@vue-skuilder/edit-ui 0.1.29 → 0.1.31-a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- var e=Object.defineProperty,t=(t,n,r)=>((t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r)(t,"symbol"!=typeof n?n+"":n,r);import{defineComponent as n,defineAsyncComponent as r,ref as a,computed as o,onMounted as c,onUnmounted as l,watch as u,nextTick as h,onBeforeUnmount as d,createElementBlock as f,openBlock as p,createElementVNode as m,createCommentVNode as g,toDisplayString as y,Fragment as b,renderList as _,resolveComponent as w,createVNode as x,createTextVNode as k,withDirectives as S,normalizeClass as C,vModelText as M,createBlock as E,withCtx as T,normalizeStyle as A,markRaw as P,withModifiers as I,withKeys as N}from"vue";import{AudioAutoPlayer as D,RadioMultipleChoice as O,useViewable as L,useQuestionView as B,Question as R,containsComponent as V,splitByDelimiters as F,isInlineComponent as z,UserInputNumber as j,TFSelect as q,alertUser as H,SkldrMouseTrap as U,UserInputString as G,getCurrentUser as W,TagsInput as Y,CardBrowser as $,SkMouseTrap as K}from"@vue-skuilder/common-ui";import{FieldType as Q,DataShapeName as X,Status as Z,Validators as J,log as ee,NameSpacer as te,fieldConverters as ne,validationFunctionToVuetifyRule as re,isValidBulkFormat as ie,parseBulkTextToCards as ae}from"@vue-skuilder/common";import{getDataLayer as se,DocType as oe,Navigators as ce,validateProcessorConfig as le,importParsedCards as ue}from"@vue-skuilder/db";import{defineStore as he}from"pinia";const de=[{name:X.Blanks,fields:[{name:"Input",type:Q.MARKDOWN},{name:"Uploads",type:Q.MEDIA_UPLOADS}]}],fe={name:X.MATH_SingleDigitAddition,fields:[{name:"a",type:Q.INT},{name:"b",type:Q.INT}]},pe={name:X.MATH_EqualityTest,fields:[{name:"a",type:Q.STRING},{name:"b",type:Q.STRING}]};var me,ge;function ve(){return me.apply(null,arguments)}function ye(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function be(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function _e(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function we(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(_e(e,t))return!1;return!0}function xe(e){return void 0===e}function ke(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function Se(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function Ce(e,t){var n,r=[],i=e.length;for(n=0;n<i;++n)r.push(t(e[n],n));return r}function Me(e,t){for(var n in t)_e(t,n)&&(e[n]=t[n]);return _e(t,"toString")&&(e.toString=t.toString),_e(t,"valueOf")&&(e.valueOf=t.valueOf),e}function Ee(e,t,n,r){return $n(e,t,n,r,!0).utc()}function Te(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function Ae(e){var t=null,n=!1,r=e._d&&!isNaN(e._d.getTime());return r&&(t=Te(e),n=ge.call(t.parsedDateParts,(function(e){return null!=e})),r=t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n),e._strict&&(r=r&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour)),null!=Object.isFrozen&&Object.isFrozen(e)?r:(e._isValid=r,e._isValid)}function Pe(e){var t=Ee(NaN);return null!=e?Me(Te(t),e):Te(t).userInvalidated=!0,t}ge=Array.prototype.some?Array.prototype.some:function(e){var t,n=Object(this),r=n.length>>>0;for(t=0;t<r;t++)if(t in n&&e.call(this,n[t],t,n))return!0;return!1};var Ie=ve.momentProperties=[],Ne=!1;function De(e,t){var n,r,i,a=Ie.length;if(xe(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),xe(t._i)||(e._i=t._i),xe(t._f)||(e._f=t._f),xe(t._l)||(e._l=t._l),xe(t._strict)||(e._strict=t._strict),xe(t._tzm)||(e._tzm=t._tzm),xe(t._isUTC)||(e._isUTC=t._isUTC),xe(t._offset)||(e._offset=t._offset),xe(t._pf)||(e._pf=Te(t)),xe(t._locale)||(e._locale=t._locale),a>0)for(n=0;n<a;n++)xe(i=t[r=Ie[n]])||(e[r]=i);return e}function Oe(e){De(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=/* @__PURE__ */new Date(NaN)),!1===Ne&&(Ne=!0,ve.updateOffset(this),Ne=!1)}function Le(e){return e instanceof Oe||null!=e&&null!=e._isAMomentObject}function Be(e){!1===ve.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function Re(e,t){var n=!0;return Me((function(){if(null!=ve.deprecationHandler&&ve.deprecationHandler(null,e),n){var r,i,a,s=[],o=arguments.length;for(i=0;i<o;i++){if(r="","object"==typeof arguments[i]){for(a in r+="\n["+i+"] ",arguments[0])_e(arguments[0],a)&&(r+=a+": "+arguments[0][a]+", ");r=r.slice(0,-2)}else r=arguments[i];s.push(r)}Be(e+"\nArguments: "+Array.prototype.slice.call(s).join("")+"\n"+(new Error).stack),n=!1}return t.apply(this,arguments)}),t)}var Ve,Fe={};function ze(e,t){null!=ve.deprecationHandler&&ve.deprecationHandler(e,t),Fe[e]||(Be(t),Fe[e]=!0)}function je(e){return"undefined"!=typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function qe(e,t){var n,r=Me({},e);for(n in t)_e(t,n)&&(be(e[n])&&be(t[n])?(r[n]={},Me(r[n],e[n]),Me(r[n],t[n])):null!=t[n]?r[n]=t[n]:delete r[n]);for(n in e)_e(e,n)&&!_e(t,n)&&be(e[n])&&(r[n]=Me({},r[n]));return r}function He(e){null!=e&&this.set(e)}ve.suppressDeprecationWarnings=!1,ve.deprecationHandler=null,Ve=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)_e(e,t)&&n.push(t);return n};function Ue(e,t,n){var r=""+Math.abs(e),i=t-r.length;return(e>=0?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}var Ge=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,We=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Ye={},$e={};function Ke(e,t,n,r){var i=r;"string"==typeof r&&(i=function(){return this[r]()}),e&&($e[e]=i),t&&($e[t[0]]=function(){return Ue(i.apply(this,arguments),t[1],t[2])}),n&&($e[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function Qe(e,t){return e.isValid()?(t=Xe(t,e.localeData()),Ye[t]=Ye[t]||function(e){var t,n,r,i=e.match(Ge);for(t=0,n=i.length;t<n;t++)$e[i[t]]?i[t]=$e[i[t]]:i[t]=(r=i[t]).match(/\[[\s\S]/)?r.replace(/^\[|\]$/g,""):r.replace(/\\/g,"");return function(t){var r,a="";for(r=0;r<n;r++)a+=je(i[r])?i[r].call(t,e):i[r];return a}}(t),Ye[t](e)):e.localeData().invalidDate()}function Xe(e,t){var n=5;function r(e){return t.longDateFormat(e)||e}for(We.lastIndex=0;n>=0&&We.test(e);)e=e.replace(We,r),We.lastIndex=0,n-=1;return e}var Ze={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Je(e){return"string"==typeof e?Ze[e]||Ze[e.toLowerCase()]:void 0}function et(e){var t,n,r={};for(n in e)_e(e,n)&&(t=Je(n))&&(r[t]=e[n]);return r}var tt={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};var nt,rt=/\d/,it=/\d\d/,at=/\d{3}/,st=/\d{4}/,ot=/[+-]?\d{6}/,ct=/\d\d?/,lt=/\d\d\d\d?/,ut=/\d\d\d\d\d\d?/,ht=/\d{1,3}/,dt=/\d{1,4}/,ft=/[+-]?\d{1,6}/,pt=/\d+/,mt=/[+-]?\d+/,gt=/Z|[+-]\d\d:?\d\d/gi,vt=/Z|[+-]\d\d(?::?\d\d)?/gi,yt=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,bt=/^[1-9]\d?/,_t=/^([1-9]\d|\d)/;function wt(e,t,n){nt[e]=je(t)?t:function(e,r){return e&&n?n:t}}function xt(e,t){return _e(nt,e)?nt[e](t._strict,t._locale):new RegExp(kt(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,(function(e,t,n,r,i){return t||n||r||i}))))}function kt(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function St(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function Ct(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=St(t)),n}nt={};var Mt={};function Et(e,t){var n,r,i=t;for("string"==typeof e&&(e=[e]),ke(t)&&(i=function(e,n){n[t]=Ct(e)}),r=e.length,n=0;n<r;n++)Mt[e[n]]=i}function Tt(e,t){Et(e,(function(e,n,r,i){r._w=r._w||{},t(e,r._w,r,i)}))}function At(e,t,n){null!=t&&_e(Mt,e)&&Mt[e](t,n._a,n,e)}function Pt(e){return e%4==0&&e%100!=0||e%400==0}var It=0,Nt=1,Dt=2,Ot=3,Lt=4,Bt=5,Rt=6,Vt=7,Ft=8;function zt(e){return Pt(e)?366:365}Ke("Y",0,0,(function(){var e=this.year();return e<=9999?Ue(e,4):"+"+e})),Ke(0,["YY",2],0,(function(){return this.year()%100})),Ke(0,["YYYY",4],0,"year"),Ke(0,["YYYYY",5],0,"year"),Ke(0,["YYYYYY",6,!0],0,"year"),wt("Y",mt),wt("YY",ct,it),wt("YYYY",dt,st),wt("YYYYY",ft,ot),wt("YYYYYY",ft,ot),Et(["YYYYY","YYYYYY"],It),Et("YYYY",(function(e,t){t[It]=2===e.length?ve.parseTwoDigitYear(e):Ct(e)})),Et("YY",(function(e,t){t[It]=ve.parseTwoDigitYear(e)})),Et("Y",(function(e,t){t[It]=parseInt(e,10)})),ve.parseTwoDigitYear=function(e){return Ct(e)+(Ct(e)>68?1900:2e3)};var jt,qt=Ht("FullYear",!0);function Ht(e,t){return function(n){return null!=n?(Gt(this,e,n),ve.updateOffset(this,t),this):Ut(this,e)}}function Ut(e,t){if(!e.isValid())return NaN;var n=e._d,r=e._isUTC;switch(t){case"Milliseconds":return r?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return r?n.getUTCSeconds():n.getSeconds();case"Minutes":return r?n.getUTCMinutes():n.getMinutes();case"Hours":return r?n.getUTCHours():n.getHours();case"Date":return r?n.getUTCDate():n.getDate();case"Day":return r?n.getUTCDay():n.getDay();case"Month":return r?n.getUTCMonth():n.getMonth();case"FullYear":return r?n.getUTCFullYear():n.getFullYear();default:return NaN}}function Gt(e,t,n){var r,i,a,s,o;if(e.isValid()&&!isNaN(n)){switch(r=e._d,i=e._isUTC,t){case"Milliseconds":return void(i?r.setUTCMilliseconds(n):r.setMilliseconds(n));case"Seconds":return void(i?r.setUTCSeconds(n):r.setSeconds(n));case"Minutes":return void(i?r.setUTCMinutes(n):r.setMinutes(n));case"Hours":return void(i?r.setUTCHours(n):r.setHours(n));case"Date":return void(i?r.setUTCDate(n):r.setDate(n));case"FullYear":break;default:return}a=n,s=e.month(),o=29!==(o=e.date())||1!==s||Pt(a)?o:28,i?r.setUTCFullYear(a,s,o):r.setFullYear(a,s,o)}}function Wt(e,t){if(isNaN(e)||isNaN(t))return NaN;var n,r=(t%(n=12)+n)%n;return e+=(t-r)/12,1===r?Pt(e)?29:28:31-r%7%2}jt=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1},Ke("M",["MM",2],"Mo",(function(){return this.month()+1})),Ke("MMM",0,0,(function(e){return this.localeData().monthsShort(this,e)})),Ke("MMMM",0,0,(function(e){return this.localeData().months(this,e)})),wt("M",ct,bt),wt("MM",ct,it),wt("MMM",(function(e,t){return t.monthsShortRegex(e)})),wt("MMMM",(function(e,t){return t.monthsRegex(e)})),Et(["M","MM"],(function(e,t){t[Nt]=Ct(e)-1})),Et(["MMM","MMMM"],(function(e,t,n,r){var i=n._locale.monthsParse(e,r,n._strict);null!=i?t[Nt]=i:Te(n).invalidMonth=e}));var Yt="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),$t="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Kt=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Qt=yt,Xt=yt;function Zt(e,t,n){var r,i,a,s=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],r=0;r<12;++r)a=Ee([2e3,r]),this._shortMonthsParse[r]=this.monthsShort(a,"").toLocaleLowerCase(),this._longMonthsParse[r]=this.months(a,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=jt.call(this._shortMonthsParse,s))?i:null:-1!==(i=jt.call(this._longMonthsParse,s))?i:null:"MMM"===t?-1!==(i=jt.call(this._shortMonthsParse,s))||-1!==(i=jt.call(this._longMonthsParse,s))?i:null:-1!==(i=jt.call(this._longMonthsParse,s))||-1!==(i=jt.call(this._shortMonthsParse,s))?i:null}function Jt(e,t){if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=Ct(t);else if(!ke(t=e.localeData().monthsParse(t)))return e;var n=t,r=e.date();return r=r<29?r:Math.min(r,Wt(e.year(),n)),e._isUTC?e._d.setUTCMonth(n,r):e._d.setMonth(n,r),e}function en(e){return null!=e?(Jt(this,e),ve.updateOffset(this,!0),this):Ut(this,"Month")}function tn(){function e(e,t){return t.length-e.length}var t,n,r,i,a=[],s=[],o=[];for(t=0;t<12;t++)n=Ee([2e3,t]),r=kt(this.monthsShort(n,"")),i=kt(this.months(n,"")),a.push(r),s.push(i),o.push(i),o.push(r);a.sort(e),s.sort(e),o.sort(e),this._monthsRegex=new RegExp("^("+o.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+a.join("|")+")","i")}function nn(e,t,n,r,i,a,s){var o;return e<100&&e>=0?(o=new Date(e+400,t,n,r,i,a,s),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,r,i,a,s),o}function rn(e){var t,n;return e<100&&e>=0?((n=Array.prototype.slice.call(arguments))[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function an(e,t,n){var r=7+t-n;return-((7+rn(e,0,r).getUTCDay()-t)%7)+r-1}function sn(e,t,n,r,i){var a,s,o=1+7*(t-1)+(7+n-r)%7+an(e,r,i);return o<=0?s=zt(a=e-1)+o:o>zt(e)?(a=e+1,s=o-zt(e)):(a=e,s=o),{year:a,dayOfYear:s}}function on(e,t,n){var r,i,a=an(e.year(),t,n),s=Math.floor((e.dayOfYear()-a-1)/7)+1;return s<1?r=s+cn(i=e.year()-1,t,n):s>cn(e.year(),t,n)?(r=s-cn(e.year(),t,n),i=e.year()+1):(i=e.year(),r=s),{week:r,year:i}}function cn(e,t,n){var r=an(e,t,n),i=an(e+1,t,n);return(zt(e)-r+i)/7}Ke("w",["ww",2],"wo","week"),Ke("W",["WW",2],"Wo","isoWeek"),wt("w",ct,bt),wt("ww",ct,it),wt("W",ct,bt),wt("WW",ct,it),Tt(["w","ww","W","WW"],(function(e,t,n,r){t[r.substr(0,1)]=Ct(e)}));function ln(e,t){return e.slice(t,7).concat(e.slice(0,t))}Ke("d",0,"do","day"),Ke("dd",0,0,(function(e){return this.localeData().weekdaysMin(this,e)})),Ke("ddd",0,0,(function(e){return this.localeData().weekdaysShort(this,e)})),Ke("dddd",0,0,(function(e){return this.localeData().weekdays(this,e)})),Ke("e",0,0,"weekday"),Ke("E",0,0,"isoWeekday"),wt("d",ct),wt("e",ct),wt("E",ct),wt("dd",(function(e,t){return t.weekdaysMinRegex(e)})),wt("ddd",(function(e,t){return t.weekdaysShortRegex(e)})),wt("dddd",(function(e,t){return t.weekdaysRegex(e)})),Tt(["dd","ddd","dddd"],(function(e,t,n,r){var i=n._locale.weekdaysParse(e,r,n._strict);null!=i?t.d=i:Te(n).invalidWeekday=e})),Tt(["d","e","E"],(function(e,t,n,r){t[r]=Ct(e)}));var un="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),hn="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),dn="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),fn=yt,pn=yt,mn=yt;function gn(e,t,n){var r,i,a,s=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)a=Ee([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(a,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(a,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(a,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=jt.call(this._weekdaysParse,s))?i:null:"ddd"===t?-1!==(i=jt.call(this._shortWeekdaysParse,s))?i:null:-1!==(i=jt.call(this._minWeekdaysParse,s))?i:null:"dddd"===t?-1!==(i=jt.call(this._weekdaysParse,s))||-1!==(i=jt.call(this._shortWeekdaysParse,s))||-1!==(i=jt.call(this._minWeekdaysParse,s))?i:null:"ddd"===t?-1!==(i=jt.call(this._shortWeekdaysParse,s))||-1!==(i=jt.call(this._weekdaysParse,s))||-1!==(i=jt.call(this._minWeekdaysParse,s))?i:null:-1!==(i=jt.call(this._minWeekdaysParse,s))||-1!==(i=jt.call(this._weekdaysParse,s))||-1!==(i=jt.call(this._shortWeekdaysParse,s))?i:null}function vn(){function e(e,t){return t.length-e.length}var t,n,r,i,a,s=[],o=[],c=[],l=[];for(t=0;t<7;t++)n=Ee([2e3,1]).day(t),r=kt(this.weekdaysMin(n,"")),i=kt(this.weekdaysShort(n,"")),a=kt(this.weekdays(n,"")),s.push(r),o.push(i),c.push(a),l.push(r),l.push(i),l.push(a);s.sort(e),o.sort(e),c.sort(e),l.sort(e),this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+c.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+s.join("|")+")","i")}function yn(){return this.hours()%12||12}function bn(e,t){Ke(e,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)}))}function _n(e,t){return t._meridiemParse}Ke("H",["HH",2],0,"hour"),Ke("h",["hh",2],0,yn),Ke("k",["kk",2],0,(function(){return this.hours()||24})),Ke("hmm",0,0,(function(){return""+yn.apply(this)+Ue(this.minutes(),2)})),Ke("hmmss",0,0,(function(){return""+yn.apply(this)+Ue(this.minutes(),2)+Ue(this.seconds(),2)})),Ke("Hmm",0,0,(function(){return""+this.hours()+Ue(this.minutes(),2)})),Ke("Hmmss",0,0,(function(){return""+this.hours()+Ue(this.minutes(),2)+Ue(this.seconds(),2)})),bn("a",!0),bn("A",!1),wt("a",_n),wt("A",_n),wt("H",ct,_t),wt("h",ct,bt),wt("k",ct,bt),wt("HH",ct,it),wt("hh",ct,it),wt("kk",ct,it),wt("hmm",lt),wt("hmmss",ut),wt("Hmm",lt),wt("Hmmss",ut),Et(["H","HH"],Ot),Et(["k","kk"],(function(e,t,n){var r=Ct(e);t[Ot]=24===r?0:r})),Et(["a","A"],(function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e})),Et(["h","hh"],(function(e,t,n){t[Ot]=Ct(e),Te(n).bigHour=!0})),Et("hmm",(function(e,t,n){var r=e.length-2;t[Ot]=Ct(e.substr(0,r)),t[Lt]=Ct(e.substr(r)),Te(n).bigHour=!0})),Et("hmmss",(function(e,t,n){var r=e.length-4,i=e.length-2;t[Ot]=Ct(e.substr(0,r)),t[Lt]=Ct(e.substr(r,2)),t[Bt]=Ct(e.substr(i)),Te(n).bigHour=!0})),Et("Hmm",(function(e,t,n){var r=e.length-2;t[Ot]=Ct(e.substr(0,r)),t[Lt]=Ct(e.substr(r))})),Et("Hmmss",(function(e,t,n){var r=e.length-4,i=e.length-2;t[Ot]=Ct(e.substr(0,r)),t[Lt]=Ct(e.substr(r,2)),t[Bt]=Ct(e.substr(i))}));var wn=Ht("Hours",!0);var xn,kn={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Yt,monthsShort:$t,week:{dow:0,doy:6},weekdays:un,weekdaysMin:dn,weekdaysShort:hn,meridiemParse:/[ap]\.?m?\.?/i},Sn={},Cn={};function Mn(e,t){var n,r=Math.min(e.length,t.length);for(n=0;n<r;n+=1)if(e[n]!==t[n])return n;return r}function En(e){return e?e.toLowerCase().replace("_","-"):e}function Tn(e){var t=null;if(void 0===Sn[e]&&"undefined"!=typeof module&&module&&module.exports&&function(e){return!(!e||!e.match("^[^/\\\\]*$"))}(e))try{t=xn._abbr,require("./locale/"+e),An(t)}catch(tl){Sn[e]=null}return Sn[e]}function An(e,t){var n;return e&&((n=xe(t)?In(e):Pn(e,t))?xn=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),xn._abbr}function Pn(e,t){if(null!==t){var n,r=kn;if(t.abbr=e,null!=Sn[e])ze("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),r=Sn[e]._config;else if(null!=t.parentLocale)if(null!=Sn[t.parentLocale])r=Sn[t.parentLocale]._config;else{if(null==(n=Tn(t.parentLocale)))return Cn[t.parentLocale]||(Cn[t.parentLocale]=[]),Cn[t.parentLocale].push({name:e,config:t}),null;r=n._config}return Sn[e]=new He(qe(r,t)),Cn[e]&&Cn[e].forEach((function(e){Pn(e.name,e.config)})),An(e),Sn[e]}return delete Sn[e],null}function In(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return xn;if(!ye(e)){if(t=Tn(e))return t;e=[e]}return function(e){for(var t,n,r,i,a=0;a<e.length;){for(t=(i=En(e[a]).split("-")).length,n=(n=En(e[a+1]))?n.split("-"):null;t>0;){if(r=Tn(i.slice(0,t).join("-")))return r;if(n&&n.length>=t&&Mn(i,n)>=t-1)break;t--}a++}return xn}(e)}function Nn(e){var t,n=e._a;return n&&-2===Te(e).overflow&&(t=n[Nt]<0||n[Nt]>11?Nt:n[Dt]<1||n[Dt]>Wt(n[It],n[Nt])?Dt:n[Ot]<0||n[Ot]>24||24===n[Ot]&&(0!==n[Lt]||0!==n[Bt]||0!==n[Rt])?Ot:n[Lt]<0||n[Lt]>59?Lt:n[Bt]<0||n[Bt]>59?Bt:n[Rt]<0||n[Rt]>999?Rt:-1,Te(e)._overflowDayOfYear&&(t<It||t>Dt)&&(t=Dt),Te(e)._overflowWeeks&&-1===t&&(t=Vt),Te(e)._overflowWeekday&&-1===t&&(t=Ft),Te(e).overflow=t),e}var Dn=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,On=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ln=/Z|[+-]\d\d(?::?\d\d)?/,Bn=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Rn=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Vn=/^\/?Date\((-?\d+)/i,Fn=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,zn={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function jn(e){var t,n,r,i,a,s,o=e._i,c=Dn.exec(o)||On.exec(o),l=Bn.length,u=Rn.length;if(c){for(Te(e).iso=!0,t=0,n=l;t<n;t++)if(Bn[t][1].exec(c[1])){i=Bn[t][0],r=!1!==Bn[t][2];break}if(null==i)return void(e._isValid=!1);if(c[3]){for(t=0,n=u;t<n;t++)if(Rn[t][1].exec(c[3])){a=(c[2]||" ")+Rn[t][0];break}if(null==a)return void(e._isValid=!1)}if(!r&&null!=a)return void(e._isValid=!1);if(c[4]){if(!Ln.exec(c[4]))return void(e._isValid=!1);s="Z"}e._f=i+(a||"")+(s||""),Wn(e)}else e._isValid=!1}function qn(e){var t=parseInt(e,10);return t<=49?2e3+t:t<=999?1900+t:t}function Hn(e){var t,n,r,i,a,s,o,c,l=Fn.exec(e._i.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(l){if(n=l[4],r=l[3],i=l[2],a=l[5],s=l[6],o=l[7],c=[qn(n),$t.indexOf(r),parseInt(i,10),parseInt(a,10),parseInt(s,10)],o&&c.push(parseInt(o,10)),t=c,!function(e,t,n){return!e||hn.indexOf(e)===new Date(t[0],t[1],t[2]).getDay()||(Te(n).weekdayMismatch=!0,n._isValid=!1,!1)}(l[1],t,e))return;e._a=t,e._tzm=function(e,t,n){if(e)return zn[e];if(t)return 0;var r=parseInt(n,10),i=r%100;return(r-i)/100*60+i}(l[8],l[9],l[10]),e._d=rn.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),Te(e).rfc2822=!0}else e._isValid=!1}function Un(e,t,n){return null!=e?e:null!=t?t:n}function Gn(e){var t,n,r,i,a,s=[];if(!e._d){for(r=function(e){var t=new Date(ve.now());return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}(e),e._w&&null==e._a[Dt]&&null==e._a[Nt]&&function(e){var t,n,r,i,a,s,o,c,l;t=e._w,null!=t.GG||null!=t.W||null!=t.E?(a=1,s=4,n=Un(t.GG,e._a[It],on(Kn(),1,4).year),r=Un(t.W,1),((i=Un(t.E,1))<1||i>7)&&(c=!0)):(a=e._locale._week.dow,s=e._locale._week.doy,l=on(Kn(),a,s),n=Un(t.gg,e._a[It],l.year),r=Un(t.w,l.week),null!=t.d?((i=t.d)<0||i>6)&&(c=!0):null!=t.e?(i=t.e+a,(t.e<0||t.e>6)&&(c=!0)):i=a);r<1||r>cn(n,a,s)?Te(e)._overflowWeeks=!0:null!=c?Te(e)._overflowWeekday=!0:(o=sn(n,r,i,a,s),e._a[It]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(a=Un(e._a[It],r[It]),(e._dayOfYear>zt(a)||0===e._dayOfYear)&&(Te(e)._overflowDayOfYear=!0),n=rn(a,0,e._dayOfYear),e._a[Nt]=n.getUTCMonth(),e._a[Dt]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=s[t]=r[t];for(;t<7;t++)e._a[t]=s[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[Ot]&&0===e._a[Lt]&&0===e._a[Bt]&&0===e._a[Rt]&&(e._nextDay=!0,e._a[Ot]=0),e._d=(e._useUTC?rn:nn).apply(null,s),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Ot]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(Te(e).weekdayMismatch=!0)}}function Wn(e){if(e._f!==ve.ISO_8601)if(e._f!==ve.RFC_2822){e._a=[],Te(e).empty=!0;var t,n,r,i,a,s,o,c=""+e._i,l=c.length,u=0;for(o=(r=Xe(e._f,e._locale).match(Ge)||[]).length,t=0;t<o;t++)i=r[t],(n=(c.match(xt(i,e))||[])[0])&&((a=c.substr(0,c.indexOf(n))).length>0&&Te(e).unusedInput.push(a),c=c.slice(c.indexOf(n)+n.length),u+=n.length),$e[i]?(n?Te(e).empty=!1:Te(e).unusedTokens.push(i),At(i,n,e)):e._strict&&!n&&Te(e).unusedTokens.push(i);Te(e).charsLeftOver=l-u,c.length>0&&Te(e).unusedInput.push(c),e._a[Ot]<=12&&!0===Te(e).bigHour&&e._a[Ot]>0&&(Te(e).bigHour=void 0),Te(e).parsedDateParts=e._a.slice(0),Te(e).meridiem=e._meridiem,e._a[Ot]=function(e,t,n){var r;if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?((r=e.isPM(n))&&t<12&&(t+=12),r||12!==t||(t=0),t):t}(e._locale,e._a[Ot],e._meridiem),null!==(s=Te(e).era)&&(e._a[It]=e._locale.erasConvertYear(s,e._a[It])),Gn(e),Nn(e)}else Hn(e);else jn(e)}function Yn(e){var t=e._i,n=e._f;return e._locale=e._locale||In(e._l),null===t||void 0===n&&""===t?Pe({nullInput:!0}):("string"==typeof t&&(e._i=t=e._locale.preparse(t)),Le(t)?new Oe(Nn(t)):(Se(t)?e._d=t:ye(n)?function(e){var t,n,r,i,a,s,o=!1,c=e._f.length;if(0===c)return Te(e).invalidFormat=!0,void(e._d=/* @__PURE__ */new Date(NaN));for(i=0;i<c;i++)a=0,s=!1,t=De({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],Wn(t),Ae(t)&&(s=!0),a+=Te(t).charsLeftOver,a+=10*Te(t).unusedTokens.length,Te(t).score=a,o?a<r&&(r=a,n=t):(null==r||a<r||s)&&(r=a,n=t,s&&(o=!0));Me(e,n||t)}(e):n?Wn(e):function(e){var t=e._i;xe(t)?e._d=new Date(ve.now()):Se(t)?e._d=new Date(t.valueOf()):"string"==typeof t?function(e){var t=Vn.exec(e._i);null===t?(jn(e),!1===e._isValid&&(delete e._isValid,Hn(e),!1===e._isValid&&(delete e._isValid,e._strict?e._isValid=!1:ve.createFromInputFallback(e)))):e._d=/* @__PURE__ */new Date(+t[1])}(e):ye(t)?(e._a=Ce(t.slice(0),(function(e){return parseInt(e,10)})),Gn(e)):be(t)?function(e){if(!e._d){var t=et(e._i),n=void 0===t.day?t.date:t.day;e._a=Ce([t.year,t.month,n,t.hour,t.minute,t.second,t.millisecond],(function(e){return e&&parseInt(e,10)})),Gn(e)}}(e):ke(t)?e._d=new Date(t):ve.createFromInputFallback(e)}(e),Ae(e)||(e._d=null),e))}function $n(e,t,n,r,i){var a,s={};return!0!==t&&!1!==t||(r=t,t=void 0),!0!==n&&!1!==n||(r=n,n=void 0),(be(e)&&we(e)||ye(e)&&0===e.length)&&(e=void 0),s._isAMomentObject=!0,s._useUTC=s._isUTC=i,s._l=n,s._i=e,s._f=t,s._strict=r,(a=new Oe(Nn(Yn(s))))._nextDay&&(a.add(1,"d"),a._nextDay=void 0),a}function Kn(e,t,n,r){return $n(e,t,n,r,!1)}ve.createFromInputFallback=Re("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",(function(e){e._d=/* @__PURE__ */new Date(e._i+(e._useUTC?" UTC":""))})),ve.ISO_8601=function(){},ve.RFC_2822=function(){};var Qn=Re("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var e=Kn.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:Pe()})),Xn=Re("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var e=Kn.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:Pe()}));function Zn(e,t){var n,r;if(1===t.length&&ye(t[0])&&(t=t[0]),!t.length)return Kn();for(n=t[0],r=1;r<t.length;++r)t[r].isValid()&&!t[r][e](n)||(n=t[r]);return n}var Jn=["year","quarter","month","week","day","hour","minute","second","millisecond"];function er(e){var t=et(e),n=t.year||0,r=t.quarter||0,i=t.month||0,a=t.week||t.isoWeek||0,s=t.day||0,o=t.hour||0,c=t.minute||0,l=t.second||0,u=t.millisecond||0;this._isValid=function(e){var t,n,r=!1,i=Jn.length;for(t in e)if(_e(e,t)&&(-1===jt.call(Jn,t)||null!=e[t]&&isNaN(e[t])))return!1;for(n=0;n<i;++n)if(e[Jn[n]]){if(r)return!1;parseFloat(e[Jn[n]])!==Ct(e[Jn[n]])&&(r=!0)}return!0}(t),this._milliseconds=+u+1e3*l+6e4*c+1e3*o*60*60,this._days=+s+7*a,this._months=+i+3*r+12*n,this._data={},this._locale=In(),this._bubble()}function tr(e){return e instanceof er}function nr(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function rr(e,t){Ke(e,0,0,(function(){var e=this.utcOffset(),n="+";return e<0&&(e=-e,n="-"),n+Ue(~~(e/60),2)+t+Ue(~~e%60,2)}))}rr("Z",":"),rr("ZZ",""),wt("Z",vt),wt("ZZ",vt),Et(["Z","ZZ"],(function(e,t,n){n._useUTC=!0,n._tzm=ar(vt,e)}));var ir=/([\+\-]|\d\d)/gi;function ar(e,t){var n,r,i=(t||"").match(e);return null===i?null:0===(r=60*(n=((i[i.length-1]||[])+"").match(ir)||["-",0,0])[1]+Ct(n[2]))?0:"+"===n[0]?r:-r}function sr(e,t){var n,r;return t._isUTC?(n=t.clone(),r=(Le(e)||Se(e)?e.valueOf():Kn(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+r),ve.updateOffset(n,!1),n):Kn(e).local()}function or(e){return-Math.round(e._d.getTimezoneOffset())}function cr(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}ve.updateOffset=function(){};var lr=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,ur=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function hr(e,t){var n,r,i,a=e,s=null;return tr(e)?a={ms:e._milliseconds,d:e._days,M:e._months}:ke(e)||!isNaN(+e)?(a={},t?a[t]=+e:a.milliseconds=+e):(s=lr.exec(e))?(n="-"===s[1]?-1:1,a={y:0,d:Ct(s[Dt])*n,h:Ct(s[Ot])*n,m:Ct(s[Lt])*n,s:Ct(s[Bt])*n,ms:Ct(nr(1e3*s[Rt]))*n}):(s=ur.exec(e))?(n="-"===s[1]?-1:1,a={y:dr(s[2],n),M:dr(s[3],n),w:dr(s[4],n),d:dr(s[5],n),h:dr(s[6],n),m:dr(s[7],n),s:dr(s[8],n)}):null==a?a={}:"object"==typeof a&&("from"in a||"to"in a)&&(i=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=sr(t,e),e.isBefore(t)?n=fr(e,t):((n=fr(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(Kn(a.from),Kn(a.to)),(a={}).ms=i.milliseconds,a.M=i.months),r=new er(a),tr(e)&&_e(e,"_locale")&&(r._locale=e._locale),tr(e)&&_e(e,"_isValid")&&(r._isValid=e._isValid),r}function dr(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function fr(e,t){var n={};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function pr(e,t){return function(n,r){var i;return null===r||isNaN(+r)||(ze(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),i=n,n=r,r=i),mr(this,hr(n,r),e),this}}function mr(e,t,n,r){var i=t._milliseconds,a=nr(t._days),s=nr(t._months);e.isValid()&&(r=null==r||r,s&&Jt(e,Ut(e,"Month")+s*n),a&&Gt(e,"Date",Ut(e,"Date")+a*n),i&&e._d.setTime(e._d.valueOf()+i*n),r&&ve.updateOffset(e,a||s))}hr.fn=er.prototype,hr.invalid=function(){return hr(NaN)};var gr=pr(1,"add"),vr=pr(-1,"subtract");function yr(e){return"string"==typeof e||e instanceof String}function br(e){return Le(e)||Se(e)||yr(e)||ke(e)||function(e){var t=ye(e),n=!1;t&&(n=0===e.filter((function(t){return!ke(t)&&yr(e)})).length);return t&&n}(e)||function(e){var t,n,r=be(e)&&!we(e),i=!1,a=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],s=a.length;for(t=0;t<s;t+=1)n=a[t],i=i||_e(e,n);return r&&i}(e)||null==e}function _r(e,t){if(e.date()<t.date())return-_r(t,e);var n=12*(t.year()-e.year())+(t.month()-e.month()),r=e.clone().add(n,"months");return-(n+(t-r<0?(t-r)/(r-e.clone().add(n-1,"months")):(t-r)/(e.clone().add(n+1,"months")-r)))||0}function wr(e){var t;return void 0===e?this._locale._abbr:(null!=(t=In(e))&&(this._locale=t),this)}ve.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",ve.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var xr=Re("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",(function(e){return void 0===e?this.localeData():this.locale(e)}));function kr(){return this._locale}var Sr=1e3,Cr=6e4,Mr=36e5,Er=126227808e5;function Tr(e,t){return(e%t+t)%t}function Ar(e,t,n){return e<100&&e>=0?new Date(e+400,t,n)-Er:new Date(e,t,n).valueOf()}function Pr(e,t,n){return e<100&&e>=0?Date.UTC(e+400,t,n)-Er:Date.UTC(e,t,n)}function Ir(e,t){return t.erasAbbrRegex(e)}function Nr(){var e,t,n,r,i,a=[],s=[],o=[],c=[],l=this.eras();for(e=0,t=l.length;e<t;++e)n=kt(l[e].name),r=kt(l[e].abbr),i=kt(l[e].narrow),s.push(n),a.push(r),o.push(i),c.push(n),c.push(r),c.push(i);this._erasRegex=new RegExp("^("+c.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+s.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+a.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+o.join("|")+")","i")}function Dr(e,t){Ke(0,[e,e.length],0,t)}function Or(e,t,n,r,i){var a;return null==e?on(this,r,i).year:(t>(a=cn(e,r,i))&&(t=a),Lr.call(this,e,t,n,r,i))}function Lr(e,t,n,r,i){var a=sn(e,t,n,r,i),s=rn(a.year,0,a.dayOfYear);return this.year(s.getUTCFullYear()),this.month(s.getUTCMonth()),this.date(s.getUTCDate()),this}Ke("N",0,0,"eraAbbr"),Ke("NN",0,0,"eraAbbr"),Ke("NNN",0,0,"eraAbbr"),Ke("NNNN",0,0,"eraName"),Ke("NNNNN",0,0,"eraNarrow"),Ke("y",["y",1],"yo","eraYear"),Ke("y",["yy",2],0,"eraYear"),Ke("y",["yyy",3],0,"eraYear"),Ke("y",["yyyy",4],0,"eraYear"),wt("N",Ir),wt("NN",Ir),wt("NNN",Ir),wt("NNNN",(function(e,t){return t.erasNameRegex(e)})),wt("NNNNN",(function(e,t){return t.erasNarrowRegex(e)})),Et(["N","NN","NNN","NNNN","NNNNN"],(function(e,t,n,r){var i=n._locale.erasParse(e,r,n._strict);i?Te(n).era=i:Te(n).invalidEra=e})),wt("y",pt),wt("yy",pt),wt("yyy",pt),wt("yyyy",pt),wt("yo",(function(e,t){return t._eraYearOrdinalRegex||pt})),Et(["y","yy","yyy","yyyy"],It),Et(["yo"],(function(e,t,n,r){var i;n._locale._eraYearOrdinalRegex&&(i=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[It]=n._locale.eraYearOrdinalParse(e,i):t[It]=parseInt(e,10)})),Ke(0,["gg",2],0,(function(){return this.weekYear()%100})),Ke(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),Dr("gggg","weekYear"),Dr("ggggg","weekYear"),Dr("GGGG","isoWeekYear"),Dr("GGGGG","isoWeekYear"),wt("G",mt),wt("g",mt),wt("GG",ct,it),wt("gg",ct,it),wt("GGGG",dt,st),wt("gggg",dt,st),wt("GGGGG",ft,ot),wt("ggggg",ft,ot),Tt(["gggg","ggggg","GGGG","GGGGG"],(function(e,t,n,r){t[r.substr(0,2)]=Ct(e)})),Tt(["gg","GG"],(function(e,t,n,r){t[r]=ve.parseTwoDigitYear(e)})),Ke("Q",0,"Qo","quarter"),wt("Q",rt),Et("Q",(function(e,t){t[Nt]=3*(Ct(e)-1)})),Ke("D",["DD",2],"Do","date"),wt("D",ct,bt),wt("DD",ct,it),wt("Do",(function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient})),Et(["D","DD"],Dt),Et("Do",(function(e,t){t[Dt]=Ct(e.match(ct)[0])}));var Br=Ht("Date",!0);Ke("DDD",["DDDD",3],"DDDo","dayOfYear"),wt("DDD",ht),wt("DDDD",at),Et(["DDD","DDDD"],(function(e,t,n){n._dayOfYear=Ct(e)})),Ke("m",["mm",2],0,"minute"),wt("m",ct,_t),wt("mm",ct,it),Et(["m","mm"],Lt);var Rr=Ht("Minutes",!1);Ke("s",["ss",2],0,"second"),wt("s",ct,_t),wt("ss",ct,it),Et(["s","ss"],Bt);var Vr,Fr,zr=Ht("Seconds",!1);for(Ke("S",0,0,(function(){return~~(this.millisecond()/100)})),Ke(0,["SS",2],0,(function(){return~~(this.millisecond()/10)})),Ke(0,["SSS",3],0,"millisecond"),Ke(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),Ke(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),Ke(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),Ke(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),Ke(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),Ke(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),wt("S",ht,rt),wt("SS",ht,it),wt("SSS",ht,at),Vr="SSSS";Vr.length<=9;Vr+="S")wt(Vr,pt);function jr(e,t){t[Rt]=Ct(1e3*("0."+e))}for(Vr="S";Vr.length<=9;Vr+="S")Et(Vr,jr);Fr=Ht("Milliseconds",!1),Ke("z",0,0,"zoneAbbr"),Ke("zz",0,0,"zoneName");var qr=Oe.prototype;function Hr(e){return e}qr.add=gr,qr.calendar=function(e,t){1===arguments.length&&(arguments[0]?br(arguments[0])?(e=arguments[0],t=void 0):function(e){var t,n=be(e)&&!we(e),r=!1,i=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"];for(t=0;t<i.length;t+=1)r=r||_e(e,i[t]);return n&&r}(arguments[0])&&(t=arguments[0],e=void 0):(e=void 0,t=void 0));var n=e||Kn(),r=sr(n,this).startOf("day"),i=ve.calendarFormat(this,r)||"sameElse",a=t&&(je(t[i])?t[i].call(this,n):t[i]);return this.format(a||this.localeData().calendar(i,this,Kn(n)))},qr.clone=function(){return new Oe(this)},qr.diff=function(e,t,n){var r,i,a;if(!this.isValid())return NaN;if(!(r=sr(e,this)).isValid())return NaN;switch(i=6e4*(r.utcOffset()-this.utcOffset()),t=Je(t)){case"year":a=_r(this,r)/12;break;case"month":a=_r(this,r);break;case"quarter":a=_r(this,r)/3;break;case"second":a=(this-r)/1e3;break;case"minute":a=(this-r)/6e4;break;case"hour":a=(this-r)/36e5;break;case"day":a=(this-r-i)/864e5;break;case"week":a=(this-r-i)/6048e5;break;default:a=this-r}return n?a:St(a)},qr.endOf=function(e){var t,n;if(void 0===(e=Je(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?Pr:Ar,e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=Mr-Tr(t+(this._isUTC?0:this.utcOffset()*Cr),Mr)-1;break;case"minute":t=this._d.valueOf(),t+=Cr-Tr(t,Cr)-1;break;case"second":t=this._d.valueOf(),t+=Sr-Tr(t,Sr)-1}return this._d.setTime(t),ve.updateOffset(this,!0),this},qr.format=function(e){e||(e=this.isUtc()?ve.defaultFormatUtc:ve.defaultFormat);var t=Qe(this,e);return this.localeData().postformat(t)},qr.from=function(e,t){return this.isValid()&&(Le(e)&&e.isValid()||Kn(e).isValid())?hr({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},qr.fromNow=function(e){return this.from(Kn(),e)},qr.to=function(e,t){return this.isValid()&&(Le(e)&&e.isValid()||Kn(e).isValid())?hr({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},qr.toNow=function(e){return this.to(Kn(),e)},qr.get=function(e){return je(this[e=Je(e)])?this[e]():this},qr.invalidAt=function(){return Te(this).overflow},qr.isAfter=function(e,t){var n=Le(e)?e:Kn(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=Je(t)||"millisecond")?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())},qr.isBefore=function(e,t){var n=Le(e)?e:Kn(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=Je(t)||"millisecond")?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())},qr.isBetween=function(e,t,n,r){var i=Le(e)?e:Kn(e),a=Le(t)?t:Kn(t);return!!(this.isValid()&&i.isValid()&&a.isValid())&&(("("===(r=r||"()")[0]?this.isAfter(i,n):!this.isBefore(i,n))&&(")"===r[1]?this.isBefore(a,n):!this.isAfter(a,n)))},qr.isSame=function(e,t){var n,r=Le(e)?e:Kn(e);return!(!this.isValid()||!r.isValid())&&("millisecond"===(t=Je(t)||"millisecond")?this.valueOf()===r.valueOf():(n=r.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))},qr.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},qr.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},qr.isValid=function(){return Ae(this)},qr.lang=xr,qr.locale=wr,qr.localeData=kr,qr.max=Xn,qr.min=Qn,qr.parsingFlags=function(){return Me({},Te(this))},qr.set=function(e,t){if("object"==typeof e){var n,r=function(e){var t,n=[];for(t in e)_e(e,t)&&n.push({unit:t,priority:tt[t]});return n.sort((function(e,t){return e.priority-t.priority})),n}(e=et(e)),i=r.length;for(n=0;n<i;n++)this[r[n].unit](e[r[n].unit])}else if(je(this[e=Je(e)]))return this[e](t);return this},qr.startOf=function(e){var t,n;if(void 0===(e=Je(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?Pr:Ar,e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=Tr(t+(this._isUTC?0:this.utcOffset()*Cr),Mr);break;case"minute":t=this._d.valueOf(),t-=Tr(t,Cr);break;case"second":t=this._d.valueOf(),t-=Tr(t,Sr)}return this._d.setTime(t),ve.updateOffset(this,!0),this},qr.subtract=vr,qr.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},qr.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},qr.toDate=function(){return new Date(this.valueOf())},qr.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,n=t?this.clone().utc():this;return n.year()<0||n.year()>9999?Qe(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):je(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",Qe(n,"Z")):Qe(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},qr.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t,n,r="moment",i="";return this.isLocal()||(r=0===this.utcOffset()?"moment.utc":"moment.parseZone",i="Z"),e="["+r+'("]',t=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",n=i+'[")]',this.format(e+t+"-MM-DD[T]HH:mm:ss.SSS"+n)},"undefined"!=typeof Symbol&&null!=Symbol.for&&(qr[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),qr.toJSON=function(){return this.isValid()?this.toISOString():null},qr.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},qr.unix=function(){return Math.floor(this.valueOf()/1e3)},qr.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},qr.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},qr.eraName=function(){var e,t,n,r=this.localeData().eras();for(e=0,t=r.length;e<t;++e){if(n=this.clone().startOf("day").valueOf(),r[e].since<=n&&n<=r[e].until)return r[e].name;if(r[e].until<=n&&n<=r[e].since)return r[e].name}return""},qr.eraNarrow=function(){var e,t,n,r=this.localeData().eras();for(e=0,t=r.length;e<t;++e){if(n=this.clone().startOf("day").valueOf(),r[e].since<=n&&n<=r[e].until)return r[e].narrow;if(r[e].until<=n&&n<=r[e].since)return r[e].narrow}return""},qr.eraAbbr=function(){var e,t,n,r=this.localeData().eras();for(e=0,t=r.length;e<t;++e){if(n=this.clone().startOf("day").valueOf(),r[e].since<=n&&n<=r[e].until)return r[e].abbr;if(r[e].until<=n&&n<=r[e].since)return r[e].abbr}return""},qr.eraYear=function(){var e,t,n,r,i=this.localeData().eras();for(e=0,t=i.length;e<t;++e)if(n=i[e].since<=i[e].until?1:-1,r=this.clone().startOf("day").valueOf(),i[e].since<=r&&r<=i[e].until||i[e].until<=r&&r<=i[e].since)return(this.year()-ve(i[e].since).year())*n+i[e].offset;return this.year()},qr.year=qt,qr.isLeapYear=function(){return Pt(this.year())},qr.weekYear=function(e){return Or.call(this,e,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)},qr.isoWeekYear=function(e){return Or.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},qr.quarter=qr.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},qr.month=en,qr.daysInMonth=function(){return Wt(this.year(),this.month())},qr.week=qr.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},qr.isoWeek=qr.isoWeeks=function(e){var t=on(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},qr.weeksInYear=function(){var e=this.localeData()._week;return cn(this.year(),e.dow,e.doy)},qr.weeksInWeekYear=function(){var e=this.localeData()._week;return cn(this.weekYear(),e.dow,e.doy)},qr.isoWeeksInYear=function(){return cn(this.year(),1,4)},qr.isoWeeksInISOWeekYear=function(){return cn(this.isoWeekYear(),1,4)},qr.date=Br,qr.day=qr.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t=Ut(this,"Day");return null!=e?(e=function(e,t){return"string"!=typeof e?e:isNaN(e)?"number"==typeof(e=t.weekdaysParse(e))?e:null:parseInt(e,10)}(e,this.localeData()),this.add(e-t,"d")):t},qr.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},qr.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null!=e){var t=function(e,t){return"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}(e,this.localeData());return this.day(this.day()%7?t:t-7)}return this.day()||7},qr.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},qr.hour=qr.hours=wn,qr.minute=qr.minutes=Rr,qr.second=qr.seconds=zr,qr.millisecond=qr.milliseconds=Fr,qr.utcOffset=function(e,t,n){var r,i=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null!=e){if("string"==typeof e){if(null===(e=ar(vt,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(r=or(this)),this._offset=e,this._isUTC=!0,null!=r&&this.add(r,"m"),i!==e&&(!t||this._changeInProgress?mr(this,hr(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,ve.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?i:or(this)},qr.utc=function(e){return this.utcOffset(0,e)},qr.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(or(this),"m")),this},qr.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=ar(gt,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},qr.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?Kn(e).utcOffset():0,(this.utcOffset()-e)%60==0)},qr.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},qr.isLocal=function(){return!!this.isValid()&&!this._isUTC},qr.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},qr.isUtc=cr,qr.isUTC=cr,qr.zoneAbbr=function(){return this._isUTC?"UTC":""},qr.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},qr.dates=Re("dates accessor is deprecated. Use date instead.",Br),qr.months=Re("months accessor is deprecated. Use month instead",en),qr.years=Re("years accessor is deprecated. Use year instead",qt),qr.zone=Re("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",(function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()})),qr.isDSTShifted=Re("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",(function(){if(!xe(this._isDSTShifted))return this._isDSTShifted;var e,t={};return De(t,this),(t=Yn(t))._a?(e=t._isUTC?Ee(t._a):Kn(t._a),this._isDSTShifted=this.isValid()&&function(e,t){var n,r=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),a=0;for(n=0;n<r;n++)Ct(e[n])!==Ct(t[n])&&a++;return a+i}(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}));var Ur=He.prototype;function Gr(e,t,n,r){var i=In(),a=Ee().set(r,t);return i[n](a,e)}function Wr(e,t,n){if(ke(e)&&(t=e,e=void 0),e=e||"",null!=t)return Gr(e,t,n,"month");var r,i=[];for(r=0;r<12;r++)i[r]=Gr(e,r,n,"month");return i}function Yr(e,t,n,r){"boolean"==typeof e?(ke(t)&&(n=t,t=void 0),t=t||""):(n=t=e,e=!1,ke(t)&&(n=t,t=void 0),t=t||"");var i,a=In(),s=e?a._week.dow:0,o=[];if(null!=n)return Gr(t,(n+s)%7,r,"day");for(i=0;i<7;i++)o[i]=Gr(t,(i+s)%7,r,"day");return o}Ur.calendar=function(e,t,n){var r=this._calendar[e]||this._calendar.sameElse;return je(r)?r.call(t,n):r},Ur.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(Ge).map((function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e})).join(""),this._longDateFormat[e])},Ur.invalidDate=function(){return this._invalidDate},Ur.ordinal=function(e){return this._ordinal.replace("%d",e)},Ur.preparse=Hr,Ur.postformat=Hr,Ur.relativeTime=function(e,t,n,r){var i=this._relativeTime[n];return je(i)?i(e,t,n,r):i.replace(/%d/i,e)},Ur.pastFuture=function(e,t){var n=this._relativeTime[e>0?"future":"past"];return je(n)?n(t):n.replace(/%s/i,t)},Ur.set=function(e){var t,n;for(n in e)_e(e,n)&&(je(t=e[n])?this[n]=t:this["_"+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},Ur.eras=function(e,t){var n,r,i,a=this._eras||In("en")._eras;for(n=0,r=a.length;n<r;++n){if("string"==typeof a[n].since)i=ve(a[n].since).startOf("day"),a[n].since=i.valueOf();switch(typeof a[n].until){case"undefined":a[n].until=1/0;break;case"string":i=ve(a[n].until).startOf("day").valueOf(),a[n].until=i.valueOf()}}return a},Ur.erasParse=function(e,t,n){var r,i,a,s,o,c=this.eras();for(e=e.toUpperCase(),r=0,i=c.length;r<i;++r)if(a=c[r].name.toUpperCase(),s=c[r].abbr.toUpperCase(),o=c[r].narrow.toUpperCase(),n)switch(t){case"N":case"NN":case"NNN":if(s===e)return c[r];break;case"NNNN":if(a===e)return c[r];break;case"NNNNN":if(o===e)return c[r]}else if([a,s,o].indexOf(e)>=0)return c[r]},Ur.erasConvertYear=function(e,t){var n=e.since<=e.until?1:-1;return void 0===t?ve(e.since).year():ve(e.since).year()+(t-e.offset)*n},Ur.erasAbbrRegex=function(e){return _e(this,"_erasAbbrRegex")||Nr.call(this),e?this._erasAbbrRegex:this._erasRegex},Ur.erasNameRegex=function(e){return _e(this,"_erasNameRegex")||Nr.call(this),e?this._erasNameRegex:this._erasRegex},Ur.erasNarrowRegex=function(e){return _e(this,"_erasNarrowRegex")||Nr.call(this),e?this._erasNarrowRegex:this._erasRegex},Ur.months=function(e,t){return e?ye(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||Kt).test(t)?"format":"standalone"][e.month()]:ye(this._months)?this._months:this._months.standalone},Ur.monthsShort=function(e,t){return e?ye(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[Kt.test(t)?"format":"standalone"][e.month()]:ye(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},Ur.monthsParse=function(e,t,n){var r,i,a;if(this._monthsParseExact)return Zt.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;r<12;r++){if(i=Ee([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[r]||(a="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(a.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[r].test(e))return r;if(n&&"MMM"===t&&this._shortMonthsParse[r].test(e))return r;if(!n&&this._monthsParse[r].test(e))return r}},Ur.monthsRegex=function(e){return this._monthsParseExact?(_e(this,"_monthsRegex")||tn.call(this),e?this._monthsStrictRegex:this._monthsRegex):(_e(this,"_monthsRegex")||(this._monthsRegex=Xt),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},Ur.monthsShortRegex=function(e){return this._monthsParseExact?(_e(this,"_monthsRegex")||tn.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(_e(this,"_monthsShortRegex")||(this._monthsShortRegex=Qt),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},Ur.week=function(e){return on(e,this._week.dow,this._week.doy).week},Ur.firstDayOfYear=function(){return this._week.doy},Ur.firstDayOfWeek=function(){return this._week.dow},Ur.weekdays=function(e,t){var n=ye(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?ln(n,this._week.dow):e?n[e.day()]:n},Ur.weekdaysMin=function(e){return!0===e?ln(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},Ur.weekdaysShort=function(e){return!0===e?ln(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},Ur.weekdaysParse=function(e,t,n){var r,i,a;if(this._weekdaysParseExact)return gn.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(i=Ee([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[r]||(a="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(a.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[r].test(e))return r;if(n&&"ddd"===t&&this._shortWeekdaysParse[r].test(e))return r;if(n&&"dd"===t&&this._minWeekdaysParse[r].test(e))return r;if(!n&&this._weekdaysParse[r].test(e))return r}},Ur.weekdaysRegex=function(e){return this._weekdaysParseExact?(_e(this,"_weekdaysRegex")||vn.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(_e(this,"_weekdaysRegex")||(this._weekdaysRegex=fn),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},Ur.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(_e(this,"_weekdaysRegex")||vn.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(_e(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=pn),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},Ur.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(_e(this,"_weekdaysRegex")||vn.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(_e(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=mn),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},Ur.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},Ur.meridiem=function(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"},An("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===Ct(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),ve.lang=Re("moment.lang is deprecated. Use moment.locale instead.",An),ve.langData=Re("moment.langData is deprecated. Use moment.localeData instead.",In);var $r=Math.abs;function Kr(e,t,n,r){var i=hr(t,n);return e._milliseconds+=r*i._milliseconds,e._days+=r*i._days,e._months+=r*i._months,e._bubble()}function Qr(e){return e<0?Math.floor(e):Math.ceil(e)}function Xr(e){return 4800*e/146097}function Zr(e){return 146097*e/4800}function Jr(e){return function(){return this.as(e)}}var ei=Jr("ms"),ti=Jr("s"),ni=Jr("m"),ri=Jr("h"),ii=Jr("d"),ai=Jr("w"),si=Jr("M"),oi=Jr("Q"),ci=Jr("y"),li=ei;function ui(e){return function(){return this.isValid()?this._data[e]:NaN}}var hi=ui("milliseconds"),di=ui("seconds"),fi=ui("minutes"),pi=ui("hours"),mi=ui("days"),gi=ui("months"),vi=ui("years");var yi=Math.round,bi={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function _i(e,t,n,r,i){return i.relativeTime(t||1,!!n,e,r)}var wi=Math.abs;function xi(e){return(e>0)-(e<0)||+e}function ki(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n,r,i,a,s,o,c=wi(this._milliseconds)/1e3,l=wi(this._days),u=wi(this._months),h=this.asSeconds();return h?(e=St(c/60),t=St(e/60),c%=60,e%=60,n=St(u/12),u%=12,r=c?c.toFixed(3).replace(/\.?0+$/,""):"",i=h<0?"-":"",a=xi(this._months)!==xi(h)?"-":"",s=xi(this._days)!==xi(h)?"-":"",o=xi(this._milliseconds)!==xi(h)?"-":"",i+"P"+(n?a+n+"Y":"")+(u?a+u+"M":"")+(l?s+l+"D":"")+(t||e||c?"T":"")+(t?o+t+"H":"")+(e?o+e+"M":"")+(c?o+r+"S":"")):"P0D"}var Si=er.prototype;Si.isValid=function(){return this._isValid},Si.abs=function(){var e=this._data;return this._milliseconds=$r(this._milliseconds),this._days=$r(this._days),this._months=$r(this._months),e.milliseconds=$r(e.milliseconds),e.seconds=$r(e.seconds),e.minutes=$r(e.minutes),e.hours=$r(e.hours),e.months=$r(e.months),e.years=$r(e.years),this},Si.add=function(e,t){return Kr(this,e,t,1)},Si.subtract=function(e,t){return Kr(this,e,t,-1)},Si.as=function(e){if(!this.isValid())return NaN;var t,n,r=this._milliseconds;if("month"===(e=Je(e))||"quarter"===e||"year"===e)switch(t=this._days+r/864e5,n=this._months+Xr(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Zr(this._months)),e){case"week":return t/7+r/6048e5;case"day":return t+r/864e5;case"hour":return 24*t+r/36e5;case"minute":return 1440*t+r/6e4;case"second":return 86400*t+r/1e3;case"millisecond":return Math.floor(864e5*t)+r;default:throw new Error("Unknown unit "+e)}},Si.asMilliseconds=ei,Si.asSeconds=ti,Si.asMinutes=ni,Si.asHours=ri,Si.asDays=ii,Si.asWeeks=ai,Si.asMonths=si,Si.asQuarters=oi,Si.asYears=ci,Si.valueOf=li,Si._bubble=function(){var e,t,n,r,i,a=this._milliseconds,s=this._days,o=this._months,c=this._data;return a>=0&&s>=0&&o>=0||a<=0&&s<=0&&o<=0||(a+=864e5*Qr(Zr(o)+s),s=0,o=0),c.milliseconds=a%1e3,e=St(a/1e3),c.seconds=e%60,t=St(e/60),c.minutes=t%60,n=St(t/60),c.hours=n%24,s+=St(n/24),o+=i=St(Xr(s)),s-=Qr(Zr(i)),r=St(o/12),o%=12,c.days=s,c.months=o,c.years=r,this},Si.clone=function(){return hr(this)},Si.get=function(e){return e=Je(e),this.isValid()?this[e+"s"]():NaN},Si.milliseconds=hi,Si.seconds=di,Si.minutes=fi,Si.hours=pi,Si.days=mi,Si.weeks=function(){return St(this.days()/7)},Si.months=gi,Si.years=vi,Si.humanize=function(e,t){if(!this.isValid())return this.localeData().invalidDate();var n,r,i=!1,a=bi;return"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(i=e),"object"==typeof t&&(a=Object.assign({},bi,t),null!=t.s&&null==t.ss&&(a.ss=t.s-1)),r=function(e,t,n,r){var i=hr(e).abs(),a=yi(i.as("s")),s=yi(i.as("m")),o=yi(i.as("h")),c=yi(i.as("d")),l=yi(i.as("M")),u=yi(i.as("w")),h=yi(i.as("y")),d=a<=n.ss&&["s",a]||a<n.s&&["ss",a]||s<=1&&["m"]||s<n.m&&["mm",s]||o<=1&&["h"]||o<n.h&&["hh",o]||c<=1&&["d"]||c<n.d&&["dd",c];return null!=n.w&&(d=d||u<=1&&["w"]||u<n.w&&["ww",u]),(d=d||l<=1&&["M"]||l<n.M&&["MM",l]||h<=1&&["y"]||["yy",h])[2]=t,d[3]=+e>0,d[4]=r,_i.apply(null,d)}(this,!i,a,n=this.localeData()),i&&(r=n.pastFuture(+this,r)),n.postformat(r)},Si.toISOString=ki,Si.toString=ki,Si.toJSON=ki,Si.locale=wr,Si.localeData=kr,Si.toIsoString=Re("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",ki),Si.lang=xr,Ke("X",0,0,"unix"),Ke("x",0,0,"valueOf"),wt("x",mt),wt("X",/[+-]?\d+(\.\d{1,3})?/),Et("X",(function(e,t,n){n._d=new Date(1e3*parseFloat(e))})),Et("x",(function(e,t,n){n._d=new Date(Ct(e))})),ve.version="2.30.1",me=Kn,ve.fn=qr,ve.min=function(){return Zn("isBefore",[].slice.call(arguments,0))},ve.max=function(){return Zn("isAfter",[].slice.call(arguments,0))},ve.now=function(){return Date.now?Date.now():+/* @__PURE__ */new Date},ve.utc=Ee,ve.unix=function(e){return Kn(1e3*e)},ve.months=function(e,t){return Wr(e,t,"months")},ve.isDate=Se,ve.locale=An,ve.invalid=Pe,ve.duration=hr,ve.isMoment=Le,ve.weekdays=function(e,t,n){return Yr(e,t,n,"weekdays")},ve.parseZone=function(){return Kn.apply(null,arguments).parseZone()},ve.localeData=In,ve.isDuration=tr,ve.monthsShort=function(e,t){return Wr(e,t,"monthsShort")},ve.weekdaysMin=function(e,t,n){return Yr(e,t,n,"weekdaysMin")},ve.defineLocale=Pn,ve.updateLocale=function(e,t){if(null!=t){var n,r,i=kn;null!=Sn[e]&&null!=Sn[e].parentLocale?Sn[e].set(qe(Sn[e]._config,t)):(null!=(r=Tn(e))&&(i=r._config),t=qe(i,t),null==r&&(t.abbr=e),(n=new He(t)).parentLocale=Sn[e],Sn[e]=n),An(e)}else null!=Sn[e]&&(null!=Sn[e].parentLocale?(Sn[e]=Sn[e].parentLocale,e===An()&&An(e)):null!=Sn[e]&&delete Sn[e]);return Sn[e]},ve.locales=function(){return Ve(Sn)},ve.weekdaysShort=function(e,t,n){return Yr(e,t,n,"weekdaysShort")},ve.normalizeUnits=Je,ve.relativeTimeRounding=function(e){return void 0===e?yi:"function"==typeof e&&(yi=e,!0)},ve.relativeTimeThreshold=function(e,t){return void 0!==bi[e]&&(void 0===t?bi[e]:(bi[e]=t,"s"===e&&(bi.ss=t-1),!0))},ve.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},ve.prototype=qr,ve.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};var Ci="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Mi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ei(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){var n=!1;try{n=this instanceof e}catch{}return n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var Ti,Ai,Pi,Ii={exports:{}};const Ni=/* @__PURE__ */Mi((Ti||(Ti=1,Ai=Ii,Pi=Ii.exports,function(){var e,t="Expected a function",n="__lodash_hash_undefined__",r="__lodash_placeholder__",i=32,a=128,s=1/0,o=9007199254740991,c=NaN,l=4294967295,u=[["ary",a],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",i],["partialRight",64],["rearg",256]],h="[object Arguments]",d="[object Array]",f="[object Boolean]",p="[object Date]",m="[object Error]",g="[object Function]",v="[object GeneratorFunction]",y="[object Map]",b="[object Number]",_="[object Object]",w="[object Promise]",x="[object RegExp]",k="[object Set]",S="[object String]",C="[object Symbol]",M="[object WeakMap]",E="[object ArrayBuffer]",T="[object DataView]",A="[object Float32Array]",P="[object Float64Array]",I="[object Int8Array]",N="[object Int16Array]",D="[object Int32Array]",O="[object Uint8Array]",L="[object Uint8ClampedArray]",B="[object Uint16Array]",R="[object Uint32Array]",V=/\b__p \+= '';/g,F=/\b(__p \+=) '' \+/g,z=/(__e\(.*?\)|\b__t\)) \+\n'';/g,j=/&(?:amp|lt|gt|quot|#39);/g,q=/[&<>"']/g,H=RegExp(j.source),U=RegExp(q.source),G=/<%-([\s\S]+?)%>/g,W=/<%([\s\S]+?)%>/g,Y=/<%=([\s\S]+?)%>/g,$=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,K=/^\w*$/,Q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,X=/[\\^$.*+?()[\]{}|]/g,Z=RegExp(X.source),J=/^\s+/,ee=/\s/,te=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ne=/\{\n\/\* \[wrapped with (.+)\] \*/,re=/,? & /,ie=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ae=/[()=,{}\[\]\/\s]/,se=/\\(\\)?/g,oe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ce=/\w*$/,le=/^[-+]0x[0-9a-f]+$/i,ue=/^0b[01]+$/i,he=/^\[object .+?Constructor\]$/,de=/^0o[0-7]+$/i,fe=/^(?:0|[1-9]\d*)$/,pe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,me=/($^)/,ge=/['\n\r\u2028\u2029\\]/g,ve="\\ud800-\\udfff",ye="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",be="\\u2700-\\u27bf",_e="a-z\\xdf-\\xf6\\xf8-\\xff",we="A-Z\\xc0-\\xd6\\xd8-\\xde",xe="\\ufe0e\\ufe0f",ke="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Se="["+ve+"]",Ce="["+ke+"]",Me="["+ye+"]",Ee="\\d+",Te="["+be+"]",Ae="["+_e+"]",Pe="[^"+ve+ke+Ee+be+_e+we+"]",Ie="\\ud83c[\\udffb-\\udfff]",Ne="[^"+ve+"]",De="(?:\\ud83c[\\udde6-\\uddff]){2}",Oe="[\\ud800-\\udbff][\\udc00-\\udfff]",Le="["+we+"]",Be="\\u200d",Re="(?:"+Ae+"|"+Pe+")",Ve="(?:"+Le+"|"+Pe+")",Fe="(?:['’](?:d|ll|m|re|s|t|ve))?",ze="(?:['’](?:D|LL|M|RE|S|T|VE))?",je="(?:"+Me+"|"+Ie+")?",qe="["+xe+"]?",He=qe+je+"(?:"+Be+"(?:"+[Ne,De,Oe].join("|")+")"+qe+je+")*",Ue="(?:"+[Te,De,Oe].join("|")+")"+He,Ge="(?:"+[Ne+Me+"?",Me,De,Oe,Se].join("|")+")",We=RegExp("['’]","g"),Ye=RegExp(Me,"g"),$e=RegExp(Ie+"(?="+Ie+")|"+Ge+He,"g"),Ke=RegExp([Le+"?"+Ae+"+"+Fe+"(?="+[Ce,Le,"$"].join("|")+")",Ve+"+"+ze+"(?="+[Ce,Le+Re,"$"].join("|")+")",Le+"?"+Re+"+"+Fe,Le+"+"+ze,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ee,Ue].join("|"),"g"),Qe=RegExp("["+Be+ve+ye+xe+"]"),Xe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ze=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Je=-1,et={};et[A]=et[P]=et[I]=et[N]=et[D]=et[O]=et[L]=et[B]=et[R]=!0,et[h]=et[d]=et[E]=et[f]=et[T]=et[p]=et[m]=et[g]=et[y]=et[b]=et[_]=et[x]=et[k]=et[S]=et[M]=!1;var tt={};tt[h]=tt[d]=tt[E]=tt[T]=tt[f]=tt[p]=tt[A]=tt[P]=tt[I]=tt[N]=tt[D]=tt[y]=tt[b]=tt[_]=tt[x]=tt[k]=tt[S]=tt[C]=tt[O]=tt[L]=tt[B]=tt[R]=!0,tt[m]=tt[g]=tt[M]=!1;var nt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},rt=parseFloat,it=parseInt,at="object"==typeof Ci&&Ci&&Ci.Object===Object&&Ci,st="object"==typeof self&&self&&self.Object===Object&&self,ot=at||st||Function("return this")(),ct=Pi&&!Pi.nodeType&&Pi,lt=ct&&Ai&&!Ai.nodeType&&Ai,ut=lt&&lt.exports===ct,ht=ut&&at.process,dt=function(){try{return lt&&lt.require&&lt.require("util").types||ht&&ht.binding&&ht.binding("util")}catch(e){}}(),ft=dt&&dt.isArrayBuffer,pt=dt&&dt.isDate,mt=dt&&dt.isMap,gt=dt&&dt.isRegExp,vt=dt&&dt.isSet,yt=dt&&dt.isTypedArray;function bt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function _t(e,t,n,r){for(var i=-1,a=null==e?0:e.length;++i<a;){var s=e[i];t(r,s,n(s),e)}return r}function wt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function xt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function kt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function St(e,t){for(var n=-1,r=null==e?0:e.length,i=0,a=[];++n<r;){var s=e[n];t(s,n,e)&&(a[i++]=s)}return a}function Ct(e,t){return!(null==e||!e.length)&&Lt(e,t,0)>-1}function Mt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function Et(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function Tt(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function At(e,t,n,r){var i=-1,a=null==e?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function Pt(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function It(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Nt=Ft("length");function Dt(e,t,n){var r;return n(e,(function(e,n,i){if(t(e,n,i))return r=n,!1})),r}function Ot(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function Lt(e,t,n){return t==t?function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):Ot(e,Rt,n)}function Bt(e,t,n,r){for(var i=n-1,a=e.length;++i<a;)if(r(e[i],t))return i;return-1}function Rt(e){return e!=e}function Vt(e,t){var n=null==e?0:e.length;return n?qt(e,t)/n:c}function Ft(t){return function(n){return null==n?e:n[t]}}function zt(t){return function(n){return null==t?e:t[n]}}function jt(e,t,n,r,i){return i(e,(function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)})),n}function qt(t,n){for(var r,i=-1,a=t.length;++i<a;){var s=n(t[i]);s!==e&&(r=r===e?s:r+s)}return r}function Ht(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Ut(e){return e?e.slice(0,on(e)+1).replace(J,""):e}function Gt(e){return function(t){return e(t)}}function Wt(e,t){return Et(t,(function(t){return e[t]}))}function Yt(e,t){return e.has(t)}function $t(e,t){for(var n=-1,r=e.length;++n<r&&Lt(t,e[n],0)>-1;);return n}function Kt(e,t){for(var n=e.length;n--&&Lt(t,e[n],0)>-1;);return n}var Qt=zt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Xt=zt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Zt(e){return"\\"+nt[e]}function Jt(e){return Qe.test(e)}function en(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function tn(e,t){return function(n){return e(t(n))}}function nn(e,t){for(var n=-1,i=e.length,a=0,s=[];++n<i;){var o=e[n];o!==t&&o!==r||(e[n]=r,s[a++]=n)}return s}function rn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function an(e){return Jt(e)?function(e){for(var t=$e.lastIndex=0;$e.test(e);)++t;return t}(e):Nt(e)}function sn(e){return Jt(e)?e.match($e)||[]:function(e){return e.split("")}(e)}function on(e){for(var t=e.length;t--&&ee.test(e.charAt(t)););return t}var cn=zt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),ln=function ee(ve){var ye,be=(ve=null==ve?ot:ln.defaults(ot.Object(),ve,ln.pick(ot,Ze))).Array,_e=ve.Date,we=ve.Error,xe=ve.Function,ke=ve.Math,Se=ve.Object,Ce=ve.RegExp,Me=ve.String,Ee=ve.TypeError,Te=be.prototype,Ae=xe.prototype,Pe=Se.prototype,Ie=ve["__core-js_shared__"],Ne=Ae.toString,De=Pe.hasOwnProperty,Oe=0,Le=(ye=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+ye:"",Be=Pe.toString,Re=Ne.call(Se),Ve=ot._,Fe=Ce("^"+Ne.call(De).replace(X,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ze=ut?ve.Buffer:e,je=ve.Symbol,qe=ve.Uint8Array,He=ze?ze.allocUnsafe:e,Ue=tn(Se.getPrototypeOf,Se),Ge=Se.create,$e=Pe.propertyIsEnumerable,Qe=Te.splice,nt=je?je.isConcatSpreadable:e,at=je?je.iterator:e,st=je?je.toStringTag:e,ct=function(){try{var e=oa(Se,"defineProperty");return e({},"",{}),e}catch(t){}}(),lt=ve.clearTimeout!==ot.clearTimeout&&ve.clearTimeout,ht=_e&&_e.now!==ot.Date.now&&_e.now,dt=ve.setTimeout!==ot.setTimeout&&ve.setTimeout,Nt=ke.ceil,zt=ke.floor,un=Se.getOwnPropertySymbols,hn=ze?ze.isBuffer:e,dn=ve.isFinite,fn=Te.join,pn=tn(Se.keys,Se),mn=ke.max,gn=ke.min,vn=_e.now,yn=ve.parseInt,bn=ke.random,_n=Te.reverse,wn=oa(ve,"DataView"),xn=oa(ve,"Map"),kn=oa(ve,"Promise"),Sn=oa(ve,"Set"),Cn=oa(ve,"WeakMap"),Mn=oa(Se,"create"),En=Cn&&new Cn,Tn={},An=La(wn),Pn=La(xn),In=La(kn),Nn=La(Sn),Dn=La(Cn),On=je?je.prototype:e,Ln=On?On.valueOf:e,Bn=On?On.toString:e;function Rn(e){if(Zs(e)&&!js(e)&&!(e instanceof jn)){if(e instanceof zn)return e;if(De.call(e,"__wrapped__"))return Ba(e)}return new zn(e)}var Vn=/* @__PURE__ */function(){function t(){}return function(n){if(!Xs(n))return{};if(Ge)return Ge(n);t.prototype=n;var r=new t;return t.prototype=e,r}}();function Fn(){}function zn(t,n){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!n,this.__index__=0,this.__values__=e}function jn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=l,this.__views__=[]}function qn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Hn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Un(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Gn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Un;++t<n;)this.add(e[t])}function Wn(e){var t=this.__data__=new Hn(e);this.size=t.size}function Yn(e,t){var n=js(e),r=!n&&zs(e),i=!n&&!r&&Gs(e),a=!n&&!r&&!i&&so(e),s=n||r||i||a,o=s?Ht(e.length,Me):[],c=o.length;for(var l in e)!t&&!De.call(e,l)||s&&("length"==l||i&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||pa(l,c))||o.push(l);return o}function $n(t){var n=t.length;return n?t[Ur(0,n-1)]:e}function Kn(e,t){return Pa(Ci(e),ir(t,0,e.length))}function Qn(e){return Pa(Ci(e))}function Xn(t,n,r){(r!==e&&!Rs(t[n],r)||r===e&&!(n in t))&&nr(t,n,r)}function Zn(t,n,r){var i=t[n];De.call(t,n)&&Rs(i,r)&&(r!==e||n in t)||nr(t,n,r)}function Jn(e,t){for(var n=e.length;n--;)if(Rs(e[n][0],t))return n;return-1}function er(e,t,n,r){return lr(e,(function(e,i,a){t(r,e,n(e),a)})),r}function tr(e,t){return e&&Mi(t,Ao(t),e)}function nr(e,t,n){"__proto__"==t&&ct?ct(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function rr(t,n){for(var r=-1,i=n.length,a=be(i),s=null==t;++r<i;)a[r]=s?e:So(t,n[r]);return a}function ir(t,n,r){return t==t&&(r!==e&&(t=t<=r?t:r),n!==e&&(t=t>=n?t:n)),t}function ar(t,n,r,i,a,s){var o,c=1&n,l=2&n,u=4&n;if(r&&(o=a?r(t,i,a,s):r(t)),o!==e)return o;if(!Xs(t))return t;var d,m,w,M=js(t);if(M){if(m=(d=t).length,w=new d.constructor(m),m&&"string"==typeof d[0]&&De.call(d,"index")&&(w.index=d.index,w.input=d.input),o=w,!c)return Ci(t,o)}else{var V=ua(t),F=V==g||V==v;if(Gs(t))return bi(t,c);if(V==_||V==h||F&&!a){if(o=l||F?{}:da(t),!c)return l?function(e,t){return Mi(e,la(e),t)}(t,function(e,t){return e&&Mi(t,Po(t),e)}(o,t)):function(e,t){return Mi(e,ca(e),t)}(t,tr(o,t))}else{if(!tt[V])return a?t:{};o=function(e,t,n){var r,i,a,s=e.constructor;switch(t){case E:return _i(e);case f:case p:return new s(+e);case T:return i=e,a=n?_i(i.buffer):i.buffer,new i.constructor(a,i.byteOffset,i.byteLength);case A:case P:case I:case N:case D:case O:case L:case B:case R:return wi(e,n);case y:return new s;case b:case S:return new s(e);case x:return function(e){var t=new e.constructor(e.source,ce.exec(e));return t.lastIndex=e.lastIndex,t}(e);case k:return new s;case C:return r=e,Ln?Se(Ln.call(r)):{}}}(t,V,c)}}s||(s=new Wn);var z=s.get(t);if(z)return z;s.set(t,o),ro(t)?t.forEach((function(e){o.add(ar(e,n,r,e,t,s))})):Js(t)&&t.forEach((function(e,i){o.set(i,ar(e,n,r,i,t,s))}));var j=M?e:(u?l?ea:Ji:l?Po:Ao)(t);return wt(j||t,(function(e,i){j&&(e=t[i=e]),Zn(o,i,ar(e,n,r,i,t,s))})),o}function sr(t,n,r){var i=r.length;if(null==t)return!i;for(t=Se(t);i--;){var a=r[i],s=n[a],o=t[a];if(o===e&&!(a in t)||!s(o))return!1}return!0}function or(n,r,i){if("function"!=typeof n)throw new Ee(t);return Ma((function(){n.apply(e,i)}),r)}function cr(e,t,n,r){var i=-1,a=Ct,s=!0,o=e.length,c=[],l=t.length;if(!o)return c;n&&(t=Et(t,Gt(n))),r?(a=Mt,s=!1):t.length>=200&&(a=Yt,s=!1,t=new Gn(t));e:for(;++i<o;){var u=e[i],h=null==n?u:n(u);if(u=r||0!==u?u:0,s&&h==h){for(var d=l;d--;)if(t[d]===h)continue e;c.push(u)}else a(t,h,r)||c.push(u)}return c}Rn.templateSettings={escape:G,evaluate:W,interpolate:Y,variable:"",imports:{_:Rn}},Rn.prototype=Fn.prototype,Rn.prototype.constructor=Rn,zn.prototype=Vn(Fn.prototype),zn.prototype.constructor=zn,jn.prototype=Vn(Fn.prototype),jn.prototype.constructor=jn,qn.prototype.clear=function(){this.__data__=Mn?Mn(null):{},this.size=0},qn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},qn.prototype.get=function(t){var r=this.__data__;if(Mn){var i=r[t];return i===n?e:i}return De.call(r,t)?r[t]:e},qn.prototype.has=function(t){var n=this.__data__;return Mn?n[t]!==e:De.call(n,t)},qn.prototype.set=function(t,r){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=Mn&&r===e?n:r,this},Hn.prototype.clear=function(){this.__data__=[],this.size=0},Hn.prototype.delete=function(e){var t=this.__data__,n=Jn(t,e);return!(n<0||(n==t.length-1?t.pop():Qe.call(t,n,1),--this.size,0))},Hn.prototype.get=function(t){var n=this.__data__,r=Jn(n,t);return r<0?e:n[r][1]},Hn.prototype.has=function(e){return Jn(this.__data__,e)>-1},Hn.prototype.set=function(e,t){var n=this.__data__,r=Jn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Un.prototype.clear=function(){this.size=0,this.__data__={hash:new qn,map:new(xn||Hn),string:new qn}},Un.prototype.delete=function(e){var t=aa(this,e).delete(e);return this.size-=t?1:0,t},Un.prototype.get=function(e){return aa(this,e).get(e)},Un.prototype.has=function(e){return aa(this,e).has(e)},Un.prototype.set=function(e,t){var n=aa(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,n),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Wn.prototype.clear=function(){this.__data__=new Hn,this.size=0},Wn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Wn.prototype.get=function(e){return this.__data__.get(e)},Wn.prototype.has=function(e){return this.__data__.has(e)},Wn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Hn){var r=n.__data__;if(!xn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Un(r)}return n.set(e,t),this.size=n.size,this};var lr=Ai(vr),ur=Ai(yr,!0);function hr(e,t){var n=!0;return lr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function dr(t,n,r){for(var i=-1,a=t.length;++i<a;){var s=t[i],o=n(s);if(null!=o&&(c===e?o==o&&!ao(o):r(o,c)))var c=o,l=s}return l}function fr(e,t){var n=[];return lr(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n}function pr(e,t,n,r,i){var a=-1,s=e.length;for(n||(n=fa),i||(i=[]);++a<s;){var o=e[a];t>0&&n(o)?t>1?pr(o,t-1,n,r,i):Tt(i,o):r||(i[i.length]=o)}return i}var mr=Pi(),gr=Pi(!0);function vr(e,t){return e&&mr(e,t,Ao)}function yr(e,t){return e&&gr(e,t,Ao)}function br(e,t){return St(t,(function(t){return $s(e[t])}))}function _r(t,n){for(var r=0,i=(n=mi(n,t)).length;null!=t&&r<i;)t=t[Oa(n[r++])];return r&&r==i?t:e}function wr(e,t,n){var r=t(e);return js(e)?r:Tt(r,n(e))}function xr(t){return null==t?t===e?"[object Undefined]":"[object Null]":st&&st in Se(t)?function(t){var n=De.call(t,st),r=t[st];try{t[st]=e;var i=!0}catch(s){}var a=Be.call(t);return i&&(n?t[st]=r:delete t[st]),a}(t):(n=t,Be.call(n));var n}function kr(e,t){return e>t}function Sr(e,t){return null!=e&&De.call(e,t)}function Cr(e,t){return null!=e&&t in Se(e)}function Mr(t,n,r){for(var i=r?Mt:Ct,a=t[0].length,s=t.length,o=s,c=be(s),l=1/0,u=[];o--;){var h=t[o];o&&n&&(h=Et(h,Gt(n))),l=gn(h.length,l),c[o]=!r&&(n||a>=120&&h.length>=120)?new Gn(o&&h):e}h=t[0];var d=-1,f=c[0];e:for(;++d<a&&u.length<l;){var p=h[d],m=n?n(p):p;if(p=r||0!==p?p:0,!(f?Yt(f,m):i(u,m,r))){for(o=s;--o;){var g=c[o];if(!(g?Yt(g,m):i(t[o],m,r)))continue e}f&&f.push(m),u.push(p)}}return u}function Er(t,n,r){var i=null==(t=ka(t,n=mi(n,t)))?t:t[Oa(Ya(n))];return null==i?e:bt(i,t,r)}function Tr(e){return Zs(e)&&xr(e)==h}function Ar(t,n,r,i,a){return t===n||(null==t||null==n||!Zs(t)&&!Zs(n)?t!=t&&n!=n:function(t,n,r,i,a,s){var o=js(t),c=js(n),l=o?d:ua(t),u=c?d:ua(n),g=(l=l==h?_:l)==_,v=(u=u==h?_:u)==_,w=l==u;if(w&&Gs(t)){if(!Gs(n))return!1;o=!0,g=!1}if(w&&!g)return s||(s=new Wn),o||so(t)?Xi(t,n,r,i,a,s):function(e,t,n,r,i,a,s){switch(n){case T:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case E:return!(e.byteLength!=t.byteLength||!a(new qe(e),new qe(t)));case f:case p:case b:return Rs(+e,+t);case m:return e.name==t.name&&e.message==t.message;case x:case S:return e==t+"";case y:var o=en;case k:var c=1&r;if(o||(o=rn),e.size!=t.size&&!c)return!1;var l=s.get(e);if(l)return l==t;r|=2,s.set(e,t);var u=Xi(o(e),o(t),r,i,a,s);return s.delete(e),u;case C:if(Ln)return Ln.call(e)==Ln.call(t)}return!1}(t,n,l,r,i,a,s);if(!(1&r)){var M=g&&De.call(t,"__wrapped__"),A=v&&De.call(n,"__wrapped__");if(M||A){var P=M?t.value():t,I=A?n.value():n;return s||(s=new Wn),a(P,I,r,i,s)}}return!!w&&(s||(s=new Wn),function(t,n,r,i,a,s){var o=1&r,c=Ji(t),l=c.length;if(l!=Ji(n).length&&!o)return!1;for(var u=l;u--;){var h=c[u];if(!(o?h in n:De.call(n,h)))return!1}var d=s.get(t),f=s.get(n);if(d&&f)return d==n&&f==t;var p=!0;s.set(t,n),s.set(n,t);for(var m=o;++u<l;){var g=t[h=c[u]],v=n[h];if(i)var y=o?i(v,g,h,n,t,s):i(g,v,h,t,n,s);if(!(y===e?g===v||a(g,v,r,i,s):y)){p=!1;break}m||(m="constructor"==h)}if(p&&!m){var b=t.constructor,_=n.constructor;b==_||!("constructor"in t)||!("constructor"in n)||"function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _||(p=!1)}return s.delete(t),s.delete(n),p}(t,n,r,i,a,s))}(t,n,r,i,Ar,a))}function Pr(t,n,r,i){var a=r.length,s=a,o=!i;if(null==t)return!s;for(t=Se(t);a--;){var c=r[a];if(o&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++a<s;){var l=(c=r[a])[0],u=t[l],h=c[1];if(o&&c[2]){if(u===e&&!(l in t))return!1}else{var d=new Wn;if(i)var f=i(u,h,l,t,n,d);if(!(f===e?Ar(h,u,3,i,d):f))return!1}}return!0}function Ir(e){return!(!Xs(e)||(t=e,Le&&Le in t))&&($s(e)?Fe:he).test(La(e));var t}function Nr(e){return"function"==typeof e?e:null==e?tc:"object"==typeof e?js(e)?Rr(e[0],e[1]):Br(e):uc(e)}function Dr(e){if(!ba(e))return pn(e);var t=[];for(var n in Se(e))De.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Or(e,t){return e<t}function Lr(e,t){var n=-1,r=Hs(e)?be(e.length):[];return lr(e,(function(e,i,a){r[++n]=t(e,i,a)})),r}function Br(e){var t=sa(e);return 1==t.length&&t[0][2]?wa(t[0][0],t[0][1]):function(n){return n===e||Pr(n,e,t)}}function Rr(t,n){return ga(t)&&_a(n)?wa(Oa(t),n):function(r){var i=So(r,t);return i===e&&i===n?Co(r,t):Ar(n,i,3)}}function Vr(t,n,r,i,a){t!==n&&mr(n,(function(s,o){if(a||(a=new Wn),Xs(s))!function(t,n,r,i,a,s,o){var c=Sa(t,r),l=Sa(n,r),u=o.get(l);if(u)Xn(t,r,u);else{var h=s?s(c,l,r+"",t,n,o):e,d=h===e;if(d){var f=js(l),p=!f&&Gs(l),m=!f&&!p&&so(l);h=l,f||p||m?js(c)?h=c:Us(c)?h=Ci(c):p?(d=!1,h=bi(l,!0)):m?(d=!1,h=wi(l,!0)):h=[]:to(l)||zs(l)?(h=c,zs(c)?h=mo(c):Xs(c)&&!$s(c)||(h=da(l))):d=!1}d&&(o.set(l,h),a(h,l,i,s,o),o.delete(l)),Xn(t,r,h)}}(t,n,o,r,Vr,i,a);else{var c=i?i(Sa(t,o),s,o+"",t,n,a):e;c===e&&(c=s),Xn(t,o,c)}}),Po)}function Fr(t,n){var r=t.length;if(r)return pa(n+=n<0?r:0,r)?t[n]:e}function zr(e,t,n){t=t.length?Et(t,(function(e){return js(e)?function(t){return _r(t,1===e.length?e[0]:e)}:e})):[tc];var r=-1;return t=Et(t,Gt(ia())),function(e){var t=e.length;for(e.sort((function(e,t){return function(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,s=i.length,o=n.length;++r<s;){var c=xi(i[r],a[r]);if(c)return r>=o?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));t--;)e[t]=e[t].value;return e}(Lr(e,(function(e,n,i){return{criteria:Et(t,(function(t){return t(e)})),index:++r,value:e}})))}function jr(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var s=t[r],o=_r(e,s);n(o,s)&&Kr(a,mi(s,e),o)}return a}function qr(e,t,n,r){var i=r?Bt:Lt,a=-1,s=t.length,o=e;for(e===t&&(t=Ci(t)),n&&(o=Et(e,Gt(n)));++a<s;)for(var c=0,l=t[a],u=n?n(l):l;(c=i(o,u,c,r))>-1;)o!==e&&Qe.call(o,c,1),Qe.call(e,c,1);return e}function Hr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;pa(i)?Qe.call(e,i,1):oi(e,i)}}return e}function Ur(e,t){return e+zt(bn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>o)return n;do{t%2&&(n+=e),(t=zt(t/2))&&(e+=e)}while(t);return n}function Wr(e,t){return Ea(xa(e,t,tc),e+"")}function Yr(e){return $n(Vo(e))}function $r(e,t){var n=Vo(e);return Pa(n,ir(t,0,n.length))}function Kr(t,n,r,i){if(!Xs(t))return t;for(var a=-1,s=(n=mi(n,t)).length,o=s-1,c=t;null!=c&&++a<s;){var l=Oa(n[a]),u=r;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(a!=o){var h=c[l];(u=i?i(h,l,c):e)===e&&(u=Xs(h)?h:pa(n[a+1])?[]:{})}Zn(c,l,u),c=c[l]}return t}var Qr=En?function(e,t){return En.set(e,t),e}:tc,Xr=ct?function(e,t){return ct(e,"toString",{configurable:!0,enumerable:!1,value:Zo(t),writable:!0})}:tc;function Zr(e){return Pa(Vo(e))}function Jr(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=be(i);++r<i;)a[r]=e[r+t];return a}function ei(e,t){var n;return lr(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n}function ti(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var a=r+i>>>1,s=e[a];null!==s&&!ao(s)&&(n?s<=t:s<t)?r=a+1:i=a}return i}return ni(e,t,tc,n)}function ni(t,n,r,i){var a=0,s=null==t?0:t.length;if(0===s)return 0;for(var o=(n=r(n))!=n,c=null===n,l=ao(n),u=n===e;a<s;){var h=zt((a+s)/2),d=r(t[h]),f=d!==e,p=null===d,m=d==d,g=ao(d);if(o)var v=i||m;else v=u?m&&(i||f):c?m&&f&&(i||!p):l?m&&f&&!p&&(i||!g):!p&&!g&&(i?d<=n:d<n);v?a=h+1:s=h}return gn(s,4294967294)}function ri(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var s=e[n],o=t?t(s):s;if(!n||!Rs(o,c)){var c=o;a[i++]=0===s?0:s}}return a}function ii(e){return"number"==typeof e?e:ao(e)?c:+e}function ai(e){if("string"==typeof e)return e;if(js(e))return Et(e,ai)+"";if(ao(e))return Bn?Bn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function si(e,t,n){var r=-1,i=Ct,a=e.length,s=!0,o=[],c=o;if(n)s=!1,i=Mt;else if(a>=200){var l=t?null:Gi(e);if(l)return rn(l);s=!1,i=Yt,c=new Gn}else c=t?[]:o;e:for(;++r<a;){var u=e[r],h=t?t(u):u;if(u=n||0!==u?u:0,s&&h==h){for(var d=c.length;d--;)if(c[d]===h)continue e;t&&c.push(h),o.push(u)}else i(c,h,n)||(c!==o&&c.push(h),o.push(u))}return o}function oi(e,t){return null==(e=ka(e,t=mi(t,e)))||delete e[Oa(Ya(t))]}function ci(e,t,n,r){return Kr(e,t,n(_r(e,t)),r)}function li(e,t,n,r){for(var i=e.length,a=r?i:-1;(r?a--:++a<i)&&t(e[a],a,e););return n?Jr(e,r?0:a,r?a+1:i):Jr(e,r?a+1:0,r?i:a)}function ui(e,t){var n=e;return n instanceof jn&&(n=n.value()),At(t,(function(e,t){return t.func.apply(t.thisArg,Tt([e],t.args))}),n)}function hi(e,t,n){var r=e.length;if(r<2)return r?si(e[0]):[];for(var i=-1,a=be(r);++i<r;)for(var s=e[i],o=-1;++o<r;)o!=i&&(a[i]=cr(a[i]||s,e[o],t,n));return si(pr(a,1),t,n)}function di(t,n,r){for(var i=-1,a=t.length,s=n.length,o={};++i<a;){var c=i<s?n[i]:e;r(o,t[i],c)}return o}function fi(e){return Us(e)?e:[]}function pi(e){return"function"==typeof e?e:tc}function mi(e,t){return js(e)?e:ga(e,t)?[e]:Da(go(e))}var gi=Wr;function vi(t,n,r){var i=t.length;return r=r===e?i:r,!n&&r>=i?t:Jr(t,n,r)}var yi=lt||function(e){return ot.clearTimeout(e)};function bi(e,t){if(t)return e.slice();var n=e.length,r=He?He(n):new e.constructor(n);return e.copy(r),r}function _i(e){var t=new e.constructor(e.byteLength);return new qe(t).set(new qe(e)),t}function wi(e,t){var n=t?_i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function xi(t,n){if(t!==n){var r=t!==e,i=null===t,a=t==t,s=ao(t),o=n!==e,c=null===n,l=n==n,u=ao(n);if(!c&&!u&&!s&&t>n||s&&o&&l&&!c&&!u||i&&o&&l||!r&&l||!a)return 1;if(!i&&!s&&!u&&t<n||u&&r&&a&&!i&&!s||c&&r&&a||!o&&a||!l)return-1}return 0}function ki(e,t,n,r){for(var i=-1,a=e.length,s=n.length,o=-1,c=t.length,l=mn(a-s,0),u=be(c+l),h=!r;++o<c;)u[o]=t[o];for(;++i<s;)(h||i<a)&&(u[n[i]]=e[i]);for(;l--;)u[o++]=e[i++];return u}function Si(e,t,n,r){for(var i=-1,a=e.length,s=-1,o=n.length,c=-1,l=t.length,u=mn(a-o,0),h=be(u+l),d=!r;++i<u;)h[i]=e[i];for(var f=i;++c<l;)h[f+c]=t[c];for(;++s<o;)(d||i<a)&&(h[f+n[s]]=e[i++]);return h}function Ci(e,t){var n=-1,r=e.length;for(t||(t=be(r));++n<r;)t[n]=e[n];return t}function Mi(t,n,r,i){var a=!r;r||(r={});for(var s=-1,o=n.length;++s<o;){var c=n[s],l=i?i(r[c],t[c],c,r,t):e;l===e&&(l=t[c]),a?nr(r,c,l):Zn(r,c,l)}return r}function Ei(e,t){return function(n,r){var i=js(n)?_t:er,a=t?t():{};return i(n,e,ia(r,2),a)}}function Ti(t){return Wr((function(n,r){var i=-1,a=r.length,s=a>1?r[a-1]:e,o=a>2?r[2]:e;for(s=t.length>3&&"function"==typeof s?(a--,s):e,o&&ma(r[0],r[1],o)&&(s=a<3?e:s,a=1),n=Se(n);++i<a;){var c=r[i];c&&t(n,c,i,s)}return n}))}function Ai(e,t){return function(n,r){if(null==n)return n;if(!Hs(n))return e(n,r);for(var i=n.length,a=t?i:-1,s=Se(n);(t?a--:++a<i)&&!1!==r(s[a],a,s););return n}}function Pi(e){return function(t,n,r){for(var i=-1,a=Se(t),s=r(t),o=s.length;o--;){var c=s[e?o:++i];if(!1===n(a[c],c,a))break}return t}}function Ii(t){return function(n){var r=Jt(n=go(n))?sn(n):e,i=r?r[0]:n.charAt(0),a=r?vi(r,1).join(""):n.slice(1);return i[t]()+a}}function Ni(e){return function(t){return At(Ko(jo(t).replace(We,"")),e,"")}}function Di(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Vn(e.prototype),r=e.apply(n,t);return Xs(r)?r:n}}function Oi(t){return function(n,r,i){var a=Se(n);if(!Hs(n)){var s=ia(r,3);n=Ao(n),r=function(e){return s(a[e],e,a)}}var o=t(n,r,i);return o>-1?a[s?n[o]:o]:e}}function Li(n){return Zi((function(r){var i=r.length,a=i,s=zn.prototype.thru;for(n&&r.reverse();a--;){var o=r[a];if("function"!=typeof o)throw new Ee(t);if(s&&!c&&"wrapper"==na(o))var c=new zn([],!0)}for(a=c?a:i;++a<i;){var l=na(o=r[a]),u="wrapper"==l?ta(o):e;c=u&&va(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?c[na(u[0])].apply(c,u[3]):1==o.length&&va(o)?c[l]():c.thru(o)}return function(){var e=arguments,t=e[0];if(c&&1==e.length&&js(t))return c.plant(t).value();for(var n=0,a=i?r[n].apply(this,e):t;++n<i;)a=r[n].call(this,a);return a}}))}function Bi(t,n,r,i,s,o,c,l,u,h){var d=n&a,f=1&n,p=2&n,m=24&n,g=512&n,v=p?e:Di(t);return function a(){for(var y=arguments.length,b=be(y),_=y;_--;)b[_]=arguments[_];if(m)var w=ra(a),x=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(b,w);if(i&&(b=ki(b,i,s,m)),o&&(b=Si(b,o,c,m)),y-=x,m&&y<h){var k=nn(b,w);return Hi(t,n,Bi,a.placeholder,r,b,k,l,u,h-y)}var S=f?r:this,C=p?S[t]:t;return y=b.length,l?b=function(t,n){for(var r=t.length,i=gn(n.length,r),a=Ci(t);i--;){var s=n[i];t[i]=pa(s,r)?a[s]:e}return t}(b,l):g&&y>1&&b.reverse(),d&&u<y&&(b.length=u),this&&this!==ot&&this instanceof a&&(C=v||Di(C)),C.apply(S,b)}}function Ri(e,t){return function(n,r){return i=n,a=e,s=t(r),o={},vr(i,(function(e,t,n){a(o,s(e),t,n)})),o;var i,a,s,o}}function Vi(t,n){return function(r,i){var a;if(r===e&&i===e)return n;if(r!==e&&(a=r),i!==e){if(a===e)return i;"string"==typeof r||"string"==typeof i?(r=ai(r),i=ai(i)):(r=ii(r),i=ii(i)),a=t(r,i)}return a}}function Fi(e){return Zi((function(t){return t=Et(t,Gt(ia())),Wr((function(n){var r=this;return e(t,(function(e){return bt(e,r,n)}))}))}))}function zi(t,n){var r=(n=n===e?" ":ai(n)).length;if(r<2)return r?Gr(n,t):n;var i=Gr(n,Nt(t/an(n)));return Jt(n)?vi(sn(i),0,t).join(""):i.slice(0,t)}function ji(t){return function(n,r,i){return i&&"number"!=typeof i&&ma(n,r,i)&&(r=i=e),n=uo(n),r===e?(r=n,n=0):r=uo(r),function(e,t,n,r){for(var i=-1,a=mn(Nt((t-e)/(n||1)),0),s=be(a);a--;)s[r?a:++i]=e,e+=n;return s}(n,r,i=i===e?n<r?1:-1:uo(i),t)}}function qi(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=po(t),n=po(n)),e(t,n)}}function Hi(t,n,r,a,s,o,c,l,u,h){var d=8&n;n|=d?i:64,4&(n&=~(d?64:i))||(n&=-4);var f=[t,n,s,d?o:e,d?c:e,d?e:o,d?e:c,l,u,h],p=r.apply(e,f);return va(t)&&Ca(p,f),p.placeholder=a,Ta(p,t,n)}function Ui(e){var t=ke[e];return function(e,n){if(e=po(e),(n=null==n?0:gn(ho(n),292))&&dn(e)){var r=(go(e)+"e").split("e");return+((r=(go(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Gi=Sn&&1/rn(new Sn([,-0]))[1]==s?function(e){return new Sn(e)}:sc;function Wi(e){return function(t){var n,r,i,a=ua(t);return a==y?en(t):a==k?(n=t,r=-1,i=Array(n.size),n.forEach((function(e){i[++r]=[e,e]})),i):function(e,t){return Et(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Yi(n,s,o,c,l,u,h,d){var f=2&s;if(!f&&"function"!=typeof n)throw new Ee(t);var p=c?c.length:0;if(p||(s&=-97,c=l=e),h=h===e?h:mn(ho(h),0),d=d===e?d:ho(d),p-=l?l.length:0,64&s){var m=c,g=l;c=l=e}var v,y,b,_,w=f?e:ta(n),x=[n,s,o,c,l,m,g,u,h,d];if(w&&function(e,t){var n=e[1],i=t[1],s=n|i,o=s<131,c=i==a&&8==n||i==a&&256==n&&e[7].length<=t[8]||384==i&&t[7].length<=t[8]&&8==n;if(!o&&!c)return e;1&i&&(e[2]=t[2],s|=1&n?0:4);var l=t[3];if(l){var u=e[3];e[3]=u?ki(u,l,t[4]):l,e[4]=u?nn(e[3],r):t[4]}(l=t[5])&&(u=e[5],e[5]=u?Si(u,l,t[6]):l,e[6]=u?nn(e[5],r):t[6]),(l=t[7])&&(e[7]=l),i&a&&(e[8]=null==e[8]?t[8]:gn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=s}(x,w),n=x[0],s=x[1],o=x[2],c=x[3],l=x[4],!(d=x[9]=x[9]===e?f?0:n.length:mn(x[9]-p,0))&&24&s&&(s&=-25),s&&1!=s)k=8==s||16==s?(y=s,b=d,_=Di(v=n),function t(){for(var n=arguments.length,r=be(n),i=n,a=ra(t);i--;)r[i]=arguments[i];var s=n<3&&r[0]!==a&&r[n-1]!==a?[]:nn(r,a);return(n-=s.length)<b?Hi(v,y,Bi,t.placeholder,e,r,s,e,e,b-n):bt(this&&this!==ot&&this instanceof t?_:v,this,r)}):s!=i&&33!=s||l.length?Bi.apply(e,x):function(e,t,n,r){var i=1&t,a=Di(e);return function t(){for(var s=-1,o=arguments.length,c=-1,l=r.length,u=be(l+o),h=this&&this!==ot&&this instanceof t?a:e;++c<l;)u[c]=r[c];for(;o--;)u[c++]=arguments[++s];return bt(h,i?n:this,u)}}(n,s,o,c);else var k=function(e,t,n){var r=1&t,i=Di(e);return function t(){return(this&&this!==ot&&this instanceof t?i:e).apply(r?n:this,arguments)}}(n,s,o);return Ta((w?Qr:Ca)(k,x),n,s)}function $i(t,n,r,i){return t===e||Rs(t,Pe[r])&&!De.call(i,r)?n:t}function Ki(t,n,r,i,a,s){return Xs(t)&&Xs(n)&&(s.set(n,t),Vr(t,n,e,Ki,s),s.delete(n)),t}function Qi(t){return to(t)?e:t}function Xi(t,n,r,i,a,s){var o=1&r,c=t.length,l=n.length;if(c!=l&&!(o&&l>c))return!1;var u=s.get(t),h=s.get(n);if(u&&h)return u==n&&h==t;var d=-1,f=!0,p=2&r?new Gn:e;for(s.set(t,n),s.set(n,t);++d<c;){var m=t[d],g=n[d];if(i)var v=o?i(g,m,d,n,t,s):i(m,g,d,t,n,s);if(v!==e){if(v)continue;f=!1;break}if(p){if(!It(n,(function(e,t){if(!Yt(p,t)&&(m===e||a(m,e,r,i,s)))return p.push(t)}))){f=!1;break}}else if(m!==g&&!a(m,g,r,i,s)){f=!1;break}}return s.delete(t),s.delete(n),f}function Zi(t){return Ea(xa(t,e,qa),t+"")}function Ji(e){return wr(e,Ao,ca)}function ea(e){return wr(e,Po,la)}var ta=En?function(e){return En.get(e)}:sc;function na(e){for(var t=e.name+"",n=Tn[t],r=De.call(Tn,t)?n.length:0;r--;){var i=n[r],a=i.func;if(null==a||a==e)return i.name}return t}function ra(e){return(De.call(Rn,"placeholder")?Rn:e).placeholder}function ia(){var e=Rn.iteratee||nc;return e=e===nc?Nr:e,arguments.length?e(arguments[0],arguments[1]):e}function aa(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function sa(e){for(var t=Ao(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,_a(i)]}return t}function oa(t,n){var r,i,a=(i=n,null==(r=t)?e:r[i]);return Ir(a)?a:e}var ca=un?function(e){return null==e?[]:(e=Se(e),St(un(e),(function(t){return $e.call(e,t)})))}:fc,la=un?function(e){for(var t=[];e;)Tt(t,ca(e)),e=Ue(e);return t}:fc,ua=xr;function ha(e,t,n){for(var r=-1,i=(t=mi(t,e)).length,a=!1;++r<i;){var s=Oa(t[r]);if(!(a=null!=e&&n(e,s)))break;e=e[s]}return a||++r!=i?a:!!(i=null==e?0:e.length)&&Qs(i)&&pa(s,i)&&(js(e)||zs(e))}function da(e){return"function"!=typeof e.constructor||ba(e)?{}:Vn(Ue(e))}function fa(e){return js(e)||zs(e)||!!(nt&&e&&e[nt])}function pa(e,t){var n=typeof e;return!!(t=null==t?o:t)&&("number"==n||"symbol"!=n&&fe.test(e))&&e>-1&&e%1==0&&e<t}function ma(e,t,n){if(!Xs(n))return!1;var r=typeof t;return!!("number"==r?Hs(n)&&pa(t,n.length):"string"==r&&t in n)&&Rs(n[t],e)}function ga(e,t){if(js(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!ao(e))||K.test(e)||!$.test(e)||null!=t&&e in Se(t)}function va(e){var t=na(e),n=Rn[t];if("function"!=typeof n||!(t in jn.prototype))return!1;if(e===n)return!0;var r=ta(n);return!!r&&e===r[0]}(wn&&ua(new wn(new ArrayBuffer(1)))!=T||xn&&ua(new xn)!=y||kn&&ua(kn.resolve())!=w||Sn&&ua(new Sn)!=k||Cn&&ua(new Cn)!=M)&&(ua=function(t){var n=xr(t),r=n==_?t.constructor:e,i=r?La(r):"";if(i)switch(i){case An:return T;case Pn:return y;case In:return w;case Nn:return k;case Dn:return M}return n});var ya=Ie?$s:pc;function ba(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Pe)}function _a(e){return e==e&&!Xs(e)}function wa(t,n){return function(r){return null!=r&&r[t]===n&&(n!==e||t in Se(r))}}function xa(t,n,r){return n=mn(n===e?t.length-1:n,0),function(){for(var e=arguments,i=-1,a=mn(e.length-n,0),s=be(a);++i<a;)s[i]=e[n+i];i=-1;for(var o=be(n+1);++i<n;)o[i]=e[i];return o[n]=r(s),bt(t,this,o)}}function ka(e,t){return t.length<2?e:_r(e,Jr(t,0,-1))}function Sa(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Ca=Aa(Qr),Ma=dt||function(e,t){return ot.setTimeout(e,t)},Ea=Aa(Xr);function Ta(e,t,n){var r,i=t+"";return Ea(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(te,"{\n/* [wrapped with "+t+"] */\n")}(i,function(e,t){return wt(u,(function(n){var r="_."+n[0];t&n[1]&&!Ct(e,r)&&e.push(r)})),e.sort()}((r=i.match(ne))?r[1].split(re):[],n)))}function Aa(t){var n=0,r=0;return function(){var i=vn(),a=16-(i-r);if(r=i,a>0){if(++n>=800)return arguments[0]}else n=0;return t.apply(e,arguments)}}function Pa(t,n){var r=-1,i=t.length,a=i-1;for(n=n===e?i:n;++r<n;){var s=Ur(r,a),o=t[s];t[s]=t[r],t[r]=o}return t.length=n,t}var Ia,Na,Da=(Ia=Is((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Q,(function(e,n,r,i){t.push(r?i.replace(se,"$1"):n||e)})),t}),(function(e){return 500===Na.size&&Na.clear(),e})),Na=Ia.cache,Ia);function Oa(e){if("string"==typeof e||ao(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function La(e){if(null!=e){try{return Ne.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Ba(e){if(e instanceof jn)return e.clone();var t=new zn(e.__wrapped__,e.__chain__);return t.__actions__=Ci(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Ra=Wr((function(e,t){return Us(e)?cr(e,pr(t,1,Us,!0)):[]})),Va=Wr((function(t,n){var r=Ya(n);return Us(r)&&(r=e),Us(t)?cr(t,pr(n,1,Us,!0),ia(r,2)):[]})),Fa=Wr((function(t,n){var r=Ya(n);return Us(r)&&(r=e),Us(t)?cr(t,pr(n,1,Us,!0),e,r):[]}));function za(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ho(n);return i<0&&(i=mn(r+i,0)),Ot(e,ia(t,3),i)}function ja(t,n,r){var i=null==t?0:t.length;if(!i)return-1;var a=i-1;return r!==e&&(a=ho(r),a=r<0?mn(i+a,0):gn(a,i-1)),Ot(t,ia(n,3),a,!0)}function qa(e){return null!=e&&e.length?pr(e,1):[]}function Ha(t){return t&&t.length?t[0]:e}var Ua=Wr((function(e){var t=Et(e,fi);return t.length&&t[0]===e[0]?Mr(t):[]})),Ga=Wr((function(t){var n=Ya(t),r=Et(t,fi);return n===Ya(r)?n=e:r.pop(),r.length&&r[0]===t[0]?Mr(r,ia(n,2)):[]})),Wa=Wr((function(t){var n=Ya(t),r=Et(t,fi);return(n="function"==typeof n?n:e)&&r.pop(),r.length&&r[0]===t[0]?Mr(r,e,n):[]}));function Ya(t){var n=null==t?0:t.length;return n?t[n-1]:e}var $a=Wr(Ka);function Ka(e,t){return e&&e.length&&t&&t.length?qr(e,t):e}var Qa=Zi((function(e,t){var n=null==e?0:e.length,r=rr(e,t);return Hr(e,Et(t,(function(e){return pa(e,n)?+e:e})).sort(xi)),r}));function Xa(e){return null==e?e:_n.call(e)}var Za=Wr((function(e){return si(pr(e,1,Us,!0))})),Ja=Wr((function(t){var n=Ya(t);return Us(n)&&(n=e),si(pr(t,1,Us,!0),ia(n,2))})),es=Wr((function(t){var n=Ya(t);return n="function"==typeof n?n:e,si(pr(t,1,Us,!0),e,n)}));function ts(e){if(!e||!e.length)return[];var t=0;return e=St(e,(function(e){if(Us(e))return t=mn(e.length,t),!0})),Ht(t,(function(t){return Et(e,Ft(t))}))}function ns(t,n){if(!t||!t.length)return[];var r=ts(t);return null==n?r:Et(r,(function(t){return bt(n,e,t)}))}var rs=Wr((function(e,t){return Us(e)?cr(e,t):[]})),is=Wr((function(e){return hi(St(e,Us))})),as=Wr((function(t){var n=Ya(t);return Us(n)&&(n=e),hi(St(t,Us),ia(n,2))})),ss=Wr((function(t){var n=Ya(t);return n="function"==typeof n?n:e,hi(St(t,Us),e,n)})),os=Wr(ts),cs=Wr((function(t){var n=t.length,r=n>1?t[n-1]:e;return r="function"==typeof r?(t.pop(),r):e,ns(t,r)}));function ls(e){var t=Rn(e);return t.__chain__=!0,t}function us(e,t){return t(e)}var hs=Zi((function(t){var n=t.length,r=n?t[0]:0,i=this.__wrapped__,a=function(e){return rr(e,t)};return!(n>1||this.__actions__.length)&&i instanceof jn&&pa(r)?((i=i.slice(r,+r+(n?1:0))).__actions__.push({func:us,args:[a],thisArg:e}),new zn(i,this.__chain__).thru((function(t){return n&&!t.length&&t.push(e),t}))):this.thru(a)})),ds=Ei((function(e,t,n){De.call(e,n)?++e[n]:nr(e,n,1)})),fs=Oi(za),ps=Oi(ja);function ms(e,t){return(js(e)?wt:lr)(e,ia(t,3))}function gs(e,t){return(js(e)?xt:ur)(e,ia(t,3))}var vs=Ei((function(e,t,n){De.call(e,n)?e[n].push(t):nr(e,n,[t])})),ys=Wr((function(e,t,n){var r=-1,i="function"==typeof t,a=Hs(e)?be(e.length):[];return lr(e,(function(e){a[++r]=i?bt(t,e,n):Er(e,t,n)})),a})),bs=Ei((function(e,t,n){nr(e,n,t)}));function _s(e,t){return(js(e)?Et:Lr)(e,ia(t,3))}var ws=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),xs=Wr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&ma(e,t[0],t[1])?t=[]:n>2&&ma(t[0],t[1],t[2])&&(t=[t[0]]),zr(e,pr(t,1),[])})),ks=ht||function(){return ot.Date.now()};function Ss(t,n,r){return n=r?e:n,n=t&&null==n?t.length:n,Yi(t,a,e,e,e,e,n)}function Cs(n,r){var i;if("function"!=typeof r)throw new Ee(t);return n=ho(n),function(){return--n>0&&(i=r.apply(this,arguments)),n<=1&&(r=e),i}}var Ms=Wr((function(e,t,n){var r=1;if(n.length){var a=nn(n,ra(Ms));r|=i}return Yi(e,r,t,n,a)})),Es=Wr((function(e,t,n){var r=3;if(n.length){var a=nn(n,ra(Es));r|=i}return Yi(t,r,e,n,a)}));function Ts(n,r,i){var a,s,o,c,l,u,h=0,d=!1,f=!1,p=!0;if("function"!=typeof n)throw new Ee(t);function m(t){var r=a,i=s;return a=s=e,h=t,c=n.apply(i,r)}function g(t){var n=t-u;return u===e||n>=r||n<0||f&&t-h>=o}function v(){var e,t,n=ks();if(g(n))return y(n);l=Ma(v,(t=r-((e=n)-u),f?gn(t,o-(e-h)):t))}function y(t){return l=e,p&&a?m(t):(a=s=e,c)}function b(){var t,n=ks(),i=g(n);if(a=arguments,s=this,u=n,i){if(l===e)return h=t=u,l=Ma(v,r),d?m(t):c;if(f)return yi(l),l=Ma(v,r),m(u)}return l===e&&(l=Ma(v,r)),c}return r=po(r)||0,Xs(i)&&(d=!!i.leading,o=(f="maxWait"in i)?mn(po(i.maxWait)||0,r):o,p="trailing"in i?!!i.trailing:p),b.cancel=function(){l!==e&&yi(l),h=0,a=u=s=l=e},b.flush=function(){return l===e?c:y(ks())},b}var As=Wr((function(e,t){return or(e,1,t)})),Ps=Wr((function(e,t,n){return or(e,po(t)||0,n)}));function Is(e,n){if("function"!=typeof e||null!=n&&"function"!=typeof n)throw new Ee(t);var r=function(){var t=arguments,i=n?n.apply(this,t):t[0],a=r.cache;if(a.has(i))return a.get(i);var s=e.apply(this,t);return r.cache=a.set(i,s)||a,s};return r.cache=new(Is.Cache||Un),r}function Ns(e){if("function"!=typeof e)throw new Ee(t);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Is.Cache=Un;var Ds=gi((function(e,t){var n=(t=1==t.length&&js(t[0])?Et(t[0],Gt(ia())):Et(pr(t,1),Gt(ia()))).length;return Wr((function(r){for(var i=-1,a=gn(r.length,n);++i<a;)r[i]=t[i].call(this,r[i]);return bt(e,this,r)}))})),Os=Wr((function(t,n){var r=nn(n,ra(Os));return Yi(t,i,e,n,r)})),Ls=Wr((function(t,n){var r=nn(n,ra(Ls));return Yi(t,64,e,n,r)})),Bs=Zi((function(t,n){return Yi(t,256,e,e,e,n)}));function Rs(e,t){return e===t||e!=e&&t!=t}var Vs=qi(kr),Fs=qi((function(e,t){return e>=t})),zs=Tr(/* @__PURE__ */function(){return arguments}())?Tr:function(e){return Zs(e)&&De.call(e,"callee")&&!$e.call(e,"callee")},js=be.isArray,qs=ft?Gt(ft):function(e){return Zs(e)&&xr(e)==E};function Hs(e){return null!=e&&Qs(e.length)&&!$s(e)}function Us(e){return Zs(e)&&Hs(e)}var Gs=hn||pc,Ws=pt?Gt(pt):function(e){return Zs(e)&&xr(e)==p};function Ys(e){if(!Zs(e))return!1;var t=xr(e);return t==m||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!to(e)}function $s(e){if(!Xs(e))return!1;var t=xr(e);return t==g||t==v||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Ks(e){return"number"==typeof e&&e==ho(e)}function Qs(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}function Xs(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Zs(e){return null!=e&&"object"==typeof e}var Js=mt?Gt(mt):function(e){return Zs(e)&&ua(e)==y};function eo(e){return"number"==typeof e||Zs(e)&&xr(e)==b}function to(e){if(!Zs(e)||xr(e)!=_)return!1;var t=Ue(e);if(null===t)return!0;var n=De.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ne.call(n)==Re}var no=gt?Gt(gt):function(e){return Zs(e)&&xr(e)==x},ro=vt?Gt(vt):function(e){return Zs(e)&&ua(e)==k};function io(e){return"string"==typeof e||!js(e)&&Zs(e)&&xr(e)==S}function ao(e){return"symbol"==typeof e||Zs(e)&&xr(e)==C}var so=yt?Gt(yt):function(e){return Zs(e)&&Qs(e.length)&&!!et[xr(e)]},oo=qi(Or),co=qi((function(e,t){return e<=t}));function lo(e){if(!e)return[];if(Hs(e))return io(e)?sn(e):Ci(e);if(at&&e[at])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[at]());var t=ua(e);return(t==y?en:t==k?rn:Vo)(e)}function uo(e){return e?(e=po(e))===s||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ho(e){var t=uo(e),n=t%1;return t==t?n?t-n:t:0}function fo(e){return e?ir(ho(e),0,l):0}function po(e){if("number"==typeof e)return e;if(ao(e))return c;if(Xs(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Xs(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Ut(e);var n=ue.test(e);return n||de.test(e)?it(e.slice(2),n?2:8):le.test(e)?c:+e}function mo(e){return Mi(e,Po(e))}function go(e){return null==e?"":ai(e)}var vo=Ti((function(e,t){if(ba(t)||Hs(t))Mi(t,Ao(t),e);else for(var n in t)De.call(t,n)&&Zn(e,n,t[n])})),yo=Ti((function(e,t){Mi(t,Po(t),e)})),bo=Ti((function(e,t,n,r){Mi(t,Po(t),e,r)})),_o=Ti((function(e,t,n,r){Mi(t,Ao(t),e,r)})),wo=Zi(rr),xo=Wr((function(t,n){t=Se(t);var r=-1,i=n.length,a=i>2?n[2]:e;for(a&&ma(n[0],n[1],a)&&(i=1);++r<i;)for(var s=n[r],o=Po(s),c=-1,l=o.length;++c<l;){var u=o[c],h=t[u];(h===e||Rs(h,Pe[u])&&!De.call(t,u))&&(t[u]=s[u])}return t})),ko=Wr((function(t){return t.push(e,Ki),bt(No,e,t)}));function So(t,n,r){var i=null==t?e:_r(t,n);return i===e?r:i}function Co(e,t){return null!=e&&ha(e,t,Cr)}var Mo=Ri((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Be.call(t)),e[t]=n}),Zo(tc)),Eo=Ri((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Be.call(t)),De.call(e,t)?e[t].push(n):e[t]=[n]}),ia),To=Wr(Er);function Ao(e){return Hs(e)?Yn(e):Dr(e)}function Po(e){return Hs(e)?Yn(e,!0):function(e){if(!Xs(e))return function(e){var t=[];if(null!=e)for(var n in Se(e))t.push(n);return t}(e);var t=ba(e),n=[];for(var r in e)("constructor"!=r||!t&&De.call(e,r))&&n.push(r);return n}(e)}var Io=Ti((function(e,t,n){Vr(e,t,n)})),No=Ti((function(e,t,n,r){Vr(e,t,n,r)})),Do=Zi((function(e,t){var n={};if(null==e)return n;var r=!1;t=Et(t,(function(t){return t=mi(t,e),r||(r=t.length>1),t})),Mi(e,ea(e),n),r&&(n=ar(n,7,Qi));for(var i=t.length;i--;)oi(n,t[i]);return n})),Oo=Zi((function(e,t){return null==e?{}:jr(n=e,t,(function(e,t){return Co(n,t)}));var n}));function Lo(e,t){if(null==e)return{};var n=Et(ea(e),(function(e){return[e]}));return t=ia(t),jr(e,n,(function(e,n){return t(e,n[0])}))}var Bo=Wi(Ao),Ro=Wi(Po);function Vo(e){return null==e?[]:Wt(e,Ao(e))}var Fo=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?zo(t):t)}));function zo(e){return $o(go(e).toLowerCase())}function jo(e){return(e=go(e))&&e.replace(pe,Qt).replace(Ye,"")}var qo=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Ho=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Uo=Ii("toLowerCase"),Go=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Wo=Ni((function(e,t,n){return e+(n?" ":"")+$o(t)})),Yo=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),$o=Ii("toUpperCase");function Ko(t,n,r){return t=go(t),(n=r?e:n)===e?(i=t,Xe.test(i)?function(e){return e.match(Ke)||[]}(t):function(e){return e.match(ie)||[]}(t)):t.match(n)||[];var i}var Qo=Wr((function(t,n){try{return bt(t,e,n)}catch(r){return Ys(r)?r:new we(r)}})),Xo=Zi((function(e,t){return wt(t,(function(t){t=Oa(t),nr(e,t,Ms(e[t],e))})),e}));function Zo(e){return function(){return e}}var Jo=Li(),ec=Li(!0);function tc(e){return e}function nc(e){return Nr("function"==typeof e?e:ar(e,1))}var rc=Wr((function(e,t){return function(n){return Er(n,e,t)}})),ic=Wr((function(e,t){return function(n){return Er(e,n,t)}}));function ac(e,t,n){var r=Ao(t),i=br(t,r);null!=n||Xs(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=br(t,Ao(t)));var a=!(Xs(n)&&"chain"in n&&!n.chain),s=$s(e);return wt(i,(function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__);return(n.__actions__=Ci(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Tt([this.value()],arguments))})})),e}function sc(){}var oc=Fi(Et),cc=Fi(kt),lc=Fi(It);function uc(e){return ga(e)?Ft(Oa(e)):/* @__PURE__ */function(e){return function(t){return _r(t,e)}}(e)}var hc=ji(),dc=ji(!0);function fc(){return[]}function pc(){return!1}var mc,gc=Vi((function(e,t){return e+t}),0),vc=Ui("ceil"),yc=Vi((function(e,t){return e/t}),1),bc=Ui("floor"),_c=Vi((function(e,t){return e*t}),1),wc=Ui("round"),xc=Vi((function(e,t){return e-t}),0);return Rn.after=function(e,n){if("function"!=typeof n)throw new Ee(t);return e=ho(e),function(){if(--e<1)return n.apply(this,arguments)}},Rn.ary=Ss,Rn.assign=vo,Rn.assignIn=yo,Rn.assignInWith=bo,Rn.assignWith=_o,Rn.at=wo,Rn.before=Cs,Rn.bind=Ms,Rn.bindAll=Xo,Rn.bindKey=Es,Rn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return js(e)?e:[e]},Rn.chain=ls,Rn.chunk=function(t,n,r){n=(r?ma(t,n,r):n===e)?1:mn(ho(n),0);var i=null==t?0:t.length;if(!i||n<1)return[];for(var a=0,s=0,o=be(Nt(i/n));a<i;)o[s++]=Jr(t,a,a+=n);return o},Rn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var a=e[t];a&&(i[r++]=a)}return i},Rn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=be(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Tt(js(n)?Ci(n):[n],pr(t,1))},Rn.cond=function(e){var n=null==e?0:e.length,r=ia();return e=n?Et(e,(function(e){if("function"!=typeof e[1])throw new Ee(t);return[r(e[0]),e[1]]})):[],Wr((function(t){for(var r=-1;++r<n;){var i=e[r];if(bt(i[0],this,t))return bt(i[1],this,t)}}))},Rn.conforms=function(e){return t=ar(e,1),n=Ao(t),function(e){return sr(e,t,n)};var t,n},Rn.constant=Zo,Rn.countBy=ds,Rn.create=function(e,t){var n=Vn(e);return null==t?n:tr(n,t)},Rn.curry=function t(n,r,i){var a=Yi(n,8,e,e,e,e,e,r=i?e:r);return a.placeholder=t.placeholder,a},Rn.curryRight=function t(n,r,i){var a=Yi(n,16,e,e,e,e,e,r=i?e:r);return a.placeholder=t.placeholder,a},Rn.debounce=Ts,Rn.defaults=xo,Rn.defaultsDeep=ko,Rn.defer=As,Rn.delay=Ps,Rn.difference=Ra,Rn.differenceBy=Va,Rn.differenceWith=Fa,Rn.drop=function(t,n,r){var i=null==t?0:t.length;return i?Jr(t,(n=r||n===e?1:ho(n))<0?0:n,i):[]},Rn.dropRight=function(t,n,r){var i=null==t?0:t.length;return i?Jr(t,0,(n=i-(n=r||n===e?1:ho(n)))<0?0:n):[]},Rn.dropRightWhile=function(e,t){return e&&e.length?li(e,ia(t,3),!0,!0):[]},Rn.dropWhile=function(e,t){return e&&e.length?li(e,ia(t,3),!0):[]},Rn.fill=function(t,n,r,i){var a=null==t?0:t.length;return a?(r&&"number"!=typeof r&&ma(t,n,r)&&(r=0,i=a),function(t,n,r,i){var a=t.length;for((r=ho(r))<0&&(r=-r>a?0:a+r),(i=i===e||i>a?a:ho(i))<0&&(i+=a),i=r>i?0:fo(i);r<i;)t[r++]=n;return t}(t,n,r,i)):[]},Rn.filter=function(e,t){return(js(e)?St:fr)(e,ia(t,3))},Rn.flatMap=function(e,t){return pr(_s(e,t),1)},Rn.flatMapDeep=function(e,t){return pr(_s(e,t),s)},Rn.flatMapDepth=function(t,n,r){return r=r===e?1:ho(r),pr(_s(t,n),r)},Rn.flatten=qa,Rn.flattenDeep=function(e){return null!=e&&e.length?pr(e,s):[]},Rn.flattenDepth=function(t,n){return null!=t&&t.length?pr(t,n=n===e?1:ho(n)):[]},Rn.flip=function(e){return Yi(e,512)},Rn.flow=Jo,Rn.flowRight=ec,Rn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r},Rn.functions=function(e){return null==e?[]:br(e,Ao(e))},Rn.functionsIn=function(e){return null==e?[]:br(e,Po(e))},Rn.groupBy=vs,Rn.initial=function(e){return null!=e&&e.length?Jr(e,0,-1):[]},Rn.intersection=Ua,Rn.intersectionBy=Ga,Rn.intersectionWith=Wa,Rn.invert=Mo,Rn.invertBy=Eo,Rn.invokeMap=ys,Rn.iteratee=nc,Rn.keyBy=bs,Rn.keys=Ao,Rn.keysIn=Po,Rn.map=_s,Rn.mapKeys=function(e,t){var n={};return t=ia(t,3),vr(e,(function(e,r,i){nr(n,t(e,r,i),e)})),n},Rn.mapValues=function(e,t){var n={};return t=ia(t,3),vr(e,(function(e,r,i){nr(n,r,t(e,r,i))})),n},Rn.matches=function(e){return Br(ar(e,1))},Rn.matchesProperty=function(e,t){return Rr(e,ar(t,1))},Rn.memoize=Is,Rn.merge=Io,Rn.mergeWith=No,Rn.method=rc,Rn.methodOf=ic,Rn.mixin=ac,Rn.negate=Ns,Rn.nthArg=function(e){return e=ho(e),Wr((function(t){return Fr(t,e)}))},Rn.omit=Do,Rn.omitBy=function(e,t){return Lo(e,Ns(ia(t)))},Rn.once=function(e){return Cs(2,e)},Rn.orderBy=function(t,n,r,i){return null==t?[]:(js(n)||(n=null==n?[]:[n]),js(r=i?e:r)||(r=null==r?[]:[r]),zr(t,n,r))},Rn.over=oc,Rn.overArgs=Ds,Rn.overEvery=cc,Rn.overSome=lc,Rn.partial=Os,Rn.partialRight=Ls,Rn.partition=ws,Rn.pick=Oo,Rn.pickBy=Lo,Rn.property=uc,Rn.propertyOf=function(t){return function(n){return null==t?e:_r(t,n)}},Rn.pull=$a,Rn.pullAll=Ka,Rn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?qr(e,t,ia(n,2)):e},Rn.pullAllWith=function(t,n,r){return t&&t.length&&n&&n.length?qr(t,n,e,r):t},Rn.pullAt=Qa,Rn.range=hc,Rn.rangeRight=dc,Rn.rearg=Bs,Rn.reject=function(e,t){return(js(e)?St:fr)(e,Ns(ia(t,3)))},Rn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],a=e.length;for(t=ia(t,3);++r<a;){var s=e[r];t(s,r,e)&&(n.push(s),i.push(r))}return Hr(e,i),n},Rn.rest=function(n,r){if("function"!=typeof n)throw new Ee(t);return Wr(n,r=r===e?r:ho(r))},Rn.reverse=Xa,Rn.sampleSize=function(t,n,r){return n=(r?ma(t,n,r):n===e)?1:ho(n),(js(t)?Kn:$r)(t,n)},Rn.set=function(e,t,n){return null==e?e:Kr(e,t,n)},Rn.setWith=function(t,n,r,i){return i="function"==typeof i?i:e,null==t?t:Kr(t,n,r,i)},Rn.shuffle=function(e){return(js(e)?Qn:Zr)(e)},Rn.slice=function(t,n,r){var i=null==t?0:t.length;return i?(r&&"number"!=typeof r&&ma(t,n,r)?(n=0,r=i):(n=null==n?0:ho(n),r=r===e?i:ho(r)),Jr(t,n,r)):[]},Rn.sortBy=xs,Rn.sortedUniq=function(e){return e&&e.length?ri(e):[]},Rn.sortedUniqBy=function(e,t){return e&&e.length?ri(e,ia(t,2)):[]},Rn.split=function(t,n,r){return r&&"number"!=typeof r&&ma(t,n,r)&&(n=r=e),(r=r===e?l:r>>>0)?(t=go(t))&&("string"==typeof n||null!=n&&!no(n))&&!(n=ai(n))&&Jt(t)?vi(sn(t),0,r):t.split(n,r):[]},Rn.spread=function(e,n){if("function"!=typeof e)throw new Ee(t);return n=null==n?0:mn(ho(n),0),Wr((function(t){var r=t[n],i=vi(t,0,n);return r&&Tt(i,r),bt(e,this,i)}))},Rn.tail=function(e){var t=null==e?0:e.length;return t?Jr(e,1,t):[]},Rn.take=function(t,n,r){return t&&t.length?Jr(t,0,(n=r||n===e?1:ho(n))<0?0:n):[]},Rn.takeRight=function(t,n,r){var i=null==t?0:t.length;return i?Jr(t,(n=i-(n=r||n===e?1:ho(n)))<0?0:n,i):[]},Rn.takeRightWhile=function(e,t){return e&&e.length?li(e,ia(t,3),!1,!0):[]},Rn.takeWhile=function(e,t){return e&&e.length?li(e,ia(t,3)):[]},Rn.tap=function(e,t){return t(e),e},Rn.throttle=function(e,n,r){var i=!0,a=!0;if("function"!=typeof e)throw new Ee(t);return Xs(r)&&(i="leading"in r?!!r.leading:i,a="trailing"in r?!!r.trailing:a),Ts(e,n,{leading:i,maxWait:n,trailing:a})},Rn.thru=us,Rn.toArray=lo,Rn.toPairs=Bo,Rn.toPairsIn=Ro,Rn.toPath=function(e){return js(e)?Et(e,Oa):ao(e)?[e]:Ci(Da(go(e)))},Rn.toPlainObject=mo,Rn.transform=function(e,t,n){var r=js(e),i=r||Gs(e)||so(e);if(t=ia(t,4),null==n){var a=e&&e.constructor;n=i?r?new a:[]:Xs(e)&&$s(a)?Vn(Ue(e)):{}}return(i?wt:vr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Rn.unary=function(e){return Ss(e,1)},Rn.union=Za,Rn.unionBy=Ja,Rn.unionWith=es,Rn.uniq=function(e){return e&&e.length?si(e):[]},Rn.uniqBy=function(e,t){return e&&e.length?si(e,ia(t,2)):[]},Rn.uniqWith=function(t,n){return n="function"==typeof n?n:e,t&&t.length?si(t,e,n):[]},Rn.unset=function(e,t){return null==e||oi(e,t)},Rn.unzip=ts,Rn.unzipWith=ns,Rn.update=function(e,t,n){return null==e?e:ci(e,t,pi(n))},Rn.updateWith=function(t,n,r,i){return i="function"==typeof i?i:e,null==t?t:ci(t,n,pi(r),i)},Rn.values=Vo,Rn.valuesIn=function(e){return null==e?[]:Wt(e,Po(e))},Rn.without=rs,Rn.words=Ko,Rn.wrap=function(e,t){return Os(pi(t),e)},Rn.xor=is,Rn.xorBy=as,Rn.xorWith=ss,Rn.zip=os,Rn.zipObject=function(e,t){return di(e||[],t||[],Zn)},Rn.zipObjectDeep=function(e,t){return di(e||[],t||[],Kr)},Rn.zipWith=cs,Rn.entries=Bo,Rn.entriesIn=Ro,Rn.extend=yo,Rn.extendWith=bo,ac(Rn,Rn),Rn.add=gc,Rn.attempt=Qo,Rn.camelCase=Fo,Rn.capitalize=zo,Rn.ceil=vc,Rn.clamp=function(t,n,r){return r===e&&(r=n,n=e),r!==e&&(r=(r=po(r))==r?r:0),n!==e&&(n=(n=po(n))==n?n:0),ir(po(t),n,r)},Rn.clone=function(e){return ar(e,4)},Rn.cloneDeep=function(e){return ar(e,5)},Rn.cloneDeepWith=function(t,n){return ar(t,5,n="function"==typeof n?n:e)},Rn.cloneWith=function(t,n){return ar(t,4,n="function"==typeof n?n:e)},Rn.conformsTo=function(e,t){return null==t||sr(e,t,Ao(t))},Rn.deburr=jo,Rn.defaultTo=function(e,t){return null==e||e!=e?t:e},Rn.divide=yc,Rn.endsWith=function(t,n,r){t=go(t),n=ai(n);var i=t.length,a=r=r===e?i:ir(ho(r),0,i);return(r-=n.length)>=0&&t.slice(r,a)==n},Rn.eq=Rs,Rn.escape=function(e){return(e=go(e))&&U.test(e)?e.replace(q,Xt):e},Rn.escapeRegExp=function(e){return(e=go(e))&&Z.test(e)?e.replace(X,"\\$&"):e},Rn.every=function(t,n,r){var i=js(t)?kt:hr;return r&&ma(t,n,r)&&(n=e),i(t,ia(n,3))},Rn.find=fs,Rn.findIndex=za,Rn.findKey=function(e,t){return Dt(e,ia(t,3),vr)},Rn.findLast=ps,Rn.findLastIndex=ja,Rn.findLastKey=function(e,t){return Dt(e,ia(t,3),yr)},Rn.floor=bc,Rn.forEach=ms,Rn.forEachRight=gs,Rn.forIn=function(e,t){return null==e?e:mr(e,ia(t,3),Po)},Rn.forInRight=function(e,t){return null==e?e:gr(e,ia(t,3),Po)},Rn.forOwn=function(e,t){return e&&vr(e,ia(t,3))},Rn.forOwnRight=function(e,t){return e&&yr(e,ia(t,3))},Rn.get=So,Rn.gt=Vs,Rn.gte=Fs,Rn.has=function(e,t){return null!=e&&ha(e,t,Sr)},Rn.hasIn=Co,Rn.head=Ha,Rn.identity=tc,Rn.includes=function(e,t,n,r){e=Hs(e)?e:Vo(e),n=n&&!r?ho(n):0;var i=e.length;return n<0&&(n=mn(i+n,0)),io(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Lt(e,t,n)>-1},Rn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ho(n);return i<0&&(i=mn(r+i,0)),Lt(e,t,i)},Rn.inRange=function(t,n,r){return n=uo(n),r===e?(r=n,n=0):r=uo(r),(i=t=po(t))>=gn(a=n,s=r)&&i<mn(a,s);var i,a,s},Rn.invoke=To,Rn.isArguments=zs,Rn.isArray=js,Rn.isArrayBuffer=qs,Rn.isArrayLike=Hs,Rn.isArrayLikeObject=Us,Rn.isBoolean=function(e){return!0===e||!1===e||Zs(e)&&xr(e)==f},Rn.isBuffer=Gs,Rn.isDate=Ws,Rn.isElement=function(e){return Zs(e)&&1===e.nodeType&&!to(e)},Rn.isEmpty=function(e){if(null==e)return!0;if(Hs(e)&&(js(e)||"string"==typeof e||"function"==typeof e.splice||Gs(e)||so(e)||zs(e)))return!e.length;var t=ua(e);if(t==y||t==k)return!e.size;if(ba(e))return!Dr(e).length;for(var n in e)if(De.call(e,n))return!1;return!0},Rn.isEqual=function(e,t){return Ar(e,t)},Rn.isEqualWith=function(t,n,r){var i=(r="function"==typeof r?r:e)?r(t,n):e;return i===e?Ar(t,n,e,r):!!i},Rn.isError=Ys,Rn.isFinite=function(e){return"number"==typeof e&&dn(e)},Rn.isFunction=$s,Rn.isInteger=Ks,Rn.isLength=Qs,Rn.isMap=Js,Rn.isMatch=function(e,t){return e===t||Pr(e,t,sa(t))},Rn.isMatchWith=function(t,n,r){return r="function"==typeof r?r:e,Pr(t,n,sa(n),r)},Rn.isNaN=function(e){return eo(e)&&e!=+e},Rn.isNative=function(e){if(ya(e))throw new we("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Ir(e)},Rn.isNil=function(e){return null==e},Rn.isNull=function(e){return null===e},Rn.isNumber=eo,Rn.isObject=Xs,Rn.isObjectLike=Zs,Rn.isPlainObject=to,Rn.isRegExp=no,Rn.isSafeInteger=function(e){return Ks(e)&&e>=-9007199254740991&&e<=o},Rn.isSet=ro,Rn.isString=io,Rn.isSymbol=ao,Rn.isTypedArray=so,Rn.isUndefined=function(t){return t===e},Rn.isWeakMap=function(e){return Zs(e)&&ua(e)==M},Rn.isWeakSet=function(e){return Zs(e)&&"[object WeakSet]"==xr(e)},Rn.join=function(e,t){return null==e?"":fn.call(e,t)},Rn.kebabCase=qo,Rn.last=Ya,Rn.lastIndexOf=function(t,n,r){var i=null==t?0:t.length;if(!i)return-1;var a=i;return r!==e&&(a=(a=ho(r))<0?mn(i+a,0):gn(a,i-1)),n==n?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(t,n,a):Ot(t,Rt,a,!0)},Rn.lowerCase=Ho,Rn.lowerFirst=Uo,Rn.lt=oo,Rn.lte=co,Rn.max=function(t){return t&&t.length?dr(t,tc,kr):e},Rn.maxBy=function(t,n){return t&&t.length?dr(t,ia(n,2),kr):e},Rn.mean=function(e){return Vt(e,tc)},Rn.meanBy=function(e,t){return Vt(e,ia(t,2))},Rn.min=function(t){return t&&t.length?dr(t,tc,Or):e},Rn.minBy=function(t,n){return t&&t.length?dr(t,ia(n,2),Or):e},Rn.stubArray=fc,Rn.stubFalse=pc,Rn.stubObject=function(){return{}},Rn.stubString=function(){return""},Rn.stubTrue=function(){return!0},Rn.multiply=_c,Rn.nth=function(t,n){return t&&t.length?Fr(t,ho(n)):e},Rn.noConflict=function(){return ot._===this&&(ot._=Ve),this},Rn.noop=sc,Rn.now=ks,Rn.pad=function(e,t,n){e=go(e);var r=(t=ho(t))?an(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return zi(zt(i),n)+e+zi(Nt(i),n)},Rn.padEnd=function(e,t,n){e=go(e);var r=(t=ho(t))?an(e):0;return t&&r<t?e+zi(t-r,n):e},Rn.padStart=function(e,t,n){e=go(e);var r=(t=ho(t))?an(e):0;return t&&r<t?zi(t-r,n)+e:e},Rn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),yn(go(e).replace(J,""),t||0)},Rn.random=function(t,n,r){if(r&&"boolean"!=typeof r&&ma(t,n,r)&&(n=r=e),r===e&&("boolean"==typeof n?(r=n,n=e):"boolean"==typeof t&&(r=t,t=e)),t===e&&n===e?(t=0,n=1):(t=uo(t),n===e?(n=t,t=0):n=uo(n)),t>n){var i=t;t=n,n=i}if(r||t%1||n%1){var a=bn();return gn(t+a*(n-t+rt("1e-"+((a+"").length-1))),n)}return Ur(t,n)},Rn.reduce=function(e,t,n){var r=js(e)?At:jt,i=arguments.length<3;return r(e,ia(t,4),n,i,lr)},Rn.reduceRight=function(e,t,n){var r=js(e)?Pt:jt,i=arguments.length<3;return r(e,ia(t,4),n,i,ur)},Rn.repeat=function(t,n,r){return n=(r?ma(t,n,r):n===e)?1:ho(n),Gr(go(t),n)},Rn.replace=function(){var e=arguments,t=go(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Rn.result=function(t,n,r){var i=-1,a=(n=mi(n,t)).length;for(a||(a=1,t=e);++i<a;){var s=null==t?e:t[Oa(n[i])];s===e&&(i=a,s=r),t=$s(s)?s.call(t):s}return t},Rn.round=wc,Rn.runInContext=ee,Rn.sample=function(e){return(js(e)?$n:Yr)(e)},Rn.size=function(e){if(null==e)return 0;if(Hs(e))return io(e)?an(e):e.length;var t=ua(e);return t==y||t==k?e.size:Dr(e).length},Rn.snakeCase=Go,Rn.some=function(t,n,r){var i=js(t)?It:ei;return r&&ma(t,n,r)&&(n=e),i(t,ia(n,3))},Rn.sortedIndex=function(e,t){return ti(e,t)},Rn.sortedIndexBy=function(e,t,n){return ni(e,t,ia(n,2))},Rn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ti(e,t);if(r<n&&Rs(e[r],t))return r}return-1},Rn.sortedLastIndex=function(e,t){return ti(e,t,!0)},Rn.sortedLastIndexBy=function(e,t,n){return ni(e,t,ia(n,2),!0)},Rn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ti(e,t,!0)-1;if(Rs(e[n],t))return n}return-1},Rn.startCase=Wo,Rn.startsWith=function(e,t,n){return e=go(e),n=null==n?0:ir(ho(n),0,e.length),t=ai(t),e.slice(n,n+t.length)==t},Rn.subtract=xc,Rn.sum=function(e){return e&&e.length?qt(e,tc):0},Rn.sumBy=function(e,t){return e&&e.length?qt(e,ia(t,2)):0},Rn.template=function(t,n,r){var i=Rn.templateSettings;r&&ma(t,n,r)&&(n=e),t=go(t),n=bo({},n,i,$i);var a,s,o=bo({},n.imports,i.imports,$i),c=Ao(o),l=Wt(o,c),u=0,h=n.interpolate||me,d="__p += '",f=Ce((n.escape||me).source+"|"+h.source+"|"+(h===Y?oe:me).source+"|"+(n.evaluate||me).source+"|$","g"),p="//# sourceURL="+(De.call(n,"sourceURL")?(n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Je+"]")+"\n";t.replace(f,(function(e,n,r,i,o,c){return r||(r=i),d+=t.slice(u,c).replace(ge,Zt),n&&(a=!0,d+="' +\n__e("+n+") +\n'"),o&&(s=!0,d+="';\n"+o+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=c+e.length,e})),d+="';\n";var m=De.call(n,"variable")&&n.variable;if(m){if(ae.test(m))throw new we("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(s?d.replace(V,""):d).replace(F,"$1").replace(z,"$1;"),d="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=Qo((function(){return xe(c,p+"return "+d).apply(e,l)}));if(g.source=d,Ys(g))throw g;return g},Rn.times=function(e,t){if((e=ho(e))<1||e>o)return[];var n=l,r=gn(e,l);t=ia(t),e-=l;for(var i=Ht(r,t);++n<e;)t(n);return i},Rn.toFinite=uo,Rn.toInteger=ho,Rn.toLength=fo,Rn.toLower=function(e){return go(e).toLowerCase()},Rn.toNumber=po,Rn.toSafeInteger=function(e){return e?ir(ho(e),-9007199254740991,o):0===e?e:0},Rn.toString=go,Rn.toUpper=function(e){return go(e).toUpperCase()},Rn.trim=function(t,n,r){if((t=go(t))&&(r||n===e))return Ut(t);if(!t||!(n=ai(n)))return t;var i=sn(t),a=sn(n);return vi(i,$t(i,a),Kt(i,a)+1).join("")},Rn.trimEnd=function(t,n,r){if((t=go(t))&&(r||n===e))return t.slice(0,on(t)+1);if(!t||!(n=ai(n)))return t;var i=sn(t);return vi(i,0,Kt(i,sn(n))+1).join("")},Rn.trimStart=function(t,n,r){if((t=go(t))&&(r||n===e))return t.replace(J,"");if(!t||!(n=ai(n)))return t;var i=sn(t);return vi(i,$t(i,sn(n))).join("")},Rn.truncate=function(t,n){var r=30,i="...";if(Xs(n)){var a="separator"in n?n.separator:a;r="length"in n?ho(n.length):r,i="omission"in n?ai(n.omission):i}var s=(t=go(t)).length;if(Jt(t)){var o=sn(t);s=o.length}if(r>=s)return t;var c=r-an(i);if(c<1)return i;var l=o?vi(o,0,c).join(""):t.slice(0,c);if(a===e)return l+i;if(o&&(c+=l.length-c),no(a)){if(t.slice(c).search(a)){var u,h=l;for(a.global||(a=Ce(a.source,go(ce.exec(a))+"g")),a.lastIndex=0;u=a.exec(h);)var d=u.index;l=l.slice(0,d===e?c:d)}}else if(t.indexOf(ai(a),c)!=c){var f=l.lastIndexOf(a);f>-1&&(l=l.slice(0,f))}return l+i},Rn.unescape=function(e){return(e=go(e))&&H.test(e)?e.replace(j,cn):e},Rn.uniqueId=function(e){var t=++Oe;return go(e)+t},Rn.upperCase=Yo,Rn.upperFirst=$o,Rn.each=ms,Rn.eachRight=gs,Rn.first=Ha,ac(Rn,(mc={},vr(Rn,(function(e,t){De.call(Rn.prototype,t)||(mc[t]=e)})),mc),{chain:!1}),Rn.VERSION="4.17.21",wt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Rn[e].placeholder=Rn})),wt(["drop","take"],(function(t,n){jn.prototype[t]=function(r){r=r===e?1:mn(ho(r),0);var i=this.__filtered__&&!n?new jn(this):this.clone();return i.__filtered__?i.__takeCount__=gn(r,i.__takeCount__):i.__views__.push({size:gn(r,l),type:t+(i.__dir__<0?"Right":"")}),i},jn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),wt(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;jn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:ia(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),wt(["head","last"],(function(e,t){var n="take"+(t?"Right":"");jn.prototype[e]=function(){return this[n](1).value()[0]}})),wt(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");jn.prototype[e]=function(){return this.__filtered__?new jn(this):this[n](1)}})),jn.prototype.compact=function(){return this.filter(tc)},jn.prototype.find=function(e){return this.filter(e).head()},jn.prototype.findLast=function(e){return this.reverse().find(e)},jn.prototype.invokeMap=Wr((function(e,t){return"function"==typeof e?new jn(this):this.map((function(n){return Er(n,e,t)}))})),jn.prototype.reject=function(e){return this.filter(Ns(ia(e)))},jn.prototype.slice=function(t,n){t=ho(t);var r=this;return r.__filtered__&&(t>0||n<0)?new jn(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),n!==e&&(r=(n=ho(n))<0?r.dropRight(-n):r.take(n-t)),r)},jn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},jn.prototype.toArray=function(){return this.take(l)},vr(jn.prototype,(function(t,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),i=/^(?:head|last)$/.test(n),a=Rn[i?"take"+("last"==n?"Right":""):n],s=i||/^find/.test(n);a&&(Rn.prototype[n]=function(){var n=this.__wrapped__,o=i?[1]:arguments,c=n instanceof jn,l=o[0],u=c||js(n),h=function(e){var t=a.apply(Rn,Tt([e],o));return i&&d?t[0]:t};u&&r&&"function"==typeof l&&1!=l.length&&(c=u=!1);var d=this.__chain__,f=!!this.__actions__.length,p=s&&!d,m=c&&!f;if(!s&&u){n=m?n:new jn(this);var g=t.apply(n,o);return g.__actions__.push({func:us,args:[h],thisArg:e}),new zn(g,d)}return p&&m?t.apply(this,o):(g=this.thru(h),p?i?g.value()[0]:g.value():g)})})),wt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Te[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Rn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(js(i)?i:[],e)}return this[n]((function(n){return t.apply(js(n)?n:[],e)}))}})),vr(jn.prototype,(function(e,t){var n=Rn[t];if(n){var r=n.name+"";De.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Bi(e,2).name]=[{name:"wrapper",func:e}],jn.prototype.clone=function(){var e=new jn(this.__wrapped__);return e.__actions__=Ci(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ci(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ci(this.__views__),e},jn.prototype.reverse=function(){if(this.__filtered__){var e=new jn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},jn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=js(e),r=t<0,i=n?e.length:0,a=function(e,t,n){for(var r=-1,i=n.length;++r<i;){var a=n[r],s=a.size;switch(a.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=gn(t,e+s);break;case"takeRight":e=mn(e,t-s)}}return{start:e,end:t}}(0,i,this.__views__),s=a.start,o=a.end,c=o-s,l=r?o:s-1,u=this.__iteratees__,h=u.length,d=0,f=gn(c,this.__takeCount__);if(!n||!r&&i==c&&f==c)return ui(e,this.__actions__);var p=[];e:for(;c--&&d<f;){for(var m=-1,g=e[l+=t];++m<h;){var v=u[m],y=v.iteratee,b=v.type,_=y(g);if(2==b)g=_;else if(!_){if(1==b)continue e;break e}}p[d++]=g}return p},Rn.prototype.at=hs,Rn.prototype.chain=function(){return ls(this)},Rn.prototype.commit=function(){return new zn(this.value(),this.__chain__)},Rn.prototype.next=function(){this.__values__===e&&(this.__values__=lo(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?e:this.__values__[this.__index__++]}},Rn.prototype.plant=function(t){for(var n,r=this;r instanceof Fn;){var i=Ba(r);i.__index__=0,i.__values__=e,n?a.__wrapped__=i:n=i;var a=i;r=r.__wrapped__}return a.__wrapped__=t,n},Rn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof jn){var n=t;return this.__actions__.length&&(n=new jn(this)),(n=n.reverse()).__actions__.push({func:us,args:[Xa],thisArg:e}),new zn(n,this.__chain__)}return this.thru(Xa)},Rn.prototype.toJSON=Rn.prototype.valueOf=Rn.prototype.value=function(){return ui(this.__wrapped__,this.__actions__)},Rn.prototype.first=Rn.prototype.head,at&&(Rn.prototype[at]=function(){return this}),Rn}();lt?((lt.exports=ln)._=ln,ct._=ln):ot._=ln}.call(Ii.exports)),Ii.exports));function Di(e,t){return Math.floor(Math.random()*(t-e+1))+e}function Oi(e){return Math.cos(Bi(e))}function Li(e){return Math.sin(Bi(e))}function Bi(e){return e/360*2*Math.PI}const Ri=n({name:"FillInView",components:{MarkdownRenderer:r((()=>import("@vue-skuilder/common-ui").then((e=>e.MarkdownRenderer)))),RadioMultipleChoice:O,AudioAutoPlayer:D},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"FillInView"),r=B(n);r.question.value=new Wi(e.data);const i=a(),s=o((()=>{if(!r.question.value)throw n.logger.error("Question not initialized"),new Error("Question not initialized");return r.question.value}));c((()=>{try{if(r.question.value||(r.question.value=new Wi(e.data)),r.question.value.options){const e=_();i.value=Ni.shuffle(e)}}catch(t){n.logger.error("Failed to initialize question:",t)}})),l((()=>{r.question.value=void 0}));const h=o((()=>i.value??[])),d=o((()=>!!e.data[0]["image-1"])),f=o((()=>{if(!d.value)return[""];const t=[];let n=1;for(;e.data[0][`image-${n}`];)t.push(URL.createObjectURL(e.data[0][`image-${n}`])),n++;return t})),p=o((()=>!!e.data[0]["audio-1"])),m=o((()=>s.value?.mdText||"")),g=o((()=>{if(!p.value)return[""];const t=[];let n=1;for(;e.data[0][`audio-${n}`];)t.push(URL.createObjectURL(e.data[0][`audio-${n}`])),n++;return t})),v=o((()=>{if(s.value.answers)return s.value.answers[Math.floor(s.value.answers.length*Math.random())];throw new Error("No answers provided")})),y=o((()=>{const e=v.value;if(console.log(`Prior answers: ${r.priorAnswers.value}`),e&&r.priorAnswers.value[0]?.[0]&&"UserInputString"===r.priorAnswers.value[0][1])return function(e,t){const n=new Array(t.length).fill("_"),r=e.split("");console.log(e,t),console.log("Attempt char codes:",e.split("").map((e=>e.charCodeAt(0)))),console.log("Answer char codes:",t.split("").map((e=>e.charCodeAt(0))));for(let i=0;i<t.length;i++)i<r.length&&r[i]===t[i]&&(n[i]=r[i],r[i]="");for(let i=t.length-1;i>=0;i--)if("_"===n[i]){const e=r.findIndex((e=>e===t[i]));-1!==e&&(n[i]=t[i],r[e]="")}return console.log(n.join(" ")),n.join(" ")}(r.priorAnswers.value[0][0],e);if(console.log("found no UserInputString"),v.value){let e="";for(let t=0;t<v.value.length;t++)e+="_ ";return e}return""})),b=o((()=>!!(s.value.answers&&s.value.answers.length>0))),_=()=>{if(!s.value?.options)return;if(s.value.options.length<=6)return s.value.options;const t=[];t.push(s.value.answers[Math.floor(Math.random()*s.value.answers.length)]);let n=Ni.shuffle(s.value.options.filter((e=>-1===s.value.answers?.indexOf(e))));return e.modifyDifficulty&&(console.log(`Modifying difficulty: ${e.modifyDifficulty}`),n=e.modifyDifficulty<-200?n.slice(0,1):e.modifyDifficulty<-150?n.slice(0,2):e.modifyDifficulty<-100?n.slice(0,3):e.modifyDifficulty<-50?n.slice(0,4):n.slice(0,5)),t.push(...n.slice(0,5)),t};return u((()=>e.data),(e=>{try{if(r.question.value=new Wi(e),r.question.value?.options){const e=_();i.value=Ni.shuffle(e)}}catch(t){n.logger.error("Failed to initialize/update question:",t)}}),{deep:!0}),{...n,...r,question:s,truncatedOptions:h,hasImage:d,imageURLs:f,hasAudio:p,audioURL:g,obscuredAnswer:y,someAnswer:v,isQuestion:b,handleNext:()=>{r.submitAnswer("")},markdownText:m}}}),Vi=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},Fi={"data-viewable":"FillInView"},zi=["src"],ji={key:4,class:"text-center text-h6"},qi={key:5,class:"text-center text-h6"},Hi=/* @__PURE__ */Vi(Ri,[["render",function(e,t,n,r,i,a){const s=w("audio-auto-player"),o=w("markdown-renderer"),c=w("radio-multiple-choice"),l=w("v-spacer"),u=w("v-btn"),h=w("v-card-actions");return p(),f("div",Fi,[e.hasAudio?(p(),E(s,{key:0,src:e.audioURL},null,8,["src"])):g("",!0),e.hasImage?(p(!0),f(b,{key:1},_(e.imageURLs,((e,t)=>(p(),f("img",{key:t,src:e},null,8,zi)))),128)):g("",!0),e.markdownText?(p(),E(o,{key:2,md:e.markdownText},null,8,["md"])):g("",!0),e.question?.options?(p(),E(c,{key:3,"choice-list":e.truncatedOptions},null,8,["choice-list"])):1==e.priorAttempts?(p(),f("div",ji,[m("span",null,y(e.obscuredAnswer),1)])):2==e.priorAttempts?(p(),f("div",qi,[m("span",null,y(e.someAnswer),1)])):g("",!0),e.isQuestion?g("",!0):(p(),E(h,{key:6},{default:T((()=>[x(l),x(u,{color:"primary",autofocus:"autofocus",onClick:e.handleNext},{default:T((()=>t[0]||(t[0]=[k(" Next ")]))),_:1},8,["onClick"])])),_:1}))])}],["__scopeId","data-v-26a1bfdf"]]);function Ui(e,t,n){const r=e.split(t),i=r[0],a=r[1].split(n);return{left:i,middle:a[0],right:a[1]}}const Gi=class _BlanksCard extends R{constructor(e){super(e),t(this,"mdText",""),t(this,"answers",null),t(this,"options",null),this.mdText=e[0].Input,void 0===this.mdText&&(this.mdText="");const n=F(this.mdText,"{{","}}"),r=[];for(let t=0;t<n.length;t++){const e=n[t],i=e.trim();if(i.startsWith("{{")&&i.endsWith("}}")){const t=i.slice(2,-2).trim();if(z(t))r.push(e);else try{const t=this.optionsFromString(e);this.answers=t.answers,this.options=t.options,this.options?.length?r.push("{{ || }}"):r.push("{{ }}")}catch{r.push(e)}}else r.push(e)}this.mdText=r.join("")}splitTextToken(e){if(V(e)){const t=Ui(e.text,"{{","}}"),n=Ui(e.raw,"{{","}}"),r=[];return n.left.length>0&&r.push({type:"text",raw:n.left,text:t.left}),n.middle.length>0&&r.push({type:"text",raw:"{{"+n.middle+"}}",text:"{{"+t.middle+"}}"}),n.right.length>0&&r.push({type:"text",raw:n.right,text:t.right}),r}return[e]}optionsFromString(e){if(!e.startsWith("{{")||!e.endsWith("}}"))throw new Error(`string ${e} is not fill-in text - must look like "{{someText}}"`);const t=(e=e.substring(2,e.length-2)).split("||");if(t.length>1){const e=t[0].split("|").map((e=>e.trim())),n=t[1].split("|").map((e=>e.trim())).filter((t=>!e.includes(t)));return n.push(e[Di(0,e.length-1)]),{answers:e,options:Ni.shuffle(n)}}return{answers:[e.trim()],options:null}}isCorrect(e){if(console.log(`answers:${this.answers}\nuser answer: ${JSON.stringify(e)}`),"string"==typeof e){if(this.answers)return this.answers.includes(e);if(""===e)return!0;throw new Error("Question has no configured answers!")}if(Array.isArray(e)){if(this.answers)return e.every((e=>this.answers.includes(e)));throw new Error("Question has no configured answers!")}return this.isCorrectRadio(e)}dataShapes(){return _BlanksCard.dataShapes}views(){return _BlanksCard.views}isCorrectRadio(e){return!!this.answers&&this.answers.includes(e.choiceList[e.selection])}};t(Gi,"dataShapes",de),t(Gi,"views",[Hi]);let Wi=Gi;class CourseWare{constructor(e,n){t(this,"name"),t(this,"questionList"),this.name=e,this.questionList=n,this.questionList=this.questionList.concat(this.getBaseQTypes())}get questions(){return this.questionList}get allViews(){const e=new Array;return this.questionList.forEach((t=>{t.views.forEach((t=>{e.push(t)}))})),e}get allViewsMap(){const e={};return this.allViews.forEach((t=>{if(!t.name)throw new Error("View has no name");e[t.name]=t})),e}getQuestion(e){return this.questionList.find((t=>{const n=t.name.replace(/^_/,"").replace(/\d+$/,""),r=e.replace(/^_/,"").replace(/\d+$/,"");return t.name===e||n===r||t.name.includes(r)||e.includes(n)}))}getBaseQTypes(){return[Wi]}}const Yi=new CourseWare("default",[Wi]),$i=["cg-white","cg-black"],Ki=["a","b","c","d","e","f","g","h"],Qi=["1","2","3","4","5","6","7","8"],Xi=[...Qi].reverse(),Zi=Array.prototype.concat(...Ki.map((e=>Qi.map((t=>e+t))))),Ji=e=>Zi[8*e[0]+e[1]],ea=e=>[e.charCodeAt(0)-97,e.charCodeAt(1)-49],ta=Zi.map(ea),na=()=>{let e;return{start(){e=performance.now()},cancel(){e=void 0},stop(){if(!e)return 0;const t=performance.now()-e;return e=void 0,t}}},ra=e=>"cg-white"===e?"cg-black":"cg-white",ia=(e,t)=>{const n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r},aa=(e,t)=>e.role===t.role&&e.color===t.color,sa=e=>(t,n)=>[(n?t[0]:7-t[0])*e.width/8,(n?7-t[1]:t[1])*e.height/8],oa=(e,t)=>{e.style.transform=`translate(${t[0]}px,${t[1]}px)`},ca=(e,t,n=1)=>{e.style.transform=`translate(${t[0]}px,${t[1]}px) scale(${n})`},la=(e,t)=>{e.style.visibility=t?"visible":"hidden"},ua=e=>e.clientX||0===e.clientX?[e.clientX,e.clientY]:e.targetTouches?.[0]?[e.targetTouches[0].clientX,e.targetTouches[0].clientY]:void 0,ha=e=>2===e.button,da=(e,t)=>{const n=document.createElement(e);return t&&(n.className=t),n};function fa(e,t,n){const r=ea(e);return t||(r[0]=7-r[0],r[1]=7-r[1]),[n.left+n.width*r[0]/8+n.width/16,n.top+n.height*(7-r[1])/8+n.height/16]}const pa=(e,t)=>Math.abs(e-t),ma=(e,t,n,r)=>{const i=pa(e,n),a=pa(t,r);return 1===i&&2===a||2===i&&1===a},ga=(e,t,n,r)=>pa(e,n)===pa(t,r),va=(e,t,n,r)=>e===n||t===r,ya=(e,t,n,r)=>ga(e,t,n,r)||va(e,t,n,r);function ba(e,t,n){const r=e.get(t);if(!r)return[];const i=ea(t),a=r.role,s="pawn"===a?(o=r.color,(e,t,n,r)=>pa(e,n)<2&&("cg-white"===o?r===t+1||t<=1&&r===t+2&&e===n:r===t-1||t>=6&&r===t-2&&e===n)):"knight"===a?ma:"bishop"===a?ga:"rook"===a?va:"queen"===a?ya:/* @__PURE__ */((e,t,n)=>(r,i,a,s)=>pa(r,a)<2&&pa(i,s)<2||n&&i===s&&i===("cg-white"===e?0:7)&&(4===r&&(2===a&&t.includes(0)||6===a&&t.includes(7))||t.includes(a)))(r.color,function(e,t){const n="cg-white"===t?"1":"8",r=[];for(const[i,a]of e)i[1]===n&&a.color===t&&"rook"===a.role&&r.push(ea(i)[0]);return r}(e,r.color),n);var o;return ta.filter((e=>(i[0]!==e[0]||i[1]!==e[1])&&s(i[0],i[1],e[0],e[1]))).map(Ji)}function _a(e,...t){e&&setTimeout((()=>e(...t)),1)}function wa(e){e.premovable.current&&(e.premovable.current=void 0,_a(e.premovable.events.unset))}function xa(e){const t=e.predroppable;t.current&&(t.current=void 0,_a(t.events.unset))}function ka(e,t,n){const r=e.pieces.get(t),i=e.pieces.get(n);if(t===n||!r)return!1;const a=i&&i.color!==r.color?i:void 0;return n===e.selected&&Pa(e),_a(e.events.move,t,n,a),function(e,t,n){if(!e.autoCastle)return!1;const r=e.pieces.get(t);if(!r||"king"!==r.role)return!1;const i=ea(t),a=ea(n);if(0!==i[1]&&7!==i[1]||i[1]!==a[1])return!1;4!==i[0]||e.pieces.has(n)||(6===a[0]?n=Ji([7,a[1]]):2===a[0]&&(n=Ji([0,a[1]])));const s=e.pieces.get(n);return!(!s||s.color!==r.color||"rook"!==s.role||(e.pieces.delete(t),e.pieces.delete(n),i[0]<a[0]?(e.pieces.set(Ji([6,a[1]]),r),e.pieces.set(Ji([5,a[1]]),s)):(e.pieces.set(Ji([2,a[1]]),r),e.pieces.set(Ji([3,a[1]]),s)),0))}(e,t,n)||(e.pieces.set(n,r),e.pieces.delete(t)),e.lastMove=[t,n],e.check=void 0,_a(e.events.change),a||!0}function Sa(e,t,n,r){if(e.pieces.has(n)){if(!r)return!1;e.pieces.delete(n)}return _a(e.events.dropNewPiece,t,n),e.pieces.set(n,t),e.lastMove=[n],e.check=void 0,_a(e.events.change),e.movable.dests=void 0,e.turnColor=ra(e.turnColor),!0}function Ca(e,t,n){const r=ka(e,t,n);return r&&(e.movable.dests=void 0,e.turnColor=ra(e.turnColor),e.animation.current=void 0),r}function Ma(e,t,n){if(Na(e,t,n)){const r=Ca(e,t,n);if(r){const i=e.hold.stop();Pa(e);const a={premove:!1,ctrlKey:e.stats.ctrlKey,holdTime:i};return!0!==r&&(a.captured=r),_a(e.movable.events.after,t,n,a),!0}}else if(function(e,t,n){const r=e.premovable.customDests?.get(t)??ba(e.pieces,t,e.premovable.castle);return t!==n&&Da(e,t)&&r.includes(n)}(e,t,n))return r=e,i=t,a=n,s={ctrlKey:e.stats.ctrlKey},xa(r),r.premovable.current=[i,a],_a(r.premovable.events.set,i,a,s),Pa(e),!0;var r,i,a,s;return Pa(e),!1}function Ea(e,t,n,r){const i=e.pieces.get(t);var a,s,o;i&&(function(e,t,n){const r=e.pieces.get(t);return!(!r||t!==n&&e.pieces.has(n)||"both"!==e.movable.color&&(e.movable.color!==r.color||e.turnColor!==r.color))}(e,t,n)||r)?(e.pieces.delete(t),Sa(e,i,n,r),_a(e.movable.events.afterNewPiece,i.role,n,{premove:!1,predrop:!1})):i&&function(e,t,n){const r=e.pieces.get(t),i=e.pieces.get(n);return!!r&&(!i||i.color!==e.movable.color)&&e.predroppable.enabled&&("pawn"!==r.role||"1"!==n[1]&&"8"!==n[1])&&e.movable.color===r.color&&e.turnColor!==r.color}(e,t,n)?(a=e,s=i.role,o=n,wa(a),a.predroppable.current={role:s,key:o},_a(a.predroppable.events.set,s,o)):(wa(e),xa(e)),e.pieces.delete(t),Pa(e)}function Ta(e,t,n){if(_a(e.events.select,t),e.selected){if(e.selected===t&&!e.draggable.enabled)return Pa(e),void e.hold.cancel();if((e.selectable.enabled||n)&&e.selected!==t&&Ma(e,e.selected,t))return void(e.stats.dragged=!1)}(e.selectable.enabled||e.draggable.enabled)&&(Ia(e,t)||Da(e,t))&&(Aa(e,t),e.hold.start())}function Aa(e,t){e.selected=t,Da(e,t)?e.premovable.customDests||(e.premovable.dests=ba(e.pieces,t,e.premovable.castle)):e.premovable.dests=void 0}function Pa(e){e.selected=void 0,e.premovable.dests=void 0,e.hold.cancel()}function Ia(e,t){const n=e.pieces.get(t);return!!n&&("both"===e.movable.color||e.movable.color===n.color&&e.turnColor===n.color)}const Na=(e,t,n)=>t!==n&&Ia(e,t)&&(e.movable.free||!!e.movable.dests?.get(t)?.includes(n));function Da(e,t){const n=e.pieces.get(t);return!!n&&e.premovable.enabled&&e.movable.color===n.color&&e.turnColor!==n.color}function Oa(e){const t=e.premovable.current;if(!t)return!1;const n=t[0],r=t[1];let i=!1;if(Na(e,n,r)){const t=Ca(e,n,r);if(t){const a={premove:!0};!0!==t&&(a.captured=t),_a(e.movable.events.after,n,r,a),i=!0}}return wa(e),i}function La(e){wa(e),xa(e),Pa(e)}function Ba(e){e.movable.color=e.movable.dests=e.animation.current=void 0,La(e)}function Ra(e,t,n){let r=Math.floor(8*(e[0]-n.left)/n.width);t||(r=7-r);let i=7-Math.floor(8*(e[1]-n.top)/n.height);return t||(i=7-i),r>=0&&r<8&&i>=0&&i<8?Ji([r,i]):void 0}const Va=e=>"cg-white"===e.orientation,Fa="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR",za={p:"pawn",r:"rook",n:"knight",b:"bishop",q:"queen",k:"king"},ja={pawn:"p",rook:"r",knight:"n",bishop:"b",queen:"q",king:"k"};function qa(e){"start"===e&&(e=Fa);const t=/* @__PURE__ */new Map;let n=7,r=0;for(const i of e)switch(i){case" ":case"[":return t;case"/":if(--n,n<0)return t;r=0;break;case"~":{const e=t.get(Ji([r-1,n]));e&&(e.promoted=!0);break}default:{const e=i.charCodeAt(0);if(e<57)r+=e-48;else{const e=i.toLowerCase();t.set(Ji([r,n]),{role:za[e],color:i===e?"cg-black":"cg-white"}),++r}}}return t}function Ha(e,t){t.animation&&(Ga(e.animation,t.animation),(e.animation.duration||0)<70&&(e.animation.enabled=!1))}function Ua(e,t){if(t.movable?.dests&&(e.movable.dests=void 0),t.drawable?.autoShapes&&(e.drawable.autoShapes=[]),Ga(e,t),t.fen&&(e.pieces=qa(t.fen),e.drawable.shapes=t.drawable?.shapes||[]),"check"in t&&function(e,t){if(e.check=void 0,!0===t&&(t=e.turnColor),t)for(const[n,r]of e.pieces)"king"===r.role&&r.color===t&&(e.check=n)}(e,t.check||!1),"lastMove"in t&&!t.lastMove?e.lastMove=void 0:t.lastMove&&(e.lastMove=t.lastMove),e.selected&&Aa(e,e.selected),Ha(e,t),!e.movable.rookCastle&&e.movable.dests){const t="cg-white"===e.movable.color?"1":"8",n="e"+t,r=e.movable.dests.get(n),i=e.pieces.get(n);if(!r||!i||"king"!==i.role)return;e.movable.dests.set(n,r.filter((e=>!(e==="a"+t&&r.includes("c"+t)||e==="h"+t&&r.includes("g"+t)))))}}function Ga(e,t){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)&&Wa(e[n])&&Wa(t[n])?Ga(e[n],t[n]):e[n]=t[n])}function Wa(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const Ya=(e,t)=>t.animation.enabled?function(e,t){const n=new Map(t.pieces),r=e(t),i=function(e,t){const n=/* @__PURE__ */new Map,r=[],i=/* @__PURE__ */new Map,a=[],s=[],o=/* @__PURE__ */new Map;let c,l,u;for(const[h,d]of e)o.set(h,Ka(h,d));for(const h of Zi)c=t.pieces.get(h),l=o.get(h),c?l?aa(c,l.piece)||(a.push(l),s.push(Ka(h,c))):s.push(Ka(h,c)):l&&a.push(l);for(const h of s)l=Qa(h,a.filter((e=>aa(h.piece,e.piece)))),l&&(u=[l.pos[0]-h.pos[0],l.pos[1]-h.pos[1]],n.set(h.key,u.concat(u)),r.push(l.key));for(const h of a)r.includes(h.key)||i.set(h.key,h.piece);return{anims:n,fadings:i}}(n,t);if(i.anims.size||i.fadings.size){const e=t.animation.current&&t.animation.current.start;t.animation.current={start:performance.now(),frequency:1/t.animation.duration,plan:i},e||Xa(t,performance.now())}else t.dom.redraw();return r}(e,t):$a(e,t);function $a(e,t){const n=e(t);return t.dom.redraw(),n}const Ka=(e,t)=>({key:e,pos:ea(e),piece:t}),Qa=(e,t)=>t.sort(((t,n)=>ia(e.pos,t.pos)-ia(e.pos,n.pos)))[0];function Xa(e,t){const n=e.animation.current;if(void 0===n)return void(e.dom.destroyed||e.dom.redrawNow());const r=1-(t-n.start)*n.frequency;if(r<=0)e.animation.current=void 0,e.dom.redrawNow();else{const t=Za(r);for(const e of n.plan.anims.values())e[2]=e[0]*t,e[3]=e[1]*t;e.dom.redrawNow(!0),requestAnimationFrame(((t=performance.now())=>Xa(e,t)))}}const Za=e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,Ja=["green","red","blue","yellow"];function es(e,t){if(t.touches&&t.touches.length>1)return;t.stopPropagation(),t.preventDefault(),t.ctrlKey?Pa(e):La(e);const n=ua(t),r=Ra(n,Va(e),e.dom.bounds());r&&(e.drawable.current={orig:r,pos:n,brush:as(t),snapToValidMove:e.drawable.defaultSnapToValidMove},ts(e))}function ts(e){requestAnimationFrame((()=>{const t=e.drawable.current;if(t){const n=Ra(t.pos,Va(e),e.dom.bounds());n||(t.snapToValidMove=!1);const r=t.snapToValidMove?function(e,t,n,r){const i=ea(e),a=ta.filter((e=>ya(i[0],i[1],e[0],e[1])||ma(i[0],i[1],e[0],e[1]))),s=a.map((e=>fa(Ji(e),n,r))).map((e=>ia(t,e))),[,o]=s.reduce(((e,t,n)=>e[0]<t?e:[t,n]),[s[0],0]);return Ji(a[o])}(t.orig,t.pos,Va(e),e.dom.bounds()):n;r!==t.mouseSq&&(t.mouseSq=r,t.dest=r!==t.orig?r:void 0,e.dom.redrawNow()),ts(e)}}))}function ns(e,t){e.drawable.current&&(e.drawable.current.pos=ua(t))}function rs(e){const t=e.drawable.current;t&&(t.mouseSq&&function(e,t){const n=e=>e.orig===t.orig&&e.dest===t.dest,r=e.shapes.find(n);r&&(e.shapes=e.shapes.filter((e=>!n(e)))),r&&r.brush===t.brush||e.shapes.push({orig:t.orig,dest:t.dest,brush:t.brush}),ss(e)}(e.drawable,t),is(e))}function is(e){e.drawable.current&&(e.drawable.current=void 0,e.dom.redraw())}function as(e){const t=(e.shiftKey||e.ctrlKey)&&ha(e),n=e.altKey||e.metaKey||e.getModifierState?.("AltGraph");return Ja[(t?1:0)+(n?2:0)]}function ss(e){e.onChange&&e.onChange(e.shapes)}function os(e){requestAnimationFrame((()=>{const t=e.draggable.current;if(!t)return;e.animation.current?.plan.anims.has(t.orig)&&(e.animation.current=void 0);const n=e.pieces.get(t.orig);if(n&&aa(n,t.piece)){if(!t.started&&ia(t.pos,t.origPos)>=Math.pow(e.draggable.distance,2)&&(t.started=!0),t.started){if("function"==typeof t.element){const e=t.element();if(!e)return;e.cgDragging=!0,e.classList.add("dragging"),t.element=e}const n=e.dom.bounds();oa(t.element,[t.pos[0]-n.left-n.width/16,t.pos[1]-n.top-n.height/16]),t.keyHasChanged=t.keyHasChanged||t.orig!==Ra(t.pos,Va(e),n)}}else us(e);os(e)}))}function cs(e,t){e.draggable.current&&(!t.touches||t.touches.length<2)&&(e.draggable.current.pos=ua(t))}function ls(e,t){const n=e.draggable.current;if(!n)return;if("touchend"===t.type&&!1!==t.cancelable&&t.preventDefault(),"touchend"===t.type&&n.originTarget!==t.target&&!n.newPiece)return void(e.draggable.current=void 0);wa(e),xa(e);const r=Ra(ua(t)||n.pos,Va(e),e.dom.bounds());r&&n.started&&n.orig!==r?n.newPiece?Ea(e,n.orig,r,n.force):(e.stats.ctrlKey=t.ctrlKey,Ma(e,n.orig,r)&&(e.stats.dragged=!0)):n.newPiece?e.pieces.delete(n.orig):e.draggable.deleteOnDropOff&&!r&&(e.pieces.delete(n.orig),_a(e.events.change)),(n.orig!==n.previouslySelected&&!n.keyHasChanged||n.orig!==r&&r)&&e.selectable.enabled||Pa(e),hs(e),e.draggable.current=void 0,e.dom.redraw()}function us(e){const t=e.draggable.current;t&&(t.newPiece&&e.pieces.delete(t.orig),e.draggable.current=void 0,Pa(e),hs(e),e.dom.redraw())}function hs(e){const t=e.dom.elements;t.ghost&&la(t.ghost,!1)}function ds(e,t){let n=e.dom.elements.board.firstChild;for(;n;){if(n.cgKey===t&&"PIECE"===n.tagName)return n;n=n.nextSibling}}function fs(e,t){e.exploding&&(t?e.exploding.stage=t:e.exploding=void 0,e.dom.redraw())}const ps={hilitePrimary:{key:"hilitePrimary",color:"#3291ff",opacity:1,lineWidth:1},hiliteWhite:{key:"hiliteWhite",color:"#ffffff",opacity:1,lineWidth:1}};function ms({orig:e,dest:t,brush:n,piece:r,modifiers:i,customSvg:a,label:s},o,c,l){return[l.width,l.height,c,e,t,n,o&&"-",r&&gs(r),i&&(u=i,[u.lineWidth,u.hilite&&"*"].filter((e=>e)).join(",")),a&&`custom-${vs(a.html)},${a.center?.[0]??"o"}`,s&&`label-${vs(s.text)}`].filter((e=>e)).join(",");var u}function gs(e){return[e.color,e.role,e.scale].filter((e=>e)).join(",")}function vs(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)>>>0;return t.toString()}function ys(e){return["#ffffff","#fff","white"].includes(e.color)?ps.hilitePrimary:ps.hiliteWhite}function bs(e){const t=Ss(ks("marker"),{id:"arrowhead-"+e.key,orient:"auto",overflow:"visible",markerWidth:4,markerHeight:4,refX:e.key.startsWith("hilite")?1.86:2.05,refY:2});return t.appendChild(Ss(ks("path"),{d:"M0,0 V4 L3,2 Z",fill:e.color})),t.setAttribute("cgKey",e.key),t}function _s(e,t,n,r,i,a){const s=.4*.75**e.text.length,o=Ps(n,r,i),c="tr"===a?.4:0,l=Ss(ks("g"),{transform:`translate(${o[0]+c},${o[1]-c})`,cgHash:t});l.appendChild(Ss(ks("circle"),{r:.2,"fill-opacity":a?1:.8,"stroke-opacity":a?1:.7,"stroke-width":.03,fill:e.fill??"#666",stroke:"white"}));const u=Ss(ks("text"),{"font-size":s,"font-family":"Noto Sans","text-anchor":"middle",fill:"white",y:.13*.75**e.text.length});return u.innerHTML=e.text,l.appendChild(u),l}function ws(e,t){return"cg-white"===t?e:[7-e[0],7-e[1]]}function xs(e,t){return!0===(e&&t.has(e)&&t.get(e).size>1)}function ks(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function Ss(e,t){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.setAttribute(n,t[n]);return e}function Cs(e,t){return t?{color:e.color,opacity:Math.round(10*e.opacity)/10,lineWidth:Math.round(t.lineWidth||e.lineWidth),key:[e.key,t.lineWidth].filter((e=>e)).join("")}:e}function Ms(e,t){return(e.lineWidth||10)*(t?.85:1)/64}function Es(e,t){return(e.opacity||1)*(t?.9:1)}function Ts(e,t){const n=Math.min(1,t.width/t.height),r=Math.min(1,t.height/t.width);return[(e[0]-3.5)*n,(3.5-e[1])*r]}function As(e,t,n=!0){const r=Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI;return n?(Math.round(8*r/Math.PI)+16)%16:r}function Ps(e,t,n){let r=(i=e,a=t,Math.sqrt([i[0]-a[0],i[1]-a[1]].reduce(((e,t)=>e+t*t),0)));var i,a;const s=As(e,t,!1);if(n&&(r-=33/64,n.size>1)){r-=10/64;const i=As(e,t);(n.has((i+1)%16)||n.has((i+15)%16))&&1&i&&(r-=.4)}return[e[0]-Math.cos(s)*r,e[1]-Math.sin(s)*r].map((e=>e+.5))}function Is(e,t){const n=da("coords",t);let r;for(const i of e)r=da("coord"),r.textContent=i,n.appendChild(r);return n}function Ns(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}const Ds=e=>t=>{e.draggable.current?us(e):e.drawable.current?is(e):t.shiftKey||ha(t)?e.drawable.enabled&&es(e,t):e.viewOnly||(e.dropmode.active?function(e,t){if(!e.dropmode.active)return;wa(e),xa(e);const n=e.dropmode.piece;if(n){e.pieces.set("a0",n);const r=ua(t),i=r&&Ra(r,Va(e),e.dom.bounds());i&&Ea(e,"a0",i)}e.dom.redraw()}(e,t):function(e,t){if(!e.trustAllEvents&&!t.isTrusted)return;if(void 0!==t.buttons&&t.buttons>1)return;if(t.touches&&t.touches.length>1)return;const n=e.dom.bounds(),r=ua(t),i=Ra(r,Va(e),n);if(!i)return;const a=e.pieces.get(i),s=e.selected;var o;if(s||!e.drawable.enabled||!e.drawable.eraseOnClick&&a&&a.color===e.turnColor||(o=e).drawable.shapes.length&&(o.drawable.shapes=[],o.dom.redraw(),ss(o.drawable)),!1!==t.cancelable&&(!t.touches||e.blockTouchScroll||a||s||function(e,t){const n=Va(e),r=e.dom.bounds(),i=Math.pow(r.width/8,2);for(const a of e.pieces.keys()){const e=fa(a,n,r);if(ia(e,t)<=i)return!0}return!1}(e,r)))t.preventDefault();else if(t.touches)return;const c=!!e.premovable.current,l=!!e.predroppable.current;e.stats.ctrlKey=t.ctrlKey,e.selected&&Na(e,e.selected,i)?Ya((e=>Ta(e,i)),e):Ta(e,i);const u=e.selected===i,h=ds(e,i);if(a&&h&&u&&function(e,t){const n=e.pieces.get(t);return!!n&&e.draggable.enabled&&("both"===e.movable.color||e.movable.color===n.color&&(e.turnColor===n.color||e.premovable.enabled))}(e,i)){e.draggable.current={orig:i,piece:a,origPos:r,pos:r,started:e.draggable.autoDistance&&e.stats.dragged,element:h,previouslySelected:s,originTarget:t.target,keyHasChanged:!1},h.cgDragging=!0,h.classList.add("dragging");const o=e.dom.elements.ghost;o&&(o.className=`ghost ${a.color} ${a.role}`,oa(o,sa(n)(ea(i),Va(e))),la(o,!0)),os(e)}else c&&wa(e),l&&xa(e);e.dom.redraw()}(e,t))},Os=(e,t,n)=>r=>{e.drawable.current?e.drawable.enabled&&n(e,r):e.viewOnly||t(e,r)};function Ls(e){const t=e.dom.elements.wrap.getBoundingClientRect(),n=e.dom.elements.container,r=t.height/t.width,i=8*Math.floor(t.width*window.devicePixelRatio/8)/window.devicePixelRatio,a=i*r;n.style.width=i+"px",n.style.height=a+"px",e.dom.bounds.clear(),e.addDimensionsCssVarsTo?.style.setProperty("---cg-width",i+"px"),e.addDimensionsCssVarsTo?.style.setProperty("---cg-height",a+"px")}const Bs=e=>"PIECE"===e.tagName,Rs=e=>"SQUARE"===e.tagName;function Vs(e,t){for(const n of t)e.dom.elements.board.removeChild(n)}function Fs(e,t){const n=e[1];return`${t?10-n:3+n}`}const zs=e=>`${e.color} ${e.role}`;function js(e,t,n){const r=e.get(t);r?e.set(t,`${r} ${n}`):e.set(t,n)}function qs(e,t,n){const r=e.get(t);r?r.push(n):e.set(t,[n])}const Hs=e=>[e.orig,e.piece?.role,e.piece?.color,e.piece?.scale].join(",");function Us(e,t){const n={pieces:qa(Fa),orientation:"cg-white",turnColor:"cg-white",coordinates:!0,coordinatesOnSquares:!1,ranksPosition:"right",autoCastle:!0,viewOnly:!1,disableContextMenu:!1,addPieceZIndex:!1,blockTouchScroll:!1,pieceKey:!1,trustAllEvents:!1,highlight:{lastMove:!0,check:!0},animation:{enabled:!0,duration:200},movable:{free:!0,color:"both",showDests:!0,events:{},rookCastle:!0},premovable:{enabled:!0,showDests:!0,castle:!0,events:{}},predroppable:{enabled:!1,events:{}},draggable:{enabled:!0,distance:3,autoDistance:!0,showGhost:!0,deleteOnDropOff:!1},dropmode:{active:!1},selectable:{enabled:!0},stats:{dragged:!("ontouchstart"in window)},events:{},drawable:{enabled:!0,visible:!0,defaultSnapToValidMove:!0,eraseOnClick:!0,shapes:[],autoShapes:[],brushes:{green:{key:"g",color:"#15781B",opacity:1,lineWidth:10},red:{key:"r",color:"#882020",opacity:1,lineWidth:10},blue:{key:"b",color:"#003088",opacity:1,lineWidth:10},yellow:{key:"y",color:"#e68f00",opacity:1,lineWidth:10},paleBlue:{key:"pb",color:"#003088",opacity:.4,lineWidth:15},paleGreen:{key:"pg",color:"#15781B",opacity:.4,lineWidth:15},paleRed:{key:"pr",color:"#882020",opacity:.4,lineWidth:15},paleGrey:{key:"pgr",color:"#4a4a4a",opacity:.35,lineWidth:15},purple:{key:"purple",color:"#68217a",opacity:.65,lineWidth:10},pink:{key:"pink",color:"#ee2080",opacity:.5,lineWidth:10},white:{key:"white",color:"white",opacity:1,lineWidth:10}},prevSvgHash:""},hold:na()};function r(){const t="dom"in n?n.dom.unbind:void 0,r=function(e,t){e.innerHTML="",e.classList.add("cg-wrap");for(const c of $i)e.classList.toggle("orientation-"+c,t.orientation===c);e.classList.toggle("manipulable",!t.viewOnly);const n=da("cg-container");e.appendChild(n);const r=da("cg-board");let i,a,s,o;if(n.appendChild(r),t.drawable.visible&&(i=Ss(ks("svg"),{class:"cg-shapes",viewBox:"-4 -4 8 8",preserveAspectRatio:"xMidYMid slice"}),i.appendChild(function(){const e=ks("defs"),t=Ss(ks("filter"),{id:"cg-filter-blur"});return t.appendChild(Ss(ks("feGaussianBlur"),{stdDeviation:"0.019"})),e.appendChild(t),e}()),i.appendChild(ks("g")),a=Ss(ks("svg"),{class:"cg-custom-svgs",viewBox:"-3.5 -3.5 8 8",preserveAspectRatio:"xMidYMid slice"}),a.appendChild(ks("g")),s=da("cg-auto-pieces"),n.appendChild(i),n.appendChild(a),n.appendChild(s)),t.coordinates){const e="cg-black"===t.orientation?" black":"",r="left"===t.ranksPosition?" left":"";if(t.coordinatesOnSquares){const i="cg-white"===t.orientation?e=>e+1:e=>8-e;Ki.forEach(((t,a)=>n.appendChild(Is(Qi.map((e=>t+e)),"squares rank"+i(a)+e+r))))}else n.appendChild(Is(Qi,"ranks"+e+r)),n.appendChild(Is(Ki,"files"+e))}return t.draggable.enabled&&t.draggable.showGhost&&(o=da("piece","ghost"),la(o,!1),n.appendChild(o)),{board:r,container:n,wrap:e,ghost:o,svg:i,customSvg:a,autoPieces:s}}(e,n),i=function(){let e;const t=()=>(void 0===e&&(e=r.board.getBoundingClientRect()),e);return t.clear=()=>{e=void 0},t}(),a=e=>{(function(e){const t=Va(e),n=sa(e.dom.bounds()),r=e.dom.elements.board,i=e.pieces,a=e.animation.current,s=a?a.plan.anims:/* @__PURE__ */new Map,o=a?a.plan.fadings:/* @__PURE__ */new Map,c=e.draggable.current,l=function(e){const t=/* @__PURE__ */new Map;if(e.lastMove&&e.highlight.lastMove)for(const i of e.lastMove)js(t,i,"last-move");if(e.check&&e.highlight.check&&js(t,e.check,"check"),e.selected&&(js(t,e.selected,"selected"),e.movable.showDests)){const n=e.movable.dests?.get(e.selected);if(n)for(const i of n)js(t,i,"move-dest"+(e.pieces.has(i)?" oc":""));const r=e.premovable.customDests?.get(e.selected)??e.premovable.dests;if(r)for(const i of r)js(t,i,"premove-dest"+(e.pieces.has(i)?" oc":""))}const n=e.premovable.current;if(n)for(const i of n)js(t,i,"current-premove");else e.predroppable.current&&js(t,e.predroppable.current.key,"current-premove");const r=e.exploding;if(r)for(const i of r.keys)js(t,i,"exploding"+r.stage);return e.highlight.custom&&e.highlight.custom.forEach(((e,n)=>{js(t,n,e)})),t}(e),u=/* @__PURE__ */new Set,h=/* @__PURE__ */new Set,d=/* @__PURE__ */new Map,f=/* @__PURE__ */new Map;let p,m,g,v,y,b,_,w,x,k;for(m=r.firstChild;m;){if(p=m.cgKey,Bs(m))if(g=i.get(p),y=s.get(p),b=o.get(p),v=m.cgPiece,!m.cgDragging||c&&c.orig===p||(m.classList.remove("dragging"),oa(m,n(ea(p),t)),m.cgDragging=!1),!b&&m.cgFading&&(m.cgFading=!1,m.classList.remove("fading")),g){if(y&&m.cgAnimating&&v===zs(g)){const e=ea(p);e[0]+=y[2],e[1]+=y[3],m.classList.add("anim"),oa(m,n(e,t))}else m.cgAnimating&&(m.cgAnimating=!1,m.classList.remove("anim"),oa(m,n(ea(p),t)),e.addPieceZIndex&&(m.style.zIndex=Fs(ea(p),t)));v!==zs(g)||b&&m.cgFading?b&&v===zs(b)?(m.classList.add("fading"),m.cgFading=!0):qs(d,v,m):u.add(p)}else qs(d,v,m);else if(Rs(m)){const e=m.className;l.get(p)===e?h.add(p):qs(f,e,m)}m=m.nextSibling}for(const[S,C]of l)if(!h.has(S)){x=f.get(C),k=x&&x.pop();const e=n(ea(S),t);if(k)k.cgKey=S,oa(k,e);else{const t=da("square",C);t.cgKey=S,oa(t,e),r.insertBefore(t,r.firstChild)}}for(const[S,C]of i)if(y=s.get(S),!u.has(S))if(_=d.get(zs(C)),w=_&&_.pop(),w){w.cgKey=S,w.cgFading&&(w.classList.remove("fading"),w.cgFading=!1);const r=ea(S);e.addPieceZIndex&&(w.style.zIndex=Fs(r,t)),y&&(w.cgAnimating=!0,w.classList.add("anim"),r[0]+=y[2],r[1]+=y[3]),oa(w,n(r,t))}else{const i=zs(C),a=da("piece",i),s=ea(S);a.cgPiece=i,a.cgKey=S,y&&(a.cgAnimating=!0,s[0]+=y[2],s[1]+=y[3]),oa(a,n(s,t)),e.addPieceZIndex&&(a.style.zIndex=Fs(s,t)),r.appendChild(a)}for(const S of d.values())Vs(e,S);for(const S of f.values())Vs(e,S)})(s),r.autoPieces&&function(e,t){!function(e,t,n){const r=/* @__PURE__ */new Map,i=[];for(const o of e)r.set(o.hash,!1);let a,s=t.firstElementChild;for(;s;)a=s.getAttribute("cgHash"),r.has(a)?r.set(a,!0):i.push(s),s=s.nextElementSibling;for(const o of i)t.removeChild(o);for(const o of e)r.get(o.hash)||t.appendChild(n(o))}(e.drawable.autoShapes.filter((e=>e.piece)).map((e=>({shape:e,hash:Hs(e),current:!1}))),t,(t=>function(e,{shape:t,hash:n},r){const i=t.orig,a=t.piece?.role,s=t.piece?.color,o=t.piece?.scale,c=da("piece",`${a} ${s}`);return c.setAttribute("cgHash",n),c.cgKey=i,c.cgScale=o,ca(c,sa(r)(ea(i),Va(e)),o),c}(e,t,e.dom.bounds())))}(s,r.autoPieces),!e&&r.svg&&function(e,t,n){const r=e.drawable,i=r.current,a=i&&i.mouseSq?i:void 0,s=/* @__PURE__ */new Map,o=e.dom.bounds(),c=r.autoShapes.filter((e=>!e.piece));for(const d of r.shapes.concat(c).concat(a?[a]:[])){if(!d.dest)continue;const t=s.get(d.dest)??/* @__PURE__ */new Set,n=Ts(ws(ea(d.orig),e.orientation),o),r=Ts(ws(ea(d.dest),e.orientation),o);t.add(As(n,r)),s.set(d.dest,t)}const l=r.shapes.concat(c).map((e=>({shape:e,current:!1,hash:ms(e,xs(e.dest,s),!1,o)})));a&&l.push({shape:a,current:!0,hash:ms(a,xs(a.dest,s),!0,o)});const u=l.map((e=>e.hash)).join(";");if(u===e.drawable.prevSvgHash)return;e.drawable.prevSvgHash=u;const h=t.querySelector("defs");!function(e,t,n){const r=/* @__PURE__ */new Map;let i;for(const o of t.filter((e=>e.shape.dest&&e.shape.brush)))i=Cs(e.brushes[o.shape.brush],o.shape.modifiers),o.shape.modifiers?.hilite&&r.set(ys(i).key,ys(i)),r.set(i.key,i);const a=/* @__PURE__ */new Set;let s=n.firstElementChild;for(;s;)a.add(s.getAttribute("cgKey")),s=s.nextElementSibling;for(const[o,c]of r.entries())a.has(o)||n.appendChild(bs(c))}(r,l,h),function(e,t,n,r){const i=/* @__PURE__ */new Map;for(const a of e)i.set(a.hash,!1);for(const a of[t,n]){const e=[];let t,n=a.firstElementChild;for(;n;)t=n.getAttribute("cgHash"),i.has(t)?i.set(t,!0):e.push(n),n=n.nextElementSibling;for(const r of e)a.removeChild(r)}for(const a of e.filter((e=>!i.get(e.hash))))for(const e of r(a))e.isCustom?n.appendChild(e.el):t.appendChild(e.el)}(l,t.querySelector("g"),n.querySelector("g"),(t=>function(e,{shape:t,current:n,hash:r},i,a,s){const o=Ts(ws(ea(t.orig),e.orientation),s),c=t.dest?Ts(ws(ea(t.dest),e.orientation),s):o,l=t.brush&&Cs(i[t.brush],t.modifiers),u=a.get(t.dest),h=[];if(l){const e=Ss(ks("g"),{cgHash:r});h.push({el:e}),o[0]!==c[0]||o[1]!==c[1]?e.appendChild(function(e,t,n,r,i,a){function s(s){const o=(a&&!i?20:10)/64,c=r[0]-n[0],l=r[1]-n[1],u=Math.atan2(l,c),h=Math.cos(u)*o,d=Math.sin(u)*o;return Ss(ks("line"),{stroke:s?ys(t).color:t.color,"stroke-width":Ms(t,i)+(s?.04:0),"stroke-linecap":"round","marker-end":`url(#arrowhead-${s?ys(t).key:t.key})`,opacity:e.modifiers?.hilite?1:Es(t,i),x1:n[0],y1:n[1],x2:r[0]-h,y2:r[1]-d})}if(!e.modifiers?.hilite)return s(!1);const o=ks("g"),c=Ss(ks("g"),{filter:"url(#cg-filter-blur)"});return c.appendChild(function(e,t){const n={from:[Math.floor(Math.min(e[0],t[0])),Math.floor(Math.min(e[1],t[1]))],to:[Math.ceil(Math.max(e[0],t[0])),Math.ceil(Math.max(e[1],t[1]))]};return Ss(ks("rect"),{x:n.from[0],y:n.from[1],width:n.to[0]-n.from[0],height:n.to[1]-n.from[1],fill:"none",stroke:"none"})}(n,r)),c.appendChild(s(!0)),o.appendChild(c),o.appendChild(s(!1)),o}(t,l,o,c,n,xs(t.dest,a))):e.appendChild(function(e,t,n,r){const i=[3/64,4/64],a=(r.width+r.height)/(4*Math.max(r.width,r.height));return Ss(ks("circle"),{stroke:e.color,"stroke-width":i[n?0:1],fill:"none",opacity:Es(e,n),cx:t[0],cy:t[1],r:a-i[1]/2})}(i[t.brush],o,n,s))}if(t.label){const e=t.label;e.fill||t.brush&&i[t.brush]&&(e.fill=i[t.brush].color);const n=t.brush?void 0:"tr";h.push({el:_s(e,r,o,c,u,n),isCustom:!0})}if(t.customSvg){const e=t.customSvg.center??"orig",[n,i]="label"===e?Ps(o,c,u).map((e=>e-.5)):"dest"===e?c:o,a=Ss(ks("g"),{transform:`translate(${n},${i})`,cgHash:r});a.innerHTML=`<svg width="1" height="1" viewBox="0 0 100 100">${t.customSvg.html}</svg>`,h.push({el:a,isCustom:!0})}return h}(e,t,r.brushes,s,o)))}(s,r.svg,r.customSvg)},s=n;return s.dom={elements:r,bounds:i,redraw:Gs(a),redrawNow:a,unbind:t},s.drawable.prevSvgHash="",Ls(s),a(!1),function(e){const t=e.dom.elements.board;if((e.disableContextMenu||e.drawable.enabled)&&t.addEventListener("contextmenu",(e=>e.preventDefault())),e.viewOnly)return;const n=Ds(e);t.addEventListener("touchstart",n,{passive:!1}),t.addEventListener("mousedown",n,{passive:!1})}(s),t||(s.dom.unbind=function(e){const t=[];if("ResizeObserver"in window||t.push(Ns(document.body,"chessground.resize",(()=>{Ls(s),function(e){const t=Va(e),n=sa(e.dom.bounds());let r=e.dom.elements.board.firstChild;for(;r;)(Bs(r)&&!r.cgAnimating||Rs(r))&&oa(r,n(ea(r.cgKey),t)),r=r.nextSibling}(s),r.autoPieces&&function(e){const t=Va(e),n=sa(e.dom.bounds());let r=e.dom.elements.autoPieces?.firstChild;for(;r;)ca(r,n(ea(r.cgKey),t),r.cgScale),r=r.nextSibling}(s)}))),!e.viewOnly){const n=Os(e,cs,ns),r=Os(e,ls,rs);for(const e of["touchmove","mousemove"])t.push(Ns(document,e,n));for(const e of["touchend","mouseup"])t.push(Ns(document,e,r));const i=()=>e.dom.bounds.clear();t.push(Ns(document,"scroll",i,{capture:!0,passive:!0})),t.push(Ns(window,"resize",i,{passive:!0}))}return()=>t.forEach((e=>e()))}(s)),s.events.insert?.(r),s}return Ua(n,t||{}),function(e,t){function n(){var n;(n=e).orientation=ra(n.orientation),n.animation.current=n.draggable.current=n.selected=void 0,t()}return{set(t){t.orientation&&t.orientation!==e.orientation&&n(),Ha(e,t),(t.fen?Ya:$a)((e=>Ua(e,t)),e)},state:e,getFen:()=>{return t=e.pieces,Xi.map((e=>Ki.map((n=>{const r=t.get(n+e);if(r){let e=ja[r.role];return"cg-white"===r.color&&(e=e.toUpperCase()),r.promoted&&(e+="~"),e}return"1"})).join(""))).join("/").replace(/1{2,}/g,(e=>e.length.toString()));var t},toggleOrientation:n,setPieces(t){Ya((e=>function(e,t){for(const[n,r]of t)r?e.pieces.set(n,r):e.pieces.delete(n)}(e,t)),e)},selectSquare(t,n){t?Ya((e=>Ta(e,t,n)),e):e.selected&&(Pa(e),e.dom.redraw())},move(t,n){Ya((e=>ka(e,t,n)),e)},newPiece(t,n){Ya((e=>Sa(e,t,n)),e)},playPremove(){if(e.premovable.current){if(Ya(Oa,e))return!0;e.dom.redraw()}return!1},playPredrop(t){if(e.predroppable.current){const n=function(e,t){const n=e.predroppable.current;let r=!1;return!!n&&(t(n)&&Sa(e,{role:n.role,color:e.movable.color},n.key)&&(_a(e.movable.events.afterNewPiece,n.role,n.key,{premove:!1,predrop:!0}),r=!0),xa(e),r)}(e,t);return e.dom.redraw(),n}return!1},cancelPremove(){$a(wa,e)},cancelPredrop(){$a(xa,e)},cancelMove(){$a((e=>{La(e),us(e)}),e)},stop(){$a((e=>{Ba(e),us(e)}),e)},explode(t){var n,r;r=t,(n=e).exploding={stage:1,keys:r},n.dom.redraw(),setTimeout((()=>{fs(n,2),setTimeout((()=>fs(n,void 0)),120)}),120)},setAutoShapes(t){$a((e=>e.drawable.autoShapes=t),e)},setShapes(t){$a((e=>e.drawable.shapes=t),e)},getKeyAtDomPos:t=>Ra(t,Va(e),e.dom.bounds()),redrawAll:t,dragNewPiece(t,n,r){!function(e,t,n,r){const i="a0";e.pieces.set(i,t),e.dom.redraw();const a=ua(n);e.draggable.current={orig:i,piece:t,origPos:a,pos:a,started:!0,element:()=>ds(e,i),originTarget:n.target,newPiece:!0,force:!!r,keyHasChanged:!1},os(e)}(e,t,n,r)},destroy(){Ba(e),e.dom.unbind?.(),e.dom.destroyed=!0}}}(r(),r)}function Gs(e){let t=!1;return()=>{t||(t=!0,requestAnimationFrame((()=>{e(),t=!1})))}}const Ws="w",Ys="b",$s="p",Ks="b",Qs="r",Xs="q",Zs="k",Js="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";class Move{constructor(e,n){t(this,"color"),t(this,"from"),t(this,"to"),t(this,"piece"),t(this,"captured"),t(this,"promotion"),t(this,"flags"),t(this,"san"),t(this,"lan"),t(this,"before"),t(this,"after");const{color:r,piece:i,from:a,to:s,flags:o,captured:c,promotion:l}=n,u=bo(a),h=bo(s);this.color=r,this.piece=i,this.from=u,this.to=h,this.san=e._moveToSan(n,e._moves({legal:!0})),this.lan=u+h,this.before=e.fen(),e._makeMove(n),this.after=e.fen(),e._undoMove(),this.flags="";for(const t in ro)ro[t]&o&&(this.flags+=to[t]);c&&(this.captured=c),l&&(this.promotion=l,this.lan+=l)}isCapture(){return this.flags.indexOf(to.CAPTURE)>-1}isPromotion(){return this.flags.indexOf(to.PROMOTION)>-1}isEnPassant(){return this.flags.indexOf(to.EP_CAPTURE)>-1}isKingsideCastle(){return this.flags.indexOf(to.KSIDE_CASTLE)>-1}isQueensideCastle(){return this.flags.indexOf(to.QSIDE_CASTLE)>-1}isBigPawn(){return this.flags.indexOf(to.BIG_PAWN)>-1}}const eo=-1,to={NORMAL:"n",CAPTURE:"c",BIG_PAWN:"b",EP_CAPTURE:"e",PROMOTION:"p",KSIDE_CASTLE:"k",QSIDE_CASTLE:"q"},no=["a8","b8","c8","d8","e8","f8","g8","h8","a7","b7","c7","d7","e7","f7","g7","h7","a6","b6","c6","d6","e6","f6","g6","h6","a5","b5","c5","d5","e5","f5","g5","h5","a4","b4","c4","d4","e4","f4","g4","h4","a3","b3","c3","d3","e3","f3","g3","h3","a2","b2","c2","d2","e2","f2","g2","h2","a1","b1","c1","d1","e1","f1","g1","h1"],ro={NORMAL:1,CAPTURE:2,BIG_PAWN:4,EP_CAPTURE:8,PROMOTION:16,KSIDE_CASTLE:32,QSIDE_CASTLE:64},io={a8:0,b8:1,c8:2,d8:3,e8:4,f8:5,g8:6,h8:7,a7:16,b7:17,c7:18,d7:19,e7:20,f7:21,g7:22,h7:23,a6:32,b6:33,c6:34,d6:35,e6:36,f6:37,g6:38,h6:39,a5:48,b5:49,c5:50,d5:51,e5:52,f5:53,g5:54,h5:55,a4:64,b4:65,c4:66,d4:67,e4:68,f4:69,g4:70,h4:71,a3:80,b3:81,c3:82,d3:83,e3:84,f3:85,g3:86,h3:87,a2:96,b2:97,c2:98,d2:99,e2:100,f2:101,g2:102,h2:103,a1:112,b1:113,c1:114,d1:115,e1:116,f1:117,g1:118,h1:119},ao={b:[16,32,17,15],w:[-16,-32,-17,-15]},so={n:[-18,-33,-31,-14,18,33,31,14],b:[-17,-15,17,15],r:[-16,1,16,-1],q:[-17,-16,-15,1,17,16,15,-1],k:[-17,-16,-15,1,17,16,15,-1]},oo=[20,0,0,0,0,0,0,24,0,0,0,0,0,0,20,0,0,20,0,0,0,0,0,24,0,0,0,0,0,20,0,0,0,0,20,0,0,0,0,24,0,0,0,0,20,0,0,0,0,0,0,20,0,0,0,24,0,0,0,20,0,0,0,0,0,0,0,0,20,0,0,24,0,0,20,0,0,0,0,0,0,0,0,0,0,20,2,24,2,20,0,0,0,0,0,0,0,0,0,0,0,2,53,56,53,2,0,0,0,0,0,0,24,24,24,24,24,24,56,0,56,24,24,24,24,24,24,0,0,0,0,0,0,2,53,56,53,2,0,0,0,0,0,0,0,0,0,0,0,20,2,24,2,20,0,0,0,0,0,0,0,0,0,0,20,0,0,24,0,0,20,0,0,0,0,0,0,0,0,20,0,0,0,24,0,0,0,20,0,0,0,0,0,0,20,0,0,0,0,24,0,0,0,0,20,0,0,0,0,20,0,0,0,0,0,24,0,0,0,0,0,20,0,0,20,0,0,0,0,0,0,24,0,0,0,0,0,0,20],co=[17,0,0,0,0,0,0,16,0,0,0,0,0,0,15,0,0,17,0,0,0,0,0,16,0,0,0,0,0,15,0,0,0,0,17,0,0,0,0,16,0,0,0,0,15,0,0,0,0,0,0,17,0,0,0,16,0,0,0,15,0,0,0,0,0,0,0,0,17,0,0,16,0,0,15,0,0,0,0,0,0,0,0,0,0,17,0,16,0,15,0,0,0,0,0,0,0,0,0,0,0,0,17,16,15,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,-15,-16,-17,0,0,0,0,0,0,0,0,0,0,0,0,-15,0,-16,0,-17,0,0,0,0,0,0,0,0,0,0,-15,0,0,-16,0,0,-17,0,0,0,0,0,0,0,0,-15,0,0,0,-16,0,0,0,-17,0,0,0,0,0,0,-15,0,0,0,0,-16,0,0,0,0,-17,0,0,0,0,-15,0,0,0,0,0,-16,0,0,0,0,0,-17,0,0,-15,0,0,0,0,0,0,-16,0,0,0,0,0,0,-17],lo={p:1,n:2,b:4,r:8,q:16,k:32},uo=["n",Ks,Qs,Xs],ho={[Zs]:ro.KSIDE_CASTLE,[Xs]:ro.QSIDE_CASTLE},fo={w:[{square:io.a1,flag:ro.QSIDE_CASTLE},{square:io.h1,flag:ro.KSIDE_CASTLE}],b:[{square:io.a8,flag:ro.QSIDE_CASTLE},{square:io.h8,flag:ro.KSIDE_CASTLE}]},po={b:1,w:6},mo=["1-0","0-1","1/2-1/2","*"];function go(e){return e>>4}function vo(e){return 15&e}function yo(e){return-1!=="0123456789".indexOf(e)}function bo(e){const t=vo(e),n=go(e);return"abcdefgh".substring(t,t+1)+"87654321".substring(n,n+1)}function _o(e){return e===Ws?Ys:Ws}function wo(e,t,n,r,i,a=void 0,s=ro.NORMAL){const o=go(r);if(i!==$s||7!==o&&0!==o)e.push({color:t,from:n,to:r,piece:i,captured:a,flags:s});else for(let c=0;c<uo.length;c++){const o=uo[c];e.push({color:t,from:n,to:r,piece:i,captured:a,promotion:o,flags:s|ro.PROMOTION})}}function xo(e){let t=e.charAt(0);if(t>="a"&&t<="h"){if(e.match(/[a-h]\d.*[a-h]\d/))return;return $s}return t=t.toLowerCase(),"o"===t?Zs:t}function ko(e){return e.replace(/=/,"").replace(/[+#]?[?!]*$/,"")}function So(e){return e.split(" ").slice(0,4).join(" ")}class Chess{constructor(e=Js,{skipValidation:n=!1}={}){t(this,"_board",new Array(128)),t(this,"_turn",Ws),t(this,"_header",{}),t(this,"_kings",{w:eo,b:eo}),t(this,"_epSquare",-1),t(this,"_halfMoves",0),t(this,"_moveNumber",0),t(this,"_history",[]),t(this,"_comments",{}),t(this,"_castling",{w:0,b:0}),t(this,"_positionCount",{}),this.load(e,{skipValidation:n})}clear({preserveHeaders:e=!1}={}){this._board=new Array(128),this._kings={w:eo,b:eo},this._turn=Ws,this._castling={w:0,b:0},this._epSquare=eo,this._halfMoves=0,this._moveNumber=1,this._history=[],this._comments={},this._header=e?this._header:{},this._positionCount={},delete this._header.SetUp,delete this._header.FEN}load(e,{skipValidation:t=!1,preserveHeaders:n=!1}={}){let r=e.split(/\s+/);if(r.length>=2&&r.length<6){const t=["-","-","0","1"];e=r.concat(t.slice(-(6-r.length))).join(" ")}if(r=e.split(/\s+/),!t){const{ok:t,error:n}=function(e){const t=e.split(/\s+/);if(6!==t.length)return{ok:!1,error:"Invalid FEN: must contain six space-delimited fields"};const n=parseInt(t[5],10);if(isNaN(n)||n<=0)return{ok:!1,error:"Invalid FEN: move number must be a positive integer"};const r=parseInt(t[4],10);if(isNaN(r)||r<0)return{ok:!1,error:"Invalid FEN: half move counter number must be a non-negative integer"};if(!/^(-|[abcdefgh][36])$/.test(t[3]))return{ok:!1,error:"Invalid FEN: en-passant square is invalid"};if(/[^kKqQ-]/.test(t[2]))return{ok:!1,error:"Invalid FEN: castling availability is invalid"};if(!/^(w|b)$/.test(t[1]))return{ok:!1,error:"Invalid FEN: side-to-move is invalid"};const i=t[0].split("/");if(8!==i.length)return{ok:!1,error:"Invalid FEN: piece data does not contain 8 '/'-delimited rows"};for(let s=0;s<i.length;s++){let e=0,t=!1;for(let n=0;n<i[s].length;n++)if(yo(i[s][n])){if(t)return{ok:!1,error:"Invalid FEN: piece data is invalid (consecutive number)"};e+=parseInt(i[s][n],10),t=!0}else{if(!/^[prnbqkPRNBQK]$/.test(i[s][n]))return{ok:!1,error:"Invalid FEN: piece data is invalid (invalid piece)"};e+=1,t=!1}if(8!==e)return{ok:!1,error:"Invalid FEN: piece data is invalid (too many squares in rank)"}}if("3"==t[3][1]&&"w"==t[1]||"6"==t[3][1]&&"b"==t[1])return{ok:!1,error:"Invalid FEN: illegal en-passant square"};const a=[{color:"white",regex:/K/g},{color:"black",regex:/k/g}];for(const{color:s,regex:o}of a){if(!o.test(t[0]))return{ok:!1,error:`Invalid FEN: missing ${s} king`};if((t[0].match(o)||[]).length>1)return{ok:!1,error:`Invalid FEN: too many ${s} kings`}}return Array.from(i[0]+i[7]).some((e=>"P"===e.toUpperCase()))?{ok:!1,error:"Invalid FEN: some pawns are on the edge rows"}:{ok:!0}}(e);if(!t)throw new Error(n)}const i=r[0];let a=0;this.clear({preserveHeaders:n});for(let s=0;s<i.length;s++){const e=i.charAt(s);if("/"===e)a+=8;else if(yo(e))a+=parseInt(e,10);else{const t=e<"a"?Ws:Ys;this._put({type:e.toLowerCase(),color:t},bo(a)),a++}}this._turn=r[1],r[2].indexOf("K")>-1&&(this._castling.w|=ro.KSIDE_CASTLE),r[2].indexOf("Q")>-1&&(this._castling.w|=ro.QSIDE_CASTLE),r[2].indexOf("k")>-1&&(this._castling.b|=ro.KSIDE_CASTLE),r[2].indexOf("q")>-1&&(this._castling.b|=ro.QSIDE_CASTLE),this._epSquare="-"===r[3]?eo:io[r[3]],this._halfMoves=parseInt(r[4],10),this._moveNumber=parseInt(r[5],10),this._updateSetup(e),this._incPositionCount(e)}fen(){let e=0,t="";for(let i=io.a8;i<=io.h1;i++){if(this._board[i]){e>0&&(t+=e,e=0);const{color:n,type:r}=this._board[i];t+=n===Ws?r.toUpperCase():r.toLowerCase()}else e++;i+1&136&&(e>0&&(t+=e),i!==io.h1&&(t+="/"),e=0,i+=8)}let n="";this._castling[Ws]&ro.KSIDE_CASTLE&&(n+="K"),this._castling[Ws]&ro.QSIDE_CASTLE&&(n+="Q"),this._castling[Ys]&ro.KSIDE_CASTLE&&(n+="k"),this._castling[Ys]&ro.QSIDE_CASTLE&&(n+="q"),n=n||"-";let r="-";if(this._epSquare!==eo){const e=this._epSquare+(this._turn===Ws?16:-16),t=[e+1,e-1];for(const n of t){if(136&n)continue;const e=this._turn;if(this._board[n]?.color===e&&this._board[n]?.type===$s){this._makeMove({color:e,from:n,to:this._epSquare,piece:$s,captured:$s,flags:ro.EP_CAPTURE});const t=!this._isKingAttacked(e);if(this._undoMove(),t){r=bo(this._epSquare);break}}}}return[t,this._turn,n,r,this._halfMoves,this._moveNumber].join(" ")}_updateSetup(e){this._history.length>0||(e!==Js?(this._header.SetUp="1",this._header.FEN=e):(delete this._header.SetUp,delete this._header.FEN))}reset(){this.load(Js)}get(e){return this._board[io[e]]}put({type:e,color:t},n){return!!this._put({type:e,color:t},n)&&(this._updateCastlingRights(),this._updateEnPassantSquare(),this._updateSetup(this.fen()),!0)}_put({type:e,color:t},n){if(-1==="pnbrqkPNBRQK".indexOf(e.toLowerCase()))return!1;if(!(n in io))return!1;const r=io[n];if(e==Zs&&this._kings[t]!=eo&&this._kings[t]!=r)return!1;const i=this._board[r];return i&&i.type===Zs&&(this._kings[i.color]=eo),this._board[r]={type:e,color:t},e===Zs&&(this._kings[t]=r),!0}remove(e){const t=this.get(e);return delete this._board[io[e]],t&&t.type===Zs&&(this._kings[t.color]=eo),this._updateCastlingRights(),this._updateEnPassantSquare(),this._updateSetup(this.fen()),t}_updateCastlingRights(){const e=this._board[io.e1]?.type===Zs&&this._board[io.e1]?.color===Ws,t=this._board[io.e8]?.type===Zs&&this._board[io.e8]?.color===Ys;e&&this._board[io.a1]?.type===Qs&&this._board[io.a1]?.color===Ws||(this._castling.w&=-65),e&&this._board[io.h1]?.type===Qs&&this._board[io.h1]?.color===Ws||(this._castling.w&=-33),t&&this._board[io.a8]?.type===Qs&&this._board[io.a8]?.color===Ys||(this._castling.b&=-65),t&&this._board[io.h8]?.type===Qs&&this._board[io.h8]?.color===Ys||(this._castling.b&=-33)}_updateEnPassantSquare(){if(this._epSquare===eo)return;const e=this._epSquare+(this._turn===Ws?-16:16),t=this._epSquare+(this._turn===Ws?16:-16),n=[t+1,t-1];null===this._board[e]&&null===this._board[this._epSquare]&&this._board[t]?.color===_o(this._turn)&&this._board[t]?.type===$s&&n.some((e=>!(136&e)&&this._board[e]?.color===this._turn&&this._board[e]?.type===$s))||(this._epSquare=eo)}_attacked(e,t,n){const r=[];for(let i=io.a8;i<=io.h1;i++){if(136&i){i+=7;continue}if(void 0===this._board[i]||this._board[i].color!==e)continue;const a=this._board[i],s=i-t;if(0===s)continue;const o=s+119;if(oo[o]&lo[a.type]){if(a.type===$s){if(s>0&&a.color===Ws||s<=0&&a.color===Ys){if(!n)return!0;r.push(bo(i))}continue}if("n"===a.type||"k"===a.type){if(n){r.push(bo(i));continue}return!0}const e=co[o];let c=i+e,l=!1;for(;c!==t;){if(null!=this._board[c]){l=!0;break}c+=e}if(!l){if(n){r.push(bo(i));continue}return!0}}}return!!n&&r}attackers(e,t){return t?this._attacked(t,io[e],!0):this._attacked(this._turn,io[e],!0)}_isKingAttacked(e){const t=this._kings[e];return-1!==t&&this._attacked(_o(e),t)}isAttacked(e,t){return this._attacked(t,io[e])}isCheck(){return this._isKingAttacked(this._turn)}inCheck(){return this.isCheck()}isCheckmate(){return this.isCheck()&&0===this._moves().length}isStalemate(){return!this.isCheck()&&0===this._moves().length}isInsufficientMaterial(){const e={b:0,n:0,r:0,q:0,k:0,p:0},t=[];let n=0,r=0;for(let i=io.a8;i<=io.h1;i++){if(r=(r+1)%2,136&i){i+=7;continue}const a=this._board[i];a&&(e[a.type]=a.type in e?e[a.type]+1:1,a.type===Ks&&t.push(r),n++)}if(2===n)return!0;if(3===n&&(1===e[Ks]||1===e.n))return!0;if(n===e[Ks]+2){let e=0;const n=t.length;for(let r=0;r<n;r++)e+=t[r];if(0===e||e===n)return!0}return!1}isThreefoldRepetition(){return this._getPositionCount(this.fen())>=3}isDrawByFiftyMoves(){return this._halfMoves>=100}isDraw(){return this.isDrawByFiftyMoves()||this.isStalemate()||this.isInsufficientMaterial()||this.isThreefoldRepetition()}isGameOver(){return this.isCheckmate()||this.isStalemate()||this.isDraw()}moves({verbose:e=!1,square:t,piece:n}={}){const r=this._moves({square:t,piece:n});return e?r.map((e=>new Move(this,e))):r.map((e=>this._moveToSan(e,r)))}_moves({legal:e=!0,piece:t,square:n}={}){const r=n?n.toLowerCase():void 0,i=t?.toLowerCase(),a=[],s=this._turn,o=_o(s);let c=io.a8,l=io.h1,u=!1;if(r){if(!(r in io))return[];c=l=io[r],u=!0}for(let d=c;d<=l;d++){if(136&d){d+=7;continue}if(!this._board[d]||this._board[d].color===o)continue;const{type:e}=this._board[d];let t;if(e===$s){if(i&&i!==e)continue;t=d+ao[s][0],this._board[t]||(wo(a,s,d,t,$s),t=d+ao[s][1],po[s]!==go(d)||this._board[t]||wo(a,s,d,t,$s,void 0,ro.BIG_PAWN));for(let e=2;e<4;e++)t=d+ao[s][e],136&t||(this._board[t]?.color===o?wo(a,s,d,t,$s,this._board[t].type,ro.CAPTURE):t===this._epSquare&&wo(a,s,d,t,$s,$s,ro.EP_CAPTURE))}else{if(i&&i!==e)continue;for(let n=0,r=so[e].length;n<r;n++){const r=so[e][n];for(t=d;t+=r,!(136&t);){if(this._board[t]){if(this._board[t].color===s)break;wo(a,s,d,t,e,this._board[t].type,ro.CAPTURE);break}if(wo(a,s,d,t,e),"n"===e||e===Zs)break}}}}if(!(void 0!==i&&i!==Zs||u&&l!==this._kings[s])){if(this._castling[s]&ro.KSIDE_CASTLE){const e=this._kings[s],t=e+2;this._board[e+1]||this._board[t]||this._attacked(o,this._kings[s])||this._attacked(o,e+1)||this._attacked(o,t)||wo(a,s,this._kings[s],t,Zs,void 0,ro.KSIDE_CASTLE)}if(this._castling[s]&ro.QSIDE_CASTLE){const e=this._kings[s],t=e-2;this._board[e-1]||this._board[e-2]||this._board[e-3]||this._attacked(o,this._kings[s])||this._attacked(o,e-1)||this._attacked(o,t)||wo(a,s,this._kings[s],t,Zs,void 0,ro.QSIDE_CASTLE)}}if(!e||-1===this._kings[s])return a;const h=[];for(let d=0,f=a.length;d<f;d++)this._makeMove(a[d]),this._isKingAttacked(s)||h.push(a[d]),this._undoMove();return h}move(e,{strict:t=!1}={}){let n=null;if("string"==typeof e)n=this._moveFromSan(e,t);else if("object"==typeof e){const t=this._moves();for(let r=0,i=t.length;r<i;r++)if(e.from===bo(t[r].from)&&e.to===bo(t[r].to)&&(!("promotion"in t[r])||e.promotion===t[r].promotion)){n=t[r];break}}if(!n)throw"string"==typeof e?new Error(`Invalid move: ${e}`):new Error(`Invalid move: ${JSON.stringify(e)}`);const r=new Move(this,n);return this._makeMove(n),this._incPositionCount(r.after),r}_push(e){this._history.push({move:e,kings:{b:this._kings.b,w:this._kings.w},turn:this._turn,castling:{b:this._castling.b,w:this._castling.w},epSquare:this._epSquare,halfMoves:this._halfMoves,moveNumber:this._moveNumber})}_makeMove(e){const t=this._turn,n=_o(t);if(this._push(e),this._board[e.to]=this._board[e.from],delete this._board[e.from],e.flags&ro.EP_CAPTURE&&(this._turn===Ys?delete this._board[e.to-16]:delete this._board[e.to+16]),e.promotion&&(this._board[e.to]={type:e.promotion,color:t}),this._board[e.to].type===Zs){if(this._kings[t]=e.to,e.flags&ro.KSIDE_CASTLE){const t=e.to-1,n=e.to+1;this._board[t]=this._board[n],delete this._board[n]}else if(e.flags&ro.QSIDE_CASTLE){const t=e.to+1,n=e.to-2;this._board[t]=this._board[n],delete this._board[n]}this._castling[t]=0}if(this._castling[t])for(let r=0,i=fo[t].length;r<i;r++)if(e.from===fo[t][r].square&&this._castling[t]&fo[t][r].flag){this._castling[t]^=fo[t][r].flag;break}if(this._castling[n])for(let r=0,i=fo[n].length;r<i;r++)if(e.to===fo[n][r].square&&this._castling[n]&fo[n][r].flag){this._castling[n]^=fo[n][r].flag;break}e.flags&ro.BIG_PAWN?this._epSquare=t===Ys?e.to-16:e.to+16:this._epSquare=eo,e.piece===$s||e.flags&(ro.CAPTURE|ro.EP_CAPTURE)?this._halfMoves=0:this._halfMoves++,t===Ys&&this._moveNumber++,this._turn=n}undo(){const e=this._undoMove();if(e){const t=new Move(this,e);return this._decPositionCount(t.after),t}return null}_undoMove(){const e=this._history.pop();if(void 0===e)return null;const t=e.move;this._kings=e.kings,this._turn=e.turn,this._castling=e.castling,this._epSquare=e.epSquare,this._halfMoves=e.halfMoves,this._moveNumber=e.moveNumber;const n=this._turn,r=_o(n);if(this._board[t.from]=this._board[t.to],this._board[t.from].type=t.piece,delete this._board[t.to],t.captured)if(t.flags&ro.EP_CAPTURE){let e;e=n===Ys?t.to-16:t.to+16,this._board[e]={type:$s,color:r}}else this._board[t.to]={type:t.captured,color:r};if(t.flags&(ro.KSIDE_CASTLE|ro.QSIDE_CASTLE)){let e,n;t.flags&ro.KSIDE_CASTLE?(e=t.to+1,n=t.to-1):(e=t.to-2,n=t.to+1),this._board[e]=this._board[n],delete this._board[n]}return t}pgn({newline:e="\n",maxWidth:t=0}={}){const n=[];let r=!1;for(const h in this._header)n.push("["+h+' "'+this._header[h]+'"]'+e),r=!0;r&&this._history.length&&n.push(e);const i=e=>{const t=this._comments[this.fen()];return void 0!==t&&(e=`${e}${e.length>0?" ":""}{${t}}`),e},a=[];for(;this._history.length>0;)a.push(this._undoMove());const s=[];let o="";for(0===a.length&&s.push(i(""));a.length>0;){o=i(o);const e=a.pop();if(!e)break;if(this._history.length||"b"!==e.color)"w"===e.color&&(o.length&&s.push(o),o=this._moveNumber+".");else{const e=`${this._moveNumber}. ...`;o=o?`${o} ${e}`:e}o=o+" "+this._moveToSan(e,this._moves({legal:!0})),this._makeMove(e)}if(o.length&&s.push(i(o)),void 0!==this._header.Result&&s.push(this._header.Result),0===t)return n.join("")+s.join(" ");const c=function(){return n.length>0&&" "===n[n.length-1]&&(n.pop(),!0)},l=function(r,i){for(const a of i.split(" "))if(a){if(r+a.length>t){for(;c();)r--;n.push(e),r=0}n.push(a),r+=a.length,n.push(" "),r++}return c()&&r--,r};let u=0;for(let h=0;h<s.length;h++)u+s[h].length>t&&s[h].includes("{")?u=l(u,s[h]):(u+s[h].length>t&&0!==h?(" "===n[n.length-1]&&n.pop(),n.push(e),u=0):0!==h&&(n.push(" "),u++),n.push(s[h]),u+=s[h].length);return n.join("")}header(...e){for(let t=0;t<e.length;t+=2)"string"==typeof e[t]&&"string"==typeof e[t+1]&&(this._header[e[t]]=e[t+1]);return this._header}setHeader(e,t){return this._header[e]=t,this._header}removeHeader(e){return e in this._header&&(delete this._header[e],!0)}getHeaders(){return this._header}loadPgn(e,{strict:t=!1,newlineChar:n="\r?\n"}={}){function r(e){return e.replace(/\\/g,"\\")}e=e.trim();const i=new RegExp("^(\\[((?:"+r(n)+")|.)*\\])((?:\\s*"+r(n)+"){2}|(?:\\s*"+r(n)+")*$)").exec(e),a=i&&i.length>=2?i[1]:"";this.reset();const s=function(e){const t={},i=e.split(new RegExp(r(n)));let a="",s="";for(let n=0;n<i.length;n++){const e=/^\s*\[\s*([A-Za-z]+)\s*"(.*)"\s*\]\s*$/;a=i[n].replace(e,"$1"),s=i[n].replace(e,"$2"),a.trim().length>0&&(t[a]=s)}return t}(a);let o="";for(const p in s)"fen"===p.toLowerCase()&&(o=s[p]),this.header(p,s[p]);if(t){if("1"===s.SetUp){if(!("FEN"in s))throw new Error("Invalid PGN: FEN tag must be supplied with SetUp tag");this.load(s.FEN,{preserveHeaders:!0})}}else o&&this.load(o,{preserveHeaders:!0});const c=function(e){return`{${t=(e=e.replace(new RegExp(r(n),"g")," ")).slice(1,e.length-1),Array.from(t).map((function(e){return e.charCodeAt(0)<128?e.charCodeAt(0).toString(16):encodeURIComponent(e).replace(/%/g,"").toLowerCase()})).join("")}}`;var t},l=function(e){if(e.startsWith("{")&&e.endsWith("}"))return 0==(t=e.slice(1,e.length-1)).length?"":decodeURIComponent("%"+(t.match(/.{1,2}/g)||[]).join("%"));var t};let u=e.replace(a,"").replace(new RegExp(`({[^}]*})+?|;([^${r(n)}]*)`,"g"),(function(e,t,n){return void 0!==t?c(t):" "+c(`{${n.slice(1)}}`)})).replace(new RegExp(r(n),"g")," ");const h=/(\([^()]+\))+?/g;for(;h.test(u);)u=u.replace(h,"");u=u.replace(/\d+\.(\.\.)?/g,""),u=u.replace(/\.\.\./g,""),u=u.replace(/\$\d+/g,"");let d=u.trim().split(new RegExp(/\s+/));d=d.filter((e=>""!==e));let f="";for(let p=0;p<d.length;p++){const e=l(d[p]);if(void 0!==e){this._comments[this.fen()]=e;continue}const n=this._moveFromSan(d[p],t);if(null==n){if(!(mo.indexOf(d[p])>-1))throw new Error(`Invalid move in PGN: ${d[p]}`);f=d[p]}else f="",this._makeMove(n),this._incPositionCount(this.fen())}f&&Object.keys(this._header).length&&!this._header.Result&&this.header("Result",f)}_moveToSan(e,t){let n="";if(e.flags&ro.KSIDE_CASTLE)n="O-O";else if(e.flags&ro.QSIDE_CASTLE)n="O-O-O";else{if(e.piece!==$s){const r=function(e,t){const n=e.from,r=e.to,i=e.piece;let a=0,s=0,o=0;for(let c=0,l=t.length;c<l;c++){const e=t[c].from,l=t[c].to;i===t[c].piece&&n!==e&&r===l&&(a++,go(n)===go(e)&&s++,vo(n)===vo(e)&&o++)}return a>0?s>0&&o>0?bo(n):o>0?bo(n).charAt(1):bo(n).charAt(0):""}(e,t);n+=e.piece.toUpperCase()+r}e.flags&(ro.CAPTURE|ro.EP_CAPTURE)&&(e.piece===$s&&(n+=bo(e.from)[0]),n+="x"),n+=bo(e.to),e.promotion&&(n+="="+e.promotion.toUpperCase())}return this._makeMove(e),this.isCheck()&&(this.isCheckmate()?n+="#":n+="+"),this._undoMove(),n}_moveFromSan(e,t=!1){const n=ko(e);let r,i,a,s,o,c=xo(n),l=this._moves({legal:!0,piece:c});for(let h=0,d=l.length;h<d;h++)if(n===ko(this._moveToSan(l[h],l)))return l[h];if(t)return null;let u=!1;if(i=n.match(/([pnbrqkPNBRQK])?([a-h][1-8])x?-?([a-h][1-8])([qrbnQRBN])?/),i?(r=i[1],a=i[2],s=i[3],o=i[4],1==a.length&&(u=!0)):(i=n.match(/([pnbrqkPNBRQK])?([a-h]?[1-8]?)x?-?([a-h][1-8])([qrbnQRBN])?/),i&&(r=i[1],a=i[2],s=i[3],o=i[4],1==a.length&&(u=!0))),c=xo(n),l=this._moves({legal:!0,piece:r||c}),!s)return null;for(let h=0,d=l.length;h<d;h++)if(a){if(!(r&&r.toLowerCase()!=l[h].piece||io[a]!=l[h].from||io[s]!=l[h].to||o&&o.toLowerCase()!=l[h].promotion))return l[h];if(u){const e=bo(l[h].from);if(!(r&&r.toLowerCase()!=l[h].piece||io[s]!=l[h].to||a!=e[0]&&a!=e[1]||o&&o.toLowerCase()!=l[h].promotion))return l[h]}}else if(n===ko(this._moveToSan(l[h],l)).replace("x",""))return l[h];return null}ascii(){let e=" +------------------------+\n";for(let t=io.a8;t<=io.h1;t++){if(0===vo(t)&&(e+=" "+"87654321"[go(t)]+" |"),this._board[t]){const n=this._board[t].type;e+=" "+(this._board[t].color===Ws?n.toUpperCase():n.toLowerCase())+" "}else e+=" . ";t+1&136&&(e+="|\n",t+=8)}return e+=" +------------------------+\n",e+=" a b c d e f g h",e}perft(e){const t=this._moves({legal:!1});let n=0;const r=this._turn;for(let i=0,a=t.length;i<a;i++)this._makeMove(t[i]),this._isKingAttacked(r)||(e-1>0?n+=this.perft(e-1):n++),this._undoMove();return n}turn(){return this._turn}board(){const e=[];let t=[];for(let n=io.a8;n<=io.h1;n++)null==this._board[n]?t.push(null):t.push({square:bo(n),type:this._board[n].type,color:this._board[n].color}),n+1&136&&(e.push(t),t=[],n+=8);return e}squareColor(e){if(e in io){const t=io[e];return(go(t)+vo(t))%2==0?"light":"dark"}return null}history({verbose:e=!1}={}){const t=[],n=[];for(;this._history.length>0;)t.push(this._undoMove());for(;;){const r=t.pop();if(!r)break;e?n.push(new Move(this,r)):n.push(this._moveToSan(r,this._moves())),this._makeMove(r)}return n}_getPositionCount(e){const t=So(e);return this._positionCount[t]||0}_incPositionCount(e){const t=So(e);void 0===this._positionCount[t]&&(this._positionCount[t]=0),this._positionCount[t]+=1}_decPositionCount(e){const t=So(e);1===this._positionCount[t]?delete this._positionCount[t]:this._positionCount[t]-=1}_pruneComments(){const e=[],t={},n=e=>{e in this._comments&&(t[e]=this._comments[e])};for(;this._history.length>0;)e.push(this._undoMove());for(n(this.fen());;){const t=e.pop();if(!t)break;this._makeMove(t),n(this.fen())}this._comments=t}getComment(){return this._comments[this.fen()]}setComment(e){this._comments[this.fen()]=e.replace("{","[").replace("}","]")}deleteComment(){return this.removeComment()}removeComment(){const e=this._comments[this.fen()];return delete this._comments[this.fen()],e}getComments(){return this._pruneComments(),Object.keys(this._comments).map((e=>({fen:e,comment:this._comments[e]})))}deleteComments(){return this.removeComments()}removeComments(){return this._pruneComments(),Object.keys(this._comments).map((e=>{const t=this._comments[e];return delete this._comments[e],{fen:e,comment:t}}))}setCastlingRights(e,t){for(const r of[Zs,Xs])void 0!==t[r]&&(t[r]?this._castling[e]|=ho[r]:this._castling[e]&=~ho[r]);this._updateCastlingRights();const n=this.getCastlingRights(e);return!(void 0!==t[Zs]&&t[Zs]!==n[Zs]||void 0!==t[Xs]&&t[Xs]!==n[Xs])}getCastlingRights(e){return{[Zs]:!!(this._castling[e]&ho[Zs]),[Xs]:!!(this._castling[e]&ho[Xs])}}moveNumber(){return this._moveNumber}}const Co=e=>{const t=/* @__PURE__ */new Map;return no.forEach((n=>{const r=e.moves({square:n,verbose:!0});r.length&&t.set(n,r.map((e=>e.to)))})),t},Mo=e=>"w"===e.turn()?"cg-white":"cg-black",Eo=n({name:"PuzzleView",props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"PuzzleView"),r=B(n),i=a(null),s=a(),u=a(),h=a("cg-white"),d=a(!1),f=a(null),p=o((()=>{const e=["a","b","c","d","e","f","g","h"];return"cg-white"===h.value?e:e.reverse()})),m=e=>!!e&&["q","r","b","n"].includes(e),g=()=>{s.value&&u.value&&u.value.set({fen:s.value.fen(),turnColor:Mo(s.value),movable:{color:Mo(s.value),dests:Co(s.value)}})},v=(e,t,n)=>{if(!r.question.value?.moves.length)throw new Error("No moves");if(((e,t,n)=>{if(m(n))return!1;const r=s.value?.get(e);return"p"===r?.type&&("8"===t[1]||"1"===t[1])})(e,t,n))return f.value={from:e,to:t},void(d.value=!0);r.question.value.moves[0]===(m(n)?`${e}${t}${n}`:`${e}${t}`)?(s.value?.move({from:e,to:t,promotion:m(n)?n:void 0}),g(),r.question.value.moves.shift(),0===r.question.value.moves.length?r.submitAnswer(""):window.setTimeout((()=>{if(!r.question.value)return;const e=(e=>{if(e.length<4||e.length>5)throw new Error(`Invalid UCI move format: ${e}`);return{from:e.substring(0,2),to:e.substring(2,4),promotion:5===e.length?e[4]:void 0}})(r.question.value.moves.shift());s.value?.move(e),g()}),300)):(s.value?.move({from:e,to:t,promotion:n}),s.value?.isCheckmate()?r.submitAnswer(Fo.CHECKMATE):s.value?.undo(),r.submitAnswer(e+t+n),g())};return c((()=>{if(!i.value)return;r.question.value=new Fo(e.data),s.value=new Chess(r.question.value.fen),h.value="cg-white"===Mo(s.value)?"cg-black":"cg-white",u.value=Us(i.value,{movable:{free:!1,showDests:!0,dests:Co(s.value),events:{after:v}},draggable:{showGhost:!0},fen:s.value.fen(),orientation:h.value,coordinates:!1,animation:{duration:300,enabled:!0}});const t=r.question.value.moves.shift();u.value.move(t.substring(0,2),t.substring(2)),s.value.move({from:t.substring(0,2),to:t.substring(2)}),g()})),l((()=>{u.value?.destroy(),s.value=void 0})),{boardElement:i,playerColor:h,files:p,showPromotionDialog:d,promotionPieces:[{value:"q",name:"Queen",whiteSymbol:"♕",blackSymbol:"♛"},{value:"r",name:"Rook",whiteSymbol:"♖",blackSymbol:"♜"},{value:"b",name:"Bishop",whiteSymbol:"♗",blackSymbol:"♝"},{value:"n",name:"Knight",whiteSymbol:"♘",blackSymbol:"♞"}],handlePromotion:e=>{"q"===e||"r"===e||"b"===e||"n"===e?f.value&&(n.logger.log(`promoting to ${e}`),d.value=!1,v(f.value.from,f.value.to,e)):n.logger.error(`Invalid promotion piece: ${e}`)},...n,...r}}}),To={"data-viewable":"PuzzleView"},Ao={class:"text-h5"},Po={class:"puzzle-board-wrapper"},Io={class:"puzzle-ranks-labels"},No={class:"puzzle-board-and-files"},Do={id:"cg",ref:"boardElement"},Oo={class:"puzzle-files-labels"},Lo={key:0,class:"puzzle-promotion-dialog"},Bo=["onClick"],Ro=/* @__PURE__ */Vi(Eo,[["render",function(e,t,n,r,i,a){return p(),f("div",To,[m("p",Ao," Make the best move for "+y("cg-white"===e.playerColor?"White ♖♘♗♕♔♗♘♖":"Black ♜♞♝♚♛♝♞♜")+": ",1),m("div",Po,[m("div",Io,[(p(),f(b,null,_(8,(t=>m("div",{key:t},y("cg-white"===e.playerColor?9-t:t),1))),64))]),m("div",No,[m("div",Do,null,512),m("div",Oo,[(p(!0),f(b,null,_(e.files,(e=>(p(),f("div",{key:e},y(e),1)))),128))])])]),e.showPromotionDialog?(p(),f("div",Lo,[(p(!0),f(b,null,_(e.promotionPieces,(t=>(p(),f("button",{key:t.value,onClick:n=>e.handlePromotion(t.value)},y("cg-white"===e.playerColor?t.whiteSymbol:t.blackSymbol)+" "+y(t.name),9,Bo)))),128))])):g("",!0)])}]]),Vo=class _ChessPuzzle extends R{constructor(e){super(e),t(this,"fen"),t(this,"id"),t(this,"moves"),t(this,"rating"),t(this,"themes"),t(this,"checkMove",((e,t)=>(alert("checkMove"),console.log("checkMove",e,t),console.log("this.moves[0]",this.moves[0]),this.moves[0]===t)));const[n,r,i,a,,,,s]=e[0].puzzleData.split(",");this.id=n,this.fen=r,this.moves=i.split(" "),this.rating=parseInt(a,10),this.themes=s.split(" ")}evaluate(e,t){return{isCorrect:this.isCorrect(e),performance:this.displayedSkill(e,t)}}displayedSkill(e,t){return this.isCorrect(e)?t<5e3?1:1-Math.min(1,(t-5e3)/1e4):0}dataShapes(){return _ChessPuzzle.dataShapes}views(){return _ChessPuzzle.views}isCorrect(e){const t=0===this.moves.length;return e===_ChessPuzzle.CHECKMATE||t}};t(Vo,"dataShapes",[{name:X.CHESS_puzzle,fields:[{name:"puzzleData",type:Q.CHESS_PUZZLE,validator:{instructions:"insert a valid fen string",test:function(e){return console.log(`running puzzle validator on ${e}`),e?10!=e.split(",").length?{status:Z.error,msg:"puzzleData must have 8 comma-separated fields"}:{status:Z.ok,msg:""}:{status:Z.error,msg:"no defined input"}}},tagger:()=>["test"]}]}]),t(Vo,"views",[Ro]),t(Vo,"acceptsUserData",!0),t(Vo,"CHECKMATE","CHECKMATE");let Fo=Vo;const zo=new CourseWare("chess",[Fo]),jo=n({name:"AudioParseView",components:{AudioAutoPlayer:D},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"AudioParseView"),r=B(n),i=a("");r.question.value=new Go(e.data);const s=o((()=>r.question.value));return{...n,...r,answer:i,question:s,submit:()=>{s.value}}}}),qo={"data-viewable":"AudioParseView"},Ho=/* @__PURE__ */Vi(jo,[["render",function(e,t,n,r,i,a){const s=w("AudioAutoPlayer");return p(),f("div",qo,[e.question?(p(),f(b,{key:0},[x(s,{src:e.getURL("audio")},null,8,["src"]),t[0]||(t[0]=m("br",null,null,-1)),t[1]||(t[1]=m("br",null,null,-1)),k(" "+y(e.question.text),1)],64)):g("",!0)])}]]),Uo=class _AudioParsingQuestion extends R{constructor(e){super(e),t(this,"audio"),t(this,"text"),this.audio=e[0].audio,this.text=e[0].text}isCorrect(e){throw new Error(`isCorrect() not implemented - cannor parse ${e}`)}dataShapes(){return _AudioParsingQuestion.dataShapes}views(){return _AudioParsingQuestion.views}};t(Uo,"dataShapes",[{name:X.FRENCH_AudioParse,fields:[{name:"audio",type:Q.IMAGE},{name:"text",type:Q.STRING,validator:{test:e=>{const t=e.length<45;return{msg:t?"":"It's too long!",status:t?Z.ok:Z.error}}}}]}]),t(Uo,"views",[Ho]);let Go=Uo;const Wo=n({name:"IdentifyVocab",components:{},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"IdentifyVocab"),r=B(n);r.question.value=new Xo(e.data);const i=o((()=>r.question.value));return{...n,...r,question:i}}}),Yo={"data-viewable":"IdentifyVocab"},$o=/* @__PURE__ */Vi(Wo,[["render",function(e,t,n,r,i,a){return p(),f("div",Yo,[e.question?(p(),f(b,{key:0},[k(" This is a vocabulary question. ")],64)):g("",!0)])}]]),Ko=[{name:"word",type:Q.STRING,validator:J.NonEmptyString},{name:"image",type:Q.IMAGE},{name:"audio",type:Q.AUDIO}],Qo=class _VocabQuestion extends R{isCorrect(e){throw new Error(`isCorrect() not implemented. Cannot parse ${e}`)}dataShapes(){return _VocabQuestion.dataShapes}views(){return _VocabQuestion.views}};t(Qo,"dataShapes",[{fields:Ko,name:X.FRENCH_Vocab}]),t(Qo,"views",[$o]);let Xo=Qo;const Zo=new CourseWare("french",[Go,Xo]),Jo=n({name:"AdditionHorizontal",components:{UserInputNumber:j},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"AdditionHorizontal"),r=B(n),i=a("");r.question.value=new sc(e.data);const s=o((()=>r.question.value));return{...n,...r,answer:i,question:s,submit:()=>{if(s.value){const e=s.value.isCorrect(parseInt(i.value,10));alert(e)}}}}}),ec={"data-viewable":"AdditionHorizontal"},tc=/* @__PURE__ */Vi(Jo,[["render",function(e,t,n,r,i,a){const s=w("UserInputNumber");return p(),f("div",ec,[e.question?(p(),f(b,{key:0},[k(y(e.question.a)+" + "+y(e.question.b)+" = ",1),x(s,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,["modelValue"])],64)):g("",!0)])}]]),nc=n({name:"VerbalAddition",components:{UserInputNumber:j},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"VerbalAddition"),r=B(n),i=a("");r.question.value=new sc(e.data);const s=o((()=>r.question.value));return{...n,...r,answer:i,question:s,submit:()=>{if(s.value){const e=s.value.isCorrect(parseInt(i.value,10));alert(e)}}}}}),rc={"data-viewable":"VerbalAddition"},ic=/* @__PURE__ */Vi(nc,[["render",function(e,t,n,r,i,a){const s=w("UserInputNumber");return p(),f("div",rc,[e.question?(p(),f(b,{key:0},[k(y(e.question.a)+" plus "+y(e.question.b)+" is ",1),x(s,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,["modelValue"])],64)):g("",!0)])}]]),ac=class _SingleDigitAdditionQuestion extends R{constructor(e){super(e),t(this,"a"),t(this,"b"),this.a=e[0].a,this.b=e[0].b}isCorrect(e){return 1*this.a+this.b===e}dataShapes(){return _SingleDigitAdditionQuestion.dataShapes}views(){return _SingleDigitAdditionQuestion.views}};t(ac,"dataShapes",[fe]),t(ac,"views",[tc,ic]),t(ac,"seedData",function(){const e=[];for(let t=0;t<10;t++)for(let n=0;n<10;n++)e.push({a:t,b:n});return e}()),t(ac,"acceptsUserData",!1);let sc=ac;const oc=n({name:"DivisionHorizontal",components:{UserInputNumber:j},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"DivisionHorizontal"),r=B(n),i=a("");r.question.value=new dc(e.data);const s=o((()=>r.question.value));return{...n,...r,answer:i,question:s,submit:()=>{if(s.value){const e=s.value.isCorrect(parseInt(i.value,10));alert(e)}}}}}),cc={"data-viewable":"DivisionHorizontal"},lc=/* @__PURE__ */Vi(oc,[["render",function(e,t,n,r,i,a){const s=w("UserInputNumber");return p(),f("div",cc,[e.question?(p(),f(b,{key:0},[k(y(e.question.a*e.question.b)+" ÷ "+y(e.question.b)+" = ",1),x(s,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,["modelValue"])],64)):g("",!0)])}]]),uc=[{name:"a",type:Q.INT},{name:"b",type:Q.INT,validator:{instructions:"An integer between 1 and 10, inclusive.",test:e=>{const t=parseInt(e,10);return 0<t&&t<11?{status:Z.ok,msg:""}:0===t?{status:Z.error,msg:"Thou shalt not divide by zero."}:{status:Z.error,msg:"Single digit division problem divisors must be between 1 and 10, inclusive."}}}}],hc=class _SingleDigitDivisionQuestion extends R{constructor(e){super(e),t(this,"a"),t(this,"b"),this.a=e[0].a,this.b=e[0].b}isCorrect(e){return this.a*this.b===e}dataShapes(){return _SingleDigitDivisionQuestion.dataShapes}views(){return _SingleDigitDivisionQuestion.views}};t(hc,"dataShapes",[{name:X.MATH_SingleDigitDivision,fields:uc}]),t(hc,"views",[lc]);let dc=hc;const fc=n({name:"MultiplicationHorizontal",components:{UserInputNumber:j},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"MultiplicationHorizontal"),r=B(n),i=a("");r.question.value=new xc(e.data);const s=o((()=>r.question.value));return{...n,...r,answer:i,question:s,submit:()=>{if(s.value){const e=s.value.isCorrect(parseInt(i.value,10));alert(e)}}}}}),pc={"data-viewable":"MultiplicationHorizontal"},mc=/* @__PURE__ */Vi(fc,[["render",function(e,t,n,r,i,a){const s=w("UserInputNumber");return p(),f("div",pc,[e.question?(p(),f(b,{key:0},[k(y(e.question.a)+" × "+y(e.question.b)+" = ",1),x(s,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,["modelValue"])],64)):g("",!0)])}]]),gc=n({name:"VerbalMultiplication",components:{UserInputNumber:j},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"VerbalMultiplication"),r=B(n),i=a("");r.question.value=new xc(e.data);const s=o((()=>r.question.value));return{...n,...r,answer:i,question:s,submit:()=>{if(s.value){const e=s.value.isCorrect(parseInt(i.value,10));alert(e)}}}}}),vc={"data-viewable":"VerbalMultiplication"},yc=/* @__PURE__ */Vi(gc,[["render",function(e,t,n,r,i,a){const s=w("UserInputNumber");return p(),f("div",vc,[e.question?(p(),f(b,{key:0},[k(y(e.question.a)+" times "+y(e.question.b)+" is ",1),x(s,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,["modelValue"])],64)):g("",!0)])}]]),bc={instructions:"An integer between 0 and 10, inclusive.",test:e=>{const t=parseInt(e,10);return 0<=t&&t<=10?{status:Z.ok,msg:""}:{status:Z.error,msg:"Single digit multiplication problem inputs must be between 0 and 10, inclusive."}}},_c=[{name:"a",type:Q.INT,validator:bc},{name:"b",type:Q.INT,validator:bc}],wc=class _SingleDigitMultiplicationQuestion extends R{constructor(e){super(e),t(this,"a"),t(this,"b"),this.a=e[0].a,this.b=e[0].b}isCorrect(e){return this.a*this.b===e}dataShapes(){return _SingleDigitMultiplicationQuestion.dataShapes}views(){return _SingleDigitMultiplicationQuestion.views}};t(wc,"dataShapes",[{name:X.MATH_SingleDigitMultiplication,fields:_c}]),t(wc,"views",[yc,mc]);let xc=wc;const kc=n({name:"TrueFalse",components:{TFSelect:q},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"TrueFalse");B(n).question.value=new Ec(e.data);const r=o((()=>new Ec(e.data)));return{question:r,submit:e=>{alert(r.value.isCorrect(0===e))}}}}),Sc={"data-viewable":"TrueFalse"},Cc=/* @__PURE__ */Vi(kc,[["render",function(e,t,n,r,i,a){const s=w("TFSelect");return p(),f("div",Sc,[k(y(e.question.a)+" = "+y(e.question.b)+" ",1),x(s,{submit:e.submit},null,8,["submit"])])}]]),Mc=class _EqualityTest extends R{constructor(e){super(e),t(this,"a"),t(this,"b"),this.a=e[0].a,this.b=e[0].b}isCorrect(e){return this.a===this.b===e}dataShapes(){return _EqualityTest.dataShapes}views(){return _EqualityTest.views}};t(Mc,"dataShapes",[pe]),t(Mc,"views",[Cc]);let Ec=Mc;const Tc=n({name:"SolveView",components:{UserInputNumber:j},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"Solve"),r=B(n),i=a(""),s=["a","b","d","A","z","B","d","y"],c=a(s[Di(0,s.length)]);r.question.value=new zc(e.data);const l=o((()=>r.question.value));return{...n,...r,answer:i,question:l,variable:c,submit:()=>{if(l.value){const e=l.value.isCorrect(parseInt(i.value,10));alert(e)}}}}}),Ac={"data-viewable":"Solve"},Pc={key:0},Ic={key:1},Nc={key:2},Dc={key:3},Oc={key:4},Lc=/* @__PURE__ */Vi(Tc,[["render",function(e,t,n,r,i,a){const s=w("UserInputNumber");return p(),f("div",Ac,[e.question?(p(),f(b,{key:0},[t[1]||(t[1]=m("h4",null,"Solve the Equation",-1)),t[2]||(t[2]=m("br",null,null,-1)),t[3]||(t[3]=m("br",null,null,-1)),"ADDITION"===e.question.operation.valueOf()?(p(),f("div",Pc,y(e.variable)+" - "+y(e.question.a)+" = "+y(e.question.b),1)):"SUBTRACTION"===e.question.operation.valueOf()?(p(),f("div",Ic,y(e.variable)+" + "+y(e.question.a)+" = "+y(e.question.b),1)):"MULTIPLICATION"===e.question.operation.valueOf()?(p(),f("div",Nc,y(e.variable)+" ÷ "+y(e.question.a)+" = "+y(e.question.b),1)):"DIVISION"===e.question.operation.valueOf()?(p(),f("div",Dc,y(e.variable)+" * "+y(e.question.a)+" = "+y(e.question.b*e.question.a),1)):(p(),f("div",Oc,"No operation!? (This should never show)")),t[4]||(t[4]=m("br",null,null,-1)),t[5]||(t[5]=m("br",null,null,-1)),k(" "+y(e.variable)+" = ",1),x(s,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,["modelValue"])],64)):g("",!0)])}]]),Bc={instructions:"An integer between 0 and 10, inclusive.",test:e=>{const t=parseInt(e,10);return 0<=t&&t<=100?{status:Z.ok,msg:""}:{status:Z.error,msg:"Single-step equation problem inputs must be between 0 and 100, inclusive."}}},Rc={test:e=>"ADDITION"===e||"SUBTRACTION"===e||"MULTIPLICATION"===e||"DIVISION"===e?{status:Z.ok,msg:""}:{status:Z.error,msg:"Operation must be ADDITION, SUBTRACTION, MULTIPLICATION, or DIVISION"}},Vc=[{name:"a",type:Q.INT,validator:Bc},{name:"b",type:Q.INT,validator:Bc},{name:"operation",type:Q.STRING,validator:Rc}],Fc=class _OneStepEquation extends R{constructor(e){super(e),t(this,"a"),t(this,"b"),t(this,"operation"),this.a=e[0].a,this.b=e[0].b,this.operation=e[0].operation}answer(){let e=0;return"ADDITION"===this.operation?e=this.a+this.b:"SUBTRACTION"===this.operation?e=this.b-this.a:"MULTIPLICATION"===this.operation?e=this.a*this.b:"DIVISION"===this.operation&&(e=this.b),ee(`The answer is ${e}\nThe operation is ${this.operation.valueOf()}\nthis.a = ${this.a}\nthis.b = ${this.b}\n`),e}isCorrect(e){return e===this.answer()}dataShapes(){return _OneStepEquation.dataShapes}views(){return _OneStepEquation.views}};t(Fc,"dataShapes",[{name:X.MATH_OneStepEquation,fields:Vc}]),t(Fc,"views",[Lc]);let zc=Fc;const jc=n({name:"AngleCategorizeV",components:{RadioMultipleChoice:O},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"AngleCategorizeV"),r=B(n),i=a(null);r.question.value=new Kc(e.data);const s=o((()=>r.question.value)),l=o((()=>{if(!s.value)return 0;const e=s.value.angleCategory;if(e===Wc.ACUTE)return Di(10,83);if(e===Wc.RIGHT)return 90;if(e===Wc.OBTUSE)return Di(97,173);if(e===Wc.STRAIGHT)return 180;if(e===Wc.REFLEX)return Di(190,350);throw new Error("Unknown Angle type on AngleCategorize question")}));return c((()=>{if(!i.value)return;const e=i.value.width,t=i.value.height,n=i.value.getContext("2d");if(!n)return;const r=Di(0,360),a=r+l.value;n.moveTo(e/2,t/2);const s=e/2+e*Math.cos(r/360*2*Math.PI),o=t/2+e*Math.sin(r/360*2*Math.PI);n.lineTo(s,o),n.stroke(),n.moveTo(e/2,t/2);const c=e/2+e*Math.cos(a/360*2*Math.PI),u=t/2+e*Math.sin(a/360*2*Math.PI);n.lineTo(c,u),n.stroke(),n.moveTo(e/2,t/2),n.beginPath(),n.arc(e/2,t/2,25,r/360*2*Math.PI,a/360*2*Math.PI),n.stroke()})),{...n,...r,canvasRef:i,question:s}}}),qc={"data-viewable":"AngleCategorizeV"},Hc={ref:"canvasRef",width:"300",height:"300"},Uc=/* @__PURE__ */Vi(jc,[["render",function(e,t,n,r,i,a){const s=w("radio-multiple-choice");return p(),f("div",qc,[e.question?(p(),f(b,{key:0},[t[0]||(t[0]=m("h2",null,"What kind of angle is this?",-1)),m("canvas",Hc,null,512),x(s,{"choice-list":e.question.answers},null,8,["choice-list"])],64)):g("",!0)])}],["__scopeId","data-v-57f16e4a"]]),Gc={instructions:'Must be "ACUTE", "RIGHT", "OBTUSE", "STRAIGHT", or "REFLEX".',test:e=>"ACUTE"===e||"OBTUSE"===e||"REFLEX"===e||"RIGHT"===e||"STRAIGHT"===e?{status:Z.ok,msg:""}:{status:Z.error,msg:'Must be "ACUTE", "RIGHT", "OBTUSE", "STRAIGHT", or "REFLEX".'}};var Wc=/* @__PURE__ */(e=>(e.ACUTE="ACUTE",e.RIGHT="RIGHT",e.OBTUSE="OBTUSE",e.STRAIGHT="STRAIGHT",e.REFLEX="REFLEX",e))(Wc||{});const Yc=[{name:"Category",type:Q.STRING,validator:Gc}],$c=class _AngleCategorize extends R{constructor(e){super(e),t(this,"angleCategory"),t(this,"answers"),this.angleCategory=e[0].Category,this.answers=Ni.shuffle(["ACUTE","OBTUSE","REFLEX","RIGHT","STRAIGHT"])}isCorrect(e){return this.angleCategory.valueOf()===e.choiceList[e.selection]}dataShapes(){return _AngleCategorize.dataShapes}views(){return _AngleCategorize.views}};t($c,"dataShapes",[{name:X.MATH_AngleCategorize,fields:Yc}]),t($c,"views",[Uc]);let Kc=$c;function Qc(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Xc={exports:{}};const Zc=/* @__PURE__ */Ei(/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Jc,el,tl,nl={exports:{}};function rl(){return Jc||(Jc=1,function(e){var t=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],n=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",i={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},a="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",s={5:a,"5module":a+" export import",6:a+" const class extends export import super"},o=/^in(stanceof)?$/,c=new RegExp("["+r+"]"),l=new RegExp("["+r+"‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・]");function u(e,t){for(var n=65536,r=0;r<t.length;r+=2){if((n+=t[r])>e)return!1;if((n+=t[r+1])>=e)return!0}return!1}function h(e,t){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&c.test(String.fromCharCode(e)):!1!==t&&u(e,n)))}function d(e,r){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&l.test(String.fromCharCode(e)):!1!==r&&(u(e,n)||u(e,t)))))}var f=function(e,t){void 0===t&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function p(e,t){return new f(e,{beforeExpr:!0,binop:t})}var m={beforeExpr:!0},g={startsExpr:!0},v={};function y(e,t){return void 0===t&&(t={}),t.keyword=e,v[e]=new f(e,t)}var b={num:new f("num",g),regexp:new f("regexp",g),string:new f("string",g),name:new f("name",g),privateId:new f("privateId",g),eof:new f("eof"),bracketL:new f("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new f("]"),braceL:new f("{",{beforeExpr:!0,startsExpr:!0}),braceR:new f("}"),parenL:new f("(",{beforeExpr:!0,startsExpr:!0}),parenR:new f(")"),comma:new f(",",m),semi:new f(";",m),colon:new f(":",m),dot:new f("."),question:new f("?",m),questionDot:new f("?."),arrow:new f("=>",m),template:new f("template"),invalidTemplate:new f("invalidTemplate"),ellipsis:new f("...",m),backQuote:new f("`",g),dollarBraceL:new f("${",{beforeExpr:!0,startsExpr:!0}),eq:new f("=",{beforeExpr:!0,isAssign:!0}),assign:new f("_=",{beforeExpr:!0,isAssign:!0}),incDec:new f("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new f("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:p("||",1),logicalAND:p("&&",2),bitwiseOR:p("|",3),bitwiseXOR:p("^",4),bitwiseAND:p("&",5),equality:p("==/!=/===/!==",6),relational:p("</>/<=/>=",7),bitShift:p("<</>>/>>>",8),plusMin:new f("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:p("%",10),star:p("*",10),slash:p("/",10),starstar:new f("**",{beforeExpr:!0}),coalesce:p("??",1),_break:y("break"),_case:y("case",m),_catch:y("catch"),_continue:y("continue"),_debugger:y("debugger"),_default:y("default",m),_do:y("do",{isLoop:!0,beforeExpr:!0}),_else:y("else",m),_finally:y("finally"),_for:y("for",{isLoop:!0}),_function:y("function",g),_if:y("if"),_return:y("return",m),_switch:y("switch"),_throw:y("throw",m),_try:y("try"),_var:y("var"),_const:y("const"),_while:y("while",{isLoop:!0}),_with:y("with"),_new:y("new",{beforeExpr:!0,startsExpr:!0}),_this:y("this",g),_super:y("super",g),_class:y("class",g),_extends:y("extends",m),_export:y("export"),_import:y("import",g),_null:y("null",g),_true:y("true",g),_false:y("false",g),_in:y("in",{beforeExpr:!0,binop:7}),_instanceof:y("instanceof",{beforeExpr:!0,binop:7}),_typeof:y("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:y("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:y("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},_=/\r\n?|\n|\u2028|\u2029/,w=new RegExp(_.source,"g");function x(e){return 10===e||13===e||8232===e||8233===e}function k(e,t,n){void 0===n&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(x(i))return r<n-1&&13===i&&10===e.charCodeAt(r+1)?r+2:r+1}return-1}var S=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,C=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,M=Object.prototype,E=M.hasOwnProperty,T=M.toString,A=Object.hasOwn||function(e,t){return E.call(e,t)},P=Array.isArray||function(e){return"[object Array]"===T.call(e)},I=/* @__PURE__ */Object.create(null);function N(e){return I[e]||(I[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function D(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var O=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,L=function(e,t){this.line=e,this.column=t};L.prototype.offset=function(e){return new L(this.line,this.column+e)};var B=function(e,t,n){this.start=t,this.end=n,null!==e.sourceFile&&(this.source=e.sourceFile)};function R(e,t){for(var n=1,r=0;;){var i=k(e,r,t);if(i<0)return new L(n,t-r);++n,r=i}}var V={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},F=!1;function z(e){var t={};for(var n in V)t[n]=e&&A(e,n)?e[n]:V[n];if("latest"===t.ecmaVersion?t.ecmaVersion=1e8:null==t.ecmaVersion?(!F&&"object"==typeof console&&console.warn&&(F=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),null==t.allowReserved&&(t.allowReserved=t.ecmaVersion<5),e&&null!=e.allowHashBang||(t.allowHashBang=t.ecmaVersion>=14),P(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}return P(t.onComment)&&(t.onComment=function(e,t){return function(n,r,i,a,s,o){var c={type:n?"Block":"Line",value:r,start:i,end:a};e.locations&&(c.loc=new B(this,s,o)),e.ranges&&(c.range=[i,a]),t.push(c)}}(t,t.onComment)),t}var j=256;function q(e,t){return 2|(e?4:0)|(t?8:0)}var H=function(e,t,n){this.options=e=z(e),this.sourceFile=e.sourceFile,this.keywords=N(s[e.ecmaVersion>=6?6:"module"===e.sourceType?"5module":5]);var r="";!0!==e.allowReserved&&(r=i[e.ecmaVersion>=6?6:5===e.ecmaVersion?5:3],"module"===e.sourceType&&(r+=" await")),this.reservedWords=N(r);var a=(r?r+" ":"")+i.strict;this.reservedWordsStrict=N(a),this.reservedWordsStrictBind=N(a+" "+i.strictBind),this.input=String(t),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf("\n",n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(_).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=b.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=/* @__PURE__ */Object.create(null),0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(1),this.regexpState=null,this.privateNameStack=[]},U={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};H.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},U.inFunction.get=function(){return(2&this.currentVarScope().flags)>0},U.inGenerator.get=function(){return(8&this.currentVarScope().flags)>0&&!this.currentVarScope().inClassFieldInit},U.inAsync.get=function(){return(4&this.currentVarScope().flags)>0&&!this.currentVarScope().inClassFieldInit},U.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&j)return!1;if(2&t.flags)return(4&t.flags)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},U.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,n=e.inClassFieldInit;return(64&t)>0||n||this.options.allowSuperOutsideMethod},U.allowDirectSuper.get=function(){return(128&this.currentThisScope().flags)>0},U.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},U.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,n=e.inClassFieldInit;return(258&t)>0||n},U.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&j)>0},H.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},H.parse=function(e,t){return new this(t,e).parse()},H.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},H.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(H.prototype,U);var G=H.prototype,W=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;G.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){C.lastIndex=e,e+=C.exec(this.input)[0].length;var t=W.exec(this.input.slice(e));if(!t)return!1;if("use strict"===(t[1]||t[2])){C.lastIndex=e+t[0].length;var n=C.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return";"===i||"}"===i||_.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||"!"===i&&"="===this.input.charAt(r+1))}e+=t[0].length,C.lastIndex=e,e+=C.exec(this.input)[0].length,";"===this.input[e]&&e++}},G.eat=function(e){return this.type===e&&(this.next(),!0)},G.isContextual=function(e){return this.type===b.name&&this.value===e&&!this.containsEsc},G.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},G.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},G.canInsertSemicolon=function(){return this.type===b.eof||this.type===b.braceR||_.test(this.input.slice(this.lastTokEnd,this.start))},G.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},G.semicolon=function(){this.eat(b.semi)||this.insertSemicolon()||this.unexpected()},G.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},G.expect=function(e){this.eat(e)||this.unexpected()},G.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")};var Y=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};G.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?"Assigning to rvalue":"Parenthesized pattern")}},G.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,"Shorthand property assignments are valid only in destructuring patterns"),r>=0&&this.raiseRecoverable(r,"Redefinition of __proto__ property")},G.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},G.isSimpleAssignTarget=function(e){return"ParenthesizedExpression"===e.type?this.isSimpleAssignTarget(e.expression):"Identifier"===e.type||"MemberExpression"===e.type};var $=H.prototype;$.parseTopLevel=function(e){var t=/* @__PURE__ */Object.create(null);for(e.body||(e.body=[]);this.type!==b.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,"Export '"+a+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var K={kind:"loop"},Q={kind:"switch"};$.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;C.lastIndex=this.pos;var t=C.exec(this.input),n=this.pos+t[0].length,r=this.input.charCodeAt(n);if(91===r||92===r)return!0;if(e)return!1;if(123===r||r>55295&&r<56320)return!0;if(h(r,!0)){for(var i=n+1;d(r=this.input.charCodeAt(i),!0);)++i;if(92===r||r>55295&&r<56320)return!0;var a=this.input.slice(n,i);if(!o.test(a))return!0}return!1},$.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;C.lastIndex=this.pos;var e,t=C.exec(this.input),n=this.pos+t[0].length;return!(_.test(this.input.slice(this.pos,n))||"function"!==this.input.slice(n,n+8)||n+8!==this.input.length&&(d(e=this.input.charCodeAt(n+8))||e>55295&&e<56320))},$.parseStatement=function(e,t,n){var r,i=this.type,a=this.startNode();switch(this.isLet(e)&&(i=b._var,r="let"),i){case b._break:case b._continue:return this.parseBreakContinueStatement(a,i.keyword);case b._debugger:return this.parseDebuggerStatement(a);case b._do:return this.parseDoStatement(a);case b._for:return this.parseForStatement(a);case b._function:return e&&(this.strict||"if"!==e&&"label"!==e)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(a,!1,!e);case b._class:return e&&this.unexpected(),this.parseClass(a,!0);case b._if:return this.parseIfStatement(a);case b._return:return this.parseReturnStatement(a);case b._switch:return this.parseSwitchStatement(a);case b._throw:return this.parseThrowStatement(a);case b._try:return this.parseTryStatement(a);case b._const:case b._var:return r=r||this.value,e&&"var"!==r&&this.unexpected(),this.parseVarStatement(a,r);case b._while:return this.parseWhileStatement(a);case b._with:return this.parseWithStatement(a);case b.braceL:return this.parseBlock(!0,a);case b.semi:return this.parseEmptyStatement(a);case b._export:case b._import:if(this.options.ecmaVersion>10&&i===b._import){C.lastIndex=this.pos;var s=C.exec(this.input),o=this.pos+s[0].length,c=this.input.charCodeAt(o);if(40===c||46===c)return this.parseExpressionStatement(a,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===b._import?this.parseImport(a):this.parseExport(a,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(a,!0,!e);var l=this.value,u=this.parseExpression();return i===b.name&&"Identifier"===u.type&&this.eat(b.colon)?this.parseLabeledStatement(a,l,u,e):this.parseExpressionStatement(a,u)}},$.parseBreakContinueStatement=function(e,t){var n="break"===t;this.next(),this.eat(b.semi)||this.insertSemicolon()?e.label=null:this.type!==b.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if(null==e.label||i.name===e.label.name){if(null!=i.kind&&(n||"loop"===i.kind))break;if(e.label&&n)break}}return r===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,n?"BreakStatement":"ContinueStatement")},$.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},$.parseDoStatement=function(e){return this.next(),this.labels.push(K),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(b._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(b.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},$.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(K),this.enterScope(0),this.expect(b.parenL),this.type===b.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===b._var||this.type===b._const||n){var r=this.startNode(),i=n?"let":this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,"VariableDeclaration"),(this.type===b._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===r.declarations.length?(this.options.ecmaVersion>=9&&(this.type===b._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,r)):(t>-1&&this.unexpected(t),this.parseFor(e,r))}var a=this.isContextual("let"),s=!1,o=this.containsEsc,c=new Y,l=this.start,u=t>-1?this.parseExprSubscripts(c,"await"):this.parseExpression(!0,c);return this.type===b._in||(s=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===b._in&&this.unexpected(t),e.await=!0):s&&this.options.ecmaVersion>=8&&(u.start!==l||o||"Identifier"!==u.type||"async"!==u.name?this.options.ecmaVersion>=9&&(e.await=!1):this.unexpected()),a&&s&&this.raise(u.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(u,!1,c),this.checkLValPattern(u),this.parseForIn(e,u)):(this.checkExpressionErrors(c,!0),t>-1&&this.unexpected(t),this.parseFor(e,u))},$.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,Z|(n?0:J),!1,t)},$.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(b._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},$.parseReturnStatement=function(e){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(b.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},$.parseSwitchStatement=function(e){var t;this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(b.braceL),this.labels.push(Q),this.enterScope(0);for(var n=!1;this.type!==b.braceR;)if(this.type===b._case||this.type===b._default){var r=this.type===b._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),n=!0,t.test=null),this.expect(b.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},$.parseThrowStatement=function(e){return this.next(),_.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var X=[];$.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t="Identifier"===e.type;return this.enterScope(t?32:0),this.checkLValPattern(e,t?4:2),this.expect(b.parenR),e},$.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===b._catch){var t=this.startNode();this.next(),this.eat(b.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(b._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},$.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,"VariableDeclaration")},$.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(K),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},$.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")},$.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},$.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,"Label '"+t+"' is already declared");for(var s=this.type.isLoop?"loop":this.type===b._switch?"switch":null,o=this.labels.length-1;o>=0;o--){var c=this.labels[o];if(c.statementStart!==e.start)break;c.statementStart=this.start,c.kind=s}return this.labels.push({name:t,kind:s,statementStart:this.start}),e.body=this.parseStatement(r?-1===r.indexOf("label")?r+"label":r:"label"),this.labels.pop(),e.label=n,this.finishNode(e,"LabeledStatement")},$.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},$.parseBlock=function(e,t,n){for(void 0===e&&(e=!0),void 0===t&&(t=this.startNode()),t.body=[],this.expect(b.braceL),e&&this.enterScope(0);this.type!==b.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},$.parseFor=function(e,t){return e.init=t,this.expect(b.semi),e.test=this.type===b.semi?null:this.parseExpression(),this.expect(b.semi),e.update=this.type===b.parenR?null:this.parseExpression(),this.expect(b.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},$.parseForIn=function(e,t){var n=this.type===b._in;return this.next(),"VariableDeclaration"===t.type&&null!=t.declarations[0].init&&(!n||this.options.ecmaVersion<8||this.strict||"var"!==t.kind||"Identifier"!==t.declarations[0].id.type)&&this.raise(t.start,(n?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(b.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,n?"ForInStatement":"ForOfStatement")},$.parseVar=function(e,t,n,r){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(b.eq)?i.init=this.parseMaybeAssign(t):r||"const"!==n||this.type===b._in||this.options.ecmaVersion>=6&&this.isContextual("of")?r||"Identifier"===i.id.type||t&&(this.type===b._in||this.isContextual("of"))?i.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),e.declarations.push(this.finishNode(i,"VariableDeclarator")),!this.eat(b.comma))break}return e},$.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,"var"===t?1:2,!1)};var Z=1,J=2;function ee(e,t){var n=t.key.name,r=e[n],i="true";return"MethodDefinition"!==t.type||"get"!==t.kind&&"set"!==t.kind||(i=(t.static?"s":"i")+t.kind),"iget"===r&&"iset"===i||"iset"===r&&"iget"===i||"sget"===r&&"sset"===i||"sset"===r&&"sget"===i?(e[n]="true",!1):!!r||(e[n]=i,!1)}function te(e,t){var n=e.computed,r=e.key;return!n&&("Identifier"===r.type&&r.name===t||"Literal"===r.type&&r.value===t)}$.parseFunction=function(e,t,n,r,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===b.star&&t&J&&this.unexpected(),e.generator=this.eat(b.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&Z&&(e.id=4&t&&this.type!==b.name?null:this.parseIdent(),!e.id||t&J||this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?1:2:3));var a=this.yieldPos,s=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(q(e.async,e.generator)),t&Z||(e.id=this.type===b.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=a,this.awaitPos=s,this.awaitIdentPos=o,this.finishNode(e,t&Z?"FunctionDeclaration":"FunctionExpression")},$.parseFunctionParams=function(e){this.expect(b.parenL),e.params=this.parseBindingList(b.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},$.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(b.braceL);this.type!==b.braceR;){var s=this.parseClassElement(null!==e.superClass);s&&(i.body.push(s),"MethodDefinition"===s.type&&"constructor"===s.kind?(a&&this.raiseRecoverable(s.start,"Duplicate constructor in the same class"),a=!0):s.key&&"PrivateIdentifier"===s.key.type&&ee(r,s)&&this.raiseRecoverable(s.key.start,"Identifier '#"+s.key.name+"' has already been declared"))}return this.strict=n,this.next(),e.body=this.finishNode(i,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},$.parseClassElement=function(e){if(this.eat(b.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r="",i=!1,a=!1,s="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(b.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===b.star?o=!0:r="static"}if(n.static=o,!r&&t>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==b.star||this.canInsertSemicolon()?r="async":a=!0),!r&&(t>=9||!a)&&this.eat(b.star)&&(i=!0),!r&&!a&&!i){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?s=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,"Identifier")):this.parseClassElementName(n),t<13||this.type===b.parenL||"method"!==s||i||a){var l=!n.static&&te(n,"constructor"),u=l&&e;l&&"method"!==s&&this.raise(n.key.start,"Constructor can't have get/set modifier"),n.kind=l?"constructor":s,this.parseClassMethod(n,i,a,u)}else this.parseClassField(n);return n},$.isClassElementNameStart=function(){return this.type===b.name||this.type===b.privateId||this.type===b.num||this.type===b.string||this.type===b.bracketL||this.type.keyword},$.parseClassElementName=function(e){this.type===b.privateId?("constructor"===this.value&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},$.parseClassMethod=function(e,t,n,r){var i=e.key;"constructor"===e.kind?(t&&this.raise(i.start,"Constructor can't be a generator"),n&&this.raise(i.start,"Constructor can't be an async method")):e.static&&te(e,"prototype")&&this.raise(i.start,"Classes may not have a static property named prototype");var a=e.value=this.parseMethod(t,n,r);return"get"===e.kind&&0!==a.params.length&&this.raiseRecoverable(a.start,"getter should have no params"),"set"===e.kind&&1!==a.params.length&&this.raiseRecoverable(a.start,"setter should have exactly one param"),"set"===e.kind&&"RestElement"===a.params[0].type&&this.raiseRecoverable(a.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},$.parseClassField=function(e){if(te(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&te(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(b.eq)){var t=this.currentThisScope(),n=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=n}else e.value=null;return this.semicolon(),this.finishNode(e,"PropertyDefinition")},$.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(320);this.type!==b.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},$.parseClassId=function(e,t){this.type===b.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,2,!1)):(!0===t&&this.unexpected(),e.id=null)},$.parseClassSuper=function(e){e.superClass=this.eat(b._extends)?this.parseExprSubscripts(null,!1):null},$.enterClassBody=function(){var e={declared:/* @__PURE__ */Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},$.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=0===r?null:this.privateNameStack[r-1],a=0;a<n.length;++a){var s=n[a];A(t,s.name)||(i?i.used.push(s):this.raiseRecoverable(s.start,"Private field '#"+s.name+"' must be declared in an enclosing class"))}},$.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==b.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},$.parseExport=function(e,t){if(this.next(),this.eat(b.star))return this.parseExportAllDeclaration(e,t);if(this.eat(b._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),"VariableDeclaration"===e.declaration.type?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==b.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var n=0,r=e.specifiers;n<r.length;n+=1){var i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),"Literal"===i.local.type&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")},$.parseExportDeclaration=function(e){return this.parseStatement(null)},$.parseExportDefaultDeclaration=function(){var e;if(this.type===b._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,4|Z,!1,e)}if(this.type===b._class){var n=this.startNode();return this.parseClass(n,"nullableID")}var r=this.parseMaybeAssign();return this.semicolon(),r},$.checkExport=function(e,t,n){e&&("string"!=typeof t&&(t="Identifier"===t.type?t.name:t.value),A(e,t)&&this.raiseRecoverable(n,"Duplicate export '"+t+"'"),e[t]=!0)},$.checkPatternExport=function(e,t){var n=t.type;if("Identifier"===n)this.checkExport(e,t,t.start);else if("ObjectPattern"===n)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if("ArrayPattern"===n)for(var s=0,o=t.elements;s<o.length;s+=1){var c=o[s];c&&this.checkPatternExport(e,c)}else"Property"===n?this.checkPatternExport(e,t.value):"AssignmentPattern"===n?this.checkPatternExport(e,t.left):"RestElement"===n&&this.checkPatternExport(e,t.argument)},$.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},$.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},$.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual("as")?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,"ExportSpecifier")},$.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(b.braceL);!this.eat(b.braceR);){if(n)n=!1;else if(this.expect(b.comma),this.afterTrailingComma(b.braceR))break;t.push(this.parseExportSpecifier(e))}return t},$.parseImport=function(e){return this.next(),this.type===b.string?(e.specifiers=X,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===b.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},$.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,2),this.finishNode(e,"ImportSpecifier")},$.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,2),this.finishNode(e,"ImportDefaultSpecifier")},$.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,2),this.finishNode(e,"ImportNamespaceSpecifier")},$.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===b.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(b.comma)))return e;if(this.type===b.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(b.braceL);!this.eat(b.braceR);){if(t)t=!1;else if(this.expect(b.comma),this.afterTrailingComma(b.braceR))break;e.push(this.parseImportSpecifier())}return e},$.parseWithClause=function(){var e=[];if(!this.eat(b._with))return e;this.expect(b.braceL);for(var t={},n=!0;!this.eat(b.braceR);){if(n)n=!1;else if(this.expect(b.comma),this.afterTrailingComma(b.braceR))break;var r=this.parseImportAttribute(),i="Identifier"===r.key.type?r.key.name:r.key.value;A(t,i)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+i+"'"),t[i]=!0,e.push(r)}return e},$.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===b.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved),this.expect(b.colon),this.type!==b.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},$.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===b.string){var e=this.parseLiteral(this.value);return O.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},$.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},$.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"string"==typeof e.expression.value&&('"'===this.input[e.start]||"'"===this.input[e.start])};var ne=H.prototype;ne.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&"await"===e.name&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),"RestElement"!==a.type||"ArrayPattern"!==a.argument.type&&"ObjectPattern"!==a.argument.type||this.raise(a.argument.start,"Unexpected token")}break;case"Property":"init"!==e.kind&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),"AssignmentPattern"===e.argument.type&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==e.operator&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,n);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else n&&this.checkPatternErrors(n,!0);return e},ne.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];6===this.options.ecmaVersion&&t&&a&&"RestElement"===a.type&&"Identifier"!==a.argument.type&&this.unexpected(a.argument.start)}return e},ne.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},ne.parseRestBinding=function(){var e=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==b.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},ne.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case b.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(b.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case b.braceL:return this.parseObj(!0)}return this.parseIdent()},ne.parseBindingList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(b.comma),t&&this.type===b.comma)i.push(null);else{if(n&&this.afterTrailingComma(e))break;if(this.type===b.ellipsis){var s=this.parseRestBinding();this.parseBindingListItem(s),i.push(s),this.type===b.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}i.push(this.parseAssignableListItem(r))}return i},ne.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},ne.parseBindingListItem=function(e){return e},ne.parseMaybeDefault=function(e,t,n){if(n=n||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(b.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")},ne.checkLValSimple=function(e,t,n){void 0===t&&(t=0);var r=0!==t;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?"Binding ":"Assigning to ")+e.name+" in strict mode"),r&&(2===t&&"let"===e.name&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),n&&(A(n,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),n[e.name]=!0),5!==t&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":r&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return r&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(r?"Binding":"Assigning to")+" rvalue")}},ne.checkLValPattern=function(e,t,n){switch(void 0===t&&(t=0),e.type){case"ObjectPattern":for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,t,n)}break;case"ArrayPattern":for(var s=0,o=e.elements;s<o.length;s+=1){var c=o[s];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},ne.checkLValInnerPattern=function(e,t,n){switch(void 0===t&&(t=0),e.type){case"Property":this.checkLValInnerPattern(e.value,t,n);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,n);break;case"RestElement":this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var re=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},ie={b_stat:new re("{",!1),b_expr:new re("{",!0),b_tmpl:new re("${",!1),p_stat:new re("(",!1),p_expr:new re("(",!0),q_tmpl:new re("`",!0,!0,(function(e){return e.tryReadTemplateToken()})),f_stat:new re("function",!1),f_expr:new re("function",!0),f_expr_gen:new re("function",!0,!1,null,!0),f_gen:new re("function",!1,!1,null,!0)},ae=H.prototype;ae.initialContext=function(){return[ie.b_stat]},ae.curContext=function(){return this.context[this.context.length-1]},ae.braceIsBlock=function(e){var t=this.curContext();return t===ie.f_expr||t===ie.f_stat||(e!==b.colon||t!==ie.b_stat&&t!==ie.b_expr?e===b._return||e===b.name&&this.exprAllowed?_.test(this.input.slice(this.lastTokEnd,this.start)):e===b._else||e===b.semi||e===b.eof||e===b.parenR||e===b.arrow||(e===b.braceL?t===ie.b_stat:e!==b._var&&e!==b._const&&e!==b.name&&!this.exprAllowed):!t.isExpr)},ae.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if("function"===t.token)return t.generator}return!1},ae.updateContext=function(e){var t,n=this.type;n.keyword&&e===b.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},ae.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},b.parenR.updateContext=b.braceR.updateContext=function(){if(1!==this.context.length){var e=this.context.pop();e===ie.b_stat&&"function"===this.curContext().token&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}else this.exprAllowed=!0},b.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?ie.b_stat:ie.b_expr),this.exprAllowed=!0},b.dollarBraceL.updateContext=function(){this.context.push(ie.b_tmpl),this.exprAllowed=!0},b.parenL.updateContext=function(e){var t=e===b._if||e===b._for||e===b._with||e===b._while;this.context.push(t?ie.p_stat:ie.p_expr),this.exprAllowed=!0},b.incDec.updateContext=function(){},b._function.updateContext=b._class.updateContext=function(e){!e.beforeExpr||e===b._else||e===b.semi&&this.curContext()!==ie.p_stat||e===b._return&&_.test(this.input.slice(this.lastTokEnd,this.start))||(e===b.colon||e===b.braceL)&&this.curContext()===ie.b_stat?this.context.push(ie.f_stat):this.context.push(ie.f_expr),this.exprAllowed=!1},b.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},b.backQuote.updateContext=function(){this.curContext()===ie.q_tmpl?this.context.pop():this.context.push(ie.q_tmpl),this.exprAllowed=!1},b.star.updateContext=function(e){if(e===b._function){var t=this.context.length-1;this.context[t]===ie.f_expr?this.context[t]=ie.f_expr_gen:this.context[t]=ie.f_gen}this.exprAllowed=!0},b.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==b.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var se=H.prototype;function oe(e){return"Identifier"===e.type||"ParenthesizedExpression"===e.type&&oe(e.expression)}function ce(e){return"MemberExpression"===e.type&&"PrivateIdentifier"===e.property.type||"ChainExpression"===e.type&&ce(e.expression)||"ParenthesizedExpression"===e.type&&ce(e.expression)}se.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===e.type||this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r,i=e.key;switch(i.type){case"Identifier":r=i.name;break;case"Literal":r=String(i.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6)"__proto__"===r&&"init"===a&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=i.start):this.raiseRecoverable(i.start,"Redefinition of __proto__ property")),t.proto=!0);else{var s=t[r="$"+r];s?("init"===a?this.strict&&s.init||s.get||s.set:s.init||s[a])&&this.raiseRecoverable(i.start,"Redefinition of property"):s=t[r]={init:!1,get:!1,set:!1},s[a]=!0}}},se.parseExpression=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeAssign(e,t);if(this.type===b.comma){var a=this.startNodeAt(n,r);for(a.expressions=[i];this.eat(b.comma);)a.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(a,"SequenceExpression")}return i},se.parseMaybeAssign=function(e,t,n){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1,s=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,s=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new Y,r=!0);var o=this.start,c=this.startLoc;this.type!==b.parenL&&this.type!==b.name||(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===e);var l=this.parseMaybeConditional(e,t);if(n&&(l=n.call(this,l,o,c)),this.type.isAssign){var u=this.startNodeAt(o,c);return u.operator=this.value,this.type===b.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===b.eq?this.checkLValPattern(l):this.checkLValSimple(l),u.left=l,this.next(),u.right=this.parseMaybeAssign(e),s>-1&&(t.doubleProto=s),this.finishNode(u,"AssignmentExpression")}return r&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),l},se.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(this.eat(b.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(b.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,"ConditionalExpression")}return i},se.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&"ArrowFunctionExpression"===i.type?i:this.parseExprOp(i,n,r,-1,e)},se.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(null!=a&&(!i||this.type!==b._in)&&a>r){var s=this.type===b.logicalOR||this.type===b.logicalAND,o=this.type===b.coalesce;o&&(a=b.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,h=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),l,u,a,i),d=this.buildBinary(t,n,e,h,c,s||o);return(s&&this.type===b.coalesce||o&&(this.type===b.logicalOR||this.type===b.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(d,t,n,r,i)}return e},se.buildBinary=function(e,t,n,r,i,a){"PrivateIdentifier"===r.type&&this.raise(r.start,"Private identifier can only be left side of binary expression");var s=this.startNodeAt(e,t);return s.left=n,s.operator=i,s.right=r,this.finishNode(s,a?"LogicalExpression":"BinaryExpression")},se.parseMaybeUnary=function(e,t,n,r){var i,a=this.start,s=this.startLoc;if(this.isContextual("await")&&this.canAwait)i=this.parseAwait(r),t=!0;else if(this.type.prefix){var o=this.startNode(),c=this.type===b.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(o.argument):this.strict&&"delete"===o.operator&&oe(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):"delete"===o.operator&&ce(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,i=this.finishNode(o,c?"UpdateExpression":"UnaryExpression")}else if(t||this.type!==b.privateId){if(i=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return i;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(a,s);l.operator=this.value,l.prefix=!1,l.argument=i,this.checkLValSimple(i),this.next(),i=this.finishNode(l,"UpdateExpression")}}else(r||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),i=this.parsePrivateIdent(),this.type!==b._in&&this.unexpected();return n||!this.eat(b.starstar)?i:t?void this.unexpected(this.lastTokStart):this.buildBinary(a,s,i,this.parseMaybeUnary(null,!1,!1,r),"**",!1)},se.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprAtom(e,t);if("ArrowFunctionExpression"===i.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return i;var a=this.parseSubscripts(i,n,r,!1,t);return e&&"MemberExpression"===a.type&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},se.parseSubscripts=function(e,t,n,r,i){for(var a=this.options.ecmaVersion>=8&&"Identifier"===e.type&&"async"===e.name&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start==5&&this.potentialArrowAt===e.start,s=!1;;){var o=this.parseSubscript(e,t,n,r,a,s,i);if(o.optional&&(s=!0),o===e||"ArrowFunctionExpression"===o.type){if(s){var c=this.startNodeAt(t,n);c.expression=o,o=this.finishNode(c,"ChainExpression")}return o}e=o}},se.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(b.arrow)},se.parseSubscriptAsyncArrow=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,r)},se.parseSubscript=function(e,t,n,r,i,a,s){var o=this.options.ecmaVersion>=11,c=o&&this.eat(b.questionDot);r&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var l=this.eat(b.bracketL);if(l||c&&this.type!==b.parenL&&this.type!==b.backQuote||this.eat(b.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(b.bracketR)):this.type===b.privateId&&"Super"!==e.type?u.property=this.parsePrivateIdent():u.property=this.parseIdent("never"!==this.options.allowReserved),u.computed=!!l,o&&(u.optional=c),e=this.finishNode(u,"MemberExpression")}else if(!r&&this.eat(b.parenL)){var h=new Y,d=this.yieldPos,f=this.awaitPos,p=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var m=this.parseExprList(b.parenR,this.options.ecmaVersion>=8,!1,h);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(h,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=d,this.awaitPos=f,this.awaitIdentPos=p,this.parseSubscriptAsyncArrow(t,n,m,s);this.checkExpressionErrors(h,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=f||this.awaitPos,this.awaitIdentPos=p||this.awaitIdentPos;var g=this.startNodeAt(t,n);g.callee=e,g.arguments=m,o&&(g.optional=c),e=this.finishNode(g,"CallExpression")}else if(this.type===b.backQuote){(c||a)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var v=this.startNodeAt(t,n);v.tag=e,v.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(v,"TaggedTemplateExpression")}return e},se.parseExprAtom=function(e,t,n){this.type===b.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case b._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type!==b.parenL||this.allowDirectSuper||this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==b.dot&&this.type!==b.bracketL&&this.type!==b.parenL&&this.unexpected(),this.finishNode(r,"Super");case b._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case b.name:var a=this.start,s=this.startLoc,o=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&"async"===c.name&&!this.canInsertSemicolon()&&this.eat(b._function))return this.overrideContext(ie.f_expr),this.parseFunction(this.startNodeAt(a,s),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(b.arrow))return this.parseArrowExpression(this.startNodeAt(a,s),[c],!1,t);if(this.options.ecmaVersion>=8&&"async"===c.name&&this.type===b.name&&!o&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return c=this.parseIdent(!1),!this.canInsertSemicolon()&&this.eat(b.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,s),[c],!0,t)}return c;case b.regexp:var l=this.value;return(r=this.parseLiteral(l.value)).regex={pattern:l.pattern,flags:l.flags},r;case b.num:case b.string:return this.parseLiteral(this.value);case b._null:case b._true:case b._false:return(r=this.startNode()).value=this.type===b._null?null:this.type===b._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case b.parenL:var u=this.start,h=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(h)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),h;case b.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(b.bracketR,!0,!0,e),this.finishNode(r,"ArrayExpression");case b.braceL:return this.overrideContext(ie.b_expr),this.parseObj(!1,e);case b._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case b._class:return this.parseClass(this.startNode(),!1);case b._new:return this.parseNew();case b.backQuote:return this.parseTemplate();case b._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},se.parseExprAtomDefault=function(){this.unexpected()},se.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===b.parenL&&!e)return this.parseDynamicImport(t);if(this.type===b.dot){var n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name="import",t.meta=this.finishNode(n,"Identifier"),this.parseImportMeta(t)}this.unexpected()},se.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(b.parenR)?e.options=null:(this.expect(b.comma),this.afterTrailingComma(b.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(b.parenR)||(this.expect(b.comma),this.afterTrailingComma(b.parenR)||this.unexpected())));else if(!this.eat(b.parenR)){var t=this.start;this.eat(b.comma)&&this.eat(b.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},se.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),"meta"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),"module"===this.options.sourceType||this.options.allowImportExportEverywhere||this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")},se.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),110===t.raw.charCodeAt(t.raw.length-1)&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")},se.parseParenExpression=function(){this.expect(b.parenL);var e=this.parseExpression();return this.expect(b.parenR),e},se.shouldParseArrow=function(e){return!this.canInsertSemicolon()},se.parseParenAndDistinguishExpression=function(e,t){var n,r=this.start,i=this.startLoc,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var s,o=this.start,c=this.startLoc,l=[],u=!0,h=!1,d=new Y,f=this.yieldPos,p=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==b.parenR;){if(u?u=!1:this.expect(b.comma),a&&this.afterTrailingComma(b.parenR,!0)){h=!0;break}if(this.type===b.ellipsis){s=this.start,l.push(this.parseParenItem(this.parseRestBinding())),this.type===b.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}l.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var m=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(b.parenR),e&&this.shouldParseArrow(l)&&this.eat(b.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=p,this.parseParenArrowList(r,i,l,t);l.length&&!h||this.unexpected(this.lastTokStart),s&&this.unexpected(s),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,l.length>1?((n=this.startNodeAt(o,c)).expressions=l,this.finishNodeAt(n,"SequenceExpression",m,g)):n=l[0]}else n=this.parseParenExpression();if(this.options.preserveParens){var v=this.startNodeAt(r,i);return v.expression=n,this.finishNode(v,"ParenthesizedExpression")}return n},se.parseParenItem=function(e){return e},se.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)};var le=[];se.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===b.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var n=this.containsEsc;return e.property=this.parseIdent(!0),"target"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),n&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var r=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),this.eat(b.parenL)?e.arguments=this.parseExprList(b.parenR,this.options.ecmaVersion>=8,!1):e.arguments=le,this.finishNode(e,"NewExpression")},se.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===b.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),n.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),n.tail=this.type===b.backQuote,this.finishNode(n,"TemplateElement")},se.parseTemplate=function(e){void 0===e&&(e={});var t=e.isTagged;void 0===t&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(n.quasis=[r];!r.tail;)this.type===b.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(b.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(b.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,"TemplateLiteral")},se.isAsyncProp=function(e){return!e.computed&&"Identifier"===e.key.type&&"async"===e.key.name&&(this.type===b.name||this.type===b.num||this.type===b.string||this.type===b.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===b.star)&&!_.test(this.input.slice(this.lastTokEnd,this.start))},se.parseObj=function(e,t){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(b.braceR);){if(r)r=!1;else if(this.expect(b.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(b.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,i,t),n.properties.push(a)}return this.finishNode(n,e?"ObjectPattern":"ObjectExpression")},se.parseProperty=function(e,t){var n,r,i,a,s=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(b.ellipsis))return e?(s.argument=this.parseIdent(!1),this.type===b.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(s,"RestElement")):(s.argument=this.parseMaybeAssign(!1,t),this.type===b.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(s,"SpreadElement"));this.options.ecmaVersion>=6&&(s.method=!1,s.shorthand=!1,(e||t)&&(i=this.start,a=this.startLoc),e||(n=this.eat(b.star)));var o=this.containsEsc;return this.parsePropertyName(s),!e&&!o&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(s)?(r=!0,n=this.options.ecmaVersion>=9&&this.eat(b.star),this.parsePropertyName(s)):r=!1,this.parsePropertyValue(s,e,n,r,i,a,t,o),this.finishNode(s,"Property")},se.parseGetterSetter=function(e){e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var t="get"===e.kind?0:1;if(e.value.params.length!==t){var n=e.value.start;"get"===e.kind?this.raiseRecoverable(n,"getter should have no params"):this.raiseRecoverable(n,"setter should have exactly one param")}else"set"===e.kind&&"RestElement"===e.value.params[0].type&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")},se.parsePropertyValue=function(e,t,n,r,i,a,s,o){(n||r)&&this.type===b.colon&&this.unexpected(),this.eat(b.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,s),e.kind="init"):this.options.ecmaVersion>=6&&this.type===b.parenL?(t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(n,r)):t||o||!(this.options.ecmaVersion>=5)||e.computed||"Identifier"!==e.key.type||"get"!==e.key.name&&"set"!==e.key.name||this.type===b.comma||this.type===b.braceR||this.type===b.eq?this.options.ecmaVersion>=6&&!e.computed&&"Identifier"===e.key.type?((n||r)&&this.unexpected(),this.checkUnreserved(e.key),"await"!==e.key.name||this.awaitIdentPos||(this.awaitIdentPos=i),e.kind="init",t?e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key)):this.type===b.eq&&s?(s.shorthandAssign<0&&(s.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected():((n||r)&&this.unexpected(),this.parseGetterSetter(e))},se.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(b.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(b.bracketR),e.key;e.computed=!1}return e.key=this.type===b.num||this.type===b.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},se.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},se.parseMethod=function(e,t,n){var r=this.startNode(),i=this.yieldPos,a=this.awaitPos,s=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(64|q(t,r.generator)|(n?128:0)),this.expect(b.parenL),r.params=this.parseBindingList(b.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=s,this.finishNode(r,"FunctionExpression")},se.parseArrowExpression=function(e,t,n,r){var i=this.yieldPos,a=this.awaitPos,s=this.awaitIdentPos;return this.enterScope(16|q(n,!1)),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=s,this.finishNode(e,"ArrowFunctionExpression")},se.parseFunctionBody=function(e,t,n,r){var i=t&&this.type!==b.braceL,a=this.strict,s=!1;if(i)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);a&&!o||(s=this.strictDirective(this.end))&&o&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list");var c=this.labels;this.labels=[],s&&(this.strict=!0),this.checkParams(e,!a&&!s&&!t&&!n&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,5),e.body=this.parseBlock(!1,void 0,s&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},se.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1)if("Identifier"!==n[t].type)return!1;return!0},se.checkParams=function(e,t){for(var n=/* @__PURE__ */Object.create(null),r=0,i=e.params;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,1,t?null:n)}},se.parseExprList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(b.comma),t&&this.afterTrailingComma(e))break;var s=void 0;n&&this.type===b.comma?s=null:this.type===b.ellipsis?(s=this.parseSpread(r),r&&this.type===b.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):s=this.parseMaybeAssign(!1,r),i.push(s)}return i},se.checkUnreserved=function(e){var t=e.start,n=e.end,r=e.name;this.inGenerator&&"yield"===r&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===r&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().inClassFieldInit&&"arguments"===r&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),!this.inClassStaticBlock||"arguments"!==r&&"await"!==r||this.raise(t,"Cannot use "+r+" in class static initialization block"),this.keywords.test(r)&&this.raise(t,"Unexpected keyword '"+r+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(t,n).indexOf("\\")||(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&(this.inAsync||"await"!==r||this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+r+"' is reserved"))},se.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),"await"!==t.name||this.awaitIdentPos||(this.awaitIdentPos=t.start)),t},se.parseIdentNode=function(){var e=this.startNode();return this.type===b.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,"class"!==e.name&&"function"!==e.name||this.lastTokEnd===this.lastTokStart+1&&46===this.input.charCodeAt(this.lastTokStart)||this.context.pop(),this.type=b.name):this.unexpected(),e},se.parsePrivateIdent=function(){var e=this.startNode();return this.type===b.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(0===this.privateNameStack.length?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},se.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===b.semi||this.canInsertSemicolon()||this.type!==b.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(b.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},se.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var ue=H.prototype;ue.raise=function(e,t){var n=R(this.input,e);t+=" ("+n.line+":"+n.column+")";var r=new SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=this.pos,r},ue.raiseRecoverable=ue.raise,ue.curPosition=function(){if(this.options.locations)return new L(this.curLine,this.pos-this.lineStart)};var he=H.prototype,de=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};he.enterScope=function(e){this.scopeStack.push(new de(e))},he.exitScope=function(){this.scopeStack.pop()},he.treatFunctionsAsVarInScope=function(e){return 2&e.flags||!this.inModule&&1&e.flags},he.declareName=function(e,t,n){var r=!1;if(2===t){var i=this.currentScope();r=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&1&i.flags&&delete this.undefinedExports[e]}else if(4===t)this.currentScope().lexical.push(e);else if(3===t){var a=this.currentScope();r=this.treatFunctionsAsVar?a.lexical.indexOf(e)>-1:a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var s=this.scopeStack.length-1;s>=0;--s){var o=this.scopeStack[s];if(o.lexical.indexOf(e)>-1&&!(32&o.flags&&o.lexical[0]===e)||!this.treatFunctionsAsVarInScope(o)&&o.functions.indexOf(e)>-1){r=!0;break}if(o.var.push(e),this.inModule&&1&o.flags&&delete this.undefinedExports[e],259&o.flags)break}r&&this.raiseRecoverable(n,"Identifier '"+e+"' has already been declared")},he.checkLocalExport=function(e){-1===this.scopeStack[0].lexical.indexOf(e.name)&&-1===this.scopeStack[0].var.indexOf(e.name)&&(this.undefinedExports[e.name]=e)},he.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},he.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(259&t.flags)return t}},he.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(259&t.flags&&!(16&t.flags))return t}};var fe=function(e,t,n){this.type="",this.start=t,this.end=0,e.options.locations&&(this.loc=new B(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},pe=H.prototype;function me(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}pe.startNode=function(){return new fe(this,this.start,this.startLoc)},pe.startNodeAt=function(e,t){return new fe(this,e,t)},pe.finishNode=function(e,t){return me.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},pe.finishNodeAt=function(e,t,n,r){return me.call(this,e,t,n,r)},pe.copyNode=function(e){var t=new fe(this,e.start,this.startLoc);for(var n in e)t[n]=e[n];return t};var ge,ve,ye="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",be=ye+" Extended_Pictographic",_e=be+" EBase EComp EMod EPres ExtPict",we={9:ye,10:be,11:be,12:_e,13:_e,14:_e},xe={9:"",10:"",11:"",12:"",13:"",14:"Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"},ke="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Se="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Ce=Se+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Me=Ce+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Ee=Me+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Te=Ee+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Ae={9:Se,10:Ce,11:Me,12:Ee,13:Te,14:Te+" Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz"},Pe={};for(var Ie=0,Ne=[9,10,11,12,13,14];Ie<Ne.length;Ie+=1)ve=void 0,(ve=Pe[ge=Ne[Ie]]={binary:N(we[ge]+" "+ke),binaryOfStrings:N(xe[ge]),nonBinary:{General_Category:N(ke),Script:N(Ae[ge])}}).nonBinary.Script_Extensions=ve.nonBinary.Script,ve.nonBinary.gc=ve.nonBinary.General_Category,ve.nonBinary.sc=ve.nonBinary.Script,ve.nonBinary.scx=ve.nonBinary.Script_Extensions;var De=H.prototype,Oe=function(e,t){this.parent=e,this.base=t||this};Oe.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var n=e;n;n=n.parent)if(t.base===n.base&&t!==n)return!0;return!1},Oe.prototype.sibling=function(){return new Oe(this.parent,this.base)};var Le=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Pe[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=/* @__PURE__ */Object.create(null),this.backReferenceNames=[],this.branchID=null};function Be(e){return 105===e||109===e||115===e}function Re(e){return 36===e||e>=40&&e<=43||46===e||63===e||e>=91&&e<=94||e>=123&&e<=125}function Ve(e){return e>=65&&e<=90||e>=97&&e<=122}Le.prototype.reset=function(e,t,n){var r=-1!==n.indexOf("v"),i=-1!==n.indexOf("u");this.start=0|e,this.source=t+"",this.flags=n,r&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=i&&this.parser.options.ecmaVersion>=9)},Le.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)},Le.prototype.at=function(e,t){void 0===t&&(t=!1);var n=this.source,r=n.length;if(e>=r)return-1;var i=n.charCodeAt(e);if(!t&&!this.switchU||i<=55295||i>=57344||e+1>=r)return i;var a=n.charCodeAt(e+1);return a>=56320&&a<=57343?(i<<10)+a-56613888:i},Le.prototype.nextIndex=function(e,t){void 0===t&&(t=!1);var n=this.source,r=n.length;if(e>=r)return r;var i,a=n.charCodeAt(e);return!t&&!this.switchU||a<=55295||a>=57344||e+1>=r||(i=n.charCodeAt(e+1))<56320||i>57343?e+1:e+2},Le.prototype.current=function(e){return void 0===e&&(e=!1),this.at(this.pos,e)},Le.prototype.lookahead=function(e){return void 0===e&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},Le.prototype.advance=function(e){void 0===e&&(e=!1),this.pos=this.nextIndex(this.pos,e)},Le.prototype.eat=function(e,t){return void 0===t&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},Le.prototype.eatChars=function(e,t){void 0===t&&(t=!1);for(var n=this.pos,r=0,i=e;r<i.length;r+=1){var a=i[r],s=this.at(n,t);if(-1===s||s!==a)return!1;n=this.nextIndex(n,t)}return this.pos=n,!0},De.validateRegExpFlags=function(e){for(var t=e.validFlags,n=e.flags,r=!1,i=!1,a=0;a<n.length;a++){var s=n.charAt(a);-1===t.indexOf(s)&&this.raise(e.start,"Invalid regular expression flag"),n.indexOf(s,a+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),"u"===s&&(r=!0),"v"===s&&(i=!0)}this.options.ecmaVersion>=15&&r&&i&&this.raise(e.start,"Invalid regular expression flag")},De.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&function(e){for(var t in e)return!0;return!1}(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},De.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=/* @__PURE__ */Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,n=e.backReferenceNames;t<n.length;t+=1){var r=n[t];e.groupNames[r]||e.raise("Invalid named capture referenced")}},De.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Oe(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")},De.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},De.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),!0):!!(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))&&(this.regexp_eatQuantifier(e),!0)},De.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!n,!0}return e.pos=t,!1},De.regexp_eatQuantifier=function(e,t){return void 0===t&&(t=!1),!!this.regexp_eatQuantifierPrefix(e,t)&&(e.eat(63),!0)},De.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},De.regexp_eatBracedQuantifier=function(e,t){var n=e.pos;if(e.eat(123)){var r=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return-1!==i&&i<r&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=n}return!1},De.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},De.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},De.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(e),r=e.eat(45);if(n||r){for(var i=0;i<n.length;i++){var a=n.charAt(i);n.indexOf(a,i+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(r){var s=this.regexp_eatModifiers(e);n||s||58!==e.current()||e.raise("Invalid regular expression modifiers");for(var o=0;o<s.length;o++){var c=s.charAt(o);(s.indexOf(c,o+1)>-1||n.indexOf(c)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}}e.pos=t}return!1},De.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):63===e.current()&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1},De.regexp_eatModifiers=function(e){for(var t="",n=0;-1!==(n=e.current())&&Be(n);)t+=D(n),e.advance();return t},De.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},De.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},De.regexp_eatSyntaxCharacter=function(e){var t=e.current();return!!Re(t)&&(e.lastIntValue=t,e.advance(),!0)},De.regexp_eatPatternCharacters=function(e){for(var t=e.pos,n=0;-1!==(n=e.current())&&!Re(n);)e.advance();return e.pos!==t},De.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return!(-1===t||36===t||t>=40&&t<=43||46===t||63===t||91===t||94===t||124===t||(e.advance(),0))},De.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,n=e.groupNames[e.lastStringValue];if(n)if(t)for(var r=0,i=n;r<i.length;r+=1)i[r].separatedFrom(e.branchID)||e.raise("Duplicate capture group name");else e.raise("Duplicate capture group name");t?(n||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},De.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1},De.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=D(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=D(e.lastIntValue);return!0}return!1},De.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),92===r&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),function(e){return h(e,!0)||36===e||95===e}(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)},De.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),92===r&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),function(e){return d(e,!0)||36===e||95===e||8204===e||8205===e}(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)},De.regexp_eatAtomEscape=function(e){return!!(this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e))||(e.switchU&&(99===e.current()&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)},De.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var n=e.lastIntValue;if(e.switchU)return n>e.maxBackReference&&(e.maxBackReference=n),!0;if(n<=e.numCapturingParens)return!0;e.pos=t}return!1},De.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1},De.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},De.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},De.regexp_eatZero=function(e){return 48===e.current()&&!je(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},De.regexp_eatControlEscape=function(e){var t=e.current();return 116===t?(e.lastIntValue=9,e.advance(),!0):110===t?(e.lastIntValue=10,e.advance(),!0):118===t?(e.lastIntValue=11,e.advance(),!0):102===t?(e.lastIntValue=12,e.advance(),!0):114===t&&(e.lastIntValue=13,e.advance(),!0)},De.regexp_eatControlLetter=function(e){var t=e.current();return!!Ve(t)&&(e.lastIntValue=t%32,e.advance(),!0)},De.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){void 0===t&&(t=!1);var n=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(r&&i>=55296&&i<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var s=e.lastIntValue;if(s>=56320&&s<=57343)return e.lastIntValue=1024*(i-55296)+(s-56320)+65536,!0}e.pos=a,e.lastIntValue=i}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&function(e){return e>=0&&e<=1114111}(e.lastIntValue))return!0;r&&e.raise("Invalid unicode escape"),e.pos=n}return!1},De.regexp_eatIdentityEscape=function(e){if(e.switchU)return!!this.regexp_eatSyntaxCharacter(e)||!!e.eat(47)&&(e.lastIntValue=47,!0);var t=e.current();return!(99===t||e.switchN&&107===t||(e.lastIntValue=t,e.advance(),0))},De.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do{e.lastIntValue=10*e.lastIntValue+(t-48),e.advance()}while((t=e.current())>=48&&t<=57);return!0}return!1};function Fe(e){return Ve(e)||95===e}function ze(e){return Fe(e)||je(e)}function je(e){return e>=48&&e<=57}function qe(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function He(e){return e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:e-48}function Ue(e){return e>=48&&e<=55}De.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(function(e){return 100===e||68===e||115===e||83===e||119===e||87===e}(t))return e.lastIntValue=-1,e.advance(),1;var n=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((n=80===t)||112===t)){var r;if(e.lastIntValue=-1,e.advance(),e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return n&&2===r&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return 0},De.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var n=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,n,r),1}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return 0},De.regexp_validateUnicodePropertyNameAndValue=function(e,t,n){A(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(n)||e.raise("Invalid property value")},De.regexp_validateUnicodePropertyNameOrValue=function(e,t){return e.unicodeProperties.binary.test(t)?1:e.switchV&&e.unicodeProperties.binaryOfStrings.test(t)?2:void e.raise("Invalid property name")},De.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Fe(t=e.current());)e.lastStringValue+=D(t),e.advance();return""!==e.lastStringValue},De.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";ze(t=e.current());)e.lastStringValue+=D(t),e.advance();return""!==e.lastStringValue},De.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},De.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),n=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&2===n&&e.raise("Negated character class may contain strings"),!0}return!1},De.regexp_classContents=function(e){return 93===e.current()?1:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),1)},De.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var n=e.lastIntValue;!e.switchU||-1!==t&&-1!==n||e.raise("Invalid character class"),-1!==t&&-1!==n&&t>n&&e.raise("Range out of order in character class")}}},De.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var n=e.current();(99===n||Ue(n))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var r=e.current();return 93!==r&&(e.lastIntValue=r,e.advance(),!0)},De.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},De.regexp_classSetExpression=function(e){var t,n=1;if(this.regexp_eatClassSetRange(e));else if(t=this.regexp_eatClassSetOperand(e)){2===t&&(n=2);for(var r=e.pos;e.eatChars([38,38]);)38!==e.current()&&(t=this.regexp_eatClassSetOperand(e))?2!==t&&(n=1):e.raise("Invalid character in character class");if(r!==e.pos)return n;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(r!==e.pos)return n}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(!(t=this.regexp_eatClassSetOperand(e)))return n;2===t&&(n=2)}},De.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return-1!==n&&-1!==r&&n>r&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1},De.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?1:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},De.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var n=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return n&&2===r&&e.raise("Negated character class may contain strings"),r;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null},De.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var n=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return n}else e.raise("Invalid escape");e.pos=t}return null},De.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)2===this.regexp_classString(e)&&(t=2);return t},De.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return 1===t?1:2},De.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return!(!this.regexp_eatCharacterEscape(e)&&!this.regexp_eatClassSetReservedPunctuator(e)&&(e.eat(98)?(e.lastIntValue=8,0):(e.pos=t,1)));var n=e.current();return!(n<0||n===e.lookahead()&&function(e){return 33===e||e>=35&&e<=38||e>=42&&e<=44||46===e||e>=58&&e<=64||94===e||96===e||126===e}(n)||function(e){return 40===e||41===e||45===e||47===e||e>=91&&e<=93||e>=123&&e<=125}(n)||(e.advance(),e.lastIntValue=n,0))},De.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return!!function(e){return 33===e||35===e||37===e||38===e||44===e||45===e||e>=58&&e<=62||64===e||96===e||126===e}(t)&&(e.lastIntValue=t,e.advance(),!0)},De.regexp_eatClassControlLetter=function(e){var t=e.current();return!(!je(t)&&95!==t||(e.lastIntValue=t%32,e.advance(),0))},De.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1},De.regexp_eatDecimalDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;je(n=e.current());)e.lastIntValue=10*e.lastIntValue+(n-48),e.advance();return e.pos!==t},De.regexp_eatHexDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;qe(n=e.current());)e.lastIntValue=16*e.lastIntValue+He(n),e.advance();return e.pos!==t},De.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var n=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=64*t+8*n+e.lastIntValue:e.lastIntValue=8*t+n}else e.lastIntValue=t;return!0}return!1},De.regexp_eatOctalDigit=function(e){var t=e.current();return Ue(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)},De.regexp_eatFixedHexDigits=function(e,t){var n=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var i=e.current();if(!qe(i))return e.pos=n,!1;e.lastIntValue=16*e.lastIntValue+He(i),e.advance()}return!0};var Ge=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new B(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},We=H.prototype;function Ye(e){return"function"!=typeof BigInt?null:BigInt(e.replace(/_/g,""))}We.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new Ge(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},We.getToken=function(){return this.next(),new Ge(this)},"undefined"!=typeof Symbol&&(We[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===b.eof,value:t}}}}),We.nextToken=function(){var e=this.curContext();return e&&e.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(b.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},We.readToken=function(e){return h(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},We.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888},We.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf("*/",this.pos+=2);if(-1===n&&this.raise(this.pos-2,"Unterminated comment"),this.pos=n+2,this.options.locations)for(var r=void 0,i=t;(r=k(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},We.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!x(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.curPosition())},We.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(e>8&&e<14||e>=5760&&S.test(String.fromCharCode(e))))break e;++this.pos}}},We.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},We.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===e&&46===t?(this.pos+=3,this.finishToken(b.ellipsis)):(++this.pos,this.finishToken(b.dot))},We.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===e?this.finishOp(b.assign,2):this.finishOp(b.slash,1)},We.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=42===e?b.star:b.modulo;return this.options.ecmaVersion>=7&&42===e&&42===t&&(++n,r=b.starstar,t=this.input.charCodeAt(this.pos+2)),61===t?this.finishOp(b.assign,n+1):this.finishOp(r,n)},We.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&61===this.input.charCodeAt(this.pos+2)?this.finishOp(b.assign,3):this.finishOp(124===e?b.logicalOR:b.logicalAND,2):61===t?this.finishOp(b.assign,2):this.finishOp(124===e?b.bitwiseOR:b.bitwiseAND,1)},We.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(b.assign,2):this.finishOp(b.bitwiseXOR,1)},We.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?45!==t||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!_.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(b.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===t?this.finishOp(b.assign,2):this.finishOp(b.plusMin,1)},We.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+n)?this.finishOp(b.assign,n+1):this.finishOp(b.bitShift,n)):33!==t||60!==e||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===t&&(n=2),this.finishOp(b.relational,n)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},We.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(b.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===e&&62===t&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(b.arrow)):this.finishOp(61===e?b.eq:b.prefix,1)},We.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(46===t){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(b.questionDot,2)}if(63===t)return e>=12&&61===this.input.charCodeAt(this.pos+2)?this.finishOp(b.assign,3):this.finishOp(b.coalesce,2)}return this.finishOp(b.question,1)},We.readToken_numberSign=function(){var e=35;if(this.options.ecmaVersion>=13&&(++this.pos,h(e=this.fullCharCodeAtPos(),!0)||92===e))return this.finishToken(b.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+D(e)+"'")},We.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(b.parenL);case 41:return++this.pos,this.finishToken(b.parenR);case 59:return++this.pos,this.finishToken(b.semi);case 44:return++this.pos,this.finishToken(b.comma);case 91:return++this.pos,this.finishToken(b.bracketL);case 93:return++this.pos,this.finishToken(b.bracketR);case 123:return++this.pos,this.finishToken(b.braceL);case 125:return++this.pos,this.finishToken(b.braceR);case 58:return++this.pos,this.finishToken(b.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(b.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(b.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+D(e)+"'")},We.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)},We.readRegexp=function(){for(var e,t,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,"Unterminated regular expression");var r=this.input.charAt(this.pos);if(_.test(r)&&this.raise(n,"Unterminated regular expression"),e)e=!1;else{if("["===r)t=!0;else if("]"===r&&t)t=!1;else if("/"===r&&!t)break;e="\\"===r}++this.pos}var i=this.input.slice(n,this.pos);++this.pos;var a=this.pos,s=this.readWord1();this.containsEsc&&this.unexpected(a);var o=this.regexpState||(this.regexpState=new Le(this));o.reset(n,i,s),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var c=null;try{c=new RegExp(i,s)}catch(l){}return this.finishToken(b.regexp,{pattern:i,flags:s,value:c})},We.readInt=function(e,t,n){for(var r=this.options.ecmaVersion>=12&&void 0===t,i=n&&48===this.input.charCodeAt(this.pos),a=this.pos,s=0,o=0,c=0,l=null==t?1/0:t;c<l;++c,++this.pos){var u=this.input.charCodeAt(this.pos),h=void 0;if(r&&95===u)i&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===o&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===c&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=u;else{if((h=u>=97?u-97+10:u>=65?u-65+10:u>=48&&u<=57?u-48:1/0)>=e)break;o=u,s=s*e+h}}return r&&95===o&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===a||null!=t&&this.pos-a!==t?null:s},We.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var n=this.readInt(e);return null==n&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(n=Ye(this.input.slice(t,this.pos)),++this.pos):h(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(b.num,n)},We.readNumber=function(e){var t=this.pos;e||null!==this.readInt(10,void 0,!0)||this.raise(t,"Invalid number");var n=this.pos-t>=2&&48===this.input.charCodeAt(t);n&&this.strict&&this.raise(t,"Invalid number");var r=this.input.charCodeAt(this.pos);if(!n&&!e&&this.options.ecmaVersion>=11&&110===r){var i=Ye(this.input.slice(t,this.pos));return++this.pos,h(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(b.num,i)}n&&/[89]/.test(this.input.slice(t,this.pos))&&(n=!1),46!==r||n||(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),69!==r&&101!==r||n||(43!==(r=this.input.charCodeAt(++this.pos))&&45!==r||++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number")),h(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var a=function(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}(this.input.slice(t,this.pos),n);return this.finishToken(b.num,a)},We.readCodePoint=function(){var e;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var t=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(t,"Code point out of bounds")}else e=this.readHexChar(4);return e},We.readString=function(e){for(var t="",n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var r=this.input.charCodeAt(this.pos);if(r===e)break;92===r?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):8232===r||8233===r?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(x(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(b.string,t)};var $e={};We.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(ge){if(ge!==$e)throw ge;this.readInvalidTemplateToken()}this.inTemplateElement=!1},We.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw $e;this.raise(e,t)},We.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var n=this.input.charCodeAt(this.pos);if(96===n||36===n&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==b.template&&this.type!==b.invalidTemplate?(e+=this.input.slice(t,this.pos),this.finishToken(b.template,e)):36===n?(this.pos+=2,this.finishToken(b.dollarBraceL)):(++this.pos,this.finishToken(b.backQuote));if(92===n)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(x(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(n)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},We.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if("{"!==this.input[this.pos+1])break;case"`":return this.finishToken(b.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":"\n"===this.input[this.pos+1]&&++this.pos;case"\n":case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,"Unterminated template")},We.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return D(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var n=this.pos-1;this.invalidStringToken(n,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),"0"===r&&56!==t&&57!==t||!this.strict&&!e||this.invalidStringToken(this.pos-1-r.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(i)}return x(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},We.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return null===n&&this.invalidStringToken(t,"Bad character escape sequence"),n},We.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(d(i,r))this.pos+=i<=65535?1:2;else{if(92!==i)break;this.containsEsc=!0,e+=this.input.slice(n,this.pos);var a=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var s=this.readCodePoint();(t?h:d)(s,r)||this.invalidStringToken(a,"Invalid Unicode escape"),e+=D(s),n=this.pos}t=!1}return e+this.input.slice(n,this.pos)},We.readWord=function(){var e=this.readWord1(),t=b.name;return this.keywords.test(e)&&(t=v[e]),this.finishToken(t,e)};var Ke="8.14.0";H.acorn={Parser:H,version:Ke,defaultOptions:V,Position:L,SourceLocation:B,getLineInfo:R,Node:fe,TokenType:f,tokTypes:b,keywordTypes:v,TokContext:re,tokContexts:ie,isIdentifierChar:d,isIdentifierStart:h,Token:Ge,isNewLine:x,lineBreak:_,lineBreakG:w,nonASCIIwhitespace:S},e.Node=fe,e.Parser=H,e.Position=L,e.SourceLocation=B,e.TokContext=re,e.Token=Ge,e.TokenType=f,e.defaultOptions=V,e.getLineInfo=R,e.isIdentifierChar=d,e.isIdentifierStart=h,e.isNewLine=x,e.keywordTypes=v,e.lineBreak=_,e.lineBreakG=w,e.nonASCIIwhitespace=S,e.parse=function(e,t){return H.parse(e,t)},e.parseExpressionAt=function(e,t,n){return H.parseExpressionAt(e,t,n)},e.tokContexts=ie,e.tokTypes=b,e.tokenizer=function(e,t){return H.tokenizer(e,t)},e.version=Ke}(nl.exports)),nl.exports}const il=/* @__PURE__ */Mi((el||(el=1,tl=Xc,function(e,t){var n=(e=e||Zc).window,r=e.document,i=new function(){var e=/^(statics|enumerable|beans|preserve)$/,n=[],r=n.slice,i=Object.create,a=Object.getOwnPropertyDescriptor,s=Object.defineProperty,o=n.forEach||function(e,t){for(var n=0,r=this.length;n<r;n++)e.call(t,this[n],n,this)},c=function(e,t){for(var n in this)this.hasOwnProperty(n)&&e.call(t,this[n],n,this)},l=Object.assign||function(e){for(var t=1,n=arguments.length;t<n;t++){var r=arguments[t];for(var i in r)r.hasOwnProperty(i)&&(e[i]=r[i])}return e},u=function(e,t,n){if(e){var r=a(e,"length");(r&&"number"==typeof r.value?o:c).call(e,t,n=n||e)}return n};function h(t,n,r,i,o){var c={};function l(e,l){"string"==typeof(l=l||(l=a(n,e))&&(l.get?l:l.value))&&"#"===l[0]&&(l=t[l.substring(1)]||l);var u,h="function"==typeof l,f=l,p=o||h&&!l.base?l&&l.get?e in t:t[e]:null;o&&p||(h&&p&&(l.base=p),h&&!1!==i&&(u=e.match(/^([gs]et|is)(([A-Z])(.*))$/))&&(c[u[3].toLowerCase()+u[4]]=u[2]),f&&!h&&f.get&&"function"==typeof f.get&&d.isPlainObject(f)||(f={value:f,writable:!0}),(a(t,e)||{configurable:!0}).configurable&&(f.configurable=!0,f.enumerable=null!=r?r:!u),s(t,e,f))}if(n){for(var u in n)n.hasOwnProperty(u)&&!e.test(u)&&l(u);for(var u in c){var h=c[u],f=t["set"+h],p=t["get"+h]||f&&t["is"+h];!p||!0!==i&&0!==p.length||l(u,{get:p,set:f})}}return t}function d(){for(var e=0,t=arguments.length;e<t;e++){var n=arguments[e];n&&l(this,n)}return this}return h(d,{inject:function(e){if(e){var t=!0===e.statics?e:e.statics,n=e.beans,r=e.preserve;t!==e&&h(this.prototype,e,e.enumerable,n,r),h(this,t,null,n,r)}for(var i=1,a=arguments.length;i<a;i++)this.inject(arguments[i]);return this},extend:function(){for(var e,t,n,r=this,a=0,o=arguments.length;a<o&&(!e||!t);a++)n=arguments[a],e=e||n.initialize,t=t||n.prototype;return e=e||function(){r.apply(this,arguments)},t=e.prototype=t||i(this.prototype),s(t,"constructor",{value:e,writable:!0,configurable:!0}),h(e,this),arguments.length&&this.inject.apply(e,arguments),e.base=r,e}}).inject({enumerable:!1,initialize:d,set:d,inject:function(){for(var e=0,t=arguments.length;e<t;e++){var n=arguments[e];n&&h(this,n,n.enumerable,n.beans,n.preserve)}return this},extend:function(){var e=i(this);return e.inject.apply(e,arguments)},each:function(e,t){return u(this,e,t)},clone:function(){return new this.constructor(this)},statics:{set:l,each:u,create:i,define:s,describe:a,clone:function(e){return l(new e.constructor,e)},isPlainObject:function(e){var t=null!=e&&e.constructor;return t&&(t===Object||t===d||"Object"===t.name)},pick:function(e,n){return e!==t?e:n},slice:function(e,t,n){return r.call(e,t,n)}}})};tl.exports=i,i.inject({enumerable:!1,toString:function(){return null!=this._id?(this._class||"Object")+(this._name?" '"+this._name+"'":" @"+this._id):"{ "+i.each(this,(function(e,t){if(!/^_/.test(t)){var n=typeof e;this.push(t+": "+("number"===n?l.instance.number(e):"string"===n?"'"+e+"'":e))}}),[]).join(", ")+" }"},getClassName:function(){return this._class||""},importJSON:function(e){return i.importJSON(e,this)},exportJSON:function(e){return i.exportJSON(this,e)},toJSON:function(){return i.serialize(this)},set:function(e,t){return e&&i.filter(this,e,t,this._prioritize),this}},{beans:!1,statics:{exports:{},extend:function e(){var t=e.base.apply(this,arguments),n=t.prototype._class;return n&&!i.exports[n]&&(i.exports[n]=t),t},equals:function(e,t){if(e===t)return!0;if(e&&e.equals)return e.equals(t);if(t&&t.equals)return t.equals(e);if(e&&t&&"object"==typeof e&&"object"==typeof t){if(Array.isArray(e)&&Array.isArray(t)){if((n=e.length)!==t.length)return!1;for(;n--;)if(!i.equals(e[n],t[n]))return!1}else{var n,r=Object.keys(e);if((n=r.length)!==Object.keys(t).length)return!1;for(;n--;){var a=r[n];if(!t.hasOwnProperty(a)||!i.equals(e[a],t[a]))return!1}}return!0}return!1},read:function(e,n,r,a){if(this===i){var s=this.peek(e,n);return e.__index++,s}var o=this.prototype,c=o._readIndex,l=n||c&&e.__index||0,u=e.length,h=e[l];if(a=a||u-l,h instanceof this||r&&r.readNull&&null==h&&a<=1)return c&&(e.__index=l+1),h&&r&&r.clone?h.clone():h;if(h=i.create(o),c&&(h.__read=!0),h=h.initialize.apply(h,l>0||l+a<u?i.slice(e,l,l+a):e)||h,c){e.__index=l+h.__read;var d=h.__filtered;d&&(e.__filtered=d,h.__filtered=t),h.__read=t}return h},peek:function(e,t){return e[e.__index=t||e.__index||0]},remain:function(e){return e.length-(e.__index||0)},readList:function(e,t,n,r){for(var i,a=[],s=t||0,o=r?s+r:e.length,c=s;c<o;c++)a.push(Array.isArray(i=e[c])?this.read(i,0,n):this.read(e,c,n,1));return a},readNamed:function(e,n,r,a,s){var o=this.getNamed(e,n),c=o!==t;if(c){var l=e.__filtered;if(!l){var u=this.getSource(e);(l=e.__filtered=i.create(u)).__unfiltered=u}l[n]=t}return this.read(c?[o]:e,r,a,s)},readSupported:function(e,n){var r=this.getSource(e),i=this,a=!1;return r&&Object.keys(r).forEach((function(r){if(r in n){var s=i.readNamed(e,r);s!==t&&(n[r]=s),a=!0}})),a},getSource:function(e){var n=e.__source;if(n===t){var r=1===e.length&&e[0];n=e.__source=r&&i.isPlainObject(r)?r:null}return n},getNamed:function(e,t){var n=this.getSource(e);if(n)return t?n[t]:e.__filtered||n},hasNamed:function(e,t){return!!this.getNamed(e,t)},filter:function(e,n,r,i){var a;function s(i){if(!(r&&i in r||a&&i in a)){var s=n[i];s!==t&&(e[i]=s)}}if(i){for(var o,c={},l=0,u=i.length;l<u;l++)(o=i[l])in n&&(s(o),c[o]=!0);a=c}return Object.keys(n.__unfiltered||n).forEach(s),e},isPlainValue:function(e,t){return i.isPlainObject(e)||Array.isArray(e)||t&&"string"==typeof e},serialize:function(e,t,n,r){t=t||{};var a,s=!r;if(s&&(t.formatter=new l(t.precision),r={length:0,definitions:{},references:{},add:function(e,t){var n="#"+e._id,r=this.references[n];if(!r){this.length++;var i=t.call(e),a=e._class;a&&i[0]!==a&&i.unshift(a),this.definitions[n]=i,r=this.references[n]=[n]}return r}}),e&&e._serialize){a=e._serialize(t,r);var o=e._class;!o||e._compactSerialize||!s&&n||a[0]===o||a.unshift(o)}else if(Array.isArray(e)){a=[];for(var c=0,u=e.length;c<u;c++)a[c]=i.serialize(e[c],t,n,r)}else if(i.isPlainObject(e)){a={};var h=Object.keys(e);for(c=0,u=h.length;c<u;c++){var d=h[c];a[d]=i.serialize(e[d],t,n,r)}}else a="number"==typeof e?t.formatter.number(e,t.precision):e;return s&&r.length>0?[["dictionary",r.definitions],a]:a},deserialize:function(e,t,n,r,a){var s=e,o=!n,c=o&&e&&e.length&&"dictionary"===e[0][0];if(n=n||{},Array.isArray(e)){var l=e[0],u="dictionary"===l;if(1==e.length&&/^#/.test(l))return n.dictionary[l];s=[];for(var h=(l=i.exports[l])?1:0,d=e.length;h<d;h++)s.push(i.deserialize(e[h],t,n,u,c));if(l){var f=s;s=t?t(l,f,o||a):new l(f)}}else if(i.isPlainObject(e))for(var p in s={},r&&(n.dictionary=s),e)s[p]=i.deserialize(e[p],t,n);return c?s[1]:s},exportJSON:function(e,t){var n=i.serialize(e,t);return t&&0==t.asString?n:JSON.stringify(n)},importJSON:function(e,t){return i.deserialize("string"==typeof e?JSON.parse(e):e,(function(e,n,r){var a=r&&t&&t.constructor===e,s=a?t:i.create(e.prototype);if(1===n.length&&s instanceof w&&(a||!(s instanceof k))){var o=n[0];i.isPlainObject(o)&&(o.insert=!1,a&&(n=n.concat([w.INSERT])))}return(a?s.set:e).apply(s,n),a&&(t=null),s}))},push:function(e,t){var n=t.length;if(n<4096)e.push.apply(e,t);else{var r=e.length;e.length+=n;for(var i=0;i<n;i++)e[r+i]=t[i]}return e},splice:function(e,n,r,a){var s=n&&n.length,o=r===t;(r=o?e.length:r)>e.length&&(r=e.length);for(var c=0;c<s;c++)n[c]._index=r+c;if(o)return i.push(e,n),[];var l=[r,a];n&&i.push(l,n);for(var u=e.splice.apply(e,l),h=(c=0,u.length);c<h;c++)u[c]._index=t;for(c=r+s,h=e.length;c<h;c++)e[c]._index=c;return u},capitalize:function(e){return e.replace(/\b[a-z]/g,(function(e){return e.toUpperCase()}))},camelize:function(e){return e.replace(/-(.)/g,(function(e,t){return t.toUpperCase()}))},hyphenate:function(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}}});var a={on:function(e,t){if("string"!=typeof e)i.each(e,(function(e,t){this.on(t,e)}),this);else{var n=this._eventTypes,r=n&&n[e],a=this._callbacks=this._callbacks||{};-1===(a=a[e]=a[e]||[]).indexOf(t)&&(a.push(t),r&&r.install&&1===a.length&&r.install.call(this,e))}return this},off:function(e,t){if("string"==typeof e){var n,r=this._eventTypes,a=r&&r[e],s=this._callbacks&&this._callbacks[e];return s&&(!t||-1!==(n=s.indexOf(t))&&1===s.length?(a&&a.uninstall&&a.uninstall.call(this,e),delete this._callbacks[e]):-1!==n&&s.splice(n,1)),this}i.each(e,(function(e,t){this.off(t,e)}),this)},once:function(e,t){return this.on(e,(function n(){t.apply(this,arguments),this.off(e,n)}))},emit:function(e,t){var n=this._callbacks&&this._callbacks[e];if(!n)return!1;var r=i.slice(arguments,1),a=t&&t.target&&!t.currentTarget;n=n.slice(),a&&(t.currentTarget=this);for(var s=0,o=n.length;s<o;s++)if(0==n[s].apply(this,r)){t&&t.stop&&t.stop();break}return a&&delete t.currentTarget,!0},responds:function(e){return!(!this._callbacks||!this._callbacks[e])},attach:"#on",detach:"#off",fire:"#emit",_installEvents:function(e){var t=this._eventTypes,n=this._callbacks,r=e?"install":"uninstall";if(t)for(var i in n)if(n[i].length>0){var a=t[i],s=a&&a[r];s&&s.call(this,i)}},statics:{inject:function e(t){var n=t._events;if(n){var r={};i.each(n,(function(e,n){var a="string"==typeof e,s=a?e:n,o=i.capitalize(s),c=s.substring(2).toLowerCase();r[c]=a?{}:e,s="_"+s,t["get"+o]=function(){return this[s]},t["set"+o]=function(e){var t=this[s];t&&this.off(c,t),e&&this.on(c,e),this[s]=e}})),t._eventTypes=r}return e.base.apply(this,arguments)}}},s=i.extend({_class:"PaperScope",initialize:function t(){se=this,this.settings=new i({applyMatrix:!0,insertItems:!0,handleSize:4,hitTolerance:0}),this.project=null,this.projects=[],this.tools=[],this._id=t._id++,t._scopes[this._id]=this;var n=t.prototype;if(!this.support){var r=ne.getContext(1,1)||{};n.support={nativeDash:"setLineDash"in r||"mozDash"in r,nativeBlendModes:re.nativeModes},ne.release(r)}if(!this.agent){var a=e.navigator.userAgent.toLowerCase(),s=(/(darwin|win|mac|linux|freebsd|sunos)/.exec(a)||[])[0],o="darwin"===s?"mac":s,c=n.agent=n.browser={platform:o};o&&(c[o]=!0),a.replace(/(opera|chrome|safari|webkit|firefox|msie|trident|atom|node|jsdom)\/?\s*([.\d]+)(?:.*version\/([.\d]+))?(?:.*rv\:v?([.\d]+))?/g,(function(e,t,n,r,i){if(!c.chrome){var a="opera"===t?r:/^(node|trident)$/.test(t)?i:n;c.version=a,c.versionNumber=parseFloat(a),t={trident:"msie",jsdom:"node"}[t]||t,c.name=t,c[t]=!0}})),c.chrome&&delete c.webkit,c.atom&&delete c.chrome}},version:"0.12.18",getView:function(){var e=this.project;return e&&e._view},getPaper:function(){return this},execute:function(e,t){var n=se.PaperScript.execute(e,this,t);return W.updateFocus(),n},install:function(e){var t=this;for(var n in i.each(["project","view","tool"],(function(n){i.define(e,n,{configurable:!0,get:function(){return t[n]}})})),this)!/^_/.test(n)&&this[n]&&(e[n]=this[n])},setup:function(e){return se=this,this.project=new _(e),this},createCanvas:function(e,t){return ne.getCanvas(e,t)},activate:function(){se=this},clear:function(){for(var e=this.projects,t=this.tools,n=e.length-1;n>=0;n--)e[n].remove();for(n=t.length-1;n>=0;n--)t[n].remove()},remove:function(){this.clear(),delete s._scopes[this._id]},statics:new function(){function e(e){return e+="Attribute",function(t,n){return t[e](n)||t[e]("data-paper-"+n)}}return{_scopes:{},_id:0,get:function(e){return this._scopes[e]||null},getAttribute:e("get"),hasAttribute:e("has")}}}),o=i.extend(a,{initialize:function(e){this._scope=se,this._index=this._scope[this._list].push(this)-1,!e&&this._scope[this._reference]||this.activate()},activate:function(){if(!this._scope)return!1;var e=this._scope[this._reference];return e&&e!==this&&e.emit("deactivate"),this._scope[this._reference]=this,this.emit("activate",e),!0},isActive:function(){return this._scope[this._reference]===this},remove:function(){return null!=this._index&&(i.splice(this._scope[this._list],null,this._index,1),this._scope[this._reference]==this&&(this._scope[this._reference]=null),this._scope=null,!0)},getView:function(){return this._scope.getView()}}),c={findItemBoundsCollisions:function(e,t,n){function r(e){for(var t=new Array(e.length),n=0;n<e.length;n++){var r=e[n].getBounds();t[n]=[r.left,r.top,r.right,r.bottom]}return t}var i=r(e),a=t&&t!==e?r(t):i;return this.findBoundsCollisions(i,a,n||0)},findCurveBoundsCollisions:function(e,t,n,r){function i(e){for(var t=Math.min,n=Math.max,r=new Array(e.length),i=0;i<e.length;i++){var a=e[i];r[i]=[t(a[0],a[2],a[4],a[6]),t(a[1],a[3],a[5],a[7]),n(a[0],a[2],a[4],a[6]),n(a[1],a[3],a[5],a[7])]}return r}var a=i(e),s=t&&t!==e?i(t):a;if(r){for(var o=this.findBoundsCollisions(a,s,n||0,!1,!0),c=this.findBoundsCollisions(a,s,n||0,!0,!0),l=[],u=0,h=o.length;u<h;u++)l[u]={hor:o[u],ver:c[u]};return l}return this.findBoundsCollisions(a,s,n||0)},findBoundsCollisions:function(e,t,n,r,i){var a=!t||e===t,s=a?e:e.concat(t),o=e.length,c=s.length;function l(e,t,n){for(var r=0,i=e.length;r<i;){var a=i+r>>>1;s[e[a]][t]<n?r=a+1:i=a}return r-1}for(var u=r?1:0,h=u+2,d=r?0:1,f=d+2,p=new Array(c),m=0;m<c;m++)p[m]=m;p.sort((function(e,t){return s[e][u]-s[t][u]}));var g=[],v=new Array(o);for(m=0;m<c;m++){var y=p[m],b=s[y],_=a?y:y-o,w=y<o,x=a||!w,k=w?[]:null;if(g.length){var S=l(g,h,b[u]-n)+1;if(g.splice(0,S),a&&i){k=k.concat(g);for(var C=0;C<g.length;C++)v[T=g[C]].push(_)}else{var M=b[f],E=b[d];for(C=0;C<g.length;C++){var T=g[C],A=s[T],P=T<o,I=a||T>=o;(i||(w&&I||x&&P)&&M>=A[d]-n&&E<=A[f]+n)&&(w&&I&&k.push(a?T:T-o),x&&P&&v[T].push(_))}}}if(w&&(e===t&&k.push(y),v[y]=k),g.length){var N=l(g,h,b[h]);g.splice(N+1,0,y)}else g.push(y)}for(m=0;m<v.length;m++){var D=v[m];D&&D.sort((function(e,t){return e-t}))}return v}},l=i.extend({initialize:function(e){this.precision=i.pick(e,5),this.multiplier=Math.pow(10,this.precision)},number:function(e){return this.precision<16?Math.round(e*this.multiplier)/this.multiplier:e},pair:function(e,t,n){return this.number(e)+(n||",")+this.number(t)},point:function(e,t){return this.number(e.x)+(t||",")+this.number(e.y)},size:function(e,t){return this.number(e.width)+(t||",")+this.number(e.height)},rectangle:function(e,t){return this.point(e,t)+(t||",")+this.size(e,t)}});l.instance=new l;var u=new function(){var e=[[.5773502691896257],[0,.7745966692414834],[.33998104358485626,.8611363115940526],[0,.5384693101056831,.906179845938664],[.2386191860831969,.6612093864662645,.932469514203152],[0,.4058451513773972,.7415311855993945,.9491079123427585],[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499]],t=[[1],[.8888888888888888,.5555555555555556],[.6521451548625461,.34785484513745385],[.5688888888888889,.47862867049936647,.23692688505618908],[.46791393457269104,.3607615730481386,.17132449237917036],[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096]],n=Math.abs,r=Math.sqrt,i=Math.pow,a=Math.log2||function(e){return Math.log(e)*Math.LOG2E},s=1e-12,o=112e-18;function c(e,t,n){return e<t?t:e>n?n:e}function l(e,t,r){function i(e){var t=134217729*e,n=e-t+t;return[n,e-n]}var a=t*t-e*r,s=t*t+e*r;if(3*n(a)<s){var o=i(e),c=i(t),l=i(r),u=t*t,h=e*r;a=u-h+(c[0]*c[0]-u+2*c[0]*c[1]+c[1]*c[1]-(o[0]*l[0]-h+o[0]*l[1]+o[1]*l[0]+o[1]*l[1]))}return a}function h(){var e=Math.max.apply(Math,arguments);return e&&(e<1e-8||e>1e8)?i(2,-Math.round(a(e))):0}return{EPSILON:s,MACHINE_EPSILON:o,CURVETIME_EPSILON:1e-8,GEOMETRIC_EPSILON:1e-7,TRIGONOMETRIC_EPSILON:1e-8,ANGULAR_EPSILON:1e-5,KAPPA:4*(r(2)-1)/3,isZero:function(e){return e>=-1e-12&&e<=s},isMachineZero:function(e){return e>=-112e-18&&e<=o},clamp:c,integrate:function(n,r,i,a){for(var s=e[a-2],o=t[a-2],c=.5*(i-r),l=c+r,u=0,h=a+1>>1,d=1&a?o[u++]*n(l):0;u<h;){var f=c*s[u];d+=o[u++]*(n(l+f)+n(l-f))}return c*d},findRoot:function(e,t,r,i,a,s,o){for(var l=0;l<s;l++){var u=e(r),h=u/t(r),d=r-h;if(n(h)<o){r=d;break}u>0?(a=r,r=d<=i?.5*(i+a):d):(i=r,r=d>=a?.5*(i+a):d)}return c(r,i,a)},solveQuadratic:function(e,t,i,a,u,d){var f,p=1/0;if(n(e)<s){if(n(t)<s)return n(i)<s?-1:0;f=-i/t}else{var m=l(e,t*=-.5,i);if(m&&n(m)<o){var g=h(n(e),n(t),n(i));g&&(m=l(e*=g,t*=g,i*=g))}if(m>=-112e-18){var v=m<0?0:r(m),y=t+(t<0?-v:v);0===y?p=-(f=i/e):(f=y/e,p=i/y)}}var b=0,_=null==u,w=u-s,x=d+s;return isFinite(f)&&(_||f>w&&f<x)&&(a[b++]=_?f:c(f,u,d)),p!==f&&isFinite(p)&&(_||p>w&&p<x)&&(a[b++]=_?p:c(p,u,d)),b},solveCubic:function(e,t,a,l,d,f,p){var m,g,v,y,b,_=h(n(e),n(t),n(a),n(l));function w(n){var r=e*(m=n);y=(r+(g=r+t))*m+(v=g*m+a),b=v*m+l}if(_&&(e*=_,t*=_,a*=_,l*=_),n(e)<s)e=t,g=a,v=l,m=1/0;else if(n(l)<s)g=t,v=a,m=0;else{w(-t/e/3);var x=b/e,k=i(n(x),1/3),S=x<0?-1:1,C=-y/e,M=C>0?1.324717957244746*Math.max(k,r(C)):k,E=m-S*M;if(E!==m){do{w(E),E=0===y?m:m-b/y/(1+o)}while(S*E>S*m);n(e)*m*m>n(l/m)&&(g=((v=-l/m)-a)/m)}}var T=u.solveQuadratic(e,g,v,d,f,p),A=null==f;return isFinite(m)&&(0===T||T>0&&m!==d[0]&&m!==d[1])&&(A||m>f-s&&m<p+s)&&(d[T++]=A?m:c(m,f,p)),T}}},h={_id:1,_pools:{},get:function(e){if(e){var t=this._pools[e];return t||(t=this._pools[e]={_id:1}),t._id++}return this._id++}},d=i.extend({_class:"Point",_readIndex:!0,initialize:function(e,t){var n=typeof e,r=this.__read,i=0;if("number"===n){var a="number"==typeof t;this._set(e,a?t:e),r&&(i=a?2:1)}else if("undefined"===n||null===e)this._set(0,0),r&&(i=null===e?1:0);else{var s="string"===n?e.split(/[\s,]+/)||[]:e;i=1,Array.isArray(s)?this._set(+s[0],+(s.length>1?s[1]:s[0])):"x"in s?this._set(s.x||0,s.y||0):"width"in s?this._set(s.width||0,s.height||0):"angle"in s?(this._set(s.length||0,0),this.setAngle(s.angle||0)):(this._set(0,0),i=0)}return r&&(this.__read=i),this},set:"#initialize",_set:function(e,t){return this.x=e,this.y=t,this},equals:function(e){return this===e||e&&(this.x===e.x&&this.y===e.y||Array.isArray(e)&&this.x===e[0]&&this.y===e[1])||!1},clone:function(){return new d(this.x,this.y)},toString:function(){var e=l.instance;return"{ x: "+e.number(this.x)+", y: "+e.number(this.y)+" }"},_serialize:function(e){var t=e.formatter;return[t.number(this.x),t.number(this.y)]},getLength:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},setLength:function(e){if(this.isZero()){var t=this._angle||0;this._set(Math.cos(t)*e,Math.sin(t)*e)}else{var n=e/this.getLength();u.isZero(n)&&this.getAngle(),this._set(this.x*n,this.y*n)}},getAngle:function(){return 180*this.getAngleInRadians.apply(this,arguments)/Math.PI},setAngle:function(e){this.setAngleInRadians.call(this,e*Math.PI/180)},getAngleInDegrees:"#getAngle",setAngleInDegrees:"#setAngle",getAngleInRadians:function(){if(arguments.length){var e=d.read(arguments),t=this.getLength()*e.getLength();if(u.isZero(t))return NaN;var n=this.dot(e)/t;return Math.acos(n<-1?-1:n>1?1:n)}return this.isZero()?this._angle||0:this._angle=Math.atan2(this.y,this.x)},setAngleInRadians:function(e){if(this._angle=e,!this.isZero()){var t=this.getLength();this._set(Math.cos(e)*t,Math.sin(e)*t)}},getQuadrant:function(){return this.x>=0?this.y>=0?1:4:this.y>=0?2:3}},{beans:!1,getDirectedAngle:function(){var e=d.read(arguments);return 180*Math.atan2(this.cross(e),this.dot(e))/Math.PI},getDistance:function(){var e=arguments,t=d.read(e),n=t.x-this.x,r=t.y-this.y,a=n*n+r*r;return i.read(e)?a:Math.sqrt(a)},normalize:function(e){e===t&&(e=1);var n=this.getLength(),r=0!==n?e/n:0,i=new d(this.x*r,this.y*r);return r>=0&&(i._angle=this._angle),i},rotate:function(e,t){if(0===e)return this.clone();e=e*Math.PI/180;var n=t?this.subtract(t):this,r=Math.sin(e),i=Math.cos(e);return n=new d(n.x*i-n.y*r,n.x*r+n.y*i),t?n.add(t):n},transform:function(e){return e?e._transformPoint(this):this},add:function(){var e=d.read(arguments);return new d(this.x+e.x,this.y+e.y)},subtract:function(){var e=d.read(arguments);return new d(this.x-e.x,this.y-e.y)},multiply:function(){var e=d.read(arguments);return new d(this.x*e.x,this.y*e.y)},divide:function(){var e=d.read(arguments);return new d(this.x/e.x,this.y/e.y)},modulo:function(){var e=d.read(arguments);return new d(this.x%e.x,this.y%e.y)},negate:function(){return new d(-this.x,-this.y)},isInside:function(){return g.read(arguments).contains(this)},isClose:function(){var e=arguments,t=d.read(e),n=i.read(e);return this.getDistance(t)<=n},isCollinear:function(){var e=d.read(arguments);return d.isCollinear(this.x,this.y,e.x,e.y)},isColinear:"#isCollinear",isOrthogonal:function(){var e=d.read(arguments);return d.isOrthogonal(this.x,this.y,e.x,e.y)},isZero:function(){var e=u.isZero;return e(this.x)&&e(this.y)},isNaN:function(){return isNaN(this.x)||isNaN(this.y)},isInQuadrant:function(e){return this.x*(e>1&&e<4?-1:1)>=0&&this.y*(e>2?-1:1)>=0},dot:function(){var e=d.read(arguments);return this.x*e.x+this.y*e.y},cross:function(){var e=d.read(arguments);return this.x*e.y-this.y*e.x},project:function(){var e=d.read(arguments),t=e.isZero()?0:this.dot(e)/e.dot(e);return new d(e.x*t,e.y*t)},statics:{min:function(){var e=arguments,t=d.read(e),n=d.read(e);return new d(Math.min(t.x,n.x),Math.min(t.y,n.y))},max:function(){var e=arguments,t=d.read(e),n=d.read(e);return new d(Math.max(t.x,n.x),Math.max(t.y,n.y))},random:function(){return new d(Math.random(),Math.random())},isCollinear:function(e,t,n,r){return Math.abs(e*r-t*n)<=1e-8*Math.sqrt((e*e+t*t)*(n*n+r*r))},isOrthogonal:function(e,t,n,r){return Math.abs(e*n+t*r)<=1e-8*Math.sqrt((e*e+t*t)*(n*n+r*r))}}},i.each(["round","ceil","floor","abs"],(function(e){var t=Math[e];this[e]=function(){return new d(t(this.x),t(this.y))}}),{})),f=d.extend({initialize:function(e,t,n,r){this._x=e,this._y=t,this._owner=n,this._setter=r},_set:function(e,t,n){return this._x=e,this._y=t,n||this._owner[this._setter](this),this},getX:function(){return this._x},setX:function(e){this._x=e,this._owner[this._setter](this)},getY:function(){return this._y},setY:function(e){this._y=e,this._owner[this._setter](this)},isSelected:function(){return!!(this._owner._selection&this._getSelection())},setSelected:function(e){this._owner._changeSelection(this._getSelection(),e)},_getSelection:function(){return"setPosition"===this._setter?4:0}}),p=i.extend({_class:"Size",_readIndex:!0,initialize:function(e,t){var n=typeof e,r=this.__read,i=0;if("number"===n){var a="number"==typeof t;this._set(e,a?t:e),r&&(i=a?2:1)}else if("undefined"===n||null===e)this._set(0,0),r&&(i=null===e?1:0);else{var s="string"===n?e.split(/[\s,]+/)||[]:e;i=1,Array.isArray(s)?this._set(+s[0],+(s.length>1?s[1]:s[0])):"width"in s?this._set(s.width||0,s.height||0):"x"in s?this._set(s.x||0,s.y||0):(this._set(0,0),i=0)}return r&&(this.__read=i),this},set:"#initialize",_set:function(e,t){return this.width=e,this.height=t,this},equals:function(e){return e===this||e&&(this.width===e.width&&this.height===e.height||Array.isArray(e)&&this.width===e[0]&&this.height===e[1])||!1},clone:function(){return new p(this.width,this.height)},toString:function(){var e=l.instance;return"{ width: "+e.number(this.width)+", height: "+e.number(this.height)+" }"},_serialize:function(e){var t=e.formatter;return[t.number(this.width),t.number(this.height)]},add:function(){var e=p.read(arguments);return new p(this.width+e.width,this.height+e.height)},subtract:function(){var e=p.read(arguments);return new p(this.width-e.width,this.height-e.height)},multiply:function(){var e=p.read(arguments);return new p(this.width*e.width,this.height*e.height)},divide:function(){var e=p.read(arguments);return new p(this.width/e.width,this.height/e.height)},modulo:function(){var e=p.read(arguments);return new p(this.width%e.width,this.height%e.height)},negate:function(){return new p(-this.width,-this.height)},isZero:function(){var e=u.isZero;return e(this.width)&&e(this.height)},isNaN:function(){return isNaN(this.width)||isNaN(this.height)},statics:{min:function(e,t){return new p(Math.min(e.width,t.width),Math.min(e.height,t.height))},max:function(e,t){return new p(Math.max(e.width,t.width),Math.max(e.height,t.height))},random:function(){return new p(Math.random(),Math.random())}}},i.each(["round","ceil","floor","abs"],(function(e){var t=Math[e];this[e]=function(){return new p(t(this.width),t(this.height))}}),{})),m=p.extend({initialize:function(e,t,n,r){this._width=e,this._height=t,this._owner=n,this._setter=r},_set:function(e,t,n){return this._width=e,this._height=t,n||this._owner[this._setter](this),this},getWidth:function(){return this._width},setWidth:function(e){this._width=e,this._owner[this._setter](this)},getHeight:function(){return this._height},setHeight:function(e){this._height=e,this._owner[this._setter](this)}}),g=i.extend({_class:"Rectangle",_readIndex:!0,beans:!0,initialize:function(e,n,r,a){var s,o=arguments,c=typeof e;if("number"===c?(this._set(e,n,r,a),s=4):"undefined"===c||null===e?(this._set(0,0,0,0),s=null===e?1:0):1===o.length&&(Array.isArray(e)?(this._set.apply(this,e),s=1):e.x!==t||e.width!==t?(this._set(e.x||0,e.y||0,e.width||0,e.height||0),s=1):e.from===t&&e.to===t&&(this._set(0,0,0,0),i.readSupported(o,this)&&(s=1))),s===t){var l,u,h=d.readNamed(o,"from"),f=i.peek(o),m=h.x,g=h.y;if(f&&f.x!==t||i.hasNamed(o,"to")){var v=d.readNamed(o,"to");l=v.x-m,u=v.y-g,l<0&&(m=v.x,l=-l),u<0&&(g=v.y,u=-u)}else{var y=p.read(o);l=y.width,u=y.height}this._set(m,g,l,u),s=o.__index}var b=o.__filtered;return b&&(this.__filtered=b),this.__read&&(this.__read=s),this},set:"#initialize",_set:function(e,t,n,r){return this.x=e,this.y=t,this.width=n,this.height=r,this},clone:function(){return new g(this.x,this.y,this.width,this.height)},equals:function(e){var t=i.isPlainValue(e)?g.read(arguments):e;return t===this||t&&this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height||!1},toString:function(){var e=l.instance;return"{ x: "+e.number(this.x)+", y: "+e.number(this.y)+", width: "+e.number(this.width)+", height: "+e.number(this.height)+" }"},_serialize:function(e){var t=e.formatter;return[t.number(this.x),t.number(this.y),t.number(this.width),t.number(this.height)]},getPoint:function(e){return new(e?d:f)(this.x,this.y,this,"setPoint")},setPoint:function(){var e=d.read(arguments);this.x=e.x,this.y=e.y},getSize:function(e){return new(e?p:m)(this.width,this.height,this,"setSize")},_fw:1,_fh:1,setSize:function(){var e=p.read(arguments),t=this._sx,n=this._sy,r=e.width,i=e.height;t&&(this.x+=(this.width-r)*t),n&&(this.y+=(this.height-i)*n),this.width=r,this.height=i,this._fw=this._fh=1},getLeft:function(){return this.x},setLeft:function(e){if(!this._fw){var t=e-this.x;this.width-=.5===this._sx?2*t:t}this.x=e,this._sx=this._fw=0},getTop:function(){return this.y},setTop:function(e){if(!this._fh){var t=e-this.y;this.height-=.5===this._sy?2*t:t}this.y=e,this._sy=this._fh=0},getRight:function(){return this.x+this.width},setRight:function(e){if(!this._fw){var t=e-this.x;this.width=.5===this._sx?2*t:t}this.x=e-this.width,this._sx=1,this._fw=0},getBottom:function(){return this.y+this.height},setBottom:function(e){if(!this._fh){var t=e-this.y;this.height=.5===this._sy?2*t:t}this.y=e-this.height,this._sy=1,this._fh=0},getCenterX:function(){return this.x+this.width/2},setCenterX:function(e){this._fw||.5===this._sx?this.x=e-this.width/2:(this._sx&&(this.x+=2*(e-this.x)*this._sx),this.width=2*(e-this.x)),this._sx=.5,this._fw=0},getCenterY:function(){return this.y+this.height/2},setCenterY:function(e){this._fh||.5===this._sy?this.y=e-this.height/2:(this._sy&&(this.y+=2*(e-this.y)*this._sy),this.height=2*(e-this.y)),this._sy=.5,this._fh=0},getCenter:function(e){return new(e?d:f)(this.getCenterX(),this.getCenterY(),this,"setCenter")},setCenter:function(){var e=d.read(arguments);return this.setCenterX(e.x),this.setCenterY(e.y),this},getArea:function(){return this.width*this.height},isEmpty:function(){return 0===this.width||0===this.height},contains:function(e){return e&&e.width!==t||4===(Array.isArray(e)?e:arguments).length?this._containsRectangle(g.read(arguments)):this._containsPoint(d.read(arguments))},_containsPoint:function(e){var t=e.x,n=e.y;return t>=this.x&&n>=this.y&&t<=this.x+this.width&&n<=this.y+this.height},_containsRectangle:function(e){var t=e.x,n=e.y;return t>=this.x&&n>=this.y&&t+e.width<=this.x+this.width&&n+e.height<=this.y+this.height},intersects:function(){var e=g.read(arguments),t=i.read(arguments)||0;return e.x+e.width>this.x-t&&e.y+e.height>this.y-t&&e.x<this.x+this.width+t&&e.y<this.y+this.height+t},intersect:function(){var e=g.read(arguments),t=Math.max(this.x,e.x),n=Math.max(this.y,e.y),r=Math.min(this.x+this.width,e.x+e.width),i=Math.min(this.y+this.height,e.y+e.height);return new g(t,n,r-t,i-n)},unite:function(){var e=g.read(arguments),t=Math.min(this.x,e.x),n=Math.min(this.y,e.y),r=Math.max(this.x+this.width,e.x+e.width),i=Math.max(this.y+this.height,e.y+e.height);return new g(t,n,r-t,i-n)},include:function(){var e=d.read(arguments),t=Math.min(this.x,e.x),n=Math.min(this.y,e.y),r=Math.max(this.x+this.width,e.x),i=Math.max(this.y+this.height,e.y);return new g(t,n,r-t,i-n)},expand:function(){var e=p.read(arguments),t=e.width,n=e.height;return new g(this.x-t/2,this.y-n/2,this.width+t,this.height+n)},scale:function(e,n){return this.expand(this.width*e-this.width,this.height*(n===t?e:n)-this.height)}},i.each([["Top","Left"],["Top","Right"],["Bottom","Left"],["Bottom","Right"],["Left","Center"],["Top","Center"],["Right","Center"],["Bottom","Center"]],(function(e,t){var n=e.join(""),r=/^[RL]/.test(n);t>=4&&(e[1]+=r?"Y":"X");var i=e[r?0:1],a=e[r?1:0],s="get"+i,o="get"+a,c="set"+i,l="set"+a,u="set"+n;this["get"+n]=function(e){return new(e?d:f)(this[s](),this[o](),this,u)},this[u]=function(){var e=d.read(arguments);this[c](e.x),this[l](e.y)}}),{beans:!0})),v=g.extend({initialize:function(e,t,n,r,i,a){this._set(e,t,n,r,!0),this._owner=i,this._setter=a},_set:function(e,t,n,r,i){return this._x=e,this._y=t,this._width=n,this._height=r,i||this._owner[this._setter](this),this}},new function(){var e=g.prototype;return i.each(["x","y","width","height"],(function(e){var t=i.capitalize(e),n="_"+e;this["get"+t]=function(){return this[n]},this["set"+t]=function(e){this[n]=e,this._dontNotify||this._owner[this._setter](this)}}),i.each(["Point","Size","Center","Left","Top","Right","Bottom","CenterX","CenterY","TopLeft","TopRight","BottomLeft","BottomRight","LeftCenter","TopCenter","RightCenter","BottomCenter"],(function(t){var n="set"+t;this[n]=function(){this._dontNotify=!0,e[n].apply(this,arguments),this._dontNotify=!1,this._owner[this._setter](this)}}),{isSelected:function(){return!!(2&this._owner._selection)},setSelected:function(e){var t=this._owner;t._changeSelection&&t._changeSelection(2,e)}}))}),y=i.extend({_class:"Matrix",initialize:function e(t,n){var r=arguments,i=r.length,a=!0;if(i>=6?this._set.apply(this,r):1===i||2===i?t instanceof e?this._set(t._a,t._b,t._c,t._d,t._tx,t._ty,n):Array.isArray(t)?this._set.apply(this,n?t.concat([n]):t):a=!1:i?a=!1:this.reset(),!a)throw new Error("Unsupported matrix parameters");return this},set:"#initialize",_set:function(e,t,n,r,i,a,s){return this._a=e,this._b=t,this._c=n,this._d=r,this._tx=i,this._ty=a,s||this._changed(),this},_serialize:function(e,t){return i.serialize(this.getValues(),e,!0,t)},_changed:function(){var e=this._owner;e&&(e._applyMatrix?e.transform(null,!0):e._changed(25))},clone:function(){return new y(this._a,this._b,this._c,this._d,this._tx,this._ty)},equals:function(e){return e===this||e&&this._a===e._a&&this._b===e._b&&this._c===e._c&&this._d===e._d&&this._tx===e._tx&&this._ty===e._ty},toString:function(){var e=l.instance;return"[["+[e.number(this._a),e.number(this._c),e.number(this._tx)].join(", ")+"], ["+[e.number(this._b),e.number(this._d),e.number(this._ty)].join(", ")+"]]"},reset:function(e){return this._a=this._d=1,this._b=this._c=this._tx=this._ty=0,e||this._changed(),this},apply:function(e,t){var n=this._owner;return!!n&&(n.transform(null,i.pick(e,!0),t),this.isIdentity())},translate:function(){var e=d.read(arguments),t=e.x,n=e.y;return this._tx+=t*this._a+n*this._c,this._ty+=t*this._b+n*this._d,this._changed(),this},scale:function(){var e=arguments,t=d.read(e),n=d.read(e,0,{readNull:!0});return n&&this.translate(n),this._a*=t.x,this._b*=t.x,this._c*=t.y,this._d*=t.y,n&&this.translate(n.negate()),this._changed(),this},rotate:function(e){e*=Math.PI/180;var t=d.read(arguments,1),n=t.x,r=t.y,i=Math.cos(e),a=Math.sin(e),s=n-n*i+r*a,o=r-n*a-r*i,c=this._a,l=this._b,u=this._c,h=this._d;return this._a=i*c+a*u,this._b=i*l+a*h,this._c=-a*c+i*u,this._d=-a*l+i*h,this._tx+=s*c+o*u,this._ty+=s*l+o*h,this._changed(),this},shear:function(){var e=arguments,t=d.read(e),n=d.read(e,0,{readNull:!0});n&&this.translate(n);var r=this._a,i=this._b;return this._a+=t.y*this._c,this._b+=t.y*this._d,this._c+=t.x*r,this._d+=t.x*i,n&&this.translate(n.negate()),this._changed(),this},skew:function(){var e=arguments,t=d.read(e),n=d.read(e,0,{readNull:!0}),r=Math.PI/180,i=new d(Math.tan(t.x*r),Math.tan(t.y*r));return this.shear(i,n)},append:function(e,t){if(e){var n=this._a,r=this._b,i=this._c,a=this._d,s=e._a,o=e._c,c=e._b,l=e._d,u=e._tx,h=e._ty;this._a=s*n+c*i,this._c=o*n+l*i,this._b=s*r+c*a,this._d=o*r+l*a,this._tx+=u*n+h*i,this._ty+=u*r+h*a,t||this._changed()}return this},prepend:function(e,t){if(e){var n=this._a,r=this._b,i=this._c,a=this._d,s=this._tx,o=this._ty,c=e._a,l=e._c,u=e._b,h=e._d,d=e._tx,f=e._ty;this._a=c*n+l*r,this._c=c*i+l*a,this._b=u*n+h*r,this._d=u*i+h*a,this._tx=c*s+l*o+d,this._ty=u*s+h*o+f,t||this._changed()}return this},appended:function(e){return this.clone().append(e)},prepended:function(e){return this.clone().prepend(e)},invert:function(){var e=this._a,t=this._b,n=this._c,r=this._d,i=this._tx,a=this._ty,s=e*r-t*n,o=null;return s&&!isNaN(s)&&isFinite(i)&&isFinite(a)&&(this._a=r/s,this._b=-t/s,this._c=-n/s,this._d=e/s,this._tx=(n*a-r*i)/s,this._ty=(t*i-e*a)/s,o=this),o},inverted:function(){return this.clone().invert()},concatenate:"#append",preConcatenate:"#prepend",chain:"#appended",_shiftless:function(){return new y(this._a,this._b,this._c,this._d,0,0)},_orNullIfIdentity:function(){return this.isIdentity()?null:this},isIdentity:function(){return 1===this._a&&0===this._b&&0===this._c&&1===this._d&&0===this._tx&&0===this._ty},isInvertible:function(){var e=this._a*this._d-this._c*this._b;return e&&!isNaN(e)&&isFinite(this._tx)&&isFinite(this._ty)},isSingular:function(){return!this.isInvertible()},transform:function(e,t,n){return arguments.length<3?this._transformPoint(d.read(arguments)):this._transformCoordinates(e,t,n)},_transformPoint:function(e,t,n){var r=e.x,i=e.y;return t||(t=new d),t._set(r*this._a+i*this._c+this._tx,r*this._b+i*this._d+this._ty,n)},_transformCoordinates:function(e,t,n){for(var r=0,i=2*n;r<i;r+=2){var a=e[r],s=e[r+1];t[r]=a*this._a+s*this._c+this._tx,t[r+1]=a*this._b+s*this._d+this._ty}return t},_transformCorners:function(e){var t=e.x,n=e.y,r=t+e.width,i=n+e.height,a=[t,n,r,n,r,i,t,i];return this._transformCoordinates(a,a,4)},_transformBounds:function(e,t,n){for(var r=this._transformCorners(e),i=r.slice(0,2),a=i.slice(),s=2;s<8;s++){var o=r[s],c=1&s;o<i[c]?i[c]=o:o>a[c]&&(a[c]=o)}return t||(t=new g),t._set(i[0],i[1],a[0]-i[0],a[1]-i[1],n)},inverseTransform:function(){return this._inverseTransform(d.read(arguments))},_inverseTransform:function(e,t,n){var r=this._a,i=this._b,a=this._c,s=this._d,o=this._tx,c=this._ty,l=r*s-i*a,u=null;if(l&&!isNaN(l)&&isFinite(o)&&isFinite(c)){var h=e.x-this._tx,f=e.y-this._ty;t||(t=new d),u=t._set((h*s-f*a)/l,(f*r-h*i)/l,n)}return u},decompose:function(){var e,t,n,r=this._a,i=this._b,a=this._c,s=this._d,o=r*s-i*a,c=Math.sqrt,l=Math.atan2,u=180/Math.PI;if(0!==r||0!==i){var h=c(r*r+i*i);e=Math.acos(r/h)*(i>0?1:-1),t=[h,o/h],n=[l(r*a+i*s,h*h),0]}else if(0!==a||0!==s){var f=c(a*a+s*s);e=Math.asin(a/f)*(s>0?1:-1),t=[o/f,f],n=[0,l(r*a+i*s,f*f)]}else e=0,n=t=[0,0];return{translation:this.getTranslation(),rotation:e*u,scaling:new d(t),skewing:new d(n[0]*u,n[1]*u)}},getValues:function(){return[this._a,this._b,this._c,this._d,this._tx,this._ty]},getTranslation:function(){return new d(this._tx,this._ty)},getScaling:function(){return this.decompose().scaling},getRotation:function(){return this.decompose().rotation},applyToContext:function(e){this.isIdentity()||e.transform(this._a,this._b,this._c,this._d,this._tx,this._ty)}},i.each(["a","b","c","d","tx","ty"],(function(e){var t=i.capitalize(e),n="_"+e;this["get"+t]=function(){return this[n]},this["set"+t]=function(e){this[n]=e,this._changed()}}),{})),b=i.extend({_class:"Line",initialize:function(e,t,n,r,i){var a=!1;arguments.length>=4?(this._px=e,this._py=t,this._vx=n,this._vy=r,a=i):(this._px=e.x,this._py=e.y,this._vx=t.x,this._vy=t.y,a=n),a||(this._vx-=this._px,this._vy-=this._py)},getPoint:function(){return new d(this._px,this._py)},getVector:function(){return new d(this._vx,this._vy)},getLength:function(){return this.getVector().getLength()},intersect:function(e,t){return b.intersect(this._px,this._py,this._vx,this._vy,e._px,e._py,e._vx,e._vy,!0,t)},getSide:function(e,t){return b.getSide(this._px,this._py,this._vx,this._vy,e.x,e.y,!0,t)},getDistance:function(e){return Math.abs(this.getSignedDistance(e))},getSignedDistance:function(e){return b.getSignedDistance(this._px,this._py,this._vx,this._vy,e.x,e.y,!0)},isCollinear:function(e){return d.isCollinear(this._vx,this._vy,e._vx,e._vy)},isOrthogonal:function(e){return d.isOrthogonal(this._vx,this._vy,e._vx,e._vy)},statics:{intersect:function(e,t,n,r,i,a,s,o,c,l){c||(n-=e,r-=t,s-=i,o-=a);var h=n*o-r*s;if(!u.isMachineZero(h)){var f=e-i,p=t-a,m=(s*p-o*f)/h,g=(n*p-r*f)/h,v=-1e-12,y=1+1e-12;if(l||v<m&&m<y&&v<g&&g<y)return l||(m=m<=0?0:m>=1?1:m),new d(e+m*n,t+m*r)}},getSide:function(e,t,n,r,i,a,s,o){s||(n-=e,r-=t);var c=i-e,l=c*r-(a-t)*n;return!o&&u.isMachineZero(l)&&(l=(c*n+c*n)/(n*n+r*r))>=0&&l<=1&&(l=0),l<0?-1:l>0?1:0},getSignedDistance:function(e,t,n,r,i,a,s){return s||(n-=e,r-=t),0===n?r>0?i-e:e-i:0===r?n<0?a-t:t-a:((i-e)*r-(a-t)*n)/(r>n?r*Math.sqrt(1+n*n/(r*r)):n*Math.sqrt(1+r*r/(n*n)))},getDistance:function(e,t,n,r,i,a,s){return Math.abs(b.getSignedDistance(e,t,n,r,i,a,s))}}}),_=o.extend({_class:"Project",_list:"projects",_reference:"project",_compactSerialize:!0,initialize:function(e){o.call(this,!0),this._children=[],this._namedChildren={},this._activeLayer=null,this._currentStyle=new H(null,null,this),this._view=W.create(this,e||ne.getCanvas(1,1)),this._selectionItems={},this._selectionCount=0,this._updateVersion=0},_serialize:function(e,t){return i.serialize(this._children,e,!0,t)},_changed:function(e,t){if(1&e){var n=this._view;n&&(n._needsUpdate=!0,!n._requested&&n._autoUpdate&&n.requestUpdate())}var r=this._changes;if(r&&t){var i=this._changesById,a=t._id,s=i[a];s?s.flags|=e:r.push(i[a]={item:t,flags:e})}},clear:function(){for(var e=this._children,t=e.length-1;t>=0;t--)e[t].remove()},isEmpty:function(){return!this._children.length},remove:function e(){return!!e.base.call(this)&&(this._view&&this._view.remove(),!0)},getView:function(){return this._view},getCurrentStyle:function(){return this._currentStyle},setCurrentStyle:function(e){this._currentStyle.set(e)},getIndex:function(){return this._index},getOptions:function(){return this._scope.settings},getLayers:function(){return this._children},getActiveLayer:function(){return this._activeLayer||new k({project:this,insert:!0})},getSymbolDefinitions:function(){var e=[],t={};return this.getItems({class:M,match:function(n){var r=n._definition,i=r._id;return t[i]||(t[i]=!0,e.push(r)),!1}}),e},getSymbols:"getSymbolDefinitions",getSelectedItems:function(){var e=this._selectionItems,t=[];for(var n in e){var r=e[n],i=r._selection;1&i&&r.isInserted()?t.push(r):i||this._updateSelection(r)}return t},_updateSelection:function(e){var t=e._id,n=this._selectionItems;e._selection?n[t]!==e&&(this._selectionCount++,n[t]=e):n[t]===e&&(this._selectionCount--,delete n[t])},selectAll:function(){for(var e=this._children,t=0,n=e.length;t<n;t++)e[t].setFullySelected(!0)},deselectAll:function(){var e=this._selectionItems;for(var t in e)e[t].setFullySelected(!1)},addLayer:function(e){return this.insertLayer(t,e)},insertLayer:function(e,t){if(t instanceof k){t._remove(!1,!0),i.splice(this._children,[t],e,0),t._setProject(this,!0);var n=t._name;n&&t.setName(n),this._changes&&t._changed(5),this._activeLayer||(this._activeLayer=t)}else t=null;return t},_insertItem:function(e,n,r){return n=this.insertLayer(e,n)||(this._activeLayer||this._insertItem(t,new k(w.NO_INSERT),!0)).insertChild(e,n),r&&n.activate&&n.activate(),n},getItems:function(e){return w._getItems(this,e)},getItem:function(e){return w._getItems(this,e,null,null,!0)[0]||null},importJSON:function(e){this.activate();var t=this._activeLayer;return i.importJSON(e,t&&t.isEmpty()&&t)},removeOn:function(e){var t=this._removeSets;if(t){"mouseup"===e&&(t.mousedrag=null);var n=t[e];if(n){for(var r in n){var i=n[r];for(var a in t){var s=t[a];s&&s!=n&&delete s[i._id]}i.remove()}t[e]=null}}},draw:function(e,t,n){this._updateVersion++,e.save(),t.applyToContext(e);for(var r=this._children,a=new i({offset:new d(0,0),pixelRatio:n,viewMatrix:t.isIdentity()?null:t,matrices:[new y],updateMatrix:!0}),s=0,o=r.length;s<o;s++)r[s].draw(e,a);if(e.restore(),this._selectionCount>0){e.save(),e.strokeWidth=1;var c=this._selectionItems,l=this._scope.settings.handleSize,u=this._updateVersion;for(var h in c)c[h]._drawSelection(e,t,l,c,u);e.restore()}}}),w=i.extend(a,{statics:{extend:function e(t){return t._serializeFields&&(t._serializeFields=i.set({},this.prototype._serializeFields,t._serializeFields)),e.base.apply(this,arguments)},INSERT:{insert:!0},NO_INSERT:{insert:!1}},_class:"Item",_name:null,_applyMatrix:!0,_canApplyMatrix:!0,_canScaleStroke:!1,_pivot:null,_visible:!0,_blendMode:"normal",_opacity:1,_locked:!1,_guide:!1,_clipMask:!1,_selection:0,_selectBounds:!0,_selectChildren:!1,_serializeFields:{name:null,applyMatrix:null,matrix:new y,pivot:null,visible:!0,blendMode:"normal",opacity:1,locked:!1,guide:!1,clipMask:!1,selected:!1,data:{}},_prioritize:["applyMatrix"]},new function(){var e=["onMouseDown","onMouseUp","onMouseDrag","onClick","onDoubleClick","onMouseMove","onMouseEnter","onMouseLeave"];return i.each(e,(function(e){this._events[e]={install:function(e){this.getView()._countItemEvent(e,1)},uninstall:function(e){this.getView()._countItemEvent(e,-1)}}}),{_events:{onFrame:{install:function(){this.getView()._animateItem(this,!0)},uninstall:function(){this.getView()._animateItem(this,!1)}},onLoad:{},onError:{}},statics:{_itemHandlers:e}})},{initialize:function(){},_initialize:function(e,n){var r=e&&i.isPlainObject(e),a=r&&!0===e.internal,s=this._matrix=new y,o=r&&e.project||se.project,c=se.settings;return this._id=a?null:h.get(),this._parent=this._index=null,this._applyMatrix=this._canApplyMatrix&&c.applyMatrix,n&&s.translate(n),s._owner=this,this._style=new H(o._currentStyle,this,o),a||r&&0==e.insert||!c.insertItems&&(!r||1!=e.insert)?this._setProject(o):(r&&e.parent||o)._insertItem(t,this,!0),r&&e!==w.NO_INSERT&&e!==w.INSERT&&this.set(e,{internal:!0,insert:!0,project:!0,parent:!0}),r},_serialize:function(e,t){var n={},r=this;function a(a){for(var s in a){var o=r[s];i.equals(o,"leading"===s?1.2*a.fontSize:a[s])||(n[s]=i.serialize(o,e,"data"!==s,t))}}return a(this._serializeFields),this instanceof x||a(this._style._defaults),[this._class,n]},_changed:function(e){var n=this._symbol,r=this._parent||n,i=this._project;8&e&&(this._bounds=this._position=this._decomposed=t),16&e&&(this._globalMatrix=t),r&&72&e&&w._clearBoundsCache(r),2&e&&w._clearBoundsCache(this),i&&i._changed(e,this),n&&n._changed(e)},getId:function(){return this._id},getName:function(){return this._name},setName:function(e){if(this._name&&this._removeNamed(),e===+e+"")throw new Error("Names consisting only of numbers are not supported.");var n=this._getOwner();if(e&&n){var r=n._children,i=n._namedChildren;(i[e]=i[e]||[]).push(this),e in r||(r[e]=this)}this._name=e||t,this._changed(256)},getStyle:function(){return this._style},setStyle:function(e){this.getStyle().set(e)}},i.each(["locked","visible","blendMode","opacity","guide"],(function(e){var t=i.capitalize(e),n="_"+e,r={locked:256,visible:265};this["get"+t]=function(){return this[n]},this["set"+t]=function(t){t!=this[n]&&(this[n]=t,this._changed(r[e]||257))}}),{}),{beans:!0,getSelection:function(){return this._selection},setSelection:function(e){if(e!==this._selection){this._selection=e;var t=this._project;t&&(t._updateSelection(this),this._changed(257))}},_changeSelection:function(e,t){var n=this._selection;this.setSelection(t?n|e:n&~e)},isSelected:function(){if(this._selectChildren)for(var e=this._children,t=0,n=e.length;t<n;t++)if(e[t].isSelected())return!0;return!!(1&this._selection)},setSelected:function(e){if(this._selectChildren)for(var t=this._children,n=0,r=t.length;n<r;n++)t[n].setSelected(e);this._changeSelection(1,e)},isFullySelected:function(){var e=this._children,t=!!(1&this._selection);if(e&&t){for(var n=0,r=e.length;n<r;n++)if(!e[n].isFullySelected())return!1;return!0}return t},setFullySelected:function(e){var t=this._children;if(t)for(var n=0,r=t.length;n<r;n++)t[n].setFullySelected(e);this._changeSelection(1,e)},isClipMask:function(){return this._clipMask},setClipMask:function(e){this._clipMask!=(e=!!e)&&(this._clipMask=e,e&&(this.setFillColor(null),this.setStrokeColor(null)),this._changed(257),this._parent&&this._parent._changed(2048))},getData:function(){return this._data||(this._data={}),this._data},setData:function(e){this._data=e},getPosition:function(e){var t=e?d:f,n=this._position||(this._position=this._getPositionFromBounds());return new t(n.x,n.y,this,"setPosition")},setPosition:function(){this.translate(d.read(arguments).subtract(this.getPosition(!0)))},_getPositionFromBounds:function(e){return this._pivot?this._matrix._transformPoint(this._pivot):(e||this.getBounds()).getCenter(!0)},getPivot:function(){var e=this._pivot;return e?new f(e.x,e.y,this,"setPivot"):null},setPivot:function(){this._pivot=d.read(arguments,0,{clone:!0,readNull:!0}),this._position=t}},i.each({getStrokeBounds:{stroke:!0},getHandleBounds:{handle:!0},getInternalBounds:{internal:!0}},(function(e,t){this[t]=function(t){return this.getBounds(t,e)}}),{beans:!0,getBounds:function(e,t){var n=t||e instanceof y,r=i.set({},n?t:e,this._boundsOptions);r.stroke&&!this.getStrokeScaling()||(r.cacheItem=this);var a=this._getCachedBounds(n&&e,r).rect;return arguments.length?a:new v(a.x,a.y,a.width,a.height,this,"setBounds")},setBounds:function(){var e=g.read(arguments),t=this.getBounds(),n=this._matrix,r=new y,i=e.getCenter();r.translate(i),e.width==t.width&&e.height==t.height||(n.isInvertible()||(n.set(n._backup||(new y).translate(n.getTranslation())),t=this.getBounds()),r.scale(0!==t.width?e.width/t.width:0,0!==t.height?e.height/t.height:0)),i=t.getCenter(),r.translate(-i.x,-i.y),this.transform(r)},_getBounds:function(e,t){var n=this._children;return n&&n.length?(w._updateBoundsCache(this,t.cacheItem),w._getBounds(n,e,t)):new g},_getBoundsCacheKey:function(e,t){return[e.stroke?1:0,e.handle?1:0,t?1:0].join("")},_getCachedBounds:function(e,t,n){e=e&&e._orNullIfIdentity();var r=t.internal&&!n,i=t.cacheItem,a=r?null:this._matrix._orNullIfIdentity(),s=i&&(!e||e.equals(a))&&this._getBoundsCacheKey(t,r),o=this._bounds;if(w._updateBoundsCache(this._parent||this._symbol,i),s&&o&&s in o)return{rect:(d=o[s]).rect.clone(),nonscaling:d.nonscaling};var c=this._getBounds(e||a,t),l=c.rect||c,u=this._style,h=c.nonscaling||u.hasStroke()&&!u.getStrokeScaling();if(s){o||(this._bounds=o={});var d=o[s]={rect:l.clone(),nonscaling:h,internal:r}}return{rect:l,nonscaling:h}},_getStrokeMatrix:function(e,t){var n=this.getStrokeScaling()?null:t&&t.internal?this:this._parent||this._symbol&&this._symbol._item,r=n?n.getViewMatrix().invert():e;return r&&r._shiftless()},statics:{_updateBoundsCache:function(e,t){if(e&&t){var n=t._id,r=e._boundsCache=e._boundsCache||{ids:{},list:[]};r.ids[n]||(r.list.push(t),r.ids[n]=t)}},_clearBoundsCache:function(e){var n=e._boundsCache;if(n){e._bounds=e._position=e._boundsCache=t;for(var r=0,i=n.list,a=i.length;r<a;r++){var s=i[r];s!==e&&(s._bounds=s._position=t,s._boundsCache&&w._clearBoundsCache(s))}}},_getBounds:function(e,t,n){var r=1/0,i=-r,a=r,s=i,o=!1;n=n||{};for(var c=0,l=e.length;c<l;c++){var u=e[c];if(u._visible&&!u.isEmpty(!0)){var h=u._getCachedBounds(t&&t.appended(u._matrix),n,!0),d=h.rect;r=Math.min(d.x,r),a=Math.min(d.y,a),i=Math.max(d.x+d.width,i),s=Math.max(d.y+d.height,s),h.nonscaling&&(o=!0)}}return{rect:isFinite(r)?new g(r,a,i-r,s-a):new g,nonscaling:o}}}}),{beans:!0,_decompose:function(){return this._applyMatrix?null:this._decomposed||(this._decomposed=this._matrix.decompose())},getRotation:function(){var e=this._decompose();return e?e.rotation:0},setRotation:function(e){var t=this.getRotation();if(null!=t&&null!=e){var n=this._decomposed;this.rotate(e-t),n&&(n.rotation=e,this._decomposed=n)}},getScaling:function(){var e=this._decompose(),t=e&&e.scaling;return new f(t?t.x:1,t?t.y:1,this,"setScaling")},setScaling:function(){var e=this.getScaling(),t=d.read(arguments,0,{clone:!0,readNull:!0});if(e&&t&&!e.equals(t)){var n=this.getRotation(),r=this._decomposed,i=new y,a=u.isZero;if(a(e.x)||a(e.y))i.translate(r.translation),n&&i.rotate(n),i.scale(t.x,t.y),this._matrix.set(i);else{var s=this.getPosition(!0);i.translate(s),n&&i.rotate(n),i.scale(t.x/e.x,t.y/e.y),n&&i.rotate(-n),i.translate(s.negate()),this.transform(i)}r&&(r.scaling=t,this._decomposed=r)}},getMatrix:function(){return this._matrix},setMatrix:function(){var e=this._matrix;e.set.apply(e,arguments)},getGlobalMatrix:function(e){var t=this._globalMatrix;if(t)for(var n=this._parent,r=[];n;){if(!n._globalMatrix){t=null;for(var i=0,a=r.length;i<a;i++)r[i]._globalMatrix=null;break}r.push(n),n=n._parent}return t||(t=this._globalMatrix=this._matrix.clone(),(n=this._parent)&&t.prepend(n.getGlobalMatrix(!0))),e?t:t.clone()},getViewMatrix:function(){return this.getGlobalMatrix().prepend(this.getView()._matrix)},getApplyMatrix:function(){return this._applyMatrix},setApplyMatrix:function(e){(this._applyMatrix=this._canApplyMatrix&&!!e)&&this.transform(null,!0)},getTransformContent:"#getApplyMatrix",setTransformContent:"#setApplyMatrix"},{getProject:function(){return this._project},_setProject:function(e,t){if(this._project!==e){this._project&&this._installEvents(!1),this._project=e;for(var n=this._children,r=0,i=n&&n.length;r<i;r++)n[r]._setProject(e);t=!0}t&&this._installEvents(!0)},getView:function(){return this._project._view},_installEvents:function e(t){e.base.call(this,t);for(var n=this._children,r=0,i=n&&n.length;r<i;r++)n[r]._installEvents(t)},getLayer:function(){for(var e=this;e=e._parent;)if(e instanceof k)return e;return null},getParent:function(){return this._parent},setParent:function(e){return e.addChild(this)},_getOwner:"#getParent",getChildren:function(){return this._children},setChildren:function(e){this.removeChildren(),this.addChildren(e)},getFirstChild:function(){return this._children&&this._children[0]||null},getLastChild:function(){return this._children&&this._children[this._children.length-1]||null},getNextSibling:function(){var e=this._getOwner();return e&&e._children[this._index+1]||null},getPreviousSibling:function(){var e=this._getOwner();return e&&e._children[this._index-1]||null},getIndex:function(){return this._index},setIndex:function(e){var n=this._parent,r=n&&n._children;r&&n.insertChildren(e in r?e:t,[this])},equals:function(e){return e===this||e&&this._class===e._class&&this._style.equals(e._style)&&this._matrix.equals(e._matrix)&&this._locked===e._locked&&this._visible===e._visible&&this._blendMode===e._blendMode&&this._opacity===e._opacity&&this._clipMask===e._clipMask&&this._guide===e._guide&&this._equals(e)||!1},_equals:function(e){return i.equals(this._children,e._children)},clone:function(e){var n=new this.constructor(w.NO_INSERT),r=this._children,a=i.pick(e?e.insert:t,e===t||!0===e),s=i.pick(e?e.deep:t,!0);r&&n.copyAttributes(this),r&&!s||n.copyContent(this),r||n.copyAttributes(this),a&&n.insertAbove(this);var o=this._name,c=this._parent;if(o&&c){r=c._children;for(var l=o,u=1;r[o];)o=l+" "+u++;o!==l&&n.setName(o)}return n},copyContent:function(e){for(var t=e._children,n=0,r=t&&t.length;n<r;n++)this.addChild(t[n].clone(!1),!0)},copyAttributes:function(e,t){this.setStyle(e._style);for(var n=["_locked","_visible","_blendMode","_opacity","_clipMask","_guide"],r=0,a=n.length;r<a;r++){var s=n[r];e.hasOwnProperty(s)&&(this[s]=e[s])}t||this._matrix.set(e._matrix,!0),this.setApplyMatrix(e._applyMatrix),this.setPivot(e._pivot),this.setSelection(e._selection);var o=e._data,c=e._name;this._data=o?i.clone(o):null,c&&this.setName(c)},rasterize:function(e,n){var r,a,s;i.isPlainObject(e)?(r=e.resolution,a=e.insert,s=e.raster):(r=e,a=n),s||(s=new C(w.NO_INSERT));var o=this.getStrokeBounds(),c=(r||this.getView().getResolution())/72,l=o.getTopLeft().floor(),u=o.getBottomRight().ceil(),h=new p(u.subtract(l)),d=h.multiply(c);if(s.setSize(d,!0),!d.isZero()){var f=s.getContext(!0),m=(new y).scale(c).translate(l.negate());f.save(),m.applyToContext(f),this.draw(f,new i({matrices:[m]})),f.restore()}return s._matrix.set((new y).translate(l.add(h.divide(2))).scale(1/c)),(a===t||a)&&s.insertAbove(this),s},contains:function(){var e=this._matrix;return e.isInvertible()&&!!this._contains(e._inverseTransform(d.read(arguments)))},_contains:function(e){var t=this._children;if(t){for(var n=t.length-1;n>=0;n--)if(t[n].contains(e))return!0;return!1}return e.isInside(this.getInternalBounds())},isInside:function(){return g.read(arguments).contains(this.getBounds())},_asPathItem:function(){return new O.Rectangle({rectangle:this.getInternalBounds(),matrix:this._matrix,insert:!1})},intersects:function(e,t){return e instanceof w&&this._asPathItem().getIntersections(e._asPathItem(),null,t,!0).length>0}},new function(){function e(){var e=arguments;return this._hitTest(d.read(e),T.getOptions(e))}function t(){var e=arguments,t=d.read(e),n=T.getOptions(e),r=[];return this._hitTest(t,new i({all:r},n)),r}function n(e,t,n,r){var i=this._children;if(i)for(var a=i.length-1;a>=0;a--){var s=i[a],o=s!==r&&s._hitTest(e,t,n);if(o&&!t.all)return o}return null}return _.inject({hitTest:e,hitTestAll:t,_hitTest:n}),{hitTest:e,hitTestAll:t,_hitTestChildren:n}},{_hitTest:function(e,t,n){if(this._locked||!this._visible||this._guide&&!t.guides||this.isEmpty())return null;var r=this._matrix,a=n?n.appended(r):this.getGlobalMatrix().prepend(this.getView()._matrix),s=Math.max(t.tolerance,1e-12),o=t._tolerancePadding=new p(O._getStrokePadding(s,r._shiftless().invert()));if(!(e=r._inverseTransform(e))||!this._children&&!this.getBounds({internal:!0,stroke:!0,handle:!0}).expand(o.multiply(2))._containsPoint(e))return null;var c,l,u=!(t.guides&&!this._guide||t.selected&&!this.isSelected()||t.type&&t.type!==i.hyphenate(this._class)||t.class&&!(this instanceof t.class)),h=t.match,d=this;function f(e){return e&&h&&!h(e)&&(e=null),e&&t.all&&t.all.push(e),e}function m(t,n){var r=n?c["get"+n]():d.getPosition();if(e.subtract(r).divide(o).length<=1)return new T(t,d,{name:n?i.hyphenate(n):t,point:r})}var g=t.position,v=t.center,y=t.bounds;if(u&&this._parent&&(g||v||y)){if((v||y)&&(c=this.getInternalBounds()),!(l=g&&m("position")||v&&m("center","Center"))&&y)for(var b=["TopLeft","TopRight","BottomLeft","BottomRight","LeftCenter","TopCenter","RightCenter","BottomCenter"],_=0;_<8&&!l;_++)l=m("bounds",b[_]);l=f(l)}return l||(l=this._hitTestChildren(e,t,a)||u&&f(this._hitTestSelf(e,t,a,this.getStrokeScaling()?null:a._shiftless().invert()))||null),l&&l.point&&(l.point=r.transform(l.point)),l},_hitTestSelf:function(e,t){if(t.fill&&this.hasFill()&&this._contains(e))return new T("fill",this)},matches:function(e,t){var n=typeof e;if("object"===n){for(var r in e)if(e.hasOwnProperty(r)&&!this.matches(r,e[r]))return!1;return!0}if("function"===n)return e(this);if("match"===e)return t(this);var a=/^(empty|editable)$/.test(e)?this["is"+i.capitalize(e)]():"type"===e?i.hyphenate(this._class):this[e];if("class"===e){if("function"==typeof t)return this instanceof t;a=this._class}if("function"==typeof t)return!!t(a);if(t){if(t.test)return t.test(a);if(i.isPlainObject(t))return function e(t,n){for(var r in t)if(t.hasOwnProperty(r)){var a=t[r],s=n[r];if(i.isPlainObject(a)&&i.isPlainObject(s)){if(!e(a,s))return!1}else if(!i.equals(a,s))return!1}return!0}(t,a)}return i.equals(a,t)},getItems:function(e){return w._getItems(this,e,this._matrix)},getItem:function(e){return w._getItems(this,e,this._matrix,null,!0)[0]||null},statics:{_getItems:function e(t,n,r,a,s){if(!a){var o="object"==typeof n&&n,c=o&&o.overlapping,l=o&&o.inside,u=(_=c||l)&&g.read([_]);a={items:[],recursive:o&&!1!==o.recursive,inside:!!l,overlapping:!!c,rect:u,path:c&&new O.Rectangle({rectangle:u,insert:!1})},o&&(n=i.filter({},n,{recursive:!0,inside:!0,overlapping:!0}))}var h=t._children,d=a.items;r=(u=a.rect)&&(r||new y);for(var f=0,p=h&&h.length;f<p;f++){var m=h[f],v=r&&r.appended(m._matrix),b=!0;if(u){var _=m.getBounds(v);if(!u.intersects(_))continue;u.contains(_)||a.overlapping&&(_.contains(u)||a.path.intersects(m,v))||(b=!1)}if(b&&m.matches(n)&&(d.push(m),s))break;if(!1!==a.recursive&&e(m,n,v,a,s),s&&d.length>0)break}return d}}},{importJSON:function(e){var t=i.importJSON(e,this);return t!==this?this.addChild(t):t},addChild:function(e){return this.insertChild(t,e)},insertChild:function(e,t){var n=t?this.insertChildren(e,[t]):null;return n&&n[0]},addChildren:function(e){return this.insertChildren(this._children.length,e)},insertChildren:function(e,t){var n=this._children;if(n&&t&&t.length>0){for(var r={},a=(t=i.slice(t)).length-1;a>=0;a--){var s=(u=t[a])&&u._id;!u||r[s]?t.splice(a,1):(u._remove(!1,!0),r[s]=!0)}i.splice(n,t,e,0);for(var o=this._project,c=o._changes,l=(a=0,t.length);a<l;a++){var u,h=(u=t[a])._name;u._parent=this,u._setProject(o,!0),h&&u.setName(h),c&&u._changed(5)}this._changed(11)}else t=null;return t},_insertItem:"#insertChild",_insertAt:function(e,t){var n=e&&e._getOwner(),r=e!==this&&n?this:null;return r&&(r._remove(!1,!0),n._insertItem(e._index+t,r)),r},insertAbove:function(e){return this._insertAt(e,1)},insertBelow:function(e){return this._insertAt(e,0)},sendToBack:function(){var e=this._getOwner();return e?e._insertItem(0,this):null},bringToFront:function(){var e=this._getOwner();return e?e._insertItem(t,this):null},appendTop:"#addChild",appendBottom:function(e){return this.insertChild(0,e)},moveAbove:"#insertAbove",moveBelow:"#insertBelow",addTo:function(e){return e._insertItem(t,this)},copyTo:function(e){return this.clone(!1).addTo(e)},reduce:function(e){var t=this._children;if(t&&1===t.length){var n=t[0].reduce(e);return this._parent?(n.insertAbove(this),this.remove()):n.remove(),n}return this},_removeNamed:function(){var e=this._getOwner();if(e){var t=e._children,n=e._namedChildren,r=this._name,i=n[r],a=i?i.indexOf(this):-1;-1!==a&&(t[r]==this&&delete t[r],i.splice(a,1),i.length?t[r]=i[0]:delete n[r])}},_remove:function(e,t){var n=this._getOwner(),r=this._project,a=this._index;return this._style&&this._style._dispose(),!!n&&(this._name&&this._removeNamed(),null!=a&&(r._activeLayer===this&&(r._activeLayer=this.getNextSibling()||this.getPreviousSibling()),i.splice(n._children,null,a,1)),this._installEvents(!1),e&&r._changes&&this._changed(5),t&&n._changed(11,this),this._parent=null,!0)},remove:function(){return this._remove(!0,!0)},replaceWith:function(e){var t=e&&e.insertBelow(this);return t&&this.remove(),t},removeChildren:function(e,t){if(!this._children)return null;e=e||0,t=i.pick(t,this._children.length);for(var n=i.splice(this._children,null,e,t-e),r=n.length-1;r>=0;r--)n[r]._remove(!0,!1);return n.length>0&&this._changed(11),n},clear:"#removeChildren",reverseChildren:function(){if(this._children){this._children.reverse();for(var e=0,t=this._children.length;e<t;e++)this._children[e]._index=e;this._changed(11)}},isEmpty:function(e){var t=this._children,n=t?t.length:0;if(e){for(var r=0;r<n;r++)if(!t[r].isEmpty(e))return!1;return!0}return!n},isEditable:function(){for(var e=this;e;){if(!e._visible||e._locked)return!1;e=e._parent}return!0},hasFill:function(){return this.getStyle().hasFill()},hasStroke:function(){return this.getStyle().hasStroke()},hasShadow:function(){return this.getStyle().hasShadow()},_getOrder:function(e){function t(e){var t=[];do{t.unshift(e)}while(e=e._parent);return t}for(var n=t(this),r=t(e),i=0,a=Math.min(n.length,r.length);i<a;i++)if(n[i]!=r[i])return n[i]._index<r[i]._index?1:-1;return 0},hasChildren:function(){return this._children&&this._children.length>0},isInserted:function(){return!!this._parent&&this._parent.isInserted()},isAbove:function(e){return-1===this._getOrder(e)},isBelow:function(e){return 1===this._getOrder(e)},isParent:function(e){return this._parent===e},isChild:function(e){return e&&e._parent===this},isDescendant:function(e){for(var t=this;t=t._parent;)if(t===e)return!0;return!1},isAncestor:function(e){return!!e&&e.isDescendant(this)},isSibling:function(e){return this._parent===e._parent},isGroupedWith:function(e){for(var t=this._parent;t;){if(t._parent&&/^(Group|Layer|CompoundPath)$/.test(t._class)&&e.isDescendant(t))return!0;t=t._parent}return!1}},i.each(["rotate","scale","shear","skew"],(function(e){var t="rotate"===e;this[e]=function(){var n=arguments,r=(t?i:d).read(n),a=d.read(n,0,{readNull:!0});return this.transform((new y)[e](r,a||this.getPosition(!0)))}}),{translate:function(){var e=new y;return this.transform(e.translate.apply(e,arguments))},transform:function(e,t,n){var r=this._matrix,i=e&&!e.isIdentity(),a=n&&this._canApplyMatrix||this._applyMatrix&&(i||!r.isIdentity()||t&&this._children);if(!i&&!a)return this;if(i){!e.isInvertible()&&r.isInvertible()&&(r._backup=r.getValues()),r.prepend(e,!0);var s=this._style,o=s.getFillColor(!0),c=s.getStrokeColor(!0);o&&o.transform(e),c&&c.transform(e)}if(a&&(a=this._transformContent(r,t,n))){var l=this._pivot;l&&r._transformPoint(l,l,!0),r.reset(!0),n&&this._canApplyMatrix&&(this._applyMatrix=!0)}var u=this._bounds,h=this._position;(i||a)&&this._changed(25);var d=i&&u&&e.decompose();if(d&&d.skewing.isZero()&&d.rotation%90==0){for(var f in u){var p=u[f];if(p.nonscaling)delete u[f];else if(a||!p.internal){var m=p.rect;e._transformBounds(m,m)}}this._bounds=u;var g=u[this._getBoundsCacheKey(this._boundsOptions||{})];g&&(this._position=this._getPositionFromBounds(g.rect))}else i&&h&&this._pivot&&(this._position=e._transformPoint(h,h));return this},_transformContent:function(e,t,n){var r=this._children;if(r){for(var i=0,a=r.length;i<a;i++)r[i].transform(e,t,n);return!0}},globalToLocal:function(){return this.getGlobalMatrix(!0)._inverseTransform(d.read(arguments))},localToGlobal:function(){return this.getGlobalMatrix(!0)._transformPoint(d.read(arguments))},parentToLocal:function(){return this._matrix._inverseTransform(d.read(arguments))},localToParent:function(){return this._matrix._transformPoint(d.read(arguments))},fitBounds:function(e,t){e=g.read(arguments);var n=this.getBounds(),r=n.height/n.width,i=e.height/e.width,a=(t?r>i:r<i)?e.width/n.width:e.height/n.height,s=new g(new d,new p(n.width*a,n.height*a));s.setCenter(e.getCenter()),this.setBounds(s)}}),{_setStyles:function(e,t,n){var r=this._style,i=this._matrix;if(r.hasFill()&&(e.fillStyle=r.getFillColor().toCanvasStyle(e,i)),r.hasStroke()){e.strokeStyle=r.getStrokeColor().toCanvasStyle(e,i),e.lineWidth=r.getStrokeWidth();var a=r.getStrokeJoin(),s=r.getStrokeCap(),o=r.getMiterLimit();if(a&&(e.lineJoin=a),s&&(e.lineCap=s),o&&(e.miterLimit=o),se.support.nativeDash){var c=r.getDashArray(),l=r.getDashOffset();c&&c.length&&("setLineDash"in e?(e.setLineDash(c),e.lineDashOffset=l):(e.mozDash=c,e.mozDashOffset=l))}}if(r.hasShadow()){var u=t.pixelRatio||1,h=n._shiftless().prepend((new y).scale(u,u)),f=h.transform(new d(r.getShadowBlur(),0)),p=h.transform(this.getShadowOffset());e.shadowColor=r.getShadowColor().toCanvasStyle(e),e.shadowBlur=f.getLength(),e.shadowOffsetX=p.x,e.shadowOffsetY=p.y}},draw:function(e,t,n){if(this._updateVersion=this._project._updateVersion,this._visible&&0!==this._opacity){var r=t.matrices,i=t.viewMatrix,a=this._matrix,s=r[r.length-1].appended(a);if(s.isInvertible()){i=i?i.appended(s):s,r.push(s),t.updateMatrix&&(this._globalMatrix=s);var o,c,l,h=this._blendMode,d=u.clamp(this._opacity,0,1),f="normal"===h,p=re.nativeModes[h],m=f&&1===d||t.dontStart||t.clip||(p||f&&d<1)&&this._canComposite(),g=t.pixelRatio||1;if(!m){var v=this.getStrokeBounds(i);if(!v.width||!v.height)return void r.pop();l=t.offset,c=t.offset=v.getTopLeft().floor(),o=e,e=ne.getContext(v.getSize().ceil().add(1).multiply(g)),1!==g&&e.scale(g,g)}e.save();var y=n?n.appended(a):this._canScaleStroke&&!this.getStrokeScaling(!0)&&i,b=!m&&t.clipItem,_=!y||b;if(m?(e.globalAlpha=d,p&&(e.globalCompositeOperation=h)):_&&e.translate(-c.x,-c.y),_&&(m?a:i).applyToContext(e),b&&t.clipItem.draw(e,t.extend({clip:!0})),y){e.setTransform(g,0,0,g,0,0);var w=t.offset;w&&e.translate(-w.x,-w.y)}this._draw(e,t,i,y),e.restore(),r.pop(),t.clip&&!t.dontFinish&&e.clip(this.getFillRule()),m||(re.process(h,e,o,d,c.subtract(l).multiply(g)),ne.release(e),t.offset=l)}}},_isUpdated:function(e){var t=this._parent;if(t instanceof L)return t._isUpdated(e);var n=this._updateVersion===e;return!n&&t&&t._visible&&t._isUpdated(e)&&(this._updateVersion=e,n=!0),n},_drawSelection:function(e,t,n,r,i){var a=this._selection,s=1&a,o=2&a||s&&this._selectBounds,c=4&a;if(this._drawSelected||(s=!1),(s||o||c)&&this._isUpdated(i)){var l,u=this.getSelectedColor(!0)||(l=this.getLayer())&&l.getSelectedColor(!0),h=t.appended(this.getGlobalMatrix(!0)),d=n/2;if(e.strokeStyle=e.fillStyle=u?u.toCanvasStyle(e):"#009dec",s&&this._drawSelected(e,h,r),c){var f=this.getPosition(!0),p=this._parent,m=p?p.localToGlobal(f):f,g=m.x,v=m.y;e.beginPath(),e.arc(g,v,d,0,2*Math.PI,!0),e.stroke();for(var y=[[0,-1],[1,0],[0,1],[-1,0]],b=d,_=n+1,w=0;w<4;w++){var x=y[w],k=x[0],S=x[1];e.moveTo(g+k*b,v+S*b),e.lineTo(g+k*_,v+S*_),e.stroke()}}if(o){var C=h._transformCorners(this.getInternalBounds());for(e.beginPath(),w=0;w<8;w++)e[w?"lineTo":"moveTo"](C[w],C[++w]);for(e.closePath(),e.stroke(),w=0;w<8;w++)e.fillRect(C[w]-d,C[++w]-d,n,n)}}},_canComposite:function(){return!1}},i.each(["down","drag","up","move"],(function(e){this["removeOn"+i.capitalize(e)]=function(){var t={};return t[e]=!0,this.removeOn(t)}}),{removeOn:function(e){for(var t in e)if(e[t]){var n="mouse"+t,r=this._project,i=r._removeSets=r._removeSets||{};i[n]=i[n]||{},i[n][this._id]=this}return this}}),{tween:function(e,t,n){n||(n=t,t=e,e=null,n||(n=t,t=null));var r=n&&n.easing,i=n&&n.start,a=null!=n&&("number"==typeof n?n:n.duration),s=new ee(this,e,t,a,r,i);return a&&this.on("frame",(function e(t){s._handleFrame(1e3*t.time),s.running||this.off("frame",e)})),s},tweenTo:function(e,t){return this.tween(null,e,t)},tweenFrom:function(e,t){return this.tween(e,null,t)}}),x=w.extend({_class:"Group",_selectBounds:!1,_selectChildren:!0,_serializeFields:{children:[]},initialize:function(e){this._children=[],this._namedChildren={},this._initialize(e)||this.addChildren(Array.isArray(e)?e:arguments)},_changed:function e(n){e.base.call(this,n),2050&n&&(this._clipItem=t)},_getClipItem:function(){var e=this._clipItem;if(e===t){e=null;for(var n=this._children,r=0,i=n.length;r<i;r++)if(n[r]._clipMask){e=n[r];break}this._clipItem=e}return e},isClipped:function(){return!!this._getClipItem()},setClipped:function(e){var t=this.getFirstChild();t&&t.setClipMask(e)},_getBounds:function e(t,n){var r=this._getClipItem();return r?r._getCachedBounds(r._matrix.prepended(t),i.set({},n,{stroke:!1})):e.base.call(this,t,n)},_hitTestChildren:function e(t,n,r){var i=this._getClipItem();return(!i||i.contains(t))&&e.base.call(this,t,n,r,i)},_draw:function(e,t){var n=t.clip,r=!n&&this._getClipItem();t=t.extend({clipItem:r,clip:!1}),n?(e.beginPath(),t.dontStart=t.dontFinish=!0):r&&r.draw(e,t.extend({clip:!0}));for(var i=this._children,a=0,s=i.length;a<s;a++){var o=i[a];o!==r&&o.draw(e,t)}}}),k=x.extend({_class:"Layer",initialize:function(){x.apply(this,arguments)},_getOwner:function(){return this._parent||null!=this._index&&this._project},isInserted:function e(){return this._parent?e.base.call(this):null!=this._index},activate:function(){this._project._activeLayer=this},_hitTestSelf:function(){}}),S=w.extend({_class:"Shape",_applyMatrix:!1,_canApplyMatrix:!1,_canScaleStroke:!0,_serializeFields:{type:null,size:null,radius:null},initialize:function(e,t){this._initialize(e,t)},_equals:function(e){return this._type===e._type&&this._size.equals(e._size)&&i.equals(this._radius,e._radius)},copyContent:function(e){this.setType(e._type),this.setSize(e._size),this.setRadius(e._radius)},getType:function(){return this._type},setType:function(e){this._type=e},getShape:"#getType",setShape:"#setType",getSize:function(){var e=this._size;return new m(e.width,e.height,this,"setSize")},setSize:function(){var e=p.read(arguments);if(this._size){if(!this._size.equals(e)){var t=this._type,n=e.width,r=e.height;"rectangle"===t?this._radius.set(p.min(this._radius,e.divide(2).abs())):"circle"===t?(n=r=(n+r)/2,this._radius=n/2):"ellipse"===t&&this._radius._set(n/2,r/2),this._size._set(n,r),this._changed(9)}}else this._size=e.clone()},getRadius:function(){var e=this._radius;return"circle"===this._type?e:new m(e.width,e.height,this,"setRadius")},setRadius:function(e){var t=this._type;if("circle"===t){if(e===this._radius)return;var n=2*e;this._radius=e,this._size._set(n,n)}else if(e=p.read(arguments),this._radius){if(this._radius.equals(e))return;this._radius.set(e),"rectangle"===t?(n=p.max(this._size,e.multiply(2)),this._size.set(n)):"ellipse"===t&&this._size._set(2*e.width,2*e.height)}else this._radius=e.clone();this._changed(9)},isEmpty:function(){return!1},toPath:function(e){var n=new(O[i.capitalize(this._type)])({center:new d,size:this._size,radius:this._radius,insert:!1});return n.copyAttributes(this),se.settings.applyMatrix&&n.setApplyMatrix(!0),(e===t||e)&&n.insertAbove(this),n},toShape:"#clone",_asPathItem:function(){return this.toPath(!1)},_draw:function(e,t,n,r){var i=this._style,a=i.hasFill(),s=i.hasStroke(),o=t.dontFinish||t.clip,c=!r;if(a||s||o){var l=this._type,u=this._radius,h="circle"===l;if(t.dontStart||e.beginPath(),c&&h)e.arc(0,0,u,0,2*Math.PI,!0);else{var d=h?u:u.width,f=h?u:u.height,p=this._size,m=p.width,g=p.height;if(c&&"rectangle"===l&&0===d&&0===f)e.rect(-m/2,-g/2,m,g);else{var v=m/2,y=g/2,b=.44771525016920644,_=d*b,w=f*b,x=[-v,-y+f,-v,-y+w,-v+_,-y,-v+d,-y,v-d,-y,v-_,-y,v,-y+w,v,-y+f,v,y-f,v,y-w,v-_,y,v-d,y,-v+d,y,-v+_,y,-v,y-w,-v,y-f];r&&r.transform(x,x,32),e.moveTo(x[0],x[1]),e.bezierCurveTo(x[2],x[3],x[4],x[5],x[6],x[7]),v!==d&&e.lineTo(x[8],x[9]),e.bezierCurveTo(x[10],x[11],x[12],x[13],x[14],x[15]),y!==f&&e.lineTo(x[16],x[17]),e.bezierCurveTo(x[18],x[19],x[20],x[21],x[22],x[23]),v!==d&&e.lineTo(x[24],x[25]),e.bezierCurveTo(x[26],x[27],x[28],x[29],x[30],x[31])}}e.closePath()}o||!a&&!s||(this._setStyles(e,t,n),a&&(e.fill(i.getFillRule()),e.shadowColor="rgba(0,0,0,0)"),s&&e.stroke())},_canComposite:function(){return!(this.hasFill()&&this.hasStroke())},_getBounds:function(e,t){var n=new g(this._size).setCenter(0,0),r=this._style,i=t.stroke&&r.hasStroke()&&r.getStrokeWidth();return e&&(n=e._transformBounds(n)),i?n.expand(O._getStrokePadding(i,this._getStrokeMatrix(e,t))):n}},new function(){function e(e,t,n){var r=e._radius;if(!r.isZero())for(var i=e._size.divide(2),a=1;a<=4;a++){var s=new d(a>1&&a<4?-1:1,a>2?-1:1),o=s.multiply(i),c=o.subtract(s.multiply(r));if(new g(n?o.add(s.multiply(n)):o,c).contains(t))return{point:c,quadrant:a}}}function t(e,t,n,r){var i=e.divide(t);return(!r||i.isInQuadrant(r))&&i.subtract(i.normalize()).multiply(t).divide(n).length<=1}return{_contains:function t(n){if("rectangle"===this._type){var r=e(this,n);return r?n.subtract(r.point).divide(this._radius).getLength()<=1:t.base.call(this,n)}return n.divide(this.size).getLength()<=.5},_hitTestSelf:function n(r,i,a,s){var o=!1,c=this._style,l=i.stroke&&c.hasStroke(),u=i.fill&&c.hasFill();if(l||u){var h=this._type,d=this._radius,f=l?c.getStrokeWidth()/2:0,p=i._tolerancePadding.add(O._getStrokePadding(f,!c.getStrokeScaling()&&s));if("rectangle"===h){var m=p.multiply(2),v=e(this,r,m);if(v)o=t(r.subtract(v.point),d,p,v.quadrant);else{var y=new g(this._size).setCenter(0,0),b=y.expand(m),_=y.expand(m.negate());o=b._containsPoint(r)&&!_._containsPoint(r)}}else o=t(r,d,p)}return o?new T(l?"stroke":"fill",this):n.base.apply(this,arguments)}}},{statics:new function(){function e(e,t,n,r,a){var s=i.create(S.prototype);return s._type=e,s._size=n,s._radius=r,s._initialize(i.getNamed(a),t),s}return{Circle:function(){var t=arguments,n=d.readNamed(t,"center"),r=i.readNamed(t,"radius");return e("circle",n,new p(2*r),r,t)},Rectangle:function(){var t=arguments,n=g.readNamed(t,"rectangle"),r=p.min(p.readNamed(t,"radius"),n.getSize(!0).divide(2));return e("rectangle",n.getCenter(!0),n.getSize(!0),r,t)},Ellipse:function(){var t=arguments,n=S._readEllipse(t),r=n.radius;return e("ellipse",n.center,r.multiply(2),r,t)},_readEllipse:function(e){var t,n;if(i.hasNamed(e,"radius"))t=d.readNamed(e,"center"),n=p.readNamed(e,"radius");else{var r=g.readNamed(e,"rectangle");t=r.getCenter(!0),n=r.getSize(!0).divide(2)}return{center:t,radius:n}}}}}),C=w.extend({_class:"Raster",_applyMatrix:!1,_canApplyMatrix:!1,_boundsOptions:{stroke:!1,handle:!1},_serializeFields:{crossOrigin:null,source:null},_prioritize:["crossOrigin"],_smoothing:"low",beans:!0,initialize:function(e,n){if(!this._initialize(e,n!==t&&d.read(arguments))){var i,a=typeof e,s="string"===a?r.getElementById(e):"object"===a?e:null;if(s&&s!==w.NO_INSERT)if(s.getContext||null!=s.naturalHeight)i=s;else if(s){var o=p.read(arguments);o.isZero()||(i=ne.getCanvas(o))}i?this.setImage(i):this.setSource(e)}this._size||(this._size=new p,this._loaded=!1)},_equals:function(e){return this.getSource()===e.getSource()},copyContent:function(e){var t=e._image,n=e._canvas;if(t)this._setImage(t);else if(n){var r=ne.getCanvas(e._size);r.getContext("2d").drawImage(n,0,0),this._setImage(r)}this._crossOrigin=e._crossOrigin},getSize:function(){var e=this._size;return new m(e?e.width:0,e?e.height:0,this,"setSize")},setSize:function(e,t){var n=p.read(arguments);if(n.equals(this._size))t&&this.clear();else if(n.width>0&&n.height>0){var r=!t&&this.getElement();this._setImage(ne.getCanvas(n)),r&&this.getContext(!0).drawImage(r,0,0,n.width,n.height)}else this._canvas&&ne.release(this._canvas),this._size=n.clone()},getWidth:function(){return this._size?this._size.width:0},setWidth:function(e){this.setSize(e,this.getHeight())},getHeight:function(){return this._size?this._size.height:0},setHeight:function(e){this.setSize(this.getWidth(),e)},getLoaded:function(){return this._loaded},isEmpty:function(){var e=this._size;return!e||0===e.width&&0===e.height},getResolution:function(){var e=this._matrix,t=new d(0,0).transform(e),n=new d(1,0).transform(e).subtract(t),r=new d(0,1).transform(e).subtract(t);return new p(72/n.getLength(),72/r.getLength())},getPpi:"#getResolution",getImage:function(){return this._image},setImage:function(e){var t=this;function n(e){var n=t.getView(),r=e&&e.type||"load";n&&t.responds(r)&&(se=n._scope,t.emit(r,new $(e)))}this._setImage(e),this._loaded?setTimeout(n,0):e&&G.add(e,{load:function(r){t._setImage(e),n(r)},error:n})},_setImage:function(e){this._canvas&&ne.release(this._canvas),e&&e.getContext?(this._image=null,this._canvas=e,this._loaded=!0):(this._image=e,this._canvas=null,this._loaded=!!(e&&e.src&&e.complete)),this._size=new p(e?e.naturalWidth||e.width:0,e?e.naturalHeight||e.height:0),this._context=null,this._changed(1033)},getCanvas:function(){if(!this._canvas){var e=ne.getContext(this._size);try{this._image&&e.drawImage(this._image,0,0),this._canvas=e.canvas}catch(t){ne.release(e)}}return this._canvas},setCanvas:"#setImage",getContext:function(e){return this._context||(this._context=this.getCanvas().getContext("2d")),e&&(this._image=null,this._changed(1025)),this._context},setContext:function(e){this._context=e},getSource:function(){var e=this._image;return e&&e.src||this.toDataURL()},setSource:function(t){var n=new e.Image,r=this._crossOrigin;r&&(n.crossOrigin=r),t&&(n.src=t),this.setImage(n)},getCrossOrigin:function(){var e=this._image;return e&&e.crossOrigin||this._crossOrigin||""},setCrossOrigin:function(e){this._crossOrigin=e;var t=this._image;t&&(t.crossOrigin=e)},getSmoothing:function(){return this._smoothing},setSmoothing:function(e){this._smoothing="string"==typeof e?e:e?"low":"off",this._changed(257)},getElement:function(){return this._canvas||this._loaded&&this._image}},{beans:!1,getSubCanvas:function(){var e=g.read(arguments),t=ne.getContext(e.getSize());return t.drawImage(this.getCanvas(),e.x,e.y,e.width,e.height,0,0,e.width,e.height),t.canvas},getSubRaster:function(){var e=g.read(arguments),t=new C(w.NO_INSERT);return t._setImage(this.getSubCanvas(e)),t.translate(e.getCenter().subtract(this.getSize().divide(2))),t._matrix.prepend(this._matrix),t.insertAbove(this),t},toDataURL:function(){var e=this._image,t=e&&e.src;if(/^data:/.test(t))return t;var n=this.getCanvas();return n?n.toDataURL.apply(n,arguments):null},drawImage:function(e){var t=d.read(arguments,1);this.getContext(!0).drawImage(e,t.x,t.y)},getAverageColor:function(e){var t,n;if(e?e instanceof D?(n=e,t=e.getBounds()):"object"==typeof e&&("width"in e?t=new g(e):"x"in e&&(t=new g(e.x-.5,e.y-.5,1,1))):t=this.getBounds(),!t)return null;var r=Math.min(t.width,32),a=Math.min(t.height,32),s=C._sampleContext;s?s.clearRect(0,0,33,33):s=C._sampleContext=ne.getContext(new p(32)),s.save();var o=(new y).scale(r/t.width,a/t.height).translate(-t.x,-t.y);o.applyToContext(s),n&&n.draw(s,new i({clip:!0,matrices:[o]})),this._matrix.applyToContext(s);var c=this.getElement(),l=this._size;c&&s.drawImage(c,-l.width/2,-l.height/2),s.restore();for(var u=s.getImageData(.5,.5,Math.ceil(r),Math.ceil(a)).data,h=[0,0,0],d=0,f=0,m=u.length;f<m;f+=4){var v=u[f+3];d+=v,v/=255,h[0]+=u[f]*v,h[1]+=u[f+1]*v,h[2]+=u[f+2]*v}for(f=0;f<3;f++)h[f]/=d;return d?z.read(h):null},getPixel:function(){var e=d.read(arguments),t=this.getContext().getImageData(e.x,e.y,1,1).data;return new z("rgb",[t[0]/255,t[1]/255,t[2]/255],t[3]/255)},setPixel:function(){var e=arguments,t=d.read(e),n=z.read(e),r=n._convert("rgb"),i=n._alpha,a=this.getContext(!0),s=a.createImageData(1,1),o=s.data;o[0]=255*r[0],o[1]=255*r[1],o[2]=255*r[2],o[3]=null!=i?255*i:255,a.putImageData(s,t.x,t.y)},clear:function(){var e=this._size;this.getContext(!0).clearRect(0,0,e.width+1,e.height+1)},createImageData:function(){var e=p.read(arguments);return this.getContext().createImageData(e.width,e.height)},getImageData:function(){var e=g.read(arguments);return e.isEmpty()&&(e=new g(this._size)),this.getContext().getImageData(e.x,e.y,e.width,e.height)},putImageData:function(e){var t=d.read(arguments,1);this.getContext(!0).putImageData(e,t.x,t.y)},setImageData:function(e){this.setSize(e),this.getContext(!0).putImageData(e,0,0)},_getBounds:function(e,t){var n=new g(this._size).setCenter(0,0);return e?e._transformBounds(n):n},_hitTestSelf:function(e){if(this._contains(e)){var t=this;return new T("pixel",t,{offset:e.add(t._size.divide(2)).round(),color:{get:function(){return t.getPixel(this.offset)}}})}},_draw:function(e,t,n){var r=this.getElement();if(r&&r.width>0&&r.height>0){e.globalAlpha=u.clamp(this._opacity,0,1),this._setStyles(e,t,n);var i=this._smoothing,a="off"===i;U.setPrefixed(e,a?"imageSmoothingEnabled":"imageSmoothingQuality",!a&&i),e.drawImage(r,-this._size.width/2,-this._size.height/2)}},_canComposite:function(){return!0}}),M=w.extend({_class:"SymbolItem",_applyMatrix:!1,_canApplyMatrix:!1,_boundsOptions:{stroke:!0},_serializeFields:{symbol:null},initialize:function(e,n){this._initialize(e,n!==t&&d.read(arguments,1))||this.setDefinition(e instanceof E?e:new E(e))},_equals:function(e){return this._definition===e._definition},copyContent:function(e){this.setDefinition(e._definition)},getDefinition:function(){return this._definition},setDefinition:function(e){this._definition=e,this._changed(9)},getSymbol:"#getDefinition",setSymbol:"#setDefinition",isEmpty:function(){return this._definition._item.isEmpty()},_getBounds:function(e,t){var n=this._definition._item;return n._getCachedBounds(n._matrix.prepended(e),t)},_hitTestSelf:function(e,t,n){var r=t.extend({all:!1}),i=this._definition._item._hitTest(e,r,n);return i&&(i.item=this),i},_draw:function(e,t){this._definition._item.draw(e,t)}}),E=i.extend({_class:"SymbolDefinition",initialize:function(e,t){this._id=h.get(),this.project=se.project,e&&this.setItem(e,t)},_serialize:function(e,t){return t.add(this,(function(){return i.serialize([this._class,this._item],e,!1,t)}))},_changed:function(e){8&e&&w._clearBoundsCache(this),1&e&&this.project._changed(e)},getItem:function(){return this._item},setItem:function(e,t){e._symbol&&(e=e.clone()),this._item&&(this._item._symbol=null),this._item=e,e.remove(),e.setSelected(!1),t||e.setPosition(new d),e._symbol=this,this._changed(9)},getDefinition:"#getItem",setDefinition:"#setItem",place:function(e){return new M(this,e)},clone:function(){return new E(this._item.clone(!1))},equals:function(e){return e===this||e&&this._item.equals(e._item)||!1}}),T=i.extend({_class:"HitResult",initialize:function(e,t,n){this.type=e,this.item=t,n&&this.inject(n)},statics:{getOptions:function(e){var t=e&&i.read(e);return new i({type:null,tolerance:se.settings.hitTolerance,fill:!t,stroke:!t,segments:!t,handles:!1,ends:!1,position:!1,center:!1,bounds:!1,guides:!1,selected:!1},t)}}}),A=i.extend({_class:"Segment",beans:!0,_selection:0,initialize:function(e,n,r,i,a,s){var o,c,l,u,h=arguments.length;h>0&&(null==e||"object"==typeof e?1===h&&e&&"point"in e?(o=e.point,c=e.handleIn,l=e.handleOut,u=e.selection):(o=e,c=n,l=r,u=i):(o=[e,n],c=r!==t?[r,i]:null,l=a!==t?[a,s]:null)),new P(o,this,"_point"),new P(c,this,"_handleIn"),new P(l,this,"_handleOut"),u&&this.setSelection(u)},_serialize:function(e,t){var n=this._point,r=this._selection,a=r||this.hasHandles()?[n,this._handleIn,this._handleOut]:n;return r&&a.push(r),i.serialize(a,e,!0,t)},_changed:function(e){var t=this._path;if(t){var n,r=t._curves,i=this._index;r&&(e&&e!==this._point&&e!==this._handleIn||!(n=i>0?r[i-1]:t._closed?r[r.length-1]:null)||n._changed(),e&&e!==this._point&&e!==this._handleOut||!(n=r[i])||n._changed()),t._changed(41)}},getPoint:function(){return this._point},setPoint:function(){this._point.set(d.read(arguments))},getHandleIn:function(){return this._handleIn},setHandleIn:function(){this._handleIn.set(d.read(arguments))},getHandleOut:function(){return this._handleOut},setHandleOut:function(){this._handleOut.set(d.read(arguments))},hasHandles:function(){return!this._handleIn.isZero()||!this._handleOut.isZero()},isSmooth:function(){var e=this._handleIn,t=this._handleOut;return!e.isZero()&&!t.isZero()&&e.isCollinear(t)},clearHandles:function(){this._handleIn._set(0,0),this._handleOut._set(0,0)},getSelection:function(){return this._selection},setSelection:function(e){var t=this._selection,n=this._path;this._selection=e=e||0,n&&e!==t&&(n._updateSelection(this,t,e),n._changed(257))},_changeSelection:function(e,t){var n=this._selection;this.setSelection(t?n|e:n&~e)},isSelected:function(){return!!(7&this._selection)},setSelected:function(e){this._changeSelection(7,e)},getIndex:function(){return this._index!==t?this._index:null},getPath:function(){return this._path||null},getCurve:function(){var e=this._path,t=this._index;return e?(t>0&&!e._closed&&t===e._segments.length-1&&t--,e.getCurves()[t]||null):null},getLocation:function(){var e=this.getCurve();return e?new N(e,this===e._segment1?0:1):null},getNext:function(){var e=this._path&&this._path._segments;return e&&(e[this._index+1]||this._path._closed&&e[0])||null},smooth:function(e,n,r){var i=e||{},a=i.type,s=i.factor,o=this.getPrevious(),c=this.getNext(),l=(o||this)._point,u=this._point,h=(c||this)._point,f=l.getDistance(u),p=u.getDistance(h);if(a&&"catmull-rom"!==a){if("geometric"!==a)throw new Error("Smoothing method '"+a+"' not supported.");if(o&&c){var m=l.subtract(h),g=s===t?.4:s,v=g*f/(f+p);n||this.setHandleIn(m.multiply(v)),r||this.setHandleOut(m.multiply(v-g))}}else{var y=s===t?.5:s,b=Math.pow(f,y),_=b*b,w=Math.pow(p,y),x=w*w;if(!n&&o){var k=2*x+3*w*b+_,S=3*w*(w+b);this.setHandleIn(0!==S?new d((x*l._x+k*u._x-_*h._x)/S-u._x,(x*l._y+k*u._y-_*h._y)/S-u._y):new d)}!r&&c&&(k=2*_+3*b*w+x,S=3*b*(b+w),this.setHandleOut(0!==S?new d((_*h._x+k*u._x-x*l._x)/S-u._x,(_*h._y+k*u._y-x*l._y)/S-u._y):new d))}},getPrevious:function(){var e=this._path&&this._path._segments;return e&&(e[this._index-1]||this._path._closed&&e[e.length-1])||null},isFirst:function(){return!this._index},isLast:function(){var e=this._path;return e&&this._index===e._segments.length-1||!1},reverse:function(){var e=this._handleIn,t=this._handleOut,n=e.clone();e.set(t),t.set(n)},reversed:function(){return new A(this._point,this._handleOut,this._handleIn)},remove:function(){return!!this._path&&!!this._path.removeSegment(this._index)},clone:function(){return new A(this._point,this._handleIn,this._handleOut)},equals:function(e){return e===this||e&&this._class===e._class&&this._point.equals(e._point)&&this._handleIn.equals(e._handleIn)&&this._handleOut.equals(e._handleOut)||!1},toString:function(){var e=["point: "+this._point];return this._handleIn.isZero()||e.push("handleIn: "+this._handleIn),this._handleOut.isZero()||e.push("handleOut: "+this._handleOut),"{ "+e.join(", ")+" }"},transform:function(e){this._transformCoordinates(e,new Array(6),!0),this._changed()},interpolate:function(e,t,n){var r=1-n,i=n,a=e._point,s=t._point,o=e._handleIn,c=t._handleIn,l=t._handleOut,u=e._handleOut;this._point._set(r*a._x+i*s._x,r*a._y+i*s._y,!0),this._handleIn._set(r*o._x+i*c._x,r*o._y+i*c._y,!0),this._handleOut._set(r*u._x+i*l._x,r*u._y+i*l._y,!0),this._changed()},_transformCoordinates:function(e,t,n){var r=this._point,i=n&&this._handleIn.isZero()?null:this._handleIn,a=n&&this._handleOut.isZero()?null:this._handleOut,s=r._x,o=r._y,c=2;return t[0]=s,t[1]=o,i&&(t[c++]=i._x+s,t[c++]=i._y+o),a&&(t[c++]=a._x+s,t[c++]=a._y+o),e&&(e._transformCoordinates(t,t,c/2),s=t[0],o=t[1],n?(r._x=s,r._y=o,c=2,i&&(i._x=t[c++]-s,i._y=t[c++]-o),a&&(a._x=t[c++]-s,a._y=t[c++]-o)):(i||(t[c++]=s,t[c++]=o),a||(t[c++]=s,t[c++]=o))),t}}),P=d.extend({initialize:function(e,n,r){var i,a,s;if(e)if((i=e[0])!==t)a=e[1];else{var o=e;(i=o.x)===t&&(i=(o=d.read(arguments)).x),a=o.y,s=o.selected}else i=a=0;this._x=i,this._y=a,this._owner=n,n[r]=this,s&&this.setSelected(!0)},_set:function(e,t){return this._x=e,this._y=t,this._owner._changed(this),this},getX:function(){return this._x},setX:function(e){this._x=e,this._owner._changed(this)},getY:function(){return this._y},setY:function(e){this._y=e,this._owner._changed(this)},isZero:function(){var e=u.isZero;return e(this._x)&&e(this._y)},isSelected:function(){return!!(this._owner._selection&this._getSelection())},setSelected:function(e){this._owner._changeSelection(this._getSelection(),e)},_getSelection:function(){var e=this._owner;return this===e._point?1:this===e._handleIn?2:this===e._handleOut?4:0}}),I=i.extend({_class:"Curve",beans:!0,initialize:function(e,t,n,r,i,a,s,o){var c,l,u,h,d,f,p=arguments.length;3===p?(this._path=e,c=t,l=n):p?1===p?"segment1"in e?(c=new A(e.segment1),l=new A(e.segment2)):"point1"in e?(u=e.point1,d=e.handle1,f=e.handle2,h=e.point2):Array.isArray(e)&&(u=[e[0],e[1]],h=[e[6],e[7]],d=[e[2]-e[0],e[3]-e[1]],f=[e[4]-e[6],e[5]-e[7]]):2===p?(c=new A(e),l=new A(t)):4===p?(u=e,d=t,f=n,h=r):8===p&&(u=[e,t],h=[s,o],d=[n-e,r-t],f=[i-s,a-o]):(c=new A,l=new A),this._segment1=c||new A(u,null,d),this._segment2=l||new A(h,f,null)},_serialize:function(e,t){return i.serialize(this.hasHandles()?[this.getPoint1(),this.getHandle1(),this.getHandle2(),this.getPoint2()]:[this.getPoint1(),this.getPoint2()],e,!0,t)},_changed:function(){this._length=this._bounds=t},clone:function(){return new I(this._segment1,this._segment2)},toString:function(){var e=["point1: "+this._segment1._point];return this._segment1._handleOut.isZero()||e.push("handle1: "+this._segment1._handleOut),this._segment2._handleIn.isZero()||e.push("handle2: "+this._segment2._handleIn),e.push("point2: "+this._segment2._point),"{ "+e.join(", ")+" }"},classify:function(){return I.classify(this.getValues())},remove:function(){var e=!1;if(this._path){var t=this._segment2,n=t._handleOut;(e=t.remove())&&this._segment1._handleOut.set(n)}return e},getPoint1:function(){return this._segment1._point},setPoint1:function(){this._segment1._point.set(d.read(arguments))},getPoint2:function(){return this._segment2._point},setPoint2:function(){this._segment2._point.set(d.read(arguments))},getHandle1:function(){return this._segment1._handleOut},setHandle1:function(){this._segment1._handleOut.set(d.read(arguments))},getHandle2:function(){return this._segment2._handleIn},setHandle2:function(){this._segment2._handleIn.set(d.read(arguments))},getSegment1:function(){return this._segment1},getSegment2:function(){return this._segment2},getPath:function(){return this._path},getIndex:function(){return this._segment1._index},getNext:function(){var e=this._path&&this._path._curves;return e&&(e[this._segment1._index+1]||this._path._closed&&e[0])||null},getPrevious:function(){var e=this._path&&this._path._curves;return e&&(e[this._segment1._index-1]||this._path._closed&&e[e.length-1])||null},isFirst:function(){return!this._segment1._index},isLast:function(){var e=this._path;return e&&this._segment1._index===e._curves.length-1||!1},isSelected:function(){return this.getPoint1().isSelected()&&this.getHandle1().isSelected()&&this.getHandle2().isSelected()&&this.getPoint2().isSelected()},setSelected:function(e){this.getPoint1().setSelected(e),this.getHandle1().setSelected(e),this.getHandle2().setSelected(e),this.getPoint2().setSelected(e)},getValues:function(e){return I.getValues(this._segment1,this._segment2,e)},getPoints:function(){for(var e=this.getValues(),t=[],n=0;n<8;n+=2)t.push(new d(e[n],e[n+1]));return t}},{getLength:function(){return null==this._length&&(this._length=I.getLength(this.getValues(),0,1)),this._length},getArea:function(){return I.getArea(this.getValues())},getLine:function(){return new b(this._segment1._point,this._segment2._point)},getPart:function(e,t){return new I(I.getPart(this.getValues(),e,t))},getPartLength:function(e,t){return I.getLength(this.getValues(),e,t)},divideAt:function(e){return this.divideAtTime(e&&e.curve===this?e.time:this.getTimeAt(e))},divideAtTime:function(e,t){var n=null;if(e>=1e-8&&e<=.99999999){var r=I.subdivide(this.getValues(),e),i=r[0],a=r[1],s=t||this.hasHandles(),o=this._segment1,c=this._segment2,l=this._path;s&&(o._handleOut._set(i[2]-i[0],i[3]-i[1]),c._handleIn._set(a[4]-a[6],a[5]-a[7]));var u=i[6],h=i[7],f=new A(new d(u,h),s&&new d(i[4]-u,i[5]-h),s&&new d(a[2]-u,a[3]-h));l?(l.insert(o._index+1,f),n=this.getNext()):(this._segment2=f,this._changed(),n=new I(f,c))}return n},splitAt:function(e){var t=this._path;return t?t.splitAt(e):null},splitAtTime:function(e){return this.splitAt(this.getLocationAtTime(e))},divide:function(e,n){return this.divideAtTime(e===t?.5:n?e:this.getTimeAt(e))},split:function(e,n){return this.splitAtTime(e===t?.5:n?e:this.getTimeAt(e))},reversed:function(){return new I(this._segment2.reversed(),this._segment1.reversed())},clearHandles:function(){this._segment1._handleOut._set(0,0),this._segment2._handleIn._set(0,0)},statics:{getValues:function(e,t,n,r){var i=e._point,a=e._handleOut,s=t._handleIn,o=t._point,c=i.x,l=i.y,u=o.x,h=o.y,d=r?[c,l,c,l,u,h,u,h]:[c,l,c+a._x,l+a._y,u+s._x,h+s._y,u,h];return n&&n._transformCoordinates(d,d,4),d},subdivide:function(e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],c=e[5],l=e[6],u=e[7];n===t&&(n=.5);var h=1-n,d=h*r+n*a,f=h*i+n*s,p=h*a+n*o,m=h*s+n*c,g=h*o+n*l,v=h*c+n*u,y=h*d+n*p,b=h*f+n*m,_=h*p+n*g,w=h*m+n*v,x=h*y+n*_,k=h*b+n*w;return[[r,i,d,f,y,b,x,k],[x,k,_,w,g,v,l,u]]},getMonoCurves:function(e,t){var n=[],r=t?0:1,i=e[r+0],a=e[r+2],s=e[r+4],o=e[r+6];if(i>=a==a>=s&&a>=s==s>=o||I.isStraight(e))n.push(e);else{var c=3*(a-s)-i+o,l=2*(i+s)-4*a,h=a-i,d=[],f=u.solveQuadratic(c,l,h,d,1e-8,.99999999);if(f){d.sort();var p=d[0],m=I.subdivide(e,p);n.push(m[0]),f>1&&(p=(d[1]-p)/(1-p),m=I.subdivide(m[1],p),n.push(m[0])),n.push(m[1])}else n.push(e)}return n},solveCubic:function(e,t,n,r,i,a){var s=e[t],o=e[t+2],c=e[t+4],l=e[t+6],h=0;if(!(s<n&&l<n&&o<n&&c<n||s>n&&l>n&&o>n&&c>n)){var d=3*(o-s),f=3*(c-o)-d,p=l-s-d-f;h=u.solveCubic(p,f,d,s-n,r,i,a)}return h},getTimeOf:function(e,t){var n=new d(e[0],e[1]),r=new d(e[6],e[7]),i=1e-7;if(null===(t.isClose(n,1e-12)?0:t.isClose(r,1e-12)?1:null))for(var a=[t.x,t.y],s=[],o=0;o<2;o++)for(var c=I.solveCubic(e,o,a[o],s,0,1),l=0;l<c;l++){var u=s[l];if(t.isClose(I.getPoint(e,u),i))return u}return t.isClose(n,i)?0:t.isClose(r,i)?1:null},getNearestTime:function(e,t){if(I.isStraight(e)){var n=e[0],r=e[1],i=e[6]-n,a=e[7]-r,s=i*i+a*a;if(0===s)return 0;var o=((t.x-n)*i+(t.y-r)*a)/s;return o<1e-12?0:o>.999999999999?1:I.getTimeOf(e,new d(n+o*i,r+o*a))}var c=1/0,l=0;function u(n){if(n>=0&&n<=1){var r=t.getDistance(I.getPoint(e,n),!0);if(r<c)return c=r,l=n,!0}}for(var h=0;h<=100;h++)u(h/100);for(var f=.005;f>1e-8;)u(l-f)||u(l+f)||(f/=2);return l},getPart:function(e,t,n){var r=t>n;if(r){var i=t;t=n,n=i}return t>0&&(e=I.subdivide(e,t)[1]),n<1&&(e=I.subdivide(e,(n-t)/(1-t))[0]),r?[e[6],e[7],e[4],e[5],e[2],e[3],e[0],e[1]]:e},isFlatEnough:function(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],c=e[6],l=e[7],u=3*i-2*n-c,h=3*a-2*r-l,d=3*s-2*c-n,f=3*o-2*l-r;return Math.max(u*u,d*d)+Math.max(h*h,f*f)<=16*t*t},getArea:function(e){var t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],c=e[7];return 3*((c-n)*(r+a)-(o-t)*(i+s)+i*(t-a)-r*(n-s)+c*(a+t/3)-o*(s+n/3))/20},getBounds:function(e){for(var t=e.slice(0,2),n=t.slice(),r=[0,0],i=0;i<2;i++)I._addBounds(e[i],e[i+2],e[i+4],e[i+6],i,0,t,n,r);return new g(t[0],t[1],n[0]-t[0],n[1]-t[1])},_addBounds:function(e,t,n,r,i,a,s,o,c){function l(e,t){var n=e-t,r=e+t;n<s[i]&&(s[i]=n),r>o[i]&&(o[i]=r)}a/=2;var h=s[i]+a,d=o[i]-a;if(e<h||t<h||n<h||r<h||e>d||t>d||n>d||r>d)if(t<e!=t<r&&n<e!=n<r)l(e,0),l(r,0);else{var f=3*(t-n)-e+r,p=2*(e+n)-4*t,m=t-e,g=u.solveQuadratic(f,p,m,c);l(r,0);for(var v=0;v<g;v++){var y=c[v],b=1-y;1e-8<=y&&y<=.99999999&&l(b*b*b*e+3*b*b*y*t+3*b*y*y*n+y*y*y*r,a)}}}}},i.each(["getBounds","getStrokeBounds","getHandleBounds"],(function(e){this[e]=function(){this._bounds||(this._bounds={});var t=this._bounds[e];return t||(t=this._bounds[e]=O[e]([this._segment1,this._segment2],!1,this._path)),t.clone()}}),{}),i.each({isStraight:function(e,t,n,r){if(t.isZero()&&n.isZero())return!0;var i=r.subtract(e);if(i.isZero())return!1;if(i.isCollinear(t)&&i.isCollinear(n)){var a=new b(e,r);if(a.getDistance(e.add(t))<1e-7&&a.getDistance(r.add(n))<1e-7){var s=i.dot(i),o=i.dot(t)/s,c=i.dot(n)/s;return o>=0&&o<=1&&c<=0&&c>=-1}}return!1},isLinear:function(e,t,n,r){var i=r.subtract(e).divide(3);return t.equals(i)&&n.negate().equals(i)}},(function(e,t){this[t]=function(t){var n=this._segment1,r=this._segment2;return e(n._point,n._handleOut,r._handleIn,r._point,t)},this.statics[t]=function(t,n){var r=t[0],i=t[1],a=t[6],s=t[7];return e(new d(r,i),new d(t[2]-r,t[3]-i),new d(t[4]-a,t[5]-s),new d(a,s),n)}}),{statics:{},hasHandles:function(){return!this._segment1._handleOut.isZero()||!this._segment2._handleIn.isZero()},hasLength:function(e){return(!this.getPoint1().equals(this.getPoint2())||this.hasHandles())&&this.getLength()>(e||0)},isCollinear:function(e){return e&&this.isStraight()&&e.isStraight()&&this.getLine().isCollinear(e.getLine())},isHorizontal:function(){return this.isStraight()&&Math.abs(this.getTangentAtTime(.5).y)<1e-8},isVertical:function(){return this.isStraight()&&Math.abs(this.getTangentAtTime(.5).x)<1e-8}}),{beans:!1,getLocationAt:function(e,t){return this.getLocationAtTime(t?e:this.getTimeAt(e))},getLocationAtTime:function(e){return null!=e&&e>=0&&e<=1?new N(this,e):null},getTimeAt:function(e,t){return I.getTimeAt(this.getValues(),e,t)},getParameterAt:"#getTimeAt",getTimesWithTangent:function(){var e=d.read(arguments);return e.isZero()?[]:I.getTimesWithTangent(this.getValues(),e)},getOffsetAtTime:function(e){return this.getPartLength(0,e)},getLocationOf:function(){return this.getLocationAtTime(this.getTimeOf(d.read(arguments)))},getOffsetOf:function(){var e=this.getLocationOf.apply(this,arguments);return e?e.getOffset():null},getTimeOf:function(){return I.getTimeOf(this.getValues(),d.read(arguments))},getParameterOf:"#getTimeOf",getNearestLocation:function(){var e=d.read(arguments),t=this.getValues(),n=I.getNearestTime(t,e),r=I.getPoint(t,n);return new N(this,n,r,null,e.getDistance(r))},getNearestPoint:function(){var e=this.getNearestLocation.apply(this,arguments);return e?e.getPoint():e}},new function(){var e=["getPoint","getTangent","getNormal","getWeightedTangent","getWeightedNormal","getCurvature"];return i.each(e,(function(e){this[e+"At"]=function(t,n){var r=this.getValues();return I[e](r,n?t:I.getTimeAt(r,t))},this[e+"AtTime"]=function(t){return I[e](this.getValues(),t)}}),{statics:{_evaluateMethods:e}})},new function(){function e(e){var t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],c=e[7],l=9*(r-a)+3*(o-t),u=6*(t+a)-12*r,h=3*(r-t),d=9*(i-s)+3*(c-n),f=6*(n+s)-12*i,p=3*(i-n);return function(e){var t=(l*e+u)*e+h,n=(d*e+f)*e+p;return Math.sqrt(t*t+n*n)}}function n(e,t){return Math.max(2,Math.min(16,Math.ceil(32*Math.abs(t-e))))}function r(e,t,n,r){if(null==t||t<0||t>1)return null;var i=e[0],a=e[1],s=e[2],o=e[3],c=e[4],l=e[5],h=e[6],f=e[7],p=u.isZero;p(s-i)&&p(o-a)&&(s=i,o=a),p(c-h)&&p(l-f)&&(c=h,l=f);var m,g,v=3*(s-i),y=3*(c-s)-v,b=h-i-v-y,_=3*(o-a),w=3*(l-o)-_,x=f-a-_-w;if(0===n)m=0===t?i:1===t?h:((b*t+y)*t+v)*t+i,g=0===t?a:1===t?f:((x*t+w)*t+_)*t+a;else{var k=1e-8,S=1-k;if(t<k?(m=v,g=_):t>S?(m=3*(h-c),g=3*(f-l)):(m=(3*b*t+2*y)*t+v,g=(3*x*t+2*w)*t+_),r){0===m&&0===g&&(t<k||t>S)&&(m=c-s,g=l-o);var C=Math.sqrt(m*m+g*g);C&&(m/=C,g/=C)}if(3===n){c=6*b*t+2*y,l=6*x*t+2*w;var M=Math.pow(m*m+g*g,1.5);m=0!==M?(m*l-g*c)/M:0,g=0}}return 2===n?new d(g,-m):new d(m,g)}return{statics:{classify:function(e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],c=e[6],l=e[7],h=i*(r-l)+a*(c-n)+n*l-r*c,d=3*(s*(a-r)+o*(n-i)+i*r-a*n),f=d-h,p=f-h+(n*(l-o)+r*(s-c)+c*o-l*s),m=Math.sqrt(p*p+f*f+d*d),g=0!==m?1/m:0,v=u.isZero,y="serpentine";function b(e,n,r){var i=n!==t,a=i&&n>0&&n<1,s=i&&r>0&&r<1;return!i||(a||s)&&("loop"!==e||a&&s)||(e="arch",a=s=!1),{type:e,roots:a||s?a&&s?n<r?[n,r]:[r,n]:[a?n:r]:null}}if(f*=g,d*=g,v(p*=g))return v(f)?b(v(d)?"line":"quadratic"):b(y,d/(3*f));var _=3*f*f-4*p*d;if(v(_))return b("cusp",f/(2*p));var w=_>0?Math.sqrt(_/3):Math.sqrt(-_),x=2*p;return b(_>0?y:"loop",(f+w)/x,(f-w)/x)},getLength:function(r,i,a,s){if(i===t&&(i=0),a===t&&(a=1),I.isStraight(r)){var o=r;a<1&&(o=I.subdivide(o,a)[0],i/=a),i>0&&(o=I.subdivide(o,i)[1]);var c=o[6]-o[0],l=o[7]-o[1];return Math.sqrt(c*c+l*l)}return u.integrate(s||e(r),i,a,n(i,a))},getTimeAt:function(r,i,a){if(a===t&&(a=i<0?1:0),0===i)return a;var s=Math.abs,o=i>0,c=o?a:0,l=o?1:a,h=e(r),d=I.getLength(r,c,l,h),f=s(i)-d;if(s(f)<1e-12)return o?l:c;if(f>1e-12)return null;var p=i/d,m=0;return u.findRoot((function(e){return m+=u.integrate(h,a,e,n(a,e)),a=e,m-i}),h,a+p,c,l,32,1e-12)},getPoint:function(e,t){return r(e,t,0,!1)},getTangent:function(e,t){return r(e,t,1,!0)},getWeightedTangent:function(e,t){return r(e,t,1,!1)},getNormal:function(e,t){return r(e,t,2,!0)},getWeightedNormal:function(e,t){return r(e,t,2,!1)},getCurvature:function(e,t){return r(e,t,3,!1).x},getPeaks:function(e){var t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=3*r-t-3*a+e[6],c=3*t-6*r+3*a,l=-3*t+3*r,h=3*i-n-3*s+e[7],d=3*n-6*i+3*s,f=-3*n+3*i,p=[];return u.solveCubic(9*(o*o+h*h),9*(o*c+d*h),2*(c*c+d*d)+3*(l*o+f*h),l*c+d*f,p,1e-8,.99999999),p.sort()}}}},new function(){function e(e,t,n,r,i,a,s){var o=!s&&n.getPrevious()===i,c=!s&&n!==i&&n.getNext()===i,l=1e-8,u=1-l;if(null!==r&&r>=(o?l:0)&&r<=(c?u:1)&&null!==a&&a>=(c?l:0)&&a<=(o?u:1)){var h=new N(n,r,null,s),d=new N(i,a,null,s);h._intersection=d,d._intersection=h,t&&!t(h)||N.insert(e,h,!0)}}function t(r,i,a,s,o,c,l,u,h,d,f,p,m){if(++h>=4096||++u>=40)return h;var g,v,y=i[0],_=i[1],w=i[6],x=i[7],k=b.getSignedDistance,S=k(y,_,w,x,i[2],i[3]),C=k(y,_,w,x,i[4],i[5]),M=S*C>0?3/4:4/9,E=M*Math.min(0,S,C),T=M*Math.max(0,S,C),A=k(y,_,w,x,r[0],r[1]),P=k(y,_,w,x,r[2],r[3]),N=k(y,_,w,x,r[4],r[5]),D=k(y,_,w,x,r[6],r[7]),O=function(e,t,n,r){var i,a=[0,e],s=[1/3,t],o=[2/3,n],c=[1,r],l=t-(2*e+r)/3,u=n-(e+2*r)/3;if(l*u<0)i=[[a,s,c],[a,o,c]];else{var h=l/u;i=[h>=2?[a,s,c]:h<=.5?[a,o,c]:[a,s,o,c],[a,c]]}return(l||u)<0?i.reverse():i}(A,P,N,D),L=O[0],B=O[1];if(0===S&&0===C&&0===A&&0===P&&0===N&&0===D||null==(g=n(L,B,E,T))||null==(v=n(L.reverse(),B.reverse(),E,T)))return h;var R=d+(f-d)*g,V=d+(f-d)*v;if(Math.max(m-p,V-R)<1e-9){var F=(R+V)/2,z=(p+m)/2;e(o,c,l?s:a,l?z:F,l?a:s,l?F:z)}else{r=I.getPart(r,g,v);var j=m-p;if(v-g>.8)if(V-R>j)F=(R+V)/2,h=t(i,(q=I.subdivide(r,.5))[0],s,a,o,c,!l,u,h,p,m,R,F),h=t(i,q[1],s,a,o,c,!l,u,h,p,m,F,V);else{var q;z=(p+m)/2,h=t((q=I.subdivide(i,.5))[0],r,s,a,o,c,!l,u,h,p,z,R,V),h=t(q[1],r,s,a,o,c,!l,u,h,z,m,R,V)}else h=0===j||j>=1e-9?t(i,r,s,a,o,c,!l,u,h,p,m,R,V):t(r,i,a,s,o,c,l,u,h,R,V,p,m)}return h}function n(e,t,n,i){return e[0][1]<n?r(e,!0,n):t[0][1]>i?r(t,!1,i):e[0][0]}function r(e,t,n){for(var r=e[0][0],i=e[0][1],a=1,s=e.length;a<s;a++){var o=e[a][0],c=e[a][1];if(t?c>=n:c<=n)return c===n?o:r+(n-i)*(o-r)/(c-i);r=o,i=c}return null}function i(e,t,n,r,i){var a=u.isZero;if(a(r)&&a(i)){var s=I.getTimeOf(e,new d(t,n));return null===s?[]:[s]}for(var o=Math.atan2(-i,r),c=Math.sin(o),l=Math.cos(o),h=[],f=[],p=0;p<8;p+=2){var m=e[p]-t,g=e[p+1]-n;h.push(m*l-g*c,m*c+g*l)}return I.solveCubic(h,1,0,f,0,1),f}function a(t,n,r,a,s,o,c){for(var l=n[0],u=n[1],h=i(t,l,u,n[6]-l,n[7]-u),d=0,f=h.length;d<f;d++){var p=h[d],m=I.getPoint(t,p),g=I.getTimeOf(n,m);null!==g&&e(s,o,c?a:r,c?g:p,c?r:a,c?p:g)}}function s(t,n,r,i,a,s){var o=b.intersect(t[0],t[1],t[6],t[7],n[0],n[1],n[6],n[7]);o&&e(a,s,r,I.getTimeOf(t,o),i,I.getTimeOf(n,o))}function o(n,r,i,o,c,l){var u=1e-12,f=Math.min,p=Math.max;if(p(n[0],n[2],n[4],n[6])+u>f(r[0],r[2],r[4],r[6])&&f(n[0],n[2],n[4],n[6])-u<p(r[0],r[2],r[4],r[6])&&p(n[1],n[3],n[5],n[7])+u>f(r[1],r[3],r[5],r[7])&&f(n[1],n[3],n[5],n[7])-u<p(r[1],r[3],r[5],r[7])){var m=h(n,r);if(m)for(var g=0;g<2;g++){var v=m[g];e(c,l,i,v[0],o,v[1],!0)}else{var y=I.isStraight(n),b=I.isStraight(r),_=y&&b,w=y&&!b,x=c.length;if((_?s:y||b?a:t)(w?r:n,w?n:r,w?o:i,w?i:o,c,l,w,0,0,0,1,0,1),!_||c.length===x)for(g=0;g<4;g++){var k=g>>1,S=1&g,C=6*k,M=6*S,E=new d(n[C],n[C+1]),T=new d(r[M],r[M+1]);E.isClose(T,u)&&e(c,l,i,k,o,S)}}}return c}function l(t,n,r,i){var a=I.classify(t);if("loop"===a.type){var s=a.roots;e(r,i,n,s[0],n,s[1])}return r}function h(e,t){function n(e){var t=e[6]-e[0],n=e[7]-e[1];return t*t+n*n}var r=Math.abs,i=b.getDistance,a=1e-7,s=I.isStraight(e),o=I.isStraight(t),c=s&&o,l=n(e)<n(t),u=l?t:e,h=l?e:t,f=u[0],p=u[1],m=u[6]-f,g=u[7]-p;if(i(f,p,m,g,h[0],h[1],!0)<a&&i(f,p,m,g,h[6],h[7],!0)<a)!c&&i(f,p,m,g,u[2],u[3],!0)<a&&i(f,p,m,g,u[4],u[5],!0)<a&&i(f,p,m,g,h[2],h[3],!0)<a&&i(f,p,m,g,h[4],h[5],!0)<a&&(s=o=c=!0);else if(c)return null;if(s^o)return null;for(var v=[e,t],y=[],_=0;_<4&&y.length<2;_++){var w=1&_,x=1^w,k=_>>1,S=I.getTimeOf(v[w],new d(v[x][k?6:0],v[x][k?7:1]));if(null!=S){var C=w?[k,S]:[S,k];(!y.length||r(C[0]-y[0][0])>1e-8&&r(C[1]-y[0][1])>1e-8)&&y.push(C)}if(_>2&&!y.length)break}if(2!==y.length)y=null;else if(!c){var M=I.getPart(e,y[0][0],y[1][0]),E=I.getPart(t,y[0][1],y[1][1]);(r(E[2]-M[2])>a||r(E[3]-M[3])>a||r(E[4]-M[4])>a||r(E[5]-M[5])>a)&&(y=null)}return y}return{getIntersections:function(e){var t=this.getValues(),n=e&&e!==this&&e.getValues();return n?o(t,n,this,e,[]):l(t,this,[])},statics:{getOverlaps:h,getIntersections:function(e,t,n,r,i,a){var s=!t;s&&(t=e);for(var u=e.length,h=t.length,d=new Array(u),f=s?d:new Array(h),p=[],m=0;m<u;m++)d[m]=e[m].getValues(r);if(!s)for(m=0;m<h;m++)f[m]=t[m].getValues(i);for(var g=c.findCurveBoundsCollisions(d,f,1e-7),v=0;v<u;v++){var y=e[v],b=d[v];s&&l(b,y,p,n);var _=g[v];if(_)for(var w=0;w<_.length;w++){if(a&&p.length)return p;var x=_[w];if(!s||x>v){var k=t[x];o(b,f[x],y,k,p,n)}}}return p},getCurveLineIntersections:i,getTimesWithTangent:function(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],c=e[6],l=e[7],h=t.normalize(),d=h.x,f=h.y,p=3*c-9*s+9*i-3*n,m=3*l-9*o+9*a-3*r,g=6*s-12*i+6*n,v=6*o-12*a+6*r,y=3*i-3*n,b=3*a-3*r,_=2*p*f-2*m*d,w=[];if(Math.abs(_)<u.CURVETIME_EPSILON){if(0!=(_=p*v-m*g)){var x=-(p*b-m*y)/_;x>=0&&x<=1&&w.push(x)}}else{var k=(g*g-4*p*y)*f*f+(-2*g*v+4*m*y+4*p*b)*d*f+(v*v-4*m*b)*d*d,S=g*f-v*d;if(k>=0&&0!=_){var C=Math.sqrt(k),M=-(S+C)/_,E=(-S+C)/_;M>=0&&M<=1&&w.push(M),E>=0&&E<=1&&w.push(E)}}return w}}}}),N=i.extend({_class:"CurveLocation",initialize:function(e,t,n,r,i){if(t>=.99999999){var a=e.getNext();a&&(t=0,e=a)}this._setCurve(e),this._time=t,this._point=n||e.getPointAtTime(t),this._overlap=r,this._distance=i,this._intersection=this._next=this._previous=null},_setPath:function(e){this._path=e,this._version=e?e._version:0},_setCurve:function(e){this._setPath(e._path),this._curve=e,this._segment=null,this._segment1=e._segment1,this._segment2=e._segment2},_setSegment:function(e){var t=e.getCurve();t?this._setCurve(t):(this._setPath(e._path),this._segment1=e,this._segment2=null),this._segment=e,this._time=e===this._segment1?0:1,this._point=e._point.clone()},getSegment:function(){var e=this._segment;if(!e){var t=this.getCurve(),n=this.getTime();0===n?e=t._segment1:1===n?e=t._segment2:null!=n&&(e=t.getPartLength(0,n)<t.getPartLength(n,1)?t._segment1:t._segment2),this._segment=e}return e},getCurve:function(){var e=this._path,t=this;function n(e){var n=e&&e.getCurve();if(n&&null!=(t._time=n.getTimeOf(t._point)))return t._setCurve(n),n}return e&&e._version!==this._version&&(this._time=this._offset=this._curveOffset=this._curve=null),this._curve||n(this._segment)||n(this._segment1)||n(this._segment2.getPrevious())},getPath:function(){var e=this.getCurve();return e&&e._path},getIndex:function(){var e=this.getCurve();return e&&e.getIndex()},getTime:function(){var e=this.getCurve(),t=this._time;return e&&null==t?this._time=e.getTimeOf(this._point):t},getParameter:"#getTime",getPoint:function(){return this._point},getOffset:function(){var e=this._offset;if(null==e){e=0;var t=this.getPath(),n=this.getIndex();if(t&&null!=n)for(var r=t.getCurves(),i=0;i<n;i++)e+=r[i].getLength();this._offset=e+=this.getCurveOffset()}return e},getCurveOffset:function(){var e=this._curveOffset;if(null==e){var t=this.getCurve(),n=this.getTime();this._curveOffset=e=null!=n&&t&&t.getPartLength(0,n)}return e},getIntersection:function(){return this._intersection},getDistance:function(){return this._distance},divide:function(){var e=this.getCurve(),t=e&&e.divideAtTime(this.getTime());return t&&this._setSegment(t._segment1),t},split:function(){var e=this.getCurve(),t=e._path,n=e&&e.splitAtTime(this.getTime());return n&&this._setSegment(t.getLastSegment()),n},equals:function(e,t){var n=this===e;if(!n&&e instanceof N){var r=this.getCurve(),i=e.getCurve(),a=r._path;if(a===i._path){var s=Math.abs,o=s(this.getOffset()-e.getOffset()),c=!t&&this._intersection,l=!t&&e._intersection;n=(o<1e-7||a&&s(a.getLength()-o)<1e-7)&&(!c&&!l||c&&l&&c.equals(l,!0))}}return n},toString:function(){var e=[],t=this.getPoint(),n=l.instance;t&&e.push("point: "+t);var r=this.getIndex();null!=r&&e.push("index: "+r);var i=this.getTime();return null!=i&&e.push("time: "+n.number(i)),null!=this._distance&&e.push("distance: "+n.number(this._distance)),"{ "+e.join(", ")+" }"},isTouching:function(){var e=this._intersection;if(e&&this.getTangent().isCollinear(e.getTangent())){var t=this.getCurve(),n=e.getCurve();return!(t.isStraight()&&n.isStraight()&&t.getLine().intersect(n.getLine()))}return!1},isCrossing:function(){var e=this._intersection;if(!e)return!1;var t=this.getTime(),n=e.getTime(),r=1e-8,i=1-r,a=t>=r&&t<=i,s=n>=r&&n<=i;if(a&&s)return!this.isTouching();var o=this.getCurve(),c=o&&t<r?o.getPrevious():o,l=e.getCurve(),u=l&&n<r?l.getPrevious():l;if(t>i&&(o=o.getNext()),n>i&&(l=l.getNext()),!(c&&o&&u&&l))return!1;var h=[];function d(e,t){var n=e.getValues(),r=I.classify(n).roots||I.getPeaks(n),i=r.length,a=I.getLength(n,t&&i?r[i-1]:0,!t&&i?r[0]:1);h.push(i?a:a/32)}function f(e,t,n){return t<n?e>t&&e<n:e>t||e<n}a||(d(c,!0),d(o,!1)),s||(d(u,!0),d(l,!1));var p=this.getPoint(),m=Math.min.apply(Math,h),g=a?o.getTangentAtTime(t):o.getPointAt(m).subtract(p),v=a?g.negate():c.getPointAt(-m).subtract(p),y=s?l.getTangentAtTime(n):l.getPointAt(m).subtract(p),b=s?y.negate():u.getPointAt(-m).subtract(p),_=v.getAngle(),w=g.getAngle(),x=b.getAngle(),k=y.getAngle();return!!(a?f(_,x,k)^f(w,x,k)&&f(_,k,x)^f(w,k,x):f(x,_,w)^f(k,_,w)&&f(x,w,_)^f(k,w,_))},hasOverlap:function(){return!!this._overlap}},i.each(I._evaluateMethods,(function(e){var t=e+"At";this[e]=function(){var e=this.getCurve(),n=this.getTime();return null!=n&&e&&e[t](n,!0)}}),{preserve:!0}),new function(){function e(e,t,n){var r=e.length,i=0,a=r-1;function s(n,i){for(var a=n+i;a>=-1&&a<=r;a+=i){var s=e[(a%r+r)%r];if(!t.getPoint().isClose(s.getPoint(),1e-7))break;if(t.equals(s))return s}return null}for(;i<=a;){var o,c=i+a>>>1,l=e[c];if(n&&(o=t.equals(l)?l:s(c,-1)||s(c,1)))return t._overlap&&(o._overlap=o._intersection._overlap=!0),o;var u=t.getPath(),h=l.getPath();(u!==h?u._id-h._id:t.getIndex()+t.getTime()-(l.getIndex()+l.getTime()))<0?a=c-1:i=c+1}return e.splice(i,0,t),t}return{statics:{insert:e,expand:function(t){for(var n=t.slice(),r=t.length-1;r>=0;r--)e(n,t[r]._intersection,!1);return n}}}}),D=w.extend({_class:"PathItem",_selectBounds:!1,_canScaleStroke:!0,beans:!0,initialize:function(){},statics:{create:function(e){var t,n,r;if(i.isPlainObject(e)?(n=e.segments,t=e.pathData):Array.isArray(e)?n=e:"string"==typeof e&&(t=e),n){var a=n[0];r=a&&Array.isArray(a[0])}else t&&(r=(t.match(/m/gi)||[]).length>1||/z\s*\S+/i.test(t));return new(r?L:O)(e)}},_asPathItem:function(){return this},isClockwise:function(){return this.getArea()>=0},setClockwise:function(e){this.isClockwise()!=(e=!!e)&&this.reverse()},setPathData:function(e){var t,n,r,i=e&&e.match(/[mlhvcsqtaz][^mlhvcsqtaz]*/gi),a=!1,s=new d,o=new d;function c(e,n){var r=+t[e];return a&&(r+=s[n]),r}function l(e){return new d(c(e,"x"),c(e+1,"y"))}this.clear();for(var u=0,h=i&&i.length;u<h;u++){var f=i[u],m=f[0],g=m.toLowerCase(),v=(t=f.match(/[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g))&&t.length;switch(a=m===g,"z"!==n||/[mz]/.test(g)||this.moveTo(s),g){case"m":case"l":for(var y="m"===g,b=0;b<v;b+=2)this[y?"moveTo":"lineTo"](s=l(b)),y&&(o=s,y=!1);r=s;break;case"h":case"v":var _="h"===g?"x":"y";for(s=s.clone(),b=0;b<v;b++)s[_]=c(b,_),this.lineTo(s);r=s;break;case"c":for(b=0;b<v;b+=6)this.cubicCurveTo(l(b),r=l(b+2),s=l(b+4));break;case"s":for(b=0;b<v;b+=4)this.cubicCurveTo(/[cs]/.test(n)?s.multiply(2).subtract(r):s,r=l(b),s=l(b+2)),n=g;break;case"q":for(b=0;b<v;b+=4)this.quadraticCurveTo(r=l(b),s=l(b+2));break;case"t":for(b=0;b<v;b+=2)this.quadraticCurveTo(r=/[qt]/.test(n)?s.multiply(2).subtract(r):s,s=l(b)),n=g;break;case"a":for(b=0;b<v;b+=7)this.arcTo(s=l(b+5),new p(+t[b],+t[b+1]),+t[b+2],+t[b+4],+t[b+3]);break;case"z":this.closePath(1e-12),s=o}n=g}},_canComposite:function(){return!(this.hasFill()&&this.hasStroke())},_contains:function(e){var t=e.isInside(this.getBounds({internal:!0,handle:!0}))?this._getWinding(e):{};return t.onPath||!!("evenodd"===this.getFillRule()?1&t.windingL||1&t.windingR:t.winding)},getIntersections:function(e,t,n,r){var i=this===e||!e,a=this._matrix._orNullIfIdentity(),s=i?a:(n||e._matrix)._orNullIfIdentity();return i||this.getBounds(a).intersects(e.getBounds(s),1e-12)?I.getIntersections(this.getCurves(),!i&&e.getCurves(),t,a,s,r):[]},getCrossings:function(e){return this.getIntersections(e,(function(e){return e.isCrossing()}))},getNearestLocation:function(){for(var e=d.read(arguments),t=this.getCurves(),n=1/0,r=null,i=0,a=t.length;i<a;i++){var s=t[i].getNearestLocation(e);s._distance<n&&(n=s._distance,r=s)}return r},getNearestPoint:function(){var e=this.getNearestLocation.apply(this,arguments);return e?e.getPoint():e},interpolate:function(e,t,n){var r=!this._children,i=r?"_segments":"_children",a=e[i],s=t[i],o=this[i];if(!a||!s||a.length!==s.length)throw new Error("Invalid operands in interpolate() call: "+e+", "+t);var c=o.length,l=s.length;if(c<l)for(var u=r?A:O,h=c;h<l;h++)this.add(new u);else c>l&&this[r?"removeSegments":"removeChildren"](l,c);for(h=0;h<l;h++)o[h].interpolate(a[h],s[h],n);r&&(this.setClosed(e._closed),this._changed(9))},compare:function(e){var t=!1;if(e){var n=this._children||[this],r=e._children?e._children.slice():[e],i=n.length,a=r.length,s=[],o=0;t=!0;for(var l=c.findItemBoundsCollisions(n,r,u.GEOMETRIC_EPSILON),h=i-1;h>=0&&t;h--){var d=n[h];t=!1;var f=l[h];if(f)for(var p=f.length-1;p>=0&&!t;p--)d.compare(r[f[p]])&&(s[f[p]]||(s[f[p]]=!0,o++),t=!0)}t=t&&o===a}return t}}),O=D.extend({_class:"Path",_serializeFields:{segments:[],closed:!1},initialize:function(e){this._closed=!1,this._segments=[],this._version=0;var n=arguments,r=Array.isArray(e)?"object"==typeof e[0]?e:n:!e||e.size!==t||e.x===t&&e.point===t?null:n;r&&r.length>0?this.setSegments(r):(this._curves=t,this._segmentSelection=0,r||"string"!=typeof e||(this.setPathData(e),e=null)),this._initialize(!r&&e)},_equals:function(e){return this._closed===e._closed&&i.equals(this._segments,e._segments)},copyContent:function(e){this.setSegments(e._segments),this._closed=e._closed},_changed:function e(n){if(e.base.call(this,n),8&n){if(this._length=this._area=t,32&n)this._version++;else if(this._curves)for(var r=0,i=this._curves.length;r<i;r++)this._curves[r]._changed()}else 64&n&&(this._bounds=t)},getStyle:function(){var e=this._parent;return(e instanceof L?e:this)._style},getSegments:function(){return this._segments},setSegments:function(e){var n=this.isFullySelected(),r=e&&e.length;if(this._segments.length=0,this._segmentSelection=0,this._curves=t,r){var i=e[r-1];"boolean"==typeof i&&(this.setClosed(i),r--),this._add(A.readList(e,0,{},r))}n&&this.setFullySelected(!0)},getFirstSegment:function(){return this._segments[0]},getLastSegment:function(){return this._segments[this._segments.length-1]},getCurves:function(){var e=this._curves,t=this._segments;if(!e){var n=this._countCurves();e=this._curves=new Array(n);for(var r=0;r<n;r++)e[r]=new I(this,t[r],t[r+1]||t[0])}return e},getFirstCurve:function(){return this.getCurves()[0]},getLastCurve:function(){var e=this.getCurves();return e[e.length-1]},isClosed:function(){return this._closed},setClosed:function(e){if(this._closed!=(e=!!e)){if(this._closed=e,this._curves){var t=this._curves.length=this._countCurves();e&&(this._curves[t-1]=new I(this,this._segments[t-1],this._segments[0]))}this._changed(41)}}},{beans:!0,getPathData:function(e,t){var n,r,i,a,s,o,c,u,h=this._segments,d=h.length,f=new l(t),p=new Array(6),m=!0,g=[];function v(t,l){if(t._transformCoordinates(e,p),n=p[0],r=p[1],m)g.push("M"+f.pair(n,r)),m=!1;else if(s=p[2],o=p[3],s===n&&o===r&&c===i&&u===a){if(!l){var h=n-i,d=r-a;g.push(0===h?"v"+f.number(d):0===d?"h"+f.number(h):"l"+f.pair(h,d))}}else g.push("c"+f.pair(c-i,u-a)+" "+f.pair(s-i,o-a)+" "+f.pair(n-i,r-a));i=n,a=r,c=p[4],u=p[5]}if(!d)return"";for(var y=0;y<d;y++)v(h[y]);return this._closed&&d>0&&(v(h[0],!0),g.push("z")),g.join("")},isEmpty:function(){return!this._segments.length},_transformContent:function(e){for(var t=this._segments,n=new Array(6),r=0,i=t.length;r<i;r++)t[r]._transformCoordinates(e,n,!0);return!0},_add:function(e,t){for(var n=this._segments,r=this._curves,a=e.length,s=null==t,o=(t=s?n.length:t,0);o<a;o++){var c=e[o];c._path&&(c=e[o]=c.clone()),c._path=this,c._index=t+o,c._selection&&this._updateSelection(c,0,c._selection)}if(s)i.push(n,e);else{n.splice.apply(n,[t,0].concat(e)),o=t+a;for(var l=n.length;o<l;o++)n[o]._index=o}if(r){var u=this._countCurves(),h=t>0&&t+a-1===u?t-1:t,d=h,f=Math.min(h+a,u);for(e._curves&&(r.splice.apply(r,[h,0].concat(e._curves)),d+=e._curves.length),o=d;o<f;o++)r.splice(o,0,new I(this,null,null));this._adjustCurves(h,f)}return this._changed(41),e},_adjustCurves:function(e,t){for(var n,r=this._segments,i=this._curves,a=e;a<t;a++)(n=i[a])._path=this,n._segment1=r[a],n._segment2=r[a+1]||r[0],n._changed();(n=i[this._closed&&!e?r.length-1:e-1])&&(n._segment2=r[e]||r[0],n._changed()),(n=i[t])&&(n._segment1=r[t],n._changed())},_countCurves:function(){var e=this._segments.length;return!this._closed&&e>0?e-1:e},add:function(e){var t=arguments;return t.length>1&&"number"!=typeof e?this._add(A.readList(t)):this._add([A.read(t)])[0]},insert:function(e,t){var n=arguments;return n.length>2&&"number"!=typeof t?this._add(A.readList(n,1),e):this._add([A.read(n,1)],e)[0]},addSegment:function(){return this._add([A.read(arguments)])[0]},insertSegment:function(e){return this._add([A.read(arguments,1)],e)[0]},addSegments:function(e){return this._add(A.readList(e))},insertSegments:function(e,t){return this._add(A.readList(t),e)},removeSegment:function(e){return this.removeSegments(e,e+1)[0]||null},removeSegments:function(e,t,n){e=e||0,t=i.pick(t,this._segments.length);var r=this._segments,a=this._curves,s=r.length,o=r.splice(e,t-e),c=o.length;if(!c)return o;for(var l=0;l<c;l++){var u=o[l];u._selection&&this._updateSelection(u,u._selection,0),u._index=u._path=null}l=e;for(var h=r.length;l<h;l++)r[l]._index=l;if(a){var d=e>0&&t===s+(this._closed?1:0)?e-1:e;for(l=(a=a.splice(d,c)).length-1;l>=0;l--)a[l]._path=null;n&&(o._curves=a.slice(1)),this._adjustCurves(d,d)}return this._changed(41),o},clear:"#removeSegments",hasHandles:function(){for(var e=this._segments,t=0,n=e.length;t<n;t++)if(e[t].hasHandles())return!0;return!1},clearHandles:function(){for(var e=this._segments,t=0,n=e.length;t<n;t++)e[t].clearHandles()},getLength:function(){if(null==this._length){for(var e=this.getCurves(),t=0,n=0,r=e.length;n<r;n++)t+=e[n].getLength();this._length=t}return this._length},getArea:function(){var e=this._area;if(null==e){var t=this._segments,n=this._closed;e=0;for(var r=0,i=t.length;r<i;r++){var a=r+1===i;e+=I.getArea(I.getValues(t[r],t[a?0:r+1],null,a&&!n))}this._area=e}return e},isFullySelected:function(){var e=this._segments.length;return this.isSelected()&&e>0&&this._segmentSelection===7*e},setFullySelected:function(e){e&&this._selectSegments(!0),this.setSelected(e)},setSelection:function e(t){1&t||this._selectSegments(!1),e.base.call(this,t)},_selectSegments:function(e){var t=this._segments,n=t.length,r=e?7:0;this._segmentSelection=r*n;for(var i=0;i<n;i++)t[i]._selection=r},_updateSelection:function(e,t,n){e._selection=n,(this._segmentSelection+=n-t)>0&&this.setSelected(!0)},divideAt:function(e){var t,n=this.getLocationAt(e);return n&&(t=n.getCurve().divideAt(n.getCurveOffset()))?t._segment1:null},splitAt:function(e){var t=this.getLocationAt(e),n=t&&t.index,r=t&&t.time;r>.99999999&&(n++,r=0);var i=this.getCurves();if(n>=0&&n<i.length){r>=1e-8&&i[n++].divideAtTime(r);var a,s=this.removeSegments(n,this._segments.length,!0);return this._closed?(this.setClosed(!1),a=this):((a=new O(w.NO_INSERT)).insertAbove(this),a.copyAttributes(this)),a._add(s,0),this.addSegment(s[0]),a}return null},split:function(e,n){var r,i=n===t?e:(r=this.getCurves()[e])&&r.getLocationAtTime(n);return null!=i?this.splitAt(i):null},join:function(e,t){var n=t||0;if(e&&e!==this){var r=e._segments,i=this.getLastSegment(),a=e.getLastSegment();if(!a)return this;i&&i._point.isClose(a._point,n)&&e.reverse();var s=e.getFirstSegment();if(i&&i._point.isClose(s._point,n))i.setHandleOut(s._handleOut),this._add(r.slice(1));else{var o=this.getFirstSegment();o&&o._point.isClose(s._point,n)&&e.reverse(),a=e.getLastSegment(),o&&o._point.isClose(a._point,n)?(o.setHandleIn(a._handleIn),this._add(r.slice(0,r.length-1),0)):this._add(r.slice())}e._closed&&this._add([r[0]]),e.remove()}var c=this.getFirstSegment(),l=this.getLastSegment();return c!==l&&c._point.isClose(l._point,n)&&(c.setHandleIn(l._handleIn),l.remove(),this.setClosed(!0)),this},reduce:function(e){for(var t=this.getCurves(),n=e&&e.simplify,r=n?1e-7:0,i=t.length-1;i>=0;i--){var a=t[i];!a.hasHandles()&&(!a.hasLength(r)||n&&a.isCollinear(a.getNext()))&&a.remove()}return this},reverse:function(){this._segments.reverse();for(var e=0,t=this._segments.length;e<t;e++){var n=this._segments[e],r=n._handleIn;n._handleIn=n._handleOut,n._handleOut=r,n._index=e}this._curves=null,this._changed(9)},flatten:function(e){for(var t=new B(this,e||.25,256,!0).parts,n=t.length,r=[],i=0;i<n;i++)r.push(new A(t[i].curve.slice(0,2)));!this._closed&&n>0&&r.push(new A(t[n-1].curve.slice(6))),this.setSegments(r)},simplify:function(e){var t=new R(this).fit(e||2.5);return t&&this.setSegments(t),!!t},smooth:function(e){var n=this,r=e||{},i=r.type||"asymmetric",a=this._segments,s=a.length,o=this._closed;function c(e,t){var r=e&&e.index;if(null!=r){var i=e.path;if(i&&i!==n)throw new Error(e._class+" "+r+" of "+i+" is not part of "+n);t&&e instanceof I&&r++}else r="number"==typeof e?e:t;return Math.min(r<0&&o?r%s:r<0?r+s:r,s-1)}var l=o&&r.from===t&&r.to===t,u=c(r.from,0),h=c(r.to,s-1);if(u>h)if(o)u-=s;else{var d=u;u=h,h=d}if(/^(?:asymmetric|continuous)$/.test(i)){var f="asymmetric"===i,p=Math.min,m=h-u+1,g=m-1,v=l?p(m,4):1,y=v,b=v,_=[];if(o||(y=p(1,u),b=p(1,s-h-1)),(g+=y+b)<=1)return;for(var w=0,x=u-y;w<=g;w++,x++)_[w]=a[(x<0?x+s:x)%s]._point;var k=_[0]._x+2*_[1]._x,S=_[0]._y+2*_[1]._y,C=2,M=g-1,E=[k],T=[S],A=[C],P=[],N=[];for(w=1;w<g;w++){var D=w<M,O=D?4:f?2:7,L=D?4:f?3:8,B=D?2:f?0:1,R=(D||f?1:2)/C;C=A[w]=O-R,k=E[w]=L*_[w]._x+B*_[w+1]._x-R*k,S=T[w]=L*_[w]._y+B*_[w+1]._y-R*S}for(P[M]=E[M]/A[M],N[M]=T[M]/A[M],w=g-2;w>=0;w--)P[w]=(E[w]-P[w+1])/A[w],N[w]=(T[w]-N[w+1])/A[w];P[g]=(3*_[g]._x-P[M])/2,N[g]=(3*_[g]._y-N[M])/2,w=y;var V=g-b;for(x=u;w<=V;w++,x++){var F=a[x<0?x+s:x],z=F._point,j=P[w]-z._x,q=N[w]-z._y;(l||w<V)&&F.setHandleOut(j,q),(l||w>y)&&F.setHandleIn(-j,-q)}}else for(w=u;w<=h;w++)a[w<0?w+s:w].smooth(r,!l&&w===u,!l&&w===h)},toShape:function(e){if(!this._closed)return null;var n,r,i,a,s,o,c,l=this._segments;function h(e,t){var n=l[e],r=n.getNext(),i=l[t],a=i.getNext();return n._handleOut.isZero()&&r._handleIn.isZero()&&i._handleOut.isZero()&&a._handleIn.isZero()&&r._point.subtract(n._point).isCollinear(a._point.subtract(i._point))}function d(e){var t=l[e],n=t.getNext(),r=t._handleOut,i=n._handleIn,a=.5522847498307936;if(r.isOrthogonal(i)){var s=t._point,o=n._point,c=new b(s,r,!0).intersect(new b(o,i,!0),!0);return c&&u.isZero(r.getLength()/c.subtract(s).getLength()-a)&&u.isZero(i.getLength()/c.subtract(o).getLength()-a)}return!1}function f(e,t){return l[e]._point.getDistance(l[t]._point)}if(!this.hasHandles()&&4===l.length&&h(0,2)&&h(1,3)&&(o=(s=l[1]).getPrevious(),c=s.getNext(),o._handleOut.isZero()&&s._handleIn.isZero()&&s._handleOut.isZero()&&c._handleIn.isZero()&&s._point.subtract(o._point).isOrthogonal(c._point.subtract(s._point)))?(n=S.Rectangle,r=new p(f(0,3),f(0,1)),a=l[1]._point.add(l[2]._point).divide(2)):8===l.length&&d(0)&&d(2)&&d(4)&&d(6)&&h(1,5)&&h(3,7)?(n=S.Rectangle,i=(r=new p(f(1,6),f(0,3))).subtract(new p(f(0,7),f(1,2))).divide(2),a=l[3]._point.add(l[4]._point).divide(2)):4===l.length&&d(0)&&d(1)&&d(2)&&d(3)&&(u.isZero(f(0,2)-f(1,3))?(n=S.Circle,i=f(0,2)/2):(n=S.Ellipse,i=new p(f(2,0)/2,f(3,1)/2)),a=l[1]._point),n){var m=this.getPosition(!0),g=new n({center:m,size:r,radius:i,insert:!1});return g.copyAttributes(this,!0),g._matrix.prepend(this._matrix),g.rotate(a.subtract(m).getAngle()+90),(e===t||e)&&g.insertAbove(this),g}return null},toPath:"#clone",compare:function e(t){if(!t||t instanceof L)return e.base.call(this,t);var n=this.getCurves(),r=t.getCurves(),i=n.length,a=r.length;if(!i||!a)return i==a;for(var s,o,c=n[0].getValues(),l=[],u=0,h=0,d=0;d<a;d++){var f=r[d].getValues();if(l.push(f),g=I.getOverlaps(c,f)){s=!d&&g[0][0]>0?a-1:d,o=g[0][1];break}}var p,m=Math.abs;for(f=l[s];c&&f;){var g;if((g=I.getOverlaps(c,f))&&m(g[0][0]-h)<1e-8){1===(h=g[1][0])&&(c=++u<i?n[u].getValues():null,h=0);var v=g[0][1];if(m(v-o)<1e-8){if(p||(p=[s,v]),1===(o=g[1][1])&&(++s>=a&&(s=0),f=l[s]||r[s].getValues(),o=0),!c)return p[0]===s&&p[1]===o;continue}}break}return!1},_hitTestSelf:function(e,t,n,r){var i,a,s,o,c,l,u=this,h=this.getStyle(),d=this._segments,f=d.length,p=this._closed,m=t._tolerancePadding,g=m,v=t.stroke&&h.hasStroke(),y=t.fill&&h.hasFill(),b=t.curves,_=v?h.getStrokeWidth()/2:y&&t.tolerance>0||b?0:null;function w(t,n){return e.subtract(t).divide(n).length<=1}function x(e,n,r){if(!t.selected||n.isSelected()){var i=e._point;if(n!==i&&(n=n.add(i)),w(n,g))return new T(r,u,{segment:e,point:n})}}function k(e,n){return(n||t.segments)&&x(e,e._point,"segment")||!n&&t.handles&&(x(e,e._handleIn,"handle-in")||x(e,e._handleOut,"handle-out"))}function S(e){o.add(e)}function C(t){var n,c=p||t._index>0&&t._index<f-1;return"round"===(c?i:a)?w(t._point,g):(o=new O({internal:!0,closed:!0}),c?t.isSmooth()||O._addBevelJoin(t,i,_,s,null,r,S,!0):"square"===a&&O._addSquareCap(t,a,_,null,r,S,!0),o.isEmpty()?void 0:o.contains(e)||(n=o.getNearestLocation(e))&&w(n.getPoint(),m))}if(null!==_&&(_>0?(i=h.getStrokeJoin(),a=h.getStrokeCap(),s=h.getMiterLimit(),g=g.add(O._getStrokePadding(_,r))):i=a="round"),!t.ends||t.segments||p){if(t.segments||t.handles)for(var M=0;M<f;M++)if(l=k(d[M]))return l}else if(l=k(d[0],!0)||k(d[f-1],!0))return l;if(null!==_){if(c=this.getNearestLocation(e)){var E=c.getTime();0===E||1===E&&f>1?C(c.getSegment())||(c=null):w(c.getPoint(),g)||(c=null)}if(!c&&"miter"===i&&f>1)for(M=0;M<f;M++){var A=d[M];if(e.getDistance(A._point)<=s*_&&C(A)){c=A.getLocation();break}}}return!c&&y&&this._contains(e)||c&&!v&&!b?new T("fill",this):c?new T(v?"stroke":"curve",this,{location:c,point:c.getPoint()}):null}},i.each(I._evaluateMethods,(function(e){this[e+"At"]=function(t){var n=this.getLocationAt(t);return n&&n[e]()}}),{beans:!1,getLocationOf:function(){for(var e=d.read(arguments),t=this.getCurves(),n=0,r=t.length;n<r;n++){var i=t[n].getLocationOf(e);if(i)return i}return null},getOffsetOf:function(){var e=this.getLocationOf.apply(this,arguments);return e?e.getOffset():null},getLocationAt:function(e){if("number"==typeof e){for(var t=this.getCurves(),n=0,r=0,i=t.length;r<i;r++){var a=n,s=t[r];if((n+=s.getLength())>e)return s.getLocationAt(e-a)}if(t.length>0&&e<=this.getLength())return new N(t[t.length-1],1)}else if(e&&e.getPath&&e.getPath()===this)return e;return null},getOffsetsWithTangent:function(){var e=d.read(arguments);if(e.isZero())return[];for(var t=[],n=0,r=this.getCurves(),i=0,a=r.length;i<a;i++){for(var s=r[i],o=s.getTimesWithTangent(e),c=0,l=o.length;c<l;c++){var u=n+s.getOffsetAtTime(o[c]);t.indexOf(u)<0&&t.push(u)}n+=s.length}return t}}),new function(){function e(e,t,n){var r,i,a,s,o,c,l,u,h=t._segments,d=h.length,f=new Array(6),p=!0;function m(t){if(n)t._transformCoordinates(n,f),r=f[0],i=f[1];else{var h=t._point;r=h._x,i=h._y}if(p)e.moveTo(r,i),p=!1;else{if(n)o=f[2],c=f[3];else{var d=t._handleIn;o=r+d._x,c=i+d._y}o===r&&c===i&&l===a&&u===s?e.lineTo(r,i):e.bezierCurveTo(l,u,o,c,r,i)}a=r,s=i,n?(l=f[4],u=f[5]):(d=t._handleOut,l=a+d._x,u=s+d._y)}for(var g=0;g<d;g++)m(h[g]);t._closed&&d>0&&m(h[0])}return{_draw:function(t,n,r,i){var a=n.dontStart,s=n.dontFinish||n.clip,o=this.getStyle(),c=o.hasFill(),l=o.hasStroke(),u=o.getDashArray(),h=!se.support.nativeDash&&l&&u&&u.length;function d(e){return u[(e%h+h)%h]}if(a||t.beginPath(),(c||l&&!h||s)&&(e(t,this,i),this._closed&&t.closePath()),!s&&(c||l)&&(this._setStyles(t,n,r),c&&(t.fill(o.getFillRule()),t.shadowColor="rgba(0,0,0,0)"),l)){if(h){a||t.beginPath();for(var f,p=new B(this,.25,32,!1,i),m=p.length,g=-o.getDashOffset(),v=0;g>0;)g-=d(v--)+d(v--);for(;g<m;)f=g+d(v++),(g>0||f>0)&&p.drawPart(t,Math.max(g,0),Math.max(f,0)),g=f+d(v++)}t.stroke()}},_drawSelected:function(t,n){t.beginPath(),e(t,this,n),t.stroke(),function(e,t,n,r){if(!(r<=0))for(var i,a,s=r/2,o=r-2,c=s-1,l=new Array(6),u=0,h=t.length;u<h;u++){var d=t[u],f=d._selection;if(d._transformCoordinates(n,l),i=l[0],a=l[1],2&f&&m(2),4&f&&m(4),e.fillRect(i-s,a-s,r,r),o>0&&!(1&f)){var p=e.fillStyle;e.fillStyle="#ffffff",e.fillRect(i-c,a-c,o,o),e.fillStyle=p}}function m(t){var n=l[t],r=l[t+1];i==n&&a==r||(e.beginPath(),e.moveTo(i,a),e.lineTo(n,r),e.stroke(),e.beginPath(),e.arc(n,r,s,0,2*Math.PI,!0),e.fill())}}(t,this._segments,n,se.settings.handleSize)}}},new function(){function e(e){var t=e._segments;if(!t.length)throw new Error("Use a moveTo() command first");return t[t.length-1]}return{moveTo:function(){var e=this._segments;1===e.length&&this.removeSegment(0),e.length||this._add([new A(d.read(arguments))])},moveBy:function(){throw new Error("moveBy() is unsupported on Path items.")},lineTo:function(){this._add([new A(d.read(arguments))])},cubicCurveTo:function(){var t=arguments,n=d.read(t),r=d.read(t),i=d.read(t),a=e(this);a.setHandleOut(n.subtract(a._point)),this._add([new A(i,r.subtract(i))])},quadraticCurveTo:function(){var t=arguments,n=d.read(t),r=d.read(t),i=e(this)._point;this.cubicCurveTo(n.add(i.subtract(n).multiply(1/3)),n.add(r.subtract(n).multiply(1/3)),r)},curveTo:function(){var t=arguments,n=d.read(t),r=d.read(t),a=i.pick(i.read(t),.5),s=1-a,o=e(this)._point,c=n.subtract(o.multiply(s*s)).subtract(r.multiply(a*a)).divide(2*a*s);if(c.isNaN())throw new Error("Cannot put a curve through points with parameter = "+a);this.quadraticCurveTo(c,r)},arcTo:function(){var t,n,r,a,s=arguments,o=Math.abs,c=Math.sqrt,l=e(this),h=l._point,f=d.read(s),m=i.peek(s);if("boolean"==typeof(x=i.pick(m,!0)))var g=(S=h.add(f).divide(2)).add(S.subtract(h).rotate(x?-90:90));else if(i.remain(s)<=2)g=f,f=d.read(s);else if(!h.equals(f)){var v=p.read(s),_=u.isZero;if(_(v.width)||_(v.height))return this.lineTo(f);var w=i.read(s),x=!!i.read(s),k=!!i.read(s),S=h.add(f).divide(2),C=(Y=h.subtract(S).rotate(-w)).x,M=Y.y,E=o(v.width),T=o(v.height),P=E*E,I=T*T,N=C*C,D=M*M,O=c(N/P+D/I);if(O>1&&(P=(E*=O)*E,I=(T*=O)*T),o(O=(P*I-P*D-I*N)/(P*D+I*N))<1e-12&&(O=0),O<0)throw new Error("Cannot create an arc with the given arguments");t=new d(E*M/T,-T*C/E).multiply((k===x?-1:1)*c(O)).rotate(w).add(S),n=(r=(a=(new y).translate(t).rotate(w).scale(E,T))._inverseTransform(h)).getDirectedAngle(a._inverseTransform(f)),!x&&n>0?n-=360:x&&n<0&&(n+=360)}if(g){var L=new b(h.add(g).divide(2),g.subtract(h).rotate(90),!0),B=new b(g.add(f).divide(2),f.subtract(g).rotate(90),!0),R=new b(h,f),V=R.getSide(g);if(!(t=L.intersect(B,!0))){if(!V)return this.lineTo(f);throw new Error("Cannot create an arc with the given arguments")}n=(r=h.subtract(t)).getDirectedAngle(f.subtract(t));var F=R.getSide(t,!0);0===F?n=V*o(n):V===F&&(n+=n<0?360:-360)}if(n){for(var z=o(n),j=z>=360?4:Math.ceil((z-1e-5)/90),q=n/j,H=q*Math.PI/360,U=4/3*Math.sin(H)/(1+Math.cos(H)),G=[],W=0;W<=j;W++){var Y=f,$=null;if(W<j&&($=r.rotate(90).multiply(U),a?(Y=a._transformPoint(r),$=a._transformPoint(r.add($)).subtract(Y)):Y=t.add(r)),W){var K=r.rotate(-90).multiply(U);a&&(K=a._transformPoint(r.add(K)).subtract(Y)),G.push(new A(Y,K,$))}else l.setHandleOut($);r=r.rotate(q)}this._add(G)}},lineBy:function(){var t=d.read(arguments),n=e(this)._point;this.lineTo(n.add(t))},curveBy:function(){var t=arguments,n=d.read(t),r=d.read(t),a=i.read(t),s=e(this)._point;this.curveTo(s.add(n),s.add(r),a)},cubicCurveBy:function(){var t=arguments,n=d.read(t),r=d.read(t),i=d.read(t),a=e(this)._point;this.cubicCurveTo(a.add(n),a.add(r),a.add(i))},quadraticCurveBy:function(){var t=arguments,n=d.read(t),r=d.read(t),i=e(this)._point;this.quadraticCurveTo(i.add(n),i.add(r))},arcBy:function(){var t=arguments,n=e(this)._point,r=n.add(d.read(t)),a=i.pick(i.peek(t),!0);"boolean"==typeof a?this.arcTo(r,a):this.arcTo(r,n.add(d.read(t)))},closePath:function(e){this.setClosed(!0),this.join(this,e)}}},{_getBounds:function(e,t){var n=t.handle?"getHandleBounds":t.stroke?"getStrokeBounds":"getBounds";return O[n](this._segments,this._closed,this,e,t)},statics:{getBounds:function(e,t,n,r,i,a){var s=e[0];if(!s)return new g;var o=new Array(6),c=s._transformCoordinates(r,new Array(6)),l=c.slice(0,2),u=l.slice(),h=new Array(2);function d(e){e._transformCoordinates(r,o);for(var t=0;t<2;t++)I._addBounds(c[t],c[t+4],o[t+2],o[t],t,a?a[t]:0,l,u,h);var n=c;c=o,o=n}for(var f=1,p=e.length;f<p;f++)d(e[f]);return t&&d(s),new g(l[0],l[1],u[0]-l[0],u[1]-l[1])},getStrokeBounds:function(e,t,n,r,i){var a=n.getStyle(),s=a.hasStroke(),o=a.getStrokeWidth(),c=s&&n._getStrokeMatrix(r,i),l=s&&O._getStrokePadding(o,c),u=O.getBounds(e,t,n,r,i,l);if(!s)return u;var h=o/2,d=a.getStrokeJoin(),f=a.getStrokeCap(),m=a.getMiterLimit(),v=new g(new p(l));function y(e){u=u.include(e)}function b(e){u=u.unite(v.setCenter(e._point.transform(r)))}function _(e,t){"round"===t||e.isSmooth()?b(e):O._addBevelJoin(e,t,h,m,r,c,y)}function w(e,t){"round"===t?b(e):O._addSquareCap(e,t,h,r,c,y)}var x=e.length-(t?0:1);if(x>0){for(var k=1;k<x;k++)_(e[k],d);t?_(e[0],d):(w(e[0],f),w(e[e.length-1],f))}return u},_getStrokePadding:function(e,t){if(!t)return[e,e];var n=new d(e,0).transform(t),r=new d(0,e).transform(t),i=n.getAngleInRadians(),a=n.getLength(),s=r.getLength(),o=Math.sin(i),c=Math.cos(i),l=Math.tan(i),u=Math.atan2(s*l,a),h=Math.atan2(s,l*a);return[Math.abs(a*Math.cos(u)*c+s*Math.sin(u)*o),Math.abs(s*Math.sin(h)*c+a*Math.cos(h)*o)]},_addBevelJoin:function(e,t,n,r,i,a,s,o){var c=e.getCurve(),l=c.getPrevious(),u=c.getPoint1().transform(i),h=l.getNormalAtTime(1).multiply(n).transform(a),f=c.getNormalAtTime(0).multiply(n).transform(a),p=h.getDirectedAngle(f);if((p<0||p>=180)&&(h=h.negate(),f=f.negate()),o&&s(u),s(u.add(h)),"miter"===t){var m=new b(u.add(h),new d(-h.y,h.x),!0).intersect(new b(u.add(f),new d(-f.y,f.x),!0),!0);m&&u.getDistance(m)<=r*n&&s(m)}s(u.add(f))},_addSquareCap:function(e,t,n,r,i,a,s){var o=e._point.transform(r),c=e.getLocation(),l=c.getNormal().multiply(0===c.getTime()?n:-n).transform(i);"square"===t&&(s&&(a(o.subtract(l)),a(o.add(l))),o=o.add(l.rotate(-90))),a(o.add(l)),a(o.subtract(l))},getHandleBounds:function(e,t,n,r,i){var a,s,o=n.getStyle();if(i.stroke&&o.hasStroke()){var c=n._getStrokeMatrix(r,i),l=o.getStrokeWidth()/2,u=l;"miter"===o.getStrokeJoin()&&(u=l*o.getMiterLimit()),"square"===o.getStrokeCap()&&(u=Math.max(u,l*Math.SQRT2)),a=O._getStrokePadding(l,c),s=O._getStrokePadding(u,c)}for(var h=new Array(6),d=1/0,f=-d,p=d,m=f,v=0,y=e.length;v<y;v++){e[v]._transformCoordinates(r,h);for(var b=0;b<6;b+=2){var _=b?a:s,w=_?_[0]:0,x=_?_[1]:0,k=h[b],S=h[b+1],C=k-w,M=k+w,E=S-x,T=S+x;C<d&&(d=C),M>f&&(f=M),E<p&&(p=E),T>m&&(m=T)}}return new g(d,p,f-d,m-p)}}});O.inject({statics:new function(){var e=.5522847498307936,t=[new A([-1,0],[0,e],[0,-e]),new A([0,-1],[-e,0],[e,0]),new A([1,0],[0,-e],[0,e]),new A([0,1],[e,0],[-e,0])];function n(e,t,n){var r=i.getNamed(n),a=new O(r&&(1==r.insert?w.INSERT:0==r.insert?w.NO_INSERT:null));return a._add(e),a._closed=t,a.set(r,w.INSERT)}function r(e,r,i){for(var a=new Array(4),s=0;s<4;s++){var o=t[s];a[s]=new A(o._point.multiply(r).add(e),o._handleIn.multiply(r),o._handleOut.multiply(r))}return n(a,!0,i)}return{Line:function(){var e=arguments;return n([new A(d.readNamed(e,"from")),new A(d.readNamed(e,"to"))],!1,e)},Circle:function(){var e=arguments,t=d.readNamed(e,"center"),n=i.readNamed(e,"radius");return r(t,new p(n),e)},Rectangle:function(){var t,r=arguments,i=g.readNamed(r,"rectangle"),a=p.readNamed(r,"radius",0,{readNull:!0}),s=i.getBottomLeft(!0),o=i.getTopLeft(!0),c=i.getTopRight(!0),l=i.getBottomRight(!0);if(!a||a.isZero())t=[new A(s),new A(o),new A(c),new A(l)];else{var u=(a=p.min(a,i.getSize(!0).divide(2))).width,h=a.height,d=u*e,f=h*e;t=[new A(s.add(u,0),null,[-d,0]),new A(s.subtract(0,h),[0,f]),new A(o.add(0,h),null,[0,-f]),new A(o.add(u,0),[-d,0],null),new A(c.subtract(u,0),null,[d,0]),new A(c.add(0,h),[0,-f],null),new A(l.subtract(0,h),null,[0,f]),new A(l.subtract(u,0),[d,0])]}return n(t,!0,r)},RoundRectangle:"#Rectangle",Ellipse:function(){var e=arguments,t=S._readEllipse(e);return r(t.center,t.radius,e)},Oval:"#Ellipse",Arc:function(){var e=arguments,t=d.readNamed(e,"from"),n=d.readNamed(e,"through"),r=d.readNamed(e,"to"),a=i.getNamed(e),s=new O(a&&0==a.insert&&w.NO_INSERT);return s.moveTo(t),s.arcTo(n,r),s.set(a)},RegularPolygon:function(){for(var e=arguments,t=d.readNamed(e,"center"),r=i.readNamed(e,"sides"),a=i.readNamed(e,"radius"),s=360/r,o=r%3==0,c=new d(0,o?-a:a),l=o?-1:.5,u=new Array(r),h=0;h<r;h++)u[h]=new A(t.add(c.rotate((h+l)*s)));return n(u,!0,e)},Star:function(){for(var e=arguments,t=d.readNamed(e,"center"),r=2*i.readNamed(e,"points"),a=i.readNamed(e,"radius1"),s=i.readNamed(e,"radius2"),o=360/r,c=new d(0,-1),l=new Array(r),u=0;u<r;u++)l[u]=new A(t.add(c.rotate(o*u).multiply(u%2?s:a)));return n(l,!0,e)}}}});var L=D.extend({_class:"CompoundPath",_serializeFields:{children:[]},beans:!0,initialize:function(e){this._children=[],this._namedChildren={},this._initialize(e)||("string"==typeof e?this.setPathData(e):this.addChildren(Array.isArray(e)?e:arguments))},insertChildren:function e(t,n){var r=n,a=r[0];a&&"number"==typeof a[0]&&(r=[r]);for(var s=n.length-1;s>=0;s--){var o=r[s];r!==n||o instanceof O||(r=i.slice(r)),Array.isArray(o)?r[s]=new O({segments:o,insert:!1}):o instanceof L&&(r.splice.apply(r,[s,1].concat(o.removeChildren())),o.remove())}return e.base.call(this,t,r)},reduce:function e(t){for(var n=this._children,r=n.length-1;r>=0;r--){var i;(i=n[r].reduce(t)).isEmpty()&&i.remove()}return n.length?e.base.call(this):((i=new O(w.NO_INSERT)).copyAttributes(this),i.insertAbove(this),this.remove(),i)},isClosed:function(){for(var e=this._children,t=0,n=e.length;t<n;t++)if(!e[t]._closed)return!1;return!0},setClosed:function(e){for(var t=this._children,n=0,r=t.length;n<r;n++)t[n].setClosed(e)},getFirstSegment:function(){var e=this.getFirstChild();return e&&e.getFirstSegment()},getLastSegment:function(){var e=this.getLastChild();return e&&e.getLastSegment()},getCurves:function(){for(var e=this._children,t=[],n=0,r=e.length;n<r;n++)i.push(t,e[n].getCurves());return t},getFirstCurve:function(){var e=this.getFirstChild();return e&&e.getFirstCurve()},getLastCurve:function(){var e=this.getLastChild();return e&&e.getLastCurve()},getArea:function(){for(var e=this._children,t=0,n=0,r=e.length;n<r;n++)t+=e[n].getArea();return t},getLength:function(){for(var e=this._children,t=0,n=0,r=e.length;n<r;n++)t+=e[n].getLength();return t},getPathData:function(e,t){for(var n=this._children,r=[],i=0,a=n.length;i<a;i++){var s=n[i],o=s._matrix;r.push(s.getPathData(e&&!o.isIdentity()?e.appended(o):e,t))}return r.join("")},_hitTestChildren:function e(t,n,r){return e.base.call(this,t,n.class===O||"path"===n.type?n:i.set({},n,{fill:!1}),r)},_draw:function(e,t,n,r){var i=this._children;if(i.length){t=t.extend({dontStart:!0,dontFinish:!0}),e.beginPath();for(var a=0,s=i.length;a<s;a++)i[a].draw(e,t,r);if(!t.clip){this._setStyles(e,t,n);var o=this._style;o.hasFill()&&(e.fill(o.getFillRule()),e.shadowColor="rgba(0,0,0,0)"),o.hasStroke()&&e.stroke()}}},_drawSelected:function(e,t,n){for(var r=this._children,i=0,a=r.length;i<a;i++){var s=r[i],o=s._matrix;n[s._id]||s._drawSelected(e,o.isIdentity()?t:t.appended(o))}}},new function(){function e(e,t){var n=e._children;if(t&&!n.length)throw new Error("Use a moveTo() command first");return n[n.length-1]}return i.each(["lineTo","cubicCurveTo","quadraticCurveTo","curveTo","arcTo","lineBy","cubicCurveBy","quadraticCurveBy","curveBy","arcBy"],(function(t){this[t]=function(){var n=e(this,!0);n[t].apply(n,arguments)}}),{moveTo:function(){var t=e(this),n=t&&t.isEmpty()?t:new O(w.NO_INSERT);n!==t&&this.addChild(n),n.moveTo.apply(n,arguments)},moveBy:function(){var t=e(this,!0),n=t&&t.getLastSegment(),r=d.read(arguments);this.moveTo(n?r.add(n._point):r)},closePath:function(t){e(this,!0).closePath(t)}})},i.each(["reverse","flatten","simplify","smooth"],(function(e){this[e]=function(t){for(var n,r=this._children,i=0,a=r.length;i<a;i++)n=r[i][e](t)||n;return n}}),{}));D.inject(new function(){var e=Math.min,n=Math.max,r=Math.abs,a={unite:{1:!0,2:!0},intersect:{2:!0},subtract:{1:!0},exclude:{1:!0,"-1":!0}};function s(e){return e._children||[e]}function o(e,t){var n=e.clone(!1).reduce({simplify:!0}).transform(null,!0,!0);if(t){for(var r=s(n),i=0,a=r.length;i<a;i++)(e=r[i])._closed||e.isEmpty()||(e.closePath(1e-12),e.getFirstSegment().setHandleIn(0,0),e.getLastSegment().setHandleOut(0,0));n=n.resolveCrossings().reorient("nonzero"===n.getFillRule(),!0)}return n}function l(e,t,n,r,i){var a=new L(w.NO_INSERT);return a.addChildren(e,!0),a=a.reduce({simplify:t}),i&&0==i.insert||a.insertAbove(r&&n.isSibling(r)&&n.getIndex()<r.getIndex()?r:n),a.copyAttributes(n,!0),a}function h(e){return e.hasOverlap()||e.isCrossing()}function d(e,t,n,r){if(r&&(0==r.trace||r.stroke)&&/^(subtract|intersect)$/.test(n))return f(e,t,n);var u=o(e,!0),d=t&&e!==t&&o(t,!0),p=a[n];p[n]=!0,d&&(p.subtract||p.exclude)^d.isClockwise()^u.isClockwise()&&d.reverse();var m,y=v(N.expand(u.getIntersections(d,h))),w=s(u),x=d&&s(d),k=[],S=[];function C(e){for(var t=0,n=e.length;t<n;t++){var r=e[t];i.push(k,r._segments),i.push(S,r.getCurves()),r._overlapsOnly=!0}}function M(e){for(var t=[],n=0,r=e&&e.length;n<r;n++)t.push(S[e[n]]);return t}if(y.length){C(w),x&&C(x);for(var E=new Array(S.length),T=0,A=S.length;T<A;T++)E[T]=S[T].getValues();var P=c.findCurveBoundsCollisions(E,E,0,!0),I={};for(T=0;T<S.length;T++){var D=S[T],O=D._path._id;(I[O]=I[O]||{})[D.getIndex()]={hor:M(P[T].hor),ver:M(P[T].ver)}}for(T=0,A=y.length;T<A;T++)b(y[T]._segment,u,d,I,p);for(T=0,A=k.length;T<A;T++){var L=k[T],B=L._intersection;L._winding||b(L,u,d,I,p),B&&B._overlap||(L._path._overlapsOnly=!1)}m=_(k,p)}else m=g(x?w.concat(x):w.slice(),(function(e){return!!p[e]}));return l(m,!0,e,t,r)}function f(e,t,n){var r=o(e),i=o(t),a=r.getIntersections(i,h),s="subtract"===n,c="divide"===n,u={},d=[];function f(e){if(!u[e._id]&&(c||i.contains(e.getPointAt(e.getLength()/2))^s))return d.unshift(e),u[e._id]=!0}for(var p=a.length-1;p>=0;p--){var m=a[p].split();m&&(f(m)&&m.getFirstSegment().setHandleIn(0,0),r.getLastSegment().setHandleOut(0,0))}return f(r),l(d,!1,e,t)}function p(e,t){for(var n=e;n;){if(n===t)return;n=n._previous}for(;e._next&&e._next!==t;)e=e._next;if(!e._next){for(;t._previous;)t=t._previous;e._next=t,t._previous=e}}function m(e){for(var t=e.length-1;t>=0;t--)e[t].clearHandles()}function g(e,t,n){var a=e&&e.length;if(a){var s=i.each(e,(function(e,t){this[e._id]={container:null,winding:e.isClockwise()?1:-1,index:t}}),{}),o=e.slice().sort((function(e,t){return r(t.getArea())-r(e.getArea())})),l=o[0],h=c.findItemBoundsCollisions(o,null,u.GEOMETRIC_EPSILON);null==n&&(n=l.isClockwise());for(var d=0;d<a;d++){var f=o[d],p=s[f._id],m=0,g=h[d];if(g)for(var v=null,y=g.length-1;y>=0;y--)if(g[y]<d){v=v||f.getInteriorPoint();var b=o[g[y]];if(b.contains(v)){var _=s[b._id];m=_.winding,p.winding+=m,p.container=_.exclude?_.container:b;break}}if(t(p.winding)===t(m))p.exclude=!0,e[p.index]=null;else{var w=p.container;f.setClockwise(w?!w.isClockwise():n)}}}return e}function v(e,t,n){var r,i,a,s=t&&[],o=1e-8,c=1-o,l=!1,u=n||[],h=n&&{};function d(e){return e._path._id+"."+e._segment1._index}for(var f=(n&&n.length)-1;f>=0;f--)(g=n[f])._path&&(h[d(g)]=!0);for(f=e.length-1;f>=0;f--){var g,v,y=e[f],b=y._time,_=b,w=t&&!t(y);if((g=y._curve)&&(g!==i?(l=!g.hasHandles()||h&&h[d(g)],r=[],a=null,i=g):a>=o&&(b/=a)),w)r&&r.push(y);else{if(t&&s.unshift(y),a=_,b<o)v=g._segment1;else if(b>c)v=g._segment2;else{var x=g.divideAtTime(b,!0);l&&u.push(g,x),v=x._segment1;for(var k=r.length-1;k>=0;k--){var S=r[k];S._time=(S._time-b)/(1-b)}}y._setSegment(v);var C=v._intersection,M=y._intersection;if(C){p(C,M);for(var E=C;E;)p(E._intersection,C),E=E._next}else v._intersection=M}}return n||m(u),s||e}function y(t,i,a,s,o){var c,l,u=Array.isArray(i)?i:i[a?"hor":"ver"],h=a?1:0,d=1^h,f=[t.x,t.y],p=f[h],m=f[d],g=1e-6,v=p-1e-9,b=p+1e-9,_=0,w=0,x=0,k=0,S=!1,C=!1,M=1,E=[];function T(r){var l=r[d+0],u=r[d+6];if(!(m<e(l,u)||m>n(l,u))){var f=r[h+0],_=r[h+2],w=r[h+4],C=r[h+6];if(l!==u){var T=m===l?0:m===u||v>n(f,_,w,C)||b<e(f,_,w,C)?1:I.solveCubic(r,d,m,E,0,1)>0?E[0]:1,A=0===T?f:1===T?C:I.getPoint(r,T)[a?"y":"x"],P=l>u?1:-1,N=c[d]>c[d+6]?1:-1,D=c[h+6];return m!==l?(A<v?x+=P:A>b?k+=P:S=!0,A>p-g&&A<p+g&&(M/=2)):(P!==N?f<v?x+=P:f>b&&(k+=P):f!=D&&(D<b&&A>b?(k+=P,S=!0):D>v&&A<v&&(x+=P,S=!0)),M/=4),c=r,!o&&A>v&&A<b&&0===I.getTangent(r,T)[a?"x":"y"]&&y(t,i,!a,s,!0)}(f<b&&C>v||C<b&&f>v)&&(S=!0)}}function A(t){var r=t[d+0],i=t[d+2],s=t[d+4],o=t[d+6];if(m<=n(r,i,s,o)&&m>=e(r,i,s,o))for(var c,l=t[h+0],u=t[h+2],f=t[h+4],p=t[h+6],g=v>n(l,u,f,p)||b<e(l,u,f,p)?[t]:I.getMonoCurves(t,a),y=0,_=g.length;y<_;y++)if(c=T(g[y]))return c}for(var P=0,N=u.length;P<N;P++){var D,O=u[P],L=O._path,B=O.getValues();if(!(P&&u[P-1]._path===L||(c=null,L._closed||(l=I.getValues(L.getLastCurve().getSegment2(),O.getSegment1(),null,!s))[d]!==l[d+6]&&(c=l),c))){c=B;for(var R=L.getLastCurve();R&&R!==O;){var V=R.getValues();if(V[d]!==V[d+6]){c=V;break}R=R.getPrevious()}}if(D=A(B))return D;if(P+1===N||u[P+1]._path!==L){if(l&&(D=A(l)))return D;!S||x||k||(x=k=L.isClockwise(s)^a?1:-1),_+=x,w+=k,x=k=0,S&&(C=!0,S=!1),l=null}}return _=r(_),w=r(w),{winding:n(_,w),windingL:_,windingR:w,quality:M,onPath:C}}function b(e,t,n,i,a){var s=[],o=e,c=0;do{if(b=e.getCurve()){var l=b.getLength();s.push({segment:e,curve:b,length:l}),c+=l}e=e.getNext()}while(e&&!e._intersection&&e!==o);for(var h=[.5,.25,.75],d={winding:0,quality:-1},f=0;f<h.length&&d.quality<.5;f++){l=c*h[f];for(var p=0,m=s.length;p<m;p++){var g=s[p],v=g.length;if(l<=v){var b,_=(b=g.curve)._path,w=_._parent,x=w instanceof L?w:_,k=u.clamp(b.getTimeAt(l),.001,.999),S=b.getPointAtTime(k),C=r(b.getTangentAtTime(k).y)<Math.SQRT1_2,M=null;if(a.subtract&&n){var E=(x===t?n:t)._getWinding(S,C,!0);if(x===t&&E.winding||x===n&&!E.winding){if(E.quality<1)continue;M={winding:0,quality:1}}}(M=M||y(S,i[_._id][b.getIndex()],C,!0)).quality>d.quality&&(d=M);break}l-=v}}for(p=s.length-1;p>=0;p--)s[p].segment._winding=d}function _(e,t){var n,r=[];function i(e){var n;return!(!e||e._visited||t&&(!t[(n=e._winding||{}).winding]||t.unite&&2===n.winding&&n.windingL&&n.windingR))}function a(e){if(e)for(var t=0,r=n.length;t<r;t++)if(e===n[t])return!0;return!1}function s(e){for(var t=e._segments,n=0,r=t.length;n<r;n++)t[n]._visited=!0}function o(e,t){var r=e._intersection,s=r,o=[];function c(r,s){for(;r&&r!==s;){var c=r._segment,l=c&&c._path;if(l){var u=c.getNext()||l.getFirstSegment(),h=u._intersection;c!==e&&(a(c)||a(u)||u&&i(c)&&(i(u)||h&&i(h._segment)))&&o.push(c),t&&n.push(c)}r=r._next}}if(t&&(n=[e]),r){for(c(r);r&&r._previous;)r=r._previous;c(r,s)}return o}e.sort((function(e,t){var n=e._intersection,r=t._intersection,i=!(!n||!n._overlap),a=!(!r||!r._overlap),s=e._path,o=t._path;return i^a?i?1:-1:!n^!r?n?1:-1:s!==o?s._id-o._id:e._index-t._index}));for(var c=0,l=e.length;c<l;c++){var u,h,d,f=e[c],p=i(f),m=null,g=!1,v=!0,y=[];if(p&&f._path._overlapsOnly){var b=f._path,_=f._intersection._segment._path;b.compare(_)&&(b.getArea()&&r.push(b.clone(!1)),s(b),s(_),p=!1)}for(;p;){var x=!m,k=o(f,x),S=k.shift(),C=!(g=!x&&(a(f)||a(S)))&&S;if(x&&(m=new O(w.NO_INSERT),u=null),g){(f.isFirst()||f.isLast())&&(v=f._path._closed),f._visited=!0;break}if(C&&u&&(y.push(u),u=null),u||(C&&k.push(f),u={start:m._segments.length,crossings:k,visited:h=[],handleIn:d}),C&&(f=S),!i(f)){m.removeSegments(u.start);for(var M=0,E=h.length;M<E;M++)h[M]._visited=!1;h.length=0;do{(f=u&&u.crossings.shift())&&f._path||(f=null,(u=y.pop())&&(h=u.visited,d=u.handleIn))}while(u&&!i(f));if(!f)break}var T=f.getNext();m.add(new A(f._point,d,T&&f._handleOut)),f._visited=!0,h.push(f),f=T||f._path.getFirstSegment(),d=T&&T._handleIn}g&&(v&&(m.getFirstSegment().setHandleIn(d),m.setClosed(v)),0!==m.getArea()&&r.push(m))}return r}return{_getWinding:function(e,t,n){return y(e,this.getCurves(),t,n)},unite:function(e,t){return d(this,e,"unite",t)},intersect:function(e,t){return d(this,e,"intersect",t)},subtract:function(e,t){return d(this,e,"subtract",t)},exclude:function(e,t){return d(this,e,"exclude",t)},divide:function(e,t){return t&&(0==t.trace||t.stroke)?f(this,e,"divide"):l([this.subtract(e,t),this.intersect(e,t)],!0,this,e,t)},resolveCrossings:function(){var e=this._children,t=e||[this];function n(e,t){var n=e&&e._intersection;return n&&n._overlap&&n._path===t}var r=!1,a=!1,s=this.getIntersections(null,(function(e){return e.hasOverlap()&&(r=!0)||e.isCrossing()&&(a=!0)})),o=r&&a&&[];if(s=N.expand(s),r)for(var c=v(s,(function(e){return e.hasOverlap()}),o),l=c.length-1;l>=0;l--){var u=c[l],h=u._path,d=u._segment,f=d.getPrevious(),p=d.getNext();n(f,h)&&n(p,h)&&(d.remove(),f._handleOut._set(0,0),p._handleIn._set(0,0),f===d||f.getCurve().hasLength()||(p._handleIn.set(f._handleIn),f.remove()))}a&&(v(s,r&&function(e){var t=e.getCurve(),n=e.getSegment(),r=e._intersection,i=r._curve,a=r._segment;if(t&&i&&t._path&&i._path)return!0;n&&(n._intersection=null),a&&(a._intersection=null)},o),o&&m(o),t=_(i.each(t,(function(e){i.push(this,e._segments)}),[])));var g,y=t.length;return y>1&&e?(t!==e&&this.setChildren(t),g=this):1!==y||e||(t[0]!==this&&this.setSegments(t[0].removeSegments()),g=this),g||((g=new L(w.NO_INSERT)).addChildren(t),(g=g.reduce()).copyAttributes(this),this.replaceWith(g)),g},reorient:function(e,n){var r=this._children;return r&&r.length?this.setChildren(g(this.removeChildren(),(function(t){return!!(e?t:1&t)}),n)):n!==t&&this.setClockwise(n),this},getInteriorPoint:function(){var t=this.getBounds().getCenter(!0);if(!this.contains(t)){for(var r=this.getCurves(),i=t.y,a=[],s=[],o=0,c=r.length;o<c;o++){var l=r[o].getValues(),u=l[1],h=l[3],d=l[5],f=l[7];if(i>=e(u,h,d,f)&&i<=n(u,h,d,f))for(var p=I.getMonoCurves(l),m=0,g=p.length;m<g;m++){var v=p[m],y=v[1],b=v[7];if(y!==b&&(i>=y&&i<=b||i>=b&&i<=y)){var _=i===y?v[0]:i===b?v[6]:1===I.solveCubic(v,1,i,s,0,1)?I.getPoint(v,s[0]).x:(v[0]+v[6])/2;a.push(_)}}}a.length>1&&(a.sort((function(e,t){return e-t})),t.x=(a[0]+a[1])/2)}return t}}});var B=i.extend({_class:"PathFlattener",initialize:function(e,t,n,r,i){var a,s=[],o=[],c=0,l=1/(n||32),u=e._segments,h=u[0];function d(e,t){var n=I.getValues(e,t,i);s.push(n),f(n,e._index,0,1)}function f(e,n,i,a){if(!(a-i>l)||r&&I.isStraight(e)||I.isFlatEnough(e,t||.25)){var s=e[6]-e[0],u=e[7]-e[1],h=Math.sqrt(s*s+u*u);h>0&&(c+=h,o.push({offset:c,curve:e,index:n,time:a}))}else{var d=I.subdivide(e,.5),p=(i+a)/2;f(d[0],n,i,p),f(d[1],n,p,a)}}for(var p=1,m=u.length;p<m;p++)d(h,a=u[p]),h=a;e._closed&&d(a||h,u[0]),this.curves=s,this.parts=o,this.length=c,this.index=0},_get:function(e){for(var t,n=this.parts,r=n.length,i=this.index;t=i,i&&!(n[--i].offset<e););for(;t<r;t++){var a=n[t];if(a.offset>=e){this.index=t;var s=n[t-1],o=s&&s.index===a.index?s.time:0,c=s?s.offset:0;return{index:a.index,time:o+(a.time-o)*(e-c)/(a.offset-c)}}}return{index:n[r-1].index,time:1}},drawPart:function(e,t,n){for(var r=this._get(t),i=this._get(n),a=r.index,s=i.index;a<=s;a++){var o=I.getPart(this.curves[a],a===r.index?r.time:0,a===i.index?i.time:1);a===r.index&&e.moveTo(o[0],o[1]),e.bezierCurveTo.apply(e,o.slice(2))}}},i.each(I._evaluateMethods,(function(e){this[e+"At"]=function(t){var n=this._get(t);return I[e](this.curves[n.index],n.time)}}),{})),R=i.extend({initialize:function(e){for(var t,n=this.points=[],r=e._segments,i=e._closed,a=0,s=r.length;a<s;a++){var o=r[a].point;t&&t.equals(o)||n.push(t=o.clone())}i&&(n.unshift(n[n.length-1]),n.push(n[1])),this.closed=i},fit:function(e){var t=this.points,n=t.length,r=null;return n>0&&(r=[new A(t[0])],n>1&&(this.fitCubic(r,e,0,n-1,t[1].subtract(t[0]),t[n-2].subtract(t[n-1])),this.closed&&(r.shift(),r.pop()))),r},fitCubic:function(e,t,n,r,i,a){var s=this.points;if(r-n!=1){for(var o,c=this.chordLengthParameterize(n,r),l=Math.max(t,t*t),u=!0,h=0;h<=4;h++){var d=this.generateBezier(n,r,c,i,a),f=this.findMaxError(n,r,d,c);if(f.error<t&&u)return void this.addCurve(e,d);if(o=f.index,f.error>=l)break;u=this.reparameterize(n,r,c,d),l=f.error}var p=s[o-1].subtract(s[o+1]);this.fitCubic(e,t,n,o,i,p),this.fitCubic(e,t,o,r,p.negate(),a)}else{var m=s[n],g=s[r],v=m.getDistance(g)/3;this.addCurve(e,[m,m.add(i.normalize(v)),g.add(a.normalize(v)),g])}},addCurve:function(e,t){e[e.length-1].setHandleOut(t[1].subtract(t[0])),e.push(new A(t[3],t[2].subtract(t[3])))},generateBezier:function(e,t,n,r,i){for(var a=1e-12,s=Math.abs,o=this.points,c=o[e],l=o[t],u=[[0,0],[0,0]],h=[0,0],d=0,f=t-e+1;d<f;d++){var p=n[d],m=1-p,g=3*p*m,v=m*m*m,y=g*m,b=g*p,_=p*p*p,w=r.normalize(y),x=i.normalize(b),k=o[e+d].subtract(c.multiply(v+y)).subtract(l.multiply(b+_));u[0][0]+=w.dot(w),u[0][1]+=w.dot(x),u[1][0]=u[0][1],u[1][1]+=x.dot(x),h[0]+=w.dot(k),h[1]+=x.dot(k)}var S,C,M=u[0][0]*u[1][1]-u[1][0]*u[0][1];if(s(M)>a){var E=u[0][0]*h[1]-u[1][0]*h[0];S=(h[0]*u[1][1]-h[1]*u[0][1])/M,C=E/M}else{var T=u[0][0]+u[0][1],A=u[1][0]+u[1][1];S=C=s(T)>a?h[0]/T:s(A)>a?h[1]/A:0}var P,I,N=l.getDistance(c),D=a*N;if(S<D||C<D)S=C=N/3;else{var O=l.subtract(c);P=r.normalize(S),I=i.normalize(C),P.dot(O)-I.dot(O)>N*N&&(S=C=N/3,P=I=null)}return[c,c.add(P||r.normalize(S)),l.add(I||i.normalize(C)),l]},reparameterize:function(e,t,n,r){for(var i=e;i<=t;i++)n[i-e]=this.findRoot(r,this.points[i],n[i-e]);i=1;for(var a=n.length;i<a;i++)if(n[i]<=n[i-1])return!1;return!0},findRoot:function(e,t,n){for(var r=[],i=[],a=0;a<=2;a++)r[a]=e[a+1].subtract(e[a]).multiply(3);for(a=0;a<=1;a++)i[a]=r[a+1].subtract(r[a]).multiply(2);var s=this.evaluate(3,e,n),o=this.evaluate(2,r,n),c=this.evaluate(1,i,n),l=s.subtract(t),h=o.dot(o)+l.dot(c);return u.isMachineZero(h)?n:n-l.dot(o)/h},evaluate:function(e,t,n){for(var r=t.slice(),i=1;i<=e;i++)for(var a=0;a<=e-i;a++)r[a]=r[a].multiply(1-n).add(r[a+1].multiply(n));return r[0]},chordLengthParameterize:function(e,t){for(var n=[0],r=e+1;r<=t;r++)n[r-e]=n[r-e-1]+this.points[r].getDistance(this.points[r-1]);r=1;for(var i=t-e;r<=i;r++)n[r]/=n[i];return n},findMaxError:function(e,t,n,r){for(var i=Math.floor((t-e+1)/2),a=0,s=e+1;s<t;s++){var o=this.evaluate(3,n,r[s-e]).subtract(this.points[s]),c=o.x*o.x+o.y*o.y;c>=a&&(a=c,i=s)}return{error:a,index:i}}}),V=w.extend({_class:"TextItem",_applyMatrix:!1,_canApplyMatrix:!1,_serializeFields:{content:null},_boundsOptions:{stroke:!1,handle:!1},initialize:function(e){this._content="",this._lines=[];var n=e&&i.isPlainObject(e)&&e.x===t&&e.y===t;this._initialize(n&&e,!n&&d.read(arguments))},_equals:function(e){return this._content===e._content},copyContent:function(e){this.setContent(e._content)},getContent:function(){return this._content},setContent:function(e){this._content=""+e,this._lines=this._content.split(/\r\n|\n|\r/gm),this._changed(521)},isEmpty:function(){return!this._content},getCharacterStyle:"#getStyle",setCharacterStyle:"#setStyle",getParagraphStyle:"#getStyle",setParagraphStyle:"#setStyle"}),F=V.extend({_class:"PointText",initialize:function(){V.apply(this,arguments)},getPoint:function(){var e=this._matrix.getTranslation();return new f(e.x,e.y,this,"setPoint")},setPoint:function(){var e=d.read(arguments);this.translate(e.subtract(this._matrix.getTranslation()))},_draw:function(e,t,n){if(this._content){this._setStyles(e,t,n);var r=this._lines,i=this._style,a=i.hasFill(),s=i.hasStroke(),o=i.getLeading(),c=e.shadowColor;e.font=i.getFontStyle(),e.textAlign=i.getJustification();for(var l=0,u=r.length;l<u;l++){e.shadowColor=c;var h=r[l];a&&(e.fillText(h,0,0),e.shadowColor="rgba(0,0,0,0)"),s&&e.strokeText(h,0,0),e.translate(0,o)}}},_getBounds:function(e,t){var n=this._style,r=this._lines,i=r.length,a=n.getJustification(),s=n.getLeading(),o=this.getView().getTextWidth(n.getFontStyle(),r),c=0;"left"!==a&&(c-=o/("center"===a?2:1));var l=new g(c,i?-.75*s:0,o,i*s);return e?e._transformBounds(l,l):l}}),z=i.extend(new function(){var e,t={gray:["gray"],rgb:["red","green","blue"],hsb:["hue","saturation","brightness"],hsl:["hue","saturation","lightness"],gradient:["gradient","origin","destination","highlight"]},r={},a={transparent:[0,0,0,0]},s=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]],o={"rgb-hsb":function(e,t,n){var r=Math.max(e,t,n),i=r-Math.min(e,t,n);return[0===i?0:60*(r==e?(t-n)/i+(t<n?6:0):r==t?(n-e)/i+2:(e-t)/i+4),0===r?0:i/r,r]},"hsb-rgb":function(e,t,n){var r,i=(e=(e/60%6+6)%6)-(r=Math.floor(e)),a=[n,n*(1-t),n*(1-t*i),n*(1-t*(1-i))];return[a[(r=s[r])[0]],a[r[1]],a[r[2]]]},"rgb-hsl":function(e,t,n){var r=Math.max(e,t,n),i=Math.min(e,t,n),a=r-i,s=0===a,o=(r+i)/2;return[s?0:60*(r==e?(t-n)/a+(t<n?6:0):r==t?(n-e)/a+2:(e-t)/a+4),s?0:o<.5?a/(r+i):a/(2-r-i),o]},"hsl-rgb":function(e,t,n){if(0===t)return[n,n,n];for(var r=[(e=(e/360%1+1)%1)+1/3,e,e-1/3],i=n<.5?n*(1+t):n+t-n*t,a=2*n-i,s=[],o=0;o<3;o++){var c=r[o];c<0&&(c+=1),c>1&&(c-=1),s[o]=6*c<1?a+6*(i-a)*c:2*c<1?i:3*c<2?a+(i-a)*(2/3-c)*6:a}return s},"rgb-gray":function(e,t,n){return[.2989*e+.587*t+.114*n]},"gray-rgb":function(e){return[e,e,e]},"gray-hsb":function(e){return[0,0,e]},"gray-hsl":function(e){return[0,0,e]},"gradient-rgb":function(){return[]},"rgb-gradient":function(){return[]}};return i.each(t,(function(e,n){r[n]=[],i.each(e,(function(e,a){var s=i.capitalize(e),o=/^(hue|saturation)$/.test(e),c=r[n][a]="gradient"===n?"gradient"===e?function(e){var t=this._components[0];return t!==(e=j.read(Array.isArray(e)?e:arguments,0,{readNull:!0}))&&(t&&t._removeOwner(this),e&&e._addOwner(this)),e}:function(){return d.read(arguments,0,{readNull:"highlight"===e,clone:!0})}:function(e){return null==e||isNaN(e)?0:+e};this["get"+s]=function(){return this._type===n||o&&/^hs[bl]$/.test(this._type)?this._components[a]:this._convert(n)[a]},this["set"+s]=function(e){this._type===n||o&&/^hs[bl]$/.test(this._type)||(this._components=this._convert(n),this._properties=t[n],this._type=n),this._components[a]=c.call(this,e),this._changed()}}),this)}),{_class:"Color",_readIndex:!0,initialize:function s(o){var c,l,u,h,d=arguments,f=this.__read,p=0;Array.isArray(o)&&(o=(d=o)[0]);var m=null!=o&&typeof o;if("string"===m&&o in t&&(c=o,o=d[1],Array.isArray(o)?(l=o,u=d[2]):(f&&(p=1),d=i.slice(d,1),m=typeof o)),!l){if(h="number"===m?d:"object"===m&&null!=o.length?o:null){c||(c=h.length>=3?"rgb":"gray");var g=t[c].length;u=h[g],f&&(p+=h===arguments?g+(null!=u?1:0):1),h.length>g&&(h=i.slice(h,0,g))}else if("string"===m){var v=function(t){var r,i=t.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})([\da-f]{2})?$/i)||t.match(/^#([\da-f])([\da-f])([\da-f])([\da-f])?$/i),s="rgb";if(i){var o=i[4]?4:3;r=new Array(o);for(var c=0;c<o;c++){var l=i[c+1];r[c]=parseInt(1==l.length?l+l:l,16)/255}}else if(i=t.match(/^(rgb|hsl)a?\((.*)\)$/)){s=i[1],r=i[2].trim().split(/[,\s]+/g);for(var u="hsl"===s,h=(c=0,Math.min(r.length,4));c<h;c++){var d=r[c];if(l=parseFloat(d),u)if(0===c){var f=d.match(/([a-z]*)$/)[1];l*={turn:360,rad:180/Math.PI,grad:.9}[f]||1}else c<3&&(l/=100);else c<3&&(l/=/%$/.test(d)?100:255);r[c]=l}}else{var p=a[t];if(!p)if(n){e||((e=ne.getContext(1,1,{willReadFrequently:!0})).globalCompositeOperation="copy"),e.fillStyle="rgba(0,0,0,0)",e.fillStyle=t,e.fillRect(0,0,1,1);var m=e.getImageData(0,0,1,1).data;p=a[t]=[m[0]/255,m[1]/255,m[2]/255]}else p=[0,0,0];r=p.slice()}return[s,r]}(o);c=v[0],4===(l=v[1]).length&&(u=l[3],l.length--)}else if("object"===m)if(o.constructor===s){if(c=o._type,l=o._components.slice(),u=o._alpha,"gradient"===c)for(var y=1,b=l.length;y<b;y++){var _=l[y];_&&(l[y]=_.clone())}}else if(o.constructor===j)c="gradient",h=d;else{var w=t[c="hue"in o?"lightness"in o?"hsl":"hsb":"gradient"in o||"stops"in o||"radial"in o?"gradient":"gray"in o?"gray":"rgb"],x=r[c];for(this._components=l=[],y=0,b=w.length;y<b;y++)null==(k=o[w[y]])&&!y&&"gradient"===c&&"stops"in o&&(k={stops:o.stops,radial:o.radial}),null!=(k=x[y].call(this,k))&&(l[y]=k);u=o.alpha}f&&c&&(p=1)}if(this._type=c||"rgb",!l)for(this._components=l=[],y=0,b=(x=r[this._type]).length;y<b;y++){var k;null!=(k=x[y].call(this,h&&h[y]))&&(l[y]=k)}return this._components=l,this._properties=t[this._type],this._alpha=u,f&&(this.__read=p),this},set:"#initialize",_serialize:function(e,t){var n=this.getComponents();return i.serialize(/^(gray|rgb)$/.test(this._type)?n:[this._type].concat(n),e,!0,t)},_changed:function(){this._canvasStyle=null,this._owner&&(this._setter?this._owner[this._setter](this):this._owner._changed(129))},_convert:function(e){var t;return this._type===e?this._components.slice():(t=o[this._type+"-"+e])?t.apply(this,this._components):o["rgb-"+e].apply(this,o[this._type+"-rgb"].apply(this,this._components))},convert:function(e){return new z(e,this._convert(e),this._alpha)},getType:function(){return this._type},setType:function(e){this._components=this._convert(e),this._properties=t[e],this._type=e},getComponents:function(){var e=this._components.slice();return null!=this._alpha&&e.push(this._alpha),e},getAlpha:function(){return null!=this._alpha?this._alpha:1},setAlpha:function(e){this._alpha=null==e?null:Math.min(Math.max(e,0),1),this._changed()},hasAlpha:function(){return null!=this._alpha},equals:function(e){var t=i.isPlainValue(e,!0)?z.read(arguments):e;return t===this||t&&this._class===t._class&&this._type===t._type&&this.getAlpha()===t.getAlpha()&&i.equals(this._components,t._components)||!1},toString:function(){for(var e=this._properties,t=[],n="gradient"===this._type,r=l.instance,i=0,a=e.length;i<a;i++){var s=this._components[i];null!=s&&t.push(e[i]+": "+(n?s:r.number(s)))}return null!=this._alpha&&t.push("alpha: "+r.number(this._alpha)),"{ "+t.join(", ")+" }"},toCSS:function(e){var t=this._convert("rgb"),n=e||null==this._alpha?1:this._alpha;function r(e){return Math.round(255*(e<0?0:e>1?1:e))}return t=[r(t[0]),r(t[1]),r(t[2])],n<1&&t.push(n<0?0:n),e?"#"+((1<<24)+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1):(4==t.length?"rgba(":"rgb(")+t.join(",")+")"},toCanvasStyle:function(e,t){if(this._canvasStyle)return this._canvasStyle;if("gradient"!==this._type)return this._canvasStyle=this.toCSS();var n,r=this._components,i=r[0],a=i._stops,s=r[1],o=r[2],c=r[3],l=t&&t.inverted();if(l&&(s=l._transformPoint(s),o=l._transformPoint(o),c&&(c=l._transformPoint(c))),i._radial){var u=o.getDistance(s);if(c){var h=c.subtract(s);h.getLength()>u&&(c=s.add(h.normalize(u-.1)))}var d=c||s;n=e.createRadialGradient(d.x,d.y,0,s.x,s.y,u)}else n=e.createLinearGradient(s.x,s.y,o.x,o.y);for(var f=0,p=a.length;f<p;f++){var m=a[f],g=m._offset;n.addColorStop(null==g?f/(p-1):g,m._color.toCanvasStyle())}return this._canvasStyle=n},transform:function(e){if("gradient"===this._type){for(var t=this._components,n=1,r=t.length;n<r;n++){var i=t[n];e._transformPoint(i,i,!0)}this._changed()}},statics:{_types:t,random:function(){var e=Math.random;return new z(e(),e(),e())},_setOwner:function(e,t,n){return e&&(e._owner&&t&&e._owner!==t&&(e=e.clone()),!e._owner^!t&&(e._owner=t||null,e._setter=n||null)),e}}})},new function(){return i.each({add:function(e,t){return e+t},subtract:function(e,t){return e-t},multiply:function(e,t){return e*t},divide:function(e,t){return e/t}},(function(e,t){this[t]=function(t){t=z.read(arguments);for(var n=this._type,r=this._components,i=t._convert(n),a=0,s=r.length;a<s;a++)i[a]=e(r[a],i[a]);return new z(n,i,null!=this._alpha?e(this._alpha,t.getAlpha()):null)}}),{})}),j=i.extend({_class:"Gradient",initialize:function(e,t){this._id=h.get(),e&&i.isPlainObject(e)&&(this.set(e),e=t=null),null==this._stops&&this.setStops(e||["white","black"]),null==this._radial&&this.setRadial("string"==typeof t&&"radial"===t||t||!1)},_serialize:function(e,t){return t.add(this,(function(){return i.serialize([this._stops,this._radial],e,!0,t)}))},_changed:function(){for(var e=0,t=this._owners&&this._owners.length;e<t;e++)this._owners[e]._changed()},_addOwner:function(e){this._owners||(this._owners=[]),this._owners.push(e)},_removeOwner:function(e){var n=this._owners?this._owners.indexOf(e):-1;-1!=n&&(this._owners.splice(n,1),this._owners.length||(this._owners=t))},clone:function(){for(var e=[],t=0,n=this._stops.length;t<n;t++)e[t]=this._stops[t].clone();return new j(e,this._radial)},getStops:function(){return this._stops},setStops:function(e){if(e.length<2)throw new Error("Gradient stop list needs to contain at least two stops.");var n=this._stops;if(n)for(var r=0,i=n.length;r<i;r++)n[r]._owner=t;for(r=0,i=(n=this._stops=q.readList(e,0,{clone:!0})).length;r<i;r++)n[r]._owner=this;this._changed()},getRadial:function(){return this._radial},setRadial:function(e){this._radial=e,this._changed()},equals:function(e){if(e===this)return!0;if(e&&this._class===e._class){var t=this._stops,n=e._stops,r=t.length;if(r===n.length){for(var i=0;i<r;i++)if(!t[i].equals(n[i]))return!1;return!0}}return!1}}),q=i.extend({_class:"GradientStop",initialize:function(e,n){var r=e,i=n;"object"==typeof e&&n===t&&(Array.isArray(e)&&"number"!=typeof e[0]?(r=e[0],i=e[1]):("color"in e||"offset"in e||"rampPoint"in e)&&(r=e.color,i=e.offset||e.rampPoint||0)),this.setColor(r),this.setOffset(i)},clone:function(){return new q(this._color.clone(),this._offset)},_serialize:function(e,t){var n=this._color,r=this._offset;return i.serialize(null==r?[n]:[n,r],e,!0,t)},_changed:function(){this._owner&&this._owner._changed(129)},getOffset:function(){return this._offset},setOffset:function(e){this._offset=e,this._changed()},getRampPoint:"#getOffset",setRampPoint:"#setOffset",getColor:function(){return this._color},setColor:function(){z._setOwner(this._color,null),this._color=z._setOwner(z.read(arguments,0),this,"setColor"),this._changed()},equals:function(e){return e===this||e&&this._class===e._class&&this._color.equals(e._color)&&this._offset==e._offset||!1}}),H=i.extend(new function(){var e={fillColor:null,fillRule:"nonzero",strokeColor:null,strokeWidth:1,strokeCap:"butt",strokeJoin:"miter",strokeScaling:!0,miterLimit:10,dashOffset:0,dashArray:[],shadowColor:null,shadowBlur:0,shadowOffset:new d,selectedColor:null},n=i.set({},e,{fontFamily:"sans-serif",fontWeight:"normal",fontSize:12,leading:null,justification:"left"}),r=i.set({},n,{fillColor:new z}),a={strokeWidth:193,strokeCap:193,strokeJoin:193,strokeScaling:201,miterLimit:193,fontFamily:9,fontWeight:9,fontSize:9,font:9,leading:9,justification:9},s={beans:!0},o={_class:"Style",beans:!0,initialize:function(t,i,a){this._values={},this._owner=i,this._project=i&&i._project||a||se.project,this._defaults=!i||i instanceof x?n:i instanceof V?r:e,t&&this.set(t)}};return i.each(n,(function(e,n){var r=/Color$/.test(n),c="shadowOffset"===n,l=i.capitalize(n),u=a[n],h="set"+l,f="get"+l;o[h]=function(e){var t=this._owner,i=t&&t._children,a=i&&i.length>0&&!(t instanceof L);if(a)for(var s=0,o=i.length;s<o;s++)i[s]._style[h](e);if(("selectedColor"===n||!a)&&n in this._defaults){var c=this._values[n];c!==e&&(r&&(c&&(z._setOwner(c,null),c._canvasStyle=null),e&&e.constructor===z&&(e=z._setOwner(e,t,a&&h))),this._values[n]=e,t&&t._changed(u||129))}},o[f]=function(e){var a=this._owner,s=a&&a._children,o=s&&s.length>0&&!(a instanceof L);if(o&&!e)for(var l=0,u=s.length;l<u;l++){var p=s[l]._style[f]();if(l){if(!i.equals(m,p))return t}else m=p}else if(n in this._defaults){var m;if((m=this._values[n])===t)(m=this._defaults[n])&&m.clone&&(m=m.clone());else{var g=r?z:c?d:null;!g||m&&m.constructor===g||(this._values[n]=m=g.read([m],0,{readNull:!0,clone:!0}))}}return m&&r&&(m=z._setOwner(m,a,o&&h)),m},s[f]=function(e){return this._style[f](e)},s[h]=function(e){this._style[h](e)}})),i.each({Font:"FontFamily",WindingRule:"FillRule"},(function(e,t){var n="get"+t,r="set"+t;o[n]=s[n]="#get"+e,o[r]=s[r]="#set"+e})),w.inject(s),o},{set:function(e){var t=e instanceof H,n=t?e._values:e;if(n)for(var r in n)if(r in this._defaults){var i=n[r];this[r]=i&&t&&i.clone?i.clone():i}},equals:function(e){function n(e,n,r){var a=e._values,s=n._values,o=n._defaults;for(var c in a){var l=a[c],u=s[c];if(!(r&&c in s||i.equals(l,u===t?o[c]:u)))return!1}return!0}return e===this||e&&this._class===e._class&&n(this,e)&&n(e,this,!0)||!1},_dispose:function(){var e;(e=this.getFillColor())&&(e._canvasStyle=null),(e=this.getStrokeColor())&&(e._canvasStyle=null),(e=this.getShadowColor())&&(e._canvasStyle=null)},hasFill:function(){var e=this.getFillColor();return!!e&&e.alpha>0},hasStroke:function(){var e=this.getStrokeColor();return!!e&&e.alpha>0&&this.getStrokeWidth()>0},hasShadow:function(){var e=this.getShadowColor();return!!e&&e.alpha>0&&(this.getShadowBlur()>0||!this.getShadowOffset().isZero())},getView:function(){return this._project._view},getFontStyle:function(){var e=this.getFontSize();return this.getFontWeight()+" "+e+(/[a-z]/i.test(e+"")?" ":"px ")+this.getFontFamily()},getFont:"#getFontFamily",setFont:"#setFontFamily",getLeading:function e(){var t=e.base.call(this),n=this.getFontSize();return/pt|em|%|px/.test(n)&&(n=this.getView().getPixelSize(n)),null!=t?t:1.2*n}}),U=new function(){function e(e,t,n,r){for(var i=["","webkit","moz","Moz","ms","o"],a=t[0].toUpperCase()+t.substring(1),s=0;s<6;s++){var o=i[s],c=o?o+a:t;if(c in e){if(!n)return e[c];e[c]=r;break}}}return{getStyles:function(e){var t=e&&9!==e.nodeType?e.ownerDocument:e,n=t&&t.defaultView;return n&&n.getComputedStyle(e,"")},getBounds:function(e,t){var n,r=e.ownerDocument,i=r.body,a=r.documentElement;try{n=e.getBoundingClientRect()}catch(l){n={left:0,top:0,width:0,height:0}}var s=n.left-(a.clientLeft||i.clientLeft||0),o=n.top-(a.clientTop||i.clientTop||0);if(!t){var c=r.defaultView;s+=c.pageXOffset||a.scrollLeft||i.scrollLeft,o+=c.pageYOffset||a.scrollTop||i.scrollTop}return new g(s,o,n.width,n.height)},getViewportBounds:function(e){var t=e.ownerDocument,n=t.defaultView,r=t.documentElement;return new g(0,0,n.innerWidth||r.clientWidth,n.innerHeight||r.clientHeight)},getOffset:function(e,t){return U.getBounds(e,t).getPoint()},getSize:function(e){return U.getBounds(e,!0).getSize()},isInvisible:function(e){return U.getSize(e).equals(new p(0,0))},isInView:function(e){return!U.isInvisible(e)&&U.getViewportBounds(e).intersects(U.getBounds(e,!0))},isInserted:function(e){return r.body.contains(e)},getPrefixed:function(t,n){return t&&e(t,n)},setPrefixed:function(t,n,r){if("object"==typeof n)for(var i in n)e(t,i,!0,n[i]);else e(t,n,!0,r)}}},G={add:function(e,t){if(e)for(var n in t)for(var i=t[n],a=n.split(/[\s,]+/g),s=0,o=a.length;s<o;s++){var c=a[s],l=e===r&&("touchstart"===c||"touchmove"===c)&&{passive:!1};e.addEventListener(c,i,l)}},remove:function(e,t){if(e)for(var n in t)for(var r=t[n],i=n.split(/[\s,]+/g),a=0,s=i.length;a<s;a++)e.removeEventListener(i[a],r,!1)},getPoint:function(e){var t=e.targetTouches?e.targetTouches.length?e.targetTouches[0]:e.changedTouches[0]:e;return new d(t.pageX||t.clientX+r.documentElement.scrollLeft,t.pageY||t.clientY+r.documentElement.scrollTop)},getTarget:function(e){return e.target||e.srcElement},getRelatedTarget:function(e){return e.relatedTarget||e.toElement},getOffset:function(e,t){return G.getPoint(e).subtract(U.getOffset(t||G.getTarget(e)))}};G.requestAnimationFrame=new function(){var e,t=U.getPrefixed(n,"requestAnimationFrame"),r=!1,i=[];function a(){var e=i;i=[];for(var n=0,s=e.length;n<s;n++)e[n]();(r=t&&i.length)&&t(a)}return function(n){i.push(n),t?r||(t(a),r=!0):e||(e=setInterval(a,1e3/60))}};var W=i.extend(a,{_class:"View",initialize:function e(t,i){function a(e){return i[e]||parseInt(i.getAttribute(e),10)}function o(){var e=U.getSize(i);return e.isNaN()||e.isZero()?new p(a("width"),a("height")):e}var c;if(n&&i){this._id=i.getAttribute("id"),null==this._id&&i.setAttribute("id",this._id="paper-view-"+e._id++),G.add(i,this._viewEvents);var l="none";if(U.setPrefixed(i.style,{userDrag:l,userSelect:l,touchCallout:l,contentZooming:l,tapHighlightColor:"rgba(0,0,0,0)"}),s.hasAttribute(i,"resize")){var u=this;G.add(n,this._windowEvents={resize:function(){u.setViewSize(o())}})}if(c=o(),s.hasAttribute(i,"stats")&&"undefined"!=typeof Stats){this._stats=new Stats;var h=this._stats.domElement,d=h.style,f=U.getOffset(i);d.position="absolute",d.left=f.x+"px",d.top=f.y+"px",r.body.appendChild(h)}}else c=new p(i),i=null;this._project=t,this._scope=t._scope,this._element=i,this._pixelRatio||(this._pixelRatio=n&&n.devicePixelRatio||1),this._setElementSize(c.width,c.height),this._viewSize=c,e._views.push(this),e._viewsById[this._id]=this,(this._matrix=new y)._owner=this,e._focused||(e._focused=this),this._frameItems={},this._frameItemCount=0,this._itemEvents={native:{},virtual:{}},this._autoUpdate=!se.agent.node,this._needsUpdate=!1},remove:function(){if(!this._project)return!1;W._focused===this&&(W._focused=null),W._views.splice(W._views.indexOf(this),1),delete W._viewsById[this._id];var e=this._project;return e._view===this&&(e._view=null),G.remove(this._element,this._viewEvents),G.remove(n,this._windowEvents),this._element=this._project=null,this.off("frame"),this._animate=!1,this._frameItems={},!0},_events:i.each(w._itemHandlers.concat(["onResize","onKeyDown","onKeyUp"]),(function(e){this[e]={}}),{onFrame:{install:function(){this.play()},uninstall:function(){this.pause()}}}),_animate:!1,_time:0,_count:0,getAutoUpdate:function(){return this._autoUpdate},setAutoUpdate:function(e){this._autoUpdate=e,e&&this.requestUpdate()},update:function(){},draw:function(){this.update()},requestUpdate:function(){if(!this._requested){var e=this;G.requestAnimationFrame((function(){if(e._requested=!1,e._animate){e.requestUpdate();var t=e._element;U.getPrefixed(r,"hidden")&&"true"!==s.getAttribute(t,"keepalive")||!U.isInView(t)||e._handleFrame()}e._autoUpdate&&e.update()})),this._requested=!0}},play:function(){this._animate=!0,this.requestUpdate()},pause:function(){this._animate=!1},_handleFrame:function(){se=this._scope;var e=Date.now()/1e3,t=this._last?e-this._last:0;this._last=e,this.emit("frame",new i({delta:t,time:this._time+=t,count:this._count++})),this._stats&&this._stats.update()},_animateItem:function(e,t){var n=this._frameItems;t?(n[e._id]={item:e,time:0,count:0},1==++this._frameItemCount&&this.on("frame",this._handleFrameItems)):(delete n[e._id],0==--this._frameItemCount&&this.off("frame",this._handleFrameItems))},_handleFrameItems:function(e){for(var t in this._frameItems){var n=this._frameItems[t];n.item.emit("frame",new i(e,{time:n.time+=e.delta,count:n.count++}))}},_changed:function(){this._project._changed(4097),this._bounds=this._decomposed=t},getElement:function(){return this._element},getPixelRatio:function(){return this._pixelRatio},getResolution:function(){return 72*this._pixelRatio},getViewSize:function(){var e=this._viewSize;return new m(e.width,e.height,this,"setViewSize")},setViewSize:function(){var e=p.read(arguments),t=e.subtract(this._viewSize);t.isZero()||(this._setElementSize(e.width,e.height),this._viewSize.set(e),this._changed(),this.emit("resize",{size:e,delta:t}),this._autoUpdate&&this.update())},_setElementSize:function(e,t){var n=this._element;n&&(n.width!==e&&(n.width=e),n.height!==t&&(n.height=t))},getBounds:function(){return this._bounds||(this._bounds=this._matrix.inverted()._transformBounds(new g(new d,this._viewSize))),this._bounds},getSize:function(){return this.getBounds().getSize()},isVisible:function(){return U.isInView(this._element)},isInserted:function(){return U.isInserted(this._element)},getPixelSize:function(e){var t,n=this._element;if(n){var i=n.parentNode,a=r.createElement("div");a.style.fontSize=e,i.appendChild(a),t=parseFloat(U.getStyles(a).fontSize),i.removeChild(a)}else t=parseFloat(t);return t},getTextWidth:function(e,t){return 0}},i.each(["rotate","scale","shear","skew"],(function(e){var t="rotate"===e;this[e]=function(){var n=arguments,r=(t?i:d).read(n),a=d.read(n,0,{readNull:!0});return this.transform((new y)[e](r,a||this.getCenter(!0)))}}),{_decompose:function(){return this._decomposed||(this._decomposed=this._matrix.decompose())},translate:function(){var e=new y;return this.transform(e.translate.apply(e,arguments))},getCenter:function(){return this.getBounds().getCenter()},setCenter:function(){var e=d.read(arguments);this.translate(this.getCenter().subtract(e))},getZoom:function(){var e=this._decompose().scaling;return(e.x+e.y)/2},setZoom:function(e){this.transform((new y).scale(e/this.getZoom(),this.getCenter()))},getRotation:function(){return this._decompose().rotation},setRotation:function(e){var t=this.getRotation();null!=t&&null!=e&&this.rotate(e-t)},getScaling:function(){var e=this._decompose().scaling;return new f(e.x,e.y,this,"setScaling")},setScaling:function(){var e=this.getScaling(),t=d.read(arguments,0,{clone:!0,readNull:!0});e&&t&&this.scale(t.x/e.x,t.y/e.y)},getMatrix:function(){return this._matrix},setMatrix:function(){var e=this._matrix;e.set.apply(e,arguments)},transform:function(e){this._matrix.append(e)},scrollBy:function(){this.translate(d.read(arguments).negate())}}),{projectToView:function(){return this._matrix._transformPoint(d.read(arguments))},viewToProject:function(){return this._matrix._inverseTransform(d.read(arguments))},getEventPoint:function(e){return this.viewToProject(G.getOffset(e,this._element))}},{statics:{_views:[],_viewsById:{},_id:0,create:function(e,t){return r&&"string"==typeof t&&(t=r.getElementById(t)),new(n?Y:W)(e,t)}}},new function(){if(n){var e,t,i,a,s,o=!1,c=!1,l=n.navigator;l.pointerEnabled||l.msPointerEnabled?(i="pointerdown MSPointerDown",a="pointermove MSPointerMove",s="pointerup pointercancel MSPointerUp MSPointerCancel"):(i="touchstart",a="touchmove",s="touchend touchcancel","ontouchstart"in n&&l.userAgent.match(/mobile|tablet|ip(ad|hone|od)|android|silk/i)||(i+=" mousedown",a+=" mousemove",s+=" mouseup"));var u={},h={mouseout:function(e){var t=W._focused,n=G.getRelatedTarget(e);if(t&&(!n||"HTML"===n.nodeName)){var r=G.getOffset(e,t._element),i=r.x,a=Math.abs,s=a(i),o=s-(1<<25);r.x=a(o)<s?o*(i<0?-1:1):i,E(t,e,t.viewToProject(r))}},scroll:M};u[i]=function(e){var t=W._focused=C(e);o||(o=!0,t._handleMouseEvent("mousedown",e))},h[a]=function(n){var r=W._focused;if(!c){var i=C(n);i?r!==i&&(r&&E(r,n),e||(e=r),r=W._focused=t=i):t&&t===r&&(e&&!e.isInserted()&&(e=null),r=W._focused=e,e=null,M())}r&&E(r,n)},h[i]=function(){c=!0},h[s]=function(e){var t=W._focused;t&&o&&t._handleMouseEvent("mouseup",e),c=o=!1},G.add(r,h),G.add(n,{load:M});var d,f,p,m,g,v,y,b,_=!1,w=!1,x={doubleclick:"click",mousedrag:"mousemove"},k=!1,S={mousedown:{mousedown:1,mousedrag:1,click:1,doubleclick:1},mouseup:{mouseup:1,mousedrag:1,click:1,doubleclick:1},mousemove:{mousedrag:1,mousemove:1,mouseenter:1,mouseleave:1}};return{_viewEvents:u,_handleMouseEvent:function(e,t,n){var r=this._itemEvents,i=r.native[e],a="mousemove"===e,s=this._scope.tool,c=this;function l(e){return r.virtual[e]||c.responds(e)||s&&s.responds(e)}a&&o&&l("mousedrag")&&(e="mousedrag"),n||(n=this.getEventPoint(t));var u=this.getBounds().contains(n),h=i&&u&&c._project.hitTest(n,{tolerance:0,fill:!0,stroke:!0}),x=h&&h.item||null,S=!1,C={};if(C[e.substr(5)]=!0,i&&x!==m&&(m&&T(m,null,"mouseleave",t,n),x&&T(x,null,"mouseenter",t,n),m=x),k^u&&(T(this,null,u?"mouseenter":"mouseleave",t,n),S=!0),!u&&!C.drag||n.equals(f)||(A(this,x,a?e:"mousemove",t,n,f),S=!0),k=u,C.down&&u||C.up&&d){if(A(this,x,e,t,n,d),C.down){if(b=x===v&&Date.now()-y<300,p=v=x,!w&&x){for(var M=x;M&&!M.responds("mousedrag");)M=M._parent;M&&(g=x)}d=n}else C.up&&(w||x!==p||(y=Date.now(),A(this,x,b?"doubleclick":"click",t,n,d),b=!1),p=g=null);k=!1,S=!0}f=n,S&&s&&(_=s._handleMouseEvent(e,t,n,C)||_),!1!==t.cancelable&&(_&&!C.move||C.down&&l("mouseup"))&&t.preventDefault()},_handleKeyEvent:function(e,t,n,r){var i,a=this._scope,s=a.tool;function o(s){s.responds(e)&&(se=a,s.emit(e,i=i||new K(e,t,n,r)))}this.isVisible()&&(o(this),s&&s.responds(e)&&o(s))},_countItemEvent:function(e,t){var n=this._itemEvents,r=n.native,i=n.virtual;for(var a in S)r[a]=(r[a]||0)+(S[a][e]||0)*t;i[e]=(i[e]||0)+t},statics:{updateFocus:M,_resetState:function(){o=c=_=k=!1,e=t=d=f=p=m=g=v=y=b=null}}}}function C(e){var t=G.getTarget(e);return t.getAttribute&&W._viewsById[t.getAttribute("id")]}function M(){var e=W._focused;if(!e||!e.isVisible())for(var n=0,r=W._views.length;n<r;n++)if((e=W._views[n]).isVisible()){W._focused=t=e;break}}function E(e,t,n){e._handleMouseEvent("mousemove",t,n)}function T(e,t,n,r,i,a,s){var o,c=!1;function l(e,n){if(e.responds(n)){if(o||(o=new X(n,r,i,t||e,a?i.subtract(a):null)),e.emit(n,o)&&(_=!0,o.prevented&&(w=!0),o.stopped))return c=!0}else{var s=x[n];if(s)return l(e,s)}}for(;e&&e!==s&&!l(e,n);)e=e._parent;return c}function A(e,t,n,r,i,a){return e._project.removeOn(n),w=_=!1,g&&T(g,null,n,r,i,a)||t&&t!==g&&!t.isDescendant(g)&&T(t,null,"mousedrag"===n?"mousemove":n,r,i,a,g)||T(e,g||t||e,n,r,i,a)}}),Y=W.extend({_class:"CanvasView",initialize:function(e,t){if(!(t instanceof n.HTMLCanvasElement)){var r=p.read(arguments,1);if(r.isZero())throw new Error("Cannot create CanvasView with the provided argument: "+i.slice(arguments,1));t=ne.getCanvas(r)}var a=this._context=t.getContext("2d");if(a.save(),this._pixelRatio=1,!/^off|false$/.test(s.getAttribute(t,"hidpi"))){var o=n.devicePixelRatio||1,c=U.getPrefixed(a,"backingStorePixelRatio")||1;this._pixelRatio=o/c}W.call(this,e,t),this._needsUpdate=!0},remove:function e(){return this._context.restore(),e.base.call(this)},_setElementSize:function e(t,n){var r=this._pixelRatio;if(e.base.call(this,t*r,n*r),1!==r){var i=this._element,a=this._context;if(!s.hasAttribute(i,"resize")){var o=i.style;o.width=t+"px",o.height=n+"px"}a.restore(),a.save(),a.scale(r,r)}},getContext:function(){return this._context},getPixelSize:function e(t){var n,r=se.agent;if(r&&r.firefox)n=e.base.call(this,t);else{var i=this._context,a=i.font;i.font=t+" serif",n=parseFloat(i.font),i.font=a}return n},getTextWidth:function(e,t){var n=this._context,r=n.font,i=0;n.font=e;for(var a=0,s=t.length;a<s;a++)i=Math.max(i,n.measureText(t[a]).width);return n.font=r,i},update:function(){if(!this._needsUpdate)return!1;var e=this._project,t=this._context,n=this._viewSize;return t.clearRect(0,0,n.width+1,n.height+1),e&&e.draw(t,this._matrix,this._pixelRatio),this._needsUpdate=!1,!0}}),$=i.extend({_class:"Event",initialize:function(e){this.event=e,this.type=e&&e.type},prevented:!1,stopped:!1,preventDefault:function(){this.prevented=!0,this.event.preventDefault()},stopPropagation:function(){this.stopped=!0,this.event.stopPropagation()},stop:function(){this.stopPropagation(),this.preventDefault()},getTimeStamp:function(){return this.event.timeStamp},getModifiers:function(){return Q.modifiers}}),K=$.extend({_class:"KeyEvent",initialize:function(e,t,n,r){this.type=e,this.event=t,this.key=n,this.character=r},toString:function(){return"{ type: '"+this.type+"', key: '"+this.key+"', character: '"+this.character+"', modifiers: "+this.getModifiers()+" }"}}),Q=new function(){var e,a,s={"\t":"tab"," ":"space","\b":"backspace","":"delete",Spacebar:"space",Del:"delete",Win:"meta",Esc:"escape"},o={tab:"\t",space:" ",enter:"\r"},c={},l={},u=new i({shift:!1,control:!1,alt:!1,meta:!1,capsLock:!1,space:!1}).inject({option:{get:function(){return this.alt}},command:{get:function(){var e=se&&se.agent;return e&&e.mac?this.meta:this.control}}});function h(e){var n=e.key||e.keyIdentifier;return n=/^U\+/.test(n)?String.fromCharCode(parseInt(n.substr(2),16)):/^Arrow[A-Z]/.test(n)?n.substr(5):"Unidentified"===n||n===t?String.fromCharCode(e.keyCode):n,s[n]||(n.length>1?i.hyphenate(n):n.toLowerCase())}function d(t,n,r,a){var s,o=W._focused;if(c[n]=t,t?l[n]=r:delete l[n],n.length>1&&(s=i.camelize(n))in u){u[s]=t;var h=se&&se.agent;if("meta"===s&&h&&h.mac)if(t)e={};else{for(var f in e)f in l&&d(!1,f,e[f],a);e=null}}else t&&e&&(e[n]=r);o&&o._handleKeyEvent(t?"keydown":"keyup",a,n,r)}return G.add(r,{keydown:function(e){var t=h(e),n=se&&se.agent;t.length>1||n&&n.chrome&&(e.altKey||n.mac&&e.metaKey||!n.mac&&e.ctrlKey)?d(!0,t,o[t]||(t.length>1?"":t),e):a=t},keypress:function(e){if(a){var t=h(e),n=e.charCode,r=n>=32?String.fromCharCode(n):t.length>1?"":t;t!==a&&(t=r.toLowerCase()),d(!0,t,r,e),a=null}},keyup:function(e){var t=h(e);t in l&&d(!1,t,l[t],e)}}),G.add(n,{blur:function(e){for(var t in l)d(!1,t,l[t],e)}}),{modifiers:u,isDown:function(e){return!!c[e]}}},X=$.extend({_class:"MouseEvent",initialize:function(e,t,n,r,i){this.type=e,this.event=t,this.point=n,this.target=r,this.delta=i},toString:function(){return"{ type: '"+this.type+"', point: "+this.point+", target: "+this.target+(this.delta?", delta: "+this.delta:"")+", modifiers: "+this.getModifiers()+" }"}}),Z=$.extend({_class:"ToolEvent",_item:null,initialize:function(e,t,n){this.tool=e,this.type=t,this.event=n},_choosePoint:function(e,t){return e||(t?t.clone():null)},getPoint:function(){return this._choosePoint(this._point,this.tool._point)},setPoint:function(e){this._point=e},getLastPoint:function(){return this._choosePoint(this._lastPoint,this.tool._lastPoint)},setLastPoint:function(e){this._lastPoint=e},getDownPoint:function(){return this._choosePoint(this._downPoint,this.tool._downPoint)},setDownPoint:function(e){this._downPoint=e},getMiddlePoint:function(){return!this._middlePoint&&this.tool._lastPoint?this.tool._point.add(this.tool._lastPoint).divide(2):this._middlePoint},setMiddlePoint:function(e){this._middlePoint=e},getDelta:function(){return!this._delta&&this.tool._lastPoint?this.tool._point.subtract(this.tool._lastPoint):this._delta},setDelta:function(e){this._delta=e},getCount:function(){return this.tool[/^mouse(down|up)$/.test(this.type)?"_downCount":"_moveCount"]},setCount:function(e){this.tool[/^mouse(down|up)$/.test(this.type)?"downCount":"count"]=e},getItem:function(){if(!this._item){var e=this.tool._scope.project.hitTest(this.getPoint());if(e){for(var t=e.item,n=t._parent;/^(Group|CompoundPath)$/.test(n._class);)t=n,n=n._parent;this._item=t}}return this._item},setItem:function(e){this._item=e},toString:function(){return"{ type: "+this.type+", point: "+this.getPoint()+", count: "+this.getCount()+", modifiers: "+this.getModifiers()+" }"}}),J=o.extend({_class:"Tool",_list:"tools",_reference:"tool",_events:["onMouseDown","onMouseUp","onMouseDrag","onMouseMove","onActivate","onDeactivate","onEditOptions","onKeyDown","onKeyUp"],initialize:function(e){o.call(this),this._moveCount=-1,this._downCount=-1,this.set(e)},getMinDistance:function(){return this._minDistance},setMinDistance:function(e){this._minDistance=e,null!=e&&null!=this._maxDistance&&e>this._maxDistance&&(this._maxDistance=e)},getMaxDistance:function(){return this._maxDistance},setMaxDistance:function(e){this._maxDistance=e,null!=this._minDistance&&null!=e&&e<this._minDistance&&(this._minDistance=e)},getFixedDistance:function(){return this._minDistance==this._maxDistance?this._minDistance:null},setFixedDistance:function(e){this._minDistance=this._maxDistance=e},_handleMouseEvent:function(e,t,n,r){se=this._scope,r.drag&&!this.responds(e)&&(e="mousemove");var i=r.move||r.drag,a=this.responds(e),s=!1,o=this;function c(e,t){var a=n,s=i?o._point:o._downPoint||a;if(i){if(o._moveCount>=0&&a.equals(s))return!1;if(s&&(null!=e||null!=t)){var c=a.subtract(s),l=c.getLength();if(l<(e||0))return!1;t&&(a=s.add(c.normalize(Math.min(l,t))))}o._moveCount++}return o._point=a,o._lastPoint=s||a,r.down&&(o._moveCount=-1,o._downPoint=a,o._downCount++),!0}function l(){a&&(s=o.emit(e,new Z(o,e,t))||s)}if(r.down)c(),l();else if(r.up)c(null,this._maxDistance),l();else if(a)for(;c(this._minDistance,this._maxDistance);)l();return s}}),ee=i.extend(a,{_class:"Tween",statics:{easings:new i({linear:function(e){return e},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return e*(2-e)},easeInOutQuad:function(e){return e<.5?2*e*e:2*(2-e)*e-1},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return--e*e*e+1},easeInOutCubic:function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1- --e*e*e*e},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1+--e*e*e*e*e},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e}})},initialize:function e(t,n,r,i,a,s){this.object=t;var o=typeof a,c="function"===o;this.type=c?o:"string"===o?a:"linear",this.easing=c?a:e.easings[this.type],this.duration=i,this.running=!1,this._then=null,this._startTime=null;var l=n||r;this._keys=l?Object.keys(l):[],this._parsedKeys=this._parseKeys(this._keys),this._from=l&&this._getState(n),this._to=l&&this._getState(r),!1!==s&&this.start()},then:function(e){return this._then=e,this},start:function(){return this._startTime=null,this.running=!0,this},stop:function(){return this.running=!1,this},update:function(e){if(this.running){e>=1&&(e=1,this.running=!1);for(var t=this.easing(e),n=this._keys,r=function(n){return"function"==typeof n?n(t,e):n},a=0,s=n&&n.length;a<s;a++){var o=n[a],c=r(this._from[o]),l=r(this._to[o]),u=c&&l&&c.__add&&l.__add?l.__subtract(c).__multiply(t).__add(c):(l-c)*t+c;this._setProperty(this._parsedKeys[o],u)}this.responds("update")&&this.emit("update",new i({progress:e,factor:t})),!this.running&&this._then&&this._then(this.object)}return this},_events:{onUpdate:{}},_handleFrame:function(e){var t=this._startTime,n=t?(e-t)/this.duration:0;t||(this._startTime=e),this.update(n)},_getState:function(e){for(var t=this._keys,n={},r=0,i=t.length;r<i;r++){var a,s=t[r],o=this._parsedKeys[s],c=this._getProperty(o);if(e){var l=this._resolveValue(c,e[s]);this._setProperty(o,l),a=(a=this._getProperty(o))&&a.clone?a.clone():a,this._setProperty(o,c)}else a=c&&c.clone?c.clone():c;n[s]=a}return n},_resolveValue:function(e,t){if(t){if(Array.isArray(t)&&2===t.length){var n=t[0];return n&&n.match&&n.match(/^[+\-\*\/]=/)?this._calculate(e,n[0],t[1]):t}if("string"==typeof t){var r=t.match(/^[+\-*/]=(.*)/);if(r){var i=JSON.parse(r[1].replace(/(['"])?([a-zA-Z0-9_]+)(['"])?:/g,'"$2": '));return this._calculate(e,t[0],i)}}}return t},_calculate:function(e,t,n){return se.PaperScript.calculateBinary(e,t,n)},_parseKeys:function(e){for(var t={},n=0,r=e.length;n<r;n++){var i=e[n],a=i.replace(/\.([^.]*)/g,"/$1").replace(/\[['"]?([^'"\]]*)['"]?\]/g,"/$1");t[i]=a.split("/")}return t},_getProperty:function(e,t){for(var n=this.object,r=0,i=e.length-(t||0);r<i&&n;r++)n=n[e[r]];return n},_setProperty:function(e,t){var n=this._getProperty(e,1);n&&(n[e[e.length-1]]=t)}}),te=function(t){var n=new e.XMLHttpRequest;return n.open((t.method||"get").toUpperCase(),t.url,i.pick(t.async,!0)),t.mimeType&&n.overrideMimeType(t.mimeType),n.onload=function(){var e=n.status;0===e||200===e?t.onLoad&&t.onLoad.call(n,n.responseText):n.onerror()},n.onerror=function(){var e=n.status,r='Could not load "'+t.url+'" (Status: '+e+")";if(!t.onError)throw new Error(r);t.onError(r,e)},n.send(null)},ne=i.exports.CanvasProvider={canvases:[],getCanvas:function(e,t,i){if(!n)return null;var a,s=!0;"object"==typeof e&&(t=e.height,e=e.width),this.canvases.length?a=this.canvases.pop():(a=r.createElement("canvas"),s=!1);var o=a.getContext("2d",i||{});if(!o)throw new Error("Canvas "+a+" is unable to provide a 2D context.");return a.width===e&&a.height===t?s&&o.clearRect(0,0,e+1,t+1):(a.width=e,a.height=t),o.save(),a},getContext:function(e,t,n){var r=this.getCanvas(e,t,n);return r?r.getContext("2d",n||{}):null},release:function(e){var t=e&&e.canvas?e.canvas:e;t&&t.getContext&&(t.getContext("2d").restore(),this.canvases.push(t))}},re=new function(){var e,t,n,r,a,s,o,c,l,u,h,d=Math.min,f=Math.max,p=Math.abs;function m(e,t,n){return.2989*e+.587*t+.114*n}function g(e,t,n,r){var i=r-m(e,t,n),a=(r=m(l=e+i,u=t+i,h=n+i),d(l,u,h)),s=f(l,u,h);if(a<0){var o=r-a;l=r+(l-r)*r/o,u=r+(u-r)*r/o,h=r+(h-r)*r/o}if(s>255){var c=255-r,p=s-r;l=r+(l-r)*c/p,u=r+(u-r)*c/p,h=r+(h-r)*c/p}}function v(e,t,n){return f(e,t,n)-d(e,t,n)}function y(e,t,n,r){var i,a=[e,t,n],s=f(e,t,n),o=d(e,t,n);i=0===d(o=o===e?0:o===t?1:2,s=s===e?0:s===t?1:2)?1===f(o,s)?2:1:0,a[s]>a[o]?(a[i]=(a[i]-a[o])*r/(a[s]-a[o]),a[s]=r):a[i]=a[s]=0,a[o]=0,l=a[0],u=a[1],h=a[2]}var b={multiply:function(){l=a*e/255,u=s*t/255,h=o*n/255},screen:function(){l=a+e-a*e/255,u=s+t-s*t/255,h=o+n-o*n/255},overlay:function(){l=a<128?2*a*e/255:255-2*(255-a)*(255-e)/255,u=s<128?2*s*t/255:255-2*(255-s)*(255-t)/255,h=o<128?2*o*n/255:255-2*(255-o)*(255-n)/255},"soft-light":function(){var r=e*a/255;l=r+a*(255-(255-a)*(255-e)/255-r)/255,u=(r=t*s/255)+s*(255-(255-s)*(255-t)/255-r)/255,h=(r=n*o/255)+o*(255-(255-o)*(255-n)/255-r)/255},"hard-light":function(){l=e<128?2*e*a/255:255-2*(255-e)*(255-a)/255,u=t<128?2*t*s/255:255-2*(255-t)*(255-s)/255,h=n<128?2*n*o/255:255-2*(255-n)*(255-o)/255},"color-dodge":function(){l=0===a?0:255===e?255:d(255,255*a/(255-e)),u=0===s?0:255===t?255:d(255,255*s/(255-t)),h=0===o?0:255===n?255:d(255,255*o/(255-n))},"color-burn":function(){l=255===a?255:0===e?0:f(0,255-255*(255-a)/e),u=255===s?255:0===t?0:f(0,255-255*(255-s)/t),h=255===o?255:0===n?0:f(0,255-255*(255-o)/n)},darken:function(){l=a<e?a:e,u=s<t?s:t,h=o<n?o:n},lighten:function(){l=a>e?a:e,u=s>t?s:t,h=o>n?o:n},difference:function(){(l=a-e)<0&&(l=-l),(u=s-t)<0&&(u=-u),(h=o-n)<0&&(h=-h)},exclusion:function(){l=a+e*(255-a-a)/255,u=s+t*(255-s-s)/255,h=o+n*(255-o-o)/255},hue:function(){y(e,t,n,v(a,s,o)),g(l,u,h,m(a,s,o))},saturation:function(){y(a,s,o,v(e,t,n)),g(l,u,h,m(a,s,o))},luminosity:function(){g(a,s,o,m(e,t,n))},color:function(){g(e,t,n,m(a,s,o))},add:function(){l=d(a+e,255),u=d(s+t,255),h=d(o+n,255)},subtract:function(){l=f(a-e,0),u=f(s-t,0),h=f(o-n,0)},average:function(){l=(a+e)/2,u=(s+t)/2,h=(o+n)/2},negation:function(){l=255-p(255-e-a),u=255-p(255-t-s),h=255-p(255-n-o)}},_=this.nativeModes=i.each(["source-over","source-in","source-out","source-atop","destination-over","destination-in","destination-out","destination-atop","lighter","darker","copy","xor"],(function(e){this[e]=!0}),{}),w=ne.getContext(1,1,{willReadFrequently:!0});w&&(i.each(b,(function(e,t){var n="darken"===t,r=!1;w.save();try{w.fillStyle=n?"#300":"#a00",w.fillRect(0,0,1,1),w.globalCompositeOperation=t,w.globalCompositeOperation===t&&(w.fillStyle=n?"#a00":"#300",w.fillRect(0,0,1,1),r=w.getImageData(0,0,1,1).data[0]!==n?170:51)}catch(i){}w.restore(),_[t]=r})),ne.release(w)),this.process=function(i,d,f,p,m){var g=d.canvas,v="normal"===i;if(v||_[i])f.save(),f.setTransform(1,0,0,1,0,0),f.globalAlpha=p,v||(f.globalCompositeOperation=i),f.drawImage(g,m.x,m.y),f.restore();else{var y=b[i];if(!y)return;for(var w=f.getImageData(m.x,m.y,g.width,g.height),x=w.data,k=d.getImageData(0,0,g.width,g.height).data,S=0,C=x.length;S<C;S+=4){e=k[S],a=x[S],t=k[S+1],s=x[S+1],n=k[S+2],o=x[S+2],r=k[S+3],c=x[S+3],y();var M=r*p/255,E=1-M;x[S]=M*l+E*a,x[S+1]=M*u+E*s,x[S+2]=M*h+E*o,x[S+3]=r*p+E*c}f.putImageData(w,m.x,m.y)}}},ie=new function(){var e="http://www.w3.org/2000/svg",t="http://www.w3.org/2000/xmlns",n="http://www.w3.org/1999/xlink",i={href:n,xlink:t,xmlns:t+"/","xmlns:xlink":t+"/"};function a(e,t,n){for(var r in t){var a=t[r],s=i[r];"number"==typeof a&&n&&(a=n.number(a)),s?e.setAttributeNS(s,r,a):e.setAttribute(r,a)}return e}return{svg:e,xmlns:t,xlink:n,create:function(t,n,i){return a(r.createElementNS(e,t),n,i)},get:function(e,t){var n=i[t],r=n?e.getAttributeNS(n,t):e.getAttribute(t);return"null"===r?null:r},set:a}},ae=i.each({fillColor:["fill","color"],fillRule:["fill-rule","string"],strokeColor:["stroke","color"],strokeWidth:["stroke-width","number"],strokeCap:["stroke-linecap","string"],strokeJoin:["stroke-linejoin","string"],strokeScaling:["vector-effect","lookup",{true:"none",false:"non-scaling-stroke"},function(e,t){return!t&&(e instanceof D||e instanceof S||e instanceof V)}],miterLimit:["stroke-miterlimit","number"],dashArray:["stroke-dasharray","array"],dashOffset:["stroke-dashoffset","number"],fontFamily:["font-family","string"],fontWeight:["font-weight","string"],fontSize:["font-size","number"],justification:["text-anchor","lookup",{left:"start",center:"middle",right:"end"}],opacity:["opacity","number"],blendMode:["mix-blend-mode","style"]},(function(e,t){var n=i.capitalize(t),r=e[2];this[t]={type:e[1],property:t,attribute:e[0],toSVG:r,fromSVG:r&&i.each(r,(function(e,t){this[e]=t}),{}),exportFilter:e[3],get:"get"+n,set:"set"+n}}),{});new function(){var t;function n(e,n,r){var a,s=new i,o=e.getTranslation();if(n&&(e.isInvertible()?(a=(e=e._shiftless())._inverseTransform(o),o=null):a=new d,s[r?"cx":"x"]=a.x,s[r?"cy":"y"]=a.y),!e.isIdentity()){var c=e.decompose();if(c){var l=[],h=c.rotation,f=c.scaling,p=c.skewing;o&&!o.isZero()&&l.push("translate("+t.point(o)+")"),h&&l.push("rotate("+t.number(h)+")"),u.isZero(f.x-1)&&u.isZero(f.y-1)||l.push("scale("+t.point(f)+")"),p.x&&l.push("skewX("+t.number(p.x)+")"),p.y&&l.push("skewY("+t.number(p.y)+")"),s.transform=l.join(" ")}else s.transform="matrix("+e.getValues().join(",")+")"}return s}function r(e,r){for(var i=n(e._matrix),a=e._children,s=ie.create("g",i,t),o=0,c=a.length;o<c;o++){var l=a[o],u=m(l,r);if(u)if(l.isClipMask()){var h=ie.create("clipPath");h.appendChild(u),f(l,h,"clip"),ie.set(s,{"clip-path":"url(#"+h.id+")"})}else s.appendChild(u)}return s}function a(e){var r=e._type,i=e._radius,a=n(e._matrix,!0,"rectangle"!==r);if("rectangle"===r){r="rect";var s=e._size,o=s.width,c=s.height;a.x-=o/2,a.y-=c/2,a.width=o,a.height=c,i.isZero()&&(i=null)}return i&&("circle"===r?a.r=i:(a.rx=i.width,a.ry=i.height)),ie.create(r,a,t)}var s,o={Group:r,Layer:r,Raster:function(e,r){var i=n(e._matrix,!0),a=e.getSize(),s=e.getImage();return i.x-=a.width/2,i.y-=a.height/2,i.width=a.width,i.height=a.height,i.href=0==r.embedImages&&s&&s.src||e.toDataURL(),ie.create("image",i,t)},Path:function(e,r){var i=r.matchShapes;if(i){var s=e.toShape(!1);if(s)return a(s)}var o,c=e._segments,l=c.length,u=n(e._matrix);if(i&&l>=2&&!e.hasHandles())if(l>2){o=e._closed?"polygon":"polyline";for(var h=[],d=0;d<l;d++)h.push(t.point(c[d]._point));u.points=h.join(" ")}else{o="line";var f=c[0]._point,p=c[1]._point;u.set({x1:f.x,y1:f.y,x2:p.x,y2:p.y})}else o="path",u.d=e.getPathData(null,r.precision);return ie.create(o,u,t)},Shape:a,CompoundPath:function(e,r){var i=n(e._matrix),a=e.getPathData(null,r.precision);return a&&(i.d=a),ie.create("path",i,t)},SymbolItem:function(e,r){var i=n(e._matrix,!0),a=e._definition,s=c(a,"symbol"),o=a._item,l=o.getStrokeBounds();return s||((s=ie.create("symbol",{viewBox:t.rectangle(l)})).appendChild(m(o,r)),f(a,s,"symbol")),i.href="#"+s.id,i.x+=l.x,i.y+=l.y,i.width=l.width,i.height=l.height,i.overflow="visible",ie.create("use",i,t)},PointText:function(e){var r=ie.create("text",n(e._matrix,!0),t);return r.textContent=e._content,r}};function c(e,t){return s||(s={ids:{},svgs:{}}),e&&s.svgs[t+"-"+(e._id||e.__id||(e.__id=h.get("svg")))]}function f(e,t,n){s||c();var r=s.ids[n]=(s.ids[n]||0)+1;t.id=n+"-"+r,s.svgs[n+"-"+(e._id||e.__id)]=t}function p(t,n){var r=t,i=null;if(s){for(var a in r="svg"===t.nodeName.toLowerCase()&&t,s.svgs)i||(r||(r=ie.create("svg")).appendChild(t),i=r.insertBefore(ie.create("defs"),r.firstChild)),i.appendChild(s.svgs[a]);s=null}return n.asString?(new e.XMLSerializer).serializeToString(r):r}function m(e,n,r){var a=o[e._class],s=a&&a(e,n);if(s){var l=n.onExport;l&&(s=l(e,s,n)||s);var u=JSON.stringify(e._data);u&&"{}"!==u&&"null"!==u&&s.setAttribute("data-paper-data",u)}return s&&function(e,n,r,a){var s={},o=!a&&e.getParent(),l=[];return null!=e._name&&(s.id=e._name),i.each(ae,(function(n){var a=n.get,u=n.type,h=e[a]();if(n.exportFilter?n.exportFilter(e,h):0==r.reduceAttributes||!o||!i.equals(o[a](),h)){if("color"===u&&null!=h){var d=h.getAlpha();d<1&&(s[n.attribute+"-opacity"]=d)}"style"===u?l.push(n.attribute+": "+h):s[n.attribute]=null==h?"none":"color"===u?h.gradient?function(e){var n=c(e,"color");if(!n){var r,i=e.getGradient(),a=i._radial,s=e.getOrigin(),o=e.getDestination();if(a){r={cx:s.x,cy:s.y,r:s.getDistance(o)};var l=e.getHighlight();l&&(r.fx=l.x,r.fy=l.y)}else r={x1:s.x,y1:s.y,x2:o.x,y2:o.y};r.gradientUnits="userSpaceOnUse",n=ie.create((a?"radial":"linear")+"Gradient",r,t);for(var u=i._stops,h=0,d=u.length;h<d;h++){var p=u[h],m=p._color,g=m.getAlpha(),v=p._offset;r={offset:null==v?h/(d-1):v},m&&(r["stop-color"]=m.toCSS(!0)),g<1&&(r["stop-opacity"]=g),n.appendChild(ie.create("stop",r,t))}f(e,n,"color")}return"url(#"+n.id+")"}(h):h.toCSS(!0):"array"===u?h.join(","):"lookup"===u?n.toSVG[h]:h}})),l.length&&(s.style=l.join(";")),1===s.opacity&&delete s.opacity,e._visible||(s.visibility="hidden"),ie.set(n,s,t)}(e,s,n,r)}function v(e){return e||(e={}),t=new l(e.precision),e}w.inject({exportSVG:function(e){return p(m(this,e=v(e),!0),e)}}),_.inject({exportSVG:function(e){e=v(e);var r=this._children,a=this.getView(),s=i.pick(e.bounds,"view"),o=e.matrix||"view"===s&&a._matrix,c=o&&y.read([o]),l="view"===s?new g([0,0],a.getViewSize()):"content"===s?w._getBounds(r,c,{stroke:!0}).rect:g.read([s],0,{readNull:!0}),u={version:"1.1",xmlns:ie.svg,"xmlns:xlink":ie.xlink};l&&(u.width=l.width,u.height=l.height,(l.x||0===l.x||l.y||0===l.y)&&(u.viewBox=t.rectangle(l)));var h=ie.create("svg",u,t),d=h;c&&!c.isIdentity()&&(d=h.appendChild(ie.create("g",n(c),t)));for(var f=0,b=r.length;f<b;f++)d.appendChild(m(r[f],e,!0));return p(h,e)}})},new function(){var a,s={};function o(e,t,n,r,i,s){var o=ie.get(e,t)||s,c=null==o?r?null:n?"":0:n?o:parseFloat(o);return/%\s*$/.test(o)?c/100*(i?1:a[/x|^width/.test(t)?"width":"height"]):c}function c(e,t,n,r,i,a,s){return t=o(e,t||"x",!1,r,i,a),n=o(e,n||"y",!1,r,i,s),!r||null!=t&&null!=n?new d(t,n):null}function l(e,t,n,r,i){return t=o(e,t||"width",!1,r,i),n=o(e,n||"height",!1,r,i),!r||null!=t&&null!=n?new p(t,n):null}function u(e,t,n){return"none"===e?null:"number"===t?parseFloat(e):"array"===t?e?e.split(/[\s,]+/g).map(parseFloat):[]:"color"===t?P(e)||e:"lookup"===t?n[e]:e}function h(e,t,n,r){var i=e.childNodes,a="clippath"===t,s="defs"===t,o=new x,c=o._project,l=c._currentStyle,u=[];if(a||s||(o=A(o,e,r),c._currentStyle=o._style.clone()),r)for(var h=e.querySelectorAll("defs"),d=0,f=h.length;d<f;d++)I(h[d],n,!1);for(d=0,f=i.length;d<f;d++){var p,m=i[d];1!==m.nodeType||/^defs$/i.test(m.nodeName)||!(p=I(m,n,!1))||p instanceof E||u.push(p)}return o.addChildren(u),a&&(o=A(o.reduce(),e,r)),c._currentStyle=l,(a||s)&&(o.remove(),o=null),o}function f(e,t){for(var n=e.getAttribute("points").match(/[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g),r=[],i=0,a=n.length;i<a;i+=2)r.push(new d(parseFloat(n[i]),parseFloat(n[i+1])));var s=new O(r);return"polygon"===t&&s.closePath(),s}function m(e,t){var n,r=(o(e,"href",!0)||"").substring(1),i="radialgradient"===t;if(r)(n=s[r].getGradient())._radial^i&&((n=n.clone())._radial=i);else{for(var a=e.childNodes,l=[],u=0,h=a.length;u<h;u++){var d=a[u];1===d.nodeType&&l.push(A(new q,d))}n=new j(l,i)}var f,p,m,g="userSpaceOnUse"!==o(e,"gradientUnits",!0);return i?(p=(f=c(e,"cx","cy",!1,g,"50%","50%")).add(o(e,"r",!1,!1,g,"50%"),0),m=c(e,"fx","fy",!0,g)):(f=c(e,"x1","y1",!1,g,"0%","0%"),p=c(e,"x2","y2",!1,g,"100%","0%")),A(new z(n,f,p,m),e)._scaleToBounds=g,null}var v={"#document":function(e,t,n,r){for(var i=e.childNodes,a=0,s=i.length;a<s;a++){var o=i[a];if(1===o.nodeType)return I(o,n,r)}},g:h,svg:h,clippath:h,polygon:f,polyline:f,path:function(e){return D.create(e.getAttribute("d"))},lineargradient:m,radialgradient:m,image:function(e){var t=new C(o(e,"href",!0));return t.on("load",(function(){var t=l(e);this.setSize(t);var n=c(e).add(t.divide(2));this._matrix.append((new y).translate(n))})),t},symbol:function(e,t,n,r){return new E(h(e,t,n,r),!0)},defs:h,use:function(e){var t=(o(e,"href",!0)||"").substring(1),n=s[t],r=c(e);return n?n instanceof E?n.place(r):n.clone().translate(r):null},circle:function(e){return new S.Circle(c(e,"cx","cy"),o(e,"r"))},ellipse:function(e){return new S.Ellipse({center:c(e,"cx","cy"),radius:l(e,"rx","ry")})},rect:function(e){return new S.Rectangle(new g(c(e),l(e)),l(e,"rx","ry"))},line:function(e){return new O.Line(c(e,"x1","y1"),c(e,"x2","y2"))},text:function(e){var t=new F(c(e).add(c(e,"dx","dy")));return t.setContent(e.textContent.trim()||""),t},switch:h};function b(e,t,n,r){if(e.transform){for(var i=(r.getAttribute(n)||"").split(/\)\s*/g),a=new y,s=0,o=i.length;s<o;s++){var c=i[s];if(!c)break;for(var l=c.split(/\(\s*/),u=l[0].trim(),h=l[1].split(/[\s,]+/g),d=0,f=h.length;d<f;d++)h[d]=parseFloat(h[d]);switch(u){case"matrix":a.append(new y(h[0],h[1],h[2],h[3],h[4],h[5]));break;case"rotate":a.rotate(h[0],h[1]||0,h[2]||0);break;case"translate":a.translate(h[0],h[1]||0);break;case"scale":a.scale(h);break;case"skewX":a.skew(h[0],0);break;case"skewY":a.skew(0,h[0])}}e.transform(a)}}function k(e,t,n){var r="fill-opacity"===n?"getFillColor":"getStrokeColor",i=e[r]&&e[r]();i&&i.setAlpha(parseFloat(t))}var M=i.set(i.each(ae,(function(e){this[e.attribute]=function(t,n){if(t[e.set]&&(t[e.set](u(n,e.type,e.fromSVG)),"color"===e.type)){var r=t[e.get]();if(r&&r._scaleToBounds){var i=t.getBounds();r.transform((new y).translate(i.getPoint()).scale(i.getSize()))}}}}),{}),{id:function(e,t){s[t]=e,e.setName&&e.setName(t)},"clip-path":function(e,t){var n=P(t);if(n){if((n=n.clone()).setClipMask(!0),!(e instanceof x))return new x(n,e);e.insertChild(0,n)}},gradientTransform:b,transform:b,"fill-opacity":k,"stroke-opacity":k,visibility:function(e,t){e.setVisible&&e.setVisible("visible"===t)},display:function(e,t){e.setVisible&&e.setVisible(null!==t)},"stop-color":function(e,t){e.setColor&&e.setColor(t)},"stop-opacity":function(e,t){e._color&&e._color.setAlpha(parseFloat(t))},offset:function(e,t){if(e.setOffset){var n=t.match(/(.*)%$/);e.setOffset(n?n[1]/100:parseFloat(t))}},viewBox:function(e,t,n,r,i){var a,s=new g(u(t,"array")),o=l(r,null,null,!0);if(e instanceof x){var c=o?o.divide(s.getSize()):1,h=(new y).scale(c).translate(s.getPoint().negate());a=e}else e instanceof E&&(o&&s.setSize(o),a=e._item);if(a){if("visible"!==T(r,"overflow",i)){var d=new S.Rectangle(s);d.setClipMask(!0),a.addChild(d)}h&&a.transform(h)}}});function T(e,n,r){var a=e.attributes[n],s=a&&a.value;if(!s&&e.style){var o=i.camelize(n);(s=e.style[o])||r.node[o]===r.parent[o]||(s=r.node[o])}return s?"none"===s?null:s:t}function A(e,n,r){var a=n.parentNode,s={node:U.getStyles(n)||{},parent:!r&&!/^defs$/i.test(a.tagName)&&U.getStyles(a)||{}};return i.each(M,(function(r,i){var a=T(n,i,s);e=a!==t&&r(e,a,i,n,s)||e})),e}function P(e){var t=e&&e.match(/\((?:["'#]*)([^"')]+)/),r=t&&t[1],i=r&&s[n?r.replace(n.location.href.split("#")[0]+"#",""):r];return i&&i._scaleToBounds&&((i=i.clone())._scaleToBounds=!0),i}function I(e,t,n){var o,c,u,h=e.nodeName.toLowerCase(),d="#document"!==h,f=r.body;n&&d&&(a=se.getView().getSize(),a=l(e,null,null,!0)||a,o=ie.create("svg",{style:"stroke-width: 1px; stroke-miterlimit: 10"}),c=e.parentNode,u=e.nextSibling,o.appendChild(e),f.appendChild(o));var p=se.settings,m=p.applyMatrix,g=p.insertItems;p.applyMatrix=!1,p.insertItems=!1;var y=v[h],b=y&&y(e,h,t,n)||null;if(p.insertItems=g,p.applyMatrix=m,b){!d||b instanceof x||(b=A(b,e,n));var _=t.onImport,w=d&&e.getAttribute("data-paper-data");_&&(b=_(e,b,t)||b),t.expandShapes&&b instanceof S&&(b.remove(),b=b.toPath()),w&&(b._data=JSON.parse(w))}return o&&(f.removeChild(o),c&&(u?c.insertBefore(e,u):c.appendChild(e))),n&&(s={},b&&i.pick(t.applyMatrix,m)&&b.matrix.apply(!0,!0)),b}function N(n,i,a){if(!n)return null;i="function"==typeof i?{onLoad:i}:i||{};var s=se,o=null;function c(r){try{var c="object"==typeof r?r:(new e.DOMParser).parseFromString(r.trim(),"image/svg+xml");if(!c.nodeName)throw c=null,new Error("Unsupported SVG source: "+n);se=s,o=I(c,i,!0),i&&!1===i.insert||a._insertItem(t,o);var u=i.onLoad;u&&u(o,r)}catch(h){l(h)}}function l(e,t){var n=i.onError;if(!n)throw new Error(e);n(e,t)}if("string"!=typeof n||/^[\s\S]*</.test(n)){if("undefined"!=typeof File&&n instanceof File){var u=new FileReader;return u.onload=function(){c(u.result)},u.onerror=function(){l(u.error)},u.readAsText(n)}c(n)}else{var h=r.getElementById(n);h?c(h):te({url:n,async:!0,onLoad:c,onError:l})}return o}w.inject({importSVG:function(e,t){return N(e,t,this)}}),_.inject({importSVG:function(e,t){return this.activate(),N(e,t,this)}})},i.exports.PaperScript=function(){var t,a=this,o=a.acorn;if(!o&&void 0!==Qc)try{o=rl()}catch(_){}function c(e,t){return(a.acorn||o).parse(e,t)}o||(o=t={},function(e){var t,n,r,i;e.version="0.5.0",e.parse=function(e,i){return n=String(e),r=n.length,s(i),Ye(),function(e){v=y=o,t.locations&&(b=new We),w=k=null,x=[],Ze();var n=e||ut(),r=!0;for(e||(n.body=[]);d!==I;){var i=xt();n.body.push(i),r&&ft(i)&&ot(!0),r=!1}return dt(n,"Program")}(t.program)};var a=e.defaultOptions={ecmaVersion:5,strictSemicolons:!1,allowTrailingCommas:!0,forbidReserved:!1,allowReturnOutsideFunction:!1,locations:!1,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null};function s(e){for(var n in t=e||{},a)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=a[n]);i=t.sourceFile||null}var o,c,l,u,h,d,f,p,m,g,v,y,b,w,x,k,S=e.getLineInfo=function(e,t){for(var n=1,r=0;;){He.lastIndex=r;var i=He.exec(e);if(!(i&&i.index<t))break;++n,r=i.index+i[0].length}return{line:n,column:t-r}};function C(e,t){var r=S(n,e);t+=" ("+r.line+":"+r.column+")";var i=new SyntaxError(t);throw i.pos=e,i.loc=r,i.raisedAt=o,i}e.tokenize=function(e,i){n=String(e),r=n.length,s(i),Ye();var a={};function v(e){return y=l,Ze(e),a.start=c,a.end=l,a.startLoc=u,a.endLoc=h,a.type=d,a.value=f,a}return v.jumpTo=function(e,r){var i;if(o=e,t.locations)for(m=1,g=He.lastIndex=0;(i=He.exec(n))&&i.index<e;)++m,g=i.index+i[0].length;p=r,Xe()},v};var M=[],E={type:"num"},T={type:"regexp"},A={type:"string"},P={type:"name"},I={type:"eof"},N={keyword:"break"},D={keyword:"case",beforeExpr:!0},O={keyword:"catch"},L={keyword:"continue"},B={keyword:"debugger"},R={keyword:"default"},V={keyword:"do",isLoop:!0},F={keyword:"else",beforeExpr:!0},z={keyword:"finally"},j={keyword:"for",isLoop:!0},q={keyword:"function"},H={keyword:"if"},U={keyword:"return",beforeExpr:!0},G={keyword:"switch"},W={keyword:"throw",beforeExpr:!0},Y={keyword:"try"},$={keyword:"var"},K={keyword:"while",isLoop:!0},Q={keyword:"with"},X={keyword:"new",beforeExpr:!0},Z={keyword:"this"},J={keyword:"null",atomValue:null},ee={keyword:"true",atomValue:!0},te={keyword:"false",atomValue:!1},ne={keyword:"in",binop:7,beforeExpr:!0},re={break:N,case:D,catch:O,continue:L,debugger:B,default:R,do:V,else:F,finally:z,for:j,function:q,if:H,return:U,switch:G,throw:W,try:Y,var:$,while:K,with:Q,null:J,true:ee,false:te,new:X,in:ne,instanceof:{keyword:"instanceof",binop:7,beforeExpr:!0},this:Z,typeof:{keyword:"typeof",prefix:!0,beforeExpr:!0},void:{keyword:"void",prefix:!0,beforeExpr:!0},delete:{keyword:"delete",prefix:!0,beforeExpr:!0}},ie={type:"[",beforeExpr:!0},ae={type:"]"},se={type:"{",beforeExpr:!0},oe={type:"}"},ce={type:"(",beforeExpr:!0},le={type:")"},ue={type:",",beforeExpr:!0},he={type:";",beforeExpr:!0},de={type:":",beforeExpr:!0},fe={type:"."},pe={type:"?",beforeExpr:!0},me={binop:10,beforeExpr:!0},ge={isAssign:!0,beforeExpr:!0},ve={isAssign:!0,beforeExpr:!0},ye={postfix:!0,prefix:!0,isUpdate:!0},be={prefix:!0,beforeExpr:!0},_e={binop:1,beforeExpr:!0},we={binop:2,beforeExpr:!0},xe={binop:3,beforeExpr:!0},ke={binop:4,beforeExpr:!0},Se={binop:5,beforeExpr:!0},Ce={binop:6,beforeExpr:!0},Me={binop:7,beforeExpr:!0},Ee={binop:8,beforeExpr:!0},Te={binop:9,prefix:!0,beforeExpr:!0},Ae={binop:10,beforeExpr:!0};for(var Pe in e.tokTypes={bracketL:ie,bracketR:ae,braceL:se,braceR:oe,parenL:ce,parenR:le,comma:ue,semi:he,colon:de,dot:fe,question:pe,slash:me,eq:ge,name:P,eof:I,num:E,regexp:T,string:A},re)e.tokTypes["_"+Pe]=re[Pe];function Ie(e){e=e.split(" ");var t="",n=[];e:for(var r=0;r<e.length;++r){for(var i=0;i<n.length;++i)if(n[i][0].length==e[r].length){n[i].push(e[r]);continue e}n.push([e[r]])}function a(e){if(1==e.length)return t+="return str === "+JSON.stringify(e[0])+";";t+="switch(str){";for(var n=0;n<e.length;++n)t+="case "+JSON.stringify(e[n])+":";t+="return true}return false;"}if(n.length>3){for(n.sort((function(e,t){return t.length-e.length})),t+="switch(str.length){",r=0;r<n.length;++r){var s=n[r];t+="case "+s[0].length+":",a(s)}t+="}"}else a(e);return new Function("str",t)}var Ne,De=Ie("abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile"),Oe=Ie("class enum extends super const export import"),Le=Ie("implements interface let package private protected public static yield"),Be=Ie("eval arguments"),Re=Ie("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this"),Ve=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Fe="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",ze=new RegExp("["+Fe+"]"),je=new RegExp("["+Fe+"̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ؚؠ-ىٲ-ۓۧ-ۨۻ-ۼܰ-݊ࠀ-ࠔࠛ-ࠣࠥ-ࠧࠩ-࠭ࡀ-ࡗࣤ-ࣾऀ-ःऺ-़ा-ॏ॑-ॗॢ-ॣ०-९ঁ-ঃ়া-ৄেৈৗয়-ৠਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୟ-ୠ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఁ-ఃె-ైొ-్ౕౖౢ-ౣ౦-౯ಂಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢ-ೣ೦-೯ംഃെ-ൈൗൢ-ൣ൦-൯ංඃ්ා-ුූෘ-ෟෲෳิ-ฺเ-ๅ๐-๙ິ-ູ່-ໍ໐-໙༘༙༠-༩༹༵༷ཁ-ཇཱ-྄྆-྇ྍ-ྗྙ-ྼ࿆က-ဩ၀-၉ၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟ᜎ-ᜐᜠ-ᜰᝀ-ᝐᝲᝳក-ឲ៝០-៩᠋-᠍᠐-᠙ᤠ-ᤫᤰ-᤻ᥑ-ᥭᦰ-ᧀᧈ-ᧉ᧐-᧙ᨀ-ᨕᨠ-ᩓ᩠-᩿᩼-᪉᪐-᪙ᭆ-ᭋ᭐-᭙᭫-᭳᮰-᮹᯦-᯳ᰀ-ᰢ᱀-᱉ᱛ-ᱽ᳐-᳒ᴀ-ᶾḁ-ἕ‌‍‿⁀⁔⃐-⃥⃜⃡-⃰ⶁ-ⶖⷠ-ⷿ〡-〨゙゚Ꙁ-ꙭꙴ-꙽ꚟ꛰-꛱ꟸ-ꠀ꠆ꠋꠣ-ꠧꢀ-ꢁꢴ-꣄꣐-꣙ꣳ-ꣷ꤀-꤉ꤦ-꤭ꤰ-ꥅꦀ-ꦃ꦳-꧀ꨀ-ꨧꩀ-ꩁꩌ-ꩍ꩐-꩙ꩻꫠ-ꫩꫲ-ꫳꯀ-ꯡ꯬꯭꯰-꯹ﬠ-ﬨ︀-️︠-︦︳︴﹍-﹏0-9_]"),qe=/[\n\r\u2028\u2029]/,He=/\r\n|[\n\r\u2028\u2029]/g,Ue=e.isIdentifierStart=function(e){return e<65?36===e:e<91||(e<97?95===e:e<123||e>=170&&ze.test(String.fromCharCode(e)))},Ge=e.isIdentifierChar=function(e){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||e>=170&&je.test(String.fromCharCode(e))))};function We(){this.line=m,this.column=o-g}function Ye(){m=1,o=g=0,p=!0,Xe()}function $e(e,n){l=o,t.locations&&(h=new We),d=e,Xe(),f=n,p=e.beforeExpr}function Ke(){var e,r=t.onComment&&t.locations&&new We,i=o,a=n.indexOf("*/",o+=2);if(-1===a&&C(o-2,"Unterminated comment"),o=a+2,t.locations)for(He.lastIndex=i;(e=He.exec(n))&&e.index<o;)++m,g=e.index+e[0].length;t.onComment&&t.onComment(!0,n.slice(i+2,a),i,o,r,t.locations&&new We)}function Qe(){for(var e=o,i=t.onComment&&t.locations&&new We,a=n.charCodeAt(o+=2);o<r&&10!==a&&13!==a&&8232!==a&&8233!==a;)++o,a=n.charCodeAt(o);t.onComment&&t.onComment(!1,n.slice(e+2,o),e,o,i,t.locations&&new We)}function Xe(){for(;o<r;){var e=n.charCodeAt(o);if(32===e)++o;else if(13===e)++o,10===(i=n.charCodeAt(o))&&++o,t.locations&&(++m,g=o);else if(10===e||8232===e||8233===e)++o,t.locations&&(++m,g=o);else if(e>8&&e<14)++o;else if(47===e){var i;if(42===(i=n.charCodeAt(o+1)))Ke();else{if(47!==i)break;Qe()}}else if(160===e)++o;else{if(!(e>=5760&&Ve.test(String.fromCharCode(e))))break;++o}}}function Ze(e){if(e?o=c+1:c=o,t.locations&&(u=new We),e)return et();if(o>=r)return $e(I);var i=n.charCodeAt(o);if(Ue(i)||92===i)return at();var a=function(e){switch(e){case 46:return(a=n.charCodeAt(o+1))>=48&&a<=57?nt(!0):(++o,$e(fe));case 40:return++o,$e(ce);case 41:return++o,$e(le);case 59:return++o,$e(he);case 44:return++o,$e(ue);case 91:return++o,$e(ie);case 93:return++o,$e(ae);case 123:return++o,$e(se);case 125:return++o,$e(oe);case 58:return++o,$e(de);case 63:return++o,$e(pe);case 48:var i=n.charCodeAt(o+1);if(120===i||88===i)return function(){o+=2;var e=tt(16);return null==e&&C(c+2,"Expected hexadecimal number"),Ue(n.charCodeAt(o))&&C(o,"Identifier directly after number"),$e(E,e)}();case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return nt(!1);case 34:case 39:return function(e){o++;for(var i="";;){o>=r&&C(c,"Unterminated string constant");var a=n.charCodeAt(o);if(a===e)return++o,$e(A,i);if(92===a){a=n.charCodeAt(++o);var s=/^[0-7]+/.exec(n.slice(o,o+3));for(s&&(s=s[0]);s&&parseInt(s,8)>255;)s=s.slice(0,-1);if("0"===s&&(s=null),++o,s)k&&C(o-2,"Octal literal in strict mode"),i+=String.fromCharCode(parseInt(s,8)),o+=s.length-1;else switch(a){case 110:i+="\n";break;case 114:i+="\r";break;case 120:i+=String.fromCharCode(rt(2));break;case 117:i+=String.fromCharCode(rt(4));break;case 85:i+=String.fromCharCode(rt(8));break;case 116:i+="\t";break;case 98:i+="\b";break;case 118:i+="\v";break;case 102:i+="\f";break;case 48:i+="\0";break;case 13:10===n.charCodeAt(o)&&++o;case 10:t.locations&&(g=o,++m);break;default:i+=String.fromCharCode(a)}}else 13!==a&&10!==a&&8232!==a&&8233!==a||C(c,"Unterminated string constant"),i+=String.fromCharCode(a),++o}}(e);case 47:return function(){var e=n.charCodeAt(o+1);return p?(++o,et()):61===e?Je(ve,2):Je(me,1)}();case 37:case 42:return 61===n.charCodeAt(o+1)?Je(ve,2):Je(Ae,1);case 124:case 38:return function(e){var t=n.charCodeAt(o+1);return t===e?Je(124===e?_e:we,2):61===t?Je(ve,2):Je(124===e?xe:Se,1)}(e);case 94:return 61===n.charCodeAt(o+1)?Je(ve,2):Je(ke,1);case 43:case 45:return function(e){var t=n.charCodeAt(o+1);return t===e?45==t&&62==n.charCodeAt(o+2)&&qe.test(n.slice(y,o))?(o+=3,Qe(),Xe(),Ze()):Je(ye,2):61===t?Je(ve,2):Je(Te,1)}(e);case 60:case 62:return function(e){var t=n.charCodeAt(o+1),r=1;return t===e?(r=62===e&&62===n.charCodeAt(o+2)?3:2,61===n.charCodeAt(o+r)?Je(ve,r+1):Je(Ee,r)):33==t&&60==e&&45==n.charCodeAt(o+2)&&45==n.charCodeAt(o+3)?(o+=4,Qe(),Xe(),Ze()):(61===t&&(r=61===n.charCodeAt(o+2)?3:2),Je(Me,r))}(e);case 61:case 33:return function(e){return 61===n.charCodeAt(o+1)?Je(Ce,61===n.charCodeAt(o+2)?3:2):Je(61===e?ge:be,1)}(e);case 126:return Je(be,1)}var a;return!1}(i);if(!1===a){var s=String.fromCharCode(i);if("\\"===s||ze.test(s))return at();C(o,"Unexpected character '"+s+"'")}return a}function Je(e,t){var r=n.slice(o,o+t);o+=t,$e(e,r)}function et(){for(var e,t,i=o;;){o>=r&&C(i,"Unterminated regular expression");var a=n.charAt(o);if(qe.test(a)&&C(i,"Unterminated regular expression"),e)e=!1;else{if("["===a)t=!0;else if("]"===a&&t)t=!1;else if("/"===a&&!t)break;e="\\"===a}++o}var s=n.slice(i,o);++o;var c=it();c&&!/^[gmsiy]*$/.test(c)&&C(i,"Invalid regexp flag");try{var l=new RegExp(s,c)}catch(_){_ instanceof SyntaxError&&C(i,_.message),C(_)}return $e(T,l)}function tt(e,t){for(var r=o,i=0,a=0,s=null==t?1/0:t;a<s;++a){var c,l=n.charCodeAt(o);if((c=l>=97?l-97+10:l>=65?l-65+10:l>=48&&l<=57?l-48:1/0)>=e)break;++o,i=i*e+c}return o===r||null!=t&&o-r!==t?null:i}function nt(e){var t=o,r=!1,i=48===n.charCodeAt(o);e||null!==tt(10)||C(t,"Invalid number"),46===n.charCodeAt(o)&&(++o,tt(10),r=!0);var a=n.charCodeAt(o);69!==a&&101!==a||(43!==(a=n.charCodeAt(++o))&&45!==a||++o,null===tt(10)&&C(t,"Invalid number"),r=!0),Ue(n.charCodeAt(o))&&C(o,"Identifier directly after number");var s,c=n.slice(t,o);return r?s=parseFloat(c):i&&1!==c.length?/[89]/.test(c)||k?C(t,"Invalid number"):s=parseInt(c,8):s=parseInt(c,10),$e(E,s)}function rt(e){var t=tt(16,e);return null===t&&C(c,"Bad character escape sequence"),t}function it(){Ne=!1;for(var e,t=!0,r=o;;){var i=n.charCodeAt(o);if(Ge(i))Ne&&(e+=n.charAt(o)),++o;else{if(92!==i)break;Ne||(e=n.slice(r,o)),Ne=!0,117!=n.charCodeAt(++o)&&C(o,"Expecting Unicode escape sequence \\uXXXX"),++o;var a=rt(4),s=String.fromCharCode(a);s||C(o-1,"Invalid Unicode escape"),(t?Ue(a):Ge(a))||C(o-4,"Invalid Unicode escape"),e+=s}t=!1}return Ne?e:n.slice(r,o)}function at(){var e=it(),t=P;return!Ne&&Re(e)&&(t=re[e]),$e(t,e)}function st(){v=c,y=l,b=h,Ze()}function ot(e){if(k=e,o=c,t.locations)for(;o<g;)g=n.lastIndexOf("\n",g-2)+1,--m;Xe(),Ze()}function ct(){this.type=null,this.start=c,this.end=null}function lt(){this.start=u,this.end=null,null!==i&&(this.source=i)}function ut(){var e=new ct;return t.locations&&(e.loc=new lt),t.directSourceFile&&(e.sourceFile=t.directSourceFile),t.ranges&&(e.range=[c,0]),e}function ht(e){var n=new ct;return n.start=e.start,t.locations&&(n.loc=new lt,n.loc.start=e.loc.start),t.ranges&&(n.range=[e.range[0],0]),n}function dt(e,n){return e.type=n,e.end=y,t.locations&&(e.loc.end=b),t.ranges&&(e.range[1]=y),e}function ft(e){return t.ecmaVersion>=5&&"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"use strict"===e.expression.value}function pt(e){if(d===e)return st(),!0}function mt(){return!t.strictSemicolons&&(d===I||d===oe||qe.test(n.slice(y,c)))}function gt(){pt(he)||mt()||yt()}function vt(e){d===e?st():yt()}function yt(){C(c,"Unexpected token")}function bt(e){"Identifier"!==e.type&&"MemberExpression"!==e.type&&C(e.start,"Assigning to rvalue"),k&&"Identifier"===e.type&&Be(e.name)&&C(e.start,"Assigning to "+e.name+" in strict mode")}var _t={kind:"loop"},wt={kind:"switch"};function xt(){(d===me||d===ve&&"/="==f)&&Ze(!0);var e=d,r=ut();switch(e){case N:case L:st();var i=e===N;pt(he)||mt()?r.label=null:d!==P?yt():(r.label=Rt(),gt());for(var a=0;a<x.length;++a){var s=x[a];if(null==r.label||s.name===r.label.name){if(null!=s.kind&&(i||"loop"===s.kind))break;if(r.label&&i)break}}return a===x.length&&C(r.start,"Unsyntactic "+e.keyword),dt(r,i?"BreakStatement":"ContinueStatement");case B:return st(),gt(),dt(r,"DebuggerStatement");case V:return st(),x.push(_t),r.body=xt(),x.pop(),vt(K),r.test=kt(),gt(),dt(r,"DoWhileStatement");case j:if(st(),x.push(_t),vt(ce),d===he)return Ct(r,null);if(d===$){var o=ut();return st(),Et(o,!0),dt(o,"VariableDeclaration"),1===o.declarations.length&&pt(ne)?Mt(r,o):Ct(r,o)}return o=Tt(!1,!0),pt(ne)?(bt(o),Mt(r,o)):Ct(r,o);case q:return st(),Lt(r,!0);case H:return st(),r.test=kt(),r.consequent=xt(),r.alternate=pt(F)?xt():null,dt(r,"IfStatement");case U:return w||t.allowReturnOutsideFunction||C(c,"'return' outside of function"),st(),pt(he)||mt()?r.argument=null:(r.argument=Tt(),gt()),dt(r,"ReturnStatement");case G:st(),r.discriminant=kt(),r.cases=[],vt(se),x.push(wt);for(var l,u;d!=oe;)if(d===D||d===R){var h=d===D;l&&dt(l,"SwitchCase"),r.cases.push(l=ut()),l.consequent=[],st(),h?l.test=Tt():(u&&C(v,"Multiple default clauses"),u=!0,l.test=null),vt(de)}else l||yt(),l.consequent.push(xt());return l&&dt(l,"SwitchCase"),st(),x.pop(),dt(r,"SwitchStatement");case W:return st(),qe.test(n.slice(y,c))&&C(y,"Illegal newline after throw"),r.argument=Tt(),gt(),dt(r,"ThrowStatement");case Y:if(st(),r.block=St(),r.handler=null,d===O){var p=ut();st(),vt(ce),p.param=Rt(),k&&Be(p.param.name)&&C(p.param.start,"Binding "+p.param.name+" in strict mode"),vt(le),p.guard=null,p.body=St(),r.handler=dt(p,"CatchClause")}return r.guardedHandlers=M,r.finalizer=pt(z)?St():null,r.handler||r.finalizer||C(r.start,"Missing catch or finally clause"),dt(r,"TryStatement");case $:return st(),Et(r),gt(),dt(r,"VariableDeclaration");case K:return st(),r.test=kt(),x.push(_t),r.body=xt(),x.pop(),dt(r,"WhileStatement");case Q:return k&&C(c,"'with' in strict mode"),st(),r.object=kt(),r.body=xt(),dt(r,"WithStatement");case se:return St();case he:return st(),dt(r,"EmptyStatement");default:var m=f,g=Tt();if(e===P&&"Identifier"===g.type&&pt(de)){for(a=0;a<x.length;++a)x[a].name===m&&C(g.start,"Label '"+m+"' is already declared");var b=d.isLoop?"loop":d===G?"switch":null;return x.push({name:m,kind:b}),r.body=xt(),x.pop(),r.label=g,dt(r,"LabeledStatement")}return r.expression=g,gt(),dt(r,"ExpressionStatement")}}function kt(){vt(ce);var e=Tt();return vt(le),e}function St(e){var t,n=ut(),r=!0,i=!1;for(n.body=[],vt(se);!pt(oe);){var a=xt();n.body.push(a),r&&e&&ft(a)&&(t=i,ot(i=!0)),r=!1}return i&&!t&&ot(!1),dt(n,"BlockStatement")}function Ct(e,t){return e.init=t,vt(he),e.test=d===he?null:Tt(),vt(he),e.update=d===le?null:Tt(),vt(le),e.body=xt(),x.pop(),dt(e,"ForStatement")}function Mt(e,t){return e.left=t,e.right=Tt(),vt(le),e.body=xt(),x.pop(),dt(e,"ForInStatement")}function Et(e,t){for(e.declarations=[],e.kind="var";;){var n=ut();if(n.id=Rt(),k&&Be(n.id.name)&&C(n.id.start,"Binding "+n.id.name+" in strict mode"),n.init=pt(ge)?Tt(!0,t):null,e.declarations.push(dt(n,"VariableDeclarator")),!pt(ue))break}return e}function Tt(e,t){var n=At(t);if(!e&&d===ue){var r=ht(n);for(r.expressions=[n];pt(ue);)r.expressions.push(At(t));return dt(r,"SequenceExpression")}return n}function At(e){var t=function(e){var t,n=(t=e,Pt(It(),-1,t));if(pt(pe)){var r=ht(n);return r.test=n,r.consequent=Tt(!0),vt(de),r.alternate=Tt(!0,e),dt(r,"ConditionalExpression")}return n}(e);if(d.isAssign){var n=ht(t);return n.operator=f,n.left=t,st(),n.right=At(e),bt(t),dt(n,"AssignmentExpression")}return t}function Pt(e,t,n){var r=d.binop;if(null!=r&&(!n||d!==ne)&&r>t){var i=ht(e);i.left=e,i.operator=f;var a=d;return st(),i.right=Pt(It(),r,n),Pt(dt(i,a===_e||a===we?"LogicalExpression":"BinaryExpression"),t,n)}return e}function It(){if(d.prefix){var e=ut(),t=d.isUpdate;return e.operator=f,e.prefix=!0,p=!0,st(),e.argument=It(),t?bt(e.argument):k&&"delete"===e.operator&&"Identifier"===e.argument.type&&C(e.start,"Deleting local variable in strict mode"),dt(e,t?"UpdateExpression":"UnaryExpression")}for(var n=Nt(Dt());d.postfix&&!mt();)(e=ht(n)).operator=f,e.prefix=!1,e.argument=n,bt(n),st(),n=dt(e,"UpdateExpression");return n}function Nt(e,t){var n;return pt(fe)?((n=ht(e)).object=e,n.property=Rt(!0),n.computed=!1,Nt(dt(n,"MemberExpression"),t)):pt(ie)?((n=ht(e)).object=e,n.property=Tt(),n.computed=!0,vt(ae),Nt(dt(n,"MemberExpression"),t)):!t&&pt(ce)?((n=ht(e)).callee=e,n.arguments=Bt(le,!1),Nt(dt(n,"CallExpression"),t)):e}function Dt(){switch(d){case Z:var e=ut();return st(),dt(e,"ThisExpression");case P:return Rt();case E:case A:case T:return(e=ut()).value=f,e.raw=n.slice(c,l),st(),dt(e,"Literal");case J:case ee:case te:return(e=ut()).value=d.atomValue,e.raw=d.keyword,st(),dt(e,"Literal");case ce:var r=u,i=c;st();var a=Tt();return a.start=i,a.end=l,t.locations&&(a.loc.start=r,a.loc.end=h),t.ranges&&(a.range=[i,l]),vt(le),a;case ie:return e=ut(),st(),e.elements=Bt(ae,!0,!0),dt(e,"ArrayExpression");case se:return function(){var e=ut(),n=!0,r=!1;for(e.properties=[],st();!pt(oe);){if(n)n=!1;else if(vt(ue),t.allowTrailingCommas&&pt(oe))break;var i,a={key:Ot()},s=!1;if(pt(de)?(a.value=Tt(!0),i=a.kind="init"):t.ecmaVersion>=5&&"Identifier"===a.key.type&&("get"===a.key.name||"set"===a.key.name)?(s=r=!0,i=a.kind=a.key.name,a.key=Ot(),d!==ce&&yt(),a.value=Lt(ut(),!1)):yt(),"Identifier"===a.key.type&&(k||r))for(var o=0;o<e.properties.length;++o){var c=e.properties[o];if(c.key.name===a.key.name){var l=i==c.kind||s&&"init"===c.kind||"init"===i&&("get"===c.kind||"set"===c.kind);l&&!k&&"init"===i&&"init"===c.kind&&(l=!1),l&&C(a.key.start,"Redefinition of property")}}e.properties.push(a)}return dt(e,"ObjectExpression")}();case q:return e=ut(),st(),Lt(e,!1);case X:return s=ut(),st(),s.callee=Nt(Dt(),!0),pt(ce)?s.arguments=Bt(le,!1):s.arguments=M,dt(s,"NewExpression");default:yt()}var s}function Ot(){return d===E||d===A?Dt():Rt(!0)}function Lt(e,t){d===P?e.id=Rt():t?yt():e.id=null,e.params=[];var n=!0;for(vt(ce);!pt(le);)n?n=!1:vt(ue),e.params.push(Rt());var r=w,i=x;if(w=!0,x=[],e.body=St(!0),w=r,x=i,k||e.body.body.length&&ft(e.body.body[0]))for(var a=e.id?-1:0;a<e.params.length;++a){var s=a<0?e.id:e.params[a];if((Le(s.name)||Be(s.name))&&C(s.start,"Defining '"+s.name+"' in strict mode"),a>=0)for(var o=0;o<a;++o)s.name===e.params[o].name&&C(s.start,"Argument name clash in strict mode")}return dt(e,t?"FunctionDeclaration":"FunctionExpression")}function Bt(e,n,r){for(var i=[],a=!0;!pt(e);){if(a)a=!1;else if(vt(ue),n&&t.allowTrailingCommas&&pt(e))break;r&&d===ue?i.push(null):i.push(Tt(!0))}return i}function Rt(e){var r=ut();return e&&"everywhere"==t.forbidReserved&&(e=!1),d===P?(!e&&(t.forbidReserved&&(3===t.ecmaVersion?De:Oe)(f)||k&&Le(f))&&-1==n.slice(c,l).indexOf("\\")&&C(c,"The keyword '"+f+"' is reserved"),r.name=f):e&&d.keyword?r.name=d.keyword:yt(),p=!1,st(),dt(r,"Identifier")}}(t),o.version||(o=null));var l={"+":"__add","-":"__subtract","*":"__multiply","/":"__divide","%":"__modulo","==":"__equals","!=":"__equals"},u={"-":"__negate","+":"__self"},h=i.each(["add","subtract","multiply","divide","modulo","equals","negate"],(function(e){this["__"+e]="#"+e}),{__self:function(){return this}});function f(e,t,n){var r=l[t];if(e&&e[r]){var i=e[r](n);return"!="===t?!i:i}switch(t){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n;case"%":return e%n;case"==":return e==n;case"!=":return e!=n}}function m(e,t){var n=u[e];if(t&&t[n])return t[n]();switch(e){case"+":return+t;case"-":return-t}}function g(t,i){if(!t)return"";var a=[];function s(e){for(var t=0,n=a.length;t<n;t++){var r=a[t];if(r[0]>=e)break;e+=r[1]}return e}function o(e){return t.substring(s(e.range[0]),s(e.range[1]))}function h(e,n){for(var r=s(e.range[0]),i=s(e.range[1]),o=0,c=a.length-1;c>=0;c--)if(r>a[c][0]){o=c+1;break}a.splice(o,0,[r,n.length-i+r]),t=t.substring(0,r)+n+t.substring(i)}var d,f=(i=i||{}).url||"",p=i.sourceMaps,m=i.paperFeatures||{},g=i.source||t,v=i.offset||0,y=se.agent,b=y.versionNumber,_=!1,w=/\r\n|\n|\r/gm;if(p&&(y.chrome&&b>=30||y.webkit&&b>=537.76||y.firefox&&b>=23||y.node)){if(y.node)v-=2;else if(n&&f&&!n.location.href.indexOf(f)){var x=r.getElementsByTagName("html")[0].innerHTML;v=x.substr(0,x.indexOf(t)+1).match(w).length+1}var k=["AA"+function(e){var t="";for(e=(Math.abs(e)<<1)+(e<0?1:0);e||!t;){var n=31&e;(e>>=5)&&(n|=32),t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[n]}return t}((_=v>0&&!(y.chrome&&b>=36||y.safari&&b>=600||y.firefox&&b>=40||y.node))?0:v)+"A"];k.length=(t.match(w)||[]).length+1+(_?v:0),d={version:3,file:f,names:[],mappings:k.join(";AACA"),sourceRoot:"",sources:[f],sourcesContent:[g]}}return!1===m.operatorOverloading&&!1===m.moduleExports||function e(n,r,i){if(n){for(var a in n)if("range"!==a&&"loc"!==a){var c=n[a];if(Array.isArray(c))for(var d=0,f=c.length;d<f;d++)e(c[d],n,i);else c&&"object"==typeof c&&e(c,n,i)}!1!==i.operatorOverloading&&function(e,n){switch(e.type){case"UnaryExpression":if(e.operator in u&&"Literal"!==e.argument.type){var r=o(e.argument);h(e,'$__("'+e.operator+'", '+r+")")}break;case"BinaryExpression":if(e.operator in l&&"Literal"!==e.left.type){var i=o(e.left),a=o(e.right),c=(g=e.left,v=e.right,t.substring(s(g.range[1]),s(v.range[0]))),d=e.operator;h(e,"__$__("+i+","+c.replace(new RegExp("\\"+d),'"'+d+'"')+", "+a+")")}break;case"UpdateExpression":case"AssignmentExpression":var f=n&&n.type;if(!("ForStatement"===f||"BinaryExpression"===f&&/^[=!<>]/.test(n.operator)||"MemberExpression"===f&&n.computed))if("UpdateExpression"===e.type){var p=(r=o(e.argument))+" = "+(m="__$__("+r+', "'+e.operator[0]+'", 1)');e.prefix?p="("+p+")":"AssignmentExpression"!==f&&"VariableDeclarator"!==f&&"BinaryExpression"!==f||(o(n.left||n.id)===r&&(p=m),p=r+"; "+p),h(e,p)}else if(/^.=$/.test(e.operator)&&"Literal"!==e.left.type){i=o(e.left),a=o(e.right);var m=i+" = __$__("+i+', "'+e.operator[0]+'", '+a+")";h(e,/^\(.*\)$/.test(o(e))?"("+m+")":m)}}var g,v}(n,r),!1!==i.moduleExports&&function(e){switch(e.type){case"ExportDefaultDeclaration":h({range:[e.start,e.declaration.start]},"module.exports = ");break;case"ExportNamedDeclaration":var t=e.declaration,n=e.specifiers;if(t){var r=t.declarations;r&&(r.forEach((function(e){h(e,"module.exports."+o(e))})),h({range:[e.start,t.start+t.kind.length]},""))}else if(n){var i=n.map((function(e){var t=o(e);return"module.exports."+t+" = "+t+"; "})).join("");i&&h(e,i)}}}(n)}}(c(t,{ranges:!0,preserveParens:!0,sourceType:"module"}),null,m),d&&(_&&(t=new Array(v+1).join("\n")+t),/^(inline|both)$/.test(p)&&(t+="\n//# sourceMappingURL=data:application/json;base64,"+e.btoa(unescape(encodeURIComponent(JSON.stringify(d))))),t+="\n//# sourceURL="+(f||"paperscript")),{url:f,source:g,code:t,map:d}}function v(e,t,n){se=t;var a,s=t.getView(),o=/\btool\.\w+|\s+on(?:Key|Mouse)(?:Up|Down|Move|Drag)\b/.test(e)&&!/\bnew\s+Tool\b/.test(e)?new J:null,c=o?o._events:[],l=["onFrame","onResize"].concat(c),u=[],h=[],p="object"==typeof e?e:g(e,n);function v(t,n){for(var r in t)!n&&/^_/.test(r)||!new RegExp("([\\b\\s\\W]|^)"+r.replace(/\$/g,"\\$")+"\\b").test(e)||(u.push(r),h.push(t[r]))}e=p.code,v({__$__:f,$__:m,paper:t,tool:o},!0),v(t),e="var module = { exports: {} }; "+e,(w=i.each(l,(function(t){new RegExp("\\s+"+t+"\\b").test(e)&&(u.push(t),this.push("module.exports."+t+" = "+t+";"))}),[]).join("\n"))&&(e+="\n"+w),e+="\nreturn module.exports;";var y=se.agent;if(r&&(y.chrome||y.firefox&&y.versionNumber<40)){var b=r.createElement("script"),_=r.head||r.getElementsByTagName("head")[0];y.firefox&&(e="\n"+e),b.appendChild(r.createTextNode("document.__paperscript__ = function("+u+") {"+e+"\n}")),_.appendChild(b),a=r.__paperscript__,delete r.__paperscript__,_.removeChild(b)}else a=Function(u,e);var w,x=(w=a&&a.apply(t,h))||{};return i.each(c,(function(e){var t=x[e];t&&(o[e]=t)})),s&&(x.onResize&&s.setOnResize(x.onResize),s.emit("resize",{size:s.size,delta:new d}),x.onFrame&&s.setOnFrame(x.onFrame),s.requestUpdate()),w}function y(e){if(/^text\/(?:x-|)paperscript$/.test(e.type)&&"true"!==s.getAttribute(e,"ignore")){var t=s.getAttribute(e,"canvas"),n=r.getElementById(t),i=e.src||e.getAttribute("data-src"),a=s.hasAttribute(e,"async"),o="data-paper-scope";if(!n)throw new Error('Unable to find canvas with id "'+t+'"');var c=s.get(n.getAttribute(o))||(new s).setup(n);return n.setAttribute(o,c._id),i?te({url:i,async:a,mimeType:"text/plain",onLoad:function(e){v(e,c,i)}}):v(e.innerHTML,c,e.baseURI),e.setAttribute("data-paper-ignore","true"),c}}function b(){i.each(r&&r.getElementsByTagName("script"),y)}return d.inject(h),p.inject(h),z.inject(h),n&&("complete"===r.readyState?setTimeout(b):G.add(n,{load:b})),{compile:g,execute:v,load:function(e){return e?y(e):b()},parse:c,calculateBinary:f,calculateUnary:m}}.call(this);var se=new(s.inject(i.exports,{Base:i,Numerical:u,Key:Q,DomEvent:G,DomElement:U,document:r,window:n,Symbol:E,PlacedSymbol:M}));return se.agent.node&&Zc(se),"function"==typeof t&&t.amd?t("paper",se):tl&&(tl.exports=se),se}.call(Xc.exports,"object"==typeof self?self:null)),Xc.exports)),al=n({name:"CalculateSupplementaryAngle",components:{UserInputNumber:j},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"CalculateSupplementaryAngle"),r=B(n),i=a(""),s=a(null),o=a();r.question.value=new dl(e.data);const l=(e,t,n,r,i,a,s=30)=>new e.Point(t/2+s*Oi(n+(r+i)/2),a/2+s*Li(n+(r+i)/2));return c((async()=>{if(await h(),!s.value)return;o.value=new il.PaperScope,o.value.setup(s.value);const e=o.value,t=s.value.width,n=s.value.height,i=Di(0,360),a=t*Oi(i),c=t*Li(i);new e.Path.Line({from:new e.Point(t/2+a,n/2+c),to:new e.Point(t/2-a,n/2-c)}).strokeColor=new il.Color("black");let u=0;const d=[];if(r.question.value)for(let s=0;s<r.question.value.angles.length;s++){const a=r.question.value.angles[s];let o;u+=a,console.log(`drawing angle ${s}:\n angle: ${a}\n angleSum: ${u}\n `);const c=u-a;o=s===r.question.value.angles.length-1?180:u;const h=new e.Point(t/2+30*Oi(i+c),n/2+30*Li(i+c)),f=l(e,t,i,c,o,n),p=new e.Point(t/2+30*Oi(i+o),n/2+30*Li(i+o)),m=t*Oi(i+u),g=t*Li(i+u),v=new e.Path.Line({from:new e.Point(t/2,n/2),to:new e.Point(t/2+m,n/2+g)});if(v.strokeColor=new il.Color(0,0,0),d.push(v),r.question.value.targetAngleIndex===s){console.log(`drawing targetAngle at i = ${s}:\n baseAngle: ${i}\n targetAngle: ${a}\n sum: ${u}\n nextAngle: ${o}\n `);const r=new il.Color(.1,.5,.8,.35),c=new e.Path.Arc({from:h,through:f,to:p});c.strokeColor=new il.Color(.1,.5,.8,.75),c.strokeWidth=3,c.fillColor=r;const l=new e.Path;l.closed=!0,l.add(h),l.add(new il.Point(t/2,n/2)),l.add(p),l.fillColor=r}else{const r=new il.PointText(f);r.content=a.toString()+"°";let s=!0,u=20;for(;s;)s=!1,r.bounds.center=l(e,t,i,c,o,n,u),d.forEach((e=>{e.intersects(r)&&(s=!0)})),u+=7}}})),d((()=>{o.value=void 0})),{answer:i,canvasRef:s,...n,...r}}}),sl={"data-viewable":"CalculateSupplementaryAngle"},ol={ref:"canvasRef",width:"300",height:"300"},cl=/* @__PURE__ */Vi(al,[["render",function(e,t,n,r,i,a){const s=w("user-input-number");return p(),f("div",sl,[t[1]||(t[1]=m("h2",null,"What is the measurement of the highlighted angle?",-1)),m("canvas",ol,null,512),t[2]||(t[2]=m("br",null,null,-1)),x(s,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,["modelValue"])])}],["__scopeId","data-v-4f8ac466"]]),ll={instructions:"Must be 2 or 3.",test:e=>"2"===e||"3"===e?{status:Z.ok,msg:""}:{status:Z.error,msg:"Must be 2 or 3."}},ul=[{name:"AngleCount",type:Q.INT,validator:ll}],hl=class _SupplementaryAngles extends R{constructor(e){super(e),t(this,"angles",[]),t(this,"targetAngleIndex"),t(this,"angleCount"),this.angleCount=e[0].AngleCount;let n=0;for(let t=0;t<=this.angleCount-2;t++){const e=Di(25,155-n);this.angles.push(e),n+=e}this.angles.push(180-n),this.targetAngleIndex=Di(0,this.angleCount-1)}isCorrect(e){return this.angles[this.targetAngleIndex]===e}dataShapes(){return _SupplementaryAngles.dataShapes}views(){return _SupplementaryAngles.views}};t(hl,"dataShapes",[{name:X.MATH_SupplimentaryAngles,fields:ul}]),t(hl,"views",[cl]);let dl=hl;const fl=n({name:"VerbalAddition",props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"VerbalAddition"),r=B(n),i=a(["","","","",""]);r.question.value=new xl(e.data);const s=o((()=>r.question.value?r.question.value:new xl(e.data)));return c((()=>{console.log("focusing..."),document.getElementById("input0")?.focus()})),{...n,...r,answer:i,question:s,track:e=>{console.log(`change in ${e}!\n userAnswer: ${i.value.toString()}\n\n qAnswer: ${s.value?.answer.toString()}`),s.value&&s.value.answer[e].toString().length===i.value[e].length&&(parseInt(i.value[e])===s.value.answer[e]?(document.getElementById("input"+e)?.classList.add("correct"),document.getElementById("input"+e)?.classList.remove("incorrect"),document.getElementById("input"+e)?.setAttribute("disabled","true"),e+1<i.value.length?document.getElementById("input"+(e+1))?.focus():r.submitAnswer(i.value)):(document.getElementById("input"+e)?.classList.add("incorrect"),r.submitAnswer(i.value),console.log(`Wrong! ${i.value[e]} !== ${s.value.answer[e]}`)))}}}}),pl={"data-viewable":"VerbalAddition",class:"text-h5"},ml={class:"text-h5"},gl=["value"],vl=["id","onUpdate:modelValue","autofocus","onKeyup"],yl={key:0},bl=/* @__PURE__ */Vi(fl,[["render",function(e,t,n,r,i,a){return p(),f("div",pl,[m("div",ml,[t[0]||(t[0]=k(" Count by ")),m("strong",null,y(e.question?.n),1),t[1]||(t[1]=k("s: "))]),m("input",{type:"text",disabled:"",class:"correct",value:e.question.answer[0]-e.question.n},null,8,gl),t[2]||(t[2]=k(", ")),(p(!0),f(b,null,_(e.question.answer,((t,n)=>(p(),f("span",{key:n},[S(m("input",{id:`input${n}`,ref_for:!0,ref:`input${n}`,class:C(`input${t}${n}`),"onUpdate:modelValue":t=>e.answer[n]=t,type:"text",autofocus:0===n,onKeyup:t=>e.track(n)},null,42,vl),[[M,e.answer[n]]]),n!==e.question.answer.length-1?(p(),f("span",yl,", ")):g("",!0)])))),128))])}],["__scopeId","data-v-0452c3a5"]]),_l=[{name:"n",type:Q.INT},{name:"hand",type:Q.STRING,validator:{test:e=>"LEFT"===e||"RIGHT"===e?{status:Z.ok,msg:""}:{status:Z.error,msg:"Hand must be LEFT or RIGHT"}}}],wl=class _CountBy extends R{constructor(e){super(e),t(this,"n"),t(this,"hand"),this.n=e[0].n,this.hand=e[0].hand}get answer(){const e=[],t="LEFT"===this.hand?this.n:6*this.n;for(let n=0;n<5;n++)e.push(t+n*this.n);return e}isCorrect(e){console.log(`Solution: ${this.answer.toString()}`);for(let n=0;n<this.answer.length;n++)if(("string"==typeof(t=e[n])?parseInt(t):t)!==this.answer[n])return console.log(`answer[${n}] == ${e[n]} !== ${this.answer[n]}`),!1;var t;return!0}dataShapes(){return _CountBy.dataShapes}views(){return _CountBy.views}};t(wl,"dataShapes",[{name:X.MATH_CountBy,fields:_l}]),t(wl,"views",[bl]),t(wl,"seedData",function(){const e=[];for(let t=2;t<=10;t++)e.push({n:t,hand:"LEFT"}),e.push({n:t,hand:"RIGHT"});return e}()),t(wl,"acceptsUserData",!1);let xl=wl;const kl=new CourseWare("math",[dc,xc,sc,Ec,zc,Kc,dl,xl]);var Sl,Cl={exports:{}},Ml=Cl.exports,El=(Sl||(Sl=1,function(e){!function(t){function n(){if(n.prototype._singleton)throw new Error("WebMidi is a singleton, it cannot be instantiated directly.");(n.prototype._singleton=this)._inputs=[],this._outputs=[],this._userHandlers={},this._stateChangeQueue=[],this._processingStateChange=!1,this._midiInterfaceEvents=["connected","disconnected"],this._nrpnBuffer=[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]],this._nrpnEventsEnabled=!0,this._nrpnTypes=["entry","increment","decrement"],this._notes=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],this._semitones={C:0,D:2,E:4,F:5,G:7,A:9,B:11},Object.defineProperties(this,{MIDI_SYSTEM_MESSAGES:{value:{sysex:240,timecode:241,songposition:242,songselect:243,tuningrequest:246,sysexend:247,clock:248,start:250,continue:251,stop:252,activesensing:254,reset:255,midimessage:0,unknownsystemmessage:-1},writable:!1,enumerable:!0,configurable:!1},MIDI_CHANNEL_MESSAGES:{value:{noteoff:8,noteon:9,keyaftertouch:10,controlchange:11,channelmode:11,nrpn:11,programchange:12,channelaftertouch:13,pitchbend:14},writable:!1,enumerable:!0,configurable:!1},MIDI_REGISTERED_PARAMETER:{value:{pitchbendrange:[0,0],channelfinetuning:[0,1],channelcoarsetuning:[0,2],tuningprogram:[0,3],tuningbank:[0,4],modulationrange:[0,5],azimuthangle:[61,0],elevationangle:[61,1],gain:[61,2],distanceratio:[61,3],maximumdistance:[61,4],maximumdistancegain:[61,5],referencedistanceratio:[61,6],panspreadangle:[61,7],rollangle:[61,8]},writable:!1,enumerable:!0,configurable:!1},MIDI_CONTROL_CHANGE_MESSAGES:{value:{bankselectcoarse:0,modulationwheelcoarse:1,breathcontrollercoarse:2,footcontrollercoarse:4,portamentotimecoarse:5,dataentrycoarse:6,volumecoarse:7,balancecoarse:8,pancoarse:10,expressioncoarse:11,effectcontrol1coarse:12,effectcontrol2coarse:13,generalpurposeslider1:16,generalpurposeslider2:17,generalpurposeslider3:18,generalpurposeslider4:19,bankselectfine:32,modulationwheelfine:33,breathcontrollerfine:34,footcontrollerfine:36,portamentotimefine:37,dataentryfine:38,volumefine:39,balancefine:40,panfine:42,expressionfine:43,effectcontrol1fine:44,effectcontrol2fine:45,holdpedal:64,portamento:65,sustenutopedal:66,softpedal:67,legatopedal:68,hold2pedal:69,soundvariation:70,resonance:71,soundreleasetime:72,soundattacktime:73,brightness:74,soundcontrol6:75,soundcontrol7:76,soundcontrol8:77,soundcontrol9:78,soundcontrol10:79,generalpurposebutton1:80,generalpurposebutton2:81,generalpurposebutton3:82,generalpurposebutton4:83,reverblevel:91,tremololevel:92,choruslevel:93,celestelevel:94,phaserlevel:95,databuttonincrement:96,databuttondecrement:97,nonregisteredparametercoarse:98,nonregisteredparameterfine:99,registeredparametercoarse:100,registeredparameterfine:101},writable:!1,enumerable:!0,configurable:!1},MIDI_NRPN_MESSAGES:{value:{entrymsb:6,entrylsb:38,increment:96,decrement:97,paramlsb:98,parammsb:99,nullactiveparameter:127},writable:!1,enumerable:!0,configurable:!1},MIDI_CHANNEL_MODE_MESSAGES:{value:{allsoundoff:120,resetallcontrollers:121,localcontrol:122,allnotesoff:123,omnimodeoff:124,omnimodeon:125,monomodeon:126,polymodeon:127},writable:!1,enumerable:!0,configurable:!1},octaveOffset:{value:0,writable:!0,enumerable:!0,configurable:!1}}),Object.defineProperties(this,{supported:{enumerable:!0,get:function(){return"requestMIDIAccess"in navigator}},enabled:{enumerable:!0,get:function(){return void 0!==this.interface}.bind(this)},inputs:{enumerable:!0,get:function(){return this._inputs}.bind(this)},outputs:{enumerable:!0,get:function(){return this._outputs}.bind(this)},sysexEnabled:{enumerable:!0,get:function(){return!(!this.interface||!this.interface.sysexEnabled)}.bind(this)},nrpnEventsEnabled:{enumerable:!0,get:function(){return!!this._nrpnEventsEnabled}.bind(this),set:function(e){return this._nrpnEventsEnabled=e,this._nrpnEventsEnabled}},nrpnTypes:{enumerable:!0,get:function(){return this._nrpnTypes}.bind(this)},time:{enumerable:!0,get:function(){return performance.now()}}})}var r=new n;function i(e){var t=this;this._userHandlers={channel:{},system:{}},this._midiInput=e,Object.defineProperties(this,{connection:{enumerable:!0,get:function(){return t._midiInput.connection}},id:{enumerable:!0,get:function(){return t._midiInput.id}},manufacturer:{enumerable:!0,get:function(){return t._midiInput.manufacturer}},name:{enumerable:!0,get:function(){return t._midiInput.name}},state:{enumerable:!0,get:function(){return t._midiInput.state}},type:{enumerable:!0,get:function(){return t._midiInput.type}}}),this._initializeUserHandlers(),this._midiInput.onmidimessage=this._onMidiMessage.bind(this)}function a(e){var t=this;this._midiOutput=e,Object.defineProperties(this,{connection:{enumerable:!0,get:function(){return t._midiOutput.connection}},id:{enumerable:!0,get:function(){return t._midiOutput.id}},manufacturer:{enumerable:!0,get:function(){return t._midiOutput.manufacturer}},name:{enumerable:!0,get:function(){return t._midiOutput.name}},state:{enumerable:!0,get:function(){return t._midiOutput.state}},type:{enumerable:!0,get:function(){return t._midiOutput.type}}})}n.prototype.enable=function(e,t){this.enabled||(this.supported?navigator.requestMIDIAccess({sysex:t}).then(function(t){var n,r=[],i=[];this.interface=t,this._resetInterfaceUserHandlers(),this.interface.onstatechange=function(e){r.push(e)};for(var a=t.inputs.values(),s=a.next();s&&!s.done;s=a.next())i.push(s.value.open());for(var o=t.outputs.values(),c=o.next();c&&!c.done;c=o.next())i.push(c.value.open());function l(){clearTimeout(n),this._updateInputsAndOutputs(),this.interface.onstatechange=this._onInterfaceStateChange.bind(this),"function"==typeof e&&e.call(this),r.forEach(function(e){this._onInterfaceStateChange(e)}.bind(this))}n=setTimeout(l.bind(this),200),Promise&&Promise.all(i).catch((function(e){})).then(l.bind(this))}.bind(this),function(t){"function"==typeof e&&e.call(this,t)}.bind(this)):"function"==typeof e&&e(new Error("The Web MIDI API is not supported by your browser.")))},n.prototype.disable=function(){if(!this.supported)throw new Error("The Web MIDI API is not supported by your browser.");this.enabled&&(this.removeListener(),this.inputs.forEach((function(e){e.removeListener()}))),this.interface&&(this.interface.onstatechange=void 0),this.interface=void 0,this._inputs=[],this._outputs=[],this._nrpnEventsEnabled=!0,this._resetInterfaceUserHandlers()},n.prototype.addListener=function(e,t){if(!this.enabled)throw new Error("WebMidi must be enabled before adding event listeners.");if("function"!=typeof t)throw new TypeError("The 'listener' parameter must be a function.");if(!(0<=this._midiInterfaceEvents.indexOf(e)))throw new TypeError("The specified event type is not supported.");return this._userHandlers[e].push(t),this},n.prototype.hasListener=function(e,t){if(!this.enabled)throw new Error("WebMidi must be enabled before checking event listeners.");if("function"!=typeof t)throw new TypeError("The 'listener' parameter must be a function.");if(!(0<=this._midiInterfaceEvents.indexOf(e)))throw new TypeError("The specified event type is not supported.");for(var n=0;n<this._userHandlers[e].length;n++)if(this._userHandlers[e][n]===t)return!0;return!1},n.prototype.removeListener=function(e,t){if(!this.enabled)throw new Error("WebMidi must be enabled before removing event listeners.");if(void 0!==t&&"function"!=typeof t)throw new TypeError("The 'listener' parameter must be a function.");if(0<=this._midiInterfaceEvents.indexOf(e))if(t)for(var n=0;n<this._userHandlers[e].length;n++)this._userHandlers[e][n]===t&&this._userHandlers[e].splice(n,1);else this._userHandlers[e]=[];else{if(void 0!==e)throw new TypeError("The specified event type is not supported.");this._resetInterfaceUserHandlers()}return this},n.prototype.toMIDIChannels=function(e){var t;if("all"===e||void 0===e)t=["all"];else{if("none"===e)return[];t=Array.isArray(e)?e:[e]}return-1<t.indexOf("all")&&(t=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),t.map((function(e){return parseInt(e)})).filter((function(e){return 1<=e&&e<=16}))},n.prototype.getInputById=function(e){if(!this.enabled)throw new Error("WebMidi is not enabled.");e=String(e);for(var t=0;t<this.inputs.length;t++)if(this.inputs[t].id===e)return this.inputs[t];return!1},n.prototype.getOutputById=function(e){if(!this.enabled)throw new Error("WebMidi is not enabled.");e=String(e);for(var t=0;t<this.outputs.length;t++)if(this.outputs[t].id===e)return this.outputs[t];return!1},n.prototype.getInputByName=function(e){if(!this.enabled)throw new Error("WebMidi is not enabled.");for(var t=0;t<this.inputs.length;t++)if(~this.inputs[t].name.indexOf(e))return this.inputs[t];return!1},n.prototype.getOctave=function(e){if(null!=e&&0<=e&&e<=127)return Math.floor(Math.floor(e)/12-1)+Math.floor(r.octaveOffset)},n.prototype.getOutputByName=function(e){if(!this.enabled)throw new Error("WebMidi is not enabled.");for(var t=0;t<this.outputs.length;t++)if(~this.outputs[t].name.indexOf(e))return this.outputs[t];return!1},n.prototype.guessNoteNumber=function(e){var t=!1;if(e&&e.toFixed&&0<=e&&e<=127?t=Math.round(e):0<=parseInt(e)&&parseInt(e)<=127?t=parseInt(e):("string"==typeof e||e instanceof String)&&(t=this.noteNameToNumber(e)),!1===t)throw new Error("Invalid input value ("+e+").");return t},n.prototype.noteNameToNumber=function(e){"string"!=typeof e&&(e="");var t=e.match(/([CDEFGAB])(#{0,2}|b{0,2})(-?\d+)/i);if(!t)throw new RangeError("Invalid note name.");var n=r._semitones[t[1].toUpperCase()],i=12*(parseInt(t[3])+1-Math.floor(r.octaveOffset))+n;if(-1<t[2].toLowerCase().indexOf("b")?i-=t[2].length:-1<t[2].toLowerCase().indexOf("#")&&(i+=t[2].length),i<0||127<i)throw new RangeError("Invalid note name or note outside valid range.");return i},n.prototype._updateInputsAndOutputs=function(){this._updateInputs(),this._updateOutputs()},n.prototype._updateInputs=function(){for(var e=0;e<this._inputs.length;e++){for(var t=!0,n=this.interface.inputs.values(),r=n.next();r&&!r.done;r=n.next())if(this._inputs[e]._midiInput===r.value){t=!1;break}t&&this._inputs.splice(e,1)}this.interface&&this.interface.inputs.forEach(function(e){for(var t=!0,n=0;n<this._inputs.length;n++)this._inputs[n]._midiInput===e&&(t=!1);t&&this._inputs.push(new i(e))}.bind(this))},n.prototype._updateOutputs=function(){for(var e=0;e<this._outputs.length;e++){for(var t=!0,n=this.interface.outputs.values(),r=n.next();r&&!r.done;r=n.next())if(this._outputs[e]._midiOutput===r.value){t=!1;break}t&&this._outputs.splice(e,1)}this.interface&&this.interface.outputs.forEach(function(e){for(var t=!0,n=0;n<this._outputs.length;n++)this._outputs[n]._midiOutput===e&&(t=!1);t&&this._outputs.push(new a(e))}.bind(this))},n.prototype._onInterfaceStateChange=function(e){this._updateInputsAndOutputs();var t={timestamp:e.timeStamp,type:e.port.state};this.interface&&"connected"===e.port.state?"output"===e.port.type?t.port=this.getOutputById(e.port.id):"input"===e.port.type&&(t.port=this.getInputById(e.port.id)):t.port={connection:"closed",id:e.port.id,manufacturer:e.port.manufacturer,name:e.port.name,state:e.port.state,type:e.port.type},this._userHandlers[e.port.state].forEach((function(e){e(t)}))},n.prototype._resetInterfaceUserHandlers=function(){for(var e=0;e<this._midiInterfaceEvents.length;e++)this._userHandlers[this._midiInterfaceEvents[e]]=[]},i.prototype.on=i.prototype.addListener=function(e,t,n){var i=this;if(void 0===t&&(t="all"),Array.isArray(t)||(t=[t]),t.forEach((function(e){if("all"!==e&&!(1<=e&&e<=16))throw new RangeError("The 'channel' parameter is invalid.")})),"function"!=typeof n)throw new TypeError("The 'listener' parameter must be a function.");if(void 0!==r.MIDI_SYSTEM_MESSAGES[e])this._userHandlers.system[e]||(this._userHandlers.system[e]=[]),this._userHandlers.system[e].push(n);else{if(void 0===r.MIDI_CHANNEL_MESSAGES[e])throw new TypeError("The specified event type is not supported.");if(-1<t.indexOf("all")){t=[];for(var a=1;a<=16;a++)t.push(a)}this._userHandlers.channel[e]||(this._userHandlers.channel[e]=[]),t.forEach((function(t){i._userHandlers.channel[e][t]||(i._userHandlers.channel[e][t]=[]),i._userHandlers.channel[e][t].push(n)}))}return this},i.prototype.hasListener=function(e,t,n){var i=this;if("function"!=typeof n)throw new TypeError("The 'listener' parameter must be a function.");if(void 0===t&&(t="all"),t.constructor!==Array&&(t=[t]),void 0!==r.MIDI_SYSTEM_MESSAGES[e]){for(var a=0;a<this._userHandlers.system[e].length;a++)if(this._userHandlers.system[e][a]===n)return!0}else if(void 0!==r.MIDI_CHANNEL_MESSAGES[e]){if(-1<t.indexOf("all")){t=[];for(var s=1;s<=16;s++)t.push(s)}return!!this._userHandlers.channel[e]&&t.every((function(t){var r=i._userHandlers.channel[e][t];return r&&-1<r.indexOf(n)}))}return!1},i.prototype.removeListener=function(e,t,n){var i=this;if(void 0!==n&&"function"!=typeof n)throw new TypeError("The 'listener' parameter must be a function.");if(void 0===t&&(t="all"),t.constructor!==Array&&(t=[t]),void 0!==r.MIDI_SYSTEM_MESSAGES[e])if(void 0===n)this._userHandlers.system[e]=[];else for(var a=0;a<this._userHandlers.system[e].length;a++)this._userHandlers.system[e][a]===n&&this._userHandlers.system[e].splice(a,1);else if(void 0!==r.MIDI_CHANNEL_MESSAGES[e]){if(-1<t.indexOf("all")){t=[];for(var s=1;s<=16;s++)t.push(s)}if(!this._userHandlers.channel[e])return this;t.forEach((function(t){var r=i._userHandlers.channel[e][t];if(r)if(void 0===n)i._userHandlers.channel[e][t]=[];else for(var a=0;a<r.length;a++)r[a]===n&&r.splice(a,1)}))}else{if(void 0!==e)throw new TypeError("The specified event type is not supported.");this._initializeUserHandlers()}return this},i.prototype._initializeUserHandlers=function(){for(var e in r.MIDI_CHANNEL_MESSAGES)Object.prototype.hasOwnProperty.call(r.MIDI_CHANNEL_MESSAGES,e)&&(this._userHandlers.channel[e]={});for(var t in r.MIDI_SYSTEM_MESSAGES)Object.prototype.hasOwnProperty.call(r.MIDI_SYSTEM_MESSAGES,t)&&(this._userHandlers.system[t]=[])},i.prototype._onMidiMessage=function(e){if(0<this._userHandlers.system.midimessage.length){var t={target:this,data:e.data,timestamp:e.timeStamp,type:"midimessage"};this._userHandlers.system.midimessage.forEach((function(e){e(t)}))}e.data[0]<240?(this._parseChannelEvent(e),this._parseNrpnEvent(e)):e.data[0]<=255&&this._parseSystemEvent(e)},i.prototype._parseNrpnEvent=function(e){var t,n,i=e.data[0]>>4,a=15&e.data[0],s=1+a;if(1<e.data.length&&(t=e.data[1],n=2<e.data.length?e.data[2]:void 0),r.nrpnEventsEnabled&&i===r.MIDI_CHANNEL_MESSAGES.controlchange&&(t>=r.MIDI_NRPN_MESSAGES.increment&&t<=r.MIDI_NRPN_MESSAGES.parammsb||t===r.MIDI_NRPN_MESSAGES.entrymsb||t===r.MIDI_NRPN_MESSAGES.entrylsb)){var o={target:this,type:"controlchange",data:e.data,timestamp:e.timeStamp,channel:s,controller:{number:t,name:this.getCcNameByNumber(t)},value:n};if(o.controller.number===r.MIDI_NRPN_MESSAGES.parammsb&&o.value!=r.MIDI_NRPN_MESSAGES.nullactiveparameter)r._nrpnBuffer[a]=[],r._nrpnBuffer[a][0]=o;else if(1===r._nrpnBuffer[a].length&&o.controller.number===r.MIDI_NRPN_MESSAGES.paramlsb)r._nrpnBuffer[a].push(o);else if(2!==r._nrpnBuffer[a].length||o.controller.number!==r.MIDI_NRPN_MESSAGES.increment&&o.controller.number!==r.MIDI_NRPN_MESSAGES.decrement&&o.controller.number!==r.MIDI_NRPN_MESSAGES.entrymsb)if(3===r._nrpnBuffer[a].length&&r._nrpnBuffer[a][2].number===r.MIDI_NRPN_MESSAGES.entrymsb&&o.controller.number===r.MIDI_NRPN_MESSAGES.entrylsb)r._nrpnBuffer[a].push(o);else if(3<=r._nrpnBuffer[a].length&&r._nrpnBuffer[a].length<=4&&o.controller.number===r.MIDI_NRPN_MESSAGES.parammsb&&o.value===r.MIDI_NRPN_MESSAGES.nullactiveparameter)r._nrpnBuffer[a].push(o);else if(4<=r._nrpnBuffer[a].length&&r._nrpnBuffer[a].length<=5&&o.controller.number===r.MIDI_NRPN_MESSAGES.paramlsb&&o.value===r.MIDI_NRPN_MESSAGES.nullactiveparameter){r._nrpnBuffer[a].push(o);var c=[];r._nrpnBuffer[a].forEach((function(e){c.push(e.data)}));var l=r._nrpnBuffer[a][0].value<<7|r._nrpnBuffer[a][1].value,u=r._nrpnBuffer[a][2].value;6===r._nrpnBuffer[a].length&&(u=r._nrpnBuffer[a][2].value<<7|r._nrpnBuffer[a][3].value);var h="";switch(r._nrpnBuffer[a][2].controller.number){case r.MIDI_NRPN_MESSAGES.entrymsb:h=r._nrpnTypes[0];break;case r.MIDI_NRPN_MESSAGES.increment:h=r._nrpnTypes[1];break;case r.MIDI_NRPN_MESSAGES.decrement:h=r._nrpnTypes[2];break;default:throw new Error("The NPRN type was unidentifiable.")}var d={timestamp:o.timestamp,channel:o.channel,type:"nrpn",data:c,controller:{number:l,type:h,name:"Non-Registered Parameter "+l},value:u};r._nrpnBuffer[a]=[],this._userHandlers.channel[d.type]&&this._userHandlers.channel[d.type][d.channel]&&this._userHandlers.channel[d.type][d.channel].forEach((function(e){e(d)}))}else r._nrpnBuffer[a]=[];else r._nrpnBuffer[a].push(o)}},i.prototype._parseChannelEvent=function(e){var t,n,i=e.data[0]>>4,a=1+(15&e.data[0]);1<e.data.length&&(t=e.data[1],n=2<e.data.length?e.data[2]:void 0);var s={target:this,data:e.data,timestamp:e.timeStamp,channel:a};i===r.MIDI_CHANNEL_MESSAGES.noteoff||i===r.MIDI_CHANNEL_MESSAGES.noteon&&0===n?(s.type="noteoff",s.note={number:t,name:r._notes[t%12],octave:r.getOctave(t)},s.velocity=n/127,s.rawVelocity=n):i===r.MIDI_CHANNEL_MESSAGES.noteon?(s.type="noteon",s.note={number:t,name:r._notes[t%12],octave:r.getOctave(t)},s.velocity=n/127,s.rawVelocity=n):i===r.MIDI_CHANNEL_MESSAGES.keyaftertouch?(s.type="keyaftertouch",s.note={number:t,name:r._notes[t%12],octave:r.getOctave(t)},s.value=n/127):i===r.MIDI_CHANNEL_MESSAGES.controlchange&&0<=t&&t<=119?(s.type="controlchange",s.controller={number:t,name:this.getCcNameByNumber(t)},s.value=n):i===r.MIDI_CHANNEL_MESSAGES.channelmode&&120<=t&&t<=127?(s.type="channelmode",s.controller={number:t,name:this.getChannelModeByNumber(t)},s.value=n):i===r.MIDI_CHANNEL_MESSAGES.programchange?(s.type="programchange",s.value=t):i===r.MIDI_CHANNEL_MESSAGES.channelaftertouch?(s.type="channelaftertouch",s.value=t/127):i===r.MIDI_CHANNEL_MESSAGES.pitchbend?(s.type="pitchbend",s.value=((n<<7)+t-8192)/8192):s.type="unknownchannelmessage",this._userHandlers.channel[s.type]&&this._userHandlers.channel[s.type][a]&&this._userHandlers.channel[s.type][a].forEach((function(e){e(s)}))},i.prototype.getCcNameByNumber=function(e){if(!(0<=(e=Math.floor(e))&&e<=119))throw new RangeError("The control change number must be between 0 and 119.");for(var t in r.MIDI_CONTROL_CHANGE_MESSAGES)if(Object.prototype.hasOwnProperty.call(r.MIDI_CONTROL_CHANGE_MESSAGES,t)&&e===r.MIDI_CONTROL_CHANGE_MESSAGES[t])return t},i.prototype.getChannelModeByNumber=function(e){if(!(120<=(e=Math.floor(e))&&status<=127))throw new RangeError("The control change number must be between 120 and 127.");for(var t in r.MIDI_CHANNEL_MODE_MESSAGES)if(Object.prototype.hasOwnProperty.call(r.MIDI_CHANNEL_MODE_MESSAGES,t)&&e===r.MIDI_CHANNEL_MODE_MESSAGES[t])return t},i.prototype._parseSystemEvent=function(e){var t=e.data[0],n={target:this,data:e.data,timestamp:e.timeStamp};t===r.MIDI_SYSTEM_MESSAGES.sysex?n.type="sysex":t===r.MIDI_SYSTEM_MESSAGES.timecode?n.type="timecode":t===r.MIDI_SYSTEM_MESSAGES.songposition?n.type="songposition":t===r.MIDI_SYSTEM_MESSAGES.songselect?(n.type="songselect",n.song=e.data[1]):t===r.MIDI_SYSTEM_MESSAGES.tuningrequest?n.type="tuningrequest":t===r.MIDI_SYSTEM_MESSAGES.clock?n.type="clock":t===r.MIDI_SYSTEM_MESSAGES.start?n.type="start":t===r.MIDI_SYSTEM_MESSAGES.continue?n.type="continue":t===r.MIDI_SYSTEM_MESSAGES.stop?n.type="stop":t===r.MIDI_SYSTEM_MESSAGES.activesensing?n.type="activesensing":t===r.MIDI_SYSTEM_MESSAGES.reset?n.type="reset":n.type="unknownsystemmessage",this._userHandlers.system[n.type]&&this._userHandlers.system[n.type].forEach((function(e){e(n)}))},a.prototype.send=function(e,t,n){if(!(128<=e&&e<=255))throw new RangeError("The status byte must be an integer between 128 (0x80) and 255 (0xFF).");void 0===t&&(t=[]),Array.isArray(t)||(t=[t]);var r=[];return t.forEach((function(e){var t=Math.floor(e);if(!(0<=t&&t<=255))throw new RangeError("Data bytes must be integers between 0 (0x00) and 255 (0xFF).");r.push(t)})),this._midiOutput.send([e].concat(r),parseFloat(n)||0),this},a.prototype.sendSysex=function(e,t,n){if(!r.sysexEnabled)throw new Error("Sysex message support must first be activated.");return n=n||{},e=[].concat(e),t.forEach((function(e){if(e<0||127<e)throw new RangeError("The data bytes of a sysex message must be integers between 0 (0x00) and 127 (0x7F).")})),t=e.concat(t,r.MIDI_SYSTEM_MESSAGES.sysexend),this.send(r.MIDI_SYSTEM_MESSAGES.sysex,t,this._parseTimeParameter(n.time)),this},a.prototype.sendTimecodeQuarterFrame=function(e,t){return t=t||{},this.send(r.MIDI_SYSTEM_MESSAGES.timecode,e,this._parseTimeParameter(t.time)),this},a.prototype.sendSongPosition=function(e,t){t=t||{};var n=(e=Math.floor(e)||0)>>7&127,i=127&e;return this.send(r.MIDI_SYSTEM_MESSAGES.songposition,[n,i],this._parseTimeParameter(t.time)),this},a.prototype.sendSongSelect=function(e,t){if(t=t||{},!(0<=(e=Math.floor(e))&&e<=127))throw new RangeError("The song number must be between 0 and 127.");return this.send(r.MIDI_SYSTEM_MESSAGES.songselect,[e],this._parseTimeParameter(t.time)),this},a.prototype.sendTuningRequest=function(e){return e=e||{},this.send(r.MIDI_SYSTEM_MESSAGES.tuningrequest,void 0,this._parseTimeParameter(e.time)),this},a.prototype.sendClock=function(e){return e=e||{},this.send(r.MIDI_SYSTEM_MESSAGES.clock,void 0,this._parseTimeParameter(e.time)),this},a.prototype.sendStart=function(e){return e=e||{},this.send(r.MIDI_SYSTEM_MESSAGES.start,void 0,this._parseTimeParameter(e.time)),this},a.prototype.sendContinue=function(e){return e=e||{},this.send(r.MIDI_SYSTEM_MESSAGES.continue,void 0,this._parseTimeParameter(e.time)),this},a.prototype.sendStop=function(e){return e=e||{},this.send(r.MIDI_SYSTEM_MESSAGES.stop,void 0,this._parseTimeParameter(e.time)),this},a.prototype.sendActiveSensing=function(e){return e=e||{},this.send(r.MIDI_SYSTEM_MESSAGES.activesensing,[],this._parseTimeParameter(e.time)),this},a.prototype.sendReset=function(e){return e=e||{},this.send(r.MIDI_SYSTEM_MESSAGES.reset,void 0,this._parseTimeParameter(e.time)),this},a.prototype.stopNote=function(e,t,n){if("all"===e)return this.sendChannelMode("allnotesoff",0,t,n);var i=64;return(n=n||{}).rawVelocity?!isNaN(n.velocity)&&0<=n.velocity&&n.velocity<=127&&(i=n.velocity):!isNaN(n.velocity)&&0<=n.velocity&&n.velocity<=1&&(i=127*n.velocity),this._convertNoteToArray(e).forEach(function(e){r.toMIDIChannels(t).forEach(function(t){this.send((r.MIDI_CHANNEL_MESSAGES.noteoff<<4)+(t-1),[e,Math.round(i)],this._parseTimeParameter(n.time))}.bind(this))}.bind(this)),this},a.prototype.playNote=function(e,t,n){var i,a=64;if((n=n||{}).rawVelocity?!isNaN(n.velocity)&&0<=n.velocity&&n.velocity<=127&&(a=n.velocity):!isNaN(n.velocity)&&0<=n.velocity&&n.velocity<=1&&(a=127*n.velocity),i=this._parseTimeParameter(n.time),this._convertNoteToArray(e).forEach(function(e){r.toMIDIChannels(t).forEach(function(t){this.send((r.MIDI_CHANNEL_MESSAGES.noteon<<4)+(t-1),[e,Math.round(a)],i)}.bind(this))}.bind(this)),!isNaN(n.duration)){n.duration<=0&&(n.duration=0);var s=64;n.rawVelocity?!isNaN(n.release)&&0<=n.release&&n.release<=127&&(s=n.release):!isNaN(n.release)&&0<=n.release&&n.release<=1&&(s=127*n.release),this._convertNoteToArray(e).forEach(function(e){r.toMIDIChannels(t).forEach(function(t){this.send((r.MIDI_CHANNEL_MESSAGES.noteoff<<4)+(t-1),[e,Math.round(s)],(i||r.time)+n.duration)}.bind(this))}.bind(this))}return this},a.prototype.sendKeyAftertouch=function(e,t,n,i){var a=this;if(i=i||{},t<1||16<t)throw new RangeError("The channel must be between 1 and 16.");(isNaN(n)||n<0||1<n)&&(n=.5);var s=Math.round(127*n);return this._convertNoteToArray(e).forEach((function(e){r.toMIDIChannels(t).forEach((function(t){a.send((r.MIDI_CHANNEL_MESSAGES.keyaftertouch<<4)+(t-1),[e,s],a._parseTimeParameter(i.time))}))})),this},a.prototype.sendControlChange=function(e,t,n,i){if(i=i||{},"string"==typeof e){if(void 0===(e=r.MIDI_CONTROL_CHANGE_MESSAGES[e]))throw new TypeError("Invalid controller name.")}else if(!(0<=(e=Math.floor(e))&&e<=119))throw new RangeError("Controller numbers must be between 0 and 119.");if(!(0<=(t=Math.floor(t)||0)&&t<=127))throw new RangeError("Controller value must be between 0 and 127.");return r.toMIDIChannels(n).forEach(function(n){this.send((r.MIDI_CHANNEL_MESSAGES.controlchange<<4)+(n-1),[e,t],this._parseTimeParameter(i.time))}.bind(this)),this},a.prototype._selectRegisteredParameter=function(e,t,n){var i=this;if(e[0]=Math.floor(e[0]),!(0<=e[0]&&e[0]<=127))throw new RangeError("The control65 value must be between 0 and 127");if(e[1]=Math.floor(e[1]),!(0<=e[1]&&e[1]<=127))throw new RangeError("The control64 value must be between 0 and 127");return r.toMIDIChannels(t).forEach((function(){i.sendControlChange(101,e[0],t,{time:n}),i.sendControlChange(100,e[1],t,{time:n})})),this},a.prototype._selectNonRegisteredParameter=function(e,t,n){var i=this;if(e[0]=Math.floor(e[0]),!(0<=e[0]&&e[0]<=127))throw new RangeError("The control63 value must be between 0 and 127");if(e[1]=Math.floor(e[1]),!(0<=e[1]&&e[1]<=127))throw new RangeError("The control62 value must be between 0 and 127");return r.toMIDIChannels(t).forEach((function(){i.sendControlChange(99,e[0],t,{time:n}),i.sendControlChange(98,e[1],t,{time:n})})),this},a.prototype._setCurrentRegisteredParameter=function(e,t,n){var i=this;if((e=[].concat(e))[0]=Math.floor(e[0]),!(0<=e[0]&&e[0]<=127))throw new RangeError("The msb value must be between 0 and 127");return r.toMIDIChannels(t).forEach((function(){i.sendControlChange(6,e[0],t,{time:n})})),e[1]=Math.floor(e[1]),0<=e[1]&&e[1]<=127&&r.toMIDIChannels(t).forEach((function(){i.sendControlChange(38,e[1],t,{time:n})})),this},a.prototype._deselectRegisteredParameter=function(e,t){var n=this;return r.toMIDIChannels(e).forEach((function(){n.sendControlChange(101,127,e,{time:t}),n.sendControlChange(100,127,e,{time:t})})),this},a.prototype.setRegisteredParameter=function(e,t,n,i){var a=this;if(i=i||{},!Array.isArray(e)){if(!r.MIDI_REGISTERED_PARAMETER[e])throw new Error("The specified parameter is not available.");e=r.MIDI_REGISTERED_PARAMETER[e]}return r.toMIDIChannels(n).forEach((function(){a._selectRegisteredParameter(e,n,i.time),a._setCurrentRegisteredParameter(t,n,i.time),a._deselectRegisteredParameter(n,i.time)})),this},a.prototype.setNonRegisteredParameter=function(e,t,n,i){var a=this;if(i=i||{},!(0<=e[0]&&e[0]<=127&&0<=e[1]&&e[1]<=127))throw new Error("Position 0 and 1 of the 2-position parameter array must both be between 0 and 127.");return t=[].concat(t),r.toMIDIChannels(n).forEach((function(){a._selectNonRegisteredParameter(e,n,i.time),a._setCurrentRegisteredParameter(t,n,i.time),a._deselectRegisteredParameter(n,i.time)})),this},a.prototype.incrementRegisteredParameter=function(e,t,n){var i=this;if(n=n||{},!Array.isArray(e)){if(!r.MIDI_REGISTERED_PARAMETER[e])throw new Error("The specified parameter is not available.");e=r.MIDI_REGISTERED_PARAMETER[e]}return r.toMIDIChannels(t).forEach((function(){i._selectRegisteredParameter(e,t,n.time),i.sendControlChange(96,0,t,{time:n.time}),i._deselectRegisteredParameter(t,n.time)})),this},a.prototype.decrementRegisteredParameter=function(e,t,n){if(n=n||{},!Array.isArray(e)){if(!r.MIDI_REGISTERED_PARAMETER[e])throw new TypeError("The specified parameter is not available.");e=r.MIDI_REGISTERED_PARAMETER[e]}return r.toMIDIChannels(t).forEach(function(){this._selectRegisteredParameter(e,t,n.time),this.sendControlChange(97,0,t,{time:n.time}),this._deselectRegisteredParameter(t,n.time)}.bind(this)),this},a.prototype.setPitchBendRange=function(e,t,n,i){var a=this;if(i=i||{},!(0<=(e=Math.floor(e)||0)&&e<=127))throw new RangeError("The semitones value must be between 0 and 127");if(!(0<=(t=Math.floor(t)||0)&&t<=127))throw new RangeError("The cents value must be between 0 and 127");return r.toMIDIChannels(n).forEach((function(){a.setRegisteredParameter("pitchbendrange",[e,t],n,{time:i.time})})),this},a.prototype.setModulationRange=function(e,t,n,i){var a=this;if(i=i||{},!(0<=(e=Math.floor(e)||0)&&e<=127))throw new RangeError("The semitones value must be between 0 and 127");if(!(0<=(t=Math.floor(t)||0)&&t<=127))throw new RangeError("The cents value must be between 0 and 127");return r.toMIDIChannels(n).forEach((function(){a.setRegisteredParameter("modulationrange",[e,t],n,{time:i.time})})),this},a.prototype.setMasterTuning=function(e,t,n){var i=this;if(n=n||{},(e=parseFloat(e)||0)<=-65||64<=e)throw new RangeError("The value must be a decimal number larger than -65 and smaller than 64.");var a=Math.floor(e)+64,s=e-Math.floor(e),o=(s=Math.round((s+1)/2*16383))>>7&127,c=127&s;return r.toMIDIChannels(t).forEach((function(){i.setRegisteredParameter("channelcoarsetuning",a,t,{time:n.time}),i.setRegisteredParameter("channelfinetuning",[o,c],t,{time:n.time})})),this},a.prototype.setTuningProgram=function(e,t,n){var i=this;if(n=n||{},!(0<=(e=Math.floor(e))&&e<=127))throw new RangeError("The program value must be between 0 and 127");return r.toMIDIChannels(t).forEach((function(){i.setRegisteredParameter("tuningprogram",e,t,{time:n.time})})),this},a.prototype.setTuningBank=function(e,t,n){var i=this;if(n=n||{},!(0<=(e=Math.floor(e)||0)&&e<=127))throw new RangeError("The bank value must be between 0 and 127");return r.toMIDIChannels(t).forEach((function(){i.setRegisteredParameter("tuningbank",e,t,{time:n.time})})),this},a.prototype.sendChannelMode=function(e,t,n,i){if(i=i||{},"string"==typeof e){if(!(e=r.MIDI_CHANNEL_MODE_MESSAGES[e]))throw new TypeError("Invalid channel mode message name.")}else if(!(120<=(e=Math.floor(e))&&e<=127))throw new RangeError("Channel mode numerical identifiers must be between 120 and 127.");if((t=Math.floor(t)||0)<0||127<t)throw new RangeError("Value must be an integer between 0 and 127.");return r.toMIDIChannels(n).forEach(function(n){this.send((r.MIDI_CHANNEL_MESSAGES.channelmode<<4)+(n-1),[e,t],this._parseTimeParameter(i.time))}.bind(this)),this},a.prototype.sendProgramChange=function(e,t,n){var i=this;if(n=n||{},e=Math.floor(e),isNaN(e)||e<0||127<e)throw new RangeError("Program numbers must be between 0 and 127.");return r.toMIDIChannels(t).forEach((function(t){i.send((r.MIDI_CHANNEL_MESSAGES.programchange<<4)+(t-1),[e],i._parseTimeParameter(n.time))})),this},a.prototype.sendChannelAftertouch=function(e,t,n){var i=this;n=n||{},e=parseFloat(e),(isNaN(e)||e<0||1<e)&&(e=.5);var a=Math.round(127*e);return r.toMIDIChannels(t).forEach((function(e){i.send((r.MIDI_CHANNEL_MESSAGES.channelaftertouch<<4)+(e-1),[a],i._parseTimeParameter(n.time))})),this},a.prototype.sendPitchBend=function(e,t,n){var i=this;if(n=n||{},isNaN(e)||e<-1||1<e)throw new RangeError("Pitch bend value must be between -1 and 1.");var a=Math.round((e+1)/2*16383),s=a>>7&127,o=127&a;return r.toMIDIChannels(t).forEach((function(e){i.send((r.MIDI_CHANNEL_MESSAGES.pitchbend<<4)+(e-1),[o,s],i._parseTimeParameter(n.time))})),this},a.prototype._parseTimeParameter=function(e){var t,n=parseFloat(e);return"string"==typeof e&&"+"===e.substring(0,1)?n&&0<n&&(t=r.time+n):n>r.time&&(t=n),t},a.prototype._convertNoteToArray=function(e){var t=[];return Array.isArray(e)||(e=[e]),e.forEach((function(e){t.push(r.guessNoteNumber(e))})),t},e.exports?e.exports=r:t.WebMidi||(t.WebMidi=r)}(Ml)}(Cl)),Cl.exports);const Tl=/* @__PURE__ */Mi(El),Al=(e,t)=>Array(Math.abs(t)+1).join(e);function Pl(e){return null!==e&&"object"==typeof e&&"string"==typeof e.name}function Il(e){return null!==e&&"object"==typeof e&&"number"==typeof e.step&&"number"==typeof e.alt}const Nl=[0,2,4,-1,1,3,5],Dl=Nl.map((e=>Math.floor(7*e/12)));function Ol(e){const{step:t,alt:n,oct:r,dir:i=1}=e,a=Nl[t]+7*n;return void 0===r?[i*a]:[i*a,i*(r-Dl[t]-4*n)]}const Ll=[3,0,4,1,5,2,6];function Bl(e){const[t,n,r]=e,i=Ll[function(e){const t=(e+1)%7;return t<0?7+t:t}(t)],a=Math.floor((t+1)/7);return void 0===n?{step:i,alt:a,dir:r}:{step:i,alt:a,oct:n+4*a+Dl[i],dir:r}}const Rl={empty:!0,name:"",pc:"",acc:""},Vl=/* @__PURE__ */new Map;function Fl(e){const t=Vl.get(e);if(t)return t;const n="string"==typeof e?function(e){const t=function(e){const t=zl.exec(e);return[t[1].toUpperCase(),t[2].replace(/x/g,"##"),t[3],t[4]]}(e);if(""===t[0]||""!==t[3])return Rl;const n=t[0],r=t[1],i=t[2],a=(n.charCodeAt(0)+3)%7,s="b"===(p=r)[0]?-p.length:p.length,o=i.length?+i:void 0,c=Ol({step:a,alt:s,oct:o}),l=n+r+i,u=n+r,h=(Hl[a]+s+120)%12,d=void 0===o?ql(Hl[a]+s,12)-1188:Hl[a]+s+12*(o+1),f=d>=0&&d<=127?d:null;var p;return{empty:!1,acc:r,alt:s,chroma:h,coord:c,freq:void 0===o?null:440*Math.pow(2,(d-69)/12),height:d,letter:n,midi:f,name:l,oct:o,pc:u,step:a}}(e):Il(e)?Fl(function(e){const{step:t,alt:n,oct:r}=e,i="CDEFGAB".charAt(t);if(!i)return"";const a=i+(e=>e<0?Al("b",-e):Al("#",e))(n);return r||0===r?a+r:a}(e)):Pl(e)?Fl(e.name):Rl;return Vl.set(e,n),n}const zl=/^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)$/;function jl(e){return Fl(Bl(e))}const ql=(e,t)=>(e%t+t)%t,Hl=[0,2,4,5,7,9,11],Ul={empty:!0,name:"",acc:""},Gl=new RegExp("^([-+]?\\d+)(d{1,4}|m|M|P|A{1,4})|(AA|A|P|M|m|d|dd)([-+]?\\d+)$"),Wl={};function Yl(e){return"string"==typeof e?Wl[e]||(Wl[e]=function(e){const t=function(e){const t=Gl.exec(`${e}`);return null===t?["",""]:t[1]?[t[1],t[2]]:[t[4],t[3]]}(e);if(""===t[0])return Ul;const n=+t[0],r=t[1],i=(Math.abs(n)-1)%7,a=Kl[i];if("M"===a&&"P"===r)return Ul;const s="M"===a?"majorable":"perfectable",o=""+n+r,c=n<0?-1:1,l=8===n||-8===n?n:c*(i+1),u=(d=s,"M"===(f=r)&&"majorable"===d||"P"===f&&"perfectable"===d?0:"m"===f&&"majorable"===d?-1:/^A+$/.test(f)?f.length:/^d+$/.test(f)?-1*("perfectable"===d?f.length:f.length+1):0),h=Math.floor((Math.abs(n)-1)/7);var d,f;return{empty:!1,name:o,num:n,q:r,step:i,alt:u,dir:c,type:s,simple:l,semitones:c*($l[i]+u+12*h),chroma:(c*($l[i]+u)%12+12)%12,coord:Ol({step:i,alt:u,oct:h,dir:c}),oct:h}}(e)):Il(e)?Yl(function(e){const{step:t,alt:n,oct:r=0,dir:i}=e;if(!i)return"";const a=t+1+7*r,s=i<0?"-":"",o="M"===Kl[t]?"majorable":"perfectable";return s+a+(c=o,0===(l=n)?"majorable"===c?"M":"P":-1===l&&"majorable"===c?"m":l>0?Al("A",l):Al("d","perfectable"===c?l:l+1));var c,l}(e)):Pl(e)?Yl(e.name):Ul}const $l=[0,2,4,5,7,9,11],Kl="PMMPPMM";function Ql(e){const[t,n=0]=e;return Yl(Bl(7*t+12*n<0?[-t,-n,-1]:[t,n,1]))}function Xl(e,t){const n=Fl(e),r=Yl(t);if(n.empty||r.empty)return"";const i=n.coord,a=r.coord;return jl(1===i.length?[i[0]+a[0]]:[i[0]+a[0],i[1]+a[1]]).name}const Zl={empty:!0,name:"",setNum:0,chroma:"000000000000",normalized:"000000000000",intervals:[]},Jl=e=>Number(e).toString(2),eu=e=>parseInt(e,2),tu=/^[01]{12}$/;function nu(e){return tu.test(e)}const ru={[Zl.chroma]:Zl};function iu(e){const t=nu(e)?e:"number"==typeof(r=e)&&r>=0&&r<=4095?Jl(e):Array.isArray(e)?function(e){if(0===e.length)return Zl.chroma;let t;const n=[0,0,0,0,0,0,0,0,0,0,0,0];for(let r=0;r<e.length;r++)t=Fl(e[r]),t.empty&&(t=Yl(e[r])),t.empty||(n[t.chroma]=1);return n.join("")}(e):(n=e)&&nu(n.chroma)?e.chroma:Zl.chroma;var n,r;return ru[t]=ru[t]||function(e){const t=eu(e),n=function(e){const t=e.split("");return t.map(((e,n)=>function(e,t){const n=t.length,r=(e%n+n)%n;return t.slice(r,n).concat(t.slice(0,r))}(n,t).join("")))}(e).map(eu).filter((e=>e>=2048)).sort()[0];return{empty:!1,name:"",setNum:t,chroma:e,normalized:Jl(n),intervals:su(e)}}(t)}const au=["1P","2m","2M","3m","3M","4P","5d","5P","6m","6M","7m","7M"];function su(e){const t=[];for(let n=0;n<12;n++)"1"===e.charAt(n)&&t.push(au[n]);return t}let ou=[],cu={};[["1P 3M 5P","major","M ^ "],["1P 3M 5P 7M","major seventh","maj7 Δ ma7 M7 Maj7 ^7"],["1P 3M 5P 7M 9M","major ninth","maj9 Δ9 ^9"],["1P 3M 5P 7M 9M 13M","major thirteenth","maj13 Maj13 ^13"],["1P 3M 5P 6M","sixth","6 add6 add13 M6"],["1P 3M 5P 6M 9M","sixth/ninth","6/9 69 M69"],["1P 3M 6m 7M","major seventh flat sixth","M7b6 ^7b6"],["1P 3M 5P 7M 11A","major seventh sharp eleventh","maj#4 Δ#4 Δ#11 M7#11 ^7#11 maj7#11"],["1P 3m 5P","minor","m min -"],["1P 3m 5P 7m","minor seventh","m7 min7 mi7 -7"],["1P 3m 5P 7M","minor/major seventh","m/ma7 m/maj7 mM7 mMaj7 m/M7 -Δ7 mΔ -^7"],["1P 3m 5P 6M","minor sixth","m6 -6"],["1P 3m 5P 7m 9M","minor ninth","m9 -9"],["1P 3m 5P 7M 9M","minor/major ninth","mM9 mMaj9 -^9"],["1P 3m 5P 7m 9M 11P","minor eleventh","m11 -11"],["1P 3m 5P 7m 9M 13M","minor thirteenth","m13 -13"],["1P 3m 5d","diminished","dim ° o"],["1P 3m 5d 7d","diminished seventh","dim7 °7 o7"],["1P 3m 5d 7m","half-diminished","m7b5 ø -7b5 h7 h"],["1P 3M 5P 7m","dominant seventh","7 dom"],["1P 3M 5P 7m 9M","dominant ninth","9"],["1P 3M 5P 7m 9M 13M","dominant thirteenth","13"],["1P 3M 5P 7m 11A","lydian dominant seventh","7#11 7#4"],["1P 3M 5P 7m 9m","dominant flat ninth","7b9"],["1P 3M 5P 7m 9A","dominant sharp ninth","7#9"],["1P 3M 7m 9m","altered","alt7"],["1P 4P 5P","suspended fourth","sus4 sus"],["1P 2M 5P","suspended second","sus2"],["1P 4P 5P 7m","suspended fourth seventh","7sus4 7sus"],["1P 5P 7m 9M 11P","eleventh","11"],["1P 4P 5P 7m 9m","suspended fourth flat ninth","b9sus phryg 7b9sus 7b9sus4"],["1P 5P","fifth","5"],["1P 3M 5A","augmented","aug + +5 ^#5"],["1P 3m 5A","minor augmented","m#5 -#5 m+"],["1P 3M 5A 7M","augmented seventh","maj7#5 maj7+5 +maj7 ^7#5"],["1P 3M 5P 7M 9M 11A","major sharp eleventh (lydian)","maj9#11 Δ9#11 ^9#11"],["1P 2M 4P 5P","","sus24 sus4add9"],["1P 3M 5A 7M 9M","","maj9#5 Maj9#5"],["1P 3M 5A 7m","","7#5 +7 7+ 7aug aug7"],["1P 3M 5A 7m 9A","","7#5#9 7#9#5 7alt"],["1P 3M 5A 7m 9M","","9#5 9+"],["1P 3M 5A 7m 9M 11A","","9#5#11"],["1P 3M 5A 7m 9m","","7#5b9 7b9#5"],["1P 3M 5A 7m 9m 11A","","7#5b9#11"],["1P 3M 5A 9A","","+add#9"],["1P 3M 5A 9M","","M#5add9 +add9"],["1P 3M 5P 6M 11A","","M6#11 M6b5 6#11 6b5"],["1P 3M 5P 6M 7M 9M","","M7add13"],["1P 3M 5P 6M 9M 11A","","69#11"],["1P 3m 5P 6M 9M","","m69 -69"],["1P 3M 5P 6m 7m","","7b6"],["1P 3M 5P 7M 9A 11A","","maj7#9#11"],["1P 3M 5P 7M 9M 11A 13M","","M13#11 maj13#11 M13+4 M13#4"],["1P 3M 5P 7M 9m","","M7b9"],["1P 3M 5P 7m 11A 13m","","7#11b13 7b5b13"],["1P 3M 5P 7m 13M","","7add6 67 7add13"],["1P 3M 5P 7m 9A 11A","","7#9#11 7b5#9 7#9b5"],["1P 3M 5P 7m 9A 11A 13M","","13#9#11"],["1P 3M 5P 7m 9A 11A 13m","","7#9#11b13"],["1P 3M 5P 7m 9A 13M","","13#9"],["1P 3M 5P 7m 9A 13m","","7#9b13"],["1P 3M 5P 7m 9M 11A","","9#11 9+4 9#4"],["1P 3M 5P 7m 9M 11A 13M","","13#11 13+4 13#4"],["1P 3M 5P 7m 9M 11A 13m","","9#11b13 9b5b13"],["1P 3M 5P 7m 9m 11A","","7b9#11 7b5b9 7b9b5"],["1P 3M 5P 7m 9m 11A 13M","","13b9#11"],["1P 3M 5P 7m 9m 11A 13m","","7b9b13#11 7b9#11b13 7b5b9b13"],["1P 3M 5P 7m 9m 13M","","13b9"],["1P 3M 5P 7m 9m 13m","","7b9b13"],["1P 3M 5P 7m 9m 9A","","7b9#9"],["1P 3M 5P 9M","","Madd9 2 add9 add2"],["1P 3M 5P 9m","","Maddb9"],["1P 3M 5d","","Mb5"],["1P 3M 5d 6M 7m 9M","","13b5"],["1P 3M 5d 7M","","M7b5"],["1P 3M 5d 7M 9M","","M9b5"],["1P 3M 5d 7m","","7b5"],["1P 3M 5d 7m 9M","","9b5"],["1P 3M 7m","","7no5"],["1P 3M 7m 13m","","7b13"],["1P 3M 7m 9M","","9no5"],["1P 3M 7m 9M 13M","","13no5"],["1P 3M 7m 9M 13m","","9b13"],["1P 3m 4P 5P","","madd4"],["1P 3m 5P 6m 7M","","mMaj7b6"],["1P 3m 5P 6m 7M 9M","","mMaj9b6"],["1P 3m 5P 7m 11P","","m7add11 m7add4"],["1P 3m 5P 9M","","madd9"],["1P 3m 5d 6M 7M","","o7M7"],["1P 3m 5d 7M","","oM7"],["1P 3m 6m 7M","","mb6M7"],["1P 3m 6m 7m","","m7#5"],["1P 3m 6m 7m 9M","","m9#5"],["1P 3m 5A 7m 9M 11P","","m11A"],["1P 3m 6m 9m","","mb6b9"],["1P 2M 3m 5d 7m","","m9b5"],["1P 4P 5A 7M","","M7#5sus4"],["1P 4P 5A 7M 9M","","M9#5sus4"],["1P 4P 5A 7m","","7#5sus4"],["1P 4P 5P 7M","","M7sus4"],["1P 4P 5P 7M 9M","","M9sus4"],["1P 4P 5P 7m 9M","","9sus4 9sus"],["1P 4P 5P 7m 9M 13M","","13sus4 13sus"],["1P 4P 5P 7m 9m 13m","","7sus4b9b13 7b9b13sus4"],["1P 4P 7m 10m","","4 quartal"],["1P 5P 7m 9m 11P","","11b9"]].forEach((([e,t,n])=>function(e,t,n){const r=function(e){const t=t=>-1!==e.indexOf(t);return t("5A")?"Augmented":t("3M")?"Major":t("5d")?"Diminished":t("3m")?"Minor":"Unknown"}(e),i={...iu(e),name:n||"",quality:r,intervals:e,aliases:t};ou.push(i),i.name&&(cu[i.name]=i),cu[i.setNum]=i,cu[i.chroma]=i,i.aliases.forEach((e=>{return t=i,void(cu[e]=t);var t}))}(e.split(" "),n.split(" "),t))),ou.sort(((e,t)=>e.setNum-t.setNum));let lu={};[["1P 2M 3M 5P 6M","major pentatonic","pentatonic"],["1P 3M 4P 5P 7M","ionian pentatonic"],["1P 3M 4P 5P 7m","mixolydian pentatonic","indian"],["1P 2M 4P 5P 6M","ritusen"],["1P 2M 4P 5P 7m","egyptian"],["1P 3M 4P 5d 7m","neopolitan major pentatonic"],["1P 3m 4P 5P 6m","vietnamese 1"],["1P 2m 3m 5P 6m","pelog"],["1P 2m 4P 5P 6m","kumoijoshi"],["1P 2M 3m 5P 6m","hirajoshi"],["1P 2m 4P 5d 7m","iwato"],["1P 2m 4P 5P 7m","in-sen"],["1P 3M 4A 5P 7M","lydian pentatonic","chinese"],["1P 3m 4P 6m 7m","malkos raga"],["1P 3m 4P 5d 7m","locrian pentatonic","minor seven flat five pentatonic"],["1P 3m 4P 5P 7m","minor pentatonic","vietnamese 2"],["1P 3m 4P 5P 6M","minor six pentatonic"],["1P 2M 3m 5P 6M","flat three pentatonic","kumoi"],["1P 2M 3M 5P 6m","flat six pentatonic"],["1P 2m 3M 5P 6M","scriabin"],["1P 3M 5d 6m 7m","whole tone pentatonic"],["1P 3M 4A 5A 7M","lydian #5P pentatonic"],["1P 3M 4A 5P 7m","lydian dominant pentatonic"],["1P 3m 4P 5P 7M","minor #7M pentatonic"],["1P 3m 4d 5d 7m","super locrian pentatonic"],["1P 2M 3m 4P 5P 7M","minor hexatonic"],["1P 2A 3M 5P 5A 7M","augmented"],["1P 2M 3m 3M 5P 6M","major blues"],["1P 2M 4P 5P 6M 7m","piongio"],["1P 2m 3M 4A 6M 7m","prometheus neopolitan"],["1P 2M 3M 4A 6M 7m","prometheus"],["1P 2m 3M 5d 6m 7m","mystery #1"],["1P 2m 3M 4P 5A 6M","six tone symmetric"],["1P 2M 3M 4A 5A 7m","whole tone","messiaen's mode #1"],["1P 2m 4P 4A 5P 7M","messiaen's mode #5"],["1P 3m 4P 5d 5P 7m","minor blues","blues"],["1P 2M 3M 4P 5d 6m 7m","locrian major","arabian"],["1P 2m 3M 4A 5P 6m 7M","double harmonic lydian"],["1P 2M 3m 4P 5P 6m 7M","harmonic minor"],["1P 2m 3m 4d 5d 6m 7m","altered","super locrian","diminished whole tone","pomeroy"],["1P 2M 3m 4P 5d 6m 7m","locrian #2","half-diminished","aeolian b5"],["1P 2M 3M 4P 5P 6m 7m","mixolydian b6","melodic minor fifth mode","hindu"],["1P 2M 3M 4A 5P 6M 7m","lydian dominant","lydian b7","overtone"],["1P 2M 3M 4A 5P 6M 7M","lydian"],["1P 2M 3M 4A 5A 6M 7M","lydian augmented"],["1P 2m 3m 4P 5P 6M 7m","dorian b2","phrygian #6","melodic minor second mode"],["1P 2M 3m 4P 5P 6M 7M","melodic minor"],["1P 2m 3m 4P 5d 6m 7m","locrian"],["1P 2m 3m 4d 5d 6m 7d","ultralocrian","superlocrian bb7","·superlocrian diminished"],["1P 2m 3m 4P 5d 6M 7m","locrian 6","locrian natural 6","locrian sharp 6"],["1P 2A 3M 4P 5P 5A 7M","augmented heptatonic"],["1P 2M 3m 5d 5P 6M 7m","romanian minor"],["1P 2M 3m 4A 5P 6M 7m","dorian #4"],["1P 2M 3m 4A 5P 6M 7M","lydian diminished"],["1P 2m 3m 4P 5P 6m 7m","phrygian"],["1P 2M 3M 4A 5A 7m 7M","leading whole tone"],["1P 2M 3M 4A 5P 6m 7m","lydian minor"],["1P 2m 3M 4P 5P 6m 7m","phrygian dominant","spanish","phrygian major"],["1P 2m 3m 4P 5P 6m 7M","balinese"],["1P 2m 3m 4P 5P 6M 7M","neopolitan major"],["1P 2M 3m 4P 5P 6m 7m","aeolian","minor"],["1P 2M 3M 4P 5P 6m 7M","harmonic major"],["1P 2m 3M 4P 5P 6m 7M","double harmonic major","gypsy"],["1P 2M 3m 4P 5P 6M 7m","dorian"],["1P 2M 3m 4A 5P 6m 7M","hungarian minor"],["1P 2A 3M 4A 5P 6M 7m","hungarian major"],["1P 2m 3M 4P 5d 6M 7m","oriental"],["1P 2m 3m 3M 4A 5P 7m","flamenco"],["1P 2m 3m 4A 5P 6m 7M","todi raga"],["1P 2M 3M 4P 5P 6M 7m","mixolydian","dominant"],["1P 2m 3M 4P 5d 6m 7M","persian"],["1P 2M 3M 4P 5P 6M 7M","major","ionian"],["1P 2m 3M 5d 6m 7m 7M","enigmatic"],["1P 2M 3M 4P 5A 6M 7M","major augmented","major #5","ionian augmented","ionian #5"],["1P 2A 3M 4A 5P 6M 7M","lydian #9"],["1P 2m 2M 4P 4A 5P 6m 7M","messiaen's mode #4"],["1P 2m 3M 4P 4A 5P 6m 7M","purvi raga"],["1P 2m 3m 3M 4P 5P 6m 7m","spanish heptatonic"],["1P 2M 3M 4P 5P 6M 7m 7M","bebop"],["1P 2M 3m 3M 4P 5P 6M 7m","bebop minor"],["1P 2M 3M 4P 5P 5A 6M 7M","bebop major"],["1P 2m 3m 4P 5d 5P 6m 7m","bebop locrian"],["1P 2M 3m 4P 5P 6m 7m 7M","minor bebop"],["1P 2M 3m 4P 5d 6m 6M 7M","diminished","whole-half diminished"],["1P 2M 3M 4P 5d 5P 6M 7M","ichikosucho"],["1P 2M 3m 4P 5P 6m 6M 7M","minor six diminished"],["1P 2m 3m 3M 4A 5P 6M 7m","half-whole diminished","dominant diminished","messiaen's mode #2"],["1P 3m 3M 4P 5P 6M 7m 7M","kafi raga"],["1P 2M 3M 4P 4A 5A 6A 7M","messiaen's mode #6"],["1P 2M 3m 3M 4P 5d 5P 6M 7m","composite blues"],["1P 2M 3m 3M 4A 5P 6m 7m 7M","messiaen's mode #3"],["1P 2m 2M 3m 4P 4A 5P 6m 6M 7M","messiaen's mode #7"],["1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M","chromatic"]].forEach((([e,t,...n])=>function(e,t,n=[]){const r={...iu(e),name:t,intervals:e,aliases:n};return lu[r.name]=r,lu[r.setNum]=r,lu[r.chroma]=r,r.aliases.forEach((e=>{return t=r,void(lu[e]=t);var t})),r}(e.split(" "),t,n))),[[.125,"dl",["large","duplex longa","maxima","octuple","octuple whole"]],[.25,"l",["long","longa"]],[.5,"d",["double whole","double","breve"]],[1,"w",["whole","semibreve"]],[2,"h",["half","minim"]],[4,"q",["quarter","crotchet"]],[8,"e",["eighth","quaver"]],[16,"s",["sixteenth","semiquaver"]],[32,"t",["thirty-second","demisemiquaver"]],[64,"sf",["sixty-fourth","hemidemisemiquaver"]],[128,"h",["hundred twenty-eighth"]],[256,"th",["two hundred fifty-sixth"]]].forEach((([e,t,n])=>{}));const uu=[1,2,2,3,3,4,5,5,6,6,7,7],hu="P m M m M P d P m M m M".split(" ");fu(((e,t)=>[e[0]+t[0],e[1]+t[1]])),fu(((e,t)=>[e[0]-t[0],e[1]-t[1]]));var du=function(e){const t=e<0?-1:1,n=Math.abs(e),r=n%12,i=Math.floor(n/12);return t*(uu[r]+7*i)+hu[r]};function fu(e){return(t,n)=>{const r=Yl(t).coord,i=Yl(n).coord;if(r&&i)return Ql(e(r,i)).name}}const pu=Math.log(2),mu=Math.log(440);function gu(e){const t=12*(Math.log(e)-mu)/pu+69;return Math.round(100*t)/100}const vu="C C# D D# E F F# G G# A A# B".split(" "),yu="C Db D Eb E F Gb G Ab A Bb B".split(" ");function bu(e,t={}){if(isNaN(e)||e===-1/0||e===1/0)return"";e=Math.round(e);const n=(!0===t.sharps?vu:yu)[e%12];return t.pitchClass?n:n+(Math.floor(e/12)-1)}const _u=["C","D","E","F","G","A","B"],wu=e=>e.name,xu=e=>e.map(Fl).filter((e=>!e.empty)),ku=Fl,Su=Xl,Cu=Xl,Mu=e=>t=>Su(t,e),Eu=Mu,Tu=e=>t=>Su(e,t),Au=Tu;function Pu(e,t){const n=ku(e);if(n.empty)return"";const[r,i]=n.coord;return jl(void 0===i?[r+t]:[r+t,i]).name}const Iu=Pu,Nu=(e,t)=>e.height-t.height;function Du(e,t){return t=t||Nu,xu(e).sort(t).map(wu)}const Ou=Bu(!0),Lu=Bu(!1);function Bu(e){return t=>{const n=ku(t);if(n.empty)return"";const r=e?n.alt>0:n.alt<0,i=null===n.midi;return bu(n.midi||n.chroma,{sharps:r,pitchClass:i})}}var Ru={names:function(e){return void 0===e?_u.slice():Array.isArray(e)?xu(e).map(wu):[]},get:ku,name:e=>ku(e).name,pitchClass:e=>ku(e).pc,accidentals:e=>ku(e).acc,octave:e=>ku(e).oct,midi:e=>ku(e).midi,ascending:Nu,descending:(e,t)=>t.height-e.height,sortedNames:Du,sortedUniqNames:function(e){return Du(e,Nu).filter(((e,t,n)=>0===t||e!==n[t-1]))},fromMidi:function(e){return bu(e)},fromMidiSharps:function(e){return bu(e,{sharps:!0})},freq:e=>ku(e).freq,fromFreq:function(e){return bu(gu(e))},fromFreqSharps:function(e){return bu(gu(e),{sharps:!0})},chroma:e=>ku(e).chroma,transpose:Su,tr:Cu,transposeBy:Mu,trBy:Eu,transposeFrom:Tu,trFrom:Au,transposeFifths:Pu,trFifths:Iu,simplify:Ou,enharmonic:Lu};const Vu=[[0,2773,0,"ionian","","Maj7","major"],[1,2902,2,"dorian","m","m7"],[2,3418,4,"phrygian","m","m7"],[3,2741,-1,"lydian","","Maj7"],[4,2774,1,"mixolydian","","7"],[5,2906,3,"aeolian","m","m7","minor"],[6,3434,5,"locrian","dim","m7b5"]].map((function(e){const[t,n,r,i,a,s,o]=e,c=o?[o]:[],l=Number(n).toString(2);return{empty:!1,intervals:su(l),modeNum:t,chroma:l,normalized:l,name:i,setNum:n,alt:r,triad:a,seventh:s,aliases:c}})),Fu={};function zu(e){const t=[];e=e.filter((e=>"noteon"===e.type)).sort(((e,t)=>e.timestamp-t.timestamp));for(let n=10;n>0;n--)for(let r=0;r<e.length-n+1;r++)try{t.push(new Syllable(e.slice(r,r+n))),e.splice(r,n),r=-1}catch{}return new SyllableSequence(t)}Vu.forEach((e=>{Fu[e.name]=e,e.aliases.forEach((t=>{Fu[t]=e}))}));class SyllableSequence{constructor(e){t(this,"syllables"),t(this,"rootNote"),e.length>0?(this.syllables=e.sort(((e,t)=>e.timestamp-t.timestamp)),this.rootNote=this.syllables[0].notes.reduce(((e,t)=>t.note.number<e.note.number?t:e)).note):(this.syllables=[],this.rootNote={name:"C",octave:4,number:0})}append(e){if(this.syllables.length)try{const t=new Syllable(this.syllables[this.syllables.length-1].notes.map((e=>({note:e.note,timestamp:e.timestamp,type:e.type,velocity:e.velocity}))).concat(e));this.syllables.splice(this.syllables.length-1,1,t)}catch{this.syllables.push(new Syllable([e]))}else this.syllables.push(new Syllable([e])),this.rootNote=e.note}grade(e){const t=[];for(let n=0;n<this.syllables.length;n++)t.push(this.syllables[n].grade(e.syllables[n]));return new SyllableSequence(t)}toString(){let e="";return this.syllables.forEach(((t,n)=>{e+=`Syllable ${n+1}: {\n`,t.notes.forEach((t=>{e+=`\t${t.note.name}\t${t.note.number}\t${t.timestamp} ${t.isCorrect?"":"(incorrect)"} ${t.isMissing?"(missing)":""}\n`})),e+=`} - ${t.timestamp}, correct: ${t.isCorrect}\n`})),e}isCorrect(){let e=!0;return this.syllables.forEach((t=>{!1===t.isCorrect?e=!1:t.notes.forEach((t=>{!1===t.isCorrect&&(e=!1)}))})),e}}class Syllable{constructor(e){t(this,"notes"),t(this,"isCorrect");const n=(e=e.filter((e=>"noteon"===e.type))).reduce(((e,t)=>e.timestamp<t.timestamp?e:t)),r=e.reduce(((e,t)=>e.timestamp>t.timestamp?e:t)).timestamp-n.timestamp;if(Syllable.gracePeriod(e.length)<r)throw new Error(`Notes ${e.toString()} are not close enough together to be a syllable`);this.notes=e.map((e=>({...e,isCorrect:!0,isMissing:!1}))).sort(((e,t)=>e.note.number-t.note.number))}get timestamp(){let e=0;return this.notes.forEach((t=>{if(0===t.timestamp)return 0;e+=t.timestamp})),e/=this.notes.length,e}static gracePeriod(e){return 1.3*12*e}grade(e){return this.notes.length!==e.notes.length&&(e.isCorrect=!1),e.notes.forEach((t=>{let n=Ru.fromMidi(t.note.number),r=Ru.fromMidiSharps(t.note.number);n=Ru.pitchClass(n),r=Ru.pitchClass(r),t.isCorrect=this.notes.filter((e=>Ru.chroma(n)===Ru.chroma(e.note.name)||Ru.chroma(r)===Ru.chroma(e.note.name))).length>=1,t.isCorrect||(e.isCorrect=!1)})),this.notes.forEach((t=>{let n=Ru.fromMidi(t.note.number);n=Ru.pitchClass(n),e.notes.some((e=>Ru.chroma(e.note.name)===Ru.chroma(n)))||e.notes.push({...t,isMissing:!0,isCorrect:!1})})),e}}const ju=class _SkMidi{constructor(e){t(this,"recording",[]),t(this,"webmidi",Tl),t(this,"input"),t(this,"output"),t(this,"_noteonListeners",[]),t(this,"_noteoffListeners",[]),t(this,"midiAccess"),t(this,"_state","initializing"),t(this,"_userLookup"),this._userLookup=e??null}get state(){return this._state}async init(){if(!this.midiAccess)try{navigator.requestMIDIAccess().then((e=>{this.midiAccess=e,this.midiAccess.onstatechange=e=>{H({text:`Midi device ${e.port.name} is ${e.port.state}`,status:"connected"===e.port.state?Z.ok:Z.error})}}))}catch(tl){console.log(`Webmidi not enabled: ${tl}`),this._state="notsupported"}try{this.webmidi.disable()}catch(tl){console.log(`Webmidi not enabled: ${tl}`),this._state="notsupported"}return new Promise(((e,t)=>{this.webmidi.enable((async n=>{n?(this._state="notsupported",console.log(`Webmidi not enabled: ${n}`),t(n)):(console.log("Webmidi enabled"),console.log(`Inputs: ${JSON.stringify(this.webmidi.inputs)}`),console.log(`Outputs: ${JSON.stringify(this.webmidi.outputs)}`),this.output=this.webmidi.outputs[0],this.input=this.webmidi.inputs[0],_SkMidi._initializedWithUserConfig||(await this.loadUserConfiguration(),_SkMidi._initializedWithUserConfig=!0),this.input&&this.output?(console.log("midi init state: ready"),this._state="ready",this.attachListeners()):(console.log("midi init state: nodevice"),this._state="nodevice"),e(!0))}))}))}async loadUserConfiguration(){try{if(!this._userLookup)return void console.log("User lookup function not provided - using default MIDI configuration");const e=await this._userLookup();if(!e)return void console.log("No user found, using default MIDI configuration");const t=await e.getActiveCourses();for(const n of t){const t=await e.getCourseInterface(n.courseID),r=await t.getCourseSettings();if(r?.midiinput||r?.midioutput){r.midiinput&&this.webmidi.getInputById(r.midiinput.toString())&&(this.selectInput(r.midiinput.toString()),console.log(`Loaded saved MIDI input: ${r.midiinput}`)),r.midioutput&&this.webmidi.getOutputById(r.midioutput.toString())&&(this.selectOutput(r.midioutput.toString()),console.log(`Loaded saved MIDI output: ${r.midioutput}`));break}}}catch(tl){console.error("Failed to load user MIDI configuration:",tl)}}setStateChangeListener(e){if(this.midiAccess)this.midiAccess.onstatechange=t=>{this.init().then((()=>{console.log(`Midi state: ${this.state}`),e()})),H({text:`Midi device ${t.port.name} is ${t.port.state}`,status:"connected"===t.port.state?Z.ok:Z.error})};else try{navigator.requestMIDIAccess().then((t=>{this.midiAccess=t,this.midiAccess.onstatechange=t=>{this.init().then((()=>{console.log(`Midi state: ${this.state}`),e()})),H({text:`Midi device ${t.port.name} is ${t.port.state}`,status:"connected"===t.port.state?Z.ok:Z.error})}}))}catch(t){console.log(`Webmidi not enabled: ${t}`),this._state="notsupported"}}attachListeners(){this.input&&(this._noteonListeners.forEach((e=>{this.input?.on("noteon","all",e)})),this._noteoffListeners.forEach((e=>{this.input?.on("noteoff","all",e)})))}get hasRecording(){return this.record.length>0}get configuredInput(){return this.input?`${this.input.manufacturer}: ${this.input.name}`:"(Not Sure!)"}eraseRecording(){this.recording=[]}stopRecording(){this.input?.removeListener()}record(){let e=0;if(void 0===this.input)throw new Error("Midi input not configured!");"open"===this.input.connection&&(this.stopRecording(),this.eraseRecording(),this.input.on("noteon","all",(t=>{0===this.recording.length&&(e=t.timestamp),this.recording.push({note:t.note,type:t.type,velocity:t.velocity,timestamp:t.timestamp-e})})),this.input.on("noteoff","all",(t=>{0===this.recording.length&&(e=t.timestamp),this.recording.push({note:t.note,velocity:t.velocity,type:t.type,timestamp:t.timestamp-e})})))}addNoteonListenter(e){this._noteonListeners.push(e),this.input&&this.input.on("noteon","all",e)}addNoteoffListenter(e){this._noteoffListeners.push(e),this.input&&this.input.on("noteoff","all",e)}play(e){let t=e||this.recording;t=t.map((e=>({...e,timestamp:e.timestamp+_SkMidi.OFFSET}))),t.forEach((e=>{"noteon"===e.type?this.output?.playNote(e.note.name+e.note.octave,1,{velocity:e.velocity,time:`+${e.timestamp}`,rawVelocity:!1}):this.output?.stopNote(e.note.name+e.note.octave,1,{velocity:e.velocity,time:`+${e.timestamp}`,rawVelocity:!1})}))}static async instance(){return _SkMidi._instance||(console.log("Buzz, whirr, Midi instance factory is at work"),_SkMidi._instance=new _SkMidi,await _SkMidi._instance.init()),_SkMidi._instance}get inputs(){return this.webmidi.inputs}get outputs(){return this.webmidi.outputs}selectInput(e){!1!==this.webmidi.getInputById(e)?this.input=this.webmidi.getInputById(e):!1!==this.webmidi.getInputByName(e)&&(this.input=this.webmidi.getInputByName(e))}selectOutput(e){!1!==this.webmidi.getOutputById(e)?this.output=this.webmidi.getOutputById(e):!1!==this.webmidi.getOutputByName(e)&&(this.output=this.webmidi.getOutputByName(e))}};t(ju,"_instance"),t(ju,"OFFSET",5),t(ju,"_initializedWithUserConfig",!1);let qu=ju;const Hu=n({name:"SyllableSeqVis",props:{seq:{type:Object,required:!0},lastTSsuggestion:{type:Number,required:!1,default:0}},setup(e){const t=a(0),n=a(0),r=a(0),i=a(500),s=o((()=>{const t=e.seq.syllables[e.seq.syllables.length-1].timestamp;return Math.max(1,t,e.lastTSsuggestion)})),l=o((()=>{let t=0,n=500;return e.seq.syllables.forEach((e=>{e.notes.forEach((e=>{e.note.number>t&&(t=e.note.number),e.note.number<n&&(n=e.note.number)}))})),Math.max(3*(t-n)+10,0)})),u=()=>{try{t.value=e.seq.syllables[0].timestamp;const r=e.seq.syllables[e.seq.syllables.length-1].timestamp,i=t.value+e.lastTSsuggestion;n.value=Math.max(r,i)}catch(a){console.log(`[SyllableSeqVis] Error updating bounds: ${a}`)}e.seq.syllables.forEach((e=>{e.notes.forEach((e=>{e.note.number>r.value&&(r.value=e.note.number),e.note.number<i.value&&(i.value=e.note.number)}))}))};return c((()=>{console.log(`SyllableSeqVis created w/ input: \n${e.seq}`),u()})),{firstTS:t,lastTS:n,high:r,low:i,sayNote:e=>{console.log(`${JSON.stringify(e)}`)},getLastTS:s,getHeight:l,updateBounds:u}}}),Uu=["height"],Gu=["cx","cy","alt","fill","stroke","onMouseenter"],Wu=/* @__PURE__ */Vi(Hu,[["render",function(e,t,n,r,i,a){return p(),f("div",null,[(p(),f("svg",{width:510,height:Math.max(3*(e.high-e.low)+10,0)},[(p(!0),f(b,null,_(e.seq.syllables,(t=>(p(),f(b,null,[(p(!0),f(b,null,_(t.notes,(n=>(p(),f("circle",{key:t.timestamp+"-"+n.note.number,cx:500*(t.timestamp-e.firstTS)/(e.lastTS-e.firstTS)+4,cy:3*(e.high-n.note.number)+4,alt:n.note.name,r:"3",fill:n.isCorrect?"black":n.isMissing?"none":"red",stroke:n.isMissing?"red":"none",onMouseenter:t=>e.sayNote(n)},null,40,Gu)))),128))],64)))),256))],8,Uu))])}],["__scopeId","data-v-2f79c080"]]),Yu=n({name:"NoteDisplay",props:{chroma:{type:Number,required:!0}},setup:e=>({style:t=>{let n="#ffffff";return t===e.chroma?n="#1976D2":1!==t&&3!==t&&6!==t&&8!==t&&10!==t&&-2!==t||(n="#000000"),{fill:n,"fill-opacity":1,stroke:"#000000","stroke-width":.79375,"stroke-miterlimit":4,"stroke-dasharray":"none","stroke-opacity":1}},white:-1,black:-2})}),$u={id:"svg8",width:"300px",height:"auto","xmlns:dc":"http://purl.org/dc/elements/1.1/","xmlns:cc":"http://creativecommons.org/ns#","xmlns:rdf":"http://www.w3.org/1999/02/22-rdf-syntax-ns#","xmlns:svg":"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/svg","xmlns:sodipodi":"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd","xmlns:inkscape":"http://www.inkscape.org/namespaces/inkscape","sodipodi:docname":"keys.svg","inkscape:version":"1.0rc1 (09960d6f05, 2020-04-09)",version:"1.1",viewBox:"0 0 175.24936 73.594925"},Ku={id:"metadata5"},Qu={id:"layer1",transform:"translate(167.75219,-151.96011)","inkscape:groupmode":"layer","inkscape:label":"Layer 1"},Xu=n({name:"Playback",components:{SyllableSeqVis:Wu,NoteDisplay:/* @__PURE__ */Vi(Yu,[["render",function(e,t,n,r,i,a){const s=w("sodipodi:namedview"),o=w("dc:format"),c=w("dc:type"),l=w("dc:title"),u=w("cc:Work"),h=w("rdf:RDF");return p(),f("svg",$u,[t[1]||(t[1]=m("defs",{id:"defs2"},null,-1)),x(s,{id:"base","inkscape:window-maximized":"1","inkscape:window-y":"726","inkscape:window-x":"1491","inkscape:window-height":"1321","inkscape:window-width":"2400",showborder:"false",showgrid:"false","inkscape:document-rotation":"0","inkscape:current-layer":"layer1","inkscape:document-units":"mm","inkscape:cy":"255.88343","inkscape:cx":"754.94284","inkscape:zoom":"0.98994949","inkscape:pageshadow":"2","inkscape:pageopacity":"0.0",borderopacity:"1.0",bordercolor:"#666666",pagecolor:"#ffffff"}),m("metadata",Ku,[x(h,null,{default:T((()=>[x(u,{"rdf:about":""},{default:T((()=>[x(o,null,{default:T((()=>t[0]||(t[0]=[k("image/svg+xml")]))),_:1}),x(c,{"rdf:resource":"http://purl.org/dc/dcmitype/StillImage"}),x(l)])),_:1})])),_:1})]),m("g",Qu,[m("rect",{id:"rect845",y:"152.19064",x:"-150.12129",height:"73.220116",width:"17.486626",style:A(e.style(0))},null,4),m("rect",{id:"rect845-9",style:A(e.style(2)),width:"17.486626",height:"73.220116",x:"-132.63466",y:"152.19064"},null,4),m("rect",{id:"rect845-6",style:A(e.style(4)),width:"17.486626",height:"73.220116",x:"-115.14803",y:"152.19064"},null,4),m("rect",{id:"rect845-4",style:A(e.style(5)),width:"17.486626",height:"73.220116",x:"-97.661407",y:"152.19064"},null,4),m("rect",{id:"rect845-92",style:A(e.style(7)),width:"17.486626",height:"73.220116",x:"-80.174782",y:"152.19064"},null,4),m("rect",{id:"rect845-3",style:A(e.style(9)),width:"17.486626",height:"73.220116",x:"-62.688156",y:"152.19064"},null,4),m("rect",{id:"rect845-0",style:A(e.style(11)),width:"17.486626",height:"73.220116",x:"-45.20153",y:"152.19064"},null,4),m("rect",{id:"rect845-30",style:A(e.style(e.white)),width:"17.486626",height:"73.220116",x:"-27.714905",y:"152.10745"},null,4),m("rect",{id:"rect898",ry:"0",y:"152.10744",x:"-138.43532",height:"54.415863",width:"10.466455",style:A(e.style(1))},null,4),m("rect",{id:"rect898-3",style:A(e.style(3)),width:"10.466455",height:"54.415863",x:"-120.84978",y:"152.10744",ry:"0"},null,4),m("rect",{id:"rect898-7",style:A(e.style(6)),width:"10.466455",height:"54.415863",x:"-85.678711",y:"152.10744",ry:"0"},null,4),m("rect",{id:"rect898-8",style:A(e.style(8)),width:"10.466455",height:"54.415863",x:"-68.09317",y:"152.10744",ry:"0"},null,4),m("rect",{id:"rect898-1",style:A(e.style(10)),width:"10.466455",height:"54.415863",x:"-50.507633",y:"152.10744",ry:"0"},null,4),m("rect",{id:"rect845-30-1",y:"152.10745",x:"-10.228278",height:"73.220116",width:"17.486626",style:A(e.style(e.white))},null,4),m("rect",{id:"rect845-30-9",y:"152.10744",x:"-167.60791",height:"73.220116",width:"17.486626",style:A(e.style(e.white))},null,4),m("rect",{id:"rect898-4",style:A(e.style(e.black)),width:"10.466455",height:"54.415863",x:"-15.336554",y:"152.10744",ry:"0"},null,4),m("rect",{id:"rect898-74",style:A(e.style(e.black)),width:"4.4679713",height:"54.415863",x:"-167.60791",y:"152.10744",ry:"0"},null,4),m("rect",{id:"rect898-10",style:A(e.style(e.black)),width:"5.1863246",height:"54.507248",x:"2.2092075",y:"152.06175",ry:"0"},null,4)])])}]])},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"Playback"),r=B(n),i=a(),s=a(!1),l=a("notSet"),u=a(!1),h=a(0),f=a(ve.utc()),p=a(0),m=a(0),g=a(zu([])),v=a(!1),y=a(zu([])),b=a(0),_=a(""),w=a(0),x=a(0),k=a(),S=a();r.question.value=new uh(e.data);const C=o((()=>new uh(e.data))),M=o((()=>zu(C.value.midi).syllables[0].notes.length>1?"Lowest note of first chord:":"First note:")),E=o((()=>s.value?zu(C.value.midi).rootNote.number%12:0)),T=()=>{l.value?l.value!==i.value?.state&&(s.value=!1,l.value=i.value?.state||"notSet",s.value=!0):(l.value=i.value?.state||"notSet",s.value=!0),n.logger.log(`Playback is running init with state: ${l.value}`),"ready"===l.value&&(p.value=C.value.duration,P())},A=()=>{try{k.value&&(k.value.style.animationName="",requestAnimationFrame((()=>{requestAnimationFrame((()=>{k.value&&(k.value.style.animationDuration=p.value+"ms",k.value.style.animationName="progress")}))})))}catch{setTimeout(A,50)}},P=()=>{i.value?.stopRecording(),i.value?.eraseRecording(),f.value=ve.utc(),w.value=0,x.value=0,u.value=!1,h.value=0,A(),i.value?.play(C.value.midi),setTimeout((()=>{n.logger.log("done playback..."),i.value?.record(),u.value=!0,i.value?.addNoteonListenter((e=>{w.value++,y.value.append(e),S.value?.updateBounds(),w.value+x.value>=C.value.midi.length&&I()})),i.value?.addNoteoffListenter((()=>{x.value++,w.value+x.value>=C.value.midi.length&&I()}))}),C.value.lastNoteOnTimestamp)},I=()=>{if(!i.value?.recording)return!1;const e=zu(C.value.midi),t=zu(i.value.recording);return g.value=e.grade(t),y.value=zu([]),!!r.submitAnswer(i.value.recording).isCorrect||(m.value++,v.value=!0,m.value<r.maxAttemptsPerView.value&&P(),!1)},N=()=>{w.value>0?I():P()};return c((async()=>{try{i.value=await qu.instance(),i.value.setStateChangeListener((()=>{T()})),s.value=!0}catch(e){H({status:Z.error,text:"Midi device not supported"}),_.value=JSON.stringify(e),l.value="notsupported",s.value=!0}T(),U.addBinding([{hotkey:"space",callback:N,command:"Clear attempt or play again"}])})),d((()=>{U.removeBinding("space")})),{...n,...r,initialized:s,state:l,recording:u,inputSeq:y,lastTSsuggestion:b,gradedSeq:g,graded:v,promptText:M,firstNoteChroma:E,progressBar:k,inputVisRef:S,clearAttempt:N,notesOn:w}}}),Zu={key:0,"data-viewable":"Playback"},Ju={key:0},eh={class:"text-h4"},th={class:"text-h5"},nh={key:0},rh={class:"progressContainer"},ih={id:"progress",ref:"progressBar"},ah={key:1},sh={key:2},oh=/* @__PURE__ */Vi(Xu,[["render",function(e,t,n,r,i,a){const s=w("note-display"),o=w("v-icon"),c=w("v-btn"),l=w("syllable-seq-vis");return e.initialized?(p(),f("div",Zu,["ready"===e.state?(p(),f("div",Ju,[m("div",eh,[k(y(e.promptText)+" ",1),x(s,{chroma:e.firstNoteChroma},null,8,["chroma"])]),m("div",th,[t[0]||(t[0]=k("Listen...")),e.recording?(p(),f("span",nh," and Repeat")):g("",!0)]),m("div",rh,[m("div",ih,null,512)]),x(c,{color:"primary",autofocus:"",onClick:e.clearAttempt},{default:T((()=>[t[2]||(t[2]=k(" Play again ")),x(o,{end:""},{default:T((()=>t[1]||(t[1]=[k("volume_up")]))),_:1})])),_:1},8,["onClick"]),(p(),E(l,{key:0,ref:"inputVisRef",seq:e.inputSeq,"last-t-ssuggestion":e.lastTSsuggestion},null,8,["seq","last-t-ssuggestion"])),e.graded?(p(),E(l,{key:1,seq:e.gradedSeq},null,8,["seq"])):g("",!0)])):"nodevice"===e.state?(p(),f("div",ah,"No midi device detected. Please attach one!")):"notsupported"===e.state?(p(),f("div",sh,t[3]||(t[3]=[m("p",null,"This exercise requires a midi input device, which is not supported by this browser ☹",-1),m("div",null,[m("p",null,"Please try again with one of the following browsers:"),m("ul",null,[m("li",null,[m("a",{href:"https://www.google.com/chrome/"},"Google Chrome")]),m("li",null,[m("a",{href:"https://www.microsoft.com/edge"},"Microsoft Edge")]),m("li",null,[m("a",{href:"https://brave.com/"},"Brave")])])],-1)]))):g("",!0)])):g("",!0)}]]),ch=[{name:"Melody",type:Q.MIDI}],lh=class _EchoQuestion extends R{constructor(e){super(e),t(this,"midi"),this.midi=e[0].Melody}get duration(){return this.midi.reduce(((e,t)=>t.timestamp>e.timestamp?t:e)).timestamp}get lastNoteOnTimestamp(){return this.midi.filter((e=>"noteon"===e.type)).reduce(((e,t)=>t.timestamp>e.timestamp?t:e)).timestamp}isCorrect(e){const t=zu(this.midi),n=zu(e);try{return t.grade(n).isCorrect()}catch(r){return console.log("ERROR grading this midi sequence!",r),!1}}dataShapes(){return _EchoQuestion.dataShapes}views(){return _EchoQuestion.views}};t(lh,"dataShapes",[{fields:ch,name:X.PIANO_Echo}]),t(lh,"views",[oh]);let uh=lh;const hh=n({name:"NotePlayback",components:{},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"NotePlayback"),r=B(n),i=a(),s=a(!1),l=a(!1),u=a(0),h=a(ve.utc()),d=a(0),f=a(zu([])),p=a(!1),m=a(zu([])),g=a("");r.question.value=new _h(e.data);const v=o((()=>new _h(e.data))),y=()=>{i.value?.stopRecording(),i.value?.eraseRecording(),h.value=ve.utc(),l.value=!1,u.value=0,i.value?.record(),l.value=!0,i.value?.addNoteonListenter((e=>{m.value.append(e)})),i.value?.addNoteoffListenter((()=>{i.value?.recording?.length&&i.value?.recording?.length>=2&&b()}))},b=()=>!!i.value?.recording&&(m.value=zu([]),!!r.submitAnswer(i.value.recording).isCorrect||(d.value++,p.value=!0,d.value<r.maxAttemptsPerView.value&&y(),!1));return c((async()=>{try{i.value=await qu.instance(),g.value=v.value.note,y(),s.value=!0}catch(e){n.logger.error("Failed to initialize MIDI:",e)}})),{...n,...r,initialized:s,recording:l,inputSeq:m,gradedSeq:f,graded:p,note:g,attempts:d}}}),dh={"data-viewable":"NotePlayback"},fh={class:"text-h4"},ph={class:"font-weight-bold"},mh={key:0,id:"svg8",width:"300px",height:"auto","xmlns:dc":"http://purl.org/dc/elements/1.1/","xmlns:cc":"http://creativecommons.org/ns#","xmlns:rdf":"http://www.w3.org/1999/02/22-rdf-syntax-ns#","xmlns:svg":"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/svg","xmlns:sodipodi":"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd","xmlns:inkscape":"http://www.inkscape.org/namespaces/inkscape","sodipodi:docname":"keys.svg","inkscape:version":"1.0rc1 (09960d6f05, 2020-04-09)",version:"1.1",viewBox:"0 0 175.24936 73.594925"},gh={id:"metadata5"},vh=/* @__PURE__ */Vi(hh,[["render",function(e,t,n,r,i,a){const s=w("sodipodi:namedview"),o=w("dc:format"),c=w("dc:type"),l=w("dc:title"),u=w("cc:Work"),h=w("rdf:RDF");return p(),f("div",dh,[m("div",fh,[t[0]||(t[0]=k(" Play the note: ")),m("span",ph,y(e.note),1)]),e.graded?(p(),f("svg",mh,[t[2]||(t[2]=m("defs",{id:"defs2"},null,-1)),x(s,{id:"base","inkscape:window-maximized":"1","inkscape:window-y":"726","inkscape:window-x":"1491","inkscape:window-height":"1321","inkscape:window-width":"2400",showborder:"false",showgrid:"false","inkscape:document-rotation":"0","inkscape:current-layer":"layer1","inkscape:document-units":"mm","inkscape:cy":"255.88343","inkscape:cx":"754.94284","inkscape:zoom":"0.98994949","inkscape:pageshadow":"2","inkscape:pageopacity":"0.0",borderopacity:"1.0",bordercolor:"#666666",pagecolor:"#ffffff"}),m("metadata",gh,[x(h,null,{default:T((()=>[x(u,{"rdf:about":""},{default:T((()=>[x(o,null,{default:T((()=>t[1]||(t[1]=[k("image/svg+xml")]))),_:1}),x(c,{"rdf:resource":"http://purl.org/dc/dcmitype/StillImage"}),x(l)])),_:1})])),_:1})]),t[3]||(t[3]=m("g",{id:"layer1",transform:"translate(167.75219,-151.96011)","inkscape:groupmode":"layer","inkscape:label":"Layer 1"},[m("rect",{id:"rect845",y:"152.19064",x:"-150.12129",height:"73.220116",width:"17.486626",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"}}),m("rect",{id:"rect845-9",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"17.486626",height:"73.220116",x:"-132.63466",y:"152.19064"}),m("rect",{id:"rect845-6",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"17.486626",height:"73.220116",x:"-115.14803",y:"152.19064"}),m("rect",{id:"rect845-0",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"17.486626",height:"73.220116",x:"-45.20153",y:"152.19064"}),m("rect",{id:"rect845-92",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"17.486626",height:"73.220116",x:"-80.174782",y:"152.19064"}),m("rect",{id:"rect845-3",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"17.486626",height:"73.220116",x:"-62.688156",y:"152.19064"}),m("rect",{id:"rect845-4",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"17.486626",height:"73.220116",x:"-97.661407",y:"152.19064"}),m("rect",{id:"rect845-30",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"17.486626",height:"73.220116",x:"-27.714905",y:"152.10745"}),m("rect",{id:"rect898",ry:"0",y:"152.10744",x:"-138.43532",height:"54.415863",width:"10.466455",style:{fill:"#000000","fill-opacity":"1",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"}}),m("rect",{id:"rect898-3",style:{fill:"#000000","fill-opacity":"1",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"10.466455",height:"54.415863",x:"-120.84978",y:"152.10744",ry:"0"}),m("rect",{id:"rect898-7",style:{fill:"#000000","fill-opacity":"1",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"10.466455",height:"54.415863",x:"-85.678711",y:"152.10744",ry:"0"}),m("rect",{id:"rect898-8",style:{fill:"#000000","fill-opacity":"1",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"10.466455",height:"54.415863",x:"-68.09317",y:"152.10744",ry:"0"}),m("rect",{id:"rect898-1",style:{fill:"#000000","fill-opacity":"1",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"10.466455",height:"54.415863",x:"-50.507633",y:"152.10744",ry:"0"}),m("rect",{id:"rect845-30-1",y:"152.10745",x:"-10.228278",height:"73.220116",width:"17.486626",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"}}),m("rect",{id:"rect845-30-9",y:"152.10744",x:"-167.60791",height:"73.220116",width:"17.486626",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"}}),m("rect",{id:"rect898-4",style:{fill:"#000000","fill-opacity":"1",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"10.466455",height:"54.415863",x:"-15.336554",y:"152.10744",ry:"0"}),m("rect",{id:"rect898-74",style:{fill:"#000000","fill-opacity":"1",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"4.4679713",height:"54.415863",x:"-167.60791",y:"152.10744",ry:"0"}),m("rect",{id:"rect898-10",style:{fill:"#000000","fill-opacity":"1",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"5.1863246",height:"54.507248",x:"2.2092075",y:"152.06175",ry:"0"})],-1))])):g("",!0)])}]]),yh=[{name:"Note",type:Q.STRING}],bh=class _PlayNote extends R{constructor(e){super(e),t(this,"note"),this.note=e[0].Note}isCorrect(e){return e[0].note.name===this.note}dataShapes(){return _PlayNote.dataShapes}views(){return _PlayNote.views}};t(bh,"dataShapes",[{fields:yh,name:X.PIANO_PlayNote}]),t(bh,"seedData",["A","B","C","D","E","F","G","A♯","C♯","D♯","F♯","G♯","D♭","E♭","G♭","A♭","B♭"].map((e=>({Note:e})))),t(bh,"views",[vh]);let _h=bh;const wh=new CourseWare("piano",[uh,_h]),xh=n({name:"IdentifyChroma",components:{RadioMultipleChoice:O},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"IdentifyChroma"),r=B(n),i=a(""),s=a(new AudioContext);r.question.value=new Th(e.data);const l=o((()=>r.question.value));return c((()=>{(()=>{const e=[];let t=147.5;for(;t>100;)e.push(t),t/=2;e.push(295);let n=590;for(;n<5e3;)e.push(n),n*=2;return e})().forEach((e=>(e=>{const t=s.value.createOscillator();t.type="sine",t.frequency.value=e;const n=s.value.createGain();console.log("Max Gain: "+n.gain.maxValue),n.gain.setValueAtTime(0,0),n.gain.linearRampToValueAtTime(.5,15),t.connect(n),n.connect(s.value.destination),t.start(0),t.stop(14)})(e)))})),{...n,...r,answer:i,question:l,submit:()=>{l.value&&l.value.isCorrect(i.value)}}}}),kh={"data-viewable":"IdentifyChroma"},Sh=/* @__PURE__ */Vi(xh,[["render",function(e,t,n,r,i,a){const s=w("radio-multiple-choice");return p(),f("div",kh,[e.question?(p(),f(b,{key:0},[t[0]||(t[0]=k(" What note is being played? ")),x(s,{"choice-list":e.question.choiceList},null,8,["choice-list"])],64)):g("",!0)])}]]);var Ch=/* @__PURE__ */(e=>(e.A="A",e.B="B",e.C="C",e.D="D",e.E="E",e.F="F",e.G="G",e))(Ch||{});const Mh=[{name:"Chroma",type:Q.STRING,validator:{test:e=>Object.values(Ch).includes(e)?{status:Z.ok,msg:""}:{status:Z.error,msg:"That's not a chroma!"},instructions:"Enter a valid musical note (A-G)"}}],Eh=class _ChromaQuestion extends R{constructor(e){super(e),t(this,"chroma"),this.chroma=e[0].Chroma}get baseFreq(){const e=440;return"A"===this.chroma?e:"B"===this.chroma?e*Math.pow(2,2/12):"C"===this.chroma?e*Math.pow(2,.25):e}get choiceList(){return Ni.shuffle([this.chroma.toString(),"test","options","are","fun"])}isCorrect(e){return e.choiceList[e.selection]===this.chroma.toString()}dataShapes(){return _ChromaQuestion.dataShapes}views(){return _ChromaQuestion.views}};t(Eh,"dataShapes",[{fields:Mh,name:X.PITCH_chroma}]),t(Eh,"views",[Sh]);let Th=Eh;const Ah=new CourseWare("pitch",[Th]);var Ph,Ih,Nh,Dh,Oh,Lh,Bh,Rh,Vh,Fh,zh,jh,qh,Hh,Uh,Gh,Wh,Yh,$h,Kh,Qh,Xh,Zh,Jh;function ed(){return Dh?Nh:(Dh=1,Nh=function(e,t){var n=this;if(t||(t={}),n.qpm=t.qpm?parseInt(t.qpm,10):null,!n.qpm){var r=e.metaText?e.metaText.tempo:null;n.qpm=e.getBpm(r)}n.extraMeasuresAtBeginning=t.extraMeasuresAtBeginning?parseInt(t.extraMeasuresAtBeginning,10):0,n.beatCallback=t.beatCallback,n.eventCallback=t.eventCallback,n.lineEndCallback=t.lineEndCallback,n.lineEndAnticipation=t.lineEndAnticipation?parseInt(t.lineEndAnticipation,10):0,n.beatSubdivisions=t.beatSubdivisions?parseInt(t.beatSubdivisions,10):1,n.joggerTimer=null,n.replaceTarget=function(e){n.noteTimings=e.setTiming(n.qpm,n.extraMeasuresAtBeginning),0===e.noteTimings.length&&(n.noteTimings=e.setTiming(0,0)),n.lineEndCallback&&(n.lineEndTimings=function(e,t){for(var n=[],r=null,i=0;i<e.length;i++){var a=e[i];"end"!==a.type&&a.top!==r&&(n.push({measureNumber:a.measureNumber,milliseconds:a.milliseconds-t,top:a.top,bottom:a.top+a.height}),r=a.top)}return n}(e.noteTimings,n.lineEndAnticipation)),n.startTime=null,n.currentBeat=0,n.currentEvent=0,n.currentLine=0,n.currentTime=0,n.isPaused=!1,n.isRunning=!1,n.pausedPercent=null,n.justUnpaused=!1,n.newSeekPercent=0,n.lastTimestamp=0,0!==n.noteTimings.length&&(n.millisecondsPerBeat=1e3/(n.qpm/60)/n.beatSubdivisions,n.lastMoment=n.noteTimings[n.noteTimings.length-1].milliseconds,n.totalBeats=Math.round(n.lastMoment/n.millisecondsPerBeat))},n.replaceTarget(e),n.doTiming=function(e){if(n.lastTimestamp!==e&&(n.lastTimestamp=e,n.startTime||(n.startTime=e),!n.isPaused&&n.isRunning)){for(n.currentTime=e-n.startTime,n.currentTime+=16;n.noteTimings.length>n.currentEvent&&n.noteTimings[n.currentEvent].milliseconds<n.currentTime;){if(n.eventCallback&&"event"===n.noteTimings[n.currentEvent].type){var t=n.startTime;n.eventCallback(n.noteTimings[n.currentEvent]),t!==n.startTime&&(n.currentTime=e-n.startTime)}n.currentEvent++}if(n.lineEndCallback&&n.lineEndTimings.length>n.currentLine&&n.lineEndTimings[n.currentLine].milliseconds<n.currentTime&&n.currentEvent<n.noteTimings.length){var r=n.noteTimings[n.currentEvent].milliseconds===n.currentTime?n.noteTimings[n.currentEvent]:n.noteTimings[n.currentEvent-1];n.lineEndCallback(n.lineEndTimings[n.currentLine],r,{line:n.currentLine,endTimings:n.lineEndTimings,currentTime:n.currentTime}),n.currentLine++}if(n.currentTime<n.lastMoment){if(requestAnimationFrame(n.doTiming),n.currentBeat*n.millisecondsPerBeat<n.currentTime){var i=n.doBeatCallback(e);null!==i&&(n.currentTime=i)}}else if(n.currentBeat<=n.totalBeats&&n.beatCallback){var a=n.doBeatCallback(e);null!==a&&(n.currentTime=a),requestAnimationFrame(n.doTiming)}if(n.currentTime>=n.lastMoment)if(n.eventCallback){var s=n.eventCallback(null);n.shouldStop(s).then((function(e){e&&n.stop()}))}else n.stop()}},n.shouldStop=function(e){return new Promise((function(t){return e?"continue"===e?t(!1):void(e.then&&e.then((function(e){t("continue"!==e)}))):t(!0)}))},n.doBeatCallback=function(e){if(n.beatCallback){for(var t,r,i=n.currentEvent;i<n.noteTimings.length&&null===n.noteTimings[i].left;)i++;if(i<n.noteTimings.length){for(t=n.noteTimings[i].milliseconds,i=Math.max(0,n.currentEvent-1);i>=0&&null===n.noteTimings[i].left;)i--;r=n.noteTimings[i]}var a={},s={};if(r){a.top=r.top,a.height=r.height;var o=Math.max(0,e-n.startTime-r.milliseconds),c=t-r.milliseconds,l=r.endX-r.left,u=c?o*l/c:0;a.left=r.left+u,0===n.currentEvent&&r.milliseconds>e-n.startTime&&(a.left=void 0),s={timestamp:e,startTime:n.startTime,ev:r,endMs:t,offMs:o,offPx:u,gapMs:c,gapPx:l}}else s={timestamp:e,startTime:n.startTime};var h=n.startTime;if(n.beatCallback(n.currentBeat/n.beatSubdivisions,n.totalBeats/n.beatSubdivisions,n.lastMoment,a,s),h!==n.startTime)return e-n.startTime;n.currentBeat++}return null},n.animationJogger=function(){n.isRunning&&(n.doTiming(performance.now()),n.joggerTimer=setTimeout(n.animationJogger,60))},n.start=function(e,t){if(n.isRunning=!0,n.isPaused&&(n.isPaused=!1,void 0===e&&(n.justUnpaused=!0)),e)n.setProgress(e,t);else if(0===e)n.reset();else if(null!==n.pausedPercent){var r=performance.now();n.currentTime=n.lastMoment*n.pausedPercent,n.startTime=r-n.currentTime,n.pausedPercent=null,n.reportNext=!0}requestAnimationFrame(n.doTiming),n.joggerTimer=setTimeout(n.animationJogger,60)},n.pause=function(){n.isPaused=!0;var e=performance.now();n.pausedPercent=(e-n.startTime)/n.lastMoment,n.isRunning=!1,n.joggerTimer&&(clearTimeout(n.joggerTimer),n.joggerTimer=null)},n.currentMillisecond=function(){return n.currentTime},n.reset=function(){n.currentBeat=0,n.currentEvent=0,n.currentLine=0,n.startTime=null,n.pausedPercent=null},n.stop=function(){n.pause(),n.reset()},n.setProgress=function(e,t){var r;switch(t){case"seconds":n.currentTime=1e3*e,n.currentTime<0&&(n.currentTime=0),n.currentTime>n.lastMoment&&(n.currentTime=n.lastMoment),r=n.currentTime/n.lastMoment;break;case"beats":n.currentTime=e*n.millisecondsPerBeat*n.beatSubdivisions,n.currentTime<0&&(n.currentTime=0),n.currentTime>n.lastMoment&&(n.currentTime=n.lastMoment),r=n.currentTime/n.lastMoment;break;default:(r=e)<0&&(r=0),r>1&&(r=1),n.currentTime=n.lastMoment*r}n.isRunning||(n.pausedPercent=r);var i=performance.now();for(n.startTime=i-n.currentTime,n.currentEvent,n.currentEvent=0;n.noteTimings.length>n.currentEvent&&n.noteTimings[n.currentEvent].milliseconds<n.currentTime;)n.currentEvent++;if(n.lineEndCallback)for(n.currentLine=0;n.lineEndTimings.length>n.currentLine&&n.lineEndTimings[n.currentLine].milliseconds+n.lineEndAnticipation<n.currentTime;)n.currentLine++;var a=n.currentBeat;n.currentBeat=Math.floor(n.currentTime/n.millisecondsPerBeat),n.beatCallback&&a!==n.currentBeat&&n.doBeatCallback(n.startTime+n.currentTime),n.eventCallback&&n.currentEvent>=0&&"event"===n.noteTimings[n.currentEvent].type&&n.eventCallback(n.noteTimings[n.currentEvent]),n.lineEndCallback&&n.lineEndCallback(n.lineEndTimings[n.currentLine],n.noteTimings[n.currentEvent],{line:n.currentLine,endTimings:n.lineEndTimings}),n.joggerTimer=setTimeout(n.animationJogger,60)}})}function td(){if(Lh)return Oh;Lh=1;var e,t,n=ed(),r={};return r.startAnimation=function(r,i,a){function s(e){for(var t=0;t<e.length;t++){var n=e[t];n.classList.contains("abcjs-bar")||(n.style.display="none")}}var o;e&&(e.stop(),e=void 0),a.showCursor&&((t=r.querySelector(".abcjs-cursor"))||((t=document.createElement("DIV")).className="abcjs-cursor cursor",t.style.position="absolute",r.appendChild(t),r.style.position="relative")),(e=new n(i,{qpm:a.bpm,eventCallback:function(n){if(n){if(n.measureStart){var i=".abcjs-l"+(u=n).line+".abcjs-m"+u.measureNumber;i&&(c=i,a.hideCurrentMeasure?(l=c,s(r.querySelectorAll(l))):a.hideFinishedMeasures&&function(e){o&&s(r.querySelectorAll(o)),o=e}(c))}t&&(t.style.left=n.left+"px",t.style.top=n.top+"px",t.style.width=n.width+"px",t.style.height=n.height+"px")}else e.stop(),e=void 0;var c,l,u}})).start()},r.pauseAnimation=function(t){e&&(t?e.pause():e.start())},r.stopAnimation=function(){e&&(e.stop(),e=void 0)},Oh=r}function nd(){if(Rh)return Bh;Rh=1;var e={cloneArray:function(e){for(var t=[],n=0;n<e.length;n++)t.push(Object.assign({},e[n]));return t},cloneHashOfHash:function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=Object.assign({},e[n]));return t},cloneHashOfArrayOfHash:function(t){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=e.cloneArray(t[r]));return n},strip:function(e){return e.replace(/^\s+/,"").replace(/\s+$/,"")},startsWith:function(e,t){return 0===e.indexOf(t)},endsWith:function(e,t){var n=e.length-t.length;return n>=0&&e.lastIndexOf(t)===n},last:function(e){return 0===e.length?null:e[e.length-1]}};return Bh=e}function rd(){if(Fh)return Vh;Fh=1;var e=nd(),t={};return function(){var n,r,i,a,s;t.initialize=function(e,t,o,c,l){n=e,r=t,a=c,s=l,(i=o).annotationfont={face:"Helvetica",size:12,weight:"normal",style:"normal",decoration:"none"},i.gchordfont={face:"Helvetica",size:12,weight:"normal",style:"normal",decoration:"none"},i.historyfont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},i.infofont={face:'"Times New Roman"',size:14,weight:"normal",style:"italic",decoration:"none"},i.measurefont={face:'"Times New Roman"',size:14,weight:"normal",style:"italic",decoration:"none"},i.partsfont={face:'"Times New Roman"',size:15,weight:"normal",style:"normal",decoration:"none"},i.repeatfont={face:'"Times New Roman"',size:13,weight:"normal",style:"normal",decoration:"none"},i.textfont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},i.tripletfont={face:"Times",size:11,weight:"normal",style:"italic",decoration:"none"},i.vocalfont={face:'"Times New Roman"',size:13,weight:"bold",style:"normal",decoration:"none"},i.wordsfont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},a.formatting.composerfont={face:'"Times New Roman"',size:14,weight:"normal",style:"italic",decoration:"none"},a.formatting.subtitlefont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},a.formatting.tempofont={face:'"Times New Roman"',size:15,weight:"bold",style:"normal",decoration:"none"},a.formatting.titlefont={face:'"Times New Roman"',size:20,weight:"normal",style:"normal",decoration:"none"},a.formatting.footerfont={face:'"Times New Roman"',size:12,weight:"normal",style:"normal",decoration:"none"},a.formatting.headerfont={face:'"Times New Roman"',size:12,weight:"normal",style:"normal",decoration:"none"},a.formatting.voicefont={face:'"Times New Roman"',size:13,weight:"bold",style:"normal",decoration:"none"},a.formatting.tablabelfont={face:'"Trebuchet MS"',size:16,weight:"normal",style:"normal",decoration:"none"},a.formatting.tabnumberfont={face:'"Arial"',size:11,weight:"normal",style:"normal",decoration:"none"},a.formatting.tabgracefont={face:'"Arial"',size:8,weight:"normal",style:"normal",decoration:"none"},a.formatting.annotationfont=i.annotationfont,a.formatting.gchordfont=i.gchordfont,a.formatting.historyfont=i.historyfont,a.formatting.infofont=i.infofont,a.formatting.measurefont=i.measurefont,a.formatting.partsfont=i.partsfont,a.formatting.repeatfont=i.repeatfont,a.formatting.textfont=i.textfont,a.formatting.tripletfont=i.tripletfont,a.formatting.vocalfont=i.vocalfont,a.formatting.wordsfont=i.wordsfont};var o={gchordfont:!0,measurefont:!0,partsfont:!0,annotationfont:!0,composerfont:!0,historyfont:!0,infofont:!0,subtitlefont:!0,textfont:!0,titlefont:!0,voicefont:!0},c=function(e,t,n,i,a){function s(){var s=parseInt(e[0].token);return e.shift(),t?0===e.length?{face:t.face,weight:t.weight,style:t.style,decoration:t.decoration,size:s}:1===e.length&&"box"===e[0].token&&o[a]?{face:t.face,weight:t.weight,style:t.style,decoration:t.decoration,size:s,box:!0}:(r("Extra parameters in font definition.",n,i),{face:t.face,weight:t.weight,style:t.style,decoration:t.decoration,size:s}):(r("Can't set just the size of the font since there is no default value.",n,i),{face:'"Times New Roman"',weight:"normal",style:"normal",decoration:"none",size:s})}if("*"===e[0].token){if(e.shift(),"number"===e[0].type)return s();r("Expected font size number after *.",n,i)}if("number"===e[0].type)return s();for(var c,l=[],u="normal",h="normal",d="none",f=!1,p="face",m=!1;e.length;){var g=e.shift(),v=g.token.toLowerCase();switch(p){case"face":m||"utf"!==v&&"number"!==g.type&&"bold"!==v&&"italic"!==v&&"underline"!==v&&"box"!==v?l.length>0&&"-"===g.token?(m=!0,l[l.length-1]=l[l.length-1]+g.token):m?(m=!1,l[l.length-1]=l[l.length-1]+g.token):l.push(g.token):"number"===g.type?(c?r("Font size specified twice in font definition.",n,i):c=g.token,p="modifier"):"bold"===v?u="bold":"italic"===v?h="italic":"underline"===v?d="underline":"box"===v?(o[a]?f=!0:r('This font style doesn\'t support "box"',n,i),p="finished"):"utf"===v?(g=e.shift(),p="size"):r("Unknown parameter "+g.token+" in font definition.",n,i);break;case"size":"number"===g.type?c?r("Font size specified twice in font definition.",n,i):c=g.token:r("Expected font size in font definition.",n,i),p="modifier";break;case"modifier":"bold"===v?u="bold":"italic"===v?h="italic":"underline"===v?d="underline":"box"===v?(o[a]?f=!0:r('This font style doesn\'t support "box"',n,i),p="finished"):r("Unknown parameter "+g.token+" in font definition.",n,i);break;case"finished":r('Extra characters found after "box" in font definition.',n,i)}}void 0===c?t?c=t.size:(r("Must specify the size of the font since there is no default value.",n,i),c=12):c=parseFloat(c),""===(l=l.join(" "))&&(t?l=t.face:(r("Must specify the name of the font since there is no default value.",n,i),l="sans-serif"));var y=function(e){switch(e){case"Arial-Italic":return{face:"Arial",weight:"normal",style:"italic",decoration:"none"};case"Arial-Bold":return{face:"Arial",weight:"bold",style:"normal",decoration:"none"};case"Bookman-Demi":return{face:"Bookman,serif",weight:"bold",style:"normal",decoration:"none"};case"Bookman-DemiItalic":return{face:"Bookman,serif",weight:"bold",style:"italic",decoration:"none"};case"Bookman-Light":return{face:"Bookman,serif",weight:"normal",style:"normal",decoration:"none"};case"Bookman-LightItalic":return{face:"Bookman,serif",weight:"normal",style:"italic",decoration:"none"};case"Courier":return{face:'"Courier New"',weight:"normal",style:"normal",decoration:"none"};case"Courier-Oblique":return{face:'"Courier New"',weight:"normal",style:"italic",decoration:"none"};case"Courier-Bold":return{face:'"Courier New"',weight:"bold",style:"normal",decoration:"none"};case"Courier-BoldOblique":return{face:'"Courier New"',weight:"bold",style:"italic",decoration:"none"};case"AvantGarde-Book":return{face:"AvantGarde,Arial",weight:"normal",style:"normal",decoration:"none"};case"AvantGarde-BookOblique":return{face:"AvantGarde,Arial",weight:"normal",style:"italic",decoration:"none"};case"AvantGarde-Demi":case"Avant-Garde-Demi":return{face:"AvantGarde,Arial",weight:"bold",style:"normal",decoration:"none"};case"AvantGarde-DemiOblique":return{face:"AvantGarde,Arial",weight:"bold",style:"italic",decoration:"none"};case"Helvetica-Oblique":return{face:"Helvetica",weight:"normal",style:"italic",decoration:"none"};case"Helvetica-Bold":return{face:"Helvetica",weight:"bold",style:"normal",decoration:"none"};case"Helvetica-BoldOblique":return{face:"Helvetica",weight:"bold",style:"italic",decoration:"none"};case"Helvetica-Narrow":return{face:'"Helvetica Narrow",Helvetica',weight:"normal",style:"normal",decoration:"none"};case"Helvetica-Narrow-Oblique":return{face:'"Helvetica Narrow",Helvetica',weight:"normal",style:"italic",decoration:"none"};case"Helvetica-Narrow-Bold":return{face:'"Helvetica Narrow",Helvetica',weight:"bold",style:"normal",decoration:"none"};case"Helvetica-Narrow-BoldOblique":return{face:'"Helvetica Narrow",Helvetica',weight:"bold",style:"italic",decoration:"none"};case"Palatino-Roman":return{face:"Palatino",weight:"normal",style:"normal",decoration:"none"};case"Palatino-Italic":return{face:"Palatino",weight:"normal",style:"italic",decoration:"none"};case"Palatino-Bold":return{face:"Palatino",weight:"bold",style:"normal",decoration:"none"};case"Palatino-BoldItalic":return{face:"Palatino",weight:"bold",style:"italic",decoration:"none"};case"NewCenturySchlbk-Roman":return{face:'"New Century",serif',weight:"normal",style:"normal",decoration:"none"};case"NewCenturySchlbk-Italic":return{face:'"New Century",serif',weight:"normal",style:"italic",decoration:"none"};case"NewCenturySchlbk-Bold":return{face:'"New Century",serif',weight:"bold",style:"normal",decoration:"none"};case"NewCenturySchlbk-BoldItalic":return{face:'"New Century",serif',weight:"bold",style:"italic",decoration:"none"};case"Times":case"Times-Roman":case"Times-Narrow":case"Times-Courier":case"Times-New-Roman":return{face:'"Times New Roman"',weight:"normal",style:"normal",decoration:"none"};case"Times-Italic":case"Times-Italics":return{face:'"Times New Roman"',weight:"normal",style:"italic",decoration:"none"};case"Times-Bold":return{face:'"Times New Roman"',weight:"bold",style:"normal",decoration:"none"};case"Times-BoldItalic":return{face:'"Times New Roman"',weight:"bold",style:"italic",decoration:"none"};case"ZapfChancery-MediumItalic":return{face:'"Zapf Chancery",cursive,serif',weight:"normal",style:"normal",decoration:"none"};default:return null}}(l),b={};return y?(b.face=y.face,b.weight=y.weight,b.style=y.style,b.decoration=y.decoration,b.size=c,f&&(b.box=!0),b):(b.face=l,b.weight=u,b.style=h,b.decoration=d,b.size=c,f&&(b.box=!0),b)},l=function(e,t,n){return 0===t.length?'Directive "'+e+'" requires a font as a parameter.':(i[e]=c(t,i[e],n,0,e),i.is_in_header&&(a.formatting[e]=i[e]),null)},u=function(e,t){var n="";t.forEach((function(e){n+=e.token}));var r=parseFloat(n);if(isNaN(r)||0===r)return'Directive "'+e+'" requires a number as a parameter.';a.formatting.scale=r},h=["acoustic-bass-drum","bass-drum-1","side-stick","acoustic-snare","hand-clap","electric-snare","low-floor-tom","closed-hi-hat","high-floor-tom","pedal-hi-hat","low-tom","open-hi-hat","low-mid-tom","hi-mid-tom","crash-cymbal-1","high-tom","ride-cymbal-1","chinese-cymbal","ride-bell","tambourine","splash-cymbal","cowbell","crash-cymbal-2","vibraslap","ride-cymbal-2","hi-bongo","low-bongo","mute-hi-conga","open-hi-conga","low-conga","high-timbale","low-timbale","high-agogo","low-agogo","cabasa","maracas","short-whistle","long-whistle","short-guiro","long-guiro","claves","hi-wood-block","low-wood-block","mute-cuica","open-cuica","mute-triangle","open-triangle"],d=function(e,t,n,r,a){if(1!==n.length||"number"!==n[0].type)return'Directive "'+t+'" requires a number as a parameter.';var s=n[0].intt;return void 0!==r&&s<r?'Directive "'+t+'" requires a number greater than or equal to '+r+" as a parameter.":void 0!==a&&s>a?'Directive "'+t+'" requires a number less than or equal to '+a+" as a parameter.":(i[e]=s,null)},f=function(e,t,n){if(1===n.length&&("true"===n[0].token||"false"===n[0].token))return i[e]="true"===n[0].token,null;var r=d(e,t,n,0,1);return null!==r?r:(i[e]=1===i[e],null)},p=function(e,t,n,r){if(1!==n.length)return'Directive "'+t+'" requires one of [ '+r.join(", ")+" ] as a parameter.";for(var a=n[0].token,s=!1,o=0;!s&&o<r.length;o++)r[o]===a&&(s=!0);return s?(i[e]=a,null):'Directive "'+t+'" requires one of [ '+r.join(", ")+" ] as a parameter."},m=["nobarlines","barlines","beataccents","nobeataccents","droneon","droneoff","drumon","drumoff","fermatafixed","fermataproportional","gchordon","gchordoff","controlcombo","temperamentnormal","noportamento"],g=["gchord","ptstress","beatstring"],v=["bassvol","chordvol","c","channel","beatmod","deltaloudness","drumbars","gracedivider","makechordchannels","randomchordattack","chordattack","stressmodel","transpose","rtranspose","vol","volinc","gchordbars"],y=["program"],b=["ratio","snt","bendvelocity","pitchbend","control","temperamentlinear"],_=["beat"],w=["drone"],x=["portamento"],k=["expand","grace","trim"],S=["drum","chordname"],C=["bassprog","chordprog"];t.parseFontChangeLine=function(e){var t=(e=e.replace(/\$\$/g,"")).split("$");if(t.length>1&&i.setfont){var n=[];""!==t[0]&&n.push({text:t[0]});for(var r=1;r<t.length;r++)if("0"===t[r][0])n.push({text:t[r].substring(1).replace(/\x03/g,"$$")});else{var a=parseInt(t[r][0],10);i.setfont[a]?n.push({font:i.setfont[a],text:t[r].substring(1).replace(/\x03/g,"$$")}):n[n.length-1].text+="$"+t[r].replace(/\x03/g,"$$")}return n}return e.replace(/\x03/g,"$$")};var M=["auto","above","below","hidden"];function E(e){if(0===e.length)return{value:1};if(1===e.length)if("number"===e[0].type){if(e[0].floatt>=0||e[0].floatt<=1)return{value:e[0].floatt}}else{if("false"===e[0].token)return{value:0};if("true"===e[0].token)return{value:1}}return{error:"Directive stretchlast requires zero or one parameter: false, true, or number between 0 and 1 (received "+e[0].token+")"}}t.addDirective=function(o){var T=n.tokenize(o,0,o.length);if(0===T.length||"alpha"!==T[0].type)return null;var A=o.substring(o.indexOf(T[0].token)+T[0].token.length);A=n.stripComment(A);var P,I,N,D,O=T.shift().token.toLowerCase(),L="";switch(O){case"bagpipes":a.formatting.bagpipes=!0;break;case"flatbeams":a.formatting.flatbeams=!0;break;case"jazzchords":a.formatting.jazzchords=!0;break;case"accentAbove":a.formatting.accentAbove=!0;break;case"germanAlphabet":a.formatting.germanAlphabet=!0;break;case"landscape":i.landscape=!0;break;case"papersize":i.papersize=A;break;case"graceslurs":if(1!==T.length)return"Directive graceslurs requires one parameter: 0 or 1";if("0"===T[0].token||"false"===T[0].token)a.formatting.graceSlurs=!1;else{if("1"!==T[0].token&&"true"!==T[0].token)return"Directive graceslurs requires one parameter: 0 or 1 (received "+T[0].token+")";a.formatting.graceSlurs=!0}break;case"lineThickness":var B=E(T);if(void 0!==B.value&&(a.formatting.lineThickness=B.value),B.error)return B.error;break;case"stretchlast":var R=E(T);if(void 0!==R.value&&(a.formatting.stretchlast=R.value),R.error)return R.error;break;case"titlecaps":i.titlecaps=!0;break;case"titleleft":a.formatting.titleleft=!0;break;case"measurebox":a.formatting.measurebox=!0;break;case"vocal":return p("vocalPosition",O,T,M);case"dynamic":return p("dynamicPosition",O,T,M);case"gchord":return p("chordPosition",O,T,M);case"ornament":return p("ornamentPosition",O,T,M);case"volume":return p("volumePosition",O,T,M);case"botmargin":case"botspace":case"composerspace":case"indent":case"leftmargin":case"linesep":case"musicspace":case"partsspace":case"pageheight":case"pagewidth":case"rightmargin":case"stafftopmargin":case"staffsep":case"staffwidth":case"subtitlespace":case"sysstaffsep":case"systemsep":case"textspace":case"titlespace":case"topmargin":case"topspace":case"vocalspace":case"wordsspace":return I=O,N=T,0===(D=n.getMeasurement(N)).used||0!==N.length?'Directive "'+I+'" requires a measurement as a parameter.':(a.formatting[I]=D.value,null);case"voicescale":if(1!==T.length||"number"!==T[0].type)return"voicescale requires one float as a parameter";var V=T.shift();return i.currentVoice&&(i.currentVoice.scale=V.floatt,s.changeVoiceScale(i.currentVoice.scale)),null;case"voicecolor":if(1!==T.length)return"voicecolor requires one string as a parameter";var F=T.shift();return i.currentVoice&&(i.currentVoice.color=F.token,s.changeVoiceColor(i.currentVoice.color)),null;case"vskip":var z=Math.round(function(e,t){var r=n.getMeasurement(t);return 0===r.used||0!==t.length?{error:'Directive "'+e+'" requires a measurement as a parameter.'}:r.value}(O,T));return z.error?z.error:(s.addSpacing(z),null);case"scale":u(O,T);break;case"sep":if(0===T.length)s.addSeparator(14,14,85,{startChar:i.iChar,endChar:i.iChar+5});else{var j=n.getMeasurement(T);if(0===j.used)return'Directive "'+O+'" requires 3 numbers: space above, space below, length of line';var q=j.value;if(0===(j=n.getMeasurement(T)).used)return'Directive "'+O+'" requires 3 numbers: space above, space below, length of line';var H=j.value;if(0===(j=n.getMeasurement(T)).used||0!==T.length)return'Directive "'+O+'" requires 3 numbers: space above, space below, length of line';var U=j.value;s.addSeparator(q,H,U,{startChar:i.iChar,endChar:i.iChar+A.length})}break;case"barsperstaff":if(null!==(L=d("barsperstaff",O,T)))return L;break;case"staffnonote":if(1!==T.length)return"Directive staffnonote requires one parameter: 0 or 1";if("0"===T[0].token)i.staffnonote=!0;else{if("1"!==T[0].token)return"Directive staffnonote requires one parameter: 0 or 1 (received "+T[0].token+")";i.staffnonote=!1}break;case"printtempo":if(null!==(L=f("printTempo",O,T)))return L;break;case"partsbox":if(null!==(L=f("partsBox",O,T)))return L;i.partsfont.box=i.partsBox;break;case"freegchord":if(null!==(L=f("freegchord",O,T)))return L;break;case"measurenb":case"barnumbers":if(null!==(L=d("barNumbers",O,T)))return L;break;case"setbarnb":if(1!==T.length||"number"!==T[0].type)return"Directive setbarnb requires a number as a parameter.";i.currBarNumber=s.setBarNumberImmediate(T[0].intt);break;case"begintext":var G="";for(P=n.nextLine();P&&0!==P.indexOf("%%endtext");)e.startsWith(P,"%%")?G+=P.substring(2)+"\n":G+=P+"\n",P=n.nextLine();s.addText(G,{startChar:i.iChar,endChar:i.iChar+G.length+7});break;case"continueall":i.continueall=!0;break;case"beginps":for(P=n.nextLine();P&&0!==P.indexOf("%%endps");)n.nextLine();r("Postscript ignored",o,0);break;case"deco":A.length>0&&i.ignoredDecorations.push(A.substring(0,A.indexOf(" "))),r("Decoration redefinition ignored",o,0);break;case"text":var W=n.translateString(A);s.addText(t.parseFontChangeLine(W),{startChar:i.iChar,endChar:i.iChar+A.length+7});break;case"center":var Y=n.translateString(A);s.addCentered(t.parseFontChangeLine(Y));break;case"font":break;case"setfont":var $=n.tokenize(A,0,A.length);if($.length>=4&&"-"===$[0].token&&"number"===$[1].type){var K=parseInt($[1].token);K>=1&&K<=9&&(i.setfont||(i.setfont=[]),$.shift(),$.shift(),i.setfont[K]=c($,i.setfont[K],o,0,"setfont"))}break;case"gchordfont":case"partsfont":case"tripletfont":case"vocalfont":case"textfont":case"annotationfont":case"historyfont":case"infofont":case"measurefont":case"repeatfont":case"wordsfont":return l(O,T,o);case"composerfont":case"subtitlefont":case"tempofont":case"titlefont":case"voicefont":case"footerfont":case"headerfont":return function(e,t,n){return 0===t.length?'Directive "'+e+'" requires a font as a parameter.':(a.formatting[e]=c(t,a.formatting[e],n,0,e),null)}(O,T,o);case"barlabelfont":case"barnumberfont":case"barnumfont":return l("measurefont",T,o);case"staves":case"score":i.score_is_present=!0;for(var Q,X=function(t,n,r,a,s){(n||0===i.staves.length)&&i.staves.push({index:i.staves.length,numVoices:0});var o=e.last(i.staves);void 0!==r&&void 0===o.bracket&&(o.bracket=r),void 0!==a&&void 0===o.brace&&(o.brace=a),s&&(o.connectBarLines="end"),void 0===i.voices[t]&&(i.voices[t]={staffNum:o.index,index:o.numVoices},o.numVoices++)},Z=!1,J=!1,ee=!1,te=!1,ne=!1,re=!1,ie=!1,ae=function(){if(ie=!0,Q){var e="start";Q.staffNum>0&&("start"!==i.staves[Q.staffNum-1].connectBarLines&&"continue"!==i.staves[Q.staffNum-1].connectBarLines||(e="continue")),i.staves[Q.staffNum].connectBarLines=e}};T.length;){var se=T.shift();switch(se.token){case"(":Z?r("Can't nest parenthesis in %%score",o,se.start):(Z=!0,te=!0);break;case")":!Z||te?r("Unexpected close parenthesis in %%score",o,se.start):Z=!1;break;case"[":J?r("Can't nest brackets in %%score",o,se.start):(J=!0,ne=!0);break;case"]":!J||ne?r("Unexpected close bracket in %%score",o,se.start):(J=!1,i.staves[Q.staffNum].bracket="end");break;case"{":ee?r("Can't nest braces in %%score",o,se.start):(ee=!0,re=!0);break;case"}":!ee||re?r("Unexpected close brace in %%score",o,se.start):(ee=!1,i.staves[Q.staffNum].brace="end");break;case"|":ae();break;default:for(var oe="";("alpha"===se.type||"number"===se.type)&&(oe+=se.token,se.continueId);)se=T.shift();X(oe,!Z||te,ne?"start":J?"continue":void 0,re?"start":ee?"continue":void 0,ie),te=!1,ne=!1,re=!1,ie=!1,Q=i.voices[oe],"staves"===O&&ae()}}break;case"newpage":var ce=n.getInt(A);s.addNewPage(0===ce.digits?-1:ce.value);break;case"abc":var le=A.split(" ");switch(le[0]){case"-copyright":case"-creator":case"-edited-by":case"-version":case"-charset":var ue=le.shift();s.addMetaText(O+ue,le.join(" "),{startChar:i.iChar,endChar:i.iChar+A.length+5});break;default:return"Unknown directive: "+O+le[0]}break;case"header":case"footer":var he=n.getMeat(A,0,A.length);'"'===(he=A.substring(he.start,he.end))[0]&&'"'===he[he.length-1]&&(he=he.substring(1,he.length-1));var de,fe=he.split("\t");de=1===fe.length?{left:"",center:fe[0],right:""}:2===fe.length?{left:fe[0],center:fe[1],right:""}:{left:fe[0],center:fe[1],right:fe[2]},fe.length>3&&r("Too many tabs in "+O+": "+fe.length+" found.",A,0),s.addMetaTextObj(O,de,{startChar:i.iChar,endChar:i.iChar+o.length});break;case"midi":var pe=n.tokenize(A,0,A.length,!0);pe.length>0&&"="===pe[0].token&&pe.shift(),0===pe.length?r("Expected midi command",A,0):function(e,t,n){var i=e.shift().token,a=[];if(m.indexOf(i)>=0)0!==e.length&&r("Unexpected parameter in MIDI "+i,n,0);else if(g.indexOf(i)>=0)1!==e.length?r("Expected one parameter in MIDI "+i,n,0):a.push(e[0].token);else if(v.indexOf(i)>=0)1!==e.length?r("Expected one parameter in MIDI "+i,n,0):"number"!==e[0].type?r("Expected one integer parameter in MIDI "+i,n,0):a.push(e[0].intt);else if(y.indexOf(i)>=0)1!==e.length&&2!==e.length?r("Expected one or two parameters in MIDI "+i,n,0):"number"!==e[0].type||2===e.length&&"number"!==e[1].type?r("Expected integer parameter in MIDI "+i,n,0):(a.push(e[0].intt),2===e.length&&a.push(e[1].intt));else if(b.indexOf(i)>=0)2!==e.length?r("Expected two parameters in MIDI "+i,n,0):"number"!==e[0].type||"number"!==e[1].type?r("Expected two integer parameters in MIDI "+i,n,0):(a.push(e[0].intt),a.push(e[1].intt));else if(x.indexOf(i)>=0)2!==e.length?r("Expected two parameters in MIDI "+i,n,0):"alpha"!==e[0].type||"number"!==e[1].type?r("Expected one string and one integer parameters in MIDI "+i,n,0):(a.push(e[0].token),a.push(e[1].intt));else if("drummap"===i)2===e.length&&"alpha"===e[0].type&&"number"===e[1].type?(t.formatting||(t.formatting={}),t.formatting.midi||(t.formatting.midi={}),t.formatting.midi.drummap||(t.formatting.midi.drummap={}),t.formatting.midi.drummap[e[0].token]=e[1].intt,a=t.formatting.midi.drummap):3===e.length&&"punct"===e[0].type&&"alpha"===e[1].type&&"number"===e[2].type?(t.formatting||(t.formatting={}),t.formatting.midi||(t.formatting.midi={}),t.formatting.midi.drummap||(t.formatting.midi.drummap={}),t.formatting.midi.drummap[e[0].token+e[1].token]=e[2].intt,a=t.formatting.midi.drummap):r("Expected one note name and one integer parameter in MIDI "+i,n,0);else if(k.indexOf(i)>=0)3!==e.length||"number"!==e[0].type||"/"!==e[1].token||"number"!==e[2].type?r("Expected fraction parameter in MIDI "+i,n,0):(a.push(e[0].intt),a.push(e[2].intt));else if(_.indexOf(i)>=0)4!==e.length?r("Expected four parameters in MIDI "+i,n,0):"number"!==e[0].type||"number"!==e[1].type||"number"!==e[2].type||"number"!==e[3].type?r("Expected four integer parameters in MIDI "+i,n,0):(a.push(e[0].intt),a.push(e[1].intt),a.push(e[2].intt),a.push(e[3].intt));else if(w.indexOf(i)>=0)5!==e.length?r("Expected five parameters in MIDI "+i,n,0):"number"!==e[0].type||"number"!==e[1].type||"number"!==e[2].type||"number"!==e[3].type||"number"!==e[4].type?r("Expected five integer parameters in MIDI "+i,n,0):(a.push(e[0].intt),a.push(e[1].intt),a.push(e[2].intt),a.push(e[3].intt),a.push(e[4].intt));else if(y.indexOf(i)>=0)1!==e.length||4!==e.length?r("Expected one or two parameters in MIDI "+i,n,0):"number"!==e[0].type?r("Expected integer parameter in MIDI "+i,n,0):4===e.length?("octave"!==e[1].token&&r("Expected octave parameter in MIDI "+i,n,0),"="!==e[2].token&&r("Expected octave parameter in MIDI "+i,n,0),"number"!==e[3].type&&r("Expected integer parameter for octave in MIDI "+i,n,0)):(a.push(e[0].intt),4===e.length&&a.push(e[3].intt));else if(S.indexOf(i)>=0)if(e.length<2)r("Expected string parameter and at least one integer parameter in MIDI "+i,n,0);else if("alpha"!==e[0].type)r("Expected string parameter and at least one integer parameter in MIDI "+i,n,0);else{var o=e.shift();for(a.push(o.token);e.length>0;)"number"!==(o=e.shift()).type&&r("Expected integer parameter in MIDI "+i,n,0),a.push(o.intt)}else if(C.indexOf(i)>=0)if(1!==e.length&&2!==e.length)r("Expected one or two parameters in MIDI "+i,n,0);else if("number"!==e[0].type)r("Expected integer parameter in MIDI "+i,n,0);else if(2===e.length&&"alpha"!==e[1].type)r("Expected alpha parameter in MIDI "+i,n,0);else if(a.push(e[0].intt),2===e.length){var c=e[1].token;-1!=c.indexOf("octave=")?(c=c.replace("octave=",""),c=parseInt(c),isNaN(c)?r("Expected octave value in MIDI"+i):(c<-1&&(r("Expected octave= in MIDI "+i+" to be >= -1 (recv:"+c+")"),c=-1),c>3&&(r("Expected octave= in MIDI "+i+" to be <= 3 (recv:"+c+")"),c=3),a.push(c))):r("Expected octave= in MIDI"+i)}s.hasBeginMusic()?s.appendElement("midi",-1,-1,{cmd:i,params:a}):(void 0===t.formatting.midi&&(t.formatting.midi={}),t.formatting.midi[i]=a)}(pe,a,A);break;case"percmap":var me=function(e){var t=e.split(/\s+/);if(2!==t.length&&3!==t.length)return{error:'Expected parameters "abc-note", "drum-sound", and optionally "note-head"'};var n=t[0],r=parseInt(t[1],10);if((isNaN(r)||r<35||r>81)&&t[1]&&(r=h.indexOf(t[1].toLowerCase())+35),isNaN(r)||r<35||r>81)return{error:'Expected drum name, received "'+t[1]+'"'};var i={sound:r};return 3===t.length&&(i.noteHead=t[2]),{key:n,value:i}}(A);me.error?r(me.error,o,8):(a.formatting.percmap||(a.formatting.percmap={}),a.formatting.percmap[me.key]=me.value);break;case"map":case"playtempo":case"auquality":case"continuous":case"nobarcheck":a.formatting[O]=A;break;default:return"Unknown directive: "+O}return null},t.globalFormatting=function(e){for(var t in e)if(e.hasOwnProperty(t)){var s,o=""+e[t],c=n.tokenize(o,0,o.length);switch(t){case"titlefont":case"gchordfont":case"composerfont":case"footerfont":case"headerfont":case"historyfont":case"infofont":case"measurefont":case"partsfont":case"repeatfont":case"subtitlefont":case"tempofont":case"textfont":case"voicefont":case"tripletfont":case"vocalfont":case"wordsfont":case"annotationfont":case"tablabelfont":case"tabnumberfont":case"tabgracefont":l(t,c,o);break;case"scale":u(t,c);break;case"partsbox":null!==(s=f("partsBox",t,c))&&r(s),i.partsfont.box=i.partsBox;break;case"freegchord":null!==(s=f("freegchord",t,c))&&r(s);break;case"fontboxpadding":1===c.length&&"number"===c[0].type||r('Directive "'+t+'" requires a number as a parameter.'),a.formatting.fontboxpadding=c[0].floatt;break;case"stafftopmargin":1===c.length&&"number"===c[0].type||r('Directive "'+t+'" requires a number as a parameter.'),a.formatting.stafftopmargin=c[0].floatt;break;case"stretchlast":var h=E(c);if(void 0!==h.value&&(a.formatting.stretchlast=h.value),h.error)return h.error;break;default:r("Formatting directive unrecognized: ",t,0)}}}}(),Vh=t}function id(){if(Hh)return qh;Hh=1;var e=["C","C♯","D","D♯","E","F","F♯","G","G♯","A","A♯","B"],t=["C","D♭","D","E♭","E","F","G♭","G","A♭","A","B♭","B"],n=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],r=["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"];return qh=function(i,a,s,o){if(!a||a%12==0)return i;for(;a<0;)a+=12;a>11&&(a%=12);var c=i.match(/^([A-G][b#♭♯]?)([^\/]+)?\/?([A-G][b#♭♯]?)?(.+)?/);if(!c)return i;var l,u=c[1],h=c[2],d=c[3],f=c[4];return(l=e.indexOf(u))<0&&(l=t.indexOf(u)),l<0&&(l=n.indexOf(u)),l<0&&(l=r.indexOf(u)),l<0||(l+=a,l%=12,i=s?o?r[l]:t[l]:o?n[l]:e[l],h&&(i+=h),d&&((l=e.indexOf(d))<0&&(l=t.indexOf(d)),l<0&&(l=n.indexOf(d)),l<0&&(l=r.indexOf(d)),i+="/",l>=0?(l+=a,l%=12,i+=s?o?r[l]:t[l]:o?n[l]:e[l]):i+=d),f&&(i+=f)),i}}function ad(){if(Gh)return Uh;Gh=1;var e={C:{modes:["CMaj","Amin","Am","GMix","DDor","EPhr","FLyd","BLoc"],stepsFromC:0},Db:{modes:["DbMaj","Bbmin","Bbm","AbMix","EbDor","FPhr","GbLyd","CLoc"],stepsFromC:1},D:{modes:["DMaj","Bmin","Bm","AMix","EDor","F#Phr","GLyd","C#Loc"],stepsFromC:2},Eb:{modes:["EbMaj","Cmin","Cm","BbMix","FDor","GPhr","AbLyd","DLoc"],stepsFromC:3},E:{modes:["EMaj","C#min","C#m","BMix","F#Dor","G#Phr","ALyd","D#Loc"],stepsFromC:4},F:{modes:["FMaj","Dmin","Dm","CMix","GDor","APhr","BbLyd","ELoc"],stepsFromC:5},Gb:{modes:["GbMaj","Ebmin","Ebm","DbMix","AbDor","BbPhr","CbLyd","FLoc"],stepsFromC:6},G:{modes:["GMaj","Emin","Em","DMix","ADor","BPhr","CLyd","F#Loc"],stepsFromC:7},Ab:{modes:["AbMaj","Fmin","Fm","EbMix","BbDor","CPhr","DbLyd","GLoc"],stepsFromC:8},A:{modes:["AMaj","F#min","F#m","EMix","BDor","C#Phr","DLyd","G#Loc"],stepsFromC:9},Bb:{modes:["BbMaj","Gmin","Gm","FMix","CDor","DPhr","EbLyd","ALoc"],stepsFromC:10},B:{modes:["BMaj","G#min","G#m","F#Mix","C#Dor","D#Phr","ELyd","A#Loc"],stepsFromC:11},"C#":{modes:["C#Maj","A#min","A#m","G#Mix","D#Dor","E#Phr","F#Lyd","B#Loc"],stepsFromC:1},"F#":{modes:["F#Maj","D#min","D#m","C#Mix","G#Dor","A#Phr","BLyd","E#Loc"],stepsFromC:6},Cb:{modes:["CbMaj","Abmin","Abm","GbMix","DbDor","EbPhr","FbLyd","BbLoc"],stepsFromC:11}},t=null;return Uh={relativeMajor:function(n){t||function(){t={};for(var n=Object.keys(e),r=0;r<n.length;r++){var i=e[n[r]];t[n[r].toLowerCase()]=n[r];for(var a=0;a<i.modes.length;a++){var s=i.modes[a].toLowerCase();t[s]=n[r]}}}();var r=n.toLowerCase().match(/([a-g][b#]?)(maj|min|mix|dor|phr|lyd|loc|m)?/);return r&&r[2]?(r=r[1]+r[2],t[r]||n):n},relativeMode:function(t,n){var r=e[t];if(!r)return t;if(""===n)return t;var i=n.toLowerCase().match(/^(maj|min|mix|dor|phr|lyd|loc|m)/);if(!i)return t;for(var a=i[1],s=0;s<r.modes.length;s++){var o=r.modes[s],c=o.toLowerCase().indexOf(a);if(-1!==c&&c===o.length-a.length)return o.substring(0,o.length-a.length)}return t},transposeKey:function(t,n){var r=e[t];if(!r)return t;for(;n<0;)n+=12;for(var i=(r.stepsFromC+n)%12,a=0;a<Object.keys(e).length;a++){var s=Object.keys(e)[a];if(e[s].stepsFromC===i)return s}return t}}}function sd(){if(Yh)return Wh;Yh=1;var{relativeMajor:e}=ad(),t={acc:"sharp",note:"f"},n={acc:"sharp",note:"c"},r={acc:"sharp",note:"g"},i={acc:"sharp",note:"d"},a={acc:"sharp",note:"A"},s={acc:"sharp",note:"e"},o={acc:"flat",note:"B"},c={acc:"flat",note:"e"},l={acc:"flat",note:"A"},u={acc:"flat",note:"d"},h={acc:"flat",note:"G"},d={acc:"flat",note:"c"},f={"C#":[t,n,r,i,a,s,{acc:"sharp",note:"B"}],"F#":[t,n,r,i,a,s],B:[t,n,r,i,a],E:[t,n,r,i],A:[t,n,r],D:[t,n],G:[t],C:[],F:[o],Bb:[o,c],Eb:[o,c,l],Cm:[o,c,l],Ab:[o,c,l,u],Db:[o,c,l,u,h],Gb:[o,c,l,u,h,d],Cb:[o,c,l,u,h,d,{acc:"flat",note:"F"}],"A#":[o,c],"B#":[],"D#":[o,c,l],"E#":[o],"G#":[o,c,l,u],none:[]};return Wh=function(t){var n=f[e(t)];return n?JSON.parse(JSON.stringify(n)):null}}function od(){if(Kh)return $h;Kh=1;var e=function(){if(jh)return zh;jh=1;var e={};const t=["C,,,","D,,,","E,,,","F,,,","G,,,","A,,,","B,,,","C,,","D,,","E,,","F,,","G,,","A,,","B,,","C,","D,","E,","F,","G,","A,","B,","C","D","E","F","G","A","B","c","d","e","f","g","a","b","c'","d'","e'","f'","g'","a'","b'","c''","d''","e''","f''","g''","a''","b''","c'''","d'''","e'''","f'''","g'''","a'''","b'''"];return e.pitchIndex=function(e){return t.indexOf(e)},e.noteName=function(e){return t[e]},zh=e}(),t=id(),n=sd(),r={},i={C:0,"C#":1,Db:1,D:2,"D#":3,Eb:3,E:4,F:5,"F#":6,Gb:6,G:7,"G#":8,Ab:8,A:9,"A#":10,Bb:10,B:11},a=["C","Db","D","Eb","E","F","F#","G","Ab","A","Bb","B"],s=["C","C#","D","D#","E","F","F#","G","G#","A","Bb","B"];r.keySignature=function(e,t,r,o,c){if("perc"===e.clef.type||"none"===e.clef.type)return{accidentals:n(t),root:r,acc:o};c||(c=0),e.localTransposeVerticalMovement=0,e.localTransposePreferFlats=!1;var l=n(t);if(!l)return e.key;if(e.localTranspose=(e.globalTranspose?e.globalTranspose:0)+c,!e.localTranspose)return{accidentals:l,root:r,acc:o};if(e.globalTransposeOrigKeySig=l,e.localTranspose%12==0)return e.localTransposeVerticalMovement=e.localTranspose/12*7,{accidentals:l,root:r,acc:o};var u=t[0];"b"===t[1]||"#"===t[1]?(u+=t[1],t=t.substr(2)):t=t.substr(1);var h=i[u],d=void 0!==h;d||(h=0,u="C",t="");for(var f=h+e.localTranspose;f<0;)f+=12;f>11&&(f%=12);var p="m"===t[0]?s[f]:a[f],m=p+t,g=n(m);g.length>0&&"flat"===g[0].acc&&(e.localTransposePreferFlats=!0);var v=m.charCodeAt(0)-u.charCodeAt(0);return e.localTranspose>0?v<0?v+=7:0===v&&("#"!==u[1]&&"b"!==m[1]||(v+=7)):e.localTranspose<0&&(v>0?v-=7:0===v&&("b"!==u[1]&&"#"!==m[1]||(v-=7))),e.localTranspose>0?e.localTransposeVerticalMovement=v+7*Math.floor(e.localTranspose/12):e.localTransposeVerticalMovement=v+7*Math.ceil(e.localTranspose/12),d?{accidentals:g,root:p[0],acc:p.length>1?p[1]:""}:{accidentals:[],root:r,acc:o}},r.chordName=function(e,n){return t(n,e.localTranspose,e.localTransposePreferFlats,e.freegchord)};var o=["c","d","e","f","g","a","b"],c={dblflat:-2,flat:-1,natural:0,sharp:1,dblsharp:2},l={"-2":"dblflat","-1":"flat",0:"natural",1:"sharp",2:"dblsharp"},u={"-2":"__","-1":"_",0:"=",1:"^",2:"^^"};return r.note=function(t,n){if(t.localTranspose&&"perc"!==t.clef.type){var r=n.pitch;if(t.localTransposeVerticalMovement&&(n.pitch=n.pitch+t.localTransposeVerticalMovement,n.name)){var i=n.accidental?n.name.substring(1):n.name,a=n.accidental?n.name[0]:"",s=e.pitchIndex(i);n.name=a+e.noteName(s+t.localTransposeVerticalMovement)}if(n.accidental){var h=function(e,t,n,r,i){for(var a=o[(e+49)%7],s=0,l=0;l<r.length;l++)r[l].note.toLowerCase()===a&&(s=c[r[l].acc]);for(var u=c[n]-s,h=o[(t+49)%7],d=0,f=0;f<i.accidentals.length;f++)i.accidentals[f].note.toLowerCase()===h&&(d=c[i.accidentals[f].acc]);var p=u+d;return p<-2&&(t--,p+="c"===h||"f"===h?1:2),p>2&&(t++,p-="b"===h||"e"===h?1:2),[t,p]}(r,n.pitch,n.accidental,t.globalTransposeOrigKeySig,t.targetKey);n.pitch=h[0],n.accidental=l[h[1]],n.name&&(n.name=u[h[1]]+n.name.replace(/[_^=]/g,""))}}},$h=r}function cd(){if(Xh)return Qh;Xh=1;var e=rd(),t=od(),n={};return function(){var r,i,a,s;n.initialize=function(e,t,n,o,c){r=e,i=t,a=n,s=c},n.standardKey=function(e,n,r,i){return t.keySignature(a,e,n,r,i)};var o={treble:{clef:"treble",pitch:4,mid:0},"treble+8":{clef:"treble+8",pitch:4,mid:0},"treble-8":{clef:"treble-8",pitch:4,mid:0},"treble^8":{clef:"treble+8",pitch:4,mid:0},treble_8:{clef:"treble-8",pitch:4,mid:0},treble1:{clef:"treble",pitch:2,mid:2},treble2:{clef:"treble",pitch:4,mid:0},treble3:{clef:"treble",pitch:6,mid:-2},treble4:{clef:"treble",pitch:8,mid:-4},treble5:{clef:"treble",pitch:10,mid:-6},perc:{clef:"perc",pitch:6,mid:0},none:{clef:"none",mid:0},bass:{clef:"bass",pitch:8,mid:-12},"bass+8":{clef:"bass+8",pitch:8,mid:-12},"bass-8":{clef:"bass-8",pitch:8,mid:-12},"bass^8":{clef:"bass+8",pitch:8,mid:-12},bass_8:{clef:"bass-8",pitch:8,mid:-12},"bass+16":{clef:"bass",pitch:8,mid:-12},"bass-16":{clef:"bass",pitch:8,mid:-12},"bass^16":{clef:"bass",pitch:8,mid:-12},bass_16:{clef:"bass",pitch:8,mid:-12},bass1:{clef:"bass",pitch:2,mid:-6},bass2:{clef:"bass",pitch:4,mid:-8},bass3:{clef:"bass",pitch:6,mid:-10},bass4:{clef:"bass",pitch:8,mid:-12},bass5:{clef:"bass",pitch:10,mid:-14},tenor:{clef:"alto",pitch:8,mid:-8},tenor1:{clef:"alto",pitch:2,mid:-2},tenor2:{clef:"alto",pitch:4,mid:-4},tenor3:{clef:"alto",pitch:6,mid:-6},tenor4:{clef:"alto",pitch:8,mid:-8},tenor5:{clef:"alto",pitch:10,mid:-10},alto:{clef:"alto",pitch:6,mid:-6},alto1:{clef:"alto",pitch:2,mid:-2},alto2:{clef:"alto",pitch:4,mid:-4},alto3:{clef:"alto",pitch:6,mid:-6},alto4:{clef:"alto",pitch:8,mid:-8},alto5:{clef:"alto",pitch:10,mid:-10},"alto+8":{clef:"alto+8",pitch:6,mid:-6},"alto-8":{clef:"alto-8",pitch:6,mid:-6},"alto^8":{clef:"alto+8",pitch:6,mid:-6},alto_8:{clef:"alto-8",pitch:6,mid:-6}},c=function(e,t){var n=o[e];return(n?n.mid:0)+t};n.fixClef=function(e){var t=o[e.type];t&&(e.clefPos=t.pitch,e.type=t.clef)},n.deepCopyKey=function(e){var t={accidentals:[],root:e.root,acc:e.acc,mode:e.mode};return e.accidentals.forEach((function(e){t.accidentals.push(Object.assign({},e))})),t};var l={A:5,B:6,C:0,D:1,E:2,F:3,G:4,a:12,b:13,c:7,d:8,e:9,f:10,g:11};n.addPosToKey=function(e,t){var n=e.verticalPos;t.accidentals.forEach((function(e){var t=l[e.note];t-=n,e.verticalPos=t})),t.impliedNaturals&&t.impliedNaturals.forEach((function(e){var t=l[e.note];t-=n,e.verticalPos=t})),n<-10?(t.accidentals.forEach((function(e){e.verticalPos-=7,(e.verticalPos>=11||10===e.verticalPos&&"flat"===e.acc)&&(e.verticalPos-=7),"A"===e.note&&"sharp"===e.acc&&(e.verticalPos-=7),"G"!==e.note&&"F"!==e.note||"flat"!==e.acc||(e.verticalPos-=7)})),t.impliedNaturals&&t.impliedNaturals.forEach((function(e){e.verticalPos-=7,(e.verticalPos>=11||10===e.verticalPos&&"flat"===e.acc)&&(e.verticalPos-=7),"A"===e.note&&"sharp"===e.acc&&(e.verticalPos-=7),"G"!==e.note&&"F"!==e.note||"flat"!==e.acc||(e.verticalPos-=7)}))):n<-4?(t.accidentals.forEach((function(e){e.verticalPos-=7,-8!==n||"f"!==e.note&&"g"!==e.note||"sharp"!==e.acc||(e.verticalPos-=7)})),t.impliedNaturals&&t.impliedNaturals.forEach((function(e){e.verticalPos-=7,-8!==n||"f"!==e.note&&"g"!==e.note||"sharp"!==e.acc||(e.verticalPos-=7)}))):n>=7&&(t.accidentals.forEach((function(e){e.verticalPos+=7})),t.impliedNaturals&&t.impliedNaturals.forEach((function(e){e.verticalPos+=7})))},n.fixKey=function(e,t){var r=Object.assign({},t);return n.addPosToKey(e,r),r};var u=function(e){var t=0,n=e[t++];"^"!==n&&"_"!==n||(n=e[t++]);var r=l[n];for(void 0===r&&(r=6);t<e.length;t++)if(","===e[t])r-=7;else{if("'"!==e[t])break;r+=7}return{mid:r-6,str:e.substring(t)}};n.parseKey=function(t,s){0===t.length&&(t="none");var o=r.tokenize(t,0,t.length),l={};if(0===o.length)return i("Must pass in key signature.",t,0),l;switch(o[0].token){case"HP":e.addDirective("bagpipes"),a.key={root:"HP",accidentals:[],acc:"",mode:""},l.foundKey=!0,o.shift();break;case"Hp":e.addDirective("bagpipes"),a.key={root:"Hp",accidentals:[{acc:"natural",note:"g"},{acc:"sharp",note:"f"},{acc:"sharp",note:"c"}],acc:"",mode:""},l.foundKey=!0,o.shift();break;case"none":a.key={root:"none",accidentals:[],acc:"",mode:""},l.foundKey=!0,o.shift();break;default:var u=r.getKeyPitch(o[0].token);if(u.len>0){l.foundKey=!0;var h="",d="";o[0].token.length>1?o[0].token=o[0].token.substring(1):o.shift();var f=u.token;if(o.length>0){var p=r.getSharpFlat(o[0].token);if(p.len>0&&(o[0].token.length>1?o[0].token=o[0].token.substring(1):o.shift(),f+=p.token,h=p.token),o.length>0){var m=r.getMode(o[0].token);m.len>0&&(o.shift(),f+=m.token,d=m.token)}if(void 0===n.standardKey(f,u.token,h,0))return i("Unsupported key signature: "+f,t,0),l}var g,v=n.deepCopyKey(a.key),y=!s&&a.globalTranspose?-a.globalTranspose:0;if(s&&(g=a.globalTransposeOrigKeySig),a.key=n.deepCopyKey(n.standardKey(f,u.token,h,y)),s&&(a.globalTransposeOrigKeySig=g),a.key.mode=d,v){for(var b,_=0;_<a.key.accidentals.length;_++)for(b=0;b<v.accidentals.length;b++)v.accidentals[b].note&&a.key.accidentals[_].note.toLowerCase()===v.accidentals[b].note.toLowerCase()&&(v.accidentals[b].note=null);for(b=0;b<v.accidentals.length;b++)v.accidentals[b].note&&(a.key.impliedNaturals||(a.key.impliedNaturals=[]),a.key.impliedNaturals.push({acc:"natural",note:v.accidentals[b].note}))}}}if(0===o.length)return l;if("exp"===o[0].token&&o.shift(),0===o.length)return l;if("oct"===o[0].token&&o.shift(),0===o.length)return l;var w,x=r.getKeyAccidentals2(o);if(x.warn&&i(x.warn,t,0),x.accs){l.foundKey||(l.foundKey=!0,a.key={root:"none",acc:"",mode:"",accidentals:[]}),function(e){for(var t=0;t<e.length;t++)"b"===e[t].note?e[t].note="B":"a"===e[t].note?e[t].note="A":"F"===e[t].note?e[t].note="f":"E"===e[t].note?e[t].note="e":"D"===e[t].note?e[t].note="d":"C"===e[t].note?e[t].note="c":"G"===e[t].note&&"sharp"===e[t].acc?e[t].note="g":"g"===e[t].note&&"flat"===e[t].acc&&(e[t].note="G")}(x.accs);for(var k=0;k<x.accs.length;k++){for(var S=!1,C=0;C<a.key.accidentals.length&&!S;C++)a.key.accidentals[C].note===x.accs[k].note&&(S=!0,a.key.accidentals[C].acc!==x.accs[k].acc&&(a.key.accidentals[C].acc=x.accs[k].acc,a.key.explicitAccidentals||(a.key.explicitAccidentals=[]),a.key.explicitAccidentals.push(x.accs[k])));if(!S&&(a.key.explicitAccidentals||(a.key.explicitAccidentals=[]),a.key.explicitAccidentals.push(x.accs[k]),a.key.accidentals.push(x.accs[k]),a.key.impliedNaturals))for(var M=0;M<a.key.impliedNaturals.length;M++)a.key.impliedNaturals[M].note===x.accs[k].note&&a.key.impliedNaturals.splice(M,1)}}for(;o.length>0;)switch(o[0].token){case"m":case"middle":if(o.shift(),0===o.length)return i("Expected = after middle",t,0),l;if("="!==(w=o.shift()).token){i("Expected = after middle",t,w.start);break}if(0===o.length)return i("Expected parameter after middle=",t,0),l;var E=r.getPitchFromTokens(o);E.warn&&i(E.warn,t,0),E.position&&(a.clef.verticalPos=E.position-6);break;case"transpose":if(o.shift(),0===o.length)return i("Expected = after transpose",t,0),l;if("="!==(w=o.shift()).token){i("Expected = after transpose",t,w.start);break}if(0===o.length)return i("Expected parameter after transpose=",t,0),l;if("number"!==o[0].type){i("Expected number after transpose",t,o[0].start);break}a.clef.transpose=o[0].intt,o.shift();break;case"stafflines":if(o.shift(),0===o.length)return i("Expected = after stafflines",t,0),l;if("="!==(w=o.shift()).token){i("Expected = after stafflines",t,w.start);break}if(0===o.length)return i("Expected parameter after stafflines=",t,0),l;if("number"!==o[0].type){i("Expected number after stafflines",t,o[0].start);break}a.clef.stafflines=o[0].intt,o.shift();break;case"staffscale":if(o.shift(),0===o.length)return i("Expected = after staffscale",t,0),l;if("="!==(w=o.shift()).token){i("Expected = after staffscale",t,w.start);break}if(0===o.length)return i("Expected parameter after staffscale=",t,0),l;if("number"!==o[0].type){i("Expected number after staffscale",t,o[0].start);break}a.clef.staffscale=o[0].floatt,o.shift();break;case"octave":if(o.shift(),0===o.length)return i("Expected = after octave",t,0),l;if("="!==(w=o.shift()).token){i("Expected = after octave",t,w.start);break}if(0===o.length)return i("Expected parameter after octave=",t,0),l;if("number"!==o[0].type){i("Expected number after octave",t,o[0].start);break}a.octave=o[0].intt,o.shift();break;case"style":if(o.shift(),0===o.length)return i("Expected = after style",t,0),l;if("="!==(w=o.shift()).token){i("Expected = after style",t,w.start);break}if(0===o.length)return i("Expected parameter after style=",t,0),l;switch(o[0].token){case"normal":case"harmonic":case"rhythm":case"x":case"triangle":a.style=o[0].token,o.shift();break;default:i("error parsing style element: "+o[0].token,t,o[0].start)}break;case"clef":if(o.shift(),0===o.length)return i("Expected = after clef",t,0),l;if("="!==(w=o.shift()).token){i("Expected = after clef",t,w.start);break}if(0===o.length)return i("Expected parameter after clef=",t,0),l;case"treble":case"bass":case"alto":case"tenor":case"perc":case"none":var T=o.shift();switch(T.token){case"treble":case"tenor":case"alto":case"bass":case"perc":case"none":break;case"C":case"c":T.token="alto";break;case"F":case"f":T.token="bass";break;case"G":case"g":T.token="treble";break;default:i("Expected clef name. Found "+T.token,t,T.start)}o.length>0&&"number"===o[0].type&&(T.token+=o[0].token,o.shift()),o.length>1&&("-"===o[0].token||"+"===o[0].token||"^"===o[0].token||"_"===o[0].token)&&"8"===o[1].token&&(T.token+=o[0].token+o[1].token,o.shift(),o.shift()),a.clef={type:T.token,verticalPos:c(T.token,0)},a.currentVoice&&void 0!==a.currentVoice.transpose&&(a.clef.transpose=a.currentVoice.transpose),l.foundClef=!0;break;default:i("Unknown parameter: "+o[0].token,t,o[0].start),o.shift()}return l},n.parseVoice=function(e,t,n){var o=r.getMeat(e,t,n),l=o.start,h=o.end,d=r.getToken(e,l,h);if(0!==d.length){var f=!1;void 0===a.voices[d]&&(a.voices[d]={},f=!0,a.score_is_present&&i("Can't have an unknown V: id when the %score directive is present",e,l)),l+=d.length,l+=r.eatWhiteSpace(e,l);for(var p={startStaff:f},m=function(t){var n=r.getVoiceToken(e,l,h);void 0!==n.warn?i("Expected value for "+t+" in voice: "+n.warn,e,l):void 0!==n.err?i("Expected value for "+t+" in voice: "+n.err,e,l):0===n.token.length&&'"'!==e[l]?i("Expected value for "+t+" in voice",e,l):p[t]=n.token,l+=n.len},g=function(t,n,s){var o=r.getVoiceToken(e,l,h);void 0!==o.warn?i("Expected value for "+n+" in voice: "+o.warn,e,l):void 0!==o.err?i("Expected value for "+n+" in voice: "+o.err,e,l):0===o.token.length&&'"'!==e[l]?i("Expected value for "+n+" in voice",e,l):(o.token=parseFloat(o.token),a.voices[t][n]=o.token),l+=o.len},v=function(t,n){var a=r.getVoiceToken(e,l,h);if(void 0!==a.warn)i("Expected value for "+t+" in voice: "+a.warn,e,l);else if(void 0!==a.err)i("Expected value for "+t+" in voice: "+a.err,e,l);else{if(0!==a.token.length||'"'===e[l])return a.token;i("Expected value for "+t+" in voice",e,l)}l+=a.len},y=function(t,n){var s=r.getVoiceToken(e,l,h);if(void 0!==s.warn)i("Expected one of (_B, _E, _b, _e) for "+n+" in voice: "+s.warn,e,l);else if(0===s.token.length&&'"'!==e[l])i("Expected one of (_B, _E, _b, _e) for "+n+" in voice",e,l);else{var o={_B:2,_E:9,_b:-10,_e:-3}[s.token];o?a.voices[t][n]=o:i("Expected one of (_B, _E, _b, _e) for "+n+" in voice",e,l)}l+=s.len};l<h;){var b=r.getVoiceToken(e,l,h);if(l+=b.len,b.warn)i("Error parsing voice: "+b.warn,e,l);else{var _=null;switch(b.token){case"clef":case"cl":m("clef");var w=0;void 0!==p.clef&&(p.clef=p.clef.replace(/[',]/g,""),-1!==p.clef.indexOf("+16")&&(w+=14,p.clef=p.clef.replace("+16","")),p.verticalPos=c(p.clef,w));break;case"treble":case"bass":case"tenor":case"alto":case"perc":case"none":case"treble'":case"bass'":case"tenor'":case"alto'":case"none'":case"treble''":case"bass''":case"tenor''":case"alto''":case"none''":case"treble,":case"bass,":case"tenor,":case"alto,":case"none,":case"treble,,":case"bass,,":case"tenor,,":case"alto,,":case"none,,":p.clef=b.token.replace(/[',]/g,""),p.verticalPos=c(p.clef,0),a.voices[d].clef=b.token;break;case"staves":case"stave":case"stv":m("staves");break;case"brace":case"brc":m("brace");break;case"bracket":case"brk":m("bracket");break;case"name":case"nm":m("name");break;case"subname":case"sname":case"snm":m("subname");break;case"merge":p.startStaff=!1;break;case"stem":case"stems":void 0!==(_=r.getVoiceToken(e,l,h)).warn?i("Expected value for stems in voice: "+_.warn,e,l):void 0!==_.err?i("Expected value for stems in voice: "+_.err,e,l):"up"===_.token||"down"===_.token?a.voices[d].stem=_.token:i("Expected up or down for voice stem",e,l),l+=_.len;break;case"up":case"down":a.voices[d].stem=b.token;break;case"middle":case"m":m("verticalPos"),p.verticalPos=u(p.verticalPos).mid;break;case"gchords":case"gch":a.voices[d].suppressChords=!0,"0"===(_=r.getVoiceToken(e,l,h)).token&&(l+=_.len);break;case"space":case"spc":m("spacing");break;case"scale":g(d,"scale");break;case"score":y(d,"scoreTranspose");break;case"transpose":g(d,"transpose");break;case"stafflines":g(d,"stafflines");break;case"staffscale":g(d,"staffscale");break;case"octave":g(d,"octave");break;case"volume":g(d,"volume");break;case"cue":var x=v("cue");a.voices[d].scale="on"===x?.6:1;break;case"style":void 0!==(_=r.getVoiceToken(e,l,h)).warn?i("Expected value for style in voice: "+_.warn,e,l):void 0!==_.err?i("Expected value for style in voice: "+_.err,e,l):"normal"===_.token||"harmonic"===_.token||"rhythm"===_.token||"x"===_.token||"triangle"===_.token?a.voices[d].style=_.token:i("Expected one of [normal, harmonic, rhythm, x, triangle] for voice style",e,l),l+=_.len}}l+=r.eatWhiteSpace(e,l)}if((p.startStaff||0===a.staves.length)&&(a.staves.push({index:a.staves.length,meter:a.origMeter}),a.score_is_present||(a.staves[a.staves.length-1].numVoices=0)),void 0===a.voices[d].staffNum){a.voices[d].staffNum=a.staves.length-1;var k=0;for(var S in a.voices)a.voices.hasOwnProperty(S)&&a.voices[S].staffNum===a.voices[d].staffNum&&k++;a.voices[d].index=k-1}var C=a.staves[a.voices[d].staffNum];return a.score_is_present||C.numVoices++,p.clef&&(C.clef={type:p.clef,verticalPos:p.verticalPos}),p.spacing&&(C.spacing_below_offset=p.spacing),p.verticalPos&&(C.verticalPos=p.verticalPos),p.name&&(C.name?C.name.push(p.name):C.name=[p.name]),p.subname&&(C.subname?C.subname.push(p.subname):C.subname=[p.subname]),function(e){var t=a.voices[e];if(!a.currentVoice||a.currentVoice.index!==t.index||a.currentVoice.staffNum!==t.staffNum)return a.currentVoice=t,s.setCurrentVoice(t.staffNum,t.index,e)}(d)}i("Expected a voice id",e,l)}}(),Qh=n}var ld,ud,hd,dd,fd,pd,md,gd,vd,yd,bd,_d,wd,xd,kd,Sd,Cd,Md,Ed,Td,Ad,Pd,Id,Nd,Dd,Od,Ld,Bd,Rd,Vd,Fd,zd,jd,qd,Hd,Ud,Gd,Wd,Yd,$d,Kd,Qd,Xd,Zd,Jd,ef,tf,nf,rf,af,sf,of,cf,lf,uf,hf,df,ff,pf,mf,gf,vf,yf,bf,_f,wf,xf,kf,Sf,Cf,Mf,Ef,Tf,Af,Pf,If,Nf,Df,Of,Lf,Bf,Rf,Vf,Ff,zf,jf,qf,Hf,Uf,Gf,Wf,Yf,$f,Kf,Qf,Xf,Zf,Jf,ep,tp,np,rp,ip,ap,sp,op,cp,lp,up,hp,dp,fp,pp,mp,gp,vp,yp,bp,_p,wp,xp,kp,Sp,Cp,Mp,Ep,Tp,Ap,Pp,Ip,Np,Dp,Op,Lp,Bp,Rp,Vp,Fp,zp,jp,qp,Hp,Up,Gp,Wp,Yp,$p,Kp,Qp,Xp,Zp,Jp,em,tm,nm,rm,im,am,sm,om,cm,lm,um,hm,dm,fm,pm,mm,gm,vm,ym,bm,_m,wm,xm,km,Sm,Cm,Mm,Em,Tm,Am,Pm,Im,Nm,Dm,Om,Lm,Bm,Rm,Vm,Fm,zm,jm,qm,Hm,Um,Gm,Wm,Ym,$m,Km,Qm,Xm,Zm,Jm,eg,tg,ng,rg,ig,ag,sg,og,cg,lg,ug,hg,dg,fg,pg,mg,gg,vg,yg,bg,_g,wg,xg,kg,Sg,Cg,Mg,Eg,Tg,Ag,Pg,Ig,Ng,Dg,Og,Lg,Bg,Rg,Vg,Fg,zg,jg,qg,Hg,Ug,Gg,Wg,Yg,$g,Kg,Qg,Xg,Zg,Jg,ev,tv,nv,rv,iv,av,sv,ov,cv,lv={};function uv(){if(md)return pd;function e(e,t){for(var n=[],r=[],i=0,a=0;a<e.length;a++){var s=e[a],o=i+s;o<t?i=o:t-i<o-t&&i>0?(n.push(a-1),r.push(Math.round(i-s)),i=s):a<e.length-1&&(n.push(a),r.push(Math.round(i)),i=0)}return r.push(Math.round(i)),{lineBreaks:n,totals:r}}function t(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n]);return t}function n(e,n,r,i,a,s,o,c,l,u,h){for(var d=u;d<e.length;d++){var f=e[d];r+=f,i+=f;var p=Math.abs(r-n[c]);if(Math.abs(p-s)<n[0]/10)if(p<s){var m=t(a),g=t(l);g.push(d-1),m.push(i-f),h.push({accumulator:r,lineAccumulator:f,lineWidths:m,lastVariance:Math.abs(r-n[c+1]),highestVariance:Math.max(o,s),currLine:c+1,lineBreaks:g,startIndex:d+1})}else p>s&&d<e.length-1&&(m=t(a),g=t(l),h.push({accumulator:r,lineAccumulator:i,lineWidths:m,lastVariance:p,highestVariance:Math.max(o,p),currLine:c,lineBreaks:g,startIndex:d+1}));p>s?(l.push(d-1),c++,o=Math.max(o,s),s=Math.abs(r-n[c]),a.push(i-f),i=f):s=p}a.push(i)}function r(e,t,r,i){for(var a=Math.ceil(e.total/t),s=Math.floor(e.total/a),o=[],c=0;c<a;c++)o.push(s*(c+1));var l=[];l.push({accumulator:0,lineAccumulator:0,lineWidths:[],lastVariance:999999,highestVariance:0,currLine:0,lineBreaks:[],startIndex:0});for(var u=0;u<l.length;)n(e.measureWidths,o,l[u].accumulator,l[u].lineAccumulator,l[u].lineWidths,l[u].lastVariance,l[u].highestVariance,l[u].currLine,l[u].lineBreaks,l[u].startIndex,l),u++;for(c=0;c<l.length;c++){var h=l[c];h.variances=[],h.aveVariance=0;for(var d=0;d<h.lineWidths.length;d++){var f=h.lineWidths[d];h.variances.push(f-o[0]),h.aveVariance+=Math.abs(f-o[0])}h.aveVariance=h.aveVariance/h.lineWidths.length,i.attempts.push({type:"optimizeLineWidths",lineBreaks:h.lineBreaks,variances:h.variances,aveVariance:h.aveVariance,widths:e.measureWidths})}var p=9999999,m=-1;for(c=0;c<l.length;c++)(h=l[c]).aveVariance<p&&(p=h.aveVariance,m=c);return{failed:!1,lineBreaks:l[m].lineBreaks,variance:l[m].highestVariance}}function i(e,t,n){for(var r=[],i=[],a=0,s=!1,o=0;o<e.length;o++)(a+=e[o])>t&&(s=!0),o%n==n-1&&(o!==e.length-1&&r.push(o),i.push(Math.round(a)),a=0);return{failed:s,totals:i,lineBreaks:r}}return md=1,pd={wrapLines:function(e,t,n){if(t&&0!==e.lines.length){var r=e.deline({lineBreaks:!1}),i=function(e,t){for(var n=[],r=0,i=0,a=0,s=0;s<e.length;s++){var o=e[s];if(o.staff){var c=i,l=t[r];r++;for(var u=0;u<o.staff.length;u++)for(var h=o.staff[u],d=0;d<h.voices.length;d++){a=c;for(var f=0,p=0,m=h.voices[d],g=0,v=0;v<m.length;v++)"bar"===m[v].el_type&&(l[p]===f&&(n.push({ogLine:s,line:a,staff:u,voice:d,start:g,end:v}),g=v+1,a++,i=Math.max(i,a),p++),f++);n.push({ogLine:s,line:a,staff:u,voice:d,start:g,end:m.length}),a++,i=Math.max(i,a)}}else n.push({ogLine:s,line:a}),a++,i=Math.max(i,a)}return n}(r,t);e.lines=function(e,t,n){for(var r=[],i=[],a=[],s=1,o=0;o<t.length;o++){var c=t[o];if(e[c.ogLine].staff){var l=e[c.ogLine].staff[c.staff];if(r[c.line]||(r[c.line]={staff:[]}),!r[c.line].staff[c.staff]){r[c.line].staff[c.staff]={voices:[]},void 0!==n&&0===c.staff&&c.line>0&&(r[c.line].staff[c.staff].barNumber=s);for(var u=Object.keys(l),h=0;h<u.length;h++){var d="voices"===u[h];"meter"===u[h]&&0!==c.line&&(d=!0),d||(r[c.line].staff[c.staff][u[h]]=l[u[h]])}i[c.staff]&&(r[c.line].staff[c.staff].key=i[c.staff])}r[c.line].staff[c.staff].voices[c.voice]||(r[c.line].staff[c.staff].voices[c.voice]=[]),r[c.line].staff[c.staff].voices[c.voice]=e[c.ogLine].staff[c.staff].voices[c.voice].slice(c.start,c.end+1),a[10*c.staff+c.voice]&&r[c.line].staff[c.staff].voices[c.voice].unshift({el_type:"stem",direction:a[10*c.staff+c.voice].direction});for(var f=r[c.line].staff[c.staff].voices[c.voice],p=f.length-1;p>=0;p--)if("key"===f[p].el_type){i[c.staff]={root:f[p].root,acc:f[p].acc,mode:f[p].mode,accidentals:f[p].accidentals.filter((function(e){return"natural"!==e.acc}))};break}for(p=f.length-1;p>=0;p--)if("stem"===f[p].el_type){a[10*c.staff+c.voice]={direction:f[p].direction};break}if(void 0!==n&&0===c.staff&&0===c.voice)for(p=0;p<f.length;p++)"bar"===f[p].el_type&&(s++,p===f.length-1?delete f[p].barNumber:f[p].barNumber=s)}else r[c.line]=e[c.ogLine]}for(var m=0;m<r.length;m++)r[m].staff&&(r[m].staff=r[m].staff.filter((function(e){return null!=e})));return r}(r,i,n),e.lineBreaks=i}},calcLineWraps:function(t,n,a){if(0===n.length||a.staffwidth<n[0].left)return{reParse:!1,explanation:"Staff width is narrower than the margin",revisedParams:a};var s=a.scale?Math.max(a.scale,.1):1,o=a.wrap.minSpacing?Math.max(parseFloat(a.wrap.minSpacing),1):1,c=a.wrap.minSpacingLimit?Math.max(parseFloat(a.wrap.minSpacingLimit),1):o-.1,l=a.wrap.maxSpacing?Math.max(parseFloat(a.wrap.maxSpacing),1):void 0;a.wrap.lastLineLimit&&!l&&(l=Math.max(parseFloat(a.wrap.lastLineLimit),1));for(var u=a.wrap.preferredMeasuresPerLine?Math.max(parseInt(a.wrap.preferredMeasuresPerLine,10),0):void 0,h=[],d=[],f=0;f<n.length;f++){var p=n[f],m=a.staffwidth-p.left,g=m/o/s,v=m/c/s,y={widths:p,lineBreakPoint:g,minLineSize:m/l/s,attempts:[],staffWidth:a.staffwidth,minWidth:Math.round(v)},b=null;if(u){var _=i(p.measureWidths,g,u);y.attempts.push({type:"Fixed Measures Per Line",preferredMeasuresPerLine:u,lineBreaks:_.lineBreaks,failed:_.failed,totals:_.totals}),_.failed||(b=_.lineBreaks)}if(!b){var w=e(p.measureWidths,g);y.attempts.push({type:"Free Form",lineBreaks:w.lineBreaks,totals:w.totals}),(b=w.lineBreaks).length>0&&p.measureWidths.length<25&&(w=r(p,g,0,y),y.attempts.push({type:"Optimize",failed:w.failed,reason:w.reason,lineBreaks:w.lineBreaks,totals:w.totals}),w.failed||(b=w.lineBreaks))}h.push(b),d.push(y)}var x=function(e,t,n){var r={lineBreaks:e,staffwidth:t};for(var i in n)n.hasOwnProperty(i)&&"wrap"!==i&&"staffwidth"!==i&&(r[i]=n[i]);return{revisedParams:r}}(h,a.staffwidth,a);return x.explanation=d,x.reParse=!0,x}}}function hv(){if(vd)return gd;vd=1;var e={FONTEM:360,FONTSIZE:30};return e.STEP=93*e.FONTSIZE/720,e.SPACE=10,e.TOPNOTE=15,e.STAVEHEIGHT=100,e.INDENT=50,gd=e}function dv(){if(bd)return yd;var e;bd=1;var t=nd();return function(){var n=1,r=128;function i(e,t,n){for(var r=0,i=t+1;i<e.length;i++)if("note"===e[i].el_type&&r++,e[i].decoration&&e[i].decoration.indexOf(n)>=0)return r;return r}function a(e,t,n){for(var r=Math.min(e.length,t+3),i=t;i<r;i++)if("note"===e[i].el_type&&e[i].decoration)for(var a=0;a<e[i].decoration.length;a++)if(n.indexOf(e[i].decoration[a])>=0)return e[i].decoration[a];return null}function s(e){for(var t=0;t<e.length;t++)for(var n=e[t],r=n.length-1;r>=0&&"bar"!==n[r].el_type;)n[r].noChordVoice=!0,r--}function o(e,t){if(e&&!(e.length<=t)&&e[t].title)return e[t].title.join(" ")}function c(e,t){var n=1/4;e.duration&&(n=e.duration[0]);var r=60;return e.bpm&&(r=e.bpm),n*r/t}function l(e){var t;switch(e.type){case"common_time":t={el_type:"meter",num:4,den:4};break;case"cut_time":t={el_type:"meter",num:2,den:2};break;case"specified":t={el_type:"meter",num:e.value[0].num,den:e.value[0].den};break;default:t={el_type:"meter"}}return n=t.num/t.den,t}function u(e){for(var t=[],n=0;n<e.length;n++)"natural"!==e[n].acc&&t.push(e[n]);return t}function h(e,t){f(e,"HP"===t.root?{el_type:"key",accidentals:[{acc:"natural",note:"g"},{acc:"sharp",note:"f"},{acc:"sharp",note:"c"}]}:{el_type:"key",accidentals:u(t.accidentals)})}function d(e,t){f(e,l(t))}function f(e,t){for(var n=e.length-1;n>=0;n--)if(e[n].el_type===t.el_type)return void(JSON.stringify(e[n])!==JSON.stringify(t)&&e.push(t));e.push(t)}e=function(e,u){var p,m=(u=u||{}).program||0,g=u.midiTranspose||0;e.visualTranspose&&(g-=e.visualTranspose);var v=u.channel||0,y=!1,b=u.drum||"",_=u.drumBars||1,w=u.drumIntro||0,x=""!==b,k=!!u.drumOff,S=[];m=parseInt(m,10),g=parseInt(g,10),10===(v=parseInt(v,10))&&(m=r),b=b.split(" "),_=parseInt(_,10),w=parseInt(w,10);var C=e.formatting.bagpipes;C&&(m=71);var M=[];if(e.formatting.midi){var E=e.formatting.midi;E.program&&E.program.length>0&&(m=E.program[0],E.program.length>1&&(m=E.program[1],v=E.program[0]),y=!0),E.transpose&&(g=E.transpose[0]),E.channel&&(v=E.channel[0],y=!0),E.drum&&(b=E.drum),E.drumbars&&(_=E.drumbars[0]),E.drumon&&(x=!0),10===v&&(m=r),E.beat&&M.push({el_type:"beat",beats:E.beat}),E.nobeataccents&&M.push({el_type:"beataccents",value:!1})}p=u.qpm?parseInt(u.qpm,10):e.metaText.tempo?c(e.metaText.tempo,e.getBeatLength()):u.defaultQpm?u.defaultQpm:180;var T=[];C&&T.push({el_type:"bagpipes"}),T.push({el_type:"instrument",program:m}),v&&T.push({el_type:"channel",channel:v}),g&&T.push({el_type:"transpose",transpose:g}),T.push({el_type:"tempo",qpm:p});for(var A=0;A<M.length;A++)T.push(M[A]);var P,I=[],N=[],D=[],O=[0],L={};L[0]={el_type:"tempo",qpm:p,timing:0};for(var B=[],R=[],V=!1,F=e.lines,z=0;z<F.length;z++){var j=F[z];if(j.staff){let n=function(e){var t,n={pppp:[15,10,5,1],ppp:[30,20,10,1],pp:[45,35,20,1],p:[60,50,35,1],mp:[75,65,50,1],mf:[90,80,65,1],f:[105,95,80,1],ff:[120,110,95,1],fff:[127,125,110,1],ffff:[127,125,110,1]};if(e.decoration)if(e.decoration.indexOf("pppp")>=0?t="pppp":e.decoration.indexOf("ppp")>=0?t="ppp":e.decoration.indexOf("pp")>=0?t="pp":e.decoration.indexOf("p")>=0?t="p":e.decoration.indexOf("mp")>=0?t="mp":e.decoration.indexOf("mf")>=0?t="mf":e.decoration.indexOf("f")>=0?t="f":e.decoration.indexOf("ff")>=0?t="ff":e.decoration.indexOf("fff")>=0?t="fff":e.decoration.indexOf("ffff")>=0&&(t="ffff"),t&&(P=n[t].slice(0),I[H].push({el_type:"beat",beats:P.slice(0)}),N[W]=!1,D[W]=!1),e.decoration.indexOf("crescendo(")>=0){var r=i(Y,ee,"crescendo)"),s=Math.min(127,P[0]+50),o=a(Y,ee+r+1,Object.keys(n));o&&(s=n[o][0]),N[W]=r>0&&Math.floor((s-P[0])/r),D[W]=!1}else if(e.decoration.indexOf("crescendo)")>=0)N[W]=!1;else if(e.decoration.indexOf("diminuendo(")>=0){var c=i(Y,ee,"diminuendo)"),l=Math.max(15,P[0]-50),u=a(Y,ee+c+1,Object.keys(n));u&&(l=n[u][0]),N[W]=!1,D[W]=c>0&&Math.floor((l-P[0])/c)}else e.decoration.indexOf("diminuendo)")>=0&&(D[W]=!1)};for(var q=j.staff,H=0,U=0;U<q.length;U++){var G=q[U];if(!G.clef||"TAB"!==G.clef.type)for(var W=0;W<G.voices.length;W++){var Y=G.voices[W];if(!I[H]){I[H]=[].concat(JSON.parse(JSON.stringify(T)));var $=o(j.staff,H);$&&I[H].unshift({el_type:"name",trackName:$})}if(g&&"perc"===G.clef.type&&I[H].push({el_type:"transpose",transpose:0}),G.clef&&"perc"===G.clef.type&&!y)for(var K=0;K<I[H].length;K++)"instrument"===I[H][K].el_type&&(I[H][K].program=r);else G.key&&h(I[H],G.key);G.meter&&d(I[H],G.meter),!V&&x&&(I[H].push({el_type:"drum",params:{pattern:b,bars:_,on:x,intro:w}}),V=!0),G.clef&&"perc"!==G.clef.type&&G.clef.transpose&&(G.clef.el_type="clef",I[H].push({el_type:"transpose",transpose:G.clef.transpose})),G.clef&&G.clef.type&&(G.clef.type.indexOf("-8")>=0?I[H].push({el_type:"transpose",transpose:-12}):G.clef.type.indexOf("+8")>=0&&I[H].push({el_type:"transpose",transpose:12})),e.formatting.midi&&e.formatting.midi.drumoff&&(I[H].push({el_type:"bar"}),I[H].push({el_type:"drum",params:{pattern:"",on:!1}}));var Q=0,X=0,Z=0,J=0;P=[105,95,85,1];for(var ee=0;ee<Y.length;ee++){var te=Y[ee];switch(te.el_type){case"note":if(N[W]&&(P[0]+=N[W],P[1]+=N[W],P[2]+=N[W],I[H].push({el_type:"beat",beats:P.slice(0)})),D[W]&&(P[0]+=D[W],P[1]+=D[W],P[2]+=D[W],I[H].push({el_type:"beat",beats:P.slice(0)})),n(te),!te.rest||"spacer"!==te.rest.type){var ne={elem:te,el_type:"note",timing:O[H]};if(te.style?ne.style=te.style:S[H]&&(ne.style=S[H]),ne.duration=0===te.duration?.25:te.duration,te.startTriplet){if(X=te.tripletMultiplier,Z=te.startTriplet*X*te.duration,te.startTriplet!==te.tripletR&&ee+te.tripletR<=Y.length){for(var re=0,ie=ee;ie<ee+te.tripletR;ie++)re+=Y[ie].duration;Z=X*re}ne.duration=ne.duration*X,ne.duration=Math.round(1e6*ne.duration)/1e6,J=ne.duration}else X&&(te.endTriplet?(X=0,ne.duration=Math.round(1e6*(Z-J))/1e6):(ne.duration=ne.duration*X,ne.duration=Math.round(1e6*ne.duration)/1e6,J+=ne.duration));te.rest&&(ne.rest=te.rest),te.decoration&&(ne.decoration=te.decoration.slice(0)),te.pitches&&(ne.pitches=t.cloneArray(te.pitches)),te.gracenotes&&(ne.gracenotes=t.cloneArray(te.gracenotes)),te.chord&&(ne.chord=t.cloneArray(te.chord)),I[H].push(ne),"rhythm"===te.style&&s(I),Q++,O[H]+=ne.duration}break;case"key":case"keySignature":h(I[H],te);break;case"meter":d(I[H],te);break;case"clef":te.transpose&&I[H].push({el_type:"transpose",transpose:te.transpose}),te.type&&(te.type.indexOf("-8")>=0?I[H].push({el_type:"transpose",transpose:-12}):te.type.indexOf("+8")>=0&&I[H].push({el_type:"transpose",transpose:12}));break;case"tempo":p=c(te,e.getBeatLength()),I[H].push({el_type:"tempo",qpm:p,timing:O[H]}),L[""+O[H]]={el_type:"tempo",qpm:p,timing:O[H]};break;case"bar":Q>0&&I[H].push({el_type:"bar"}),n(te),Q=0;var ae="bar_right_repeat"===te.type||"bar_dbl_repeat"===te.type,se="1"===te.startEnding,oe="bar_left_repeat"===te.type||"bar_dbl_repeat"===te.type||"bar_right_repeat"===te.type;if(ae){var ce=B[H];ce||(ce=0);var le=R[H];le||(le=I[H].length);for(var ue=ce;ue<le;ue++){var he=Object.assign({},I[H][ue]);he.pitches&&(he.pitches=t.cloneArray(he.pitches)),I[H].push(he)}R[H]=void 0,B[H]=void 0}se&&(R[H]=I[H].length),oe&&(B[H]=I[H].length);break;case"style":S[H]=te.head;break;case"timeSignature":I[H].push(l(te));break;case"part":case"stem":case"scale":case"break":case"font":break;case"midi":var de=!1;switch(te.cmd){case"drumon":x=!0,de=!0;break;case"drumoff":x=!1,de=!0;break;case"drum":b=te.params,de=!0;break;case"drumbars":_=te.params[0],de=!0;break;case"drummap":break;case"channel":10===te.params[0]&&I[H].push({el_type:"instrument",program:r});break;case"program":f(I[H],{el_type:"instrument",program:te.params[0]}),y=!0;break;case"transpose":I[H].push({el_type:"transpose",transpose:te.params[0]});break;case"gchordoff":I[H].push({el_type:"gchordOn",tacet:!0});break;case"gchordon":I[H].push({el_type:"gchordOn",tacet:!1});break;case"beat":I[H].push({el_type:"beat",beats:te.params});break;case"nobeataccents":I[H].push({el_type:"beataccents",value:!1});break;case"beataccents":I[H].push({el_type:"beataccents",value:!0});break;case"vol":case"volinc":I[H].push({el_type:te.cmd,volume:te.params[0]});break;case"swing":case"gchord":case"bassvol":case"chordvol":case"gchordbars":I[H].push({el_type:te.cmd,param:te.params[0]});break;case"bassprog":case"chordprog":I[H].push({el_type:te.cmd,value:te.params[0],octaveShift:te.params[1]});break;default:console.log("MIDI seq: midi cmd not handled: ",te.cmd,te)}de&&(I[0].push({el_type:"drum",params:{pattern:b,bars:_,intro:w,on:x}}),V=!0);break;default:console.log("MIDI: element type "+te.el_type+" not handled.")}}O[++H]||(O[H]=0)}}}}if(function(e,t){if(t&&0!==t.length)for(var n=Object.keys(t),r=0;r<e.length;r++)for(var i=e[r],a=t[0]?t[0].qpm:0,s=0;s<i.length;s++){var o=i[s];"tempo"===o.el_type&&(a=o.qpm),n.indexOf(""+o.timing)>=0&&a!==t[""+o.timing].qpm&&(a=t[""+o.timing].qpm,"tempo"===o.el_type?(o.qpm=t[""+o.timing].qpm,s++):(e[r].splice(s,0,{el_type:"tempo",qpm:t[""+o.timing].qpm,timing:o.timing}),s+=2))}}(I,L),w)for(var fe=e.getPickupLength(),pe=0;pe<I.length;pe++){for(var me=0;"note"!==I[pe][me].el_type&&I[pe].length>me;)me++;if(I[pe].length>me){for(ie=0;ie<w;ie++)0===fe||ie<w-1?(I[pe].splice(me,0,{el_type:"note",rest:{type:"rest"},duration:n},{el_type:"bar"}),me+=2):I[pe].splice(me++,0,{el_type:"note",rest:{type:"rest"},duration:n-fe});k&&(x=!1,I[pe].splice(me++,0,{el_type:"drum",params:{pattern:b,bars:_,intro:w,on:x}}),k=!1)}}return I.length>0&&I[0].length>0&&(I[0][0].pickupLength=e.getPickupLength()),I}}(),yd=e}function fv(){if(kd)return xd;kd=1;var e={f0:"_C",n0:"=C",s0:"^C",x0:"C",f1:"_D",n1:"=D",s1:"^D",x1:"D",f2:"_E",n2:"=E",s2:"^E",x2:"E",f3:"_F",n3:"=F",s3:"^F",x3:"F",f4:"_G",n4:"=G",s4:"^G",x4:"G",f5:"_A",n5:"=A",s5:"^A",x5:"A",f6:"_B",n6:"=B",s6:"^B",x6:"B",f7:"_c",n7:"=c",s7:"^c",x7:"c",f8:"_d",n8:"=d",s8:"^d",x8:"d",f9:"_e",n9:"=e",s9:"^e",x9:"e",f10:"_f",n10:"=f",s10:"^f",x10:"f",f11:"_g",n11:"=g",s11:"^g",x11:"g",f12:"_a",n12:"=a",s12:"^a",x12:"a",f13:"_b",n13:"=b",s13:"^b",x13:"b",f14:"_c'",n14:"=c'",s14:"^c'",x14:"c'",f15:"_d'",n15:"=d'",s15:"^d'",x15:"d'",f16:"_e'",n16:"=e'",s16:"^e'",x16:"e'"};return xd=function(t){var n=(t.accidental?t.accidental[0]:"x")+t.verticalPos;return e[n]}}function pv(){if(Ad)return Td;Ad=1;var e=nd(),t=hv(),n=dv(),r=function(){if(Cd)return Sd;var e;Cd=1;var t=function(){if(wd)return _d;wd=1;var e=function(e,t,n,i){this.chordTrack=[],this.chordTrackFinished=!1,this.chordChannel=e,this.currentChords=[],this.lastChord,this.chordLastBar,this.chordsOff=!!t,this.gChordTacet=this.chordsOff,this.hasRhythmHead=!1,this.transpose=0,this.lastBarTime=0,this.meter=i,this.tempoChangeFactor=1,this.bassInstrument=n.bassprog&&n.bassprog.length>=1?n.bassprog[0]:0,this.chordInstrument=n.chordprog&&n.chordprog.length>=1?n.chordprog[0]:0,this.bassOctaveShift=n.bassprog&&2===n.bassprog.length?n.bassprog[1]:0,this.chordOctaveShift=n.chordprog&&2===n.chordprog.length?n.chordprog[1]:0,this.boomVolume=n.bassvol&&1===n.bassvol.length?n.bassvol[0]:64,this.chickVolume=n.chordvol&&1===n.chordvol.length?n.chordvol[0]:48,n.gchord&&n.gchord.length>0?this.overridePattern=r(n.gchord[0]):this.overridePattern=void 0};function t(e,t,r,i){var a=[];if(!e)return a;t.indexOf("boom")>=0?a.push(r?e.boom:e.boom2):i&&a.push(e.boom);var s=e.chick.length;if(t.indexOf("chick")>=0)for(var o=0;o<s;o++)a.push(e.chick[o]);switch(t){case"DO":a.push(e.chick[0]);break;case"MI":a.push(e.chick[1]);break;case"SOL":a.push(n(e,2));break;case"TI":a.push(n(e,3));break;case"TOP":a.push(n(e,4));break;case"do":a.push(e.chick[0]+12);break;case"mi":a.push(e.chick[1]+12);break;case"sol":a.push(n(e,2)+12);break;case"ti":a.push(n(e,3)+12);break;case"top":a.push(n(e,4)+12)}return a}function n(e,t){var n=Math.floor(t/e.chick.length);return e.chick[t%e.chick.length]+12*n}function r(e){for(var t=[],n=0;n<e.length;n++)switch(e[n]){case"z":case"2":t.push("");break;case"c":t.push("chick");break;case"b":t.push("boom&chick");break;case"f":t.push("boom");break;case"G":t.push("DO");break;case"H":t.push("MI");break;case"I":t.push("SOL");break;case"J":t.push("TI");break;case"K":t.push("TOP");break;case"g":t.push("do");break;case"h":t.push("mi");break;case"i":t.push("sol");break;case"j":t.push("ti");break;case"k":t.push("top")}return t}function i(e){return e/1e6}function a(e,t){return Math.round(e*t*1e6)/1e6}return e.prototype.setMeter=function(e){this.meter=e},e.prototype.setTempoChangeFactor=function(e){this.tempoChangeFactor=e},e.prototype.setLastBarTime=function(e){this.lastBarTime=e},e.prototype.setTranspose=function(e){this.transpose=e},e.prototype.setRhythmHead=function(e,t){this.hasRhythmHead=e;var n=[];if(e&&this.lastChord&&this.lastChord.chick)for(var r=0;r<this.lastChord.chick.length;r++){var i=Object.assign({},t.pitches[0]);i.actualPitch=this.lastChord.chick[r],n.push(i)}return n},e.prototype.barEnd=function(e){this.chordTrack.length>0&&!this.chordTrackFinished&&(this.resolveChords(this.lastBarTime,i(e.time)),this.currentChords=[]),this.chordLastBar=this.lastChord},e.prototype.gChordOn=function(e){this.chordsOff||(this.gChordTacet=e.tacet)},e.prototype.paramChange=function(e){switch(e.el_type){case"gchord":e.param&&e.param.length>0?this.overridePattern=r(e.param):this.overridePattern=void 0;break;case"bassprog":this.bassInstrument=e.value,null!=e.octaveShift&&null!=e.octaveShift?this.bassOctaveShift=e.octaveShift:this.bassOctaveShift=0;break;case"chordprog":this.chordInstrument=e.value,null!=e.octaveShift&&null!=e.octaveShift?this.chordOctaveShift=e.octaveShift:this.chordOctaveShift=0;break;case"bassvol":this.boomVolume=e.param;break;case"chordvol":this.chickVolume=e.param;break;default:console.log("unhandled midi param",e)}},e.prototype.finish=function(){this.chordTrackEmpty()||(this.chordTrackFinished=!0)},e.prototype.addTrack=function(e){this.chordTrackEmpty()||e.push(this.chordTrack)},e.prototype.findChord=function(e){if(this.gChordTacet)return"break";if(this.chordTrackFinished||!e.chord||0===e.chord.length)return null;for(var t=0;t<e.chord.length;t++){var n=e.chord[t];if("default"===n.position)return n.name;if(this.breakSynonyms.indexOf(n.name.toLowerCase())>=0)return"break"}return null},e.prototype.interpretChord=function(e){if(0!==e.length){if("break"===e)return{chick:[]};var t=e.substring(0,1);if("("===t){if(0===(e=e.substring(1,e.length-2)).length)return;t=e.substring(0,1)}var n=this.basses[t];if(n){for(var r=this.transpose;r<-8;)r+=12;for(;r>8;)r-=12;(n+=r)<33?n+=12:n>44&&(n-=12);var i,a=n,s=(n+=12*this.bassOctaveShift)-5;1===e.length&&(i=this.chordNotes(n,""));var o=e.substring(1),c=o.substring(0,1);"b"===c||"♭"===c?(a--,n--,s--,o=o.substring(1)):"#"!==c&&"♯"!==c||(a++,n++,s++,o=o.substring(1));var l=o.split("/");if((i=this.chordNotes(a,l[0])).length>=3&&(s=s+(i[2]-i[0])-7),2===l.length&&this.basses[l[1].substring(0,1)]){var u={"#":1,"♯":1,b:-1,"♭":-1}[l[1].substring(1)]||0;n=this.basses[l[1].substring(0,1)]+u+r,s=n+=12*this.bassOctaveShift}return{boom:n,boom2:s,chick:i}}}},e.prototype.chordNotes=function(e,t){var n=this.chordIntervals[t];n||(n="ma"===t.slice(0,2).toLowerCase()||"M"===t[0]?this.chordIntervals.M:"m"===t[0]||"-"===t[0]?this.chordIntervals.m:this.chordIntervals.M),e+=12,e+=12*this.chordOctaveShift;for(var r=[],i=0;i<n.length;i++)r.push(e+n[i]);return r},e.prototype.writeNote=function(e,t,n,r,i,s){void 0!==e&&this.chordTrack.push({cmd:"note",pitch:e,volume:n,start:this.lastBarTime+r*a(t,this.tempoChangeFactor),duration:a(i,this.tempoChangeFactor),gap:0,instrument:s})},e.prototype.chordTrackEmpty=function(){for(var e=!0,t=0;t<this.chordTrack.length&&e;t++)"note"===this.chordTrack[t].cmd&&(e=!1);return e},e.prototype.resolveChords=function(e,n){if(!this.hasRhythmHead){var r=this.meter.num,i=this.meter.den,a=1/i/2,s=parseInt(r,10)/parseInt(i,10)-(n-e)/this.tempoChangeFactor;Math.abs(s)<1e-5&&(s=0),0!==this.currentChords.length&&0===this.currentChords[0].beat||this.currentChords.unshift({beat:0,chord:this.chordLastBar});var o=function(e,t){var n=[];if(0===e.length)return n;for(var r=e[0].chord,i=1;i<e.length;i++){for(var a=e[i];n.length<a.beat;)n.push(r);r=a.chord}for(;n.length<t;)n.push(r);return n}(this.currentChords,8*r/i),c=this.overridePattern?this.overridePattern:this.rhythmPatterns[r+"/"+i];if(s){c=[];for(var l=(n-e)/this.tempoChangeFactor*8,u=0;u<l/2;u+=2)c.push("chick"),c.push("")}if(!c)for(c=[],u=0;u<8*r/i/2;u++)c.push("chick"),c.push("");var h=!0,d=Math.min(c.length,o.length);for(u=0;u<d;u++){u>0&&o[u-1]&&o[u]&&o[u-1].boom!==o[u].boom&&(h=!0);var f=c[u],p=f.indexOf("boom")>=0,m=!p&&0!==u&&c[0].indexOf("boom")>=0&&(!o[u-1]||o[u-1].boom!==o[u].boom),g=t(o[u],f,h,m);p&&(h=!1);for(var v=0;v<g.length;v++)this.writeNote(g[v],.125,p||m?this.boomVolume:this.chickVolume,u,a,p||m?this.bassInstrument:this.chordInstrument),m?m=!1:p=!1}}},e.prototype.processChord=function(e){if(!this.chordTrackFinished){var t,n=this.findChord(e);if(n){var r=this.interpretChord(n);if(r){0===this.chordTrack.length&&this.chordTrack.push({cmd:"program",channel:this.chordChannel,instrument:this.chordInstrument}),this.lastChord=r;var a=(t=this.lastBarTime,8*(i(e.time)-t));this.currentChords.push({chord:this.lastChord,beat:a,start:i(e.time)})}}}},e.prototype.breakSynonyms=["break","(break)","no chord","n.c.","tacet"],e.prototype.basses={A:33,B:35,C:36,D:38,E:40,F:41,G:43},e.prototype.chordIntervals={dim:[0,3,6],"°":[0,3,6],"˚":[0,3,6],dim7:[0,3,6,9],"°7":[0,3,6,9],"˚7":[0,3,6,9],"ø7":[0,3,6,10],"m7(b5)":[0,3,6,10],m7b5:[0,3,6,10],"m7♭5":[0,3,6,10],"-7(b5)":[0,3,6,10],"-7b5":[0,3,6,10],"7b5":[0,4,6,10],"7(b5)":[0,4,6,10],"7♭5":[0,4,6,10],"7(b9,b5)":[0,4,6,10,13],"7b9,b5":[0,4,6,10,13],"7(#9,b5)":[0,4,6,10,15],"7#9b5":[0,4,6,10,15],"maj7(b5)":[0,4,6,11],maj7b5:[0,4,6,11],"13(b5)":[0,4,6,10,14,21],"13b5":[0,4,6,10,14,21],m:[0,3,7],"-":[0,3,7],m6:[0,3,7,9],"-6":[0,3,7,9],m7:[0,3,7,10],"-7":[0,3,7,10],"-(b6)":[0,3,7,8],"-b6":[0,3,7,8],"-6/9":[0,3,7,9,14],"-7(b9)":[0,3,7,10,13],"-7b9":[0,3,7,10,13],"-maj7":[0,3,7,11],"-9+7":[0,3,7,11,13],"-11":[0,3,7,11,14,17],m11:[0,3,7,11,14,17],"-maj9":[0,3,7,11,14],"-∆9":[0,3,7,11,14],mM9:[0,3,7,11,14],M:[0,4,7],6:[0,4,7,9],"6/9":[0,4,7,9,14],"6add9":[0,4,7,9,14],69:[0,4,7,9,14],7:[0,4,7,10],9:[0,4,7,10,14],11:[0,7,10,14,17],13:[0,4,7,10,14,21],"7b9":[0,4,7,10,13],"7♭9":[0,4,7,10,13],"7(b9)":[0,4,7,10,13],"7(#9)":[0,4,7,10,15],"7#9":[0,4,7,10,15],"(13)":[0,4,7,10,14,21],"7(9,13)":[0,4,7,10,14,21],"7(#9,b13)":[0,4,7,10,15,20],"7(#11)":[0,4,7,10,14,18],"7#11":[0,4,7,10,14,18],"7(b13)":[0,4,7,10,20],"7b13":[0,4,7,10,20],"9(#11)":[0,4,7,10,14,18],"9#11":[0,4,7,10,14,18],"13(#11)":[0,4,7,10,18,21],"13#11":[0,4,7,10,18,21],maj7:[0,4,7,11],"∆7":[0,4,7,11],"Δ7":[0,4,7,11],maj9:[0,4,7,11,14],"maj7(9)":[0,4,7,11,14],"maj7(11)":[0,4,7,11,17],"maj7(#11)":[0,4,7,11,18],"maj7(13)":[0,4,7,14,21],"maj7(9,13)":[0,4,7,11,14,21],"7sus4":[0,5,7,10],m7sus4:[0,3,7,10,17],sus4:[0,5,7],sus2:[0,2,7],"7sus2":[0,2,7,10],"9sus4":[0,5,7,10,14],"13sus4":[0,5,7,10,14,21],aug7:[0,4,8,10],"+7":[0,4,8,10],"+":[0,4,8],"7#5":[0,4,8,10],"7♯5":[0,4,8,10],"7+5":[0,4,8,10],"9#5":[0,4,8,10,14],"9♯5":[0,4,8,10,14],"9+5":[0,4,8,10,14],"-7(#5)":[0,3,8,10],"-7#5":[0,3,8,10],"7(#5)":[0,4,8,10],"7(b9,#5)":[0,4,8,10,13],"7b9#5":[0,4,8,10,13],"maj7(#5)":[0,4,8,11],"maj7#5":[0,4,8,11],"maj7(#5,#11)":[0,4,8,11,18],"maj7#5#11":[0,4,8,11,18],"9(#5)":[0,4,8,10,14],"13(#5)":[0,4,8,10,14,21],"13#5":[0,4,8,10,14,21],5:[0,7],"5(8)":[0,7,12],"5add8":[0,7,12]},e.prototype.rhythmPatterns={"2/2":["boom","","","","chick","","",""],"3/2":["boom","","","","chick","","","","chick","","",""],"4/2":["boom","","","","chick","","","","boom","","","","chick","","",""],"2/4":["boom","","chick",""],"3/4":["boom","","chick","","chick",""],"4/4":["boom","","chick","","boom","","chick",""],"5/4":["boom","","chick","","chick","","boom","","chick",""],"6/4":["boom","","chick","","boom","","chick","","boom","","chick",""],"3/8":["boom","","chick"],"5/8":["boom","chick","chick","boom","chick"],"6/8":["boom","","chick","boom","","chick"],"7/8":["boom","chick","chick","boom","chick","boom","chick"],"9/8":["boom","","chick","boom","","chick","boom","","chick"],"10/8":["boom","chick","chick","boom","chick","chick","boom","chick","boom","chick"],"11/8":["boom","chick","chick","boom","chick","chick","boom","chick","boom","chick","chick"],"12/8":["boom","","chick","boom","","chick","boom","","chick","boom","","chick"]},_d=e}(),n=fv();return function(){var r,i,a,s,o,c,l,u,h,d,f,p,m,g,v,y,b,_=1,w={num:4,den:4},x=128,k=!0,S=105,C=95,M=85,E=.25,T=0,A={},P=0;function I(e){for(var t=u.length-1;t>=0;t--)if("program"===u[t].cmd)return void(u[t].channel=e)}function N(e){return e/1e6}function D(e){return Math.round(e*_*1e6)/1e6}function O(e){switch(parseInt(e.den,10)){case 2:return.5;case 4:return.25;case 8:return e.num%3==0?.375:.125;case 16:return.125}return.25}function L(e,t){var n=t.start,r=t.duration,i=D(1/32);switch(e){case"trill":for(var a=2;r>0;)u.push({cmd:"note",pitch:t.pitch+a,volume:t.volume,start:n,duration:i,gap:0,instrument:l,style:"decoration"}),a=2===a?0:2,r-=i,n+=i;break;case"mordent":u.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:n,duration:i,gap:0,instrument:l,style:"decoration"}),r-=i,n+=i,u.push({cmd:"note",pitch:t.pitch+2,volume:t.volume,start:n,duration:i,gap:0,instrument:l,style:"decoration"}),r-=i,n+=i,u.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:n,duration:r,gap:0,instrument:l});break;case"lowermordent":u.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:n,duration:i,gap:0,instrument:l,style:"decoration"}),r-=i,n+=i,u.push({cmd:"note",pitch:t.pitch-2,volume:t.volume,start:n,duration:i,gap:0,instrument:l,style:"decoration"}),r-=i,n+=i,u.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:n,duration:r,gap:0,instrument:l});break;case"turn":i=t.duration/4,u.push({cmd:"note",pitch:t.pitch+2,volume:t.volume,start:n,duration:i,gap:0,instrument:l,style:"decoration"}),u.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:n+i,duration:i,gap:0,instrument:l,style:"decoration"}),u.push({cmd:"note",pitch:t.pitch-1,volume:t.volume,start:n+2*i,duration:i,gap:0,instrument:l,style:"decoration"}),u.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:n+3*i,duration:i,gap:0,instrument:l,style:"decoration"});break;case"roll":for(;r>0;)u.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:n,duration:i,gap:0,instrument:l,style:"decoration"}),r-=2*i,n+=2*i}}function B(e,t){var r,i=function(e,t){if(t)return 0;var n;if(null!=m)n=m,m=void 0;else if(k)if(P>e)n=M;else{var r=(e-p)/O(w);n=0===r?S:parseInt(r,10)===r?C:M}else n=C;return g&&(n+=g,g=void 0),n<0&&(n=0),n>127&&(n=127),t?0:n}(N(e.time),t);if(f.processChord(e),e.gracenotes&&e.pitches&&e.pitches.length>0&&e.pitches[0]&&(r=function(e,t){for(var r,i=0,a=[],s=0;s<e.length;s++)i+=(r=e[s]).duration;var o=t/2/i;for(s=0;s<e.length;s++){var c=V(r=e[s]);if(l===x&&b){var u=n(r);u&&b[u]&&(c=b[u].sound)}var h={pitch:c,duration:r.duration*o};h=z(h),a.push(h)}return a}(e.gracenotes,e.pitches[0].duration),e.elem&&(e.elem.midiGraceNotePitches=function(e,t,n,r){var i=[];n=Math.round(n);for(var a=0;a<e.length;a++){var s=e[a];u.push({cmd:"note",pitch:s.pitch,volume:n,start:t,duration:s.duration,gap:0,instrument:r,style:"grace"}),i.push({pitch:s.pitch,durationInMeasures:s.duration,volume:n,instrument:r}),t+=s.duration}return i}(r,N(e.time),2*i/3,l))),e.elem){var a=N(e.time),s=a/E/o*60*1e3;if(void 0===e.elem.currentTrackMilliseconds)e.elem.currentTrackMilliseconds=s,e.elem.currentTrackWholeNotes=a;else if(void 0===e.elem.currentTrackMilliseconds.length)e.elem.currentTrackMilliseconds!==s&&(e.elem.currentTrackMilliseconds=[e.elem.currentTrackMilliseconds,s],e.elem.currentTrackWholeNotes=[e.elem.currentTrackWholeNotes,a]);else{for(var c=!1,h=0;h<e.elem.currentTrackMilliseconds.length;h++)e.elem.currentTrackMilliseconds[h]===s&&(c=!0);c||(e.elem.currentTrackMilliseconds.push(s),e.elem.currentTrackWholeNotes.push(a))}}if(e.pitches){var v="",y=function(e,t){var n={};if(e.decoration)for(var r=0;r<e.decoration.length;r++)"staccato"===e.decoration[r]?n.thisBreakBetweenNotes="staccato":"tenuto"===e.decoration[r]?n.thisBreakBetweenNotes="tenuto":"accent"===e.decoration[r]?n.velocity=Math.min(127,1.5*t):"trill"===e.decoration[r]?n.noteModification="trill":"lowermordent"===e.decoration[r]?n.noteModification="lowermordent":"uppermordent"===e.decoration[r]||"mordent"===e.decoration[r]?n.noteModification="mordent":"turn"===e.decoration[r]?n.noteModification="turn":"roll"===e.decoration[r]&&(n.noteModification="roll");return n}(e,i);y.thisBreakBetweenNotes&&(v=y.thisBreakBetweenNotes),y.velocity&&(i=y.velocity);var _=e.pitches;"rhythm"===e.style&&(_=f.setRhythmHead(!0,e)),e.elem&&(e.elem.midiPitches=[]);for(var A=0;A<_.length;A++){var I=_[A];if(I){I.startSlur&&(T+=I.startSlur.length),I.endSlur&&(T-=I.endSlur.length);var B=I.actualPitch?I.actualPitch:V(I);if(l===x&&b){var R=n(I);R&&b[R]&&(B=b[R].sound)}var F={cmd:"note",pitch:B,volume:i,start:N(e.time),duration:D(I.duration),instrument:l,startChar:e.elem.startChar,endChar:e.elem.endChar};if(F=z(F),e.gracenotes&&(F.duration=F.duration/2,F.start=F.start+F.duration),e.elem&&e.elem.midiPitches.push(F),y.noteModification)L(y.noteModification,F);else{switch(T>0?F.endType="tenuto":v&&(F.endType=v),F.endType){case"tenuto":F.gap=-.001;break;case"staccato":var j=.4*F.duration;F.gap=o/60*j;break;default:F.gap=0}u.push(F)}}}u.length}var q,H=(q=e).pitches&&q.pitches.length>0&&q.pitches[0]?q.pitches[0].duration:q.elem?q.elem.duration:q.duration;d=Math.max(d,N(e.time)+D(H))}e=function(e,n,x,D){n||(n={}),D||(D={}),r=[],i=[0,0,0,0,0,0,0],s=[],o=n.qpm,_=1,c=void 0,l=void 0,u=void 0,h=void 0,d=0,b=x,w={num:4,den:4},k=!0,S=105,C=95,M=85,E=.25,m=void 0,g=void 0,T=0,v=[],A={},y=1,e.length>0&&e[0].length>0&&(P=e[0][0].pickupLength),void 0===n.bassprog||D.bassprog||(D.bassprog=[n.bassprog]),void 0===n.bassvol||D.bassvol||(D.bassvol=[n.bassvol]),void 0===n.chordprog||D.chordprog||(D.chordprog=[n.chordprog]),void 0===n.chordvol||D.chordvol||(D.chordvol=[n.chordvol]),void 0===n.gchord||D.gchord||(D.gchord=[n.gchord]),f=new t(e.length,n.chordsOff,D,w),function(e,t){for(var n=0;n<e.length;n++){for(var r=e[n],i={},a=t.qpm,s=0,o=1,c=0;c<r.length;c++){var l=r[c];if("tempo"!==l.el_type){l.time=s;var u=l.duration?l.duration:0;if(s+=Math.round(u*o*1e6),l.pitches){for(var h=0;h<l.pitches.length;h++){var d=l.pitches[h];if(d)if(d.duration=l.duration,d.startTie)void 0===i[d.pitch]?i[d.pitch]={el:c,pitch:h}:(r[i[d.pitch].el].pitches[i[d.pitch].pitch].duration+=d.duration,l.pitches[h]=null);else if(d.endTie){var f=i[d.pitch];if(f){var p=d.duration;delete r[f.el].pitches[f.pitch].startTie,r[f.el].pitches[f.pitch].duration+=p,l.pitches[h]=null,delete i[d.pitch]}else delete d.endTie}}delete l.duration}}else a?o=l.qpm?a/l.qpm:1:a=l.qpm}for(var m in i)if(i.hasOwnProperty(m)){var g=i[m];delete r[g.el].pitches[g.pitch].startTie}}}(e,n);for(var L=0;L<e.length;L++){a=0,f.setTranspose(a);var R=e[L];u=[{cmd:"program",channel:L,instrument:c}],h=void 0,p=0,f.setLastBarTime(0);var V=!1;(!0===n.voicesOff||n.voicesOff&&n.voicesOff.length&&n.voicesOff.indexOf(L)>=0)&&(V=!0);for(var z=0;z<R.length;z++){var j=R[z];switch(j.el_type){case"name":h={cmd:"text",type:"name",text:j.trackName};break;case"note":B(j,V);break;case"key":i=F(j);break;case"meter":w=j,f.setMeter(w),E=O(w),H();break;case"tempo":o?_=j.qpm?o/j.qpm:1:o=j.qpm,f.setTempoChangeFactor(_);break;case"transpose":a=j.transpose,f.setTranspose(a);break;case"bar":f.barEnd(j),r=[],0===L&&U(e.length+1),f.setRhythmHead(!1),p=N(j.time),f.setLastBarTime(p);break;case"bagpipes":break;case"instrument":if(void 0===c&&(c=j.program),l=j.program,u.length>0&&"program"===u[u.length-1].cmd)u[u.length-1].instrument=j.program;else{var G;for(G=u.length-1;G>=0&&"program"!==u[G].cmd;G--);(G<0||u[G].instrument!==j.program)&&u.push({cmd:"program",channel:0,instrument:j.program})}break;case"channel":I(j.channel);break;case"drum":A=q(j.params),H();break;case"gchordOn":f.gChordOn(j);break;case"beat":S=j.beats[0],C=j.beats[1],M=j.beats[2];break;case"vol":m=j.volume;break;case"volinc":g=j.volume;break;case"beataccents":k=j.value;break;case"gchord":case"bassprog":case"chordprog":case"bassvol":case"chordvol":case"gchordbars":f.paramChange(j);break;default:console.log("MIDI creation. Unknown el_type: "+j.el_type+"\n")}}void 0===u[0].instrument&&(u[0].instrument=c||0),h&&u.unshift(h),s.push(u),f.finish(),v.length}return n.detuneOctave&&function(e,t){for(var n={},r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++){var a=e[r][i];"note"===a.cmd&&(void 0===n[a.start]&&(n[a.start]=[]),n[a.start].push({track:r,event:i,pitch:a.pitch}))}var s=Object.keys(n);for(r=0;r<s.length;r++){var o=n[s[r]];if(o.length>1){var c=(o=o.sort((function(e,t){return e.pitch-t.pitch})))[o.length-1],l=c.pitch%12,u=!1;for(i=0;!u&&i<o.length-1;i++)o[i].pitch%12===l&&(u=!0);if(u){var h=e[c.track][c.event];h.cents||(h.cents=0),h.cents+=t}}}}(s,parseInt(n.detuneOctave,10)),f.addTrack(s),v.length>0&&s.push(v),{tempo:o,instrument:c,tracks:s,totalDuration:d}};var R=[0,2,4,5,7,9,11];function V(e){if(void 0!==e.midipitch)return e.midipitch;var t=e.pitch;if(e.accidental)switch(e.accidental){case"sharp":r[t]=1;break;case"flat":r[t]=-1;break;case"natural":r[t]=0;break;case"dblsharp":r[t]=2;break;case"dblflat":r[t]=-2;break;case"quartersharp":r[t]=.25;break;case"quarterflat":r[t]=-.25}var n,s=12*(n=t,Math.floor(n/7))+R[j(t)]+60;return void 0!==r[t]?s+=r[t]:s+=i[j(t)],s+a}function F(e){var t=[0,0,0,0,0,0,0];if(!e.accidentals)return t;for(var n=0;n<e.accidentals.length;n++){var r,i=e.accidentals[n];switch(i.acc){case"flat":r=-1;break;case"quarterflat":r=-.25;break;case"sharp":r=1;break;case"quartersharp":r=.25;break;default:r=0}t[j(i.note.toLowerCase().charCodeAt(0)-"c".charCodeAt(0))]+=r}return t}function z(e){var t=""+e.pitch;return t.indexOf(".75")>=0?(e.pitch=Math.round(e.pitch),e.cents=-50):t.indexOf(".25")>=0&&(e.pitch=Math.round(e.pitch),e.cents=50),e}function j(e){return(e%=7)<0&&(e+=7),e}function q(e){if(0===e.pattern.length||!1===e.on)return{on:!1};for(var t=e.pattern[0],n=[],r="",i=0,a=0;a<t.length;a++)if("d"===t[a]&&i++,"d"===t[a]||"z"===t[a])0!==r.length?(n.push(r),r=t[a]):r+=t[a];else{if(0===r.length)return{on:!1};r+=t[a]}if(0!==r.length&&n.push(r),e.pattern.length!==2*i+1)return{on:!1};for(var s={on:!0,bars:e.bars,pattern:[]},o=O(w),c=0,l=0;l<n.length;l++){r=n[l];for(var u=1,h=!1,d=0,f=1;f<r.length;f++)switch(r[f]){case"/":0!==d&&(u*=d),d=0,h=!0;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":d=10*d+r[f];break;default:return{on:!1}}h?(0===d&&(d=2),u/=d):d&&(u*=d),"d"===r[0]?(s.pattern.push({len:u*o,pitch:e.pattern[1+c],velocity:e.pattern[1+c+i]}),c++):s.pattern.push({len:u*o,pitch:null})}return y=e.bars?e.bars:1,s}function H(){if(A&&A.pattern){for(var e=A,t=0,n=w.num/w.den,r=0;r<e.pattern.length;r++)t+=e.pattern[r].len;var i=t/y/n;for(r=0;r<e.pattern.length;r++)e.pattern[r].len=e.pattern[r].len/i;A=e}}function U(e){if(0!==v.length||A.on){var t=w.num/w.den;if(0===v.length){if(d<t)return;v.push({cmd:"program",channel:e,instrument:x})}if(A.on)for(var n=p,r=0;r<A.pattern.length;r++){var i=D(A.pattern[r].len);A.pattern[r].pitch&&v.push({cmd:"note",pitch:A.pattern[r].pitch,volume:A.pattern[r].velocity,start:n,duration:i,gap:0,instrument:x}),n+=i}}}}(),Sd=e}(),i=function(){if(Ed)return Md;function e(e,t){return"abselem"===e?"abselem":t}function t(e,t){e.el_type="meter",e.startChar=-1,e.endChar=-1;for(var n=0;n<t.length;n++)t[n].unshift(e)}function n(e,t){e.el_type="key",e.startChar=-1,e.endChar=-1;for(var n=0;n<t.length;n++)t[n].unshift(e)}function r(e,t){e.el_type="clef",e.startChar=-1,e.endChar=-1;for(var n=0;n<t.length;n++)t[n].unshift(e)}function i(e,t,n){e.el_type="font",e.type=n,e.startChar=-1,e.endChar=-1;for(var r=0;r<t.length;r++)t[r].unshift(e)}function a(t,n){return!t||JSON.stringify(t,e)===JSON.stringify(n,e)}function s(e){for(var t={},n=Object.keys(e),r=0;r<n.length;r++)if("staff"!==n[r])t[n[r]]=e[n[r]];else{t.staff=[];for(var i=0;i<e.staff.length;i++){for(var a={},s=Object.keys(e.staff[i]),o=0;o<s.length;o++)if("voices"!==s[o])a[s[o]]=e.staff[i][s[o]];else{a.voices=[];for(var c=0;c<e.staff[i].voices.length;c++)a.voices.push([].concat(e.staff[i].voices[c]))}t.staff.push(a)}}return t}return Ed=1,Md=function(e,o){o||(o={});for(var c=!!o.lineBreaks,l=[],u=!1,h=[],d=[],f=[],p=[],m=[],g=[],v=[],y=0;y<e.length;y++){var b=e[y];if(b.staff){if(u&&!b.vskip)for(var _=l[l.length-1],w=0;w<_.staff.length;w++){var x=b.staff[w],k=_.staff[w];if(x&&(a(x.meter,h[w])||(t(x.meter,x.voices),h[w]=x.meter,delete x.meter),a(x.key,d[w])||(n(x.key,x.voices),d[w]=x.key,delete x.key),x.title&&(k.abbrevTitle=x.title),a(x.clef,f[w])||(r(x.clef,x.voices),f[w]=x.clef,delete x.clef),a(x.vocalfont,p[w])||(i(x.vocalfont,x.voices,"vocalfont"),p[w]=x.vocalfont,delete x.vocalfont),a(x.gchordfont,m[w])||(i(x.gchordfont,x.voices,"gchordfont"),m[w]=x.gchordfont,delete x.gchordfont),a(x.tripletfont,g[w])||(i(x.tripletfont,x.voices,"tripletfont"),g[w]=x.tripletfont,delete x.tripletfont),a(x.annotationfont,v[w])||(i(x.annotationfont,x.voices,"annotationfont"),v[w]=x.annotationfont,delete x.annotationfont)),x)for(var S=0;S<k.voices.length;S++){var C=k.voices[S],M=x.voices[S];c&&C.push({el_type:"break"}),M&&(k.voices[S]=C.concat(M))}}else{for(var E=0;E<b.staff.length;E++)d[E]=b.staff[E].key,h[E]=b.staff[E].meter,f[E]=b.staff[E].clef;l.push(s(b))}u=!0}else u=!1,l.push(b)}return l}}();return Td=function(){function a(e,t,n,r){for(var i=0;i<r.length;i++)e[n][r[i]]=t[n][r[i]]}function s(e,t){for(;t<e.length&&null===e[t].left;)t++;return e[t]}this.reset=function(){this.version="1.1.0",this.media="screen",this.metaText={},this.metaTextInfo={},this.formatting={},this.lines=[],this.staffNum=0,this.voiceNum=0,this.lineNum=0,this.runningFonts={},delete this.visualTranspose},this.reset(),this.copyTopInfo=function(e){var t=["tempo","title","header","rhythm","origin","composer","author","partOrder"];a(this,e,"metaText",t),a(this,e,"metaTextInfo",t)},this.copyBottomInfo=function(e){var t=["unalignedWords","book","source","discography","notes","transcription","history","abc-copyright","abc-creator","abc-edited-by","footer"];a(this,e,"metaText",t),a(this,e,"metaTextInfo",t)},this.getBeatLength=function(){var e=this.getMeterFraction(),t=1;return(6===e.num||9===e.num||12===e.num||3===e.num&&8===e.den)&&(t=3),t/e.den},this.getPickupLength=function(){var e=this.getBarLength(),t=function(e,t){for(var n=0,r=0;r<e.length;r++)if(e[r].staff)for(var i=0;i<e[r].staff.length;i++)for(var a=0;a<e[r].staff[i].voices.length;a++)for(var s=e[r].staff[i].voices[a],o=1,c=0;c<s.length;c++){var l=s[c].rest&&"spacer"===s[c].rest.type;if(s[c].startTriplet&&(o=s[c].tripletMultiplier),s[c].duration&&!l&&"tempo"!==s[c].el_type&&(n+=s[c].duration*o),s[c].endTriplet&&(o=1),n>=t&&(n-=t),"bar"===s[c].el_type)return n}return n}(this.lines,e);return t<1e-8||e-t<1e-8?0:t},this.getBarLength=function(){var e=this.getMeterFraction();return e.num/e.den},this.getTotalTime=function(){return this.totalTime},this.getTotalBeats=function(){return this.totalBeats},this.millisecondsPerMeasure=function(e){var t;if(e)t=e;else{var n=this.metaText?this.metaText.tempo:null;t=this.getBpm(n)}return t<=0&&(t=1),this.getBeatsPerMeasure()/t*6e4},this.getBeatsPerMeasure=function(){var e=this.getBeatLength();return this.getBarLength()/e},this.getMeter=function(){for(var e=0;e<this.lines.length;e++){var t=this.lines[e];if(t.staff)for(var n=0;n<t.staff.length;n++){var r=t.staff[n].meter;if(r)return r}}return{type:"common_time"}},this.getMeterFraction=function(){var e=this.getMeter(),t=4,n=4;return e&&("specified"===e.type?(t=parseInt(e.value[0].num,10),n=parseInt(e.value[0].den,10)):"cut_time"===e.type?(t=2,n=2):"common_time"===e.type&&(t=4,n=4)),this.meter={num:t,den:n},this.meter},this.getKeySignature=function(){for(var e=0;e<this.lines.length;e++){var t=this.lines[e];if(t.staff)for(var n=0;n<t.staff.length;n++)if(t.staff[n].key)return t.staff[n].key}return{}},this.getElementFromChar=function(e){for(var t=0;t<this.lines.length;t++){var n=this.lines[t];if(n.staff)for(var r=0;r<n.staff.length;r++)for(var i=n.staff[r],a=0;a<i.voices.length;a++)for(var s=i.voices[a],o=0;o<s.length;o++){var c=s[o];if(c.startChar&&c.endChar&&c.startChar<=e&&c.endChar>e)return c}}return null},this.addElementToEvents=function(t,n,r,i,a,s,o,c,l,u){if(n.hint)return{isTiedState:void 0,duration:0};var h=n.durationClass?n.durationClass:n.duration;if(n.abcelem.rest&&"spacer"===n.abcelem.rest.type&&(h=0),h>0){for(var d=[],f=0;f<n.elemset.length;f++)null!==n.elemset[f]&&d.push(n.elemset[f]);var p=n.startTie;if(void 0!==l)t["event"+l].elements.push(d),u&&(t["event"+r]||(t["event"+r]={type:"event",milliseconds:r,line:s,measureNumber:o,top:i,height:a,left:null,width:0,elements:[],startChar:null,endChar:null,startCharArray:[],endCharArray:[]}),t["event"+r].measureStart=!0,u=!1),p||(l=void 0);else{if(t["event"+r]){if(t["event"+r].left?t["event"+r].left=Math.min(t["event"+r].left,n.x):t["event"+r].left=n.x,t["event"+r].elements.push(d),t["event"+r].startCharArray.push(n.abcelem.startChar),t["event"+r].endCharArray.push(n.abcelem.endChar),null===t["event"+r].startChar&&(t["event"+r].startChar=n.abcelem.startChar),null===t["event"+r].endChar&&(t["event"+r].endChar=n.abcelem.endChar),n.abcelem.midiPitches&&n.abcelem.midiPitches.length)for(t["event"+r].midiPitches||(t["event"+r].midiPitches=[]),f=0;f<n.abcelem.midiPitches.length;f++)t["event"+r].midiPitches.push(n.abcelem.midiPitches[f]);if(n.abcelem.midiGraceNotePitches&&n.abcelem.midiGraceNotePitches.length){t["event"+r].midiGraceNotePitches||(t["event"+r].midiGraceNotePitches=[]);for(var m=0;m<n.abcelem.midiGraceNotePitches.length;m++)t["event"+r].midiGraceNotePitches.push(n.abcelem.midiGraceNotePitches[m])}}else t["event"+r]={type:"event",milliseconds:r,line:s,measureNumber:o,top:i,height:a,left:n.x,width:n.w,elements:[d],startChar:n.abcelem.startChar,endChar:n.abcelem.endChar,startCharArray:[n.abcelem.startChar],endCharArray:[n.abcelem.endChar],midiPitches:n.abcelem.midiPitches?e.cloneArray(n.abcelem.midiPitches):[]},n.abcelem.midiGraceNotePitches&&(t["event"+r].midiGraceNotePitches=e.cloneArray(n.abcelem.midiGraceNotePitches));u&&(t["event"+r].measureStart=!0,u=!1)}}return{isTiedState:l,duration:h/c,nextIsBar:u||"bar"===n.type}},this.makeVoicesArray=function(){for(var e=[],n=[],r={},i=0;i<this.engraver.staffgroups.length;i++){var a=this.engraver.staffgroups[i];if(a&&a.staffs&&a.staffs.length>0)for(var s=a.staffs[0],o=s.absoluteY,c=o-s.top*t.STEP,l=a.staffs[a.staffs.length-1],u=(o=l.absoluteY)-l.bottom*t.STEP-c,h=a.voices,d=0;d<h.length;d++)if(!h[d].staff||!h[d].staff.isTabStaff){var f=!1;e[d]||(e[d]=[]),void 0===n[d]&&(n[d]=0);for(var p=h[d].children,m=0;m<p.length;m++)"tempo"===p[m].type&&(r[n[d]]=this.getBpm(p[m].abcelem)),e[d].push({top:c,height:u,line:a.line,measureNumber:n[d],elem:p[m]}),"bar"===p[m].type&&f&&n[d]++,"note"!==p[m].type&&"rest"!==p[m].type||(f=!0)}}return this.tempoLocations=r,e},this.setupEvents=function(e,t,n,r){r||(r=1);for(var i,a=[],o={},c=e,l=!0,u=this.makeVoicesArray(),h=0,d=0;d<u.length;d++){var f=c,p=Math.round(1e3*f),m=0,g=-1,v=u[d],y=n;t=this.getBeatLength()*y/60;for(var b=-1,_=0;_<v.length;_++){var w=v[_].measureNumber;b!==w&&this.tempoLocations[w]&&(y=this.tempoLocations[w],t=r*this.getBeatLength()*y/60,b=w);var x,k=v[_].elem,S=this.addElementToEvents(o,k,p,v[_].top,v[_].height,v[_].line,v[_].measureNumber,t,i,l);if(i=S.isTiedState,l=S.nextIsBar,f+=S.duration,k.duration>0&&o["event"+p]&&(x="event"+p),p=Math.round(1e3*f),"bar"===k.type){var C=k.abcelem.type,M="bar_right_repeat"===C||"bar_dbl_repeat"===C,E="1"===k.abcelem.startEnding,T="bar_left_repeat"===C||"bar_dbl_repeat"===C||"bar_right_repeat"===C;if(M){_>0&&(o[x].endX=k.x),-1===g&&(g=_);var A=0;b=-1;for(var P=m;P<g;P++){b!==(w=v[P].measureNumber)&&this.tempoLocations[w]&&(y=this.tempoLocations[w],t=r*this.getBeatLength()*y/60,b=w);var I=v[P].elem;i=(S=this.addElementToEvents(o,I,p,v[P].top,v[P].height,v[P].line,v[P].measureNumber,t,i,l)).isTiedState,l=S.nextIsBar,f+=S.duration,A=p,p=Math.round(1e3*f)}o["event"+A]&&(o["event"+A].endX=v[g].elem.x),l=!0,g=-1}E&&(g=_),T&&(m=_)}}h=Math.max(h,p)}return function(e){for(var t,n,r,i,a=e.length-1;a>=0;a--){var s=e[a];"bar"===s.type?(s.top=r,s.nextTop=t,t=r,s.bottom=i,s.nextBottom=n,n=i):"event"===s.type&&(r=s.top,i=s.top+s.height)}}(a=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t.sort((function(e,t){var n=e.milliseconds-t.milliseconds;return 0!==n?n:"bar"===e.type?-1:1}))}(o)),function(e,t){if(!(t.length<1)){for(var n=0;n<t.length-1;n++){var r=t[n],i=s(t,n+1);if(null!==r.left){var a=i&&r.top===i.top?i.left:e[r.line].staffGroup.w;void 0!==r.endX?a>r.left&&(r.endX=Math.min(r.endX,a)):r.endX=a}}var o=t[t.length-1];o.endX=e[o.line].staffGroup.w}}(this.lines,a),a.push({type:"end",milliseconds:h}),this.addUsefulCallbackInfo(a,y*r),a},this.addUsefulCallbackInfo=function(e,t){for(var n=this.millisecondsPerMeasure(t),r=0;r<e.length;r++)e[r].millisecondsPerMeasure=n},this.getBpm=function(e){var t;if(e||(e=this.metaText?this.metaText.tempo:null),e){t=e.bpm;var n=this.getBeatLength();t=t*(e.duration&&e.duration.length>0?e.duration[0]:n)/n}if(!t){t=180;var r=this.getMeterFraction();r&&3!==r.num&&r.num%3==0&&(t=120)}return t},this.setTiming=function(e,t){if(t=t||0,!this.engraver||!this.engraver.staffgroups)return console.log("setTiming cannot be called before the tune is drawn."),this.noteTimings=[],this.noteTimings;var n=this.metaText?this.metaText.tempo:null,r=this.getBpm(n),i=1;e?n&&(i=e/r):e=r;var a=this.getBeatLength(),s=e/60,o=this.getBarLength()/a*t/s;o&&(o-=this.getPickupLength()/a/s);var c=a*s;return this.noteTimings=this.setupEvents(o,c,e,i),this.noteTimings.length>0?(this.totalTime=this.noteTimings[this.noteTimings.length-1].milliseconds/1e3,this.totalBeats=this.totalTime*s):(this.totalTime=void 0,this.totalBeats=void 0),this.noteTimings},this.setUpAudio=function(e){e||(e={});var t=n(this,e);return r(t,e,this.formatting.percmap,this.formatting.midi)},this.deline=function(e){return i(this.lines,e)},this.findSelectableElement=function(e){return this.engraver&&this.engraver.selectables?this.engraver.findSelectableElement(e):null},this.getSelectableArray=function(){return this.engraver&&this.engraver.selectables?this.engraver.selectables:[]}}}function mv(){if(Dd)return Nd;Dd=1;var e=nd(),t=rd(),n=function(){if(Jh)return Zh;Jh=1;var e=nd(),t=rd(),n=cd();return Zh=function(r,i,a,s,o){this.reset=function(e,r,i,a){n.initialize(e,r,i,a,o),t.initialize(e,r,i,a,o)},this.reset(r,i,a,s),this.setTitle=function(e,t){a.hasMainTitle?o.addSubtitle(e,{startChar:a.iChar,endChar:a.iChar+t+2}):(o.addMetaText("title",e,{startChar:a.iChar,endChar:a.iChar+t+2}),a.hasMainTitle=!0)},this.setMeter=function(e){if("C"===(e=r.stripComment(e)))return!0===a.havent_set_length&&(a.default_length=.125,a.havent_set_length=!1),{type:"common_time"};if("C|"===e)return!0===a.havent_set_length&&(a.default_length=.125,a.havent_set_length=!1),{type:"cut_time"};if("o"===e)return!0===a.havent_set_length&&(a.default_length=.125,a.havent_set_length=!1),{type:"tempus_perfectum"};if("c"===e)return!0===a.havent_set_length&&(a.default_length=.125,a.havent_set_length=!1),{type:"tempus_imperfectum"};if("o."===e)return!0===a.havent_set_length&&(a.default_length=.125,a.havent_set_length=!1),{type:"tempus_perfectum_prolatio"};if("c."===e)return!0===a.havent_set_length&&(a.default_length=.125,a.havent_set_length=!1),{type:"tempus_imperfectum_prolatio"};if(0===e.length||"none"===e.toLowerCase())return!0===a.havent_set_length&&(a.default_length=.125,a.havent_set_length=!1),null;var t=r.tokenize(e,0,e.length);try{var n=function(){var e=function(){var e={value:0,num:""},n=t.shift();for("("===n.token&&(n=t.shift());;){if("number"!==n.type)throw"Expected top number of meter";if(e.value+=parseInt(n.token),e.num+=n.token,0===t.length||"/"===t[0].token)return e;if(")"===(n=t.shift()).token){if(0===t.length||"/"===t[0].token)return e;throw"Unexpected paren in meter"}if("."!==n.token&&"+"!==n.token)throw"Expected top number of meter";if(e.num+=n.token,0===t.length)throw"Expected top number of meter";n=t.shift()}return e}();if(0===t.length)return e;var n=t.shift();if("/"!==n.token)throw"Expected slash in meter";if("number"!==(n=t.shift()).type)throw"Expected bottom number of meter";return e.den=n.token,e.value=e.value/parseInt(e.den),e};if(0===t.length)throw"Expected meter definition in M: line";for(var s={type:"specified",value:[]},o=0;;){var c=n();o+=c.value;var l={num:c.num};if(void 0!==c.den&&(l.den=c.den),s.value.push(l),0===t.length)break}return!0===a.havent_set_length&&(a.default_length=o<.75?.0625:.125,a.havent_set_length=!1),s}catch(u){i(u,e,0)}return null},this.calcTempo=function(e){var t=1/4;a.meter&&"specified"===a.meter.type?t=1/parseInt(a.meter.value[0].den):a.origMeter&&"specified"===a.origMeter.type&&(t=1/parseInt(a.origMeter.value[0].den));for(var n=0;n<e.duration;n++)e.duration[n]=t*e.duration[n];return e},this.resolveTempo=function(){a.tempo&&(this.calcTempo(a.tempo),s.metaText.tempo=a.tempo,delete a.tempo)},this.addUserDefinition=function(t,n,r){var s=t.indexOf("=",n);if(-1!==s){var o=e.strip(t.substring(n,s)),c=e.strip(t.substring(s+1));1===o.length?-1!=="HIJKLMNOPQRSTUVWXYhijklmnopqrstuvw~".indexOf(o)?0!==c.length?(void 0===a.macros&&(a.macros={}),a.macros[o]=c):i("Missing macro definition",t,n):i("Macro definitions must be H-Y, h-w, or tilde",t,n):i("Macro definitions can only be one character",t,n)}else i("Need an = in a macro definition",t,n)},this.setDefaultLength=function(e,t,n){var r=e.substring(t,n).replace(/ /g,"").split("/");if(2===r.length){var i=parseInt(r[0]),s=parseInt(r[1]);s>0&&(a.default_length=i/s,a.havent_set_length=!1)}else 1===r.length&&"1"===r[0]&&(a.default_length=1,a.havent_set_length=!1)};var c={larghissimo:20,adagissimo:24,sostenuto:28,grave:32,largo:40,lento:50,larghetto:60,adagio:68,adagietto:74,andante:80,andantino:88,"marcia moderato":84,"andante moderato":100,moderato:112,allegretto:116,"allegro moderato":120,allegro:126,animato:132,agitato:140,veloce:148,"mosso vivo":156,vivace:164,vivacissimo:172,allegrissimo:176,presto:184,prestissimo:210};this.setTempo=function(e,t,n,s){try{var o=r.tokenize(e,t,n);if(0===o.length)throw"Missing parameter in Q: field";var l={startChar:s+t-2,endChar:s+n},u=!0,h=o.shift();if("quote"===h.type&&(l.preString=h.token,h=o.shift(),0===o.length))return c[l.preString.toLowerCase()]&&(l.bpm=c[l.preString.toLowerCase()],l.suppressBpm=!0),{type:"immediate",tempo:l};if("alpha"===h.type&&"C"===h.token){if(0===o.length)throw"Missing tempo after C in Q: field";if("punct"===(h=o.shift()).type&&"="===h.token){if(0===o.length)throw"Missing tempo after = in Q: field";if("number"!==(h=o.shift()).type)throw"Expected number after = in Q: field";l.duration=[1],l.bpm=parseInt(h.token)}else{if("number"!==h.type)throw"Expected number or equal after C in Q: field";if(l.duration=[parseInt(h.token)],0===o.length)throw"Missing = after duration in Q: field";if("punct"!==(h=o.shift()).type||"="!==h.token)throw"Expected = after duration in Q: field";if(0===o.length)throw"Missing tempo after = in Q: field";if("number"!==(h=o.shift()).type)throw"Expected number after = in Q: field";l.bpm=parseInt(h.token)}}else{if("number"!==h.type)throw"Unknown value in Q: field";var d=parseInt(h.token);if(0===o.length||"quote"===o[0].type)l.duration=[1],l.bpm=d;else{if(u=!1,"punct"!==(h=o.shift()).type&&"/"!==h.token)throw"Expected fraction in Q: field";if("number"!==(h=o.shift()).type)throw"Expected fraction in Q: field";var f=parseInt(h.token);for(l.duration=[d/f];o.length>0&&"="!==o[0].token&&"quote"!==o[0].type;){if("number"!==(h=o.shift()).type)throw"Expected fraction in Q: field";if(d=parseInt(h.token),"punct"!==(h=o.shift()).type&&"/"!==h.token)throw"Expected fraction in Q: field";if("number"!==(h=o.shift()).type)throw"Expected fraction in Q: field";f=parseInt(h.token),l.duration.push(d/f)}if("punct"!==(h=o.shift()).type&&"="!==h.token)throw"Expected = in Q: field";if("number"!==(h=o.shift()).type)throw"Expected tempo in Q: field";l.bpm=parseInt(h.token)}}if(0!==o.length&&("quote"===(h=o.shift()).type&&(l.postString=h.token,h=o.shift()),0!==o.length))throw"Unexpected string at end of Q: field";return!1===a.printTempo&&(l.suppress=!0),{type:u?"delaySet":"immediate",tempo:l}}catch(p){return i(p,e,t),{type:"none"}}},this.letter_to_inline_header=function(e,c,l){var u=!1,h=r.eatWhiteSpace(e,c);if(c+=h,e.length>=c+5&&"["===e[c]&&":"===e[c+2]){var d=e.indexOf("]",c),f=a.iChar+c,p=a.iChar+d+1;switch(e.substring(c,c+3)){case"[I:":var m=t.addDirective(e.substring(c+3,d));return m&&i(m,e,c),[d-c+1+h];case"[M:":var g=this.setMeter(e.substring(c+3,d));return o.hasBeginMusic()&&g?o.appendStartingElement("meter",f,p,g):a.meter=g,[d-c+1+h];case"[K:":var v=n.parseKey(e.substring(c+3,d),!0);return v.foundClef&&o.hasBeginMusic()&&o.appendStartingElement("clef",f,p,a.clef),v.foundKey&&o.hasBeginMusic()&&o.appendStartingElement("key",f,p,n.fixKey(a.clef,a.key)),[d-c+1+h];case"[P:":var y=t.parseFontChangeLine(e.substring(c+3,d));return l||s.lines.length<=s.lineNum?a.partForNextLine={title:y,startChar:f,endChar:p}:o.appendElement("part",f,p,{title:y}),[d-c+1+h];case"[L:":return this.setDefaultLength(e,c+3,d),[d-c+1+h];case"[Q:":if(d>0){var b=this.setTempo(e,c+3,d,a.iChar);return"delaySet"===b.type?o.hasBeginMusic()?o.appendElement("tempo",f,p,this.calcTempo(b.tempo)):a.tempoForNextLine=["tempo",f,p,this.calcTempo(b.tempo)]:"immediate"===b.type&&(!l&&o.hasBeginMusic()?o.appendElement("tempo",f,p,b.tempo):a.tempoForNextLine=["tempo",f,p,b.tempo]),[d-c+1+h,e[c+1],e.substring(c+3,d)]}break;case"[V:":if(d>0)return u=n.parseVoice(e,c+3,d),[d-c+1+h,e[c+1],e.substring(c+3,d),u];break;case"[r:":return[d-c+1+h]}}return[0]},this.letter_to_body_header=function(r,s){var c=!1;if(r.length>=s+3)switch(r.substring(s,s+2)){case"I:":var l=t.addDirective(r.substring(s+2));return l&&i(l,r,s),[r.length];case"M:":var u=this.setMeter(r.substring(s+2));return o.hasBeginMusic()&&u&&o.appendStartingElement("meter",a.iChar+s,a.iChar+r.length,u),[r.length];case"K:":var h=n.parseKey(r.substring(s+2),o.hasBeginMusic());return h.foundClef&&o.hasBeginMusic()&&o.appendStartingElement("clef",a.iChar+s,a.iChar+r.length,a.clef),h.foundKey&&o.hasBeginMusic()&&o.appendStartingElement("key",a.iChar+s,a.iChar+r.length,n.fixKey(a.clef,a.key)),[r.length];case"P:":return o.hasBeginMusic()&&o.appendElement("part",a.iChar+s,a.iChar+r.length,{title:r.substring(s+2)}),[r.length];case"L:":return this.setDefaultLength(r,s+2,r.length),[r.length];case"Q:":var d=r.indexOf("",s+2);-1===d&&(d=r.length);var f=this.setTempo(r,s+2,d,a.iChar);return"delaySet"===f.type?o.appendElement("tempo",a.iChar+s,a.iChar+r.length,this.calcTempo(f.tempo)):"immediate"===f.type&&o.appendElement("tempo",a.iChar+s,a.iChar+r.length,f.tempo),[d,r[s],e.strip(r.substring(s+2))];case"V:":return c=n.parseVoice(r,s+2,r.length),[r.length,r[s],e.strip(r.substring(s+2)),c]}return[0]};var l={A:"author",B:"book",C:"composer",D:"discography",F:"url",G:"group",I:"instruction",N:"notes",O:"origin",R:"rhythm",S:"source",W:"unalignedWords",Z:"transcription"};this.parseHeader=function(e){var c=l[e[0]],u=e.length-2,h=r.translateString(r.stripComment(e.substring(2)));if("unalignedWords"===c||"notes"===c)o.addMetaTextArray(c,t.parseFontChangeLine(h),{startChar:a.iChar,endChar:a.iChar+e.length});else if(void 0!==c)o.addMetaText(c,t.parseFontChangeLine(h),{startChar:a.iChar,endChar:a.iChar+e.length});else{var d=a.iChar,f=d+e.length;switch(e[0]){case"H":for(o.addMetaTextArray("history",t.parseFontChangeLine(h),{startChar:a.iChar,endChar:a.iChar+e.length}),e=r.peekLine();e&&":"!==e[1];)r.nextLine(),o.addMetaTextArray("history",t.parseFontChangeLine(r.translateString(r.stripComment(e))),{startChar:a.iChar,endChar:a.iChar+e.length}),e=r.peekLine();break;case"K":this.resolveTempo();var p=n.parseKey(e.substring(2),!1);!a.is_in_header&&o.hasBeginMusic()&&(p.foundClef&&o.appendStartingElement("clef",d,f,a.clef),p.foundKey&&o.appendStartingElement("key",d,f,n.fixKey(a.clef,a.key))),a.is_in_header=!1;break;case"L":this.setDefaultLength(e,2,e.length);break;case"M":a.origMeter=a.meter=this.setMeter(e.substring(2));break;case"P":a.is_in_header?o.addMetaText("partOrder",t.parseFontChangeLine(h),{startChar:a.iChar,endChar:a.iChar+e.length}):a.partForNextLine={title:h,startChar:d,endChar:f};break;case"Q":var m=this.setTempo(e,2,e.length,a.iChar);"delaySet"===m.type?a.tempo=m.tempo:"immediate"===m.type&&(s.metaText.tempo?a.tempoForNextLine=["tempo",d,f,m.tempo]:s.metaText.tempo=m.tempo);break;case"T":a.titlecaps&&(h=h.toUpperCase()),this.setTitle(t.parseFontChangeLine(r.theReverser(h)),u);break;case"U":this.addUserDefinition(e,2,e.length);break;case"V":if(n.parseVoice(e,2,e.length),!a.is_in_header)return{newline:!0};break;case"s":return{symbols:!0};case"w":return{words:!0};case"X":break;case"E":case"m":i("Ignored header",e,0);break;default:return{regular:!0}}}return{}}}}(),r=function(){if(hd)return ud;hd=1;var e,t,n,r,i,a,s=cd(),o=od(),{legalAccents:c,volumeDecorations:l,dynamicDecorations:u,accentPseudonyms:h,accentDynamicPseudonyms:d,nonDecorations:f,durations:p,pitches:m,rests:g,accMap:v,tripletQ:y}=(ld||(ld=1,lv.legalAccents=["trill","lowermordent","uppermordent","mordent","pralltriller","accent","fermata","invertedfermata","tenuto","0","1","2","3","4","5","+","wedge","open","thumb","snap","turn","roll","breath","shortphrase","mediumphrase","longphrase","segno","coda","D.S.","D.C.","fine","beambr1","beambr2","slide","marcato","upbow","downbow","/","//","///","////","trem1","trem2","trem3","trem4","turnx","invertedturn","invertedturnx","trill(","trill)","arpeggio","xstem","mark","umarcato","style=normal","style=harmonic","style=rhythm","style=x","style=triangle","D.C.alcoda","D.C.alfine","D.S.alcoda","D.S.alfine","editorial","courtesy"],lv.volumeDecorations=["p","pp","f","ff","mf","mp","ppp","pppp","fff","ffff","sfz"],lv.dynamicDecorations=["crescendo(","crescendo)","diminuendo(","diminuendo)","glissando(","glissando)","~(","~)"],lv.accentPseudonyms=[["<","accent"],[">","accent"],["tr","trill"],["plus","+"],["emphasis","accent"],["^","umarcato"],["marcato","umarcato"]],lv.accentDynamicPseudonyms=[["<(","crescendo("],["<)","crescendo)"],[">(","diminuendo("],[">)","diminuendo)"]],lv.nonDecorations="ABCDEFGabcdefgxyzZ[]|^_{",lv.durations=[.5,.75,.875,.9375,.96875,.984375,.25,.375,.4375,.46875,.484375,.4921875,.125,.1875,.21875,.234375,.2421875,.24609375,.0625,.09375,.109375,.1171875,.12109375,.123046875,.03125,.046875,.0546875,.05859375,.060546875,.0615234375,.015625,.0234375,.02734375,.029296875,.0302734375,.03076171875],lv.pitches={A:5,B:6,C:0,D:1,E:2,F:3,G:4,a:12,b:13,c:7,d:8,e:9,f:10,g:11},lv.rests={x:"invisible",X:"invisible-multimeasure",y:"spacer",z:"rest",Z:"multimeasure"},lv.accMap={dblflat:"__",flat:"_",natural:"=",sharp:"^",dblsharp:"^^",quarterflat:"_/",quartersharp:"^/"},lv.tripletQ={2:3,3:2,4:3,5:2,6:2,7:2,8:3,9:2}),lv),b=function(s,o,c,l,u,h){e=s,t=o,n=c,r=l,i=u,a=h,this.lineContinuation=!1},_=function(e,t,n){if(void 0===e.inTie[t])return!1;var r=e.currentVoice?100*e.currentVoice.staffNum+e.currentVoice.index:0;return!(!e.inTie[t][r]||void 0===n.pitches&&"spacer"===n.rest.type)},w={};b.prototype.parseMusic=function(s){a.resolveTempo(),n.is_in_header=!1;for(var o=0,c=n.iChar;e.isWhiteSpace(s[o])&&o<s.length;)o++;if(o!==s.length&&"%"!==s[o]){var l=n.start_new_line;void 0===n.continueall?n.start_new_line=!0:n.start_new_line=!1;var u=0,h=a.letter_to_body_header(s,o);h[0]>0&&(o+=h[0],"V"===h[1]&&this.startNewLine());for(var d=0;o<s.length;){var m=o;if("%"===s[o])break;var g=a.letter_to_inline_header(s,o,l);if(g[0]>0)o+=g[0],"V"===g[1]&&(l=!0);else{var v;for((!i.hasBeginMusic()||l&&!this.lineContinuation)&&(this.startNewLine(),l=!1);;)if((v=e.eatWhiteSpace(s,o))>0&&(o+=v),o>0&&""===s[o-1]&&(v=a.letter_to_body_header(s,o))[0]>0&&("V"===v[1]&&this.startNewLine(),o=v[0],n.start_new_line=!1),(v=T(s,o))[0]>0&&(o+=v[0]),(v=k(s,o))[0]>0){w.chord||(w.chord=[]);var y=e.translateString(v[1]);y=y.replace(/;/g,"\n");for(var b=!1,L=0;L<w.chord.length;L++)w.chord[L].position===v[2]&&(b=!0,w.chord[L].name+="\n"+y);!1===b&&(null===v[2]&&v[3]?w.chord.push({name:y,rel_position:v[3]}):w.chord.push({name:y,position:v[2]})),o+=v[0];var B=e.skipWhiteSpace(s.substring(o));B>0&&(w.force_end_beam_last=!0),o+=B}else if((v=-1===f.indexOf(s[o])?E(s,o):[0])[0]>0)null===v[1]?o+1<s.length&&this.startNewLine():v[1].length>0&&(0===v[1].indexOf("style=")?w.style=v[1].substr(6):(void 0===w.decoration&&(w.decoration=[]),"beambr1"===v[1]?w.beambr=1:"beambr2"===v[1]?w.beambr=2:w.decoration.push(v[1]))),o+=v[0];else{if(!((v=S(s,o))[0]>0))break;w.gracenotes=v[1],o+=v[0]}if((v=A(s,o))[0]>0){d=0,void 0!==w.gracenotes&&(w.rest={type:"spacer"},w.duration=.125,n.addFormattingOptions(w,r.formatting,"note"),i.appendElement("note",c+o,c+o+v[0],w),n.measureNotEmpty=!0,w={});var R={type:v[1]};0===R.type.length?t("Unknown bar type",s,o):(n.inEnding&&"bar_thin"!==R.type&&(R.endEnding=!0,n.inEnding=!1),v[2]&&(R.startEnding=v[2],n.inEnding&&(R.endEnding=!0),n.inEnding=!0,"bar_right_repeat"===v[1]?n.restoreStartEndingHoldOvers():n.duplicateStartEndingHoldOvers()),void 0!==w.decoration&&(R.decoration=w.decoration),void 0!==w.chord&&(R.chord=w.chord),R.startEnding&&void 0===n.barFirstEndingNum?n.barFirstEndingNum=n.currBarNumber:R.startEnding&&R.endEnding&&n.barFirstEndingNum?n.currBarNumber=n.barFirstEndingNum:R.endEnding&&(n.barFirstEndingNum=void 0),"bar_invisible"!==R.type&&n.measureNotEmpty&&O()&&(n.currBarNumber++,n.barNumbers&&n.currBarNumber%n.barNumbers==0&&(R.barNumber=n.currBarNumber)),n.addFormattingOptions(w,r.formatting,"bar"),i.appendElement("bar",c+m,c+o+v[0],R),n.measureNotEmpty=!1,w={}),o+=v[0]}else if("&"===s[o])(v=C(s,o))[0]>0&&(i.appendElement("overlay",c,c+1,{}),o+=1,d++);else{if((v=P(s,o)).consumed>0&&(void 0!==v.startSlur&&(w.startSlur=v.startSlur),v.dottedSlur&&(w.dottedSlur=!0),void 0!==v.triplet&&(u>0?t("Can't nest triplets",s,o):(w.startTriplet=v.triplet,w.tripletMultiplier=v.tripletQ/v.triplet,w.tripletR=v.num_notes,u=void 0===v.num_notes?v.triplet:v.num_notes)),o+=v.consumed),"["===s[o]){o++;for(var V=null,F=!1,z=!1;!z;){var j=E(s,o);j[0]>0&&(o+=j[0]);var q=N(s,o,{},!1);if(null!==q&&void 0!==q.pitch)j[0]>0&&0!==j[1].indexOf("style=")&&(void 0===w.decoration&&(w.decoration=[]),w.decoration.push(j[1])),q.end_beam&&(w.end_beam=!0,delete q.end_beam),void 0===w.pitches?(w.duration=q.duration,w.pitches=[q]):w.pitches.push(q),delete q.duration,j[0]>0&&0===j[1].indexOf("style=")&&(w.pitches[w.pitches.length-1].style=j[1].substr(6)),n.inTieChord[w.pitches.length]&&(q.endTie=!0,n.inTieChord[w.pitches.length]=void 0),q.startTie&&(n.inTieChord[w.pitches.length]=!0),o=q.endChar,delete q.endChar;else if(" "===s[o])t("Spaces are not allowed in chords",s,o),o++;else{if(o<s.length&&"]"===s[o]){o++,0!==n.next_note_duration&&(w.duration=w.duration*n.next_note_duration,n.next_note_duration=0),_(n,d,w)&&(w.pitches.forEach((function(e){e.endTie=!0})),x(n,d,!1)),u>0&&(!w.rest||"spacer"!==w.rest.type)&&0==--u&&(w.endTriplet=!0);for(var H=!1;o<s.length&&!H;){switch(s[o]){case" ":case"\t":I(w);break;case")":void 0===w.endSlur?w.endSlur=1:w.endSlur++;break;case"-":w.pitches.forEach((function(e){e.startTie={}})),x(n,d,!0);break;case">":case"<":var U=D(s,o);o+=U[0]-1,n.next_note_duration=U[2],V?V*=U[1]:V=U[1];break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"/":var G=e.getFraction(s,o);V=G.value;var W=s[o=G.index];" "===W&&(F=!0),"-"===W||")"===W||" "===W||"<"===W||">"===W?o--:H=!0;break;case"0":V=0;break;default:H=!0}H||o++}}else t("Expected ']' to end the chords",s,o);void 0!==w.pitches&&(null!==V&&(w.duration=w.duration*V,F&&I(w)),n.addFormattingOptions(w,r.formatting,"note"),i.appendElement("note",c+m,c+o,w),n.measureNotEmpty=!0,w={}),z=!0}}}else{var Y={},$=N(s,o,Y,!0);void 0!==Y.endTie&&x(n,d,!0),null!==$&&(void 0!==$.pitch?(w.pitches=[{}],void 0!==$.accidental&&(w.pitches[0].accidental=$.accidental),w.pitches[0].pitch=$.pitch,w.pitches[0].name=$.name,($.midipitch||0===$.midipitch)&&(w.pitches[0].midipitch=$.midipitch),void 0!==$.endSlur&&(w.pitches[0].endSlur=$.endSlur),void 0!==$.endTie&&(w.pitches[0].endTie=$.endTie),void 0!==$.startSlur&&(w.pitches[0].startSlur=$.startSlur),void 0!==w.startSlur&&(w.pitches[0].startSlur=w.startSlur),void 0!==w.dottedSlur&&(w.pitches[0].dottedSlur=!0),void 0!==$.startTie&&(w.pitches[0].startTie=$.startTie),void 0!==w.startTie&&(w.pitches[0].startTie=w.startTie)):(w.rest=$.rest,"multimeasure"===$.rest.type&&O()&&(n.currBarNumber+=$.rest.text-1),void 0!==$.endSlur&&(w.endSlur=$.endSlur),void 0!==$.endTie&&(w.rest.endTie=$.endTie),void 0!==$.startSlur&&(w.startSlur=$.startSlur),void 0!==$.startTie&&(w.rest.startTie=$.startTie),void 0!==w.startTie&&(w.rest.startTie=w.startTie)),void 0!==$.chord&&(w.chord=$.chord),void 0!==$.duration&&(w.duration=$.duration),void 0!==$.decoration&&(w.decoration=$.decoration),void 0!==$.graceNotes&&(w.graceNotes=$.graceNotes),delete w.startSlur,delete w.dottedSlur,_(n,d,w)&&(void 0!==w.pitches?w.pitches[0].endTie=!0:"spacer"!==w.rest.type&&(w.rest.endTie=!0),x(n,d,!1)),($.startTie||w.startTie)&&x(n,d,!0),o=$.endChar,u>0&&(!$.rest||"spacer"!==$.rest.type)&&0==--u&&(w.endTriplet=!0),$.end_beam&&I(w),w.rest&&"rest"===w.rest.type&&1===w.duration&&M(n)<=1&&(w.rest.type="whole",w.duration=M(n)),w.duration<1&&-1===p.indexOf(w.duration)&&0!==w.duration&&(w.rest&&"spacer"===w.rest.type||t("Duration not representable: "+s.substring(m,o),s,o)),n.addFormattingOptions(w,r.formatting,"note"),i.appendElement("note",c+m,c+o,w)||(this.startNewLine(),i.appendElement("note",c+m,c+o,w)),n.measureNotEmpty=!0,w={})}o===m&&(" "!==s[o]&&"`"!==s[o]&&t("Unknown character ignored",s,o),o++)}}}this.lineContinuation=s.indexOf("")>=0||h[0]>0,this.lineContinuation||(w={})}};var x=function(e,t,n){var r=e.currentVoice?100*e.currentVoice.staffNum+e.currentVoice.index:0;void 0===e.inTie[t]&&(e.inTie[t]=[]),e.inTie[t][r]=n},k=function(r,i){if('"'===r[i]){var a=e.getBrackettedSubstring(r,i,5);if(a[2]||t("Missing the closing quote while parsing the chord symbol",r,i),a[0]>0&&a[1].length>0&&"^"===a[1][0])a[1]=a[1].substring(1),a[2]="above";else if(a[0]>0&&a[1].length>0&&"_"===a[1][0])a[1]=a[1].substring(1),a[2]="below";else if(a[0]>0&&a[1].length>0&&"<"===a[1][0])a[1]=a[1].substring(1),a[2]="left";else if(a[0]>0&&a[1].length>0&&">"===a[1][0])a[1]=a[1].substring(1),a[2]="right";else if(a[0]>0&&a[1].length>0&&"@"===a[1][0]){a[1]=a[1].substring(1);var s=e.getFloat(a[1]);if(0===s.digits)return t("Missing first position in absolutely positioned annotation.",r,i),a[1]=a[1].replace("@",""),a[2]="above",a;if(a[1]=a[1].substring(s.digits),","!==a[1][0])return t("Missing comma absolutely positioned annotation.",r,i),a[1]=a[1].replace("@",""),a[2]="above",a;a[1]=a[1].substring(1);var c=e.getFloat(a[1]);if(0===c.digits)return t("Missing second position in absolutely positioned annotation.",r,i),a[1]=a[1].replace("@",""),a[2]="above",a;a[1]=a[1].substring(c.digits);var l=e.skipWhiteSpace(a[1]);a[1]=a[1].substring(l),a[2]=null,a[3]={x:s.value,y:c.value}}else!0!==n.freegchord&&(a[1]=a[1].replace(/([ABCDEFG0-9])b/g,"$1♭"),a[1]=a[1].replace(/([ABCDEFG0-9])#/g,"$1♯"),a[1]=a[1].replace(/^([ABCDEFG])([♯♭]?)o([^A-Za-z])/g,"$1$2°$3"),a[1]=a[1].replace(/^([ABCDEFG])([♯♭]?)o$/g,"$1$2°"),a[1]=a[1].replace(/^([ABCDEFG])([♯♭]?)0([^A-Za-z])/g,"$1$2ø$3"),a[1]=a[1].replace(/^([ABCDEFG])([♯♭]?)\^([^A-Za-z])/g,"$1$2∆$3")),a[2]="default",a[1]=o.chordName(n,a[1]);return a}return[0,""]},S=function(r,i){if("{"===r[i]){var a=e.getBrackettedSubstring(r,i,1,"}");a[2]||t("Missing the closing '}' while parsing grace note",r,i),")"===r[i+a[0]]&&(a[0]++,a[1]+=")");for(var s=[],o=0,c=!1;o<a[1].length;){var l=!1;"/"===a[1][o]&&(l=!0,o++);var u=N(a[1],o,{},!1);null!==u?(u.duration=u.duration/(8*n.default_length),l&&(u.acciaccatura=!0),u.rest?t("Rests not allowed as grace notes '"+a[1][o]+"' while parsing grace note",r,i):s.push(u),c&&(u.endTie=!0,c=!1),u.startTie&&(c=!0),o=u.endChar,delete u.endChar,u.end_beam&&(u.endBeam=!0,delete u.end_beam)):(" "===a[1][o]?s.length>0&&(s[s.length-1].endBeam=!0):t("Unknown character '"+a[1][o]+"' while parsing grace note",r,i),o++)}if(s.length)return[a[0],s]}return[0]};function C(e,t){if("&"===e[t]){for(var n=t;e[t]&&":"!==e[t]&&"|"!==e[t];)t++;return[t-n,e.substring(n+1,t)]}return[0]}function M(e){var t=e.origMeter;return t&&"specified"===t.type&&t.value&&0!==t.value.length?parseInt(t.value[0].num,10)/parseInt(t.value[0].den,10):1}var E=function(r,i){var a=n.macros[r[i]];if(void 0!==a)return"!"!==a[0]&&"+"!==a[0]||(a=a.substring(1)),"!"!==a[a.length-1]&&"+"!==a[a.length-1]||(a=a.substring(0,a.length-1)),c.includes(a)?[1,a]:l.includes(a)?("hidden"===n.volumePosition&&(a=""),[1,a]):u.includes(a)?("hidden"===n.dynamicPosition&&(a=""),[1,a]):(n.ignoredDecorations.includes(a)||t("Unknown macro: "+a,r,i),[1,""]);switch(r[i]){case".":if("("===r[i+1]||"-"===r[i+1])break;return[1,"staccato"];case"u":return[1,"upbow"];case"v":return[1,"downbow"];case"~":return[1,"irishroll"];case"!":case"+":var s=e.getBrackettedSubstring(r,i,5);if(s[1].length>1&&("^"===s[1][0]||"_"===s[1][0])&&(s[1]=s[1].substring(1)),c.includes(s[1]))return s;if(l.includes(s[1]))return"hidden"===n.volumePosition&&(s[1]=""),s;if(u.includes(s[1]))return"hidden"===n.dynamicPosition&&(s[1]=""),s;var o=h.findIndex((function(e){return s[1]===e[0]}));return o>=0?(s[1]=h[o][1],s):(o=d.findIndex((function(e){return s[1]===e[0]})))>=0?(s[1]=d[o][1],"hidden"===n.dynamicPosition&&(s[1]=""),s):"!"!==r[i]||1!==s[0]&&"!"===r[i+s[0]-1]?(t("Unknown decoration: "+s[1],r,i),s[1]="",s):[1,null];case"H":return[1,"fermata"];case"J":return[1,"slide"];case"L":return[1,"accent"];case"M":return[1,"mordent"];case"O":return[1,"coda"];case"P":return[1,"pralltriller"];case"R":return[1,"roll"];case"S":return[1,"segno"];case"T":return[1,"trill"]}return[0,0]},T=function(t,n){for(var r=n;e.isWhiteSpace(t[n]);)n++;return[n-r]},A=function(n,r){var i=e.getBarLine(n,r);if(0===i.len)return[0,""];if(i.warn)return t(i.warn,n,r),[i.len,""];for(var a=0;a<n.length&&" "===n[r+i.len+a];a++);var s=i.len;if("["===n[r+i.len+a]&&(i.len+=a+1),'"'===n[r+i.len]&&"["===n[r+i.len-1]){var o=e.getBrackettedSubstring(n,r+i.len,5);return[i.len+o[0],i.token,o[1]]}var c=e.getTokenOf(n.substring(r+i.len),"1234567890-,");return 0===c.len||"-"===c.token[0]?[s,i.token]:[i.len+c.len,i.token,c.token]},P=function(n,r){var i={},a=r;for("."===n[r]&&"("===n[r+1]&&(i.dottedSlur=!0,r++);"("===n[r]||e.isWhiteSpace(n[r]);)"("===n[r]&&(r+1<n.length&&n[r+1]>="2"&&n[r+1]<="9"?(void 0!==i.triplet?t("Can't nest triplets",n,r):(i.triplet=n[r+1]-"0",i.tripletQ=y[i.triplet],i.num_notes=i.triplet,r+2<n.length&&":"===n[r+2]&&(r+3<n.length&&":"===n[r+3]?r+4<n.length&&n[r+4]>="1"&&n[r+4]<="9"?(i.num_notes=n[r+4]-"0",r+=3):t("expected number after the two colons after the triplet to mark the duration",n,r):r+3<n.length&&n[r+3]>="1"&&n[r+3]<="9"?(i.tripletQ=n[r+3]-"0",r+4<n.length&&":"===n[r+4]?r+5<n.length&&n[r+5]>="1"&&n[r+5]<="9"&&(i.num_notes=n[r+5]-"0",r+=4):r+=2):t("expected number after the triplet to mark the duration",n,r))),r++):void 0===i.startSlur?i.startSlur=1:i.startSlur++),r++;return i.consumed=r-a,i};b.prototype.startNewLine=function(){var e={startChar:-1,endChar:-1};n.partForNextLine.title&&(e.part=n.partForNextLine),e.clef=n.currentVoice&&void 0!==n.staves[n.currentVoice.staffNum].clef?Object.assign({},n.staves[n.currentVoice.staffNum].clef):Object.assign({},n.clef);var t=n.currentVoice?n.currentVoice.scoreTranspose:0;if(e.key=s.standardKey(n.key.root+n.key.acc+n.key.mode,n.key.root,n.key.acc,t),e.key.mode=n.key.mode,n.key.impliedNaturals&&(e.key.impliedNaturals=n.key.impliedNaturals),n.key.explicitAccidentals)for(var r=0;r<n.key.explicitAccidentals.length;r++){for(var a=!1,o=0;o<e.key.accidentals.length;o++)e.key.accidentals[o].note===n.key.explicitAccidentals[r].note&&(e.key.accidentals[o].acc=n.key.explicitAccidentals[r].acc,a=!0);a||e.key.accidentals.push(n.key.explicitAccidentals[r])}if(n.targetKey=e.key,e.key.explicitAccidentals&&delete e.key.explicitAccidentals,s.addPosToKey(e.clef,e.key),null!==n.meter?(n.currentVoice?(n.staves.forEach((function(e){e.meter=n.meter})),e.meter=n.staves[n.currentVoice.staffNum].meter,n.staves[n.currentVoice.staffNum].meter=null):e.meter=n.meter,n.meter=null):n.currentVoice&&n.staves[n.currentVoice.staffNum].meter&&(e.meter=n.staves[n.currentVoice.staffNum].meter,n.staves[n.currentVoice.staffNum].meter=null),n.currentVoice&&n.currentVoice.name&&(e.name=n.currentVoice.name),n.vocalfont&&(e.vocalfont=n.vocalfont),n.tripletfont&&(e.tripletfont=n.tripletfont),n.gchordfont&&(e.gchordfont=n.gchordfont),n.style&&(e.style=n.style),n.currentVoice){var c=n.staves[n.currentVoice.staffNum];c.brace&&(e.brace=c.brace),c.bracket&&(e.bracket=c.bracket),c.connectBarLines&&(e.connectBarLines=c.connectBarLines),c.name&&(e.name=c.name[n.currentVoice.index]),c.subname&&(e.subname=c.subname[n.currentVoice.index]),n.currentVoice.stem&&(e.stem=n.currentVoice.stem),n.currentVoice.stafflines&&(e.stafflines=n.currentVoice.stafflines),n.currentVoice.staffscale&&(e.staffscale=n.currentVoice.staffscale),n.currentVoice.scale&&(e.scale=n.currentVoice.scale),n.currentVoice.color&&(e.color=n.currentVoice.color),n.currentVoice.style&&(e.style=n.currentVoice.style),n.currentVoice.transpose&&(e.clef.transpose=n.currentVoice.transpose),e.currentVoice=n.currentVoice;for(var l=Object.keys(n.voices),u=0;u<l.length;u++)e.currentVoice.staffNum===n.voices[l[u]].staffNum&&e.currentVoice.index===n.voices[l[u]].index&&(e.currentVoiceName=l[u])}0===n.barNumbers&&O()&&1!==n.currBarNumber&&(e.barNumber=n.currBarNumber),i.startNewLine(e),n.key.impliedNaturals&&delete n.key.impliedNaturals,n.partForNextLine={},4===n.tempoForNextLine.length&&i.appendElement(n.tempoForNextLine[0],n.tempoForNextLine[1],n.tempoForNextLine[2],n.tempoForNextLine[3]),n.tempoForNextLine=[]};var I=function(e){return void 0!==e.duration&&e.duration<.25&&(e.end_beam=!0),e},N=function(t,a,s,c){var l,u=function(e){return"octave"===e||"duration"===e||"Zduration"===e||"broken_rhythm"===e||"end_slur"===e};"."===t[a]&&"-"===t[a+1]&&(l=!0,a++);for(var h="startSlur",d=!1;;){switch(t[a]){case"(":if("startSlur"!==h)return u(h)?(s.endChar=a,s):null;void 0===s.startSlur?s.startSlur=1:s.startSlur++;break;case")":if(!u(h))return null;void 0===s.endSlur?s.endSlur=1:s.endSlur++;break;case"^":if("startSlur"===h)s.accidental="sharp",h="sharp2";else{if("sharp2"!==h)return u(h)?(s.endChar=a,s):null;s.accidental="dblsharp",h="pitch"}break;case"_":if("startSlur"===h)s.accidental="flat",h="flat2";else{if("flat2"!==h)return u(h)?(s.endChar=a,s):null;s.accidental="dblflat",h="pitch"}break;case"=":if("startSlur"!==h)return u(h)?(s.endChar=a,s):null;s.accidental="natural",h="pitch";break;case"A":case"B":case"C":case"D":case"E":case"F":case"G":case"a":case"b":case"c":case"d":case"e":case"f":case"g":if("startSlur"!==h&&"sharp2"!==h&&"flat2"!==h&&"pitch"!==h)return u(h)?(s.endChar=a,s):null;if(s.pitch=m[t[a]],s.pitch+=7*(n.currentVoice&&void 0!==n.currentVoice.octave?n.currentVoice.octave:n.octave),s.name=t[a],s.accidental&&(s.name=v[s.accidental]+s.name),o.note(n,s),h="octave",c&&0!==n.next_note_duration?(s.duration=n.default_length*n.next_note_duration,n.next_note_duration=0,d=!0):s.duration=n.default_length,n.clef&&"perc"===n.clef.type||n.currentVoice&&"perc"===n.currentVoice.clef){var f=t[a];s.accidental&&(f=v[s.accidental]+f),r.formatting&&r.formatting.midi&&r.formatting.midi.drummap&&(s.midipitch=r.formatting.midi.drummap[f])}break;case",":if("octave"!==h)return u(h)?(s.endChar=a,s):null;s.pitch-=7,s.name+=",";break;case"'":if("octave"!==h)return u(h)?(s.endChar=a,s):null;s.pitch+=7,s.name+="'";break;case"x":case"X":case"y":case"z":case"Z":if("startSlur"!==h)return u(h)?(s.endChar=a,s):null;s.rest={type:g[t[a]]},delete s.accidental,delete s.startSlur,delete s.startTie,delete s.endSlur,delete s.endTie,delete s.end_beam,delete s.grace_notes,s.rest.type.indexOf("multimeasure")>=0?(s.duration=r.getBarLength(),s.rest.text=1,h="Zduration"):(c&&0!==n.next_note_duration?(s.duration=n.default_length*n.next_note_duration,n.next_note_duration=0,d=!0):s.duration=n.default_length,h="duration");break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"0":case"/":if("octave"===h||"duration"===h){var p=e.getFraction(t,a);for(s.duration=s.duration*p.value,s.endChar=p.index;p.index<t.length&&(e.isWhiteSpace(t[p.index])||"-"===t[p.index]);)"-"===t[p.index]?s.startTie={}:s=I(s),p.index++;a=p.index-1,h="broken_rhythm"}else if("sharp2"===h)s.accidental="quartersharp",h="pitch";else{if("flat2"!==h){if("Zduration"===h){var y=e.getNumber(t,a);return s.duration=y.num*r.getBarLength(),s.rest.text=y.num,s.endChar=y.index,s}return null}s.accidental="quarterflat",h="pitch"}break;case"-":if("startSlur"===h)i.addTieToLastNote(l),s.endTie=!0;else{if("octave"!==h&&"duration"!==h&&"end_slur"!==h)return"broken_rhythm"===h?(s.endChar=a,s):null;if(s.startTie={},d||!c)return e.isWhiteSpace(t[a+1])&&I(s),s.endChar=a+1,s;h="broken_rhythm"}break;case" ":case"\t":if(!u(h))return null;s.end_beam=!0,l=!1;do{"."===t[a]&&"-"===t[a+1]&&(l=!0,a++),"-"===t[a]&&(s.startTie={},l&&(s.startTie.style="dotted")),a++}while(a<t.length&&(e.isWhiteSpace(t[a])||"-"===t[a])||"."===t[a]&&"-"===t[a+1]);if(s.endChar=a,d||!c||"<"!==t[a]&&">"!==t[a])return s;a--,h="broken_rhythm";break;case">":case"<":if(!u(h))return null;if(!c)return s.endChar=a,s;var b=D(t,a);a+=b[0]-1,n.next_note_duration=b[2],s.duration=b[1]*s.duration,h="end_slur";break;default:return u(h)?(s.endChar=a,s):null}if(++a===t.length)return u(h)?(s.endChar=a,s):null}return null},D=function(e,t){switch(e[t]){case">":return t<e.length-2&&">"===e[t+1]&&">"===e[t+2]?[3,1.875,.125]:t<e.length-1&&">"===e[t+1]?[2,1.75,.25]:[1,1.5,.5];case"<":return t<e.length-2&&"<"===e[t+1]&&"<"===e[t+2]?[3,.125,1.875]:t<e.length-1&&"<"===e[t+1]?[2,.25,1.75]:[1,.5,1.5]}return null};function O(){return void 0===n.currentVoice||0===n.currentVoice.staffNum&&0===n.currentVoice.index}return ud=b}(),a=function(){if(fd)return dd;fd=1;var e=nd(),t=function(t,n){this.lineIndex=0,this.lines=t,this.multilineVars=n,this.skipWhiteSpace=function(e){for(var t=0;t<e.length;t++)if(!this.isWhiteSpace(e[t]))return t;return e.length};var r=function(e,t){return t>=e.length};this.eatWhiteSpace=function(e,t){for(var n=t;n<e.length;n++)if(!this.isWhiteSpace(e[n]))return n-t;return n-t},this.getKeyPitch=function(e){var t=this.skipWhiteSpace(e);if(r(e,t))return{len:0};switch(e[t]){case"A":return{len:t+1,token:"A"};case"B":return{len:t+1,token:"B"};case"C":return{len:t+1,token:"C"};case"D":return{len:t+1,token:"D"};case"E":return{len:t+1,token:"E"};case"F":return{len:t+1,token:"F"};case"G":return{len:t+1,token:"G"}}return{len:0}},this.getSharpFlat=function(e){if("bass"===e)return{len:0};switch(e[0]){case"#":return{len:1,token:"#"};case"b":return{len:1,token:"b"}}return{len:0}},this.getMode=function(e){var t=function(e,t){for(;t<e.length&&(e[t]>="a"&&e[t]<="z"||e[t]>="A"&&e[t]<="Z");)t++;return t},n=this.skipWhiteSpace(e);if(r(e,n))return{len:0};var i=e.substring(n,n+3).toLowerCase();switch((i.length>1&&" "===i[1]||"^"===i[1]||"_"===i[1]||"="===i[1])&&(i=i[0]),i){case"mix":return{len:t(e,n),token:"Mix"};case"dor":return{len:t(e,n),token:"Dor"};case"phr":return{len:t(e,n),token:"Phr"};case"lyd":return{len:t(e,n),token:"Lyd"};case"loc":return{len:t(e,n),token:"Loc"};case"aeo":case"min":case"m":return{len:t(e,n),token:"m"};case"maj":case"ion":return{len:t(e,n),token:""}}return{len:0}},this.getClef=function(t,n){var i=t,a=this.skipWhiteSpace(t);if(r(t,a))return{len:0};var s=!1,o=t.substring(a);if(e.startsWith(o,"clef=")&&(s=!0,o=o.substring(5),a+=5),0===o.length&&s)return{len:a+5,warn:"No clef specified: "+i};var c=this.skipWhiteSpace(o);if(r(o,c))return{len:0};c>0&&(a+=c,o=o.substring(c));var l=null;if(e.startsWith(o,"treble"))l="treble";else if(e.startsWith(o,"bass3"))l="bass3";else if(e.startsWith(o,"bass"))l="bass";else if(e.startsWith(o,"tenor"))l="tenor";else if(e.startsWith(o,"alto2"))l="alto2";else if(e.startsWith(o,"alto1"))l="alto1";else if(e.startsWith(o,"alto"))l="alto";else if(!n&&s&&e.startsWith(o,"none"))l="none";else if(e.startsWith(o,"perc"))l="perc";else if(!n&&s&&e.startsWith(o,"C"))l="tenor";else if(!n&&s&&e.startsWith(o,"F"))l="bass";else{if(n||!s||!e.startsWith(o,"G"))return{len:a+5,warn:"Unknown clef specified: "+i};l="treble"}return o=o.substring(l.length),(c=this.isMatch(o,"+8"))>0?l+="+8":(c=this.isMatch(o,"-8"))>0&&(l+="-8"),{len:a+l.length,token:l,explicit:s}},this.getBarLine=function(e,t){switch(e[t]){case"]":switch(e[++t]){case"|":return{len:2,token:"bar_thick_thin"};case"[":return e[++t]>="1"&&e[t]<="9"||'"'===e[t]?{len:2,token:"bar_invisible"}:{len:1,warn:"Unknown bar symbol"};default:return{len:1,token:"bar_invisible"}}case":":switch(e[++t]){case":":return{len:2,token:"bar_dbl_repeat"};case"|":switch(e[++t]){case"]":return"|"===e[++t]&&":"===e[++t]?{len:5,token:"bar_dbl_repeat"}:{len:3,token:"bar_right_repeat"};case"|":return":"===e[++t]?{len:4,token:"bar_dbl_repeat"}:{len:3,token:"bar_right_repeat"};default:return{len:2,token:"bar_right_repeat"}}default:return{len:1,warn:"Unknown bar symbol"}}case"[":if("|"!==e[++t])return e[t]>="1"&&e[t]<="9"||'"'===e[t]?{len:1,token:"bar_invisible"}:{len:0};switch(e[++t]){case":":return{len:3,token:"bar_left_repeat"};case"]":return{len:3,token:"bar_invisible"};default:return{len:2,token:"bar_thick_thin"}}case"|":switch(e[++t]){case"]":return{len:2,token:"bar_thin_thick"};case"|":return":"===e[++t]?{len:3,token:"bar_left_repeat"}:{len:2,token:"bar_thin_thin"};case":":for(var n=0;":"===e[t+n];)n++;return{len:1+n,token:"bar_left_repeat"};default:return{len:1,token:"bar_thin"}}}return{len:0}},this.getTokenOf=function(e,t){for(var n=0;n<e.length;n++)if(t.indexOf(e[n])<0)return{len:n,token:e.substring(0,n)};return{len:n,token:e}},this.getToken=function(e,t,n){for(var r=t;r<n&&!this.isWhiteSpace(e[r]);)r++;return e.substring(t,r)},this.isMatch=function(t,n){var i=this.skipWhiteSpace(t);return r(t,i)?0:e.startsWith(t.substring(i),n)?i+n.length:0},this.getPitchFromTokens=function(e){var t={};if(t.position={A:5,B:6,C:0,D:1,E:2,F:3,G:4,a:12,b:13,c:7,d:8,e:9,f:10,g:11}[e[0].token],void 0===t.position)return{warn:"Pitch expected. Found: "+e[0].token};for(e.shift();e.length;)switch(e[0].token){case",":t.position-=7,e.shift();break;case"'":t.position+=7,e.shift();break;default:return t}return t},this.getKeyAccidentals2=function(e){for(var t;e.length>0;){var n;if("^"===e[0].token){if(n="sharp",e.shift(),0===e.length)return{accs:t,warn:"Expected note name after "+n};switch(e[0].token){case"^":n="dblsharp",e.shift();break;case"/":n="quartersharp",e.shift()}}else if("="===e[0].token)n="natural",e.shift();else{if("_"!==e[0].token)return{accs:t};if(n="flat",e.shift(),0===e.length)return{accs:t,warn:"Expected note name after "+n};switch(e[0].token){case"_":n="dblflat",e.shift();break;case"/":n="quarterflat",e.shift()}}if(0===e.length)return{accs:t,warn:"Expected note name after "+n};switch(e[0].token[0]){case"a":case"b":case"c":case"d":case"e":case"f":case"g":case"A":case"B":case"C":case"D":case"E":case"F":case"G":void 0===t&&(t=[]),t.push({acc:n,note:e[0].token[0]}),1===e[0].token.length?e.shift():e[0].token=e[0].token.substring(1);break;default:return{accs:t,warn:"Expected note name after "+n+" Found: "+e[0].token}}}return{accs:t}},this.getKeyAccidental=function(e){var t={"^":"sharp","^^":"dblsharp","=":"natural",_:"flat",__:"dblflat","_/":"quarterflat","^/":"quartersharp"},n=this.skipWhiteSpace(e);if(r(e,n))return{len:0};var i=null;switch(e[n]){case"^":case"_":case"=":i=e[n];break;default:return{len:0}}if(n++,r(e,n))return{len:1,warn:"Expected note name after accidental"};switch(e[n]){case"a":case"b":case"c":case"d":case"e":case"f":case"g":case"A":case"B":case"C":case"D":case"E":case"F":case"G":return{len:n+1,token:{acc:t[i],note:e[n]}};case"^":case"_":case"/":if(i+=e[n],n++,r(e,n))return{len:2,warn:"Expected note name after accidental"};switch(e[n]){case"a":case"b":case"c":case"d":case"e":case"f":case"g":case"A":case"B":case"C":case"D":case"E":case"F":case"G":return{len:n+1,token:{acc:t[i],note:e[n]}};default:return{len:2,warn:"Expected note name after accidental"}}break;default:return{len:1,warn:"Expected note name after accidental"}}},this.isWhiteSpace=function(e){return" "===e||"\t"===e||""===e},this.getMeat=function(e,t,n){var r=e.indexOf("%",t);for(r>=0&&r<n&&(n=r);t<n&&(" "===e[t]||"\t"===e[t]||""===e[t]);)t++;for(;t<n&&(" "===e[n-1]||"\t"===e[n-1]||""===e[n-1]);)n--;return{start:t,end:n}};var i=function(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"},a=function(e){return e>="0"&&e<="9"};this.tokenize=function(e,t,n,r){var s=this.getMeat(e,t,n);t=s.start,n=s.end;for(var o,c=[];t<n;){if('"'===e[t]){for(o=t+1;o<n&&'"'!==e[o];)o++;c.push({type:"quote",token:e.substring(t+1,o),start:t+1,end:o}),o++}else if(i(e[t])){if(o=t+1,r)for(;o<n&&!this.isWhiteSpace(e[o]);)o++;else for(;o<n&&i(e[o]);)o++;c.push({type:"alpha",token:e.substring(t,o),continueId:a(e[o]),start:t,end:o}),t=o+1}else if("."===e[t]&&a(e[o+1])){o=t+1;for(var l;o<n&&a(e[o]);)o++;l=parseFloat(e.substring(t,o)),c.push({type:"number",token:e.substring(t,o),intt:null,floatt:l,continueId:i(e[o]),start:t,end:o}),t=o+1}else if(a(e[t])||"-"===e[t]&&a(e[o+1])){o=t+1;for(var u,h=null;o<n&&a(e[o]);)o++;if("."===e[o]&&a(e[o+1]))for(o++;o<n&&a(e[o]);)o++;else h=parseInt(e.substring(t,o));u=parseFloat(e.substring(t,o)),c.push({type:"number",token:e.substring(t,o),intt:h,floatt:u,continueId:i(e[o]),start:t,end:o}),t=o+1}else" "===e[t]||"\t"===e[t]||c.push({type:"punct",token:e[t],start:t,end:t+1}),o=t+1;t=o}return c},this.getVoiceToken=function(e,t,n){for(var r=t;r<n&&this.isWhiteSpace(e[r])||"="===e[r];)r++;if('"'===e[r]){var i=e.indexOf('"',r+1);return-1===i||i>=n?{len:1,err:"Missing close quote"}:{len:i-t+1,token:this.translateString(e.substring(r+1,i))}}for(var a=r;a<n&&!this.isWhiteSpace(e[a])&&"="!==e[a];)a++;return{len:a-t+1,token:e.substring(r,a)}};var s={"`a":"à","'a":"á","^a":"â","~a":"ã",'"a':"ä",oa:"å",aa:"å","=a":"ā",ua:"ă",";a":"ą","`e":"è","'e":"é","^e":"ê",'"e':"ë","=e":"ē",ue:"ĕ",";e":"ę",".e":"ė","`i":"ì","'i":"í","^i":"î",'"i':"ï","=i":"ī",ui:"ĭ",";i":"į","`o":"ò","'o":"ó","^o":"ô","~o":"õ",'"o':"ö","=o":"ō",uo:"ŏ","/o":"ø","`u":"ù","'u":"ú","^u":"û","~u":"ũ",'"u':"ü",ou:"ů","=u":"ū",uu:"ŭ",";u":"ų","`A":"À","'A":"Á","^A":"Â","~A":"Ã",'"A':"Ä",oA:"Å",AA:"Å","=A":"Ā",uA:"Ă",";A":"Ą","`E":"È","'E":"É","^E":"Ê",'"E':"Ë","=E":"Ē",uE:"Ĕ",";E":"Ę",".E":"Ė","`I":"Ì","'I":"Í","^I":"Î","~I":"Ĩ",'"I':"Ï","=I":"Ī",uI:"Ĭ",";I":"Į",".I":"İ","`O":"Ò","'O":"Ó","^O":"Ô","~O":"Õ",'"O':"Ö","=O":"Ō",uO:"Ŏ","/O":"Ø","`U":"Ù","'U":"Ú","^U":"Û","~U":"Ũ",'"U':"Ü",oU:"Ů","=U":"Ū",uU:"Ŭ",";U":"Ų",ae:"æ",AE:"Æ",oe:"œ",OE:"Œ",ss:"ß","'c":"ć","^c":"ĉ",uc:"č",cc:"ç",".c":"ċ",cC:"Ç","'C":"Ć","^C":"Ĉ",uC:"Č",".C":"Ċ","~N":"Ñ","~n":"ñ","=s":"š",vs:"š",DH:"Ð",dh:"ð",HO:"Ő",Ho:"ő",HU:"Ű",Hu:"ű","'Y":"Ý","'y":"ý","^Y":"Ŷ","^y":"ŷ",'"Y':"Ÿ",'"y':"ÿ",vS:"Š",vZ:"Ž",vz:"ž"},o={"#":"♯",b:"♭","=":"♮"},c={201:"♯",202:"♭",203:"♮",241:"¡",242:"¢",252:"a",262:"2",272:"o",302:"Â",312:"Ê",322:"Ò",332:"Ú",342:"â",352:"ê",362:"ò",372:"ú",243:"£",253:"«",263:"3",273:"»",303:"Ã",313:"Ë",323:"Ó",333:"Û",343:"ã",353:"ë",363:"ó",373:"û",244:"¤",254:"¬",264:" ́",274:"1⁄4",304:"Ä",314:"Ì",324:"Ô",334:"Ü",344:"ä",354:"ì",364:"ô",374:"ü",245:"¥",255:"-",265:"μ",275:"1⁄2",305:"Å",315:"Í",325:"Õ",335:"Ý",345:"å",355:"í",365:"õ",375:"ý",246:"¦",256:"®",266:"¶",276:"3⁄4",306:"Æ",316:"Î",326:"Ö",336:"Þ",346:"æ",356:"î",366:"ö",376:"þ",247:"§",257:" ̄",267:"·",277:"¿",307:"Ç",317:"Ï",327:"×",337:"ß",347:"ç",357:"ï",367:"÷",377:"ÿ",250:" ̈",260:"°",270:" ̧",300:"À",310:"È",320:"Ð",330:"Ø",340:"à",350:"è",360:"ð",370:"ø",251:"©",261:"±",271:"1",301:"Á",311:"É",321:"Ñ",331:"Ù",341:"á",351:"é",361:"ñ",371:"ù"};function l(e){const t=/^(\d+)\./.exec(e);return t?t[1]:null}this.translateString=function(e){var t=e.split("\\");if(1===t.length)return e;var n=null;return t.forEach((function(e){if(null===n)n=e;else{var t=s[e.substring(0,2)];void 0!==t?n+=t+e.substring(2):void 0!==(t=c[e.substring(0,3)])?n+=t+e.substring(3):(t=o[e.substring(0,1)],n+=void 0!==t?t+e.substring(1):"\\"+e)}})),n},this.getNumber=function(e,t){for(var n=0;t<e.length;)switch(e[t]){case"0":n*=10,t++;break;case"1":n=10*n+1,t++;break;case"2":n=10*n+2,t++;break;case"3":n=10*n+3,t++;break;case"4":n=10*n+4,t++;break;case"5":n=10*n+5,t++;break;case"6":n=10*n+6,t++;break;case"7":n=10*n+7,t++;break;case"8":n=10*n+8,t++;break;case"9":n=10*n+9,t++;break;default:return{num:n,index:t}}return{num:n,index:t}},this.getFraction=function(e,t){var n=1,r=1;if("/"!==e[t]){var i=this.getNumber(e,t);n=i.num,t=i.index}if("/"===e[t]){if("/"===e[++t]){for(var a=.5;"/"===e[t++];)a/=2;return{value:n*a,index:t-1}}var s=t,o=this.getNumber(e,t);0===o.num&&s===t&&(o.num=2),0!==o.num&&(r=o.num),t=o.index}return{value:n/r,index:t}};var u=[{match:/,\s*[Tt]he$/,replace:"The "},{match:/,\s*[Aa]$/,replace:"A "},{match:/,\s*[Aa]n$/,replace:"An "}];this.theReverser=function(e){for(var t=0;t<u.length;t++){var n=u[t],r=e.match(n.match);if(r){var i=l(e);i&&(e=(e=e.replace(i+".","")).trim());var a=r[0].length,s=n.replace+e.substring(0,e.length-a);return i&&(s=i+". "+s),s}}return e},this.stripComment=function(t){var n=t.indexOf("%");return n>=0?e.strip(t.substring(0,n)):e.strip(t)},this.getInt=function(e){var t=parseInt(e);if(isNaN(t))return{digits:0};var n=""+t;return{value:t,digits:e.indexOf(n)+n.length}},this.getFloat=function(e){var t=parseFloat(e);if(isNaN(t))return{digits:0};var n=""+t;return{value:t,digits:e.indexOf(n)+n.length}},this.getMeasurement=function(e){if(0===e.length)return{used:0};var t=1,n="";if("-"===e[0].token)e.shift(),n="-",t++;else if("number"!==e[0].type)return{used:0};if(n+=e.shift().token,0===e.length)return{used:1,value:parseInt(n)};var r=e.shift();if("."===r.token){if(t++,0===e.length)return{used:t,value:parseInt(n)};if("number"===e[0].type&&(n=n+"."+(r=e.shift()).token,t++,0===e.length))return{used:t,value:parseFloat(n)};r=e.shift()}switch(r.token){case"pt":case"px":return{used:t+1,value:parseFloat(n)};case"cm":return{used:t+1,value:parseFloat(n)/2.54*72};case"in":return{used:t+1,value:72*parseFloat(n)};default:return e.unshift(r),{used:t,value:parseFloat(n)}}};var h=function(e){return(e=e.replace(/\\n/g,"\n")).replace(/\\"/g,'"')};this.getBrackettedSubstring=function(e,t,n,r){for(var i=r||e[t],a=t+1,s=!1;a<e.length&&(s||e[a]!==i);)s="\\"===e[a],++a;return e[a]===i?[a-t+1,h(e.substring(t+1,a)),!0]:((a=t+n)>e.length-1&&(a=e.length-1),[a-t+1,h(e.substring(t+1,a)),!1])}};return t.prototype.peekLine=function(){return this.lines[this.lineIndex]},t.prototype.nextLine=function(){if(this.lineIndex>0&&(this.multilineVars.iChar+=this.lines[this.lineIndex-1].length+1),this.lineIndex<this.lines.length){var e=this.lines[this.lineIndex];return this.lineIndex++,e}return null},dd=t}(),o=uv(),c=pv(),l=function(){if(Id)return Pd;Id=1;var e=cd();function t(e){if(!e)return!1;if("string"==typeof e)return!1;for(var t=0;t<e.length;t++)if("string"!=typeof e[t])return!1;return!0}function n(e){for(var t=!1,n=[],i=0;i<e.lines.length;i++){var a=e.lines[i];if(a.staff)for(var s=0;s<a.staff.length;s++){for(var o=a.staff[s],c=[],l=0;l<o.voices.length;l++){var u=o.voices[l];c.push({hasOverlay:!1,voice:[],snip:[]}),n[i]=0;for(var h=0,d=!1,f=-1,p=0;p<u.length;p++){var m=u[p];if("overlay"!==m.el_type||d)"bar"===m.el_type?(d?(d=!1,c[l].snip.push({start:f,len:p-f}),c[l].voice.push(m)):(h>0&&c[l].voice.push({el_type:"note",duration:h,rest:{type:"invisible"},startChar:m.startChar,endChar:m.endChar}),c[l].voice.push(m)),h=0):"note"===m.el_type?d?c[l].voice.push(m):(h+=m.duration,n[i]+=m.duration):"scale"!==m.el_type&&"stem"!==m.el_type&&"overlay"!==m.el_type&&"style"!==m.el_type&&"transpose"!==m.el_type&&"color"!==m.el_type||c[l].voice.push(m);else{t=!0,d=!0,f=p,c[l].hasOverlay=!0;for(var g=0;g<i;g++)n[g]&&e.lines[g].staff&&o.voices.length>=e.lines[g].staff[0].voices.length&&e.lines[g].staff[0].voices.push([{el_type:"note",duration:n[g],rest:{type:"invisible"},startChar:m.startChar,endChar:m.endChar}])}}c[l].hasOverlay&&0===c[l].snip.length&&c[l].snip.push({start:f,len:u.length-f})}for(l=0;l<c.length;l++){var v=c[l];if(v.hasOverlay){v.voice.splice(0,0,{el_type:"stem",direction:"down"}),o.voices.push(v.voice);for(var y=v.snip.length-1;y>=0;y--){var b=v.snip[y];o.voices[l].splice(b.start,b.len),o.voices[l].splice(b.start+1,0,{el_type:"stem",direction:"auto"});var _=r(o.voices[l],b.start);o.voices[l].splice(_,0,{el_type:"stem",direction:"up"})}for(y=0;y<o.voices[o.voices.length-1].length;y++){o.voices[o.voices.length-1][y]=Object.assign({},o.voices[o.voices.length-1][y]);var w=o.voices[o.voices.length-1][y];"bar"===w.el_type&&w.startEnding&&delete w.startEnding,"bar"===w.el_type&&w.endEnding&&delete w.endEnding}}}}}return t}function r(e,t){for(var n=t-1;n>0&&"bar"!==e[n].el_type;n--);return n}function a(e,t,n,r){var i;r[t]||(r[t]=[]),r[t][n]||(r[t][n]=[]);for(var a=function(e,a,s){if(void 0===r[t][n][s]){for(i=0;i<r[t][n].length;i++)if(void 0!==r[t][n][i]){s=i;break}if(void 0===r[t][n][s]){var o=100*s+1;e.endSlur.forEach((function(e){o===e&&--o})),r[t][n][s]=[o]}}for(var c,l=0;l<a;l++)c=r[t][n][s].pop(),e.endSlur.push(c);return 0===r[t][n][s].length&&delete r[t][n][s],c},s=function(e,i,a,s){e.startSlur=[],void 0===r[t][n][a]&&(r[t][n][a]=[]);for(var o=100*a+1,c=0;c<i;c++)s&&(s.forEach((function(e){o===e&&++o})),s.forEach((function(e){o===e&&++o})),s.forEach((function(e){o===e&&++o}))),r[t][n][a].forEach((function(e){o===e&&++o})),r[t][n][a].forEach((function(e){o===e&&++o})),r[t][n][a].push(o),e.startSlur.push({label:o}),e.dottedSlur&&(e.startSlur[e.startSlur.length-1].style="dotted",delete e.dottedSlur),o++},o=0;o<e.length;o++){var c=e[o];if("note"===c.el_type){if(c.gracenotes)for(var l=0;l<c.gracenotes.length;l++){if(c.gracenotes[l].endSlur){var u=c.gracenotes[l].endSlur;c.gracenotes[l].endSlur=[];for(var h=0;h<u;h++)a(c.gracenotes[l],1,20)}c.gracenotes[l].startSlur&&(i=c.gracenotes[l].startSlur,s(c.gracenotes[l],i,20))}if(c.endSlur&&(i=c.endSlur,c.endSlur=[],a(c,i,0)),c.startSlur&&s(c,i=c.startSlur,0),c.pitches){for(var d=[],f=0;f<c.pitches.length;f++)if(c.pitches[f].endSlur){var p=c.pitches[f].endSlur;c.pitches[f].endSlur=[];for(var m=0;m<p;m++){var g=a(c.pitches[f],1,f+1);d.push(g)}}for(f=0;f<c.pitches.length;f++)c.pitches[f].startSlur&&(i=c.pitches[f].startSlur,s(c.pitches[f],i,f+1,d));c.gracenotes&&c.pitches[0].endSlur&&100===c.pitches[0].endSlur[0]&&c.pitches[0].startSlur&&(c.gracenotes[0].endSlur?c.gracenotes[0].endSlur.push(c.pitches[0].startSlur[0].label):c.gracenotes[0].endSlur=[c.pitches[0].startSlur[0].label],1===c.pitches[0].endSlur.length?delete c.pitches[0].endSlur:100===c.pitches[0].endSlur[0]?c.pitches[0].endSlur.shift():100===c.pitches[0].endSlur[c.pitches[0].endSlur.length-1]&&c.pitches[0].endSlur.pop(),1===r[t][n][1].length?delete r[t][n][1]:r[t][n][1].pop())}}}}function o(e,t){for(i=0;i<e.length;i++)if(void 0!==e[i].staff)for(s=0;s<e[i].staff.length;s++){var n=[];for(v=0;v<e[i].staff[s].voices.length;v++)for(var r=e[i].staff[s].voices[v],a=0,o=0;o<r.length;o++)if("bar"===r[o].el_type){if(++a>=t&&o<r.length-1){var l=c(e,i);if(!l){var u=JSON.parse(JSON.stringify(e[i]));e.push(Object.assign({},u)),l=e[e.length-1];for(var h=0;h<l.staff.length;h++)for(var d=0;d<l.staff[h].voices.length;d++)l.staff[h].voices[d]=[]}var f=o+1,p=e[i].staff[s].voices[v].slice(f);return e[i].staff[s].voices[v]=e[i].staff[s].voices[v].slice(0,f),l.staff[s].voices[v]=n.concat(p.concat(l.staff[s].voices[v])),!0}}else r[o].duration||n.push(r[o])}return!1}function c(e,t){for(t++;e.length>t;){if(e[t].staff)return e[t];t++}return null}function l(e){e.potentialStartBeam&&e.potentialEndBeam&&(e.potentialStartBeam.startBeam=!0,e.potentialEndBeam.endBeam=!0),delete e.potentialStartBeam,delete e.potentialEndBeam}function u(e){for(var t=0;t<e.length;t++)if("note"===e[t].el_type||"bar"===e[t].el_type)return!0;return!1}function h(e){for(var t=0;t<e.length;t++)if("note"===e[t].el_type&&(void 0===e[t].rest||void 0!==e[t].chord))return!0;return!1}function d(e,t){e.vskipPending&&(t.vskip=e.vskipPending,delete e.vskipPending),e.lines.push(t)}function f(e){void 0!==e.potentialStartBeam&&void 0!==e.potentialEndBeam&&(e.potentialStartBeam.startBeam=!0,e.potentialEndBeam.endBeam=!0),delete e.potentialStartBeam,delete e.potentialEndBeam}function p(e,t,n){if(e.runningFonts[t]){for(var r=!1,i=Object.keys(n),a=0;a<i.length;a++)e.runningFonts[t][i[a]]!==n[i[a]]&&(r=!0);r&&(e.lines[e.lineNum].staff[e.staffNum][t]=n)}e.runningFonts[t]=n}function m(e,t,n){var r=t.lines[t.lineNum].staff[t.staffNum];if(r.voices[t.voiceNum]=[],r.title||(r.title=[]),r.title[t.voiceNum]={name:n.name,subname:n.subname},n.style&&e.appendElement("style",null,null,{head:n.style}),n.stem)e.appendElement("stem",null,null,{direction:n.stem});else if(t.voiceNum>0){if(void 0!==r.voices[0]){for(var i=!1,a=0;a<r.voices[0].length;a++)"stem"===r.voices[0].el_type&&(i=!0);i||r.voices[0].splice(0,0,{el_type:"stem",direction:"up"})}e.appendElement("stem",null,null,{direction:"down"})}n.scale&&e.appendElement("scale",null,null,{size:n.scale}),n.color&&e.appendElement("color",null,null,{color:n.color})}function g(e,t,n){n.key&&n.key.impliedNaturals&&(n.key.accidentals=n.key.accidentals.concat(n.key.impliedNaturals),delete n.key.impliedNaturals),t.lines[t.lineNum].staff[t.staffNum]={voices:[],clef:n.clef,key:n.key,workingClef:n.clef};var r=t.lines[t.lineNum].staff[t.staffNum];void 0!==n.stafflines&&(r.clef.stafflines=n.stafflines,r.workingClef.stafflines=n.stafflines),n.staffscale&&(r.staffscale=n.staffscale),n.annotationfont&&p(t,"annotationfont",n.annotationfont),n.gchordfont&&p(t,"gchordfont",n.gchordfont),n.tripletfont&&p(t,"tripletfont",n.tripletfont),n.vocalfont&&p(t,"vocalfont",n.vocalfont),n.bracket&&(r.bracket=n.bracket),n.brace&&(r.brace=n.brace),n.connectBarLines&&(r.connectBarLines=n.connectBarLines),n.barNumber&&(r.barNumber=n.barNumber),m(e,t,n),n.part&&e.appendElement("part",n.part.startChar,n.part.endChar,{title:n.part.title}),void 0!==n.meter&&(r.meter=n.meter),t.vskipPending&&(t.lines[t.lineNum].vskip=t.vskipPending,delete t.vskipPending)}return Pd=function(r){var i=this,s={},p="";r.reset(),this.setVisualTranspose=function(e){e&&(r.visualTranspose=e)},this.cleanUp=function(i,s,d){var f;l(r),delete r.runningFonts,t((f=r).metaText.notes)&&(f.metaText.notes=f.metaText.notes.join("\n")),t(f.metaText.history)&&(f.metaText.history=f.metaText.history.join("\n")),r.metaText.tempo&&r.metaText.tempo.bpm&&!r.metaText.tempo.duration&&(r.metaText.tempo.duration=[r.getBeatLength()]);var p,m,g=!1;for(b=0;b<r.lines.length;b++)if(void 0!==r.lines[b].staff){var v=!1;for(p=0;p<r.lines[b].staff.length;p++)if(void 0===r.lines[b].staff[p])g=!0,r.lines[b].staff[p]=null;else for(m=0;m<r.lines[b].staff[p].voices.length;m++)void 0===r.lines[b].staff[p].voices[m]?r.lines[b].staff[p].voices[m]=[]:u(r.lines[b].staff[p].voices[m])&&(v=!0);v||(r.lines[b]=null,g=!0)}if(g&&(r.lines=r.lines.filter((function(e){return!!e})),r.lines.forEach((function(e){e.staff&&(e.staff=e.staff.filter((function(e){return!!e})))}))),i)for(;o(r.lines,i););if(s){for(g=!1,b=0;b<r.lines.length;b++)if(void 0!==r.lines[b].staff)for(p=0;p<r.lines[b].staff.length;p++){var y=!1;for(m=0;m<r.lines[b].staff[p].voices.length;m++)h(r.lines[b].staff[p].voices[m])&&(y=!0);y||(g=!0,r.lines[b].staff[p]=null)}g&&r.lines.forEach((function(e){e.staff&&(e.staff=e.staff.filter((function(e){return!!e})))}))}for(function(e){for(var t=!0,n=0;n<e.length;n++){var r=e[n];if(r.staff){for(var i=0;i<r.staff.length;i++){var a=r.staff[i];if(a.title){for(var s=!1,o=0;o<a.title.length;o++)a.title[o]?(a.title[o]=t?a.title[o].name:a.title[o].subname,a.title[o]?s=!0:a.title[o]=""):a.title[o]="";s||delete a.title}}t=!1}}}(r.lines),b=0;b<r.lines.length;b++)if(r.lines[b].staff)for(p=0;p<r.lines[b].staff.length;p++)delete r.lines[b].staff[p].workingClef;for(;n(r););for(var b=0;b<r.lines.length;b++){var _=r.lines[b].staff;if(_)for(r.staffNum=0;r.staffNum<_.length;r.staffNum++)for(_[r.staffNum].clef&&e.fixClef(_[r.staffNum].clef),r.voiceNum=0;r.voiceNum<_[r.staffNum].voices.length;r.voiceNum++){var w=_[r.staffNum].voices[r.voiceNum];a(w,r.staffNum,r.voiceNum,d);for(var x=0;x<w.length;x++)"clef"===w[x].el_type&&e.fixClef(w[x]);if(w.length>0&&w[w.length-1].barNumber){var k=c(r.lines,b);k&&(k.staff[0].barNumber=w[w.length-1].barNumber),delete w[w.length-1].barNumber}}}return delete r.staffNum,delete r.voiceNum,delete r.lineNum,delete r.potentialStartBeam,delete r.potentialEndBeam,delete r.vskipPending,d},this.addTieToLastNote=function(e){var t=function(e){if(!e.lines[e.lineNum])return null;if(!e.lines[e.lineNum].staff)return null;if(!e.lines[e.lineNum].staff[e.staffNum])return null;var t=e.lines[e.lineNum].staff[e.staffNum].voices[e.voiceNum];if(!t)return null;for(var n=t.length-1;n>=0;n--){var r=t[n];if("note"===r.el_type)return r}return null}(r);return!!(t&&t.pitches&&t.pitches.length>0)&&(t.pitches[0].startTie={},e&&(t.pitches[0].startTie.style="dotted"),!0)},this.appendElement=function(e,t,n,a){var o,c,l;return a.el_type=e,null!==t&&(a.startChar=t),null!==n&&(a.endChar=n),"note"===e?((o=a).duration?o.duration:0)>=.25||a.force_end_beam_last&&void 0!==r.potentialStartBeam?f(r):a.end_beam&&void 0!==r.potentialStartBeam?void 0===a.rest?(c=a,(l=r).potentialStartBeam.startBeam=!0,c.endBeam=!0,delete l.potentialStartBeam,delete l.potentialEndBeam):f(r):void 0===a.rest&&(void 0===r.potentialStartBeam?a.end_beam||(r.potentialStartBeam=a,delete r.potentialEndBeam):r.potentialEndBeam=a):f(r),delete a.end_beam,delete a.force_end_beam_last,a.rest&&"invisible"===a.rest.type&&delete a.decoration,!(r.lines.length<=r.lineNum||r.lines[r.lineNum].staff.length<=r.staffNum||(function(e,t,n,r,i){var a=t.lines[t.lineNum].staff[t.staffNum];if(void 0!==n.pitches){var s=a.workingClef.verticalPos;n.pitches.forEach((function(e){e.verticalPos=e.pitch-s}))}if(void 0!==n.gracenotes){var o=a.workingClef.verticalPos;n.gracenotes.forEach((function(e){e.verticalPos=e.pitch-o}))}a.voices.length<=t.voiceNum&&(r[i]||(r[i]={}),m(e,t,r[i])),a.voices[t.voiceNum].push(n)}(i,r,a,s,p),0))},this.appendStartingElement=function(e,t,n,i){var a;l(r),"key"===e&&(a=i.impliedNaturals,delete i.impliedNaturals,delete i.explicitAccidentals);var s=Object.assign({},i);if(r.lines[r.lineNum]){var o=r.lines[r.lineNum].staff;if(o){o.length<=r.staffNum&&(o[r.staffNum]={},o[r.staffNum].clef=Object.assign({},o[0].clef),o[r.staffNum].key=Object.assign({},o[0].key),o[0].meter&&(o[r.staffNum].meter=Object.assign({},o[0].meter)),o[r.staffNum].workingClef=Object.assign({},o[0].workingClef),o[r.staffNum].voices=[[]]),"clef"===e&&(o[r.staffNum].workingClef=s);for(var c=o[r.staffNum].voices[r.voiceNum],u=0;u<c.length;u++){if("note"===c[u].el_type||"bar"===c[u].el_type)return s.el_type=e,s.startChar=t,s.endChar=n,a&&(s.accidentals=a.concat(s.accidentals)),void c.push(s);if(c[u].el_type===e)return s.el_type=e,s.startChar=t,s.endChar=n,a&&(s.accidentals=a.concat(s.accidentals)),void(c[u]=s)}o[r.staffNum][e]=i}}},this.addSubtitle=function(e,t){d(r,{subtitle:{text:e,startChar:t.startChar,endChar:t.endChar}})},this.addSpacing=function(e){r.vskipPending=e},this.addNewPage=function(e){d(r,{newpage:e})},this.addSeparator=function(e,t,n,i){d(r,{separator:{spaceAbove:Math.round(e),spaceBelow:Math.round(t),lineLength:Math.round(n),startChar:i.startChar,endChar:i.endChar}})},this.addText=function(e,t){d(r,{text:{text:e,startChar:t.startChar,endChar:t.endChar}})},this.addCentered=function(e){d(r,{text:[{text:e,center:!0}]})},this.changeVoiceScale=function(e){i.appendElement("scale",null,null,{size:e})},this.changeVoiceColor=function(e){i.appendElement("color",null,null,{color:e})},this.startNewLine=function(e){var t,n,a;l(r),e.currentVoiceName&&(p=e.currentVoiceName,s[e.currentVoiceName]=e),void 0===r.lines[r.lineNum]?(t=i,a=e,(n=r).lines[n.lineNum]={staff:[]},g(t,n,a)):void 0===r.lines[r.lineNum].staff?(r.lineNum++,this.startNewLine(e)):void 0===r.lines[r.lineNum].staff[r.staffNum]?g(i,r,e):void 0===r.lines[r.lineNum].staff[r.staffNum].voices[r.voiceNum]?m(i,r,e):u(r.lines[r.lineNum].staff[r.staffNum].voices[r.voiceNum])?(r.lineNum++,this.startNewLine(e)):e.part&&i.appendElement("part",e.part.startChar,e.part.endChar,{title:e.part.title})},this.setRunningFont=function(e,t){r.runningFonts[e]=t},this.setBarNumberImmediate=function(e){var t=this.getCurrentVoice();if(t&&t.length>0){var n=t[t.length-1];if("bar"!==n.el_type)return e-1;void 0!==n.barNumber&&(n.barNumber=e)}return e},this.hasBeginMusic=function(){for(var e=0;e<r.lines.length;e++)if(r.lines[e].staff)return!0;return!1},this.isFirstLine=function(e){for(var t=e-1;t>=0;t--)if(void 0!==r.lines[t].staff)return!1;return!0},this.getCurrentVoice=function(){var e=function(e,t){for(;t>=0;){if(e[t].staff)return e[t];t--}return null}(r.lines,r.lineNum);if(!e)return null;var t=e.staff[r.staffNum];return t&&void 0!==t.voices[r.voiceNum]?t.voices[r.voiceNum]:null},this.setCurrentVoice=function(e,t,n){r.staffNum=e,r.voiceNum=t,p=n;for(var i=0;i<r.lines.length;i++)if(r.lines[i].staff&&(void 0===r.lines[i].staff[e]||void 0===r.lines[i].staff[e].voices[t]||!u(r.lines[i].staff[e].voices[t])))return r.lineNum=i,!(r.lines[i].staff[e]&&!r.lines[i].staff[e].voices[t]);return r.lineNum=i,!1},this.addMetaText=function(e,t,n){void 0===r.metaText[e]?(r.metaText[e]=t,r.metaTextInfo[e]=n):("string"==typeof r.metaText[e]&&"string"==typeof t?r.metaText[e]+="\n"+t:("string"===r.metaText[e]&&(r.metaText[e]=[{text:r.metaText[e]}]),"string"==typeof t&&(t=[{text:t}]),r.metaText[e]=r.metaText[e].concat(t)),r.metaTextInfo[e].endChar=n.endChar)},this.addMetaTextArray=function(e,t,n){void 0===r.metaText[e]?(r.metaText[e]=[t],r.metaTextInfo[e]=n):(r.metaText[e].push(t),r.metaTextInfo[e].endChar=n.endChar)},this.addMetaTextObj=function(e,t,n){r.metaText[e]=t,r.metaTextInfo[e]=n}}}();return Nd=function(){var i,s=new c,u=new l(s),h="",d="";function f(e,t,n){e.positioning||(e.positioning={}),e.positioning[t]=n}function p(e,t,n){e.fonts||(e.fonts={}),e.fonts[t]=n}this.getTune=function(){var e={formatting:s.formatting,lines:s.lines,media:s.media,metaText:s.metaText,metaTextInfo:s.metaTextInfo,version:s.version,addElementToEvents:s.addElementToEvents,addUsefulCallbackInfo:s.addUsefulCallbackInfo,getTotalTime:s.getTotalTime,getTotalBeats:s.getTotalBeats,getBarLength:s.getBarLength,getBeatLength:s.getBeatLength,getBeatsPerMeasure:s.getBeatsPerMeasure,getBpm:s.getBpm,getMeter:s.getMeter,getMeterFraction:s.getMeterFraction,getPickupLength:s.getPickupLength,getKeySignature:s.getKeySignature,getElementFromChar:s.getElementFromChar,makeVoicesArray:s.makeVoicesArray,millisecondsPerMeasure:s.millisecondsPerMeasure,setupEvents:s.setupEvents,setTiming:s.setTiming,setUpAudio:s.setUpAudio,deline:s.deline,findSelectableElement:s.findSelectableElement,getSelectableArray:s.getSelectableArray};return s.lineBreaks&&(e.lineBreaks=s.lineBreaks),s.visualTranspose&&(e.visualTranspose=s.visualTranspose),e};var m,g,v={reset:function(){for(var e in this)this.hasOwnProperty(e)&&"function"!=typeof this[e]&&delete this[e];this.iChar=0,this.key={accidentals:[],root:"none",acc:"",mode:""},this.meter=null,this.origMeter=null,this.hasMainTitle=!1,this.default_length=.125,this.clef={type:"treble",verticalPos:0},this.octave=0,this.next_note_duration=0,this.start_new_line=!0,this.is_in_header=!0,this.partForNextLine={},this.tempoForNextLine=[],this.havent_set_length=!0,this.voices={},this.staves=[],this.macros={},this.currBarNumber=1,this.barCounter={},this.ignoredDecorations=[],this.score_is_present=!1,this.inEnding=!1,this.inTie=[],this.inTieChord={},this.vocalPosition="auto",this.dynamicPosition="auto",this.chordPosition="auto",this.ornamentPosition="auto",this.volumePosition="auto",this.openSlurs=[],this.freegchord=!1,this.endingHoldOver={}},differentFont:function(e,t){return this[e].decoration!==t[e].decoration||this[e].face!==t[e].face||this[e].size!==t[e].size||this[e].style!==t[e].style||this[e].weight!==t[e].weight},addFormattingOptions:function(e,t,n){"note"===n?("auto"!==this.vocalPosition&&f(e,"vocalPosition",this.vocalPosition),"auto"!==this.dynamicPosition&&f(e,"dynamicPosition",this.dynamicPosition),"auto"!==this.chordPosition&&f(e,"chordPosition",this.chordPosition),"auto"!==this.ornamentPosition&&f(e,"ornamentPosition",this.ornamentPosition),"auto"!==this.volumePosition&&f(e,"volumePosition",this.volumePosition),this.differentFont("annotationfont",t)&&p(e,"annotationfont",this.annotationfont),this.differentFont("gchordfont",t)&&p(e,"gchordfont",this.gchordfont),this.differentFont("vocalfont",t)&&p(e,"vocalfont",this.vocalfont),this.differentFont("tripletfont",t)&&p(e,"tripletfont",this.tripletfont)):"bar"===n&&("auto"!==this.dynamicPosition&&f(e,"dynamicPosition",this.dynamicPosition),"auto"!==this.chordPosition&&f(e,"chordPosition",this.chordPosition),"auto"!==this.ornamentPosition&&f(e,"ornamentPosition",this.ornamentPosition),"auto"!==this.volumePosition&&f(e,"volumePosition",this.volumePosition),this.differentFont("measurefont",t)&&p(e,"measurefont",this.measurefont),this.differentFont("repeatfont",t)&&p(e,"repeatfont",this.repeatfont))},duplicateStartEndingHoldOvers:function(){this.endingHoldOver={inTie:[],inTieChord:{}};for(var e=0;e<this.inTie.length;e++)if(this.endingHoldOver.inTie.push([]),this.inTie[e])for(var t=0;t<this.inTie[e].length;t++)this.endingHoldOver.inTie[e].push(this.inTie[e][t]);for(var n in this.inTieChord)this.inTieChord.hasOwnProperty(n)&&(this.endingHoldOver.inTieChord[n]=this.inTieChord[n])},restoreStartEndingHoldOvers:function(){if(this.endingHoldOver.inTie){this.inTie=[],this.inTieChord={};for(var e=0;e<this.endingHoldOver.inTie.length;e++){this.inTie.push([]);for(var t=0;t<this.endingHoldOver.inTie[e].length;t++)this.inTie[e].push(this.endingHoldOver.inTie[e][t])}for(var n in this.endingHoldOver.inTieChord)this.endingHoldOver.inTieChord.hasOwnProperty(n)&&(this.inTieChord[n]=this.endingHoldOver.inTieChord[n])}}},y=function(e){var t=e.replace(/\x12/g," ");return(t=(t=t.replace(/&/g,"&amp;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;")},b=function(e,t,n){t||(t=" ");var r=t[n];" "!==r&&r||(r="SPACE");var a,s,o=y(t.substring(n-64,n))+'<span style="text-decoration:underline;font-size:1.3em;font-weight:bold;">'+r+"</span>"+y(t.substring(n+1).substring(0,64));s="Music Line:"+i.lineIndex+":"+(n+1)+": "+e+": "+o,v.warnings||(v.warnings=[]),v.warnings.push(s),a={message:e,line:t,startChar:v.iChar+n,column:n},v.warningObjects||(v.warningObjects=[]),v.warningObjects.push(a)};this.getWarnings=function(){return v.warnings},this.getWarningObjects=function(){return v.warningObjects};var _=function(t,n){if(n.indexOf("")>=0)h+=n;else if(n=h+n,h="",t){"-"!==(n=e.strip(n))[n.length-1]&&(n+=" ");for(var r=[],a=0,s=!1,o=function(t){var o=e.strip(n.substring(a,t));if(o=o.replace(/\\([-_*|~])/g,"$1"),a=t+1,o.length>0){s&&(o=o.replace(/~/g," "));var c=n[t];return"_"!==c&&"-"!==c&&(c=" "),r.push({syllable:i.translateString(o),divider:c}),s=!1,!0}return!1},c=!1,l=0;l<n.length;l++){switch(n[l]){case" ":case"":o(l);break;case"-":!c&&!o(l)&&r.length>0&&(e.last(r).divider="-",r.push({skip:!0,to:"next"}));break;case"_":c||(o(l),r.push({skip:!0,to:"slur"}));break;case"*":c||(o(l),r.push({skip:!0,to:"next"}));break;case"|":c||(o(l),r.push({skip:!0,to:"bar"}));break;case"~":c||(s=!0)}c="\\"===n[l]}t.forEach((function(e){if(0!==r.length)if(r[0].skip){switch(r[0].to){case"next":case"slur":"note"===e.el_type&&null!==e.pitches&&r.shift();break;case"bar":"bar"===e.el_type&&r.shift()}"bar"!==e.el_type&&(void 0===e.lyric?e.lyric=[{syllable:"",divider:" "}]:e.lyric.push({syllable:"",divider:" "}))}else if("note"===e.el_type&&void 0===e.rest){var t=r.shift();t.syllable&&(t.syllable=t.syllable.replace(/ +/g," ")),void 0===e.lyric?e.lyric=[t]:e.lyric.push(t)}}))}else b("Can't add words before the first line of music",t,0)},w=function(t,n){if(n.indexOf("")>=0)d+=n;else if(n=d+n,d="",t){"-"!==(n=e.strip(n))[n.length-1]&&(n+=" ");for(var r=[],a=0,s=!1,o=function(t){var o=e.strip(n.substring(a,t));if(a=t+1,o.length>0){s&&(o=o.replace(/~/g," "));var c=n[t];return"_"!==c&&"-"!==c&&(c=" "),r.push({syllable:i.translateString(o),divider:c}),s=!1,!0}return!1},c=0;c<n.length;c++)switch(n[c]){case" ":case"":o(c);break;case"-":!o(c)&&r.length>0&&(e.last(r).divider="-",r.push({skip:!0,to:"next"}));break;case"_":o(c),r.push({skip:!0,to:"slur"});break;case"*":o(c),r.push({skip:!0,to:"next"});break;case"|":o(c),r.push({skip:!0,to:"bar"});break;case"~":s=!0}t.forEach((function(e){if(0!==r.length)if(r[0].skip)switch(r[0].to){case"next":case"slur":"note"===e.el_type&&null!==e.pitches&&r.shift();break;case"bar":"bar"===e.el_type&&r.shift()}else if("note"===e.el_type&&void 0===e.rest){var t=r.shift();void 0===e.lyric?e.lyric=[t]:e.lyric.push(t)}}))}else b("Can't add symbols before the first line of music",t,0)},x=function(n){if(e.startsWith(n,"%%")){var r=t.addDirective(n.substring(2));r&&b(r,n,2)}else{var i=n.indexOf("%");if(i>=0&&(n=n.substring(0,i)),0!==(n=n.replace(/\s+$/,"")).length)if(h)_(u.getCurrentVoice(),n.substring(2));else if(d)w(u.getCurrentVoice(),n.substring(2));else if(n.length<2||":"!==n[1]||g.lineContinuation)g.parseMusic(n);else{var a=m.parseHeader(n);a.regular&&g.parseMusic(n),a.newline&&g.startNewLine(),a.words&&_(u.getCurrentVoice(),n.substring(2)),a.symbols&&w(u.getCurrentVoice(),n.substring(2))}}};function k(e,t){e.push({el_type:"hint"});for(var n=0;n<t.length;n++){var r=t[n],i=Object.assign({},r);if(e.push(i),"bar"===r.el_type)return}}function S(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=t[n];if(i)for(var a=0;a<i.voices.length;a++){var s=i.voices[a],o=r.voices[a];o&&k(o,s)}}}this.parse=function(c,l,f){l||(l={}),f||(f=0),s.reset();var p=(c=c.replace(/\r\n?/g,"\n")+"\n").split("\n\\");if(p.length>1){for(var y=1;y<p.length;y++)for(;p[y].length>0&&"\n"!==p[y][0];)p[y]=p[y].substr(1),p[y-1]+=" ";c=p.join(" ")}var k=(c=c.replace(/\\([ \t]*)(%.*)*\n/g,(function(e,t,n){return t+""+(n?Array(n.length+1).join(" "):"")+"\n"}))).split("\n");0===e.last(k).length&&k.pop(),i=new a(k,v),m=new n(i,b,v,s,u),g=new r(i,b,v,s,u,m),l.print&&(s.media="print"),v.reset(),v.iChar=f,l.visualTranspose?(v.globalTranspose=parseInt(l.visualTranspose),0===v.globalTranspose?v.globalTranspose=void 0:u.setVisualTranspose(l.visualTranspose)):v.globalTranspose=void 0,l.lineBreaks&&(v.lineBreaks=l.lineBreaks),m.reset(i,b,v,s);try{l.format&&t.globalFormatting(l.format);for(var C=i.nextLine();C;){if(l.header_only&&!1===v.is_in_header)throw"normal_abort";if(l.stop_on_warning&&v.warnings)throw"normal_abort";var M=v.is_in_header;x(C),M&&!v.is_in_header&&(u.setRunningFont("annotationfont",v.annotationfont),u.setRunningFont("gchordfont",v.gchordfont),u.setRunningFont("tripletfont",v.tripletfont),u.setRunningFont("vocalfont",v.vocalfont)),C=i.nextLine()}h&&_(u.getCurrentVoice(),""),d&&w(u.getCurrentVoice(),""),v.openSlurs=u.cleanUp(v.barsperstaff,v.staffnonote,v.openSlurs)}catch(P){if("normal_abort"!==P)throw P}var E=792,T=612;switch(v.papersize){case"legal":E=1008,T=612;break;case"A4":E=842.4,T=597.6}if(v.landscape){var A=E;E=T,T=A}s.formatting.pagewidth||(s.formatting.pagewidth=T),s.formatting.pageheight||(s.formatting.pageheight=E),l.hint_measures&&function(){for(var e=0;e<s.lines.length;e++){var t=s.lines[e].staff;if(t){for(var n=e+1;n<s.lines.length&&void 0===s.lines[n].staff;)n++;n<s.lines.length&&S(t,s.lines[n].staff)}}}(),o.wrapLines(s,v.lineBreaks,v.barNumbers)}}}function gv(){if(Fd)return Vd;Fd=1;var e=function(e,t){this.children=[],this.beams=[],this.otherchildren=[],this.w=0,this.duplicate=!1,this.voicenumber=e,this.voicetotal=t,this.bottom=7,this.top=7,this.specialY={tempoHeightAbove:0,partHeightAbove:0,volumeHeightAbove:0,dynamicHeightAbove:0,endingHeightAbove:0,chordHeightAbove:0,lyricHeightAbove:0,lyricHeightBelow:0,chordHeightBelow:0,volumeHeightBelow:0,dynamicHeightBelow:0}};return e.prototype.addChild=function(e){if("bar"===e.type){for(var t=!0,n=0;t&&n<this.children.length;n++)this.children[n].type.indexOf("staff-extra")<0&&"tempo"!==this.children[n].type&&(t=!1);t||(this.beams.push("bar"),this.otherchildren.push("bar"))}this.children[this.children.length]=e,this.setRange(e)},e.prototype.setLimit=function(e,t){var n=t.specialY;n||(n=t),n[e]&&(this.specialY[e]?this.specialY[e]=Math.max(this.specialY[e],n[e]):this.specialY[e]=n[e])},e.prototype.adjustRange=function(e){void 0!==e.bottom&&(this.bottom=Math.min(this.bottom,e.bottom)),void 0!==e.top&&(this.top=Math.max(this.top,e.top))},e.prototype.setRange=function(e){this.adjustRange(e),this.setLimit("tempoHeightAbove",e),this.setLimit("partHeightAbove",e),this.setLimit("volumeHeightAbove",e),this.setLimit("dynamicHeightAbove",e),this.setLimit("endingHeightAbove",e),this.setLimit("chordHeightAbove",e),this.setLimit("lyricHeightAbove",e),this.setLimit("lyricHeightBelow",e),this.setLimit("chordHeightBelow",e),this.setLimit("volumeHeightBelow",e),this.setLimit("dynamicHeightBelow",e)},e.prototype.addOther=function(e){this.otherchildren.push(e),this.setRange(e)},e.prototype.addBeam=function(e){this.beams.push(e)},e.prototype.setWidth=function(e){this.w=e},Vd=e}function vv(){return jd?zd:(jd=1,zd=function(e,t,n,r){if(e)for(var i=0;i<e.length;i++){var a=e[i],s=a.getAttribute("highlight");s||(s="fill"),a.setAttribute(s,r);var o=a.getAttribute("class");o||(o=""),o=(o=o.replace(n,"")).replace(t,""),t.length>0&&(o.length>0&&" "!==o[o.length-1]&&(o+=" "),o+=t),a.setAttribute("class",o)}})}function yv(){if(Hd)return qd;Hd=1;var e=vv();return qd=function(t,n){void 0===t&&(t="abcjs-note_selected"),void 0===n&&(n="#ff0000"),e(this.elemset,t,"",n)}}function bv(){if(Gd)return Ud;Gd=1;var e=vv();return Ud=function(t,n){void 0===t&&(t="abcjs-note_selected"),void 0===n&&(n="#000000"),e(this.elemset,"",t,n)}}function _v(){if(Yd)return Wd;Yd=1;var e=yv(),t=bv(),n=function(e,t,n,r,i,a){a||(a={}),this.tuneNumber=i,this.abcelem=e,this.duration=t,this.durationClass=a.durationClassOveride?a.durationClassOveride:this.duration,this.minspacing=n||0,this.x=0,this.children=[],this.heads=[],this.extra=[],this.extraw=0,this.w=0,this.right=[],this.invisible=!1,this.bottom=void 0,this.top=void 0,this.type=r,this.fixed={w:0,t:void 0,b:void 0},this.specialY={tempoHeightAbove:0,partHeightAbove:0,volumeHeightAbove:0,dynamicHeightAbove:0,endingHeightAbove:0,chordHeightAbove:0,lyricHeightAbove:0,lyricHeightBelow:0,chordHeightBelow:0,volumeHeightBelow:0,dynamicHeightBelow:0}};return n.prototype.getFixedCoords=function(){return{x:this.x,w:this.fixed.w,t:this.fixed.t,b:this.fixed.b}},n.prototype.addExtra=function(e){this.fixed.w=Math.max(this.fixed.w,e.dx+e.w),void 0===this.fixed.t?this.fixed.t=e.top:this.fixed.t=Math.max(this.fixed.t,e.top),void 0===this.fixed.b?this.fixed.b=e.bottom:this.fixed.b=Math.min(this.fixed.b,e.bottom),e.dx<this.extraw&&(this.extraw=e.dx),this.extra[this.extra.length]=e,this._addChild(e)},n.prototype.addHead=function(e){e.dx<this.extraw&&(this.extraw=e.dx),this.heads[this.heads.length]=e,this.addRight(e)},n.prototype.addRight=function(e){this.fixed.w=Math.max(this.fixed.w,e.dx+e.w),void 0!==e.top&&(void 0===this.fixed.t?this.fixed.t=e.top:this.fixed.t=Math.max(this.fixed.t,e.top)),void 0!==e.bottom&&(void 0===this.fixed.b?this.fixed.b=e.bottom:this.fixed.b=Math.min(this.fixed.b,e.bottom)),e.dx+e.w>this.w&&(this.w=e.dx+e.w),this.right[this.right.length]=e,this._addChild(e)},n.prototype.addFixed=function(e){this._addChild(e)},n.prototype.addFixedX=function(e){this._addChild(e)},n.prototype.addCentered=function(e){var t=e.w/2;-t<this.extraw&&(this.extraw=-t),this.extra[this.extra.length]=e,e.dx+t>this.w&&(this.w=e.dx+t),this.right[this.right.length]=e,this._addChild(e)},n.prototype.setLimit=function(e,t){t[e]&&(this.specialY[e]?this.specialY[e]=Math.max(this.specialY[e],t[e]):this.specialY[e]=t[e])},n.prototype._addChild=function(e){var t=!0;"clef"==this.abcelem.el_type&&"barNumber"==e.type&&(t=!1),e.parent=this,this.children[this.children.length]=e,t&&this.pushTop(e.top),this.pushBottom(e.bottom),this.setLimit("tempoHeightAbove",e),this.setLimit("partHeightAbove",e),this.setLimit("volumeHeightAbove",e),this.setLimit("dynamicHeightAbove",e),this.setLimit("endingHeightAbove",e),this.setLimit("chordHeightAbove",e),this.setLimit("lyricHeightAbove",e),this.setLimit("lyricHeightBelow",e),this.setLimit("chordHeightBelow",e),this.setLimit("volumeHeightBelow",e),this.setLimit("dynamicHeightBelow",e)},n.prototype.pushTop=function(e){void 0!==e&&(void 0===this.top?this.top=e:this.top=Math.max(e,this.top))},n.prototype.pushBottom=function(e){void 0!==e&&(void 0===this.bottom?this.bottom=e:this.bottom=Math.min(e,this.bottom))},n.prototype.setX=function(e){this.x=e;for(var t=0;t<this.children.length;t++)this.children[t].setX(e)},n.prototype.center=function(e,t){var n=(t.x-e.x)/2+e.x;this.x=n-this.w/2;for(var r=0;r<this.children.length;r++)this.children[r].setX(this.x)},n.prototype.setHint=function(){this.hint=!0},n.prototype.highlight=function(t,n){e.bind(this)(t,n)},n.prototype.unhighlight=function(e,n){t.bind(this)(e,n)},Wd=n}function wv(){if(Kd)return $d;Kd=1;var e=function(e,t,n,r,i){switch(i=i||{},this.x=0,this.c=e,this.dx=t,this.w=n,this.pitch=r,this.scalex=i.scalex||1,this.scaley=i.scaley||1,this.type=i.type||"symbol",this.pitch2=i.pitch2,this.linewidth=i.linewidth,this.klass=i.klass,this.anchor=i.anchor?i.anchor:"middle",this.top=r,void 0!==this.pitch2&&this.pitch2>this.top&&(this.top=this.pitch2),this.bottom=r,void 0!==this.pitch2&&this.pitch2<this.bottom&&(this.bottom=this.pitch2),i.thickness&&(this.top+=i.thickness/2,this.bottom-=i.thickness/2),i.stemHeight&&(i.stemHeight>0?this.top+=i.stemHeight:this.bottom+=i.stemHeight),i.dim&&(this.dim=i.dim),i.position&&(this.position=i.position),this.height=i.height?i.height:4,i.top&&(this.top=i.top),i.bottom&&(this.bottom=i.bottom),i.name?this.name=i.name:this.c?this.name=this.c:this.name=this.type,i.realWidth?this.realWidth=i.realWidth:this.realWidth=this.w,this.centerVertically=!1,this.type){case"debug":this.chordHeightAbove=this.height;break;case"lyric":i.position&&"below"===i.position?this.lyricHeightBelow=this.height:this.lyricHeightAbove=this.height;break;case"chord":i.position&&"below"===i.position?this.chordHeightBelow=this.height:this.chordHeightAbove=this.height;break;case"text":void 0===this.pitch?i.position&&"below"===i.position?this.chordHeightBelow=this.height:this.chordHeightAbove=this.height:this.centerVertically=!0;break;case"part":this.partHeightAbove=this.height}};return e.prototype.getChordDim=function(){if("debug"===this.type)return null;if(!this.chordHeightAbove&&!this.chordHeightBelow)return null;var e="chord"===this.type?this.realWidth/2:0,t=this.x-e-0;return{left:t,right:t+this.realWidth+0}},e.prototype.invertLane=function(e){void 0===this.lane&&(this.lane=0),this.lane=e-this.lane-1},e.prototype.putChordInLane=function(e){this.lane=e,this.chordHeightAbove?this.chordHeightAbove=1.25*this.height*this.lane:this.chordHeightBelow=1.25*this.height*this.lane},e.prototype.getLane=function(){return void 0===this.lane?0:this.lane},e.prototype.setX=function(e){this.x=e+this.dx},$d=e}function xv(){if(tf)return ef;tf=1;var e={__:-2,_:-1,"_/":-.5,"=":0,"":0,"^/":.5,"^":1,"^^":2},t=["C","-","D","-","E","F","-","G","-","A","-","B","c","-","d","-","e","f","-","g","-","a","-","b"];return ef={noteToMidi:function(n){var r=n.match(/([_^\/]*)([ABCDEFGabcdefg])(,*)('*)/);if(r&&5===r.length){var i=e[r[1]];return 48+t.indexOf(r[2])+i+12*(r[4].length-r[3].length)}return 0},midiToNote:function(e){e=parseInt(e,10);var n=Math.floor(e/12),r=e%12,i=t[r];if("-"===i&&(i="^"+t[r-1]),n>4)for(i=i.toLowerCase(),n-=5;n>0;)i+="'",n--;else for(;n<4;)i+=",",n++;return i}}}function kv(){if(rf)return nf;rf=1;var{noteToMidi:e,midiToNote:t}=xv();function n(n,r){var i=e(n);r&&(i+=r);var a,s=t(i),o=!1,c=!1,l=null,u=null,h=!1,d=0;n.startsWith("_")?(o=!0,d=-1,"/"==n[1]?(o=!1,u="v",d=0):"_"==n[1]&&(h=!0,d-=1)):n.startsWith("^")?(c=!0,d=1,"/"==n[1]?(c=!1,u="^",d=0):"^"==n[1]&&(h=!0,d+=1)):n.startsWith("=")&&(l=!0,d=0),((a=o||c||null!=u)||l)&&(s=null!=u||h?n.slice(2):n.slice(1));var f=(s.match(/,/g)||[]).length,p=(s.match(/'/g)||[]).length;this.pitch=i,this.pitchAltered=0,this.name=s,this.acc=d,this.isSharp=c,this.isKeySharp=!1,this.isDouble=h,this.isAltered=a,this.isFlat=o,this.isKeyFlat=!1,this.natural=l,this.quarter=u,this.isLower=this.name==this.name.toLowerCase(),this.name=this.name[0].toUpperCase(),this.hasComma=f,this.isQuoted=p}return n.prototype.sameNoteAs=function(e){return e.pitch===this.pitch},n.prototype.isLowerThan=function(e){return e.pitch>this.pitch},n.prototype.checkKeyAccidentals=function(e,t){if(!this.isAltered&&!this.natural)if(t[this.name.toUpperCase()])switch(t[this.name.toUpperCase()]){case"__":return this.acc=-2,void(this.pitchAltered=-2);case"_":return this.acc=-1,void(this.pitchAltered=-1);case"=":return this.acc=0,void(this.pitchAltered=0);case"^":return this.acc=1,void(this.pitchAltered=1);case"^^":return this.acc=2,void(this.pitchAltered=2)}else if(e)for(var n=this.name,r=0;r<e.length;r++){var i=e[r];n==i.note.toUpperCase()&&("flat"==i.acc&&(this.acc=-1,this.isKeyFlat=!0,this.pitchAltered=-1),"sharp"==i.acc&&(this.acc=1,this.isKeySharp=!0,this.pitchAltered=1))}},n.prototype.getAccidentalEquiv=function(){var e,t,r=((t=new n((e=this).name)).pitch=e.pitch,t.hasComma=e.hasComma,t.isLower=e.isLower,t.isQuoted=e.isQuoted,t.isSharp=e.isSharp,t.isKeySharp=e.isKeySharp,t.isFlat=e.isFlat,t.isKeyFlat=e.isKeyFlat,t);return r.isSharp||r.isKeySharp?((r=r.nextNote()).isFlat=!0,r.isSharp=!1,r.isKeySharp=!1):(r.isFlat||r.isKeyFlat)&&((r=r.prevNote()).isSharp=!0,r.isFlat=!1,r.isKeyFlat=!1),r},n.prototype.nextNote=function(){return new n(t(this.pitch+1+this.pitchAltered))},n.prototype.prevNote=function(){return new n(t(this.pitch-1+this.pitchAltered))},n.prototype.emitNoAccidentals=function(){var e=this.name;this.isLower&&(e=e.toLowerCase());for(var t=0;t<this.isQuoted;t++)e+="'";for(var n=0;n<this.hasComma;n++)e+=",";return e},n.prototype.emit=function(){var e=this.name;(this.isSharp||this.isKeySharp)&&(e="^"+e,this.isDouble&&(e="^"+e)),(this.isFlat||this.isKeyFlat)&&(e="_"+e,this.isDouble&&(e="_"+e)),this.quarter&&(e="^"==this.quarter?"^/"+e:"_/"+e),this.natural&&(e="="+e);for(var t=1;t<=this.hasComma;t++)e+=",";if(this.isLower){e=e.toLowerCase();for(var n=1;n<=this.isQuoted;n++)e+="'"}return e},nf=n}function Sv(){if(cf)return of;cf=1;const{noteToMidi:e}=xv();var t=kv(),n=function(){if(sf)return af;sf=1;var e=kv(),t=["A","B","C","D","E","F","G"];return af=function(n,r){var i=new e(n),a=new e(r);if(a.isLowerThan(i)){var s=i.emit();return{error:"Invalid string Instrument tuning : "+a.emit()+" string lower than "+s+" string"}}var o=[],c=t.indexOf(i.name),l=t.indexOf(a.name);if(-1==c||-1==l)return o;for(var u=!1;!u;)o.push(i.emit()),(i=i.nextNote()).sameNoteAs(a)&&(u=!0);return o}}();function r(e,t,n,r,i){var a=e.strings;t.checkKeyAccidentals(e.accidentals,e.measureAccidentals),r&&(a=r);var s=t.emitNoAccidentals(),o=a[n].indexOf(s),c=t.acc;if(-1!=o){if(r&&(o+=i),(t.isFlat||-1==t.acc)&&0==o){var l=t.getAccidentalEquiv();o=a[++n].indexOf(l.emit()),c=0}return{num:o+c,str:n,note:t}}return null}function i(e,t){var n;(t.isAltered||t.natural)&&(t.isFlat?n=t.isDouble?"__":"_":t.isSharp?n=t.isDouble?"^^":"^":t.natural&&(n="="),e.measureAccidentals[t.name.toUpperCase()]=n);for(var r=e.stringPitches.length-1;r>=0;r--)if(t.pitch+t.pitchAltered>=e.stringPitches[r]){var i=t.pitch+t.pitchAltered-e.stringPitches[r];return"^"===t.quarter?i-=.5:"v"===t.quarter&&(i+=.5),{num:Math.round(i),str:e.stringPitches.length-1-r,note:t}}return{num:"?",str:e.stringPitches.length-1,note:t}}function a(e,t){var n={num:"?",str:0,note:t};e.push(n),e.error=t.emit()+": unexpected note for instrument"}function s(r){var i=r.tuning,a=r.capo,s=r.params.highestNote;this.linePitch=r.linePitch,this.highestNote="a'",s&&(this.highestNote=s),this.measureAccidentals={},this.capo=0,a&&(this.capo=parseInt(a,10)),this.transpose=r.transpose?r.transpose:0,this.tuning=i,this.stringPitches=[];for(var o=0;o<this.tuning.length;o++){var c=e(this.tuning[o])+this.capo;this.stringPitches.push(c)}if(this.capo>0&&(this.capoTuning=function(e){var n=null,r=e.tuning;if(e.capo>0){n=[];for(var i=0;i<r.length;i++){for(var a=new t(r[i]),s=0;s<e.capo;s++)a=a.nextNote();n[i]=a.emit()}}return n}(this)),this.strings=function(e){var t=[],r=e.tuning;e.capo>0&&(r=e.capoTuning);for(var i=r.length-1,a=0;a<r.length;a++){var s=e.highestNote;a!=r.length-1&&(s=r[a+1]);var o=n(r[a],s);if(o.error)return o;t[i--]=o}return t}(this),this.strings.error)return r.setError(this.strings.error),void(r.inError=!0);this.secondPos=function(e){var t=[];t[0]=[];for(var n=e.strings,r=1;r<n.length;r++)t[r]=n[r-1];return t}(this)}return s.prototype.stringToPitch=function(e){return 5.3+(this.strings.length-1-e)*this.linePitch},s.prototype.notesToNumber=function(e,n){var s,o,c=null,l=null;if(e&&(l=[],e.length>1?(l=function(e,n){for(var a=[],s=0;s<n.length;s++)if(!n[s].endTie){var o=new t(n[s].name,e.clefTranspose);o.checkKeyAccidentals(e.accidentals,e.measureAccidentals);var c=i(e,o);a.push(c)}return function(e,t){for(var n=0;n<t.length-1;n++){var i=t[n],a=t[n+1];if(i.str==a.str){if(i.str==e.strings.length-1)return i.num="?",void(a.num="?");a.num<i.num?(a.str++,a=r(e,a.note,a.str,e.secondPos,e.strings[a.str].length)):(i.str++,i=r(e,i.note,i.str,e.secondPos,e.strings[i.str].length)),t[n]=i,t[n+1]=a}}}(e,a),a}(this,e)).error&&(c=l.error):e[0].endTie||((s=new t(e[0].name,this.clefTranspose)).checkKeyAccidentals(this.accidentals,this.measureAccidentals),(o=i(this,s))?l.push(o):(a(l,s),c=l.error))),c)return l;var u=null;if(n){u=[];for(var h=0;h<n.length;h++)(s=new t(n[h].name,this.clefTranspose)).checkKeyAccidentals(this.accidentals,this.measureAccidentals),(o=i(this,s))?u.push(o):(a(u,s),c=l.error)}return{notes:l,graces:u,error:c}},s.prototype.toString=function(){for(var e=[],t=0;t<this.tuning.length;t++){var n=this.tuning[t].replaceAll(",","").replaceAll("'","").toUpperCase();"_"===n[0]?n=n[1]+"b ":"^"===n[0]&&(n=n[1]+"# "),e.push(n)}return e.join("")},s.prototype.tabInfos=function(e){var t=e.params.label;if(t){var n="";return-1!=t.indexOf("%T")&&(n=this.toString(),e.capo>0&&(n+=" capo:"+e.capo),t=t.replace("%T",n)),t}return""},s.prototype.suppress=function(e){return!!e.params.suppress},of=s}function Cv(){if(uf)return lf;uf=1;var e=function(){if(Rd)return Bd;function e(e,t){this.numLines=e,this.lineSpace=t,this.verticalSize=this.numLines*this.lineSpace,this.bar={pitch:3,pitch2:t*e,height:5}}return Rd=1,e.prototype.bypass=function(e){var t=e.staffGroup.voices;return!!(t.length>0&&t[0].isPercussion)},e.prototype.setRelative=function(e,t,n){switch(e.type){case"bar":t.pitch=this.bar.pitch,t.pitch2=this.bar.pitch2,t.height=this.height;break;case"symbol":var r=this.bar.pitch2/2;if("dots.dot"==e.name)return n?(t.pitch=r,!1):(t.pitch=r+this.lineSpace,!0)}return n},Bd=e}(),t=function(){if(Jd)return Zd;Jd=1;var e=gv(),t=function(){if(Xd)return Qd;Xd=1;var e=_v(),t=wv();function n(e,t){for(var n in t)t.hasOwnProperty(n)&&(Array.isArray(t[n])||null!=(r=t[n])&&r.constructor===Object||(e[n]=t[n]));var r}function r(t){var r=new e("",0,0,"",0);return n(r,t),r.top=0,r.bottom=-1,t.abcelem&&(r.abcelem={},n(r.abcelem,t.abcelem),"note"===r.abcelem.el_type&&(r.abcelem.el_type="tabNumber")),t.cloned=r,r}function i(e,i){var a=r(e);if(i)for(var s=e.children,o=!0,c=0;c<s.length;c++){var l=s[c],u=new t("",0,0,0,"");n(u,l),o=i.tablature.setRelative(l,u,o),a.children.push(u)}return a}function a(n,r,i){var a="tab.tiny",s=7.5;n.isTabBig&&(a="tab.big",s=10);var o={el_type:"tab",icon:a,Ypos:s};if(s+=n.tabSymbolOffset,!n.hideTabSymbol){var c=new e(o,0,0,"symbol",0);c.x=r;var l=new t(a,0,0,7.5,"tab");l.x=i,c.children.push(l),"tab"==c.abcelem.el_type&&(l.pitch=s)}return c}function s(e){if(e.extra)for(var t=0;t<e.extra.length;t++){var n=e.extra[t];if("lyric"==n.type)return{bottom:n.bottom,height:n.height}}return null}function o(){this.accidentals=null}function c(e,n,r,i,a){var s=i.num;null!=i.note.quarter&&(s=s.toString(),s+=i.note.quarter);var o=e.semantics.stringToPitch(i.str);r.notes.push({num:s,str:i.str,pitch:i.note.emit()});var c=new t(s,0,0,o+.3,{type:"tabNumber"});return c.x=n,c.isGrace=a,c.isAltered=i.note.isAltered,c}function l(e,t){var n=0;if(e.extra)for(var r=0;r<e.extra.length;r++)if(e.extra[r].c.indexOf("noteheads")>=0){if(n===t)return e.extra[r].x+e.extra[r].w/2;n++}return-1}function u(e){if(e.abcelem){var t=e.abcelem;if(t.rest)return t.gracenotes}return null}function h(e,t,n){var r=e.semantics.notesToNumber(t,n);if(r.error)return e.setError(r.error),r;if(r.graces&&r.notes){var i=r.notes.length-1;r.notes[i].graces=r.graces}return r}function d(e,t,n,r,i){for(var a=0;a<r.length;a++){var s={el_type:"note",startChar:n.abcelem.startChar,endChar:n.abcelem.endChar,notes:[],grace:!0},o=c(e,l(n,a),s,r[a],!0);t.children.push(o),i.push(s)}}return o.prototype.build=function(e,t,n,o,f,p,m){!function(e){for(var t=0;t<e.length;t++)e[t].tabNameInfos}(t);var g=t[f+o],v=t[m],y=null,b=null;"clef"!=g.children[0].abcelem.el_type&&"none"!=p&&g.children.splice(0,0,p);for(var _=0;_<g.children.length;_++){var w=g.children[_],x=w.x,k=x;switch(w.isClef&&(v.children.push(a(e,x,k)),w.abcelem.type.indexOf("-8")>=0&&(e.semantics.clefTranspose=-12),w.abcelem.type.indexOf("+8")>=0&&(e.semantics.clefTranspose=12)),w.type){case"staff-extra key-signature":this.accidentals=w.abcelem.accidentals,e.semantics.accidentals=this.accidentals;break;case"bar":e.semantics.measureAccidentals={};var S=!1;_===g.children.length-1&&(S=!0);var C=i(w,e);if(C.abcelem.barNumber){delete C.abcelem.barNumber;for(var M=0;M<C.children.length;M++)if("barNumber"===C.children[M].type){C.children.splice(M,1);break}}C.abcelem.lastBar=S,v.children.push(C),n.push({el_type:w.abcelem.el_type,type:w.abcelem.type,endChar:w.abcelem.endChar,startChar:w.abcelem.startChar,abselem:C});break;case"rest":var E=u(w);if(E){if((y=h(e,null,E)).error)return;L={el_type:"note",startChar:w.abcelem.startChar,endChar:w.abcelem.endChar,notes:[],grace:!0},d(e,T,w,y.graces,n)}break;case"note":var T=r(w);T.x=w.heads[0].x+w.heads[0].w/2,T.lyricDim=s(w);var A=w.abcelem.pitches,P=w.abcelem.gracenotes;if(T.type="tabNumber",(y=h(e,A,P)).error)return;if(y.graces){var I=y.notes.length-1;y.notes[I].graces=y.graces}b={el_type:"note",startChar:w.abcelem.startChar,endChar:w.abcelem.endChar,notes:[]};for(var N=0;N<y.notes.length;N++){var D=y.notes[N];if(D.graces)for(var O=0;O<D.graces.length;O++){var L={el_type:"note",startChar:w.abcelem.startChar,endChar:w.abcelem.endChar,notes:[],grace:!0},B=c(e,l(w,O),L,D.graces[O],!0);T.children.push(B),n.push(L)}var R=c(e,T.x+w.heads[N].dx,b,D,!1);T.children.push(R)}b.notes.length>0&&(b.abselem=T,n.push(b),v.children.push(T))}}},Qd=o}(),n=hv();function r(e,t,n){var r=e.semantics,i=t.controller.getTextSize,a=r.tabInfos(e),s=!0;if(r.suppress(e)&&(s=!1),s){var o=i.calc(a,"tablabelfont","text instrumentname");return n.tabNameInfos={textSize:{height:o.height,width:o.width},name:a},o.height}return 0}function i(e,t){return!(!t[e].isTabStaff||e!==t.length-1&&t[e+1].isTabStaff)}function a(e,t){for(var n=t;n>=0;n--)if(!e[n].isTabStaff)return n;return-1}function s(e,t){return"clef"===e[t].children[0].abcelem.el_type?null:0==t?"none":e[t-1].children[0]}return Zd=function(o,c,l,u){var h=new t,d={clef:{type:"TAB"}},f=o.linePitch*o.nbLines,p=l.staff;if(p){var m=p[0];if(m&&m.clef&&0==m.clef.stafflines)return void o.setError("No tablatures when stafflines=0");p.splice(p.length,0,d)}var g=l.staffGroup,v=g.voices,y=function(e){for(var t=0,n=0;n<e.children.length;n++){var r=e.children[n];r.specialY&&r.specialY.lyricHeightBelow>t&&(t=r.specialY.lyricHeightBelow)}return t}(v[0]),b=u,_=g.staffs[b],w=f+3-_.bottom-y;_.isTabStaff&&(w=_.top);var x,k={bottom:-1,isTabStaff:!0,specialY:{tempoHeightAbove:0,partHeightAbove:0,volumeHeightAbove:0,dynamicHeightAbove:0,endingHeightAbove:0,chordHeightAbove:0,lyricHeightAbove:0,lyricHeightBelow:0,chordHeightBelow:0,volumeHeightBelow:0,dynamicHeightBelow:0},lines:o.nbLines,linePitch:o.linePitch,dy:.15,top:w},S=function(e,t){for(var n=0,r=0,a=0;;){if(!t[n])return-1;if(t[n].isTabStaff||(a=t[n].voices.length),t[n].isTabStaff){if(r++,i(n,t)&&r<a)return n+1}else if(r=0,n>=e){if(n+1==t.length)return n+1;if(!t[n+1].isTabStaff)return n+1}if(++n>t.length)return-1}}(u,g.staffs);if(-1!==S){k.parentIndex=S-1,g.staffs.splice(S,0,k),g.height+=f+3;var C=function(e,t){for(var n=t;n>=0;n--)if(!e[n].isTabStaff)return e[n];return null}(g.staffs,S),M=1;x=C,1===function(e){for(var t=0,n=0;n<e.length;n++)e[n].isTabStaff||t++;return t}(g.staffs)&&x.voices.length>1&&(M=C.voices.length),d.voices=[];for(var E=0;E<M;E++){var T=new e(0,0);E>0&&(T.duplicate=!0);var A=r(o,c,T)/n.STEP;A=Math.max(A,1),g.staffs[u].top+=1,g.height+=A,T.staff=k;var P=v.length;v.splice(v.length,0,T);var I=s(v,E+u);d.voices[E]=[],h.build(o,v,d.voices[E],E,u,I,P)}!function(e){for(var t=0;t<e.length;t++)if(e[t].isTabStaff){var n=a(e,t);e[t].hasStaff=e[n],e[n].hasTab||(e[n].hasTab=[]),e[n].hasTab.push(e[t])}}(g.staffs)}}}(),n=Sv();function r(){}return r.prototype.init=function(t,r,i,a){this.tune=t,this.params=i,this.tuneNumber=r,this.inError=!1,this.abcTune=t,this.linePitch=3,this.nbLines=a.defaultTuning.length,this.isTabBig=a.isTabBig,this.tabSymbolOffset=a.tabSymbolOffset,this.capo=i.capo,this.transpose=i.visualTranspose,this.hideTabSymbol=i.hideTabSymbol,this.tablature=new e(this.nbLines,this.linePitch);var s=i.tuning;s||(s=a.defaultTuning),this.tuning=s,this.semantics=new n(this)},r.prototype.setError=function(e){e&&(this.error=e,this.inError=!0,this.tune.warnings?this.tune.warnings.push(e):this.tune.warnings=[e])},r.prototype.render=function(e,n,r){this.inError||this.tablature.bypass(n)||t(this,e,n,r)},lf=function(){return{name:"StringTab",tablature:r}}}function Mv(){if(df)return hf;df=1;var e=Cv(),t={violin:{name:"StringTab",defaultTuning:["G,","D","A","e"],isTabBig:!1,tabSymbolOffset:0},fiddle:{name:"StringTab",defaultTuning:["G,","D","A","e"],isTabBig:!1,tabSymbolOffset:0},mandolin:{name:"StringTab",defaultTuning:["G,","D","A","e"],isTabBig:!1,tabSymbolOffset:0},guitar:{name:"StringTab",defaultTuning:["E,","A,","D","G","B","e"],isTabBig:!0,tabSymbolOffset:0},fiveString:{name:"StringTab",defaultTuning:["C,","G,","D","A","e"],isTabBig:!1,tabSymbolOffset:-.95}};return hf={inited:!1,plugins:{},register:function(e){var t=e.name,n=e.tablature;this.plugins[t]=n},setError:function(e,t){e.warnings?e.warning.push(t):e.warnings=[t]},preparePlugins:function(n,r,i){this.inited||(this.register(new e),this.inited=!0);var a=null;if(i.tablature){var s=i.tablature;a=[];for(var o=0;o<s.length;o++){var c=s[o],l=c.instrument;if(null==l)return this.setError(n,"tablature 'instrument' is missing"),a;var u=t[l],h=null;if(u&&(h=this.plugins[u.name]),h){0!=i.visualTranspose&&(c.visualTranspose=i.visualTranspose),c.abcSrc=i.tablature.abcSrc;var d={classz:h,tuneNumber:r,params:c,instance:null,tabType:u};a.push(d)}else{if(""!==l)return this.setError(n,"Undefined tablature plugin: "+l),a;a.push(null)}}}return a},layoutTablatures:function(e,t){var n=t.tablatures,r=0;if(n&&n.length>0)for(var i=n.length,a=0;a<i;++a)n[a]&&n[a].params.firstStaffOnly&&(n[a].params.suppress=!1);for(var s=0;s<t.lines.length;s++){var o=t.lines[s];if(o.staff&&r++,r>1&&n&&n.length>0)for(i=n.length,a=0;a<i;++a)n[a].params.firstStaffOnly&&(n[a].params.suppress=!0);var c=o.staff;if(c)for(var l=c.length,u=0;u<c.length;u++)if(n[u]&&u<l){var h=n[u];null==h.instance&&(h.instance=new h.classz,h.instance.init(t,h.tuneNumber,h.params,h.tabType)),h.instance.render(e,o,u)}}}}}function Ev(){if(pf)return ff;pf=1;var e=mv(),t=function(){if(Ld)return Od;Ld=1;var e=nd();return Od=function(t){for(var n="",r=t.match(/(\s*)/),i=(t=e.strip(t)).split("\nX:"),a=1;a<i.length;a++)i[a]="X:"+i[a];var s=r?r[0].length:0,o=[];i.forEach((function(e){o.push({abc:e,startPos:s}),s+=e.length+1})),o.length>1&&!e.startsWith(o[0].abc,"X:")&&o.shift().abc.split("\n").forEach((function(t){e.startsWith(t,"%%")&&(n+=t+"\n")}));var c=n;return o.forEach((function(t){var r=t.abc.indexOf("\n\n");r>0&&(t.abc=t.abc.substring(0,r)),t.pure=t.abc,t.abc=n+t.abc,t.title="";var i=t.pure.split("T:");i.length>1&&(i=i[1].split("\n"),t.title=e.strip(i[0]));var a=t.pure.substring(2,t.pure.indexOf("\n"));t.id=e.strip(a)})),{header:c,tunes:o}}}(),n=Mv(),r={};return function(){r.numberOfTunes=function(e){var t=e.split("\nX:").length;return 0===t&&(t=1),t};var i=r.TuneBook=function(e){var n=t(e);this.header=n.header,this.tunes=n.tunes};i.prototype.getTuneById=function(e){for(var t=0;t<this.tunes.length;t++)if(this.tunes[t].id===""+e)return this.tunes[t];return null},i.prototype.getTuneByTitle=function(e){for(var t=0;t<this.tunes.length;t++)if(this.tunes[t].title===e)return this.tunes[t];return null},r.parseOnly=function(e,t){for(var n=r.numberOfTunes(e),i=[],a=0;a<n;a++)i.push(1);return r.renderEngine((function(){}),i,e,t)},r.renderEngine=function(t,r,a,s){var o=[];if(void 0!==r&&void 0!==a){var c;(!(c=r)||c.propertyIsEnumerable("length")||"object"!=typeof c||"number"!=typeof c.length)&&(r=[r]),void 0===s&&(s={});for(var l=s.startingTune?parseInt(s.startingTune,10):0,u=new i(a),h=new e,d=0;d<r.length;d++){var f=r[d];if("*"===f||"string"==typeof f&&(f=document.getElementById(f)),f)if(l>=0&&l<u.tunes.length){h.parse(u.tunes[l].abc,s,u.tunes[l].startPos-u.header.length);var p=h.getTune();s.tablature&&(p.tablatures=n.preparePlugins(p,l,s));var m=h.getWarnings();m&&(p.warnings=m);var g=t(f,p,d,u.tunes[l].abc);o.push(g||p)}else f.innerHTML&&(f.innerHTML="");l++}return o}},r.extractMeasures=function(e){for(var t=[],n=new i(e),a=0;a<n.tunes.length;a++){for(var s=n.tunes[a],o=s.abc.split("K:"),c=o[1].split("\n"),l=o[0]+"K:"+c[0]+"\n",u=null,h=null,d=null,f=[],p=!1,m=r.parseOnly(s.abc)[0],g=m.getPickupLength()>0,v=0;v<m.lines.length;v++){var y=m.lines[v];if(y.staff)for(var b=0;b<1;b++)for(var _=y.staff[b],w=0;w<1;w++)for(var x=_.voices[w],k=0;k<x.length;k++){var S=x[k];if(null===d&&S.startChar>=0&&(d=S.startChar,h=void 0===S.chord?u:null),S.chord&&(u=S),"bar"===S.el_type){if(p){var C={abc:s.abc.substring(d,S.endChar)};(u=h&&h.chord&&h.chord.length>0?h.chord[0].name:null)&&(C.lastChord=u),S.startEnding&&(C.startEnding=S.startEnding),S.endEnding&&(C.endEnding=S.endEnding),f.push(C),d=null,p=!1}}else"note"===S.el_type&&(p=!0)}}t.push({header:l,measures:f,hasPickup:g})}return t}}(),ff=r}function Tv(){if(xf)return wf;xf=1;var e=hv(),t={0:{d:[["M",4.83,-14.97],["c",.33,-.03,1.11,0,1.47,.06],["c",1.68,.36,2.97,1.59,3.78,3.6],["c",1.2,2.97,.81,6.96,-.9,9.27],["c",-.78,1.08,-1.71,1.71,-2.91,1.95],["c",-.45,.09,-1.32,.09,-1.77,0],["c",-.81,-.18,-1.47,-.51,-2.07,-1.02],["c",-2.34,-2.07,-3.15,-6.72,-1.74,-10.2],["c",.87,-2.16,2.28,-3.42,4.14,-3.66],["z"],["m",1.11,.87],["c",-.21,-.06,-.69,-.09,-.87,-.06],["c",-.54,.12,-.87,.42,-1.17,.99],["c",-.36,.66,-.51,1.56,-.6,3],["c",-.03,.75,-.03,4.59,0,5.31],["c",.09,1.5,.27,2.4,.6,3.06],["c",.24,.48,.57,.78,.96,.9],["c",.27,.09,.78,.09,1.05,0],["c",.39,-.12,.72,-.42,.96,-.9],["c",.33,-.66,.51,-1.56,.6,-3.06],["c",.03,-.72,.03,-4.56,0,-5.31],["c",-.09,-1.47,-.27,-2.37,-.6,-3.03],["c",-.24,-.48,-.54,-.78,-.93,-.9],["z"]],w:10.78,h:14.959},1:{d:[["M",3.3,-15.06],["c",.06,-.06,.21,-.03,.66,.15],["c",.81,.39,1.08,.39,1.83,.03],["c",.21,-.09,.39,-.15,.42,-.15],["c",.12,0,.21,.09,.27,.21],["c",.06,.12,.06,.33,.06,5.94],["c",0,3.93,0,5.85,.03,6.03],["c",.06,.36,.15,.69,.27,.96],["c",.36,.75,.93,1.17,1.68,1.26],["c",.3,.03,.39,.09,.39,.3],["c",0,.15,-.03,.18,-.09,.24],["c",-.06,.06,-.09,.06,-.48,.06],["c",-.42,0,-.69,-.03,-2.1,-.24],["c",-.9,-.15,-1.77,-.15,-2.67,0],["c",-1.41,.21,-1.68,.24,-2.1,.24],["c",-.39,0,-.42,0,-.48,-.06],["c",-.06,-.06,-.06,-.09,-.06,-.24],["c",0,-.21,.06,-.27,.36,-.3],["c",.75,-.09,1.32,-.51,1.68,-1.26],["c",.12,-.27,.21,-.6,.27,-.96],["c",.03,-.18,.03,-1.59,.03,-4.29],["c",0,-3.87,0,-4.05,-.06,-4.14],["c",-.09,-.15,-.18,-.24,-.39,-.24],["c",-.12,0,-.15,.03,-.21,.06],["c",-.03,.06,-.45,.99,-.96,2.13],["c",-.48,1.14,-.9,2.1,-.93,2.16],["c",-.06,.15,-.21,.24,-.33,.24],["c",-.24,0,-.42,-.18,-.42,-.39],["c",0,-.06,3.27,-7.62,3.33,-7.74],["z"]],w:8.94,h:15.058},2:{d:[["M",4.23,-14.97],["c",.57,-.06,1.68,0,2.34,.18],["c",.69,.18,1.5,.54,2.01,.9],["c",1.35,.96,1.95,2.25,1.77,3.81],["c",-.15,1.35,-.66,2.34,-1.68,3.15],["c",-.6,.48,-1.44,.93,-3.12,1.65],["c",-1.32,.57,-1.8,.81,-2.37,1.14],["c",-.57,.33,-.57,.33,-.24,.27],["c",.39,-.09,1.26,-.09,1.68,0],["c",.72,.15,1.41,.45,2.1,.9],["c",.99,.63,1.86,.87,2.55,.75],["c",.24,-.06,.42,-.15,.57,-.3],["c",.12,-.09,.3,-.42,.3,-.51],["c",0,-.09,.12,-.21,.24,-.24],["c",.18,-.03,.39,.12,.39,.3],["c",0,.12,-.15,.57,-.3,.87],["c",-.54,1.02,-1.56,1.74,-2.79,2.01],["c",-.42,.09,-1.23,.09,-1.62,.03],["c",-.81,-.18,-1.32,-.45,-2.01,-1.11],["c",-.45,-.45,-.63,-.57,-.96,-.69],["c",-.84,-.27,-1.89,.12,-2.25,.9],["c",-.12,.21,-.21,.54,-.21,.72],["c",0,.12,-.12,.21,-.27,.24],["c",-.15,0,-.27,-.03,-.33,-.15],["c",-.09,-.21,.09,-1.08,.33,-1.71],["c",.24,-.66,.66,-1.26,1.29,-1.89],["c",.45,-.45,.9,-.81,1.92,-1.56],["c",1.29,-.93,1.89,-1.44,2.34,-1.98],["c",.87,-1.05,1.26,-2.19,1.2,-3.63],["c",-.06,-1.29,-.39,-2.31,-.96,-2.91],["c",-.36,-.33,-.72,-.51,-1.17,-.54],["c",-.84,-.03,-1.53,.42,-1.59,1.05],["c",-.03,.33,.12,.6,.57,1.14],["c",.45,.54,.54,.87,.42,1.41],["c",-.15,.63,-.54,1.11,-1.08,1.38],["c",-.63,.33,-1.2,.33,-1.83,0],["c",-.24,-.12,-.33,-.18,-.54,-.39],["c",-.18,-.18,-.27,-.3,-.36,-.51],["c",-.24,-.45,-.27,-.84,-.21,-1.38],["c",.12,-.75,.45,-1.41,1.02,-1.98],["c",.72,-.72,1.74,-1.17,2.85,-1.32],["z"]],w:10.764,h:14.97},3:{d:[["M",3.78,-14.97],["c",.3,-.03,1.41,0,1.83,.06],["c",2.22,.3,3.51,1.32,3.72,2.91],["c",.03,.33,.03,1.26,-.03,1.65],["c",-.12,.84,-.48,1.47,-1.05,1.77],["c",-.27,.15,-.36,.24,-.45,.39],["c",-.09,.21,-.09,.36,0,.57],["c",.09,.15,.18,.24,.51,.39],["c",.75,.42,1.23,1.14,1.41,2.13],["c",.06,.42,.06,1.35,0,1.71],["c",-.18,.81,-.48,1.38,-1.02,1.95],["c",-.75,.72,-1.8,1.2,-3.18,1.38],["c",-.42,.06,-1.56,.06,-1.95,0],["c",-1.89,-.33,-3.18,-1.29,-3.51,-2.64],["c",-.03,-.12,-.03,-.33,-.03,-.6],["c",0,-.36,0,-.42,.06,-.63],["c",.12,-.3,.27,-.51,.51,-.75],["c",.24,-.24,.45,-.39,.75,-.51],["c",.21,-.06,.27,-.06,.6,-.06],["c",.33,0,.39,0,.6,.06],["c",.3,.12,.51,.27,.75,.51],["c",.36,.33,.57,.75,.6,1.2],["c",0,.21,0,.27,-.06,.42],["c",-.09,.18,-.12,.24,-.54,.54],["c",-.51,.36,-.63,.54,-.6,.87],["c",.06,.54,.54,.9,1.38,.99],["c",.36,.06,.72,.03,.96,-.06],["c",.81,-.27,1.29,-1.23,1.44,-2.79],["c",.03,-.45,.03,-1.95,-.03,-2.37],["c",-.09,-.75,-.33,-1.23,-.75,-1.44],["c",-.33,-.18,-.45,-.18,-1.98,-.18],["c",-1.35,0,-1.41,0,-1.5,-.06],["c",-.18,-.12,-.24,-.39,-.12,-.6],["c",.12,-.15,.15,-.15,1.68,-.15],["c",1.5,0,1.62,0,1.89,-.15],["c",.18,-.09,.42,-.36,.54,-.57],["c",.18,-.42,.27,-.9,.3,-1.95],["c",.03,-1.2,-.06,-1.8,-.36,-2.37],["c",-.24,-.48,-.63,-.81,-1.14,-.96],["c",-.3,-.06,-1.08,-.06,-1.38,.03],["c",-.6,.15,-.9,.42,-.96,.84],["c",-.03,.3,.06,.45,.63,.84],["c",.33,.24,.42,.39,.45,.63],["c",.03,.72,-.57,1.5,-1.32,1.65],["c",-1.05,.27,-2.1,-.57,-2.1,-1.65],["c",0,-.45,.15,-.96,.39,-1.38],["c",.12,-.21,.54,-.63,.81,-.81],["c",.57,-.42,1.38,-.69,2.25,-.81],["z"]],w:9.735,h:14.967},4:{d:[["M",8.64,-14.94],["c",.27,-.09,.42,-.12,.54,-.03],["c",.09,.06,.15,.21,.15,.3],["c",-.03,.06,-1.92,2.31,-4.23,5.04],["c",-2.31,2.73,-4.23,4.98,-4.26,5.01],["c",-.03,.06,.12,.06,2.55,.06],["l",2.61,0],["l",0,-2.37],["c",0,-2.19,.03,-2.37,.06,-2.46],["c",.03,-.06,.21,-.18,.57,-.42],["c",1.08,-.72,1.38,-1.08,1.86,-2.16],["c",.12,-.3,.24,-.54,.27,-.57],["c",.12,-.12,.39,-.06,.45,.12],["c",.06,.09,.06,.57,.06,3.96],["l",0,3.9],["l",1.08,0],["c",1.05,0,1.11,0,1.2,.06],["c",.24,.15,.24,.54,0,.69],["c",-.09,.06,-.15,.06,-1.2,.06],["l",-1.08,0],["l",0,.33],["c",0,.57,.09,1.11,.3,1.53],["c",.36,.75,.93,1.17,1.68,1.26],["c",.3,.03,.39,.09,.39,.3],["c",0,.15,-.03,.18,-.09,.24],["c",-.06,.06,-.09,.06,-.48,.06],["c",-.42,0,-.69,-.03,-2.1,-.24],["c",-.9,-.15,-1.77,-.15,-2.67,0],["c",-1.41,.21,-1.68,.24,-2.1,.24],["c",-.39,0,-.42,0,-.48,-.06],["c",-.06,-.06,-.06,-.09,-.06,-.24],["c",0,-.21,.06,-.27,.36,-.3],["c",.75,-.09,1.32,-.51,1.68,-1.26],["c",.21,-.42,.3,-.96,.3,-1.53],["l",0,-.33],["l",-2.7,0],["c",-2.91,0,-2.85,0,-3.09,-.15],["c",-.18,-.12,-.3,-.39,-.27,-.54],["c",.03,-.06,.18,-.24,.33,-.45],["c",.75,-.9,1.59,-2.07,2.13,-3.03],["c",.33,-.54,.84,-1.62,1.05,-2.16],["c",.57,-1.41,.84,-2.64,.9,-4.05],["c",.03,-.63,.06,-.72,.24,-.81],["l",.12,-.06],["l",.45,.12],["c",.66,.18,1.02,.24,1.47,.27],["c",.6,.03,1.23,-.09,2.01,-.33],["z"]],w:11.795,h:14.994},5:{d:[["M",1.02,-14.94],["c",.12,-.09,.03,-.09,1.08,.06],["c",2.49,.36,4.35,.36,6.96,-.06],["c",.57,-.09,.66,-.06,.81,.06],["c",.15,.18,.12,.24,-.15,.51],["c",-1.29,1.26,-3.24,2.04,-5.58,2.31],["c",-.6,.09,-1.2,.12,-1.71,.12],["c",-.39,0,-.45,0,-.57,.06],["c",-.09,.06,-.15,.12,-.21,.21],["l",-.06,.12],["l",0,1.65],["l",0,1.65],["l",.21,-.21],["c",.66,-.57,1.41,-.96,2.19,-1.14],["c",.33,-.06,1.41,-.06,1.95,0],["c",2.61,.36,4.02,1.74,4.26,4.14],["c",.03,.45,.03,1.08,-.03,1.44],["c",-.18,1.02,-.78,2.01,-1.59,2.7],["c",-.72,.57,-1.62,1.02,-2.49,1.2],["c",-1.38,.27,-3.03,.06,-4.2,-.54],["c",-1.08,-.54,-1.71,-1.32,-1.86,-2.28],["c",-.09,-.69,.09,-1.29,.57,-1.74],["c",.24,-.24,.45,-.39,.75,-.51],["c",.21,-.06,.27,-.06,.6,-.06],["c",.33,0,.39,0,.6,.06],["c",.3,.12,.51,.27,.75,.51],["c",.36,.33,.57,.75,.6,1.2],["c",0,.21,0,.27,-.06,.42],["c",-.09,.18,-.12,.24,-.54,.54],["c",-.18,.12,-.36,.3,-.42,.33],["c",-.36,.42,-.18,.99,.36,1.26],["c",.51,.27,1.47,.36,2.01,.27],["c",.93,-.21,1.47,-1.17,1.65,-2.91],["c",.06,-.45,.06,-1.89,0,-2.31],["c",-.15,-1.2,-.51,-2.1,-1.05,-2.55],["c",-.21,-.18,-.54,-.36,-.81,-.39],["c",-.3,-.06,-.84,-.03,-1.26,.06],["c",-.93,.18,-1.65,.6,-2.16,1.2],["c",-.15,.21,-.27,.3,-.39,.3],["c",-.15,0,-.3,-.09,-.36,-.18],["c",-.06,-.09,-.06,-.15,-.06,-3.66],["c",0,-3.39,0,-3.57,.06,-3.66],["c",.03,-.06,.09,-.15,.15,-.18],["z"]],w:10.212,h:14.997},6:{d:[["M",4.98,-14.97],["c",.36,-.03,1.2,0,1.59,.06],["c",.9,.15,1.68,.51,2.25,1.05],["c",.57,.51,.87,1.23,.84,1.98],["c",-.03,.51,-.21,.9,-.6,1.26],["c",-.24,.24,-.45,.39,-.75,.51],["c",-.21,.06,-.27,.06,-.6,.06],["c",-.33,0,-.39,0,-.6,-.06],["c",-.3,-.12,-.51,-.27,-.75,-.51],["c",-.39,-.36,-.57,-.78,-.57,-1.26],["c",0,-.27,0,-.3,.09,-.42],["c",.03,-.09,.18,-.21,.3,-.3],["c",.12,-.09,.3,-.21,.39,-.27],["c",.09,-.06,.21,-.18,.27,-.24],["c",.06,-.12,.09,-.15,.09,-.33],["c",0,-.18,-.03,-.24,-.09,-.36],["c",-.24,-.39,-.75,-.6,-1.38,-.57],["c",-.54,.03,-.9,.18,-1.23,.48],["c",-.81,.72,-1.08,2.16,-.96,5.37],["l",0,.63],["l",.3,-.12],["c",.78,-.27,1.29,-.33,2.1,-.27],["c",1.47,.12,2.49,.54,3.27,1.29],["c",.48,.51,.81,1.11,.96,1.89],["c",.06,.27,.06,.42,.06,.93],["c",0,.54,0,.69,-.06,.96],["c",-.15,.78,-.48,1.38,-.96,1.89],["c",-.54,.51,-1.17,.87,-1.98,1.08],["c",-1.14,.3,-2.4,.33,-3.24,.03],["c",-1.5,-.48,-2.64,-1.89,-3.27,-4.02],["c",-.36,-1.23,-.51,-2.82,-.42,-4.08],["c",.3,-3.66,2.28,-6.3,4.95,-6.66],["z"],["m",.66,7.41],["c",-.27,-.09,-.81,-.12,-1.08,-.06],["c",-.72,.18,-1.08,.69,-1.23,1.71],["c",-.06,.54,-.06,3,0,3.54],["c",.18,1.26,.72,1.77,1.8,1.74],["c",.39,-.03,.63,-.09,.9,-.27],["c",.66,-.42,.9,-1.32,.9,-3.24],["c",0,-2.22,-.36,-3.12,-1.29,-3.42],["z"]],w:9.956,h:14.982},7:{d:[["M",.21,-14.97],["c",.21,-.06,.45,0,.54,.15],["c",.06,.09,.06,.15,.06,.39],["c",0,.24,0,.33,.06,.42],["c",.06,.12,.21,.24,.27,.24],["c",.03,0,.12,-.12,.24,-.21],["c",.96,-1.2,2.58,-1.35,3.99,-.42],["c",.15,.12,.42,.3,.54,.45],["c",.48,.39,.81,.57,1.29,.6],["c",.69,.03,1.5,-.3,2.13,-.87],["c",.09,-.09,.27,-.3,.39,-.45],["c",.12,-.15,.24,-.27,.3,-.3],["c",.18,-.06,.39,.03,.51,.21],["c",.06,.18,.06,.24,-.27,.72],["c",-.18,.24,-.54,.78,-.78,1.17],["c",-2.37,3.54,-3.54,6.27,-3.87,9],["c",-.03,.33,-.03,.66,-.03,1.26],["c",0,.9,0,1.08,.15,1.89],["c",.06,.45,.06,.48,.03,.6],["c",-.06,.09,-.21,.21,-.3,.21],["c",-.03,0,-.27,-.06,-.54,-.15],["c",-.84,-.27,-1.11,-.3,-1.65,-.3],["c",-.57,0,-.84,.03,-1.56,.27],["c",-.6,.18,-.69,.21,-.81,.15],["c",-.12,-.06,-.21,-.18,-.21,-.3],["c",0,-.15,.6,-1.44,1.2,-2.61],["c",1.14,-2.22,2.73,-4.68,5.1,-8.01],["c",.21,-.27,.36,-.48,.33,-.48],["c",0,0,-.12,.06,-.27,.12],["c",-.54,.3,-.99,.39,-1.56,.39],["c",-.75,.03,-1.2,-.18,-1.83,-.75],["c",-.99,-.9,-1.83,-1.17,-2.31,-.72],["c",-.18,.15,-.36,.51,-.45,.84],["c",-.06,.24,-.06,.33,-.09,1.98],["c",0,1.62,-.03,1.74,-.06,1.8],["c",-.15,.24,-.54,.24,-.69,0],["c",-.06,-.09,-.06,-.15,-.06,-3.57],["c",0,-3.42,0,-3.48,.06,-3.57],["c",.03,-.06,.09,-.12,.15,-.15],["z"]],w:10.561,h:15.093},8:{d:[["M",4.98,-14.97],["c",.33,-.03,1.02,-.03,1.32,0],["c",1.32,.12,2.49,.6,3.21,1.32],["c",.39,.39,.66,.81,.78,1.29],["c",.09,.36,.09,1.08,0,1.44],["c",-.21,.84,-.66,1.59,-1.59,2.55],["l",-.3,.3],["l",.27,.18],["c",1.47,.93,2.31,2.31,2.25,3.75],["c",-.03,.75,-.24,1.35,-.63,1.95],["c",-.45,.66,-1.02,1.14,-1.83,1.53],["c",-1.8,.87,-4.2,.87,-6,.03],["c",-1.62,-.78,-2.52,-2.16,-2.46,-3.66],["c",.06,-.99,.54,-1.77,1.8,-2.97],["c",.54,-.51,.54,-.54,.48,-.57],["c",-.39,-.27,-.96,-.78,-1.2,-1.14],["c",-.75,-1.11,-.87,-2.4,-.3,-3.6],["c",.69,-1.35,2.25,-2.25,4.2,-2.4],["z"],["m",1.53,.69],["c",-.42,-.09,-1.11,-.12,-1.38,-.06],["c",-.3,.06,-.6,.18,-.81,.3],["c",-.21,.12,-.6,.51,-.72,.72],["c",-.51,.87,-.42,1.89,.21,2.52],["c",.21,.21,.36,.3,1.95,1.23],["c",.96,.54,1.74,.99,1.77,1.02],["c",.09,0,.63,-.6,.99,-1.11],["c",.21,-.36,.48,-.87,.57,-1.23],["c",.06,-.24,.06,-.36,.06,-.72],["c",0,-.45,-.03,-.66,-.15,-.99],["c",-.39,-.81,-1.29,-1.44,-2.49,-1.68],["z"],["m",-1.44,8.07],["l",-1.89,-1.08],["c",-.03,0,-.18,.15,-.39,.33],["c",-1.2,1.08,-1.65,1.95,-1.59,3],["c",.09,1.59,1.35,2.85,3.21,3.24],["c",.33,.06,.45,.06,.93,.06],["c",.63,0,.81,-.03,1.29,-.27],["c",.9,-.42,1.47,-1.41,1.41,-2.4],["c",-.06,-.66,-.39,-1.29,-.9,-1.65],["c",-.12,-.09,-1.05,-.63,-2.07,-1.23],["z"]],w:10.926,h:14.989},9:{d:[["M",4.23,-14.97],["c",.42,-.03,1.29,0,1.62,.06],["c",.51,.12,.93,.3,1.38,.57],["c",1.53,1.02,2.52,3.24,2.73,5.94],["c",.18,2.55,-.48,4.98,-1.83,6.57],["c",-1.05,1.26,-2.4,1.89,-3.93,1.83],["c",-1.23,-.06,-2.31,-.45,-3.03,-1.14],["c",-.57,-.51,-.87,-1.23,-.84,-1.98],["c",.03,-.51,.21,-.9,.6,-1.26],["c",.24,-.24,.45,-.39,.75,-.51],["c",.21,-.06,.27,-.06,.6,-.06],["c",.33,0,.39,0,.6,.06],["c",.3,.12,.51,.27,.75,.51],["c",.39,.36,.57,.78,.57,1.26],["c",0,.27,0,.3,-.09,.42],["c",-.03,.09,-.18,.21,-.3,.3],["c",-.12,.09,-.3,.21,-.39,.27],["c",-.09,.06,-.21,.18,-.27,.24],["c",-.06,.12,-.06,.15,-.06,.33],["c",0,.18,0,.24,.06,.36],["c",.24,.39,.75,.6,1.38,.57],["c",.54,-.03,.9,-.18,1.23,-.48],["c",.81,-.72,1.08,-2.16,.96,-5.37],["l",0,-.63],["l",-.3,.12],["c",-.78,.27,-1.29,.33,-2.1,.27],["c",-1.47,-.12,-2.49,-.54,-3.27,-1.29],["c",-.48,-.51,-.81,-1.11,-.96,-1.89],["c",-.06,-.27,-.06,-.42,-.06,-.96],["c",0,-.51,0,-.66,.06,-.93],["c",.15,-.78,.48,-1.38,.96,-1.89],["c",.15,-.12,.33,-.27,.42,-.36],["c",.69,-.51,1.62,-.81,2.76,-.93],["z"],["m",1.17,.66],["c",-.21,-.06,-.57,-.06,-.81,-.03],["c",-.78,.12,-1.26,.69,-1.41,1.74],["c",-.12,.63,-.15,1.95,-.09,2.79],["c",.12,1.71,.63,2.4,1.77,2.46],["c",1.08,.03,1.62,-.48,1.8,-1.74],["c",.06,-.54,.06,-3,0,-3.54],["c",-.15,-1.05,-.51,-1.53,-1.26,-1.68],["z"]],w:9.959,h:14.986},"rests.multimeasure":{d:[["M",0,-4],["l",0,16],["l",1,0],["l",0,-5],["l",40,0],["l",0,5],["l",1,0],["l",0,-16],["l",-1,0],["l",0,5],["l",-40,0],["l",0,-5],["z"]],w:42,h:18},"rests.whole":{d:[["M",.06,.03],["l",.09,-.06],["l",5.46,0],["l",5.49,0],["l",.09,.06],["l",.06,.09],["l",0,2.19],["l",0,2.19],["l",-.06,.09],["l",-.09,.06],["l",-5.49,0],["l",-5.46,0],["l",-.09,-.06],["l",-.06,-.09],["l",0,-2.19],["l",0,-2.19],["z"]],w:11.25,h:4.68},"rests.half":{d:[["M",.06,-4.62],["l",.09,-.06],["l",5.46,0],["l",5.49,0],["l",.09,.06],["l",.06,.09],["l",0,2.19],["l",0,2.19],["l",-.06,.09],["l",-.09,.06],["l",-5.49,0],["l",-5.46,0],["l",-.09,-.06],["l",-.06,-.09],["l",0,-2.19],["l",0,-2.19],["z"]],w:11.25,h:4.68},"rests.quarter":{d:[["M",1.89,-11.82],["c",.12,-.06,.24,-.06,.36,-.03],["c",.09,.06,4.74,5.58,4.86,5.82],["c",.21,.39,.15,.78,-.15,1.26],["c",-.24,.33,-.72,.81,-1.62,1.56],["c",-.45,.36,-.87,.75,-.96,.84],["c",-.93,.99,-1.14,2.49,-.6,3.63],["c",.18,.39,.27,.48,1.32,1.68],["c",1.92,2.25,1.83,2.16,1.83,2.34],["c",0,.18,-.18,.36,-.36,.39],["c",-.15,0,-.27,-.06,-.48,-.27],["c",-.75,-.75,-2.46,-1.29,-3.39,-1.08],["c",-.45,.09,-.69,.27,-.9,.69],["c",-.12,.3,-.21,.66,-.24,1.14],["c",-.03,.66,.09,1.35,.3,2.01],["c",.15,.42,.24,.66,.45,.96],["c",.18,.24,.18,.33,.03,.42],["c",-.12,.06,-.18,.03,-.45,-.3],["c",-1.08,-1.38,-2.07,-3.36,-2.4,-4.83],["c",-.27,-1.05,-.15,-1.77,.27,-2.07],["c",.21,-.12,.42,-.15,.87,-.15],["c",.87,.06,2.1,.39,3.3,.9],["l",.39,.18],["l",-1.65,-1.95],["c",-2.52,-2.97,-2.61,-3.09,-2.7,-3.27],["c",-.09,-.24,-.12,-.48,-.03,-.75],["c",.15,-.48,.57,-.96,1.83,-2.01],["c",.45,-.36,.84,-.72,.93,-.78],["c",.69,-.75,1.02,-1.8,.9,-2.79],["c",-.06,-.33,-.21,-.84,-.39,-1.11],["c",-.09,-.15,-.45,-.6,-.81,-1.05],["c",-.36,-.42,-.69,-.81,-.72,-.87],["c",-.09,-.18,0,-.42,.21,-.51],["z"]],w:7.888,h:21.435},"rests.8th":{d:[["M",1.68,-6.12],["c",.66,-.09,1.23,.09,1.68,.51],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.12,.27,.33,.45,.6,.48],["c",.12,0,.18,0,.33,-.09],["c",.39,-.18,1.32,-1.29,1.68,-1.98],["c",.09,-.21,.24,-.3,.39,-.3],["c",.12,0,.27,.09,.33,.18],["c",.03,.06,-.27,1.11,-1.86,6.42],["c",-1.02,3.48,-1.89,6.39,-1.92,6.42],["c",0,.03,-.12,.12,-.24,.15],["c",-.18,.09,-.21,.09,-.45,.09],["c",-.24,0,-.3,0,-.48,-.06],["c",-.09,-.06,-.21,-.12,-.21,-.15],["c",-.06,-.03,.15,-.57,1.68,-4.92],["c",.96,-2.67,1.74,-4.89,1.71,-4.89],["l",-.51,.15],["c",-1.08,.36,-1.74,.48,-2.55,.48],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.33,-.45,.84,-.81,1.38,-.9],["z"]],w:7.534,h:13.883},"rests.16th":{d:[["M",3.33,-6.12],["c",.66,-.09,1.23,.09,1.68,.51],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.15,.39,.57,.57,.87,.42],["c",.39,-.18,1.2,-1.23,1.62,-2.07],["c",.06,-.15,.24,-.24,.36,-.24],["c",.12,0,.27,.09,.33,.18],["c",.03,.06,-.45,1.86,-2.67,10.17],["c",-1.5,5.55,-2.73,10.14,-2.76,10.17],["c",-.03,.03,-.12,.12,-.24,.15],["c",-.18,.09,-.21,.09,-.45,.09],["c",-.24,0,-.3,0,-.48,-.06],["c",-.09,-.06,-.21,-.12,-.21,-.15],["c",-.06,-.03,.12,-.57,1.44,-4.92],["c",.81,-2.67,1.47,-4.86,1.47,-4.89],["c",-.03,0,-.27,.06,-.54,.15],["c",-1.08,.36,-1.77,.48,-2.58,.48],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.72,-1.05,2.22,-1.23,3.06,-.42],["c",.3,.33,.42,.6,.6,1.38],["c",.09,.45,.21,.78,.33,.9],["c",.09,.09,.27,.18,.45,.21],["c",.12,0,.18,0,.33,-.09],["c",.33,-.15,1.02,-.93,1.41,-1.59],["c",.12,-.21,.18,-.39,.39,-1.08],["c",.66,-2.1,1.17,-3.84,1.17,-3.87],["c",0,0,-.21,.06,-.42,.15],["c",-.51,.15,-1.2,.33,-1.68,.42],["c",-.33,.06,-.51,.06,-.96,.06],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.33,-.45,.84,-.81,1.38,-.9],["z"]],w:9.724,h:21.383},"rests.32nd":{d:[["M",4.23,-13.62],["c",.66,-.09,1.23,.09,1.68,.51],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.12,.27,.33,.45,.6,.48],["c",.12,0,.18,0,.27,-.06],["c",.33,-.21,.99,-1.11,1.44,-1.98],["c",.09,-.24,.21,-.33,.39,-.33],["c",.12,0,.27,.09,.33,.18],["c",.03,.06,-.57,2.67,-3.21,13.89],["c",-1.8,7.62,-3.3,13.89,-3.3,13.92],["c",-.03,.06,-.12,.12,-.24,.18],["c",-.21,.09,-.24,.09,-.48,.09],["c",-.24,0,-.3,0,-.48,-.06],["c",-.09,-.06,-.21,-.12,-.21,-.15],["c",-.06,-.03,.09,-.57,1.23,-4.92],["c",.69,-2.67,1.26,-4.86,1.29,-4.89],["c",0,-.03,-.12,-.03,-.48,.12],["c",-1.17,.39,-2.22,.57,-3,.54],["c",-.42,-.03,-.75,-.12,-1.11,-.3],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.72,-1.05,2.22,-1.23,3.06,-.42],["c",.3,.33,.42,.6,.6,1.38],["c",.09,.45,.21,.78,.33,.9],["c",.12,.09,.3,.18,.48,.21],["c",.12,0,.18,0,.3,-.09],["c",.42,-.21,1.29,-1.29,1.56,-1.89],["c",.03,-.12,1.23,-4.59,1.23,-4.65],["c",0,-.03,-.18,.03,-.39,.12],["c",-.63,.18,-1.2,.36,-1.74,.45],["c",-.39,.06,-.54,.06,-1.02,.06],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.72,-1.05,2.22,-1.23,3.06,-.42],["c",.3,.33,.42,.6,.6,1.38],["c",.09,.45,.21,.78,.33,.9],["c",.18,.18,.51,.27,.72,.15],["c",.3,-.12,.69,-.57,1.08,-1.17],["c",.42,-.6,.39,-.51,1.05,-3.03],["c",.33,-1.26,.6,-2.31,.6,-2.34],["c",0,0,-.21,.03,-.45,.12],["c",-.57,.18,-1.14,.33,-1.62,.42],["c",-.33,.06,-.51,.06,-.96,.06],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.33,-.45,.84,-.81,1.38,-.9],["z"]],w:11.373,h:28.883},"rests.64th":{d:[["M",5.13,-13.62],["c",.66,-.09,1.23,.09,1.68,.51],["c",.27,.3,.39,.54,.57,1.26],["c",.15,.63,.21,.81,.33,.96],["c",.18,.21,.54,.3,.75,.18],["c",.24,-.12,.63,-.66,1.08,-1.56],["c",.33,-.66,.39,-.72,.6,-.72],["c",.12,0,.27,.09,.33,.18],["c",.03,.06,-.69,3.66,-3.54,17.64],["c",-1.95,9.66,-3.57,17.61,-3.57,17.64],["c",-.03,.06,-.12,.12,-.24,.18],["c",-.21,.09,-.24,.09,-.48,.09],["c",-.24,0,-.3,0,-.48,-.06],["c",-.09,-.06,-.21,-.12,-.21,-.15],["c",-.06,-.03,.06,-.57,1.05,-4.95],["c",.6,-2.7,1.08,-4.89,1.08,-4.92],["c",0,0,-.24,.06,-.51,.15],["c",-.66,.24,-1.2,.36,-1.77,.48],["c",-.42,.06,-.57,.06,-1.05,.06],["c",-.69,0,-.87,-.03,-1.35,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.72,-1.05,2.22,-1.23,3.06,-.42],["c",.3,.33,.42,.6,.6,1.38],["c",.09,.45,.21,.78,.33,.9],["c",.09,.09,.27,.18,.45,.21],["c",.21,.03,.39,-.09,.72,-.42],["c",.45,-.45,1.02,-1.26,1.17,-1.65],["c",.03,-.09,.27,-1.14,.54,-2.34],["c",.27,-1.2,.48,-2.19,.51,-2.22],["c",0,-.03,-.09,-.03,-.48,.12],["c",-1.17,.39,-2.22,.57,-3,.54],["c",-.42,-.03,-.75,-.12,-1.11,-.3],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.36,-.54,.96,-.87,1.65,-.93],["c",.54,-.03,1.02,.15,1.41,.54],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.15,.39,.57,.57,.9,.42],["c",.36,-.18,1.2,-1.26,1.47,-1.89],["c",.03,-.09,.3,-1.2,.57,-2.43],["l",.51,-2.28],["l",-.54,.18],["c",-1.11,.36,-1.8,.48,-2.61,.48],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.36,-.54,.96,-.87,1.65,-.93],["c",.54,-.03,1.02,.15,1.41,.54],["c",.27,.3,.39,.54,.57,1.26],["c",.15,.63,.21,.81,.33,.96],["c",.21,.21,.54,.3,.75,.18],["c",.36,-.18,.93,-.93,1.29,-1.68],["c",.12,-.24,.18,-.48,.63,-2.55],["l",.51,-2.31],["c",0,-.03,-.18,.03,-.39,.12],["c",-1.14,.36,-2.1,.54,-2.82,.51],["c",-.42,-.03,-.75,-.12,-1.11,-.3],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.33,-.45,.84,-.81,1.38,-.9],["z"]],w:12.453,h:36.383},"rests.128th":{d:[["M",6.03,-21.12],["c",.66,-.09,1.23,.09,1.68,.51],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.12,.27,.33,.45,.6,.48],["c",.21,0,.33,-.06,.54,-.36],["c",.15,-.21,.54,-.93,.78,-1.47],["c",.15,-.33,.18,-.39,.3,-.48],["c",.18,-.09,.45,0,.51,.15],["c",.03,.09,-7.11,42.75,-7.17,42.84],["c",-.03,.03,-.15,.09,-.24,.15],["c",-.18,.06,-.24,.06,-.45,.06],["c",-.24,0,-.3,0,-.48,-.06],["c",-.09,-.06,-.21,-.12,-.21,-.15],["c",-.06,-.03,.03,-.57,.84,-4.98],["c",.51,-2.7,.93,-4.92,.9,-4.92],["c",0,0,-.15,.06,-.36,.12],["c",-.78,.27,-1.62,.48,-2.31,.57],["c",-.15,.03,-.54,.03,-.81,.03],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.36,-.54,.96,-.87,1.65,-.93],["c",.54,-.03,1.02,.15,1.41,.54],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.12,.27,.33,.45,.63,.48],["c",.12,0,.18,0,.3,-.09],["c",.42,-.21,1.14,-1.11,1.5,-1.83],["c",.12,-.27,.12,-.27,.54,-2.52],["c",.24,-1.23,.42,-2.25,.39,-2.25],["c",0,0,-.24,.06,-.51,.18],["c",-1.26,.39,-2.25,.57,-3.06,.54],["c",-.42,-.03,-.75,-.12,-1.11,-.3],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.36,-.54,.96,-.87,1.65,-.93],["c",.54,-.03,1.02,.15,1.41,.54],["c",.27,.3,.39,.54,.57,1.26],["c",.15,.63,.21,.81,.33,.96],["c",.18,.21,.51,.3,.75,.18],["c",.36,-.15,1.05,-.99,1.41,-1.77],["l",.15,-.3],["l",.42,-2.25],["c",.21,-1.26,.42,-2.28,.39,-2.28],["l",-.51,.15],["c",-1.11,.39,-1.89,.51,-2.7,.51],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.36,-.54,.96,-.87,1.65,-.93],["c",.54,-.03,1.02,.15,1.41,.54],["c",.27,.3,.39,.54,.57,1.26],["c",.15,.63,.21,.81,.33,.96],["c",.18,.18,.48,.27,.72,.21],["c",.33,-.12,1.14,-1.26,1.41,-1.95],["c",0,-.09,.21,-1.11,.45,-2.34],["c",.21,-1.2,.39,-2.22,.39,-2.28],["c",.03,-.03,0,-.03,-.45,.12],["c",-.57,.18,-1.2,.33,-1.71,.42],["c",-.3,.06,-.51,.06,-.93,.06],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.36,-.54,.96,-.87,1.65,-.93],["c",.54,-.03,1.02,.15,1.41,.54],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.12,.27,.33,.45,.6,.48],["c",.18,0,.36,-.09,.57,-.33],["c",.33,-.36,.78,-1.14,.93,-1.56],["c",.03,-.12,.24,-1.2,.45,-2.4],["c",.24,-1.2,.42,-2.22,.42,-2.28],["c",.03,-.03,0,-.03,-.39,.09],["c",-1.05,.36,-1.8,.48,-2.58,.48],["c",-.63,0,-.84,-.03,-1.29,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.33,-.45,.84,-.81,1.38,-.9],["z"]],w:12.992,h:43.883},"accidentals.sharp":{d:[["M",5.73,-11.19],["c",.21,-.12,.54,-.03,.66,.24],["c",.06,.12,.06,.21,.06,2.31],["c",0,1.23,0,2.22,.03,2.22],["c",0,0,.27,-.12,.6,-.24],["c",.69,-.27,.78,-.3,.96,-.15],["c",.21,.15,.21,.18,.21,1.38],["c",0,1.02,0,1.11,-.06,1.2],["c",-.03,.06,-.09,.12,-.12,.15],["c",-.06,.03,-.42,.21,-.84,.36],["l",-.75,.33],["l",-.03,2.43],["c",0,1.32,0,2.43,.03,2.43],["c",0,0,.27,-.12,.6,-.24],["c",.69,-.27,.78,-.3,.96,-.15],["c",.21,.15,.21,.18,.21,1.38],["c",0,1.02,0,1.11,-.06,1.2],["c",-.03,.06,-.09,.12,-.12,.15],["c",-.06,.03,-.42,.21,-.84,.36],["l",-.75,.33],["l",-.03,2.52],["c",0,2.28,-.03,2.55,-.06,2.64],["c",-.21,.36,-.72,.36,-.93,0],["c",-.03,-.09,-.06,-.33,-.06,-2.43],["l",0,-2.31],["l",-1.29,.51],["l",-1.26,.51],["l",0,2.43],["c",0,2.58,0,2.52,-.15,2.67],["c",-.06,.09,-.27,.18,-.36,.18],["c",-.12,0,-.33,-.09,-.39,-.18],["c",-.15,-.15,-.15,-.09,-.15,-2.43],["c",0,-1.23,0,-2.22,-.03,-2.22],["c",0,0,-.27,.12,-.6,.24],["c",-.69,.27,-.78,.3,-.96,.15],["c",-.21,-.15,-.21,-.18,-.21,-1.38],["c",0,-1.02,0,-1.11,.06,-1.2],["c",.03,-.06,.09,-.12,.12,-.15],["c",.06,-.03,.42,-.21,.84,-.36],["l",.78,-.33],["l",0,-2.43],["c",0,-1.32,0,-2.43,-.03,-2.43],["c",0,0,-.27,.12,-.6,.24],["c",-.69,.27,-.78,.3,-.96,.15],["c",-.21,-.15,-.21,-.18,-.21,-1.38],["c",0,-1.02,0,-1.11,.06,-1.2],["c",.03,-.06,.09,-.12,.12,-.15],["c",.06,-.03,.42,-.21,.84,-.36],["l",.78,-.33],["l",0,-2.52],["c",0,-2.28,.03,-2.55,.06,-2.64],["c",.21,-.36,.72,-.36,.93,0],["c",.03,.09,.06,.33,.06,2.43],["l",.03,2.31],["l",1.26,-.51],["l",1.26,-.51],["l",0,-2.43],["c",0,-2.28,0,-2.43,.06,-2.55],["c",.06,-.12,.12,-.18,.27,-.24],["z"],["m",-.33,10.65],["l",0,-2.43],["l",-1.29,.51],["l",-1.26,.51],["l",0,2.46],["l",0,2.43],["l",.09,-.03],["c",.06,-.03,.63,-.27,1.29,-.51],["l",1.17,-.48],["l",0,-2.46],["z"]],w:8.25,h:22.462},"accidentals.halfsharp":{d:[["M",2.43,-10.05],["c",.21,-.12,.54,-.03,.66,.24],["c",.06,.12,.06,.21,.06,2.01],["c",0,1.05,0,1.89,.03,1.89],["l",.72,-.48],["c",.69,-.48,.69,-.51,.87,-.51],["c",.15,0,.18,.03,.27,.09],["c",.21,.15,.21,.18,.21,1.41],["c",0,1.11,-.03,1.14,-.09,1.23],["c",-.03,.03,-.48,.39,-1.02,.75],["l",-.99,.66],["l",0,2.37],["c",0,1.32,0,2.37,.03,2.37],["l",.72,-.48],["c",.69,-.48,.69,-.51,.87,-.51],["c",.15,0,.18,.03,.27,.09],["c",.21,.15,.21,.18,.21,1.41],["c",0,1.11,-.03,1.14,-.09,1.23],["c",-.03,.03,-.48,.39,-1.02,.75],["l",-.99,.66],["l",0,2.25],["c",0,1.95,0,2.28,-.06,2.37],["c",-.06,.12,-.12,.21,-.24,.27],["c",-.27,.12,-.54,.03,-.69,-.24],["c",-.06,-.12,-.06,-.21,-.06,-2.01],["c",0,-1.05,0,-1.89,-.03,-1.89],["l",-.72,.48],["c",-.69,.48,-.69,.48,-.87,.48],["c",-.15,0,-.18,0,-.27,-.06],["c",-.21,-.15,-.21,-.18,-.21,-1.41],["c",0,-1.11,.03,-1.14,.09,-1.23],["c",.03,-.03,.48,-.39,1.02,-.75],["l",.99,-.66],["l",0,-2.37],["c",0,-1.32,0,-2.37,-.03,-2.37],["l",-.72,.48],["c",-.69,.48,-.69,.48,-.87,.48],["c",-.15,0,-.18,0,-.27,-.06],["c",-.21,-.15,-.21,-.18,-.21,-1.41],["c",0,-1.11,.03,-1.14,.09,-1.23],["c",.03,-.03,.48,-.39,1.02,-.75],["l",.99,-.66],["l",0,-2.25],["c",0,-2.13,0,-2.28,.06,-2.4],["c",.06,-.12,.12,-.18,.27,-.24],["z"]],w:5.25,h:20.174},"accidentals.nat":{d:[["M",.21,-11.4],["c",.24,-.06,.78,0,.99,.15],["c",.03,.03,.03,.48,0,2.61],["c",-.03,1.44,-.03,2.61,-.03,2.61],["c",0,.03,.75,-.09,1.68,-.24],["c",.96,-.18,1.71,-.27,1.74,-.27],["c",.15,.03,.27,.15,.36,.3],["l",.06,.12],["l",.09,8.67],["c",.09,6.96,.12,8.67,.09,8.67],["c",-.03,.03,-.12,.06,-.21,.09],["c",-.24,.09,-.72,.09,-.96,0],["c",-.09,-.03,-.18,-.06,-.21,-.09],["c",-.03,-.03,-.03,-.48,0,-2.61],["c",.03,-1.44,.03,-2.61,.03,-2.61],["c",0,-.03,-.75,.09,-1.68,.24],["c",-.96,.18,-1.71,.27,-1.74,.27],["c",-.15,-.03,-.27,-.15,-.36,-.3],["l",-.06,-.15],["l",-.09,-7.53],["c",-.06,-4.14,-.09,-8.04,-.12,-8.67],["l",0,-1.11],["l",.15,-.06],["c",.09,-.03,.21,-.06,.27,-.09],["z"],["m",3.75,8.4],["c",0,-.33,0,-.42,-.03,-.42],["c",-.12,0,-2.79,.45,-2.79,.48],["c",-.03,0,-.09,6.3,-.09,6.33],["c",.03,0,2.79,-.45,2.82,-.48],["c",0,0,.09,-4.53,.09,-5.91],["z"]],w:5.4,h:22.8},"accidentals.flat":{d:[["M",-.36,-14.07],["c",.33,-.06,.87,0,1.08,.15],["c",.06,.03,.06,.36,-.03,5.25],["c",-.06,2.85,-.09,5.19,-.09,5.19],["c",0,.03,.12,-.03,.24,-.12],["c",.63,-.42,1.41,-.66,2.19,-.72],["c",.81,-.03,1.47,.21,2.04,.78],["c",.57,.54,.87,1.26,.93,2.04],["c",.03,.57,-.09,1.08,-.36,1.62],["c",-.42,.81,-1.02,1.38,-2.82,2.61],["c",-1.14,.78,-1.44,1.02,-1.8,1.44],["c",-.18,.18,-.39,.39,-.45,.42],["c",-.27,.18,-.57,.15,-.81,-.06],["c",-.06,-.09,-.12,-.18,-.15,-.27],["c",-.03,-.06,-.09,-3.27,-.18,-8.34],["c",-.09,-4.53,-.15,-8.58,-.18,-9.03],["l",0,-.78],["l",.12,-.06],["c",.06,-.03,.18,-.09,.27,-.12],["z"],["m",3.18,11.01],["c",-.21,-.12,-.54,-.15,-.81,-.06],["c",-.54,.15,-.99,.63,-1.17,1.26],["c",-.06,.3,-.12,2.88,-.06,3.87],["c",.03,.42,.03,.81,.06,.9],["l",.03,.12],["l",.45,-.39],["c",.63,-.54,1.26,-1.17,1.56,-1.59],["c",.3,-.42,.6,-.99,.72,-1.41],["c",.18,-.69,.09,-1.47,-.18,-2.07],["c",-.15,-.3,-.33,-.51,-.6,-.63],["z"]],w:6.75,h:18.801},"accidentals.halfflat":{d:[["M",4.83,-14.07],["c",.33,-.06,.87,0,1.08,.15],["c",.06,.03,.06,.6,-.12,9.06],["c",-.09,5.55,-.15,9.06,-.18,9.12],["c",-.03,.09,-.09,.18,-.15,.27],["c",-.24,.21,-.54,.24,-.81,.06],["c",-.06,-.03,-.27,-.24,-.45,-.42],["c",-.36,-.42,-.66,-.66,-1.8,-1.44],["c",-1.23,-.84,-1.83,-1.32,-2.25,-1.77],["c",-.66,-.78,-.96,-1.56,-.93,-2.46],["c",.09,-1.41,1.11,-2.58,2.4,-2.79],["c",.3,-.06,.84,-.03,1.23,.06],["c",.54,.12,1.08,.33,1.53,.63],["c",.12,.09,.24,.15,.24,.12],["c",0,0,-.12,-8.37,-.18,-9.75],["l",0,-.66],["l",.12,-.06],["c",.06,-.03,.18,-.09,.27,-.12],["z"],["m",-1.65,10.95],["c",-.6,-.18,-1.08,.09,-1.38,.69],["c",-.27,.6,-.36,1.38,-.18,2.07],["c",.12,.42,.42,.99,.72,1.41],["c",.3,.42,.93,1.05,1.56,1.59],["l",.48,.39],["l",0,-.12],["c",.03,-.09,.03,-.48,.06,-.9],["c",.03,-.57,.03,-1.08,0,-2.22],["c",-.03,-1.62,-.03,-1.62,-.24,-2.07],["c",-.21,-.42,-.6,-.75,-1.02,-.84],["z"]],w:6.728,h:18.801},"accidentals.dblflat":{d:[["M",-.36,-14.07],["c",.33,-.06,.87,0,1.08,.15],["c",.06,.03,.06,.36,-.03,5.25],["c",-.06,2.85,-.09,5.19,-.09,5.19],["c",0,.03,.12,-.03,.24,-.12],["c",.63,-.42,1.41,-.66,2.19,-.72],["c",.81,-.03,1.47,.21,2.04,.78],["c",.57,.54,.87,1.26,.93,2.04],["c",.03,.57,-.09,1.08,-.36,1.62],["c",-.42,.81,-1.02,1.38,-2.82,2.61],["c",-1.14,.78,-1.44,1.02,-1.8,1.44],["c",-.18,.18,-.39,.39,-.45,.42],["c",-.27,.18,-.57,.15,-.81,-.06],["c",-.06,-.09,-.12,-.18,-.15,-.27],["c",-.03,-.06,-.09,-3.27,-.18,-8.34],["c",-.09,-4.53,-.15,-8.58,-.18,-9.03],["l",0,-.78],["l",.12,-.06],["c",.06,-.03,.18,-.09,.27,-.12],["z"],["m",3.18,11.01],["c",-.21,-.12,-.54,-.15,-.81,-.06],["c",-.54,.15,-.99,.63,-1.17,1.26],["c",-.06,.3,-.12,2.88,-.06,3.87],["c",.03,.42,.03,.81,.06,.9],["l",.03,.12],["l",.45,-.39],["c",.63,-.54,1.26,-1.17,1.56,-1.59],["c",.3,-.42,.6,-.99,.72,-1.41],["c",.18,-.69,.09,-1.47,-.18,-2.07],["c",-.15,-.3,-.33,-.51,-.6,-.63],["z"],["m",3,-11],["c",.33,-.06,.87,0,1.08,.15],["c",.06,.03,.06,.36,-.03,5.25],["c",-.06,2.85,-.09,5.19,-.09,5.19],["c",0,.03,.12,-.03,.24,-.12],["c",.63,-.42,1.41,-.66,2.19,-.72],["c",.81,-.03,1.47,.21,2.04,.78],["c",.57,.54,.87,1.26,.93,2.04],["c",.03,.57,-.09,1.08,-.36,1.62],["c",-.42,.81,-1.02,1.38,-2.82,2.61],["c",-1.14,.78,-1.44,1.02,-1.8,1.44],["c",-.18,.18,-.39,.39,-.45,.42],["c",-.27,.18,-.57,.15,-.81,-.06],["c",-.06,-.09,-.12,-.18,-.15,-.27],["c",-.03,-.06,-.09,-3.27,-.18,-8.34],["c",-.09,-4.53,-.15,-8.58,-.18,-9.03],["l",0,-.78],["l",.12,-.06],["c",.06,-.03,.18,-.09,.27,-.12],["z"],["m",3.18,11.01],["c",-.21,-.12,-.54,-.15,-.81,-.06],["c",-.54,.15,-.99,.63,-1.17,1.26],["c",-.06,.3,-.12,2.88,-.06,3.87],["c",.03,.42,.03,.81,.06,.9],["l",.03,.12],["l",.45,-.39],["c",.63,-.54,1.26,-1.17,1.56,-1.59],["c",.3,-.42,.6,-.99,.72,-1.41],["c",.18,-.69,.09,-1.47,-.18,-2.07],["c",-.15,-.3,-.33,-.51,-.6,-.63],["z"]],w:12.1,h:18.804},"accidentals.dblsharp":{d:[["M",-.18,-3.96],["c",.06,-.03,.12,-.06,.15,-.06],["c",.09,0,2.76,.27,2.79,.3],["c",.12,.03,.15,.12,.15,.51],["c",.06,.96,.24,1.59,.57,2.1],["c",.06,.09,.15,.21,.18,.24],["l",.09,.06],["l",.09,-.06],["c",.03,-.03,.12,-.15,.18,-.24],["c",.33,-.51,.51,-1.14,.57,-2.1],["c",0,-.39,.03,-.45,.12,-.51],["c",.03,0,.66,-.09,1.44,-.15],["c",1.47,-.15,1.5,-.15,1.56,-.03],["c",.03,.06,0,.42,-.09,1.44],["c",-.09,.72,-.15,1.35,-.15,1.38],["c",0,.03,-.03,.09,-.06,.12],["c",-.06,.06,-.12,.09,-.51,.09],["c",-1.08,.06,-1.8,.3,-2.28,.75],["l",-.12,.09],["l",.09,.09],["c",.12,.15,.39,.33,.63,.45],["c",.42,.18,.96,.27,1.68,.33],["c",.39,0,.45,.03,.51,.09],["c",.03,.03,.06,.09,.06,.12],["c",0,.03,.06,.66,.15,1.38],["c",.09,1.02,.12,1.38,.09,1.44],["c",-.06,.12,-.09,.12,-1.56,-.03],["c",-.78,-.06,-1.41,-.15,-1.44,-.15],["c",-.09,-.06,-.12,-.12,-.12,-.54],["c",-.06,-.93,-.24,-1.56,-.57,-2.07],["c",-.06,-.09,-.15,-.21,-.18,-.24],["l",-.09,-.06],["l",-.09,.06],["c",-.03,.03,-.12,.15,-.18,.24],["c",-.33,.51,-.51,1.14,-.57,2.07],["c",0,.42,-.03,.48,-.12,.54],["c",-.03,0,-.66,.09,-1.44,.15],["c",-1.47,.15,-1.5,.15,-1.56,.03],["c",-.03,-.06,0,-.42,.09,-1.44],["c",.09,-.72,.15,-1.35,.15,-1.38],["c",0,-.03,.03,-.09,.06,-.12],["c",.06,-.06,.12,-.09,.51,-.09],["c",.72,-.06,1.26,-.15,1.68,-.33],["c",.24,-.12,.51,-.3,.63,-.45],["l",.09,-.09],["l",-.12,-.09],["c",-.48,-.45,-1.2,-.69,-2.28,-.75],["c",-.39,0,-.45,-.03,-.51,-.09],["c",-.03,-.03,-.06,-.09,-.06,-.12],["c",0,-.03,-.06,-.63,-.12,-1.38],["c",-.09,-.72,-.15,-1.35,-.15,-1.38],["z"]],w:7.95,h:7.977},"dots.dot":{d:[["M",1.32,-1.68],["c",.09,-.03,.27,-.06,.39,-.06],["c",.96,0,1.74,.78,1.74,1.71],["c",0,.96,-.78,1.74,-1.71,1.74],["c",-.96,0,-1.74,-.78,-1.74,-1.71],["c",0,-.78,.54,-1.5,1.32,-1.68],["z"]],w:3.45,h:3.45},"noteheads.dbl":{d:[["M",-.69,-4.02],["c",.18,-.09,.36,-.09,.54,0],["c",.18,.09,.24,.15,.33,.3],["c",.06,.15,.06,.18,.06,1.41],["l",0,1.23],["l",.12,-.18],["c",.72,-1.26,2.64,-2.31,4.86,-2.64],["c",.81,-.15,1.11,-.15,2.13,-.15],["c",.99,0,1.29,0,2.1,.15],["c",.75,.12,1.38,.27,2.04,.54],["c",1.35,.51,2.34,1.26,2.82,2.1],["l",.12,.18],["l",0,-1.23],["c",0,-1.2,0,-1.26,.06,-1.38],["c",.09,-.18,.15,-.24,.33,-.33],["c",.18,-.09,.36,-.09,.54,0],["c",.18,.09,.24,.15,.33,.3],["l",.06,.15],["l",0,3.54],["l",0,3.54],["l",-.06,.15],["c",-.09,.18,-.15,.24,-.33,.33],["c",-.18,.09,-.36,.09,-.54,0],["c",-.18,-.09,-.24,-.15,-.33,-.33],["c",-.06,-.12,-.06,-.18,-.06,-1.38],["l",0,-1.23],["l",-.12,.18],["c",-.48,.84,-1.47,1.59,-2.82,2.1],["c",-.84,.33,-1.71,.54,-2.85,.66],["c",-.45,.06,-2.16,.06,-2.61,0],["c",-1.14,-.12,-2.01,-.33,-2.85,-.66],["c",-1.35,-.51,-2.34,-1.26,-2.82,-2.1],["l",-.12,-.18],["l",0,1.23],["c",0,1.23,0,1.26,-.06,1.38],["c",-.09,.18,-.15,.24,-.33,.33],["c",-.18,.09,-.36,.09,-.54,0],["c",-.18,-.09,-.24,-.15,-.33,-.33],["l",-.06,-.15],["l",0,-3.54],["c",0,-3.48,0,-3.54,.06,-3.66],["c",.09,-.18,.15,-.24,.33,-.33],["z"],["m",7.71,.63],["c",-.36,-.06,-.9,-.06,-1.14,0],["c",-.3,.03,-.66,.24,-.87,.42],["c",-.6,.54,-.9,1.62,-.75,2.82],["c",.12,.93,.51,1.68,1.11,2.31],["c",.75,.72,1.83,1.2,2.85,1.26],["c",1.05,.06,1.83,-.54,2.1,-1.65],["c",.21,-.9,.12,-1.95,-.24,-2.82],["c",-.36,-.81,-1.08,-1.53,-1.95,-1.95],["c",-.3,-.15,-.78,-.3,-1.11,-.39],["z"]],w:16.83,h:8.145},"noteheads.whole":{d:[["M",6.51,-4.05],["c",.51,-.03,2.01,0,2.52,.03],["c",1.41,.18,2.64,.51,3.72,1.08],["c",1.2,.63,1.95,1.41,2.19,2.31],["c",.09,.33,.09,.9,0,1.23],["c",-.24,.9,-.99,1.68,-2.19,2.31],["c",-1.08,.57,-2.28,.9,-3.75,1.08],["c",-.66,.06,-2.31,.06,-2.97,0],["c",-1.47,-.18,-2.67,-.51,-3.75,-1.08],["c",-1.2,-.63,-1.95,-1.41,-2.19,-2.31],["c",-.09,-.33,-.09,-.9,0,-1.23],["c",.24,-.9,.99,-1.68,2.19,-2.31],["c",1.2,-.63,2.61,-.99,4.23,-1.11],["z"],["m",.57,.66],["c",-.87,-.15,-1.53,0,-2.04,.51],["c",-.15,.15,-.24,.27,-.33,.48],["c",-.24,.51,-.36,1.08,-.33,1.77],["c",.03,.69,.18,1.26,.42,1.77],["c",.6,1.17,1.74,1.98,3.18,2.22],["c",1.11,.21,1.95,-.15,2.34,-.99],["c",.24,-.51,.36,-1.08,.33,-1.8],["c",-.06,-1.11,-.45,-2.04,-1.17,-2.76],["c",-.63,-.63,-1.47,-1.05,-2.4,-1.2],["z"]],w:14.985,h:8.097},"noteheads.half":{d:[["M",7.44,-4.05],["c",.06,-.03,.27,-.03,.48,-.03],["c",1.05,0,1.71,.24,2.1,.81],["c",.42,.6,.45,1.35,.18,2.4],["c",-.42,1.59,-1.14,2.73,-2.16,3.39],["c",-1.41,.93,-3.18,1.44,-5.4,1.53],["c",-1.17,.03,-1.89,-.21,-2.28,-.81],["c",-.42,-.6,-.45,-1.35,-.18,-2.4],["c",.42,-1.59,1.14,-2.73,2.16,-3.39],["c",.63,-.42,1.23,-.72,1.98,-.96],["c",.9,-.3,1.65,-.42,3.12,-.54],["z"],["m",1.29,.87],["c",-.27,-.09,-.63,-.12,-.9,-.03],["c",-.72,.24,-1.53,.69,-3.27,1.8],["c",-2.34,1.5,-3.3,2.25,-3.57,2.79],["c",-.36,.72,-.06,1.5,.66,1.77],["c",.24,.12,.69,.09,.99,0],["c",.84,-.3,1.92,-.93,4.14,-2.37],["c",1.62,-1.08,2.37,-1.71,2.61,-2.19],["c",.36,-.72,.06,-1.5,-.66,-1.77],["z"]],w:10.37,h:8.132},"noteheads.quarter":{d:[["M",6.09,-4.05],["c",.36,-.03,1.2,0,1.53,.06],["c",1.17,.24,1.89,.84,2.16,1.83],["c",.06,.18,.06,.3,.06,.66],["c",0,.45,0,.63,-.15,1.08],["c",-.66,2.04,-3.06,3.93,-5.52,4.38],["c",-.54,.09,-1.44,.09,-1.83,.03],["c",-1.23,-.27,-1.98,-.87,-2.25,-1.86],["c",-.06,-.18,-.06,-.3,-.06,-.66],["c",0,-.45,0,-.63,.15,-1.08],["c",.24,-.78,.75,-1.53,1.44,-2.22],["c",1.2,-1.2,2.85,-2.01,4.47,-2.22],["z"]],w:9.81,h:8.094},"noteheads.slash.nostem":{d:[["M",9.3,-7.77],["c",.06,-.06,.18,-.06,1.71,-.06],["l",1.65,0],["l",.09,.09],["c",.06,.06,.06,.09,.06,.15],["c",-.03,.12,-9.21,15.24,-9.3,15.33],["c",-.06,.06,-.18,.06,-1.71,.06],["l",-1.65,0],["l",-.09,-.09],["c",-.06,-.06,-.06,-.09,-.06,-.15],["c",.03,-.12,9.21,-15.24,9.3,-15.33],["z"]],w:12.81,h:15.63},"noteheads.indeterminate":{d:[["M",.78,-4.05],["c",.12,-.03,.24,-.03,.36,.03],["c",.03,.03,.93,.72,1.95,1.56],["l",1.86,1.5],["l",1.86,-1.5],["c",1.02,-.84,1.92,-1.53,1.95,-1.56],["c",.21,-.12,.33,-.09,.75,.24],["c",.3,.27,.36,.36,.36,.54],["c",0,.03,-.03,.12,-.06,.18],["c",-.03,.06,-.9,.75,-1.89,1.56],["l",-1.8,1.47],["c",0,.03,.81,.69,1.8,1.5],["c",.99,.81,1.86,1.5,1.89,1.56],["c",.03,.06,.06,.15,.06,.18],["c",0,.18,-.06,.27,-.36,.54],["c",-.42,.33,-.54,.36,-.75,.24],["c",-.03,-.03,-.93,-.72,-1.95,-1.56],["l",-1.86,-1.5],["l",-1.86,1.5],["c",-1.02,.84,-1.92,1.53,-1.95,1.56],["c",-.21,.12,-.33,.09,-.75,-.24],["c",-.3,-.27,-.36,-.36,-.36,-.54],["c",0,-.03,.03,-.12,.06,-.18],["c",.03,-.06,.9,-.75,1.89,-1.56],["l",1.8,-1.47],["c",0,-.03,-.81,-.69,-1.8,-1.5],["c",-.99,-.81,-1.86,-1.5,-1.89,-1.56],["c",-.06,-.12,-.09,-.21,-.03,-.36],["c",.03,-.09,.57,-.57,.72,-.63],["z"]],w:9.843,h:8.139},"scripts.ufermata":{d:[["M",-.75,-10.77],["c",.12,0,.45,-.03,.69,-.03],["c",2.91,-.03,5.55,1.53,7.41,4.35],["c",1.17,1.71,1.95,3.72,2.43,6.03],["c",.12,.51,.12,.57,.03,.69],["c",-.12,.21,-.48,.27,-.69,.12],["c",-.12,-.09,-.18,-.24,-.27,-.69],["c",-.78,-3.63,-3.42,-6.54,-6.78,-7.38],["c",-.78,-.21,-1.2,-.24,-2.07,-.24],["c",-.63,0,-.84,0,-1.2,.06],["c",-1.83,.27,-3.42,1.08,-4.8,2.37],["c",-1.41,1.35,-2.4,3.21,-2.85,5.19],["c",-.09,.45,-.15,.6,-.27,.69],["c",-.21,.15,-.57,.09,-.69,-.12],["c",-.09,-.12,-.09,-.18,.03,-.69],["c",.33,-1.62,.78,-3,1.47,-4.38],["c",1.77,-3.54,4.44,-5.67,7.56,-5.97],["z"],["m",.33,7.47],["c",1.38,-.3,2.58,.9,2.31,2.25],["c",-.15,.72,-.78,1.35,-1.47,1.5],["c",-1.38,.27,-2.58,-.93,-2.31,-2.31],["c",.15,-.69,.78,-1.29,1.47,-1.44],["z"]],w:19.748,h:11.289},"scripts.dfermata":{d:[["M",-9.63,-.42],["c",.15,-.09,.36,-.06,.51,.03],["c",.12,.09,.18,.24,.27,.66],["c",.78,3.66,3.42,6.57,6.78,7.41],["c",.78,.21,1.2,.24,2.07,.24],["c",.63,0,.84,0,1.2,-.06],["c",1.83,-.27,3.42,-1.08,4.8,-2.37],["c",1.41,-1.35,2.4,-3.21,2.85,-5.22],["c",.09,-.42,.15,-.57,.27,-.66],["c",.21,-.15,.57,-.09,.69,.12],["c",.09,.12,.09,.18,-.03,.69],["c",-.33,1.62,-.78,3,-1.47,4.38],["c",-1.92,3.84,-4.89,6,-8.31,6],["c",-3.42,0,-6.39,-2.16,-8.31,-6],["c",-.48,-.96,-.84,-1.92,-1.14,-2.97],["c",-.18,-.69,-.42,-1.74,-.42,-1.92],["c",0,-.12,.09,-.27,.24,-.33],["z"],["m",9.21,0],["c",1.2,-.27,2.34,.63,2.34,1.86],["c",0,.9,-.66,1.68,-1.5,1.89],["c",-1.38,.27,-2.58,-.93,-2.31,-2.31],["c",.15,-.69,.78,-1.29,1.47,-1.44],["z"]],w:19.744,h:11.274},"scripts.sforzato":{d:[["M",-6.45,-3.69],["c",.06,-.03,.15,-.06,.18,-.06],["c",.06,0,2.85,.72,6.24,1.59],["l",6.33,1.65],["c",.33,.06,.45,.21,.45,.51],["c",0,.3,-.12,.45,-.45,.51],["l",-6.33,1.65],["c",-3.39,.87,-6.18,1.59,-6.21,1.59],["c",-.21,0,-.48,-.24,-.51,-.45],["c",0,-.15,.06,-.36,.18,-.45],["c",.09,-.06,.87,-.27,3.84,-1.05],["c",2.04,-.54,3.84,-.99,4.02,-1.02],["c",.15,-.06,1.14,-.24,2.22,-.42],["c",1.05,-.18,1.92,-.36,1.92,-.36],["c",0,0,-.87,-.18,-1.92,-.36],["c",-1.08,-.18,-2.07,-.36,-2.22,-.42],["c",-.18,-.03,-1.98,-.48,-4.02,-1.02],["c",-2.97,-.78,-3.75,-.99,-3.84,-1.05],["c",-.12,-.09,-.18,-.3,-.18,-.45],["c",.03,-.15,.15,-.3,.3,-.39],["z"]],w:13.5,h:7.5},"scripts.staccato":{d:[["M",-.36,-1.47],["c",.93,-.21,1.86,.51,1.86,1.47],["c",0,.93,-.87,1.65,-1.8,1.47],["c",-.54,-.12,-1.02,-.57,-1.14,-1.08],["c",-.21,-.81,.27,-1.65,1.08,-1.86],["z"]],w:2.989,h:3.004},"scripts.tenuto":{d:[["M",-4.2,-.48],["l",.12,-.06],["l",4.08,0],["l",4.08,0],["l",.12,.06],["c",.39,.21,.39,.75,0,.96],["l",-.12,.06],["l",-4.08,0],["l",-4.08,0],["l",-.12,-.06],["c",-.39,-.21,-.39,-.75,0,-.96],["z"]],w:8.985,h:1.08},"scripts.umarcato":{d:[["M",-.15,-8.19],["c",.15,-.12,.36,-.03,.45,.15],["c",.21,.42,3.45,7.65,3.45,7.71],["c",0,.12,-.12,.27,-.21,.3],["c",-.03,.03,-.51,.03,-1.14,.03],["c",-1.05,0,-1.08,0,-1.17,-.06],["c",-.09,-.06,-.24,-.36,-1.17,-2.4],["c",-.57,-1.29,-1.05,-2.34,-1.08,-2.34],["c",0,-.03,-.51,1.02,-1.08,2.34],["c",-.93,2.07,-1.08,2.34,-1.14,2.4],["c",-.06,.03,-.15,.06,-.18,.06],["c",-.15,0,-.33,-.18,-.33,-.33],["c",0,-.06,3.24,-7.32,3.45,-7.71],["c",.03,-.06,.09,-.15,.15,-.15],["z"]],w:7.5,h:8.245},"scripts.dmarcato":{d:[["M",-3.57,.03],["c",.03,0,.57,-.03,1.17,-.03],["c",1.05,0,1.08,0,1.17,.06],["c",.09,.06,.24,.36,1.17,2.4],["c",.57,1.29,1.05,2.34,1.08,2.34],["c",0,.03,.51,-1.02,1.08,-2.34],["c",.93,-2.07,1.08,-2.34,1.14,-2.4],["c",.06,-.03,.15,-.06,.18,-.06],["c",.15,0,.33,.18,.33,.33],["c",0,.09,-3.45,7.74,-3.54,7.83],["c",-.12,.12,-.3,.12,-.42,0],["c",-.09,-.09,-3.54,-7.74,-3.54,-7.83],["c",0,-.09,.12,-.27,.18,-.3],["z"]],w:7.5,h:8.25},"scripts.stopped":{d:[["M",-.27,-4.08],["c",.18,-.09,.36,-.09,.54,0],["c",.18,.09,.24,.15,.33,.3],["l",.06,.15],["l",0,1.5],["l",0,1.47],["l",1.47,0],["l",1.5,0],["l",.15,.06],["c",.15,.09,.21,.15,.3,.33],["c",.09,.18,.09,.36,0,.54],["c",-.09,.18,-.15,.24,-.33,.33],["c",-.12,.06,-.18,.06,-1.62,.06],["l",-1.47,0],["l",0,1.47],["l",0,1.47],["l",-.06,.15],["c",-.09,.18,-.15,.24,-.33,.33],["c",-.18,.09,-.36,.09,-.54,0],["c",-.18,-.09,-.24,-.15,-.33,-.33],["l",-.06,-.15],["l",0,-1.47],["l",0,-1.47],["l",-1.47,0],["c",-1.44,0,-1.5,0,-1.62,-.06],["c",-.18,-.09,-.24,-.15,-.33,-.33],["c",-.09,-.18,-.09,-.36,0,-.54],["c",.09,-.18,.15,-.24,.33,-.33],["l",.15,-.06],["l",1.47,0],["l",1.47,0],["l",0,-1.47],["c",0,-1.44,0,-1.5,.06,-1.62],["c",.09,-.18,.15,-.24,.33,-.33],["z"]],w:8.295,h:8.295},"scripts.upbow":{d:[["M",-4.65,-15.54],["c",.12,-.09,.36,-.06,.48,.03],["c",.03,.03,.09,.09,.12,.15],["c",.03,.06,.66,2.13,1.41,4.62],["c",1.35,4.41,1.38,4.56,2.01,6.96],["l",.63,2.46],["l",.63,-2.46],["c",.63,-2.4,.66,-2.55,2.01,-6.96],["c",.75,-2.49,1.38,-4.56,1.41,-4.62],["c",.06,-.15,.18,-.21,.36,-.24],["c",.15,0,.3,.06,.39,.18],["c",.15,.21,.24,-.18,-2.1,7.56],["c",-1.2,3.96,-2.22,7.32,-2.25,7.41],["c",0,.12,-.06,.27,-.09,.3],["c",-.12,.21,-.6,.21,-.72,0],["c",-.03,-.03,-.09,-.18,-.09,-.3],["c",-.03,-.09,-1.05,-3.45,-2.25,-7.41],["c",-2.34,-7.74,-2.25,-7.35,-2.1,-7.56],["c",.03,-.03,.09,-.09,.15,-.12],["z"]],w:9.73,h:15.608},"scripts.downbow":{d:[["M",-5.55,-9.93],["l",.09,-.06],["l",5.46,0],["l",5.46,0],["l",.09,.06],["l",.06,.09],["l",0,4.77],["c",0,5.28,0,4.89,-.18,5.01],["c",-.18,.12,-.42,.06,-.54,-.12],["c",-.06,-.09,-.06,-.18,-.06,-2.97],["l",0,-2.85],["l",-4.83,0],["l",-4.83,0],["l",0,2.85],["c",0,2.79,0,2.88,-.06,2.97],["c",-.15,.24,-.51,.24,-.66,0],["c",-.06,-.09,-.06,-.21,-.06,-4.89],["l",0,-4.77],["z"]],w:11.22,h:9.992},"scripts.turn":{d:[["M",-4.77,-3.9],["c",.36,-.06,1.05,-.06,1.44,.03],["c",.78,.15,1.5,.51,2.34,1.14],["c",.6,.45,1.05,.87,2.22,2.01],["c",1.11,1.08,1.62,1.5,2.22,1.86],["c",.6,.36,1.32,.57,1.92,.57],["c",.9,0,1.71,-.57,1.89,-1.35],["c",.24,-.93,-.39,-1.89,-1.35,-2.1],["l",-.15,-.06],["l",-.09,.15],["c",-.03,.09,-.15,.24,-.24,.33],["c",-.72,.72,-2.04,.54,-2.49,-.36],["c",-.48,-.93,.03,-1.86,1.17,-2.19],["c",.3,-.09,1.02,-.09,1.35,0],["c",.99,.27,1.74,.87,2.25,1.83],["c",.69,1.41,.63,3,-.21,4.26],["c",-.21,.3,-.69,.81,-.99,1.02],["c",-.3,.21,-.84,.45,-1.17,.54],["c",-1.23,.36,-2.49,.15,-3.72,-.6],["c",-.75,-.48,-1.41,-1.02,-2.85,-2.46],["c",-1.11,-1.08,-1.62,-1.5,-2.22,-1.86],["c",-.6,-.36,-1.32,-.57,-1.92,-.57],["c",-.9,0,-1.71,.57,-1.89,1.35],["c",-.24,.93,.39,1.89,1.35,2.1],["l",.15,.06],["l",.09,-.15],["c",.03,-.09,.15,-.24,.24,-.33],["c",.72,-.72,2.04,-.54,2.49,.36],["c",.48,.93,-.03,1.86,-1.17,2.19],["c",-.3,.09,-1.02,.09,-1.35,0],["c",-.99,-.27,-1.74,-.87,-2.25,-1.83],["c",-.69,-1.41,-.63,-3,.21,-4.26],["c",.21,-.3,.69,-.81,.99,-1.02],["c",.48,-.33,1.11,-.57,1.74,-.66],["z"]],w:16.366,h:7.893},"scripts.trill":{d:[["M",-.51,-16.02],["c",.12,-.09,.21,-.18,.21,-.18],["l",-.81,4.02],["l",-.81,4.02],["c",.03,0,.51,-.27,1.08,-.6],["c",.6,-.3,1.14,-.63,1.26,-.66],["c",1.14,-.54,2.31,-.6,3.09,-.18],["c",.27,.15,.54,.36,.6,.51],["l",.06,.12],["l",.21,-.21],["c",.9,-.81,2.22,-.99,3.12,-.42],["c",.6,.42,.9,1.14,.78,2.07],["c",-.15,1.29,-1.05,2.31,-1.95,2.25],["c",-.48,-.03,-.78,-.3,-.96,-.81],["c",-.09,-.27,-.09,-.9,-.03,-1.2],["c",.21,-.75,.81,-1.23,1.59,-1.32],["l",.24,-.03],["l",-.09,-.12],["c",-.51,-.66,-1.62,-.63,-2.31,.03],["c",-.39,.42,-.3,.09,-1.23,4.77],["l",-.81,4.14],["c",-.03,0,-.12,-.03,-.21,-.09],["c",-.33,-.15,-.54,-.18,-.99,-.18],["c",-.42,0,-.66,.03,-1.05,.18],["c",-.12,.06,-.21,.09,-.21,.09],["c",0,-.03,.36,-1.86,.81,-4.11],["c",.9,-4.47,.87,-4.26,.69,-4.53],["c",-.21,-.36,-.66,-.51,-1.17,-.36],["c",-.15,.06,-2.22,1.14,-2.58,1.38],["c",-.12,.09,-.12,.09,-.21,.6],["l",-.09,.51],["l",.21,.24],["c",.63,.75,1.02,1.47,1.2,2.19],["c",.06,.27,.06,.36,.06,.81],["c",0,.42,0,.54,-.06,.78],["c",-.15,.54,-.33,.93,-.63,1.35],["c",-.18,.24,-.57,.63,-.81,.78],["c",-.24,.15,-.63,.36,-.84,.42],["c",-.27,.06,-.66,.06,-.87,.03],["c",-.81,-.18,-1.32,-1.05,-1.38,-2.46],["c",-.03,-.6,.03,-.99,.33,-2.46],["c",.21,-1.08,.24,-1.32,.21,-1.29],["c",-1.2,.48,-2.4,.75,-3.21,.72],["c",-.69,-.06,-1.17,-.3,-1.41,-.72],["c",-.39,-.75,-.12,-1.8,.66,-2.46],["c",.24,-.18,.69,-.42,1.02,-.51],["c",.69,-.18,1.53,-.15,2.31,.09],["c",.3,.09,.75,.3,.99,.45],["c",.12,.09,.15,.09,.15,.03],["c",.03,-.03,.33,-1.59,.72,-3.45],["c",.36,-1.86,.66,-3.42,.69,-3.45],["c",0,-.03,.03,-.03,.21,.03],["c",.21,.06,.27,.06,.48,.06],["c",.42,-.03,.78,-.18,1.26,-.48],["c",.15,-.12,.36,-.27,.48,-.39],["z"],["m",-5.73,7.68],["c",-.27,-.03,-.96,-.06,-1.2,-.03],["c",-.81,.12,-1.35,.57,-1.5,1.2],["c",-.18,.66,.12,1.14,.75,1.29],["c",.66,.12,1.92,-.12,3.18,-.66],["l",.33,-.15],["l",.09,-.39],["c",.06,-.21,.09,-.42,.09,-.45],["c",0,-.03,-.45,-.3,-.75,-.45],["c",-.27,-.15,-.66,-.27,-.99,-.36],["z"],["m",4.29,3.63],["c",-.24,-.39,-.51,-.75,-.51,-.69],["c",-.06,.12,-.39,1.92,-.45,2.28],["c",-.09,.54,-.12,1.14,-.06,1.38],["c",.06,.42,.21,.6,.51,.57],["c",.39,-.06,.75,-.48,.93,-1.14],["c",.09,-.33,.09,-1.05,0,-1.38],["c",-.09,-.39,-.24,-.69,-.42,-1.02],["z"]],w:17.963,h:16.49},"scripts.segno":{d:[["M",-3.72,-11.22],["c",.78,-.09,1.59,.03,2.31,.42],["c",1.2,.6,2.01,1.71,2.31,3.09],["c",.09,.42,.09,1.2,.03,1.5],["c",-.15,.45,-.39,.81,-.66,.93],["c",-.33,.18,-.84,.21,-1.23,.15],["c",-.81,-.18,-1.32,-.93,-1.26,-1.89],["c",.03,-.36,.09,-.57,.24,-.9],["c",.15,-.33,.45,-.6,.72,-.75],["c",.12,-.06,.18,-.09,.18,-.12],["c",0,-.03,-.03,-.15,-.09,-.24],["c",-.18,-.45,-.54,-.87,-.96,-1.08],["c",-1.11,-.57,-2.34,-.18,-2.88,.9],["c",-.24,.51,-.33,1.11,-.24,1.83],["c",.27,1.92,1.5,3.54,3.93,5.13],["c",.48,.33,1.26,.78,1.29,.78],["c",.03,0,1.35,-2.19,2.94,-4.89],["l",2.88,-4.89],["l",.84,0],["l",.87,0],["l",-.03,.06],["c",-.15,.21,-6.15,10.41,-6.15,10.44],["c",0,0,.21,.15,.48,.27],["c",2.61,1.47,4.35,3.03,5.13,4.65],["c",1.14,2.34,.51,5.07,-1.44,6.39],["c",-.66,.42,-1.32,.63,-2.13,.69],["c",-2.01,.09,-3.81,-1.41,-4.26,-3.54],["c",-.09,-.42,-.09,-1.2,-.03,-1.5],["c",.15,-.45,.39,-.81,.66,-.93],["c",.33,-.18,.84,-.21,1.23,-.15],["c",.81,.18,1.32,.93,1.26,1.89],["c",-.03,.36,-.09,.57,-.24,.9],["c",-.15,.33,-.45,.6,-.72,.75],["c",-.12,.06,-.18,.09,-.18,.12],["c",0,.03,.03,.15,.09,.24],["c",.18,.45,.54,.87,.96,1.08],["c",1.11,.57,2.34,.18,2.88,-.9],["c",.24,-.51,.33,-1.11,.24,-1.83],["c",-.27,-1.92,-1.5,-3.54,-3.93,-5.13],["c",-.48,-.33,-1.26,-.78,-1.29,-.78],["c",-.03,0,-1.35,2.19,-2.91,4.89],["l",-2.88,4.89],["l",-.87,0],["l",-.87,0],["l",.03,-.06],["c",.15,-.21,6.15,-10.41,6.15,-10.44],["c",0,0,-.21,-.15,-.48,-.3],["c",-2.61,-1.44,-4.35,-3,-5.13,-4.62],["c",-.9,-1.89,-.72,-4.02,.48,-5.52],["c",.69,-.84,1.68,-1.41,2.73,-1.53],["z"],["m",8.76,9.09],["c",.03,-.03,.15,-.03,.27,-.03],["c",.33,.03,.57,.18,.72,.48],["c",.09,.18,.09,.57,0,.75],["c",-.09,.18,-.21,.3,-.36,.39],["c",-.15,.06,-.21,.06,-.39,.06],["c",-.21,0,-.27,0,-.39,-.06],["c",-.3,-.15,-.48,-.45,-.48,-.75],["c",0,-.39,.24,-.72,.63,-.84],["z"],["m",-10.53,2.61],["c",.03,-.03,.15,-.03,.27,-.03],["c",.33,.03,.57,.18,.72,.48],["c",.09,.18,.09,.57,0,.75],["c",-.09,.18,-.21,.3,-.36,.39],["c",-.15,.06,-.21,.06,-.39,.06],["c",-.21,0,-.27,0,-.39,-.06],["c",-.3,-.15,-.48,-.45,-.48,-.75],["c",0,-.39,.24,-.72,.63,-.84],["z"]],w:15,h:22.504},"scripts.coda":{d:[["M",-.21,-10.47],["c",.18,-.12,.42,-.06,.54,.12],["c",.06,.09,.06,.18,.06,1.5],["l",0,1.38],["l",.18,0],["c",.39,.06,.96,.24,1.38,.48],["c",1.68,.93,2.82,3.24,3.03,6.12],["c",.03,.24,.03,.45,.03,.45],["c",0,.03,.6,.03,1.35,.03],["c",1.5,0,1.47,0,1.59,.18],["c",.09,.12,.09,.3,0,.42],["c",-.12,.18,-.09,.18,-1.59,.18],["c",-.75,0,-1.35,0,-1.35,.03],["c",0,0,0,.21,-.03,.42],["c",-.24,3.15,-1.53,5.58,-3.45,6.36],["c",-.27,.12,-.72,.24,-.96,.27],["l",-.18,0],["l",0,1.38],["c",0,1.32,0,1.41,-.06,1.5],["c",-.15,.24,-.51,.24,-.66,0],["c",-.06,-.09,-.06,-.18,-.06,-1.5],["l",0,-1.38],["l",-.18,0],["c",-.39,-.06,-.96,-.24,-1.38,-.48],["c",-1.68,-.93,-2.82,-3.24,-3.03,-6.15],["c",-.03,-.21,-.03,-.42,-.03,-.42],["c",0,-.03,-.6,-.03,-1.35,-.03],["c",-1.5,0,-1.47,0,-1.59,-.18],["c",-.09,-.12,-.09,-.3,0,-.42],["c",.12,-.18,.09,-.18,1.59,-.18],["c",.75,0,1.35,0,1.35,-.03],["c",0,0,0,-.21,.03,-.45],["c",.24,-3.12,1.53,-5.55,3.45,-6.33],["c",.27,-.12,.72,-.24,.96,-.27],["l",.18,0],["l",0,-1.38],["c",0,-1.53,0,-1.5,.18,-1.62],["z"],["m",-.18,6.93],["c",0,-2.97,0,-3.15,-.06,-3.15],["c",-.09,0,-.51,.15,-.66,.21],["c",-.87,.51,-1.38,1.62,-1.56,3.51],["c",-.06,.54,-.12,1.59,-.12,2.16],["l",0,.42],["l",1.2,0],["l",1.2,0],["l",0,-3.15],["z"],["m",1.17,-3.06],["c",-.09,-.03,-.21,-.06,-.27,-.09],["l",-.12,0],["l",0,3.15],["l",0,3.15],["l",1.2,0],["l",1.2,0],["l",0,-.81],["c",-.06,-2.4,-.33,-3.69,-.93,-4.59],["c",-.27,-.39,-.66,-.69,-1.08,-.81],["z"],["m",-1.17,10.14],["l",0,-3.15],["l",-1.2,0],["l",-1.2,0],["l",0,.81],["c",.03,.96,.06,1.47,.15,2.13],["c",.24,2.04,.96,3.12,2.13,3.36],["l",.12,0],["l",0,-3.15],["z"],["m",3.18,-2.34],["l",0,-.81],["l",-1.2,0],["l",-1.2,0],["l",0,3.15],["l",0,3.15],["l",.12,0],["c",1.17,-.24,1.89,-1.32,2.13,-3.36],["c",.09,-.66,.12,-1.17,.15,-2.13],["z"]],w:16.035,h:21.062},"scripts.comma":{d:[["M",1.14,-4.62],["c",.3,-.12,.69,-.03,.93,.15],["c",.12,.12,.36,.45,.51,.78],["c",.9,1.77,.54,4.05,-1.08,6.75],["c",-.36,.63,-.87,1.38,-.96,1.44],["c",-.18,.12,-.42,.06,-.54,-.12],["c",-.09,-.18,-.09,-.3,.12,-.6],["c",.96,-1.44,1.44,-2.97,1.38,-4.35],["c",-.06,-.93,-.3,-1.68,-.78,-2.46],["c",-.27,-.39,-.33,-.63,-.24,-.96],["c",.09,-.27,.36,-.54,.66,-.63],["z"]],w:3.042,h:9.237},"scripts.roll":{d:[["M",1.95,-6],["c",.21,-.09,.36,-.09,.57,0],["c",.39,.15,.63,.39,1.47,1.35],["c",.66,.75,.78,.87,1.08,1.05],["c",.75,.45,1.65,.42,2.4,-.06],["c",.12,-.09,.27,-.27,.54,-.6],["c",.42,-.54,.51,-.63,.69,-.63],["c",.09,0,.3,.12,.36,.21],["c",.09,.12,.12,.3,.03,.42],["c",-.06,.12,-3.15,3.9,-3.3,4.08],["c",-.06,.06,-.18,.12,-.27,.18],["c",-.27,.12,-.6,.06,-.99,-.27],["c",-.27,-.21,-.42,-.39,-1.08,-1.14],["c",-.63,-.72,-.81,-.9,-1.17,-1.08],["c",-.36,-.18,-.57,-.21,-.99,-.21],["c",-.39,0,-.63,.03,-.93,.18],["c",-.36,.15,-.51,.27,-.9,.81],["c",-.24,.27,-.45,.51,-.48,.54],["c",-.12,.09,-.27,.06,-.39,0],["c",-.24,-.15,-.33,-.39,-.21,-.6],["c",.09,-.12,3.18,-3.87,3.33,-4.02],["c",.06,-.06,.18,-.15,.24,-.21],["z"]],w:10.817,h:6.125},"scripts.prall":{d:[["M",-4.38,-3.69],["c",.06,-.03,.18,-.06,.24,-.06],["c",.3,0,.27,-.03,1.89,1.95],["l",1.53,1.83],["c",.03,0,.57,-.84,1.23,-1.83],["c",1.14,-1.68,1.23,-1.83,1.35,-1.89],["c",.06,-.03,.18,-.06,.24,-.06],["c",.3,0,.27,-.03,1.89,1.95],["l",1.53,1.83],["l",.48,-.69],["c",.51,-.78,.54,-.84,.69,-.9],["c",.42,-.18,.87,.15,.81,.6],["c",-.03,.12,-.3,.51,-1.5,2.37],["c",-1.38,2.07,-1.5,2.22,-1.62,2.28],["c",-.06,.03,-.18,.06,-.24,.06],["c",-.3,0,-.27,.03,-1.89,-1.95],["l",-1.53,-1.83],["c",-.03,0,-.57,.84,-1.23,1.83],["c",-1.14,1.68,-1.23,1.83,-1.35,1.89],["c",-.06,.03,-.18,.06,-.24,.06],["c",-.3,0,-.27,.03,-1.89,-1.95],["l",-1.53,-1.83],["l",-.48,.69],["c",-.51,.78,-.54,.84,-.69,.9],["c",-.42,.18,-.87,-.15,-.81,-.6],["c",.03,-.12,.3,-.51,1.5,-2.37],["c",1.38,-2.07,1.5,-2.22,1.62,-2.28],["z"]],w:15.011,h:7.5},"scripts.arpeggio":{d:[["M",1.5,0],["c",1.5,2,1.5,3,1.5,3],["s",0,1,-2,1.5],["s",-.5,3,1,5.5],["l",1.5,0],["s",-1.75,-2,-1.9,-3.25],["s",2.15,-.6,2.95,-1.6],["s",.45,-1,.5,-1.25],["s",0,-1,-2,-3.9],["l",-1.5,0],["z"]],w:5,h:10},"scripts.mordent":{d:[["M",-.21,-4.95],["c",.27,-.15,.63,0,.75,.27],["c",.06,.12,.06,.24,.06,1.44],["l",0,1.29],["l",.57,-.84],["c",.51,-.75,.57,-.84,.69,-.9],["c",.06,-.03,.18,-.06,.24,-.06],["c",.3,0,.27,-.03,1.89,1.95],["l",1.53,1.83],["l",.48,-.69],["c",.51,-.78,.54,-.84,.69,-.9],["c",.42,-.18,.87,.15,.81,.6],["c",-.03,.12,-.3,.51,-1.5,2.37],["c",-1.38,2.07,-1.5,2.22,-1.62,2.28],["c",-.06,.03,-.18,.06,-.24,.06],["c",-.3,0,-.27,.03,-1.83,-1.89],["c",-.81,-.99,-1.5,-1.8,-1.53,-1.86],["c",-.06,-.03,-.06,-.03,-.12,.03],["c",-.06,.06,-.06,.15,-.06,2.28],["c",0,1.95,0,2.25,-.06,2.34],["c",-.18,.45,-.81,.48,-1.05,.03],["c",-.03,-.06,-.06,-.24,-.06,-1.41],["l",0,-1.35],["l",-.57,.84],["c",-.54,.78,-.6,.87,-.72,.93],["c",-.06,.03,-.18,.06,-.24,.06],["c",-.3,0,-.27,.03,-1.89,-1.95],["l",-1.53,-1.83],["l",-.48,.69],["c",-.51,.78,-.54,.84,-.69,.9],["c",-.42,.18,-.87,-.15,-.81,-.6],["c",.03,-.12,.3,-.51,1.5,-2.37],["c",1.38,-2.07,1.5,-2.22,1.62,-2.28],["c",.06,-.03,.18,-.06,.24,-.06],["c",.3,0,.27,-.03,1.89,1.95],["l",1.53,1.83],["c",.03,0,.06,-.06,.09,-.09],["c",.06,-.12,.06,-.15,.06,-2.28],["c",0,-1.92,0,-2.22,.06,-2.31],["c",.06,-.15,.15,-.24,.3,-.3],["z"]],w:15.011,h:10.012},"flags.u8th":{d:[["M",-.42,3.75],["l",0,-3.75],["l",.21,0],["l",.21,0],["l",0,.18],["c",0,.3,.06,.84,.12,1.23],["c",.24,1.53,.9,3.12,2.13,5.16],["l",.99,1.59],["c",.87,1.44,1.38,2.34,1.77,3.09],["c",.81,1.68,1.2,3.06,1.26,4.53],["c",.03,1.53,-.21,3.27,-.75,5.01],["c",-.21,.69,-.51,1.5,-.6,1.59],["c",-.09,.12,-.27,.21,-.42,.21],["c",-.15,0,-.42,-.12,-.51,-.21],["c",-.15,-.18,-.18,-.42,-.09,-.66],["c",.15,-.33,.45,-1.2,.57,-1.62],["c",.42,-1.38,.6,-2.58,.6,-3.9],["c",0,-.66,0,-.81,-.06,-1.11],["c",-.39,-2.07,-1.8,-4.26,-4.59,-7.14],["l",-.42,-.45],["l",-.21,0],["l",-.21,0],["l",0,-3.75],["z"]],w:6.692,h:22.59},"flags.u16th":{d:[["M",-.42,7.5],["l",0,-7.5],["l",.21,0],["l",.21,0],["l",0,.39],["c",.06,1.08,.39,2.19,.99,3.39],["c",.45,.9,.87,1.59,1.95,3.12],["c",1.29,1.86,1.77,2.64,2.22,3.57],["c",.45,.93,.72,1.8,.87,2.64],["c",.06,.51,.06,1.5,0,1.92],["c",-.12,.6,-.3,1.2,-.54,1.71],["l",-.09,.24],["l",.18,.45],["c",.51,1.2,.72,2.22,.69,3.42],["c",-.06,1.53,-.39,3.03,-.99,4.53],["c",-.3,.75,-.36,.81,-.57,.9],["c",-.15,.09,-.33,.06,-.48,0],["c",-.18,-.09,-.27,-.18,-.33,-.33],["c",-.09,-.18,-.06,-.3,.12,-.75],["c",.66,-1.41,1.02,-2.88,1.08,-4.32],["c",0,-.6,-.03,-1.05,-.18,-1.59],["c",-.3,-1.2,-.99,-2.4,-2.25,-3.87],["c",-.42,-.48,-1.53,-1.62,-2.19,-2.22],["l",-.45,-.42],["l",-.03,1.11],["l",0,1.11],["l",-.21,0],["l",-.21,0],["l",0,-7.5],["z"],["m",1.65,.09],["c",-.3,-.3,-.69,-.72,-.9,-.87],["l",-.33,-.33],["l",0,.15],["c",0,.3,.06,.81,.15,1.26],["c",.27,1.29,.87,2.61,2.04,4.29],["c",.15,.24,.6,.87,.96,1.38],["l",1.08,1.53],["l",.42,.63],["c",.03,0,.12,-.36,.21,-.72],["c",.06,-.33,.06,-1.2,0,-1.62],["c",-.33,-1.71,-1.44,-3.48,-3.63,-5.7],["z"]],w:6.693,h:26.337},"flags.u32nd":{d:[["M",-.42,11.25],["l",0,-11.25],["l",.21,0],["l",.21,0],["l",0,.36],["c",.09,1.68,.69,3.27,2.07,5.46],["l",.87,1.35],["c",1.02,1.62,1.47,2.37,1.86,3.18],["c",.48,1.02,.78,1.92,.93,2.88],["c",.06,.48,.06,1.5,0,1.89],["c",-.09,.42,-.21,.87,-.36,1.26],["l",-.12,.3],["l",.15,.39],["c",.69,1.56,.84,2.88,.54,4.38],["c",-.09,.45,-.27,1.08,-.45,1.47],["l",-.12,.24],["l",.18,.36],["c",.33,.72,.57,1.56,.69,2.34],["c",.12,1.02,-.06,2.52,-.42,3.84],["c",-.27,.93,-.75,2.13,-.93,2.31],["c",-.18,.15,-.45,.18,-.66,.09],["c",-.18,-.09,-.27,-.18,-.33,-.33],["c",-.09,-.18,-.06,-.3,.06,-.6],["c",.21,-.36,.42,-.9,.57,-1.38],["c",.51,-1.41,.69,-3.06,.48,-4.08],["c",-.15,-.81,-.57,-1.68,-1.2,-2.55],["c",-.72,-.99,-1.83,-2.13,-3.3,-3.33],["l",-.48,-.42],["l",-.03,1.53],["l",0,1.56],["l",-.21,0],["l",-.21,0],["l",0,-11.25],["z"],["m",1.26,-3.96],["c",-.27,-.3,-.54,-.6,-.66,-.72],["l",-.18,-.21],["l",0,.42],["c",.06,.87,.24,1.74,.66,2.67],["c",.36,.87,.96,1.86,1.92,3.18],["c",.21,.33,.63,.87,.87,1.23],["c",.27,.39,.6,.84,.75,1.08],["l",.27,.39],["l",.03,-.12],["c",.12,-.45,.15,-1.05,.09,-1.59],["c",-.27,-1.86,-1.38,-3.78,-3.75,-6.33],["z"],["m",-.27,6.09],["c",-.27,-.21,-.48,-.42,-.51,-.45],["c",-.06,-.03,-.06,-.03,-.06,.21],["c",0,.9,.3,2.04,.81,3.09],["c",.48,1.02,.96,1.77,2.37,3.63],["c",.6,.78,1.05,1.44,1.29,1.77],["c",.06,.12,.15,.21,.15,.18],["c",.03,-.03,.18,-.57,.24,-.87],["c",.06,-.45,.06,-1.32,-.03,-1.74],["c",-.09,-.48,-.24,-.9,-.51,-1.44],["c",-.66,-1.35,-1.83,-2.7,-3.75,-4.38],["z"]],w:6.697,h:32.145},"flags.u64th":{d:[["M",-.42,15],["l",0,-15],["l",.21,0],["l",.21,0],["l",0,.36],["c",.06,1.2,.39,2.37,1.02,3.66],["c",.39,.81,.84,1.56,1.8,3.09],["c",.81,1.26,1.05,1.68,1.35,2.22],["c",.87,1.5,1.35,2.79,1.56,4.08],["c",.06,.54,.06,1.56,-.03,2.04],["c",-.09,.48,-.21,.99,-.36,1.35],["l",-.12,.27],["l",.12,.27],["c",.09,.15,.21,.45,.27,.66],["c",.69,1.89,.63,3.66,-.18,5.46],["l",-.18,.39],["l",.15,.33],["c",.3,.66,.51,1.44,.63,2.1],["c",.06,.48,.06,1.35,0,1.71],["c",-.15,.57,-.42,1.2,-.78,1.68],["l",-.21,.27],["l",.18,.33],["c",.57,1.05,.93,2.13,1.02,3.18],["c",.06,.72,0,1.83,-.21,2.79],["c",-.18,1.02,-.63,2.34,-1.02,3.09],["c",-.15,.33,-.48,.45,-.78,.3],["c",-.18,-.09,-.27,-.18,-.33,-.33],["c",-.09,-.18,-.06,-.3,.03,-.54],["c",.75,-1.5,1.23,-3.45,1.17,-4.89],["c",-.06,-1.02,-.42,-2.01,-1.17,-3.15],["c",-.48,-.72,-1.02,-1.35,-1.89,-2.22],["c",-.57,-.57,-1.56,-1.5,-1.92,-1.77],["l",-.12,-.09],["l",0,1.68],["l",0,1.68],["l",-.21,0],["l",-.21,0],["l",0,-15],["z"],["m",.93,-8.07],["c",-.27,-.3,-.48,-.54,-.51,-.54],["c",0,0,0,.69,.03,1.02],["c",.15,1.47,.75,2.94,2.04,4.83],["l",1.08,1.53],["c",.39,.57,.84,1.2,.99,1.44],["c",.15,.24,.3,.45,.3,.45],["c",0,0,.03,-.09,.06,-.21],["c",.36,-1.59,-.15,-3.33,-1.47,-5.4],["c",-.63,-.93,-1.35,-1.83,-2.52,-3.12],["z"],["m",.06,6.72],["c",-.24,-.21,-.48,-.42,-.51,-.45],["l",-.06,-.06],["l",0,.33],["c",0,1.2,.3,2.34,.93,3.6],["c",.45,.9,.96,1.68,2.25,3.51],["c",.39,.54,.84,1.17,1.02,1.44],["c",.21,.33,.33,.51,.33,.48],["c",.06,-.09,.21,-.63,.3,-.99],["c",.06,-.33,.06,-.45,.06,-.96],["c",0,-.6,-.03,-.84,-.18,-1.35],["c",-.3,-1.08,-1.02,-2.28,-2.13,-3.57],["c",-.39,-.45,-1.44,-1.47,-2.01,-1.98],["z"],["m",0,6.72],["c",-.24,-.21,-.48,-.39,-.51,-.42],["l",-.06,-.06],["l",0,.33],["c",0,1.41,.45,2.82,1.38,4.35],["c",.42,.72,.72,1.14,1.86,2.73],["c",.36,.45,.75,.99,.87,1.2],["c",.15,.21,.3,.36,.3,.36],["c",.06,0,.3,-.48,.39,-.75],["c",.09,-.36,.12,-.63,.12,-1.05],["c",-.06,-1.05,-.45,-2.04,-1.2,-3.18],["c",-.57,-.87,-1.11,-1.53,-2.07,-2.49],["c",-.36,-.33,-.84,-.78,-1.08,-1.02],["z"]],w:6.682,h:39.694},"flags.d8th":{d:[["M",5.67,-21.63],["c",.24,-.12,.54,-.06,.69,.15],["c",.06,.06,.21,.36,.39,.66],["c",.84,1.77,1.26,3.36,1.32,5.1],["c",.03,1.29,-.21,2.37,-.81,3.63],["c",-.6,1.23,-1.26,2.13,-3.21,4.38],["c",-1.35,1.53,-1.86,2.19,-2.4,2.97],["c",-.63,.93,-1.11,1.92,-1.38,2.79],["c",-.15,.54,-.27,1.35,-.27,1.8],["l",0,.15],["l",-.21,0],["l",-.21,0],["l",0,-3.75],["l",0,-3.75],["l",.21,0],["l",.21,0],["l",.48,-.3],["c",1.83,-1.11,3.12,-2.1,4.17,-3.12],["c",.78,-.81,1.32,-1.53,1.71,-2.31],["c",.45,-.93,.6,-1.74,.51,-2.88],["c",-.12,-1.56,-.63,-3.18,-1.47,-4.68],["c",-.12,-.21,-.15,-.33,-.06,-.51],["c",.06,-.15,.15,-.24,.33,-.33],["z"]],w:8.492,h:21.691},"flags.ugrace":{d:[["M",6.03,6.93],["c",.15,-.09,.33,-.06,.51,0],["c",.15,.09,.21,.15,.3,.33],["c",.09,.18,.06,.39,-.03,.54],["c",-.06,.15,-10.89,8.88,-11.07,8.97],["c",-.15,.09,-.33,.06,-.48,0],["c",-.18,-.09,-.24,-.15,-.33,-.33],["c",-.09,-.18,-.06,-.39,.03,-.54],["c",.06,-.15,10.89,-8.88,11.07,-8.97],["z"]],w:12.019,h:9.954},"flags.dgrace":{d:[["M",-6.06,-15.93],["c",.18,-.09,.33,-.12,.48,-.06],["c",.18,.09,14.01,8.04,14.1,8.1],["c",.12,.12,.18,.33,.18,.51],["c",-.03,.21,-.15,.39,-.36,.48],["c",-.18,.09,-.33,.12,-.48,.06],["c",-.18,-.09,-14.01,-8.04,-14.1,-8.1],["c",-.12,-.12,-.18,-.33,-.18,-.51],["c",.03,-.21,.15,-.39,.36,-.48],["z"]],w:15.12,h:9.212},"flags.d16th":{d:[["M",6.84,-22.53],["c",.27,-.12,.57,-.06,.72,.15],["c",.15,.15,.33,.87,.45,1.56],["c",.06,.33,.06,1.35,0,1.65],["c",-.06,.33,-.15,.78,-.27,1.11],["c",-.12,.33,-.45,.96,-.66,1.32],["l",-.18,.27],["l",.09,.18],["c",.48,1.02,.72,2.25,.69,3.3],["c",-.06,1.23,-.42,2.28,-1.26,3.45],["c",-.57,.87,-.99,1.32,-3,3.39],["c",-1.56,1.56,-2.22,2.4,-2.76,3.45],["c",-.42,.84,-.66,1.8,-.66,2.55],["l",0,.15],["l",-.21,0],["l",-.21,0],["l",0,-7.5],["l",0,-7.5],["l",.21,0],["l",.21,0],["l",0,1.14],["l",0,1.11],["l",.27,-.15],["c",1.11,-.57,1.77,-.99,2.52,-1.47],["c",2.37,-1.56,3.69,-3.15,4.05,-4.83],["c",.03,-.18,.03,-.39,.03,-.78],["c",0,-.6,-.03,-.93,-.24,-1.5],["c",-.06,-.18,-.12,-.39,-.15,-.45],["c",-.03,-.24,.12,-.48,.36,-.6],["z"],["m",-.63,7.5],["c",-.06,-.18,-.15,-.36,-.15,-.36],["c",-.03,0,-.03,.03,-.06,.06],["c",-.06,.12,-.96,1.02,-1.95,1.98],["c",-.63,.57,-1.26,1.17,-1.44,1.35],["c",-1.53,1.62,-2.28,2.85,-2.55,4.32],["c",-.03,.18,-.03,.54,-.06,.99],["l",0,.69],["l",.18,-.09],["c",.93,-.54,2.1,-1.29,2.82,-1.83],["c",.69,-.51,1.02,-.81,1.53,-1.29],["c",1.86,-1.89,2.37,-3.66,1.68,-5.82],["z"]],w:8.475,h:22.591},"flags.d32nd":{d:[["M",6.84,-29.13],["c",.27,-.12,.57,-.06,.72,.15],["c",.12,.12,.27,.63,.36,1.11],["c",.33,1.59,.06,3.06,-.81,4.47],["l",-.18,.27],["l",.09,.15],["c",.12,.24,.33,.69,.45,1.05],["c",.63,1.83,.45,3.57,-.57,5.22],["l",-.18,.3],["l",.15,.27],["c",.42,.87,.6,1.71,.57,2.61],["c",-.06,1.29,-.48,2.46,-1.35,3.78],["c",-.54,.81,-.93,1.29,-2.46,3],["c",-.51,.54,-1.05,1.17,-1.26,1.41],["c",-1.56,1.86,-2.25,3.36,-2.37,5.01],["l",0,.33],["l",-.21,0],["l",-.21,0],["l",0,-11.25],["l",0,-11.25],["l",.21,0],["l",.21,0],["l",0,1.35],["l",.03,1.35],["l",.78,-.39],["c",1.38,-.69,2.34,-1.26,3.24,-1.92],["c",1.38,-1.02,2.28,-2.13,2.64,-3.21],["c",.15,-.48,.18,-.72,.18,-1.29],["c",0,-.57,-.06,-.9,-.24,-1.47],["c",-.06,-.18,-.12,-.39,-.15,-.45],["c",-.03,-.24,.12,-.48,.36,-.6],["z"],["m",-.63,7.2],["c",-.09,-.18,-.12,-.21,-.12,-.15],["c",-.03,.09,-1.02,1.08,-2.04,2.04],["c",-1.17,1.08,-1.65,1.56,-2.07,2.04],["c",-.84,.96,-1.38,1.86,-1.68,2.76],["c",-.21,.57,-.27,.99,-.3,1.65],["l",0,.54],["l",.66,-.33],["c",3.57,-1.86,5.49,-3.69,5.94,-5.7],["c",.06,-.39,.06,-1.2,-.03,-1.65],["c",-.06,-.39,-.24,-.9,-.36,-1.2],["z"],["m",-.06,7.2],["c",-.06,-.15,-.12,-.33,-.15,-.45],["l",-.06,-.18],["l",-.18,.21],["l",-1.83,1.83],["c",-.87,.9,-1.77,1.8,-1.95,2.01],["c",-1.08,1.29,-1.62,2.31,-1.89,3.51],["c",-.06,.3,-.06,.51,-.09,.93],["l",0,.57],["l",.09,-.06],["c",.75,-.45,1.89,-1.26,2.52,-1.74],["c",.81,-.66,1.74,-1.53,2.22,-2.16],["c",1.26,-1.53,1.68,-3.06,1.32,-4.47],["z"]],w:8.385,h:29.191},"flags.d64th":{d:[["M",7.08,-32.88],["c",.3,-.12,.66,-.03,.78,.24],["c",.18,.33,.27,2.1,.15,2.64],["c",-.09,.39,-.21,.78,-.39,1.08],["l",-.15,.3],["l",.09,.27],["c",.03,.12,.09,.45,.12,.69],["c",.27,1.44,.18,2.55,-.3,3.6],["l",-.12,.33],["l",.06,.42],["c",.27,1.35,.33,2.82,.21,3.63],["c",-.12,.6,-.3,1.23,-.57,1.8],["l",-.15,.27],["l",.03,.42],["c",.06,1.02,.06,2.7,.03,3.06],["c",-.15,1.47,-.66,2.76,-1.74,4.41],["c",-.45,.69,-.75,1.11,-1.74,2.37],["c",-1.05,1.38,-1.5,1.98,-1.95,2.73],["c",-.93,1.5,-1.38,2.82,-1.44,4.2],["l",0,.42],["l",-.21,0],["l",-.21,0],["l",0,-15],["l",0,-15],["l",.21,0],["l",.21,0],["l",0,1.86],["l",0,1.89],["c",0,0,.21,-.03,.45,-.09],["c",2.22,-.39,4.08,-1.11,5.19,-2.01],["c",.63,-.54,1.02,-1.14,1.2,-1.8],["c",.06,-.3,.06,-1.14,-.03,-1.65],["c",-.03,-.18,-.06,-.39,-.09,-.48],["c",-.03,-.24,.12,-.48,.36,-.6],["z"],["m",-.45,6.15],["c",-.03,-.18,-.06,-.42,-.06,-.54],["l",-.03,-.18],["l",-.33,.3],["c",-.42,.36,-.87,.72,-1.68,1.29],["c",-1.98,1.38,-2.25,1.59,-2.85,2.16],["c",-.75,.69,-1.23,1.44,-1.47,2.19],["c",-.15,.45,-.18,.63,-.21,1.35],["l",0,.66],["l",.39,-.18],["c",1.83,-.9,3.45,-1.95,4.47,-2.91],["c",.93,-.9,1.53,-1.83,1.74,-2.82],["c",.06,-.33,.06,-.87,.03,-1.32],["z"],["m",-.27,4.86],["c",-.03,-.21,-.06,-.36,-.06,-.36],["c",0,-.03,-.12,.09,-.24,.24],["c",-.39,.48,-.99,1.08,-2.16,2.19],["c",-1.47,1.38,-1.92,1.83,-2.46,2.49],["c",-.66,.87,-1.08,1.74,-1.29,2.58],["c",-.09,.42,-.15,.87,-.15,1.44],["l",0,.54],["l",.48,-.33],["c",1.5,-1.02,2.58,-1.89,3.51,-2.82],["c",1.47,-1.47,2.25,-2.85,2.4,-4.26],["c",.03,-.39,.03,-1.17,-.03,-1.71],["z"],["m",-.66,7.68],["c",.03,-.15,.03,-.6,.03,-.99],["l",0,-.72],["l",-.27,.33],["l",-1.74,1.98],["c",-1.77,1.92,-2.43,2.76,-2.97,3.9],["c",-.51,1.02,-.72,1.77,-.75,2.91],["c",0,.63,0,.63,.06,.6],["c",.03,-.03,.3,-.27,.63,-.54],["c",.66,-.6,1.86,-1.8,2.31,-2.31],["c",1.65,-1.89,2.52,-3.54,2.7,-5.16],["z"]],w:8.485,h:32.932},"clefs.C":{d:[["M",.06,-14.94],["l",.09,-.06],["l",1.92,0],["l",1.92,0],["l",.09,.06],["l",.06,.09],["l",0,14.85],["l",0,14.82],["l",-.06,.09],["l",-.09,.06],["l",-1.92,0],["l",-1.92,0],["l",-.09,-.06],["l",-.06,-.09],["l",0,-14.82],["l",0,-14.85],["z"],["m",5.37,0],["c",.09,-.06,.09,-.06,.57,-.06],["c",.45,0,.45,0,.54,.06],["l",.06,.09],["l",0,7.14],["l",0,7.11],["l",.09,-.06],["c",.18,-.18,.72,-.84,.96,-1.2],["c",.3,-.45,.66,-1.17,.84,-1.65],["c",.36,-.9,.57,-1.83,.6,-2.79],["c",.03,-.48,.03,-.54,.09,-.63],["c",.12,-.18,.36,-.21,.54,-.12],["c",.18,.09,.21,.15,.24,.66],["c",.06,.87,.21,1.56,.57,2.22],["c",.51,1.02,1.26,1.68,2.22,1.92],["c",.21,.06,.33,.06,.78,.06],["c",.45,0,.57,0,.84,-.06],["c",.45,-.12,.81,-.33,1.08,-.6],["c",.57,-.57,.87,-1.41,.99,-2.88],["c",.06,-.54,.06,-3,0,-3.57],["c",-.21,-2.58,-.84,-3.87,-2.16,-4.5],["c",-.48,-.21,-1.17,-.36,-1.77,-.36],["c",-.69,0,-1.29,.27,-1.5,.72],["c",-.06,.15,-.06,.21,-.06,.42],["c",0,.24,0,.3,.06,.45],["c",.12,.24,.24,.39,.63,.66],["c",.42,.3,.57,.48,.69,.72],["c",.06,.15,.06,.21,.06,.48],["c",0,.39,-.03,.63,-.21,.96],["c",-.3,.6,-.87,1.08,-1.5,1.26],["c",-.27,.06,-.87,.06,-1.14,0],["c",-.78,-.24,-1.44,-.87,-1.65,-1.68],["c",-.12,-.42,-.09,-1.17,.09,-1.71],["c",.51,-1.65,1.98,-2.82,3.81,-3.09],["c",.84,-.09,2.46,.03,3.51,.27],["c",2.22,.57,3.69,1.8,4.44,3.75],["c",.36,.93,.57,2.13,.57,3.36],["c",0,1.44,-.48,2.73,-1.38,3.81],["c",-1.26,1.5,-3.27,2.43,-5.28,2.43],["c",-.48,0,-.51,0,-.75,-.09],["c",-.15,-.03,-.48,-.21,-.78,-.36],["c",-.69,-.36,-.87,-.42,-1.26,-.42],["c",-.27,0,-.3,0,-.51,.09],["c",-.57,.3,-.81,.9,-.81,2.1],["c",0,1.23,.24,1.83,.81,2.13],["c",.21,.09,.24,.09,.51,.09],["c",.39,0,.57,-.06,1.26,-.42],["c",.3,-.15,.63,-.33,.78,-.36],["c",.24,-.09,.27,-.09,.75,-.09],["c",2.01,0,4.02,.93,5.28,2.4],["c",.9,1.11,1.38,2.4,1.38,3.84],["c",0,1.5,-.3,2.88,-.84,3.96],["c",-.78,1.59,-2.19,2.64,-4.17,3.15],["c",-1.05,.24,-2.67,.36,-3.51,.27],["c",-1.83,-.27,-3.3,-1.44,-3.81,-3.09],["c",-.18,-.54,-.21,-1.29,-.09,-1.74],["c",.15,-.6,.63,-1.2,1.23,-1.47],["c",.36,-.18,.57,-.21,.99,-.21],["c",.42,0,.63,.03,1.02,.21],["c",.42,.21,.84,.63,1.05,1.05],["c",.18,.36,.21,.6,.21,.96],["c",0,.3,0,.36,-.06,.51],["c",-.12,.24,-.27,.42,-.69,.72],["c",-.57,.42,-.69,.63,-.69,1.08],["c",0,.24,0,.3,.06,.45],["c",.12,.21,.3,.39,.57,.54],["c",.42,.18,.87,.21,1.53,.15],["c",1.08,-.15,1.8,-.57,2.34,-1.32],["c",.54,-.75,.84,-1.83,.99,-3.51],["c",.06,-.57,.06,-3.03,0,-3.57],["c",-.12,-1.47,-.42,-2.31,-.99,-2.88],["c",-.27,-.27,-.63,-.48,-1.08,-.6],["c",-.27,-.06,-.39,-.06,-.84,-.06],["c",-.45,0,-.57,0,-.78,.06],["c",-1.14,.27,-2.01,1.17,-2.46,2.49],["c",-.21,.57,-.3,.99,-.33,1.65],["c",-.03,.51,-.06,.57,-.24,.66],["c",-.12,.06,-.27,.06,-.39,0],["c",-.21,-.09,-.21,-.15,-.24,-.75],["c",-.09,-1.92,-.78,-3.72,-2.01,-5.19],["c",-.18,-.21,-.36,-.42,-.39,-.45],["l",-.09,-.06],["l",0,7.11],["l",0,7.14],["l",-.06,.09],["c",-.09,.06,-.09,.06,-.54,.06],["c",-.48,0,-.48,0,-.57,-.06],["l",-.06,-.09],["l",0,-14.82],["l",0,-14.85],["z"]],w:20.31,h:29.97},"clefs.F":{d:[["M",6.3,-7.8],["c",.36,-.03,1.65,0,2.13,.03],["c",3.6,.42,6.03,2.1,6.93,4.86],["c",.27,.84,.36,1.5,.36,2.58],["c",0,.9,-.03,1.35,-.18,2.16],["c",-.78,3.78,-3.54,7.08,-8.37,9.96],["c",-1.74,1.05,-3.87,2.13,-6.18,3.12],["c",-.39,.18,-.75,.33,-.81,.36],["c",-.06,.03,-.15,.06,-.18,.06],["c",-.15,0,-.33,-.18,-.33,-.33],["c",0,-.15,.06,-.21,.51,-.48],["c",3,-1.77,5.13,-3.21,6.84,-4.74],["c",.51,-.45,1.59,-1.5,1.95,-1.95],["c",1.89,-2.19,2.88,-4.32,3.15,-6.78],["c",.06,-.42,.06,-1.77,0,-2.19],["c",-.24,-2.01,-.93,-3.63,-2.04,-4.71],["c",-.63,-.63,-1.29,-1.02,-2.07,-1.2],["c",-1.62,-.39,-3.36,.15,-4.56,1.44],["c",-.54,.6,-1.05,1.47,-1.32,2.22],["l",-.09,.21],["l",.24,-.12],["c",.39,-.21,.63,-.24,1.11,-.24],["c",.3,0,.45,0,.66,.06],["c",1.92,.48,2.85,2.55,1.95,4.38],["c",-.45,.99,-1.41,1.62,-2.46,1.71],["c",-1.47,.09,-2.91,-.87,-3.39,-2.25],["c",-.18,-.57,-.21,-1.32,-.03,-2.28],["c",.39,-2.25,1.83,-4.2,3.81,-5.19],["c",.69,-.36,1.59,-.6,2.37,-.69],["z"],["m",11.58,2.52],["c",.84,-.21,1.71,.3,1.89,1.14],["c",.3,1.17,-.72,2.19,-1.89,1.89],["c",-.99,-.21,-1.5,-1.32,-1.02,-2.25],["c",.18,-.39,.6,-.69,1.02,-.78],["z"],["m",0,7.5],["c",.84,-.21,1.71,.3,1.89,1.14],["c",.21,.87,-.3,1.71,-1.14,1.89],["c",-.87,.21,-1.71,-.3,-1.89,-1.14],["c",-.21,-.84,.3,-1.71,1.14,-1.89],["z"]],w:20.153,h:23.142},"clefs.G":{d:[["M",9.69,-37.41],["c",.09,-.09,.24,-.06,.36,0],["c",.12,.09,.57,.6,.96,1.11],["c",1.77,2.34,3.21,5.85,3.57,8.73],["c",.21,1.56,.03,3.27,-.45,4.86],["c",-.69,2.31,-1.92,4.47,-4.23,7.44],["c",-.3,.39,-.57,.72,-.6,.75],["c",-.03,.06,0,.15,.18,.78],["c",.54,1.68,1.38,4.44,1.68,5.49],["l",.09,.42],["l",.39,0],["c",1.47,.09,2.76,.51,3.96,1.29],["c",1.83,1.23,3.06,3.21,3.39,5.52],["c",.09,.45,.12,1.29,.06,1.74],["c",-.09,1.02,-.33,1.83,-.75,2.73],["c",-.84,1.71,-2.28,3.06,-4.02,3.72],["l",-.33,.12],["l",.03,1.26],["c",0,1.74,-.06,3.63,-.21,4.62],["c",-.45,3.06,-2.19,5.49,-4.47,6.21],["c",-.57,.18,-.9,.21,-1.59,.21],["c",-.69,0,-1.02,-.03,-1.65,-.21],["c",-1.14,-.27,-2.13,-.84,-2.94,-1.65],["c",-.99,-.99,-1.56,-2.16,-1.71,-3.54],["c",-.09,-.81,.06,-1.53,.45,-2.13],["c",.63,-.99,1.83,-1.56,3,-1.53],["c",1.5,.09,2.64,1.32,2.73,2.94],["c",.06,1.47,-.93,2.7,-2.37,2.97],["c",-.45,.06,-.84,.03,-1.29,-.09],["l",-.21,-.09],["l",.09,.12],["c",.39,.54,.78,.93,1.32,1.26],["c",1.35,.87,3.06,1.02,4.35,.36],["c",1.44,-.72,2.52,-2.28,2.97,-4.35],["c",.15,-.66,.24,-1.5,.3,-3.03],["c",.03,-.84,.03,-2.94,0,-3],["c",-.03,0,-.18,0,-.36,.03],["c",-.66,.12,-.99,.12,-1.83,.12],["c",-1.05,0,-1.71,-.06,-2.61,-.3],["c",-4.02,-.99,-7.11,-4.35,-7.8,-8.46],["c",-.12,-.66,-.12,-.99,-.12,-1.83],["c",0,-.84,0,-1.14,.15,-1.92],["c",.36,-2.28,1.41,-4.62,3.3,-7.29],["l",2.79,-3.6],["c",.54,-.66,.96,-1.2,.96,-1.23],["c",0,-.03,-.09,-.33,-.18,-.69],["c",-.96,-3.21,-1.41,-5.28,-1.59,-7.68],["c",-.12,-1.38,-.15,-3.09,-.06,-3.96],["c",.33,-2.67,1.38,-5.07,3.12,-7.08],["c",.36,-.42,.99,-1.05,1.17,-1.14],["z"],["m",2.01,4.71],["c",-.15,-.3,-.3,-.54,-.3,-.54],["c",-.03,0,-.18,.09,-.3,.21],["c",-2.4,1.74,-3.87,4.2,-4.26,7.11],["c",-.06,.54,-.06,1.41,-.03,1.89],["c",.09,1.29,.48,3.12,1.08,5.22],["c",.15,.42,.24,.78,.24,.81],["c",0,.03,.84,-1.11,1.23,-1.68],["c",1.89,-2.73,2.88,-5.07,3.15,-7.53],["c",.09,-.57,.12,-1.74,.06,-2.37],["c",-.09,-1.23,-.27,-1.92,-.87,-3.12],["z"],["m",-2.94,20.7],["c",-.21,-.72,-.39,-1.32,-.42,-1.32],["c",0,0,-1.2,1.47,-1.86,2.37],["c",-2.79,3.63,-4.02,6.3,-4.35,9.3],["c",-.03,.21,-.03,.69,-.03,1.08],["c",0,.69,0,.75,.06,1.11],["c",.12,.54,.27,.99,.51,1.47],["c",.69,1.38,1.83,2.55,3.42,3.42],["c",.96,.54,2.07,.9,3.21,1.08],["c",.78,.12,2.04,.12,2.94,-.03],["c",.51,-.06,.45,-.03,.42,-.3],["c",-.24,-3.33,-.72,-6.33,-1.62,-10.08],["c",-.09,-.39,-.18,-.75,-.18,-.78],["c",-.03,-.03,-.42,0,-.81,.09],["c",-.9,.18,-1.65,.57,-2.22,1.14],["c",-.72,.72,-1.08,1.65,-1.05,2.64],["c",.06,.96,.48,1.83,1.23,2.58],["c",.36,.36,.72,.63,1.17,.9],["c",.33,.18,.36,.21,.42,.33],["c",.18,.42,-.18,.9,-.6,.87],["c",-.18,-.03,-.84,-.36,-1.26,-.63],["c",-.78,-.51,-1.38,-1.11,-1.86,-1.83],["c",-1.77,-2.7,-.99,-6.42,1.71,-8.19],["c",.3,-.21,.81,-.48,1.17,-.63],["c",.3,-.09,1.02,-.3,1.14,-.3],["c",.06,0,.09,0,.09,-.03],["c",.03,-.03,-.51,-1.92,-1.23,-4.26],["z"],["m",3.78,7.41],["c",-.18,-.03,-.36,-.06,-.39,-.06],["c",-.03,0,0,.21,.18,1.02],["c",.75,3.18,1.26,6.3,1.5,9.09],["c",.06,.72,0,.69,.51,.42],["c",.78,-.36,1.44,-.96,1.98,-1.77],["c",1.08,-1.62,1.2,-3.69,.3,-5.55],["c",-.81,-1.62,-2.31,-2.79,-4.08,-3.15],["z"]],w:19.051,h:57.057},"clefs.perc":{d:[["M",5.07,-7.44],["l",.09,-.06],["l",1.53,0],["l",1.53,0],["l",.09,.06],["l",.06,.09],["l",0,7.35],["l",0,7.32],["l",-.06,.09],["l",-.09,.06],["l",-1.53,0],["l",-1.53,0],["l",-.09,-.06],["l",-.06,-.09],["l",0,-7.32],["l",0,-7.35],["z"],["m",6.63,0],["l",.09,-.06],["l",1.53,0],["l",1.53,0],["l",.09,.06],["l",.06,.09],["l",0,7.35],["l",0,7.32],["l",-.06,.09],["l",-.09,.06],["l",-1.53,0],["l",-1.53,0],["l",-.09,-.06],["l",-.06,-.09],["l",0,-7.32],["l",0,-7.35],["z"]],w:21,h:14.97},"tab.big":{d:[["M",20.16,-21.66],["c",.24,-.09,.66,.09,.78,.36],["c",.09,.21,.09,.24,-.18,.54],["c",-.78,.81,-1.86,1.44,-2.94,1.71],["c",-.87,.24,-1.71,.24,-2.55,.03],["l",-.06,-.03],["l",-.18,.99],["c",-.33,1.98,-.75,4.26,-.96,5.04],["c",-.42,1.65,-1.26,3.18,-2.28,4.14],["c",-.57,.57,-1.17,.9,-1.86,1.08],["c",-.18,.06,-.33,.06,-.66,.06],["c",-.54,0,-.78,-.03,-1.23,-.27],["c",-.39,-.18,-.66,-.39,-1.38,-.99],["c",-.3,-.24,-.66,-.51,-.75,-.57],["c",-.21,-.15,-.27,-.24,-.24,-.45],["c",.06,-.27,.36,-.6,.6,-.66],["c",.18,-.03,.33,.06,.9,.57],["c",.48,.42,.72,.57,.93,.69],["c",.66,.33,1.38,.21,1.95,-.36],["c",.63,-.6,1.05,-1.62,1.23,-3],["c",.03,-.18,.09,-.66,.09,-1.11],["c",.09,-1.56,.33,-3.81,.57,-5.49],["c",.06,-.33,.09,-.63,.09,-.63],["c",-.03,-.03,-.81,-.12,-1.02,-.12],["c",-.57,0,-1.32,.12,-1.8,.33],["c",-.87,.3,-1.35,.78,-1.5,1.41],["c",-.18,.63,.09,1.26,.66,1.65],["c",.12,.06,.15,.12,.18,.24],["c",.09,.27,.06,.57,-.09,.75],["c",-.03,.06,-.12,.09,-.27,.15],["c",-.72,.21,-1.44,.15,-2.1,-.18],["c",-.54,-.27,-.96,-.66,-1.2,-1.14],["c",-.39,-.75,-.33,-1.74,.15,-2.52],["c",.27,-.42,.84,-.93,1.41,-1.23],["c",1.17,-.57,2.88,-.9,4.8,-.9],["c",.69,0,.78,0,1.08,.06],["c",.45,.09,1.11,.3,2.07,.6],["c",1.47,.48,1.83,.57,2.55,.54],["c",1.02,-.06,2.04,-.45,2.94,-1.11],["c",.12,-.09,.24,-.18,.27,-.18],["z"],["m",-5.88,13.05],["c",.21,-.03,.81,0,1.08,.06],["c",.48,.12,.9,.42,.99,.69],["c",.03,.09,.03,.15,0,.27],["c",0,.09,-.03,.57,-.06,1.08],["c",-.09,2.19,-.24,5.76,-.39,8.28],["c",-.06,1.53,-.06,1.77,.03,2.01],["c",.09,.18,.15,.24,.3,.3],["c",.24,.12,.54,.06,1.23,-.27],["c",.57,-.27,.66,-.3,.75,-.24],["c",.09,.06,.18,.3,.18,.45],["c",0,.33,-.15,.51,-.45,.63],["c",-.12,.03,-.39,.15,-.6,.27],["c",-1.17,.6,-1.38,.69,-1.8,.72],["c",-.45,.03,-.78,-.09,-1.08,-.39],["c",-.39,-.42,-.66,-1.2,-1.02,-3.12],["c",-.24,-1.23,-.36,-2.07,-.54,-3.75],["l",0,-.18],["l",-.36,.45],["c",-.6,.75,-1.32,1.59,-1.95,2.25],["c",-.15,.18,-.27,.3,-.27,.33],["c",0,0,.06,.09,.15,.18],["c",.24,.33,.6,.57,1.05,.69],["c",.18,.06,.3,.06,.69,.06],["l",.48,.03],["l",.06,.12],["c",.15,.27,.03,.72,-.21,.9],["c",-.18,.12,-.93,.27,-1.41,.27],["c",-.84,0,-1.59,-.3,-1.98,-.84],["l",-.12,-.15],["l",-.45,.42],["c",-.99,.87,-1.53,1.32,-2.16,1.74],["c",-.78,.51,-1.5,.84,-2.1,.93],["c",-.69,.12,-1.2,.03,-1.95,-.42],["c",-.21,-.12,-.51,-.27,-.66,-.36],["c",-.24,-.12,-.3,-.18,-.33,-.24],["c",-.12,-.27,.15,-.78,.45,-.93],["c",.24,-.12,.33,-.09,.9,.18],["c",.6,.3,.84,.39,1.2,.36],["c",.87,-.09,1.77,-.69,3.24,-2.31],["c",2.67,-2.85,4.59,-5.94,5.7,-9.15],["c",.15,-.45,.24,-.63,.42,-.81],["c",.21,-.24,.6,-.45,.99,-.51],["z"],["m",-3.99,16.05],["c",.18,0,.69,-.03,1.17,0],["c",3.27,.03,5.37,.75,6,2.07],["c",.45,.99,.12,2.4,-.81,3.42],["c",-.24,.27,-.57,.57,-.84,.75],["c",-.09,.06,-.18,.09,-.18,.12],["c",0,0,.18,.03,.42,.09],["c",1.23,.3,2.01,.81,2.37,1.59],["c",.27,.54,.3,1.32,.09,2.1],["c",-.12,.36,-.45,1.05,-.69,1.35],["c",-.87,1.17,-2.1,1.92,-3.54,2.25],["c",-.36,.06,-.48,.06,-.96,.06],["c",-.45,0,-.66,0,-.84,-.03],["c",-.84,-.18,-1.47,-.51,-2.07,-1.11],["c",-.33,-.33,-.45,-.51,-.45,-.63],["c",0,-.06,.03,-.15,.06,-.24],["c",.18,-.33,.69,-.6,.93,-.48],["c",.03,.03,.15,.12,.27,.24],["c",.39,.42,.99,.57,1.62,.45],["c",1.05,-.21,1.98,-1.02,2.31,-2.01],["c",.48,-1.53,-.48,-2.55,-2.58,-2.67],["c",-.21,0,-.36,-.03,-.42,-.06],["c",-.15,-.09,-.21,-.51,-.06,-.78],["c",.12,-.27,.24,-.33,.6,-.36],["c",.57,-.06,1.11,-.42,1.5,-.99],["c",.48,-.72,.54,-1.59,.18,-2.31],["c",-.12,-.21,-.45,-.54,-.69,-.69],["c",-.33,-.21,-.93,-.45,-1.35,-.51],["l",-.12,-.03],["l",-.06,.48],["c",-.54,2.94,-1.14,6.24,-1.29,6.75],["c",-.33,1.35,-.93,2.61,-1.65,3.6],["c",-.3,.36,-.81,.9,-1.14,1.14],["c",-.3,.24,-.84,.48,-1.14,.57],["c",-.33,.09,-.96,.09,-1.26,.03],["c",-.45,-.12,-.87,-.39,-1.53,-.96],["c",-.24,-.15,-.51,-.39,-.63,-.48],["c",-.3,-.21,-.33,-.33,-.21,-.63],["c",.12,-.18,.27,-.36,.42,-.45],["c",.27,-.12,.36,-.09,.87,.33],["c",.78,.6,1.08,.75,1.65,.72],["c",.45,-.03,.81,-.21,1.17,-.54],["c",.87,-.9,1.38,-2.85,1.38,-5.37],["c",0,-.6,.03,-1.11,.12,-2.04],["c",.06,-.69,.24,-2.01,.33,-2.58],["c",.06,-.24,.06,-.42,.06,-.42],["c",0,0,-.12,.03,-.21,.09],["c",-1.44,.57,-2.16,1.65,-1.74,2.55],["c",.09,.15,.18,.24,.27,.33],["c",.24,.21,.3,.27,.33,.39],["c",.06,.24,0,.63,-.15,.78],["c",-.09,.12,-.54,.21,-.96,.24],["c",-1.02,.03,-2.01,-.48,-2.43,-1.32],["c",-.21,-.45,-.27,-.9,-.15,-1.44],["c",.06,-.27,.21,-.66,.39,-.93],["c",.87,-1.29,3,-2.22,5.64,-2.43],["z"]],w:19.643,h:43.325},"tab.tiny":{d:[["M",16.02,-17.25],["c",.12,-.09,.15,-.09,.27,-.09],["c",.21,.03,.51,.3,.51,.45],["c",0,.06,-.12,.18,-.3,.36],["c",-1.11,1.08,-2.55,1.59,-3.84,1.41],["c",-.15,-.03,-.33,-.06,-.39,-.09],["c",-.06,-.03,-.09,-.03,-.12,-.03],["c",0,0,-.06,.42,-.15,.93],["c",-.33,2.01,-.66,3.69,-.84,4.26],["c",-.42,1.41,-1.23,2.67,-2.16,3.33],["c",-.27,.18,-.75,.42,-.99,.48],["c",-.3,.09,-.72,.09,-1.02,.06],["c",-.45,-.09,-.84,-.33,-1.53,-.9],["c",-.21,-.18,-.51,-.39,-.63,-.48],["c",-.27,-.21,-.3,-.24,-.3,-.36],["c",0,-.12,.09,-.36,.18,-.45],["c",.09,-.09,.27,-.18,.36,-.18],["c",.12,0,.3,.12,.66,.45],["c",.57,.51,.87,.69,1.23,.72],["c",.93,.06,1.68,-.78,1.98,-2.37],["c",.09,-.39,.15,-.75,.18,-1.53],["c",.06,-.99,.24,-2.79,.42,-4.05],["c",.03,-.3,.06,-.57,.06,-.6],["c",0,-.06,-.03,-.09,-.15,-.12],["c",-.9,-.18,-2.13,.06,-2.76,.57],["c",-.36,.3,-.51,.6,-.51,1.02],["c",0,.45,.15,.75,.48,.99],["c",.06,.06,.15,.18,.18,.24],["c",.12,.24,.03,.63,-.15,.69],["c",-.24,.12,-.6,.15,-.9,.15],["c",-.36,-.03,-.57,-.09,-.87,-.24],["c",-.78,-.36,-1.23,-1.11,-1.2,-1.92],["c",.12,-1.53,1.74,-2.49,4.62,-2.7],["c",1.2,-.09,1.47,-.03,3.33,.57],["c",.9,.3,1.14,.36,1.56,.39],["c",.45,0,.93,-.06,1.38,-.21],["c",.51,-.18,.81,-.33,1.41,-.75],["z"],["m",-4.68,10.38],["c",.39,-.06,.84,0,1.2,.15],["c",.24,.12,.36,.21,.45,.36],["l",.09,.09],["l",-.06,1.41],["c",-.09,2.19,-.18,3.96,-.27,5.49],["c",-.03,.78,-.06,1.59,-.06,1.86],["c",0,.42,0,.48,.06,.57],["c",.06,.18,.18,.24,.36,.27],["c",.18,0,.39,-.06,.84,-.27],["c",.45,-.21,.54,-.24,.63,-.18],["c",.12,.12,.15,.54,.03,.69],["c",-.03,.03,-.15,.12,-.27,.18],["c",-.15,.03,-.3,.12,-.36,.15],["c",-.87,.45,-1.02,.51,-1.26,.57],["c",-.33,.09,-.6,.06,-.84,-.06],["c",-.42,-.18,-.63,-.6,-.87,-1.44],["c",-.3,-1.23,-.57,-2.97,-.66,-4.08],["c",0,-.18,-.03,-.3,-.03,-.33],["l",-.06,.06],["c",-.18,.27,-1.11,1.38,-1.68,2.01],["l",-.33,.33],["l",.06,.09],["c",.06,.15,.27,.33,.48,.42],["c",.27,.18,.51,.24,.96,.27],["l",.39,0],["l",.03,.12],["c",.12,.21,.03,.57,-.15,.69],["c",-.03,.03,-.21,.09,-.36,.15],["c",-.27,.06,-.39,.06,-.75,.06],["c",-.48,0,-.75,-.03,-1.08,-.21],["c",-.21,-.12,-.51,-.36,-.57,-.48],["l",-.03,-.09],["l",-.39,.36],["c",-1.47,1.35,-2.49,1.98,-3.42,2.13],["c",-.54,.09,-.96,-.03,-1.62,-.39],["c",-.21,-.15,-.45,-.27,-.54,-.3],["c",-.18,-.09,-.21,-.21,-.12,-.45],["c",.06,-.27,.33,-.48,.54,-.48],["c",.03,0,.27,.09,.48,.21],["c",.48,.24,.69,.27,.99,.27],["c",.6,-.06,1.17,-.42,2.1,-1.35],["c",2.22,-2.22,4.02,-4.98,4.95,-7.59],["c",.21,-.57,.3,-.78,.48,-.93],["c",.15,-.15,.42,-.27,.66,-.33],["z"],["m",-3.06,12.84],["c",.27,-.03,1.68,0,2.01,.03],["c",1.92,.18,3.15,.69,3.63,1.5],["c",.18,.33,.24,.51,.21,.93],["c",0,.45,-.06,.72,-.24,1.11],["c",-.24,.51,-.69,1.02,-1.17,1.35],["c",-.21,.15,-.21,.15,-.12,.18],["c",.72,.15,1.11,.3,1.5,.57],["c",.39,.24,.63,.57,.75,.96],["c",.09,.3,.09,.96,0,1.29],["c",-.15,.57,-.39,1.05,-.78,1.5],["c",-.66,.75,-1.62,1.32,-2.61,1.53],["c",-.27,.06,-.42,.06,-.84,.06],["c",-.48,0,-.57,0,-.81,-.06],["c",-.6,-.18,-1.05,-.42,-1.47,-.81],["c",-.36,-.39,-.42,-.51,-.3,-.75],["c",.12,-.21,.39,-.39,.6,-.39],["c",.09,0,.15,.03,.33,.18],["c",.12,.12,.27,.24,.36,.27],["c",.96,.48,2.46,-.33,2.82,-1.5],["c",.24,-.81,-.03,-1.44,-.69,-1.77],["c",-.39,-.21,-1.02,-.33,-1.53,-.33],["c",-.18,0,-.21,0,-.27,-.09],["c",-.06,-.09,-.06,-.3,-.03,-.48],["c",.06,-.18,.18,-.36,.33,-.36],["c",.39,-.06,.51,-.09,.72,-.18],["c",.69,-.36,1.11,-1.23,.99,-2.01],["c",-.09,-.51,-.42,-.9,-.93,-1.17],["c",-.24,-.12,-.6,-.27,-.87,-.3],["c",-.09,-.03,-.09,-.03,-.12,.12],["c",0,.09,-.21,1.11,-.42,2.25],["c",-.66,3.75,-.72,3.99,-1.26,5.07],["c",-.9,1.89,-2.25,2.85,-3.48,2.61],["c",-.39,-.09,-.69,-.27,-1.38,-.84],["c",-.63,-.51,-.63,-.48,-.63,-.6],["c",0,-.18,.18,-.48,.39,-.57],["c",.21,-.12,.3,-.09,.81,.33],["c",.15,.15,.39,.3,.54,.36],["c",.18,.12,.27,.12,.48,.15],["c",.99,.06,1.71,-.78,2.04,-2.46],["c",.12,-.66,.18,-1.14,.21,-2.22],["c",.03,-1.23,.12,-2.25,.36,-3.63],["c",.03,-.24,.06,-.45,.06,-.48],["c",-.06,-.03,-.66,.27,-.9,.42],["c",-.06,.06,-.21,.18,-.33,.3],["c",-.57,.57,-.6,1.35,-.06,1.74],["c",.18,.12,.24,.24,.21,.51],["c",-.03,.3,-.15,.42,-.57,.48],["c",-1.11,.24,-2.22,-.42,-2.43,-1.38],["c",-.09,-.45,.03,-1.02,.3,-1.47],["c",.18,-.24,.6,-.63,.9,-.84],["c",.9,-.6,2.28,-1.02,3.69,-1.11],["z"]],w:15.709,h:34.656},"timesig.common":{d:[["M",6.66,-7.83],["c",.72,-.06,1.41,-.03,1.98,.09],["c",1.2,.27,2.34,.96,3.09,1.92],["c",.63,.81,1.08,1.86,1.14,2.73],["c",.06,1.02,-.51,1.92,-1.44,2.22],["c",-.24,.09,-.3,.09,-.63,.09],["c",-.33,0,-.42,0,-.63,-.06],["c",-.66,-.24,-1.14,-.63,-1.41,-1.2],["c",-.15,-.3,-.21,-.51,-.24,-.9],["c",-.06,-1.08,.57,-2.04,1.56,-2.37],["c",.18,-.06,.27,-.06,.63,-.06],["l",.45,0],["c",.06,.03,.09,.03,.09,0],["c",0,0,-.09,-.12,-.24,-.27],["c",-1.02,-1.11,-2.55,-1.68,-4.08,-1.5],["c",-1.29,.15,-2.04,.69,-2.4,1.74],["c",-.36,.93,-.42,1.89,-.42,5.37],["c",0,2.97,.06,3.96,.24,4.77],["c",.24,1.08,.63,1.68,1.41,2.07],["c",.81,.39,2.16,.45,3.18,.09],["c",1.29,-.45,2.37,-1.53,3.03,-2.97],["c",.15,-.33,.33,-.87,.39,-1.17],["c",.09,-.24,.15,-.36,.3,-.39],["c",.21,-.03,.42,.15,.39,.36],["c",-.06,.39,-.42,1.38,-.69,1.89],["c",-.96,1.8,-2.49,2.94,-4.23,3.18],["c",-.99,.12,-2.58,-.06,-3.63,-.45],["c",-.96,-.36,-1.71,-.84,-2.4,-1.5],["c",-1.11,-1.11,-1.8,-2.61,-2.04,-4.56],["c",-.06,-.6,-.06,-2.01,0,-2.61],["c",.24,-1.95,.9,-3.45,2.01,-4.56],["c",.69,-.66,1.44,-1.11,2.37,-1.47],["c",.63,-.24,1.47,-.42,2.22,-.48],["z"]],w:13.038,h:15.689},"timesig.cut":{d:[["M",6.24,-10.44],["c",.09,-.06,.09,-.06,.48,-.06],["c",.36,0,.36,0,.45,.06],["l",.06,.09],["l",0,1.23],["l",0,1.26],["l",.27,0],["c",1.26,0,2.49,.45,3.48,1.29],["c",1.05,.87,1.8,2.28,1.89,3.48],["c",.06,1.02,-.51,1.92,-1.44,2.22],["c",-.24,.09,-.3,.09,-.63,.09],["c",-.33,0,-.42,0,-.63,-.06],["c",-.66,-.24,-1.14,-.63,-1.41,-1.2],["c",-.15,-.3,-.21,-.51,-.24,-.9],["c",-.06,-1.08,.57,-2.04,1.56,-2.37],["c",.18,-.06,.27,-.06,.63,-.06],["l",.45,0],["c",.06,.03,.09,.03,.09,0],["c",0,-.03,-.45,-.51,-.66,-.69],["c",-.87,-.69,-1.83,-1.05,-2.94,-1.11],["l",-.42,0],["l",0,7.17],["l",0,7.14],["l",.42,0],["c",.69,-.03,1.23,-.18,1.86,-.51],["c",1.05,-.51,1.89,-1.47,2.46,-2.7],["c",.15,-.33,.33,-.87,.39,-1.17],["c",.09,-.24,.15,-.36,.3,-.39],["c",.21,-.03,.42,.15,.39,.36],["c",-.03,.24,-.21,.78,-.39,1.2],["c",-.96,2.37,-2.94,3.9,-5.13,3.9],["l",-.3,0],["l",0,1.26],["l",0,1.23],["l",-.06,.09],["c",-.09,.06,-.09,.06,-.45,.06],["c",-.39,0,-.39,0,-.48,-.06],["l",-.06,-.09],["l",0,-1.29],["l",0,-1.29],["l",-.21,-.03],["c",-1.23,-.21,-2.31,-.63,-3.21,-1.29],["c",-.15,-.09,-.45,-.36,-.66,-.57],["c",-1.11,-1.11,-1.8,-2.61,-2.04,-4.56],["c",-.06,-.6,-.06,-2.01,0,-2.61],["c",.24,-1.95,.93,-3.45,2.04,-4.59],["c",.42,-.39,.78,-.66,1.26,-.93],["c",.75,-.45,1.65,-.75,2.61,-.9],["l",.21,-.03],["l",0,-1.29],["l",0,-1.29],["z"],["m",-.06,10.44],["c",0,-5.58,0,-6.99,-.03,-6.99],["c",-.15,0,-.63,.27,-.87,.45],["c",-.45,.36,-.75,.93,-.93,1.77],["c",-.18,.81,-.24,1.8,-.24,4.74],["c",0,2.97,.06,3.96,.24,4.77],["c",.24,1.08,.66,1.68,1.41,2.07],["c",.12,.06,.3,.12,.33,.15],["l",.09,0],["l",0,-6.96],["z"]],w:13.038,h:20.97},"timesig.imperfectum":{d:[["M",13,-5],["a",8,8,0,1,0,0,10]],w:13.038,h:20.97},"timesig.imperfectum2":{d:[["M",13,-5],["a",8,8,0,1,0,0,10]],w:13.038,h:20.97},"timesig.perfectum":{d:[["M",13,-5],["a",8,8,0,1,0,0,10]],w:13.038,h:20.97},"timesig.perfectum2":{d:[["M",13,-5],["a",8,8,0,1,0,0,10]],w:13.038,h:20.97},f:{d:[["M",9.93,-14.28],["c",1.53,-.18,2.88,.45,3.12,1.5],["c",.12,.51,0,1.32,-.27,1.86],["c",-.15,.3,-.42,.57,-.63,.69],["c",-.69,.36,-1.56,.03,-1.83,-.69],["c",-.09,-.24,-.09,-.69,0,-.87],["c",.06,-.12,.21,-.24,.45,-.42],["c",.42,-.24,.57,-.45,.6,-.72],["c",.03,-.33,-.09,-.39,-.63,-.42],["c",-.3,0,-.45,0,-.6,.03],["c",-.81,.21,-1.35,.93,-1.74,2.46],["c",-.06,.27,-.48,2.25,-.48,2.31],["c",0,.03,.39,.03,.9,.03],["c",.72,0,.9,0,.99,.06],["c",.42,.15,.45,.72,.03,.9],["c",-.12,.06,-.24,.06,-1.17,.06],["l",-1.05,0],["l",-.78,2.55],["c",-.45,1.41,-.87,2.79,-.96,3.06],["c",-.87,2.37,-2.37,4.74,-3.78,5.91],["c",-1.05,.9,-2.04,1.23,-3.09,1.08],["c",-1.11,-.18,-1.89,-.78,-2.04,-1.59],["c",-.12,-.66,.15,-1.71,.54,-2.19],["c",.69,-.75,1.86,-.54,2.22,.39],["c",.06,.15,.09,.27,.09,.48],["c",0,.24,-.03,.27,-.12,.42],["c",-.03,.09,-.15,.18,-.27,.27],["c",-.09,.06,-.27,.21,-.36,.27],["c",-.24,.18,-.36,.36,-.39,.6],["c",-.03,.33,.09,.39,.63,.42],["c",.42,0,.63,-.03,.9,-.15],["c",.6,-.3,.96,-.96,1.38,-2.64],["c",.09,-.42,.63,-2.55,1.17,-4.77],["l",1.02,-4.08],["c",0,-.03,-.36,-.03,-.81,-.03],["c",-.72,0,-.81,0,-.93,-.06],["c",-.42,-.18,-.39,-.75,.03,-.9],["c",.09,-.06,.27,-.06,1.05,-.06],["l",.96,0],["l",0,-.09],["c",.06,-.18,.3,-.72,.51,-1.17],["c",1.2,-2.46,3.3,-4.23,5.34,-4.5],["z"]],w:16.155,h:19.445},m:{d:[["M",2.79,-8.91],["c",.09,0,.3,-.03,.45,-.03],["c",.24,.03,.3,.03,.45,.12],["c",.36,.15,.63,.54,.75,1.02],["l",.03,.21],["l",.33,-.3],["c",.69,-.69,1.38,-1.02,2.07,-1.02],["c",.27,0,.33,0,.48,.06],["c",.21,.09,.48,.36,.63,.6],["c",.03,.09,.12,.27,.18,.42],["c",.03,.15,.09,.27,.12,.27],["c",0,0,.09,-.09,.18,-.21],["c",.33,-.39,.87,-.81,1.29,-.99],["c",.78,-.33,1.47,-.21,2.01,.33],["c",.3,.33,.48,.69,.6,1.14],["c",.09,.42,.06,.54,-.54,3.06],["c",-.33,1.29,-.57,2.4,-.57,2.43],["c",0,.12,.09,.21,.21,.21],["c",.24,0,.75,-.3,1.2,-.72],["c",.45,-.39,.6,-.45,.78,-.27],["c",.18,.18,.09,.36,-.45,.87],["c",-1.05,.96,-1.83,1.47,-2.58,1.71],["c",-.93,.33,-1.53,.21,-1.8,-.33],["c",-.06,-.15,-.06,-.21,-.06,-.45],["c",0,-.24,.03,-.48,.6,-2.82],["c",.42,-1.71,.6,-2.64,.63,-2.79],["c",.03,-.57,-.3,-.75,-.84,-.48],["c",-.24,.12,-.54,.39,-.66,.63],["c",-.03,.09,-.42,1.38,-.9,3],["c",-.9,3.15,-.84,3,-1.14,3.15],["l",-.15,.09],["l",-.78,0],["c",-.6,0,-.78,0,-.84,-.06],["c",-.09,-.03,-.18,-.18,-.18,-.27],["c",0,-.03,.36,-1.38,.84,-2.97],["c",.57,-2.04,.81,-2.97,.84,-3.12],["c",.03,-.54,-.3,-.72,-.84,-.45],["c",-.24,.12,-.57,.42,-.66,.63],["c",-.06,.09,-.51,1.44,-1.05,2.97],["c",-.51,1.56,-.99,2.85,-.99,2.91],["c",-.06,.12,-.21,.24,-.36,.3],["c",-.12,.06,-.21,.06,-.9,.06],["c",-.6,0,-.78,0,-.84,-.06],["c",-.09,-.03,-.18,-.18,-.18,-.27],["c",0,-.03,.45,-1.38,.99,-2.97],["c",1.05,-3.18,1.05,-3.18,.93,-3.45],["c",-.12,-.27,-.39,-.3,-.72,-.15],["c",-.54,.27,-1.14,1.17,-1.56,2.4],["c",-.06,.15,-.15,.3,-.18,.36],["c",-.21,.21,-.57,.27,-.72,.09],["c",-.09,-.09,-.06,-.21,.06,-.63],["c",.48,-1.26,1.26,-2.46,2.01,-3.21],["c",.57,-.54,1.2,-.87,1.83,-1.02],["z"]],w:14.687,h:9.126},p:{d:[["M",1.92,-8.7],["c",.27,-.09,.81,-.06,1.11,.03],["c",.54,.18,.93,.51,1.17,.99],["c",.09,.15,.15,.33,.18,.36],["l",0,.12],["l",.3,-.27],["c",.66,-.6,1.35,-1.02,2.13,-1.2],["c",.21,-.06,.33,-.06,.78,-.06],["c",.45,0,.51,0,.84,.09],["c",1.29,.33,2.07,1.32,2.25,2.79],["c",.09,.81,-.09,2.01,-.45,2.79],["c",-.54,1.26,-1.86,2.55,-3.18,3.03],["c",-.45,.18,-.81,.24,-1.29,.24],["c",-.69,-.03,-1.35,-.18,-1.86,-.45],["c",-.3,-.15,-.51,-.18,-.69,-.09],["c",-.09,.03,-.18,.09,-.18,.12],["c",-.09,.12,-1.05,2.94,-1.05,3.06],["c",0,.24,.18,.48,.51,.63],["c",.18,.06,.54,.15,.75,.15],["c",.21,0,.36,.06,.42,.18],["c",.12,.18,.06,.42,-.12,.54],["c",-.09,.03,-.15,.03,-.78,0],["c",-1.98,-.15,-3.81,-.15,-5.79,0],["c",-.63,.03,-.69,.03,-.78,0],["c",-.24,-.15,-.24,-.57,.03,-.66],["c",.06,-.03,.48,-.09,.99,-.12],["c",.87,-.06,1.11,-.09,1.35,-.21],["c",.18,-.06,.33,-.18,.39,-.3],["c",.06,-.12,3.24,-9.42,3.27,-9.6],["c",.06,-.33,.03,-.57,-.15,-.69],["c",-.09,-.06,-.12,-.06,-.3,-.06],["c",-.69,.06,-1.53,1.02,-2.28,2.61],["c",-.09,.21,-.21,.45,-.27,.51],["c",-.09,.12,-.33,.24,-.48,.24],["c",-.18,0,-.36,-.15,-.36,-.3],["c",0,-.24,.78,-1.83,1.26,-2.55],["c",.72,-1.11,1.47,-1.74,2.28,-1.92],["z"],["m",5.37,1.47],["c",-.27,-.12,-.75,-.03,-1.14,.21],["c",-.75,.48,-1.47,1.68,-1.89,3.15],["c",-.45,1.47,-.42,2.34,0,2.7],["c",.45,.39,1.26,.21,1.83,-.36],["c",.51,-.51,.99,-1.68,1.38,-3.27],["c",.3,-1.17,.33,-1.74,.15,-2.13],["c",-.09,-.15,-.15,-.21,-.33,-.3],["z"]],w:14.689,h:13.127},r:{d:[["M",6.33,-9.12],["c",.27,-.03,.93,0,1.2,.06],["c",.84,.21,1.23,.81,1.02,1.53],["c",-.24,.75,-.9,1.17,-1.56,.96],["c",-.33,-.09,-.51,-.3,-.66,-.75],["c",-.03,-.12,-.09,-.24,-.12,-.3],["c",-.09,-.15,-.3,-.24,-.48,-.24],["c",-.57,0,-1.38,.54,-1.65,1.08],["c",-.06,.15,-.33,1.17,-.9,3.27],["c",-.57,2.31,-.81,3.12,-.87,3.21],["c",-.03,.06,-.12,.15,-.18,.21],["l",-.12,.06],["l",-.81,.03],["c",-.69,0,-.81,0,-.9,-.03],["c",-.09,-.06,-.18,-.21,-.18,-.3],["c",0,-.06,.39,-1.62,.9,-3.51],["c",.84,-3.24,.87,-3.45,.87,-3.72],["c",0,-.21,0,-.27,-.03,-.36],["c",-.12,-.15,-.21,-.24,-.42,-.24],["c",-.24,0,-.45,.15,-.78,.42],["c",-.33,.36,-.45,.54,-.72,1.14],["c",-.03,.12,-.21,.24,-.36,.27],["c",-.12,0,-.15,0,-.24,-.06],["c",-.18,-.12,-.18,-.21,-.06,-.54],["c",.21,-.57,.42,-.93,.78,-1.32],["c",.54,-.51,1.2,-.81,1.95,-.87],["c",.81,-.03,1.53,.3,1.92,.87],["l",.12,.18],["l",.09,-.09],["c",.57,-.45,1.41,-.84,2.19,-.96],["z"]],w:9.41,h:9.132},s:{d:[["M",4.47,-8.73],["c",.09,0,.36,-.03,.57,-.03],["c",.75,.03,1.29,.24,1.71,.63],["c",.51,.54,.66,1.26,.36,1.83],["c",-.24,.42,-.63,.57,-1.11,.42],["c",-.33,-.09,-.6,-.36,-.6,-.57],["c",0,-.03,.06,-.21,.15,-.39],["c",.12,-.21,.15,-.33,.18,-.48],["c",0,-.24,-.06,-.48,-.15,-.6],["c",-.15,-.21,-.42,-.24,-.75,-.15],["c",-.27,.06,-.48,.18,-.69,.36],["c",-.39,.39,-.51,.96,-.33,1.38],["c",.09,.21,.42,.51,.78,.72],["c",1.11,.69,1.59,1.11,1.89,1.68],["c",.21,.39,.24,.78,.15,1.29],["c",-.18,1.2,-1.17,2.16,-2.52,2.52],["c",-1.02,.24,-1.95,.12,-2.7,-.42],["c",-.72,-.51,-.99,-1.47,-.6,-2.19],["c",.24,-.48,.72,-.63,1.17,-.42],["c",.33,.18,.54,.45,.57,.81],["c",0,.21,-.03,.3,-.33,.51],["c",-.33,.24,-.39,.42,-.27,.69],["c",.06,.15,.21,.27,.45,.33],["c",.3,.09,.87,.09,1.2,0],["c",.75,-.21,1.23,-.72,1.29,-1.35],["c",.03,-.42,-.15,-.81,-.54,-1.2],["c",-.24,-.24,-.48,-.42,-1.41,-1.02],["c",-.69,-.42,-1.05,-.93,-1.05,-1.47],["c",0,-.39,.12,-.87,.3,-1.23],["c",.27,-.57,.78,-1.05,1.38,-1.35],["c",.24,-.12,.63,-.27,.9,-.3],["z"]],w:6.632,h:8.758},z:{d:[["M",2.64,-7.95],["c",.36,-.09,.81,-.03,1.71,.27],["c",.78,.21,.96,.27,1.74,.3],["c",.87,.06,1.02,.03,1.38,-.21],["c",.21,-.15,.33,-.15,.48,-.06],["c",.15,.09,.21,.3,.15,.45],["c",-.03,.06,-1.26,1.26,-2.76,2.67],["l",-2.73,2.55],["l",.54,.03],["c",.54,.03,.72,.03,2.01,.15],["c",.36,.03,.9,.06,1.2,.09],["c",.66,0,.81,-.03,1.02,-.24],["c",.3,-.3,.39,-.72,.27,-1.23],["c",-.06,-.27,-.06,-.27,-.03,-.39],["c",.15,-.3,.54,-.27,.69,.03],["c",.15,.33,.27,1.02,.27,1.5],["c",0,1.47,-1.11,2.7,-2.52,2.79],["c",-.57,.03,-1.02,-.09,-2.01,-.51],["c",-1.02,-.42,-1.23,-.48,-2.13,-.54],["c",-.81,-.06,-.96,-.03,-1.26,.18],["c",-.12,.06,-.24,.12,-.27,.12],["c",-.27,0,-.45,-.3,-.36,-.51],["c",.03,-.06,1.32,-1.32,2.91,-2.79],["l",2.88,-2.73],["c",-.03,0,-.21,.03,-.42,.06],["c",-.21,.03,-.78,.09,-1.23,.12],["c",-1.11,.12,-1.23,.15,-1.95,.27],["c",-.72,.15,-1.17,.18,-1.29,.09],["c",-.27,-.18,-.21,-.75,.12,-1.26],["c",.39,-.6,.93,-1.02,1.59,-1.2],["z"]],w:8.573,h:8.743},"+":{d:[["M",3.48,-9.3],["c",.18,-.09,.36,-.09,.54,0],["c",.18,.09,.24,.15,.33,.3],["l",.06,.15],["l",0,1.29],["l",0,1.29],["l",1.29,0],["c",1.23,0,1.29,0,1.41,.06],["c",.06,.03,.15,.09,.18,.12],["c",.12,.09,.21,.33,.21,.48],["c",0,.15,-.09,.39,-.21,.48],["c",-.03,.03,-.12,.09,-.18,.12],["c",-.12,.06,-.18,.06,-1.41,.06],["l",-1.29,0],["l",0,1.29],["c",0,1.23,0,1.29,-.06,1.41],["c",-.09,.18,-.15,.24,-.3,.33],["c",-.21,.09,-.39,.09,-.57,0],["c",-.18,-.09,-.24,-.15,-.33,-.33],["c",-.06,-.12,-.06,-.18,-.06,-1.41],["l",0,-1.29],["l",-1.29,0],["c",-1.23,0,-1.29,0,-1.41,-.06],["c",-.18,-.09,-.24,-.15,-.33,-.33],["c",-.09,-.18,-.09,-.36,0,-.54],["c",.09,-.18,.15,-.24,.33,-.33],["l",.15,-.06],["l",1.26,0],["l",1.29,0],["l",0,-1.29],["c",0,-1.23,0,-1.29,.06,-1.41],["c",.09,-.18,.15,-.24,.33,-.33],["z"]],w:7.507,h:7.515},",":{d:[["M",1.85,-3.36],["c",.57,-.15,1.17,.03,1.59,.45],["c",.45,.45,.6,.96,.51,1.89],["c",-.09,1.23,-.42,2.46,-.99,3.93],["c",-.3,.72,-.72,1.62,-.78,1.68],["c",-.18,.21,-.51,.18,-.66,-.06],["c",-.03,-.06,-.06,-.15,-.06,-.18],["c",0,-.06,.12,-.33,.24,-.63],["c",.84,-1.8,1.02,-2.61,.69,-3.24],["c",-.12,-.24,-.27,-.36,-.75,-.6],["c",-.36,-.15,-.42,-.21,-.6,-.39],["c",-.69,-.69,-.69,-1.71,0,-2.4],["c",.21,-.21,.51,-.39,.81,-.45],["z"]],w:3.452,h:8.143},"-":{d:[["M",.18,-5.34],["c",.09,-.06,.15,-.06,2.31,-.06],["c",2.46,0,2.37,0,2.46,.21],["c",.12,.21,.03,.42,-.15,.54],["c",-.09,.06,-.15,.06,-2.28,.06],["c",-2.16,0,-2.22,0,-2.31,-.06],["c",-.27,-.15,-.27,-.54,-.03,-.69],["z"]],w:5.001,h:.81},".":{d:[["M",1.32,-3.36],["c",1.05,-.27,2.1,.57,2.1,1.65],["c",0,1.08,-1.05,1.92,-2.1,1.65],["c",-.9,-.21,-1.5,-1.14,-1.26,-2.04],["c",.12,-.63,.63,-1.11,1.26,-1.26],["z"]],w:3.413,h:3.402},"scripts.wedge":{d:[["M",-3.66,-7.44],["c",.06,-.09,0,-.09,.81,.03],["c",1.86,.3,3.84,.3,5.73,0],["c",.78,-.12,.72,-.12,.78,-.03],["c",.15,.15,.12,.24,-.24,.6],["c",-.93,.93,-1.98,2.76,-2.67,4.62],["c",-.3,.78,-.51,1.71,-.51,2.13],["c",0,.15,0,.18,-.06,.27],["c",-.12,.09,-.24,.09,-.36,0],["c",-.06,-.09,-.06,-.12,-.06,-.27],["c",0,-.42,-.21,-1.35,-.51,-2.13],["c",-.69,-1.86,-1.74,-3.69,-2.67,-4.62],["c",-.36,-.36,-.39,-.45,-.24,-.6],["z"]],w:7.49,h:7.752},"scripts.thumb":{d:[["M",-.54,-3.69],["c",.15,-.03,.36,-.06,.51,-.06],["c",1.44,0,2.58,1.11,2.94,2.85],["c",.09,.48,.09,1.32,0,1.8],["c",-.27,1.41,-1.08,2.43,-2.16,2.73],["l",-.18,.06],["l",0,.12],["c",.03,.06,.06,.45,.09,.87],["c",.03,.57,.03,.78,0,.84],["c",-.09,.27,-.39,.48,-.66,.48],["c",-.27,0,-.57,-.21,-.66,-.48],["c",-.03,-.06,-.03,-.27,0,-.84],["c",.03,-.42,.06,-.81,.09,-.87],["l",0,-.12],["l",-.18,-.06],["c",-1.08,-.3,-1.89,-1.32,-2.16,-2.73],["c",-.09,-.48,-.09,-1.32,0,-1.8],["c",.15,-.84,.51,-1.53,1.02,-2.04],["c",.39,-.39,.84,-.63,1.35,-.75],["z"],["m",1.05,.9],["c",-.15,-.09,-.21,-.09,-.45,-.12],["c",-.15,0,-.3,.03,-.39,.03],["c",-.57,.18,-.9,.72,-1.08,1.74],["c",-.06,.48,-.06,1.8,0,2.28],["c",.15,.9,.42,1.44,.9,1.65],["c",.18,.09,.21,.09,.51,.09],["c",.3,0,.33,0,.51,-.09],["c",.48,-.21,.75,-.75,.9,-1.65],["c",.03,-.27,.03,-.54,.03,-1.14],["c",0,-.6,0,-.87,-.03,-1.14],["c",-.15,-.9,-.45,-1.44,-.9,-1.65],["z"]],w:5.955,h:9.75},"scripts.open":{d:[["M",-.54,-3.69],["c",.15,-.03,.36,-.06,.51,-.06],["c",1.44,0,2.58,1.11,2.94,2.85],["c",.09,.48,.09,1.32,0,1.8],["c",-.33,1.74,-1.47,2.85,-2.91,2.85],["c",-1.44,0,-2.58,-1.11,-2.91,-2.85],["c",-.09,-.48,-.09,-1.32,0,-1.8],["c",.15,-.84,.51,-1.53,1.02,-2.04],["c",.39,-.39,.84,-.63,1.35,-.75],["z"],["m",1.11,.9],["c",-.21,-.09,-.27,-.09,-.51,-.12],["c",-.3,0,-.42,.03,-.66,.15],["c",-.24,.12,-.51,.39,-.66,.63],["c",-.54,.93,-.63,2.64,-.21,3.81],["c",.21,.54,.51,.9,.93,1.11],["c",.21,.09,.24,.09,.54,.09],["c",.3,0,.33,0,.54,-.09],["c",.42,-.21,.72,-.57,.93,-1.11],["c",.36,-.99,.36,-2.37,0,-3.36],["c",-.21,-.54,-.51,-.9,-.9,-1.11],["z"]],w:5.955,h:7.5},"scripts.longphrase":{d:[["M",1.47,-15.09],["c",.36,-.09,.66,-.18,.69,-.18],["c",.06,0,.06,.54,.06,11.25],["l",0,11.25],["l",-.63,.15],["c",-.66,.18,-1.44,.39,-1.5,.39],["c",-.03,0,-.03,-3.39,-.03,-11.25],["l",0,-11.25],["l",.36,-.09],["c",.21,-.06,.66,-.18,1.05,-.27],["z"]],w:2.16,h:23.04},"scripts.mediumphrase":{d:[["M",1.47,-7.59],["c",.36,-.09,.66,-.18,.69,-.18],["c",.06,0,.06,.39,.06,7.5],["l",0,7.5],["l",-.63,.15],["c",-.66,.18,-1.44,.39,-1.5,.39],["c",-.03,0,-.03,-2.28,-.03,-7.5],["l",0,-7.5],["l",.36,-.09],["c",.21,-.06,.66,-.18,1.05,-.27],["z"]],w:2.16,h:15.54},"scripts.shortphrase":{d:[["M",1.47,-7.59],["c",.36,-.09,.66,-.18,.69,-.18],["c",.06,0,.06,.21,.06,3.75],["l",0,3.75],["l",-.42,.09],["c",-.57,.18,-1.65,.45,-1.71,.45],["c",-.03,0,-.03,-.72,-.03,-3.75],["l",0,-3.75],["l",.36,-.09],["c",.21,-.06,.66,-.18,1.05,-.27],["z"]],w:2.16,h:8.04},"scripts.snap":{d:[["M",4.5,-3.39],["c",.36,-.03,.96,-.03,1.35,0],["c",1.56,.15,3.15,.9,4.2,2.01],["c",.24,.27,.33,.42,.33,.6],["c",0,.27,.03,.24,-2.46,2.22],["c",-1.29,1.02,-2.4,1.86,-2.49,1.92],["c",-.18,.09,-.3,.09,-.48,0],["c",-.09,-.06,-1.2,-.9,-2.49,-1.92],["c",-2.49,-1.98,-2.46,-1.95,-2.46,-2.22],["c",0,-.18,.09,-.33,.33,-.6],["c",1.05,-1.08,2.64,-1.86,4.17,-2.01],["z"],["m",1.29,1.17],["c",-1.47,-.15,-2.97,.3,-4.14,1.2],["l",-.18,.15],["l",.06,.09],["c",.15,.12,3.63,2.85,3.66,2.85],["c",.03,0,3.51,-2.73,3.66,-2.85],["l",.06,-.09],["l",-.18,-.15],["c",-.84,-.66,-1.89,-1.08,-2.94,-1.2],["z"]],w:10.38,h:6.84},"noteheads.slash.whole":{d:[["M",5,-5],["l",1,1],["l",-5,5],["l",-1,-1],["z"],["m",4,6],["l",-5,-5],["l",2,-2],["l",5,5],["z"],["m",0,-2],["l",1,1],["l",-5,5],["l",-1,-1],["z"],["m",-4,6],["l",-5,-5],["l",2,-2],["l",5,5],["z"]],w:10.81,h:15.63},"noteheads.slash.quarter":{d:[["M",9,-6],["l",0,4],["l",-9,9],["l",0,-4],["z"]],w:9,h:9},"noteheads.harmonic.quarter":{d:[["M",3.63,-4.02],["c",.09,-.06,.18,-.09,.24,-.03],["c",.03,.03,.87,.93,1.83,2.01],["c",1.5,1.65,1.8,1.98,1.8,2.04],["c",0,.06,-.3,.39,-1.8,2.04],["c",-.96,1.08,-1.8,1.98,-1.83,2.01],["c",-.06,.06,-.15,.03,-.24,-.03],["c",-.12,-.09,-3.54,-3.84,-3.6,-3.93],["c",-.03,-.03,-.03,-.09,-.03,-.15],["c",.03,-.06,3.45,-3.84,3.63,-3.96],["z"]],w:7.5,h:8.165},"noteheads.triangle.quarter":{d:[["M",0,4],["l",9,0],["l",-4.5,-9],["z"]],w:9,h:9}},n=function(e){for(var t=[],n=0,r=e.length;n<r;n++){t[n]=[];for(var i=0,a=e[n].length;i<a;i++)t[n][i]=e[n][i]}return t};return wf={printSymbol:function(e,r,i,a,s){if(!t[i])return null;var o=n(t[i].d);o[0][1]+=e,o[0][2]+=r;for(var c="",l=0;l<o.length;l++)c+=o[l].join(" ");return s.path=c,a.path(s)},getPathForSymbol:function(e,r,i,a,s){if(a=a||1,s=s||1,!t[i])return null;var o=n(t[i].d);return 1===a&&1===s||function(e,t,n){for(var r=0,i=e.length;r<i;r++){var a,s,o=e[r];for(a=1,s=o.length;a<s;a++)o[a]*=a%2?t:n}}(o,a,s),o[0][1]+=e,o[0][2]+=r,o},getSymbolWidth:function(e){return t[e]?t[e].w:0},symbolHeightInPitches:function(n){return(t[n]?t[n].h:0)/e.STEP},getSymbolAlign:function(e){return"scripts"===e.substring(0,7)&&"scripts.roll"!==e?"center":"left"},getYCorr:function(e){switch(e){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"flags.d64th":case"scripts.trill":case"scripts.upbow":case"scripts.downbow":return-2;case"timesig.common":case"timesig.cut":default:return 0;case"flags.d32nd":case"rests.half":case"rests.8th":case"rests.quarter":case"rests.16th":case"rests.32nd":case"rests.64th":case"scripts.ufermata":case"scripts.wedge":case"scripts.roll":case"scripts.shortphrase":case"scripts.longphrase":return-1;case"flags.u32nd":case"rests.whole":case"scripts.dfermata":return 1;case"flags.u64th":return 3;case"f":case"m":case"p":case"s":case"z":return-4}},setSymbol:function(e,n){t[e]=n}}}function Av(){if(Vf)return Rf;Vf=1;var e=function(e){this.type="TieElem",this.anchor1=e.anchor1,this.anchor2=e.anchor2,e.isGrace&&(this.isGrace=!0),e.fixedY&&(this.fixedY=!0),e.stemDir&&(this.stemDir=e.stemDir),void 0!==e.voiceNumber&&(this.voiceNumber=e.voiceNumber),void 0!==e.style&&(this.dotted=!0),this.internalNotes=[]};return e.prototype.addInternalNote=function(e){this.internalNotes.push(e)},e.prototype.setEndAnchor=function(e){this.anchor2=e,this.anchor1?(this.top=Math.max(this.anchor1.pitch,this.anchor2.pitch)+4,this.bottom=Math.min(this.anchor1.pitch,this.anchor2.pitch)-4):(this.top=this.anchor2.pitch+4,this.bottom=this.anchor2.pitch-4)},e.prototype.setStartX=function(e){this.startLimitX=e},e.prototype.setEndX=function(e){this.endLimitX=e},e.prototype.setHint=function(){this.hint=!0},e.prototype.calcTieDirection=function(){if(this.isGrace)this.above=!1;else if(0===this.voiceNumber)this.above=!0;else if(this.voiceNumber>0)this.above=!1;else{var e;e=this.anchor1?this.anchor1.pitch:this.anchor2?this.anchor2.pitch:14,this.anchor1&&"down"===this.anchor1.stemDir&&this.anchor2&&"down"===this.anchor2.stemDir?this.above=!0:this.anchor1&&"up"===this.anchor1.stemDir&&this.anchor2&&"up"===this.anchor2.stemDir?this.above=!1:this.anchor1&&this.anchor2?this.above=e>=6:this.anchor1?this.above="down"===this.anchor1.stemDir:this.anchor2?this.above="down"===this.anchor2.stemDir:this.above=e>=6}},e.prototype.calcSlurDirection=function(){if(this.isGrace)this.above=!1;else if(0===this.voiceNumber)this.above=!0;else if(this.voiceNumber>0)this.above=!1;else{var e=!1;this.anchor1&&"down"===this.anchor1.stemDir&&(e=!0),this.anchor2&&"down"===this.anchor2.stemDir&&(e=!0);for(var t=0;t<this.internalNotes.length;t++)"down"===this.internalNotes[t].stemDir&&(e=!0);this.above=e}},e.prototype.calcX=function(e,t){this.anchor1?(this.startX=this.anchor1.x,this.anchor1.scalex<1&&(this.startX-=3)):this.startLimitX?this.startX=this.startLimitX.x+this.startLimitX.w:this.anchor2?this.startX=this.anchor2.x-20:this.startX=e,!this.anchor1&&this.dotted&&(this.startX-=3),this.anchor2?this.endX=this.anchor2.x:this.endLimitX?this.endX=this.endLimitX.x:this.endX=t},e.prototype.calcTieY=function(){this.anchor1?this.startY=this.anchor1.pitch:this.anchor2?this.startY=this.anchor2.pitch:this.startY=this.above?14:0,this.anchor2?this.endY=this.anchor2.pitch:this.anchor1?this.endY=this.anchor1.pitch:this.endY=this.above?14:0},e.prototype.calcSlurY=function(){if(this.anchor1&&this.anchor2){this.above&&"up"===this.anchor1.stemDir&&!this.fixedY?(this.startY=(this.anchor1.highestVert+this.anchor1.pitch)/2,this.startX+=this.anchor1.w/2):this.startY=this.anchor1.pitch;var e=this.anchor2.parent.beam&&this.anchor2.parent.beam.stemsUp&&this.anchor2.parent.beam.elems[0]!==this.anchor2.parent,t=(this.anchor2.highestVert+this.anchor2.pitch)/2;if(this.above&&"up"===this.anchor2.stemDir&&!this.fixedY&&!e&&t<this.startY?(this.endY=t,this.endX+=Math.round(this.anchor2.w/2)):this.endY=this.above&&e?this.anchor2.highestVert:this.anchor2.pitch,1===this.anchor1.scalex){var n=!!this.anchor1.parent.beam,r=!!this.anchor2.parent.beam;n&&(this.anchor1.parent===this.anchor1.parent.beam.elems[this.anchor1.parent.beam.elems.length-1]||(this.above?this.startY=this.anchor1.parent.fixed.t:this.startY=this.anchor1.parent.fixed.b)),r&&(this.anchor2.parent===this.anchor2.parent.beam.elems[0]||(this.above?this.endY=this.anchor2.parent.fixed.t:this.endY=this.anchor2.parent.fixed.b))}}else this.anchor1?this.startY=this.endY=this.anchor1.pitch:this.anchor2?this.startY=this.endY=this.anchor2.pitch:(this.startY=this.above?14:0,this.endY=this.above?14:0)},e.prototype.avoidCollisionAbove=function(){if(this.above){for(var e=-50,t=0;t<this.internalNotes.length;t++)this.internalNotes[t].highestVert>e&&(e=this.internalNotes[t].highestVert);e>this.startY&&e>this.endY&&(this.startY=this.endY=e-1)}},e.prototype.getYBounds=function(){var e,t;return this.isTie?(this.calcTieDirection(),this.calcX(10,1e3),this.calcTieY()):(this.calcSlurDirection(),this.calcX(10,1e3),this.calcSlurY()),this.above?e=(t=Math.min(this.startY,this.endY))+3:t=(e=Math.min(this.startY,this.endY))-3,[e,t]},Rf=e}function Pv(){if(zf)return Ff;zf=1;var e=Nf?If:(Nf=1,If=function(e,t,n){this.type="DynamicDecoration",this.anchor=e,this.dec=t,"below"===n?this.volumeHeightBelow=6:this.volumeHeightAbove=6,this.pitch=void 0}),t=Of?Df:(Of=1,Df=function(e,t,n,r){this.type="CrescendoElem",this.anchor1=e,this.anchor2=t,this.dir=n,"above"===r?this.dynamicHeightAbove=6:this.dynamicHeightBelow=6,this.pitch=void 0}),n=Bf?Lf:(Bf=1,Lf=function(e,t){this.type="GlissandoElem",this.anchor1=e,this.anchor2=t}),r=Tv(),i=wv(),a=Av(),s=function(){this.startDiminuendoX=void 0,this.startCrescendoX=void 0,this.minTop=12,this.minBottom=0};return s.prototype.dynamicDecoration=function(e,r,i,a){for(var s,o,c,l=0;l<r.length;l++)switch(r[l]){case"diminuendo(":this.startDiminuendoX=i,s=void 0;break;case"diminuendo)":s={start:this.startDiminuendoX,stop:i},this.startDiminuendoX=void 0;break;case"crescendo(":this.startCrescendoX=i,o=void 0;break;case"crescendo)":o={start:this.startCrescendoX,stop:i},this.startCrescendoX=void 0;break;case"~(":case"glissando(":this.startGlissandoX=i,c=void 0;break;case"~)":case"glissando)":c={start:this.startGlissandoX,stop:i},this.startGlissandoX=void 0}s&&e.addOther(new t(s.start,s.stop,">",a)),o&&e.addOther(new t(o.start,o.stop,"<",a)),c&&e.addOther(new n(c.start,c.stop))},s.prototype.createDecoration=function(t,n,s,o,c,l,u,h,d,f,p){d||(d={ornamentPosition:"above",volumePosition:f?"above":"below",dynamicPosition:f?"above":"below"}),function(t,n,r,i){for(var a=0;a<n.length;a++)switch(n[a]){case"p":case"mp":case"pp":case"ppp":case"pppp":case"f":case"ff":case"fff":case"ffff":case"sfz":case"mf":var s=new e(r,n[a],i);t.addOther(s)}}(t,n,c,d.volumePosition),this.dynamicDecoration(t,n,c,d.dynamicPosition),function(e,t,n,a,s){function o(e,t){var o="down"===s?function(){if(0===a.heads.length)return 2;for(var e=a.heads[0].pitch,t=1;t<a.heads.length;t++)e=Math.min(e,a.heads[t].pitch);return e}()+1:function(){if(0===a.heads.length)return 10;for(var e=a.heads[0].pitch,t=1;t<a.heads.length;t++)e=Math.max(e,a.heads[t].pitch);return e}()+9;"down"!==s&&1===t&&o--;var c=n/2;c+="down"===s?-5:3;for(var l=0;l<t;l++)o-=1,a.addFixedX(new i(e,c,r.getSymbolWidth(e),o))}for(var c=0;c<e.length;c++)switch(e[c]){case"/":o("flags.ugrace",1);break;case"//":o("flags.ugrace",2);break;case"///":o("flags.ugrace",3);break;case"////":o("flags.ugrace",4)}}(n,0,o,c,u);var m=function(e,t,n,s,o,c,l,u,h){for(var d,f=0;f<t.length;f++){if("staccato"===t[f]||"tenuto"===t[f]||"accent"===t[f]&&!h){var p="scripts."+t[f];if("accent"===t[f]&&(p="scripts.sforzato"),d=void 0===d?"down"===l?n+2:u-2:"down"===l?d+2:d-2,"accent"===t[f])"up"===l?d--:d++;else switch(d){case 2:case 4:case 6:case 8:case 10:"up"===l?d--:d++}n>9&&d++;var m=s/2;"center"!==r.getSymbolAlign(p)&&(m-=r.getSymbolWidth(p)/2),o.addFixedX(new i(p,m,r.getSymbolWidth(p),d))}if("slide"===t[f]&&o.heads[0]){var g=o.heads[0].pitch,v=new i("",-c-15,0,(g-=2)-1),y=new i("",-c-5,0,g+1);o.addFixedX(v),o.addFixedX(y),e.addOther(new a({anchor1:v,anchor2:y,fixedY:!0}))}}return void 0===d&&(d=n),{above:d,below:o.bottom}}(t,n,s,o,c,l,u,h,p);m.above=Math.max(m.above,this.minTop),m.below=Math.min(m.below,h),function(e,t,n,a,s,o,c,l){function u(e,t){"above"===e?a.above+=t:a.below-=t}function h(e){var t;return"above"===e?(t=a.above)<o&&(t=o):(t=a.below)>c&&(t=c),t}function d(e,r,a){var s=h(r);n.addFixedX(new i(e,t/2,0,s+2,{type:"decoration",klass:"ornament",thickness:3,anchor:a})),u(r,5)}function f(e,a){var s=t/2;"center"!==r.getSymbolAlign(e)&&(s-=r.getSymbolWidth(e)/2);var o=r.symbolHeightInPitches(e)+1,c=h(a);c="above"===a?c+o/2:c-o/2,n.addFixedX(new i(e,s,r.getSymbolWidth(e),c,{klass:"ornament",thickness:r.symbolHeightInPitches(e),position:a})),u(a,o)}for(var p={"+":"scripts.stopped",open:"scripts.open",snap:"scripts.snap",wedge:"scripts.wedge",thumb:"scripts.thumb",shortphrase:"scripts.shortphrase",mediumphrase:"scripts.mediumphrase",longphrase:"scripts.longphrase",trill:"scripts.trill",roll:"scripts.roll",irishroll:"scripts.roll",marcato:"scripts.umarcato",dmarcato:"scripts.dmarcato",umarcato:"scripts.umarcato",turn:"scripts.turn",uppermordent:"scripts.prall",pralltriller:"scripts.prall",mordent:"scripts.mordent",lowermordent:"scripts.mordent",downbow:"scripts.downbow",upbow:"scripts.upbow",fermata:"scripts.ufermata",invertedfermata:"scripts.dfermata",breath:",",coda:"scripts.coda",segno:"scripts.segno"},m=0;m<e.length;m++)switch(e[m]){case"0":case"1":case"2":case"3":case"4":case"5":case"D.C.":case"D.S.":d(e[m],s,"middle");break;case"D.C.alcoda":d("D.C. al coda",s,"end");break;case"D.C.alfine":d("D.C. al fine",s,"end");break;case"D.S.alcoda":d("D.S. al coda",s,"end");break;case"D.S.alfine":d("D.S. al fine",s,"end");break;case"fine":d("FINE",s,"middle");break;case"+":case"open":case"snap":case"wedge":case"thumb":case"shortphrase":case"mediumphrase":case"longphrase":case"trill":case"roll":case"irishroll":case"marcato":case"dmarcato":case"turn":case"uppermordent":case"pralltriller":case"mordent":case"lowermordent":case"downbow":case"upbow":case"fermata":case"breath":case"umarcato":case"coda":case"segno":f(p[e[m]],s);break;case"invertedfermata":f(p[e[m]],"below");break;case"mark":n.klass="mark";break;case"accent":l&&(f("scripts.sforzato",s),!0)}}(n,o,c,m,d.ornamentPosition,this.minTop,h,p),function(e,t,n){for(var a=0;a<e.length;a++)if("arpeggio"===e[a])for(var s=t.abcelem.minpitch-1;s<=t.abcelem.maxpitch;s+=2)t.addExtra(new i("scripts.arpeggio",2*-r.getSymbolWidth("scripts.arpeggio")-n,0,s+2,{klass:"ornament",thickness:r.symbolHeightInPitches("scripts.arpeggio")}))}(n,c,l)},Ff=s}function Iv(){if(np)return tp;np=1;var e=_v(),t=function(){if(yf)return vf;yf=1;var e=function(e,t,n,r){this.type="BeamElem",this.isflat=!!n,this.isgrace=!(!t||"grace"!==t),this.forceup=!!(this.isgrace||t&&"up"===t),this.forcedown=!(!t||"down"!==t),this.elems=[],this.total=0,this.average=6,this.allrests=!0,this.stemHeight=e,this.beams=[],r&&r.duration?(this.duration=r.duration,r.startTriplet&&(this.duration*=r.tripletMultiplier),this.duration=Math.round(1e3*this.duration)/1e3):this.duration=0};function t(e,t){return t?e/t:0}return e.prototype.setHint=function(){this.hint=!0},e.prototype.runningDirection=function(e){var t=e.averagepitch;void 0!==t&&(this.total=Math.round(this.total+t),this.count||(this.count=0),this.count++)},e.prototype.add=function(e){var t=e.abcelem.averagepitch;void 0!==t&&(e.abcelem.rest||(this.allrests=!1),e.beam=this,this.elems.push(e),this.total=Math.round(this.total+t),(void 0===this.min||e.abcelem.minpitch<this.min)&&(this.min=e.abcelem.minpitch),(void 0===this.max||e.abcelem.maxpitch>this.max)&&(this.max=e.abcelem.maxpitch))},e.prototype.addBeam=function(e){this.beams.push(e)},e.prototype.setStemDirection=function(){this.average=t(this.total,this.count),this.forceup?this.stemsUp=!0:this.forcedown?this.stemsUp=!1:this.stemsUp=this.average<6,delete this.count,this.total=0},e.prototype.calcDir=function(){this.average=t(this.total,this.elems.length),this.forceup?this.stemsUp=!0:this.forcedown?this.stemsUp=!1:this.stemsUp=this.average<6;for(var e=this.stemsUp?"up":"down",n=0;n<this.elems.length;n++)for(var r=0;r<this.elems[n].heads.length;r++)this.elems[n].heads[r].stemDir=e},vf=e}(),n=function(){if(_f)return bf;_f=1;var e=function(e,t){this.startVoice=e,this.type=t};return e.prototype.setBottomStaff=function(e){this.endVoice=e,this.startVoice.header&&!this.endVoice.header&&(this.header=this.startVoice.header,delete this.startVoice.header)},e.prototype.continuing=function(e){this.lastContinuedVoice=e},e.prototype.getWidth=function(){return 10},e.prototype.isStartVoice=function(e){return!!(this.startVoice&&this.startVoice.staff&&this.startVoice.staff.voices.length>0&&this.startVoice.staff.voices[0]===e)},bf=e}(),r=function(){if(Sf)return kf;Sf=1;var e=_v(),t=Tv(),n=wv();return kf=function(r,i){var a,s=0;r.el_type="clef";var o=new e(r,0,10,"staff-extra clef",i);switch(o.isClef=!0,r.type){case"treble":a="clefs.G";break;case"tenor":case"alto":a="clefs.C";break;case"bass":a="clefs.F";break;case"treble+8":a="clefs.G",s=1;break;case"tenor+8":case"alto+8":a="clefs.C",s=1;break;case"bass+8":a="clefs.F",s=1;break;case"treble-8":a="clefs.G",s=-1;break;case"tenor-8":case"alto-8":a="clefs.C",s=-1;break;case"bass-8":a="clefs.F",s=-1;break;case"none":return null;case"perc":a="clefs.perc";break;default:o.addFixed(new n("clef="+r.type,0,0,void 0,{type:"debug"}))}if(a){var c=t.symbolHeightInPitches(a),l=function(e){switch(e){case"clefs.G":return-5;case"clefs.C":case"clefs.F":return-4;case"clefs.perc":return-2;default:return 0}}(a);if(o.addRight(new n(a,5,t.getSymbolWidth(a),r.clefPos,{top:c+r.clefPos+l,bottom:r.clefPos+l})),0!==s){var u=2/3,h=(t.getSymbolWidth(a)-t.getSymbolWidth("8")*u)/2,d=s>0?o.top+3:o.bottom-1,f=s>0?o.top+3:o.bottom-3,p=f-2;"bass-8"===r.type&&(d=3,h=0),o.addRight(new n("8",5+h,t.getSymbolWidth("8")*u,d,{scalex:u,scaley:u,top:f,bottom:p}))}}return o}}(),i=function(){if(Mf)return Cf;Mf=1;var e=_v(),t=Tv(),n=wv();return Cf=function(r,i){if(r.el_type="keySignature",!r.accidentals||0===r.accidentals.length)return null;var a=new e(r,0,10,"staff-extra key-signature",i);a.isKeySig=!0;var s=0;return r.accidentals.forEach((function(e){var r,i=0;switch(e.acc){case"sharp":r="accidentals.sharp",i=-3;break;case"natural":r="accidentals.nat";break;case"flat":r="accidentals.flat",i=-1.2;break;case"quartersharp":r="accidentals.halfsharp",i=-2.5;break;case"quarterflat":r="accidentals.halfflat",i=-1.2;break;default:r="accidentals.flat"}a.addRight(new n(r,s,t.getSymbolWidth(r),e.verticalPos,{thickness:t.symbolHeightInPitches(r),top:e.verticalPos+t.symbolHeightInPitches(r)+i,bottom:e.verticalPos+i})),s+=t.getSymbolWidth(r)+2}),this),a}}(),a=function(){if(Tf)return Ef;Tf=1;var e=Tv(),t=wv();return Ef=function(n,r,i,a){a||(a={});var s,o=void 0!==a.dir?a.dir:null,c=void 0!==a.headx?a.headx:0,l=void 0!==a.extrax?a.extrax:0,u=void 0!==a.flag?a.flag:null,h=void 0!==a.dot?a.dot:0,d=void 0!==a.dotshiftx?a.dotshiftx:0,f=void 0!==a.scale?a.scale:1,p=void 0!==a.accidentalSlot?a.accidentalSlot:[],m=void 0!==a.shouldExtendStem&&a.shouldExtendStem,g=void 0===a.printAccidentals||a.printAccidentals,v=i.verticalPos,y=0,b=0,_=0;if(void 0===r)n.addFixed(new t("pitch is undefined",0,0,0,{type:"debug"}));else if(""===r)s=new t(null,0,0,v);else{var w=c;if(i.printer_shift){var x="same"===i.printer_shift?1:0;w="down"===o?-e.getSymbolWidth(r)*f+x:e.getSymbolWidth(r)*f-x}var k={scalex:f,scaley:f,thickness:e.symbolHeightInPitches(r)*f,name:i.name};if((s=new t(r,w,e.getSymbolWidth(r)*f,v,k)).stemDir=o,u){var S=v+("down"===o?-7:7)*f;m&&("down"===o&&S>6&&(S=6),"up"===o&&S<6&&(S=6));var C="down"===o?c:c+s.w-.6;n.addRight(new t(u,C,e.getSymbolWidth(u)*f,S,{scalex:f,scaley:f}))}for(b=s.w+d-2+5*h;h>0;h--){var M=1-Math.abs(v)%2;n.addRight(new t("dots.dot",s.w+d-2+5*h,e.getSymbolWidth("dots.dot"),v+M))}}if(s&&(s.highestVert=i.highestVert),g&&i.accidental){var E;switch(i.accidental){case"quartersharp":E="accidentals.halfsharp";break;case"dblsharp":E="accidentals.dblsharp";break;case"sharp":E="accidentals.sharp";break;case"quarterflat":E="accidentals.halfflat";break;case"flat":E="accidentals.flat";break;case"dblflat":E="accidentals.dblflat";break;case"natural":E="accidentals.nat"}for(var T=!1,A=l,P=0;P<p.length;P++)if(v-p[P][0]>=6){p[P][0]=v,A=p[P][1],T=!0;break}!1===T&&(A-=e.getSymbolWidth(E)*f+2,p.push([v,A]),y=e.getSymbolWidth(E)*f+2);var I=e.symbolHeightInPitches(E);n.addExtra(new t(E,A,e.getSymbolWidth(E),v,{scalex:f,scaley:f,top:v+I/2,bottom:v-I/2})),_=e.getSymbolWidth(E)/2}return{notehead:s,accidentalshiftx:y,dotshiftx:b,extraLeft:_}}}(),s=function(){if(Pf)return Af;Pf=1;var e=_v(),t=Tv(),n=wv();return Af=function(r,i){r.el_type="timeSignature";var a=new e(r,0,10,"staff-extra time-signature",i);if("specified"===r.type)for(var s=0,o=0;o<r.value.length;o++)if(0!==o&&(a.addRight(new n("+",s+1,t.getSymbolWidth("+"),6,{thickness:t.symbolHeightInPitches("+")})),s+=t.getSymbolWidth("+")+2),r.value[o].den){for(var c=0,l=0;l<r.value[o].num.length;l++)c+=t.getSymbolWidth(r.value[o].num[l]);var u=0;for(l=0;l<r.value[o].num.length;l++)u+=t.getSymbolWidth(r.value[o].den[l]);var h=Math.max(c,u);a.addRight(new n(r.value[o].num,s+(h-c)/2,c,8,{thickness:t.symbolHeightInPitches(r.value[o].num[0])})),a.addRight(new n(r.value[o].den,s+(h-u)/2,u,4,{thickness:t.symbolHeightInPitches(r.value[o].den[0])})),s+=h}else{for(var d=0,f=0;f<r.value[o].num.length;f++)d+=t.getSymbolWidth(r.value[o].num[f]);a.addRight(new n(r.value[o].num,s,d,6,{thickness:t.symbolHeightInPitches(r.value[o].num[0])})),s+=d}else"common_time"===r.type?a.addRight(new n("timesig.common",0,t.getSymbolWidth("timesig.common"),6,{thickness:t.symbolHeightInPitches("timesig.common")})):"cut_time"===r.type?a.addRight(new n("timesig.cut",0,t.getSymbolWidth("timesig.cut"),6,{thickness:t.symbolHeightInPitches("timesig.cut")})):"tempus_imperfectum"===r.type?a.addRight(new n("timesig.imperfectum",0,t.getSymbolWidth("timesig.imperfectum"),6,{thickness:t.symbolHeightInPitches("timesig.imperfectum")})):"tempus_imperfectum_prolatio"===r.type?a.addRight(new n("timesig.imperfectum2",0,t.getSymbolWidth("timesig.imperfectum2"),6,{thickness:t.symbolHeightInPitches("timesig.imperfectum2")})):"tempus_perfectum"===r.type?a.addRight(new n("timesig.perfectum",0,t.getSymbolWidth("timesig.perfectum"),6,{thickness:t.symbolHeightInPitches("timesig.perfectum")})):"tempus_perfectum_prolatio"===r.type?a.addRight(new n("timesig.perfectum2",0,t.getSymbolWidth("timesig.perfectum2"),6,{thickness:t.symbolHeightInPitches("timesig.perfectum2")})):console.log("time signature:",r);return a}}(),o=Pv(),c=qf?jf:(qf=1,jf=function(e,t,n){this.type="EndingElem",this.text=e,this.anchor1=t,this.anchor2=n,this.endingHeightAbove=5,this.pitch=void 0}),l=Tv(),u=wv(),h=hv(),d=function(){if(Wf)return Gf;Wf=1;var e=Uf?Hf:(Uf=1,Hf=function(e){for(var t=0,n=0;n<e.voices.length;n++){var r=e.voices[n].staff;e.voices[n].duplicate||(t+=r.top,t+=-r.bottom)}return t}),t=function(e){this.getTextSize=e,this.voices=[],this.staffs=[],this.brace=void 0,this.bracket=void 0};return t.prototype.setLimit=function(e,t){t.specialY[e]&&(t.staff.specialY[e]?t.staff.specialY[e]=Math.max(t.staff.specialY[e],t.specialY[e]):t.staff.specialY[e]=t.specialY[e])},t.prototype.addVoice=function(e,t,n){var r=this.voices.length;this.voices[r]=e,this.staffs[t]?this.staffs[t].voices.push(r):this.staffs[this.staffs.length]={top:10,bottom:2,lines:n,voices:[r],specialY:{tempoHeightAbove:0,partHeightAbove:0,volumeHeightAbove:0,dynamicHeightAbove:0,endingHeightAbove:0,chordHeightAbove:0,lyricHeightAbove:0,lyricHeightBelow:0,chordHeightBelow:0,volumeHeightBelow:0,dynamicHeightBelow:0}},e.staff=this.staffs[t]},t.prototype.setHeight=function(){this.height=e(this)},t.prototype.setWidth=function(e){this.w=e;for(var t=0;t<this.voices.length;t++)this.voices[t].setWidth(e)},t.prototype.setStaffLimits=function(e){e.staff.top=Math.max(e.staff.top,e.top),e.staff.bottom=Math.min(e.staff.bottom,e.bottom),this.setLimit("tempoHeightAbove",e),this.setLimit("partHeightAbove",e),this.setLimit("volumeHeightAbove",e),this.setLimit("dynamicHeightAbove",e),this.setLimit("endingHeightAbove",e),this.setLimit("chordHeightAbove",e),this.setLimit("lyricHeightAbove",e),this.setLimit("lyricHeightBelow",e),this.setLimit("chordHeightBelow",e),this.setLimit("volumeHeightBelow",e),this.setLimit("dynamicHeightBelow",e)},Gf=t}(),f=function(){if($f)return Yf;$f=1;var e=_v(),t=wv(),n=function(e,t,n){this.type="TempoElement",this.tempo=e,this.tempo.type="tempo",this.tuneNumber=t,this.totalHeightInPitches=6,this.tempoHeightAbove=this.totalHeightInPitches,this.pitch=void 0,this.tempo.duration&&!this.tempo.suppressBpm&&(this.note=this.createNote(n,e,t))};return n.prototype.setX=function(e){this.x=e},n.prototype.createNote=function(n,r,i){var a,s,o,c=r.duration[0],l=new e(r,c,1,"tempo",i);c<=1/32?(o="noteheads.quarter",s="flags.u32nd",a=0):c<=1/16?(o="noteheads.quarter",s="flags.u16th",a=0):c<=3/32?(o="noteheads.quarter",s="flags.u16nd",a=1):c<=1/8?(o="noteheads.quarter",s="flags.u8th",a=0):c<=3/16?(o="noteheads.quarter",s="flags.u8th",a=1):c<=1/4?(o="noteheads.quarter",a=0):c<=3/8?(o="noteheads.quarter",a=1):c<=.5?(o="noteheads.half",a=0):c<=3/4?(o="noteheads.half",a=1):c<=1?(o="noteheads.whole",a=0):c<=1.5?(o="noteheads.whole",a=1):c<=2?(o="noteheads.dbl",a=0):(o="noteheads.dbl",a=1);var u,h=n(l,o,{verticalPos:0},{dir:"up",flag:s,dot:a,scale:.75}).notehead;if(l.addHead(h),"noteheads.whole"!==o&&"noteheads.dbl"!==o){var d=h.dx+h.w;u=new t(null,d,0,.25,{type:"stem",pitch2:3.75,linewidth:-.6}),l.addRight(u)}return l},Yf=n}(),p=Av(),m=function(){if(Qf)return Kf;Qf=1;var e=function(e,t,n){this.type="TripletElem",this.anchor1=t,this.number=e,this.durationClass=("d"+Math.round(1e3*t.parent.durationClass)/1e3).replace(/\./,"-"),this.middleElems=[],this.flatBeams=n.flatBeams};return e.prototype.isClosed=function(){return!!this.anchor2},e.prototype.middleNote=function(e){this.middleElems.push(e)},e.prototype.setCloseAnchor=function(e){this.anchor2=e,this.anchor1.parent.beam&&"up"!==this.anchor1.stemDir||(this.endingHeightAbove=4)},Kf=e}(),g=gv(),v=function(){if(ep)return Jf;ep=1;var e=wv(),t=hv();const n=function(){if(Zf)return Xf;function e(e){switch(e){case"B#":return"H#";case"B♯":return"H♯";case"B":return"H";case"Bb":case"B♭":return"B"}return e}return Zf=1,Xf=function(t,n,r){var i=t.split("\n");for(let a=0;a<i.length;a++){let t=i[a].match(/^([ABCDEFG][♯♭]?)?([^\/]+)?(\/([ABCDEFG][#b♯♭]?))?/);if(!t)continue;let s=t[1]||"",o=t[2]||"",c=t[4]||"";r&&(s=e(s),c=e(c));const l=n?"":"",u=c?"/"+c:"";i[a]=[s,o,u].join(l)}return i.join("\n")}}();function r(r,i,a,s,o,c,l,u,h,d,f,p,m,g,v){for(var y=r.split("\n"),b=y.length-1;b>=0;b--){var _,w=y[b],x=0;s||(w=n(w,g,v));var k=u.calc(w,o,c),S=k.width,C=k.height/t.STEP;switch(i){case"left":x=-(f+=S+7),_=d.averagepitch,h.addExtra(new e(w,x,S+4,_,{type:"text",height:C,dim:l,position:"left"}));break;case"right":x=p+=4,_=d.averagepitch,h.addRight(new e(w,x,S+4,_,{type:"text",height:C,dim:l,position:"right"}));break;case"below":h.addRight(new e(w,0,0,void 0,{type:"text",position:"below",height:C,dim:l,realWidth:S}));break;case"above":h.addRight(new e(w,0,0,void 0,{type:"text",position:"above",height:C,dim:l,realWidth:S}));break;default:if(a){var M=a.y+3*t.STEP;h.addRight(new e(w,x+a.x,0,d.minpitch+M/t.STEP,{position:"relative",type:"text",height:C,dim:l}))}else{var E="above";d.positioning&&d.positioning.chordPosition&&(E=d.positioning.chordPosition),"hidden"!==E&&h.addCentered(new e(w,m/2,S,void 0,{type:"chord",position:E,height:C,dim:l,realWidth:S}))}}}return{roomTaken:f,roomTakenRight:p}}return Jf=function(e,t,n,i,a,s,o,c){for(var l=0;l<n.chord.length;l++){var u,h,d=n.chord[l].position,f=n.chord[l].rel_position,p="left"===d||"right"===d||"below"===d||"above"===d||!!f;p?(u="annotationfont",h="abcjs-annotation"):(u="gchordfont",h="abcjs-chord");var m,g=e.attr(u,h),v=n.chord[l].name;if("string"==typeof v)i=(m=r(v,d,f,p,u,h,g,e,t,n,i,a,s,o,c)).roomTaken,a=m.roomTakenRight;else for(var y=0;y<v.length;y++)i=(m=r(v[y].text,d,f,p,u,h,g,e,t,n,i,a,s,o,c)).roomTaken,a=m.roomTakenRight}return{roomTaken:i,roomTakenRight:a}}}(),y=fv(),b=nd(),_=function(e){var t=0;return e.duration&&(t=e.duration),t},w=!1,x={rest:{0:"rests.whole",1:"rests.half",2:"rests.quarter",3:"rests.8th",4:"rests.16th",5:"rests.32nd",6:"rests.64th",7:"rests.128th",multi:"rests.multimeasure"},note:{"-1":"noteheads.dbl",0:"noteheads.whole",1:"noteheads.half",2:"noteheads.quarter",3:"noteheads.quarter",4:"noteheads.quarter",5:"noteheads.quarter",6:"noteheads.quarter",7:"noteheads.quarter",nostem:"noteheads.quarter"},rhythm:{"-1":"noteheads.slash.whole",0:"noteheads.slash.whole",1:"noteheads.slash.whole",2:"noteheads.slash.quarter",3:"noteheads.slash.quarter",4:"noteheads.slash.quarter",5:"noteheads.slash.quarter",6:"noteheads.slash.quarter",7:"noteheads.slash.quarter",nostem:"noteheads.slash.nostem"},x:{"-1":"noteheads.indeterminate",0:"noteheads.indeterminate",1:"noteheads.indeterminate",2:"noteheads.indeterminate",3:"noteheads.indeterminate",4:"noteheads.indeterminate",5:"noteheads.indeterminate",6:"noteheads.indeterminate",7:"noteheads.indeterminate",nostem:"noteheads.indeterminate"},harmonic:{"-1":"noteheads.harmonic.quarter",0:"noteheads.harmonic.quarter",1:"noteheads.harmonic.quarter",2:"noteheads.harmonic.quarter",3:"noteheads.harmonic.quarter",4:"noteheads.harmonic.quarter",5:"noteheads.harmonic.quarter",6:"noteheads.harmonic.quarter",7:"noteheads.harmonic.quarter",nostem:"noteheads.harmonic.quarter"},triangle:{"-1":"noteheads.triangle.quarter",0:"noteheads.triangle.quarter",1:"noteheads.triangle.quarter",2:"noteheads.triangle.quarter",3:"noteheads.triangle.quarter",4:"noteheads.triangle.quarter",5:"noteheads.triangle.quarter",6:"noteheads.triangle.quarter",7:"noteheads.triangle.quarter",nostem:"noteheads.triangle.quarter"},uflags:{3:"flags.u8th",4:"flags.u16th",5:"flags.u32nd",6:"flags.u64th"},dflags:{3:"flags.d8th",4:"flags.d16th",5:"flags.d32nd",6:"flags.d64th"}},k=function(e,t,n){this.decoration=new o,this.getTextSize=e,this.tuneNumber=t,this.isBagpipes=n.bagpipes,this.flatBeams=n.flatbeams,this.graceSlurs=n.graceSlurs,this.percmap=n.percmap,this.initialClef=n.initialClef,this.jazzchords=!!n.jazzchords,this.accentAbove=!!n.accentAbove,this.germanAlphabet=!!n.germanAlphabet,this.reset()};function S(e,t){var n=e[t];if("note"!==n.el_type||!n.startBeam||n.endBeam)return{count:1,elem:n};for(var r=[];t<e.length&&"note"===e[t].el_type&&(r.push(e[t]),!e[t].endBeam);)t++;return{count:r.length,elem:r}}function C(e){if(e.pitches){M(e);for(var t=0,n=0;n<e.pitches.length;n++)t+=e.pitches[n].verticalPos;e.averagepitch=t/e.pitches.length,e.minpitch=e.pitches[0].verticalPos,e.maxpitch=e.pitches[e.pitches.length-1].verticalPos}}k.prototype.reset=function(){this.slurs={},this.ties=[],this.voiceScale=1,this.voiceColor=void 0,this.slursbyvoice={},this.tiesbyvoice={},this.endingsbyvoice={},this.scaleByVoice={},this.colorByVoice={},this.tripletmultiplier=1,this.abcline=void 0,this.accidentalSlot=void 0,this.accidentalshiftx=void 0,this.dotshiftx=void 0,this.hasVocals=!1,this.minY=void 0,this.partstartelem=void 0,this.startlimitelem=void 0,this.stemdir=void 0},k.prototype.setStemHeight=function(e){this.stemHeight=Math.round(10*e/h.STEP)/10},k.prototype.getCurrentVoiceId=function(e,t){return"s"+e+"v"+t},k.prototype.pushCrossLineElems=function(e,t){this.slursbyvoice[this.getCurrentVoiceId(e,t)]=this.slurs,this.tiesbyvoice[this.getCurrentVoiceId(e,t)]=this.ties,this.endingsbyvoice[this.getCurrentVoiceId(e,t)]=this.partstartelem,this.scaleByVoice[this.getCurrentVoiceId(e,t)]=this.voiceScale,this.voiceColor&&(this.colorByVoice[this.getCurrentVoiceId(e,t)]=this.voiceColor)},k.prototype.popCrossLineElems=function(e,t){this.slurs=this.slursbyvoice[this.getCurrentVoiceId(e,t)]||{},this.ties=this.tiesbyvoice[this.getCurrentVoiceId(e,t)]||[],this.partstartelem=this.endingsbyvoice[this.getCurrentVoiceId(e,t)],this.voiceScale=this.scaleByVoice[this.getCurrentVoiceId(e,t)],void 0===this.voiceScale&&(this.voiceScale=1),this.voiceColor=this.colorByVoice[this.getCurrentVoiceId(e,t)]},k.prototype.containsLyrics=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e[t].voices.length;n++)for(var r=0;r<e[t].voices[n].length;r++){var i=e[t].voices[n][r];if(i.lyric)return void(i.positioning&&"below"!==i.positioning.vocalPosition||(this.hasVocals=!0))}},k.prototype.createABCLine=function(e,t,n){this.minY=2,this.containsLyrics(e);var r=new d(this.getTextSize);this.tempoSet=!1;for(var i=0;i<e.length;i++)w&&this.restoreState(),w=!1,this.createABCStaff(r,e[i],t,i,n);return r},k.prototype.createABCStaff=function(e,t,a,o,c){e.getTextSize.updateFonts(t);for(var l=0;l<t.voices.length;l++){var u=new g(l,t.voices.length);0===l?(u.barfrom="start"===t.connectBarLines||"continue"===t.connectBarLines,u.barto="continue"===t.connectBarLines||"end"===t.connectBarLines):u.duplicate=!0,t.title&&t.title[l]&&(u.header=t.title[l].replace(/\\n/g,"\n"),u.headerPosition=6+e.getTextSize.baselineToCenter(u.header,"voicefont","staff-extra voice-name",l,t.voices.length)/h.STEP),t.clef&&"perc"===t.clef.type&&(u.isPercussion=!0);var d=(!this.initialClef||0===c)&&r(t.clef,this.tuneNumber);d&&(0===l&&t.barNumber&&this.addMeasureNumber(t.barNumber,d),u.addChild(d),this.startlimitelem=d);var f=i(t.key,this.tuneNumber);if(f&&(u.addChild(f),this.startlimitelem=f),t.meter){"specified"===t.meter.type?this.measureLength=t.meter.value[0].num/t.meter.value[0].den:this.measureLength=1;var p=s(t.meter,this.tuneNumber);u.addChild(p),this.startlimitelem=p}u.duplicate&&(u.children=[]);var m=t.clef.stafflines||0===t.clef.stafflines?t.clef.stafflines:5;e.addVoice(u,o,m);var v=1===m;this.createABCVoice(t.voices[l],a,o,l,v,u),e.setStaffLimits(u),0===l&&("start"===t.brace||!e.brace&&t.brace?(e.brace||(e.brace=[]),e.brace.push(new n(u,"brace"))):"end"===t.brace&&e.brace?e.brace[e.brace.length-1].setBottomStaff(u):"continue"===t.brace&&e.brace&&e.brace[e.brace.length-1].continuing(u),"start"===t.bracket||!e.bracket&&t.bracket?(e.bracket||(e.bracket=[]),e.bracket.push(new n(u,"bracket"))):"end"===t.bracket&&e.bracket?e.bracket[e.bracket.length-1].setBottomStaff(u):"continue"===t.bracket&&e.bracket&&e.bracket[e.bracket.length-1].continuing(u))}},k.prototype.createABCVoice=function(t,n,r,i,s,o){this.popCrossLineElems(r,i),this.stemdir=this.isBagpipes?"down":null,this.abcline=t,this.partstartelem&&(this.partstartelem=new c("",null,null),o.addOther(this.partstartelem));var l=o.voicetotal<2?-1:o.voicenumber;for(var u in this.slurs)this.slurs.hasOwnProperty(u)&&(this.slurs[u]=new p({force:this.slurs[u].force,voiceNumber:l,stemDir:this.slurs[u].stemDir,style:this.slurs[u].dotted}),w&&this.slurs[u].setHint(),o.addOther(this.slurs[u]));for(var h=0;h<this.ties.length;h++)this.ties[h]=new p({force:this.ties[h].force,stemDir:this.ties[h].stemDir,voiceNumber:l,style:this.ties[h].dotted}),w&&this.ties[h].setHint(),o.addOther(this.ties[h]);for(var d=0;d<this.abcline.length;d++)C(this.abcline[d]),this.minY=Math.min(this.abcline[d].minpitch,this.minY);for(var m=0===r,g=0;g<this.abcline.length;){var v=S(this.abcline,g),y=this.createABCElement(m,s,o,v.elem);if(y)for(h=0;h<y.length;h++){if(!this.tempoSet&&n&&!n.suppress){this.tempoSet=!0;var b=new e(n,0,0,"tempo",this.tuneNumber,{});b.addFixedX(new f(n,this.tuneNumber,a)),o.addChild(b)}o.addChild(y[h])}g+=v.count}this.pushCrossLineElems(r,i)},k.prototype.saveState=function(){this.tiesSave=b.cloneArray(this.ties),this.slursSave=b.cloneHashOfHash(this.slurs),this.slursbyvoiceSave=b.cloneHashOfHash(this.slursbyvoice),this.tiesbyvoiceSave=b.cloneHashOfArrayOfHash(this.tiesbyvoice)},k.prototype.restoreState=function(){this.ties=b.cloneArray(this.tiesSave),this.slurs=b.cloneHashOfHash(this.slursSave),this.slursbyvoice=b.cloneHashOfHash(this.slursbyvoiceSave),this.tiesbyvoice=b.cloneHashOfArrayOfHash(this.tiesbyvoiceSave)},k.prototype.createABCElement=function(t,n,o,c){var l=[];switch(c.el_type){case void 0:l=this.createBeam(n,o,c);break;case"note":l[0]=this.createNote(c,!1,n,o),this.triplet&&this.triplet.isClosed()&&(o.addOther(this.triplet),this.triplet=null,this.tripletmultiplier=1);break;case"bar":l[0]=this.createBarLine(o,c,t),o.duplicate&&l.length>0&&(l[0].invisible=!0);break;case"meter":l[0]=s(c,this.tuneNumber),this.startlimitelem=l[0],o.duplicate&&l.length>0&&(l[0].invisible=!0);break;case"clef":if(l[0]=r(c,this.tuneNumber),!l[0])return null;o.duplicate&&l.length>0&&(l[0].invisible=!0);break;case"key":var d=i(c,this.tuneNumber);d&&(l[0]=d,this.startlimitelem=l[0]),o.duplicate&&l.length>0&&(l[0].invisible=!0);break;case"stem":this.stemdir="auto"===c.direction?void 0:c.direction;break;case"part":var p=new e(c,0,0,"part",this.tuneNumber),m=this.getTextSize.calc(c.title,"partsfont","part");p.addFixedX(new u(c.title,0,0,void 0,{type:"part",height:m.height/h.STEP})),l[0]=p;break;case"tempo":var g=new e(c,0,0,"tempo",this.tuneNumber);g.addFixedX(new f(c,this.tuneNumber,a)),l[0]=g;break;case"style":"normal"===c.head?delete this.style:this.style=c.head;break;case"hint":w=!0,this.saveState();break;case"midi":break;case"scale":this.voiceScale=c.size;break;case"color":this.voiceColor=c.color,o.color=this.voiceColor;break;default:var v=new e(c,0,0,"unsupported",this.tuneNumber);v.addFixed(new u("element type "+c.el_type,0,0,void 0,{type:"debug"})),l[0]=v}return l},k.prototype.createBeam=function(e,n,r){var i=[],a=new t(this.stemHeight*this.voiceScale,this.stemdir,this.flatBeams,r[0]);w&&a.setHint();for(var s=0;s<r.length;s++)a.runningDirection(r[s]);a.setStemDirection();var o=this.stemdir;for(this.stemdir=a.stemsUp?"up":"down",s=0;s<r.length;s++){var c=r[s],l=this.createNote(c,!0,e,n);i.push(l),a.add(l),this.triplet&&this.triplet.isClosed()&&(n.addOther(this.triplet),this.triplet=null,this.tripletmultiplier=1)}return a.calcDir(),n.addBeam(a),this.stemdir=o,i};var M=function(e){var t;do{t=!0;for(var n=0;n<e.pitches.length-1;n++)if(e.pitches[n].pitch>e.pitches[n+1].pitch){t=!1;var r=e.pitches[n];e.pitches[n]=e.pitches[n+1],e.pitches[n+1]=r}}while(!t)},E=function(e,t,n,r,i,a,s,o,c){for(var l=n;l>11;l--)l%2!=0||r||e.addFixed(new u(null,o,(i+4)*c,l,{type:"ledger"}));for(l=t;l<1;l++)l%2!=0||r||e.addFixed(new u(null,o,(i+4)*c,l,{type:"ledger"}));for(l=0;l<a.length;l++){var h=i;"down"===s&&(h=-h),e.addFixed(new u(null,h+o,(i+4)*c,a[l],{type:"ledger"}))}};function T(e,t){for(var n=0;n<e.length;n++)if(JSON.stringify(e[n])===JSON.stringify(t))return;e.push(t)}return k.prototype.addGraceNotes=function(e,n,r,i,s,o,c){var h=.6;s=Math.round(.7*s);var d,f,m=null;e.gracenotes.length>1&&(m=new t(s,"grace",o),w&&m.setHint(),m.mainNote=r);var g=[];for(f=e.gracenotes.length-1;f>=0;f--)c+=10,g[f]=c,e.gracenotes[f].accidental&&(c+=7);for(f=0;f<e.gracenotes.length;f++){var v=e.gracenotes[f].verticalPos;d=m?null:x.uflags[o?5:3];var y=a(r,"noteheads.quarter",e.gracenotes[f],{dir:"up",headx:-g[f],extrax:-g[f],flag:d,scale:h*this.voiceScale,accidentalSlot:[]});y.notehead.highestVert=y.notehead.pitch+s;var b=y.notehead;if(this.addSlursAndTies(r,e.gracenotes[f],b,n,"up",!0),r.addExtra(b),e.gracenotes[f].acciaccatura){var _=e.gracenotes[f].verticalPos+4.2,k=m?5:6;r.addRight(new u("flags.ugrace",-g[f]+k,0,_,{scalex:h,scaley:h}))}if(m){var S=e.gracenotes[f].duration/2;o&&(S/=2);var C={heads:[b],abcelem:{averagepitch:v,minpitch:v,maxpitch:v,duration:S}};m.add(C)}else{var M=v+1/3*h,T=v+4.2,A=b.dx+b.w;r.addExtra(new u(null,A,0,M,{type:"stem",pitch2:T,linewidth:-.6}))}E(r,v,v,!1,l.getSymbolWidth("noteheads.quarter"),[],!0,b.dx-1,.6);var P=e.rest&&("spacer"===e.rest.type||"invisible"===e.rest.type);0!==f||o||!this.graceSlurs||P||n.addOther(new p({anchor1:b,anchor2:i,isGrace:!0}))}return m&&(m.calcDir(),n.addBeam(m)),c},k.prototype.addNoteToAbcElement=function(e,t,n,r,i,s,o,c,h){var d,f,p,m,g,v=0,b=0,w=0,k=[],S=[],C=0,M=t.averagepitch>=6?"down":"up";for(r&&(M=r),(i=t.style?t.style:i)&&"normal"!==i||(i="note"),(m=s?x[i].nostem:x[i][-o])||console.log("noteSymbol:",i,o,s),g="down"===M?t.pitches.length-2:1;"down"===M?g>=0:g<t.pitches.length;g="down"===M?g-1:g+1){var E=t.pitches["down"===M?g+1:g-1],A=t.pitches[g],P="down"===M?E.pitch-A.pitch:A.pitch-E.pitch;P<=1&&!E.printer_shift&&(A.printer_shift=P?"different":"same",(A.verticalPos>11||A.verticalPos<1)&&k.push(A.verticalPos-A.verticalPos%2),"down"===M?b=l.getSymbolWidth(m)+2:v=l.getSymbolWidth(m)+2)}var I=t.pitches.length;for(g=0;g<t.pitches.length;g++){var N,D;if(c||(N="down"===M&&0!==g||"up"===M&&g!==I-1?null:x["down"===M?"dflags":"uflags"][-o]),t.pitches[g].style)D=x[t.pitches[g].style][-o];else if(h.isPercussion&&this.percmap){D=m;var O=this.percmap[y(t.pitches[g])];O&&O.noteHead&&x[O.noteHead]&&(D=x[O.noteHead][-o])}else D=m;if(t.pitches[g].highestVert=t.pitches[g].verticalPos,("up"===r||"up"===M)&&0===g||("down"===r||"down"===M)&&g===I-1){if((t.startSlur||1===I)&&(t.pitches[g].highestVert=t.pitches[I-1].verticalPos,_(t)<1&&("up"===r||"up"===M)&&(t.pitches[g].highestVert+=6)),t.startSlur)for(t.pitches[g].startSlur||(t.pitches[g].startSlur=[]),p=0;p<t.startSlur.length;p++)T(t.pitches[g].startSlur,t.startSlur[p]);if(t.endSlur)for(t.pitches[g].highestVert=t.pitches[I-1].verticalPos,_(t)<1&&("up"===r||"up"===M)&&(t.pitches[g].highestVert+=6),t.pitches[g].endSlur||(t.pitches[g].endSlur=[]),p=0;p<t.endSlur.length;p++)T(t.pitches[g].endSlur,t.endSlur[p])}var L=!c&&o<=-1,B=a(e,D,t.pitches[g],{dir:M,extrax:-b,flag:N,dot:n,dotshiftx:v,scale:this.voiceScale,accidentalSlot:S,shouldExtendStem:!r,printAccidentals:!h.isPercussion});C=Math.max(l.getSymbolWidth(D),C),e.extraw-=B.extraLeft,(d=B.notehead)&&(this.addSlursAndTies(e,t.pitches[g],d,h,L?M:null,!1),t.gracenotes&&t.gracenotes.length>0&&(d.bottom=d.bottom-1),e.addHead(d)),b+=B.accidentalshiftx,w=Math.max(w,B.dotshiftx)}if(L){var R=Math.round(70*this.voiceScale)/10,V="down"===M?t.minpitch-R:t.minpitch+1/3;V>6&&!r&&(V=6);var F="down"===M?t.maxpitch-1/3:t.maxpitch+R;F<6&&!r&&(F=6);var z="down"===M||0===e.heads.length?0:e.heads[0].w,j="down"===M?1:-1;d&&"noteheads.slash.quarter"===d.c&&("down"===M?F-=1:V+=1),d&&"noteheads.triangle.quarter"===d.c&&("down"===M?F-=.7:V-=1.2),e.addRight(new u(null,z,0,V,{type:"stem",pitch2:F,linewidth:j,bottom:V-1})),f=Math.min(V,F)}return{noteHead:d,roomTaken:b,roomTakenRight:w,min:f,additionalLedgers:k,dir:M,symbolWidth:C}},k.prototype.addLyric=function(e,t){var n="";t.lyric.forEach((function(e){var t=" "===e.divider?"":e.divider;n+=e.syllable+t+"\n"}));var r=this.getTextSize.calc(n,"vocalfont","lyric"),i=t.positioning?t.positioning.vocalPosition:"below";e.addCentered(new u(n,0,r.width,void 0,{type:"lyric",position:i,height:r.height/h.STEP,dim:this.getTextSize.attr("vocalfont","lyric")}))},k.prototype.createNote=function(t,n,r,i){var s,o=null,c=0,h=0,d=0,f=[],p=_(t),g=!1;0===p&&(g=!0,p=.25,n=!0);for(var y=Math.floor(Math.log(p)/Math.log(2)),b=0,k=Math.pow(2,y),S=k/2;k<p;b++,k+=S,S/=2);t.startTriplet&&(this.tripletmultiplier=t.tripletMultiplier);var C=p*this.tripletmultiplier;t.rest&&"multimeasure"===t.rest.type&&(C=1),t.rest&&"invisible-multimeasure"===t.rest.type&&(C=this.measureLength*t.rest.text);var M=t.rest?"rest":"note",T=new e(t,C,1,M,this.tuneNumber,{durationClassOveride:t.duration*this.tripletmultiplier});if(w&&T.setHint(),t.rest){this.measureLength===p&&"invisible"!==t.rest.type&&"spacer"!==t.rest.type&&t.rest.type.indexOf("multimeasure")<0&&(t.rest.type="whole");var A=function(e,t,n,r,i,s,o,c,h){var d,f,p,m,g=7;switch(i&&("down"===s&&(g=3),"up"===s&&(g=11)),o&&(g=n<.5||n<1?7:5),t.rest.type){case"whole":d=x.rest[0],t.averagepitch=g,t.minpitch=g,t.maxpitch=g,r=0;break;case"rest":d="rhythm"===t.style?x.rhythm[-c]:x.rest[-c],t.averagepitch=g,t.minpitch=g,t.maxpitch=g;break;case"invisible":case"invisible-multimeasure":case"spacer":d="",t.averagepitch=g,t.minpitch=g,t.maxpitch=g;break;case"multimeasure":d=x.rest.multi,t.averagepitch=g,t.minpitch=g,t.maxpitch=g,r=0;var v=l.getSymbolWidth(d);e.addHead(new u(d,v,2*v,7));var y=new u(""+t.rest.text,v,v,16,{type:"multimeasure-text"});e.addExtra(y)}if(t.rest.type.indexOf("multimeasure")<0&&"invisible"!==t.rest.type){var b=a(e,d,{verticalPos:g},{dot:r,scale:h});(f=b.notehead)&&(e.addHead(f),p=b.accidentalshiftx,m=b.dotshiftx)}return{noteHead:f,roomTaken:p,roomTakenRight:m}}(T,t,p,b,i.voicetotal>1,this.stemdir,r,y,this.voiceScale);o=A.noteHead,c=A.roomTaken,h=A.roomTakenRight}else{var P=this.addNoteToAbcElement(T,t,b,this.stemdir,this.style,g,y,n,i);void 0!==P.min&&(this.minY=Math.min(P.min,this.minY)),o=P.noteHead,c=P.roomTaken,h=P.roomTakenRight,f=P.additionalLedgers,s=P.dir,d=P.symbolWidth}if(void 0!==t.lyric&&this.addLyric(T,t),void 0!==t.gracenotes&&(c+=this.addGraceNotes(t,i,T,o,this.stemHeight*this.voiceScale,this.isBagpipes,c)),t.decoration){var I=n&&"up"!==s?Math.min(-3,T.bottom-6):T.bottom;this.decoration.createDecoration(i,t.decoration,T.top,o?o.w:0,T,c,s,I,t.positioning,this.hasVocals,this.accentAbove)}if(t.barNumber&&T.addFixed(new u(t.barNumber,-10,0,0,{type:"barNumber"})),E(T,t.minpitch,t.maxpitch,t.rest,d,f,s,-2,1),void 0!==t.chord){var N=v(this.getTextSize,T,t,c,h,d,this.jazzchords,this.germanAlphabet);c=N.roomTaken,h=N.roomTakenRight}return t.startTriplet&&(this.triplet=new m(t.startTriplet,o,{flatBeams:this.flatBeams})),t.endTriplet&&this.triplet&&this.triplet.setCloseAnchor(o),!this.triplet||t.startTriplet||t.endTriplet||t.rest&&"spacer"===t.rest.type||this.triplet.middleNote(o),T},k.prototype.addSlursAndTies=function(e,t,n,r,i,a){if(t.endTie&&this.ties.length>0){for(var s=!1,o=0;o<this.ties.length;o++)if(this.ties[o].anchor1&&this.ties[o].anchor1.pitch===n.pitch){this.ties[o].setEndAnchor(n),r.setRange(this.ties[o]),this.ties.splice(o,1),s=!0;break}s||(this.ties[0].setEndAnchor(n),r.setRange(this.ties[0]),this.ties.splice(0,1))}var c,l,u=r.voicetotal<2?-1:r.voicenumber;if(t.startTie){var h=new p({anchor1:n,force:"down"===this.stemdir||"up"===this.stemdir,stemDir:this.stemdir,isGrace:a,voiceNumber:u,style:t.startTie.style});w&&h.setHint(),this.ties[this.ties.length]=h,r.addOther(h),e.startTie=!0}if(t.endSlur)for(var d=0;d<t.endSlur.length;d++)l=t.endSlur[d],this.slurs[l]?((c=this.slurs[l]).setEndAnchor(n),r.setRange(c),delete this.slurs[l]):(c=new p({anchor2:n,stemDir:this.stemdir,voiceNumber:u}),w&&c.setHint(),r.addOther(c)),this.startlimitelem&&c.setStartX(this.startlimitelem);else if(!a)for(var f in this.slurs)this.slurs.hasOwnProperty(f)&&this.slurs[f].addInternalNote(n);if(t.startSlur)for(d=0;d<t.startSlur.length;d++)l=t.startSlur[d].label,c=new p({anchor1:n,stemDir:this.stemdir,voiceNumber:u,style:t.startSlur[d].style}),w&&c.setHint(),this.slurs[l]=c,r.addOther(c)},k.prototype.addMeasureNumber=function(e,t){var n=this.getTextSize.calc(e,"measurefont","bar-number"),r=0;t.isClef&&(r+=n.width/2);var i=n.width>10&&"treble"===t.abcelem.type?13.5:11;t.addFixed(new u(e,r,n.width,i+n.height/h.STEP,{type:"barNumber",dim:this.getTextSize.attr("measurefont","bar-number")}))},k.prototype.createBarLine=function(t,n,r){var i=new e(n,0,10,"bar",this.tuneNumber),a=null,s=0;n.barNumber&&this.addMeasureNumber(n.barNumber,i);var o="bar_right_repeat"===n.type||"bar_dbl_repeat"===n.type,l="bar_left_repeat"!==n.type&&"bar_thick_thin"!==n.type&&"bar_invisible"!==n.type,h="bar_right_repeat"===n.type||"bar_dbl_repeat"===n.type||"bar_left_repeat"===n.type||"bar_thin_thick"===n.type||"bar_thick_thin"===n.type,d="bar_left_repeat"===n.type||"bar_thick_thin"===n.type||"bar_thin_thin"===n.type||"bar_dbl_repeat"===n.type,f="bar_left_repeat"===n.type||"bar_dbl_repeat"===n.type;if(o||f){for(var p in this.slurs)this.slurs.hasOwnProperty(p)&&this.slurs[p].setEndX(i);this.startlimitelem=i}if(o&&(i.addRight(new u("dots.dot",s,1,7)),i.addRight(new u("dots.dot",s,1,5)),s+=6),l&&(a=new u(null,s,1,2,{type:"bar",pitch2:10,linewidth:.6}),i.addRight(a)),"bar_invisible"===n.type&&(a=new u(null,s,1,2,{type:"none",pitch2:10,linewidth:.6}),i.addRight(a)),n.decoration&&this.decoration.createDecoration(t,n.decoration,12,h?3:1,i,0,"down",2,n.positioning,this.hasVocals,this.accentAbove),h&&(a=new u(null,s+=4,4,2,{type:"bar",pitch2:10,linewidth:4}),i.addRight(a),s+=5),this.partstartelem&&n.endEnding&&(this.partstartelem.anchor2=a,this.partstartelem=null),d&&(a=new u(null,s+=3,1,2,{type:"bar",pitch2:10,linewidth:.6}),i.addRight(a)),f&&(s+=3,i.addRight(new u("dots.dot",s,1,7)),i.addRight(new u("dots.dot",s,1,5))),n.startEnding&&r){var m=this.getTextSize.calc(n.startEnding,"repeatfont","").width;i.minspacing+=m+10,this.partstartelem=new c(n.startEnding,a,null),t.addOther(this.partstartelem)}return i.extraw-=5,void 0!==n.chord&&v(this.getTextSize,i,n,0,0,0,!1,this.germanAlphabet),i},tp=k}function Nv(){return pp?fp:(pp=1,fp=function(e,t,n){if(t.text){t.marginLeft||(t.marginLeft=0),t.klass||(t.klass=""),t.anchor||(t.anchor="start"),t.info||(t.info={startChar:-2,endChar:-2}),t.marginTop&&e.push({move:t.marginTop});var r={left:t.marginLeft,text:t.text,font:t.font,anchor:t.anchor,startChar:t.info.startChar,endChar:t.info.endChar,"dominant-baseline":t["dominant-baseline"]};t.absElemType&&(r.absElemType=t.absElemType),!t.inGroup&&t.klass&&(r.klass=t.klass),t.name&&(r.name=t.name),e.push(r);var i=n.calc("A",t.font,t.klass),a=t.text.split("\n").length;if("\n"===t.text[t.text.length-1]&&a--,!t.noMove){var s=1.1*i.height*a;e.push({move:Math.round(s)}),t.marginBottom&&e.push({move:t.marginBottom})}}})}function Dv(){if(gp)return mp;gp=1;const e=Nv();return mp=function(t,n,r,i,a,s,o,c){var l=c.calc("i",r,i);if(""===n)t.push({move:l.height});else{if("string"==typeof n)return void e(t,{marginLeft:s,text:n,font:r,klass:i,marginTop:o.marginTop,anchor:o.anchor,absElemType:o.absElemType,info:o.info,name:a},c);o.marginTop&&t.push({move:o.marginTop});var u=0,h={left:s,anchor:o.anchor,phrases:[]};i&&(h.klass=i),t.push(h);for(var d=0;d<n.length;d++){var f=n[d],p=f.font?f.font:c.attr(r,i).font,m={content:f.text};p&&(m.attrs={"font-family":c.getFamily(p.face),"font-size":p.size,"font-weight":p.weight,"font-style":p.style,"font-decoration":p.decoration}),h.phrases.push(m);var g=c.calc(f.text,p,i);u=Math.max(u,g.height)," "===f.text[f.text.length-1]&&l.width}t.push({move:u})}}}function Ov(){if(xp)return wp;function e(e,t,n,r){if(0===e.indexOf(t)){var i=e.replace(t,""),a=parseInt(i,10);""+a===i&&(n[r]=a)}}return xp=1,wp=function(t,n){var r=[];if(t.absEl.elemset){for(var i={},a=0;a<t.absEl.elemset.length;a++){var s=t.absEl.elemset[a];if(s)for(var o=s.getAttribute("class").split(" "),c=0;c<o.length;c++)i[o[c]]=!0}for(var l=0;l<Object.keys(i).length;l++)r.push(Object.keys(i)[l])}for(var u={},h=0;h<r.length;h++)e(r[h],"abcjs-v",u,"voice"),e(r[h],"abcjs-l",u,"line"),e(r[h],"abcjs-m",u,"measure");t.staffPos&&(u.staffPos=t.staffPos);for(var d=n.target;d&&d.dataset&&!d.dataset.name&&"svg"!==d.tagName.toLowerCase();)d=d.parentNode;for(var f=n.target;f&&f.dataset&&!f.dataset.index&&"svg"!==f.tagName.toLowerCase();)f=f.parentNode;return f&&f.dataset&&(u.name=f.dataset.name,u.clickedName=d.dataset.name,u.parentClasses=f.classList),d&&d.classList&&(u.clickedClasses=d.classList),u.selectableElement=t.svgEl,{classes:r,analysis:u}}}function Lv(){return Mp?Cp:(Mp=1,Cp=function(e,t,n,r,i){return t+(r-t)/(n-e)*(i-e)})}function Bv(){if(Np)return Ip;Np=1;var e=function(){if(Tp)return Ep;Tp=1;var e=wv(),t=hv(),n=Lv(),r=function(e){return void 0===e?0:Math.floor(Math.log(e)/Math.log(2))};function i(e,t,n,r){if(!e.children)return r;for(var i=0;i<e.children.length;i++){var a=e.children[i];t&&void 0!==a.top&&"flags.ugrace"===a.c?r=Math.max(r,a.top-n):t||void 0===a.bottom||"flags.ugrace"!==a.c||(r=Math.max(r,n-a.bottom+7))}return r}function a(e,t,n){var r=t.heads[e?0:t.heads.length-1],i=n.heads[e?0:n.heads.length-1],a=r.x;e&&(a+=r.w-.6);var s=i.x;return[a,s+=e?i.w:.6]}return Ep=function(s){if(0!==s.elems.length&&!s.allrests){var o=(g=s.stemsUp,v=s.isgrace,y=g?t.STEP:-t.STEP,v&&(y*=.4),y),c=s.elems[0],l=s.elems[s.elems.length-1],u=0,h=s.stemsUp?c.abcelem.maxpitch:c.abcelem.minpitch;u=i(c,s.stemsUp,h,u),u=i(l,s.stemsUp,h,u),u=Math.max(s.stemHeight,u+3);var d=function(e,t,n,r,i,a,s,o,c,l){var u=n-2,h=n-2,d=Math.round(r?Math.max(e+u,c+h):Math.min(e-u,o-h)),f=function(e,t,n,r){if(r)return 0;var i=e-t,a=n/2;return i>a&&(i=a),i<-a&&(i=-a),i}(i,a,t,s),p=d+Math.floor(f/2),m=d+Math.floor(-f/2);return l||(r&&d<6||!r&&d>6)&&(p=6,m=6),[p,m]}(s.average,s.elems.length,u,s.stemsUp,c.abcelem.averagepitch,l.abcelem.averagepitch,s.isflat,s.min,s.max,s.isgrace),f=a(s.stemsUp,c,l);s.addBeam({startX:f[0],endX:f[1],startY:d[0],endY:d[1],dy:o});for(var p=function(e,t,i,s,o){for(var c=[],l=[],u=0;u<e.length;u++){var h=e[u];if(!h.abcelem.rest){var d=h.heads[t?0:h.heads.length-1],f=d.x+(t?d.w:0),p=n(i.startX,i.startY,i.endX,i.endY,f),m=t?-1.5:1.5;s&&(m=2*m/3);var g=h.abcelem.duration;0===g&&(g=.25);for(var v=r(g);v<-3;v++){var y=-4-v;if(l[y]?l[y].single=!1:l[y]={x:f+(t?-.6:0),y:p+m*(y+1),durlog:v,single:!0},u>0&&h.abcelem.beambr&&h.abcelem.beambr<=y+1){l[y].split||(l[y].split=[l[y].x]);var b=a(t,e[u-1],h);l[y].split[l[y].split.length-1]>=b[0]&&(b[0]+=h.w),l[y].split.push(b[0]),l[y].split.push(b[1])}}for(var _=l.length-1;_>=0;_--)if(u===e.length-1||r(e[u+1].abcelem.duration)>-_-4){var w=f,x=p+m*(_+1);l[_].single&&(w=0===u?f+5:f-5,x=n(i.startX,i.startY,i.endX,i.endY,w)+m*(_+1));var k={startX:l[_].x,endX:w,startY:l[_].y,endY:x,dy:o};if(void 0!==l[_].split){var S=l[_].split;k.endX<=S[S.length-1]&&(S[S.length-1]-=h.w),S.push(k.endX),k.split=l[_].split}c.push(k),l=l.slice(0,_)}}}return c}(s.elems,s.stemsUp,s.beams[0],s.isgrace,o),m=0;m<p.length;m++)s.addBeam(p[m]);!function(r,i,a,s,o){for(var c=0;c<r.length;c++){var l=r[c];if(!l.abcelem.rest){var u=!l.addExtra,h=u?o:l,d=l.heads[i?0:l.heads.length-1],f=d.pitch+(i?.2:-.2),p=i?d.w:0;u||(p+=d.dx);var m=d.x+p,g=n(a.startX,a.startY,a.endX,a.endY,m),v=i?-.6:.6;i||(g-=s/2/t.STEP),u&&(p+=l.heads[0].dx),"noteheads.slash.quarter"===d.c&&(i?f+=1:f-=1);var y=new e(null,p,0,f,{type:"stem",pitch2:g,linewidth:v});y.setX(h.x),h.addRight(y)}}}(s.elems,s.stemsUp,s.beams[0],o,s.mainNote)}var g,v,y}}(),t=Lv(),n=function(){if(Pp)return Ap;Pp=1;var e=Lv();function t(e){return e.stemsUp}return Ap=function(n){if(n.anchor1&&n.anchor2){n.hasBeam=!!n.anchor1.parent.beam&&n.anchor1.parent.beam===n.anchor2.parent.beam;var r=n.anchor1.parent.beam;if(!n.hasBeam||r.elems[0]===n.anchor1.parent&&r.elems[r.elems.length-1]===n.anchor2.parent||(n.hasBeam=!1),n.hasBeam){var i=t(r)?n.anchor1.x+n.anchor1.w:n.anchor1.x;n.yTextPos=function(t,n,r){if(0===r.beams.length)return 0;r=r.beams[0];var i=t+(n-t)/2;return e(r.startX,r.startY,r.endX,r.endY,i)}(i,n.anchor2.x,r),n.yTextPos+=t(r)?3:-2,n.xTextPos=(o=i)+(n.anchor2.x-o)/2,n.top=n.yTextPos+1,n.bottom=n.yTextPos-2,t(r)&&(n.endingHeightAbove=4)}else{n.startNote=Math.max(n.anchor1.parent.top,9)+4,n.endNote=Math.max(n.anchor2.parent.top,9)+4,"rest"===n.anchor1.parent.type&&"rest"!==n.anchor2.parent.type?n.startNote=n.endNote:"rest"===n.anchor2.parent.type&&"rest"!==n.anchor1.parent.type&&(n.endNote=n.startNote);for(var a=0,s=0;s<n.middleElems.length;s++)a=Math.max(a,n.middleElems[s].top);((a+=4)>n.startNote||a>n.endNote)&&(n.startNote=a,n.endNote=a),n.flatBeams&&(n.startNote=Math.max(n.startNote,n.endNote),n.endNote=Math.max(n.startNote,n.endNote)),n.yTextPos=n.startNote+(n.endNote-n.startNote)/2,n.xTextPos=n.anchor1.x+(n.anchor2.x+n.anchor2.w-n.anchor1.x)/2,n.top=n.yTextPos+1}}var o;delete n.middleElems,delete n.flatBeams}}();function r(e){for(var t=0;t<e.elems.length;t++){var n=e.elems[t];if(n.top)for(var r=s(n,e),i=0;i<n.children.length;i++){var a=n.children[i];if("ornament"===a.klass&&"below"!==a.position&&a.bottom-1.5<r){var o=r-a.bottom+1.5;a.bottom+=o,a.top+=o,a.pitch+=o,r=n.top=a.top}}}}function i(e,t){var n=t.getChordDim();if(n){for(var r=0;r<e.length;r++)if(e[r]<n.left)return r>0&&t.putChordInLane(r),void(e[r]=n.right);e.push(n.right),t.putChordInLane(e.length-1)}}function a(e){for(var t=0,n=0;n<e.children.length;n++)e.children[n].chordHeightBelow&&t++;return t}function s(e,n){return n=n.beams[0],t(n.startX,n.startY,n.endX,n.endY,e.x)}return Ip=function(t){for(var s=0;s<t.beams.length;s++)if("BeamElem"===t.beams[s].type){e(t.beams[s]),r(t.beams[s]);for(var o=0;o<t.beams[s].elems.length;o++)t.adjustRange(t.beams[s].elems[o])}for(t.staff.specialY.chordLines=function(e){var t,n,r,s=[0],o=[0];for(t=0;t<e.length;t++){for(n=0;n<e[t].children.length;n++)(r=e[t].children[n]).chordHeightAbove&&i(s,r);for(n=e[t].children.length-1;n>=0;n--)(r=e[t].children[n]).chordHeightBelow&&i(o,r)}return(s.length>1||o.length>1)&&function(e,t){for(var n=0;n<e.length;n++){a(e[n]);for(var r=0;r<e[n].children.length;r++){var i=e[n].children[r];i.chordHeightAbove&&i.invertLane(t)}}}(e,s.length),{above:s.length,below:o.length}}(t.children),s=0;s<t.otherchildren.length;s++){var c=t.otherchildren[s];"TripletElem"===c.type&&(n(c),t.adjustRange(c))}t.staff.top=Math.max(t.staff.top,t.top),t.staff.bottom=Math.min(t.staff.bottom,t.bottom)}}function Rv(){if(zp)return Fp;function e(e,t,n){if(t)for(var r=0;r<t.length;r++)if(t[r].header){var i=n.calc(t[r].header,"voicefont","");e=Math.max(e,i.width)}return e}function t(e,t,r){if(e)for(var i=0;i<e.length;i++)n(t,e[i]),r=Math.max(r,e[i].getWidth());return r}function n(e,t){t.x=e}return zp=1,Fp=function(n,r,i,a,s){var o,c,l=n.padding.left,u=0;for(o=0;o<i.length;o++)i[o].header&&(c=r.calc(i[o].header,"voicefont",""),u=Math.max(u,c.width));u=e(u,a,r),(u=e(u,s,r))&&(u+=r.calc("A","voicefont","").width);var h=0;return h=t(a,l+=u,h),l+t(s,l,h)}}function Vv(){if(Up)return Hp;Up=1;var e=Bv(),t=function(){if(Op)return Dp;Op=1;var e=hv();function t(e,t,n,r){if(e.specialY[n]){var i=e.specialY[n];r&&(i*=r),e.top+=i+1,t[n]=e.top}}function n(e,t,n){var o,c;for(o=0;o<t.children.length;o++)r(e,c=t.children[o],n);for(o=0;o<t.otherchildren.length;o++)switch((c=t.otherchildren[o]).type){case"CrescendoElem":i(e,c);break;case"DynamicDecoration":a(e,c);break;case"EndingElem":s(e,c);break;case"TieElem":var l=c.getYBounds();t.staff.top=Math.max(t.staff.top,l[0]),t.staff.top=Math.max(t.staff.top,l[1]),t.staff.bottom=Math.min(t.staff.bottom,l[0]),t.staff.bottom=Math.min(t.staff.bottom,l[1])}}function r(e,t,n){for(var r=0;r<t.children.length;r++){var i=t.children[r];for(var a in t.specialY)t.specialY.hasOwnProperty(a)&&i[a]&&(i.pitch=e[a],void 0===i.top&&("TempoElement"===i.type?o(e,i):c(e,i,n),t.pushTop(i.top),t.pushBottom(i.bottom)))}}function i(e,t){t.dynamicHeightAbove?t.pitch=e.dynamicHeightAbove:t.pitch=e.dynamicHeightBelow}function a(e,t){t.volumeHeightAbove?t.pitch=e.volumeHeightAbove:t.pitch=e.volumeHeightBelow}function s(e,t){t.pitch=e.endingHeightAbove-2}function o(e,t){if(t.pitch=e.tempoHeightAbove,t.top=e.tempoHeightAbove,t.bottom=e.tempoHeightAbove,t.note){var n=t.pitch-t.totalHeightInPitches+1;t.note.top=n,t.note.bottom=n;for(var r=0;r<t.note.children.length;r++){var i=t.note.children[r];i.top+=n,i.bottom+=n,i.pitch+=n,void 0!==i.pitch2&&(i.pitch2+=n)}}}function c(t,n,r){switch(n.type){case"part":n.top=t.partHeightAbove+n.height,n.bottom=t.partHeightAbove;break;case"text":case"chord":n.chordHeightAbove?(n.top=t.chordHeightAbove,n.bottom=t.chordHeightAbove):(n.top=t.chordHeightBelow,n.bottom=t.chordHeightBelow);break;case"lyric":n.lyricHeightAbove?(n.top=t.lyricHeightAbove,n.bottom=t.lyricHeightAbove):(n.top=t.lyricHeightBelow+r.vocal/e.STEP,n.bottom=t.lyricHeightBelow+r.vocal/e.STEP,n.pitch-=r.vocal/e.STEP);break;case"debug":n.top=t.chordHeightAbove,n.bottom=t.chordHeightAbove}void 0!==n.pitch&&void 0!==n.top||console.error("RelativeElement position not set.",n.type,n.pitch,n.top,t)}return Dp=function(r,i){for(var a,s=0;s<i.staffs.length;s++){var o=i.staffs[s],c={tempoHeightAbove:0,partHeightAbove:0,volumeHeightAbove:0,dynamicHeightAbove:0,endingHeightAbove:0,chordHeightAbove:0,lyricHeightAbove:0,lyricHeightBelow:0,chordHeightBelow:0,volumeHeightBelow:0,dynamicHeightBelow:0};if(r.showDebug&&r.showDebug.indexOf("box")>=0&&(o.originalTop=o.top,o.originalBottom=o.bottom),t(o,c,"lyricHeightAbove"),t(o,c,"chordHeightAbove",o.specialY.chordLines.above),o.specialY.endingHeightAbove&&(o.specialY.chordHeightAbove?o.top+=2:o.top+=o.specialY.endingHeightAbove+1,c.endingHeightAbove=o.top),o.specialY.dynamicHeightAbove&&o.specialY.volumeHeightAbove?(o.top+=Math.max(o.specialY.dynamicHeightAbove,o.specialY.volumeHeightAbove)+1,c.dynamicHeightAbove=o.top,c.volumeHeightAbove=o.top):(t(o,c,"dynamicHeightAbove"),t(o,c,"volumeHeightAbove")),t(o,c,"partHeightAbove"),t(o,c,"tempoHeightAbove"),o.specialY.lyricHeightBelow&&(o.specialY.lyricHeightBelow+=r.spacing.vocal/e.STEP,c.lyricHeightBelow=o.bottom,o.bottom-=o.specialY.lyricHeightBelow+1),o.specialY.chordHeightBelow){c.chordHeightBelow=o.bottom;var l=o.specialY.chordHeightBelow;o.specialY.chordLines.below&&(l*=o.specialY.chordLines.below),o.bottom-=l+1}o.specialY.volumeHeightBelow&&o.specialY.dynamicHeightBelow?(c.volumeHeightBelow=o.bottom,c.dynamicHeightBelow=o.bottom,o.bottom-=Math.max(o.specialY.volumeHeightBelow,o.specialY.dynamicHeightBelow)+1):o.specialY.volumeHeightBelow?(c.volumeHeightBelow=o.bottom,o.bottom-=o.specialY.volumeHeightBelow+1):o.specialY.dynamicHeightBelow&&(c.dynamicHeightBelow=o.bottom,o.bottom-=o.specialY.dynamicHeightBelow+1),r.showDebug&&r.showDebug.indexOf("box")>=0&&(o.positionY=c);for(var u=0;u<o.voices.length;u++)n(c,i.voices[o.voices[u]],r.spacing);if(void 0!==a){var h=a+(o.top-10),d=r.spacing.systemStaffSeparation/e.STEP-h;d>0&&(o.top+=d)}o.top+=r.spacing.staffTopMargin/e.STEP,a=2-o.bottom}}}(),n=function(){if(Vp)return Rp;Vp=1;var e=function(){if(Bp)return Lp;Bp=1;var e=function(){};return e.beginLayout=function(e,t){t.i=0,t.durationindex=0,t.startx=e,t.minx=e,t.nextx=e,t.spacingduration=0},e.layoutEnded=function(e){return e.i>=e.children.length},e.getNextX=function(e){return Math.max(e.minx,e.nextx)},e.getSpacingUnits=function(e){return Math.sqrt(8*e.spacingduration)},e.layoutOneItem=function(e,t,n,r,i){var a=n.children[n.i];if(!a)return 0;var s=e-n.minx,o=n.durationindex+a.duration>0?r:0;if("note"===a.abcelem.el_type&&!a.abcelem.rest&&0!==n.voicenumber&&i){var c=i.children[i.i],l=c&&(a.abcelem.maxpitch<=c.abcelem.maxpitch+1&&a.abcelem.maxpitch>=c.abcelem.minpitch-1||a.abcelem.minpitch<=c.abcelem.maxpitch+1&&a.abcelem.minpitch>=c.abcelem.minpitch-1);if(l&&a.abcelem.minpitch===c.abcelem.minpitch&&a.abcelem.maxpitch===c.abcelem.maxpitch&&c.heads&&c.heads.length>0&&a.heads&&a.heads.length>0&&c.heads[0].c===a.heads[0].c&&(l=!1),l){var u=c.heads&&c.heads.length>0?c.heads[0].realWidth:c.fixed.w;a.adjustedWidth||(a.adjustedWidth=u+a.w),a.w=a.adjustedWidth;for(var h=0;h<a.children.length;h++){var d=a.children[h];d.name.indexOf("accidental")<0&&(d.adjustedWidth||(d.adjustedWidth=d.dx+u),d.dx=d.adjustedWidth)}}}var f,p,m,g=(p=o,m=0,"note"!==(f=a).type&&"bar"!==f.type||(m=p),-f.extraw+m);return s<g&&(0===n.i||"bar"!==a.type||"part"!==n.children[n.i-1].type&&"tempo"!==n.children[n.i-1].type)&&(e+=g-s),a.setX(e),n.spacingduration=a.duration,n.minx=e+function(e){return e.w}(a),n.i!==n.children.length-1&&(n.minx+=a.minspacing),this.updateNextX(e,t,n),e},e.shiftRight=function(e,t){var n=t.children[t.i];n&&(n.setX(n.x+e),t.minx+=e,t.nextx+=e)},e.updateNextX=function(e,t,n){n.nextx=e+t*this.getSpacingUnits(n)},e.updateIndices=function(e){this.layoutEnded(e)||(e.durationindex+=e.children[e.i].duration,"bar"===e.children[e.i].type&&(e.durationindex=Math.round(64*e.durationindex)/64),e.i++)},Lp=e}();function t(t){for(var n=0;n<t.length;n++)if(!e.layoutEnded(t[n]))return!1;return!0}function n(e){return e.durationindex-(e.children[e.i]&&e.children[e.i].duration>0?0:5e-7)}return Rp=function(r,i,a,s,o){var c,l=0,u=1e3,h=o;s.startx=h;var d,f,p=0;for(a&&console.log("init layout",r),c=0;c<s.voices.length;c++)e.beginLayout(h,s.voices[c]);for(var m=0;!t(s.voices);){for(p=null,c=0;c<s.voices.length;c++)e.layoutEnded(s.voices[c])||p&&!(n(s.voices[c])<p)||(p=n(s.voices[c]));var g=[],v=[];for(c=0;c<s.voices.length;c++)n(s.voices[c])-p>1e-7?v.push(s.voices[c]):g.push(s.voices[c]);m=0;var y=0;for(c=0;c<g.length;c++)e.getNextX(g[c])>h&&(h=e.getNextX(g[c]),m=e.getSpacingUnits(g[c]),y=g[c].spacingduration);l+=m,u=Math.min(u,m),a&&console.log("currentduration: ",p,l,u);var b=void 0;for(c=0;c<g.length;c++){var _=g[c];0===_.voicenumber&&(b=c);var w=void 0!==b&&g[b].voicenumber!==_.voicenumber?g[b]:void 0;f=w,(d=_)&&d.staff&&d.staff.voices&&0!==d.staff.voices.length&&f&&f.staff&&f.staff.voices&&0!==f.staff.voices.length&&d.staff.voices[0]===f.staff.voices[0]||(w=void 0);var x=e.layoutOneItem(h,r,_,i,w),k=x-h;if(k>0){h=x;for(var S=0;S<c;S++)e.shiftRight(k,g[S])}}for(c=0;c<v.length;c++)v[c].spacingduration-=y,e.updateNextX(h,r,v[c]);for(c=0;c<g.length;c++){var C=g[c];e.updateIndices(C)}}for(c=0;c<s.voices.length;c++)e.getNextX(s.voices[c])>h&&(h=e.getNextX(s.voices[c]),m=e.getSpacingUnits(s.voices[c]));return function(e){for(var t=0,n=0;n<e.length;n++){var r=e[n];if(r.children.length>0){var i=r.children.length-1,a=r.children[i];if("bar"===a.abcelem.el_type){var s=a.children[0].x;s>t?t=s:a.children[0].x=t}}}}(s.voices),l+=m,s.setWidth(h),{spacingUnits:l,minSpace:u}}}(),r=Rv(),i=function(){if(qp)return jp;qp=1;var e=Rv();return jp=function(t,n,r){var i=e(t,n.getTextSize,n.voices,n.brace,n.bracket),a=function(e,t){for(var n=0,r=0,i=0;i<e.voices.length;i++){for(var a=0,s=e.voices[i],o=0;o<s.children.length;o++){var c=s.children[o];if(a+=c.duration,c.duration){var l=(c.w+t)/c.duration;n=Math.max(n,l)}}r=Math.max(r,a)}return{totalDuration:r,minSpacing:n}}(n,r.minPadding),s=a.totalDuration,o=a.minSpacing*s;r.minWidth&&(o=Math.max(o,r.minWidth));var c=r.minPadding?r.minPadding/2:2;n.startx=i,n.w=o+i;for(var l=0;l<n.voices.length;l++){var u=n.voices[l];u.startx=i,u.w=o+i;for(var h=i,d=!1,f=0,p=0;p<u.children.length;p++){var m=u.children[p];d||(0!==m.duration?(d=!0,f=(o+i-h)/s,n.gridStart=h):(m.x=h,h+=m.w+m.minspacing)),d&&("center"===r.align?m.x=h+m.duration*f/2-m.w/2:0===m.duration?m.x=h+1-m.w:m.x=h+c-m.extraw,h+=m.duration*f);for(var g=0;g<m.children.length;g++){var v=m.children[g],y=v.dx?v.dx:0;v.x=m.x+y}}n.gridEnd=h}return o}}(),a=function(e,t,i,a,o,c,l){for(var u=r(e,a.getTextSize,a.voices,a.brace,a.bracket),h=i,d=0;d<8;d++){var f=n(h,e.minPadding,l,a,u);if(null===(h=s(c,o.stretchlast,t+e.padding.left,a.w,h,f.spacingUnits,f.minSpace,e.padding.left+e.padding.right)))break}return function(e){for(var t=0;t<e.length;t++)for(var n=e[t],r=1;r<n.children.length-1;r++){var i=n.children[r];if(i.abcelem.rest&&("whole"===i.abcelem.rest.type||"multimeasure"===i.abcelem.rest.type)){var a=n.children[r-1],s=n.children[r+1];i.center(a,s)}}}(a.voices),a.w-u};function s(e,t,n,r,i,a,s,o){if(e)if(void 0===t){if(r/n<.66)return null}else if(!(1-(r+o)/n<t))return null;return Math.abs(n-r)<2?null:a>0?((i=(n-(r-a*i))/a)*s>50&&(i=50/s),i):null}return Hp=function(n,r,s,o,c,l){var u,h,d=s;for(u=0;u<r.lines.length;u++){var f;(h=r.lines[u]).staff&&(f=void 0!==l?i(n,h.staffGroup,l):a(n,d,o,h.staffGroup,r.formatting,u===r.lines.length-1,!1),Math.round(f)>Math.round(d)&&(d=f,c&&(u=-1)))}for(u=0;u<r.lines.length;u++)if((h=r.lines[u]).staffGroup&&h.staffGroup.voices){for(var p=0;p<h.staffGroup.voices.length;p++)e(h.staffGroup.voices[p]);t(n,h.staffGroup)}for(u=0;u<r.lines.length;u++)(h=r.lines[u]).staffGroup&&h.staffGroup.setHeight();return d}}function Fv(){return Zp||(Zp=1,Xp=function(){for(var e,t,n,r,i,a=0,s=arguments[a++],o=[];s;){if(t=/^[^\x25]+/.exec(s))o.push(t[0]);else if(t=/^\x25{2}/.exec(s))o.push("%");else{if(!(t=/^\x25(?:(\d+)\$)?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(s)))throw"Huh ?!";if(null==(e=arguments[t[1]||a++])||null==e)throw"Too few arguments.";if(/[^s]/.test(t[7])&&"number"!=typeof e)throw"Expecting number but found "+typeof e;switch(t[7]){case"b":e=e.toString(2);break;case"c":e=String.fromCharCode(e);break;case"d":e=parseInt(e);break;case"e":e=t[6]?e.toExponential(t[6]):e.toExponential();break;case"f":e=t[6]?parseFloat(e).toFixed(t[6]):parseFloat(e);break;case"o":e=e.toString(8);break;case"s":e=(e=String(e))&&t[6]?e.substring(0,t[6]):e;break;case"u":e=Math.abs(e);break;case"x":e=e.toString(16);break;case"X":e=e.toString(16).toUpperCase()}e=/[def]/.test(t[7])&&t[2]&&e>0?"+"+e:e,r=t[3]?"0"==t[3]?"0":t[3][1]:" ",i=t[5]-String(e).length,n=t[5]?str_repeat(r,i):"",o.push(t[4]?e+n:n+e)}s=s.substring(t[0].length)}return o.join("")}),Xp}function zv(){return em?Jp:(em=1,Jp=function(e){return parseFloat(e.toFixed(2))})}function jv(){if(nm)return tm;nm=1;var e=zv();return tm=function(t,n,r){var i,a=n.y;if(n.phrases)return t.paper.richTextLine(n.phrases,n.x,n.y,n.klass,n.anchor);if(n.lane){var s=.25*n.dim.font.size;a+=(n.dim.font.size+s)*n.lane}n.dim?(i=n.dim).attr.class=n.klass:i=t.controller.getFontAndAttr.calc(n.type,n.klass),n.anchor&&(i.attr["text-anchor"]=n.anchor),n["dominant-baseline"]&&(i.attr["dominant-baseline"]=n["dominant-baseline"]),i.attr.x=n.x,i.attr.y=a,n.centerVertically||(i.attr.y+=i.font.size),"debugfont"===n.type&&(console.log("Debug msg: "+n.text),i.attr.stroke="#ff0000"),n.cursor&&(i.attr.cursor=n.cursor);var o=n.text.replace(/\n\n/g,"\n \n");o=o.replace(/^\n/," \n"),i.font.box&&(r||t.paper.openGroup({klass:i.attr.class,fill:t.foregroundColor,"data-name":n.name}),"end"===i.attr["text-anchor"]?i.attr.x-=i.font.padding:"start"===i.attr["text-anchor"]&&(i.attr.x+=i.font.padding),i.attr.y+=i.font.padding,delete i.attr.class),n.noClass&&delete i.attr.class,i.attr.x=e(i.attr.x),i.attr.y=e(i.attr.y),n.name&&(i.attr["data-name"]=n.name);var c=t.paper.text(o,i.attr);if(i.font.box){var l=c.getBBox(),u=0;"middle"===i.attr["text-anchor"]?u=l.width/2+i.font.padding:"end"===i.attr["text-anchor"]&&(u=l.width+2*i.font.padding);var h=0;n.centerVertically&&(h=l.height-i.font.padding),t.paper.rect({"data-name":"box",x:Math.round(n.x-u),y:Math.round(a-h),width:Math.round(l.width+2*i.font.padding),height:Math.round(l.height+2*i.font.padding)}),r||(c=t.paper.closeGroup())}return c}}function qv(){if(im)return rm;im=1;var e=Fv(),t=hv(),n=jv();function r(t,n,r,i){return e("M %f %f C %f %f %f %f %f %f C %f %f %f %f %f %f z",t+r[0],n+i[0],t+r[1],n+i[1],t+r[2],n+i[2],t+r[3],n+i[3],t+r[4],n+i[4],t+r[5],n+i[5],t+r[6],n+i[6])}return rm=function(i,a,s){var o=a.startVoice.staff.absoluteY-10*t.STEP;return a.endVoice&&a.endVoice.staff?a.endY=a.endVoice.staff.absoluteY-2*t.STEP:a.lastContinuedVoice&&a.lastContinuedVoice.staff?a.endY=a.lastContinuedVoice.staff.absoluteY-2*t.STEP:a.endY=a.startVoice.staff.absoluteY-2*t.STEP,function(i,a,s,o,c,l,u){var h,d,f,p,m,g,v;if(l){i.paper.openGroup({klass:i.controller.classes.generate("staff-extra voice-name"),"data-name":c});var y=s+(o-s)/2;y-=i.controller.getTextSize.baselineToCenter(l,"voicefont","staff-extra voice-name",0,1),n(i,{x:i.padding.left,y:y,text:l,type:"voicefont",klass:"staff-extra voice-name",anchor:"start",centerVertically:!0})}return"brace"===c?(d=i,m=c,v=r(f=a,p=s,[7.5,-8,21,0,18.5,-10.5,7.5],[0,(g=o-p)/5.5,g/3.14,g/2,g/2.93,g/4.88,0]),v+=r(f,p,[0,17.5,-7.5,6.6,-5,20,0],[g/2,g/1.46,g/1.22,g,g/1.19,g/1.42,g/2]),h=d.paper.path({path:v,stroke:d.foregroundColor,fill:d.foregroundColor,class:d.controller.classes.generate(m),"data-name":m})):"bracket"===c&&(h=function(n,r,i,a,s){r+=t.STEP;var o=.75*t.STEP,c=.75*t.STEP,l=a-i,u=e("M %f %f l %f %f l %f %f l %f %f z",r,i-c,0,l+2*c,o,0,0,-(l+2*c)),h=2*t.STEP,d=t.STEP;return u+=e("M %f %f q %f %f %f %f q %f %f %f %f z",r+o,i-c,.6*h,.2*d,h,-d,.1*-h,.3*d,-h,d+t.STEP),u+=e("M %f %f q %f %f %f %f q %f %f %f %f z",r+o,i+c+l,.6*h,.2*-d,h,d,.1*-h,.3*-d,-h,-d-t.STEP),n.paper.path({path:u,stroke:n.foregroundColor,fill:n.foregroundColor,class:n.controller.classes.generate(s),"data-name":s})}(i,a,s,o,c)),l&&(h=i.paper.closeGroup()),u.wrapSvgEl({el_type:c,startChar:-1,endChar:-1},h),h}(i,a.x,o,a.endY,a.type,a.header,s)}}function Hv(){return sm?am:(sm=1,am=function(e,t,n){return e.paper.path(t)})}function Uv(){if(cm)return om;cm=1;var e=Fv(),t=Hv(),n=zv();function r(e,t,r){return n(e+r*t)}var i=[[3.5,-4.8]],a=[[1.5,-1],[.3,-.3],[-3.5,3.8]],s=[[-1.5,2]],o=[[3,4],[3,-4]],c=[[-3,4],[-3,-4]];function l(e,t){for(var n="",i=0;i<e.length;i++)n+="l"+e[i][0]+" "+r(e[i][1],t,e[i][0]);return n}return om=function(n,u,h){u.anchor1&&u.anchor2&&u.anchor1.heads&&u.anchor2.heads&&0!==u.anchor1.heads.length&&0!==u.anchor2.heads.length||window.console.error("Glissando Element not set.");var d,f,p=n.calcY(u.anchor1.heads[0].pitch),m=n.calcY(u.anchor2.heads[0].pitch),g=u.anchor1.x+u.anchor1.w/2,v=u.anchor2.x+u.anchor2.w/2,y=(d=v-g,f=m-p,Math.sqrt(d*d+f*f)),b=u.anchor1.w/2+4,_=u.anchor2.w/2+4,w=function(e,t,n,r){return(r-t)/(n-e)}(g,p,v,m),x=r(p,w,b);r(m,w,-_);var k,S=function(n,r,u,h,d){var f,p=e("M %f %f",r,u);for(p+=l(i,d),f=0;f<h;f++)p+=l(o,d);for(p+=l(a,d),f=0;f<h;f++)p+=l(c,d);return p+=l(s,d)+"z",t(n,{path:p,highlight:"stroke",stroke:n.foregroundColor,class:n.controller.classes.generate("decoration"),"data-name":"glissando"})}(n,g+b,x,(k=y-b-_,Math.max(2,Math.floor((k-10)/6))),w);return h.wrapSvgEl({el_type:"glissando",startChar:-1,endChar:-1},S),[S]}}function Gv(){if(dm)return hm;dm=1;var e=zv();function t(){this.ingroup=!1}t.prototype.beginGroup=function(e,t){this.paper=e,this.controller=t,this.path=[],this.lastM=[0,0],this.ingroup=!0,this.paper.openGroup()},t.prototype.isInGroup=function(){return this.ingroup},t.prototype.addPath=function(t){if(0!==(t=t||[]).length){t[0][0]="m",t[0][1]=e(t[0][1]-this.lastM[0]),t[0][2]=e(t[0][2]-this.lastM[1]),this.lastM[0]+=t[0][1],this.lastM[1]+=t[0][2],this.path.push(t[0]);for(var n=1,r=t.length;n<r;n++)"m"===t[n][0]&&(this.lastM[0]+=t[n][1],this.lastM[1]+=t[n][2]),this.path.push(t[n])}},t.prototype.endGroup=function(e,t){this.ingroup=!1;for(var n=0;n<this.path.length;n++)this.path[n].join(" ");this.path=[];var r=this.paper.closeGroup();return r&&(r.setAttribute("class",this.controller.classes.generate(e)),r.setAttribute("fill",this.controller.renderer.foregroundColor),r.setAttribute("stroke","none"),r.setAttribute("data-name",t)),r};var n=new t;return hm=n}function Wv(){if(pm)return fm;pm=1;var e=jv(),t=Tv(),n=Gv();return fm=function(r,i,a,s,o){var c,l,u,h,d,f;if(!s)return null;if(s.length>1&&s.indexOf(".")<0){var p=n.isInGroup()?"":o.klass;r.paper.openGroup({"data-name":o.name,klass:p});for(var m=0,g=0;g<s.length;g++){var v=s[g];l=t.getYCorr(v),(c=t.printSymbol(i+m,r.calcY(a+l),v,r.paper,{stroke:o.stroke,fill:o.fill}))?g<s.length-1&&(m+=(u=v,h=s[g+1],d=t.getSymbolWidth(v),f=void 0,f=d,"f"===u&&"f"===h&&(f=2*f/3),"p"===u&&"p"===h&&(f=5*f/6),"f"===u&&"z"===h&&(f=5*f/8),f)):e(r,{x:i,y:r.y,text:"no symbol:"+s,type:"debugfont",klass:"debug-msg",anchor:"start"},!1)}return r.paper.closeGroup()}return l=t.getYCorr(s),(c=n.isInGroup()?t.printSymbol(i,r.calcY(a+l),s,r.paper,{"data-name":o.name}):t.printSymbol(i,r.calcY(a+l),s,r.paper,{klass:o.klass,stroke:o.stroke,fill:o.fill,"data-name":o.name}))?c:(e(r,{x:i,y:r.y,text:"no symbol:"+s,type:"debugfont",klass:"debug-msg",anchor:"start"},!1),null)}}function Yv(){if(Mm)return Cm;Mm=1;var e=Gv(),t=zv();return Cm=function(n,r,i,a,s,o,c){if(i<0||a<s){var l=t(s);s=t(a),a=l}else a=t(a),s=t(s);r=t(r);var u=t(r+i);if(n.firefox112){var h={x1:r+=i/2,x2:r,y1:a,y2:s,stroke:n.foregroundColor,"stroke-width":Math.abs(i)};return o&&(h.class=o),c&&(h["data-name"]=c),n.paper.lineToBack(h)}for(var d=[["M",r,a],["L",r,s],["L",u,s],["L",u,a],["z"]],f=(h={path:""},0);f<d.length;f++)h.path+=d[f].join(" ");return o&&(h.class=o),c&&(h["data-name"]=c),e.isInGroup()||(h.stroke="none",h.fill=n.foregroundColor),n.paper.pathToBack(h)}}function $v(){if(Pm)return Am;Pm=1;var e=function(){if(Tm)return Em;Tm=1;var e=Fv(),t=zv();return Em=function(n,r,i,a,s,o,c){var l=n.foregroundColor;r=t(r),i=t(i);var u=t(a-c),h=t(a+c);if(n.firefox112){var d={x1:r,x2:i,y1:a+=c/2,y2:a,stroke:n.foregroundColor,"stroke-width":Math.abs(2*c)};return s&&(d.class=s),o&&(d["data-name"]=o),n.paper.lineToBack(d)}var f={path:e("M %f %f L %f %f L %f %f L %f %f z",r,u,i,u,i,h,r,h),stroke:"none",fill:l};return o&&(f["data-name"]=o),s&&(f.class=s),n.paper.pathToBack(f)}}();return Am=function(t,n,r,i,a,s,o){var c=t.calcY(i);return e(t,n,r,c,a,s,o)}}function Kv(){if(Nm)return Im;Nm=1;var e=jv(),t=Yv(),n=$v(),r=Wv();return Im=function(i,a,s){void 0===a.pitch&&window.console.error(a.type+" Relative Element y-coordinate not set.");var o,c,l,u,h,d,f=i.calcY(a.pitch);switch(a.type){case"symbol":if(null===a.c)return null;var p="symbol";a.klass&&(p+=" "+a.klass),a.graphelem=r(i,a.x,a.pitch,a.c,{scalex:a.scalex,scaley:a.scaley,klass:i.controller.classes.generate(p),name:a.name});break;case"debug":a.graphelem=e(i,{x:a.x,y:i.calcY(15),text:""+a.c,type:"debugfont",klass:i.controller.classes.generate("debug-msg"),anchor:"start",centerVertically:!1,dim:a.dim},!1);break;case"tabNumber":var m="tabnumberfont",g="abcjs-tab-number";a.isGrace&&(m="tabgracefont",f+=2.5,g="tab-grace"),a.graphelem=e(i,{x:a.x,y:f,text:""+a.c,type:m,klass:i.controller.classes.generate(g),anchor:"middle",centerVertically:!1,dim:a.dim,cursor:"default"},!1);break;case"barNumber":a.graphelem=e(i,{x:a.x,y:f,text:""+a.c,type:"measurefont",klass:i.controller.classes.generate("bar-number"),anchor:"middle",dim:a.dim,name:"bar-number"},!0);break;case"lyric":a.graphelem=e(i,{x:a.x,y:f,text:a.c,type:"vocalfont",klass:i.controller.classes.generate("lyric"),anchor:"middle",dim:a.dim,name:"lyric"},!1);break;case"chord":a.graphelem=e(i,{x:a.x,y:f,text:a.c,type:"gchordfont",klass:i.controller.classes.generate("chord"),anchor:"middle",dim:a.dim,lane:a.getLane(),name:"chord"},!1);break;case"decoration":a.graphelem=e(i,{x:a.x,y:f+6,text:a.c,type:"annotationfont",klass:i.controller.classes.generate("annotation"),anchor:a.anchor,centerVertically:!0,dim:a.dim},!1);break;case"text":a.graphelem=e(i,{x:a.x,y:f,text:a.c,type:"annotationfont",klass:i.controller.classes.generate("annotation"),anchor:"start",centerVertically:a.centerVertically,dim:a.dim,lane:a.getLane(),name:"annotation"},!1);break;case"multimeasure-text":a.graphelem=e(i,{x:a.x+a.w/2,y:f,text:a.c,type:"tempofont",klass:i.controller.classes.generate("rest"),anchor:"middle",centerVertically:!1,dim:a.dim},!1);break;case"part":a.graphelem=e(i,{x:a.x,y:f,text:a.c,type:"partsfont",klass:i.controller.classes.generate("part"),anchor:"start",dim:a.dim,name:a.c},!0);break;case"bar":a.graphelem=t(i,a.x,a.linewidth+i.lineThickness,f,s||i.calcY(a.pitch2),null,"bar");break;case"stem":var v=a.linewidth>0?a.linewidth+i.lineThickness:a.linewidth-i.lineThickness;a.graphelem=t(i,a.x,v,f,i.calcY(a.pitch2),"abcjs-stem","stem");break;case"ledger":a.graphelem=n(i,a.x,a.x+a.w,a.pitch,"abcjs-ledger","ledger",.35+i.lineThickness)}return 1!==a.scalex&&a.graphelem&&(o=i.paper,c=a.graphelem,l=a.scalex,u=a.scaley,h=a.x,d=f,o.setAttributeOnElement(c,{style:"transform:scale("+l+","+u+");transform-origin:"+h+"px "+d+"px;"})),a.graphelem}}function Qv(){if(Vm)return Rm;Vm=1;var e=Uv(),t=function(){if(um)return lm;um=1;var e=Fv(),t=Hv(),n=zv(),r=function(r,i,a,s,o,c,l){i=n(i),a=n(a),s=n(s),o=n(o),c=n(c),l=n(l);var u=e("M %f %f L %f %f M %f %f L %f %f",c,i,l,a,c,s,l,o);return t(r,{path:u,highlight:"stroke",stroke:r.foregroundColor,class:r.controller.classes.generate("dynamics decoration"),"data-name":"dynamics"})};return lm=function(e,t,n){void 0===t.pitch&&window.console.error("Crescendo Element y-coordinate not set.");var i,a=e.calcY(t.pitch)+4,s=t.anchor1?t.anchor1.x:0,o=t.anchor2?t.anchor2.x:800;return i="<"===t.dir?r(e,a+4,a,a+4,a+8,s,o):r(e,a,a+4,a+8,a+4,s,o),n.wrapSvgEl({el_type:"dynamicDecoration",startChar:-1,endChar:-1},i),[i]}}(),n=function(){if(gm)return mm;gm=1;var e=Wv();return mm=function(t,n,r){void 0===n.pitch&&window.console.error("Dynamic Element y-coordinate not set.");var i=e(t,n.anchor.x,n.pitch,n.dec,{scalex:1,scaley:1,klass:t.controller.classes.generate("decoration dynamics"),fill:t.foregroundColor,stroke:"none",name:"dynamics"});return r.wrapSvgEl({el_type:"dynamicDecoration",startChar:-1,endChar:-1,decoration:n.dec},i),[i]}}(),r=function(){if(ym)return vm;ym=1;var e=Fv(),t=jv(),n=Hv(),r=zv();function i(t,n,i,a){return e("M %f %f L %f %f",r(t),r(n),r(i),r(a))}return vm=function(e,r,a){e.paper.openGroup({klass:e.controller.classes.generate("triplet "+r.durationClass),"data-name":"triplet"}),r.hasBeam||function(e,t,r,a,s){r=e.calcY(r),s=e.calcY(s);var o="";o+=i(t,r,t,r+5),o+=i(a,s,a,s+5);var c=t+(a-t)/2,l=(s-r)/(a-t),u=c-8;o+=i(t,r,u,r+(u-t)*l);var h=c+8;o+=i(h,r+(h-t)*l,a,s),n(e,{path:o,stroke:e.foregroundColor,"data-name":"triplet-bracket"})}(e,r.anchor1.x,r.startNote,r.anchor2.x+r.anchor2.w,r.endNote),t(e,{x:r.xTextPos,y:e.calcY(r.yTextPos-1),text:""+r.number,type:"tripletfont",anchor:"middle",centerVertically:!0,noClass:!0,name:""+r.number},!0);var s=e.paper.closeGroup();return a.wrapSvgEl({el_type:"triplet",startChar:-1,endChar:-1},s),s}}(),i=function(){if(_m)return bm;_m=1;var e=Fv(),t=jv(),n=Hv(),r=zv();return bm=function(i,a,s,o,c){void 0===a.pitch&&window.console.error("Ending Element y-coordinate not set.");var l=r(i.calcY(a.pitch)),u="";a.anchor1&&(s=r(a.anchor1.x+a.anchor1.w),u+=e("M %f %f L %f %f ",s,l,s,r(l+20))),a.anchor2&&(o=r(a.anchor2.x),u+=e("M %f %f L %f %f ",o,l,o,r(l+20))),u+=e("M %f %f L %f %f ",s,l,o,l),i.paper.openGroup({klass:i.controller.classes.generate("ending"),"data-name":"ending"}),n(i,{path:u,stroke:i.foregroundColor,fill:i.foregroundColor,"data-name":"line"}),a.anchor1&&t(i,{x:r(s+5),y:r(i.calcY(a.pitch-.5)),text:a.text,type:"repeatfont",klass:"ending",anchor:"start",noClass:!0,name:a.text});var h=i.paper.closeGroup();return c.wrapSvgEl({el_type:"ending",startChar:-1,endChar:-1},h),[h]}}(),a=function(){if(xm)return wm;xm=1;var e=Fv(),t=zv();return wm=function(n,r,i,a,s){!function(e,t,n){e.anchor1&&e.anchor2?e.anchor1.pitch===e.anchor2.pitch&&0===e.internalNotes.length?e.isTie=!0:e.isTie=!1:e.isTie=!0,e.isTie?(e.calcTieDirection(),e.calcX(t,n),e.calcTieY()):(e.calcSlurDirection(),e.calcX(t,n),e.calcSlurY()),e.avoidCollisionAbove()}(r,i,a);var o="";r.anchor1?o+="abcjs-start-m"+r.anchor1.parent.counters.measure+"-n"+r.anchor1.parent.counters.note:o+="abcjs-start-edge",r.anchor2?o+=" abcjs-end-m"+r.anchor2.parent.counters.measure+"-n"+r.anchor2.parent.counters.note:o+=" abcjs-end-edge",r.hint&&(o="abcjs-hint");var c=r.fixedY?1.5:0,l=function(n,r,i,a,s,o,c,l,u){var h=l?1.2:1.5;r=t(r+6),i=t(i+4),a+=o?h:-h,s+=o?h:-h;var d,f=t(n.calcY(a)),p=t(n.calcY(s)),m=i-r,g=p-f,v=Math.sqrt(m*m+g*g),y=m/v,b=g/v,_=v/3.5,w=l?10:25,x=(o?-1:1)*Math.min(w,Math.max(4,_)),k=t(r+_*y-x*b),S=t(f+_*b+x*y),C=t(i-_*y-x*b),M=t(p-_*b+x*y);if(c?c+=" slur":c="slur",c+=l?" tie":" legato",u){c+=" dotted";var E=e("M %f %f C %f %f %f %f %f %f",r,f,k,S,C,M,i,p);d=n.paper.path({path:E,stroke:n.foregroundColor,fill:"none","stroke-dasharray":"5 5",class:n.controller.classes.generate(c),"data-name":l?"tie":"slur"})}else{var T=e("M %f %f C %f %f %f %f %f %f C %f %f %f %f %f %f z",r,f,k,S,C,M,i,p,t(C-2*b),t(M+2*y),t(k-2*b),t(S+2*y),r,f);d=n.paper.path({path:T,stroke:"none",fill:n.foregroundColor,class:n.controller.classes.generate(c),"data-name":l?"tie":"slur"})}return d}(n,r.startX,r.endX,r.startY+c,r.endY+c,r.above,o,r.isTie,r.dotted),u=-1;r.anchor1&&!r.isTie&&(u=r.anchor1.parent.abcelem.startChar-1);var h=-1;return r.anchor2&&!r.isTie&&(h=r.anchor2.parent.abcelem.endChar+1),s.wrapSvgEl({el_type:"slur",startChar:u,endChar:h},l),[l]}}(),s=function(){if(Sm)return km;Sm=1;var e=Hv(),t=zv();function n(e,n,r,i,a,s){r=t(e.calcY(r)),a=t(e.calcY(a)),n=t(n),i=t(i);var o=t(r+s);return"M"+n+" "+r+" L"+i+" "+a+"L"+i+" "+t(a+s)+" L"+n+" "+o+"z"}function r(e,t,n,r,i){return(i-n)/(r-t)}function i(e,t,n,r){return t+(r-e)*n}return km=function(t,a){if(0!==a.beams.length){for(var s="",o=0;o<a.beams.length;o++){var c=a.beams[o];if(c.split){for(var l=r(0,c.startX,c.startY,c.endX,c.endY),u=[],h=0;h<c.split.length;h+=2)u.push([c.split[h],c.split[h+1]]);for(h=0;h<u.length;h++){var d=i(c.startX,c.startY,l,u[h][0]),f=i(c.startX,c.startY,l,u[h][1]);s+=n(t,u[h][0],d,u[h][1],f,c.dy)}}else s+=n(t,c.startX,c.startY,c.endX,c.endY,c.dy)}var p=("abcjs-d"+a.duration).replace(/\./g,"-"),m=t.controller.classes.generate("beam-elem "+p);return[e(t,{path:s,stroke:"none",fill:t.foregroundColor,class:m})]}}}(),o=jv(),c=function(){if(Bm)return Lm;Bm=1;var e=function(){if(Om)return Dm;Om=1;var e=Kv(),t=jv();return Dm=function(n,r){var i=r.x;void 0===r.pitch&&window.console.error("Tempo Element y-coordinate not set."),r.tempo.el_type="tempo";var a,s=n.calcY(r.pitch)+2;if(r.tempo.preString){a=t(n,{x:i,y:s,text:r.tempo.preString,type:"tempofont",klass:"abcjs-tempo",anchor:"start",noClass:!0,name:"pre"},!0);var o=n.controller.getTextSize.calc(r.tempo.preString,"tempofont","tempo",a).width;i+=o+o/r.tempo.preString.length}if(r.note){r.note.setX(i);for(var c=0;c<r.note.children.length;c++)e(n,r.note.children[c],i);i+=r.note.w+5;var l="= "+r.tempo.bpm;a=t(n,{x:i,y:s,text:l,type:"tempofont",klass:"abcjs-tempo",anchor:"start",noClass:!0,name:"beats"});var u=n.controller.getTextSize.calc(l,"tempofont","tempo",a).width;i+=u+u/l.length}r.tempo.postString&&t(n,{x:i,y:s,text:r.tempo.postString,type:"tempofont",klass:"abcjs-tempo",anchor:"start",noClass:!0,name:"post"},!0)}}(),t=Kv(),n=hv(),r=vv(),i=Gv();return Lm=function(a,s,o,c,l){if(!s.invisible){var u=s.children.length>0&&"TempoElement"===s.children[0].type;s.elemset=[],i.beginGroup(a.paper,a.controller);for(var h=0;h<s.children.length;h++){var d=s.children[h];if("TempoElement"===d.type)e(a,d);else{var f=t(a,d,o);"symbol"===d.type&&d.c&&d.c.indexOf("notehead")>=0&&f.setAttribute("class","abcjs-notehead")}}var p=s.type;if(("note"===s.type||"rest"===s.type)&&(s.counters=a.controller.classes.getCurrent(),p=(p+=" d"+Math.round(1e3*s.durationClass)/1e3).replace(/\./g,"-"),s.abcelem.pitches))for(var m=0;m<s.abcelem.pitches.length;m++)p+=" p"+s.abcelem.pitches[m].pitch;var g=i.endGroup(p,s.type);if(g){if(s.cloned&&(s.cloned.overrideClasses=g.className.baseVal),s.overrideClasses){var v=g.classList&&g.classList.length>0?g.classList[0]+" ":"";g.setAttribute("class",v+s.overrideClasses)}if(u)s.startChar=s.abcelem.startChar,s.endChar=s.abcelem.endChar,c.add(s,g,!1,l);else{s.elemset.push(g);var y=!1;"note"!==s.type&&"tabNumber"!==s.type||(y=!0),c.add(s,g,y,l)}}else s.elemset.length>0&&c.add(s,s.elemset[0],"note"===s.type,l);if(s.klass&&r(s.elemset,"mark","","#00ff00"),s.hint&&r(s.elemset,"abcjs-hint","",null),s.abcelem.abselem=s,s.heads&&s.heads.length>0){s.notePositions=[];for(var b=0;b<s.heads.length;b++)s.notePositions.push({x:s.heads[b].x+s.heads[b].w/2,y:l.zero-s.heads[b].pitch*n.STEP})}}}}();return Rm=function(l,u,h,d,f){var p=u.w-1;l.staffbottom=u.staff.bottom;var m,g,v=l.foregroundColor;if(u.color&&(l.foregroundColor=u.color),u.header){var y=o(l,{x:l.padding.left,y:l.calcY(u.headerPosition),text:u.header,type:"voicefont",klass:"staff-extra voice-name",anchor:"start",centerVertically:!0,name:"voice-name"},!0);d.wrapSvgEl({el_type:"voiceName",startChar:-1,endChar:-1,text:u.header},y)}var b,_=!1;for(m=0;m<u.children.length;m++){"note"!==(g=u.children[m]).type&&"rest"!==g.type||(_=!0);var w=!1;"staff-extra"===g.type||l.controller.classes.isInMeasure()||(l.controller.classes.startMeasure(),w=!0),u.staff.isTabStaff&&(g.invisible=!1,"bar"==g.type&&g.abcelem.lastBar&&(h=u.topLine)),c(l,g,u.barto||m===u.children.length-1?h:0,d,f),("note"===g.type||"rest"===(b=g).type&&!(!b.abcelem||!b.abcelem.rest||"spacer"===b.abcelem.rest.type))&&l.controller.classes.incrNote(),"bar"===g.type&&!w&&_&&l.controller.classes.incrMeasure()}for(l.controller.classes.startMeasure(),m=0;m<u.beams.length;m++){var x=u.beams[m];"bar"===x?l.controller.classes.incrMeasure():s(l,x,d)}for(l.controller.classes.startMeasure(),m=0;m<u.otherchildren.length;m++)if("bar"===(g=u.otherchildren[m]))l.controller.classes.incrMeasure();else switch(g.type){case"GlissandoElem":g.elemset=e(l,g,d);break;case"CrescendoElem":g.elemset=t(l,g,d);break;case"DynamicDecoration":g.elemset=n(l,g,d);break;case"TripletElem":r(l,g,d);break;case"EndingElem":g.elemset=i(l,g,u.startx+10,p,d);break;case"TieElem":g.elemset=a(l,g,u.startx+10,p,d);break;default:console.log(g),c(l,g,u.startx+10,p,d,f)}l.foregroundColor=v}}function Xv(){if(Wm)return Gm;Wm=1;var e=Um?Hm:(Um=1,Hm=function(e,t){var n=Math.round(e.y),r=(e.controller.width-t)/2,i=r+t,a="M "+r+" "+n+" L "+i+" "+n+" L "+i+" "+(n+1)+" L "+r+" "+(n+1)+" L "+r+" "+n+" z";e.paper.pathToBack({path:a,stroke:"rgba(0,0,0,0)",fill:"rgba(0,0,0,255)",class:e.controller.classes.generate("defined-text")})}),t=jv();return Gm=function(n,r,i){for(var a=0;a<r.rows.length;a++){var s=r.rows[a];if(s.absmove)n.absolutemoveY(s.absmove);else if(s.move)n.moveY(s.move);else if(s.text||s.phrases){var o=s.left?s.left:0,c=t(n,{x:o,y:n.y,text:s.text,phrases:s.phrases,"dominant-baseline":s["dominant-baseline"],type:s.font,klass:s.klass,name:s.name,anchor:s.anchor});s.absElemType&&i.wrapSvgEl({el_type:s.absElemType,name:s.name,startChar:s.startChar,endChar:s.endChar,text:s.text},c)}else if(s.separator)e(n,s.separator);else if(s.startGroup)n.paper.openGroup({klass:s.klass,"data-name":s.name});else if(s.endGroup){var l=n.paper.closeGroup();s.absElemType&&i.wrapSvgEl({el_type:s.absElemType,name:s.name,startChar:s.startChar,endChar:s.endChar,text:""},l)}}}}function Zv(){if(eg)return Jm;eg=1;var e=function(){if($m)return Ym;$m=1;var e=hv(),t=qv(),n=Qv(),r=function(){if(zm)return Fm;zm=1;var e=$v();return Fm=function(t,n,r,i,a,s){var o="abcjs-top-line",c=2;a&&(c=a),t.paper.openGroup({prepend:!0,klass:t.controller.classes.generate("abcjs-staff")});var l=0,u=0;if(1===i)e(t,n,r,6,o,null,s+t.lineThickness),l=t.calcY(10),u=t.calcY(2);else for(var h=i-1;h>=0;h--){var d=(h+1)*c;u=t.calcY(d),0===l&&(l=u),e(t,n,r,d,o,null,s+t.lineThickness),o=void 0}return t.paper.closeGroup(),[l,u]}}(),i=qm?jm:(qm=1,jm=function(e,t,n){var r=e.paper.rectBeneath(t);return n&&e.paper.text(n,{x:0,y:t.y+7,"text-anchor":"start","font-size":"14px",fill:"rgba(0,0,255,.4)",stroke:"rgba(0,0,255,.4)"}),r}),a=Yv(),s=Xv();function o(n,r,i,a,s){if(i)for(var o=0;o<i.length;o++)i[o].isStartVoice(a)&&(i[o].startY=r-10*e.STEP,i[o].elemset=t(n,i[o],s))}function c(t,n,r){for(var a=0;a<r.length;a++)for(var s=n[r[a]].children,o=0;o<s.length;o++){var c=s[o],l=c.getFixedCoords();if(!c.invisible&&void 0!==l.t&&void 0!==l.b){var u=(l.t-l.b)*e.STEP;i(t,{x:l.x,y:t.calcY(l.t),width:l.w,height:u,fill:"#88e888","fill-opacity":.4,stroke:"#4aa93d","stroke-opacity":.8});for(var h=0;h<c.children.length;h++){var d=c.children[h],f=d.getChordDim();if(f){var p=t.calcY(d.pitch);p+=d.dim.font.size*d.getLane(),i(t,{x:f.left,y:p,width:f.right-f.left,height:d.dim.font.size,fill:"none",stroke:"#4aa93d","stroke-opacity":.8})}}}}}return Ym=function(t,l,u,h){for(var d,f,p,m=t.y,g=0;g<l.staffs.length;g++){var v=l.staffs[g];t.moveY(e.STEP,v.top),v.absoluteY=t.y,t.showDebug&&(t.showDebug.indexOf("box")>=0&&v.voices&&c(t,l.voices,v.voices),t.showDebug.indexOf("grid")>=0&&(t.paper.dottedLine({x1:t.padding.left,x2:t.padding.left+t.controller.width,y1:m,y2:m,stroke:"#0000ff"}),i(t,{x:t.padding.left,y:t.calcY(v.originalTop),width:t.controller.width,height:t.calcY(v.originalBottom)-t.calcY(v.originalTop),fill:t.foregroundColor,stroke:t.foregroundColor,"fill-opacity":.1,"stroke-opacity":.1}),d=0,E(v,"chordHeightAbove"),E(v,"chordHeightBelow"),E(v,"dynamicHeightAbove"),E(v,"dynamicHeightBelow"),E(v,"endingHeightAbove"),E(v,"lyricHeightAbove"),E(v,"lyricHeightBelow"),E(v,"partHeightAbove"),E(v,"tempoHeightAbove"),E(v,"volumeHeightAbove"),E(v,"volumeHeightBelow"))),t.moveY(e.STEP,-v.bottom),t.showDebug&&t.showDebug.indexOf("grid")>=0&&t.paper.dottedLine({x1:t.padding.left,x2:t.padding.left+t.controller.width,y1:t.y,y2:t.y,stroke:"#0000aa"})}for(var y=2,b=0,_=0;_<l.voices.length;_++){var w=l.voices[_].staff,x=l.voices[_].tabNameInfos;if(t.y=w.absoluteY,t.controller.classes.incrVoice(),!l.voices[_].duplicate){if(f||(f=t.calcY(10)),p=t.calcY(y),0!==w.lines){w.linePitch&&(y=w.linePitch),t.controller.classes.newMeasure();var k=r(t,l.startx,l.w,w.lines,w.linePitch,.35);p=k[1],w.bottomLine=p,w.topLine=k[0],w.hasTab&&(b=w.topLine),w.hasStaff&&(b=w.hasStaff.topLine,l.voices[_].barto=!0,l.voices[_].topLine=f)}o(t,w.absoluteY,l.brace,_,u),o(t,w.absoluteY,l.bracket,_,u)}n(t,l.voices[_],b,u,{top:m,zero:t.y,height:l.height*e.STEP});var S=0;if(x){var C={rows:[]};C.rows.push({absmove:p+2}),C.rows.push({left:l.startx+8,text:x.name,font:"tablabelfont",klass:"text instrument-name",anchor:"start"}),C.rows.push({move:x.textSize.height}),s(t,C),S=x.textSize.height}t.controller.classes.newMeasure(),l.voices[_].duplicate||(b=t.calcY(2+S))}t.controller.classes.newMeasure();var M=l.staffs.length;function E(n,r){var a=["rgb(207,27,36)","rgb(168,214,80)","rgb(110,161,224)","rgb(191,119,218)","rgb(195,30,151)","rgb(31,170,177)","rgb(220,166,142)"];if(n.positionY&&n.positionY[r]){var s=n.specialY[r]*e.STEP;"chordHeightAbove"===r&&n.specialY.chordLines&&n.specialY.chordLines.above&&(s*=n.specialY.chordLines.above),"chordHeightBelow"===r&&n.specialY.chordLines&&n.specialY.chordLines.below&&(s*=n.specialY.chordLines.below),i(t,{x:t.padding.left,y:t.calcY(n.positionY[r]),width:t.controller.width,height:s,fill:a[d],stroke:a[d],"fill-opacity":.4,"stroke-opacity":.4},r.substr(0,4)),(d+=1)>6&&(d=0)}}M>1&&(f=l.staffs[0].topLine,p=l.staffs[M-1].bottomLine,a(t,l.startx,.6,f,p,null)),t.y=m}}(),t=Qm?Km:(Qm=1,Km=function(e,t,n,r){var i=(t+e.padding.left+e.padding.right)*n,a=(e.y+e.padding.bottom)*n;if(e.isPrint&&(a=Math.max(a,1056)),""!==e.ariaLabel){var s="Sheet Music";e.abctune&&e.abctune.metaText&&e.abctune.metaText.title&&(s+=' for "'+e.abctune.metaText.title+'"'),e.paper.setTitle(s);var o=e.ariaLabel?e.ariaLabel:s;e.paper.setAttribute("aria-label",o)}e.paper.insertStyles(".abcjs-dragging-in-progress text, .abcjs-dragging-in-progress tspan {"+["-webkit-touch-callout: none;","-webkit-user-select: none;","-khtml-user-select: none;","-moz-user-select: none;","-ms-user-select: none;","user-select: none;"].join(" ")+"}");var c={overflow:"hidden"};"resize"===r?e.paper.setResponsiveWidth(i,a):(c.width="",c.height=a+"px",n<1?(c.width=i+"px",e.paper.setSize(i/n,a/n)):e.paper.setSize(i,a)),e.paper.setScale(n),e.paper.setParentStyles(c)}),n=Xv(),r=hv(),i=function(){if(Zm)return Xm;Zm=1;var e=yv(),t=bv();function n(e,t,n){this.elements=[],this.paper=e,this.tuneNumber=n,this.selectTypes=t}return n.prototype.getElements=function(){return this.elements},n.prototype.add=function(e,t,n,r){if(this.canSelect(e)){var i;i=void 0===this.selectTypes?{selectable:!1,"data-index":this.elements.length}:{selectable:!0,tabindex:0,"data-index":this.elements.length},this.paper.setAttributeOnElement(t,i);var a={absEl:e,svgEl:t,isDraggable:n};void 0!==r&&(a.staffPos=r),this.elements.push(a)}},n.prototype.canSelect=function(e){return!(!1===this.selectTypes||!e||!e.abcelem||!0!==this.selectTypes&&!(void 0===this.selectTypes?"note"===e.abcelem.el_type||"tabNumber"===e.abcelem.el_type:this.selectTypes.indexOf(e.abcelem.el_type)>=0))},n.prototype.wrapSvgEl=function(n,r){var i={tuneNumber:this.tuneNumber,abcelem:n,elemset:[r],highlight:e,unhighlight:t};this.add(i,r,!1)},Xm=n}();function a(t,n,i,a){e(t,n,i,a);var s=n.height*r.STEP;return t.y+=s,n}function s(e,t,n,i){var a=-(n.staffs[n.staffs.length-1].bottom-2),s=(i.staffs[0].top-10+a)*r.STEP;s<t&&e.moveY(t-s)}return Jm=function(e,r,o,c,l,u,h,d,f,p){var m=new i(e.paper,d,f),g={};r.shouldAddClasses&&(g.klass="abcjs-meta-top"),e.paper.openGroup(g),e.moveY(e.padding.top),n(e,o.topText,m),e.paper.closeGroup(),e.moveY(e.spacing.music);for(var v=[],y=0;y<o.lines.length;y++){r.incrLine();var b=o.lines[y];if(b.staff){r.shouldAddClasses&&(g.klass="abcjs-staff-wrapper abcjs-l"+r.lineNumber),e.paper.openGroup(g),b.vskip&&e.moveY(b.vskip),v.length>=1&&s(e,e.spacing.staffSeparation,v[v.length-1],b.staffGroup);var _=a(e,b.staffGroup,m,y);_.line=p+y,v.push(_),e.paper.closeGroup()}else b.nonMusic&&(r.shouldAddClasses&&(g.klass="abcjs-non-music"),e.paper.openGroup(g),n(e,b.nonMusic,m),e.paper.closeGroup())}return r.reset(),o.bottomText&&o.bottomText.rows&&o.bottomText.rows.length>0&&(r.shouldAddClasses&&(g.klass="abcjs-meta-bottom"),e.paper.openGroup(g),e.moveY(24),n(e,o.bottomText,m),e.paper.closeGroup()),t(e,l,h,u),{staffgroups:v,selectables:m.getElements()}}}function Jv(){if(ig)return rg;ig=1;var e=hv(),t=Iv(),n=function(){if(sp)return ap;sp=1;var e=hv(),t=function(){if(ip)return rp;ip=1;var e="http://www.w3.org/2000/svg";function t(e){this.svg=a(),this.currentGroup=[],e.appendChild(this.svg)}function n(e,t,n){var r=n-e;return"M "+e+" "+t+" l "+r+" 0 l 0 1 l "+-r+" 0 z "}function r(e,t,n){var r=n-t;return"M "+e+" "+t+" l 0 "+r+" l 1 0 l 0 "+-r+" z "}t.prototype.clear=function(){if(this.svg){var e=this.svg.parentNode;this.svg=a(),this.currentGroup=[],e&&(e.innerHTML="",e.appendChild(this.svg))}},t.prototype.setTitle=function(e){var t=document.createElement("title"),n=document.createTextNode(e);t.appendChild(n),this.svg.insertBefore(t,this.svg.firstChild)},t.prototype.setResponsiveWidth=function(e,t){if(this.svg.setAttribute("viewBox","0 0 "+e+" "+t),this.svg.setAttribute("preserveAspectRatio","xMinYMin meet"),this.svg.removeAttribute("height"),this.svg.removeAttribute("width"),this.svg.style.display="inline-block",this.svg.style.position="absolute",this.svg.style.top="0",this.svg.style.left="0",this.svg.parentNode){var n=this.svg.parentNode.getAttribute("class");n?n.indexOf("abcjs-container")<0&&this.svg.parentNode.setAttribute("class",n+" abcjs-container"):this.svg.parentNode.setAttribute("class","abcjs-container"),this.svg.parentNode.style.display="inline-block",this.svg.parentNode.style.position="relative",this.svg.parentNode.style.width="100%";var r=t/e*100;this.svg.parentNode.style["padding-bottom"]=r+"%",this.svg.parentNode.style["vertical-align"]="middle",this.svg.parentNode.style.overflow="hidden"}},t.prototype.setSize=function(e,t){this.svg.setAttribute("width",e),this.svg.setAttribute("height",t)},t.prototype.setAttribute=function(e,t){this.svg.setAttribute(e,t)},t.prototype.setScale=function(e){1!==e?(this.svg.style.transform="scale("+e+","+e+")",this.svg.style["-ms-transform"]="scale("+e+","+e+")",this.svg.style["-webkit-transform"]="scale("+e+","+e+")",this.svg.style["transform-origin"]="0 0",this.svg.style["-ms-transform-origin-x"]="0",this.svg.style["-ms-transform-origin-y"]="0",this.svg.style["-webkit-transform-origin-x"]="0",this.svg.style["-webkit-transform-origin-y"]="0"):(this.svg.style.transform="",this.svg.style["-ms-transform"]="",this.svg.style["-webkit-transform"]="")},t.prototype.insertStyles=function(t){var n=document.createElementNS(e,"style");n.textContent=t,this.svg.insertBefore(n,this.svg.firstChild)},t.prototype.setParentStyles=function(e){for(var t in e)e.hasOwnProperty(t)&&this.svg.parentNode&&(this.svg.parentNode.style[t]=e[t]);this.dummySvg&&(document.querySelector("body").removeChild(this.dummySvg),this.dummySvg=null)},t.prototype.rect=function(e){var t=[],i=e.x,a=e.y,s=e.x+e.width,o=e.y+e.height;return t.push(n(i,a,s)),t.push(n(i,o,s)),t.push(r(s,a,o)),t.push(r(i,o,a)),this.path({path:t.join(" "),stroke:"none","data-name":e["data-name"]})},t.prototype.dottedLine=function(t){var n=document.createElementNS(e,"line");n.setAttribute("x1",t.x1),n.setAttribute("x2",t.x2),n.setAttribute("y1",t.y1),n.setAttribute("y2",t.y2),n.setAttribute("stroke",t.stroke),n.setAttribute("stroke-dasharray","5,5"),this.svg.insertBefore(n,this.svg.firstChild)},t.prototype.rectBeneath=function(t){var n=document.createElementNS(e,"rect");n.setAttribute("x",t.x),n.setAttribute("width",t.width),n.setAttribute("y",t.y),n.setAttribute("height",t.height),t.stroke&&n.setAttribute("stroke",t.stroke),t["stroke-opacity"]&&n.setAttribute("stroke-opacity",t["stroke-opacity"]),t.fill&&n.setAttribute("fill",t.fill),t["fill-opacity"]&&n.setAttribute("fill-opacity",t["fill-opacity"]),this.svg.insertBefore(n,this.svg.firstChild)},t.prototype.text=function(t,n,r){var i=document.createElementNS(e,"text");for(var a in i.setAttribute("stroke","none"),n)n.hasOwnProperty(a)&&i.setAttribute(a,n[a]);for(var s=(""+t).split("\n"),o=0;o<s.length;o++){var c=document.createElementNS(e,"tspan");if(c.setAttribute("x",n.x?n.x:0),0!==o&&c.setAttribute("dy","1.2em"),-1!==s[o].indexOf("")){var l=s[o].split("");if(c.textContent=l[0],l[1]){var u=document.createElementNS(e,"tspan");u.setAttribute("dy","-0.3em"),u.setAttribute("style","font-size:0.7em"),u.textContent=l[1],c.appendChild(u)}if(l[2]){var h=l[1]?"0.4em":"0.1em",d=document.createElementNS(e,"tspan");d.setAttribute("dy",h),d.setAttribute("style","font-size:0.7em"),d.textContent=l[2],c.appendChild(d)}}else c.textContent=s[o];i.appendChild(c)}return r?r.appendChild(i):this.append(i),i},t.prototype.richTextLine=function(t,n,r,i,a,s){var o=document.createElementNS(e,"text");o.setAttribute("stroke","none"),o.setAttribute("class",i),o.setAttribute("x",n),o.setAttribute("y",r),o.setAttribute("text-anchor",a),o.setAttribute("dominant-baseline","middle");for(var c=0;c<t.length;c++){for(var l=t[c],u=document.createElementNS(e,"tspan"),h=Object.keys(l.attrs),d=0;d<h.length;d++){var f=l.attrs[h[d]];""!==f&&u.setAttribute(h[d],f)}u.textContent=l.content,o.appendChild(u)}return s?s.appendChild(o):this.append(o),o},t.prototype.guessWidth=function(e,t){var n,r=this.createDummySvg(),i=this.text(e,t,r);try{n=i.getBBox(),n=isNaN(n.height)||!n.height?{width:t["font-size"]/2,height:t["font-size"]+2}:{width:n.width,height:n.height}}catch(a){n={width:t["font-size"]/2,height:t["font-size"]+2}}return r.removeChild(i),n},t.prototype.createDummySvg=function(){return this.dummySvg||(this.dummySvg=a(),this.dummySvg.setAttribute("style",["display: block !important;","height: 1px;","width: 1px;","position: absolute;"].join("")),document.querySelector("body").appendChild(this.dummySvg)),this.dummySvg};var i={};function a(){var t=document.createElementNS(e,"svg");return t.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),t.setAttribute("role","img"),t.setAttribute("fill","currentColor"),t.setAttribute("stroke","currentColor"),t}return t.prototype.getTextSize=function(e,t,n){if("number"==typeof e&&(e=""+e),!e||e.match(/^\s+$/))return{width:0,height:0};var r;if(e.length<20&&(r=e+JSON.stringify(t),i[r]))return i[r];var a,s=!n;n||(n=this.text(e,t));try{a=n.getBBox(),a=isNaN(a.height)||!a.height?this.guessWidth(e,t):{width:a.width,height:a.height}}catch(o){a=this.guessWidth(e,t)}return s&&(this.currentGroup.length>0?this.currentGroup[0].removeChild(n):this.svg.removeChild(n)),r&&(i[r]=a),a},t.prototype.openGroup=function(t){t=t||{};var n=document.createElementNS(e,"g");return t.klass&&n.setAttribute("class",t.klass),t.fill&&n.setAttribute("fill",t.fill),t.stroke&&n.setAttribute("stroke",t.stroke),t["data-name"]&&n.setAttribute("data-name",t["data-name"]),t.prepend?this.prepend(n):this.append(n),this.currentGroup.unshift(n),n},t.prototype.closeGroup=function(){var e=this.currentGroup.shift();return e&&0===e.children.length?(e.parentElement.removeChild(e),null):e},t.prototype.path=function(t){var n=document.createElementNS(e,"path");for(var r in t)t.hasOwnProperty(r)&&("path"===r?n.setAttributeNS(null,"d",t.path):"klass"===r?n.setAttributeNS(null,"class",t[r]):void 0!==t[r]&&n.setAttributeNS(null,r,t[r]));return this.append(n),n},t.prototype.pathToBack=function(t){var n=document.createElementNS(e,"path");for(var r in t)t.hasOwnProperty(r)&&("path"===r?n.setAttributeNS(null,"d",t.path):"klass"===r?n.setAttributeNS(null,"class",t[r]):n.setAttributeNS(null,r,t[r]));return this.prepend(n),n},t.prototype.lineToBack=function(t){for(var n=document.createElementNS(e,"line"),r=Object.keys(t),i=0;i<r.length;i++)n.setAttribute(r[i],t[r[i]]);return this.prepend(n),n},t.prototype.append=function(e){this.currentGroup.length>0?this.currentGroup[0].appendChild(e):this.svg.appendChild(e)},t.prototype.prepend=function(e){this.currentGroup.length>0?this.currentGroup[0].appendChild(e):this.svg.insertBefore(e,this.svg.firstChild)},t.prototype.setAttributeOnElement=function(e,t){for(var n in t)t.hasOwnProperty(n)&&e.setAttributeNS(null,n,t[n])},t.prototype.moveElementToChild=function(e,t){e.appendChild(t)},rp=t}(),n=function(n){this.paper=new t(n),this.controller=null,this.space=3*e.SPACE,this.padding={},this.reset(),this.firefox112=navigator.userAgent.indexOf("Firefox/112.0")>=0};return n.prototype.reset=function(){this.paper.clear(),this.y=0,this.abctune=null,this.path=null,this.isPrint=!1,this.lineThickness=0,this.initVerticalSpace()},n.prototype.newTune=function(e){this.abctune=e,this.setVerticalSpace(e.formatting),this.isPrint="print"===e.media,this.setPadding(e)},n.prototype.setLineThickness=function(e){this.lineThickness=e},n.prototype.setPaddingOverride=function(e){this.paddingOverride={top:e.paddingtop,bottom:e.paddingbottom,right:e.paddingright,left:e.paddingleft}},n.prototype.setPadding=function(e){function t(t,n,r,i,a){void 0!==e.formatting[r]?t.padding[n]=e.formatting[r]:void 0!==t.paddingOverride[n]?t.padding[n]=t.paddingOverride[n]:t.isPrint?t.padding[n]=i:t.padding[n]=a}t(this,"top","topmargin",38,15),t(this,"bottom","botmargin",38,15),t(this,"left","leftmargin",68,15),t(this,"right","rightmargin",68,15)},n.prototype.adjustNonScaledItems=function(e){this.padding.top/=e,this.padding.bottom/=e,this.padding.left/=e,this.padding.right/=e,this.abctune.formatting.headerfont.size/=e,this.abctune.formatting.footerfont.size/=e},n.prototype.initVerticalSpace=function(){this.spacing={composer:7.56,graceBefore:8.67,graceInside:10.67,graceAfter:16,info:0,lineSkipFactor:1.1,music:7.56,paragraphSkipFactor:.4,parts:11.33,slurHeight:1,staffSeparation:61.33,staffTopMargin:0,stemHeight:36.67,subtitle:3.78,systemStaffSeparation:48,text:18.9,title:7.56,top:30.24,vocal:0,words:0}},n.prototype.setVerticalSpace=function(e){void 0!==e.staffsep&&(this.spacing.staffSeparation=4*e.staffsep/3),void 0!==e.composerspace&&(this.spacing.composer=4*e.composerspace/3),void 0!==e.partsspace&&(this.spacing.parts=4*e.partsspace/3),void 0!==e.textspace&&(this.spacing.text=4*e.textspace/3),void 0!==e.musicspace&&(this.spacing.music=4*e.musicspace/3),void 0!==e.titlespace&&(this.spacing.title=4*e.titlespace/3),void 0!==e.sysstaffsep&&(this.spacing.systemStaffSeparation=4*e.sysstaffsep/3),void 0!==e.stafftopmargin&&(this.spacing.staffTopMargin=4*e.stafftopmargin/3),void 0!==e.subtitlespace&&(this.spacing.subtitle=4*e.subtitlespace/3),void 0!==e.topspace&&(this.spacing.top=4*e.topspace/3),void 0!==e.vocalspace&&(this.spacing.vocal=4*e.vocalspace/3),void 0!==e.wordsspace&&(this.spacing.words=4*e.wordsspace/3)},n.prototype.calcY=function(t){return this.y-t*e.STEP},n.prototype.moveY=function(e,t){void 0===t&&(t=1),this.y+=e*t},n.prototype.absolutemoveY=function(e){this.y=e},ap=n}(),r=cp?op:(cp=1,op=function(e,t,n,r,i,a){var s,o=e.text;this.rows=[],t&&this.rows.push({move:t});var c=n.calc("textfont","defined-text");if(""===o)this.rows.push({move:2*c.attr["font-size"]});else if("string"==typeof o)this.rows.push({move:c.attr["font-size"]/2}),this.rows.push({left:r,text:o,font:"textfont",klass:"defined-text",anchor:"start",startChar:e.startChar,endChar:e.endChar,absElemType:"freeText",name:"free-text"}),s=a.calc(o,"textfont","defined-text"),this.rows.push({move:s.height});else if(o){for(var l=0,u=r,h="textfont",d=0;d<o.length;d++)h=o[d].font?o[d].font:"textfont",this.rows.push({left:u,text:o[d].text,font:h,klass:"defined-text",anchor:"start",startChar:e.startChar,endChar:e.endChar,absElemType:"freeText",name:"free-text"}),u+=(s=a.calc(o[d].text,n.calc(h,"defined-text").font,"defined-text")).width+s.height/2,l=Math.max(l,s.height);this.rows.push({move:l})}else if(1===e.length){var f=i/2;this.rows.push({left:f,text:e[0].text,font:"textfont",klass:"defined-text",anchor:"middle",startChar:e.startChar,endChar:e.endChar,absElemType:"freeText",name:"free-text"}),s=a.calc(e[0].text,"textfont","defined-text"),this.rows.push({move:s.height})}}),i=up?lp:(up=1,lp=function(e,t,n){this.rows=[],e&&this.rows.push({move:e}),this.rows.push({separator:t,absElemType:"separator"}),n&&this.rows.push({move:n})}),a=dp?hp:(dp=1,hp=function(e,t,n,r,i,a){this.rows=[],e&&this.rows.push({move:e});var s=t.titleleft?"start":"middle",o=t.titleleft?i:r;this.rows.push({left:o,text:n.text,font:"subtitlefont",klass:"text subtitle",anchor:s,startChar:n.startChar,endChar:n.endChar,absElemType:"subtitle",name:"subtitle"});var c=a.calc(n.text,"subtitlefont","text subtitle");this.rows.push({move:c.height})}),s=function(){if(yp)return vp;yp=1;const e=Nv(),t=Dv();return vp=function(n,r,i,a,s,o,c,l,u,h){if(this.rows=[],n.header&&o){var d=h.calc("X","headerfont","abcjs-header abcjs-meta-top").height;e(this.rows,{marginLeft:c,text:n.header.left,font:"headerfont",klass:"header meta-top",marginTop:-d,info:r.header,name:"header"},h),e(this.rows,{marginLeft:c+s/2,text:n.header.center,font:"headerfont",klass:"header meta-top",marginTop:-d,anchor:"middle",info:r.header,name:"header"},h),e(this.rows,{marginLeft:c+s,text:n.header.right,font:"headerfont",klass:"header meta-top",marginTop:-d,anchor:"end",info:r.header,name:"header"},h)}o&&this.rows.push({move:l.top});var f=i.titleleft?"start":"middle",p=i.titleleft?c:c+s/2;if(n.title){var m=u?"abcjs-title":"";t(this.rows,n.title,"titlefont",m,"title",p,{marginTop:l.title,anchor:f,absElemType:"title",info:r.title},h)}if(a.length)for(var g=0;g<a.length&&a[g].subtitle;)m=u?"abcjs-text abcjs-subtitle":"",t(this.rows,a[g].subtitle.text,"subtitlefont",m,"subtitle",p,{marginTop:l.subtitle,anchor:f,absElemType:"subtitle",info:a[g].subtitle},h),g++;if(n.rhythm||n.origin||n.composer){if(this.rows.push({move:l.composer}),n.rhythm&&n.rhythm.length>0){var v=!(!n.composer&&!n.origin);m=u?"abcjs-rhythm":"",e(this.rows,{marginLeft:c,text:n.rhythm,font:"infofont",klass:m,absElemType:"rhythm",noMove:v,info:r.rhythm,name:"rhythm"},h)}n.composer&&n.composer,n.origin&&n.origin;var y=n.composer?n.composer:"";n.origin&&("string"==typeof y&&"string"==typeof n.origin?y+=" ("+n.origin+")":"string"==typeof y&&"string"!=typeof n.origin?((y=[{text:y}]).push({text:" ("}),(y=y.concat(n.origin)).push({text:")"})):(y.push({text:" ("}),(y=y.concat(n.origin)).push({text:")"}))),y&&(m=u?"abcjs-composer":"",t(this.rows,y,"composerfont",m,"composer",c+s,{anchor:"end",absElemType:"composer",info:r.composer,ingroup:!0},h))}n.author&&n.author.length>0&&(m=u?"abcjs-author":"",t(this.rows,n.author,"composerfont",m,"author",c+s,{anchor:"end",absElemType:"author",info:r.author},h)),n.partOrder&&n.partOrder.length>0&&(m=u?"abcjs-part-order":"",t(this.rows,n.partOrder,"partsfont",m,"part-order",c,{absElemType:"partOrder",info:r.partOrder,anchor:"start"},h))}}(),o=function(){if(_p)return bp;_p=1;const e=Nv(),t=Dv();function n(e,t,n,r,i,a,s){this.rows=[],e.unalignedWords&&e.unalignedWords.length>0&&this.unalignedWords(e.unalignedWords,r,i,a,s),this.extraText(e,r,i,a,s),e.footer&&n&&this.footer(e.footer,t,r,s)}function r(e,n,r,i,a,s,o){r&&(n&&(r="string"==typeof r?n+r:[{text:n}].concat(r)),t(e,r,"historyfont",a=s?"abcjs-extra-text "+a:"","description",i,{absElemType:"extraText",anchor:"start"},o))}function i(n,r,i,a,s,o,c,l,u,h,d,f){if(i){l=d?"abcjs-extra-text "+l:"";var p=f.calc("A",s,l);if("string"==typeof i)r&&(i=r+"\n"+i),e(n,{marginLeft:a,text:i,font:s,absElemType:"extraText",name:u,"dominant-baseline":"middle",klass:l},f);else{n.push({startGroup:c,klass:l,name:u}),n.push({move:h.info}),r&&(e(n,{marginLeft:a,text:r,font:s,absElemType:"extraText",name:u,"dominant-baseline":"middle"},f),n.push({move:3*p.height/4}));for(var m=0;m<i.length;m++)t(n,i[m],s,"",u,a,{anchor:"start"},f),m<i.length-1&&"string"==typeof i[m]&&"string"!=typeof i[m+1]&&n.push({move:3*p.height/4});n.push({endGroup:c,absElemType:o,startChar:-1,endChar:-1,name:u}),n.push({move:p.height})}}}return n.prototype.unalignedWords=function(e,t,n,r,a){var s=r?"abcjs-unaligned-words":"",o="wordsfont",c=a.calc("i",o,s);this.rows.push({move:n.words}),i(this.rows,"",e,t,o,"unalignedWords","unalignedWords",s,"unalignedWords",n,r,a),this.rows.push({move:c.height})},n.prototype.extraText=function(e,t,n,a,s){r(this.rows,"Book: ",e.book,t,"abcjs-book",a,s),r(this.rows,"Source: ",e.source,t,"abcjs-source",a,s),r(this.rows,"Discography: ",e.discography,t,"abcjs-discography",a,s),i(this.rows,"Notes:",e.notes,t,"historyfont","extraText","notes","abcjs-notes","description",n,a,s),r(this.rows,"Transcription: ",e.transcription,t,"abcjs-transcription",a,s),i(this.rows,"History:",e.history,t,"historyfont","extraText","history","abcjs-history","description",n,a,s),r(this.rows,"Copyright: ",e["abc-copyright"],t,"abcjs-copyright",a,s),r(this.rows,"Creator: ",e["abc-creator"],t,"abcjs-creator",a,s),r(this.rows,"Edited By: ",e["abc-edited-by"],t,"abcjs-edited-by",a,s)},n.prototype.footer=function(t,n,r,i){var a="header meta-bottom",s="footerfont";this.rows.push({startGroup:"footer",klass:a}),e(this.rows,{marginLeft:r,text:t.left,font:s,klass:a,name:"footer"},i),e(this.rows,{marginLeft:r+n/2,text:t.center,font:s,klass:a,anchor:"middle",name:"footer"},i),e(this.rows,{marginLeft:r+n,text:t.right,font:s,klass:a,anchor:"end",name:"footer"},i)},bp=n}(),c=function(){if(Sp)return kp;Sp=1;var e=hv(),t=Ov();function n(e){"keyboard"===this.dragMechanism&&0!==this.dragYStep&&this.dragTarget&&h.bind(this)(this.dragTarget,this.dragYStep,this.selectables.length,this.dragIndex,e),this.dragYStep=0}function r(e){switch(e.keyCode){case 38:case 40:e.preventDefault()}}function i(t){var n=!1,r=t.target.dataset.index;switch(t.keyCode){case 13:case 32:n=!0,this.dragTarget=this.selectables[r],this.dragIndex=r,this.dragMechanism="keyboard",l.bind(this)(t);break;case 38:n=!0,this.dragTarget=this.selectables[r],this.dragIndex=r,this.dragTarget&&this.dragTarget.isDraggable&&(this.dragging&&this.dragTarget.isDraggable&&this.dragTarget.absEl.highlight(void 0,this.dragColor),this.dragYStep--,this.dragTarget.svgEl.setAttribute("transform","translate(0,"+this.dragYStep*e.STEP+")"));break;case 40:n=!0,this.dragTarget=this.selectables[r],this.dragIndex=r,this.dragMechanism="keyboard",this.dragTarget&&this.dragTarget.isDraggable&&(this.dragging&&this.dragTarget.isDraggable&&this.dragTarget.absEl.highlight(void 0,this.dragColor),this.dragYStep++,this.dragTarget.svgEl.setAttribute("transform","translate(0,"+this.dragYStep*e.STEP+")"));break;case 9:0!==this.dragYStep&&l.bind(this)(t)}n&&t.preventDefault()}function a(e,t){var n,r,i,a,s,o,c=function(e,t){if(!t)return-1;for(var n=0;n<e.length;n++)if(t.dataset.index===e[n].svgEl.dataset.index)return n;return-1}(e.selectables,function(e){if(!e)return null;if("svg"===e.tagName)return e;if(!e.getAttribute)return null;for(var t=e.getAttribute("selectable");!t;)t=!e.parentElement||"svg"===(e=e.parentElement).tagName||e.getAttribute("selectable");return e}(t.target));return c>=0?(a=e.selectables[c].svgEl.getBBox(),s=t,o=e.scale,n=(i=a.x<=s.offsetX&&a.x+a.width>=s.offsetX&&a.y<=s.offsetY&&a.y+a.height>=s.offsetY||Math.abs(s.layerY/o-s.offsetY)<3?[s.offsetX,s.offsetY]:[s.layerX,s.layerY])[0],r=i[1]):(i=function(e){var t,n,r=1,i=1,a=e.target.closest("svg"),s=0;return a&&a.viewBox&&a.viewBox.baseVal&&(0!==a.viewBox.baseVal.width&&(r=a.viewBox.baseVal.width/a.clientWidth),0!==a.viewBox.baseVal.height&&(i=a.viewBox.baseVal.height/a.clientHeight),s=a.viewBox.baseVal.y),e.target&&"svg"===e.target.tagName?(t=e.offsetX,n=e.offsetY):(t=e.layerX,n=e.layerY),[t*=r,(n*=i)+s]}(t),c=function(e,t,n){for(var r=9999999,i=-1,a=0;a<e.selectables.length&&r>0;a++){var s=e.selectables[a];if(e.getDim(s),s.dim.left<t&&s.dim.right>t&&s.dim.top<n&&s.dim.bottom>n)i=a,r=0;else if(s.dim.top<n&&s.dim.bottom>n){var o=Math.min(Math.abs(s.dim.left-t),Math.abs(s.dim.right-t));o<r&&(r=o,i=a)}else if(s.dim.left<t&&s.dim.right>t){var c=Math.min(Math.abs(s.dim.top-n),Math.abs(s.dim.bottom-n));c<r&&(r=c,i=a)}else{var l=Math.abs(t-s.dim.left)>Math.abs(t-s.dim.right)?Math.abs(t-s.dim.right):Math.abs(t-s.dim.left),u=Math.abs(n-s.dim.top)>Math.abs(n-s.dim.bottom)?Math.abs(n-s.dim.bottom):Math.abs(n-s.dim.top),h=Math.sqrt(l*l+u*u);h<r&&(r=h,i=a)}}return i>=0&&r<=12?i:-1}(e,n=i[0],r=i[1])),{x:n,y:r,clickedOn:c}}function s(e){if(e&&e.target&&e.touches&&!(e.touches.length<1)){var t=e.target.getBoundingClientRect(),n=e.touches[0].pageX-t.left,r=e.touches[0].pageY-t.top;e.touches[0].offsetX=n,e.touches[0].offsetY=r,e.touches[0].layerX=e.touches[0].pageX,e.touches[0].layerY=e.touches[0].pageY}}function o(e){var t=e;"touchstart"===e.type&&(s(e),e.touches.length>0&&(t=e.touches[0]));var n=a(this,t);n.clickedOn>=0&&("touchstart"===e.type||0===e.button)&&this.selectables[n.clickedOn]&&(this.dragTarget=this.selectables[n.clickedOn],this.dragIndex=n.clickedOn,this.dragMechanism="mouse",this.dragMouseStart={x:n.x,y:n.y},this.dragging&&this.dragTarget.isDraggable&&(function(e){if(e){var t=p(e.svg);t["abcjs-dragging-in-progress"]=!0,m(e.svg,t)}}(this.renderer.paper),this.dragTarget.absEl.highlight(void 0,this.dragColor)))}function c(t){var n=t;if("touchmove"===t.type&&(s(t),t.touches.length>0&&(n=t.touches[0])),this.lastTouchMove=t,this.dragTarget&&this.dragging&&this.dragTarget.isDraggable&&"mouse"===this.dragMechanism&&this.dragMouseStart){var r=a(this,n),i=Math.round((r.y-this.dragMouseStart.y)/e.STEP);i!==this.dragYStep&&(this.dragYStep=i,this.dragTarget.svgEl.setAttribute("transform","translate(0,"+i*e.STEP+")"))}}function l(e){var t=e;"touchend"===e.type&&this.lastTouchMove&&(s(this.lastTouchMove),this.lastTouchMove&&this.lastTouchMove.touches&&this.lastTouchMove.touches.length>0&&(t=this.lastTouchMove.touches[0])),this.dragTarget&&(d.bind(this)(),this.dragTarget.absEl&&this.dragTarget.absEl.highlight&&(this.selected=[this.dragTarget.absEl],this.dragTarget.absEl.highlight(void 0,this.selectionColor)),h.bind(this)(this.dragTarget,this.dragYStep,this.selectables.length,this.dragIndex,t),this.dragTarget.svgEl&&this.dragTarget.svgEl.focus&&(this.dragTarget.svgEl.focus(),this.dragTarget=null,this.dragIndex=-1),function(e){if(e){var t=p(e.svg);delete t["abcjs-dragging-in-progress"],m(e.svg,t)}}(this.renderer.svg))}function u(e){e>=0&&e<this.selectables.length&&(this.dragTarget=this.selectables[e],this.dragIndex=e,this.dragMechanism="keyboard",l.bind(this)({target:this.dragTarget.svgEl}))}function h(e,n,r,i,a){for(var s=t(e,a),o=s.classes,c=s.analysis,l=0;l<this.listeners.length;l++)this.listeners[l](e.absEl.abcelem,e.absEl.tuneNumber,o.join(" "),c,{step:n,max:r,index:i,setSelection:u.bind(this)},a)}function d(){for(var e=0;e<this.selected.length;e++)this.selected[e].unhighlight(void 0,this.renderer.foregroundColor);this.selected=[]}function f(e,t){d.bind(this)();for(var n=0;n<this.staffgroups.length;n++)for(var r=this.staffgroups[n].voices,i=0;i<r.length;i++)for(var a=r[i].children,s=0;s<a.length;s++){var o=a[s].abcelem.startChar,c=a[s].abcelem.endChar;(t>o&&e<c||t===e&&t===c)&&(this.selected[this.selected.length]=a[s],a[s].highlight(void 0,this.selectionColor))}}function p(e){var t=e.getAttribute("class");t||(t="");for(var n=t.split(" "),r={},i=0;i<n.length;i++)r[n[i]]=!0;return r}function m(e,t){var n=[];for(var r in t)t.hasOwnProperty(r)&&n.push(r);e.setAttribute("class",n.join(" "))}return kp=function(e,t){if(e.rangeHighlight=f,e.dragging)for(var a=0;a<e.selectables.length;a++){var s=e.selectables[a];"true"===s.svgEl.getAttribute("selectable")&&(s.svgEl.setAttribute("tabindex",0),s.svgEl.setAttribute("data-index",a),s.svgEl.addEventListener("keydown",r.bind(e)),s.svgEl.addEventListener("keyup",i.bind(e)),s.svgEl.addEventListener("focus",n.bind(e)))}for(var u=0;u<t.length;u++)t[u].addEventListener("touchstart",o.bind(e),{passive:!0}),t[u].addEventListener("touchmove",c.bind(e),{passive:!0}),t[u].addEventListener("touchend",l.bind(e),{passive:!0}),t[u].addEventListener("mousedown",o.bind(e)),t[u].addEventListener("mousemove",c.bind(e)),t[u].addEventListener("mouseup",l.bind(e))}}(),l=Vv(),u=function(){if(Wp)return Gp;Wp=1;var e=function(e){this.shouldAddClasses=e.shouldAddClasses,this.reset()};return e.prototype.reset=function(){this.lineNumber=null,this.voiceNumber=null,this.measureNumber=null,this.measureTotalPerLine=[],this.noteNumber=null},e.prototype.incrLine=function(){null===this.lineNumber?this.lineNumber=0:this.lineNumber++,this.voiceNumber=null,this.measureNumber=null,this.noteNumber=null},e.prototype.incrVoice=function(){null===this.voiceNumber?this.voiceNumber=0:this.voiceNumber++,this.measureNumber=null,this.noteNumber=null},e.prototype.isInMeasure=function(){return null!==this.measureNumber},e.prototype.newMeasure=function(){this.measureNumber&&(this.measureTotalPerLine[this.lineNumber]=this.measureNumber),this.measureNumber=null,this.noteNumber=null},e.prototype.startMeasure=function(){this.measureNumber=0,this.noteNumber=0},e.prototype.incrMeasure=function(){this.measureNumber++,this.noteNumber=0},e.prototype.incrNote=function(){this.noteNumber++},e.prototype.measureTotal=function(){for(var e=0,t=0;t<this.lineNumber;t++)e+=this.measureTotalPerLine[t]?this.measureTotalPerLine[t]:0;return this.measureNumber&&(e+=this.measureNumber),e},e.prototype.getCurrent=function(e){return{line:this.lineNumber,measure:this.measureNumber,measureTotal:this.measureTotal(),voice:this.voiceNumber,note:this.noteNumber}},e.prototype.generate=function(e){if(!this.shouldAddClasses)return"";var t=[];if(e&&e.length>0&&t.push(e),"abcjs-tab-number"===e)return t.join(" ");if("text instrument-name"===e)return"abcjs-text abcjs-instrument-name";if(null!==this.lineNumber&&t.push("l"+this.lineNumber),null!==this.measureNumber&&t.push("m"+this.measureNumber),null!==this.measureNumber&&t.push("mm"+this.measureTotal()),null!==this.voiceNumber&&t.push("v"+this.voiceNumber),e&&(e.indexOf("note")>=0||e.indexOf("rest")>=0||e.indexOf("lyric")>=0)&&null!==this.noteNumber&&t.push("n"+this.noteNumber),t.length>0){t=(t=t.join(" ")).split(" ");for(var n=0;n<t.length;n++)0!==t[n].indexOf("abcjs-")&&t[n].length>0&&(t[n]="abcjs-"+t[n])}return t.join(" ")},Gp=e}(),h=function(){if($p)return Yp;$p=1;var e=function(e,t){this.formatting=e,this.classes=t};return e.prototype.updateFonts=function(e){e.gchordfont&&(this.formatting.gchordfont=e.gchordfont),e.tripletfont&&(this.formatting.tripletfont=e.tripletfont),e.annotationfont&&(this.formatting.annotationfont=e.annotationfont),e.vocalfont&&(this.formatting.vocalfont=e.vocalfont)},e.prototype.getFamily=function(e){return'"'===e[0]&&'"'===e[e.length-1]?e.substring(1,e.length-1):e},e.prototype.calc=function(e,t){var n;n="string"==typeof e?(n=this.formatting[e])?{face:n.face,size:Math.round(4*n.size/3),decoration:n.decoration,style:n.style,weight:n.weight,box:n.box}:{face:"Arial",size:Math.round(16),decoration:"underline",style:"normal",weight:"normal"}:{face:e.face,size:Math.round(4*e.size/3),decoration:e.decoration,style:e.style,weight:e.weight,box:e.box};var r=this.formatting.fontboxpadding?this.formatting.fontboxpadding:.1;return n.padding=n.size*r,{font:n,attr:{"font-size":n.size,"font-style":n.style,"font-family":this.getFamily(n.face),"font-weight":n.weight,"text-decoration":n.decoration,class:this.classes.generate(t)}}},Yp=e}(),d=function(){if(Qp)return Kp;Qp=1;var e=function(e,t){this.getFontAndAttr=e,this.svg=t};return e.prototype.updateFonts=function(e){this.getFontAndAttr.updateFonts(e)},e.prototype.attr=function(e,t){return this.getFontAndAttr.calc(e,t)},e.prototype.getFamily=function(e){return'"'===e[0]&&'"'===e[e.length-1]?e.substring(1,e.length-1):e},e.prototype.calc=function(e,t,n,r){var i;i="string"==typeof t?this.attr(t,n):{font:{face:t.face,size:t.size,decoration:t.decoration,style:t.style,weight:t.weight},attr:{"font-size":t.size,"font-style":t.style,"font-family":this.getFamily(t.face),"font-weight":t.weight,"text-decoration":t.decoration,class:this.getFontAndAttr.classes.generate(n)}};var a=this.svg.getTextSize(e,i.attr,r);return i.font.box?{height:a.height+4*i.font.padding,width:a.width+4*i.font.padding}:a},e.prototype.baselineToCenter=function(e,t,n,r,i){return.5*this.calc(e,t,n).height+(i-r-2)*this.attr(t,n).font.size},Kp=e}(),f=Zv(),p=Mv(),m=function(){if(ng)return tg;ng=1;var e=Ov();return tg=function(t){for(var n=t;n&&n.attributes&&"svg"!==n.tagName.toLowerCase()&&!n.attributes.selectable;)n=n.parentNode;if(n&&n.attributes&&n.attributes.selectable){var r=n.attributes["data-index"].nodeValue;if(r&&(r=parseInt(r,10))>=0&&r<this.selectables.length){var i=this.selectables[r],a=e(i,t);return a.index=r,a.element=i,a}}return null}}(),g=function(t,r){r=r||{},this.findSelectableElement=m,this.oneSvgPerLine=r.oneSvgPerLine,this.selectionColor=r.selectionColor,this.dragColor=r.dragColor?r.dragColor:r.selectionColor,this.dragging=!!r.dragging,this.selectTypes=r.selectTypes,this.responsive=r.responsive,this.space=3*e.SPACE,this.initialClef=r.initialClef,this.timeBasedLayout=r.timeBasedLayout,this.expandToWidest=!!r.expandToWidest,this.scale=r.scale?parseFloat(r.scale):0,this.classes=new u({shouldAddClasses:r.add_classes}),this.scale>.1||(this.scale=void 0),r.staffwidth?(this.staffwidthScreen=r.staffwidth,this.staffwidthPrint=r.staffwidth):(this.staffwidthScreen=740,this.staffwidthPrint=680),this.listeners=[],r.clickListener&&this.addSelectListener(r.clickListener),this.renderer=new n(t),this.renderer.setPaddingOverride(r),r.showDebug&&(this.renderer.showDebug=r.showDebug),r.jazzchords&&(this.jazzchords=r.jazzchords),r.accentAbove&&(this.accentAbove=r.accentAbove),r.germanAlphabet&&(this.germanAlphabet=r.germanAlphabet),r.lineThickness&&(this.lineThickness=r.lineThickness),this.renderer.controller=this,this.renderer.foregroundColor=r.foregroundColor?r.foregroundColor:"currentColor",void 0!==r.ariaLabel&&(this.renderer.ariaLabel=r.ariaLabel),this.renderer.minPadding=r.minPadding?r.minPadding:0,this.reset()};function v(e){for(var t=document.createElementNS("http://www.w3.org/2000/svg","svg"),n=0;n<e.attributes.length;n++){var r=e.attributes[n];"height"!==r.name&&"aria-label"!=r.name&&t.setAttribute(r.name,r.value)}return t}return g.prototype.reset=function(){this.selected=[],this.staffgroups=[],this.engraver&&this.engraver.reset(),this.engraver=null,this.renderer.reset(),this.dragTarget=null,this.dragIndex=-1,this.dragMouseStart={x:-1,y:-1},this.dragYStep=0,this.lineThickness&&this.renderer.setLineThickness(this.lineThickness)},g.prototype.engraveABC=function(e,t,n){void 0===e[0]&&(e=[e]),this.reset();for(var r=0;r<e.length;r++)void 0===t&&(t=r),this.getFontAndAttr=new h(e[r].formatting,this.classes),this.getTextSize=new d(this.getFontAndAttr,this.renderer.paper),this.engraveTune(e[r],t,n)},g.prototype.adjustNonScaledItems=function(e){this.width/=e,this.renderer.adjustNonScaledItems(e)},g.prototype.getMeasureWidths=function(e){this.reset(),this.getFontAndAttr=new h(e.formatting,this.classes),this.getTextSize=new d(this.getFontAndAttr,this.renderer.paper);var t=this.jazzchords;this.setupTune(e,0),this.constructTuneElements(e),l(this.renderer,e,0,this.space,this.timeBasedLayout);for(var n,r=[],i=!0,a=0;a<e.lines.length;a++){var s=e.lines[a];if(s.staff){if(i&&(n={left:0,measureWidths:[],total:0},r.push(n),i=!1),s.staffGroup.voices.length>0)for(var o=s.staffGroup.voices[0],c=!1,u=0,f=0;f<o.children.length;f++){var p=o.children[f];c||p.isClef||p.isKeySig||(c=!0,n.left=p.x,u=p.x),"bar"===p.type&&(n.measureWidths.push(p.x-u),n.total+=p.x-u,u=p.x)}}else i=!0}return this.jazzchords=t,r},g.prototype.setupTune=function(e,n){this.classes.reset(),void 0!==e.formatting.jazzchords&&(this.jazzchords=e.formatting.jazzchords),void 0!==e.formatting.accentAbove&&(this.accentAbove=e.formatting.accentAbove),this.renderer.newTune(e),this.engraver=new t(this.getTextSize,n,{bagpipes:e.formatting.bagpipes,flatbeams:e.formatting.flatbeams,graceSlurs:!1!==e.formatting.graceSlurs,percmap:e.formatting.percmap,initialClef:this.initialClef,jazzchords:this.jazzchords,timeBasedLayout:this.timeBasedLayout,accentAbove:this.accentAbove,germanAlphabet:this.germanAlphabet}),this.engraver.setStemHeight(this.renderer.spacing.stemHeight),this.engraver.measureLength=e.getMeterFraction().num/e.getMeterFraction().den,e.formatting.staffwidth?this.width=1.33*e.formatting.staffwidth:this.width=this.renderer.isPrint?this.staffwidthPrint:this.staffwidthScreen;var r=e.formatting.scale?e.formatting.scale:this.scale;return"resize"===this.responsive&&(r=void 0),void 0===r&&(r=this.renderer.isPrint?.75:1),this.adjustNonScaledItems(r),r},g.prototype.constructTuneElements=function(e){var t,n;e.topText=new s(e.metaText,e.metaTextInfo,e.formatting,e.lines,this.width,this.renderer.isPrint,this.renderer.padding.left,this.renderer.spacing,this.classes.shouldAddClasses,this.getTextSize);var c=!1,l=!1;for(t=0;t<e.lines.length;t++)if((n=e.lines[t]).staff)l=!0,n.staffGroup=this.engraver.createABCLine(n.staff,c?null:e.metaText.tempo,t),c=!0;else if(n.subtitle){if(l){var u=this.width/2+this.renderer.padding.left;n.nonMusic=new a(this.renderer.spacing.subtitle,e.formatting,n.subtitle,u,this.renderer.padding.left,this.getTextSize)}}else void 0!==n.text?(l=!0,n.nonMusic=new r(n.text,n.vskip,this.getFontAndAttr,this.renderer.padding.left,this.width,this.getTextSize)):void 0!==n.separator&&n.separator.lineLength&&(l=!0,n.nonMusic=new i(n.separator.spaceAbove,n.separator.lineLength,n.separator.spaceBelow));e.bottomText=new o(e.metaText,this.width,this.renderer.isPrint,this.renderer.padding.left,this.renderer.spacing,this.classes.shouldAddClasses,this.getTextSize)},g.prototype.engraveTune=function(e,t,n){var r=this.jazzchords,i=this.setupTune(e,t);this.constructTuneElements(e);var a=l(this.renderer,e,this.width,this.space,this.expandToWidest,this.timeBasedLayout);if(this.expandToWidest&&a>this.width+1&&(e.topText=new s(e.metaText,e.metaTextInfo,e.formatting,e.lines,a,this.renderer.isPrint,this.renderer.padding.left,this.renderer.spacing,this.classes.shouldAddClasses,this.getTextSize),e.lines&&e.lines.length>0))for(var o=e.lines.length,u=0;u<o;++u){var h=e.lines[u];if(h.nonMusic&&h.nonMusic.rows&&h.nonMusic.rows.length>0)for(var d=h.nonMusic.rows.length,m=0;m<d;++m){var g=h.nonMusic.rows[m];g.left&&(h.subtitle||h.text&&h.text.length>0&&h.text[0].center)&&(g.left=a/2+this.renderer.padding.left)}}e.tablatures&&p.layoutTablatures(this.renderer,e);var y=f(this.renderer,this.classes,e,this.width,a,this.responsive,i,this.selectTypes,t,n);if(this.staffgroups=y.staffgroups,this.selectables=y.selectables,this.oneSvgPerLine){var b=this.renderer.paper.svg.parentNode;this.svgs=function(e,t,n,r,i){n||(n="Untitled");var a=t.querySelector("svg");"resize"===r&&(t.style.paddingBottom="");for(var s=a.querySelector("style"),o="resize"===r?a.viewBox.baseVal.width:a.getAttribute("width"),c=t.querySelectorAll("svg > g"),l=0,u=[],h=0;h<c.length;h++){var d=c[h],f=d.getBBox(),p=f.y-l,m=f.height+p,g=document.createElement("div"),y="overflow: hidden;";"resize"!==r&&(y+="height:"+m*i+"px;"),g.setAttribute("style",y);var b=v(a),_='Sheet Music for "'+n+'" section '+(h+1);b.setAttribute("aria-label",_),"resize"!==r&&b.setAttribute("height",m),"resize"===r&&(b.style.position="");var w=e.firefox112?m+1:m;b.setAttribute("viewBox","0 "+l+" "+o+" "+w),b.appendChild(s.cloneNode(!0));var x=document.createElement("title");x.innerText=_,b.appendChild(x),b.appendChild(d),g.appendChild(b),u.push(b),t.appendChild(g),l=f.y+f.height}return t.removeChild(a),u}(this.renderer,b,e.metaText.title,this.responsive,i)}else this.svgs=[this.renderer.paper.svg];c(this,this.svgs),this.jazzchords=r},g.prototype.getDim=function(e){if(!e.dim){var t=e.svgEl.getBBox();e.dim={left:Math.round(t.x),top:Math.round(t.y),right:Math.round(t.x+t.width),bottom:Math.round(t.y+t.height)}}return e.dim},g.prototype.addSelectListener=function(e){this.listeners[this.listeners.length]=e},rg=g}function ey(){if(sg)return ag;sg=1;var e=Ev();pv();var t=Jv(),n=mv(),r=uv(),i={};function a(){var e=window.innerWidth;for(var t in i)if(i.hasOwnProperty(t)){var n=i[t];e-=2*n.offsetLeft,n.style.width=e+"px"}}try{window.addEventListener("resize",a),window.addEventListener("orientationChange",a)}catch(o){}function s(e,n,r,a,s){r.viewportHorizontal?(e.innerHTML='<div class="abcjs-inner"></div>',r.scrollHorizontal?(e.style.overflowX="auto",e.style.overflowY="hidden"):e.style.overflow="hidden",i[e.id]=e,e=e.children[0]):r.viewportVertical?(e.innerHTML='<div class="abcjs-inner scroll-amount"></div>',e.style.overflowX="hidden",e.style.overflowY="auto",e=e.children[0]):e.innerHTML="";var o=new t(e,r);o.engraveABC(n,a,s),n.engraver=o,(r.viewportVertical||r.viewportHorizontal)&&(e.parentNode.style.width=e.style.width)}return ag=function(i,a,o,c,l){var u,h={};if(o){for(u in o)o.hasOwnProperty(u)&&(h[u]=o[u]);h.warnings_id&&h.tablature&&(h.tablature.warning_id=h.warnings_id)}if(c)for(u in c)c.hasOwnProperty(u)&&("listener"===u?c[u].highlight&&(h.clickListener=c[u].highlight):h[u]=c[u]);if(l)for(u in l)l.hasOwnProperty(u)&&(h[u]=l[u]);return e.renderEngine((function(e,i,a,o){var c=!1;return"*"===e&&(c=!0,(e=document.createElement("div")).setAttribute("style","visibility: hidden;"),document.body.appendChild(e)),!c&&h.wrap&&h.staffwidth?i=function(e,i,a,o,c){var l=new t(e,c).getMeasureWidths(i),u=r.calcLineWraps(i,l,c);if(u.reParse){var h=new n;h.parse(o,u.revisedParams),i=h.getTune();var d=h.getWarnings();d&&(i.warnings=d)}return c.afterParsing&&c.afterParsing(i,a,o),s(e,i,u.revisedParams,a,0),i.explanation=u.explanation,i}(e,i,a,o,h):(h.afterParsing&&h.afterParsing(i,a,o),s(e,i,h,a,0),c&&e.parentNode.removeChild(e),null)}),i,a,h)}}function ty(){return ug?lg:(ug=1,lg={})}function ny(){return pg?fg:(pg=1,fg=["acoustic_grand_piano","bright_acoustic_piano","electric_grand_piano","honkytonk_piano","electric_piano_1","electric_piano_2","harpsichord","clavinet","celesta","glockenspiel","music_box","vibraphone","marimba","xylophone","tubular_bells","dulcimer","drawbar_organ","percussive_organ","rock_organ","church_organ","reed_organ","accordion","harmonica","tango_accordion","acoustic_guitar_nylon","acoustic_guitar_steel","electric_guitar_jazz","electric_guitar_clean","electric_guitar_muted","overdriven_guitar","distortion_guitar","guitar_harmonics","acoustic_bass","electric_bass_finger","electric_bass_pick","fretless_bass","slap_bass_1","slap_bass_2","synth_bass_1","synth_bass_2","violin","viola","cello","contrabass","tremolo_strings","pizzicato_strings","orchestral_harp","timpani","string_ensemble_1","string_ensemble_2","synth_strings_1","synth_strings_2","choir_aahs","voice_oohs","synth_choir","orchestra_hit","trumpet","trombone","tuba","muted_trumpet","french_horn","brass_section","synth_brass_1","synth_brass_2","soprano_sax","alto_sax","tenor_sax","baritone_sax","oboe","english_horn","bassoon","clarinet","piccolo","flute","recorder","pan_flute","blown_bottle","shakuhachi","whistle","ocarina","lead_1_square","lead_2_sawtooth","lead_3_calliope","lead_4_chiff","lead_5_charang","lead_6_voice","lead_7_fifths","lead_8_bass_lead","pad_1_new_age","pad_2_warm","pad_3_polysynth","pad_4_choir","pad_5_bowed","pad_6_metallic","pad_7_halo","pad_8_sweep","fx_1_rain","fx_2_soundtrack","fx_3_crystal","fx_4_atmosphere","fx_5_brightness","fx_6_goblins","fx_7_echoes","fx_8_scifi","sitar","banjo","shamisen","koto","kalimba","bagpipe","fiddle","shanai","tinkle_bell","agogo","steel_drums","woodblock","taiko_drum","melodic_tom","synth_drum","reverse_cymbal","guitar_fret_noise","breath_noise","seashore","bird_tweet","telephone_ring","helicopter","applause","gunshot","percussion"])}function ry(){return yg?vg:(yg=1,vg=function(e){if(e)window.abcjsAudioContext=e;else if(!window.abcjsAudioContext){var t=window.AudioContext||window.webkitAudioContext;if(!t)return!1;window.abcjsAudioContext=new t}return"suspended"!==window.abcjsAudioContext.state})}function iy(){if(_g)return bg;_g=1;var e=ry();return bg=function(){return window.abcjsAudioContext||e(),window.abcjsAudioContext}}function ay(){if(xg)return wg;xg=1;var e=iy();return wg=function(){if(!window.Promise)return!1;if(!(window.AudioContext||window.webkitAudioContext||navigator.mozAudioContext||navigator.msAudioContext))return!1;var t=e();return t?void 0!==t.resume:void 0}}function sy(){return Sg?kg:(Sg=1,kg={21:"A0",22:"Bb0",23:"B0",24:"C1",25:"Db1",26:"D1",27:"Eb1",28:"E1",29:"F1",30:"Gb1",31:"G1",32:"Ab1",33:"A1",34:"Bb1",35:"B1",36:"C2",37:"Db2",38:"D2",39:"Eb2",40:"E2",41:"F2",42:"Gb2",43:"G2",44:"Ab2",45:"A2",46:"Bb2",47:"B2",48:"C3",49:"Db3",50:"D3",51:"Eb3",52:"E3",53:"F3",54:"Gb3",55:"G3",56:"Ab3",57:"A3",58:"Bb3",59:"B3",60:"C4",61:"Db4",62:"D4",63:"Eb4",64:"E4",65:"F4",66:"Gb4",67:"G4",68:"Ab4",69:"A4",70:"Bb4",71:"B4",72:"C5",73:"Db5",74:"D5",75:"Eb5",76:"E5",77:"F5",78:"Gb5",79:"G5",80:"Ab5",81:"A5",82:"Bb5",83:"B5",84:"C6",85:"Db6",86:"D6",87:"Eb6",88:"E6",89:"F6",90:"Gb6",91:"G6",92:"Ab6",93:"A6",94:"Bb6",95:"B6",96:"C7",97:"Db7",98:"D7",99:"Eb7",100:"E7",101:"F7",102:"Gb7",103:"G7",104:"Ab7",105:"A7",106:"Bb7",107:"B7",108:"C8",109:"Db8",110:"D8",111:"Eb8",112:"E8",113:"F8",114:"Gb8",115:"G8",116:"Ab8",117:"A8",118:"Bb8",119:"B8",120:"C9",121:"Db9"})}function oy(){return Tg?Eg:(Tg=1,Eg=function(e){return Math.pow(2,e/1200)})}function cy(){if(Ng)return Ig;Ng=1;var e=function(){if(dg)return hg;dg=1;var e=ty();return hg=function(t,n,r,i){e[n]||(e[n]={});var a=e[n];return a[r]||(a[r]=new Promise((function(e,a){var s=new XMLHttpRequest;let o=t+n+"-mp3/"+r+".mp3";s.open("GET",o,!0),s.responseType="arraybuffer",s.onload=function(){if(200===s.status){var t=i.decodeAudioData(s.response,(function(t){e({instrument:n,name:r,status:"loaded",audioBuffer:t})}),(function(){a(Error("Can't decode sound at "+o))}));t&&"function"==typeof t.catch&&t.catch(a)}else a(Error("Can't load sound at "+o+" status="+s.status))},s.onerror=function(){a(Error("Can't load sound at "+o))},s.send()})).catch((e=>{throw console.error("Didn't load note",n,r,":",e.message),e}))),a[r]}}(),t=function(){if(gg)return mg;gg=1;var e=ny();return mg=function(t){for(var n=[],r=0;r<t.tracks.length;r++)n.push([]);var i=e[0];return t.tracks.forEach((function(t,r){t.forEach((function(t){switch(t.cmd){case"note":var a=void 0!==t.instrument?e[t.instrument]:i;if(t.duration>0){var s=t.gap?t.gap:0,o=t.duration;s=Math.min(s,2*o/3);var c={pitch:t.pitch,instrument:a,start:Math.round(1e6*t.start)/1e6,end:Math.round(1e6*(t.start+o-s))/1e6,volume:t.volume};t.startChar&&(c.startChar=t.startChar),t.endChar&&(c.endChar=t.endChar),t.style&&(c.style=t.style),t.cents&&(c.cents=t.cents),n[r].push(c)}break;case"program":i=e[t.instrument];break;case"text":break;default:console.log("Unhandled midi event",t)}}))})),n}}(),n=ry(),r=iy(),i=ay(),a=sy(),s=ny(),o=Mg?Cg:(Mg=1,Cg=function(e){return window.URL.createObjectURL(function(e){var t,n,r=e[0],i=r.numberOfChannels,a=r.length*i*2+44,s=new ArrayBuffer(a),o=new DataView(s),c=[],l=0,u=0;for(d(1179011410),d(a-8),d(1163280727),d(544501094),d(16),h(1),h(i),d(r.sampleRate),d(2*r.sampleRate*i),h(2*i),h(16),d(1635017060),d(a-u-4),t=0;t<i;t++)c.push(r.getChannelData(t));for(;u<a;){for(t=0;t<c.length;t++)n=0|(.5+(n=Math.max(-1,Math.min(1,c[t][l])))<0?32768*n:32767*n),o.setInt16(u,n,!0),u+=2;l++}return new Blob([s],{type:"audio/wav"});function h(e){o.setUint16(u,e,!0),u+=2}function d(e){o.setUint32(u,e,!0),u+=4}}(e.audioBuffers))}),c=function(){if(Pg)return Ag;Pg=1;var e=ty(),t=sy(),n=oy(),r=function(e,t,n){for(var r=0;r<2;r++)for(var i=t.getChannelData(r),a=e.getChannelData(r),s=0;s<i.length;s++)a[s+n]+=i[s]};return Ag=function(i,a,s,o,c,l,u,h,d){var f=window.OfflineAudioContext||window.webkitOfflineAudioContext,p=s.len*s.tempoMultiplier;l&&(p+=l/1e3),(p-=h)<0&&(p=.005);var m=new f(2,Math.floor((p+u)*a),a),g=t[s.pitch];if(!e[s.instrument])return d&&d("placeNote skipped (instrument empty): "+s.instrument+":"+g),Promise.resolve();var v=e[s.instrument][g];return v?v.then((function(e){var t=m.createBufferSource();t.buffer=e.audioBuffer;var h,f=s.volume/96*c;return t.gainNode=m.createGain(),s.pan&&m.createStereoPanner&&(t.panNode=m.createStereoPanner(),t.panNode.pan.setValueAtTime(s.pan,0)),t.gainNode.gain.value=f,t.gainNode.gain.linearRampToValueAtTime(t.gainNode.gain.value,p),t.gainNode.gain.linearRampToValueAtTime(0,p+u),s.cents&&(t.playbackRate.value=n(s.cents)),t.panNode?(t.panNode.connect(m.destination),t.gainNode.connect(t.panNode)):t.gainNode.connect(m.destination),t.connect(t.gainNode),t.start(0),t.noteOff?t.noteOff(p+u):t.stop(p+u),m.oncomplete=function(e){if(e.renderedBuffer&&e.renderedBuffer.getChannelData)for(var t=0;t<o.length;t++){var n=o[t]*s.tempoMultiplier;l&&(n-=l/1e3),n<0&&(n=0),n=Math.floor(n*a),r(i,e.renderedBuffer,n)}d&&d("placeNote: "+s.instrument+":"+g),h()},m.startRendering(),new Promise((function(e){h=e}))})).catch((function(e){return d&&d("placeNote catch: "+e.message),Promise.resolve()})):(d&&d("placeNote skipped: "+s.instrument+":"+g),Promise.resolve())}}(),l=ty(),u="MIDI is not supported in this browser.",h="https://paulrosen.github.io/midi-js-soundfonts/abcjs/",d="https://paulrosen.github.io/midi-js-soundfonts/FluidR3_GM/";return Ig=function(){var f=this;f.audioBufferPossible=void 0,f.directSource=[],f.startTimeSec=void 0,f.pausedTimeSec=void 0,f.audioBuffers=[],f.duration=void 0,f.isRunning=!1,f.options=void 0,f.pickupLength=0,f.init=function(e){e||(e={}),e.options&&(f.options=e.options),n(e.audioContext);var t=r().currentTime;if(f.debugCallback=e.debugCallback,f.debugCallback&&f.debugCallback("init called"),f.audioBufferPossible=f._deviceCapable(),!f.audioBufferPossible)return Promise.reject({status:"NotSupported",message:u});var i=e.options?e.options:{};f.soundFontUrl=i.soundFontUrl?i.soundFontUrl:d,"/"!==f.soundFontUrl[f.soundFontUrl.length-1]&&(f.soundFontUrl+="/"),i.soundFontVolumeMultiplier||0===i.soundFontVolumeMultiplier?f.soundFontVolumeMultiplier=i.soundFontVolumeMultiplier:f.soundFontUrl===d||"https://paulrosen.github.io/midi-js-soundfonts/MusyngKite/"===f.soundFontUrl?f.soundFontVolumeMultiplier=3:f.soundFontUrl===h?f.soundFontVolumeMultiplier=.4:f.soundFontVolumeMultiplier=1,i.programOffsets?f.programOffsets=i.programOffsets:f.soundFontUrl===h?f.programOffsets={bright_acoustic_piano:20,honkytonk_piano:20,electric_piano_1:30,electric_piano_2:30,harpsichord:40,clavinet:20,celesta:20,glockenspiel:40,vibraphone:30,marimba:35,xylophone:30,tubular_bells:35,dulcimer:30,drawbar_organ:20,percussive_organ:25,rock_organ:20,church_organ:40,reed_organ:40,accordion:40,harmonica:40,acoustic_guitar_nylon:20,acoustic_guitar_steel:30,electric_guitar_jazz:25,electric_guitar_clean:15,electric_guitar_muted:35,overdriven_guitar:25,distortion_guitar:20,guitar_harmonics:30,electric_bass_finger:15,electric_bass_pick:30,fretless_bass:40,violin:105,viola:50,cello:40,contrabass:60,trumpet:10,trombone:90,alto_sax:20,tenor_sax:20,clarinet:20,flute:50,banjo:50,woodblock:20}:f.programOffsets={};var o=void 0!==i.fadeLength?parseInt(i.fadeLength,10):NaN;if(f.fadeLength=isNaN(o)?200:o,o=void 0!==i.noteEnd?parseInt(i.noteEnd,10):NaN,f.noteEnd=isNaN(o)?0:o,f.pan=i.pan,f.meterSize=1,e.visualObj)f.flattened=e.visualObj.setUpAudio(i),e.visualObj.getMeterFraction().den&&(f.meterSize=e.visualObj.getMeterFraction().num/e.visualObj.getMeterFraction().den),f.pickupLength=e.visualObj.getPickupLength();else{if(!e.sequence)return Promise.reject(new Error("Must pass in either a visualObj or a sequence"));f.flattened=e.sequence}f.millisecondsPerMeasure=e.millisecondsPerMeasure?e.millisecondsPerMeasure:e.visualObj?e.visualObj.millisecondsPerMeasure(f.flattened.tempo):1e3,f.beatsPerMeasure=e.visualObj?e.visualObj.getBeatsPerMeasure():4,f.sequenceCallback=i.sequenceCallback,f.callbackContext=i.callbackContext,f.onEnded=i.onEnded,f.meterFraction=e.visualObj?e.visualObj.getMeterFraction():{den:1};var c={},p=[],m=[],g=s[0];f.flattened.tracks.forEach((function(e){e.forEach((function(e){if("program"===e.cmd&&s[e.instrument]&&(g=s[e.instrument]),void 0!==e.pitch){var t=e.pitch,n=a[t],r=void 0!==e.instrument?s[e.instrument]:g;if(n)if(c[r]||(c[r]={}),l[r]&&l[r][n]){var i=r+":"+n;p.indexOf(i)<0&&p.push(i)}else c[r][n]=!0;else{var o=r+":"+n;console.log("Can't find note: ",t,o),m.indexOf(o)<0&&m.push(o)}}}))})),f.debugCallback&&f.debugCallback("note gathering time = "+Math.floor(1e3*(r().currentTime-t))+"ms"),t=r().currentTime;var v=[];Object.keys(c).forEach((function(e){Object.keys(c[e]).forEach((function(t){v.push({instrument:e,note:t})}))})),f.debugCallback&&f.debugCallback("notes "+JSON.stringify(v));for(var y=[],b=0;b<v.length;b+=256)y.push(v.slice(b,b+256));return new Promise((function(e,n){var i={cached:p,error:m,loaded:[]},a=0,s=function(){f.debugCallback&&f.debugCallback("loadBatch idx="+a+" len="+y.length),a<y.length?f._loadBatch(y[a],f.soundFontUrl,t).then((function(e){f.debugCallback&&f.debugCallback("loadBatch then"),t=r().currentTime,e&&(e.error&&(i.error=i.error.concat(e.error)),e.loaded&&(i.loaded=i.loaded.concat(e.loaded))),a++,s()}),n):(f.debugCallback&&f.debugCallback("resolve init"),e(i))};s()}))},f._loadBatch=function(t,n,i,a){var s=[];return t.forEach((function(t){f.debugCallback&&f.debugCallback("getNote "+t.instrument+":"+t.note),s.push(e(n,t.instrument,t.note,r()))})),Promise.all(s).then((function(e){f.debugCallback&&f.debugCallback("mp3 load time = "+Math.floor(1e3*(r().currentTime-i))+"ms");for(var s=[],o=[],c=[],l=[],u=0;u<e.length;u++){var h=e[u],d=h.instrument+":"+h.name;"loaded"===h.status?s.push(d):"pending"===h.status?c.push(d):"cached"===h.status?o.push(d):l.push(d+" "+h.message)}if(c.length>0){if(f.debugCallback&&f.debugCallback("pending "+JSON.stringify(c)),a?a*=2:a=50,a<9e4)return new Promise((function(e,t){setTimeout((function(){var r=[];for(u=0;u<c.length;u++)d=c[u].split(":"),r.push({instrument:d[0],note:d[1]});f.debugCallback&&f.debugCallback("retry "+JSON.stringify(r)),f._loadBatch(r,n,i,a).then((function(t){e(t)})).catch((function(e){t(e)}))}),a)}));for(var p=[],m=0;m<t.length;m++)p.push(t[m].instrument+"/"+t[m].note);return f.debugCallback&&f.debugCallback("loadBatch timeout"),Promise.reject(new Error("timeout attempting to load: "+p.join(", ")))}return f.debugCallback&&f.debugCallback("loadBatch resolve"),Promise.resolve({loaded:s,cached:o,error:l})})).catch((function(e){f.debugCallback&&f.debugCallback("loadBatch catch "+e.message)}))},f.prime=function(){var e=f.fadeLength/1e3;return f.isRunning=!1,f.audioBufferPossible?(f.debugCallback&&f.debugCallback("prime called"),new Promise((function(n){var i=r().currentTime,a=f.millisecondsPerMeasure/1e3/f.meterSize;if(f.duration=f.flattened.totalDuration*a,f.duration<=0)return f.audioBuffers=[],n({status:"empty",seconds:0});f.duration+=e;var s=Math.floor(r().sampleRate*f.duration);f.stop();var o=t(f.flattened);f.options.swing&&function(e,t,n,r){if(!(4!=n.den&&8!=n.den||(t=parseFloat(t),isNaN(t)||t<=50))){t>75&&(t=75),t=t/50-1;var i=.25;8===n.den&&(i/=2);for(var a=i/2,s=a*t,o=0;o<e.length;o++)for(var c=e[o],l=0;l<c.length;l++){var u=c[l];if((u.start-r)%a==0&&(u.start-r)%i!=0&&(0==l||c[l-1].start<=c[l].start-a)&&(l==c.length-1||c[l+1].start>=c[l].start+a)){var h=u.start;u.start+=s,u.volume*=1,l>0&&c[l-1].end==h&&(c[l-1].end=u.start,c[l-1].volume*=1)}}}}(o,f.options.swing,f.meterFraction,f.pickupLength),f.sequenceCallback&&f.sequenceCallback(o,f.callbackContext);var l=function(e,t){if(null==t)return null;var n=[];if(t.length){for(var r=0;r<e;r++)if(r<t.length){var i=parseFloat(t[r]);i<-1?i=-1:i>1&&(i=1),n.push(i)}else n.push(0);return n}var a=parseFloat(t);if(a*(e-1)>2)return null;for(var s=e%2==0,o=s?0-a/2:0,c=o+a,l=0;l<e;l++)(s=l%2==0)?(n.push(o),o-=a):(n.push(c),c+=a);return n}(o.length,f.pan),u={};o.forEach((function(e,t){var n=l&&l.length>t?l[t]:0;e.forEach((function(e){var t=e.instrument+":"+e.pitch+":"+e.volume+":"+Math.round(1e3*(e.end-e.start))/1e3+":"+n+":"+a+":"+(e.cents?e.cents:0);f.debugCallback&&f.debugCallback("noteMapTrack "+t),u[t]||(u[t]=[]),u[t].push(e.start)}))}));for(var h=[],d=r().createBuffer(2,s,r().sampleRate),p=0;p<Object.keys(u).length;p++){var m=Object.keys(u)[p],g=m.split(":"),v=void 0!==g[6]?parseFloat(g[6]):0;g={instrument:g[0],pitch:parseInt(g[1],10),volume:parseInt(g[2],10),len:parseFloat(g[3]),pan:parseFloat(g[4]),tempoMultiplier:parseFloat(g[5]),cents:v},h.push(c(d,r().sampleRate,g,u[m],f.soundFontVolumeMultiplier,f.programOffsets[g.instrument],e,f.noteEnd/1e3,f.debugCallback))}function y(e){var t=e&&e.audioBuffers&&e.audioBuffers.length>0?e.audioBuffers[0].duration:0;return{status:r().state,duration:t}}f.audioBuffers=[d],f.debugCallback&&(f.debugCallback("sampleRate = "+r().sampleRate),f.debugCallback("totalSamples = "+s),f.debugCallback("creationTime = "+Math.floor(1e3*(r().currentTime-i))+"ms")),Promise.all(h).then((function(){"suspended"===r().state?r().resume().then((function(){n(y(f))})):"interrupted"===r().state?r().suspend().then((function(){r().resume().then((function(){n(y(f))}))})):n(y(f))}))}))):Promise.reject(new Error(u))},f.start=function(){if(!f.audioBufferPossible)throw new Error(u);f.debugCallback&&f.debugCallback("start called");var e=f.pausedTimeSec?f.pausedTimeSec:0;f._kickOffSound(e),f.startTimeSec=r().currentTime-e,f.pausedTimeSec=void 0,f.debugCallback&&f.debugCallback("MIDI STARTED",f.startTimeSec)},f.pause=function(){if(!f.audioBufferPossible)throw new Error(u);return f.debugCallback&&f.debugCallback("pause called"),f.pausedTimeSec=f.stop(),f.pausedTimeSec},f.resume=function(){f.start()},f.seek=function(e,t){var n;switch(t){case"seconds":n=e;break;case"beats":n=e*f.millisecondsPerMeasure/f.beatsPerMeasure/1e3;break;default:n=(f.duration-f.fadeLength/1e3)*e}if(!f.audioBufferPossible)throw new Error(u);f.debugCallback&&f.debugCallback("seek called sec="+n),f.isRunning?(f.stop(),f._kickOffSound(n)):f.pausedTimeSec=n,f.pausedTimeSec=n},f.stop=function(){return f.isRunning=!1,f.pausedTimeSec=void 0,f.directSource.forEach((function(e){try{e.stop()}catch(t){console.log("direct source didn't stop:",t)}})),f.directSource=[],r().currentTime-f.startTimeSec},f.finished=function(){f.startTimeSec=void 0,f.pausedTimeSec=void 0,f.isRunning=!1},f.download=function(){return o(f)},f.getAudioBuffer=function(){return f.audioBuffers[0]},f.getIsRunning=function(){return f.isRunning},f._deviceCapable=function(){return!!i()||(console.warn(u),f.debugCallback&&f.debugCallback(u),!1)},f._kickOffSound=function(e){f.isRunning=!0,f.directSource=[],f.audioBuffers.forEach((function(e,t){f.directSource[t]=r().createBufferSource(),f.directSource[t].buffer=e,f.directSource[t].connect(r().destination)})),f.directSource.forEach((function(t){t.start(0,e)})),f.onEnded&&(f.directSource[0].onended=function(){f.onEnded(f.callbackContext)})}}}function ly(){return Og?Dg:(Og=1,Dg=function(){var e=this;e.tracks=[],e.totalDuration=0,e.currentInstrument=[],e.starts=[],e.addTrack=function(){return e.tracks.push([]),e.currentInstrument.push(0),e.starts.push(0),e.tracks.length-1},e.setInstrument=function(t,n){e.tracks[t].push({channel:0,cmd:"program",instrument:n}),e.currentInstrument[t]=n},e.appendNote=function(t,n,r,i,a){var s={cmd:"note",duration:r,gap:0,instrument:e.currentInstrument[t],pitch:n,start:e.starts[t],volume:i};a&&(s.cents=a),e.tracks[t].push(s),e.starts[t]+=r,e.totalDuration=Math.max(e.totalDuration,e.starts[t])}})}function uy(){if(Wg)return Gg;Wg=1;var e=ay(),t=ry(),n=iy(),r=Bg?Lg:(Bg=1,Lg='\n<svg version="1.0" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 700" preserveAspectRatio="xMidYMid meet">\n\t<g transform="translate(0,700) scale(0.1,-0.1)" >\n\t<path d="M3111 6981 c-20 -37 -90 -55 -364 -96 -120 -18 -190 -33 -244 -55\n\t-42 -17 -124 -42 -182 -56 -78 -18 -119 -34 -157 -60 -28 -19 -86 -46 -128\n\t-60 -43 -13 -107 -42 -144 -64 -37 -23 -84 -46 -106 -52 -21 -7 -56 -29 -79\n\t-50 -22 -22 -61 -50 -86 -63 -26 -13 -67 -40 -91 -60 -24 -20 -65 -47 -90 -60\n\t-25 -13 -53 -31 -61 -41 -8 -9 -32 -30 -54 -46 -75 -54 -486 -460 -512 -507\n\t-15 -25 -48 -69 -75 -98 -26 -28 -48 -57 -48 -63 0 -6 -18 -29 -39 -53 -21\n\t-23 -56 -71 -77 -107 -20 -36 -50 -80 -65 -97 -16 -18 -33 -52 -40 -75 -12\n\t-47 -47 -115 -84 -166 -13 -18 -30 -56 -38 -83 -8 -27 -34 -80 -56 -118 -33\n\t-53 -46 -91 -62 -167 -12 -63 -34 -127 -59 -179 -42 -84 -60 -166 -60 -270 0\n\t-90 26 -122 125 -154 54 -17 96 -19 430 -20 305 -1 381 2 430 14 82 22 140 51\n\t153 78 6 12 22 47 37 77 14 30 38 77 54 103 15 27 34 73 40 103 7 30 28 78 48\n\t107 19 28 44 74 55 101 10 28 34 67 53 87 18 20 49 61 68 90 19 30 44 63 57\n\t74 13 11 36 40 52 65 59 94 232 270 306 313 20 11 57 37 82 58 25 20 70 52\n\t100 72 30 19 66 47 79 61 13 14 49 35 80 46 30 12 80 37 111 56 31 19 95 45\n\t143 58 48 12 110 37 139 55 63 40 127 55 323 76 83 9 208 28 279 41 156 29\n\t165 29 330 4 453 -71 514 -84 606 -130 31 -16 83 -36 116 -45 32 -9 84 -34\n\t115 -56 31 -21 82 -48 113 -60 32 -11 72 -33 89 -48 18 -16 59 -45 92 -65 33\n\t-21 74 -51 90 -66 17 -15 49 -40 73 -54 52 -32 65 -61 50 -113 -8 -31 -61 -90\n\t-277 -308 -300 -303 -361 -382 -369 -481 -2 -29 0 -66 6 -81 13 -40 88 -138\n\t115 -151 12 -6 54 -26 92 -44 l70 -33 945 -2 c520 -1 975 2 1012 7 64 8 191\n\t50 231 76 11 7 33 34 50 60 22 34 42 51 65 58 l32 9 0 1101 0 1102 -32 9 c-21\n\t7 -44 26 -64 55 -60 84 -77 97 -140 110 -44 9 -76 10 -127 2 -59 -9 -77 -17\n\t-134 -62 -37 -28 -172 -155 -301 -281 -129 -127 -249 -237 -267 -245 -25 -10\n\t-41 -11 -71 -2 -58 15 -112 45 -124 69 -6 11 -35 35 -64 54 -28 18 -58 41 -66\n\t50 -8 9 -41 35 -75 58 -33 22 -77 56 -99 75 -21 18 -64 46 -95 61 -31 14 -73\n\t39 -93 55 -20 15 -70 40 -110 55 -40 15 -97 44 -127 64 -29 21 -78 44 -107 53\n\t-30 8 -77 31 -105 51 -42 28 -73 39 -173 60 -68 14 -154 39 -196 58 -95 43\n\t-131 51 -343 76 -209 24 -242 32 -279 70 l-30 29 -328 0 c-312 0 -330 -1 -339\n\t-19z"></path>\n\t<path d="M254 2875 c-89 -16 -107 -26 -145 -78 -32 -44 -62 -66 -91 -67 -17 0\n\t-18 -61 -18 -1140 l0 -1140 24 0 c16 0 41 -17 72 -50 40 -42 61 -55 117 -72\n\tl69 -21 82 23 c44 12 96 30 114 39 18 9 148 132 290 272 141 141 267 261 279\n\t268 51 26 86 14 176 -61 32 -26 62 -48 66 -48 5 0 36 -25 70 -55 34 -30 74\n\t-61 89 -69 15 -8 37 -28 50 -45 12 -17 50 -45 84 -62 34 -17 78 -44 98 -60 19\n\t-16 61 -37 93 -48 32 -11 81 -37 107 -56 27 -20 76 -45 109 -56 33 -12 75 -31\n\t93 -44 62 -45 93 -58 191 -82 54 -12 130 -37 168 -54 68 -29 180 -58 226 -59\n\t62 0 183 -64 183 -96 0 -12 88 -14 639 -14 l639 0 12 30 c18 44 76 66 233 89\n\t89 14 160 30 200 47 34 15 106 42 159 60 54 18 112 44 130 57 47 35 85 52 146\n\t67 29 7 76 28 105 48 29 20 77 48 107 63 30 15 66 39 80 54 14 15 50 40 81 56\n\t31 15 78 46 104 69 26 22 61 46 79 54 17 7 43 26 56 42 14 16 41 41 60 56 64\n\t48 380 362 408 405 15 23 40 51 55 63 15 12 36 38 46 58 11 21 37 57 58 82 22\n\t25 49 62 62 83 13 20 38 56 57 78 19 23 50 74 69 113 19 39 46 86 59 104 14\n\t18 34 62 46 98 12 36 32 77 45 92 31 38 60 97 80 167 9 33 26 76 37 95 29 50\n\t47 103 68 206 10 52 32 117 51 155 29 56 33 74 34 140 0 94 -10 108 -101 138\n\t-61 20 -83 21 -463 21 -226 0 -421 -4 -451 -10 -63 -12 -86 -30 -110 -85 -10\n\t-22 -33 -63 -52 -92 -21 -31 -42 -80 -53 -123 -11 -44 -32 -93 -56 -128 -20\n\t-32 -47 -83 -59 -115 -12 -32 -37 -77 -56 -100 -19 -23 -50 -65 -69 -94 -19\n\t-29 -44 -57 -54 -63 -11 -5 -29 -27 -42 -47 -52 -85 -234 -277 -300 -315 -25\n\t-15 -53 -38 -62 -51 -9 -14 -42 -39 -74 -57 -32 -18 -75 -48 -95 -66 -21 -18\n\t-59 -44 -85 -58 -26 -13 -72 -40 -100 -59 -35 -24 -78 -41 -128 -52 -47 -11\n\t-99 -31 -139 -56 -69 -42 -94 -49 -391 -110 -245 -51 -425 -66 -595 -50 -168\n\t16 -230 27 -330 61 -47 16 -123 35 -170 44 -98 17 -123 25 -172 58 -20 14 -71\n\t37 -114 53 -44 15 -95 40 -115 56 -20 16 -70 42 -110 59 -40 16 -88 45 -108\n\t63 -20 19 -55 46 -78 61 -24 14 -49 35 -55 47 -7 11 -34 33 -60 49 -50 31 -65\n\t61 -53 102 4 13 130 147 281 298 236 238 277 283 299 335 15 32 35 71 46 86\n\t12 18 19 44 19 76 0 42 -8 63 -53 138 -92 151 11 139 -1207 141 -798 2 -1030\n\t0 -1086 -11z"></path>\n\t</g>\n</svg>\n'),i=Vg?Rg:(Vg=1,Rg='\n<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25" class="abcjs-play-svg">\n <g>\n <polygon points="4 0 23 12.5 4 25"/>\n </g>\n</svg>\n'),a=zg?Fg:(zg=1,Fg='\n<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25" class="abcjs-pause-svg">\n <g>\n <rect width="8.23" height="25"/>\n <rect width="8.23" height="25" x="17"/>\n </g>\n</svg>\n'),s=qg?jg:(qg=1,jg='\n<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" class="abcjs-loading-svg">\n <circle cx="50" cy="50" fill="none" stroke-width="20" r="35" stroke-dasharray="160 55"></circle>\n</svg>\n'),o=Ug?Hg:(Ug=1,Hg='\n<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25">\n <g>\n <polygon points="5 12.5 24 0 24 25"/>\n <rect width="3" height="25" x="0" y="0"/>\n </g>\n</svg>\n');function c(r,i,a,s,o){var c=!0;if(n()?c="suspended"===n().state:t(),!e())throw{status:"NotSupported",message:"This browser does not support audio."};(c||o)&&a&&a.classList.add("abcjs-loading"),c?n().resume().then((function(){s?s().then((function(e){l(r,i,a,o)})):l(r,i,a,o)})):l(r,i,a,o)}function l(e,t,n,r){r?e(t).then((function(){n&&n.classList.remove("abcjs-loading")})):(e(t),n&&n.classList.remove("abcjs-loading"))}return Gg=function(e,l){var u,h,d,f,p,m,g,v=this;if("string"==typeof e){var y=e;if(!(e=document.querySelector(y)))throw new Error('Cannot find element "'+y+'" in the DOM.')}else if(!(e instanceof HTMLElement))throw new Error("The first parameter must be a valid element or selector in the DOM.");if(v.parent=e,v.options={},l&&(v.options=Object.assign({},l)),v.options.ac&&t(v.options.ac),function(e,t){var n=!!t.loopHandler,c=!!t.restartHandler,l=!!t.playHandler||!!t.playPromiseHandler,u=!!t.progressHandler,h=!!t.warpHandler,d=!1!==t.hasClock,f='<div class="abcjs-inline-audio">\n';if(n){var p=t.repeatTitle?t.repeatTitle:"Click to toggle play once/repeat.";f+='<button type="button" class="abcjs-midi-loop abcjs-btn" title="'+p+'" aria-label="'+(t.repeatAria?t.repeatAria:p)+'">'+r+"</button>\n"}if(c){var m=t.restartTitle?t.restartTitle:"Click to go to beginning.";f+='<button type="button" class="abcjs-midi-reset abcjs-btn" title="'+m+'" aria-label="'+(t.restartAria?t.restartAria:m)+'">'+o+"</button>\n"}if(l){var g=t.playTitle?t.playTitle:"Click to play/pause.";f+='<button type="button" class="abcjs-midi-start abcjs-btn" title="'+g+'" aria-label="'+(t.playAria?t.playAria:g)+'">'+i+a+s+"</button>\n"}if(u){var v=t.randomTitle?t.randomTitle:"Click to change the playback position.";f+='<button type="button" class="abcjs-midi-progress-background" title="'+v+'" aria-label="'+(t.randomAria?t.randomAria:v)+'"><span class="abcjs-midi-progress-indicator"></span></button>\n'}if(d&&(f+='<span class="abcjs-midi-clock"></span>\n'),h){var y=t.warpTitle?t.warpTitle:"Change the playback speed.";f+='<span class="abcjs-tempo-wrapper"><label><input class="abcjs-midi-tempo" type="number" min="1" max="300" value="100" title="'+y+'" aria-label="'+(t.warpAria?t.warpAria:y)+'">%</label><span>&nbsp;(<span class="abcjs-midi-current-tempo"></span> '+(t.bpm?t.bpm:"BPM")+")</span></span>\n"}f+='<div class="abcjs-css-warning" style="font-size: 12px;color:red;border: 1px solid red;text-align: center;width: 300px;margin-top: 4px;font-weight: bold;border-radius: 4px;">CSS required: load abcjs-audio.css</div>',f+="</div>\n",e.innerHTML=f}(v.parent,v.options),h=!!(u=v).options.loopHandler,d=!!u.options.restartHandler,f=!!u.options.playHandler||!!u.options.playPromiseHandler,p=!!u.options.progressHandler,m=!!u.options.warpHandler,g=u.parent.querySelector(".abcjs-midi-start"),h&&u.parent.querySelector(".abcjs-midi-loop").addEventListener("click",(function(e){c(u.options.loopHandler,e,g,u.options.afterResume)})),d&&u.parent.querySelector(".abcjs-midi-reset").addEventListener("click",(function(e){c(u.options.restartHandler,e,g,u.options.afterResume)})),f&&g.addEventListener("click",(function(e){c(u.options.playPromiseHandler||u.options.playHandler,e,g,u.options.afterResume,!!u.options.playPromiseHandler)})),p&&u.parent.querySelector(".abcjs-midi-progress-background").addEventListener("click",(function(e){c(u.options.progressHandler,e,g,u.options.afterResume)})),m&&u.parent.querySelector(".abcjs-midi-tempo").addEventListener("change",(function(e){c(u.options.warpHandler,e,g,u.options.afterResume)})),v.disable=function(e){var t=v.parent.querySelector(".abcjs-inline-audio");e?t.classList.add("abcjs-disabled"):t.classList.remove("abcjs-disabled")},v.setWarp=function(e,t){v.parent.querySelector(".abcjs-midi-tempo").value=Math.round(t),v.setTempo(e)},v.setTempo=function(e){var t=v.parent.querySelector(".abcjs-midi-current-tempo");t&&(t.innerHTML=Math.round(e))},v.resetAll=function(){for(var e=v.parent.querySelectorAll(".abcjs-pushed"),t=0;t<e.length;t++)e[t].classList.remove("abcjs-pushed")},v.pushPlay=function(e){var t=v.parent.querySelector(".abcjs-midi-start");t&&(e?t.classList.add("abcjs-pushed"):t.classList.remove("abcjs-pushed"))},v.pushLoop=function(e){var t=v.parent.querySelector(".abcjs-midi-loop");t&&(e?t.classList.add("abcjs-pushed"):t.classList.remove("abcjs-pushed"))},v.setProgress=function(e,t){var n=v.parent.querySelector(".abcjs-midi-progress-background"),r=v.parent.querySelector(".abcjs-midi-progress-indicator");if(n&&r){var i=n.clientWidth*e;r.style.left=i+"px";var a=v.parent.querySelector(".abcjs-midi-clock");if(a){var s=t*e/1e3,o=Math.floor(s/60),c=Math.floor(s%60),l=c<10?"0"+c:c;a.innerHTML=o+":"+l}}},v.options.afterResume){var b=!1;v.options.ac?b="suspended"!==v.options.ac.state:n()&&(b="suspended"!==n().state),b&&v.options.afterResume()}}}function hy(){if(Qg)return Kg;Qg=1;var e=uy(),t=cy(),n=ed(),r=iy();return Kg=function(){var i=this;i.warp=100,i.cursorControl=null,i.visualObj=null,i.timer=null,i.midiBuffer=null,i.options=null,i.currentTempo=null,i.control=null,i.isLooping=!1,i.isStarted=!1,i.isLoaded=!1,i.isLoading=!1,i.load=function(t,n,r){r||(r={}),void 0===r.displayPlay&&(r.displayPlay=!0),void 0===r.displayProgress&&(r.displayProgress=!0),i.control=new e(t,{loopHandler:r.displayLoop?i.toggleLoop:void 0,restartHandler:r.displayRestart?i.restart:void 0,playPromiseHandler:r.displayPlay?i.play:void 0,progressHandler:r.displayProgress?i.randomAccess:void 0,warpHandler:r.displayWarp?i.onWarp:void 0,afterResume:i.init}),i.cursorControl=n,i.disable(!0)},i.disable=function(e){i.control&&i.control.disable(e)},i.setTune=function(e,t,n){return i.visualObj=e,i.disable(!1),i.options=n||{},i.control&&(i.pause(),i.setProgress(0,1),i.control.resetAll(),i.restart(),i.isStarted=!1),i.isLooping=!1,t?i.go():Promise.resolve({status:"no-audio-context"})},i.go=function(){i.isLoading=!0;var e,a=100*i.visualObj.millisecondsPerMeasure()/i.warp;return i.currentTempo=Math.round(i.visualObj.getBeatsPerMeasure()/a*6e4),i.control&&i.control.setTempo(i.currentTempo),i.percent=0,i.midiBuffer||(i.midiBuffer=new t),r().resume().then((function(e){return i.midiBuffer.init({visualObj:i.visualObj,options:i.options,millisecondsPerMeasure:a})})).then((function(t){return e=t,i.midiBuffer.prime()})).then((function(){var t=16;return i.cursorControl&&void 0!==i.cursorControl.beatSubdivisions&&parseInt(i.cursorControl.beatSubdivisions,10)>=1&&parseInt(i.cursorControl.beatSubdivisions,10)<=64&&(t=parseInt(i.cursorControl.beatSubdivisions,10)),i.timer=new n(i.visualObj,{beatCallback:i.beatCallback,eventCallback:i.eventCallback,lineEndCallback:i.lineEndCallback,qpm:i.currentTempo,extraMeasuresAtBeginning:i.cursorControl?i.cursorControl.extraMeasuresAtBeginning:void 0,lineEndAnticipation:i.cursorControl?i.cursorControl.lineEndAnticipation:0,beatSubdivisions:t}),i.cursorControl&&i.cursorControl.onReady&&"function"==typeof i.cursorControl.onReady&&i.cursorControl.onReady(i),i.isLoaded=!0,i.isLoading=!1,Promise.resolve({status:"created",notesStatus:e})}))},i.destroy=function(){i.timer&&(i.timer.reset(),i.timer.stop(),i.timer=null),i.midiBuffer&&(i.midiBuffer.stop(),i.midiBuffer=null),i.setProgress(0,1),i.control&&i.control.resetAll()},i.play=function(){return i.runWhenReady(i._play,void 0)},i.runWhenReady=function(e,t){return i.visualObj?i.isLoading?new Promise((function(e){setTimeout(e,500)})).then((function(){return i.isLoading?i.runWhenReady(e,t):e(t)})):i.isLoaded?e(t):i.go().then((function(){return e(t)})):Promise.resolve({status:"loading"})},i._play=function(){return r().resume().then((function(){return i.isStarted=!i.isStarted,i.isStarted?(i.cursorControl&&i.cursorControl.onStart&&"function"==typeof i.cursorControl.onStart&&i.cursorControl.onStart(),i.midiBuffer.start(),i.timer.start(i.percent),i.control&&i.control.pushPlay(!0)):i.pause(),Promise.resolve({status:"ok"})}))},i.pause=function(){i.timer&&(i.timer.pause(),i.midiBuffer.pause(),i.control&&i.control.pushPlay(!1))},i.toggleLoop=function(){i.isLooping=!i.isLooping,i.control&&i.control.pushLoop(i.isLooping)},i.restart=function(){i.timer&&(i.timer.setProgress(0),i.midiBuffer.seek(0))},i.randomAccess=function(e){return i.runWhenReady(i._randomAccess,e)},i._randomAccess=function(e){var t=e.target.classList.contains("abcjs-midi-progress-indicator")?e.target.parentNode:e.target,n=(e.x-t.getBoundingClientRect().left)/t.offsetWidth;return n<0&&(n=0),n>1&&(n=1),i.seek(n),Promise.resolve({status:"ok"})},i.seek=function(e,t){i.timer&&i.midiBuffer&&(i.timer.setProgress(e,t),i.midiBuffer.seek(e,t))},i.setWarp=function(e){if(parseInt(e,10)>0){i.warp=parseInt(e,10);var t=i.isStarted,n=i.percent;return i.destroy(),i.isStarted=!1,i.go().then((function(){return i.setProgress(n,1e3*i.midiBuffer.duration),i.control&&i.control.setWarp(i.currentTempo,i.warp),t?i.play().then((function(){return i.seek(n),Promise.resolve()})):(i.seek(n),Promise.resolve())}))}return Promise.resolve()},i.onWarp=function(e){var t=e.target.value;return i.setWarp(t)},i.setProgress=function(e,t){i.percent=e,i.control&&i.control.setProgress(e,t)},i.finished=function(){if(i.timer.reset(),i.isLooping)return i.timer.start(0),i.midiBuffer.finished(),i.midiBuffer.start(),"continue";i.timer.stop(),i.isStarted&&(i.control&&i.control.pushPlay(!1),i.isStarted=!1,i.midiBuffer.finished(),i.cursorControl&&i.cursorControl.onFinished&&"function"==typeof i.cursorControl.onFinished&&i.cursorControl.onFinished(),i.setProgress(0,1))},i.beatCallback=function(e,t,n,r){var a=e/t;i.setProgress(a,n),i.cursorControl&&i.cursorControl.onBeat&&"function"==typeof i.cursorControl.onBeat&&i.cursorControl.onBeat(e,t,n,r)},i.eventCallback=function(e){if(!e)return i.finished();i.cursorControl&&i.cursorControl.onEvent&&"function"==typeof i.cursorControl.onEvent&&i.cursorControl.onEvent(e)},i.lineEndCallback=function(e,t){i.cursorControl&&i.cursorControl.onLineEnd&&"function"==typeof i.cursorControl.onLineEnd&&i.cursorControl.onLineEnd(e,t)},i.getUrl=function(){return i.midiBuffer.download()},i.download=function(e){var t=i.getUrl(),n=document.createElement("a");document.body.appendChild(n),n.setAttribute("style","display: none;"),n.href=t,n.download=e||"output.wav",n.click(),window.URL.revokeObjectURL(t),document.body.removeChild(n)}}}function dy(){if(Zg)return Xg;Zg=1;var e,t=oy();return function(){function n(e,t){for(var n in t)t.hasOwnProperty(n)&&e.setAttribute(n,t[n]);return e}function r(){this.trackstrings="",this.trackcount=0,this.noteOnAndChannel="%90",this.noteOffAndChannel="%80"}function i(e,t){for(var n="",r=0;r<e.length;r++)n+=a(e.charCodeAt(r),2);return"%00%FF"+t+a(n.length/3,2)+n}function a(e,t){var n=e.toString(16);for(n=n.split(".")[0];n.length<t;)n="0"+n;return n.length>t&&(n=n.substring(0,t)),function(e){for(var t="",n=0;n<e.length;n+=2)t+="%",t+=e.substr(n,2);return t}(n)}function s(e){var t=(e=Math.round(e))%128;return a(2*(e-t)+t,4)}function o(e){var t=0,n=[];for(e=Math.round(e);0!==e;)n.push(127&e),e>>=7;for(var r=n.length-1;r>=0;r--){t<<=8;var i=n[r];0!==r&&(i|=128),t|=i}var s=t.toString(16).length;return a(t,s+=s%2)}r.prototype.setTempo=function(e){0===this.trackcount&&(this.startTrack(),this.track+="%00%FF%51%03"+a(Math.round(6e7/e),6),this.endTrack())},r.prototype.setGlobalInfo=function(e,t,n,r){if(0===this.trackcount){this.startTrack();var s=Math.round(6e7/e);this.track+="%00%FF%51%03"+a(s,6),n&&(this.track+=function(e){if(!e||!e.accidentals)return"";for(var t=0,n=256,r=0;r<e.accidentals.length;r++)"sharp"===e.accidentals[r].acc?t++:"flat"===e.accidentals[r].acc&&n--;return"%00%FF%59%02"+a(256!==n?n:t,2)+("m"===e.mode?"%01":"%00")}(n)),r&&(this.track+=function(e){var t,n="%00%FF%58%04"+a(e.num,2),r={1:0,2:1,4:2,8:3,16:4,32:5}[e.den];if(!r)return"";switch(n+=a(r,2),e.num+"/"+e.den){case"2/4":case"3/4":case"4/4":case"5/4":t=24;break;case"6/4":t=72;break;case"2/2":case"3/2":case"4/2":t=48;break;case"3/8":case"6/8":case"9/8":case"12/8":t=36}return t?(n+=a(t,2))+"%08":""}(r)),t&&(this.track+=i(t,"%01")),this.endTrack()}},r.prototype.startTrack=function(){this.noteWarped={},this.track="",this.trackName="",this.trackInstrument="",this.silencelength=0,this.trackcount++,this.instrument&&this.setInstrument(this.instrument)},r.prototype.endTrack=function(){this.track=this.trackName+this.trackInstrument+this.track;var e=a(this.track.length/3+4,8);this.track="MTrk"+e+this.track+"%00%FF%2F%00",this.trackstrings+=this.track},r.prototype.setText=function(e,t){"name"===e&&(this.trackName=i(t,"%03"))},r.prototype.setInstrument=function(e){this.trackInstrument="%00%C0"+a(e,2),this.instrument=e},r.prototype.setChannel=function(e,t){this.channel=e;var n="%00%B"+this.channel.toString(16);this.track+=n+"%79%00",this.track+=n+"%40%00",this.track+=n+"%5B%30",t||(t=0),t=Math.round(64*(t+1)),this.track+=n+"%0A"+a(t,2),this.track+=n+"%07%64",this.noteOnAndChannel="%9"+this.channel.toString(16),this.noteOffAndChannel="%8"+this.channel.toString(16)},r.prototype.startNote=function(e,n,r){if(this.track+=o(this.silencelength),this.silencelength=0,r){this.track+="%e"+this.channel.toString(16);var i=Math.round(4096*t(r));this.track+=s(8192+i),this.track+=o(0),this.noteWarped[e]=!0}this.track+=this.noteOnAndChannel,this.track+="%"+e.toString(16)+a(n,2)},r.prototype.endNote=function(e){this.track+=o(this.silencelength),this.silencelength=0,this.noteWarped[e]&&(this.track+="%e"+this.channel.toString(16),this.track+=s(8192),this.track+=o(0),this.noteWarped[e]=!1),this.track+=this.noteOffAndChannel,this.track+="%"+e.toString(16)+"%00"},r.prototype.addRest=function(e){this.silencelength+=e,this.silencelength<0&&(this.silencelength=0)},r.prototype.getData=function(){return"data:audio/midi,MThd%00%00%00%06%00%01"+a(this.trackcount,4)+"%01%e0"+this.trackstrings},r.prototype.embed=function(e,t){var r=this.getData(),i=n(document.createElement("a"),{href:r});if(i.innerHTML="download midi",e.insertBefore(i,e.firstChild),!t){var a=n(document.createElement("embed"),{src:r,type:"video/quicktime",controller:"true",autoplay:"false",loop:"false",enablejavascript:"true",style:"display:block; height: 20px;"});e.insertBefore(a,e.firstChild)}},e=function(){return new r}}(),Xg=e}function fy(){if(iv)return rv;iv=1;try{if("function"!=typeof window.CustomEvent){var e=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n};e.prototype=window.Event.prototype,window.CustomEvent=e}}catch(n){}var t=function(e){this.textarea="string"==typeof e?document.getElementById(e):e,this.initialText=this.textarea.value,this.isDragging=!1};return t.prototype.addSelectionListener=function(e){this.textarea.onmousemove=function(t){this.isDragging&&e.fireSelectionChanged()}},t.prototype.addChangeListener=function(e){this.changelistener=e,this.textarea.onkeyup=function(){e.fireChanged()},this.textarea.onmousedown=function(){this.isDragging=!0,e.fireSelectionChanged()},this.textarea.onmouseup=function(){this.isDragging=!1,e.fireChanged()},this.textarea.onchange=function(){e.fireChanged()}},t.prototype.getSelection=function(){return{start:this.textarea.selectionStart,end:this.textarea.selectionEnd}},t.prototype.setSelection=function(e,t){if(this.textarea.setSelectionRange)this.textarea.setSelectionRange(e,t);else if(this.textarea.createTextRange){var n=this.textarea.createTextRange();n.collapse(!0),n.moveEnd("character",t),n.moveStart("character",e),n.select()}this.textarea.focus()},t.prototype.getString=function(){return this.textarea.value},t.prototype.setString=function(e){this.textarea.value=e,this.initialText=this.getString(),this.changelistener&&this.changelistener.fireChanged()},t.prototype.getElem=function(){return this.textarea},rv=t}const py=/* @__PURE__ */Mi(function(){if(cv)return ov;cv=1;var e=Ih?Ph:(Ih=1,Ph="6.4.4"),t=td(),n=Ev(),r=dv(),i=function(){if(gf)return mf;gf=1;var e,t=sd(),{relativeMajor:n,transposeKey:r,relativeMode:i}=ad(),a=id();return function(){function s(e,t,n){var r=[],i=t.getKeySignature();if("Hp"===i.root||"HP"===i.root)return r;r=r.concat(function(e,t){for(var n=[],r=e.split("K:"),i=r[0].length,a=1;a<r.length;a++){var s=r[a],o=s.match(/^( *)([A-G])([#b]?)(\w*)/);if(o){var c=i+2+o[1].length,l=o[2]+o[3]+o[4],u=f({root:o[2],acc:o[3],mode:o[4]},t),h=u.root+u.acc+u.mode;n.push({start:c,end:c+l.length,note:h})}i+=s.length+2}return n}(e,n));for(var a=0;a<t.lines.length;a++){var s=t.lines[a].staff;if(s)for(var c=0;c<s.length;c++){var l=s[c];"perc"!==l.clef.type&&(r=r.concat(o(e,l.voices,l.key,n)))}}return r}function o(e,t,n,r){for(var i=[],a=f(n,r),s=0;s<t.length;s++)i=i.concat(u(e,t[s],n.root,c(n),a,r));return i}function c(e){for(var t={},n=0;n<e.accidentals.length;n++){var r=e.accidentals[n];"flat"===r.acc?t[r.note.toUpperCase()]="_":"sharp"===r.acc&&(t[r.note.toUpperCase()]="^")}return t}function l(e,t,n){var r=h.indexOf(e.root)-h.indexOf(t);return"none"===t&&(r=h.indexOf(e.root)),0===r?n>2?r+=7:-12===n&&(r-=7):n>0&&r<0?r+=7:n<0&&r>0&&(r-=7),n>12?r+=7:n<-12&&(r-=7),r}function u(e,t,n,r,i,s){for(var o=[],u=l(i,n,s),h={},d={},m=0;m<t.length;m++){var g=t[m];if(g.chord)for(var v=0;v<g.chord.length;v++){var y=g.chord[v];if("default"===y.position){var k=i.accidentals.length&&"flat"===i.accidentals[0].acc,S=a(y.name,s,k,!0);(S=S.replace(/♭/g,"b").replace(/♯/g,"#"))!==y.name&&o.push(x(e,g.startChar,g.endChar,S))}}if("note"===g.el_type&&g.pitches){for(var C=0;C<g.pitches.length;C++){var M=b(g.pitches[C].name,n,r,h);M.acc&&(h[M.name.toUpperCase()]=M.acc);var E=p(M,i,u,d);E.acc&&(d[E.upper]=E.acc),o.push(_(e,g.startChar,g.endChar,E.acc+E.name,C))}if(g.gracenotes)for(var T=0;T<g.gracenotes.length;T++){var A=b(g.gracenotes[T].name,n,r,h);A.acc&&(h[A.name.toUpperCase()]=A.acc);var P=p(A,i,u,h);P.acc&&(d[P.upper]=P.acc),o.push(w(e,g.startChar,g.endChar,P.acc+P.name,T))}}else"bar"===g.el_type?(h={},d={}):"keySignature"===g.el_type&&(n=g.root,r=c(g),u=l(i=f(g,s),n,s))}return o}e=function(e,o,c){if("TEST"===o)return{keyAccidentals:t,relativeMajor:n,transposeKey:r,relativeMode:i,transposeChordName:a};c=parseInt(c,10);var l,u=[];for(l=0;l<o.length;l++)u=u.concat(s(e,o[l],c));u=u.sort((function(e,t){return t.start-e.start}));var h=e.split("");for(l=0;l<u.length;l++){var d=u[l];h.splice(d.start,d.end-d.start,d.note)}return h.join("")};var h="CDEFGAB",d=[",,,,",",,,",",,",",","","'","''","'''","''''"];function f(e,a){if("none"===e.root)return{root:r("C",a),mode:"",acc:"",accidentals:[]};var s=n(e.root+e.acc+e.mode),o=r(s,a),c=i(o,e.mode),l=t(o);return{root:c[0],mode:e.mode,acc:c.length>1?c[1]:"",accidentals:l}}function p(e,t,n,r){for(var i=e.pitch,a=h.indexOf(e.name),s=(h.indexOf(t.root)+i)%7,o=a+n,c=e.oct;o>6;)c++,o-=7;for(;o<0;)c--,o+=7;for(var l=h[s],u="",d=e.adj,f="=",m=0;m<t.accidentals.length;m++)if(t.accidentals[m].note.toLowerCase()===l.toLowerCase()){d+="flat"===t.accidentals[m].acc?-1:1,f="flat"===t.accidentals[m].acc?"_":"^";break}switch(d){case-2:u="__";break;case-1:u="_";break;case 0:u="=";break;case 1:u="^";break;case 2:u="^^";break;case-3:return(g={}).pitch=e.pitch-1,g.oct=e.oct,g.name=h[h.indexOf(e.name)-1],g.name||(g.name="B",g.oct--),"B"===g.name||"E"===g.name?g.adj=e.adj+1:g.adj=e.adj+2,p(g,t,n+1,r);case 3:var g;return(g={}).pitch=e.pitch+1,g.oct=e.oct,g.name=h[h.indexOf(e.name)+1],g.name||(g.name="C",g.oct++),"C"===g.name||"F"===g.name?g.adj=e.adj-1:g.adj=e.adj-2,p(g,t,n+1,r)}switch(r[l]!==u&&(r[l]||u!==f)||e.courtesy||(u=""),c){case 0:l+=",,,";break;case 1:l+=",,";break;case 2:l+=",";break;case 4:l=l.toLowerCase();break;case 5:l=l.toLowerCase()+"'";break;case 6:l=l.toLowerCase()+"''";break;case 7:l=l.toLowerCase()+"'''";break;case 8:l=l.toLowerCase()+"''''"}return c>4&&(l=l.toLowerCase()),{acc:u,name:l,upper:l.toUpperCase()}}var m=/([_^=]*)([A-Ga-g])([,']*)/,g=/([_^=]*[A-Ga-g][,']*)(\d*\/*\d*)([\>\<\-\)\.\s\\]*)/,v=/([_^=]*[A-Ga-g][,']*)?(\d*\/*\d*)?([\>\<\-\)]*)?/,y=/(\s*)$/;function b(e,t,n,r){var i="none"===t?0:h.indexOf(t),a=e.match(m),s=a[2].toUpperCase(),o=h.indexOf(s)-i;o<0&&(o+=7);var c=d.indexOf(a[3]);s===a[2]&&c--;var l=r[s]||n[s]||"=";return{acc:a[1],name:s,pitch:o,oct:c,adj:k(a[1],n[s],r[s]),courtesy:a[1]===l}}function _(e,t,n,r,i){var a=e.substring(t,n),s=a.match(new RegExp(g.source+y.source),"");if(s){var o=s[1].length,c=s[2].length+s[3].length+s[4].length;t+=n-t-o-c,n-=c}else if(s=a.match(new RegExp(/([^\[]*)/.source+/\[/.source+v.source+v.source+v.source+v.source+v.source+v.source+v.source+v.source+/\-?](\d*\/*\d*)?([\>\<\-\)]*)/.source+y.source))){for(var l=1+s[1].length,u=0;u<i;u++)s[3*u+2]&&(l+=s[3*u+2].length),s[3*u+3]&&(l+=s[3*u+3].length),s[3*u+4]&&(l+=s[3*u+4].length);n=(t+=l)+(s[3*i+2]?s[3*i+2].length:0)}return{start:t,end:n,note:r}}function w(e,t,n,r,i){var a=/(\/*)/,s=e.substring(t,n).match(new RegExp(/([^\{]*)/.source+/\{/.source+a.source+v.source+a.source+v.source+a.source+v.source+a.source+v.source+a.source+v.source+a.source+v.source+a.source+v.source+a.source+v.source+/\}/.source));if(s){for(var o=1+s[1].length,c=0;c<i;c++)s[3*c+2]&&(o+=s[3*c+2].length),s[3*c+3]&&(o+=s[3*c+3].length),s[3*c+4]&&(o+=s[3*c+4].length),s[3*c+5]&&(o+=s[3*c+5].length);s[3*i+2]&&(o+=s[3*c+2].length),t+=o;var l=s[3*i+3]?s[3*i+3].length:0;l+=s[3*i+4]?s[3*i+4].length:0,n=t+(l+=s[3*i+5]?s[3*i+5].length:0)}return{start:t,end:n,note:r}}function x(e,t,n,r){var i=e.substring(t,n).match(/([^"]+)?(".+")+/);return i[1]&&(t+=i[1].length),{start:t+1,end:(n=t+i[2].length)-1,note:r}}function k(e,t,n){if(!e&&n&&(e=n),!e)return 0;switch(t){case void 0:switch(e){case"__":return-2;case"_":return-1;case"=":default:return 0;case"^":return 1;case"^^":return 2}case"_":switch(e){case"__":return-1;case"_":default:return 0;case"=":return 1;case"^":return 2;case"^^":return 3}case"^":switch(e){case"__":return-3;case"_":return-2;case"=":return-1;case"^":default:return 0;case"^^":return 1}}return 0}}(),mf=e}(),a={};a.signature="abcjs-basic v"+e,Object.keys(t).forEach((function(e){a[e]=t[e]})),Object.keys(n).forEach((function(e){a[e]=n[e]})),a.renderAbc=ey(),a.tuneMetrics=function(){if(cg)return og;cg=1;var e=Ev(),t=Jv();return og=function(n,r){return e.renderEngine((function(e,n,i,a){(e=document.createElement("div")).setAttribute("style","visibility: hidden;"),document.body.appendChild(e);var s=new t(e,r).getMeasureWidths(n);return e.parentNode.removeChild(e),{sections:s}}),"*",n,r)}}(),a.TimingCallbacks=ed();var s=Tv();a.setGlyph=s.setSymbol,a.strTranspose=i;var o=cy(),c=ny(),l=sy(),u=ly(),h=uy(),d=ry(),f=iy(),p=ay(),m=function(){if($g)return Yg;$g=1;var e=ly(),t=cy(),n=iy();function r(e,n,r,i){var a=new t;return a.init({sequence:e,millisecondsPerMeasure:n,options:{soundFontUrl:r},debugCallback:i}).then((function(){return a.prime()})).then((function(){return a.start(),Promise.resolve()}))}return Yg=function(t,i,a,s,o){for(var c=new e,l=0;l<t.length;l++){var u=t[l],h=c.addTrack();if(c.setInstrument(h,u.instrument),0===l&&i)for(var d=0;d<i.length;d++){var f=i[d];c.appendNote(h,f.pitch,1/64,f.volume,f.cents)}c.appendNote(h,u.pitch,u.duration,u.volume,u.cents)}var p=n();return"suspended"===p.state?p.resume().then((function(){return r(c,a,s,o)})):r(c,a,s,o)}}(),g=hy(),v=function(){if(nv)return tv;nv=1;var e=Ev(),t=function(){if(ev)return Jg;ev=1;var e,t=dy();return function(){function n(e,t,n){for(var r=Object.keys(t),i=0;i<r.length;i++)r[i]=parseFloat(r[i]);r.sort((function(e,t){return e-t}));for(var a=0,s=0;s<r.length;s++){var o=t[r[s]];if(r[s]>a){var c=(r[s]-a)*n;e.addRest(c),a=r[s]}for(var l=0;l<o.length;l++){var u=o[l];u.volume?e.startNote(u.pitch,u.volume,u.cents):e.endNote(u.pitch)}}}e=function(e,r){void 0===r&&(r={});var i=e.setUpAudio(r),a=t(),s=e.metaText?e.metaText.title:void 0;s&&s.length>128&&(s=s.substring(0,124)+"...");var o=e.getKeySignature(),c=e.getMeterFraction(),l=i.tempo,u=l/60;8==c.den&&(u=(l=6e4/(e.millisecondsPerMeasure()/c.num)/2)/60),a.setGlobalInfo(l,s,o,c);for(var h=0;h<i.tracks.length;h++){a.startTrack();for(var d={},f=0;f<i.tracks[h].length;f++){var p=i.tracks[h][f];switch(p.cmd){case"text":a.setText(p.type,p.text);break;case"program":var m=0;r.pan&&r.pan.length>h&&(m=r.pan[h]),128===p.instrument?(a.setChannel(9,m),a.setInstrument(0)):(a.setChannel(p.channel,m),a.setInstrument(p.instrument));break;case"note":var g=p.gap*u,v=p.start,y=v+p.duration-g;d[v]||(d[v]=[]),d[v].push({pitch:p.pitch,volume:p.volume,cents:p.cents}),d[y]||(d[y]=[]),d[y].push({pitch:p.pitch,volume:0});break;default:console.log("MIDI create Unknown: "+p.cmd)}}n(a,d,1920),a.endTrack()}return a.getData()}}(),Jg=e}();return tv=function(n,r){var i={};if(r)for(var a in r)r.hasOwnProperty(a)&&(i[a]=r[a]);function s(e,n,r){var a=t(n,i);switch(i.midiOutputType){case"encoded":return a;case"binary":var s=a.replace("data:audio/midi,","");s=(s=s.replace(/MThd/g,"%4d%54%68%64")).replace(/MTrk/g,"%4d%54%72%6b");for(var o=new ArrayBuffer(s.length/3),c=new Uint8Array(o),l=0;l<s.length/3;l++){var u=3*l+1,h=parseInt(s.substring(u,u+2),16);c[l]=h}return c;default:return function(e,t,n,r){var i=["abcjs-download-midi","abcjs-midi-"+r];t.downloadClass&&i.push(t.downloadClass);var a='<div class="'+i.join(" ")+'">';t.preTextDownload&&(a+=t.preTextDownload);var s,o,c=e.metaText&&e.metaText.title?e.metaText.title:"Untitled";return s=t.downloadLabel&&(o=t.downloadLabel)&&"[object Function]"==={}.toString.call(o)?t.downloadLabel(e,r):t.downloadLabel?t.downloadLabel.replace(/%T/,c):'Download MIDI for "'+c+'"',c=c.toLowerCase().replace(/'/g,"").replace(/\W/g,"_").replace(/__/g,"_"),a+='<a download="'+(t.fileName?t.fileName:c+".midi")+'" href="'+n+'">'+s+"</a>",t.postTextDownload&&(a+=t.postTextDownload),a+"</div>"}(n,i,a,r)}}return i.generateInline=!1,"string"==typeof n?e.renderEngine(s,"*",n,i):s(0,n,0)}}(),y=dy();return a.synth={CreateSynth:o,instrumentIndexToName:c,pitchToNoteName:l,SynthController:g,SynthSequence:u,CreateSynthControl:h,registerAudioContext:d,activeAudioContext:f,supportsAudio:p,playEvent:m,getMidiFile:v,sequence:r,midiRenderer:y},a.Editor=function(){if(sv)return av;sv=1;var e=nd(),t=hy(),n=ay(),r=ey(),i=fy(),a=function(t,r){this.abcjsParams=function(e){var t,n={};if(e.abcjsParams)for(t in e.abcjsParams)e.abcjsParams.hasOwnProperty(t)&&(n[t]=e.abcjsParams[t]);if(e.midi_options)for(t in e.midi_options)e.midi_options.hasOwnProperty(t)&&(n[t]=e.midi_options[t]);if(e.parser_options)for(t in e.parser_options)e.parser_options.hasOwnProperty(t)&&(n[t]=e.parser_options[t]);if(e.render_options)for(t in e.render_options)e.render_options.hasOwnProperty(t)&&(n[t]=e.render_options[t]);return n.tablature&&e.warnings_id&&(n.tablature.warnings_id=e.warnings_id),n}(r),r.indicate_changed&&(this.indicate_changed=!0),this.editarea="string"==typeof t?new i(t):t,this.editarea.addSelectionListener(this),this.editarea.addChangeListener(this),r.canvas_id?this.div=r.canvas_id:r.paper_id?this.div=r.paper_id:(this.div=document.createElement("DIV"),this.editarea.getElem().parentNode.insertBefore(this.div,this.editarea.getElem())),"string"==typeof this.div&&(this.div=document.getElementById(this.div)),r.selectionChangeCallback&&(this.selectionChangeCallback=r.selectionChangeCallback),this.clientClickListener=this.abcjsParams.clickListener,this.abcjsParams.clickListener=this.highlight.bind(this),r.synth&&n()&&(this.synth={el:r.synth.el,cursorControl:r.synth.cursorControl,options:r.synth.options}),r.generate_midi&&(this.generate_midi=r.generate_midi,this.abcjsParams.generateDownload&&("string"==typeof r.midi_download_id?this.downloadMidi=document.getElementById(r.midi_download_id):r.midi_download_id&&(this.downloadMidi=r.midi_download_id)),!1!==this.abcjsParams.generateInline&&("string"==typeof r.midi_id?this.inlineMidi=document.getElementById(r.midi_id):r.midi_id&&(this.inlineMidi=r.midi_id))),r.warnings_id?"string"==typeof r.warnings_id?this.warningsdiv=document.getElementById(r.warnings_id):this.warningsdiv=r.warnings_id:r.generate_warnings&&(this.warningsdiv=document.createElement("div"),this.div.parentNode.insertBefore(this.warningsdiv,this.div)),this.onchangeCallback=r.onchange,this.currentAbc="",this.tunes=[],this.bReentry=!1,this.parseABC(),this.modelChanged(),this.addClassName=function(e,t){var n,r;return n=t,(r=e.className).length>0&&(r===n||new RegExp("(^|\\s)"+n+"(\\s|$)").test(r))||(e.className+=(e.className?" ":"")+t),e},this.removeClassName=function(t,n){return t.className=e.strip(t.className.replace(new RegExp("(^|\\s+)"+n+"(\\s+|$)")," ")),t},this.setReadOnly=function(e){var t="abc_textarea_readonly",n=this.editarea.getElem();e?(n.setAttribute("readonly","yes"),this.addClassName(n,t)):(n.removeAttribute("readonly"),this.removeClassName(n,t))}};return a.prototype.redrawMidi=function(){if(this.generate_midi&&!this.midiPause){var e=new window.CustomEvent("generateMidi",{detail:{tunes:this.tunes,abcjsParams:this.abcjsParams,downloadMidiEl:this.downloadMidi,inlineMidiEl:this.inlineMidi,engravingEl:this.div}});window.dispatchEvent(e)}if(this.synth){var n=this.synth.synthControl;this.synth.synthControl||(this.synth.synthControl=new t,this.synth.synthControl.load(this.synth.el,this.synth.cursorControl,this.synth.options)),this.synth.synthControl.setTune(this.tunes[0],n,this.synth.options)}},a.prototype.modelChanged=function(){if(!this.bReentry){this.bReentry=!0;try{this.timerId=null,this.synth&&this.synth.synthControl&&this.synth.synthControl.disable(!0),this.tunes=r(this.div,this.currentAbc,this.abcjsParams),this.tunes.length>0&&(this.warnings=this.tunes[0].warnings),this.redrawMidi()}catch(e){console.error("ABCJS error: ",e),this.warnings||(this.warnings=[]),this.warnings.push(e.message)}this.warningsdiv&&(this.warningsdiv.innerHTML=this.warnings?this.warnings.join("<br />"):"No errors"),this.updateSelection(),this.bReentry=!1}},a.prototype.paramChanged=function(e){if(e)for(var t in e)e.hasOwnProperty(t)&&(this.abcjsParams[t]=e[t]);this.currentAbc="",this.fireChanged()},a.prototype.synthParamChanged=function(e){if(this.synth){if(this.synth.options={},e)for(var t in e)e.hasOwnProperty(t)&&(this.synth.options[t]=e[t]);this.currentAbc="",this.fireChanged()}},a.prototype.parseABC=function(){var e=this.editarea.getString();return e===this.currentAbc?(this.updateSelection(),!1):(this.currentAbc=e,!0)},a.prototype.updateSelection=function(){var e=this.editarea.getSelection();try{this.tunes.length>0&&this.tunes[0].engraver&&this.tunes[0].engraver.rangeHighlight(e.start,e.end)}catch(t){}this.selectionChangeCallback&&this.selectionChangeCallback(e.start,e.end)},a.prototype.fireSelectionChanged=function(){this.updateSelection()},a.prototype.setDirtyStyle=function(t){if(void 0!==this.indicate_changed){var n,r,i,a,s="abc_textarea_dirty",o=this.editarea.getElem();t?(i=r=s,(a=(n=o).className).length>0&&(a===i||new RegExp("(^|\\s)"+i+"(\\s|$)").test(a))||(n.className+=(n.className?" ":"")+r)):(l=s,(c=o).className=e.strip(c.className.replace(new RegExp("(^|\\s+)"+l+"(\\s+|$)")," ")))}var c,l},a.prototype.fireChanged=function(){if(!this.bIsPaused&&this.parseABC()){var e=this;this.timerId&&clearTimeout(this.timerId),this.timerId=setTimeout((function(){e.modelChanged()}),300);var t=this.isDirty();this.wasDirty!==t&&(this.wasDirty=t,this.setDirtyStyle(t)),this.onchangeCallback&&this.onchangeCallback(this)}},a.prototype.setNotDirty=function(){this.editarea.initialText=this.editarea.getString(),this.wasDirty=!1,this.setDirtyStyle(!1)},a.prototype.isDirty=function(){return void 0!==this.indicate_changed&&this.editarea.initialText!==this.editarea.getString()},a.prototype.highlight=function(e,t,n,r,i,a){this.editarea.setSelection(e.startChar,e.endChar),this.selectionChangeCallback&&this.selectionChangeCallback(e.startChar,e.endChar),this.clientClickListener&&this.clientClickListener(e,t,n,r,i,a)},a.prototype.pause=function(e){this.bIsPaused=e,e||this.fireChanged()},a.prototype.millisecondsPerMeasure=function(){return this.synth&&this.synth.synthControl&&this.synth.synthControl.visualObj?this.synth.synthControl.visualObj.millisecondsPerMeasure():0},a.prototype.pauseMidi=function(e){this.midiPause=e,e||this.redrawMidi()},av=a}(),a.EditArea=fy(),ov=a}()),my=n({name:"MusicScoreRenderer",props:{abcString:{type:String,required:!0}},mounted(){py.renderAbc("abc",this.abcString)}}),gy={id:"abc"},vy=n({name:"IdentifyKeyView",components:{RadioMultipleChoice:O,MusicScoreRenderer:/* @__PURE__ */Vi(my,[["render",function(e,t,n,r,i,a){return p(),f("div",gy)}]])},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"IdentifyKeyView"),r=B(n),i=a("");r.question.value=new xy(e.data);const s=o((()=>r.question.value)),c=o((()=>{const e=function(){const e=[];for(let t=0;t<5;t++)e.push(_y[Math.floor(Math.random()*_y.length)]);return e}();return e.includes(s.value?.key||"")||(e[Math.floor(Math.random()*e.length)]=s.value?.key||""),e}));return{...n,...r,answer:i,question:s,choices:c,submit:()=>{}}}}),yy={"data-viewable":"IdentifyKeyView"},by=/* @__PURE__ */Vi(vy,[["render",function(e,t,n,r,i,a){const s=w("MusicScoreRenderer"),o=w("RadioMultipleChoice");return p(),f("div",yy,[e.question?(p(),f(b,{key:0},[x(s,{"key-signature":`X:1\nK:${e.question.key}\n||`,"abc-string":"''"},null,8,["key-signature"]),t[0]||(t[0]=k(" This signature is for the major key: _____ ")),x(o,{"choice-list":e.choices},null,8,["choice-list"])],64)):g("",!0)])}]]),_y=["C","G","D","A","E","B","F#","C#","F","Bb","Eb","Ab","Db","Gb","Cb"],wy=class _IdentifyKeyQuestion extends R{constructor(e){super(e),t(this,"key"),this.key=_IdentifyKeyQuestion.getKey(e[0].key)}static getKey(e){return _y[e]}isCorrect(e){return console.log(`answer: ${JSON.stringify(e)}, key: ${this.key}`),this.key===e.choiceList[e.selection]}dataShapes(){return _IdentifyKeyQuestion.dataShapes}views(){return _IdentifyKeyQuestion.views}};t(wy,"dataShapes",[{name:X.SIGHTSING_IdentifyKey,fields:[{name:"key",type:Q.NUMBER,validator:{test:e=>{const t=parseInt(e);return t>=0&&t<=_y.length?{msg:"",status:Z.ok}:{msg:"Please enter a number between 0 and 11",status:Z.error}}}}]}]),t(wy,"views",[by]);let xy=wy;const ky=new CourseWare("sightSing",[xy]),Sy=n({name:"LetterQuestionView",props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"LetterQuestionView"),r=B(n),i=a(null);r.question.value=new Ty(e.data);const s=o((()=>r.question.value)),u=e=>{if(!s.value)return;const t=e.key.toLowerCase(),n=s.value.letter.toLowerCase();if(t===n){i.value?.classList.add("pressed");const e=a=>{a.key.toLowerCase()===n&&(i.value?.classList.remove("pressed"),r.submitAnswer(t),window.removeEventListener("keyup",e))};window.addEventListener("keyup",e)}else r.submitAnswer(t)};return c((()=>{window.addEventListener("keypress",u)})),l((()=>{window.removeEventListener("keypress",u)})),{...r,...n,letterDisplay:i,question:s}}}),Cy={"data-viewable":"LetterQuestionView"},My=/* @__PURE__ */Vi(Sy,[["render",function(e,t,n,r,i,a){return p(),f("div",Cy,[e.question?(p(),f(b,{key:0},[t[0]||(t[0]=m("p",{class:"text-h5"},"Type this letter!",-1)),m("div",{ref:"letterDisplay",class:"letter-display"},y(e.question.letter),513)],64)):g("",!0)])}],["__scopeId","data-v-4ae4db54"]]),Ey=class _TypeLetterQuestion extends R{constructor(e){super(e),t(this,"letter"),this.letter=e[0].letter}evaluate(e,t){return{isCorrect:this.isCorrect(e),performance:this.displayedSkill(e,t)}}displayedSkill(e,t){if(this.isCorrect(e)){if(t<3e3)return 1;{const e=1-(t-3e3)/7e3*.75;return Math.max(.25,e)}}return 0}dataShapes(){return _TypeLetterQuestion.dataShapes}views(){return _TypeLetterQuestion.views}isCorrect(e){const t=e.toLowerCase()===this.letter.toLowerCase();return console.log(`singleLetter Q isCorrect: ${t}`),t}};t(Ey,"dataShapes",[{name:X.TYPING_singleLetter,fields:[{name:"letter",type:Q.STRING,validator:{instructions:"Enter a single letter",test:function(e){return e&&1===e.length&&/[a-zA-Z]/.test(e)?{status:Z.ok,msg:""}:{status:Z.error,msg:"Input must be a single letter"}}}}]}]),t(Ey,"views",[My]),t(Ey,"acceptsUserData",!0),t(Ey,"seedData",function(){const e=[];for(let t=0;t<26;t++)e.push({letter:String.fromCharCode(65+t)});return e}());let Ty=Ey;const Ay=class _FallingLettersQuestion extends R{constructor(e){super(e),t(this,"gameLength"),t(this,"initialSpeed"),t(this,"acceleration"),t(this,"spawnInterval"),this.gameLength=e[0].gameLength,this.initialSpeed=e[0].initialSpeed,this.acceleration=e[0].acceleration,this.spawnInterval=e[0].spawnInterval}evaluate(e){return{isCorrect:this.isCorrect(e),performance:this.displayedSkill(e)}}displayedSkill(e){return e.win?1:e.percentage}dataShapes(){return _FallingLettersQuestion.dataShapes}views(){return _FallingLettersQuestion.views}isCorrect(e){return e.win}};t(Ay,"dataShapes",[{name:X.TYPING_fallingLetters,fields:[{name:"gameLength",type:Q.NUMBER},{name:"initialSpeed",type:Q.NUMBER},{name:"acceleration",type:Q.NUMBER},{name:"spawnInterval",type:Q.NUMBER,validator:{instructions:"How often should a new letter spawn? (in seconds)",test:e=>"string"==typeof e?parseFloat(e)>0?{status:Z.ok,msg:""}:{status:Z.error,msg:"Must be greater than 0"}:{status:Z.error,msg:"Unexpected non-string input."},placeholder:"1"}}]}]),t(Ay,"views",[]),t(Ay,"acceptsUserData",!0),t(Ay,"seedData",[{gameLength:30,initialSpeed:2,acceleration:.1,spawnInterval:1}]);let Py=Ay;const Iy=n({name:"FallingLettersView",emits:["emitResponse"],props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"FallingLettersView"),r=B(n),i=a(null),s=a([]),o=a(!1),u=a(""),h=a(30),d=a(0),f=a([]),p=a([]),m=a({currentSpeed:2,letterId:0,gameLoop:null,lastSpawn:0,lastUpdate:0,spawnInterval:1e3}),g=e=>{if(o.value)return;const t=(e-m.value.lastUpdate)/1e3;if(m.value.lastUpdate=e,h.value-=t,r.question.value&&(m.value.currentSpeed+=r.question.value.acceleration*t),h.value<=0)return o.value=!0,u.value="You Win!",void r.submitAnswer({lettersTyped:d.value,win:!0,percentage:1});e-m.value.lastSpawn>=m.value.spawnInterval&&((()=>{if(!i.value)return;const e={id:m.value.letterId++,char:String.fromCharCode(65+Math.floor(26*Math.random())),x:Math.random()*(i.value.clientWidth-30),y:-30};s.value.push(e)})(),m.value.lastSpawn=e,m.value.spawnInterval=Math.max(500,m.value.spawnInterval-10)),i.value&&(s.value=s.value.filter((e=>(e.y+=m.value.currentSpeed,!(e.y>i.value.clientHeight&&(o.value=!0,u.value="Game Over!",r.submitAnswer({lettersTyped:d.value,percentage:h.value/(r.question.value?.gameLength||30),win:!1}),1)))))),m.value.gameLoop=requestAnimationFrame(g)},v=e=>{if(o.value)return;const t=e.key.toUpperCase(),n=s.value.findIndex((e=>e.char===t));-1!==n&&(p.value.push({id:Date.now(),x:s.value[n].x,y:s.value[n].y}),setTimeout((()=>{p.value=p.value.filter((e=>e.id!==p.value[p.value.length-1].id))}),300),s.value.splice(n,1),d.value++)};return c((()=>{try{r.question.value=new Py(e.data),r.maxAttemptsPerView.value=1,window.addEventListener("keypress",v),f.value=Array.from({length:7},((e,t)=>({id:t,left:20+t*Math.random()*30-10,height:100+120*Math.random(),scale:1+2*Math.random()}))),r.question.value?(h.value=r.question.value.gameLength,d.value=0,s.value=[],o.value=!1,u.value="",m.value={currentSpeed:r.question.value.initialSpeed,letterId:0,gameLoop:null,lastSpawn:performance.now(),lastUpdate:performance.now(),spawnInterval:1e3*r.question.value.spawnInterval},m.value.gameLoop=requestAnimationFrame(g)):n.logger.error("Question not initialized")}catch(t){n.logger.error("Error initializing game:",t)}})),l((()=>{window.removeEventListener("keypress",v),m.value.gameLoop&&cancelAnimationFrame(m.value.gameLoop)})),{...r,gameArea:i,letters:s,gameOver:o,gameOverMessage:u,timeLeft:h,score:d,treePositions:f,explosions:p}}}),Ny={class:"game-container"},Dy={class:"stats"},Oy={class:"time"},Ly={class:"score"},By={ref:"gameArea",class:"game-area"},Ry={class:"letter-text"},Vy={class:"trees"},Fy={key:0,class:"game-over"},zy=/* @__PURE__ */Vi(Iy,[["render",function(e,t,n,r,i,a){return p(),f("div",Ny,[m("div",Dy,[m("div",Oy,"Time: "+y(e.timeLeft.toFixed(1))+"s",1),m("div",Ly,"Score: "+y(e.score),1)]),m("div",By,[(p(!0),f(b,null,_(e.letters,(e=>(p(),f("div",{key:e.id,class:"falling-letter",style:A({left:e.x+"px",top:e.y+"px"})},[t[0]||(t[0]=m("div",{class:"meteor-effect"},null,-1)),m("span",Ry,y(e.char),1)],4)))),128)),(p(!0),f(b,null,_(e.explosions,(e=>(p(),f("div",{key:e.id,class:"explosion",style:A({left:e.x+"px",top:e.y+"px"})},[(p(),f(b,null,_(12,(e=>m("div",{key:e,class:"particle"}))),64))],4)))),128)),t[2]||(t[2]=m("div",{class:"grass-container"},[m("div",{class:"grass"}),m("div",{class:"grass-overlay"})],-1)),m("div",Vy,[(p(!0),f(b,null,_(e.treePositions,(e=>(p(),f("div",{key:e.id,class:"tree",style:A({left:`${e.left}%`,height:`${e.height}px`,transform:`scale(${e.scale})`})},t[1]||(t[1]=[m("div",{class:"tree-crown"},null,-1),m("div",{class:"tree-trunk"},null,-1)]),4)))),128))])],512),e.gameOver?(p(),f("div",Fy,y(e.gameOverMessage),1)):g("",!0)])}],["__scopeId","data-v-41b85e8b"]]);Py.views=[zy];const jy=new CourseWare("typing",[Ty,Py]),qy=n({name:"IdentifyVocab",components:{AudioAutoPlayer:D,UserInputString:G},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const n=L(e,t,"IdentifyVocab"),r=B(n),i=a("");r.question.value=new $y(e.data);const s=o((()=>r.question.value));return{...n,...r,answer:i,question:s,submit:()=>{s.value&&r.submitAnswer(i.value)}}}}),Hy={"data-viewable":"IdentifyVocab"},Uy={key:0,class:"text-h6"},Gy=/* @__PURE__ */Vi(qy,[["render",function(e,t,n,r,i,a){const s=w("UserInputString"),o=w("center"),c=w("audio-auto-player");return p(),f("div",Hy,[e.question?(p(),f(b,{key:0},[t[1]||(t[1]=m("span",{class:"text-h5"}," Spell the word: ",-1)),x(s,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,["modelValue"]),x(o,null,{default:T((()=>[e.priorAttempts?(p(),f("span",Uy,y(e.question.word),1)):g("",!0)])),_:1}),x(o,null,{default:T((()=>[x(c,{src:[e.getURL("WordAudio"),e.getURL("SentenceAudio"),e.getURL("WordAudio")]},null,8,["src"])])),_:1})],64)):g("",!0)])}]]),Wy=[{name:"Word",type:Q.STRING,validator:J.NonEmptyString},{name:"ExampleSentence",type:Q.STRING},{name:"WordAudio",type:Q.AUDIO},{name:"SentenceAudio",type:Q.AUDIO}],Yy=class _SpellingQuestion extends R{constructor(e){super(e),t(this,"word"),t(this,"sentence"),t(this,"audio_word"),t(this,"audio_sentence"),this.word=e[0].Word,this.sentence=e[0].Sentence,this.audio_word=e[0].WordAudio,this.audio_sentence=e[0].SentenceAudio}isCorrect(e){return e===this.word}dataShapes(){return _SpellingQuestion.dataShapes}views(){return _SpellingQuestion.views}};t(Yy,"dataShapes",[{fields:Wy,name:X.WORDWORK_Spelling}]),t(Yy,"views",[Gy]);let $y=Yy;const Ky=new CourseWare("wordWork",[$y]),Qy=n({name:"PianoRangeVisualizer",props:{lowestNote:{type:Number,required:!0},highestNote:{type:Number,required:!0},maxWidth:{type:Number,default:1e3}},setup(e){const t=a(null),n=a(800),r=o((()=>{let e=0;for(let t=21;t<=108;t++)u(t)&&e++;return e})),i=o((()=>Math.min(22,n.value/Math.max(25,r.value)))),s=o((()=>.6*i.value)),l=o((()=>Math.min(e.maxWidth,i.value*r.value+10))),u=e=>[0,2,4,5,7,9,11].includes(e%12);return c((()=>{t.value&&(n.value=t.value.clientWidth,new ResizeObserver((e=>{for(const t of e)n.value=t.contentRect.width})).observe(t.value))})),{pianoWrapper:t,keyHeight:100,blackKeyHeight:60,whiteKeyWidth:i,blackKeyWidth:s,svgWidth:l,isWhiteKey:u,getKeyPosition:e=>{let t=0;for(let n=21;n<e;n++)u(n)&&t++;return u(e)?t*i.value:t*i.value-s.value/2},getNoteLabel:e=>{const t=e%12,n=Math.floor(e/12)-1;return`${["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"][t]}${n}`}}}}),Xy={class:"piano-range-container"},Zy={class:"piano-wrapper",ref:"pianoWrapper"},Jy=["width","height"],eb={class:"background-keys",opacity:"0.15"},tb=["x","width","height"],nb=["x","width","height"],rb={class:"selected-range"},ib=["x","width","height"],ab=["x","width","height"],sb={class:"range-markers"},ob=["x","height"],cb=["x","height"],lb=["x","y"],ub=["x","y"];n({name:"MidiConfig",components:{PianoRangeVisualizer:/* @__PURE__ */Vi(Qy,[["render",function(e,t,n,r,i,a){return p(),f("div",Xy,[m("div",Zy,[(p(),f("svg",{width:e.svgWidth,height:e.keyHeight+20,class:"piano-svg"},[m("g",eb,[(p(),f(b,null,_(88,(t=>(p(),f(b,{key:`bg-${t}`},[e.isWhiteKey(t+20)?(p(),f("rect",{key:0,x:e.getKeyPosition(t+20),y:"0",width:e.whiteKeyWidth,height:e.keyHeight,class:"white-key",stroke:"#999","stroke-width":"1"},null,8,tb)):g("",!0)],64)))),64)),(p(),f(b,null,_(88,(t=>(p(),f(b,{key:`bg-black-${t}`},[e.isWhiteKey(t+20)?g("",!0):(p(),f("rect",{key:0,x:e.getKeyPosition(t+20),y:"0",width:e.blackKeyWidth,height:e.blackKeyHeight,class:"black-key"},null,8,nb))],64)))),64))]),m("g",rb,[(p(),f(b,null,_(128,(t=>(p(),f(b,{key:`white-${t}`},[e.isWhiteKey(t)&&t>=e.lowestNote&&t<=e.highestNote?(p(),f("rect",{key:0,x:e.getKeyPosition(t),y:"0",width:e.whiteKeyWidth,height:e.keyHeight,class:"white-key active",stroke:"#666","stroke-width":"1"},null,8,ib)):g("",!0)],64)))),64)),(p(),f(b,null,_(128,(t=>(p(),f(b,{key:`black-${t}`},[!e.isWhiteKey(t)&&t>=e.lowestNote&&t<=e.highestNote?(p(),f("rect",{key:0,x:e.getKeyPosition(t),y:"0",width:e.blackKeyWidth,height:e.blackKeyHeight,class:"black-key active"},null,8,ab)):g("",!0)],64)))),64))]),m("g",sb,[m("rect",{x:e.getKeyPosition(e.lowestNote)-2,y:"0",width:4,height:e.keyHeight+5,class:"range-marker start"},null,8,ob),m("rect",{x:e.getKeyPosition(e.highestNote)+e.whiteKeyWidth-2,y:"0",width:4,height:e.keyHeight+5,class:"range-marker end"},null,8,cb)]),m("text",{x:e.getKeyPosition(e.lowestNote)+3,y:e.keyHeight+12,class:"note-label"},y(e.getNoteLabel(e.lowestNote)),9,lb),m("text",{x:e.getKeyPosition(e.highestNote)+e.whiteKeyWidth-3,y:e.keyHeight+12,"text-anchor":"end",class:"note-label"},y(e.getNoteLabel(e.highestNote)),9,ub)],8,Jy))],512)])}],["__scopeId","data-v-4b232a8b"]])},props:{_id:{type:String,required:!0},user:{type:Object,required:!0}},setup(e){const t=a(),n=a(!0),r=a([]),i=a([]),s=a(""),o=a(""),l=a(!1),h=a(""),d=a(""),f=a(!1),p=a("full-88"),m=a(21),g=a(108),v=a(""),y=a(0),b=a(0),_=a([]),w=a([{title:"Full 88-key Piano (A0-C8)",value:"full-88"},{title:"76-key Keyboard (E1-G7)",value:"76-key"},{title:"61-key Keyboard (C2-C7)",value:"61-key"},{title:"49-key Keyboard (C3-C7)",value:"49-key"},{title:"37-key Keyboard (C3-C6)",value:"37-key"},{title:"25-key Keyboard (C4-C6)",value:"25-key"},{title:"Custom Range",value:"custom"}]),x=()=>{f.value=s.value!==h.value||o.value!==d.value||p.value!==v.value||"custom"===p.value&&(m.value!==y.value||g.value!==b.value)},k=e=>{H({text:`I hear a ${e.note.name}!`,status:Z.ok})};return u(s,(()=>{t.value?.selectInput(s.value),x()})),u(o,(()=>{t.value?.selectOutput(o.value),x()})),c((async()=>{(()=>{const e=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],t=[];for(let n=0;n<=127;n++){const r=Math.floor(n/12)-1,i=e[n%12];t.push({title:`${i}${r} (${n})`,value:n})}_.value=t})();try{t.value=await qu.instance(),n.value="ready"===t.value.state||"nodevice"===t.value.state}catch(a){console.log(`Error on midi Init: ${a}`),n.value=!1}n.value&&(t.value?.addNoteonListenter(k),t.value?(r.value=t.value.inputs.filter((e=>"connected"===e.state)).map((e=>({title:`${e.manufacturer}: ${e.name}`,value:e.id}))),i.value=t.value?.outputs.filter((e=>"connected"===e.state)).map((e=>({title:`${e.manufacturer}: ${e.name}`,value:e.id})))):(r.value=[{title:"No inputs available",value:""}],i.value=[{title:"No outputs available",value:""}]),await(async()=>{const t=await(await e.user.getCourseInterface(e._id)).getCourseSettings();if(t?.midiinput){const e=t.midiinput.toString();r.value.some((t=>t.value===e))&&(s.value=e,h.value=e)}if(t?.midioutput){const e=t.midioutput.toString();i.value.some((t=>t.value===e))&&(o.value=e,d.value=e)}t?.keyboardRange&&(v.value=t.keyboardRange.toString(),p.value=v.value),t?.lowestNote&&(y.value=parseInt(t.lowestNote.toString()),m.value=y.value),t?.highestNote&&(b.value=parseInt(t.highestNote.toString()),g.value=b.value),t?.lowestNote&&t?.highestNote&&!t?.keyboardRange&&(p.value="custom"),f.value=!1})(),!s.value&&r.value.length>0&&(s.value=r.value[0].value),!o.value&&i.value.length>0&&(o.value=i.value[0].value))})),{midiSupported:n,inputs:r,outputs:i,selectedInput:s,selectedOutput:o,updatePending:l,playSound:()=>{t.value?.play([{note:{number:64,name:"E",octave:4},type:"noteon",velocity:.4251968503937008,timestamp:0},{note:{number:64,name:"E",octave:4},velocity:.3779527559055118,type:"noteoff",timestamp:511.90500000002794},{note:{number:60,name:"C",octave:4},type:"noteon",velocity:.5275590551181102,timestamp:535.8800000001211},{note:{number:60,name:"C",octave:4},velocity:.33858267716535434,type:"noteoff",timestamp:674.9899999999907},{note:{number:60,name:"C",octave:4},type:"noteon",velocity:.5590551181102362,timestamp:1070.8800000000047},{note:{number:60,name:"C",octave:4},velocity:.3464566929133858,type:"noteoff",timestamp:1214.8999999999069},{note:{number:64,name:"E",octave:4},type:"noteon",velocity:.5118110236220472,timestamp:1424.9400000000605},{note:{number:64,name:"E",octave:4},velocity:.2755905511811024,type:"noteoff",timestamp:1576.9150000000373},{note:{number:62,name:"D",octave:4},type:"noteon",velocity:.3937007874015748,timestamp:1756.9149999999208},{note:{number:62,name:"D",octave:4},velocity:.36220472440944884,type:"noteoff",timestamp:1926.9899999998743},{note:{number:60,name:"C",octave:4},type:"noteon",velocity:.5196850393700787,timestamp:1970.9600000000792},{note:{number:60,name:"C",octave:4},velocity:.36220472440944884,type:"noteoff",timestamp:2126.009999999893},{note:{number:60,name:"C",octave:4},type:"noteon",velocity:.5984251968503937,timestamp:2502.0050000000047},{note:{number:60,name:"C",octave:4},velocity:.3858267716535433,type:"noteoff",timestamp:2853.920000000042},{note:{number:67,name:"G",octave:4},type:"noteon",velocity:.6850393700787402,timestamp:2875.8649999999907},{note:{number:67,name:"G",octave:4},velocity:.6377952755905512,type:"noteoff",timestamp:4497.004999999888}])},saveSettings:async()=>{l.value=!0,(await se().getUserDB().getCourseInterface(e._id)).updateCourseSettings([{key:"midiinput",value:s.value},{key:"midioutput",value:o.value},{key:"keyboardRange",value:p.value},{key:"lowestNote",value:m.value},{key:"highestNote",value:g.value}]),h.value=s.value,d.value=o.value,v.value=p.value,y.value=m.value,b.value=g.value,f.value=!1,l.value=!1,H({text:"Settings updated.",status:Z.ok})},configChanged:f,lowestNote:m,highestNote:g,keyboardRangeOptions:w,selectedKeyboardRange:p,noteOptions:_,updateCustomRangeFromPreset:()=>{switch(p.value){case"full-88":m.value=21,g.value=108;break;case"76-key":m.value=28,g.value=103;break;case"61-key":m.value=36,g.value=96;break;case"49-key":m.value=48,g.value=96;break;case"37-key":m.value=48,g.value=84;break;case"25-key":m.value=60,g.value=84}x()},updateRangeAndCheckChanges:()=>{m.value>=g.value&&(g.value=m.value+12),x()}}}});const hb=new class AllCourseWare{constructor(e){t(this,"courseWareList"),t(this,"cachedRawViews",null),this.courseWareList=e}get courses(){return this.courseWareList}getCourseWare(e){return this.courseWareList.find((t=>t.name===e))}allViewsRaw(){if(!this.cachedRawViews){const e=this.allViews();this.cachedRawViews=Object.fromEntries(Object.entries(e).map((([e,t])=>[e,P(t)])))}return this.cachedRawViews}allViews(){const e={};return this.courseWareList.forEach((t=>{Object.assign(e,t.allViewsMap)})),e}getView(e){let t;t="string"==typeof e?te.getViewDescriptor(e):e;const n=this.getCourseWare(t.course);if(n){const e=n.getQuestion(t.questionType);if(e){const r=e.views.find((e=>e.name===t.view));if(r)return r;throw console.error(`QuestionView ${t.view} not found in course ${t.course}\n\n descriptor: ${JSON.stringify(t)}\n\n course: ${n.name}\n question: ${e.name}\n views: ${e.views.map((e=>e.name)).join(", ")}\n `),new Error(`view ${t.view} does not exist.`)}throw console.error(`Question ${t.questionType} not found in course ${t.course}\n\n descriptor: ${JSON.stringify(t)}\n\n course: ${n.name}\n questions: ${n.questions.map((e=>e.name)).join(", ")}\n `),new Error(`question ${t.questionType} does not exist.`)}throw console.error(`Course ${t.course} not found.\n\n descriptor: ${JSON.stringify(t)}`),new Error(`course ${t.course} does not exist.`)}toString(){let e="";return this.courses.forEach((t=>{e+=`Course: ${t.name}\n`,t.questions.forEach((t=>{e+=` Question: ${t.name}\n`,t.views.forEach((t=>{e+=` View: ${t.name}\n`}))}))})),e}allDataShapesRaw(){const e=[];return this.courseWareList.forEach((t=>{t.questions.forEach((t=>{t.dataShapes.forEach((t=>{e.includes(t)||e.push(t)}))}))})),e}allDataShapes(){const e=[];return this.courseWareList.forEach((t=>{t.questions.forEach((n=>{n.dataShapes.forEach((r=>{-1===e.findIndex((e=>e.course===t.name&&e.dataShape===r.name))&&e.push({course:t.name,dataShape:r.name,displayable:n})}))}))})),e}getDataShape(e){let t;if(this.getCourseWare(e.course).questions.forEach((n=>{n.dataShapes.forEach((n=>{n.name===e.dataShape&&(t=n)}))})),t)return t;throw new Error(`DataShape ${te.getDataShapeString(e)} not found`)}}([kl,Ky,Zo,Yi,wh,Ah,ky,zo,jy]);var db="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function fb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pb,mb={exports:{}};var gb,vb,yb=(pb||(pb=1,gb=mb,vb=mb.exports,function(){var e,t="Expected a function",n="__lodash_hash_undefined__",r="__lodash_placeholder__",i=32,a=128,s=256,o=1/0,c=9007199254740991,l=NaN,u=4294967295,h=[["ary",a],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",i],["partialRight",64],["rearg",s]],d="[object Arguments]",f="[object Array]",p="[object Boolean]",m="[object Date]",g="[object Error]",v="[object Function]",y="[object GeneratorFunction]",b="[object Map]",_="[object Number]",w="[object Object]",x="[object Promise]",k="[object RegExp]",S="[object Set]",C="[object String]",M="[object Symbol]",E="[object WeakMap]",T="[object ArrayBuffer]",A="[object DataView]",P="[object Float32Array]",I="[object Float64Array]",N="[object Int8Array]",D="[object Int16Array]",O="[object Int32Array]",L="[object Uint8Array]",B="[object Uint8ClampedArray]",R="[object Uint16Array]",V="[object Uint32Array]",F=/\b__p \+= '';/g,z=/\b(__p \+=) '' \+/g,j=/(__e\(.*?\)|\b__t\)) \+\n'';/g,q=/&(?:amp|lt|gt|quot|#39);/g,H=/[&<>"']/g,U=RegExp(q.source),G=RegExp(H.source),W=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,$=/<%=([\s\S]+?)%>/g,K=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,X=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Z=/[\\^$.*+?()[\]{}|]/g,J=RegExp(Z.source),ee=/^\s+/,te=/\s/,ne=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,re=/\{\n\/\* \[wrapped with (.+)\] \*/,ie=/,? & /,ae=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,oe=/\\(\\)?/g,ce=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,le=/\w*$/,ue=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,fe=/^0o[0-7]+$/i,pe=/^(?:0|[1-9]\d*)$/,me=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ge=/($^)/,ve=/['\n\r\u2028\u2029\\]/g,ye="\\ud800-\\udfff",be="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",_e="\\u2700-\\u27bf",we="a-z\\xdf-\\xf6\\xf8-\\xff",xe="A-Z\\xc0-\\xd6\\xd8-\\xde",ke="\\ufe0e\\ufe0f",Se="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ce="['’]",Me="["+ye+"]",Ee="["+Se+"]",Te="["+be+"]",Ae="\\d+",Pe="["+_e+"]",Ie="["+we+"]",Ne="[^"+ye+Se+Ae+_e+we+xe+"]",De="\\ud83c[\\udffb-\\udfff]",Oe="[^"+ye+"]",Le="(?:\\ud83c[\\udde6-\\uddff]){2}",Be="[\\ud800-\\udbff][\\udc00-\\udfff]",Re="["+xe+"]",Ve="\\u200d",Fe="(?:"+Ie+"|"+Ne+")",ze="(?:"+Re+"|"+Ne+")",je="(?:['’](?:d|ll|m|re|s|t|ve))?",qe="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Te+"|"+De+")?",Ue="["+ke+"]?",Ge=Ue+He+"(?:"+Ve+"(?:"+[Oe,Le,Be].join("|")+")"+Ue+He+")*",We="(?:"+[Pe,Le,Be].join("|")+")"+Ge,Ye="(?:"+[Oe+Te+"?",Te,Le,Be,Me].join("|")+")",$e=RegExp(Ce,"g"),Ke=RegExp(Te,"g"),Qe=RegExp(De+"(?="+De+")|"+Ye+Ge,"g"),Xe=RegExp([Re+"?"+Ie+"+"+je+"(?="+[Ee,Re,"$"].join("|")+")",ze+"+"+qe+"(?="+[Ee,Re+Fe,"$"].join("|")+")",Re+"?"+Fe+"+"+je,Re+"+"+qe,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ae,We].join("|"),"g"),Ze=RegExp("["+Ve+ye+be+ke+"]"),Je=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,et=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],tt=-1,nt={};nt[P]=nt[I]=nt[N]=nt[D]=nt[O]=nt[L]=nt[B]=nt[R]=nt[V]=!0,nt[d]=nt[f]=nt[T]=nt[p]=nt[A]=nt[m]=nt[g]=nt[v]=nt[b]=nt[_]=nt[w]=nt[k]=nt[S]=nt[C]=nt[E]=!1;var rt={};rt[d]=rt[f]=rt[T]=rt[A]=rt[p]=rt[m]=rt[P]=rt[I]=rt[N]=rt[D]=rt[O]=rt[b]=rt[_]=rt[w]=rt[k]=rt[S]=rt[C]=rt[M]=rt[L]=rt[B]=rt[R]=rt[V]=!0,rt[g]=rt[v]=rt[E]=!1;var it={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},at=parseFloat,st=parseInt,ot="object"==typeof db&&db&&db.Object===Object&&db,ct="object"==typeof self&&self&&self.Object===Object&&self,lt=ot||ct||Function("return this")(),ut=vb&&!vb.nodeType&&vb,ht=ut&&gb&&!gb.nodeType&&gb,dt=ht&&ht.exports===ut,ft=dt&&ot.process,pt=function(){try{var e=ht&&ht.require&&ht.require("util").types;return e||ft&&ft.binding&&ft.binding("util")}catch(tl){}}(),mt=pt&&pt.isArrayBuffer,gt=pt&&pt.isDate,vt=pt&&pt.isMap,yt=pt&&pt.isRegExp,bt=pt&&pt.isSet,_t=pt&&pt.isTypedArray;function wt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function xt(e,t,n,r){for(var i=-1,a=null==e?0:e.length;++i<a;){var s=e[i];t(r,s,n(s),e)}return r}function kt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function St(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Ct(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function Mt(e,t){for(var n=-1,r=null==e?0:e.length,i=0,a=[];++n<r;){var s=e[n];t(s,n,e)&&(a[i++]=s)}return a}function Et(e,t){return!(null==e||!e.length)&&Rt(e,t,0)>-1}function Tt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function At(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function Pt(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function It(e,t,n,r){var i=-1,a=null==e?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function Nt(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function Dt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Ot=jt("length");function Lt(e,t,n){var r;return n(e,(function(e,n,i){if(t(e,n,i))return r=n,!1})),r}function Bt(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function Rt(e,t,n){return t==t?function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):Bt(e,Ft,n)}function Vt(e,t,n,r){for(var i=n-1,a=e.length;++i<a;)if(r(e[i],t))return i;return-1}function Ft(e){return e!=e}function zt(e,t){var n=null==e?0:e.length;return n?Ut(e,t)/n:l}function jt(t){return function(n){return null==n?e:n[t]}}function qt(t){return function(n){return null==t?e:t[n]}}function Ht(e,t,n,r,i){return i(e,(function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)})),n}function Ut(t,n){for(var r,i=-1,a=t.length;++i<a;){var s=n(t[i]);s!==e&&(r=r===e?s:r+s)}return r}function Gt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Wt(e){return e?e.slice(0,ln(e)+1).replace(ee,""):e}function Yt(e){return function(t){return e(t)}}function $t(e,t){return At(t,(function(t){return e[t]}))}function Kt(e,t){return e.has(t)}function Qt(e,t){for(var n=-1,r=e.length;++n<r&&Rt(t,e[n],0)>-1;);return n}function Xt(e,t){for(var n=e.length;n--&&Rt(t,e[n],0)>-1;);return n}var Zt=qt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Jt=qt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function en(e){return"\\"+it[e]}function tn(e){return Ze.test(e)}function nn(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function rn(e,t){return function(n){return e(t(n))}}function an(e,t){for(var n=-1,i=e.length,a=0,s=[];++n<i;){var o=e[n];o!==t&&o!==r||(e[n]=r,s[a++]=n)}return s}function sn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function on(e){return tn(e)?function(e){for(var t=Qe.lastIndex=0;Qe.test(e);)++t;return t}(e):Ot(e)}function cn(e){return tn(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.split("")}(e)}function ln(e){for(var t=e.length;t--&&te.test(e.charAt(t)););return t}var un=qt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),hn=function te(ye){var be,_e=(ye=null==ye?lt:hn.defaults(lt.Object(),ye,hn.pick(lt,et))).Array,we=ye.Date,xe=ye.Error,ke=ye.Function,Se=ye.Math,Ce=ye.Object,Me=ye.RegExp,Ee=ye.String,Te=ye.TypeError,Ae=_e.prototype,Pe=ke.prototype,Ie=Ce.prototype,Ne=ye["__core-js_shared__"],De=Pe.toString,Oe=Ie.hasOwnProperty,Le=0,Be=(be=/[^.]+$/.exec(Ne&&Ne.keys&&Ne.keys.IE_PROTO||""))?"Symbol(src)_1."+be:"",Re=Ie.toString,Ve=De.call(Ce),Fe=lt._,ze=Me("^"+De.call(Oe).replace(Z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),je=dt?ye.Buffer:e,qe=ye.Symbol,He=ye.Uint8Array,Ue=je?je.allocUnsafe:e,Ge=rn(Ce.getPrototypeOf,Ce),We=Ce.create,Ye=Ie.propertyIsEnumerable,Qe=Ae.splice,Ze=qe?qe.isConcatSpreadable:e,it=qe?qe.iterator:e,ot=qe?qe.toStringTag:e,ct=function(){try{var e=la(Ce,"defineProperty");return e({},"",{}),e}catch(tl){}}(),ut=ye.clearTimeout!==lt.clearTimeout&&ye.clearTimeout,ht=we&&we.now!==lt.Date.now&&we.now,ft=ye.setTimeout!==lt.setTimeout&&ye.setTimeout,pt=Se.ceil,Ot=Se.floor,qt=Ce.getOwnPropertySymbols,dn=je?je.isBuffer:e,fn=ye.isFinite,pn=Ae.join,mn=rn(Ce.keys,Ce),gn=Se.max,vn=Se.min,yn=we.now,bn=ye.parseInt,_n=Se.random,wn=Ae.reverse,xn=la(ye,"DataView"),kn=la(ye,"Map"),Sn=la(ye,"Promise"),Cn=la(ye,"Set"),Mn=la(ye,"WeakMap"),En=la(Ce,"create"),Tn=Mn&&new Mn,An={},Pn=Va(xn),In=Va(kn),Nn=Va(Sn),Dn=Va(Cn),On=Va(Mn),Ln=qe?qe.prototype:e,Bn=Ln?Ln.valueOf:e,Rn=Ln?Ln.toString:e;function Vn(e){if(to(e)&&!Us(e)&&!(e instanceof qn)){if(e instanceof jn)return e;if(Oe.call(e,"__wrapped__"))return Fa(e)}return new jn(e)}var Fn=/* @__PURE__ */function(){function t(){}return function(n){if(!eo(n))return{};if(We)return We(n);t.prototype=n;var r=new t;return t.prototype=e,r}}();function zn(){}function jn(t,n){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!n,this.__index__=0,this.__values__=e}function qn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=u,this.__views__=[]}function Hn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Un(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Gn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Gn;++t<n;)this.add(e[t])}function Yn(e){var t=this.__data__=new Un(e);this.size=t.size}function $n(e,t){var n=Us(e),r=!n&&Hs(e),i=!n&&!r&&$s(e),a=!n&&!r&&!i&&lo(e),s=n||r||i||a,o=s?Gt(e.length,Ee):[],c=o.length;for(var l in e)!t&&!Oe.call(e,l)||s&&("length"==l||i&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||ga(l,c))||o.push(l);return o}function Kn(t){var n=t.length;return n?t[Wr(0,n-1)]:e}function Qn(e,t){return Na(Ei(e),ar(t,0,e.length))}function Xn(e){return Na(Ei(e))}function Zn(t,n,r){(r!==e&&!zs(t[n],r)||r===e&&!(n in t))&&rr(t,n,r)}function Jn(t,n,r){var i=t[n];Oe.call(t,n)&&zs(i,r)&&(r!==e||n in t)||rr(t,n,r)}function er(e,t){for(var n=e.length;n--;)if(zs(e[n][0],t))return n;return-1}function tr(e,t,n,r){return ur(e,(function(e,i,a){t(r,e,n(e),a)})),r}function nr(e,t){return e&&Ti(t,No(t),e)}function rr(e,t,n){"__proto__"==t&&ct?ct(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ir(t,n){for(var r=-1,i=n.length,a=_e(i),s=null==t;++r<i;)a[r]=s?e:Eo(t,n[r]);return a}function ar(t,n,r){return t==t&&(r!==e&&(t=t<=r?t:r),n!==e&&(t=t>=n?t:n)),t}function sr(t,n,r,i,a,s){var o,c=1&n,l=2&n,u=4&n;if(r&&(o=a?r(t,i,a,s):r(t)),o!==e)return o;if(!eo(t))return t;var h=Us(t);if(h){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Oe.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!c)return Ei(t,o)}else{var f=da(t),g=f==v||f==y;if($s(t))return wi(t,c);if(f==w||f==d||g&&!a){if(o=l||g?{}:pa(t),!c)return l?function(e,t){return Ti(e,ha(e),t)}(t,function(e,t){return e&&Ti(t,Do(t),e)}(o,t)):function(e,t){return Ti(e,ua(e),t)}(t,nr(o,t))}else{if(!rt[f])return a?t:{};o=function(e,t,n){var r,i=e.constructor;switch(t){case T:return xi(e);case p:case m:return new i(+e);case A:return function(e,t){var n=t?xi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case P:case I:case N:case D:case O:case L:case B:case R:case V:return ki(e,n);case b:return new i;case _:case C:return new i(e);case k:return function(e){var t=new e.constructor(e.source,le.exec(e));return t.lastIndex=e.lastIndex,t}(e);case S:return new i;case M:return r=e,Bn?Ce(Bn.call(r)):{}}}(t,f,c)}}s||(s=new Yn);var x=s.get(t);if(x)return x;s.set(t,o),so(t)?t.forEach((function(e){o.add(sr(e,n,r,e,t,s))})):no(t)&&t.forEach((function(e,i){o.set(i,sr(e,n,r,i,t,s))}));var E=h?e:(u?l?na:ta:l?Do:No)(t);return kt(E||t,(function(e,i){E&&(e=t[i=e]),Jn(o,i,sr(e,n,r,i,t,s))})),o}function or(t,n,r){var i=r.length;if(null==t)return!i;for(t=Ce(t);i--;){var a=r[i],s=n[a],o=t[a];if(o===e&&!(a in t)||!s(o))return!1}return!0}function cr(n,r,i){if("function"!=typeof n)throw new Te(t);return Ta((function(){n.apply(e,i)}),r)}function lr(e,t,n,r){var i=-1,a=Et,s=!0,o=e.length,c=[],l=t.length;if(!o)return c;n&&(t=At(t,Yt(n))),r?(a=Tt,s=!1):t.length>=200&&(a=Kt,s=!1,t=new Wn(t));e:for(;++i<o;){var u=e[i],h=null==n?u:n(u);if(u=r||0!==u?u:0,s&&h==h){for(var d=l;d--;)if(t[d]===h)continue e;c.push(u)}else a(t,h,r)||c.push(u)}return c}Vn.templateSettings={escape:W,evaluate:Y,interpolate:$,variable:"",imports:{_:Vn}},Vn.prototype=zn.prototype,Vn.prototype.constructor=Vn,jn.prototype=Fn(zn.prototype),jn.prototype.constructor=jn,qn.prototype=Fn(zn.prototype),qn.prototype.constructor=qn,Hn.prototype.clear=function(){this.__data__=En?En(null):{},this.size=0},Hn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Hn.prototype.get=function(t){var r=this.__data__;if(En){var i=r[t];return i===n?e:i}return Oe.call(r,t)?r[t]:e},Hn.prototype.has=function(t){var n=this.__data__;return En?n[t]!==e:Oe.call(n,t)},Hn.prototype.set=function(t,r){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=En&&r===e?n:r,this},Un.prototype.clear=function(){this.__data__=[],this.size=0},Un.prototype.delete=function(e){var t=this.__data__,n=er(t,e);return!(n<0||(n==t.length-1?t.pop():Qe.call(t,n,1),--this.size,0))},Un.prototype.get=function(t){var n=this.__data__,r=er(n,t);return r<0?e:n[r][1]},Un.prototype.has=function(e){return er(this.__data__,e)>-1},Un.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Gn.prototype.clear=function(){this.size=0,this.__data__={hash:new Hn,map:new(kn||Un),string:new Hn}},Gn.prototype.delete=function(e){var t=oa(this,e).delete(e);return this.size-=t?1:0,t},Gn.prototype.get=function(e){return oa(this,e).get(e)},Gn.prototype.has=function(e){return oa(this,e).has(e)},Gn.prototype.set=function(e,t){var n=oa(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Wn.prototype.add=Wn.prototype.push=function(e){return this.__data__.set(e,n),this},Wn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.clear=function(){this.__data__=new Un,this.size=0},Yn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Yn.prototype.get=function(e){return this.__data__.get(e)},Yn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Un){var r=n.__data__;if(!kn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Gn(r)}return n.set(e,t),this.size=n.size,this};var ur=Ii(yr),hr=Ii(br,!0);function dr(e,t){var n=!0;return ur(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function fr(t,n,r){for(var i=-1,a=t.length;++i<a;){var s=t[i],o=n(s);if(null!=o&&(c===e?o==o&&!co(o):r(o,c)))var c=o,l=s}return l}function pr(e,t){var n=[];return ur(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n}function mr(e,t,n,r,i){var a=-1,s=e.length;for(n||(n=ma),i||(i=[]);++a<s;){var o=e[a];t>0&&n(o)?t>1?mr(o,t-1,n,r,i):Pt(i,o):r||(i[i.length]=o)}return i}var gr=Ni(),vr=Ni(!0);function yr(e,t){return e&&gr(e,t,No)}function br(e,t){return e&&vr(e,t,No)}function _r(e,t){return Mt(t,(function(t){return Xs(e[t])}))}function wr(t,n){for(var r=0,i=(n=vi(n,t)).length;null!=t&&r<i;)t=t[Ra(n[r++])];return r&&r==i?t:e}function xr(e,t,n){var r=t(e);return Us(e)?r:Pt(r,n(e))}function kr(t){return null==t?t===e?"[object Undefined]":"[object Null]":ot&&ot in Ce(t)?function(t){var n=Oe.call(t,ot),r=t[ot];try{t[ot]=e;var i=!0}catch(tl){}var a=Re.call(t);return i&&(n?t[ot]=r:delete t[ot]),a}(t):function(e){return Re.call(e)}(t)}function Sr(e,t){return e>t}function Cr(e,t){return null!=e&&Oe.call(e,t)}function Mr(e,t){return null!=e&&t in Ce(e)}function Er(t,n,r){for(var i=r?Tt:Et,a=t[0].length,s=t.length,o=s,c=_e(s),l=1/0,u=[];o--;){var h=t[o];o&&n&&(h=At(h,Yt(n))),l=vn(h.length,l),c[o]=!r&&(n||a>=120&&h.length>=120)?new Wn(o&&h):e}h=t[0];var d=-1,f=c[0];e:for(;++d<a&&u.length<l;){var p=h[d],m=n?n(p):p;if(p=r||0!==p?p:0,!(f?Kt(f,m):i(u,m,r))){for(o=s;--o;){var g=c[o];if(!(g?Kt(g,m):i(t[o],m,r)))continue e}f&&f.push(m),u.push(p)}}return u}function Tr(t,n,r){var i=null==(t=Ca(t,n=vi(n,t)))?t:t[Ra(Qa(n))];return null==i?e:wt(i,t,r)}function Ar(e){return to(e)&&kr(e)==d}function Pr(t,n,r,i,a){return t===n||(null==t||null==n||!to(t)&&!to(n)?t!=t&&n!=n:function(t,n,r,i,a,s){var o=Us(t),c=Us(n),l=o?f:da(t),u=c?f:da(n),h=(l=l==d?w:l)==w,v=(u=u==d?w:u)==w,y=l==u;if(y&&$s(t)){if(!$s(n))return!1;o=!0,h=!1}if(y&&!h)return s||(s=new Yn),o||lo(t)?Ji(t,n,r,i,a,s):function(e,t,n,r,i,a,s){switch(n){case A:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case T:return!(e.byteLength!=t.byteLength||!a(new He(e),new He(t)));case p:case m:case _:return zs(+e,+t);case g:return e.name==t.name&&e.message==t.message;case k:case C:return e==t+"";case b:var o=nn;case S:var c=1&r;if(o||(o=sn),e.size!=t.size&&!c)return!1;var l=s.get(e);if(l)return l==t;r|=2,s.set(e,t);var u=Ji(o(e),o(t),r,i,a,s);return s.delete(e),u;case M:if(Bn)return Bn.call(e)==Bn.call(t)}return!1}(t,n,l,r,i,a,s);if(!(1&r)){var x=h&&Oe.call(t,"__wrapped__"),E=v&&Oe.call(n,"__wrapped__");if(x||E){var P=x?t.value():t,I=E?n.value():n;return s||(s=new Yn),a(P,I,r,i,s)}}return!!y&&(s||(s=new Yn),function(t,n,r,i,a,s){var o=1&r,c=ta(t),l=c.length,u=ta(n),h=u.length;if(l!=h&&!o)return!1;for(var d=l;d--;){var f=c[d];if(!(o?f in n:Oe.call(n,f)))return!1}var p=s.get(t),m=s.get(n);if(p&&m)return p==n&&m==t;var g=!0;s.set(t,n),s.set(n,t);for(var v=o;++d<l;){var y=t[f=c[d]],b=n[f];if(i)var _=o?i(b,y,f,n,t,s):i(y,b,f,t,n,s);if(!(_===e?y===b||a(y,b,r,i,s):_)){g=!1;break}v||(v="constructor"==f)}if(g&&!v){var w=t.constructor,x=n.constructor;w==x||!("constructor"in t)||!("constructor"in n)||"function"==typeof w&&w instanceof w&&"function"==typeof x&&x instanceof x||(g=!1)}return s.delete(t),s.delete(n),g}(t,n,r,i,a,s))}(t,n,r,i,Pr,a))}function Ir(t,n,r,i){var a=r.length,s=a,o=!i;if(null==t)return!s;for(t=Ce(t);a--;){var c=r[a];if(o&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++a<s;){var l=(c=r[a])[0],u=t[l],h=c[1];if(o&&c[2]){if(u===e&&!(l in t))return!1}else{var d=new Yn;if(i)var f=i(u,h,l,t,n,d);if(!(f===e?Pr(h,u,3,i,d):f))return!1}}return!0}function Nr(e){return!(!eo(e)||(t=e,Be&&Be in t))&&(Xs(e)?ze:de).test(Va(e));var t}function Dr(e){return"function"==typeof e?e:null==e?ic:"object"==typeof e?Us(e)?Fr(e[0],e[1]):Vr(e):fc(e)}function Or(e){if(!wa(e))return mn(e);var t=[];for(var n in Ce(e))Oe.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Lr(e){if(!eo(e))return function(e){var t=[];if(null!=e)for(var n in Ce(e))t.push(n);return t}(e);var t=wa(e),n=[];for(var r in e)("constructor"!=r||!t&&Oe.call(e,r))&&n.push(r);return n}function Br(e,t){return e<t}function Rr(e,t){var n=-1,r=Ws(e)?_e(e.length):[];return ur(e,(function(e,i,a){r[++n]=t(e,i,a)})),r}function Vr(e){var t=ca(e);return 1==t.length&&t[0][2]?ka(t[0][0],t[0][1]):function(n){return n===e||Ir(n,e,t)}}function Fr(t,n){return ya(t)&&xa(n)?ka(Ra(t),n):function(r){var i=Eo(r,t);return i===e&&i===n?To(r,t):Pr(n,i,3)}}function zr(t,n,r,i,a){t!==n&&gr(n,(function(s,o){if(a||(a=new Yn),eo(s))!function(t,n,r,i,a,s,o){var c=Ma(t,r),l=Ma(n,r),u=o.get(l);if(u)Zn(t,r,u);else{var h=s?s(c,l,r+"",t,n,o):e,d=h===e;if(d){var f=Us(l),p=!f&&$s(l),m=!f&&!p&&lo(l);h=l,f||p||m?Us(c)?h=c:Ys(c)?h=Ei(c):p?(d=!1,h=wi(l,!0)):m?(d=!1,h=ki(l,!0)):h=[]:io(l)||Hs(l)?(h=c,Hs(c)?h=yo(c):eo(c)&&!Xs(c)||(h=pa(l))):d=!1}d&&(o.set(l,h),a(h,l,i,s,o),o.delete(l)),Zn(t,r,h)}}(t,n,o,r,zr,i,a);else{var c=i?i(Ma(t,o),s,o+"",t,n,a):e;c===e&&(c=s),Zn(t,o,c)}}),Do)}function jr(t,n){var r=t.length;if(r)return ga(n+=n<0?r:0,r)?t[n]:e}function qr(e,t,n){t=t.length?At(t,(function(e){return Us(e)?function(t){return wr(t,1===e.length?e[0]:e)}:e})):[ic];var r=-1;return t=At(t,Yt(sa())),function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(Rr(e,(function(e,n,i){return{criteria:At(t,(function(t){return t(e)})),index:++r,value:e}})),(function(e,t){return function(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,s=i.length,o=n.length;++r<s;){var c=Si(i[r],a[r]);if(c)return r>=o?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function Hr(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var s=t[r],o=wr(e,s);n(o,s)&&Xr(a,vi(s,e),o)}return a}function Ur(e,t,n,r){var i=r?Vt:Rt,a=-1,s=t.length,o=e;for(e===t&&(t=Ei(t)),n&&(o=At(e,Yt(n)));++a<s;)for(var c=0,l=t[a],u=n?n(l):l;(c=i(o,u,c,r))>-1;)o!==e&&Qe.call(o,c,1),Qe.call(e,c,1);return e}function Gr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;ga(i)?Qe.call(e,i,1):li(e,i)}}return e}function Wr(e,t){return e+Ot(_n()*(t-e+1))}function Yr(e,t){var n="";if(!e||t<1||t>c)return n;do{t%2&&(n+=e),(t=Ot(t/2))&&(e+=e)}while(t);return n}function $r(e,t){return Aa(Sa(e,t,ic),e+"")}function Kr(e){return Kn(jo(e))}function Qr(e,t){var n=jo(e);return Na(n,ar(t,0,n.length))}function Xr(t,n,r,i){if(!eo(t))return t;for(var a=-1,s=(n=vi(n,t)).length,o=s-1,c=t;null!=c&&++a<s;){var l=Ra(n[a]),u=r;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(a!=o){var h=c[l];(u=i?i(h,l,c):e)===e&&(u=eo(h)?h:ga(n[a+1])?[]:{})}Jn(c,l,u),c=c[l]}return t}var Zr=Tn?function(e,t){return Tn.set(e,t),e}:ic,Jr=ct?function(e,t){return ct(e,"toString",{configurable:!0,enumerable:!1,value:tc(t),writable:!0})}:ic;function ei(e){return Na(jo(e))}function ti(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=_e(i);++r<i;)a[r]=e[r+t];return a}function ni(e,t){var n;return ur(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n}function ri(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var a=r+i>>>1,s=e[a];null!==s&&!co(s)&&(n?s<=t:s<t)?r=a+1:i=a}return i}return ii(e,t,ic,n)}function ii(t,n,r,i){var a=0,s=null==t?0:t.length;if(0===s)return 0;for(var o=(n=r(n))!=n,c=null===n,l=co(n),u=n===e;a<s;){var h=Ot((a+s)/2),d=r(t[h]),f=d!==e,p=null===d,m=d==d,g=co(d);if(o)var v=i||m;else v=u?m&&(i||f):c?m&&f&&(i||!p):l?m&&f&&!p&&(i||!g):!p&&!g&&(i?d<=n:d<n);v?a=h+1:s=h}return vn(s,4294967294)}function ai(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var s=e[n],o=t?t(s):s;if(!n||!zs(o,c)){var c=o;a[i++]=0===s?0:s}}return a}function si(e){return"number"==typeof e?e:co(e)?l:+e}function oi(e){if("string"==typeof e)return e;if(Us(e))return At(e,oi)+"";if(co(e))return Rn?Rn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ci(e,t,n){var r=-1,i=Et,a=e.length,s=!0,o=[],c=o;if(n)s=!1,i=Tt;else if(a>=200){var l=t?null:Yi(e);if(l)return sn(l);s=!1,i=Kt,c=new Wn}else c=t?[]:o;e:for(;++r<a;){var u=e[r],h=t?t(u):u;if(u=n||0!==u?u:0,s&&h==h){for(var d=c.length;d--;)if(c[d]===h)continue e;t&&c.push(h),o.push(u)}else i(c,h,n)||(c!==o&&c.push(h),o.push(u))}return o}function li(e,t){return null==(e=Ca(e,t=vi(t,e)))||delete e[Ra(Qa(t))]}function ui(e,t,n,r){return Xr(e,t,n(wr(e,t)),r)}function hi(e,t,n,r){for(var i=e.length,a=r?i:-1;(r?a--:++a<i)&&t(e[a],a,e););return n?ti(e,r?0:a,r?a+1:i):ti(e,r?a+1:0,r?i:a)}function di(e,t){var n=e;return n instanceof qn&&(n=n.value()),It(t,(function(e,t){return t.func.apply(t.thisArg,Pt([e],t.args))}),n)}function fi(e,t,n){var r=e.length;if(r<2)return r?ci(e[0]):[];for(var i=-1,a=_e(r);++i<r;)for(var s=e[i],o=-1;++o<r;)o!=i&&(a[i]=lr(a[i]||s,e[o],t,n));return ci(mr(a,1),t,n)}function pi(t,n,r){for(var i=-1,a=t.length,s=n.length,o={};++i<a;){var c=i<s?n[i]:e;r(o,t[i],c)}return o}function mi(e){return Ys(e)?e:[]}function gi(e){return"function"==typeof e?e:ic}function vi(e,t){return Us(e)?e:ya(e,t)?[e]:Ba(bo(e))}var yi=$r;function bi(t,n,r){var i=t.length;return r=r===e?i:r,!n&&r>=i?t:ti(t,n,r)}var _i=ut||function(e){return lt.clearTimeout(e)};function wi(e,t){if(t)return e.slice();var n=e.length,r=Ue?Ue(n):new e.constructor(n);return e.copy(r),r}function xi(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(e)),t}function ki(e,t){var n=t?xi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Si(t,n){if(t!==n){var r=t!==e,i=null===t,a=t==t,s=co(t),o=n!==e,c=null===n,l=n==n,u=co(n);if(!c&&!u&&!s&&t>n||s&&o&&l&&!c&&!u||i&&o&&l||!r&&l||!a)return 1;if(!i&&!s&&!u&&t<n||u&&r&&a&&!i&&!s||c&&r&&a||!o&&a||!l)return-1}return 0}function Ci(e,t,n,r){for(var i=-1,a=e.length,s=n.length,o=-1,c=t.length,l=gn(a-s,0),u=_e(c+l),h=!r;++o<c;)u[o]=t[o];for(;++i<s;)(h||i<a)&&(u[n[i]]=e[i]);for(;l--;)u[o++]=e[i++];return u}function Mi(e,t,n,r){for(var i=-1,a=e.length,s=-1,o=n.length,c=-1,l=t.length,u=gn(a-o,0),h=_e(u+l),d=!r;++i<u;)h[i]=e[i];for(var f=i;++c<l;)h[f+c]=t[c];for(;++s<o;)(d||i<a)&&(h[f+n[s]]=e[i++]);return h}function Ei(e,t){var n=-1,r=e.length;for(t||(t=_e(r));++n<r;)t[n]=e[n];return t}function Ti(t,n,r,i){var a=!r;r||(r={});for(var s=-1,o=n.length;++s<o;){var c=n[s],l=i?i(r[c],t[c],c,r,t):e;l===e&&(l=t[c]),a?rr(r,c,l):Jn(r,c,l)}return r}function Ai(e,t){return function(n,r){var i=Us(n)?xt:tr,a=t?t():{};return i(n,e,sa(r,2),a)}}function Pi(t){return $r((function(n,r){var i=-1,a=r.length,s=a>1?r[a-1]:e,o=a>2?r[2]:e;for(s=t.length>3&&"function"==typeof s?(a--,s):e,o&&va(r[0],r[1],o)&&(s=a<3?e:s,a=1),n=Ce(n);++i<a;){var c=r[i];c&&t(n,c,i,s)}return n}))}function Ii(e,t){return function(n,r){if(null==n)return n;if(!Ws(n))return e(n,r);for(var i=n.length,a=t?i:-1,s=Ce(n);(t?a--:++a<i)&&!1!==r(s[a],a,s););return n}}function Ni(e){return function(t,n,r){for(var i=-1,a=Ce(t),s=r(t),o=s.length;o--;){var c=s[e?o:++i];if(!1===n(a[c],c,a))break}return t}}function Di(t){return function(n){var r=tn(n=bo(n))?cn(n):e,i=r?r[0]:n.charAt(0),a=r?bi(r,1).join(""):n.slice(1);return i[t]()+a}}function Oi(e){return function(t){return It(Zo(Uo(t).replace($e,"")),e,"")}}function Li(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Fn(e.prototype),r=e.apply(n,t);return eo(r)?r:n}}function Bi(t){return function(n,r,i){var a=Ce(n);if(!Ws(n)){var s=sa(r,3);n=No(n),r=function(e){return s(a[e],e,a)}}var o=t(n,r,i);return o>-1?a[s?n[o]:o]:e}}function Ri(n){return ea((function(r){var i=r.length,a=i,s=jn.prototype.thru;for(n&&r.reverse();a--;){var o=r[a];if("function"!=typeof o)throw new Te(t);if(s&&!c&&"wrapper"==ia(o))var c=new jn([],!0)}for(a=c?a:i;++a<i;){var l=ia(o=r[a]),u="wrapper"==l?ra(o):e;c=u&&ba(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?c[ia(u[0])].apply(c,u[3]):1==o.length&&ba(o)?c[l]():c.thru(o)}return function(){var e=arguments,t=e[0];if(c&&1==e.length&&Us(t))return c.plant(t).value();for(var n=0,a=i?r[n].apply(this,e):t;++n<i;)a=r[n].call(this,a);return a}}))}function Vi(t,n,r,i,s,o,c,l,u,h){var d=n&a,f=1&n,p=2&n,m=24&n,g=512&n,v=p?e:Li(t);return function a(){for(var y=arguments.length,b=_e(y),_=y;_--;)b[_]=arguments[_];if(m)var w=aa(a),x=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(b,w);if(i&&(b=Ci(b,i,s,m)),o&&(b=Mi(b,o,c,m)),y-=x,m&&y<h){var k=an(b,w);return Gi(t,n,Vi,a.placeholder,r,b,k,l,u,h-y)}var S=f?r:this,C=p?S[t]:t;return y=b.length,l?b=function(t,n){for(var r=t.length,i=vn(n.length,r),a=Ei(t);i--;){var s=n[i];t[i]=ga(s,r)?a[s]:e}return t}(b,l):g&&y>1&&b.reverse(),d&&u<y&&(b.length=u),this&&this!==lt&&this instanceof a&&(C=v||Li(C)),C.apply(S,b)}}function Fi(e,t){return function(n,r){return function(e,t,n,r){return yr(e,(function(e,i,a){t(r,n(e),i,a)})),r}(n,e,t(r),{})}}function zi(t,n){return function(r,i){var a;if(r===e&&i===e)return n;if(r!==e&&(a=r),i!==e){if(a===e)return i;"string"==typeof r||"string"==typeof i?(r=oi(r),i=oi(i)):(r=si(r),i=si(i)),a=t(r,i)}return a}}function ji(e){return ea((function(t){return t=At(t,Yt(sa())),$r((function(n){var r=this;return e(t,(function(e){return wt(e,r,n)}))}))}))}function qi(t,n){var r=(n=n===e?" ":oi(n)).length;if(r<2)return r?Yr(n,t):n;var i=Yr(n,pt(t/on(n)));return tn(n)?bi(cn(i),0,t).join(""):i.slice(0,t)}function Hi(t){return function(n,r,i){return i&&"number"!=typeof i&&va(n,r,i)&&(r=i=e),n=po(n),r===e?(r=n,n=0):r=po(r),function(e,t,n,r){for(var i=-1,a=gn(pt((t-e)/(n||1)),0),s=_e(a);a--;)s[r?a:++i]=e,e+=n;return s}(n,r,i=i===e?n<r?1:-1:po(i),t)}}function Ui(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=vo(t),n=vo(n)),e(t,n)}}function Gi(t,n,r,a,s,o,c,l,u,h){var d=8&n;n|=d?i:64,4&(n&=~(d?64:i))||(n&=-4);var f=[t,n,s,d?o:e,d?c:e,d?e:o,d?e:c,l,u,h],p=r.apply(e,f);return ba(t)&&Ea(p,f),p.placeholder=a,Pa(p,t,n)}function Wi(e){var t=Se[e];return function(e,n){if(e=vo(e),(n=null==n?0:vn(mo(n),292))&&fn(e)){var r=(bo(e)+"e").split("e");return+((r=(bo(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Yi=Cn&&1/sn(new Cn([,-0]))[1]==o?function(e){return new Cn(e)}:lc;function $i(e){return function(t){var n=da(t);return n==b?nn(t):n==S?function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}(t):function(e,t){return At(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Ki(n,o,c,l,u,h,d,f){var p=2&o;if(!p&&"function"!=typeof n)throw new Te(t);var m=l?l.length:0;if(m||(o&=-97,l=u=e),d=d===e?d:gn(mo(d),0),f=f===e?f:mo(f),m-=u?u.length:0,64&o){var g=l,v=u;l=u=e}var y=p?e:ra(n),b=[n,o,c,l,u,g,v,h,d,f];if(y&&function(e,t){var n=e[1],i=t[1],o=n|i,c=o<131,l=i==a&&8==n||i==a&&n==s&&e[7].length<=t[8]||384==i&&t[7].length<=t[8]&&8==n;if(!c&&!l)return e;1&i&&(e[2]=t[2],o|=1&n?0:4);var u=t[3];if(u){var h=e[3];e[3]=h?Ci(h,u,t[4]):u,e[4]=h?an(e[3],r):t[4]}(u=t[5])&&(h=e[5],e[5]=h?Mi(h,u,t[6]):u,e[6]=h?an(e[5],r):t[6]),(u=t[7])&&(e[7]=u),i&a&&(e[8]=null==e[8]?t[8]:vn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o}(b,y),n=b[0],o=b[1],c=b[2],l=b[3],u=b[4],!(f=b[9]=b[9]===e?p?0:n.length:gn(b[9]-m,0))&&24&o&&(o&=-25),o&&1!=o)_=8==o||16==o?function(t,n,r){var i=Li(t);return function a(){for(var s=arguments.length,o=_e(s),c=s,l=aa(a);c--;)o[c]=arguments[c];var u=s<3&&o[0]!==l&&o[s-1]!==l?[]:an(o,l);return(s-=u.length)<r?Gi(t,n,Vi,a.placeholder,e,o,u,e,e,r-s):wt(this&&this!==lt&&this instanceof a?i:t,this,o)}}(n,o,f):o!=i&&33!=o||u.length?Vi.apply(e,b):function(e,t,n,r){var i=1&t,a=Li(e);return function t(){for(var s=-1,o=arguments.length,c=-1,l=r.length,u=_e(l+o),h=this&&this!==lt&&this instanceof t?a:e;++c<l;)u[c]=r[c];for(;o--;)u[c++]=arguments[++s];return wt(h,i?n:this,u)}}(n,o,c,l);else var _=function(e,t,n){var r=1&t,i=Li(e);return function t(){return(this&&this!==lt&&this instanceof t?i:e).apply(r?n:this,arguments)}}(n,o,c);return Pa((y?Zr:Ea)(_,b),n,o)}function Qi(t,n,r,i){return t===e||zs(t,Ie[r])&&!Oe.call(i,r)?n:t}function Xi(t,n,r,i,a,s){return eo(t)&&eo(n)&&(s.set(n,t),zr(t,n,e,Xi,s),s.delete(n)),t}function Zi(t){return io(t)?e:t}function Ji(t,n,r,i,a,s){var o=1&r,c=t.length,l=n.length;if(c!=l&&!(o&&l>c))return!1;var u=s.get(t),h=s.get(n);if(u&&h)return u==n&&h==t;var d=-1,f=!0,p=2&r?new Wn:e;for(s.set(t,n),s.set(n,t);++d<c;){var m=t[d],g=n[d];if(i)var v=o?i(g,m,d,n,t,s):i(m,g,d,t,n,s);if(v!==e){if(v)continue;f=!1;break}if(p){if(!Dt(n,(function(e,t){if(!Kt(p,t)&&(m===e||a(m,e,r,i,s)))return p.push(t)}))){f=!1;break}}else if(m!==g&&!a(m,g,r,i,s)){f=!1;break}}return s.delete(t),s.delete(n),f}function ea(t){return Aa(Sa(t,e,Ga),t+"")}function ta(e){return xr(e,No,ua)}function na(e){return xr(e,Do,ha)}var ra=Tn?function(e){return Tn.get(e)}:lc;function ia(e){for(var t=e.name+"",n=An[t],r=Oe.call(An,t)?n.length:0;r--;){var i=n[r],a=i.func;if(null==a||a==e)return i.name}return t}function aa(e){return(Oe.call(Vn,"placeholder")?Vn:e).placeholder}function sa(){var e=Vn.iteratee||ac;return e=e===ac?Dr:e,arguments.length?e(arguments[0],arguments[1]):e}function oa(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function ca(e){for(var t=No(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,xa(i)]}return t}function la(t,n){var r=function(t,n){return null==t?e:t[n]}(t,n);return Nr(r)?r:e}var ua=qt?function(e){return null==e?[]:(e=Ce(e),Mt(qt(e),(function(t){return Ye.call(e,t)})))}:gc,ha=qt?function(e){for(var t=[];e;)Pt(t,ua(e)),e=Ge(e);return t}:gc,da=kr;function fa(e,t,n){for(var r=-1,i=(t=vi(t,e)).length,a=!1;++r<i;){var s=Ra(t[r]);if(!(a=null!=e&&n(e,s)))break;e=e[s]}return a||++r!=i?a:!!(i=null==e?0:e.length)&&Js(i)&&ga(s,i)&&(Us(e)||Hs(e))}function pa(e){return"function"!=typeof e.constructor||wa(e)?{}:Fn(Ge(e))}function ma(e){return Us(e)||Hs(e)||!!(Ze&&e&&e[Ze])}function ga(e,t){var n=typeof e;return!!(t=null==t?c:t)&&("number"==n||"symbol"!=n&&pe.test(e))&&e>-1&&e%1==0&&e<t}function va(e,t,n){if(!eo(n))return!1;var r=typeof t;return!!("number"==r?Ws(n)&&ga(t,n.length):"string"==r&&t in n)&&zs(n[t],e)}function ya(e,t){if(Us(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!co(e))||Q.test(e)||!K.test(e)||null!=t&&e in Ce(t)}function ba(e){var t=ia(e),n=Vn[t];if("function"!=typeof n||!(t in qn.prototype))return!1;if(e===n)return!0;var r=ra(n);return!!r&&e===r[0]}(xn&&da(new xn(new ArrayBuffer(1)))!=A||kn&&da(new kn)!=b||Sn&&da(Sn.resolve())!=x||Cn&&da(new Cn)!=S||Mn&&da(new Mn)!=E)&&(da=function(t){var n=kr(t),r=n==w?t.constructor:e,i=r?Va(r):"";if(i)switch(i){case Pn:return A;case In:return b;case Nn:return x;case Dn:return S;case On:return E}return n});var _a=Ne?Xs:vc;function wa(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ie)}function xa(e){return e==e&&!eo(e)}function ka(t,n){return function(r){return null!=r&&r[t]===n&&(n!==e||t in Ce(r))}}function Sa(t,n,r){return n=gn(n===e?t.length-1:n,0),function(){for(var e=arguments,i=-1,a=gn(e.length-n,0),s=_e(a);++i<a;)s[i]=e[n+i];i=-1;for(var o=_e(n+1);++i<n;)o[i]=e[i];return o[n]=r(s),wt(t,this,o)}}function Ca(e,t){return t.length<2?e:wr(e,ti(t,0,-1))}function Ma(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Ea=Ia(Zr),Ta=ft||function(e,t){return lt.setTimeout(e,t)},Aa=Ia(Jr);function Pa(e,t,n){var r=t+"";return Aa(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ne,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return kt(h,(function(n){var r="_."+n[0];t&n[1]&&!Et(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(re);return t?t[1].split(ie):[]}(r),n)))}function Ia(t){var n=0,r=0;return function(){var i=yn(),a=16-(i-r);if(r=i,a>0){if(++n>=800)return arguments[0]}else n=0;return t.apply(e,arguments)}}function Na(t,n){var r=-1,i=t.length,a=i-1;for(n=n===e?i:n;++r<n;){var s=Wr(r,a),o=t[s];t[s]=t[r],t[r]=o}return t.length=n,t}var Da,Oa,La,Ba=(Da=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(X,(function(e,n,r,i){t.push(r?i.replace(oe,"$1"):n||e)})),t},Oa=Os(Da,(function(e){return 500===La.size&&La.clear(),e})),La=Oa.cache,Oa);function Ra(e){if("string"==typeof e||co(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Va(e){if(null!=e){try{return De.call(e)}catch(tl){}try{return e+""}catch(tl){}}return""}function Fa(e){if(e instanceof qn)return e.clone();var t=new jn(e.__wrapped__,e.__chain__);return t.__actions__=Ei(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var za=$r((function(e,t){return Ys(e)?lr(e,mr(t,1,Ys,!0)):[]})),ja=$r((function(t,n){var r=Qa(n);return Ys(r)&&(r=e),Ys(t)?lr(t,mr(n,1,Ys,!0),sa(r,2)):[]})),qa=$r((function(t,n){var r=Qa(n);return Ys(r)&&(r=e),Ys(t)?lr(t,mr(n,1,Ys,!0),e,r):[]}));function Ha(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:mo(n);return i<0&&(i=gn(r+i,0)),Bt(e,sa(t,3),i)}function Ua(t,n,r){var i=null==t?0:t.length;if(!i)return-1;var a=i-1;return r!==e&&(a=mo(r),a=r<0?gn(i+a,0):vn(a,i-1)),Bt(t,sa(n,3),a,!0)}function Ga(e){return null!=e&&e.length?mr(e,1):[]}function Wa(t){return t&&t.length?t[0]:e}var Ya=$r((function(e){var t=At(e,mi);return t.length&&t[0]===e[0]?Er(t):[]})),$a=$r((function(t){var n=Qa(t),r=At(t,mi);return n===Qa(r)?n=e:r.pop(),r.length&&r[0]===t[0]?Er(r,sa(n,2)):[]})),Ka=$r((function(t){var n=Qa(t),r=At(t,mi);return(n="function"==typeof n?n:e)&&r.pop(),r.length&&r[0]===t[0]?Er(r,e,n):[]}));function Qa(t){var n=null==t?0:t.length;return n?t[n-1]:e}var Xa=$r(Za);function Za(e,t){return e&&e.length&&t&&t.length?Ur(e,t):e}var Ja=ea((function(e,t){var n=null==e?0:e.length,r=ir(e,t);return Gr(e,At(t,(function(e){return ga(e,n)?+e:e})).sort(Si)),r}));function es(e){return null==e?e:wn.call(e)}var ts=$r((function(e){return ci(mr(e,1,Ys,!0))})),ns=$r((function(t){var n=Qa(t);return Ys(n)&&(n=e),ci(mr(t,1,Ys,!0),sa(n,2))})),rs=$r((function(t){var n=Qa(t);return n="function"==typeof n?n:e,ci(mr(t,1,Ys,!0),e,n)}));function is(e){if(!e||!e.length)return[];var t=0;return e=Mt(e,(function(e){if(Ys(e))return t=gn(e.length,t),!0})),Gt(t,(function(t){return At(e,jt(t))}))}function as(t,n){if(!t||!t.length)return[];var r=is(t);return null==n?r:At(r,(function(t){return wt(n,e,t)}))}var ss=$r((function(e,t){return Ys(e)?lr(e,t):[]})),os=$r((function(e){return fi(Mt(e,Ys))})),cs=$r((function(t){var n=Qa(t);return Ys(n)&&(n=e),fi(Mt(t,Ys),sa(n,2))})),ls=$r((function(t){var n=Qa(t);return n="function"==typeof n?n:e,fi(Mt(t,Ys),e,n)})),us=$r(is),hs=$r((function(t){var n=t.length,r=n>1?t[n-1]:e;return r="function"==typeof r?(t.pop(),r):e,as(t,r)}));function ds(e){var t=Vn(e);return t.__chain__=!0,t}function fs(e,t){return t(e)}var ps=ea((function(t){var n=t.length,r=n?t[0]:0,i=this.__wrapped__,a=function(e){return ir(e,t)};return!(n>1||this.__actions__.length)&&i instanceof qn&&ga(r)?((i=i.slice(r,+r+(n?1:0))).__actions__.push({func:fs,args:[a],thisArg:e}),new jn(i,this.__chain__).thru((function(t){return n&&!t.length&&t.push(e),t}))):this.thru(a)})),ms=Ai((function(e,t,n){Oe.call(e,n)?++e[n]:rr(e,n,1)})),gs=Bi(Ha),vs=Bi(Ua);function ys(e,t){return(Us(e)?kt:ur)(e,sa(t,3))}function bs(e,t){return(Us(e)?St:hr)(e,sa(t,3))}var _s=Ai((function(e,t,n){Oe.call(e,n)?e[n].push(t):rr(e,n,[t])})),ws=$r((function(e,t,n){var r=-1,i="function"==typeof t,a=Ws(e)?_e(e.length):[];return ur(e,(function(e){a[++r]=i?wt(t,e,n):Tr(e,t,n)})),a})),xs=Ai((function(e,t,n){rr(e,n,t)}));function ks(e,t){return(Us(e)?At:Rr)(e,sa(t,3))}var Ss=Ai((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Cs=$r((function(e,t){if(null==e)return[];var n=t.length;return n>1&&va(e,t[0],t[1])?t=[]:n>2&&va(t[0],t[1],t[2])&&(t=[t[0]]),qr(e,mr(t,1),[])})),Ms=ht||function(){return lt.Date.now()};function Es(t,n,r){return n=r?e:n,n=t&&null==n?t.length:n,Ki(t,a,e,e,e,e,n)}function Ts(n,r){var i;if("function"!=typeof r)throw new Te(t);return n=mo(n),function(){return--n>0&&(i=r.apply(this,arguments)),n<=1&&(r=e),i}}var As=$r((function(e,t,n){var r=1;if(n.length){var a=an(n,aa(As));r|=i}return Ki(e,r,t,n,a)})),Ps=$r((function(e,t,n){var r=3;if(n.length){var a=an(n,aa(Ps));r|=i}return Ki(t,r,e,n,a)}));function Is(n,r,i){var a,s,o,c,l,u,h=0,d=!1,f=!1,p=!0;if("function"!=typeof n)throw new Te(t);function m(t){var r=a,i=s;return a=s=e,h=t,c=n.apply(i,r)}function g(t){var n=t-u;return u===e||n>=r||n<0||f&&t-h>=o}function v(){var e=Ms();if(g(e))return y(e);l=Ta(v,function(e){var t=r-(e-u);return f?vn(t,o-(e-h)):t}(e))}function y(t){return l=e,p&&a?m(t):(a=s=e,c)}function b(){var t=Ms(),n=g(t);if(a=arguments,s=this,u=t,n){if(l===e)return function(e){return h=e,l=Ta(v,r),d?m(e):c}(u);if(f)return _i(l),l=Ta(v,r),m(u)}return l===e&&(l=Ta(v,r)),c}return r=vo(r)||0,eo(i)&&(d=!!i.leading,o=(f="maxWait"in i)?gn(vo(i.maxWait)||0,r):o,p="trailing"in i?!!i.trailing:p),b.cancel=function(){l!==e&&_i(l),h=0,a=u=s=l=e},b.flush=function(){return l===e?c:y(Ms())},b}var Ns=$r((function(e,t){return cr(e,1,t)})),Ds=$r((function(e,t,n){return cr(e,vo(t)||0,n)}));function Os(e,n){if("function"!=typeof e||null!=n&&"function"!=typeof n)throw new Te(t);var r=function(){var t=arguments,i=n?n.apply(this,t):t[0],a=r.cache;if(a.has(i))return a.get(i);var s=e.apply(this,t);return r.cache=a.set(i,s)||a,s};return r.cache=new(Os.Cache||Gn),r}function Ls(e){if("function"!=typeof e)throw new Te(t);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Os.Cache=Gn;var Bs=yi((function(e,t){var n=(t=1==t.length&&Us(t[0])?At(t[0],Yt(sa())):At(mr(t,1),Yt(sa()))).length;return $r((function(r){for(var i=-1,a=vn(r.length,n);++i<a;)r[i]=t[i].call(this,r[i]);return wt(e,this,r)}))})),Rs=$r((function(t,n){var r=an(n,aa(Rs));return Ki(t,i,e,n,r)})),Vs=$r((function(t,n){var r=an(n,aa(Vs));return Ki(t,64,e,n,r)})),Fs=ea((function(t,n){return Ki(t,s,e,e,e,n)}));function zs(e,t){return e===t||e!=e&&t!=t}var js=Ui(Sr),qs=Ui((function(e,t){return e>=t})),Hs=Ar(/* @__PURE__ */function(){return arguments}())?Ar:function(e){return to(e)&&Oe.call(e,"callee")&&!Ye.call(e,"callee")},Us=_e.isArray,Gs=mt?Yt(mt):function(e){return to(e)&&kr(e)==T};function Ws(e){return null!=e&&Js(e.length)&&!Xs(e)}function Ys(e){return to(e)&&Ws(e)}var $s=dn||vc,Ks=gt?Yt(gt):function(e){return to(e)&&kr(e)==m};function Qs(e){if(!to(e))return!1;var t=kr(e);return t==g||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!io(e)}function Xs(e){if(!eo(e))return!1;var t=kr(e);return t==v||t==y||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Zs(e){return"number"==typeof e&&e==mo(e)}function Js(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function eo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function to(e){return null!=e&&"object"==typeof e}var no=vt?Yt(vt):function(e){return to(e)&&da(e)==b};function ro(e){return"number"==typeof e||to(e)&&kr(e)==_}function io(e){if(!to(e)||kr(e)!=w)return!1;var t=Ge(e);if(null===t)return!0;var n=Oe.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&De.call(n)==Ve}var ao=yt?Yt(yt):function(e){return to(e)&&kr(e)==k},so=bt?Yt(bt):function(e){return to(e)&&da(e)==S};function oo(e){return"string"==typeof e||!Us(e)&&to(e)&&kr(e)==C}function co(e){return"symbol"==typeof e||to(e)&&kr(e)==M}var lo=_t?Yt(_t):function(e){return to(e)&&Js(e.length)&&!!nt[kr(e)]},uo=Ui(Br),ho=Ui((function(e,t){return e<=t}));function fo(e){if(!e)return[];if(Ws(e))return oo(e)?cn(e):Ei(e);if(it&&e[it])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[it]());var t=da(e);return(t==b?nn:t==S?sn:jo)(e)}function po(e){return e?(e=vo(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function mo(e){var t=po(e),n=t%1;return t==t?n?t-n:t:0}function go(e){return e?ar(mo(e),0,u):0}function vo(e){if("number"==typeof e)return e;if(co(e))return l;if(eo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=eo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Wt(e);var n=he.test(e);return n||fe.test(e)?st(e.slice(2),n?2:8):ue.test(e)?l:+e}function yo(e){return Ti(e,Do(e))}function bo(e){return null==e?"":oi(e)}var _o=Pi((function(e,t){if(wa(t)||Ws(t))Ti(t,No(t),e);else for(var n in t)Oe.call(t,n)&&Jn(e,n,t[n])})),wo=Pi((function(e,t){Ti(t,Do(t),e)})),xo=Pi((function(e,t,n,r){Ti(t,Do(t),e,r)})),ko=Pi((function(e,t,n,r){Ti(t,No(t),e,r)})),So=ea(ir),Co=$r((function(t,n){t=Ce(t);var r=-1,i=n.length,a=i>2?n[2]:e;for(a&&va(n[0],n[1],a)&&(i=1);++r<i;)for(var s=n[r],o=Do(s),c=-1,l=o.length;++c<l;){var u=o[c],h=t[u];(h===e||zs(h,Ie[u])&&!Oe.call(t,u))&&(t[u]=s[u])}return t})),Mo=$r((function(t){return t.push(e,Xi),wt(Lo,e,t)}));function Eo(t,n,r){var i=null==t?e:wr(t,n);return i===e?r:i}function To(e,t){return null!=e&&fa(e,t,Mr)}var Ao=Fi((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Re.call(t)),e[t]=n}),tc(ic)),Po=Fi((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Re.call(t)),Oe.call(e,t)?e[t].push(n):e[t]=[n]}),sa),Io=$r(Tr);function No(e){return Ws(e)?$n(e):Or(e)}function Do(e){return Ws(e)?$n(e,!0):Lr(e)}var Oo=Pi((function(e,t,n){zr(e,t,n)})),Lo=Pi((function(e,t,n,r){zr(e,t,n,r)})),Bo=ea((function(e,t){var n={};if(null==e)return n;var r=!1;t=At(t,(function(t){return t=vi(t,e),r||(r=t.length>1),t})),Ti(e,na(e),n),r&&(n=sr(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Ro=ea((function(e,t){return null==e?{}:function(e,t){return Hr(e,t,(function(t,n){return To(e,n)}))}(e,t)}));function Vo(e,t){if(null==e)return{};var n=At(na(e),(function(e){return[e]}));return t=sa(t),Hr(e,n,(function(e,n){return t(e,n[0])}))}var Fo=$i(No),zo=$i(Do);function jo(e){return null==e?[]:$t(e,No(e))}var qo=Oi((function(e,t,n){return t=t.toLowerCase(),e+(n?Ho(t):t)}));function Ho(e){return Xo(bo(e).toLowerCase())}function Uo(e){return(e=bo(e))&&e.replace(me,Zt).replace(Ke,"")}var Go=Oi((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Wo=Oi((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Yo=Di("toLowerCase"),$o=Oi((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ko=Oi((function(e,t,n){return e+(n?" ":"")+Xo(t)})),Qo=Oi((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xo=Di("toUpperCase");function Zo(t,n,r){return t=bo(t),(n=r?e:n)===e?function(e){return Je.test(e)}(t)?function(e){return e.match(Xe)||[]}(t):function(e){return e.match(ae)||[]}(t):t.match(n)||[]}var Jo=$r((function(t,n){try{return wt(t,e,n)}catch(tl){return Qs(tl)?tl:new xe(tl)}})),ec=ea((function(e,t){return kt(t,(function(t){t=Ra(t),rr(e,t,As(e[t],e))})),e}));function tc(e){return function(){return e}}var nc=Ri(),rc=Ri(!0);function ic(e){return e}function ac(e){return Dr("function"==typeof e?e:sr(e,1))}var sc=$r((function(e,t){return function(n){return Tr(n,e,t)}})),oc=$r((function(e,t){return function(n){return Tr(e,n,t)}}));function cc(e,t,n){var r=No(t),i=_r(t,r);null!=n||eo(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=_r(t,No(t)));var a=!(eo(n)&&"chain"in n&&!n.chain),s=Xs(e);return kt(i,(function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__);return(n.__actions__=Ei(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Pt([this.value()],arguments))})})),e}function lc(){}var uc=ji(At),hc=ji(Ct),dc=ji(Dt);function fc(e){return ya(e)?jt(Ra(e)):function(e){return function(t){return wr(t,e)}}(e)}var pc=Hi(),mc=Hi(!0);function gc(){return[]}function vc(){return!1}var yc,bc=zi((function(e,t){return e+t}),0),_c=Wi("ceil"),wc=zi((function(e,t){return e/t}),1),xc=Wi("floor"),kc=zi((function(e,t){return e*t}),1),Sc=Wi("round"),Cc=zi((function(e,t){return e-t}),0);return Vn.after=function(e,n){if("function"!=typeof n)throw new Te(t);return e=mo(e),function(){if(--e<1)return n.apply(this,arguments)}},Vn.ary=Es,Vn.assign=_o,Vn.assignIn=wo,Vn.assignInWith=xo,Vn.assignWith=ko,Vn.at=So,Vn.before=Ts,Vn.bind=As,Vn.bindAll=ec,Vn.bindKey=Ps,Vn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Us(e)?e:[e]},Vn.chain=ds,Vn.chunk=function(t,n,r){n=(r?va(t,n,r):n===e)?1:gn(mo(n),0);var i=null==t?0:t.length;if(!i||n<1)return[];for(var a=0,s=0,o=_e(pt(i/n));a<i;)o[s++]=ti(t,a,a+=n);return o},Vn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var a=e[t];a&&(i[r++]=a)}return i},Vn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=_e(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Pt(Us(n)?Ei(n):[n],mr(t,1))},Vn.cond=function(e){var n=null==e?0:e.length,r=sa();return e=n?At(e,(function(e){if("function"!=typeof e[1])throw new Te(t);return[r(e[0]),e[1]]})):[],$r((function(t){for(var r=-1;++r<n;){var i=e[r];if(wt(i[0],this,t))return wt(i[1],this,t)}}))},Vn.conforms=function(e){return function(e){var t=No(e);return function(n){return or(n,e,t)}}(sr(e,1))},Vn.constant=tc,Vn.countBy=ms,Vn.create=function(e,t){var n=Fn(e);return null==t?n:nr(n,t)},Vn.curry=function t(n,r,i){var a=Ki(n,8,e,e,e,e,e,r=i?e:r);return a.placeholder=t.placeholder,a},Vn.curryRight=function t(n,r,i){var a=Ki(n,16,e,e,e,e,e,r=i?e:r);return a.placeholder=t.placeholder,a},Vn.debounce=Is,Vn.defaults=Co,Vn.defaultsDeep=Mo,Vn.defer=Ns,Vn.delay=Ds,Vn.difference=za,Vn.differenceBy=ja,Vn.differenceWith=qa,Vn.drop=function(t,n,r){var i=null==t?0:t.length;return i?ti(t,(n=r||n===e?1:mo(n))<0?0:n,i):[]},Vn.dropRight=function(t,n,r){var i=null==t?0:t.length;return i?ti(t,0,(n=i-(n=r||n===e?1:mo(n)))<0?0:n):[]},Vn.dropRightWhile=function(e,t){return e&&e.length?hi(e,sa(t,3),!0,!0):[]},Vn.dropWhile=function(e,t){return e&&e.length?hi(e,sa(t,3),!0):[]},Vn.fill=function(t,n,r,i){var a=null==t?0:t.length;return a?(r&&"number"!=typeof r&&va(t,n,r)&&(r=0,i=a),function(t,n,r,i){var a=t.length;for((r=mo(r))<0&&(r=-r>a?0:a+r),(i=i===e||i>a?a:mo(i))<0&&(i+=a),i=r>i?0:go(i);r<i;)t[r++]=n;return t}(t,n,r,i)):[]},Vn.filter=function(e,t){return(Us(e)?Mt:pr)(e,sa(t,3))},Vn.flatMap=function(e,t){return mr(ks(e,t),1)},Vn.flatMapDeep=function(e,t){return mr(ks(e,t),o)},Vn.flatMapDepth=function(t,n,r){return r=r===e?1:mo(r),mr(ks(t,n),r)},Vn.flatten=Ga,Vn.flattenDeep=function(e){return null!=e&&e.length?mr(e,o):[]},Vn.flattenDepth=function(t,n){return null!=t&&t.length?mr(t,n=n===e?1:mo(n)):[]},Vn.flip=function(e){return Ki(e,512)},Vn.flow=nc,Vn.flowRight=rc,Vn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r},Vn.functions=function(e){return null==e?[]:_r(e,No(e))},Vn.functionsIn=function(e){return null==e?[]:_r(e,Do(e))},Vn.groupBy=_s,Vn.initial=function(e){return null!=e&&e.length?ti(e,0,-1):[]},Vn.intersection=Ya,Vn.intersectionBy=$a,Vn.intersectionWith=Ka,Vn.invert=Ao,Vn.invertBy=Po,Vn.invokeMap=ws,Vn.iteratee=ac,Vn.keyBy=xs,Vn.keys=No,Vn.keysIn=Do,Vn.map=ks,Vn.mapKeys=function(e,t){var n={};return t=sa(t,3),yr(e,(function(e,r,i){rr(n,t(e,r,i),e)})),n},Vn.mapValues=function(e,t){var n={};return t=sa(t,3),yr(e,(function(e,r,i){rr(n,r,t(e,r,i))})),n},Vn.matches=function(e){return Vr(sr(e,1))},Vn.matchesProperty=function(e,t){return Fr(e,sr(t,1))},Vn.memoize=Os,Vn.merge=Oo,Vn.mergeWith=Lo,Vn.method=sc,Vn.methodOf=oc,Vn.mixin=cc,Vn.negate=Ls,Vn.nthArg=function(e){return e=mo(e),$r((function(t){return jr(t,e)}))},Vn.omit=Bo,Vn.omitBy=function(e,t){return Vo(e,Ls(sa(t)))},Vn.once=function(e){return Ts(2,e)},Vn.orderBy=function(t,n,r,i){return null==t?[]:(Us(n)||(n=null==n?[]:[n]),Us(r=i?e:r)||(r=null==r?[]:[r]),qr(t,n,r))},Vn.over=uc,Vn.overArgs=Bs,Vn.overEvery=hc,Vn.overSome=dc,Vn.partial=Rs,Vn.partialRight=Vs,Vn.partition=Ss,Vn.pick=Ro,Vn.pickBy=Vo,Vn.property=fc,Vn.propertyOf=function(t){return function(n){return null==t?e:wr(t,n)}},Vn.pull=Xa,Vn.pullAll=Za,Vn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Ur(e,t,sa(n,2)):e},Vn.pullAllWith=function(t,n,r){return t&&t.length&&n&&n.length?Ur(t,n,e,r):t},Vn.pullAt=Ja,Vn.range=pc,Vn.rangeRight=mc,Vn.rearg=Fs,Vn.reject=function(e,t){return(Us(e)?Mt:pr)(e,Ls(sa(t,3)))},Vn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],a=e.length;for(t=sa(t,3);++r<a;){var s=e[r];t(s,r,e)&&(n.push(s),i.push(r))}return Gr(e,i),n},Vn.rest=function(n,r){if("function"!=typeof n)throw new Te(t);return $r(n,r=r===e?r:mo(r))},Vn.reverse=es,Vn.sampleSize=function(t,n,r){return n=(r?va(t,n,r):n===e)?1:mo(n),(Us(t)?Qn:Qr)(t,n)},Vn.set=function(e,t,n){return null==e?e:Xr(e,t,n)},Vn.setWith=function(t,n,r,i){return i="function"==typeof i?i:e,null==t?t:Xr(t,n,r,i)},Vn.shuffle=function(e){return(Us(e)?Xn:ei)(e)},Vn.slice=function(t,n,r){var i=null==t?0:t.length;return i?(r&&"number"!=typeof r&&va(t,n,r)?(n=0,r=i):(n=null==n?0:mo(n),r=r===e?i:mo(r)),ti(t,n,r)):[]},Vn.sortBy=Cs,Vn.sortedUniq=function(e){return e&&e.length?ai(e):[]},Vn.sortedUniqBy=function(e,t){return e&&e.length?ai(e,sa(t,2)):[]},Vn.split=function(t,n,r){return r&&"number"!=typeof r&&va(t,n,r)&&(n=r=e),(r=r===e?u:r>>>0)?(t=bo(t))&&("string"==typeof n||null!=n&&!ao(n))&&!(n=oi(n))&&tn(t)?bi(cn(t),0,r):t.split(n,r):[]},Vn.spread=function(e,n){if("function"!=typeof e)throw new Te(t);return n=null==n?0:gn(mo(n),0),$r((function(t){var r=t[n],i=bi(t,0,n);return r&&Pt(i,r),wt(e,this,i)}))},Vn.tail=function(e){var t=null==e?0:e.length;return t?ti(e,1,t):[]},Vn.take=function(t,n,r){return t&&t.length?ti(t,0,(n=r||n===e?1:mo(n))<0?0:n):[]},Vn.takeRight=function(t,n,r){var i=null==t?0:t.length;return i?ti(t,(n=i-(n=r||n===e?1:mo(n)))<0?0:n,i):[]},Vn.takeRightWhile=function(e,t){return e&&e.length?hi(e,sa(t,3),!1,!0):[]},Vn.takeWhile=function(e,t){return e&&e.length?hi(e,sa(t,3)):[]},Vn.tap=function(e,t){return t(e),e},Vn.throttle=function(e,n,r){var i=!0,a=!0;if("function"!=typeof e)throw new Te(t);return eo(r)&&(i="leading"in r?!!r.leading:i,a="trailing"in r?!!r.trailing:a),Is(e,n,{leading:i,maxWait:n,trailing:a})},Vn.thru=fs,Vn.toArray=fo,Vn.toPairs=Fo,Vn.toPairsIn=zo,Vn.toPath=function(e){return Us(e)?At(e,Ra):co(e)?[e]:Ei(Ba(bo(e)))},Vn.toPlainObject=yo,Vn.transform=function(e,t,n){var r=Us(e),i=r||$s(e)||lo(e);if(t=sa(t,4),null==n){var a=e&&e.constructor;n=i?r?new a:[]:eo(e)&&Xs(a)?Fn(Ge(e)):{}}return(i?kt:yr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Vn.unary=function(e){return Es(e,1)},Vn.union=ts,Vn.unionBy=ns,Vn.unionWith=rs,Vn.uniq=function(e){return e&&e.length?ci(e):[]},Vn.uniqBy=function(e,t){return e&&e.length?ci(e,sa(t,2)):[]},Vn.uniqWith=function(t,n){return n="function"==typeof n?n:e,t&&t.length?ci(t,e,n):[]},Vn.unset=function(e,t){return null==e||li(e,t)},Vn.unzip=is,Vn.unzipWith=as,Vn.update=function(e,t,n){return null==e?e:ui(e,t,gi(n))},Vn.updateWith=function(t,n,r,i){return i="function"==typeof i?i:e,null==t?t:ui(t,n,gi(r),i)},Vn.values=jo,Vn.valuesIn=function(e){return null==e?[]:$t(e,Do(e))},Vn.without=ss,Vn.words=Zo,Vn.wrap=function(e,t){return Rs(gi(t),e)},Vn.xor=os,Vn.xorBy=cs,Vn.xorWith=ls,Vn.zip=us,Vn.zipObject=function(e,t){return pi(e||[],t||[],Jn)},Vn.zipObjectDeep=function(e,t){return pi(e||[],t||[],Xr)},Vn.zipWith=hs,Vn.entries=Fo,Vn.entriesIn=zo,Vn.extend=wo,Vn.extendWith=xo,cc(Vn,Vn),Vn.add=bc,Vn.attempt=Jo,Vn.camelCase=qo,Vn.capitalize=Ho,Vn.ceil=_c,Vn.clamp=function(t,n,r){return r===e&&(r=n,n=e),r!==e&&(r=(r=vo(r))==r?r:0),n!==e&&(n=(n=vo(n))==n?n:0),ar(vo(t),n,r)},Vn.clone=function(e){return sr(e,4)},Vn.cloneDeep=function(e){return sr(e,5)},Vn.cloneDeepWith=function(t,n){return sr(t,5,n="function"==typeof n?n:e)},Vn.cloneWith=function(t,n){return sr(t,4,n="function"==typeof n?n:e)},Vn.conformsTo=function(e,t){return null==t||or(e,t,No(t))},Vn.deburr=Uo,Vn.defaultTo=function(e,t){return null==e||e!=e?t:e},Vn.divide=wc,Vn.endsWith=function(t,n,r){t=bo(t),n=oi(n);var i=t.length,a=r=r===e?i:ar(mo(r),0,i);return(r-=n.length)>=0&&t.slice(r,a)==n},Vn.eq=zs,Vn.escape=function(e){return(e=bo(e))&&G.test(e)?e.replace(H,Jt):e},Vn.escapeRegExp=function(e){return(e=bo(e))&&J.test(e)?e.replace(Z,"\\$&"):e},Vn.every=function(t,n,r){var i=Us(t)?Ct:dr;return r&&va(t,n,r)&&(n=e),i(t,sa(n,3))},Vn.find=gs,Vn.findIndex=Ha,Vn.findKey=function(e,t){return Lt(e,sa(t,3),yr)},Vn.findLast=vs,Vn.findLastIndex=Ua,Vn.findLastKey=function(e,t){return Lt(e,sa(t,3),br)},Vn.floor=xc,Vn.forEach=ys,Vn.forEachRight=bs,Vn.forIn=function(e,t){return null==e?e:gr(e,sa(t,3),Do)},Vn.forInRight=function(e,t){return null==e?e:vr(e,sa(t,3),Do)},Vn.forOwn=function(e,t){return e&&yr(e,sa(t,3))},Vn.forOwnRight=function(e,t){return e&&br(e,sa(t,3))},Vn.get=Eo,Vn.gt=js,Vn.gte=qs,Vn.has=function(e,t){return null!=e&&fa(e,t,Cr)},Vn.hasIn=To,Vn.head=Wa,Vn.identity=ic,Vn.includes=function(e,t,n,r){e=Ws(e)?e:jo(e),n=n&&!r?mo(n):0;var i=e.length;return n<0&&(n=gn(i+n,0)),oo(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Rt(e,t,n)>-1},Vn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:mo(n);return i<0&&(i=gn(r+i,0)),Rt(e,t,i)},Vn.inRange=function(t,n,r){return n=po(n),r===e?(r=n,n=0):r=po(r),function(e,t,n){return e>=vn(t,n)&&e<gn(t,n)}(t=vo(t),n,r)},Vn.invoke=Io,Vn.isArguments=Hs,Vn.isArray=Us,Vn.isArrayBuffer=Gs,Vn.isArrayLike=Ws,Vn.isArrayLikeObject=Ys,Vn.isBoolean=function(e){return!0===e||!1===e||to(e)&&kr(e)==p},Vn.isBuffer=$s,Vn.isDate=Ks,Vn.isElement=function(e){return to(e)&&1===e.nodeType&&!io(e)},Vn.isEmpty=function(e){if(null==e)return!0;if(Ws(e)&&(Us(e)||"string"==typeof e||"function"==typeof e.splice||$s(e)||lo(e)||Hs(e)))return!e.length;var t=da(e);if(t==b||t==S)return!e.size;if(wa(e))return!Or(e).length;for(var n in e)if(Oe.call(e,n))return!1;return!0},Vn.isEqual=function(e,t){return Pr(e,t)},Vn.isEqualWith=function(t,n,r){var i=(r="function"==typeof r?r:e)?r(t,n):e;return i===e?Pr(t,n,e,r):!!i},Vn.isError=Qs,Vn.isFinite=function(e){return"number"==typeof e&&fn(e)},Vn.isFunction=Xs,Vn.isInteger=Zs,Vn.isLength=Js,Vn.isMap=no,Vn.isMatch=function(e,t){return e===t||Ir(e,t,ca(t))},Vn.isMatchWith=function(t,n,r){return r="function"==typeof r?r:e,Ir(t,n,ca(n),r)},Vn.isNaN=function(e){return ro(e)&&e!=+e},Vn.isNative=function(e){if(_a(e))throw new xe("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Nr(e)},Vn.isNil=function(e){return null==e},Vn.isNull=function(e){return null===e},Vn.isNumber=ro,Vn.isObject=eo,Vn.isObjectLike=to,Vn.isPlainObject=io,Vn.isRegExp=ao,Vn.isSafeInteger=function(e){return Zs(e)&&e>=-9007199254740991&&e<=c},Vn.isSet=so,Vn.isString=oo,Vn.isSymbol=co,Vn.isTypedArray=lo,Vn.isUndefined=function(t){return t===e},Vn.isWeakMap=function(e){return to(e)&&da(e)==E},Vn.isWeakSet=function(e){return to(e)&&"[object WeakSet]"==kr(e)},Vn.join=function(e,t){return null==e?"":pn.call(e,t)},Vn.kebabCase=Go,Vn.last=Qa,Vn.lastIndexOf=function(t,n,r){var i=null==t?0:t.length;if(!i)return-1;var a=i;return r!==e&&(a=(a=mo(r))<0?gn(i+a,0):vn(a,i-1)),n==n?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(t,n,a):Bt(t,Ft,a,!0)},Vn.lowerCase=Wo,Vn.lowerFirst=Yo,Vn.lt=uo,Vn.lte=ho,Vn.max=function(t){return t&&t.length?fr(t,ic,Sr):e},Vn.maxBy=function(t,n){return t&&t.length?fr(t,sa(n,2),Sr):e},Vn.mean=function(e){return zt(e,ic)},Vn.meanBy=function(e,t){return zt(e,sa(t,2))},Vn.min=function(t){return t&&t.length?fr(t,ic,Br):e},Vn.minBy=function(t,n){return t&&t.length?fr(t,sa(n,2),Br):e},Vn.stubArray=gc,Vn.stubFalse=vc,Vn.stubObject=function(){return{}},Vn.stubString=function(){return""},Vn.stubTrue=function(){return!0},Vn.multiply=kc,Vn.nth=function(t,n){return t&&t.length?jr(t,mo(n)):e},Vn.noConflict=function(){return lt._===this&&(lt._=Fe),this},Vn.noop=lc,Vn.now=Ms,Vn.pad=function(e,t,n){e=bo(e);var r=(t=mo(t))?on(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return qi(Ot(i),n)+e+qi(pt(i),n)},Vn.padEnd=function(e,t,n){e=bo(e);var r=(t=mo(t))?on(e):0;return t&&r<t?e+qi(t-r,n):e},Vn.padStart=function(e,t,n){e=bo(e);var r=(t=mo(t))?on(e):0;return t&&r<t?qi(t-r,n)+e:e},Vn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),bn(bo(e).replace(ee,""),t||0)},Vn.random=function(t,n,r){if(r&&"boolean"!=typeof r&&va(t,n,r)&&(n=r=e),r===e&&("boolean"==typeof n?(r=n,n=e):"boolean"==typeof t&&(r=t,t=e)),t===e&&n===e?(t=0,n=1):(t=po(t),n===e?(n=t,t=0):n=po(n)),t>n){var i=t;t=n,n=i}if(r||t%1||n%1){var a=_n();return vn(t+a*(n-t+at("1e-"+((a+"").length-1))),n)}return Wr(t,n)},Vn.reduce=function(e,t,n){var r=Us(e)?It:Ht,i=arguments.length<3;return r(e,sa(t,4),n,i,ur)},Vn.reduceRight=function(e,t,n){var r=Us(e)?Nt:Ht,i=arguments.length<3;return r(e,sa(t,4),n,i,hr)},Vn.repeat=function(t,n,r){return n=(r?va(t,n,r):n===e)?1:mo(n),Yr(bo(t),n)},Vn.replace=function(){var e=arguments,t=bo(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Vn.result=function(t,n,r){var i=-1,a=(n=vi(n,t)).length;for(a||(a=1,t=e);++i<a;){var s=null==t?e:t[Ra(n[i])];s===e&&(i=a,s=r),t=Xs(s)?s.call(t):s}return t},Vn.round=Sc,Vn.runInContext=te,Vn.sample=function(e){return(Us(e)?Kn:Kr)(e)},Vn.size=function(e){if(null==e)return 0;if(Ws(e))return oo(e)?on(e):e.length;var t=da(e);return t==b||t==S?e.size:Or(e).length},Vn.snakeCase=$o,Vn.some=function(t,n,r){var i=Us(t)?Dt:ni;return r&&va(t,n,r)&&(n=e),i(t,sa(n,3))},Vn.sortedIndex=function(e,t){return ri(e,t)},Vn.sortedIndexBy=function(e,t,n){return ii(e,t,sa(n,2))},Vn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ri(e,t);if(r<n&&zs(e[r],t))return r}return-1},Vn.sortedLastIndex=function(e,t){return ri(e,t,!0)},Vn.sortedLastIndexBy=function(e,t,n){return ii(e,t,sa(n,2),!0)},Vn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ri(e,t,!0)-1;if(zs(e[n],t))return n}return-1},Vn.startCase=Ko,Vn.startsWith=function(e,t,n){return e=bo(e),n=null==n?0:ar(mo(n),0,e.length),t=oi(t),e.slice(n,n+t.length)==t},Vn.subtract=Cc,Vn.sum=function(e){return e&&e.length?Ut(e,ic):0},Vn.sumBy=function(e,t){return e&&e.length?Ut(e,sa(t,2)):0},Vn.template=function(t,n,r){var i=Vn.templateSettings;r&&va(t,n,r)&&(n=e),t=bo(t),n=xo({},n,i,Qi);var a,s,o=xo({},n.imports,i.imports,Qi),c=No(o),l=$t(o,c),u=0,h=n.interpolate||ge,d="__p += '",f=Me((n.escape||ge).source+"|"+h.source+"|"+(h===$?ce:ge).source+"|"+(n.evaluate||ge).source+"|$","g"),p="//# sourceURL="+(Oe.call(n,"sourceURL")?(n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++tt+"]")+"\n";t.replace(f,(function(e,n,r,i,o,c){return r||(r=i),d+=t.slice(u,c).replace(ve,en),n&&(a=!0,d+="' +\n__e("+n+") +\n'"),o&&(s=!0,d+="';\n"+o+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=c+e.length,e})),d+="';\n";var m=Oe.call(n,"variable")&&n.variable;if(m){if(se.test(m))throw new xe("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(s?d.replace(F,""):d).replace(z,"$1").replace(j,"$1;"),d="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=Jo((function(){return ke(c,p+"return "+d).apply(e,l)}));if(g.source=d,Qs(g))throw g;return g},Vn.times=function(e,t){if((e=mo(e))<1||e>c)return[];var n=u,r=vn(e,u);t=sa(t),e-=u;for(var i=Gt(r,t);++n<e;)t(n);return i},Vn.toFinite=po,Vn.toInteger=mo,Vn.toLength=go,Vn.toLower=function(e){return bo(e).toLowerCase()},Vn.toNumber=vo,Vn.toSafeInteger=function(e){return e?ar(mo(e),-9007199254740991,c):0===e?e:0},Vn.toString=bo,Vn.toUpper=function(e){return bo(e).toUpperCase()},Vn.trim=function(t,n,r){if((t=bo(t))&&(r||n===e))return Wt(t);if(!t||!(n=oi(n)))return t;var i=cn(t),a=cn(n);return bi(i,Qt(i,a),Xt(i,a)+1).join("")},Vn.trimEnd=function(t,n,r){if((t=bo(t))&&(r||n===e))return t.slice(0,ln(t)+1);if(!t||!(n=oi(n)))return t;var i=cn(t);return bi(i,0,Xt(i,cn(n))+1).join("")},Vn.trimStart=function(t,n,r){if((t=bo(t))&&(r||n===e))return t.replace(ee,"");if(!t||!(n=oi(n)))return t;var i=cn(t);return bi(i,Qt(i,cn(n))).join("")},Vn.truncate=function(t,n){var r=30,i="...";if(eo(n)){var a="separator"in n?n.separator:a;r="length"in n?mo(n.length):r,i="omission"in n?oi(n.omission):i}var s=(t=bo(t)).length;if(tn(t)){var o=cn(t);s=o.length}if(r>=s)return t;var c=r-on(i);if(c<1)return i;var l=o?bi(o,0,c).join(""):t.slice(0,c);if(a===e)return l+i;if(o&&(c+=l.length-c),ao(a)){if(t.slice(c).search(a)){var u,h=l;for(a.global||(a=Me(a.source,bo(le.exec(a))+"g")),a.lastIndex=0;u=a.exec(h);)var d=u.index;l=l.slice(0,d===e?c:d)}}else if(t.indexOf(oi(a),c)!=c){var f=l.lastIndexOf(a);f>-1&&(l=l.slice(0,f))}return l+i},Vn.unescape=function(e){return(e=bo(e))&&U.test(e)?e.replace(q,un):e},Vn.uniqueId=function(e){var t=++Le;return bo(e)+t},Vn.upperCase=Qo,Vn.upperFirst=Xo,Vn.each=ys,Vn.eachRight=bs,Vn.first=Wa,cc(Vn,(yc={},yr(Vn,(function(e,t){Oe.call(Vn.prototype,t)||(yc[t]=e)})),yc),{chain:!1}),Vn.VERSION="4.17.21",kt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Vn[e].placeholder=Vn})),kt(["drop","take"],(function(t,n){qn.prototype[t]=function(r){r=r===e?1:gn(mo(r),0);var i=this.__filtered__&&!n?new qn(this):this.clone();return i.__filtered__?i.__takeCount__=vn(r,i.__takeCount__):i.__views__.push({size:vn(r,u),type:t+(i.__dir__<0?"Right":"")}),i},qn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),kt(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;qn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:sa(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),kt(["head","last"],(function(e,t){var n="take"+(t?"Right":"");qn.prototype[e]=function(){return this[n](1).value()[0]}})),kt(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");qn.prototype[e]=function(){return this.__filtered__?new qn(this):this[n](1)}})),qn.prototype.compact=function(){return this.filter(ic)},qn.prototype.find=function(e){return this.filter(e).head()},qn.prototype.findLast=function(e){return this.reverse().find(e)},qn.prototype.invokeMap=$r((function(e,t){return"function"==typeof e?new qn(this):this.map((function(n){return Tr(n,e,t)}))})),qn.prototype.reject=function(e){return this.filter(Ls(sa(e)))},qn.prototype.slice=function(t,n){t=mo(t);var r=this;return r.__filtered__&&(t>0||n<0)?new qn(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),n!==e&&(r=(n=mo(n))<0?r.dropRight(-n):r.take(n-t)),r)},qn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},qn.prototype.toArray=function(){return this.take(u)},yr(qn.prototype,(function(t,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),i=/^(?:head|last)$/.test(n),a=Vn[i?"take"+("last"==n?"Right":""):n],s=i||/^find/.test(n);a&&(Vn.prototype[n]=function(){var n=this.__wrapped__,o=i?[1]:arguments,c=n instanceof qn,l=o[0],u=c||Us(n),h=function(e){var t=a.apply(Vn,Pt([e],o));return i&&d?t[0]:t};u&&r&&"function"==typeof l&&1!=l.length&&(c=u=!1);var d=this.__chain__,f=!!this.__actions__.length,p=s&&!d,m=c&&!f;if(!s&&u){n=m?n:new qn(this);var g=t.apply(n,o);return g.__actions__.push({func:fs,args:[h],thisArg:e}),new jn(g,d)}return p&&m?t.apply(this,o):(g=this.thru(h),p?i?g.value()[0]:g.value():g)})})),kt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ae[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Vn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Us(i)?i:[],e)}return this[n]((function(n){return t.apply(Us(n)?n:[],e)}))}})),yr(qn.prototype,(function(e,t){var n=Vn[t];if(n){var r=n.name+"";Oe.call(An,r)||(An[r]=[]),An[r].push({name:t,func:n})}})),An[Vi(e,2).name]=[{name:"wrapper",func:e}],qn.prototype.clone=function(){var e=new qn(this.__wrapped__);return e.__actions__=Ei(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ei(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ei(this.__views__),e},qn.prototype.reverse=function(){if(this.__filtered__){var e=new qn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},qn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Us(e),r=t<0,i=n?e.length:0,a=function(e,t,n){for(var r=-1,i=n.length;++r<i;){var a=n[r],s=a.size;switch(a.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=vn(t,e+s);break;case"takeRight":e=gn(e,t-s)}}return{start:e,end:t}}(0,i,this.__views__),s=a.start,o=a.end,c=o-s,l=r?o:s-1,u=this.__iteratees__,h=u.length,d=0,f=vn(c,this.__takeCount__);if(!n||!r&&i==c&&f==c)return di(e,this.__actions__);var p=[];e:for(;c--&&d<f;){for(var m=-1,g=e[l+=t];++m<h;){var v=u[m],y=v.iteratee,b=v.type,_=y(g);if(2==b)g=_;else if(!_){if(1==b)continue e;break e}}p[d++]=g}return p},Vn.prototype.at=ps,Vn.prototype.chain=function(){return ds(this)},Vn.prototype.commit=function(){return new jn(this.value(),this.__chain__)},Vn.prototype.next=function(){this.__values__===e&&(this.__values__=fo(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?e:this.__values__[this.__index__++]}},Vn.prototype.plant=function(t){for(var n,r=this;r instanceof zn;){var i=Fa(r);i.__index__=0,i.__values__=e,n?a.__wrapped__=i:n=i;var a=i;r=r.__wrapped__}return a.__wrapped__=t,n},Vn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof qn){var n=t;return this.__actions__.length&&(n=new qn(this)),(n=n.reverse()).__actions__.push({func:fs,args:[es],thisArg:e}),new jn(n,this.__chain__)}return this.thru(es)},Vn.prototype.toJSON=Vn.prototype.valueOf=Vn.prototype.value=function(){return di(this.__wrapped__,this.__actions__)},Vn.prototype.first=Vn.prototype.head,it&&(Vn.prototype[it]=function(){return this}),Vn}();ht?((ht.exports=hn)._=hn,ut._=hn):lt._=hn}.call(mb.exports)),mb.exports);const bb=/* @__PURE__ */fb(yb),_b=n({name:"ComponentRegistration",props:{course:{type:String,required:!0}},data:()=>({dataShapes:[],questions:[],courseDatashapes:[],courseQuestionTypes:[],courseConfig:void 0,courseDB:null}),async created(){this.courseDB=se().getCourseDB(this.course),this.courseConfig=await this.courseDB.getCourseConfig(),this.courseDatashapes=this.courseConfig.dataShapes,this.courseQuestionTypes=this.courseConfig.questionTypes;const e=hb.allDataShapes();hb.allDataShapesRaw().forEach((e=>{console.log(`[ComponentRegistration] Datashape:\n${JSON.stringify(e)}`)})),e.forEach((e=>{const t=this.courseDatashapes.find((t=>t.name===te.getDataShapeString(e)));this.dataShapes.push({name:e.dataShape,course:e.course,dataShape:hb.getDataShape(e),registered:void 0!==t,displayable:e.displayable})})),this.dataShapes=yb.sortBy(this.dataShapes,["registered","name"]);const t=hb.courses.map((e=>e.name)),n=[];t.forEach((e=>{hb.getCourseWare(e).questions.forEach((t=>{n.push([{course:e,questionType:t.name},t])}))})),n.forEach((e=>{const t=this.courseQuestionTypes.find((t=>te.getQuestionString(e[0])===t.name));this.questions.push({course:e[0].course,name:e[1].name,registered:void 0!==t,question:e[1]})}))},methods:{async registerShape(e){const t=this.dataShapes.find((t=>t.name===e));this.courseConfig.dataShapes.push({name:te.getDataShapeString({dataShape:t.name,course:t.course}),questionTypes:[]});(await this.courseDB.updateCourseConfig(this.courseConfig)).ok&&(t.registered=!0)},async registerQuestionView(e){const t=this.questions.find((t=>t.name===e)),n=te.getQuestionString({course:t.course,questionType:t.name});this.courseConfig.questionTypes.push({name:n,viewList:t.question.views.map((e=>e.name?e.name:"unnamedComponent")),dataShapeList:t.question.dataShapes.map((e=>te.getDataShapeString({course:t.course,dataShape:e.name})))}),t.question.dataShapes.forEach((e=>{const r=te.getDataShapeString({course:t.course,dataShape:e.name});for(const t of this.courseConfig.dataShapes)t.name===r&&t.questionTypes.push(n)}));const r=await this.courseDB.updateCourseConfig(this.courseConfig),i=await W();r.ok&&(t.registered=!0,console.log(`[ComponentRegistration]\nQuestion: ${JSON.stringify(t)}\nCourseID: ${this.course}\n `),t.question.seedData?(console.log("[ComponentRegistration] Question has seed data!"),t.question.seedData.forEach((e=>{this.courseDB.addNote(t.course,t.question.dataShapes[0],e,i.getUsername(),[])}))):console.log("[ComponentRegistration] Question has NO seed data!"))}}}),wb=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},xb={key:1,class:"inset"},kb={key:0},Sb={key:1,class:"inset"};const Cb=/* @__PURE__ */wb(_b,[["render",function(e,t,n,r,i,a){const s=w("v-btn");return p(),f("div",null,[t[2]||(t[2]=m("h3",null,"DataShapes",-1)),m("ul",null,[(p(!0),f(b,null,_(e.dataShapes,(n=>(p(),f("li",{key:n.name,class:"ma-2"},[n.registered?(p(),f("span",xb," (Registered) ")):(p(),E(s,{key:0,size:"small",onClick:t=>e.registerShape(n.name)},{default:T((()=>t[0]||(t[0]=[k(" Register ")]))),_:2},1032,["onClick"])),k(" "+y(n.name)+" ",1),m("ul",null,[(p(!0),f(b,null,_(n.dataShape.views,(e=>(p(),f("div",{key:e.name},[e?(p(),f("li",kb,y(e.name),1)):g("",!0)])))),128))])])))),128))]),t[3]||(t[3]=m("h3",null,"Questions",-1)),m("ul",null,[(p(!0),f(b,null,_(e.questions,(n=>(p(),f("li",{key:n.name,class:"ma-2"},[n.registered?(p(),f("span",Sb," (Registered) ")):(p(),E(s,{key:0,size:"small",onClick:t=>e.registerQuestionView(n.name)},{default:T((()=>t[1]||(t[1]=[k(" Register ")]))),_:2},1032,["onClick"])),k(" "+y(n.name),1)])))),128))])])}],["__scopeId","data-v-c01bca96"]]),Mb=n({name:"NavigationStrategyList",props:{strategies:{type:Array,required:!0},defaultStrategyId:{type:String,default:null}},emits:["edit","delete","update:defaultStrategy"],methods:{getDisplayConfig(e){if(!e.serializedData)return"No configuration";try{const t=JSON.parse(e.serializedData);return Array.isArray(t)?`${t.length} cards in sequence`:Object.keys(t).map((e=>`${e}: ${t[e]}`)).join(", ")}catch{return e.serializedData}}}}),Eb={class:"navigation-strategy-list"},Tb={key:0},Ab={class:"d-flex"};const Pb=/* @__PURE__ */wb(Mb,[["render",function(e,t,n,r,i,a){const s=w("v-radio"),o=w("v-list-item-title"),c=w("v-list-item-subtitle"),l=w("v-icon"),u=w("v-btn"),h=w("v-list-item"),d=w("v-list"),v=w("v-radio-group");return p(),f("div",Eb,[x(v,{"model-value":e.defaultStrategyId,"onUpdate:modelValue":t[0]||(t[0]=t=>e.$emit("update:defaultStrategy",t)),density:"compact"},{default:T((()=>[x(d,{density:"compact"},{default:T((()=>[(p(!0),f(b,null,_(e.strategies,(n=>(p(),E(h,{key:n._id,lines:"two"},{prepend:T((()=>[x(s,{value:n._id},null,8,["value"])])),append:T((()=>[m("div",Ab,[x(u,{icon:"",size:"x-small",variant:"text",title:"Edit Strategy",onClick:t=>e.$emit("edit",n)},{default:T((()=>[x(l,{size:"small"},{default:T((()=>t[1]||(t[1]=[k("mdi-pencil")]))),_:1})])),_:2},1032,["onClick"]),x(u,{icon:"",size:"x-small",variant:"text",title:"Delete Strategy",onClick:t=>e.$emit("delete",n)},{default:T((()=>[x(l,{size:"small"},{default:T((()=>t[2]||(t[2]=[k("mdi-delete")]))),_:1})])),_:2},1032,["onClick"])])])),default:T((()=>[x(o,{class:"text-subtitle-2"},{default:T((()=>[k(y(n.name),1)])),_:2},1024),x(c,{class:"text-caption"},{default:T((()=>[k(y(n.implementingClass)+" ",1),n.description?(p(),f("span",Tb," • "+y(n.description),1)):g("",!0)])),_:2},1024)])),_:2},1024)))),128))])),_:1})])),_:1},8,["model-value"])])}],["__scopeId","data-v-1fcb2a5f"]]),Ib=n({name:"HierarchyConfigForm",props:{modelValue:{type:Object,required:!0},courseId:{type:String,required:!0}},emits:["update:modelValue"],setup(e,{emit:t}){const n=a("ui"),r=a([]),i=a(null),s=a(null),l=a(!0),h=o((()=>e.modelValue)),d=o((()=>{try{return JSON.stringify(h.value,null,2)}catch{return""}}));return c((()=>{!async function(){l.value=!0;try{const t=se().getCourseDB(e.courseId),n=await t.getCourseTagStubs();r.value=n.rows.map((e=>e.id.replace("TAG-",""))),console.log("Loaded tags:",r.value)}catch(t){console.error("Failed to load course tags:",t),i.value="Failed to load course tags"}finally{l.value=!1}}()})),u((()=>h.value),(()=>{!function(){i.value=null;try{if(!h.value.prerequisites||"object"!=typeof h.value.prerequisites)throw new Error("Prerequisites must be an object");new Set(Object.keys(h.value.prerequisites));for(const[e,t]of Object.entries(h.value.prerequisites))for(const n of t)if(n.tag===e)throw new Error(`Circular dependency: ${e} requires itself`);return!0}catch(e){return i.value=e instanceof Error?e.message:"Invalid configuration",!1}}()}),{deep:!0}),{inputMode:n,config:h,availableTags:r,loadingTags:l,jsonText:d,jsonError:s,validationError:i,addPrerequisiteRule:function(){const e=r.value[0]||"new-tag";t("update:modelValue",{...h.value,prerequisites:{...h.value.prerequisites,[e]:[]}})},removePrerequisiteRule:function(e){const n={...h.value.prerequisites};delete n[e],t("update:modelValue",{...h.value,prerequisites:n})},renamePrerequisiteTag:function(e,n){if(e===n)return;const r={...h.value.prerequisites};r[n]=r[e],delete r[e],t("update:modelValue",{...h.value,prerequisites:r})},addPrerequisite:function(e){const n=r.value.find((t=>t!==e))||"prerequisite-tag",i={...h.value.prerequisites};i[e]=[...i[e],{tag:n,masteryThreshold:{minCount:3}}],t("update:modelValue",{...h.value,prerequisites:i})},removePrerequisite:function(e,n){const r={...h.value.prerequisites};r[e]=r[e].filter(((e,t)=>t!==n)),t("update:modelValue",{...h.value,prerequisites:r})},updatePrerequisiteTag:function(e,n,r){const i={...h.value.prerequisites};i[e][n]={...i[e][n],tag:r},t("update:modelValue",{...h.value,prerequisites:i})},updateMinCount:function(e,n,r){const i="string"==typeof r?parseInt(r):r;if(isNaN(i))return;const a={...h.value.prerequisites},s=a[e][n];a[e][n]={...s,masteryThreshold:{...s.masteryThreshold,minCount:i}},t("update:modelValue",{...h.value,prerequisites:a})},updateMinElo:function(e,n,r){if(""===r||null==r){const r={...h.value.prerequisites},i=r[e][n],a={...i.masteryThreshold};return delete a.minElo,r[e][n]={...i,masteryThreshold:a},void t("update:modelValue",{...h.value,prerequisites:r})}const i="string"==typeof r?parseInt(r):r;if(isNaN(i))return;const a={...h.value.prerequisites},s=a[e][n];a[e][n]={...s,masteryThreshold:{...s.masteryThreshold,minElo:i}},t("update:modelValue",{...h.value,prerequisites:a})},updateFromJson:function(e){s.value=null;try{const n=JSON.parse(e);if(!n.prerequisites||"object"!=typeof n.prerequisites)throw new Error('Config must have "prerequisites" object');t("update:modelValue",n)}catch(n){s.value=n instanceof Error?n.message:"Invalid JSON"}}}}}),Nb={class:"hierarchy-config-form"},Db={class:"prerequisites-section"},Ob={class:"d-flex align-center mb-2"},Lb={class:"d-flex align-center mb-2"};const Bb=/* @__PURE__ */wb(Ib,[["render",function(e,t,n,r,i,a){const s=w("v-tab"),o=w("v-tabs"),c=w("v-spacer"),l=w("v-icon"),u=w("v-btn"),h=w("v-alert"),d=w("v-select"),v=w("v-divider"),S=w("v-text-field"),C=w("v-card"),M=w("v-window-item"),A=w("v-textarea"),P=w("v-window");return p(),f("div",Nb,[x(o,{modelValue:e.inputMode,"onUpdate:modelValue":t[0]||(t[0]=t=>e.inputMode=t),density:"compact",class:"mb-4"},{default:T((()=>[x(s,{value:"ui"},{default:T((()=>t[2]||(t[2]=[k("Visual Editor")]))),_:1}),x(s,{value:"json"},{default:T((()=>t[3]||(t[3]=[k("JSON Editor")]))),_:1})])),_:1},8,["modelValue"]),x(P,{modelValue:e.inputMode,"onUpdate:modelValue":t[1]||(t[1]=t=>e.inputMode=t)},{default:T((()=>[x(M,{value:"ui"},{default:T((()=>[m("div",Db,[m("div",Ob,[t[6]||(t[6]=m("h4",{class:"text-subtitle-1"},"Prerequisites",-1)),x(c),x(u,{size:"small",color:"primary",onClick:e.addPrerequisiteRule},{default:T((()=>[x(l,{start:""},{default:T((()=>t[4]||(t[4]=[k("mdi-plus")]))),_:1}),t[5]||(t[5]=k(" Add Rule "))])),_:1},8,["onClick"])]),0===Object.keys(e.config.prerequisites).length?(p(),E(h,{key:0,type:"info",density:"compact"},{default:T((()=>t[7]||(t[7]=[k(' No prerequisites defined. Click "Add Rule" to gate a tag behind prerequisite mastery. ')]))),_:1})):g("",!0),(p(!0),f(b,null,_(e.config.prerequisites,((n,r)=>(p(),E(C,{key:r,variant:"outlined",class:"mb-3 pa-3"},{default:T((()=>[m("div",Lb,[x(d,{"model-value":r,"onUpdate:modelValue":t=>e.renamePrerequisiteTag(r,t),items:e.availableTags,loading:e.loadingTags,disabled:e.loadingTags,label:"Gated Tag",hint:"This tag will be locked until prerequisites are met","persistent-hint":"",density:"compact",style:{"max-width":"300px"}},null,8,["model-value","onUpdate:modelValue","items","loading","disabled"]),x(c),x(u,{icon:"",size:"small",color:"error",onClick:t=>e.removePrerequisiteRule(r)},{default:T((()=>[x(l,null,{default:T((()=>t[8]||(t[8]=[k("mdi-delete")]))),_:1})])),_:2},1032,["onClick"])]),x(v,{class:"my-2"}),t[12]||(t[12]=m("div",{class:"text-caption mb-2"},"Requires mastery of:",-1)),(p(!0),f(b,null,_(n,((n,i)=>(p(),f("div",{key:`${r}-${i}`,class:"d-flex align-center gap-2 mb-2"},[x(d,{"model-value":n.tag,"onUpdate:modelValue":t=>e.updatePrerequisiteTag(r,i,t),items:e.availableTags,loading:e.loadingTags,disabled:e.loadingTags,label:"Prerequisite Tag",density:"compact",style:{flex:"1","max-width":"200px"}},null,8,["model-value","onUpdate:modelValue","items","loading","disabled"]),x(S,{"model-value":n.masteryThreshold?.minCount,"onUpdate:modelValue":t=>e.updateMinCount(r,i,t),label:"Min Count",type:"number",density:"compact",style:{"max-width":"100px"},hint:"Min interactions","persistent-hint":""},null,8,["model-value","onUpdate:modelValue"]),x(S,{"model-value":n.masteryThreshold?.minElo,"onUpdate:modelValue":t=>e.updateMinElo(r,i,t),label:"Min ELO",type:"number",density:"compact",style:{"max-width":"100px"},hint:"Optional","persistent-hint":""},null,8,["model-value","onUpdate:modelValue"]),x(u,{icon:"",size:"small",onClick:t=>e.removePrerequisite(r,i)},{default:T((()=>[x(l,null,{default:T((()=>t[9]||(t[9]=[k("mdi-minus-circle")]))),_:1})])),_:2},1032,["onClick"])])))),128)),x(u,{size:"small",variant:"text",onClick:t=>e.addPrerequisite(r)},{default:T((()=>[x(l,{start:""},{default:T((()=>t[10]||(t[10]=[k("mdi-plus")]))),_:1}),t[11]||(t[11]=k(" Add Prerequisite "))])),_:2},1032,["onClick"])])),_:2},1024)))),128))])])),_:1}),x(M,{value:"json"},{default:T((()=>[x(A,{"model-value":e.jsonText,"onUpdate:modelValue":e.updateFromJson,label:"Configuration JSON",rows:"15",placeholder:'{"prerequisites": {"cvc-words": [{"tag": "letter-sounds", "masteryThreshold": {"minCount": 10}}]}}',hint:"Paste or edit JSON configuration directly","persistent-hint":"","auto-grow":""},null,8,["model-value","onUpdate:modelValue"]),e.jsonError?(p(),E(h,{key:0,type:"error",density:"compact",class:"mt-2"},{default:T((()=>[k(y(e.jsonError),1)])),_:1})):e.jsonText?(p(),E(h,{key:1,type:"success",density:"compact",class:"mt-2"},{default:T((()=>t[13]||(t[13]=[k(" Valid configuration ")]))),_:1})):g("",!0)])),_:1})])),_:1},8,["modelValue"]),e.validationError?(p(),E(h,{key:0,type:"error",density:"compact",class:"mt-3"},{default:T((()=>[k(y(e.validationError),1)])),_:1})):g("",!0)])}],["__scopeId","data-v-470885e1"]]),Rb=n({name:"InterferenceConfigForm",props:{modelValue:{type:Object,required:!0},courseId:{type:String,required:!0}},emits:["update:modelValue"],setup(e,{emit:t}){const n=a("ui"),r=a([]),i=a(null),s=a(null),l=a(!0),h=o((()=>e.modelValue)),d=o((()=>{try{return JSON.stringify(h.value,null,2)}catch{return""}}));return c((()=>{!async function(){l.value=!0;try{const t=se().getCourseDB(e.courseId),n=await t.getCourseTagStubs();r.value=n.rows.map((e=>e.id.replace("TAG-","")))}catch(t){console.error("Failed to load course tags:",t),i.value="Failed to load course tags"}finally{l.value=!1}}()})),u((()=>h.value),(()=>{!function(){i.value=null;try{if(!h.value.interferenceSets||!Array.isArray(h.value.interferenceSets))throw new Error("Interference sets must be an array");for(const e of h.value.interferenceSets){if(!Array.isArray(e.tags)||e.tags.length<2)throw new Error("Each interference group must have at least 2 tags");if(void 0!==e.decay&&(e.decay<0||e.decay>1))throw new Error("Decay values must be between 0 and 1")}return!0}catch(e){return i.value=e instanceof Error?e.message:"Invalid configuration",!1}}()}),{deep:!0}),{inputMode:n,config:h,availableTags:r,loadingTags:l,jsonText:d,jsonError:s,validationError:i,updateMinCount:function(e){const n="string"==typeof e?parseInt(e):e;isNaN(n)||t("update:modelValue",{...h.value,maturityThreshold:{...h.value.maturityThreshold,minCount:n}})},updateMinElo:function(e){if(""===e||null==e){const e={...h.value.maturityThreshold};return delete e.minElo,void t("update:modelValue",{...h.value,maturityThreshold:e})}const n="string"==typeof e?parseInt(e):e;isNaN(n)||t("update:modelValue",{...h.value,maturityThreshold:{...h.value.maturityThreshold,minElo:n}})},updateMinElapsedDays:function(e){const n="string"==typeof e?parseInt(e):e;isNaN(n)||t("update:modelValue",{...h.value,maturityThreshold:{...h.value.maturityThreshold,minElapsedDays:n}})},updateDefaultDecay:function(e){const n="string"==typeof e?parseFloat(e):e;isNaN(n)||t("update:modelValue",{...h.value,defaultDecay:Math.max(0,Math.min(1,n))})},addInterferenceGroup:function(){t("update:modelValue",{...h.value,interferenceSets:[...h.value.interferenceSets,{tags:[],decay:h.value.defaultDecay||.8}]})},removeInterferenceGroup:function(e){t("update:modelValue",{...h.value,interferenceSets:h.value.interferenceSets.filter(((t,n)=>n!==e))})},updateGroupTags:function(e,n){const r=[...h.value.interferenceSets];r[e]={...r[e],tags:n},t("update:modelValue",{...h.value,interferenceSets:r})},updateGroupDecay:function(e,n){const r="string"==typeof n?parseFloat(n):n;if(isNaN(r))return;const i=[...h.value.interferenceSets];i[e]={...i[e],decay:Math.max(0,Math.min(1,r))},t("update:modelValue",{...h.value,interferenceSets:i})},updateFromJson:function(e){s.value=null;try{const n=JSON.parse(e);if(!n.interferenceSets||!Array.isArray(n.interferenceSets))throw new Error('Config must have "interferenceSets" array');t("update:modelValue",n)}catch(n){s.value=n instanceof Error?n.message:"Invalid JSON"}}}}}),Vb={class:"interference-config-form"},Fb={class:"maturity-section mb-4"},zb={class:"mb-4"},jb={class:"interference-groups-section"},qb={class:"d-flex align-center mb-2"},Hb={class:"d-flex align-center mb-2"},Ub={class:"text-subtitle-2"};const Gb=/* @__PURE__ */wb(Rb,[["render",function(e,t,n,r,i,a){const s=w("v-tab"),o=w("v-tabs"),c=w("v-text-field"),l=w("v-slider"),u=w("v-spacer"),h=w("v-icon"),d=w("v-btn"),v=w("v-alert"),S=w("v-select"),C=w("v-card"),M=w("v-window-item"),A=w("v-textarea"),P=w("v-window");return p(),f("div",Vb,[x(o,{modelValue:e.inputMode,"onUpdate:modelValue":t[0]||(t[0]=t=>e.inputMode=t),density:"compact",class:"mb-4"},{default:T((()=>[x(s,{value:"ui"},{default:T((()=>t[2]||(t[2]=[k("Visual Editor")]))),_:1}),x(s,{value:"json"},{default:T((()=>t[3]||(t[3]=[k("JSON Editor")]))),_:1})])),_:1},8,["modelValue"]),x(P,{modelValue:e.inputMode,"onUpdate:modelValue":t[1]||(t[1]=t=>e.inputMode=t)},{default:T((()=>[x(M,{value:"ui"},{default:T((()=>[m("div",Fb,[t[4]||(t[4]=m("h4",{class:"text-subtitle-1 mb-2"},"Maturity Threshold",-1)),t[5]||(t[5]=m("p",{class:"text-caption mb-3"},'Tags below this threshold are considered "immature" (still being learned)',-1)),x(c,{"model-value":e.config.maturityThreshold?.minCount,"onUpdate:modelValue":e.updateMinCount,label:"Min Count",type:"number",hint:"Minimum interactions required (default: 10)","persistent-hint":"",density:"compact",class:"mb-2"},null,8,["model-value","onUpdate:modelValue"]),x(c,{"model-value":e.config.maturityThreshold?.minElo,"onUpdate:modelValue":e.updateMinElo,label:"Min ELO (optional)",type:"number",hint:"Minimum ELO score for maturity","persistent-hint":"",density:"compact",class:"mb-2"},null,8,["model-value","onUpdate:modelValue"]),x(c,{"model-value":e.config.maturityThreshold?.minElapsedDays,"onUpdate:modelValue":e.updateMinElapsedDays,label:"Min Elapsed Days",type:"number",hint:"Minimum time since first interaction (default: 3)","persistent-hint":"",density:"compact"},null,8,["model-value","onUpdate:modelValue"])]),m("div",zb,[x(l,{"model-value":e.config.defaultDecay||.8,"onUpdate:modelValue":e.updateDefaultDecay,label:"Default Decay",min:0,max:1,step:.05,"thumb-label":"",hint:"Default interference strength for groups without explicit decay (0 = no effect, 1 = maximum avoidance)","persistent-hint":""},{append:T((()=>[x(c,{"model-value":e.config.defaultDecay||.8,"onUpdate:modelValue":e.updateDefaultDecay,type:"number",style:{width:"80px"},density:"compact","hide-details":"",min:0,max:1,step:.05},null,8,["model-value","onUpdate:modelValue"])])),_:1},8,["model-value","onUpdate:modelValue"])]),m("div",jb,[m("div",qb,[t[8]||(t[8]=m("h4",{class:"text-subtitle-1"},"Interference Groups",-1)),x(u),x(d,{size:"small",color:"primary",onClick:e.addInterferenceGroup},{default:T((()=>[x(h,{start:""},{default:T((()=>t[6]||(t[6]=[k("mdi-plus")]))),_:1}),t[7]||(t[7]=k(" Add Group "))])),_:1},8,["onClick"])]),0===e.config.interferenceSets.length?(p(),E(v,{key:0,type:"info",density:"compact"},{default:T((()=>t[9]||(t[9]=[k(' No interference groups defined. Click "Add Group" to create a set of tags that interfere with each other. ')]))),_:1})):g("",!0),(p(!0),f(b,null,_(e.config.interferenceSets,((n,r)=>(p(),E(C,{key:r,variant:"outlined",class:"mb-3 pa-3"},{default:T((()=>[m("div",Hb,[m("h5",Ub,"Group "+y(r+1),1),x(u),x(d,{icon:"",size:"small",color:"error",onClick:t=>e.removeInterferenceGroup(r)},{default:T((()=>[x(h,null,{default:T((()=>t[10]||(t[10]=[k("mdi-delete")]))),_:1})])),_:2},1032,["onClick"])]),x(S,{"model-value":n.tags,"onUpdate:modelValue":t=>e.updateGroupTags(r,t),items:e.availableTags,loading:e.loadingTags,disabled:e.loadingTags,label:"Interfering Tags",hint:"Tags that interfere with each other","persistent-hint":"",multiple:"",chips:"","closable-chips":"",density:"compact",class:"mb-3"},null,8,["model-value","onUpdate:modelValue","items","loading","disabled"]),x(l,{"model-value":void 0!==n.decay?n.decay:e.config.defaultDecay||.8,"onUpdate:modelValue":t=>e.updateGroupDecay(r,t),label:"Decay Strength",min:0,max:1,step:.05,"thumb-label":"",hint:"How strongly these tags interfere (higher = stronger avoidance)","persistent-hint":""},{append:T((()=>[x(c,{"model-value":void 0!==n.decay?n.decay:e.config.defaultDecay||.8,"onUpdate:modelValue":t=>e.updateGroupDecay(r,t),type:"number",style:{width:"80px"},density:"compact","hide-details":"",min:0,max:1,step:.05},null,8,["model-value","onUpdate:modelValue"])])),_:2},1032,["model-value","onUpdate:modelValue"])])),_:2},1024)))),128))])])),_:1}),x(M,{value:"json"},{default:T((()=>[x(A,{"model-value":e.jsonText,"onUpdate:modelValue":e.updateFromJson,label:"Configuration JSON",rows:"20",placeholder:'{"interferenceSets": [{"tags": ["letter-b", "letter-d"], "decay": 0.9}], "maturityThreshold": {"minCount": 10}, "defaultDecay": 0.8}',hint:"Paste or edit JSON configuration directly","persistent-hint":"","auto-grow":""},null,8,["model-value","onUpdate:modelValue"]),e.jsonError?(p(),E(v,{key:0,type:"error",density:"compact",class:"mt-2"},{default:T((()=>[k(y(e.jsonError),1)])),_:1})):e.jsonText?(p(),E(v,{key:1,type:"success",density:"compact",class:"mt-2"},{default:T((()=>t[11]||(t[11]=[k(" Valid configuration ")]))),_:1})):g("",!0)])),_:1})])),_:1},8,["modelValue"]),e.validationError?(p(),E(v,{key:0,type:"error",density:"compact",class:"mt-3"},{default:T((()=>[k(y(e.validationError),1)])),_:1})):g("",!0)])}],["__scopeId","data-v-20d01937"]]),Wb=n({name:"RelativePriorityConfigForm",props:{modelValue:{type:Object,required:!0},courseId:{type:String,required:!0}},emits:["update:modelValue"],setup(e,{emit:t}){const n=a("ui"),r=a([]),i=a(null),s=a(null),l=a(!0),h=o((()=>e.modelValue)),d=o((()=>{try{return JSON.stringify(h.value,null,2)}catch{return""}}));return c((()=>{!async function(){l.value=!0;try{const t=se().getCourseDB(e.courseId),n=await t.getCourseTagStubs();r.value=n.rows.map((e=>e.id.replace("TAG-","")))}catch(t){console.error("Failed to load course tags:",t),i.value="Failed to load course tags"}finally{l.value=!1}}()})),u((()=>h.value),(()=>{!function(){i.value=null;try{if(!h.value.tagPriorities||"object"!=typeof h.value.tagPriorities)throw new Error("Tag priorities must be an object");for(const[e,t]of Object.entries(h.value.tagPriorities))if("number"!=typeof t||t<0||t>1)throw new Error(`Priority for ${e} must be between 0 and 1`);return!0}catch(e){return i.value=e instanceof Error?e.message:"Invalid configuration",!1}}()}),{deep:!0}),{inputMode:n,config:h,availableTags:r,loadingTags:l,combineModes:[{title:"Max (highest priority wins)",value:"max"},{title:"Average (average all priorities)",value:"average"},{title:"Min (lowest priority wins)",value:"min"}],jsonText:d,jsonError:s,validationError:i,updateDefaultPriority:function(e){const n="string"==typeof e?parseFloat(e):e;isNaN(n)||t("update:modelValue",{...h.value,defaultPriority:Math.max(0,Math.min(1,n))})},updateCombineMode:function(e){t("update:modelValue",{...h.value,combineMode:e})},updatePriorityInfluence:function(e){const n="string"==typeof e?parseFloat(e):e;isNaN(n)||t("update:modelValue",{...h.value,priorityInfluence:Math.max(0,Math.min(1,n))})},getTagPriority:function(e){return void 0!==h.value.tagPriorities[e]?h.value.tagPriorities[e]:void 0!==h.value.defaultPriority?h.value.defaultPriority:.5},updateTagPriority:function(e,n){const r="string"==typeof n?parseFloat(n):n;isNaN(r)||t("update:modelValue",{...h.value,tagPriorities:{...h.value.tagPriorities,[e]:Math.max(0,Math.min(1,r))}})},updateFromJson:function(e){s.value=null;try{const n=JSON.parse(e);if(!n.tagPriorities||"object"!=typeof n.tagPriorities)throw new Error('Config must have "tagPriorities" object');t("update:modelValue",n)}catch(n){s.value=n instanceof Error?n.message:"Invalid JSON"}}}}}),Yb={class:"relative-priority-config-form"},$b={class:"config-options mb-4"},Kb={class:"tag-priorities-section"},Qb={key:2,class:"tag-priority-list"};const Xb=n({name:"NavigationStrategyEditor",components:{NavigationStrategyList:Pb,HierarchyConfigForm:Bb,InterferenceConfigForm:Gb,RelativePriorityConfigForm:/* @__PURE__ */wb(Wb,[["render",function(e,t,n,r,i,a){const s=w("v-tab"),o=w("v-tabs"),c=w("v-text-field"),l=w("v-slider"),u=w("v-select"),h=w("v-alert"),d=w("v-window-item"),v=w("v-textarea"),S=w("v-window");return p(),f("div",Yb,[x(o,{modelValue:e.inputMode,"onUpdate:modelValue":t[0]||(t[0]=t=>e.inputMode=t),density:"compact",class:"mb-4"},{default:T((()=>[x(s,{value:"ui"},{default:T((()=>t[2]||(t[2]=[k("Visual Editor")]))),_:1}),x(s,{value:"json"},{default:T((()=>t[3]||(t[3]=[k("JSON Editor")]))),_:1})])),_:1},8,["modelValue"]),x(S,{modelValue:e.inputMode,"onUpdate:modelValue":t[1]||(t[1]=t=>e.inputMode=t)},{default:T((()=>[x(d,{value:"ui"},{default:T((()=>[m("div",$b,[t[4]||(t[4]=m("h4",{class:"text-subtitle-1 mb-2"},"Priority Configuration",-1)),x(l,{"model-value":void 0!==e.config.defaultPriority?e.config.defaultPriority:.5,"onUpdate:modelValue":e.updateDefaultPriority,label:"Default Priority",min:0,max:1,step:.05,"thumb-label":"",hint:"Priority for tags not explicitly listed (0.5 = neutral)","persistent-hint":"",class:"mb-3"},{append:T((()=>[x(c,{"model-value":void 0!==e.config.defaultPriority?e.config.defaultPriority:.5,"onUpdate:modelValue":e.updateDefaultPriority,type:"number",style:{width:"80px"},density:"compact","hide-details":"",min:0,max:1,step:.05},null,8,["model-value","onUpdate:modelValue"])])),_:1},8,["model-value","onUpdate:modelValue"]),x(u,{"model-value":e.config.combineMode||"max","onUpdate:modelValue":e.updateCombineMode,label:"Combine Mode",items:e.combineModes,hint:"How to combine priorities when a card has multiple tags","persistent-hint":"",density:"compact",class:"mb-3"},null,8,["model-value","onUpdate:modelValue","items"]),x(l,{"model-value":void 0!==e.config.priorityInfluence?e.config.priorityInfluence:.5,"onUpdate:modelValue":e.updatePriorityInfluence,label:"Priority Influence",min:0,max:1,step:.05,"thumb-label":"",hint:"How strongly priority affects scoring (0 = no effect, 1 = maximum effect)","persistent-hint":""},{append:T((()=>[x(c,{"model-value":void 0!==e.config.priorityInfluence?e.config.priorityInfluence:.5,"onUpdate:modelValue":e.updatePriorityInfluence,type:"number",style:{width:"80px"},density:"compact","hide-details":"",min:0,max:1,step:.05},null,8,["model-value","onUpdate:modelValue"])])),_:1},8,["model-value","onUpdate:modelValue"])]),m("div",Kb,[t[7]||(t[7]=m("h4",{class:"text-subtitle-1 mb-2"},"Tag Priorities",-1)),t[8]||(t[8]=m("p",{class:"text-caption mb-3"},"Set priority for each tag (1.0 = highest priority, 0.0 = lowest)",-1)),e.loadingTags?(p(),E(h,{key:0,type:"info",density:"compact"},{default:T((()=>t[5]||(t[5]=[k(" Loading tags... ")]))),_:1})):0===e.availableTags.length?(p(),E(h,{key:1,type:"warning",density:"compact"},{default:T((()=>t[6]||(t[6]=[k(" No tags available in course ")]))),_:1})):(p(),f("div",Qb,[(p(!0),f(b,null,_(e.availableTags,(t=>(p(),f("div",{key:t,class:"tag-priority-item mb-3"},[x(l,{"model-value":e.getTagPriority(t),"onUpdate:modelValue":n=>e.updateTagPriority(t,n),label:t,min:0,max:1,step:.05,"thumb-label":"",density:"compact"},{append:T((()=>[x(c,{"model-value":e.getTagPriority(t),"onUpdate:modelValue":n=>e.updateTagPriority(t,n),type:"number",style:{width:"80px"},density:"compact","hide-details":"",min:0,max:1,step:.05},null,8,["model-value","onUpdate:modelValue"])])),_:2},1032,["model-value","onUpdate:modelValue","label"])])))),128))]))])])),_:1}),x(d,{value:"json"},{default:T((()=>[x(v,{"model-value":e.jsonText,"onUpdate:modelValue":e.updateFromJson,label:"Configuration JSON",rows:"15",placeholder:'{"tagPriorities": {"letter-s": 0.95, "letter-t": 0.90}, "defaultPriority": 0.5, "combineMode": "max", "priorityInfluence": 0.5}',hint:"Paste or edit JSON configuration directly","persistent-hint":"","auto-grow":""},null,8,["model-value","onUpdate:modelValue"]),e.jsonError?(p(),E(h,{key:0,type:"error",density:"compact",class:"mt-2"},{default:T((()=>[k(y(e.jsonError),1)])),_:1})):e.jsonText?(p(),E(h,{key:1,type:"success",density:"compact",class:"mt-2"},{default:T((()=>t[9]||(t[9]=[k(" Valid configuration ")]))),_:1})):g("",!0)])),_:1})])),_:1},8,["modelValue"]),e.validationError?(p(),E(h,{key:0,type:"error",density:"compact",class:"mt-3"},{default:T((()=>[k(y(e.validationError),1)])),_:1})):g("",!0)])}],["__scopeId","data-v-573b50bd"]])},props:{courseId:{type:String,required:!0}},data:()=>({strategies:[],loading:!0,showDeleteConfirm:!1,strategyToDelete:null,strategyTypes:[{label:"Hierarchy Definition",value:"hierarchy"},{label:"Interference Mitigator",value:"interference"},{label:"Relative Priority",value:"relativePriority"}],newStrategy:{type:"hierarchy",name:"",description:"",config:{cardIds:[]}},editingStrategy:null,defaultStrategyId:null}),async created(){await this.loadStrategies()},watch:{"newStrategy.type"(e){this.newStrategy.config=this.getDefaultConfig(e)}},methods:{getDefaultConfig(e){switch(e){case"hierarchy":return{prerequisites:{}};case"interference":return{interferenceSets:[],maturityThreshold:{minCount:10,minElapsedDays:3},defaultDecay:.8};case"relativePriority":return{tagPriorities:{},defaultPriority:.5,combineMode:"max",priorityInfluence:.5};default:return{}}},getStrategyTypeFromClass(e){switch(e){case ce.HIERARCHY:return"hierarchy";case ce.INTERFERENCE:return"interference";case ce.RELATIVE_PRIORITY:return"relativePriority";default:return"hierarchy"}},parseSerializedData(e,t){try{return JSON.parse(t)}catch(n){return console.error("Failed to parse strategy data:",n),this.getDefaultConfig(e)}},async loadStrategies(){this.loading=!0;try{const e=se().getCourseDB(this.courseId),[t,n]=await Promise.all([e.getAllNavigationStrategies(),e.getCourseConfig()]);this.strategies=t,this.defaultStrategyId=n.defaultNavigationStrategyId||null}catch(e){console.error("Failed to load navigation strategies:",e),this.strategies=[{_id:"NAVIGATION_STRATEGY-ELO",docType:oe.NAVIGATION_STRATEGY,name:"ELO",description:"Default ELO-based navigation strategy",implementingClass:ce.ELO,course:this.courseId,serializedData:"",author:"system"}]}this.loading=!1},async setDefaultStrategy(e){try{this.loading=!0;const t=se().getCourseDB(this.courseId),n=await t.getCourseConfig();n.defaultNavigationStrategyId=e,await t.updateCourseConfig(n),this.defaultStrategyId=e,alert("Default strategy updated!")}catch(t){console.error("Failed to set default strategy:",t),alert("Error updating default strategy. See console for details.")}finally{this.loading=!1}},startNewStrategy(){const e="hierarchy";this.newStrategy={type:e,name:"",description:"",config:this.getDefaultConfig(e)},this.editingStrategy=null},cancelEdit(){this.startNewStrategy()},editStrategy(e){const t=this.getStrategyTypeFromClass(e.implementingClass),n=this.parseSerializedData(t,e.serializedData);this.newStrategy={type:t,name:e.name,description:e.description,config:n},this.editingStrategy=e},async saveStrategy(){if(this.newStrategy.name)if("hardcoded"!==this.newStrategy.type||0!==this.newStrategy.config.cardIds.length){if("hierarchy"===this.newStrategy.type){if(0===Object.keys(this.newStrategy.config.prerequisites||{}).length)return void alert("At least one prerequisite rule is required for hierarchy strategy.")}if("interference"!==this.newStrategy.type||this.newStrategy.config.interferenceSets&&0!==this.newStrategy.config.interferenceSets.length)if("relativePriority"!==this.newStrategy.type||this.newStrategy.config.tagPriorities&&0!==Object.keys(this.newStrategy.config.tagPriorities).length){this.loading=!0;try{const e=se(),t=e.getUserDB().getUsername(),n=e.getCourseDB(this.courseId),r={hierarchy:ce.HIERARCHY,interference:ce.INTERFERENCE,relativePriority:ce.RELATIVE_PRIORITY};let i=JSON.stringify(this.newStrategy.config);if(this.editingStrategy){const e={...this.editingStrategy,name:this.newStrategy.name,description:this.newStrategy.description,implementingClass:r[this.newStrategy.type],serializedData:i};await n.updateNavigationStrategy(this.editingStrategy._id,e)}else{const e={_id:`NAVIGATION_STRATEGY-${Date.now()}`,docType:oe.NAVIGATION_STRATEGY,name:this.newStrategy.name,description:this.newStrategy.description,implementingClass:r[this.newStrategy.type],author:t,course:this.courseId,serializedData:i};await n.addNavigationStrategy(e)}await this.loadStrategies(),this.startNewStrategy()}catch(e){console.error("Failed to save new strategy:",e),alert("Error saving strategy. See console for details.")}this.loading=!1}else alert("At least one tag priority must be set for relative priority strategy.");else alert("At least one interference group is required for interference strategy.")}else alert("At least one card ID is required for hardcoded order strategy.");else alert("Strategy Name is required.")},confirmDeleteStrategy(e){this.strategyToDelete=e,this.showDeleteConfirm=!0},async deleteStrategy(){if(this.strategyToDelete){this.loading=!0;try{const e=se().getCourseDB(this.courseId),t={_id:this.strategyToDelete._id,docType:oe.NAVIGATION_STRATEGY,name:"DELETED",description:"This strategy has been deleted",implementingClass:"",course:this.courseId,serializedData:""};await e.updateNavigationStrategy(this.strategyToDelete._id,t),console.log(`Strategy ${this.strategyToDelete._id} marked as deleted`),this.strategies=this.strategies.filter((e=>e._id!==this.strategyToDelete?._id)),this.showDeleteConfirm=!1,this.strategyToDelete=null}catch(e){console.error("Failed to delete navigation strategy:",e)}this.loading=!1}}}}),Zb={class:"navigation-strategy-editor"},Jb={key:0,class:"text-center pa-4"},e_={key:1,class:"editor-layout"},t_={class:"strategy-list-column"},n_={class:"d-flex align-center mb-2"},r_={class:"strategy-form-column"},i_={class:"form-header d-flex align-center mb-3"},a_={class:"text-h6"},s_={class:"form-actions mt-4"};const o_=/* @__PURE__ */wb(Xb,[["render",function(e,t,n,r,i,a){const s=w("v-progress-circular"),o=w("v-spacer"),c=w("v-icon"),l=w("v-btn"),u=w("v-alert"),h=w("navigation-strategy-list"),d=w("v-select"),v=w("v-text-field"),b=w("hierarchy-config-form"),_=w("interference-config-form"),S=w("relative-priority-config-form"),C=w("v-card-title"),M=w("v-card-text"),A=w("v-card-actions"),P=w("v-card"),I=w("v-dialog");return p(),f("div",Zb,[e.loading?(p(),f("div",Jb,[x(s,{indeterminate:"",color:"secondary"})])):(p(),f("div",e_,[m("div",t_,[m("div",n_,[t[10]||(t[10]=m("h3",{class:"text-h6"},"Strategies",-1)),x(o),x(l,{size:"small",color:"primary",onClick:e.startNewStrategy,density:"compact"},{default:T((()=>[x(c,{start:"",size:"small"},{default:T((()=>t[8]||(t[8]=[k("mdi-plus")]))),_:1}),t[9]||(t[9]=k(" New "))])),_:1},8,["onClick"])]),0===e.strategies.length?(p(),E(u,{key:0,type:"info",density:"compact"},{default:T((()=>t[11]||(t[11]=[k(" No strategies defined ")]))),_:1})):(p(),E(h,{key:1,strategies:e.strategies,"default-strategy-id":e.defaultStrategyId,"onUpdate:defaultStrategy":e.setDefaultStrategy,onEdit:e.editStrategy,onDelete:e.confirmDeleteStrategy},null,8,["strategies","default-strategy-id","onUpdate:defaultStrategy","onEdit","onDelete"]))]),m("div",r_,[m("div",i_,[m("h3",a_,y(e.editingStrategy?"Edit Strategy":"New Strategy"),1),x(o),e.editingStrategy?(p(),E(l,{key:0,size:"small",variant:"text",onClick:e.cancelEdit,density:"compact"},{default:T((()=>t[12]||(t[12]=[k(" Cancel ")]))),_:1},8,["onClick"])):g("",!0)]),x(d,{modelValue:e.newStrategy.type,"onUpdate:modelValue":t[0]||(t[0]=t=>e.newStrategy.type=t),label:"Type",items:e.strategyTypes,"item-title":"label","item-value":"value",density:"compact",class:"mb-3"},null,8,["modelValue","items"]),x(v,{modelValue:e.newStrategy.name,"onUpdate:modelValue":t[1]||(t[1]=t=>e.newStrategy.name=t),label:"Name",density:"compact",class:"mb-3"},null,8,["modelValue"]),x(v,{modelValue:e.newStrategy.description,"onUpdate:modelValue":t[2]||(t[2]=t=>e.newStrategy.description=t),label:"Description",density:"compact",class:"mb-3"},null,8,["modelValue"]),"hierarchy"===e.newStrategy.type?(p(),E(b,{key:0,modelValue:e.newStrategy.config,"onUpdate:modelValue":t[3]||(t[3]=t=>e.newStrategy.config=t),"course-id":e.courseId},null,8,["modelValue","course-id"])):"interference"===e.newStrategy.type?(p(),E(_,{key:1,modelValue:e.newStrategy.config,"onUpdate:modelValue":t[4]||(t[4]=t=>e.newStrategy.config=t),"course-id":e.courseId},null,8,["modelValue","course-id"])):"relativePriority"===e.newStrategy.type?(p(),E(S,{key:2,modelValue:e.newStrategy.config,"onUpdate:modelValue":t[5]||(t[5]=t=>e.newStrategy.config=t),"course-id":e.courseId},null,8,["modelValue","course-id"])):(p(),E(u,{key:3,type:"warning",density:"compact"},{default:T((()=>[k(" Unknown strategy type: "+y(e.newStrategy.type),1)])),_:1})),m("div",s_,[x(l,{color:"primary",onClick:e.saveStrategy,disabled:!e.newStrategy.name,size:"small"},{default:T((()=>[k(y(e.editingStrategy?"Update":"Create"),1)])),_:1},8,["onClick","disabled"]),e.editingStrategy?(p(),E(l,{key:0,variant:"text",onClick:e.cancelEdit,size:"small"},{default:T((()=>t[13]||(t[13]=[k(" Cancel ")]))),_:1},8,["onClick"])):g("",!0)])]),x(I,{modelValue:e.showDeleteConfirm,"onUpdate:modelValue":t[7]||(t[7]=t=>e.showDeleteConfirm=t),"max-width":"400px"},{default:T((()=>[x(P,null,{default:T((()=>[x(C,{class:"text-subtitle-1"},{default:T((()=>t[14]||(t[14]=[k("Delete Strategy")]))),_:1}),x(M,null,{default:T((()=>[k('Delete "'+y(e.strategyToDelete?.name)+'"?',1)])),_:1}),x(A,null,{default:T((()=>[x(o),x(l,{size:"small",onClick:t[6]||(t[6]=t=>e.showDeleteConfirm=!1)},{default:T((()=>t[15]||(t[15]=[k("Cancel")]))),_:1}),x(l,{size:"small",color:"error",onClick:e.deleteStrategy},{default:T((()=>t[16]||(t[16]=[k("Delete")]))),_:1},8,["onClick"])])),_:1})])),_:1})])),_:1},8,["modelValue"])]))])}],["__scopeId","data-v-1cb6c357"]]);function c_(e){return null!==e&&"object"==typeof e&&"clearData"in e&&"validate"in e&&"function"==typeof e.clearData&&"function"==typeof e.validate}const l_={status:Z.ok,msg:""};function u_(e){const t={status:Z.error,msg:"This input must be a number"};return function(e){return!isNaN(e-parseFloat(e))}(e)?l_:t}function h_(e){const t={status:Z.error,msg:"This input must be an integer (..., -2, -1, 0, 1, 2, ...)."};return u_(e).status===Z.error?u_(e):function(e){return/^[+,-]?\s?\d+$/.test(e)}(e)?l_:t}const d_=he("fieldStore",{state:()=>({dataShape:null,inputs:{},mediaInputs:{},inputIsValid:!1,validation:{},convertedInput:{},previewInput:{}}),getters:{isValidated(){return this.inputIsValid},getPreview:e=>e.inputIsValid?e.previewInput:{},getConverted:e=>e.inputIsValid?e.convertedInput:{}},actions:{$reset(){console.log("[FieldInputStore].reset()"),this.inputs={},this.mediaInputs={},this.validation={},this.convertedInput={},this.previewInput={},this.inputIsValid=!1;for(let e=1;e<=10;e++){const t=`audio-${e}`,n=`image-${e}`;delete this.mediaInputs[t],delete this.mediaInputs[n]}},setFieldValue(e,t){this.inputs[e]=t,this.validate(),this.convert()},setMedia(e,t){console.log(`[FieldInputStore].setMedia: ${e}`),this.mediaInputs[e]=t,this.convert()},validate(){if(this.validation={},null!==this.dataShape){this.inputIsValid=!0;for(const e of this.dataShape.fields)if(e.validator){e.validator.test(this.inputs[e.name]).status===Z.ok?this.validation[e.name]=!0:(this.inputIsValid=!1,this.validation[e.name]=!1)}}else this.inputIsValid=!1},convert(){this.convertedInput={},this.dataShape?.fields.forEach((e=>{this.convertedInput[e.name]=ne[e.type].databaseConverter(this.inputs[e.name]),this.previewInput[e.name]=ne[e.type].previewConverter(this.inputs[e.name])}));for(let e=1;e<11;e++){const t=`audio-${e}`,n=this.mediaInputs[t];if(!n)break;this.convertedInput[t]=ne[Q.AUDIO].databaseConverter(n),this.previewInput[t]=ne[Q.AUDIO].previewConverter(n)}for(let e=1;e<11;e++){const t=`image-${e}`,n=this.mediaInputs[t];if(!n)break;this.convertedInput[t]=ne[Q.IMAGE].databaseConverter(n),this.previewInput[t]=ne[Q.IMAGE].previewConverter(n)}},clearMediaEntries(){for(let e=1;e<=10;e++)delete this.mediaInputs[`audio-${e}`],delete this.mediaInputs[`image-${e}`],delete this.convertedInput[`audio-${e}`],delete this.convertedInput[`image-${e}`],delete this.previewInput[`audio-${e}`],delete this.previewInput[`image-${e}`]},clearField(e){delete this.inputs[e],delete this.validation[e],delete this.convertedInput[e],delete this.previewInput[e]}}}),f_=n({name:"FieldInput",props:{autofocus:Boolean,field:{type:Object,required:!0}},setup(e){const t=d_(),n=a(null),r=o({get:()=>t.inputs[e.field.name],set:n=>t.setFieldValue(e.field.name,n)});u(r,((n,r)=>{console.log("[FieldInput] modelValue changed:",{new:n,old:r,currentStoreValue:t.inputs[e.field.name]})}));const i=o((()=>{const t=[];return e.field?.validator&&t.push(e.field.validator.test),t})),s=()=>{if(!e.field?.name)throw new Error("Field name is required for FieldInput component");return t.inputs[e.field.name]};return{inputField:n,fieldStore:t,modelValue:r,validators:i,focus:()=>{n.value&&n.value.focus()},userInput:s,clearData:()=>{if(console.log(`[FieldInput] Running generic clearData() for ${e.field?.name} in FieldInput.ts`),n.value){if(n.value.value="",!e.field?.name)return;t.clearField(e.field.name)}},setData:n=>{if(!e.field?.name)throw new Error("Field name is required for FieldInput component");t.setFieldValue(e.field.name,n)},vuetifyRules:()=>e.field?.validator?i.value.map((e=>re(e))):[],generateTags:()=>(console.log("[FieldInput] Running generic generateTags() in FieldInput.ts"),e.field?.tagger?e.field.tagger(s()):[]),generateELO:()=>(console.log("[FieldInput] Running generic generateELO() in FieldInput.ts"),e.field?.generateELO?e.field.generateELO(s()):void 0)}},data:()=>({validationStatus:{status:Z.ok,msg:""}})});const p_=/* @__PURE__ */wb(n({name:"IntegerInput",extends:f_,setup(e,t){const n=f_.setup?.(e,t);return{...n,validators:o((()=>{const t=f_.validators.call(this);return e.field.validator?.test&&t.push(e.field.validator.test),t?[h_,...t]:[h_]}))}}}),[["render",function(e,t,n,r,i,a){const s=w("v-text-field");return p(),E(s,{ref:"inputField",modelValue:e.modelValue,"onUpdate:modelValue":t[0]||(t[0]=t=>e.modelValue=t),variant:"filled",type:"number",name:e.field.name,label:e.field.name,rules:e.vuetifyRules(),hint:e.validationStatus.msg,autofocus:e.autofocus},null,8,["modelValue","name","label","rules","hint","autofocus"])}]]);const m_=/* @__PURE__ */wb(n({name:"MarkdownInput",extends:f_,setup(e,t){const n=f_.setup?.(e,t);return{...n}}}),[["render",function(e,t,n,r,i,a){const s=w("v-textarea");return p(),E(s,{ref:"inputField",modelValue:e.modelValue,"onUpdate:modelValue":t[0]||(t[0]=t=>e.modelValue=t),variant:"filled",name:e.field.name,label:e.field.name,rules:e.vuetifyRules(),hint:e.validationStatus.msg,autofocus:e.autofocus},null,8,["modelValue","name","label","rules","hint","autofocus"])}],["__scopeId","data-v-28ef24ff"]]),g_=n({name:"MediaDragDropUploader",extends:f_,setup(e,t){const n=f_.setup?.(e,t),{fieldStore:r}=n;return{...n,fieldStore:r}},data:()=>({isDragging:!1,mediaItems:[]}),computed:{hasMedia(){return this.mediaItems.length>0}},created(){},methods:{dragOverHandler(e){e.preventDefault()},dragEnterHandler(e){e.preventDefault(),this.isDragging=!0},dragLeaveHandler(e){e.preventDefault(),this.isDragging=!1},dropHandler(e){e.preventDefault(),this.isDragging=!1;const t=e.dataTransfer?.files;t&&this.processFiles(t)},triggerFileInput(){this.$refs.fileInput.click()},handleFileInput(e){const t=e.target.files;t&&this.processFiles(t)},processFiles(e){Array.from(e).forEach((e=>{this.addMediaItem(e)})),this.updateStore()},addMediaItem(e){const t=e.type.startsWith("image/")?"image":"audio",n={type:t,file:e,url:URL.createObjectURL(e)};"image"===t&&this.createThumbnail(e).then((e=>{n.thumbnailUrl=e,this.$nextTick((()=>{this.$forceUpdate()}))})),this.mediaItems.push(n)},createThumbnail:async e=>new Promise((t=>{const n=new FileReader;n.onload=e=>{t(e.target?.result)},n.readAsDataURL(e)})),removeMedia(e){URL.revokeObjectURL(this.mediaItems[e].url),this.mediaItems.splice(e,1),this.updateStore()},clearData(){this.mediaItems.forEach((e=>{URL.revokeObjectURL(e.url)})),this.mediaItems=[],this.updateStore()},addMoreMedia(){console.log("addMoreMedia"),this.triggerFileInput()},updateStore(){let e=0,t=0;this.mediaItems.forEach((n=>{"image"===n.type?(e++,this.fieldStore.setMedia(`image-${e}`,{content_type:n.file.type,data:n.file})):"audio"===n.type&&(t++,this.fieldStore.setMedia(`audio-${t}`,{content_type:n.file.type,data:n.file}))}))},getValidators(){return[()=>({status:this.mediaItems.length>0?Z.ok:Z.error,msg:this.mediaItems.length>0?"":"At least one media item is required"})]}}}),v_={class:"mr-2 mb-2"},y_=["src"],b_=["src"];const __=/* @__PURE__ */wb(g_,[["render",function(e,t,n,r,i,a){const s=w("v-label"),o=w("v-btn");return p(),f("div",v_,[x(s,{class:"text-h5"},{default:T((()=>t[5]||(t[5]=[k("Add media:")]))),_:1}),m("div",{class:C(["drop-zone",{"drop-zone--over":e.isDragging}]),onDrop:t[1]||(t[1]=(...t)=>e.dropHandler&&e.dropHandler(...t)),onDragover:t[2]||(t[2]=I(((...t)=>e.dragOverHandler&&e.dragOverHandler(...t)),["prevent"])),onDragenter:t[3]||(t[3]=I(((...t)=>e.dragEnterHandler&&e.dragEnterHandler(...t)),["prevent"])),onDragleave:t[4]||(t[4]=I(((...t)=>e.dragLeaveHandler&&e.dragLeaveHandler(...t)),["prevent"]))},[m("input",{ref:"fileInput",type:"file",accept:"image/*,audio/*",multiple:"",style:{display:"none"},onChange:t[0]||(t[0]=(...t)=>e.handleFileInput&&e.handleFileInput(...t))},null,544),(p(!0),f(b,null,_(e.mediaItems,((n,r)=>(p(),f("div",{key:r,class:"media-item"},["image"===n.type?(p(),f("img",{key:0,src:n.thumbnailUrl,alt:"Uploaded image thumbnail",class:"thumbnail"},null,8,y_)):"audio"===n.type?(p(),f("audio",{key:1,controls:"",src:n.url},null,8,b_)):g("",!0),x(o,{size:"small",onClick:t=>e.removeMedia(r)},{default:T((()=>t[6]||(t[6]=[k("Remove")]))),_:2},1032,["onClick"])])))),128)),t[8]||(t[8]=k(" Drop image or audio files here... ")),x(o,{onClick:e.triggerFileInput},{default:T((()=>t[7]||(t[7]=[k("Or Click to Upload")]))),_:1},8,["onClick"])],34)])}],["__scopeId","data-v-e86645b6"]]),w_=n({name:"MidiInput",components:{SyllableSeqVis:Wu},extends:f_,data:()=>({midi:null,recording:!1,SylSeq:zu([]),display:!1,transpositions:!1}),async created(){try{this.midi=await qu.instance(),this.record(),this.store[this.field.name]=this.getTransposedSeqs}catch(tl){throw new Error(`MidiInput.created: ${tl}`)}},methods:{record(){this.midi&&(this.midi.record(),this.midi.addNoteonListenter((e=>{this.SylSeq.append(e),this.$refs.inputVis.updateBounds()})),this.recording=!0)},getTransposedSeqs(){return this.midi?this.transpositions?[-5,-4,-3,-2,-1,0,1,2,3,4,5,6].map((e=>function(e,t){return e.map((e=>function(e,t){const n={...e},r=Ru.transpose(e.note.name+e.note.octave,du(t));return n.note={name:Ru.pitchClass(r),number:e.note.number+t,octave:Ru.octave(r)},n}(e,t)))}(this.midi.recording,e))):[this.midi.recording]:[]},clearData(){this.midi&&(console.log("midiInput clearing data..."),this.midi.stopRecording(),this.midi.eraseRecording(),this.SylSeq=zu([]),this.record(),this.recording=!0,this.store.convertedInput[this.field.name]=this.midi.recording,this.store.validation[this.field.name]=!1,this.store[this.field.name]=this.getTransposedSeqs)},hasRecording(){return this.midi?.hasRecording??!1},reset(){this.clearData()},play(){this.midi&&(this.midi.play(),this.display=!0,this.validate())}}}),x_={key:0},k_={class:"text-h5"},S_={class:"font-weight-black"};const C_=/* @__PURE__ */wb(w_,[["render",function(e,t,n,r,i,a){const s=w("syllable-seq-vis"),o=w("v-icon"),c=w("v-btn"),l=w("v-checkbox");return p(),f("div",null,[e.recording?(p(),f("div",x_,[m("span",k_,[t[1]||(t[1]=k(" Now Recording from device: ")),m("span",S_,y(e.midi.configuredInput),1)])])):g("",!0),(p(),E(s,{key:1,ref:"inputVis",seq:e.SylSeq,"last-t-ssuggestion":"5000"},null,8,["seq"])),x(c,{color:"primary",disabled:e.hasRecording(),onClick:e.play},{default:T((()=>[t[3]||(t[3]=k(" Preview ")),x(o,{end:""},{default:T((()=>t[2]||(t[2]=[k("volume_up")]))),_:1})])),_:1},8,["disabled","onClick"]),x(c,{color:"error",disabled:e.hasRecording(),onClick:e.reset},{default:T((()=>[t[5]||(t[5]=k(" Clear and try again ")),x(o,{end:""},{default:T((()=>t[4]||(t[4]=[k("close")]))),_:1})])),_:1},8,["disabled","onClick"]),x(l,{modelValue:e.transpositions,"onUpdate:modelValue":t[0]||(t[0]=t=>e.transpositions=t),label:"Include Transpositions",onClickCapture:e.reset},null,8,["modelValue","onClickCapture"])])}]]);const M_=/* @__PURE__ */wb(n({name:"NumberInput",extends:f_,setup(e,t){const n=f_.setup?.(e,t);return{...n,validators:o((()=>{const t=f_.validators.call(this);return e.field.validator?.test&&t.push(e.field.validator.test),t?[u_,...t]:[u_]}))}}}),[["render",function(e,t,n,r,i,a){const s=w("v-text-field");return p(),E(s,{ref:"inputField",modelValue:e.modelValue,"onUpdate:modelValue":t[0]||(t[0]=t=>e.modelValue=t),variant:"filled",type:"number",name:e.field.name,label:e.field.name,rules:e.vuetifyRules(),hint:e.validationStatus.msg,autofocus:e.autofocus},null,8,["modelValue","name","label","rules","hint","autofocus"])}]]);const E_=/* @__PURE__ */wb(n({name:"StringInput",extends:f_,setup(e,t){const n=f_.setup?.(e,t);return{...n,validators:o((()=>{const t=f_.validators.call(this);return e.field.validator?.test&&t.push(e.field.validator.test),t||[]}))}}}),[["render",function(e,t,n,r,i,a){const s=w("v-text-field");return p(),E(s,{ref:"inputField",modelValue:e.modelValue,"onUpdate:modelValue":t[0]||(t[0]=t=>e.modelValue=t),variant:"filled",type:"text",name:e.field.name,label:e.field.name,rules:e.vuetifyRules(),hint:e.validationStatus.msg,autofocus:e.autofocus},null,8,["modelValue","name","label","rules","hint","autofocus"])}]]);const T_=/* @__PURE__ */wb(n({name:"ChessPuzzleInput",extends:f_,setup(e,t){const n=f_.setup?.(e,t),r=()=>{if(!n)return[];console.log(`CPI.generateTags: modelValue: ${n.modelValue.value}`);const e=n.modelValue.value.split(","),t=e[7].split(" "),r=e[9].split(" ");return t.map((e=>`theme-${e}`)).concat(r.map((e=>`opening-${e}`)))};return{...n,generateELO:()=>{if(!n)return;const e=n.modelValue.value.split(","),t=parseInt(e[3]),i=parseInt(e[6]),a={global:{score:t,count:i},tags:{},misc:{}};return r().forEach((e=>{a.tags[e]={score:t,count:i}})),console.log("generateELO",JSON.stringify(a)),a},generateTags:r}}}),[["render",function(e,t,n,r,i,a){const s=w("v-text-field");return p(),E(s,{ref:"inputField",modelValue:e.modelValue,"onUpdate:modelValue":t[0]||(t[0]=t=>e.modelValue=t),variant:"filled",name:e.field.name,label:e.field.name,rules:e.vuetifyRules(),autofocus:e.autofocus},null,8,["modelValue","name","label","rules","autofocus"])}]]),A_=he("dataInputForm",{state:()=>({dataInputForm:{dataShape:null,course:null,shapeViews:[],fields:[],fieldStore:d_(),uploading:!1}}),actions:{setDataShape(e){this.dataInputForm.dataShape=e,this.dataInputForm.fieldStore.dataShape=e,this.dataInputForm.fieldStore.$reset()},setCourse(e){this.dataInputForm.course=e}}}),P_=n({name:"DataInputForm",components:{NumberInput:M_,StringInput:E_,IntegerInput:p_,MarkdownInput:m_,MidiInput:C_,CardBrowser:$,MediaDragDropUploader:__,TagsInput:Y,ChessPuzzleInput:T_},props:{courseCfg:{type:Object,required:!0,default:()=>({courseID:"default-test"})},dataShape:{type:Object,required:!0},previewComponent:{type:Object,required:!1,default:null},courseWare:{type:Object,default:()=>hb}},data:()=>({tag:"",tags:[],autoCompleteSuggestions:[],timer:void 0,dataInputFormStore:A_(),fieldInputRefs:[],courseDB:null}),computed:{ftString:()=>Q.STRING,int:()=>Q.INT,num:()=>Q.NUMBER,img:()=>Q.IMAGE,mkd:()=>Q.MARKDOWN,audio:()=>Q.AUDIO,midi:()=>Q.MIDI,uploader:()=>Q.MEDIA_UPLOADS,chessPuzzle:()=>Q.CHESS_PUZZLE,fieldInputs(){return Array.from(this.fieldInputRefs.values())},shapeViews:{get(){return this.dataInputFormStore.dataInputForm.shapeViews},set(e){this.dataInputFormStore.dataInputForm.shapeViews=e}},allowSubmit(){return this.dataInputFormStore.dataInputForm.fieldStore.isValidated},fieldStore(){return this.dataInputFormStore.dataInputForm.fieldStore},uploading:{get(){return this.dataInputFormStore.dataInputForm.uploading},set(e){this.dataInputFormStore.dataInputForm.uploading=e}},previewInput(){return this.fieldStore.getPreview},convertedInput(){return this.fieldStore.convertedInput},inputIsValidated(){return this.dataInputFormStore.dataInputForm.fieldStore.isValidated},datashapeDescriptor(){if(!this.courseCfg||!this.courseCfg.dataShapes)return{course:"",dataShape:""};for(const e of this.courseCfg.dataShapes){const t=te.getDataShapeDescriptor(e.name);if(t.dataShape===this.dataShape.name)return t}return{course:"",dataShape:""}}},watch:{dataShape:{handler(){this.previewComponent||this.getImplementingViews()},immediate:!0},store:{handler(){this.convertInput()}},"dataShape.fields"(e){console.log(`[DataInputForm].watch(fields): newFields ${JSON.stringify(e)}`),console.log(`[DataInputForm].watch(fields): fields ${JSON.stringify(this.dataShape.fields)}`),this.fieldInputRefs=new Array(e.length).fill(null),console.log(`[DataInputForm].watch(fields): fieldRefs ${JSON.stringify(this.fieldInputRefs)}`)}},created(){this.uploading=!1,this.courseDB=se().getCourseDB(this.courseCfg.courseID),this.getCourseTags(),this.dataInputFormStore.setDataShape(this.dataShape),console.log(`[DataInputForm].created: fields: ${JSON.stringify(this.dataShape.fields)}`),this.fieldInputRefs=new Array(this.dataShape.fields.length).fill(null),this.previewComponent&&this.getImplementingViews()},beforeUnmount(){this.fieldInputRefs=[]},methods:{async updateTags(e){console.log(`[DataInputForm] tags updated: ${JSON.stringify(e)}`),this.tags=e},setFieldInputRef(e,t){for(console.log(`[DataInputForm].setFieldInputRef: index: ${t}`),t>=this.fieldInputRefs.length&&(this.fieldInputRefs=this.fieldInputRefs.concat(new Array(t-this.fieldInputRefs.length+1).fill(null)));null===this.fieldInputRefs[this.fieldInputRefs.length-1];)this.fieldInputRefs.pop();this.fieldInputRefs[t]=e},async getCourseTags(){const e=await this.courseDB.getCourseTagStubs();this.autoCompleteSuggestions=e.rows.map((e=>e.doc.name))},expectedValidations(){return this.dataShape.fields.length},checkInput:()=>!0,convertInput(){},inputContainsTranspositionFcns(){this.convertInput();for(const e in this.convertedInput)if("function"==typeof this.convertedInput[e])return!0;return!1},objectContainsFunction(e){for(const t in e)if("function"==typeof e[t])return!0;return!1},expandO(e){let t=[];if(this.objectContainsFunction(e)){for(const n in e)if("function"==typeof e[n]){console.log(`[DataInputForm] Key ${n} is a function.`);const r=[];e[n]().forEach((t=>{let i={};i=bb.cloneDeep(e),i[n]=t,console.log(`[DataInputForm] Replaced Copy: ${JSON.stringify(i)}`),r.push(i)})),r.forEach((e=>{if(this.objectContainsFunction(e)){console.log("[DataInputForm] 2nd pass...");const n=this.expandO(e);t=t.concat(n)}else t.push(e)}))}return t}return[]},getTags(){const e=[];this.fieldInputs.forEach((t=>{if(t.generateTags){const n=t.generateTags();e.push(...n)}}));const t=this.$refs.tagsInput.tags.map((e=>e.text));return e.concat(t)},getElo(){for(const e of this.fieldInputs)if(e.generateELO)return e.generateELO()},async submit(){if(this.checkInput()){console.log(`[DataInputForm] Store: ${JSON.stringify(this.fieldStore.inputs)}`),console.log(`[DataInputForm] ConvertedStore: ${JSON.stringify(this.convertedInput)}`),this.uploading=!0;let e=[];this.inputContainsTranspositionFcns()?(console.log(`[DataInputForm] Expanded input: ${JSON.stringify(this.expandO(this.convertedInput))}`),e=this.expandO(this.convertedInput)):(console.log("[DataInputForm] No Transposition fcn detected"),e=[this.convertedInput]);const t=await Promise.all(e.map((async e=>await this.courseDB.addNote(this.datashapeDescriptor.course,this.dataShape,e,(await W()).getUsername(),this.getTags(),void 0,this.getElo()))));if(t[0].status===Z.ok){H({text:"Content added... Thank you!",status:Z.ok});const e=this.$refs.tagsInput;e.tags.length&&(e.updateAvailableCourseTags(),e.tags=[]),this.reset()}else H({text:"A problem occurred. Content has not been added.",status:Z.error}),console.error(`Error in DataInputForm.submit(). Result from addNote: ${JSON.stringify(t)}`),this.uploading=!1}},reset(){console.log("[DataInputForm].reset()"),this.uploading=!1,this.fieldInputs.forEach((e=>{e.clearData()})),this.fieldStore.$reset(),this.fieldInputs[0].focus(),this.convertInput()},getImplementingViews(){if(this.previewComponent)return console.log("[DataInputForm] Getting previewComponent views"),void(this.shapeViews=this.previewComponent.views);for(const e of this.courseCfg.dataShapes){const t=te.getDataShapeDescriptor(e.name);if(console.log("[DataInputForm] descriptor",t),console.log("[DataInputForm] this.dataShape",this.dataShape),console.log("[DataInputForm] this.dataShape.name",this.dataShape.name),t.dataShape===this.dataShape.name){const n=this.courseWare.getCourseWare(t.course);this.shapeViews=[],n.getBaseQTypes().forEach((e=>{e.dataShapes[0].name===this.dataShape.name&&(this.shapeViews=this.shapeViews.concat(e.views))}));for(const t of e.questionTypes){const e=te.getQuestionDescriptor(t);n.getQuestion(e.questionType).views.forEach((e=>{this.shapeViews=this.shapeViews.concat(e)}))}}}},isFieldInput:e=>c_(e)}}),I_={key:1};const N_=/* @__PURE__ */wb(P_,[["render",function(e,t,n,r,i,a){const s=w("string-input"),o=w("chess-puzzle-input"),c=w("number-input"),l=w("integer-input"),u=w("markdown-input"),h=w("midi-input"),d=w("media-drag-drop-uploader"),m=w("tags-input"),v=w("v-icon"),S=w("v-btn"),C=w("v-form"),M=w("v-col"),A=w("card-browser"),P=w("v-row"),N=w("v-container");return p(),E(N,{fluid:""},{default:T((()=>[x(P,null,{default:T((()=>[x(M,{cols:"12",xl:"6"},{default:T((()=>[x(C,{"ma-2":"",autocomplete:"off"},{default:T((()=>[(p(!0),f(b,null,_(e.dataShape.fields,((t,n)=>(p(),f("div",{key:e.dataShape.fields.indexOf(t)},[t.type===e.ftString?(p(),E(s,{key:0,ref_for:!0,ref:t=>e.setFieldInputRef(t,n),field:t,autofocus:0==n},null,8,["field","autofocus"])):t.type===e.chessPuzzle?(p(),E(o,{key:1,ref_for:!0,ref:t=>e.setFieldInputRef(t,n),field:t,autofocus:0==n},null,8,["field","autofocus"])):t.type===e.num?(p(),E(c,{key:2,ref_for:!0,ref:t=>e.setFieldInputRef(t,n),field:t,autofocus:0==n},null,8,["field","autofocus"])):t.type===e.int?(p(),E(l,{key:3,ref_for:!0,ref:t=>e.setFieldInputRef(t,n),field:t,autofocus:0==n},null,8,["field","autofocus"])):t.type===e.mkd?(p(),E(u,{key:4,ref_for:!0,ref:t=>e.setFieldInputRef(t,n),field:t,autofocus:0==n,"data-cy":"markdown-input"},null,8,["field","autofocus"])):t.type===e.midi?(p(),E(h,{key:5,ref_for:!0,ref:t=>e.setFieldInputRef(t,n),field:t,autofocus:0==n},null,8,["field","autofocus"])):t.type===e.uploader?(p(),E(d,{key:6,ref_for:!0,ref:t=>e.setFieldInputRef(t,n),field:t,autofocus:0==n},null,8,["field","autofocus"])):g("",!0)])))),128)),x(m,{ref:"tagsInput","hide-submit":!0,"course-i-d":e.courseCfg.courseID,"card-i-d":""},null,8,["course-i-d"]),e.previewComponent?(p(),f("div",I_,"Input validated: "+y(e.inputIsValidated),1)):(p(),E(S,{key:0,"data-cy":"add-card-btn",class:"float-right",type:"submit",color:"primary",loading:e.uploading,disabled:!e.allowSubmit,onClick:I(e.submit,["prevent"])},{default:T((()=>[t[1]||(t[1]=k(" Add card ")),x(v,{end:""},{default:T((()=>t[0]||(t[0]=[k("mdi-plus-circle")]))),_:1})])),_:1},8,["loading","disabled","onClick"]))])),_:1})])),_:1}),x(M,{cols:"12",xl:"6"},{default:T((()=>[e.inputIsValidated?(p(),E(A,{key:0,class:"ml-4",views:e.shapeViews,data:[e.previewInput]},null,8,["views","data"])):g("",!0)])),_:1})])),_:1})])),_:1})}]]),D_=n({name:"CardPreviewList",components:{CardBrowser:$,SkMouseTrap:K},props:{parsedCards:{type:Array,required:!0,default:()=>[]},dataShape:{type:Object,required:!0},viewComponents:{type:Array,required:!1,default:()=>[]}},emits:["update:parsedCards","edit-card","delete-card"],data:()=>({currentIndex:0,loading:!1,keyBindings:[],showDeleteConfirm:!1,dontAskAgain:!1,skipDeleteConfirmation:!1,shortcutsEnabled:!0}),computed:{currentCard(){return 0===this.parsedCards.length||this.currentIndex>=this.parsedCards.length?null:this.parsedCards[this.currentIndex]},currentViewData(){return this.currentCard?{Input:this.currentCard.markdown}:{Input:""}}},mounted(){this.setupKeyBindings()},beforeUnmount(){this.shortcutsEnabled&&this.keyBindings.forEach((e=>{U.removeBinding(e.hotkey)}))},methods:{nextCard(){this.currentIndex<this.parsedCards.length-1&&this.currentIndex++},prevCard(){this.currentIndex>0&&this.currentIndex--},showCard(e){e>=0&&e<this.parsedCards.length&&(this.currentIndex=e)},setupKeyBindings(){this.keyBindings=[{command:"Previous Card",hotkey:"left",callback:()=>(this.prevCard(),!1)},{command:"Next Card",hotkey:"right",callback:()=>(this.nextCard(),!1)},{command:"Delete Card",hotkey:"del",callback:()=>(this.promptDelete(),!1)},{command:"Edit Card",hotkey:"e",callback:()=>(this.editCurrentCard(),!1)}],this.shortcutsEnabled&&U.addBinding(this.keyBindings)},enableShortcuts(){this.shortcutsEnabled||(this.shortcutsEnabled=!0,U.addBinding(this.keyBindings),console.log("[CardPreviewList] Keyboard shortcuts enabled"))},disableShortcuts(){this.shortcutsEnabled&&(this.shortcutsEnabled=!1,this.keyBindings.forEach((e=>{U.removeBinding(e.hotkey)})),console.log("[CardPreviewList] Keyboard shortcuts disabled"))},toggleShortcuts(e){e?this.enableShortcuts():this.disableShortcuts()},promptDelete(){this.currentCard&&(this.skipDeleteConfirmation?this.deleteCurrentCard():this.showDeleteConfirm=!0)},cancelDelete(){this.showDeleteConfirm=!1},confirmDelete(){this.dontAskAgain&&(this.skipDeleteConfirmation=!0),this.showDeleteConfirm=!1,this.deleteCurrentCard()},deleteCurrentCard(){if(!this.currentCard)return;const e=[...this.parsedCards];e.splice(this.currentIndex,1),this.$emit("update:parsedCards",e),this.$emit("delete-card",this.currentIndex),this.currentIndex>=e.length&&e.length>0&&(this.currentIndex=e.length-1)},editCurrentCard(){this.currentCard&&this.$emit("edit-card",this.currentCard,this.currentIndex)}}}),O_={class:"card-preview-list"},L_={class:"d-flex align-center"},B_={class:"text-subtitle-1 mr-2"},R_={key:0,class:"d-flex justify-center align-center my-4"},V_={key:1},F_={key:0},z_={key:0},j_={key:1},q_={class:"markdown-content"},H_={class:"card-metadata mt-2"},U_={class:"d-flex flex-wrap gap-1"},G_={key:0,class:"mt-2 text-caption"},W_={key:1,class:"text-center pa-4"};const Y_=n({name:"BulkImportView",components:{CardPreviewList:/* @__PURE__ */wb(D_,[["render",function(e,t,n,r,i,a){const s=w("v-card-title"),o=w("v-checkbox"),c=w("v-card-text"),l=w("v-spacer"),u=w("v-btn"),h=w("v-card-actions"),d=w("v-card"),v=w("v-dialog"),S=w("sk-mouse-trap"),C=w("v-progress-circular"),M=w("card-browser"),A=w("v-sheet"),P=w("v-chip"),I=w("v-icon");return p(),f("div",O_,[x(v,{modelValue:e.showDeleteConfirm,"onUpdate:modelValue":t[1]||(t[1]=t=>e.showDeleteConfirm=t),"max-width":"400px"},{default:T((()=>[x(d,null,{default:T((()=>[x(s,{class:"text-h5"},{default:T((()=>t[2]||(t[2]=[k("Remove Card")]))),_:1}),x(c,null,{default:T((()=>[t[3]||(t[3]=m("p",null,"Are you sure you want to remove this card?",-1)),x(o,{modelValue:e.dontAskAgain,"onUpdate:modelValue":t[0]||(t[0]=t=>e.dontAskAgain=t),label:"Don't ask me again","hide-details":"",class:"mt-2"},null,8,["modelValue"])])),_:1}),x(h,null,{default:T((()=>[x(l),x(u,{color:"grey-darken-1",variant:"text",onClick:e.cancelDelete},{default:T((()=>t[4]||(t[4]=[k("Cancel")]))),_:1},8,["onClick"]),x(u,{color:"error",onClick:e.confirmDelete},{default:T((()=>t[5]||(t[5]=[k("Remove")]))),_:1},8,["onClick"])])),_:1})])),_:1})])),_:1},8,["modelValue"]),e.parsedCards.length>0?(p(),E(d,{key:0,class:"mb-4"},{default:T((()=>[x(s,{class:"d-flex align-center justify-space-between"},{default:T((()=>[t[6]||(t[6]=m("span",null,"Card Preview",-1)),m("div",L_,[m("div",B_,y(e.currentIndex+1)+" of "+y(e.parsedCards.length),1),x(S)])])),_:1}),x(c,null,{default:T((()=>[e.loading?(p(),f("div",R_,[x(C,{indeterminate:"",color:"primary"})])):(p(),f("div",V_,[e.currentCard?(p(),f("div",F_,[x(A,{class:"card-content pa-4 mb-4",rounded:"",border:""},{default:T((()=>[e.viewComponents&&e.viewComponents.length>0?(p(),f("div",z_,[x(M,{views:e.viewComponents,data:[e.currentViewData],"suppress-spinner":!0},null,8,["views","data"])])):(p(),f("div",j_,[t[7]||(t[7]=m("div",{class:"mb-2 font-weight-bold"},"Card content:",-1)),m("div",q_,y(e.currentCard.markdown),1)]))])),_:1}),m("div",H_,[m("div",U_,[(p(!0),f(b,null,_(e.currentCard.tags,(e=>(p(),E(P,{key:e,size:"small",color:"primary",variant:"outlined",class:"mr-1 mb-1"},{default:T((()=>[k(y(e),1)])),_:2},1024)))),128))]),void 0!==e.currentCard.elo?(p(),f("div",G_,"ELO: "+y(e.currentCard.elo),1)):g("",!0)])])):(p(),f("div",W_,"No card selected or available to preview."))]))])),_:1}),x(h,{class:"px-4 pb-4"},{default:T((()=>[x(u,{variant:"outlined",icon:"",disabled:0===e.currentIndex||e.loading,onClick:e.prevCard},{default:T((()=>[x(I,null,{default:T((()=>t[8]||(t[8]=[k("mdi-chevron-left")]))),_:1})])),_:1},8,["disabled","onClick"]),x(l),x(u,{variant:"tonal",color:"error","prepend-icon":"mdi-delete",class:"mx-2",disabled:!e.currentCard||e.loading,onClick:e.promptDelete},{default:T((()=>t[9]||(t[9]=[k(" Remove ")]))),_:1},8,["disabled","onClick"]),x(u,{variant:"tonal",color:"primary","prepend-icon":"mdi-pencil",class:"mx-2",disabled:!e.currentCard||e.loading,onClick:e.editCurrentCard},{default:T((()=>t[10]||(t[10]=[k(" Edit ")]))),_:1},8,["disabled","onClick"]),x(l),x(u,{variant:"outlined",icon:"",disabled:e.currentIndex>=e.parsedCards.length-1||e.loading,onClick:e.nextCard},{default:T((()=>[x(I,null,{default:T((()=>t[11]||(t[11]=[k("mdi-chevron-right")]))),_:1})])),_:1},8,["disabled","onClick"])])),_:1})])),_:1})):g("",!0)])}],["__scopeId","data-v-41613480"]])},props:{courseCfg:{type:Object,required:!0}},data:()=>({bulkText:"",parsedCards:[],parsingComplete:!1,importAttempted:!1,results:[],processing:!1,courseDB:null,dataShape:de[0],cardViewComponents:[],editingCard:null,editingCardIndex:-1,showEditDialog:!1,editedMarkdown:"",editedTags:[],editedElo:void 0,newTagText:""}),computed:{uniqueTags(){if(!this.parsedCards||0===this.parsedCards.length)return[];const e=this.parsedCards.reduce(((e,t)=>(t.tags&&t.tags.length>0&&e.push(...t.tags),e)),[]);return[...new Set(e)].sort()}},created(){this.courseCfg?.courseID?(this.courseDB=se().getCourseDB(this.courseCfg.courseID),this.courseCfg.dataShapes&&0!==this.courseCfg.dataShapes.length?this.initializeCardPreviewComponents():(console.error("[BulkImportView] Course config does not contain any dataShapes."),H({text:"Course configuration has no dataShapes. Bulk import may not work correctly.",status:Z.warning}))):(console.error("[BulkImportView] Course config or Course ID is missing."),H({text:"Course configuration is missing. Cannot initialize bulk import.",status:Z.error}))},methods:{handleDeleteCard(e){console.log(`[BulkImportView] Card at index ${e} was deleted`),H({text:"Card removed from import list",status:Z.ok})},handleEditCard(e,t){this.$refs.cardPreviewList&&this.$refs.cardPreviewList.toggleShortcuts(!1),this.editingCard={...e},this.editingCardIndex=t,this.editedMarkdown=e.markdown,this.editedTags=[...e.tags],this.editedElo=e.elo,this.showEditDialog=!0,this.$nextTick((()=>{this.$refs.markdownTextarea&&this.$refs.markdownTextarea.$el.querySelector("textarea")?.focus()}))},saveEditedCard(){if(this.editingCardIndex<0||!this.editingCard)return;const e={markdown:this.editedMarkdown,tags:this.editedTags,elo:this.editedElo},t=[...this.parsedCards];t[this.editingCardIndex]=e,this.parsedCards=t,this.closeEditDialog(),H({text:"Card updated successfully",status:Z.ok})},closeEditDialog(){this.showEditDialog=!1,this.editingCard=null,this.editingCardIndex=-1,this.editedMarkdown="",this.editedTags=[],this.editedElo=void 0,setTimeout((()=>{this.$refs.cardPreviewList&&this.$refs.cardPreviewList.toggleShortcuts(!0)}),100)},addTag(){const e=this.newTagText.trim();e&&!this.editedTags.includes(e)&&(this.editedTags.push(e),this.newTagText="")},removeTag(e){this.editedTags=this.editedTags.filter((t=>t!==e))},initializeCardPreviewComponents(){const e=this.courseCfg?.dataShapes?.[0];if(!e)return;this.dataShape.name!==de[0].name&&(this.dataShape=de[0]);const t=te.getDataShapeDescriptor(e.name),n=hb.getCourse(t.course);if(n){this.cardViewComponents=[],n.getBaseQTypes().forEach((e=>{e.dataShapes[0].name===this.dataShape?.name&&(this.cardViewComponents=this.cardViewComponents.concat(e.views))}));for(const t of e.questionTypes){const e=te.getQuestionDescriptor(t),r=n.getQuestion(e.questionType)?.views||[];this.cardViewComponents=this.cardViewComponents.concat(r)}console.log(`[BulkImportView] Loaded ${this.cardViewComponents.length} view components for card preview`)}},resetToInputStage(){this.parsingComplete=!1,this.parsedCards=[],this.importAttempted=!1},startNewBulkImport(){this.bulkText="",this.results=[],this.parsedCards=[],this.parsingComplete=!1,this.importAttempted=!1},handleInitialParse(){if(this.courseDB){if(ie(this.bulkText)){this.processing=!0,this.results=[],this.parsedCards=[],this.parsingComplete=!1;try{if(this.parsedCards=ae(this.bulkText),0===this.parsedCards.length)return H({text:'No cards could be parsed from the input. Please check the format and ensure cards are separated by two "---" lines and that cards have content.',status:Z.warning}),void(this.processing=!1);0===this.cardViewComponents.length&&this.initializeCardPreviewComponents(),this.parsingComplete=!0,console.log(`[BulkImportView] Successfully parsed ${this.parsedCards.length} cards for preview`)}catch(e){console.error("[BulkImportView] Error parsing bulk text:",e),H({text:`Error parsing cards: ${e instanceof Error?e.message:"Unknown error"}`,status:Z.error})}finally{this.processing=!1}}}else H({text:"Database connection not available. Cannot process cards.",status:Z.error})},async confirmAndImportCards(){if(!this.courseDB)return H({text:"Database connection lost before import.",status:Z.error}),void(this.processing=!1);if(0===this.parsedCards.length)return H({text:"No parsed cards to import.",status:Z.warning}),void(this.processing=!1);if(!this.courseCfg?.dataShapes||0===this.courseCfg.dataShapes.length)return H({text:"This course has no data shapes configured. Cannot import cards.",status:Z.error}),void(this.processing=!1);this.processing=!0,this.results=[];const e=(await W()).getUsername(),t=de[0];if(!t)return H({text:"Critical: Could not find BlanksCardDataShapes. Aborting import.",status:Z.error}),void(this.processing=!1);const n=this.courseCfg?.dataShapes?.[0];if(!n)return H({text:"Critical: No data shapes found in course configuration. Aborting import.",status:Z.error}),void(this.processing=!1);const r=te.getDataShapeDescriptor(n.name).course,i={dataShape:t,courseCode:r,userName:e},a=le(i);if(!a.isValid)return H({text:a.errorMessage||"Invalid processor configuration for import.",status:Z.error}),void(this.processing=!1);console.log("[BulkImportView] Starting import of parsed cards:",{courseID:this.courseCfg.courseID,dataShapeToUse:t.name,courseCode:r,numberOfCards:this.parsedCards.length});try{this.results=await ue(this.parsedCards,this.courseDB,i)}catch(s){console.error("[BulkImportView] Error importing parsed cards:",s),this.results.push({originalText:"Bulk Operation Error",status:"error",message:`Critical error during import: ${s instanceof Error?s.message:"Unknown error"}`})}finally{this.processing=!1,this.importAttempted=!0}this.results.every((e=>"success"===e.status))&&this.results.length>0?H({text:`${this.results.length} card(s) imported successfully!`,status:Z.ok}):this.results.some((e=>"error"===e.status))&&H({text:"Some cards failed to import. Please review the results below.",status:Z.warning})}}}),$_={key:0},K_={key:1,class:"text--secondary"},Q_={class:"my-4"},X_={class:"d-flex align-center mb-2"},Z_={class:"d-flex flex-wrap"},J_={key:0,class:"ml-6"},ew={key:1,class:"ml-6"},tw={key:2,class:"ml-6"},nw={style:{"white-space":"pre-wrap","background-color":"#f5f5f5",padding:"5px"}};const rw=/* @__PURE__ */wb(Y_,[["render",function(e,t,n,r,i,a){const s=w("v-textarea"),o=w("v-col"),c=w("v-row"),l=w("v-card-title"),u=w("v-chip"),h=w("v-card-text"),d=w("v-card"),v=w("card-preview-list"),S=w("v-text-field"),M=w("v-btn"),A=w("v-form"),P=w("v-spacer"),D=w("v-tooltip"),O=w("v-card-actions"),L=w("v-dialog"),B=w("v-icon"),R=w("v-list-subheader"),V=w("v-list-item-title"),F=w("v-list-item-subtitle"),z=w("v-list-item"),j=w("v-list"),q=w("v-container");return p(),E(q,{fluid:""},{default:T((()=>[e.parsingComplete?g("",!0):(p(),E(c,{key:0},{default:T((()=>[x(o,{cols:"12"},{default:T((()=>[x(s,{modelValue:e.bulkText,"onUpdate:modelValue":t[0]||(t[0]=t=>e.bulkText=t),label:"Bulk Card Input",placeholder:"Paste card data here.\nSeparate cards with two consecutive '---' lines on their own lines.\nExample:\nCard 1 Question\n{{blank}}\ntags: tagA, tagB\nelo: 1500\n---\n---\nCard 2 Question\nAnother {{blank}}\nelo: 1200\ntags: tagC",rows:"15",variant:"outlined","data-cy":"bulk-import-textarea"},null,8,["modelValue"])])),_:1})])),_:1})),e.parsingComplete?(p(),E(c,{key:1,class:"mb-4"},{default:T((()=>[x(o,{cols:"12",md:"4"},{default:T((()=>[x(d,{border:""},{default:T((()=>[x(l,null,{default:T((()=>t[6]||(t[6]=[k("Parsing Summary")]))),_:1}),x(h,null,{default:T((()=>[m("p",null,[m("strong",null,y(e.parsedCards.length),1),t[7]||(t[7]=k(" card(s) parsed and ready for import. "))]),e.parsedCards.length>0?(p(),f("div",$_,[t[8]||(t[8]=m("strong",null,"Tags Found:",-1)),e.uniqueTags.length>0?(p(!0),f(b,{key:0},_(e.uniqueTags,(e=>(p(),E(u,{key:e,class:"mr-1 mb-1",size:"small",label:""},{default:T((()=>[k(y(e),1)])),_:2},1024)))),128)):(p(),f("span",K_,"No unique tags identified across parsed cards."))])):g("",!0)])),_:1})])),_:1})])),_:1}),x(o,{cols:"12",md:"8"},{default:T((()=>[e.parsedCards.length>0?(p(),E(v,{key:0,ref:"cardPreviewList","parsed-cards":e.parsedCards,"onUpdate:parsedCards":t[1]||(t[1]=t=>e.parsedCards=t),"data-shape":e.dataShape,"view-components":e.cardViewComponents,onEditCard:e.handleEditCard,onDeleteCard:e.handleDeleteCard},null,8,["parsed-cards","data-shape","view-components","onEditCard","onDeleteCard"])):g("",!0)])),_:1})])),_:1})):g("",!0),x(L,{modelValue:e.showEditDialog,"onUpdate:modelValue":t[5]||(t[5]=t=>e.showEditDialog=t),"max-width":"800px"},{default:T((()=>[x(d,null,{default:T((()=>[x(l,null,{default:T((()=>t[9]||(t[9]=[k("Edit Card")]))),_:1}),x(h,null,{default:T((()=>[x(A,{onSubmit:I(e.saveEditedCard,["prevent"]),onKeydown:N(e.closeEditDialog,["esc"])},{default:T((()=>[x(s,{ref:"markdownTextarea",modelValue:e.editedMarkdown,"onUpdate:modelValue":t[2]||(t[2]=t=>e.editedMarkdown=t),label:"Card Content",rows:"6","auto-grow":"",variant:"outlined",onKeydown:N(I(e.saveEditedCard,["ctrl"]),["enter"])},null,8,["modelValue","onKeydown"]),m("div",Q_,[m("div",X_,[t[11]||(t[11]=m("h3",{class:"text-subtitle-1 mr-2"},"Tags",-1)),x(S,{modelValue:e.newTagText,"onUpdate:modelValue":t[3]||(t[3]=t=>e.newTagText=t),density:"compact","hide-details":"",placeholder:"Add a tag",variant:"outlined",class:"mr-2",onKeydown:[N(I(e.addTag,["prevent"]),["enter"]),N(e.closeEditDialog,["esc"])]},null,8,["modelValue","onKeydown"]),x(M,{size:"small",color:"primary",variant:"text",onClick:e.addTag},{default:T((()=>t[10]||(t[10]=[k("Add")]))),_:1},8,["onClick"])]),m("div",Z_,[(p(!0),f(b,null,_(e.editedTags,(t=>(p(),E(u,{key:t,closable:"",class:"mr-1 mb-1","onClick:close":n=>e.removeTag(t)},{default:T((()=>[k(y(t),1)])),_:2},1032,["onClick:close"])))),128))])]),x(S,{modelValue:e.editedElo,"onUpdate:modelValue":t[4]||(t[4]=t=>e.editedElo=t),modelModifiers:{number:!0},label:"ELO Rating (optional)",type:"number",variant:"outlined",min:"0",max:"3000"},null,8,["modelValue"])])),_:1},8,["onSubmit","onKeydown"])])),_:1}),x(O,null,{default:T((()=>[x(P),x(M,{color:"grey",variant:"text",onClick:e.closeEditDialog},{default:T((()=>[t[13]||(t[13]=k(" Cancel ")),x(D,{activator:"parent",location:"top"},{default:T((()=>t[12]||(t[12]=[k("Press ESC")]))),_:1})])),_:1},8,["onClick"]),x(M,{color:"primary",onClick:e.saveEditedCard},{default:T((()=>[t[15]||(t[15]=k(" Save ")),x(D,{activator:"parent",location:"top"},{default:T((()=>t[14]||(t[14]=[k("Press Ctrl+Enter")]))),_:1})])),_:1},8,["onClick"])])),_:1})])),_:1})])),_:1},8,["modelValue"]),x(c,null,{default:T((()=>[x(o,{cols:"12"},{default:T((()=>[e.parsingComplete?g("",!0):(p(),E(M,{key:0,color:"primary",loading:e.processing,disabled:!e.bulkText.trim()||e.processing,"data-cy":"bulk-import-parse-btn",onClick:e.handleInitialParse},{default:T((()=>[t[17]||(t[17]=k(" Parse Cards ")),x(B,{end:""},{default:T((()=>t[16]||(t[16]=[k("mdi-play-circle-outline")]))),_:1})])),_:1},8,["loading","disabled","onClick"])),e.parsingComplete?(p(),f(b,{key:1},[x(M,{color:"primary",class:"mr-2",loading:e.processing,disabled:0===e.parsedCards.length||e.processing||e.importAttempted,"data-cy":"bulk-import-confirm-btn",onClick:e.confirmAndImportCards},{default:T((()=>[k(" Confirm and Import "+y(e.parsedCards.length)+" Card(s) ",1),x(B,{end:""},{default:T((()=>t[18]||(t[18]=[k("mdi-check-circle-outline")]))),_:1})])),_:1},8,["loading","disabled","onClick"]),e.importAttempted?g("",!0):(p(),E(M,{key:0,variant:"outlined",color:"grey-darken-1",disabled:e.processing,"data-cy":"bulk-import-edit-again-btn",onClick:e.resetToInputStage},{default:T((()=>[x(B,{start:""},{default:T((()=>t[19]||(t[19]=[k("mdi-pencil")]))),_:1}),t[20]||(t[20]=k(" Back to bulk-editor. "))])),_:1},8,["disabled","onClick"])),e.importAttempted?(p(),E(M,{key:1,variant:"outlined",color:"blue-darken-1",disabled:e.processing,"data-cy":"bulk-import-add-another-btn",onClick:e.startNewBulkImport},{default:T((()=>[x(B,{start:""},{default:T((()=>t[21]||(t[21]=[k("mdi-plus-circle-outline")]))),_:1}),t[22]||(t[22]=k(" Add Another Bulk Import "))])),_:1},8,["disabled","onClick"])):g("",!0)],64)):g("",!0)])),_:1})])),_:1}),e.results.length>0?(p(),E(c,{key:2},{default:T((()=>[x(o,{cols:"12"},{default:T((()=>[x(j,{density:"compact"},{default:T((()=>[x(R,null,{default:T((()=>t[23]||(t[23]=[k("Import Results")]))),_:1}),(p(!0),f(b,null,_(e.results,((e,n)=>(p(),E(z,{key:n,class:C({"lime-lighten-5":"success"===e.status,"red-lighten-5":"error"===e.status,"force-dark-text":"success"===e.status||"error"===e.status})},{default:T((()=>[x(V,null,{default:T((()=>[x(B,{color:"success"===e.status?"green":"red"},{default:T((()=>[k(y("success"===e.status?"mdi-check-circle":"mdi-alert-circle"),1)])),_:2},1032,["color"]),k(" Card "+y(n+1),1)])),_:2},1024),x(F,null,{default:T((()=>[e.message?(p(),f("div",J_,y(e.message),1)):g("",!0),e.cardId?(p(),f("div",ew,"ID: "+y(e.cardId),1)):g("",!0),"error"===e.status&&e.originalText?(p(),f("details",tw,[t[24]||(t[24]=m("summary",null,"Original Input",-1)),m("pre",nw,y(e.originalText),1)])):g("",!0)])),_:2},1024)])),_:2},1032,["class"])))),128))])),_:1})])),_:1})])),_:1})):g("",!0)])),_:1})}],["__scopeId","data-v-901d842b"]]),iw=n({name:"CourseEditor",components:{DataInputForm:N_,ComponentRegistration:Cb,NavigationStrategyEditor:o_,BulkImportView:rw},props:{course:{type:String,required:!0}},data:()=>({registeredDataShapes:[],dataShapes:[],selectedShape:Wi.dataShapes[0].name,courseConfig:null,dataShape:de[0],loading:!0,currentTab:"single",dataInputFormStore:A_()}),watch:{selectedShape:{handler(e){e&&(this.dataShape=this.getDataShape(e),this.dataInputFormStore.setDataShape(this.dataShape),this.dataInputFormStore.dataInputForm.course=this.courseConfig)}}},async created(){this.courseConfig=await se().getCoursesDB().getCourseConfig(this.course),hb.courses.forEach((e=>{e.questions.forEach((e=>{e.dataShapes.forEach((e=>{this.dataShapes.push(e)}))}))})),this.courseConfig&&this.courseConfig.dataShapes&&this.courseConfig.dataShapes.forEach((e=>{this.registeredDataShapes.push(this.dataShapes.find((t=>t.name===te.getDataShapeDescriptor(e.name).dataShape)))})),this.loading=!1},methods:{getDataShape(e){return this.dataShapes.find((t=>t.name===e))}}}),aw={key:0,class:"courseEditor"},sw={key:0},ow={key:1},cw={class:"text-h4"};const lw=/* @__PURE__ */wb(iw,[["render",function(e,t,n,r,i,a){const s=w("v-progress-circular"),o=w("router-link"),c=w("v-tab"),l=w("v-tabs"),u=w("v-select"),h=w("data-input-form"),d=w("v-container"),v=w("v-window-item"),b=w("bulk-import-view"),_=w("component-registration"),S=w("navigation-strategy-editor"),C=w("v-window");return e.course?(p(),f("div",aw,[e.loading?(p(),f("div",sw,[x(s,{indeterminate:"",color:"secondary"})])):(p(),f("div",ow,[m("h1",cw,[x(o,{to:"/q"},{default:T((()=>t[3]||(t[3]=[k("Quilts")]))),_:1}),t[4]||(t[4]=k(" / ")),x(o,{to:`/q/${e.courseConfig?e.courseConfig.name:e.course}`},{default:T((()=>[k(y(e.courseConfig?.name),1)])),_:1},8,["to"])]),x(l,{modelValue:e.currentTab,"onUpdate:modelValue":t[0]||(t[0]=t=>e.currentTab=t),"bg-color":"primary",grow:""},{default:T((()=>[x(c,{value:"single"},{default:T((()=>t[5]||(t[5]=[k("Single Card Input")]))),_:1}),x(c,{value:"bulk"},{default:T((()=>t[6]||(t[6]=[k("Bulk Import")]))),_:1}),x(c,{value:"navigation"},{default:T((()=>t[7]||(t[7]=[k("Navigation")]))),_:1}),x(c,{value:"registration"},{default:T((()=>t[8]||(t[8]=[k("Component Registration")]))),_:1})])),_:1},8,["modelValue"]),x(C,{modelValue:e.currentTab,"onUpdate:modelValue":t[2]||(t[2]=t=>e.currentTab=t)},{default:T((()=>[x(v,{value:"single"},{default:T((()=>[x(d,{fluid:""},{default:T((()=>[x(u,{modelValue:e.selectedShape,"onUpdate:modelValue":t[1]||(t[1]=t=>e.selectedShape=t),label:"What kind of content are you adding?",items:e.registeredDataShapes.map((e=>e.name)),class:"mt-4"},null,8,["modelValue","items"]),""!==e.selectedShape&&e.courseConfig&&e.dataShape?(p(),E(h,{key:0,"data-shape":e.dataShape,"course-cfg":e.courseConfig},null,8,["data-shape","course-cfg"])):g("",!0)])),_:1})])),_:1}),x(v,{value:"bulk"},{default:T((()=>[x(d,{fluid:""},{default:T((()=>[e.courseConfig?(p(),E(b,{key:0,"course-cfg":e.courseConfig,class:"mt-4"},null,8,["course-cfg"])):g("",!0)])),_:1})])),_:1}),x(v,{value:"registration"},{default:T((()=>[x(d,{fluid:""},{default:T((()=>[x(_,{course:e.course,class:"mt-4"},null,8,["course"])])),_:1})])),_:1}),x(v,{value:"navigation"},{default:T((()=>[x(d,{fluid:""},{default:T((()=>[x(S,{"course-id":e.course},null,8,["course-id"])])),_:1})])),_:1})])),_:1},8,["modelValue"])]))])):g("",!0)}],["__scopeId","data-v-c987522c"]]);export{rw as BulkImportView,T_ as ChessPuzzleInput,lw as CourseEditor,N_ as DataInputForm,p_ as IntegerInput,m_ as MarkdownInput,__ as MediaDragDropUploader,C_ as MidiInput,M_ as NumberInput,f_ as OptionsFieldInput,E_ as StringInput,h_ as integerValidator,c_ as isFieldInput,u_ as numberValidator,A_ as useDataInputFormStore,d_ as useFieldInputStore};
1
+ import{defineComponent as e,resolveComponent as t,createElementBlock as n,openBlock as r,createElementVNode as a,Fragment as i,renderList as o,createBlock as u,createTextVNode as s,withCtx as l,toDisplayString as c,createCommentVNode as d,createVNode as f,ref as p,computed as h,onMounted as g,watch as m,withModifiers as v,normalizeClass as y,withKeys as _}from"vue";import{allCourseWare as b,SyllableSeqVis as w,eventsToSyllableSequence as C,transposeSyllableSeq as S,SkMidi as I,BlanksCardDataShapes as k,BlanksCard as x}from"@vue-skuilder/courseware";import{getDataLayer as D,DocType as V,Navigators as T,validateProcessorConfig as E,importParsedCards as A}from"@vue-skuilder/db";import{NameSpacer as O,Status as F,fieldConverters as R,FieldType as j,validationFunctionToVuetifyRule as U,isValidBulkFormat as q,parseBulkTextToCards as N}from"@vue-skuilder/common";import{getCurrentUser as P,TagsInput as M,CardBrowser as z,alertUser as $,SkMouseTrap as B,SkldrMouseTrap as L}from"@vue-skuilder/common-ui";import{defineStore as W}from"pinia";var J,G="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},H={exports:{}};var Q,K,Y=(J||(J=1,Q=H,K=H.exports,function(){var e,t="Expected a function",n="__lodash_hash_undefined__",r="__lodash_placeholder__",a=32,i=128,o=256,u=1/0,s=9007199254740991,l=NaN,c=4294967295,d=[["ary",i],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",a],["partialRight",64],["rearg",o]],f="[object Arguments]",p="[object Array]",h="[object Boolean]",g="[object Date]",m="[object Error]",v="[object Function]",y="[object GeneratorFunction]",_="[object Map]",b="[object Number]",w="[object Object]",C="[object Promise]",S="[object RegExp]",I="[object Set]",k="[object String]",x="[object Symbol]",D="[object WeakMap]",V="[object ArrayBuffer]",T="[object DataView]",E="[object Float32Array]",A="[object Float64Array]",O="[object Int8Array]",F="[object Int16Array]",R="[object Int32Array]",j="[object Uint8Array]",U="[object Uint8ClampedArray]",q="[object Uint16Array]",N="[object Uint32Array]",P=/\b__p \+= '';/g,M=/\b(__p \+=) '' \+/g,z=/(__e\(.*?\)|\b__t\)) \+\n'';/g,$=/&(?:amp|lt|gt|quot|#39);/g,B=/[&<>"']/g,L=RegExp($.source),W=RegExp(B.source),J=/<%-([\s\S]+?)%>/g,H=/<%([\s\S]+?)%>/g,Y=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ae=/\s/,ie=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,oe=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,de=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,fe=/\w*$/,pe=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,ge=/^\[object .+?Constructor\]$/,me=/^0o[0-7]+$/i,ve=/^(?:0|[1-9]\d*)$/,ye=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,be=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Ce="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Se="\\u2700-\\u27bf",Ie="a-z\\xdf-\\xf6\\xf8-\\xff",ke="A-Z\\xc0-\\xd6\\xd8-\\xde",xe="\\ufe0e\\ufe0f",De="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ve="['’]",Te="["+we+"]",Ee="["+De+"]",Ae="["+Ce+"]",Oe="\\d+",Fe="["+Se+"]",Re="["+Ie+"]",je="[^"+we+De+Oe+Se+Ie+ke+"]",Ue="\\ud83c[\\udffb-\\udfff]",qe="[^"+we+"]",Ne="(?:\\ud83c[\\udde6-\\uddff]){2}",Pe="[\\ud800-\\udbff][\\udc00-\\udfff]",Me="["+ke+"]",ze="\\u200d",$e="(?:"+Re+"|"+je+")",Be="(?:"+Me+"|"+je+")",Le="(?:['’](?:d|ll|m|re|s|t|ve))?",We="(?:['’](?:D|LL|M|RE|S|T|VE))?",Je="(?:"+Ae+"|"+Ue+")?",Ge="["+xe+"]?",He=Ge+Je+"(?:"+ze+"(?:"+[qe,Ne,Pe].join("|")+")"+Ge+Je+")*",Qe="(?:"+[Fe,Ne,Pe].join("|")+")"+He,Ke="(?:"+[qe+Ae+"?",Ae,Ne,Pe,Te].join("|")+")",Ye=RegExp(Ve,"g"),Ze=RegExp(Ae,"g"),Xe=RegExp(Ue+"(?="+Ue+")|"+Ke+He,"g"),et=RegExp([Me+"?"+Re+"+"+Le+"(?="+[Ee,Me,"$"].join("|")+")",Be+"+"+We+"(?="+[Ee,Me+$e,"$"].join("|")+")",Me+"?"+$e+"+"+Le,Me+"+"+We,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Oe,Qe].join("|"),"g"),tt=RegExp("["+ze+we+Ce+xe+"]"),nt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,rt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],at=-1,it={};it[E]=it[A]=it[O]=it[F]=it[R]=it[j]=it[U]=it[q]=it[N]=!0,it[f]=it[p]=it[V]=it[h]=it[T]=it[g]=it[m]=it[v]=it[_]=it[b]=it[w]=it[S]=it[I]=it[k]=it[D]=!1;var ot={};ot[f]=ot[p]=ot[V]=ot[T]=ot[h]=ot[g]=ot[E]=ot[A]=ot[O]=ot[F]=ot[R]=ot[_]=ot[b]=ot[w]=ot[S]=ot[I]=ot[k]=ot[x]=ot[j]=ot[U]=ot[q]=ot[N]=!0,ot[m]=ot[v]=ot[D]=!1;var ut={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},st=parseFloat,lt=parseInt,ct="object"==typeof G&&G&&G.Object===Object&&G,dt="object"==typeof self&&self&&self.Object===Object&&self,ft=ct||dt||Function("return this")(),pt=K&&!K.nodeType&&K,ht=pt&&Q&&!Q.nodeType&&Q,gt=ht&&ht.exports===pt,mt=gt&&ct.process,vt=function(){try{var e=ht&&ht.require&&ht.require("util").types;return e||mt&&mt.binding&&mt.binding("util")}catch(t){}}(),yt=vt&&vt.isArrayBuffer,_t=vt&&vt.isDate,bt=vt&&vt.isMap,wt=vt&&vt.isRegExp,Ct=vt&&vt.isSet,St=vt&&vt.isTypedArray;function It(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function kt(e,t,n,r){for(var a=-1,i=null==e?0:e.length;++a<i;){var o=e[a];t(r,o,n(o),e)}return r}function xt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function Dt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Vt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function Tt(e,t){for(var n=-1,r=null==e?0:e.length,a=0,i=[];++n<r;){var o=e[n];t(o,n,e)&&(i[a++]=o)}return i}function Et(e,t){return!(null==e||!e.length)&&Mt(e,t,0)>-1}function At(e,t,n){for(var r=-1,a=null==e?0:e.length;++r<a;)if(n(t,e[r]))return!0;return!1}function Ot(e,t){for(var n=-1,r=null==e?0:e.length,a=Array(r);++n<r;)a[n]=t(e[n],n,e);return a}function Ft(e,t){for(var n=-1,r=t.length,a=e.length;++n<r;)e[a+n]=t[n];return e}function Rt(e,t,n,r){var a=-1,i=null==e?0:e.length;for(r&&i&&(n=e[++a]);++a<i;)n=t(n,e[a],a,e);return n}function jt(e,t,n,r){var a=null==e?0:e.length;for(r&&a&&(n=e[--a]);a--;)n=t(n,e[a],a,e);return n}function Ut(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var qt=Lt("length");function Nt(e,t,n){var r;return n(e,(function(e,n,a){if(t(e,n,a))return r=n,!1})),r}function Pt(e,t,n,r){for(var a=e.length,i=n+(r?1:-1);r?i--:++i<a;)if(t(e[i],i,e))return i;return-1}function Mt(e,t,n){return t==t?function(e,t,n){for(var r=n-1,a=e.length;++r<a;)if(e[r]===t)return r;return-1}(e,t,n):Pt(e,$t,n)}function zt(e,t,n,r){for(var a=n-1,i=e.length;++a<i;)if(r(e[a],t))return a;return-1}function $t(e){return e!=e}function Bt(e,t){var n=null==e?0:e.length;return n?Gt(e,t)/n:l}function Lt(t){return function(n){return null==n?e:n[t]}}function Wt(t){return function(n){return null==t?e:t[n]}}function Jt(e,t,n,r,a){return a(e,(function(e,a,i){n=r?(r=!1,e):t(n,e,a,i)})),n}function Gt(t,n){for(var r,a=-1,i=t.length;++a<i;){var o=n(t[a]);o!==e&&(r=r===e?o:r+o)}return r}function Ht(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Qt(e){return e?e.slice(0,fn(e)+1).replace(re,""):e}function Kt(e){return function(t){return e(t)}}function Yt(e,t){return Ot(t,(function(t){return e[t]}))}function Zt(e,t){return e.has(t)}function Xt(e,t){for(var n=-1,r=e.length;++n<r&&Mt(t,e[n],0)>-1;);return n}function en(e,t){for(var n=e.length;n--&&Mt(t,e[n],0)>-1;);return n}var tn=Wt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),nn=Wt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function rn(e){return"\\"+ut[e]}function an(e){return tt.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function un(e,t){return function(n){return e(t(n))}}function sn(e,t){for(var n=-1,a=e.length,i=0,o=[];++n<a;){var u=e[n];u!==t&&u!==r||(e[n]=r,o[i++]=n)}return o}function ln(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function cn(e){return an(e)?function(e){for(var t=Xe.lastIndex=0;Xe.test(e);)++t;return t}(e):qt(e)}function dn(e){return an(e)?function(e){return e.match(Xe)||[]}(e):function(e){return e.split("")}(e)}function fn(e){for(var t=e.length;t--&&ae.test(e.charAt(t)););return t}var pn=Wt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),hn=function G(Q){var K,ae=(Q=null==Q?ft:hn.defaults(ft.Object(),Q,hn.pick(ft,rt))).Array,we=Q.Date,Ce=Q.Error,Se=Q.Function,Ie=Q.Math,ke=Q.Object,xe=Q.RegExp,De=Q.String,Ve=Q.TypeError,Te=ae.prototype,Ee=Se.prototype,Ae=ke.prototype,Oe=Q["__core-js_shared__"],Fe=Ee.toString,Re=Ae.hasOwnProperty,je=0,Ue=(K=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||""))?"Symbol(src)_1."+K:"",qe=Ae.toString,Ne=Fe.call(ke),Pe=ft._,Me=xe("^"+Fe.call(Re).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ze=gt?Q.Buffer:e,$e=Q.Symbol,Be=Q.Uint8Array,Le=ze?ze.allocUnsafe:e,We=un(ke.getPrototypeOf,ke),Je=ke.create,Ge=Ae.propertyIsEnumerable,He=Te.splice,Qe=$e?$e.isConcatSpreadable:e,Ke=$e?$e.iterator:e,Xe=$e?$e.toStringTag:e,tt=function(){try{var e=li(ke,"defineProperty");return e({},"",{}),e}catch(t){}}(),ut=Q.clearTimeout!==ft.clearTimeout&&Q.clearTimeout,ct=we&&we.now!==ft.Date.now&&we.now,dt=Q.setTimeout!==ft.setTimeout&&Q.setTimeout,pt=Ie.ceil,ht=Ie.floor,mt=ke.getOwnPropertySymbols,vt=ze?ze.isBuffer:e,qt=Q.isFinite,Wt=Te.join,gn=un(ke.keys,ke),mn=Ie.max,vn=Ie.min,yn=we.now,_n=Q.parseInt,bn=Ie.random,wn=Te.reverse,Cn=li(Q,"DataView"),Sn=li(Q,"Map"),In=li(Q,"Promise"),kn=li(Q,"Set"),xn=li(Q,"WeakMap"),Dn=li(ke,"create"),Vn=xn&&new xn,Tn={},En=Ni(Cn),An=Ni(Sn),On=Ni(In),Fn=Ni(kn),Rn=Ni(xn),jn=$e?$e.prototype:e,Un=jn?jn.valueOf:e,qn=jn?jn.toString:e;function Nn(e){if(nu(e)&&!Wo(e)&&!(e instanceof $n)){if(e instanceof zn)return e;if(Re.call(e,"__wrapped__"))return Pi(e)}return new zn(e)}var Pn=/* @__PURE__ */function(){function t(){}return function(n){if(!tu(n))return{};if(Je)return Je(n);t.prototype=n;var r=new t;return t.prototype=e,r}}();function Mn(){}function zn(t,n){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!n,this.__index__=0,this.__values__=e}function $n(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=c,this.__views__=[]}function Bn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ln(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Jn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Wn;++t<n;)this.add(e[t])}function Gn(e){var t=this.__data__=new Ln(e);this.size=t.size}function Hn(e,t){var n=Wo(e),r=!n&&Lo(e),a=!n&&!r&&Qo(e),i=!n&&!r&&!a&&cu(e),o=n||r||a||i,u=o?Ht(e.length,De):[],s=u.length;for(var l in e)!t&&!Re.call(e,l)||o&&("length"==l||a&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||mi(l,s))||u.push(l);return u}function Qn(t){var n=t.length;return n?t[Jr(0,n-1)]:e}function Kn(e,t){return Oi(Da(e),ir(t,0,e.length))}function Yn(e){return Oi(Da(e))}function Zn(t,n,r){(r!==e&&!zo(t[n],r)||r===e&&!(n in t))&&rr(t,n,r)}function Xn(t,n,r){var a=t[n];Re.call(t,n)&&zo(a,r)&&(r!==e||n in t)||rr(t,n,r)}function er(e,t){for(var n=e.length;n--;)if(zo(e[n][0],t))return n;return-1}function tr(e,t,n,r){return cr(e,(function(e,a,i){t(r,e,n(e),i)})),r}function nr(e,t){return e&&Va(t,Ou(t),e)}function rr(e,t,n){"__proto__"==t&&tt?tt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ar(t,n){for(var r=-1,a=n.length,i=ae(a),o=null==t;++r<a;)i[r]=o?e:Du(t,n[r]);return i}function ir(t,n,r){return t==t&&(r!==e&&(t=t<=r?t:r),n!==e&&(t=t>=n?t:n)),t}function or(t,n,r,a,i,o){var u,s=1&n,l=2&n,c=4&n;if(r&&(u=i?r(t,a,i,o):r(t)),u!==e)return u;if(!tu(t))return t;var d=Wo(t);if(d){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Re.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!s)return Da(t,u)}else{var p=fi(t),m=p==v||p==y;if(Qo(t))return wa(t,s);if(p==w||p==f||m&&!i){if(u=l||m?{}:hi(t),!s)return l?function(e,t){return Va(e,di(e),t)}(t,function(e,t){return e&&Va(t,Fu(t),e)}(u,t)):function(e,t){return Va(e,ci(e),t)}(t,nr(u,t))}else{if(!ot[p])return i?t:{};u=function(e,t,n){var r,a=e.constructor;switch(t){case V:return Ca(e);case h:case g:return new a(+e);case T:return function(e,t){var n=t?Ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case E:case A:case O:case F:case R:case j:case U:case q:case N:return Sa(e,n);case _:return new a;case b:case k:return new a(e);case S:return function(e){var t=new e.constructor(e.source,fe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case I:return new a;case x:return r=e,Un?ke(Un.call(r)):{}}}(t,p,s)}}o||(o=new Gn);var C=o.get(t);if(C)return C;o.set(t,u),uu(t)?t.forEach((function(e){u.add(or(e,n,r,e,t,o))})):ru(t)&&t.forEach((function(e,a){u.set(a,or(e,n,r,a,t,o))}));var D=d?e:(c?l?ni:ti:l?Fu:Ou)(t);return xt(D||t,(function(e,a){D&&(e=t[a=e]),Xn(u,a,or(e,n,r,a,t,o))})),u}function ur(t,n,r){var a=r.length;if(null==t)return!a;for(t=ke(t);a--;){var i=r[a],o=n[i],u=t[i];if(u===e&&!(i in t)||!o(u))return!1}return!0}function sr(n,r,a){if("function"!=typeof n)throw new Ve(t);return Vi((function(){n.apply(e,a)}),r)}function lr(e,t,n,r){var a=-1,i=Et,o=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=Ot(t,Kt(n))),r?(i=At,o=!1):t.length>=200&&(i=Zt,o=!1,t=new Jn(t));e:for(;++a<u;){var c=e[a],d=null==n?c:n(c);if(c=r||0!==c?c:0,o&&d==d){for(var f=l;f--;)if(t[f]===d)continue e;s.push(c)}else i(t,d,r)||s.push(c)}return s}Nn.templateSettings={escape:J,evaluate:H,interpolate:Y,variable:"",imports:{_:Nn}},Nn.prototype=Mn.prototype,Nn.prototype.constructor=Nn,zn.prototype=Pn(Mn.prototype),zn.prototype.constructor=zn,$n.prototype=Pn(Mn.prototype),$n.prototype.constructor=$n,Bn.prototype.clear=function(){this.__data__=Dn?Dn(null):{},this.size=0},Bn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Bn.prototype.get=function(t){var r=this.__data__;if(Dn){var a=r[t];return a===n?e:a}return Re.call(r,t)?r[t]:e},Bn.prototype.has=function(t){var n=this.__data__;return Dn?n[t]!==e:Re.call(n,t)},Bn.prototype.set=function(t,r){var a=this.__data__;return this.size+=this.has(t)?0:1,a[t]=Dn&&r===e?n:r,this},Ln.prototype.clear=function(){this.__data__=[],this.size=0},Ln.prototype.delete=function(e){var t=this.__data__,n=er(t,e);return!(n<0||(n==t.length-1?t.pop():He.call(t,n,1),--this.size,0))},Ln.prototype.get=function(t){var n=this.__data__,r=er(n,t);return r<0?e:n[r][1]},Ln.prototype.has=function(e){return er(this.__data__,e)>-1},Ln.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Wn.prototype.clear=function(){this.size=0,this.__data__={hash:new Bn,map:new(Sn||Ln),string:new Bn}},Wn.prototype.delete=function(e){var t=ui(this,e).delete(e);return this.size-=t?1:0,t},Wn.prototype.get=function(e){return ui(this,e).get(e)},Wn.prototype.has=function(e){return ui(this,e).has(e)},Wn.prototype.set=function(e,t){var n=ui(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Jn.prototype.add=Jn.prototype.push=function(e){return this.__data__.set(e,n),this},Jn.prototype.has=function(e){return this.__data__.has(e)},Gn.prototype.clear=function(){this.__data__=new Ln,this.size=0},Gn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Gn.prototype.get=function(e){return this.__data__.get(e)},Gn.prototype.has=function(e){return this.__data__.has(e)},Gn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ln){var r=n.__data__;if(!Sn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Wn(r)}return n.set(e,t),this.size=n.size,this};var cr=Aa(yr),dr=Aa(_r,!0);function fr(e,t){var n=!0;return cr(e,(function(e,r,a){return n=!!t(e,r,a)})),n}function pr(t,n,r){for(var a=-1,i=t.length;++a<i;){var o=t[a],u=n(o);if(null!=u&&(s===e?u==u&&!lu(u):r(u,s)))var s=u,l=o}return l}function hr(e,t){var n=[];return cr(e,(function(e,r,a){t(e,r,a)&&n.push(e)})),n}function gr(e,t,n,r,a){var i=-1,o=e.length;for(n||(n=gi),a||(a=[]);++i<o;){var u=e[i];t>0&&n(u)?t>1?gr(u,t-1,n,r,a):Ft(a,u):r||(a[a.length]=u)}return a}var mr=Oa(),vr=Oa(!0);function yr(e,t){return e&&mr(e,t,Ou)}function _r(e,t){return e&&vr(e,t,Ou)}function br(e,t){return Tt(t,(function(t){return Zo(e[t])}))}function wr(t,n){for(var r=0,a=(n=va(n,t)).length;null!=t&&r<a;)t=t[qi(n[r++])];return r&&r==a?t:e}function Cr(e,t,n){var r=t(e);return Wo(e)?r:Ft(r,n(e))}function Sr(t){return null==t?t===e?"[object Undefined]":"[object Null]":Xe&&Xe in ke(t)?function(t){var n=Re.call(t,Xe),r=t[Xe];try{t[Xe]=e;var a=!0}catch(o){}var i=qe.call(t);return a&&(n?t[Xe]=r:delete t[Xe]),i}(t):function(e){return qe.call(e)}(t)}function Ir(e,t){return e>t}function kr(e,t){return null!=e&&Re.call(e,t)}function xr(e,t){return null!=e&&t in ke(e)}function Dr(t,n,r){for(var a=r?At:Et,i=t[0].length,o=t.length,u=o,s=ae(o),l=1/0,c=[];u--;){var d=t[u];u&&n&&(d=Ot(d,Kt(n))),l=vn(d.length,l),s[u]=!r&&(n||i>=120&&d.length>=120)?new Jn(u&&d):e}d=t[0];var f=-1,p=s[0];e:for(;++f<i&&c.length<l;){var h=d[f],g=n?n(h):h;if(h=r||0!==h?h:0,!(p?Zt(p,g):a(c,g,r))){for(u=o;--u;){var m=s[u];if(!(m?Zt(m,g):a(t[u],g,r)))continue e}p&&p.push(g),c.push(h)}}return c}function Vr(t,n,r){var a=null==(t=ki(t,n=va(n,t)))?t:t[qi(Ki(n))];return null==a?e:It(a,t,r)}function Tr(e){return nu(e)&&Sr(e)==f}function Er(t,n,r,a,i){return t===n||(null==t||null==n||!nu(t)&&!nu(n)?t!=t&&n!=n:function(t,n,r,a,i,o){var u=Wo(t),s=Wo(n),l=u?p:fi(t),c=s?p:fi(n),d=(l=l==f?w:l)==w,v=(c=c==f?w:c)==w,y=l==c;if(y&&Qo(t)){if(!Qo(n))return!1;u=!0,d=!1}if(y&&!d)return o||(o=new Gn),u||cu(t)?Xa(t,n,r,a,i,o):function(e,t,n,r,a,i,o){switch(n){case T:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case V:return!(e.byteLength!=t.byteLength||!i(new Be(e),new Be(t)));case h:case g:case b:return zo(+e,+t);case m:return e.name==t.name&&e.message==t.message;case S:case k:return e==t+"";case _:var u=on;case I:var s=1&r;if(u||(u=ln),e.size!=t.size&&!s)return!1;var l=o.get(e);if(l)return l==t;r|=2,o.set(e,t);var c=Xa(u(e),u(t),r,a,i,o);return o.delete(e),c;case x:if(Un)return Un.call(e)==Un.call(t)}return!1}(t,n,l,r,a,i,o);if(!(1&r)){var C=d&&Re.call(t,"__wrapped__"),D=v&&Re.call(n,"__wrapped__");if(C||D){var E=C?t.value():t,A=D?n.value():n;return o||(o=new Gn),i(E,A,r,a,o)}}return!!y&&(o||(o=new Gn),function(t,n,r,a,i,o){var u=1&r,s=ti(t),l=s.length,c=ti(n),d=c.length;if(l!=d&&!u)return!1;for(var f=l;f--;){var p=s[f];if(!(u?p in n:Re.call(n,p)))return!1}var h=o.get(t),g=o.get(n);if(h&&g)return h==n&&g==t;var m=!0;o.set(t,n),o.set(n,t);for(var v=u;++f<l;){var y=t[p=s[f]],_=n[p];if(a)var b=u?a(_,y,p,n,t,o):a(y,_,p,t,n,o);if(!(b===e?y===_||i(y,_,r,a,o):b)){m=!1;break}v||(v="constructor"==p)}if(m&&!v){var w=t.constructor,C=n.constructor;w==C||!("constructor"in t)||!("constructor"in n)||"function"==typeof w&&w instanceof w&&"function"==typeof C&&C instanceof C||(m=!1)}return o.delete(t),o.delete(n),m}(t,n,r,a,i,o))}(t,n,r,a,Er,i))}function Ar(t,n,r,a){var i=r.length,o=i,u=!a;if(null==t)return!o;for(t=ke(t);i--;){var s=r[i];if(u&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<o;){var l=(s=r[i])[0],c=t[l],d=s[1];if(u&&s[2]){if(c===e&&!(l in t))return!1}else{var f=new Gn;if(a)var p=a(c,d,l,t,n,f);if(!(p===e?Er(d,c,3,a,f):p))return!1}}return!0}function Or(e){return!(!tu(e)||(t=e,Ue&&Ue in t))&&(Zo(e)?Me:ge).test(Ni(e));var t}function Fr(e){return"function"==typeof e?e:null==e?as:"object"==typeof e?Wo(e)?Pr(e[0],e[1]):Nr(e):ps(e)}function Rr(e){if(!wi(e))return gn(e);var t=[];for(var n in ke(e))Re.call(e,n)&&"constructor"!=n&&t.push(n);return t}function jr(e){if(!tu(e))return function(e){var t=[];if(null!=e)for(var n in ke(e))t.push(n);return t}(e);var t=wi(e),n=[];for(var r in e)("constructor"!=r||!t&&Re.call(e,r))&&n.push(r);return n}function Ur(e,t){return e<t}function qr(e,t){var n=-1,r=Go(e)?ae(e.length):[];return cr(e,(function(e,a,i){r[++n]=t(e,a,i)})),r}function Nr(e){var t=si(e);return 1==t.length&&t[0][2]?Si(t[0][0],t[0][1]):function(n){return n===e||Ar(n,e,t)}}function Pr(t,n){return yi(t)&&Ci(n)?Si(qi(t),n):function(r){var a=Du(r,t);return a===e&&a===n?Vu(r,t):Er(n,a,3)}}function Mr(t,n,r,a,i){t!==n&&mr(n,(function(o,u){if(i||(i=new Gn),tu(o))!function(t,n,r,a,i,o,u){var s=xi(t,r),l=xi(n,r),c=u.get(l);if(c)Zn(t,r,c);else{var d=o?o(s,l,r+"",t,n,u):e,f=d===e;if(f){var p=Wo(l),h=!p&&Qo(l),g=!p&&!h&&cu(l);d=l,p||h||g?Wo(s)?d=s:Ho(s)?d=Da(s):h?(f=!1,d=wa(l,!0)):g?(f=!1,d=Sa(l,!0)):d=[]:iu(l)||Lo(l)?(d=s,Lo(s)?d=yu(s):tu(s)&&!Zo(s)||(d=hi(l))):f=!1}f&&(u.set(l,d),i(d,l,a,o,u),u.delete(l)),Zn(t,r,d)}}(t,n,u,r,Mr,a,i);else{var s=a?a(xi(t,u),o,u+"",t,n,i):e;s===e&&(s=o),Zn(t,u,s)}}),Fu)}function zr(t,n){var r=t.length;if(r)return mi(n+=n<0?r:0,r)?t[n]:e}function $r(e,t,n){t=t.length?Ot(t,(function(e){return Wo(e)?function(t){return wr(t,1===e.length?e[0]:e)}:e})):[as];var r=-1;return t=Ot(t,Kt(oi())),function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(qr(e,(function(e,n,a){return{criteria:Ot(t,(function(t){return t(e)})),index:++r,value:e}})),(function(e,t){return function(e,t,n){for(var r=-1,a=e.criteria,i=t.criteria,o=a.length,u=n.length;++r<o;){var s=Ia(a[r],i[r]);if(s)return r>=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function Br(e,t,n){for(var r=-1,a=t.length,i={};++r<a;){var o=t[r],u=wr(e,o);n(u,o)&&Yr(i,va(o,e),u)}return i}function Lr(e,t,n,r){var a=r?zt:Mt,i=-1,o=t.length,u=e;for(e===t&&(t=Da(t)),n&&(u=Ot(e,Kt(n)));++i<o;)for(var s=0,l=t[i],c=n?n(l):l;(s=a(u,c,s,r))>-1;)u!==e&&He.call(u,s,1),He.call(e,s,1);return e}function Wr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var a=t[n];if(n==r||a!==i){var i=a;mi(a)?He.call(e,a,1):la(e,a)}}return e}function Jr(e,t){return e+ht(bn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>s)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Hr(e,t){return Ti(Ii(e,t,as),e+"")}function Qr(e){return Qn(zu(e))}function Kr(e,t){var n=zu(e);return Oi(n,ir(t,0,n.length))}function Yr(t,n,r,a){if(!tu(t))return t;for(var i=-1,o=(n=va(n,t)).length,u=o-1,s=t;null!=s&&++i<o;){var l=qi(n[i]),c=r;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(i!=u){var d=s[l];(c=a?a(d,l,s):e)===e&&(c=tu(d)?d:mi(n[i+1])?[]:{})}Xn(s,l,c),s=s[l]}return t}var Zr=Vn?function(e,t){return Vn.set(e,t),e}:as,Xr=tt?function(e,t){return tt(e,"toString",{configurable:!0,enumerable:!1,value:ts(t),writable:!0})}:as;function ea(e){return Oi(zu(e))}function ta(e,t,n){var r=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var i=ae(a);++r<a;)i[r]=e[r+t];return i}function na(e,t){var n;return cr(e,(function(e,r,a){return!(n=t(e,r,a))})),!!n}function ra(e,t,n){var r=0,a=null==e?r:e.length;if("number"==typeof t&&t==t&&a<=2147483647){for(;r<a;){var i=r+a>>>1,o=e[i];null!==o&&!lu(o)&&(n?o<=t:o<t)?r=i+1:a=i}return a}return aa(e,t,as,n)}function aa(t,n,r,a){var i=0,o=null==t?0:t.length;if(0===o)return 0;for(var u=(n=r(n))!=n,s=null===n,l=lu(n),c=n===e;i<o;){var d=ht((i+o)/2),f=r(t[d]),p=f!==e,h=null===f,g=f==f,m=lu(f);if(u)var v=a||g;else v=c?g&&(a||p):s?g&&p&&(a||!h):l?g&&p&&!h&&(a||!m):!h&&!m&&(a?f<=n:f<n);v?i=d+1:o=d}return vn(o,4294967294)}function ia(e,t){for(var n=-1,r=e.length,a=0,i=[];++n<r;){var o=e[n],u=t?t(o):o;if(!n||!zo(u,s)){var s=u;i[a++]=0===o?0:o}}return i}function oa(e){return"number"==typeof e?e:lu(e)?l:+e}function ua(e){if("string"==typeof e)return e;if(Wo(e))return Ot(e,ua)+"";if(lu(e))return qn?qn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function sa(e,t,n){var r=-1,a=Et,i=e.length,o=!0,u=[],s=u;if(n)o=!1,a=At;else if(i>=200){var l=t?null:Ga(e);if(l)return ln(l);o=!1,a=Zt,s=new Jn}else s=t?[]:u;e:for(;++r<i;){var c=e[r],d=t?t(c):c;if(c=n||0!==c?c:0,o&&d==d){for(var f=s.length;f--;)if(s[f]===d)continue e;t&&s.push(d),u.push(c)}else a(s,d,n)||(s!==u&&s.push(d),u.push(c))}return u}function la(e,t){return null==(e=ki(e,t=va(t,e)))||delete e[qi(Ki(t))]}function ca(e,t,n,r){return Yr(e,t,n(wr(e,t)),r)}function da(e,t,n,r){for(var a=e.length,i=r?a:-1;(r?i--:++i<a)&&t(e[i],i,e););return n?ta(e,r?0:i,r?i+1:a):ta(e,r?i+1:0,r?a:i)}function fa(e,t){var n=e;return n instanceof $n&&(n=n.value()),Rt(t,(function(e,t){return t.func.apply(t.thisArg,Ft([e],t.args))}),n)}function pa(e,t,n){var r=e.length;if(r<2)return r?sa(e[0]):[];for(var a=-1,i=ae(r);++a<r;)for(var o=e[a],u=-1;++u<r;)u!=a&&(i[a]=lr(i[a]||o,e[u],t,n));return sa(gr(i,1),t,n)}function ha(t,n,r){for(var a=-1,i=t.length,o=n.length,u={};++a<i;){var s=a<o?n[a]:e;r(u,t[a],s)}return u}function ga(e){return Ho(e)?e:[]}function ma(e){return"function"==typeof e?e:as}function va(e,t){return Wo(e)?e:yi(e,t)?[e]:Ui(_u(e))}var ya=Hr;function _a(t,n,r){var a=t.length;return r=r===e?a:r,!n&&r>=a?t:ta(t,n,r)}var ba=ut||function(e){return ft.clearTimeout(e)};function wa(e,t){if(t)return e.slice();var n=e.length,r=Le?Le(n):new e.constructor(n);return e.copy(r),r}function Ca(e){var t=new e.constructor(e.byteLength);return new Be(t).set(new Be(e)),t}function Sa(e,t){var n=t?Ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ia(t,n){if(t!==n){var r=t!==e,a=null===t,i=t==t,o=lu(t),u=n!==e,s=null===n,l=n==n,c=lu(n);if(!s&&!c&&!o&&t>n||o&&u&&l&&!s&&!c||a&&u&&l||!r&&l||!i)return 1;if(!a&&!o&&!c&&t<n||c&&r&&i&&!a&&!o||s&&r&&i||!u&&i||!l)return-1}return 0}function ka(e,t,n,r){for(var a=-1,i=e.length,o=n.length,u=-1,s=t.length,l=mn(i-o,0),c=ae(s+l),d=!r;++u<s;)c[u]=t[u];for(;++a<o;)(d||a<i)&&(c[n[a]]=e[a]);for(;l--;)c[u++]=e[a++];return c}function xa(e,t,n,r){for(var a=-1,i=e.length,o=-1,u=n.length,s=-1,l=t.length,c=mn(i-u,0),d=ae(c+l),f=!r;++a<c;)d[a]=e[a];for(var p=a;++s<l;)d[p+s]=t[s];for(;++o<u;)(f||a<i)&&(d[p+n[o]]=e[a++]);return d}function Da(e,t){var n=-1,r=e.length;for(t||(t=ae(r));++n<r;)t[n]=e[n];return t}function Va(t,n,r,a){var i=!r;r||(r={});for(var o=-1,u=n.length;++o<u;){var s=n[o],l=a?a(r[s],t[s],s,r,t):e;l===e&&(l=t[s]),i?rr(r,s,l):Xn(r,s,l)}return r}function Ta(e,t){return function(n,r){var a=Wo(n)?kt:tr,i=t?t():{};return a(n,e,oi(r,2),i)}}function Ea(t){return Hr((function(n,r){var a=-1,i=r.length,o=i>1?r[i-1]:e,u=i>2?r[2]:e;for(o=t.length>3&&"function"==typeof o?(i--,o):e,u&&vi(r[0],r[1],u)&&(o=i<3?e:o,i=1),n=ke(n);++a<i;){var s=r[a];s&&t(n,s,a,o)}return n}))}function Aa(e,t){return function(n,r){if(null==n)return n;if(!Go(n))return e(n,r);for(var a=n.length,i=t?a:-1,o=ke(n);(t?i--:++i<a)&&!1!==r(o[i],i,o););return n}}function Oa(e){return function(t,n,r){for(var a=-1,i=ke(t),o=r(t),u=o.length;u--;){var s=o[e?u:++a];if(!1===n(i[s],s,i))break}return t}}function Fa(t){return function(n){var r=an(n=_u(n))?dn(n):e,a=r?r[0]:n.charAt(0),i=r?_a(r,1).join(""):n.slice(1);return a[t]()+i}}function Ra(e){return function(t){return Rt(Zu(Lu(t).replace(Ye,"")),e,"")}}function ja(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Pn(e.prototype),r=e.apply(n,t);return tu(r)?r:n}}function Ua(t){return function(n,r,a){var i=ke(n);if(!Go(n)){var o=oi(r,3);n=Ou(n),r=function(e){return o(i[e],e,i)}}var u=t(n,r,a);return u>-1?i[o?n[u]:u]:e}}function qa(n){return ei((function(r){var a=r.length,i=a,o=zn.prototype.thru;for(n&&r.reverse();i--;){var u=r[i];if("function"!=typeof u)throw new Ve(t);if(o&&!s&&"wrapper"==ai(u))var s=new zn([],!0)}for(i=s?i:a;++i<a;){var l=ai(u=r[i]),c="wrapper"==l?ri(u):e;s=c&&_i(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?s[ai(c[0])].apply(s,c[3]):1==u.length&&_i(u)?s[l]():s.thru(u)}return function(){var e=arguments,t=e[0];if(s&&1==e.length&&Wo(t))return s.plant(t).value();for(var n=0,i=a?r[n].apply(this,e):t;++n<a;)i=r[n].call(this,i);return i}}))}function Na(t,n,r,a,o,u,s,l,c,d){var f=n&i,p=1&n,h=2&n,g=24&n,m=512&n,v=h?e:ja(t);return function i(){for(var y=arguments.length,_=ae(y),b=y;b--;)_[b]=arguments[b];if(g)var w=ii(i),C=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(_,w);if(a&&(_=ka(_,a,o,g)),u&&(_=xa(_,u,s,g)),y-=C,g&&y<d){var S=sn(_,w);return Wa(t,n,Na,i.placeholder,r,_,S,l,c,d-y)}var I=p?r:this,k=h?I[t]:t;return y=_.length,l?_=function(t,n){for(var r=t.length,a=vn(n.length,r),i=Da(t);a--;){var o=n[a];t[a]=mi(o,r)?i[o]:e}return t}(_,l):m&&y>1&&_.reverse(),f&&c<y&&(_.length=c),this&&this!==ft&&this instanceof i&&(k=v||ja(k)),k.apply(I,_)}}function Pa(e,t){return function(n,r){return function(e,t,n,r){return yr(e,(function(e,a,i){t(r,n(e),a,i)})),r}(n,e,t(r),{})}}function Ma(t,n){return function(r,a){var i;if(r===e&&a===e)return n;if(r!==e&&(i=r),a!==e){if(i===e)return a;"string"==typeof r||"string"==typeof a?(r=ua(r),a=ua(a)):(r=oa(r),a=oa(a)),i=t(r,a)}return i}}function za(e){return ei((function(t){return t=Ot(t,Kt(oi())),Hr((function(n){var r=this;return e(t,(function(e){return It(e,r,n)}))}))}))}function $a(t,n){var r=(n=n===e?" ":ua(n)).length;if(r<2)return r?Gr(n,t):n;var a=Gr(n,pt(t/cn(n)));return an(n)?_a(dn(a),0,t).join(""):a.slice(0,t)}function Ba(t){return function(n,r,a){return a&&"number"!=typeof a&&vi(n,r,a)&&(r=a=e),n=hu(n),r===e?(r=n,n=0):r=hu(r),function(e,t,n,r){for(var a=-1,i=mn(pt((t-e)/(n||1)),0),o=ae(i);i--;)o[r?i:++a]=e,e+=n;return o}(n,r,a=a===e?n<r?1:-1:hu(a),t)}}function La(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=vu(t),n=vu(n)),e(t,n)}}function Wa(t,n,r,i,o,u,s,l,c,d){var f=8&n;n|=f?a:64,4&(n&=~(f?64:a))||(n&=-4);var p=[t,n,o,f?u:e,f?s:e,f?e:u,f?e:s,l,c,d],h=r.apply(e,p);return _i(t)&&Di(h,p),h.placeholder=i,Ei(h,t,n)}function Ja(e){var t=Ie[e];return function(e,n){if(e=vu(e),(n=null==n?0:vn(gu(n),292))&&qt(e)){var r=(_u(e)+"e").split("e");return+((r=(_u(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Ga=kn&&1/ln(new kn([,-0]))[1]==u?function(e){return new kn(e)}:ls;function Ha(e){return function(t){var n=fi(t);return n==_?on(t):n==I?function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}(t):function(e,t){return Ot(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Qa(n,u,s,l,c,d,f,p){var h=2&u;if(!h&&"function"!=typeof n)throw new Ve(t);var g=l?l.length:0;if(g||(u&=-97,l=c=e),f=f===e?f:mn(gu(f),0),p=p===e?p:gu(p),g-=c?c.length:0,64&u){var m=l,v=c;l=c=e}var y=h?e:ri(n),_=[n,u,s,l,c,m,v,d,f,p];if(y&&function(e,t){var n=e[1],a=t[1],u=n|a,s=u<131,l=a==i&&8==n||a==i&&n==o&&e[7].length<=t[8]||384==a&&t[7].length<=t[8]&&8==n;if(!s&&!l)return e;1&a&&(e[2]=t[2],u|=1&n?0:4);var c=t[3];if(c){var d=e[3];e[3]=d?ka(d,c,t[4]):c,e[4]=d?sn(e[3],r):t[4]}(c=t[5])&&(d=e[5],e[5]=d?xa(d,c,t[6]):c,e[6]=d?sn(e[5],r):t[6]),(c=t[7])&&(e[7]=c),a&i&&(e[8]=null==e[8]?t[8]:vn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=u}(_,y),n=_[0],u=_[1],s=_[2],l=_[3],c=_[4],!(p=_[9]=_[9]===e?h?0:n.length:mn(_[9]-g,0))&&24&u&&(u&=-25),u&&1!=u)b=8==u||16==u?function(t,n,r){var a=ja(t);return function i(){for(var o=arguments.length,u=ae(o),s=o,l=ii(i);s--;)u[s]=arguments[s];var c=o<3&&u[0]!==l&&u[o-1]!==l?[]:sn(u,l);return(o-=c.length)<r?Wa(t,n,Na,i.placeholder,e,u,c,e,e,r-o):It(this&&this!==ft&&this instanceof i?a:t,this,u)}}(n,u,p):u!=a&&33!=u||c.length?Na.apply(e,_):function(e,t,n,r){var a=1&t,i=ja(e);return function t(){for(var o=-1,u=arguments.length,s=-1,l=r.length,c=ae(l+u),d=this&&this!==ft&&this instanceof t?i:e;++s<l;)c[s]=r[s];for(;u--;)c[s++]=arguments[++o];return It(d,a?n:this,c)}}(n,u,s,l);else var b=function(e,t,n){var r=1&t,a=ja(e);return function t(){return(this&&this!==ft&&this instanceof t?a:e).apply(r?n:this,arguments)}}(n,u,s);return Ei((y?Zr:Di)(b,_),n,u)}function Ka(t,n,r,a){return t===e||zo(t,Ae[r])&&!Re.call(a,r)?n:t}function Ya(t,n,r,a,i,o){return tu(t)&&tu(n)&&(o.set(n,t),Mr(t,n,e,Ya,o),o.delete(n)),t}function Za(t){return iu(t)?e:t}function Xa(t,n,r,a,i,o){var u=1&r,s=t.length,l=n.length;if(s!=l&&!(u&&l>s))return!1;var c=o.get(t),d=o.get(n);if(c&&d)return c==n&&d==t;var f=-1,p=!0,h=2&r?new Jn:e;for(o.set(t,n),o.set(n,t);++f<s;){var g=t[f],m=n[f];if(a)var v=u?a(m,g,f,n,t,o):a(g,m,f,t,n,o);if(v!==e){if(v)continue;p=!1;break}if(h){if(!Ut(n,(function(e,t){if(!Zt(h,t)&&(g===e||i(g,e,r,a,o)))return h.push(t)}))){p=!1;break}}else if(g!==m&&!i(g,m,r,a,o)){p=!1;break}}return o.delete(t),o.delete(n),p}function ei(t){return Ti(Ii(t,e,Wi),t+"")}function ti(e){return Cr(e,Ou,ci)}function ni(e){return Cr(e,Fu,di)}var ri=Vn?function(e){return Vn.get(e)}:ls;function ai(e){for(var t=e.name+"",n=Tn[t],r=Re.call(Tn,t)?n.length:0;r--;){var a=n[r],i=a.func;if(null==i||i==e)return a.name}return t}function ii(e){return(Re.call(Nn,"placeholder")?Nn:e).placeholder}function oi(){var e=Nn.iteratee||is;return e=e===is?Fr:e,arguments.length?e(arguments[0],arguments[1]):e}function ui(e,t){var n,r,a=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?a["string"==typeof t?"string":"hash"]:a.map}function si(e){for(var t=Ou(e),n=t.length;n--;){var r=t[n],a=e[r];t[n]=[r,a,Ci(a)]}return t}function li(t,n){var r=function(t,n){return null==t?e:t[n]}(t,n);return Or(r)?r:e}var ci=mt?function(e){return null==e?[]:(e=ke(e),Tt(mt(e),(function(t){return Ge.call(e,t)})))}:ms,di=mt?function(e){for(var t=[];e;)Ft(t,ci(e)),e=We(e);return t}:ms,fi=Sr;function pi(e,t,n){for(var r=-1,a=(t=va(t,e)).length,i=!1;++r<a;){var o=qi(t[r]);if(!(i=null!=e&&n(e,o)))break;e=e[o]}return i||++r!=a?i:!!(a=null==e?0:e.length)&&eu(a)&&mi(o,a)&&(Wo(e)||Lo(e))}function hi(e){return"function"!=typeof e.constructor||wi(e)?{}:Pn(We(e))}function gi(e){return Wo(e)||Lo(e)||!!(Qe&&e&&e[Qe])}function mi(e,t){var n=typeof e;return!!(t=null==t?s:t)&&("number"==n||"symbol"!=n&&ve.test(e))&&e>-1&&e%1==0&&e<t}function vi(e,t,n){if(!tu(n))return!1;var r=typeof t;return!!("number"==r?Go(n)&&mi(t,n.length):"string"==r&&t in n)&&zo(n[t],e)}function yi(e,t){if(Wo(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!lu(e))||X.test(e)||!Z.test(e)||null!=t&&e in ke(t)}function _i(e){var t=ai(e),n=Nn[t];if("function"!=typeof n||!(t in $n.prototype))return!1;if(e===n)return!0;var r=ri(n);return!!r&&e===r[0]}(Cn&&fi(new Cn(new ArrayBuffer(1)))!=T||Sn&&fi(new Sn)!=_||In&&fi(In.resolve())!=C||kn&&fi(new kn)!=I||xn&&fi(new xn)!=D)&&(fi=function(t){var n=Sr(t),r=n==w?t.constructor:e,a=r?Ni(r):"";if(a)switch(a){case En:return T;case An:return _;case On:return C;case Fn:return I;case Rn:return D}return n});var bi=Oe?Zo:vs;function wi(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ae)}function Ci(e){return e==e&&!tu(e)}function Si(t,n){return function(r){return null!=r&&r[t]===n&&(n!==e||t in ke(r))}}function Ii(t,n,r){return n=mn(n===e?t.length-1:n,0),function(){for(var e=arguments,a=-1,i=mn(e.length-n,0),o=ae(i);++a<i;)o[a]=e[n+a];a=-1;for(var u=ae(n+1);++a<n;)u[a]=e[a];return u[n]=r(o),It(t,this,u)}}function ki(e,t){return t.length<2?e:wr(e,ta(t,0,-1))}function xi(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Di=Ai(Zr),Vi=dt||function(e,t){return ft.setTimeout(e,t)},Ti=Ai(Xr);function Ei(e,t,n){var r=t+"";return Ti(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ie,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return xt(d,(function(n){var r="_."+n[0];t&n[1]&&!Et(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(oe);return t?t[1].split(ue):[]}(r),n)))}function Ai(t){var n=0,r=0;return function(){var a=yn(),i=16-(a-r);if(r=a,i>0){if(++n>=800)return arguments[0]}else n=0;return t.apply(e,arguments)}}function Oi(t,n){var r=-1,a=t.length,i=a-1;for(n=n===e?a:n;++r<n;){var o=Jr(r,i),u=t[o];t[o]=t[r],t[r]=u}return t.length=n,t}var Fi,Ri,ji,Ui=(Fi=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ee,(function(e,n,r,a){t.push(r?a.replace(ce,"$1"):n||e)})),t},Ri=jo(Fi,(function(e){return 500===ji.size&&ji.clear(),e})),ji=Ri.cache,Ri);function qi(e){if("string"==typeof e||lu(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ni(e){if(null!=e){try{return Fe.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Pi(e){if(e instanceof $n)return e.clone();var t=new zn(e.__wrapped__,e.__chain__);return t.__actions__=Da(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Mi=Hr((function(e,t){return Ho(e)?lr(e,gr(t,1,Ho,!0)):[]})),zi=Hr((function(t,n){var r=Ki(n);return Ho(r)&&(r=e),Ho(t)?lr(t,gr(n,1,Ho,!0),oi(r,2)):[]})),$i=Hr((function(t,n){var r=Ki(n);return Ho(r)&&(r=e),Ho(t)?lr(t,gr(n,1,Ho,!0),e,r):[]}));function Bi(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var a=null==n?0:gu(n);return a<0&&(a=mn(r+a,0)),Pt(e,oi(t,3),a)}function Li(t,n,r){var a=null==t?0:t.length;if(!a)return-1;var i=a-1;return r!==e&&(i=gu(r),i=r<0?mn(a+i,0):vn(i,a-1)),Pt(t,oi(n,3),i,!0)}function Wi(e){return null!=e&&e.length?gr(e,1):[]}function Ji(t){return t&&t.length?t[0]:e}var Gi=Hr((function(e){var t=Ot(e,ga);return t.length&&t[0]===e[0]?Dr(t):[]})),Hi=Hr((function(t){var n=Ki(t),r=Ot(t,ga);return n===Ki(r)?n=e:r.pop(),r.length&&r[0]===t[0]?Dr(r,oi(n,2)):[]})),Qi=Hr((function(t){var n=Ki(t),r=Ot(t,ga);return(n="function"==typeof n?n:e)&&r.pop(),r.length&&r[0]===t[0]?Dr(r,e,n):[]}));function Ki(t){var n=null==t?0:t.length;return n?t[n-1]:e}var Yi=Hr(Zi);function Zi(e,t){return e&&e.length&&t&&t.length?Lr(e,t):e}var Xi=ei((function(e,t){var n=null==e?0:e.length,r=ar(e,t);return Wr(e,Ot(t,(function(e){return mi(e,n)?+e:e})).sort(Ia)),r}));function eo(e){return null==e?e:wn.call(e)}var to=Hr((function(e){return sa(gr(e,1,Ho,!0))})),no=Hr((function(t){var n=Ki(t);return Ho(n)&&(n=e),sa(gr(t,1,Ho,!0),oi(n,2))})),ro=Hr((function(t){var n=Ki(t);return n="function"==typeof n?n:e,sa(gr(t,1,Ho,!0),e,n)}));function ao(e){if(!e||!e.length)return[];var t=0;return e=Tt(e,(function(e){if(Ho(e))return t=mn(e.length,t),!0})),Ht(t,(function(t){return Ot(e,Lt(t))}))}function io(t,n){if(!t||!t.length)return[];var r=ao(t);return null==n?r:Ot(r,(function(t){return It(n,e,t)}))}var oo=Hr((function(e,t){return Ho(e)?lr(e,t):[]})),uo=Hr((function(e){return pa(Tt(e,Ho))})),so=Hr((function(t){var n=Ki(t);return Ho(n)&&(n=e),pa(Tt(t,Ho),oi(n,2))})),lo=Hr((function(t){var n=Ki(t);return n="function"==typeof n?n:e,pa(Tt(t,Ho),e,n)})),co=Hr(ao),fo=Hr((function(t){var n=t.length,r=n>1?t[n-1]:e;return r="function"==typeof r?(t.pop(),r):e,io(t,r)}));function po(e){var t=Nn(e);return t.__chain__=!0,t}function ho(e,t){return t(e)}var go=ei((function(t){var n=t.length,r=n?t[0]:0,a=this.__wrapped__,i=function(e){return ar(e,t)};return!(n>1||this.__actions__.length)&&a instanceof $n&&mi(r)?((a=a.slice(r,+r+(n?1:0))).__actions__.push({func:ho,args:[i],thisArg:e}),new zn(a,this.__chain__).thru((function(t){return n&&!t.length&&t.push(e),t}))):this.thru(i)})),mo=Ta((function(e,t,n){Re.call(e,n)?++e[n]:rr(e,n,1)})),vo=Ua(Bi),yo=Ua(Li);function _o(e,t){return(Wo(e)?xt:cr)(e,oi(t,3))}function bo(e,t){return(Wo(e)?Dt:dr)(e,oi(t,3))}var wo=Ta((function(e,t,n){Re.call(e,n)?e[n].push(t):rr(e,n,[t])})),Co=Hr((function(e,t,n){var r=-1,a="function"==typeof t,i=Go(e)?ae(e.length):[];return cr(e,(function(e){i[++r]=a?It(t,e,n):Vr(e,t,n)})),i})),So=Ta((function(e,t,n){rr(e,n,t)}));function Io(e,t){return(Wo(e)?Ot:qr)(e,oi(t,3))}var ko=Ta((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),xo=Hr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&vi(e,t[0],t[1])?t=[]:n>2&&vi(t[0],t[1],t[2])&&(t=[t[0]]),$r(e,gr(t,1),[])})),Do=ct||function(){return ft.Date.now()};function Vo(t,n,r){return n=r?e:n,n=t&&null==n?t.length:n,Qa(t,i,e,e,e,e,n)}function To(n,r){var a;if("function"!=typeof r)throw new Ve(t);return n=gu(n),function(){return--n>0&&(a=r.apply(this,arguments)),n<=1&&(r=e),a}}var Eo=Hr((function(e,t,n){var r=1;if(n.length){var i=sn(n,ii(Eo));r|=a}return Qa(e,r,t,n,i)})),Ao=Hr((function(e,t,n){var r=3;if(n.length){var i=sn(n,ii(Ao));r|=a}return Qa(t,r,e,n,i)}));function Oo(n,r,a){var i,o,u,s,l,c,d=0,f=!1,p=!1,h=!0;if("function"!=typeof n)throw new Ve(t);function g(t){var r=i,a=o;return i=o=e,d=t,s=n.apply(a,r)}function m(t){var n=t-c;return c===e||n>=r||n<0||p&&t-d>=u}function v(){var e=Do();if(m(e))return y(e);l=Vi(v,function(e){var t=r-(e-c);return p?vn(t,u-(e-d)):t}(e))}function y(t){return l=e,h&&i?g(t):(i=o=e,s)}function _(){var t=Do(),n=m(t);if(i=arguments,o=this,c=t,n){if(l===e)return function(e){return d=e,l=Vi(v,r),f?g(e):s}(c);if(p)return ba(l),l=Vi(v,r),g(c)}return l===e&&(l=Vi(v,r)),s}return r=vu(r)||0,tu(a)&&(f=!!a.leading,u=(p="maxWait"in a)?mn(vu(a.maxWait)||0,r):u,h="trailing"in a?!!a.trailing:h),_.cancel=function(){l!==e&&ba(l),d=0,i=c=o=l=e},_.flush=function(){return l===e?s:y(Do())},_}var Fo=Hr((function(e,t){return sr(e,1,t)})),Ro=Hr((function(e,t,n){return sr(e,vu(t)||0,n)}));function jo(e,n){if("function"!=typeof e||null!=n&&"function"!=typeof n)throw new Ve(t);var r=function(){var t=arguments,a=n?n.apply(this,t):t[0],i=r.cache;if(i.has(a))return i.get(a);var o=e.apply(this,t);return r.cache=i.set(a,o)||i,o};return r.cache=new(jo.Cache||Wn),r}function Uo(e){if("function"!=typeof e)throw new Ve(t);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}jo.Cache=Wn;var qo=ya((function(e,t){var n=(t=1==t.length&&Wo(t[0])?Ot(t[0],Kt(oi())):Ot(gr(t,1),Kt(oi()))).length;return Hr((function(r){for(var a=-1,i=vn(r.length,n);++a<i;)r[a]=t[a].call(this,r[a]);return It(e,this,r)}))})),No=Hr((function(t,n){var r=sn(n,ii(No));return Qa(t,a,e,n,r)})),Po=Hr((function(t,n){var r=sn(n,ii(Po));return Qa(t,64,e,n,r)})),Mo=ei((function(t,n){return Qa(t,o,e,e,e,n)}));function zo(e,t){return e===t||e!=e&&t!=t}var $o=La(Ir),Bo=La((function(e,t){return e>=t})),Lo=Tr(/* @__PURE__ */function(){return arguments}())?Tr:function(e){return nu(e)&&Re.call(e,"callee")&&!Ge.call(e,"callee")},Wo=ae.isArray,Jo=yt?Kt(yt):function(e){return nu(e)&&Sr(e)==V};function Go(e){return null!=e&&eu(e.length)&&!Zo(e)}function Ho(e){return nu(e)&&Go(e)}var Qo=vt||vs,Ko=_t?Kt(_t):function(e){return nu(e)&&Sr(e)==g};function Yo(e){if(!nu(e))return!1;var t=Sr(e);return t==m||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!iu(e)}function Zo(e){if(!tu(e))return!1;var t=Sr(e);return t==v||t==y||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Xo(e){return"number"==typeof e&&e==gu(e)}function eu(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=s}function tu(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function nu(e){return null!=e&&"object"==typeof e}var ru=bt?Kt(bt):function(e){return nu(e)&&fi(e)==_};function au(e){return"number"==typeof e||nu(e)&&Sr(e)==b}function iu(e){if(!nu(e)||Sr(e)!=w)return!1;var t=We(e);if(null===t)return!0;var n=Re.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Fe.call(n)==Ne}var ou=wt?Kt(wt):function(e){return nu(e)&&Sr(e)==S},uu=Ct?Kt(Ct):function(e){return nu(e)&&fi(e)==I};function su(e){return"string"==typeof e||!Wo(e)&&nu(e)&&Sr(e)==k}function lu(e){return"symbol"==typeof e||nu(e)&&Sr(e)==x}var cu=St?Kt(St):function(e){return nu(e)&&eu(e.length)&&!!it[Sr(e)]},du=La(Ur),fu=La((function(e,t){return e<=t}));function pu(e){if(!e)return[];if(Go(e))return su(e)?dn(e):Da(e);if(Ke&&e[Ke])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Ke]());var t=fi(e);return(t==_?on:t==I?ln:zu)(e)}function hu(e){return e?(e=vu(e))===u||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function gu(e){var t=hu(e),n=t%1;return t==t?n?t-n:t:0}function mu(e){return e?ir(gu(e),0,c):0}function vu(e){if("number"==typeof e)return e;if(lu(e))return l;if(tu(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=tu(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Qt(e);var n=he.test(e);return n||me.test(e)?lt(e.slice(2),n?2:8):pe.test(e)?l:+e}function yu(e){return Va(e,Fu(e))}function _u(e){return null==e?"":ua(e)}var bu=Ea((function(e,t){if(wi(t)||Go(t))Va(t,Ou(t),e);else for(var n in t)Re.call(t,n)&&Xn(e,n,t[n])})),wu=Ea((function(e,t){Va(t,Fu(t),e)})),Cu=Ea((function(e,t,n,r){Va(t,Fu(t),e,r)})),Su=Ea((function(e,t,n,r){Va(t,Ou(t),e,r)})),Iu=ei(ar),ku=Hr((function(t,n){t=ke(t);var r=-1,a=n.length,i=a>2?n[2]:e;for(i&&vi(n[0],n[1],i)&&(a=1);++r<a;)for(var o=n[r],u=Fu(o),s=-1,l=u.length;++s<l;){var c=u[s],d=t[c];(d===e||zo(d,Ae[c])&&!Re.call(t,c))&&(t[c]=o[c])}return t})),xu=Hr((function(t){return t.push(e,Ya),It(ju,e,t)}));function Du(t,n,r){var a=null==t?e:wr(t,n);return a===e?r:a}function Vu(e,t){return null!=e&&pi(e,t,xr)}var Tu=Pa((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=qe.call(t)),e[t]=n}),ts(as)),Eu=Pa((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=qe.call(t)),Re.call(e,t)?e[t].push(n):e[t]=[n]}),oi),Au=Hr(Vr);function Ou(e){return Go(e)?Hn(e):Rr(e)}function Fu(e){return Go(e)?Hn(e,!0):jr(e)}var Ru=Ea((function(e,t,n){Mr(e,t,n)})),ju=Ea((function(e,t,n,r){Mr(e,t,n,r)})),Uu=ei((function(e,t){var n={};if(null==e)return n;var r=!1;t=Ot(t,(function(t){return t=va(t,e),r||(r=t.length>1),t})),Va(e,ni(e),n),r&&(n=or(n,7,Za));for(var a=t.length;a--;)la(n,t[a]);return n})),qu=ei((function(e,t){return null==e?{}:function(e,t){return Br(e,t,(function(t,n){return Vu(e,n)}))}(e,t)}));function Nu(e,t){if(null==e)return{};var n=Ot(ni(e),(function(e){return[e]}));return t=oi(t),Br(e,n,(function(e,n){return t(e,n[0])}))}var Pu=Ha(Ou),Mu=Ha(Fu);function zu(e){return null==e?[]:Yt(e,Ou(e))}var $u=Ra((function(e,t,n){return t=t.toLowerCase(),e+(n?Bu(t):t)}));function Bu(e){return Yu(_u(e).toLowerCase())}function Lu(e){return(e=_u(e))&&e.replace(ye,tn).replace(Ze,"")}var Wu=Ra((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Ju=Ra((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Gu=Fa("toLowerCase"),Hu=Ra((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Qu=Ra((function(e,t,n){return e+(n?" ":"")+Yu(t)})),Ku=Ra((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Yu=Fa("toUpperCase");function Zu(t,n,r){return t=_u(t),(n=r?e:n)===e?function(e){return nt.test(e)}(t)?function(e){return e.match(et)||[]}(t):function(e){return e.match(se)||[]}(t):t.match(n)||[]}var Xu=Hr((function(t,n){try{return It(t,e,n)}catch(r){return Yo(r)?r:new Ce(r)}})),es=ei((function(e,t){return xt(t,(function(t){t=qi(t),rr(e,t,Eo(e[t],e))})),e}));function ts(e){return function(){return e}}var ns=qa(),rs=qa(!0);function as(e){return e}function is(e){return Fr("function"==typeof e?e:or(e,1))}var os=Hr((function(e,t){return function(n){return Vr(n,e,t)}})),us=Hr((function(e,t){return function(n){return Vr(e,n,t)}}));function ss(e,t,n){var r=Ou(t),a=br(t,r);null!=n||tu(t)&&(a.length||!r.length)||(n=t,t=e,e=this,a=br(t,Ou(t)));var i=!(tu(n)&&"chain"in n&&!n.chain),o=Zo(e);return xt(a,(function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__);return(n.__actions__=Da(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Ft([this.value()],arguments))})})),e}function ls(){}var cs=za(Ot),ds=za(Vt),fs=za(Ut);function ps(e){return yi(e)?Lt(qi(e)):function(e){return function(t){return wr(t,e)}}(e)}var hs=Ba(),gs=Ba(!0);function ms(){return[]}function vs(){return!1}var ys,_s=Ma((function(e,t){return e+t}),0),bs=Ja("ceil"),ws=Ma((function(e,t){return e/t}),1),Cs=Ja("floor"),Ss=Ma((function(e,t){return e*t}),1),Is=Ja("round"),ks=Ma((function(e,t){return e-t}),0);return Nn.after=function(e,n){if("function"!=typeof n)throw new Ve(t);return e=gu(e),function(){if(--e<1)return n.apply(this,arguments)}},Nn.ary=Vo,Nn.assign=bu,Nn.assignIn=wu,Nn.assignInWith=Cu,Nn.assignWith=Su,Nn.at=Iu,Nn.before=To,Nn.bind=Eo,Nn.bindAll=es,Nn.bindKey=Ao,Nn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wo(e)?e:[e]},Nn.chain=po,Nn.chunk=function(t,n,r){n=(r?vi(t,n,r):n===e)?1:mn(gu(n),0);var a=null==t?0:t.length;if(!a||n<1)return[];for(var i=0,o=0,u=ae(pt(a/n));i<a;)u[o++]=ta(t,i,i+=n);return u},Nn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,a=[];++t<n;){var i=e[t];i&&(a[r++]=i)}return a},Nn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=ae(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Ft(Wo(n)?Da(n):[n],gr(t,1))},Nn.cond=function(e){var n=null==e?0:e.length,r=oi();return e=n?Ot(e,(function(e){if("function"!=typeof e[1])throw new Ve(t);return[r(e[0]),e[1]]})):[],Hr((function(t){for(var r=-1;++r<n;){var a=e[r];if(It(a[0],this,t))return It(a[1],this,t)}}))},Nn.conforms=function(e){return function(e){var t=Ou(e);return function(n){return ur(n,e,t)}}(or(e,1))},Nn.constant=ts,Nn.countBy=mo,Nn.create=function(e,t){var n=Pn(e);return null==t?n:nr(n,t)},Nn.curry=function t(n,r,a){var i=Qa(n,8,e,e,e,e,e,r=a?e:r);return i.placeholder=t.placeholder,i},Nn.curryRight=function t(n,r,a){var i=Qa(n,16,e,e,e,e,e,r=a?e:r);return i.placeholder=t.placeholder,i},Nn.debounce=Oo,Nn.defaults=ku,Nn.defaultsDeep=xu,Nn.defer=Fo,Nn.delay=Ro,Nn.difference=Mi,Nn.differenceBy=zi,Nn.differenceWith=$i,Nn.drop=function(t,n,r){var a=null==t?0:t.length;return a?ta(t,(n=r||n===e?1:gu(n))<0?0:n,a):[]},Nn.dropRight=function(t,n,r){var a=null==t?0:t.length;return a?ta(t,0,(n=a-(n=r||n===e?1:gu(n)))<0?0:n):[]},Nn.dropRightWhile=function(e,t){return e&&e.length?da(e,oi(t,3),!0,!0):[]},Nn.dropWhile=function(e,t){return e&&e.length?da(e,oi(t,3),!0):[]},Nn.fill=function(t,n,r,a){var i=null==t?0:t.length;return i?(r&&"number"!=typeof r&&vi(t,n,r)&&(r=0,a=i),function(t,n,r,a){var i=t.length;for((r=gu(r))<0&&(r=-r>i?0:i+r),(a=a===e||a>i?i:gu(a))<0&&(a+=i),a=r>a?0:mu(a);r<a;)t[r++]=n;return t}(t,n,r,a)):[]},Nn.filter=function(e,t){return(Wo(e)?Tt:hr)(e,oi(t,3))},Nn.flatMap=function(e,t){return gr(Io(e,t),1)},Nn.flatMapDeep=function(e,t){return gr(Io(e,t),u)},Nn.flatMapDepth=function(t,n,r){return r=r===e?1:gu(r),gr(Io(t,n),r)},Nn.flatten=Wi,Nn.flattenDeep=function(e){return null!=e&&e.length?gr(e,u):[]},Nn.flattenDepth=function(t,n){return null!=t&&t.length?gr(t,n=n===e?1:gu(n)):[]},Nn.flip=function(e){return Qa(e,512)},Nn.flow=ns,Nn.flowRight=rs,Nn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var a=e[t];r[a[0]]=a[1]}return r},Nn.functions=function(e){return null==e?[]:br(e,Ou(e))},Nn.functionsIn=function(e){return null==e?[]:br(e,Fu(e))},Nn.groupBy=wo,Nn.initial=function(e){return null!=e&&e.length?ta(e,0,-1):[]},Nn.intersection=Gi,Nn.intersectionBy=Hi,Nn.intersectionWith=Qi,Nn.invert=Tu,Nn.invertBy=Eu,Nn.invokeMap=Co,Nn.iteratee=is,Nn.keyBy=So,Nn.keys=Ou,Nn.keysIn=Fu,Nn.map=Io,Nn.mapKeys=function(e,t){var n={};return t=oi(t,3),yr(e,(function(e,r,a){rr(n,t(e,r,a),e)})),n},Nn.mapValues=function(e,t){var n={};return t=oi(t,3),yr(e,(function(e,r,a){rr(n,r,t(e,r,a))})),n},Nn.matches=function(e){return Nr(or(e,1))},Nn.matchesProperty=function(e,t){return Pr(e,or(t,1))},Nn.memoize=jo,Nn.merge=Ru,Nn.mergeWith=ju,Nn.method=os,Nn.methodOf=us,Nn.mixin=ss,Nn.negate=Uo,Nn.nthArg=function(e){return e=gu(e),Hr((function(t){return zr(t,e)}))},Nn.omit=Uu,Nn.omitBy=function(e,t){return Nu(e,Uo(oi(t)))},Nn.once=function(e){return To(2,e)},Nn.orderBy=function(t,n,r,a){return null==t?[]:(Wo(n)||(n=null==n?[]:[n]),Wo(r=a?e:r)||(r=null==r?[]:[r]),$r(t,n,r))},Nn.over=cs,Nn.overArgs=qo,Nn.overEvery=ds,Nn.overSome=fs,Nn.partial=No,Nn.partialRight=Po,Nn.partition=ko,Nn.pick=qu,Nn.pickBy=Nu,Nn.property=ps,Nn.propertyOf=function(t){return function(n){return null==t?e:wr(t,n)}},Nn.pull=Yi,Nn.pullAll=Zi,Nn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Lr(e,t,oi(n,2)):e},Nn.pullAllWith=function(t,n,r){return t&&t.length&&n&&n.length?Lr(t,n,e,r):t},Nn.pullAt=Xi,Nn.range=hs,Nn.rangeRight=gs,Nn.rearg=Mo,Nn.reject=function(e,t){return(Wo(e)?Tt:hr)(e,Uo(oi(t,3)))},Nn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,a=[],i=e.length;for(t=oi(t,3);++r<i;){var o=e[r];t(o,r,e)&&(n.push(o),a.push(r))}return Wr(e,a),n},Nn.rest=function(n,r){if("function"!=typeof n)throw new Ve(t);return Hr(n,r=r===e?r:gu(r))},Nn.reverse=eo,Nn.sampleSize=function(t,n,r){return n=(r?vi(t,n,r):n===e)?1:gu(n),(Wo(t)?Kn:Kr)(t,n)},Nn.set=function(e,t,n){return null==e?e:Yr(e,t,n)},Nn.setWith=function(t,n,r,a){return a="function"==typeof a?a:e,null==t?t:Yr(t,n,r,a)},Nn.shuffle=function(e){return(Wo(e)?Yn:ea)(e)},Nn.slice=function(t,n,r){var a=null==t?0:t.length;return a?(r&&"number"!=typeof r&&vi(t,n,r)?(n=0,r=a):(n=null==n?0:gu(n),r=r===e?a:gu(r)),ta(t,n,r)):[]},Nn.sortBy=xo,Nn.sortedUniq=function(e){return e&&e.length?ia(e):[]},Nn.sortedUniqBy=function(e,t){return e&&e.length?ia(e,oi(t,2)):[]},Nn.split=function(t,n,r){return r&&"number"!=typeof r&&vi(t,n,r)&&(n=r=e),(r=r===e?c:r>>>0)?(t=_u(t))&&("string"==typeof n||null!=n&&!ou(n))&&!(n=ua(n))&&an(t)?_a(dn(t),0,r):t.split(n,r):[]},Nn.spread=function(e,n){if("function"!=typeof e)throw new Ve(t);return n=null==n?0:mn(gu(n),0),Hr((function(t){var r=t[n],a=_a(t,0,n);return r&&Ft(a,r),It(e,this,a)}))},Nn.tail=function(e){var t=null==e?0:e.length;return t?ta(e,1,t):[]},Nn.take=function(t,n,r){return t&&t.length?ta(t,0,(n=r||n===e?1:gu(n))<0?0:n):[]},Nn.takeRight=function(t,n,r){var a=null==t?0:t.length;return a?ta(t,(n=a-(n=r||n===e?1:gu(n)))<0?0:n,a):[]},Nn.takeRightWhile=function(e,t){return e&&e.length?da(e,oi(t,3),!1,!0):[]},Nn.takeWhile=function(e,t){return e&&e.length?da(e,oi(t,3)):[]},Nn.tap=function(e,t){return t(e),e},Nn.throttle=function(e,n,r){var a=!0,i=!0;if("function"!=typeof e)throw new Ve(t);return tu(r)&&(a="leading"in r?!!r.leading:a,i="trailing"in r?!!r.trailing:i),Oo(e,n,{leading:a,maxWait:n,trailing:i})},Nn.thru=ho,Nn.toArray=pu,Nn.toPairs=Pu,Nn.toPairsIn=Mu,Nn.toPath=function(e){return Wo(e)?Ot(e,qi):lu(e)?[e]:Da(Ui(_u(e)))},Nn.toPlainObject=yu,Nn.transform=function(e,t,n){var r=Wo(e),a=r||Qo(e)||cu(e);if(t=oi(t,4),null==n){var i=e&&e.constructor;n=a?r?new i:[]:tu(e)&&Zo(i)?Pn(We(e)):{}}return(a?xt:yr)(e,(function(e,r,a){return t(n,e,r,a)})),n},Nn.unary=function(e){return Vo(e,1)},Nn.union=to,Nn.unionBy=no,Nn.unionWith=ro,Nn.uniq=function(e){return e&&e.length?sa(e):[]},Nn.uniqBy=function(e,t){return e&&e.length?sa(e,oi(t,2)):[]},Nn.uniqWith=function(t,n){return n="function"==typeof n?n:e,t&&t.length?sa(t,e,n):[]},Nn.unset=function(e,t){return null==e||la(e,t)},Nn.unzip=ao,Nn.unzipWith=io,Nn.update=function(e,t,n){return null==e?e:ca(e,t,ma(n))},Nn.updateWith=function(t,n,r,a){return a="function"==typeof a?a:e,null==t?t:ca(t,n,ma(r),a)},Nn.values=zu,Nn.valuesIn=function(e){return null==e?[]:Yt(e,Fu(e))},Nn.without=oo,Nn.words=Zu,Nn.wrap=function(e,t){return No(ma(t),e)},Nn.xor=uo,Nn.xorBy=so,Nn.xorWith=lo,Nn.zip=co,Nn.zipObject=function(e,t){return ha(e||[],t||[],Xn)},Nn.zipObjectDeep=function(e,t){return ha(e||[],t||[],Yr)},Nn.zipWith=fo,Nn.entries=Pu,Nn.entriesIn=Mu,Nn.extend=wu,Nn.extendWith=Cu,ss(Nn,Nn),Nn.add=_s,Nn.attempt=Xu,Nn.camelCase=$u,Nn.capitalize=Bu,Nn.ceil=bs,Nn.clamp=function(t,n,r){return r===e&&(r=n,n=e),r!==e&&(r=(r=vu(r))==r?r:0),n!==e&&(n=(n=vu(n))==n?n:0),ir(vu(t),n,r)},Nn.clone=function(e){return or(e,4)},Nn.cloneDeep=function(e){return or(e,5)},Nn.cloneDeepWith=function(t,n){return or(t,5,n="function"==typeof n?n:e)},Nn.cloneWith=function(t,n){return or(t,4,n="function"==typeof n?n:e)},Nn.conformsTo=function(e,t){return null==t||ur(e,t,Ou(t))},Nn.deburr=Lu,Nn.defaultTo=function(e,t){return null==e||e!=e?t:e},Nn.divide=ws,Nn.endsWith=function(t,n,r){t=_u(t),n=ua(n);var a=t.length,i=r=r===e?a:ir(gu(r),0,a);return(r-=n.length)>=0&&t.slice(r,i)==n},Nn.eq=zo,Nn.escape=function(e){return(e=_u(e))&&W.test(e)?e.replace(B,nn):e},Nn.escapeRegExp=function(e){return(e=_u(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Nn.every=function(t,n,r){var a=Wo(t)?Vt:fr;return r&&vi(t,n,r)&&(n=e),a(t,oi(n,3))},Nn.find=vo,Nn.findIndex=Bi,Nn.findKey=function(e,t){return Nt(e,oi(t,3),yr)},Nn.findLast=yo,Nn.findLastIndex=Li,Nn.findLastKey=function(e,t){return Nt(e,oi(t,3),_r)},Nn.floor=Cs,Nn.forEach=_o,Nn.forEachRight=bo,Nn.forIn=function(e,t){return null==e?e:mr(e,oi(t,3),Fu)},Nn.forInRight=function(e,t){return null==e?e:vr(e,oi(t,3),Fu)},Nn.forOwn=function(e,t){return e&&yr(e,oi(t,3))},Nn.forOwnRight=function(e,t){return e&&_r(e,oi(t,3))},Nn.get=Du,Nn.gt=$o,Nn.gte=Bo,Nn.has=function(e,t){return null!=e&&pi(e,t,kr)},Nn.hasIn=Vu,Nn.head=Ji,Nn.identity=as,Nn.includes=function(e,t,n,r){e=Go(e)?e:zu(e),n=n&&!r?gu(n):0;var a=e.length;return n<0&&(n=mn(a+n,0)),su(e)?n<=a&&e.indexOf(t,n)>-1:!!a&&Mt(e,t,n)>-1},Nn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var a=null==n?0:gu(n);return a<0&&(a=mn(r+a,0)),Mt(e,t,a)},Nn.inRange=function(t,n,r){return n=hu(n),r===e?(r=n,n=0):r=hu(r),function(e,t,n){return e>=vn(t,n)&&e<mn(t,n)}(t=vu(t),n,r)},Nn.invoke=Au,Nn.isArguments=Lo,Nn.isArray=Wo,Nn.isArrayBuffer=Jo,Nn.isArrayLike=Go,Nn.isArrayLikeObject=Ho,Nn.isBoolean=function(e){return!0===e||!1===e||nu(e)&&Sr(e)==h},Nn.isBuffer=Qo,Nn.isDate=Ko,Nn.isElement=function(e){return nu(e)&&1===e.nodeType&&!iu(e)},Nn.isEmpty=function(e){if(null==e)return!0;if(Go(e)&&(Wo(e)||"string"==typeof e||"function"==typeof e.splice||Qo(e)||cu(e)||Lo(e)))return!e.length;var t=fi(e);if(t==_||t==I)return!e.size;if(wi(e))return!Rr(e).length;for(var n in e)if(Re.call(e,n))return!1;return!0},Nn.isEqual=function(e,t){return Er(e,t)},Nn.isEqualWith=function(t,n,r){var a=(r="function"==typeof r?r:e)?r(t,n):e;return a===e?Er(t,n,e,r):!!a},Nn.isError=Yo,Nn.isFinite=function(e){return"number"==typeof e&&qt(e)},Nn.isFunction=Zo,Nn.isInteger=Xo,Nn.isLength=eu,Nn.isMap=ru,Nn.isMatch=function(e,t){return e===t||Ar(e,t,si(t))},Nn.isMatchWith=function(t,n,r){return r="function"==typeof r?r:e,Ar(t,n,si(n),r)},Nn.isNaN=function(e){return au(e)&&e!=+e},Nn.isNative=function(e){if(bi(e))throw new Ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Or(e)},Nn.isNil=function(e){return null==e},Nn.isNull=function(e){return null===e},Nn.isNumber=au,Nn.isObject=tu,Nn.isObjectLike=nu,Nn.isPlainObject=iu,Nn.isRegExp=ou,Nn.isSafeInteger=function(e){return Xo(e)&&e>=-9007199254740991&&e<=s},Nn.isSet=uu,Nn.isString=su,Nn.isSymbol=lu,Nn.isTypedArray=cu,Nn.isUndefined=function(t){return t===e},Nn.isWeakMap=function(e){return nu(e)&&fi(e)==D},Nn.isWeakSet=function(e){return nu(e)&&"[object WeakSet]"==Sr(e)},Nn.join=function(e,t){return null==e?"":Wt.call(e,t)},Nn.kebabCase=Wu,Nn.last=Ki,Nn.lastIndexOf=function(t,n,r){var a=null==t?0:t.length;if(!a)return-1;var i=a;return r!==e&&(i=(i=gu(r))<0?mn(a+i,0):vn(i,a-1)),n==n?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(t,n,i):Pt(t,$t,i,!0)},Nn.lowerCase=Ju,Nn.lowerFirst=Gu,Nn.lt=du,Nn.lte=fu,Nn.max=function(t){return t&&t.length?pr(t,as,Ir):e},Nn.maxBy=function(t,n){return t&&t.length?pr(t,oi(n,2),Ir):e},Nn.mean=function(e){return Bt(e,as)},Nn.meanBy=function(e,t){return Bt(e,oi(t,2))},Nn.min=function(t){return t&&t.length?pr(t,as,Ur):e},Nn.minBy=function(t,n){return t&&t.length?pr(t,oi(n,2),Ur):e},Nn.stubArray=ms,Nn.stubFalse=vs,Nn.stubObject=function(){return{}},Nn.stubString=function(){return""},Nn.stubTrue=function(){return!0},Nn.multiply=Ss,Nn.nth=function(t,n){return t&&t.length?zr(t,gu(n)):e},Nn.noConflict=function(){return ft._===this&&(ft._=Pe),this},Nn.noop=ls,Nn.now=Do,Nn.pad=function(e,t,n){e=_u(e);var r=(t=gu(t))?cn(e):0;if(!t||r>=t)return e;var a=(t-r)/2;return $a(ht(a),n)+e+$a(pt(a),n)},Nn.padEnd=function(e,t,n){e=_u(e);var r=(t=gu(t))?cn(e):0;return t&&r<t?e+$a(t-r,n):e},Nn.padStart=function(e,t,n){e=_u(e);var r=(t=gu(t))?cn(e):0;return t&&r<t?$a(t-r,n)+e:e},Nn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),_n(_u(e).replace(re,""),t||0)},Nn.random=function(t,n,r){if(r&&"boolean"!=typeof r&&vi(t,n,r)&&(n=r=e),r===e&&("boolean"==typeof n?(r=n,n=e):"boolean"==typeof t&&(r=t,t=e)),t===e&&n===e?(t=0,n=1):(t=hu(t),n===e?(n=t,t=0):n=hu(n)),t>n){var a=t;t=n,n=a}if(r||t%1||n%1){var i=bn();return vn(t+i*(n-t+st("1e-"+((i+"").length-1))),n)}return Jr(t,n)},Nn.reduce=function(e,t,n){var r=Wo(e)?Rt:Jt,a=arguments.length<3;return r(e,oi(t,4),n,a,cr)},Nn.reduceRight=function(e,t,n){var r=Wo(e)?jt:Jt,a=arguments.length<3;return r(e,oi(t,4),n,a,dr)},Nn.repeat=function(t,n,r){return n=(r?vi(t,n,r):n===e)?1:gu(n),Gr(_u(t),n)},Nn.replace=function(){var e=arguments,t=_u(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Nn.result=function(t,n,r){var a=-1,i=(n=va(n,t)).length;for(i||(i=1,t=e);++a<i;){var o=null==t?e:t[qi(n[a])];o===e&&(a=i,o=r),t=Zo(o)?o.call(t):o}return t},Nn.round=Is,Nn.runInContext=G,Nn.sample=function(e){return(Wo(e)?Qn:Qr)(e)},Nn.size=function(e){if(null==e)return 0;if(Go(e))return su(e)?cn(e):e.length;var t=fi(e);return t==_||t==I?e.size:Rr(e).length},Nn.snakeCase=Hu,Nn.some=function(t,n,r){var a=Wo(t)?Ut:na;return r&&vi(t,n,r)&&(n=e),a(t,oi(n,3))},Nn.sortedIndex=function(e,t){return ra(e,t)},Nn.sortedIndexBy=function(e,t,n){return aa(e,t,oi(n,2))},Nn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ra(e,t);if(r<n&&zo(e[r],t))return r}return-1},Nn.sortedLastIndex=function(e,t){return ra(e,t,!0)},Nn.sortedLastIndexBy=function(e,t,n){return aa(e,t,oi(n,2),!0)},Nn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ra(e,t,!0)-1;if(zo(e[n],t))return n}return-1},Nn.startCase=Qu,Nn.startsWith=function(e,t,n){return e=_u(e),n=null==n?0:ir(gu(n),0,e.length),t=ua(t),e.slice(n,n+t.length)==t},Nn.subtract=ks,Nn.sum=function(e){return e&&e.length?Gt(e,as):0},Nn.sumBy=function(e,t){return e&&e.length?Gt(e,oi(t,2)):0},Nn.template=function(t,n,r){var a=Nn.templateSettings;r&&vi(t,n,r)&&(n=e),t=_u(t),n=Cu({},n,a,Ka);var i,o,u=Cu({},n.imports,a.imports,Ka),s=Ou(u),l=Yt(u,s),c=0,d=n.interpolate||_e,f="__p += '",p=xe((n.escape||_e).source+"|"+d.source+"|"+(d===Y?de:_e).source+"|"+(n.evaluate||_e).source+"|$","g"),h="//# sourceURL="+(Re.call(n,"sourceURL")?(n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++at+"]")+"\n";t.replace(p,(function(e,n,r,a,u,s){return r||(r=a),f+=t.slice(c,s).replace(be,rn),n&&(i=!0,f+="' +\n__e("+n+") +\n'"),u&&(o=!0,f+="';\n"+u+";\n__p += '"),r&&(f+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),c=s+e.length,e})),f+="';\n";var g=Re.call(n,"variable")&&n.variable;if(g){if(le.test(g))throw new Ce("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(o?f.replace(P,""):f).replace(M,"$1").replace(z,"$1;"),f="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var m=Xu((function(){return Se(s,h+"return "+f).apply(e,l)}));if(m.source=f,Yo(m))throw m;return m},Nn.times=function(e,t){if((e=gu(e))<1||e>s)return[];var n=c,r=vn(e,c);t=oi(t),e-=c;for(var a=Ht(r,t);++n<e;)t(n);return a},Nn.toFinite=hu,Nn.toInteger=gu,Nn.toLength=mu,Nn.toLower=function(e){return _u(e).toLowerCase()},Nn.toNumber=vu,Nn.toSafeInteger=function(e){return e?ir(gu(e),-9007199254740991,s):0===e?e:0},Nn.toString=_u,Nn.toUpper=function(e){return _u(e).toUpperCase()},Nn.trim=function(t,n,r){if((t=_u(t))&&(r||n===e))return Qt(t);if(!t||!(n=ua(n)))return t;var a=dn(t),i=dn(n);return _a(a,Xt(a,i),en(a,i)+1).join("")},Nn.trimEnd=function(t,n,r){if((t=_u(t))&&(r||n===e))return t.slice(0,fn(t)+1);if(!t||!(n=ua(n)))return t;var a=dn(t);return _a(a,0,en(a,dn(n))+1).join("")},Nn.trimStart=function(t,n,r){if((t=_u(t))&&(r||n===e))return t.replace(re,"");if(!t||!(n=ua(n)))return t;var a=dn(t);return _a(a,Xt(a,dn(n))).join("")},Nn.truncate=function(t,n){var r=30,a="...";if(tu(n)){var i="separator"in n?n.separator:i;r="length"in n?gu(n.length):r,a="omission"in n?ua(n.omission):a}var o=(t=_u(t)).length;if(an(t)){var u=dn(t);o=u.length}if(r>=o)return t;var s=r-cn(a);if(s<1)return a;var l=u?_a(u,0,s).join(""):t.slice(0,s);if(i===e)return l+a;if(u&&(s+=l.length-s),ou(i)){if(t.slice(s).search(i)){var c,d=l;for(i.global||(i=xe(i.source,_u(fe.exec(i))+"g")),i.lastIndex=0;c=i.exec(d);)var f=c.index;l=l.slice(0,f===e?s:f)}}else if(t.indexOf(ua(i),s)!=s){var p=l.lastIndexOf(i);p>-1&&(l=l.slice(0,p))}return l+a},Nn.unescape=function(e){return(e=_u(e))&&L.test(e)?e.replace($,pn):e},Nn.uniqueId=function(e){var t=++je;return _u(e)+t},Nn.upperCase=Ku,Nn.upperFirst=Yu,Nn.each=_o,Nn.eachRight=bo,Nn.first=Ji,ss(Nn,(ys={},yr(Nn,(function(e,t){Re.call(Nn.prototype,t)||(ys[t]=e)})),ys),{chain:!1}),Nn.VERSION="4.17.21",xt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Nn[e].placeholder=Nn})),xt(["drop","take"],(function(t,n){$n.prototype[t]=function(r){r=r===e?1:mn(gu(r),0);var a=this.__filtered__&&!n?new $n(this):this.clone();return a.__filtered__?a.__takeCount__=vn(r,a.__takeCount__):a.__views__.push({size:vn(r,c),type:t+(a.__dir__<0?"Right":"")}),a},$n.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),xt(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;$n.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oi(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),xt(["head","last"],(function(e,t){var n="take"+(t?"Right":"");$n.prototype[e]=function(){return this[n](1).value()[0]}})),xt(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");$n.prototype[e]=function(){return this.__filtered__?new $n(this):this[n](1)}})),$n.prototype.compact=function(){return this.filter(as)},$n.prototype.find=function(e){return this.filter(e).head()},$n.prototype.findLast=function(e){return this.reverse().find(e)},$n.prototype.invokeMap=Hr((function(e,t){return"function"==typeof e?new $n(this):this.map((function(n){return Vr(n,e,t)}))})),$n.prototype.reject=function(e){return this.filter(Uo(oi(e)))},$n.prototype.slice=function(t,n){t=gu(t);var r=this;return r.__filtered__&&(t>0||n<0)?new $n(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),n!==e&&(r=(n=gu(n))<0?r.dropRight(-n):r.take(n-t)),r)},$n.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},$n.prototype.toArray=function(){return this.take(c)},yr($n.prototype,(function(t,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),a=/^(?:head|last)$/.test(n),i=Nn[a?"take"+("last"==n?"Right":""):n],o=a||/^find/.test(n);i&&(Nn.prototype[n]=function(){var n=this.__wrapped__,u=a?[1]:arguments,s=n instanceof $n,l=u[0],c=s||Wo(n),d=function(e){var t=i.apply(Nn,Ft([e],u));return a&&f?t[0]:t};c&&r&&"function"==typeof l&&1!=l.length&&(s=c=!1);var f=this.__chain__,p=!!this.__actions__.length,h=o&&!f,g=s&&!p;if(!o&&c){n=g?n:new $n(this);var m=t.apply(n,u);return m.__actions__.push({func:ho,args:[d],thisArg:e}),new zn(m,f)}return h&&g?t.apply(this,u):(m=this.thru(d),h?a?m.value()[0]:m.value():m)})})),xt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Te[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Nn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var a=this.value();return t.apply(Wo(a)?a:[],e)}return this[n]((function(n){return t.apply(Wo(n)?n:[],e)}))}})),yr($n.prototype,(function(e,t){var n=Nn[t];if(n){var r=n.name+"";Re.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Na(e,2).name]=[{name:"wrapper",func:e}],$n.prototype.clone=function(){var e=new $n(this.__wrapped__);return e.__actions__=Da(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Da(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Da(this.__views__),e},$n.prototype.reverse=function(){if(this.__filtered__){var e=new $n(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},$n.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wo(e),r=t<0,a=n?e.length:0,i=function(e,t,n){for(var r=-1,a=n.length;++r<a;){var i=n[r],o=i.size;switch(i.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=vn(t,e+o);break;case"takeRight":e=mn(e,t-o)}}return{start:e,end:t}}(0,a,this.__views__),o=i.start,u=i.end,s=u-o,l=r?u:o-1,c=this.__iteratees__,d=c.length,f=0,p=vn(s,this.__takeCount__);if(!n||!r&&a==s&&p==s)return fa(e,this.__actions__);var h=[];e:for(;s--&&f<p;){for(var g=-1,m=e[l+=t];++g<d;){var v=c[g],y=v.iteratee,_=v.type,b=y(m);if(2==_)m=b;else if(!b){if(1==_)continue e;break e}}h[f++]=m}return h},Nn.prototype.at=go,Nn.prototype.chain=function(){return po(this)},Nn.prototype.commit=function(){return new zn(this.value(),this.__chain__)},Nn.prototype.next=function(){this.__values__===e&&(this.__values__=pu(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?e:this.__values__[this.__index__++]}},Nn.prototype.plant=function(t){for(var n,r=this;r instanceof Mn;){var a=Pi(r);a.__index__=0,a.__values__=e,n?i.__wrapped__=a:n=a;var i=a;r=r.__wrapped__}return i.__wrapped__=t,n},Nn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof $n){var n=t;return this.__actions__.length&&(n=new $n(this)),(n=n.reverse()).__actions__.push({func:ho,args:[eo],thisArg:e}),new zn(n,this.__chain__)}return this.thru(eo)},Nn.prototype.toJSON=Nn.prototype.valueOf=Nn.prototype.value=function(){return fa(this.__wrapped__,this.__actions__)},Nn.prototype.first=Nn.prototype.head,Ke&&(Nn.prototype[Ke]=function(){return this}),Nn}();ht?((ht.exports=hn)._=hn,pt._=hn):ft._=hn}.call(H.exports)),H.exports);const Z=e({name:"ComponentRegistration",props:{course:{type:String,required:!0}},data:()=>({dataShapes:[],questions:[],courseDatashapes:[],courseQuestionTypes:[],courseConfig:void 0,courseDB:null}),async created(){this.courseDB=D().getCourseDB(this.course),this.courseConfig=await this.courseDB.getCourseConfig(),this.courseDatashapes=this.courseConfig.dataShapes,this.courseQuestionTypes=this.courseConfig.questionTypes;const e=b.allDataShapes();b.allDataShapesRaw().forEach((e=>{console.log(`[ComponentRegistration] Datashape:\n${JSON.stringify(e)}`)})),e.forEach((e=>{const t=this.courseDatashapes.find((t=>t.name===O.getDataShapeString(e)));this.dataShapes.push({name:e.dataShape,course:e.course,dataShape:b.getDataShape(e),registered:void 0!==t,displayable:e.displayable})})),this.dataShapes=Y.sortBy(this.dataShapes,["registered","name"]);const t=b.courses.map((e=>e.name)),n=[];t.forEach((e=>{b.getCourseWare(e).questions.forEach((t=>{n.push([{course:e,questionType:t.name},t])}))})),n.forEach((e=>{const t=this.courseQuestionTypes.find((t=>O.getQuestionString(e[0])===t.name));this.questions.push({course:e[0].course,name:e[1].name,registered:void 0!==t,question:e[1]})}))},methods:{async registerShape(e){const t=this.dataShapes.find((t=>t.name===e));this.courseConfig.dataShapes.push({name:O.getDataShapeString({dataShape:t.name,course:t.course}),questionTypes:[]});(await this.courseDB.updateCourseConfig(this.courseConfig)).ok&&(t.registered=!0)},async registerQuestionView(e){const t=this.questions.find((t=>t.name===e)),n=O.getQuestionString({course:t.course,questionType:t.name});this.courseConfig.questionTypes.push({name:n,viewList:t.question.views.map((e=>e.name?e.name:"unnamedComponent")),dataShapeList:t.question.dataShapes.map((e=>O.getDataShapeString({course:t.course,dataShape:e.name})))}),t.question.dataShapes.forEach((e=>{const r=O.getDataShapeString({course:t.course,dataShape:e.name});for(const t of this.courseConfig.dataShapes)t.name===r&&t.questionTypes.push(n)}));const r=await this.courseDB.updateCourseConfig(this.courseConfig),a=await P();r.ok&&(t.registered=!0,console.log(`[ComponentRegistration]\nQuestion: ${JSON.stringify(t)}\nCourseID: ${this.course}\n `),t.question.seedData?(console.log("[ComponentRegistration] Question has seed data!"),t.question.seedData.forEach((e=>{this.courseDB.addNote(t.course,t.question.dataShapes[0],e,a.getUsername(),[])}))):console.log("[ComponentRegistration] Question has NO seed data!"))}}}),X=(e,t)=>{const n=e.__vccOpts||e;for(const[r,a]of t)n[r]=a;return n},ee={key:1,class:"inset"},te={key:0},ne={key:1,class:"inset"};const re=/* @__PURE__ */X(Z,[["render",function(e,f,p,h,g,m){const v=t("v-btn");return r(),n("div",null,[f[2]||(f[2]=a("h3",null,"DataShapes",-1)),a("ul",null,[(r(!0),n(i,null,o(e.dataShapes,(t=>(r(),n("li",{key:t.name,class:"ma-2"},[t.registered?(r(),n("span",ee," (Registered) ")):(r(),u(v,{key:0,size:"small",onClick:n=>e.registerShape(t.name)},{default:l((()=>f[0]||(f[0]=[s(" Register ")]))),_:2},1032,["onClick"])),s(" "+c(t.name)+" ",1),a("ul",null,[(r(!0),n(i,null,o(t.dataShape.views,(e=>(r(),n("div",{key:e.name},[e?(r(),n("li",te,c(e.name),1)):d("",!0)])))),128))])])))),128))]),f[3]||(f[3]=a("h3",null,"Questions",-1)),a("ul",null,[(r(!0),n(i,null,o(e.questions,(t=>(r(),n("li",{key:t.name,class:"ma-2"},[t.registered?(r(),n("span",ne," (Registered) ")):(r(),u(v,{key:0,size:"small",onClick:n=>e.registerQuestionView(t.name)},{default:l((()=>f[1]||(f[1]=[s(" Register ")]))),_:2},1032,["onClick"])),s(" "+c(t.name),1)])))),128))])])}],["__scopeId","data-v-c01bca96"]]),ae=e({name:"NavigationStrategyList",props:{strategies:{type:Array,required:!0},defaultStrategyId:{type:String,default:null}},emits:["edit","delete","update:defaultStrategy"],methods:{getDisplayConfig(e){if(!e.serializedData)return"No configuration";try{const t=JSON.parse(e.serializedData);return Array.isArray(t)?`${t.length} cards in sequence`:Object.keys(t).map((e=>`${e}: ${t[e]}`)).join(", ")}catch{return e.serializedData}}}}),ie={class:"navigation-strategy-list"},oe={key:0},ue={class:"d-flex"};const se=/* @__PURE__ */X(ae,[["render",function(e,p,h,g,m,v){const y=t("v-radio"),_=t("v-list-item-title"),b=t("v-list-item-subtitle"),w=t("v-icon"),C=t("v-btn"),S=t("v-list-item"),I=t("v-list"),k=t("v-radio-group");return r(),n("div",ie,[f(k,{"model-value":e.defaultStrategyId,"onUpdate:modelValue":p[0]||(p[0]=t=>e.$emit("update:defaultStrategy",t)),density:"compact"},{default:l((()=>[f(I,{density:"compact"},{default:l((()=>[(r(!0),n(i,null,o(e.strategies,(t=>(r(),u(S,{key:t._id,lines:"two"},{prepend:l((()=>[f(y,{value:t._id},null,8,["value"])])),append:l((()=>[a("div",ue,[f(C,{icon:"",size:"x-small",variant:"text",title:"Edit Strategy",onClick:n=>e.$emit("edit",t)},{default:l((()=>[f(w,{size:"small"},{default:l((()=>p[1]||(p[1]=[s("mdi-pencil")]))),_:1})])),_:2},1032,["onClick"]),f(C,{icon:"",size:"x-small",variant:"text",title:"Delete Strategy",onClick:n=>e.$emit("delete",t)},{default:l((()=>[f(w,{size:"small"},{default:l((()=>p[2]||(p[2]=[s("mdi-delete")]))),_:1})])),_:2},1032,["onClick"])])])),default:l((()=>[f(_,{class:"text-subtitle-2"},{default:l((()=>[s(c(t.name),1)])),_:2},1024),f(b,{class:"text-caption"},{default:l((()=>[s(c(t.implementingClass)+" ",1),t.description?(r(),n("span",oe," • "+c(t.description),1)):d("",!0)])),_:2},1024)])),_:2},1024)))),128))])),_:1})])),_:1},8,["model-value"])])}],["__scopeId","data-v-1fcb2a5f"]]),le=e({name:"HierarchyConfigForm",props:{modelValue:{type:Object,required:!0},courseId:{type:String,required:!0}},emits:["update:modelValue"],setup(e,{emit:t}){const n=p("ui"),r=p([]),a=p(null),i=p(null),o=p(!0),u=h((()=>e.modelValue)),s=h((()=>{try{return JSON.stringify(u.value,null,2)}catch{return""}}));return g((()=>{!async function(){o.value=!0;try{const t=D().getCourseDB(e.courseId),n=await t.getCourseTagStubs();r.value=n.rows.map((e=>e.id.replace("TAG-",""))),console.log("Loaded tags:",r.value)}catch(t){console.error("Failed to load course tags:",t),a.value="Failed to load course tags"}finally{o.value=!1}}()})),m((()=>u.value),(()=>{!function(){a.value=null;try{if(!u.value.prerequisites||"object"!=typeof u.value.prerequisites)throw new Error("Prerequisites must be an object");new Set(Object.keys(u.value.prerequisites));for(const[e,t]of Object.entries(u.value.prerequisites))for(const n of t)if(n.tag===e)throw new Error(`Circular dependency: ${e} requires itself`);return!0}catch(e){return a.value=e instanceof Error?e.message:"Invalid configuration",!1}}()}),{deep:!0}),{inputMode:n,config:u,availableTags:r,loadingTags:o,jsonText:s,jsonError:i,validationError:a,addPrerequisiteRule:function(){const e=r.value[0]||"new-tag";t("update:modelValue",{...u.value,prerequisites:{...u.value.prerequisites,[e]:[]}})},removePrerequisiteRule:function(e){const n={...u.value.prerequisites};delete n[e],t("update:modelValue",{...u.value,prerequisites:n})},renamePrerequisiteTag:function(e,n){if(e===n)return;const r={...u.value.prerequisites};r[n]=r[e],delete r[e],t("update:modelValue",{...u.value,prerequisites:r})},addPrerequisite:function(e){const n=r.value.find((t=>t!==e))||"prerequisite-tag",a={...u.value.prerequisites};a[e]=[...a[e],{tag:n,masteryThreshold:{minCount:3}}],t("update:modelValue",{...u.value,prerequisites:a})},removePrerequisite:function(e,n){const r={...u.value.prerequisites};r[e]=r[e].filter(((e,t)=>t!==n)),t("update:modelValue",{...u.value,prerequisites:r})},updatePrerequisiteTag:function(e,n,r){const a={...u.value.prerequisites};a[e][n]={...a[e][n],tag:r},t("update:modelValue",{...u.value,prerequisites:a})},updateMinCount:function(e,n,r){const a="string"==typeof r?parseInt(r):r;if(isNaN(a))return;const i={...u.value.prerequisites},o=i[e][n];i[e][n]={...o,masteryThreshold:{...o.masteryThreshold,minCount:a}},t("update:modelValue",{...u.value,prerequisites:i})},updateMinElo:function(e,n,r){if(""===r||null==r){const r={...u.value.prerequisites},a=r[e][n],i={...a.masteryThreshold};return delete i.minElo,r[e][n]={...a,masteryThreshold:i},void t("update:modelValue",{...u.value,prerequisites:r})}const a="string"==typeof r?parseInt(r):r;if(isNaN(a))return;const i={...u.value.prerequisites},o=i[e][n];i[e][n]={...o,masteryThreshold:{...o.masteryThreshold,minElo:a}},t("update:modelValue",{...u.value,prerequisites:i})},updateFromJson:function(e){i.value=null;try{const n=JSON.parse(e);if(!n.prerequisites||"object"!=typeof n.prerequisites)throw new Error('Config must have "prerequisites" object');t("update:modelValue",n)}catch(n){i.value=n instanceof Error?n.message:"Invalid JSON"}}}}}),ce={class:"hierarchy-config-form"},de={class:"prerequisites-section"},fe={class:"d-flex align-center mb-2"},pe={class:"d-flex align-center mb-2"};const he=/* @__PURE__ */X(le,[["render",function(e,p,h,g,m,v){const y=t("v-tab"),_=t("v-tabs"),b=t("v-spacer"),w=t("v-icon"),C=t("v-btn"),S=t("v-alert"),I=t("v-select"),k=t("v-divider"),x=t("v-text-field"),D=t("v-card"),V=t("v-window-item"),T=t("v-textarea"),E=t("v-window");return r(),n("div",ce,[f(_,{modelValue:e.inputMode,"onUpdate:modelValue":p[0]||(p[0]=t=>e.inputMode=t),density:"compact",class:"mb-4"},{default:l((()=>[f(y,{value:"ui"},{default:l((()=>p[2]||(p[2]=[s("Visual Editor")]))),_:1}),f(y,{value:"json"},{default:l((()=>p[3]||(p[3]=[s("JSON Editor")]))),_:1})])),_:1},8,["modelValue"]),f(E,{modelValue:e.inputMode,"onUpdate:modelValue":p[1]||(p[1]=t=>e.inputMode=t)},{default:l((()=>[f(V,{value:"ui"},{default:l((()=>[a("div",de,[a("div",fe,[p[6]||(p[6]=a("h4",{class:"text-subtitle-1"},"Prerequisites",-1)),f(b),f(C,{size:"small",color:"primary",onClick:e.addPrerequisiteRule},{default:l((()=>[f(w,{start:""},{default:l((()=>p[4]||(p[4]=[s("mdi-plus")]))),_:1}),p[5]||(p[5]=s(" Add Rule "))])),_:1},8,["onClick"])]),0===Object.keys(e.config.prerequisites).length?(r(),u(S,{key:0,type:"info",density:"compact"},{default:l((()=>p[7]||(p[7]=[s(' No prerequisites defined. Click "Add Rule" to gate a tag behind prerequisite mastery. ')]))),_:1})):d("",!0),(r(!0),n(i,null,o(e.config.prerequisites,((t,c)=>(r(),u(D,{key:c,variant:"outlined",class:"mb-3 pa-3"},{default:l((()=>[a("div",pe,[f(I,{"model-value":c,"onUpdate:modelValue":t=>e.renamePrerequisiteTag(c,t),items:e.availableTags,loading:e.loadingTags,disabled:e.loadingTags,label:"Gated Tag",hint:"This tag will be locked until prerequisites are met","persistent-hint":"",density:"compact",style:{"max-width":"300px"}},null,8,["model-value","onUpdate:modelValue","items","loading","disabled"]),f(b),f(C,{icon:"",size:"small",color:"error",onClick:t=>e.removePrerequisiteRule(c)},{default:l((()=>[f(w,null,{default:l((()=>p[8]||(p[8]=[s("mdi-delete")]))),_:1})])),_:2},1032,["onClick"])]),f(k,{class:"my-2"}),p[12]||(p[12]=a("div",{class:"text-caption mb-2"},"Requires mastery of:",-1)),(r(!0),n(i,null,o(t,((t,a)=>(r(),n("div",{key:`${c}-${a}`,class:"d-flex align-center gap-2 mb-2"},[f(I,{"model-value":t.tag,"onUpdate:modelValue":t=>e.updatePrerequisiteTag(c,a,t),items:e.availableTags,loading:e.loadingTags,disabled:e.loadingTags,label:"Prerequisite Tag",density:"compact",style:{flex:"1","max-width":"200px"}},null,8,["model-value","onUpdate:modelValue","items","loading","disabled"]),f(x,{"model-value":t.masteryThreshold?.minCount,"onUpdate:modelValue":t=>e.updateMinCount(c,a,t),label:"Min Count",type:"number",density:"compact",style:{"max-width":"100px"},hint:"Min interactions","persistent-hint":""},null,8,["model-value","onUpdate:modelValue"]),f(x,{"model-value":t.masteryThreshold?.minElo,"onUpdate:modelValue":t=>e.updateMinElo(c,a,t),label:"Min ELO",type:"number",density:"compact",style:{"max-width":"100px"},hint:"Optional","persistent-hint":""},null,8,["model-value","onUpdate:modelValue"]),f(C,{icon:"",size:"small",onClick:t=>e.removePrerequisite(c,a)},{default:l((()=>[f(w,null,{default:l((()=>p[9]||(p[9]=[s("mdi-minus-circle")]))),_:1})])),_:2},1032,["onClick"])])))),128)),f(C,{size:"small",variant:"text",onClick:t=>e.addPrerequisite(c)},{default:l((()=>[f(w,{start:""},{default:l((()=>p[10]||(p[10]=[s("mdi-plus")]))),_:1}),p[11]||(p[11]=s(" Add Prerequisite "))])),_:2},1032,["onClick"])])),_:2},1024)))),128))])])),_:1}),f(V,{value:"json"},{default:l((()=>[f(T,{"model-value":e.jsonText,"onUpdate:modelValue":e.updateFromJson,label:"Configuration JSON",rows:"15",placeholder:'{"prerequisites": {"cvc-words": [{"tag": "letter-sounds", "masteryThreshold": {"minCount": 10}}]}}',hint:"Paste or edit JSON configuration directly","persistent-hint":"","auto-grow":""},null,8,["model-value","onUpdate:modelValue"]),e.jsonError?(r(),u(S,{key:0,type:"error",density:"compact",class:"mt-2"},{default:l((()=>[s(c(e.jsonError),1)])),_:1})):e.jsonText?(r(),u(S,{key:1,type:"success",density:"compact",class:"mt-2"},{default:l((()=>p[13]||(p[13]=[s(" Valid configuration ")]))),_:1})):d("",!0)])),_:1})])),_:1},8,["modelValue"]),e.validationError?(r(),u(S,{key:0,type:"error",density:"compact",class:"mt-3"},{default:l((()=>[s(c(e.validationError),1)])),_:1})):d("",!0)])}],["__scopeId","data-v-470885e1"]]),ge=e({name:"InterferenceConfigForm",props:{modelValue:{type:Object,required:!0},courseId:{type:String,required:!0}},emits:["update:modelValue"],setup(e,{emit:t}){const n=p("ui"),r=p([]),a=p(null),i=p(null),o=p(!0),u=h((()=>e.modelValue)),s=h((()=>{try{return JSON.stringify(u.value,null,2)}catch{return""}}));return g((()=>{!async function(){o.value=!0;try{const t=D().getCourseDB(e.courseId),n=await t.getCourseTagStubs();r.value=n.rows.map((e=>e.id.replace("TAG-","")))}catch(t){console.error("Failed to load course tags:",t),a.value="Failed to load course tags"}finally{o.value=!1}}()})),m((()=>u.value),(()=>{!function(){a.value=null;try{if(!u.value.interferenceSets||!Array.isArray(u.value.interferenceSets))throw new Error("Interference sets must be an array");for(const e of u.value.interferenceSets){if(!Array.isArray(e.tags)||e.tags.length<2)throw new Error("Each interference group must have at least 2 tags");if(void 0!==e.decay&&(e.decay<0||e.decay>1))throw new Error("Decay values must be between 0 and 1")}return!0}catch(e){return a.value=e instanceof Error?e.message:"Invalid configuration",!1}}()}),{deep:!0}),{inputMode:n,config:u,availableTags:r,loadingTags:o,jsonText:s,jsonError:i,validationError:a,updateMinCount:function(e){const n="string"==typeof e?parseInt(e):e;isNaN(n)||t("update:modelValue",{...u.value,maturityThreshold:{...u.value.maturityThreshold,minCount:n}})},updateMinElo:function(e){if(""===e||null==e){const e={...u.value.maturityThreshold};return delete e.minElo,void t("update:modelValue",{...u.value,maturityThreshold:e})}const n="string"==typeof e?parseInt(e):e;isNaN(n)||t("update:modelValue",{...u.value,maturityThreshold:{...u.value.maturityThreshold,minElo:n}})},updateMinElapsedDays:function(e){const n="string"==typeof e?parseInt(e):e;isNaN(n)||t("update:modelValue",{...u.value,maturityThreshold:{...u.value.maturityThreshold,minElapsedDays:n}})},updateDefaultDecay:function(e){const n="string"==typeof e?parseFloat(e):e;isNaN(n)||t("update:modelValue",{...u.value,defaultDecay:Math.max(0,Math.min(1,n))})},addInterferenceGroup:function(){t("update:modelValue",{...u.value,interferenceSets:[...u.value.interferenceSets,{tags:[],decay:u.value.defaultDecay||.8}]})},removeInterferenceGroup:function(e){t("update:modelValue",{...u.value,interferenceSets:u.value.interferenceSets.filter(((t,n)=>n!==e))})},updateGroupTags:function(e,n){const r=[...u.value.interferenceSets];r[e]={...r[e],tags:n},t("update:modelValue",{...u.value,interferenceSets:r})},updateGroupDecay:function(e,n){const r="string"==typeof n?parseFloat(n):n;if(isNaN(r))return;const a=[...u.value.interferenceSets];a[e]={...a[e],decay:Math.max(0,Math.min(1,r))},t("update:modelValue",{...u.value,interferenceSets:a})},updateFromJson:function(e){i.value=null;try{const n=JSON.parse(e);if(!n.interferenceSets||!Array.isArray(n.interferenceSets))throw new Error('Config must have "interferenceSets" array');t("update:modelValue",n)}catch(n){i.value=n instanceof Error?n.message:"Invalid JSON"}}}}}),me={class:"interference-config-form"},ve={class:"maturity-section mb-4"},ye={class:"mb-4"},_e={class:"interference-groups-section"},be={class:"d-flex align-center mb-2"},we={class:"d-flex align-center mb-2"},Ce={class:"text-subtitle-2"};const Se=/* @__PURE__ */X(ge,[["render",function(e,p,h,g,m,v){const y=t("v-tab"),_=t("v-tabs"),b=t("v-text-field"),w=t("v-slider"),C=t("v-spacer"),S=t("v-icon"),I=t("v-btn"),k=t("v-alert"),x=t("v-select"),D=t("v-card"),V=t("v-window-item"),T=t("v-textarea"),E=t("v-window");return r(),n("div",me,[f(_,{modelValue:e.inputMode,"onUpdate:modelValue":p[0]||(p[0]=t=>e.inputMode=t),density:"compact",class:"mb-4"},{default:l((()=>[f(y,{value:"ui"},{default:l((()=>p[2]||(p[2]=[s("Visual Editor")]))),_:1}),f(y,{value:"json"},{default:l((()=>p[3]||(p[3]=[s("JSON Editor")]))),_:1})])),_:1},8,["modelValue"]),f(E,{modelValue:e.inputMode,"onUpdate:modelValue":p[1]||(p[1]=t=>e.inputMode=t)},{default:l((()=>[f(V,{value:"ui"},{default:l((()=>[a("div",ve,[p[4]||(p[4]=a("h4",{class:"text-subtitle-1 mb-2"},"Maturity Threshold",-1)),p[5]||(p[5]=a("p",{class:"text-caption mb-3"},'Tags below this threshold are considered "immature" (still being learned)',-1)),f(b,{"model-value":e.config.maturityThreshold?.minCount,"onUpdate:modelValue":e.updateMinCount,label:"Min Count",type:"number",hint:"Minimum interactions required (default: 10)","persistent-hint":"",density:"compact",class:"mb-2"},null,8,["model-value","onUpdate:modelValue"]),f(b,{"model-value":e.config.maturityThreshold?.minElo,"onUpdate:modelValue":e.updateMinElo,label:"Min ELO (optional)",type:"number",hint:"Minimum ELO score for maturity","persistent-hint":"",density:"compact",class:"mb-2"},null,8,["model-value","onUpdate:modelValue"]),f(b,{"model-value":e.config.maturityThreshold?.minElapsedDays,"onUpdate:modelValue":e.updateMinElapsedDays,label:"Min Elapsed Days",type:"number",hint:"Minimum time since first interaction (default: 3)","persistent-hint":"",density:"compact"},null,8,["model-value","onUpdate:modelValue"])]),a("div",ye,[f(w,{"model-value":e.config.defaultDecay||.8,"onUpdate:modelValue":e.updateDefaultDecay,label:"Default Decay",min:0,max:1,step:.05,"thumb-label":"",hint:"Default interference strength for groups without explicit decay (0 = no effect, 1 = maximum avoidance)","persistent-hint":""},{append:l((()=>[f(b,{"model-value":e.config.defaultDecay||.8,"onUpdate:modelValue":e.updateDefaultDecay,type:"number",style:{width:"80px"},density:"compact","hide-details":"",min:0,max:1,step:.05},null,8,["model-value","onUpdate:modelValue"])])),_:1},8,["model-value","onUpdate:modelValue"])]),a("div",_e,[a("div",be,[p[8]||(p[8]=a("h4",{class:"text-subtitle-1"},"Interference Groups",-1)),f(C),f(I,{size:"small",color:"primary",onClick:e.addInterferenceGroup},{default:l((()=>[f(S,{start:""},{default:l((()=>p[6]||(p[6]=[s("mdi-plus")]))),_:1}),p[7]||(p[7]=s(" Add Group "))])),_:1},8,["onClick"])]),0===e.config.interferenceSets.length?(r(),u(k,{key:0,type:"info",density:"compact"},{default:l((()=>p[9]||(p[9]=[s(' No interference groups defined. Click "Add Group" to create a set of tags that interfere with each other. ')]))),_:1})):d("",!0),(r(!0),n(i,null,o(e.config.interferenceSets,((t,n)=>(r(),u(D,{key:n,variant:"outlined",class:"mb-3 pa-3"},{default:l((()=>[a("div",we,[a("h5",Ce,"Group "+c(n+1),1),f(C),f(I,{icon:"",size:"small",color:"error",onClick:t=>e.removeInterferenceGroup(n)},{default:l((()=>[f(S,null,{default:l((()=>p[10]||(p[10]=[s("mdi-delete")]))),_:1})])),_:2},1032,["onClick"])]),f(x,{"model-value":t.tags,"onUpdate:modelValue":t=>e.updateGroupTags(n,t),items:e.availableTags,loading:e.loadingTags,disabled:e.loadingTags,label:"Interfering Tags",hint:"Tags that interfere with each other","persistent-hint":"",multiple:"",chips:"","closable-chips":"",density:"compact",class:"mb-3"},null,8,["model-value","onUpdate:modelValue","items","loading","disabled"]),f(w,{"model-value":void 0!==t.decay?t.decay:e.config.defaultDecay||.8,"onUpdate:modelValue":t=>e.updateGroupDecay(n,t),label:"Decay Strength",min:0,max:1,step:.05,"thumb-label":"",hint:"How strongly these tags interfere (higher = stronger avoidance)","persistent-hint":""},{append:l((()=>[f(b,{"model-value":void 0!==t.decay?t.decay:e.config.defaultDecay||.8,"onUpdate:modelValue":t=>e.updateGroupDecay(n,t),type:"number",style:{width:"80px"},density:"compact","hide-details":"",min:0,max:1,step:.05},null,8,["model-value","onUpdate:modelValue"])])),_:2},1032,["model-value","onUpdate:modelValue"])])),_:2},1024)))),128))])])),_:1}),f(V,{value:"json"},{default:l((()=>[f(T,{"model-value":e.jsonText,"onUpdate:modelValue":e.updateFromJson,label:"Configuration JSON",rows:"20",placeholder:'{"interferenceSets": [{"tags": ["letter-b", "letter-d"], "decay": 0.9}], "maturityThreshold": {"minCount": 10}, "defaultDecay": 0.8}',hint:"Paste or edit JSON configuration directly","persistent-hint":"","auto-grow":""},null,8,["model-value","onUpdate:modelValue"]),e.jsonError?(r(),u(k,{key:0,type:"error",density:"compact",class:"mt-2"},{default:l((()=>[s(c(e.jsonError),1)])),_:1})):e.jsonText?(r(),u(k,{key:1,type:"success",density:"compact",class:"mt-2"},{default:l((()=>p[11]||(p[11]=[s(" Valid configuration ")]))),_:1})):d("",!0)])),_:1})])),_:1},8,["modelValue"]),e.validationError?(r(),u(k,{key:0,type:"error",density:"compact",class:"mt-3"},{default:l((()=>[s(c(e.validationError),1)])),_:1})):d("",!0)])}],["__scopeId","data-v-20d01937"]]),Ie=e({name:"RelativePriorityConfigForm",props:{modelValue:{type:Object,required:!0},courseId:{type:String,required:!0}},emits:["update:modelValue"],setup(e,{emit:t}){const n=p("ui"),r=p([]),a=p(null),i=p(null),o=p(!0),u=h((()=>e.modelValue)),s=h((()=>{try{return JSON.stringify(u.value,null,2)}catch{return""}}));return g((()=>{!async function(){o.value=!0;try{const t=D().getCourseDB(e.courseId),n=await t.getCourseTagStubs();r.value=n.rows.map((e=>e.id.replace("TAG-","")))}catch(t){console.error("Failed to load course tags:",t),a.value="Failed to load course tags"}finally{o.value=!1}}()})),m((()=>u.value),(()=>{!function(){a.value=null;try{if(!u.value.tagPriorities||"object"!=typeof u.value.tagPriorities)throw new Error("Tag priorities must be an object");for(const[e,t]of Object.entries(u.value.tagPriorities))if("number"!=typeof t||t<0||t>1)throw new Error(`Priority for ${e} must be between 0 and 1`);return!0}catch(e){return a.value=e instanceof Error?e.message:"Invalid configuration",!1}}()}),{deep:!0}),{inputMode:n,config:u,availableTags:r,loadingTags:o,combineModes:[{title:"Max (highest priority wins)",value:"max"},{title:"Average (average all priorities)",value:"average"},{title:"Min (lowest priority wins)",value:"min"}],jsonText:s,jsonError:i,validationError:a,updateDefaultPriority:function(e){const n="string"==typeof e?parseFloat(e):e;isNaN(n)||t("update:modelValue",{...u.value,defaultPriority:Math.max(0,Math.min(1,n))})},updateCombineMode:function(e){t("update:modelValue",{...u.value,combineMode:e})},updatePriorityInfluence:function(e){const n="string"==typeof e?parseFloat(e):e;isNaN(n)||t("update:modelValue",{...u.value,priorityInfluence:Math.max(0,Math.min(1,n))})},getTagPriority:function(e){return void 0!==u.value.tagPriorities[e]?u.value.tagPriorities[e]:void 0!==u.value.defaultPriority?u.value.defaultPriority:.5},updateTagPriority:function(e,n){const r="string"==typeof n?parseFloat(n):n;isNaN(r)||t("update:modelValue",{...u.value,tagPriorities:{...u.value.tagPriorities,[e]:Math.max(0,Math.min(1,r))}})},updateFromJson:function(e){i.value=null;try{const n=JSON.parse(e);if(!n.tagPriorities||"object"!=typeof n.tagPriorities)throw new Error('Config must have "tagPriorities" object');t("update:modelValue",n)}catch(n){i.value=n instanceof Error?n.message:"Invalid JSON"}}}}}),ke={class:"relative-priority-config-form"},xe={class:"config-options mb-4"},De={class:"tag-priorities-section"},Ve={key:2,class:"tag-priority-list"};const Te=e({name:"NavigationStrategyEditor",components:{NavigationStrategyList:se,HierarchyConfigForm:he,InterferenceConfigForm:Se,RelativePriorityConfigForm:/* @__PURE__ */X(Ie,[["render",function(e,p,h,g,m,v){const y=t("v-tab"),_=t("v-tabs"),b=t("v-text-field"),w=t("v-slider"),C=t("v-select"),S=t("v-alert"),I=t("v-window-item"),k=t("v-textarea"),x=t("v-window");return r(),n("div",ke,[f(_,{modelValue:e.inputMode,"onUpdate:modelValue":p[0]||(p[0]=t=>e.inputMode=t),density:"compact",class:"mb-4"},{default:l((()=>[f(y,{value:"ui"},{default:l((()=>p[2]||(p[2]=[s("Visual Editor")]))),_:1}),f(y,{value:"json"},{default:l((()=>p[3]||(p[3]=[s("JSON Editor")]))),_:1})])),_:1},8,["modelValue"]),f(x,{modelValue:e.inputMode,"onUpdate:modelValue":p[1]||(p[1]=t=>e.inputMode=t)},{default:l((()=>[f(I,{value:"ui"},{default:l((()=>[a("div",xe,[p[4]||(p[4]=a("h4",{class:"text-subtitle-1 mb-2"},"Priority Configuration",-1)),f(w,{"model-value":void 0!==e.config.defaultPriority?e.config.defaultPriority:.5,"onUpdate:modelValue":e.updateDefaultPriority,label:"Default Priority",min:0,max:1,step:.05,"thumb-label":"",hint:"Priority for tags not explicitly listed (0.5 = neutral)","persistent-hint":"",class:"mb-3"},{append:l((()=>[f(b,{"model-value":void 0!==e.config.defaultPriority?e.config.defaultPriority:.5,"onUpdate:modelValue":e.updateDefaultPriority,type:"number",style:{width:"80px"},density:"compact","hide-details":"",min:0,max:1,step:.05},null,8,["model-value","onUpdate:modelValue"])])),_:1},8,["model-value","onUpdate:modelValue"]),f(C,{"model-value":e.config.combineMode||"max","onUpdate:modelValue":e.updateCombineMode,label:"Combine Mode",items:e.combineModes,hint:"How to combine priorities when a card has multiple tags","persistent-hint":"",density:"compact",class:"mb-3"},null,8,["model-value","onUpdate:modelValue","items"]),f(w,{"model-value":void 0!==e.config.priorityInfluence?e.config.priorityInfluence:.5,"onUpdate:modelValue":e.updatePriorityInfluence,label:"Priority Influence",min:0,max:1,step:.05,"thumb-label":"",hint:"How strongly priority affects scoring (0 = no effect, 1 = maximum effect)","persistent-hint":""},{append:l((()=>[f(b,{"model-value":void 0!==e.config.priorityInfluence?e.config.priorityInfluence:.5,"onUpdate:modelValue":e.updatePriorityInfluence,type:"number",style:{width:"80px"},density:"compact","hide-details":"",min:0,max:1,step:.05},null,8,["model-value","onUpdate:modelValue"])])),_:1},8,["model-value","onUpdate:modelValue"])]),a("div",De,[p[7]||(p[7]=a("h4",{class:"text-subtitle-1 mb-2"},"Tag Priorities",-1)),p[8]||(p[8]=a("p",{class:"text-caption mb-3"},"Set priority for each tag (1.0 = highest priority, 0.0 = lowest)",-1)),e.loadingTags?(r(),u(S,{key:0,type:"info",density:"compact"},{default:l((()=>p[5]||(p[5]=[s(" Loading tags... ")]))),_:1})):0===e.availableTags.length?(r(),u(S,{key:1,type:"warning",density:"compact"},{default:l((()=>p[6]||(p[6]=[s(" No tags available in course ")]))),_:1})):(r(),n("div",Ve,[(r(!0),n(i,null,o(e.availableTags,(t=>(r(),n("div",{key:t,class:"tag-priority-item mb-3"},[f(w,{"model-value":e.getTagPriority(t),"onUpdate:modelValue":n=>e.updateTagPriority(t,n),label:t,min:0,max:1,step:.05,"thumb-label":"",density:"compact"},{append:l((()=>[f(b,{"model-value":e.getTagPriority(t),"onUpdate:modelValue":n=>e.updateTagPriority(t,n),type:"number",style:{width:"80px"},density:"compact","hide-details":"",min:0,max:1,step:.05},null,8,["model-value","onUpdate:modelValue"])])),_:2},1032,["model-value","onUpdate:modelValue","label"])])))),128))]))])])),_:1}),f(I,{value:"json"},{default:l((()=>[f(k,{"model-value":e.jsonText,"onUpdate:modelValue":e.updateFromJson,label:"Configuration JSON",rows:"15",placeholder:'{"tagPriorities": {"letter-s": 0.95, "letter-t": 0.90}, "defaultPriority": 0.5, "combineMode": "max", "priorityInfluence": 0.5}',hint:"Paste or edit JSON configuration directly","persistent-hint":"","auto-grow":""},null,8,["model-value","onUpdate:modelValue"]),e.jsonError?(r(),u(S,{key:0,type:"error",density:"compact",class:"mt-2"},{default:l((()=>[s(c(e.jsonError),1)])),_:1})):e.jsonText?(r(),u(S,{key:1,type:"success",density:"compact",class:"mt-2"},{default:l((()=>p[9]||(p[9]=[s(" Valid configuration ")]))),_:1})):d("",!0)])),_:1})])),_:1},8,["modelValue"]),e.validationError?(r(),u(S,{key:0,type:"error",density:"compact",class:"mt-3"},{default:l((()=>[s(c(e.validationError),1)])),_:1})):d("",!0)])}],["__scopeId","data-v-573b50bd"]])},props:{courseId:{type:String,required:!0}},data:()=>({strategies:[],loading:!0,showDeleteConfirm:!1,strategyToDelete:null,strategyTypes:[{label:"Hierarchy Definition",value:"hierarchy"},{label:"Interference Mitigator",value:"interference"},{label:"Relative Priority",value:"relativePriority"}],newStrategy:{type:"hierarchy",name:"",description:"",config:{cardIds:[]}},editingStrategy:null,defaultStrategyId:null}),async created(){await this.loadStrategies()},watch:{"newStrategy.type"(e){this.newStrategy.config=this.getDefaultConfig(e)}},methods:{getDefaultConfig(e){switch(e){case"hierarchy":return{prerequisites:{}};case"interference":return{interferenceSets:[],maturityThreshold:{minCount:10,minElapsedDays:3},defaultDecay:.8};case"relativePriority":return{tagPriorities:{},defaultPriority:.5,combineMode:"max",priorityInfluence:.5};default:return{}}},getStrategyTypeFromClass(e){switch(e){case T.HIERARCHY:return"hierarchy";case T.INTERFERENCE:return"interference";case T.RELATIVE_PRIORITY:return"relativePriority";default:return"hierarchy"}},parseSerializedData(e,t){try{return JSON.parse(t)}catch(n){return console.error("Failed to parse strategy data:",n),this.getDefaultConfig(e)}},async loadStrategies(){this.loading=!0;try{const e=D().getCourseDB(this.courseId),[t,n]=await Promise.all([e.getAllNavigationStrategies(),e.getCourseConfig()]);this.strategies=t,this.defaultStrategyId=n.defaultNavigationStrategyId||null}catch(e){console.error("Failed to load navigation strategies:",e),this.strategies=[{_id:"NAVIGATION_STRATEGY-ELO",docType:V.NAVIGATION_STRATEGY,name:"ELO",description:"Default ELO-based navigation strategy",implementingClass:T.ELO,course:this.courseId,serializedData:"",author:"system"}]}this.loading=!1},async setDefaultStrategy(e){try{this.loading=!0;const t=D().getCourseDB(this.courseId),n=await t.getCourseConfig();n.defaultNavigationStrategyId=e,await t.updateCourseConfig(n),this.defaultStrategyId=e,alert("Default strategy updated!")}catch(t){console.error("Failed to set default strategy:",t),alert("Error updating default strategy. See console for details.")}finally{this.loading=!1}},startNewStrategy(){const e="hierarchy";this.newStrategy={type:e,name:"",description:"",config:this.getDefaultConfig(e)},this.editingStrategy=null},cancelEdit(){this.startNewStrategy()},editStrategy(e){const t=this.getStrategyTypeFromClass(e.implementingClass),n=this.parseSerializedData(t,e.serializedData);this.newStrategy={type:t,name:e.name,description:e.description,config:n},this.editingStrategy=e},async saveStrategy(){if(this.newStrategy.name)if("hardcoded"!==this.newStrategy.type||0!==this.newStrategy.config.cardIds.length){if("hierarchy"===this.newStrategy.type){if(0===Object.keys(this.newStrategy.config.prerequisites||{}).length)return void alert("At least one prerequisite rule is required for hierarchy strategy.")}if("interference"!==this.newStrategy.type||this.newStrategy.config.interferenceSets&&0!==this.newStrategy.config.interferenceSets.length)if("relativePriority"!==this.newStrategy.type||this.newStrategy.config.tagPriorities&&0!==Object.keys(this.newStrategy.config.tagPriorities).length){this.loading=!0;try{const e=D(),t=e.getUserDB().getUsername(),n=e.getCourseDB(this.courseId),r={hierarchy:T.HIERARCHY,interference:T.INTERFERENCE,relativePriority:T.RELATIVE_PRIORITY};let a=JSON.stringify(this.newStrategy.config);if(this.editingStrategy){const e={...this.editingStrategy,name:this.newStrategy.name,description:this.newStrategy.description,implementingClass:r[this.newStrategy.type],serializedData:a};await n.updateNavigationStrategy(this.editingStrategy._id,e)}else{const e={_id:`NAVIGATION_STRATEGY-${Date.now()}`,docType:V.NAVIGATION_STRATEGY,name:this.newStrategy.name,description:this.newStrategy.description,implementingClass:r[this.newStrategy.type],author:t,course:this.courseId,serializedData:a};await n.addNavigationStrategy(e)}await this.loadStrategies(),this.startNewStrategy()}catch(e){console.error("Failed to save new strategy:",e),alert("Error saving strategy. See console for details.")}this.loading=!1}else alert("At least one tag priority must be set for relative priority strategy.");else alert("At least one interference group is required for interference strategy.")}else alert("At least one card ID is required for hardcoded order strategy.");else alert("Strategy Name is required.")},confirmDeleteStrategy(e){this.strategyToDelete=e,this.showDeleteConfirm=!0},async deleteStrategy(){if(this.strategyToDelete){this.loading=!0;try{const e=D().getCourseDB(this.courseId),t={_id:this.strategyToDelete._id,docType:V.NAVIGATION_STRATEGY,name:"DELETED",description:"This strategy has been deleted",implementingClass:"",course:this.courseId,serializedData:""};await e.updateNavigationStrategy(this.strategyToDelete._id,t),console.log(`Strategy ${this.strategyToDelete._id} marked as deleted`),this.strategies=this.strategies.filter((e=>e._id!==this.strategyToDelete?._id)),this.showDeleteConfirm=!1,this.strategyToDelete=null}catch(e){console.error("Failed to delete navigation strategy:",e)}this.loading=!1}}}}),Ee={class:"navigation-strategy-editor"},Ae={key:0,class:"text-center pa-4"},Oe={key:1,class:"editor-layout"},Fe={class:"strategy-list-column"},Re={class:"d-flex align-center mb-2"},je={class:"strategy-form-column"},Ue={class:"form-header d-flex align-center mb-3"},qe={class:"text-h6"},Ne={class:"form-actions mt-4"};const Pe=/* @__PURE__ */X(Te,[["render",function(e,i,o,p,h,g){const m=t("v-progress-circular"),v=t("v-spacer"),y=t("v-icon"),_=t("v-btn"),b=t("v-alert"),w=t("navigation-strategy-list"),C=t("v-select"),S=t("v-text-field"),I=t("hierarchy-config-form"),k=t("interference-config-form"),x=t("relative-priority-config-form"),D=t("v-card-title"),V=t("v-card-text"),T=t("v-card-actions"),E=t("v-card"),A=t("v-dialog");return r(),n("div",Ee,[e.loading?(r(),n("div",Ae,[f(m,{indeterminate:"",color:"secondary"})])):(r(),n("div",Oe,[a("div",Fe,[a("div",Re,[i[10]||(i[10]=a("h3",{class:"text-h6"},"Strategies",-1)),f(v),f(_,{size:"small",color:"primary",onClick:e.startNewStrategy,density:"compact"},{default:l((()=>[f(y,{start:"",size:"small"},{default:l((()=>i[8]||(i[8]=[s("mdi-plus")]))),_:1}),i[9]||(i[9]=s(" New "))])),_:1},8,["onClick"])]),0===e.strategies.length?(r(),u(b,{key:0,type:"info",density:"compact"},{default:l((()=>i[11]||(i[11]=[s(" No strategies defined ")]))),_:1})):(r(),u(w,{key:1,strategies:e.strategies,"default-strategy-id":e.defaultStrategyId,"onUpdate:defaultStrategy":e.setDefaultStrategy,onEdit:e.editStrategy,onDelete:e.confirmDeleteStrategy},null,8,["strategies","default-strategy-id","onUpdate:defaultStrategy","onEdit","onDelete"]))]),a("div",je,[a("div",Ue,[a("h3",qe,c(e.editingStrategy?"Edit Strategy":"New Strategy"),1),f(v),e.editingStrategy?(r(),u(_,{key:0,size:"small",variant:"text",onClick:e.cancelEdit,density:"compact"},{default:l((()=>i[12]||(i[12]=[s(" Cancel ")]))),_:1},8,["onClick"])):d("",!0)]),f(C,{modelValue:e.newStrategy.type,"onUpdate:modelValue":i[0]||(i[0]=t=>e.newStrategy.type=t),label:"Type",items:e.strategyTypes,"item-title":"label","item-value":"value",density:"compact",class:"mb-3"},null,8,["modelValue","items"]),f(S,{modelValue:e.newStrategy.name,"onUpdate:modelValue":i[1]||(i[1]=t=>e.newStrategy.name=t),label:"Name",density:"compact",class:"mb-3"},null,8,["modelValue"]),f(S,{modelValue:e.newStrategy.description,"onUpdate:modelValue":i[2]||(i[2]=t=>e.newStrategy.description=t),label:"Description",density:"compact",class:"mb-3"},null,8,["modelValue"]),"hierarchy"===e.newStrategy.type?(r(),u(I,{key:0,modelValue:e.newStrategy.config,"onUpdate:modelValue":i[3]||(i[3]=t=>e.newStrategy.config=t),"course-id":e.courseId},null,8,["modelValue","course-id"])):"interference"===e.newStrategy.type?(r(),u(k,{key:1,modelValue:e.newStrategy.config,"onUpdate:modelValue":i[4]||(i[4]=t=>e.newStrategy.config=t),"course-id":e.courseId},null,8,["modelValue","course-id"])):"relativePriority"===e.newStrategy.type?(r(),u(x,{key:2,modelValue:e.newStrategy.config,"onUpdate:modelValue":i[5]||(i[5]=t=>e.newStrategy.config=t),"course-id":e.courseId},null,8,["modelValue","course-id"])):(r(),u(b,{key:3,type:"warning",density:"compact"},{default:l((()=>[s(" Unknown strategy type: "+c(e.newStrategy.type),1)])),_:1})),a("div",Ne,[f(_,{color:"primary",onClick:e.saveStrategy,disabled:!e.newStrategy.name,size:"small"},{default:l((()=>[s(c(e.editingStrategy?"Update":"Create"),1)])),_:1},8,["onClick","disabled"]),e.editingStrategy?(r(),u(_,{key:0,variant:"text",onClick:e.cancelEdit,size:"small"},{default:l((()=>i[13]||(i[13]=[s(" Cancel ")]))),_:1},8,["onClick"])):d("",!0)])]),f(A,{modelValue:e.showDeleteConfirm,"onUpdate:modelValue":i[7]||(i[7]=t=>e.showDeleteConfirm=t),"max-width":"400px"},{default:l((()=>[f(E,null,{default:l((()=>[f(D,{class:"text-subtitle-1"},{default:l((()=>i[14]||(i[14]=[s("Delete Strategy")]))),_:1}),f(V,null,{default:l((()=>[s('Delete "'+c(e.strategyToDelete?.name)+'"?',1)])),_:1}),f(T,null,{default:l((()=>[f(v),f(_,{size:"small",onClick:i[6]||(i[6]=t=>e.showDeleteConfirm=!1)},{default:l((()=>i[15]||(i[15]=[s("Cancel")]))),_:1}),f(_,{size:"small",color:"error",onClick:e.deleteStrategy},{default:l((()=>i[16]||(i[16]=[s("Delete")]))),_:1},8,["onClick"])])),_:1})])),_:1})])),_:1},8,["modelValue"])]))])}],["__scopeId","data-v-1cb6c357"]]);function Me(e){return null!==e&&"object"==typeof e&&"clearData"in e&&"validate"in e&&"function"==typeof e.clearData&&"function"==typeof e.validate}const ze={status:F.ok,msg:""};function $e(e){const t={status:F.error,msg:"This input must be a number"};return function(e){return!isNaN(e-parseFloat(e))}(e)?ze:t}function Be(e){const t={status:F.error,msg:"This input must be an integer (..., -2, -1, 0, 1, 2, ...)."};return $e(e).status===F.error?$e(e):function(e){return/^[+,-]?\s?\d+$/.test(e)}(e)?ze:t}const Le=W("fieldStore",{state:()=>({dataShape:null,inputs:{},mediaInputs:{},inputIsValid:!1,validation:{},convertedInput:{},previewInput:{}}),getters:{isValidated(){return this.inputIsValid},getPreview:e=>e.inputIsValid?e.previewInput:{},getConverted:e=>e.inputIsValid?e.convertedInput:{}},actions:{$reset(){console.log("[FieldInputStore].reset()"),this.inputs={},this.mediaInputs={},this.validation={},this.convertedInput={},this.previewInput={},this.inputIsValid=!1;for(let e=1;e<=10;e++){const t=`audio-${e}`,n=`image-${e}`;delete this.mediaInputs[t],delete this.mediaInputs[n]}},setFieldValue(e,t){this.inputs[e]=t,this.validate(),this.convert()},setMedia(e,t){console.log(`[FieldInputStore].setMedia: ${e}`),this.mediaInputs[e]=t,this.convert()},validate(){if(this.validation={},null!==this.dataShape){this.inputIsValid=!0;for(const e of this.dataShape.fields)if(e.validator){e.validator.test(this.inputs[e.name]).status===F.ok?this.validation[e.name]=!0:(this.inputIsValid=!1,this.validation[e.name]=!1)}}else this.inputIsValid=!1},convert(){this.convertedInput={},this.dataShape?.fields.forEach((e=>{this.convertedInput[e.name]=R[e.type].databaseConverter(this.inputs[e.name]),this.previewInput[e.name]=R[e.type].previewConverter(this.inputs[e.name])}));for(let e=1;e<11;e++){const t=`audio-${e}`,n=this.mediaInputs[t];if(!n)break;this.convertedInput[t]=R[j.AUDIO].databaseConverter(n),this.previewInput[t]=R[j.AUDIO].previewConverter(n)}for(let e=1;e<11;e++){const t=`image-${e}`,n=this.mediaInputs[t];if(!n)break;this.convertedInput[t]=R[j.IMAGE].databaseConverter(n),this.previewInput[t]=R[j.IMAGE].previewConverter(n)}},clearMediaEntries(){for(let e=1;e<=10;e++)delete this.mediaInputs[`audio-${e}`],delete this.mediaInputs[`image-${e}`],delete this.convertedInput[`audio-${e}`],delete this.convertedInput[`image-${e}`],delete this.previewInput[`audio-${e}`],delete this.previewInput[`image-${e}`]},clearField(e){delete this.inputs[e],delete this.validation[e],delete this.convertedInput[e],delete this.previewInput[e]}}}),We=e({name:"FieldInput",props:{autofocus:Boolean,field:{type:Object,required:!0}},setup(e){const t=Le(),n=p(null),r=h({get:()=>t.inputs[e.field.name],set:n=>t.setFieldValue(e.field.name,n)});m(r,((n,r)=>{console.log("[FieldInput] modelValue changed:",{new:n,old:r,currentStoreValue:t.inputs[e.field.name]})}));const a=h((()=>{const t=[];return e.field?.validator&&t.push(e.field.validator.test),t})),i=()=>{if(!e.field?.name)throw new Error("Field name is required for FieldInput component");return t.inputs[e.field.name]};return{inputField:n,fieldStore:t,modelValue:r,validators:a,focus:()=>{n.value&&n.value.focus()},userInput:i,clearData:()=>{if(console.log(`[FieldInput] Running generic clearData() for ${e.field?.name} in FieldInput.ts`),n.value){if(n.value.value="",!e.field?.name)return;t.clearField(e.field.name)}},setData:n=>{if(!e.field?.name)throw new Error("Field name is required for FieldInput component");t.setFieldValue(e.field.name,n)},vuetifyRules:()=>e.field?.validator?a.value.map((e=>U(e))):[],generateTags:()=>(console.log("[FieldInput] Running generic generateTags() in FieldInput.ts"),e.field?.tagger?e.field.tagger(i()):[]),generateELO:()=>(console.log("[FieldInput] Running generic generateELO() in FieldInput.ts"),e.field?.generateELO?e.field.generateELO(i()):void 0)}},data:()=>({validationStatus:{status:F.ok,msg:""}})});const Je=/* @__PURE__ */X(e({name:"IntegerInput",extends:We,setup(e,t){const n=We.setup?.(e,t);return{...n,validators:h((()=>{const t=We.validators.call(this);return e.field.validator?.test&&t.push(e.field.validator.test),t?[Be,...t]:[Be]}))}}}),[["render",function(e,n,a,i,o,s){const l=t("v-text-field");return r(),u(l,{ref:"inputField",modelValue:e.modelValue,"onUpdate:modelValue":n[0]||(n[0]=t=>e.modelValue=t),variant:"filled",type:"number",name:e.field.name,label:e.field.name,rules:e.vuetifyRules(),hint:e.validationStatus.msg,autofocus:e.autofocus},null,8,["modelValue","name","label","rules","hint","autofocus"])}]]);const Ge=/* @__PURE__ */X(e({name:"MarkdownInput",extends:We,setup(e,t){const n=We.setup?.(e,t);return{...n}}}),[["render",function(e,n,a,i,o,s){const l=t("v-textarea");return r(),u(l,{ref:"inputField",modelValue:e.modelValue,"onUpdate:modelValue":n[0]||(n[0]=t=>e.modelValue=t),variant:"filled",name:e.field.name,label:e.field.name,rules:e.vuetifyRules(),hint:e.validationStatus.msg,autofocus:e.autofocus},null,8,["modelValue","name","label","rules","hint","autofocus"])}],["__scopeId","data-v-28ef24ff"]]),He=e({name:"MediaDragDropUploader",extends:We,setup(e,t){const n=We.setup?.(e,t),{fieldStore:r}=n;return{...n,fieldStore:r}},data:()=>({isDragging:!1,mediaItems:[]}),computed:{hasMedia(){return this.mediaItems.length>0}},created(){},methods:{dragOverHandler(e){e.preventDefault()},dragEnterHandler(e){e.preventDefault(),this.isDragging=!0},dragLeaveHandler(e){e.preventDefault(),this.isDragging=!1},dropHandler(e){e.preventDefault(),this.isDragging=!1;const t=e.dataTransfer?.files;t&&this.processFiles(t)},triggerFileInput(){this.$refs.fileInput.click()},handleFileInput(e){const t=e.target.files;t&&this.processFiles(t)},processFiles(e){Array.from(e).forEach((e=>{this.addMediaItem(e)})),this.updateStore()},addMediaItem(e){const t=e.type.startsWith("image/")?"image":"audio",n={type:t,file:e,url:URL.createObjectURL(e)};"image"===t&&this.createThumbnail(e).then((e=>{n.thumbnailUrl=e,this.$nextTick((()=>{this.$forceUpdate()}))})),this.mediaItems.push(n)},createThumbnail:async e=>new Promise((t=>{const n=new FileReader;n.onload=e=>{t(e.target?.result)},n.readAsDataURL(e)})),removeMedia(e){URL.revokeObjectURL(this.mediaItems[e].url),this.mediaItems.splice(e,1),this.updateStore()},clearData(){this.mediaItems.forEach((e=>{URL.revokeObjectURL(e.url)})),this.mediaItems=[],this.updateStore()},addMoreMedia(){console.log("addMoreMedia"),this.triggerFileInput()},updateStore(){let e=0,t=0;this.mediaItems.forEach((n=>{"image"===n.type?(e++,this.fieldStore.setMedia(`image-${e}`,{content_type:n.file.type,data:n.file})):"audio"===n.type&&(t++,this.fieldStore.setMedia(`audio-${t}`,{content_type:n.file.type,data:n.file}))}))},getValidators(){return[()=>({status:this.mediaItems.length>0?F.ok:F.error,msg:this.mediaItems.length>0?"":"At least one media item is required"})]}}}),Qe={class:"mr-2 mb-2"},Ke=["src"],Ye=["src"];const Ze=/* @__PURE__ */X(He,[["render",function(e,u,c,p,h,g){const m=t("v-label"),_=t("v-btn");return r(),n("div",Qe,[f(m,{class:"text-h5"},{default:l((()=>u[5]||(u[5]=[s("Add media:")]))),_:1}),a("div",{class:y(["drop-zone",{"drop-zone--over":e.isDragging}]),onDrop:u[1]||(u[1]=(...t)=>e.dropHandler&&e.dropHandler(...t)),onDragover:u[2]||(u[2]=v(((...t)=>e.dragOverHandler&&e.dragOverHandler(...t)),["prevent"])),onDragenter:u[3]||(u[3]=v(((...t)=>e.dragEnterHandler&&e.dragEnterHandler(...t)),["prevent"])),onDragleave:u[4]||(u[4]=v(((...t)=>e.dragLeaveHandler&&e.dragLeaveHandler(...t)),["prevent"]))},[a("input",{ref:"fileInput",type:"file",accept:"image/*,audio/*",multiple:"",style:{display:"none"},onChange:u[0]||(u[0]=(...t)=>e.handleFileInput&&e.handleFileInput(...t))},null,544),(r(!0),n(i,null,o(e.mediaItems,((t,a)=>(r(),n("div",{key:a,class:"media-item"},["image"===t.type?(r(),n("img",{key:0,src:t.thumbnailUrl,alt:"Uploaded image thumbnail",class:"thumbnail"},null,8,Ke)):"audio"===t.type?(r(),n("audio",{key:1,controls:"",src:t.url},null,8,Ye)):d("",!0),f(_,{size:"small",onClick:t=>e.removeMedia(a)},{default:l((()=>u[6]||(u[6]=[s("Remove")]))),_:2},1032,["onClick"])])))),128)),u[8]||(u[8]=s(" Drop image or audio files here... ")),f(_,{onClick:e.triggerFileInput},{default:l((()=>u[7]||(u[7]=[s("Or Click to Upload")]))),_:1},8,["onClick"])],34)])}],["__scopeId","data-v-e86645b6"]]),Xe=e({name:"MidiInput",components:{SyllableSeqVis:w},extends:We,data:()=>({midi:null,recording:!1,SylSeq:C([]),display:!1,transpositions:!1}),async created(){try{this.midi=await I.instance(),this.record(),this.store[this.field.name]=this.getTransposedSeqs}catch(e){throw new Error(`MidiInput.created: ${e}`)}},methods:{record(){this.midi&&(this.midi.record(),this.midi.addNoteonListenter((e=>{this.SylSeq.append(e),this.$refs.inputVis.updateBounds()})),this.recording=!0)},getTransposedSeqs(){return this.midi?this.transpositions?[-5,-4,-3,-2,-1,0,1,2,3,4,5,6].map((e=>S(this.midi.recording,e))):[this.midi.recording]:[]},clearData(){this.midi&&(console.log("midiInput clearing data..."),this.midi.stopRecording(),this.midi.eraseRecording(),this.SylSeq=C([]),this.record(),this.recording=!0,this.store.convertedInput[this.field.name]=this.midi.recording,this.store.validation[this.field.name]=!1,this.store[this.field.name]=this.getTransposedSeqs)},hasRecording(){return this.midi?.hasRecording??!1},reset(){this.clearData()},play(){this.midi&&(this.midi.play(),this.display=!0,this.validate())}}}),et={key:0},tt={class:"text-h5"},nt={class:"font-weight-black"};const rt=/* @__PURE__ */X(Xe,[["render",function(e,i,o,p,h,g){const m=t("syllable-seq-vis"),v=t("v-icon"),y=t("v-btn"),_=t("v-checkbox");return r(),n("div",null,[e.recording?(r(),n("div",et,[a("span",tt,[i[1]||(i[1]=s(" Now Recording from device: ")),a("span",nt,c(e.midi.configuredInput),1)])])):d("",!0),(r(),u(m,{key:1,ref:"inputVis",seq:e.SylSeq,"last-t-ssuggestion":"5000"},null,8,["seq"])),f(y,{color:"primary",disabled:e.hasRecording(),onClick:e.play},{default:l((()=>[i[3]||(i[3]=s(" Preview ")),f(v,{end:""},{default:l((()=>i[2]||(i[2]=[s("volume_up")]))),_:1})])),_:1},8,["disabled","onClick"]),f(y,{color:"error",disabled:e.hasRecording(),onClick:e.reset},{default:l((()=>[i[5]||(i[5]=s(" Clear and try again ")),f(v,{end:""},{default:l((()=>i[4]||(i[4]=[s("close")]))),_:1})])),_:1},8,["disabled","onClick"]),f(_,{modelValue:e.transpositions,"onUpdate:modelValue":i[0]||(i[0]=t=>e.transpositions=t),label:"Include Transpositions",onClickCapture:e.reset},null,8,["modelValue","onClickCapture"])])}]]);const at=/* @__PURE__ */X(e({name:"NumberInput",extends:We,setup(e,t){const n=We.setup?.(e,t);return{...n,validators:h((()=>{const t=We.validators.call(this);return e.field.validator?.test&&t.push(e.field.validator.test),t?[$e,...t]:[$e]}))}}}),[["render",function(e,n,a,i,o,s){const l=t("v-text-field");return r(),u(l,{ref:"inputField",modelValue:e.modelValue,"onUpdate:modelValue":n[0]||(n[0]=t=>e.modelValue=t),variant:"filled",type:"number",name:e.field.name,label:e.field.name,rules:e.vuetifyRules(),hint:e.validationStatus.msg,autofocus:e.autofocus},null,8,["modelValue","name","label","rules","hint","autofocus"])}]]);const it=/* @__PURE__ */X(e({name:"StringInput",extends:We,setup(e,t){const n=We.setup?.(e,t);return{...n,validators:h((()=>{const t=We.validators.call(this);return e.field.validator?.test&&t.push(e.field.validator.test),t||[]}))}}}),[["render",function(e,n,a,i,o,s){const l=t("v-text-field");return r(),u(l,{ref:"inputField",modelValue:e.modelValue,"onUpdate:modelValue":n[0]||(n[0]=t=>e.modelValue=t),variant:"filled",type:"text",name:e.field.name,label:e.field.name,rules:e.vuetifyRules(),hint:e.validationStatus.msg,autofocus:e.autofocus},null,8,["modelValue","name","label","rules","hint","autofocus"])}]]);const ot=/* @__PURE__ */X(e({name:"ChessPuzzleInput",extends:We,setup(e,t){const n=We.setup?.(e,t),r=()=>{if(!n)return[];console.log(`CPI.generateTags: modelValue: ${n.modelValue.value}`);const e=n.modelValue.value.split(","),t=e[7].split(" "),r=e[9].split(" ");return t.map((e=>`theme-${e}`)).concat(r.map((e=>`opening-${e}`)))};return{...n,generateELO:()=>{if(!n)return;const e=n.modelValue.value.split(","),t=parseInt(e[3]),a=parseInt(e[6]),i={global:{score:t,count:a},tags:{},misc:{}};return r().forEach((e=>{i.tags[e]={score:t,count:a}})),console.log("generateELO",JSON.stringify(i)),i},generateTags:r}}}),[["render",function(e,n,a,i,o,s){const l=t("v-text-field");return r(),u(l,{ref:"inputField",modelValue:e.modelValue,"onUpdate:modelValue":n[0]||(n[0]=t=>e.modelValue=t),variant:"filled",name:e.field.name,label:e.field.name,rules:e.vuetifyRules(),autofocus:e.autofocus},null,8,["modelValue","name","label","rules","autofocus"])}]]),ut=W("dataInputForm",{state:()=>({dataInputForm:{dataShape:null,course:null,shapeViews:[],fields:[],fieldStore:Le(),uploading:!1}}),actions:{setDataShape(e){this.dataInputForm.dataShape=e,this.dataInputForm.fieldStore.dataShape=e,this.dataInputForm.fieldStore.$reset()},setCourse(e){this.dataInputForm.course=e}}}),st=e({name:"DataInputForm",components:{NumberInput:at,StringInput:it,IntegerInput:Je,MarkdownInput:Ge,MidiInput:rt,CardBrowser:z,MediaDragDropUploader:Ze,TagsInput:M,ChessPuzzleInput:ot},props:{courseCfg:{type:Object,required:!0,default:()=>({courseID:"default-test"})},dataShape:{type:Object,required:!0},previewComponent:{type:Object,required:!1,default:null},courseWare:{type:Object,default:()=>b}},data:()=>({tag:"",tags:[],autoCompleteSuggestions:[],timer:void 0,dataInputFormStore:ut(),fieldInputRefs:[],courseDB:null}),computed:{ftString:()=>j.STRING,int:()=>j.INT,num:()=>j.NUMBER,img:()=>j.IMAGE,mkd:()=>j.MARKDOWN,audio:()=>j.AUDIO,midi:()=>j.MIDI,uploader:()=>j.MEDIA_UPLOADS,chessPuzzle:()=>j.CHESS_PUZZLE,fieldInputs(){return Array.from(this.fieldInputRefs.values())},shapeViews:{get(){return this.dataInputFormStore.dataInputForm.shapeViews},set(e){this.dataInputFormStore.dataInputForm.shapeViews=e}},allowSubmit(){return this.dataInputFormStore.dataInputForm.fieldStore.isValidated},fieldStore(){return this.dataInputFormStore.dataInputForm.fieldStore},uploading:{get(){return this.dataInputFormStore.dataInputForm.uploading},set(e){this.dataInputFormStore.dataInputForm.uploading=e}},previewInput(){return this.fieldStore.getPreview},convertedInput(){return this.fieldStore.convertedInput},inputIsValidated(){return this.dataInputFormStore.dataInputForm.fieldStore.isValidated},datashapeDescriptor(){if(!this.courseCfg||!this.courseCfg.dataShapes)return{course:"",dataShape:""};for(const e of this.courseCfg.dataShapes){const t=O.getDataShapeDescriptor(e.name);if(t.dataShape===this.dataShape.name)return t}return{course:"",dataShape:""}}},watch:{dataShape:{handler(){this.previewComponent||this.getImplementingViews()},immediate:!0},store:{handler(){this.convertInput()}},"dataShape.fields"(e){console.log(`[DataInputForm].watch(fields): newFields ${JSON.stringify(e)}`),console.log(`[DataInputForm].watch(fields): fields ${JSON.stringify(this.dataShape.fields)}`),this.fieldInputRefs=new Array(e.length).fill(null),console.log(`[DataInputForm].watch(fields): fieldRefs ${JSON.stringify(this.fieldInputRefs)}`)}},created(){this.uploading=!1,this.courseDB=D().getCourseDB(this.courseCfg.courseID),this.getCourseTags(),this.dataInputFormStore.setDataShape(this.dataShape),console.log(`[DataInputForm].created: fields: ${JSON.stringify(this.dataShape.fields)}`),this.fieldInputRefs=new Array(this.dataShape.fields.length).fill(null),this.previewComponent&&this.getImplementingViews()},beforeUnmount(){this.fieldInputRefs=[]},methods:{async updateTags(e){console.log(`[DataInputForm] tags updated: ${JSON.stringify(e)}`),this.tags=e},setFieldInputRef(e,t){for(console.log(`[DataInputForm].setFieldInputRef: index: ${t}`),t>=this.fieldInputRefs.length&&(this.fieldInputRefs=this.fieldInputRefs.concat(new Array(t-this.fieldInputRefs.length+1).fill(null)));null===this.fieldInputRefs[this.fieldInputRefs.length-1];)this.fieldInputRefs.pop();this.fieldInputRefs[t]=e},async getCourseTags(){const e=await this.courseDB.getCourseTagStubs();this.autoCompleteSuggestions=e.rows.map((e=>e.doc.name))},expectedValidations(){return this.dataShape.fields.length},checkInput:()=>!0,convertInput(){},inputContainsTranspositionFcns(){this.convertInput();for(const e in this.convertedInput)if("function"==typeof this.convertedInput[e])return!0;return!1},objectContainsFunction(e){for(const t in e)if("function"==typeof e[t])return!0;return!1},expandO(e){let t=[];if(this.objectContainsFunction(e)){for(const n in e)if("function"==typeof e[n]){console.log(`[DataInputForm] Key ${n} is a function.`);const r=[];e[n]().forEach((t=>{let a={};a=structuredClone(e),a[n]=t,console.log(`[DataInputForm] Replaced Copy: ${JSON.stringify(a)}`),r.push(a)})),r.forEach((e=>{if(this.objectContainsFunction(e)){console.log("[DataInputForm] 2nd pass...");const n=this.expandO(e);t=t.concat(n)}else t.push(e)}))}return t}return[]},getTags(){const e=[];this.fieldInputs.forEach((t=>{if(t.generateTags){const n=t.generateTags();e.push(...n)}}));const t=this.$refs.tagsInput.tags.map((e=>e.text));return e.concat(t)},getElo(){for(const e of this.fieldInputs)if(e.generateELO)return e.generateELO()},async submit(){if(this.checkInput()){console.log(`[DataInputForm] Store: ${JSON.stringify(this.fieldStore.inputs)}`),console.log(`[DataInputForm] ConvertedStore: ${JSON.stringify(this.convertedInput)}`),this.uploading=!0;let e=[];this.inputContainsTranspositionFcns()?(console.log(`[DataInputForm] Expanded input: ${JSON.stringify(this.expandO(this.convertedInput))}`),e=this.expandO(this.convertedInput)):(console.log("[DataInputForm] No Transposition fcn detected"),e=[this.convertedInput]);const t=await Promise.all(e.map((async e=>await this.courseDB.addNote(this.datashapeDescriptor.course,this.dataShape,e,(await P()).getUsername(),this.getTags(),void 0,this.getElo()))));if(t[0].status===F.ok){$({text:"Content added... Thank you!",status:F.ok});const e=this.$refs.tagsInput;e.tags.length&&(e.updateAvailableCourseTags(),e.tags=[]),this.reset()}else $({text:"A problem occurred. Content has not been added.",status:F.error}),console.error(`Error in DataInputForm.submit(). Result from addNote: ${JSON.stringify(t)}`),this.uploading=!1}},reset(){console.log("[DataInputForm].reset()"),this.uploading=!1,this.fieldInputs.forEach((e=>{e.clearData()})),this.fieldStore.$reset(),this.fieldInputs[0].focus(),this.convertInput()},getImplementingViews(){if(this.previewComponent)return console.log("[DataInputForm] Getting previewComponent views"),void(this.shapeViews=this.previewComponent.views);for(const e of this.courseCfg.dataShapes){const t=O.getDataShapeDescriptor(e.name);if(console.log("[DataInputForm] descriptor",t),console.log("[DataInputForm] this.dataShape",this.dataShape),console.log("[DataInputForm] this.dataShape.name",this.dataShape.name),t.dataShape===this.dataShape.name){const n=this.courseWare.getCourseWare(t.course);this.shapeViews=[],n.getBaseQTypes().forEach((e=>{e.dataShapes[0].name===this.dataShape.name&&(this.shapeViews=this.shapeViews.concat(e.views))}));for(const t of e.questionTypes){const e=O.getQuestionDescriptor(t);n.getQuestion(e.questionType).views.forEach((e=>{this.shapeViews=this.shapeViews.concat(e)}))}}}},isFieldInput:e=>Me(e)}}),lt={key:1};const ct=/* @__PURE__ */X(st,[["render",function(e,a,p,h,g,m){const y=t("string-input"),_=t("chess-puzzle-input"),b=t("number-input"),w=t("integer-input"),C=t("markdown-input"),S=t("midi-input"),I=t("media-drag-drop-uploader"),k=t("tags-input"),x=t("v-icon"),D=t("v-btn"),V=t("v-form"),T=t("v-col"),E=t("card-browser"),A=t("v-row"),O=t("v-container");return r(),u(O,{fluid:""},{default:l((()=>[f(A,null,{default:l((()=>[f(T,{cols:"12",xl:"6"},{default:l((()=>[f(V,{"ma-2":"",autocomplete:"off"},{default:l((()=>[(r(!0),n(i,null,o(e.dataShape.fields,((t,a)=>(r(),n("div",{key:e.dataShape.fields.indexOf(t)},[t.type===e.ftString?(r(),u(y,{key:0,ref_for:!0,ref:t=>e.setFieldInputRef(t,a),field:t,autofocus:0==a},null,8,["field","autofocus"])):t.type===e.chessPuzzle?(r(),u(_,{key:1,ref_for:!0,ref:t=>e.setFieldInputRef(t,a),field:t,autofocus:0==a},null,8,["field","autofocus"])):t.type===e.num?(r(),u(b,{key:2,ref_for:!0,ref:t=>e.setFieldInputRef(t,a),field:t,autofocus:0==a},null,8,["field","autofocus"])):t.type===e.int?(r(),u(w,{key:3,ref_for:!0,ref:t=>e.setFieldInputRef(t,a),field:t,autofocus:0==a},null,8,["field","autofocus"])):t.type===e.mkd?(r(),u(C,{key:4,ref_for:!0,ref:t=>e.setFieldInputRef(t,a),field:t,autofocus:0==a,"data-cy":"markdown-input"},null,8,["field","autofocus"])):t.type===e.midi?(r(),u(S,{key:5,ref_for:!0,ref:t=>e.setFieldInputRef(t,a),field:t,autofocus:0==a},null,8,["field","autofocus"])):t.type===e.uploader?(r(),u(I,{key:6,ref_for:!0,ref:t=>e.setFieldInputRef(t,a),field:t,autofocus:0==a},null,8,["field","autofocus"])):d("",!0)])))),128)),f(k,{ref:"tagsInput","hide-submit":!0,"course-i-d":e.courseCfg.courseID,"card-i-d":""},null,8,["course-i-d"]),e.previewComponent?(r(),n("div",lt,"Input validated: "+c(e.inputIsValidated),1)):(r(),u(D,{key:0,"data-cy":"add-card-btn",class:"float-right",type:"submit",color:"primary",loading:e.uploading,disabled:!e.allowSubmit,onClick:v(e.submit,["prevent"])},{default:l((()=>[a[1]||(a[1]=s(" Add card ")),f(x,{end:""},{default:l((()=>a[0]||(a[0]=[s("mdi-plus-circle")]))),_:1})])),_:1},8,["loading","disabled","onClick"]))])),_:1})])),_:1}),f(T,{cols:"12",xl:"6"},{default:l((()=>[e.inputIsValidated?(r(),u(E,{key:0,class:"ml-4",views:e.shapeViews,data:[e.previewInput]},null,8,["views","data"])):d("",!0)])),_:1})])),_:1})])),_:1})}]]),dt=e({name:"CardPreviewList",components:{CardBrowser:z,SkMouseTrap:B},props:{parsedCards:{type:Array,required:!0,default:()=>[]},dataShape:{type:Object,required:!0},viewComponents:{type:Array,required:!1,default:()=>[]}},emits:["update:parsedCards","edit-card","delete-card"],data:()=>({currentIndex:0,loading:!1,keyBindings:[],showDeleteConfirm:!1,dontAskAgain:!1,skipDeleteConfirmation:!1,shortcutsEnabled:!0}),computed:{currentCard(){return 0===this.parsedCards.length||this.currentIndex>=this.parsedCards.length?null:this.parsedCards[this.currentIndex]},currentViewData(){return this.currentCard?{Input:this.currentCard.markdown}:{Input:""}}},mounted(){this.setupKeyBindings()},beforeUnmount(){this.shortcutsEnabled&&this.keyBindings.forEach((e=>{L.removeBinding(e.hotkey)}))},methods:{nextCard(){this.currentIndex<this.parsedCards.length-1&&this.currentIndex++},prevCard(){this.currentIndex>0&&this.currentIndex--},showCard(e){e>=0&&e<this.parsedCards.length&&(this.currentIndex=e)},setupKeyBindings(){this.keyBindings=[{command:"Previous Card",hotkey:"left",callback:()=>(this.prevCard(),!1)},{command:"Next Card",hotkey:"right",callback:()=>(this.nextCard(),!1)},{command:"Delete Card",hotkey:"del",callback:()=>(this.promptDelete(),!1)},{command:"Edit Card",hotkey:"e",callback:()=>(this.editCurrentCard(),!1)}],this.shortcutsEnabled&&L.addBinding(this.keyBindings)},enableShortcuts(){this.shortcutsEnabled||(this.shortcutsEnabled=!0,L.addBinding(this.keyBindings),console.log("[CardPreviewList] Keyboard shortcuts enabled"))},disableShortcuts(){this.shortcutsEnabled&&(this.shortcutsEnabled=!1,this.keyBindings.forEach((e=>{L.removeBinding(e.hotkey)})),console.log("[CardPreviewList] Keyboard shortcuts disabled"))},toggleShortcuts(e){e?this.enableShortcuts():this.disableShortcuts()},promptDelete(){this.currentCard&&(this.skipDeleteConfirmation?this.deleteCurrentCard():this.showDeleteConfirm=!0)},cancelDelete(){this.showDeleteConfirm=!1},confirmDelete(){this.dontAskAgain&&(this.skipDeleteConfirmation=!0),this.showDeleteConfirm=!1,this.deleteCurrentCard()},deleteCurrentCard(){if(!this.currentCard)return;const e=[...this.parsedCards];e.splice(this.currentIndex,1),this.$emit("update:parsedCards",e),this.$emit("delete-card",this.currentIndex),this.currentIndex>=e.length&&e.length>0&&(this.currentIndex=e.length-1)},editCurrentCard(){this.currentCard&&this.$emit("edit-card",this.currentCard,this.currentIndex)}}}),ft={class:"card-preview-list"},pt={class:"d-flex align-center"},ht={class:"text-subtitle-1 mr-2"},gt={key:0,class:"d-flex justify-center align-center my-4"},mt={key:1},vt={key:0},yt={key:0},_t={key:1},bt={class:"markdown-content"},wt={class:"card-metadata mt-2"},Ct={class:"d-flex flex-wrap gap-1"},St={key:0,class:"mt-2 text-caption"},It={key:1,class:"text-center pa-4"};const kt=e({name:"BulkImportView",components:{CardPreviewList:/* @__PURE__ */X(dt,[["render",function(e,p,h,g,m,v){const y=t("v-card-title"),_=t("v-checkbox"),b=t("v-card-text"),w=t("v-spacer"),C=t("v-btn"),S=t("v-card-actions"),I=t("v-card"),k=t("v-dialog"),x=t("sk-mouse-trap"),D=t("v-progress-circular"),V=t("card-browser"),T=t("v-sheet"),E=t("v-chip"),A=t("v-icon");return r(),n("div",ft,[f(k,{modelValue:e.showDeleteConfirm,"onUpdate:modelValue":p[1]||(p[1]=t=>e.showDeleteConfirm=t),"max-width":"400px"},{default:l((()=>[f(I,null,{default:l((()=>[f(y,{class:"text-h5"},{default:l((()=>p[2]||(p[2]=[s("Remove Card")]))),_:1}),f(b,null,{default:l((()=>[p[3]||(p[3]=a("p",null,"Are you sure you want to remove this card?",-1)),f(_,{modelValue:e.dontAskAgain,"onUpdate:modelValue":p[0]||(p[0]=t=>e.dontAskAgain=t),label:"Don't ask me again","hide-details":"",class:"mt-2"},null,8,["modelValue"])])),_:1}),f(S,null,{default:l((()=>[f(w),f(C,{color:"grey-darken-1",variant:"text",onClick:e.cancelDelete},{default:l((()=>p[4]||(p[4]=[s("Cancel")]))),_:1},8,["onClick"]),f(C,{color:"error",onClick:e.confirmDelete},{default:l((()=>p[5]||(p[5]=[s("Remove")]))),_:1},8,["onClick"])])),_:1})])),_:1})])),_:1},8,["modelValue"]),e.parsedCards.length>0?(r(),u(I,{key:0,class:"mb-4"},{default:l((()=>[f(y,{class:"d-flex align-center justify-space-between"},{default:l((()=>[p[6]||(p[6]=a("span",null,"Card Preview",-1)),a("div",pt,[a("div",ht,c(e.currentIndex+1)+" of "+c(e.parsedCards.length),1),f(x)])])),_:1}),f(b,null,{default:l((()=>[e.loading?(r(),n("div",gt,[f(D,{indeterminate:"",color:"primary"})])):(r(),n("div",mt,[e.currentCard?(r(),n("div",vt,[f(T,{class:"card-content pa-4 mb-4",rounded:"",border:""},{default:l((()=>[e.viewComponents&&e.viewComponents.length>0?(r(),n("div",yt,[f(V,{views:e.viewComponents,data:[e.currentViewData],"suppress-spinner":!0},null,8,["views","data"])])):(r(),n("div",_t,[p[7]||(p[7]=a("div",{class:"mb-2 font-weight-bold"},"Card content:",-1)),a("div",bt,c(e.currentCard.markdown),1)]))])),_:1}),a("div",wt,[a("div",Ct,[(r(!0),n(i,null,o(e.currentCard.tags,(e=>(r(),u(E,{key:e,size:"small",color:"primary",variant:"outlined",class:"mr-1 mb-1"},{default:l((()=>[s(c(e),1)])),_:2},1024)))),128))]),void 0!==e.currentCard.elo?(r(),n("div",St,"ELO: "+c(e.currentCard.elo),1)):d("",!0)])])):(r(),n("div",It,"No card selected or available to preview."))]))])),_:1}),f(S,{class:"px-4 pb-4"},{default:l((()=>[f(C,{variant:"outlined",icon:"",disabled:0===e.currentIndex||e.loading,onClick:e.prevCard},{default:l((()=>[f(A,null,{default:l((()=>p[8]||(p[8]=[s("mdi-chevron-left")]))),_:1})])),_:1},8,["disabled","onClick"]),f(w),f(C,{variant:"tonal",color:"error","prepend-icon":"mdi-delete",class:"mx-2",disabled:!e.currentCard||e.loading,onClick:e.promptDelete},{default:l((()=>p[9]||(p[9]=[s(" Remove ")]))),_:1},8,["disabled","onClick"]),f(C,{variant:"tonal",color:"primary","prepend-icon":"mdi-pencil",class:"mx-2",disabled:!e.currentCard||e.loading,onClick:e.editCurrentCard},{default:l((()=>p[10]||(p[10]=[s(" Edit ")]))),_:1},8,["disabled","onClick"]),f(w),f(C,{variant:"outlined",icon:"",disabled:e.currentIndex>=e.parsedCards.length-1||e.loading,onClick:e.nextCard},{default:l((()=>[f(A,null,{default:l((()=>p[11]||(p[11]=[s("mdi-chevron-right")]))),_:1})])),_:1},8,["disabled","onClick"])])),_:1})])),_:1})):d("",!0)])}],["__scopeId","data-v-41613480"]])},props:{courseCfg:{type:Object,required:!0}},data:()=>({bulkText:"",parsedCards:[],parsingComplete:!1,importAttempted:!1,results:[],processing:!1,courseDB:null,dataShape:k[0],cardViewComponents:[],editingCard:null,editingCardIndex:-1,showEditDialog:!1,editedMarkdown:"",editedTags:[],editedElo:void 0,newTagText:""}),computed:{uniqueTags(){if(!this.parsedCards||0===this.parsedCards.length)return[];const e=this.parsedCards.reduce(((e,t)=>(t.tags&&t.tags.length>0&&e.push(...t.tags),e)),[]);return[...new Set(e)].sort()}},created(){this.courseCfg?.courseID?(this.courseDB=D().getCourseDB(this.courseCfg.courseID),this.courseCfg.dataShapes&&0!==this.courseCfg.dataShapes.length?this.initializeCardPreviewComponents():(console.error("[BulkImportView] Course config does not contain any dataShapes."),$({text:"Course configuration has no dataShapes. Bulk import may not work correctly.",status:F.warning}))):(console.error("[BulkImportView] Course config or Course ID is missing."),$({text:"Course configuration is missing. Cannot initialize bulk import.",status:F.error}))},methods:{handleDeleteCard(e){console.log(`[BulkImportView] Card at index ${e} was deleted`),$({text:"Card removed from import list",status:F.ok})},handleEditCard(e,t){this.$refs.cardPreviewList&&this.$refs.cardPreviewList.toggleShortcuts(!1),this.editingCard={...e},this.editingCardIndex=t,this.editedMarkdown=e.markdown,this.editedTags=[...e.tags],this.editedElo=e.elo,this.showEditDialog=!0,this.$nextTick((()=>{this.$refs.markdownTextarea&&this.$refs.markdownTextarea.$el.querySelector("textarea")?.focus()}))},saveEditedCard(){if(this.editingCardIndex<0||!this.editingCard)return;const e={markdown:this.editedMarkdown,tags:this.editedTags,elo:this.editedElo},t=[...this.parsedCards];t[this.editingCardIndex]=e,this.parsedCards=t,this.closeEditDialog(),$({text:"Card updated successfully",status:F.ok})},closeEditDialog(){this.showEditDialog=!1,this.editingCard=null,this.editingCardIndex=-1,this.editedMarkdown="",this.editedTags=[],this.editedElo=void 0,setTimeout((()=>{this.$refs.cardPreviewList&&this.$refs.cardPreviewList.toggleShortcuts(!0)}),100)},addTag(){const e=this.newTagText.trim();e&&!this.editedTags.includes(e)&&(this.editedTags.push(e),this.newTagText="")},removeTag(e){this.editedTags=this.editedTags.filter((t=>t!==e))},initializeCardPreviewComponents(){const e=this.courseCfg?.dataShapes?.[0];if(!e)return;this.dataShape.name!==k[0].name&&(this.dataShape=k[0]);const t=O.getDataShapeDescriptor(e.name),n=b.getCourse(t.course);if(n){this.cardViewComponents=[],n.getBaseQTypes().forEach((e=>{e.dataShapes[0].name===this.dataShape?.name&&(this.cardViewComponents=this.cardViewComponents.concat(e.views))}));for(const t of e.questionTypes){const e=O.getQuestionDescriptor(t),r=n.getQuestion(e.questionType)?.views||[];this.cardViewComponents=this.cardViewComponents.concat(r)}console.log(`[BulkImportView] Loaded ${this.cardViewComponents.length} view components for card preview`)}},resetToInputStage(){this.parsingComplete=!1,this.parsedCards=[],this.importAttempted=!1},startNewBulkImport(){this.bulkText="",this.results=[],this.parsedCards=[],this.parsingComplete=!1,this.importAttempted=!1},handleInitialParse(){if(this.courseDB){if(q(this.bulkText)){this.processing=!0,this.results=[],this.parsedCards=[],this.parsingComplete=!1;try{if(this.parsedCards=N(this.bulkText),0===this.parsedCards.length)return $({text:'No cards could be parsed from the input. Please check the format and ensure cards are separated by two "---" lines and that cards have content.',status:F.warning}),void(this.processing=!1);0===this.cardViewComponents.length&&this.initializeCardPreviewComponents(),this.parsingComplete=!0,console.log(`[BulkImportView] Successfully parsed ${this.parsedCards.length} cards for preview`)}catch(e){console.error("[BulkImportView] Error parsing bulk text:",e),$({text:`Error parsing cards: ${e instanceof Error?e.message:"Unknown error"}`,status:F.error})}finally{this.processing=!1}}}else $({text:"Database connection not available. Cannot process cards.",status:F.error})},async confirmAndImportCards(){if(!this.courseDB)return $({text:"Database connection lost before import.",status:F.error}),void(this.processing=!1);if(0===this.parsedCards.length)return $({text:"No parsed cards to import.",status:F.warning}),void(this.processing=!1);if(!this.courseCfg?.dataShapes||0===this.courseCfg.dataShapes.length)return $({text:"This course has no data shapes configured. Cannot import cards.",status:F.error}),void(this.processing=!1);this.processing=!0,this.results=[];const e=(await P()).getUsername(),t=k[0];if(!t)return $({text:"Critical: Could not find BlanksCardDataShapes. Aborting import.",status:F.error}),void(this.processing=!1);const n=this.courseCfg?.dataShapes?.[0];if(!n)return $({text:"Critical: No data shapes found in course configuration. Aborting import.",status:F.error}),void(this.processing=!1);const r=O.getDataShapeDescriptor(n.name).course,a={dataShape:t,courseCode:r,userName:e},i=E(a);if(!i.isValid)return $({text:i.errorMessage||"Invalid processor configuration for import.",status:F.error}),void(this.processing=!1);console.log("[BulkImportView] Starting import of parsed cards:",{courseID:this.courseCfg.courseID,dataShapeToUse:t.name,courseCode:r,numberOfCards:this.parsedCards.length});try{this.results=await A(this.parsedCards,this.courseDB,a)}catch(o){console.error("[BulkImportView] Error importing parsed cards:",o),this.results.push({originalText:"Bulk Operation Error",status:"error",message:`Critical error during import: ${o instanceof Error?o.message:"Unknown error"}`})}finally{this.processing=!1,this.importAttempted=!0}this.results.every((e=>"success"===e.status))&&this.results.length>0?$({text:`${this.results.length} card(s) imported successfully!`,status:F.ok}):this.results.some((e=>"error"===e.status))&&$({text:"Some cards failed to import. Please review the results below.",status:F.warning})}}}),xt={key:0},Dt={key:1,class:"text--secondary"},Vt={class:"my-4"},Tt={class:"d-flex align-center mb-2"},Et={class:"d-flex flex-wrap"},At={key:0,class:"ml-6"},Ot={key:1,class:"ml-6"},Ft={key:2,class:"ml-6"},Rt={style:{"white-space":"pre-wrap","background-color":"#f5f5f5",padding:"5px"}};const jt=/* @__PURE__ */X(kt,[["render",function(e,p,h,g,m,b){const w=t("v-textarea"),C=t("v-col"),S=t("v-row"),I=t("v-card-title"),k=t("v-chip"),x=t("v-card-text"),D=t("v-card"),V=t("card-preview-list"),T=t("v-text-field"),E=t("v-btn"),A=t("v-form"),O=t("v-spacer"),F=t("v-tooltip"),R=t("v-card-actions"),j=t("v-dialog"),U=t("v-icon"),q=t("v-list-subheader"),N=t("v-list-item-title"),P=t("v-list-item-subtitle"),M=t("v-list-item"),z=t("v-list"),$=t("v-container");return r(),u($,{fluid:""},{default:l((()=>[e.parsingComplete?d("",!0):(r(),u(S,{key:0},{default:l((()=>[f(C,{cols:"12"},{default:l((()=>[f(w,{modelValue:e.bulkText,"onUpdate:modelValue":p[0]||(p[0]=t=>e.bulkText=t),label:"Bulk Card Input",placeholder:"Paste card data here.\nSeparate cards with two consecutive '---' lines on their own lines.\nExample:\nCard 1 Question\n{{blank}}\ntags: tagA, tagB\nelo: 1500\n---\n---\nCard 2 Question\nAnother {{blank}}\nelo: 1200\ntags: tagC",rows:"15",variant:"outlined","data-cy":"bulk-import-textarea"},null,8,["modelValue"])])),_:1})])),_:1})),e.parsingComplete?(r(),u(S,{key:1,class:"mb-4"},{default:l((()=>[f(C,{cols:"12",md:"4"},{default:l((()=>[f(D,{border:""},{default:l((()=>[f(I,null,{default:l((()=>p[6]||(p[6]=[s("Parsing Summary")]))),_:1}),f(x,null,{default:l((()=>[a("p",null,[a("strong",null,c(e.parsedCards.length),1),p[7]||(p[7]=s(" card(s) parsed and ready for import. "))]),e.parsedCards.length>0?(r(),n("div",xt,[p[8]||(p[8]=a("strong",null,"Tags Found:",-1)),e.uniqueTags.length>0?(r(!0),n(i,{key:0},o(e.uniqueTags,(e=>(r(),u(k,{key:e,class:"mr-1 mb-1",size:"small",label:""},{default:l((()=>[s(c(e),1)])),_:2},1024)))),128)):(r(),n("span",Dt,"No unique tags identified across parsed cards."))])):d("",!0)])),_:1})])),_:1})])),_:1}),f(C,{cols:"12",md:"8"},{default:l((()=>[e.parsedCards.length>0?(r(),u(V,{key:0,ref:"cardPreviewList","parsed-cards":e.parsedCards,"onUpdate:parsedCards":p[1]||(p[1]=t=>e.parsedCards=t),"data-shape":e.dataShape,"view-components":e.cardViewComponents,onEditCard:e.handleEditCard,onDeleteCard:e.handleDeleteCard},null,8,["parsed-cards","data-shape","view-components","onEditCard","onDeleteCard"])):d("",!0)])),_:1})])),_:1})):d("",!0),f(j,{modelValue:e.showEditDialog,"onUpdate:modelValue":p[5]||(p[5]=t=>e.showEditDialog=t),"max-width":"800px"},{default:l((()=>[f(D,null,{default:l((()=>[f(I,null,{default:l((()=>p[9]||(p[9]=[s("Edit Card")]))),_:1}),f(x,null,{default:l((()=>[f(A,{onSubmit:v(e.saveEditedCard,["prevent"]),onKeydown:_(e.closeEditDialog,["esc"])},{default:l((()=>[f(w,{ref:"markdownTextarea",modelValue:e.editedMarkdown,"onUpdate:modelValue":p[2]||(p[2]=t=>e.editedMarkdown=t),label:"Card Content",rows:"6","auto-grow":"",variant:"outlined",onKeydown:_(v(e.saveEditedCard,["ctrl"]),["enter"])},null,8,["modelValue","onKeydown"]),a("div",Vt,[a("div",Tt,[p[11]||(p[11]=a("h3",{class:"text-subtitle-1 mr-2"},"Tags",-1)),f(T,{modelValue:e.newTagText,"onUpdate:modelValue":p[3]||(p[3]=t=>e.newTagText=t),density:"compact","hide-details":"",placeholder:"Add a tag",variant:"outlined",class:"mr-2",onKeydown:[_(v(e.addTag,["prevent"]),["enter"]),_(e.closeEditDialog,["esc"])]},null,8,["modelValue","onKeydown"]),f(E,{size:"small",color:"primary",variant:"text",onClick:e.addTag},{default:l((()=>p[10]||(p[10]=[s("Add")]))),_:1},8,["onClick"])]),a("div",Et,[(r(!0),n(i,null,o(e.editedTags,(t=>(r(),u(k,{key:t,closable:"",class:"mr-1 mb-1","onClick:close":n=>e.removeTag(t)},{default:l((()=>[s(c(t),1)])),_:2},1032,["onClick:close"])))),128))])]),f(T,{modelValue:e.editedElo,"onUpdate:modelValue":p[4]||(p[4]=t=>e.editedElo=t),modelModifiers:{number:!0},label:"ELO Rating (optional)",type:"number",variant:"outlined",min:"0",max:"3000"},null,8,["modelValue"])])),_:1},8,["onSubmit","onKeydown"])])),_:1}),f(R,null,{default:l((()=>[f(O),f(E,{color:"grey",variant:"text",onClick:e.closeEditDialog},{default:l((()=>[p[13]||(p[13]=s(" Cancel ")),f(F,{activator:"parent",location:"top"},{default:l((()=>p[12]||(p[12]=[s("Press ESC")]))),_:1})])),_:1},8,["onClick"]),f(E,{color:"primary",onClick:e.saveEditedCard},{default:l((()=>[p[15]||(p[15]=s(" Save ")),f(F,{activator:"parent",location:"top"},{default:l((()=>p[14]||(p[14]=[s("Press Ctrl+Enter")]))),_:1})])),_:1},8,["onClick"])])),_:1})])),_:1})])),_:1},8,["modelValue"]),f(S,null,{default:l((()=>[f(C,{cols:"12"},{default:l((()=>[e.parsingComplete?d("",!0):(r(),u(E,{key:0,color:"primary",loading:e.processing,disabled:!e.bulkText.trim()||e.processing,"data-cy":"bulk-import-parse-btn",onClick:e.handleInitialParse},{default:l((()=>[p[17]||(p[17]=s(" Parse Cards ")),f(U,{end:""},{default:l((()=>p[16]||(p[16]=[s("mdi-play-circle-outline")]))),_:1})])),_:1},8,["loading","disabled","onClick"])),e.parsingComplete?(r(),n(i,{key:1},[f(E,{color:"primary",class:"mr-2",loading:e.processing,disabled:0===e.parsedCards.length||e.processing||e.importAttempted,"data-cy":"bulk-import-confirm-btn",onClick:e.confirmAndImportCards},{default:l((()=>[s(" Confirm and Import "+c(e.parsedCards.length)+" Card(s) ",1),f(U,{end:""},{default:l((()=>p[18]||(p[18]=[s("mdi-check-circle-outline")]))),_:1})])),_:1},8,["loading","disabled","onClick"]),e.importAttempted?d("",!0):(r(),u(E,{key:0,variant:"outlined",color:"grey-darken-1",disabled:e.processing,"data-cy":"bulk-import-edit-again-btn",onClick:e.resetToInputStage},{default:l((()=>[f(U,{start:""},{default:l((()=>p[19]||(p[19]=[s("mdi-pencil")]))),_:1}),p[20]||(p[20]=s(" Back to bulk-editor. "))])),_:1},8,["disabled","onClick"])),e.importAttempted?(r(),u(E,{key:1,variant:"outlined",color:"blue-darken-1",disabled:e.processing,"data-cy":"bulk-import-add-another-btn",onClick:e.startNewBulkImport},{default:l((()=>[f(U,{start:""},{default:l((()=>p[21]||(p[21]=[s("mdi-plus-circle-outline")]))),_:1}),p[22]||(p[22]=s(" Add Another Bulk Import "))])),_:1},8,["disabled","onClick"])):d("",!0)],64)):d("",!0)])),_:1})])),_:1}),e.results.length>0?(r(),u(S,{key:2},{default:l((()=>[f(C,{cols:"12"},{default:l((()=>[f(z,{density:"compact"},{default:l((()=>[f(q,null,{default:l((()=>p[23]||(p[23]=[s("Import Results")]))),_:1}),(r(!0),n(i,null,o(e.results,((e,t)=>(r(),u(M,{key:t,class:y({"lime-lighten-5":"success"===e.status,"red-lighten-5":"error"===e.status,"force-dark-text":"success"===e.status||"error"===e.status})},{default:l((()=>[f(N,null,{default:l((()=>[f(U,{color:"success"===e.status?"green":"red"},{default:l((()=>[s(c("success"===e.status?"mdi-check-circle":"mdi-alert-circle"),1)])),_:2},1032,["color"]),s(" Card "+c(t+1),1)])),_:2},1024),f(P,null,{default:l((()=>[e.message?(r(),n("div",At,c(e.message),1)):d("",!0),e.cardId?(r(),n("div",Ot,"ID: "+c(e.cardId),1)):d("",!0),"error"===e.status&&e.originalText?(r(),n("details",Ft,[p[24]||(p[24]=a("summary",null,"Original Input",-1)),a("pre",Rt,c(e.originalText),1)])):d("",!0)])),_:2},1024)])),_:2},1032,["class"])))),128))])),_:1})])),_:1})])),_:1})):d("",!0)])),_:1})}],["__scopeId","data-v-901d842b"]]),Ut=e({name:"CourseEditor",components:{DataInputForm:ct,ComponentRegistration:re,NavigationStrategyEditor:Pe,BulkImportView:jt},props:{course:{type:String,required:!0}},data:()=>({registeredDataShapes:[],dataShapes:[],selectedShape:x.dataShapes[0].name,courseConfig:null,dataShape:k[0],loading:!0,currentTab:"single",dataInputFormStore:ut()}),watch:{selectedShape:{handler(e){e&&(this.dataShape=this.getDataShape(e),this.dataInputFormStore.setDataShape(this.dataShape),this.dataInputFormStore.dataInputForm.course=this.courseConfig)}}},async created(){this.courseConfig=await D().getCoursesDB().getCourseConfig(this.course),b.courses.forEach((e=>{e.questions.forEach((e=>{e.dataShapes.forEach((e=>{this.dataShapes.push(e)}))}))})),this.courseConfig&&this.courseConfig.dataShapes&&this.courseConfig.dataShapes.forEach((e=>{this.registeredDataShapes.push(this.dataShapes.find((t=>t.name===O.getDataShapeDescriptor(e.name).dataShape)))})),this.loading=!1},methods:{getDataShape(e){return this.dataShapes.find((t=>t.name===e))}}}),qt={key:0,class:"courseEditor"},Nt={key:0},Pt={key:1},Mt={class:"text-h4"};const zt=/* @__PURE__ */X(Ut,[["render",function(e,i,o,p,h,g){const m=t("v-progress-circular"),v=t("router-link"),y=t("v-tab"),_=t("v-tabs"),b=t("v-select"),w=t("data-input-form"),C=t("v-container"),S=t("v-window-item"),I=t("bulk-import-view"),k=t("component-registration"),x=t("navigation-strategy-editor"),D=t("v-window");return e.course?(r(),n("div",qt,[e.loading?(r(),n("div",Nt,[f(m,{indeterminate:"",color:"secondary"})])):(r(),n("div",Pt,[a("h1",Mt,[f(v,{to:"/q"},{default:l((()=>i[3]||(i[3]=[s("Quilts")]))),_:1}),i[4]||(i[4]=s(" / ")),f(v,{to:`/q/${e.courseConfig?e.courseConfig.name:e.course}`},{default:l((()=>[s(c(e.courseConfig?.name),1)])),_:1},8,["to"])]),f(_,{modelValue:e.currentTab,"onUpdate:modelValue":i[0]||(i[0]=t=>e.currentTab=t),"bg-color":"primary",grow:""},{default:l((()=>[f(y,{value:"single"},{default:l((()=>i[5]||(i[5]=[s("Single Card Input")]))),_:1}),f(y,{value:"bulk"},{default:l((()=>i[6]||(i[6]=[s("Bulk Import")]))),_:1}),f(y,{value:"navigation"},{default:l((()=>i[7]||(i[7]=[s("Navigation")]))),_:1}),f(y,{value:"registration"},{default:l((()=>i[8]||(i[8]=[s("Component Registration")]))),_:1})])),_:1},8,["modelValue"]),f(D,{modelValue:e.currentTab,"onUpdate:modelValue":i[2]||(i[2]=t=>e.currentTab=t)},{default:l((()=>[f(S,{value:"single"},{default:l((()=>[f(C,{fluid:""},{default:l((()=>[f(b,{modelValue:e.selectedShape,"onUpdate:modelValue":i[1]||(i[1]=t=>e.selectedShape=t),label:"What kind of content are you adding?",items:e.registeredDataShapes.map((e=>e.name)),class:"mt-4"},null,8,["modelValue","items"]),""!==e.selectedShape&&e.courseConfig&&e.dataShape?(r(),u(w,{key:0,"data-shape":e.dataShape,"course-cfg":e.courseConfig},null,8,["data-shape","course-cfg"])):d("",!0)])),_:1})])),_:1}),f(S,{value:"bulk"},{default:l((()=>[f(C,{fluid:""},{default:l((()=>[e.courseConfig?(r(),u(I,{key:0,"course-cfg":e.courseConfig,class:"mt-4"},null,8,["course-cfg"])):d("",!0)])),_:1})])),_:1}),f(S,{value:"registration"},{default:l((()=>[f(C,{fluid:""},{default:l((()=>[f(k,{course:e.course,class:"mt-4"},null,8,["course"])])),_:1})])),_:1}),f(S,{value:"navigation"},{default:l((()=>[f(C,{fluid:""},{default:l((()=>[f(x,{"course-id":e.course},null,8,["course-id"])])),_:1})])),_:1})])),_:1},8,["modelValue"])]))])):d("",!0)}],["__scopeId","data-v-c987522c"]]);export{jt as BulkImportView,ot as ChessPuzzleInput,zt as CourseEditor,ct as DataInputForm,Je as IntegerInput,Ge as MarkdownInput,Ze as MediaDragDropUploader,rt as MidiInput,at as NumberInput,We as OptionsFieldInput,it as StringInput,Be as integerValidator,Me as isFieldInput,$e as numberValidator,ut as useDataInputFormStore,Le as useFieldInputStore};
2
2
  //# sourceMappingURL=edit-ui.es.js.map