hedgedoc/public/vendor/abcjs_basic_3.1.1-min.js

17 lines
482 KiB
JavaScript
Raw Normal View History

2017-03-26 08:39:07 -04:00
/*! abcjs v3.1.1 Copyright © 2009-2016 Paul Rosen and Gregory Dyke (http://abcjs.net) */
function calcHorizontalSpacing(isLastLine,stretchLast,targetWidth,lineWidth,spacing,spacingUnits,minSpace){if(isLastLine&&lineWidth/targetWidth<.66&&!stretchLast)return null;if(Math.abs(targetWidth-lineWidth)<2)return null;var relSpace=spacingUnits*spacing,constSpace=lineWidth-relSpace;return spacingUnits>0?(spacing=(targetWidth-constSpace)/spacingUnits,spacing*minSpace>50&&(spacing=50/minSpace),spacing):null}function centerWholeRests(voices){for(var i=0;i<voices.length;i++)for(var voice=voices[i],j=1;j<voice.children.length-1;j++){var absElem=voice.children[j];if(absElem.abcelem.rest&&"whole"===absElem.abcelem.rest.type){var before=voice.children[j-1],after=voice.children[j+1],midpoint=(after.x-before.x)/2+before.x;absElem.x=midpoint-absElem.w/2;for(var k=0;k<absElem.children.length;k++)absElem.children[k].x=absElem.x}}}function kernSymbols(lastSymbol,thisSymbol,lastSymbolWidth){var width=lastSymbolWidth;return"f"===lastSymbol&&"f"===thisSymbol&&(width=2*width/3),"p"===lastSymbol&&"p"===thisSymbol&&(width=5*width/6),"f"===lastSymbol&&"z"===thisSymbol&&(width=5*width/8),width}!function(glob){var current_event,stop,version="0.4.2",has="hasOwnProperty",separator=/[\.\/]/,wildcard="*",fun=function(){},numsort=function(a,b){return a-b},events={n:{}},eve=function(name,scope){name=String(name);var l,oldstop=stop,args=Array.prototype.slice.call(arguments,2),listeners=eve.listeners(name),z=0,indexed=[],queue={},out=[],ce=current_event;current_event=name,stop=0;for(var i=0,ii=listeners.length;i<ii;i++)"zIndex"in listeners[i]&&(indexed.push(listeners[i].zIndex),listeners[i].zIndex<0&&(queue[listeners[i].zIndex]=listeners[i]));for(indexed.sort(numsort);indexed[z]<0;)if(l=queue[indexed[z++]],out.push(l.apply(scope,args)),stop)return stop=oldstop,out;for(i=0;i<ii;i++)if(l=listeners[i],"zIndex"in l)if(l.zIndex==indexed[z]){if(out.push(l.apply(scope,args)),stop)break;do if(z++,l=queue[indexed[z]],l&&out.push(l.apply(scope,args)),stop)break;while(l)}else queue[l.zIndex]=l;else if(out.push(l.apply(scope,args)),stop)break;return stop=oldstop,current_event=ce,out.length?out:null};eve._events=events,eve.listeners=function(name){var item,items,k,i,ii,j,jj,nes,names=name.split(separator),e=events,es=[e],out=[];for(i=0,ii=names.length;i<ii;i++){for(nes=[],j=0,jj=es.length;j<jj;j++)for(e=es[j].n,items=[e[names[i]],e[wildcard]],k=2;k--;)item=items[k],item&&(nes.push(item),out=out.concat(item.f||[]));es=nes}return out},eve.on=function(name,f){if(name=String(name),"function"!=typeof f)return function(){};for(var names=name.split(separator),e=events,i=0,ii=names.length;i<ii;i++)e=e.n,e=e.hasOwnProperty(names[i])&&e[names[i]]||(e[names[i]]={n:{}});for(e.f=e.f||[],i=0,ii=e.f.length;i<ii;i++)if(e.f[i]==f)return fun;return e.f.push(f),function(zIndex){+zIndex==+zIndex&&(f.zIndex=+zIndex)}},eve.f=function(event){var attrs=[].slice.call(arguments,1);return function(){eve.apply(null,[event,null].concat(attrs).concat([].slice.call(arguments,0)))}},eve.stop=function(){stop=1},eve.nt=function(subname){return subname?new RegExp("(?:\\.|\\/|^)"+subname+"(?:\\.|\\/|$)").test(current_event):current_event},eve.nts=function(){return current_event.split(separator)},eve.off=eve.unbind=function(name,f){if(!name)return void(eve._events=events={n:{}});var e,key,splice,i,ii,j,jj,names=name.split(separator),cur=[events];for(i=0,ii=names.length;i<ii;i++)for(j=0;j<cur.length;j+=splice.length-2){if(splice=[j,1],e=cur[j].n,names[i]!=wildcard)e[names[i]]&&splice.push(e[names[i]]);else for(key in e)e[has](key)&&splice.push(e[key]);cur.splice.apply(cur,splice)}for(i=0,ii=cur.length;i<ii;i++)for(e=cur[i];e.n;){if(f){if(e.f){for(j=0,jj=e.f.length;j<jj;j++)if(e.f[j]==f){e.f.splice(j,1);break}!e.f.length&&delete e.f}for(key in e.n)if(e.n[has](key)&&e.n[key].f){var funcs=e.n[key].f;for(j=0,jj=funcs.length;j<jj;j++)if(funcs[j]==f){funcs.splice(j,1);break}!funcs.length&&delete e.n[key].f}}else{delete e.f;for(key in e.n)e.n[has](key)&&e.n[key].f&&delete e.n[key].f}e=e.n}},eve.once=function(name,f){var f2=function(){return eve.unbind(name,f2),f.apply(this,arguments)};return eve.on(name
var res=[],x=0,y=0,mx=0,my=0,start=0;"M"==pathArray[0][0]&&(x=pathArray[0][1],y=pathArray[0][2],mx=x,my=y,start++,res.push(["M",x,y]));for(var i=start,ii=pathArray.length;i<ii;i++){var r=res[i]=[],pa=pathArray[i];if(pa[0]!=lowerCase.call(pa[0]))switch(r[0]=lowerCase.call(pa[0]),r[0]){case"a":r[1]=pa[1],r[2]=pa[2],r[3]=pa[3],r[4]=pa[4],r[5]=pa[5],r[6]=+(pa[6]-x).toFixed(3),r[7]=+(pa[7]-y).toFixed(3);break;case"v":r[1]=+(pa[1]-y).toFixed(3);break;case"m":mx=pa[1],my=pa[2];default:for(var j=1,jj=pa.length;j<jj;j++)r[j]=+(pa[j]-(j%2?x:y)).toFixed(3)}else{r=res[i]=[],"m"==pa[0]&&(mx=pa[1]+x,my=pa[2]+y);for(var k=0,kk=pa.length;k<kk;k++)res[i][k]=pa[k]}var len=res[i].length;switch(res[i][0]){case"z":x=mx,y=my;break;case"h":x+=+res[i][len-1];break;case"v":y+=+res[i][len-1];break;default:x+=+res[i][len-2],y+=+res[i][len-1]}}return res.toString=R._path2string,pth.rel=pathClone(res),res},pathToAbsolute=R._pathToAbsolute=function(pathArray){var pth=paths(pathArray);if(pth.abs)return pathClone(pth.abs);if(R.is(pathArray,array)&&R.is(pathArray&&pathArray[0],array)||(pathArray=R.parsePathString(pathArray)),!pathArray||!pathArray.length)return[["M",0,0]];var res=[],x=0,y=0,mx=0,my=0,start=0;"M"==pathArray[0][0]&&(x=+pathArray[0][1],y=+pathArray[0][2],mx=x,my=y,start++,res[0]=["M",x,y]);for(var r,pa,crz=3==pathArray.length&&"M"==pathArray[0][0]&&"R"==pathArray[1][0].toUpperCase()&&"Z"==pathArray[2][0].toUpperCase(),i=start,ii=pathArray.length;i<ii;i++){if(res.push(r=[]),pa=pathArray[i],pa[0]!=upperCase.call(pa[0]))switch(r[0]=upperCase.call(pa[0]),r[0]){case"A":r[1]=pa[1],r[2]=pa[2],r[3]=pa[3],r[4]=pa[4],r[5]=pa[5],r[6]=+(pa[6]+x),r[7]=+(pa[7]+y);break;case"V":r[1]=+pa[1]+y;break;case"H":r[1]=+pa[1]+x;break;case"R":for(var dots=[x,y][concat](pa.slice(1)),j=2,jj=dots.length;j<jj;j++)dots[j]=+dots[j]+x,dots[++j]=+dots[j]+y;res.pop(),res=res[concat](catmullRom2bezier(dots,crz));break;case"M":mx=+pa[1]+x,my=+pa[2]+y;default:for(j=1,jj=pa.length;j<jj;j++)r[j]=+pa[j]+(j%2?x:y)}else if("R"==pa[0])dots=[x,y][concat](pa.slice(1)),res.pop(),res=res[concat](catmullRom2bezier(dots,crz)),r=["R"][concat](pa.slice(-2));else for(var k=0,kk=pa.length;k<kk;k++)r[k]=pa[k];switch(r[0]){case"Z":x=mx,y=my;break;case"H":x=r[1];break;case"V":y=r[1];break;case"M":mx=r[r.length-2],my=r[r.length-1];default:x=r[r.length-2],y=r[r.length-1]}}return res.toString=R._path2string,pth.abs=pathClone(res),res},l2c=function(x1,y1,x2,y2){return[x1,y1,x2,y2,x2,y2]},q2c=function(x1,y1,ax,ay,x2,y2){var _13=1/3,_23=2/3;return[_13*x1+_23*ax,_13*y1+_23*ay,_13*x2+_23*ax,_13*y2+_23*ay,x2,y2]},a2c=function(x1,y1,rx,ry,angle,large_arc_flag,sweep_flag,x2,y2,recursive){var xy,_120=120*PI/180,rad=PI/180*(+angle||0),res=[],rotate=cacher(function(x,y,rad){var X=x*math.cos(rad)-y*math.sin(rad),Y=x*math.sin(rad)+y*math.cos(rad);return{x:X,y:Y}});if(recursive)f1=recursive[0],f2=recursive[1],cx=recursive[2],cy=recursive[3];else{xy=rotate(x1,y1,-rad),x1=xy.x,y1=xy.y,xy=rotate(x2,y2,-rad),x2=xy.x,y2=xy.y;var x=(math.cos(PI/180*angle),math.sin(PI/180*angle),(x1-x2)/2),y=(y1-y2)/2,h=x*x/(rx*rx)+y*y/(ry*ry);h>1&&(h=math.sqrt(h),rx*=h,ry*=h);var rx2=rx*rx,ry2=ry*ry,k=(large_arc_flag==sweep_flag?-1:1)*math.sqrt(abs((rx2*ry2-rx2*y*y-ry2*x*x)/(rx2*y*y+ry2*x*x))),cx=k*rx*y/ry+(x1+x2)/2,cy=k*-ry*x/rx+(y1+y2)/2,f1=math.asin(((y1-cy)/ry).toFixed(9)),f2=math.asin(((y2-cy)/ry).toFixed(9));f1=x1<cx?PI-f1:f1,f2=x2<cx?PI-f2:f2,f1<0&&(f1=2*PI+f1),f2<0&&(f2=2*PI+f2),sweep_flag&&f1>f2&&(f1-=2*PI),!sweep_flag&&f2>f1&&(f2-=2*PI)}var df=f2-f1;if(abs(df)>_120){var f2old=f2,x2old=x2,y2old=y2;f2=f1+_120*(sweep_flag&&f2>f1?1:-1),x2=cx+rx*math.cos(f2),y2=cy+ry*math.sin(f2),res=a2c(x2,y2,rx,ry,angle,0,sweep_flag,x2old,y2old,[f2,f2old,cx,cy])}df=f2-f1;var c1=math.cos(f1),s1=math.sin(f1),c2=math.cos(f2),s2=math.sin(f2),t=math.tan(df/4),hx=4/3*rx*t,hy=4/3*ry*t,m1=[x1,y1],m2=[x1+hx*s1,y1-hy*c1],m3=[x2+hx*s2,y2-hy*c2],m4=[x2,y2];if(m2[0]=2*m1[0]-m2[0],m2[1]=2*m1[1]-m2[1],recursive)return[m2,m3,m4][concat](res);res=[m2,m3,m4][concat](res).join()[split](",");for(var newres=[],i=0,ii=res.length;i<ii;i++)newres[i]=i%2?rotate(res[i
!R.is(easing,"function")&&easing||(callback=callback||easing||null,easing=null),params=Object(params),ms=+ms||0;var json,attr,p={};for(attr in params)params[has](attr)&&toFloat(attr)!=attr&&toFloat(attr)+"%"!=attr&&(json=!0,p[attr]=params[attr]);return json?(easing&&(p.easing=easing),callback&&(p.callback=callback),new Animation({100:p},ms)):new Animation(params,ms)},elproto.animate=function(params,ms,easing,callback){var element=this;if(element.removed)return callback&&callback.call(element),element;var anim=params instanceof Animation?params:R.animation(params,ms,easing,callback);return runAnimation(anim,element,anim.percents[0],null,element.attr()),element},elproto.setTime=function(anim,value){return anim&&null!=value&&this.status(anim,mmin(value,anim.ms)/anim.ms),this},elproto.status=function(anim,value){var len,e,out=[],i=0;if(null!=value)return runAnimation(anim,this,-1,mmin(value,1)),this;for(len=animationElements.length;i<len;i++)if(e=animationElements[i],e.el.id==this.id&&(!anim||e.anim==anim)){if(anim)return e.status;out.push({anim:e.anim,status:e.status})}return anim?0:out},elproto.pause=function(anim){for(var i=0;i<animationElements.length;i++)animationElements[i].el.id!=this.id||anim&&animationElements[i].anim!=anim||eve("raphael.anim.pause."+this.id,this,animationElements[i].anim)!==!1&&(animationElements[i].paused=!0);return this},elproto.resume=function(anim){for(var i=0;i<animationElements.length;i++)if(animationElements[i].el.id==this.id&&(!anim||animationElements[i].anim==anim)){var e=animationElements[i];eve("raphael.anim.resume."+this.id,this,e.anim)!==!1&&(delete e.paused,this.status(e.anim,e.status))}return this},elproto.stop=function(anim){for(var i=0;i<animationElements.length;i++)animationElements[i].el.id!=this.id||anim&&animationElements[i].anim!=anim||eve("raphael.anim.stop."+this.id,this,animationElements[i].anim)!==!1&&animationElements.splice(i--,1);return this},eve.on("raphael.remove",stopAnimation),eve.on("raphael.clear",stopAnimation),elproto.toString=function(){return"Raphaëls object"};var Set=function(items){if(this.items=[],this.length=0,this.type="set",items)for(var i=0,ii=items.length;i<ii;i++)!items[i]||items[i].constructor!=elproto.constructor&&items[i].constructor!=Set||(this[this.items.length]=this.items[this.items.length]=items[i],this.length++)},setproto=Set.prototype;setproto.push=function(){for(var item,len,i=0,ii=arguments.length;i<ii;i++)item=arguments[i],!item||item.constructor!=elproto.constructor&&item.constructor!=Set||(len=this.items.length,this[len]=this.items[len]=item,this.length++);return this},setproto.pop=function(){return this.length&&delete this[this.length--],this.items.pop()},setproto.forEach=function(callback,thisArg){for(var i=0,ii=this.items.length;i<ii;i++)if(callback.call(thisArg,this.items[i],i)===!1)return this;return this};for(var method in elproto)elproto[has](method)&&(setproto[method]=function(methodname){return function(){var arg=arguments;return this.forEach(function(el){el[methodname][apply](el,arg)})}}(method));return setproto.attr=function(name,value){if(name&&R.is(name,array)&&R.is(name[0],"object"))for(var j=0,jj=name.length;j<jj;j++)this.items[j].attr(name[j]);else for(var i=0,ii=this.items.length;i<ii;i++)this.items[i].attr(name,value);return this},setproto.clear=function(){for(;this.length;)this.pop()},setproto.splice=function(index,count,insertion){index=index<0?mmax(this.length+index,0):index,count=mmax(0,mmin(this.length-index,count));var i,tail=[],todel=[],args=[];for(i=2;i<arguments.length;i++)args.push(arguments[i]);for(i=0;i<count;i++)todel.push(this[index+i]);for(;i<this.length-index;i++)tail.push(this[index+i]);var arglen=args.length;for(i=0;i<arglen+tail.length;i++)this.items[index+i]=this[index+i]=i<arglen?args[i]:tail[i-arglen];for(i=this.items.length=this.length-=count-arglen;this[i];)delete this[i++];return new Set(todel)},setproto.exclude=function(el){for(var i=0,ii=this.length;i<ii;i++)if(this[i]==el)return this.splice(i,1),!0},setproto.animate=function(params,ms,easing,callback){(R.is(easing,"function")||!easing)&&
for(var i=0,ii=pa.length;i<ii;i++){p=pa[i],r=pa[i][0].toLowerCase(),"z"==r&&(r="x");for(var j=1,jj=p.length;j<jj;j++)r+=round(p[j]*zoom)+(j!=jj-1?",":E);res.push(r)}return res.join(S)},compensation=function(deg,dx,dy){var m=R.matrix();return m.rotate(-deg,.5,.5),{dx:m.x(dx,dy),dy:m.y(dx,dy)}},setCoords=function(p,sx,sy,dx,dy,deg){var _=p._,m=p.matrix,fillpos=_.fillpos,o=p.node,s=o.style,y=1,flip="",kx=zoom/sx,ky=zoom/sy;if(s.visibility="hidden",sx&&sy){if(o.coordsize=abs(kx)+S+abs(ky),s.rotation=deg*(sx*sy<0?-1:1),deg){var c=compensation(deg,dx,dy);dx=c.dx,dy=c.dy}if(sx<0&&(flip+="x"),sy<0&&(flip+=" y")&&(y=-1),s.flip=flip,o.coordorigin=dx*-kx+S+dy*-ky,fillpos||_.fillsize){var fill=o.getElementsByTagName(fillString);fill=fill&&fill[0],o.removeChild(fill),fillpos&&(c=compensation(deg,m.x(fillpos[0],fillpos[1]),m.y(fillpos[0],fillpos[1])),fill.position=c.dx*y+S+c.dy*y),_.fillsize&&(fill.size=_.fillsize[0]*abs(sx)+S+_.fillsize[1]*abs(sy)),o.appendChild(fill)}s.visibility="visible"}};R.toString=function(){return"Your browser doesnt support SVG. Falling down to VML.\nYou are running Raphaël "+this.version};var addArrow=function(o,value,isEnd){for(var values=Str(value).toLowerCase().split("-"),se=isEnd?"end":"start",i=values.length,type="classic",w="medium",h="medium";i--;)switch(values[i]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":type=values[i];break;case"wide":case"narrow":h=values[i];break;case"long":case"short":w=values[i]}var stroke=o.node.getElementsByTagName("stroke")[0];stroke[se+"arrow"]=type,stroke[se+"arrowlength"]=w,stroke[se+"arrowwidth"]=h},setFillAndStroke=function(o,params){o.attrs=o.attrs||{};var node=o.node,a=o.attrs,s=node.style,newpath=pathTypes[o.type]&&(params.x!=a.x||params.y!=a.y||params.width!=a.width||params.height!=a.height||params.cx!=a.cx||params.cy!=a.cy||params.rx!=a.rx||params.ry!=a.ry||params.r!=a.r),isOval=ovalTypes[o.type]&&(a.cx!=params.cx||a.cy!=params.cy||a.r!=params.r||a.rx!=params.rx||a.ry!=params.ry),res=o;for(var par in params)params[has](par)&&(a[par]=params[par]);if(newpath&&(a.path=R._getPath[o.type](o),o._.dirty=1),params.href&&(node.href=params.href),params.title&&(node.title=params.title),params.target&&(node.target=params.target),params.cursor&&(s.cursor=params.cursor),"blur"in params&&o.blur(params.blur),(params.path&&"path"==o.type||newpath)&&(node.path=path2vml(~Str(a.path).toLowerCase().indexOf("r")?R._pathToAbsolute(a.path):a.path),"image"==o.type&&(o._.fillpos=[a.x,a.y],o._.fillsize=[a.width,a.height],setCoords(o,1,1,0,0,0))),"transform"in params&&o.transform(params.transform),isOval){var cx=+a.cx,cy=+a.cy,rx=+a.rx||+a.r||0,ry=+a.ry||+a.r||0;node.path=R.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",round((cx-rx)*zoom),round((cy-ry)*zoom),round((cx+rx)*zoom),round((cy+ry)*zoom),round(cx*zoom)),o._.dirty=1}if("clip-rect"in params){var rect=Str(params["clip-rect"]).split(separator);if(4==rect.length){rect[2]=+rect[2]+ +rect[0],rect[3]=+rect[3]+ +rect[1];var div=node.clipRect||R._g.doc.createElement("div"),dstyle=div.style;dstyle.clip=R.format("rect({1}px {2}px {3}px {0}px)",rect),node.clipRect||(dstyle.position="absolute",dstyle.top=0,dstyle.left=0,dstyle.width=o.paper.width+"px",dstyle.height=o.paper.height+"px",node.parentNode.insertBefore(div,node),div.appendChild(node),node.clipRect=div)}params["clip-rect"]||node.clipRect&&(node.clipRect.style.clip="auto")}if(o.textpath){var textpathStyle=o.textpath.style;params.font&&(textpathStyle.font=params.font),params["font-family"]&&(textpathStyle.fontFamily='"'+params["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,E)+'"'),params["font-size"]&&(textpathStyle.fontSize=params["font-size"]),params["font-weight"]&&(textpathStyle.fontWeight=params["font-weight"]),params["font-style"]&&(textpathStyle.fontStyle=params["font-style"])}if("arrow-start"in params&&addArrow(res,params["arrow-start"]),"arrow-end"in params&&addArrow(res,params["arrow-end"],1),null!=params.opacity||null!=params["stroke-width"]||null!=params.fill||null!=params.src||null!=params.stroke||null!=params["stroke-width"]||null!=pa
eParamsFirst.paddingbottom=-20,eParamsMid.paddingbottom=-20,eParamsMid.paddingtop=10,eParamsLast.paddingtop=10;for(var k=0;k<tunes.length;k++){var lineEl=document.createElement("div");div.appendChild(lineEl);var ep=0===k?eParamsFirst:k===tunes.length-1?eParamsLast:eParamsMid;renderOne(lineEl,tunes[k],renderParams,ep)}}ABCJS.numberOfTunes=function(abc){var tunes=abc.split("\nX:"),num=tunes.length;return 0===num&&(num=1),num},ABCJS.TuneBook=function(book){var This=this,directives="";book=window.ABCJS.parse.strip(book);for(var tunes=book.split("\nX:"),i=1;i<tunes.length;i++)tunes[i]="X:"+tunes[i];var pos=0;if(This.tunes=[],window.ABCJS.parse.each(tunes,function(tune){This.tunes.push({abc:tune,startPos:pos}),pos+=tune.length}),This.tunes.length>1&&!window.ABCJS.parse.startsWith(This.tunes[0].abc,"X:")){var dir=This.tunes.shift(),arrDir=dir.abc.split("\n");window.ABCJS.parse.each(arrDir,function(line){window.ABCJS.parse.startsWith(line,"%%")&&(directives+=line+"\n")})}This.header=directives,window.ABCJS.parse.each(This.tunes,function(tune){var end=tune.abc.indexOf("\n\n");end>0&&(tune.abc=tune.abc.substring(0,end)),tune.pure=tune.abc,tune.abc=directives+tune.abc;var title=tune.pure.split("T:");title.length>1?(title=title[1].split("\n"),tune.title=title[0].replace(/^\s+|\s+$/g,"")):tune.title="";var id=tune.pure.substring(2,tune.pure.indexOf("\n"));tune.id=id.replace(/^\s+|\s+$/g,"")})},ABCJS.TuneBook.prototype.getTuneById=function(id){for(var i=0;i<this.tunes.length;i++)if(this.tunes[i].id===id)return this.tunes[i];return null},ABCJS.TuneBook.prototype.getTuneByTitle=function(title){for(var i=0;i<this.tunes.length;i++)if(this.tunes[i].title===title)return this.tunes[i];return null};var resizeDivs={};window.addEventListener("resize",resizeOuter),window.addEventListener("orientationChange",resizeOuter),ABCJS.renderAbc=function(output,abc,parserParams,engraverParams,renderParams){function callback(div,tune){!renderParams.oneSvgPerLine||tune.lines.length<2?renderOne(div,tune,renderParams,engraverParams):renderEachLineSeparately(div,tune,renderParams,engraverParams)}return void 0===renderParams&&(renderParams={}),renderEngine(callback,output,abc,parserParams,renderParams)},ABCJS.renderMidi=function(output,abc,parserParams,midiParams,renderParams){function callback(div,tune,index){var html="",midi=window.ABCJS.midi.create(tune,midiParams);if(midiParams.generateInline){var inlineMidi=midi.inline?midi.inline:midi;html+=window.ABCJS.midi.generateMidiControls(tune,midiParams,inlineMidi,index)}if(midiParams.generateDownload){var downloadMidi=midi.download?midi.download:midi;html+=window.ABCJS.midi.generateMidiDownloadLink(tune,midiParams,downloadMidi,index)}div.innerHTML=html;var find=function(element,cls){var els=element.getElementsByClassName(cls);return 0===els.length?null:els[0]};if(midiParams.generateInline&&(midiParams.animate||midiParams.listener)){var parent=find(div,"abcjs-inline-midi");if(parent.abcjsTune=tune,parent.abcjsListener=midiParams.listener,parent.abcjsQpm=midiParams.qpm,midiParams.animate){var drumIntro=midiParams.drumIntro?midiParams.drumIntro:0;parent.abcjsAnimate=midiParams.animate.listener,parent.abcjsTune=midiParams.animate.target,parent.abcjsTune.setTiming(midiParams.qpm,drumIntro)}}if(midiParams.generateInline&&midiParams.inlineControls&&midiParams.inlineControls.startPlaying){var startButton=find(div,"abcjs-midi-start");window.ABCJS.midi.startPlaying(startButton)}}return void 0===midiParams&&(midiParams={}),void 0===midiParams.generateInline&&(midiParams.generateInline=!0),midiParams.inlineControls&&(midiParams.inlineControls.selectionToggle=!1),renderEngine(callback,output,abc,parserParams,renderParams)}}(),window.ABCJS||(window.ABCJS={}),window.ABCJS.data||(window.ABCJS.data={}),window.ABCJS.data.Tune=function(){function addVerticalInfo(timingEvents){for(var lastBarTop,lastBarBottom,lastEventTop,lastEventBottom,e=timingEvents.length-1;e>=0;e--){var ev=timingEvents[e];"bar"===ev.type?(ev.top=lastEventTop,ev.nextTop=lastBarTop,lastBarTop=lastEventTop,ev.bottom=lastEventBottom,ev.nextBottom=lastBarBottom,las
void 0===options.tooltipTempo&&(options.tooltipTempo="Change the playback speed.");var style="";options.hide&&(style='style="display:none;"');var html='<div class="abcjs-inline-midi abcjs-midi-'+index+'" '+style+">";if(html+='<span class="abcjs-data" style="display:none;">'+JSON.stringify(midi)+"</span>",midiParams.preTextInline&&(html+='<span class="abcjs-midi-pre">'+preprocessLabel(midiParams.preTextInline,title)+"</span>"),options.selectionToggle&&(html+='<button class="abcjs-midi-selection abcjs-btn" title="'+options.tooltipSelection+'"></button>'),options.loopToggle&&(html+='<button class="abcjs-midi-loop abcjs-btn" title="'+options.tooltipLoop+'"></button>'),options.standard&&(html+='<button class="abcjs-midi-reset abcjs-btn" title="'+options.tooltipReset+'"></button><button class="abcjs-midi-start abcjs-btn" title="'+options.tooltipPlay+'"></button><button class="abcjs-midi-progress-background" title="'+options.tooltipProgress+'"><span class="abcjs-midi-progress-indicator"></span></button><span class="abcjs-midi-clock"> 0:00</span>'),options.tempo){var startTempo=tune&&tune.metaText&&tune.metaText.tempo?tune.metaText.tempo.bpm:180;html+='<span class="abcjs-tempo-wrapper"><input class="abcjs-midi-tempo" value="100" type="number" min="1" max="300" data-start-tempo="'+startTempo+'" title="'+options.tooltipTempo+'" />% (<span class="abcjs-midi-current-tempo">'+startTempo+"</span> BPM)</span>"}return midiParams.postTextInline&&(html+='<span class="abcjs-midi-post">'+preprocessLabel(midiParams.postTextInline,title)+"</span>"),html+"</div>"},window.ABCJS.midi.soundfontUrl="/soundfont/";var lastNow,midiJsInitialized=!1;window.ABCJS.midi.startPlaying=function(target){onStart(target)},window.ABCJS.midi.stopPlaying=function(){stopCurrentlyPlayingTune()},addLoadEvent(addDelegates)}(),window.ABCJS||(window.ABCJS={}),window.ABCJS.midi||(window.ABCJS.midi={}),function(){"use strict";function convertPitch(pitch){return 60+pitch}var baseDuration=1920;window.ABCJS.midi.create=function(abcTune,options){void 0===options&&(options={});var sequence=window.ABCJS.midi.sequence(abcTune,options),commands=window.ABCJS.midi.flatten(sequence,options),midi=window.ABCJS.midi.rendererFactory(),midiJs=new window.ABCJS.midi.Preparer,title=abcTune.metaText?abcTune.metaText.title:void 0;title&&title.length>128&&(title=title.substring(0,124)+"..."),midi.setGlobalInfo(commands.tempo,title),midiJs.setGlobalInfo(commands.tempo,title),void 0!==commands.instrument&&(midi.setInstrument(commands.instrument),midiJs.setInstrument(commands.instrument)),void 0!==commands.channel&&(midi.setChannel(commands.channel),midiJs.setChannel(commands.channel));for(var i=0;i<commands.tracks.length;i++){midi.startTrack(),midiJs.startTrack();for(var j=0;j<commands.tracks[i].length;j++){var event=commands.tracks[i][j];switch(event.cmd){case"instrument":midi.setInstrument(event.instrument),midiJs.setInstrument(event.instrument);break;case"channel":midi.setChannel(event.channel),midiJs.setChannel(event.channel);break;case"start":midi.startNote(convertPitch(event.pitch),event.volume),midiJs.startNote(convertPitch(event.pitch),event.volume);break;case"stop":midi.endNote(convertPitch(event.pitch),0),midiJs.endNote(convertPitch(event.pitch));break;case"move":midi.addRest(event.duration*baseDuration),midiJs.addRest(event.duration*baseDuration);break;default:console.log("MIDI create Unknown: "+event.cmd)}}midi.endTrack(),midiJs.endTrack()}var midiFile=midi.getData(),midiInline=midiJs.getData();return void 0===options.generateInline&&(options.generateInline=!0),options.generateInline&&options.generateDownload?{download:midiFile,inline:midiInline}:options.generateInline?midiInline:midiFile}}(),window.ABCJS||(window.ABCJS={}),window.ABCJS.midi||(window.ABCJS.midi={}),function(){"use strict";function findChord(elem){if(chordTrackFinished||!elem.chord||0===elem.chord.length)return null;for(var i=0;i<elem.chord.length;i++){var ch=elem.chord[i];if("default"===ch.position)return ch.name;if(breakSynonyms.indexOf(ch.name.toLowerCase())>=0)return"break"}return null}function timeFromStart(){fo
0===multilineVars.barNumbers&&isFirstVoice&&1!==multilineVars.currBarNumber&&(params.barNumber=multilineVars.currBarNumber),tune.startNewLine(params),multilineVars.partForNextLine=""}function durationOfMeasure(multilineVars){var meter=multilineVars.origMeter;return meter&&"specified"===meter.type&&meter.value&&0!==meter.value.length?parseInt(meter.value[0].num,10)/parseInt(meter.value[0].den,10):1}function appendLastMeasure(voice,nextVoice){voice.push({el_type:"hint"});for(var i=0;i<nextVoice.length;i++){var element=nextVoice[i],hint=window.ABCJS.parse.clone(element);if(voice.push(hint),"bar"===element.el_type)return}}function addHintMeasure(staff,nextStaff){for(var i=0;i<staff.length;i++){var stave=staff[i],nextStave=nextStaff[i];if(nextStave)for(var j=0;j<nextStave.voices.length;j++){var nextVoice=nextStave.voices[j],voice=stave.voices[j];voice&&appendLastMeasure(voice,nextVoice)}}}function addHintMeasures(){for(var i=0;i<tune.lines.length;i++){var line=tune.lines[i].staff;if(line){for(var j=i+1;j<tune.lines.length&&void 0===tune.lines[j].staff;)j++;if(j<tune.lines.length){var nextLine=tune.lines[j].staff;addHintMeasure(line,nextLine)}}}}var tune=new window.ABCJS.data.Tune,tokenizer=new window.ABCJS.parse.tokenizer;this.getTune=function(){return tune};var multilineVars={reset:function(){for(var property in this)this.hasOwnProperty(property)&&"function"!=typeof this[property]&&delete this[property];this.iChar=0,this.key={accidentals:[],root:"none",acc:"",mode:""},this.meter={type:"specified",value:[{num:"4",den:"4"}]},this.origMeter={type:"specified",value:[{num:"4",den:"4"}]},this.hasMainTitle=!1,this.default_length=.125,this.clef={type:"treble",verticalPos:0},this.next_note_duration=0,this.start_new_line=!0,this.is_in_header=!0,this.is_in_history=!1,this.partForNextLine="",this.havent_set_length=!0,this.voices={},this.staves=[],this.macros={},this.currBarNumber=1,this.inTextBlock=!1,this.inPsBlock=!1,this.ignoredDecorations=[],this.textBlock="",this.score_is_present=!1,this.inEnding=!1,this.inTie=!1,this.inTieChord={},this.vocalPosition="auto",this.dynamicPosition="auto",this.chordPosition="auto",this.ornamentPosition="auto",this.volumePosition="auto",this.openSlurs=[]},differentFont:function(type,defaultFonts){return this[type].decoration!==defaultFonts[type].decoration||(this[type].face!==defaultFonts[type].face||(this[type].size!==defaultFonts[type].size||(this[type].style!==defaultFonts[type].style||this[type].weight!==defaultFonts[type].weight)))},addFormattingOptions:function(el,defaultFonts,elType){"note"===elType?("auto"!==this.vocalPosition&&addPositioning(el,"vocalPosition",this.vocalPosition),"auto"!==this.dynamicPosition&&addPositioning(el,"dynamicPosition",this.dynamicPosition),"auto"!==this.chordPosition&&addPositioning(el,"chordPosition",this.chordPosition),"auto"!==this.ornamentPosition&&addPositioning(el,"ornamentPosition",this.ornamentPosition),"auto"!==this.volumePosition&&addPositioning(el,"volumePosition",this.volumePosition),this.differentFont("annotationfont",defaultFonts)&&addFont(el,"annotationfont",this.annotationfont),this.differentFont("gchordfont",defaultFonts)&&addFont(el,"gchordfont",this.gchordfont),this.differentFont("vocalfont",defaultFonts)&&addFont(el,"vocalfont",this.vocalfont)):"bar"===elType&&("auto"!==this.dynamicPosition&&addPositioning(el,"dynamicPosition",this.dynamicPosition),"auto"!==this.chordPosition&&addPositioning(el,"chordPosition",this.chordPosition),"auto"!==this.ornamentPosition&&addPositioning(el,"ornamentPosition",this.ornamentPosition),"auto"!==this.volumePosition&&addPositioning(el,"volumePosition",this.volumePosition),this.differentFont("measurefont",defaultFonts)&&addFont(el,"measurefont",this.measurefont),this.differentFont("repeatfont",defaultFonts)&&addFont(el,"repeatfont",this.repeatfont))}},addWarning=function(str){multilineVars.warnings||(multilineVars.warnings=[]),multilineVars.warnings.push(str)},encode=function(str){var ret=window.ABCJS.parse.gsub(str,""," ");return ret=window.ABCJS.parse.gsub(ret,"&","&amp;"),ret=window.ABCJS.parse.gsub(ret,"<","&l
tune.formatting.measurefont=multilineVars.measurefont,tune.formatting.partsfont=multilineVars.partsfont,tune.formatting.repeatfont=multilineVars.repeatfont,tune.formatting.textfont=multilineVars.textfont,tune.formatting.vocalfont=multilineVars.vocalfont,tune.formatting.wordsfont=multilineVars.wordsfont}var tokenizer,warn,multilineVars,tune;window.ABCJS.parse.parseDirective.initialize=function(tokenizer_,warn_,multilineVars_,tune_){tokenizer=tokenizer_,warn=warn_,multilineVars=multilineVars_,tune=tune_,initializeFonts()};var fontTypeCanHaveBox={gchordfont:!0,measurefont:!0,partsfont:!0},fontTranslation=function(fontFace){switch(fontFace){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
if(i+=ws,line.length>=i+5&&"["===line.charAt(i)&&":"===line.charAt(i+2)){var e=line.indexOf("]",i);switch(line.substring(i,i+3)){case"[I:":var err=window.ABCJS.parse.parseDirective.addDirective(line.substring(i+3,e));return err&&warn(err,line,i),[e-i+1+ws];case"[M:":var meter=this.setMeter(line.substring(i+3,e));return tune.hasBeginMusic()&&meter?tune.appendStartingElement("meter",-1,-1,meter):multilineVars.meter=meter,[e-i+1+ws];case"[K:":var result=window.ABCJS.parse.parseKeyVoice.parseKey(line.substring(i+3,e));return result.foundClef&&tune.hasBeginMusic()&&tune.appendStartingElement("clef",-1,-1,multilineVars.clef),result.foundKey&&tune.hasBeginMusic()&&tune.appendStartingElement("key",-1,-1,window.ABCJS.parse.parseKeyVoice.fixKey(multilineVars.clef,multilineVars.key)),[e-i+1+ws];case"[P:":return tune.lines.length<=tune.lineNum?multilineVars.partForNextLine=line.substring(i+3,e):tune.appendElement("part",-1,-1,{title:line.substring(i+3,e)}),[e-i+1+ws];case"[L:":return this.setDefaultLength(line,i+3,e),[e-i+1+ws];case"[Q:":if(e>0){var tempo=this.setTempo(line,i+3,e);return"delaySet"===tempo.type?tune.appendElement("tempo",-1,-1,this.calcTempo(tempo.tempo)):"immediate"===tempo.type&&tune.appendElement("tempo",-1,-1,tempo.tempo),[e-i+1+ws,line.charAt(i+1),line.substring(i+3,e)]}break;case"[V:":if(e>0)return window.ABCJS.parse.parseKeyVoice.parseVoice(line,i+3,e),[e-i+1+ws,line.charAt(i+1),line.substring(i+3,e)]}}return[0]},this.letter_to_body_header=function(line,i){if(line.length>=i+3)switch(line.substring(i,i+2)){case"I:":var err=window.ABCJS.parse.parseDirective.addDirective(line.substring(i+2));return err&&warn(err,line,i),[line.length];case"M:":var meter=this.setMeter(line.substring(i+2));return tune.hasBeginMusic()&&meter&&tune.appendStartingElement("meter",-1,-1,meter),[line.length];case"K:":var result=window.ABCJS.parse.parseKeyVoice.parseKey(line.substring(i+2));return result.foundClef&&tune.hasBeginMusic()&&tune.appendStartingElement("clef",-1,-1,multilineVars.clef),result.foundKey&&tune.hasBeginMusic()&&tune.appendStartingElement("key",-1,-1,window.ABCJS.parse.parseKeyVoice.fixKey(multilineVars.clef,multilineVars.key)),[line.length];case"P:":return tune.hasBeginMusic()&&tune.appendElement("part",-1,-1,{title:line.substring(i+2)}),[line.length];case"L:":return this.setDefaultLength(line,i+2,line.length),[line.length];case"Q:":var e=line.indexOf("",i+2);e===-1&&(e=line.length);var tempo=this.setTempo(line,i+2,e);return"delaySet"===tempo.type?tune.appendElement("tempo",-1,-1,this.calcTempo(tempo.tempo)):"immediate"===tempo.type&&tune.appendElement("tempo",-1,-1,tempo.tempo),[e,line.charAt(i),window.ABCJS.parse.strip(line.substring(i+2))];case"V:":return window.ABCJS.parse.parseKeyVoice.parseVoice(line,2,line.length),[line.length,line.charAt(i),window.ABCJS.parse(line.substring(i+2))]}return[0]};var metaTextHeaders={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(line){if(window.ABCJS.parse.startsWith(line,"%%")){var err=window.ABCJS.parse.parseDirective.addDirective(line.substring(2));return err&&warn(err,line,2),{}}var i=line.indexOf("%");if(i>=0&&(line=line.substring(0,i)),line=line.replace(/\s+$/,""),0===line.length)return{};if(line.length>=2&&":"===line.charAt(1)){var nextLine="";line.indexOf("")>=0&&"w"!==line.charAt(0)&&(nextLine=line.substring(line.indexOf("")+1),line=line.substring(0,line.indexOf("")));var field=metaTextHeaders[line.charAt(0)];if(void 0!==field)return"unalignedWords"===field?tune.addMetaTextArray(field,window.ABCJS.parse.parseDirective.parseFontChangeLine(tokenizer.translateString(tokenizer.stripComment(line.substring(2))))):tune.addMetaText(field,tokenizer.translateString(tokenizer.stripComment(line.substring(2)))),{};switch(line.charAt(0)){case"H":tune.addMetaText("history",tokenizer.translateString(tokenizer.stripComment(line.substring(2)))),multilineVars.is_in_history=!0;break;case"K":this.resolveTempo();var result=window.ABCJS.parse.parse
},this.getPitchFromTokens=function(tokens){var ret={},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};if(ret.position=pitches[tokens[0].token],void 0===ret.position)return{warn:"Pitch expected. Found: "+tokens[0].token};for(tokens.shift();tokens.length;)switch(tokens[0].token){case",":ret.position-=7,tokens.shift();break;case"'":ret.position+=7,tokens.shift();break;default:return ret}return ret},this.getKeyAccidentals2=function(tokens){for(var accs;tokens.length>0;){var acc;if("^"===tokens[0].token){if(acc="sharp",tokens.shift(),0===tokens.length)return{accs:accs,warn:"Expected note name after "+acc};switch(tokens[0].token){case"^":acc="dblsharp",tokens.shift();break;case"/":acc="quartersharp",tokens.shift()}}else if("="===tokens[0].token)acc="natural",tokens.shift();else{if("_"!==tokens[0].token)return{accs:accs};if(acc="flat",tokens.shift(),0===tokens.length)return{accs:accs,warn:"Expected note name after "+acc};switch(tokens[0].token){case"_":acc="dblflat",tokens.shift();break;case"/":acc="quarterflat",tokens.shift()}}if(0===tokens.length)return{accs:accs,warn:"Expected note name after "+acc};switch(tokens[0].token.charAt(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===accs&&(accs=[]),accs.push({acc:acc,note:tokens[0].token.charAt(0)}),1===tokens[0].token.length?tokens.shift():tokens[0].token=tokens[0].token.substring(1);break;default:return{accs:accs,warn:"Expected note name after "+acc+" Found: "+tokens[0].token}}}return{accs:accs}},this.getKeyAccidental=function(str){var accTranslation={"^":"sharp","^^":"dblsharp","=":"natural",_:"flat",__:"dblflat","_/":"quarterflat","^/":"quartersharp"},i=this.skipWhiteSpace(str);if(finished(str,i))return{len:0};var acc=null;switch(str.charAt(i)){case"^":case"_":case"=":acc=str.charAt(i);break;default:return{len:0}}if(i++,finished(str,i))return{len:1,warn:"Expected note name after accidental"};switch(str.charAt(i)){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:i+1,token:{acc:accTranslation[acc],note:str.charAt(i)}};case"^":case"_":case"/":if(acc+=str.charAt(i),i++,finished(str,i))return{len:2,warn:"Expected note name after accidental"};switch(str.charAt(i)){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:i+1,token:{acc:accTranslation[acc],note:str.charAt(i)}};default:return{len:2,warn:"Expected note name after accidental"}}break;default:return{len:1,warn:"Expected note name after accidental"}}},this.isWhiteSpace=function(ch){return" "===ch||"\t"===ch||""===ch},this.getMeat=function(line,start,end){var comment=line.indexOf("%",start);for(comment>=0&&comment<end&&(end=comment);start<end&&(" "===line.charAt(start)||"\t"===line.charAt(start)||""===line.charAt(start));)start++;for(;start<end&&(" "===line.charAt(end-1)||"\t"===line.charAt(end-1)||""===line.charAt(end-1));)end--;return{start:start,end:end}};var isLetter=function(ch){return ch>="A"&&ch<="Z"||ch>="a"&&ch<="z"},isNumber=function(ch){return ch>="0"&&ch<="9"};this.tokenize=function(line,start,end,alphaUntilWhiteSpace){var ret=this.getMeat(line,start,end);start=ret.start,end=ret.end;for(var i,tokens=[];start<end;){if('"'===line.charAt(start)){for(i=start+1;i<end&&'"'!==line.charAt(i);)i++;tokens.push({type:"quote",token:line.substring(start+1,i),start:start+1,end:i}),i++}else if(isLetter(line.charAt(start))){if(i=start+1,alphaUntilWhiteSpace)for(;i<end&&!this.isWhiteSpace(line.charAt(i));)i++;else for(;i<end&&isLetter(line.charAt(i));)i++;tokens.push({type:"alpha",token:line.substring(start,i),continueId:isNumber(line.charAt(i)),start:start,end:i}),start=i+1}else if("."===line.charAt(start)&&isNumber(line.charAt(i+1))){i=start+1;for(var int2=null,float2=null;i<end&&isNumber(line.charAt(i));)i++;float2=parseFloat(line.substring(start,i)),tokens.push({type:"number",token:line.substring(start,i),intt:int2,floatt:float2,continueId:isLetter(line.charAt(i)),start:start,end:i}),star
ABCJS.write.hint&&gracebeam.setHint(),gracebeam.mainNote=abselem);var graceoffsets=[];for(i=elem.gracenotes.length-1;i>=0;i--)this.roomtaken+=10,graceoffsets[i]=this.roomtaken,elem.gracenotes[i].accidental&&(this.roomtaken+=7);for(i=0;i<elem.gracenotes.length;i++){var gracepitch=elem.gracenotes[i].verticalPos;if(flag=gracebeam?null:this.chartable.uflags[this.isBagpipes?5:3],grace=this.createNoteHead(abselem,"noteheads.quarter",elem.gracenotes[i],"up",-graceoffsets[i],-graceoffsets[i],flag,0,0,gracescale),abselem.addExtra(grace),elem.gracenotes[i].acciaccatura){var pos=elem.gracenotes[i].verticalPos+7*gracescale,dAcciaccatura=gracebeam?5:6;abselem.addRight(new ABCJS.write.RelativeElement("flags.ugrace",-graceoffsets[i]+dAcciaccatura,0,pos,{scalex:gracescale,scaley:gracescale}))}if(gracebeam){var graceDuration=elem.gracenotes[i].duration/2;this.isBagpipes&&(graceDuration/=2);var pseudoabselem={heads:[grace],abcelem:{averagepitch:gracepitch,minpitch:gracepitch,maxpitch:gracepitch,duration:graceDuration}};gracebeam.add(pseudoabselem)}else p1=gracepitch+1/3*gracescale,p2=gracepitch+7*gracescale,dx=grace.dx+grace.w,width=-.6,abselem.addExtra(new ABCJS.write.RelativeElement(null,dx,0,p1,{type:"stem",pitch2:p2,linewidth:width}));ABCJS.write.ledgerLines(abselem,gracepitch,gracepitch,!1,"noteheads.quarter",[],!0,grace.dx-1,.6),0!==i||this.isBagpipes||elem.rest&&("spacer"===elem.rest.type||"invisible"===elem.rest.type)||this.voice.addOther(new ABCJS.write.TieElem(grace,notehead,!1,!0,!1))}gracebeam&&this.voice.addBeam(gracebeam)}!dontDraw&&elem.decoration&&this.decoration.createDecoration(this.voice,elem.decoration,abselem.top,notehead?notehead.w:0,abselem,this.roomtaken,dir,abselem.bottom,elem.positioning,this.hasVocals),elem.barNumber&&abselem.addChild(new ABCJS.write.RelativeElement(elem.barNumber,-10,0,0,{type:"barNumber"})),ABCJS.write.ledgerLines(abselem,elem.minpitch,elem.maxpitch,elem.rest,c,additionalLedgers,dir,-2,1);var chordMargin=8;if(void 0!==elem.chord)for(i=0;i<elem.chord.length;i++){var y,x=0,dim=this.renderer.getTextSize(elem.chord[i].name,"annotationfont","annotation"),chordWidth=dim.width,chordHeight=dim.height/ABCJS.write.spacing.STEP;switch(elem.chord[i].position){case"left":this.roomtaken+=chordWidth+7,x=-this.roomtaken,y=elem.averagepitch,abselem.addExtra(new ABCJS.write.RelativeElement(elem.chord[i].name,x,chordWidth+4,y,{type:"text",height:chordHeight}));break;case"right":this.roomtakenright+=4,x=this.roomtakenright,y=elem.averagepitch,abselem.addRight(new ABCJS.write.RelativeElement(elem.chord[i].name,x,chordWidth+4,y,{type:"text",height:chordHeight}));break;case"below":for(var eachLine=elem.chord[i].name.split("\n"),ii=0;ii<eachLine.length;ii++)abselem.addRight(new ABCJS.write.RelativeElement(eachLine[ii],x,chordWidth+chordMargin,void 0,{type:"text",position:"below",height:chordHeight}));break;case"above":abselem.addRight(new ABCJS.write.RelativeElement(elem.chord[i].name,0,chordWidth+chordMargin,void 0,{type:"text",height:chordHeight}));break;default:if(elem.chord[i].rel_position){var relPositionY=elem.chord[i].rel_position.y+3*ABCJS.write.spacing.STEP;abselem.addChild(new ABCJS.write.RelativeElement(elem.chord[i].name,x+elem.chord[i].rel_position.x,0,elem.minpitch+relPositionY/ABCJS.write.spacing.STEP,{type:"text",height:chordHeight}))}else{var pos2="above";elem.positioning&&elem.positioning.chordPosition&&(pos2=elem.positioning.chordPosition),dim=this.renderer.getTextSize(elem.chord[i].name,"gchordfont","chord"),chordHeight=dim.height/ABCJS.write.spacing.STEP,chordWidth=dim.width,abselem.addCentered(new ABCJS.write.RelativeElement(elem.chord[i].name,x,chordWidth,void 0,{type:"chord",position:pos2,height:chordHeight}))}}}return elem.startTriplet&&!dontDraw&&(this.triplet=new ABCJS.write.TripletElem(elem.startTriplet,notehead)),elem.endTriplet&&this.triplet&&!dontDraw&&this.triplet.setCloseAnchor(notehead),abselem},ABCJS.write.AbstractEngraver.prototype.createNoteHead=function(abselem,c,pitchelem,dir,headx,extrax,flag,dot,dotshiftx,scale){var notehead,i,pitch=pitchelem.verticalPos;if(this.accidentalshi
this.editable=params.editable||!1,this.listeners=[],params.listener&&this.addSelectListener(params.listener),this.usingSvg=!(!window.SVGAngle&&!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")),this.usingSvg&&params.add_classes&&(Raphael._availableAttrs.class=""),Raphael._availableAttrs["text-decoration"]="",Raphael._availableAttrs["data-vertical"]="",this.renderer=new ABCJS.write.Renderer(paper,params.regression),this.renderer.setPaddingOverride(params),this.renderer.controller=this,this.reset()},ABCJS.write.EngraverController.prototype.reset=function(){this.selected=[],this.ingroup=!1,this.staffgroups=[],this.lastStaffGroupIndex=-1,this.engraver&&this.engraver.reset(),this.engraver=null,this.renderer.reset()},ABCJS.write.EngraverController.prototype.engraveABC=function(abctunes){void 0===abctunes[0]&&(abctunes=[abctunes]),this.reset();for(var i=0;i<abctunes.length;i++)this.engraveTune(abctunes[i],i);if(this.renderer.doRegression)return this.renderer.regressionLines.join("\n")},ABCJS.write.EngraverController.prototype.adjustNonScaledItems=function(scale){this.width/=scale,this.renderer.adjustNonScaledItems(scale)},ABCJS.write.EngraverController.prototype.engraveTune=function(abctune,tuneNumber){this.renderer.lineNumber=null,abctune.formatting.tripletfont={face:"Times",size:11,weight:"normal",style:"italic",decoration:"none"},this.renderer.abctune=abctune,this.renderer.setVerticalSpace(abctune.formatting),this.renderer.measureNumber=null,this.renderer.setPrintMode("print"===abctune.media);var scale=abctune.formatting.scale?abctune.formatting.scale:this.scale;void 0===scale&&(scale=this.renderer.isPrint?.75:1),this.renderer.setPadding(abctune),this.engraver=new ABCJS.write.AbstractEngraver(abctune.formatting.bagpipes,this.renderer,tuneNumber),this.engraver.setStemHeight(this.renderer.spacing.stemHeight),this.renderer.engraver=this.engraver,abctune.formatting.staffwidth?this.width=1.33*abctune.formatting.staffwidth:this.width=this.renderer.isPrint?this.staffwidthPrint:this.staffwidthScreen,this.adjustNonScaledItems(scale);var i,abcLine,hasPrintedTempo=!1;for(i=0;i<abctune.lines.length;i++)abcLine=abctune.lines[i],abcLine.staff&&(abcLine.staffGroup=this.engraver.createABCLine(abcLine.staff,hasPrintedTempo?null:abctune.metaText.tempo),hasPrintedTempo=!0);var maxWidth=this.width;for(i=0;i<abctune.lines.length;i++)abcLine=abctune.lines[i],abcLine.staff&&(this.setXSpacing(abcLine.staffGroup,abctune.formatting,i===abctune.lines.length-1),abcLine.staffGroup.w>maxWidth&&(maxWidth=abcLine.staffGroup.w));for(i=0;i<abctune.lines.length;i++)if(abcLine=abctune.lines[i],abcLine.staffGroup&&abcLine.staffGroup.voices){for(var j=0;j<abcLine.staffGroup.voices.length;j++)abcLine.staffGroup.voices[j].layoutBeams();abcLine.staffGroup.setUpperAndLowerElements(this.renderer)}for(i=0;i<abctune.lines.length;i++)abcLine=abctune.lines[i],abcLine.staffGroup&&(abcLine.staffGroup.height=abcLine.staffGroup.calcHeight());this.renderer.topMargin(abctune),this.renderer.engraveTopText(this.width,abctune),this.renderer.addMusicPadding(),this.staffgroups=[],this.lastStaffGroupIndex=-1;for(var line=0;line<abctune.lines.length;line++)this.renderer.lineNumber=line,abcLine=abctune.lines[line],abcLine.staff?this.engraveStaffLine(abcLine.staffGroup):abcLine.subtitle&&0!==line?this.renderer.outputSubtitle(this.width,abcLine.subtitle):void 0!==abcLine.text&&this.renderer.outputFreeText(abcLine.text);this.renderer.moveY(24),this.renderer.engraveExtraText(this.width,abctune),this.renderer.setPaperSize(maxWidth,scale)},ABCJS.write.EngraverController.prototype.setXSpacing=function(staffGroup,formatting,isLastLine){for(var newspace=this.space,it=0;it<3;it++){staffGroup.layout(newspace,this.renderer,!1);var stretchLast=!!formatting.stretchlast&&formatting.stretchlast;if(newspace=calcHorizontalSpacing(isLastLine,stretchLast,this.width+this.renderer.padding.left,staffGroup.w,newspace,staffGroup.spacingunits,staffGroup.minspace),null===newspace)break}centerWholeRests(staffGroup.voices)},ABCJS.write.EngraverController.prototype.eng
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,.33,-.03,4.89],["c",-.06,2.67,-.09,5.01,-.09,5.22],["l",0,.36],["l",.15,-.15],["c",.36,-.3,.75,-.51,1.2,-.63],["c",.33,-.09,.96,-.09,1.26,-.03],["c",.27,.09,.63,.27,.87,.45],["l",.21,.15],["l",0,-.27],["c",0,-.15,-.03,-2.43,-.09,-5.1],["c",-.09,-4.56,-.09,-4.86,-.03,-4.89],["c",.15,-.12,.39,-.15,.72,-.15],["c",.3,0,.54,.03,.69,.15],["c",.06,.03,.06,.33,-.03,4.95],["c",-.06,2.7,-.09,5.04,-.09,5.22],["l",.03,.3],["l",.21,-.15],["c",.69,-.48,1.44,-.69,2.28,-.69],["c",.51,0,.78,.03,1.2,.21],["c",1.32,.63,2.01,2.28,1.53,3.69],["c",-.21,.57,-.51,1.02,-1.05,1.56],["c",-.42,.42,-.81,.72,-1.92,1.5],["c",-1.26,.87,-1.5,1.08,-1.86,1.5],["c",-.39,.45,-.54,.54,-.81,.51],["c",-.18,0,-.21,0,-.33,-.06],["l",-.21,-.21],["l",-.06,-.12],["l",-.03,-.99],["c",-.03,-.54,-.03,-1.29,-.06,-1.68],["l",0,-.69],["l",-.21,.24],["c",-.36,.42,-.75,.75,-1.8,1.62],["c",-1.02,.84,-1.2,.99,-1.44,1.38],["c",-.36,.51,-.54,.6,-.9,.51],["c",-.15,-.03,-.39,-.27,-.42,-.42],["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",2.52,10.98],["c",-.18,-.09,-.48,-.12,-.66,-.06],["c",-.39,.15,-.69,.54,-.84,1.14],["c",-.06,.24,-.06,.39,-.09,1.74],["c",-.03,1.44,0,2.73,.06,3.18],["l",.03,.15],["l",.27,-.27],["c",.93,-.96,1.5,-1.95,1.74,-3.06],["c",.06,-.27,.06,-.39,.06,-.96],["c",0,-.54,0,-.69,-.06,-.93],["c",-.09,-.51,-.27,-.81,-.51,-.93],["z"],["m",5.43,0],["c",-.18,-.09,-.51,-.12,-.72,-.06],["c",-.54,.12,-.96,.63,-1.17,1.26],["c",-.06,.3,-.12,2.88,-.06,3.9],["c",.03,.42,.03,.81,.06,.9],["l",.03,.12],["l",.36,-.3],["c",.42,-.36,1.02,-.96,1.29,-1.29],["c",.36,-.45,.66,-.99,.81,-1.41],["c",.42,-1.23,.15,-2.76,-.6,-3.12],["z"]],w:11.613,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,
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,-.
opt.thickness&&(this.top+=opt.thickness/2,this.bottom-=opt.thickness/2),opt.stemHeight&&(opt.stemHeight>0?this.top+=opt.stemHeight:this.bottom+=opt.stemHeight);var height=opt.height?opt.height:4;switch(this.centerVertically=!1,this.type){case"debug":this.chordHeightAbove=height;break;case"lyric":opt.position&&"below"===opt.position?this.lyricHeightBelow=height:this.lyricHeightAbove=height;break;case"chord":opt.position&&"below"===opt.position?this.chordHeightBelow=height:this.chordHeightAbove=height;break;case"text":void 0===this.pitch?opt.position&&"below"===opt.position?this.chordHeightBelow=height:this.chordHeightAbove=height:this.centerVertically=!0;break;case"part":this.partHeightAbove=height}},ABCJS.write.RelativeElement.prototype.setX=function(x){this.x=x+this.dx},ABCJS.write.RelativeElement.prototype.draw=function(renderer,bartop){void 0===this.pitch&&window.console.error(this.type+" Relative Element y-coordinate not set.");var y=renderer.calcY(this.pitch);switch(this.type){case"symbol":if(null===this.c)return null;var klass="symbol";this.klass&&(klass+=" "+this.klass),this.graphelem=renderer.printSymbol(this.x,this.pitch,this.c,this.scalex,this.scaley,renderer.addClasses(klass));break;case"debug":this.graphelem=renderer.renderText(this.x,renderer.calcY(15),""+this.c,"debugfont","debug-msg","start");break;case"barNumber":this.graphelem=renderer.renderText(this.x,y,""+this.c,"measurefont","bar-number","middle");break;case"lyric":this.graphelem=renderer.renderText(this.x,y,this.c,"vocalfont","abc-lyric","middle");break;case"chord":this.graphelem=renderer.renderText(this.x,y,this.c,"gchordfont","chord","middle");break;case"decoration":this.graphelem=renderer.renderText(this.x,y,this.c,"annotationfont","annotation","middle",!0);break;case"text":this.graphelem=renderer.renderText(this.x,y,this.c,"annotationfont","annotation","start",this.centerVertically);break;case"part":this.graphelem=renderer.renderText(this.x,y,this.c,"partsfont","part","start");break;case"bar":this.graphelem=renderer.printStem(this.x,this.linewidth,y,bartop?bartop:renderer.calcY(this.pitch2));break;case"stem":this.graphelem=renderer.printStem(this.x,this.linewidth,y,renderer.calcY(this.pitch2));break;case"ledger":this.graphelem=renderer.printStaveLine(this.x,this.x+this.w,this.pitch)}return 1!==this.scalex&&this.graphelem&&this.graphelem.scale(this.scalex,this.scaley,this.x,y),this.graphelem},window.ABCJS||(window.ABCJS={}),window.ABCJS.write||(window.ABCJS.write={}),ABCJS.write.Renderer=function(paper,doRegression){this.paper=paper,this.controller=null,this.space=3*ABCJS.write.spacing.SPACE,this.padding={},this.doRegression=doRegression,this.doRegression&&(this.regressionLines=[]),this.reset()},ABCJS.write.Renderer.prototype.reset=function(){this.paper.clear(),this.y=0,this.abctune=null,this.lastM=null,this.ingroup=!1,this.path=null,this.isPrint=!1,this.initVerticalSpace(),this.doRegression&&(this.regressionLines=[])},ABCJS.write.Renderer.prototype.setPrintMode=function(isPrint){this.isPrint=isPrint},ABCJS.write.Renderer.prototype.setPaperSize=function(maxwidth,scale){var w=(maxwidth+this.padding.right)*scale,h=(this.y+this.padding.bottom)*scale;this.isPrint&&(h=Math.max(h,1056)),this.doRegression&&this.regressionLines.push("PAPER SIZE: ("+w+","+h+")"),this.paper.setSize(w/scale,h/scale);var isIE=!1;isIE?(this.paper.canvas.parentNode.style.width=w+"px",this.paper.canvas.parentNode.style.height=""+h+"px"):this.paper.canvas.parentNode.setAttribute("style","width:"+w+"px"),1!==scale?(this.paper.canvas.style.transform="scale("+scale+","+scale+")",this.paper.canvas.style["-ms-transform"]="scale("+scale+","+scale+")",this.paper.canvas.style["-webkit-transform"]="scale("+scale+","+scale+")",this.paper.canvas.style["transform-origin"]="0 0",this.paper.canvas.style["-ms-transform-origin-x"]="0",this.paper.canvas.style["-ms-transform-origin-y"]="0",this.paper.canvas.style["-webkit-transform-origin-x"]="0",this.paper.canvas.style["-webkit-transform-origin-y"]="0"):(this.paper.canvas.style.transform="",this.paper.canvas.style["-ms-transform"]="",this.paper
x+=preWidth+charWidth}if(this.tempo.duration){var dot,flag,note,temposcale=.75,tempopitch=this.pitch-totalHeightInPitches+1,duration=this.tempo.duration[0],abselem=new ABCJS.write.AbsoluteElement(this.tempo,duration,1,"tempo",this.tuneNumber);duration<=1/32?(note="noteheads.quarter",flag="flags.u32nd",dot=0):duration<=1/16?(note="noteheads.quarter",flag="flags.u16th",dot=0):duration<=3/32?(note="noteheads.quarter",flag="flags.u16nd",dot=1):duration<=1/8?(note="noteheads.quarter",flag="flags.u8th",dot=0):duration<=3/16?(note="noteheads.quarter",flag="flags.u8th",dot=1):duration<=.25?(note="noteheads.quarter",dot=0):duration<=3/8?(note="noteheads.quarter",dot=1):duration<=.5?(note="noteheads.half",dot=0):duration<=.75?(note="noteheads.half",dot=1):duration<=1?(note="noteheads.whole",dot=0):duration<=1.5?(note="noteheads.whole",dot=1):duration<=2?(note="noteheads.dbl",dot=0):(note="noteheads.dbl",dot=1);var temponote=renderer.engraver.createNoteHead(abselem,note,{verticalPos:tempopitch},"up",0,0,flag,dot,0,temposcale);abselem.addHead(temponote);var stem;if("noteheads.whole"!==note&&"noteheads.dbl"!==note){var p1=tempopitch+1/3*temposcale,p2=tempopitch+7*temposcale,dx=temponote.dx+temponote.w,width=-.6;stem=new ABCJS.write.RelativeElement(null,dx,0,p1,{type:"stem",pitch2:p2,linewidth:width}),stem.setX(x),abselem.addExtra(stem)}abselem.setX(x);for(var i=0;i<abselem.children.length;i++)abselem.children[i].draw(renderer,x);x+=abselem.w+5;var str="= "+this.tempo.bpm;text=renderer.renderText(x,y,str,"tempofont","tempo","start");var postWidth=text.getBBox().width,charWidth2=postWidth/str.length;x+=postWidth+charWidth2}this.tempo.postString&&renderer.renderText(x,y,this.tempo.postString,"tempofont","tempo","start")}}(),window.ABCJS||(window.ABCJS={}),window.ABCJS.write||(window.ABCJS.write={}),ABCJS.write.TieElem=function(anchor1,anchor2,above,forceandshift,isTie){this.anchor1=anchor1,this.anchor2=anchor2,this.above=above,this.force=forceandshift,this.isTie=isTie},ABCJS.write.TieElem.prototype.setEndAnchor=function(anchor2){this.anchor2=anchor2,this.isTie&&(this.anchor1&&(this.anchor1.isTie=!0),this.anchor2&&(this.anchor2.isTie=!0))},ABCJS.write.TieElem.prototype.setStartX=function(startLimitElem){this.startLimitX=startLimitElem},ABCJS.write.TieElem.prototype.setEndX=function(endLimitElem){this.endLimitX=endLimitElem},ABCJS.write.TieElem.prototype.setHint=function(){this.hint=!0},ABCJS.write.TieElem.prototype.setUpperAndLowerElements=function(positionY){},ABCJS.write.TieElem.prototype.layout=function(lineStartX,lineEndX){function getPitch(anchor,isAbove,isTie){return isTie?anchor.pitch:isAbove&&void 0!==anchor.highestVert?anchor.highestVert:anchor.pitch}!this.force&&this.anchor2&&this.anchor2.pitch===this.anchor2.highestVert&&(this.above=!0),this.isTie?(this.anchor1&&(this.anchor1.tieAbove=this.above),this.anchor2&&(this.anchor2.tieAbove=this.above)):this.anchor2&&this.anchor2.isTie?this.above=this.anchor2.tieAbove:this.anchor1&&this.anchor1.isTie&&(this.above=this.anchor1.tieAbove),this.anchor1?this.startX=this.anchor1.x:this.startLimitX?this.startX=this.startLimitX.x+this.startLimitX.w:this.startX=lineStartX,this.anchor2?this.endX=this.anchor2.x:this.endLimitX?this.endX=this.endLimitX.x:this.endX=lineEndX,this.anchor1&&this.anchor2?(this.startY=getPitch(this.anchor1,this.above,this.isTie),this.endY=getPitch(this.anchor2,this.above,this.isTie)):this.anchor1?(this.startY=getPitch(this.anchor1,this.above,this.isTie),this.endY=getPitch(this.anchor1,this.above,this.isTie)):this.anchor2?(this.startY=getPitch(this.anchor2,this.above,this.isTie),this.endY=getPitch(this.anchor2,this.above,this.isTie)):(this.startY=this.above?14:0,this.endY=this.above?14:0)},ABCJS.write.TieElem.prototype.draw=function(renderer,linestartx,lineendx){this.layout(linestartx,lineendx);var klass;this.hint&&(klass="abcjs-hint"),renderer.drawArc(this.startX,this.endX,this.startY,this.endY,this.above,klass,this.isTie)},window.ABCJS||(window.ABCJS={}),window.ABCJS.write||(window.ABCJS.write={}),function(){"use strict";function drawLine(renderer,l,t,r,b){var pathStr