/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/piano-chart@1.5.0/piano-chart.umd.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).pianoChart={})}(this,(function(t){"use strict";const e={},i=[];function n(t,i){if(Array.isArray(t))for(const e of t)n(e,i);else if("object"!=typeof t)r(Object.getOwnPropertyNames(i)),e[t]=Object.assign(e[t]||{},i);else for(const e in t)n(e,t[e])}function s(t){return e[t]||{}}function r(t){i.push(...t)}function h(t,e){var i,n=t.length,s=[];for(i=0;i<n;i++)s.push(e(t[i]));return s}function o(t){return t%360*Math.PI/180}function a(t){return t.toLowerCase().replace(/-(.)/g,(function(t,e){return e.toUpperCase()}))}function u(t){return t.charAt(0).toUpperCase()+t.slice(1)}function l(t,e,i,n){return null!=e&&null!=i||(n=n||t.bbox(),null==e?e=n.width/n.height*i:null==i&&(i=n.height/n.width*e)),{width:e,height:i}}function c(t,e){const i=t.origin;let n,s;if("string"==typeof i||null==i){const r=(i||"center").toLowerCase().trim(),{height:h,width:o,x:a,y:u}=e.bbox(),l=r.includes("left")?a:r.includes("right")?a+o:a+o/2,c=r.includes("top")?u:r.includes("bottom")?u+h:u+h/2;n=null!=t.ox?t.ox:l,s=null!=t.oy?t.oy:c}else n=i[0],s=i[1];return[n,s]}const d="http://www.w3.org/2000/svg",f="http://www.w3.org/2000/xmlns/",p="http://www.w3.org/1999/xlink",m={window:"undefined"==typeof window?null:window,document:"undefined"==typeof document?null:document};class y{}const g={},v="___SYMBOL___ROOT___";function _(t){return m.document.createElementNS(d,t)}function w(t){if(t instanceof y)return t;if("object"==typeof t)return O(t);if(null==t)return new g[v];if("string"==typeof t&&"<"!==t.charAt(0))return O(m.document.querySelector(t));var e=_("svg");return e.innerHTML=t,t=O(e.firstChild)}function b(t,e){return e instanceof m.window.Node?e:_(t)}function x(t){if(!t)return null;if(t.instance instanceof y)return t.instance;var e=u(t.nodeName||"Dom");return"LinearGradient"===e||"RadialGradient"===e?e="Gradient":g[e]||(e="Dom"),new g[e](t)}let O=x;function N(t,e=t.name,i=!1){return g[e]=t,i&&(g[v]=t),r(Object.getOwnPropertyNames(t.prototype)),t}let S=1e3;function k(t){return"Svgjs"+u(t)+S++}function T(t,e,i){var n,s;for(s=(t=Array.isArray(t)?t:[t]).length-1;s>=0;s--)for(n in e){let r=e[n];i&&(r=M(e[n])),t[s].prototype[n]=r}}function M(t){return function(...e){const i=e[e.length-1];return!i||i.constructor!==Object||i instanceof Array?t.apply(this,e):t.apply(this,e.slice(0,-1)).attr(i)}}n("Dom",{siblings:function(){return this.parent().children()},position:function(){return this.parent().index(this)},next:function(){return this.siblings()[this.position()+1]},prev:function(){return this.siblings()[this.position()-1]},forward:function(){var t=this.position()+1,e=this.parent();return e.removeElement(this).add(this,t),"function"==typeof e.isRoot&&e.isRoot()&&e.node.appendChild(e.defs().node),this},backward:function(){var t=this.position();return t>0&&this.parent().removeElement(this).add(this,t-1),this},front:function(){var t=this.parent();return t.node.appendChild(this.node),"function"==typeof t.isRoot&&t.isRoot()&&t.node.appendChild(t.defs().node),this},back:function(){return this.position()>0&&this.parent().removeElement(this).add(this,0),this},before:function(t){(t=w(t)).remove();var e=this.position();return this.parent().add(t,e),this},after:function(t){(t=w(t)).remove();var e=this.position();return this.parent().add(t,e+1),this},insertBefore:function(t){return(t=w(t)).before(this),this},insertAfter:function(t){return(t=w(t)).after(this),this}});const A=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,C=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,E=/rgb\((\d+),(\d+),(\d+)\)/,I=/(#[a-z0-9\-_]+)/i,j=/\)\s*,?\s*/,H=/\s/g,L=/^#[a-f0-9]{3,6}$/i,D=/^rgb\(/,P=/^(\s+)?$/,z=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,R=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,K=/[\s,]+/,F=/([^e])-/gi,q=/[MLHVCSQTAZ]/gi,W=/[MLHVCSQTAZ]/i,Y=/((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi,B=/\./g;n("Dom",{classes:function(){var t=this.attr("class");return null==t?[]:t.trim().split(K)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){var e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(t){return this.hasClass(t)&&this.attr("class",this.classes().filter((function(e){return e!==t})).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)}}),n("Dom",{css:function(t,e){const i={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter((function(t){return!!t.length})).forEach((function(t){const e=t.split(/\s*:\s*/);i[e[0]]=e[1]})),i;if(arguments.length<2){if(Array.isArray(t)){for(const e of t){const t=a(e);i[t]=this.node.style[t]}return i}if("string"==typeof t)return this.node.style[a(t)];if("object"==typeof t)for(const e in t)this.node.style[a(e)]=null==t[e]||P.test(t[e])?"":t[e]}return 2===arguments.length&&(this.node.style[a(t)]=null==e||P.test(e)?"":e),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),n("Dom",{data:function(t,e,i){if("object"==typeof t)for(e in t)this.data(e,t[e]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+t))}catch(e){return this.attr("data-"+t)}else this.attr("data-"+t,null===e?null:!0===i||"string"==typeof e||"number"==typeof e?e:JSON.stringify(e));return this}}),n("Dom",{remember:function(t,e){if("object"==typeof arguments[0])for(var i in t)this.remember(i,t[i]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=e}return this},forget:function(){if(0===arguments.length)this._memory={};else for(var t=arguments.length-1;t>=0;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory=this._memory||{}}});let U=0;const X={};function G(t){let e=t.getEventHolder();return e===m.window&&(e=X),e.events||(e.events={}),e.events}function V(t){return t.getEventTarget()}function $(t,e,i,n,s){var r=i.bind(n||t),h=w(t),o=G(h),a=V(h);e=Array.isArray(e)?e:e.split(K),i._svgjsListenerId||(i._svgjsListenerId=++U),e.forEach((function(t){var e=t.split(".")[0],n=t.split(".")[1]||"*";o[e]=o[e]||{},o[e][n]=o[e][n]||{},o[e][n][i._svgjsListenerId]=r,a.addEventListener(e,r,s||!1)}))}function Q(t,e,i,n){var s=w(t),r=G(s),h=V(s);("function"!=typeof i||(i=i._svgjsListenerId))&&(e=Array.isArray(e)?e:(e||"").split(K)).forEach((function(t){var e,o,a=t&&t.split(".")[0],u=t&&t.split(".")[1];if(i)r[a]&&r[a][u||"*"]&&(h.removeEventListener(a,r[a][u||"*"][i],n||!1),delete r[a][u||"*"][i]);else if(a&&u){if(r[a]&&r[a][u]){for(o in r[a][u])Q(h,[a,u].join("."),o);delete r[a][u]}}else if(u)for(t in r)for(e in r[t])u===e&&Q(h,[t,u].join("."));else if(a){if(r[a]){for(e in r[a])Q(h,[a,e].join("."));delete r[a]}}else{for(t in r)Q(h,t);!function(t){const e=t.getEventHolder();e.events&&(e.events={})}(s)}}))}function Z(t){const e=Math.round(t),i=Math.max(0,Math.min(255,e)).toString(16);return 1===i.length?"0"+i:i}function J(t,e){for(let i=e.length;i--;)if(null==t[e[i]])return!1;return!0}function tt(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}class et{constructor(...t){this.init(...t)}init(t=0,e=0,i=0,n=0,s="rgb"){if(t=t||0,this.space)for(const t in this.space)delete this[this.space[t]];if("number"==typeof t)s="string"==typeof n?n:s,n="string"==typeof n?0:n,Object.assign(this,{_a:t,_b:e,_c:i,_d:n,space:s});else if(t instanceof Array)this.space=e||("string"==typeof t[3]?t[3]:t[4])||"rgb",Object.assign(this,{_a:t[0],_b:t[1],_c:t[2],_d:t[3]||0});else if(t instanceof Object){const i=function(t,e){const i=J(t,"rgb")?{_a:t.r,_b:t.g,_c:t.b,space:"rgb"}:J(t,"xyz")?{_a:t.x,_b:t.y,_c:t.z,_d:0,space:"xyz"}:J(t,"hsl")?{_a:t.h,_b:t.s,_c:t.l,_d:0,space:"hsl"}:J(t,"lab")?{_a:t.l,_b:t.a,_c:t.b,_d:0,space:"lab"}:J(t,"lch")?{_a:t.l,_b:t.c,_c:t.h,_d:0,space:"lch"}:J(t,"cmyk")?{_a:t.c,_b:t.m,_c:t.y,_d:t.k,space:"cmyk"}:{_a:0,_b:0,_c:0,space:"rgb"};return i.space=e||i.space,i}(t,e);Object.assign(this,i)}else if("string"==typeof t)if(D.test(t)){const e=t.replace(H,""),[i,n,s]=E.exec(e).slice(1,4).map(t=>parseInt(t));Object.assign(this,{_a:i,_b:n,_c:s,_d:0,space:"rgb"})}else{if(!L.test(t))throw Error("Unsupported string format, can't construct Color");{const e=t=>parseInt(t,16),[,i,n,s]=C.exec(function(t){return 4===t.length?["#",t.substring(1,2),t.substring(1,2),t.substring(2,3),t.substring(2,3),t.substring(3,4),t.substring(3,4)].join(""):t}(t)).map(e);Object.assign(this,{_a:i,_b:n,_c:s,_d:0,space:"rgb"})}}const{_a:r,_b:h,_c:o,_d:a}=this,u="rgb"===this.space?{r:r,g:h,b:o}:"xyz"===this.space?{x:r,y:h,z:o}:"hsl"===this.space?{h:r,s:h,l:o}:"lab"===this.space?{l:r,a:h,b:o}:"lch"===this.space?{l:r,c:h,h:o}:"cmyk"===this.space?{c:r,m:h,y:o,k:a}:{};Object.assign(this,u)}rgb(){if("rgb"===this.space)return this;if("lab"===(t=this.space)||"xyz"===t||"lch"===t){let{x:t,y:e,z:i}=this;if("lab"===this.space||"lch"===this.space){let{l:n,a:s,b:r}=this;if("lch"===this.space){const{c:t,h:e}=this,i=Math.PI/180;s=t*Math.cos(i*e),r=t*Math.sin(i*e)}const h=(n+16)/116,o=s/500+h,a=h-r/200,u=16/116,l=.008856,c=7.787;t=.95047*(o**3>l?o**3:(o-u)/c),e=1*(h**3>l?h**3:(h-u)/c),i=1.08883*(a**3>l?a**3:(a-u)/c)}const n=3.2406*t+-1.5372*e+-.4986*i,s=-.9689*t+1.8758*e+.0415*i,r=.0557*t+-.204*e+1.057*i,h=Math.pow,o=.0031308,a=n>o?1.055*h(n,1/2.4)-.055:12.92*n,u=s>o?1.055*h(s,1/2.4)-.055:12.92*s,l=r>o?1.055*h(r,1/2.4)-.055:12.92*r;return new et(255*a,255*u,255*l)}if("hsl"===this.space){let{h:t,s:e,l:i}=this;if(t/=360,e/=100,i/=100,0===e){return i*=255,new et(i,i,i)}const n=i<.5?i*(1+e):i+e-i*e,s=2*i-n,r=255*tt(s,n,t+1/3),h=255*tt(s,n,t),o=255*tt(s,n,t-1/3);return new et(r,h,o)}if("cmyk"===this.space){const{c:t,m:e,y:i,k:n}=this,s=255*(1-Math.min(1,t*(1-n)+n)),r=255*(1-Math.min(1,e*(1-n)+n)),h=255*(1-Math.min(1,i*(1-n)+n));return new et(s,r,h)}return this;var t}lab(){const{x:t,y:e,z:i}=this.xyz();return new et(116*e-16,500*(t-e),200*(e-i),"lab")}xyz(){const{_a:t,_b:e,_c:i}=this.rgb(),[n,s,r]=[t,e,i].map(t=>t/255),h=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92,o=s>.04045?Math.pow((s+.055)/1.055,2.4):s/12.92,a=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,u=(.4124*h+.3576*o+.1805*a)/.95047,l=(.2126*h+.7152*o+.0722*a)/1,c=(.0193*h+.1192*o+.9505*a)/1.08883,d=u>.008856?Math.pow(u,1/3):7.787*u+16/116,f=l>.008856?Math.pow(l,1/3):7.787*l+16/116,p=c>.008856?Math.pow(c,1/3):7.787*c+16/116;return new et(d,f,p,"xyz")}lch(){const{l:t,a:e,b:i}=this.lab(),n=Math.sqrt(e**2+i**2);let s=180*Math.atan2(i,e)/Math.PI;return s<0&&(s*=-1,s=360-s),new et(t,n,s,"lch")}hsl(){const{_a:t,_b:e,_c:i}=this.rgb(),[n,s,r]=[t,e,i].map(t=>t/255),h=Math.max(n,s,r),o=Math.min(n,s,r),a=(h+o)/2,u=h===o,l=h-o;return new et(360*(u?0:h===n?((s-r)/l+(s<r?6:0))/6:h===s?((r-n)/l+2)/6:h===r?((n-s)/l+4)/6:0),100*(u?0:a>.5?l/(2-h-o):l/(h+o)),100*a,"hsl")}cmyk(){const{_a:t,_b:e,_c:i}=this.rgb(),[n,s,r]=[t,e,i].map(t=>t/255),h=Math.min(1-n,1-s,1-r);return 1===h?new et(0,0,0,1,"cmyk"):new et((1-n-h)/(1-h),(1-s-h)/(1-h),(1-r-h)/(1-h),h,"cmyk")}_clamped(){const{_a:t,_b:e,_c:i}=this.rgb(),{max:n,min:s,round:r}=Math;return[t,e,i].map(t=>n(0,s(r(t),255)))}toHex(){const[t,e,i]=this._clamped().map(Z);return`#${t}${e}${i}`}toString(){return this.toHex()}toRgb(){const[t,e,i]=this._clamped();return`rgb(${t},${e},${i})`}toArray(){const{_a:t,_b:e,_c:i,_d:n,space:s}=this;return[t,e,i,n,s]}static random(t="vibrant",e,i){const{random:n,round:s,sin:r,PI:h}=Math;if("vibrant"===t){const t=24*n()+57,e=38*n()+45,i=360*n();return new et(t,e,i,"lch")}if("sine"===t){const t=s(80*r(2*h*(e=null==e?n():e)/.5+.01)+150),i=s(50*r(2*h*e/.5+4.6)+200),o=s(100*r(2*h*e/.5+2.3)+150);return new et(t,i,o)}if("pastel"===t){const t=8*n()+86,e=17*n()+9,i=360*n();return new et(t,e,i,"lch")}if("dark"===t){const t=10+10*n(),e=50*n()+86,i=360*n();return new et(t,e,i,"lch")}if("rgb"===t){const t=255*n(),e=255*n(),i=255*n();return new et(t,e,i)}if("lab"===t){const t=100*n(),e=256*n()-128,i=256*n()-128;return new et(t,e,i,"lab")}if("grey"===t){const t=255*n();return new et(t,t,t)}}static test(t){return"string"==typeof t&&(L.test(t)||D.test(t))}static isRgb(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b}static isColor(t){return t&&(t instanceof et||this.isRgb(t)||this.test(t))}}class it{constructor(...t){this.init(...t)}init(t,e){const i=0,n=0,s=Array.isArray(t)?{x:t[0],y:t[1]}:"object"==typeof t?{x:t.x,y:t.y}:{x:t,y:e};return this.x=null==s.x?i:s.x,this.y=null==s.y?n:s.y,this}clone(){return new it(this)}transform(t){return this.clone().transformO(t)}transformO(t){st.isMatrixLike(t)||(t=new st(t));const{x:e,y:i}=this;return this.x=t.a*e+t.c*i+t.e,this.y=t.b*e+t.d*i+t.f,this}toArray(){return[this.x,this.y]}}function nt(t,e,i){return Math.abs(e-t)<(i||1e-6)}class st{constructor(...t){this.init(...t)}init(t){var e=st.fromArray([1,0,0,1,0,0]);return t=t instanceof Ot?t.matrixify():"string"==typeof t?st.fromArray(t.split(K).map(parseFloat)):Array.isArray(t)?st.fromArray(t):"object"==typeof t&&st.isMatrixLike(t)?t:"object"==typeof t?(new st).transform(t):6===arguments.length?st.fromArray([].slice.call(arguments)):e,this.a=null!=t.a?t.a:e.a,this.b=null!=t.b?t.b:e.b,this.c=null!=t.c?t.c:e.c,this.d=null!=t.d?t.d:e.d,this.e=null!=t.e?t.e:e.e,this.f=null!=t.f?t.f:e.f,this}clone(){return new st(this)}transform(t){if(st.isMatrixLike(t))return new st(t).multiplyO(this);var e=st.formatTransforms(t);const{x:i,y:n}=new it(e.ox,e.oy).transform(this);var s=(new st).translateO(e.rx,e.ry).lmultiplyO(this).translateO(-i,-n).scaleO(e.scaleX,e.scaleY).skewO(e.skewX,e.skewY).shearO(e.shear).rotateO(e.theta).translateO(i,n);if(isFinite(e.px)||isFinite(e.py)){const t=new it(i,n).transform(s),r=e.px?e.px-t.x:0,h=e.py?e.py-t.y:0;s.translateO(r,h)}return s.translateO(e.tx,e.ty),s}compose(t){t.origin&&(t.originX=t.origin[0],t.originY=t.origin[1]);var e=t.originX||0,i=t.originY||0,n=t.scaleX||1,s=t.scaleY||1,r=t.shear||0,h=t.rotate||0,o=t.translateX||0,a=t.translateY||0;return(new st).translateO(-e,-i).scaleO(n,s).shearO(r).rotateO(h).translateO(o,a).lmultiplyO(this).translateO(e,i)}decompose(t=0,e=0){var i=this.a,n=this.b,s=this.c,r=this.d,h=this.e,o=this.f,a=i*r-n*s,u=a>0?1:-1,l=u*Math.sqrt(i*i+n*n),c=Math.atan2(u*n,u*i),d=180/Math.PI*c,f=Math.cos(c),p=Math.sin(c),m=(i*s+n*r)/a,y=s*l/(m*i-n)||r*l/(m*n+i);return{scaleX:l,scaleY:y,shear:m,rotate:d,translateX:h-t+t*f*l+e*(m*f*l-p*y),translateY:o-e+t*p*l+e*(m*p*l+f*y),originX:t,originY:e,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}multiply(t){return this.clone().multiplyO(t)}multiplyO(t){var e=t instanceof st?t:new st(t);return st.matrixMultiply(this,e,this)}lmultiply(t){return this.clone().lmultiplyO(t)}lmultiplyO(t){var e=t instanceof st?t:new st(t);return st.matrixMultiply(e,this,this)}inverseO(){var t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,h=t*n-e*i;if(!h)throw new Error("Cannot invert "+this);var o=n/h,a=-e/h,u=-i/h,l=t/h,c=-(o*s+u*r),d=-(a*s+l*r);return this.a=o,this.b=a,this.c=u,this.d=l,this.e=c,this.f=d,this}inverse(){return this.clone().inverseO()}translate(t,e){return this.clone().translateO(t,e)}translateO(t,e){return this.e+=t||0,this.f+=e||0,this}scale(t,e,i,n){return this.clone().scaleO(...arguments)}scaleO(t,e=t,i=0,n=0){3===arguments.length&&(n=i,i=e,e=t);const{a:s,b:r,c:h,d:o,e:a,f:u}=this;return this.a=s*t,this.b=r*e,this.c=h*t,this.d=o*e,this.e=a*t-i*t+i,this.f=u*e-n*e+n,this}rotate(t,e,i){return this.clone().rotateO(t,e,i)}rotateO(t,e=0,i=0){t=o(t);const n=Math.cos(t),s=Math.sin(t),{a:r,b:h,c:a,d:u,e:l,f:c}=this;return this.a=r*n-h*s,this.b=h*n+r*s,this.c=a*n-u*s,this.d=u*n+a*s,this.e=l*n-c*s+i*s-e*n+e,this.f=c*n+l*s-e*s-i*n+i,this}flip(t,e){return this.clone().flipO(t,e)}flipO(t,e){return"x"===t?this.scaleO(-1,1,e,0):"y"===t?this.scaleO(1,-1,0,e):this.scaleO(-1,-1,t,e||t)}shear(t,e,i){return this.clone().shearO(t,e,i)}shearO(t,e=0,i=0){const{a:n,b:s,c:r,d:h,e:o,f:a}=this;return this.a=n+s*t,this.c=r+h*t,this.e=o+a*t-i*t,this}skew(t,e,i,n){return this.clone().skewO(...arguments)}skewO(t,e=t,i=0,n=0){3===arguments.length&&(n=i,i=e,e=t),t=o(t),e=o(e);const s=Math.tan(t),r=Math.tan(e),{a:h,b:a,c:u,d:l,e:c,f:d}=this;return this.a=h+a*s,this.b=a+h*r,this.c=u+l*s,this.d=l+u*r,this.e=c+d*s-n*s,this.f=d+c*r-i*r,this}skewX(t,e,i){return this.skew(t,0,e,i)}skewXO(t,e,i){return this.skewO(t,0,e,i)}skewY(t,e,i){return this.skew(0,t,e,i)}skewYO(t,e,i){return this.skewO(0,t,e,i)}aroundO(t,e,i){var n=t||0,s=e||0;return this.translateO(-n,-s).lmultiplyO(i).translateO(n,s)}around(t,e,i){return this.clone().aroundO(t,e,i)}equals(t){var e=new st(t);return nt(this.a,e.a)&&nt(this.b,e.b)&&nt(this.c,e.c)&&nt(this.d,e.d)&&nt(this.e,e.e)&&nt(this.f,e.f)}toString(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"}toArray(){return[this.a,this.b,this.c,this.d,this.e,this.f]}valueOf(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}static fromArray(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}static isMatrixLike(t){return null!=t.a||null!=t.b||null!=t.c||null!=t.d||null!=t.e||null!=t.f}static formatTransforms(t){var e="both"===t.flip||!0===t.flip,i=t.flip&&(e||"x"===t.flip)?-1:1,n=t.flip&&(e||"y"===t.flip)?-1:1,s=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,r=t.skew&&t.skew.length?t.skew[1]:isFinite(t.skew)?t.skew:isFinite(t.skewY)?t.skewY:0,h=t.scale&&t.scale.length?t.scale[0]*i:isFinite(t.scale)?t.scale*i:isFinite(t.scaleX)?t.scaleX*i:i,o=t.scale&&t.scale.length?t.scale[1]*n:isFinite(t.scale)?t.scale*n:isFinite(t.scaleY)?t.scaleY*n:n,a=t.shear||0,u=t.rotate||t.theta||0,l=new it(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),c=l.x,d=l.y,f=new it(t.position||t.px||t.positionX,t.py||t.positionY),p=f.x,m=f.y,y=new it(t.translate||t.tx||t.translateX,t.ty||t.translateY),g=y.x,v=y.y,_=new it(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:h,scaleY:o,skewX:s,skewY:r,shear:a,theta:u,rx:_.x,ry:_.y,tx:g,ty:v,ox:c,oy:d,px:p,py:m}}static matrixMultiply(t,e,i){var n=t.a*e.a+t.c*e.b,s=t.b*e.a+t.d*e.b,r=t.a*e.c+t.c*e.d,h=t.b*e.c+t.d*e.d,o=t.e+t.a*e.e+t.c*e.f,a=t.f+t.b*e.e+t.d*e.f;return i.a=n,i.b=s,i.c=r,i.d=h,i.e=o,i.f=a,i}}function rt(){if(!rt.nodes){const t=w().size(2,0);t.node.style.cssText=["opacity: 0","position: absolute","left: -100%","top: -100%","overflow: hidden"].join(";"),t.attr("focusable","false"),t.attr("aria-hidden","true");const e=t.path().node;rt.nodes={svg:t,path:e}}if(!rt.nodes.svg.node.parentNode){const t=m.document.body||m.document.documentElement;rt.nodes.svg.addTo(t)}return rt.nodes}function ht(t){return!(t.width||t.height||t.x||t.y)}N(st,"Matrix");class ot{constructor(...t){this.init(...t)}init(t){return t="string"==typeof t?t.split(K).map(parseFloat):Array.isArray(t)?t:"object"==typeof t?[null!=t.left?t.left:t.x,null!=t.top?t.top:t.y,t.width,t.height]:4===arguments.length?[].slice.call(arguments):[0,0,0,0],this.x=t[0]||0,this.y=t[1]||0,this.width=this.w=t[2]||0,this.height=this.h=t[3]||0,this.x2=this.x+this.w,this.y2=this.y+this.h,this.cx=this.x+this.w/2,this.cy=this.y+this.h/2,this}merge(t){const e=Math.min(this.x,t.x),i=Math.min(this.y,t.y),n=Math.max(this.x+this.width,t.x+t.width)-e,s=Math.max(this.y+this.height,t.y+t.height)-i;return new ot(e,i,n,s)}transform(t){t instanceof st||(t=new st(t));let e=1/0,i=-1/0,n=1/0,s=-1/0;return[new it(this.x,this.y),new it(this.x2,this.y),new it(this.x,this.y2),new it(this.x2,this.y2)].forEach((function(r){r=r.transform(t),e=Math.min(e,r.x),i=Math.max(i,r.x),n=Math.min(n,r.y),s=Math.max(s,r.y)})),new ot(e,n,i-e,s-n)}addOffset(){return this.x+=m.window.pageXOffset,this.y+=m.window.pageYOffset,this}toString(){return this.x+" "+this.y+" "+this.width+" "+this.height}toArray(){return[this.x,this.y,this.width,this.height]}isNulled(){return ht(this)}}function at(t,e){let i;try{if(i=t(this.node),ht(i)&&((n=this.node)!==m.document&&!(m.document.documentElement.contains||function(t){for(;t.parentNode;)t=t.parentNode;return t===m.document}).call(m.document.documentElement,n)))throw new Error("Element not in the dom")}catch(t){i=e(this)}var n;return i}n({viewbox:{viewbox(t,e,i,n){return null==t?new ot(this.attr("viewBox")):this.attr("viewBox",new ot(t,e,i,n))},zoom(t,e){let i=this.node.clientWidth,n=this.node.clientHeight;const s=this.viewbox();if(!i&&!n){var r=window.getComputedStyle(this.node);i=parseFloat(r.getPropertyValue("width")),n=parseFloat(r.getPropertyValue("height"))}const h=i/s.width,o=n/s.height,a=Math.min(h,o);if(null==t)return a;let u=a/t;u===1/0&&(u=Number.MIN_VALUE),e=e||new it(i/2/h+s.x,n/2/o+s.y);const l=new ot(s).transform(new st({scale:u,origin:e}));return this.viewbox(l)}}}),N(ot,"Box");const ut=function(){try{return Function("name","baseClass","_constructor",["baseClass = baseClass || Array","return {","  [name]: class extends baseClass {","    constructor (...args) {","      super(...args)","      _constructor && _constructor.apply(this, args)","    }","  }","}[name]"].join("\n"))}catch(t){return(t,e=Array,i)=>{const n=function(){e.apply(this,arguments),i&&i.apply(this,arguments)};return(n.prototype=Object.create(e.prototype)).constructor=n,n.prototype.map=function(t){const e=new n;return e.push.apply(e,Array.prototype.map.call(this,t)),e},n}}}(),lt=ut("List",Array,(function(t=[]){if("number"==typeof t)return this;this.length=0,this.push(...t)}));T(lt,{each(t,...e){return"function"==typeof t?this.map(e=>t.call(e,e)):this.map(i=>i[t](...e))},toArray(){return Array.prototype.concat.apply([],this)}});const ct=["toArray","constructor","each"];function dt(t,e){return new lt(h((e||m.document).querySelectorAll(t),(function(t){return x(t)})))}lt.extend=function(t){t=t.reduce((t,e)=>(ct.includes(e)||"_"===e[0]||(t[e]=function(...t){return this.each(e,...t)}),t),{}),T(lt,t)};class ft extends y{constructor({events:t={}}={}){super(),this.events=t}addEventListener(){}dispatch(t,e){return function(t,e,i){var n=V(t);return e instanceof m.window.Event||(e=new m.window.CustomEvent(e,{detail:i,cancelable:!0})),n.dispatchEvent(e),e}(this,t,e)}dispatchEvent(t){const e=this.getEventHolder().events;if(!e)return!0;const i=e[t.type];for(const e in i)for(const n in i[e])i[e][n](t);return!t.defaultPrevented}fire(t,e){return this.dispatch(t,e),this}getEventHolder(){return this}getEventTarget(){return this}off(t,e){return Q(this,t,e),this}on(t,e,i,n){return $(this,t,e,i,n),this}removeEventListener(){}}function pt(){}N(ft,"EventTarget");const mt=400,yt=">",gt=0,vt={"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","text-anchor":"start"},_t=ut("SVGArray",Array,(function(t){this.init(t)}));T(_t,{init(t){return"number"==typeof t||(this.length=0,this.push(...this.parse(t))),this},toArray(){return Array.prototype.concat.apply([],this)},toString(){return this.join(" ")},valueOf(){const t=[];return t.push(...this),t},parse:(t=[])=>t instanceof Array?t:t.trim().split(K).map(parseFloat),clone(){return new this.constructor(this)},toSet(){return new Set(this)}});class wt{constructor(...t){this.init(...t)}init(t,e){return e=Array.isArray(t)?t[1]:e,t=Array.isArray(t)?t[0]:t,this.value=0,this.unit=e||"","number"==typeof t?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-34e37:34e37:"string"==typeof t?(e=t.match(A))&&(this.value=parseFloat(e[1]),"%"===e[5]?this.value/=100:"s"===e[5]&&(this.value*=1e3),this.unit=e[5]):t instanceof wt&&(this.value=t.valueOf(),this.unit=t.unit),this}toString(){return("%"===this.unit?~~(1e8*this.value)/1e6:"s"===this.unit?this.value/1e3:this.value)+this.unit}toJSON(){return this.toString()}toArray(){return[this.value,this.unit]}valueOf(){return this.value}plus(t){return t=new wt(t),new wt(this+t,this.unit||t.unit)}minus(t){return t=new wt(t),new wt(this-t,this.unit||t.unit)}times(t){return t=new wt(t),new wt(this*t,this.unit||t.unit)}divide(t){return t=new wt(t),new wt(this/t,this.unit||t.unit)}convert(t){return new wt(this.value,t)}}const bt=[];class xt extends ft{constructor(t,e){super(t),this.node=t,this.type=t.nodeName,e&&t!==e&&this.attr(e)}add(t,e){return t=w(t),null==e?this.node.appendChild(t.node):t.node!==this.node.childNodes[e]&&this.node.insertBefore(t.node,this.node.childNodes[e]),this}addTo(t){return w(t).put(this)}children(){return new lt(h(this.node.children,(function(t){return x(t)})))}clear(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}clone(){return this.writeDataToDom(),function t(e){for(var i=e.children.length-1;i>=0;i--)t(e.children[i]);return e.id?x(e).id(k(e.nodeName)):x(e)}(this.node.cloneNode(!0))}each(t,e){var i,n,s=this.children();for(i=0,n=s.length;i<n;i++)t.apply(s[i],[i,s]),e&&s[i].each(t,e);return this}element(t){return this.put(new xt(_(t)))}first(){return x(this.node.firstChild)}get(t){return x(this.node.childNodes[t])}getEventHolder(){return this.node}getEventTarget(){return this.node}has(t){return this.index(t)>=0}id(t){return void 0!==t||this.node.id||(this.node.id=k(this.type)),this.attr("id",t)}index(t){return[].slice.call(this.node.childNodes).indexOf(t.node)}last(){return x(this.node.lastChild)}matches(t){const e=this.node;return(e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector).call(e,t)}parent(t){var e=this;if(!e.node.parentNode)return null;if(e=x(e.node.parentNode),!t)return e;for(;e;){if("string"==typeof t?e.matches(t):e instanceof t)return e;if(!e.node.parentNode||"#document"===e.node.parentNode.nodeName||"#document-fragment"===e.node.parentNode.nodeName)return null;e=x(e.node.parentNode)}}put(t,e){return this.add(t,e),t}putIn(t){return w(t).add(this)}remove(){return this.parent()&&this.parent().removeElement(this),this}removeElement(t){return this.node.removeChild(t.node),this}replace(t){return t=w(t),this.node.parentNode.replaceChild(t.node,this.node),t}round(t=2,e){const i=10**t,n=this.attr();e||(e=Object.keys(n));const s={};return e.forEach(t=>{s[t]=Math.round(n[t]*i)/i}),this.attr(s),this}toString(){return this.id()}svg(t,e){var i,n,s;if(!1===t&&(e=!1,t=null),null==t||"function"==typeof t){e=null==e||e,this.writeDataToDom();let i=this;if(null!=t){if(i=x(i.node.cloneNode(!0)),e){const e=t(i);if(i=e||i,!1===e)return""}i.each((function(){const e=t(this),i=e||this;!1===e?this.remove():e&&this!==i&&this.replace(i)}),!0)}return e?i.node.outerHTML:i.node.innerHTML}for(e=null!=e&&e,i=m.document.createElementNS(d,"svg"),s=m.document.createDocumentFragment(),i.innerHTML=t,n=i.children.length;n--;)s.appendChild(i.firstElementChild);const r=this.parent();return e?this.replace(s)&&r:this.add(s)}words(t){return this.node.textContent=t,this}writeDataToDom(){return this.each((function(){this.writeDataToDom()})),this}}T(xt,{attr:function(t,e,i){if(null==t){t={},e=this.node.attributes;for(const i of e)t[i.nodeName]=z.test(i.nodeValue)?parseFloat(i.nodeValue):i.nodeValue;return t}if(t instanceof Array)return t.reduce((t,e)=>(t[e]=this.attr(e),t),{});if("object"==typeof t&&t.constructor===Object)for(e in t)this.attr(e,t[e]);else if(null===e)this.node.removeAttribute(t);else{if(null==e)return null==(e=this.node.getAttribute(t))?vt[t]:z.test(e)?parseFloat(e):e;"number"==typeof(e=bt.reduce((e,i)=>i(t,e,this),e))?e=new wt(e):et.isColor(e)?e=new et(e):e.constructor===Array&&(e=new _t(e)),"leading"===t?this.leading&&this.leading(e):"string"==typeof i?this.node.setAttributeNS(i,t,e.toString()):this.node.setAttribute(t,e.toString()),!this.rebuild||"font-size"!==t&&"x"!==t||this.rebuild()}return this},find:function(t){return dt(t,this.node)},findOne:function(t){return x(this.node.querySelector(t))}}),N(xt,"Dom");class Ot extends xt{constructor(t,e){super(t,e),this.dom={},this.node.instance=this,t.hasAttribute("svgjs:data")&&this.setData(JSON.parse(t.getAttribute("svgjs:data"))||{})}center(t,e){return this.cx(t).cy(e)}cx(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)}cy(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)}defs(){return this.root().defs()}dmove(t,e){return this.dx(t).dy(e)}dx(t=0){return this.x(new wt(t).plus(this.x()))}dy(t=0){return this.y(new wt(t).plus(this.y()))}root(){const t=this.parent(g[v]);return t&&t.root()}getEventHolder(){return this}height(t){return this.attr("height",t)}inside(t,e){const i=this.bbox();return t>i.x&&e>i.y&&t<i.x+i.width&&e<i.y+i.height}move(t,e){return this.x(t).y(e)}parents(t=m.document){t=w(t);const e=new lt;let i=this;for(;(i=i.parent())&&i.node!==t.node&&i.node!==m.document;)e.push(i);return e}reference(t){if(!(t=this.attr(t)))return null;const e=t.match(I);return e?w(e[1]):null}setData(t){return this.dom=t,this}size(t,e){const i=l(this,t,e);return this.width(new wt(i.width)).height(new wt(i.height))}width(t){return this.attr("width",t)}writeDataToDom(){return this.node.removeAttribute("svgjs:data"),Object.keys(this.dom).length&&this.node.setAttribute("svgjs:data",JSON.stringify(this.dom)),super.writeDataToDom()}x(t){return this.attr("x",t)}y(t){return this.attr("y",t)}}T(Ot,{bbox:function(){return new ot(at.call(this,t=>t.getBBox(),t=>{try{const e=t.clone().addTo(rt().svg).show(),i=e.node.getBBox();return e.remove(),i}catch(e){throw new Error('Getting bbox of element "'+t.node.nodeName+'" is not possible. '+e.toString())}}))},rbox:function(t){const e=new ot(at.call(this,t=>t.getBoundingClientRect(),t=>{throw new Error('Getting rbox of element "'+t.node.nodeName+'" is not possible')}));return t?e.transform(t.screenCTM().inverse()):e.addOffset()},point:function(t,e){return new it(t,e).transform(this.screenCTM().inverse())},ctm:function(){return new st(this.node.getCTM())},screenCTM:function(){if("function"==typeof this.isRoot&&!this.isRoot()){var t=this.rect(1,1),e=t.node.getScreenCTM();return t.remove(),new st(e)}return new st(this.node.getScreenCTM())}}),N(Ot,"Element");var Nt={stroke:["color","width","opacity","linecap","linejoin","miterlimit","dasharray","dashoffset"],fill:["color","opacity","rule"],prefix:function(t,e){return"color"===e?t:t+"-"+e}};function St(t){return this.attr("rx",t)}function kt(t){return this.attr("ry",t)}function Tt(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())}function Mt(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())}function At(t){return null==t?this.attr("cx"):this.attr("cx",t)}function Ct(t){return null==t?this.attr("cy"):this.attr("cy",t)}function Et(t){return null==t?2*this.rx():this.rx(new wt(t).divide(2))}function It(t){return null==t?2*this.ry():this.ry(new wt(t).divide(2))}["fill","stroke"].forEach((function(t){var e,i={};i[t]=function(i){if(void 0===i)return this.attr(t);if("string"==typeof i||i instanceof et||et.isRgb(i)||i instanceof Ot)this.attr(t,i);else for(e=Nt[t].length-1;e>=0;e--)null!=i[Nt[t][e]]&&this.attr(Nt.prefix(t,Nt[t][e]),i[Nt[t][e]]);return this},n(["Element","Runner"],i)})),n(["Element","Runner"],{matrix:function(t,e,i,n,s,r){return null==t?new st(this):this.attr("transform",new st(t,e,i,n,s,r))},rotate:function(t,e,i){return this.transform({rotate:t,ox:e,oy:i},!0)},skew:function(t,e,i,n){return 1===arguments.length||3===arguments.length?this.transform({skew:t,ox:e,oy:i},!0):this.transform({skew:[t,e],ox:i,oy:n},!0)},shear:function(t,e,i){return this.transform({shear:t,ox:e,oy:i},!0)},scale:function(t,e,i,n){return 1===arguments.length||3===arguments.length?this.transform({scale:t,ox:e,oy:i},!0):this.transform({scale:[t,e],ox:i,oy:n},!0)},translate:function(t,e){return this.transform({translate:[t,e]},!0)},relative:function(t,e){return this.transform({relative:[t,e]},!0)},flip:function(t,e){var i="string"==typeof t?t:(isFinite(t),"both"),n="both"===t&&isFinite(e)?[e,e]:"x"===t?[e,0]:"y"===t?[0,e]:isFinite(t)?[t,t]:[0,0];return this.transform({flip:i,origin:n},!0)},opacity:function(t){return this.attr("opacity",t)}}),n("radius",{radius:function(t,e){var i=(this._element||this).type;return"radialGradient"===i||"radialGradient"===i?this.attr("r",new wt(t)):this.rx(t).ry(null==e?t:e)}}),n("Path",{length:function(){return this.node.getTotalLength()},pointAt:function(t){return new it(this.node.getPointAtLength(t))}}),n(["Element","Runner"],{font:function(t,e){if("object"==typeof t){for(e in t)this.font(e,t[e]);return this}return"leading"===t?this.leading(e):"anchor"===t?this.attr("text-anchor",e):"size"===t||"family"===t||"weight"===t||"stretch"===t||"variant"===t||"style"===t?this.attr("font-"+t,e):this.attr(t,e)}}),n("Text",{ax(t){return this.attr("x",t)},ay(t){return this.attr("y",t)},amove(t,e){return this.ax(t).ay(e)}}),n("Element",["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","touchstart","touchmove","touchleave","touchend","touchcancel"].reduce((function(t,e){return t[e]=function(t){return null===t?Q(this,e):$(this,e,t),this},t}),{})),n("Element",{untransform:function(){return this.attr("transform",null)},matrixify:function(){return(this.attr("transform")||"").split(j).slice(0,-1).map((function(t){var e=t.trim().split("(");return[e[0],e[1].split(K).map((function(t){return parseFloat(t)}))]})).reverse().reduce((function(t,e){return"matrix"===e[0]?t.lmultiply(st.fromArray(e[1])):t[e[0]].apply(t,e[1])}),new st)},toParent:function(t){if(this===t)return this;var e=this.screenCTM(),i=t.screenCTM().inverse();return this.addTo(t).untransform().transform(i.multiply(e)),this},toRoot:function(){return this.toParent(this.root())},transform:function(t,e){if(null==t||"string"==typeof t){var i=new st(this).decompose();return null==t?i:i[t]}st.isMatrixLike(t)||(t={...t,origin:c(t,this)});var n=new st(!0===e?this:e||!1).transform(t);return this.attr("transform",n)}});var jt,Ht=Object.freeze({__proto__:null,rx:St,ry:kt,x:Tt,y:Mt,cx:At,cy:Ct,width:Et,height:It});class Lt extends Ot{}N(Lt,"Shape");class Dt extends Lt{constructor(t){super(b("circle",t),t)}radius(t){return this.attr("r",t)}rx(t){return this.attr("r",t)}ry(t){return this.rx(t)}size(t){return this.radius(new wt(t).divide(2))}}T(Dt,{x:Tt,y:Mt,cx:At,cy:Ct,width:Et,height:It}),n({Container:{circle:M((function(t){return this.put(new Dt).size(t).move(0,0)}))}}),N(Dt,"Circle");class Pt extends Ot{flatten(t){return this.each((function(){return this instanceof Pt?this.flatten(t).ungroup(t):this.toParent(t)})),this.node.firstElementChild||this.remove(),this}ungroup(t){return t=t||this.parent(),this.each((function(){return this.toParent(t)})),this.remove(),this}}N(Pt,"Container");class zt extends Pt{constructor(t){super(b("defs",t),t)}flatten(){return this}ungroup(){return this}}N(zt,"Defs");class Rt extends Lt{constructor(t){super(b("ellipse",t),t)}size(t,e){var i=l(this,t,e);return this.rx(new wt(i.width).divide(2)).ry(new wt(i.height).divide(2))}}T(Rt,Ht),n("Container",{ellipse:M((function(t=0,e=t){return this.put(new Rt).size(t,e).move(0,0)}))}),N(Rt,"Ellipse");class Kt extends Ot{constructor(t){super(b("stop",t),t)}update(t){return("number"==typeof t||t instanceof wt)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new wt(t.offset)),this}}function Ft(t,e){return"radialGradient"===(this._element||this).type?this.attr({fx:new wt(t),fy:new wt(e)}):this.attr({x1:new wt(t),y1:new wt(e)})}function qt(t,e){return"radialGradient"===(this._element||this).type?this.attr({cx:new wt(t),cy:new wt(e)}):this.attr({x2:new wt(t),y2:new wt(e)})}N(Kt,"Stop");class Wt extends Pt{constructor(t,e){super(b(t+"Gradient","string"==typeof t?null:t),e)}stop(t,e,i){return this.put(new Kt).update(t,e,i)}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}toString(){return this.url()}attr(t,e,i){return"transform"===t&&(t="gradientTransform"),super.attr(t,e,i)}targets(){return dt('svg [fill*="'+this.id()+'"]')}bbox(){return new ot}}T(Wt,Object.freeze({__proto__:null,from:Ft,to:qt})),n({Container:{gradient:M((function(t,e){return this.defs().gradient(t,e)}))},Defs:{gradient:M((function(t,e){return this.put(new Wt(t)).update(e)}))}}),N(Wt,"Gradient");class Yt extends Pt{constructor(t){super(b("pattern",t),t)}url(){return"url(#"+this.id()+")"}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}toString(){return this.url()}attr(t,e,i){return"transform"===t&&(t="patternTransform"),super.attr(t,e,i)}targets(){return dt('svg [fill*="'+this.id()+'"]')}bbox(){return new ot}}n({Container:{pattern(...t){return this.defs().pattern(...t)}},Defs:{pattern:M((function(t,e,i){return this.put(new Yt).update(i).attr({x:0,y:0,width:t,height:e,patternUnits:"userSpaceOnUse"})}))}}),N(Yt,"Pattern");class Bt extends Lt{constructor(t){super(b("image",t),t)}load(t,e){if(!t)return this;var i=new m.window.Image;return $(i,"load",(function(t){var n=this.parent(Yt);0===this.width()&&0===this.height()&&this.size(i.width,i.height),n instanceof Yt&&0===n.width()&&0===n.height()&&n.size(this.width(),this.height()),"function"==typeof e&&e.call(this,t)}),this),$(i,"load error",(function(){Q(i)})),this.attr("href",i.src=t,p)}}jt=function(t,e,i){return"fill"!==t&&"stroke"!==t||R.test(e)&&(e=i.root().defs().image(e)),e instanceof Bt&&(e=i.root().defs().pattern(0,0,t=>{t.add(e)})),e},bt.push(jt),n({Container:{image:M((function(t,e){return this.put(new Bt).size(0,0).load(t,e)}))}}),N(Bt,"Image");const Ut=ut("PointArray",_t);T(Ut,{toString(){for(var t=0,e=this.length,i=[];t<e;t++)i.push(this[t].join(","));return i.join(" ")},toLine(){return{x1:this[0][0],y1:this[0][1],x2:this[1][0],y2:this[1][1]}},at(t){if(!this.destination)return this;for(var e=0,i=this.length,n=[];e<i;e++)n.push([this[e][0]+(this.destination[e][0]-this[e][0])*t,this[e][1]+(this.destination[e][1]-this[e][1])*t]);return new Ut(n)},parse(t=[[0,0]]){var e=[];if(t instanceof Array){if(t[0]instanceof Array)return t}else t=t.trim().split(K).map(parseFloat);t.length%2!=0&&t.pop();for(var i=0,n=t.length;i<n;i+=2)e.push([t[i],t[i+1]]);return e},transform(t){const e=[];for(let i=0;i<this.length;i++){const n=this[i];e.push([t.a*n[0]+t.c*n[1]+t.e,t.b*n[0]+t.d*n[1]+t.f])}return new Ut(e)},move(t,e){var i=this.bbox();if(t-=i.x,e-=i.y,!isNaN(t)&&!isNaN(e))for(var n=this.length-1;n>=0;n--)this[n]=[this[n][0]+t,this[n][1]+e];return this},size(t,e){var i,n=this.bbox();for(i=this.length-1;i>=0;i--)n.width&&(this[i][0]=(this[i][0]-n.x)*t/n.width+n.x),n.height&&(this[i][1]=(this[i][1]-n.y)*e/n.height+n.y);return this},bbox(){var t=-1/0,e=-1/0,i=1/0,n=1/0;return this.forEach((function(s){t=Math.max(s[0],t),e=Math.max(s[1],e),i=Math.min(s[0],i),n=Math.min(s[1],n)})),{x:i,y:n,width:t-i,height:e-n}}});const Xt=Ut;var Gt=Object.freeze({__proto__:null,MorphArray:Xt,x:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)},y:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)},width:function(t){const e=this.bbox();return null==t?e.width:this.size(t,e.height)},height:function(t){const e=this.bbox();return null==t?e.height:this.size(e.width,t)}});class Vt extends Lt{constructor(t){super(b("line",t),t)}array(){return new Ut([[this.attr("x1"),this.attr("y1")],[this.attr("x2"),this.attr("y2")]])}plot(t,e,i,n){return null==t?this.array():(t=void 0!==e?{x1:t,y1:e,x2:i,y2:n}:new Ut(t).toLine(),this.attr(t))}move(t,e){return this.attr(this.array().move(t,e).toLine())}size(t,e){var i=l(this,t,e);return this.attr(this.array().size(i.width,i.height).toLine())}}T(Vt,Gt),n({Container:{line:M((function(...t){return Vt.prototype.plot.apply(this.put(new Vt),null!=t[0]?t:[0,0,0,0])}))}}),N(Vt,"Line");class $t extends Pt{constructor(t){super(b("marker",t),t)}width(t){return this.attr("markerWidth",t)}height(t){return this.attr("markerHeight",t)}ref(t,e){return this.attr("refX",t).attr("refY",e)}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}toString(){return"url(#"+this.id()+")"}}function Qt(t,e){return function(i){return null==i?this[i]:(this[t]=i,e&&e.call(this),this)}}n({Container:{marker(...t){return this.defs().marker(...t)}},Defs:{marker:M((function(t,e,i){return this.put(new $t).size(t,e).ref(t/2,e/2).viewbox(0,0,t,e).attr("orient","auto").update(i)}))},marker:{marker(t,e,i,n){var s=["marker"];return"all"!==t&&s.push(t),s=s.join("-"),t=arguments[1]instanceof $t?arguments[1]:this.defs().marker(e,i,n),this.attr(s,t)}}}),N($t,"Marker");const Zt={"-":function(t){return t},"<>":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(t,e,i,n){return function(s){return s<0?t>0?e/t*s:i>0?n/i*s:0:s>1?i<1?(1-n)/(1-i)*s+(n-i)/(1-i):t<1?(1-e)/(1-t)*s+(e-t)/(1-t):1:3*s*(1-s)**2*e+3*s**2*(1-s)*n+s**3}},steps:function(t,e="end"){e=e.split("-").reverse()[0];let i=t;return"none"===e?--i:"both"===e&&++i,(n,s=!1)=>{let r=Math.floor(n*t);const h=n*r%1==0;return"start"!==e&&"both"!==e||++r,s&&h&&--r,n>=0&&r<0&&(r=0),n<=1&&r>i&&(r=i),r/i}}};class Jt{done(){return!1}}class te extends Jt{constructor(t){super(),this.ease=Zt[t||yt]||t}step(t,e,i){return"number"!=typeof t?i<1?t:e:t+(e-t)*this.ease(i)}}class ee extends Jt{constructor(t){super(),this.stepper=t}step(t,e,i,n){return this.stepper(t,e,i,n)}done(t){return t.done}}function ie(){var t=(this._duration||500)/1e3,e=this._overshoot||0,i=Math.PI,n=Math.log(e/100+1e-10),s=-n/Math.sqrt(i*i+n*n),r=3.9/(s*t);this.d=2*s*r,this.k=r*r}T(class extends ee{constructor(t,e){super(),this.duration(t||500).overshoot(e||0)}step(t,e,i,n){if("string"==typeof t)return t;if(n.done=i===1/0,i===1/0)return e;if(0===i)return t;i>100&&(i=16),i/=1e3;var s=n.velocity||0,r=-this.d*s-this.k*(t-e),h=t+s*i+r*i*i/2;return n.velocity=s+r*i,n.done=Math.abs(e-h)+Math.abs(s)<.002,n.done?e:h}},{duration:Qt("_duration",ie),overshoot:Qt("_overshoot",ie)});T(class extends ee{constructor(t,e,i,n){super(),t=null==t?.1:t,e=null==e?.01:e,i=null==i?0:i,n=null==n?1e3:n,this.p(t).i(e).d(i).windup(n)}step(t,e,i,n){if("string"==typeof t)return t;if(n.done=i===1/0,i===1/0)return e;if(0===i)return t;var s=e-t,r=(n.integral||0)+s*i,h=(s-(n.error||0))/i,o=this.windup;return!1!==o&&(r=Math.max(-o,Math.min(r,o))),n.error=s,n.integral=r,n.done=Math.abs(s)<.001,n.done?e:t+(this.P*s+this.I*r+this.D*h)}},{windup:Qt("windup"),p:Qt("P"),i:Qt("I"),d:Qt("D")});const ne=ut("PathArray",_t);function se(t,e,i,n){return i+n.replace(B," .")}const re={M:function(t,e,i){return e.x=i.x=t[0],e.y=i.y=t[1],["M",e.x,e.y]},L:function(t,e){return e.x=t[0],e.y=t[1],["L",t[0],t[1]]},H:function(t,e){return e.x=t[0],["H",t[0]]},V:function(t,e){return e.y=t[0],["V",t[0]]},C:function(t,e){return e.x=t[4],e.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,e){return e.x=t[2],e.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,e){return e.x=t[2],e.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,e){return e.x=t[0],e.y=t[1],["T",t[0],t[1]]},Z:function(t,e,i){return e.x=i.x,e.y=i.y,["Z"]},A:function(t,e){return e.x=t[5],e.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},he="mlhvqtcsaz".split("");for(var oe=0,ae=he.length;oe<ae;++oe)re[he[oe]]=function(t){return function(e,i,n){if("H"===t)e[0]=e[0]+i.x;else if("V"===t)e[0]=e[0]+i.y;else if("A"===t)e[5]=e[5]+i.x,e[6]=e[6]+i.y;else for(var s=0,r=e.length;s<r;++s)e[s]=e[s]+(s%2?i.y:i.x);return re[t](e,i,n)}}(he[oe].toUpperCase());T(ne,{toString(){return function(t){for(var e=0,i=t.length,n="";e<i;e++)n+=t[e][0],null!=t[e][1]&&(n+=t[e][1],null!=t[e][2]&&(n+=" ",n+=t[e][2],null!=t[e][3]&&(n+=" ",n+=t[e][3],n+=" ",n+=t[e][4],null!=t[e][5]&&(n+=" ",n+=t[e][5],n+=" ",n+=t[e][6],null!=t[e][7]&&(n+=" ",n+=t[e][7])))));return n+" "}(this)},move(t,e){var i=this.bbox();if(t-=i.x,e-=i.y,!isNaN(t)&&!isNaN(e))for(var n,s=this.length-1;s>=0;s--)"M"===(n=this[s][0])||"L"===n||"T"===n?(this[s][1]+=t,this[s][2]+=e):"H"===n?this[s][1]+=t:"V"===n?this[s][1]+=e:"C"===n||"S"===n||"Q"===n?(this[s][1]+=t,this[s][2]+=e,this[s][3]+=t,this[s][4]+=e,"C"===n&&(this[s][5]+=t,this[s][6]+=e)):"A"===n&&(this[s][6]+=t,this[s][7]+=e);return this},size(t,e){var i,n,s=this.bbox();for(s.width=0===s.width?1:s.width,s.height=0===s.height?1:s.height,i=this.length-1;i>=0;i--)"M"===(n=this[i][0])||"L"===n||"T"===n?(this[i][1]=(this[i][1]-s.x)*t/s.width+s.x,this[i][2]=(this[i][2]-s.y)*e/s.height+s.y):"H"===n?this[i][1]=(this[i][1]-s.x)*t/s.width+s.x:"V"===n?this[i][1]=(this[i][1]-s.y)*e/s.height+s.y:"C"===n||"S"===n||"Q"===n?(this[i][1]=(this[i][1]-s.x)*t/s.width+s.x,this[i][2]=(this[i][2]-s.y)*e/s.height+s.y,this[i][3]=(this[i][3]-s.x)*t/s.width+s.x,this[i][4]=(this[i][4]-s.y)*e/s.height+s.y,"C"===n&&(this[i][5]=(this[i][5]-s.x)*t/s.width+s.x,this[i][6]=(this[i][6]-s.y)*e/s.height+s.y)):"A"===n&&(this[i][1]=this[i][1]*t/s.width,this[i][2]=this[i][2]*e/s.height,this[i][6]=(this[i][6]-s.x)*t/s.width+s.x,this[i][7]=(this[i][7]-s.y)*e/s.height+s.y);return this},equalCommands(t){var e,i,n;for(t=new ne(t),n=this.length===t.length,e=0,i=this.length;n&&e<i;e++)n=this[e][0]===t[e][0];return n},morph(t){return t=new ne(t),this.equalCommands(t)?this.destination=t:this.destination=null,this},at(t){if(!this.destination)return this;var e,i,n,s,r=this.destination.value,h=[],o=new ne;for(e=0,i=this.length;e<i;e++){for(h[e]=[this[e][0]],n=1,s=this[e].length;n<s;n++)h[e][n]=this[e][n]+(r[e][n]-this[e][n])*t;"A"===h[e][0]&&(h[e][4]=+(0!==h[e][4]),h[e][5]=+(0!==h[e][5]))}return o.value=h,o},parse(t=[["M",0,0]]){if(t instanceof ne)return t;var e,i={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};t="string"==typeof t?t.replace(Y,se).replace(q," $& ").replace(F,"$1 -").trim().split(K):t.reduce((function(t,e){return[].concat.call(t,e)}),[]);var n=[],s=new it,r=new it,h=0,o=t.length;do{W.test(t[h])?(e=t[h],++h):"M"===e?e="L":"m"===e&&(e="l"),n.push(re[e].call(null,t.slice(h,h+=i[e.toUpperCase()]).map(parseFloat),s,r))}while(o>h);return n},bbox(){return rt().path.setAttribute("d",this.toString()),rt.nodes.path.getBBox()}});class ue{constructor(t){this._stepper=t||new te("-"),this._from=null,this._to=null,this._type=null,this._context=null,this._morphObj=null}from(t){return null==t?this._from:(this._from=this._set(t),this)}to(t){return null==t?this._to:(this._to=this._set(t),this)}type(t){return null==t?this._type:(this._type=t,this)}_set(t){if(!this._type){var e=typeof t;"number"===e?this.type(wt):"string"===e?et.isColor(t)?this.type(et):K.test(t)?this.type(q.test(t)?ne:_t):A.test(t)?this.type(wt):this.type(le):fe.indexOf(t.constructor)>-1?this.type(t.constructor):Array.isArray(t)?this.type(_t):"object"===e?this.type(de):this.type(le)}var i=new this._type(t);return this._type===et&&(i=this._to?i[this._to[4]]():this._from?i[this._from[4]]():i),i=i.toArray(),this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(i.length)).map(Object).map((function(t){return t.done=!0,t})),i}stepper(t){return null==t?this._stepper:(this._stepper=t,this)}done(){return this._context.map(this._stepper.done).reduce((function(t,e){return t&&e}),!0)}at(t){var e=this;return this._morphObj.fromArray(this._from.map((function(i,n){return e._stepper.step(i,e._to[n],t,e._context[n],e._context)})))}}class le{constructor(...t){this.init(...t)}init(t){return t=Array.isArray(t)?t[0]:t,this.value=t,this}valueOf(){return this.value}toArray(){return[this.value]}}class ce{constructor(...t){this.init(...t)}init(t){return Array.isArray(t)&&(t={scaleX:t[0],scaleY:t[1],shear:t[2],rotate:t[3],translateX:t[4],translateY:t[5],originX:t[6],originY:t[7]}),Object.assign(this,ce.defaults,t),this}toArray(){var t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}}ce.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0};class de{constructor(...t){this.init(...t)}init(t){if(this.values=[],!Array.isArray(t)){t=t||{};var e=[];for(const i in t)e.push([i,t[i]]);return e.sort((t,e)=>t[0]-e[0]),this.values=e.reduce((t,e)=>t.concat(e),[]),this}this.values=t}valueOf(){for(var t={},e=this.values,i=0,n=e.length;i<n;i+=2)t[e[i]]=e[i+1];return t}toArray(){return this.values}}const fe=[le,ce,de];class pe extends Lt{constructor(t){super(b("path",t),t)}array(){return this._array||(this._array=new ne(this.attr("d")))}plot(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new ne(t))}clear(){return delete this._array,this}move(t,e){return this.attr("d",this.array().move(t,e))}x(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)}y(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}size(t,e){var i=l(this,t,e);return this.attr("d",this.array().size(i.width,i.height))}width(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)}height(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}targets(){return dt('svg textpath [href*="'+this.id()+'"]')}}pe.prototype.MorphArray=ne,n({Container:{path:M((function(t){return this.put(new pe).plot(t||new ne)}))}}),N(pe,"Path");var me=Object.freeze({__proto__:null,array:function(){return this._array||(this._array=new Ut(this.attr("points")))},plot:function(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new Ut(t))},clear:function(){return delete this._array,this},move:function(t,e){return this.attr("points",this.array().move(t,e))},size:function(t,e){const i=l(this,t,e);return this.attr("points",this.array().size(i.width,i.height))}});class ye extends Lt{constructor(t){super(b("polygon",t),t)}}n({Container:{polygon:M((function(t){return this.put(new ye).plot(t||new Ut)}))}}),T(ye,Gt),T(ye,me),N(ye,"Polygon");class ge extends Lt{constructor(t){super(b("polyline",t),t)}}n({Container:{polyline:M((function(t){return this.put(new ge).plot(t||new Ut)}))}}),T(ge,Gt),T(ge,me),N(ge,"Polyline");class ve extends Lt{constructor(t){super(b("rect",t),t)}}T(ve,{rx:St,ry:kt}),n({Container:{rect:M((function(t,e){return this.put(new ve).size(t,e)}))}}),N(ve,"Rect");class _e{constructor(){this._first=null,this._last=null}push(t){var e=t.next?t:{value:t,next:null,prev:null};return this._last?(e.prev=this._last,this._last.next=e,this._last=e):(this._last=e,this._first=e),e}shift(){var t=this._first;return t?(this._first=t.next,this._first&&(this._first.prev=null),this._last=this._first?this._last:null,t.value):null}first(){return this._first&&this._first.value}last(){return this._last&&this._last.value}remove(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t===this._last&&(this._last=t.prev),t===this._first&&(this._first=t.next),t.prev=null,t.next=null}}const we={nextDraw:null,frames:new _e,timeouts:new _e,immediates:new _e,timer:()=>m.window.performance||m.window.Date,transforms:[],frame(t){var e=we.frames.push({run:t});return null===we.nextDraw&&(we.nextDraw=m.window.requestAnimationFrame(we._draw)),e},timeout(t,e){e=e||0;var i=we.timer().now()+e,n=we.timeouts.push({run:t,time:i});return null===we.nextDraw&&(we.nextDraw=m.window.requestAnimationFrame(we._draw)),n},immediate(t){var e=we.immediates.push(t);return null===we.nextDraw&&(we.nextDraw=m.window.requestAnimationFrame(we._draw)),e},cancelFrame(t){null!=t&&we.frames.remove(t)},clearTimeout(t){null!=t&&we.timeouts.remove(t)},cancelImmediate(t){null!=t&&we.immediates.remove(t)},_draw(t){for(var e=null,i=we.timeouts.last();(e=we.timeouts.shift())&&(t>=e.time?e.run():we.timeouts.push(e),e!==i););for(var n=null,s=we.frames.last();n!==s&&(n=we.frames.shift());)n.run(t);for(var r=null;r=we.immediates.shift();)r();we.nextDraw=we.timeouts.first()||we.frames.first()?m.window.requestAnimationFrame(we._draw):null}};var be=function(t){var e=t.start,i=t.runner.duration();return{start:e,duration:i,end:e+i,runner:t.runner}};const xe=function(){const t=m.window;return(t.performance||t.Date).now()};class Oe extends ft{constructor(t=xe){super(),this._timeSource=t,this._startTime=0,this._speed=1,this._persist=0,this._nextFrame=null,this._paused=!0,this._runners=[],this._runnerIds=[],this._lastRunnerId=-1,this._time=0,this._lastSourceTime=0,this._lastStepTime=0,this._step=this._stepFn.bind(this,!1),this._stepImmediate=this._stepFn.bind(this,!0)}schedule(t,e,i){if(null==t)return this._runners.map(be);var n=0,s=this.getEndTime();if(e=e||0,null==i||"last"===i||"after"===i)n=s;else if("absolute"===i||"start"===i)n=e,e=0;else if("now"===i)n=this._time;else{if("relative"!==i)throw new Error('Invalid value for the "when" parameter');{const i=this._runners[t.id];i&&(n=i.start+e,e=0)}}t.unschedule(),t.timeline(this);const r=t.persist(),h={persist:null===r?this._persist:r,start:n+e,runner:t};return this._lastRunnerId=t.id,this._runners.push(h),this._runners.sort((t,e)=>t.start-e.start),this._runnerIds=this._runners.map(t=>t.runner.id),this.updateTime()._continue(),this}unschedule(t){var e=this._runnerIds.indexOf(t.id);return e<0||(this._runners.splice(e,1),this._runnerIds.splice(e,1),t.timeline(null)),this}getEndTime(){var t=this._runners[this._runnerIds.indexOf(this._lastRunnerId)],e=t?t.runner.duration():0;return(t?t.start:0)+e}getEndTimeOfTimeline(){let t=0;for(var e=0;e<this._runners.length;e++){const n=this._runners[e];var i=n?n.runner.duration():0;const s=(n?n.start:0)+i;s>t&&(t=s)}return t}updateTime(){return this.active()||(this._lastSourceTime=this._timeSource()),this}play(){return this._paused=!1,this.updateTime()._continue()}pause(){return this._paused=!0,this._continue()}stop(){return this.time(0),this.pause()}finish(){return this.time(this.getEndTimeOfTimeline()+1),this.pause()}speed(t){return null==t?this._speed:(this._speed=t,this)}reverse(t){var e=this.speed();if(null==t)return this.speed(-e);var i=Math.abs(e);return this.speed(t?i:-i)}seek(t){return this.time(this._time+t)}time(t){return null==t?this._time:(this._time=t,this._continue(!0))}persist(t){return null==t?this._persist:(this._persist=t,this)}source(t){return null==t?this._timeSource:(this._timeSource=t,this)}_stepFn(t=!1){var e=this._timeSource(),i=e-this._lastSourceTime;t&&(i=0);var n=this._speed*i+(this._time-this._lastStepTime);this._lastSourceTime=e,t||(this._time+=n,this._time=this._time<0?0:this._time),this._lastStepTime=this._time,this.fire("time",this._time);for(var s=this._runners.length;s--;){const t=this._runners[s],e=t.runner;this._time-t.start<=0&&e.reset()}for(var r=!1,h=0,o=this._runners.length;h<o;h++){const t=this._runners[h],e=t.runner;let i=n;const s=this._time-t.start;if(s<=0)r=!0;else if(s<i&&(i=s),e.active())if(e.step(i).done){if(!0!==t.persist){e.duration()-e.time()+this._time+t.persist<this._time&&(e.unschedule(),--h,--o)}}else r=!0}return r&&!(this._speed<0&&0===this._time)||this._runnerIds.length&&this._speed<0&&this._time>0?this._continue():(this.pause(),this.fire("finished")),this}_continue(t=!1){return we.cancelFrame(this._nextFrame),this._nextFrame=null,t?this._stepImmediate():(this._paused||(this._nextFrame=we.frame(this._step)),this)}active(){return!!this._nextFrame}}n({Element:{timeline:function(t){return null==t?(this._timeline=this._timeline||new Oe,this._timeline):(this._timeline=t,this)}}});class Ne extends ft{constructor(t){super(),this.id=Ne.id++,t="function"==typeof(t=null==t?mt:t)?new ee(t):t,this._element=null,this._timeline=null,this.done=!1,this._queue=[],this._duration="number"==typeof t&&t,this._isDeclarative=t instanceof ee,this._stepper=this._isDeclarative?t:new te,this._history={},this.enabled=!0,this._time=0,this._lastTime=0,this._reseted=!0,this.transforms=new st,this.transformId=1,this._haveReversed=!1,this._reverse=!1,this._loopsDone=0,this._swing=!1,this._wait=0,this._times=1,this._frameId=null,this._persist=!!this._isDeclarative||null}element(t){return null==t?this._element:(this._element=t,t._prepareRunner(),this)}timeline(t){return void 0===t?this._timeline:(this._timeline=t,this)}animate(t,e,i){var n=Ne.sanitise(t,e,i),s=new Ne(n.duration);return this._timeline&&s.timeline(this._timeline),this._element&&s.element(this._element),s.loop(n).schedule(n.delay,n.when)}schedule(t,e,i){if(t instanceof Oe||(i=e,e=t,t=this.timeline()),!t)throw Error("Runner cannot be scheduled without timeline");return t.schedule(this,e,i),this}unschedule(){var t=this.timeline();return t&&t.unschedule(this),this}loop(t,e,i){return"object"==typeof t&&(e=t.swing,i=t.wait,t=t.times),this._times=t||1/0,this._swing=e||!1,this._wait=i||0,!0===this._times&&(this._times=1/0),this}delay(t){return this.animate(0,t)}queue(t,e,i,n){return this._queue.push({initialiser:t||pt,runner:e||pt,retarget:i,isTransform:n,initialised:!1,finished:!1}),this.timeline()&&this.timeline()._continue(),this}during(t){return this.queue(null,t)}after(t){return this.on("finished",t)}time(t){if(null==t)return this._time;const e=t-this._time;return this.step(e),this}duration(){return this._times*(this._wait+this._duration)-this._wait}loops(t){var e=this._duration+this._wait;if(null==t){var i=Math.floor(this._time/e),n=(this._time-i*e)/this._duration;return Math.min(i+n,this._times)}var s=t%1,r=e*Math.floor(t)+this._duration*s;return this.time(r)}persist(t){return null==t?this._persist:(this._persist=t,this)}position(t){var e,i=this._time,n=this._duration,s=this._wait,r=this._times,h=this._swing,o=this._reverse;if(null==t){const t=function(t){var e=h*Math.floor(t%(2*(s+n))/(s+n)),i=e&&!o||!e&&o,r=Math.pow(-1,i)*(t%(s+n))/n+i;return Math.max(Math.min(r,1),0)};var a=r*(s+n)-s;return e=i<=0?Math.round(t(1e-5)):i<a?t(i):Math.round(t(a-1e-5))}var u=Math.floor(this.loops()),l=h&&u%2==0;return e=u+(l&&!o||o&&l?t:1-t),this.loops(e)}progress(t){return null==t?Math.min(1,this._time/this.duration()):this.time(t*this.duration())}step(t){if(!this.enabled)return this;t=null==t?16:t,this._time+=t;var e=this.position(),i=this._lastPosition!==e&&this._time>=0;this._lastPosition=e;var n=this.duration(),s=this._lastTime<=0&&this._time>0,r=this._lastTime<n&&this._time>=n;this._lastTime=this._time,s&&this.fire("start",this);var h=this._isDeclarative;if(this.done=!h&&!r&&this._time>=n,this._reseted=!1,i||h){this._initialise(i),this.transforms=new st;var o=this._run(h?t:e);this.fire("step",this)}return this.done=this.done||o&&h,r&&this.fire("finished",this),this}reset(){return this._reseted||(this.time(0),this._reseted=!0),this}finish(){return this.step(1/0)}reverse(t){return this._reverse=null==t?!this._reverse:t,this}ease(t){return this._stepper=new te(t),this}active(t){return null==t?this.enabled:(this.enabled=t,this)}_rememberMorpher(t,e){if(this._history[t]={morpher:e,caller:this._queue[this._queue.length-1]},this._isDeclarative){var i=this.timeline();i&&i.play()}}_tryRetarget(t,e,i){if(this._history[t]){if(!this._history[t].caller.initialised){const e=this._queue.indexOf(this._history[t].caller);return this._queue.splice(e,1),!1}this._history[t].caller.retarget?this._history[t].caller.retarget(e,i):this._history[t].morpher.to(e),this._history[t].caller.finished=!1;var n=this.timeline();return n&&n.play(),!0}return!1}_initialise(t){if(t||this._isDeclarative)for(var e=0,i=this._queue.length;e<i;++e){var n=this._queue[e],s=this._isDeclarative||!n.initialised&&t;t=!n.finished,s&&t&&(n.initialiser.call(this),n.initialised=!0)}}_run(t){for(var e=!0,i=0,n=this._queue.length;i<n;++i){var s=this._queue[i],r=s.runner.call(this,t);s.finished=s.finished||!0===r,e=e&&s.finished}return e}addTransform(t,e){return this.transforms.lmultiplyO(t),this}clearTransform(){return this.transforms=new st,this}clearTransformsFromQueue(){this.done&&this._timeline&&this._timeline._runnerIds.includes(this.id)||(this._queue=this._queue.filter(t=>!t.isTransform))}static sanitise(t,e,i){var n=1,s=!1,r=0;return e=e||gt,i=i||"last","object"!=typeof(t=t||mt)||t instanceof Jt||(e=t.delay||e,i=t.when||i,s=t.swing||s,n=t.times||n,r=t.wait||r,t=t.duration||mt),{duration:t,delay:e,swing:s,times:n,wait:r,when:i}}}Ne.id=0;class Se{constructor(t=new st,e=-1,i=!0){this.transforms=t,this.id=e,this.done=i}clearTransformsFromQueue(){}}T([Ne,Se],{mergeWith(t){return new Se(t.transforms.lmultiply(this.transforms),t.id)}});const ke=(t,e)=>t.lmultiplyO(e),Te=t=>t.transforms;function Me(){const t=this._transformationRunners.runners.map(Te).reduce(ke,new st);this.transform(t),this._transformationRunners.merge(),1===this._transformationRunners.length()&&(this._frameId=null)}class Ae{constructor(){this.runners=[],this.ids=[]}add(t){if(this.runners.includes(t))return;const e=t.id+1;return this.runners.push(t),this.ids.push(e),this}getByID(t){return this.runners[this.ids.indexOf(t+1)]}remove(t){const e=this.ids.indexOf(t+1);return this.ids.splice(e,1),this.runners.splice(e,1),this}merge(){let t=null;return this.runners.forEach((e,i)=>{t&&e.done&&t.done&&(!e._timeline||!e._timeline._runnerIds.includes(e.id))&&(!t._timeline||!t._timeline._runnerIds.includes(t.id))&&(this.remove(e.id),this.edit(t.id,e.mergeWith(t))),t=e}),this}edit(t,e){const i=this.ids.indexOf(t+1);return this.ids.splice(i,1,t+1),this.runners.splice(i,1,e),this}length(){return this.ids.length}clearBefore(t){const e=this.ids.indexOf(t+1)||1;return this.ids.splice(0,e,0),this.runners.splice(0,e,new Se).forEach(t=>t.clearTransformsFromQueue()),this}}n({Element:{animate(t,e,i){var n=Ne.sanitise(t,e,i),s=this.timeline();return new Ne(n.duration).loop(n).element(this).timeline(s.play()).schedule(n.delay,n.when)},delay(t,e){return this.animate(0,t,e)},_clearTransformRunnersBefore(t){this._transformationRunners.clearBefore(t.id)},_currentTransform(t){return this._transformationRunners.runners.filter(e=>e.id<=t.id).map(Te).reduce(ke,new st)},_addRunner(t){this._transformationRunners.add(t),we.cancelImmediate(this._frameId),this._frameId=we.immediate(Me.bind(this))},_prepareRunner(){null==this._frameId&&(this._transformationRunners=(new Ae).add(new Se(new st(this))))}}}),T(Ne,{attr(t,e){return this.styleAttr("attr",t,e)},css(t,e){return this.styleAttr("css",t,e)},styleAttr(t,e,i){if("object"==typeof e){for(var n in e)this.styleAttr(t,n,e[n]);return this}var s=new ue(this._stepper).to(i);return this.queue((function(){s=s.from(this.element()[t](e))}),(function(i){return this.element()[t](e,s.at(i)),s.done()})),this},zoom(t,e){if(this._tryRetarget("zoom",qt,e))return this;var i=new ue(this._stepper).to(new wt(t));return this.queue((function(){i=i.from(this.element().zoom())}),(function(t){return this.element().zoom(i.at(t),e),i.done()}),(function(t,n){e=n,i.to(t)})),this._rememberMorpher("zoom",i),this},transform(t,e,i){if(e=t.relative||e,this._isDeclarative&&!e&&this._tryRetarget("transform",t))return this;var n=st.isMatrixLike(t);i=null!=t.affine?t.affine:null!=i?i:!n;const s=new ue(this._stepper).type(i?ce:st);let r,h,o,a,u;return this.queue((function(){h=h||this.element(),r=r||c(t,h),u=new st(e?void 0:h),h._addRunner(this),e||h._clearTransformRunnersBefore(this)}),(function(l){e||this.clearTransform();const{x:c,y:d}=new it(r).transform(h._currentTransform(this));let f=new st({...t,origin:[c,d]}),p=this._isDeclarative&&o?o:u;if(i){f=f.decompose(c,d),p=p.decompose(c,d);const t=f.rotate,e=p.rotate,i=[t-360,t,t+360],n=i.map(t=>Math.abs(t-e)),s=Math.min(...n),r=n.indexOf(s);f.rotate=i[r]}e&&(n||(f.rotate=t.rotate||0),this._isDeclarative&&a&&(p.rotate=a)),s.from(p),s.to(f);const m=s.at(l);return a=m.rotate,o=new st(m),this.addTransform(o),h._addRunner(this),s.done()}),(function(e){(e.origin||"center").toString()!==(t.origin||"center").toString()&&(r=c(t,h)),t={...e,origin:r}}),!0),this._isDeclarative&&this._rememberMorpher("transform",s),this},x(t,e){return this._queueNumber("x",t)},y(t){return this._queueNumber("y",t)},dx(t=0){return this._queueNumberDelta("x",t)},dy(t=0){return this._queueNumberDelta("y",t)},dmove(t,e){return this.dx(t).dy(e)},_queueNumberDelta(t,e){if(e=new wt(e),this._tryRetarget(t,e))return this;var i=new ue(this._stepper).to(e),n=null;return this.queue((function(){n=this.element()[t](),i.from(n),i.to(n+e)}),(function(e){return this.element()[t](i.at(e)),i.done()}),(function(t){i.to(n+new wt(t))})),this._rememberMorpher(t,i),this},_queueObject(t,e){if(this._tryRetarget(t,e))return this;var i=new ue(this._stepper).to(e);return this.queue((function(){i.from(this.element()[t]())}),(function(e){return this.element()[t](i.at(e)),i.done()})),this._rememberMorpher(t,i),this},_queueNumber(t,e){return this._queueObject(t,new wt(e))},cx(t){return this._queueNumber("cx",t)},cy(t){return this._queueNumber("cy",t)},move(t,e){return this.x(t).y(e)},center(t,e){return this.cx(t).cy(e)},size(t,e){var i;return t&&e||(i=this._element.bbox()),t||(t=i.width/i.height*e),e||(e=i.height/i.width*t),this.width(t).height(e)},width(t){return this._queueNumber("width",t)},height(t){return this._queueNumber("height",t)},plot(t,e,i,n){if(4===arguments.length)return this.plot([t,e,i,n]);if(this._tryRetarget("plot",t))return this;var s=new ue(this._stepper).type(this._element.MorphArray).to(t);return this.queue((function(){s.from(this._element.array())}),(function(t){return this._element.plot(s.at(t)),s.done()})),this._rememberMorpher("plot",s),this},leading(t){return this._queueNumber("leading",t)},viewbox(t,e,i,n){return this._queueObject("viewbox",new ot(t,e,i,n))},update(t){return"object"!=typeof t?this.update({offset:arguments[0],color:arguments[1],opacity:arguments[2]}):(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",t.offset),this)}}),T(Ne,{rx:St,ry:kt,from:Ft,to:qt}),N(Ne,"Runner");class Ce extends Pt{constructor(t){super(b("svg",t),t),this.namespace()}isRoot(){return!(this.node.parentNode&&this.node.parentNode instanceof m.window.SVGElement&&"#document"!==this.node.parentNode.nodeName)}root(){return this.isRoot()?this:super.root()}namespace(){return this.isRoot()?this.attr({xmlns:d,version:"1.1"}).attr("xmlns:xlink",p,f).attr("xmlns:svgjs","http://svgjs.com/svgjs",f):this.root().namespace()}defs(){return this.isRoot()?x(this.node.querySelector("defs"))||this.put(new zt):this.root().defs()}parent(t){return this.isRoot()?"#document"===this.node.parentNode.nodeName?null:x(this.node.parentNode):super.parent(t)}clear(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return delete this._defs,this}}n({Container:{nested:M((function(){return this.put(new Ce)}))}}),N(Ce,"Svg",!0);class Ee extends Pt{constructor(t){super(b("symbol",t),t)}}n({Container:{symbol:M((function(){return this.put(new Ee)}))}}),N(Ee,"Symbol");var Ie=Object.freeze({__proto__:null,plain:function(t){return!1===this._build&&this.clear(),this.node.appendChild(m.document.createTextNode(t)),this},length:function(){return this.node.getComputedTextLength()}});class je extends Lt{constructor(t){super(b("text",t),t),this.dom.leading=new wt(1.3),this._rebuild=!0,this._build=!1}x(t,e=this.bbox()){return null==t?e.x:this.attr("x",this.attr("x")+t-e.x)}y(t,e=this.bbox()){return null==t?e.y:this.attr("y",this.attr("y")+t-e.y)}move(t,e,i=this.bbox()){return this.x(t,i).y(e,i)}cx(t,e=this.bbox()){return null==t?e.cx:this.attr("x",this.attr("x")+t-e.cx)}cy(t,e=this.bbox()){return null==t?e.cy:this.attr("y",this.attr("y")+t-e.cy)}center(t,e,i=this.bbox()){return this.cx(t,i).cy(e,i)}text(t){if(void 0===t){var e=this.node.childNodes,i=0;t="";for(var n=0,s=e.length;n<s;++n)"textPath"!==e[n].nodeName?(n!==i&&3!==e[n].nodeType&&!0===x(e[n]).dom.newLined&&(t+="\n"),t+=e[n].textContent):0===n&&(i=1);return t}if(this.clear().build(!0),"function"==typeof t)t.call(this,this);else for(var r=0,h=(t=t.split("\n")).length;r<h;r++)this.tspan(t[r]).newLine();return this.build(!1).rebuild()}leading(t){return null==t?this.dom.leading:(this.dom.leading=new wt(t),this.rebuild())}rebuild(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){var e=this,i=0,n=this.dom.leading;this.each((function(){var t=m.window.getComputedStyle(this.node).getPropertyValue("font-size"),s=n*new wt(t);this.dom.newLined&&(this.attr("x",e.attr("x")),"\n"===this.text()?i+=s:(this.attr("dy",s+i),i=0))})),this.fire("rebuild")}return this}build(t){return this._build=!!t,this}setData(t){return this.dom=t,this.dom.leading=new wt(t.leading||1.3),this}}T(je,Ie),n({Container:{text:M((function(t){return this.put(new je).text(t)})),plain:M((function(t){return this.put(new je).plain(t)}))}}),N(je,"Text");class He extends je{constructor(t){super(b("tspan",t),t)}text(t){return null==t?this.node.textContent+(this.dom.newLined?"\n":""):("function"==typeof t?t.call(this,this):this.plain(t),this)}dx(t){return this.attr("dx",t)}dy(t){return this.attr("dy",t)}x(t){return this.attr("x",t)}y(t){return this.attr("x",t)}move(t,e){return this.x(t).y(e)}newLine(){var t=this.parent(je);this.dom.newLined=!0;var e=m.window.getComputedStyle(this.node).getPropertyValue("font-size"),i=t.dom.leading*new wt(e);return this.dy(i).attr("x",t.x())}}T(He,Ie),n({Tspan:{tspan:M((function(t){var e=new He;return this._build||this.clear(),this.node.appendChild(e.node),e.text(t)}))}}),N(He,"Tspan");class Le extends Pt{constructor(t){super(b("clipPath",t),t)}remove(){return this.targets().forEach((function(t){t.unclip()})),super.remove()}targets(){return dt('svg [clip-path*="'+this.id()+'"]')}}n({Container:{clip:M((function(){return this.defs().put(new Le)}))},Element:{clipWith(t){const e=t instanceof Le?t:this.parent().clip().add(t);return this.attr("clip-path",'url("#'+e.id()+'")')},unclip(){return this.attr("clip-path",null)},clipper(){return this.reference("clip-path")}}}),N(Le,"ClipPath");class De extends Ot{constructor(t){super(b("foreignObject",t),t)}}n({Container:{foreignObject:M((function(t,e){return this.put(new De).size(t,e)}))}}),N(De,"ForeignObject");class Pe extends Pt{constructor(t){super(b("g",t),t)}x(t,e=this.bbox()){return null==t?e.x:this.move(t,e.y,e)}y(t,e=this.bbox()){return null==t?e.y:this.move(e.x,t,e)}move(t=0,e=0,i=this.bbox()){const n=t-i.x,s=e-i.y;return this.dmove(n,s)}dx(t){return this.dmove(t,0)}dy(t){return this.dmove(0,t)}dmove(t,e){return this.children().forEach((i,n)=>{const s=i.bbox(),r=new st(i),h=r.translate(t,e).transform(r.inverse()),o=new it(s.x,s.y).transform(h);i.move(o.x,o.y)}),this}width(t,e=this.bbox()){return null==t?e.width:this.size(t,e.height,e)}height(t,e=this.bbox()){return null==t?e.height:this.size(e.width,t,e)}size(t,e,i=this.bbox()){const n=l(this,t,e,i),s=n.width/i.width,r=n.height/i.height;return this.children().forEach((t,e)=>{const n=new it(i).transform(new st(t).inverse());t.scale(s,r,n.x,n.y)}),this}}n({Container:{group:M((function(){return this.put(new Pe)}))}}),N(Pe,"G");class ze extends Pt{constructor(t){super(b("a",t),t)}to(t){return this.attr("href",t,p)}target(t){return this.attr("target",t)}}n({Container:{link:M((function(t){return this.put(new ze).to(t)}))},Element:{linkTo:function(t){var e=new ze;return"function"==typeof t?t.call(e,e):e.to(t),this.parent().put(e).put(this)}}}),N(ze,"A");class Re extends Pt{constructor(t){super(b("mask",t),t)}remove(){return this.targets().forEach((function(t){t.unmask()})),super.remove()}targets(){return dt('svg [mask*="'+this.id()+'"]')}}n({Container:{mask:M((function(){return this.defs().put(new Re)}))},Element:{maskWith(t){var e=t instanceof Re?t:this.parent().mask().add(t);return this.attr("mask",'url("#'+e.id()+'")')},unmask(){return this.attr("mask",null)},masker(){return this.reference("mask")}}}),N(Re,"Mask");class Ke extends Ot{constructor(t){super(b("style",t),t)}addText(t=""){return this.node.textContent+=t,this}font(t,e,i={}){return this.rule("@font-face",{fontFamily:t,src:e,...i})}rule(t,e){return this.addText(function(t,e){if(!t)return"";if(!e)return t;var i=t+"{";for(var n in e)i+=n.replace(/([A-Z])/g,(function(t,e){return"-"+e.toLowerCase()}))+":"+e[n]+";";return i+="}"}(t,e))}}n("Dom",{style:M((function(t,e){return this.put(new Ke).rule(t,e)})),fontface:M((function(t,e,i){return this.put(new Ke).font(t,e,i)}))}),N(Ke,"Style");class Fe extends je{constructor(t){super(b("textPath",t),t)}array(){var t=this.track();return t?t.array():null}plot(t){var e=this.track(),i=null;return e&&(i=e.plot(t)),null==t?i:this}track(){return this.reference("href")}}n({Container:{textPath:M((function(t,e){return t instanceof je||(t=this.text(t)),t.path(e)}))},Text:{path:M((function(t,e=!0){var i=new Fe;let n;if(t instanceof pe||(t=this.defs().path(t)),i.attr("href","#"+t,p),e)for(;n=this.node.firstChild;)i.node.appendChild(n);return this.put(i)})),textPath(){return this.findOne("textPath")}},Path:{text:M((function(t){return t instanceof je||(t=(new je).addTo(this.parent()).text(t)),t.path(this)})),targets(){return dt('svg [href*="'+this.id()+'"]')}}}),Fe.prototype.MorphArray=ne,N(Fe,"TextPath");class qe extends Lt{constructor(t){super(b("use",t),t)}element(t,e){return this.attr("href",(e||"")+"#"+t,p)}}n({Container:{use:M((function(t,e){return this.put(new qe).element(t,e)}))}}),N(qe,"Use");const We=w;T([Ce,Ee,Bt,Yt,$t],s("viewbox")),T([Vt,ge,ye,pe],s("marker")),T(je,s("Text")),T(pe,s("Path")),T(zt,s("Defs")),T([je,He],s("Tspan")),T([ve,Rt,Dt,Wt],s("radius")),T(ft,s("EventTarget")),T(xt,s("Dom")),T(Ot,s("Element")),T(Lt,s("Shape")),T(Pt,s("Container")),T(Ne,s("Runner")),lt.extend([...new Set(i)]),function(t=[]){fe.push(...[].concat(t))}([wt,et,ot,st,_t,Ut,ne]),T(fe,{to(t){return(new ue).type(this.constructor).from(this.valueOf()).to(t)},fromArray(t){return this.init(t),this}});
/*! *****************************************************************************
  Copyright (c) Microsoft Corporation. All rights reserved.
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  this file except in compliance with the License. You may obtain a copy of the
  License at http://www.apache.org/licenses/LICENSE-2.0

  THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  MERCHANTABLITY OR NON-INFRINGEMENT.

  See the Apache Version 2.0 License for specific language governing permissions
  and limitations under the License.
  ***************************************************************************** */
var Ye=function(t,e){return(Ye=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};function Be(t,e){function i(){this.constructor=t}Ye(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var Ue=function(){function t(t){if("string"==typeof t){if(!(t.length>0))throw"Can't parse this note";if(this.note=t[0].toUpperCase(),t.length>1){var e=t.substr(1);["#","b"].indexOf(t[1])>-1&&(t.length>2&&t[1]===t[2]?this.accidental=t.substr(1,2):this.accidental=t[1],e=t.substr(this.accidental.toString().length+1)),e.length>0&&(this.octave=Number.parseInt(e))}}else this.note=t.note,this.accidental=t.accidental,this.octave=t.octave;this.toString=this.toString.bind(this)}return Object.defineProperty(t.prototype,"baseNote",{get:function(){var t,e=this,i=[{note:"C"},{note:"C",accidental:"#"},{note:"D"},{note:"D",accidental:"#"},{note:"E"},{note:"F"},{note:"F",accidental:"#"},{note:"G"},{note:"G",accidental:"#"},{note:"A"},{note:"A",accidental:"#"},{note:"B"}],n=i.findIndex((function(t){return t.note===e.note&&t.accidental===e.accidental}));if(n>-1)t={note:i[n].note,accidental:i[n].accidental,octave:this.octave};else{switch(n=i.findIndex((function(t){return t.note===e.note&&void 0===t.accidental})),this.accidental){case"#":n+=1;break;case"##":n+=2;break;case"b":n-=1;break;case"bb":n-=2}var s=0;n<0?(n+=12,s=-1):n>11&&(n-=12,s=1),t={note:i[n].note,accidental:i[n].accidental,octave:void 0!==this.octave?this.octave+s:void 0}}return t},enumerable:!0,configurable:!0}),t.prototype.toString=function(){var t=this.note.toString();return void 0!==this.accidental&&(t+=this.accidental.toString()),void 0!==this.octave&&(t+=this.octave.toString()),t},t}(),Xe=function(){function t(){}return t.WHITE_KEY_RATIO=6.4,t.BLACK_KEY_RATIO=6.6,t.WHITE_BLACK_WIDTH_RATIO=1.7,t.NOTE_LIST=["C","D","E","F","G","A","B"],t.BLACK_BASE_NOTE_LIST=["C","D","F","G","A"],t}(),Ge=function(){function t(t,e,i,n){this.container=t,this.onKeyPress=i,this.onKeyRelease=n,this.instrumentSettings=e}return Object.defineProperty(t.prototype,"boxWidth",{get:function(){return this.container.bbox().width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"boxHeight",{get:function(){return this.container.bbox().height},enumerable:!0,configurable:!0}),t.prototype.move=function(t,e){this.container.untransform(),this.container.translate(t,e)},t.prototype.setInstrumentSettings=function(t){this.instrumentSettings=t},t}(),Ve=function(t){function e(e,i,n,s,r,h,o){var a=t.call(this,e,i,n,s)||this;return a.highlightSize=1,a.isPressed=!1,a.isMouseDown=!1,a.width=r,a.height=h,a._note=o,a._displayNote=o,a.addMouseListeners=a.addMouseListeners.bind(a),a.handleInputDown=a.handleInputDown.bind(a),a.handleInputUp=a.handleInputUp.bind(a),a}return Be(e,t),Object.defineProperty(e.prototype,"note",{get:function(){return this._note},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"displayNote",{get:function(){return this.isHighlighted?this.getNoteIfHighlighted(function(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;var n=Array(t),s=0;for(e=0;e<i;e++)for(var r=arguments[e],h=0,o=r.length;h<o;h++,s++)n[s]=r[h];return n}(this.instrumentSettings.highlightedNotes,this.instrumentSettings.specialHighlightedNotes)):this._displayNote},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isHighlighted",{get:function(){return void 0!==this.getNoteIfHighlighted(this.instrumentSettings.highlightedNotes)||this.isSpecialHighlighted},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isSpecialHighlighted",{get:function(){return void 0!==this.getNoteIfHighlighted(this.instrumentSettings.specialHighlightedNotes)},enumerable:!0,configurable:!0}),e.prototype.addMouseListeners=function(){void 0!==this._visual&&(this._visual.on("mousedown",this.handleInputDown),this._visual.on("mouseup",this.handleInputUp),this._visual.on("mouseleave",this.handleInputUp),this._visual.on("touchstart",this.handleInputDown),this._visual.on("touchend",this.handleInputUp))},e.prototype.handleInputDown=function(){this.isMouseDown=!0,void 0!==this.onKeyPress&&this.onKeyPress(this.note)},e.prototype.handleInputUp=function(){this.isMouseDown&&(this.isMouseDown=!1,void 0!==this.onKeyRelease&&this.onKeyRelease(this.note))},e.prototype.press=function(t){this.isPressed=!0,this._displayNote=t,this._label&&"onpress"===this.instrumentSettings.showNoteNames&&(this.updateLabel(),this._label.show())},e.prototype.release=function(){this.isPressed=!1,this._label&&"onpress"===this.instrumentSettings.showNoteNames&&this._label.hide()},e.prototype.backward=function(){this.container.backward()},e.prototype.accidentalToUnicode=function(t){return t.toString().replace(/#/g,"♯").replace(/b/g,"♭")},e.prototype.createLabel=function(t){this._label=this.container.group(),this._labelText=this._label.text(""+this.displayNote.note+(this.displayNote.accidental?this.accidentalToUnicode(this.displayNote.accidental):"")).fill(t).font({family:"Helvetica",size:this.width/2,anchor:"middle"}),this._label.attr("pointer-events","none"),this.layout(),"always"!==this.instrumentSettings.showNoteNames&&this._label.hide()},e.prototype.updateLabel=function(){this._labelText&&(this._labelText.text(""+this.displayNote.note+(this.displayNote.accidental?this.accidentalToUnicode(this.displayNote.accidental):"")),this.layout())},e.prototype.createHighlight=function(t){this.highlightSize=t,this._highlight=this.container.circle(this.highlightSize),this._highlight.center(.5,.5),this._highlight.attr("pointer-events","none");var e=this.instrumentSettings.highlightColor,i=this.instrumentSettings.specialHighlightColor,n=this.container.gradient("radial",(function(t){t.stop(0,"#fff"),t.stop(1,e)}));n.attr({cx:.4,cy:.4});var s=this.container.gradient("radial",(function(t){t.stop(0,"#fff"),t.stop(1,i)}));s.attr({cx:.4,cy:.4}),this._highlight.fill(this.isSpecialHighlighted?s:n),this.layout()},e.prototype.layout=function(){var t,e,i;null===(t=this._visual)||void 0===t||t.size(this.width,this.height),this._label&&this._labelText&&(this._labelText.font({size:this.width/2}),null===(e=this._label)||void 0===e||e.untransform(),null===(i=this._label)||void 0===i||i.translate(this.width/2,this.height-2*this._labelText.bbox().height),"onhighlight"===this.instrumentSettings.showNoteNames&&(this.isHighlighted?this._label.show():this._label.hide())),this._highlight&&(this._highlight.radius(this.highlightSize).untransform().translate(this.width/2,4*this.highlightSize),this.isHighlighted?this._highlight.show():this._highlight.hide())},e.prototype.getNoteIfHighlighted=function(t){var e=void 0!==this.note.baseNote?this.note.baseNote:this.note;return t.find((function(t){var i=void 0!==t.baseNote?t.baseNote:t;return i.note===e.note&&i.accidental===e.accidental&&(i.octave===e.octave||void 0===i.octave)}))},e}(Ge),$e=function(t){function e(e,i,n,s,r,h){return t.call(this,e,i,n,s,h,h*Xe.WHITE_KEY_RATIO,r)||this}return Be(e,t),e.prototype.create=function(){this._visual=this.container.rect(this.width,this.height).fill("#fff").stroke({color:"#000",width:2}),this.createLabel("#000"),this.createHighlight(this.width/Xe.WHITE_BLACK_WIDTH_RATIO/8),this.addMouseListeners()},e.prototype.resize=function(t){this.width=t,this.height=t*Xe.WHITE_KEY_RATIO,this.layout()},e.prototype.press=function(e){var i,n;"subtle"===this.instrumentSettings.keyPressStyle?(n=this.container.gradient("linear",(function(t){t.stop(0,"#fff"),t.stop(1,"#e8e8e8")}))).attr({x1:0,y1:0,x2:0,y2:1}):n=this.instrumentSettings.vividKeyPressColor,this.isPressed||(t.prototype.press.call(this,e),null===(i=this._visual)||void 0===i||i.fill(n).transform({origin:{x:this.width/2,y:0},skewX:.3}))},e.prototype.release=function(){var e;this.isPressed&&(t.prototype.release.call(this),null===(e=this._visual)||void 0===e||e.fill("#fff").untransform())},e}(Ve),Qe=function(t){function e(e,i,n,s,r,h,o){var a=t.call(this,e,i,n,s,o,o*Xe.BLACK_KEY_RATIO,r)||this;return a._baseWhiteKey=h,a}return Be(e,t),Object.defineProperty(e.prototype,"baseWhiteKey",{get:function(){return this._baseWhiteKey},enumerable:!0,configurable:!0}),e.prototype.create=function(){this._visual=this.container.rect(this.width,this.height).fill("#000").stroke({color:"#000",width:2}),this.createLabel("#fff"),this.createHighlight(this.width/8),this.addMouseListeners()},e.prototype.resize=function(t){this.width=t,this.height=t*Xe.BLACK_KEY_RATIO,this.layout()},e.prototype.press=function(e){var i,n;"subtle"===this.instrumentSettings.keyPressStyle?(n=this.container.gradient("linear",(function(t){t.stop(0,"#000"),t.stop(1,"#555")}))).attr({x1:0,y1:0,x2:0,y2:1}):(n=(n=new et(this.instrumentSettings.vividKeyPressColor)).hsl()).l/=1.2,this.isPressed||(t.prototype.press.call(this,e),null===(i=this._visual)||void 0===i||i.fill(n))},e.prototype.release=function(){var e;this.isPressed&&(t.prototype.release.call(this),null===(e=this._visual)||void 0===e||e.fill("#000"))},e}(Ve),Ze=function(t){function e(e,i,n,s,r,h,o,a){var u=t.call(this,e,i,n,s)||this;return u.whiteKeys=[],u.blackKeys=[],u.LABEL_SIZE_RATIO=30,u.container=e,u._octave=r,u.startNote=h,u.endNote=o,u.whiteKeyWidth=a,u.whiteKeyHeight=u.whiteKeyWidth*Xe.WHITE_KEY_RATIO,u}return Be(e,t),Object.defineProperty(e.prototype,"octave",{get:function(){return this._octave},enumerable:!0,configurable:!0}),e.prototype.create=function(){for(var t=!1,e=Xe.NOTE_LIST.indexOf(this.startNote);e<=Xe.NOTE_LIST.indexOf(this.endNote);e++){var i=Xe.NOTE_LIST[e],n=new $e(this.container.group(),this.instrumentSettings,this.onKeyPress,this.onKeyRelease,new Ue({note:i,octave:this._octave}),this.whiteKeyWidth);if(n.create(),this.whiteKeys.push(n),t&&n.backward(),t=!1,Xe.BLACK_BASE_NOTE_LIST.indexOf(i)>-1&&(i!==this.endNote||"B"===this.endNote)){var s=new Qe(this.container.group(),this.instrumentSettings,this.onKeyPress,this.onKeyRelease,new Ue({note:i,accidental:"#",octave:this._octave}),n,this.whiteKeyWidth/Xe.WHITE_BLACK_WIDTH_RATIO);s.create(),this.blackKeys.push(s),t=!0}}this.createOctaveNumberLabel()},e.prototype.layout=function(t){var e,i,n=this;this.whiteKeyWidth=t,this.whiteKeyHeight=this.whiteKeyWidth*Xe.WHITE_KEY_RATIO;var s=0;this.whiteKeys.forEach((function(t){t.resize(n.whiteKeyWidth),t.move(s,0),s+=t.boxWidth;var e=n.blackKeys.find((function(e){return e.baseWhiteKey===t}));e&&(e.resize(n.whiteKeyWidth/Xe.WHITE_BLACK_WIDTH_RATIO),e.move(s-e.boxWidth/2,0))})),this._label&&this._labelText&&(this._labelText.font({size:this.whiteKeyHeight/this.LABEL_SIZE_RATIO}),null===(e=this._label)||void 0===e||e.untransform(),null===(i=this._label)||void 0===i||i.translate(this.whiteKeyHeight/this.LABEL_SIZE_RATIO/2,this.whiteKeyHeight-1.5*this._labelText.bbox().height),this.instrumentSettings.showOctaveNumbers?this._label.show():this._label.hide())},Object.defineProperty(e.prototype,"numberOfWhiteKeys",{get:function(){return Xe.NOTE_LIST.indexOf(this.endNote)-Xe.NOTE_LIST.indexOf(this.startNote)+1},enumerable:!0,configurable:!0}),e.prototype.keyDown=function(t){var e=new Ue(t).baseNote;if(void 0===e.accidental)(i=this.whiteKeys.find((function(t){return t.note.note===e.note})))&&i.press(t);else if("#"===e.accidental){var i;(i=this.blackKeys.find((function(t){return t.note.note===e.note})))&&i.press(t)}},e.prototype.keyUp=function(t){var e=new Ue(t).baseNote;if(void 0===e.accidental)(i=this.whiteKeys.find((function(t){return t.note.note===e.note})))&&i.release();else if("#"===e.accidental){var i;(i=this.blackKeys.find((function(t){return t.note.note===e.note})))&&i.release()}},e.prototype.setInstrumentSettings=function(e){t.prototype.setInstrumentSettings.call(this,e),this.whiteKeys.forEach((function(t){return t.setInstrumentSettings(e)})),this.blackKeys.forEach((function(t){return t.setInstrumentSettings(e)}))},e.prototype.createOctaveNumberLabel=function(){this._label=this.container.group(),this._labelText=this._label.text(""+this.octave).fill("#000").font({family:"Helvetica",size:this.whiteKeyHeight/this.LABEL_SIZE_RATIO,anchor:"left"}),this._label.attr("pointer-events","none")},e}(Ge),Je=function(t){function e(e,i,n,s,r,h){var o=t.call(this,e,h,i,n)||this;return o.octaves=[],o.availableWidth=s,o.availableHeight=r,o.instrumentSettings=h,o}return Be(e,t),e.prototype.create=function(){for(var t=this.instrumentSettings.startOctave;t<=this.instrumentSettings.endOctave;t++){var e=new Ze(this.container.group(),this.instrumentSettings,this.onKeyPress,this.onKeyRelease,t,t===this.instrumentSettings.startOctave?this.instrumentSettings.startNote:"C",t===this.instrumentSettings.endOctave?this.instrumentSettings.endNote:"B",this.whiteKeyWidth);e.create(),this.octaves.push(e)}},e.prototype.layout=function(t,e){var i=this;this.availableWidth=t,this.availableHeight=e;var n=0;this.octaves.forEach((function(t){t.layout(i.whiteKeyWidth),t.move(n,0),n+=t.boxWidth}))},Object.defineProperty(e.prototype,"numberOfWhiteKeys",{get:function(){for(var t=0,e=Xe.NOTE_LIST,i=this.instrumentSettings.startOctave;i<=this.instrumentSettings.endOctave;i++)i===this.instrumentSettings.startOctave?this.instrumentSettings.endOctave>this.instrumentSettings.startOctave?t+=7-e.indexOf(this.instrumentSettings.startNote):t=e.indexOf(this.instrumentSettings.endNote)-e.indexOf(this.instrumentSettings.startNote)+1:i===this.instrumentSettings.endOctave?t+=e.indexOf(this.instrumentSettings.endNote)+1:t+=7;return t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"whiteKeyWidth",{get:function(){var t=this.availableWidth/this.numberOfWhiteKeys;return t*Xe.WHITE_KEY_RATIO<=this.availableHeight?t:this.availableHeight/Xe.WHITE_KEY_RATIO},enumerable:!0,configurable:!0}),e.prototype.keyDown=function(t){if(this.octaves.length>0&&void 0!==t.octave){var e=new Ue(t),i=this.octaves.find((function(t){return t.octave===e.baseNote.octave}));i&&i.keyDown(t)}},e.prototype.keyUp=function(t){if(this.octaves.length>0&&void 0!==t.octave){var e=this.octaves.find((function(e){return e.octave===t.octave}));e&&e.keyUp(t)}},e.prototype.setInstrumentSettings=function(e){t.prototype.setInstrumentSettings.call(this,e),this.octaves.forEach((function(t){return t.setInstrumentSettings(e)}))},e}(Ge),ti=function(){function t(t){this.startOctave=2,this.startNote="C",this.endOctave=6,this.endNote="C",this.showNoteNames="onpress",this.highlightedNotes=[],this.highlightColor="#0c0",this.specialHighlightedNotes=[],this.specialHighlightColor="#f00",this.showOctaveNumbers=!1,this.keyPressStyle="subtle",this.vividKeyPressColor="#f33",this._reloadNeeded=!1,this.applySettings(t)}return Object.defineProperty(t.prototype,"reloadNeded",{get:function(){return this._reloadNeeded},enumerable:!0,configurable:!0}),t.prototype.applySettings=function(t){var e=this;this._reloadNeeded=!1,void 0!==t&&(void 0!==t.startOctave&&(this.startOctave=t.startOctave,this._reloadNeeded=!0),void 0!==t.startNote&&(this.startNote=t.startNote,this._reloadNeeded=!0),void 0!==t.endOctave&&(this.endOctave=t.endOctave,this._reloadNeeded=!0),void 0!==t.endNote&&(this.endNote=t.endNote,this._reloadNeeded=!0),void 0!==t.showNoteNames&&(this.showNoteNames=t.showNoteNames,this._reloadNeeded=!0),void 0!==t.highlightedNotes&&(this.highlightedNotes.splice(0),t.highlightedNotes.forEach((function(t){return e.highlightedNotes.push(new Ue(t))}))),void 0!==t.highlightColor&&(this.highlightColor=t.highlightColor),void 0!==t.specialHighlightedNotes&&(this.specialHighlightedNotes.splice(0),t.specialHighlightedNotes.forEach((function(t){return e.specialHighlightedNotes.push(new Ue(t))}))),void 0!==t.specialHighlightColor&&(this.specialHighlightColor=t.specialHighlightColor),void 0!==t.showOctaveNumbers&&(this.showOctaveNumbers=t.showOctaveNumbers),void 0!==t.keyPressStyle&&(this.keyPressStyle=t.keyPressStyle),void 0!==t.vividKeyPressColor&&(this.vividKeyPressColor=t.vividKeyPressColor))},t}(),ei=function(){function t(t,e){this.keyPressEventHandlers=[],this.keyReleaseEventHandlers=[],this.resizeCounter=0,this.container=t,this.settings=new ti(e),this.create=this.create.bind(this),this.layout=this.layout.bind(this),this.keyDown=this.keyDown.bind(this),this.keyUp=this.keyUp.bind(this),this.destroy=this.destroy.bind(this),this.handleMouseKeyDown=this.handleMouseKeyDown.bind(this),this.handleMouseKeyUp=this.handleMouseKeyUp.bind(this),this.handleResize=this.handleResize.bind(this),this.reload=this.reload.bind(this)}return t.prototype.create=function(){this.img=We().addTo(this.container).size("100%","100%"),this.img.css("-ms-user-select","none"),this.img.css("-webkit-user-select","none"),this.img.css("-moz-user-select","none"),this.img.css("user-select","none"),this.keybed=new Je(this.img.group(),this.handleMouseKeyDown,this.handleMouseKeyUp,this.container.clientWidth,this.container.clientHeight,this.settings),this.keybed.create(),this.layout(),window.addEventListener("resize",this.handleResize)},t.prototype.destroy=function(){this.container.removeChild(this.img.node),window.removeEventListener("resize",this.handleResize)},t.prototype.keyDown=function(t){this.keybed&&this.keybed.keyDown(new Ue(t))},t.prototype.keyUp=function(t){this.keybed&&this.keybed.keyUp(new Ue(t))},t.prototype.addKeyMouseDownListener=function(t){this.keyPressEventHandlers.push(t)},t.prototype.addKeyMouseUpListener=function(t){this.keyReleaseEventHandlers.push(t)},t.prototype.removeKeyMouseDownListener=function(t){void 0!==t?this.keyPressEventHandlers.indexOf(t)>-1&&this.keyPressEventHandlers.splice(this.keyPressEventHandlers.indexOf(t),1):this.keyPressEventHandlers.splice(0)},t.prototype.removeKeyMouseUpListener=function(t){void 0!==t?this.keyReleaseEventHandlers.indexOf(t)>-1&&this.keyReleaseEventHandlers.splice(this.keyReleaseEventHandlers.indexOf(t),1):this.keyReleaseEventHandlers.splice(0)},t.prototype.reload=function(){this.destroy(),this.create()},t.prototype.applySettings=function(t){this.settings.applySettings(t),this.settings.reloadNeded?this.reload():(this.keybed&&this.keybed.setInstrumentSettings(this.settings),this.layout())},t.prototype.handleResize=function(){var t=this;this.resizeCounter++,setTimeout((function(){t.resizeCounter--,t.resizeCounter<=0&&t.layout()}),300)},t.prototype.layout=function(){this.img&&this.keybed&&(this.img.size("100%","100%"),this.keybed.layout(this.container.clientWidth,this.container.clientHeight),this.img.width(this.keybed.boxWidth).height(this.keybed.boxHeight))},t.prototype.handleMouseKeyDown=function(t){this.keyPressEventHandlers.forEach((function(e){return e(t)}))},t.prototype.handleMouseKeyUp=function(t){this.keyReleaseEventHandlers.forEach((function(e){return e(t)}))},t.prototype.rasterize=function(t,e){var i=document.createElement("canvas"),n=document.createElement("div"),s=We().addTo(n).svg(this.img.svg()).size(this.img.width(),this.img.height());if(e){var r=s.root().group();r.text(e).fill("#888").font({family:"Helvetica",size:12,anchor:"start"}),s.height(s.height()+r.height()+6),r.translate(s.width()-r.width()-6,s.height()-6)}i.width=s.width(),i.height=s.height();var h=s.svg(),o=i.getContext("2d"),a=window.URL,u=new Image(i.width,i.height);u.setAttribute("crossOrigin","anonymous");var l=new Blob([h],{type:"image/svg+xml"}),c=a.createObjectURL(l);u.onload=function(){o.drawImage(u,0,0),a.revokeObjectURL(c),t(i.toDataURL("image/png"))},u.src=c},t}(),ii=function(){function t(t,e){this.notes=[],this.notes=t,this.mode=e}return Object.defineProperty(t.prototype,"root",{get:function(){return this.notes.length>0?this.notes[0]:{note:"C"}},enumerable:!0,configurable:!0}),t}(),ni=function(){function t(){}return t.getScale=function(e,i){var n=new Ue(e).baseNote,s=t.chromatic.notes.findIndex((function(t){return n.note===t.note&&n.accidental===t.accidental})),r=t.modeSteps.get(i),h=[];if(void 0!==r){h.push(n);for(var o=s,a=0;a<r.length;a++)o=(o+r[a])%12,h.push(t.chromatic.notes[o])}return new ii(t.adjustScale(e,h),i)},t.adjustScale=function(e,i){var n=[];return i.forEach((function(i){if("b"===e.accidental&&"#"===i.accidental){var s=t.chromatic.notes.findIndex((function(t){return t.note===i.note&&t.accidental===i.accidental}));n.push({note:t.chromatic.notes[s+1].note,accidental:"b"})}else n.push(i)})),n},t.chromatic=new ii([new Ue("C"),new Ue("C#"),new Ue("D"),new Ue("D#"),new Ue("E"),new Ue("F"),new Ue("F#"),new Ue("G"),new Ue("G#"),new Ue("A"),new Ue("A#"),new Ue("B")],"chromatic"),t.modeSteps=new Map([["major",[2,2,1,2,2,2,1]],["minor",[2,1,2,2,1,2,2]],["dorian",[2,1,2,2,2,1,2]],["phrygian",[1,2,2,2,1,2,2]],["lydian",[2,2,2,1,2,2,1]],["mixolydian",[2,2,1,2,2,1,2]],["locrian",[1,2,2,1,2,2,2]],["majorpentatonic",[2,2,3,2,3]],["minorpentatonic",[3,2,2,3,2]],["harmonicminor",[2,1,2,2,1,3,1]],["melodicminor",[2,1,2,2,2,2,1]]]),t}();t.Instrument=ei,t.NoteValue=Ue,t.PianoData=Xe,t.Scale=ii,t.ScaleHelper=ni,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=piano-chart.umd.js.map
