var an=Object.defineProperty;var ln=(i,e,t)=>e in i?an(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var lt=(i,e,t)=>(ln(i,typeof e!="symbol"?e+"":e,t),t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function t(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(r){if(r.ep)return;r.ep=!0;const o=t(r);fetch(r.href,o)}})();const index="",common="",popup$1="",SnackbarSfc="",elevation="",loading="",button="",icon="",snackbar="",coreSfc="",cell="",CellSfc="",ripple="",formDetails="",hoverOverlay="",_switch="",SwitchSfc="",style="";function makeMap(i,e){const t=Object.create(null),s=i.split(",");for(let r=0;r!!t[r.toLowerCase()]:r=>!!t[r]}function normalizeStyle(i){if(isArray$8(i)){const e={};for(let t=0;t{if(t){const s=t.split(propertyDelimiterRE);s.length>1&&(e[s[0].trim()]=s[1].trim())}}),e}function normalizeClass(i){let e="";if(isString$2(i))e=i;else if(isArray$8(i))for(let t=0;tisString$2(i)?i:i==null?"":isArray$8(i)||isObject$4(i)&&(i.toString===objectToString$2||!isFunction$5(i.toString))?JSON.stringify(i,replacer,2):String(i),replacer=(i,e)=>e&&e.__v_isRef?replacer(i,e.value):isMap$1(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[s,r])=>(t[`${s} =>`]=r,t),{})}:isSet$1(e)?{[`Set(${e.size})`]:[...e.values()]}:isObject$4(e)&&!isArray$8(e)&&!isPlainObject$3(e)?String(e):e,EMPTY_OBJ={},EMPTY_ARR=[],NOOP=()=>{},NO=()=>!1,onRE=/^on[^a-z]/,isOn=i=>onRE.test(i),isModelListener=i=>i.startsWith("onUpdate:"),extend$3=Object.assign,remove$7=(i,e)=>{const t=i.indexOf(e);t>-1&&i.splice(t,1)},hasOwnProperty$3=Object.prototype.hasOwnProperty,hasOwn$2=(i,e)=>hasOwnProperty$3.call(i,e),isArray$8=Array.isArray,isMap$1=i=>toTypeString(i)==="[object Map]",isSet$1=i=>toTypeString(i)==="[object Set]",isFunction$5=i=>typeof i=="function",isString$2=i=>typeof i=="string",isSymbol$1=i=>typeof i=="symbol",isObject$4=i=>i!==null&&typeof i=="object",isPromise$1=i=>isObject$4(i)&&isFunction$5(i.then)&&isFunction$5(i.catch),objectToString$2=Object.prototype.toString,toTypeString=i=>objectToString$2.call(i),toRawType=i=>toTypeString(i).slice(8,-1),isPlainObject$3=i=>toTypeString(i)==="[object Object]",isIntegerKey=i=>isString$2(i)&&i!=="NaN"&&i[0]!=="-"&&""+parseInt(i,10)===i,isReservedProp=makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),cacheStringFunction=i=>{const e=Object.create(null);return t=>e[t]||(e[t]=i(t))},camelizeRE$1=/-(\w)/g,camelize$2=cacheStringFunction(i=>i.replace(camelizeRE$1,(e,t)=>t?t.toUpperCase():"")),hyphenateRE=/\B([A-Z])/g,hyphenate=cacheStringFunction(i=>i.replace(hyphenateRE,"-$1").toLowerCase()),capitalize=cacheStringFunction(i=>i.charAt(0).toUpperCase()+i.slice(1)),toHandlerKey=cacheStringFunction(i=>i?`on${capitalize(i)}`:""),hasChanged=(i,e)=>!Object.is(i,e),invokeArrayFns=(i,e)=>{for(let t=0;t{Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value:t})},looseToNumber=i=>{const e=parseFloat(i);return isNaN(e)?i:e},toNumber$1=i=>{const e=isString$2(i)?Number(i):NaN;return isNaN(e)?i: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 t=activeEffectScope;try{return activeEffectScope=this,e()}finally{activeEffectScope=t}}}on(){activeEffectScope=this}off(){activeEffectScope=this.parent}stop(e){if(this._active){let t,s;for(t=0,s=this.effects.length;t{const e=new Set(i);return e.w=0,e.n=0,e},wasTracked=i=>(i.w&trackOpBit)>0,newTracked=i=>(i.n&trackOpBit)>0,initDepMarkers=({deps:i})=>{if(i.length)for(let e=0;e{const{deps:e}=i;if(e.length){let t=0;for(let s=0;s{(m==="length"||m>=c)&&l.push(d)})}else switch(t!==void 0&&l.push(a.get(t)),e){case"add":isArray$8(i)?isIntegerKey(t)&&l.push(a.get("length")):(l.push(a.get(ITERATE_KEY)),isMap$1(i)&&l.push(a.get(MAP_KEY_ITERATE_KEY)));break;case"delete":isArray$8(i)||(l.push(a.get(ITERATE_KEY)),isMap$1(i)&&l.push(a.get(MAP_KEY_ITERATE_KEY)));break;case"set":isMap$1(i)&&l.push(a.get(ITERATE_KEY));break}if(l.length===1)l[0]&&triggerEffects(l[0]);else{const c=[];for(const d of l)d&&c.push(...d);triggerEffects(createDep(c))}}function triggerEffects(i,e){const t=isArray$8(i)?i:[...i];for(const s of t)s.computed&&triggerEffect(s);for(const s of t)s.computed||triggerEffect(s)}function triggerEffect(i,e){(i!==activeEffect||i.allowRecurse)&&(i.scheduler?i.scheduler():i.run())}const isNonTrackableKeys=makeMap("__proto__,__v_isRef,__isVue"),builtInSymbols=new Set(Object.getOwnPropertyNames(Symbol).filter(i=>i!=="arguments"&&i!=="caller").map(i=>Symbol[i]).filter(isSymbol$1)),get$1=createGetter(),shallowGet=createGetter(!1,!0),readonlyGet=createGetter(!0),arrayInstrumentations=createArrayInstrumentations();function createArrayInstrumentations(){const i={};return["includes","indexOf","lastIndexOf"].forEach(e=>{i[e]=function(...t){const s=toRaw(this);for(let o=0,a=this.length;o{i[e]=function(...t){pauseTracking();const s=toRaw(this)[e].apply(this,t);return resetTracking(),s}}),i}function hasOwnProperty$2(i){const e=toRaw(this);return track(e,"has",i),e.hasOwnProperty(i)}function createGetter(i=!1,e=!1){return function(s,r,o){if(r==="__v_isReactive")return!i;if(r==="__v_isReadonly")return i;if(r==="__v_isShallow")return e;if(r==="__v_raw"&&o===(i?e?shallowReadonlyMap:readonlyMap:e?shallowReactiveMap:reactiveMap).get(s))return s;const a=isArray$8(s);if(!i){if(a&&hasOwn$2(arrayInstrumentations,r))return Reflect.get(arrayInstrumentations,r,o);if(r==="hasOwnProperty")return hasOwnProperty$2}const l=Reflect.get(s,r,o);return(isSymbol$1(r)?builtInSymbols.has(r):isNonTrackableKeys(r))||(i||track(s,"get",r),e)?l:isRef(l)?a&&isIntegerKey(r)?l:l.value:isObject$4(l)?i?readonly(l):reactive(l):l}}const set$1=createSetter(),shallowSet=createSetter(!0);function createSetter(i=!1){return function(t,s,r,o){let a=t[s];if(isReadonly(a)&&isRef(a)&&!isRef(r))return!1;if(!i&&(!isShallow(r)&&!isReadonly(r)&&(a=toRaw(a),r=toRaw(r)),!isArray$8(t)&&isRef(a)&&!isRef(r)))return a.value=r,!0;const l=isArray$8(t)&&isIntegerKey(s)?Number(s)i,getProto$1=i=>Reflect.getPrototypeOf(i);function get$2(i,e,t=!1,s=!1){i=i.__v_raw;const r=toRaw(i),o=toRaw(e);t||(e!==o&&track(r,"get",e),track(r,"get",o));const{has:a}=getProto$1(r),l=s?toShallow:t?toReadonly:toReactive;if(a.call(r,e))return l(i.get(e));if(a.call(r,o))return l(i.get(o));i!==r&&i.get(e)}function has$4(i,e=!1){const t=this.__v_raw,s=toRaw(t),r=toRaw(i);return e||(i!==r&&track(s,"has",i),track(s,"has",r)),i===r?t.has(i):t.has(i)||t.has(r)}function size(i,e=!1){return i=i.__v_raw,!e&&track(toRaw(i),"iterate",ITERATE_KEY),Reflect.get(i,"size",i)}function add(i){i=toRaw(i);const e=toRaw(this);return getProto$1(e).has.call(e,i)||(e.add(i),trigger(e,"add",i,i)),this}function set(i,e){e=toRaw(e);const t=toRaw(this),{has:s,get:r}=getProto$1(t);let o=s.call(t,i);o||(i=toRaw(i),o=s.call(t,i));const a=r.call(t,i);return t.set(i,e),o?hasChanged(e,a)&&trigger(t,"set",i,e):trigger(t,"add",i,e),this}function deleteEntry(i){const e=toRaw(this),{has:t,get:s}=getProto$1(e);let r=t.call(e,i);r||(i=toRaw(i),r=t.call(e,i)),s&&s.call(e,i);const o=e.delete(i);return r&&trigger(e,"delete",i,void 0),o}function clear(){const i=toRaw(this),e=i.size!==0,t=i.clear();return e&&trigger(i,"clear",void 0,void 0),t}function createForEach(i,e){return function(s,r){const o=this,a=o.__v_raw,l=toRaw(a),c=e?toShallow:i?toReadonly:toReactive;return!i&&track(l,"iterate",ITERATE_KEY),a.forEach((d,m)=>s.call(r,c(d),c(m),o))}}function createIterableMethod(i,e,t){return function(...s){const r=this.__v_raw,o=toRaw(r),a=isMap$1(o),l=i==="entries"||i===Symbol.iterator&&a,c=i==="keys"&&a,d=r[i](...s),m=t?toShallow:e?toReadonly:toReactive;return!e&&track(o,"iterate",c?MAP_KEY_ITERATE_KEY:ITERATE_KEY),{next(){const{value:u,done:g}=d.next();return g?{value:u,done:g}:{value:l?[m(u[0]),m(u[1])]:m(u),done:g}},[Symbol.iterator](){return this}}}}function createReadonlyMethod(i){return function(...e){return i==="delete"?!1:this}}function createInstrumentations(){const i={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)},t={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)},s={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=>{i[o]=createIterableMethod(o,!1,!1),t[o]=createIterableMethod(o,!0,!1),e[o]=createIterableMethod(o,!1,!0),s[o]=createIterableMethod(o,!0,!0)}),[i,t,e,s]}const[mutableInstrumentations,readonlyInstrumentations,shallowInstrumentations,shallowReadonlyInstrumentations]=createInstrumentations();function createInstrumentationGetter(i,e){const t=e?i?shallowReadonlyInstrumentations:shallowInstrumentations:i?readonlyInstrumentations:mutableInstrumentations;return(s,r,o)=>r==="__v_isReactive"?!i:r==="__v_isReadonly"?i:r==="__v_raw"?s:Reflect.get(hasOwn$2(t,r)&&r in s?t:s,r,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(i){switch(i){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function getTargetType(i){return i.__v_skip||!Object.isExtensible(i)?0:targetTypeMap(toRawType(i))}function reactive(i){return isReadonly(i)?i:createReactiveObject(i,!1,mutableHandlers,mutableCollectionHandlers,reactiveMap)}function shallowReactive(i){return createReactiveObject(i,!1,shallowReactiveHandlers,shallowCollectionHandlers,shallowReactiveMap)}function readonly(i){return createReactiveObject(i,!0,readonlyHandlers,readonlyCollectionHandlers,readonlyMap)}function createReactiveObject(i,e,t,s,r){if(!isObject$4(i)||i.__v_raw&&!(e&&i.__v_isReactive))return i;const o=r.get(i);if(o)return o;const a=getTargetType(i);if(a===0)return i;const l=new Proxy(i,a===2?s:t);return r.set(i,l),l}function isReactive(i){return isReadonly(i)?isReactive(i.__v_raw):!!(i&&i.__v_isReactive)}function isReadonly(i){return!!(i&&i.__v_isReadonly)}function isShallow(i){return!!(i&&i.__v_isShallow)}function isProxy(i){return isReactive(i)||isReadonly(i)}function toRaw(i){const e=i&&i.__v_raw;return e?toRaw(e):i}function markRaw(i){return def(i,"__v_skip",!0),i}const toReactive=i=>isObject$4(i)?reactive(i):i,toReadonly=i=>isObject$4(i)?readonly(i):i;function trackRefValue(i){shouldTrack&&activeEffect&&(i=toRaw(i),trackEffects(i.dep||(i.dep=createDep())))}function triggerRefValue(i,e){i=toRaw(i);const t=i.dep;t&&triggerEffects(t)}function isRef(i){return!!(i&&i.__v_isRef===!0)}function ref(i){return createRef(i,!1)}function shallowRef(i){return createRef(i,!0)}function createRef(i,e){return isRef(i)?i:new RefImpl(i,e)}class RefImpl{constructor(e,t){this.__v_isShallow=t,this.dep=void 0,this.__v_isRef=!0,this._rawValue=t?e:toRaw(e),this._value=t?e:toReactive(e)}get value(){return trackRefValue(this),this._value}set value(e){const t=this.__v_isShallow||isShallow(e)||isReadonly(e);e=t?e:toRaw(e),hasChanged(e,this._rawValue)&&(this._rawValue=e,this._value=t?e:toReactive(e),triggerRefValue(this))}}function unref(i){return isRef(i)?i.value:i}const shallowUnwrapHandlers={get:(i,e,t)=>unref(Reflect.get(i,e,t)),set:(i,e,t,s)=>{const r=i[e];return isRef(r)&&!isRef(t)?(r.value=t,!0):Reflect.set(i,e,t,s)}};function proxyRefs(i){return isReactive(i)?i:new Proxy(i,shallowUnwrapHandlers)}var _a$1;class ComputedRefImpl{constructor(e,t,s,r){this._setter=t,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=!r,this.__v_isReadonly=s}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(i,e,t=!1){let s,r;const o=isFunction$5(i);return o?(s=i,r=NOOP):(s=i.get,r=i.set),new ComputedRefImpl(s,r,o||!r,t)}function warn(i,...e){}function callWithErrorHandling(i,e,t,s){let r;try{r=s?i(...s):i()}catch(o){handleError(o,e,t)}return r}function callWithAsyncErrorHandling(i,e,t,s){if(isFunction$5(i)){const o=callWithErrorHandling(i,e,t,s);return o&&isPromise$1(o)&&o.catch(a=>{handleError(a,e,t)}),o}const r=[];for(let o=0;o>>1;getId(queue$1[s])flushIndex&&queue$1.splice(e,1)}function queuePostFlushCb(i){isArray$8(i)?pendingPostFlushCbs.push(...i):(!activePostFlushCbs||!activePostFlushCbs.includes(i,i.allowRecurse?postFlushIndex+1:postFlushIndex))&&pendingPostFlushCbs.push(i),queueFlush()}function flushPreFlushCbs(i,e=isFlushing?flushIndex+1:0){for(;egetId(t)-getId(s)),postFlushIndex=0;postFlushIndexi.id==null?1/0:i.id,comparator=(i,e)=>{const t=getId(i)-getId(e);if(t===0){if(i.pre&&!e.pre)return-1;if(e.pre&&!i.pre)return 1}return t};function flushJobs(i){isFlushPending=!1,isFlushing=!0,queue$1.sort(comparator);const e=NOOP;try{for(flushIndex=0;flushIndexisString$2(b)?b.trim():b)),u&&(r=t.map(looseToNumber))}let l,c=s[l=toHandlerKey(e)]||s[l=toHandlerKey(camelize$2(e))];!c&&o&&(c=s[l=toHandlerKey(hyphenate(e))]),c&&callWithAsyncErrorHandling(c,i,6,r);const d=s[l+"Once"];if(d){if(!i.emitted)i.emitted={};else if(i.emitted[l])return;i.emitted[l]=!0,callWithAsyncErrorHandling(d,i,6,r)}}function normalizeEmitsOptions(i,e,t=!1){const s=e.emitsCache,r=s.get(i);if(r!==void 0)return r;const o=i.emits;let a={},l=!1;if(!isFunction$5(i)){const c=d=>{const m=normalizeEmitsOptions(d,e,!0);m&&(l=!0,extend$3(a,m))};!t&&e.mixins.length&&e.mixins.forEach(c),i.extends&&c(i.extends),i.mixins&&i.mixins.forEach(c)}return!o&&!l?(isObject$4(i)&&s.set(i,null),null):(isArray$8(o)?o.forEach(c=>a[c]=null):extend$3(a,o),isObject$4(i)&&s.set(i,a),a)}function isEmitListener(i,e){return!i||!isOn(e)?!1:(e=e.slice(2).replace(/Once$/,""),hasOwn$2(i,e[0].toLowerCase()+e.slice(1))||hasOwn$2(i,hyphenate(e))||hasOwn$2(i,e))}let currentRenderingInstance=null,currentScopeId=null;function setCurrentRenderingInstance(i){const e=currentRenderingInstance;return currentRenderingInstance=i,currentScopeId=i&&i.type.__scopeId||null,e}function pushScopeId(i){currentScopeId=i}function popScopeId(){currentScopeId=null}function withCtx(i,e=currentRenderingInstance,t){if(!e||i._n)return i;const s=(...r)=>{s._d&&setBlockTracking(-1);const o=setCurrentRenderingInstance(e);let a;try{a=i(...r)}finally{setCurrentRenderingInstance(o),s._d&&setBlockTracking(1)}return a};return s._n=!0,s._c=!0,s._d=!0,s}function markAttrsAccessed(){}function renderComponentRoot(i){const{type:e,vnode:t,proxy:s,withProxy:r,props:o,propsOptions:[a],slots:l,attrs:c,emit:d,render:m,renderCache:u,data:g,setupState:b,ctx:y,inheritAttrs:S}=i;let v,x;const A=setCurrentRenderingInstance(i);try{if(t.shapeFlag&4){const _=r||s;v=normalizeVNode(m.call(_,_,u,o,b,g,y)),x=c}else{const _=e;v=normalizeVNode(_.length>1?_(o,{attrs:c,slots:l,emit:d}):_(o,null)),x=e.props?c:getFunctionalFallthrough(c)}}catch(_){blockStack.length=0,handleError(_,i,1),v=createVNode(Comment)}let E=v;if(x&&S!==!1){const _=Object.keys(x),{shapeFlag:w}=E;_.length&&w&7&&(a&&_.some(isModelListener)&&(x=filterModelListeners(x,a)),E=cloneVNode(E,x))}return t.dirs&&(E=cloneVNode(E),E.dirs=E.dirs?E.dirs.concat(t.dirs):t.dirs),t.transition&&(E.transition=t.transition),v=E,setCurrentRenderingInstance(A),v}const getFunctionalFallthrough=i=>{let e;for(const t in i)(t==="class"||t==="style"||isOn(t))&&((e||(e={}))[t]=i[t]);return e},filterModelListeners=(i,e)=>{const t={};for(const s in i)(!isModelListener(s)||!(s.slice(9)in e))&&(t[s]=i[s]);return t};function shouldUpdateComponent(i,e,t){const{props:s,children:r,component:o}=i,{props:a,children:l,patchFlag:c}=e,d=o.emitsOptions;if(e.dirs||e.transition)return!0;if(t&&c>=0){if(c&1024)return!0;if(c&16)return s?hasPropsChanged(s,a,d):!!a;if(c&8){const m=e.dynamicProps;for(let u=0;ui.__isSuspense;function queueEffectWithSuspense(i,e){e&&e.pendingBranch?isArray$8(i)?e.effects.push(...i):e.effects.push(i):queuePostFlushCb(i)}function provide(i,e){if(currentInstance){let t=currentInstance.provides;const s=currentInstance.parent&¤tInstance.parent.provides;s===t&&(t=currentInstance.provides=Object.create(s)),t[i]=e}}function inject(i,e,t=!1){const s=currentInstance||currentRenderingInstance;if(s){const r=s.parent==null?s.vnode.appContext&&s.vnode.appContext.provides:s.parent.provides;if(r&&i in r)return r[i];if(arguments.length>1)return t&&isFunction$5(e)?e.call(s.proxy):e}}function watchEffect(i,e){return doWatch(i,null,e)}const INITIAL_WATCHER_VALUE={};function watch(i,e,t){return doWatch(i,e,t)}function doWatch(i,e,{immediate:t,deep:s,flush:r,onTrack:o,onTrigger:a}=EMPTY_OBJ){const l=getCurrentScope()===(currentInstance==null?void 0:currentInstance.scope)?currentInstance:null;let c,d=!1,m=!1;if(isRef(i)?(c=()=>i.value,d=isShallow(i)):isReactive(i)?(c=()=>i,s=!0):isArray$8(i)?(m=!0,d=i.some(E=>isReactive(E)||isShallow(E)),c=()=>i.map(E=>{if(isRef(E))return E.value;if(isReactive(E))return traverse(E);if(isFunction$5(E))return callWithErrorHandling(E,l,2)})):isFunction$5(i)?e?c=()=>callWithErrorHandling(i,l,2):c=()=>{if(!(l&&l.isUnmounted))return u&&u(),callWithAsyncErrorHandling(i,l,3,[g])}:c=NOOP,e&&s){const E=c;c=()=>traverse(E())}let u,g=E=>{u=x.onStop=()=>{callWithErrorHandling(E,l,4)}},b;if(isInSSRComponentSetup)if(g=NOOP,e?t&&callWithAsyncErrorHandling(e,l,3,[c(),m?[]:void 0,g]):c(),r==="sync"){const E=useSSRContext();b=E.__watcherHandles||(E.__watcherHandles=[])}else return NOOP;let y=m?new Array(i.length).fill(INITIAL_WATCHER_VALUE):INITIAL_WATCHER_VALUE;const S=()=>{if(x.active)if(e){const E=x.run();(s||d||(m?E.some((_,w)=>hasChanged(_,y[w])):hasChanged(E,y)))&&(u&&u(),callWithAsyncErrorHandling(e,l,3,[E,y===INITIAL_WATCHER_VALUE?void 0:m&&y[0]===INITIAL_WATCHER_VALUE?[]:y,g]),y=E)}else x.run()};S.allowRecurse=!!e;let v;r==="sync"?v=S:r==="post"?v=()=>queuePostRenderEffect(S,l&&l.suspense):(S.pre=!0,l&&(S.id=l.uid),v=()=>queueJob(S));const x=new ReactiveEffect(c,v);e?t?S():y=x.run():r==="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 b&&b.push(A),A}function instanceWatch(i,e,t){const s=this.proxy,r=isString$2(i)?i.includes(".")?createPathGetter(s,i):()=>s[i]:i.bind(s,s);let o;isFunction$5(e)?o=e:(o=e.handler,t=e);const a=currentInstance;setCurrentInstance(this);const l=doWatch(r,o.bind(s),t);return a?setCurrentInstance(a):unsetCurrentInstance(),l}function createPathGetter(i,e){const t=e.split(".");return()=>{let s=i;for(let r=0;r{traverse(t,e)});else if(isPlainObject$3(i))for(const t in i)traverse(i[t],e);return i}function useTransitionState(){const i={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return onMounted(()=>{i.isMounted=!0}),onBeforeUnmount(()=>{i.isUnmounting=!0}),i}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(i,{slots:e}){const t=getCurrentInstance(),s=useTransitionState();let r;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(i),{mode:c}=l;if(s.isLeaving)return emptyPlaceholder(a);const d=getKeepAliveChild(a);if(!d)return emptyPlaceholder(a);const m=resolveTransitionHooks(d,l,s,t);setTransitionHooks(d,m);const u=t.subTree,g=u&&getKeepAliveChild(u);let b=!1;const{getTransitionKey:y}=d.type;if(y){const S=y();r===void 0?r=S:S!==r&&(r=S,b=!0)}if(g&&g.type!==Comment&&(!isSameVNodeType(d,g)||b)){const S=resolveTransitionHooks(g,l,s,t);if(setTransitionHooks(g,S),c==="out-in")return s.isLeaving=!0,S.afterLeave=()=>{s.isLeaving=!1,t.update.active!==!1&&t.update()},emptyPlaceholder(a);c==="in-out"&&d.type!==Comment&&(S.delayLeave=(v,x,A)=>{const E=getLeavingNodesForType(s,g);E[String(g.key)]=g,v._leaveCb=()=>{x(),v._leaveCb=void 0,delete m.delayedLeave},m.delayedLeave=A})}return a}}},BaseTransition=BaseTransitionImpl;function getLeavingNodesForType(i,e){const{leavingVNodes:t}=i;let s=t.get(e.type);return s||(s=Object.create(null),t.set(e.type,s)),s}function resolveTransitionHooks(i,e,t,s){const{appear:r,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:d,onEnterCancelled:m,onBeforeLeave:u,onLeave:g,onAfterLeave:b,onLeaveCancelled:y,onBeforeAppear:S,onAppear:v,onAfterAppear:x,onAppearCancelled:A}=e,E=String(i.key),_=getLeavingNodesForType(t,i),w=(I,N)=>{I&&callWithAsyncErrorHandling(I,s,9,N)},C=(I,N)=>{const R=N[1];w(I,N),isArray$8(I)?I.every(F=>F.length<=1)&&R():I.length<=1&&R()},P={mode:o,persisted:a,beforeEnter(I){let N=l;if(!t.isMounted)if(r)N=S||l;else return;I._leaveCb&&I._leaveCb(!0);const R=_[E];R&&isSameVNodeType(i,R)&&R.el._leaveCb&&R.el._leaveCb(),w(N,[I])},enter(I){let N=c,R=d,F=m;if(!t.isMounted)if(r)N=v||c,R=x||d,F=A||m;else return;let B=!1;const k=I._enterCb=M=>{B||(B=!0,M?w(F,[I]):w(R,[I]),P.delayedLeave&&P.delayedLeave(),I._enterCb=void 0)};N?C(N,[I,k]):k()},leave(I,N){const R=String(i.key);if(I._enterCb&&I._enterCb(!0),t.isUnmounting)return N();w(u,[I]);let F=!1;const B=I._leaveCb=k=>{F||(F=!0,N(),k?w(y,[I]):w(b,[I]),I._leaveCb=void 0,_[R]===i&&delete _[R])};_[R]=i,g?C(g,[I,B]):B()},clone(I){return resolveTransitionHooks(I,e,t,s)}};return P}function emptyPlaceholder(i){if(isKeepAlive(i))return i=cloneVNode(i),i.children=null,i}function getKeepAliveChild(i){return isKeepAlive(i)?i.children?i.children[0]:void 0:i}function setTransitionHooks(i,e){i.shapeFlag&6&&i.component?setTransitionHooks(i.component.subTree,e):i.shapeFlag&128?(i.ssContent.transition=e.clone(i.ssContent),i.ssFallback.transition=e.clone(i.ssFallback)):i.transition=e}function getTransitionRawChildren(i,e=!1,t){let s=[],r=0;for(let o=0;o1)for(let o=0;o!!i.type.__asyncLoader,isKeepAlive=i=>i.type.__isKeepAlive;function onActivated(i,e){registerKeepAliveHook(i,"a",e)}function onDeactivated(i,e){registerKeepAliveHook(i,"da",e)}function registerKeepAliveHook(i,e,t=currentInstance){const s=i.__wdc||(i.__wdc=()=>{let r=t;for(;r;){if(r.isDeactivated)return;r=r.parent}return i()});if(injectHook(e,s,t),t){let r=t.parent;for(;r&&r.parent;)isKeepAlive(r.parent.vnode)&&injectToKeepAliveRoot(s,e,t,r),r=r.parent}}function injectToKeepAliveRoot(i,e,t,s){const r=injectHook(e,i,s,!0);onUnmounted(()=>{remove$7(s[e],r)},t)}function injectHook(i,e,t=currentInstance,s=!1){if(t){const r=t[i]||(t[i]=[]),o=e.__weh||(e.__weh=(...a)=>{if(t.isUnmounted)return;pauseTracking(),setCurrentInstance(t);const l=callWithAsyncErrorHandling(e,t,i,a);return unsetCurrentInstance(),resetTracking(),l});return s?r.unshift(o):r.push(o),o}}const createHook=i=>(e,t=currentInstance)=>(!isInSSRComponentSetup||i==="sp")&&injectHook(i,(...s)=>e(...s),t),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(i,e=currentInstance){injectHook("ec",i,e)}function withDirectives(i,e){const t=currentRenderingInstance;if(t===null)return i;const s=getExposeProxy(t)||t.proxy,r=i.dirs||(i.dirs=[]);for(let o=0;oe(a,l,void 0,o&&o[l]));else{const a=Object.keys(i);r=new Array(a.length);for(let l=0,c=a.length;lisVNode(e)?!(e.type===Comment||e.type===Fragment&&!ensureValidVNode(e.children)):!0)?i:null}const getPublicInstance=i=>i?isStatefulComponent(i)?getExposeProxy(i)||i.proxy:getPublicInstance(i.parent):null,publicPropertiesMap=extend$3(Object.create(null),{$:i=>i,$el:i=>i.vnode.el,$data:i=>i.data,$props:i=>i.props,$attrs:i=>i.attrs,$slots:i=>i.slots,$refs:i=>i.refs,$parent:i=>getPublicInstance(i.parent),$root:i=>getPublicInstance(i.root),$emit:i=>i.emit,$options:i=>resolveMergedOptions(i),$forceUpdate:i=>i.f||(i.f=()=>queueJob(i.update)),$nextTick:i=>i.n||(i.n=nextTick.bind(i.proxy)),$watch:i=>instanceWatch.bind(i)}),hasSetupBinding=(i,e)=>i!==EMPTY_OBJ&&!i.__isScriptSetup&&hasOwn$2(i,e),PublicInstanceProxyHandlers={get({_:i},e){const{ctx:t,setupState:s,data:r,props:o,accessCache:a,type:l,appContext:c}=i;let d;if(e[0]!=="$"){const b=a[e];if(b!==void 0)switch(b){case 1:return s[e];case 2:return r[e];case 4:return t[e];case 3:return o[e]}else{if(hasSetupBinding(s,e))return a[e]=1,s[e];if(r!==EMPTY_OBJ&&hasOwn$2(r,e))return a[e]=2,r[e];if((d=i.propsOptions[0])&&hasOwn$2(d,e))return a[e]=3,o[e];if(t!==EMPTY_OBJ&&hasOwn$2(t,e))return a[e]=4,t[e];shouldCacheAccess&&(a[e]=0)}}const m=publicPropertiesMap[e];let u,g;if(m)return e==="$attrs"&&track(i,"get",e),m(i);if((u=l.__cssModules)&&(u=u[e]))return u;if(t!==EMPTY_OBJ&&hasOwn$2(t,e))return a[e]=4,t[e];if(g=c.config.globalProperties,hasOwn$2(g,e))return g[e]},set({_:i},e,t){const{data:s,setupState:r,ctx:o}=i;return hasSetupBinding(r,e)?(r[e]=t,!0):s!==EMPTY_OBJ&&hasOwn$2(s,e)?(s[e]=t,!0):hasOwn$2(i.props,e)||e[0]==="$"&&e.slice(1)in i?!1:(o[e]=t,!0)},has({_:{data:i,setupState:e,accessCache:t,ctx:s,appContext:r,propsOptions:o}},a){let l;return!!t[a]||i!==EMPTY_OBJ&&hasOwn$2(i,a)||hasSetupBinding(e,a)||(l=o[0])&&hasOwn$2(l,a)||hasOwn$2(s,a)||hasOwn$2(publicPropertiesMap,a)||hasOwn$2(r.config.globalProperties,a)},defineProperty(i,e,t){return t.get!=null?i._.accessCache[e]=0:hasOwn$2(t,"value")&&this.set(i,e,t.value,null),Reflect.defineProperty(i,e,t)}};let shouldCacheAccess=!0;function applyOptions(i){const e=resolveMergedOptions(i),t=i.proxy,s=i.ctx;shouldCacheAccess=!1,e.beforeCreate&&callHook$1(e.beforeCreate,i,"bc");const{data:r,computed:o,methods:a,watch:l,provide:c,inject:d,created:m,beforeMount:u,mounted:g,beforeUpdate:b,updated:y,activated:S,deactivated:v,beforeDestroy:x,beforeUnmount:A,destroyed:E,unmounted:_,render:w,renderTracked:C,renderTriggered:P,errorCaptured:I,serverPrefetch:N,expose:R,inheritAttrs:F,components:B,directives:k,filters:M}=e;if(d&&resolveInjections(d,s,null,i.appContext.config.unwrapInjectedRef),a)for(const $ in a){const re=a[$];isFunction$5(re)&&(s[$]=re.bind(t))}if(r){const $=r.call(t,t);isObject$4($)&&(i.data=reactive($))}if(shouldCacheAccess=!0,o)for(const $ in o){const re=o[$],ie=isFunction$5(re)?re.bind(t,t):isFunction$5(re.get)?re.get.bind(t,t):NOOP,de=!isFunction$5(re)&&isFunction$5(re.set)?re.set.bind(t):NOOP,Q=computed({get:ie,set:de});Object.defineProperty(s,$,{enumerable:!0,configurable:!0,get:()=>Q.value,set:H=>Q.value=H})}if(l)for(const $ in l)createWatcher(l[$],s,t,$);if(c){const $=isFunction$5(c)?c.call(t):c;Reflect.ownKeys($).forEach(re=>{provide(re,$[re])})}m&&callHook$1(m,i,"c");function ee($,re){isArray$8(re)?re.forEach(ie=>$(ie.bind(t))):re&&$(re.bind(t))}if(ee(onBeforeMount,u),ee(onMounted,g),ee(onBeforeUpdate,b),ee(onUpdated,y),ee(onActivated,S),ee(onDeactivated,v),ee(onErrorCaptured,I),ee(onRenderTracked,C),ee(onRenderTriggered,P),ee(onBeforeUnmount,A),ee(onUnmounted,_),ee(onServerPrefetch,N),isArray$8(R))if(R.length){const $=i.exposed||(i.exposed={});R.forEach(re=>{Object.defineProperty($,re,{get:()=>t[re],set:ie=>t[re]=ie})})}else i.exposed||(i.exposed={});w&&i.render===NOOP&&(i.render=w),F!=null&&(i.inheritAttrs=F),B&&(i.components=B),k&&(i.directives=k)}function resolveInjections(i,e,t=NOOP,s=!1){isArray$8(i)&&(i=normalizeInject(i));for(const r in i){const o=i[r];let a;isObject$4(o)?"default"in o?a=inject(o.from||r,o.default,!0):a=inject(o.from||r):a=inject(o),isRef(a)&&s?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>a.value,set:l=>a.value=l}):e[r]=a}}function callHook$1(i,e,t){callWithAsyncErrorHandling(isArray$8(i)?i.map(s=>s.bind(e.proxy)):i.bind(e.proxy),e,t)}function createWatcher(i,e,t,s){const r=s.includes(".")?createPathGetter(t,s):()=>t[s];if(isString$2(i)){const o=e[i];isFunction$5(o)&&watch(r,o)}else if(isFunction$5(i))watch(r,i.bind(t));else if(isObject$4(i))if(isArray$8(i))i.forEach(o=>createWatcher(o,e,t,s));else{const o=isFunction$5(i.handler)?i.handler.bind(t):e[i.handler];isFunction$5(o)&&watch(r,o,i)}}function resolveMergedOptions(i){const e=i.type,{mixins:t,extends:s}=e,{mixins:r,optionsCache:o,config:{optionMergeStrategies:a}}=i.appContext,l=o.get(e);let c;return l?c=l:!r.length&&!t&&!s?c=e:(c={},r.length&&r.forEach(d=>mergeOptions$1(c,d,a,!0)),mergeOptions$1(c,e,a)),isObject$4(e)&&o.set(e,c),c}function mergeOptions$1(i,e,t,s=!1){const{mixins:r,extends:o}=e;o&&mergeOptions$1(i,o,t,!0),r&&r.forEach(a=>mergeOptions$1(i,a,t,!0));for(const a in e)if(!(s&&a==="expose")){const l=internalOptionMergeStrats[a]||t&&t[a];i[a]=l?l(i[a],e[a]):e[a]}return i}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(i,e){return e?i?function(){return extend$3(isFunction$5(i)?i.call(this,this):i,isFunction$5(e)?e.call(this,this):e)}:e:i}function mergeInject(i,e){return mergeObjectOptions(normalizeInject(i),normalizeInject(e))}function normalizeInject(i){if(isArray$8(i)){const e={};for(let t=0;t0)&&!(a&16)){if(a&8){const m=i.vnode.dynamicProps;for(let u=0;u{c=!0;const[g,b]=normalizePropsOptions(u,e,!0);extend$3(a,g),b&&l.push(...b)};!t&&e.mixins.length&&e.mixins.forEach(m),i.extends&&m(i.extends),i.mixins&&i.mixins.forEach(m)}if(!o&&!c)return isObject$4(i)&&s.set(i,EMPTY_ARR),EMPTY_ARR;if(isArray$8(o))for(let m=0;m-1,b[1]=S<0||y-1||hasOwn$2(b,"default"))&&l.push(u)}}}const d=[a,l];return isObject$4(i)&&s.set(i,d),d}function validatePropName(i){return i[0]!=="$"}function getType(i){const e=i&&i.toString().match(/^\s*(function|class) (\w+)/);return e?e[2]:i===null?"null":""}function isSameType(i,e){return getType(i)===getType(e)}function getTypeIndex(i,e){return isArray$8(e)?e.findIndex(t=>isSameType(t,i)):isFunction$5(e)&&isSameType(e,i)?0:-1}const isInternalKey=i=>i[0]==="_"||i==="$stable",normalizeSlotValue=i=>isArray$8(i)?i.map(normalizeVNode):[normalizeVNode(i)],normalizeSlot$1=(i,e,t)=>{if(e._n)return e;const s=withCtx((...r)=>normalizeSlotValue(e(...r)),t);return s._c=!1,s},normalizeObjectSlots=(i,e,t)=>{const s=i._ctx;for(const r in i){if(isInternalKey(r))continue;const o=i[r];if(isFunction$5(o))e[r]=normalizeSlot$1(r,o,s);else if(o!=null){const a=normalizeSlotValue(o);e[r]=()=>a}}},normalizeVNodeSlots=(i,e)=>{const t=normalizeSlotValue(e);i.slots.default=()=>t},initSlots=(i,e)=>{if(i.vnode.shapeFlag&32){const t=e._;t?(i.slots=toRaw(e),def(e,"_",t)):normalizeObjectSlots(e,i.slots={})}else i.slots={},e&&normalizeVNodeSlots(i,e);def(i.slots,InternalObjectKey,1)},updateSlots=(i,e,t)=>{const{vnode:s,slots:r}=i;let o=!0,a=EMPTY_OBJ;if(s.shapeFlag&32){const l=e._;l?t&&l===1?o=!1:(extend$3(r,e),!t&&l===1&&delete r._):(o=!e.$stable,normalizeObjectSlots(e,r)),a=e}else e&&(normalizeVNodeSlots(i,e),a={default:1});if(o)for(const l in r)!isInternalKey(l)&&!(l in a)&&delete r[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(i,e){return function(s,r=null){isFunction$5(s)||(s=Object.assign({},s)),r!=null&&!isObject$4(r)&&(r=null);const o=createAppContext(),a=new Set;let l=!1;const c=o.app={_uid:uid$1++,_component:s,_props:r,_container:null,_context:o,_instance:null,version,get config(){return o.config},set config(d){},use(d,...m){return a.has(d)||(d&&isFunction$5(d.install)?(a.add(d),d.install(c,...m)):isFunction$5(d)&&(a.add(d),d(c,...m))),c},mixin(d){return o.mixins.includes(d)||o.mixins.push(d),c},component(d,m){return m?(o.components[d]=m,c):o.components[d]},directive(d,m){return m?(o.directives[d]=m,c):o.directives[d]},mount(d,m,u){if(!l){const g=createVNode(s,r);return g.appContext=o,m&&e?e(g,d):i(g,d,u),l=!0,c._container=d,d.__vue_app__=c,getExposeProxy(g.component)||g.component.proxy}},unmount(){l&&(i(null,c._container),delete c._container.__vue_app__)},provide(d,m){return o.provides[d]=m,c}};return c}}function setRef(i,e,t,s,r=!1){if(isArray$8(i)){i.forEach((g,b)=>setRef(g,e&&(isArray$8(e)?e[b]:e),t,s,r));return}if(isAsyncWrapper(s)&&!r)return;const o=s.shapeFlag&4?getExposeProxy(s.component)||s.component.proxy:s.el,a=r?null:o,{i:l,r:c}=i,d=e&&e.r,m=l.refs===EMPTY_OBJ?l.refs={}:l.refs,u=l.setupState;if(d!=null&&d!==c&&(isString$2(d)?(m[d]=null,hasOwn$2(u,d)&&(u[d]=null)):isRef(d)&&(d.value=null)),isFunction$5(c))callWithErrorHandling(c,l,12,[a,m]);else{const g=isString$2(c),b=isRef(c);if(g||b){const y=()=>{if(i.f){const S=g?hasOwn$2(u,c)?u[c]:m[c]:c.value;r?isArray$8(S)&&remove$7(S,o):isArray$8(S)?S.includes(o)||S.push(o):g?(m[c]=[o],hasOwn$2(u,c)&&(u[c]=m[c])):(c.value=[o],i.k&&(m[i.k]=c.value))}else g?(m[c]=a,hasOwn$2(u,c)&&(u[c]=a)):b&&(c.value=a,i.k&&(m[i.k]=a))};a?(y.id=-1,queuePostRenderEffect(y,t)):y()}}}const queuePostRenderEffect=queueEffectWithSuspense;function createRenderer(i){return baseCreateRenderer(i)}function baseCreateRenderer(i,e){const t=getGlobalThis();t.__VUE__=!0;const{insert:s,remove:r,patchProp:o,createElement:a,createText:l,createComment:c,setText:d,setElementText:m,parentNode:u,nextSibling:g,setScopeId:b=NOOP,insertStaticContent:y}=i,S=(z,J,T,q=null,Y=null,O=null,V=!1,U=null,se=!!J.dynamicChildren)=>{if(z===J)return;z&&!isSameVNodeType(z,J)&&(q=he(z),H(z,Y,O,!0),z=null),J.patchFlag===-2&&(se=!1,J.dynamicChildren=null);const{type:te,ref:K,shapeFlag:ae}=J;switch(te){case Text:v(z,J,T,q);break;case Comment:x(z,J,T,q);break;case Static:z==null&&A(J,T,q,V);break;case Fragment:B(z,J,T,q,Y,O,V,U,se);break;default:ae&1?w(z,J,T,q,Y,O,V,U,se):ae&6?k(z,J,T,q,Y,O,V,U,se):(ae&64||ae&128)&&te.process(z,J,T,q,Y,O,V,U,se,me)}K!=null&&Y&&setRef(K,z&&z.ref,O,J||z,!J)},v=(z,J,T,q)=>{if(z==null)s(J.el=l(J.children),T,q);else{const Y=J.el=z.el;J.children!==z.children&&d(Y,J.children)}},x=(z,J,T,q)=>{z==null?s(J.el=c(J.children||""),T,q):J.el=z.el},A=(z,J,T,q)=>{[z.el,z.anchor]=y(z.children,J,T,q,z.el,z.anchor)},E=({el:z,anchor:J},T,q)=>{let Y;for(;z&&z!==J;)Y=g(z),s(z,T,q),z=Y;s(J,T,q)},_=({el:z,anchor:J})=>{let T;for(;z&&z!==J;)T=g(z),r(z),z=T;r(J)},w=(z,J,T,q,Y,O,V,U,se)=>{V=V||J.type==="svg",z==null?C(J,T,q,Y,O,V,U,se):N(z,J,Y,O,V,U,se)},C=(z,J,T,q,Y,O,V,U)=>{let se,te;const{type:K,props:ae,shapeFlag:fe,transition:pe,dirs:ye}=z;if(se=z.el=a(z.type,O,ae&&ae.is,ae),fe&8?m(se,z.children):fe&16&&I(z.children,se,null,q,Y,O&&K!=="foreignObject",V,U),ye&&invokeDirectiveHook(z,null,q,"created"),P(se,z,z.scopeId,V,q),ae){for(const ce in ae)ce!=="value"&&!isReservedProp(ce)&&o(se,ce,null,ae[ce],O,z.children,q,Y,oe);"value"in ae&&o(se,"value",null,ae.value),(te=ae.onVnodeBeforeMount)&&invokeVNodeHook(te,q,z)}ye&&invokeDirectiveHook(z,null,q,"beforeMount");const ve=(!Y||Y&&!Y.pendingBranch)&&pe&&!pe.persisted;ve&&pe.beforeEnter(se),s(se,J,T),((te=ae&&ae.onVnodeMounted)||ve||ye)&&queuePostRenderEffect(()=>{te&&invokeVNodeHook(te,q,z),ve&&pe.enter(se),ye&&invokeDirectiveHook(z,null,q,"mounted")},Y)},P=(z,J,T,q,Y)=>{if(T&&b(z,T),q)for(let O=0;O{for(let te=se;te{const U=J.el=z.el;let{patchFlag:se,dynamicChildren:te,dirs:K}=J;se|=z.patchFlag&16;const ae=z.props||EMPTY_OBJ,fe=J.props||EMPTY_OBJ;let pe;T&&toggleRecurse(T,!1),(pe=fe.onVnodeBeforeUpdate)&&invokeVNodeHook(pe,T,J,z),K&&invokeDirectiveHook(J,z,T,"beforeUpdate"),T&&toggleRecurse(T,!0);const ye=Y&&J.type!=="foreignObject";if(te?R(z.dynamicChildren,te,U,T,q,ye,O):V||re(z,J,U,null,T,q,ye,O,!1),se>0){if(se&16)F(U,J,ae,fe,T,q,Y);else if(se&2&&ae.class!==fe.class&&o(U,"class",null,fe.class,Y),se&4&&o(U,"style",ae.style,fe.style,Y),se&8){const ve=J.dynamicProps;for(let ce=0;ce{pe&&invokeVNodeHook(pe,T,J,z),K&&invokeDirectiveHook(J,z,T,"updated")},q)},R=(z,J,T,q,Y,O,V)=>{for(let U=0;U{if(T!==q){if(T!==EMPTY_OBJ)for(const U in T)!isReservedProp(U)&&!(U in q)&&o(z,U,T[U],null,V,J.children,Y,O,oe);for(const U in q){if(isReservedProp(U))continue;const se=q[U],te=T[U];se!==te&&U!=="value"&&o(z,U,te,se,V,J.children,Y,O,oe)}"value"in q&&o(z,"value",T.value,q.value)}},B=(z,J,T,q,Y,O,V,U,se)=>{const te=J.el=z?z.el:l(""),K=J.anchor=z?z.anchor:l("");let{patchFlag:ae,dynamicChildren:fe,slotScopeIds:pe}=J;pe&&(U=U?U.concat(pe):pe),z==null?(s(te,T,q),s(K,T,q),I(J.children,T,K,Y,O,V,U,se)):ae>0&&ae&64&&fe&&z.dynamicChildren?(R(z.dynamicChildren,fe,T,Y,O,V,U),(J.key!=null||Y&&J===Y.subTree)&&traverseStaticChildren(z,J,!0)):re(z,J,T,K,Y,O,V,U,se)},k=(z,J,T,q,Y,O,V,U,se)=>{J.slotScopeIds=U,z==null?J.shapeFlag&512?Y.ctx.activate(J,T,q,V,se):M(J,T,q,Y,O,V,se):G(z,J,se)},M=(z,J,T,q,Y,O,V)=>{const U=z.component=createComponentInstance(z,q,Y);if(isKeepAlive(z)&&(U.ctx.renderer=me),setupComponent(U),U.asyncDep){if(Y&&Y.registerDep(U,ee),!z.el){const se=U.subTree=createVNode(Comment);x(null,se,J,T)}return}ee(U,z,J,T,Y,O,V)},G=(z,J,T)=>{const q=J.component=z.component;if(shouldUpdateComponent(z,J,T))if(q.asyncDep&&!q.asyncResolved){$(q,J,T);return}else q.next=J,invalidateJob(q.update),q.update();else J.el=z.el,q.vnode=J},ee=(z,J,T,q,Y,O,V)=>{const U=()=>{if(z.isMounted){let{next:K,bu:ae,u:fe,parent:pe,vnode:ye}=z,ve=K,ce;toggleRecurse(z,!1),K?(K.el=ye.el,$(z,K,V)):K=ye,ae&&invokeArrayFns(ae),(ce=K.props&&K.props.onVnodeBeforeUpdate)&&invokeVNodeHook(ce,pe,K,ye),toggleRecurse(z,!0);const Se=renderComponentRoot(z),we=z.subTree;z.subTree=Se,S(we,Se,u(we.el),he(we),z,Y,O),K.el=Se.el,ve===null&&updateHOCHostEl(z,Se.el),fe&&queuePostRenderEffect(fe,Y),(ce=K.props&&K.props.onVnodeUpdated)&&queuePostRenderEffect(()=>invokeVNodeHook(ce,pe,K,ye),Y)}else{let K;const{el:ae,props:fe}=J,{bm:pe,m:ye,parent:ve}=z,ce=isAsyncWrapper(J);if(toggleRecurse(z,!1),pe&&invokeArrayFns(pe),!ce&&(K=fe&&fe.onVnodeBeforeMount)&&invokeVNodeHook(K,ve,J),toggleRecurse(z,!0),ae&&be){const Se=()=>{z.subTree=renderComponentRoot(z),be(ae,z.subTree,z,Y,null)};ce?J.type.__asyncLoader().then(()=>!z.isUnmounted&&Se()):Se()}else{const Se=z.subTree=renderComponentRoot(z);S(null,Se,T,q,z,Y,O),J.el=Se.el}if(ye&&queuePostRenderEffect(ye,Y),!ce&&(K=fe&&fe.onVnodeMounted)){const Se=J;queuePostRenderEffect(()=>invokeVNodeHook(K,ve,Se),Y)}(J.shapeFlag&256||ve&&isAsyncWrapper(ve.vnode)&&ve.vnode.shapeFlag&256)&&z.a&&queuePostRenderEffect(z.a,Y),z.isMounted=!0,J=T=q=null}},se=z.effect=new ReactiveEffect(U,()=>queueJob(te),z.scope),te=z.update=()=>se.run();te.id=z.uid,toggleRecurse(z,!0),te()},$=(z,J,T)=>{J.component=z;const q=z.vnode.props;z.vnode=J,z.next=null,updateProps(z,J.props,q,T),updateSlots(z,J.children,T),pauseTracking(),flushPreFlushCbs(),resetTracking()},re=(z,J,T,q,Y,O,V,U,se=!1)=>{const te=z&&z.children,K=z?z.shapeFlag:0,ae=J.children,{patchFlag:fe,shapeFlag:pe}=J;if(fe>0){if(fe&128){de(te,ae,T,q,Y,O,V,U,se);return}else if(fe&256){ie(te,ae,T,q,Y,O,V,U,se);return}}pe&8?(K&16&&oe(te,Y,O),ae!==te&&m(T,ae)):K&16?pe&16?de(te,ae,T,q,Y,O,V,U,se):oe(te,Y,O,!0):(K&8&&m(T,""),pe&16&&I(ae,T,q,Y,O,V,U,se))},ie=(z,J,T,q,Y,O,V,U,se)=>{z=z||EMPTY_ARR,J=J||EMPTY_ARR;const te=z.length,K=J.length,ae=Math.min(te,K);let fe;for(fe=0;feK?oe(z,Y,O,!0,!1,ae):I(J,T,q,Y,O,V,U,se,ae)},de=(z,J,T,q,Y,O,V,U,se)=>{let te=0;const K=J.length;let ae=z.length-1,fe=K-1;for(;te<=ae&&te<=fe;){const pe=z[te],ye=J[te]=se?cloneIfMounted(J[te]):normalizeVNode(J[te]);if(isSameVNodeType(pe,ye))S(pe,ye,T,null,Y,O,V,U,se);else break;te++}for(;te<=ae&&te<=fe;){const pe=z[ae],ye=J[fe]=se?cloneIfMounted(J[fe]):normalizeVNode(J[fe]);if(isSameVNodeType(pe,ye))S(pe,ye,T,null,Y,O,V,U,se);else break;ae--,fe--}if(te>ae){if(te<=fe){const pe=fe+1,ye=pefe)for(;te<=ae;)H(z[te],Y,O,!0),te++;else{const pe=te,ye=te,ve=new Map;for(te=ye;te<=fe;te++){const Le=J[te]=se?cloneIfMounted(J[te]):normalizeVNode(J[te]);Le.key!=null&&ve.set(Le.key,te)}let ce,Se=0;const we=fe-ye+1;let Pe=!1,Be=0;const Me=new Array(we);for(te=0;te=we){H(Le,Y,O,!0);continue}let Ce;if(Le.key!=null)Ce=ve.get(Le.key);else for(ce=ye;ce<=fe;ce++)if(Me[ce-ye]===0&&isSameVNodeType(Le,J[ce])){Ce=ce;break}Ce===void 0?H(Le,Y,O,!0):(Me[Ce-ye]=te+1,Ce>=Be?Be=Ce:Pe=!0,S(Le,J[Ce],T,null,Y,O,V,U,se),Se++)}const Ne=Pe?getSequence(Me):EMPTY_ARR;for(ce=Ne.length-1,te=we-1;te>=0;te--){const Le=ye+te,Ce=J[Le],ze=Le+1{const{el:O,type:V,transition:U,children:se,shapeFlag:te}=z;if(te&6){Q(z.component.subTree,J,T,q);return}if(te&128){z.suspense.move(J,T,q);return}if(te&64){V.move(z,J,T,me);return}if(V===Fragment){s(O,J,T);for(let ae=0;aeU.enter(O),Y);else{const{leave:ae,delayLeave:fe,afterLeave:pe}=U,ye=()=>s(O,J,T),ve=()=>{ae(O,()=>{ye(),pe&&pe()})};fe?fe(O,ye,ve):ve()}else s(O,J,T)},H=(z,J,T,q=!1,Y=!1)=>{const{type:O,props:V,ref:U,children:se,dynamicChildren:te,shapeFlag:K,patchFlag:ae,dirs:fe}=z;if(U!=null&&setRef(U,null,T,z,!0),K&256){J.ctx.deactivate(z);return}const pe=K&1&&fe,ye=!isAsyncWrapper(z);let ve;if(ye&&(ve=V&&V.onVnodeBeforeUnmount)&&invokeVNodeHook(ve,J,z),K&6)W(z.component,T,q);else{if(K&128){z.suspense.unmount(T,q);return}pe&&invokeDirectiveHook(z,null,J,"beforeUnmount"),K&64?z.type.remove(z,J,T,Y,me,q):te&&(O!==Fragment||ae>0&&ae&64)?oe(te,J,T,!1,!0):(O===Fragment&&ae&384||!Y&&K&16)&&oe(se,J,T),q&&ue(z)}(ye&&(ve=V&&V.onVnodeUnmounted)||pe)&&queuePostRenderEffect(()=>{ve&&invokeVNodeHook(ve,J,z),pe&&invokeDirectiveHook(z,null,J,"unmounted")},T)},ue=z=>{const{type:J,el:T,anchor:q,transition:Y}=z;if(J===Fragment){ne(T,q);return}if(J===Static){_(z);return}const O=()=>{r(T),Y&&!Y.persisted&&Y.afterLeave&&Y.afterLeave()};if(z.shapeFlag&1&&Y&&!Y.persisted){const{leave:V,delayLeave:U}=Y,se=()=>V(T,O);U?U(z.el,O,se):se()}else O()},ne=(z,J)=>{let T;for(;z!==J;)T=g(z),r(z),z=T;r(J)},W=(z,J,T)=>{const{bum:q,scope:Y,update:O,subTree:V,um:U}=z;q&&invokeArrayFns(q),Y.stop(),O&&(O.active=!1,H(V,z,J,T)),U&&queuePostRenderEffect(U,J),queuePostRenderEffect(()=>{z.isUnmounted=!0},J),J&&J.pendingBranch&&!J.isUnmounted&&z.asyncDep&&!z.asyncResolved&&z.suspenseId===J.pendingId&&(J.deps--,J.deps===0&&J.resolve())},oe=(z,J,T,q=!1,Y=!1,O=0)=>{for(let V=O;Vz.shapeFlag&6?he(z.component.subTree):z.shapeFlag&128?z.suspense.next():g(z.anchor||z.el),le=(z,J,T)=>{z==null?J._vnode&&H(J._vnode,null,null,!0):S(J._vnode||null,z,J,null,null,null,T),flushPreFlushCbs(),flushPostFlushCbs(),J._vnode=z},me={p:S,um:H,m:Q,r:ue,mt:M,mc:I,pc:re,pbc:R,n:he,o:i};let Ae,be;return e&&([Ae,be]=e(me)),{render:le,hydrate:Ae,createApp:createAppAPI(le,Ae)}}function toggleRecurse({effect:i,update:e},t){i.allowRecurse=e.allowRecurse=t}function traverseStaticChildren(i,e,t=!1){const s=i.children,r=e.children;if(isArray$8(s)&&isArray$8(r))for(let o=0;o>1,i[t[l]]0&&(e[s]=t[o-1]),t[o]=s)}}for(o=t.length,a=t[o-1];o-- >0;)t[o]=a,a=e[a];return t}const isTeleport=i=>i.__isTeleport,isTeleportDisabled=i=>i&&(i.disabled||i.disabled===""),isTargetSVG=i=>typeof SVGElement<"u"&&i instanceof SVGElement,resolveTarget=(i,e)=>{const t=i&&i.to;return isString$2(t)?e?e(t):null:t},TeleportImpl={__isTeleport:!0,process(i,e,t,s,r,o,a,l,c,d){const{mc:m,pc:u,pbc:g,o:{insert:b,querySelector:y,createText:S,createComment:v}}=d,x=isTeleportDisabled(e.props);let{shapeFlag:A,children:E,dynamicChildren:_}=e;if(i==null){const w=e.el=S(""),C=e.anchor=S("");b(w,t,s),b(C,t,s);const P=e.target=resolveTarget(e.props,y),I=e.targetAnchor=S("");P&&(b(I,P),a=a||isTargetSVG(P));const N=(R,F)=>{A&16&&m(E,R,F,r,o,a,l,c)};x?N(t,C):P&&N(P,I)}else{e.el=i.el;const w=e.anchor=i.anchor,C=e.target=i.target,P=e.targetAnchor=i.targetAnchor,I=isTeleportDisabled(i.props),N=I?t:C,R=I?w:P;if(a=a||isTargetSVG(C),_?(g(i.dynamicChildren,_,N,r,o,a,l),traverseStaticChildren(i,e,!0)):c||u(i,e,N,R,r,o,a,l,!1),x)I||moveTeleport(e,t,w,d,1);else if((e.props&&e.props.to)!==(i.props&&i.props.to)){const F=e.target=resolveTarget(e.props,y);F&&moveTeleport(e,F,null,d,0)}else I&&moveTeleport(e,C,P,d,1)}updateCssVars(e)},remove(i,e,t,s,{um:r,o:{remove:o}},a){const{shapeFlag:l,children:c,anchor:d,targetAnchor:m,target:u,props:g}=i;if(u&&o(m),(a||!isTeleportDisabled(g))&&(o(d),l&16))for(let b=0;b0?currentBlock||EMPTY_ARR:null,closeBlock(),isBlockTreeEnabled>0&¤tBlock&¤tBlock.push(i),i}function createElementBlock(i,e,t,s,r,o){return setupBlock(createBaseVNode(i,e,t,s,r,o,!0))}function createBlock(i,e,t,s,r){return setupBlock(createVNode(i,e,t,s,r,!0))}function isVNode(i){return i?i.__v_isVNode===!0:!1}function isSameVNodeType(i,e){return i.type===e.type&&i.key===e.key}const InternalObjectKey="__vInternal",normalizeKey=({key:i})=>i!=null?i:null,normalizeRef=({ref:i,ref_key:e,ref_for:t})=>i!=null?isString$2(i)||isRef(i)||isFunction$5(i)?{i:currentRenderingInstance,r:i,k:e,f:!!t}:i:null;function createBaseVNode(i,e=null,t=null,s=0,r=null,o=i===Fragment?0:1,a=!1,l=!1){const c={__v_isVNode:!0,__v_skip:!0,type:i,props:e,key:e&&normalizeKey(e),ref:e&&normalizeRef(e),scopeId:currentScopeId,slotScopeIds:null,children:t,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:s,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:currentRenderingInstance};return l?(normalizeChildren(c,t),o&128&&i.normalize(c)):t&&(c.shapeFlag|=isString$2(t)?8:16),isBlockTreeEnabled>0&&!a&¤tBlock&&(c.patchFlag>0||o&6)&&c.patchFlag!==32&¤tBlock.push(c),c}const createVNode=_createVNode;function _createVNode(i,e=null,t=null,s=0,r=null,o=!1){if((!i||i===NULL_DYNAMIC_COMPONENT)&&(i=Comment),isVNode(i)){const l=cloneVNode(i,e,!0);return t&&normalizeChildren(l,t),isBlockTreeEnabled>0&&!o&¤tBlock&&(l.shapeFlag&6?currentBlock[currentBlock.indexOf(i)]=l:currentBlock.push(l)),l.patchFlag|=-2,l}if(isClassComponent(i)&&(i=i.__vccOpts),e){e=guardReactiveProps(e);let{class:l,style:c}=e;l&&!isString$2(l)&&(e.class=normalizeClass(l)),isObject$4(c)&&(isProxy(c)&&!isArray$8(c)&&(c=extend$3({},c)),e.style=normalizeStyle(c))}const a=isString$2(i)?1:isSuspense(i)?128:isTeleport(i)?64:isObject$4(i)?4:isFunction$5(i)?2:0;return createBaseVNode(i,e,t,s,r,a,o,!0)}function guardReactiveProps(i){return i?isProxy(i)||InternalObjectKey in i?extend$3({},i):i:null}function cloneVNode(i,e,t=!1){const{props:s,ref:r,patchFlag:o,children:a}=i,l=e?mergeProps(s||{},e):s;return{__v_isVNode:!0,__v_skip:!0,type:i.type,props:l,key:l&&normalizeKey(l),ref:e&&e.ref?t&&r?isArray$8(r)?r.concat(normalizeRef(e)):[r,normalizeRef(e)]:normalizeRef(e):r,scopeId:i.scopeId,slotScopeIds:i.slotScopeIds,children:a,target:i.target,targetAnchor:i.targetAnchor,staticCount:i.staticCount,shapeFlag:i.shapeFlag,patchFlag:e&&i.type!==Fragment?o===-1?16:o|16:o,dynamicProps:i.dynamicProps,dynamicChildren:i.dynamicChildren,appContext:i.appContext,dirs:i.dirs,transition:i.transition,component:i.component,suspense:i.suspense,ssContent:i.ssContent&&cloneVNode(i.ssContent),ssFallback:i.ssFallback&&cloneVNode(i.ssFallback),el:i.el,anchor:i.anchor,ctx:i.ctx,ce:i.ce}}function createTextVNode(i=" ",e=0){return createVNode(Text,null,i,e)}function createCommentVNode(i="",e=!1){return e?(openBlock(),createBlock(Comment,null,i)):createVNode(Comment,null,i)}function normalizeVNode(i){return i==null||typeof i=="boolean"?createVNode(Comment):isArray$8(i)?createVNode(Fragment,null,i.slice()):typeof i=="object"?cloneIfMounted(i):createVNode(Text,null,String(i))}function cloneIfMounted(i){return i.el===null&&i.patchFlag!==-1||i.memo?i:cloneVNode(i)}function normalizeChildren(i,e){let t=0;const{shapeFlag:s}=i;if(e==null)e=null;else if(isArray$8(e))t=16;else if(typeof e=="object")if(s&65){const r=e.default;r&&(r._c&&(r._d=!1),normalizeChildren(i,r()),r._c&&(r._d=!0));return}else{t=32;const r=e._;!r&&!(InternalObjectKey in e)?e._ctx=currentRenderingInstance:r===3&¤tRenderingInstance&&(currentRenderingInstance.slots._===1?e._=1:(e._=2,i.patchFlag|=1024))}else isFunction$5(e)?(e={default:e,_ctx:currentRenderingInstance},t=32):(e=String(e),s&64?(t=16,e=[createTextVNode(e)]):t=8);i.children=e,i.shapeFlag|=t}function mergeProps(...i){const e={};for(let t=0;tcurrentInstance||currentRenderingInstance,setCurrentInstance=i=>{currentInstance=i,i.scope.on()},unsetCurrentInstance=()=>{currentInstance&¤tInstance.scope.off(),currentInstance=null};function isStatefulComponent(i){return i.vnode.shapeFlag&4}let isInSSRComponentSetup=!1;function setupComponent(i,e=!1){isInSSRComponentSetup=e;const{props:t,children:s}=i.vnode,r=isStatefulComponent(i);initProps(i,t,r,e),initSlots(i,s);const o=r?setupStatefulComponent(i,e):void 0;return isInSSRComponentSetup=!1,o}function setupStatefulComponent(i,e){const t=i.type;i.accessCache=Object.create(null),i.proxy=markRaw(new Proxy(i.ctx,PublicInstanceProxyHandlers));const{setup:s}=t;if(s){const r=i.setupContext=s.length>1?createSetupContext(i):null;setCurrentInstance(i),pauseTracking();const o=callWithErrorHandling(s,i,0,[i.props,r]);if(resetTracking(),unsetCurrentInstance(),isPromise$1(o)){if(o.then(unsetCurrentInstance,unsetCurrentInstance),e)return o.then(a=>{handleSetupResult(i,a,e)}).catch(a=>{handleError(a,i,0)});i.asyncDep=o}else handleSetupResult(i,o,e)}else finishComponentSetup(i,e)}function handleSetupResult(i,e,t){isFunction$5(e)?i.type.__ssrInlineRender?i.ssrRender=e:i.render=e:isObject$4(e)&&(i.setupState=proxyRefs(e)),finishComponentSetup(i,t)}let compile$1;function finishComponentSetup(i,e,t){const s=i.type;if(!i.render){if(!e&&compile$1&&!s.render){const r=s.template||resolveMergedOptions(i).template;if(r){const{isCustomElement:o,compilerOptions:a}=i.appContext.config,{delimiters:l,compilerOptions:c}=s,d=extend$3(extend$3({isCustomElement:o,delimiters:l},a),c);s.render=compile$1(r,d)}}i.render=s.render||NOOP}setCurrentInstance(i),pauseTracking(),applyOptions(i),resetTracking(),unsetCurrentInstance()}function createAttrsProxy(i){return new Proxy(i.attrs,{get(e,t){return track(i,"get","$attrs"),e[t]}})}function createSetupContext(i){const e=s=>{i.exposed=s||{}};let t;return{get attrs(){return t||(t=createAttrsProxy(i))},slots:i.slots,emit:i.emit,expose:e}}function getExposeProxy(i){if(i.exposed)return i.exposeProxy||(i.exposeProxy=new Proxy(proxyRefs(markRaw(i.exposed)),{get(e,t){if(t in e)return e[t];if(t in publicPropertiesMap)return publicPropertiesMap[t](i)},has(e,t){return t in e||t in publicPropertiesMap}}))}function getComponentName(i,e=!0){return isFunction$5(i)?i.displayName||i.name:i.name||e&&i.__name}function isClassComponent(i){return isFunction$5(i)&&"__vccOpts"in i}const computed=(i,e)=>computed$1(i,e,isInSSRComponentSetup);function h(i,e,t){const s=arguments.length;return s===2?isObject$4(e)&&!isArray$8(e)?isVNode(e)?createVNode(i,null,[e]):createVNode(i,e):createVNode(i,null,e):(s>3?t=Array.prototype.slice.call(arguments,2):s===3&&isVNode(t)&&(t=[t]),createVNode(i,e,t))}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:(i,e,t)=>{e.insertBefore(i,t||null)},remove:i=>{const e=i.parentNode;e&&e.removeChild(i)},createElement:(i,e,t,s)=>{const r=e?doc$2.createElementNS(svgNS,i):doc$2.createElement(i,t?{is:t}:void 0);return i==="select"&&s&&s.multiple!=null&&r.setAttribute("multiple",s.multiple),r},createText:i=>doc$2.createTextNode(i),createComment:i=>doc$2.createComment(i),setText:(i,e)=>{i.nodeValue=e},setElementText:(i,e)=>{i.textContent=e},parentNode:i=>i.parentNode,nextSibling:i=>i.nextSibling,querySelector:i=>doc$2.querySelector(i),setScopeId(i,e){i.setAttribute(e,"")},insertStaticContent(i,e,t,s,r,o){const a=t?t.previousSibling:e.lastChild;if(r&&(r===o||r.nextSibling))for(;e.insertBefore(r.cloneNode(!0),t),!(r===o||!(r=r.nextSibling)););else{templateContainer.innerHTML=s?`${i}`:i;const l=templateContainer.content;if(s){const c=l.firstChild;for(;c.firstChild;)l.appendChild(c.firstChild);l.removeChild(c)}e.insertBefore(l,t)}return[a?a.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}};function patchClass(i,e,t){const s=i._vtc;s&&(e=(e?[e,...s]:[...s]).join(" ")),e==null?i.removeAttribute("class"):t?i.setAttribute("class",e):i.className=e}function patchStyle(i,e,t){const s=i.style,r=isString$2(t);if(t&&!r){if(e&&!isString$2(e))for(const o in e)t[o]==null&&setStyle(s,o,"");for(const o in t)setStyle(s,o,t[o])}else{const o=s.display;r?e!==t&&(s.cssText=t):e&&i.removeAttribute("style"),"_vod"in i&&(s.display=o)}}const importantRE=/\s*!important$/;function setStyle(i,e,t){if(isArray$8(t))t.forEach(s=>setStyle(i,e,s));else if(t==null&&(t=""),e.startsWith("--"))i.setProperty(e,t);else{const s=autoPrefix(i,e);importantRE.test(t)?i.setProperty(hyphenate(s),t.replace(importantRE,""),"important"):i[s]=t}}const prefixes=["Webkit","Moz","ms"],prefixCache={};function autoPrefix(i,e){const t=prefixCache[e];if(t)return t;let s=camelize$2(e);if(s!=="filter"&&s in i)return prefixCache[e]=s;s=capitalize(s);for(let r=0;rcachedNow||(p.then(()=>cachedNow=0),cachedNow=Date.now());function createInvoker(i,e){const t=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=t.attached)return;callWithAsyncErrorHandling(patchStopImmediatePropagation(s,t.value),e,5,[s])};return t.value=i,t.attached=getNow(),t}function patchStopImmediatePropagation(i,e){if(isArray$8(e)){const t=i.stopImmediatePropagation;return i.stopImmediatePropagation=()=>{t.call(i),i._stopped=!0},e.map(s=>r=>!r._stopped&&s&&s(r))}else return e}const nativeOnRE=/^on[a-z]/,patchProp=(i,e,t,s,r=!1,o,a,l,c)=>{e==="class"?patchClass(i,s,r):e==="style"?patchStyle(i,t,s):isOn(e)?isModelListener(e)||patchEvent(i,e,t,s,a):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):shouldSetAsProp(i,e,s,r))?patchDOMProp(i,e,s,o,a,l,c):(e==="true-value"?i._trueValue=s:e==="false-value"&&(i._falseValue=s),patchAttr(i,e,s,r))};function shouldSetAsProp(i,e,t,s){return s?!!(e==="innerHTML"||e==="textContent"||e in i&&nativeOnRE.test(e)&&isFunction$5(t)):e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&i.tagName==="INPUT"||e==="type"&&i.tagName==="TEXTAREA"||nativeOnRE.test(e)&&isString$2(t)?!1:e in i}const TRANSITION="transition",ANIMATION="animation",Transition=(i,{slots:e})=>h(BaseTransition,resolveTransitionProps(i),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=(i,e=[])=>{isArray$8(i)?i.forEach(t=>t(...e)):i&&i(...e)},hasExplicitCallback=i=>i?isArray$8(i)?i.some(e=>e.length>1):i.length>1:!1;function resolveTransitionProps(i){const e={};for(const B in i)B in DOMTransitionPropsValidators||(e[B]=i[B]);if(i.css===!1)return e;const{name:t="v",type:s,duration:r,enterFromClass:o=`${t}-enter-from`,enterActiveClass:a=`${t}-enter-active`,enterToClass:l=`${t}-enter-to`,appearFromClass:c=o,appearActiveClass:d=a,appearToClass:m=l,leaveFromClass:u=`${t}-leave-from`,leaveActiveClass:g=`${t}-leave-active`,leaveToClass:b=`${t}-leave-to`}=i,y=normalizeDuration(r),S=y&&y[0],v=y&&y[1],{onBeforeEnter:x,onEnter:A,onEnterCancelled:E,onLeave:_,onLeaveCancelled:w,onBeforeAppear:C=x,onAppear:P=A,onAppearCancelled:I=E}=e,N=(B,k,M)=>{removeTransitionClass(B,k?m:l),removeTransitionClass(B,k?d:a),M&&M()},R=(B,k)=>{B._isLeaving=!1,removeTransitionClass(B,u),removeTransitionClass(B,b),removeTransitionClass(B,g),k&&k()},F=B=>(k,M)=>{const G=B?P:A,ee=()=>N(k,B,M);callHook(G,[k,ee]),nextFrame(()=>{removeTransitionClass(k,B?c:o),addTransitionClass(k,B?m:l),hasExplicitCallback(G)||whenTransitionEnds(k,s,S,ee)})};return extend$3(e,{onBeforeEnter(B){callHook(x,[B]),addTransitionClass(B,o),addTransitionClass(B,a)},onBeforeAppear(B){callHook(C,[B]),addTransitionClass(B,c),addTransitionClass(B,d)},onEnter:F(!1),onAppear:F(!0),onLeave(B,k){B._isLeaving=!0;const M=()=>R(B,k);addTransitionClass(B,u),forceReflow(),addTransitionClass(B,g),nextFrame(()=>{B._isLeaving&&(removeTransitionClass(B,u),addTransitionClass(B,b),hasExplicitCallback(_)||whenTransitionEnds(B,s,v,M))}),callHook(_,[B,M])},onEnterCancelled(B){N(B,!1),callHook(E,[B])},onAppearCancelled(B){N(B,!0),callHook(I,[B])},onLeaveCancelled(B){R(B),callHook(w,[B])}})}function normalizeDuration(i){if(i==null)return null;if(isObject$4(i))return[NumberOf(i.enter),NumberOf(i.leave)];{const e=NumberOf(i);return[e,e]}}function NumberOf(i){return toNumber$1(i)}function addTransitionClass(i,e){e.split(/\s+/).forEach(t=>t&&i.classList.add(t)),(i._vtc||(i._vtc=new Set)).add(e)}function removeTransitionClass(i,e){e.split(/\s+/).forEach(s=>s&&i.classList.remove(s));const{_vtc:t}=i;t&&(t.delete(e),t.size||(i._vtc=void 0))}function nextFrame(i){requestAnimationFrame(()=>{requestAnimationFrame(i)})}let endId=0;function whenTransitionEnds(i,e,t,s){const r=i._endId=++endId,o=()=>{r===i._endId&&s()};if(t)return setTimeout(o,t);const{type:a,timeout:l,propCount:c}=getTransitionInfo(i,e);if(!a)return s();const d=a+"end";let m=0;const u=()=>{i.removeEventListener(d,g),o()},g=b=>{b.target===i&&++m>=c&&u()};setTimeout(()=>{m(t[y]||"").split(", "),r=s(`${TRANSITION}Delay`),o=s(`${TRANSITION}Duration`),a=getTimeout(r,o),l=s(`${ANIMATION}Delay`),c=s(`${ANIMATION}Duration`),d=getTimeout(l,c);let m=null,u=0,g=0;e===TRANSITION?a>0&&(m=TRANSITION,u=a,g=o.length):e===ANIMATION?d>0&&(m=ANIMATION,u=d,g=c.length):(u=Math.max(a,d),m=u>0?a>d?TRANSITION:ANIMATION:null,g=m?m===TRANSITION?o.length:c.length:0);const b=m===TRANSITION&&/\b(transform|all)(,|$)/.test(s(`${TRANSITION}Property`).toString());return{type:m,timeout:u,propCount:g,hasTransform:b}}function getTimeout(i,e){for(;i.lengthtoMs(t)+toMs(i[s])))}function toMs(i){return Number(i.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(i,{slots:e}){const t=getCurrentInstance(),s=useTransitionState();let r,o;return onUpdated(()=>{if(!r.length)return;const a=i.moveClass||`${i.name||"v"}-move`;if(!hasCSSTransform(r[0].el,t.vnode.el,a))return;r.forEach(callPendingCbs),r.forEach(recordPosition);const l=r.filter(applyTranslation);forceReflow(),l.forEach(c=>{const d=c.el,m=d.style;addTransitionClass(d,a),m.transform=m.webkitTransform=m.transitionDuration="";const u=d._moveCb=g=>{g&&g.target!==d||(!g||/transform$/.test(g.propertyName))&&(d.removeEventListener("transitionend",u),d._moveCb=null,removeTransitionClass(d,a))};d.addEventListener("transitionend",u)})}),()=>{const a=toRaw(i),l=resolveTransitionProps(a);let c=a.tag||Fragment;r=o,o=e.default?getTransitionRawChildren(e.default()):[];for(let d=0;ddelete i.mode;TransitionGroupImpl.props;const TransitionGroup=TransitionGroupImpl;function callPendingCbs(i){const e=i.el;e._moveCb&&e._moveCb(),e._enterCb&&e._enterCb()}function recordPosition(i){newPositionMap.set(i,i.el.getBoundingClientRect())}function applyTranslation(i){const e=positionMap.get(i),t=newPositionMap.get(i),s=e.left-t.left,r=e.top-t.top;if(s||r){const o=i.el.style;return o.transform=o.webkitTransform=`translate(${s}px,${r}px)`,o.transitionDuration="0s",i}}function hasCSSTransform(i,e,t){const s=i.cloneNode();i._vtc&&i._vtc.forEach(a=>{a.split(/\s+/).forEach(l=>l&&s.classList.remove(l))}),t.split(/\s+/).forEach(a=>a&&s.classList.add(a)),s.style.display="none";const r=e.nodeType===1?e:e.parentNode;r.appendChild(s);const{hasTransform:o}=getTransitionInfo(s);return r.removeChild(s),o}const vShow={beforeMount(i,{value:e},{transition:t}){i._vod=i.style.display==="none"?"":i.style.display,t&&e?t.beforeEnter(i):setDisplay(i,e)},mounted(i,{value:e},{transition:t}){t&&e&&t.enter(i)},updated(i,{value:e,oldValue:t},{transition:s}){!e!=!t&&(s?e?(s.beforeEnter(i),setDisplay(i,!0),s.enter(i)):s.leave(i,()=>{setDisplay(i,!1)}):setDisplay(i,e))},beforeUnmount(i,{value:e}){setDisplay(i,e)}};function setDisplay(i,e){i.style.display=e?i._vod:"none"}const rendererOptions=extend$3({patchProp},nodeOps);let renderer;function ensureRenderer(){return renderer||(renderer=createRenderer(rendererOptions))}const createApp=(...i)=>{const e=ensureRenderer().createApp(...i),{mount:t}=e;return e.mount=s=>{const r=normalizeContainer(s);if(!r)return;const o=e._component;!isFunction$5(o)&&!o.render&&!o.template&&(o.template=r.innerHTML),r.innerHTML="";const a=t(r,!1,r instanceof SVGElement);return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),a},e};function normalizeContainer(i){return isString$2(i)?document.querySelector(i):i}/*! * vue-router v4.1.6 * (c) 2022 Eduardo San Martin Morote * @license MIT */const isBrowser=typeof window<"u";function isESModule(i){return i.__esModule||i[Symbol.toStringTag]==="Module"}const assign$2=Object.assign;function applyToParams(i,e){const t={};for(const s in e){const r=e[s];t[s]=isArray$7(r)?r.map(i):i(r)}return t}const noop$2=()=>{},isArray$7=Array.isArray,TRAILING_SLASH_RE=/\/$/,removeTrailingSlash=i=>i.replace(TRAILING_SLASH_RE,"");function parseURL(i,e,t="/"){let s,r={},o="",a="";const l=e.indexOf("#");let c=e.indexOf("?");return l=0&&(c=-1),c>-1&&(s=e.slice(0,c),o=e.slice(c+1,l>-1?l:e.length),r=i(o)),l>-1&&(s=s||e.slice(0,l),a=e.slice(l,e.length)),s=resolveRelativePath(s!=null?s:e,t),{fullPath:s+(o&&"?")+o+a,path:s,query:r,hash:a}}function stringifyURL(i,e){const t=e.query?i(e.query):"";return e.path+(t&&"?")+t+(e.hash||"")}function stripBase(i,e){return!e||!i.toLowerCase().startsWith(e.toLowerCase())?i:i.slice(e.length)||"/"}function isSameRouteLocation(i,e,t){const s=e.matched.length-1,r=t.matched.length-1;return s>-1&&s===r&&isSameRouteRecord(e.matched[s],t.matched[r])&&isSameRouteLocationParams(e.params,t.params)&&i(e.query)===i(t.query)&&e.hash===t.hash}function isSameRouteRecord(i,e){return(i.aliasOf||i)===(e.aliasOf||e)}function isSameRouteLocationParams(i,e){if(Object.keys(i).length!==Object.keys(e).length)return!1;for(const t in i)if(!isSameRouteLocationParamsValue(i[t],e[t]))return!1;return!0}function isSameRouteLocationParamsValue(i,e){return isArray$7(i)?isEquivalentArray(i,e):isArray$7(e)?isEquivalentArray(e,i):i===e}function isEquivalentArray(i,e){return isArray$7(e)?i.length===e.length&&i.every((t,s)=>t===e[s]):i.length===1&&i[0]===e}function resolveRelativePath(i,e){if(i.startsWith("/"))return i;if(!i)return e;const t=e.split("/"),s=i.split("/");let r=t.length-1,o,a;for(o=0;o1&&r--;else break;return t.slice(0,r).join("/")+"/"+s.slice(o-(o===s.length?1:0)).join("/")}var NavigationType;(function(i){i.pop="pop",i.push="push"})(NavigationType||(NavigationType={}));var NavigationDirection;(function(i){i.back="back",i.forward="forward",i.unknown=""})(NavigationDirection||(NavigationDirection={}));function normalizeBase(i){if(!i)if(isBrowser){const e=document.querySelector("base");i=e&&e.getAttribute("href")||"/",i=i.replace(/^\w+:\/\/[^\/]+/,"")}else i="/";return i[0]!=="/"&&i[0]!=="#"&&(i="/"+i),removeTrailingSlash(i)}const BEFORE_HASH_RE=/^[^#]+#/;function createHref(i,e){return i.replace(BEFORE_HASH_RE,"#")+e}function getElementPosition(i,e){const t=document.documentElement.getBoundingClientRect(),s=i.getBoundingClientRect();return{behavior:e.behavior,left:s.left-t.left-(e.left||0),top:s.top-t.top-(e.top||0)}}const computeScrollPosition=()=>({left:window.pageXOffset,top:window.pageYOffset});function scrollToPosition(i){let e;if("el"in i){const t=i.el,s=typeof t=="string"&&t.startsWith("#"),r=typeof t=="string"?s?document.getElementById(t.slice(1)):document.querySelector(t):t;if(!r)return;e=getElementPosition(r,i)}else e=i;"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(i,e){return(history.state?history.state.position-e:-1)+i}const scrollPositions=new Map;function saveScrollPosition(i,e){scrollPositions.set(i,e)}function getSavedScrollPosition(i){const e=scrollPositions.get(i);return scrollPositions.delete(i),e}let createBaseLocation=()=>location.protocol+"//"+location.host;function createCurrentLocation(i,e){const{pathname:t,search:s,hash:r}=e,o=i.indexOf("#");if(o>-1){let l=r.includes(i.slice(o))?i.slice(o).length:1,c=r.slice(l);return c[0]!=="/"&&(c="/"+c),stripBase(c,"")}return stripBase(t,i)+s+r}function useHistoryListeners(i,e,t,s){let r=[],o=[],a=null;const l=({state:g})=>{const b=createCurrentLocation(i,location),y=t.value,S=e.value;let v=0;if(g){if(t.value=b,e.value=g,a&&a===y){a=null;return}v=S?g.position-S.position:0}else s(b);r.forEach(x=>{x(t.value,y,{delta:v,type:NavigationType.pop,direction:v?v>0?NavigationDirection.forward:NavigationDirection.back:NavigationDirection.unknown})})};function c(){a=t.value}function d(g){r.push(g);const b=()=>{const y=r.indexOf(g);y>-1&&r.splice(y,1)};return o.push(b),b}function m(){const{history:g}=window;g.state&&g.replaceState(assign$2({},g.state,{scroll:computeScrollPosition()}),"")}function u(){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:d,destroy:u}}function buildState(i,e,t,s=!1,r=!1){return{back:i,current:e,forward:t,replaced:s,position:window.history.length,scroll:r?computeScrollPosition():null}}function useHistoryStateNavigation(i){const{history:e,location:t}=window,s={value:createCurrentLocation(i,t)},r={value:e.state};r.value||o(s.value,{back:null,current:s.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function o(c,d,m){const u=i.indexOf("#"),g=u>-1?(t.host&&document.querySelector("base")?i:i.slice(u))+c:createBaseLocation()+i+c;try{e[m?"replaceState":"pushState"](d,"",g),r.value=d}catch(b){console.error(b),t[m?"replace":"assign"](g)}}function a(c,d){const m=assign$2({},e.state,buildState(r.value.back,c,r.value.forward,!0),d,{position:r.value.position});o(c,m,!0),s.value=c}function l(c,d){const m=assign$2({},r.value,e.state,{forward:c,scroll:computeScrollPosition()});o(m.current,m,!0);const u=assign$2({},buildState(s.value,c,null),{position:m.position+1},d);o(c,u,!1),s.value=c}return{location:s,state:r,push:l,replace:a}}function createWebHistory(i){i=normalizeBase(i);const e=useHistoryStateNavigation(i),t=useHistoryListeners(i,e.state,e.location,e.replace);function s(o,a=!0){a||t.pauseListeners(),history.go(o)}const r=assign$2({location:"",base:i,go:s,createHref:createHref.bind(null,i)},e,t);return Object.defineProperty(r,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(r,"state",{enumerable:!0,get:()=>e.state.value}),r}function createWebHashHistory(i){return i=location.host?i||location.pathname+location.search:"",i.includes("#")||(i+="#"),createWebHistory(i)}function isRouteLocation(i){return typeof i=="string"||i&&typeof i=="object"}function isRouteName(i){return typeof i=="string"||typeof i=="symbol"}const START_LOCATION_NORMALIZED={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},NavigationFailureSymbol=Symbol("");var NavigationFailureType;(function(i){i[i.aborted=4]="aborted",i[i.cancelled=8]="cancelled",i[i.duplicated=16]="duplicated"})(NavigationFailureType||(NavigationFailureType={}));function createRouterError(i,e){return assign$2(new Error,{type:i,[NavigationFailureSymbol]:!0},e)}function isNavigationFailure(i,e){return i instanceof Error&&NavigationFailureSymbol in i&&(e==null||!!(i.type&e))}const BASE_PARAM_PATTERN="[^/]+?",BASE_PATH_PARSER_OPTIONS={sensitive:!1,strict:!1,start:!0,end:!0},REGEX_CHARS_RE=/[.+*?^${}()[\]/\\]/g;function tokensToParser(i,e){const t=assign$2({},BASE_PATH_PARSER_OPTIONS,e),s=[];let r=t.start?"^":"";const o=[];for(const d of i){const m=d.length?[]:[90];t.strict&&!d.length&&(r+="/");for(let u=0;ue.length?e.length===1&&e[0]===40+40?1:-1:0}function comparePathParserScore(i,e){let t=0;const s=i.score,r=e.score;for(;t0&&e[e.length-1]<0}const ROOT_TOKEN={type:0,value:""},VALID_PARAM_RE=/[a-zA-Z0-9_]/;function tokenizePath(i){if(!i)return[[]];if(i==="/")return[[ROOT_TOKEN]];if(!i.startsWith("/"))throw new Error(`Invalid path "${i}"`);function e(b){throw new Error(`ERR (${t})/"${d}": ${b}`)}let t=0,s=t;const r=[];let o;function a(){o&&r.push(o),o=[]}let l=0,c,d="",m="";function u(){d&&(t===0?o.push({type:0,value:d}):t===1||t===2||t===3?(o.length>1&&(c==="*"||c==="+")&&e(`A repeatable param (${d}) must be alone in its segment. eg: '/:ids+.`),o.push({type:1,value:d,regexp:m,repeatable:c==="*"||c==="+",optional:c==="*"||c==="?"})):e("Invalid state to consume buffer"),d="")}function g(){d+=c}for(;l{a(A)}:noop$2}function a(m){if(isRouteName(m)){const u=s.get(m);u&&(s.delete(m),t.splice(t.indexOf(u),1),u.children.forEach(a),u.alias.forEach(a))}else{const u=t.indexOf(m);u>-1&&(t.splice(u,1),m.record.name&&s.delete(m.record.name),m.children.forEach(a),m.alias.forEach(a))}}function l(){return t}function c(m){let u=0;for(;u=0&&(m.record.path!==t[u].record.path||!isRecordChildOf(m,t[u]));)u++;t.splice(u,0,m),m.record.name&&!isAliasRecord(m)&&s.set(m.record.name,m)}function d(m,u){let g,b={},y,S;if("name"in m&&m.name){if(g=s.get(m.name),!g)throw createRouterError(1,{location:m});S=g.record.name,b=assign$2(paramsFromLocation(u.params,g.keys.filter(A=>!A.optional).map(A=>A.name)),m.params&¶msFromLocation(m.params,g.keys.map(A=>A.name))),y=g.stringify(b)}else if("path"in m)y=m.path,g=t.find(A=>A.re.test(y)),g&&(b=g.parse(y),S=g.record.name);else{if(g=u.name?s.get(u.name):t.find(A=>A.re.test(u.path)),!g)throw createRouterError(1,{location:m,currentLocation:u});S=g.record.name,b=assign$2({},u.params,m.params),y=g.stringify(b)}const v=[];let x=g;for(;x;)v.unshift(x.record),x=x.parent;return{name:S,path:y,params:b,matched:v,meta:mergeMetaFields(v)}}return i.forEach(m=>o(m)),{addRoute:o,resolve:d,removeRoute:a,getRoutes:l,getRecordMatcher:r}}function paramsFromLocation(i,e){const t={};for(const s of e)s in i&&(t[s]=i[s]);return t}function normalizeRouteRecord(i){return{path:i.path,redirect:i.redirect,name:i.name,meta:i.meta||{},aliasOf:void 0,beforeEnter:i.beforeEnter,props:normalizeRecordProps(i),children:i.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in i?i.components||null:i.component&&{default:i.component}}}function normalizeRecordProps(i){const e={},t=i.props||!1;if("component"in i)e.default=t;else for(const s in i.components)e[s]=typeof t=="boolean"?t:t[s];return e}function isAliasRecord(i){for(;i;){if(i.record.aliasOf)return!0;i=i.parent}return!1}function mergeMetaFields(i){return i.reduce((e,t)=>assign$2(e,t.meta),{})}function mergeOptions(i,e){const t={};for(const s in i)t[s]=s in e?e[s]:i[s];return t}function isRecordChildOf(i,e){return e.children.some(t=>t===i||isRecordChildOf(i,t))}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(i){return encodeURI(""+i).replace(ENC_PIPE_RE,"|").replace(ENC_BRACKET_OPEN_RE,"[").replace(ENC_BRACKET_CLOSE_RE,"]")}function encodeHash(i){return commonEncode(i).replace(ENC_CURLY_OPEN_RE,"{").replace(ENC_CURLY_CLOSE_RE,"}").replace(ENC_CARET_RE,"^")}function encodeQueryValue(i){return commonEncode(i).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(i){return encodeQueryValue(i).replace(EQUAL_RE,"%3D")}function encodePath(i){return commonEncode(i).replace(HASH_RE,"%23").replace(IM_RE,"%3F")}function encodeParam(i){return i==null?"":encodePath(i).replace(SLASH_RE,"%2F")}function decode$5(i){try{return decodeURIComponent(""+i)}catch(e){}return""+i}function parseQuery(i){const e={};if(i===""||i==="?")return e;const s=(i[0]==="?"?i.slice(1):i).split("&");for(let r=0;ro&&encodeQueryValue(o)):[s&&encodeQueryValue(s)]).forEach(o=>{o!==void 0&&(e+=(e.length?"&":"")+t,o!=null&&(e+="="+o))})}return e}function normalizeQuery(i){const e={};for(const t in i){const s=i[t];s!==void 0&&(e[t]=isArray$7(s)?s.map(r=>r==null?null:""+r):s==null?s:""+s)}return e}const matchedRouteKey=Symbol(""),viewDepthKey=Symbol(""),routerKey=Symbol(""),routeLocationKey=Symbol(""),routerViewLocationKey=Symbol("");function useCallbacks(){let i=[];function e(s){return i.push(s),()=>{const r=i.indexOf(s);r>-1&&i.splice(r,1)}}function t(){i=[]}return{add:e,list:()=>i,reset:t}}function guardToPromiseFn(i,e,t,s,r){const o=s&&(s.enterCallbacks[r]=s.enterCallbacks[r]||[]);return()=>new Promise((a,l)=>{const c=u=>{u===!1?l(createRouterError(4,{from:t,to:e})):u instanceof Error?l(u):isRouteLocation(u)?l(createRouterError(2,{from:e,to:u})):(o&&s.enterCallbacks[r]===o&&typeof u=="function"&&o.push(u),a())},d=i.call(s&&s.instances[r],e,t,c);let m=Promise.resolve(d);i.length<3&&(m=m.then(c)),m.catch(u=>l(u))})}function extractComponentsGuards(i,e,t,s){const r=[];for(const o of i)for(const a in o.components){let l=o.components[a];if(!(e!=="beforeRouteEnter"&&!o.instances[a]))if(isRouteComponent(l)){const d=(l.__vccOpts||l)[e];d&&r.push(guardToPromiseFn(d,t,s,o,a))}else{let c=l();r.push(()=>c.then(d=>{if(!d)return Promise.reject(new Error(`Couldn't resolve component "${a}" at "${o.path}"`));const m=isESModule(d)?d.default:d;o.components[a]=m;const g=(m.__vccOpts||m)[e];return g&&guardToPromiseFn(g,t,s,o,a)()}))}}return r}function isRouteComponent(i){return typeof i=="object"||"displayName"in i||"props"in i||"__vccOpts"in i}function useLink(i){const e=inject(routerKey),t=inject(routeLocationKey),s=computed(()=>e.resolve(unref(i.to))),r=computed(()=>{const{matched:c}=s.value,{length:d}=c,m=c[d-1],u=t.matched;if(!m||!u.length)return-1;const g=u.findIndex(isSameRouteRecord.bind(null,m));if(g>-1)return g;const b=getOriginalPath(c[d-2]);return d>1&&getOriginalPath(m)===b&&u[u.length-1].path!==b?u.findIndex(isSameRouteRecord.bind(null,c[d-2])):g}),o=computed(()=>r.value>-1&&includesParams(t.params,s.value.params)),a=computed(()=>r.value>-1&&r.value===t.matched.length-1&&isSameRouteLocationParams(t.params,s.value.params));function l(c={}){return guardEvent(c)?e[unref(i.replace)?"replace":"push"](unref(i.to)).catch(noop$2):Promise.resolve()}return{route:s,href:computed(()=>s.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(i,{slots:e}){const t=reactive(useLink(i)),{options:s}=inject(routerKey),r=computed(()=>({[getLinkClass(i.activeClass,s.linkActiveClass,"router-link-active")]:t.isActive,[getLinkClass(i.exactActiveClass,s.linkExactActiveClass,"router-link-exact-active")]:t.isExactActive}));return()=>{const o=e.default&&e.default(t);return i.custom?o:h("a",{"aria-current":t.isExactActive?i.ariaCurrentValue:null,href:t.href,onClick:t.navigate,class:r.value},o)}}}),RouterLink=RouterLinkImpl;function guardEvent(i){if(!(i.metaKey||i.altKey||i.ctrlKey||i.shiftKey)&&!i.defaultPrevented&&!(i.button!==void 0&&i.button!==0)){if(i.currentTarget&&i.currentTarget.getAttribute){const e=i.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return i.preventDefault&&i.preventDefault(),!0}}function includesParams(i,e){for(const t in e){const s=e[t],r=i[t];if(typeof s=="string"){if(s!==r)return!1}else if(!isArray$7(r)||r.length!==s.length||s.some((o,a)=>o!==r[a]))return!1}return!0}function getOriginalPath(i){return i?i.aliasOf?i.aliasOf.path:i.path:""}const getLinkClass=(i,e,t)=>i!=null?i:e!=null?e:t,RouterViewImpl=defineComponent({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(i,{attrs:e,slots:t}){const s=inject(routerViewLocationKey),r=computed(()=>i.route||s.value),o=inject(viewDepthKey,0),a=computed(()=>{let d=unref(o);const{matched:m}=r.value;let u;for(;(u=m[d])&&!u.components;)d++;return d}),l=computed(()=>r.value.matched[a.value]);provide(viewDepthKey,computed(()=>a.value+1)),provide(matchedRouteKey,l),provide(routerViewLocationKey,r);const c=ref();return watch(()=>[c.value,l.value,i.name],([d,m,u],[g,b,y])=>{m&&(m.instances[u]=d,b&&b!==m&&d&&d===g&&(m.leaveGuards.size||(m.leaveGuards=b.leaveGuards),m.updateGuards.size||(m.updateGuards=b.updateGuards))),d&&m&&(!b||!isSameRouteRecord(m,b)||!g)&&(m.enterCallbacks[u]||[]).forEach(S=>S(d))},{flush:"post"}),()=>{const d=r.value,m=i.name,u=l.value,g=u&&u.components[m];if(!g)return normalizeSlot(t.default,{Component:g,route:d});const b=u.props[m],y=b?b===!0?d.params:typeof b=="function"?b(d):b:null,v=h(g,assign$2({},y,e,{onVnodeUnmounted:x=>{x.component.isUnmounted&&(u.instances[m]=null)},ref:c}));return normalizeSlot(t.default,{Component:v,route:d})||v}}});function normalizeSlot(i,e){if(!i)return null;const t=i(e);return t.length===1?t[0]:t}const RouterView=RouterViewImpl;function createRouter(i){const e=createRouterMatcher(i.routes,i),t=i.parseQuery||parseQuery,s=i.stringifyQuery||stringifyQuery,r=i.history,o=useCallbacks(),a=useCallbacks(),l=useCallbacks(),c=shallowRef(START_LOCATION_NORMALIZED);let d=START_LOCATION_NORMALIZED;isBrowser&&i.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const m=applyToParams.bind(null,W=>""+W),u=applyToParams.bind(null,encodeParam),g=applyToParams.bind(null,decode$5);function b(W,oe){let he,le;return isRouteName(W)?(he=e.getRecordMatcher(W),le=oe):le=W,e.addRoute(le,he)}function y(W){const oe=e.getRecordMatcher(W);oe&&e.removeRoute(oe)}function S(){return e.getRoutes().map(W=>W.record)}function v(W){return!!e.getRecordMatcher(W)}function x(W,oe){if(oe=assign$2({},oe||c.value),typeof W=="string"){const z=parseURL(t,W,oe.path),J=e.resolve({path:z.path},oe),T=r.createHref(z.fullPath);return assign$2(z,J,{params:g(J.params),hash:decode$5(z.hash),redirectedFrom:void 0,href:T})}let he;if("path"in W)he=assign$2({},W,{path:parseURL(t,W.path,oe.path).path});else{const z=assign$2({},W.params);for(const J in z)z[J]==null&&delete z[J];he=assign$2({},W,{params:u(W.params)}),oe.params=u(oe.params)}const le=e.resolve(he,oe),me=W.hash||"";le.params=m(g(le.params));const Ae=stringifyURL(s,assign$2({},W,{hash:encodeHash(me),path:le.path})),be=r.createHref(Ae);return assign$2({fullPath:Ae,hash:me,query:s===stringifyQuery?normalizeQuery(W.query):W.query||{}},le,{redirectedFrom:void 0,href:be})}function A(W){return typeof W=="string"?parseURL(t,W,c.value.path):assign$2({},W)}function E(W,oe){if(d!==W)return createRouterError(8,{from:oe,to:W})}function _(W){return P(W)}function w(W){return _(assign$2(A(W),{replace:!0}))}function C(W){const oe=W.matched[W.matched.length-1];if(oe&&oe.redirect){const{redirect:he}=oe;let le=typeof he=="function"?he(W):he;return typeof le=="string"&&(le=le.includes("?")||le.includes("#")?le=A(le):{path:le},le.params={}),assign$2({query:W.query,hash:W.hash,params:"path"in le?{}:W.params},le)}}function P(W,oe){const he=d=x(W),le=c.value,me=W.state,Ae=W.force,be=W.replace===!0,z=C(he);if(z)return P(assign$2(A(z),{state:typeof z=="object"?assign$2({},me,z.state):me,force:Ae,replace:be}),oe||he);const J=he;J.redirectedFrom=oe;let T;return!Ae&&isSameRouteLocation(s,le,he)&&(T=createRouterError(16,{to:J,from:le}),de(le,le,!0,!1)),(T?Promise.resolve(T):N(J,le)).catch(q=>isNavigationFailure(q)?isNavigationFailure(q,2)?q:ie(q):$(q,J,le)).then(q=>{if(q){if(isNavigationFailure(q,2))return P(assign$2({replace:be},A(q.to),{state:typeof q.to=="object"?assign$2({},me,q.to.state):me,force:Ae}),oe||J)}else q=F(J,le,!0,be,me);return R(J,le,q),q})}function I(W,oe){const he=E(W,oe);return he?Promise.reject(he):Promise.resolve()}function N(W,oe){let he;const[le,me,Ae]=extractChangingRecords(W,oe);he=extractComponentsGuards(le.reverse(),"beforeRouteLeave",W,oe);for(const z of le)z.leaveGuards.forEach(J=>{he.push(guardToPromiseFn(J,W,oe))});const be=I.bind(null,W,oe);return he.push(be),runGuardQueue(he).then(()=>{he=[];for(const z of o.list())he.push(guardToPromiseFn(z,W,oe));return he.push(be),runGuardQueue(he)}).then(()=>{he=extractComponentsGuards(me,"beforeRouteUpdate",W,oe);for(const z of me)z.updateGuards.forEach(J=>{he.push(guardToPromiseFn(J,W,oe))});return he.push(be),runGuardQueue(he)}).then(()=>{he=[];for(const z of W.matched)if(z.beforeEnter&&!oe.matched.includes(z))if(isArray$7(z.beforeEnter))for(const J of z.beforeEnter)he.push(guardToPromiseFn(J,W,oe));else he.push(guardToPromiseFn(z.beforeEnter,W,oe));return he.push(be),runGuardQueue(he)}).then(()=>(W.matched.forEach(z=>z.enterCallbacks={}),he=extractComponentsGuards(Ae,"beforeRouteEnter",W,oe),he.push(be),runGuardQueue(he))).then(()=>{he=[];for(const z of a.list())he.push(guardToPromiseFn(z,W,oe));return he.push(be),runGuardQueue(he)}).catch(z=>isNavigationFailure(z,8)?z:Promise.reject(z))}function R(W,oe,he){for(const le of l.list())le(W,oe,he)}function F(W,oe,he,le,me){const Ae=E(W,oe);if(Ae)return Ae;const be=oe===START_LOCATION_NORMALIZED,z=isBrowser?history.state:{};he&&(le||be?r.replace(W.fullPath,assign$2({scroll:be&&z&&z.scroll},me)):r.push(W.fullPath,me)),c.value=W,de(W,oe,he,be),ie()}let B;function k(){B||(B=r.listen((W,oe,he)=>{if(!ne.listening)return;const le=x(W),me=C(le);if(me){P(assign$2(me,{replace:!0}),le).catch(noop$2);return}d=le;const Ae=c.value;isBrowser&&saveScrollPosition(getScrollKey(Ae.fullPath,he.delta),computeScrollPosition()),N(le,Ae).catch(be=>isNavigationFailure(be,12)?be:isNavigationFailure(be,2)?(P(be.to,le).then(z=>{isNavigationFailure(z,20)&&!he.delta&&he.type===NavigationType.pop&&r.go(-1,!1)}).catch(noop$2),Promise.reject()):(he.delta&&r.go(-he.delta,!1),$(be,le,Ae))).then(be=>{be=be||F(le,Ae,!1),be&&(he.delta&&!isNavigationFailure(be,8)?r.go(-he.delta,!1):he.type===NavigationType.pop&&isNavigationFailure(be,20)&&r.go(-1,!1)),R(le,Ae,be)}).catch(noop$2)}))}let M=useCallbacks(),G=useCallbacks(),ee;function $(W,oe,he){ie(W);const le=G.list();return le.length?le.forEach(me=>me(W,oe,he)):console.error(W),Promise.reject(W)}function re(){return ee&&c.value!==START_LOCATION_NORMALIZED?Promise.resolve():new Promise((W,oe)=>{M.add([W,oe])})}function ie(W){return ee||(ee=!W,k(),M.list().forEach(([oe,he])=>W?he(W):oe()),M.reset()),W}function de(W,oe,he,le){const{scrollBehavior:me}=i;if(!isBrowser||!me)return Promise.resolve();const Ae=!he&&getSavedScrollPosition(getScrollKey(W.fullPath,0))||(le||!he)&&history.state&&history.state.scroll||null;return nextTick().then(()=>me(W,oe,Ae)).then(be=>be&&scrollToPosition(be)).catch(be=>$(be,W,oe))}const Q=W=>r.go(W);let H;const ue=new Set,ne={currentRoute:c,listening:!0,addRoute:b,removeRoute:y,hasRoute:v,getRoutes:S,resolve:x,options:i,push:_,replace:w,go:Q,back:()=>Q(-1),forward:()=>Q(1),beforeEach:o.add,beforeResolve:a.add,afterEach:l.add,onError:G.add,isReady:re,install(W){const oe=this;W.component("RouterLink",RouterLink),W.component("RouterView",RouterView),W.config.globalProperties.$router=oe,Object.defineProperty(W.config.globalProperties,"$route",{enumerable:!0,get:()=>unref(c)}),isBrowser&&!H&&c.value===START_LOCATION_NORMALIZED&&(H=!0,_(r.location).catch(me=>{}));const he={};for(const me in START_LOCATION_NORMALIZED)he[me]=computed(()=>c.value[me]);W.provide(routerKey,oe),W.provide(routeLocationKey,reactive(he)),W.provide(routerViewLocationKey,c);const le=W.unmount;ue.add(W),W.unmount=function(){ue.delete(W),ue.size<1&&(d=START_LOCATION_NORMALIZED,B&&B(),B=null,c.value=START_LOCATION_NORMALIZED,H=!1,ee=!1),le()}}};return ne}function runGuardQueue(i){return i.reduce((e,t)=>e.then(()=>t()),Promise.resolve())}function extractChangingRecords(i,e){const t=[],s=[],r=[],o=Math.max(e.matched.length,i.matched.length);for(let a=0;aisSameRouteRecord(d,l))?s.push(l):t.push(l));const c=i.matched[a];c&&(e.matched.find(d=>isSameRouteRecord(d,c))||r.push(c))}return[t,s,r]}function useRoute$1(){return inject(routeLocationKey)}const isDef$1=i=>i!=null,isFunction$4=i=>typeof i=="function",isObject$3=i=>i!==null&&typeof i=="object",isPromise=i=>isObject$3(i)&&isFunction$4(i.then)&&isFunction$4(i.catch),isNumeric=i=>typeof i=="number"||/^\d+(\.\d+)?$/.test(i),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(i,e){const t=e.split(".");let s=i;return t.forEach(r=>{var o;s=isObject$3(s)&&(o=s[r])!=null?o:""}),s}function pick$1(i,e,t){return e.reduce((s,r)=>((!t||i[r]!==void 0)&&(s[r]=i[r]),s),{})}const isSameValue=(i,e)=>JSON.stringify(i)===JSON.stringify(e),toArray=i=>Array.isArray(i)?i:[i],unknownProp=null,numericProp=[Number,String],truthProp={type:Boolean,default:!0},makeRequiredProp=i=>({type:i,required:!0}),makeArrayProp=()=>({type:Array,default:()=>[]}),makeNumberProp=i=>({type:Number,default:i}),makeNumericProp=i=>({type:numericProp,default:i}),makeStringProp=i=>({type:String,default:i});var inBrowser$1=typeof window<"u";function raf(i){return inBrowser$1?requestAnimationFrame(i):-1}function cancelRaf(i){inBrowser$1&&cancelAnimationFrame(i)}function doubleRaf(i){raf(()=>raf(i))}var isWindow=i=>i===window,makeDOMRect=(i,e)=>({top:0,left:0,right:i,bottom:e,width:i,height:e}),useRect=i=>{const e=unref(i);if(isWindow(e)){const t=e.innerWidth,s=e.innerHeight;return makeDOMRect(t,s)}return e!=null&&e.getBoundingClientRect?e.getBoundingClientRect():makeDOMRect(0,0)};function useParent$1(i){const e=inject(i,null);if(e){const t=getCurrentInstance(),{link:s,unlink:r,internalChildren:o}=e;s(t),onUnmounted(()=>r(t));const a=computed(()=>o.indexOf(t));return{parent:e,index:a}}return{parent:null,index:ref(-1)}}function flattenVNodes(i){const e=[],t=s=>{Array.isArray(s)&&s.forEach(r=>{var o;isVNode(r)&&(e.push(r),(o=r.component)!=null&&o.subTree&&(e.push(r.component.subTree),t(r.component.subTree.children)),r.children&&t(r.children))})};return t(i),e}var findVNodeIndex=(i,e)=>{const t=i.indexOf(e);return t===-1?i.findIndex(s=>e.key!==void 0&&e.key!==null&&s.type===e.type&&s.key===e.key):t};function sortChildren(i,e,t){const s=flattenVNodes(i.subTree.children);t.sort((o,a)=>findVNodeIndex(s,o.vnode)-findVNodeIndex(s,a.vnode));const r=t.map(o=>o.proxy);e.sort((o,a)=>{const l=r.indexOf(o),c=r.indexOf(a);return l-c})}function useChildren(i){const e=reactive([]),t=reactive([]),s=getCurrentInstance();return{children:e,linkChildren:o=>{provide(i,Object.assign({link:c=>{c.proxy&&(t.push(c),e.push(c.proxy),sortChildren(s,e,t))},unlink:c=>{const d=t.indexOf(c);e.splice(d,1),t.splice(d,1)},children:e,internalChildren:t},o))}}}function onMountedOrActivated(i){let e;onMounted(()=>{i(),nextTick(()=>{e=!0})}),onActivated(()=>{e&&i()})}function useEventListener$1(i,e,t={}){if(!inBrowser$1)return;const{target:s=window,passive:r=!1,capture:o=!1}=t;let a=!1,l;const c=u=>{if(a)return;const g=unref(u);g&&!l&&(g.addEventListener(i,e,{capture:o,passive:r}),l=!0)},d=u=>{if(a)return;const g=unref(u);g&&l&&(g.removeEventListener(i,e,o),l=!1)};onUnmounted(()=>d(s)),onDeactivated(()=>d(s)),onMountedOrActivated(()=>c(s));let m;return isRef(s)&&(m=watch(s,(u,g)=>{d(g),c(u)})),()=>{m==null||m(),d(s),a=!0}}function useClickAway(i,e,t={}){if(!inBrowser$1)return;const{eventName:s="click"}=t;useEventListener$1(s,o=>{(Array.isArray(i)?i:[i]).every(c=>{const d=unref(c);return d&&!d.contains(o.target)})&&e(o)},{target:document})}var width,height;function useWindowSize(){if(!width&&(width=ref(0),height=ref(0),inBrowser$1)){const i=()=>{width.value=window.innerWidth,height.value=window.innerHeight};i(),window.addEventListener("resize",i,{passive:!0}),window.addEventListener("orientationchange",i,{passive:!0})}return{width,height}}var overflowScrollReg=/scroll|auto|overlay/i,defaultRoot=inBrowser$1?window:void 0;function isElement$2(i){return i.tagName!=="HTML"&&i.tagName!=="BODY"&&i.nodeType===1}function getScrollParent$1(i,e=defaultRoot){let t=i;for(;t&&t!==e&&isElement$2(t);){const{overflowY:s}=window.getComputedStyle(t);if(overflowScrollReg.test(s))return t;t=t.parentNode}return e}function useScrollParent(i,e=defaultRoot){const t=ref();return onMounted(()=>{i.value&&(t.value=getScrollParent$1(i.value,e))}),t}var visibility;function usePageVisibility(){if(!visibility&&(visibility=ref("visible"),inBrowser$1)){const i=()=>{visibility.value=document.hidden?"hidden":"visible"};i(),window.addEventListener("visibilitychange",i)}return visibility}var CUSTOM_FIELD_INJECTION_KEY=Symbol("van-field");function useCustomFieldValue(i){const e=inject(CUSTOM_FIELD_INJECTION_KEY,null);e&&!e.customValue.value&&(e.customValue.value=i,watch(i,()=>{e.resetValidation(),e.validateWithTrigger("onChange")}))}function getScrollTop(i){const e="scrollTop"in i?i.scrollTop:i.pageYOffset;return Math.max(e,0)}function setScrollTop(i,e){"scrollTop"in i?i.scrollTop=e:i.scrollTo(i.scrollX,e)}function getRootScrollTop(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0}function setRootScrollTop(i){setScrollTop(window,i),setScrollTop(document.body,i)}function getElementTop(i,e){if(i===window)return 0;const t=e?getScrollTop(e):getRootScrollTop();return useRect(i).top+t}const isIOS=isIOS$1();function resetScroll(){isIOS&&setRootScrollTop(getRootScrollTop())}const stopPropagation=i=>i.stopPropagation();function preventDefault(i,e){(typeof i.cancelable!="boolean"||i.cancelable)&&i.preventDefault(),e&&stopPropagation(i)}function isHidden(i){const e=unref(i);if(!e)return!1;const t=window.getComputedStyle(e),s=t.display==="none",r=e.offsetParent===null&&t.position!=="fixed";return s||r}const{width:windowWidth,height:windowHeight}=useWindowSize();function addUnit(i){if(isDef$1(i))return isNumeric(i)?`${i}px`:String(i)}function getSizeStyle(i){if(isDef$1(i)){if(Array.isArray(i))return{width:addUnit(i[0]),height:addUnit(i[1])};const e=addUnit(i);return{width:e,height:e}}}function getZIndexStyle(i){const e={};return i!==void 0&&(e.zIndex=+i),e}let rootFontSize;function getRootFontSize(){if(!rootFontSize){const i=document.documentElement,e=i.style.fontSize||window.getComputedStyle(i).fontSize;rootFontSize=parseFloat(e)}return rootFontSize}function convertRem(i){return i=i.replace(/rem/g,""),+i*getRootFontSize()}function convertVw(i){return i=i.replace(/vw/g,""),+i*windowWidth.value/100}function convertVh(i){return i=i.replace(/vh/g,""),+i*windowHeight.value/100}function unitToPx(i){if(typeof i=="number")return i;if(inBrowser$2){if(i.includes("rem"))return convertRem(i);if(i.includes("vw"))return convertVw(i);if(i.includes("vh"))return convertVh(i)}return parseFloat(i)}const camelizeRE=/-(\w)/g,camelize$1=i=>i.replace(camelizeRE,(e,t)=>t.toUpperCase()),kebabCase=i=>i.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^-/,""),clamp=(i,e,t)=>Math.min(Math.max(i,e),t);function trimExtraChar(i,e,t){const s=i.indexOf(e);return s===-1?i:e==="-"&&s!==0?i.slice(0,s):i.slice(0,s+1)+i.slice(s).replace(t,"")}function formatNumber(i,e=!0,t=!0){e?i=trimExtraChar(i,".",/\./g):i=i.split(".")[0],t?i=trimExtraChar(i,"-",/-/g):i=i.replace(/-/,"");const s=e?/[^-0-9.]/g:/[^-0-9]/g;return i.replace(s,"")}function addNumber(i,e){return Math.round((i+e)*1e10)/1e10}const{hasOwnProperty:hasOwnProperty$1}=Object.prototype;function assignKey(i,e,t){const s=e[t];isDef$1(s)&&(!hasOwnProperty$1.call(i,t)||!isObject$3(s)?i[t]=s:i[t]=deepAssign(Object(i[t]),s))}function deepAssign(i,e){return Object.keys(e).forEach(t=>{assignKey(i,e,t)}),i}var stdin_default$s={name:"姓名",tel:"电话",save:"保存",confirm:"确认",cancel:"取消",delete:"删除",loading:"加载中...",noCoupon:"暂无优惠券",nameEmpty:"请填写姓名",addContact:"添加联系人",telInvalid:"请填写正确的电话",vanCalendar:{end:"结束",start:"开始",title:"日期选择",weekdays:["日","一","二","三","四","五","六"],monthTitle:(i,e)=>`${i}年${e}月`,rangePrompt:i=>`最多选择 ${i} 天`},vanCascader:{select:"请选择"},vanPagination:{prev:"上一页",next:"下一页"},vanPullRefresh:{pulling:"下拉即可刷新...",loosing:"释放即可刷新..."},vanSubmitBar:{label:"合计:"},vanCoupon:{unlimited:"无门槛",discount:i=>`${i}折`,condition:i=>`满${i}元可用`},vanCouponCell:{title:"优惠券",count:i=>`${i}张可用`},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$s}),Locale={messages(){return messages[lang.value]},use(i,e){lang.value=i,this.add({[i]:e})},add(i={}){deepAssign(messages,i)}};var stdin_default$r=Locale;function createTranslate(i){const e=camelize$1(i)+".";return(t,...s)=>{const r=stdin_default$r.messages(),o=get(r,e+t)||get(r,t);return isFunction$4(o)?o(...s):o}}function genBem(i,e){return e?typeof e=="string"?` ${i}--${e}`:Array.isArray(e)?e.reduce((t,s)=>t+genBem(i,s),""):Object.keys(e).reduce((t,s)=>t+(e[s]?genBem(i,s):""),""):""}function createBEM(i){return(e,t)=>(e&&typeof e!="string"&&(t=e,e=""),e=e?`${i}__${e}`:i,`${e}${genBem(e,t)}`)}function createNamespace$1(i){const e=`van-${i}`;return[e,createBEM(e),createTranslate(e)]}const BORDER="van-hairline",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(i,{args:e=[],done:t,canceled:s}){if(i){const r=i.apply(null,e);isPromise(r)?r.then(o=>{o?t():s&&s()}).catch(noop$1):r?t():s&&s()}else t()}function withInstall(i){return i.install=e=>{const{name:t}=i;t&&(e.component(t,i),e.component(camelize$1(`-${t}`),i))},i}const POPUP_TOGGLE_KEY=Symbol();function onPopupReopen(i){const e=inject(POPUP_TOGGLE_KEY,null);e&&watch(e,t=>{t&&i()})}function useExpose(i){const e=getCurrentInstance();e&&extend$2(e.proxy,i)}const routeProps={to:[String,Object],url:String,replace:Boolean};function route({to:i,url:e,replace:t,$router:s}){i&&s?s[t?"replace":"push"](i):e&&(t?location.replace(e):location.href=e)}function useRoute(){const i=getCurrentInstance().proxy;return()=>route(i)}const[name$o,bem$o]=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$q=defineComponent({name:name$o,props:badgeProps,setup(i,{slots:e}){const t=()=>{if(e.content)return!0;const{content:l,showZero:c}=i;return isDef$1(l)&&l!==""&&(c||l!==0&&l!=="0")},s=()=>{const{dot:l,max:c,content:d}=i;if(!l&&t())return e.content?e.content():isDef$1(c)&&isNumeric(d)&&+d>+c?`${c}+`:d},r=l=>l.startsWith("-")?l.replace("-",""):`-${l}`,o=computed(()=>{const l={background:i.color};if(i.offset){const[c,d]=i.offset,{position:m}=i,[u,g]=m.split("-");e.default?(typeof d=="number"?l[u]=addUnit(u==="top"?d:-d):l[u]=u==="top"?addUnit(d):r(d),typeof c=="number"?l[g]=addUnit(g==="left"?c:-c):l[g]=g==="left"?addUnit(c):r(c)):(l.marginTop=addUnit(d),l.marginLeft=addUnit(c))}return l}),a=()=>{if(t()||i.dot)return createVNode("div",{class:bem$o([i.position,{dot:i.dot,fixed:!!e.default}]),style:o.value},[s()])};return()=>{if(e.default){const{tag:l}=i;return createVNode(l,{class:bem$o("wrapper")},{default:()=>[e.default(),a()]})}return a()}}});const Badge=withInstall(stdin_default$q);let globalZIndex=2e3;const useGlobalZIndex=()=>++globalZIndex,setGlobalZIndex=i=>{globalZIndex=i},[name$n,bem$n]=createNamespace$1("config-provider"),CONFIG_PROVIDER_KEY=Symbol(name$n),configProviderProps={tag:makeStringProp("div"),theme:makeStringProp("light"),zIndex:Number,themeVars:Object,themeVarsDark:Object,themeVarsLight:Object,iconPrefix:String};function mapThemeVarsToCSSVars(i){const e={};return Object.keys(i).forEach(t=>{e[`--van-${kebabCase(t)}`]=i[t]}),e}defineComponent({name:name$n,props:configProviderProps,setup(i,{slots:e}){const t=computed(()=>mapThemeVarsToCSSVars(extend$2({},i.themeVars,i.theme==="dark"?i.themeVarsDark:i.themeVarsLight)));if(inBrowser$2){const s=()=>{document.documentElement.classList.add(`van-theme-${i.theme}`)},r=(o=i.theme)=>{document.documentElement.classList.remove(`van-theme-${o}`)};watch(()=>i.theme,(o,a)=>{a&&r(a),s()},{immediate:!0}),onActivated(s),onDeactivated(r),onBeforeUnmount(r)}return provide(CONFIG_PROVIDER_KEY,i),watchEffect(()=>{i.zIndex!==void 0&&setGlobalZIndex(i.zIndex)}),()=>createVNode(i.tag,{class:bem$n(),style:t.value},{default:()=>{var s;return[(s=e.default)==null?void 0:s.call(e)]}})}});const[name$m,bem$m]=createNamespace$1("icon"),isImage=i=>i==null?void 0:i.includes("/"),iconProps={dot:Boolean,tag:makeStringProp("i"),name:String,size:numericProp,badge:numericProp,color:String,badgeProps:Object,classPrefix:String};var stdin_default$p=defineComponent({name:name$m,props:iconProps,setup(i,{slots:e}){const t=inject(CONFIG_PROVIDER_KEY,null),s=computed(()=>i.classPrefix||(t==null?void 0:t.iconPrefix)||bem$m());return()=>{const{tag:r,dot:o,name:a,size:l,badge:c,color:d}=i,m=isImage(a);return createVNode(Badge,mergeProps({dot:o,tag:r,class:[s.value,m?"":`${s.value}-${a}`],style:{color:d,fontSize:addUnit(l)},content:c},i.badgeProps),{default:()=>{var u;return[(u=e.default)==null?void 0:u.call(e),m&&createVNode("img",{class:bem$m("image"),src:a},null)]}})}}});const Icon$1=withInstall(stdin_default$p),[name$l,bem$l]=createNamespace$1("loading"),SpinIcon=Array(12).fill(null).map((i,e)=>createVNode("i",{class:bem$l("line",String(e+1))},null)),CircularIcon=createVNode("svg",{class:bem$l("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$o=defineComponent({name:name$l,props:loadingProps,setup(i,{slots:e}){const t=computed(()=>extend$2({color:i.color},getSizeStyle(i.size))),s=()=>{const o=i.type==="spinner"?SpinIcon:CircularIcon;return createVNode("span",{class:bem$l("spinner",i.type),style:t.value},[e.icon?e.icon():o])},r=()=>{var o;if(e.default)return createVNode("span",{class:bem$l("text"),style:{fontSize:addUnit(i.textSize),color:(o=i.textColor)!=null?o:i.color}},[e.default()])};return()=>{const{type:o,vertical:a}=i;return createVNode("div",{class:bem$l([o,{vertical:a}]),"aria-live":"polite","aria-busy":!0},[s(),r()])}}});const Loading$1=withInstall(stdin_default$o),[name$k,bem$k]=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$n=defineComponent({name:name$k,props:buttonProps,emits:["click"],setup(i,{emit:e,slots:t}){const s=useRoute(),r=()=>t.loading?t.loading():createVNode(Loading$1,{size:i.loadingSize,type:i.loadingType,class:bem$k("loading")},null),o=()=>{if(i.loading)return r();if(t.icon)return createVNode("div",{class:bem$k("icon")},[t.icon()]);if(i.icon)return createVNode(Icon$1,{name:i.icon,class:bem$k("icon"),classPrefix:i.iconPrefix},null)},a=()=>{let d;if(i.loading?d=i.loadingText:d=t.default?t.default():i.text,d)return createVNode("span",{class:bem$k("text")},[d])},l=()=>{const{color:d,plain:m}=i;if(d){const u={color:m?d:"white"};return m||(u.background=d),d.includes("gradient")?u.border=0:u.borderColor=d,u}},c=d=>{i.loading?preventDefault(d):i.disabled||(e("click",d),s())};return()=>{const{tag:d,type:m,size:u,block:g,round:b,plain:y,square:S,loading:v,disabled:x,hairline:A,nativeType:E,iconPosition:_}=i,w=[bem$k([m,u,{plain:y,block:g,round:b,square:S,loading:v,disabled:x,hairline:A}]),{[BORDER_SURROUND]:A}];return createVNode(d,{type:E,class:w,style:l(),disabled:x,onClick:c},{default:()=>[createVNode("div",{class:bem$k("content")},[_==="left"&&o(),a(),_==="right"&&o()])]})}}});const Button=withInstall(stdin_default$n),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};function getDirection(i,e){return i>e?"horizontal":e>i?"vertical":""}function useTouch(){const i=ref(0),e=ref(0),t=ref(0),s=ref(0),r=ref(0),o=ref(0),a=ref(""),l=()=>a.value==="vertical",c=()=>a.value==="horizontal",d=()=>{t.value=0,s.value=0,r.value=0,o.value=0,a.value=""};return{move:g=>{const b=g.touches[0];t.value=(b.clientX<0?0:b.clientX)-i.value,s.value=b.clientY-e.value,r.value=Math.abs(t.value),o.value=Math.abs(s.value);const y=10;(!a.value||r.value{d(),i.value=g.touches[0].clientX,e.value=g.touches[0].clientY},reset:d,startX:i,startY:e,deltaX:t,deltaY:s,offsetX:r,offsetY:o,direction:a,isVertical:l,isHorizontal:c}}let totalLockCount=0;const BODY_LOCK_CLASS="van-overflow-hidden";function useLockScroll(i,e){const t=useTouch(),s="01",r="10",o=m=>{t.move(m);const u=t.deltaY.value>0?r:s,g=getScrollParent$1(m.target,i.value),{scrollHeight:b,offsetHeight:y,scrollTop:S}=g;let v="11";S===0?v=y>=b?"00":"01":S+y>=b&&(v="10"),v!=="11"&&t.isVertical()&&!(parseInt(v,2)&parseInt(u,2))&&preventDefault(m,!0)},a=()=>{document.addEventListener("touchstart",t.start),document.addEventListener("touchmove",o,{passive:!1}),totalLockCount||document.body.classList.add(BODY_LOCK_CLASS),totalLockCount++},l=()=>{totalLockCount&&(document.removeEventListener("touchstart",t.start),document.removeEventListener("touchmove",o),totalLockCount--,totalLockCount||document.body.classList.remove(BODY_LOCK_CLASS))},c=()=>e()&&a(),d=()=>e()&&l();onMountedOrActivated(c),onDeactivated(d),onBeforeUnmount(d),watch(e,m=>{m?a():l()})}function useLazyRender(i){const e=ref(!1);return watch(i,t=>{t&&(e.value=t)},{immediate:!0}),t=>()=>e.value?t():null}const[name$j,bem$j]=createNamespace$1("overlay"),overlayProps={show:Boolean,zIndex:numericProp,duration:numericProp,className:unknownProp,lockScroll:truthProp,lazyRender:truthProp,customStyle:Object};var stdin_default$m=defineComponent({name:name$j,props:overlayProps,setup(i,{slots:e}){const t=ref(),s=useLazyRender(()=>i.show||!i.lazyRender),r=a=>{i.lockScroll&&preventDefault(a,!0)},o=s(()=>{var a;const l=extend$2(getZIndexStyle(i.zIndex),i.customStyle);return isDef$1(i.duration)&&(l.animationDuration=`${i.duration}s`),withDirectives(createVNode("div",{ref:t,style:l,class:[bem$j(),i.className]},[(a=e.default)==null?void 0:a.call(e)]),[[vShow,i.show]])});return useEventListener$1("touchmove",r,{target:t}),()=>createVNode(Transition,{name:"van-fade",appear:!0},{default:o})}});const Overlay=withInstall(stdin_default$m),popupProps$1=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$i,bem$i]=createNamespace$1("popup");var stdin_default$l=defineComponent({name:name$i,inheritAttrs:!1,props:popupProps$1,emits:["open","close","opened","closed","keydown","update:show","clickOverlay","clickCloseIcon"],setup(i,{emit:e,attrs:t,slots:s}){let r,o;const a=ref(),l=ref(),c=useLazyRender(()=>i.show||!i.lazyRender),d=computed(()=>{const w={zIndex:a.value};if(isDef$1(i.duration)){const C=i.position==="center"?"animationDuration":"transitionDuration";w[C]=`${i.duration}s`}return w}),m=()=>{r||(r=!0,a.value=i.zIndex!==void 0?+i.zIndex:useGlobalZIndex(),e("open"))},u=()=>{r&&callInterceptor(i.beforeClose,{done(){r=!1,e("close"),e("update:show",!1)}})},g=w=>{e("clickOverlay",w),i.closeOnClickOverlay&&u()},b=()=>{if(i.overlay)return createVNode(Overlay,{show:i.show,class:i.overlayClass,zIndex:a.value,duration:i.duration,customStyle:i.overlayStyle,role:i.closeOnClickOverlay?"button":void 0,tabindex:i.closeOnClickOverlay?0:void 0,onClick:g},{default:s["overlay-content"]})},y=w=>{e("clickCloseIcon",w),u()},S=()=>{if(i.closeable)return createVNode(Icon$1,{role:"button",tabindex:0,name:i.closeIcon,class:[bem$i("close-icon",i.closeIconPosition),HAPTICS_FEEDBACK],classPrefix:i.iconPrefix,onClick:y},null)},v=()=>e("opened"),x=()=>e("closed"),A=w=>e("keydown",w),E=c(()=>{var w;const{round:C,position:P,safeAreaInsetTop:I,safeAreaInsetBottom:N}=i;return withDirectives(createVNode("div",mergeProps({ref:l,style:d.value,role:"dialog",tabindex:0,class:[bem$i({round:C,[P]:P}),{"van-safe-area-top":I,"van-safe-area-bottom":N}],onKeydown:A},t),[(w=s.default)==null?void 0:w.call(s),S()]),[[vShow,i.show]])}),_=()=>{const{position:w,transition:C,transitionAppear:P}=i,I=w==="center"?"van-fade":`van-popup-slide-${w}`;return createVNode(Transition,{name:C||I,appear:P,onAfterEnter:v,onAfterLeave:x},{default:E})};return watch(()=>i.show,w=>{w&&!r&&(m(),t.tabindex===0&&nextTick(()=>{var C;(C=l.value)==null||C.focus()})),!w&&r&&(r=!1,e("close"))}),useExpose({popupRef:l}),useLockScroll(l,()=>i.show&&i.lockScroll),useEventListener$1("popstate",()=>{i.closeOnPopstate&&(u(),o=!1)}),onMounted(()=>{i.show&&m()}),onActivated(()=>{o&&(e("update:show",!0),o=!1)}),onDeactivated(()=>{i.show&&i.teleport&&(u(),o=!0)}),provide(POPUP_TOGGLE_KEY,()=>i.show),()=>i.teleport?createVNode(Teleport,{to:i.teleport},{default:()=>[b(),_()]}):createVNode(Fragment,null,[b(),_()])}});const Popup$1=withInstall(stdin_default$l);function scrollLeftTo(i,e,t){let s=0;const r=i.scrollLeft,o=t===0?1:Math.round(t*1e3/16);function a(){i.scrollLeft+=(e-r)/o,++se||!o&&re?raf(c):s&&raf(s)}c()}let current=0;function useId(){const i=getCurrentInstance(),{name:e="unknown"}=(i==null?void 0:i.type)||{};return`${e}-${++current}`}function useRefs(){const i=ref([]),e=[];return onBeforeUpdate(()=>{i.value=[]}),[i,s=>(e[s]||(e[s]=r=>{i.value[s]=r}),e[s])]}function useVisibilityChange(i,e){if(!inBrowser$2||!window.IntersectionObserver)return;const t=new IntersectionObserver(o=>{e(o[0].intersectionRatio>0)},{root:document.body}),s=()=>{i.value&&t.observe(i.value)},r=()=>{i.value&&t.unobserve(i.value)};onDeactivated(r),onBeforeUnmount(r),onMountedOrActivated(s)}const[name$h,bem$h]=createNamespace$1("sticky"),stickyProps={zIndex:numericProp,position:makeStringProp("top"),container:Object,offsetTop:makeNumericProp(0),offsetBottom:makeNumericProp(0)};var stdin_default$k=defineComponent({name:name$h,props:stickyProps,emits:["scroll","change"],setup(i,{emit:e,slots:t}){const s=ref(),r=useScrollParent(s),o=reactive({fixed:!1,width:0,height:0,transform:0}),a=computed(()=>unitToPx(i.position==="top"?i.offsetTop:i.offsetBottom)),l=computed(()=>{const{fixed:u,height:g,width:b}=o;if(u)return{width:`${b}px`,height:`${g}px`}}),c=computed(()=>{if(!o.fixed)return;const u=extend$2(getZIndexStyle(i.zIndex),{width:`${o.width}px`,height:`${o.height}px`,[i.position]:`${a.value}px`});return o.transform&&(u.transform=`translate3d(0, ${o.transform}px, 0)`),u}),d=u=>e("scroll",{scrollTop:u,isFixed:o.fixed}),m=()=>{if(!s.value||isHidden(s))return;const{container:u,position:g}=i,b=useRect(s),y=getScrollTop(window);if(o.width=b.width,o.height=b.height,g==="top")if(u){const S=useRect(u),v=S.bottom-a.value-o.height;o.fixed=a.value>b.top&&S.bottom>0,o.transform=v<0?v:0}else o.fixed=a.value>b.top;else{const{clientHeight:S}=document.documentElement;if(u){const v=useRect(u),x=S-v.top-a.value-o.height;o.fixed=S-a.valuev.top,o.transform=x<0?-x:0}else o.fixed=S-a.valueo.fixed,u=>e("change",u)),useEventListener$1("scroll",m,{target:r,passive:!0}),useVisibilityChange(s,m),()=>{var u;return createVNode("div",{ref:s,style:l.value},[createVNode("div",{class:bem$h({fixed:o.fixed}),style:c.value},[(u=t.default)==null?void 0:u.call(t)])])}}});const Sticky=withInstall(stdin_default$k),[name$g,bem$g]=createNamespace$1("tab");var stdin_default$j=defineComponent({name:name$g,props:{id:String,dot:Boolean,type:String,color:String,title:String,badge:numericProp,shrink:Boolean,isActive:Boolean,disabled:Boolean,controls:String,scrollable:Boolean,activeColor:String,inactiveColor:String,showZeroBadge:truthProp},setup(i,{slots:e}){const t=computed(()=>{const r={},{type:o,color:a,disabled:l,isActive:c,activeColor:d,inactiveColor:m}=i;a&&o==="card"&&(r.borderColor=a,l||(c?r.backgroundColor=a:r.color=a));const g=c?d:m;return g&&(r.color=g),r}),s=()=>{const r=createVNode("span",{class:bem$g("text",{ellipsis:!i.scrollable})},[e.title?e.title():i.title]);return i.dot||isDef$1(i.badge)&&i.badge!==""?createVNode(Badge,{dot:i.dot,content:i.badge,showZero:i.showZeroBadge},{default:()=>[r]}):r};return()=>createVNode("div",{id:i.id,role:"tab",class:[bem$g([i.type,{grow:i.scrollable&&!i.shrink,shrink:i.shrink,active:i.isActive,disabled:i.disabled}])],style:t.value,tabindex:i.disabled?void 0:i.isActive?0:-1,"aria-selected":i.isActive,"aria-disabled":i.disabled||void 0,"aria-controls":i.controls},[s()])}});const[name$f,bem$f]=createNamespace$1("swipe"),swipeProps={loop:truthProp,width:numericProp,height:numericProp,vertical:Boolean,autoplay:makeNumericProp(0),duration:makeNumericProp(500),touchable:truthProp,lazyRender:Boolean,initialSwipe:makeNumericProp(0),indicatorColor:String,showIndicators:truthProp,stopPropagation:truthProp},SWIPE_KEY=Symbol(name$f);var stdin_default$i=defineComponent({name:name$f,props:swipeProps,emits:["change","dragStart","dragEnd"],setup(i,{emit:e,slots:t}){const s=ref(),r=ref(),o=reactive({rect:null,width:0,height:0,offset:0,active:0,swiping:!1});let a=!1;const l=useTouch(),{children:c,linkChildren:d}=useChildren(SWIPE_KEY),m=computed(()=>c.length),u=computed(()=>o[i.vertical?"height":"width"]),g=computed(()=>i.vertical?l.deltaY.value:l.deltaX.value),b=computed(()=>o.rect?(i.vertical?o.rect.height:o.rect.width)-u.value*m.value:0),y=computed(()=>u.value?Math.ceil(Math.abs(b.value)/u.value):m.value),S=computed(()=>m.value*u.value),v=computed(()=>(o.active+m.value)%m.value),x=computed(()=>{const Q=i.vertical?"vertical":"horizontal";return l.direction.value===Q}),A=computed(()=>{const Q={transitionDuration:`${o.swiping?0:i.duration}ms`,transform:`translate${i.vertical?"Y":"X"}(${o.offset}px)`};if(u.value){const H=i.vertical?"height":"width",ue=i.vertical?"width":"height";Q[H]=`${S.value}px`,Q[ue]=i[ue]?`${i[ue]}px`:""}return Q}),E=Q=>{const{active:H}=o;return Q?i.loop?clamp(H+Q,-1,m.value):clamp(H+Q,0,y.value):H},_=(Q,H=0)=>{let ue=Q*u.value;i.loop||(ue=Math.min(ue,-b.value));let ne=H-ue;return i.loop||(ne=clamp(ne,b.value,0)),ne},w=({pace:Q=0,offset:H=0,emitChange:ue})=>{if(m.value<=1)return;const{active:ne}=o,W=E(Q),oe=_(W,H);if(i.loop){if(c[0]&&oe!==b.value){const he=oe0;c[m.value-1].setOffset(he?-S.value:0)}}o.active=W,o.offset=oe,ue&&W!==ne&&e("change",v.value)},C=()=>{o.swiping=!0,o.active<=-1?w({pace:m.value}):o.active>=m.value&&w({pace:-m.value})},P=()=>{C(),l.reset(),doubleRaf(()=>{o.swiping=!1,w({pace:-1,emitChange:!0})})},I=()=>{C(),l.reset(),doubleRaf(()=>{o.swiping=!1,w({pace:1,emitChange:!0})})};let N;const R=()=>clearTimeout(N),F=()=>{R(),+i.autoplay>0&&m.value>1&&(N=setTimeout(()=>{I(),F()},+i.autoplay))},B=(Q=+i.initialSwipe)=>{if(!s.value)return;const H=()=>{var ue,ne;if(!isHidden(s)){const W={width:s.value.offsetWidth,height:s.value.offsetHeight};o.rect=W,o.width=+((ue=i.width)!=null?ue:W.width),o.height=+((ne=i.height)!=null?ne:W.height)}m.value&&(Q=Math.min(m.value-1,Q),Q===-1&&(Q=m.value-1)),o.active=Q,o.swiping=!0,o.offset=_(Q),c.forEach(W=>{W.setOffset(0)}),F()};isHidden(s)?nextTick().then(H):H()},k=()=>B(o.active);let M;const G=Q=>{!i.touchable||Q.touches.length>1||(l.start(Q),a=!1,M=Date.now(),R(),C())},ee=Q=>{i.touchable&&o.swiping&&(l.move(Q),x.value&&(!i.loop&&(o.active===0&&g.value>0||o.active===m.value-1&&g.value<0)||(preventDefault(Q,i.stopPropagation),w({offset:g.value}),a||(e("dragStart",{index:v.value}),a=!0))))},$=()=>{if(!i.touchable||!o.swiping)return;const Q=Date.now()-M,H=g.value/Q;if((Math.abs(H)>.25||Math.abs(g.value)>u.value/2)&&x.value){const ne=i.vertical?l.offsetY.value:l.offsetX.value;let W=0;i.loop?W=ne>0?g.value>0?-1:1:0:W=-Math[g.value>0?"ceil":"floor"](g.value/u.value),w({pace:W,emitChange:!0})}else g.value&&w({pace:0});a=!1,o.swiping=!1,e("dragEnd",{index:v.value}),F()},re=(Q,H={})=>{C(),l.reset(),doubleRaf(()=>{let ue;i.loop&&Q===m.value?ue=o.active===0?0:Q:ue=Q%m.value,H.immediate?doubleRaf(()=>{o.swiping=!1}):o.swiping=!1,w({pace:ue-o.active,emitChange:!0})})},ie=(Q,H)=>{const ue=H===v.value,ne=ue?{backgroundColor:i.indicatorColor}:void 0;return createVNode("i",{style:ne,class:bem$f("indicator",{active:ue})},null)},de=()=>{if(t.indicator)return t.indicator({active:v.value,total:m.value});if(i.showIndicators&&m.value>1)return createVNode("div",{class:bem$f("indicators",{vertical:i.vertical})},[Array(m.value).fill("").map(ie)])};return useExpose({prev:P,next:I,state:o,resize:k,swipeTo:re}),d({size:u,props:i,count:m,activeIndicator:v}),watch(()=>i.initialSwipe,Q=>B(+Q)),watch(m,()=>B(o.active)),watch(()=>i.autoplay,F),watch([windowWidth,windowHeight],k),watch(usePageVisibility(),Q=>{Q==="visible"?F():R()}),onMounted(B),onActivated(()=>B(o.active)),onPopupReopen(()=>B(o.active)),onDeactivated(R),onBeforeUnmount(R),useEventListener$1("touchmove",ee,{target:r}),()=>{var Q;return createVNode("div",{ref:s,class:bem$f()},[createVNode("div",{ref:r,style:A.value,class:bem$f("track",{vertical:i.vertical}),onTouchstartPassive:G,onTouchend:$,onTouchcancel:$},[(Q=t.default)==null?void 0:Q.call(t)]),de()])}}});const Swipe=withInstall(stdin_default$i),[name$e,bem$e]=createNamespace$1("tabs");var stdin_default$h=defineComponent({name:name$e,props:{count:makeRequiredProp(Number),inited:Boolean,animated:Boolean,duration:makeRequiredProp(numericProp),swipeable:Boolean,lazyRender:Boolean,currentIndex:makeRequiredProp(Number)},emits:["change"],setup(i,{emit:e,slots:t}){const s=ref(),r=l=>e("change",l),o=()=>{var l;const c=(l=t.default)==null?void 0:l.call(t);return i.animated||i.swipeable?createVNode(Swipe,{ref:s,loop:!1,class:bem$e("track"),duration:+i.duration*1e3,touchable:i.swipeable,lazyRender:i.lazyRender,showIndicators:!1,onChange:r},{default:()=>[c]}):c},a=l=>{const c=s.value;c&&c.state.active!==l&&c.swipeTo(l,{immediate:!i.inited})};return watch(()=>i.currentIndex,a),onMounted(()=>{a(i.currentIndex)}),useExpose({swipeRef:s}),()=>createVNode("div",{class:bem$e("content",{animated:i.animated||i.swipeable})},[o()])}});const[name$d,bem$d]=createNamespace$1("tabs"),tabsProps={type:makeStringProp("line"),color:String,border:Boolean,sticky:Boolean,shrink:Boolean,active:makeNumericProp(0),duration:makeNumericProp(.3),animated:Boolean,ellipsis:truthProp,swipeable:Boolean,scrollspy:Boolean,offsetTop:makeNumericProp(0),background:String,lazyRender:truthProp,lineWidth:numericProp,lineHeight:numericProp,beforeChange:Function,swipeThreshold:makeNumericProp(5),titleActiveColor:String,titleInactiveColor:String},TABS_KEY=Symbol(name$d);var stdin_default$g=defineComponent({name:name$d,props:tabsProps,emits:["change","scroll","rendered","clickTab","update:active"],setup(i,{emit:e,slots:t}){let s,r,o;const a=ref(),l=ref(),c=ref(),d=ref(),m=useId(),u=useScrollParent(a),[g,b]=useRefs(),{children:y,linkChildren:S}=useChildren(TABS_KEY),v=reactive({inited:!1,position:"",lineStyle:{},currentIndex:-1}),x=computed(()=>y.length>+i.swipeThreshold||!i.ellipsis||i.shrink),A=computed(()=>({borderColor:i.color,background:i.background})),E=(ne,W)=>{var oe;return(oe=ne.name)!=null?oe:W},_=computed(()=>{const ne=y[v.currentIndex];if(ne)return E(ne,v.currentIndex)}),w=computed(()=>unitToPx(i.offsetTop)),C=computed(()=>i.sticky?w.value+s:0),P=ne=>{const W=l.value,oe=g.value;if(!x.value||!W||!oe||!oe[v.currentIndex])return;const he=oe[v.currentIndex].$el,le=he.offsetLeft-(W.offsetWidth-he.offsetWidth)/2;scrollLeftTo(W,le,ne?0:+i.duration)},I=()=>{const ne=v.inited;nextTick(()=>{const W=g.value;if(!W||!W[v.currentIndex]||i.type!=="line"||isHidden(a.value))return;const oe=W[v.currentIndex].$el,{lineWidth:he,lineHeight:le}=i,me=oe.offsetLeft+oe.offsetWidth/2,Ae={width:addUnit(he),backgroundColor:i.color,transform:`translateX(${me}px) translateX(-50%)`};if(ne&&(Ae.transitionDuration=`${i.duration}s`),isDef$1(le)){const be=addUnit(le);Ae.height=be,Ae.borderRadius=be}v.lineStyle=Ae})},N=ne=>{const W=ne=0&&ne{const oe=N(ne);if(!isDef$1(oe))return;const he=y[oe],le=E(he,oe),me=v.currentIndex!==null;v.currentIndex!==oe&&(v.currentIndex=oe,W||P(),I()),le!==i.active&&(e("update:active",le),me&&e("change",le,he.title)),o&&!i.scrollspy&&setRootScrollTop(Math.ceil(getElementTop(a.value)-w.value))},F=(ne,W)=>{const oe=y.find((le,me)=>E(le,me)===ne),he=oe?y.indexOf(oe):0;R(he,W)},B=(ne=!1)=>{if(i.scrollspy){const W=y[v.currentIndex].$el;if(W&&u.value){const oe=getElementTop(W,u.value)-C.value;r=!0,scrollTopTo(u.value,oe,ne?0:+i.duration,()=>{r=!1})}}},k=(ne,W,oe)=>{const{title:he,disabled:le}=y[W],me=E(y[W],W);le||(callInterceptor(i.beforeChange,{args:[me],done:()=>{R(W),B()}}),route(ne)),e("clickTab",{name:me,title:he,event:oe,disabled:le})},M=ne=>{o=ne.isFixed,e("scroll",ne)},G=ne=>{nextTick(()=>{F(ne),B(!0)})},ee=()=>{for(let ne=0;neC.value)return ne===0?0:ne-1}return y.length-1},$=()=>{if(i.scrollspy&&!r){const ne=ee();R(ne)}},re=()=>y.map((ne,W)=>createVNode(stdin_default$j,mergeProps({key:ne.id,id:`${m}-${W}`,ref:b(W),type:i.type,color:i.color,style:ne.titleStyle,class:ne.titleClass,shrink:i.shrink,isActive:W===v.currentIndex,controls:ne.id,scrollable:x.value,activeColor:i.titleActiveColor,inactiveColor:i.titleInactiveColor,onClick:oe=>k(ne,W,oe)},pick$1(ne,["dot","badge","title","disabled","showZeroBadge"])),{title:ne.$slots.title})),ie=()=>{if(i.type==="line"&&y.length)return createVNode("div",{class:bem$d("line"),style:v.lineStyle},null)},de=()=>{var ne,W,oe;const{type:he,border:le,sticky:me}=i,Ae=[createVNode("div",{ref:me?void 0:c,class:[bem$d("wrap"),{[BORDER_TOP_BOTTOM]:he==="line"&&le}]},[createVNode("div",{ref:l,role:"tablist",class:bem$d("nav",[he,{shrink:i.shrink,complete:x.value}]),style:A.value,"aria-orientation":"horizontal"},[(ne=t["nav-left"])==null?void 0:ne.call(t),re(),ie(),(W=t["nav-right"])==null?void 0:W.call(t)])]),(oe=t["nav-bottom"])==null?void 0:oe.call(t)];return me?createVNode("div",{ref:c},[Ae]):Ae};watch([()=>i.color,windowWidth],I),watch(()=>i.active,ne=>{ne!==_.value&&F(ne)}),watch(()=>y.length,()=>{v.inited&&(F(i.active),I(),nextTick(()=>{P(!0)}))});const Q=()=>{F(i.active,!0),nextTick(()=>{v.inited=!0,c.value&&(s=useRect(c.value).height),P(!0)})},H=(ne,W)=>e("rendered",ne,W);return useExpose({resize:()=>{I(),nextTick(()=>{var ne,W;return(W=(ne=d.value)==null?void 0:ne.swipeRef.value)==null?void 0:W.resize()})},scrollTo:G}),onActivated(I),onPopupReopen(I),onMountedOrActivated(Q),useVisibilityChange(a,I),useEventListener$1("scroll",$,{target:u,passive:!0}),S({id:m,props:i,setLine:I,onRendered:H,currentName:_,scrollIntoView:P}),()=>createVNode("div",{ref:a,class:bem$d([i.type])},[i.sticky?createVNode(Sticky,{container:a.value,offsetTop:w.value,onScroll:M},{default:()=>[de()]}):de(),createVNode(stdin_default$h,{ref:d,count:y.length,inited:v.inited,animated:i.animated,duration:i.duration,swipeable:i.swipeable,lazyRender:i.lazyRender,currentIndex:v.currentIndex,onChange:R},{default:()=>{var ne;return[(ne=t.default)==null?void 0:ne.call(t)]}})])}});const TAB_STATUS_KEY=Symbol(),useTabStatus=()=>inject(TAB_STATUS_KEY,null),[name$c,bem$c]=createNamespace$1("swipe-item");var stdin_default$f=defineComponent({name:name$c,setup(i,{slots:e}){let t;const s=reactive({offset:0,inited:!1,mounted:!1}),{parent:r,index:o}=useParent$1(SWIPE_KEY);if(!r)return;const a=computed(()=>{const d={},{vertical:m}=r.props;return r.size.value&&(d[m?"height":"width"]=`${r.size.value}px`),s.offset&&(d.transform=`translate${m?"Y":"X"}(${s.offset}px)`),d}),l=computed(()=>{const{loop:d,lazyRender:m}=r.props;if(!m||t)return!0;if(!s.mounted)return!1;const u=r.activeIndicator.value,g=r.count.value-1,b=u===0&&d?g:u-1,y=u===g&&d?0:u+1;return t=o.value===u||o.value===b||o.value===y,t}),c=d=>{s.offset=d};return onMounted(()=>{nextTick(()=>{s.mounted=!0})}),useExpose({setOffset:c}),()=>{var d;return createVNode("div",{class:bem$c(),style:a.value},[l.value?(d=e.default)==null?void 0:d.call(e):null])}}});const SwipeItem=withInstall(stdin_default$f),[name$b,bem$b]=createNamespace$1("tab"),tabProps=extend$2({},routeProps,{dot:Boolean,name:numericProp,badge:numericProp,title:String,disabled:Boolean,titleClass:unknownProp,titleStyle:[String,Object],showZeroBadge:truthProp});var stdin_default$e=defineComponent({name:name$b,props:tabProps,setup(i,{slots:e}){const t=useId(),s=ref(!1),{parent:r,index:o}=useParent$1(TABS_KEY);if(!r)return;const a=()=>{var m;return(m=i.name)!=null?m:o.value},l=()=>{s.value=!0,r.props.lazyRender&&nextTick(()=>{r.onRendered(a(),i.title)})},c=computed(()=>{const m=a()===r.currentName.value;return m&&!s.value&&l(),m}),d=ref(!c.value);return watch(c,m=>{m?d.value=!1:doubleRaf(()=>{d.value=!0})}),watch(()=>i.title,()=>{r.setLine(),r.scrollIntoView()}),provide(TAB_STATUS_KEY,c),()=>{var m;const u=`${r.id}-${o.value}`,{animated:g,swipeable:b,scrollspy:y,lazyRender:S}=r.props;if(!e.default&&!g)return;const v=y||c.value;if(g||b)return createVNode(SwipeItem,{id:t,role:"tabpanel",class:bem$b("panel-wrapper",{inactive:d.value}),tabindex:c.value?0:-1,"aria-hidden":!c.value,"aria-labelledby":u},{default:()=>{var E;return[createVNode("div",{class:bem$b("panel")},[(E=e.default)==null?void 0:E.call(e)])]}});const A=s.value||y||!S?(m=e.default)==null?void 0:m.call(e):null;return useExpose({id:t}),withDirectives(createVNode("div",{id:t,role:"tabpanel",class:bem$b("panel"),tabindex:v?0:-1,"aria-labelledby":u},[A]),[[vShow,v]])}}});const Tab=withInstall(stdin_default$e),Tabs=withInstall(stdin_default$g),[name$a,bem$a]=createNamespace$1("cell"),cellSharedProps={tag:makeStringProp("div"),icon:String,size:String,title:numericProp,value:numericProp,label:numericProp,center:Boolean,isLink:Boolean,border:truthProp,required:Boolean,iconPrefix:String,valueClass:unknownProp,labelClass:unknownProp,titleClass:unknownProp,titleStyle:null,arrowDirection:String,clickable:{type:Boolean,default:null}},cellProps=extend$2({},cellSharedProps,routeProps);var stdin_default$d=defineComponent({name:name$a,props:cellProps,setup(i,{slots:e}){const t=useRoute(),s=()=>{if(e.label||isDef$1(i.label))return createVNode("div",{class:[bem$a("label"),i.labelClass]},[e.label?e.label():i.label])},r=()=>{var c;if(e.title||isDef$1(i.title)){const d=(c=e.title)==null?void 0:c.call(e);return Array.isArray(d)&&d.length===0?void 0:createVNode("div",{class:[bem$a("title"),i.titleClass],style:i.titleStyle},[d||createVNode("span",null,[i.title]),s()])}},o=()=>{const c=e.value||e.default;if(c||isDef$1(i.value))return createVNode("div",{class:[bem$a("value"),i.valueClass]},[c?c():createVNode("span",null,[i.value])])},a=()=>{if(e.icon)return e.icon();if(i.icon)return createVNode(Icon$1,{name:i.icon,class:bem$a("left-icon"),classPrefix:i.iconPrefix},null)},l=()=>{if(e["right-icon"])return e["right-icon"]();if(i.isLink){const c=i.arrowDirection&&i.arrowDirection!=="right"?`arrow-${i.arrowDirection}`:"arrow";return createVNode(Icon$1,{name:c,class:bem$a("right-icon")},null)}};return()=>{var c;const{tag:d,size:m,center:u,border:g,isLink:b,required:y}=i,S=(c=i.clickable)!=null?c:b,v={center:u,required:y,clickable:S,borderless:!g};return m&&(v[m]=!!m),createVNode(d,{class:bem$a(v),role:S?"button":void 0,tabindex:S?0:void 0,onClick:t},{default:()=>{var x;return[a(),r(),o(),l(),(x=e.extra)==null?void 0:x.call(e)]}})}}});const Cell=withInstall(stdin_default$d);let lockCount=0;function lockClick(i){i?(lockCount||document.body.classList.add("van-toast--unclickable"),lockCount++):lockCount&&(lockCount--,lockCount||document.body.classList.remove("van-toast--unclickable"))}const[name$9,bem$9]=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$c=defineComponent({name:name$9,props:toastProps,emits:["update:show"],setup(i,{emit:e,slots:t}){let s,r=!1;const o=()=>{const u=i.show&&i.forbidClick;r!==u&&(r=u,lockClick(r))},a=u=>e("update:show",u),l=()=>{i.closeOnClick&&a(!1)},c=()=>clearTimeout(s),d=()=>{const{icon:u,type:g,iconSize:b,iconPrefix:y,loadingType:S}=i;if(u||g==="success"||g==="fail")return createVNode(Icon$1,{name:u||g,size:b,class:bem$9("icon"),classPrefix:y},null);if(g==="loading")return createVNode(Loading$1,{class:bem$9("loading"),size:b,type:S},null)},m=()=>{const{type:u,message:g}=i;if(t.message)return createVNode("div",{class:bem$9("text")},[t.message()]);if(isDef$1(g)&&g!=="")return u==="html"?createVNode("div",{key:0,class:bem$9("text"),innerHTML:String(g)},null):createVNode("div",{class:bem$9("text")},[g])};return watch(()=>[i.show,i.forbidClick],o),watch(()=>[i.show,i.type,i.message,i.duration],()=>{c(),i.show&&i.duration>0&&(s=setTimeout(()=>{a(!1)},i.duration))}),onMounted(o),onUnmounted(o),()=>createVNode(Popup$1,mergeProps({class:[bem$9([i.position,i.wordBreak==="normal"?"break-normal":i.wordBreak,{[i.type]:!i.icon}]),i.className],lockScroll:!1,onClick:l,onClosed:c,"onUpdate:show":a},pick$1(i,popupInheritProps)),{default:()=>[d(),m()]})}});function usePopupState(){const i=reactive({show:!1}),e=r=>{i.show=r},t=r=>{extend$2(i,r,{transitionAppear:!0}),e(!0)},s=()=>e(!1);return useExpose({open:t,close:s,toggle:e}),{open:t,close:s,state:i,toggle:e}}function mountComponent(i){const e=createApp(i),t=document.createElement("div");return document.body.appendChild(t),{instance:e.mount(t),unmount(){e.unmount(),document.body.removeChild(t)}}}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(i){return isObject$3(i)?i:{message:i}}function createInstance(){const{instance:i,unmount:e}=mountComponent({setup(){const t=ref(""),{open:s,state:r,close:o,toggle:a}=usePopupState(),l=()=>{},c=()=>createVNode(stdin_default$c,mergeProps(r,{onClosed:l,"onUpdate:show":a}),null);return watch(t,d=>{r.message=d}),getCurrentInstance().render=c,{open:s,close:o,message:t}}});return i}function getInstance(){if(!queue.length||allowMultiple){const i=createInstance();queue.push(i)}return queue[queue.length-1]}function showToast(i={}){if(!inBrowser$2)return{};const e=getInstance(),t=parseOptions(i);return e.open(extend$2({},currentOptions,defaultOptionsMap.get(t.type||currentOptions.type),t)),e}const createMethod=i=>e=>showToast(extend$2({type:i},parseOptions(e))),showLoadingToast=createMethod("loading"),closeToast=i=>{queue.length&&(i?(queue.forEach(e=>{e.close()}),queue=[]):queue[0].close())};withInstall(stdin_default$c);const[name$8,bem$8]=createNamespace$1("circle");let uid=0;const format$1=i=>Math.min(Math.max(+i,0),100);function getPath(i,e){const t=i?1:0;return`M ${e/2} ${e/2} m 0, -500 a 500, 500 0 1, ${t} 0, 1000 a 500, 500 0 1, ${t} 0, -1000`}const circleProps={text:String,size:numericProp,fill:makeStringProp("none"),rate:makeNumericProp(100),speed:makeNumericProp(0),color:[String,Object],clockwise:truthProp,layerColor:String,currentRate:makeNumberProp(0),strokeWidth:makeNumericProp(40),strokeLinecap:String,startPosition:makeStringProp("top")};var stdin_default$b=defineComponent({name:name$8,props:circleProps,emits:["update:currentRate"],setup(i,{emit:e,slots:t}){const s=`van-circle-${uid++}`,r=computed(()=>+i.strokeWidth+1e3),o=computed(()=>getPath(i.clockwise,r.value)),a=computed(()=>{const g={top:0,right:90,bottom:180,left:270}[i.startPosition];if(g)return{transform:`rotate(${g}deg)`}});watch(()=>i.rate,u=>{let g;const b=Date.now(),y=i.currentRate,S=format$1(u),v=Math.abs((y-S)*1e3/+i.speed),x=()=>{const A=Date.now(),_=Math.min((A-b)/v,1)*(S-y)+y;e("update:currentRate",format$1(parseFloat(_.toFixed(1)))),(S>y?_S)&&(g=raf(x))};i.speed?(g&&cancelRaf(g),g=raf(x)):e("update:currentRate",S)},{immediate:!0});const l=()=>{const{strokeWidth:g,currentRate:b,strokeLinecap:y}=i,S=3140*b/100,v=isObject$3(i.color)?`url(#${s})`:i.color,x={stroke:v,strokeWidth:`${+g+1}px`,strokeLinecap:y,strokeDasharray:`${S}px 3140px`};return createVNode("path",{d:o.value,style:x,class:bem$8("hover"),stroke:v},null)},c=()=>{const u={fill:i.fill,stroke:i.layerColor,strokeWidth:`${i.strokeWidth}px`};return createVNode("path",{class:bem$8("layer"),style:u,d:o.value},null)},d=()=>{const{color:u}=i;if(!isObject$3(u))return;const g=Object.keys(u).sort((b,y)=>parseFloat(b)-parseFloat(y)).map((b,y)=>createVNode("stop",{key:y,offset:b,"stop-color":u[b]},null));return createVNode("defs",null,[createVNode("linearGradient",{id:s,x1:"100%",y1:"0%",x2:"0%",y2:"0%"},[g])])},m=()=>{if(t.default)return t.default();if(i.text)return createVNode("div",{class:bem$8("text")},[i.text])};return()=>createVNode("div",{class:bem$8(),style:getSizeStyle(i.size)},[createVNode("svg",{viewBox:`0 0 ${r.value} ${r.value}`,style:a.value},[d(),c(),l()]),m()])}});const Circle=withInstall(stdin_default$b),[name$7,bem$7]=createNamespace$1("empty"),emptyProps={image:makeStringProp("default"),imageSize:[Number,String,Array],description:String};var stdin_default$a=defineComponent({name:name$7,props:emptyProps,setup(i,{slots:e}){const t=()=>{const x=e.description?e.description():i.description;if(x)return createVNode("p",{class:bem$7("description")},[x])},s=()=>{if(e.default)return createVNode("div",{class:bem$7("bottom")},[e.default()])},r=useId(),o=x=>`${r}-${x}`,a=x=>`url(#${o(x)})`,l=(x,A,E)=>createVNode("stop",{"stop-color":x,offset:`${A}%`,"stop-opacity":E},null),c=(x,A)=>[l(x,0),l(A,100)],d=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)])],u=()=>[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)])])]),b=()=>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(),u(),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)])]),y=()=>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(),u(),d("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(),u(),d("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)])]),v=()=>{var x;if(e.image)return e.image();const A={error:y,search:S,network:g,default:b};return((x=A[i.image])==null?void 0:x.call(A))||createVNode("img",{src:i.image},null)};return()=>createVNode("div",{class:bem$7()},[createVNode("div",{class:bem$7("image"),style:getSizeStyle(i.imageSize)},[v()]),t(),s()])}});const Empty=withInstall(stdin_default$a),[name$6,bem$6]=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$9=defineComponent({name:name$6,props:noticeBarProps,emits:["close","replay"],setup(i,{emit:e,slots:t}){let s=0,r=0,o;const a=ref(),l=ref(),c=reactive({show:!0,offset:0,duration:0}),d=()=>{if(t["left-icon"])return t["left-icon"]();if(i.leftIcon)return createVNode(Icon$1,{class:bem$6("left-icon"),name:i.leftIcon},null)},m=()=>{if(i.mode==="closeable")return"cross";if(i.mode==="link")return"arrow"},u=v=>{i.mode==="closeable"&&(c.show=!1,e("close",v))},g=()=>{if(t["right-icon"])return t["right-icon"]();const v=m();if(v)return createVNode(Icon$1,{name:v,class:bem$6("right-icon"),onClick:u},null)},b=()=>{c.offset=s,c.duration=0,raf(()=>{doubleRaf(()=>{c.offset=-r,c.duration=(r+s)/+i.speed,e("replay")})})},y=()=>{const v=i.scrollable===!1&&!i.wrapable,x={transform:c.offset?`translateX(${c.offset}px)`:"",transitionDuration:`${c.duration}s`};return createVNode("div",{ref:a,role:"marquee",class:bem$6("wrap")},[createVNode("div",{ref:l,style:x,class:[bem$6("content"),{"van-ellipsis":v}],onTransitionend:b},[t.default?t.default():i.text])])},S=()=>{const{delay:v,speed:x,scrollable:A}=i,E=isDef$1(v)?+v*1e3:0;s=0,r=0,c.offset=0,c.duration=0,clearTimeout(o),o=setTimeout(()=>{if(!a.value||!l.value||A===!1)return;const _=useRect(a).width,w=useRect(l).width;(A||w>_)&&doubleRaf(()=>{s=_,r=w,c.offset=-r,c.duration=r/+x})},E)};return onPopupReopen(S),onMountedOrActivated(S),useEventListener$1("pageshow",S),useExpose({reset:S}),watch(()=>[i.text,i.scrollable],S),()=>{const{color:v,wrapable:x,background:A}=i;return withDirectives(createVNode("div",{role:"alert",class:bem$6({wrapable:x}),style:{color:v,background:A}},[d(),y(),g()]),[[vShow,c.show]])}}});const NoticeBar=withInstall(stdin_default$9);function getWindow(i){if(i==null)return window;if(i.toString()!=="[object Window]"){var e=i.ownerDocument;return e&&e.defaultView||window}return i}function isElement$1(i){var e=getWindow(i).Element;return i instanceof e||i instanceof Element}function isHTMLElement(i){var e=getWindow(i).HTMLElement;return i instanceof e||i instanceof HTMLElement}function isShadowRoot(i){if(typeof ShadowRoot>"u")return!1;var e=getWindow(i).ShadowRoot;return i instanceof e||i instanceof ShadowRoot}var round=Math.round;function getUAString(){var i=navigator.userAgentData;return i!=null&&i.brands?i.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function isLayoutViewport(){return!/^((?!chrome|android).)*safari/i.test(getUAString())}function getBoundingClientRect(i,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var s=i.getBoundingClientRect(),r=1,o=1;e&&isHTMLElement(i)&&(r=i.offsetWidth>0&&round(s.width)/i.offsetWidth||1,o=i.offsetHeight>0&&round(s.height)/i.offsetHeight||1);var a=isElement$1(i)?getWindow(i):window,l=a.visualViewport,c=!isLayoutViewport()&&t,d=(s.left+(c&&l?l.offsetLeft:0))/r,m=(s.top+(c&&l?l.offsetTop:0))/o,u=s.width/r,g=s.height/o;return{width:u,height:g,top:m,right:d+u,bottom:m+g,left:d,x:d,y:m}}function getWindowScroll(i){var e=getWindow(i),t=e.pageXOffset,s=e.pageYOffset;return{scrollLeft:t,scrollTop:s}}function getHTMLElementScroll(i){return{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}}function getNodeScroll(i){return i===getWindow(i)||!isHTMLElement(i)?getWindowScroll(i):getHTMLElementScroll(i)}function getNodeName(i){return i?(i.nodeName||"").toLowerCase():null}function getDocumentElement(i){return((isElement$1(i)?i.ownerDocument:i.document)||window.document).documentElement}function getWindowScrollBarX(i){return getBoundingClientRect(getDocumentElement(i)).left+getWindowScroll(i).scrollLeft}function getComputedStyle(i){return getWindow(i).getComputedStyle(i)}function isScrollParent(i){var e=getComputedStyle(i),t=e.overflow,s=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+r+s)}function isElementScaled(i){var e=i.getBoundingClientRect(),t=round(e.width)/i.offsetWidth||1,s=round(e.height)/i.offsetHeight||1;return t!==1||s!==1}function getCompositeRect(i,e,t){t===void 0&&(t=!1);var s=isHTMLElement(e),r=isHTMLElement(e)&&isElementScaled(e),o=getDocumentElement(e),a=getBoundingClientRect(i,r,t),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(s||!s&&!t)&&((getNodeName(e)!=="body"||isScrollParent(o))&&(l=getNodeScroll(e)),isHTMLElement(e)?(c=getBoundingClientRect(e,!0),c.x+=e.clientLeft,c.y+=e.clientTop):o&&(c.x=getWindowScrollBarX(o))),{x:a.left+l.scrollLeft-c.x,y:a.top+l.scrollTop-c.y,width:a.width,height:a.height}}function getLayoutRect(i){var e=getBoundingClientRect(i),t=i.offsetWidth,s=i.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-s)<=1&&(s=e.height),{x:i.offsetLeft,y:i.offsetTop,width:t,height:s}}function getParentNode(i){return getNodeName(i)==="html"?i:i.assignedSlot||i.parentNode||(isShadowRoot(i)?i.host:null)||getDocumentElement(i)}function getScrollParent(i){return["html","body","#document"].indexOf(getNodeName(i))>=0?i.ownerDocument.body:isHTMLElement(i)&&isScrollParent(i)?i:getScrollParent(getParentNode(i))}function listScrollParents(i,e){var t;e===void 0&&(e=[]);var s=getScrollParent(i),r=s===((t=i.ownerDocument)==null?void 0:t.body),o=getWindow(s),a=r?[o].concat(o.visualViewport||[],isScrollParent(s)?s:[]):s,l=e.concat(a);return r?l:l.concat(listScrollParents(getParentNode(a)))}function isTableElement(i){return["table","td","th"].indexOf(getNodeName(i))>=0}function getTrueOffsetParent(i){return!isHTMLElement(i)||getComputedStyle(i).position==="fixed"?null:i.offsetParent}function getContainingBlock(i){var e=/firefox/i.test(getUAString()),t=/Trident/i.test(getUAString());if(t&&isHTMLElement(i)){var s=getComputedStyle(i);if(s.position==="fixed")return null}var r=getParentNode(i);for(isShadowRoot(r)&&(r=r.host);isHTMLElement(r)&&["html","body"].indexOf(getNodeName(r))<0;){var o=getComputedStyle(r);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||e&&o.willChange==="filter"||e&&o.filter&&o.filter!=="none")return r;r=r.parentNode}return null}function getOffsetParent(i){for(var e=getWindow(i),t=getTrueOffsetParent(i);t&&isTableElement(t)&&getComputedStyle(t).position==="static";)t=getTrueOffsetParent(t);return t&&(getNodeName(t)==="html"||getNodeName(t)==="body"&&getComputedStyle(t).position==="static")?e:t||getContainingBlock(i)||e}var top="top",bottom="bottom",right="right",left="left",auto="auto",basePlacements=[top,bottom,right,left],start="start",end="end",placements=[].concat(basePlacements,[auto]).reduce(function(i,e){return i.concat([e,e+"-"+start,e+"-"+end])},[]),beforeRead="beforeRead",read$6="read",afterRead="afterRead",beforeMain="beforeMain",main="main",afterMain="afterMain",beforeWrite="beforeWrite",write$6="write",afterWrite="afterWrite",modifierPhases=[beforeRead,read$6,afterRead,beforeMain,main,afterMain,beforeWrite,write$6,afterWrite];function order(i){var e=new Map,t=new Set,s=[];i.forEach(function(o){e.set(o.name,o)});function r(o){t.add(o.name);var a=[].concat(o.requires||[],o.requiresIfExists||[]);a.forEach(function(l){if(!t.has(l)){var c=e.get(l);c&&r(c)}}),s.push(o)}return i.forEach(function(o){t.has(o.name)||r(o)}),s}function orderModifiers(i){var e=order(i);return modifierPhases.reduce(function(t,s){return t.concat(e.filter(function(r){return r.phase===s}))},[])}function debounce(i){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(i())})})),e}}function format(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),s=1;s=0?"x":"y"}function computeOffsets(i){var e=i.reference,t=i.element,s=i.placement,r=s?getBasePlacement(s):null,o=s?getVariation(s):null,a=e.x+e.width/2-t.width/2,l=e.y+e.height/2-t.height/2,c;switch(r){case top:c={x:a,y:e.y-t.height};break;case bottom:c={x:a,y:e.y+e.height};break;case right:c={x:e.x+e.width,y:l};break;case left:c={x:e.x-t.width,y:l};break;default:c={x:e.x,y:e.y}}var d=r?getMainAxisFromPlacement(r):null;if(d!=null){var m=d==="y"?"height":"width";switch(o){case start:c[d]=c[d]-(e[m]/2-t[m]/2);break;case end:c[d]=c[d]+(e[m]/2-t[m]/2);break}}return c}var INVALID_ELEMENT_ERROR="Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.",INFINITE_LOOP_ERROR="Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.",DEFAULT_OPTIONS={placement:"bottom",modifiers:[],strategy:"absolute"};function areValidElements(){for(var i=arguments.length,e=new Array(i),t=0;t100){console.error(INFINITE_LOOP_ERROR);break}if(m.reset===!0){m.reset=!1,w=-1;continue}var C=m.orderedModifiers[w],P=C.fn,I=C.options,N=I===void 0?{}:I,R=C.name;typeof P=="function"&&(m=P({state:m,options:N,name:R,instance:b})||m)}}},update:debounce(function(){return new Promise(function(v){b.forceUpdate(),v(m)})}),destroy:function(){S(),g=!0}};if(!areValidElements(l,c))return console.error(INVALID_ELEMENT_ERROR),b;b.setOptions(d).then(function(v){!g&&d.onFirstUpdate&&d.onFirstUpdate(v)});function y(){m.orderedModifiers.forEach(function(v){var x=v.name,A=v.options,E=A===void 0?{}:A,_=v.effect;if(typeof _=="function"){var w=_({state:m,name:x,instance:b,options:E}),C=function(){};u.push(w||C)}})}function S(){u.forEach(function(v){return v()}),u=[]}return b}}var passive={passive:!0};function effect(i){var e=i.state,t=i.instance,s=i.options,r=s.scroll,o=r===void 0?!0:r,a=s.resize,l=a===void 0?!0:a,c=getWindow(e.elements.popper),d=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&d.forEach(function(m){m.addEventListener("scroll",t.update,passive)}),l&&c.addEventListener("resize",t.update,passive),function(){o&&d.forEach(function(m){m.removeEventListener("scroll",t.update,passive)}),l&&c.removeEventListener("resize",t.update,passive)}}var eventListeners_default={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect,data:{}};function popperOffsets(i){var e=i.state,t=i.name;e.modifiersData[t]=computeOffsets({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var popperOffsets_default={name:"popperOffsets",enabled:!0,phase:"read",fn:popperOffsets,data:{}},unsetSides={top:"auto",right:"auto",bottom:"auto",left:"auto"};function roundOffsetsByDPR(i){var e=i.x,t=i.y,s=window,r=s.devicePixelRatio||1;return{x:round(e*r)/r||0,y:round(t*r)/r||0}}function mapToStyles(i){var e,t=i.popper,s=i.popperRect,r=i.placement,o=i.variation,a=i.offsets,l=i.position,c=i.gpuAcceleration,d=i.adaptive,m=i.roundOffsets,u=i.isFixed,g=a.x,b=g===void 0?0:g,y=a.y,S=y===void 0?0:y,v=typeof m=="function"?m({x:b,y:S}):{x:b,y:S};b=v.x,S=v.y;var x=a.hasOwnProperty("x"),A=a.hasOwnProperty("y"),E=left,_=top,w=window;if(d){var C=getOffsetParent(t),P="clientHeight",I="clientWidth";if(C===getWindow(t)&&(C=getDocumentElement(t),getComputedStyle(C).position!=="static"&&l==="absolute"&&(P="scrollHeight",I="scrollWidth")),C=C,r===top||(r===left||r===right)&&o===end){_=bottom;var N=u&&C===w&&w.visualViewport?w.visualViewport.height:C[P];S-=N-s.height,S*=c?1:-1}if(r===left||(r===top||r===bottom)&&o===end){E=right;var R=u&&C===w&&w.visualViewport?w.visualViewport.width:C[I];b-=R-s.width,b*=c?1:-1}}var F=Object.assign({position:l},d&&unsetSides),B=m===!0?roundOffsetsByDPR({x:b,y:S}):{x:b,y:S};if(b=B.x,S=B.y,c){var k;return Object.assign({},F,(k={},k[_]=A?"0":"",k[E]=x?"0":"",k.transform=(w.devicePixelRatio||1)<=1?"translate("+b+"px, "+S+"px)":"translate3d("+b+"px, "+S+"px, 0)",k))}return Object.assign({},F,(e={},e[_]=A?S+"px":"",e[E]=x?b+"px":"",e.transform="",e))}function computeStyles(i){var e=i.state,t=i.options,s=t.gpuAcceleration,r=s===void 0?!0:s,o=t.adaptive,a=o===void 0?!0:o,l=t.roundOffsets,c=l===void 0?!0:l;{var d=getComputedStyle(e.elements.popper).transitionProperty||"";a&&["transform","top","right","bottom","left"].some(function(u){return d.indexOf(u)>=0})&&console.warn(["Popper: Detected CSS transitions on at least one of the following",'CSS properties: "transform", "top", "right", "bottom", "left".',` `,'Disable the "computeStyles" modifier\'s `adaptive` option to allow',"for smooth transitions, or remove these properties from the CSS","transition declaration on the popper element if only transitioning","opacity or background-color for example.",` `,"We recommend using the popper element as a wrapper around an inner","element that can have any CSS property transitioned for animations."].join(" "))}var m={placement:getBasePlacement(e.placement),variation:getVariation(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,mapToStyles(Object.assign({},m,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:c})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,mapToStyles(Object.assign({},m,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var computeStyles_default={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:computeStyles,data:{}};function applyStyles(i){var e=i.state;Object.keys(e.elements).forEach(function(t){var s=e.styles[t]||{},r=e.attributes[t]||{},o=e.elements[t];!isHTMLElement(o)||!getNodeName(o)||(Object.assign(o.style,s),Object.keys(r).forEach(function(a){var l=r[a];l===!1?o.removeAttribute(a):o.setAttribute(a,l===!0?"":l)}))})}function effect2(i){var e=i.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(s){var r=e.elements[s],o=e.attributes[s]||{},a=Object.keys(e.styles.hasOwnProperty(s)?e.styles[s]:t[s]),l=a.reduce(function(c,d){return c[d]="",c},{});!isHTMLElement(r)||!getNodeName(r)||(Object.assign(r.style,l),Object.keys(o).forEach(function(c){r.removeAttribute(c)}))})}}var applyStyles_default={name:"applyStyles",enabled:!0,phase:"write",fn:applyStyles,effect:effect2,requires:["computeStyles"]},defaultModifiers=[eventListeners_default,popperOffsets_default,computeStyles_default,applyStyles_default],createPopper=popperGenerator({defaultModifiers});function distanceAndSkiddingToXY(i,e,t){var s=getBasePlacement(i),r=[left,top].indexOf(s)>=0?-1:1,o=typeof t=="function"?t(Object.assign({},e,{placement:i})):t,a=o[0],l=o[1];return a=a||0,l=(l||0)*r,[left,right].indexOf(s)>=0?{x:l,y:a}:{x:a,y:l}}function offset(i){var e=i.state,t=i.options,s=i.name,r=t.offset,o=r===void 0?[0,0]:r,a=placements.reduce(function(m,u){return m[u]=distanceAndSkiddingToXY(u,e.rects,o),m},{}),l=a[e.placement],c=l.x,d=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=d),e.modifiersData[s]=a}var offset_default={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:offset};const useSyncPropRef=(i,e)=>{const t=ref(i());return watch(i,s=>{s!==t.value&&(t.value=s)}),watch(t,s=>{s!==i()&&e(s)}),t},[name$5,bem$5]=createNamespace$1("popover"),popupProps=["overlay","duration","teleport","overlayStyle","overlayClass","closeOnClickOverlay"],popoverProps={show:Boolean,theme:makeStringProp("light"),overlay:Boolean,actions:makeArrayProp(),trigger:makeStringProp("click"),duration:numericProp,showArrow:truthProp,placement:makeStringProp("bottom"),iconPrefix:String,overlayClass:unknownProp,overlayStyle:Object,closeOnClickAction:truthProp,closeOnClickOverlay:truthProp,closeOnClickOutside:truthProp,offset:{type:Array,default:()=>[0,8]},teleport:{type:[String,Object],default:"body"}};var stdin_default$8=defineComponent({name:name$5,props:popoverProps,emits:["select","touchstart","update:show"],setup(i,{emit:e,slots:t,attrs:s}){let r;const o=ref(),a=ref(),l=ref(),c=useSyncPropRef(()=>i.show,A=>e("update:show",A)),d=()=>({placement:i.placement,modifiers:[{name:"computeStyles",options:{adaptive:!1,gpuAcceleration:!1}},extend$2({},offset_default,{options:{offset:i.offset}})]}),m=()=>a.value&&l.value?createPopper(a.value,l.value.popupRef.value,d()):null,u=()=>{nextTick(()=>{c.value&&(r?r.setOptions(d()):(r=m(),inBrowser$2&&(window.addEventListener("animationend",u),window.addEventListener("transitionend",u))))})},g=A=>{c.value=A},b=()=>{i.trigger==="click"&&(c.value=!c.value)},y=(A,E)=>{A.disabled||(e("select",A,E),i.closeOnClickAction&&(c.value=!1))},S=()=>{c.value&&i.closeOnClickOutside&&(!i.overlay||i.closeOnClickOverlay)&&(c.value=!1)},v=(A,E)=>t.action?t.action({action:A,index:E}):[A.icon&&createVNode(Icon$1,{name:A.icon,classPrefix:i.iconPrefix,class:bem$5("action-icon")},null),createVNode("div",{class:[bem$5("action-text"),BORDER_BOTTOM]},[A.text])],x=(A,E)=>{const{icon:_,color:w,disabled:C,className:P}=A;return createVNode("div",{role:"menuitem",class:[bem$5("action",{disabled:C,"with-icon":_}),P],style:{color:w},tabindex:C?void 0:0,"aria-disabled":C||void 0,onClick:()=>y(A,E)},[v(A,E)])};return onMounted(()=>{u(),watchEffect(()=>{var A;o.value=(A=l.value)==null?void 0:A.popupRef.value})}),onBeforeUnmount(()=>{r&&(inBrowser$2&&(window.removeEventListener("animationend",u),window.removeEventListener("transitionend",u)),r.destroy(),r=null)}),watch(()=>[c.value,i.offset,i.placement],u),useClickAway([a,o],S,{eventName:"touchstart"}),()=>{var A;return createVNode(Fragment,null,[createVNode("span",{ref:a,class:bem$5("wrapper"),onClick:b},[(A=t.reference)==null?void 0:A.call(t)]),createVNode(Popup$1,mergeProps({ref:l,show:c.value,class:bem$5([i.theme]),position:"",transition:"van-popover-zoom",lockScroll:!1,"onUpdate:show":g},s,pick$1(i,popupProps)),{default:()=>[i.showArrow&&createVNode("div",{class:bem$5("arrow")},null),createVNode("div",{role:"menu",class:bem$5("content")},[t.default?t.default():i.actions.map(x)])]})])}}});const Popover=withInstall(stdin_default$8),[name$4,bem$4]=createNamespace$1("skeleton-title"),skeletonTitleProps={round:Boolean,titleWidth:numericProp};var stdin_default$7=defineComponent({name:name$4,props:skeletonTitleProps,setup(i){return()=>createVNode("h3",{class:bem$4([{round:i.round}]),style:{width:addUnit(i.titleWidth)}},null)}});const SkeletonTitle=withInstall(stdin_default$7);var stdin_default$6=SkeletonTitle;const[name$3,bem$3]=createNamespace$1("skeleton-avatar"),skeletonAvatarProps={avatarSize:numericProp,avatarShape:makeStringProp("round")};var stdin_default$5=defineComponent({name:name$3,props:skeletonAvatarProps,setup(i){return()=>createVNode("div",{class:bem$3([i.avatarShape]),style:getSizeStyle(i.avatarSize)},null)}});const SkeletonAvatar=withInstall(stdin_default$5);var stdin_default$4=SkeletonAvatar;const DEFAULT_ROW_WIDTH="100%",skeletonParagraphProps={round:Boolean,rowWidth:{type:numericProp,default:DEFAULT_ROW_WIDTH}},[name$2,bem$2]=createNamespace$1("skeleton-paragraph");var stdin_default$3=defineComponent({name:name$2,props:skeletonParagraphProps,setup(i){return()=>createVNode("div",{class:bem$2([{round:i.round}]),style:{width:i.rowWidth}},null)}});const SkeletonParagraph=withInstall(stdin_default$3);var stdin_default$2=SkeletonParagraph;const[name$1,bem$1]=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$1=defineComponent({name:name$1,inheritAttrs:!1,props:skeletonProps,setup(i,{slots:e,attrs:t}){const s=()=>{if(i.avatar)return createVNode(stdin_default$4,{avatarShape:i.avatarShape,avatarSize:i.avatarSize},null)},r=()=>{if(i.title)return createVNode(stdin_default$6,{round:i.round,titleWidth:i.titleWidth},null)},o=c=>{const{rowWidth:d}=i;return d===DEFAULT_ROW_WIDTH&&c===+i.row-1?DEFAULT_LAST_ROW_WIDTH:Array.isArray(d)?d[c]:d},a=()=>Array(+i.row).fill("").map((c,d)=>createVNode(stdin_default$2,{key:d,round:i.round,rowWidth:addUnit(o(d))},null)),l=()=>e.template?e.template():createVNode(Fragment,null,[s(),createVNode("div",{class:bem$1("content")},[r(),a()])]);return()=>{var c;return i.loading?createVNode("div",mergeProps({class:bem$1({animate:i.animate,round:i.round})},t),[l()]):(c=e.default)==null?void 0:c.call(e)}}});const Skeleton=withInstall(stdin_default$1),[name,bem]=createNamespace$1("slider"),sliderProps={min:makeNumericProp(0),max:makeNumericProp(100),step:makeNumericProp(1),range:Boolean,reverse:Boolean,disabled:Boolean,readonly:Boolean,vertical:Boolean,barHeight:numericProp,buttonSize:numericProp,activeColor:String,inactiveColor:String,modelValue:{type:[Number,Array],default:0}};var stdin_default=defineComponent({name,props:sliderProps,emits:["change","dragEnd","dragStart","update:modelValue"],setup(i,{emit:e,slots:t}){let s,r,o;const a=ref(),l=[ref(),ref()],c=ref(),d=useTouch(),m=computed(()=>Number(i.max)-Number(i.min)),u=computed(()=>{const R=i.vertical?"width":"height";return{background:i.inactiveColor,[R]:addUnit(i.barHeight)}}),g=R=>i.range&&Array.isArray(R),b=()=>{const{modelValue:R,min:F}=i;return g(R)?`${(R[1]-R[0])*100/m.value}%`:`${(R-Number(F))*100/m.value}%`},y=()=>{const{modelValue:R,min:F}=i;return g(R)?`${(R[0]-Number(F))*100/m.value}%`:"0%"},S=computed(()=>{const F={[i.vertical?"height":"width"]:b(),background:i.activeColor};c.value&&(F.transition="none");const B=()=>i.vertical?i.reverse?"bottom":"top":i.reverse?"right":"left";return F[B()]=y(),F}),v=R=>{const F=+i.min,B=+i.max,k=+i.step;R=clamp(R,F,B);const M=Math.round((R-F)/k)*k;return addNumber(F,M)},x=R=>{var F,B;const k=(F=R[0])!=null?F:Number(i.min),M=(B=R[1])!=null?B:Number(i.max);return k>M?[M,k]:[k,M]},A=(R,F)=>{g(R)?R=x(R).map(v):R=v(R),isSameValue(R,i.modelValue)||e("update:modelValue",R),F&&!isSameValue(R,o)&&e("change",R)},E=R=>{if(R.stopPropagation(),i.disabled||i.readonly)return;const{min:F,reverse:B,vertical:k,modelValue:M}=i,G=useRect(a),ee=()=>k?B?G.bottom-R.clientY:R.clientY-G.top:B?G.right-R.clientX:R.clientX-G.left,$=k?G.height:G.width,re=Number(F)+ee()/$*m.value;if(g(M)){const[ie,de]=M,Q=(ie+de)/2;re<=Q?A([re,de],!0):A([ie,re],!0)}else A(re,!0)},_=R=>{i.disabled||i.readonly||(d.start(R),r=i.modelValue,g(r)?o=r.map(v):o=v(r),c.value="start")},w=R=>{if(i.disabled||i.readonly)return;c.value==="start"&&e("dragStart",R),preventDefault(R,!0),d.move(R),c.value="dragging";const F=useRect(a),B=i.vertical?d.deltaY.value:d.deltaX.value,k=i.vertical?F.height:F.width;let M=B/k*m.value;if(i.reverse&&(M=-M),g(o)){const G=i.reverse?1-s:s;r[G]=o[G]+M}else r=o+M;A(r)},C=R=>{i.disabled||i.readonly||(c.value==="dragging"&&(A(r,!0),e("dragEnd",R)),c.value="")},P=R=>typeof R=="number"?bem("button-wrapper",["left","right"][R]):bem("button-wrapper",i.reverse?"left":"right"),I=(R,F)=>{if(typeof F=="number"){const B=t[F===0?"left-button":"right-button"];if(B)return B({value:R})}return t.button?t.button({value:R}):createVNode("div",{class:bem("button"),style:getSizeStyle(i.buttonSize)},null)},N=R=>{const F=typeof R=="number"?i.modelValue[R]:i.modelValue;return createVNode("div",{ref:l[R!=null?R:0],role:"slider",class:P(R),tabindex:i.disabled?void 0:0,"aria-valuemin":i.min,"aria-valuenow":F,"aria-valuemax":i.max,"aria-disabled":i.disabled||void 0,"aria-readonly":i.readonly||void 0,"aria-orientation":i.vertical?"vertical":"horizontal",onTouchstartPassive:B=>{typeof R=="number"&&(s=R),_(B)},onTouchend:C,onTouchcancel:C,onClick:stopPropagation},[I(F,R)])};return A(i.modelValue),useCustomFieldValue(()=>i.modelValue),l.forEach(R=>{useEventListener$1("touchmove",w,{target:R})}),()=>createVNode("div",{ref:a,style:u.value,class:bem({vertical:i.vertical,disabled:i.disabled}),onClick:E},[createVNode("div",{class:bem("bar"),style:S.value},[i.range?[N(0),N(1)]:N()])])}});const Slider=withInstall(stdin_default),TheError=defineComponent({name:"The-error",setup(i,e){return()=>createVNode("div",null,[createVNode(Empty,{image:"error",description:"网络开小差,再刷新看看"},{default:()=>[createVNode(Button,{type:"primary",size:"small",onClick:()=>history.go(0)},{default:()=>[createTextVNode("重新加载")]})]})])}}),storeData=reactive({status:"init",user:{},platformType:"STUDENT",platformApi:"/api-student",proxy:"",isApp:!1}),setStoreData=i=>{Object.assign(storeData,i)},setUserInfo=i=>{storeData.status="login",storeData.user=i||{}},browser=()=>{const i=navigator.userAgent;return{trident:i.indexOf("Trident")>-1,presto:i.indexOf("Presto")>-1,webKit:i.indexOf("AppleWebKit")>-1,gecko:i.indexOf("Gecko")>-1&&i.indexOf("KHTML")==-1,mobile:!!i.match(/AppleWebKit.*Mobile.*/),ios:!!i.match(/Mac OS X/)||/(iPhone|iPad|iPod|iOS)/i.test(i),android:i.indexOf("Android")>-1||i.indexOf("Adr")>-1,iPhone:i.indexOf("ORCHESTRAAPPI")>-1,isApp:i.includes("DAYAAPPA")||i.includes("DAYAAPPI")||i.includes("COLEXIUAPPA")||i.includes("COLEXIUAPPI")||i.includes("ORCHESTRAAPPI")||i.includes("ORCHESTRAAPPA"),isTeacher:i.indexOf("ORCHESTRATEACHER")>-1||i.includes("COLEXIUTEACHER"),isStudent:i.indexOf("ORCHESTRASTUDENT")>-1||i.includes("COLEXIUSTUDENT"),isSchool:i.indexOf("ORCHESTRASCHOOL")>-1,iPad:i.indexOf("iPad")>-1,webApp:i.indexOf("Safari")==-1,weixin:i.indexOf("MicroMessenger")>-1,alipay:i.indexOf("AlipayClient")>-1,huawei:!!i.match(/huawei/i)||!!i.match(/honor/i),xiaomi:!!i.match(/mi\s/i)||!!i.match(/redmi/i)||!!i.match(/mix/i)}},getRandomKey=()=>""+Date.now()+Math.floor(Math.random()*1e6),AuthorizationKey="AUTHORIZATION",setToken=i=>{sessionStorage.setItem(AuthorizationKey,i)},getToken=()=>sessionStorage.getItem(AuthorizationKey)||"",setGlobalData=(i,e)=>{if(!i||!e)return;const t=window.GYM||{};t[i]=e,window.GYM=t},BEHAVIORIDKEY="BEHAVIORID",setBehaviorId=i=>{localStorage.setItem(BEHAVIORIDKEY,i)},getBehaviorId=()=>localStorage.getItem(BEHAVIORIDKEY),campIdKey="CAMPID",setCampId=i=>{sessionStorage.setItem(campIdKey,i)},getCampId=()=>sessionStorage.getItem(campIdKey),getSecondRPM=(i,e)=>{if(isNaN(i))return"00:00";let t=Math.floor(i/60/60%24),s=Math.floor(i/60%60),r=Math.floor(i%60);return e==="cn"?`${t>0?t.toString().padStart(2,"0")+"时":""}${s.toString().padStart(2,"0")}分${r.toString().padStart(2,"0")}秒`:`${t>0?t.toString().padStart(2,"0")+":":""}${s.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`},token="%[a-f0-9]{2}",singleMatcher=new RegExp("("+token+")|([^%]+?)","gi"),multiMatcher=new RegExp("("+token+")+","gi");function decodeComponents(i,e){try{return[decodeURIComponent(i.join(""))]}catch(r){}if(i.length===1)return i;e=e||1;const t=i.slice(0,e),s=i.slice(e);return Array.prototype.concat.call([],decodeComponents(t),decodeComponents(s))}function decode$4(i){try{return decodeURIComponent(i)}catch(e){let t=i.match(singleMatcher)||[];for(let s=1;si==null,strictUriEncode=i=>encodeURIComponent(i).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),encodeFragmentIdentifier=Symbol("encodeFragmentIdentifier");function encoderForArrayFormat(i){switch(i.arrayFormat){case"index":return e=>(t,s)=>{const r=t.length;return s===void 0||i.skipNull&&s===null||i.skipEmptyString&&s===""?t:s===null?[...t,[encode$1(e,i),"[",r,"]"].join("")]:[...t,[encode$1(e,i),"[",encode$1(r,i),"]=",encode$1(s,i)].join("")]};case"bracket":return e=>(t,s)=>s===void 0||i.skipNull&&s===null||i.skipEmptyString&&s===""?t:s===null?[...t,[encode$1(e,i),"[]"].join("")]:[...t,[encode$1(e,i),"[]=",encode$1(s,i)].join("")];case"colon-list-separator":return e=>(t,s)=>s===void 0||i.skipNull&&s===null||i.skipEmptyString&&s===""?t:s===null?[...t,[encode$1(e,i),":list="].join("")]:[...t,[encode$1(e,i),":list=",encode$1(s,i)].join("")];case"comma":case"separator":case"bracket-separator":{const e=i.arrayFormat==="bracket-separator"?"[]=":"=";return t=>(s,r)=>r===void 0||i.skipNull&&r===null||i.skipEmptyString&&r===""?s:(r=r===null?"":r,s.length===0?[[encode$1(t,i),e,encode$1(r,i)].join("")]:[[s,encode$1(r,i)].join(i.arrayFormatSeparator)])}default:return e=>(t,s)=>s===void 0||i.skipNull&&s===null||i.skipEmptyString&&s===""?t:s===null?[...t,encode$1(e,i)]:[...t,[encode$1(e,i),"=",encode$1(s,i)].join("")]}}function parserForArrayFormat(i){let e;switch(i.arrayFormat){case"index":return(t,s,r)=>{if(e=/\[(\d*)]$/.exec(t),t=t.replace(/\[\d*]$/,""),!e){r[t]=s;return}r[t]===void 0&&(r[t]={}),r[t][e[1]]=s};case"bracket":return(t,s,r)=>{if(e=/(\[])$/.exec(t),t=t.replace(/\[]$/,""),!e){r[t]=s;return}if(r[t]===void 0){r[t]=[s];return}r[t]=[...r[t],s]};case"colon-list-separator":return(t,s,r)=>{if(e=/(:list)$/.exec(t),t=t.replace(/:list$/,""),!e){r[t]=s;return}if(r[t]===void 0){r[t]=[s];return}r[t]=[...r[t],s]};case"comma":case"separator":return(t,s,r)=>{const o=typeof s=="string"&&s.includes(i.arrayFormatSeparator),a=typeof s=="string"&&!o&&decode$3(s,i).includes(i.arrayFormatSeparator);s=a?decode$3(s,i):s;const l=o||a?s.split(i.arrayFormatSeparator).map(c=>decode$3(c,i)):s===null?s:decode$3(s,i);r[t]=l};case"bracket-separator":return(t,s,r)=>{const o=/(\[])$/.test(t);if(t=t.replace(/\[]$/,""),!o){r[t]=s&&decode$3(s,i);return}const a=s===null?[]:s.split(i.arrayFormatSeparator).map(l=>decode$3(l,i));if(r[t]===void 0){r[t]=a;return}r[t]=[...r[t],...a]};default:return(t,s,r)=>{if(r[t]===void 0){r[t]=s;return}r[t]=[...[r[t]].flat(),s]}}}function validateArrayFormatSeparator(i){if(typeof i!="string"||i.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function encode$1(i,e){return e.encode?e.strict?strictUriEncode(i):encodeURIComponent(i):i}function decode$3(i,e){return e.decode?decodeUriComponent(i):i}function keysSorter(i){return Array.isArray(i)?i.sort():typeof i=="object"?keysSorter(Object.keys(i)).sort((e,t)=>Number(e)-Number(t)).map(e=>i[e]):i}function removeHash(i){const e=i.indexOf("#");return e!==-1&&(i=i.slice(0,e)),i}function getHash(i){let e="";const t=i.indexOf("#");return t!==-1&&(e=i.slice(t)),e}function parseValue(i,e){return e.parseNumbers&&!Number.isNaN(Number(i))&&typeof i=="string"&&i.trim()!==""?i=Number(i):e.parseBooleans&&i!==null&&(i.toLowerCase()==="true"||i.toLowerCase()==="false")&&(i=i.toLowerCase()==="true"),i}function extract(i){i=removeHash(i);const e=i.indexOf("?");return e===-1?"":i.slice(e+1)}function parse$5(i,e){e={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,...e},validateArrayFormatSeparator(e.arrayFormatSeparator);const t=parserForArrayFormat(e),s=Object.create(null);if(typeof i!="string"||(i=i.trim().replace(/^[?#&]/,""),!i))return s;for(const r of i.split("&")){if(r==="")continue;const o=e.decode?r.replace(/\+/g," "):r;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),t(decode$3(a,e),l,s)}for(const[r,o]of Object.entries(s))if(typeof o=="object"&&o!==null)for(const[a,l]of Object.entries(o))o[a]=parseValue(l,e);else s[r]=parseValue(o,e);return e.sort===!1?s:(e.sort===!0?Object.keys(s).sort():Object.keys(s).sort(e.sort)).reduce((r,o)=>{const a=s[o];return a&&typeof a=="object"&&!Array.isArray(a)?r[o]=keysSorter(a):r[o]=a,r},Object.create(null))}function stringify$2(i,e){if(!i)return"";e={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...e},validateArrayFormatSeparator(e.arrayFormatSeparator);const t=a=>e.skipNull&&isNullOrUndefined(i[a])||e.skipEmptyString&&i[a]==="",s=encoderForArrayFormat(e),r={};for(const[a,l]of Object.entries(i))t(a)||(r[a]=l);const o=Object.keys(r);return e.sort!==!1&&o.sort(e.sort),o.map(a=>{const l=i[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(s(a),[]).join("&"):encode$1(a,e)+"="+encode$1(l,e)}).filter(a=>a.length>0).join("&")}function parseUrl(i,e){var r,o;e={decode:!0,...e};let[t,s]=splitOnFirst(i,"#");return t===void 0&&(t=i),{url:(o=(r=t==null?void 0:t.split("?"))==null?void 0:r[0])!=null?o:"",query:parse$5(extract(i),e),...e&&e.parseFragmentIdentifier&&s?{fragmentIdentifier:decode$3(s,e)}:{}}}function stringifyUrl(i,e){e={encode:!0,strict:!0,[encodeFragmentIdentifier]:!0,...e};const t=removeHash(i.url).split("?")[0]||"",s=extract(i.url),r={...parse$5(s,{sort:!1}),...i.query};let o=stringify$2(r,e);o&&(o=`?${o}`);let a=getHash(i.url);if(i.fragmentIdentifier){const l=new URL(t);l.hash=i.fragmentIdentifier,a=e[encodeFragmentIdentifier]?l.hash:`#${i.fragmentIdentifier}`}return`${t}${o}${a}`}function pick(i,e,t){t={parseFragmentIdentifier:!0,[encodeFragmentIdentifier]:!1,...t};const{url:s,query:r,fragmentIdentifier:o}=parseUrl(i,t);return stringifyUrl({url:s,query:includeKeys(r,e),fragmentIdentifier:o},t)}function exclude(i,e,t){const s=Array.isArray(e)?r=>!e.includes(r):(r,o)=>!e(r,o);return pick(i,s,t)}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 i={};try{i={...queryString.parse(location.search),...queryString.parse(location.hash.split("?")[1])}}catch(e){}return{...i}};var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getAugmentedNamespace(i){if(i.__esModule)return i;var e=i.default;if(typeof e=="function"){var t=function s(){if(this instanceof s){var r=[null];r.push.apply(r,arguments);var o=Function.bind.apply(e,r);return new o}return e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(i).forEach(function(s){var r=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(t,s,r.get?r:{enumerable:!0,get:function(){return i[s]}})}),t}var shams=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),s=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(s)!=="[object Symbol]")return!1;var r=42;e[t]=r;for(t 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]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,t);if(a.value!==r||a.enumerable!==!0)return!1}return!0},origSymbol=typeof Symbol<"u"&&Symbol,hasSymbolSham=shams,hasSymbols$1=function(){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$3=Array.prototype.slice,toStr$1=Object.prototype.toString,funcType="[object Function]",implementation$1=function(e){var t=this;if(typeof t!="function"||toStr$1.call(t)!==funcType)throw new TypeError(ERROR_MESSAGE+t);for(var s=slice$3.call(arguments,1),r,o=function(){if(this instanceof r){var m=t.apply(this,s.concat(slice$3.call(arguments)));return Object(m)===m?m:this}else return t.apply(e,s.concat(slice$3.call(arguments)))},a=Math.max(0,t.length-s.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(i){var errorProto=getProto(getProto(i));INTRINSICS["%Error.prototype%"]=errorProto}var doEval=function i(e){var t;if(e==="%AsyncFunction%")t=getEvalledConstructor("async function () {}");else if(e==="%GeneratorFunction%")t=getEvalledConstructor("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=getEvalledConstructor("async function* () {}");else if(e==="%AsyncGenerator%"){var s=i("%AsyncGeneratorFunction%");s&&(t=s.prototype)}else if(e==="%AsyncIteratorPrototype%"){var r=i("%AsyncGenerator%");r&&(t=getProto(r.prototype))}return INTRINSICS[e]=t,t},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$2=functionBind,hasOwn$1=src$1,$concat$1=bind$2.call(Function.call,Array.prototype.concat),$spliceApply=bind$2.call(Function.apply,Array.prototype.splice),$replace$1=bind$2.call(Function.call,String.prototype.replace),$strSlice=bind$2.call(Function.call,String.prototype.slice),$exec=bind$2.call(Function.call,RegExp.prototype.exec),rePropName=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=function(e){var t=$strSlice(e,0,1),s=$strSlice(e,-1);if(t==="%"&&s!=="%")throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");if(s==="%"&&t!=="%")throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");var r=[];return $replace$1(e,rePropName,function(o,a,l,c){r[r.length]=l?$replace$1(c,reEscapeChar,"$1"):a||o}),r},getBaseIntrinsic=function(e,t){var s=e,r;if(hasOwn$1(LEGACY_ALIASES,s)&&(r=LEGACY_ALIASES[s],s="%"+r[0]+"%"),hasOwn$1(INTRINSICS,s)){var o=INTRINSICS[s];if(o===needsEval&&(o=doEval(s)),typeof o>"u"&&!t)throw new $TypeError$1("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:s,value:o}}throw new $SyntaxError("intrinsic "+e+" does not exist!")},getIntrinsic=function(e,t){if(typeof e!="string"||e.length===0)throw new $TypeError$1("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="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 s=stringToPath(e),r=s.length>0?s[0]:"",o=getBaseIntrinsic("%"+r+"%",t),a=o.name,l=o.value,c=!1,d=o.alias;d&&(r=d[0],$spliceApply(s,$concat$1([0,1],d)));for(var m=1,u=!0;m=s.length){var S=$gOPD(l,g);u=!!S,u&&"get"in S&&!("originalValue"in S.get)?l=S.get:l=l[g]}else u=hasOwn$1(l,g),l=l[g];u&&!c&&(INTRINSICS[a]=l)}}return l},callBindExports={},callBind$1={get exports(){return callBindExports},set exports(i){callBindExports=i}};(function(i){var e=functionBind,t=getIntrinsic,s=t("%Function.prototype.apply%"),r=t("%Function.prototype.call%"),o=t("%Reflect.apply%",!0)||e.call(r,s),a=t("%Object.getOwnPropertyDescriptor%",!0),l=t("%Object.defineProperty%",!0),c=t("%Math.max%");if(l)try{l({},"a",{value:1})}catch(m){l=null}i.exports=function(u){var g=o(e,r,arguments);if(a&&l){var b=a(g,"length");b.configurable&&l(g,"length",{value:1+c(0,u.length-(arguments.length-1))})}return g};var d=function(){return o(e,s,arguments)};l?l(i.exports,"apply",{value:d}):i.exports.apply=d})(callBind$1);var GetIntrinsic$1=getIntrinsic,callBind=callBindExports,$indexOf=callBind(GetIntrinsic$1("String.prototype.indexOf")),callBound$1=function(e,t){var s=GetIntrinsic$1(e,!!t);return typeof s=="function"&&$indexOf(e,".prototype.")>-1?callBind(s):s};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$1=Object.prototype.toString,functionToString=Function.prototype.toString,$match=String.prototype.match,$slice=String.prototype.slice,$replace=String.prototype.replace,$toUpperCase=String.prototype.toUpperCase,$toLowerCase=String.prototype.toLowerCase,$test=RegExp.prototype.test,$concat=Array.prototype.concat,$join=Array.prototype.join,$arrSlice=Array.prototype.slice,$floor=Math.floor,bigIntValueOf=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(i){return i.__proto__}:null);function addNumericSeparator(i,e){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||$test.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var s=i<0?-$floor(-i):$floor(i);if(s!==i){var r=String(s),o=$slice.call(e,r.length+1);return $replace.call(r,t,"$&_")+"."+$replace.call($replace.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return $replace.call(e,t,"$&_")}var utilInspect=require$$0$1,inspectCustom=utilInspect.custom,inspectSymbol=isSymbol(inspectCustom)?inspectCustom:null,objectInspect=function i(e,t,s,r){var o=t||{};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 d=String(e)+"n";return l?addNumericSeparator(e,d):d}var m=typeof o.depth>"u"?5:o.depth;if(typeof s>"u"&&(s=0),s>=m&&m>0&&typeof e=="object")return isArray$6(e)?"[Array]":"[Object]";var u=getIndent(o,s);if(typeof r>"u")r=[];else if(indexOf$2(r,e)>=0)return"[Circular]";function g(k,M,G){if(M&&(r=$arrSlice.call(r),r.push(M)),G){var ee={depth:o.depth};return has$3(o,"quoteStyle")&&(ee.quoteStyle=o.quoteStyle),i(k,ee,s+1,r)}return i(k,o,s+1,r)}if(typeof e=="function"&&!isRegExp$1(e)){var b=nameOf(e),y=arrObjKeys(e,g);return"[Function"+(b?": "+b:" (anonymous)")+"]"+(y.length>0?" { "+$join.call(y,", ")+" }":"")}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 v="<"+$toLowerCase.call(String(e.nodeName)),x=e.attributes||[],A=0;A",v}if(isArray$6(e)){if(e.length===0)return"[]";var E=arrObjKeys(e,g);return u&&!singleLineValues(E)?"["+indentedJoin(E,u)+"]":"[ "+$join.call(E,", ")+" ]"}if(isError(e)){var _=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),_),", ")+" }":_.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+$join.call(_,", ")+" }"}if(typeof e=="object"&&a){if(inspectSymbol&&typeof e[inspectSymbol]=="function"&&utilInspect)return utilInspect(e,{depth:m-s});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(isMap(e)){var w=[];return mapForEach&&mapForEach.call(e,function(k,M){w.push(g(M,e,!0)+" => "+g(k,e))}),collectionOf("Map",mapSize.call(e),w,u)}if(isSet(e)){var C=[];return setForEach&&setForEach.call(e,function(k){C.push(g(k,e))}),collectionOf("Set",setSize.call(e),C,u)}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 P=arrObjKeys(e,g),I=gPO?gPO(e)===Object.prototype:e instanceof Object||e.constructor===Object,N=e instanceof Object?"":"null prototype",R=!I&&toStringTag&&Object(e)===e&&toStringTag in e?$slice.call(toStr(e),8,-1):N?"Object":"",F=I||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",B=F+(R||N?"["+$join.call($concat.call([],R||[],N||[]),": ")+"] ":"");return P.length===0?B+"{}":u?B+"{"+indentedJoin(P,u)+"}":B+"{ "+$join.call(P,", ")+" }"}return String(e)};function wrapQuotes(i,e,t){var s=(t.quoteStyle||e)==="double"?'"':"'";return s+i+s}function quote(i){return $replace.call(String(i),/"/g,""")}function isArray$6(i){return toStr(i)==="[object Array]"&&(!toStringTag||!(typeof i=="object"&&toStringTag in i))}function isDate$1(i){return toStr(i)==="[object Date]"&&(!toStringTag||!(typeof i=="object"&&toStringTag in i))}function isRegExp$1(i){return toStr(i)==="[object RegExp]"&&(!toStringTag||!(typeof i=="object"&&toStringTag in i))}function isError(i){return toStr(i)==="[object Error]"&&(!toStringTag||!(typeof i=="object"&&toStringTag in i))}function isString$1(i){return toStr(i)==="[object String]"&&(!toStringTag||!(typeof i=="object"&&toStringTag in i))}function isNumber$1(i){return toStr(i)==="[object Number]"&&(!toStringTag||!(typeof i=="object"&&toStringTag in i))}function isBoolean$1(i){return toStr(i)==="[object Boolean]"&&(!toStringTag||!(typeof i=="object"&&toStringTag in i))}function isSymbol(i){if(hasShammedSymbols)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!symToString)return!1;try{return symToString.call(i),!0}catch(e){}return!1}function isBigInt(i){if(!i||typeof i!="object"||!bigIntValueOf)return!1;try{return bigIntValueOf.call(i),!0}catch(e){}return!1}var hasOwn=Object.prototype.hasOwnProperty||function(i){return i in this};function has$3(i,e){return hasOwn.call(i,e)}function toStr(i){return objectToString$1.call(i)}function nameOf(i){if(i.name)return i.name;var e=$match.call(functionToString.call(i),/^function\s*([\w$]+)/);return e?e[1]:null}function indexOf$2(i,e){if(i.indexOf)return i.indexOf(e);for(var t=0,s=i.length;te.maxStringLength){var t=i.length-e.maxStringLength,s="... "+t+" more character"+(t>1?"s":"");return inspectString($slice.call(i,0,e.maxStringLength),e)+s}var r=$replace.call($replace.call(i,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,lowbyte);return wrapQuotes(r,"single",e)}function lowbyte(i){var e=i.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+$toUpperCase.call(e.toString(16))}function markBoxed(i){return"Object("+i+")"}function weakCollectionOf(i){return i+" { ? }"}function collectionOf(i,e,t,s){var r=s?indentedJoin(t,s):$join.call(t,", ");return i+" ("+e+") {"+r+"}"}function singleLineValues(i){for(var e=0;e=0)return!1;return!0}function getIndent(i,e){var t;if(i.indent===" ")t=" ";else if(typeof i.indent=="number"&&i.indent>0)t=$join.call(Array(i.indent+1)," ");else return null;return{base:t,prev:$join.call(Array(e+1),t)}}function indentedJoin(i,e){if(i.length===0)return"";var t=` `+e.prev+e.base;return t+$join.call(i,","+t)+` `+e.prev}function arrObjKeys(i,e){var t=isArray$6(i),s=[];if(t){s.length=i.length;for(var r=0;r1;){var t=e.pop(),s=t.obj[t.prop];if(isArray$5(s)){for(var r=[],o=0;o=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===formats$2.RFC1738&&(d===40||d===41)){l+=a.charAt(c);continue}if(d<128){l=l+hexTable[d];continue}if(d<2048){l=l+(hexTable[192|d>>6]+hexTable[128|d&63]);continue}if(d<55296||d>=57344){l=l+(hexTable[224|d>>12]+hexTable[128|d>>6&63]+hexTable[128|d&63]);continue}c+=1,d=65536+((d&1023)<<10|a.charCodeAt(c)&1023),l+=hexTable[240|d>>18]+hexTable[128|d>>12&63]+hexTable[128|d>>6&63]+hexTable[128|d&63]}return l},compact=function(e){for(var t=[{obj:{o:e},prop:"o"}],s=[],r=0;r"u"&&(E=0)}if(typeof c=="function"?x=c(t,x):x instanceof Date?x=u(x):s==="comma"&&isArray$4(x)&&(x=utils$2.maybeMap(x,function(ee){return ee instanceof Date?u(ee):ee})),x===null){if(o)return l&&!y?l(t,defaults$1.encoder,S,"key",g):t;x=""}if(isNonNullishPrimitive(x)||utils$2.isBuffer(x)){if(l){var C=y?t:l(t,defaults$1.encoder,S,"key",g);return[b(C)+"="+b(l(x,defaults$1.encoder,S,"value",g))]}return[b(t)+"="+b(String(x))]}var P=[];if(typeof x>"u")return P;var I;if(s==="comma"&&isArray$4(x))y&&l&&(x=utils$2.maybeMap(x,l)),I=[{value:x.length>0?x.join(",")||null:void 0}];else if(isArray$4(c))I=c;else{var N=Object.keys(x);I=d?N.sort(d):N}for(var R=r&&isArray$4(x)&&x.length===1?t+"[]":t,F=0;F"u"?defaults$1.allowDots:!!e.allowDots,charset:t,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:s,formatter:r,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(i,e){var t=i,s=normalizeStringifyOptions(e),r,o;typeof s.filter=="function"?(o=s.filter,t=o("",t)):isArray$4(s.filter)&&(o=s.filter,r=o);var a=[];if(typeof t!="object"||t===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 d=c==="comma"&&e&&e.commaRoundTrip;r||(r=Object.keys(t)),s.sort&&r.sort(s.sort);for(var m=getSideChannel(),u=0;u0?y+b:""},utils$1=utils$3,has=Object.prototype.hasOwnProperty,isArray$3=Array.isArray,defaults={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:utils$1.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},interpretNumericEntities=function(i){return i.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},parseArrayValue=function(i,e){return i&&typeof i=="string"&&e.comma&&i.indexOf(",")>-1?i.split(","):i},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function(e,t){var s={},r=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,o=t.parameterLimit===1/0?void 0:t.parameterLimit,a=r.split(t.delimiter,o),l=-1,c,d=t.charset;if(t.charsetSentinel)for(c=0;c-1&&(y=isArray$3(y)?[y]:y),has.call(s,b)?s[b]=utils$1.combine(s[b],y):s[b]=y}return s},parseObject=function(i,e,t,s){for(var r=s?e:parseArrayValue(e,t),o=i.length-1;o>=0;--o){var a,l=i[o];if(l==="[]"&&t.parseArrays)a=[].concat(r);else{a=t.plainObjects?Object.create(null):{};var c=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,d=parseInt(c,10);!t.parseArrays&&c===""?a={0:r}:!isNaN(d)&&l!==c&&String(d)===c&&d>=0&&t.parseArrays&&d<=t.arrayLimit?(a=[],a[d]=r):c!=="__proto__"&&(a[c]=r)}r=a}return r},parseKeys=function(e,t,s,r){if(e){var o=s.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/,l=/(\[[^[\]]*])/g,c=s.depth>0&&a.exec(o),d=c?o.slice(0,c.index):o,m=[];if(d){if(!s.plainObjects&&has.call(Object.prototype,d)&&!s.allowPrototypes)return;m.push(d)}for(var u=0;s.depth>0&&(c=l.exec(o))!==null&&u"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:t,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(i,e){var t=normalizeParseOptions(e);if(i===""||i===null||typeof i>"u")return t.plainObjects?Object.create(null):{};for(var s=typeof i=="string"?parseValues(i,t):i,r=t.plainObjects?Object.create(null):{},o=Object.keys(s),a=0;a-1};function normalizeName(i){if(typeof i!="string"&&(i=String(i)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(i)||i==="")throw new TypeError('Invalid character in header field name: "'+i+'"');return i.toLowerCase()}function normalizeValue(i){return typeof i!="string"&&(i=String(i)),i}function iteratorFor(i){var e={next:function(){var t=i.shift();return{done:t===void 0,value:t}}};return support.iterable&&(e[Symbol.iterator]=function(){return e}),e}function Headers(i){this.map={},i instanceof Headers?i.forEach(function(e,t){this.append(t,e)},this):Array.isArray(i)?i.forEach(function(e){this.append(e[0],e[1])},this):i&&Object.getOwnPropertyNames(i).forEach(function(e){this.append(e,i[e])},this)}Headers.prototype.append=function(i,e){i=normalizeName(i),e=normalizeValue(e);var t=this.map[i];this.map[i]=t?t+", "+e:e};Headers.prototype.delete=function(i){delete this.map[normalizeName(i)]};Headers.prototype.get=function(i){return i=normalizeName(i),this.has(i)?this.map[i]:null};Headers.prototype.has=function(i){return this.map.hasOwnProperty(normalizeName(i))};Headers.prototype.set=function(i,e){this.map[normalizeName(i)]=normalizeValue(e)};Headers.prototype.forEach=function(i,e){for(var t in this.map)this.map.hasOwnProperty(t)&&i.call(e,this.map[t],t,this)};Headers.prototype.keys=function(){var i=[];return this.forEach(function(e,t){i.push(t)}),iteratorFor(i)};Headers.prototype.values=function(){var i=[];return this.forEach(function(e){i.push(e)}),iteratorFor(i)};Headers.prototype.entries=function(){var i=[];return this.forEach(function(e,t){i.push([t,e])}),iteratorFor(i)};support.iterable&&(Headers.prototype[Symbol.iterator]=Headers.prototype.entries);function consumed(i){if(i.bodyUsed)return Promise.reject(new TypeError("Already read"));i.bodyUsed=!0}function fileReaderReady(i){return new Promise(function(e,t){i.onload=function(){e(i.result)},i.onerror=function(){t(i.error)}})}function readBlobAsArrayBuffer(i){var e=new FileReader,t=fileReaderReady(e);return e.readAsArrayBuffer(i),t}function readBlobAsText(i){var e=new FileReader,t=fileReaderReady(e);return e.readAsText(i),t}function readArrayBufferAsText(i){for(var e=new Uint8Array(i),t=new Array(e.length),s=0;s-1?e:i}function Request(i,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 t=e.body;if(i instanceof Request){if(i.bodyUsed)throw new TypeError("Already read");this.url=i.url,this.credentials=i.credentials,e.headers||(this.headers=new Headers(i.headers)),this.method=i.method,this.mode=i.mode,this.signal=i.signal,!t&&i._bodyInit!=null&&(t=i._bodyInit,i.bodyUsed=!0)}else this.url=String(i);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")&&t)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(t),(this.method==="GET"||this.method==="HEAD")&&(e.cache==="no-store"||e.cache==="no-cache")){var s=/([?&])_=[^&]*/;if(s.test(this.url))this.url=this.url.replace(s,"$1_="+new Date().getTime());else{var r=/\?/;this.url+=(r.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}Request.prototype.clone=function(){return new Request(this,{body:this._bodyInit})};function decode$1(i){var e=new FormData;return i.trim().split("&").forEach(function(t){if(t){var s=t.split("="),r=s.shift().replace(/\+/g," "),o=s.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(o))}}),e}function parseHeaders(i){var e=new Headers,t=i.replace(/\r?\n[\t ]+/g," ");return t.split("\r").map(function(s){return s.indexOf(` `)===0?s.substr(1,s.length):s}).forEach(function(s){var r=s.split(":"),o=r.shift().trim();if(o){var a=r.join(":").trim();e.append(o,a)}}),e}Body.call(Request.prototype);function Response(i,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(i)}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 i=new Response(null,{status:0,statusText:""});return i.type="error",i};var redirectStatuses=[301,302,303,307,308];Response.redirect=function(i,e){if(redirectStatuses.indexOf(e)===-1)throw new RangeError("Invalid status code");return new Response(null,{status:e,headers:{location:i}})};var DOMException=global$1.DOMException;try{new DOMException}catch(i){DOMException=function(e,t){this.message=e,this.name=t;var s=Error(e);this.stack=s.stack},DOMException.prototype=Object.create(Error.prototype),DOMException.prototype.constructor=DOMException}function fetch$2(i,e){return new Promise(function(t,s){var r=new Request(i,e);if(r.signal&&r.signal.aborted)return s(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 d="response"in o?o.response:o.responseText;setTimeout(function(){t(new Response(d,c))},0)},o.onerror=function(){setTimeout(function(){s(new TypeError("Network request failed"))},0)},o.ontimeout=function(){setTimeout(function(){s(new TypeError("Network request failed"))},0)},o.onabort=function(){setTimeout(function(){s(new DOMException("Aborted","AbortError"))},0)};function l(c){try{return c===""&&global$1.location.href?global$1.location.href:c}catch(d){return c}}o.open(r.method,l(r.url),!0),r.credentials==="include"?o.withCredentials=!0:r.credentials==="omit"&&(o.withCredentials=!1),"responseType"in o&&(support.blob?o.responseType="blob":support.arrayBuffer&&r.headers.get("Content-Type")&&r.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]))}):r.headers.forEach(function(c,d){o.setRequestHeader(d,c)}),r.signal&&(r.signal.addEventListener("abort",a),o.onreadystatechange=function(){o.readyState===4&&r.signal.removeEventListener("abort",a)}),o.send(typeof r._bodyInit>"u"?null:r._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(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);e&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,s)}return t}function _objectSpread2(i){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(i){return!1}}function _construct(i,e,t){return _isNativeReflectConstruct()?_construct=Reflect.construct:_construct=function(r,o,a){var l=[null];l.push.apply(l,o);var c=Function.bind.apply(r,l),d=new c;return a&&_setPrototypeOf(d,a.prototype),d},_construct.apply(null,arguments)}function _isNativeFunction(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function _wrapNativeSuper(i){var e=typeof Map=="function"?new Map:void 0;return _wrapNativeSuper=function(s){if(s===null||!_isNativeFunction(s))return s;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(s))return e.get(s);e.set(s,r)}function r(){return _construct(s,arguments,_getPrototypeOf(this).constructor)}return r.prototype=Object.create(s.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(r,s)},_wrapNativeSuper(i)}function _assertThisInitialized(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function _possibleConstructorReturn(i,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(i)}function _createSuper(i){var e=_isNativeReflectConstruct();return function(){var s=_getPrototypeOf(i),r;if(e){var o=_getPrototypeOf(this).constructor;r=Reflect.construct(s,arguments,o)}else r=s.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function _toConsumableArray(i){return _arrayWithoutHoles(i)||_iterableToArray(i)||_unsupportedIterableToArray(i)||_nonIterableSpread()}function _arrayWithoutHoles(i){if(Array.isArray(i))return _arrayLikeToArray(i)}function _iterableToArray(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function _unsupportedIterableToArray(i,e){if(i){if(typeof i=="string")return _arrayLikeToArray(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _arrayLikeToArray(i,e)}}function _arrayLikeToArray(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t1&&arguments[1]!==void 0?arguments[1]:{global:!1,core:!1,defaultInstance:!1},r=!1,o=!1,a=!1;if(typeof s=="number"?(process&&process.env,r=!0,o=!1):_typeof(s)==="object"&&s&&(o=s.global||!1,r=s.core||!1,a=s.defaultInstance||!1),o){i.globalMiddlewares.splice(i.globalMiddlewares.length-i.defaultGlobalMiddlewaresLength,0,t);return}if(r){i.coreMiddlewares.splice(i.coreMiddlewares.length-i.defaultCoreMiddlewaresLength,0,t);return}if(a){this.defaultMiddlewares.push(t);return}this.middlewares.push(t)}},{key:"execute",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,s=compose([].concat(_toConsumableArray(this.middlewares),_toConsumableArray(this.defaultMiddlewares),_toConsumableArray(i.globalMiddlewares),_toConsumableArray(i.coreMiddlewares)));return s(t)}}]),i}();Onion.globalMiddlewares=[];Onion.defaultGlobalMiddlewaresLength=0;Onion.coreMiddlewares=[];Onion.defaultCoreMiddlewaresLength=0;var MapCache=function(){function i(e){_classCallCheck(this,i),this.cache=new Map,this.timer={},this.extendOptions(e)}return _createClass(i,[{key:"extendOptions",value:function(t){this.maxCache=t.maxCache||0}},{key:"get",value:function(t){return this.cache.get(JSON.stringify(t))}},{key:"set",value:function(t,s){var r=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(t);this.cache.set(l,s),o>0&&(this.timer[l]=setTimeout(function(){r.cache.delete(l),delete r.timer[l]},o))}},{key:"delete",value:function(t){var s=JSON.stringify(t);return delete this.timer[s],this.cache.delete(s)}},{key:"clear",value:function(){return this.timer={},this.cache.clear()}}]),i}(),RequestError=function(i){_inherits(t,i);var e=_createSuper(t);function t(s,r){var o,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"RequestError";return _classCallCheck(this,t),o=e.call(this,s),o.name="RequestError",o.request=r,o.type=a,o}return t}(_wrapNativeSuper(Error)),ResponseError=function(i){_inherits(t,i);var e=_createSuper(t);function t(s,r,o,a){var l,c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"ResponseError";return _classCallCheck(this,t),l=e.call(this,r||s.statusText),l.name="ResponseError",l.data=o,l.response=s,l.request=a,l.type=c,l}return t}(_wrapNativeSuper(Error));function readerGBK(i){return new Promise(function(e,t){var s=new FileReader;s.onload=function(){e(s.result)},s.onerror=t,s.readAsText(i,"GBK")})}function safeJsonParse(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;try{return JSON.parse(i)}catch(r){if(e)throw new ResponseError(t,"JSON.parse fail",i,s,"ParseError")}return i}function timeout2Throw(i,e,t){return new Promise(function(s,r){setTimeout(function(){r(new RequestError(e||"timeout of ".concat(i,"ms exceeded"),t,"Timeout"))},i)})}function cancel2Throw(i){return new Promise(function(e,t){i.cancelToken&&i.cancelToken.promise.then(function(s){t(s)})})}var toString$2=Object.prototype.toString;function getEnv(){var i;return typeof process<"u"&&toString$2.call(process)==="[object process]"&&(i="NODE"),typeof XMLHttpRequest<"u"&&(i="BROWSER"),i}function isArray$2(i){return _typeof(i)==="object"&&Object.prototype.toString.call(i)==="[object Array]"}function isURLSearchParams(i){return typeof URLSearchParams<"u"&&i instanceof URLSearchParams}function isDate(i){return _typeof(i)==="object"&&Object.prototype.toString.call(i)==="[object Date]"}function isObject$2(i){return i!==null&&_typeof(i)==="object"}function forEach2ObjArr(i,e){if(i)if(_typeof(i)!=="object"&&(i=[i]),isArray$2(i))for(var t=0;t1&&arguments[1]!==void 0?arguments[1]:{},s=t.prefix,r=t.suffix;return s&&(e="".concat(s).concat(e)),r&&(e="".concat(e).concat(r)),{url:e,options:t}},warnedCoreType=!1;function __defaultValidateCache(i,e){var t=e.method,s=t===void 0?"get":t;return s.toLowerCase()==="get"}function fetchMiddleware(i,e){if(!i)return e();var t=i.req;t=t===void 0?{}:t;var s=t.options,r=s===void 0?{}:s,o=t.url,a=o===void 0?"":o,l=i.cache,c=i.responseInterceptors,d=r.timeout,m=d===void 0?0:d,u=r.timeoutMessage,g=r.__umiRequestCoreType__,b=g===void 0?"normal":g,y=r.useCache,S=y===void 0?!1:y,v=r.method,x=v===void 0?"get":v,A=r.params,E=r.ttl,_=r.validateCache,w=_===void 0?__defaultValidateCache:_;if(b!=="normal")return process&&process.env,e();var C=fetch;if(!C)throw new Error("Global fetch not exist!");var P=getEnv()==="BROWSER",I=w(a,r)&&S&&P;if(I){var N=l.get({url:a,params:A,method:x});if(N)return N=N.clone(),N.useCache=!0,i.res=N,e()}var R;return m>0?R=Promise.race([cancel2Throw(r),C(a,r),timeout2Throw(m,u,i.req)]):R=Promise.race([cancel2Throw(r),C(a,r)]),c.forEach(function(F){R=R.then(function(B){var k=typeof B.clone=="function"?B.clone():B;return F(k,r)})}),R.then(function(F){if(I&&F.status===200){var B=F.clone();B.useCache=!0,l.set({url:a,params:A,method:x},B,E)}return i.res=F,e()})}function parseResponseMiddleware(i,e){var t;return e().then(function(){if(i){var s=i.res,r=s===void 0?{}:s,o=i.req,a=o===void 0?{}:o,l=a||{},c=l.options;c=c===void 0?{}:c;var d=c.responseType,m=d===void 0?"json":d,u=c.charset,g=u===void 0?"utf8":u;c.getResponse;var b=c.throwErrIfParseFail,y=b===void 0?!1:b,S=c.parseResponse,v=S===void 0?!0:S;if(v&&!(!r||!r.clone)){if(t=getEnv()==="BROWSER"?r.clone():r,t.useCache=r.useCache||!1,g==="gbk")try{return r.blob().then(readerGBK).then(function(x){return safeJsonParse(x,!1,t,a)})}catch(x){throw new ResponseError(t,x.message,null,a,"ParseError")}else if(m==="json")return r.text().then(function(x){return safeJsonParse(x,y,t,a)});try{return r[m]()}catch(x){throw new ResponseError(t,"responseType not support",null,a,"ParseError")}}}}).then(function(s){if(i){i.res;var r=i.req,o=r===void 0?{}:r,a=o||{},l=a.options;l=l===void 0?{}:l;var c=l.getResponse,d=c===void 0?!1:c;if(t){if(t.status>=200&&t.status<300){if(d){i.res={data:s,response:t};return}i.res=s;return}throw new ResponseError(t,"http error",s,o,"HttpError")}}}).catch(function(s){if(s instanceof RequestError||s instanceof ResponseError)throw s;var r=i.req,o=i.res;throw s.request=s.request||r,s.response=s.response||o,s.type=s.type||s.name,s.data=s.data||void 0,s})}function simplePostMiddleware(i,e){if(!i)return e();var t=i.req;t=t===void 0?{}:t;var s=t.options,r=s===void 0?{}:s,o=r.method,a=o===void 0?"get":o;if(["post","put","patch","delete"].indexOf(a.toLowerCase())===-1)return e();var l=r.requestType,c=l===void 0?"json":l,d=r.data;if(d){var m=Object.prototype.toString.call(d);m==="[object Object]"||m==="[object Array]"?c==="json"?(r.headers=_objectSpread2({Accept:"application/json","Content-Type":"application/json;charset=UTF-8"},r.headers),r.body=JSON.stringify(d)):c==="form"&&(r.headers=_objectSpread2({Accept:"application/json","Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},r.headers),r.body=reqStringify(d)):(r.headers=_objectSpread2({Accept:"application/json"},r.headers),r.body=d)}return i.req.options=r,e()}function paramsSerialize(i,e){var t,s;if(i)if(e)t=e(i);else if(isURLSearchParams(i))t=i.toString();else if(isArray$2(i))s=[],forEach2ObjArr(i,function(o){o===null||typeof o>"u"?s.push(o):s.push(isObject$2(o)?JSON.stringify(o):o)}),t=reqStringify(s);else{s={},forEach2ObjArr(i,function(o,a){var l=o;o===null||typeof o>"u"?s[a]=o:isDate(o)?l=o.toISOString():isArray$2(o)?l=o:isObject$2(o)&&(l=JSON.stringify(o)),s[a]=l});var r=reqStringify(s);t=r}return t}function simpleGetMiddleware(i,e){if(!i)return e();var t=i.req;t=t===void 0?{}:t;var s=t.options,r=s===void 0?{}:s,o=r.paramsSerializer,a=r.params,l=i.req;l=l===void 0?{}:l;var c=l.url,d=c===void 0?"":c;r.method=r.method?r.method.toUpperCase():"GET",r.credentials=r.credentials||"same-origin";var m=paramsSerialize(a,o);if(i.req.originUrl=d,m){var u=d.indexOf("?")!==-1?"&":"?";i.req.url="".concat(d).concat(u).concat(m)}return i.req.options=r,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 i(e){_classCallCheck(this,i),this.onion=new Onion([]),this.fetchIndex=0,this.mapCache=new MapCache(e),this.initOptions=e,this.instanceRequestInterceptors=[],this.instanceResponseInterceptors=[]}return _createClass(i,[{key:"use",value:function(t){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{global:!1,core:!1};return this.onion.use(t,s),this}},{key:"extendOptions",value:function(t){this.initOptions=mergeRequestOptions(this.initOptions,t),this.mapCache.extendOptions(t)}},{key:"dealRequestInterceptors",value:function(t){var s=function(a,l){return a.then(function(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t.req.url=c.url||t.req.url,t.req.options=c.options||t.req.options,l(t.req.url,t.req.options)})},r=[].concat(_toConsumableArray(i.requestInterceptors),_toConsumableArray(this.instanceRequestInterceptors));return r.reduce(s,Promise.resolve()).then(function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t.req.url=o.url||t.req.url,t.req.options=o.options||t.req.options,Promise.resolve()})}},{key:"request",value:function(t,s){var r=this,o=this.onion,a={req:{url:t,options:_objectSpread2(_objectSpread2({},s),{},{url:t})},res:null,cache:this.mapCache,responseInterceptors:[].concat(_toConsumableArray(i.responseInterceptors),_toConsumableArray(this.instanceResponseInterceptors))};if(typeof t!="string")throw new Error("url MUST be a string");return new Promise(function(l,c){r.dealRequestInterceptors(a).then(function(){return o.execute(a)}).then(function(){l(a.res)}).catch(function(d){var m=a.req.options.errorHandler;if(m)try{var u=m(d);l(u)}catch(g){c(g)}else c(d)})})}}],[{key:"requestUse",value:function(t){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{global:!0};if(typeof t!="function")throw new TypeError("Interceptor must be function!");s.global?i.requestInterceptors.push(t):this.instanceRequestInterceptors.push(t)}},{key:"responseUse",value:function(t){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{global:!0};if(typeof t!="function")throw new TypeError("Interceptor must be function!");s.global?i.responseInterceptors.push(t):this.instanceResponseInterceptors.push(t)}}]),i}();Core.requestInterceptors=[addfix];Core.responseInterceptors=[];function Cancel(i){this.message=i}Cancel.prototype.toString=function(){return this.message?"Cancel: ".concat(this.message):"Cancel"};Cancel.prototype.__CANCEL__=!0;function CancelToken(i){if(typeof i!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(r){e=r});var t=this;i(function(r){t.reason||(t.reason=new Cancel(r),e(t.reason))})}CancelToken.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};CancelToken.source=function(){var e,t=new CancelToken(function(r){e=r});return{token:t,cancel:e}};function isCancel(i){return!!(i&&i.__CANCEL__)}var request$1=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=new Core(e),s=function(a){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=mergeRequestOptions(t.initOptions,l);return t.request(a,c)};s.use=t.use.bind(t),s.fetchIndex=t.fetchIndex,s.interceptors={request:{use:Core.requestUse.bind(t)},response:{use:Core.responseUse.bind(t)}};var r=["get","post","delete","put","patch","head","options","rpc"];return r.forEach(function(o){s[o]=function(a,l){return s(a,_objectSpread2(_objectSpread2({},l),{},{method:o}))}}),s.Cancel=Cancel,s.CancelToken=CancelToken,s.isCancel=isCancel,s.extendOptions=t.extendOptions.bind(t),s.middlewares={instance:t.onion.middlewares,defaultInstance:t.onion.defaultMiddlewares,global:Onion.globalMiddlewares,core:Onion.coreMiddlewares},s},extend$1=function(e){return request$1(e)};request$1({parseResponse:!1});request$1({});var lodash_isemptyExports={},lodash_isempty={get exports(){return lodash_isemptyExports},set exports(i){lodash_isemptyExports=i}};(function(i,e){var t=9007199254740991,s="[object Arguments]",r="[object Function]",o="[object GeneratorFunction]",a="[object Map]",l="[object Object]",c="[object Promise]",d="[object Set]",m="[object WeakMap]",u="[object DataView]",g=/[\\^$.*+?()[\]{}|]/g,b=/^\[object .+?Constructor\]$/,y=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,S=typeof self=="object"&&self&&self.Object===Object&&self,v=y||S||Function("return this")(),x=e&&!e.nodeType&&e,A=x&&!0&&i&&!i.nodeType&&i,E=A&&A.exports===x;function _(ce,Se){return ce==null?void 0:ce[Se]}function w(ce){var Se=!1;if(ce!=null&&typeof ce.toString!="function")try{Se=!!(ce+"")}catch(we){}return Se}function C(ce,Se){return function(we){return ce(Se(we))}}var P=Function.prototype,I=Object.prototype,N=v["__core-js_shared__"],R=function(){var ce=/[^.]+$/.exec(N&&N.keys&&N.keys.IE_PROTO||"");return ce?"Symbol(src)_1."+ce:""}(),F=P.toString,B=I.hasOwnProperty,k=I.toString,M=RegExp("^"+F.call(B).replace(g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),G=E?v.Buffer:void 0,ee=I.propertyIsEnumerable,$=G?G.isBuffer:void 0,re=C(Object.keys,Object),ie=z(v,"DataView"),de=z(v,"Map"),Q=z(v,"Promise"),H=z(v,"Set"),ue=z(v,"WeakMap"),ne=!ee.call({valueOf:1},"valueOf"),W=Y(ie),oe=Y(de),he=Y(Q),le=Y(H),me=Y(ue);function Ae(ce){return k.call(ce)}function be(ce){if(!pe(ce)||T(ce))return!1;var Se=ae(ce)||w(ce)?M:b;return Se.test(Y(ce))}function z(ce,Se){var we=_(ce,Se);return be(we)?we:void 0}var J=Ae;(ie&&J(new ie(new ArrayBuffer(1)))!=u||de&&J(new de)!=a||Q&&J(Q.resolve())!=c||H&&J(new H)!=d||ue&&J(new ue)!=m)&&(J=function(ce){var Se=k.call(ce),we=Se==l?ce.constructor:void 0,Pe=we?Y(we):void 0;if(Pe)switch(Pe){case W:return u;case oe:return a;case he:return c;case le:return d;case me:return m}return Se});function T(ce){return!!R&&R in ce}function q(ce){var Se=ce&&ce.constructor,we=typeof Se=="function"&&Se.prototype||I;return ce===we}function Y(ce){if(ce!=null){try{return F.call(ce)}catch(Se){}try{return ce+""}catch(Se){}}return""}function O(ce){return se(ce)&&B.call(ce,"callee")&&(!ee.call(ce,"callee")||k.call(ce)==s)}var V=Array.isArray;function U(ce){return ce!=null&&fe(ce.length)&&!ae(ce)}function se(ce){return ye(ce)&&U(ce)}var te=$||ve;function K(ce){if(U(ce)&&(V(ce)||typeof ce=="string"||typeof ce.splice=="function"||te(ce)||O(ce)))return!ce.length;var Se=J(ce);if(Se==a||Se==d)return!ce.size;if(ne||q(ce))return!re(ce).length;for(var we in ce)if(B.call(ce,we))return!1;return!0}function ae(ce){var Se=pe(ce)?k.call(ce):"";return Se==r||Se==o}function fe(ce){return typeof ce=="number"&&ce>-1&&ce%1==0&&ce<=t}function pe(ce){var Se=typeof ce;return!!ce&&(Se=="object"||Se=="function")}function ye(ce){return!!ce&&typeof ce=="object"}function ve(){return!1}i.exports=K})(lodash_isempty,lodash_isemptyExports);var objectTag="[object Object]";function isHostObject(i){var e=!1;if(i!=null&&typeof i.toString!="function")try{e=!!(i+"")}catch(t){}return e}function overArg(i,e){return function(t){return i(e(t))}}var funcProto=Function.prototype,objectProto=Object.prototype,funcToString=funcProto.toString,hasOwnProperty=objectProto.hasOwnProperty,objectCtorString=funcToString.call(Object),objectToString=objectProto.toString,getPrototype=overArg(Object.getPrototypeOf,Object);function isObjectLike(i){return!!i&&typeof i=="object"}function isPlainObject$2(i){if(!isObjectLike(i)||objectToString.call(i)!=objectTag||isHostObject(i))return!1;var e=getPrototype(i);if(e===null)return!0;var t=hasOwnProperty.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&funcToString.call(t)==objectCtorString}var lodash_isplainobject=isPlainObject$2,lodash_transformExports={},lodash_transform={get exports(){return lodash_transformExports},set exports(i){lodash_transformExports=i}};(function(i,e){var t=200,s="Expected a function",r="__lodash_hash_undefined__",o=1,a=2,l=1/0,c=9007199254740991,d="[object Arguments]",m="[object Array]",u="[object Boolean]",g="[object Date]",b="[object Error]",y="[object Function]",S="[object GeneratorFunction]",v="[object Map]",x="[object Number]",A="[object Object]",E="[object Promise]",_="[object RegExp]",w="[object Set]",C="[object String]",P="[object Symbol]",I="[object WeakMap]",N="[object ArrayBuffer]",R="[object DataView]",F="[object Float32Array]",B="[object Float64Array]",k="[object Int8Array]",M="[object Int16Array]",G="[object Int32Array]",ee="[object Uint8Array]",$="[object Uint8ClampedArray]",re="[object Uint16Array]",ie="[object Uint32Array]",de=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,H=/^\./,ue=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ne=/[\\^$.*+?()[\]{}|]/g,W=/\\(\\)?/g,oe=/^\[object .+?Constructor\]$/,he=/^(?:0|[1-9]\d*)$/,le={};le[F]=le[B]=le[k]=le[M]=le[G]=le[ee]=le[$]=le[re]=le[ie]=!0,le[d]=le[m]=le[N]=le[u]=le[R]=le[g]=le[b]=le[y]=le[v]=le[x]=le[A]=le[_]=le[w]=le[C]=le[I]=!1;var me=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,Ae=typeof self=="object"&&self&&self.Object===Object&&self,be=me||Ae||Function("return this")(),z=e&&!e.nodeType&&e,J=z&&!0&&i&&!i.nodeType&&i,T=J&&J.exports===z,q=T&&me.process,Y=function(){try{return q&&q.binding("util")}catch(D){}}(),O=Y&&Y.isTypedArray;function V(D,Z){for(var ge=-1,xe=D?D.length:0;++ge-1}function mi(D,Z){var ge=this.__data__,xe=Mt(ge,D);return xe<0?ge.push([D,Z]):ge[xe][1]=Z,this}nt.prototype.clear=hi,nt.prototype.delete=fi,nt.prototype.get=di,nt.prototype.has=pi,nt.prototype.set=mi;function st(D){var Z=-1,ge=D?D.length:0;for(this.clear();++ZIe))return!1;var ke=Ee.get(D);if(ke&&Ee.get(Z))return ke==Z;var Oe=-1,Ue=!0,De=_e&o?new Pt:void 0;for(Ee.set(D,Z),Ee.set(Z,D);++Oe-1&&D%1==0&&D-1&&D%1==0&&D<=c}function At(D){var Z=typeof D;return!!D&&(Z=="object"||Z=="function")}function Lt(D){return!!D&&typeof D=="object"}function Ht(D){return typeof D=="symbol"||Lt(D)&&Le.call(D)==P}var Zt=O?K(O):Fi;function en(D){return D==null?"":zi(D)}function tn(D,Z,ge){var xe=D==null?void 0:Wt(D,Z);return xe===void 0?ge:xe}function nn(D,Z){return D!=null&&Qi(D,Z,Bi)}function Rt(D){return Jt(D)?Ti(D):Vi(D)}function sn(D,Z,ge){var xe=ot(D)||Zt(D);if(Z=Oi(Z),ge==null)if(xe||At(D)){var _e=D.constructor;xe?ge=ot(D)?new _e:[]:ge=Vt(_e)?Ci(ut(D)):{}}else ge={};return(xe?V:Li)(D,function(Ee,Te,Ie){return Z(ge,Ee,Te,Ie)}),ge}function rn(D){return D}function on(D){return Ct(D)?se(It(D)):Ui(D)}i.exports=sn})(lodash_transform,lodash_transformExports);const isEmpty$1=lodash_isemptyExports,isPlainObject$1=lodash_isplainobject,transform=lodash_transformExports;var src=function i(e,{cleanKeys:t=[],cleanValues:s=[],emptyArrays:r=!0,emptyObjects:o=!0,emptyStrings:a=!0,NaNValues:l=!1,nullValues:c=!0,undefinedValues:d=!0}={}){return transform(e,(m,u,g)=>{if(!t.includes(g)&&((Array.isArray(u)||isPlainObject$1(u))&&(u=i(u,{NaNValues:l,cleanKeys:t,cleanValues:s,emptyArrays:r,emptyObjects:o,emptyStrings:a,nullValues:c,undefinedValues:d})),!s.includes(u)&&!(o&&isPlainObject$1(u)&&isEmpty$1(u))&&!(r&&Array.isArray(u)&&!u.length)&&!(a&&u==="")&&!(l&&Number.isNaN(u))&&!(c&&u===null)&&!(d&&u===void 0))){if(Array.isArray(m))return m.push(u);m[g]=u}})};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"}),originalPostMessage=window.postMessage;window.postMessage=i=>{originalPostMessage(i,"*")};const loop=()=>{},calls={},browserInfo$3=browser();browserInfo$3.isApp&&window.addEventListener("message",i=>{var e,t;try{const s=i.data?typeof i.data=="object"?i.data:JSON.parse(i.data):{},r=((e=s.content)==null?void 0:e.uuid)||s.uuid;try{s.content&&(s.content=JSON.parse(s.content))}catch(l){}if(console.log("h5_接受_api:",s==null?void 0:s.api),!r){const l=Object.keys(calls).filter(c=>c.indexOf(s.api)===0);for(const c of l){const d=calls[c]||loop;typeof d=="function"&&d(s),Array.isArray(d)&&d.forEach(m=>{typeof m=="function"&&m(s)})}return}const o=((t=s.content)==null?void 0:t.uuid)||s.uuid||s.api+s.uuid,a=calls[o]||loop;typeof a=="function"&&a(s)}catch(s){console.error("通信消息解析错误",s)}});var ti,ii,ni,si,ri,oi;const instance=window.DAYA||((ii=(ti=window.webkit)==null?void 0:ti.messageHandlers)==null?void 0:ii.DAYA)||window.COLEXIU||((si=(ni=window.webkit)==null?void 0:ni.messageHandlers)==null?void 0:si.COLEXIU)||window.ORCHESTRA||((oi=(ri=window.webkit)==null?void 0:ri.messageHandlers)==null?void 0:oi.ORCHESTRA),postMessage=(i,e)=>{if(browserInfo$3.isApp){const t=getRandomKey();calls[t]=e||loop,i.content=i.content?{...i.content,uuid:t}:{uuid:t},instance.postMessage(JSON.stringify(i)),console.log("h5_请求_api:",i.api)}},listenerMessage=(i,e)=>{if(browserInfo$3.isApp){const t=i;calls[t]||(calls[t]=[]),calls[t].push(e||loop)}},removeListenerMessage=(i,e)=>{if(browserInfo$3.isApp){const t=i;if(Array.isArray(calls[t])){const s=calls[t].indexOf(e);calls[t].splice(s,1)}}},promisefiyPostMessage=i=>new Promise(e=>{postMessage(i,t=>e(t))}),apiRouter=whiteUrl(),browserInfo$2=browser(),request=extend$1({requestType:"form",timeout:1e4});request.interceptors.request.use((i,e)=>{const t=storeData.proxy+storeData.platformApi;storeData.platformType==="WEB"&&apiRouter[i]&&(i=apiRouter[i]);const s=getToken(),r={};return s&&(r.Authorization=s),{url:t+i,options:{...e,params:src(e.params),data:src(e.data),headers:{...e.headers,...r}}}},{global:!1});request.interceptors.response.use(async(i,e)=>{if(i.status>299||i.status<200){const s=i.statusText+", 状态码"+i.status;throw showToast(s),new Error(s)}const t=await i.clone().json();if(t.code!==200&&t.errCode!==0){const s=t.msg||"处理失败,请重试";throw t.code===403||t.code===401||showToast(s),t.code===403&&(browserInfo$2.isApp?postMessage({api:"login"}):(storeData.status="error",showToast("登录过期"))),new Error(s)}return t},{global:!1});var dayjs_minExports={},dayjs_min={get exports(){return dayjs_minExports},set exports(i){dayjs_minExports=i}};(function(i,e){(function(t,s){i.exports=s()})(commonjsGlobal,function(){var t=1e3,s=6e4,r=36e5,o="millisecond",a="second",l="minute",c="hour",d="day",m="week",u="month",g="quarter",b="year",y="date",S="Invalid Date",v=/^(\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(k){var M=["th","st","nd","rd"],G=k%100;return"["+k+(M[(G-20)%10]||M[G]||M[0])+"]"}},E=function(k,M,G){var ee=String(k);return!ee||ee.length>=M?k:""+Array(M+1-ee.length).join(G)+k},_={s:E,z:function(k){var M=-k.utcOffset(),G=Math.abs(M),ee=Math.floor(G/60),$=G%60;return(M<=0?"+":"-")+E(ee,2,"0")+":"+E($,2,"0")},m:function k(M,G){if(M.date()1)return k(ie[0])}else{var de=M.name;C[de]=M,$=de}return!ee&&$&&(w=$),$||!ee&&w},N=function(k,M){if(P(k))return k.clone();var G=typeof M=="object"?M:{};return G.date=k,G.args=arguments,new F(G)},R=_;R.l=I,R.i=P,R.w=function(k,M){return N(k,{locale:M.$L,utc:M.$u,x:M.$x,$offset:M.$offset})};var F=function(){function k(G){this.$L=I(G.locale,null,!0),this.parse(G)}var M=k.prototype;return M.parse=function(G){this.$d=function(ee){var $=ee.date,re=ee.utc;if($===null)return new Date(NaN);if(R.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var ie=$.match(v);if(ie){var de=ie[2]-1||0,Q=(ie[7]||"0").substring(0,3);return re?new Date(Date.UTC(ie[1],de,ie[3]||1,ie[4]||0,ie[5]||0,ie[6]||0,Q)):new Date(ie[1],de,ie[3]||1,ie[4]||0,ie[5]||0,ie[6]||0,Q)}}return new Date($)}(G),this.$x=G.x||{},this.init()},M.init=function(){var G=this.$d;this.$y=G.getFullYear(),this.$M=G.getMonth(),this.$D=G.getDate(),this.$W=G.getDay(),this.$H=G.getHours(),this.$m=G.getMinutes(),this.$s=G.getSeconds(),this.$ms=G.getMilliseconds()},M.$utils=function(){return R},M.isValid=function(){return this.$d.toString()!==S},M.isSame=function(G,ee){var $=N(G);return this.startOf(ee)<=$&&$<=this.endOf(ee)},M.isAfter=function(G,ee){return N(G)=0&&u<=1){if(g._volume=u,g._muted)return g;g.usingWebAudio&&g.masterGain.gain.setValueAtTime(u,t.ctx.currentTime);for(var b=0;b=0;g--)u._howls[g].unload();return u.usingWebAudio&&u.ctx&&typeof u.ctx.close<"u"&&(u.ctx.close(),u.ctx=null,m()),u},codecs:function(u){return(this||t)._codecs[u.replace(/^x-/,"")]},_setup:function(){var u=this||t;if(u.state=u.ctx&&u.ctx.state||"suspended",u._autoSuspend(),!u.usingWebAudio)if(typeof Audio<"u")try{var g=new Audio;typeof g.oncanplaythrough>"u"&&(u._canPlayEvent="canplay")}catch(b){u.noAudio=!0}else u.noAudio=!0;try{var g=new Audio;g.muted&&(u.noAudio=!0)}catch(b){}return u.noAudio||u._setupCodecs(),u},_setupCodecs:function(){var u=this||t,g=null;try{g=typeof Audio<"u"?new Audio:null}catch(_){return u}if(!g||typeof g.canPlayType!="function")return u;var b=g.canPlayType("audio/mpeg;").replace(/^no$/,""),y=u._navigator?u._navigator.userAgent:"",S=y.match(/OPR\/([0-6].)/g),v=S&&parseInt(S[0].split("/")[1],10)<33,x=y.indexOf("Safari")!==-1&&y.indexOf("Chrome")===-1,A=y.match(/Version\/(.*?) /),E=x&&A&&parseInt(A[1],10)<15;return u._codecs={mp3:!!(!v&&(b||g.canPlayType("audio/mp3;").replace(/^no$/,""))),mpeg:!!b,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:!!(!E&&g.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!!(!E&&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$/,"")},u},_unlockAudio:function(){var u=this||t;if(!(u._audioUnlocked||!u.ctx)){u._audioUnlocked=!1,u.autoUnlock=!1,!u._mobileUnloaded&&u.ctx.sampleRate!==44100&&(u._mobileUnloaded=!0,u.unload()),u._scratchBuffer=u.ctx.createBuffer(1,1,22050);var g=function(b){for(;u._html5AudioPool.length"u"?E.noteOn(0):E.start(0),typeof u.ctx.resume=="function"&&u.ctx.resume(),E.onended=function(){E.disconnect(0),u._audioUnlocked=!0,document.removeEventListener("touchstart",g,!0),document.removeEventListener("touchend",g,!0),document.removeEventListener("click",g,!0),document.removeEventListener("keydown",g,!0);for(var _=0;_"u"||!t.usingWebAudio)){for(var g=0;g"u"||!t.usingWebAudio))return u.state==="running"&&u.ctx.state!=="interrupted"&&u._suspendTimer?(clearTimeout(u._suspendTimer),u._suspendTimer=null):u.state==="suspended"||u.state==="running"&&u.ctx.state==="interrupted"?(u.ctx.resume().then(function(){u.state="running";for(var g=0;g"u"&&(u="__default",!b._playLock)){for(var S=0,v=0;v0?x._seek:b._sprite[u][0]/1e3),_=Math.max(0,(b._sprite[u][0]+b._sprite[u][1])/1e3-E),w=_*1e3/Math.abs(x._rate),C=b._sprite[u][0]/1e3,P=(b._sprite[u][0]+b._sprite[u][1])/1e3;x._sprite=u,x._ended=!1;var I=function(){x._paused=!1,x._seek=E,x._start=C,x._stop=P,x._loop=!!(x._loop||b._sprite[u][2])};if(E>=P){b._ended(x);return}var N=x._node;if(b._webAudio){var R=function(){b._playLock=!1,I(),b._refreshBuffer(x);var M=x._muted||b._muted?0:x._volume;N.gain.setValueAtTime(M,t.ctx.currentTime),x._playStart=t.ctx.currentTime,typeof N.bufferSource.start>"u"?x._loop?N.bufferSource.noteGrainOn(0,E,86400):N.bufferSource.noteGrainOn(0,E,_):x._loop?N.bufferSource.start(0,E,86400):N.bufferSource.start(0,E,_),w!==1/0&&(b._endTimers[x._id]=setTimeout(b._ended.bind(b,x),w)),g||setTimeout(function(){b._emit("play",x._id),b._loadQueue()},0)};t.state==="running"&&t.ctx.state!=="interrupted"?R():(b._playLock=!0,b.once("resume",R),b._clearTimer(x._id))}else{var F=function(){N.currentTime=E,N.muted=x._muted||b._muted||t._muted||N.muted,N.volume=x._volume*t.volume(),N.playbackRate=x._rate;try{var M=N.play();if(M&&typeof Promise<"u"&&(M instanceof Promise||typeof M.then=="function")?(b._playLock=!0,I(),M.then(function(){b._playLock=!1,N._unlocked=!0,g?b._loadQueue():b._emit("play",x._id)}).catch(function(){b._playLock=!1,b._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||(b._playLock=!1,I(),b._emit("play",x._id)),N.playbackRate=x._rate,N.paused){b._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}u!=="__default"||x._loop?b._endTimers[x._id]=setTimeout(b._ended.bind(b,x),w):(b._endTimers[x._id]=function(){b._ended(x),N.removeEventListener("ended",b._endTimers[x._id],!1)},N.addEventListener("ended",b._endTimers[x._id],!1))}catch(G){b._emit("playerror",x._id,G)}};N.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(N.src=b._src,N.load());var B=window&&window.ejecta||!N.readyState&&t._navigator.isCocoonJS;if(N.readyState>=3||B)F();else{b._playLock=!0,b._state="loading";var k=function(){b._state="loaded",F(),N.removeEventListener(t._canPlayEvent,k,!1)};N.addEventListener(t._canPlayEvent,k,!1),b._clearTimer(x._id)}}return x._id},pause:function(u){var g=this;if(g._state!=="loaded"||g._playLock)return g._queue.push({event:"pause",action:function(){g.pause(u)}}),g;for(var b=g._getSoundIds(u),y=0;y"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(u,g){var b=this;if(b._state!=="loaded"||b._playLock)return b._queue.push({event:"stop",action:function(){b.stop(u)}}),b;for(var y=b._getSoundIds(u),S=0;S"u"?v._node.bufferSource.noteOff(0):v._node.bufferSource.stop(0),b._cleanBuffer(v._node)):(!isNaN(v._node.duration)||v._node.duration===1/0)&&(v._node.currentTime=v._start||0,v._node.pause(),v._node.duration===1/0&&b._clearSound(v._node))),g||b._emit("stop",v._id))}return b},mute:function(u,g){var b=this;if(b._state!=="loaded"||b._playLock)return b._queue.push({event:"mute",action:function(){b.mute(u,g)}}),b;if(typeof g>"u")if(typeof u=="boolean")b._muted=u;else return b._muted;for(var y=b._getSoundIds(g),S=0;S"u"){var S=u._getSoundIds(),v=S.indexOf(g[0]);v>=0?y=parseInt(g[0],10):b=parseFloat(g[0])}else g.length>=2&&(b=parseFloat(g[0]),y=parseInt(g[1],10));var x;if(typeof b<"u"&&b>=0&&b<=1){if(u._state!=="loaded"||u._playLock)return u._queue.push({event:"volume",action:function(){u.volume.apply(u,g)}}),u;typeof y>"u"&&(u._volume=b),y=u._getSoundIds(y);for(var A=0;A"u")}}return S},_startFadeInterval:function(u,g,b,y,S,v){var x=this,A=g,E=b-g,_=Math.abs(E/.01),w=Math.max(4,_>0?y/_:y),C=Date.now();u._fadeTo=b,u._interval=setInterval(function(){var P=(Date.now()-C)/y;C=Date.now(),A+=E*P,A=Math.round(A*100)/100,E<0?A=Math.max(b,A):A=Math.min(b,A),x._webAudio?u._volume=A:x.volume(A,u._id,!0),v&&(x._volume=A),(bg&&A>=b)&&(clearInterval(u._interval),u._interval=null,u._fadeTo=null,x.volume(b,u._id),x._emit("fade",u._id))},w)},_stopFade:function(u){var g=this,b=g._soundById(u);return b&&b._interval&&(g._webAudio&&b._node.gain.cancelScheduledValues(t.ctx.currentTime),clearInterval(b._interval),b._interval=null,g.volume(b._fadeTo,u),b._fadeTo=null,g._emit("fade",u)),g},loop:function(){var u=this,g=arguments,b,y,S;if(g.length===0)return u._loop;if(g.length===1)if(typeof g[0]=="boolean")b=g[0],u._loop=b;else return S=u._soundById(parseInt(g[0],10)),S?S._loop:!1;else g.length===2&&(b=g[0],y=parseInt(g[1],10));for(var v=u._getSoundIds(y),x=0;x=0?y=parseInt(g[0],10):b=parseFloat(g[0])}else g.length===2&&(b=parseFloat(g[0]),y=parseInt(g[1],10));var x;if(typeof b=="number"){if(u._state!=="loaded"||u._playLock)return u._queue.push({event:"rate",action:function(){u.rate.apply(u,g)}}),u;typeof y>"u"&&(u._rate=b),y=u._getSoundIds(y);for(var A=0;A=0?y=parseInt(g[0],10):u._sounds.length&&(y=u._sounds[0]._id,b=parseFloat(g[0]))}else g.length===2&&(b=parseFloat(g[0]),y=parseInt(g[1],10));if(typeof y>"u")return 0;if(typeof b=="number"&&(u._state!=="loaded"||u._playLock))return u._queue.push({event:"seek",action:function(){u.seek.apply(u,g)}}),u;var x=u._soundById(y);if(x)if(typeof b=="number"&&b>=0){var A=u.playing(y);A&&u.pause(y,!0),x._seek=b,x._ended=!1,u._clearTimer(y),!u._webAudio&&x._node&&!isNaN(x._node.duration)&&(x._node.currentTime=b);var E=function(){A&&u.play(y,!0),u._emit("seek",y)};if(A&&!u._webAudio){var _=function(){u._playLock?setTimeout(_,0):E()};setTimeout(_,0)}else E()}else if(u._webAudio){var w=u.playing(y)?t.ctx.currentTime-x._playStart:0,C=x._rateSeek?x._rateSeek-x._seek:0;return x._seek+(C+w*Math.abs(x._rate))}else return x._node.currentTime;return u},playing:function(u){var g=this;if(typeof u=="number"){var b=g._soundById(u);return b?!b._paused:!1}for(var y=0;y=0&&t._howls.splice(y,1);var S=!0;for(b=0;b=0){S=!1;break}return o&&S&&delete o[u._src],t.noAudio=!1,u._state="unloaded",u._sounds=[],u=null,null},on:function(u,g,b,y){var S=this,v=S["_on"+u];return typeof g=="function"&&v.push(y?{id:b,fn:g,once:y}:{id:b,fn:g}),S},off:function(u,g,b){var y=this,S=y["_on"+u],v=0;if(typeof g=="number"&&(b=g,g=null),g||b)for(v=0;v=0;v--)(!S[v].id||S[v].id===g||u==="load")&&(setTimeout(function(x){x.call(this,g,b)}.bind(y,S[v].fn),0),S[v].once&&y.off(u,S[v].fn,S[v].id));return y._loadQueue(u),y},_loadQueue:function(u){var g=this;if(g._queue.length>0){var b=g._queue[0];b.event===u&&(g._queue.shift(),g._loadQueue()),u||b.action()}return g},_ended:function(u){var g=this,b=u._sprite;if(!g._webAudio&&u._node&&!u._node.paused&&!u._node.ended&&u._node.currentTime=0;y--){if(b<=g)return;u._sounds[y]._ended&&(u._webAudio&&u._sounds[y]._node&&u._sounds[y]._node.disconnect(0),u._sounds.splice(y,1),b--)}}},_getSoundIds:function(u){var g=this;if(typeof u>"u"){for(var b=[],y=0;y=0;if(t._scratchBuffer&&u.bufferSource&&(u.bufferSource.onended=null,u.bufferSource.disconnect(0),b))try{u.bufferSource.buffer=t._scratchBuffer}catch(y){}return u.bufferSource=null,g},_clearSound:function(u){var g=/MSIE |Trident\//.test(t._navigator&&t._navigator.userAgent);g||(u.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var r=function(u){this._parent=u,this.init()};r.prototype={init:function(){var u=this,g=u._parent;return u._muted=g._muted,u._loop=g._loop,u._volume=g._volume,u._rate=g._rate,u._seek=0,u._paused=!0,u._ended=!0,u._sprite="__default",u._id=++t._counter,g._sounds.push(u),u.create(),u},create:function(){var u=this,g=u._parent,b=t._muted||u._muted||u._parent._muted?0:u._volume;return g._webAudio?(u._node=typeof t.ctx.createGain>"u"?t.ctx.createGainNode():t.ctx.createGain(),u._node.gain.setValueAtTime(b,t.ctx.currentTime),u._node.paused=!0,u._node.connect(t.masterGain)):t.noAudio||(u._node=t._obtainHtml5Audio(),u._errorFn=u._errorListener.bind(u),u._node.addEventListener("error",u._errorFn,!1),u._loadFn=u._loadListener.bind(u),u._node.addEventListener(t._canPlayEvent,u._loadFn,!1),u._endFn=u._endListener.bind(u),u._node.addEventListener("ended",u._endFn,!1),u._node.src=g._src,u._node.preload=g._preload===!0?"auto":g._preload,u._node.volume=b*t.volume(),u._node.load()),u},reset:function(){var u=this,g=u._parent;return u._muted=g._muted,u._loop=g._loop,u._volume=g._volume,u._rate=g._rate,u._seek=0,u._rateSeek=0,u._paused=!0,u._ended=!0,u._sprite="__default",u._id=++t._counter,u},_errorListener:function(){var u=this;u._parent._emit("loaderror",u._id,u._node.error?u._node.error.code:0),u._node.removeEventListener("error",u._errorFn,!1)},_loadListener:function(){var u=this,g=u._parent;g._duration=Math.ceil(u._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()),u._node.removeEventListener(t._canPlayEvent,u._loadFn,!1)},_endListener:function(){var u=this,g=u._parent;g._duration===1/0&&(g._duration=Math.ceil(u._node.duration*10)/10,g._sprite.__default[1]===1/0&&(g._sprite.__default[1]=g._duration*1e3),g._ended(u)),u._node.removeEventListener("ended",u._endFn,!1)}};var o={},a=function(u){var g=u._src;if(o[g]){u._duration=o[g].duration,d(u);return}if(/^data:[^;]+;base64,/.test(g)){for(var b=atob(g.split(",")[1]),y=new Uint8Array(b.length),S=0;S0?(o[g._src]=S,d(g,S)):b()};typeof Promise<"u"&&t.ctx.decodeAudioData.length===1?t.ctx.decodeAudioData(u).then(y).catch(b):t.ctx.decodeAudioData(u,y,b)},d=function(u,g){g&&!u._duration&&(u._duration=g.duration),Object.keys(u._sprite).length===0&&(u._sprite={__default:[0,u._duration*1e3]}),u._state!=="loaded"&&(u._state="loaded",u._emit("load"),u._loadQueue())},m=function(){if(t.usingWebAudio){try{typeof AudioContext<"u"?t.ctx=new AudioContext:typeof webkitAudioContext<"u"?t.ctx=new webkitAudioContext:t.usingWebAudio=!1}catch(S){t.usingWebAudio=!1}t.ctx||(t.usingWebAudio=!1);var u=/iP(hone|od|ad)/.test(t._navigator&&t._navigator.platform),g=t._navigator&&t._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),b=g?parseInt(g[1],10):null;if(u&&b&&b<9){var y=/safari/.test(t._navigator&&t._navigator.userAgent.toLowerCase());t._navigator&&!y&&(t.usingWebAudio=!1)}t.usingWebAudio&&(t.masterGain=typeof t.ctx.createGain>"u"?t.ctx.createGainNode():t.ctx.createGain(),t.masterGain.gain.setValueAtTime(t._muted?0:t._volume,t.ctx.currentTime),t.masterGain.connect(t.ctx.destination)),t._setup()}};i.Howler=t,i.Howl=s,typeof commonjsGlobal<"u"?(commonjsGlobal.HowlerGlobal=e,commonjsGlobal.Howler=t,commonjsGlobal.Howl=s,commonjsGlobal.Sound=r):typeof window<"u"&&(window.HowlerGlobal=e,window.Howler=t,window.Howl=s,window.Sound=r)})();/*! * 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(t){var s=this;if(!s.ctx||!s.ctx.listener)return s;for(var r=s._howls.length-1;r>=0;r--)s._howls[r].stereo(t);return s},HowlerGlobal.prototype.pos=function(t,s,r){var o=this;if(!o.ctx||!o.ctx.listener)return o;if(s=typeof s!="number"?o._pos[1]:s,r=typeof r!="number"?o._pos[2]:r,typeof t=="number")o._pos=[t,s,r],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(t,s,r,o,a,l){var c=this;if(!c.ctx||!c.ctx.listener)return c;var d=c._orientation;if(s=typeof s!="number"?d[1]:s,r=typeof r!="number"?d[2]:r,o=typeof o!="number"?d[3]:o,a=typeof a!="number"?d[4]:a,l=typeof l!="number"?d[5]:l,typeof t=="number")c._orientation=[t,s,r,o,a,l],typeof c.ctx.listener.forwardX<"u"?(c.ctx.listener.forwardX.setTargetAtTime(t,Howler.ctx.currentTime,.1),c.ctx.listener.forwardY.setTargetAtTime(s,Howler.ctx.currentTime,.1),c.ctx.listener.forwardZ.setTargetAtTime(r,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(t,s,r,o,a,l);else return d;return c},Howl.prototype.init=function(t){return function(s){var r=this;return r._orientation=s.orientation||[1,0,0],r._stereo=s.stereo||null,r._pos=s.pos||null,r._pannerAttr={coneInnerAngle:typeof s.coneInnerAngle<"u"?s.coneInnerAngle:360,coneOuterAngle:typeof s.coneOuterAngle<"u"?s.coneOuterAngle:360,coneOuterGain:typeof s.coneOuterGain<"u"?s.coneOuterGain:0,distanceModel:typeof s.distanceModel<"u"?s.distanceModel:"inverse",maxDistance:typeof s.maxDistance<"u"?s.maxDistance:1e4,panningModel:typeof s.panningModel<"u"?s.panningModel:"HRTF",refDistance:typeof s.refDistance<"u"?s.refDistance:1,rolloffFactor:typeof s.rolloffFactor<"u"?s.rolloffFactor:1},r._onstereo=s.onstereo?[{fn:s.onstereo}]:[],r._onpos=s.onpos?[{fn:s.onpos}]:[],r._onorientation=s.onorientation?[{fn:s.onorientation}]:[],t.call(this,s)}}(Howl.prototype.init),Howl.prototype.stereo=function(t,s){var r=this;if(!r._webAudio)return r;if(r._state!=="loaded")return r._queue.push({event:"stereo",action:function(){r.stereo(t,s)}}),r;var o=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof s>"u")if(typeof t=="number")r._stereo=t,r._pos=[t,0,0];else return r._stereo;for(var a=r._getSoundIds(s),l=0;l"u")if(typeof t=="number")a._pos=[t,s,r];else return a._pos;for(var l=a._getSoundIds(o),c=0;c"u")if(typeof t=="number")a._orientation=[t,s,r];else return a._orientation;for(var l=a._getSoundIds(o),c=0;c"u"&&(r.pannerAttr||(r.pannerAttr={coneInnerAngle:r.coneInnerAngle,coneOuterAngle:r.coneOuterAngle,coneOuterGain:r.coneOuterGain,distanceModel:r.distanceModel,maxDistance:r.maxDistance,refDistance:r.refDistance,rolloffFactor:r.rolloffFactor,panningModel:r.panningModel}),t._pannerAttr={coneInnerAngle:typeof r.pannerAttr.coneInnerAngle<"u"?r.pannerAttr.coneInnerAngle:t._coneInnerAngle,coneOuterAngle:typeof r.pannerAttr.coneOuterAngle<"u"?r.pannerAttr.coneOuterAngle:t._coneOuterAngle,coneOuterGain:typeof r.pannerAttr.coneOuterGain<"u"?r.pannerAttr.coneOuterGain:t._coneOuterGain,distanceModel:typeof r.pannerAttr.distanceModel<"u"?r.pannerAttr.distanceModel:t._distanceModel,maxDistance:typeof r.pannerAttr.maxDistance<"u"?r.pannerAttr.maxDistance:t._maxDistance,refDistance:typeof r.pannerAttr.refDistance<"u"?r.pannerAttr.refDistance:t._refDistance,rolloffFactor:typeof r.pannerAttr.rolloffFactor<"u"?r.pannerAttr.rolloffFactor:t._rolloffFactor,panningModel:typeof r.pannerAttr.panningModel<"u"?r.pannerAttr.panningModel:t._panningModel});else return a=t._soundById(parseInt(s[0],10)),a?a._pannerAttr:t._pannerAttr;else s.length===2&&(r=s[0],o=parseInt(s[1],10));for(var l=t._getSoundIds(o),c=0;c{if(!metronomeData.lineShow)return;const i=document.querySelector("#cursorImg-0");i&&(metronomeData.activeMetro.isRestFlag?i.classList.remove("lineHide"):i.classList.add("lineHide"))};watch(()=>metronomeData.lineShow,()=>{const i=document.querySelector("#cursorImg-0");if(i){const e=state$1.times[state$1.activeNoteIndex];metronomeData.lineShow&&!e.isRestFlag?i.classList.add("lineHide"):i.classList.remove("lineHide")}});class Metronome{constructor(e){lt(this,"playType","tick");lt(this,"source",null);lt(this,"source1",null);lt(this,"source2",null);lt(this,"sound",e=>{e=setCurrentTime(e);let t=-1,s=-1;for(let r=0;r=o)t=r,s=o;else break}if(t>-1&&metronomeData.activeIndex!==t){metronomeData.activeIndex=t,metronomeData.activeMetro=this.getStep(s),this.playAudio(),metronomeData.isClick=!1,toggleLine();return}metronomeData.isClick=!1});lt(this,"playAudio",()=>{var e;metronomeData.initPlayerState&&(this.source=((e=metronomeData.activeMetro)==null?void 0:e.index)===0?this.source1:this.source2,this.source.volume(metronomeData.disable?0:.4),this.source.play())});lt(this,"loadAudio1",()=>new howler.Howl({src:tockAndTick.tick}));lt(this,"loadAudio2",()=>new howler.Howl({src:tockAndTick.tock}))}init(e){this.calculation(e),metronomeData.activeList=[]}initPlayer(){this.source1||(this.source1=this.loadAudio1()),this.source2||(this.source2=this.loadAudio2()),metronomeData.initPlayerState=!0}selectPlay(){}getStep(e){for(let t=0;to.time===e);if(r)return r}return{}}calculation(e){var a,l,c,d,m,u,g,b,y,S,v,x,A,E;const t=[];let s=-1;for(let _=0;_-1&&C!=s){const I={measureNumberXML:C,measureNumberIndex:P,numerator:((g=(u=(m=w==null?void 0:w.noteElement)==null?void 0:m.sourceMeasure)==null?void 0:u.ActiveTimeSignature)==null?void 0:g.numerator)||0,start:w.measures[0].time,end:w.measures[w.measures.length-1].endtime,time:w.measures[w.measures.length-1].endtime-w.measures[0].time,stave_x:((x=(v=(S=(y=(b=w==null?void 0:w.noteElement)==null?void 0:b.sourceMeasure)==null?void 0:y.verticalMeasureList)==null?void 0:S[0])==null?void 0:v.stave)==null?void 0:x.x)||0,end_x:((A=w==null?void 0:w.stave)==null?void 0:A.end_x)||0||0,stepList:[],svgs:[],isRestFlag:w.isRestFlag};if([121].includes(state$1.subjectId)){const N=e.filter(R=>{var F,B;return((B=(F=R==null?void 0:R.noteElement)==null?void 0:F.sourceMeasure)==null?void 0:B.measureListIndex)==P});w.measures=N,I.start=w.measures[0].time,I.end=w.measures[w.measures.length-1].endtime,I.time=w.measures[w.measures.length-1].endtime-w.measures[0].time;try{const R=w.noteElement.sourceMeasure.verticalMeasureList.reduce((B,k)=>(B.push(...k.vfVoices[1].tickables),B),[]),F=[];I.svgs=R.map(B=>{const k=B.getBoundingBox().x;if(!F.includes(k)&&B.duration!=="w")return F.push(k),B._start_x=k,B}).filter(Boolean).sort((B,k)=>B._start_x-k._start_x)}catch(R){console.log(R)}I.stepList=calculateMutilpleMetroStep(w.measures,I)}else I.stepList=calculateMetroStep(w.measures,I);t.push(I),s=C}}let r=[];const o=[];try{for(let _=0;_-1?`${B} + ${I}%`:`${B}px + ${I}%`:`${I}%`,w.stepList[N]=F}o[_].push({index:N,time:R,left:(F==null?void 0:F.indexOf("%"))>-1?`calc(${F})`:F,measureNumberXML:w.measureNumberXML,isRestFlag:w.isRestFlag})}}}catch(_){console.log(_)}metronomeData.metroList=r,metronomeData.metroMeasure=o,metronomeData.activeMetro=((E=o[0])==null?void 0:E[0])||{}}}function calculateMetroStep(i,e){var l,c,d,m,u,g,b,y,S,v,x,A,E,_,w,C,P,I,N,R,F,B,k,M,G,ee,$,re,ie,de,Q,H,ue,ne,W,oe,he,le,me,Ae,be,z,J,T,q;const s=i.reduce((Y,O)=>(Y+=O._noteLength,Y),0)/e.numerator;if(i.length===1){const Y=i[0].svgElement;if(Y&&!Y.isRest()){const O=((u=(m=(d=(c=(l=Y==null?void 0:Y.attrs)==null?void 0:l.el)==null?void 0:c.parentElement)==null?void 0:d.parentElement)==null?void 0:m.getBoundingClientRect)==null?void 0:u.call(m))||{x:0,right:0};let V=((y=(b=(g=Y==null?void 0:Y.attrs)==null?void 0:g.el)==null?void 0:b.getBoundingClientRect)==null?void 0:y.call(b))||{x:0},U=Math.abs(O.right-V.x)/e.numerator,se=[];for(let te=0;te=1){r-=s;const se=((B=(F=(R=(N=(I=(P=O==null?void 0:O.svgElement)==null?void 0:P.attrs)==null?void 0:I.el)==null?void 0:N.parentElement)==null?void 0:R.parentElement)==null?void 0:F.getBoundingClientRect)==null?void 0:B.call(F))||{x:0};if(o.length>0){let fe=(($=(ee=(G=(M=(k=o[0])==null?void 0:k.svgElement)==null?void 0:M.attrs)==null?void 0:G.el)==null?void 0:ee.getBoundingClientRect)==null?void 0:$.call(ee))||{x:0},pe=fe.x-se.x;if(o[0]._noteLength/s>=1){const ye=((H=(Q=(de=(ie=(re=i[o[0].index+1])==null?void 0:re.svgElement)==null?void 0:ie.attrs)==null?void 0:de.el)==null?void 0:Q.getBoundingClientRect)==null?void 0:H.call(Q))||{x:se.right},ve=Math.abs(fe.x-ye.x)/2;pe=fe.x-se.x+ve}a.push(pe)}else{let pe=(((oe=(W=(ne=(ue=O==null?void 0:O.svgElement)==null?void 0:ue.attrs)==null?void 0:ne.el)==null?void 0:W.getBoundingClientRect)==null?void 0:oe.call(W))||{x:0}).x-se.x;a.push(pe)}o=[];let te=((Ae=(me=(le=(he=O==null?void 0:O.svgElement)==null?void 0:he.attrs)==null?void 0:le.el)==null?void 0:me.getBoundingClientRect)==null?void 0:Ae.call(me))||{x:0},K=te.x-se.x,ae=0;if(U>1){const fe=((q=(T=(J=(z=(be=i[Y+1])==null?void 0:be.svgElement)==null?void 0:z.attrs)==null?void 0:J.el)==null?void 0:T.getBoundingClientRect)==null?void 0:q.call(T))||{x:se.right};ae=Math.abs(te.x-fe.x)/U}for(let fe=1;feNumber.EPSILON&&r>0&&o.push(O)}return a=a.reduce((Y,O)=>(Y.includes(O)?Y.push(void 0):Y.push(O),Y),[]),a}function calculateMutilpleMetroStep(i,e){var l,c,d,m,u,g,b,y,S,v,x,A,E,_,w,C,P,I,N;const t=e.time/e.numerator,s=((b=(g=(u=(m=(d=(c=(l=i[0])==null?void 0:l.svgElement)==null?void 0:c.attrs)==null?void 0:d.el)==null?void 0:m.parentElement)==null?void 0:u.parentElement)==null?void 0:g.getBoundingClientRect)==null?void 0:b.call(g))||{x:0};if(i.length===1){const R=e.svgs[0];let F=((v=(S=(y=R==null?void 0:R.attrs)==null?void 0:y.el)==null?void 0:S.getBoundingClientRect)==null?void 0:v.call(S))||{x:0};return R&&!R.isRest()?[F.x-s.x]:[]}let r=0,o=[],a=[];for(let R=0;Rt){r-=t;let G=M.x-s.x;o.length>0&&(k=(w=(_=e.svgs[o[0]._index])==null?void 0:_.attrs)==null?void 0:w.el,M=((C=k==null?void 0:k.getBoundingClientRect)==null?void 0:C.call(k))||{x:0},G=M.x-s.x),a.push(G),o=[]}else o.push(F);if(Math.abs(r-t)<.001){let G=M.x-s.x;o.length>0&&(k=(I=(P=e.svgs[o[0]._index])==null?void 0:P.attrs)==null?void 0:I.el,M=((N=k==null?void 0:k.getBoundingClientRect)==null?void 0:N.call(k))||{x:0},G=M.x-s.x),a.push(G),r=0,o=[]}}return a=a.reduce((R,F)=>(R.includes(F)?R.push(void 0):R.push(F),R),[]),a}function setCurrentTime(i){return browserInfo$1.huawei||browserInfo$1.xiaomi?i+=.125:browserInfo$1.android?i+=.11:browserInfo$1.ios&&(i+=.01),i}var GradualVersion=(i=>(i[i.BASE=0]="BASE",i[i.ENSEMBLE=1]="ENSEMBLE",i))(GradualVersion||{}),context={locks:{},zIndex:2e3,enableRipple:!0};reactive(context);const Context=reactive(context),isString=i=>typeof i=="string",isBoolean=i=>typeof i=="boolean",isNumber=i=>typeof i=="number",isPlainObject=i=>Object.prototype.toString.call(i)==="[object Object]",isFunction$3=i=>typeof i=="function",isArray$1=i=>Array.isArray(i),isURL=i=>i?/^(http)|(\.*\/)/.test(i):!1,toNumber=i=>i==null?0:isString(i)?(i=parseFloat(i),i=Number.isNaN(i)?0:i,i):isBoolean(i)?Number(i):i,inBrowser=()=>typeof window<"u",camelize=i=>i.replace(/-(\w)/g,(e,t)=>t.toUpperCase());function getViewportSize(){var{innerWidth:i,innerHeight:e}=window;return i>e?{vMin:e,vMax:i}:{vMin:i,vMax:e}}var isRem=i=>isString(i)&&i.endsWith("rem"),isPx=i=>isString(i)&&i.endsWith("px")||isNumber(i),isPercent=i=>isString(i)&&i.endsWith("%"),isVw=i=>isString(i)&&i.endsWith("vw"),isVh=i=>isString(i)&&i.endsWith("vh"),isVMin=i=>isString(i)&&i.endsWith("vmin"),isVMax=i=>isString(i)&&i.endsWith("vmax"),isCalc=i=>isString(i)&&i.startsWith("calc("),isVar=i=>isString(i)&&i.startsWith("var("),toPxNum=i=>{if(isNumber(i))return i;if(isPx(i))return+i.replace("px","");if(isVw(i))return+i.replace("vw","")*window.innerWidth/100;if(isVh(i))return+i.replace("vh","")*window.innerHeight/100;if(isRem(i)){var e=+i.replace("rem",""),t=window.getComputedStyle(document.documentElement).fontSize;return e*parseFloat(t)}return isVMin(i)?getViewportSize().vMin:isVMax(i)?getViewportSize().vMax:isString(i)?toNumber(i):0},toSizeUnit=i=>{if(i!=null)return isPercent(i)||isVw(i)||isVh(i)||isRem(i)||isCalc(i)||isVar(i)||isVMin(i)||isVMax(i)?i:toPxNum(i)+"px"},multiplySizeUnit=function(i,e){if(e===void 0&&(e=1),i!=null){var t=toSizeUnit(i),s=t.match(/(vh|%|rem|px|vw)$/)[0];return""+parseFloat(t)*e+s}};function supportTouch(){var i=typeof window<"u";return i&&"ontouchstart"in window}function useMounted(i){let e=!1;onMounted(()=>{i(),nextTick(()=>{e=!0})}),onActivated(()=>{e&&i()})}function useEventListener(i,e,t,s={}){if(!inBrowser())return;const{passive:r=!1,capture:o=!1}=s;let a=!1,l=!1;const c=g=>{if(a||l)return;const b=unref(g);b&&(b.addEventListener(e,t,{passive:r,capture:o}),a=!0)},d=g=>{if(!a||l)return;const b=unref(g);b&&(b.removeEventListener(e,t,{capture:o}),a=!1)};let m;isRef(i)&&(m=watch(()=>i.value,(g,b)=>{d(b),c(g)}));const u=()=>{m==null||m(),d(i),l=!0};return useMounted(()=>{c(i)}),onBeforeUnmount(()=>{d(i)}),onDeactivated(()=>{d(i)}),u}var __rest=globalThis&&globalThis.__rest||function(i,e){var t={};for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&e.indexOf(s)<0&&(t[s]=i[s]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(i);rt.indexOf(a)),parentProvider:o,bindParent:d=>{onMounted(()=>{nextTick().then(()=>{s(a,d)})}),onBeforeUnmount(()=>{nextTick().then(()=>{r(a,d)})})}}}function asyncGeneratorStep$1(i,e,t,s,r,o,a){try{var l=i[o](a),c=l.value}catch(d){t(d);return}l.done?e(c):Promise.resolve(c).then(s,r)}function _asyncToGenerator$1(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var o=i.apply(e,t);function a(c){asyncGeneratorStep$1(o,s,r,a,l,"next",c)}function l(c){asyncGeneratorStep$1(o,s,r,a,l,"throw",c)}a(void 0)})}}function _extends$3(){return _extends$3=Object.assign?Object.assign.bind():function(i){for(var e=1;e(t[s]=i[s],t),{}):i[e]}function mount(i){var e=createApp(i),t=document.createElement("div");return document.body.appendChild(t),{instance:e.mount(t),unmount(){e.unmount(),document.body.removeChild(t)}}}function mountInstance(i,e,t){e===void 0&&(e={}),t===void 0&&(t={});var s={setup(){return()=>h(i,_extends$3({},e,t))}},{unmount:r}=mount(s);return{unmountInstance:r}}function useValidation(){var i=ref(""),e=function(){var r=_asyncToGenerator$1(function*(o,a,l){if(!isArray$1(o)||!o.length)return!0;var c=yield Promise.all(o.map(d=>d(a,l)));return!c.some(d=>d!==!0?(i.value=String(d),!0):!1)});return function(a,l,c){return r.apply(this,arguments)}}(),t=()=>{i.value=""},s=function(){var r=_asyncToGenerator$1(function*(o,a,l,c,d){o.includes(a)&&(yield e(l,c,d))&&(i.value="")});return function(a,l,c,d,m){return r.apply(this,arguments)}}();return{errorMessage:i,validate:e,resetValidation:t,validateWithTrigger:s}}function useRouteListener(i){inBrowser()&&(useEventListener(window,"hashchange",i),useEventListener(window,"popstate",i))}function useTeleport(){var i=ref(!1);return onActivated(()=>{i.value=!1}),onDeactivated(()=>{i.value=!0}),{disabled:i}}function createNamespace(i){var e="var",t=e+"-"+i,s=o=>o?o[0]==="$"?o.replace("$",e):o.startsWith("--")?""+t+o:t+"__"+o:t,r=function(){for(var o=arguments.length,a=new Array(o),l=0;l{if(isArray$1(c)){var[d,m,u=null]=c;return d?m:u}return c})};return{n:s,classes:r}}function call(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),s=1;sr(...t));if(i)return i(...t)}function defineListenerProp(i){return{type:[Function,Array],default:i}}function positionValidator$1(i){return["top","bottom","right","left","center"].includes(i)}var props$4={show:{type:Boolean,default:!1},position:{type:String,default:"center",validator:positionValidator$1},transition:{type:String},overlay:{type:Boolean,default:!0},overlayClass:{type:String},overlayStyle:{type:Object},lockScroll:{type:Boolean,default:!0},closeOnClickOverlay:{type:Boolean,default:!0},defaultStyle:{type:Boolean,default:!0},teleport:{type:String},onOpen:defineListenerProp(),onOpened:defineListenerProp(),onClose:defineListenerProp(),onClosed:defineListenerProp(),onClickOverlay:defineListenerProp(),"onUpdate:show":defineListenerProp(),onRouteChange:defineListenerProp()};function resolveLock(){var i=Object.keys(Context.locks).length;i<=0?document.body.classList.remove("var--lock"):document.body.classList.add("var--lock")}function addLock(i){Context.locks[i]=1,resolveLock()}function releaseLock(i){delete Context.locks[i],resolveLock()}function useLock(i,e){var{uid:t}=getCurrentInstance();e&&watch(e,s=>{s===!1?releaseLock(t):s===!0&&i()===!0&&addLock(t)}),watch(i,s=>{e&&e()===!1||(s===!0?addLock(t):releaseLock(t))}),onBeforeMount(()=>{e&&e()===!1||i()===!0&&addLock(t)}),onUnmounted(()=>{e&&e()===!1||i()===!0&&releaseLock(t)}),onActivated(()=>{e&&e()===!1||i()===!0&&addLock(t)}),onDeactivated(()=>{e&&e()===!1||i()===!0&&releaseLock(t)})}function useZIndex(i,e){var t=ref(Context.zIndex);return watch(i,s=>{s&&(Context.zIndex+=e,t.value=Context.zIndex)},{immediate:!0}),{zIndex:t}}function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(i){for(var e=1;ei.show,3),{disabled:o}=useTeleport(),a=()=>{var{closeOnClickOverlay:m,onClickOverlay:u}=i;call(u),m&&call(i["onUpdate:show"],!1)};useLock(()=>i.show,()=>i.lockScroll),watch(()=>i.show,m=>{call(m?i.onOpen:i.onClose)}),useRouteListener(()=>call(i.onRouteChange));var l=()=>{var{overlayClass:m="",overlayStyle:u}=i;return createVNode("div",{class:classes$3(n$4("overlay"),m),style:_extends$2({zIndex:r.value-1},u),onClick:a},null)},c=()=>createVNode("div",mergeProps({class:classes$3(n$4("content"),n$4("--"+i.position),[i.defaultStyle,n$4("--content-background-color")],[i.defaultStyle,n$4("$-elevation--3")]),style:{zIndex:r.value}},s),[call(t.default)]),d=()=>{var{onOpened:m,onClosed:u,show:g,overlay:b,transition:y,position:S}=i;return createVNode(Transition,{name:n$4("$-fade"),onAfterEnter:m,onAfterLeave:u},{default:()=>[withDirectives(createVNode("div",{class:classes$3(n$4("$--box"),n$4()),style:{zIndex:r.value-2}},[b&&l(),createVNode(Transition,{name:y||n$4("$-pop-"+S)},{default:()=>[g&&c()]})]),[[vShow,g]])]})};return()=>{var{teleport:m}=i;if(m){var u;return createVNode(Teleport,{to:m,disabled:o.value},_isSlot$1(u=d())?u:{default:()=>[u]})}return d()}}});Popup.install=function(i){i.component(Popup.name,Popup)};var props$3={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(i,e,t,s,r,o,a){try{var l=i[o](a),c=l.value}catch(d){t(d);return}l.done?e(c):Promise.resolve(c).then(s,r)}function _asyncToGenerator(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var o=i.apply(e,t);function a(c){asyncGeneratorStep(o,s,r,a,l,"next",c)}function l(c){asyncGeneratorStep(o,s,r,a,l,"throw",c)}a(void 0)})}}var{n:n$3,classes:classes$2}=createNamespace("icon");function __render__$3(i,e){return openBlock(),createBlock(resolveDynamicComponent(i.isURL(i.name)?"img":"i"),{class:normalizeClass(i.classes(i.n(),[i.namespace!==i.n(),i.namespace],i.namespace+"--set",[i.isURL(i.name),i.n("image"),i.namespace+"-"+i.nextName],[i.animateInProgress,i.animationClass==null?i.n("--shrinking"):i.animationClass])),style:normalizeStyle({color:i.color,"transition-duration":i.toNumber(i.transition)+"ms",width:i.isURL(i.name)?i.toSizeUnit(i.size):null,height:i.isURL(i.name)?i.toSizeUnit(i.size):null,fontSize:i.toSizeUnit(i.size)}),src:i.isURL(i.name)?i.nextName:null,onClick:i.onClick},null,8,["class","style","src","onClick"])}var __sfc__$3=defineComponent({name:"VarIcon",props:props$3,setup(i){var e=ref(""),t=ref(!1),s=function(){var r=_asyncToGenerator(function*(o,a){var{transition:l}=i;if(a==null||toNumber(l)===0){e.value=o;return}t.value=!0,yield nextTick(),setTimeout(()=>{a!=null&&(e.value=o),t.value=!1},toNumber(l))});return function(a,l){return r.apply(this,arguments)}}();return watch(()=>i.name,s,{immediate:!0}),{n:n$3,classes:classes$2,nextName:e,animateInProgress:t,isURL,toNumber,toSizeUnit}}});__sfc__$3.render=__render__$3;const Icon=__sfc__$3;Icon.install=function(i){i.component(Icon.name,Icon)};function typeValidator$1(i){return["circle","wave","cube","rect","disappear"].includes(i)}function sizeValidator(i){return["normal","mini","small","large"].includes(i)}var props$2={type:{type:String,default:"circle",validator:typeValidator$1},radius:{type:[String,Number]},size:{type:String,default:"normal",validator:sizeValidator},color:{type:String},description:{type:String},loading:{type:Boolean,default:!1}},{n:n$2,classes:classes$1}=createNamespace("loading"),_withScopeId=i=>(pushScopeId(""),i=i(),popScopeId(),i),_hoisted_1=_withScopeId(()=>createBaseVNode("svg",{viewBox:"25 25 50 50"},[createBaseVNode("circle",{cx:"50",cy:"50",r:"20",fill:"none"})],-1)),_hoisted_2=[_hoisted_1];function __render__$2(i,e){return openBlock(),createElementBlock("div",{class:normalizeClass(i.n())},[i.$slots.default?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(i.classes(i.n("content"),[i.loading,i.n("content--active")]))},[renderSlot(i.$slots,"default"),i.loading?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(i.n("content-mask"))},null,2)):createCommentVNode("v-if",!0)],2)):createCommentVNode("v-if",!0),i.isShow?(openBlock(),createElementBlock("div",{key:1,class:normalizeClass(i.classes(i.n("$--box"),i.n("body"),[i.$slots.default,i.n("inside")]))},[i.type==="circle"?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(i.n("circle"))},[createBaseVNode("span",{class:normalizeClass(i.classes(i.n("circle-block"),i.n("circle-block--"+i.size))),style:normalizeStyle({width:i.multiplySizeUnit(i.radius,2),height:i.multiplySizeUnit(i.radius,2),color:i.color})},_hoisted_2,6)],2)):createCommentVNode("v-if",!0),(openBlock(!0),createElementBlock(Fragment,null,renderList(i.loadingTypeDict,(t,s)=>(openBlock(),createElementBlock(Fragment,{key:s},[i.type===s?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(i.classes(i.n(s),i.n(s+"--"+i.size)))},[(openBlock(!0),createElementBlock(Fragment,null,renderList(t,r=>(openBlock(),createElementBlock("div",{key:r+s,style:normalizeStyle({backgroundColor:i.color}),class:normalizeClass(i.classes(i.n(s+"-item"),i.n(s+"-item--"+i.size)))},null,6))),128))],2)):createCommentVNode("v-if",!0)],64))),128)),i.$slots.description||i.description?(openBlock(),createElementBlock("div",{key:1,class:normalizeClass(i.classes(i.n("description"),i.n("description--"+i.size))),style:normalizeStyle({color:i.color})},[renderSlot(i.$slots,"description",{},()=>[createTextVNode(toDisplayString(i.description),1)])],6)):createCommentVNode("v-if",!0)],2)):createCommentVNode("v-if",!0)],2)}var __sfc__$2=defineComponent({name:"VarLoading",props:props$2,setup(i,e){var{slots:t}=e,s={wave:5,cube:4,rect:8,disappear:3},r=computed(()=>call(t.default)?i.loading:!0);return{n:n$2,classes:classes$1,multiplySizeUnit,loadingTypeDict:s,isShow:r}}});__sfc__$2.render=__render__$2;const Loading=__sfc__$2;Loading.install=function(i){i.component(Loading.name,Loading)};function _extends$1(){return _extends$1=Object.assign?Object.assign.bind():function(i){for(var e=1;e[createTextVNode(toDisplayString(i.content),1)])],2),createBaseVNode("div",{class:normalizeClass(i.n("action"))},[i.iconName?(openBlock(),createBlock(t,{key:0,name:i.iconName},null,8,["name"])):createCommentVNode("v-if",!0),i.type==="loading"?(openBlock(),createBlock(s,{key:1,type:i.loadingType,size:i.loadingSize,color:i.loadingColor,radius:i.loadingRadius},null,8,["type","size","color","radius"])):createCommentVNode("v-if",!0),renderSlot(i.$slots,"action")],2)],6)],6)),[[vShow,i.show]])}var __sfc__$1=defineComponent({name:"VarSnackbarCore",components:{VarLoading:Loading,VarIcon:Icon},props:props$1,setup(i){var e=ref(null),{zIndex:t}=useZIndex(()=>i.show,1);useLock(()=>i.show,()=>i.lockScroll);var s=computed(()=>i.type==="loading"||i.forbidClick),r=computed(()=>i.type?ICON_TYPE_DICT[i.type]:""),o=()=>{e.value=setTimeout(()=>{i.type!=="loading"&&call(i["onUpdate:show"],!1)},i.duration)};return watch(()=>i.show,a=>{a?(call(i.onOpen),o()):a===!1&&(clearTimeout(e.value),call(i.onClose))}),watch(()=>i._update,()=>{clearTimeout(e.value),o()}),useMounted(()=>{i.show&&(call(i.onOpen),o())}),{SNACKBAR_TYPE,n:n$1,classes,zIndex:t,iconName:r,isForbidClick:s}}});__sfc__$1.render=__render__$1;const VarSnackbarCore=__sfc__$1;var{n}=createNamespace("snackbar");function __render__(i,e){var t=resolveComponent("var-snackbar-core");return openBlock(),createBlock(Teleport,{to:i.teleport,disabled:i.disabled},[createVNode(Transition,{name:i.n()+"-fade",onAfterEnter:i.onOpened,onAfterLeave:i.onClosed},{default:withCtx(()=>[createVNode(t,mergeProps(i.$props,{class:i.n("transition")}),{action:withCtx(()=>[renderSlot(i.$slots,"action")]),default:withCtx(()=>[renderSlot(i.$slots,"default",{},()=>[createTextVNode(toDisplayString(i.content),1)])]),_:3},16,["class"])]),_:3},8,["name","onAfterEnter","onAfterLeave"])],8,["to","disabled"])}var __sfc__=defineComponent({name:"VarSnackbar",components:{VarSnackbarCore},props:props$1,setup(){var{disabled:i}=useTeleport();return{n,disabled:i}}});__sfc__.render=__render__;const VarSnackbar=__sfc__;function _extends(){return _extends=Object.assign?Object.assign.bind():function(i){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 i=uniqSnackbarOptions.map(e=>{var{id:t,reactiveSnackOptions:s,_update:r}=e,o=document.querySelector(".var-transition-group");s.forbidClick||s.type==="loading"?o.classList.add("var-pointer-auto"):o.classList.remove("var-pointer-auto"),isAllowMultiple&&(s.position="top");var a=isAllowMultiple?"relative":"absolute",l=_extends({position:a},getTop(s.position));return createVNode(VarSnackbarCore,mergeProps(s,{key:t,style:l,"data-id":t,_update:r,show:s.show,"onUpdate:show":c=>s.show=c}),null)});return createVNode(TransitionGroup,mergeProps(transitionGroupProps,{style:{zIndex:Context.zIndex},onAfterEnter:opened,onAfterLeave:removeUniqOption}),_isSlot(i)?i:{default:()=>[i]})}}},Snackbar=function(i){var e=normalizeOptions(i),t=reactive(_extends({},defaultOptions,e));t.show=!0,isMount||(isMount=!0,unmount=mountInstance(TransitionGroupHost).unmountInstance);var{length:s}=uniqSnackbarOptions,r={id:sid++,reactiveSnackOptions:t};if(s===0||isAllowMultiple)addUniqOption(r);else{var o="update-"+sid;updateUniqOption(t,o)}return{clear(){!isAllowMultiple&&uniqSnackbarOptions.length?uniqSnackbarOptions[0].reactiveSnackOptions.show=!1:t.show=!1}}};SNACKBAR_TYPE.forEach(i=>{Snackbar[i]=e=>(isPlainObject(e)?e.type=i:e={content:e,type:i},Snackbar(e))});Snackbar.install=function(i){i.component(VarSnackbar.name,VarSnackbar)};Snackbar.allowMultiple=function(i){i===void 0&&(i=!1),i!==isAllowMultiple&&(uniqSnackbarOptions.forEach(e=>{e.reactiveSnackOptions.show=!1}),isAllowMultiple=i)};Snackbar.clear=function(){uniqSnackbarOptions.forEach(i=>{i.reactiveSnackOptions.show=!1})};Snackbar.setDefaultOptions=function(i){defaultOptions=i};Snackbar.resetDefaultOptions=function(){defaultOptions=defaultOptionsValue};Snackbar.Component=VarSnackbar;function opened(i){var e=i.getAttribute("data-id"),t=uniqSnackbarOptions.find(s=>s.id===toNumber(e));t&&call(t.reactiveSnackOptions.onOpened)}function removeUniqOption(i){i.parentElement&&i.parentElement.classList.remove("var-pointer-auto");var e=i.getAttribute("data-id"),t=uniqSnackbarOptions.find(r=>r.id===toNumber(e));t&&(t.animationEnd=!0,call(t.reactiveSnackOptions.onClosed));var s=uniqSnackbarOptions.every(r=>r.animationEnd);s&&(call(unmount),uniqSnackbarOptions=reactive([]),isMount=!1)}function addUniqOption(i){uniqSnackbarOptions.push(i)}function normalizeOptions(i){return i===void 0&&(i={}),isString(i)?{content:i}:i}function updateUniqOption(i,e){var[t]=uniqSnackbarOptions;t.reactiveSnackOptions=_extends({},t.reactiveSnackOptions,i),t._update=e}function getTop(i){return i===void 0&&(i="top"),i==="bottom"?{[i]:"5%"}:{top:i==="top"?"5%":"45%"}}VarSnackbar.install=function(i){i.component(VarSnackbar.name,VarSnackbar)};const Snackbar$1=Snackbar,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=i=>{if(!i&&typeof i!="number")return{};let e=0;return i>20&&i<=40?e=1:i>40&&i<=60?e=2:i>60&&i<=80?e=3:i>80&&(e=4),{...icons[e],leve:e}},getLeveByScoreMeasure=i=>{if(!i&&typeof i!="number")return{};let e=0;return i>=40&&i<70?e=1:i>=70&&i<90?e=2:i>=90&&(e=3),e},getEarphone=()=>storeData.isApp?promisefiyPostMessage({api:"isWiredHeadsetOn"}):Promise.resolve({}),isSpecialShapedScreen=()=>storeData.isApp?promisefiyPostMessage({api:"isSpecialShapedScreen"}):Promise.resolve({}),startSoundCheck=()=>{postMessage({api:"startSoundCheck"})},sendResult=i=>{listenerMessage("sendResult",i)},removeResult=i=>{removeListenerMessage("sendResult",i)},endSoundCheck=()=>{postMessage({api:"endSoundCheck"})},startEvaluating=i=>storeData.isApp?promisefiyPostMessage({api:"startEvaluating",content:i}):Promise.resolve({}),endEvaluating=i=>storeData.isApp?promisefiyPostMessage({api:"endEvaluating",content:i}):Promise.resolve({}),cancelEvaluating=()=>{postMessage({api:"cancelEvaluating"})},startRecording=()=>storeData.isApp?promisefiyPostMessage({api:"startRecording"}):Promise.resolve({}),api_proxyServiceMessage=i=>storeData.isApp?promisefiyPostMessage({api:"proxyServiceMessage",content:i}):Promise.resolve({}),api_videoUpdate=()=>storeData.isApp?promisefiyPostMessage({api:"videoUpdate"}):Promise.resolve({}),api_shareAchievements=i=>storeData.isApp?promisefiyPostMessage({api:"shareAchievements",content:i}):Promise.resolve({}),api_openWebView=i=>storeData.isApp?promisefiyPostMessage({api:"openWebView",content:i}):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=i=>storeData.isApp?promisefiyPostMessage({api:"cloudToggleFollow",content:{state:i}}):Promise.resolve({}),api_cloudFollowTime=(i,e=!0)=>{e?listenerMessage("cloudFollowTime",i):removeListenerMessage("cloudFollowTime",i)},api_back=()=>{postMessage({api:"back"})},api_cloudLoading=()=>{postMessage({api:"cloudLoading",content:{show:!1,type:"fullscreen"}})},api_cloudDestroy=()=>{postMessage({api:"cloudDestroy"})},api_setEventTracking=()=>{postMessage({api:"setEventTracking",content:{type:"klx_xiaokuAI"}})},api_savePicture=i=>storeData.isApp?promisefiyPostMessage({api:"savePicture",content:i}):Promise.resolve({}),evaluatingData=reactive({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}),handleStartEvaluat=()=>{state$1.modeType==="evaluating"?handleCancelEvaluat():handleStopPlay(),state$1.modeType=state$1.modeType==="evaluating"?"practise":"evaluating",state$1.modeType!=="evaluating"&&(evaluatingData.rendered=!1)},sendEvaluatingOffsetTime=i=>{const t=Date.now()-evaluatingData.backtime-i*1e3;console.log("真正播放延迟",t),setTimeout(async()=>{await api_proxyServiceMessage({header:{commond:"audioPlayStart",type:"SOUND_COMPARE"},body:{offsetTime:t<0?0:t}}),evaluatingData.backtime=0},220)},checkUseEarphone=async()=>{var e;const i=await getEarphone();return((e=i==null?void 0:i.content)==null?void 0:e.checkIsWired)||!1},handleSoundEffect=i=>{if(i!=null&&i.content){const{header:e,body:t}=i.content;e.commond==="checking"&&(evaluatingData.soundEffectFrequency=t.frequency)}},handleStartSoundCheck=()=>{sendResult(handleSoundEffect),startSoundCheck()},handleEndSoundCheck=()=>{endSoundCheck(),removeResult(handleSoundEffect)},connectWebsocket=async i=>{evaluatingData.websocketState=!1;const e=await startEvaluating(i);(e==null?void 0:e.api)==="startEvaluating"?evaluatingData.websocketState=!0:Snackbar$1.error("请在APP端进行评测")},handlePerformDetection=async()=>{if(evaluatingData.checkEnd=!1,evaluatingData.checkStep===0){const i=await checkUseEarphone();evaluatingData.checkStep=1,i?handlePerformDetection():evaluatingData.earphoneMode=!0;return}if(evaluatingData.checkStep===1){evaluatingData.checkStep=10,state$1.setting.soundEffect?(evaluatingData.soundEffectMode=!0,handleStartSoundCheck()):handlePerformDetection();return}evaluatingData.checkStep===10&&(evaluatingData.checkEnd=!0,evaluatingData.checkStep=0)},addMeasureScore=i=>{evaluatingData.evaluatings[i.measureRenderIndex]={...i,leve:getLeveByScoreMeasure(i.score),show:!0}},handleScoreResult=i=>{if(i!=null&&i.content){const{header:e,body:t}=i.content;(e==null?void 0:e.commond)==="measureScore"&&addMeasureScore(t),(e==null?void 0:e.commond)==="overall"&&(evaluatingData.resulstMode=!0,evaluatingData.resultData={...t,...getLeveByScore(t.score)},console.log("🚀 ~ evaluatingData.resultData:",evaluatingData.resultData),removeResult(handleScoreResult),closeToast())}},handleStartBegin=async()=>{if(evaluatingData.startBegin=!0,evaluatingData.evaluatings={},evaluatingData.resultData={},sendResult(handleScoreResult),await startRecording(),!await togglePlay("play")){evaluatingData.startBegin=!1;return}evaluatingData.backtime=Date.now()},handleEndBegin=(i=!1)=>{evaluatingData.startBegin=!1,endEvaluating({musicScoreId:state$1.examSongId}),showLoadingToast({message:"评分中",duration:0,forbidClick:!0}),!i&&handleStopPlay()},handleCancelEvaluat=()=>{evaluatingData.evaluatings={},closeToast(),api_proxyServiceMessage({header:{commond:"recordCancel",type:"SOUND_COMPARE",status:200}}),cancelEvaluating(),removeResult(handleScoreResult),handleStopPlay()},handleViewReport=()=>{var i;api_openWebView({url:location.origin+"/accompany/#/report/"+((i=evaluatingData.resultData)==null?void 0:i.recordId)||"",orientation:0,isHideTitle:!0,statusBarTextColor:!1,isOpenLight:!0})},Evaluating=defineComponent({name:"evaluating",setup(){return onBeforeMount(()=>{evaluatingData.resultData={},evaluatingData.evaluatings={},evaluatingData.soundEffectFrequency=0,evaluatingData.checkStep=0,evaluatingData.rendered=!0}),()=>createVNode("div",null,null)}}),popup="_popup_1838h_1",dots="_dots_1838h_6",dot="_dot_1838h_6",active="_active_1838h_20",one="_one_1838h_23",styles$3={popup,dots,dot,active,one},tickData=reactive({list:[],len:0,tickEnd:!1,beatLengthInMilliseconds:0,state:"",source1:"",source2:"",index:0,show:!1}),handlePlay=(i,e)=>new Promise(t=>{setTimeout(()=>{if(tickData.tickEnd){t(i);return}tickData.index++,e&&e.play(),t(i)},tickData.beatLengthInMilliseconds)}),handleInitTick=(i,e)=>{tickData.state="",tickData.beatLengthInMilliseconds=i,tickData.len=e},handleStartTick=async()=>{tickData.show=!0,tickData.tickEnd=!1,tickData.state!=="ok"&&(tickData.source1=new howler.Howl({src:tockAndTick.tick}),tickData.source2=new howler.Howl({src:tockAndTick.tock}),tickData.state="ok"),tickData.index=0;for(let i=0;i<=tickData.len;i++){if(tickData.tickEnd)return!1;const e=i===0?tickData.source1:i===tickData.len?null:tickData.source2;await handlePlay(i,e)}return tickData.show=!1,!0},Tick=defineComponent({name:"metronome",setup(){const i=()=>{tickData.tickEnd=!0};return()=>createVNode(Popup$1,{class:styles$3.popup,show:tickData.show,"onUpdate:show":e=>tickData.show=e,closeable:!0,onClickCloseIcon:i},{default:()=>[createVNode("div",{class:styles$3.dots},[Array(tickData.len).fill(0).map((e,t)=>createVNode("div",{class:[styles$3.dot,tickData.index>t&&styles$3.active,tickData.index>t&&t===0&&styles$3.one]},null))])]})}}),audioList="_audioList_1s1qf_1",styles$2={audioList},audioData=reactive({songEle:null,backgroundEle:null}),audioListStart=i=>{var e,t,s,r;i==="play"?((e=audioData.songEle)==null||e.play(),(t=audioData.backgroundEle)==null||t.play()):i==="paused"&&((s=audioData.songEle)==null||s.pause(),(r=audioData.backgroundEle)==null||r.pause())},setAudioPlaybackRate=i=>{audioData.songEle&&(audioData.songEle.playbackRate=i),audioData.backgroundEle&&(audioData.backgroundEle.playbackRate=i)},getAudioCurrentTime=()=>{var i,e;return((i=audioData.songEle)==null?void 0:i.currentTime)||((e=audioData.backgroundEle)==null?void 0:e.currentTime)||0},getAudioDuration=()=>{var i,e;return((i=audioData.songEle)==null?void 0:i.duration)||((e=audioData.backgroundEle)==null?void 0:e.duration)||0},setAudioCurrentTime=i=>{audioData.songEle&&(audioData.songEle.currentTime=i),audioData.backgroundEle&&(audioData.backgroundEle.currentTime=i)},AudioList=defineComponent({name:"audio-list",setup(){const i=computed(()=>state$1.playSource==="music");return()=>createVNode("div",{class:styles$2.audioList},[createVNode("audio",{muted:!i.value,preload:"auto",ref:e=>{state$1.music&&(audioData.songEle=e)},src:state$1.music,onLoadedmetadata,onPlay,onTimeupdate,onEnded},null),createVNode("audio",{muted:i.value,preload:"auto",ref:e=>{state$1.accompany&&(audioData.backgroundEle=e)},src:state$1.accompany},null)])}}),followData=reactive({list:[],index:0,start:!1,rendered:!1}),toggleFollow=(i=!0)=>{state$1.modeType=state$1.modeType==="follow"?"practise":"follow",i||(followData.start=!1,openToggleRecord(!1))},noteFrequency=ref(0),audioFrequency=ref(0),followTime=ref(0),openToggleRecord=async(i=!0)=>{if(await api_cloudToggleFollow(i?"start":"end"),i)followTime.value=Date.now();else{const e=Date.now()-followTime.value;followTime.value!==0&&e>0&&(followTime.value=0)}},onClear=()=>{state$1.times.forEach(i=>{const e=document.querySelector(`div[data-vf=vf${i.id}]`);e&&(e.classList.remove("error"),e.classList.remove("success"))})},handleFollowStart=async()=>{if(!storeData.isApp){Snackbar$1({content:"请在APP端使用",type:"warning"});return}onClear(),followData.start=!0,followData.index=0,followData.list=[],gotoNext(state$1.times[0]),await openToggleRecord(!0),setStep$1()},handleFollowEnd=()=>{followData.start=!1,openToggleRecord(!1),followData.index=0,gotoNext(state$1.times[0])},next=()=>{gotoNext(state$1.times[followData.index])},getNoteIndex=()=>{const i=state$1.times[followData.index];return i.frequency<=0?(followData.index=followData.index+1,next(),getNoteIndex()):(noteFrequency.value=i.frequency,{id:i.id,min:i.frequency-i.prevFrequency*.1,max:i.frequency+i.nextFrequency*.1})};let checking=!1;const onFollowTime=i=>{var t;const e=(t=i==null?void 0:i.content)==null?void 0:t.frequency;audioFrequency.value=e,followData.list.push(e)},setStep$1=()=>{let i=Date.now();requestAnimationFrame(()=>{if(Date.now()-i<16.6){if(!followData.start)return;checked()}setStep$1()})},checked=()=>{if(checking)return;checking=!0;const i=getNoteIndex();for(let e=0;ei.min&&t{const t=document.querySelector(`div[data-vf=vf${i.id}]`);t&&(e?(t.classList.remove("error"),t.classList.add("success")):(t.classList.remove("success"),t.classList.add("error")))},FollowPractice=defineComponent({name:"follow",setup(){return onMounted(()=>{api_cloudFollowTime(onFollowTime),console.log("进入跟练模式")}),onUnmounted(()=>{api_cloudFollowTime(onFollowTime,!1),onClear(),console.log("退出跟练模式")}),()=>createVNode("div",null,null)}}),musicscoresettingKey="musicscoresetting",state=reactive({appName:"",musicRenderType:"staff",musicRendered:!1,detailId:"",xmlUrl:"",subjectId:0,categoriesId:0,categoriesName:"",enableEvaluation:!0,enableNotation:!1,examSongId:"",examSongName:"",extConfigJson:{},isOpenMetronome:!1,isShowFingering:!1,music:"",accompany:"",midiUrl:"",parentCategoriesId:0,playMode:"MP3",speed:0,originSpeed:0,track:"",partIndex:0,needTick:!1,osmd:null,isSpecialBookCategory:!1,playState:"paused",playEnd:!1,playSource:"music",playProgress:0,activeNoteIndex:0,activeMeasureIndex:0,sectionStatus:!1,section:[],sectionToast:null,sectionBoundingBoxs:[],isOpenPrepare:!1,sectionFirst:null,times:[],modeType:"practise",setting:{soundEffect:!0,eyeProtection:!1,camera:!1,cameraOpacity:70,repeatAutoPlay:!0,displayFingering:!0,displayCursor:!0,frequency:442,evaluationDifficulty:"ADVANCED",saveToAlbum:!1,enableAccompaniment:!1,reactionTimeMs:0},fixtime:0,fingeringInfo:{},scrollContainer:"musicAndSelection",isPercussion:!1,repeatedBeats:0,partListNames:[],gradual:[],gradualVersion:GradualVersion.BASE,gradualTimes:null,multitrack:0,zoom:.8,isSelectMeasureMode:!1}),onLoadedmetadata=i=>{},setStep=()=>{let i=Date.now();requestAnimationFrame(()=>{if(Date.now()-i<16.6){if(state.playState!=="play")return;handlePlaying()}setStep()})},onPlay=()=>{if(state.playEnd=!1,setStep(),state.modeType==="evaluating"){let i=getAudioCurrentTime();state.isSelectMeasureMode&&(i=i-state.section[0].time),sendEvaluatingOffsetTime(i)}},onTimeupdate=i=>{},onEnded=()=>{state.playEnd=!0,handleStopPlay(),state.modeType==="evaluating"&&handleEndBegin(!0),state.setting.repeatAutoPlay&&state.modeType==="practise"&&(skipNotePlay(0,!0),scrollViewNote(),setTimeout(()=>{togglePlay("play")},1e3))},handlePlaying=i=>{var r;const e=getAudioCurrentTime(),t=getAudioDuration();state.playProgress=e/t*100;const s=i||getNote(e);if(s){if(state.sectionStatus&&state.section.length===2){let o=state.section[0].i,a=state.section[0].MeasureNumberXML;if(state.sectionFirst&&(o=state.sectionFirst.i,a=state.sectionFirst.MeasureNumberXML),s.MeasureNumberXMLstate.section[1].MeasureNumberXML){console.log("选段播放结束"),state.isSelectMeasureMode&&onEnded(),skipNotePlay(o);return}}gotoNext(s)}(r=metronomeData.metro)==null||r.sound(e)},skipNotePlay=(i,e=!1)=>{const t=state.times[i];let s=t.time;e&&(s=0),t&&(setAudioCurrentTime(s),handlePlaying(t))},togglePlay=async i=>(state.playState=i||(state.playState==="paused"?"play":"paused"),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)},gotoCustomNote=i=>{try{state.osmd.cursor.reset()}catch(e){}for(let e=0;e{const e=i.i;if(state.activeNoteIndex===i.i)return;const t=state.osmd;let s=state.activeNoteIndex;if(state.activeNoteIndex=e,state.activeMeasureIndex=i.MeasureNumberXML,s&&e-s===1)t.cursor.next();else if(s&&e-s>0)for(;e-s>0;)s++,t.cursor.next();else gotoCustomNote(e);scrollViewNote()},getNote=i=>{const e=state.times,t=state.times.length;if(i>e[t-1].endtime+1){onEnded();return}let s=null;for(let r=state.activeNoteIndex;r=o.time)(!a||o.time!=a.time)&&(s=o);else break}return s},handleResetPlay=()=>{skipNotePlay(0,!0)},handleSetSpeed=i=>{state.speed=i;const e=i/state.originSpeed;console.log("🚀 ~ playbackRate:",i,state.originSpeed),setAudioPlaybackRate(e)},clearSelection=()=>{var i;state.sectionStatus=!1,state.section=[],(i=state.sectionToast)==null||i.close(),state.sectionToast=null},handleChangeSection=()=>{if(state.sectionStatus){clearSelection();return}state.sectionStatus=!0,state.sectionStatus&&togglePlay("paused"),state.sectionToast=showToast({message:"请选择开始小节",duration:0,position:"top",className:"selectionToast"})},handleSelection=i=>{var e;if(!(!state.sectionStatus||state.section.length>1)){if(state.section.length!==2&&i&&(state.section.push(i),state.section.length===2)){state.section=state.section.sort((s,r)=>s.time-r.time);let t=state.section[0].index;if(state.isOpenPrepare){const s=state.section[0].MeasureNumberXML;state.sectionFirst=state.times.find(r=>s-r.MeasureNumberXML===1),t=state.sectionFirst?state.sectionFirst.i:t}skipNotePlay(t),(e=state.sectionToast)==null||e.close(),state.sectionToast=null}state.section.length===1&&state.sectionToast&&(state.sectionToast.message="请选择结束小节")}},hanldeDirectSelection=i=>{if(!Array.isArray(i)||i.length!==2)return;state.sectionStatus=!0,state.section=i.sort((t,s)=>t.time-s.time);let e=state.section[0].i;if(state.isOpenPrepare){const t=state.section[0].MeasureNumberXML;state.sectionFirst=state.times.find(s=>t-s.MeasureNumberXML===1),e=state.sectionFirst?state.sectionFirst.i:e}skipNotePlay(e)};let offsetTop=0;const scrollViewNote=()=>{const i=document.getElementById("cursorImg-0"),e=document.getElementById(state.scrollContainer);!i||!e||offsetTop===i.offsetTop||(offsetTop=i.offsetTop,i.offsetTop>50?e.scrollTo({top:i.offsetTop-25,behavior:"smooth"}):e.scrollTo({top:0,behavior:"smooth"}))},isRhythmicExercises=()=>state.examSongName.indexOf("节奏练习")>-1,handleRessetState=()=>{state.modeType==="evaluating"?handleStartEvaluat():state.modeType==="practise"?togglePlay("paused"):state.modeType==="follow"&&toggleFollow(!1)},state$1=state;class AJAX{static ajax(e,t=9e3){let s;const r=e.indexOf(".mxl")>-1?"text/plain; charset=x-user-defined":"application/xml";if(XMLHttpRequest)s=new XMLHttpRequest;else if(ActiveXObject)s=new ActiveXObject("Microsoft.XMLHTTP");else return Promise.reject(new Error("XMLHttp not supported."));return s.timeout=t,new Promise((o,a)=>{s.onreadystatechange=()=>{s.readyState===XMLHttpRequest.DONE&&(s.status===200||s.status===0&&s.responseText?o(s.responseText):a(new Error("Could not retrieve requested URL "+s.status)))},s.ontimeout=l=>{a(new Error("Server request Timeout"))},s.overrideMimeType(r),s.open("GET",e,!0),s.send()})}}const _Fraction=class{constructor(i=0,e=1,t=0,s=!0){this.numerator=0,this.denominator=1,this.wholeValue=0,this.numerator=i,this.denominator=e,this.wholeValue=t,s&&this.simplify(),this.setRealValue()}static max(i,e){return i.RealValue>e.RealValue?i:e}static Equal(i,e){return i.wholeValue===e.wholeValue&&i.Denominator===e.Denominator&&i.Numerator===e.Numerator}static createFromFraction(i){return new _Fraction(i.numerator,i.denominator,i.wholeValue,!1)}static plus(i,e){const t=i.clone();return t.Add(e),t}static minus(i,e){const t=i.clone();return t.Sub(e),t}static multiply(i,e){return new _Fraction((i.wholeValue*i.denominator+i.numerator)*(e.wholeValue*e.denominator+e.numerator),i.denominator*e.denominator)}static greatestCommonDenominator(i,e){if(i===0)return e;if(e===1)return 1;for(;Math.abs(e)>1e-8;)i>e?i-=e:e-=i;return Math.round(i)}toString(){let i=this.numerator+"/"+this.denominator;return this.wholeValue!==0&&(i=this.wholeValue+" "+i),i}clone(){return new _Fraction(this.numerator,this.denominator,this.wholeValue,!1)}get Numerator(){return this.numerator}set Numerator(i){this.numerator!==i&&(this.numerator=i,this.simplify(),this.setRealValue())}get Denominator(){return this.denominator}set Denominator(i){this.denominator!==i&&(this.denominator=i,this.numerator!==0&&this.simplify(),this.setRealValue())}get WholeValue(){return this.wholeValue}set WholeValue(i){this.wholeValue!==i&&(this.wholeValue=i,this.setRealValue())}GetExpandedNumerator(){return this.wholeValue*this.denominator+this.numerator}calculateNumberOfNeededDots(){let i=1,e=2;const t=this.GetExpandedNumerator();for(;ei;)e.Numerator++;if(this.numerator>this.denominator){const t=new _Fraction(this.numerator-1,this.denominator,this.wholeValue);for(;t.Denominator>i;)t.Numerator--;if(t.Denominator_Fraction.maximumAllowedNumber){const t=this.denominator/_Fraction.maximumAllowedNumber;this.numerator=Math.round(this.numerator/t),this.denominator=Math.round(this.denominator/t)}if(this.numerator>_Fraction.maximumAllowedNumber){const t=this.numerator/_Fraction.maximumAllowedNumber;this.numerator=Math.round(this.numerator/t),this.denominator=Math.round(this.denominator/t)}}isOnBeat(i){const e=this.distanceFromBeat(i);return Math.abs(e)<_Fraction.FloatInaccuracyTolerance}distanceFromBeat(i){const e=new _Fraction(1,i.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,t){for(let s=0,r=e.length;s(i[i.Above=0]="Above",i[i.Below=1]="Below",i[i.Left=2]="Left",i[i.Right=3]="Right",i[i.NotYetDefined=4]="NotYetDefined",i[i.AboveOrBelow=5]="AboveOrBelow",i))(PlacementEnum||{});const _ContinuousDynamicExpression=class extends AbstractExpression{constructor(i,e,t,s,r,o,a=""){super(e),super.parentMeasure=s,this.NumberXml=o,this.dynamicType=i,this.label=a,this.staffNumber=t,this.activeInstantaneousDynamic=r,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(i){this.dynamicType=i}get StartMultiExpression(){return this.startMultiExpression}set StartMultiExpression(i){this.startMultiExpression=i}get EndMultiExpression(){return this.endMultiExpression}set EndMultiExpression(i){this.endMultiExpression=i}get Placement(){return this.placement}set Placement(i){this.placement=i}get StartVolume(){return this.startVolume}set StartVolume(i){this.startVolume=i}get EndVolume(){return this.endVolume}set EndVolume(i){this.endVolume=i}get StaffNumber(){return this.staffNumber}set StaffNumber(i){this.staffNumber=i}get Label(){return this.label}set Label(i){this.label=i,this.setType()}static isInputStringContinuousDynamic(i){return i?_ContinuousDynamicExpression.isStringInStringList(_ContinuousDynamicExpression.listContinuousDynamicIncreasing,i)||_ContinuousDynamicExpression.isStringInStringList(_ContinuousDynamicExpression.listContinuousDynamicDecreasing,i):!1}getInterpolatedDynamic(i){const e=this.StartMultiExpression.AbsoluteTimestamp;let t;if(this.EndMultiExpression?t=this.EndMultiExpression.AbsoluteTimestamp:t=Fraction$1.plus(this.startMultiExpression.SourceMeasureParent.AbsoluteTimestamp,this.startMultiExpression.SourceMeasureParent.Duration),i.lt(e))return-1;if(t.lt(i))return-2;const s=Fraction$1.minus(i,e).RealValue/Fraction$1.minus(t,e).RealValue;return Math.max(0,Math.min(99.9,this.startVolume+(this.endVolume-this.startVolume)*s))}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=(i=>(i[i.crescendo=0]="crescendo",i[i.diminuendo=1]="diminuendo",i))(ContDynamicEnum||{}),DynamicExpressionSymbolEnum=(i=>(i[i.p=0]="p",i[i.f=1]="f",i[i.s=2]="s",i[i.z=3]="z",i[i.m=4]="m",i[i.r=5]="r",i))(DynamicExpressionSymbolEnum||{});class MusicSheetReadingException{constructor(e,t){this.message=e,t&&(this.message+=" "+t.toString())}}class ArgumentOutOfRangeException{constructor(e){this.message=e}}class InvalidEnumArgumentException{constructor(e){this.message=e}}var loglevelExports={},loglevel={get exports(){return loglevelExports},set exports(i){loglevelExports=i}};(function(i){(function(e,t){i.exports?i.exports=t():e.log=t()})(commonjsGlobal,function(){var e=function(){},t="undefined",s=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"];function o(S,v){var x=S[v];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 a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(S){return S==="debug"&&(S="log"),typeof console===t?!1:S==="trace"&&s?a:console[S]!==void 0?o(console,S):console.log!==void 0?o(console,"log"):e}function c(S,v){for(var x=0;x=0&&N<=A.levels.SILENT){if(E=N,R!==!1&&w(N),c.call(A,N,S),typeof console===t&&N"u"}i.isUndefined=l;function c(u){return Object.prototype.toString.call(u)==="[object String]"}i.isString=c;function d(u){return l(u)||!a(u)?function(g,b){return g=0;o--)if(s(i[o],e))return o;return-1}arrays$4.lastIndexOf=lastIndexOf;function contains(i,e,t){return indexOf$1(i,e,t)>=0}arrays$4.contains=contains;function remove$6(i,e,t){var s=indexOf$1(i,e,t);return s<0?!1:(i.splice(s,1),!0)}arrays$4.remove=remove$6;function frequency(i,e,t){for(var s=t||util$h.defaultEquals,r=i.length,o=0,a=0;a=i.length||t<0||t>=i.length)return!1;var s=i[e];return i[e]=i[t],i[t]=s,!0}arrays$4.swap=swap;function toString$1(i){return"["+i.toString()+"]"}arrays$4.toString=toString$1;function forEach(i,e){for(var t=0,s=i;te.size())return!1;var t=!0;return this.forEach(function(s){return e.contains(s)?!0:(t=!1,!1)}),t},i.prototype.remove=function(e){return this.contains(e)?(this.dictionary.remove(e),!0):!1},i.prototype.forEach=function(e){this.dictionary.forEach(function(t,s){return e(s)})},i.prototype.toArray=function(){return this.dictionary.values()},i.prototype.isEmpty=function(){return this.dictionary.isEmpty()},i.prototype.size=function(){return this.dictionary.size()},i.prototype.clear=function(){this.dictionary.clear()},i.prototype.toString=function(){return arrays$3.toString(this.toArray())},i}();_Set.default=Set$1;Object.defineProperty(Bag$1,"__esModule",{value:!0});var util$e=util$i,Dictionary_1$4=Dictionary$2,Set_1$1=_Set,Bag=function(){function i(e){this.toStrF=e||util$e.defaultToString,this.dictionary=new Dictionary_1$4.default(this.toStrF),this.nElements=0}return i.prototype.add=function(e,t){if(t===void 0&&(t=1),util$e.isUndefined(e)||t<=0)return!1;if(this.contains(e))this.dictionary.getValue(e).copies+=t;else{var s={value:e,copies:t};this.dictionary.setValue(e,s)}return this.nElements+=t,!0},i.prototype.count=function(e){return this.contains(e)?this.dictionary.getValue(e).copies:0},i.prototype.contains=function(e){return this.dictionary.containsKey(e)},i.prototype.remove=function(e,t){if(t===void 0&&(t=1),util$e.isUndefined(e)||t<=0)return!1;if(this.contains(e)){var s=this.dictionary.getValue(e);return t>s.copies?this.nElements-=s.copies:this.nElements-=t,s.copies-=t,s.copies<=0&&this.dictionary.remove(e),!0}else return!1},i.prototype.toArray=function(){for(var e=[],t=this.dictionary.values(),s=0,r=t;sthis.nElements||util$d.isUndefined(e))return!1;var s=this.createNode(e);if(this.nElements===0||this.lastNode===null)this.firstNode=s,this.lastNode=s;else if(t===this.nElements)this.lastNode.next=s,this.lastNode=s;else if(t===0)s.next=this.firstNode,this.firstNode=s;else{var r=this.nodeAtIndex(t-1);if(r===null)return!1;s.next=r.next,r.next=s}return this.nElements++,!0},i.prototype.first=function(){if(this.firstNode!==null)return this.firstNode.element},i.prototype.last=function(){if(this.lastNode!==null)return this.lastNode.element},i.prototype.elementAtIndex=function(e){var t=this.nodeAtIndex(e);if(t!==null)return t.element},i.prototype.indexOf=function(e,t){var s=t||util$d.defaultEquals;if(util$d.isUndefined(e))return-1;for(var r=this.firstNode,o=0;r!==null;){if(s(r.element,e))return o;o++,r=r.next}return-1},i.prototype.contains=function(e,t){return this.indexOf(e,t)>=0},i.prototype.remove=function(e,t){var s=t||util$d.defaultEquals;if(this.nElements<1||util$d.isUndefined(e))return!1;for(var r=null,o=this.firstNode;o!==null;){if(s(o.element,e))return r===null?(this.firstNode=o.next,o===this.lastNode&&(this.lastNode=null)):o===this.lastNode?(this.lastNode=r,r.next=o.next,o.next=null):(r.next=o.next,o.next=null),this.nElements--,!0;r=o,o=o.next}return!1},i.prototype.clear=function(){this.firstNode=null,this.lastNode=null,this.nElements=0},i.prototype.equals=function(e,t){var s=t||util$d.defaultEquals;return!(e instanceof i)||this.size()!==e.size()?!1:this.equalsAux(this.firstNode,e.firstNode,s)},i.prototype.equalsAux=function(e,t,s){for(;e!==null&&t!==null;){if(!s(e.element,t.element))return!1;e=e.next,t=t.next}return!0},i.prototype.removeElementAtIndex=function(e){if(!(e<0||e>=this.nElements||this.firstNode===null||this.lastNode===null)){var t;if(this.nElements===1)t=this.firstNode.element,this.firstNode=null,this.lastNode=null;else{var s=this.nodeAtIndex(e-1);s===null?(t=this.firstNode.element,this.firstNode=this.firstNode.next):s.next===this.lastNode&&(t=this.lastNode.element,this.lastNode=s),s!==null&&s.next!==null&&(t=s.next.element,s.next=s.next.next)}return this.nElements--,t}},i.prototype.forEach=function(e){for(var t=this.firstNode;t!==null&&e(t.element)!==!1;)t=t.next},i.prototype.reverse=function(){for(var e=null,t=this.firstNode,s=null;t!==null;)s=t.next,t.next=e,e=t,t=s;s=this.firstNode,this.firstNode=this.lastNode,this.lastNode=s},i.prototype.toArray=function(){for(var e=[],t=this.firstNode;t!==null;)e.push(t.element),t=t.next;return e},i.prototype.size=function(){return this.nElements},i.prototype.isEmpty=function(){return this.nElements<=0},i.prototype.toString=function(){return arrays$2.toString(this.toArray())},i.prototype.nodeAtIndex=function(e){if(e<0||e>=this.nElements)return null;if(e===this.nElements-1)return this.lastNode;for(var t=this.firstNode,s=0;s0&&(e=e.rightCh);return e},i.prototype.transplant=function(e,t){e.parent===null?this.root=t:e===e.parent.leftCh?e.parent.leftCh=t:e.parent.rightCh=t,t!==null&&(t.parent=e.parent)},i.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 t=this.minimumAux(e.rightCh);t.parent!==e&&(this.transplant(t,t.rightCh),t.rightCh=e.rightCh,t.rightCh.parent=t),this.transplant(e,t),t.leftCh=e.leftCh,t.leftCh.parent=t}},i.prototype.inorderTraversalAux=function(e,t,s){e===null||s.stop||(this.inorderTraversalAux(e.leftCh,t,s),!s.stop&&(s.stop=t(e.element)===!1,!s.stop&&this.inorderTraversalAux(e.rightCh,t,s)))},i.prototype.levelTraversalAux=function(e,t){var s=new Queue_1$1.default;for(e!==null&&s.enqueue(e),e=s.dequeue()||null;e!=null;){if(t(e.element)===!1)return;e.leftCh!==null&&s.enqueue(e.leftCh),e.rightCh!==null&&s.enqueue(e.rightCh),e=s.dequeue()||null}},i.prototype.preorderTraversalAux=function(e,t,s){e===null||s.stop||(s.stop=t(e.element)===!1,!s.stop&&(this.preorderTraversalAux(e.leftCh,t,s),!s.stop&&this.preorderTraversalAux(e.rightCh,t,s)))},i.prototype.postorderTraversalAux=function(e,t,s){e===null||s.stop||(this.postorderTraversalAux(e.leftCh,t,s),!s.stop&&(this.postorderTraversalAux(e.rightCh,t,s),!s.stop&&(s.stop=t(e.element)===!1)))},i.prototype.minimumAux=function(e){for(;e!=null&&e.leftCh!==null;)e=e.leftCh;return e},i.prototype.maximumAux=function(e){for(;e!=null&&e.rightCh!==null;)e=e.rightCh;return e},i.prototype.heightAux=function(e){return e===null?-1:Math.max(this.heightAux(e.leftCh),this.heightAux(e.rightCh))+1},i.prototype.insertNode=function(e){for(var t=null,s=this.root;s!==null;){var r=this.compare(e.element,s.element);if(r===0)return null;r<0?(t=s,s=s.leftCh):(t=s,s=s.rightCh)}return e.parent=t,t===null?this.root=e:this.compare(e.element,t.element)<0?t.leftCh=e:t.rightCh=e,e},i.prototype.createNode=function(e){return{element:e,leftCh:null,rightCh:null,parent:null}},i}();BSTreeKV$1.default=BSTreeKV;var __extends$2=commonjsGlobal&&commonjsGlobal.__extends||function(){var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])};return function(e,t){i(e,t);function s(){this.constructor=e}e.prototype=t===null?Object.create(t):(s.prototype=t.prototype,new s)}}();Object.defineProperty(BSTree$1,"__esModule",{value:!0});var BSTreeKV_1$1=BSTreeKV$1,BSTree=function(i){__extends$2(e,i);function e(){return i!==null&&i.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$i,arrays$1=arrays$4,Heap=function(){function i(e){this.data=[],this.compare=e||collections.defaultCompare}return i.prototype.leftChildIndex=function(e){return 2*e+1},i.prototype.rightChildIndex=function(e){return 2*e+2},i.prototype.parentIndex=function(e){return Math.floor((e-1)/2)},i.prototype.minIndex=function(e,t){return t>=this.data.length?e>=this.data.length?-1:e:this.compare(this.data[e],this.data[t])<=0?e:t},i.prototype.siftUp=function(e){for(var t=this.parentIndex(e);e>0&&this.compare(this.data[t],this.data[e])>0;)arrays$1.swap(this.data,t,e),e=t,t=this.parentIndex(e)},i.prototype.siftDown=function(e){for(var t=this.minIndex(this.leftChildIndex(e),this.rightChildIndex(e));t>=0&&this.compare(this.data[e],this.data[t])>0;)arrays$1.swap(this.data,t,e),e=t,t=this.minIndex(this.leftChildIndex(e),this.rightChildIndex(e))},i.prototype.peek=function(){if(this.data.length>0)return this.data[0]},i.prototype.add=function(e){return collections.isUndefined(e)?!1:(this.data.push(e),this.siftUp(this.data.length-1),!0)},i.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}},i.prototype.contains=function(e){var t=collections.compareToEquals(this.compare);return arrays$1.contains(this.data,e,t)},i.prototype.size=function(){return this.data.length},i.prototype.isEmpty=function(){return this.data.length<=0},i.prototype.clear=function(){this.data.length=0},i.prototype.forEach=function(e){arrays$1.forEach(this.data,e)},i}();Heap$1.default=Heap;var LinkedDictionary$1={},__extends$1=commonjsGlobal&&commonjsGlobal.__extends||function(){var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])};return function(e,t){i(e,t);function s(){this.constructor=e}e.prototype=t===null?Object.create(t):(s.prototype=t.prototype,new s)}}();Object.defineProperty(LinkedDictionary$1,"__esModule",{value:!0});var Dictionary_1$3=Dictionary$2,util$b=util$i,LinkedDictionaryPair=function(){function i(e,t){this.key=e,this.value=t}return i.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},i}(),HeadOrTailLinkedDictionaryPair=function(){function i(){this.key=null,this.value=null}return i.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},i}();function isHeadOrTailLinkedDictionaryPair(i){return!i.next}var LinkedDictionary=function(i){__extends$1(e,i);function e(t){var s=i.call(this,t)||this;return s.head=new HeadOrTailLinkedDictionaryPair,s.tail=new HeadOrTailLinkedDictionaryPair,s.head.next=s.tail,s.tail.prev=s.head,s}return e.prototype.appendToTail=function(t){var s=this.tail.prev;s.next=t,t.prev=s,t.next=this.tail,this.tail.prev=t},e.prototype.getLinkedDictionaryPair=function(t){if(!util$b.isUndefined(t)){var s="$"+this.toStr(t),r=this.table[s];return r}},e.prototype.getValue=function(t){var s=this.getLinkedDictionaryPair(t);if(!util$b.isUndefined(s))return s.value},e.prototype.remove=function(t){var s=this.getLinkedDictionaryPair(t);if(!util$b.isUndefined(s))return i.prototype.remove.call(this,t),s.unlink(),s.value},e.prototype.clear=function(){i.prototype.clear.call(this),this.head.next=this.tail,this.tail.prev=this.head},e.prototype.replace=function(t,s){var r="$"+this.toStr(s.key);s.next=t.next,s.prev=t.prev,this.remove(t.key),s.prev.next=s,s.next.prev=s,this.table[r]=s,++this.nElements},e.prototype.setValue=function(t,s){if(!(util$b.isUndefined(t)||util$b.isUndefined(s))){var r=this.getLinkedDictionaryPair(t),o=new LinkedDictionaryPair(t,s),a="$"+this.toStr(t);if(util$b.isUndefined(r)){this.appendToTail(o),this.table[a]=o,++this.nElements;return}else return this.replace(r,o),r.value}},e.prototype.keys=function(){var t=[];return this.forEach(function(s,r){t.push(s)}),t},e.prototype.values=function(){var t=[];return this.forEach(function(s,r){t.push(r)}),t},e.prototype.forEach=function(t){for(var s=this.head.next;!isHeadOrTailLinkedDictionaryPair(s);){var r=t(s.key,s.value);if(r===!1)return;s=s.next}},e}(Dictionary_1$3.default);LinkedDictionary$1.default=LinkedDictionary;var MultiDictionary$1={};Object.defineProperty(MultiDictionary$1,"__esModule",{value:!0});var util$a=util$i,Dictionary_1$2=Dictionary$2,arrays=arrays$4,MultiDictionary=function(){function i(e,t,s){s===void 0&&(s=!1),this.dict=new Dictionary_1$2.default(e),this.equalsF=t||util$a.defaultEquals,this.allowDuplicate=s}return i.prototype.getValue=function(e){var t=this.dict.getValue(e);return util$a.isUndefined(t)?[]:arrays.copy(t)},i.prototype.setValue=function(e,t){if(util$a.isUndefined(e)||util$a.isUndefined(t))return!1;var s=this.dict.getValue(e);return util$a.isUndefined(s)?(this.dict.setValue(e,[t]),!0):!this.allowDuplicate&&arrays.contains(s,t,this.equalsF)?!1:(s.push(t),!0)},i.prototype.remove=function(e,t){if(util$a.isUndefined(t)){var s=this.dict.remove(e);return!util$a.isUndefined(s)}var r=this.dict.getValue(e);return!util$a.isUndefined(r)&&arrays.remove(r,t,this.equalsF)?(r.length===0&&this.dict.remove(e),!0):!1},i.prototype.keys=function(){return this.dict.keys()},i.prototype.values=function(){for(var e=this.dict.values(),t=[],s=0,r=e;s-1&&this.insertIdIntoRoot(t,s);for(var r in this.nodes)if(this.nodes.hasOwnProperty(r)){var o=this.findNodeId(r,e);o>-1&&this.insertIdIntoNode(r,t,o)}},i.prototype.insertIdAfterId=function(e,t){var s=this.findRootId(e);s>-1&&this.insertIdIntoRoot(t,s+1);for(var r in this.nodes)if(this.nodes.hasOwnProperty(r)){var o=this.findNodeId(r,e);o>-1&&this.insertIdIntoNode(r,t,o+1)}},i.prototype.insertIdIntoId=function(e,t){this.nodeInsertAtEnd(e,t),this.nodes[t]=[]},i.prototype.insertIdIntoRoot=function(e,t){if(t===void 0)this.rootInsertAtEnd(e);else if(t<0){var s=this.rootIds.length;this.rootIds.splice(t+s+1,0,e)}else this.rootIds.splice(t,0,e);this.nodes[e]=this.nodes[e]||[]},i.prototype.insertIdIntoNode=function(e,t,s){if(this.nodes[e]=this.nodes[e]||[],this.nodes[t]=this.nodes[t]||[],s===void 0)this.nodeInsertAtEnd(e,t);else if(s<0){var r=this.nodes[e].length;this.nodes[e].splice(s+r+1,0,t)}else this.nodes[e].splice(s,0,t)},i.prototype.moveId=function(e,t,s){var r=e,o=this.findRootId(r);this.nodes[t];for(var a in this.nodes)if(this.nodes.hasOwnProperty(a)){this.findNodeId(a,t);break}var l=t,c=this.findRootId(l);this.nodes[t];for(var a in this.nodes)if(this.nodes.hasOwnProperty(a)){this.findNodeId(a,t);break}if(o>-1)if(c>-1)switch(this.rootDelete(o),c>o&&c--,s){case Direction.BEFORE:this.insertIdIntoRoot(r,c);break;case Direction.AFTER:this.insertIdIntoRoot(r,c+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(l,r);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(l,r);break}else{this.rootDelete(o);for(var a in this.nodes)if(this.nodes.hasOwnProperty(a)){var d=this.findNodeId(a,l);if(d>-1){switch(s){case Direction.BEFORE:this.insertIdIntoNode(a,r,d);break;case Direction.AFTER:this.insertIdIntoNode(a,r,d+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(l,r);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(l,r);break}break}}}else if(c>-1){for(var a in this.nodes)if(this.nodes.hasOwnProperty(a)){var d=this.findNodeId(a,r);if(d>-1){this.nodeDeleteAtIndex(a,d);break}}switch(s){case Direction.BEFORE:this.insertIdIntoRoot(r,c);break;case Direction.AFTER:this.insertIdIntoRoot(r,c+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(l,r);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(l,r);break}}else{for(var a in this.nodes)if(this.nodes.hasOwnProperty(a)){var d=this.findNodeId(a,r);if(d>-1){this.nodeDeleteAtIndex(a,d);break}}for(var a in this.nodes)if(this.nodes.hasOwnProperty(a)){var d=this.findNodeId(a,l);if(d>-1){switch(s){case Direction.BEFORE:this.insertIdIntoNode(a,r,d);break;case Direction.AFTER:this.insertIdIntoNode(a,r,d+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(l,r);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(l,r);break}break}}}},i.prototype.swapArrayElements=function(e,t,s){var r=e[t];return e[t]=e[s],e[s]=r,e},i.prototype.rootDeleteId=function(e){var t=this.findRootId(e);t>-1&&this.rootDelete(t)},i.prototype.nodeAndSubNodesDelete=function(e){for(var t=[],s=0;s(i[i.pppppp=0]="pppppp",i[i.ppppp=1]="ppppp",i[i.pppp=2]="pppp",i[i.ppp=3]="ppp",i[i.pp=4]="pp",i[i.p=5]="p",i[i.mp=6]="mp",i[i.mf=7]="mf",i[i.f=8]="f",i[i.ff=9]="ff",i[i.fff=10]="fff",i[i.ffff=11]="ffff",i[i.fffff=12]="fffff",i[i.ffffff=13]="ffffff",i[i.sf=14]="sf",i[i.sff=15]="sff",i[i.sfp=16]="sfp",i[i.sfpp=17]="sfpp",i[i.fp=18]="fp",i[i.rf=19]="rf",i[i.rfz=20]="rfz",i[i.sfz=21]="sfz",i[i.sffz=22]="sffz",i[i.fz=23]="fz",i[i.other=24]="other",i))(DynamicEnum||{});InstantaneousDynamicExpression.staticConstructor();class DynamicsContainer{constructor(e,t){e instanceof ContinuousDynamicExpression?this.continuousDynamicExpression=e:e instanceof InstantaneousDynamicExpression&&(this.instantaneousDynamicExpression=e),this.staffNumber=t}static Compare(e,t){return e.parMultiExpression().AbsoluteTimestamp.CompareTo(t.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,t){super(void 0),this.rhythm=e,this.numerator=e.Numerator,this.denominator=e.Denominator,this.symbolEnum=t}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 t=this;return t===e?!0:!t||!e?!1:t.numerator===e.numerator&&t.denominator===e.denominator}OperatorNotEqual(e){return this!==e}ToString(){return"Rhythm: "+this.rhythm.toString()}}var RhythmSymbolEnum=(i=>(i[i.NONE=0]="NONE",i[i.COMMON=1]="COMMON",i[i.CUT=2]="CUT",i))(RhythmSymbolEnum||{});class MusicPartManagerIterator{constructor(e,t,s){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 r of this.musicSheet.Repetitions)this.setRepetitionIterationCount(r,1);for(let r=0;r=this.JumpResponsibleRepetition.StartIndex&&r.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(r)}}handleRepetitionsAtMeasureEnd(){for(let e=0,t=this.currentMeasure.LastRepetitionInstructions.length;e-1&&this.getRepetitionIterationCount(r)=this.JumpResponsibleRepetition.StartIndex&&r.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(r),this.repetitionIterationCountDictKeys.contains(r))){const o=r.getForwardJumpTargetForIteration(this.getRepetitionIterationCount(r));if(o>=0){this.currentMeasureIndex=o,this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.jumpResponsibleRepetition=r,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 t=0,s=e.length;t0&&(this.currentDynamicEntryIndex>=e.length||e[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp.gte(this.CurrentSourceTimestamp));)this.currentDynamicEntryIndex--;for(;this.currentDynamicEntryIndex0&&(this.currentTempoEntryIndex>=t.length||t[this.currentTempoEntryIndex].AbsoluteTimestamp.gte(this.CurrentSourceTimestamp));)this.currentTempoEntryIndex--;for(;this.currentTempoEntryIndex=0&&this.currentVoiceEntryIndex=0&&this.currentMeasureIndex0){if(!e)return!0;for(let s=0,r=t.length;st&&(this.openSheetMusicDisplay.Sheet.SelectionStart=this.openSheetMusicDisplay.Sheet.SourceMeasures[t].AbsoluteTimestamp),this.openSheetMusicDisplay.Sheet&&this.openSheetMusicDisplay.Sheet.SourceMeasures.length>s){const o=this.openSheetMusicDisplay.Sheet.SourceMeasures[s];this.openSheetMusicDisplay.Sheet.SelectionEnd=Fraction$1.plus(o.AbsoluteTimestamp,o.Duration)}this.iterator=this.manager.getIterator()}getStaffEntryFromVoiceEntry(e){const t=e.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.measureListIndex,s=e.ParentSourceStaffEntry.ParentStaff.idInMusicSheet;return this.graphic.findGraphicalStaffEntryFromMeasureList(s,t,e.ParentSourceStaffEntry)}updateWithTimestamp(e){const t=this.manager.absoluteEnrolledToSheetTimestamp(e),s=this.graphic.calculateXPositionFromTimestamp(t),r=s[0],o=s[1];this.updateCurrentPageFromSystem(o);const a=s[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 d=this.graphic.calculateCursorPoints(r,o),m=d[0].y,u=d[1].y-m;if(c){if(this.updateWidthAndStyle(c.PositionAndShape,r,m,u),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,t=e.CurrentVisibleVoiceEntries();if(e.EndReached||!e.CurrentVoiceEntries||t.length===0)return;let s=0,r=0,o=0,a;if(e.CurrentMeasure.isReducedToMultiRest){const m=this.graphic.findGraphicalMeasure(e.CurrentMeasureIndex,0),u=m.parentSourceMeasure.multipleRestMeasures,b=e.CurrentMeasure.multipleRestMeasureNumber/(u+1),y=m.PositionAndShape.Size.width-m.beginInstructionsWidth;s=m.PositionAndShape.AbsolutePosition.x+m.beginInstructionsWidth+b*y,a=m.ParentMusicSystem}else{const u=t.map(g=>this.getStaffEntryFromVoiceEntry(g)).sort((g,b)=>{var y,S,v,x;return((S=(y=g==null?void 0:g.PositionAndShape)==null?void 0:y.AbsolutePosition)==null?void 0:S.x)<=((x=(v=b==null?void 0:b.PositionAndShape)==null?void 0:v.AbsolutePosition)==null?void 0:x.x)?-1:1})[0];u&&(s=u.PositionAndShape.AbsolutePosition.x,a=u.parentMeasure.ParentMusicSystem)}if(!a)return;r=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-r;const d=this.graphic.findGraphicalMeasure(e.CurrentMeasureIndex,0).PositionAndShape;if(this.updateWidthAndStyle(d,s,r,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,t,s,r){var c;const o=this.cursorElement;let a=0,l=r;switch(this.cursorOptions.type){case 1:o.style.top=s*10*this.openSheetMusicDisplay.zoom+"px",o.style.left=(t-1.5)*10*this.openSheetMusicDisplay.zoom+"px",l=r*10*this.openSheetMusicDisplay.zoom,o.height=l,o.style.height=l+"px",a=5*this.openSheetMusicDisplay.zoom;break;case 2:o.style.top=(s-2.5)*10*this.openSheetMusicDisplay.zoom+"px",o.style.left=t*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=r*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=r*10*this.openSheetMusicDisplay.zoom,o.height=l,o.style.height=l+"px",a=(t-e.AbsolutePosition.x)*10*this.openSheetMusicDisplay.zoom;break;default:o.style.top=s*10*this.openSheetMusicDisplay.zoom+"px",o.style.left=(t-1.5)*10*this.openSheetMusicDisplay.zoom+"px",l=r*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,t=void 0){t!==void 0&&(this.cursorOptions=t);const s=document.createElement("canvas");s.width=this.cursorElement.width,s.height=1;const r=s.getContext("2d");r.globalAlpha=this.cursorOptions.alpha;const o=r.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}r.fillStyle=o,r.fillRect(0,0,e,1),this.cursorElement.src=s.toDataURL("image/png")}get Iterator(){return this.iterator}get Hidden(){return this.hidden}VoicesUnderCursor(e){return this.Iterator.CurrentVisibleVoiceEntries(e)}NotesUnderCursor(e){const t=this.VoicesUnderCursor(e),s=[];return t.forEach(r=>{s.push.apply(s,r.Notes)}),s}GNotesUnderCursor(e){const t=this.VoicesUnderCursor(e),s=[];return t.forEach(r=>{s.push(...r.Notes.map(o=>this.rules.GNote(o)))}),s}updateCurrentPage(){const e=this.Iterator.currentTimeStamp;for(const t of this.graphic.MusicPages)if(t.MusicSystems.last().GetSystemsLastTimeStamp().gt(e)){const r=t.PageNumber;return r!==this.currentPageNumber&&(this.container.removeChild(this.cursorElement),this.container=document.getElementById(this.rules.DYContainerId+r),this.container.appendChild(this.cursorElement)),this.currentPageNumber=r}return 1}updateCurrentPageFromSystem(e){if(e!=null&&e.Parent){const t=e.Parent.PageNumber;return t!==this.currentPageNumber&&(this.container.removeChild(this.cursorElement),this.container=document.getElementById(this.rules.DYContainerId+t),this.container.appendChild(this.cursorElement)),this.currentPageNumber=t}return 1}}class PointF2D{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}static get Empty(){return new PointF2D}static pointsAreEqual(e,t){return e.x===t.x&&e.y===t.y}ToString(){return"["+this.x+", "+this.y+"]"}}class SizeF2D{constructor(e=0,t=0){this.width=e,this.height=t}}class RectangleF2D{constructor(e,t,s,r){this.x=0,this.y=0,this.width=0,this.height=0,this.x=e,this.y=t,this.width=s,this.height=r}static createFromLocationAndSize(e,t){return new RectangleF2D(e.x,e.y,t.width,t.height)}get Location(){return new PointF2D(this.x,this.y)}get Size(){return new SizeF2D(this.width,this.height)}}class AClassHierarchyTrackable{isInstanceOfClass(e){let t=this.constructor.prototype;for(;t;){if(e===t.constructor.name)return!0;t=t.__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 t=e.PositionAndShape;this.boundingBox=new BoundingBox$1(this,t),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,t=void 0,s=!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=t,this.dataObject=e,this.isSymbol=s,this.xBordersHaveBeenSet=!1,this.yBordersHaveBeenSet=!1,t&&(this.Parent=t)}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,((s=(t=this.parent)==null?void 0:t.ChildElements)==null?void 0:s.indexOf(this))>-1?loglevelExports.error("BoundingBox of "+this.dataObject.constructor.name+" already in children list of "+this.parent.dataObject.constructor.name+"'s BoundingBox"):(o=(r=this.parent)==null?void 0:r.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,t=this.ChildElements.length;e.001;break;case 2:case 3:r=this.relativePosition.y,e.calculateMarginPositionAlongDirection(this,t),o=Math.abs(r-this.relativePosition.y)>.001;break;default:throw new ArgumentOutOfRangeException("direction")}while(o)}collisionDetection(e){const t=Math.min(this.AbsolutePosition.x+this.borderRight,e.absolutePosition.x+e.borderRight)-Math.max(this.AbsolutePosition.x+this.borderLeft,e.absolutePosition.x+e.borderLeft),s=Math.min(this.AbsolutePosition.y+this.borderBottom,e.absolutePosition.y+e.borderBottom)-Math.max(this.AbsolutePosition.y+this.borderTop,e.absolutePosition.y+e.borderTop);return t>0&&s>0}liesInsideBorders(e){const t=this.AbsolutePosition.x+this.borderLeft<=e.absolutePosition.x+e.borderLeft&&e.absolutePosition.x+e.borderLeft<=this.AbsolutePosition.x+this.borderRight,s=this.AbsolutePosition.x+this.borderLeft<=e.absolutePosition.x+e.borderRight&&e.absolutePosition.x+e.borderRight<=this.AbsolutePosition.x+this.borderRight;if(t&&s){const r=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(r&&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 t=Math.min(this.AbsolutePosition.x+this.borderMarginRight,e.absolutePosition.x+e.borderMarginRight)-Math.max(this.AbsolutePosition.x+this.borderMarginLeft,e.absolutePosition.x+e.borderMarginLeft),s=Math.min(this.AbsolutePosition.y+this.borderMarginBottom,e.absolutePosition.y+e.borderMarginBottom)-Math.max(this.AbsolutePosition.y+this.borderMarginTop,e.absolutePosition.y+e.borderMarginTop);return t>0&&s>0}liesInsideMargins(e){const t=this.AbsolutePosition.x+this.borderMarginLeft<=e.absolutePosition.x+e.borderMarginLeft&&e.absolutePosition.x+e.borderMarginLeft<=this.AbsolutePosition.x+this.borderMarginRight,s=this.AbsolutePosition.x+this.borderMarginLeft<=e.absolutePosition.x+e.borderMarginRight&&e.absolutePosition.x+e.borderMarginRight<=this.AbsolutePosition.x+this.borderMarginRight;if(t&&s){const r=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(r&&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,t,s){this.RelativePosition=new PointF2D(s.x,s.y),this.setAbsolutePositionFromParent();let r=0,o=!1;do switch(t){case 0:case 1:r=this.relativePosition.x,e.calculatePositionAlongDirection(this,t),o=Math.abs(r-this.relativePosition.x)>1e-4;break;case 2:case 3:r=this.relativePosition.y,e.calculatePositionAlongDirection(this,t),o=Math.abs(r-this.relativePosition.y)>1e-4;break;default:throw new ArgumentOutOfRangeException("direction")}while(o)}getClickedObjectOfType(e){const t=this.dataObject;if(this.pointLiesInsideBorders(e)&&t)return t;for(let s=0,r=this.childElements.length;s(i[i.Left=0]="Left",i[i.Right=1]="Right",i[i.Up=2]="Up",i[i.Down=3]="Down",i))(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,t){return new PointF2D(0,0)}}var PagePlacementEnum=(i=>(i[i.Down=0]="Down",i[i.Right=1]="Right",i[i.RightDown=2]="RightDown",i))(PagePlacementEnum||{}),TextAlignmentEnum=(i=>(i[i.LeftTop=0]="LeftTop",i[i.LeftCenter=1]="LeftCenter",i[i.LeftBottom=2]="LeftBottom",i[i.CenterTop=3]="CenterTop",i[i.CenterCenter=4]="CenterCenter",i[i.CenterBottom=5]="CenterBottom",i[i.RightTop=6]="RightTop",i[i.RightCenter=7]="RightCenter",i[i.RightBottom=8]="RightBottom",i))(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=(i=>(i[i.Regular=0]="Regular",i[i.Bold=1]="Bold",i[i.Italic=2]="Italic",i[i.BoldItalic=3]="BoldItalic",i[i.Underlined=4]="Underlined",i))(FontStyles||{}),Fonts=(i=>(i[i.TimesNewRoman=0]="TimesNewRoman",i[i.Kokila=1]="Kokila",i[i.Gonville=2]="Gonville",i))(Fonts||{});const FontStringNames={0:"Times New Roman",1:"Kokila",2:"Gonville"};var TieTypes=(i=>(i.SIMPLE="",i.HAMMERON="H",i.PULLOFF="P",i.SLIDE="S",i.TAPPING="T",i))(TieTypes||{});const Additional={"-2":[4,12,23],"-7":[13],"-9":[6]};var NoteEnum=(i=>(i[i.C=0]="C",i[i.D=2]="D",i[i.E=4]="E",i[i.F=5]="F",i[i.G=7]="G",i[i.A=9]="A",i[i.B=11]="B",i))(NoteEnum||{}),AccidentalEnum=(i=>(i[i.SHARP=0]="SHARP",i[i.FLAT=1]="FLAT",i[i.NONE=2]="NONE",i[i.NATURAL=3]="NATURAL",i[i.DOUBLESHARP=4]="DOUBLESHARP",i[i.DOUBLEFLAT=5]="DOUBLEFLAT",i[i.TRIPLESHARP=6]="TRIPLESHARP",i[i.TRIPLEFLAT=7]="TRIPLEFLAT",i[i.QUARTERTONESHARP=8]="QUARTERTONESHARP",i[i.QUARTERTONEFLAT=9]="QUARTERTONEFLAT",i[i.SLASHFLAT=10]="SLASHFLAT",i[i.THREEQUARTERSSHARP=11]="THREEQUARTERSSHARP",i[i.THREEQUARTERSFLAT=12]="THREEQUARTERSFLAT",i[i.SLASHQUARTERSHARP=13]="SLASHQUARTERSHARP",i[i.SLASHSHARP=14]="SLASHSHARP",i[i.DOUBLESLASHFLAT=15]="DOUBLESLASHFLAT",i[i.SORI=16]="SORI",i[i.KORON=17]="KORON",i))(AccidentalEnum||{});const _Pitch=class{constructor(i,e,t,s=void 0){this.accidental=2,this.fundamentalNote=i,this.octave=e,this.accidental=t,this.accidentalXml=s,this.halfTone=i+(e+_Pitch.octXmlDiff)*12+_Pitch.HalfTonesFromAccidental(t),this.frequency=_Pitch.calcFrequency(this),this.nextFrequency=_Pitch.calcFrequency(this,"next"),this.prevFrequency=_Pitch.calcFrequency(this,"prev")}static getNoteEnumString(i){switch(i){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(i,e){if(e===0)return[i,0];const t=_Pitch.pitchEnumValues,s=t.indexOf(i);let r=0,o=(s+e)%t.length;return s+e>t.length-1&&(r=1),o<0&&(o=t.length+o,r=-1),[t[o],r]}static CalculateTransposedHalfTone(i,e){const t=i.fundamentalNote+i.AccidentalHalfTones+e;return _Pitch.WrapAroundCheck(t,12)}static WrapAroundCheck(i,e){let t=0;for(;i<0;)i+=e,t--;for(;i>=e;)i-=e,t++;return{overflow:t,halftone:i}}static calcFrequency(i,e){let t=0,s;if(i instanceof _Pitch){const l=i;t=l.octave-1,s=l.fundamentalNote-9+l.AccidentalHalfTones}else typeof i=="number"&&(s=i-57);const r=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(r)){o=parseFloat(l);break}let a=s+o;return e==="next"&&a++,e==="prev"&&a--,442*Math.pow(2,t)*Math.pow(2,a/12)}static calcFractionalKey(i){return Math.log(i/440)/Math.LN10*_Pitch.halftoneFactor+57}static fromFrequency(i){const e=_Pitch.calcFractionalKey(i)+.5,t=Math.floor(e/12)-_Pitch.octXmlDiff,s=Math.floor(e)%12;let r=s,o=2;return this.pitchEnumValues.indexOf(r)===-1&&(r=s-1,o=0),new _Pitch(r,t,o)}static fromHalftone(i){const e=Math.floor(i/12)-_Pitch.octXmlDiff,t=i%12;let s=t,r=2;return this.pitchEnumValues.indexOf(s)===-1&&(s=t-1,r=0),new _Pitch(s,e,r)}static ceiling(i){i=i%12;let e=i;return this.pitchEnumValues.indexOf(e)===-1&&(e=i+1),e}static floor(i){i=i%12;let e=i;return this.pitchEnumValues.indexOf(e)===-1&&(e=i-1),e}static HalfTonesFromAccidental(i){switch(i){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(i){switch(i){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 i>0&&i<1?8:i<0&&i>-1?9:8}}static accidentalVexflow(i){let e;switch(i){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(i){if(i>12)throw new Error("rewrite this method to handle bigger octave changes or don't use is with bigger octave changes!");return i>0?this.getHigherPitchByTransposeFactor(i):i<0?this.getLowerPitchByTransposeFactor(-i):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 i=_Pitch.accidentalVexflow(this.accidental);return i||(i=""),"Key: "+_Pitch.getNoteEnumString(this.fundamentalNote)+i+", Note: "+this.fundamentalNote+", octave: "+this.octave.toString()}OperatorEquals(i){const e=this;return!e||!i?!1:e.FundamentalNote===i.FundamentalNote&&e.Octave===i.Octave&&e.Accidental===i.Accidental}OperatorNotEqual(i){return this!==i}OperatorFundamentalGreaterThan(i){const e=this;return e.Octave===i.Octave?e.FundamentalNote>i.FundamentalNote:e.Octave>i.Octave}OperatorFundamentalLessThan(i){const e=this;return e.Octave===i.Octave?e.FundamentalNote_Pitch.pitchEnumValues.length-1?(s=_Pitch.pitchEnumValues[e+i-_Pitch.pitchEnumValues.length],t++):s=_Pitch.pitchEnumValues[e+i],new _Pitch(s,t,2)}getLowerPitchByTransposeFactor(i){const e=_Pitch.pitchEnumValues.indexOf(this.fundamentalNote);let t=this.octave,s;return e-i<0?(s=_Pitch.pitchEnumValues[_Pitch.pitchEnumValues.length+e-i],t--):s=_Pitch.pitchEnumValues[e-i],new _Pitch(s,t,2)}getNextFundamentalNote(i){let e=_Pitch.pitchEnumValues.indexOf(i);return e=(e+1)%_Pitch.pitchEnumValues.length,_Pitch.pitchEnumValues[e]}getPreviousFundamentalNote(i){const e=_Pitch.pitchEnumValues.indexOf(i);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,t){this.staffEntries=[],this.absoluteTimestamp=t,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,t){const s=e.absoluteTimestamp.RealValue,r=t.absoluteTimestamp.RealValue;return sr?1:0}getFirstNonNullStaffEntry(){for(let e=0,t=this.staffEntries.length;e(i[i.BaseWritingColor=0]="BaseWritingColor",i[i.FollowingCursor=1]="FollowingCursor",i[i.AlternativeFollowingCursor=2]="AlternativeFollowingCursor",i[i.PlaybackCursor=3]="PlaybackCursor",i[i.Highlighted=4]="Highlighted",i[i.ErrorUnderlay=5]="ErrorUnderlay",i[i.Selected=6]="Selected",i[i.SelectionSymbol=7]="SelectionSymbol",i[i.DebugColor1=8]="DebugColor1",i[i.DebugColor2=9]="DebugColor2",i[i.DebugColor3=10]="DebugColor3",i[i.SplitScreenDivision=11]="SplitScreenDivision",i[i.GreyTransparentOverlay=12]="GreyTransparentOverlay",i[i.MarkedArea1=13]="MarkedArea1",i[i.MarkedArea2=14]="MarkedArea2",i[i.MarkedArea3=15]="MarkedArea3",i[i.MarkedArea4=16]="MarkedArea4",i[i.MarkedArea5=17]="MarkedArea5",i[i.MarkedArea6=18]="MarkedArea6",i[i.MarkedArea7=19]="MarkedArea7",i[i.MarkedArea8=20]="MarkedArea8",i[i.MarkedArea9=21]="MarkedArea9",i[i.MarkedArea10=22]="MarkedArea10",i[i.Comment1=23]="Comment1",i[i.Comment2=24]="Comment2",i[i.Comment3=25]="Comment3",i[i.Comment4=26]="Comment4",i[i.Comment5=27]="Comment5",i[i.Comment6=28]="Comment6",i[i.Comment7=29]="Comment7",i[i.Comment8=30]="Comment8",i[i.Comment9=31]="Comment9",i[i.Comment10=32]="Comment10",i))(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=(i=>(i[i.Background=0]="Background",i[i.Highlight=1]="Highlight",i[i.MeasureError=2]="MeasureError",i[i.SelectionSymbol=3]="SelectionSymbol",i[i.Cursor=4]="Cursor",i[i.PSI_Debug=5]="PSI_Debug",i[i.Notes=6]="Notes",i[i.Comment=7]="Comment",i[i.Debug_above=8]="Debug_above",i))(GraphicalLayers||{}),NoteState=(i=>(i[i.Normal=0]="Normal",i[i.Selected=1]="Selected",i[i.Follow_Confirmed=2]="Follow_Confirmed",i[i.QFeedback_NotFound=3]="QFeedback_NotFound",i[i.QFeedback_OK=4]="QFeedback_OK",i[i.QFeedback_Perfect=5]="QFeedback_Perfect",i[i.Debug1=6]="Debug1",i[i.Debug2=7]="Debug2",i[i.Debug3=8]="Debug3",i))(NoteState||{}),AutoColorSet=(i=>(i.C="#d82c6b",i.D="#F89D15",i.E="#FFE21A",i.F="#4dbd5c",i.G="#009D96",i.A="#43469d",i.B="#76429c",i.Rest="#000000",i))(AutoColorSet||{});class GraphicalLine{constructor(e,t,s=0,r=OutlineAndFillStyleEnum.BaseWritingColor,o=void 0){this.start=e,this.end=t,this.width=s,this.styleId=r,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,t=0,s=2){super(void 0),this.clefType=0,this.line=2,this.octaveOffset=0,this.line=s,this.clefType=e,this.octaveOffset=t,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 t=0;t<=2;t++){const s=new ClefInstruction(0,t,2);e.push(s)}for(let t=-2;t<=0;t++){const s=new ClefInstruction(1,t,4);e.push(s)}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=(i=>(i[i.G=0]="G",i[i.F=1]="F",i[i.C=2]="C",i[i.percussion=3]="percussion",i[i.TAB=4]="TAB",i))(ClefEnum||{}),MidiInstrument=(i=>(i[i.None=-1]="None",i[i.Acoustic_Grand_Piano=0]="Acoustic_Grand_Piano",i[i.Bright_Acoustic_Piano=1]="Bright_Acoustic_Piano",i[i.Electric_Grand_Piano=2]="Electric_Grand_Piano",i[i.Honky_tonk_Piano=3]="Honky_tonk_Piano",i[i.Electric_Piano_1=4]="Electric_Piano_1",i[i.Electric_Piano_2=5]="Electric_Piano_2",i[i.Harpsichord=6]="Harpsichord",i[i.Clavinet=7]="Clavinet",i[i.Celesta=8]="Celesta",i[i.Glockenspiel=9]="Glockenspiel",i[i.Music_Box=10]="Music_Box",i[i.Vibraphone=11]="Vibraphone",i[i.Marimba=12]="Marimba",i[i.Xylophone=13]="Xylophone",i[i.Tubular_Bells=14]="Tubular_Bells",i[i.Dulcimer=15]="Dulcimer",i[i.Drawbar_Organ=16]="Drawbar_Organ",i[i.Percussive_Organ=17]="Percussive_Organ",i[i.Rock_Organ=18]="Rock_Organ",i[i.Church_Organ=19]="Church_Organ",i[i.Reed_Organ=20]="Reed_Organ",i[i.Accordion=21]="Accordion",i[i.Harmonica=22]="Harmonica",i[i.Tango_Accordion=23]="Tango_Accordion",i[i.Acoustic_Guitar_nylon=24]="Acoustic_Guitar_nylon",i[i.Acoustic_Guitar_steel=25]="Acoustic_Guitar_steel",i[i.Electric_Guitar_jazz=26]="Electric_Guitar_jazz",i[i.Electric_Guitar_clean=27]="Electric_Guitar_clean",i[i.Electric_Guitar_muted=28]="Electric_Guitar_muted",i[i.Overdriven_Guitar=29]="Overdriven_Guitar",i[i.Distortion_Guitar=30]="Distortion_Guitar",i[i.Guitar_harmonics=31]="Guitar_harmonics",i[i.Acoustic_Bass=32]="Acoustic_Bass",i[i.Electric_Bass_finger=33]="Electric_Bass_finger",i[i.Electric_Bass_pick=34]="Electric_Bass_pick",i[i.Fretless_Bass=35]="Fretless_Bass",i[i.Slap_Bass_1=36]="Slap_Bass_1",i[i.Slap_Bass_2=37]="Slap_Bass_2",i[i.Synth_Bass_1=38]="Synth_Bass_1",i[i.Synth_Bass_2=39]="Synth_Bass_2",i[i.Violin=40]="Violin",i[i.Viola=41]="Viola",i[i.Cello=42]="Cello",i[i.Contrabass=43]="Contrabass",i[i.Tremolo_Strings=44]="Tremolo_Strings",i[i.Pizzicato_Strings=45]="Pizzicato_Strings",i[i.Orchestral_Harp=46]="Orchestral_Harp",i[i.Timpani=47]="Timpani",i[i.String_Ensemble_1=48]="String_Ensemble_1",i[i.String_Ensemble_2=49]="String_Ensemble_2",i[i.Synth_Strings_1=50]="Synth_Strings_1",i[i.Synth_Strings_2=51]="Synth_Strings_2",i[i.Choir_Aahs=52]="Choir_Aahs",i[i.Voice_Oohs=53]="Voice_Oohs",i[i.Synth_Voice=54]="Synth_Voice",i[i.Orchestra_Hit=55]="Orchestra_Hit",i[i.Trumpet=56]="Trumpet",i[i.Trombone=57]="Trombone",i[i.Tuba=58]="Tuba",i[i.Muted_Trumpet=59]="Muted_Trumpet",i[i.French_Horn=60]="French_Horn",i[i.Brass_Section=61]="Brass_Section",i[i.Synth_Brass_1=62]="Synth_Brass_1",i[i.Synth_Brass_2=63]="Synth_Brass_2",i[i.Soprano_Sax=64]="Soprano_Sax",i[i.Alto_Sax=65]="Alto_Sax",i[i.Tenor_Sax=66]="Tenor_Sax",i[i.Baritone_Sax=67]="Baritone_Sax",i[i.Oboe=68]="Oboe",i[i.English_Horn=69]="English_Horn",i[i.Bassoon=70]="Bassoon",i[i.Clarinet=71]="Clarinet",i[i.Piccolo=72]="Piccolo",i[i.Flute=73]="Flute",i[i.Recorder=74]="Recorder",i[i.Pan_Flute=75]="Pan_Flute",i[i.Blown_Bottle=76]="Blown_Bottle",i[i.Shakuhachi=77]="Shakuhachi",i[i.Whistle=78]="Whistle",i[i.Ocarina=79]="Ocarina",i[i.Lead_1_square=80]="Lead_1_square",i[i.Lead_2_sawtooth=81]="Lead_2_sawtooth",i[i.Lead_3_calliope=82]="Lead_3_calliope",i[i.Lead_4_chiff=83]="Lead_4_chiff",i[i.Lead_5_charang=84]="Lead_5_charang",i[i.Lead_6_voice=85]="Lead_6_voice",i[i.Lead_7_fifths=86]="Lead_7_fifths",i[i.Lead_8_bass_lead=87]="Lead_8_bass_lead",i[i.Pad_1_new_age=88]="Pad_1_new_age",i[i.Pad_2_warm=89]="Pad_2_warm",i[i.Pad_3_polysynth=90]="Pad_3_polysynth",i[i.Pad_4_choir=91]="Pad_4_choir",i[i.Pad_5_bowed=92]="Pad_5_bowed",i[i.Pad_6_metallic=93]="Pad_6_metallic",i[i.Pad_7_halo=94]="Pad_7_halo",i[i.Pad_8_sweep=95]="Pad_8_sweep",i[i.FX_1_rain=96]="FX_1_rain",i[i.FX_2_soundtrack=97]="FX_2_soundtrack",i[i.FX_3_crystal=98]="FX_3_crystal",i[i.FX_4_atmosphere=99]="FX_4_atmosphere",i[i.FX_5_brightness=100]="FX_5_brightness",i[i.FX_6_goblins=101]="FX_6_goblins",i[i.FX_7_echoes=102]="FX_7_echoes",i[i.FX_8_scifi=103]="FX_8_scifi",i[i.Sitar=104]="Sitar",i[i.Banjo=105]="Banjo",i[i.Shamisen=106]="Shamisen",i[i.Koto=107]="Koto",i[i.Kalimba=108]="Kalimba",i[i.Bag_pipe=109]="Bag_pipe",i[i.Fiddle=110]="Fiddle",i[i.Shanai=111]="Shanai",i[i.Tinkle_Bell=112]="Tinkle_Bell",i[i.Agogo=113]="Agogo",i[i.Steel_Drums=114]="Steel_Drums",i[i.Woodblock=115]="Woodblock",i[i.Taiko_Drum=116]="Taiko_Drum",i[i.Melodic_Tom=117]="Melodic_Tom",i[i.Synth_Drum=118]="Synth_Drum",i[i.Reverse_Cymbal=119]="Reverse_Cymbal",i[i.Guitar_Fret_Noise=120]="Guitar_Fret_Noise",i[i.Breath_Noise=121]="Breath_Noise",i[i.Seashore=122]="Seashore",i[i.Bird_Tweet=123]="Bird_Tweet",i[i.Telephone_Ring=124]="Telephone_Ring",i[i.Helicopter=125]="Helicopter",i[i.Applause=126]="Applause",i[i.Gunshot=127]="Gunshot",i[i.euphonium=128]="euphonium",i[i.AltoClarinetInEb=200]="AltoClarinetInEb",i[i.TrumpetInBb=201]="TrumpetInBb",i[i.BaritoneSaxophone=202]="BaritoneSaxophone",i[i.TenorSaxophone=203]="TenorSaxophone",i[i.ClarinetInEb=204]="ClarinetInEb",i[i.Euphonium=205]="Euphonium",i[i.Alto_Clarinet=206]="Alto_Clarinet",i[i.Bass_Clarinet=207]="Bass_Clarinet",i[i.Bass_Trombone=208]="Bass_Trombone",i[i.clarinet_in_bb=209]="clarinet_in_bb",i[i.clarinet_in_eb=210]="clarinet_in_eb",i[i.Percussion=135]="Percussion",i))(MidiInstrument||{});const _KeyInstruction=class extends AbstractNotationInstruction{constructor(i=void 0,e=0,t=0){super(i),this.isTransposedBy=0,this.Key=e,this.keyTypeOriginal=e,this.mode=t,this.alteratedNotes=this.calcAlteratedNotes()}static copy(i){const e=new _KeyInstruction(i.parent,i.Key,i.Mode);return e.keyTypeOriginal=i.keyTypeOriginal,e}static getAllPossibleMajorKeyInstructions(){const i=[];for(let e=-7;e<7;e++){const t=new _KeyInstruction(void 0,e,0);i.push(t)}return i}get Key(){return this.keyType}set Key(i){this.keyType=i,this.alteratedNotes=this.calcAlteratedNotes()}get Mode(){return this.mode}set Mode(i){this.mode=i}get AlteratedNotes(){return this.alteratedNotes}calcAlteratedNotes(){const i=[];if(this.keyType>0)for(let e=0;e=0}getAlterationForPitch(i){return this.keyType>0&&this.alteratedNotes.indexOf(i.FundamentalNote)<=this.keyType?AccidentalEnum.SHARP:this.keyType<0&&this.alteratedNotes.indexOf(i.FundamentalNote)<=Math.abs(this.keyType)?AccidentalEnum.FLAT:AccidentalEnum.NONE}ToString(){return"Key: "+this.keyType+this.mode}OperatorEquals(i){const e=this;return e===i?!0:!e||!i?!1:e.Key===i.Key&&e.Mode===i.Mode}OperatorNotEqual(i){return!this.OperatorEquals(i)}};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=(i=>(i[i.major=0]="major",i[i.minor=1]="minor",i[i.none=2]="none",i[i.dorian=3]="dorian",i[i.phrygian=4]="phrygian",i[i.lydian=5]="lydian",i[i.mixolydian=6]="mixolydian",i[i.aeolian=7]="aeolian",i[i.ionian=8]="ionian",i[i.locrian=9]="locrian",i))(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(i){return this.indexOf(i)!==-1}});class CollectionUtil{static contains2(e,t){for(let s=0;s{var s,r,o,a;return((r=(s=t.sourceNote.Pitch)==null?void 0:s.getHalfTone())!=null?r:0)-((a=(o=e.sourceNote.Pitch)==null?void 0:o.getHalfTone())!=null?a:0)}),this.notes}sortForVexflow(){return this.notes.sort((e,t)=>{var s,r,o;return((r=(s=e.sourceNote.Pitch)==null?void 0:s.getHalfTone())!=null?r:0)-((o=t.sourceNote.Pitch.getHalfTone())!=null?o:0)}),this.notes}color(){}}class GraphicalMusicSheet{constructor(e,t){this.musicPages=[],this.measureList=[],this.verticalGraphicalStaffEntryContainers=[],this.cursors=[],this.leadSheet=!1,this.musicSheet=e,this.numberOfStaves=this.musicSheet.Staves.length,this.calculator=t,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 t=0;t=0;s--){const r=this.measureList[s][t];if(r)return r}}findGraphicalStaffEntryFromMeasureList(e,t,s){for(let r=t;r0)return a.staffEntries[0]}}getFirstVisibleMeasuresListFromIndices(e,t){const s=[],r=this.measureList[0].length;for(let o=e;o<=t;o++)for(let a=0;a=0;t--){if(this.verticalGraphicalStaffEntryContainers[t].AbsoluteTimestamp.lt(e)){const s=new VerticalGraphicalStaffEntryContainer(this.numberOfStaves,e);return this.verticalGraphicalStaffEntryContainers.splice(t+1,0,s),s}if(this.verticalGraphicalStaffEntryContainers[t].AbsoluteTimestamp.Equals(e))return this.verticalGraphicalStaffEntryContainers[t]}}GetVerticalContainerFromTimestamp(e,t=0){const s=CollectionUtil.binarySearch(this.verticalGraphicalStaffEntryContainers,new VerticalGraphicalStaffEntryContainer(0,e),VerticalGraphicalStaffEntryContainer.compareByTimestamp,t);if(s>=0)return this.verticalGraphicalStaffEntryContainers[s]}GetInterpolatedIndexInVerticalContainers(e){const t=this.verticalGraphicalStaffEntryContainers;let s=0,r=t.length-1,o,a;if(e.lte(t[t.length-1].AbsoluteTimestamp)){for(;r-s>1;){const m=Math.floor((r+s)/2);if(t[s].AbsoluteTimestamp.Equals(e)){r=s;break}else if(t[r].AbsoluteTimestamp.Equals(e)){s=r;break}else{if(t[m].AbsoluteTimestamp.Equals(e))return this.verticalGraphicalStaffEntryContainers.indexOf(t[m]);e.lt(t[m].AbsoluteTimestamp)?r=m:s=m}}if(s===r)return this.verticalGraphicalStaffEntryContainers.indexOf(t[s]);o=t[s].AbsoluteTimestamp,a=t[r].AbsoluteTimestamp}else o=t[t.length-1].AbsoluteTimestamp,a=Fraction$1.plus(this.getLongestStaffEntryDuration(t.length-1),o),r=t.length;const l=a.RealValue-o.RealValue,c=a.RealValue-e.RealValue,d=r-c/l;return Math.min(d,this.verticalGraphicalStaffEntryContainers.length)}getVisibleStavesIndicesFromSourceMeasure(e){const t=[],s=[];for(let r=0,o=e.length;r{var s;return((s=t.parentStaffEntry)==null?void 0:s.relInMeasureTimestamp)!==void 0})}GetNearestNote(e,t){const s=this.GetNearestVoiceEntry(e);if(!s)return;let r,o=Number.MAX_SAFE_INTEGER;for(const a of s.notes){const l=a.PositionAndShape.AbsolutePosition.y,c=Math.abs(a.PositionAndShape.AbsolutePosition.x-e.x),d=Math.abs(l-e.y);c+da.PositionAndShape.RelativePosition.x&&(s=a):s=a)}}catch(r){loglevelExports.info("GraphicalMusicSheet.getStaffEntry",r)}return s}GetPreviousVisibleContainerIndex(e){for(let t=e-1;t>=0;t--){const s=this.verticalGraphicalStaffEntryContainers[t].StaffEntries;for(let r=0,o=s.length;r=0;o--)if(s=this.getStaffEntry(o),s)if(t){if(s.sourceStaffEntry.ParentStaff.ParentInstrument.Visible)return s}else return s}findClosestRightStaffEntry(e,t){let s;const r=Math.max(0,Math.ceil(e));for(let o=r;o{};Vex.L=(i,e)=>{if(!e)return;const t=Array.prototype.slice.call(e).join(" ");window.console.log(i+": "+t)};Vex.MakeException=i=>class extends Error{constructor(t,s){super(t),this.name=i,this.message=t,this.data=s}};class RuntimeError{constructor(e,t){this.code=e,this.message=t}toString(){return"[RuntimeError] "+this.code+":"+this.message}}Vex.RuntimeError=RuntimeError;Vex.RERR=Vex.RuntimeError;Vex.Merge=(i,e)=>{for(const t in e)i[t]=e[t];return i};Vex.Min=Math.min;Vex.Max=Math.max;Vex.forEach=(i,e)=>{for(let t=0;ti%e>=e/2?parseInt(i/e,10)*e+e:parseInt(i/e,10)*e;Vex.MidLine=(i,e)=>{let t=e+(i-e)/2;return t%2>0&&(t=Vex.RoundN(t*10,5)/10),t};Vex.SortAndUnique=(i,e,t)=>{if(i.length>1){const s=[];let r;i.sort(e);for(let o=0;o{let t=i.length;for(;t--;)if(i[t]===e)return!0;return!1};Vex.getCanvasContext=i=>{if(!i)throw new Vex.RERR("BadArgument","Invalid canvas selector: "+i);const e=document.getElementById(i);if(!(e&&e.getContext))throw new Vex.RERR("UnsupportedBrowserError","This browser does not support HTML5 Canvas");return e.getContext("2d")};Vex.drawDot=(i,e,t,s="#55")=>{i.save(),i.setFillStyle(s),i.beginPath(),i.arc(e,t,3,0,Math.PI*2,!0),i.closePath(),i.fill(),i.restore()};Vex.BM=(i,e)=>{const t=new Date().getTime();e();const s=new Date().getTime()-t;Vex.L(i+s+"ms")};Vex.StackTrace=()=>new Error().stack;Vex.W=(...i)=>{const e=i.join(" ");window.console.log("Warning: ",e,Vex.StackTrace())};Vex.Prefix=i=>Vex.Prefix.prefix+i;Vex.Prefix.prefix="vf-";class Fraction{static GCD(e,t){if(typeof e!="number"||typeof t!="number")throw new Vex.RERR("BadArgument",`Invalid numbers: ${e}, ${t}`);let s;for(;t!==0;)s=t,t=e%t,e=s;return e}static LCM(e,t){return e*t/Fraction.GCD(e,t)}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 t=e[0];return e.shift(),Fraction.LCM(t,Fraction.LCMM(e))}}constructor(e,t){this.set(e,t)}set(e,t){return this.numerator=e===void 0?1:e,this.denominator=t===void 0?1:t,this}value(){return this.numerator/this.denominator}simplify(){let e=this.numerator,t=this.denominator;const s=Fraction.GCD(e,t);return e/=s,t/=s,t<0&&(t=-t,e=-e),this.set(e,t)}add(e,t){let s,r;e instanceof Fraction?(s=e.numerator,r=e.denominator):(e!==void 0?s=e:s=0,t!==void 0?r=t:r=1);const o=Fraction.LCM(this.denominator,r),a=o/this.denominator,l=o/r,c=this.numerator*a+s*l;return this.set(c,o)}subtract(e,t){let s,r;e instanceof Fraction?(s=e.numerator,r=e.denominator):(e!==void 0?s=e:s=0,t!==void 0?r=t:r=1);const o=Fraction.LCM(this.denominator,r),a=o/this.denominator,l=o/r,c=this.numerator*a-s*l;return this.set(c,o)}multiply(e,t){let s,r;return e instanceof Fraction?(s=e.numerator,r=e.denominator):(e!==void 0?s=e:s=1,t!==void 0?r=t:r=1),this.set(this.numerator*s,this.denominator*r)}divide(e,t){let s,r;return e instanceof Fraction?(s=e.numerator,r=e.denominator):(e!==void 0?s=e:s=1,t!==void 0?r=t:r=1),this.set(this.numerator*r,this.denominator*s)}equals(e){const t=Fraction.__compareA.copy(e).simplify(),s=Fraction.__compareB.copy(this).simplify();return t.numerator===s.numerator&&t.denominator===s.denominator}greaterThan(e){const t=Fraction.__compareB.copy(this);return t.subtract(e),t.numerator>0}greaterThanEquals(e){const t=Fraction.__compareB.copy(this);return t.subtract(e),t.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 t=this.quotient(),s=Fraction.__tmp.copy(this);return t<0?s.abs().fraction():s.fraction(),t!==0?(e+=t,s.numerator!==0&&(e+=" "+s.toSimplifiedString())):s.numerator===0?e="0":e=s.toSimplifiedString(),e}parse(e){const t=e.split("/"),s=parseInt(t[0],10),r=t[1]?parseInt(t[1],10):1;return this.set(s,r)}}Fraction.__compareA=new Fraction;Fraction.__compareB=new Fraction;Fraction.__tmp=new Fraction;const X$3=Vex.MakeException("RegistryError");function setIndexValue(i,e,t,s,r){i[e][t]||(i[e][t]={}),i[e][t][s]=r}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:t,value:s,oldValue:r}){const o=this.getElementById(e);r!==null&&this.index[t][r]&&delete this.index[t][r][e],s!==null&&setIndexValue(this.index,t,s,o.getAttribute("id"),o)}register(e,t){if(t=t||e.getAttribute("id"),!t)throw new X$3("Can't add element without `id` attribute to registry",e);return e.setAttribute("id",t),setIndexValue(this.index,"id",t,t,e),Registry.INDEXES.forEach(s=>{this.updateIndex({id:t,name:s,value:e.getAttribute(s),oldValue:null})}),e.onRegister(this),this}getElementById(e){return this.index.id[e]?this.index.id[e][e]:null}getElementsByAttribute(e,t){const s=this.index[e];return s&&s[t]?Object.keys(s[t]).map(r=>s[t][r]):[]}getElementsByType(e){return this.getElementsByAttribute("type",e)}getElementsByClass(e){return this.getElementsByAttribute("class",e)}onUpdate({id:e,name:t,value:s,oldValue:r}){function o(a,l){return a.filter(c=>c===l).length>0}return o(Registry.INDEXES.concat(["id","class"]),t)?(this.updateIndex({id:e,name:t,value:s,oldValue:r}),this):this}}Registry.defaultRegistry=null;let Element$1=class Ut{static newID(){return"auto"+Ut.ID++}constructor({type:e}={}){this.attrs={id:Ut.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,t=this.getStyle()){return t?(e.save(),t.shadowColor&&e.setShadowColor(t.shadowColor),t.shadowBlur&&e.setShadowBlur(t.shadowBlur),t.fillStyle&&e.setFillStyle(t.fillStyle),t.strokeStyle&&e.setStrokeStyle(t.strokeStyle),t.lineWidth&&e.setLineWidth(t.lineWidth),this):this}restoreStyle(e=this.context,t=this.getStyle()){return t?(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,t){const s=this.attrs.id,r=this.attrs[e];return this.attrs[e]=t,this.registry&&this.registry.onUpdate({id:s,name:e,value:t,oldValue:r}),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,t,s,r){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.addPoint(e,t),this.addPoint(s,r)}width(){return this.x2-this.x1}height(){return this.y2-this.y1}addPoint(e,t){e!=null&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),ethis.x2&&(this.x2=e)),t!=null&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),tthis.y2&&(this.y2=t))}addX(e){this.addPoint(e,null)}addY(e){this.addPoint(null,e)}addQuadraticCurve(e,t,s,r,o,a){const l=e+.6666666666666666*(s-e),c=t+2/3*(r-t),d=l+1/3*(o-e),m=c+1/3*(a-t);this.addBezierCurve(e,t,l,c,d,m,o,a)}addBezierCurve(e,t,s,r,o,a,l,c){const d=[e,t],m=[s,r],u=[o,a],g=[l,c];let b;this.addPoint(d[0],d[1]),this.addPoint(g[0],g[1]);const y=(S,v)=>Math.pow(1-S,3)*d[v]+3*Math.pow(1-S,2)*S*m[v]+3*(1-S)*Math.pow(S,2)*u[v]+Math.pow(S,3)*g[v];for(b=0;b<=1;b++){const S=6*d[b]-12*m[b]+6*u[b],v=-3*d[b]+9*m[b]-9*u[b]+3*g[b],x=3*m[b]-3*d[b];if(v===0){if(S===0)continue;const w=-x/S;0{if(!i)throw new Vex.RERR("BadArgument","Invalid clef: "+i);const e=Flow.clefProperties.values[i];if(!e)throw new Vex.RERR("BadArgument","Invalid clef: "+i);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=(i,e,t)=>{e===void 0&&(e="treble");const s={octave_shift:0};typeof t=="object"&&Vex.Merge(s,t);const r=i.split("/");if(r.length<2)throw new Vex.RERR("BadArguments",`Key must have note + octave and an optional glyph: ${i}`);const o=r[0].toUpperCase(),a=Flow.keyProperties.note_values[o];if(!a)throw new Vex.RERR("BadArguments","Invalid key name: "+o);a.octave&&(r[1]=a.octave);let l=parseInt(r[1],10);l+=-1*s.octave_shift;let d=(l*7-4*7+a.index)/2;d+=Flow.clefProperties(e).line_shift;let m=0;d<=0&&d*2%2===0&&(m=1),d>=6&&d*2%2===0&&(m=-1);const u=typeof a.int_val<"u"?l*12+a.int_val:null,g=a.code,b=a.shift_right;let y={};if(r.length>2&&r[2]){const S=r[2].toUpperCase();y=Flow.keyProperties.customNoteHeads[S]||{}}return{key:o,octave:l,line:d,int_value:u,accidental:a.accidental,code:g,stroke:m,shift_right:b,displaced:!1,...y}};Flow.keyProperties.note_values={C:{index:0,int_val:0,accidental:null},CN:{index:0,int_val:0,accidental:"n"},"C#":{index:0,int_val:1,accidental:"#"},"C##":{index:0,int_val:2,accidental:"##"},CB:{index:0,int_val:-1,accidental:"b"},CBB:{index:0,int_val:-2,accidental:"bb"},D:{index:1,int_val:2,accidental:null},DN:{index:1,int_val:2,accidental:"n"},"D#":{index:1,int_val:3,accidental:"#"},"D##":{index:1,int_val:4,accidental:"##"},DB:{index:1,int_val:1,accidental:"b"},DBB:{index:1,int_val:0,accidental:"bb"},E:{index:2,int_val:4,accidental:null},EN:{index:2,int_val:4,accidental:"n"},"E#":{index:2,int_val:5,accidental:"#"},"E##":{index:2,int_val:6,accidental:"##"},EB:{index:2,int_val:3,accidental:"b"},EBB:{index:2,int_val:2,accidental:"bb"},F:{index:3,int_val:5,accidental:null},FN:{index:3,int_val:5,accidental:"n"},"F#":{index:3,int_val:6,accidental:"#"},"F##":{index:3,int_val:7,accidental:"##"},FB:{index:3,int_val:4,accidental:"b"},FBB:{index:3,int_val:3,accidental:"bb"},G:{index:4,int_val:7,accidental:null},GN:{index:4,int_val:7,accidental:"n"},"G#":{index:4,int_val:8,accidental:"#"},"G##":{index:4,int_val:9,accidental:"##"},GB:{index:4,int_val:6,accidental:"b"},GBB:{index:4,int_val:5,accidental:"bb"},A:{index:5,int_val:9,accidental:null},AN:{index:5,int_val:9,accidental:"n"},"A#":{index:5,int_val:10,accidental:"#"},"A##":{index:5,int_val:11,accidental:"##"},AB:{index:5,int_val:8,accidental:"b"},ABB:{index:5,int_val:7,accidental:"bb"},B:{index:6,int_val:11,accidental:null},BN:{index:6,int_val:11,accidental:"n"},"B#":{index:6,int_val:12,accidental:"#"},"B##":{index:6,int_val:13,accidental:"##"},BB:{index:6,int_val:10,accidental:"b"},BBB:{index:6,int_val:9,accidental:"bb"},R:{index:6,int_val:9,rest:!0},X:{index:6,accidental:"",octave:4,code:"v3e",shift_right:5.5}};Flow.keyProperties.customNoteHeads={D0:{code:"v27",shift_right:0,stem_up_x_offset:0,stem_down_x_offset:0,stem_up_y_offset:-1,stem_down_y_offset:0},D1:{code:"v2d",shift_right:-.5},D2:{code:"v22",shift_right:-.5},D3:{code:"v70",shift_right:-.5},T0:{code:"v49",shift_right:-2,stem_up_y_offset:-4,stem_down_y_offset:4},T1:{code:"v93",shift_right:.5,stem_up_y_offset:-4,stem_down_y_offset:4},T2:{code:"v40",shift_right:.5,stem_up_y_offset:-4,stem_down_y_offset:4},T3:{code:"v7d",shift_right:.5,stem_up_y_offset:-4,stem_down_y_offset:4},X0:{code:"v92",stem_up_x_offset:-2,stem_down_x_offset:0,stem_up_y_offset:4,stem_down_y_offset:4},X1:{code:"v95",shift_right:-.5,stem_up_y_offset:4,stem_down_y_offset:4},X2:{code:"v3e",shift_right:.5,stem_up_y_offset:4,stem_down_y_offset:4},X3:{code:"v3b",shift_right:0,stem_up_x_offset:-1.2,stem_down_x_offset:0,stem_up_y_offset:-1,stem_down_y_offset:2},S1:{code:"vd3",shift_right:0},S2:{code:"vd2",shift_right:0},R1:{code:"vd5",shift_right:0},R2:{code:"vd4",shift_right:0}};Flow.integerToNote=i=>{if(typeof i>"u")throw new Vex.RERR("BadArguments","Undefined integer for integerToNote");if(i<-2)throw new Vex.RERR("BadArguments",`integerToNote requires integer > -2: ${i}`);const e=Flow.integerToNote.table[i];if(!e)throw new Vex.RERR("BadArguments",`Unknown note value for integer: ${i}`);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=(i,e=1)=>{let t=null,s=0,r=0;if(i.toString().toUpperCase()==="X"){const o=new Glyph("v7f",Flow.DEFAULT_TABLATURE_FONT_SCALE).getMetrics();t="v7f",s=o.width,r=-o.height/2}else s=Flow.textWidth(i.toString());return{text:i,code:t,getWidth:()=>s*e,shift_y:r}};Flow.textWidth=i=>7*i.toString().length;Flow.articulationCodes=i=>Flow.articulationCodes.articulations[i];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=i=>Flow.accidentalCodes.accidentals[i];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=i=>Flow.ornamentCodes.ornaments[i];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=i=>{const e=Flow.keySignature.keySpecs[i];if(!e)throw new Vex.RERR("BadKeySignature",`Bad key signature spec: '${i}'`);if(!e.acc)return[];const t=Flow.keySignature.accidentalList(e.acc),s=[];for(let r=0;r({b:[2,.5,2.5,1,3,1.5,3.5],"#":[0,1.5,-.5,1,2.5,.5,2]})[i];Flow.parseNoteDurationString=i=>{if(typeof i!="string")return null;const t=/(\d*\/?\d+|[a-z])(d*)([nrhms]|$)/.exec(i);if(!t)return null;const s=t[1],r=t[2].length;let o=t[3];return o.length===0&&(o="n"),{duration:s,dots:r,type:o}};Flow.parseNoteStruct=i=>{const e=i.duration,t=Flow.parseNoteDurationString(e);if(!t)return null;let s=Flow.durationToTicks(t.duration);if(s==null)return null;let r=i.type;const o=[];if(r){if(!Flow.getGlyphProps.validTypes[r])return null}else r=t.type||"n",i.keys!==void 0&&i.keys.forEach((c,d)=>{const m=c.split("/");m&&m.length===3&&(o[d]=m[2])});const a=i.dots?i.dots:t.dots;if(typeof a!="number")return null;let l=s;for(let c=0;c{const e=Flow.durationAliases[i];if(e!==void 0&&(i=e),Flow.durationToTicks.durations[i]===void 0)throw new Vex.RERR("BadArguments",`The provided duration is not valid: ${i}`);return i};Flow.durationToFraction=i=>new Fraction().parse(Flow.sanitizeDuration(i));Flow.durationToNumber=i=>Flow.durationToFraction(i).value();Flow.durationToTicks=i=>{i=Flow.sanitizeDuration(i);const e=Flow.durationToTicks.durations[i];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=(i,e)=>{i=Flow.sanitizeDuration(i);const t=Flow.getGlyphProps.duration_codes[i];if(t===void 0)return null;e||(e="n");let s=t.type[e];if(s===void 0){const r=Flow.keyProperties.customNoteHeads[e.toUpperCase()];if(r===void 0)return null;s={code_head:r.code,...r}}return{...t.common,...s}};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(i=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"v53",i).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(i=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"v1d",i).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(i=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"v81",i).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(i=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",i).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(i=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",i).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(i=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",i).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(i=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",i).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(i=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",i).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(i=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",i).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,t){return Math.max(e,t)>this.CANVAS_BROWSER_SIZE_LIMIT&&(Vex.W("Canvas dimensions exceed browser limit. Cropping to "+this.CANVAS_BROWSER_SIZE_LIMIT),e>this.CANVAS_BROWSER_SIZE_LIMIT&&(e=this.CANVAS_BROWSER_SIZE_LIMIT),t>this.CANVAS_BROWSER_SIZE_LIMIT&&(t=this.CANVAS_BROWSER_SIZE_LIMIT)),[e,t]}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,t,s){return this.vexFlowCanvasContext.font=(s||"")+" "+t+"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,t){return this.vexFlowCanvasContext.scale(parseFloat(e),parseFloat(t))}resize(e,t){return[e,t]=this.SanitizeCanvasDims(parseInt(e,10),parseInt(t,10)),this.vexFlowCanvasContext.resize(e,t)}rect(e,t,s,r){return this.vexFlowCanvasContext.rect(e,t,s,r)}fillRect(e,t,s,r){return this.vexFlowCanvasContext.fillRect(e,t,s,r)}clearRect(e,t,s,r){return this.vexFlowCanvasContext.clearRect(e,t,s,r)}beginPath(){return this.vexFlowCanvasContext.beginPath()}moveTo(e,t){return this.vexFlowCanvasContext.moveTo(e,t)}lineTo(e,t){return this.vexFlowCanvasContext.lineTo(e,t)}bezierCurveTo(e,t,s,r,o,a){return this.vexFlowCanvasContext.bezierCurveTo(e,t,s,r,o,a)}quadraticCurveTo(e,t,s,r){return this.vexFlowCanvasContext.quadraticCurveTo(e,t,s,r)}arc(e,t,s,r,o,a){return this.vexFlowCanvasContext.arc(e,t,s,r,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,t,s){return this.vexFlowCanvasContext.fillText(e,t,s)}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,t,s){return this.state.font_family=e,this.state.font_size=t,this.state.font_weight=s,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,t){return this.state.scale={x:e,y:t},this.attributes.transform="S"+e+","+t+",0,0",this.attributes.scale=e+","+t+",0,0",this.attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this.background_attributes.transform="S"+e+","+t+",0,0",this.background_attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this}clear(){this.paper.clear()}resize(e,t){return this.element.style.width=e,this.paper.setSize(e,t),this}setViewBox(e){this.paper.canvas.setAttribute("viewBox",e)}rect(e,t,s,r){return r<0&&(t+=r,r=-r),this.paper.rect(e,t,s-.5,r-.5).attr(this.attributes).attr("fill","none").attr("stroke-width",this.lineWidth),this}fillRect(e,t,s,r){return r<0&&(t+=r,r=-r),this.paper.rect(e,t,s-.5,r-.5).attr(this.attributes),this}clearRect(e,t,s,r){return r<0&&(t+=r,r=-r),this.paper.rect(e,t,s-.5,r-.5).attr(this.background_attributes),this}beginPath(){return this.path="",this.pen.x=0,this.pen.y=0,this}moveTo(e,t){return this.path+="M"+e+","+t,this.pen.x=e,this.pen.y=t,this}lineTo(e,t){return this.path+="L"+e+","+t,this.pen.x=e,this.pen.y=t,this}bezierCurveTo(e,t,s,r,o,a){return this.path+="C"+e+","+t+","+s+","+r+","+o+","+a,this.pen.x=o,this.pen.y=a,this}quadraticCurveTo(e,t,s,r){return this.path+="Q"+e+","+t+","+s+","+r,this.pen.x=s,this.pen.y=r,this}arc(e,t,s,r,o,a){function l(d){for(;d<0;)d+=Math.PI*2;for(;d>Math.PI*2;)d-=Math.PI*2;return d}if(r=l(r),o=l(o),r>o){const d=r;r=o,o=d,a=!a}const c=o-r;return c>Math.PI?(this.arcHelper(e,t,s,r,r+c/2,a),this.arcHelper(e,t,s,r+c/2,o,a)):this.arcHelper(e,t,s,r,o,a),this}arcHelper(e,t,s,r,o,a){const l=e+s*Math.cos(r),c=t+s*Math.sin(r),d=e+s*Math.cos(o),m=t+s*Math.sin(o);let u=0,g=0;a?(g=1,o-rMath.PI&&(u=1),this.path+="M"+l+","+c+",A"+s+","+s+",0,"+u+","+g+","+d+","+m+"M"+this.pen.x+","+this.pen.y}glow(){const e=this.paper.set();if(this.shadow_attributes.width>0){const t=this.shadow_attributes,s=t.width/2;for(let r=1;r<=s;r++)e.push(this.paper.path(this.path).attr({stroke:t.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(t.width/s*r).toFixed(3),opacity:+((t.opacity||.3)/s).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,t=this.paper.path(this.path).attr(this.attributes).attr("fill","none").attr("stroke-width",e);return this.glow(t),this}closePath(){return this.path+="Z",this}measureText(e){const t=this.paper.text(0,0,e).attr(this.attributes).attr("fill","none").attr("stroke","none"),s=t.getBBox();return t.remove(),{width:s.width,height:s.height}}fillText(e,t,s){return this.paper.text(t+this.measureText(e).width/2,s-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 i={"font-family":!0,"font-weight":!0,"font-style":!0,"font-size":!0};Vex.Merge(attrNamesToIgnoreMap.rect,i),Vex.Merge(attrNamesToIgnoreMap.path,i)}class SVGContext{constructor(e){this.element=e,this.svgNS="http://www.w3.org/2000/svg";const t=this.create("svg");this.element.appendChild(t),this.svg=t,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,t,s){const r=this.create("g");return this.groups.push(r),this.parent.appendChild(r),this.parent=r,e&&r.setAttribute("class",Vex.Prefix(e)),t&&r.setAttribute("id",Vex.Prefix(t)),s&&s.pointerBBox&&r.setAttribute("pointer-events","bounding-box"),r}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,t,s){let r=!1,o=!1,a="normal";typeof s=="string"&&(s.indexOf("italic")!==-1&&(s=s.replace(/italic/g,""),o=!0),s.indexOf("bold")!==-1&&(s=s.replace(/bold/g,""),r=!0),s=s.replace(/ /g,"")),s=r?"bold":s,s=typeof s>"u"||s===""?"normal":s,a=o?"italic":a;const l={"font-family":e,"font-size":t+"pt","font-weight":s,"font-style":a};return this.fontSize=Number(t),Vex.Merge(this.attributes,l),Vex.Merge(this.state,l),this}setRawFont(e){e=e.trim();const t=e.split(" ");return this.attributes["font-family"]=t[1],this.state["font-family"]=t[1],this.attributes["font-size"]=t[0],this.state["font-size"]=t[0],this.fontSize=Number(t[0].match(/\d+/)),this}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,t){this.width=e,this.height=t,this.element.style.width=e;const s={width:e,height:t};return this.applyAttributes(this.svg,s),this.scale(this.state.scale.x,this.state.scale.y),this}scale(e,t){this.state.scale={x:e,y:t};const s=this.width/e,r=this.height/t;return this.setViewBox(0,0,s,r),this}setViewBox(...e){if(e.length===1){const[t]=e;this.svg.setAttribute("viewBox",t)}else{const[t,s,r,o]=e,a=t+" "+s+" "+r+" "+o;this.svg.setAttribute("viewBox",a)}}applyAttributes(e,t){const s=attrNamesToIgnoreMap[e.nodeName];return Object.keys(t).forEach(r=>{var o;s&&s[r]||!r||!t[r]||r==="d"&&((o=t[r])==null?void 0:o.indexOf("NaN"))>-1||e.setAttributeNS(null,r,t[r])}),e}clear(){for(;this.svg.lastChild;)this.svg.removeChild(this.svg.lastChild);this.scale(this.state.scale.x,this.state.scale.y)}rect(e,t,s,r,o){r<0&&(t+=r,r*=-1);const a=this.create("rect");return typeof o>"u"&&(o={fill:"none","stroke-width":this.lineWidth,stroke:"black"}),Vex.Merge(o,{x:e,y:t,width:s,height:r}),this.applyAttributes(a,o),this.add(a),this}fillRect(e,t,s,r){return r<0&&(t+=r,r*=-1),this.rect(e,t,s,r,this.attributes),this}clearRect(e,t,s,r){return this.rect(e,t,s,r,this.background_attributes),this}beginPath(){return this.path="",this.pen.x=NaN,this.pen.y=NaN,this}moveTo(e,t){return this.path+="M"+e+" "+t,this.pen.x=e,this.pen.y=t,this}lineTo(e,t){return this.path+="L"+e+" "+t,this.pen.x=e,this.pen.y=t,this}bezierCurveTo(e,t,s,r,o,a){return this.path+="C"+e+" "+t+","+s+" "+r+","+o+" "+a,this.pen.x=o,this.pen.y=a,this}quadraticCurveTo(e,t,s,r){return this.path+="Q"+e+" "+t+","+s+" "+r,this.pen.x=s,this.pen.y=r,this}arc(e,t,s,r,o,a){function l(d){for(;d<0;)d+=Math.PI*2;for(;d>Math.PI*2;)d-=Math.PI*2;return d}if(r=l(r),o=l(o),r>o){const d=r;r=o,o=d,a=!a}const c=o-r;return c>Math.PI?(this.arcHelper(e,t,s,r,r+c/2,a),this.arcHelper(e,t,s,r+c/2,o,a)):this.arcHelper(e,t,s,r,o,a),this}arcHelper(e,t,s,r,o,a){const l=e+s*Math.cos(r),c=t+s*Math.sin(r),d=e+s*Math.cos(o),m=t+s*Math.sin(o);let u=0,g=0;a?(g=1,o-rMath.PI&&(u=1),this.path+="M"+l+" "+c+" A"+s+" "+s+" 0 "+u+" "+g+" "+d+" "+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,t=e.width/2;for(let s=1;s<=t;s++){const r={stroke:e.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(e.width*.4/t*s).toFixed(3),opacity:+((e.opacity||.3)/t).toFixed(3)},o=this.create("path");r.d=this.path,this.applyAttributes(o,r),this.add(o)}}return this}fill(e){this.glow();const t=this.create("path");let s=e;return typeof e>"u"?(e={},Vex.Merge(e,this.attributes),e.stroke="none",s=e):(s=e,Vex.Merge(s,this.attributes),e.class&&(s.class=e.class),e.id&&(s.id=e.id)),e.d=this.path,this.applyAttributes(t,e),this.add(t),this}stroke(e=void 0){this.glow();const t=this.create("path"),s={};return Vex.Merge(s,this.attributes),e&&Vex.Merge(s,e),s.fill="none",s["stroke-width"]=this.lineWidth,s.d=this.path,this.applyAttributes(t,s),this.add(t),this}measureText(e){const t=this.create("text");if(typeof t.getBBox!="function")return{x:0,y:0,width:0,height:0};t.textContent=e,this.applyAttributes(t,this.attributes),this.svg.appendChild(t);let s=t.getBBox();return this.ie&&e!==""&&this.attributes["font-style"]==="italic"&&(s=this.ieMeasureTextFix(s,e)),this.svg.removeChild(t),s}ieMeasureTextFix(e){const t=Number(this.fontSize),s=1.196,r=1.9598,o=s*t+r,a=e.width-o,l=e.height-1.5;return{x:e.x,y:e.y,width:a,height:l}}fillText(e,t,s){if(!e||e.length<=0)return;const r={};Vex.Merge(r,this.attributes),r.stroke="none",r.x=t,r.y=s;const o=this.create("text");o.textContent=e,this.applyAttributes(o,r),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,t,s,r,o){const a=new Renderer(e,t);s&&r&&a.resize(s,r),o||(o="#FFF");const l=a.getContext();return l.setBackgroundFillStyle(o),Renderer.lastContext=l,l}static getCanvasContext(e,t,s,r){return Renderer.buildContext(e,Renderer.Backends.CANVAS,t,s,r)}static getRaphaelContext(e,t,s,r){return Renderer.buildContext(e,Renderer.Backends.RAPHAEL,t,s,r)}static getSVGContext(e,t,s,r){return Renderer.buildContext(e,Renderer.Backends.SVG,t,s,r)}static bolsterCanvasContext(e){if(Renderer.USE_CANVAS_PROXY)return new CanvasContext(e);const t=["clear","setFont","setRawFont","setFillStyle","setBackgroundFillStyle","setStrokeStyle","setShadowColor","setShadowBlur","setLineWidth","setLineCap","setLineDash","openGroup","closeGroup","getGroup"];return e.vexFlowCanvasContext=e,t.forEach(s=>{e[s]=e[s]||CanvasContext.prototype[s]}),e}static drawDashedLine(e,t,s,r,o,a){e.beginPath();const l=r-t,c=o-s,d=Math.atan2(c,l);let m=t,u=s;e.moveTo(t,s);let g=0,b=!0;for(;!((l<0?m<=r:m>=r)&&(c<0?u<=o:u>=o));){const y=a[g++%a.length],S=m+Math.cos(d)*y;m=l<0?Math.max(r,S):Math.min(r,S);const v=u+Math.sin(d)*y;u=c<0?Math.max(o,v):Math.min(o,v),b?e.lineTo(m,u):e.moveTo(m,u),b=!b}e.closePath(),e.stroke()}constructor(e,t){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=t,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"))}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,t){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,t]=CanvasContext.SanitizeCanvasDims(e,t);const s=window.devicePixelRatio||1;this.element.width=e*s,this.element.height=t*s,this.element.style.width=e+"px",this.element.style.height=t+"px",this.ctx=Renderer.bolsterCanvasContext(this.element.getContext("2d")),this.ctx.scale(s,s)}else this.ctx.resize(e,t);return this}getContext(){return this.ctx}}function L$j(...i){Stem.DEBUG&&Vex.L("Vex.Flow.Stem",i)}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.resetHeight=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,t){return this.x_begin=e,this.x_end=t,this}setDirection(e){this.stem_direction=e}setExtension(e){this.stem_extension=e}getExtension(){return this.stem_extension}setYBounds(e,t){this.y_top=e,this.y_bottom=t}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,t=[this.y_top,this.y_bottom],s=Stem.HEIGHT+this.stem_extension,r=(e?Math.min:Math.max)(...t),o=(e?Math.max:Math.min)(...t);return{topY:r+s*-this.stem_direction+this.resetHeight*-this.stem_direction,baseY:o}}setVisibility(e){return this.hide=!e,this}setStemlet(e,t){return this.isStemlet=e,this.stemletHeight=t,this}draw(){if(this.setRendered(),this.hide)return;const e=this.checkContext();let t,s;const r=this.stem_direction;r===Stem.DOWN?(t=this.x_begin,s=this.y_top+this.stem_down_y_offset):(t=this.x_end,s=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(t,s-a),e.lineTo(t,s-o-this.renderHeightAdjustment*r-this.resetHeight*r),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 ct extends Element$1{static get LOCATION_TOP(){return 1}static get LOCATION_BOTTOM(){return-1}static get NESTING_OFFSET(){return 15}constructor(e,t){if(super(),this.setAttribute("type","Tuplet"),!e||!e.length)throw new Vex.RuntimeError("BadArguments","No notes provided for tuplet.");this.options=Vex.Merge({},t),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(s=>s.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||ct.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,t=this.notes[0];let s=o(t,e),r=o(t,e);function o(a,l){return a.tupletStack.filter(c=>c.location===l).length}return this.notes.forEach(a=>{const l=o(a,e);s=l>s?l:s,r=lr&&(r=a)}}return r+e+t}draw(){this.checkContext(),this.setRendered();const e=this.notes[0],t=this.notes[this.notes.length-1];this.bracketed?(this.x_pos=e.getTieLeftX()-5,this.width=t.getTieRightX()-this.x_pos+5):(this.x_pos=e.getStemX(),this.width=t.getStemX()-this.x_pos),this.y_pos=this.getYPosition();const s=(c,d)=>c+d.getMetrics().width;let r=this.numerator_glyphs.reduce(s,0);this.ratioed&&(r=this.denom_glyphs.reduce(s,r),r+=this.point*.32);const a=this.x_pos+this.width/2-r/2;if(this.bracketed){const c=this.width/2-r/2-5;c>0&&(this.context.fillRect(this.x_pos,this.y_pos,c,1),this.context.fillRect(this.x_pos+this.width/2+r/2+5,this.y_pos,c,1),this.context.fillRect(this.x_pos,this.y_pos+(this.location===ct.LOCATION_BOTTOM),1,this.location*10),this.context.fillRect(this.x_pos+this.width,this.y_pos+(this.location===ct.LOCATION_BOTTOM),1,this.location*10))}let l=0;if(this.numerator_glyphs.forEach(c=>{c.render(this.context,a+l,this.y_pos+this.point/3-2),l+=c.getMetrics().width}),this.ratioed){const c=a+l+this.point*.16,d=this.point*.06;this.context.beginPath(),this.context.arc(c,this.y_pos-this.point*.08,d,0,Math.PI*2,!0),this.context.closePath(),this.context.fill(),this.context.beginPath(),this.context.arc(c,this.y_pos+this.point*.12,d,0,Math.PI*2,!0),this.context.closePath(),this.context.fill(),l+=this.point*.32,this.denom_glyphs.forEach(m=>{m.render(this.context,a+l,this.y_pos+this.point/3-2),l+=m.getMetrics().width})}}};function calculateStemDirection(i){let e=0;return i.forEach(t=>{t.keyProps&&t.keyProps.forEach(s=>{e+=s.line-3})}),e>=0?Stem.DOWN:Stem.UP}const getStemSlope=(i,e)=>{const t=i.getStemExtents().topY,s=i.getStemX(),r=e.getStemExtents().topY,o=e.getStemX();return(r-t)/(o-s)},BEAM_LEFT="L",BEAM_RIGHT="R",BEAM_BOTH="B";let Beam$1=class zt extends Element$1{static getDefaultBeamGroups(e){(!e||e==="c")&&(e="4/4");const s={"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(s===void 0){const r=parseInt(e.split("/")[0],10),o=parseInt(e.split("/")[1],10);if(r%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 s.map(r=>new Fraction().parse(r));return[new Fraction(1,4)]}static applyAndGetBeams(e,t,s){return zt.generateBeams(e.getTickables(),{groups:s,stem_direction:t})}static generateBeams(e,t){t||(t={}),(!t.groups||!t.groups.length)&&(t.groups=[new Fraction(2,8)]);const s=t.groups.map(_=>{if(!_.multiply)throw new Vex.RuntimeError("InvalidBeamGroups","The beam groups must be an array of Vex.Flow.Fractions");return _.clone().multiply(Flow.RESOLUTION,1)}),r=e;let o=0,a=[],l=[];function c(_){return _.reduce((w,C)=>C.getTicks().clone().add(w),new Fraction(0,1))}function d(){s.length-1>o?o+=1:o=0}function m(){let _=[];r.forEach(w=>{if(_=[],w.shouldIgnoreTicks()){a.push(l),l=_;return}l.push(w);const C=s[o].clone(),P=c(l),I=Flow.durationToNumber(w.duration)<8;I&&w.tuplet&&(C.numerator*=2),P.greaterThan(C)?(I||_.push(l.pop()),a.push(l),l=_,d()):P.equals(C)&&(a.push(l),l=_,d())}),l.length>0&&a.push(l)}function u(){return a.filter(_=>{if(_.length>1){let w=!0;return _.forEach(C=>{C.getIntrinsicTicks()>=Flow.durationToTicks("4")&&(w=!1)}),w}return!1})}function g(){const _=[];a.forEach(w=>{let C=[];w.forEach((P,I,N)=>{const R=I===0||I===N.length-1,F=N[I-1],B=!t.beam_rests&&P.isRest(),k=t.beam_rests&&t.beam_middle_only&&P.isRest()&&R;let M=!1;if(t.maintain_stem_directions&&F&&!P.isRest()&&!F.isRest()){const $=F.getStemDirection();M=P.getStemDirection()!==$}const G=parseInt(P.duration,10)<8;B||k||M||G?(C.length>0&&_.push(C),C=M?[P]:[]):C.push(P)}),C.length>0&&_.push(C)}),a=_}function b(){a.forEach(_=>{let w;if(t.maintain_stem_directions){const C=y(_);w=C?C.getStemDirection():Stem.UP}else t.stem_direction?w=t.stem_direction:w=calculateStemDirection(_);S(_,w)})}function y(_){for(let w=0;w<_.length;w++){const C=_[w];if(!C.isRest())return C}return!1}function S(_,w){_.forEach(C=>{C.setStemDirection(w)})}function v(){const _=[];return a.forEach(w=>{let C=null;w.forEach(P=>{P.tuplet&&C!==P.tuplet&&(C=P.tuplet,_.push(C))})}),_}m(),g(),b();const x=u(),A=v(),E=[];return x.forEach(_=>{const w=new zt(_);t.show_stemlets&&(w.render_options.show_stemlets=!0),t.secondary_breaks&&(w.render_options.secondary_break_ticks=Flow.durationToTicks(t.secondary_breaks)),t.flat_beams===!0&&(w.render_options.flat_beams=!0,w.render_options.flat_beam_offset=t.flat_beam_offset),E.push(w)}),A.forEach(_=>{const w=_.notes[0].stem_direction===Stem.DOWN?Tuplet$1.LOCATION_BOTTOM:Tuplet$1.LOCATION_TOP;_.setTupletLocation(w);let C=!1;for(let P=0;P<_.notes.length;P++)if(_.notes[P].beam===null){C=!0;break}_.setBracketed(C)}),E}constructor(e,t){if(super(),this.setAttribute("type","Beam"),!e||e===[])throw new Vex.RuntimeError("BadArguments","No notes provided for beam.");if(e.length===1)throw new Vex.RuntimeError("BadArguments","Too few notes for beam.");if(this.ticks=e[0].getIntrinsicTicks(),this.ticks>=Flow.durationToTicks("4"))throw new Vex.RuntimeError("BadArguments","Beams can only be applied to notes shorter than a quarter note.");let s,r;for(this.stem_direction=Stem.UP,s=0;sl+c.stem_direction,0)>-1?Stem.UP:Stem.DOWN),s=0;ss.getGlyph().beam_count).reduce((s,r)=>r>s?r:s)}breakSecondaryAt(e){return this.break_on_indices=e,this}getSlopeY(e,t,s,r){return s+(e-t)*r}calculateSlope(){const{notes:e,stem_direction:t,render_options:{max_slope:s,min_slope:r,slope_iterations:o,slope_cost:a}}=this,l=e[0],c=getStemSlope(l,e[e.length-1]),d=(s-r)/o;let m=Number.MAX_VALUE,u=0,g=0;for(let b=r;b<=s;b+=d){let y=0,S=0;for(let E=1;Ev)&&(d=v,l=Math.min(...S.getYs()),c=S.getBeamCount())}let m=a/e.length;const u=s*1.5,g=r+c*u,b=l+g*-t;t===Stem.DOWN&&mb&&(m=l-g),o+this.render_options.flat_beam_offset_per_beam>0?t===Stem.DOWN&&m>o&&!this.render_options.flat_beams?this.render_options.flat_beam_offset=m:t===Stem.UP&&m0){let r=this.render_options.flat_beam_offset;this.render_options.flat_beam_offset_per_beam&&(r+=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);s=o+r*-this.stem_direction}return s}applyStemExtensions(){const{notes:e,slope:t,y_shift:s,stem_direction:r,beam_count:o,render_options:{show_stemlets:a,stemlet_extension:l,beam_width:c}}=this,d=e[0],m=this.getBeamYToDraw(),u=d.getStemX();for(let g=0;g=8&&(b=this.break_on_indices.indexOf(m)!==-1,this.render_options.secondary_break_ticks&&c>=this.render_options.secondary_break_ticks&&(c=0,b=!0));const y=u.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"],t=this.notes[0];let s=this.getBeamYToDraw();const r=t.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,t=this.stave){this.setRendered();let s=null;for(let r=0;r0&&s){const a=o.getBoundingBox();a&&s.mergeWith(a)}o.setContext(e),o.drawWithStyle()}this.boundingBox=s}};function drawBoldDoubleLine(i,e,t,s,r){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),i.fillRect(t+o,s,1,r-s),i.fillRect(t-l,s,a,r-s)}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,t){super(),this.setAttribute("type","StaveConnector"),this.thickness=Flow.STAVE_LINE_THICKNESS,this.width=3,this.top_stave=e,this.bottom_stave=t,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,t){return this.texts.push({content:e,options:Vex.Merge({shift_x:0,shift_y:0},t)}),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 t=this.top_stave.getYForLine(0),s=this.bottom_stave.getYForLine(this.bottom_stave.getNumLines()-1)+this.thickness,r=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=s-t;switch(this.type){case StaveConnector.type.SINGLE:r=1;break;case StaveConnector.type.SINGLE_LEFT:r=1;break;case StaveConnector.type.SINGLE_RIGHT:r=1;break;case StaveConnector.type.DOUBLE:o-=this.width+2;break;case StaveConnector.type.BRACE:{r=12;const c=this.top_stave.getX()-2+this.x_shift,d=t,m=c,u=s,g=c-r,b=d+l/2,y=g-.9*r,S=d+.2*l,v=c+1.1*r,x=b-.135*l,A=v,E=b+.135*l,_=y,w=u-.2*l,C=g-r,P=w,I=c+.4*r,N=b+.135*l,R=I,F=b-.135*l,B=C,k=S;e.beginPath(),e.moveTo(c,d),e.bezierCurveTo(y,S,v,x,g,b),e.bezierCurveTo(A,E,_,w,m,u),e.bezierCurveTo(C,P,I,N,g,b),e.bezierCurveTo(R,F,B,k,c,d),e.fill(),e.stroke();break}case StaveConnector.type.BRACKET:t-=4,s+=4,l=s-t,Glyph.renderGlyph(e,o-5,t-3,40,"v1b",!0),Glyph.renderGlyph(e,o-5,s+3,40,"v10",!0),o-=this.width+2;break;case StaveConnector.type.BOLD_DOUBLE_LEFT:drawBoldDoubleLine(e,this.type,o+this.x_shift,t,s);break;case StaveConnector.type.BOLD_DOUBLE_RIGHT:drawBoldDoubleLine(e,this.type,o,t,s);break;case StaveConnector.type.THIN_DOUBLE:r=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,t,r,l),this.type===StaveConnector.type.THIN_DOUBLE&&e.fillRect(o-3,t,r,l),e.save(),e.lineWidth=2,e.setFont(this.font.family,this.font.size,this.font.weight);for(let c=0;c0){const v=S.space.deviation,x=v>=0?"+":"";e.setFillStyle("red"),e.fillText(x+Math.round(v),l+t.getXShift(),s-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 t=Flow.parseNoteStruct(e);if(!t)throw new Vex.RuntimeError("BadArguments",`Invalid note initialization object: ${JSON.stringify(e)}`);if(this.duration=t.duration,this.dots=t.dots,this.noteType=t.type,this.customTypes=t.customTypes,this.DYMusicScoreType=e.DYMusicScoreType,e.duration_override?this.setDuration(e.duration_override):this.setIntrinsicTicks(t.ticks),this.modifiers=[],this.glyph=Flow.getGlyphProps(this.duration,this.noteType),this.customGlyphs=this.customTypes.map(s=>Flow.getGlyphProps(this.duration,s)),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,t){return t.setNote(this),t.setIndex(e),this.modifiers.push(t),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.glyph.getWidth(this.render_options.glyph_font_scale):15}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,t=0){return e.setNote(this),e.setIndex(t),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,t=0;this.modifierContext!=null&&(e=this.modifierContext.state.left_shift,t=this.modifierContext.state.right_shift);const s=this.getWidth();return{width:s,noteWidth:s-e-t-this.extraLeftPx-this.extraRightPx,left_shift:this.x_shift,modLeftPx:e,modRightPx:t,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()&&(this.DYMusicScoreType==="jianpu"||(e+=this.getCenterXShift())),e}setPreFormatted(e){if(this.preFormatted=e,this.preFormatted){const t=this.tickContext.getExtraPx();this.left_modPx=Math.max(this.left_modPx,t.left),this.right_modPx=Math.max(this.right_modPx,t.right)}}}function L$i(...i){NoteHead.DEBUG&&Vex.L("Vex.Flow.NoteHead",i)}function drawSlashNoteHead(i,e,t,s,r,o){const a=Flow.SLASH_NOTEHEAD_WIDTH;i.save(),i.setLineWidth(Flow.STEM_WIDTH);let l=!1;if(Flow.durationToNumber(e)>2&&(l=!0),l||(t-=Flow.STEM_WIDTH/2*r),i.beginPath(),i.moveTo(t,s+o),i.lineTo(t,s+1),i.lineTo(t+a,s-o),i.lineTo(t+a,s),i.lineTo(t,s+o),i.closePath(),l?i.fill():i.stroke(),Flow.durationToFraction(e).equals(.5)){const c=[-3,-1,a+1,a+3];for(let d=0;d{const l=a.getTickContext();a.setStave(t.stave),l.setXOffset(o)})}}class Dot extends Modifier{static get CATEGORY(){return"dots"}static format(e,t){const s=t.right_shift,r=1;if(!e||e.length===0)return!1;const o=[],a={};for(let b=0;by.line-b.line);let l=s,c=0,d=null,m=null,u=null,g=0;for(let b=0;bc?l:c,d=x,m=S}return t.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,t=this.note.getModifierStartXY(this.position,this.index,{forceFlagRight:!0});this.note.getCategory()==="tabnotes"&&(t.y=this.note.getStemExtents().baseY+1);const s=t.x+this.x_shift+this.width-this.radius,r=t.y+this.y_shift+this.dot_shiftY*e,o=this.context;o.beginPath(),o.arc(s,r,this.radius,0,Math.PI*2,!1),o.fill()}}function L$h(...i){StaveNote.DEBUG&&Vex.L("Vex.Flow.StaveNote",i)}const getStemAdjustment=i=>Stem.WIDTH/(2*-i.getStemDirection()),isInnerNoteIndex=(i,e)=>e===(i.getStemDirection()===Stem.UP?i.keyProps.length-1:0);function shiftRestVertical(i,e,t){const s=(e.isrest?0:1)*t;i.line+=s,i.maxLine+=s,i.minLine+=s,i.note.setKeyLine(0,i.note.getKeyLine(0)+s)}function centerRest(i,e,t){const s=i.line-Vex.MidLine(e.minLine,t.maxLine);i.note.setKeyLine(0,i.note.getKeyLine(0)-s),i.line-=s,i.maxLine-=s,i.minLine-=s}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,t,s,r){let{width:o,height:a,wave_width:l,wave_girth:c,wave_height:d,stem_direction:m}=r;const u=Math.floor(o/l);let g=a/(u/2)*m;g==0&&(m=1,g=.3),e.beginPath(),e.moveTo(t,s+c);for(let b=0;b2?s[1]:null;let c=o>2?s[2]:s[1];o===2&&a.stemDirection===-1&&c.stemDirection===1&&(a=s[1],c=s[0]);const d=Math.max(a.voice_shift,c.voice_shift);let m=0,u;if(o===2){const g=a.stemDirection===c.stemDirection?0:.5;if(a.stemDirection===c.stemDirection&&a.minLine<=c.maxLine&&(a.isrest||(u=Math.abs(a.line-(c.maxLine+.5)),u=Math.max(u,a.stemMin),a.minLine=a.line-u,a.note.setStemLength(u*10))),a.minLine<=c.maxLine+g)if(a.isrest)shiftRestVertical(a,c,1);else if(c.isrest)shiftRestVertical(c,a,-1);else{m=d;const b=Math.abs(a.line-c.line);let y=0,S=0;a.note.duration==="h"?y++:a.note.duration==="w"&&S++,c.note.duration==="h"?y++:c.note.duration==="w"&&S++;let v=y===1||S===1||a.note.dots!==c.note.dots;if(r&&(v=v||S===2),b===0&&v){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 b<1&&b>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.minLinet.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.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(t=>t.getStyle());this.buildNoteHeads(),this.note_heads.forEach((t,s)=>t.setStyle(e[s])),this.stave&&this.note_heads.forEach(t=>t.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(),t=this.getKeys();let s=null,r=null,o=!1,a,l,c;e===Stem.UP?(a=0,l=t.length,c=1):e===Stem.DOWN&&(a=t.length-1,l=-1,c=-1);for(let d=a;d!==l;d+=c){const m=this.keyProps[d],u=m.line;s===null?s=u:(r=Math.abs(s-u),r===0||r===.5?o=!o:(o=!1,this.use_default_head_x=!0)),s=u;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,line:m.line});this.note_heads[d]=g}}autoStem(){this.minLine=this.keyProps[0].line,this.maxLine=this.keyProps[this.keyProps.length-1].line;const e=3,s=(this.minLine+this.maxLine)/20&&(this.keyProps[t-1].displaced=!0)),e=a,this.keyProps.push(o)}e=-1/0,this.keyProps.forEach(t=>{t.linet.line-s.line)}getBoundingBox(){if(!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call getBoundingBox on an unformatted note.");const{width:e,modLeftPx:t,extraLeftPx:s}=this.getMetrics(),r=this.getAbsoluteX()-t-s;let o=0,a=0;const l=this.getStave().getSpacingBetweenLines()/2,c=l*2;if(this.isRest()){const d=this.ys[0],m=Flow.durationToFraction(this.duration);m.equals(1)||m.equals(2)?(o=d-l,a=d+l):(o=d-this.glyph.line_above*c,a=d+this.glyph.line_below*c)}else if(this.glyph.stem){const d=this.getStemExtents();d.baseY+=l*this.stem_direction,o=Math.min(d.topY,d.baseY),a=Math.max(d.topY,d.baseY)}else{o=null,a=null;for(let d=0;dt&&(t=r):r1}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 t=this.getStemExtents();return Math.min(this.stave.getYForTopText(e),t.topY-this.render_options.annotation_spacing*(e+1))}getYForBottomText(e){const t=this.getStemExtents();return Math.max(this.stave.getYForTopText(e),t.baseY+this.render_options.annotation_spacing*e)}setStave(e){super.setStave(e);const t=this.note_heads.map(s=>(s.setStave(e),s.getY()));if(this.setYs(t),this.stem){const{y_top:s,y_bottom:r}=this.getNoteHeadBounds();this.stem.setYBounds(s,r)}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 t=this.keyProps[this.keyProps.length-1].line,s=Math.max(e,t),r=Math.min(e,t);e=Vex.MidLine(s,r)}return e}getModifierStartXY(e,t,s){if(s=s||{},!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:r,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()&&(s.forceFlagRight||isInnerNoteIndex(this,t))&&(c+=this.flag.getMetrics().width)):(e===o||e===r)&&(c=this.getGlyphWidth()/2),{x:this.getAbsoluteX()+c,y:this.ys[t]}}setStyle(e){super.setStyle(e),this.note_heads.forEach(t=>t.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,t){return this.note_heads[e].setStyle(t),this}setKeyLine(e,t){return this.keyProps[e].line=t,this.reset(),this}getKeyLine(e){return this.keyProps[e].line}addToModifierContext(e){this.setModifierContext(e);for(let t=0;t{const g=u.getLine(),b=u.getY();(e===null||bt)&&(t=b),r===null&&u.isDisplaced()&&(r=u.getAbsoluteX()),s===null&&!u.isDisplaced()&&(s=u.getAbsoluteX()),o=g>o?g:o,a=g{let w;_&&E?w=S-s:E?w=y-s:w=b-s;const C=E&&_?a:o;r.beginPath(),r.moveTo(w,A),r.lineTo(w+C,A),r.stroke()},x={...e.getStyle()||{},...this.getLedgerLineStyle()||{}};this.applyStyle(r,x);for(let A=6;A<=l;++A){const E=y!==null&&A<=m,_=b!==null&&A<=d;v(e.getYForNote(A),E,_)}for(let A=0;A>=c;--A){const E=y!==null&&A>=g,_=b!==null&&A>=u;v(e.getYForNote(A),E,_)}this.restoreStyle(r,x)}drawVibrato(){if(this.vibrato){const e=this.context,t=this.vibrato.getNoteHeadEndX()+2;let{y_bottom:s}=this.vibrato.getNoteHeadBounds(),{y_top:r}=this.getNoteHeadBounds();const o=s6.5||u<-.5)&&(m=m+(u>6.5?(u-6.5)*10:(u+.5)*10))}s.openGroup("flag",null,{pointerBBox:!0}),this.applyStyle(s,this.getFlagStyle()||!1),this.flag.render(s,d,m),this.restoreStyle(s,this.getFlagStyle()||!1),s.closeGroup()}}drawNoteHeads(){this.note_heads.forEach(e=>{this.context.openGroup("notehead",null,{pointerBBox:!0});try{if(this.isRest()&&this.duration==="w"){const t=this.stave.options.line_config.filter(r=>r.visible).length;this.keyProps[0].line===4&&t<5&&e.setY(e.getY()+10),t===1&&e.setLine(3)}}catch(t){}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 r=0;rr.setX(t)),this.stem){let r=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(r,r)}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}),s&&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,t){const{left_shift:s,right_shift:r}=t,o=1;if(!e||e.length===0)return!1;const a=[];let l=null,c=0,d=0;for(let v=0;vx.line-v.line);let m=0,u=0,g=0,b=0,y=null,S=null;for(let v=0;vg?x:g):E===Modifier.Position.RIGHT&&(_.setXShift(u),x=d+I,b=x>b?x:b),y=w,S=A}return t.left_shift+=g,t.right_shift+=b,!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,t=this.note.getModifierStartXY(this.position,this.index);let s=t.x+this.x_shift+this.x_offset,r=t.y+this.y_shift+this.y_offset+5;switch(this.position){case Modifier.Position.ABOVE:s-=4,r-=12;break;case Modifier.Position.BELOW:s-=2,r+=10;break;case Modifier.Position.LEFT:s-=this.width;break;case Modifier.Position.RIGHT:s+=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,s,r),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 t=e.toLowerCase(),r=/^([cdefgab])(b|bb|n|#|##)?$/.exec(t);if(r!=null){const o=r[1],a=r[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 t=e.toLowerCase(),r=/^([cdefgab])(b|#)?(mel|harm|m|M)?$/.exec(t);if(r!=null){const o=r[1],a=r[2];let l=r[3];return l||(l="M"),{root:o,accidental:a,type:l}}else throw new Vex.RERR("BadArguments",`Invalid key: ${e}`)}getNoteValue(e){const t=Music.noteValues[e];if(t==null)throw new Vex.RERR("BadArguments",`Invalid note name: ${e}`);return t.int_val}getIntervalValue(e){const t=Music.intervals[e];if(t==null)throw new Vex.RERR("BadArguments",`Invalid interval name: ${e}`);return t}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,t,s){if(s==null&&(s=1),s!==1&&s!==-1)throw new Vex.RERR("BadArguments",`Invalid direction: ${s}`);let r=(e+s*t)%Music.NUM_TONES;return r<0&&(r+=Music.NUM_TONES),r}getRelativeNoteName(e,t){const s=this.getNoteParts(e),r=this.getNoteValue(s.root);let o=t-r;if(Math.abs(o)>Music.NUM_TONES-3){let l=1;o>0&&(l=-1);const c=(t+1+(r+1))%Music.NUM_TONES*l;if(Math.abs(c)>2)throw new Vex.RERR("BadArguments",`Notes not related: ${e}, ${t})`);o=c}if(Math.abs(o)>2)throw new Vex.RERR("BadArguments",`Notes not related: ${e}, ${t})`);let a=s.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,t){const s=[e];let r=e;for(let o=0;oi.getMetrics().width;class Accidental extends Modifier{static get CATEGORY(){return"accidentals"}static format(e,t){const r=t.left_shift+1,o=3;if(!e||e.length===0)return;const a=[];let l=null,c=0,d;for(let A=0;AE.line-A.line);const m=[];let u=0,g=null;for(let A=0;Au?E.shift:u,g=E.line}let b=0;for(let A=0;Am[_+M],P=M=>M.map(C),I=(M,G)=>{const[ee,$]=P([M,G]).map(re=>re.line);return ee-$},N=(...M)=>M.map(P).every(G=>!this.checkCollision(...G)),R=w-_+1;let F=this.checkCollision(m[_],m[w])?"a":"b";switch(R){case 3:F==="a"&&I(1,2)===.5&&I(0,1)!==.5&&(F="second_on_bottom");break;case 4:N([0,2],[1,3])&&(F="spaced_out_tetrachord");break;case 5:F==="b"&&N([1,3])&&(F="spaced_out_pentachord",N([0,2],[2,4])&&(F="very_spaced_out_pentachord"));break;case 6:N([0,3],[1,4],[2,5])&&(F="spaced_out_hexachord"),N([0,2],[2,4],[1,3],[3,5])&&(F="very_spaced_out_hexachord");break}let B,k;if(R>=7){let M=2,G=!0;for(;G===!0;){G=!1;for(let ee=0;ee+Mk?b:k}else for(B=A;B<=w;B++)k=Flow.accidentalColumnsTable[R][F][B-A],m[B].column=k,b=b>k?b:k;A=w}const y=[],S=[];for(let A=0;A<=b;A++)y[A]=0,S[A]=0;y[0]=u+r,S[0]=u+r,m.forEach(A=>{A.width>y[A.column]&&(y[A.column]=A.width)});for(let A=1;A{let E=0;const _=x+A.numAcc;for(x;x<_;x++){const w=S[A.column-1]+E;a[x].acc.setXShift(w),E+=a[x].acc.getWidth()+o,L$g("Line, accCount, shift: ",A.line,x,w)}}),t.left_shift+=v}static checkCollision(e,t){let s=t.line-e.line,r=3;s>0?(r=t.flatLine||t.dblSharpLine?2.5:3,e.dblSharpLine&&(s-=.5)):(r=e.flatLine||e.dblSharpLine?2.5:3,t.dblSharpLine&&(s-=.5));const o=Math.abs(s){const c=new Fraction(0,1);l.getTickables().forEach(m=>{if(m.shouldIgnoreTicks())return;const u=r[c.value()];u?u.push(m):(s.push(c.value()),r[c.value()]=[m]),c.add(m.getTicks())})});const o=new Music;t||(t="C");const a=o.createScaleMap(t);s.forEach(l=>{const c=r[l],d=[],m=u=>{u.isRest()||u.shouldIgnoreTicks()||(u.keys.forEach((g,b)=>{const y=o.getNoteParts(g.split("/")[0]),S=y.accidental||"n",v=y.root+S,x=a[y.root]===v,A=d.indexOf(v)>-1;if(!x||x&&A){a[y.root]=v;const E=new Accidental(S);u.addAccidental(b,E),d.push(v)}}),u.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:t,position:s,note:r,index:o,cautionary:a,x_shift:l,y_shift:c,glyph:d,parenLeft:m,parenRight:u,render_options:{parenLeftPadding:g,parenRightPadding:b}}=this;if(this.checkContext(),!(r&&o!=null))throw new Vex.RERR("NoAttachedNote","Can't draw accidental without a note and index.");const y=r.getModifierStartXY(s,o);let S=y.x+l;const v=y.y+c;L$g("Rendering: ",t,S,v),a?(u.render(e,S,v),S-=getGlyphWidth(u),S-=b,S-=this.accidental.parenRightPaddingAdjustment,d.render(e,S,v),S-=getGlyphWidth(d),S-=g,m.render(e,S,v)):d.render(e,S,v),this.setRendered()}}let NoteSubGroup$1=class ai extends Modifier{static get CATEGORY(){return"notesubgroup"}static format(e,t){if(!e||e.length===0)return!1;let s=0;for(let r=0;r{t.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 ai.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(t=>t.setContext(this.context).drawWithStyle())}};class StaveTie extends Element$1{constructor(e,t){super(),this.setAttribute("type","StaveTie"),this.notes=e,this.context=null,this.text=t,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:15,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 t=this.context;let s=this.render_options.cp1,r=this.render_options.cp2;Math.abs(e.last_x_px-e.first_x_px)<10&&(s=2,r=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;cg&&Math.abs(m-g)<10?-6:0;if(this.first_note&&this.first_note.DYMusicScoreType==="jianpu"){if(this.getAttribute("type")==="TabTie")continue;m1){const t=new Beam$1(e);t.render_options.beam_width=3,t.render_options.partial_beam_length=4,this.beams.push(t)}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(t=>{t.setContext(this.context).draw()}),this.beams.forEach(t=>{t.setContext(this.context).draw()}),this.show_slur){const t=this.getNote().getCategory()===StaveNote.CATEGORY,s=t?StaveTie:TabTie;this.slur=new s({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=(t?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,t){const s=t.left_shift,r=0;if(!e||e.length===0)return this;const o=e.map(c=>{const d=c.getNote();if(d instanceof StaveNote){const{line:m,displaced:u}=d.getKeyProps()[c.getIndex()],g=u?d.getExtraLeftPx():0;return{line:m,shift:g,stroke:c}}else{const{str:m}=d.getPositions()[c.getIndex()];return{line:m,shift:0,stroke:c}}}),a=s,l=o.reduce((c,{stroke:d,shift:m})=>(d.setXShift(a+m),Math.max(d.getWidth()+r,c)),0);return t.left_shift+=l,!0}constructor(e,t){super(),this.setAttribute("type","Stroke"),this.note=null,this.options=Vex.Merge({},t),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 t=this.note.getYs(),s=e.y,r=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 b=0;bw.line-_.line);let S=0,v=0,x=0,A=null,E=null;for(m=0;mv?_:v):b===Modifier.Position.RIGHT&&(u.setXShift(S),_+=P,x=_>x?_:x),A=w,E=g}return t.left_shift+=v,t.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 t=this.note.stave.options.spacing_between_lines_px,s=this.note.getModifierStartXY(this.position,this.index);let r=s.x+this.x_shift+this.x_offset,o=s.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,d=l.baseY+2;this.note.stem_direction===StaveNote.STEM_DOWN&&(c=l.baseY,d=l.topY-2),this.position===Modifier.Position.ABOVE?o=this.note.hasStem()?c-t*1.75:s.y-t*1.75:o=this.note.hasStem()?d+t*1.5:s.y+t*1.75,o+=this.y_shift+this.y_offset;break}case Modifier.Position.LEFT:r-=this.radius/2+5;break;case Modifier.Position.RIGHT:r+=this.radius/2+6;break;default:throw new Vex.RERR("InvalidPosition",`The position ${this.position} is invalid`)}e.save(),e.beginPath(),e.arc(r,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=r-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,r+10,o,r+l,o,[3,3]):Renderer.drawDashedLine(e,r+10,o,r+l,o,[3,0]);let c,d;switch(this.leg){case Renderer.LineEndType.UP:c=-10,d=this.dashed?[3,3]:[3,0],Renderer.drawDashedLine(e,r+l,o,r+l,o+c,d);break;case Renderer.LineEndType.DOWN:c=10,d=this.dashed?[3,3]:[3,0],Renderer.drawDashedLine(e,r+l,o,r+l,o+c,d);break}}e.restore()}}function L$e(...i){Articulation$1.DEBUG&&Vex.L("Vex.Flow.Articulation",i)}const{ABOVE,BELOW}=Modifier.Position,roundToNearestHalf=(i,e)=>i(e/.5)*.5,isWithinLines=(i,e)=>e===ABOVE?i<=5:i>=1,getRoundingFunction=(i,e)=>isWithinLines(i,e)?e===ABOVE?Math.ceil:Math.floor:Math.round,snapLineToStaff=(i,e,t,s)=>{const r=roundToNearestHalf(getRoundingFunction(e,t),e),o=i&&isWithinLines(r,t),a=r%1===0;return o&&a?r+.5*-s:r},isStaveNote=i=>{const e=i.getCategory();return e==="stavenotes"||e==="gracenotes"},isTabNote=i=>{const e=i.getCategory();return e==="tabnotes"||e==="numberednotes"},getTopY=(i,e)=>{const t=i.getStave(),s=i.getStemDirection(),{topY:r,baseY:o}=i.getStemExtents();if(isStaveNote(i))return i.hasStem()?s===Stem.UP?r:o:Math.min(...i.getYs());if(isTabNote(i))return i.hasStem()&&s===Stem.UP?r:t.getYForTopText(e);throw new Vex.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")},getBottomY=(i,e)=>{const t=i.getStave(),s=i.getStemDirection(),{topY:r,baseY:o}=i.getStemExtents();if(isStaveNote(i))return i.hasStem()?s===Stem.UP?o:r:Math.max(...i.getYs());if(isTabNote(i))return i.hasStem()?s===Stem.UP?t.getYForBottomText(e):r:t.getYForBottomText(e);throw new Vex.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")},getInitialOffset=(i,e)=>{const t=e===ABOVE&&i.getStemDirection()===Stem.UP||e===BELOW&&i.getStemDirection()===Stem.DOWN;return isStaveNote(i)?i.hasStem()&&t?.5:1:i.hasStem()&&t?1:0};let Articulation$1=class kt extends Modifier{static get CATEGORY(){return"articulations"}static get INITIAL_OFFSET(){return-.5}static format(e,t){if(!e||e.length===0)return!1;const s=c=>c.getPosition()===ABOVE,r=c=>c.getPosition()===BELOW,o=.5,a=(c,d,m)=>roundToNearestHalf(getRoundingFunction(d,m),c.glyph.getMetrics().height/10+o);e.filter(s).forEach(c=>{c.setTextLine(t.top_text_line),t.top_text_line+=a(c,t.top_text_line,ABOVE)}),e.filter(r).forEach(c=>{c.setTextLine(t.text_line),t.text_line+=a(c,t.text_line,BELOW)});const l=e.map(c=>c.getWidth()).reduce((c,d)=>Math.max(d,c));return t.left_shift+=l/2,t.right_shift+=l/2,!0}static easyScoreHook({articulations:e},t,s){if(!e)return;const r={staccato:"a.",tenuto:"a-"};e.split(",").map(o=>o.trim().split(".")).map(([o,a])=>{const l={type:r[o]};return a&&(l.position=Modifier.PositionString[a]),s.getFactory().Articulation(l)}).map(o=>t.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.articulation=Flow.articulationCodes(this.type),!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 kt.CATEGORY}draw(){const{note:e,index:t,position:s,glyph:r,articulation:{between_lines:o},text_line:a,context:l}=this;if(this.checkContext(),!e||t==null)throw new Vex.RERR("NoAttachedNote","Can't draw Articulation without a note and index.");this.setRendered();const c=e.getStave(),d=c.getSpacingBetweenLines(),m=e.getCategory()==="tabnotes",{x:u}=e.getModifierStartXY(s,t),g=!o||m,b=getInitialOffset(e,s);let y={[ABOVE]:()=>{r.setOrigin(.5,1);const S=getTopY(e,a)-(a+b)*d+(this.y_shift||0);return g?Math.min(c.getYForTopText(kt.INITIAL_OFFSET),S):S},[BELOW]:()=>{r.setOrigin(.5,0);const S=getBottomY(e,a)+(a+b)*d;return g?Math.max(c.getYForBottomText(kt.INITIAL_OFFSET),S):S}}[s]();if(!m){const S=s===ABOVE?-1:1,v=m?e.positions[t].str:e.getKeyProps()[t].line,A=(e.getYs()[t]-y)/d+v,E=snapLineToStaff(o,A,s,S);isWithinLines(E,s)&&r.setOrigin(.5,.5),y+=Math.abs(E-A)*d*S}L$e(`Rendering articulation at (x: ${u}, y: ${y})`),r.render(l,u,y)}};class TickContext extends Tickable{static getNextContext(e){const t=e.tContexts,s=t.indexOf(e);return t[s+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:t,extraLeftPx:s,extraRightPx:r}=this;return{width:e,notePx:t,extraLeftPx:s,extraRightPx:r}}getCurrentTick(){return this.currentTick}setCurrentTick(e){this.currentTick=e,this.preFormatted=!1}getExtraPx(){let e=0,t=0,s=0,r=0;for(let o=0;o0&&r--;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(...i){Formatter.DEBUG&&Vex.L("Vex.Flow.Formatter",i)}function getNext(i,e){var s,r;const t=i[e+1];return t&&((s=t==null?void 0:t.keys)!=null&&s.includes("b/4"))||(r=t==null?void 0:t.keys)!=null&&r.includes("r/4")?getNext(i,e+1):t}function createContexts(i,e,t){if(!i||!i.length)throw new Vex.RERR("BadArgument","No voices to format");const s=i[0].getTotalTicks(),r=i.reduce((c,d)=>{if(!d.getTotalTicks().equals(s))throw new Vex.RERR("TickMismatch","Voices should have same total note duration in ticks.");if(d.getMode()===Voice$1.Mode.STRICT&&!d.isComplete())throw new Vex.RERR("IncompleteVoice","Voice does not have enough notes.");return Math.max(c,Fraction.LCM(c,d.getResolutionMultiplier()))},1),o={},a=[],l=[];return i.forEach(c=>{const d=new Fraction(0,r);c.getTickables().forEach(m=>{const u=d.numerator;if(!o[u]){const g=new e;l.push(g),o[u]=g}t(m,o[u]),a.push(u),d.add(m.getTicks())})}),{map:o,array:l,list:Vex.SortAndUnique(a,(c,d)=>c-d,(c,d)=>c===d),resolutionMultiplier:r}}class Formatter{static SimpleFormat(e,t=0,{paddingBetween:s=10}={}){e.reduce((r,o)=>{o.addToModifierContext(new ModifierContext);const a=new TickContext().addTickable(o).preFormat(),l=a.getExtraPx();return a.setX(r+l.left),r+a.getWidth()+l.right+s},t)}static plotDebugging(e,t,s,r,o){const a=s+Note.STAVEPADDING,l=t.contextGaps;function c(d,m,u){e.beginPath(),e.setStrokeStyle(u),e.setFillStyle(u),e.setLineWidth(1),e.fillRect(d,r,m-d,o-r)}e.save(),e.setFont("Arial",8,""),l.gaps.forEach(d=>{c(a+d.x1,a+d.x2,"#aaa"),e.fillText(Math.round(d.x2-d.x1),a+d.x1,o+12)}),e.fillText(Math.round(l.total)+"px",a-20,o+12),e.setFillStyle("red"),e.fillText("Loss: "+t.lossHistory.map(d=>Math.round(d)),a-20,o+22),e.restore()}static FormatAndDraw(e,t,s,r){const o={auto_beam:!1,align_rests:!1};typeof r=="object"?Vex.Merge(o,r):typeof r=="boolean"&&(o.auto_beam=r);const a=new Voice$1(Flow.TIME4_4).setMode(Voice$1.Mode.SOFT).addTickables(s),l=o.auto_beam?Beam$1.applyAndGetBeams(a):[];return new Formatter().joinVoices([a],{align_rests:o.align_rests}).formatToStave([a],t,{align_rests:o.align_rests,stave:t}),a.setStave(t).draw(e,t),l.forEach(c=>c.setContext(e).draw()),a.getBoundingBox()}static FormatAndDrawTab(e,t,s,r,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 d=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(r),u=c.auto_beam?Beam$1.applyAndGetBeams(d):[];new Formatter().joinVoices([d],{align_rests:c.align_rests}).joinVoices([m]).formatToStave([d,m],s,{align_rests:c.align_rests}),d.draw(e,s),m.draw(e,t),u.forEach(g=>g.setContext(e).draw()),new StaveConnector(s,t).setContext(e).draw()}static AlignRestsToNotes(e,t,s){return e.forEach((r,o)=>{if(r instanceof StaveNote&&r.isRest()){if(r.tuplet&&!s)return;if(["va5","v3c"].includes(r.glyph.code_head)){const a=r.glyph.code_head==="va5"?10:14,l=e[o-1],c=getNext(e,o);let d=!1;if(l&&c&&l.beam&&c.beam&&(d=l.beam.notes.includes(c)),d){r.setKeyLine(0,3);let m=[...l.beam.notes,...c.beam.notes];r.beam&&r.beam.notes&&m.push(...r.beam.notes),m=Array.from(new Set(m));for(let u=0;u0){const y=g<1.5?Math.abs(g-1.5)*a:0;b.setResetHeight(y)}else{const y=g>4.5?Math.abs(g-4.5)*a:0;b.setResetHeight(y)}}}}}}),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,t){if(!e||!e.length)throw new Vex.RERR("BadArgument","No voices to format rests");e.forEach(s=>Formatter.AlignRestsToNotes(s.getTickables(),t))}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:t,map:s}=this.tickContexts;return this.minTotalWidth=t.map(r=>{const o=s[r];return o.preFormat(),o.getWidth()}).reduce((r,o)=>r+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 t=createContexts(e,ModifierContext,(s,r)=>s.addToModifierContext(r));return this.modiferContexts=t,t}createTickContexts(e){const t=createContexts(e,TickContext,(s,r)=>r.addTickable(s));return t.array.forEach(s=>{s.tContexts=t.array}),this.totalTicks=e[0].getTicksUsed().clone(),this.tickContexts=t,t}preFormat(e=0,t,s,r){const o=this.tickContexts,{list:a,map:l,resolutionMultiplier:c}=o;s&&r&&s.forEach(S=>S.setStave(r).preFormat());let d=0,m=0;const u=e/2;if(this.minTotalWidth=0,a.forEach(S=>{const v=l[S];t&&v.setContext(t),v.preFormat();const x=v.getWidth();this.minTotalWidth+=x;const A=v.getMetrics();d=d+m+A.extraLeftPx,v.setX(d),m=x-A.extraLeftPx}),this.minTotalWidth=d+m,this.hasMinTotalWidth=!0,e<=0)return;const b=(e-this.minTotalWidth)/(this.totalTicks.value()*c);let y=0;a.forEach((S,v)=>{const x=a[v-1]||0,A=l[S],E=(S-x)*b;y+=E,A.setX(A.getX()+y),A.getCenterAlignedTickables().forEach(_=>{_.center_x_shift=u-A.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],d=this.tickContexts.map[o],m=c.getMetrics(),u=c.getX()+m.width,g=d.getX(),b=g-u;this.contextGaps.total+=b,this.contextGaps.gaps.push({x1:u,x2:g}),d.getFormatterMetrics().freedom.left=b,c.getFormatterMetrics().freedom.right=b});const t=this.durationStats={};function s(o,a){const l=t[o];l===void 0?t[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 d=a.getTicks().clone().simplify().toString(),m=a.getMetrics(),u=a.getFormatterMetrics(),g=a.getX()+m.noteWidth+m.modRightPx+m.extraRightPx;let b=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-t[l].mean,c.duration=l,c.space.mean=t[l].mean,r+=Math.pow(t[l].mean,2)})}),this.totalCost=Math.sqrt(r),this.lossHistory.push(this.totalCost),this}tune(){const e=r=>r.reduce((o,a)=>o+a);function t(r,o,a,l){r.setX(r.getX()+l),r.getFormatterMetrics().freedom.left+=l,r.getFormatterMetrics().freedom.right-=l,o&&(o.getFormatterMetrics().freedom.right+=l),a&&(a.getFormatterMetrics().freedom.left-=l)}let s=0;return this.tickContexts.list.forEach((r,o,a)=>{const l=this.tickContexts.map[r],c=o>0?this.tickContexts.map[a[o-1]]:null,d=og.getFormatterMetrics().space.deviation));m>0?s=-Math.min(l.getFormatterMetrics().freedom.right,Math.abs(m)):m<0&&(d?s=Math.min(d.getFormatterMetrics().freedom.right,Math.abs(m)):s=0);const u=Math.min(5,Math.abs(s));s=s>0?u:-u}),this.evaluate()}postFormat(){const e=t=>t.list.forEach(s=>t.map[s].postFormat());return e(this.modiferContexts),e(this.tickContexts),this}joinVoices(e){return this.createModifierContexts(e),this.hasMinTotalWidth=!1,this}format(e,t,s){const r={align_rests:!1,context:null,stave:null};return Vex.Merge(r,s),this.voices=e,this.alignRests(e,r.align_rests),this.createTickContexts(e),this.preFormat(t,r.context,e,r.stave),this}formatToStave(e,t,s){const r=t.getNoteEndX()-t.getNoteStartX()-10;L$a("Formatting voices to width: ",r);const o={context:t.getContext()};return Vex.Merge(o,s),this.format(e,r,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,t,s){e.setYShift(t.getYForLine(s)-t.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 t=Barline.type;this.widths={},this.widths[t.SINGLE]=5,this.widths[t.DOUBLE]=5,this.widths[t.END]=5,this.widths[t.REPEAT_BEGIN]=5,this.widths[t.REPEAT_END]=5,this.widths[t.REPEAT_BOTH]=5,this.widths[t.NONE]=5,this.paddings={},this.paddings[t.SINGLE]=0,this.paddings[t.DOUBLE]=0,this.paddings[t.END]=0,this.paddings[t.REPEAT_BEGIN]=15,this.paddings[t.REPEAT_END]=15,this.paddings[t.REPEAT_BOTH]=15,this.paddings[t.NONE]=0,this.layoutMetricsMap={},this.layoutMetricsMap[t.SINGLE]={xMin:0,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[t.DOUBLE]={xMin:-3,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[t.END]={xMin:-5,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[t.REPEAT_END]={xMin:-10,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[t.REPEAT_BEGIN]={xMin:-2,xMax:10,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[t.REPEAT_BOTH]={xMin:-10,xMax:10,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[t.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,t,s){e.checkContext();const r=e.getTopLineTopY(),o=e.getBottomLineBottomY();s&&e.context.fillRect(t-3,r,1,o-r),e.context.fillRect(t,r,1,o-r)}drawVerticalEndBar(e,t){e.checkContext();const s=e.getTopLineTopY(),r=e.getBottomLineBottomY();e.context.fillRect(t-5,s,1,r-s),e.context.fillRect(t-2,s,3,r-s)}drawRepeatBar(e,t,s){e.checkContext();const r=e.getTopLineTopY(),o=e.getBottomLineBottomY();let a=3;s||(a=-5),e.context.fillRect(t+a,r,1,o-r),e.context.fillRect(t-2,r,3,o-r);const l=2;s?a+=4:a-=4;const c=t+a+l/2;let d=(e.getNumLines()-1)*e.getSpacingBetweenLines();d=d/2-e.getSpacingBetweenLines()/2;let m=r+d+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 Ve 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,t,s){super(),this.setAttribute("type","Repetition"),this.symbol_type=e,this.x=t,this.x_shift=0,this.y_shift=s,this.font={family:"times",size:12,weight:"bold italic"}}getCategory(){return Ve.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,t){switch(this.setRendered(),this.symbol_type){case Ve.type.CODA_RIGHT:this.drawCodaFixed(e,t+e.width);break;case Ve.type.CODA_LEFT:this.drawSymbolText(e,t,"Coda",!1);break;case Ve.type.SEGNO_LEFT:this.drawSignoFixed(e,t);break;case Ve.type.SEGNO_RIGHT:this.drawSignoFixed(e,t+e.width);break;case Ve.type.DC:this.drawSymbolText(e,t,"D.C.",!1);break;case Ve.type.DC_AL_CODA:this.drawSymbolText(e,t,"D.C. al Coda",!0);break;case Ve.type.DC_AL_FINE:this.drawSymbolText(e,t,"D.C. al Fine",!1);break;case Ve.type.DS:this.drawSymbolText(e,t,"D.S.",!1);break;case Ve.type.DS_AL_CODA:this.drawSymbolText(e,t,"D.S. al Coda",!0);break;case Ve.type.DS_AL_FINE:this.drawSymbolText(e,t,"D.S. al Fine",!1);break;case Ve.type.FINE:this.drawSymbolText(e,t,"Fine",!1);break;case Ve.type.TO_CODA:this.drawSymbolText(e,t,"To Coda",!0);break}return this}drawCodaFixed(e,t){const s=e.getYForTopText(e.options.num_lines)+this.y_shift;return Glyph.renderGlyph(e.context,this.x+t+this.x_shift,s+25,40,"v4d",!0),this}drawSignoFixed(e,t){const s=e.getYForTopText(e.options.num_lines)+this.y_shift;return Glyph.renderGlyph(e.context,this.x+t+this.x_shift,s+25,30,"v8c",!0),this}drawSymbolText(e,t,s,r){const o=e.checkContext();o.save(),o.setFont(this.font.family,this.font.size,this.font.weight);let a=0+this.x_shift,l=t+this.x_shift;this.symbol_type===Ve.type.CODA_LEFT?(a=this.x+e.options.vertical_bar_width,l=a+o.measureText(s).width+12):(this.x_shift=-(a+o.measureText(s).width+12+e.options.vertical_bar_width+12),a=this.x+this.x_shift+e.options.vertical_bar_width,l=a+o.measureText(s).width+12);const c=e.getYForTopText(e.options.num_lines)+this.y_shift+25;return r&&Glyph.renderGlyph(o,l,c,40,"v4d",!0),o.fillText(s,a,c+5),o.restore(),this}};class StaveSection extends StaveModifier{static get CATEGORY(){return"stavesection"}constructor(e,t,s){super(),this.setAttribute("type","StaveSection"),this.setWidth(16),this.section=e,this.x=t,this.shift_x=0,this.shift_y=s,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,t){const s=e.checkContext();this.setRendered(),s.save(),s.lineWidth=2,s.setFont(this.font.family,this.font.size,this.font.weight);const r=s.measureText(""+this.section),o=r.width,a=r.height;let l=o+6;l<18&&(l=18);const c=a,d=e.getYForTopText(3)+this.shift_y;let m=this.x+t;return s.beginPath(),s.lineWidth=2,s.rect(m,d+a/4,l,c),s.stroke(),m+=(l-o)/2,s.fillText(""+this.section,m,d+16),s.restore(),this}}class StaveTempo extends StaveModifier{static get CATEGORY(){return"stavetempo"}constructor(e,t,s){super(),this.setAttribute("type","StaveTempo"),this.tempo=e,this.position=Modifier.Position.ABOVE,this.x=t,this.shift_x=10,this.shift_y=s,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,t){const s=e.checkContext();this.setRendered();const r=this.render_options,o=r.glyph_font_scale/38,a=this.tempo.name,l=this.tempo.duration,c=this.tempo.dots,d=this.tempo.bpm,m=this.font;let u=this.x+this.shift_x+t;const g=e.getYForTopText(1)+this.shift_y;if(s.save(),s.openGroup("stavetempo",null,{}),a&&(s.setFont(m.family,m.size,m.weight),s.fillText(a,u,g),u+=s.measureText(a).width),l&&d){s.setFont(m.family,m.size,"normal"),a&&(u+=s.measureText(" ").width,s.fillText("(",u,g),u+=s.measureText("(").width);const b=Flow.getGlyphProps(l);if(u+=3*o,Glyph.renderGlyph(s,u,g,r.glyph_font_scale,b.code_head),u+=b.getWidth()*o,b.stem){let y=30;b.beam_count&&(y+=3*(b.beam_count-1)),y*=o;const S=g-y;s.fillRect(u-o,S,o,y),b.flag&&(Glyph.renderGlyph(s,u,S,r.glyph_font_scale,b.code_flag_upstem),c||(u+=6*o))}for(let y=0;y=e.line?c.above:c.below)}this.placeGlyphOnLine(r,this.stave,e.line),this.glyphs.push(r);const a=this.xPositions[this.xPositions.length-1],l=r.getMetrics().width+o;this.xPositions.push(a+l),this.width+=l}cancelKey(e){return this.formatted=!1,this.cancelKeySpec=e,this}convertToCancelAccList(e){const t=Flow.keySignature(e),s=this.accList.length>0&&t.length>0&&t[0].type!==this.accList[0].type,r=s?t.length:t.length-this.accList.length;if(r<1)return;const o=[];for(let a=0;a0?e[0].type:null;let s;if(this.cancelKeySpec&&(s=this.convertToCancelAccList(this.cancelKeySpec)),this.alterKeySpec&&this.convertToAlterAccList(this.alterKeySpec),this.accList.length>0){const r=(this.position===StaveModifier.Position.END?this.stave.endClef:this.stave.clef)||this.stave.clef;s&&this.convertAccLines(r,s.type,s.accList),this.convertAccLines(r,t,e);for(let o=0;o0){this.stave.context.openGroup("keysignature");for(let e=0;e{const e=i.split("/").filter(t=>t!=="");if(e.length!==2)throw new Vex.RERR("BadTimeSignature",`Invalid time spec: ${i}. Must be in the form "/"`);e.forEach(t=>{if(isNaN(Number(t)))throw new Vex.RERR("BadTimeSignature",`Invalid time spec: ${i}. 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,t=15,s=!0){if(super(),this.setAttribute("type","TimeSignature"),this.validate_args=s,e===null)return;const r=t;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(r)}getCategory(){return TimeSignature.CATEGORY}parseTimeSpec(e){if(e==="C"||e==="C|"){const{line:r,code:o,point:a}=TimeSignature.glyphs[e];return{line:r,num:!1,glyph:new Glyph(o,a)}}this.validate_args&&assertIsValidFraction(e);const[t,s]=e.split("/").map(r=>r.split(""));return{num:!0,glyph:this.makeTimeSignatureGlyph(t,s)}}makeTimeSignatureGlyph(e,t){const s=new Glyph("v0",this.point);s.topGlyphs=[],s.botGlyphs=[];let r=0;for(let u=0;uo?r:o,l=s.getMetrics().x_min;s.getMetrics=()=>({x_min:l,x_max:l+a,width:a});const c=(a-r)/2,d=(a-o)/2,m=this;return s.renderToStave=function(g){let b=g+c;for(let y=0;yt.visible).filter(Boolean).length}getOptions(){return this.options}setNoteStartX(e){this.formatted||this.format(),this.setStartX(e);const t=this.modifiers[0];return t.setX(this.start_x-t.getWidth()),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 t=e-this.x;this.formatted=!1,this.x=e,this.start_x+=t,this.end_x+=t;for(let s=0;ss.getWidth()&&(t-=s.getWidth()),t}setRepetitionTypeLeft(e,t){return this.modifiers.push(new Repetition$1(e,this.x,t)),this}setRepetitionTypeRight(e,t){return this.modifiers.push(new Repetition$1(e,this.x,t)),this}setVoltaType(e,t,s){if(e===2)volta.type===2&&volta.stave.modifiers.push(new Volta(volta.type,volta.number_t,volta.x,volta.y)),volta={stave:this,type:e,number_t:t,MeasureNumber:this.MeasureNumber,y:s,x:this.x};else if(e===4){let r=this.MeasureNumber-volta.MeasureNumber,o=Math.max(volta.y,s);for(let a=0;a<=r;a++)voltaMeasureNumber[volta.MeasureNumber+a]={type:a===0?2:a===r?4:0,number_t:t,y:o};volta={}}else this.modifiers.push(new Volta(e,t,this.x,s));return this}drawVolta(){let e=voltaMeasureNumber[this.MeasureNumber];e&&(this.modifiers.push(new Volta(e.type,e.number_t,this.x,e.y)),delete voltaMeasureNumber[this.MeasureNumber]),volta.type&&volta.MeasureNumber==this.MeasureNumber&&(this.modifiers.push(new Volta(volta.type,volta.number_t,this.x,volta.y)),volta={})}setSection(e,t,s=0,r=12){const o=new StaveSection(e,this.x+s,t);return o.font.size=r,this.modifiers.push(o),this}setTempo(e,t){return this.modifiers.push(new StaveTempo(e,this.x,t)),this}setText(e,t,s){let r=new StaveText(e,t,s);return r.setFont({family:"Arial",size:14,weight:"normal"}),this.modifiers.push(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,t=e.spacing_between_lines_px;return this.getYForLine(e.num_lines)+e.space_below_staff_ln*t}getBottomLineY(){return this.getYForLine(this.options.num_lines)}getYForLine(e){const t=this.options,s=t.spacing_between_lines_px,r=t.space_above_staff_ln;return this.y+e*s+r*s}getLineForY(e){const t=this.options,s=t.spacing_between_lines_px,r=t.space_above_staff_ln;return(e-this.y)/s-r}getYForTopText(e){const t=e||0;return this.getYForLine(-t-this.options.top_text_position)}getYForBottomText(e){const t=e||0;return this.getYForLine(this.options.bottom_text_position+t)}getYForNote(e){const t=this.options,s=t.spacing_between_lines_px,r=t.space_above_staff_ln;return this.y+r*s+5*s-e*s}getYForGlyphs(){return this.getYForLine(3)}addModifier(e,t,s){return t!==void 0&&e.setPosition(t),s&&(this.timeSignature.numerator=s.numerator,this.timeSignature.denominator=s.denominator),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:t,REPEAT_BEGIN:s,NONE:r}=Barline.type;return(e===t||e===s||e===r)&&(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,t,s,r){r===void 0&&(r=StaveModifier.Position.BEGIN),r===StaveModifier.Position.END?this.endClef=e:this.clef=e;const o=this.getModifiers(r,Clef.CATEGORY);return o.length===0?this.addClef(e,t,s,r):o[0].setType(e,t,s),this}setEndClef(e,t,s){return this.setClef(e,t,s,StaveModifier.Position.END),this}setKeySignature(e,t,s){this.options.keySignature=e,s===void 0&&(s=StaveModifier.Position.BEGIN);const r=this.getModifiers(s,KeySignature.CATEGORY);return r.length===0?this.options.DYMusicScoreType!=="jianpu"&&this.addKeySignature(e,t,s):r[0].setKeySig(e,t),this}setEndKeySignature(e,t){return this.setKeySignature(e,t,StaveModifier.Position.END),this}setTimeSignature(e,t,s){s===void 0&&(s=StaveModifier.Position.BEGIN);const r=this.getModifiers(s,TimeSignature.CATEGORY);return r.length===0?this.addTimeSignature(e,t,s):r[0].setTimeSig(e),this}setEndTimeSignature(e,t){return this.setTimeSignature(e,t,StaveModifier.Position.END),this}addKeySignature(e,t,s){return s===void 0&&(s=StaveModifier.Position.BEGIN),this.addModifier(new KeySignature(e,t).setPosition(s),s),this}addClef(e,t,s,r){return r===void 0||r===StaveModifier.Position.BEGIN?this.clef=e:r===StaveModifier.Position.END&&(this.endClef=e),this.addModifier(new Clef(e,t,s),r),this}addEndClef(e,t,s){return this.addClef(e,t,s,StaveModifier.Position.END),this}addTimeSignature(e,t,s){return this.addModifier(new TimeSignature(e,t),s),this}addEndTimeSignature(e,t){return this.addTimeSignature(e,t,StaveModifier.Position.END),this}addTrebleGlyph(){return this.addClef("treble"),this}getModifiers(e,t){return e===void 0&&t===void 0?this.modifiers:this.modifiers.filter(s=>(e===void 0||e===s.getPosition())&&(t===void 0||t===s.getCategory()))}sortByCategory(e,t){for(let s=e.length-1;s>=0;s--)for(let r=0;rt[e[r+1].getCategory()]){const o=e[r];e[r]=e[r+1],e[r+1]=o}}format(){const e=this.modifiers[0],t=this.modifiers[1],s=this.getModifiers(StaveModifier.Position.BEGIN),r=this.getModifiers(StaveModifier.Position.END);this.sortByCategory(s,{barlines:0,clefs:1,keysignatures:2,timesignatures:3}),this.sortByCategory(r,{timesignatures:0,keysignatures:1,barlines:2,clefs:3}),s.length>1&&e.getType()===Barline.type.REPEAT_BEGIN&&(s.push(s.splice(0,1)[0]),s.splice(0,0,new Barline(Barline.type.SINGLE))),r.indexOf(t)>0&&r.splice(0,0,new Barline(Barline.type.NONE));let o,a,l,c=0,d=this.x;for(let g=0;g{a.includes(c)?l.visible=!0:l.visible=!1})}for(let a=0;athis.drawStaveTempo()),this.measure>0){this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.weight);const a=this.context.measureText(""+this.measure).width;r=this.getYForTopText(0)+3,this.context.fillText(""+this.measure,this.x-a/2,r),this.context.restore()}return this}drawStaveTempo(){if(!this.staveTempos.length)return;const e=document.querySelector(`#${this.attrs.id}`);if(!e)return;const t=e.parentElement.getBBox(),s=this.getYForLine(0),r=e.parentElement.parentElement.querySelectorAll(".vf-curve");if(r.length){const o=this.x+this.staveTempos[0].shift_x+this.getModifierXShift(0),a=this.getYForTopText(1)+t.y-s+5;r.forEach(l=>{const c=l.getBBox();c.x-10o&&c.y-10a&&(t.y=c.y+5)})}for(let o=0;o=0&&this.timeSignature.numerator){let e=40,t=0;this.MeasureNumber<2&&(e=70,t=-72),this.setText(`${this.timeSignature.numerator}`,1,{justification:1,shift_x:e,shift_y:t-13}),this.setText("ᅳ",1,{justification:1,shift_x:e+3,shift_y:t-2}),this.setText(`${this.timeSignature.denominator}`,1,{justification:1,shift_x:e,shift_y:t+8})}}drawVertical(e,t){this.drawVerticalFixed(this.x+e,t)}drawVerticalFixed(e,t){this.checkContext();const s=this.getYForLine(0),r=this.getYForLine(this.options.num_lines-1);t&&this.context.fillRect(e-3,s,1,r-s+1),this.context.fillRect(e,s,1,r-s+1)}drawVerticalBar(e){this.drawVerticalBarFixed(this.x+e,!1)}drawVerticalBarFixed(e){this.checkContext();const t=this.getYForLine(0),s=this.getYForLine(this.options.num_lines-1);this.context.fillRect(e,t,1,s-t+1)}getConfigForLines(){return this.options.line_config}setConfigForLine(e,t){if(e>=this.options.num_lines||e<0)throw new Vex.RERR("StaveConfigError","The line number must be within the range of the number of lines in the Stave.");if(t.visible===void 0)throw new Vex.RERR("StaveConfigError","The line configuration object is missing the 'visible' property.");if(typeof t.visible!="boolean")throw new Vex.RERR("StaveConfigError","The line configuration objects 'visible' property must be true or false.");return this.options.line_config[e]=t,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 t in e)e[t]||(e[t]=this.options.line_config[t]),Vex.Merge(this.options.line_config[t],e[t]);return this.options.line_config=e,this}}class TabStave extends Stave{constructor(e,t,s,r){const o={spacing_between_lines_px:13,num_lines:6,top_text_position:1};Vex.Merge(o,r),super(e,t,s,o),this.setAttribute("type","TabStave")}getYForGlyphs(){return this.getYForLine(2.5)}addTabGlyph(){return this.addClef("tab"),this}}function getUnusedStringGroups(i,e){const t=[];let s=[];for(let r=1;r<=i;r++)e.indexOf(r)>-1?(t.push(s),s=[]):s.push(r);return s.length>0&&t.push(s),t}function getPartialStemLines(i,e,t,s){const r=s!==1,o=s!==-1,a=t.getSpacingBetweenLines(),l=t.getNumLines(),c=[];return e.forEach(d=>{const m=d.indexOf(l)>-1,u=d.indexOf(1)>-1;if(r&&u||o&&m)return;d.length===1&&d.push(d[0]);const g=[];d.forEach((b,y,S)=>{const v=b===1,x=b===l;let A=t.getYForLine(b-1);y===0&&!v?A-=a/2-1:y===S.length-1&&!x&&(A+=a/2-1),g.push(A),s===1&&v?g.push(i-2):s===-1&&x&&g.push(i+2)}),c.push(g.sort((b,y)=>b-y))}),c}let TabNote$1=class li extends StemmableNote{static get CATEGORY(){return"tabnotes"}constructor(e,t){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:t,draw_dots:t,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 li.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 t;if(this.context){const r=this.context;for(this.width=0,t=0;to.width),this.width=Math.max(o.getWidth(),this.width)}this.glyph.getWidth=()=>this.width}const s=this.positions.map(({str:r})=>e.getYForLine(r-1));return this.setYs(s),this.stem&&this.stem.setYBounds(this.getStemY(),this.getStemY()),this}getPositions(){return this.positions}addToModifierContext(e){this.setModifierContext(e);for(let t=0;t{e.getCategory()==="dots"&&!this.render_options.draw_dots||(e.setContext(this.context),e.drawWithStyle())})}drawStemThrough(){const e=this.getStemX(),t=this.getStemY(),s=this.context,r=this.render_options.draw_stem_through_stave;if(this.render_options.draw_stem&&r){const a=this.stave.getNumLines(),l=this.positions.map(m=>m.str),c=getUnusedStringGroups(a,l),d=getPartialStemLines(t,c,this.getStave(),this.getStemDirection());s.save(),s.setLineWidth(Stem.WIDTH),d.forEach(m=>{m.length!==0&&(s.beginPath(),s.moveTo(e,m[0]),s.lineTo(e,m[m.length-1]),s.stroke(),s.closePath())}),s.restore()}}drawPositions(){const e=this.context,t=this.getAbsoluteX(),s=this.ys;for(let r=0;rparseInt(r,10)?TabSlide.SLIDE_DOWN:TabSlide.SLIDE_UP}this.slide_direction=t,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 t=this.context,s=e.first_x_px,r=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[t-1]}getValueForFret(e,t){const s=this.getValueForString(t),r=parseInt(e,10);if(r<0)throw new Vex.RERR("BadArguments","Fret number must be 0 or higher: "+e);return s+r}getNoteForFret(e,t){const s=this.getValueForFret(e,t),r=Math.floor(s/12),o=s%12;return Flow.integerToNote(o)+"/"+r}}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 t=Music.root_indices[this.keyParts.root];for(let s=0;s{const s=TextDynamics.GLYPHS[t];if(!s)throw new Vex.RERR("Invalid dynamics character: "+t);const r=this.render_options.glyph_font_size,o=new Glyph(s.code,r);this.glyphs.push(o),e+=s.width}),this.setWidth(e),this.preFormatted=!0,this}draw(){this.setRendered();const e=this.getAbsoluteX(),t=this.stave.getYForLine(this.line+-3);L$7("Rendering Dynamics: ",this.sequence);let s=e;this.glyphs.forEach((r,o)=>{const a=this.sequence[o];r.render(this.context,s,t),s+=TextDynamics.GLYPHS[a].width})}}function drawArrowHead(i,e,t,s,r,o,a){i.beginPath(),i.moveTo(e,t),i.lineTo(s,r),i.lineTo(o,a),i.lineTo(e,t),i.closePath(),i.fill()}function drawArrowLine(i,e,t,s){const r=s.draw_start_arrow&&s.draw_end_arrow,o=e.x,a=e.y,l=t.x,c=t.y,d=Math.sqrt((l-o)*(l-o)+(c-a)*(c-a)),m=(d-s.arrowhead_length/3)/d;let u,g,b,y;s.draw_end_arrow||r?(u=Math.round(o+(l-o)*m),g=Math.round(a+(c-a)*m)):(u=l,g=c),s.draw_start_arrow||r?(b=o+(l-o)*(1-m),y=a+(c-a)*(1-m)):(b=o,y=a),s.color&&(i.setStrokeStyle(s.color),i.setFillStyle(s.color)),i.beginPath(),i.moveTo(b,y),i.lineTo(u,g),i.stroke(),i.closePath();const S=Math.atan2(c-a,l-o),v=Math.abs(s.arrowhead_length/Math.cos(s.arrowhead_angle));let x,A,E,_,w,C;(s.draw_end_arrow||r)&&(x=S+Math.PI+s.arrowhead_angle,E=l+Math.cos(x)*v,_=c+Math.sin(x)*v,A=S+Math.PI-s.arrowhead_angle,w=l+Math.cos(A)*v,C=c+Math.sin(A)*v,drawArrowHead(i,E,_,l,c,w,C)),(s.draw_start_arrow||r)&&(x=S+s.arrowhead_angle,E=o+Math.cos(x)*v,_=a+Math.sin(x)*v,A=S-s.arrowhead_angle,w=o+Math.cos(A)*v,C=a+Math.sin(A)*v,drawArrowHead(i,E,_,o,a,w,C))}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(),t=this.render_options;t.line_dash&&e.setLineDash(t.line_dash),t.line_width&&e.setLineWidth(t.line_width),t.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 t=this.first_note,s=this.last_note,r=this.render_options;e.save(),this.applyLineStyle();let o,a;this.first_indices.forEach((g,b)=>{const y=this.last_indices[b];o=t.getModifierStartXY(2,g),a=s.getModifierStartXY(1,y);const S=o.y>a.y;o.x+=t.getMetrics().modRightPx+r.padding_left,a.x-=s.getMetrics().modLeftPx+r.padding_right;const v=t.getGlyph().getWidth();t.getKeyProps()[g].displaced&&t.getStemDirection()===1&&(o.x+=v+r.padding_left),s.getKeyProps()[y].displaced&&s.getStemDirection()===-1&&(a.x-=v+r.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=r.text_justification;let d=0;c===StaveLine.TextJustification.LEFT?d=o.x:c===StaveLine.TextJustification.CENTER?d=(a.x-o.x)/2+o.x-l/2:c===StaveLine.TextJustification.RIGHT&&(d=a.x-l);let m;const u=r.text_position_vertical;return u===StaveLine.TextVerticalPosition.TOP?m=t.getStave().getYForTopText():u===StaveLine.TextVerticalPosition.BOTTOM&&(m=t.getStave().getYForBottomText(Flow.TEXT_HEIGHT_OFFSET_HACK)),e.save(),this.applyFontStyle(),e.fillText(this.text,d,m),e.restore(),this}}function L$6(...i){PedalMarking.DEBUG&&Vex.L("Vex.Flow.PedalMarking",i)}function drawPedalGlyph(i,e,t,s,r){const o=PedalMarking.GLYPHS[i];new Glyph(o.code,r).render(e,t+o.x_shift,s+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 t=new PedalMarking(e);return t.setStyle(PedalMarking.Styles.MIXED),t.setCustomText("Sost. Ped."),t}static createUnaCorda(e){const t=new PedalMarking(e);return t.setStyle(PedalMarking.Styles.TEXT),t.setCustomText("una corda","tre corda"),t}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 t=0;t3)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 t=!1,s,r;const o=this;this.notes.forEach((a,l,c)=>{t=!t;let d=0;if(a?d=a.getNoteHeadBeginX():d=this.endStave.end_x+this.endStaveAddedWidth,this.EndsStave)t?this.ChangeBegin&&(d=a.getAbsoluteX()):(a?this.ChangeEnd?d=a.getAbsoluteX():d=a.getStave().end_x+this.endStaveAddedWidth-o.render_options.text_margin_right:d=this.endStave.end_x+this.endStaveAddedWidth-o.render_options.text_margin_right,this.endMargin=-o.render_options.text_margin_right);else if(a)if(t)this.ChangeBegin&&(d=a.getAbsoluteX());else switch(o.style){case PedalMarking.Styles.BRACKET_OPEN_END:case PedalMarking.Styles.BRACKET_OPEN_BOTH:case PedalMarking.Styles.MIXED_OPEN_END:d=a.getNoteHeadEndX();break;default:this.ChangeEnd?d=a.getAbsoluteX():(d=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 u=m.getYForBottomText(o.line+3);r&&r>u&&(u=r);const g=c[l+1]===a,b=c[l-1]===a;let y=0;if(t)if(y=b?5:0,(o.style===PedalMarking.Styles.MIXED||o.style===PedalMarking.Styles.MIXED_OPEN_END)&&!b)if(o.custom_depress_text){const S=e.measureText(o.custom_depress_text).width;e.fillText(o.custom_depress_text,d-S/2,u),y=S/2+o.render_options.text_margin_right}else drawPedalGlyph("pedal_depress",e,d,u,o.render_options.glyph_point_size),y=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(d+y,u):(this.ChangeBegin&&(d+=5),e.moveTo(d,u-o.render_options.bracket_height),this.ChangeBegin&&(d+=5),e.lineTo(d+y,u)),e.stroke(),e.closePath();else y=g&&!this.EndsStave?-5:0,e.beginPath(),e.moveTo(s,r),e.lineTo(d+y,u),o.style!==PedalMarking.Styles.BRACKET_OPEN_END&&o.style!==PedalMarking.Styles.MIXED_OPEN_END&&o.style!==PedalMarking.Styles.BRACKET_OPEN_BOTH&&(this.ChangeEnd&&(d+=5),e.lineTo(d,u-o.render_options.bracket_height)),e.stroke(),e.closePath();s=d+y,r=u})}drawText(){const e=this.context;let t=!1;const s=this,r=s.render_options.glyph_point_size;this.notes.forEach(o=>{t=!t;const a=o.getStave(),l=o.getAbsoluteX(),c=a.getYForBottomText(s.line+3);let d=0;t?s.custom_depress_text?(d=e.measureText(s.custom_depress_text).width,e.fillText(s.custom_depress_text,l-d/2,c)):drawPedalGlyph("pedal_depress",e,l,c,r):s.custom_release_text?(d=e.measureText(s.custom_release_text).width,e.fillText(s.custom_release_text,l-d/2,c)):drawPedalGlyph("pedal_release",e,l,c,r)})}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(...i){TextBracket.DEBUG&&Vex.L("Vex.Flow.TextBracket",i)}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:t,text:s="",superscript:r="",position:o=TextBracket.Positions.TOP}){super(),this.setAttribute("type","TextBracket"),this.start=e,this.stop=t,this.text=s,this.superscript=r,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,t){return this.render_options.dashed=e,t&&(this.render_options.dash=t),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 t=0;switch(this.position){case TextBracket.Positions.TOP:t=this.start.getStave().getYForTopText(this.line);break;case TextBracket.Positions.BOTTOM:t=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 s={x:this.start.getAbsoluteX(),y:t},r={x:this.stop.getAbsoluteX(),y:t};L$5("Rendering TextBracket: start:",s,"stop:",r,"y:",t);const o=this.render_options.bracket_height*this.position;e.save(),this.applyStyle(e),e.fillText(this.text,s.x,s.y);const a=e.measureText(this.text).width,l=e.measureText("M").width,c=s.y-l/2.5;e.setFont(this.font.family,this.font.size/1.4,this.font.weight),e.fillText(this.superscript,s.x+a+1,c);const d=e.measureText(this.superscript).width,m=e.measureText("M").width;let u=s.x,g=c;const b=r.x+this.stop.getGlyph().getWidth();this.position===TextBracket.Positions.TOP?(u+=a+d+5,g-=m/2.7):this.position===TextBracket.Positions.BOTTOM&&(g+=m/2.7,u+=a+2,this.render_options.underline_superscript||(u+=d)),this.render_options.dashed?(Renderer.drawDashedLine(e,u,g,b,g,this.render_options.dash),this.render_options.show_bracket&&Renderer.drawDashedLine(e,b,g+1*this.position,b,g+o,this.render_options.dash)):(e.beginPath(),e.moveTo(u,g),e.lineTo(b,g),this.render_options.show_bracket&&e.lineTo(b,g+o),e.stroke(),e.closePath()),e.restore()}}function L$4(...i){BarNote.DEBUG&&Vex.L("Vex.Flow.BarNote",i)}class BarNote extends Note{constructor(e=Barline.type.SINGLE){super({duration:"b"}),this.setAttribute("type","BarNote"),this.metrics={widths:{}};const t=Barline.type;this.metrics.widths={[t.SINGLE]:8,[t.DOUBLE]:12,[t.END]:15,[t.REPEAT_BEGIN]:14,[t.REPEAT_END]:14,[t.REPEAT_BOTH]:18,[t.NONE]:0},this.ignore_ticks=!0,this.setType(e)}getType(){return this.type}setType(e){return this.type=typeof e=="string"?Barline.typeString[e]:e,this.setWidth(this.metrics.widths[this.type]),this}getBoundingBox(){return super.getBoundingBox()}addToModifierContext(){return this}preFormat(){return this.setPreFormatted(!0),this}draw(){if(this.checkContext(),!this.stave)throw new Vex.RERR("NoStave","Can't draw without a stave.");L$4("Rendering bar line at: ",this.getAbsoluteX());const e=new Barline(this.type);e.setX(this.getAbsoluteX()),e.draw(this.stave),this.setRendered()}}class GhostNote extends StemmableNote{constructor(e){if(!e)throw new Vex.RuntimeError("BadArguments","Ghost note must have valid initialization data to identify duration.");let t;if(typeof e=="string")t={duration:e};else if(typeof e=="object")t=e;else throw new Vex.RuntimeError("BadArguments","Ghost note must have valid initialization data to identify duration.");super(t),this.setAttribute("type","GhostNote"),this.setWidth(0)}isRest(){return!0}setStave(e){super.setStave(e)}addToModifierContext(){return this}preFormat(){return this.setPreFormatted(!0),this}draw(){if(!this.stave)throw new Vex.RERR("NoStave","Can't draw without a stave.");this.setRendered();for(let e=0;e0||t===!0;return t&&!(o>0)&&(this.pos=r),l?this.matchSuccess():this.matchFail(r),{success:l,results:s,numMatches:o}}expectZeroOrMore(e){return this.expectOneOrMore(e,!0)}expect(e){L$2("Evaluating rules:",e);let t;if(!e)throw new X$2("Invalid Rule: "+e,e);const s=e.bind(this.grammar)();if(s.token)t=this.matchToken(s.token,s.noSpace===!0),t.success&&(this.pos+=t.incrementPos);else if(s.expect)s.oneOrMore?t=this.expectOneOrMore(s):s.zeroOrMore?t=this.expectZeroOrMore(s):t=this.expectOne(s);else throw new X$2("Bad grammar! No `token` or `expect` property",s);return t.matches=[],t.results&&t.results.forEach(r=>t.matches.push(flattenMatches(r))),s.run&&t.success&&s.run(t),t}}function L$1(...i){EasyScore.DEBUG&&Vex.L("Vex.Flow.EasyScore",i)}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=t=>t.slice(1,-1);return{expect:[this.KEY,this.EQUALS,this.VAL],run:t=>this.builder.addNoteOption(t.matches[0],e(t.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,t){L$1("addNoteOption: key:",e,"value:",t),this.piece.options[e]=t}addNote(e,t,s){L$1("addNote:",e,t,s),this.piece.chord.push({key:e,accid:t,octave:s})}addSingleNote(e,t,s){L$1("addSingleNote:",e,t,s),this.addNote(e,t,s)}addChord(e){L$1("startChord"),typeof e[0]!="object"?this.addSingleNote(e[0]):e.forEach(t=>{t&&this.addNote(...t)}),L$1("endChord")}commitPiece(){L$1("commitPiece");const{factory:e}=this;if(!e)return;const t={...this.options,...this.piece.options},{stem:s,clef:r}=t,o=s.toLowerCase()==="auto",a=!o&&s.toLowerCase()==="up"?StaveNote.STEM_UP:StaveNote.STEM_DOWN,{chord:l,duration:c,dots:d,type:m}=this.piece,u=l.map(y=>y.key+"/"+y.octave),g=e.StaveNote({keys:u,duration:c,dots:d,type:m,clef:r,auto_stem:o});o||g.setStemDirection(a);const b=l.map(y=>y.accid||null);b.forEach((y,S)=>{y&&g.addAccidental(S,e.Accidental({type:y}))});for(let y=0;yy(t,g,this)),this.elements.notes.push(g),this.elements.accidentals.concat(b),this.resetPiece()}}function setId({id:i},e){i!==void 0&&e.setAttribute("id",i)}function setClass(i,e){if(!i.class)return;const t=/\s*,\s*/;i.class.split(t).forEach(s=>e.addClass(s))}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(t=>this.addCommitHook(t)),this}setContext(e){return this.factory&&this.factory.setContext(e),this}parse(e,t={}){this.builder.reset(t);const s=this.parser.parse(e);if(!s.success&&this.options.throwOnError)throw new X$1("Error parsing line: "+e,s);return s}beam(e,t={}){return this.factory.Beam({notes:e,options:t}),e}tuplet(e,t={}){return this.factory.Tuplet({notes:e,options:t}),e}notes(e,t={}){return t={clef:this.defaults.clef,stem:this.defaults.stem,...t},this.parse(e,t),this.builder.getElements().notes}voice(e,t){return t={time:this.defaults.time,...t},this.factory.Voice(t).addTickables(e)}addCommitHook(e){return this.builder.addCommitHook(e)}}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 t=Flow.sanitizeDuration(this.duration);var s=NumberedNote.numberedDurationLine[t.toString()];if(s&&(this.duration_lines=s),s=NumberedNote.longDurationLine[t.toString()],s&&(this.long_duration_lines=s),!_text_width){var r="__$text_wraper$$__";let a=document.createElement("canvas");a.id=r,document.body.append(a);const l=document.getElementById(r),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 t=NumberedNote.noteLift;if(!t)return;var s=this.keys[0].split("/"),r=s[0];r==="b"&&(r="R"),r=r.replace(new RegExp("#","g"),""),r=r.replace(new RegExp("n","g"),""),r.length>1&&(r=r.replace(new RegExp("b","g"),""));const o=NumberedNoteHead.numberedNotationMapping[r.toUpperCase()];if(t.includes(o))for(let a=0;a{switch(s.getAttribute("type")){case"Accidental":s.render_options.font_scale=this.note_width*1.4,s.x_shift=2,s.y_shift=this.unit_height/2,this.ornament&&(s.render_options.font_scale=this.note_width,s.x_shift=14,s.y_shift=-10);break;case"Stroke":s.x_shift=-1*e,s.y_shift=1*this.unit_height;break;case"Dot":s.x_shift=t*this.duration_dot_width+7,s.y_shift=1*this.unit_height,t++;break;case"Ornament":s.y_shift=-3;break;default:s.y_shift=1*this.unit_height}s.reset&&s.reset(),e+=s.getWidth()/2})}handleDeleteDot(){for(let e=0;ea),s=t.length?t[0]/t[1]:0;if(this.ornament)return;if(s===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 r={lines:this.duration_lines,duration:s,id:this.attrs.id,x:this.x-this.duration_line_space/2-this.left_width,y:this.y,width:this.full_width};s>e*2&&(this.long_duration_lines=parseInt(s/e)-1,this.handleDeleteDot()),ornamentGroup&&(r.x+=this.note_width),group.notes.push(r);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 t=this.getAbsoluteX()+2.5;this.x=t;let s=this.stave.getYForLine(2)+this.note_height/2;this.y=s,this.buildToneHeads(),this.preFormatModifier(),this.applyStyle(),this.note_tones.forEach(r=>{r.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,t){e=e||this.context;let s=t||this.y+this.duration_line_space;for(let r=0;r<5;r++){let o=[],a=0;for(let l=0;lr)o.push(c),a++;else{if(o.length>1){let d=o.length-1;s=o[0].y+this.duration_line_space,e.rect(o[0].x,s+r*3,o[d].x-o[0].x+o[d].width,.5)}o=[],a=l+1}}if(o.length>1){let l=o.length-1;s=o[0].y+this.duration_line_space,e.rect(o[0].x,s+r*3,o[l].x-o[0].x+o[l].width,.5)}}}draw_dot(e,t,s,r){e.openGroup("numbered-note-dot"),e.beginPath(),e.arc(t,s,r,0,2*Math.PI),e.closePath(),e.fill(),e.closeGroup()}drawDurationLine(e,t){var s=this.attrs.id+"-lines";e.openGroup("numbered_note_lines",s);var r,o;if(this.duration_lines>0){const c=this.duration_line_space;var a=this.full_width;if(t&&t.width&&(a=t.width),a<0&&(a=this.note_width),!t||typeof t.startX>"u"?r=this.x-c/2-this.left_width:r=t.startX,!t||typeof t.startY>"u"?o=this.y+this.duration_line_space:o=t.startY,group.finish&&(this.drawDurationLoneLine(e,o),group=initGroup()),this.ornament?(r+=12,o-=22,a=15,ornamentGroup&&(r-=10,a+=10)):ornamentGroup&&(r+=this.note_width,a-=this.note_width),a>0){for(var l=0;ll.getAttribute("type")==="Accidental"),a=this.modifiers.findIndex(l=>l.getAttribute("type")==="Accidental");r&&a>-1?this.modifiers[a].accidental.code=r==="#"?"v18":"v44":this.modifiers.splice(a,1)}}catch(r){console.log("🚀 ~ error",r)}}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(s=>(s.td+s.bd)*(e.dot_space+e.dot_width)).reduce((s,r)=>s+r,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 t=[];return this.modifiers.forEach(s=>{s.getCategory()===e&&t.push(s)}),t}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(t=>{e+=t.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("/"),t=e[0];t==="b"&&(t="R"),t=t.replace(new RegExp("#","g"),""),t=t.replace(new RegExp("n","g"),""),t.length>1&&(t=t.replace(new RegExp("b","g"),""));let s=0,r=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&&(r=Math.ceil((o-NumberedNoteHead.numberedNotationMapping.max)/3.5)),t.toUpperCase()==="R"&&(s=0,r=0),{key:NumberedNoteHead.numberedNotationMapping[t.toUpperCase()],td:r,bd:s}}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 t=this.y;e.openGroup("numbered-note-head");var s=this.x+(this.note.ornament?-2:0);let r=t-this.note.unit_height-this.note.dot_space-(this.note.ornament?-4:2);for(let a=0;a1&&(l-=this.note.duration_line_space),t+=l}this.draw_dot(e,s+_text_width,t,this.note.dot_width),t+=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,t,s,r){e.openGroup("numbered-note-dot"),e.beginPath(),e.arc(t,s,r,0,2*Math.PI),e.closePath(),e.fill(),e.closeGroup()}}function L(...i){Factory.DEBUG&&Vex.L("Vex.Flow.Factory",i)}const X=Vex.MakeException("FactoryError");function setDefaults$1(i={},e){const t=e.options;return i=Object.assign(e,i),i.options=Object.assign(t,i.options),i}class Factory{constructor(e){L("New factory: ",e);const t={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=t,this.setOptions(e)}static newFromElementId(e,t=500,s=200){return new Factory({renderer:{elementId:e,width:t,height:s}})}reset(){this.renderQ=[],this.systems=[],this.staves=[],this.voices=[],this.stave=null}getOptions(){return this.options}setOptions(e){for(const t of["stave","renderer","font"])Object.assign(this.options[t],e[t]);(this.options.renderer.elementId!==null||this.options.renderer.context)&&this.initRenderer(),this.reset()}initRenderer(){const{elementId:e,backend:t,width:s,height:r,background:o}=this.options.renderer;if(e==="")throw new X("HTML DOM element not set in Factory");this.context=Renderer.buildContext(e,t,s,r,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 t=new Stave(e.x,e.y,e.width,e.options);return this.staves.push(t),t.setContext(this.context),this.stave=t,t}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 t=new TabStave(e.x,e.y,e.width,e.options);return this.staves.push(t),t.setContext(this.context),this.stave=t,t}StaveNote(e){const t=new StaveNote(e);return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}GhostNote(e){const t=new GhostNote(e);return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}TextNote(e){const t=new TextNote(e);return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}NumberedNote(e){const t=new NumberedNote(e);return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}BarNote(e){e=setDefaults$1(e,{type:"single",options:{}});const t=new BarNote(e.type);return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}ClefNote(e){e=setDefaults$1(e,{type:"treble",options:{size:"default"}});const t=new ClefNote(e.type,e.options.size,e.options.annotation);return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}TimeSigNote(e){e=setDefaults$1(e,{time:"4/4",options:{}});const t=new TimeSigNote(e.time);return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}KeySigNote(e){const t=new KeySigNote(e.key,e.cancelKey,e.alterKey);return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}TabNote(e){const t=new TabNote$1(e);return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}GraceNote(e){const t=new GraceNote(e);return this.stave&&t.setStave(this.stave),t.setContext(this.context),t}GraceNoteGroup(e){const t=new GraceNoteGroup(e.notes,e.slur);return t.setContext(this.context),t}Accidental(e){e=setDefaults$1(e,{type:null,options:{}});const t=new Accidental(e.type);return t.setContext(this.context),t}Annotation(e){e=setDefaults$1(e,{text:"p",vJustify:"below",hJustify:"center",fontFamily:"Times",fontSize:14,fontWeight:"bold italic",options:{}});const t=new Annotation(e.text);return t.setJustification(e.hJustify),t.setVerticalJustification(e.vJustify),t.setFont(e.fontFamily,e.fontSize,e.fontWeight),t.setContext(this.context),t}Articulation(e){e=setDefaults$1(e,{type:"a.",position:"above",options:{}});const t=new Articulation$1(e.type);return t.setPosition(e.position),t.setContext(this.context),t}TextDynamics(e){e=setDefaults$1(e,{text:"p",duration:"q",dots:0,line:0,options:{}});const t=new TextDynamics({text:e.text,line:e.line,duration:e.duration,dots:e.dots});return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}Fingering(e){e=setDefaults$1(e,{number:"0",position:"left",options:{}});const t=new FretHandFinger(e.number);return t.setPosition(e.position),t.setContext(this.context),t}StringNumber(e){e=setDefaults$1(e,{number:"0",position:"left",options:{}});const t=new StringNumber(e.number);return t.setPosition(e.position),t.setContext(this.context),t}TickContext(){return new TickContext().setContext(this.context)}ModifierContext(){return new ModifierContext}MultiMeasureRest(e){const t=new MultiMeasureRest(e.number_of_measures,e);return t.setContext(this.context),this.renderQ.push(t),t}Voice(e){e=setDefaults$1(e,{time:"4/4",options:{}});const t=new Voice$1(e.time);return this.voices.push(t),t}StaveConnector(e){e=setDefaults$1(e,{top_stave:null,bottom_stave:null,type:"double",options:{}});const t=new StaveConnector(e.top_stave,e.bottom_stave);return t.setType(e.type).setContext(this.context),this.renderQ.push(t),t}Formatter(){return new Formatter}Tuplet(e){e=setDefaults$1(e,{notes:[],options:{}});const t=new Tuplet$1(e.notes,e.options).setContext(this.context);return this.renderQ.push(t),t}Beam(e){e=setDefaults$1(e,{notes:[],options:{autoStem:!1,secondaryBeamBreaks:[]}});const t=new Beam$1(e.notes,e.options.autoStem).setContext(this.context);return t.breakSecondaryAt(e.options.secondaryBeamBreaks),this.renderQ.push(t),t}Curve(e){e=setDefaults$1(e,{from:null,to:null,options:{}});const t=new Curve(e.from,e.to,e.options).setContext(this.context);return this.renderQ.push(t),t}StaveTie(e){e=setDefaults$1(e,{from:null,to:null,first_indices:[0],last_indices:[0],text:null,options:{direction:void 0}});const t=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&&t.setDirection(e.options.direction),t.setContext(this.context),this.renderQ.push(t),t}StaveLine(e){e=setDefaults$1(e,{from:null,to:null,first_indices:[0],last_indices:[0],options:{}});const t=new StaveLine({first_note:e.from,last_note:e.to,first_indices:e.first_indices,last_indices:e.last_indices});return e.options.text&&t.setText(e.options.text),e.options.font&&t.setFont(e.options.font),t.setContext(this.context),this.renderQ.push(t),t}VibratoBracket(e){e=setDefaults$1(e,{from:null,to:null,options:{harsh:!1}});const t=new VibratoBracket({start:e.from,stop:e.to});return e.options.line&&t.setLine(e.options.line),e.options.harsh&&t.setHarsh(e.options.harsh),t.setContext(this.context),this.renderQ.push(t),t}TextBracket(e){e=setDefaults$1(e,{from:null,to:null,text:"",options:{superscript:"",position:1}});const t=new TextBracket({start:e.from,stop:e.to,text:e.text,superscript:e.options.superscript,position:e.options.position});return e.options.line&&t.setLine(e.options.line),e.options.font&&t.setFont(e.options.font),t.setContext(this.context),this.renderQ.push(t),t}System(e={}){e.factory=this;const t=new System(e).setContext(this.context);return this.systems.push(t),t}EasyScore(e={}){return e.factory=this,new EasyScore(e)}PedalMarking(e={}){e=setDefaults$1(e,{notes:[],options:{style:"mixed"}});const t=new PedalMarking(e.notes);return t.setStyle(PedalMarking.StylesString[e.options.style]),t.setContext(this.context),this.renderQ.push(t),t}NoteSubGroup(e={}){e=setDefaults$1(e,{notes:[],options:{}});const t=new NoteSubGroup$1(e.notes);return t.setContext(this.context),t}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(i,e){const t=e.options;return i=Object.assign(e,i),i.options=Object.assign(t,i.options),i}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(t=>t.setContext(this.context).setStave(e.stave).getTickables().forEach(s=>s.setStave(e.stave))),this.parts.push(e),e.stave}format(){const e=new Formatter;this.formatter=e;let t=this.options.y,s=0,r=[];const o=[];this.parts.forEach(l=>{t=t+l.stave.space(l.spaceAbove),l.stave.setY(t),e.joinVoices(l.voices),t=t+l.stave.space(l.spaceBelow),t=t+l.stave.space(this.options.spaceBetweenStaves),l.debugNoteMetrics&&(o.push({y:t,voice:l.voices[0]}),t+=15),r=r.concat(l.voices),s=Math.max(s,l.stave.getNoteStartX())}),this.parts.forEach(l=>l.stave.setNoteStartX(s));const a=this.options.width-(s-this.options.x)-Note.STAVEPADDING;e.format(r,a);for(let l=0;l{t.voice.getTickables().forEach(s=>Note.plotMetrics(e,s,t.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=(i=>(i[i.SingleThin=0]="SingleThin",i[i.DoubleThin=1]="DoubleThin",i[i.ThinBold=2]="ThinBold",i[i.BoldThinDots=3]="BoldThinDots",i[i.DotsThinBold=4]="DotsThinBold",i[i.DotsBoldBoldDots=5]="DotsBoldBoldDots",i[i.None=6]="None",i[i.Dotted=7]="Dotted",i[i.Dashed=8]="Dashed",i[i.Bold=9]="Bold",i[i.BoldThin=10]="BoldThin",i[i.DoubleBold=11]="DoubleBold",i[i.Tick=12]="Tick",i[i.Short=13]="Short",i))(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 t=0;t<2;t++)this.matrix[e][t]=0}}static getRotationMatrix(e){const t=new Matrix2D,s=Math.cos(e),r=Math.sin(e);return t.matrix[0][0]=s,t.matrix[0][1]=-r,t.matrix[1][0]=r,t.matrix[1][1]=s,t}scalarMultiplication(e){for(let t=0;t<2;t++)for(let s=0;s<2;s++)this.matrix[t][s]*=e}getTransposeMatrix(){const e=new Matrix2D;for(let t=0;t<2;t++)for(let s=0;s<2;s++)e.matrix[t][s]=this.matrix[s][t];return e}vectorMultiplication(e){const t=new PointF2D;return t.x=e.x*this.matrix[0][0]+e.y*this.matrix[0][1],t.y=e.x*this.matrix[1][0]+e.y*this.matrix[1][1],t}}class MusicSheetErrors{constructor(){this.measureErrors={},this.errors=[],this.tempErrors=[]}finalizeMeasure(e){let t=this.measureErrors[e];t||(t=[]),this.measureErrors[e]=t.concat(this.tempErrors),this.tempErrors=[]}pushMeasureError(e){this.tempErrors.push(e)}push(e){this.errors.push(e)}}class Arpeggio{constructor(e,t=7){this.parentVoiceEntry=e,this.type=t,this.notes=[]}addNote(e){this.notes.push(e),e.Arpeggio=this}}var ArpeggioType=(i=>(i[i.BRUSH_DOWN=1]="BRUSH_DOWN",i[i.BRUSH_UP=2]="BRUSH_UP",i[i.ROLL_DOWN=3]="ROLL_DOWN",i[i.ROLL_UP=4]="ROLL_UP",i[i.RASQUEDO_DOWN=5]="RASQUEDO_DOWN",i[i.RASQUEDO_UP=6]="RASQUEDO_UP",i[i.ARPEGGIO_DIRECTIONLESS=7]="ARPEGGIO_DIRECTIONLESS",i))(ArpeggioType||{});class Beam{constructor(e=1,t=0){this.notes=[],this.extendedNoteList=[],this.BeamNumberOffsetToXML=0,this.BeamNumber=e,this.BeamNumberOffsetToXML=t}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,t){this.voiceEntries=[],this.volume=1,this.parent=e,this.visible=!0,this.audible=!0,this.following=!0,this.voiceId=t,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,t,s){super(e,t),this.master=s}get Master(){return this.master}}class Notehead{constructor(e,t,s=void 0){this.sourceNote=e,this.setShapeFromXml(t,s)}setShapeFromXml(e,t=void 0){this.shape=Notehead.ShapeTypeXmlToShape(e);let s=t;s===void 0&&(this.sourceNote?s=this.sourceNote.Length.Denominator>2:(loglevelExports.warn("notehead: sourceNote and filledXmlAttribute undefined."),s=!0)),this.filled=s}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=(i=>(i[i.CIRCLEX=0]="CIRCLEX",i[i.DIAMOND=1]="DIAMOND",i[i.NORMAL=2]="NORMAL",i[i.RECTANGLE=3]="RECTANGLE",i[i.SLASH=4]="SLASH",i[i.SQUARE=5]="SQUARE",i[i.TRIANGLE=6]="TRIANGLE",i[i.X=7]="X",i))(NoteHeadShape||{});class ITextTranslation{static translateText(e,t){if(!this.defaultTextTranslation)return t}}var NoteType=(i=>(i[i.UNDEFINED=0]="UNDEFINED",i[i._1024th=1]="_1024th",i[i._512th=2]="_512th",i[i._256th=3]="_256th",i[i._128th=4]="_128th",i[i._64th=5]="_64th",i[i._32nd=6]="_32nd",i[i._16th=7]="_16th",i[i.EIGTH=8]="EIGTH",i[i.QUARTER=9]="QUARTER",i[i.HALF=10]="HALF",i[i.WHOLE=11]="WHOLE",i[i.BREVE=12]="BREVE",i[i.LONG=13]="LONG",i[i.MAXIMA=14]="MAXIMA",i))(NoteType||{});class NoteTypeHandler{static NoteTypeToString(e){return this.NoteTypeXmlValues[e]}static StringToNoteType(e){const t=this.NoteTypeXmlValues.indexOf(e);return t!==-1?t: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 t=ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError","Invalid note duration.");throw new MusicSheetReadingException(t)}}}}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=(i=>(i[i.Trill=0]="Trill",i[i.Turn=1]="Turn",i[i.InvertedTurn=2]="InvertedTurn",i[i.DelayedTurn=3]="DelayedTurn",i[i.DelayedInvertedTurn=4]="DelayedInvertedTurn",i[i.Mordent=5]="Mordent",i[i.InvertedMordent=6]="InvertedMordent",i))(OrnamentEnum||{});class VerticalSourceStaffEntryContainer{constructor(e,t,s){this.staffEntries=[],this.comments=[],this.timestamp=t,this.staffEntries=new Array(s),this.parentMeasure=e}$get$(e){return this.staffEntries[e]}$set$(e,t){this.staffEntries[e]=t}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,t){this.voiceEntries=[],this.instructions=[],this.chordSymbolContainers=[],this.verticalContainerParent=e,this.parentStaff=t}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,t=0;for(;e0)return!0;return!1}hasTie(){for(let e=0,t=this.VoiceEntries.length;et.parentRepetition.StartIndex)return-1}if(e.alignment===0&&t.alignment===0){if(e.parentRepetition.EndIndext.parentRepetition.EndIndex)return-1}}return 0}}class RepetitionInstruction{constructor(e,t,s=1,r=void 0,o=void 0){this.endingIndices=void 0,this.measureIndex=e,o&&(this.endingIndices=o.slice()),this.type=t,this.alignment=s,this.parentRepetition=r}CompareTo(e){const t=e;if(this.measureIndex>t.measureIndex)return 1;if(this.measureIndex(i[i.StartLine=0]="StartLine",i[i.ForwardJump=1]="ForwardJump",i[i.BackJumpLine=2]="BackJumpLine",i[i.Ending=3]="Ending",i[i.DaCapo=4]="DaCapo",i[i.DalSegno=5]="DalSegno",i[i.Fine=6]="Fine",i[i.ToCoda=7]="ToCoda",i[i.DalSegnoAlFine=8]="DalSegnoAlFine",i[i.DaCapoAlFine=9]="DaCapoAlFine",i[i.DalSegnoAlCoda=10]="DalSegnoAlCoda",i[i.DaCapoAlCoda=11]="DaCapoAlCoda",i[i.Coda=12]="Coda",i[i.Segno=13]="Segno",i[i.None=14]="None",i))(RepetitionInstructionEnum||{}),AlignmentType=(i=>(i[i.Begin=0]="Begin",i[i.End=1]="End",i))(AlignmentType||{});let prevSourceMeasure=null;class SourceMeasure{constructor(e,t){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=t,this.TempoInBPM=0;for(let s=0;s1)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,t,s){let r,o;for(const l of this.verticalSourceStaffEntryContainers)if(l.Timestamp.Equals(e)){o=l;break}if(o)return o.StaffEntries[t]?r=o.StaffEntries[t]:(r=new SourceStaffEntry(o,s),o.StaffEntries[t]=r),{createdNewContainer:!1,staffEntry:r};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),r=new SourceStaffEntry(l,s),l.StaffEntries[t]=r}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),r=new SourceStaffEntry(c,s),c.StaffEntries[t]=r;break}if(l===0){const c=new VerticalSourceStaffEntryContainer(this,e.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(l,0,c),r=new SourceStaffEntry(c,s),c.StaffEntries[t]=r;break}}return{createdNewContainer:!0,staffEntry:r}}findOrCreateVoiceEntry(e,t){let s,r=!1;for(const o of e.VoiceEntries)if(o.ParentVoice===t){s=o;break}return s||(s=new VoiceEntry(e.Timestamp,t,e),r=!0),{createdVoiceEntry:r,voiceEntry:s}}getPreviousSourceStaffEntryFromIndex(e,t){for(let s=t-1;s>=0;s--)if(this.verticalSourceStaffEntryContainers[s][e])return this.verticalSourceStaffEntryContainers[s][e]}getVerticalContainerIndexByTimestamp(e){for(let t=0,s=this.VerticalSourceStaffEntryContainers.length;t=0;u--){const g=this.verticalSourceStaffEntryContainers[u][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}}}}r.push(a)}for(let o=0,a=r.length;o0)return!0}return!1}beginsWithLineRepetition(){for(let e=0,t=this.FirstRepetitionInstructions.length;e=0&&(t=this.verticalSourceStaffEntryContainers[s].StaffEntries[e],!t);s--);return t}canBeReducedToMultiRest(){var s,r,o,a,l,c;let e=!0,t=!1;for(const d of this.verticalSourceStaffEntryContainers)if(d){for(const m of d.StaffEntries)if(!(!m||!m.ParentStaff.ParentInstrument.Visible)){if(m.ChordContainers.length>0||(m.ParentStaff.hasLyrics&&(t=!0),this.firstRepetitionInstructions.length>0||this.lastRepetitionInstructions.length>0))return!1;for(const u of m.VoiceEntries){for(const g of u.Notes)if(!g.isRest()){e=!1;break}if(!e)break}}}if(!e||t||this.hasMoodExpressions||this.tempoExpressions.length>0)return!1;for(const d of this.staffLinkedExpressions)if(d.length>0)return!1;for(const d of this.lastInstructionsStaffEntries)for(let m=0,u=d==null?void 0:d.Instructions.length;m=0;t--)for(let s=0;s(i[i.Fingering=0]="Fingering",i[i.String=1]="String",i))(TechnicalInstructionType||{});class TechnicalInstruction{}class PlaybackNote{constructor(e,t){this.parentEntry=e,this.parentNote=t,this.ParentNote.PlaybackNote=this,this.Length=this.ParentNote.Length,t.Pitch!==void 0?this.ParentNote.ParentStaff.ParentInstrument.MidiInstrumentId===MidiInstrument.Percussion?this.MidiKey=PlaybackNote.noteToMidiDrumKey(t):this.MidiKey=t.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 r;const t=e.Pitch.getHalfTone()-12,s=(r=e.Notehead)==null?void 0:r.Shape;switch(e.Pitch.Octave){case 1:switch(e.Pitch.FundamentalNote){case NoteEnum.D:switch(s){default:return 44}case NoteEnum.E:switch(s){default:return 35}case NoteEnum.F:switch(s){default:return 36}case NoteEnum.G:switch(s){default:return 41}case NoteEnum.A:switch(s){default:return 43}case NoteEnum.B:switch(s){case NoteHeadShape.TRIANGLE:return 54;default:return 47}default:return t}case 2:switch(e.Pitch.FundamentalNote){case NoteEnum.C:switch(s){case NoteHeadShape.X:return 37;default:return 38}case NoteEnum.D:switch(s){case NoteHeadShape.X:return 59;default:return 48}case NoteEnum.E:switch(s){case NoteHeadShape.X:return 42;case NoteHeadShape.CIRCLEX:return 46;case NoteHeadShape.TRIANGLE:return 56;default:return 50}case NoteEnum.F:switch(s){case NoteHeadShape.DIAMOND:return 53;default:return 51}case NoteEnum.G:switch(s){case NoteHeadShape.CIRCLEX:case NoteHeadShape.DIAMOND:return 46;default:return 42}case NoteEnum.A:switch(s){default:return 49}case NoteEnum.B:switch(s){default:return 57}default:return t}case 3:switch(e.Pitch.FundamentalNote){case NoteEnum.C:switch(s){case NoteHeadShape.CIRCLEX:return 52;default:return 55}default:return t}default:return t}}}class PlaybackEntry{constructor(e){this.notes=[],this.TimestampShift=new Fraction$1,this.parentVoiceEntry=e;for(const t of e.Notes)this.Notes.push(new PlaybackNote(this,t))}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 t of this.Notes)t.Length=e}get HasNotes(){return this.Notes.length>0}}class VoiceEntry{constructor(e,t,s,r=!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=t,this.parentSourceStaffEntry=s,this.isGrace=o,this.graceAfterMainNote=!1,this.graceNoteSlash=a,this.graceSlur=l,o||t.VoiceEntries.push(this),r&&s!==void 0){const c=s.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 t of this.graceVoiceEntriesBefore)t.parentSourceStaffEntry=this.ParentSourceStaffEntry}get GraceVoiceEntriesAfter(){return this.graceVoiceEntriesAfter}set GraceVoiceEntriesAfter(e){this.graceVoiceEntriesAfter=e;for(const t of this.graceVoiceEntriesAfter)t.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 t=this.playbackEntries.indexOf(e);t>-1&&this.playbackEntries.splice(t,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 t of this.articulations)if(t.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,t=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 t=1;return this.lyricsEntries.forEach((s,r)=>{e===r&&(t=s)}),t}}var ArticulationEnum=(i=>(i[i.accent=0]="accent",i[i.strongaccent=1]="strongaccent",i[i.marcatoup=2]="marcatoup",i[i.marcatodown=3]="marcatodown",i[i.invertedstrongaccent=4]="invertedstrongaccent",i[i.staccato=5]="staccato",i[i.staccatissimo=6]="staccatissimo",i[i.spiccato=7]="spiccato",i[i.tenuto=8]="tenuto",i[i.fermata=9]="fermata",i[i.invertedfermata=10]="invertedfermata",i[i.breathmark=11]="breathmark",i[i.caesura=12]="caesura",i[i.lefthandpizzicato=13]="lefthandpizzicato",i[i.naturalharmonic=14]="naturalharmonic",i[i.snappizzicato=15]="snappizzicato",i[i.upbow=16]="upbow",i[i.downbow=17]="downbow",i[i.scoop=18]="scoop",i[i.plop=19]="plop",i[i.doit=20]="doit",i[i.falloff=21]="falloff",i[i.stress=22]="stress",i[i.unstress=23]="unstress",i[i.detachedlegato=24]="detachedlegato",i[i.otherarticulation=25]="otherarticulation",i[i.bend=26]="bend",i))(ArticulationEnum||{}),StemDirectionType=(i=>(i[i.Undefined=-1]="Undefined",i[i.Up=0]="Up",i[i.Down=1]="Down",i[i.None=2]="None",i[i.Double=3]="Double",i))(StemDirectionType||{}),SystemLinePosition=(i=>(i[i.MeasureBegin=0]="MeasureBegin",i[i.MeasureEnd=1]="MeasureEnd",i))(SystemLinePosition||{});class GraphicalLabel extends Clickable{constructor(e,t,s,r,o=void 0){super(),this.label=e,this.boundingBox=new BoundingBox$1(this,o),this.label.fontHeight=t,this.label.textAlignment=s,this.rules=r,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,t=this.Label.text.split(/[\n\r]+/g),s=t.length;let r=0;for(let d=0;d0&&this.TextLines.length>1&&(o+=this.rules.SpacingBetweenTextLines*s/10);const a=this.PositionAndShape;switch(this.Label.textAlignment){case TextAlignmentEnum.CenterBottom:a.BorderTop=-o,a.BorderLeft=-r/2,a.BorderBottom=0,a.BorderRight=r/2;break;case TextAlignmentEnum.CenterCenter:a.BorderTop=-o/2,a.BorderLeft=-r/2,a.BorderBottom=o/2,a.BorderRight=r/2;break;case TextAlignmentEnum.CenterTop:a.BorderTop=0,a.BorderLeft=-r/2,a.BorderBottom=o,a.BorderRight=r/2;break;case TextAlignmentEnum.LeftBottom:a.BorderTop=-o,a.BorderLeft=0,a.BorderBottom=0,a.BorderRight=r;break;case TextAlignmentEnum.LeftCenter:a.BorderTop=-o/2,a.BorderLeft=0,a.BorderBottom=o/2,a.BorderRight=r;break;case TextAlignmentEnum.LeftTop:a.BorderTop=0,a.BorderLeft=0,a.BorderBottom=o,a.BorderRight=r;break;case TextAlignmentEnum.RightBottom:a.BorderTop=-o,a.BorderLeft=-r,a.BorderBottom=0,a.BorderRight=0;break;case TextAlignmentEnum.RightCenter:a.BorderTop=-o/2,a.BorderLeft=-r,a.BorderBottom=o/2,a.BorderRight=0;break;case TextAlignmentEnum.RightTop:a.BorderTop=0,a.BorderLeft=-r,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="",t=TextAlignmentEnum.CenterBottom,s=void 0,r=!0){this.IsCreditLabel=!1,this.text=e,this.print=r,this.textAlignment=t,this.font=s,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(i){return i.indexOf(SpeedKeyword)===0}function isSpeedHiddenKeyword(i){return i.indexOf(SpeedHiddenKeyword)===0}function formatSpeedKeyword(i){return i.replace(SpeedHiddenKeyword,"").replace(SpeedKeyword,"")}function isGradientWords(i){return GradientWords.includes(i)}function isSpecialMark(i){return[...Object.keys(SpeedTag),...SpecialMarks,...SpecialWords,...HideWords].map(e=>e.trim().toLocaleUpperCase()).includes(i.toLocaleUpperCase().trim())}function isTopFont(i){return[TextAlignmentEnum.CenterTop,TextAlignmentEnum.RightTop].includes(i)}var MusicSymbol=(i=>(i[i.Unused_first_Symbol=0]="Unused_first_Symbol",i[i.BLACK_HEAD=1]="BLACK_HEAD",i[i.UPWARDS_TAIL=2]="UPWARDS_TAIL",i[i.DOWNWARDS_TAIL=3]="DOWNWARDS_TAIL",i[i.UPWARDS_DOUBLE_TAIL=4]="UPWARDS_DOUBLE_TAIL",i[i.DOWNWARDS_DOUBLE_TAIL=5]="DOWNWARDS_DOUBLE_TAIL",i[i.UPWARDS_TRIPLE_TAIL=6]="UPWARDS_TRIPLE_TAIL",i[i.DOWNWARDS_TRIPLE_TAIL=7]="DOWNWARDS_TRIPLE_TAIL",i[i.UPWARDS_QUAD_TAIL=8]="UPWARDS_QUAD_TAIL",i[i.DOWNWARDS_QUAD_TAIL=9]="DOWNWARDS_QUAD_TAIL",i[i.ROUND_HEAD=10]="ROUND_HEAD",i[i.WHITE_HEAD=11]="WHITE_HEAD",i[i.G_CLEF=12]="G_CLEF",i[i.F_CLEF=13]="F_CLEF",i[i.C_CLEF=14]="C_CLEF",i[i.BREVE=15]="BREVE",i[i.BREVE_REST=16]="BREVE_REST",i[i.COMMON_TIME=17]="COMMON_TIME",i[i.CUT_TIME=18]="CUT_TIME",i[i.WHOLE_REST=19]="WHOLE_REST",i[i.HALF_REST=20]="HALF_REST",i[i.QUARTER_REST=21]="QUARTER_REST",i[i.EIGHTH_REST=22]="EIGHTH_REST",i[i.SIXTEENTH_REST=23]="SIXTEENTH_REST",i[i.THIRTYSECOND_REST=24]="THIRTYSECOND_REST",i[i.SIXTYFOURTH_REST=25]="SIXTYFOURTH_REST",i[i.FLAT=26]="FLAT",i[i.SHARP=27]="SHARP",i[i.NATURAL=28]="NATURAL",i[i.DOUBLE_FLAT=29]="DOUBLE_FLAT",i[i.DOUBLE_SHARP=30]="DOUBLE_SHARP",i[i.ZERO=31]="ZERO",i[i.ONE=32]="ONE",i[i.TWO=33]="TWO",i[i.THREE=34]="THREE",i[i.FOUR=35]="FOUR",i[i.FIVE=36]="FIVE",i[i.SIX=37]="SIX",i[i.SEVEN=38]="SEVEN",i[i.EIGHT=39]="EIGHT",i[i.NINE=40]="NINE",i[i.DOT=41]="DOT",i[i.FERMATA=42]="FERMATA",i[i.INVERTED_FERMATA=43]="INVERTED_FERMATA",i[i.SPICCATO=44]="SPICCATO",i[i.TENUTO=45]="TENUTO",i[i.MARCATO=46]="MARCATO",i[i.MARCATISSIMO=47]="MARCATISSIMO",i[i.INVERTED_MARCATISSIMO=48]="INVERTED_MARCATISSIMO",i[i.P=49]="P",i[i.F=50]="F",i[i.S=51]="S",i[i.Z=52]="Z",i[i.M=53]="M",i[i.R=54]="R",i[i.SEGNO=55]="SEGNO",i[i.CODA=56]="CODA",i[i.DRUM_CLEF=57]="DRUM_CLEF",i[i.G_CLEF_SUB8=58]="G_CLEF_SUB8",i[i.G_CLEF_SUPER8=59]="G_CLEF_SUPER8",i[i.G_CLEF_SUB15=60]="G_CLEF_SUB15",i[i.G_CLEF_SUPER15=61]="G_CLEF_SUPER15",i[i.F_CLEF_SUB8=62]="F_CLEF_SUB8",i[i.F_CLEF_SUPER8=63]="F_CLEF_SUPER8",i[i.F_CLEF_SUB15=64]="F_CLEF_SUB15",i[i.F_CLEF_SUPER15=65]="F_CLEF_SUPER15",i[i.DOWN_BOW=66]="DOWN_BOW",i[i.MORDENT=67]="MORDENT",i[i.INVERTED_MORDENT=68]="INVERTED_MORDENT",i[i.TURN=69]="TURN",i[i.INVERTED_TURN=70]="INVERTED_TURN",i[i.LEFTHAND_PIZZICATO=71]="LEFTHAND_PIZZICATO",i[i.RELEASE_PED=72]="RELEASE_PED",i[i.ENGAGE_PED=73]="ENGAGE_PED",i[i.VA8=74]="VA8",i[i.VB8=75]="VB8",i[i.TRILL=76]="TRILL",i[i.MA15=77]="MA15",i[i.MB15=78]="MB15",i[i.HIGH=79]="HIGH",i[i.PLAY=80]="PLAY",i[i.MIC=81]="MIC",i[i.SNAP_PIZZICATO=82]="SNAP_PIZZICATO",i[i.NATURAL_HARMONIC=83]="NATURAL_HARMONIC",i[i.EditPen=84]="EditPen",i[i.PEDAL_BRACKET=85]="PEDAL_BRACKET",i[i.PEDAL_MIXED=86]="PEDAL_MIXED",i[i.PEDAL_SYMBOL=87]="PEDAL_SYMBOL",i))(MusicSymbol||{}),MusicSymbolDrawingStyle=(i=>(i[i.Normal=0]="Normal",i[i.Disabled=1]="Disabled",i[i.Selected=2]="Selected",i[i.Clickable=3]="Clickable",i[i.PlaybackSymbols=4]="PlaybackSymbols",i[i.FollowSymbols=5]="FollowSymbols",i[i.QFeedbackNotFound=6]="QFeedbackNotFound",i[i.QFeedbackOk=7]="QFeedbackOk",i[i.QFeedbackPerfect=8]="QFeedbackPerfect",i[i.Debug1=9]="Debug1",i[i.Debug2=10]="Debug2",i[i.Debug3=11]="Debug3",i))(MusicSymbolDrawingStyle||{}),PhonicScoreModes=(i=>(i[i.Following=0]="Following",i[i.Midi=1]="Midi",i[i.Manual=2]="Manual",i))(PhonicScoreModes||{});class LabelRenderSpecs{}class MusicSheetDrawer{constructor(e,t){this.drawableBoundingBoxElement="None",this.skyLineVisible=!1,this.bottomLineVisible=!1,this.phonicScoreMode=PhonicScoreModes.Manual,this.textMeasurer=e,this.splitScreenLineColor=-1,this.drawingParameters=t,this.rules=t.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 s of e.Cursors){if(!s)continue;const r=new BoundingBox$1(s);r.AbsolutePosition=s.Start,r.BorderBottom=s.End.y-s.Start.y,r.BorderRight=s.Width/2,r.BorderLeft=-s.Width/2,this.isVisible(r)&&this.drawLineAsVerticalRectangle(s,GraphicalLayers.Cursor)}this.drawingParameters.drawScrollIndicator&&this.drawScrollIndicator();const t=Math.min(this.graphicalMusicSheet.MusicPages.length,this.rules.MaxPageToDrawNumber);for(let s=0;sQ[0]).filter(Boolean))||[],ie=[];let de=!1;for(let Q=0;QQ.x-H.x))==null?void 0:w[0])==null?void 0:C.measure;break}}}catch(ee){console.log("🚀 ~ error",ee)}let M=0;k?M=((P=k.stave)==null?void 0:P.end_x)||0:M=((I=s.sourceNote.SourceMeasure.VerticalMeasureList[0])==null?void 0:I.getVFStave()).end_x;const G=0;o.ScreenPosition.x=M,o.ScreenPosition.y=F===0?(e.PositionAndShape.Parent.AbsolutePosition.y-3-G)*10:F*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(r.text)&&(o.ScreenPosition.y=(e.PositionAndShape.Parent.AbsolutePosition.y+e.PositionAndShape.Parent.BorderTop+e.PositionAndShape.Parent.BorderMarginTop)*10),["play","listen"].includes(r.text.toLocaleLowerCase())&&r.textAlignment===TextAlignmentEnum.LeftBottom&&(o.ScreenPosition.y=(e.PositionAndShape.Parent.AbsolutePosition.y-1+e.PositionAndShape.Parent.BorderBottom)*10),["ffp","p-f","sfzp","szf"].includes(r.text)&&(r.fontStyle=3,r.text==="sfzp"&&(r.fontHeight=2.3)),(r.text=="R"||r.text=="L")&&(o.ScreenPosition.x+=5),(r.text==="r"||r.text==="l")&&(o.ScreenPosition.x+=6);const m=e.PositionAndShape.Size.width/2*10;if(a.x-m0&&(isTopFont(e.Label.textAlignment)||[TextAlignmentEnum.CenterBottom].includes(e.Label.textAlignment))){let F=-1,B=!1;for(const k of(l==null?void 0:l.AbstractExpressions)||[])if(k.Label===e?F=(N=k==null?void 0:k.parentMeasure)==null?void 0:N.measureListIndex:(R=k.expression)!=null&&R.TempoInBpm&&(B=k.expression.TempoInBpm>0),B&&F>-1){o.ScreenPosition.y-=4*10;break}}this.rules.DYMusicScoreType==="jianpu"?isNaN(parseInt(e.Label.text,10))&&this.renderLabel(e,t,o):this.renderLabel(e,t,o)}calculateLabel(e){const t=new LabelRenderSpecs,s=e.Label,r=new BoundingBox$1(this);r.AbsolutePosition.x=e.PositionAndShape.AbsolutePosition.x,r.AbsolutePosition.y=e.PositionAndShape.AbsolutePosition.y||e.PositionAndShape.Parent.AbsolutePosition.y,t.ScreenPosition=this.applyScreenTransformation(r.AbsolutePosition),t.FontHeightInPixel=this.calculatePixelDistance(s.fontHeight);const o=this.calculatePixelDistance(e.PositionAndShape.Size.width);switch(t.BitmapWidth=Math.ceil(o),t.BitmapHeight=e.TextLines?Math.ceil(t.FontHeightInPixel*(.2+e.TextLines.length)):10,s.textAlignment){case TextAlignmentEnum.LeftTop:t.ScreenPosition.x-=t.BitmapWidth/2,t.ScreenPosition.y+=t.BitmapHeight*1.5;break;case TextAlignmentEnum.LeftCenter:t.ScreenPosition.y-=t.BitmapHeight/2;break;case TextAlignmentEnum.LeftBottom:t.ScreenPosition.y-=t.BitmapHeight;break;case TextAlignmentEnum.CenterTop:t.ScreenPosition.x-=t.BitmapWidth/2;break;case TextAlignmentEnum.CenterCenter:t.ScreenPosition.x-=t.BitmapWidth/2,t.ScreenPosition.y-=t.BitmapHeight/2;break;case TextAlignmentEnum.CenterBottom:t.ScreenPosition.x-=t.BitmapWidth/2,t.ScreenPosition.y-=t.BitmapHeight;break;case TextAlignmentEnum.RightTop:t.ScreenPosition.x-=t.BitmapWidth;break;case TextAlignmentEnum.RightCenter:t.ScreenPosition.x-=t.BitmapWidth,t.ScreenPosition.y-=t.BitmapHeight/2;break;case TextAlignmentEnum.RightBottom:t.ScreenPosition.x-=t.BitmapWidth,t.ScreenPosition.y-=t.BitmapHeight;break;default:throw new ArgumentOutOfRangeException("")}return t}applyScreenTransformations(e){const t=[];for(const s of e)t.push(this.applyScreenTransformation(s));return t}drawSplitScreenLine(){}renderRectangle(e,t,s,r=void 0,o=1){throw new Error("not implemented")}drawScrollIndicator(){}drawSelectionStartSymbol(e){}drawSelectionEndSymbol(e){}renderLabel(e,t,s){throw new Error("not implemented")}renderSystemToScreen(e,t,s){}drawSkyLine(e){}drawBottomLine(e){}drawInstrumentBrace(e,t){}drawGroupBracket(e,t){}isVisible(e){return!0}drawMusicSystem(e){const t=this.getSystemAbsBoundingRect(e),s=this.getSytemBoundingBoxInPixels(t);this.drawMusicSystemComponents(e,s,t)}getSytemBoundingBoxInPixels(e){const t=this.applyScreenTransformationForRect(e);return t.x=Math.round(t.x),t.y=Math.round(t.y),t}getSystemAbsBoundingRect(e){const t=e.PositionAndShape.BoundingRectangle;return new RectangleF2D(e.PositionAndShape.AbsolutePosition.x+e.PositionAndShape.BorderLeft-1,e.PositionAndShape.AbsolutePosition.y+e.PositionAndShape.BorderTop-1,t.width+6,t.height+2)}drawMusicSystemComponents(e,t,s){const r=this.graphicalMusicSheet.SelectionStartSymbol,o=this.graphicalMusicSheet.SelectionEndSymbol;this.drawingParameters.drawSelectionStartSymbol&&r!==void 0&&this.isVisible(r.PositionAndShape)&&this.drawSelectionStartSymbol(r),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,t,s,r){return!0}drawSystemLineObject(e){}drawStaffLine(e){for(const t of e.Measures)this.drawMeasure(t);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,t){t.LyricLines.forEach(s=>{s.Start.y+=t.PositionAndShape.AbsolutePosition.y,s.End.y+=t.PositionAndShape.AbsolutePosition.y,s.Start.x+=t.PositionAndShape.AbsolutePosition.x,s.End.x+=t.PositionAndShape.AbsolutePosition.x,this.drawGraphicalLine(s,this.rules.LyricUnderscoreLineWidth)})}drawExpressions(e){}drawGraphicalLine(e,t,s="black"){return this.drawLine(e.Start,e.End,s,t)}drawLine(e,t,s="#FF0000FF",r){}drawDashes(e){e.forEach(t=>t.SVGNode=this.drawLabel(t,GraphicalLayers.Notes))}drawOctaveShifts(e){}drawStaffLines(e){if(e.StaffLines){const t=e.PositionAndShape.AbsolutePosition;for(let s=0;s<5;s++)this.drawLineAsHorizontalRectangleWithOffset(e.StaffLines[s],t,GraphicalLayers.Notes)}}drawSymbol(e,t,s,r=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 t of e.MusicSystems)this.isVisible(t.PositionAndShape)&&this.drawMusicSystem(t);if(e===e.Parent.MusicPages[0])for(const t of e.Labels)t.SVGNode=this.drawLabel(t,GraphicalLayers.Notes);this.drawableBoundingBoxElement&&this.drawBoundingBoxes(e.PositionAndShape,0,this.drawableBoundingBoxElement)}}drawBoundingBoxes(e,t=0,s="all"){const r=e.DataObject.constructor.name;let o=!1;s==="all"&&(o=!0),(o||r===s)&&this.drawBoundingBox(e,void 0,!0,r,t),t++,e.ChildElements.forEach(a=>this.drawBoundingBoxes(a,t,s))}drawBoundingBox(e,t=void 0,s=!1,r=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);s&&(this.drawLineAsHorizontalRectangle(new GraphicalLine(new PointF2D(e.AbsolutePosition.x-1,e.AbsolutePosition.y),new PointF2D(e.AbsolutePosition.x+1,e.AbsolutePosition.y),.1,OutlineAndFillStyleEnum.BaseWritingColor,t),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,t),o-1)),a=this.applyScreenTransformationForRect(a);const l=this.renderRectangle(a,GraphicalLayers.Background,o,t,.5);if(r){const c=new Label(r),d=new LabelRenderSpecs;d.BitmapWidth=a.width,d.BitmapHeight=a.height,d.FontHeightInPixel=a.height,d.ScreenPosition=new PointF2D(a.x,a.y+12),this.renderLabel(new GraphicalLabel(c,.8,TextAlignmentEnum.CenterCenter,this.rules),o,d)}return l}drawMarkedAreas(e){for(const t of e.GraphicalMarkedAreas)t&&(t.systemRectangle&&this.drawRectangle(t.systemRectangle,GraphicalLayers.Background),t.settings&&(t.settings.SVGNode=this.drawLabel(t.settings,GraphicalLayers.Comment)),t.labelRectangle&&this.drawRectangle(t.labelRectangle,GraphicalLayers.Background),t.label&&(t.label.SVGNode=this.drawLabel(t.label,GraphicalLayers.Comment)))}drawStaffLineSymbols(e){const t=e.ParentStaff.ParentInstrument,s=e.PositionAndShape.AbsolutePosition.x,r=e.PositionAndShape.AbsolutePosition.y+2,o=e.PositionAndShape.BorderRight;t.highlight&&this.drawingParameters.drawHighlights&&this.drawLineAsHorizontalRectangle(new GraphicalLine(new PointF2D(s,r),new PointF2D(s+o,r),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 d=new PointF2D(s+o+2,r);this.drawSymbol(l,a,d)}if(this.drawingParameters.drawErrors)for(const d of e.Measures){const m=d.PositionAndShape,u=m.AbsolutePosition.x,g=m.AbsolutePosition.y+2;d.hasError&&this.graphicalMusicSheet.ParentMusicSheet.DrawErroneousMeasures&&this.drawLineAsHorizontalRectangle(new GraphicalLine(new PointF2D(u,g),new PointF2D(u+m.BorderRight,g),4,OutlineAndFillStyleEnum.ErrorUnderlay),GraphicalLayers.MeasureError)}}}class VexFlowTextMeasurer{constructor(e){this.fontSize=20,this.fontSizeStandard=this.fontSize;const t=document.createElement("canvas");this.context=t.getContext("2d"),this.rules=e}computeTextWidthToHeightRatio(e,t,s,r=void 0,o=this.fontSize){return this.context.font=VexFlowConverter.font(o,s,t,this.rules,r),this.context.measureText(e).width/o}setFontSize(e=this.fontSizeStandard){return this.fontSize=e,e}}class AbstractGraphicalExpression extends GraphicalObject{constructor(e,t,s){super(),this.expression=t,this.parentMeasure=s,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,t){super(t.PositionAndShape.Parent.DataObject,e,e.parentMeasure),this.label=t}get GraphicalLabel(){return this.label}updateSkyBottomLine(){}}class GraphicalInstantaneousDynamicExpression extends AbstractGraphicalExpression{constructor(e,t,s){super(t,e,s.parentSourceMeasure),this.mInstantaneousDynamicExpression=e,this.mMeasure=s}updateSkyBottomLine(){const e=this.parentStaffLine.SkyBottomLineCalculator,t=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginLeft,s=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginRight;let r=0;switch(this.Placement){case PlacementEnum.Above:r=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginTop,e.updateSkyLineInRange(t,s,r);break;case PlacementEnum.Below:r=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginBottom,e.updateBottomLineInRange(t,s,r);break;default:loglevelExports.error("Placement for GraphicalInstantaneousDynamicExpression is unknown")}}}class GraphicalContinuousDynamicExpression extends AbstractGraphicalExpression{constructor(e,t,s){super(t,e,s),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 r;const e=this.parentStaffLine.SkyBottomLineCalculator,t=this.IsVerbal?this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft:0,s=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: "+((r=this.startMeasure)==null?void 0:r.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(t,s,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(t,s,o)}break;default:loglevelExports.error("Placement for GraphicalContinuousDynamicExpression is unknown")}}createCrescendoLines(e,t,s,r=this.rules.WedgeOpeningLength,o=this.rules.WedgeLineWidth){const a=new PointF2D(e,s),l=new PointF2D(t,s-r/2),c=new PointF2D(t,s+r/2);this.addWedgeLines(a,l,c,o)}createFirstHalfCrescendoLines(e,t,s,r=this.rules.WedgeMeasureEndOpeningLength,o=this.rules.WedgeLineWidth){const a=new PointF2D(e,s),l=new PointF2D(t,s-r/2),c=new PointF2D(t,s+r/2);this.addWedgeLines(a,l,c,o)}createSecondHalfCrescendoLines(e,t,s,r=this.rules.WedgeMeasureBeginOpeningLength,o=this.rules.WedgeOpeningLength,a=this.rules.WedgeLineWidth){const l=new PointF2D(e,s-r/2),c=new PointF2D(e,s+r/2),d=new PointF2D(t,s-o/2),m=new PointF2D(t,s+o/2);this.addDoubleLines(l,d,c,m,a)}recalculateCrescendoLines(e,t,s){const r=Math.abs(this.lines[0].Start.y-this.lines[1].Start.y)>1e-4;this.lines.clear(),r?this.createSecondHalfCrescendoLines(e,t,s):this.isSplittedPart?this.createFirstHalfCrescendoLines(e,t,s):this.createCrescendoLines(e,t,s)}createDiminuendoLines(e,t,s,r=this.rules.WedgeOpeningLength,o=this.rules.WedgeLineWidth){const a=new PointF2D(e,s-r/2),l=new PointF2D(e,s+r/2),c=new PointF2D(t,s);this.addWedgeLines(c,a,l,o)}createFirstHalfDiminuendoLines(e,t,s,r=this.rules.WedgeOpeningLength,o=this.rules.WedgeMeasureEndOpeningLength,a=this.rules.WedgeLineWidth){const l=new PointF2D(e,s-r/2),c=new PointF2D(e,s+r/2),d=new PointF2D(t,s-o/2),m=new PointF2D(t,s+o/2);this.addDoubleLines(l,d,c,m,a)}createSecondHalfDiminuendoLines(e,t,s,r=this.rules.WedgeMeasureBeginOpeningLength,o=this.rules.WedgeLineWidth){const a=new PointF2D(e,s-r/2),l=new PointF2D(e,s+r/2),c=new PointF2D(t,s);this.addWedgeLines(c,a,l,o)}recalculateDiminuendoLines(e,t,s){const r=Math.abs(this.lines[0].End.y-this.lines[1].End.y)>1e-4;this.lines.clear(),r?this.createFirstHalfDiminuendoLines(e,t,s):this.isSplittedPart?this.createSecondHalfDiminuendoLines(e,t,s):this.createDiminuendoLines(e,t,s)}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,t,s,r){const o=new GraphicalLine(e,t,r),a=new GraphicalLine(e,s,r);this.lines.push(o),this.lines.push(a)}addDoubleLines(e,t,s,r,o){const a=new GraphicalLine(e,t,o),l=new GraphicalLine(s,r,o);this.lines.push(a),this.lines.push(l)}}class GraphicalUnknownExpression extends AbstractGraphicalExpression{constructor(e,t,s,r,o=void 0){super(e,new AbstractExpression(s),r),this.label=t,this.sourceMultiExpression=o}updateSkyBottomLine(){const e=this.parentStaffLine.SkyBottomLineCalculator,t=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft,s=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginRight;switch(this.Placement){case PlacementEnum.Above:const r=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;e.updateSkyLineInRange(t,s,r);break;case PlacementEnum.Below:const o=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;e.updateBottomLineInRange(t,s,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=(t,s)=>s?String(t.Label.PositionAndShape.RelativePosition[s]):String(t.Label.PositionAndShape.RelativePosition.x)+String(t.Label.PositionAndShape.RelativePosition.y),this.hasDot=(t,s,r,o)=>{const a=s||Object.values(o);for(const l of a){if(r)return t.x===l.x&&t.y===l.y;if(t.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 t,s,r;this.rules.DefaultVexFlowNoteFont==="gonville"&&(Vex.Flow.DEFAULT_FONT_STACK=[(t=Vex.Flow.Fonts)==null?void 0:t.Gonville,(s=Vex.Flow.Fonts)==null?void 0:s.Bravura,(r=Vex.Flow.Fonts)==null?void 0:r.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 t=this.backend.getContext().openGroup();t&&t.classList.add("staffline"),super.drawStaffLine(e);const s=e.PositionAndShape.AbsolutePosition;this.rules.RenderSlurs&&this.drawSlurs(e,s),this.backend.getContext().closeGroup()}drawSlurs(e,t){var r,o,a,l;const s=(r=window.GYM)==null?void 0:r.vfcurveItem;for(let c=0;c(u.index?u.index===c:!0)&&u.MeasureNumberXML==d.staffEntries[d.staffEntries.length-1].parentMeasure.MeasureNumber);m&&(d.bezierEndControlPt.y+=(o=m==null?void 0:m.bezierEndControlPt)!=null&&o.y?m.bezierEndControlPt.y:0,d.bezierEndPt.y+=(a=m==null?void 0:m.bezierEndPt)!=null&&a.y?m.bezierEndPt.y:0,d.bezierStartControlPt.y+=(l=m==null?void 0:m.bezierStartControlPt)!=null&&l.y?m.bezierStartControlPt.y:0)}catch(m){console.log(m)}this.drawSlur(d,t)}}}drawSlur(e,t){const s=[];let r,o,a,l;this.rules.DYMusicScoreType==="jianpu"?((e.placement>0||e.bezierStartPt.y>0)&&(e.bezierStartPt.y=-.8,e.bezierStartControlPt.y=-2.5),r=new PointF2D(e.bezierStartPt.x+t.x,e.bezierStartPt.y+t.y),o=new PointF2D(e.bezierStartControlPt.x+t.x,e.bezierStartControlPt.y+t.y),a=new PointF2D(e.bezierEndControlPt.x+t.x,e.bezierStartControlPt.y+t.y),l=new PointF2D(e.bezierEndPt.x+t.x,e.bezierStartPt.y+t.y)):(r=new PointF2D(e.bezierStartPt.x+t.x,e.bezierStartPt.y+t.y),o=new PointF2D(e.bezierStartControlPt.x+t.x,e.bezierStartControlPt.y+t.y),a=new PointF2D(e.bezierEndControlPt.x+t.x,e.bezierEndControlPt.y+t.y),l=new PointF2D(e.bezierEndPt.x+t.x,e.bezierEndPt.y+t.y)),s.push(this.applyScreenTransformation(r)),s.push(this.applyScreenTransformation(o)),s.push(this.applyScreenTransformation(a)),s.push(this.applyScreenTransformation(l)),e.placement===PlacementEnum.Above?(r.y-=.05,o.y-=.3,a.y-=.3,l.y-=.05):(r.y+=.05,o.y+=.3,a.y+=.3,l.y+=.05),s.push(this.applyScreenTransformation(r)),s.push(this.applyScreenTransformation(o)),s.push(this.applyScreenTransformation(a)),s.push(this.applyScreenTransformation(l)),e.SVGElement=this.backend.renderCurve(s)}drawMeasure(e){e.setAbsoluteCoordinates(e.PositionAndShape.AbsolutePosition.x*unitInPixels,e.PositionAndShape.AbsolutePosition.y*unitInPixels);const t=this.backend.getContext();try{e.draw(t)}catch(s){loglevelExports.warn("VexFlowMusicSheetDrawer.drawMeasure",s)}for(const s of e.staffEntries)this.drawStaffEntry(s)}drawLine(e,t,s="#FF0000FF",r=.2){return e=this.applyScreenTransformation(e),t=this.applyScreenTransformation(t),this.backend.renderLine(e,t,s,r*unitInPixels)}DrawOverlayLine(e,t,s,r="#FF0000FF",o=.2){if(!s.PageNumber||s.PageNumber>this.backends.length||s.PageNumber<1){console.log("VexFlowMusicSheetDrawer.drawOverlayLine: invalid page number / music page number doesn't correspond to an existing backend.");return}const a=s.PageNumber-1,l=this.backends[a];return e=this.applyScreenTransformation(e),t=this.applyScreenTransformation(t),l.renderLine(e,t,r,o*unitInPixels)}drawSkyLine(e){const t=e.PositionAndShape.AbsolutePosition,s=e.PositionAndShape.Size.width;this.drawSampledLine(e.SkyLine,t,s)}drawBottomLine(e){const t=new PointF2D(e.PositionAndShape.AbsolutePosition.x,e.PositionAndShape.AbsolutePosition.y),s=e.PositionAndShape.Size.width;this.drawSampledLine(e.BottomLine,t,s,"#0000FFFF")}drawSampledLine(e,t,s,r="#FF0000FF"){const o=[];let a=0;for(let c=0;c0){const c=this.rules.SamplingUnit;let d=new PointF2D(l.x,l.y),m=new PointF2D(o[0]/c+l.x,l.y);this.drawLine(d,m,r);let u,g;e[0]>=0&&(u=new PointF2D(o[0]/c+l.x,l.y),g=new PointF2D(o[0]/c+l.x,l.y+e[o[0]]),this.drawLine(u,g,r));for(let b=1;b0)for(const t of e.FingeringEntries)t.SVGNode=this.drawLabel(t,GraphicalLayers.Notes);if(e.graphicalChordContainers!==void 0&&e.graphicalChordContainers.length>0)for(const t of e.graphicalChordContainers){const s=t.GraphicalLabel;s.SVGNode=this.drawLabel(s,GraphicalLayers.Notes)}this.rules.RenderLyrics&&e.LyricsEntries.length>0&&this.drawLyrics(e.LyricsEntries,GraphicalLayers.Notes)}drawLyrics(e,t){e.forEach(s=>{const r=s.GraphicalLabel;r.SVGNode=this.drawLabel(r,t)})}drawInstrumentBrace(e,t){e.draw(this.backend.getContext())}drawGroupBracket(e,t){e.draw(this.backend.getContext())}drawOctaveShifts(e){for(const t of e.OctaveShifts)if(t){const s=t,r=this.backend.getContext(),o=s.getTextBracket();o.setContext(r);try{o.draw()}catch(a){loglevelExports.warn(a)}}}drawPedals(e){for(const t of e.Pedals)if(t){const s=t,r=this.backend.getContext(),o=s.getPedalMarking();o.setContext(r),o.draw()}}drawWavyLines(e){for(const t of e.WavyLines)if(t){const s=t,r=this.backend.getContext(),o=s.getVibratoBracket();o.setContext(r),o.draw()}}getMaxExpressionsYAndDots(e){var c,d;const t=[];let s=0;for(const m of e.measures)t.push(m.measureNumber);const r={},o={},a={};for(const m of e.AbstractExpressions)if(m instanceof GraphicalUnknownExpression&&t.includes(m.parentMeasure.MeasureNumber)){const u=this.getDotId(m),g=this.getDotId(m,"x");o[u]||(o[u]=[]),a[g]||(a[g]=[]),this.hasDot(m.Label.PositionAndShape.RelativePosition,o[u],!0)||(o[u].push(m.Label.PositionAndShape.RelativePosition),a[g].push(m.Label.PositionAndShape.RelativePosition)),r[u]=m.Label.PositionAndShape.RelativePosition}let l=0;for(const m of e.AbstractExpressions){const u=(c=m.parentMeasure)==null?void 0:c.MeasureNumber;if(m instanceof GraphicalUnknownExpression&&t.includes(u)){const g=(d=m.parentMeasure.verticalMeasureList[0])==null?void 0:d.stave,b=(g==null?void 0:g.end_x)-(g==null?void 0:g.x),y=this.getDotId(m,"x");if((a[y]||[]).length===1&&l!==u){const S=m.Label.PositionAndShape.AbsolutePosition.y;s=s===0?S:Math.min(s,S)}(a[y]||[]).length!==1&&b/101){let s=Math.min(...e.Lines.map(r=>r.Start.x));e.Lines[0].Start.x=s,e.Lines[1].Start.x=s,[e.Lines[0].Start.y,e.Lines[1].Start.y]=[e.Lines[1].Start.y,e.Lines[0].Start.y],e.Lines[0].End.y+=this.rules.WedgeOpeningLength/2,e.Lines[1].End.y+=this.rules.WedgeOpeningLength}}catch(s){}const t=this.backend.getContext();t.openGroup("lineGroup");for(const s of e.Lines){const r=new PointF2D(e.ParentStaffLine.PositionAndShape.AbsolutePosition.x+s.Start.x,e.ParentStaffLine.PositionAndShape.AbsolutePosition.y+s.Start.y),o=new PointF2D(e.ParentStaffLine.PositionAndShape.AbsolutePosition.x+s.End.x,e.ParentStaffLine.PositionAndShape.AbsolutePosition.y+s.End.y);this.drawLine(r,o,"black",s.Width)}t.closeGroup()}}renderLabel(e,t,s){return this._renderLabel(e,s)}_renderLabel(e,t){var d;if(!e.Label.print)return;const s=e.Label.fontHeight*unitInPixels,{font:r}=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<((d=e.TextLines)==null?void 0:d.length);m++){const u=e.TextLines[m],g=this.calculatePixelDistance(u.xOffset),b=new PointF2D(t.ScreenPosition.x+g,t.ScreenPosition.y),y=this.backend.renderText(s,a,r,u.text,t.FontHeightInPixel,b,o,e.Label.fontFamily);c?c.appendChild(y):c=y,t.ScreenPosition.y=t.ScreenPosition.y+t.FontHeightInPixel,e.TextLines.length>1&&(t.ScreenPosition.y+=this.rules.SpacingBetweenTextLines)}return c}renderRectangle(e,t,s,r,o){return this.backend.renderRectangle(e,s,r,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)}}const VF$c=Vex.Flow,_VexFlowConverter=class{static durations(i,e){const t=[],s=i.clone();for(;s.RealValue>0;){const r=s.RealValue;if(r>=2)t.push("1/2"),s.Sub(new Fraction$1(2,1));else if(r>=1)t.push("w"),s.Sub(new Fraction$1(1,1));else if(r<1&&r>=.5){if(e&&r>.5)return["w"];t.push("h"),s.Sub(new Fraction$1(1,2))}else if(r<.5&&r>=.25){if(e&&r>.25)return["h"];t.push("q"),s.Sub(new Fraction$1(1,4))}else if(r<.25&&r>=.125){if(e&&r>.125)return["q"];t.push("8"),s.Sub(new Fraction$1(1,8))}else if(r<.125&&r>=.0625){if(e&&r>.0625)return["8"];t.push("16"),s.Sub(new Fraction$1(1,16))}else if(r<.0625&&r>=.03125){if(e&&r>.03125)return["16"];t.push("32"),s.Sub(new Fraction$1(1,32))}else if(r<.03125&&r>=.015625){if(e&&r>.015625)return["32"];t.push("64"),s.Sub(new Fraction$1(1,64))}else{if(e)return["64"];t.push("128"),s.Sub(new Fraction$1(1,128))}}return t}static pitch(i,e,t,s=void 0,r=void 0){let o=r;r===void 0&&(o=3),e&&r===void 0&&(o=0,t.ClefType===ClefEnum.F&&(o=2),t.ClefType===ClefEnum.C&&(o=2));const a=NoteEnum[i.FundamentalNote].toLowerCase(),l=Pitch.accidentalVexflow(i.Accidental),c=i.Octave-t.OctaveOffset+o;let d="";return s&&(d=this.NoteHeadCode(s)),[a+"n/"+c+d,l,t]}static restToNotePitch(i,e){let t=i.Octave;switch(e){case ClefEnum.C:case ClefEnum.F:{t+=2;break}case ClefEnum.G:}return new Pitch(i.FundamentalNote,t,AccidentalEnum.NONE)}static NoteHeadCode(i){const e="/",t=i.Filled?"2":"1";switch(i.Shape){case NoteHeadShape.NORMAL:return"";case NoteHeadShape.DIAMOND:return e+"D"+t;case NoteHeadShape.TRIANGLE:return e+"T"+t;case NoteHeadShape.X:return e+"X"+t;case NoteHeadShape.CIRCLEX:return e+"X3";case NoteHeadShape.RECTANGLE:return e+"R"+t;case NoteHeadShape.SQUARE:return e+"S"+t;case NoteHeadShape.SLASH:return"";default:return""}}static GhostNotes(i){const e=[],t=_VexFlowConverter.durations(i,!1);for(const s of t)e.push(new VF$c.GhostNote({duration:s}));return e}static StaveNote(i){var I,N,R,F,B,k,M,G,ee,$,re,ie,de,Q;i.sortForVexflow();const e=i.notes,t=i.parentStaffEntry.parentMeasure.parentSourceMeasure.Rules,s=e[0];let r=[],o;const a=[],l=s.graphicalNoteLength,c=s.sourceNote.NoteTuplet!==void 0;let d=_VexFlowConverter.durations(l,c)[0];s.sourceNote.TypeLength!==void 0&&s.sourceNote.TypeLength!==l&&s.sourceNote.TypeLength.RealValue!==0&&(d=_VexFlowConverter.durations(s.sourceNote.TypeLength,c)[0],s.numberOfDots=s.sourceNote.DotsXml);let m,u=s.numberOfDots,g=!1,b=0,y=!1,S=!1,v;for(const H of e){if(u=1&&he.length-1>=Ae+1&&(le=(B=(F=he[Ae-1])==null?void 0:F.graphicalVoiceEntries[0])==null?void 0:B.parentVoiceEntry,me=(M=(k=he[Ae+1])==null?void 0:k.graphicalVoiceEntries[0])==null?void 0:M.parentVoiceEntry,le&&me)){const be=le.Notes[0],z=me.Notes[0];if((G=be.NoteBeam)!=null&&G.Notes.includes(z)&&z.ParentStaffEntry.ParentStaff.StafflineCount!==1){const J=le.Notes.last().Pitch,T=H.Clef(),q=_VexFlowConverter.pitch(_VexFlowConverter.restToNotePitch(J.getTransposedPitch(-2),T.ClefType),!1,T);J.FundamentalNote===4&&(r=[q[0]])}}}}if(l.RealValue===H.sourceNote.SourceMeasure.ActiveTimeSignature.RealValue&&(r=t.DYMusicScoreType==="staff"?["d/5"]:["R/5"],d="w",u=0,g=!0,b=t.WholeRestXShiftVexflow*unitInPixels),[...H.sourceNote.ParentStaff.Voices].filter(oe=>(oe==null?void 0:oe.VoiceId)!=1).length){const oe=H.parentVoiceEntry.parentStaffEntry.graphicalVoiceEntries,he=H.parentVoiceEntry.parentVoiceEntry.ParentVoice.VoiceId;let le,me;for(const Ae of oe)for(const be of Ae.notes){if(be===H||be.sourceNote.isRest()||!be.sourceNote.PrintObject){H.lineShift=-2;continue}const z=be.parentVoiceEntry.parentVoiceEntry.WantedStemDirection,J=he===1||he===5,T=J?1:-1,Y=be.sourceNote.Pitch.getHalfTone(),O=T===1&&Y>le,V=T===-1&&Y0){let Ae=3;const be=H.Clef();switch(be.ClefType){case ClefEnum.F:Ae=5;break;case ClefEnum.C:Ae=4;break}v=Pitch.fromHalftone(le),r=[_VexFlowConverter.pitch(v,!0,be,void 0,Ae)[0]]}}break}H.sourceNote.Notehead&&H.sourceNote.Notehead.Shape===NoteHeadShape.SLASH&&(y=!0);const ue=H.vfpitch;if(($=(ee=ue[2])==null?void 0:ee.Parent)!=null&&$.Instructions)for(let ne=0,W=ue[2].Parent.Instructions.length;nei.notes[ue].staffLine=H),(t.LedgerLineWidth||t.LedgerLineStrokeStyle)&&(x.ledgerLineStyle||(x.ledgerLineStyle={}),t.LedgerLineWidth&&(x.ledgerLineStyle.lineWidth=t.LedgerLineWidth),t.LedgerLineStrokeStyle&&(x.ledgerLineStyle.strokeStyle=t.LedgerLineStrokeStyle)),t.ColoringEnabled){const H=t.DefaultColorStem;let ue=i.parentVoiceEntry.StemColor;!ue&&H&&(ue=H);const ne={fillStyle:ue,strokeStyle:ue};ue&&(x.setStemStyle(ne),x.flag&&t.ColorFlags&&x.setFlagStyle(ne))}if(x.x_shift=b,i.parentVoiceEntry.IsGrace&&i.notes[0].sourceNote.NoteBeam&&(i.parentVoiceEntry.WantedStemDirection=i.notes[0].sourceNote.NoteBeam.Notes[0].ParentVoiceEntry.WantedStemDirection),i.parentVoiceEntry){let H=i.parentVoiceEntry.WantedStemDirection;const ue=((de=window.GYM)==null?void 0:de.stemDirectionNote)||[],ne=ue==null?void 0:ue.find(W=>W.id===i.notes[0].sourceNote.NoteToGraphicalNoteObjectId);switch(ne&&typeof(ne==null?void 0:ne.direction)=="number"&&(H=ne.direction),H){case StemDirectionType.Up:x.setStemDirection(VF$c.Stem.UP),i.parentVoiceEntry.StemDirection=StemDirectionType.Up;break;case StemDirectionType.Down:x.setStemDirection(VF$c.Stem.DOWN),i.parentVoiceEntry.StemDirection=StemDirectionType.Down;break}}for(let H=0,ue=e.length;H0&&W==="single"){const oe=new VF$c.Tremolo(ne);oe.extra_stroke_scale=t.TremoloStrokeScale,oe.y_spacing_scale=t.TremoloYSpacingScale,x&&x.duration==="w"&&x.stem.setExtension(-9),x.addModifier(H,oe)}if(ne>0&&W==="start"&&this.noteTremoloList.push(x),ne>0&&W==="stop"){this.noteTremoloList.push(x);const oe=new VF$c.Tremolo(ne,[...this.noteTremoloList]);oe.extra_stroke_scale=1.2,oe.y_spacing_scale=1.2,oe.x_shift=-30,x.addModifier(H,oe),this.noteTremoloList=[]}this.glissandoList.length&&(x.setVibrato(this.glissandoList[0].vfnote[0]),this.glissandoList=[]),e[H].sourceNote.glissandoType==="start"&&this.glissandoList.push(e[H])}if(this.slideNote){try{x.setSlideNote(this.slideNote)}catch(H){console.error(H)}this.slideNote=null}if(i.notes[0].sourceNote.slideType==="start"&&(this.slideNote=x),E.Length.RealValue===.25&&E.Notehead&&E.Notehead.Filled===!1){const H=x.getKeyProps();for(let ue=0;ue1){let H=x.getKeyProps().filter(ne=>!ne.code&&ne.line>3);!((Q=window.GYM)==null?void 0:Q.stemDirectionNote)&&H.length===r.length&&x.setStemDirection(-1)}t.DYMusicScoreType==="jianpu"&&window&&window.sett&&window.sett.keySignature&&x.addAccidental(0,new VF$c.Accidental("#"));try{const H=["b","#","§","º","X"],ue={b:"b","#":"#","§":"n",º:"bb",X:"##"};for(const ne of e){const W=ne.sourceNote.voiceEntry.Timestamp;for(const oe of ne.sourceNote.SourceMeasure.StaffLinkedExpressions)for(const he of oe){const le=Fraction$1.Equal(W,he.Timestamp),Ae=he.EntriesList.map(be=>be.label).filter(be=>H.includes(be)).map(be=>ue[be]);if(le){for(const be of Ae)be&&x.addAnnotation(0,new VF$c.Annotation(be));break}}}}catch(H){}return x}static generateArticulations(i,e,t){var s,r,o,a,l,c;if(!(!i||i.getAttribute("type")==="GhostNote"))for(const d of e){let m=VF$c.Modifier.Position.ABOVE;i.getStemDirection()===VF$c.Stem.UP&&(m=VF$c.Modifier.Position.BELOW);let u;const g=d.articulationEnum;switch(t.ArticulationPlacementFromXML&&(d.placement===PlacementEnum.Above?m=VF$c.Modifier.Position.ABOVE:d.placement===PlacementEnum.Below&&(m=VF$c.Modifier.Position.BELOW)),g){case ArticulationEnum.accent:{u=new VF$c.Articulation("a>");break}case ArticulationEnum.downbow:{u=new VF$c.Articulation("am"),d.placement===void 0&&(m=VF$c.Modifier.Position.ABOVE);break}case ArticulationEnum.fermata:{u=new VF$c.Articulation("a@a"),m=VF$c.Modifier.Position.ABOVE;break}case ArticulationEnum.marcatodown:{u=new VF$c.Articulation("a|");break}case ArticulationEnum.marcatoup:{u=new VF$c.Articulation("a^");break}case ArticulationEnum.invertedfermata:{u=new VF$c.Articulation("a@u"),m=VF$c.Modifier.Position.BELOW;break}case ArticulationEnum.lefthandpizzicato:{u=new VF$c.Articulation("a+");break}case ArticulationEnum.naturalharmonic:{u=new VF$c.Articulation("ah");break}case ArticulationEnum.snappizzicato:{u=new VF$c.Articulation("ao");break}case ArticulationEnum.staccatissimo:{u=new VF$c.Articulation("av");break}case ArticulationEnum.staccato:{u=new VF$c.Articulation("a.");break}case ArticulationEnum.tenuto:{u=new VF$c.Articulation("a-");break}case ArticulationEnum.upbow:{u=new VF$c.Articulation("a|"),d.placement===void 0&&(m=VF$c.Modifier.Position.ABOVE);break}case ArticulationEnum.strongaccent:{u=new VF$c.Articulation("a^");break}}u&&(!i.hasStem()&&!i.isRest()&&g==ArticulationEnum.accent&&i.getLineNumber()>=3&&(m=VF$c.Modifier.Position.ABOVE,(r=(s=i==null?void 0:i.modifiers)==null?void 0:s.filter(S=>["TREMOLO"].includes(S.getCategory().toLocaleUpperCase())))!=null&&r.length&&u.setYShift(-16)),g===ArticulationEnum.strongaccent&&(m=VF$c.Modifier.Position.ABOVE,(o=window.GYM)!=null&&o.customArtPosition&&(i.getStemDirection()===1?m=VF$c.Modifier.Position.ABOVE:(m=VF$c.Modifier.Position.BELOW,u=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&&i.getDuration()==="w"&&((c=window.GYM)!=null&&c.customTenutoItem)&&(m=VF$c.Modifier.Position.ABOVE),u.setPosition(m),i.addModifier(0,u))}}static generateOrnaments(i,e){let t=VF$c.Modifier.Position.ABOVE;e.placement===PlacementEnum.Below&&(t=VF$c.Modifier.Position.BELOW);let s;switch(e.GetOrnament){case OrnamentEnum.DelayedInvertedTurn:{s=new VF$c.Ornament("turn_inverted"),s.setDelayed(!0);break}case OrnamentEnum.DelayedTurn:{s=new VF$c.Ornament("turn"),s.setDelayed(!0);break}case OrnamentEnum.InvertedMordent:{s=new VF$c.Ornament("mordent"),s.setDelayed(!1);break}case OrnamentEnum.InvertedTurn:{s=new VF$c.Ornament("turn_inverted"),s.setDelayed(!1);break}case OrnamentEnum.Mordent:{s=new VF$c.Ornament("mordent_inverted"),s.setDelayed(!1);break}case OrnamentEnum.Trill:{s=new VF$c.Ornament("tr"),s.setDelayed(!1);break}case OrnamentEnum.Turn:{s=new VF$c.Ornament("turn"),s.setDelayed(!1);break}default:{loglevelExports.warn("unhandled OrnamentEnum type: "+e.GetOrnament);return}}s&&(e.AccidentalBelow!==AccidentalEnum.NONE&&s.setLowerAccidental(Pitch.accidentalVexflow(e.AccidentalBelow)),e.AccidentalAbove!==AccidentalEnum.NONE&&s.setUpperAccidental(Pitch.accidentalVexflow(e.AccidentalAbove)),s.setPosition(t),i.addModifier(0,s))}static StrokeTypeFromArpeggioType(i){switch(i){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(i){const e=[],t=i.notes.reverse(),s=[],r=i.notes[0].graphicalNoteLength,o=i.notes[0].sourceNote.NoteTuplet!==void 0;let a=_VexFlowConverter.durations(r,o)[0],l=0;for(const d of i.notes){const m=d.sourceNote,u={str:m.StringNumberTab,fret:m.FretNumber};e.push(u),m.BendArray&&m.BendArray.forEach(function(g){let b;const y=g.bendalter-u.fret;y>1?b="Full":y===1?b="1/2":b="1/4",g.direction==="up"?s.push({type:VF$c.Bend.UP,text:b,width:10}):s.push({type:VF$c.Bend.DOWN,text:b,width:10})}),l(i[i.VA8=0]="VA8",i[i.VB8=1]="VB8",i[i.MA15=2]="MA15",i[i.MB15=3]="MB15",i[i.NONE=4]="NONE",i))(OctaveEnum||{});class AbstractTempoExpression extends AbstractExpression{constructor(e,t,s,r){super(t),this.label=e,this.staffNumber=s,this.parentMultiTempoExpression=r}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,t){for(const s of e)if(AbstractTempoExpression.stringContainsSeparatedWord(t.toLowerCase().trim(),s.toLowerCase().trim()))return!0;return!1}static stringContainsSeparatedWord(e,t){return e===t||e.indexOf(" "+t)!==-1||e.indexOf(t+" ")!==-1}}const _InstantaneousTempoExpression=class extends AbstractTempoExpression{constructor(i,e,t,s,r,o=!1){super(i,e,t,r),this.setTempoAndTempoType(s)}static getDefaultValueForTempoType(i){switch(i){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(i){return i?_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLarghissimo,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoGrave,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLento,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLargo,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLarghetto,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAdagio,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAdagietto,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndanteModerato,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndante,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndantino,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoModerato,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegretto,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegroModerato,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegro,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoVivace,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoVivacissimo,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegrissimo,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoPresto,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoPrestissimo,i)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoChangesGeneral,i):!1}get Label(){return this.label}set Label(i){this.label=i}get Placement(){return this.placement}set Placement(i){this.placement=i}get StaffNumber(){return this.staffNumber}set StaffNumber(i){this.staffNumber=i}get Enum(){return this.tempoEnum}get TempoInBpm(){return this.tempoInBpm}set TempoInBpm(i){this.tempoInBpm=i}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(i){if(!this.label){this.tempoInBpm=i,this.tempoEnum=23;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLarghissimo,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(1)),this.tempoInBpm=i,this.tempoEnum=1;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoGrave,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(2)),this.tempoInBpm=i,this.tempoEnum=2;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLento,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(3)),this.tempoInBpm=i,this.tempoEnum=3;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLargo,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(4)),this.tempoInBpm=i,this.tempoEnum=4;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLarghetto,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(5)),this.tempoInBpm=i,this.tempoEnum=5;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAdagio,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(6)),this.tempoInBpm=i,this.tempoEnum=6;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAdagietto,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(7)),this.tempoInBpm=i,this.tempoEnum=7;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndanteModerato,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(8)),this.tempoInBpm=i,this.tempoEnum=8;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndante,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(9)),this.tempoInBpm=i,this.tempoEnum=9;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndantino,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(10)),this.tempoInBpm=i,this.tempoEnum=10;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoModerato,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(11)),this.tempoInBpm=i,this.tempoEnum=11;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegretto,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(12)),this.tempoInBpm=i,this.tempoEnum=12;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegroModerato,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(13)),this.tempoInBpm=i,this.tempoEnum=13;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegro,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(14)),this.tempoInBpm=i,this.tempoEnum=14;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoVivace,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(15)),this.tempoInBpm=i,this.tempoEnum=15;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoVivacissimo,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(16)),this.tempoInBpm=i,this.tempoEnum=16;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegrissimo,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(17)),this.tempoInBpm=i,this.tempoEnum=17;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoPresto,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(18)),this.tempoInBpm=i,this.tempoEnum=18;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoPrestissimo,this.label)){i===0&&(i=_InstantaneousTempoExpression.getDefaultValueForTempoType(19)),this.tempoInBpm=i,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=(i=>(i[i.none=0]="none",i[i.larghissimo=1]="larghissimo",i[i.grave=2]="grave",i[i.lento=3]="lento",i[i.largo=4]="largo",i[i.larghetto=5]="larghetto",i[i.adagio=6]="adagio",i[i.adagietto=7]="adagietto",i[i.andanteModerato=8]="andanteModerato",i[i.andante=9]="andante",i[i.andantino=10]="andantino",i[i.moderato=11]="moderato",i[i.allegretto=12]="allegretto",i[i.allegroModerato=13]="allegroModerato",i[i.allegro=14]="allegro",i[i.vivace=15]="vivace",i[i.vivacissimo=16]="vivacissimo",i[i.allegrissimo=17]="allegrissimo",i[i.presto=18]="presto",i[i.prestissimo=19]="prestissimo",i[i.lastRealTempo=20]="lastRealTempo",i[i.addon=21]="addon",i[i.changes=22]="changes",i[i.metronomeMark=23]="metronomeMark",i))(TempoEnum||{});const _MoodExpression=class extends AbstractExpression{constructor(i,e,t){super(e),this.label=i,this.staffNumber=t,this.setMoodType()}static isInputStringMood(i){return i?_MoodExpression.isStringInStringList(_MoodExpression.listMoodAffettuoso,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodAgitato,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodAnimato,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodAppassionato,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodBrillante,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodCantabile,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodDolce,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodEnergico,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodEroico,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodEspressivo,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodFurioso,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodGiocoso,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodGioioso,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodGrandioso,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodGrazioso,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodLacrimoso,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodLeggiero,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMaestoso,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMalinconico,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMarcato,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMarziale,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMesto,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMorendo,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodNobilmente,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodPatetico,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodPesante,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodSaltando,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodSautille,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodScherzando,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodSostenuto,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodSpiccato,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodTenerezza,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodTranquillamente,i)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodTrionfante,i):!1}get Label(){return this.label}set Label(i){this.label=i}get Mood(){return this.moodType}set Mood(i){this.moodType=i}get StaffNumber(){return this.staffNumber}set StaffNumber(i){this.staffNumber=i}get Placement(){return this.placement}set Placement(i){this.placement=i}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,t,s,r){super(t),this.label=e,this.staffNumber=r,s===void 0&&(s=TextAlignmentEnum.LeftBottom),this.textAlignment=s}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,t){this.unknownList=[],this.moodList=[],this.expressions=[],this.sourceMeasure=e,this.timestamp=t}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 t;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=(t=this.expressions[0].expression.fontStyle)!=null?t:FontStyles.Regular)),e}addExpression(e,t){e instanceof InstantaneousDynamicExpression?(this.instantaneousDynamic&&this.removeExpressionFromEntryList(this.InstantaneousDynamic),this.instantaneousDynamic=e,this.instantaneousDynamic.ParentMultiExpression=this):e instanceof ContinuousDynamicExpression?this.startingContinuousDynamic=e:e instanceof MoodExpression?this.moodList.push(e):e instanceof UnknownExpression&&this.unknownList.push(e),this.addExpressionToEntryList(e,t)}CompareTo(e){return this.Timestamp.RealValue>e.Timestamp.RealValue?1:this.Timestamp.RealValue=5&&i<=12}get TempoType(){return this.tempoType}set TempoType(i){this.tempoType=i}get StartTempo(){return this.startTempo}set StartTempo(i){this.startTempo=i}get EndTempo(){return this.endTempo}set EndTempo(i){this.endTempo=i}get AbsoluteEndTimestamp(){return this.absoluteEndTimestamp}set AbsoluteEndTimestamp(i){this.absoluteEndTimestamp=i}get AbsoluteTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp}getAbsoluteFloatTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp.RealValue}getInterpolatedTempo(i){const e=Fraction$1.plus(this.parentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.parentMultiTempoExpression.Timestamp);if(i.lt(e))return-1;if(this.absoluteEndTimestamp.lt(i))return-2;const t=Fraction$1.minus(i,e).RealValue/Fraction$1.minus(this.absoluteEndTimestamp,e).RealValue;return Math.max(0,Math.min(250,this.startTempo+(this.endTempo-this.startTempo)*t))}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,t){this.expressions=[],this.sourceMeasure=e,this.timestamp=t}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,t){if(this.checkIfAlreadyExists(e))return;e instanceof InstantaneousTempoExpression?this.instantaneousTempo=e:e instanceof ContinuousTempoExpression&&(this.continuousTempo=e);const s=new TempoExpressionEntry;s.prefix=t,s.Expression=e,s.label=e.Label,this.expressions.push(s)}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,t,s,r){for(let o=0,a=e.length;o0&&(l.beginInstructionsWidth=s),r>0&&(l.endInstructionsWidth=r)}}finalizeCurrentAndCreateNewSystem(e,t=!1,s=!0,r=!1){this.finalizeCurrentSystem(e,t,s,r),this.currentSystemParams=new SystemBuildParameters,e!==void 0&&this.measureListIndex=1){const t=this.currentSystemParams.currentSystem.GraphicalMeasures[this.currentSystemParams.currentSystem.GraphicalMeasures.length-1];let s=0;const r=e[e.length-1];r.endLine===SystemLinesEnum.DotsBoldBoldDots&&(r.endLine=SystemLinesEnum.DotsThinBold,s=t[0].getLineWidth(SystemLinesEnum.DotsBoldBoldDots)/2-t[0].getLineWidth(SystemLinesEnum.DotsThinBold)),this.currentSystemParams.currentSystemFixWidth-=s;for(let o=0,a=t.length;o1){a=!0;break}}let l=0;for(let c=0;c=0&&this.measureList[C]){const I=(E=this.measureList[C][0])==null?void 0:E.parentSourceMeasure;I!=null&&I.ImplicitMeasure&&(I!=null&&I.RhythmPrinted)&&(_=!1)}_&&(t.addRhythmAtBegin(d),t.parentSourceMeasure.RhythmPrinted=d,b=!0)}return(u||g||b)&&(a+=t.beginInstructionsWidth,b&&(a+=this.rules.RhythmRightMargin)),a}addInstructionsAtMeasureEnd(e,t,s){if(!e||!e.Instructions||e.Instructions.length===0)return 0;for(let r=0,o=e.Instructions.length;r0&&(this.currentSystemParams.systemMeasures.push({beginLine:SystemLinesEnum.None,endLine:SystemLinesEnum.None}),this.currentSystemParams.currentWidth+=r,this.currentSystemParams.currentSystemFixWidth+=r)}addExtraInstructionMeasure(e,t,s){const r=this.currentSystemParams.currentSystem,o=MusicSheetCalculator.symbolFactory.createExtraGraphicalMeasure(r.StaffLines[e]);t&&o.addKeyAtBegin(t,this.activeKeys[e],this.activeClefs[e]),s!==void 0&&s.PrintObject&&o.addRhythmAtBegin(s),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,r.StaffLines[e].Measures.push(o),a}addStaveMeasuresToSystem(e){if(e[0]){const t=[];for(let r=0;r1){const l=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,e.measureListIndex+e.multipleRestMeasures-1);e=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[l]}}finally{}const t=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures,s=t[this.measureListIndex];let r=!1;return s.allRests&&(r=(a=(o=t[this.measureListIndex+s.multipleRestMeasures-1])==null?void 0:o.endsWithLineRepetition)==null?void 0:a.call(o)),this.nextMeasureBeginsLineRepetition()&&this.thisMeasureEndsLineRepetition()?SystemLinesEnum.DotsBoldBoldDots:this.thisMeasureEndsLineRepetition()||r?SystemLinesEnum.DotsThinBold:this.nextMeasureHasKeyInstructionChange()||this.thisMeasureEndsWordRepetition()||this.nextMeasureBeginsWordRepetition()?SystemLinesEnum.DoubleThin:e&&e.endingBarStyleEnum!==void 0?e.endingBarStyleEnum:SystemLinesEnum.SingleThin}getLineWidth(e,t,s){let r=e.getLineWidth(t);return t===SystemLinesEnum.DotsBoldBoldDots&&(r/=2),s&&t===SystemLinesEnum.BoldThinDots&&(r+=this.rules.DistanceBetweenLastInstructionAndRepetitionBarline),r}previousMeasureEndsLineRepetition(){if(this.measureListIndex===0)return!1;for(let e=0,t=this.measureList[this.measureListIndex-1].length;e=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||!this.measureList[e])return!1;for(let t=0,s=this.measureList[e].length;t=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||e>this.measureList.length-1)return!1;for(let t=0,s=this.measureList[e].length;t1)for(let l=1;lo&&(o=m)}for(let l=0;lthis.rules.PageHeight-this.rules.PageBottomMargin&&(r++,r<=4&&console.log(`warning: could not fit a single system on page ${e.PageNumber} and measure number ${s.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],d=c.StaffLines[c.StaffLines.length-1],m=d.PositionAndShape;let u=this.findRequiredDistanceWithSkyBottomLine(c,s);u=Math.max(o,u),u+=this.rules.MinSkyBottomDistBetweenSystems,((a=window==null?void 0:window.appName)==null?void 0:a.toLocaleUpperCase())==="GYM"&&(u=u<16?16:u);const g=this.hasExpressionCounts(s);g.TempoCount>0&&this.rules.MetronomeMarksDrawn&&(u+=2),g.OtherCount>0&&this.rules.MetronomeMarksDrawn&&(u+=2),u=Math.max(u,this.rules.MinimumDistanceBetweenSystems+d.StaffHeight);const b=t+m.RelativePosition.y+u,y=b+s.PositionAndShape.BorderMarginBottom;if(!(this.rules.NewPageAtXMLNewPageAttribute&&c.breaksPage)&&y0&&console.log(`total amount of pages that couldn't fit a single music system: ${r} of ${e.PageNumber}`)}findRequiredDistanceWithSkyBottomLine(e,t){const s=e.StaffLines[e.StaffLines.length-1],r=t.StaffLines[0],o=s.BottomLine,a=r.SkyLine,l=s.PositionAndShape,c=r.PositionAndShape,d=1/this.rules.SamplingUnit;let m=0;for(let u=0;u=a.length)break;const y=Math.max(0,b-6),S=Math.min(a.length-1,b+6);let v=0;for(let A=y;A<=S;A++)v=Math.min(v,a[A]);const x=g-v;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,t,s){this.getOpenOctaveShift=e,this.getAbsoluteStartTimestamp=t,this.getAbsoluteEndTimestamp=s}}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,t){if(!t)return;const s=t.FundamentalNote+t.Octave*12,r=this.currentAlterationsComparedToKeyInstructionList.indexOf(s)>=0;if(this.currentInMeasureNoteAlterationsDict.containsKey(s)){if(r&&this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(s),1),this.currentInMeasureNoteAlterationsDict.getValue(s)!==t.AccidentalHalfTones){this.keySignatureNoteAlterationsDict.containsKey(s)&&this.keySignatureNoteAlterationsDict.getValue(s)!==t.AccidentalHalfTones?(this.currentAlterationsComparedToKeyInstructionList.push(s),this.currentInMeasureNoteAlterationsDict.setValue(s,t.AccidentalHalfTones)):t.Accidental!==AccidentalEnum.NONE&&this.currentInMeasureNoteAlterationsDict.remove(s);const o=this.currentInMeasureNoteAlterationsDict.getValue(s);if(t.Accidental===AccidentalEnum.NONE&&(Math.abs(o)===.5?t=new Pitch(t.FundamentalNote,t.Octave,AccidentalEnum.NONE):t=new Pitch(t.FundamentalNote,t.Octave,AccidentalEnum.NATURAL)),this.isAlterAmbiguousAccidental(t.Accidental)&&!t.AccidentalXml)return;MusicSheetCalculator.symbolFactory.addGraphicalAccidental(e,t)}}else if(t.Accidental!==AccidentalEnum.NONE){if(r||this.currentAlterationsComparedToKeyInstructionList.push(s),this.currentInMeasureNoteAlterationsDict.setValue(s,t.AccidentalHalfTones),this.isAlterAmbiguousAccidental(t.Accidental)&&!t.AccidentalXml)return;MusicSheetCalculator.symbolFactory.addGraphicalAccidental(e,t)}else r&&(t=new Pitch(t.FundamentalNote,t.Octave,AccidentalEnum.NATURAL),this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(s),1),MusicSheetCalculator.symbolFactory.addGraphicalAccidental(e,t))}isAlterAmbiguousAccidental(e){return e===AccidentalEnum.SLASHFLAT||e===AccidentalEnum.QUARTERTONEFLAT}reactOnKeyInstructionChange(){const e=this.activeKeyInstruction.AlteratedNotes;let t;this.activeKeyInstruction.Key>0?t=AccidentalEnum.SHARP:t=AccidentalEnum.FLAT,this.keySignatureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.length=0;for(let s=-9;s<9;s++)for(let r=0;r0?(s=m-1,e.push({startIndex:t,endIndex:s}),t=m):b.HasEndLine&&this.rules.NewPartAndSystemAfterFinalBarline&&(s=m,e.push({startIndex:t,endIndex:s}),t=m+1)}t0?Number(B):6,w===B||_+N>S&&w%2===0?(o.push(w),_=I,w=1):w++}else _>S?(o.push(w),_=I,w=1):w++;I>S?R=C+1:R=Math.ceil(R),A===R?E+=1:(r.push(E),A=R,E=1)}r.push(E),o.push(w),o=o.filter(Boolean),console.log(o,r)}return this.buildPreparedMusicSystems(o)}buildPreparedMusicSystems(e){let t=!1;this.currentSystemParams=new SystemBuildParameters,this.currentSystemParams.currentSystem=this.initMusicSystem();for(let s=0,r=this.measureList.length;s0&&this.rules.RenderMultipleRestMeasures){u.isReducedToMultiRest=!0,u.multipleRestMeasureNumber=1;const b=u.multipleRestMeasures-1;d+=b;for(let y=1;y<=b;y++){const S=e.SourceMeasures[u.MeasureNumber-1+y];S.multipleRestMeasureNumber=y+1,S.isReducedToMultiRest=!0,t.push([void 0])}}}if(this.rules.AutoGenerateMutipleRestMeasuresFromRestMeasures&&this.rules.RenderMultipleRestMeasures){let d,m=0;for(let u=0,g=e.SourceMeasures.length;u0){d.isReducedToMultiRest=!0,d.multipleRestMeasureNumber=1,m++,b.multipleRestMeasureNumber=m,b.isReducedToMultiRest=!0;for(let y=0;y1){d.multipleRestMeasures=m;const y=this.createGraphicalMeasuresForSourceMeasure(d,s,o,l,r);t[d.measureListIndex]=y,m=0,d=void 0}else m=0,d=void 0}if(m>1){d.multipleRestMeasures=m,d.isReducedToMultiRest=!0;const u=this.createGraphicalMeasuresForSourceMeasure(d,s,o,l,r);t[d.measureListIndex]=u,m=0,d=void 0}}const c=r.map(d=>d.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,t){let s=0;const r=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),s=a*1.2+t+r;for(let l=1;l0)return;const a=t.Measures[o];(a.MeasureNumber===0||a.MeasureNumber===1)&&(s=a.MeasureNumber),a!==t.Measures[0]&&this.rules.MeasureNumberLabelXOffset?r=this.rules.MeasureNumberLabelXOffset:r=0;const l=this.rules.UseXMLMeasureNumbers&&a.MeasureNumber===1&&a.parentSourceMeasure.getPrintedMeasureNumber()!==1;((a.MeasureNumber===s||a.MeasureNumber>=s+this.rules.MeasureNumberLabelOffset)&&!a.parentSourceMeasure.ImplicitMeasure||l)&&((a.MeasureNumber!==1||a.MeasureNumber===1&&a!==t.Measures[0]||l)&&this.calculateSingleMeasureNumberPlacement(a,t,e,r),s=a.MeasureNumber)}}calculateSingleMeasureNumberPlacement(e,t,s,r=0){const o=e.parentSourceMeasure.getPrintedMeasureNumber().toString(),a=new Label(o),l=new GraphicalLabel(a,this.rules.MeasureNumberLabelHeight,TextAlignmentEnum.LeftBottom,this.rules),c=t.SkyBottomLineCalculator;l.setLabelPositionAndShapeBorders(),l.PositionAndShape.Parent=s.PositionAndShape;const d=t.PositionAndShape.RelativePosition.x+e.PositionAndShape.RelativePosition.x-l.PositionAndShape.BorderMarginLeft+r;let m,u=d,g=d-l.PositionAndShape.BorderLeft+l.PositionAndShape.BorderRight;u-=t.PositionAndShape.RelativePosition.x,g-=t.PositionAndShape.RelativePosition.x;const b=u+.5,y=g-.5,S=c.getSkyLineMinInRange(b,y);if(e===t.Measures[0]){let v=0;if(s.GroupBrackets.length>0)for(const x of s.GroupBrackets)v=Math.min(v,x.PositionAndShape.BorderTop);m=Math.min(S,v)}else m=S;m=Math.min(0,m),l.PositionAndShape.RelativePosition=new PointF2D(d,m),s.MeasureNumberLabels.push(l)}calculateMeasureNumberSkyline(e){const t=e.StaffLines[0];for(const s of e.MeasureNumberLabels){let r=s.PositionAndShape.RelativePosition.x,o=r-s.PositionAndShape.BorderLeft+s.PositionAndShape.BorderRight;r-=t.PositionAndShape.RelativePosition.x,o-=t.PositionAndShape.RelativePosition.x,t.SkyBottomLineCalculator.updateSkyLineInRange(r,o,s.PositionAndShape.RelativePosition.y+s.PositionAndShape.BorderMarginTop)}}layoutGraphicalTie(e,t,s){throw new Error(this.abstractNotImplementedErrorMessage)}calculateSingleStaffLineLyricsPosition(e,t){let s=0,r=this.rules.StaffHeight;const o=[],a=e.SkyBottomLineCalculator;let l=e.Measures.length;for(let d=0;d0){o.push(y),s=Math.max(s,y.LyricsEntries.length);const S=y.PositionAndShape.RelativePosition.x+u.x;let v=Number.MAX_VALUE,x=Number.MIN_VALUE;for(let E=0;E0){const d=e.PositionAndShape.Size.width;let m=o[0].PositionAndShape.RelativePosition.x+o[0].PositionAndShape.BorderMarginLeft+o[0].parentMeasure.PositionAndShape.RelativePosition.x;m=m>d?d:m,a.updateBottomLineInRange(m,d,c)}return o}calculateLyricsExtendsAndDashes(e){for(let t=0,s=e.length;t0||e.UnknownList.length>0){let c="";for(let b=0,y=e.EntriesList.length;be.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 t=[];for(let a=this.rules.MinMeasureToDrawIndex,l=e.length;a0)&&(r=s.getSkyLineMinInRange(u,g));let b=0;l===0?(b+=this.rules.ChordSymbolYOffset,b+=.1):b+=this.rules.ChordSymbolYPadding,b*=-1;const y=c.GraphicalLabel;y.PositionAndShape.RelativePosition.y=r+b,y.setLabelPositionAndShapeBorders(),y.PositionAndShape.calculateBoundingBox(),s.updateSkyLineInRange(u,g,r+y.PositionAndShape.BorderMarginTop)}}}}calculateAlignedChordSymbolsOffset(e,t){let s=Number.MAX_SAFE_INTEGER;for(const r of e)for(const o of r.graphicalChordContainers){const a=r.PositionAndShape,l=o.PositionAndShape,c=l.BorderMarginLeft+a.AbsolutePosition.x,d=l.BorderMarginRight+a.AbsolutePosition.x;s=Math.min(s,t.getSkyLineMinInRange(c,d))}return s}layoutMeasureWithWholeRest(e,t,s){}layoutBeams(e){}layoutArticulationMarks(e,t,s){}layoutOrnament(e,t,s){}calculateRestNotePlacementWithinGraphicalBeam(e,t,s,r,o){}calculateTupletNumbers(){}calculateSlurs(){}calculateDynamicExpressionsForMultiExpression(e,t,s){}calculateGraphicalVerbalContinuousDynamic(e,t){const s=e.Label,r=t.x+s.PositionAndShape.BorderMarginLeft,o=t.x+s.PositionAndShape.BorderMarginRight,a=e.ContinuousDynamic.Placement,c=e.ParentStaffLine.SkyBottomLineCalculator;let d;a===PlacementEnum.Below?(d=c.getBottomLineMaxInRange(r,o),s.PositionAndShape.RelativePosition=new PointF2D(t.x,d-s.PositionAndShape.BorderMarginTop)):(d=c.getSkyLineMinInRange(r,o),s.PositionAndShape.RelativePosition=new PointF2D(t.x,d-s.PositionAndShape.BorderMarginBottom))}calculateGraphicalContinuousDynamic(e,t){var M,G,ee;const s=e.ParentStaffLine.ParentStaff.idInMusicSheet,r=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(e.ContinuousDynamic.EndMultiExpression.SourceMeasureParent,s);if(!r){loglevelExports.warn("MusicSheetCalculator.calculateGraphicalContinuousDynamic: No endMeasure found");return}e.EndMeasure=r;const o=e.ParentStaffLine,a=r.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 d=Fraction$1.createFromFraction(e.ContinuousDynamic.EndMultiExpression.AbsoluteTimestamp),m=this.graphicalMusicSheet.GetVerticalContainerFromTimestamp(d),u=m.getFirstNonNullStaffEntry().parentMeasure,g=u.PositionAndShape.AbsolutePosition.x+u.PositionAndShape.BorderRight;let b=new Fraction$1(0,0,0);for(const $ of m.StaffEntries){const re=(M=$==null?void 0:$.sourceStaffEntry)==null?void 0:M.calculateMaxNoteLength();re!=null&&re.gt(b)&&(b=re)}const y=this.getRelativePositionInStaffLineFromTimestamp(d,s,a,c,0),S=Fraction$1.plus(d,b),v=this.getRelativePositionInStaffLineFromTimestamp(S,s,a,c,0);v.x>y.x&&v.xE){const de=A.StaffLines[$].PositionAndShape.RelativePosition.y-o.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;B=this.rules.StaffHeight+de/2}else B=this.rules.WedgePlacementBelowY;B-=this.rules.WedgeOpeningLength/2,l||(k=B);let re=_.getBottomLineMaxInRange(I,R);if(re>B&&(B=re),Ek&&(k=re),k+=this.rules.WedgeOpeningLength/2,k+=this.rules.WedgeVerticalMargin),B+=this.rules.WedgeOpeningLength/2,B+=this.rules.WedgeVerticalMargin}else if(w===PlacementEnum.Above){if(o.ParentStaff.ParentInstrument.Staves.length===1)B=this.rules.WedgePlacementAboveY;else{let re=0;E>0&&(re=E-1);const ie=A.StaffLines[re];B=-(o.PositionAndShape.RelativePosition.y-ie.PositionAndShape.RelativePosition.y-this.rules.StaffHeight)/2}B+=this.rules.WedgeOpeningLength/2,l||(k=B);let $=_.getSkyLineMinInRange(I,R);if($1&&E>0){const re=o.findClosestStaffEntry(I),ie=o.findClosestStaffEntry(R);re&&ie&&re.parentVerticalContainer}l||($=a.SkyBottomLineCalculator.getSkyLineMinInRange(N,F),$-u/2?c=-u/2:c=d-e.PositionAndShape.BorderMarginBottom}else c=d-e.PositionAndShape.BorderMarginBottom;e.PositionAndShape.RelativePosition=new PointF2D(t.x,c)}else if(e.Placement===PlacementEnum.Below){const d=l.getBottomLineMaxInRange(o,a),m=r.ParentStaff.ParentInstrument.Staves[r.ParentStaff.ParentInstrument.Staves.length-1];if(r.isPartOfMultiStaffInstrument()&&r.ParentStaff!==m){const g=r.ParentMusicSystem.StaffLines[r.ParentMusicSystem.StaffLines.indexOf(r)+1].PositionAndShape.RelativePosition.y-r.PositionAndShape.RelativePosition.y-this.rules.StaffHeight,b=e.PositionAndShape.BorderMarginBottom;d+be.PositionAndShape.Size.width&&(g=e.PositionAndShape.Size.width-this.rules.MeasureRightMargin,u=g-d.PositionAndShape.MarginSize.width,t.x=u-d.PositionAndShape.BorderMarginLeft);let b;const y=e.SkyBottomLineCalculator;return o===PlacementEnum.Below?b=y.getBottomLineMaxInRange(u,g):b=y.getSkyLineMinInRange(u,g),d.PositionAndShape.RelativePosition=new PointF2D(t.x,b),o===PlacementEnum.Below?y.updateBottomLineInRange(u,g,d.PositionAndShape.BorderMarginBottom+b):y.updateSkyLineInRange(u,g,d.PositionAndShape.BorderMarginTop+b),d}calculateTempoExpressionsForMultiTempoExpression(e,t,s,r){metronomeMarks={};const o=Fraction$1.plus(e.AbsoluteTimestamp,t.Timestamp),a=this.graphicalMusicSheet.MeasureList[s];let l=new PointF2D;if(t.ContinuousTempo||t.InstantaneousTempo){if(this.rules.MinMeasureToDrawIndex>0||!a[0])return;let c=a[0].ParentStaffLine,d=a[0].PositionAndShape.RelativePosition.x,m=0;for(let u=0;u0){c=a[u].ParentStaffLine,d=a[u].PositionAndShape.RelativePosition.x,m=u;break}if(l=this.getRelativePositionInStaffLineFromTimestamp(o,m,c,c.isPartOfMultiStaffInstrument(),d),t.EntriesList.length>0&&t.EntriesList[0].Expression instanceof InstantaneousTempoExpression){const u=t.EntriesList[0].Expression;if(u.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 b=g.GraphicalInstructions.last();l.x=b.PositionAndShape.RelativePosition.x}this.rules.CompactMode&&(l.x=c.PositionAndShape.RelativePosition.x+c.Measures[0].PositionAndShape.RelativePosition.x)}}for(const u of t.EntriesList){let g=TextAlignmentEnum.CenterBottom;this.rules.CompactMode&&(g=TextAlignmentEnum.LeftBottom);const b=this.calculateLabel(c,l,u.label,t.getFontstyleOfFirstEntry(),u.Expression.Placement,this.rules.UnknownTextHeight,g);if(u.Expression instanceof InstantaneousTempoExpression){for(const S of c.AbstractExpressions)S instanceof GraphicalInstantaneousTempoExpression&&(S.SourceExpression.Label,u.Expression.Label);new GraphicalInstantaneousTempoExpression(u.Expression,b).ParentStaffLine||loglevelExports.warn("Adding staffline didn't work"),u.Expression.Enum===TempoEnum.metronomeMark&&(metronomeMarks[s]=u.Expression)}else u.Expression instanceof ContinuousTempoExpression;if(r===e.TempoExpressions.length-1)for(const y of Object.values(metronomeMarks))this.createMetronomeMark(y,s)}}}createMetronomeMark(e,t){throw new Error(this.abstractNotImplementedErrorMessage)}graphicalMeasureCreatedCalculations(e){}clearSystemsAndMeasures(){for(let e=0,t=this.graphicalMusicSheet.MusicPages.length;e-1&&g.PositionAndShape.ChildElements.splice(b,1),g.FirstInstructionStaffEntry=void 0,g.beginInstructionsWidth=0}if(g.LastInstructionStaffEntry){const b=g.PositionAndShape.ChildElements.indexOf(g.LastInstructionStaffEntry.PositionAndShape);b>-1&&g.PositionAndShape.ChildElements.splice(b,1),g.LastInstructionStaffEntry=void 0,g.endInstructionsWidth=0}}d.Measures=[],d.PositionAndShape.ChildElements=[]}a.StaffLines.length=0,a.PositionAndShape.ChildElements=[]}s.MusicSystems=[],s.PositionAndShape.ChildElements=[]}this.graphicalMusicSheet.MusicPages=[]}handleVoiceEntry(e,t,s,r,o,a,l,c,d,m=void 0,u=void 0){e.StemDirectionXml!==StemDirectionType.Undefined&&this.rules.SetWantedStemDirectionByXml&&e.StemDirectionXml!==void 0?e.WantedStemDirection=e.StemDirectionXml:this.calculateStemDirectionFromVoices(e);const g=t.findOrCreateGraphicalVoiceEntry(e);g.octaveShiftValue=c;const b=t.tabStaffEntry;let y;b&&(y=b.findOrCreateGraphicalVoiceEntry(e));for(let S=0,v=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,s,o,c),this.resetYPositionForLeadSheet(A.PositionAndShape),t.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)),y){const E=MusicSheetCalculator.symbolFactory.createNote(x,y,o,c,this.rules,void 0);b.addGraphicalNoteToListAtCorrectYPosition(y,E),E.PositionAndShape.calculateBoundingBox(),this.leadSheet||x.NoteTuplet&&this.handleTuplet(E,x.NoteTuplet,a)}}return e.Articulations.length>0&&this.handleVoiceEntryArticulations(e.Articulations,e,t),e.TechnicalInstructions.length>0&&this.handleVoiceEntryTechnicalInstructions(e.TechnicalInstructions,e,t),e.LyricsEntries.size()>0&&this.handleVoiceEntryLyrics(e,t,r),e.OrnamentContainer&&this.handleVoiceEntryOrnaments(e.OrnamentContainer,e,t),c}resetYPositionForLeadSheet(e){this.leadSheet&&(e.RelativePosition=new PointF2D(e.RelativePosition.x,0))}layoutVoiceEntries(e,t){if(e.PositionAndShape.RelativePosition=new PointF2D(0,0),!this.leadSheet)for(const s of e.graphicalVoiceEntries){const r=s.notes;if(r.length===0)continue;const o=r[0].sourceNote.ParentVoiceEntry,a=r[0].sourceNote.Pitch!==void 0;this.layoutVoiceEntry(o,r,e,a)}}maxInstrNameLabelLength(){var t;let e=0;for(const s of this.graphicalMusicSheet.ParentMusicSheet.Instruments)if((t=s.NameLabel)!=null&&t.print&&s.Voices.length>0&&s.Voices[0].Visible){let r=s.NameLabel;this.rules.RenderPartNames||(r=new Label("",r.textAlignment,r.font));const o=new GraphicalLabel(r,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 r;const e=this.graphicalMusicSheet.ParentMusicSheet,t=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=t,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=t,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=t,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=t,this.graphicalMusicSheet.Lyricist=o,o.setLabelPositionAndShapeBorders()}else this.rules.RenderLyricist||(this.graphicalMusicSheet.Lyricist=void 0);const s=(r=this.graphicalMusicSheet.musicSheet.sourceMeasures)==null?void 0:r[0];if(s&&s.FirstInstructionsStaffEntries.length>0){const o=s.FirstInstructionsStaffEntries[0];let a,l;for(let c=0,d=o.Instructions.length;c0&&m.graphicalVoiceEntries[0].notes.length===1){const u=m.graphicalVoiceEntries[0].notes[0];!u.sourceNote.Pitch&&new Fraction$1(1,2).lt(u.sourceNote.Length)&&this.layoutMeasureWithWholeRest(u,m,d)}}}}}}optimizeRestNotePlacement(e,t){if(e.graphicalVoiceEntries.length===0)return;const s=e.graphicalVoiceEntries[0].notes;if(s.length===0)return;const r=s[0],o=r.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!==t.staffEntries[0]&&e!==t.staffEntries[t.staffEntries.length-1]){const a=t.staffEntries.indexOf(e),l=t.staffEntries[a-1],c=t.staffEntries[a+1];if(l.graphicalVoiceEntries.length===1){const d=l.graphicalVoiceEntries[0].notes[0];if(d.sourceNote.NoteBeam!==void 0&&c.graphicalVoiceEntries.length===1){const m=c.graphicalVoiceEntries[0].notes[0];m.sourceNote.NoteBeam!==void 0&&d.sourceNote.NoteBeam===m.sourceNote.NoteBeam&&(this.calculateRestNotePlacementWithinGraphicalBeam(e,r,d,c,m),e.PositionAndShape.calculateBoundingBox())}}}}getRelativePositionInStaffLineFromTimestamp(e,t,s,r,o=0){let a=new PointF2D,l,c;const d=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,m=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(e),u=Math.min(Math.floor(m),d-1),g=Math.min(Math.ceil(m),d-1);if(u<0||t<0)return a;if(l=this.getFirstLeftNotNullStaffEntryFromContainer(u,t,r),c=this.getFirstRightNotNullStaffEntryFromContainer(g,t,r),l&&c){let b=l.parentMeasure.PositionAndShape.RelativePosition.x;o>0&&(b=o);let y=l.PositionAndShape.RelativePosition.x+b,S=c.PositionAndShape.RelativePosition.x+c.parentMeasure.PositionAndShape.RelativePosition.x;o>0&&(S=c.PositionAndShape.RelativePosition.x+b);let v=0;if(l!==c){const x=l.getAbsoluteTimestamp(),A=c.getAbsoluteTimestamp();v=Fraction$1.minus(e,x).RealValue/Fraction$1.minus(A,x).RealValue}l.parentMeasure.ParentStaffLine!==c.parentMeasure.ParentStaffLine&&(l.parentMeasure.ParentStaffLine===s?S=s.PositionAndShape.Size.width:y=s.PositionAndShape.RelativePosition.x),a=new PointF2D(y+(S-y)*v,0)}return a}getRelativeXPositionFromTimestamp(e){const t=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,s=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(e),r=Math.max(0,Math.min(Math.round(s),t-1)),o=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[r].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 t=10;if(e.MusicSystems.length>0){const l=e.MusicSystems[0];t=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 s=this.graphicalMusicSheet.Composer;let r;if(s){s.PositionAndShape.Parent=e.PositionAndShape,s.setLabelPositionAndShapeBorders();const l=new PointF2D;l.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth-this.rules.PageRightMargin,l.y=t,l.y-=this.rules.SystemComposerDistance;const c=(a=s.TextLines)==null?void 0:a.length;c>1&&(l.y-=s.PositionAndShape.BorderBottom*(c-1)/c),r=l.y,s.PositionAndShape.RelativePosition=l,e.Labels.push(s)}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=t,l.y+=o.PositionAndShape.BorderBottom,l.y=Math.min(l.y,r!=null?r: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 t=e.ties;if(t.length>1){let s;for(const r of t){const o=r.Notes[0];(!s||o.Pitch.getHalfTone()>s.Pitch.getHalfTone())&&(s=o)}for(const r of t)r.TieDirection===PlacementEnum.NotYetDefined&&(r.Notes[0]===s?r.TieDirection=PlacementEnum.Above:r.TieDirection=PlacementEnum.Below)}}createAccidentalCalculators(){const e=[],t=this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();if(t)for(let s=0;s1)return;u=MusicSheetCalculator.symbolFactory.createGraphicalMeasure(e,m)}if(u.hasError=e.getErrorInMeasure(c),e.FirstInstructionsStaffEntries[c])for(let E=0,_=e.FirstInstructionsStaffEntries[c].Instructions.length;E<_;++E){const w=e.FirstInstructionsStaffEntries[c].Instructions[E];if(w instanceof KeyInstruction){const C=KeyInstruction.copy(w),P=u.getTransposedHalftones();P!==0&&u.ParentStaff.ParentInstrument.MidiInstrumentId!==MidiInstrument.Percussion&&MusicSheetCalculator.transposeCalculator&&MusicSheetCalculator.transposeCalculator.transposeKey(C,P),r.ActiveKeyInstruction=C}}const g=[];for(let E=0,_=e.StaffLinkedExpressions[c].length;E<_;++E){const w=e.StaffLinkedExpressions[c][E];if(w.OctaveShiftStart){g.push(w);const C=w.OctaveShiftStart;let P=(b=C==null?void 0:C.ParentEndMultiExpression)==null?void 0:b.AbsoluteTimestamp;C!=null&&C.ParentEndMultiExpression||(P=Fraction$1.plus(e.AbsoluteTimestamp,e.Duration)),a[c]=new OctaveShiftParams(C,w==null?void 0:w.AbsoluteTimestamp,P)}}for(let E=0;E0){const I=_.Instructions[0];MusicSheetCalculator.symbolFactory.createInStaffClef(w,I)}this.rules.RenderChordSymbols&&((A=_.ChordContainers)==null?void 0:A.length)>0&&(_.ParentStaff.ParentInstrument.HasChordSymbols=!0,MusicSheetCalculator.symbolFactory.createChordSymbols(_,w,r.ActiveKeyInstruction,this.graphicalMusicSheet.ParentMusicSheet.Transpose))}}if(r.doCalculationsAtEndOfMeasure(),e.LastInstructionsStaffEntries[c]){const E=e.LastInstructionsStaffEntries[c];for(let _=0,w=E.Instructions.length;_=1&&u.staffEntries.length===0){const E=new SourceStaffEntry(new VerticalSourceStaffEntryContainer(u.parentSourceMeasure,u.parentSourceMeasure.AbsoluteTimestamp,u.parentSourceMeasure.CompleteNumberOfStaves),m),_=new VoiceEntry(new Fraction$1(0,1),m.Voices[0],E),w=new Note$1(_,E,Fraction$1.createFromFraction(e.Duration),void 0,e);w.PrintObject=this.rules.FillEmptyMeasuresWithWholeRest===FillEmptyMeasuresWithWholeRests.YesVisible,_.addNote(w);const C=MusicSheetCalculator.symbolFactory.createStaffEntry(E,u);u.addGraphicalStaffEntry(C),C.relInMeasureTimestamp=_.Timestamp;const P=MusicSheetCalculator.symbolFactory.createVoiceEntry(_,C);C.graphicalVoiceEntries.push(P);const I=MusicSheetCalculator.symbolFactory.createNote(w,P,new ClefInstruction,OctaveEnum.NONE,void 0);MusicSheetCalculator.stafflineNoteCalculator.trackNote(I),P.notes.push(I)}u.hasOnlyRests=!0;for(const E of u.staffEntries)if(u.hasOnlyRests=E.hasOnlyRests(),!u.hasOnlyRests)break;return u}checkNoteForAccidental(e,t,s,r){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(t.ActiveKeyInstruction,s,a,r),e.sourceNote.TransposedPitch=o),e.sourceNote.halfTone=o.getHalfTone(),t.checkAccidental(e,o)}handleStaffEntries(e){for(let t=0,s=this.graphicalMusicSheet.MeasureList.length;t0&&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 t of e.StaffLines)t.SkyBottomLineCalculator.calculateLines()}calculateExpressionAlignements(){}calculateStaffEntryArticulationMarks(){for(let e=0,t=this.musicSystems.length;e0&&this.layoutArticulationMarks(S.Articulations,S,g)}}}}}}calculateOrnaments(){for(let e=0,t=this.musicSystems.length;e0&&r.LyricVersesNumbers.sort()}for(let t=0,s=this.musicSystems.length;t=0&&(r=t.GraphicalLyricsEntries[s+1]),!r)return;const o=e.StaffEntryParent.parentMeasure.ParentStaffLine,a=r.StaffEntryParent.parentMeasure.ParentStaffLine,l=e.StaffEntryParent,c=r.StaffEntryParent;if(e.StaffEntryParent.parentMeasure.ParentStaffLine===r.StaffEntryParent.parentMeasure.ParentStaffLine){const d=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+r.GraphicalLabel.PositionAndShape.BorderMarginLeft,u=e.GraphicalLabel.PositionAndShape.RelativePosition.y;let g=1;m-d>this.rules.MinimumDistanceBetweenDashes*3&&(g=Math.floor((m-d)/this.rules.MinimumDistanceBetweenDashes)-1),g===1?this.calculateSingleDashForLyricWord(o,d,m,u):this.calculateDashes(o,d,m,u)}else{const d=l.parentMeasure.PositionAndShape.RelativePosition.x+l.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.BorderMarginRight,m=o.Measures[o.Measures.length-1],u=m.PositionAndShape.RelativePosition.x+m.PositionAndShape.Size.width;let g=e.GraphicalLabel.PositionAndShape.RelativePosition.y;if(this.calculateDashes(o,d,u,g),a&&a.Measures[0]&&c.parentMeasure.ParentStaffLine&&!(c===c.parentMeasure.staffEntries[0]&&c.parentMeasure===c.parentMeasure.ParentStaffLine.Measures[0])){const b=a.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,y=c.parentMeasure.PositionAndShape.RelativePosition.x+c.PositionAndShape.RelativePosition.x+r.GraphicalLabel.PositionAndShape.BorderMarginLeft;g=r.GraphicalLabel.PositionAndShape.RelativePosition.y,this.calculateDashes(a,b,y,g)}}}calculateDashes(e,t,s,r){let o=s-t;if(ot;)o=this.calculateRightAndLeftDashesForLyricWord(e,t,s,r),t+=l,s-=l,c++;o>l*2&&this.calculateSingleDashForLyricWord(e,t,s,r)}}calculateSingleDashForLyricWord(e,t,s,r){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(t+(s-t)/2,r);a.PositionAndShape.RelativePosition=l}calculateLyricExtend(e){let t=e.GraphicalLabel.PositionAndShape.RelativePosition.y;const s=e.StaffEntryParent,r=s.parentMeasure.ParentStaffLine;let o,a;const l=s.parentMeasure.ParentStaff.idInMusicSheet;for(let c=s.parentVerticalContainer.Index+1;c0)break;o=d,a=o.parentMeasure.ParentStaffLine,a||(a=s.parentMeasure.ParentStaffLine)}}if(!(!o||!a))if(r===a&&o.parentMeasure.ParentStaffLine){const c=s.parentMeasure.PositionAndShape.RelativePosition.x+s.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.BorderMarginRight,d=o.parentMeasure.PositionAndShape.RelativePosition.x+o.PositionAndShape.RelativePosition.x+o.PositionAndShape.BorderMarginRight;t-=e.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(r,c,d,t)}else{const c=r.Measures[r.Measures.length-1].PositionAndShape,d=s.parentMeasure.PositionAndShape.RelativePosition.x+s.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.BorderMarginRight,m=c.RelativePosition.x+c.Size.width;if(t-=e.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(r,d,m,t),!o)return;if(o.parentMeasure.ParentStaffLine&&o.parentMeasure.staffEntries&&!(o===o.parentMeasure.staffEntries[0]&&o.parentMeasure===o.parentMeasure.ParentStaffLine.Measures[0])){const u=a.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,g=o.parentMeasure.PositionAndShape.RelativePosition.x+o.PositionAndShape.RelativePosition.x+o.PositionAndShape.BorderMarginRight;this.calculateSingleLyricWordWithUnderscore(a,u,g,t)}}}calculateSingleLyricWordWithUnderscore(e,t,s,r){const o=new PointF2D(t,r),a=new PointF2D(s,r),l=new GraphicalLine(o,a,this.rules.LyricUnderscoreLineWidth);e.LyricLines.push(l),this.staffLinesWithLyricWords.indexOf(e)===-1&&this.staffLinesWithLyricWords.push(e)}calculateRightAndLeftDashesForLyricWord(e,t,s,r){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(t,r);a.PositionAndShape.RelativePosition=l;const c=new Label("-"),d=new GraphicalLabel(c,this.rules.LyricsHeight,TextAlignmentEnum.CenterBottom,this.rules);d.setLabelPositionAndShapeBorders(),e.LyricsDashes.push(d),d.PositionAndShape.Parent=e.PositionAndShape;const m=new PointF2D(s,r);return d.PositionAndShape.RelativePosition=m,d.PositionAndShape.RelativePosition.x-a.PositionAndShape.RelativePosition.x}calculateDynamicExpressions(){const e=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,this.rules.MaxMeasureToDrawIndex),t=Math.min(this.rules.MinMeasureToDrawIndex,this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length);for(let s=t;s<=e;s++){const r=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[s];this.dynamicExpressionMap.clear();for(let o=0;o=0;a--)if((o=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[a])!=null&&o.StaffEntries[t])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[a].StaffEntries[t]}getFirstRightNotNullStaffEntryFromContainer(e,t,s){var r,o;if((r=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[e])!=null&&r.StaffEntries[t])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[e].StaffEntries[t];for(let a=e+1;a0||t.StaffLinkedExpressions[s][r].UnknownList.length>0)&&this.calculateMoodAndUnknownExpression(t.StaffLinkedExpressions[s][r],e,s)}}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 t=e.Notes[0].NoteBeam;if(t){for(const s of t.Notes)if(s.ParentVoiceEntry.WantedStemDirection!==StemDirectionType.Undefined&&s.ParentVoiceEntry.ParentSourceStaffEntry.ParentStaff.Id===e.ParentSourceStaffEntry.ParentStaff.Id){e.WantedStemDirection=s.ParentVoiceEntry.WantedStemDirection;break}}}}class ChordSymbolContainer{constructor(e,t,s,r,o){this.rootPitch=e,this.chordKind=t,this.bassPitch=s,this.degrees=r,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,t,s){let r=e.RootPitch;if(MusicSheetCalculator.transposeCalculator&&(r=MusicSheetCalculator.transposeCalculator.transposePitch(e.RootPitch,s,t)),e.ChordKind===31)return e.getTextFromChordKindEnum(e.ChordKind);let o=Pitch.getNoteEnumString(r.FundamentalNote);r.Accidental!==AccidentalEnum.NONE&&(o+=this.getTextForAccidental(r.Accidental));const a={adds:[],alts:[],subs:[]};for(const m of e.ChordDegrees)if(m){let u="";switch(m.alteration!==AccidentalEnum.NONE&&(u+=this.getTextForAccidental(m.alteration)),u+=m.value,m.text){case 0:a.adds.push(u);break;case 1:a.alts.push(u);break;case 2:a.subs.push(u);break}}let l=e.getTextFromChordKindEnum(e.ChordKind);const c=["adds","alts","subs"],d=e.rules.CustomChords;for(const m of d){if(m.chordKind!==e.chordKind)continue;let u=!0;for(const g of c){for(const b of m.degrees[g]||[])if(a[g].indexOf(b)<0){u=!1;break}if(!u)break}if(u){for(const g of c)for(const b of m.degrees[g]||[])a[g].splice(a[g].indexOf(b),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,s,t)),o+="/",o+=Pitch.getNoteEnumString(m.FundamentalNote),o+=this.getTextForAccidental(m.Accidental)}return o}static getTextForAccidental(e){let t="";switch(e){case AccidentalEnum.DOUBLEFLAT:t+="bb";break;case AccidentalEnum.FLAT:t+="b";break;case AccidentalEnum.SHARP:t+="#";break;case AccidentalEnum.DOUBLESHARP:t+="x";break}return t}getTextFromChordKindEnum(e){var t;return(t=this.rules.ChordSymbolLabelTexts.getValue(e))!=null?t:""}}class Degree{constructor(e,t,s){this.value=e,this.alteration=t,this.text=s}}class CustomChord{constructor(e,t,s){this.alternateName=e,this.chordKind=t,this.degrees=s}static createCustomChord(e,t,s){return new CustomChord(e,t,s)}static renameCustomChord(e,t,s){for(const r of s)r.alternateName===e&&(r.alternateName=t)}}var ChordDegreeText=(i=>(i[i.add=0]="add",i[i.alter=1]="alter",i[i.subtract=2]="subtract",i))(ChordDegreeText||{}),ChordSymbolEnum=(i=>(i[i.major=0]="major",i[i.minor=1]="minor",i[i.augmented=2]="augmented",i[i.diminished=3]="diminished",i[i.dominant=4]="dominant",i[i.majorseventh=5]="majorseventh",i[i.minorseventh=6]="minorseventh",i[i.diminishedseventh=7]="diminishedseventh",i[i.augmentedseventh=8]="augmentedseventh",i[i.halfdiminished=9]="halfdiminished",i[i.majorminor=10]="majorminor",i[i.majorsixth=11]="majorsixth",i[i.minorsixth=12]="minorsixth",i[i.dominantninth=13]="dominantninth",i[i.majorninth=14]="majorninth",i[i.minorninth=15]="minorninth",i[i.dominant11th=16]="dominant11th",i[i.major11th=17]="major11th",i[i.minor11th=18]="minor11th",i[i.dominant13th=19]="dominant13th",i[i.major13th=20]="major13th",i[i.minor13th=21]="minor13th",i[i.suspendedsecond=22]="suspendedsecond",i[i.suspendedfourth=23]="suspendedfourth",i[i.Neapolitan=24]="Neapolitan",i[i.Italian=25]="Italian",i[i.French=26]="French",i[i.German=27]="German",i[i.pedal=28]="pedal",i[i.power=29]="power",i[i.Tristan=30]="Tristan",i[i.none=31]="none",i))(ChordSymbolEnum||{});class GraphicalNote extends GraphicalObject{constructor(e,t,s,r=void 0){super(),this.DrawnAccidental=AccidentalEnum.NONE,this.lineShift=0,this.sourceNote=e,this.parentVoiceEntry=t,this.PositionAndShape=new BoundingBox$1(this,t.PositionAndShape),r?this.graphicalNoteLength=r:this.graphicalNoteLength=e.Length,this.numberOfDots=this.calculateNumberOfNeededDots(this.graphicalNoteLength),this.rules=s,this.rules.addGraphicalNoteToNoteMap(e,this)}Transpose(e,t,s,r){let o=this.sourceNote.Pitch;return MusicSheetCalculator.transposeCalculator&&(o=MusicSheetCalculator.transposeCalculator.transposePitch(this.sourceNote.Pitch,e,s)),o}calculateNumberOfNeededDots(e){return!this.sourceNote||!this.sourceNote.NoteTuplet?e.calculateNumberOfNeededDots():0}get ParentMusicPage(){return this.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentMusicSystem.Parent}static FromNote(e,t){return t.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(i){loglevelExports.info("EngravingRules()",i)}this.MpatMode&&(this.NewPartAndSystemAfterFinalBarline=!0)}applyDefaultColorMusic(i){this.DefaultColorMusic=i,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(i,e){i.NoteToGraphicalNoteObjectId=this.NoteToGraphicalNoteMapObjectCount,this.NoteToGraphicalNoteMap.setValue(i.NoteToGraphicalNoteObjectId,e),this.NoteToGraphicalNoteMapObjectCount++}GNote(i){return GraphicalNote.FromNote(i,this)}clearMusicSheetObjects(){this.NoteToGraphicalNoteMap=new Dictionary,this.NoteToGraphicalNoteMapObjectCount=0}setChordSymbolLabelText(i,e){this.ChordSymbolLabelTexts.setValue(i,e)}resetChordSymbolLabelTexts(i){return i.setValue(ChordSymbolEnum.minor,"m"),i.setValue(ChordSymbolEnum.augmented,"aug"),i.setValue(ChordSymbolEnum.diminished,"dim"),i.setValue(ChordSymbolEnum.dominant,"7"),i.setValue(ChordSymbolEnum.majorseventh,"maj7"),i.setValue(ChordSymbolEnum.minorseventh,"m7"),i.setValue(ChordSymbolEnum.diminishedseventh,"dim7"),i.setValue(ChordSymbolEnum.augmentedseventh,"aug7"),i.setValue(ChordSymbolEnum.halfdiminished,"m7b5"),i.setValue(ChordSymbolEnum.majorminor,"m(maj7)"),i.setValue(ChordSymbolEnum.majorsixth,"maj6"),i.setValue(ChordSymbolEnum.minorsixth,"m6"),i.setValue(ChordSymbolEnum.dominantninth,"9"),i.setValue(ChordSymbolEnum.majorninth,"maj9"),i.setValue(ChordSymbolEnum.minorninth,"m9"),i.setValue(ChordSymbolEnum.dominant11th,"11"),i.setValue(ChordSymbolEnum.major11th,"maj11"),i.setValue(ChordSymbolEnum.minor11th,"m11"),i.setValue(ChordSymbolEnum.dominant13th,"13"),i.setValue(ChordSymbolEnum.major13th,"maj13"),i.setValue(ChordSymbolEnum.minor13th,"m13"),i.setValue(ChordSymbolEnum.suspendedsecond,"sus2"),i.setValue(ChordSymbolEnum.suspendedfourth,"sus4"),i.setValue(ChordSymbolEnum.power,"5"),i.setValue(ChordSymbolEnum.none,"N.C."),i}addChordName(i,e,t,s,r){if(ChordSymbolEnum[e]!==void 0){const o={adds:t,alts:s,subs:r};this.CustomChords.push(CustomChord.createCustomChord(i,ChordSymbolEnum[e],o))}}renameChord(i,e){CustomChord.renameCustomChord(i,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 i=0;i(i[i.XML=0]="XML",i[i.AutoColoring=1]="AutoColoring",i[i.CustomColorSet=2]="CustomColorSet",i))(ColoringModes||{}),DrawingParametersEnum=(i=>(i.allon="allon",i.compact="compact",i.compacttight="compacttight",i.default="default",i.leadsheet="leadsheet",i.preview="preview",i.thumbnail="thumbnail",i))(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=(i=>(i[i.Never=0]="Never",i[i.Always=1]="Always",i[i.Auto=2]="Auto",i))(AlignRestOption||{}),FillEmptyMeasuresWithWholeRests=(i=>(i[i.No=0]="No",i[i.YesVisible=1]="YesVisible",i[i.YesInvisible=2]="YesInvisible",i))(FillEmptyMeasuresWithWholeRests||{}),BackendType=(i=>(i[i.SVG=0]="SVG",i[i.Canvas=1]="Canvas",i))(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,t=[];for(let s=0;s0?this.Voices[0].Visible:!1}set Visible(e){for(let t=0,s=this.Voices.length;t-1&&this.parent.MusicSystems.splice(t,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,t,s){let r=-e/2;s&&(r=this.maxLabelLength+t-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(r,e,SystemLinesEnum.SingleThin,SystemLinePosition.MeasureBegin,this,o,a);this.SystemLines.push(l),l.PositionAndShape.RelativePosition=new PointF2D(r,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,t,s,r,o,a){const l=a.ParentStaffLine,c=new PointF2D(l.PositionAndShape.RelativePosition.x,l.PositionAndShape.RelativePosition.y),d=l.ParentStaff.ParentInstrument.Staves;if(l.ParentStaff===d[0]){let m;d.length>1&&(m=this.getBottomStaffLine(l).Measures[o]);const u=this.createSystemLine(e,t,s,r,this,a,m),g=c.x+e;u.PositionAndShape.RelativePosition=new PointF2D(g,0),u.PositionAndShape.BorderLeft=0,u.PositionAndShape.BorderRight=t,this.SystemLines.push(u)}}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 t=0,s=e.length;t1){let a,l;for(let c=0,d=this.staffLines.length;cthis.maxLabelLength&&(this.maxLabelLength=m.PositionAndShape.Size.width,t=o)}this.updateMusicSystemStaffLineXPosition(t)}setMusicSystemLabelsYPosition(){this.labels.forEach((e,t)=>{let s=0,r=0;for(let o=0;o0&&(t.PositionAndShape.RelativePosition=new PointF2D(0,s/r+2))})}checkStaffEntriesForStaffEntryLink(){let e=!1,t=!1;for(let s=0;s=0;s--){if(t=e.InstrumentalGroups[s],t instanceof Instrument){if(t.Visible===!0)return t;continue}return this.findLastVisibleInstrumentInInstrumentalGroup(t)}}updateMusicSystemStaffLineXPosition(e){for(let t=0,s=this.StaffLines.length;t1}isVisible(){return this.ParentStaff.ParentInstrument.Visible}getGraphicalMeasureDurationFromStaffEntries(){let e=new Fraction$1(0,1);const t=[];for(let s=0,r=this.staffEntries.length;s0&&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 t=this.staffEntries.length-1;t>=0;t--){if(this.staffEntries[t].relInMeasureTimestamp.lt(e.relInMeasureTimestamp)){this.staffEntries.splice(t+1,0,e);break}t===0&&this.staffEntries.splice(t,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,t){super(e,t)}applyBordersFromVexflow(){const e=this.vfStaveNote;if(!e.getNoteHeadBeginX)return;const t=e.getBoundingBox(),s=e.getNoteHeadBeginX()-t.x;this.PositionAndShape.RelativePosition.y=t.y/unitInPixels,this.PositionAndShape.BorderTop=0,this.PositionAndShape.BorderBottom=t.h/unitInPixels,this.PositionAndShape.BorderLeft=-(s+e.width/2)/unitInPixels,this.PositionAndShape.BorderRight=(t.w-s)/unitInPixels}set vfStaveNote(e){this.mVexFlowStaveNote=e}get vfStaveNote(){return this.mVexFlowStaveNote}color(){var g;const e=this.rules.DefaultColorNotehead,t=this.rules.DefaultColorRest,s=this.rules.DefaultColorStem,r="#00000000";let o,a;const l=this.vfStaveNote;for(let b=0;bc.symbol_type===t))return;const l=new VF$9.Repetition(t,r,-this.rules.RepetitionSymbolsYOffset);this.stave.addModifier(l,s);return}this.addVolta(e)}addVolta(e){var s;let t=VF$9.Volta.type.BEGIN;if(e.type===RepetitionInstructionEnum.Ending){switch(e.alignment){case AlignmentType.Begin:this.parentSourceMeasure.endsRepetitionEnding()?t=VF$9.Volta.type.BEGIN_END:t=VF$9.Volta.type.BEGIN;break;case AlignmentType.End:if(this.parentSourceMeasure.beginsRepetitionEnding())return;t=VF$9.Volta.type.END;break}const r=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=r.getSkyLineMinInRange(o,a)-2;let c=-6.1+this.rules.VoltaOffset,d=this.rules.VoltaOffset;if(l0){loglevelExports.trace(`Ghost Found in between (measure ${this.MeasureNumber})`);const u=this.createGhostGves(m);s.splice(a,0,...u),a+=u.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 u=this.createGhostGves(m);s.splice(0,0,...u),a+=u.length}}t=d}const r=Fraction$1.plus(this.parentSourceMeasure.AbsoluteTimestamp,this.parentSourceMeasure.Duration),o=Fraction$1.minus(r,t);if(o.RealValue>0){loglevelExports.trace(`Ghost Found at end (measure ${this.MeasureNumber})`);const a=this.createGhostGves(o);s=s.concat(a)}return s}createGhostGves(e){const t=VexFlowConverter.GhostNotes(e),s=[];for(const r of t){const o=new VexFlowVoiceEntry(void 0,void 0);o.vfStaveNote=r,s.push(o)}return s}handleBeam(e,t){const s=e.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;let r=this.beams[s];r||(r=this.beams[s]=[]);let o;for(const l of r)l[0]===t&&(o=l);o||(o=[t,[]],r.push(o));const a=e.parentVoiceEntry;o[1].indexOf(a)<0&&o[1].push(a)}handleTuplet(e,t){const s=e.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;t=e.sourceNote.NoteTuplet;let r=this.tuplets[s];r||(r=this.tuplets[s]=[]);let o;for(const l of r)l[0]===t&&(o=l);o||(o=[t,[]],r.push(o));const a=e.parentVoiceEntry;o[1].indexOf(a)<0&&o[1].push(a)}finalizeBeams(){this.vfbeams={};const e=[];for(const t in this.beams)if(this.beams.hasOwnProperty(t)){let s=this.vfbeams[t];s||(s=this.vfbeams[t]=[]);for(const r of this.beams[t]){let o=!1;for(const b of r[0].Notes)if(b.Length.RealValue>=new Fraction$1(1,4).RealValue&&(!b.TypeLength||b.TypeLength.RealValue>.125)){o=!0;break}if(o){loglevelExports.debug("Beam between note >= quarter, likely tremolo, currently unsupported. continuing.");continue}const a=[],l=r[0],c=r[1];let d=!0;for(const b of c)b.parentVoiceEntry.ParentVoice===l.Notes[0].ParentVoiceEntry.ParentVoice&&(d=b.parentVoiceEntry.WantedStemDirection===StemDirectionType.Undefined);let m=!1,u;const g=[];for(const b of c){const y=b.vfStaveNote;y&&(a.push(y),e.push(y)),b.parentVoiceEntry.IsGrace&&(m=!0),b.parentVoiceEntry.StemColor&&this.rules.ColoringEnabled&&g.push(b.parentVoiceEntry.StemColor)}if(a.length>1){const b=new VF$9.Beam(a,d);if(m&&(b.render_options.beam_width=3,b.render_options.partial_beam_length=4),g.length>=2&&this.rules.ColorBeams){u=g[0];for(const y of g)if(y!==u){u=void 0;break}b.setStyle({fillStyle:u,strokeStyle:u})}this.rules.FlatBeams&&(b.render_options.flat_beams=!0,b.render_options.flat_beam_offset=this.rules.FlatBeamOffset,b.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),s.push(b)}else loglevelExports.debug("Warning! Beam with no notes!")}}this.rules.AutoBeamNotes&&this.autoBeamNotes(e)}autoBeamNotes(e){if(!this.rules.AutoBeamTabs&&this.isTabMeasure)return;let t=[],s=[],r,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 u of m.graphicalVoiceEntries){const g=u.vfStaveNote,b=u.notes[0],y=m.relInMeasureTimestamp.isOnBeat(l),S=s.length>=2,v=b.sourceNote.Length.RealValue-new Fraction$1(1,4).RealValue>-Fraction$1.FloatInaccuracyTolerance,x=u.parentVoiceEntry.IsGrace||v||e.contains(g);if(x||y){if(S){for(const E of s)t.push(E);a.push(t.slice()),t=[]}if(s=[],x)continue}const A=u.notes[0].sourceNote.NoteTuplet;if(A){let E=!1;for(const _ of A.Notes){for(const w of _)if(w.NoteTypeXml>=NoteType.QUARTER||w.ParentVoiceEntry.IsGrace||w.isRest()&&!this.rules.AutoBeamOptions.beam_rests){E=!0;break}if(E)break}if(!r)r=A;else if(r!==A){if(o.length>1){const _=new VF$9.Beam(o,!0);this.rules.FlatBeams&&(_.render_options.flat_beams=!0,_.render_options.flat_beam_offset=this.rules.FlatBeamOffset,_.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(_)}o=[],r=A}E||o.push(g);continue}else r=void 0;s.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(s.length>=2){for(const m of s)t.push(m);a.push(t)}const c=this.rules.AutoBeamOptions,d={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 u of c.groups)m.push(new VF$9.Fraction(u[0],u[1]));d.groups=m}for(const m of a){const u=VF$9.Beam.generateBeams(m,d);for(const g of u)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 t=this.vftuplets[e];t||(t=this.vftuplets[e]=[]);for(const s of this.tuplets[e]){const r=[],o=s[1];for(const a of o)r.push(a.vfStaveNote);if(r.length>1){const a=s[0],l=a.Notes[0][0].NormalNotes,c=a.Bracket||a.TupletLabelNumber===3&&this.rules.TripletsBracketed||a.TupletLabelNumber!==3&&this.rules.TupletsBracketed;let d=VF$9.Tuplet.LOCATION_TOP;a.tupletLabelNumberPlacement===PlacementEnum.Below&&(d=VF$9.Tuplet.LOCATION_BOTTOM),t.push(new VF$9.Tuplet(r,{bracketed:c,location:d,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,t=[];const s=[];for(const o of this.staffEntries){e=!1,t=[];for(const a of o.graphicalVoiceEntries){if(a.parentVoiceEntry.IsGrace){t.push(a),s.push(a),e||(e=a.parentVoiceEntry.GraceSlur);continue}if(a.vfStaveNote=VexFlowConverter.StaveNote(a),t.length>0){const l=[];for(let d=0;d0&&(m.GraceSlash=!1);const u=VexFlowConverter.StaveNote(m);m.vfStaveNote=u,l.push(u)}const c=new VF$9.GraceNoteGroup(l,e);a.vfStaveNote.addModifier(0,c),t=[]}}}if(t.length>0)for(const o of t)o.vfStaveNote=VexFlowConverter.StaveNote(o),o.parentVoiceEntry.GraceAfterMainNote=!0;this.finalizeBeams(),this.finalizeTuplets();const r=this.getVoicesWithinMeasure();if(this.rules.RenderFingerings)for(const o of this.staffEntries)o.setModifierXOffsets();for(const o of r){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 d=c.parentStaffEntry;if(d&&d.vfClefBefore){const m=new NoteSubGroup([d.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 s)this.createFingerings(o),this.createStringNumber(o),this.createArpeggio(o);this.createArticulations(),this.createOrnaments()}createArpeggio(e){if(e.parentVoiceEntry&&e.parentVoiceEntry.Arpeggio){const t=e.parentVoiceEntry.Arpeggio;if(e.notes&&e.notes.length>1){const s=VexFlowConverter.StrokeTypeFromArpeggioType(t.type),r=new VF$9.Stroke(s,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&e.vfStaveNote.addStroke(0,r)}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 t of e.graphicalVoiceEntries)for(const s of t.notes){const r=s.vfnote;if(!r||!r[0])continue;switch(r[0].getStemDirection()){case VF$9.Stem.UP:t.parentVoiceEntry.StemDirection=StemDirectionType.Up;break;case VF$9.Stem.DOWN:t.parentVoiceEntry.StemDirection=StemDirectionType.Down;break}}}createArticulations(){for(let e=0,t=this.staffEntries.length;e1||e.parentStaffEntry.graphicalVoiceEntries.length>1?d=VF$9.StaveModifier.Position.LEFT:u.idInMusicSheet===0?(d=VF$9.StaveModifier.Position.ABOVE,l=PlacementEnum.Above):(d=VF$9.StaveModifier.Position.BELOW,l=PlacementEnum.Below)}const m=new VF$9.FretHandFinger(a.value);if(m.setPosition(d),m.setOffsetX(c),l===PlacementEnum.Above||l===PlacementEnum.Below){const u=l===PlacementEnum.Above?-1:1,g=l===PlacementEnum.Above?r:s-1-r;if(this.rules.FingeringInsideStafflines&&s>1){const b=m.getWidth()/2,y=s*2.5;m.setOffsetY(u*(g+y)*b)}else if(!this.rules.FingeringInsideStafflines){const b=new VF$9.StringNumber(a.value);b.radius=0,b.setPosition(d),b.setOffsetY(u*g*b.getWidth()*2/3),t.vfStaveNote.addModifier(r,b);continue}}t.vfStaveNote.addModifier(r,m)}}createStringNumber(e){if(!this.rules.RenderStringNumbersClassical)return;const t=e;e.notes.forEach((s,r)=>{const o=s.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(s.baseStringNumberXOffset*13),l.setPosition(VF$9.Modifier.Position.RIGHT)):l.setPosition(VF$9.Modifier.Position.ABOVE),l.setOffsetY(c),t.vfStaveNote.addModifier(r,l)}})}lineTo(e,t){const s=new VF$9.StaveConnector(e.getVFStave(),this.stave);s.setType(t),this.connectors.push(s)}getVFStave(){return this.stave}updateInstructionWidth(){let e=0,t=0;const s=this.stave.getModifiers();for(const r of s)r.getPosition()===5?e+=r.getWidth()+r.getPadding(void 0):r.getPosition()===6&&(t+=r.getWidth()+r.getPadding(void 0));this.beginInstructionsWidth=(e!=null?e:0)/unitInPixels,this.endInstructionsWidth=(t!=null?t:0)/unitInPixels}addStaveTie(e,t){this.vfTies.push(e),t.vfTie=e}}class GraphicalStaffEntry extends GraphicalObject{constructor(e,t=void 0,s=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=t,s?(this.staffEntryParent=s,this.parentVerticalContainer=s.parentVerticalContainer,this.PositionAndShape=new BoundingBox$1(this,s.PositionAndShape)):this.PositionAndShape=new BoundingBox$1(this,e.PositionAndShape),t&&(this.relInMeasureTimestamp=t.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 s;const t=((s=window.GYM)==null?void 0:s.graceCustom)||!1;for(const r of this.graphicalVoiceEntries)for(const o of r.notes){const a=o.sourceNote;if(t){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,t){if(e){for(const s of this.graphicalVoiceEntries)if(s.parentVoiceEntry===e.ParentVoiceEntry)for(const r of s.notes){const o=r.sourceNote;if(o.NoteTie&&o.NoteSlurs.indexOf(t)!==-1)return r}}}findGraphicalNoteFromGraceNote(e){if(e){for(const t of this.graphicalVoiceEntries)if(t.parentVoiceEntry===e.ParentVoiceEntry){for(const s of t.notes)if(s.sourceNote===e)return s}}}findGraphicalNoteFromNote(e){if(e){for(const t of this.graphicalVoiceEntries)if(t.parentVoiceEntry===e.ParentVoiceEntry){for(const s of t.notes)if(s.sourceNote===e&&this.getAbsoluteTimestamp().Equals(e.getAbsoluteTimestamp()))return s}}}getGraphicalNoteDurationFromVoice(e){for(const t of this.graphicalVoiceEntries)if(t.parentVoiceEntry.ParentVoice===e)return t.notes[0].graphicalNoteLength;return new Fraction$1(0,1)}findVoiceEntryGraphicalNotes(e){for(const t of this.graphicalVoiceEntries)if(t.parentVoiceEntry===e)return t.notes}isVoiceEntryPartOfLinkedVoiceEntry(e){if(this.sourceStaffEntry.Link)for(let t=0,s=this.sourceStaffEntry.Link.LinkStaffEntries.length;t0&&(e=r)}return e}findStaffEntryMaxNoteLength(){let e=new Fraction$1(0,1);for(const t of this.graphicalVoiceEntries)for(const s of t.notes){const r=s.graphicalNoteLength;e.lt(r)&&r.GetExpandedNumerator()>0&&(e=r)}return e}findOrCreateGraphicalVoiceEntry(e){for(const s of this.graphicalVoiceEntries)if(s.parentVoiceEntry===e)return s;const t=MusicSheetCalculator.symbolFactory.createVoiceEntry(e,this);return this.graphicalVoiceEntries.push(t),t}findOrCreateGraphicalVoiceEntryFromGraphicalNote(e){for(const s of this.graphicalVoiceEntries)if(s===e.parentVoiceEntry)return s;const t=MusicSheetCalculator.symbolFactory.createVoiceEntry(e.sourceNote.ParentVoiceEntry,this);return this.graphicalVoiceEntries.push(t),t}addGraphicalNoteToListAtCorrectYPosition(e,t){const s=e.notes;if(s.length===0||t.PositionAndShape.RelativePosition.y=0;r--){if(s[r].PositionAndShape.RelativePosition.y>t.PositionAndShape.RelativePosition.y){s.splice(r+1,0,t);break}if(r===0){s.splice(0,0,t);break}}}hasOnlyRests(){for(const t of this.graphicalVoiceEntries)for(const s of t.notes)if(!s.sourceNote.isRest())return!1;return!0}getSkylineMin(){var r;const e=(r=this.parentMeasure)==null?void 0:r.ParentStaffLine.SkyBottomLineCalculator;if(!e)return;const[t,s]=this.getAbsoluteStartAndEnd();return e.getSkyLineMinInRange(t,s)}getHighestYAtEntry(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getSkylineMin()}getLowestYAtEntry(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getBottomlineMax()}getBottomlineMax(){var r;const e=(r=this.parentMeasure)==null?void 0:r.ParentStaffLine.SkyBottomLineCalculator;if(!e)return;const[t,s]=this.getAbsoluteStartAndEnd();return e.getBottomLineMaxInRange(t,s)}getAbsoluteStartAndEnd(){let e=this.PositionAndShape.AbsolutePosition.x;e-=this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.x;const t=e+this.PositionAndShape.Size.width;return[e,t]}}const VF$8=Vex.Flow;class VexFlowStaffEntry extends GraphicalStaffEntry{constructor(e,t,s){super(e,t,s)}calculateXPosition(){const e=this.parentMeasure.getVFStave();let t=0;for(const s of this.graphicalVoiceEntries)if(s.vfStaveNote){if(s.vfStaveNote.setStave(e),e&&e.getLines&&e.getLines()===1&&s.vfStaveNote.getStemDirection()<0&&(s.vfStaveNote.setStemDirection(VF$8.Stem.UP),s.parentVoiceEntry.StemDirection=StemDirectionType.Up),!s.vfStaveNote.preFormatted)continue;s.applyBordersFromVexflow(),this.parentMeasure.ParentStaff.isTab?this.PositionAndShape.RelativePosition.x=(s.vfStaveNote.getAbsoluteX()+s.vfStaveNote.glyph.getWidth())/unitInPixels:this.PositionAndShape.RelativePosition.x=s.vfStaveNote.getBoundingBox().getX()/unitInPixels;const r=s.notes[0].sourceNote;r.isRest()&&r.Length.RealValue===this.parentMeasure.parentSourceMeasure.ActiveTimeSignature.RealValue&&(this.PositionAndShape.RelativePosition.x+=this.parentMeasure.parentSourceMeasure.Rules.WholeRestXShiftVexflow-.1,s.PositionAndShape.BorderLeft=-.7,s.PositionAndShape.BorderRight=.7),s.PositionAndShape.BorderLefto.staffLine),s=this.calculateModifierXOffsets(t,1),r=this.calculateModifierXOffsets(t,.5);e.forEach((o,a)=>{o.baseFingeringXOffset=r[a],o.baseStringNumberXOffset=s[a]})}calculateModifierXOffsets(e,t){const s=[];for(let r=0;r=0;l--){if(Math.abs(e[r]-e[l])<=t&&o===s[l]){o++,a=!0;break}a=!1}s.push(o)}return s}}class VexFlowGraphicalNote extends GraphicalNote{constructor(e,t,s,r=OctaveEnum.NONE,o,a=void 0){if(super(e,t,o,a),this.clef=s,this.octaveShift=r,e.Pitch){const l=e.isRest()?e.Pitch:OctaveShift.getPitchFromOctaveShift(e.Pitch,r);this.vfpitch=VexFlowConverter.pitch(l,e.isRest(),this.clef,this.sourceNote.Notehead),this.vfpitch[1]=void 0}}setAccidental(e){const t=this.drawPitch(e);this.vfpitch=VexFlowConverter.pitch(t,this.sourceNote.isRest(),this.clef,this.sourceNote.Notehead),this.DrawnAccidental=t.Accidental}drawPitch(e){return OctaveShift.getPitchFromOctaveShift(e,this.octaveShift)}Transpose(e,t,s,r){const o=super.Transpose(e,t,s,r),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,t){this.vfnote=[e,t],this.vfnoteIndex=t}notehead(e=void 0){let t=e;t||(t=this.vfnote[0]);const s=t.note_heads;return s&&s.length>this.vfnoteIndex&&s[this.vfnoteIndex]?t.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 t=0;;t++){const s=document.getElementById(`vf-${this.getSVGId()}-beam${t}`);if(!s)break;e.push(s)}return e}}class GraphicalChordSymbolContainer extends GraphicalObject{constructor(e,t,s,r,o,a){super(),this.chordSymbolContainer=e,this.boundingBox=new BoundingBox$1(this,t),this.rules=a,this.calculateLabel(s,o,r)}get GetChordSymbolContainer(){return this.chordSymbolContainer}get GraphicalLabel(){return this.graphicalLabel}calculateLabel(e,t,s){const r=ChordSymbolContainer.calculateChordText(this.chordSymbolContainer,t,s);this.graphicalLabel=new GraphicalLabel(new Label(r),e,this.rules.ChordSymbolTextAlignment,this.rules,this.boundingBox),this.graphicalLabel.PositionAndShape.RelativePosition=new PointF2D(this.rules.ChordSymbolRelativeXOffset,0),this.graphicalLabel.Label.colorDefault=this.rules.DefaultColorChordSymbol}}const VF$7=Vex.Flow;class VexFlowTabMeasure extends VexFlowMeasure{constructor(e,t=void 0,s=void 0){super(e,t,s),this.isTabMeasure=!0}resetLayout(){var t;const e=(t=this.ParentStaff.StafflineCount)!=null?t: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 t=0,s=this.staffEntries.length;t1){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[t.VoiceId].addTickable(o.vfStaveNote)}}}}class StaffLine extends GraphicalObject{constructor(e,t){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=t,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),t=this.PositionAndShape;e.PositionAndShape.RelativePosition=new PointF2D(t.RelativePosition.x+t.BorderRight+.5,t.RelativePosition.y+.5),e.PositionAndShape.Parent=this.parentMusicSystem.PositionAndShape}isPartOfMultiStaffInstrument(){return this.parentStaff.ParentInstrument.Staves.length>1}findClosestStaffEntry(e){let t;for(let s=0,r=this.Measures.length;s0){const c=l.map(g=>g.PositionAndShape.Center.y),d=Math.max(...c),m=((o=window.GYM)==null?void 0:o.noNeedContinuousDynamic)||!1,u=((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(b.PositionAndShape,S.PositionAndShape);b.squeeze(-(x.x+this.rules.DynamicExpressionSpacer))}if(v){const x=this.getOverlap(v.PositionAndShape,b.PositionAndShape);b.squeeze(x.x+this.rules.DynamicExpressionSpacer)}}}}}getDistance(e,t){const s=e.RelativePosition.x+e.BorderMarginRight,r=t.RelativePosition.x+t.BorderMarginLeft,o=e.RelativePosition.y+e.BorderMarginBottom,a=t.RelativePosition.y+t.BorderMarginTop;return new PointF2D(r-s,a-o)}getOverlap(e,t){return new PointF2D(e.RelativePosition.x+e.BorderMarginRight-(t.RelativePosition.x+t.BorderMarginLeft),e.RelativePosition.y+e.BorderMarginBottom-(t.RelativePosition.y+t.BorderMarginTop))}}class VexFlowStaffLine extends StaffLine{constructor(e,t){super(e,t),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,t=void 0,s=void 0){super(e,t,s),this.minimumStaffEntriesWidth=-1,s?this.rules=s.ParentMusicSystem.rules:t&&(this.rules=t.Rules),this.resetLayout(),this.multiRestElement=new VF$6.MultiMeasureRest(t.multipleRestMeasures,{})}draw(e){var o,a,l,c,d;const t=e.openGroup();(o=t==null?void 0:t.classList)==null||o.add("vf-measure");const s=e.openGroup();(a=s==null?void 0:s.classList)==null||a.add("vf-stave"),s==null||s.setAttribute("id",(c=(l=this.stave)==null?void 0:l.attrs)==null?void 0:c.id),this.stave.setContext(e).draw(),e.closeGroup();const r=e.openGroup();(d=r==null?void 0:r.classList)==null||d.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(),t}format(){}getVoicesWithinMeasure(){return[]}getGraphicalVoiceEntriesPerVoice(e){return[]}getRestFilledVexFlowStaveNotesPerVoice(e){return[]}handleBeam(e,t){}handleTuplet(e,t){}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 t=this.getRenderElement();for(let s=0;s \r<`)),o.download="opensheetmusicdisplay_download.svg",o.innerHTML=window.location.href+"/download",document.body.appendChild(o)}}class VexFlowInstantaneousDynamicExpression extends GraphicalInstantaneousDynamicExpression{constructor(e,t,s){super(e,t,s);const r=new Label(this.Expression);this.label=new GraphicalLabel(r,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,t){super(),this.getOctaveShift=e,this.setSymbol(),this.PositionAndShape=new BoundingBox$1(this,t)}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,t){switch(super(e,t),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 t of e.graphicalVoiceEntries){const s=t;if(s!=null&&s.vfStaveNote)return this.startNote=s.vfStaveNote,!0}return!1}setEndNote(e){for(const t of e.graphicalVoiceEntries){const s=t;if(s!=null&&s.vfStaveNote)return this.endNote=s.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 t=e.parentVoiceEntry.parentStaffEntry.sourceStaffEntry.ParentStaff.idInMusicSheet;let s;this.staffPitchListMapping.containsKey(t)||this.staffPitchListMapping.setValue(t,new Array),s=this.staffPitchListMapping.getValue(t);const r=e.sourceNote.Pitch;VexflowStafflineNoteCalculator.findOrInsert(s,r)}static PitchIndexOf(e,t,s=0){if(s>e.length-1)return-1;for(let r=s;rthis.rules.PercussionOneLineCutoff&&!r)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),s.length<=this.rules.PercussionForceVoicesOneLineCutoff)o.setAccidental(new Pitch(l,c,a.Accidental));else{const d=VexflowStafflineNoteCalculator.PitchIndexOf(s,a);if(d>-1){const m=Math.ceil(s.length/2);if(!this.rules.PercussionUseXMLDisplayStep)if(d>=m)switch(c=2,(d-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(d%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 u=new Pitch(l,c,a.Accidental);o.setAccidental(u);const g=o.parentVoiceEntry.parentVoiceEntry;!this.rules.SetWantedStemDirectionByXml&&g.Notes.length<2&&(u.Octave>this.baseLineOctave||u.FundamentalNote===this.baseLineNote&&u.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 t=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;t.initializeHeadless(c);const d=t.getContext(),m=t.getCanvas();c=m.width;const u=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(d)}catch(A){loglevelExports.warn("SkyBottomLineCalculator.calculateLines.draw",A)}const b=d.getImageData(0,0,c,u),y=4,S=Math.max(Math.ceil(a.PositionAndShape.Size.width*this.mRules.SamplingUnit),1),v=new Array(S),x=new Array(S);for(let A=0;A0){v[A]=E;break}}for(let E=u;E>0;E--){const w=E*c*y+A*y;if(b.data[w+3]>0){x[A]=E;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,t){for(let s=e;s>=0;s--)if(!isNaN(t[s]))return t[s];return 0}findNextValidNumber(e,t){if(e>=t.length)return t[e-1];for(let s=e;s=this.BottomLine.length&&(s=this.BottomLine.length-1),r<0&&(r=0),r>=this.BottomLine.length&&(r=this.BottomLine.length),this.SkyLine[s]=e.y;for(let a=s+1;a=this.BottomLine.length&&(s=this.BottomLine.length-1),r<0&&(r=0),r>=this.BottomLine.length&&(r=this.BottomLine.length),this.BottomLine[s]=e.y;for(let a=s+1;ae)}setBottomLineWithValue(e){this.BottomLine.forEach(t=>e)}getLeftIndexForPointX(e,t){const s=Math.floor(e*this.SamplingUnit);return s<0?0:s>=t?t-1:s}getRightIndexForPointX(e,t){const s=Math.ceil(e*this.SamplingUnit);return s<0?0:s>=t?t-1:s}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 t=Math.round(e*this.SamplingUnit);return this.mSkyLine[t]}getSkyLineMinInRange(e,t){return this.getMinInRange(this.SkyLine,e,t)}getBottomLineMax(){return Math.max(...this.BottomLine.filter(e=>!isNaN(e)))}getBottomLineMaxAtPoint(e){const t=Math.round(e*this.SamplingUnit);return this.mBottomLine[t]}getBottomLineMaxInRange(e,t){return this.getMaxInRange(this.BottomLine,e,t)}getBottomLineMaxInBoundingBox(e){const t=Math.floor(e.AbsolutePosition.x+e.BorderLeft),s=Math.ceil(e.AbsolutePosition.x+e.BorderRight);return this.getMaxInRange(this.mBottomLine,t,s)}updateWithBoundingBoxRecursively(e){if(e.ChildElements&&e.ChildElements.length>0)for(const t of e.ChildElements)this.updateWithBoundingBoxRecursively(t);else{const t=e.BorderTop+e.AbsolutePosition.y,s=e.BorderBottom+e.AbsolutePosition.y;if(t<0){const r=Math.floor(e.AbsolutePosition.x+e.BorderLeft),o=Math.ceil(e.AbsolutePosition.x+e.BorderRight);this.updateInRange(this.mSkyLine,r,o,t)}else if(s>this.StaffLineParent.StaffHeight){const r=Math.floor(e.AbsolutePosition.x+e.BorderLeft),o=Math.ceil(e.AbsolutePosition.x+e.BorderRight);this.updateInRange(this.mBottomLine,r,o,s)}}}updateInRange(e,t=0,s=e.length,r=0){if(t=Math.floor(t*this.SamplingUnit),s=Math.ceil(s*this.SamplingUnit),se.length&&(s=e.length);for(let o=t;oMath.abs(e[o])?r:e[o]}setInRange(e,t=0,s=e.length,r=0){if(t=Math.floor(t*this.SamplingUnit),s=Math.ceil(s*this.SamplingUnit),se.length&&(s=e.length);for(let o=t;o=e.length&&(t=e.length-1),s<0&&(s=0),s>=e.length&&(s=e.length),t>=0&&s<=e.length)return Math.min(...e.slice(t,s+1))}getMaxInRange(e,t,s){if(t=Math.floor(t*this.SamplingUnit),s=Math.ceil(s*this.SamplingUnit),!e)return Number.MIN_VALUE;if(t<0&&(t=0),t>=e.length&&(t=e.length-1),s<0&&(s=0),s>=e.length&&(s=e.length),t>=0&&s<=e.length)return Math.max(...e.slice(t,s+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(i){parserExports$1=i}};/*! * 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(i,e){(function(t,s){i.exports=s()})(commonjsGlobal,function(){return function(s){for(var r={command:/\s*([achlmqstvz])/gi,number:/\s*([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/gi,comma:/\s*(?:(,)|\s)/g,flag:/\s*([01])/g},o={number:function(S){return+b("number",S)},"coordinate pair":function(S){var v=b("number",S);if(v===null&&!S)return null;b("comma");var x=b("number",!0);return{x:+v,y:+x}},"arc definition":function(S){var v=o["coordinate pair"](S);if(!v&&!S)return null;b("comma");var x=+b("number",!0);b("comma",!0);var A=!!+b("flag",!0);b("comma");var E=!!+b("flag",!0);b("comma");var _=o["coordinate pair"](!0);return{radii:v,rotation:x,large:A,clockwise:E,end:_}}},a=0,l=[];at.bottom)switch(e.tagName.toLowerCase()){case"g":for(const g of e.children)this.recursiveUpdate(g,t,s,r);break;case"circle":case"rect":case"line":case"path":let m=Math.floor((o.x-s.x)/unitInPixels*this.mRules.SamplingUnit);const u=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 b=g[0],y=g[3],S=(y.end.y-b.end.y)/(y.end.x-b.end.x);let v=b.end.y/unitInPixels;for(m;m<=u;m++)vd[m]&&(d[m]=v),v+=S/this.mRules.SamplingUnit}}else for(m;m<=u;m++)ad[m]&&(d[m]=l);break}}calculateLinesForMeasure(e,t){var C,P,I;const s=t.getBBox(),r=Math.max(Math.round(e.PositionAndShape.Size.width*this.mRules.SamplingUnit),1),o=s.height/unitInPixels,l=t.getElementsByClassName("vf-stave")[0].getBBox();let c=(l==null?void 0:l.height)/unitInPixels,d=(l==null?void 0:l.y)/unitInPixels;const m=e.getVFStave();let u=((C=m.options)!=null&&C.num_lines?m.options.num_lines:5)-1,g=-1,b=0;const y=[u];for(const N of(P=m.options)==null?void 0:P.line_config)N.visible?(g===-1&&(g=b),y.push(b)):u--,b++;const S=y.pop();g===-1&&(g=0),u=S-g;const v=(I=m.options)==null?void 0:I.spacing_between_lines_px,x=u*v/unitInPixels;c-x>.2&&(c=x,d=g*v/unitInPixels);const A=d+c,E=new Array(r).fill(d),_=new Array(r).fill(A),w=[E,_];if(o>c)for(const N of t.children)this.recursiveUpdate(N,{top:d,bottom:A},s,[E,_]);return w}calculateLines(){this.mSkyLine=[],this.mBottomLine=[];const e=document.createElement("div");document.body.append(e);const t=new SvgVexFlowBackend(this.mRules);t.initialize(e,1,"0");const s=t.getContext(),r=s.openGroup();r.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(s),[l,c]=this.calculateLinesForMeasure(o,a);this.mSkyLine.push(...l),this.mBottomLine.push(...c)}s.closeGroup();for(const o of r.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 d=c+Math.ceil(l.width/unitInPixels*this.mRules.SamplingUnit),m=l.y/unitInPixels,u=l.height/unitInPixels+m;for(c;c<=d;c++)mthis.mBottomLine[c]&&(this.mBottomLine[c]=u)}t.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,t){return new VexFlowMusicSystem(e,t)}createStaffLine(e,t){return new VexFlowStaffLine(e,t)}createSkyBottomLineCalculator(e){return e.ParentMusicSystem.rules.PerformanceMode&&this.hasBBox?new SkyBottomLineCalculatorSVG(e):new SkyBottomLineCalculator(e)}createGraphicalMeasure(e,t,s=!1){return new VexFlowMeasure(t,e,void 0)}createMultiRestMeasure(e,t,s){return new VexFlowMultiRestMeasure(t,e,s)}createTabStaffMeasure(e,t){return new VexFlowTabMeasure(t,e)}createExtraGraphicalMeasure(e){const t=new VexFlowMeasure(e.ParentStaff,void 0,e);return t.IsExtraGraphicalMeasure=!0,t.ExtraGraphicalMeasurePreviousMeasure=e.Measures.last(),t}createStaffEntry(e,t){return new VexFlowStaffEntry(t,e,void 0)}createVoiceEntry(e,t){return new VexFlowVoiceEntry(e,t)}createNote(e,t,s,r=OctaveEnum.NONE,o,a=void 0){return new VexFlowGraphicalNote(e,t,s,r,o,a)}createGraceNote(e,t,s,r,o=OctaveEnum.NONE){return new VexFlowGraphicalNote(e,t,s,o,r)}addGraphicalAccidental(e,t){e.setAccidental(t)}addFermataAtTiedEndNote(e,t){}createInStaffClef(e,t){const s=e,r=VexFlowConverter.Clef(t,"small");s.vfClefBefore=new VF$1.ClefNote(r.type,r.size,r.annotation)}createChordSymbols(e,t,s,r){const o=t.parentMeasure.parentSourceMeasure.Rules;let a=0;const l=o.ChordSymbolXSpacing;for(const c of e.ChordContainers){const d=new GraphicalChordSymbolContainer(c,t.PositionAndShape,o.ChordSymbolTextHeight,s,r,t.parentMeasure.parentSourceMeasure.Rules),m=d.GraphicalLabel;m.PositionAndShape.RelativePosition.y-=o.ChordSymbolYOffset,m.PositionAndShape.RelativePosition.x+=a,m.setLabelPositionAndShapeBorders(),d.PositionAndShape.calculateBoundingBox(),t.graphicalChordContainers.push(d),a+=m.PositionAndShape.Size.width+l}}createGraphicalTechnicalInstruction(e,t){}}class GraphicalTie{constructor(e,t=void 0,s=void 0){this.tie=e,this.startNote=t,this.endNote=s}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,t,s,r){this.lyricsEntry=e,this.graphicalStaffEntry=t;const o=t.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,s,o,this.graphicalStaffEntry.parentMeasure.parentSourceMeasure.Rules,t.PositionAndShape),this.graphicalLabel.PositionAndShape.RelativePosition=new PointF2D(0,r),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(i,e){super(),this.staffEntries=[],this.slur=i,this.rules=e}static Compare(i,e){if(i.staffEntries.length<1)return-1;if(e.staffEntries.length<1)return 1;const t=Fraction$1.minus(i.staffEntries[i.staffEntries.length-1].getAbsoluteTimestamp(),i.staffEntries[0].getAbsoluteTimestamp()),s=Fraction$1.minus(e.staffEntries[e.staffEntries.length-1].getAbsoluteTimestamp(),e.staffEntries[0].getAbsoluteTimestamp());return t.RealValue>s.RealValue?1:s.RealValue>t.RealValue?-1:0}calculateCurve(i){const e=this.staffEntries[0],t=this.staffEntries[this.staffEntries.length-1];let s=e.findGraphicalNoteFromNote(this.slur.StartNote);!s&&this.graceStart&&(s=e.findGraphicalNoteFromGraceNote(this.slur.StartNote)),s||(s=e.findEndTieGraphicalNoteFromNoteWithStartingSlur(this.slur.StartNote,this.slur));let r=t.findGraphicalNoteFromNote(this.slur.EndNote);!r&&this.graceEnd&&(r=t.findGraphicalNoteFromGraceNote(this.slur.EndNote));const o=e.parentMeasure.ParentStaffLine,a=o.SkyBottomLineCalculator;this.calculatePlacement(a,o);const l=this.calculateStartAndEnd(s,r,o,i,a),c=l.startX,d=l.endX;let m=l.startY,u=l.endY;const g=i.SlurTangentMinAngle,b=i.SlurTangentMaxAngle;let y;if(this.placement===PlacementEnum.Above){m-=i.SlurNoteHeadYOffset,u-=i.SlurNoteHeadYOffset;const S=new PointF2D(this.staffEntries[0].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[0].PositionAndShape.RelativePosition.x,m);s?S.x+=this.staffEntries[0].PositionAndShape.BorderRight:S.x=this.staffEntries[0].parentMeasure.beginInstructionsWidth,this.graceStart&&(S.x+=t.PositionAndShape.RelativePosition.x);const v=new PointF2D(this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].PositionAndShape.RelativePosition.x,u);if(r?v.x+=this.staffEntries[this.staffEntries.length-1].PositionAndShape.BorderLeft:v.x=this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.Size.width,this.graceEnd&&(v.x+=t.staffEntryParent.PositionAndShape.RelativePosition.x),y=this.calculateTopPoints(S,v,o,a),y.length===0){const oe=new PointF2D((v.x-S.x)/2+S.x,(v.y-S.y)/2+S.y);y.push(oe)}const x=Math.atan((u-m)/(d-c)),A=new PointF2D(0,0);let E=new PointF2D(d-c,-(u-m));const _=Matrix2D.getRotationMatrix(x),w=_.getTransposeMatrix();E=_.vectorMultiplication(E);const C=this.calculateTranslatedAndRotatedPointListAbove(y,c,m,_);let P=this.calculateMaxLeftSlope(C,A,E),I=this.calculateMaxRightSlope(C,A,E);const N=A.y-A.x*P,R=E.y-E.x*I,F=new PointF2D;let B=!1;Math.abs(Math.abs(P)-Math.abs(I))<1e-4?(F.x=E.x/2,F.y=0,B=!0):(F.x=(R-N)/(P-I),F.y=P*F.x+N);const k=this.calculateHeightWidthRatio(E.x,C);let M=0,G=0;if(Math.abs(k)>.001){const oe=Math.abs(P/(k*2)),he=Math.abs(P);M=Math.max(0,he*(Math.min(10,oe-1)/10)),P-=M;const le=Math.abs(I/(k*2)),me=Math.abs(I);G=Math.max(0,me*(Math.min(10,le-1)/10)),I+=G}let ee=g,$=-g;if(!B){const oe=this.calculateAngles(g,P,I,b);ee=oe.startAngle,$=oe.endAngle}const re=this.calculateControlPoints(E.x,ee,$,C,k,m,u);let ie=re.startControlPoint,de=re.endControlPoint;ie=w.vectorMultiplication(ie),ie.x+=c,ie.y=-ie.y+m,de=w.vectorMultiplication(de),de.x+=c,de.y=-de.y+m,this.bezierStartPt=new PointF2D(c,m-M),this.bezierStartControlPt=new PointF2D(ie.x,ie.y-M),this.bezierEndControlPt=new PointF2D(de.x,de.y-G),this.bezierEndPt=new PointF2D(d,u-G);const Q=o.SkyLine.length,H=a.getLeftIndexForPointX(this.bezierStartPt.x,Q),ue=a.getLeftIndexForPointX(this.bezierEndPt.x,Q),ne=this.bezierEndPt.x-this.bezierStartPt.x,W=a.SamplingUnit;for(let oe=H;oe=H&&(o.SkyLine[me]=Math.min(o.SkyLine[me],le.y)),me++,me.001){const oe=Math.abs(P/(k*2)),he=Math.abs(P);M=Math.max(0,he*(Math.min(10,oe-1)/10)),P-=M;const le=Math.abs(I/(k*2)),me=Math.abs(I);G=Math.max(0,me*(Math.min(10,le-1)/10)),I+=G}let ee=g,$=-g;if(!B){const oe=this.calculateAngles(g,P,I,b);ee=oe.startAngle,$=oe.endAngle}const re=this.calculateControlPoints(E.x,ee,$,C,k,m,u);let ie=re.startControlPoint,de=re.endControlPoint;ie=w.vectorMultiplication(ie),ie.x+=c,ie.y+=m,de=w.vectorMultiplication(de),de.x+=c,de.y+=m,this.bezierStartPt=new PointF2D(c,m+M),this.bezierStartControlPt=new PointF2D(ie.x,ie.y+M),this.bezierEndControlPt=new PointF2D(de.x,de.y+G),this.bezierEndPt=new PointF2D(d,u+G);const Q=o.BottomLine.length,H=a.getLeftIndexForPointX(this.bezierStartPt.x,Q),ue=a.getLeftIndexForPointX(this.bezierEndPt.x,Q),ne=this.bezierEndPt.x-this.bezierStartPt.x,W=a.SamplingUnit;for(let oe=H;oe=H&&(o.BottomLine[me]=Math.max(o.BottomLine[me],le.y)),me++,me0){this.placement=PlacementEnum.Above;return}const t=this.staffEntries[0],s=this.staffEntries[this.staffEntries.length-1],r=t.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection,o=s.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection;if(r===o)this.placement=r===StemDirectionType.Up?PlacementEnum.Below:PlacementEnum.Above;else{let a=t.PositionAndShape.BorderLeft+t.PositionAndShape.RelativePosition.x+t.parentMeasure.PositionAndShape.RelativePosition.x,l=s.PositionAndShape.BorderRight+s.PositionAndShape.RelativePosition.x+s.parentMeasure.PositionAndShape.RelativePosition.x;this.graceStart&&(a+=s.PositionAndShape.RelativePosition.x),this.graceEnd&&(l+=s.staffEntryParent.PositionAndShape.RelativePosition.x);const c=i.getSkyLineMinInRange(a,l)*-1;i.getBottomLineMaxInRange(a,l)-e.StaffHeight>c?this.placement=PlacementEnum.Above:this.placement=PlacementEnum.Below}}calculateTopPoints(i,e,t,s){const r=[];let o=s.getRightIndexForPointX(i.x,t.SkyLine.length),a=s.getLeftIndexForPointX(e.x,t.SkyLine.length);o<0&&(o=0),a>=t.SkyLine.length&&(a=t.SkyLine.length-1);for(let l=o;l=t.BottomLine.length&&(a=t.BottomLine.length-1);for(let l=o;ld&&i>m&&(c+=i/70*this.rules.SlurHeightFlattenLongSlursFactorByWidth,c*=1+e/30*this.rules.SlurHeightFlattenLongSlursFactorByAngle,l/=c);const u=Math.min(.5,Math.max(.1,1.7*e/80*l*Math.pow(Math.max(r,.05),.4))),g=Math.min(.5,Math.max(.1,1.7*-t/80*l*Math.pow(Math.max(r,.05),.4))),b=new PointF2D;b.x=i*u*Math.cos(e*_GraphicalSlur.degreesToRadiansFactor),b.y=i*u*Math.sin(e*_GraphicalSlur.degreesToRadiansFactor);const y=new PointF2D;y.x=i-i*g*Math.cos(t*_GraphicalSlur.degreesToRadiansFactor),y.y=-(i*g*Math.sin(t*_GraphicalSlur.degreesToRadiansFactor));let S=b.y-y.y;for(;this.rules.SlurMaximumYControlPointDistance&&Math.abs(S)>this.rules.SlurMaximumYControlPointDistance;)S<0?(b.y+=1,y.y-=1):(b.y-=1,y.y+=1),S=b.y-y.y;return{startControlPoint:b,endControlPoint:y}}calculateAngles(i,e,t,s){let o=Math.atan(e)/_GraphicalSlur.degreesToRadiansFactor;e>0?o+=20:o-=20;let a=Math.atan(t)/_GraphicalSlur.degreesToRadiansFactor;t<0?a-=20:a+=20;const l=Math.min(Math.max(i,o),s),c=Math.max(Math.min(-i,a),-s);return{startAngle:l,endAngle:c}}};let GraphicalSlur=_GraphicalSlur;GraphicalSlur.degreesToRadiansFactor=Math.PI/180;class GraphicalPedal extends GraphicalObject{constructor(e,t){super(),this.getPedal=e,this.setSymbol(),this.PositionAndShape=new BoundingBox$1(this,t)}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,t,s=!1,r=!1){switch(super(e,t),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,t);break;case MusicSymbol.PEDAL_MIXED:s&&r?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BOTH:s?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BEGIN:r?this.vfStyle=Vex.Flow.PedalMarking.Styles.MIXED_OPEN_END:this.vfStyle=Vex.Flow.PedalMarking.Styles.MIXED;break;case MusicSymbol.PEDAL_BRACKET:default:s&&r?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BOTH:s?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BEGIN:r?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 t of e.graphicalVoiceEntries){const s=t;if(s!=null&&s.vfStaveNote)return this.startNote=s.vfStaveNote,this.startVfVoiceEntry=s,!0}return!1}setEndNote(e){if(!e)return!1;for(const t of e.graphicalVoiceEntries){const s=t;if(s!=null&&s.vfStaveNote)return this.endNote=s.vfStaveNote,this.endVfVoiceEntry=s,!0}return!1}setEndMeasure(e){this.endMeasure=e}CalculateBoundingBox(){}setLine(e){this.line=e}getPedalMarking(){var t,s,r,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),(((t=this.endVfVoiceEntry)==null?void 0:t.parentStaffEntry)===((o=(r=(s=this.endVfVoiceEntry)==null?void 0:s.parentStaffEntry)==null?void 0:r.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,t){super(),this.getWavyLine=e,this.PositionAndShape=new BoundingBox$1(this,t)}}class VexflowVibratoBracket extends GraphicalWavyLine{constructor(e,t,s=!1){super(e,t),this.line=1,this.isVibrato=!1,this.toEndOfStopStave=!1,this.isVibrato=s}get ToEndOfStopStave(){return this.toEndOfStopStave}setStartNote(e){for(const t of e.graphicalVoiceEntries){const s=t;if(s!=null&&s.vfStaveNote)return this.startNote=s.vfStaveNote,this.startVfVoiceEntry=s,!0}return!1}setEndNote(e){for(const t of e.graphicalVoiceEntries){const s=t;if(s!=null&&s.vfStaveNote){this.endNote=s.vfStaveNote,this.endVfVoiceEntry=s;const r=this.endVfVoiceEntry.parentStaffEntry.parentMeasure.staffEntries,o=r[r.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 t,s,r,o,a,l,c,d;super(),this.beamsNeedUpdate=!1,this.isFirstZero=!1,this.rules=e,MusicSheetCalculator.symbolFactory=new VexFlowGraphicalSymbolFactory,MusicSheetCalculator.TextMeasurer=new VexFlowTextMeasurer(this.rules),MusicSheetCalculator.stafflineNoteCalculator=new VexflowStafflineNoteCalculator(this.rules),((t=this.rules.DefaultVexFlowNoteFont)==null?void 0:t.toLowerCase())==="gonville"?Vex.Flow.DEFAULT_FONT_STACK=[(s=Vex.Flow.Fonts)==null?void 0:s.Gonville,(r=Vex.Flow.Fonts)==null?void 0:r.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,(d=Vex.Flow.Fonts)==null?void 0:d.Bravura])}clearRecreatedObjects(){super.clearRecreatedObjects(),MusicSheetCalculator.stafflineNoteCalculator=new VexflowStafflineNoteCalculator(this.rules);for(const e of this.graphicalMusicSheet.MeasureList)for(const t of e)t==null||t.clean()}formatMeasures(){for(const e of this.graphicalMusicSheet.MeasureList){if(!e||!e[0])continue;e[0].format();for(const s of e){for(const r of s.staffEntries)r.calculateXPosition();s.finalizeBeams()}}this.beamsNeedUpdate=!1}calculateMeasureXLayout(e){const t=[];for(const m of e)m&&t.push(m);if(t.length===0)return 0;e=t;const s=[],r=new VF.Formatter({softmaxFactor:this.rules.SoftmaxFactorVexFlow});let o=e[0].staffEntries.length,a=1;for(const m of e){if(!m)continue;let u=0;for(const y of m.staffEntries)u+=y.setMaxAccidentals();m.parentSourceMeasure.ImplicitMeasure&&(o=Math.max(m.staffEntries.length,o),a=Math.max(m.staffEntries.length+u,a));const g=m.vfVoices,b=[];for(const y in g)g.hasOwnProperty(y)&&(b.push(g[y]),s.push(g[y]));if(b.length===0){loglevelExports.debug("Found a measure with no voices. Continuing anyway.",g);continue}r.joinVoices(b)}let l=12;const c=e[0].parentSourceMeasure,d=.3;if(s.length>0){l=r.preCalculateMinTotalWidth(s)/unitInPixels*this.rules.VoiceSpacingMultiplierVexflow+this.rules.VoiceSpacingAddendVexflow+o*d,c!=null&&c.ImplicitMeasure&&(l=c.Duration.RealValue/c.ActiveTimeSignature.RealValue*l,o>1&&(l+=a*d*1.5),l*=this.rules.PickupMeasureWidthMultiplier),MusicSheetCalculator.setMeasuresMinStaffEntriesWidth(e,l);const m=(g,b)=>{r.formatToStave(s,b.getVFStave())},u=(g,b)=>{r.formatToStave(s,b.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=u;else if(this.rules.AlignRests===AlignRestOption.Auto){let b=!1;for(const y of g.staffEntries){let S=0,v=0;for(const x of y.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&&v++,S>1&&v>=1){b=!0;break}if(b)break}b?g.formatVoices=u:g.formatVoices=m}if(g===e[0]){const b=g;b.formatVoices(l*unitInPixels,b)}}}for(const m of e)if(m)for(const u of m.staffEntries)u.calculateXPosition();for(const m of e){if(!m)continue;const u=m.vfVoices,g=[];for(const b in u)u.hasOwnProperty(b)&&g.push(u[b]);if(g.length===0){loglevelExports.debug("Found a measure with no voices. Continuing anyway.",u);continue}r.joinVoices(g)}return l}calculateElongationFactor(e,t,s,r,o,a,l,c){let d=o,m=0;for(const u of e){const g=u.GraphicalLabel.Label.textAlignment;let b=l,y=c;if(u instanceof GraphicalLyricEntry&&u.ParentLyricWord){u.LyricsEntry.SyllableIndex>0&&(b=this.rules.BetweenSyllableMinimumDistance,TextAlignment.IsCenterAligned(g)&&(b+=1));const B=u.ParentLyricWord.GetLyricWord.Syllables;B.length>1&&u.LyricsEntry.SyllableIndex4&&(R*=1.1)}}else s[m]&&(R=E/_);I=Math.max(N,R),d=Math.max(d,I);let F=Math.max(E-_||0,0);s[m]&&(F+=s[m].cumulativeOverlap),s[m]={cumulativeOverlap:F,extend:u instanceof GraphicalLyricEntry?u.LyricsEntry.extend:!1,labelWidth:v,measureNumber:a,sourceNoteDuration:u instanceof GraphicalLyricEntry?u.LyricsEntry&&u.LyricsEntry.Parent.Notes[0].Length:!1,text:u instanceof GraphicalLyricEntry?u.LyricsEntry.Text:u.GraphicalLabel.Label.text,xPosition:A},m++}return d}calculateElongationFactorFromStaffEntries(e,t,s,r){let o=s;const a={},l={};for(const c of e)c.LyricsEntries.length>0&&(o=this.calculateElongationFactor(c.LyricsEntries,c,a,t,o,r,this.rules.HorizontalBetweenLyricsDistance,this.rules.LyricOverlapAllowedIntoNextMeasure)),c.graphicalChordContainers.length>0&&(o=this.calculateElongationFactor(c.graphicalChordContainers,c,l,t,o,r,this.rules.ChordSymbolXSpacing,this.rules.ChordOverlapAllowedIntoNextMeasure));return o}calculateMeasureWidthFromStaffEntries(e,t){var a;let s=1;if(!((a=window.GYM)==null?void 0:a.multitrack))for(const l of e)!l||l.staffEntries.length===0||(s=this.calculateElongationFactorFromStaffEntries(l.staffEntries,t,s,l.MeasureNumber),s=1);return s=Math.min(s,this.rules.MaximumLyricsElongationFactor),t*s}createGraphicalTie(e,t,s,r,o){return new GraphicalTie(e,r,o)}updateStaffLineBorders(e){e.SkyBottomLineCalculator.updateStaffLineBorders()}graphicalMeasureCreatedCalculations(e){e.rules=this.rules,e.graphicalMeasureCreatedCalculations()}layoutVoiceEntry(e,t,s,r){for(let o=0;o=2&&(a=r.vfnote[0],l=r.vfnote[1]);let c,d=0;if(o&&o.vfnote&&o.vfnote.length>=2&&(c=o.vfnote[0],d=o.vfnote[1]),t){if(a){const v=new VF.StaveTie({first_indices:[l],first_note:a}),x=r.parentVoiceEntry.parentStaffEntry.parentMeasure;if(c){c.getDuration()==="w"&&((u=(m=c.keyProps)==null?void 0:m[0])==null?void 0:u.line)>=3&&c.setStemDirection(-1);let A=((g=window.GYM)==null?void 0:g.tieDirection)||0;Math.abs(A)===1&&(((y=(b=c.keyProps)==null?void 0:b[0])==null?void 0:y.line)>=3?c.setStemDirection(-A):c.setStemDirection(A)),v==null||v.setDirection(c.getStemDirection())}if(x.vfTies.length>0){const A=x.vfTies[0].direction;v==null||v.setDirection(A?-A:1)}x.addStaveTie(v,e)}if(c){const v=new VF.StaveTie({last_indices:[d],last_note:c}),x=o.parentVoiceEntry.parentStaffEntry.parentMeasure;if(x.vfTies.length>0){const A=x.vfTies[0].direction;v==null||v.setDirection(A?-A:1)}x.addStaveTie(v,e)}}else if(a||c){let v;if(s)if(e.Tie.Type==="S"){const E=e.StartNote.sourceNote,_=e.EndNote.sourceNote;let w=1;E.FretNumber>_.FretNumber&&(w=-1),v=new VF.TabSlide({first_indices:[l],first_note:a,last_indices:[d],last_note:c},w)}else v=new VF.TabTie({first_indices:[l],first_note:a,last_indices:[d],last_note:c},e.Tie.Type);else{v=new VF.StaveTie({first_indices:[l],first_note:a,last_indices:[d],last_note:c});const E=e.Tie.getTieDirection(r.sourceNote);E===PlacementEnum.Below?v.setDirection(1):E===PlacementEnum.Above&&v.setDirection(-1);try{Math.abs((a==null?void 0:a.getTieRightX())-(c==null?void 0:c.getTieLeftX()))<10&&(v.render_options.first_x_shift=-3,v.render_options.last_x_shift=3)}catch(_){console.log(_)}}const x=o.parentVoiceEntry.parentStaffEntry.parentMeasure,A=((S=window.GYM)==null?void 0:S.graceCustom)||!1;A&&v.setDirection(A.direction),x.addStaveTie(v,e)}}calculateDynamicExpressionsForMultiExpression(e,t,s){if(tthis.rules.MaxMeasureToDrawIndex)return;const r=e.AbsoluteTimestamp,o=this.graphicalMusicSheet.MeasureList[t],a=o[s].ParentStaffLine,l=o[s];if(!a)return;const c=this.getRelativePositionInStaffLineFromTimestamp(r,s,a,a==null?void 0:a.isPartOfMultiStaffInstrument());if(c.x<=0&&(c.x=l.beginInstructionsWidth+this.rules.RhythmRightMargin),e.InstantaneousDynamic){const d=new VexFlowInstantaneousDynamicExpression(e.InstantaneousDynamic,a,l);this.calculateGraphicalInstantaneousDynamicExpression(d,c,r),this.dynamicExpressionMap.set(r.RealValue,d.PositionAndShape)}if(e.StartingContinuousDynamic){const d=e.StartingContinuousDynamic,m=new VexFlowContinuousDynamicExpression(e.StartingContinuousDynamic,a,l.parentSourceMeasure);if(m.StartMeasure=l,!m.IsVerbal&&d.EndMultiExpression)try{this.calculateGraphicalContinuousDynamic(m,c),m.updateSkyBottomLine()}catch(u){}else m.IsVerbal?this.calculateGraphicalVerbalContinuousDynamic(m,c):loglevelExports.warn("This continuous dynamic is not covered. measure"+e.SourceMeasureParent.MeasureNumber)}}createMetronomeMark(e,t){var A,E,_,w,C,P,I,N,R;const s=Math.max(e.ParentMultiTempoExpression.SourceMeasureParent.MeasureNumber-1,0),r=t||s,o=Math.max(e.StaffNumber-1,0),a=this.graphicalMusicSheet.MeasureList[r][o].getVFStave();let l="q";if(e.beatUnit){const F=NoteTypeHandler.getNoteDurationFromType(e.beatUnit);l=VexFlowConverter.durations(F,!1)[0]}let c=this.rules.MetronomeMarkYShift,d=!1;const m=[];if(e.parentMeasure){for(const F of e.parentMeasure.StaffLinkedExpressions)for(const B of F)B&&B instanceof UnknownExpression&&m.push(B);for(const F of e.parentMeasure.TempoExpressions){const B=((A=F.InstantaneousTempo)==null?void 0:A.Enum)===TempoEnum.metronomeMark;if(!e.beatUnit&&F.InstantaneousTempo.beatUnit){const k=NoteTypeHandler.getNoteDurationFromType(e.beatUnit);l=VexFlowConverter.durations(k,!1)[0]}if(F.getPlacementOfFirstEntry()===PlacementEnum.Above&&!B){d=!0;break}}}d&&(c-=1.4);const u=(E=this.graphicalMusicSheet.MeasureList[0][0].ParentStaffLine)==null?void 0:E.SkyLine;let g=e.TempoInBpm,b="",y="",S="";for(const F of this.graphicalMusicSheet.MeasureList[r][o].parentSourceMeasure.TempoExpressions){if(y=F.CombinedExpressionsText,isSpecialMark(F.CombinedExpressionsText)){b=F.CombinedExpressionsText;break}if(isSpeedKeyword(F.CombinedExpressionsText)||isSpeedHiddenKeyword(F.CombinedExpressionsText)){b=formatSpeedKeyword(F.CombinedExpressionsText),g=F.sourceMeasure.TempoInBPM,isSpeedKeyword(F.CombinedExpressionsText)&&(S=l);break}}const v={bpm:e.TempoInBpm,dots:e.dotted,duration:l,name:b};b&&(v.bpm=g/(v.dots?1.5:1),isSpeedKeyword(y)?v.duration=S:(g===SpeedTag[b]||!SpeedTag[b])&&(v.duration=""));const x=((w=(_=this.graphicalMusicSheet.MeasureList[r][o].vfVoices)==null?void 0:_[1])==null?void 0:w.boundingBox.y)||0;if(this.rules.MetronomeMarksDrawn){if(u){const M=((P=(C=this.graphicalMusicSheet.MeasureList[0])==null?void 0:C[o])==null?void 0:P.ParentStaffLine).Measures.map(G=>G.MeasureNumber-1);if(x&&M.includes(r)&&(isSpeedKeyword(y)||isSpeedHiddenKeyword(y))){const G=u.slice(0,9);let ee=Math.min(...G);ee=ee<0?ee-1:ee,c+=ee}M.includes(r)&&m.length?u[0]=Math.min(u[0],-4.5+c-4):u[0]=Math.min(u[0],-4.5+c)}a.options.line_config.reduce((k,M)=>(M.visible&&k++,k),0)<5&&(c-=2),a.setTempo(v,c*unitInPixels);let B=0;try{const k=(R=(N=(I=this.graphicalMusicSheet.MeasureList[r][o])==null?void 0:I.vfVoices)==null?void 0:N[1])==null?void 0:R.getTickables();B+=k[e.parentMeasure.metronomeNoteIndex].getBoundingBox().getX()-a.getNoteStartX()}catch(k){}a.getModifiers()[a.getModifiers().length-1].setShiftX(B)}}calculateRehearsalMark(e){var g,b,y,S,v;const t=e.rehearsalExpression;if(!this.isFirstZero&&e.MeasureNumber===0&&(this.isFirstZero=!0),!t)return;const s=this.graphicalMusicSheet.MeasureList[0][0].MeasureNumber,r=Math.max(e.measureListIndex+1-s,0),o=0,a=(g=this.graphicalMusicSheet.MeasureList[r][o])==null?void 0:g.getVFStave();if(!a)return;const l=-this.rules.RehearsalMarkYOffsetDefault-this.rules.RehearsalMarkYOffset;let c=this.rules.RehearsalMarkXOffsetDefault+this.rules.RehearsalMarkXOffset;e.IsSystemStartMeasure&&(c+=this.rules.RehearsalMarkXOffsetSystemStartMeasure);const d=this.rules.RehearsalMarkFontSize,m=a.getModifiers(),u=m.find(x=>x.getCategory().toLocaleLowerCase()==="repetitions");if(u&&u.setShiftY(u.y_shift-10),this.isFirstZero?a.setSection(e.MeasureNumberXML+1+"",l,c,d):a.setSection(t.label,l,c,d),(b=this.graphicalMusicSheet.MeasureList[r][o])!=null&&b.ParentStaffLine.AbstractExpressions){const x=m.find(A=>A.getCategory().toLocaleLowerCase()==="stavesection");for(let A of((v=(S=(y=e==null?void 0:e.VerticalMeasureList)==null?void 0:y[0])==null?void 0:S.ParentStaffLine)==null?void 0:v.AbstractExpressions)||[])A instanceof GraphicalUnknownExpression&&(x&&(A.Label.PositionAndShape.RelativePosition.y-=.5),u&&(A.Label.PositionAndShape.RelativePosition.y-=1.7))}}calculateSingleOctaveShift(e,t,s,r){var y;const o=t.OctaveShiftStart,a=o.ParentStartMultiExpression.Timestamp,l=(y=o.ParentEndMultiExpression)==null?void 0:y.Timestamp,c=this.rules.MinMeasureToDrawIndex,d=this.rules.MaxMeasureToDrawIndex;let m=this.graphicalMusicSheet.MeasureList[s][r].ParentStaffLine;m||(m=this.graphicalMusicSheet.MeasureList[c][r].ParentStaffLine);let u;o.ParentEndMultiExpression?u=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(o.ParentEndMultiExpression.SourceMeasureParent,r):u=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(r,!0),u.MeasureNumber>d+1&&(u=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(r,!0));let g;if(o.ParentEndMultiExpression?g=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(o.ParentStartMultiExpression.SourceMeasureParent,r):g=this.graphicalMusicSheet.MeasureList[c][r],g.MeasureNumberd||u.parentSourceMeasure.measureListIndexd)return;let b=u.ParentStaffLine;if(b||(b=m),u&&m&&b){const S=new VexFlowOctaveShift(o,m.PositionAndShape);if(!S.startNote){let A;for(const E of g.staffEntries)if(E){A=E;break}if(!A||(S.setStartNote(A),!S.startNote))return}if(!S.endNote){let A;for(let E=u.staffEntries.length-1;E>=0;E++)if(u.staffEntries[E]){A=u.staffEntries[E];break}if(S.setEndNote(A),!S.endNote)return}let v=g.findGraphicalStaffEntryFromTimestamp(a);v||(v=g.staffEntries[0]);let x=u.findGraphicalStaffEntryFromTimestamp(l);if(x||(x=u.staffEntries[u.staffEntries.length-1]),S.setStartNote(v),b!==m){S.endsOnDifferentStaffLine=!0;let A=m.Measures[m.Measures.length-1];A===void 0&&(A=u);const E=A.staffEntries[A.staffEntries.length-1];S.setEndNote(E);const _=b.ParentMusicSystem.Id-m.ParentMusicSystem.Id;if(_>0)for(let w=m.ParentMusicSystem.Id;wd+1&&(u=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(r,!0));let g;if(o.ParentEndMultiExpression?g=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(o.ParentStartMultiExpression.SourceMeasureParent,r):(g=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(o.ParentStartMultiExpression.SourceMeasureParent,r),g||(g=this.graphicalMusicSheet.MeasureList[c][r])),g.MeasureNumberd||u.parentSourceMeasure.measureListIndexd)return;let b=u.ParentStaffLine;if(b||(b=m),u&&m&&b){let S=!1;m!==b&&(S=!0);const v=new VexFlowPedal(o,m.PositionAndShape,!1,S);let x=g.findGraphicalStaffEntryFromTimestamp(a);x||(x=g.staffEntries[0]);let A=u.findGraphicalStaffEntryFromTimestamp(l);if(A||(A=u.staffEntries[u.staffEntries.length-1]),!v.setStartNote(x))return;if(b!==m)if(v.pedalSymbol===MusicSymbol.PEDAL_SYMBOL){v.setEndNote(A),v.setEndMeasure(u),v.ReleaseText=" ",v.CalculateBoundingBox(),this.calculatePedalSkyBottomLine(v.startVfVoiceEntry,v.endVfVoiceEntry,v,m);const E=b.Measures[0],_=new VexFlowPedal(o,E.PositionAndShape),w=E.staffEntries[0];if(!_.setStartNote(w))return;_.setEndNote(A),v.setEndMeasure(u),b.Pedals.push(_),_.CalculateBoundingBox(),_.DepressText=" ",this.calculatePedalSkyBottomLine(_.startVfVoiceEntry,_.endVfVoiceEntry,_,b)}else{let E=m.Measures[m.Measures.length-1];E===void 0&&(E=u);const _=E.staffEntries[E.staffEntries.length-1];v.setEndNote(_),v.setEndMeasure(u),v.ChangeEnd=!1;const w=b.ParentMusicSystem.Id-m.ParentMusicSystem.Id;if(w>0){let C=1;for(let P=m.ParentMusicSystem.Id;Pd+1&&(u=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(r,!0));let g;if(o.ParentEndMultiExpression?g=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(o.ParentStartMultiExpression.SourceMeasureParent,r):g=this.graphicalMusicSheet.MeasureList[c][r],g.MeasureNumberd||u.parentSourceMeasure.measureListIndexd)return;let b=u.ParentStaffLine;if(b||(b=m),u&&m&&b){const v=new VexflowVibratoBracket(o,m.PositionAndShape,g.ParentStaff.isTab);let x=g.findGraphicalStaffEntryFromTimestamp(a);x||(x=g.staffEntries[0]);let A=u.findGraphicalStaffEntryFromTimestamp(l);if(A||(A=u.staffEntries[u.staffEntries.length-1]),v.setStartNote(x),b!==m){let E=m.Measures[m.Measures.length-1];E===void 0&&(E=u);const _=E.staffEntries[E.staffEntries.length-1];if(v.setEndNote(_),b.ParentMusicSystem.Id-m.ParentMusicSystem.Id>0)for(let C=m.ParentMusicSystem.Id;Cu){const E=u;u=m,m=E}r.SkyBottomLineCalculator.updateBottomLineInRange(m,u,g+x)}for(const x of r.Pedals){const A=x,E=A.getPedalMarking(),_=E.line+3+(r.StaffLines.length-1);if(g>_){const w=E.render_options.text_margin_right/10;let C=A.startVfVoiceEntry.PositionAndShape.AbsolutePosition.x-w,P;A.setLine(g-3-(r.StaffLines.length-1));let I=(y=A.endVfVoiceEntry)==null?void 0:y.PositionAndShape;if(I||(I=A.endMeasure.PositionAndShape),A.EndSymbolPositionAndShape){const N=l.render_options.glyph_point_size/20;P=C+3.4;const R=I.AbsolutePosition.x-w,F=R+1.5;r.SkyBottomLineCalculator.updateBottomLineInRange(C,P,g+N),r.SkyBottomLineCalculator.updateBottomLineInRange(R,F,g+N)}else{const N=E.render_options.bracket_height/10;if(E.EndsStave)P=I.AbsolutePosition.x+I.Size.width-w;else switch(l.style){case a.BRACKET_OPEN_END:case a.BRACKET_OPEN_BOTH:case a.MIXED_OPEN_END:P=I.AbsolutePosition.x+I.BorderRight-w;break;default:P=I.AbsolutePosition.x+I.BorderLeft-w;break}const R=(v=(S=A.endVfVoiceEntry)==null?void 0:S.parentStaffEntry)==null?void 0:v.vfClefBefore;if(R){const F=R.getWidth()/10;P+=F}if(C>P){const F=C;C=P,P=F}r.SkyBottomLineCalculator.updateBottomLineInRange(C,P,g+N)}}}}calculateOctaveShiftSkyBottomLine(e,t,s,r){if(!t){loglevelExports.warn("octaveshift: no endStaffEntry");return}let o=e.PositionAndShape.Size.width,a=t.PositionAndShape.Size.width;e.hasOnlyRests()?o=-o:o/=2,t.hasOnlyRests()?a*=2:a/=2,e===t&&(a*=2);const l=e.PositionAndShape.AbsolutePosition.x-o,c=t.PositionAndShape.AbsolutePosition.x+a;s.PositionAndShape.Size.width=l-c;const d=s.getTextBracket(),m=d.font.size/10;if(d.position===VF.TextBracket.Positions.TOP){const u=Math.ceil(r.SkyBottomLineCalculator.getSkyLineMinInRange(l,c));if(u===1/0)return;d.start.getStave().options.top_text_position=Math.abs(u),r.SkyBottomLineCalculator.updateSkyLineInRange(l,c,u-m*2)}else{const u=r.SkyBottomLineCalculator.getBottomLineMaxInRange(l,c);if(u===1/0)return;d.start.getStave().options.bottom_text_position=u,e.parentMeasure!==t.parentMeasure&&(d.stop.getStave().options.bottom_text_position=u),r.SkyBottomLineCalculator.updateBottomLineInRange(l,c,u+m*1.5)}}calculateWordRepetitionInstruction(e,t){let s;const r=this.graphicalMusicSheet.MeasureList[t];for(let o=0,a=r.length;o{s.updateSkyBottomLine()})}catch(s){}}handleTiedGraphicalNote(e,t,s,r,o,a,l,c){}handleBeam(e,t,s){e.parentVoiceEntry.parentStaffEntry.parentMeasure.handleBeam(e,t)}handleVoiceEntryLyrics(e,t,s){e.LyricsEntries.forEach((r,o)=>{const a=new GraphicalLyricEntry(o,t,this.rules.LyricsHeight,this.rules.StaffHeight);if(t.LyricsEntries.push(a),a.GraphicalLabel.setLabelPositionAndShapeBorders(),o.Word){const c=o.Word.Syllables.indexOf(o);let d=s.indexOf(o.Word);if(d===-1&&(s.push(o.Word),d=s.indexOf(o.Word)),this.graphicalLyricWords.length===0||d>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[d];a.ParentLyricWord=m,m.GraphicalLyricsEntries[c]=a,m.isFilled()&&(s.splice(d,1),this.graphicalLyricWords.splice(this.graphicalLyricWords.indexOf(m),1))}}})}handleVoiceEntryOrnaments(e,t,s){}handleVoiceEntryArticulations(e,t,s){}handleVoiceEntryTechnicalInstructions(e,t,s){}handleTuplet(e,t,s){e.parentVoiceEntry.parentStaffEntry.parentMeasure.handleTuplet(e,t)}findIndexGraphicalSlurFromSlur(e,t){for(let s=0;s=0){const u=r[m];u.staffEntries.indexOf(a)===-1&&u.staffEntries.push(a),r.splice(m,1)}}}for(const l of r)l.staffEntries.indexOf(a)===-1&&l.staffEntries.push(a)}}for(const t of this.musicSystems)for(const s of t.StaffLines){const r=s.GraphicalSlurs.sort(GraphicalSlur.Compare);for(const o of r)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 t;for(let s=this.timestamps.length-1;s>=0;s--)if(t=this.timestamps[s],e.gte(t.from))return t;return this.timestamps[0]}absoluteEnrolledToSheetTimestamp(e){if(this.timestamps.length===0)return e;const t=this.getCurrentRepetitionTimestampTransform(e);return Fraction$1.plus(e,Fraction$1.minus(t.to,t.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,t){this.musicSheet.SelectionStart=e!=null?e:this.sheetStart,this.musicSheet.SelectionEnd=t!=null?t:this.sheetEnd}calcMapping(){this.timestamps=[];const e=this.getIterator();let t=e.CurrentRepetition,s=new TimestampTransform(e.CurrentEnrolledTimestamp.clone(),e.CurrentSourceTimestamp.clone(),void 0,0);for(this.timestamps.push(s);!e.EndReached;){if(e.JumpOccurred||t!==e.CurrentRepetition){if(t=e.CurrentRepetition,e.backJumpOccurred){const r=e.JumpResponsibleRepetition;s.nextBackJump=e.CurrentEnrolledTimestamp,s.curRepetition=r,s.curRepetitionIteration=e.CurrentJumpResponsibleRepetitionIterationBeforeJump;for(let o=this.timestamps.length-2;o>=0&&!(r.AbsoluteTimestamp.gt(this.timestamps[o].to)||this.timestamps[o].curRepetition);o--)this.timestamps[o].nextBackJump=s.nextBackJump,this.timestamps[o].curRepetition=r,this.timestamps[o].curRepetitionIteration=s.curRepetitionIteration}s=new TimestampTransform(e.CurrentEnrolledTimestamp.clone(),e.CurrentSourceTimestamp.clone(),void 0,0),this.timestamps.push(s)}e.moveToNext()}}}class TimestampTransform{constructor(e,t,s,r){this.from=e,this.to=t,this.curRepetition=s,this.curRepetitionIteration=r,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,t,s){super(e),this.musicSheet=e,this.startIndex=t,this.endIndex=s}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,t=!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=t}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 t=this.userNumberOfRepetitions-this.NumberOfEndings;for(let s=1;s<=this.userNumberOfRepetitions;s++)s<=t?this.repetitonIterationOrder.push(1):this.repetitonIterationOrder.push(s-t)}getForwardJumpTargetForIteration(e){const t=this.repetitonIterationOrder[e-1];return this.endingIndexDict[t]?this.endingIndexDict[t].part.StartIndex:-1}getBackwardJumpTarget(){return this.startMarker.measureIndex}setEndingsStartIndex(e,t){const s=new RepetitionEndingPart(new SourceMusicPart(this.musicSheet2,t,t));this.endingParts.push(s);for(const r of e)try{this.endingIndexDict[r]=s,s.endingIndices.push(r),this.numberOfEndings0&&(r=1),o.Add(new Fraction$1(r,t)),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,t=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 t=0,s=this.sourceMeasures.length;t0&&r.Voices[0].Visible&&e.push(r)}return e}}MusicSheet.defaultTitle="[no title given]";class LyricWord{constructor(){this.syllables=[]}get Syllables(){return this.syllables}containsVoiceEntry(e){for(let t=0,s=this.Syllables.length;t=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,t){var s,r;if(e){const o=e;for(let a=0,l=o.length;a0)for(let _=x;_1&&(b=parseInt(v[1],10))}catch(v){const x=ITextTranslation.translateText("ReaderErrorMessages/LyricVerseNumberError","Invalid lyric verse number");this.musicSheet.SheetErrors.pushMeasureError(x);continue}}let S;if(d==="single"||d==="end"){if(this.openLyricWords[b]){this.currentLyricWord=this.openLyricWords[b];const v=this.currentLyricWord.Syllables.length;S=new LyricsEntry(u,b,this.currentLyricWord,t,v),this.currentLyricWord.Syllables.push(S),delete this.openLyricWords[b],this.currentLyricWord=void 0}else S=new LyricsEntry(u,b,void 0,t);S.extend=c.element("extend")!==void 0}else if(d==="begin")this.openLyricWords[b]&&(delete this.openLyricWords[b],this.currentLyricWord=void 0),this.currentLyricWord=new LyricWord,this.openLyricWords[b]=this.currentLyricWord,S=new LyricsEntry(u,b,this.currentLyricWord,t,0),this.currentLyricWord.Syllables.push(S);else if(d==="middle")if(this.openLyricWords[b]){this.currentLyricWord=this.openLyricWords[b];const v=this.currentLyricWord.Syllables.length;S=new LyricsEntry(u,b,this.currentLyricWord,t,v),this.currentLyricWord.Syllables.push(S)}else S=new LyricsEntry(u,b,void 0,t);S&&(t.LyricsEntries[b]||(t.LyricsEntries.setValue(b,S),(r=(s=t.ParentSourceStaffEntry)==null?void 0:s.VerticalContainerParent)!=null&&r.ParentMeasure&&(t.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.hasLyrics=!0)),t.ParentVoice.Parent.LyricVersesNumbers[b]||t.ParentVoice.Parent.LyricVersesNumbers.push(b))}}}catch(d){const m=ITextTranslation.translateText("ReaderErrorMessages/LyricError","Error while reading lyric entry.");this.musicSheet.SheetErrors.pushMeasureError(m);continue}}t.ParentVoice.Parent.LyricVersesNumbers=t.ParentVoice.Parent.LyricVersesNumbers.filter((a,l,c)=>c.indexOf(a)===l)}}}class Articulation{constructor(e,t){this.articulationEnum=e,this.placement=t}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,t){var s,r;if(e!==void 0&&e.elements().length>0){const o=e.elements();for(let a=0,l=o.length;a0&&t.Articulations[0].articulationEnum!==ArticulationEnum.staccato&&t.Articulations.splice(0,0,b),d==="strongaccent"){const y=(r=c==null?void 0:c.attribute("type"))==null?void 0:r.value;y==="up"?b.articulationEnum=ArticulationEnum.marcatoup:y==="down"&&(b.articulationEnum=ArticulationEnum.marcatodown)}if(d==="detachedlegato"){const y=new Articulation(ArticulationEnum.staccato,u),S=new Articulation(ArticulationEnum.tenuto,u);t.Articulations.push(y,S)}if(!t.hasArticulation(b))switch(t.Articulations.push(b),b.articulationEnum){case ArticulationEnum.staccato:case ArticulationEnum.staccatissimo:t.DurationModifier=b;break;case ArticulationEnum.accent:case ArticulationEnum.strongaccent:t.VolumeModifier=b;break;default:break}}}catch(m){const u="Invalid note articulation.";loglevelExports.debug("addArticulationExpression",u,m);return}}}}addFermata(e,t){var o;let s=ArticulationEnum.fermata;e.attributes().length>0&&e.attribute("type")&&e.attribute("type").value==="inverted"&&(s=ArticulationEnum.invertedfermata);let r=PlacementEnum.Above;((o=e.attribute("placement"))==null?void 0:o.value)==="below"&&(r=PlacementEnum.Below),t.Articulations.push(new Articulation(s,r))}addTechnicalArticulations(e,t,s){var l,c;const r={bend:ArticulationEnum.bend,"down-bow":ArticulationEnum.downbow,"open-string":ArticulationEnum.naturalharmonic,"snap-pizzicato":ArticulationEnum.snappizzicato,stopped:ArticulationEnum.lefthandpizzicato,"up-bow":ArticulationEnum.upbow};for(const d in r){if(!r.hasOwnProperty(d))continue;const m=r[d],u=e.element(d);if(u){let g;((l=u.attribute("placement"))==null?void 0:l.value)==="above"&&(g=PlacementEnum.Above),((c=u.attribute("placement"))==null?void 0:c.value)==="below"&&(g=PlacementEnum.Below);const b=new Articulation(m,g);t.hasArticulation(b)||t.Articulations.push(b)}}const o=e.element("fingering");if(o){const d=this.createTechnicalInstruction(o,s);d.type=TechnicalInstructionType.Fingering,s.Fingering=d,t.TechnicalInstructions.push(d)}const a=e.element("string");if(a){const d=this.createTechnicalInstruction(a,s);d.type=TechnicalInstructionType.String,s.StringInstruction=d,t.TechnicalInstructions.push(d)}}createTechnicalInstruction(e,t){const s=new TechnicalInstruction;s.sourceNote=t,s.value=e.value;const r=e.attribute("placement");return this.rules.FingeringPositionFromXML&&(s.placement=this.getPlacement(r)),s}getPlacement(e,t=PlacementEnum.NotYetDefined){if(t!==PlacementEnum.NotYetDefined)return t;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,t){if(e){let s;const r={"delayed-inverted-turn":OrnamentEnum.DelayedInvertedTurn,"delayed-turn":OrnamentEnum.DelayedTurn,"inverted-mordent":OrnamentEnum.InvertedMordent,"inverted-turn":OrnamentEnum.InvertedTurn,mordent:OrnamentEnum.Mordent,"trill-mark":OrnamentEnum.Trill,turn:OrnamentEnum.Turn};for(const o in r){if(!r.hasOwnProperty(o))continue;const a=e.element(o);if(a){s=new OrnamentContainer(r[o]);const l=a.attribute("placement");l&&l.value==="below"&&(s.placement=PlacementEnum.Below)}}if(s){const o=e.elements("accidental-mark");if(o){let a=PlacementEnum.Below,l=AccidentalEnum.NONE;const c=o;for(let d=0,m=c.length;d0&&(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,t,s,r,o,a,l,c,d,m,u,g,b,y,S,v,x,A,E,_,w,C,P){this.currentStaffEntry=l,this.currentMeasure=c;try{this.currentNote=a?this.addRestNote(e.element("rest"),t,r,o,b,y,E):this.addSingleNote(e,t,r,s,o,u,g,b,y,S,v,x,A,E,w,C,P),this.currentNote.DotsXml=_;const I=e.elements("lyric");this.lyricsReader!==void 0&&I&&(this.lyricsReader.addLyricEntry(I,this.currentVoiceEntry),this.voice.Parent.HasLyrics=!0);let N=!1;const R=e.element("notations");if(R){this.articulationReader&&this.readArticulations(R,this.currentVoiceEntry,this.currentNote);const F=R.elements("slur");this.slurReader!==void 0&&F.length>0&&!this.currentNote.ParentVoiceEntry.IsGrace&&this.slurReader.addSlur(F,this.currentNote);const B=R.elements("tuplet");B.length>0&&(this.openTupletNumber=this.addTuplet(e,B),N=!0);const k=R.element("arpeggiate");if(k!==void 0){let $;if(this.currentVoiceEntry.Arpeggio)$=this.currentVoiceEntry.Arpeggio;else{let re=!1;for(const ie of this.currentStaffEntry.VoiceEntries)if(ie.Arpeggio){re=!0,$=ie.Arpeggio;break}if(!re){let ie=ArpeggioType.ARPEGGIO_DIRECTIONLESS;const de=k.attribute("direction");if(de)switch(de.value){case"up":ie=ArpeggioType.ROLL_UP;break;case"down":ie=ArpeggioType.ROLL_DOWN;break;default:ie=ArpeggioType.ARPEGGIO_DIRECTIONLESS}$=new Arpeggio(this.currentVoiceEntry,ie),this.currentVoiceEntry.Arpeggio=$}}$.addNote(this.currentNote)}const M=R.elements("tied");M.length>0&&this.addTie(M,d,m,TieTypes.SIMPLE);const G=R.elements("slide");G.length>0&&this.addTie(G,d,m,TieTypes.SLIDE);const ee=R.element("technical");if(ee){const $=ee.elements("hammer-on");$.length>0&&this.addTie($,d,m,TieTypes.HAMMERON);const re=ee.elements("pull-off");re.length>0&&this.addTie(re,d,m,TieTypes.PULLOFF)}}e.element("time-modification")!==void 0&&!N&&this.handleTimeModificationNode(e)}catch(I){loglevelExports.warn(I);const N=ITextTranslation.translateText("ReaderErrorMessages/NoteError","Ignored erroneous Note.");this.musicSheet.SheetErrors.pushMeasureError(N),this.musicSheet.SheetErrors.pushMeasureError(I)}return this.currentNote}checkForStaffEntryLink(e,t,s,r){const o=new StaffEntryLink(this.currentVoiceEntry);o.LinkStaffEntries.push(s),s.Link=o;const a=this.currentVoiceEntry.Timestamp.clone(),l=r.getVerticalContainerByTimestamp(a);return s=l.StaffEntries[e],s||(s=new SourceStaffEntry(l,t),l.StaffEntries[e]=s),s.VoiceEntries.push(this.currentVoiceEntry),o.LinkStaffEntries.push(s),s.Link=o,s}checkForOpenBeam(){this.openBeams.length>0&&this.currentNote&&this.handleOpenBeam()}checkOpenTies(){const e=this.openTieDict;for(const t in e)if(e.hasOwnProperty(t)){const s=e[t];Fraction$1.plus(s.StartNote.ParentStaffEntry.Timestamp,s.Duration).lt(s.StartNote.SourceMeasure.Duration)&&delete e[t]}}hasVoiceEntry(){return this.currentVoiceEntry!==void 0}readArticulations(e,t,s){const r=e.element("articulations");r&&this.articulationReader.addArticulationExpression(r,t);const o=e.element("fermata");o&&this.articulationReader.addFermata(o,t);const a=e.element("technical");a&&this.articulationReader.addTechnicalArticulations(a,t,s);const l=e.element("ornaments");l&&this.articulationReader.addOrnament(l,t)}addSingleNote(e,t,s,r,o,a,l,c,d,m,u,g,b,y,S,v,x){let A=0,E,_=AccidentalEnum.NONE,w=NoteEnum.C,C=NoteEnum.C,P=0,I=0,N,R,F;const B=e.elements();for(let de=0,Q=B.length;de0&&this.openBeams.last().ExtendedNoteList.push(y),y}addNoteInfo(e,t,s,r,o,a,l,c,d){e.NoteTypeXml=t,e.PrintObject=s,e.IsCueNote=r,e.NormalNotes=o,e.displayStepUnpitched=a,e.displayOctaveUnpitched=l,e.NoteheadColorXml=c,e.NoteheadColor=c}createBeam(e,t){var s;try{const r=e.element("beam");let o;if(r!==void 0&&r.hasAttributes&&(o=r.attribute("number")),o){let a=parseInt(o.value,10);const l=e.elements("beam"),c=l[0].value;l&&(c==="begin"?(a===((s=this.openBeams.last())==null?void 0:s.BeamNumber)?(this.beamNumberOffset++,a+=this.beamNumberOffset):this.openBeams.last()&&this.handleOpenBeam(),this.openBeams.push(new Beam(a,this.beamNumberOffset))):a+=this.beamNumberOffset);let d=!1;if(!(a>0&&a<=this.openBeams.length)||!this.openBeams[a-1]){loglevelExports.debug("[OSMD] invalid beamnumber");return}for(let m=0,u=this.openBeams[a-1].Notes.length;m1){let r=e.element("time-modification");r&&(r=r.element("actual-notes"));const o=t;for(let a=0,l=o.length;a1&&this.openTupletNumber--),this.tupletDict[u]=b;const S=[];S.push(this.currentNote),b.Notes.push(S),b.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=b,this.openTupletNumber=u}else if(m.value==="stop"){let u=1;c.attribute("number")&&(u=parseInt(c.attribute("number").value,10));const g=this.tupletDict[u];if(g){const b=c.attribute("placement");b&&(b.value==="below"?g.tupletLabelNumberPlacement=PlacementEnum.Below:g.tupletLabelNumberPlacement=PlacementEnum.Above,g.PlacementFromXml=!0);const y=[];if(y.push(this.currentNote),g.Notes.push(y),!g.PlacementFromXml){let S=!1;for(const v of g.Notes){for(const x of v)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[u],Object.keys(this.tupletDict).length===0?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--}}}}}else if(t[0]){const r=t[0];if(r.hasAttributes){const o=r.attribute("type").value;let a=1;r.attribute("number")&&(a=parseInt(r.attribute("number").value,10));const l=isNaN(a),c=r.attribute("bracket");if(c&&c.value==="yes"&&(s=!0),o==="start"){let d=0,m=e.element("time-modification");if(m&&(m=m.element("actual-notes")),m&&(d=parseInt(m.value,10),isNaN(d))){const y=ITextTranslation.translateText("ReaderErrorMessages/TupletNoteDurationError","Invalid tuplet note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(y),new MusicSheetReadingException(y)}l&&(this.openTupletNumber++,a=this.openTupletNumber);let u=this.tupletDict[a];u||(u=this.tupletDict[a]=new Tuplet(d,s),u.tupletLabelNumberPlacement=PlacementEnum.Above);const g=r.attribute("placement");g&&(g.value==="below"?u.tupletLabelNumberPlacement=PlacementEnum.Below:u.tupletLabelNumberPlacement=PlacementEnum.Above,u.PlacementFromXml=!0);const b=[];b.push(this.currentNote),u.Notes.push(b),u.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=u,this.openTupletNumber=a}else if(o==="stop"){l&&(a=this.openTupletNumber);const d=this.tupletDict[this.openTupletNumber];if(d){const m=r.attribute("placement");m&&(m.value==="below"?d.tupletLabelNumberPlacement=PlacementEnum.Below:d.tupletLabelNumberPlacement=PlacementEnum.Above,d.PlacementFromXml=!0);const u=[];if(u.push(this.currentNote),d.Notes.push(u),!d.PlacementFromXml){let g=!1;for(const b of d.Notes){for(const y of b)if(!y.isRest()){y.StemDirectionXml===StemDirectionType.Down?d.tupletLabelNumberPlacement=PlacementEnum.Below:d.tupletLabelNumberPlacement=PlacementEnum.Above,g=!0;break}if(g)break}}d.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=d,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 t=this.tupletDict[this.openTupletNumber],s=CollectionUtil.last(t.Notes),r=s[0].ParentVoiceEntry;let o;r.Timestamp.Equals(this.currentVoiceEntry.Timestamp)?o=s:(o=[],t.Notes.push(o),t.Fractions.push(this.getTupletNoteDurationFromType(e))),o.push(this.currentNote),this.currentNote.NoteTuplet=t}catch(t){const s=ITextTranslation.translateText("ReaderErrorMessages/TupletNumberError","Invalid tuplet number.");throw this.musicSheet.SheetErrors.pushMeasureError(s),t}else if(this.currentVoiceEntry.Notes.length>0){const t=this.currentVoiceEntry.Notes[0];if(t.NoteTuplet){const s=t.NoteTuplet;CollectionUtil.last(s.Notes).push(this.currentNote),this.currentNote.NoteTuplet=s}}}addTie(e,t,s,r){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 d=this.getNextAvailableNumberForTie(),m=new Tie(this.currentNote,r);this.openTieDict[d]=m,m.TieNumber=d,m.TieDirection=a}else if(l==="stop"){const c=this.findCurrentNoteInTieDict(this.currentNote),d=this.openTieDict[c];d&&(d.AddNote(this.currentNote),delete this.openTieDict[c])}}catch(c){const d=ITextTranslation.translateText("ReaderErrorMessages/TieError","Error while reading tie.");this.musicSheet.SheetErrors.pushMeasureError(d)}}}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 d=this.getTieDirection(l);a.NoteIndexToTieDirection[a.Notes.length-1]=d}}}}}getTieDirection(e){let t=PlacementEnum.NotYetDefined;const s=e.attribute("placement");s&&(s.value==="above"?t=PlacementEnum.Above:s.value==="below"&&(t=PlacementEnum.Below));const r=e.attribute("orientation");return r&&(r.value==="over"?t=PlacementEnum.Above:r.value==="under"&&(t=PlacementEnum.Below)),t}getNextAvailableNumberForTie(){const e=Object.keys(this.openTieDict);if(e.length===0)return 1;e.sort((t,s)=>+t-+s);for(let t=0;t0?r.RealValue>0?(d=Fraction$1.multiply(Fraction$1.minus(r,o),d),this.directionTimestamp=Fraction$1.plus(d,r)):this.directionTimestamp=Fraction$1.createFromFraction(d):this.offsetDivisions<0&&(r.RealValue>0?(d=Fraction$1.multiply(Fraction$1.minus(r,o),d),this.directionTimestamp=Fraction$1.minus(r,d)):this.directionTimestamp=Fraction$1.createFromFraction(d));const m=e.attribute("placement");if(m)try{const u=m.value;u==="below"?this.placement=PlacementEnum.Below:u==="above"&&(this.placement=PlacementEnum.Above)}catch(u){const g=ITextTranslation.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");loglevelExports.debug("ExpressionReader.readExpressionParameters",g,u),this.musicSheet.SheetErrors.pushMeasureError(g),this.placement=PlacementEnum.Below}if(this.placement===PlacementEnum.NotYetDefined)try{const u=e.element("direction-type");if(u){const g=u.element("dynamics");if(g){const v=g.attribute("default-y");v&&this.readExpressionPlacement(v,"read dynamics y pos")}const b=u.element("wedge");if(b){const v=b.attribute("default-y");v&&this.readExpressionPlacement(v,"read wedge y pos")}const y=u.element("words");if(y){const v=y.attribute("default-y");v&&this.readExpressionPlacement(v,"read words y pos")}const S=u.element("rehearsal");if(S){const v=S.attribute("default-y");v&&this.readExpressionPlacement(v,"read rehearsal pos")}}}catch(u){const g=ITextTranslation.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");loglevelExports.debug("ExpressionReader.readExpressionParameters",g,u),this.musicSheet.SheetErrors.pushMeasureError(g),this.placement=PlacementEnum.Below}this.placement===PlacementEnum.NotYetDefined&&(t.Staves.length>1?this.placement=PlacementEnum.Below:t.HasLyrics?this.placement=PlacementEnum.Above:this.placement=PlacementEnum.Below)}read(e,t,s,r=void 0,o=0){let a=!1,l=!1;const c=e.element("sound");if(c){const u=c.attribute("tempo"),g=c.attribute("dynamics");if(u){const b=u.value.match(/^(\d+)(\.\d+)?$/);(b==null?void 0:b.length)>0?this.soundTempo=Math.round(Number.parseFloat(u.value)):(loglevelExports.info("invalid xml tempo: "+u.value),this.soundTempo=100),t.TempoInBPM=this.soundTempo,this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,a=!0}if(g){const b=g.value.match(/\d+/);this.soundDynamic=b!==void 0?parseInt(b[0],10):100,l=!0}}const d=e.element("direction-type");if(!d)return;let m=d.element("metronome");if(m){t.metronomeNoteIndex=o;const u=m.element("beat-unit"),g=m.element("beat-unit-dot")!==void 0,b=m.element("per-minute");if(u!==void 0&&b){m.hasAttributes&&m.attribute("default-x")!==void 0&&(this.directionTimestamp=Fraction$1.createFromFraction(s));const S=parseFloat(b.value);this.createNewTempoExpressionIfNeeded(t);const v=new InstantaneousTempoExpression(void 0,this.placement,this.staffNumber,S,this.currentMultiTempoExpression,!0);v.parentMeasure=t,this.soundTempo=S,t.TempoInBPM=this.soundTempo*(g?1.5:1),this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),t.MeasureNumberXML===1&&this.musicSheet.SourceMeasures.length===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,v.dotted=g,v.beatUnit=u.value,this.currentMultiTempoExpression.addExpression(v,""),this.currentMultiTempoExpression.CombinedExpressionsText="test"}return}if(m=d.element("dynamics"),m){const u=e.element("notations")!==void 0;this.interpretInstantaneousDynamics(m,t,s,u);return}if(m=d.element("words"),m){const u=d.elements("words");let g="";for(const b of u)g+=b.value;if(m.value=g,a||isSpeedKeyword(m.value)||isSpeedHiddenKeyword(m.value)){this.createNewTempoExpressionIfNeeded(t),this.currentMultiTempoExpression.CombinedExpressionsText=m.value,(isSpeedKeyword(m.value)||isSpeedHiddenKeyword(m.value))&&(m.value=void 0);const b=new InstantaneousTempoExpression(m.value,this.placement,this.staffNumber,this.soundTempo,this.currentMultiTempoExpression);this.currentMultiTempoExpression.addExpression(b,"")}else l||this.interpretWords(m,t,s);return}if(m=d.element("wedge"),m){this.interpretWedge(m,t,r,t.MeasureNumber);return}if(m=d.element("rehearsal"),m){this.interpretRehearsalMark(m,t,s,t.MeasureNumber);return}}closeOpenExpressions(e,t){for(const s of this.openContinuousDynamicExpressions)this.createNewMultiExpressionIfNeeded(e,s.NumberXml,t),this.closeOpenContinuousDynamic(s,e,t);this.openContinuousTempoExpression&&this.closeOpenContinuousTempo(Fraction$1.plus(e.AbsoluteTimestamp,t))}addOctaveShift(e,t,s){var l;let r=1;const o=e.element("staff");if(o)try{r=parseInt(o.value,10)}catch(c){const d=ITextTranslation.translateText("ReaderErrorMessages/OctaveShiftStaffError","Invalid octave shift staff number -> set to default");this.musicSheet.SheetErrors.pushMeasureError(d),r=1,loglevelExports.debug("ExpressionReader.addOctaveShift",d,c)}const a=e.element("direction-type");if(a){const c=a.element("octave-shift"),d=this.readPlacement(e);if(c!==void 0&&c.hasAttributes)try{const m=this.readNumber(c);if(c.attribute("size")){const u=parseInt(c.attribute("size").value,10);let g=0;u===8?g=1:u===15&&(g=2);let b=(l=c.attribute("type"))==null?void 0:l.value;if(b||(d===PlacementEnum.Above?b="down":d===PlacementEnum.Below&&(b="up")),b==="up"||b==="down"){const y=new OctaveShift(b,g);y.StaffNumber=r,this.getMultiExpression=this.createNewMultiExpressionIfNeeded(t,m),this.getMultiExpression.OctaveShiftStart=y,y.ParentStartMultiExpression=this.getMultiExpression,this.openOctaveShift=y}else if(b==="stop"){if(this.openOctaveShift){this.getMultiExpression=this.createNewMultiExpressionIfNeeded(t,this.openOctaveShift.numberXml,s);const y=this.getMultiExpression;y.OctaveShiftEnd=this.openOctaveShift,this.openOctaveShift.ParentEndMultiExpression=this.getMultiExpression,this.openOctaveShift=void 0}}else b||loglevelExports.debug("octave-shift missing type in xml")}}catch(m){const u=ITextTranslation.translateText("ReaderErrorMessages/OctaveShiftError","Error while reading octave shift.");this.musicSheet.SheetErrors.pushMeasureError(u),loglevelExports.debug("ExpressionReader.addOctaveShift",u,m)}}}addPedalMarking(e,t,s){var o,a,l,c;const r=e.element("direction-type");if(r){const d=r.element("pedal");if(d!==void 0&&d.hasAttributes){let m=!1,u=!1;try{switch(((o=d.attribute("line"))==null?void 0:o.value)==="yes"?u=!0:((a=d.attribute("line"))==null?void 0:a.value)==="no"&&(u=!1,m=!0),((l=d.attribute("sign"))==null?void 0:l.value)==="yes"?m=!0:((c=d.attribute("sign"))==null?void 0:c.value)==="no"&&(m=!1,u=!0),d.attribute("type").value){case"start":this.openPedal&&this.openPedal.IsLine&&this.endOpenPedal(t),this.createNewMultiExpressionIfNeeded(t,-1),this.openPedal=new Pedal(u,m),this.getMultiExpression.PedalStart=this.openPedal,this.openPedal.ParentStartMultiExpression=this.getMultiExpression;break;case"stop":this.openPedal&&this.endOpenPedal(t);break;case"change":this.openPedal&&this.openPedal.IsLine&&(this.openPedal.ChangeEnd=!0,this.createNewMultiExpressionIfNeeded(t,-1),this.getMultiExpression.PedalEnd=this.openPedal,this.openPedal.ParentEndMultiExpression=this.getMultiExpression,this.createNewMultiExpressionIfNeeded(t,-1),this.openPedal=new Pedal(u,m),this.openPedal.ChangeBegin=!0,this.getMultiExpression.PedalStart=this.openPedal,this.openPedal.ParentStartMultiExpression=this.getMultiExpression);break;case"continue":break;default:break}}catch(g){const b=ITextTranslation.translateText("ReaderErrorMessages/PedalError","Error while reading pedal.");this.musicSheet.SheetErrors.pushMeasureError(b),loglevelExports.debug("ExpressionReader.addPedalMarking",b,g)}}}}endOpenPedal(e){this.createNewMultiExpressionIfNeeded(e,-1),this.getMultiExpression.PedalEnd=this.openPedal,this.openPedal.ParentEndMultiExpression=this.getMultiExpression,this.openPedal=void 0}addWavyLine(e,t,s,r){if(e&&e.hasAttributes)try{switch(e.attribute("type").value){case"start":this.createNewMultiExpressionIfNeeded(t,-1),this.openWavyLine=new WavyLine(this.placement),this.getMultiExpression.WavyLineStart=this.openWavyLine,this.openWavyLine.ParentStartMultiExpression=this.getMultiExpression;break;case"stop":this.openWavyLine&&(this.createNewMultiExpressionIfNeeded(t,-1,s),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 s;const t=(s=e.attribute("placement"))==null?void 0:s.value;return t==="above"?PlacementEnum.Above:t==="below"?PlacementEnum.Below:PlacementEnum.NotYetDefined}readExpressionPlacement(e,t){try{const s=parseInt(e.value,10);s<0?this.placement=PlacementEnum.Below:s>0&&(this.placement=PlacementEnum.Above)}catch(s){loglevelExports.debug("ExpressionReader.readExpressionParameters",t,s)}}interpretInstantaneousDynamics(e,t,s,r){if(e.hasElements){e.hasAttributes&&e.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(s));const o=this.readNumber(e);let a=e.elements()[0].name;if(a==="other-dynamics"&&(a=e.elements()[0].value),a){r?this.createNewMultiExpressionIfNeeded(t,o,Fraction$1.createFromFraction(s)):this.createNewMultiExpressionIfNeeded(t,o);const l=new InstantaneousDynamicExpression(a,this.soundDynamic,this.placement,this.staffNumber,t);l.InMeasureTimestamp=s.clone(),this.getMultiExpression.addExpression(l,""),this.initialize(),this.activeInstantaneousDynamic?this.activeInstantaneousDynamic.DynEnum=l.DynEnum:this.activeInstantaneousDynamic=new InstantaneousDynamicExpression(a,0,PlacementEnum.NotYetDefined,1,t)}}}interpretWords(e,t,s){const r=e.value;let o;const a=e.attribute("font-style");if(a&&a.value==="italic"&&(o=FontStyles.Italic),r.length>0){if(e.hasAttributes&&e.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(s)),this.checkIfWordsNodeIsRepetitionInstruction(r))return;this.fillMultiOrTempoExpression(r,t,s,o),this.initialize()}}readNumber(e){var r;let t=1;const s=(r=e.attribute("number"))==null?void 0:r.value;return s&&(t=Number.parseInt(s,10)),t}interpretWedge(e,t,s,r){var a,l;e!==void 0&&e.hasAttributes&&e.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(s));const o=this.readNumber(e);((l=(a=e.attribute("type"))==null?void 0:a.value)==null?void 0:l.toLowerCase())==="stop"?this.createNewMultiExpressionIfNeeded(t,o,s):this.createNewMultiExpressionIfNeeded(t,o),this.addWedge(e,t,s),this.initialize()}interpretRehearsalMark(e,t,s,r){t.rehearsalExpression=new RehearsalExpression(e.value,this.placement)}createNewMultiExpressionIfNeeded(e,t,s=void 0){s||(s=this.directionTimestamp);let r=this.getMultiExpression;return(!r||r&&(r.SourceMeasureParent!==e||r.numberXml!==t||r.SourceMeasureParent===e&&r.Timestamp!==s))&&(this.getMultiExpression=r=new MultiExpression(e,Fraction$1.createFromFraction(s)),e.StaffLinkedExpressions[this.globalStaffIndex].push(r)),r}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,t,s){if(e!==void 0&&e.hasAttributes){const r=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,t,this.activeInstantaneousDynamic,r);this.openContinuousDynamicExpressions.push(a);let l=this.getMultiExpression;l||(l=this.createNewMultiExpressionIfNeeded(t,r)),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===r&&a.NumberXml===r&&this.closeOpenContinuousDynamic(a,t,s)}catch(a){const l="ReaderErrorMessages/WedgeError, Error while reading Crescendo / Diminuendo.";this.musicSheet.SheetErrors.pushMeasureError(l),loglevelExports.debug("ExpressionReader.addWedge",l,a)}}}fillMultiOrTempoExpression(e,t,s,r){if(!e)return;const o=e.trim();this.createExpressionFromString("",o,t,s,e,r)}createExpressionFromString(e,t,s,r,o,a){if(InstantaneousTempoExpression.isInputStringInstantaneousTempo(t)||ContinuousTempoExpression.isInputStringContinuousTempo(t)){if(s.TempoExpressions.length>0)for(let m=0,u=s.TempoExpressions.length;m0)for(let m=0,u=s.TempoExpressions.length;m0&&!this.hasDigit(t)&&this.globalStaffIndex>0){if(g.EntriesList[0].label.indexOf(t)>=0)return!1;break}}let c=TextAlignmentEnum.CenterBottom;this.musicSheet.Rules.CompactMode&&(c=TextAlignmentEnum.LeftBottom);const d=new UnknownExpression(t,this.placement,c,this.staffNumber);return d.fontStyle=a,l.addExpression(d,e),!1}closeOpenContinuousDynamic(e,t,s){if(!e)return;const r=e.NumberXml;e.EndMultiExpression=this.createNewMultiExpressionIfNeeded(t,r,s),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,t=this.startNote.NoteSlurs.length;e0){const r=s.attribute("type").value;let o=1;try{s.attribute("number")&&(o=parseInt(s.attribute("number").value,10))}catch(d){loglevelExports.debug("VoiceGenerator.addSlur number: ",d)}let a=PlacementEnum.NotYetDefined;const l=s.attribute("placement");l&&l.value&&(l.value==="above"?a=PlacementEnum.Above:l.value==="below"&&(a=PlacementEnum.Below));const c=s.attribute("orientation");if(c&&c.value&&(c.value==="over"?a=PlacementEnum.Above:c.value==="under"&&(a=PlacementEnum.Below)),r==="start"){let d=this.openSlurDict[o];d||(d=new Slur,this.openSlurDict[o]=d),d.StartNote=t,d.PlacementXml=a}else if(r==="stop"){const d=this.openSlurDict[o];d&&(d.EndNote=t,t.checkForDoubleSlur(d)||(t.NoteSlurs.push(d),d.StartNote.NoteSlurs.push(d)),delete this.openSlurDict[o])}}}}catch(s){const r=ITextTranslation.translateText("ReaderErrorMessages/SlurError","Error while reading slur.");this.musicSheet.SheetErrors.pushMeasureError(r)}}}class InstrumentReader{constructor(e,t,s,r){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=t,this.xmlMeasureList=s,this.musicSheet=r.GetMusicSheet,this.instrument=r,this.activeClefs=new Array(r.Staves.length),this.activeClefsHaveBeenInitialized=new Array(r.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 r=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 E=this.xmlMeasureList[this.currentXmlMeasureIndex],_=E.elements();if(e.Rules.UseXMLMeasureNumbers&&!Number.isInteger(e.MeasureNumberXML)){const C=parseInt((d=E.attribute("number"))==null?void 0:d.value,10);Number.isInteger(C)&&(e.MeasureNumberXML=C)}let w;for(let C=0;C<_.length;C++){const P=_[C];if(C>0&&(w=_[C-1]),P.name==="print"){const I=P.attribute("new-system");(I==null?void 0:I.value)==="yes"&&(e.printNewSystemXml=!0);const N=P.attribute("new-page");(N==null?void 0:N.value)==="yes"&&(e.printNewPageXml=!0)}else if(P.name==="note"){P.element("grace")||(this.xmlNotes.push(P),c.push(P));let I=!0;((m=P.attribute("print-object"))==null?void 0:m.value)==="no"&&(I=!1);let N=1;this.instrument.Staves.length>1&&P.element("staff")&&(N=parseInt(P.element("staff").value,10),isNaN(N)&&(loglevelExports.debug("InstrumentReader.readNextXmlMeasure.get staff number"),N=1)),this.currentStaff=this.instrument.Staves[N-1];const R=P.element("chord")!==void 0;if(P.element("voice")){const U=parseInt(P.element("voice").value,10);this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(U,N-1)}else(!R||!this.currentVoiceGenerator)&&(this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(1,N-1));let F=0,B=new Fraction$1(0,1),k=2,M,G=!1;if(P.element("duration")){if(F=parseInt(P.element("duration").value,10),isNaN(F)){const U=ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError","Invalid Note Duration.");this.musicSheet.SheetErrors.pushMeasureError(U),loglevelExports.debug("InstrumentReader.readNextXmlMeasure",U);continue}else if(B=new Fraction$1(F,4*this.divisions),F===0?B=this.getNoteDurationFromTypeNode(P):M=this.getNoteDurationFromTypeNode(P),P.element("time-modification")){B=this.getNoteDurationForTuplet(P);const U=P.element("time-modification");U!=null&&U.element("normal-notes")&&(k=parseInt(U.element("normal-notes").value,10)),G=!0}}const ee=P.element("rest")!==void 0,$=P.element("notations"),re=P.element("grace")!==void 0||F===0||R&&l;let ie=!1,de=!1;if(re){const U=P.element("duration"),se=P.element("grace");se&&se.attributes()&&se.attribute("slash")&&se.attribute("slash").value==="yes"&&(ie=!0),U||(B=this.getNoteDurationFromTypeNode(P));const te=P.element("notations");te&&te.element("slur")&&(de=!0)}let Q=!1;P.element("cue")&&(Q=!0);const ue=P.element("type");let ne=NoteType.UNDEFINED;if(ue){const U=ue.attribute("size");(U==null?void 0:U.value)==="cue"&&(Q=!0),ne=NoteTypeHandler.StringToNoteType(ue.value)}let W=StemDirectionType.Undefined,oe;const he=P.element("stem");if(he){switch(he.value){case"down":W=StemDirectionType.Down;break;case"up":W=StemDirectionType.Up;break;case"double":W=StemDirectionType.Double;break;case"none":W=StemDirectionType.None;break;default:W=StemDirectionType.Undefined}const U=he.attribute("color");U&&(oe=this.parseXmlColor(U.value))}let le=0,me="",Ae="",be="";if($){const U=$.element("ornaments");if(U){const fe=U.element("tremolo");if(fe){const ye=fe.attribute("type");if(me=ye.value,ye){const ve=parseInt(fe.value,10);ve>0&&(le=ve),(ye.value==="start"||ye.value==="stop")&&(B=new Fraction$1(parseInt(P.element("duration").value,10),4*this.divisions))}}const pe=U.elements("wavy-line");if(pe!==void 0)for(const ye of pe){const ve=this.expressionReaders[this.readExpressionStaffNumber(P)-1];ve&&(ve.readExpressionParameters(ye,this.instrument,this.divisions,r,o,this.currentMeasure.MeasureNumber,!1),ve.addWavyLine(ye,this.currentMeasure,r,o))}}$.elements("glissando").find(fe=>fe.attribute("type").value==="start")&&(Ae="start"),$.elements("slide").find(fe=>fe.attribute("type").value==="start")&&(be="start")}let z;const J=P.element("notehead");if(J){const U=J.attribute("color");U&&(z=this.parseXmlColor(U.value))}let T;const q=P.attribute("color");q&&(T=this.parseXmlColor(q.value),z||(z=T),oe||(oe=T));let Y=r.clone();R&&(Y=o.clone()),this.currentStaffEntry=this.currentMeasure.findOrCreateStaffEntry(Y,this.inSourceMeasureInstrumentIndex+N-1,this.currentStaff).staffEntry,(!this.currentVoiceGenerator.hasVoiceEntry()||!R&&!re&&!l||re&&!l||re&&!R||!re&&l)&&this.currentVoiceGenerator.createVoiceEntry(Y,this.currentStaffEntry,this.activeKey,this.ActiveRhythm,re,ie,de),!re&&!R&&(o=r.clone(),r.Add(B)),R&&this.currentStaffEntry!==void 0&&this.currentStaffEntry.ParentStaff!==this.currentStaff&&(this.currentStaffEntry=this.currentVoiceGenerator.checkForStaffEntryLink(this.inSourceMeasureInstrumentIndex+N-1,this.currentStaff,this.currentStaffEntry,this.currentMeasure));const O=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,O),this.openChordSymbolContainers.length!==0&&(this.currentStaffEntry.ChordContainers=this.openChordSymbolContainers,this.openChordSymbolContainers=[]),this.activeRhythm,!G&&!re&&(B=new Fraction$1(F,4*this.divisions));const V=P.elements("dot").length;if(this.currentVoiceGenerator.read(P,B,M,ne,k,ee,this.currentStaffEntry,this.currentMeasure,t,this.maxTieNoteFraction,R,s,I,Q,re,W,le,oe,z,V,me,Ae,be),$!==void 0&&$.element("dynamics")){const U=this.expressionReaders[this.readExpressionStaffNumber(P)-1];U&&(U.readExpressionParameters(P,this.instrument,this.divisions,r,o,this.currentMeasure.MeasureNumber,!1),U.read(P,this.currentMeasure,o,void 0,c.length))}l=re}else if(P.name==="attributes"){const I=P.element("divisions");if(I&&(this.divisions=parseInt(I.value,10),isNaN(this.divisions))){const F=ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(loglevelExports.debug("InstrumentReader.readNextXmlMeasure",F),this.divisions=this.readDivisionsFromNotes(),this.divisions>0)this.musicSheet.SheetErrors.push(F+this.instrument.Name);else throw a=!0,new MusicSheetReadingException(F+this.instrument.Name)}if(!P.element("divisions")&&this.divisions===0&&this.currentXmlMeasureIndex===0){const F=ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(this.divisions=this.readDivisionsFromNotes(),this.divisions>0)this.musicSheet.SheetErrors.push(F+this.instrument.Name);else throw a=!0,new MusicSheetReadingException(F+this.instrument.Name)}this.addAbstractInstruction(P,s,w,r.clone()),r.Equals(new Fraction$1(0,1))&&this.isAttributesNodeAtBeginOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],P)&&this.saveAbstractInstructionList(this.instrument.Staves.length,!0),this.isAttributesNodeAtEndOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],P)&&this.saveClefInstructionAtEndOfMeasure();const N=P.elements("staff-details");for(const F of N){const B=F.element("staff-lines");if(B){let k=1;const M=F.attribute("number");M&&(k=parseInt(M.value,10)),this.instrument.Staves[k-1].StafflineCount=parseInt(B.value,10)}}const R=P.element("measure-style");if(R){const F=R.element("multiple-rest");if(F){const B=F.value;let k=0;try{k=Number.parseInt(B,10),e.multipleRestMeasures!==void 0&&k!==e.multipleRestMeasures?e.multipleRestMeasures=0:(e.multipleRestMeasures=k,this.currentMultirestStartMeasure=e,this.followingMultirestMeasures=k+1)}catch(M){console.log("multirest parse error: "+M)}}}}else if(P.name==="forward"){const I=parseInt(P.element("duration").value,10);r.Add(new Fraction$1(I,4*this.divisions))}else if(P.name==="backup"){const I=parseInt(P.element("duration").value,10);r.Sub(new Fraction$1(I,4*this.divisions)),r.IsNegative()&&(r=new Fraction$1(0,1)),o.Sub(new Fraction$1(I,4*this.divisions)),o.IsNegative()&&(o=new Fraction$1(0,1))}else if(P.name==="direction"){const I=P.elements("direction-type"),N=P.element("direction-type");let R=Math.min(1,r.RealValue);this.activeRhythm!==void 0&&this.activeRhythm.Rhythm&&(R/=this.activeRhythm.Rhythm.RealValue);let F=!1;if(this.repetitionInstructionReader&&(F=this.repetitionInstructionReader.handleRepetitionInstructionsFromWordsOrSymbols(N,R)),!F){let B=this.expressionReaders[0];const k=this.readExpressionStaffNumber(P)-1;if(kee==null?void 0:ee.toLocaleLowerCase()).includes((u=M.value)==null?void 0:u.toLocaleLowerCase())&&(this.currentGradualChangeMeasure=this.currentMeasure,this.currentMeasure.speedInfo={startWord:(g=M.value)==null?void 0:g.toLocaleLowerCase(),startXmlNoteIndex:c.length,endXmlNoteIndex:0,resetXmlNoteIndex:0,startMeasureListIndex:this.currentXmlMeasureIndex,endMeasureListIndex:0,resetMeasureListIndex:0},this.xmlNotes=[]),M.value.startsWith(GRADIENT_SPEED_CLOSE_TAG)&&((b=this.currentGradualChangeMeasure)!=null&&b.speedInfo)&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:this.xmlNotes.length,endMeasureListIndex:this.currentXmlMeasureIndex}),((y=M.value)==null?void 0:y.toLocaleLowerCase())==="a tempo".toLocaleLowerCase()&&((S=this.currentGradualChangeMeasure)!=null&&S.speedInfo))){const{endXmlNoteIndex:ee,resetXmlNoteIndex:$,endMeasureListIndex:re}=this.currentGradualChangeMeasure.speedInfo;$===0&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:ee||this.xmlNotes.length,endMeasureListIndex:re||this.currentXmlMeasureIndex,resetXmlNoteIndex:this.xmlNotes.length,resetMeasureListIndex:this.currentXmlMeasureIndex}),this.xmlNotes=[]}if(I.find(G=>G.element("metronome"))&&((v=this.currentGradualChangeMeasure)!=null&&v.speedInfo)){const{endXmlNoteIndex:G,resetXmlNoteIndex:ee,endMeasureListIndex:$}=this.currentGradualChangeMeasure.speedInfo;ee===0&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:G||this.xmlNotes.length,endMeasureListIndex:$||this.currentXmlMeasureIndex,resetXmlNoteIndex:this.xmlNotes.length,resetMeasureListIndex:this.currentXmlMeasureIndex}),this.xmlNotes=[]}B.readExpressionParameters(P,this.instrument,this.divisions,r,o,this.currentMeasure.MeasureNumber,!1),B.read(P,this.currentMeasure,r,o.clone(),c.length)}}}else if(P.name==="barline"){this.repetitionInstructionReader&&this.repetitionInstructionReader.handleLineRepetitionInstructions(P)&&(this.currentMeasure.HasEndLine=!0);const I=P.attribute("location");if(C===_.length-1||I&&I.value==="right"){const R=(x=P.element("bar-style"))==null?void 0:x.value;if(R&&(this.currentMeasure.endingBarStyleXml=R,this.currentMeasure.endingBarStyleEnum=SystemLinesEnumHelper.xmlBarlineStyleToSystemLinesEnum(R),(A=this.currentGradualChangeMeasure)!=null&&A.speedInfo)){const{endXmlNoteIndex:F,resetXmlNoteIndex:B,endMeasureListIndex:k}=this.currentGradualChangeMeasure.speedInfo;B===0&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:F||this.xmlNotes.length,endMeasureListIndex:k||this.currentXmlMeasureIndex,resetXmlNoteIndex:this.xmlNotes.length,resetMeasureListIndex:this.currentXmlMeasureIndex}),this.currentGradualChangeMeasure=void 0,this.xmlNotes=[]}}}else if(P.name==="sound")try{if(P.attribute("tempo")){const I=parseFloat(P.attribute("tempo").value);P.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 P.name==="harmony"&&this.openChordSymbolContainers.push(ChordSymbolReader.readChordSymbol(P,this.musicSheet,this.activeKey))}for(const C in this.voiceGeneratorsDict)this.voiceGeneratorsDict.hasOwnProperty(C)&&this.voiceGeneratorsDict[C].checkForOpenBeam();if(this.currentXmlMeasureIndex===this.xmlMeasureList.length-1){for(let C=0;C{this.voiceGeneratorsDict[C].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(E){if(a)throw new MusicSheetReadingException(E.Message);const _=ITextTranslation.translateText("ReaderErrorMessages/MeasureError","Error while reading Measure.");this.musicSheet.SheetErrors.pushMeasureError(_),loglevelExports.debug("InstrumentReader.readNextXmlMeasure",_,E)}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,t){const s=this.instrument.Staves[t];let r=this.voiceGeneratorsDict[e];if(r)s.Voices.indexOf(r.GetVoice)===-1&&s.Voices.push(r.GetVoice);else{const o=this.staffMainVoiceGeneratorDict[t];o?(r=new VoiceGenerator(this.pluginManager,s,e,this.slurReader,o.GetVoice),s.Voices.push(r.GetVoice),this.voiceGeneratorsDict[e]=r):(r=new VoiceGenerator(this.pluginManager,s,e,this.slurReader),s.Voices.push(r.GetVoice),this.voiceGeneratorsDict[e]=r,this.staffMainVoiceGeneratorDict[t]=r)}return r}createExpressionGenerators(e){this.expressionReaders=new Array(e);for(let t=0;t0?t=this.musicSheet.SourceMeasures[0]:t=this.currentMeasure;const s=new ClefInstruction(ClefEnum.G,0,2);let r;t.FirstInstructionsStaffEntries[e]?(r=t.FirstInstructionsStaffEntries[e],r.removeFirstInstructionOfTypeClefInstruction()):(r=new SourceStaffEntry(void 0,void 0),t.FirstInstructionsStaffEntries[e]=r),s.Parent=r,r.Instructions.splice(0,0,s)}createDefaultKeyInstruction(){let e;this.musicSheet.SourceMeasures.length>0?e=this.musicSheet.SourceMeasures[0]:e=this.currentMeasure;const t=new KeyInstruction(void 0,0,KeyEnum.major);for(let s=this.inSourceMeasureInstrumentIndex;s0&&s[r-1].name==="backup")return!0;let o=-1;for(let a=0;a0||o<0}isAttributesNodeAtEndOfMeasure(e,t){const s=e.elements().slice();let r=0;for(let a=0;ao}getNoteDurationFromTypeNode(e){const t=e.element("type");if(t){const s=t.value;return NoteTypeHandler.getNoteDurationFromType(s)}return new Fraction$1(0,4*this.divisions)}addAbstractInstruction(e,t,s,r){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,d=a.length;c using default clef line."),this.musicSheet.SheetErrors.pushMeasureError(l),g=2,loglevelExports.debug("InstrumentReader.addAbstractInstruction",l,E)}const v=m.element("sign");if(v)try{u=ClefEnum[v.value],ClefInstruction.isSupportedClef(u)||(l=ITextTranslation.translateText("ReaderErrorMessages/ClefError","Unsupported clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(l),u=ClefEnum.G,g=2),u===ClefEnum.TAB&&(y=-1)}catch(E){l=ITextTranslation.translateText("ReaderErrorMessages/ClefError","Invalid clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(l),u=ClefEnum.G,g=2,loglevelExports.debug("InstrumentReader.addAbstractInstruction",l,E)}const x=m.element("clef-octave-change");if(x)try{y=parseInt(x.value,10)}catch(E){l=ITextTranslation.translateText("ReaderErrorMessages/ClefOctaveError","Invalid clef octave found -> using default clef octave."),this.musicSheet.SheetErrors.pushMeasureError(l),y=0}if(m.hasAttributes&&m.attribute("number"))try{b=parseInt(m.attribute("number").value,10),b>this.currentClefNumber&&(b=this.currentClefNumber),this.currentClefNumber=b+1}catch(E){l=ITextTranslation.translateText("ReaderErrorMessages/ClefError","Invalid clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(l),b=1,this.currentClefNumber=b+1}const A=new ClefInstruction(u,y,g);this.abstractInstructions.push([b,A,r])}if(e.element("key")!==void 0&&this.instrument.MidiInstrumentId!==MidiInstrument.Percussion){let c=0;const d=e.element("key").element("fifths");if(d)try{c=parseInt(d.value,10)}catch(b){l=ITextTranslation.translateText("ReaderErrorMessages/KeyError","Invalid key found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(l),c=0,loglevelExports.debug("InstrumentReader.addAbstractInstruction",l,b)}let m=KeyEnum.none,u=e.element("key");if(u&&(u=u.element("mode")),u)try{m=KeyEnum[u.value]}catch(b){l=ITextTranslation.translateText("ReaderErrorMessages/KeyError","Invalid key found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(l),m=KeyEnum.major,loglevelExports.debug("InstrumentReader.addAbstractInstruction",l,b)}const g=new KeyInstruction(void 0,c,m);this.abstractInstructions.push([1,g,r])}if(e.element("time")){const c=e.element("time");let d=RhythmSymbolEnum.NONE,m=!0;if(c!==void 0&&c.hasAttributes){const x=c.attribute("symbol");x&&(x.value==="common"?d=RhythmSymbolEnum.COMMON:x.value==="cut"&&(d=RhythmSymbolEnum.CUT));const A=c.attribute("print-object");A&&A.value==="no"&&(m=!1)}let u=0,g=0;const b=c&&c.element("senza-misura")!==void 0,y=e.elements("time"),S=[],v=[];for(let x=0,A=y.length;x0&&v!==void 0&&S.length===v.length){const A=S.length,E=new Array(A);let _=0;for(let w=0;w set to default."),this.musicSheet.SheetErrors.pushMeasureError(l),u=4,g=4,loglevelExports.debug("InstrumentReader.addAbstractInstruction",l,A)}const x=new RhythmInstruction(new Fraction$1(u,g,0,!1),d);x.PrintObject=m,this.abstractInstructions.push([1,x,r])}}}saveAbstractInstructionList(e,t){for(let s=this.abstractInstructions.length-1;s>=0;s--){const r=this.abstractInstructions[s],o=r[0],a=r[1],l=r[2];if(a instanceof ClefInstruction){const c=a;if(this.currentXmlMeasureIndex===0||o<=this.activeClefs.length&&c!==this.activeClefs[o-1])if(!t&&this.currentStaffEntry!==void 0&&!this.currentStaffEntry.hasNotes()&&o-1===this.instrument.Staves.indexOf(this.currentStaffEntry.ParentStaff)){const d=c,m=this.currentStaffEntry;if(l&&Math.abs(l.RealValue-m.Timestamp.RealValue)>.01)continue;d.Parent=m,m.removeFirstInstructionOfTypeClefInstruction(),m.Instructions.push(d),this.activeClefs[o-1]=c,this.abstractInstructions.splice(s,1)}else if(t){if(l.RealValue!==0)continue;let d;if(this.currentMeasure){const m=c,u=this.inSourceMeasureInstrumentIndex+o-1,g=this.currentMeasure.FirstInstructionsStaffEntries[u];if(this.currentXmlMeasureIndex===0)if(!g)d=new SourceStaffEntry(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[u]=d,m.Parent=d,d.Instructions.push(m),this.activeClefsHaveBeenInitialized[o-1]=!0;else if(this.currentMeasure.FirstInstructionsStaffEntries[u]!==void 0&&!(g.Instructions[0]instanceof ClefInstruction))d=g,m.Parent=d,d.removeFirstInstructionOfTypeClefInstruction(),d.Instructions.splice(0,0,m),this.activeClefsHaveBeenInitialized[o-1]=!0;else{const b=new SourceStaffEntry(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[u]=b,m.Parent=b,b.Instructions.push(m)}else if(this.activeClefsHaveBeenInitialized[o-1]){let b=this.previousMeasure;this.followingMultirestMeasures>0&&this.currentMeasure.Rules.RenderMultipleRestMeasures&&(b=this.currentMultirestStartMeasure);const y=new SourceStaffEntry(void 0,void 0);b.LastInstructionsStaffEntries[u]=y,m.Parent=y,y.Instructions.push(m)}else{const b=this.musicSheet.SourceMeasures[0];b.FirstInstructionsStaffEntries[u]?(d=b.FirstInstructionsStaffEntries[u],d.removeFirstInstructionOfTypeClefInstruction()):d=new SourceStaffEntry(void 0,void 0),m.Parent=d,d.Instructions.splice(0,0,m),this.activeClefsHaveBeenInitialized[o-1]=!0}this.activeClefs[o-1]=c,this.abstractInstructions.splice(s,1)}}else{let d;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])),d=this.currentMeasure.LastInstructionsStaffEntries[o-1]),d&&(c.Parent=d,d.Instructions.push(c),this.activeClefs[o-1]=c,this.abstractInstructions.splice(s,1))}else o<=this.activeClefs.length&&c===this.activeClefs[o-1]&&this.abstractInstructions.splice(s,1)}if(a instanceof KeyInstruction){const c=a;if(!this.activeKey||this.activeKey.Key!==c.Key){this.activeKey=c,this.abstractInstructions.splice(s,1);let d;if(this.activeKeyHasBeenInitialized?d=this.currentMeasure:(this.activeKeyHasBeenInitialized=!0,this.currentXmlMeasureIndex>0?d=this.musicSheet.SourceMeasures[0]:d=this.currentMeasure),d)for(let m=this.inSourceMeasureInstrumentIndex;m=0;e--){const t=this.abstractInstructions[e][0],s=this.abstractInstructions[e][1];if(s instanceof ClefInstruction){const r=s;if(!this.activeClefs[t-1]||r.ClefType!==this.activeClefs[t-1].ClefType||r.ClefType===this.activeClefs[t-1].ClefType&&r.Line!==this.activeClefs[t-1].Line){const o=new SourceStaffEntry(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[this.inSourceMeasureInstrumentIndex+t-1]=o;const a=r;a.Parent=o,o.Instructions.push(a),this.activeClefs[t-1]=r,this.abstractInstructions.splice(e,1)}}}}getNoteDurationForTuplet(e){let t=new Fraction$1(0,1);const s=this.getNoteDurationFromTypeNode(e);if(e.element("time-modification")){const r=e.element("time-modification");if(r&&r.element("actual-notes")!==void 0&&r.element("normal-notes")){const o=r.element("actual-notes"),a=r.element("normal-notes");if(o!==void 0&&a){const l=parseInt(o.value,10),c=parseInt(a.value,10);t=new Fraction$1(c*s.Numerator,l*s.Denominator)}}}return t}readExpressionStaffNumber(e){let t=1;if(e.element("staff")){const s=e.element("staff");if(s)try{t=parseInt(s.value,10)}catch(r){const o=ITextTranslation.translateText("ReaderErrorMessages/ExpressionStaffError","Invalid Expression staff number -> set to default.");this.musicSheet.SheetErrors.pushMeasureError(o),t=1,loglevelExports.debug("InstrumentReader.readExpressionStaffNumber",o,r)}}return t}readDivisionsFromNotes(){let e=0,t=this.currentXmlMeasureIndex,s=!1;for(;!s;){const r=this.xmlMeasureList[t].elements();for(let o=0,a=r.length;o0){s=!0;break}}if(e===0&&(t++,t===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(i){this.parentInstrument=i,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(i){return i===MidiInstrument.Acoustic_Grand_Piano||i===MidiInstrument.Bright_Acoustic_Piano||i===MidiInstrument.Electric_Grand_Piano||i===MidiInstrument.Electric_Piano_1||i===MidiInstrument.Electric_Piano_2}setMidiInstrument(i){this.midiInstrumentID=_SubInstrument.midiInstrument[this.parseMidiInstrument(i)]}parseMidiInstrument(i){try{if(i){let e=i.toLowerCase().trim();e=e.replace(/\s+/g,"_");for(const t in _SubInstrument.midiInstrument)if(e.indexOf(t)!==-1)return t}if(this.parentInstrument.Name){let e=this.parentInstrument.Name.toLowerCase().trim();e=e.replace(/\s+/g,"_");for(const t in _SubInstrument.midiInstrument)if(e.indexOf(t)!==-1)return t}}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,t,s=!1){return new RegExp("( |^)"+t+"([ .]|$)",s?"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,t){this.currentMeasureIndex=t}handleLineRepetitionInstructions(e){let t=!1;if(e.elements().length>0){let s="",r=!1,o="",a="",l="";const c=[],d=e.element("bar-style");d&&(l=d.value),e.attributes().length>0&&e.attribute("location")?s=e.attribute("location").value:s="right";const m=e.elements();for(let u=0,g=m.length;u0)if(s==="left"){if(a==="start"){const u=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Ending,AlignmentType.Begin,void 0,c);this.addInstruction(this.repetitionInstructions,u)}if(o==="forward"){const u=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.StartLine);this.addInstruction(this.repetitionInstructions,u)}}else{if(a==="stop"){const u=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Ending,AlignmentType.End,void 0,c);this.addInstruction(this.repetitionInstructions,u)}if(o==="backward"){const u=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.BackJumpLine);this.addInstruction(this.repetitionInstructions,u)}}}return t}handleRepetitionInstructionsFromWordsOrSymbols(e,t){const s=e.element("words"),r=this.currentMeasureIndex;if(s){const o="d\\s?\\.s\\.",a=s.value.trim().toLowerCase();if(StringUtil.StringContainsSeparatedWord(a,o+" al fine",!0)){const c=new RepetitionInstruction(r,RepetitionInstructionEnum.DalSegnoAlFine);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,o+" al coda",!0)){const c=new RepetitionInstruction(r,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(r,RepetitionInstructionEnum.DaCapoAlFine);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,l+" al coda",!0)){const c=new RepetitionInstruction(r,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(r,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(r,RepetitionInstructionEnum.DalSegnoAlCoda):c=new RepetitionInstruction(r,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(r,RepetitionInstructionEnum.ToCoda);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,"fine",!0)){const c=new RepetitionInstruction(r,RepetitionInstructionEnum.Fine);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,"coda",!0)){const c=new RepetitionInstruction(r,RepetitionInstructionEnum.Coda);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,"segno",!0)){const c=new RepetitionInstruction(r,RepetitionInstructionEnum.Segno);return this.addInstruction(this.repetitionInstructions,c),!0}}else if(e.element("segno")){const o=new RepetitionInstruction(r,RepetitionInstructionEnum.Segno);return this.addInstruction(this.repetitionInstructions,o),!0}else if(e.element("coda")){const o=new RepetitionInstruction(r,RepetitionInstructionEnum.Coda);return this.addInstruction(this.repetitionInstructions,o),!0}return!1}removeRedundantInstructions(){let e=0,t=0,s=0,r=0;for(let o=0;o0&&this.findInstructionInPreviousMeasure(o,a.measureIndex,RepetitionInstructionEnum.ToCoda)&&(a.type=RepetitionInstructionEnum.None),t===0&&s===0&&(a.type=RepetitionInstructionEnum.ToCoda,a.alignment=AlignmentType.End,a.measureIndex--);break;case RepetitionInstructionEnum.Segno:if(e-r>0){let l=!1;for(let c=0,d=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;s-t>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:s++;break;case RepetitionInstructionEnum.Coda:t++;break;case RepetitionInstructionEnum.Segno:e++;break;case RepetitionInstructionEnum.DalSegnoAlFine:case RepetitionInstructionEnum.DalSegnoAlCoda:r++;break}}this.repetitionInstructions.sort(RepetitionInstructionComparer.Compare)}findInstructionInPreviousMeasure(e,t,s){for(let r=e-1;r>=0;r--){const o=this.repetitionInstructions[r];if(t-o.measureIndex===1&&o.type===s)return!0}return!1}backwardSearchForPreviousIdenticalInstruction(e,t){for(let s=e-1;s>=0;s--)if(this.repetitionInstructions[s].equals(t))return!0;return!1}addInstruction(e,t){let s=!0;for(let r=0,o=e.length;r0;)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=s.length-1,d=new RepetitionInstruction(c,RepetitionInstructionEnum.BackJumpLine,AlignmentType.End,l.RepetitonUnderConstruction);l.RepetitonUnderConstruction.BackwardJumpInstructions.push(d),s[c].LastRepetitionInstructions.push(d)}this.finalizeRepetition(this.openRepetitions.last())}catch(l){try{const c=this.openRepetitions.last().RepetitonUnderConstruction;for(const d of this.repetitionInstructions)d.parentRepetition===c&&(d.parentRepetition=void 0);this.openRepetitions.splice(this.openRepetitions.length-1,1)}catch(c){loglevelExports.error("RepetitionCalculator: calculateRepetitions2",c)}}let r=!1;const o=0,a=this.musicSheet.SourceMeasures.length-1;for(const l of this.musicSheet.Repetitions)if(l.StartIndex===o&&l.EndIndex===a){r=!0;break}if(!r){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&&d.FirstRepetitionInstructions.sort(RepetitionInstructionComparer.Compare),d.LastRepetitionInstructions.length>1&&d.LastRepetitionInstructions.sort(RepetitionInstructionComparer.Compare)}}handleRepetitionInstructions(e){let t;switch(e.type){case RepetitionInstructionEnum.StartLine:t=this.createNewRepetition(this.currentMeasureIndex),e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!1,t.RepetitonUnderConstruction.startMarker=e,this.currentMeasure.FirstRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.BackJumpLine:t=this.getOrCreateCurrentRepetition2(!1),e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e),t.RepetitonUnderConstruction.EndingParts.length===0&&this.finalizeRepetition(t);break;case RepetitionInstructionEnum.Ending:if(t=this.getOrCreateCurrentRepetition(),e.parentRepetition=t.RepetitonUnderConstruction,e.endingIndices.contains(1)&&e.alignment===AlignmentType.Begin){if(t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0||t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)){t=void 0;for(let r=this.openRepetitions.length-1;r>=0;r--){const o=this.openRepetitions[r];if(o.RepetitonUnderConstruction.BackwardJumpInstructions.length===0)for(t=o;this.openRepetitions.length-1>r;){const a=this.openRepetitions.last();this.finalizeRepetition(a)}}t===void 0&&(t=this.createNewRepetition(0),t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None))}t.RepetitonUnderConstruction.forwardJumpInstruction===void 0&&(t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(this.currentMeasureIndex-1,RepetitionInstructionEnum.ForwardJump,AlignmentType.End,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[this.currentMeasureIndex-1].LastRepetitionInstructions.push(t.RepetitonUnderConstruction.forwardJumpInstruction))}if(e.alignment===AlignmentType.Begin)t.RepetitonUnderConstruction.setEndingsStartIndex(e.endingIndices,this.currentMeasureIndex),this.currentMeasure.FirstRepetitionInstructions.push(e);else for(let r=0,o=e.endingIndices.length;r0&&Math.abs(t.RepetitonUnderConstruction.BackwardJumpInstructions.last().measureIndex-this.currentMeasureIndex)<=1||this.openRepetitions.length&&this.openRepetitions.find(r=>r.RepetitonUnderConstruction.startMarker.type===RepetitionInstructionEnum.StartLine).RepetitonUnderConstruction.StartIndex===this.currentMeasureIndex)break;t=this.createNewRepetition(this.currentMeasureIndex),e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=e,this.currentMeasure.FirstRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.Fine:if(this.openRepetitions.length===0||(t=this.getCurrentRepetition(!0),t===void 0))break;e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.RepetitonUnderConstruction.forwardJumpInstruction===void 0?(t.FineFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=e,t.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.currentMeasure.LastRepetitionInstructions.push(e)):this.currentMeasure.LastRepetitionInstructions.push(new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Fine,AlignmentType.End,void 0));break;case RepetitionInstructionEnum.ToCoda:if(this.openRepetitions.length===0||(t=this.getCurrentRepetition(!0),t===void 0))break;t.RepetitonUnderConstruction.forwardJumpInstruction===void 0&&(e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.ToCodaFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=e,this.currentMeasure.LastRepetitionInstructions.push(e));break;case RepetitionInstructionEnum.Coda:if(this.openRepetitions.length===0)break;t=this.getOrCreateCurrentRepetition2(!0),e.parentRepetition=t.RepetitonUnderConstruction,t.WaitingForCoda?(t.CodaFound=!0,t.RepetitonUnderConstruction.setEndingStartIndex(2,this.currentMeasureIndex),this.currentMeasure.LastRepetitionInstructions.push(e),this.finalizeRepetition(t),this.currentMeasureIndex>0&&(this.musicSheet.SourceMeasures[this.currentMeasureIndex-1].printNewSystemXml=!0)):t.ToCodaFound||(t.RepetitonUnderConstruction.BackwardJumpInstructions.length===0?(t.ToCodaFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.ToCoda,AlignmentType.End,t.RepetitonUnderConstruction),this.currentMeasure.LastRepetitionInstructions.push(t.RepetitonUnderConstruction.forwardJumpInstruction)):this.currentMeasure.LastRepetitionInstructions.push(new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Coda,AlignmentType.Begin,void 0)));break;case RepetitionInstructionEnum.DaCapo:t=this.getOrCreateCurrentRepetition(),t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&this.finalizeRepetition(t),t.RepetitonUnderConstruction.StartIndex!==0&&(t=this.createNewRepetition(0)),e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e),t.RepetitonUnderConstruction.EndingParts.length===0&&this.finalizeRepetition(t);break;case RepetitionInstructionEnum.DalSegno:if(t=this.getOrCreateCurrentRepetition2(!0),t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&(this.finalizeRepetition(t),t=this.createNewRepetition(0),t.RepetitonUnderConstruction.FromWords=!0,t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,t.RepetitonUnderConstruction)),e.parentRepetition=t.RepetitonUnderConstruction,!t.SegnoFound){const r=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Segno,e.measureIndex);r>=0&&(t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(r,RepetitionInstructionEnum.Segno,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[r].FirstRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.startMarker))}t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)&&t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.DalSegnoAlFine:if(this.openRepetitions.length===0)break;if(t=this.getOrCreateCurrentRepetition2(!0),e.parentRepetition=t.RepetitonUnderConstruction,!t.SegnoFound){const r=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Segno,e.measureIndex);r>=0&&(t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(r,RepetitionInstructionEnum.Segno,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[r].FirstRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.startMarker))}if(!t.FineFound){const r=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Fine,e.measureIndex);r>=0&&(t.FineFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(r,RepetitionInstructionEnum.Fine,AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.musicSheet.SourceMeasures[r].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction))}t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.DaCapoAlFine:if(t=this.getOrCreateCurrentRepetition(),t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&(this.finalizeRepetition(t),t=this.createNewRepetition(0)),t.RepetitonUnderConstruction.startMarker!==void 0&&t.RepetitonUnderConstruction.StartIndex!==0&&(t=this.createNewRepetition(0)),t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.FromWords=!0,e.parentRepetition=t.RepetitonUnderConstruction,!t.FineFound){const r=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Fine,e.measureIndex);r>=0&&(t.FineFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(r,RepetitionInstructionEnum.Fine,AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.musicSheet.SourceMeasures[r].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction))}t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.DalSegnoAlCoda:if(this.openRepetitions.length===0)break;if(t=this.getOrCreateCurrentRepetition2(!0),e.parentRepetition=t.RepetitonUnderConstruction,!t.SegnoFound){const r=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Segno,e.measureIndex);r>=0&&(t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(r,RepetitionInstructionEnum.Segno,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[r].FirstRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.startMarker))}if(!t.ToCodaFound){const r=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.ToCoda,e.measureIndex);if(r>=0)t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(r,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[r].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0;else{const o=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Coda,e.measureIndex);o>=0&&(t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(o,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[o].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0)}}t.ToCodaFound&&(t.WaitingForCoda=!0),t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.DaCapoAlCoda:if(t=this.getOrCreateCurrentRepetition(),t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0?(this.finalizeRepetition(t),t=this.createNewRepetition(0)):t.RepetitonUnderConstruction.EndingParts.length===0&&(this.finalizeRepetition(t),t=this.createNewRepetition(0)),t.RepetitonUnderConstruction.startMarker!==void 0&&t.RepetitonUnderConstruction.StartIndex!==0&&(t=this.createNewRepetition(0)),t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.FromWords=!0,e.parentRepetition=t.RepetitonUnderConstruction,!t.ToCodaFound){const r=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.ToCoda,e.measureIndex);if(r>=0)t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(r,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[r].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0;else{const o=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Coda,e.measureIndex);o>=0&&(t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(o,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[o].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0)}}t.ToCodaFound&&(t.WaitingForCoda=!0),t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.None:break;default:throw new ArgumentOutOfRangeException("currentRepetitionInstruction")}return!0}findInstructionInMainListBackwards(e,t){for(let s=this.repetitionInstructions.length-1;s>=0;s--){const r=this.repetitionInstructions[s];if(r.measureIndex<=t&&r.type===e)return r.measureIndex}return-1}finalizeRepetition(e){const t=e.RepetitonUnderConstruction;if(t.BackwardJumpInstructions.length>0){let s=!0;const r=this.getLastFinalizedRepetition();if(r!==void 0&&t.coversIdenticalMeasures(r)){if(t.NumberOfEndings>r.NumberOfEndings){const o=this.musicSheet.Repetitions.indexOf(r,0);o>-1&&this.musicSheet.Repetitions.splice(o,1),r.removeFromRepetitionInstructions(),this.musicSheet.Repetitions.push(t)}s=!1,t.removeFromRepetitionInstructions()}else this.musicSheet.Repetitions.push(t);s&&(t.startMarker.type===RepetitionInstructionEnum.None&&this.musicSheet.SourceMeasures[t.StartIndex].FirstRepetitionInstructions.push(t.startMarker),t.UserNumberOfRepetitions=t.DefaultNumberOfRepetitions)}this.openRepetitions.splice(this.openRepetitions.length-1,1)}getCurrentRepetition(e){let t;for(let s=this.openRepetitions.length-1;s>=0;s--)if(this.openRepetitions[s].RepetitonUnderConstruction.FromWords===e){for(t=this.openRepetitions[s];s0)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 t;if(this.openRepetitions.length&&this.openRepetitions.last().RepetitonUnderConstruction.EndingParts.length<2){for(let r=this.openRepetitions.length-1;r>=0;r--)if(t=this.openRepetitions[r],t.RepetitonUnderConstruction.FromWords===e){for(;r0){const s=this.openRepetitions.last(),r=s.RepetitonUnderConstruction;if(r.BackwardJumpInstructions.length>0){const o=Object.keys(r.EndingIndexDict);(o.length===0||r.EndingIndexDict[o[o.length-1]].part.EndIndex>=0)&&this.finalizeRepetition(s)}}const t=new RepetitionBuildingContainer(this.musicSheet);return this.lastRepetitionCommonPartStartIndex=e,this.openRepetitions.push(t),t}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,t,s){for(const r of this.voiceMeasureReadPlugins)try{r.measureReadCalculations(e,t,s)}catch(o){loglevelExports.info("VoiceGenerator.addSingleNote: ",o)}}}class MusicSheetReader{constructor(e=void 0,t=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=t}get PluginManager(){return this.pluginManager}get CompleteNumberOfStaves(){return this.completeNumberOfStaves}static doCalculationsAfterDurationHasBeenSet(e){for(const t of e)t.doCalculationsAfterDurationHasBeenSet()}createMusicSheet(e,t){try{return this._createMusicSheet(e,t)}catch(s){loglevelExports.error("MusicSheetReader.CreateMusicSheet",s);return}}_removeFromArray(e,t){const s=e.indexOf(t);s!==-1&&e.splice(s,1)}trimString(e){return e.replace(/^\s+|\s+$/g,"")}_lastElement(e){return e[e.length-1]}_createMusicSheet(e,t){var u;const s=[];let r=0;if(this.musicSheet=new MusicSheet,this.musicSheet.Path=t,this.musicSheet.Rules=this.rules,!e)throw new MusicSheetReadingException("Undefined root element");this.pushSheetLabels(e,t);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,s);let c=!0;this.currentFraction=new Fraction$1(0,1);let d=!1,m=e.element("identification");for(m&&(m=m.element("encoding")),m&&(m=m.element("software")),m!==void 0&&m.value==="Guitar Pro 5"&&(d=!0);c;){this.currentMeasure!==void 0&&this.currentMeasure.HasEndLine&&this.rules.NewPartAndSystemAfterFinalBarline&&(r=0),this.currentMeasure=new SourceMeasure(this.completeNumberOfStaves,this.musicSheet.Rules);for(const g of s)try{c=c&&g.readNextXmlMeasure(this.currentMeasure,this.currentFraction,d)}catch(b){const y=ITextTranslation.translateText("ReaderErrorMessages/InstrumentError","Error while reading instruments.");throw new MusicSheetReadingException(y,b)}c&&(this.musicSheet.addMeasure(this.currentMeasure),this.checkIfRhythmInstructionsAreSetAndEqual(s),this.checkSourceMeasureForNullEntries(),r=this.setSourceMeasureDuration(s,r),MusicSheetReader.doCalculationsAfterDurationHasBeenSet(s),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=(u=s[0])==null?void 0:u.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,b=this.afterSheetReadingModules.length;gs){if(this.areRhythmInstructionsMixed(t)&&l.SymbolEnum!==RhythmSymbolEnum.NONE)continue;s=l.Rhythm.RealValue,r=t.indexOf(l)}}if(t.length>0&&t.lengthe.Denominator){const s=t.Denominator/e.Denominator;e.expand(s)}}checkIfMeasureIsImplicit(e,t){return!this.previousMeasure&&e.lt(t)?!0:this.previousMeasure?Fraction$1.plus(this.previousMeasure.Duration,e).Equals(t):!1}allInstrumentsHaveSameDuration(e,t){let s=0;for(let r=0,o=e.length;r=0;e--)for(let t=this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries.length-1;t>=0;t--){const s=this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries[t];if(s)for(let r=s.VoiceEntries.length-1;r>=0;r--){const o=s.VoiceEntries[r];o.Notes.length===0&&(this._removeFromArray(o.ParentVoice.VoiceEntries,o),this._removeFromArray(s.VoiceEntries,o))}s!==void 0&&s.VoiceEntries.length===0&&(this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries[t]=void 0)}for(let e=this.currentMeasure.VerticalSourceStaffEntryContainers.length-1;e>=0;e--){let t=0;for(let s=0,r=this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries.length;st){if(!this.musicSheet.Title){const E=y.attribute("font-size").value,_=parseFloat(E);s<_&&(s=_,r=y.value)}if(this.musicSheet.Subtitle||S!=="right"&&S!=="left"&&o0&&m.MidiInstrumentId!==MidiInstrument.Percussion&&(S.midiInstrumentID=Math.max(0,parseInt(E.value,10)-1));else if(E.name==="midi-unpitched")S.fixedKey=Math.max(0,parseInt(E.value,10));else if(E.name==="volume")try{const _=parseFloat(E.value);S.volume=_/127}catch(_){loglevelExports.debug("ExpressionReader.readExpressionParameters","read volume",_)}else if(E.name==="pan")try{const _=parseFloat(E.value);S.pan=_/64}catch(_){loglevelExports.debug("ExpressionReader.readExpressionParameters","read pan",_)}}catch(_){loglevelExports.info("MusicSheetReader.createInstrumentGroups midi settings: ",_)}}}}catch(S){loglevelExports.info("MusicSheetReader.createInstrumentGroups: ",S)}}if(m.SubInstruments.length===0){const g=new SubInstrument(m);m.SubInstruments.push(g)}s[d]=m,r?(r.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 d=new InstrumentalGroup("group",this.musicSheet,r);r?r.InstrumentalGroups.push(d):this.musicSheet.InstrumentalGroups.push(d),r=d}else if(c.name==="part-group"&&c.attribute("type").value==="stop"&&r){if(r.InstrumentalGroups.length===1){const d=r.InstrumentalGroups[0];r.Parent?(r.Parent.InstrumentalGroups.push(d),this._removeFromArray(r.Parent.InstrumentalGroups,r)):(this.musicSheet.InstrumentalGroups.push(d),this._removeFromArray(this.musicSheet.InstrumentalGroups,r))}r=r.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=r[0];if(o){let a=o.element("attributes");a&&(a=a.element("staves")),a?t+=parseInt(a.value,10):t++}}}if(isNaN(t)||t<=0){const s=ITextTranslation.translateText("ReaderErrorMessages/StaffError","Invalid number of staves.");throw new MusicSheetReadingException(s)}return t}getInstrumentNumberOfStavesFromXml(e){let t=0;const s=e.element("measure");if(s){const r=s.element("attributes");let o;r&&(o=r.element("staves")),!r||!o?t=1:t=parseInt(o.value,10)}if(isNaN(t)||t<=0){const r=ITextTranslation.translateText("ReaderErrorMessages/StaffError","Invalid number of Staves.");throw new MusicSheetReadingException(r)}return t}}function commonjsRequire(i){throw new Error('Could not dynamically require "'+i+'". 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(i){jszip_minExports=i}};/*! JSZip v3.7.1 - A JavaScript class for generating and reading zip files (c) 2009-2016 Stuart Knightley Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/master/LICENSE */(function(i,e){(function(t){i.exports=t()})(function(){return function t(s,r,o){function a(d,m){if(!r[d]){if(!s[d]){var u=typeof commonjsRequire=="function"&&commonjsRequire;if(!m&&u)return u(d,!0);if(l)return l(d,!0);var g=new Error("Cannot find module '"+d+"'");throw g.code="MODULE_NOT_FOUND",g}var b=r[d]={exports:{}};s[d][0].call(b.exports,function(y){var S=s[d][1][y];return a(S||y)},b,b.exports,t,s,r,o)}return r[d].exports}for(var l=typeof commonjsRequire=="function"&&commonjsRequire,c=0;c>2,b=(3&d)<<4|m>>4,y=1>6:64,S=2>4,m=(15&g)<<4|(b=l.indexOf(c.charAt(S++)))>>2,u=(3&b)<<6|(y=l.indexOf(c.charAt(S++))),A[v++]=d,b!==64&&(A[v++]=m),y!==64&&(A[v++]=u);return A}},{"./support":30,"./utils":32}],2:[function(t,s,r){var o=t("./external"),a=t("./stream/DataWorker"),l=t("./stream/Crc32Probe"),c=t("./stream/DataLengthProbe");function d(m,u,g,b,y){this.compressedSize=m,this.uncompressedSize=u,this.crc32=g,this.compression=b,this.compressedContent=y}d.prototype={getContentWorker:function(){var m=new a(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),u=this;return m.on("end",function(){if(this.streamInfo.data_length!==u.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)}},d.createWorkerFrom=function(m,u,g){return m.pipe(new l).pipe(new c("uncompressedSize")).pipe(u.compressWorker(g)).pipe(new c("compressedSize")).withStreamInfo("compression",u)},s.exports=d},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,s,r){var o=t("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(a){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},r.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,s,r){var o=t("./utils"),a=function(){for(var l,c=[],d=0;d<256;d++){l=d;for(var m=0;m<8;m++)l=1&l?3988292384^l>>>1:l>>>1;c[d]=l}return c}();s.exports=function(l,c){return l!==void 0&&l.length?o.getTypeOf(l)!=="string"?function(d,m,u,g){var b=a,y=g+u;d^=-1;for(var S=g;S>>8^b[255&(d^m[S])];return-1^d}(0|c,l,l.length,0):function(d,m,u,g){var b=a,y=g+u;d^=-1;for(var S=g;S>>8^b[255&(d^m.charCodeAt(S))];return-1^d}(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(t,s,r){r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(t,s,r){var o=null;o=typeof Promise<"u"?Promise:t("lie"),s.exports={Promise:o}},{lie:37}],7:[function(t,s,r){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=t("pako"),l=t("./utils"),c=t("./stream/GenericWorker"),d=o?"uint8array":"array";function m(u,g){c.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=g,this.meta={}}r.magic="\b\0",l.inherits(m,c),m.prototype.processChunk=function(u){this.meta=u.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(d,u.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 u=this;this._pako.onData=function(g){u.push({data:g,meta:u.meta})}},r.compressWorker=function(u){return new m("Deflate",u)},r.uncompressWorker=function(){return new m("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,s,r){function o(b,y){var S,v="";for(S=0;S>>=8;return v}function a(b,y,S,v,x,A){var E,_,w=b.file,C=b.compression,P=A!==d.utf8encode,I=l.transformTo("string",A(w.name)),N=l.transformTo("string",d.utf8encode(w.name)),R=w.comment,F=l.transformTo("string",A(R)),B=l.transformTo("string",d.utf8encode(R)),k=N.length!==w.name.length,M=B.length!==R.length,G="",ee="",$="",re=w.dir,ie=w.date,de={crc32:0,compressedSize:0,uncompressedSize:0};y&&!S||(de.crc32=b.crc32,de.compressedSize=b.compressedSize,de.uncompressedSize=b.uncompressedSize);var Q=0;y&&(Q|=8),P||!k&&!M||(Q|=2048);var H=0,ue=0;re&&(H|=16),x==="UNIX"?(ue=798,H|=function(W,oe){var he=W;return W||(he=oe?16893:33204),(65535&he)<<16}(w.unixPermissions,re)):(ue=20,H|=function(W){return 63&(W||0)}(w.dosPermissions)),E=ie.getUTCHours(),E<<=6,E|=ie.getUTCMinutes(),E<<=5,E|=ie.getUTCSeconds()/2,_=ie.getUTCFullYear()-1980,_<<=4,_|=ie.getUTCMonth()+1,_<<=5,_|=ie.getUTCDate(),k&&(ee=o(1,1)+o(m(I),4)+N,G+="up"+o(ee.length,2)+ee),M&&($=o(1,1)+o(m(F),4)+B,G+="uc"+o($.length,2)+$);var ne="";return ne+=` \0`,ne+=o(Q,2),ne+=C.magic,ne+=o(E,2),ne+=o(_,2),ne+=o(de.crc32,4),ne+=o(de.compressedSize,4),ne+=o(de.uncompressedSize,4),ne+=o(I.length,2),ne+=o(G.length,2),{fileRecord:u.LOCAL_FILE_HEADER+ne+I+G,dirRecord:u.CENTRAL_FILE_HEADER+o(ue,2)+ne+o(F.length,2)+"\0\0\0\0"+o(H,4)+o(v,4)+I+G+F}}var l=t("../utils"),c=t("../stream/GenericWorker"),d=t("../utf8"),m=t("../crc32"),u=t("../signature");function g(b,y,S,v){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=y,this.zipPlatform=S,this.encodeFileName=v,this.streamFiles=b,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(b){var y=b.meta.percent||0,S=this.entriesCount,v=this._sources.length;this.accumulate?this.contentBuffer.push(b):(this.bytesWritten+=b.data.length,c.prototype.push.call(this,{data:b.data,meta:{currentFile:this.currentFile,percent:S?(y+100*(S-v-1))/S:100}}))},g.prototype.openedSource=function(b){this.currentSourceOffset=this.bytesWritten,this.currentFile=b.file.name;var y=this.streamFiles&&!b.file.dir;if(y){var S=a(b,y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:S.fileRecord,meta:{percent:0}})}else this.accumulate=!0},g.prototype.closedSource=function(b){this.accumulate=!1;var y=this.streamFiles&&!b.file.dir,S=a(b,y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(S.dirRecord),y)this.push({data:function(v){return u.DATA_DESCRIPTOR+o(v.crc32,4)+o(v.compressedSize,4)+o(v.uncompressedSize,4)}(b),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 b=this.bytesWritten,y=0;y=this.index;c--)d=(d<<8)+this.byteAt(c);return this.index+=l,d},readString:function(l){return o.transformTo("string",this.readData(l))},readData:function(l){},lastIndexOfSignature:function(l){},readAndCheckSignature:function(l){},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))}},s.exports=a},{"../utils":32}],19:[function(t,s,r){var o=t("./Uint8ArrayReader");function a(l){o.call(this,l)}t("../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},s.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,s,r){var o=t("./DataReader");function a(l){o.call(this,l)}t("../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},s.exports=a},{"../utils":32,"./DataReader":18}],21:[function(t,s,r){var o=t("./ArrayReader");function a(l){o.call(this,l)}t("../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},s.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(t,s,r){var o=t("../utils"),a=t("../support"),l=t("./ArrayReader"),c=t("./StringReader"),d=t("./NodeBufferReader"),m=t("./Uint8ArrayReader");s.exports=function(u){var g=o.getTypeOf(u);return o.checkSupport(g),g!=="string"||a.uint8array?g==="nodebuffer"?new d(u):a.uint8array?new m(o.transformTo("uint8array",u)):new l(o.transformTo("array",u)):new c(u)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,s,r){r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,s,r){var o=t("./GenericWorker"),a=t("../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})},s.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(t,s,r){var o=t("./GenericWorker"),a=t("../crc32");function l(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(l,o),l.prototype.processChunk=function(c){this.streamInfo.crc32=a(c.data,this.streamInfo.crc32||0),this.push(c)},s.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,s,r){var o=t("../utils"),a=t("./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 d=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=d+c.data.length}a.prototype.processChunk.call(this,c)},s.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(t,s,r){var o=t("../utils"),a=t("./GenericWorker");function l(c){a.call(this,"DataWorker");var d=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(m){d.dataIsReady=!0,d.data=m,d.max=m&&m.length||0,d.type=o.getTypeOf(m),d.isPaused||d._tickAndRepeat()},function(m){d.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,d=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,d);break;case"uint8array":c=this.data.subarray(this.index,d);break;case"array":case"nodebuffer":c=this.data.slice(this.index,d)}return this.index=d,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},s.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(t,s,r){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}},s.exports=o},{}],29:[function(t,s,r){var o=t("../utils"),a=t("./ConvertWorker"),l=t("./GenericWorker"),c=t("../base64"),d=t("../support"),m=t("../external"),u=null;if(d.nodestream)try{u=t("../nodejs/NodejsStreamOutputAdapter")}catch(y){}function g(y,S){return new m.Promise(function(v,x){var A=[],E=y._internalType,_=y._outputType,w=y._mimeType;y.on("data",function(C,P){A.push(C),S&&S(P)}).on("error",function(C){A=[],x(C)}).on("end",function(){try{var C=function(P,I,N){switch(P){case"blob":return o.newBlob(o.transformTo("arraybuffer",I),N);case"base64":return c.encode(I);default:return o.transformTo(P,I)}}(_,function(P,I){var N,R=0,F=null,B=0;for(N=0;N"u")r.blob=!1;else{var o=new ArrayBuffer(0);try{r.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),r.blob=a.getBlob("application/zip").size===0}catch(c){r.blob=!1}}}try{r.nodestream=!!t("readable-stream").Readable}catch(l){r.nodestream=!1}},{"readable-stream":16}],31:[function(t,s,r){for(var o=t("./utils"),a=t("./support"),l=t("./nodejsUtils"),c=t("./stream/GenericWorker"),d=new Array(256),m=0;m<256;m++)d[m]=252<=m?6:248<=m?5:240<=m?4:224<=m?3:192<=m?2:1;d[254]=d[254]=1;function u(){c.call(this,"utf-8 decode"),this.leftOver=null}function g(){c.call(this,"utf-8 encode")}r.utf8encode=function(b){return a.nodebuffer?l.newBufferFrom(b,"utf-8"):function(y){var S,v,x,A,E,_=y.length,w=0;for(A=0;A<_;A++)(64512&(v=y.charCodeAt(A)))==55296&&A+1<_&&(64512&(x=y.charCodeAt(A+1)))==56320&&(v=65536+(v-55296<<10)+(x-56320),A++),w+=v<128?1:v<2048?2:v<65536?3:4;for(S=a.uint8array?new Uint8Array(w):new Array(w),A=E=0;E>>6:(v<65536?S[E++]=224|v>>>12:(S[E++]=240|v>>>18,S[E++]=128|v>>>12&63),S[E++]=128|v>>>6&63),S[E++]=128|63&v);return S}(b)},r.utf8decode=function(b){return a.nodebuffer?o.transformTo("nodebuffer",b).toString("utf-8"):function(y){var S,v,x,A,E=y.length,_=new Array(2*E);for(S=v=0;S>10&1023,_[v++]=56320|1023&x)}return _.length!==v&&(_.subarray?_=_.subarray(0,v):_.length=v),o.applyFromCharCode(_)}(b=o.transformTo(a.uint8array?"uint8array":"array",b))},o.inherits(u,c),u.prototype.processChunk=function(b){var y=o.transformTo(a.uint8array?"uint8array":"array",b.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var S=y;(y=new Uint8Array(S.length+this.leftOver.length)).set(this.leftOver,0),y.set(S,this.leftOver.length)}else y=this.leftOver.concat(y);this.leftOver=null}var v=function(A,E){var _;for((E=E||A.length)>A.length&&(E=A.length),_=E-1;0<=_&&(192&A[_])==128;)_--;return _<0||_===0?E:_+d[A[_]]>E?_:E}(y),x=y;v!==y.length&&(a.uint8array?(x=y.subarray(0,v),this.leftOver=y.subarray(v,y.length)):(x=y.slice(0,v),this.leftOver=y.slice(v,y.length))),this.push({data:r.utf8decode(x),meta:b.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=u,o.inherits(g,c),g.prototype.processChunk=function(b){this.push({data:r.utf8encode(b.data),meta:b.meta})},r.Utf8EncodeWorker=g},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,s,r){var o=t("./support"),a=t("./base64"),l=t("./nodejsUtils"),c=t("set-immediate-shim"),d=t("./external");function m(v){return v}function u(v,x){for(var A=0;A>8;this.dir=!!(16&this.externalFileAttributes),b==0&&(this.dosPermissions=63&this.externalFileAttributes),b==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(b){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(b){var y,S,v,x=b.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});b.index+4>>6:(b<65536?g[v++]=224|b>>>12:(g[v++]=240|b>>>18,g[v++]=128|b>>>12&63),g[v++]=128|b>>>6&63),g[v++]=128|63&b);return g},r.buf2binstring=function(u){return m(u,u.length)},r.binstring2buf=function(u){for(var g=new o.Buf8(u.length),b=0,y=g.length;b>10&1023,A[y++]=56320|1023&S)}return m(A,y)},r.utf8border=function(u,g){var b;for((g=g||u.length)>u.length&&(g=u.length),b=g-1;0<=b&&(192&u[b])==128;)b--;return b<0||b===0?g:b+c[u[b]]>g?b:g}},{"./common":41}],43:[function(t,s,r){s.exports=function(o,a,l,c){for(var d=65535&o|0,m=o>>>16&65535|0,u=0;l!==0;){for(l-=u=2e3>>1:a>>>1;l[c]=a}return l}();s.exports=function(a,l,c,d){var m=o,u=d+c;a^=-1;for(var g=d;g>>8^m[255&(a^l[g])];return-1^a}},{}],46:[function(t,s,r){var o,a=t("../utils/common"),l=t("./trees"),c=t("./adler32"),d=t("./crc32"),m=t("./messages"),u=0,g=4,b=0,y=-2,S=-1,v=4,x=2,A=8,E=9,_=286,w=30,C=19,P=2*_+1,I=15,N=3,R=258,F=R+N+1,B=42,k=113,M=1,G=2,ee=3,$=4;function re(T,q){return T.msg=m[q],q}function ie(T){return(T<<1)-(4T.avail_out&&(Y=T.avail_out),Y!==0&&(a.arraySet(T.output,q.pending_buf,q.pending_out,Y,T.next_out),T.next_out+=Y,q.pending_out+=Y,T.total_out+=Y,T.avail_out-=Y,q.pending-=Y,q.pending===0&&(q.pending_out=0))}function H(T,q){l._tr_flush_block(T,0<=T.block_start?T.block_start:-1,T.strstart-T.block_start,q),T.block_start=T.strstart,Q(T.strm)}function ue(T,q){T.pending_buf[T.pending++]=q}function ne(T,q){T.pending_buf[T.pending++]=q>>>8&255,T.pending_buf[T.pending++]=255&q}function W(T,q){var Y,O,V=T.max_chain_length,U=T.strstart,se=T.prev_length,te=T.nice_match,K=T.strstart>T.w_size-F?T.strstart-(T.w_size-F):0,ae=T.window,fe=T.w_mask,pe=T.prev,ye=T.strstart+R,ve=ae[U+se-1],ce=ae[U+se];T.prev_length>=T.good_match&&(V>>=2),te>T.lookahead&&(te=T.lookahead);do if(ae[(Y=q)+se]===ce&&ae[Y+se-1]===ve&&ae[Y]===ae[U]&&ae[++Y]===ae[U+1]){U+=2,Y++;do;while(ae[++U]===ae[++Y]&&ae[++U]===ae[++Y]&&ae[++U]===ae[++Y]&&ae[++U]===ae[++Y]&&ae[++U]===ae[++Y]&&ae[++U]===ae[++Y]&&ae[++U]===ae[++Y]&&ae[++U]===ae[++Y]&&UK&&--V!=0);return se<=T.lookahead?se:T.lookahead}function oe(T){var q,Y,O,V,U,se,te,K,ae,fe,pe=T.w_size;do{if(V=T.window_size-T.lookahead-T.strstart,T.strstart>=pe+(pe-F)){for(a.arraySet(T.window,T.window,pe,pe,0),T.match_start-=pe,T.strstart-=pe,T.block_start-=pe,q=Y=T.hash_size;O=T.head[--q],T.head[q]=pe<=O?O-pe:0,--Y;);for(q=Y=pe;O=T.prev[--q],T.prev[q]=pe<=O?O-pe:0,--Y;);V+=pe}if(T.strm.avail_in===0)break;if(se=T.strm,te=T.window,K=T.strstart+T.lookahead,ae=V,fe=void 0,fe=se.avail_in,ae=N)for(U=T.strstart-T.insert,T.ins_h=T.window[U],T.ins_h=(T.ins_h<=N&&(T.ins_h=(T.ins_h<=N)if(O=l._tr_tally(T,T.strstart-T.match_start,T.match_length-N),T.lookahead-=T.match_length,T.match_length<=T.max_lazy_match&&T.lookahead>=N){for(T.match_length--;T.strstart++,T.ins_h=(T.ins_h<=N&&(T.ins_h=(T.ins_h<=N&&T.match_length<=T.prev_length){for(V=T.strstart+T.lookahead-N,O=l._tr_tally(T,T.strstart-1-T.prev_match,T.prev_length-N),T.lookahead-=T.prev_length-1,T.prev_length-=2;++T.strstart<=V&&(T.ins_h=(T.ins_h<T.pending_buf_size-5&&(Y=T.pending_buf_size-5);;){if(T.lookahead<=1){if(oe(T),T.lookahead===0&&q===u)return M;if(T.lookahead===0)break}T.strstart+=T.lookahead,T.lookahead=0;var O=T.block_start+Y;if((T.strstart===0||T.strstart>=O)&&(T.lookahead=T.strstart-O,T.strstart=O,H(T,!1),T.strm.avail_out===0)||T.strstart-T.block_start>=T.w_size-F&&(H(T,!1),T.strm.avail_out===0))return M}return T.insert=0,q===g?(H(T,!0),T.strm.avail_out===0?ee:$):(T.strstart>T.block_start&&(H(T,!1),T.strm.avail_out),M)}),new me(4,4,8,4,he),new me(4,5,16,8,he),new me(4,6,32,32,he),new me(4,4,16,16,le),new me(8,16,32,32,le),new me(8,16,128,128,le),new me(8,32,128,256,le),new me(32,128,258,1024,le),new me(32,258,258,4096,le)],r.deflateInit=function(T,q){return J(T,q,A,15,8,0)},r.deflateInit2=J,r.deflateReset=z,r.deflateResetKeep=be,r.deflateSetHeader=function(T,q){return T&&T.state?T.state.wrap!==2?y:(T.state.gzhead=q,b):y},r.deflate=function(T,q){var Y,O,V,U;if(!T||!T.state||5>8&255),ue(O,O.gzhead.time>>16&255),ue(O,O.gzhead.time>>24&255),ue(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),ue(O,255&O.gzhead.os),O.gzhead.extra&&O.gzhead.extra.length&&(ue(O,255&O.gzhead.extra.length),ue(O,O.gzhead.extra.length>>8&255)),O.gzhead.hcrc&&(T.adler=d(T.adler,O.pending_buf,O.pending,0)),O.gzindex=0,O.status=69):(ue(O,0),ue(O,0),ue(O,0),ue(O,0),ue(O,0),ue(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),ue(O,3),O.status=k);else{var se=A+(O.w_bits-8<<4)<<8;se|=(2<=O.strategy||O.level<2?0:O.level<6?1:O.level===6?2:3)<<6,O.strstart!==0&&(se|=32),se+=31-se%31,O.status=k,ne(O,se),O.strstart!==0&&(ne(O,T.adler>>>16),ne(O,65535&T.adler)),T.adler=1}if(O.status===69)if(O.gzhead.extra){for(V=O.pending;O.gzindex<(65535&O.gzhead.extra.length)&&(O.pending!==O.pending_buf_size||(O.gzhead.hcrc&&O.pending>V&&(T.adler=d(T.adler,O.pending_buf,O.pending-V,V)),Q(T),V=O.pending,O.pending!==O.pending_buf_size));)ue(O,255&O.gzhead.extra[O.gzindex]),O.gzindex++;O.gzhead.hcrc&&O.pending>V&&(T.adler=d(T.adler,O.pending_buf,O.pending-V,V)),O.gzindex===O.gzhead.extra.length&&(O.gzindex=0,O.status=73)}else O.status=73;if(O.status===73)if(O.gzhead.name){V=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>V&&(T.adler=d(T.adler,O.pending_buf,O.pending-V,V)),Q(T),V=O.pending,O.pending===O.pending_buf_size)){U=1;break}U=O.gzindexV&&(T.adler=d(T.adler,O.pending_buf,O.pending-V,V)),U===0&&(O.gzindex=0,O.status=91)}else O.status=91;if(O.status===91)if(O.gzhead.comment){V=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>V&&(T.adler=d(T.adler,O.pending_buf,O.pending-V,V)),Q(T),V=O.pending,O.pending===O.pending_buf_size)){U=1;break}U=O.gzindexV&&(T.adler=d(T.adler,O.pending_buf,O.pending-V,V)),U===0&&(O.status=103)}else O.status=103;if(O.status===103&&(O.gzhead.hcrc?(O.pending+2>O.pending_buf_size&&Q(T),O.pending+2<=O.pending_buf_size&&(ue(O,255&T.adler),ue(O,T.adler>>8&255),T.adler=0,O.status=k)):O.status=k),O.pending!==0){if(Q(T),T.avail_out===0)return O.last_flush=-1,b}else if(T.avail_in===0&&ie(q)<=ie(Y)&&q!==g)return re(T,-5);if(O.status===666&&T.avail_in!==0)return re(T,-5);if(T.avail_in!==0||O.lookahead!==0||q!==u&&O.status!==666){var te=O.strategy===2?function(K,ae){for(var fe;;){if(K.lookahead===0&&(oe(K),K.lookahead===0)){if(ae===u)return M;break}if(K.match_length=0,fe=l._tr_tally(K,0,K.window[K.strstart]),K.lookahead--,K.strstart++,fe&&(H(K,!1),K.strm.avail_out===0))return M}return K.insert=0,ae===g?(H(K,!0),K.strm.avail_out===0?ee:$):K.last_lit&&(H(K,!1),K.strm.avail_out===0)?M:G}(O,q):O.strategy===3?function(K,ae){for(var fe,pe,ye,ve,ce=K.window;;){if(K.lookahead<=R){if(oe(K),K.lookahead<=R&&ae===u)return M;if(K.lookahead===0)break}if(K.match_length=0,K.lookahead>=N&&0K.lookahead&&(K.match_length=K.lookahead)}if(K.match_length>=N?(fe=l._tr_tally(K,1,K.match_length-N),K.lookahead-=K.match_length,K.strstart+=K.match_length,K.match_length=0):(fe=l._tr_tally(K,0,K.window[K.strstart]),K.lookahead--,K.strstart++),fe&&(H(K,!1),K.strm.avail_out===0))return M}return K.insert=0,ae===g?(H(K,!0),K.strm.avail_out===0?ee:$):K.last_lit&&(H(K,!1),K.strm.avail_out===0)?M:G}(O,q):o[O.level].func(O,q);if(te!==ee&&te!==$||(O.status=666),te===M||te===ee)return T.avail_out===0&&(O.last_flush=-1),b;if(te===G&&(q===1?l._tr_align(O):q!==5&&(l._tr_stored_block(O,0,0,!1),q===3&&(de(O.head),O.lookahead===0&&(O.strstart=0,O.block_start=0,O.insert=0))),Q(T),T.avail_out===0))return O.last_flush=-1,b}return q!==g?b:O.wrap<=0?1:(O.wrap===2?(ue(O,255&T.adler),ue(O,T.adler>>8&255),ue(O,T.adler>>16&255),ue(O,T.adler>>24&255),ue(O,255&T.total_in),ue(O,T.total_in>>8&255),ue(O,T.total_in>>16&255),ue(O,T.total_in>>24&255)):(ne(O,T.adler>>>16),ne(O,65535&T.adler)),Q(T),0=Y.w_size&&(U===0&&(de(Y.head),Y.strstart=0,Y.block_start=0,Y.insert=0),ae=new a.Buf8(Y.w_size),a.arraySet(ae,q,fe-Y.w_size,Y.w_size,0),q=ae,fe=Y.w_size),se=T.avail_in,te=T.next_in,K=T.input,T.avail_in=fe,T.next_in=0,T.input=q,oe(Y);Y.lookahead>=N;){for(O=Y.strstart,V=Y.lookahead-(N-1);Y.ins_h=(Y.ins_h<>>=N=I>>>24,E-=N,(N=I>>>16&255)===0)G[m++]=65535&I;else{if(!(16&N)){if(!(64&N)){I=_[(65535&I)+(A&(1<>>=N,E-=N),E<15&&(A+=M[c++]<>>=N=I>>>24,E-=N,!(16&(N=I>>>16&255))){if(!(64&N)){I=w[(65535&I)+(A&(1<>>=N,E-=N,(N=m-u)>3,A&=(1<<(E-=R<<3))-1,o.next_in=c,o.next_out=m,o.avail_in=c>>24&255)+(B>>>8&65280)+((65280&B)<<8)+((255&B)<<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 E(B){var k;return B&&B.state?(k=B.state,B.total_in=B.total_out=k.total=0,B.msg="",k.wrap&&(B.adler=1&k.wrap),k.mode=y,k.last=0,k.havedict=0,k.dmax=32768,k.head=null,k.hold=0,k.bits=0,k.lencode=k.lendyn=new o.Buf32(S),k.distcode=k.distdyn=new o.Buf32(v),k.sane=1,k.back=-1,g):b}function _(B){var k;return B&&B.state?((k=B.state).wsize=0,k.whave=0,k.wnext=0,E(B)):b}function w(B,k){var M,G;return B&&B.state?(G=B.state,k<0?(M=0,k=-k):(M=1+(k>>4),k<48&&(k&=15)),k&&(k<8||15=$.wsize?(o.arraySet($.window,k,M-$.wsize,$.wsize,0),$.wnext=0,$.whave=$.wsize):(G<(ee=$.wsize-$.wnext)&&(ee=G),o.arraySet($.window,k,M-G,ee,$.wnext),(G-=ee)?(o.arraySet($.window,k,M-G,G,0),$.wnext=G,$.whave=$.wsize):($.wnext+=ee,$.wnext===$.wsize&&($.wnext=0),$.whave<$.wsize&&($.whave+=ee))),0}r.inflateReset=_,r.inflateReset2=w,r.inflateResetKeep=E,r.inflateInit=function(B){return C(B,15)},r.inflateInit2=C,r.inflate=function(B,k){var M,G,ee,$,re,ie,de,Q,H,ue,ne,W,oe,he,le,me,Ae,be,z,J,T,q,Y,O,V=0,U=new o.Buf8(4),se=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!B||!B.state||!B.output||!B.input&&B.avail_in!==0)return b;(M=B.state).mode===12&&(M.mode=13),re=B.next_out,ee=B.output,de=B.avail_out,$=B.next_in,G=B.input,ie=B.avail_in,Q=M.hold,H=M.bits,ue=ie,ne=de,q=g;e:for(;;)switch(M.mode){case y:if(M.wrap===0){M.mode=13;break}for(;H<16;){if(ie===0)break e;ie--,Q+=G[$++]<>>8&255,M.check=l(M.check,U,2,0),H=Q=0,M.mode=2;break}if(M.flags=0,M.head&&(M.head.done=!1),!(1&M.wrap)||(((255&Q)<<8)+(Q>>8))%31){B.msg="incorrect header check",M.mode=30;break}if((15&Q)!=8){B.msg="unknown compression method",M.mode=30;break}if(H-=4,T=8+(15&(Q>>>=4)),M.wbits===0)M.wbits=T;else if(T>M.wbits){B.msg="invalid window size",M.mode=30;break}M.dmax=1<>8&1),512&M.flags&&(U[0]=255&Q,U[1]=Q>>>8&255,M.check=l(M.check,U,2,0)),H=Q=0,M.mode=3;case 3:for(;H<32;){if(ie===0)break e;ie--,Q+=G[$++]<>>8&255,U[2]=Q>>>16&255,U[3]=Q>>>24&255,M.check=l(M.check,U,4,0)),H=Q=0,M.mode=4;case 4:for(;H<16;){if(ie===0)break e;ie--,Q+=G[$++]<>8),512&M.flags&&(U[0]=255&Q,U[1]=Q>>>8&255,M.check=l(M.check,U,2,0)),H=Q=0,M.mode=5;case 5:if(1024&M.flags){for(;H<16;){if(ie===0)break e;ie--,Q+=G[$++]<>>8&255,M.check=l(M.check,U,2,0)),H=Q=0}else M.head&&(M.head.extra=null);M.mode=6;case 6:if(1024&M.flags&&(ie<(W=M.length)&&(W=ie),W&&(M.head&&(T=M.head.extra_len-M.length,M.head.extra||(M.head.extra=new Array(M.head.extra_len)),o.arraySet(M.head.extra,G,$,W,T)),512&M.flags&&(M.check=l(M.check,G,W,$)),ie-=W,$+=W,M.length-=W),M.length))break e;M.length=0,M.mode=7;case 7:if(2048&M.flags){if(ie===0)break e;for(W=0;T=G[$+W++],M.head&&T&&M.length<65536&&(M.head.name+=String.fromCharCode(T)),T&&W>9&1,M.head.done=!0),B.adler=M.check=0,M.mode=12;break;case 10:for(;H<32;){if(ie===0)break e;ie--,Q+=G[$++]<>>=7&H,H-=7&H,M.mode=27;break}for(;H<3;){if(ie===0)break e;ie--,Q+=G[$++]<>>=1)){case 0:M.mode=14;break;case 1:if(R(M),M.mode=20,k!==6)break;Q>>>=2,H-=2;break e;case 2:M.mode=17;break;case 3:B.msg="invalid block type",M.mode=30}Q>>>=2,H-=2;break;case 14:for(Q>>>=7&H,H-=7&H;H<32;){if(ie===0)break e;ie--,Q+=G[$++]<>>16^65535)){B.msg="invalid stored block lengths",M.mode=30;break}if(M.length=65535&Q,H=Q=0,M.mode=15,k===6)break e;case 15:M.mode=16;case 16:if(W=M.length){if(ie>>=5,H-=5,M.ndist=1+(31&Q),Q>>>=5,H-=5,M.ncode=4+(15&Q),Q>>>=4,H-=4,286>>=3,H-=3}for(;M.have<19;)M.lens[se[M.have++]]=0;if(M.lencode=M.lendyn,M.lenbits=7,Y={bits:M.lenbits},q=d(0,M.lens,0,19,M.lencode,0,M.work,Y),M.lenbits=Y.bits,q){B.msg="invalid code lengths set",M.mode=30;break}M.have=0,M.mode=19;case 19:for(;M.have>>16&255,Ae=65535&V,!((le=V>>>24)<=H);){if(ie===0)break e;ie--,Q+=G[$++]<>>=le,H-=le,M.lens[M.have++]=Ae;else{if(Ae===16){for(O=le+2;H>>=le,H-=le,M.have===0){B.msg="invalid bit length repeat",M.mode=30;break}T=M.lens[M.have-1],W=3+(3&Q),Q>>>=2,H-=2}else if(Ae===17){for(O=le+3;H>>=le)),Q>>>=3,H-=3}else{for(O=le+7;H>>=le)),Q>>>=7,H-=7}if(M.have+W>M.nlen+M.ndist){B.msg="invalid bit length repeat",M.mode=30;break}for(;W--;)M.lens[M.have++]=T}}if(M.mode===30)break;if(M.lens[256]===0){B.msg="invalid code -- missing end-of-block",M.mode=30;break}if(M.lenbits=9,Y={bits:M.lenbits},q=d(m,M.lens,0,M.nlen,M.lencode,0,M.work,Y),M.lenbits=Y.bits,q){B.msg="invalid literal/lengths set",M.mode=30;break}if(M.distbits=6,M.distcode=M.distdyn,Y={bits:M.distbits},q=d(u,M.lens,M.nlen,M.ndist,M.distcode,0,M.work,Y),M.distbits=Y.bits,q){B.msg="invalid distances set",M.mode=30;break}if(M.mode=20,k===6)break e;case 20:M.mode=21;case 21:if(6<=ie&&258<=de){B.next_out=re,B.avail_out=de,B.next_in=$,B.avail_in=ie,M.hold=Q,M.bits=H,c(B,ne),re=B.next_out,ee=B.output,de=B.avail_out,$=B.next_in,G=B.input,ie=B.avail_in,Q=M.hold,H=M.bits,M.mode===12&&(M.back=-1);break}for(M.back=0;me=(V=M.lencode[Q&(1<>>16&255,Ae=65535&V,!((le=V>>>24)<=H);){if(ie===0)break e;ie--,Q+=G[$++]<>be)])>>>16&255,Ae=65535&V,!(be+(le=V>>>24)<=H);){if(ie===0)break e;ie--,Q+=G[$++]<>>=be,H-=be,M.back+=be}if(Q>>>=le,H-=le,M.back+=le,M.length=Ae,me===0){M.mode=26;break}if(32&me){M.back=-1,M.mode=12;break}if(64&me){B.msg="invalid literal/length code",M.mode=30;break}M.extra=15&me,M.mode=22;case 22:if(M.extra){for(O=M.extra;H>>=M.extra,H-=M.extra,M.back+=M.extra}M.was=M.length,M.mode=23;case 23:for(;me=(V=M.distcode[Q&(1<>>16&255,Ae=65535&V,!((le=V>>>24)<=H);){if(ie===0)break e;ie--,Q+=G[$++]<>be)])>>>16&255,Ae=65535&V,!(be+(le=V>>>24)<=H);){if(ie===0)break e;ie--,Q+=G[$++]<>>=be,H-=be,M.back+=be}if(Q>>>=le,H-=le,M.back+=le,64&me){B.msg="invalid distance code",M.mode=30;break}M.offset=Ae,M.extra=15&me,M.mode=24;case 24:if(M.extra){for(O=M.extra;H>>=M.extra,H-=M.extra,M.back+=M.extra}if(M.offset>M.dmax){B.msg="invalid distance too far back",M.mode=30;break}M.mode=25;case 25:if(de===0)break e;if(W=ne-de,M.offset>W){if((W=M.offset-W)>M.whave&&M.sane){B.msg="invalid distance too far back",M.mode=30;break}oe=W>M.wnext?(W-=M.wnext,M.wsize-W):M.wnext-W,W>M.length&&(W=M.length),he=M.window}else he=ee,oe=re-M.offset,W=M.length;for(deP?(N=oe[he+v[k]],H[ue+v[k]]):(N=96,0),A=1<>re)+(E-=A)]=I<<24|N<<16|R|0,E!==0;);for(A=1<>=1;if(A!==0?(Q&=A-1,Q+=A):Q=0,k++,--ne[B]==0){if(B===G)break;B=u[g+v[k]]}if(ee>>7)]}function ue(V,U){V.pending_buf[V.pending++]=255&U,V.pending_buf[V.pending++]=U>>>8&255}function ne(V,U,se){V.bi_valid>x-se?(V.bi_buf|=U<>x-V.bi_valid,V.bi_valid+=se-x):(V.bi_buf|=U<>>=1,se<<=1,0<--U;);return se>>>1}function he(V,U,se){var te,K,ae=new Array(v+1),fe=0;for(te=1;te<=v;te++)ae[te]=fe=fe+se[te-1]<<1;for(K=0;K<=U;K++){var pe=V[2*K+1];pe!==0&&(V[2*K]=oe(ae[pe]++,pe))}}function le(V){var U;for(U=0;U>1;1<=se;se--)be(V,ae,se);for(K=ye;se=V.heap[1],V.heap[1]=V.heap[V.heap_len--],be(V,ae,1),te=V.heap[1],V.heap[--V.heap_max]=se,V.heap[--V.heap_max]=te,ae[2*K]=ae[2*se]+ae[2*te],V.depth[K]=(V.depth[se]>=V.depth[te]?V.depth[se]:V.depth[te])+1,ae[2*se+1]=ae[2*te+1]=K,V.heap[1]=K++,be(V,ae,1),2<=V.heap_len;);V.heap[--V.heap_max]=V.heap[1],function(ce,Se){var we,Pe,Be,Me,Ne,Le,Ce=Se.dyn_tree,ze=Se.max_code,We=Se.stat_desc.static_tree,ut=Se.stat_desc.has_stree,Je=Se.stat_desc.extra_bits,je=Se.stat_desc.extra_base,tt=Se.stat_desc.max_length,Ze=0;for(Me=0;Me<=v;Me++)ce.bl_count[Me]=0;for(Ce[2*ce.heap[ce.heap_max]+1]=0,we=ce.heap_max+1;we>=7;K>>=1)if(1&ve&&pe.dyn_ltree[2*ye]!==0)return a;if(pe.dyn_ltree[18]!==0||pe.dyn_ltree[20]!==0||pe.dyn_ltree[26]!==0)return l;for(ye=32;ye>>3,(ae=V.static_len+3+7>>>3)<=K&&(K=ae)):K=ae=se+5,se+4<=K&&U!==-1?O(V,U,se,te):V.strategy===4||ae===K?(ne(V,2+(te?1:0),3),z(V,F,B)):(ne(V,4+(te?1:0),3),function(pe,ye,ve,ce){var Se;for(ne(pe,ye-257,5),ne(pe,ve-1,5),ne(pe,ce-4,4),Se=0;Se>>8&255,V.pending_buf[V.d_buf+2*V.last_lit+1]=255&U,V.pending_buf[V.l_buf+V.last_lit]=255&se,V.last_lit++,U===0?V.dyn_ltree[2*se]++:(V.matches++,U--,V.dyn_ltree[2*(M[se]+u+1)]++,V.dyn_dtree[2*H(U)]++),V.last_lit===V.lit_bufsize-1},r._tr_align=function(V){ne(V,2,3),W(V,E,F),function(U){U.bi_valid===16?(ue(U,U.bi_buf),U.bi_buf=0,U.bi_valid=0):8<=U.bi_valid&&(U.pending_buf[U.pending++]=255&U.bi_buf,U.bi_buf>>=8,U.bi_valid-=8)}(V)}},{"../utils/common":41}],53:[function(t,s,r){s.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,s,r){s.exports=typeof setImmediate=="function"?setImmediate:function(){var o=[].slice.apply(arguments);o.splice(1,0,0),setTimeout.apply(null,o)}},{}]},{},[10])(10)})})(jszip_min);class MXLHelper{static MXLtoIXmlElement(e){const t=new jszip_minExports;return t.loadAsync(e).then(o=>t.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 t.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 t=new jszip_minExports;return t.loadAsync(e).then(s=>t.file("META-INF/container.xml").async("text"),s=>{throw loglevelExports.error(s),s}).then(s=>{const a=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("rootfile")[0].getAttribute("full-path");return t.file(a).async("text")},s=>{throw s})}}class PlaybackNoteGenerator{calculate(e){const t=new MusicPartManagerIterator(e);for(;!t.EndReached;){const s=t.CurrentEnrolledTimestamp,r=t.CurrentAudibleVoiceEntries();for(const o of r)this.handleVoiceEntry(e,o,s);t.moveToNext()}}handleVoiceEntry(e,t,s){if(t.IsGrace)return;const r=t.ParentVoice;let o;e.PlaybackDataDict.containsKey(r)?o=e.PlaybackDataDict.getValue(r):(o=[],e.PlaybackDataDict.setValue(r,o));for(const a of t.PlaybackEntries)if(a.HasNotes){for(const c of a.Notes)c.setLength();const l=Fraction$1.plus(s,a.TimestampShift);PlaybackNoteGenerator.addEntrySorted(o,a,l)}}static addEntrySorted(e,t,s){if(e.length===0)e.push({enrolledTimestamp:s,playbackEntry:t});else for(let r=e.length-1;r>=0;r--){const o=e[r];if(s.RealValue>o.enrolledTimestamp.RealValue)if(r===e.length-1){e.push({enrolledTimestamp:s,playbackEntry:t});break}else{e.splice(r+1,0,{enrolledTimestamp:s,playbackEntry:t});break}}}}class ScreenViewingRegion{constructor(e,t,s,r){this.psi=new BoundingBox$1(void 0),this.displaySizeInPixel=e,this.RelativeDisplaySize=t,this.RelativeDisplayPosition=s,this.WidthInUnits=r}static createWithRelativeDefaults(e,t){return new ScreenViewingRegion(e,new SizeF2D(1,1),new PointF2D(0,0),t)}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,t){const s=this.psi.collisionDetection(e);return this.psi.liesInsideBorders(e),s}isInsideDisplayArea(e,t){return this.RelativeDisplayPosition.x<=e&&e<=this.RelativeDisplayPosition.x+this.RelativeDisplaySize.width&&this.RelativeDisplayPosition.y<=t&&t<=this.RelativeDisplayPosition.y+this.RelativeDisplaySize.height}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,t){if(!this.convertToUnitsReady())return;const s=this.getPositionInUnits(e,t);this.unitPosTouched(s,e,t)}get TouchActive(){return this.displayInteractionManager.TouchActive}get TouchMoving(){return this.displayInteractionManager.TouchMoving}positionDoubleTouched(e,t){if(!this.convertToUnitsReady())return;const s=this.getPositionInUnits(e,t);this.unitPosDoubleTouched(s,e,t)}get UsesManuallyControlledZoomMode(){return this.usesManuallyControlledZoomMode}set UsesManuallyControlledZoomMode(e){this.usesManuallyControlledZoomMode=e}mouseDown(e,t,s=!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 r=this.getPositionInUnits(e,t);this.unitPosTouchDown(r,e,t),this.usesManuallyControlledZoomMode||(s?this.mouseZoomMode=!0:this.mouseZoomMode=!1)}mouseUp(e,t){const s=this.getPositionInUnits(e,t);this.unitPosTouchUp(s,e,t)}mouseMove(e,t,s,r){this.mouseZoomMode?(Math.abs(s-0)>1e-8&&(this.RangeX=Math.abs(this.lastRangeX/(1+s))),!this.lockRanges&&Math.abs(r-0)>1e-8&&(this.RangeY=Math.abs(this.lastRangeY/(1-r)))):(Math.abs(s-0)>1e-8&&(this.OffsetX=this.lastOffsetX-s*this.RangeX),Math.abs(r-0)>1e-8&&(this.OffsetY=this.lastOffsetY-r*this.RangeY));const o=this.getPositionInUnits(e,t);this.unitPosMove(o,e,t)}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 t of this.zoomViews)t.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(i[i.SingleTouch=0]="SingleTouch",i[i.DoubleTouch=1]="DoubleTouch",i[i.TouchUp=2]="TouchUp",i[i.TouchDown=3]="TouchDown",i[i.Move=4]="Move",i))(InteractionType||{});class VoiceEntryInteractionListener{constructor(e){this.renderingManager=e}userDisplayInteraction(e,t,s){var r,o;switch(s){case InteractionType.TouchDown:case InteractionType.SingleTouch:case InteractionType.DoubleTouch:{const a=this.renderingManager.GraphicalMusicSheet.GetNearestVoiceEntry(t);a&&a.parentStaffEntry.parentVerticalContainer!==void 0&&((r=a.notes[0])==null?void 0:r.sourceNote.Pitch)!==void 0&&((o=this.renderingManager.PlaybackManager)==null||o.playVoiceEntry(a.parentVoiceEntry));break}}}}class SheetRenderingManager extends AbstractZoomView{constructor(e,t){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=t,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,t,s){if(!this.SingleTouchDisabled){const r=new PointF2D(t,s);this.handleUserDisplayInteraction(r,e,InteractionType.SingleTouch)}}unitPosDoubleTouched(e,t,s){if(!this.DoubleTouchDisabled){const r=new PointF2D(t,s);this.handleUserDisplayInteraction(r,e,InteractionType.DoubleTouch)}}unitPosTouchDown(e,t,s){const r=new PointF2D(t,s);this.handleUserDisplayInteraction(r,e,InteractionType.TouchDown),this.yOffsetMouseDown=e.y}unitPosTouchUp(e,t,s){const r=new PointF2D(t,s);this.handleUserDisplayInteraction(r,e,InteractionType.TouchUp),this.displayInteractionManager.WasZoomGestureActive===!1&&this.unlockFromCursorIfNecessary(e),this.yOffsetMouseDown=Number.MIN_VALUE}unitPosMove(e,t,s){const r=new PointF2D(t,s);this.handleUserDisplayInteraction(r,e,InteractionType.Move),this.unlockFromCursorIfNecessary(e)}get MainViewingRegion(){return this.mainViewingRegion}setMusicSheet(e){this.graphicalMusicSheet=e,this.adaptDisplayLimitsToSheet(),this.setYOffset(0,!0)}viewportXChanged(e,t){this.graphicalMusicSheet!==void 0&&this.horizontalViewportChanged(e,t)}viewportYChanged(e,t){this.graphicalMusicSheet!==void 0&&(this.yOffsetMouseDown<=Number.MIN_VALUE+.5&&(this.yOffsetMouseDown=e),this.verticalViewportChanged(e,t))}displaySizeChanged(e,t){super.viewSizeChanged(e,t),!(Math.abs(e-0)<1e-7||Math.abs(t-0)<1e-7)&&(this.graphicalMusicSheet!==void 0&&this.graphicalMusicSheet.EnforceRedrawOfMusicSystems(),this.mainViewingRegion.DisplaySizeInPixel=new SizeF2D(e,t),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,t,s,r,o,a){const l=this.calcDisplayYPosition(r);this.setYPosition(l,a)}setXPosition(e,t){this.LockDisplayToCursor&&this.setXOffset(e,t)}setYPosition(e,t){this.LockDisplayToCursor&&this.setYOffset(e,t)}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,t){return this.mainViewingRegion.transformToUnitCoordinates(new PointF2D(e,t))}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,t){this.mainViewingRegion.WidthInUnits!==t&&(this.mainViewingRegion.WidthInUnits=t)}verticalViewportChanged(e,t){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,t){return this.mainViewingRegion.transformToUnitCoordinates(new PointF2D(e,t))}handleUserDisplayInteraction(e,t,s){switch(s){case InteractionType.TouchDown:case InteractionType.SingleTouch:case InteractionType.DoubleTouch:{const r=this.graphicalMusicSheet.GetNearestVoiceEntry(t);if(r){const o=new CustomEvent("note-click",{detail:{...r,setAvtivePlay:()=>{var a,l;if(r.parentStaffEntry.parentVerticalContainer!==void 0){const c=r.parentStaffEntry.parentVerticalContainer.AbsoluteTimestamp;this.setStartPosition(c),((a=r.notes[0])==null?void 0:a.sourceNote.Pitch)!==void 0&&(console.log("playback clicked note",r.parentVoiceEntry),(l=this.PlaybackManager)==null||l.playVoiceEntry(r.parentVoiceEntry))}}}});window.dispatchEvent(o)}}case InteractionType.TouchUp:case InteractionType.TouchDown:case InteractionType.Move:for(const r of this.listeners)r.userDisplayInteraction(e,t,s);break;default:throw new Error("type")}}setStartPosition(e){var t;this.graphicalMusicSheet!==void 0&&(this.graphicalMusicSheet.ParentMusicSheet.SelectionStart=e,(t=this.PlaybackManager)==null||t.reset())}get GraphicalMusicSheet(){return this.graphicalMusicSheet}}class WebSheetRenderingManager extends SheetRenderingManager{mouseMove(e,t,s,r){const o=this.getPositionInUnits(e,t);this.unitPosMove(o,e,t)}}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,t){this.displayWidth=e,this.displayHeight=t;for(const s of this.listeners)s.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,t,s){this.interactionWasZoomGesture=!1;const r=e/this.displayWidth,o=t/this.displayHeight;this.lastRelPosX=r,this.lastRelPosY=o,this.lastPixelX=e,this.lastPixelY=t,this.touchActive=!0,this.touchMoving=!1,this.touchCount=Math.min(this.touchCount+1,this.maxNumerOfFingers);for(const a of this.listeners)a.mouseDown(r,o,!s)}move(e,t){if(this.touchActive&&!this.zoomGestureActive){const s=e/this.displayWidth,r=t/this.displayHeight,o=s-this.lastRelPosX,a=r-this.lastRelPosY;this.touchMoving=!0;for(const l of this.listeners)l.mouseMove(s,r,o,a)}}zoomGestureStarted(){this.zoomGestureActive=!0}zoomGestureCompleted(){this.zoomGestureActive=!1,this.interactionWasZoomGesture=!0}zoomGestureMove(e){this.zoomGestureActive&&this.listeners.forEach(function(t){t.zoom(e)})}touchUp(e,t){this.touchActive=!1,this.touchMoving=!1,this.touchCount=Math.max(0,this.touchCount-1);const s=e/this.displayWidth,r=t/this.displayHeight;for(const o of this.listeners)o.mouseUp(s,r)}click(e,t){if(!this.mouseDidMove(this.lastPixelX,e,this.lastPixelY,t)&&!this.ZoomGestureActive){const s=e/this.displayWidth,r=t/this.displayHeight;for(const o of this.listeners)o.positionTouched(s,r)}}doubleClick(e,t){if(!this.mouseDidMove(this.lastPixelX,e,this.lastPixelY,t)&&!this.ZoomGestureActive){const s=e/this.displayWidth,r=t/this.displayHeight;for(const o of this.listeners)o.positionDoubleTouched(s,r)}}mouseDidMove(e,t,s,r){const o=Math.abs(e-t)/this.displayDpi,a=Math.abs(s-r)/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,t){clearTimeout(t.timeout),t.timeout=setTimeout(()=>{t.fullOffsetLeft=0,t.fullOffsetTop=0;let s=t.osmdSheetMusicContainer;for(;s;)t.fullOffsetLeft+=s.offsetLeft,t.fullOffsetTop+=s.offsetTop,s=s.offsetParent;t.resizeEventListener(),t.deregisterScrollOffsets(),t.registerScrollOffsets()},500)}registerScrollOffsets(){let e=this.osmdSheetMusicContainer;this.fullScrollTop=0,this.fullScrollLeft=0;const t=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 s=function(r){const o=t.parentScrollMap.get(this),a=o[0],l=o[1];t.fullScrollTop=t.fullScrollTop-a+this.scrollTop,t.fullScrollLeft=t.fullScrollLeft-l+this.scrollLeft,t.parentScrollMap.set(this,[this.scrollTop,this.scrollLeft])};this.scrollCallbackMap.set(e,s),e.addEventListener("scroll",s)}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 t=[],s=this;for(window.ResizeObserver&&(this.resizeObserver=new ResizeObserver(r=>{WebDisplayInteractionManager.resizeCallback(r,s)}));e;)this.fullOffsetLeft+=e.offsetLeft,this.fullOffsetTop+=e.offsetTop,this.resizeObserver?this.resizeObserver.observe(e):t.push(e),e=e.offsetParent;if(this.resizeObserver)this.disposeResizeListener=()=>{s.resizeObserver.disconnect(),s.resizeObserver=void 0};else{let r=()=>{WebDisplayInteractionManager.resizeCallback(t,s)};window.addEventListener("resize",r),this.disposeResizeListener=()=>{window.removeEventListener("resize",r),r=void 0}}s.registerScrollOffsets()}dispose(){this.disposeResizeListener();for(const e of this.EventCallbackMap.keys()){const t=this.EventCallbackMap.getValue(e);t[0].removeEventListener(e,t[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 t=["(",["-webkit-","-moz-","-o-","-ms-"].join("touch-enabled),("),"heartz",")"].join("");return window.matchMedia(t).matches}get downEventName(){return this.isTouch()?"touchstart":"mousedown"}get moveEventName(){return this.isTouch()?"touchmove":"mousemove"}listenForInteractions(){const e=this.downEventListener.bind(this),t=this.touchEndEventListener.bind(this),s=this.moveEventListener.bind(this);this.osmdSheetMusicContainer.addEventListener("mousedown",e),this.osmdSheetMusicContainer.addEventListener("touchend",t),document.addEventListener(this.moveEventName,s),this.EventCallbackMap.setValue("mousedown",[this.osmdSheetMusicContainer,e]),this.EventCallbackMap.setValue("touchend",[this.osmdSheetMusicContainer,t]),this.EventCallbackMap.setValue(this.moveEventName,[document,s])}downEventListener(e){const t=new Date().getTime(),s=t-this.lastClick;clearTimeout(this.clickTimeout);let r=0,o=0;this.isTouch()&&e instanceof TouchEvent?(r=e.touches[0].pageX,o=e.touches[0].pageY):e instanceof MouseEvent&&(r=e.pageX,o=e.pageY);const a=this.getOffsetCoordinates(r,o);if(s0)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=t}moveEventListener(e){let t=0,s=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]),t=o==null?void 0:o.clientX,s=o==null?void 0:o.clientY}else e instanceof MouseEvent&&(t=e.clientX,s=e.clientY);const r=this.getOffsetCoordinates(t,s);this.move(r.x,r.y)}touchEndEventListener(e){let t;e.touches&&e.touches.length>0?t=e.touches[0]:e.changedTouches&&e.changedTouches.length>0&&(t=e.changedTouches[0]);const s=this.getOffsetCoordinates(t==null?void 0:t.pageX,t==null?void 0:t.pageY);this.touchUp(s.x,s.y)}resizeEventListener(){this.displaySizeChanged(this.osmdSheetMusicContainer.clientWidth,this.osmdSheetMusicContainer.clientHeight)}getOffsetCoordinates(e,t){const s=e-this.fullOffsetLeft+this.fullScrollLeft,r=t-this.fullOffsetTop+this.fullScrollTop;return new PointF2D(s,r)}}class DynamicsCalculator{static fillDynamicsList(e,t,s){for(let r=0;r=0&&s[c].push(new DynamicsContainer(l.InstantaneousDynamic,c))}if(l.StartingContinuousDynamic!==void 0){s[r].push(new DynamicsContainer(l.StartingContinuousDynamic,l.StaffNumber));const c=this.getOtherStaffIndexIfLinkedStavesAreDetected(e,r,l.StartingContinuousDynamic.Placement);c>=0&&s[c].push(new DynamicsContainer(l.StartingContinuousDynamic,c))}}}}static getOtherStaffIndexIfLinkedStavesAreDetected(e,t,s){const r=e.getStaffFromIndex(t),o=r.ParentInstrument.Staves.indexOf(r),a=r.ParentInstrument.Staves.length;return a>1&&o===0&&s===PlacementEnum.Below?t+1:a>1&&o===1&&s===PlacementEnum.Above?t-1:-1}static fillDynamicExpressions(e){const t=e.DynListStaves,s=e.getCompleteNumberOfStaves(),r=e.TimestampSortedDynamicExpressionsList;for(let o=0;o{e(this.processStringXml(s))},s=>{loglevelExports.error(new Error("[OSMD] Invalid MXL file: "+s)),t(new Error("[OSMD] Invalid MXL file: "+s))})}processStringXml(i){const e=new DOMParser;if(i.substr(0,3)==="")return loglevelExports.debug("[OSMD] UTF with BOM detected, truncate first three bytes and pass along: "+i),e.parseFromString(i.substr(3),"application/xml");if(i.substr(0,6).includes("{t.isMxl(u)?t.processMxl(u,l,c):l(t.processStringXml(u))},u=>{throw c(u),u});else{const u=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 i=this.container.offsetWidth;this.rules.RenderSingleHorizontalStaffline&&(i=this.rules.SheetMaximumWidth),this.sheet.pageWidth=i/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(t=>{t.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 i=this.container.offsetWidth;this.rules.RenderSingleHorizontalStaffline&&(i=this.graphic.MusicPages[0].PositionAndShape.Size.width*10*this.zoom);let e;const t=32767;for(const s of this.graphic.MusicPages){if(s.PageNumber>this.rules.MaxPageToDrawNumber)break;const r=this.createBackend(this.backendType,s),o=" exceeds CanvasBackend limit of 32767. Cutting off score.";r.getOSMDBackendType()===BackendType.Canvas&&i>t&&(loglevelExports.warn("[OSMD] Warning: width of "+i+o),i=t),this.rules.PageFormat&&!this.rules.PageFormat.IsUndefined?e=i/this.rules.PageFormat.aspectRatio:(e=s.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),r.getOSMDBackendType()===BackendType.Canvas&&e>t&&(loglevelExports.warn("[OSMD] Warning: height of "+e+o),e=Math.min(e,t)),r.resize(i,e),r.clear(),this.drawer.Backends.push(r),this.graphic.drawer=this.drawer}}exportSVG(){var i;for(const e of(i=this.drawer)==null?void 0:i.Backends)e instanceof SvgVexFlowBackend&&e.export()}IsReadyToRender(){return this.graphic!==void 0}clear(){var i;(i=this.drawer)==null||i.clear(),this.reset()}dispose(){this.disposeResizeListener&&this.disposeResizeListener(),this.InteractionManager&&this.InteractionManager.Dispose()}setOptions(i){if(this.rules||(this.rules=new EngravingRules),this.drawingParameters||(this.drawingParameters=new DrawingParameters,this.drawingParameters.Rules=this.rules),i==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(r){return r},i.onXMLRead&&(this.OnXMLRead=i.onXMLRead),i.drawingParameters&&(this.drawingParameters.DrawingParametersEnum=DrawingParametersEnum[i.drawingParameters.toLowerCase()]);let t=!this.drawer||!this.drawer.Backends||this.drawer.Backends.length<1;if(i.backend!==void 0){const r=OSMDOptions.BackendTypeFromString(i.backend);t=t||this.backendType!==r,this.backendType=r}this.needBackendUpdate=t,i.autoBeam!==void 0&&(this.rules.AutoBeamNotes=i.autoBeam);const s=i.autoBeamOptions;if(s&&(s.maintain_stem_directions===void 0&&(s.maintain_stem_directions=!1),this.rules.AutoBeamOptions=s,s.groups&&s.groups.length)){for(const r of s.groups)if(r.length!==2)throw new Error("Each fraction in autoBeamOptions.groups must be of length 2, e.g. [3,4] for beaming three fourths")}i.percussionOneLineCutoff!==void 0&&(this.rules.PercussionOneLineCutoff=i.percussionOneLineCutoff),this.rules.PercussionOneLineCutoff!==0&&i.percussionForceVoicesOneLineCutoff!==void 0&&(this.rules.PercussionForceVoicesOneLineCutoff=i.percussionForceVoicesOneLineCutoff),i.alignRests!==void 0&&(this.rules.AlignRests=i.alignRests),i.coloringMode!==void 0&&this.setColoringMode(i),i.coloringEnabled!==void 0&&(this.rules.ColoringEnabled=i.coloringEnabled),i.colorStemsLikeNoteheads!==void 0&&(this.rules.ColorStemsLikeNoteheads=i.colorStemsLikeNoteheads),i.disableCursor&&(this.drawingParameters.drawCursors=!1),i.drawHiddenNotes&&(this.drawingParameters.drawHiddenNotes=!0),i.drawCredits!==void 0&&(this.drawingParameters.DrawCredits=i.drawCredits),i.drawComposer!==void 0&&(this.drawingParameters.DrawComposer=i.drawComposer),i.drawTitle!==void 0&&(this.drawingParameters.DrawTitle=i.drawTitle),i.drawSubtitle!==void 0&&(this.drawingParameters.DrawSubtitle=i.drawSubtitle),i.drawLyricist!==void 0&&(this.drawingParameters.DrawLyricist=i.drawLyricist),i.drawMetronomeMarks!==void 0&&(this.rules.MetronomeMarksDrawn=i.drawMetronomeMarks),i.drawPartNames!==void 0&&(this.drawingParameters.DrawPartNames=i.drawPartNames,i.drawPartAbbreviations||(this.rules.RenderPartAbbreviations=i.drawPartNames)),i.drawPartAbbreviations!==void 0&&(this.rules.RenderPartAbbreviations=i.drawPartAbbreviations),i.drawFingerings===!1&&(this.rules.RenderFingerings=!1),i.drawMeasureNumbers!==void 0&&(this.rules.RenderMeasureNumbers=i.drawMeasureNumbers),i.drawMeasureNumbersOnlyAtSystemStart&&(this.rules.RenderMeasureNumbersOnlyAtSystemStart=i.drawMeasureNumbersOnlyAtSystemStart),i.drawLyrics!==void 0&&(this.rules.RenderLyrics=i.drawLyrics),i.drawTimeSignatures!==void 0&&(this.rules.RenderTimeSignatures=i.drawTimeSignatures),i.drawSlurs!==void 0&&(this.rules.RenderSlurs=i.drawSlurs),i.measureNumberInterval!==void 0&&(this.rules.MeasureNumberLabelOffset=i.measureNumberInterval),i.useXMLMeasureNumbers!==void 0&&(this.rules.UseXMLMeasureNumbers=i.useXMLMeasureNumbers),i.fingeringPosition!==void 0&&(this.rules.FingeringPosition=AbstractExpression.PlacementEnumFromString(i.fingeringPosition)),i.fingeringInsideStafflines!==void 0&&(this.rules.FingeringInsideStafflines=i.fingeringInsideStafflines),i.newSystemFromXML!==void 0&&(this.rules.NewSystemAtXMLNewSystemAttribute=i.newSystemFromXML),i.newPageFromXML!==void 0&&(this.rules.NewPageAtXMLNewPageAttribute=i.newPageFromXML),i.fillEmptyMeasuresWithWholeRest!==void 0&&(this.rules.FillEmptyMeasuresWithWholeRest=i.fillEmptyMeasuresWithWholeRest),i.followCursor!==void 0&&(this.FollowCursor=i.followCursor),i.setWantedStemDirectionByXml!==void 0&&(this.rules.SetWantedStemDirectionByXml=i.setWantedStemDirectionByXml),i.darkMode?(this.rules.applyDefaultColorMusic("#FFFFFF"),this.rules.PageBackgroundColor="#000000"):i.darkMode===!1&&(this.rules.applyDefaultColorMusic("#000000"),this.rules.PageBackgroundColor=void 0),i.defaultColorMusic&&this.rules.applyDefaultColorMusic(i.defaultColorMusic),i.defaultColorNotehead&&(this.rules.DefaultColorNotehead=i.defaultColorNotehead),i.defaultColorRest&&(this.rules.DefaultColorRest=i.defaultColorRest),i.defaultColorStem&&(this.rules.DefaultColorStem=i.defaultColorStem),i.defaultColorLabel&&(this.rules.DefaultColorLabel=i.defaultColorLabel),i.defaultColorTitle&&(this.rules.DefaultColorTitle=i.defaultColorTitle),i.defaultFontFamily&&(this.rules.DefaultFontFamily=i.defaultFontFamily),i.defaultFontStyle&&(this.rules.DefaultFontStyle=i.defaultFontStyle),i.drawUpToMeasureNumber&&(this.rules.MaxMeasureToDrawIndex=i.drawUpToMeasureNumber-1),i.drawFromMeasureNumber&&(this.rules.MinMeasureToDrawIndex=i.drawFromMeasureNumber-1),i.drawUpToPageNumber&&(this.rules.MaxPageToDrawNumber=i.drawUpToPageNumber),i.drawUpToSystemNumber&&(this.rules.MaxSystemToDrawNumber=i.drawUpToSystemNumber),i.tupletsRatioed&&(this.rules.TupletsRatioed=!0),i.tupletsBracketed&&(this.rules.TupletsBracketed=!0),i.tripletsBracketed&&(this.rules.TripletsBracketed=!0),i.autoResize?(this.resizeHandlerAttached||this.autoResize(),this.autoResizeEnabled=!0):i.autoResize===!1&&(this.autoResizeEnabled=!1),i.pageFormat!==void 0&&this.setPageFormat(i.pageFormat),i.pageBackgroundColor!==void 0&&(this.rules.PageBackgroundColor=i.pageBackgroundColor),i.performanceMode!==void 0&&(this.rules.PerformanceMode=i.performanceMode),i.renderSingleHorizontalStaffline!==void 0&&(this.rules.RenderSingleHorizontalStaffline=i.renderSingleHorizontalStaffline),i.spacingFactorSoftmax!==void 0&&(this.rules.SoftmaxFactorVexFlow=i.spacingFactorSoftmax),i.spacingBetweenTextLines!==void 0&&(this.rules.SpacingBetweenTextLines=i.spacingBetweenTextLines),i.stretchLastSystemLine!==void 0&&(this.rules.StretchLastSystemLine=i.stretchLastSystemLine),i.autoGenerateMutipleRestMeasuresFromRestMeasures!==void 0&&(this.rules.AutoGenerateMutipleRestMeasuresFromRestMeasures=i.autoGenerateMutipleRestMeasuresFromRestMeasures),i.cursorsOptions!==void 0?this.cursorsOptions=i.cursorsOptions:this.cursorsOptions=[{type:0,color:this.EngravingRules.DefaultColorCursor,alpha:.5,follow:!0}]}setColoringMode(i){if(i.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 t;if(i.coloringMode===ColoringModes.CustomColorSet){if(!i.coloringSetCustom||i.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 r of i.coloringSetCustom)if(!/^\#[0-9a-fA-F]{6}$/.test(r))throw new Error(`One of the color strings in options.coloringSetCustom was not a valid HTML Hex color: `+r);t=i.coloringSetCustom}else if(i.coloringMode===ColoringModes.AutoColoring){t=[];const r=Object.keys(AutoColorSet);for(let o=0;o{i.hide()}),this.sheet=void 0,this.graphic=void 0,this.zoom=1}autoResize(){const i=this;this.handleResize(()=>{},()=>{var e;((e=this.graphic)==null?void 0:e.GetCalculator)instanceof VexFlowMusicSheetCalculator&&(this.graphic.GetCalculator.beamsNeedUpdate=!0),i.IsReadyToRender()&&i.render()})}handleResize(i,e){let t,s;const o=this;function a(){o.AutoResizeEnabled&&(t=new Date().getTime(),s||(i(),t=new Date().getTime(),s=window.setTimeout(l,200)))}function l(){s=void 0,window.clearTimeout(s),new Date().getTime()-t<200?s=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(i,0),window.setTimeout(e,1)}enableOrDisableCursors(i){var e,t,s,r,o,a;if(this.drawingParameters.drawCursors=i,i){for(let l=0;l{l.hide()})}createBackend(i,e){let t;return i===void 0||i===BackendType.SVG?t=new SvgVexFlowBackend(this.rules):t=new CanvasVexFlowBackend(this.rules),t.graphicalMusicPage=e,t.initialize(this.container,this.zoom),t.getContext().setFillStyle(this.rules.DefaultColorMusic),t.getContext().setStrokeStyle(this.rules.DefaultColorMusic),t}static StringToPageFormat(i){let e=PageFormat.UndefinedPageFormat;if(i.match("^[0-9]+x[0-9]+$")){const t=i.split("x"),s=Number.parseInt(t[0],10),r=Number.parseInt(t[1],10);s>0&&s<32768&&r>0&&r<32768&&(e=new PageFormat(s,r,`customPageFormat${i}`))}return i=i.replace(" ","_"),i=i.replace("Landscape","L"),i=i.replace("Portrait","P"),_OpenSheetMusicDisplay.PageFormatStandards.hasOwnProperty(i)&&(e=_OpenSheetMusicDisplay.PageFormatStandards[i]),e}setPageFormat(i){const e=_OpenSheetMusicDisplay.StringToPageFormat(i);this.needBackendUpdate=!e.Equals(this.rules.PageFormat),this.rules.PageFormat=e}setCustomPageFormat(i,e){if(i>0&&e>0){const t=new PageFormat(i,e);this.rules.PageFormat=t}}set DrawSkyLine(i){this.drawSkyLine=i,this.drawer&&(this.drawer.skyLineVisible=i)}get DrawSkyLine(){return this.drawer.skyLineVisible}set DrawBottomLine(i){this.drawBottomLine=i,this.drawer&&(this.drawer.bottomLineVisible=i)}get DrawBottomLine(){return this.drawer.bottomLineVisible}set DrawBoundingBox(i){this.setDrawBoundingBox(i,!0)}get DrawBoundingBox(){return this.drawBoundingBox}setDrawBoundingBox(i,e=!1){this.drawBoundingBox=i,this.drawer&&(this.drawer.drawableBoundingBoxElement=i),e&&this.render()}get AutoResizeEnabled(){return this.autoResizeEnabled}set AutoResizeEnabled(i){this.autoResizeEnabled=i}get Zoom(){return this.zoom}set Zoom(i){var e;this.zoom=i,this.zoomUpdated=!0,((e=this.graphic)==null?void 0:e.GetCalculator)instanceof VexFlowMusicSheetCalculator&&(this.graphic.GetCalculator.beamsNeedUpdate=this.zoomUpdated)}set FollowCursor(i){this.followCursor=i}get FollowCursor(){return this.followCursor}set TransposeCalculator(i){MusicSheetCalculator.transposeCalculator=i}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(i){handlebarsExports=i}},handlebars_runtimeExports={},handlebars_runtime={get exports(){return handlebars_runtimeExports},set exports(i){handlebars_runtimeExports=i}},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(i){return escape$1[i]}function extend(i){for(var e=1;e0?(o.ids&&(o.ids=[o.name]),s.helpers.each(r,o)):a(this);if(o.data&&o.ids){var c=t.createFrame(o.data);c.contextPath=t.appendContextPath(o.data.contextPath,o.name),o={data:c}}return l(r,o)})},i.exports=e.default})(blockHelperMissing,blockHelperMissingExports);var eachExports={},each$8={get exports(){return eachExports},set exports(i){eachExports=i}};(function(i,e){e.__esModule=!0;function t(a){return a&&a.__esModule?a:{default:a}}var s=utils,r=exceptionExports,o=t(r);e.default=function(a){a.registerHelper("each",function(l,c){if(!c)throw new o.default("Must pass iterator to #each");var d=c.fn,m=c.inverse,u=0,g="",b=void 0,y=void 0;c.data&&c.ids&&(y=s.appendContextPath(c.data.contextPath,c.ids[0])+"."),s.isFunction(l)&&(l=l.call(this)),c.data&&(b=s.createFrame(c.data));function S(_,w,C){b&&(b.key=_,b.index=w,b.first=w===0,b.last=!!C,y&&(b.contextPath=y+_)),g=g+d(l[_],{data:b,blockParams:s.blockParams([l[_],_],[y+_,null])})}if(l&&typeof l=="object")if(s.isArray(l))for(var v=l.length;u=0?o=a:o=parseInt(o,10)}return o},log:function(o){if(o=s.lookupLevel(o),typeof console<"u"&&s.lookupLevel(s.level)<=o){var a=s.methodMap[o];console[a]||(a="log");for(var l=arguments.length,c=Array(l>1?l-1:0),d=1;d= 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(i,e,t){this.helpers=i||{},this.partials=e||{},this.decorators=t||{},_helpers$2.registerDefaultHelpers(this),_decorators.registerDefaultDecorators(this)}HandlebarsEnvironment.prototype={constructor:HandlebarsEnvironment,logger:_logger2.default,log:_logger2.default.log,registerHelper:function(e,t){if(_utils$3.toString.call(e)===objectType){if(t)throw new _exception2$3.default("Arg not supported with multiple helpers");_utils$3.extend(this.helpers,e)}else this.helpers[e]=t},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if(_utils$3.toString.call(e)===objectType)_utils$3.extend(this.partials,e);else{if(typeof t>"u")throw new _exception2$3.default('Attempting to register a partial called "'+e+'" as undefined');this.partials[e]=t}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,t){if(_utils$3.toString.call(e)===objectType){if(t)throw new _exception2$3.default("Arg not supported with multiple decorators");_utils$3.extend(this.decorators,e)}else this.decorators[e]=t},unregisterDecorator:function(e){delete this.decorators[e]},resetLoggedPropertyAccesses:function(){_internalProtoAccess$1.resetLoggedProperties()}};var log=_logger2.default.log;base$1.log=log;base$1.createFrame=_utils$3.createFrame;base$1.logger=_logger2.default;var safeStringExports={},safeString={get exports(){return safeStringExports},set exports(i){safeStringExports=i}};(function(i,e){e.__esModule=!0;function t(s){this.string=s}t.prototype.toString=t.prototype.toHTML=function(){return""+this.string},e.default=t,i.exports=e.default})(safeString,safeStringExports);var runtime={},wrapHelper$1={};wrapHelper$1.__esModule=!0;wrapHelper$1.wrapHelper=wrapHelper;function wrapHelper(i,e){if(typeof i!="function")return i;var t=function(){var r=arguments[arguments.length-1];return arguments[arguments.length-1]=e(r),i.apply(this,arguments)};return t}runtime.__esModule=!0;runtime.checkRevision=checkRevision;runtime.template=template;runtime.wrapProgram=wrapProgram;runtime.resolvePartial=resolvePartial;runtime.invokePartial=invokePartial;runtime.noop=noop;function _interopRequireDefault$3(i){return i&&i.__esModule?i:{default:i}}function _interopRequireWildcard$1(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t]);return e.default=i,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(i){var e=i&&i[0]||1,t=_base.COMPILER_REVISION;if(!(e>=_base.LAST_COMPATIBLE_COMPILER_REVISION&&e<=_base.COMPILER_REVISION))if(e<_base.LAST_COMPATIBLE_COMPILER_REVISION){var s=_base.REVISION_CHANGES[t],r=_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 ("+s+") or downgrade your runtime to an older version ("+r+").")}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 ("+i[1]+").")}function template(i,e){if(!e)throw new _exception2$2.default("No environment passed to template");if(!i||!i.main)throw new _exception2$2.default("Unknown template object: "+typeof i);i.main.decorator=i.main_d,e.VM.checkRevision(i.compiler);var t=i.compiler&&i.compiler[0]===7;function s(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 d=Utils.extend({},c,{hooks:this.hooks,protoAccessControl:this.protoAccessControl}),m=e.VM.invokePartial.call(this,a,l,d);if(m==null&&e.compile&&(c.partials[c.name]=e.compile(a,i.compilerOptions,e),m=c.partials[c.name](l,d)),m!=null){if(c.indent){for(var u=m.split(` `),g=0,b=u.length;g"u"&&(this.lexer.yylloc={});var v=this.lexer.yylloc;u.push(v);var x=this.lexer.options&&this.lexer.options.ranges;typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);function A(){var k;return k=c.lexer.lex()||1,typeof k!="number"&&(k=c.symbols_[k]||k),k}for(var E,_,w,C,P={},I,N,R,F;;){if(_=d[d.length-1],this.defaultActions[_]?w=this.defaultActions[_]:((E===null||typeof E>"u")&&(E=A()),w=g[_]&&g[_][E]),typeof w>"u"||!w.length||!w[0]){var B="";{F=[];for(I in g[_])this.terminals_[I]&&I>2&&F.push("'"+this.terminals_[I]+"'");this.lexer.showPosition?B="Parse error on line "+(y+1)+`: `+this.lexer.showPosition()+` Expecting `+F.join(", ")+", got '"+(this.terminals_[E]||E)+"'":B="Parse error on line "+(y+1)+": Unexpected "+(E==1?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(B,{text:this.lexer.match,token:this.terminals_[E]||E,line:this.lexer.yylineno,loc:v,expected:F})}}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+_+", token: "+E);switch(w[0]){case 1:d.push(E),m.push(this.lexer.yytext),u.push(this.lexer.yylloc),d.push(w[1]),E=null,S=this.lexer.yyleng,b=this.lexer.yytext,y=this.lexer.yylineno,v=this.lexer.yylloc;break;case 2:if(N=this.productions_[w[1]][1],P.$=m[m.length-N],P._$={first_line:u[u.length-(N||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(N||1)].first_column,last_column:u[u.length-1].last_column},x&&(P._$.range=[u[u.length-(N||1)].range[0],u[u.length-1].range[1]]),C=this.performAction.call(P,b,S,y,this.yy,w[1],m,u),typeof C<"u")return C;N&&(d=d.slice(0,-1*N*2),m=m.slice(0,-1*N),u=u.slice(0,-1*N)),d.push(this.productions_[w[1]][0]),m.push(P.$),u.push(P._$),R=g[d[d.length-2]][d[d.length-1]],d.push(R);break;case 3:return!0}}return!0}},r=function(){var a={EOF:1,parseError:function(c,d){if(this.yy.parser)this.yy.parser.parseError(c,d);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 d=c.match(/(?:\r\n?|\n).*/g);return d?(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 d=c.length,m=c.split(/(?:\r\n?|\n)/g);this._input=c+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d-1),this.offset-=d;var u=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===u.length?this.yylloc.first_column:0)+u[u.length-m.length].length-m[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[g[0],g[0]+this.yyleng-d]),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(),d=new Array(c.length+1).join("-");return c+this.upcomingInput()+` `+d+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var c,d,m,u,g;this._more||(this.yytext="",this.match="");for(var b=this._currentRules(),y=0;yd[0].length)&&(d=m,u=y,!this.options.flex)));y++);return d?(g=d[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+d[0].length},this.yytext+=d[0],this.match+=d[0],this.matches=d,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(d[0].length),this.matched+=d[0],c=this.performAction.call(this,this.yy,this,b[u],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,d,m,u){function g(b,y){return d.yytext=d.yytext.substring(b,d.yyleng-y+b)}switch(m){case 0:if(d.yytext.slice(-2)==="\\\\"?(g(0,1),this.begin("mu")):d.yytext.slice(-1)==="\\"?(g(0,1),this.begin("emu")):this.begin("mu"),d.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(d.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 d.yytext=g(1,2).replace(/\\"/g,'"'),80;case 32:return d.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 d.yytext=d.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}();s.lexer=r;function o(){this.yy={}}return o.prototype=s,s.Parser=o,new o}();e.default=t,i.exports=e.default})(parser$1,parserExports);var whitespaceControlExports={},whitespaceControl={get exports(){return whitespaceControlExports},set exports(i){whitespaceControlExports=i}},visitorExports={},visitor={get exports(){return visitorExports},set exports(i){visitorExports=i}};(function(i,e){e.__esModule=!0;function t(d){return d&&d.__esModule?d:{default:d}}var s=exceptionExports,r=t(s);function o(){this.parents=[]}o.prototype={constructor:o,mutating:!1,acceptKey:function(m,u){var g=this.accept(m[u]);if(this.mutating){if(g&&!o.prototype[g.type])throw new r.default('Unexpected node type "'+g.type+'" found when accepting '+u+" on "+m.type);m[u]=g}},acceptRequired:function(m,u){if(this.acceptKey(m,u),!m[u])throw new r.default(m.type+" requires "+u)},acceptArray:function(m){for(var u=0,g=m.length;u0)throw new _exception2$1.default("Invalid path: "+s,{loc:t});c===".."&&o++}else r.push(c)}return{type:"PathExpression",data:i,depth:o,parts:r,original:s,loc:t}}function prepareMustache(i,e,t,s,r,o){var a=s.charAt(3)||s.charAt(2),l=a!=="{"&&a!=="&",c=/\*/.test(s);return{type:c?"Decorator":"MustacheStatement",path:i,params:e,hash:t,escaped:l,strip:r,loc:this.locInfo(o)}}function prepareRawBlock(i,e,t,s){validateClose(i,t),s=this.locInfo(s);var r={type:"Program",body:e,strip:{},loc:s};return{type:"BlockStatement",path:i.path,params:i.params,hash:i.hash,program:r,openStrip:{},inverseStrip:{},closeStrip:{},loc:s}}function prepareBlock(i,e,t,s,r,o){s&&s.path&&validateClose(i,s);var a=/\*/.test(i.open);e.blockParams=i.blockParams;var l=void 0,c=void 0;if(t){if(a)throw new _exception2$1.default("Unexpected inverse block on decorator",t);t.chain&&(t.program.body[0].closeStrip=s.strip),c=t.strip,l=t.program}return r&&(r=l,l=e,e=r),{type:a?"DecoratorBlock":"BlockStatement",path:i.path,params:i.params,hash:i.hash,program:e,inverse:l,openStrip:i.strip,inverseStrip:c,closeStrip:s&&s.strip,loc:this.locInfo(o)}}function prepareProgram(i,e){if(!e&&i.length){var t=i[0].loc,s=i[i.length-1].loc;t&&s&&(e={source:t.source,start:{line:t.start.line,column:t.start.column},end:{line:s.end.line,column:s.end.column}})}return{type:"Program",body:i,strip:{},loc:e}}function preparePartialBlock(i,e,t,s){return validateClose(i,t),{type:"PartialBlockStatement",name:i.path,params:i.params,hash:i.hash,program:e,openStrip:i.strip,closeStrip:t&&t.strip,loc:this.locInfo(s)}}base.__esModule=!0;base.parseWithoutProcessing=parseWithoutProcessing;base.parse=parse$2;function _interopRequireWildcard(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t]);return e.default=i,e}function _interopRequireDefault$1(i){return i&&i.__esModule?i:{default:i}}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(i,e){if(i.type==="Program")return i;_parser2.default.yy=yy,yy.locInfo=function(s){return new yy.SourceLocation(e&&e.srcName,s)};var t=_parser2.default.parse(i);return t}function parse$2(i,e){var t=parseWithoutProcessing(i,e),s=new _whitespaceControl2.default(e);return s.accept(t)}var compiler={};compiler.__esModule=!0;compiler.Compiler=Compiler;compiler.precompile=precompile;compiler.compile=compile;function _interopRequireDefault(i){return i&&i.__esModule?i:{default:i}}var _exception=exceptionExports,_exception2=_interopRequireDefault(_exception),_utils=utils,_ast=astExports,_ast2=_interopRequireDefault(_ast),slice$2=[].slice;function Compiler(){}Compiler.prototype={compiler:Compiler,equals:function(e){var t=this.opcodes.length;if(e.opcodes.length!==t)return!1;for(var s=0;s1)throw new _exception2.default("Unsupported number of partial arguments: "+s.length,e);s.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):s.push({type:"PathExpression",parts:[],depth:0}));var r=e.name.original,o=e.name.type==="SubExpression";o&&this.accept(e.name),this.setupFullMustacheParams(e,t,void 0,!0);var a=e.indent||"";this.options.preventIndent&&a&&(this.opcode("appendContent",a),a=""),this.opcode("invokePartial",o,r,a),this.opcode("append")},PartialBlockStatement:function(e){this.PartialStatement(e)},MustacheStatement:function(e){this.SubExpression(e),e.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(e){this.DecoratorBlock(e)},ContentStatement:function(e){e.value&&this.opcode("appendContent",e.value)},CommentStatement:function(){},SubExpression:function(e){transformLiteralToPath(e);var t=this.classifySexpr(e);t==="simple"?this.simpleSexpr(e):t==="helper"?this.helperSexpr(e):this.ambiguousSexpr(e)},ambiguousSexpr:function(e,t,s){var r=e.path,o=r.parts[0],a=t!=null||s!=null;this.opcode("getContext",r.depth),this.opcode("pushProgram",t),this.opcode("pushProgram",s),r.strict=!0,this.accept(r),this.opcode("invokeAmbiguous",o,a)},simpleSexpr:function(e){var t=e.path;t.strict=!0,this.accept(t),this.opcode("resolvePossibleLambda")},helperSexpr:function(e,t,s){var r=this.setupFullMustacheParams(e,t,s),o=e.path,a=o.parts[0];if(this.options.knownHelpers[a])this.opcode("invokeKnownHelper",r.length,a);else{if(this.options.knownHelpersOnly)throw new _exception2.default("You specified knownHelpersOnly, but used the unknown helper "+a,e);o.strict=!0,o.falsy=!0,this.accept(o),this.opcode("invokeHelper",r.length,o.original,_ast2.default.helpers.simpleId(o))}},PathExpression:function(e){this.addDepth(e.depth),this.opcode("getContext",e.depth);var t=e.parts[0],s=_ast2.default.helpers.scopedId(e),r=!e.depth&&!s&&this.blockParamIndex(t);r?this.opcode("lookupBlockParam",r,e.parts):t?e.data?(this.options.data=!0,this.opcode("lookupData",e.depth,e.parts,e.strict)):this.opcode("lookupOnContext",e.parts,e.falsy,e.strict,s):this.opcode("pushContext")},StringLiteral:function(e){this.opcode("pushString",e.value)},NumberLiteral:function(e){this.opcode("pushLiteral",e.value)},BooleanLiteral:function(e){this.opcode("pushLiteral",e.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(e){var t=e.pairs,s=0,r=t.length;for(this.opcode("pushHash");s=0)return[t,o]}}};function precompile(i,e,t){if(i==null||typeof i!="string"&&i.type!=="Program")throw new _exception2.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+i);e=e||{},"data"in e||(e.data=!0),e.compat&&(e.useDepths=!0);var s=t.parse(i,e),r=new t.Compiler().compile(s,e);return new t.JavaScriptCompiler().compile(r,e)}function compile(i,e,t){if(e===void 0&&(e={}),i==null||typeof i!="string"&&i.type!=="Program")throw new _exception2.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+i);e=_utils.extend({},e),"data"in e||(e.data=!0),e.compat&&(e.useDepths=!0);var s=void 0;function r(){var a=t.parse(i,e),l=new t.Compiler().compile(a,e),c=new t.JavaScriptCompiler().compile(l,e,void 0,!0);return t.template(c)}function o(a,l){return s||(s=r()),s.call(this,a,l)}return o._setup=function(a){return s||(s=r()),s._setup(a)},o._child=function(a,l,c,d){return s||(s=r()),s._child(a,l,c,d)},o}function argEquals(i,e){if(i===e)return!0;if(_utils.isArray(i)&&_utils.isArray(e)&&i.length===e.length){for(var t=0;t>1;return c?-d:d}return base64Vlq.encode=function(c){var d="",m,u=o(c);do m=u&s,u>>>=e,u>0&&(m|=r),d+=i.encode(m);while(u>0);return d},base64Vlq.decode=function(c,d,m){var u=c.length,g=0,b=0,y,S;do{if(d>=u)throw new Error("Expected more digits in base 64 VLQ value.");if(S=i.decode(c.charCodeAt(d++)),S===-1)throw new Error("Invalid base64 digit: "+c.charAt(d-1));y=!!(S&r),S&=s,g=g+(S<=0;F--)N=I[F],N==="."?I.splice(F,1):N===".."?R++:R>0&&(N===""?(I.splice(F+1,R),R=0):(I.splice(F,2),R--));return w=I.join("/"),w===""&&(w=P?"/":"."),C?(C.path=w,o(C)):w}i.normalize=a;function l(_,w){_===""&&(_="."),w===""&&(w=".");var C=r(w),P=r(_);if(P&&(_=P.path||"/"),C&&!C.scheme)return P&&(C.scheme=P.scheme),o(C);if(C||w.match(s))return w;if(P&&!P.host&&!P.path)return P.host=w,o(P);var I=w.charAt(0)==="/"?w:a(_.replace(/\/+$/,"")+"/"+w);return P?(P.path=I,o(P)):I}i.join=l,i.isAbsolute=function(_){return _.charAt(0)==="/"||t.test(_)};function c(_,w){_===""&&(_="."),_=_.replace(/\/$/,"");for(var C=0;w.indexOf(_+"/")!==0;){var P=_.lastIndexOf("/");if(P<0||(_=_.slice(0,P),_.match(/^([^\/]+:\/)?\/*$/)))return w;++C}return Array(C+1).join("../")+w.substr(_.length+1)}i.relative=c;var d=function(){var _=Object.create(null);return!("__proto__"in _)}();function m(_){return _}function u(_){return b(_)?"$"+_:_}i.toSetString=d?m:u;function g(_){return b(_)?_.slice(1):_}i.fromSetString=d?m:g;function b(_){if(!_)return!1;var w=_.length;if(w<9||_.charCodeAt(w-1)!==95||_.charCodeAt(w-2)!==95||_.charCodeAt(w-3)!==111||_.charCodeAt(w-4)!==116||_.charCodeAt(w-5)!==111||_.charCodeAt(w-6)!==114||_.charCodeAt(w-7)!==112||_.charCodeAt(w-8)!==95||_.charCodeAt(w-9)!==95)return!1;for(var C=w-10;C>=0;C--)if(_.charCodeAt(C)!==36)return!1;return!0}function y(_,w,C){var P=v(_.source,w.source);return P!==0||(P=_.originalLine-w.originalLine,P!==0)||(P=_.originalColumn-w.originalColumn,P!==0||C)||(P=_.generatedColumn-w.generatedColumn,P!==0)||(P=_.generatedLine-w.generatedLine,P!==0)?P:v(_.name,w.name)}i.compareByOriginalPositions=y;function S(_,w,C){var P=_.generatedLine-w.generatedLine;return P!==0||(P=_.generatedColumn-w.generatedColumn,P!==0||C)||(P=v(_.source,w.source),P!==0)||(P=_.originalLine-w.originalLine,P!==0)||(P=_.originalColumn-w.originalColumn,P!==0)?P:v(_.name,w.name)}i.compareByGeneratedPositionsDeflated=S;function v(_,w){return _===w?0:_===null?1:w===null?-1:_>w?1:-1}function x(_,w){var C=_.generatedLine-w.generatedLine;return C!==0||(C=_.generatedColumn-w.generatedColumn,C!==0)||(C=v(_.source,w.source),C!==0)||(C=_.originalLine-w.originalLine,C!==0)||(C=_.originalColumn-w.originalColumn,C!==0)?C:v(_.name,w.name)}i.compareByGeneratedPositionsInflated=x;function A(_){return JSON.parse(_.replace(/^\)]}'[^\n]*\n/,""))}i.parseSourceMapInput=A;function E(_,w,C){if(w=w||"",_&&(_[_.length-1]!=="/"&&w[0]!=="/"&&(_+="/"),w=_+w),C){var P=r(C);if(!P)throw new Error("sourceMapURL could not be parsed");if(P.path){var I=P.path.lastIndexOf("/");I>=0&&(P.path=P.path.substring(0,I+1))}w=l(o(P),w)}return a(w)}i.computeSourceURL=E}(util$7)),util$7}var arraySet={},hasRequiredArraySet;function requireArraySet(){if(hasRequiredArraySet)return arraySet;hasRequiredArraySet=1;var i=requireUtil(),e=Object.prototype.hasOwnProperty,t=typeof Map<"u";function s(){this._array=[],this._set=t?new Map:Object.create(null)}return s.fromArray=function(o,a){for(var l=new s,c=0,d=o.length;c=0)return a}else{var l=i.toSetString(o);if(e.call(this._set,l))return this._set[l]}throw new Error('"'+o+'" is not in the set.')},s.prototype.at=function(o){if(o>=0&&oo||a==o&&c>=l||i.compareByGeneratedPositionsInflated(s,r)<=0}function t(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}return t.prototype.unsortedForEach=function(r,o){this._array.forEach(r,o)},t.prototype.add=function(r){e(this._last,r)?(this._last=r,this._array.push(r)):(this._sorted=!1,this._array.push(r))},t.prototype.toArray=function(){return this._sorted||(this._array.sort(i.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},mappingList.MappingList=t,mappingList}var hasRequiredSourceMapGenerator;function requireSourceMapGenerator(){if(hasRequiredSourceMapGenerator)return sourceMapGenerator;hasRequiredSourceMapGenerator=1;var i=requireBase64Vlq(),e=requireUtil(),t=requireArraySet().ArraySet,s=requireMappingList().MappingList;function r(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 t,this._names=new t,this._mappings=new s,this._sourcesContents=null}return r.prototype._version=3,r.fromSourceMap=function(a){var l=a.sourceRoot,c=new r({file:a.file,sourceRoot:l});return a.eachMapping(function(d){var m={generated:{line:d.generatedLine,column:d.generatedColumn}};d.source!=null&&(m.source=d.source,l!=null&&(m.source=e.relative(l,m.source)),m.original={line:d.originalLine,column:d.originalColumn},d.name!=null&&(m.name=d.name)),c.addMapping(m)}),a.sources.forEach(function(d){var m=d;l!==null&&(m=e.relative(l,d)),c._sources.has(m)||c._sources.add(m);var u=a.sourceContentFor(d);u!=null&&c.setSourceContent(d,u)}),c},r.prototype.addMapping=function(a){var l=e.getArg(a,"generated"),c=e.getArg(a,"original",null),d=e.getArg(a,"source",null),m=e.getArg(a,"name",null);this._skipValidation||this._validateMapping(l,c,d,m),d!=null&&(d=String(d),this._sources.has(d)||this._sources.add(d)),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:d,name:m})},r.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))},r.prototype.applySourceMap=function(a,l,c){var d=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.`);d=a.file}var m=this._sourceRoot;m!=null&&(d=e.relative(m,d));var u=new t,g=new t;this._mappings.unsortedForEach(function(b){if(b.source===d&&b.originalLine!=null){var y=a.originalPositionFor({line:b.originalLine,column:b.originalColumn});y.source!=null&&(b.source=y.source,c!=null&&(b.source=e.join(c,b.source)),m!=null&&(b.source=e.relative(m,b.source)),b.originalLine=y.line,b.originalColumn=y.column,y.name!=null&&(b.name=y.name))}var S=b.source;S!=null&&!u.has(S)&&u.add(S);var v=b.name;v!=null&&!g.has(v)&&g.add(v)},this),this._sources=u,this._names=g,a.sources.forEach(function(b){var y=a.sourceContentFor(b);y!=null&&(c!=null&&(b=e.join(c,b)),m!=null&&(b=e.relative(m,b)),this.setSourceContent(b,y))},this)},r.prototype._validateMapping=function(a,l,c,d){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&&!d)){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:d}))}},r.prototype._serializeMappings=function(){for(var a=0,l=1,c=0,d=0,m=0,u=0,g="",b,y,S,v,x=this._mappings.toArray(),A=0,E=x.length;A0){if(!e.compareByGeneratedPositionsInflated(y,x[A-1]))continue;b+=","}b+=i.encode(y.generatedColumn-a),a=y.generatedColumn,y.source!=null&&(v=this._sources.indexOf(y.source),b+=i.encode(v-u),u=v,b+=i.encode(y.originalLine-1-d),d=y.originalLine-1,b+=i.encode(y.originalColumn-c),c=y.originalColumn,y.name!=null&&(S=this._names.indexOf(y.name),b+=i.encode(S-m),m=S)),g+=b}return g},r.prototype._generateSourcesContent=function(a,l){return a.map(function(c){if(!this._sourcesContents)return null;l!=null&&(c=e.relative(l,c));var d=e.toSetString(c);return Object.prototype.hasOwnProperty.call(this._sourcesContents,d)?this._sourcesContents[d]:null},this)},r.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},r.prototype.toString=function(){return JSON.stringify(this.toJSON())},sourceMapGenerator.SourceMapGenerator=r,sourceMapGenerator}var sourceMapConsumer={},binarySearch={},hasRequiredBinarySearch;function requireBinarySearch(){return hasRequiredBinarySearch||(hasRequiredBinarySearch=1,function(i){i.GREATEST_LOWER_BOUND=1,i.LEAST_UPPER_BOUND=2;function e(t,s,r,o,a,l){var c=Math.floor((s-t)/2)+t,d=a(r,o[c],!0);return d===0?c:d>0?s-c>1?e(c,s,r,o,a,l):l==i.LEAST_UPPER_BOUND?s1?e(t,c,r,o,a,l):l==i.LEAST_UPPER_BOUND?c:t<0?-1:t}i.search=function(s,r,o,a){if(r.length===0)return-1;var l=e(-1,r.length,s,r,o,a||i.GREATEST_LOWER_BOUND);if(l<0)return-1;for(;l-1>=0&&o(r[l],r[l-1],!0)===0;)--l;return l}}(binarySearch)),binarySearch}var quickSort={},hasRequiredQuickSort;function requireQuickSort(){if(hasRequiredQuickSort)return quickSort;hasRequiredQuickSort=1;function i(s,r,o){var a=s[r];s[r]=s[o],s[o]=a}function e(s,r){return Math.round(s+Math.random()*(r-s))}function t(s,r,o,a){if(o=0){var S=this._originalMappings[y];if(m.column===void 0)for(var v=S.originalLine;S&&S.originalLine===v;)b.push({line:i.getArg(S,"generatedLine",null),column:i.getArg(S,"generatedColumn",null),lastColumn:i.getArg(S,"lastGeneratedColumn",null)}),S=this._originalMappings[++y];else for(var x=S.originalColumn;S&&S.originalLine===u&&S.originalColumn==x;)b.push({line:i.getArg(S,"generatedLine",null),column:i.getArg(S,"generatedColumn",null),lastColumn:i.getArg(S,"lastGeneratedColumn",null)}),S=this._originalMappings[++y]}return b},sourceMapConsumer.SourceMapConsumer=o;function a(d,m){var u=d;typeof d=="string"&&(u=i.parseSourceMapInput(d));var g=i.getArg(u,"version"),b=i.getArg(u,"sources"),y=i.getArg(u,"names",[]),S=i.getArg(u,"sourceRoot",null),v=i.getArg(u,"sourcesContent",null),x=i.getArg(u,"mappings"),A=i.getArg(u,"file",null);if(g!=this._version)throw new Error("Unsupported version: "+g);S&&(S=i.normalize(S)),b=b.map(String).map(i.normalize).map(function(E){return S&&i.isAbsolute(S)&&i.isAbsolute(E)?i.relative(S,E):E}),this._names=t.fromArray(y.map(String),!0),this._sources=t.fromArray(b,!0),this._absoluteSources=this._sources.toArray().map(function(E){return i.computeSourceURL(S,E,m)}),this.sourceRoot=S,this.sourcesContent=v,this._mappings=x,this._sourceMapURL=m,this.file=A}a.prototype=Object.create(o.prototype),a.prototype.consumer=o,a.prototype._findSourceIndex=function(d){var m=d;if(this.sourceRoot!=null&&(m=i.relative(this.sourceRoot,m)),this._sources.has(m))return this._sources.indexOf(m);var u;for(u=0;u1&&(I.source=v+R[1],v+=R[1],I.originalLine=y+R[2],y=I.originalLine,I.originalLine+=1,I.originalColumn=S+R[3],S=I.originalColumn,R.length>4&&(I.name=x+R[4],x+=R[4])),P.push(I),typeof I.originalLine=="number"&&C.push(I)}r(P,i.compareByGeneratedPositionsDeflated),this.__generatedMappings=P,r(C,i.compareByOriginalPositions),this.__originalMappings=C},a.prototype._findMapping=function(m,u,g,b,y,S){if(m[g]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+m[g]);if(m[b]<0)throw new TypeError("Column must be greater than or equal to 0, got "+m[b]);return e.search(m,u,y,S)},a.prototype.computeColumnSpans=function(){for(var m=0;m=0){var b=this._generatedMappings[g];if(b.generatedLine===u.generatedLine){var y=i.getArg(b,"source",null);y!==null&&(y=this._sources.at(y),y=i.computeSourceURL(this.sourceRoot,y,this._sourceMapURL));var S=i.getArg(b,"name",null);return S!==null&&(S=this._names.at(S)),{source:y,line:i.getArg(b,"originalLine",null),column:i.getArg(b,"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,u){if(!this.sourcesContent)return null;var g=this._findSourceIndex(m);if(g>=0)return this.sourcesContent[g];var b=m;this.sourceRoot!=null&&(b=i.relative(this.sourceRoot,b));var y;if(this.sourceRoot!=null&&(y=i.urlParse(this.sourceRoot))){var S=b.replace(/^file:\/\//,"");if(y.scheme=="file"&&this._sources.has(S))return this.sourcesContent[this._sources.indexOf(S)];if((!y.path||y.path=="/")&&this._sources.has("/"+b))return this.sourcesContent[this._sources.indexOf("/"+b)]}if(u)return null;throw new Error('"'+b+'" is not in the SourceMap.')},a.prototype.generatedPositionFor=function(m){var u=i.getArg(m,"source");if(u=this._findSourceIndex(u),u<0)return{line:null,column:null,lastColumn:null};var g={source:u,originalLine:i.getArg(m,"line"),originalColumn:i.getArg(m,"column")},b=this._findMapping(g,this._originalMappings,"originalLine","originalColumn",i.compareByOriginalPositions,i.getArg(m,"bias",o.GREATEST_LOWER_BOUND));if(b>=0){var y=this._originalMappings[b];if(y.source===g.source)return{line:i.getArg(y,"generatedLine",null),column:i.getArg(y,"generatedColumn",null),lastColumn:i.getArg(y,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},sourceMapConsumer.BasicSourceMapConsumer=a;function c(d,m){var u=d;typeof d=="string"&&(u=i.parseSourceMapInput(d));var g=i.getArg(u,"version"),b=i.getArg(u,"sections");if(g!=this._version)throw new Error("Unsupported version: "+g);this._sources=new t,this._names=new t;var y={line:-1,column:0};this._sections=b.map(function(S){if(S.url)throw new Error("Support for url field in sections not implemented.");var v=i.getArg(S,"offset"),x=i.getArg(v,"line"),A=i.getArg(v,"column");if(x=0;c--)this.prepend(l[c]);else if(l[r]||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,d=0,m=this.children.length;d0){for(c=[],d=0;d0&&(S+=", "+v.join(", "));var x=0;Object.keys(this.aliases).forEach(function(_){var w=y.aliases[_];w.children&&w.referenceCount>1&&(S+=", alias"+ ++x+"="+_,w.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 E=this.mergeSource(S);return b?(A.push(E),Function.apply(this,A)):this.source.wrap(["function(",A.join(","),`) { `,E,"}"])},mergeSource:function(b){var y=this.environment.isSimple,S=!this.forceBuffer,v=void 0,x=void 0,A=void 0,E=void 0;return this.source.each(function(_){_.appendToBuffer?(A?_.prepend(" + "):A=_,E=_):(A&&(x?A.prepend("buffer += "):v=!0,E.add(";"),A=E=void 0),x=!0,y||(S=!1))}),S?A?(A.prepend("return "),E.add(";")):x||this.source.push('return "";'):(b+=", buffer = "+(v?"":this.initializeBuffer()),A?(A.prepend("return buffer + "),E.add(";")):this.source.push("return buffer;")),b&&this.source.prepend("var "+b.substring(2)+(v?"":`; `)),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(b){var y=this.aliasable("container.hooks.blockHelperMissing"),S=[this.contextName(0)];this.setupHelperArgs(b,0,S);var v=this.popStack();S.splice(1,0,v),this.push(this.source.functionCall(y,"call",S))},ambiguousBlockValue:function(){var b=this.aliasable("container.hooks.blockHelperMissing"),y=[this.contextName(0)];this.setupHelperArgs("",0,y,!0),this.flushInline();var S=this.topStack();y.splice(1,0,S),this.pushSource(["if (!",this.lastHelper,") { ",S," = ",this.source.functionCall(b,"call",y),"}"])},appendContent:function(b){this.pendingContent?b=this.pendingContent+b:this.pendingLocation=this.source.currentLocation,this.pendingContent=b},append:function(){if(this.isInline())this.replaceStack(function(y){return[" != null ? ",y,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var b=this.popStack();this.pushSource(["if (",b," != null) { ",this.appendToBuffer(b,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(b){this.lastContext=b},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(b,y,S,v){var x=0;!v&&this.options.compat&&!this.lastContext?this.push(this.depthedLookup(b[x++])):this.pushContext(),this.resolvePath("context",b,x,y,S)},lookupBlockParam:function(b,y){this.useBlockParams=!0,this.push(["blockParams[",b[0],"][",b[1],"]"]),this.resolvePath("context",y,1)},lookupData:function(b,y,S){b?this.pushStackLiteral("container.data(data, "+b+")"):this.pushStackLiteral("data"),this.resolvePath("data",y,0,!0,S)},resolvePath:function(b,y,S,v,x){var A=this;if(this.options.strict||this.options.assumeObjects){this.push(u(this.options.strict&&x,this,y,b));return}for(var E=y.length;Sthis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var b=this.inlineStack;this.inlineStack=[];for(var y=0,S=b.length;yi!==null&&i.isSecureContext,createNativeAudioBufferConstructor=i=>i===null?null:i.hasOwnProperty("AudioBuffer")?i.AudioBuffer:null,createNativeAudioContextConstructor=i=>i===null?null:i.hasOwnProperty("AudioContext")?i.AudioContext:i.hasOwnProperty("webkitAudioContext")?i.webkitAudioContext:null,createNativeAudioWorkletNodeConstructor=i=>i===null?null:i.hasOwnProperty("AudioWorkletNode")?i.AudioWorkletNode:null,createNativeOfflineAudioContextConstructor=i=>i===null?null:i.hasOwnProperty("OfflineAudioContext")?i.OfflineAudioContext:i.hasOwnProperty("webkitOfflineAudioContext")?i.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(i){libExports$2=i}},libExports$1={},lib$1={get exports(){return libExports$1},set exports(i){libExports$1=i}};function b64ToUint6(i){return i>64&&i<91?i-65:i>96&&i<123?i-71:i>47&&i<58?i+4:i===43?62:i===47?63:0}function decode(i,e){for(var t=i.replace(/[^A-Za-z0-9\+\/]/g,""),s=t.length,r=e?Math.ceil((s*3+1>>2)/e)*e:s*3+1>>2,o=new Uint8Array(r),a,l,c=0,d=0,m=0;m>>(16>>>a&24)&255;c=0}return o}var base64={decode},fetch$1=function(i,e){return new Promise(function(t,s){var r=new XMLHttpRequest;e&&(r.responseType=e),r.open("GET",i),r.onload=function(){r.status===200?t(r.response):s(Error(r.statusText))},r.onerror=function(){s(Error("Network Error"))},r.send()})};(function(i){var e=base64,t=fetch$1;function s(P){return function(I){return typeof I=="string"&&P.test(I)}}function r(P,I){return typeof P=="string"?P+I:typeof P=="function"?P(I):I}function o(P,I,N,R){var F=a(I)?l:c(I)?d:m(I)?u:g(I)?b:y(I)?S:v(I)?x:A(I)?E:_(I)?w:null,B=N||{};return F?F(P,I,B):R?Promise.resolve(R):Promise.reject("Source not valid ("+I+")")}o.fetch=t;function a(P){return P instanceof ArrayBuffer}function l(P,I,N){return new Promise(function(R,F){P.decodeAudioData(I,function(B){R(B)},function(){F("Can't decode audio data ("+I.slice(0,30)+"...)")})})}var c=s(/\.(mp3|wav|ogg)(\?.*)?$/i);function d(P,I,N){var R=r(N.from,I);return o(P,o.fetch(R,"arraybuffer"),N)}function m(P){return P&&typeof P.then=="function"}function u(P,I,N){return I.then(function(R){return o(P,R,N)})}var g=Array.isArray;function b(P,I,N){return Promise.all(I.map(function(R){return o(P,R,N,R)}))}function y(P){return P&&typeof P=="object"}function S(P,I,N){var R={},F=Object.keys(I).map(function(B){if(N.only&&N.only.indexOf(B)===-1)return null;var k=I[B];return o(P,k,N,k).then(function(M){R[B]=M})});return Promise.all(F).then(function(){return R})}var v=s(/\.json(\?.*)?$/i);function x(P,I,N){var R=r(N.from,I);return o(P,o.fetch(R,"text").then(JSON.parse),N)}var A=s(/^data:audio/);function E(P,I,N){var R=I.indexOf(",");return o(P,e.decode(I.slice(R+1)).buffer,N)}var _=s(/\.js(\?.*)?$/i);function w(P,I,N){var R=r(N.from,I);return o(P,o.fetch(R,"text").then(C),N)}function C(P){var I=P.indexOf("MIDI.Soundfont.");if(I<0)throw Error("Invalid MIDI.js Soundfont format");I=P.indexOf("=",I)+2;var N=P.lastIndexOf(",");return JSON.parse(P.slice(I,N)+"}")}i.exports&&(i.exports=o),typeof window<"u"&&(window.loadAudio=o)})(lib$1);var libExports={},lib={get exports(){return libExports},set exports(i){libExports=i}},adsr=ADSR$1;function ADSR$1(i){var e=i.createGain(),t=e._voltage=getVoltage(i),s=scale(t),r=scale(t),o=scale(t);return e._startAmount=scale(r),e._endAmount=scale(o),e._multiplier=scale(s),e._multiplier.connect(e),e._startAmount.connect(e),e._endAmount.connect(e),e.value=s.gain,e.startValue=r.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(i){var e=this._multiplier.gain,t=this._startAmount.gain,s=this._endAmount.gain;this._voltage.start(i),this._decayFrom=this._decayFrom=i+this.attack,this._startedAt=i;var r=this.sustain;e.cancelScheduledValues(i),t.cancelScheduledValues(i),s.cancelScheduledValues(i),s.setValueAtTime(0,i),this.attack?(e.setValueAtTime(0,i),e.linearRampToValueAtTime(1,i+this.attack),t.setValueAtTime(1,i),t.linearRampToValueAtTime(0,i+this.attack)):(e.setValueAtTime(1,i),t.setValueAtTime(0,i)),this.decay&&e.setTargetAtTime(r,this._decayFrom,getTimeConstant(this.decay))}},stop:{value:function(i,e){e&&(i=i-this.release);var t=i+this.release;if(this.release){var s=this._multiplier.gain,r=this._startAmount.gain,o=this._endAmount.gain;s.cancelScheduledValues(i),r.cancelScheduledValues(i),o.cancelScheduledValues(i);var a=getTimeConstant(this.release);if(this.attack&&i=e&&(d=e),d}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(i,e,t){var s=!1,r=0,o={},a=i.createGain();a.gain.value=1;var l=Object.assign({},DEFAULTS,t),c={context:i,out:a,opts:l};return e instanceof AudioBuffer?c.buffer=e:c.buffers=e,c.start=function(u,g,b){if(c.buffer&&u!==null)return c.start(null,u,g);var y=u?c.buffers[u]:c.buffer;if(y){if(!s){console.warn("SamplePlayer not connected to any node.");return}}else{console.warn("Buffer "+u+" not found.");return}var S=b||EMPTY;g=Math.max(i.currentTime,g||0),c.emit("start",g,u,S);var v=m(u,y,S);return v.id=d(u,v),v.env.start(g),v.source.start(g),c.emit("started",g,v.id,v),S.duration&&v.stop(g+S.duration),v},c.play=function(u,g,b){return c.start(u,g,b)},c.stop=function(u,g){var b;return g=g||Object.keys(o),g.map(function(y){return b=o[y],b?(b.stop(u),b.id):null})},c.connect=function(u){return s=!0,a.connect(u),c},c.emit=function(u,g,b,y){c.onevent&&c.onevent(u,g,b,y);var S=c["on"+u];S&&S(g,b,y)},c;function d(u,g){return g.id=r++,o[g.id]=g,g.source.onended=function(){var b=i.currentTime;g.source.disconnect(),g.env.disconnect(),g.disconnect(),c.emit("ended",b,g.id,g)},g.id}function m(u,g,b){var y=i.createGain();return y.gain.value=0,y.connect(a),y.env=envelope(i,b,l),y.env.connect(y.gain),y.source=i.createBufferSource(),y.source.buffer=g,y.source.connect(y),y.source.loop=b.loop||l.loop,y.source.playbackRate.value=centsToRate(b.cents||l.cents),y.source.loopStart=b.loopStart||l.loopStart,y.source.loopEnd=b.loopEnd||l.loopEnd,y.stop=function(S){var v=S||i.currentTime;c.emit("stop",v,u);var x=y.env.stop(v);y.source.stop(x)},y}}function isNum$1(i){return typeof i=="number"}var PARAMS=["attack","decay","sustain","release"];function envelope(i,e,t){var s=ADSR(i),r=e.adsr||t.adsr;return PARAMS.forEach(function(o,a){r?s[o]=r[a]:s[o]=e[o]||t[o]}),s.value.value=isNum$1(e.gain)?e.gain:isNum$1(t.gain)?t.gain:1,s}function centsToRate(i){return i?Math.pow(2,i/1200):1}var player=SamplePlayer,events=function(i){return i.on=function(e,t){if(arguments.length===1&&typeof e=="function")return i.on("event",e);var s="on"+e,r=i[s];return i[s]=r?chain(r,t):t,i},i};function chain(i,e){return function(t,s,r,o){i(t,s,r,o),e(t,s,r,o)}}var REGEX$1=/^([a-gA-G])(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)\s*$/;function regex$1(){return REGEX$1}var SEMITONES$1=[0,2,4,5,7,9,11];function parse$1(i,e,t){if(typeof i!="string")return null;var s=REGEX$1.exec(i);if(!s||!e&&s[4])return null;var r={letter:s[1].toUpperCase(),acc:s[2].replace(/x/g,"##")};return r.pc=r.letter+r.acc,r.step=(r.letter.charCodeAt(0)+3)%7,r.alt=r.acc[0]==="b"?-r.acc.length:r.acc.length,r.chroma=SEMITONES$1[r.step]+r.alt,s[3]&&(r.oct=+s[3],r.midi=r.chroma+12*(r.oct+1),r.freq=midiToFreq$1(r.midi,t)),e&&(r.tonicOf=s[4]),r}function midiToFreq$1(i,e){return Math.pow(2,(i-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(i){parser[i]=function(e){var t=parse$1(e);return t&&typeof t[i]<"u"?t[i]:null}});var noteParser$1=parser,note=noteParser$1,isMidi=function(i){return i!==null&&i!==[]&&i>=0&&i<129},toMidi=function(i){return isMidi(i)?+i:note.midi(i)},notes=function(i){if(i.buffers){var e=i.opts.map,t=typeof e=="function"?e:toMidi,s=function(o){return o?t(o)||o:null};i.buffers=mapBuffers(i.buffers,s);var r=i.start;i.start=function(o,a,l){var c=s(o),d=c%1;return d&&(c=Math.floor(c),l=Object.assign(l||{},{cents:Math.floor(d*100)})),r(c,a,l)}}return i};function mapBuffers(i,e){return Object.keys(i).reduce(function(t,s){return t[e(s)]=i[s],t},{})}var isArr=Array.isArray,isObj=function(i){return i&&typeof i=="object"},OPTS={},scheduler=function(i){return i.schedule=function(e,t){var s=i.context.currentTime,r=e"u"?null:i.step?build(i.step,i.alt,i.oct):i<0||i>6?null:LETTERS.charAt(i)+accStr(e)+octStr(t)}function midi(i){if((isNum(i)||isStr(i))&&i>=0&&i<128)return+i;var e=parse(i);return e&&isDef(e.midi)?e.midi:null}function freq(i,e){var t=midi(i);return t===null?null:midiToFreq(t,e)}function letter(i){return(parse(i)||{}).letter}function acc(i){return(parse(i)||{}).acc}function pc(i){return(parse(i)||{}).pc}function step(i){return(parse(i)||{}).step}function alt(i){return(parse(i)||{}).alt}function chroma(i){return(parse(i)||{}).chroma}function oct(i){return(parse(i)||{}).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 i=require$$0;function e(r,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(r);this.nameToUrl=o||e.nameToUrl,this.ctx=r,this.instruments={},this.promises=[]}e.prototype.onready=function(r){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(r)},e.prototype.instrument=function(r,o){console.warn("new Soundfont().instrument() is deprecated."),console.log("Please use Soundfont.instrument() instead.");var a=this.ctx;if(r=r||"default",r in this.instruments)return this.instruments[r];var l={name:r,play:s(a,o)};if(this.instruments[r]=l,r!=="default"){var c=e.instrument(a,r,o).then(function(d){return l.play=d.play,l});this.promises.push(c),l.onready=function(d){console.warn("onready is deprecated. Use Soundfont.instrument().then()"),c.then(d)}}else l.onready=function(d){console.warn("onready is deprecated. Use Soundfont.instrument().then()"),d()};return l};function t(r,o,a){return console.warn("Soundfont.loadBuffers is deprecate."),console.log("Use Soundfont.instrument(..) and get buffers properties from the result."),e.instrument(r,o,a).then(function(l){return l.buffers})}e.loadBuffers=t;function s(r,o){return o=o||{},function(a,l,c,d){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:i.midi(a),u=m?i.midiToFreq(m,440):null;if(u){c=c||.2,d=d||{};var g=d.destination||o.destination||r.destination,b=d.vcoType||o.vcoType||"sine",y=d.gain||o.gain||.4,S=r.createOscillator();S.type=b,S.frequency.value=u;var v=r.createGain();return v.gain.value=y,S.connect(v),v.connect(g),S.start(l),c>0&&S.stop(l+c),S}}}return e.noteToMidi=i.midi,legacy=e,legacy}(function(i){var e=libExports$1,t=libExports;function s(l,c,d){if(arguments.length===1)return function(y,S){return s(l,y,S)};var m=d||{},u=m.isSoundfontURL||r,g=m.nameToUrl||o,b=u(c)?c:g(c,m.soundfont,m.format);return e(l,b,{only:m.only||m.notes}).then(function(y){var S=t(l,y,m).connect(m.destination?m.destination:l.destination);return S.url=b,S.name=c,S})}function r(l){return/\.js(\?.*)?$/i.test(l)}function o(l,c,d){return d=d==="ogg"?d:"mp3",c=c==="FluidR3_GM"?c:"MusyngKite","https://gleitz.github.io/midi-js-soundfonts/"+c+"/"+l+"-"+d+".js"}var a=requireLegacy();a.instrument=s,a.nameToUrl=o,i.exports&&(i.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},browserInfo=browser();dayjs.extend(duration);const getFixTime=i=>{const e=getDuration(state$1.osmd);let t=e.numerator||0,s=e.denominator||4;const r=e.beatUnit||"quarter";return state$1.isOpenMetronome?60/i*formatBeatUnit(r)*(t/s):0},retain=i=>Math.ceil(i*1e6)/1e6,formatLyricsEntries=i=>{var s,r;const e=((s=i.parentStaffEntry)==null?void 0:s.voiceEntries)||[],t=[];for(const o of e)if((r=o.lyricsEntries)!=null&&r.table){const a=Object.values(o.lyricsEntries.table);for(const l of a)t.push(l==null?void 0:l.value.text)}return t},getMeasureDurationDiff=i=>{const{realValue:e}=i.activeTimeSignature,{realValue:t}=i.duration;return e-t},createSpeedInfo=(i,e)=>{var t,s;if(i&&speedInfo[(t=i.startWord)==null?void 0:t.toLocaleLowerCase()]){const r=Math.max(i.endXmlNoteIndex,3),o=[],a=e,l=e/speedInfo[(s=i.startWord)==null?void 0:s.toLocaleLowerCase()];for(let c=0;c{let e=i;const t=i.split(":");return t.length===1?e=`00:${t[0]}:00`:t.length===2&&(e=`00:${t[0]}:${t[1]}`),`1970-01-01 00:${e}0`},getDuration=i=>{var t;if(i){const{Duration:s,TempoInBPM:r,ActiveTimeSignature:o,TempoExpressions:a}=(t=i.GraphicSheet.MeasureList[0][0])==null?void 0:t.parentSourceMeasure;if(s){let l="quarter";for(const d of a)l=d.InstantaneousTempo.beatUnit||"quarter";return{...formatDuration(o),TempoInBPM:r,beatUnit:l}}}return{...new Fraction$1,TempoInBPM:90,beatUnit:"quarter"}};function formatDuration(i,e){return i}function formatBeatUnit(i){let e=4;switch(i){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(i,e,t){return t/formatBeatUnit(i)*e}const setElementNoteBefore=(i,e,t)=>{let s=0;if(e){for(let r=0;r0){let r=0;const o=Array.from(t.childNodes).filter(l=>l.nodeName==="note"),a=o[o.length-1];if(s>=o.length&&a){t.insertBefore(i,t.childNodes[Array.from(t.childNodes).indexOf(a)]);return}for(let l=0;l{if(i){const e=i.toLocaleLowerCase(),t="d\\s?\\.s\\.",s="d\\.\\s?c\\.";return e==="@"||StringUtil.StringContainsSeparatedWord(e,t+" al fine",!0)||StringUtil.StringContainsSeparatedWord(e,t+" al coda",!0)||StringUtil.StringContainsSeparatedWord(e,s+" al fine",!0)||StringUtil.StringContainsSeparatedWord(e,s+" al coda",!0)||StringUtil.StringContainsSeparatedWord(e,s)||StringUtil.StringContainsSeparatedWord(e,"da\\s?capo",!0)||StringUtil.StringContainsSeparatedWord(e,t,!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=(i,e)=>{var b,y,S,v,x,A,E,_,w;if(!i)return"";const t=state$1.examSongId,s=new DOMParser().parseFromString(i,"text/xml"),r=((y=(b=s.getElementsByTagName("part-list"))==null?void 0:b[0])==null?void 0:y.getElementsByTagName("score-part"))||[],o=Array.from(r).map(C=>{var P;return((P=C.getElementsByTagName("part-name"))==null?void 0:P[0].textContent)||""}),a=s.getElementsByTagName("part"),l=[...(S=a[0])==null?void 0:S.getElementsByTagName("measure")],c=[...(v=a[0])==null?void 0:v.getElementsByTagName("metronome")],d=[...(x=a[0])==null?void 0:x.getElementsByTagName("words")],m=[...(A=a[0])==null?void 0:A.getElementsByTagName("coda")],u=[...(E=a[0])==null?void 0:E.getElementsByTagName("rehearsal")];((w=(_=o[0])==null?void 0:_.toLocaleUpperCase)==null?void 0:w.call(_))==="COMMON"&&(e++,o.shift());const g=r[e];if(state$1.partListNames=o,g){const C=g.getAttribute("id");Array.from(a).forEach(P=>{var I,N,R,F,B;if(P&&P.getAttribute("id")!==C)(I=P.parentNode)==null||I.removeChild(P);else if(P&&P.getAttribute("id")!=="P1"){const k={};for(let M=0;M{var ie;const G=(ie=M.parentElement)==null?void 0:ie.parentElement,ee=G==null?void 0:G.parentElement,$=[...(ee==null?void 0:ee.childNodes)||[]],re=G?$.indexOf(G):-1;if(ee&&re>-1){const de=l.indexOf(ee),Q=P.getElementsByTagName("measure")[de];setElementNoteBefore(G,ee,Q)}}),d.forEach(M=>{var ee;let G=M.textContent||"";if(G=["cresc."].includes(G)?"":G,(isSpecialMark(G)||isSpeedKeyword(G)||isGradientWords(G)||isRepeatWord(G)||GRADIENT_SPEED_RESET_TAG)&&G){const $=(ee=M.parentElement)==null?void 0:ee.parentElement,re=$==null?void 0:$.parentElement,ie=[...(re==null?void 0:re.childNodes)||[]],de=$?ie.indexOf($):-1;if($&&re&&de>-1){const Q=l.indexOf(re),H=P.getElementsByTagName("measure")[Q];Array.from((H==null?void 0:H.getElementsByTagName("words"))||[]).reduce((W,oe)=>{var he;return(he=oe.textContent)!=null&&he.includes(G)&&W++,W},0)===0&&(["12280"].includes(t)?H==null||H.insertBefore($.cloneNode(!0),H==null?void 0:H.childNodes[de]):setElementNoteBefore($,re,H))}}}),m.forEach(M=>{var ie;const G=(ie=M.parentElement)==null?void 0:ie.parentElement,ee=G==null?void 0:G.parentElement,$=[...(ee==null?void 0:ee.childNodes)||[]],re=G?$.indexOf(G):-1;if(G&&ee&&re>-1){const de=l.indexOf(ee),Q=P.getElementsByTagName("measure")[de];["12280"].includes(t)?Q==null||Q.insertBefore(G.cloneNode(!0),Q==null?void 0:Q.childNodes[re]):setElementNoteBefore(G,ee,Q)}}),u.forEach(M=>{var $,re;const G=($=M.parentElement)==null?void 0:$.parentElement,ee=G==null?void 0:G.parentElement;if(ee){const ie=l.indexOf(ee);(re=P.getElementsByTagName("measure")[ie])==null||re.appendChild(G.cloneNode(!0))}})}else d.forEach(k=>{var G,ee,$;const M=k.textContent||"";if(isSpeedKeyword(M)&&M){const re=(ee=(G=k.parentElement)==null?void 0:G.parentElement)==null?void 0:ee.parentElement;if(re&&re.firstElementChild&&re.firstElementChild!==k){const ie=($=k.parentElement)==null?void 0:$.parentElement,de=re.firstElementChild;re.insertBefore(ie,de)}}});if(P&&P.getAttribute("id")===C){const k=P.getElementsByTagName("barline"),M=(F=k[k.length-1])==null?void 0:F.parentElement;if(((B=M==null?void 0:M.lastElementChild)==null?void 0:B.tagName)!=="barline"){const G=(M==null?void 0:M.children)||[];for(let ee of G)if(ee.tagName==="barline"){M==null||M.appendChild(ee);break}}}}),Array.from(r).forEach(P=>{var I;P&&P.getAttribute("id")!==C&&((I=P.parentNode)==null||I.removeChild(P))})}return new XMLSerializer().serializeToString(appoggianceFormate(s))},appoggianceFormate=i=>{var s,r,o,a;if(!i)return i;const e=i.querySelectorAll("grace");if(!e.length)return i;const t=l=>l.querySelector("grace")?t(l==null?void 0:l.nextElementSibling):l;for(let l of e){const c=(s=l.parentElement)==null?void 0:s.querySelector("notations");if(c&&c.querySelectorAll("slur").length>1){let d=t((r=l.parentElement)==null?void 0:r.nextElementSibling);if(d&&d.querySelectorAll("slur").length>0){const m=Array.from(((o=d.querySelector("notations"))==null?void 0:o.children)||[]).map(g=>g.getAttribute("number")),u=c.querySelectorAll("slur");for(let g of u)m.includes(g.getAttribute("number"))||(a=d.querySelector("notations"))==null||a.appendChild(g)}}}return i},formatXML=i=>{var o,a;if(!i)return"";const e=new DOMParser().parseFromString(i,"text/xml"),t=Array.from(e.getElementsByTagName("measure"));let s=-1,r=-1;for(const l of t){s===-1&&l.getElementsByTagName("beats").length&&(s=parseInt(l.getElementsByTagName("beats")[0].textContent||"4")),r===-1&&l.getElementsByTagName("beat-type").length&&(r=parseInt(l.getElementsByTagName("beat-type")[0].textContent||"4"));const c=parseInt(((o=l.getElementsByTagName("divisions")[0])==null?void 0:o.textContent)||"256");if(l.getElementsByTagName("note").length===0){const d=(a=l.getElementsByTagName("forward")[0])==null?void 0:a.getElementsByTagName("duration")[0];d&&(d.textContent="0"),l.innerHTML=l.innerHTML+` ${c*s} 1 whole `}}return new XMLSerializer().serializeToString(e)},formateTimes=i=>{var B,k,M,G,ee,$,re,ie,de,Q,H,ue,ne,W,oe,he,le,me,Ae,be,z,J,T,q,Y,O,V,U,se,te;const e=(B=state$1.examSongId)==null?void 0:B.toString();state$1.partIndex+"";let t=browserInfo.huawei?.08:0;const s=[],r=[],o=[],{originSpeed:a}=state$1,l=(K,ae)=>{var ve,ce,Se,we,Pe,Be;return["906"].includes(e)?((ve=ae.measures[0])==null?void 0:ve.realKey)||K:["782","784"].includes(e)&&[14,16,30,32].includes((ce=ae.firstVerticalMeasure)==null?void 0:ce.measureNumber)?((Se=s[s.length-1])==null?void 0:Se.realKey)||K:["900","901","640","641","739","740","800","801","773","774","869","872","714","715"].includes(e)&&(((we=ae.firstVerticalMeasure)==null?void 0:we.measureNumber)===3||((Pe=ae.firstVerticalMeasure)==null?void 0:Pe.measureNumber)===9)&&((Be=ae.measures[0])==null?void 0:Be.realKey)||K};if(!i.cursor)return[];const c=i.cursor.Iterator;console.time("音符跑完时间");let d=0,m=0,u=[],g=[],b=0,y=0,S=0,v="quarter",x,A,E=0,_=0,w=0;const C=[];state$1.gradualTimes&&console.log("合奏速度",state$1.gradual,state$1.gradualTimes);let P=c.currentTimeStamp.RealValue;const I=[];let N=!1,R=0;for(;!c.EndReached;){const K=(k=c.CurrentVoiceEntries)!=null&&k[0]?[(M=c.CurrentVoiceEntries)==null?void 0:M[0]]:[];let ae=[];state$1.multitrack>0?ae=[...c.CurrentVoiceEntries]:ae=[...c.CurrentVoiceEntries].filter(ve=>{var ce;return ve&&((ce=ve==null?void 0:ve.ParentVoice)==null?void 0:ce.VoiceId)!=1});let fe=0,pe=!1,ye=!1;if(ae.length&&!N){pe=!0;let ve=[...c.CurrentVoiceEntries].reduce((ce,Se)=>(ce.push(...Se.Notes),ce),[]);if(ve=ve.sort((ce,Se)=>{var we,Pe;return((we=ce==null?void 0:ce.length)==null?void 0:we.realValue)-((Pe=Se==null?void 0:Se.length)==null?void 0:Pe.realValue)}),fe=((ee=(G=ve==null?void 0:ve[0])==null?void 0:G.length)==null?void 0:ee.realValue)||0,state$1.multitrack>0&&ae.length===2){const ce=((re=($=ve[0])==null?void 0:$.length)==null?void 0:re.realValue)||0;R=(((de=(ie=ve[ve.length-1])==null?void 0:ie.length)==null?void 0:de.realValue)||0)-ce,N=R!==0}}(Q=C[C.length-1])!=null&&Q.isDouble&&!ae.length&&(ye=!0),state$1.multitrack>0&&!pe&&N&&(pe=!0,fe=R,N=!1,R=0),I.push(c.currentTimeStamp.realValue-P),P=c.currentTimeStamp.realValue;for(const ve of K){let ce=ve.notes[0];if(ce.IsGraceNote&&(ce=ce.parentStaffEntry.voiceEntries.find(we=>!we.isGrace).notes[0]),ce.fixedKey=ce.ParentVoiceEntry.ParentVoice.Parent.SubInstruments[0].fixedKey||0,(H=ce==null?void 0:ce.voiceEntry)!=null&&H.isGrace){pe=!0;let Se=[...c.currentVoiceEntries].reduce((we,Pe)=>(we.push(...Pe.notes),we),[]);Se=Se.sort((we,Pe)=>{var Be,Me;return((Be=Pe==null?void 0:Pe.length)==null?void 0:Be.realValue)-((Me=we==null?void 0:we.length)==null?void 0:Me.realValue)}),fe=fe!=0?Math.min((ne=(ue=Se==null?void 0:Se[0])==null?void 0:ue.length)==null?void 0:ne.realValue,fe):(oe=(W=Se==null?void 0:Se[0])==null?void 0:W.length)==null?void 0:oe.realValue}state$1.multitrack>0&&fe>ce.length.realValue&&(fe=ce.length.realValue),C.push({note:ce,iterator:{...c},currentTime:fe,isDouble:pe,isMutileSubject:ye})}c.moveToNextVisibleVoiceEntry(!1)}for(let{note:K,iterator:ae,currentTime:fe,isDouble:pe,isMutileSubject:ye}of C){if(K){if(m===0&&o.push(K.sourceMeasure),m===0&&state$1.isSpecialBookCategory)for(const $e of(he=K.sourceMeasure)==null?void 0:he.TempoExpressions)(le=$e==null?void 0:$e.InstantaneousTempo)!=null&&le.beatUnit&&(v=$e.InstantaneousTempo.beatUnit);let ve=K.sourceMeasure.tempoInBPM;const{metronomeNoteIndex:ce}=ae.currentMeasure;ce!==0&&ce>m&&(ve=((me=s[s.length-1])==null?void 0:me.speed)||100);const Se=[(Ae=K.sourceMeasure.verticalMeasureList)==null?void 0:Ae[0]],{realValue:we}=ae.currentTimeStamp,{RealValue:Pe,Denominator:Be}=formatDuration(ae.currentMeasure.activeTimeSignature,ae.currentMeasure.duration);let{wholeValue:Me,numerator:Ne,denominator:Le,realValue:Ce}=K.length;pe&&fe>0&&fe!=Ce&&(console.log(`小节 ${K.sourceMeasure.MeasureNumberXML} 替换: noteLength: ${Ce}, 最小: ${fe}`),Ce=fe);let ze=y,We=(state$1.isSpecialBookCategory?ve:a)||1;d===0&&(t+=getFixTime(We),console.log("🚀 ~ fixtime:",t,We));let ut=0,Je=(state$1.isSpecialBookCategory?ve:a)||1;A=ae.currentMeasure.speedInfo||A,x=((be=i.Sheet.SoundTempos)==null?void 0:be.get(K.sourceMeasure.measureListIndex))||x,(!x||x.length<2)&&(x=createSpeedInfo(A,Je));const je=ae.currentMeasure.measureListIndex;if(state$1.gradualTimes&&Object.keys(state$1.gradualTimes).length>0){const $e=state$1.gradual.find((et,Ge)=>{var it;const Xe=state$1.gradual[Ge+1];return et[0].measureIndex<=je&&((it=et[1])==null?void 0:it.measureIndex)>=je&&(!Xe||(Xe==null?void 0:Xe[0].measureIndex)!==je)}),[Ye,Qe]=$e||[];if(Ye&&Qe){const et=Qe.measureIndex-Ye.measureIndex,Ge=Ye.closedMeasureIndex==je&&m>=Ye.noteInMeasureIndex,Xe=Qe.closedMeasureIndex===je&&m0)){const $e=x[0]-(x[1]-x[0]),{resetXmlNoteIndex:Ye,endXmlNoteIndex:Qe}=A,et=Qe;let Ge=(x[x.length-1]-$e)/et;if(Ge=K.DotsXml?Ge/1.5:Ge,EE&&(Je=(z=s[d-1])==null?void 0:z.speed);We=(state$1.isSpecialBookCategory?getTimeByBeatUnit(v,Je,ae.currentMeasure.activeTimeSignature.Denominator):a)||1;const Xe=!(EE);E++,Xe&&(E=0,A=void 0,x=void 0,g=[])}const tt=Ce;let Ze=ut||Math.min(Pe,Ce)*formatBeatUnit(v)*(60/We);const Et=Pe*Be*(60/We);y+=Ze,S+=Ze;let ht=Ze+ze;const yt=K.fixedKey||0,ft=(T=(J=Se[0])==null?void 0:J.vfVoices["1"])==null?void 0:T.tickables[m];if(s.length&&s[s.length-1].relativeTime===ze)continue;if(d===0){const $e=getMeasureDurationDiff(ae.currentMeasure);$e>0&&(b=$e*formatBeatUnit(v)*(60/We),t+=b),["2589","2561","2560","2559","2558","2556","2555","2554"].includes(e)&&(b=ae.currentTimeStamp.realValue*formatBeatUnit(v)*(60/We),t+=b)}let vt=(q=Se[0])==null?void 0:q.stave;!vt&&K.isRestFlag&&s.length,K.sourceMeasure.multipleRestMeasures&&(_=K.sourceMeasure.multipleRestMeasures,w=0),w<_?w++:(w=0,_=0);const Fe={isStaccato:K.voiceEntry.isStaccato(),isRestFlag:K.isRestFlag,noteId:K.NoteToGraphicalNoteObjectId,measureListIndex:K.sourceMeasure.measureListIndex,MeasureNumberXML:K.sourceMeasure.MeasureNumberXML,_noteLength:tt,svgElement:ft,frequency:((Y=K==null?void 0:K.pitch)==null?void 0:Y.frequency)||-1,nextFrequency:((O=K==null?void 0:K.pitch)==null?void 0:O.nextFrequency)||-1,prevFrequency:((V=K==null?void 0:K.pitch)==null?void 0:V.prevFrequency)||-1,difftime:b,octaveOffset:(U=Se[0])==null?void 0:U.octaveOffset,speed:Je,beatSpeed:We,i:d,si:m,stepSpeeds:g,measureOpenIndex:o.length-1,measures:u,tempoInBPM:K.sourceMeasure.tempoInBPM,measureLength:Et,relaMeasureLength:S,id:ft==null?void 0:ft.attrs.id,note:K.halfTone+12,relativeTime:retain(ze),time:retain(ze+t),endtime:retain(ht+t),relaEndtime:retain(ht),realValue:we,halfTone:K.halfTone,noteElement:K,fixedKey:yt,realKey:0,duration:0,formatLyricsEntries:formatLyricsEntries(K),stave:vt,firstVerticalMeasure:Se[0],noteLength:1,osdmContext:i,speedbeatUnit:v,multipleRestMeasures:w};Fe.realKey=l(K.halfTone-yt*12,Fe),Fe.duration=Fe.endtime-Fe.time;let wt=((te=(se=Se[0])==null?void 0:se.vfVoices["1"])==null?void 0:te.tickables)||[];[121].includes(state$1.subjectId)&&(wt=K.sourceMeasure.verticalSourceStaffEntryContainers),Fe.noteLength=wt.length||1,s.push(Fe),r.push(Fe.id),u.push(Fe),mK.relativeTime-ae.relativeTime).map((K,ae)=>({...K,i:ae}));console.timeEnd("音符跑完时间");try{i.cursor.reset()}catch(K){}return state$1.activeMeasureIndex=F[0].MeasureNumberXML,F},getNoteByMeasuresSlursStart=i=>{let e=i,t;if(i.noteElement.tie&&i.noteElement.tie.StartNote&&(t=i.noteElement.tie.StartNote),e&&t&&t!==e.noteElement){for(const s of state$1.times)if(t===s.noteElement)return s}return e},selectionContainer="_selectionContainer_1lvx1_1",position="_position_1lvx1_7",staveBox="_staveBox_1lvx1_10",leftStaveBox="_leftStaveBox_1lvx1_13",rightStaveBox="_rightStaveBox_1lvx1_27",centerStaveBox="_centerStaveBox_1lvx1_41",prepareStaveBox="_prepareStaveBox_1lvx1_66",disable$1="_disable_1lvx1_69",line="_line_1lvx1_72",scoreItem="_scoreItem_1lvx1_82",dotWrap="_dotWrap_1lvx1_119",noteFollow="_noteFollow_1lvx1_134",styles$1={selectionContainer,position,staveBox,leftStaveBox,rightStaveBox,centerStaveBox,prepareStaveBox,disable:disable$1,line,scoreItem,dotWrap,noteFollow},Selection=defineComponent({name:"selection",setup(){const i=reactive({notes:[],staves:[]}),e=()=>{var m,u,g,b,y,S,v,x,A,E,_,w;const r=((m=document.getElementById("musicAndSelection"))==null?void 0:m.getBoundingClientRect())||{x:0,y:0},o=r.x||0,a=r.y||0,l=state$1.times,c=[],d=[];for(let C=0;CR.MeasureNumberXML===P.MeasureNumberXML-1);N!=null&&N.staveBox&&(I.staveBox={left:N.staveBox.left,top:N.staveBox.top,width:N.staveBox.width},i.staves.push(I),d.push(P.MeasureNumberXML))}}}},t=computed(()=>state$1.sectionStatus||state$1.modeType!=="practise"),s=computed(()=>r=>{if(state$1.sectionStatus){if(state$1.section.length===1&&r.MeasureNumberXML==state$1.section[0].MeasureNumberXML)return styles$1.leftStaveBox;if(state$1.section.length===2){if(state$1.sectionFirst&&r.MeasureNumberXML===state$1.sectionFirst.MeasureNumberXML)return styles$1.prepareStaveBox;if(r.MeasureNumberXML>=state$1.section[0].MeasureNumberXML&&r.MeasureNumberXML<=state$1.section[1].MeasureNumberXML)return r.MeasureNumberXML==state$1.section[0].MeasureNumberXML&&r.MeasureNumberXML==state$1.section[1].MeasureNumberXML?styles$1.centerStaveBox:r.MeasureNumberXML==state$1.section[0].MeasureNumberXML?styles$1.leftStaveBox:r.MeasureNumberXML==state$1.section[1].MeasureNumberXML?styles$1.rightStaveBox:styles$1.staveBox}}else if(state$1.activeMeasureIndex==r.MeasureNumberXML)return styles$1.staveBox});return onMounted(()=>{e()}),()=>createVNode("div",{id:"selectionBox",class:styles$1.selectionContainer,onClick:r=>r.stopPropagation()},[i.staves.map(r=>{var a;const o=evaluatingData.evaluatings[r.measureListIndex];return createVNode(Fragment,null,[r.staveBox&&createVNode("div",{class:[styles$1.position,s.value(r),o?`scoreItemLeve${o.leve}`:""],style:r.staveBox,onClick:()=>handleSelection(r)},[!r.isRestFlag&&metronomeData.lineShow&&r.MeasureNumberXML===((a=metronomeData.activeMetro)==null?void 0:a.measureNumberXML)&&createVNode("div",{class:styles$1.line,style:{left:metronomeData.activeMetro.left}},null),!!r.multipleRestMeasures&&state$1.activeMeasureIndex==r.MeasureNumberXML&&createVNode("div",{class:styles$1.dotWrap},[r.multipleRestMeasures]),createVNode(Transition,{name:"centerTop",onAfterEnter:()=>{o.show=!1}},{default:()=>{var l,c;return[(o==null?void 0:o.show)&&createVNode("div",{class:styles$1.scoreItem,style:{color:((l=leveByScoreMeasureIcons[o.leve])==null?void 0:l.color)||""}},[createVNode("img",{src:(c=leveByScoreMeasureIcons[o.leve])==null?void 0:c.icon},null),createVNode("span",null,[o.score])])]}})])])}),i.notes.map(r=>createVNode("div",{class:[styles$1.position,t.value&&styles$1.disable,styles$1.note],style:r.bbox,onClick:()=>skipNotePlay(r.index)},[createVNode("div",{class:styles$1.noteFollow,"data-vf":"vf"+r.id},[createVNode(Icon$1,{name:"success"},null),createVNode(Icon$1,{name:"cross"},null)])]))])}}),index_module={},musicRenderTypeKey="musicRenderType",musicData=reactive({showSelection:!1,isRenderLoading:!0,score:""}),resetMusicScore=()=>{var t;const i=document.querySelector("#osmdSvgPage1"),e=document.getElementById("osmdCanvasPage1");if(i&&e){let s=i==null?void 0:i.getAttribute("width");if(s=isNaN(Number(s))?0:Number(s),s){const r=e.offsetWidth/s;(t=document.getElementById("musicAndSelection"))==null||t.style.setProperty("--music-zoom",r+"")}}},resetRenderMusicScore=()=>{const i=queryString.parse(location.search),e=queryString.stringify({...i,_t:Date.now()});location.search="?"+e},MusicScore=defineComponent({name:"music-score",emits:["rendered"],setup(i,{emit:e}){const t=()=>{const o=sessionStorage.getItem(musicRenderTypeKey);state$1.musicRenderType=["staff","firstTone","fixedTone"].includes(o)?o:"staff"},s=async()=>{const o=await fetch(state$1.xmlUrl).then(l=>l.text()),a=formatXML(o);musicData.score=onlyVisible(a,state$1.partIndex)},r=async()=>{const o=document.getElementById("musicAndSelection");if(!o||!musicData.score)return;const a=new OpenSheetMusicDisplay(o,{drawTitle:!1,drawSubtitle:!1,autoResize:!1,followCursor:!1,drawPartNames:!1,drawComposer:!1});a.EngravingRules.PageRightMargin=2,a.EngravingRules.PageTopMargin=3,a.EngravingRules.PageLeftMargin=2,a.EngravingRules.PageBottomMargin=2,a.EngravingRules.DYMusicScoreType=state$1.musicRenderType==="staff"?"staff":"jianpu",state$1.musicRenderType==="fixedTone"&&(window.sett={keySignature:!0}),await a.load(musicData.score),a.zoom=state$1.zoom,a.render(),e("rendered",a),musicData.showSelection=!0};return onBeforeMount(async()=>{t(),await s(),await r(),musicData.isRenderLoading=!1}),()=>createVNode("div",{id:"musicAndSelection"},[musicData.showSelection&&createVNode(Selection,null,null)])}});var assign=make_assign(),create$1=make_create(),trim$1=make_trim(),Global$5=typeof window<"u"?window:commonjsGlobal,util$6={assign,create:create$1,trim:trim$1,bind:bind$1,slice:slice$1,each:each$7,map,pluck:pluck$1,isList:isList$1,isFunction:isFunction$1,isObject:isObject$1,Global:Global$5};function make_assign(){return Object.assign?Object.assign:function(e,t,s,r){for(var o=1;o"u"?null:console;if(i){var e=i.warn?i.warn:i.log;e.apply(i,arguments)}}function createStore(i,e,t){t||(t=""),i&&!isList(i)&&(i=[i]),e&&!isList(e)&&(e=[e]);var s=t?"__storejs_"+t+"_":"",r=t?new RegExp("^"+s):null,o=/^[a-zA-Z0-9_\-]*$/;if(!o.test(t))throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");var a={_namespacePrefix:s,_namespaceRegexp:r,_testStorage:function(c){try{var d="__storejs__test__";c.write(d,d);var m=c.read(d)===d;return c.remove(d),m}catch(u){return!1}},_assignPluginFnProp:function(c,d){var m=this[d];this[d]=function(){var g=slice(arguments,0),b=this;function y(){if(m)return each$6(arguments,function(v,x){g[x]=v}),m.apply(b,g)}var S=[y].concat(g);return c.apply(b,S)}},_serialize:function(c){return JSON.stringify(c)},_deserialize:function(c,d){if(!c)return d;var m="";try{m=JSON.parse(c)}catch(u){m=c}return m!==void 0?m:d},_addStorage:function(c){this.enabled||this._testStorage(c)&&(this.storage=c,this.enabled=!0)},_addPlugin:function(c){var d=this;if(isList(c)){each$6(c,function(g){d._addPlugin(g)});return}var m=pluck(this.plugins,function(g){return c===g});if(!m){if(this.plugins.push(c),!isFunction(c))throw new Error("Plugins must be function values that return objects");var u=c.call(this);if(!isObject(u))throw new Error("Plugins must return an object of function properties");each$6(u,function(g,b){if(!isFunction(g))throw new Error("Bad plugin property: "+b+" from plugin "+c.name+". Plugins should only return functions.");d._assignPluginFnProp(g,b)})}},addStorage:function(c){_warn("store.addStorage(storage) is deprecated. Use createStore([storages])"),this._addStorage(c)}},l=create(a,storeAPI,{plugins:[]});return l.raw={},each$6(l,function(c,d){isFunction(c)&&(l.raw[d]=bind(l,c))}),each$6(i,function(c){l._addStorage(c)}),each$6(e,function(c){l._addPlugin(c)}),l}var util$4=util$6,Global$4=util$4.Global,localStorage_1={name:"localStorage",read:read$5,write:write$5,each:each$5,remove:remove$5,clearAll:clearAll$5};function localStorage$1(){return Global$4.localStorage}function read$5(i){return localStorage$1().getItem(i)}function write$5(i,e){return localStorage$1().setItem(i,e)}function each$5(i){for(var e=localStorage$1().length-1;e>=0;e--){var t=localStorage$1().key(e);i(read$5(t),t)}}function remove$5(i){return localStorage$1().removeItem(i)}function clearAll$5(){return localStorage$1().clear()}var util$3=util$6,Global$3=util$3.Global,oldFFGlobalStorage={name:"oldFF-globalStorage",read:read$4,write:write$4,each:each$4,remove:remove$4,clearAll:clearAll$4},globalStorage=Global$3.globalStorage;function read$4(i){return globalStorage[i]}function write$4(i,e){globalStorage[i]=e}function each$4(i){for(var e=globalStorage.length-1;e>=0;e--){var t=globalStorage.key(e);i(globalStorage[t],t)}}function remove$4(i){return globalStorage.removeItem(i)}function clearAll$4(){each$4(function(i,e){delete globalStorage[i]})}var util$2=util$6,Global$2=util$2.Global,oldIEUserDataStorage={name:"oldIE-userDataStorage",write:write$3,read:read$3,each:each$3,remove:remove$3,clearAll:clearAll$3},storageName="storejs",doc$1=Global$2.document,_withStorageEl=_makeIEStorageElFunction(),disable=(Global$2.navigator?Global$2.navigator.userAgent:"").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);function write$3(i,e){if(!disable){var t=fixKey(i);_withStorageEl(function(s){s.setAttribute(t,e),s.save(storageName)})}}function read$3(i){if(!disable){var e=fixKey(i),t=null;return _withStorageEl(function(s){t=s.getAttribute(e)}),t}}function each$3(i){_withStorageEl(function(e){for(var t=e.XMLDocument.documentElement.attributes,s=t.length-1;s>=0;s--){var r=t[s];i(e.getAttribute(r.name),r.name)}})}function remove$3(i){var e=fixKey(i);_withStorageEl(function(t){t.removeAttribute(e),t.save(storageName)})}function clearAll$3(){_withStorageEl(function(i){var e=i.XMLDocument.documentElement.attributes;i.load(storageName);for(var t=e.length-1;t>=0;t--)i.removeAttribute(e[t].name);i.save(storageName)})}var forbiddenCharsRegex=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function fixKey(i){return i.replace(/^\d/,"___$&").replace(forbiddenCharsRegex,"___")}function _makeIEStorageElFunction(){if(!doc$1||!doc$1.documentElement||!doc$1.documentElement.addBehavior)return null;var i="script",e,t,s;try{t=new ActiveXObject("htmlfile"),t.open(),t.write("<"+i+">document.w=window'),t.close(),e=t.w.frames[0].document,s=e.createElement("div")}catch(r){s=doc$1.createElement("div"),e=doc$1.body}return function(r){var o=[].slice.call(arguments,0);o.unshift(s),e.appendChild(s),s.addBehavior("#default#userData"),s.load(storageName),r.apply(this,o),e.removeChild(s)}}var util$1=util$6,Global$1=util$1.Global,trim=util$1.trim,cookieStorage={name:"cookieStorage",read:read$2,write:write$2,each:each$2,remove:remove$2,clearAll:clearAll$2},doc=Global$1.document;function read$2(i){if(!i||!_has(i))return null;var e="(?:^|.*;\\s*)"+escape(i).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(doc.cookie.replace(new RegExp(e),"$1"))}function each$2(i){for(var e=doc.cookie.split(/; ?/g),t=e.length-1;t>=0;t--)if(trim(e[t])){var s=e[t].split("="),r=unescape(s[0]),o=unescape(s[1]);i(o,r)}}function write$2(i,e){i&&(doc.cookie=escape(i)+"="+escape(e)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")}function remove$2(i){!i||!_has(i)||(doc.cookie=escape(i)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function clearAll$2(){each$2(function(i,e){remove$2(e)})}function _has(i){return new RegExp("(?:^|;\\s*)"+escape(i).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(doc.cookie)}var util=util$6,Global=util.Global,sessionStorage_1={name:"sessionStorage",read:read$1,write:write$1,each:each$1,remove:remove$1,clearAll:clearAll$1};function sessionStorage$1(){return Global.sessionStorage}function read$1(i){return sessionStorage$1().getItem(i)}function write$1(i,e){return sessionStorage$1().setItem(i,e)}function each$1(i){for(var e=sessionStorage$1().length-1;e>=0;e--){var t=sessionStorage$1().key(e);i(read$1(t),t)}}function remove$1(i){return sessionStorage$1().removeItem(i)}function clearAll$1(){return sessionStorage$1().clear()}var memoryStorage_1={name:"memoryStorage",read,write,each,remove,clearAll},memoryStorage={};function read(i){return memoryStorage[i]}function write(i,e){memoryStorage[i]=e}function each(i){for(var e in memoryStorage)memoryStorage.hasOwnProperty(e)&&i(memoryStorage[e],e)}function remove(i){delete memoryStorage[i]}function clearAll(i){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(i){return i<10?"0"+i:i}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(i){return rx_escapable.lastIndex=0,rx_escapable.test(i)?'"'+i.replace(rx_escapable,function(e){var t=meta[e];return typeof t=="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+i+'"'}function str(i,e){var t,s,r,o,a=gap,l,c=e[i];switch(c&&typeof c=="object"&&typeof c.toJSON=="function"&&(c=c.toJSON(i)),typeof rep=="function"&&(c=rep.call(e,i,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,t=0;tstate$1.section.length,()=>{if(!i.value&&state$1.section.length===2){i.value=!0,e.speed=state$1.speed;const t=state$1.section[0].beatSpeed;state$1.originSpeed=t,handleSetSpeed(t)}i.value&&state$1.section.length===0&&(i.value=!1,state$1.originSpeed=e.originSpeed,handleSetSpeed(e.speed))}),()=>createVNode("div",null,null)}}),scriptRel="modulepreload",assetsURL=function(i,e){return new URL(i,e).href},seen={},__vitePreload=function i(e,t,s){if(!t||t.length===0)return e();const r=document.getElementsByTagName("link");return Promise.all(t.map(o=>{if(o=assetsURL(o,s),o in seen)return;seen[o]=!0;const a=o.endsWith(".css"),l=a?'[rel="stylesheet"]':"";if(!!s)for(let m=r.length-1;m>=0;m--){const u=r[m];if(u.href===o&&(!a||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${l}`))return;const d=document.createElement("link");if(d.rel=a?"stylesheet":scriptRel,a||(d.as="script",d.crossOrigin=""),d.href=o,document.head.appendChild(d),a)return new Promise((m,u)=>{d.addEventListener("load",m),d.addEventListener("error",()=>u(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:{72:[11,2,33,4,5,6,7,8],73:[11,2,33,4,5,6,7,88],74:[11,2,33,4,5,6,7],75:[11,2,33,4,5,6,77],76:[11,2,33,4,5,6],77:[11,2,33,4,5,7,8],78:[11,2,33,4,6,7],79:[11,2,33,4],80:[11,2,33,5,6,77],81:[11,2,33],82:[[11,2,4,5],[11,3,4,5]],83:[[11,2],[11,33,4]],84:[11,33],85:[[2,33],[11]],86:[33],87:[33,4,5,6,77],88:[1,2,33,4,5,6],89:[1,2,33,4,5,77],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,77],95:[1,2,33,5,6],96:[1,2,5,6],97:[1,2,3,4,5,77,88],98:[1,2,4,5,77,8]},"small-drum":{0:["active","active-left","active-right"],64:["left","right"]}},mappingVoicePart=(i,e)=>e==="GYM"?i:e==="COLEXIU"?{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}[i]:e==="ORCHESTRA"?{1:23,2:2,3:5,4:4,5:12,6:14,7:13,8:15,9:17}[i]:0,subjectFingering=i=>{switch(i){case 2:return{name:"flute",direction:"transverse",height:"1.6rem"};case 4:return{name:"clarinet",direction:"vertical",width:"3rem"};case 5:case 6:return{name:"saxophone",direction:"vertical",width:"4.34rem"};case 12:return{name:"trumpet",direction:"transverse",height:"1.6rem"};case 13:return{name:"horn",direction:"vertical",width:"4.98rem"};case 14:return{name:"trombone",direction:"transverse",height:"1.6rem"};case 15:return{name:"up-bass-horn",direction:"vertical",width:"4.34rem"};case 17:return{name:"tuba",direction:"vertical",width:"4.34rem"};case 120:return{name:"piccolo",direction:"vertical",width:"3rem"};default:return{}}},getFingeringConfig=async i=>{switch(i){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-3b5fe9c5.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-514ebf48.js"),[],import.meta.url)).default,relationship:relationships.trombone};case"saxophone":return{json:(await __vitePreload(()=>import("./index-5f35fb88.js"),[],import.meta.url)).default,relationship:relationships.saxophone,styles:{marginLeft:".2rem",marginRight:".3rem"}};case"small-drum":return{json:(await __vitePreload(()=>import("./index-f45b4b54.js"),[],import.meta.url)).default,relationship:relationships["up-bass-horn"],width:"180px"};default:return null}},fingeringContainer="_fingeringContainer_1okg9_1",vertical="_vertical_1okg9_9",imgs="_imgs_1okg9_13",rightContent="_rightContent_1okg9_30",yidiao="_yidiao_1okg9_73",tizhi="_tizhi_1okg9_80",canDisplay="_canDisplay_1okg9_96",activeopacity="_activeopacity_1okg9_1",leftrotates="_leftrotates_1okg9_1",rightrotates="_rightrotates_1okg9_1",styles={fingeringContainer,vertical,imgs,rightContent,yidiao,tizhi,canDisplay,activeopacity,leftrotates,rightrotates},Fingering=defineComponent({name:"fingering",setup(i,{expose:e}){const t=reactive({relationshipIndex:0,subject:null}),s=async()=>{t.subject=await getFingeringConfig(state$1.fingeringInfo.name)};onBeforeMount(()=>{s()});const r=computed(()=>{var o;return((o=state$1.times[state$1.activeNoteIndex])==null?void 0:o.realKey)||-1});return()=>{var c,d,m,u,g,b;const o=((d=(c=t.subject)==null?void 0:c.relationship)==null?void 0:d[r.value])||[],a=Array.isArray(o[1])?o[t.relationshipIndex]:o,l=Array.isArray(o[1]);return createVNode(Fragment,null,[state$1.fingeringInfo.direction==="transverse"?createVNode("div",{class:[styles.fingeringContainer]},[createVNode("span",{class:[styles.yidiao,a.includes(0)&&styles.canDisplay]},[createTextVNode("转调")]),createVNode("div",{class:styles.imgs},[createVNode("img",{src:(u=(m=t.subject)==null?void 0:m.json)==null?void 0:u.full},null),a.map((y,S)=>{var x,A;const v=typeof y=="string"?y.replace("active-",""):String(y);return createVNode("img",{"data-index":v,src:(A=(x=t.subject)==null?void 0:x.json)==null?void 0:A[v]},null)})]),createVNode("div",{class:[styles.tizhi,l&&styles.canDisplay],onClick:()=>t.relationshipIndex=t.relationshipIndex===0?1:0},[createTextVNode("替指")])]):createVNode("div",{class:[styles.fingeringContainer,styles.vertical,state$1.fingeringInfo.name]},[createVNode("div",{class:styles.imgs},[createVNode("img",{src:(b=(g=t.subject)==null?void 0:g.json)==null?void 0:b.full},null),a.map((y,S)=>{var x,A;const v=typeof y=="string"?y.replace("active-",""):String(y);return createVNode("img",{"data-index":v,src:(A=(x=t.subject)==null?void 0:x.json)==null?void 0:A[v]},null)})]),createVNode("div",{class:styles.rightContent},[createVNode("span",{class:[styles.yidiao,a.includes(0)&&styles.canDisplay]},[createTextVNode("转调")]),createVNode("div",{class:[styles.tizhi,l&&styles.canDisplay],onClick:()=>t.relationshipIndex=t.relationshipIndex===0?1:0},[createTextVNode("替指")])])])])}}}),Notfind=defineComponent({name:"notfund",render(){return createVNode(Empty,{image:"error",description:this.$route.path+" 路径不存在"},{default:()=>[createVNode(Button,{type:"primary",onClick:()=>this.$router.replace("/")},{default:()=>[createTextVNode("返回首页")]})]})}});export{supportTouch as $,mergeProps as A,nextTick as B,BORDER_UNSET_TOP_BOTTOM as C,withInstall as D,useTabStatus as E,useScrollParent as F,onUpdated as G,HAPTICS_FEEDBACK as H,onMounted as I,useRect as J,isHidden as K,Loading$1 as L,addUnit as M,request as N,getQuery as O,onBeforeMount as P,setToken as Q,setBehaviorId as R,setCampId as S,Tabs as T,storeData as U,TheError as V,RouterView as W,Fragment as X,setUserInfo as Y,getRandomKey as Z,Context as _,clamp as a,handleChangeSection as a$,createNamespace as a0,openBlock as a1,createElementBlock as a2,normalizeClass as a3,camelize as a4,isFunction$3 as a5,defineListenerProp as a6,Icon as a7,toSizeUnit as a8,resolveComponent as a9,handlePerformDetection as aA,handleStartBegin as aB,handleEndBegin as aC,NoticeBar as aD,Swipe as aE,SwipeItem as aF,Popup as aG,handleEndSoundCheck as aH,handleViewReport as aI,handleStartEvaluat as aJ,api_videoUpdate as aK,api_proxyServiceMessage as aL,connectWebsocket as aM,getNoteByMeasuresSlursStart as aN,useClickAway as aO,Button as aP,Slider as aQ,handleSetSpeed as aR,api_openCamera as aS,api_closeCamera as aT,store_legacy as aU,isVNode as aV,api_cloudDestroy as aW,postMessage as aX,useRoute$1 as aY,getBehaviorId as aZ,getCampId as a_,resolveDirective as aa,withDirectives as ab,renderSlot as ac,createBaseVNode as ad,createCommentVNode as ae,normalizeStyle as af,call as ag,toDisplayString as ah,createBlock as ai,withCtx as aj,Transition as ak,useParent as al,getCurrentInstance as am,Loading as an,useValidation as ao,multiplySizeUnit as ap,createTextVNode as aq,state$1 as ar,reactive as as,Popover as at,Icon$1 as au,evaluatingData as av,queryString as aw,api_shareAchievements as ax,Snackbar$1 as ay,browser as az,makeArrayProp as b,commonjsGlobal as b$,togglePlay as b0,Circle as b1,metronomeData as b2,handleResetPlay as b3,Badge as b4,api_back as b5,Cell as b6,showToast as b7,Popup$1 as b8,getSecondRPM as b9,handleRessetState as bA,toggleFollow as bB,getAudioCurrentTime as bC,handleFollowStart as bD,handleFollowEnd as bE,api_setEventTracking as bF,Tick as bG,FollowPractice as bH,handleInitTick as bI,api_cloudLoading as bJ,getRootScrollTop as bK,setRootScrollTop as bL,isObject$3 as bM,isPromise as bN,isFunction$4 as bO,cellSharedProps as bP,unknownProp as bQ,useId as bR,provide as bS,FORM_KEY as bT,toArray as bU,formatNumber as bV,CUSTOM_FIELD_INJECTION_KEY as bW,resetScroll as bX,hanldeDirectSelection as bY,musicscoresettingKey as bZ,useCustomFieldValue as b_,api_setStatusBarVisibility as ba,resetMusicScore as bb,onBeforeUnmount as bc,Skeleton as bd,MusicScore as be,AudioList as bf,Evaluating as bg,Fingering as bh,MeasureSpeed as bi,isSpecialShapedScreen as bj,mappingVoicePart as bk,isRhythmicExercises as bl,subjectFingering as bm,setGlobalData as bn,formateTimes as bo,Metronome as bp,createRouter as bq,createWebHashHistory as br,Notfind as bs,setStoreData as bt,createApp as bu,showLoadingToast as bv,api_savePicture as bw,closeToast as bx,musicRenderTypeKey as by,resetRenderMusicScore as bz,createNamespace$1 as c,defineComponent as d,extend$2 as e,useParent$1 as f,useExpose as g,useEventListener$1 as h,isDef$1 as i,createVNode as j,useChildren as k,pick$1 as l,makeRequiredProp as m,numericProp as n,Tab as o,preventDefault as p,makeNumericProp as q,ref as r,makeStringProp as s,truthProp as t,useTouch as u,computed as v,watchEffect as w,unitToPx as x,watch as y,isSameValue as z};