vexchords
Version:
Javascript Chord Charts
1 lines • 82 kB
JavaScript
var vexchords=function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/dist",r(r.s=0)}([function(t,e,r){"use strict";r.r(e);var i={};r.r(i),r.d(i,"rx",function(){return Dt}),r.d(i,"ry",function(){return Ft}),r.d(i,"x",function(){return zt}),r.d(i,"y",function(){return Rt}),r.d(i,"cx",function(){return qt}),r.d(i,"cy",function(){return It}),r.d(i,"width",function(){return Lt}),r.d(i,"height",function(){return Pt});var n={};r.r(n),r.d(n,"from",function(){return Vt}),r.d(n,"to",function(){return Ut});var s={};r.r(s),r.d(s,"MorphArray",function(){return ee}),r.d(s,"x",function(){return re}),r.d(s,"y",function(){return ie}),r.d(s,"width",function(){return ne}),r.d(s,"height",function(){return se});var h={};r.r(h),r.d(h,"array",function(){return Ce}),r.d(h,"plot",function(){return ke}),r.d(h,"clear",function(){return Te}),r.d(h,"move",function(){return Ee}),r.d(h,"size",function(){return je});var o={};r.r(o),r.d(o,"plain",function(){return Ue}),r.d(o,"length",function(){return $e});const a={},u=[];function l(t,e){if(Array.isArray(t))for(let r of t)l(r,e);else if("object"!=typeof t)f(Object.getOwnPropertyNames(e)),a[t]=Object.assign(a[t]||{},e);else for(let e in t)l(e,t[e])}function c(t){return a[t]||{}}function f(t){u.push(...t)}function d(t,e){var r,i=t.length,n=[];for(r=0;r<i;r++)n.push(e(t[r]));return n}function p(t){return t%360*Math.PI/180}function m(t){return t.toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()})}function y(t){return t.charAt(0).toUpperCase()+t.slice(1)}function g(t,e,r,i){return null!=e&&null!=r||(i=i||t.bbox(),null==e?e=i.width/i.height*r:null==r&&(r=i.height/i.width*e)),{width:e,height:r}}function x(t,e){let r,i,n=t.origin;if("string"==typeof n||null==n){const s=(n||"center").toLowerCase().trim(),{height:h,width:o,x:a,y:u}=e.bbox();let l=s.includes("left")?a:s.includes("right")?a+o:a+o/2,c=s.includes("top")?u:s.includes("bottom")?u+h:u+h/2;r=null!=t.ox?t.ox:l,i=null!=t.oy?t.oy:c}else r=n[0],i=n[1];return[r,i]}let w="http://www.w3.org/2000/svg",v="http://www.w3.org/2000/xmlns/",_="http://www.w3.org/1999/xlink",b="http://svgjs.com/svgjs";const S={window:"undefined"==typeof window?null:window,document:"undefined"==typeof document?null:document};class M{}const A={},O="___SYMBOL___ROOT___";function C(t){return S.document.createElementNS(w,t)}function k(t){if(t instanceof M)return t;if("object"==typeof t)return j(t);if(null==t)return new A[O];if("string"==typeof t&&"<"!==t.charAt(0))return j(S.document.querySelector(t));var e=C("svg");return e.innerHTML=t,t=j(e.firstChild)}function T(t,e){return e instanceof S.window.Node?e:C(t)}function E(t){if(!t)return null;if(t.instance instanceof M)return t.instance;var e=y(t.nodeName||"Dom");return"LinearGradient"===e||"RadialGradient"===e?e="Gradient":A[e]||(e="Dom"),new A[e](t)}let j=E;function N(t,e=t.name,r=!1){return A[e]=t,r&&(A[O]=t),f(Object.getOwnPropertyNames(t.prototype)),t}let D=1e3;function F(t){return"Svgjs"+y(t)+D++}function z(t,e,r){var i,n;for(n=(t=Array.isArray(t)?t:[t]).length-1;n>=0;n--)for(i in e){let s=e[i];r&&(s=R(e[i])),t[n].prototype[i]=s}}function R(t){return function(...e){let r=e[e.length-1];return!r||r.constructor!==Object||r instanceof Array?t.apply(this,e):t.apply(this,e.slice(0,-1)).attr(r)}}l("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=k(t)).remove();var e=this.position();return this.parent().add(t,e),this},after:function(t){(t=k(t)).remove();var e=this.position();return this.parent().add(t,e+1),this},insertBefore:function(t){return(t=k(t)).before(this),this},insertAfter:function(t){return(t=k(t)).after(this),this}});let q=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,I=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,L=/rgb\((\d+),(\d+),(\d+)\)/,P=/(#[a-z0-9\-_]+)/i,X=/\)\s*,?\s*/,Y=/\s/g,B=/^#[a-f0-9]{3,6}$/i,H=/^rgb\(/,G=/^(\s+)?$/,W=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,V=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,U=/[\s,]+/,$=/([^e])-/gi,Q=/[MLHVCSQTAZ]/gi,Z=/[MLHVCSQTAZ]/i,J=/((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi,K=/\./g;l("Dom",{classes:function(){var t=this.attr("class");return null==t?[]:t.trim().split(U)},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)}}),l("Dom",{css:function(t,e){let r={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter(function(t){return!!t.length}).forEach(function(t){let e=t.split(/\s*:\s*/);r[e[0]]=e[1]}),r;if(arguments.length<2){if(Array.isArray(t)){for(let e of t){let t=m(e);r[t]=this.node.style[t]}return r}if("string"==typeof t)return this.node.style[m(t)];if("object"==typeof t)for(let e in t)this.node.style[m(e)]=null==t[e]||G.test(t[e])?"":t[e]}return 2===arguments.length&&(this.node.style[m(t)]=null==e||G.test(e)?"":e),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),l("Dom",{data:function(t,e,r){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===r||"string"==typeof e||"number"==typeof e?e:JSON.stringify(e));return this}}),l("Dom",{remember:function(t,e){if("object"==typeof arguments[0])for(var r in t)this.remember(r,t[r]);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 tt=0,et={};function rt(t){let e=t.getEventHolder();return e===S.window&&(e=et),e.events||(e.events={}),e.events}function it(t){return t.getEventTarget()}function nt(t,e,r,i,n){var s=r.bind(i||t),h=k(t),o=rt(h),a=it(h);e=Array.isArray(e)?e:e.split(U),r._svgjsListenerId||(r._svgjsListenerId=++tt),e.forEach(function(t){var e=t.split(".")[0],i=t.split(".")[1]||"*";o[e]=o[e]||{},o[e][i]=o[e][i]||{},o[e][i][r._svgjsListenerId]=s,a.addEventListener(e,s,n||!1)})}function st(t,e,r,i){var n=k(t),s=rt(n),h=it(n);("function"!=typeof r||(r=r._svgjsListenerId))&&(e=Array.isArray(e)?e:(e||"").split(U)).forEach(function(t){var e,o,a=t&&t.split(".")[0],u=t&&t.split(".")[1];if(r)s[a]&&s[a][u||"*"]&&(h.removeEventListener(a,s[a][u||"*"][r],i||!1),delete s[a][u||"*"][r]);else if(a&&u){if(s[a]&&s[a][u]){for(o in s[a][u])st(h,[a,u].join("."),o);delete s[a][u]}}else if(u)for(t in s)for(e in s[t])u===e&&st(h,[t,u].join("."));else if(a){if(s[a]){for(e in s[a])st(h,[a,e].join("."));delete s[a]}}else{for(t in s)st(h,t);!function(t){const e=t.getEventHolder();e.events&&(e.events={})}(n)}})}function ht(t){const e=Math.round(t),r=Math.max(0,Math.min(255,e)).toString(16);return 1===r.length?"0"+r:r}function ot(t,e){for(let r=e.length;r--;)if(null==t[e[r]])return!1;return!0}function at(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}class ut{constructor(...t){this.init(...t)}init(t=0,e=0,r=0,i=0,n="rgb"){if(t=t||0,this.space)for(let t in this.space)delete this[this.space[t]];if("number"==typeof t)n="string"==typeof i?i:n,i="string"==typeof i?0:i,Object.assign(this,{_a:t,_b:e,_c:r,_d:i,space:n});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 r=function(t,e){const r=ot(t,"rgb")?{_a:t.r,_b:t.g,_c:t.b,space:"rgb"}:ot(t,"xyz")?{_a:t.x,_b:t.y,_c:t.z,_d:0,space:"xyz"}:ot(t,"hsl")?{_a:t.h,_b:t.s,_c:t.l,_d:0,space:"hsl"}:ot(t,"lab")?{_a:t.l,_b:t.a,_c:t.b,_d:0,space:"lab"}:ot(t,"lch")?{_a:t.l,_b:t.c,_c:t.h,_d:0,space:"lch"}:ot(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 r.space=e||r.space,r}(t,e);Object.assign(this,r)}else if("string"==typeof t)if(H.test(t)){const e=t.replace(Y,""),[r,i,n]=L.exec(e).slice(1,4).map(t=>parseInt(t));Object.assign(this,{_a:r,_b:i,_c:n,_d:0,space:"rgb"})}else{if(!B.test(t))throw Error("Unsupported string format, can't construct Color");{const e=t=>parseInt(t,16),[,r,i,n]=I.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:r,_b:i,_c:n,_d:0,space:"rgb"})}}const{_a:s,_b:h,_c:o,_d:a}=this,u="rgb"===this.space?{r:s,g:h,b:o}:"xyz"===this.space?{x:s,y:h,z:o}:"hsl"===this.space?{h:s,s:h,l:o}:"lab"===this.space?{l:s,a:h,b:o}:"lch"===this.space?{l:s,c:h,h:o}:"cmyk"===this.space?{c:s,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:r}=this;if("lab"===this.space||"lch"===this.space){let{l:i,a:n,b:s}=this;if("lch"===this.space){let{c:t,h:e}=this;const r=Math.PI/180;n=t*Math.cos(r*e),s=t*Math.sin(r*e)}const h=(i+16)/116,o=n/500+h,a=h-s/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),r=1.08883*(a**3>l?a**3:(a-u)/c)}const i=3.2406*t+-1.5372*e+-.4986*r,n=-.9689*t+1.8758*e+.0415*r,s=.0557*t+-.204*e+1.057*r;let h=Math.pow,o=.0031308;const a=i>o?1.055*h(i,1/2.4)-.055:12.92*i,u=n>o?1.055*h(n,1/2.4)-.055:12.92*n,l=s>o?1.055*h(s,1/2.4)-.055:12.92*s;return new ut(255*a,255*u,255*l)}if("hsl"===this.space){let{h:t,s:e,l:r}=this;if(t/=360,r/=100,0===(e/=100)){return new ut(r*=255,r,r)}const i=r<.5?r*(1+e):r+e-r*e,n=2*r-i,s=255*at(n,i,t+1/3),h=255*at(n,i,t),o=255*at(n,i,t-1/3);return new ut(s,h,o)}if("cmyk"===this.space){const{c:t,m:e,y:r,k:i}=this,n=255*(1-Math.min(1,t*(1-i)+i)),s=255*(1-Math.min(1,e*(1-i)+i)),h=255*(1-Math.min(1,r*(1-i)+i));return new ut(n,s,h)}return this;var t}lab(){const{x:t,y:e,z:r}=this.xyz();return new ut(116*e-16,500*(t-e),200*(e-r),"lab")}xyz(){const{_a:t,_b:e,_c:r}=this.rgb(),[i,n,s]=[t,e,r].map(t=>t/255),h=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92,o=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92,a=s>.04045?Math.pow((s+.055)/1.055,2.4):s/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,f=u>.008856?Math.pow(u,1/3):7.787*u+16/116,d=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 ut(f,d,p,"xyz")}lch(){const{l:t,a:e,b:r}=this.lab(),i=Math.sqrt(e**2+r**2);let n=180*Math.atan2(r,e)/Math.PI;return n<0&&(n=360-(n*=-1)),new ut(t,i,n,"lch")}hsl(){const{_a:t,_b:e,_c:r}=this.rgb(),[i,n,s]=[t,e,r].map(t=>t/255),h=Math.max(i,n,s),o=Math.min(i,n,s),a=(h+o)/2,u=h===o,l=h-o;return new ut(360*(u?0:h===i?((n-s)/l+(n<s?6:0))/6:h===n?((s-i)/l+2)/6:h===s?((i-n)/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:r}=this.rgb(),[i,n,s]=[t,e,r].map(t=>t/255),h=Math.min(1-i,1-n,1-s);return 1===h?new ut(0,0,0,1,"cmyk"):new ut((1-i-h)/(1-h),(1-n-h)/(1-h),(1-s-h)/(1-h),h,"cmyk")}_clamped(){let{_a:t,_b:e,_c:r}=this.rgb(),{max:i,min:n,round:s}=Math;return[t,e,r].map(t=>i(0,n(s(t),255)))}toHex(){let[t,e,r]=this._clamped().map(ht);return`#${t}${e}${r}`}toString(){return this.toHex()}toRgb(){let[t,e,r]=this._clamped();return`rgb(${t},${e},${r})`}toArray(){let{_a:t,_b:e,_c:r,_d:i,space:n}=this;return[t,e,r,i,n]}static random(t="vibrant",e,r){const{random:i,round:n,sin:s,PI:h}=Math;if("vibrant"===t){const t=24*i()+57,e=38*i()+45,r=360*i();return new ut(t,e,r,"lch")}if("sine"===t){const t=n(80*s(2*h*(e=null==e?i():e)/.5+.01)+150),r=n(50*s(2*h*e/.5+4.6)+200),o=n(100*s(2*h*e/.5+2.3)+150);return new ut(t,r,o)}if("pastel"===t){const t=8*i()+86,e=17*i()+9,r=360*i();return new ut(t,e,r,"lch")}if("dark"===t){const t=10+10*i(),e=50*i()+86,r=360*i();return new ut(t,e,r,"lch")}if("rgb"===t){const t=255*i(),e=255*i(),r=255*i();return new ut(t,e,r)}if("lab"===t){const t=100*i(),e=256*i()-128,r=256*i()-128;return new ut(t,e,r,"lab")}if("grey"===t){const t=255*i();return new ut(t,t,t)}}static test(t){return"string"==typeof t&&(B.test(t)||H.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 ut||this.isRgb(t)||this.test(t))}}class lt{constructor(...t){this.init(...t)}init(t,e){let r,i=0,n=0;return r=Array.isArray(t)?{x:t[0],y:t[1]}:"object"==typeof t?{x:t.x,y:t.y}:{x:t,y:e},this.x=null==r.x?i:r.x,this.y=null==r.y?n:r.y,this}clone(){return new lt(this)}transform(t){return this.clone().transformO(t)}transformO(t){ft.isMatrixLike(t)||(t=new ft(t));let{x:e,y:r}=this;return this.x=t.a*e+t.c*r+t.e,this.y=t.b*e+t.d*r+t.f,this}toArray(){return[this.x,this.y]}}function ct(t,e,r){return Math.abs(e-t)<(r||1e-6)}class ft{constructor(...t){this.init(...t)}init(t){var e=ft.fromArray([1,0,0,1,0,0]);return t=t instanceof jt?t.matrixify():"string"==typeof t?ft.fromArray(t.split(U).map(parseFloat)):Array.isArray(t)?ft.fromArray(t):"object"==typeof t&&ft.isMatrixLike(t)?t:"object"==typeof t?(new ft).transform(t):6===arguments.length?ft.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 ft(this)}transform(t){if(ft.isMatrixLike(t))return new ft(t).multiplyO(this);var e=ft.formatTransforms(t);let{x:r,y:i}=new lt(e.ox,e.oy).transform(this);var n=(new ft).translateO(e.rx,e.ry).lmultiplyO(this).translateO(-r,-i).scaleO(e.scaleX,e.scaleY).skewO(e.skewX,e.skewY).shearO(e.shear).rotateO(e.theta).translateO(r,i);if(isFinite(e.px)||isFinite(e.py)){const t=new lt(r,i).transform(n),s=e.px?e.px-t.x:0,h=e.py?e.py-t.y:0;n.translateO(s,h)}return n.translateO(e.tx,e.ty),n}compose(t){t.origin&&(t.originX=t.origin[0],t.originY=t.origin[1]);var e=t.originX||0,r=t.originY||0,i=t.scaleX||1,n=t.scaleY||1,s=t.shear||0,h=t.rotate||0,o=t.translateX||0,a=t.translateY||0;return(new ft).translateO(-e,-r).scaleO(i,n).shearO(s).rotateO(h).translateO(o,a).lmultiplyO(this).translateO(e,r)}decompose(t=0,e=0){var r=this.a,i=this.b,n=this.c,s=this.d,h=this.e,o=this.f,a=r*s-i*n,u=a>0?1:-1,l=u*Math.sqrt(r*r+i*i),c=Math.atan2(u*i,u*r),f=180/Math.PI*c,d=Math.cos(c),p=Math.sin(c),m=(r*n+i*s)/a,y=n*l/(m*r-i)||s*l/(m*i+r);return{scaleX:l,scaleY:y,shear:m,rotate:f,translateX:h-t+t*d*l+e*(m*d*l-p*y),translateY:o-e+t*p*l+e*(m*p*l+d*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 ft?t:new ft(t);return ft.matrixMultiply(this,e,this)}lmultiply(t){return this.clone().lmultiplyO(t)}lmultiplyO(t){var e=t instanceof ft?t:new ft(t);return ft.matrixMultiply(e,this,this)}inverseO(){var t=this.a,e=this.b,r=this.c,i=this.d,n=this.e,s=this.f,h=t*i-e*r;if(!h)throw new Error("Cannot invert "+this);var o=i/h,a=-e/h,u=-r/h,l=t/h,c=-(o*n+u*s),f=-(a*n+l*s);return this.a=o,this.b=a,this.c=u,this.d=l,this.e=c,this.f=f,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,r,i){return this.clone().scaleO(...arguments)}scaleO(t,e=t,r=0,i=0){3===arguments.length&&(i=r,r=e,e=t);let{a:n,b:s,c:h,d:o,e:a,f:u}=this;return this.a=n*t,this.b=s*e,this.c=h*t,this.d=o*e,this.e=a*t-r*t+r,this.f=u*e-i*e+i,this}rotate(t,e,r){return this.clone().rotateO(t,e,r)}rotateO(t,e=0,r=0){t=p(t);let i=Math.cos(t),n=Math.sin(t),{a:s,b:h,c:o,d:a,e:u,f:l}=this;return this.a=s*i-h*n,this.b=h*i+s*n,this.c=o*i-a*n,this.d=a*i+o*n,this.e=u*i-l*n+r*n-e*i+e,this.f=l*i+u*n-e*n-r*i+r,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,r){return this.clone().shearO(t,e,r)}shearO(t,e=0,r=0){let{a:i,b:n,c:s,d:h,e:o,f:a}=this;return this.a=i+n*t,this.c=s+h*t,this.e=o+a*t-r*t,this}skew(t,e,r,i){return this.clone().skewO(...arguments)}skewO(t,e=t,r=0,i=0){3===arguments.length&&(i=r,r=e,e=t),t=p(t),e=p(e);let n=Math.tan(t),s=Math.tan(e),{a:h,b:o,c:a,d:u,e:l,f:c}=this;return this.a=h+o*n,this.b=o+h*s,this.c=a+u*n,this.d=u+a*s,this.e=l+c*n-i*n,this.f=c+l*s-r*s,this}skewX(t,e,r){return this.skew(t,0,e,r)}skewXO(t,e,r){return this.skewO(t,0,e,r)}skewY(t,e,r){return this.skew(0,t,e,r)}skewYO(t,e,r){return this.skewO(0,t,e,r)}aroundO(t,e,r){var i=t||0,n=e||0;return this.translateO(-i,-n).lmultiplyO(r).translateO(i,n)}around(t,e,r){return this.clone().aroundO(t,e,r)}equals(t){var e=new ft(t);return ct(this.a,e.a)&&ct(this.b,e.b)&&ct(this.c,e.c)&&ct(this.d,e.d)&&ct(this.e,e.e)&&ct(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,r=t.flip&&(e||"x"===t.flip)?-1:1,i=t.flip&&(e||"y"===t.flip)?-1:1,n=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,s=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]*r:isFinite(t.scale)?t.scale*r:isFinite(t.scaleX)?t.scaleX*r:r,o=t.scale&&t.scale.length?t.scale[1]*i:isFinite(t.scale)?t.scale*i:isFinite(t.scaleY)?t.scaleY*i:i,a=t.shear||0,u=t.rotate||t.theta||0,l=new lt(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),c=l.x,f=l.y,d=new lt(t.position||t.px||t.positionX,t.py||t.positionY),p=d.x,m=d.y,y=new lt(t.translate||t.tx||t.translateX,t.ty||t.translateY),g=y.x,x=y.y,w=new lt(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:h,scaleY:o,skewX:n,skewY:s,shear:a,theta:u,rx:w.x,ry:w.y,tx:g,ty:x,ox:c,oy:f,px:p,py:m}}static matrixMultiply(t,e,r){var i=t.a*e.a+t.c*e.b,n=t.b*e.a+t.d*e.b,s=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 r.a=i,r.b=n,r.c=s,r.d=h,r.e=o,r.f=a,r}}function dt(){if(!dt.nodes){let t=k().size(2,0);t.node.style.cssText=["opacity: 0","position: absolute","left: -100%","top: -100%","overflow: hidden"].join(";"),t.attr("focusable","false");let e=t.path().node;dt.nodes={svg:t,path:e}}if(!dt.nodes.svg.node.parentNode){let t=S.document.body||S.document.documentElement;dt.nodes.svg.addTo(t)}return dt.nodes}function pt(t){return!(t.width||t.height||t.x||t.y)}N(ft);class mt{constructor(...t){this.init(...t)}init(t){return t="string"==typeof t?t.split(U).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){let e=Math.min(this.x,t.x),r=Math.min(this.y,t.y),i=Math.max(this.x+this.width,t.x+t.width)-e,n=Math.max(this.y+this.height,t.y+t.height)-r;return new mt(e,r,i,n)}transform(t){t instanceof ft||(t=new ft(t));let e=1/0,r=-1/0,i=1/0,n=-1/0;return[new lt(this.x,this.y),new lt(this.x2,this.y),new lt(this.x,this.y2),new lt(this.x2,this.y2)].forEach(function(s){s=s.transform(t),e=Math.min(e,s.x),r=Math.max(r,s.x),i=Math.min(i,s.y),n=Math.max(n,s.y)}),new mt(e,i,r-e,n-i)}addOffset(){return this.x+=S.window.pageXOffset,this.y+=S.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 pt(this)}}function yt(t,e){let r;try{if(pt(r=t(this.node))&&((i=this.node)!==S.document&&!(S.document.documentElement.contains||function(t){for(;t.parentNode;)t=t.parentNode;return t===S.document}).call(S.document.documentElement,i)))throw new Error("Element not in the dom")}catch(t){r=e(this)}var i;return r}l({viewbox:{viewbox(t,e,r,i){return null==t?new mt(this.attr("viewBox")):this.attr("viewBox",new mt(t,e,r,i))},zoom(t,e){let r=this.node.clientWidth,i=this.node.clientHeight;const n=this.viewbox();if(!r&&!i){var s=window.getComputedStyle(this.node);r=parseFloat(s.getPropertyValue("width")),i=parseFloat(s.getPropertyValue("height"))}const h=r/n.width,o=i/n.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 lt(r/2/h+n.x,i/2/o+n.y);const l=new mt(n).transform(new ft({scale:u,origin:e}));return this.viewbox(l)}}}),N(mt);const gt=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,r)=>{const i=function(){e.apply(this,arguments),r&&r.apply(this,arguments)};return(i.prototype=Object.create(e.prototype)).constructor=i,i.prototype.map=function(t){const e=new i;return e.push.apply(e,Array.prototype.map.call(this,t)),e},i}}}(),xt=gt("List",Array,function(t=[]){if("number"==typeof t)return this;this.length=0,this.push(...t)});var wt=xt;z(xt,{each(t,...e){return"function"==typeof t?this.map(e=>t.call(e,e)):this.map(r=>r[t](...e))},toArray(){return Array.prototype.concat.apply([],this)}});const vt=["toArray","constructor","each"];function _t(t,e){return new wt(d((e||S.document).querySelectorAll(t),function(t){return E(t)}))}xt.extend=function(t){t=t.reduce((t,e)=>vt.includes(e)?t:"_"===e[0]?t:(t[e]=function(...t){return this.each(e,...t)},t),{}),z(xt,t)};class bt extends M{constructor({events:t={}}={}){super(),this.events=t}addEventListener(){}dispatch(t,e){return function(t,e,r){var i=it(t);return e instanceof S.window.Event?i.dispatchEvent(e):(e=new S.window.CustomEvent(e,{detail:r,cancelable:!0}),i.dispatchEvent(e)),e}(this,t,e)}dispatchEvent(t){const e=this.getEventHolder().events;if(!e)return!0;const r=e[t.type];for(let e in r)for(let i in r[e])r[e][i](t);return!t.defaultPrevented}fire(t,e){return this.dispatch(t,e),this}getEventHolder(){return this}getEventTarget(){return this}off(t,e){return st(this,t,e),this}on(t,e,r,i){return nt(this,t,e,r,i),this}removeEventListener(){}}function St(){}N(bt);let Mt={duration:400,ease:">",delay:0},At={"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"};const Ot=gt("SVGArray",Array,function(t){this.init(t)});var Ct=Ot;z(Ot,{init(t){return"number"==typeof t?this:(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(U).map(parseFloat),clone(){return new this.constructor(this)},toSet(){return new Set(this)}});class kt{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?-3.4e38:3.4e38:"string"==typeof t?(e=t.match(q))&&(this.value=parseFloat(e[1]),"%"===e[5]?this.value/=100:"s"===e[5]&&(this.value*=1e3),this.unit=e[5]):t instanceof kt&&(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 kt(t),new kt(this+t,this.unit||t.unit)}minus(t){return t=new kt(t),new kt(this-t,this.unit||t.unit)}times(t){return t=new kt(t),new kt(this*t,this.unit||t.unit)}divide(t){return t=new kt(t),new kt(this/t,this.unit||t.unit)}convert(t){return new kt(this.value,t)}}const Tt=[];class Et extends bt{constructor(t,e){super(t),this.node=t,this.type=t.nodeName,e&&t!==e&&this.attr(e)}add(t,e){return t=k(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 k(t).put(this)}children(){return new wt(d(this.node.children,function(t){return E(t)}))}clear(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}clone(){return this.writeDataToDom(),function t(e){for(var r=e.children.length-1;r>=0;r--)t(e.children[r]);return e.id?E(e).id(F(e.nodeName)):E(e)}(this.node.cloneNode(!0))}each(t,e){var r,i,n=this.children();for(r=0,i=n.length;r<i;r++)t.apply(n[r],[r,n]),e&&n[r].each(t,e);return this}element(t){return this.put(new Et(C(t)))}first(){return E(this.node.firstChild)}get(t){return E(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=F(this.type)),this.attr("id",t)}index(t){return[].slice.call(this.node.childNodes).indexOf(t.node)}last(){return E(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=E(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=E(e.node.parentNode)}}put(t,e){return this.add(t,e),t}putIn(t){return k(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=k(t),this.node.parentNode.replaceChild(t.node,this.node),t}round(t=2,e){const r=10**t,i=this.attr();e||(e=Object.keys(i));const n={};return e.forEach(t=>{n[t]=Math.round(i[t]*r)/r}),this.attr(n),this}toString(){return this.id()}svg(t,e){var r,i,n;if(!1===t&&(e=!1,t=null),null==t||"function"==typeof t){e=null==e||e,this.writeDataToDom();let r=this;if(null!=t){if(r=E(r.node.cloneNode(!0)),e){let e=t(r);if(r=e||r,!1===e)return""}r.each(function(){let e=t(this),r=e||this;!1===e?this.remove():e&&this!==r&&this.replace(r)},!0)}return e?r.node.outerHTML:r.node.innerHTML}for(e=null!=e&&e,r=S.document.createElementNS(w,"svg"),n=S.document.createDocumentFragment(),r.innerHTML=t,i=r.children.length;i--;)n.appendChild(r.firstElementChild);let s=this.parent();return e?this.replace(n)&&s:this.add(n)}words(t){return this.node.textContent=t,this}writeDataToDom(){return this.each(function(){this.writeDataToDom()}),this}}z(Et,{attr:function(t,e,r){if(null==t){t={},e=this.node.attributes;for(let r of e)t[r.nodeName]=W.test(r.nodeValue)?parseFloat(r.nodeValue):r.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))?At[t]:W.test(e)?parseFloat(e):e;"number"==typeof(e=Tt.reduce((e,r)=>r(t,e,this),e))?e=new kt(e):ut.isColor(e)?e=new ut(e):e.constructor===Array&&(e=new Ct(e)),"leading"===t?this.leading&&this.leading(e):"string"==typeof r?this.node.setAttributeNS(r,t,e.toString()):this.node.setAttribute(t,e.toString()),!this.rebuild||"font-size"!==t&&"x"!==t||this.rebuild()}return this},find:function(t){return _t(t,this.node)},findOne:function(t){return E(this.node.querySelector(t))}}),N(Et);class jt extends Et{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){return this.x(new kt(t).plus(this.x()))}dy(t){return this.y(new kt(t).plus(this.y()))}root(){let t=this.parent(A[O]);return t&&t.root()}getEventHolder(){return this}height(t){return this.attr("height",t)}inside(t,e){let r=this.bbox();return t>r.x&&e>r.y&&t<r.x+r.width&&e<r.y+r.height}move(t,e){return this.x(t).y(e)}parents(t=S.document){t=k(t);let e=new wt,r=this;for(;(r=r.parent())&&r.node!==t.node&&r.node!==S.document;)e.push(r);return e}reference(t){if(!(t=this.attr(t)))return null;const e=t.match(P);return e?k(e[1]):null}setData(t){return this.dom=t,this}size(t,e){let r=g(this,t,e);return this.width(new kt(r.width)).height(new kt(r.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)}}z(jt,{bbox:function(){return new mt(yt.call(this,t=>t.getBBox(),t=>{try{let e=t.clone().addTo(dt().svg).show(),r=e.node.getBBox();return e.remove(),r}catch(e){throw new Error('Getting bbox of element "'+t.node.nodeName+'" is not possible. '+e.toString())}}))},rbox:function(t){let e=new mt(yt.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 lt(t,e).transform(this.screenCTM().inverse())},ctm:function(){return new ft(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 ft(e)}return new ft(this.node.getScreenCTM())}}),N(jt);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 Dt(t){return this.attr("rx",t)}function Ft(t){return this.attr("ry",t)}function zt(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())}function Rt(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())}function qt(t){return null==t?this.attr("cx"):this.attr("cx",t)}function It(t){return null==t?this.attr("cy"):this.attr("cy",t)}function Lt(t){return null==t?2*this.rx():this.rx(new kt(t).divide(2))}function Pt(t){return null==t?2*this.ry():this.ry(new kt(t).divide(2))}["fill","stroke"].forEach(function(t){var e,r={};r[t]=function(r){if(void 0===r)return this.attr(t);if("string"==typeof r||r instanceof ut||ut.isRgb(r)||r instanceof jt)this.attr(t,r);else for(e=Nt[t].length-1;e>=0;e--)null!=r[Nt[t][e]]&&this.attr(Nt.prefix(t,Nt[t][e]),r[Nt[t][e]]);return this},l(["Element","Runner"],r)}),l(["Element","Runner"],{matrix:function(t,e,r,i,n,s){return null==t?new ft(this):this.attr("transform",new ft(t,e,r,i,n,s))},rotate:function(t,e,r){return this.transform({rotate:t,ox:e,oy:r},!0)},skew:function(t,e,r,i){return 1===arguments.length||3===arguments.length?this.transform({skew:t,ox:e,oy:r},!0):this.transform({skew:[t,e],ox:r,oy:i},!0)},shear:function(t,e,r){return this.transform({shear:t,ox:e,oy:r},!0)},scale:function(t,e,r,i){return 1===arguments.length||3===arguments.length?this.transform({scale:t,ox:e,oy:r},!0):this.transform({scale:[t,e],ox:r,oy:i},!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 r="string"==typeof t?t:(isFinite(t),"both"),i="both"===t&&isFinite(e)?[e,e]:"x"===t?[e,0]:"y"===t?[0,e]:isFinite(t)?[t,t]:[0,0];return this.transform({flip:r,origin:i},!0)},opacity:function(t){return this.attr("opacity",t)}}),l("radius",{radius:function(t,e){var r=(this._element||this).type;return"radialGradient"===r||"radialGradient"===r?this.attr("r",new kt(t)):this.rx(t).ry(null==e?t:e)}}),l("Path",{length:function(){return this.node.getTotalLength()},pointAt:function(t){return new lt(this.node.getPointAtLength(t))}}),l(["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)}}),l("Text",{ax(t){return this.attr("x",t)},ay(t){return this.attr("y",t)},amove(t,e){return this.ax(t).ay(e)}}),l("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?st(this,e):nt(this,e,t),this},t},{})),l("Element",{untransform:function(){return this.attr("transform",null)},matrixify:function(){return(this.attr("transform")||"").split(X).slice(0,-1).map(function(t){var e=t.trim().split("(");return[e[0],e[1].split(U).map(function(t){return parseFloat(t)})]}).reverse().reduce(function(t,e){return"matrix"===e[0]?t.lmultiply(ft.fromArray(e[1])):t[e[0]].apply(t,e[1])},new ft)},toParent:function(t){if(this===t)return this;var e=this.screenCTM(),r=t.screenCTM().inverse();return this.addTo(t).untransform().transform(r.multiply(e)),this},toRoot:function(){return this.toParent(this.root())},transform:function(t,e){if(null==t||"string"==typeof t){var r=new ft(this).decompose();return r[t]||r}ft.isMatrixLike(t)||(t={...t,origin:x(t,this)});var i=new ft(!0===e?this:e||!1).transform(t);return this.attr("transform",i)}});class Xt extends jt{}N(Xt);class Yt extends Xt{constructor(t){super(T("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 kt(t).divide(2))}}z(Yt,{x:zt,y:Rt,cx:qt,cy:It,width:Lt,height:Pt}),l({Container:{circle:R(function(t){return this.put(new Yt).size(t).move(0,0)})}}),N(Yt);class Bt extends jt{flatten(t){return this.each(function(){return this instanceof Bt?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(Bt);class Ht extends Bt{constructor(t){super(T("defs",t),t)}flatten(){return this}ungroup(){return this}}N(Ht);class Gt extends Xt{constructor(t){super(T("ellipse",t),t)}size(t,e){var r=g(this,t,e);return this.rx(new kt(r.width).divide(2)).ry(new kt(r.height).divide(2))}}z(Gt,i),l("Container",{ellipse:R(function(t=0,e=t){return this.put(new Gt).size(t,e).move(0,0)})}),N(Gt);class Wt extends jt{constructor(t){super(T("stop",t),t)}update(t){return("number"==typeof t||t instanceof kt)&&(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 kt(t.offset)),this}}function Vt(t,e){return"radialGradient"===(this._element||this).type?this.attr({fx:new kt(t),fy:new kt(e)}):this.attr({x1:new kt(t),y1:new kt(e)})}function Ut(t,e){return"radialGradient"===(this._element||this).type?this.attr({cx:new kt(t),cy:new kt(e)}):this.attr({x2:new kt(t),y2:new kt(e)})}N(Wt);class $t extends Bt{constructor(t,e){super(T(t+"Gradient","string"==typeof t?null:t),e)}stop(t,e,r){return this.put(new Wt).update(t,e,r)}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,r){return"transform"===t&&(t="gradientTransform"),super.attr(t,e,r)}targets(){return _t('svg [fill*="'+this.id()+'"]')}bbox(){return new mt}}z($t,n),l({Container:{gradient:R(function(t,e){return this.defs().gradient(t,e)})},Defs:{gradient:R(function(t,e){return this.put(new $t(t)).update(e)})}}),N($t);class Qt extends Bt{constructor(t){super(T("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,r){return"transform"===t&&(t="patternTransform"),super.attr(t,e,r)}targets(){return _t('svg [fill*="'+this.id()+'"]')}bbox(){return new mt}}l({Container:{pattern(...t){return this.defs().pattern(...t)}},Defs:{pattern:R(function(t,e,r){return this.put(new Qt).update(r).attr({x:0,y:0,width:t,height:e,patternUnits:"userSpaceOnUse"})})}}),N(Qt);class Zt extends Xt{constructor(t){super(T("image",t),t)}load(t,e){if(!t)return this;var r=new S.window.Image;return nt(r,"load",function(t){var i=this.parent(Qt);0===this.width()&&0===this.height()&&this.size(r.width,r.height),i instanceof Qt&&0===i.width()&&0===i.height()&&i.size(this.width(),this.height()),"function"==typeof e&&e.call(this,t)},this),nt(r,"load error",function(){st(r)}),this.attr("href",r.src=t,_)}}var Jt;Jt=function(t,e,r){return"fill"!==t&&"stroke"!==t||V.test(e)&&(e=r.root().defs().image(e)),e instanceof Zt&&(e=r.root().defs().pattern(0,0,t=>{t.add(e)})),e},Tt.push(Jt),l({Container:{image:R(function(t,e){return this.put(new Zt).size(0,0).load(t,e)})}}),N(Zt);const Kt=gt("PointArray",Ct);var te=Kt;z(Kt,{toString(){for(var t=0,e=this.length,r=[];t<e;t++)r.push(this[t].join(","));return r.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,r=this.length,i=[];e<r;e++)i.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 Kt(i)},parse(t=[[0,0]]){var e=[];if(t instanceof Array){if(t[0]instanceof Array)return t}else t=t.trim().split(U).map(parseFloat);t.length%2!=0&&t.pop();for(var r=0,i=t.length;r<i;r+=2)e.push([t[r],t[r+1]]);return e},transform(t){const e=[];for(let r=0;r<this.length;r++){const i=this[r];e.push([t.a*i[0]+t.c*i[1]+t.e,t.b*i[0]+t.d*i[1]+t.f])}return new Kt(e)},move(t,e){var r=this.bbox();if(t-=r.x,e-=r.y,!isNaN(t)&&!isNaN(e))for(var i=this.length-1;i>=0;i--)this[i]=[this[i][0]+t,this[i][1]+e];return this},size(t,e){var r,i=this.bbox();for(r=this.length-1;r>=0;r--)i.width&&(this[r][0]=(this[r][0]-i.x)*t/i.width+i.x),i.height&&(this[r][1]=(this[r][1]-i.y)*e/i.height+i.y);return this},bbox(){var t=-1/0,e=-1/0,r=1/0,i=1/0;return this.forEach(function(n){t=Math.max(n[0],t),e=Math.max(n[1],e),r=Math.min(n[0],r),i=Math.min(n[1],i)}),{x:r,y:i,width:t-r,height:e-i}}});let ee=te;function re(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)}function ie(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}function ne(t){let e=this.bbox();return null==t?e.width:this.size(t,e.height)}function se(t){let e=this.bbox();return null==t?e.height:this.size(e.width,t)}class he extends Xt{constructor(t){super(T("line",t),t)}array(){return new te([[this.attr("x1"),this.attr("y1")],[this.attr("x2"),this.attr("y2")]])}plot(t,e,r,i){return null==t?this.array():(t=void 0!==e?{x1:t,y1:e,x2:r,y2:i}:new te(t).toLine(),this.attr(t))}move(t,e){return this.attr(this.array().move(t,e).toLine())}size(t,e){var r=g(this,t,e);return this.attr(this.array().size(r.width,r.height).toLine())}}z(he,s),l({Container:{line:R(function(...t){return he.prototype.plot.apply(this.put(new he),null!=t[0]?t:[0,0,0,0])})}}),N(he);class oe extends Bt{constructor(t){super(T("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 ae(t,e){return function(r){return null==r?this[r]:(this[t]=r,e&&e.call(this),this)}}l({Container:{marker(...t){return this.defs().marker(...t)}},Defs:{marker:R(function(t,e,r){return this.put(new oe).size(t,e).ref(t/2,e/2).viewbox(0,0,t,e).attr("orient","auto").update(r)})},marker:{marker(t,e,r,i){var n=["marker"];return"all"!==t&&n.push(t),n=n.join("-"),t=arguments[1]instanceof oe?arguments[1]:this.defs().marker(e,r,i),this.attr(n,t)}}}),N(oe);let ue={"-":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,r,i){return function(n){return n<0?t>0?e/t*n:r>0?i/r*n:0:n>1?r<1?(1-i)/(1-r)*n+(i-r)/(1-r):t<1?(1-e)/(1-t)*n+(e-t)/(1-t):1:3*n*(1-n)**2*e+3*n**2*(1-n)*i+n**3}},steps:function(t,e="end"){e=e.split("-").reverse()[0];let r=t;return"none"===e?--r:"both"===e&&++r,(i,n=!1)=>{let s=Math.floor(i*t);const h=i*s%1==0;return"start"!==e&&"both"!==e||++s,n&&h&&--s,i>=0&&s<0&&(s=0),i<=1&&s>r&&(s=r),s/r}}};class le{done(){return!1}}class ce extends le{constructor(t){super(),this.ease=ue[t||Mt.ease]||t}step(t,e,r){return"number"!=typeof t?r<1?t:e:t+(e-t)*this.ease(r)}}class fe extends le{constructor(t){super(),this.stepper=t}step(t,e,r,i){return this.stepper(t,e,r,i)}done(t){return t.done}}function de(){var t=(this._duration||500)/1e3,e=this._overshoot||0,r=Math.PI,i=Math.log(e/100+1e-10),n=-i/Math.sqrt(r*r+i*i),s=3.9/(n*t);this.d=2*n*s,this.k=s*s}z(class extends fe{constructor(t,e){super(),this.duration(t||500).overshoot(e||0)}step(t,e,r,i){if("string"==typeof t)return t;if(i.done=r===1/0,r===1/0)return e;if(0===r)return t;r>100&&(r=16),r/=1e3;var n=i.velocity||0,s=-this.d*n-this.k*(t-e),h=t+n*r+s*r*r/2;return i.velocity=n+s*r,i.done=Math.abs(e-h)+Math.abs(n)<.002,i.done?e:h}},{duration:ae("_duration",de),overshoot:ae("_overshoot",de)});z(class extends fe{constructor(t,e,r,i){super(),t=null==t?.1:t,e=null==e?.01:e,r=null==r?0:r,i=null==i?1e3:i,this.p(t).i(e).d(r).windup(i)}step(t,e,r,i){if("string"==typeof t)return t;if(i.done=r===1/0,r===1/0)return e;if(0===r)return t;var n=e-t,s=(i.integral||0)+n*r,h=(n-(i.error||0))/r,o=this.windup;return!1!==o&&(s=Math.max(-o,Math.min(s,o))),i.error=n,i.integral=s,i.done=Math.abs(n)<.001,i.done?e:t+(this.P*n+this.I*s+this.D*h)}},{windup:ae("windup"),p:ae("P"),i:ae("I"),d:ae("D")});const pe=gt("PathArray",Ct);var me=pe;function ye(t,e,r,i){return r+i.replace(K," .")}const ge={M:function(t,e,r){return e.x=r.x=t[0],e.y=r.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,r){return e.x=r.x,e.y=r.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]]}};let xe="mlhvqtcsaz".split("");for(var we=0,ve=xe.length;we<ve;++we)ge[xe[we]]=function(t){return function(e,r,i){if("H"===t)e[0]=e[0]+r.x;else if("V"===t)e[0]=e[0]+r.y;else if("A"===t)e[5]=e[5]+r.x,e[6]=e[6]+r.y;else for(var n=0,s=e.length;n<s;++n)e[n]=e[n]+(n%2?r.y:r.x);return ge[t](e,r,i)}}(xe[we].toUpperCase());z(pe,{toString(){return function(t){for(var e=0,r=t.length,i="";e<r;e++)i+=t[e][0],null!=t[e][1]&&(i+=t[e][1],null!=t[e][2]&&(i+=" ",i+=t[e][2],null!=t[e][3]&&(i+=" ",i+=t[e][3],i+=" ",i+=t[e][4],null!=t[e][5]&&(i+=" ",i+=t[e][5],i+=" ",i+=t[e][6],null!=t[e][7]&&(i+=" ",i+=t[e][7])))));return i+" "}(this)},move(t,e){var r=this.bbox();if(t-=r.x,e-=r.y,!isNaN(t)&&!isNaN(e))for(var i,n=this.length-1;n>=0;n--)"M"===(i=this[n][0])||"L"===i||"T"===i?(this[n][1]+=t,this[n][2]+=e):"H"===i?this[n][1]+=t:"V"===i?this[n][1]+=e:"C"===i||"S"===i||"Q"===i?(this[n][1]+=t,this[n][2]+=e,this[n][3]+=t,this[n][4]+=e,"C"===i&&(this[n][5]+=t,this[n][6]+=e)):"A"===i&&(this[n][6]+=t,this[n][7]+=e);return this},size(t,e){var r,i,n=this.bbox();for(r=this.length-1;r>=0;r--)"M"===(i=this[r][0])||"L"===i||"T"===i?(this[r][1]=(this[r][1]-n.x)*t/n.width+n.x,this[r][2]=(this[r][2]-n.y)*e/n.height+n.y):"H"===i?this[r][1]=(this[r][1]-n.x)*t/n.width+n.x:"V"===i?this[r][1]=(this[r][1]-n.y)*e/n.height+n.y:"C"===i||"S"===i||"Q"===i?(this[r][1]=(this[r][1]-n.x)*t/n.width+n.x,this[r][2]=(this[r][2]-n.y)*e/n.height+n.y,this[r][3]=(this[r][3]-n.x)*t/n.width+n.x,this[r][4]=(this[r][4]-n.y)*e/n.height+n.y,"C"===i&&(this[r][5]=(this[r][5]-n.x)*t/n.width+n.x,this[r][6]=(this[r][6]-n.y)*e/n.height+n.y)):"A"===i&&(this[r][1]=this[r][1]*t/n.width,this[r][2]=this[r][2]*e/n.height,this[r][6]=(this[r][6]-n.x)*t/n.width+n.x,this[r][7]=(this[r][7]-n.y)*e/n.height+n.y);return this},equalCommands(t){var e,r,i;for(t=new pe(t),i=this.length===t.length,e=0,r=this.length;i&&e<r;e++)i=this[e][0]===t[e][0];return i},morph(t){return t=new pe(t),this.equalCommands(t)?this.destination=t:this.destination=null,this},at(t){if(!this.destination)return this;var e,r,i,n,s=this.destination.value,h=[],o=new pe;for(e=0,r=this.length;e<r;e++){for(h[e]=[this[e][0]],i=1,n=this[e].length;i<n;i++)h[e][i]=this[e][i]+(s[e][i]-this[e][i])*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 pe)return t;var e,r={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(J,ye).replace(Q," $& ").replace($,"$1 -").trim().split(U):t.reduce(function(t,e){return[].concat.call(t,e)},[]);var i=[],n=new lt,s=new lt,h=0,o=t.length;do{Z.test(t[h])?(e=t[h],++h):"M"===e?e="L":"m"===e&&(e="l"),i.push(ge[e].call(null,t.slice(h,h+=r[e.toUpperCase()]).map(parseFloat),n,s))}while(o>h);return i},bbox(){return dt().path.setAttribute("d",this.toString()),dt.nodes.path.getBBox()}});class _e{constructor(t){this._stepper=t||new ce("-"),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(kt):"string"===e?ut.isColor(t)?this.type(ut):U.test(t)?this.type(Q.test(t)?me:Ct):q.test(t)?this.type(kt):this.type(be):Ae.indexOf(t.constructor)>-1?this.type(t.constructor):Array.isArray(t)?this.type(Ct):"object"===e?this.type(Me):this.type(be)}var r=new this._type(t);return this._type===ut&&(r=this._to?r[this._to[4]]():this._from?r[this._from[4]]():r),r=r.toArray(),this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(r.length)).map(Object).map(function(t){return t.done=!0,t}),r}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(r,i){return e._stepper.step(r,e._to[i],t,e._context[i],e._context)}))}}class be{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 Se{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,Se.defaults,t),this}toArray(){var t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}}Se.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0};class Me{constructor(...t){this.init(...t)}init(t){if(this.values=[],!Array.isArray(t)){t=t||{};var e=[];for(let r in t)e.push([r,t[r]]);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,r=0,i=e.length;r<i;r+=2)t[e[r]]=e[r+1];return t}toArray(){return this.values}}const Ae=[be,Se,Me];class Oe extends Xt{constructor(t){super(T("path",t),t)}array(){return this._array||(this._array=new me(this.attr("d")))}plot(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new me(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 r=g(this,t,e);return this.attr("d",this.array().size(r.width,r.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().