!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).ApexSankey=n()}(this,(function(){"use strict";const t={},n=[];function e(n,r){if(Array.isArray(n))for(const t of n)e(t,r);else if("object"!=typeof n)i(Object.getOwnPropertyNames(r)),t[n]=Object.assign(t[n]||{},r);else for(const t in n)e(t,n[t])}function r(n){return t[n]||{}}function i(t){n.push(...t)}function o(t,n){let e;const r=t.length,i=[];for(e=0;eh.has(t.nodeName),l=(t,n,e={})=>{const r={...n};for(const i in r)r[i].valueOf()===e[i]&&delete r[i];Object.keys(r).length?t.node.setAttribute("data-svgjs",JSON.stringify(r)):(t.node.removeAttribute("data-svgjs"),t.node.removeAttribute("svgjs:data"))},d="http://www.w3.org/2000/svg",p="http://www.w3.org/2000/xmlns/",v="http://www.w3.org/1999/xlink",g={window:"undefined"==typeof window?null:window,document:"undefined"==typeof document?null:document};class y{}const _={},m="___SYMBOL___ROOT___";function w(t,n=d){return g.document.createElementNS(n,t)}function b(t,n=!1){if(t instanceof y)return t;if("object"==typeof t)return j(t);if(null==t)return new _[m];if("string"==typeof t&&"<"!==t.charAt(0))return j(g.document.querySelector(t));const e=n?g.document.createElement("div"):w("svg");return e.innerHTML=t,t=j(e.firstChild),e.removeChild(e.firstChild),t}function x(t,n){return n&&(n instanceof g.window.Node||n.ownerDocument&&n instanceof n.ownerDocument.defaultView.Node)?n:w(t)}function E(t){if(!t)return null;if(t.instance instanceof y)return t.instance;if("#document-fragment"===t.nodeName)return new _.Fragment(t);let n=s(t.nodeName||"Dom");return"LinearGradient"===n||"RadialGradient"===n?n="Gradient":_[n]||(n="Dom"),new _[n](t)}let j=E;function A(t,n=t.name,e=!1){return _[n]=t,e&&(_[m]=t),i(Object.getOwnPropertyNames(t.prototype)),t}let O=1e3;function M(t){return"Svgjs"+s(t)+O++}function S(t){for(let n=t.children.length-1;n>=0;n--)S(t.children[n]);return t.id?(t.id=M(t.nodeName),t):t}function k(t,n){let e,r;for(r=(t=Array.isArray(t)?t:[t]).length-1;r>=0;r--)for(e in n)t[r].prototype[e]=n[e]}function C(t){return function(...n){const e=n[n.length-1];return!e||e.constructor!==Object||e instanceof Array?t.apply(this,n):t.apply(this,n.slice(0,-1)).attr(e)}}e("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(){const t=this.position();return this.parent().add(this.remove(),t+1),this},backward:function(){const t=this.position();return this.parent().add(this.remove(),t?t-1:0),this},front:function(){return this.parent().add(this.remove()),this},back:function(){return this.parent().add(this.remove(),0),this},before:function(t){(t=b(t)).remove();const n=this.position();return this.parent().add(t,n),this},after:function(t){(t=b(t)).remove();const n=this.position();return this.parent().add(t,n+1),this},insertBefore:function(t){return(t=b(t)).before(this),this},insertAfter:function(t){return(t=b(t)).after(this),this}});const T=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,I=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,N=/rgb\((\d+),(\d+),(\d+)\)/,R=/(#[a-z_][a-z0-9\-_]*)/i,z=/\)\s*,?\s*/,P=/\s/g,D=/^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i,L=/^rgb\(/,F=/^(\s+)?$/,B=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,$=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,V=/[\s,]+/,X=/[MLHVCSQTAZ]/i;function Y(t){const n=Math.round(t),e=Math.max(0,Math.min(255,n)).toString(16);return 1===e.length?"0"+e:e}function U(t,n){for(let e=n.length;e--;)if(null==t[n[e]])return!1;return!0}function q(t,n,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+6*(n-t)*e:e<.5?n:e<2/3?t+(n-t)*(2/3-e)*6:t}e("Dom",{classes:function(){const t=this.attr("class");return null==t?[]:t.trim().split(V)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){const n=this.classes();n.push(t),this.attr("class",n.join(" "))}return this},removeClass:function(t){return this.hasClass(t)&&this.attr("class",this.classes().filter((function(n){return n!==t})).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)}}),e("Dom",{css:function(t,n){const e={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter((function(t){return!!t.length})).forEach((function(t){const n=t.split(/\s*:\s*/);e[n[0]]=n[1]})),e;if(arguments.length<2){if(Array.isArray(t)){for(const n of t){const t=n;e[n]=this.node.style.getPropertyValue(t)}return e}if("string"==typeof t)return this.node.style.getPropertyValue(t);if("object"==typeof t)for(const n in t)this.node.style.setProperty(n,null==t[n]||F.test(t[n])?"":t[n])}return 2===arguments.length&&this.node.style.setProperty(t,null==n||F.test(n)?"":n),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),e("Dom",{data:function(t,n,e){if(null==t)return this.data(o(function(t,n){let e;const r=t.length,i=[];for(e=0;e0===t.nodeName.indexOf("data-"))),(t=>t.nodeName.slice(5))));if(t instanceof Array){const n={};for(const e of t)n[e]=this.data(e);return n}if("object"==typeof t)for(n in t)this.data(n,t[n]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+t))}catch(r){return this.attr("data-"+t)}else this.attr("data-"+t,null===n?null:!0===e||"string"==typeof n||"number"==typeof n?n:JSON.stringify(n));return this}}),e("Dom",{remember:function(t,n){if("object"==typeof arguments[0])for(const e in t)this.remember(e,t[e]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=n}return this},forget:function(){if(0===arguments.length)this._memory={};else for(let t=arguments.length-1;t>=0;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory=this._memory||{}}});class W{constructor(...t){this.init(...t)}static isColor(t){return t&&(t instanceof W||this.isRgb(t)||this.test(t))}static isRgb(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b}static random(t="vibrant",n){const{random:e,round:r,sin:i,PI:o}=Math;if("vibrant"===t){const t=24*e()+57,n=38*e()+45,r=360*e();return new W(t,n,r,"lch")}if("sine"===t){const t=r(80*i(2*o*(n=null==n?e():n)/.5+.01)+150),u=r(50*i(2*o*n/.5+4.6)+200),s=r(100*i(2*o*n/.5+2.3)+150);return new W(t,u,s)}if("pastel"===t){const t=8*e()+86,n=17*e()+9,r=360*e();return new W(t,n,r,"lch")}if("dark"===t){const t=10+10*e(),n=50*e()+86,r=360*e();return new W(t,n,r,"lch")}if("rgb"===t){const t=255*e(),n=255*e(),r=255*e();return new W(t,n,r)}if("lab"===t){const t=100*e(),n=256*e()-128,r=256*e()-128;return new W(t,n,r,"lab")}if("grey"===t){const t=255*e();return new W(t,t,t)}throw new Error("Unsupported random color mode")}static test(t){return"string"==typeof t&&(D.test(t)||L.test(t))}cmyk(){const{_a:t,_b:n,_c:e}=this.rgb(),[r,i,o]=[t,n,e].map((t=>t/255)),u=Math.min(1-r,1-i,1-o);if(1===u)return new W(0,0,0,1,"cmyk");return new W((1-r-u)/(1-u),(1-i-u)/(1-u),(1-o-u)/(1-u),u,"cmyk")}hsl(){const{_a:t,_b:n,_c:e}=this.rgb(),[r,i,o]=[t,n,e].map((t=>t/255)),u=Math.max(r,i,o),s=Math.min(r,i,o),a=(u+s)/2,c=u===s,h=u-s;return new W(360*(c?0:u===r?((i-o)/h+(i.5?h/(2-u-s):h/(u+s)),100*a,"hsl")}init(t=0,n=0,e=0,r=0,i="rgb"){if(t=t||0,this.space)for(const f in this.space)delete this[this.space[f]];if("number"==typeof t)i="string"==typeof r?r:i,r="string"==typeof r?0:r,Object.assign(this,{_a:t,_b:n,_c:e,_d:r,space:i});else if(t instanceof Array)this.space=n||("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 e=function(t,n){const e=U(t,"rgb")?{_a:t.r,_b:t.g,_c:t.b,_d:0,space:"rgb"}:U(t,"xyz")?{_a:t.x,_b:t.y,_c:t.z,_d:0,space:"xyz"}:U(t,"hsl")?{_a:t.h,_b:t.s,_c:t.l,_d:0,space:"hsl"}:U(t,"lab")?{_a:t.l,_b:t.a,_c:t.b,_d:0,space:"lab"}:U(t,"lch")?{_a:t.l,_b:t.c,_c:t.h,_d:0,space:"lch"}:U(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 e.space=n||e.space,e}(t,n);Object.assign(this,e)}else if("string"==typeof t)if(L.test(t)){const n=t.replace(P,""),[e,r,i]=N.exec(n).slice(1,4).map((t=>parseInt(t)));Object.assign(this,{_a:e,_b:r,_c:i,_d:0,space:"rgb"})}else{if(!D.test(t))throw Error("Unsupported string format, can't construct Color");{const n=t=>parseInt(t,16),[,e,r,i]=I.exec((o=t,4===o.length?["#",o.substring(1,2),o.substring(1,2),o.substring(2,3),o.substring(2,3),o.substring(3,4),o.substring(3,4)].join(""):o)).map(n);Object.assign(this,{_a:e,_b:r,_c:i,_d:0,space:"rgb"})}}var o;const{_a:u,_b:s,_c:a,_d:c}=this,h="rgb"===this.space?{r:u,g:s,b:a}:"xyz"===this.space?{x:u,y:s,z:a}:"hsl"===this.space?{h:u,s:s,l:a}:"lab"===this.space?{l:u,a:s,b:a}:"lch"===this.space?{l:u,c:s,h:a}:"cmyk"===this.space?{c:u,m:s,y:a,k:c}:{};Object.assign(this,h)}lab(){const{x:t,y:n,z:e}=this.xyz();return new W(116*n-16,500*(t-n),200*(n-e),"lab")}lch(){const{l:t,a:n,b:e}=this.lab(),r=Math.sqrt(n**2+e**2);let i=180*Math.atan2(e,n)/Math.PI;i<0&&(i*=-1,i=360-i);return new W(t,r,i,"lch")}rgb(){if("rgb"===this.space)return this;if("lab"===(t=this.space)||"xyz"===t||"lch"===t){let{x:t,y:n,z:e}=this;if("lab"===this.space||"lch"===this.space){let{l:r,a:i,b:o}=this;if("lch"===this.space){const{c:t,h:n}=this,e=Math.PI/180;i=t*Math.cos(e*n),o=t*Math.sin(e*n)}const u=(r+16)/116,s=i/500+u,a=u-o/200,c=16/116,h=.008856,f=7.787;t=.95047*(s**3>h?s**3:(s-c)/f),n=1*(u**3>h?u**3:(u-c)/f),e=1.08883*(a**3>h?a**3:(a-c)/f)}const r=3.2406*t+-1.5372*n+-.4986*e,i=-.9689*t+1.8758*n+.0415*e,o=.0557*t+-.204*n+1.057*e,u=Math.pow,s=.0031308,a=r>s?1.055*u(r,1/2.4)-.055:12.92*r,c=i>s?1.055*u(i,1/2.4)-.055:12.92*i,h=o>s?1.055*u(o,1/2.4)-.055:12.92*o;return new W(255*a,255*c,255*h)}if("hsl"===this.space){let{h:t,s:n,l:e}=this;if(t/=360,n/=100,e/=100,0===n){e*=255;return new W(e,e,e)}const r=e<.5?e*(1+n):e+n-e*n,i=2*e-r,o=255*q(i,r,t+1/3),u=255*q(i,r,t),s=255*q(i,r,t-1/3);return new W(o,u,s)}if("cmyk"===this.space){const{c:t,m:n,y:e,k:r}=this,i=255*(1-Math.min(1,t*(1-r)+r)),o=255*(1-Math.min(1,n*(1-r)+r)),u=255*(1-Math.min(1,e*(1-r)+r));return new W(i,o,u)}return this;var t}toArray(){const{_a:t,_b:n,_c:e,_d:r,space:i}=this;return[t,n,e,r,i]}toHex(){const[t,n,e]=this._clamped().map(Y);return`#${t}${n}${e}`}toRgb(){const[t,n,e]=this._clamped();return`rgb(${t},${n},${e})`}toString(){return this.toHex()}xyz(){const{_a:t,_b:n,_c:e}=this.rgb(),[r,i,o]=[t,n,e].map((t=>t/255)),u=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,s=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92,a=o>.04045?Math.pow((o+.055)/1.055,2.4):o/12.92,c=(.4124*u+.3576*s+.1805*a)/.95047,h=(.2126*u+.7152*s+.0722*a)/1,f=(.0193*u+.1192*s+.9505*a)/1.08883,l=c>.008856?Math.pow(c,1/3):7.787*c+16/116,d=h>.008856?Math.pow(h,1/3):7.787*h+16/116,p=f>.008856?Math.pow(f,1/3):7.787*f+16/116;return new W(l,d,p,"xyz")}_clamped(){const{_a:t,_b:n,_c:e}=this.rgb(),{max:r,min:i,round:o}=Math;return[t,n,e].map((t=>r(0,i(o(t),255))))}}class G{constructor(...t){this.init(...t)}clone(){return new G(this)}init(t,n){const e=0,r=0,i=Array.isArray(t)?{x:t[0],y:t[1]}:"object"==typeof t?{x:t.x,y:t.y}:{x:t,y:n};return this.x=null==i.x?e:i.x,this.y=null==i.y?r:i.y,this}toArray(){return[this.x,this.y]}transform(t){return this.clone().transformO(t)}transformO(t){H.isMatrixLike(t)||(t=new H(t));const{x:n,y:e}=this;return this.x=t.a*n+t.c*e+t.e,this.y=t.b*n+t.d*e+t.f,this}}function Z(t,n,e){return Math.abs(n-t)<1e-6}class H{constructor(...t){this.init(...t)}static formatTransforms(t){const n="both"===t.flip||!0===t.flip,e=t.flip&&(n||"x"===t.flip)?-1:1,r=t.flip&&(n||"y"===t.flip)?-1:1,i=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,o=t.skew&&t.skew.length?t.skew[1]:isFinite(t.skew)?t.skew:isFinite(t.skewY)?t.skewY:0,u=t.scale&&t.scale.length?t.scale[0]*e:isFinite(t.scale)?t.scale*e:isFinite(t.scaleX)?t.scaleX*e:e,s=t.scale&&t.scale.length?t.scale[1]*r:isFinite(t.scale)?t.scale*r:isFinite(t.scaleY)?t.scaleY*r:r,a=t.shear||0,c=t.rotate||t.theta||0,h=new G(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),f=h.x,l=h.y,d=new G(t.position||t.px||t.positionX||NaN,t.py||t.positionY||NaN),p=d.x,v=d.y,g=new G(t.translate||t.tx||t.translateX,t.ty||t.translateY),y=g.x,_=g.y,m=new G(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:u,scaleY:s,skewX:i,skewY:o,shear:a,theta:c,rx:m.x,ry:m.y,tx:y,ty:_,ox:f,oy:l,px:p,py:v}}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 matrixMultiply(t,n,e){const r=t.a*n.a+t.c*n.b,i=t.b*n.a+t.d*n.b,o=t.a*n.c+t.c*n.d,u=t.b*n.c+t.d*n.d,s=t.e+t.a*n.e+t.c*n.f,a=t.f+t.b*n.e+t.d*n.f;return e.a=r,e.b=i,e.c=o,e.d=u,e.e=s,e.f=a,e}around(t,n,e){return this.clone().aroundO(t,n,e)}aroundO(t,n,e){const r=t||0,i=n||0;return this.translateO(-r,-i).lmultiplyO(e).translateO(r,i)}clone(){return new H(this)}decompose(t=0,n=0){const e=this.a,r=this.b,i=this.c,o=this.d,u=this.e,s=this.f,a=e*o-r*i,c=a>0?1:-1,h=c*Math.sqrt(e*e+r*r),f=Math.atan2(c*r,c*e),l=180/Math.PI*f,d=Math.cos(f),p=Math.sin(f),v=(e*i+r*o)/a,g=i*h/(v*e-r)||o*h/(v*r+e);return{scaleX:h,scaleY:g,shear:v,rotate:l,translateX:u-t+t*d*h+n*(v*d*h-p*g),translateY:s-n+t*p*h+n*(v*p*h+d*g),originX:t,originY:n,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}equals(t){if(t===this)return!0;const n=new H(t);return Z(this.a,n.a)&&Z(this.b,n.b)&&Z(this.c,n.c)&&Z(this.d,n.d)&&Z(this.e,n.e)&&Z(this.f,n.f)}flip(t,n){return this.clone().flipO(t,n)}flipO(t,n){return"x"===t?this.scaleO(-1,1,n,0):"y"===t?this.scaleO(1,-1,0,n):this.scaleO(-1,-1,t,n||t)}init(t){const n=H.fromArray([1,0,0,1,0,0]);return t=t instanceof bt?t.matrixify():"string"==typeof t?H.fromArray(t.split(V).map(parseFloat)):Array.isArray(t)?H.fromArray(t):"object"==typeof t&&H.isMatrixLike(t)?t:"object"==typeof t?(new H).transform(t):6===arguments.length?H.fromArray([].slice.call(arguments)):n,this.a=null!=t.a?t.a:n.a,this.b=null!=t.b?t.b:n.b,this.c=null!=t.c?t.c:n.c,this.d=null!=t.d?t.d:n.d,this.e=null!=t.e?t.e:n.e,this.f=null!=t.f?t.f:n.f,this}inverse(){return this.clone().inverseO()}inverseO(){const t=this.a,n=this.b,e=this.c,r=this.d,i=this.e,o=this.f,u=t*r-n*e;if(!u)throw new Error("Cannot invert "+this);const s=r/u,a=-n/u,c=-e/u,h=t/u,f=-(s*i+c*o),l=-(a*i+h*o);return this.a=s,this.b=a,this.c=c,this.d=h,this.e=f,this.f=l,this}lmultiply(t){return this.clone().lmultiplyO(t)}lmultiplyO(t){const n=t instanceof H?t:new H(t);return H.matrixMultiply(n,this,this)}multiply(t){return this.clone().multiplyO(t)}multiplyO(t){const n=t instanceof H?t:new H(t);return H.matrixMultiply(this,n,this)}rotate(t,n,e){return this.clone().rotateO(t,n,e)}rotateO(t,n=0,e=0){t=u(t);const r=Math.cos(t),i=Math.sin(t),{a:o,b:s,c:a,d:c,e:h,f:f}=this;return this.a=o*r-s*i,this.b=s*r+o*i,this.c=a*r-c*i,this.d=c*r+a*i,this.e=h*r-f*i+e*i-n*r+n,this.f=f*r+h*i-n*i-e*r+e,this}scale(){return this.clone().scaleO(...arguments)}scaleO(t,n=t,e=0,r=0){3===arguments.length&&(r=e,e=n,n=t);const{a:i,b:o,c:u,d:s,e:a,f:c}=this;return this.a=i*t,this.b=o*n,this.c=u*t,this.d=s*n,this.e=a*t-e*t+e,this.f=c*n-r*n+r,this}shear(t,n,e){return this.clone().shearO(t,n,e)}shearO(t,n=0,e=0){const{a:r,b:i,c:o,d:u,e:s,f:a}=this;return this.a=r+i*t,this.c=o+u*t,this.e=s+a*t-e*t,this}skew(){return this.clone().skewO(...arguments)}skewO(t,n=t,e=0,r=0){3===arguments.length&&(r=e,e=n,n=t),t=u(t),n=u(n);const i=Math.tan(t),o=Math.tan(n),{a:s,b:a,c:c,d:h,e:f,f:l}=this;return this.a=s+a*i,this.b=a+s*o,this.c=c+h*i,this.d=h+c*o,this.e=f+l*i-r*i,this.f=l+f*o-e*o,this}skewX(t,n,e){return this.skew(t,0,n,e)}skewY(t,n,e){return this.skew(0,t,n,e)}toArray(){return[this.a,this.b,this.c,this.d,this.e,this.f]}toString(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"}transform(t){if(H.isMatrixLike(t)){return new H(t).multiplyO(this)}const n=H.formatTransforms(t),{x:e,y:r}=new G(n.ox,n.oy).transform(this),i=(new H).translateO(n.rx,n.ry).lmultiplyO(this).translateO(-e,-r).scaleO(n.scaleX,n.scaleY).skewO(n.skewX,n.skewY).shearO(n.shear).rotateO(n.theta).translateO(e,r);if(isFinite(n.px)||isFinite(n.py)){const t=new G(e,r).transform(i),o=isFinite(n.px)?n.px-t.x:0,u=isFinite(n.py)?n.py-t.y:0;i.translateO(o,u)}return i.translateO(n.tx,n.ty),i}translate(t,n){return this.clone().translateO(t,n)}translateO(t,n){return this.e+=t||0,this.f+=n||0,this}valueOf(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}}function Q(){if(!Q.nodes){const t=b().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 n=t.path().node;Q.nodes={svg:t,path:n}}if(!Q.nodes.svg.node.parentNode){const t=g.document.body||g.document.documentElement;Q.nodes.svg.addTo(t)}return Q.nodes}function J(t){return!(t.width||t.height||t.x||t.y)}A(H,"Matrix");class K{constructor(...t){this.init(...t)}addOffset(){return this.x+=g.window.pageXOffset,this.y+=g.window.pageYOffset,new K(this)}init(t){return t="string"==typeof t?t.split(V).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}isNulled(){return J(this)}merge(t){const n=Math.min(this.x,t.x),e=Math.min(this.y,t.y),r=Math.max(this.x+this.width,t.x+t.width)-n,i=Math.max(this.y+this.height,t.y+t.height)-e;return new K(n,e,r,i)}toArray(){return[this.x,this.y,this.width,this.height]}toString(){return this.x+" "+this.y+" "+this.width+" "+this.height}transform(t){t instanceof H||(t=new H(t));let n=1/0,e=-1/0,r=1/0,i=-1/0;return[new G(this.x,this.y),new G(this.x2,this.y),new G(this.x,this.y2),new G(this.x2,this.y2)].forEach((function(o){o=o.transform(t),n=Math.min(n,o.x),e=Math.max(e,o.x),r=Math.min(r,o.y),i=Math.max(i,o.y)})),new K(n,r,e-n,i-r)}}function tt(t,n,e){let r;try{if(r=n(t.node),J(r)&&((i=t.node)!==g.document&&!(g.document.documentElement.contains||function(t){for(;t.parentNode;)t=t.parentNode;return t===g.document}).call(g.document.documentElement,i)))throw new Error("Element not in the dom")}catch(o){r=e(t)}var i;return r}e({viewbox:{viewbox(t,n,e,r){return null==t?new K(this.attr("viewBox")):this.attr("viewBox",new K(t,n,e,r))},zoom(t,n){let{width:e,height:r}=this.attr(["width","height"]);if((e||r)&&"string"!=typeof e&&"string"!=typeof r||(e=this.node.clientWidth,r=this.node.clientHeight),!e||!r)throw new Error("Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element");const i=this.viewbox(),o=e/i.width,u=r/i.height,s=Math.min(o,u);if(null==t)return s;let a=s/t;a===1/0&&(a=Number.MAX_SAFE_INTEGER/100),n=n||new G(e/2/o+i.x,r/2/u+i.y);const c=new K(i).transform(new H({scale:a,origin:n}));return this.viewbox(c)}}}),A(K,"Box");class nt extends Array{constructor(t=[],...n){if(super(t,...n),"number"==typeof t)return this;this.length=0,this.push(...t)}}k([nt],{each(t,...n){return"function"==typeof t?this.map(((n,e,r)=>t.call(n,n,e,r))):this.map((e=>e[t](...n)))},toArray(){return Array.prototype.concat.apply([],this)}});const et=["toArray","constructor","each"];function rt(t,n){return new nt(o((n||g.document).querySelectorAll(t),(function(t){return E(t)})))}nt.extend=function(t){t=t.reduce(((t,n)=>(et.includes(n)||"_"===n[0]||(n in Array.prototype&&(t["$"+n]=Array.prototype[n]),t[n]=function(...t){return this.each(n,...t)}),t)),{}),k([nt],t)};let it=0;const ot={};function ut(t){let n=t.getEventHolder();return n===g.window&&(n=ot),n.events||(n.events={}),n.events}function st(t){return t.getEventTarget()}function at(t,n,e,r,i){const o=e.bind(r||t),u=b(t),s=ut(u),a=st(u);n=Array.isArray(n)?n:n.split(V),e._svgjsListenerId||(e._svgjsListenerId=++it),n.forEach((function(t){const n=t.split(".")[0],r=t.split(".")[1]||"*";s[n]=s[n]||{},s[n][r]=s[n][r]||{},s[n][r][e._svgjsListenerId]=o,a.addEventListener(n,o,i||!1)}))}function ct(t,n,e,r){const i=b(t),o=ut(i),u=st(i);("function"!=typeof e||(e=e._svgjsListenerId))&&(n=Array.isArray(n)?n:(n||"").split(V)).forEach((function(t){const n=t&&t.split(".")[0],s=t&&t.split(".")[1];let a,c;if(e)o[n]&&o[n][s||"*"]&&(u.removeEventListener(n,o[n][s||"*"][e],r||!1),delete o[n][s||"*"][e]);else if(n&&s){if(o[n]&&o[n][s]){for(c in o[n][s])ct(u,[n,s].join("."),c);delete o[n][s]}}else if(s)for(t in o)for(a in o[t])s===a&&ct(u,[t,s].join("."));else if(n){if(o[n]){for(a in o[n])ct(u,[n,a].join("."));delete o[n]}}else{for(t in o)ct(u,t);!function(t){let n=t.getEventHolder();n===g.window&&(n=ot),n.events&&(n.events={})}(i)}}))}class ht extends y{addEventListener(){}dispatch(t,n,e){return function(t,n,e,r){const i=st(t);return n instanceof g.window.Event||(n=new g.window.CustomEvent(n,{detail:e,cancelable:!0,...r})),i.dispatchEvent(n),n}(this,t,n,e)}dispatchEvent(t){const n=this.getEventHolder().events;if(!n)return!0;const e=n[t.type];for(const r in e)for(const n in e[r])e[r][n](t);return!t.defaultPrevented}fire(t,n,e){return this.dispatch(t,n,e),this}getEventHolder(){return this}getEventTarget(){return this}off(t,n,e){return ct(this,t,n,e),this}on(t,n,e,r){return at(this,t,n,e,r),this}removeEventListener(){}}function ft(){}A(ht,"EventTarget");const lt=400,dt=">",pt=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"};class gt extends Array{constructor(...t){super(...t),this.init(...t)}clone(){return new this.constructor(this)}init(t){return"number"==typeof t||(this.length=0,this.push(...this.parse(t))),this}parse(t=[]){return t instanceof Array?t:t.trim().split(V).map(parseFloat)}toArray(){return Array.prototype.concat.apply([],this)}toSet(){return new Set(this)}toString(){return this.join(" ")}valueOf(){const t=[];return t.push(...this),t}}class yt{constructor(...t){this.init(...t)}convert(t){return new yt(this.value,t)}divide(t){return t=new yt(t),new yt(this/t,this.unit||t.unit)}init(t,n){return n=Array.isArray(t)?t[1]:n,t=Array.isArray(t)?t[0]:t,this.value=0,this.unit=n||"","number"==typeof t?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-34e37:34e37:"string"==typeof t?(n=t.match(T))&&(this.value=parseFloat(n[1]),"%"===n[5]?this.value/=100:"s"===n[5]&&(this.value*=1e3),this.unit=n[5]):t instanceof yt&&(this.value=t.valueOf(),this.unit=t.unit),this}minus(t){return t=new yt(t),new yt(this-t,this.unit||t.unit)}plus(t){return t=new yt(t),new yt(this+t,this.unit||t.unit)}times(t){return t=new yt(t),new yt(this*t,this.unit||t.unit)}toArray(){return[this.value,this.unit]}toJSON(){return this.toString()}toString(){return("%"===this.unit?~~(1e8*this.value)/1e6:"s"===this.unit?this.value/1e3:this.value)+this.unit}valueOf(){return this.value}}const _t=new Set(["fill","stroke","color","bgcolor","stop-color","flood-color","lighting-color"]),mt=[];class wt extends ht{constructor(t,n){super(),this.node=t,this.type=t.nodeName,n&&t!==n&&this.attr(n)}add(t,n){return(t=b(t)).removeNamespace&&this.node instanceof g.window.SVGElement&&t.removeNamespace(),null==n?this.node.appendChild(t.node):t.node!==this.node.childNodes[n]&&this.node.insertBefore(t.node,this.node.childNodes[n]),this}addTo(t,n){return b(t).put(this,n)}children(){return new nt(o(this.node.children,(function(t){return E(t)})))}clear(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}clone(t=!0,n=!0){this.writeDataToDom();let e=this.node.cloneNode(t);return n&&(e=S(e)),new this.constructor(e)}each(t,n){const e=this.children();let r,i;for(r=0,i=e.length;r=0}html(t,n){return this.xml(t,n,"http://www.w3.org/1999/xhtml")}id(t){return void 0!==t||this.node.id||(this.node.id=M(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 n=this.node,e=n.matches||n.matchesSelector||n.msMatchesSelector||n.mozMatchesSelector||n.webkitMatchesSelector||n.oMatchesSelector||null;return e&&e.call(n,t)}parent(t){let n=this;if(!n.node.parentNode)return null;if(n=E(n.node.parentNode),!t)return n;do{if("string"==typeof t?n.matches(t):n instanceof t)return n}while(n=E(n.node.parentNode));return n}put(t,n){return t=b(t),this.add(t,n),t}putIn(t,n){return b(t).add(this,n)}remove(){return this.parent()&&this.parent().removeElement(this),this}removeElement(t){return this.node.removeChild(t.node),this}replace(t){return t=b(t),this.node.parentNode&&this.node.parentNode.replaceChild(t.node,this.node),t}round(t=2,n=null){const e=10**t,r=this.attr(n);for(const i in r)"number"==typeof r[i]&&(r[i]=Math.round(r[i]*e)/e);return this.attr(r),this}svg(t,n){return this.xml(t,n,d)}toString(){return this.id()}words(t){return this.node.textContent=t,this}wrap(t){const n=this.parent();if(!n)return this.addTo(t);const e=n.index(this);return n.put(t,e).put(this)}writeDataToDom(){return this.each((function(){this.writeDataToDom()})),this}xml(t,n,e){if("boolean"==typeof t&&(e=n,n=t,t=null),null==t||"function"==typeof t){n=null==n||n,this.writeDataToDom();let e=this;if(null!=t){if(e=E(e.node.cloneNode(!0)),n){const n=t(e);if(e=n||e,!1===n)return""}e.each((function(){const n=t(this),e=n||this;!1===n?this.remove():n&&this!==e&&this.replace(e)}),!0)}return n?e.node.outerHTML:e.node.innerHTML}n=null!=n&&n;const r=w("wrapper",e),i=g.document.createDocumentFragment();r.innerHTML=t;for(let u=r.children.length;u--;)i.appendChild(r.firstElementChild);const o=this.parent();return n?this.replace(i)&&o:this.add(i)}}k(wt,{attr:function(t,n,e){if(null==t){t={},n=this.node.attributes;for(const e of n)t[e.nodeName]=B.test(e.nodeValue)?parseFloat(e.nodeValue):e.nodeValue;return t}if(t instanceof Array)return t.reduce(((t,n)=>(t[n]=this.attr(n),t)),{});if("object"==typeof t&&t.constructor===Object)for(n in t)this.attr(n,t[n]);else if(null===n)this.node.removeAttribute(t);else{if(null==n)return null==(n=this.node.getAttribute(t))?vt[t]:B.test(n)?parseFloat(n):n;"number"==typeof(n=mt.reduce(((n,e)=>e(t,n,this)),n))?n=new yt(n):_t.has(t)&&W.isColor(n)?n=new W(n):n.constructor===Array&&(n=new gt(n)),"leading"===t?this.leading&&this.leading(n):"string"==typeof e?this.node.setAttributeNS(e,t,n.toString()):this.node.setAttribute(t,n.toString()),!this.rebuild||"font-size"!==t&&"x"!==t||this.rebuild()}return this},find:function(t){return rt(t,this.node)},findOne:function(t){return E(this.node.querySelector(t))}}),A(wt,"Dom");class bt extends wt{constructor(t,n){super(t,n),this.dom={},this.node.instance=this,(t.hasAttribute("data-svgjs")||t.hasAttribute("svgjs:data"))&&this.setData(JSON.parse(t.getAttribute("data-svgjs"))??JSON.parse(t.getAttribute("svgjs:data"))??{})}center(t,n){return this.cx(t).cy(n)}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(){const t=this.root();return t&&t.defs()}dmove(t,n){return this.dx(t).dy(n)}dx(t=0){return this.x(new yt(t).plus(this.x()))}dy(t=0){return this.y(new yt(t).plus(this.y()))}getEventHolder(){return this}height(t){return this.attr("height",t)}move(t,n){return this.x(t).y(n)}parents(t=this.root()){const n="string"==typeof t;n||(t=b(t));const e=new nt;let r=this;for(;(r=r.parent())&&r.node!==g.document&&"#document-fragment"!==r.nodeName&&(e.push(r),n||r.node!==t.node)&&(!n||!r.matches(t));)if(r.node===this.root().node)return null;return e}reference(t){if(!(t=this.attr(t)))return null;const n=(t+"").match(R);return n?b(n[1]):null}root(){const t=this.parent(_[m]);return t&&t.root()}setData(t){return this.dom=t,this}size(t,n){const e=a(this,t,n);return this.width(new yt(e.width)).height(new yt(e.height))}width(t){return this.attr("width",t)}writeDataToDom(){return l(this,this.dom),super.writeDataToDom()}x(t){return this.attr("x",t)}y(t){return this.attr("y",t)}}k(bt,{bbox:function(){const t=tt(this,(t=>t.getBBox()),(t=>{try{const n=t.clone().addTo(Q().svg).show(),e=n.node.getBBox();return n.remove(),e}catch(n){throw new Error(`Getting bbox of element "${t.node.nodeName}" is not possible: ${n.toString()}`)}}));return new K(t)},rbox:function(t){const n=tt(this,(t=>t.getBoundingClientRect()),(t=>{throw new Error(`Getting rbox of element "${t.node.nodeName}" is not possible`)})),e=new K(n);return t?e.transform(t.screenCTM().inverseO()):e.addOffset()},inside:function(t,n){const e=this.bbox();return t>e.x&&n>e.y&&t=0;r--)null!=n[xt[t][r]]&&this.attr(xt.prefix(t,xt[t][r]),n[xt[t][r]]);return this},e(["Element","Runner"],n)})),e(["Element","Runner"],{matrix:function(t,n,e,r,i,o){return null==t?new H(this):this.attr("transform",new H(t,n,e,r,i,o))},rotate:function(t,n,e){return this.transform({rotate:t,ox:n,oy:e},!0)},skew:function(t,n,e,r){return 1===arguments.length||3===arguments.length?this.transform({skew:t,ox:n,oy:e},!0):this.transform({skew:[t,n],ox:e,oy:r},!0)},shear:function(t,n,e){return this.transform({shear:t,ox:n,oy:e},!0)},scale:function(t,n,e,r){return 1===arguments.length||3===arguments.length?this.transform({scale:t,ox:n,oy:e},!0):this.transform({scale:[t,n],ox:e,oy:r},!0)},translate:function(t,n){return this.transform({translate:[t,n]},!0)},relative:function(t,n){return this.transform({relative:[t,n]},!0)},flip:function(t="both",n="center"){return-1==="xybothtrue".indexOf(t)&&(n=t,t="both"),this.transform({flip:t,origin:n},!0)},opacity:function(t){return this.attr("opacity",t)}}),e("radius",{radius:function(t,n=t){return"radialGradient"===(this._element||this).type?this.attr("r",new yt(t)):this.rx(t).ry(n)}}),e("Path",{length:function(){return this.node.getTotalLength()},pointAt:function(t){return new G(this.node.getPointAtLength(t))}}),e(["Element","Runner"],{font:function(t,n){if("object"==typeof t){for(n in t)this.font(n,t[n]);return this}return"leading"===t?this.leading(n):"anchor"===t?this.attr("text-anchor",n):"size"===t||"family"===t||"weight"===t||"stretch"===t||"variant"===t||"style"===t?this.attr("font-"+t,n):this.attr(t,n)}});e("Element",["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","touchstart","touchmove","touchleave","touchend","touchcancel","contextmenu","wheel","pointerdown","pointermove","pointerup","pointerleave","pointercancel"].reduce((function(t,n){return t[n]=function(t){return null===t?this.off(n):this.on(n,t),this},t}),{})),e("Element",{untransform:function(){return this.attr("transform",null)},matrixify:function(){return(this.attr("transform")||"").split(z).slice(0,-1).map((function(t){const n=t.trim().split("(");return[n[0],n[1].split(V).map((function(t){return parseFloat(t)}))]})).reverse().reduce((function(t,n){return"matrix"===n[0]?t.lmultiply(H.fromArray(n[1])):t[n[0]].apply(t,n[1])}),new H)},toParent:function(t,n){if(this===t)return this;if(f(this.node))return this.addTo(t,n);const e=this.screenCTM(),r=t.screenCTM().inverse();return this.addTo(t,n).untransform().transform(r.multiply(e)),this},toRoot:function(t){return this.toParent(this.root(),t)},transform:function(t,n){if(null==t||"string"==typeof t){const n=new H(this).decompose();return null==t?n:n[t]}H.isMatrixLike(t)||(t={...t,origin:c(t,this)});const e=new H(!0===n?this:n||!1).transform(t);return this.attr("transform",e)}});class Et extends bt{flatten(){return this.each((function(){if(this instanceof Et)return this.flatten().ungroup()})),this}ungroup(t=this.parent(),n=t.index(this)){return n=-1===n?t.children().length:n,this.each((function(e,r){return r[r.length-e-1].toParent(t,n)})),this.remove()}}A(Et,"Container");class jt extends Et{constructor(t,n=t){super(x("defs",t),n)}flatten(){return this}ungroup(){return this}}A(jt,"Defs");class At extends bt{}function Ot(t){return this.attr("rx",t)}function Mt(t){return this.attr("ry",t)}function St(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())}function kt(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())}function Ct(t){return this.attr("cx",t)}function Tt(t){return this.attr("cy",t)}function It(t){return null==t?2*this.rx():this.rx(new yt(t).divide(2))}function Nt(t){return null==t?2*this.ry():this.ry(new yt(t).divide(2))}A(At,"Shape");const Rt=Object.freeze(Object.defineProperty({__proto__:null,cx:Ct,cy:Tt,height:Nt,rx:Ot,ry:Mt,width:It,x:St,y:kt},Symbol.toStringTag,{value:"Module"}));class zt extends At{constructor(t,n=t){super(x("ellipse",t),n)}size(t,n){const e=a(this,t,n);return this.rx(new yt(e.width).divide(2)).ry(new yt(e.height).divide(2))}}k(zt,Rt),e("Container",{ellipse:C((function(t=0,n=t){return this.put(new zt).size(t,n).move(0,0)}))}),A(zt,"Ellipse");class Pt extends wt{constructor(t=g.document.createDocumentFragment()){super(t)}xml(t,n,e){if("boolean"==typeof t&&(e=n,n=t,t=null),null==t||"function"==typeof t){const t=new wt(w("wrapper",e));return t.add(this.node.cloneNode(!0)),t.xml(!1,e)}return super.xml(t,!1,e)}}function Dt(t,n){return"radialGradient"===(this._element||this).type?this.attr({fx:new yt(t),fy:new yt(n)}):this.attr({x1:new yt(t),y1:new yt(n)})}function Lt(t,n){return"radialGradient"===(this._element||this).type?this.attr({cx:new yt(t),cy:new yt(n)}):this.attr({x2:new yt(t),y2:new yt(n)})}A(Pt,"Fragment");const Ft=Object.freeze(Object.defineProperty({__proto__:null,from:Dt,to:Lt},Symbol.toStringTag,{value:"Module"}));class Bt extends Et{constructor(t,n){super(x(t+"Gradient","string"==typeof t?null:t),n)}attr(t,n,e){return"transform"===t&&(t="gradientTransform"),super.attr(t,n,e)}bbox(){return new K}targets(){return rt("svg [fill*="+this.id()+"]")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}}k(Bt,Ft),e({Container:{gradient(...t){return this.defs().gradient(...t)}},Defs:{gradient:C((function(t,n){return this.put(new Bt(t)).update(n)}))}}),A(Bt,"Gradient");class $t extends Et{constructor(t,n=t){super(x("pattern",t),n)}attr(t,n,e){return"transform"===t&&(t="patternTransform"),super.attr(t,n,e)}bbox(){return new K}targets(){return rt("svg [fill*="+this.id()+"]")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}}e({Container:{pattern(...t){return this.defs().pattern(...t)}},Defs:{pattern:C((function(t,n,e){return this.put(new $t).update(e).attr({x:0,y:0,width:t,height:n,patternUnits:"userSpaceOnUse"})}))}}),A($t,"Pattern");class Vt extends At{constructor(t,n=t){super(x("image",t),n)}load(t,n){if(!t)return this;const e=new g.window.Image;return at(e,"load",(function(t){const r=this.parent($t);0===this.width()&&0===this.height()&&this.size(e.width,e.height),r instanceof $t&&0===r.width()&&0===r.height()&&r.size(this.width(),this.height()),"function"==typeof n&&n.call(this,t)}),this),at(e,"load error",(function(){ct(e)})),this.attr("href",e.src=t,v)}}var Xt;Xt=function(t,n,e){return"fill"!==t&&"stroke"!==t||$.test(n)&&(n=e.root().defs().image(n)),n instanceof Vt&&(n=e.root().defs().pattern(0,0,(t=>{t.add(n)}))),n},mt.push(Xt),e({Container:{image:C((function(t,n){return this.put(new Vt).size(0,0).load(t,n)}))}}),A(Vt,"Image");class Yt extends gt{bbox(){let t=-1/0,n=-1/0,e=1/0,r=1/0;return this.forEach((function(i){t=Math.max(i[0],t),n=Math.max(i[1],n),e=Math.min(i[0],e),r=Math.min(i[1],r)})),new K(e,r,t-e,n-r)}move(t,n){const e=this.bbox();if(t-=e.x,n-=e.y,!isNaN(t)&&!isNaN(n))for(let r=this.length-1;r>=0;r--)this[r]=[this[r][0]+t,this[r][1]+n];return this}parse(t=[0,0]){const n=[];(t=t instanceof Array?Array.prototype.concat.apply([],t):t.trim().split(V).map(parseFloat)).length%2!=0&&t.pop();for(let e=0,r=t.length;e=0;e--)r.width&&(this[e][0]=(this[e][0]-r.x)*t/r.width+r.x),r.height&&(this[e][1]=(this[e][1]-r.y)*n/r.height+r.y);return this}toLine(){return{x1:this[0][0],y1:this[0][1],x2:this[1][0],y2:this[1][1]}}toString(){const t=[];for(let n=0,e=this.length;n":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,n,e,r){return function(i){return i<0?t>0?n/t*i:e>0?r/e*i:0:i>1?e<1?(1-r)/(1-e)*i+(r-e)/(1-e):t<1?(1-n)/(1-t)*i+(n-t)/(1-t):1:3*i*(1-i)**2*n+3*i**2*(1-i)*r+i**3}},steps:function(t,n="end"){n=n.split("-").reverse()[0];let e=t;return"none"===n?--e:"both"===n&&++e,(r,i=!1)=>{let o=Math.floor(r*t);const u=r*o%1==0;return"start"!==n&&"both"!==n||++o,i&&u&&--o,r>=0&&o<0&&(o=0),r<=1&&o>e&&(o=e),o/e}}};class Qt{done(){return!1}}class Jt extends Qt{constructor(t=dt){super(),this.ease=Ht[t]||t}step(t,n,e){return"number"!=typeof t?e<1?t:n:t+(n-t)*this.ease(e)}}class Kt extends Qt{constructor(t){super(),this.stepper=t}done(t){return t.done}step(t,n,e,r){return this.stepper(t,n,e,r)}}function tn(){const t=(this._duration||500)/1e3,n=this._overshoot||0,e=Math.PI,r=Math.log(n/100+1e-10),i=-r/Math.sqrt(e*e+r*r),o=3.9/(i*t);this.d=2*i*o,this.k=o*o}k(class extends Kt{constructor(t=500,n=0){super(),this.duration(t).overshoot(n)}step(t,n,e,r){if("string"==typeof t)return t;if(r.done=e===1/0,e===1/0)return n;if(0===e)return t;e>100&&(e=16),e/=1e3;const i=r.velocity||0,o=-this.d*i-this.k*(t-n),u=t+i*e+o*e*e/2;return r.velocity=i+o*e,r.done=Math.abs(n-u)+Math.abs(i)<.002,r.done?n:u}},{duration:Zt("_duration",tn),overshoot:Zt("_overshoot",tn)});k(class extends Kt{constructor(t=.1,n=.01,e=0,r=1e3){super(),this.p(t).i(n).d(e).windup(r)}step(t,n,e,r){if("string"==typeof t)return t;if(r.done=e===1/0,e===1/0)return n;if(0===e)return t;const i=n-t;let o=(r.integral||0)+i*e;const u=(i-(r.error||0))/e,s=this._windup;return!1!==s&&(o=Math.max(-s,Math.min(o,s))),r.error=i,r.integral=o,r.done=Math.abs(i)<.001,r.done?n:t+(this.P*i+this.I*o+this.D*u)}},{windup:Zt("_windup"),p:Zt("P"),i:Zt("I"),d:Zt("D")});const nn={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},en={M:function(t,n,e){return n.x=e.x=t[0],n.y=e.y=t[1],["M",n.x,n.y]},L:function(t,n){return n.x=t[0],n.y=t[1],["L",t[0],t[1]]},H:function(t,n){return n.x=t[0],["H",t[0]]},V:function(t,n){return n.y=t[0],["V",t[0]]},C:function(t,n){return n.x=t[4],n.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,n){return n.x=t[2],n.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,n){return n.x=t[2],n.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,n){return n.x=t[0],n.y=t[1],["T",t[0],t[1]]},Z:function(t,n,e){return n.x=e.x,n.y=e.y,["Z"]},A:function(t,n){return n.x=t[5],n.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},rn="mlhvqtcsaz".split("");for(let $l=0,Vl=rn.length;$l=0;i--)r=this[i][0],"M"===r||"L"===r||"T"===r?(this[i][1]+=t,this[i][2]+=n):"H"===r?this[i][1]+=t:"V"===r?this[i][1]+=n:"C"===r||"S"===r||"Q"===r?(this[i][1]+=t,this[i][2]+=n,this[i][3]+=t,this[i][4]+=n,"C"===r&&(this[i][5]+=t,this[i][6]+=n)):"A"===r&&(this[i][6]+=t,this[i][7]+=n);return this}parse(t="M0 0"){return Array.isArray(t)&&(t=Array.prototype.concat.apply([],t).toString()),function(t,n=!0){let e=0,r="";const i={segment:[],inNumber:!1,number:"",lastToken:"",inSegment:!1,segments:[],pointSeen:!1,hasExponent:!1,absolute:n,p0:new G,p:new G};for(;i.lastToken=r,r=t.charAt(e++);)if(i.inSegment||!un(i,r))if("."!==r)if(isNaN(parseInt(r)))if(fn.has(r))i.inNumber&&sn(i,!1);else if("-"!==r&&"+"!==r)if("E"!==r.toUpperCase()){if(X.test(r)){if(i.inNumber)sn(i,!1);else{if(!on(i))throw new Error("parser Error");an(i)}--e}}else i.number+=r,i.hasExponent=!0;else{if(i.inNumber&&!hn(i)){sn(i,!1),--e;continue}i.number+=r,i.inNumber=!0}else{if("0"===i.number||cn(i)){i.inNumber=!0,i.number=r,sn(i,!0);continue}i.inNumber=!0,i.number+=r}else{if(i.pointSeen||i.hasExponent){sn(i,!1),--e;continue}i.inNumber=!0,i.pointSeen=!0,i.number+=r}return i.inNumber&&sn(i,!1),i.inSegment&&on(i)&&an(i),i.segments}(t)}size(t,n){const e=this.bbox();let r,i;for(e.width=0===e.width?1:e.width,e.height=0===e.height?1:e.height,r=this.length-1;r>=0;r--)i=this[r][0],"M"===i||"L"===i||"T"===i?(this[r][1]=(this[r][1]-e.x)*t/e.width+e.x,this[r][2]=(this[r][2]-e.y)*n/e.height+e.y):"H"===i?this[r][1]=(this[r][1]-e.x)*t/e.width+e.x:"V"===i?this[r][1]=(this[r][1]-e.y)*n/e.height+e.y:"C"===i||"S"===i||"Q"===i?(this[r][1]=(this[r][1]-e.x)*t/e.width+e.x,this[r][2]=(this[r][2]-e.y)*n/e.height+e.y,this[r][3]=(this[r][3]-e.x)*t/e.width+e.x,this[r][4]=(this[r][4]-e.y)*n/e.height+e.y,"C"===i&&(this[r][5]=(this[r][5]-e.x)*t/e.width+e.x,this[r][6]=(this[r][6]-e.y)*n/e.height+e.y)):"A"===i&&(this[r][1]=this[r][1]*t/e.width,this[r][2]=this[r][2]*n/e.height,this[r][6]=(this[r][6]-e.x)*t/e.width+e.x,this[r][7]=(this[r][7]-e.y)*n/e.height+e.y);return this}toString(){return function(t){let n="";for(let e=0,r=t.length;e{const n=typeof t;return"number"===n?yt:"string"===n?W.isColor(t)?W:V.test(t)?X.test(t)?ln:gt:T.test(t)?yt:vn:mn.indexOf(t.constructor)>-1?t.constructor:Array.isArray(t)?gt:"object"===n?_n:vn};class pn{constructor(t){this._stepper=t||new Jt("-"),this._from=null,this._to=null,this._type=null,this._context=null,this._morphObj=null}at(t){return this._morphObj.morph(this._from,this._to,t,this._stepper,this._context)}done(){return this._context.map(this._stepper.done).reduce((function(t,n){return t&&n}),!0)}from(t){return null==t?this._from:(this._from=this._set(t),this)}stepper(t){return null==t?this._stepper:(this._stepper=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){this._type||this.type(dn(t));let n=new this._type(t);return this._type===W&&(n=this._to?n[this._to[4]]():this._from?n[this._from[4]]():n),this._type===_n&&(n=this._to?n.align(this._to):this._from?n.align(this._from):n),n=n.toConsumable(),this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(n.length)).map(Object).map((function(t){return t.done=!0,t})),n}}class vn{constructor(...t){this.init(...t)}init(t){return t=Array.isArray(t)?t[0]:t,this.value=t,this}toArray(){return[this.value]}valueOf(){return this.value}}class gn{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,gn.defaults,t),this}toArray(){const t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}}gn.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0};const yn=(t,n)=>t[0]n[0]?1:0;class _n{constructor(...t){this.init(...t)}align(t){const n=this.values;for(let e=0,r=n.length;et.concat(n)),[]),this}toArray(){return this.values}valueOf(){const t={},n=this.values;for(;n.length;){const e=n.shift(),r=n.shift(),i=n.shift(),o=n.splice(0,i);t[e]=new r(o)}return t}}const mn=[vn,gn,_n];class wn extends At{constructor(t,n=t){super(x("path",t),n)}array(){return this._array||(this._array=new ln(this.attr("d")))}clear(){return delete this._array,this}height(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}move(t,n){return this.attr("d",this.array().move(t,n))}plot(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new ln(t))}size(t,n){const e=a(this,t,n);return this.attr("d",this.array().size(e.width,e.height))}width(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)}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)}}wn.prototype.MorphArray=ln,e({Container:{path:C((function(t){return this.put(new wn).plot(t||new ln)}))}}),A(wn,"Path");const bn=Object.freeze(Object.defineProperty({__proto__:null,array:function(){return this._array||(this._array=new Yt(this.attr("points")))},clear:function(){return delete this._array,this},move:function(t,n){return this.attr("points",this.array().move(t,n))},plot:function(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new Yt(t))},size:function(t,n){const e=a(this,t,n);return this.attr("points",this.array().size(e.width,e.height))}},Symbol.toStringTag,{value:"Module"}));class xn extends At{constructor(t,n=t){super(x("polygon",t),n)}}e({Container:{polygon:C((function(t){return this.put(new xn).plot(t||new Yt)}))}}),k(xn,qt),k(xn,bn),A(xn,"Polygon");class En extends At{constructor(t,n=t){super(x("polyline",t),n)}}e({Container:{polyline:C((function(t){return this.put(new En).plot(t||new Yt)}))}}),k(En,qt),k(En,bn),A(En,"Polyline");class jn extends At{constructor(t,n=t){super(x("rect",t),n)}}k(jn,{rx:Ot,ry:Mt}),e({Container:{rect:C((function(t,n){return this.put(new jn).size(t,n)}))}}),A(jn,"Rect");class An{constructor(){this._first=null,this._last=null}first(){return this._first&&this._first.value}last(){return this._last&&this._last.value}push(t){const n=void 0!==t.next?t:{value:t,next:null,prev:null};return this._last?(n.prev=this._last,this._last.next=n,this._last=n):(this._last=n,this._first=n),n}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}shift(){const 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}}const On={nextDraw:null,frames:new An,timeouts:new An,immediates:new An,timer:()=>g.window.performance||g.window.Date,transforms:[],frame(t){const n=On.frames.push({run:t});return null===On.nextDraw&&(On.nextDraw=g.window.requestAnimationFrame(On._draw)),n},timeout(t,n){n=n||0;const e=On.timer().now()+n,r=On.timeouts.push({run:t,time:e});return null===On.nextDraw&&(On.nextDraw=g.window.requestAnimationFrame(On._draw)),r},immediate(t){const n=On.immediates.push(t);return null===On.nextDraw&&(On.nextDraw=g.window.requestAnimationFrame(On._draw)),n},cancelFrame(t){null!=t&&On.frames.remove(t)},clearTimeout(t){null!=t&&On.timeouts.remove(t)},cancelImmediate(t){null!=t&&On.immediates.remove(t)},_draw(t){let n=null;const e=On.timeouts.last();for(;(n=On.timeouts.shift())&&(t>=n.time?n.run():On.timeouts.push(n),n!==e););let r=null;const i=On.frames.last();for(;r!==i&&(r=On.frames.shift());)r.run(t);let o=null;for(;o=On.immediates.shift();)o();On.nextDraw=On.timeouts.first()||On.frames.first()?g.window.requestAnimationFrame(On._draw):null}},Mn=function(t){const n=t.start,e=t.runner.duration();return{start:n,duration:e,end:n+e,runner:t.runner}},Sn=function(){const t=g.window;return(t.performance||t.Date).now()};class kn extends ht{constructor(t=Sn){super(),this._timeSource=t,this.terminate()}active(){return!!this._nextFrame}finish(){return this.time(this.getEndTimeOfTimeline()+1),this.pause()}getEndTime(){const t=this.getLastRunnerInfo(),n=t?t.runner.duration():0;return(t?t.start:this._time)+n}getEndTimeOfTimeline(){const t=this._runners.map((t=>t.start+t.runner.duration()));return Math.max(0,...t)}getLastRunnerInfo(){return this.getRunnerInfoById(this._lastRunnerId)}getRunnerInfoById(t){return this._runners[this._runnerIds.indexOf(t)]||null}pause(){return this._paused=!0,this._continue()}persist(t){return null==t?this._persist:(this._persist=t,this)}play(){return this._paused=!1,this.updateTime()._continue()}reverse(t){const n=this.speed();if(null==t)return this.speed(-n);const e=Math.abs(n);return this.speed(t?-e:e)}schedule(t,n,e){if(null==t)return this._runners.map(Mn);let r=0;const i=this.getEndTime();if(n=n||0,null==e||"last"===e||"after"===e)r=i;else if("absolute"===e||"start"===e)r=n,n=0;else if("now"===e)r=this._time;else if("relative"===e){const e=this.getRunnerInfoById(t.id);e&&(r=e.start+n,n=0)}else{if("with-last"!==e)throw new Error('Invalid value for the "when" parameter');{const t=this.getLastRunnerInfo();r=t?t.start:this._time}}t.unschedule(),t.timeline(this);const o=t.persist(),u={persist:null===o?this._persist:o,start:r+n,runner:t};return this._lastRunnerId=t.id,this._runners.push(u),this._runners.sort(((t,n)=>t.start-n.start)),this._runnerIds=this._runners.map((t=>t.runner.id)),this.updateTime()._continue(),this}seek(t){return this.time(this._time+t)}source(t){return null==t?this._timeSource:(this._timeSource=t,this)}speed(t){return null==t?this._speed:(this._speed=t,this)}stop(){return this.time(0),this.pause()}time(t){return null==t?this._time:(this._time=t,this._continue(!0))}unschedule(t){const n=this._runnerIds.indexOf(t.id);return n<0||(this._runners.splice(n,1),this._runnerIds.splice(n,1),t.timeline(null)),this}updateTime(){return this.active()||(this._lastSourceTime=this._timeSource()),this}_continue(t=!1){return On.cancelFrame(this._nextFrame),this._nextFrame=null,t?this._stepImmediate():(this._paused||(this._nextFrame=On.frame(this._step)),this)}_stepFn(t=!1){const n=this._timeSource();let e=n-this._lastSourceTime;t&&(e=0);const r=this._speed*e+(this._time-this._lastStepTime);this._lastSourceTime=n,t||(this._time+=r,this._time=this._time<0?0:this._time),this._lastStepTime=this._time,this.fire("time",this._time);for(let o=this._runners.length;o--;){const t=this._runners[o],n=t.runner;this._time-t.start<=0&&n.reset()}let i=!1;for(let o=0,u=this._runners.length;o0?this._continue():(this.pause(),this.fire("finished")),this}terminate(){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)}}e({Element:{timeline:function(t){return null==t?(this._timeline=this._timeline||new kn,this._timeline):(this._timeline=t,this)}}});class Cn extends ht{constructor(t){super(),this.id=Cn.id++,t="function"==typeof(t=null==t?lt:t)?new Kt(t):t,this._element=null,this._timeline=null,this.done=!1,this._queue=[],this._duration="number"==typeof t&&t,this._isDeclarative=t instanceof Kt,this._stepper=this._isDeclarative?t:new Jt,this._history={},this.enabled=!0,this._time=0,this._lastTime=0,this._reseted=!0,this.transforms=new H,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}static sanitise(t,n,e){let r=1,i=!1,o=0;return n=n??pt,e=e||"last","object"!=typeof(t=t??lt)||t instanceof Qt||(n=t.delay??n,e=t.when??e,i=t.swing||i,r=t.times??r,o=t.wait??o,t=t.duration??lt),{duration:t,delay:n,swing:i,times:r,wait:o,when:e}}active(t){return null==t?this.enabled:(this.enabled=t,this)}addTransform(t){return this.transforms.lmultiplyO(t),this}after(t){return this.on("finished",t)}animate(t,n,e){const r=Cn.sanitise(t,n,e),i=new Cn(r.duration);return this._timeline&&i.timeline(this._timeline),this._element&&i.element(this._element),i.loop(r).schedule(r.delay,r.when)}clearTransform(){return this.transforms=new H,this}clearTransformsFromQueue(){this.done&&this._timeline&&this._timeline._runnerIds.includes(this.id)||(this._queue=this._queue.filter((t=>!t.isTransform)))}delay(t){return this.animate(0,t)}duration(){return this._times*(this._wait+this._duration)-this._wait}during(t){return this.queue(null,t)}ease(t){return this._stepper=new Jt(t),this}element(t){return null==t?this._element:(this._element=t,t._prepareRunner(),this)}finish(){return this.step(1/0)}loop(t,n,e){return"object"==typeof t&&(n=t.swing,e=t.wait,t=t.times),this._times=t||1/0,this._swing=n||!1,this._wait=e||0,!0===this._times&&(this._times=1/0),this}loops(t){const n=this._duration+this._wait;if(null==t){const t=Math.floor(this._time/n),e=(this._time-t*n)/this._duration;return Math.min(t+e,this._times)}const e=t%1,r=n*Math.floor(t)+this._duration*e;return this.time(r)}persist(t){return null==t?this._persist:(this._persist=t,this)}position(t){const n=this._time,e=this._duration,r=this._wait,i=this._times,o=this._swing,u=this._reverse;let s;if(null==t){const t=function(t){const n=o*Math.floor(t%(2*(r+e))/(r+e)),i=n&&!u||!n&&u,s=Math.pow(-1,i)*(t%(r+e))/e+i;return Math.max(Math.min(s,1),0)},a=i*(r+e)-r;return s=n<=0?Math.round(t(1e-5)):n=0;this._lastPosition=n;const r=this.duration(),i=this._lastTime<=0&&this._time>0,o=this._lastTime=r;this._lastTime=this._time,i&&this.fire("start",this);const u=this._isDeclarative;this.done=!u&&!o&&this._time>=r,this._reseted=!1;let s=!1;return(e||u)&&(this._initialise(e),this.transforms=new H,s=this._run(u?t:n),this.fire("step",this)),this.done=this.done||s&&u,o&&this.fire("finished",this),this}time(t){if(null==t)return this._time;const n=t-this._time;return this.step(n),this}timeline(t){return void 0===t?this._timeline:(this._timeline=t,this)}unschedule(){const t=this.timeline();return t&&t.unschedule(this),this}_initialise(t){if(t||this._isDeclarative)for(let n=0,e=this._queue.length;nt.lmultiplyO(n),Nn=t=>t.transforms;function Rn(){const t=this._transformationRunners.runners.map(Nn).reduce(In,new H);this.transform(t),this._transformationRunners.merge(),1===this._transformationRunners.length()&&(this._frameId=null)}class zn{constructor(){this.runners=[],this.ids=[]}add(t){if(this.runners.includes(t))return;const n=t.id+1;return this.runners.push(t),this.ids.push(n),this}clearBefore(t){const n=this.ids.indexOf(t+1)||1;return this.ids.splice(0,n,0),this.runners.splice(0,n,new Tn).forEach((t=>t.clearTransformsFromQueue())),this}edit(t,n){const e=this.ids.indexOf(t+1);return this.ids.splice(e,1,t+1),this.runners.splice(e,1,n),this}getByID(t){return this.runners[this.ids.indexOf(t+1)]}length(){return this.ids.length}merge(){let t=null;for(let n=0;nn.id<=t.id)).map(Nn).reduce(In,new H)},_addRunner(t){this._transformationRunners.add(t),On.cancelImmediate(this._frameId),this._frameId=On.immediate(Rn.bind(this))},_prepareRunner(){null==this._frameId&&(this._transformationRunners=(new zn).add(new Tn(new H(this))))}}});k(Cn,{attr(t,n){return this.styleAttr("attr",t,n)},css(t,n){return this.styleAttr("css",t,n)},styleAttr(t,n,e){if("string"==typeof n)return this.styleAttr(t,{[n]:e});let r=n;if(this._tryRetarget(t,r))return this;let i=new pn(this._stepper).to(r),o=Object.keys(r);return this.queue((function(){i=i.from(this.element()[t](o))}),(function(n){return this.element()[t](i.at(n).valueOf()),i.done()}),(function(n){const e=Object.keys(n),u=(s=o,e.filter((t=>!s.includes(t))));var s;if(u.length){const n=this.element()[t](u),e=new _n(i.from()).valueOf();Object.assign(e,n),i.from(e)}const a=new _n(i.to()).valueOf();Object.assign(a,n),i.to(a),o=e,r=n})),this._rememberMorpher(t,i),this},zoom(t,n){if(this._tryRetarget("zoom",t,n))return this;let e=new pn(this._stepper).to(new yt(t));return this.queue((function(){e=e.from(this.element().zoom())}),(function(t){return this.element().zoom(e.at(t),n),e.done()}),(function(t,r){n=r,e.to(t)})),this._rememberMorpher("zoom",e),this},transform(t,n,e){if(n=t.relative||n,this._isDeclarative&&!n&&this._tryRetarget("transform",t))return this;const r=H.isMatrixLike(t);e=null!=t.affine?t.affine:null!=e?e:!r;const i=new pn(this._stepper).type(e?gn:H);let o,u,s,a,h;return this.queue((function(){u=u||this.element(),o=o||c(t,u),h=new H(n?void 0:u),u._addRunner(this),n||u._clearTransformRunnersBefore(this)}),(function(c){n||this.clearTransform();const{x:f,y:l}=new G(o).transform(u._currentTransform(this));let d=new H({...t,origin:[f,l]}),p=this._isDeclarative&&s?s:h;if(e){d=d.decompose(f,l),p=p.decompose(f,l);const t=d.rotate,n=p.rotate,e=[t-360,t,t+360],r=e.map((t=>Math.abs(t-n))),i=Math.min(...r),o=r.indexOf(i);d.rotate=e[o]}n&&(r||(d.rotate=t.rotate||0),this._isDeclarative&&a&&(p.rotate=a)),i.from(p),i.to(d);const v=i.at(c);return a=v.rotate,s=new H(v),this.addTransform(s),u._addRunner(this),i.done()}),(function(n){(n.origin||"center").toString()!==(t.origin||"center").toString()&&(o=c(n,u)),t={...n,origin:o}}),!0),this._isDeclarative&&this._rememberMorpher("transform",i),this},x(t){return this._queueNumber("x",t)},y(t){return this._queueNumber("y",t)},ax(t){return this._queueNumber("ax",t)},ay(t){return this._queueNumber("ay",t)},dx(t=0){return this._queueNumberDelta("x",t)},dy(t=0){return this._queueNumberDelta("y",t)},dmove(t,n){return this.dx(t).dy(n)},_queueNumberDelta(t,n){if(n=new yt(n),this._tryRetarget(t,n))return this;const e=new pn(this._stepper).to(n);let r=null;return this.queue((function(){r=this.element()[t](),e.from(r),e.to(r+n)}),(function(n){return this.element()[t](e.at(n)),e.done()}),(function(t){e.to(r+new yt(t))})),this._rememberMorpher(t,e),this},_queueObject(t,n){if(this._tryRetarget(t,n))return this;const e=new pn(this._stepper).to(n);return this.queue((function(){e.from(this.element()[t]())}),(function(n){return this.element()[t](e.at(n)),e.done()})),this._rememberMorpher(t,e),this},_queueNumber(t,n){return this._queueObject(t,new yt(n))},cx(t){return this._queueNumber("cx",t)},cy(t){return this._queueNumber("cy",t)},move(t,n){return this.x(t).y(n)},amove(t,n){return this.ax(t).ay(n)},center(t,n){return this.cx(t).cy(n)},size(t,n){let e;return t&&n||(e=this._element.bbox()),t||(t=e.width/e.height*n),n||(n=e.height/e.width*t),this.width(t).height(n)},width(t){return this._queueNumber("width",t)},height(t){return this._queueNumber("height",t)},plot(t,n,e,r){if(4===arguments.length)return this.plot([t,n,e,r]);if(this._tryRetarget("plot",t))return this;const i=new pn(this._stepper).type(this._element.MorphArray).to(t);return this.queue((function(){i.from(this._element.array())}),(function(t){return this._element.plot(i.at(t)),i.done()})),this._rememberMorpher("plot",i),this},leading(t){return this._queueNumber("leading",t)},viewbox(t,n,e,r){return this._queueObject("viewbox",new K(t,n,e,r))},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)}}),k(Cn,{rx:Ot,ry:Mt,from:Dt,to:Lt}),A(Cn,"Runner");class Pn extends Et{constructor(t,n=t){super(x("svg",t),n),this.namespace()}defs(){return this.isRoot()?E(this.node.querySelector("defs"))||this.put(new jt):this.root().defs()}isRoot(){return!this.node.parentNode||!(this.node.parentNode instanceof g.window.SVGElement)&&"#document-fragment"!==this.node.parentNode.nodeName}namespace(){return this.isRoot()?this.attr({xmlns:d,version:"1.1"}).attr("xmlns:xlink",v,p):this.root().namespace()}removeNamespace(){return this.attr({xmlns:null,version:null}).attr("xmlns:xlink",null,p).attr("xmlns:svgjs",null,p)}root(){return this.isRoot()?this:super.root()}}e({Container:{nested:C((function(){return this.put(new Pn)}))}}),A(Pn,"Svg",!0);let Dn=class extends Et{constructor(t,n=t){super(x("symbol",t),n)}};e({Container:{symbol:C((function(){return this.put(new Dn)}))}}),A(Dn,"Symbol");const Ln=Object.freeze(Object.defineProperty({__proto__:null,amove:function(t,n){return this.ax(t).ay(n)},ax:function(t){return this.attr("x",t)},ay:function(t){return this.attr("y",t)},build:function(t){return this._build=!!t,this},center:function(t,n,e=this.bbox()){return this.cx(t,e).cy(n,e)},cx:function(t,n=this.bbox()){return null==t?n.cx:this.attr("x",this.attr("x")+t-n.cx)},cy:function(t,n=this.bbox()){return null==t?n.cy:this.attr("y",this.attr("y")+t-n.cy)},length:function(){return this.node.getComputedTextLength()},move:function(t,n,e=this.bbox()){return this.x(t,e).y(n,e)},plain:function(t){return!1===this._build&&this.clear(),this.node.appendChild(g.document.createTextNode(t)),this},x:function(t,n=this.bbox()){return null==t?n.x:this.attr("x",this.attr("x")+t-n.x)},y:function(t,n=this.bbox()){return null==t?n.y:this.attr("y",this.attr("y")+t-n.y)}},Symbol.toStringTag,{value:"Module"}));class Fn extends At{constructor(t,n=t){super(x("text",t),n),this.dom.leading=this.dom.leading??new yt(1.3),this._rebuild=!0,this._build=!1}leading(t){return null==t?this.dom.leading:(this.dom.leading=new yt(t),this.rebuild())}rebuild(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){const t=this;let n=0;const e=this.dom.leading;this.each((function(r){if(f(this.node))return;const i=g.window.getComputedStyle(this.node).getPropertyValue("font-size"),o=e*new yt(i);this.dom.newLined&&(this.attr("x",t.attr("x")),"\n"===this.text()?n+=o:(this.attr("dy",r?o+n:0),n=0))})),this.fire("rebuild")}return this}setData(t){return this.dom=t,this.dom.leading=new yt(t.leading||1.3),this}writeDataToDom(){return l(this,this.dom,{leading:1.3}),this}text(t){if(void 0===t){const n=this.node.childNodes;let e=0;t="";for(let r=0,i=n.length;r{let r;try{r=e.node instanceof g.window.SVGSVGElement?new K(e.attr(["x","y","width","height"])):e.bbox()}catch(s){return}const i=new H(e),o=i.translate(t,n).transform(i.inverse()),u=new G(r.x,r.y).transform(o);e.move(u.x,u.y)})),this},dx:function(t){return this.dmove(t,0)},dy:function(t){return this.dmove(0,t)},height:function(t,n=this.bbox()){return null==t?n.height:this.size(n.width,t,n)},move:function(t=0,n=0,e=this.bbox()){const r=t-e.x,i=n-e.y;return this.dmove(r,i)},size:function(t,n,e=this.bbox()){const r=a(this,t,n,e),i=r.width/e.width,o=r.height/e.height;return this.children().forEach((t=>{const n=new G(e).transform(new H(t).inverse());t.scale(i,o,n.x,n.y)})),this},width:function(t,n=this.bbox()){return null==t?n.width:this.size(t,n.height,n)},x:function(t,n=this.bbox()){return null==t?n.x:this.move(t,n.y,n)},y:function(t,n=this.bbox()){return null==t?n.y:this.move(n.x,t,n)}},Symbol.toStringTag,{value:"Module"}));class Un extends Et{constructor(t,n=t){super(x("g",t),n)}}k(Un,Yn),e({Container:{group:C((function(){return this.put(new Un)}))}}),A(Un,"G");class qn extends Et{constructor(t,n=t){super(x("a",t),n)}target(t){return this.attr("target",t)}to(t){return this.attr("href",t,v)}}k(qn,Yn),e({Container:{link:C((function(t){return this.put(new qn).to(t)}))},Element:{unlink(){const t=this.linker();if(!t)return this;const n=t.parent();if(!n)return this.remove();const e=n.index(t);return n.add(this,e),t.remove(),this},linkTo(t){let n=this.linker();return n||(n=new qn,this.wrap(n)),"function"==typeof t?t.call(n,n):n.to(t),this},linker(){const t=this.parent();return t&&"a"===t.node.nodeName.toLowerCase()?t:null}}}),A(qn,"A");class Wn extends Et{constructor(t,n=t){super(x("mask",t),n)}remove(){return this.targets().forEach((function(t){t.unmask()})),super.remove()}targets(){return rt("svg [mask*="+this.id()+"]")}}e({Container:{mask:C((function(){return this.defs().put(new Wn)}))},Element:{masker(){return this.reference("mask")},maskWith(t){const n=t instanceof Wn?t:this.parent().mask().add(t);return this.attr("mask","url(#"+n.id()+")")},unmask(){return this.attr("mask",null)}}}),A(Wn,"Mask");class Gn extends bt{constructor(t,n=t){super(x("stop",t),n)}update(t){return("number"==typeof t||t instanceof yt)&&(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 yt(t.offset)),this}}e({Gradient:{stop:function(t,n,e){return this.put(new Gn).update(t,n,e)}}}),A(Gn,"Stop");class Zn extends bt{constructor(t,n=t){super(x("style",t),n)}addText(t=""){return this.node.textContent+=t,this}font(t,n,e={}){return this.rule("@font-face",{fontFamily:t,src:n,...e})}rule(t,n){return this.addText(function(t,n){if(!t)return"";if(!n)return t;let e=t+"{";for(const r in n)e+=r.replace(/([A-Z])/g,(function(t,n){return"-"+n.toLowerCase()}))+":"+n[r]+";";return e+="}",e}(t,n))}}e("Dom",{style(t,n){return this.put(new Zn).rule(t,n)},fontface(t,n,e){return this.put(new Zn).font(t,n,e)}}),A(Zn,"Style");class Hn extends Fn{constructor(t,n=t){super(x("textPath",t),n)}array(){const t=this.track();return t?t.array():null}plot(t){const n=this.track();let e=null;return n&&(e=n.plot(t)),null==t?e:this}track(){return this.reference("href")}}e({Container:{textPath:C((function(t,n){return t instanceof Fn||(t=this.text(t)),t.path(n)}))},Text:{path:C((function(t,n=!0){const e=new Hn;let r;if(t instanceof wn||(t=this.defs().path(t)),e.attr("href","#"+t,v),n)for(;r=this.node.firstChild;)e.node.appendChild(r);return this.put(e)})),textPath(){return this.findOne("textPath")}},Path:{text:C((function(t){return t instanceof Fn||(t=(new Fn).addTo(this.parent()).text(t)),t.path(this)})),targets(){return rt("svg textPath").filter((t=>(t.attr("href")||"").includes(this.id())))}}}),Hn.prototype.MorphArray=ln,A(Hn,"TextPath");class Qn extends At{constructor(t,n=t){super(x("use",t),n)}use(t,n){return this.attr("href",(n||"")+"#"+t,v)}}e({Container:{use:C((function(t,n){return this.put(new Qn).use(t,n)}))}}),A(Qn,"Use");const Jn=b;k([Pn,Dn,Vt,$t,Gt],r("viewbox")),k([Wt,En,xn,wn],r("marker")),k(Fn,r("Text")),k(wn,r("Path")),k(jt,r("Defs")),k([Fn,Bn],r("Tspan")),k([jn,zt,Bt,Cn],r("radius")),k(ht,r("EventTarget")),k(wt,r("Dom")),k(bt,r("Element")),k(At,r("Shape")),k([Et,Pt],r("Container")),k(Bt,r("Gradient")),k(Cn,r("Runner")),nt.extend([...new Set(n)]),function(t=[]){mn.push(...[].concat(t))}([yt,W,K,H,gt,Yt,ln,G]),k(mn,{to(t){return(new pn).type(this.constructor).from(this.toArray()).to(t)},fromArray(t){return this.init(t),this},toConsumable(){return this.toArray()},morph(t,n,e,r,i){return this.fromArray(t.map((function(t,o){return r.step(t,n[o],e,i[o],i)})))}});var Kn=function(t){return t.touches||[{clientX:t.clientX,clientY:t.clientY}]};k(Pn,{panZoom:function(t){var n,e,r,i,o,u,s,a,c,h,f,l,d=this;if(this.off(".panZoom"),!1===t)return this;var p,v,g=null!=(e=(t=null!=(n=t)?n:{}).zoomFactor)?e:2,y=null!=(r=t.zoomMin)?r:Number.MIN_VALUE,_=null!=(i=t.zoomMax)?i:Number.MAX_VALUE,m=null==(o=t.wheelZoom)||o,w=null==(u=t.pinchZoom)||u,b=null==(s=t.panning)||s,x=null!=(a=t.panButton)?a:0,E=null!=(c=t.oneFingerPan)&&c,j=null!=(h=t.margins)&&h,A=null!=(f=t.wheelZoomDeltaModeLinePixels)?f:17,O=null!=(l=t.wheelZoomDeltaModeScreenPixels)?l:53,M=!1,S=this.viewbox(),k=function(t){if(!j)return t;var n=j.top,e=j.left,r=j.bottom,i=j.right,o=d.attr(["width","height"]),u=o.width,s=o.height,a=d.node.preserveAspectRatio.baseVal,c=0,h=0,f=0,l=0;if(a.align!==a.SVG_PRESERVEASPECTRATIO_NONE){var p=u/s,v=S.width/S.height;if(v!==p){var g=a.meetOrSlice!==a.SVG_MEETORSLICE_SLICE,y=p>v?"width":"height",_="width"===y,m=g&&_||!g&&!_,w=m?p/v:v/p,b=t[y]-t[y]*w;m?a.align===a.SVG_PRESERVEASPECTRATIO_XMIDYMIN||a.align===a.SVG_PRESERVEASPECTRATIO_XMIDYMID||a.align===a.SVG_PRESERVEASPECTRATIO_XMIDYMAX?(c=b/2,h=-b/2):a.align===a.SVG_PRESERVEASPECTRATIO_XMINYMIN||a.align===a.SVG_PRESERVEASPECTRATIO_XMINYMID||a.align===a.SVG_PRESERVEASPECTRATIO_XMINYMAX?h=-b:a.align!==a.SVG_PRESERVEASPECTRATIO_XMAXYMIN&&a.align!==a.SVG_PRESERVEASPECTRATIO_XMAXYMID&&a.align!==a.SVG_PRESERVEASPECTRATIO_XMAXYMAX||(c=b):a.align===a.SVG_PRESERVEASPECTRATIO_XMINYMID||a.align===a.SVG_PRESERVEASPECTRATIO_XMIDYMID||a.align===a.SVG_PRESERVEASPECTRATIO_XMAXYMID?(f=b/2,l=-b/2):a.align===a.SVG_PRESERVEASPECTRATIO_XMINYMIN||a.align===a.SVG_PRESERVEASPECTRATIO_XMIDYMIN||a.align===a.SVG_PRESERVEASPECTRATIO_XMAXYMIN?l=-b:a.align!==a.SVG_PRESERVEASPECTRATIO_XMINYMAX&&a.align!==a.SVG_PRESERVEASPECTRATIO_XMIDYMAX&&a.align!==a.SVG_PRESERVEASPECTRATIO_XMAXYMAX||(f=b)}}var x=S.width+S.x-e-c,E=S.x+i-t.width-h,A=S.height+S.y-n-f,O=S.y+r-t.height-l;return t.x=Math.min(x,Math.max(E,t.x)),t.y=Math.min(A,Math.max(O,t.y)),t},C=function t(n){(v=Kn(n)).length<2?b&&E&&N.call(this,n):(b&&E&&R.call(this,n),n.preventDefault(),this.dispatch("pinchZoomStart",{event:n}).defaultPrevented||(this.off("touchstart.panZoom",t),M=!0,at(document,"touchmove.panZoom",I,this,{passive:!1}),at(document,"touchend.panZoom",T,this,{passive:!1})))},T=function t(n){n.preventDefault();var e=Kn(n);e.length>1||(M=!1,this.dispatch("pinchZoomEnd",{event:n}),ct(document,"touchmove.panZoom",I),ct(document,"touchend.panZoom",t),this.on("touchstart.panZoom",C),e.length&&b&&E&&N.call(this,n))},I=function(t){t.preventDefault();var n=Kn(t),e=this.zoom(),r=Math.sqrt(Math.pow(v[0].clientX-v[1].clientX,2)+Math.pow(v[0].clientY-v[1].clientY,2))/Math.sqrt(Math.pow(n[0].clientX-n[1].clientX,2)+Math.pow(n[0].clientY-n[1].clientY,2));(e1||e>_&&r<1)&&(r=1);var i={x:n[0].clientX+.5*(n[1].clientX-n[0].clientX),y:n[0].clientY+.5*(n[1].clientY-n[0].clientY)},o=v[0].clientX+.5*(v[1].clientX-v[0].clientX),u=v[0].clientY+.5*(v[1].clientY-v[0].clientY),s=this.point(i.x,i.y),a=this.point(2*i.x-o,2*i.y-u),c=new K(this.viewbox()).transform((new H).translate(-a.x,-a.y).scale(r,0,0).translate(s.x,s.y));k(c),this.viewbox(c),v=n,this.dispatch("zoom",{box:c,focus:a})},N=function t(n){n.type.indexOf("mouse")>-1&&n.button!==x&&n.which!==x+1||(n.preventDefault(),this.off("mousedown.panZoom",t),v=Kn(n),M||(this.dispatch("panStart",{event:n}),p={x:v[0].clientX,y:v[0].clientY},at(document,"touchmove.panZoom mousemove.panZoom",z,this,{passive:!1}),at(document,"touchend.panZoom mouseup.panZoom",R,this,{passive:!1})))},R=function t(n){n.preventDefault(),ct(document,"touchmove.panZoom mousemove.panZoom",z),ct(document,"touchend.panZoom mouseup.panZoom",t),this.on("mousedown.panZoom",N),this.dispatch("panEnd",{event:n})},z=function(t){t.preventDefault();var n=Kn(t),e={x:n[0].clientX,y:n[0].clientY},r=this.point(e.x,e.y),i=this.point(p.x,p.y),o=[i.x-r.x,i.y-r.y];if(o[0]||o[1]){var u=new K(this.viewbox()).transform((new H).translate(o[0],o[1]));p=e,k(u),this.dispatch("panning",{box:u,event:t}).defaultPrevented||this.viewbox(u)}};return m&&this.on("wheel.panZoom",(function(t){var n;switch(t.preventDefault(),t.deltaMode){case 1:n=t.deltaY*A;break;case 2:n=t.deltaY*O;break;default:n=t.deltaY}var e=Math.pow(1+g,-1*n/100)*this.zoom(),r=this.point(t.clientX,t.clientY);if(e>_&&(e=_),e=.1&&this.canvas.zoom(n)}clear(){this.canvas.clear().viewbox(`-${this.spacing} -${this.spacing} ${this.width+2*this.spacing} ${this.height+this.spacing}`)}}var ne,ee,re,ie,oe,ue,se,ae,ce,he,fe,le,de,pe,ve,ge,ye,_e,me,we,be,xe,Ee,je,Ae,Oe,Me,Se,ke,Ce,Te,Ie,Ne,Re,ze,Pe,De,Le,Fe,Be,$e,Ve,Xe,Ye,Ue,qe,We,Ge,Ze,He,Qe,Je,Ke,tr,nr,er,rr,ir,or,ur,sr,ar,cr,hr,fr,lr,dr,pr,vr,gr,yr,_r,mr,wr,br,xr,Er,jr,Ar,Or,Mr,Sr,kr,Cr,Tr,Ir,Nr,Rr,zr,Pr,Dr,Lr,Fr,Br,$r,Vr,Xr,Yr,Ur,qr,Wr,Gr,Zr,Hr,Qr,Jr,Kr,ti,ni="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ei(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ri(){if(ie)return re;return ie=1,re=function(t,n){return t===n||t!=t&&n!=n}}function ii(){if(ue)return oe;ue=1;var t=ri();return oe=function(n,e){for(var r=n.length;r--;)if(t(n[r][0],e))return r;return-1}}function oi(){if(ge)return ve;ge=1;var t=ee?ne:(ee=1,ne=function(){this.__data__=[],this.size=0}),n=function(){if(ae)return se;ae=1;var t=ii(),n=Array.prototype.splice;return se=function(e){var r=this.__data__,i=t(r,e);return!(i<0||(i==r.length-1?r.pop():n.call(r,i,1),--this.size,0))}}(),e=function(){if(he)return ce;he=1;var t=ii();return ce=function(n){var e=this.__data__,r=t(e,n);return r<0?void 0:e[r][1]}}(),r=function(){if(le)return fe;le=1;var t=ii();return fe=function(n){return t(this.__data__,n)>-1}}(),i=function(){if(pe)return de;pe=1;var t=ii();return de=function(n,e){var r=this.__data__,i=t(r,n);return i<0?(++this.size,r.push([n,e])):r[i][1]=e,this}}();function o(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n-1&&n%1==0&&n-1&&t%1==0&&t<=9007199254740991}}function Yi(){if(Fi)return Li;return Fi=1,Li=function(t){return function(n){return t(n)}}}Bi.exports;var Ui,qi,Wi,Gi,Zi,Hi,Qi,Ji,Ki,to,no,eo,ro,io,oo,uo,so,ao,co,ho,fo,lo,po,vo,go,yo,_o,mo={exports:{}};function wo(){return Ui||(Ui=1,t=mo,n=mo.exports,e=ui(),r=n&&!n.nodeType&&n,i=r&&t&&!t.nodeType&&t,o=i&&i.exports===r&&e.process,u=function(){try{var t=i&&i.require&&i.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(n){}}(),t.exports=u),mo.exports;var t,n,e,r,i,o,u}function bo(){if(Wi)return qi;Wi=1;var t=function(){if(Di)return Pi;Di=1;var t=ci(),n=Xi(),e=Oi(),r={};return r["[object Float32Array]"]=r["[object Float64Array]"]=r["[object Int8Array]"]=r["[object Int16Array]"]=r["[object Int32Array]"]=r["[object Uint8Array]"]=r["[object Uint8ClampedArray]"]=r["[object Uint16Array]"]=r["[object Uint32Array]"]=!0,r["[object Arguments]"]=r["[object Array]"]=r["[object ArrayBuffer]"]=r["[object Boolean]"]=r["[object DataView]"]=r["[object Date]"]=r["[object Error]"]=r["[object Function]"]=r["[object Map]"]=r["[object Number]"]=r["[object Object]"]=r["[object RegExp]"]=r["[object Set]"]=r["[object String]"]=r["[object WeakMap]"]=!1,Pi=function(i){return e(i)&&n(i.length)&&!!r[t(i)]}}(),n=Yi(),e=wo(),r=e&&e.isTypedArray,i=r?n(r):t;return qi=i}function xo(){if(Zi)return Gi;Zi=1;var t=qr?Ur:(qr=1,Ur=function(t,n){for(var e=-1,r=Array(t);++eh))return!1;var l=a.get(r),d=a.get(i);if(l&&d)return l==i&&d==r;var p=-1,v=!0,g=2&o?new t:void 0;for(a.set(r,i),a.set(i,r);++p0&&o(h)?i>1?e(h,i-1,o,u,s):t(s,h):u||(s[s.length]=h)}return s},dc}function Hh(){if(_c)return yc;_c=1;var t=gc?vc:(gc=1,vc=function(t,n,e){switch(e.length){case 0:return t.call(n);case 1:return t.call(n,e[0]);case 2:return t.call(n,e[0],e[1]);case 3:return t.call(n,e[0],e[1],e[2])}return t.apply(n,e)}),n=Math.max;return yc=function(e,r,i){return r=n(void 0===r?e.length-1:r,0),function(){for(var o=arguments,u=-1,s=n(o.length-r,0),a=Array(s);++u0){if(++e>=800)return arguments[0]}else e=0;return n.apply(void 0,arguments)}},bc}(),e=n(t);return Ec=e}function Jh(){if(Rc)return Nc;Rc=1;var t=Sc?Mc:(Sc=1,Mc=function(t,n,e,r){for(var i=t.length,o=e+(r?1:-1);r?o--:++o-1}}(),e=Lc?Dc:(Lc=1,Dc=function(t,n,e){for(var r=-1,i=null==t?0:t.length;++r=200){var v=s?null:i(u);if(v)return o(v);l=!1,h=r,p=new t}else p=s?[]:d;t:for(;++co){var u=i;i=o,o=u}return i+sf+o+sf+(ef.isUndefined(r)?of:r)}function lf(t,n){return ff(t,n.v,n.w,n.name)}af.prototype._nodeCount=0,af.prototype._edgeCount=0,af.prototype.isDirected=function(){return this._isDirected},af.prototype.isMultigraph=function(){return this._isMultigraph},af.prototype.isCompound=function(){return this._isCompound},af.prototype.setGraph=function(t){return this._label=t,this},af.prototype.graph=function(){return this._label},af.prototype.setDefaultNodeLabel=function(t){return ef.isFunction(t)||(t=ef.constant(t)),this._defaultNodeLabelFn=t,this},af.prototype.nodeCount=function(){return this._nodeCount},af.prototype.nodes=function(){return ef.keys(this._nodes)},af.prototype.sources=function(){var t=this;return ef.filter(this.nodes(),(function(n){return ef.isEmpty(t._in[n])}))},af.prototype.sinks=function(){var t=this;return ef.filter(this.nodes(),(function(n){return ef.isEmpty(t._out[n])}))},af.prototype.setNodes=function(t,n){var e=arguments,r=this;return ef.each(t,(function(t){e.length>1?r.setNode(t,n):r.setNode(t)})),this},af.prototype.setNode=function(t,n){return ef.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=n),this):(this._nodes[t]=arguments.length>1?n:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=uf,this._children[t]={},this._children[uf][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},af.prototype.node=function(t){return this._nodes[t]},af.prototype.hasNode=function(t){return ef.has(this._nodes,t)},af.prototype.removeNode=function(t){var n=this;if(ef.has(this._nodes,t)){var e=function(t){n.removeEdge(n._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],ef.each(this.children(t),(function(t){n.setParent(t)})),delete this._children[t]),ef.each(ef.keys(this._in[t]),e),delete this._in[t],delete this._preds[t],ef.each(ef.keys(this._out[t]),e),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},af.prototype.setParent=function(t,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(ef.isUndefined(n))n=uf;else{for(var e=n+="";!ef.isUndefined(e);e=this.parent(e))if(e===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=n,this._children[n][t]=!0,this},af.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},af.prototype.parent=function(t){if(this._isCompound){var n=this._parent[t];if(n!==uf)return n}},af.prototype.children=function(t){if(ef.isUndefined(t)&&(t=uf),this._isCompound){var n=this._children[t];if(n)return ef.keys(n)}else{if(t===uf)return this.nodes();if(this.hasNode(t))return[]}},af.prototype.predecessors=function(t){var n=this._preds[t];if(n)return ef.keys(n)},af.prototype.successors=function(t){var n=this._sucs[t];if(n)return ef.keys(n)},af.prototype.neighbors=function(t){var n=this.predecessors(t);if(n)return ef.union(n,this.successors(t))},af.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},af.prototype.filterNodes=function(t){var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph());var e=this;ef.each(this._nodes,(function(e,r){t(r)&&n.setNode(r,e)})),ef.each(this._edgeObjs,(function(t){n.hasNode(t.v)&&n.hasNode(t.w)&&n.setEdge(t,e.edge(t))}));var r={};function i(t){var o=e.parent(t);return void 0===o||n.hasNode(o)?(r[t]=o,o):o in r?r[o]:i(o)}return this._isCompound&&ef.each(n.nodes(),(function(t){n.setParent(t,i(t))})),n},af.prototype.setDefaultEdgeLabel=function(t){return ef.isFunction(t)||(t=ef.constant(t)),this._defaultEdgeLabelFn=t,this},af.prototype.edgeCount=function(){return this._edgeCount},af.prototype.edges=function(){return ef.values(this._edgeObjs)},af.prototype.setPath=function(t,n){var e=this,r=arguments;return ef.reduce(t,(function(t,i){return r.length>1?e.setEdge(t,i,n):e.setEdge(t,i),i})),this},af.prototype.setEdge=function(){var t,n,e,r,i=!1,o=arguments[0];"object"==typeof o&&null!==o&&"v"in o?(t=o.v,n=o.w,e=o.name,2===arguments.length&&(r=arguments[1],i=!0)):(t=o,n=arguments[1],e=arguments[3],arguments.length>2&&(r=arguments[2],i=!0)),t=""+t,n=""+n,ef.isUndefined(e)||(e=""+e);var u=ff(this._isDirected,t,n,e);if(ef.has(this._edgeLabels,u))return i&&(this._edgeLabels[u]=r),this;if(!ef.isUndefined(e)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(n),this._edgeLabels[u]=i?r:this._defaultEdgeLabelFn(t,n,e);var s=function(t,n,e,r){var i=""+n,o=""+e;if(!t&&i>o){var u=i;i=o,o=u}var s={v:i,w:o};r&&(s.name=r);return s}(this._isDirected,t,n,e);return t=s.v,n=s.w,Object.freeze(s),this._edgeObjs[u]=s,cf(this._preds[n],t),cf(this._sucs[t],n),this._in[n][u]=s,this._out[t][u]=s,this._edgeCount++,this},af.prototype.edge=function(t,n,e){var r=1===arguments.length?lf(this._isDirected,arguments[0]):ff(this._isDirected,t,n,e);return this._edgeLabels[r]},af.prototype.hasEdge=function(t,n,e){var r=1===arguments.length?lf(this._isDirected,arguments[0]):ff(this._isDirected,t,n,e);return ef.has(this._edgeLabels,r)},af.prototype.removeEdge=function(t,n,e){var r=1===arguments.length?lf(this._isDirected,arguments[0]):ff(this._isDirected,t,n,e),i=this._edgeObjs[r];return i&&(t=i.v,n=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],hf(this._preds[n],t),hf(this._sucs[t],n),delete this._in[n][r],delete this._out[t][r],this._edgeCount--),this},af.prototype.inEdges=function(t,n){var e=this._in[t];if(e){var r=ef.values(e);return n?ef.filter(r,(function(t){return t.v===n})):r}},af.prototype.outEdges=function(t,n){var e=this._out[t];if(e){var r=ef.values(e);return n?ef.filter(r,(function(t){return t.w===n})):r}},af.prototype.nodeEdges=function(t,n){var e=this.inEdges(t,n);if(e)return e.concat(this.outEdges(t,n))};var df={Graph:rf,version:"2.1.8"},pf=nf,vf=rf,gf={write:function(t){var n={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:yf(t),edges:_f(t)};pf.isUndefined(t.graph())||(n.value=pf.clone(t.graph()));return n},read:function(t){var n=new vf(t.options).setGraph(t.value);return pf.each(t.nodes,(function(t){n.setNode(t.v,t.value),t.parent&&n.setParent(t.v,t.parent)})),pf.each(t.edges,(function(t){n.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),n}};function yf(t){return pf.map(t.nodes(),(function(n){var e=t.node(n),r=t.parent(n),i={v:n};return pf.isUndefined(e)||(i.value=e),pf.isUndefined(r)||(i.parent=r),i}))}function _f(t){return pf.map(t.edges(),(function(n){var e=t.edge(n),r={v:n.v,w:n.w};return pf.isUndefined(n.name)||(r.name=n.name),pf.isUndefined(e)||(r.value=e),r}))}var mf=nf,wf=function(t){var n,e={},r=[];function i(r){mf.has(e,r)||(e[r]=!0,n.push(r),mf.each(t.successors(r),i),mf.each(t.predecessors(r),i))}return mf.each(t.nodes(),(function(t){n=[],i(t),n.length&&r.push(n)})),r};var bf=nf,xf=Ef;function Ef(){this._arr=[],this._keyIndices={}}Ef.prototype.size=function(){return this._arr.length},Ef.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},Ef.prototype.has=function(t){return bf.has(this._keyIndices,t)},Ef.prototype.priority=function(t){var n=this._keyIndices[t];if(void 0!==n)return this._arr[n].priority},Ef.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},Ef.prototype.add=function(t,n){var e=this._keyIndices;if(t=String(t),!bf.has(e,t)){var r=this._arr,i=r.length;return e[t]=i,r.push({key:t,priority:n}),this._decrease(i),!0}return!1},Ef.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},Ef.prototype.decrease=function(t,n){var e=this._keyIndices[t];if(n>this._arr[e].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[e].priority+" New: "+n);this._arr[e].priority=n,this._decrease(e)},Ef.prototype._heapify=function(t){var n=this._arr,e=2*t,r=e+1,i=t;e>1].priority0&&(i=s.removeMin(),(o=u[i]).distance!==Number.POSITIVE_INFINITY);)r(i).forEach(a);return u}(t,String(n),e||Of,r||function(n){return t.outEdges(n)})},Of=nf.constant(1);var Mf=Af,Sf=nf,kf=function(t,n,e){return Sf.transform(t.nodes(),(function(r,i){r[i]=Mf(t,i,n,e)}),{})};var Cf=nf,Tf=function(t){var n=0,e=[],r={},i=[];function o(u){var s=r[u]={onStack:!0,lowlink:n,index:n++};if(e.push(u),t.successors(u).forEach((function(t){Cf.has(r,t)?r[t].onStack&&(s.lowlink=Math.min(s.lowlink,r[t].index)):(o(t),s.lowlink=Math.min(s.lowlink,r[t].lowlink))})),s.lowlink===s.index){var a,c=[];do{a=e.pop(),r[a].onStack=!1,c.push(a)}while(u!==a);i.push(c)}}return t.nodes().forEach((function(t){Cf.has(r,t)||o(t)})),i};var If=nf,Nf=Tf,Rf=function(t){return If.filter(Nf(t),(function(n){return n.length>1||1===n.length&&t.hasEdge(n[0],n[0])}))};var zf=function(t,n,e){return function(t,n,e){var r={},i=t.nodes();return i.forEach((function(t){r[t]={},r[t][t]={distance:0},i.forEach((function(n){t!==n&&(r[t][n]={distance:Number.POSITIVE_INFINITY})})),e(t).forEach((function(e){var i=e.v===t?e.w:e.v,o=n(e);r[t][i]={distance:o,predecessor:t}}))})),i.forEach((function(t){var n=r[t];i.forEach((function(e){var o=r[e];i.forEach((function(e){var r=o[t],i=n[e],u=o[e],s=r.distance+i.distance;s0;){if(e=o.removeMin(),Wf.has(i,e))r.setEdge(e,i[e]);else{if(s)throw new Error("Input graph is not connected: "+t);s=!0}t.nodeEdges(e).forEach(u)}return r},tarjan:Tf,topsort:Lf},version:df.version};var Qf,Jf,Kf={exports:{}}; /** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */Qf=Kf,Jf=Kf.exports,function(){var t,n="Expected a function",e="__lodash_hash_undefined__",r="__lodash_placeholder__",i=16,o=32,u=64,s=128,a=256,c=1/0,h=9007199254740991,f=NaN,l=4294967295,d=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",i],["flip",512],["partial",o],["partialRight",u],["rearg",a]],p="[object Arguments]",v="[object Array]",g="[object Boolean]",y="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",b="[object Map]",x="[object Number]",E="[object Object]",j="[object Promise]",A="[object RegExp]",O="[object Set]",M="[object String]",S="[object Symbol]",k="[object WeakMap]",C="[object ArrayBuffer]",T="[object DataView]",I="[object Float32Array]",N="[object Float64Array]",R="[object Int8Array]",z="[object Int16Array]",P="[object Int32Array]",D="[object Uint8Array]",L="[object Uint8ClampedArray]",F="[object Uint16Array]",B="[object Uint32Array]",$=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,X=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Y=/&(?:amp|lt|gt|quot|#39);/g,U=/[&<>"']/g,q=RegExp(Y.source),W=RegExp(U.source),G=/<%-([\s\S]+?)%>/g,Z=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,J=/^\w*$/,K=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tt=/[\\^$.*+?()[\]{}|]/g,nt=RegExp(tt.source),et=/^\s+/,rt=/\s/,it=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ot=/\{\n\/\* \[wrapped with (.+)\] \*/,ut=/,? & /,st=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,at=/[()=,{}\[\]\/\s]/,ct=/\\(\\)?/g,ht=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ft=/\w*$/,lt=/^[-+]0x[0-9a-f]+$/i,dt=/^0b[01]+$/i,pt=/^\[object .+?Constructor\]$/,vt=/^0o[0-7]+$/i,gt=/^(?:0|[1-9]\d*)$/,yt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_t=/($^)/,mt=/['\n\r\u2028\u2029\\]/g,wt="\\ud800-\\udfff",bt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",xt="\\u2700-\\u27bf",Et="a-z\\xdf-\\xf6\\xf8-\\xff",jt="A-Z\\xc0-\\xd6\\xd8-\\xde",At="\\ufe0e\\ufe0f",Ot="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Mt="['’]",St="["+wt+"]",kt="["+Ot+"]",Ct="["+bt+"]",Tt="\\d+",It="["+xt+"]",Nt="["+Et+"]",Rt="[^"+wt+Ot+Tt+xt+Et+jt+"]",zt="\\ud83c[\\udffb-\\udfff]",Pt="[^"+wt+"]",Dt="(?:\\ud83c[\\udde6-\\uddff]){2}",Lt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ft="["+jt+"]",Bt="\\u200d",$t="(?:"+Nt+"|"+Rt+")",Vt="(?:"+Ft+"|"+Rt+")",Xt="(?:['’](?:d|ll|m|re|s|t|ve))?",Yt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ut="(?:"+Ct+"|"+zt+")?",qt="["+At+"]?",Wt=qt+Ut+"(?:"+Bt+"(?:"+[Pt,Dt,Lt].join("|")+")"+qt+Ut+")*",Gt="(?:"+[It,Dt,Lt].join("|")+")"+Wt,Zt="(?:"+[Pt+Ct+"?",Ct,Dt,Lt,St].join("|")+")",Ht=RegExp(Mt,"g"),Qt=RegExp(Ct,"g"),Jt=RegExp(zt+"(?="+zt+")|"+Zt+Wt,"g"),Kt=RegExp([Ft+"?"+Nt+"+"+Xt+"(?="+[kt,Ft,"$"].join("|")+")",Vt+"+"+Yt+"(?="+[kt,Ft+$t,"$"].join("|")+")",Ft+"?"+$t+"+"+Xt,Ft+"+"+Yt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Tt,Gt].join("|"),"g"),tn=RegExp("["+Bt+wt+bt+At+"]"),nn=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,en=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rn=-1,on={};on[I]=on[N]=on[R]=on[z]=on[P]=on[D]=on[L]=on[F]=on[B]=!0,on[p]=on[v]=on[C]=on[g]=on[T]=on[y]=on[_]=on[m]=on[b]=on[x]=on[E]=on[A]=on[O]=on[M]=on[k]=!1;var un={};un[p]=un[v]=un[C]=un[T]=un[g]=un[y]=un[I]=un[N]=un[R]=un[z]=un[P]=un[b]=un[x]=un[E]=un[A]=un[O]=un[M]=un[S]=un[D]=un[L]=un[F]=un[B]=!0,un[_]=un[m]=un[k]=!1;var sn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},an=parseFloat,cn=parseInt,hn="object"==typeof ni&&ni&&ni.Object===Object&&ni,fn="object"==typeof self&&self&&self.Object===Object&&self,ln=hn||fn||Function("return this")(),dn=Jf&&!Jf.nodeType&&Jf,pn=dn&&Qf&&!Qf.nodeType&&Qf,vn=pn&&pn.exports===dn,gn=vn&&hn.process,yn=function(){try{var t=pn&&pn.require&&pn.require("util").types;return t||gn&&gn.binding&&gn.binding("util")}catch(Bl){}}(),_n=yn&&yn.isArrayBuffer,mn=yn&&yn.isDate,wn=yn&&yn.isMap,bn=yn&&yn.isRegExp,xn=yn&&yn.isSet,En=yn&&yn.isTypedArray;function jn(t,n,e){switch(e.length){case 0:return t.call(n);case 1:return t.call(n,e[0]);case 2:return t.call(n,e[0],e[1]);case 3:return t.call(n,e[0],e[1],e[2])}return t.apply(n,e)}function An(t,n,e,r){for(var i=-1,o=null==t?0:t.length;++i-1}function Tn(t,n,e){for(var r=-1,i=null==t?0:t.length;++r-1;);return e}function te(t,n){for(var e=t.length;e--&&Bn(n,t[e],0)>-1;);return e}var ne=Un({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),ee=Un({"&":"&","<":"<",">":">",'"':""","'":"'"});function re(t){return"\\"+sn[t]}function ie(t){return tn.test(t)}function oe(t){var n=-1,e=Array(t.size);return t.forEach((function(t,r){e[++n]=[r,t]})),e}function ue(t,n){return function(e){return t(n(e))}}function se(t,n){for(var e=-1,i=t.length,o=0,u=[];++e",""":'"',"'":"'"}),de=function rt(wt){var bt,xt=(wt=null==wt?ln:de.defaults(ln.Object(),wt,de.pick(ln,en))).Array,Et=wt.Date,jt=wt.Error,At=wt.Function,Ot=wt.Math,Mt=wt.Object,St=wt.RegExp,kt=wt.String,Ct=wt.TypeError,Tt=xt.prototype,It=At.prototype,Nt=Mt.prototype,Rt=wt["__core-js_shared__"],zt=It.toString,Pt=Nt.hasOwnProperty,Dt=0,Lt=(bt=/[^.]+$/.exec(Rt&&Rt.keys&&Rt.keys.IE_PROTO||""))?"Symbol(src)_1."+bt:"",Ft=Nt.toString,Bt=zt.call(Mt),$t=ln._,Vt=St("^"+zt.call(Pt).replace(tt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xt=vn?wt.Buffer:t,Yt=wt.Symbol,Ut=wt.Uint8Array,qt=Xt?Xt.allocUnsafe:t,Wt=ue(Mt.getPrototypeOf,Mt),Gt=Mt.create,Zt=Nt.propertyIsEnumerable,Jt=Tt.splice,tn=Yt?Yt.isConcatSpreadable:t,sn=Yt?Yt.iterator:t,hn=Yt?Yt.toStringTag:t,fn=function(){try{var t=fo(Mt,"defineProperty");return t({},"",{}),t}catch(Bl){}}(),dn=wt.clearTimeout!==ln.clearTimeout&&wt.clearTimeout,pn=Et&&Et.now!==ln.Date.now&&Et.now,gn=wt.setTimeout!==ln.setTimeout&&wt.setTimeout,yn=Ot.ceil,Dn=Ot.floor,Un=Mt.getOwnPropertySymbols,pe=Xt?Xt.isBuffer:t,ve=wt.isFinite,ge=Tt.join,ye=ue(Mt.keys,Mt),_e=Ot.max,me=Ot.min,we=Et.now,be=wt.parseInt,xe=Ot.random,Ee=Tt.reverse,je=fo(wt,"DataView"),Ae=fo(wt,"Map"),Oe=fo(wt,"Promise"),Me=fo(wt,"Set"),Se=fo(wt,"WeakMap"),ke=fo(Mt,"create"),Ce=Se&&new Se,Te={},Ie=$o(je),Ne=$o(Ae),Re=$o(Oe),ze=$o(Me),Pe=$o(Se),De=Yt?Yt.prototype:t,Le=De?De.valueOf:t,Fe=De?De.toString:t;function Be(t){if(is(t)&&!Wu(t)&&!(t instanceof Ye)){if(t instanceof Xe)return t;if(Pt.call(t,"__wrapped__"))return Vo(t)}return new Xe(t)}var $e=function(){function n(){}return function(e){if(!rs(e))return{};if(Gt)return Gt(e);n.prototype=e;var r=new n;return n.prototype=t,r}}();function Ve(){}function Xe(n,e){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=t}function Ye(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=l,this.__views__=[]}function Ue(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n=e?n:e)),n}function ar(n,e,r,i,o,u){var s,a=1&e,c=2&e,h=4&e;if(r&&(s=o?r(n,i,o,u):r(n)),s!==t)return s;if(!rs(n))return n;var f=Wu(n);if(f){if(s=function(t){var n=t.length,e=new t.constructor(n);return n&&"string"==typeof t[0]&&Pt.call(t,"index")&&(e.index=t.index,e.input=t.input),e}(n),!a)return ki(n,s)}else{var l=vo(n),d=l==m||l==w;if(Qu(n))return Ei(n,a);if(l==E||l==p||d&&!o){if(s=c||d?{}:yo(n),!a)return c?function(t,n){return Ci(t,po(t),n)}(n,function(t,n){return t&&Ci(n,zs(n),t)}(s,n)):function(t,n){return Ci(t,lo(t),n)}(n,ir(s,n))}else{if(!un[l])return o?n:{};s=function(t,n,e){var r,i=t.constructor;switch(n){case C:return ji(t);case g:case y:return new i(+t);case T:return function(t,n){var e=n?ji(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.byteLength)}(t,e);case I:case N:case R:case z:case P:case D:case L:case F:case B:return Ai(t,e);case b:return new i;case x:case M:return new i(t);case A:return function(t){var n=new t.constructor(t.source,ft.exec(t));return n.lastIndex=t.lastIndex,n}(t);case O:return new i;case S:return r=t,Le?Mt(Le.call(r)):{}}}(n,l,a)}}u||(u=new Ze);var v=u.get(n);if(v)return v;u.set(n,s),cs(n)?n.forEach((function(t){s.add(ar(t,e,r,t,n,u))})):os(n)&&n.forEach((function(t,i){s.set(i,ar(t,e,r,i,n,u))}));var _=f?t:(h?c?io:ro:c?zs:Rs)(n);return On(_||n,(function(t,i){_&&(t=n[i=t]),nr(s,i,ar(t,e,r,i,n,u))})),s}function cr(n,e,r){var i=r.length;if(null==n)return!i;for(n=Mt(n);i--;){var o=r[i],u=e[o],s=n[o];if(s===t&&!(o in n)||!u(s))return!1}return!0}function hr(e,r,i){if("function"!=typeof e)throw new Ct(n);return To((function(){e.apply(t,i)}),r)}function fr(t,n,e,r){var i=-1,o=Cn,u=!0,s=t.length,a=[],c=n.length;if(!s)return a;e&&(n=In(n,Hn(e))),r?(o=Tn,u=!1):n.length>=200&&(o=Jn,u=!1,n=new Ge(n));t:for(;++i-1},qe.prototype.set=function(t,n){var e=this.__data__,r=er(e,t);return r<0?(++this.size,e.push([t,n])):e[r][1]=n,this},We.prototype.clear=function(){this.size=0,this.__data__={hash:new Ue,map:new(Ae||qe),string:new Ue}},We.prototype.delete=function(t){var n=co(this,t).delete(t);return this.size-=n?1:0,n},We.prototype.get=function(t){return co(this,t).get(t)},We.prototype.has=function(t){return co(this,t).has(t)},We.prototype.set=function(t,n){var e=co(this,t),r=e.size;return e.set(t,n),this.size+=e.size==r?0:1,this},Ge.prototype.add=Ge.prototype.push=function(t){return this.__data__.set(t,e),this},Ge.prototype.has=function(t){return this.__data__.has(t)},Ze.prototype.clear=function(){this.__data__=new qe,this.size=0},Ze.prototype.delete=function(t){var n=this.__data__,e=n.delete(t);return this.size=n.size,e},Ze.prototype.get=function(t){return this.__data__.get(t)},Ze.prototype.has=function(t){return this.__data__.has(t)},Ze.prototype.set=function(t,n){var e=this.__data__;if(e instanceof qe){var r=e.__data__;if(!Ae||r.length<199)return r.push([t,n]),this.size=++e.size,this;e=this.__data__=new We(r)}return e.set(t,n),this.size=e.size,this};var lr=Ni(wr),dr=Ni(br,!0);function pr(t,n){var e=!0;return lr(t,(function(t,r,i){return e=!!n(t,r,i)})),e}function vr(n,e,r){for(var i=-1,o=n.length;++i0&&e(s)?n>1?yr(s,n-1,e,r,i):Nn(i,s):r||(i[i.length]=s)}return i}var _r=Ri(),mr=Ri(!0);function wr(t,n){return t&&_r(t,n,Rs)}function br(t,n){return t&&mr(t,n,Rs)}function xr(t,n){return kn(n,(function(n){return ts(t[n])}))}function Er(n,e){for(var r=0,i=(e=mi(e,n)).length;null!=n&&rn}function Mr(t,n){return null!=t&&Pt.call(t,n)}function Sr(t,n){return null!=t&&n in Mt(t)}function kr(n,e,r){for(var i=r?Tn:Cn,o=n[0].length,u=n.length,s=u,a=xt(u),c=1/0,h=[];s--;){var f=n[s];s&&e&&(f=In(f,Hn(e))),c=me(f.length,c),a[s]=!r&&(e||o>=120&&f.length>=120)?new Ge(s&&f):t}f=n[0];var l=-1,d=a[0];t:for(;++l=s?a:a*("desc"==e[r]?-1:1)}return t.index-n.index}(t,n,e)}))}function Ur(t,n,e){for(var r=-1,i=n.length,o={};++r-1;)s!==t&&Jt.call(s,a,1),Jt.call(t,a,1);return t}function Wr(t,n){for(var e=t?n.length:0,r=e-1;e--;){var i=n[e];if(e==r||i!==o){var o=i;mo(i)?Jt.call(t,i,1):fi(t,i)}}return t}function Gr(t,n){return t+Dn(xe()*(n-t+1))}function Zr(t,n){var e="";if(!t||n<1||n>h)return e;do{n%2&&(e+=t),(n=Dn(n/2))&&(t+=t)}while(n);return e}function Hr(t,n){return Io(Mo(t,n,ua),t+"")}function Qr(t){return Qe(Xs(t))}function Jr(t,n){var e=Xs(t);return zo(e,sr(n,0,e.length))}function Kr(n,e,r,i){if(!rs(n))return n;for(var o=-1,u=(e=mi(e,n)).length,s=u-1,a=n;null!=a&&++oi?0:i+n),(e=e>i?i:e)<0&&(e+=i),i=n>e?0:e-n>>>0,n>>>=0;for(var o=xt(i);++r>>1,u=t[o];null!==u&&!fs(u)&&(e?u<=n:u=200){var c=n?null:Zi(t);if(c)return ae(c);u=!1,i=Jn,a=new Ge}else a=n?[]:s;t:for(;++r=i?n:ri(n,e,r)}var xi=dn||function(t){return ln.clearTimeout(t)};function Ei(t,n){if(n)return t.slice();var e=t.length,r=qt?qt(e):new t.constructor(e);return t.copy(r),r}function ji(t){var n=new t.constructor(t.byteLength);return new Ut(n).set(new Ut(t)),n}function Ai(t,n){var e=n?ji(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)}function Oi(n,e){if(n!==e){var r=n!==t,i=null===n,o=n==n,u=fs(n),s=e!==t,a=null===e,c=e==e,h=fs(e);if(!a&&!h&&!u&&n>e||u&&s&&c&&!a&&!h||i&&s&&c||!r&&c||!o)return 1;if(!i&&!u&&!h&&n1?r[o-1]:t,s=o>2?r[2]:t;for(u=n.length>3&&"function"==typeof u?(o--,u):t,s&&wo(r[0],r[1],s)&&(u=o<3?t:u,o=1),e=Mt(e);++i-1?o[u?e[s]:s]:t}}function Fi(e){return eo((function(r){var i=r.length,o=i,u=Xe.prototype.thru;for(e&&r.reverse();o--;){var s=r[o];if("function"!=typeof s)throw new Ct(n);if(u&&!a&&"wrapper"==uo(s))var a=new Xe([],!0)}for(o=a?o:i;++o1&&m.reverse(),l&&h<_&&(m.length=h),this&&this!==ln&&this instanceof s&&(A=y||Di(A)),A.apply(j,m)}}function $i(t,n){return function(e,r){return function(t,n,e,r){return wr(t,(function(t,i,o){n(r,e(t),i,o)})),r}(e,t,n(r),{})}}function Vi(n,e){return function(r,i){var o;if(r===t&&i===t)return e;if(r!==t&&(o=r),i!==t){if(o===t)return i;"string"==typeof r||"string"==typeof i?(r=ci(r),i=ci(i)):(r=ai(r),i=ai(i)),o=n(r,i)}return o}}function Xi(t){return eo((function(n){return n=In(n,Hn(ao())),Hr((function(e){var r=this;return t(n,(function(t){return jn(t,r,e)}))}))}))}function Yi(n,e){var r=(e=e===t?" ":ci(e)).length;if(r<2)return r?Zr(e,n):e;var i=Zr(e,yn(n/ce(e)));return ie(e)?bi(he(i),0,n).join(""):i.slice(0,n)}function Ui(n){return function(e,r,i){return i&&"number"!=typeof i&&wo(e,r,i)&&(r=i=t),e=gs(e),r===t?(r=e,e=0):r=gs(r),function(t,n,e,r){for(var i=-1,o=_e(yn((n-t)/(e||1)),0),u=xt(o);o--;)u[r?o:++i]=t,t+=e;return u}(e,r,i=i===t?ea))return!1;var h=u.get(n),f=u.get(e);if(h&&f)return h==e&&f==n;var l=-1,d=!0,p=2&r?new Ge:t;for(u.set(n,e),u.set(e,n);++l-1&&t%1==0&&t1?"& ":"")+n[r],n=n.join(e>2?", ":" "),t.replace(it,"{\n/* [wrapped with "+n+"] */\n")}(r,function(t,n){return On(d,(function(e){var r="_."+e[0];n&e[1]&&!Cn(t,r)&&t.push(r)})),t.sort()}(function(t){var n=t.match(ot);return n?n[1].split(ut):[]}(r),e)))}function Ro(n){var e=0,r=0;return function(){var i=we(),o=16-(i-r);if(r=i,o>0){if(++e>=800)return arguments[0]}else e=0;return n.apply(t,arguments)}}function zo(n,e){var r=-1,i=n.length,o=i-1;for(e=e===t?i:e;++r1?n[e-1]:t;return r="function"==typeof r?(n.pop(),r):t,au(n,r)}));function vu(t){var n=Be(t);return n.__chain__=!0,n}function gu(t,n){return n(t)}var yu=eo((function(n){var e=n.length,r=e?n[0]:0,i=this.__wrapped__,o=function(t){return ur(t,n)};return!(e>1||this.__actions__.length)&&i instanceof Ye&&mo(r)?((i=i.slice(r,+r+(e?1:0))).__actions__.push({func:gu,args:[o],thisArg:t}),new Xe(i,this.__chain__).thru((function(n){return e&&!n.length&&n.push(t),n}))):this.thru(o)})),_u=Ti((function(t,n,e){Pt.call(t,e)?++t[e]:or(t,e,1)})),mu=Li(qo),wu=Li(Wo);function bu(t,n){return(Wu(t)?On:lr)(t,ao(n,3))}function xu(t,n){return(Wu(t)?Mn:dr)(t,ao(n,3))}var Eu=Ti((function(t,n,e){Pt.call(t,e)?t[e].push(n):or(t,e,[n])})),ju=Hr((function(t,n,e){var r=-1,i="function"==typeof n,o=Zu(t)?xt(t.length):[];return lr(t,(function(t){o[++r]=i?jn(n,t,e):Cr(t,n,e)})),o})),Au=Ti((function(t,n,e){or(t,e,n)}));function Ou(t,n){return(Wu(t)?In:Fr)(t,ao(n,3))}var Mu=Ti((function(t,n,e){t[e?0:1].push(n)}),(function(){return[[],[]]})),Su=Hr((function(t,n){if(null==t)return[];var e=n.length;return e>1&&wo(t,n[0],n[1])?n=[]:e>2&&wo(n[0],n[1],n[2])&&(n=[n[0]]),Yr(t,yr(n,1),[])})),ku=pn||function(){return ln.Date.now()};function Cu(n,e,r){return e=r?t:e,e=n&&null==e?n.length:e,Qi(n,s,t,t,t,t,e)}function Tu(e,r){var i;if("function"!=typeof r)throw new Ct(n);return e=ys(e),function(){return--e>0&&(i=r.apply(this,arguments)),e<=1&&(r=t),i}}var Iu=Hr((function(t,n,e){var r=1;if(e.length){var i=se(e,so(Iu));r|=o}return Qi(t,r,n,e,i)})),Nu=Hr((function(t,n,e){var r=3;if(e.length){var i=se(e,so(Nu));r|=o}return Qi(n,r,t,e,i)}));function Ru(e,r,i){var o,u,s,a,c,h,f=0,l=!1,d=!1,p=!0;if("function"!=typeof e)throw new Ct(n);function v(n){var r=o,i=u;return o=u=t,f=n,a=e.apply(i,r)}function g(n){var e=n-h;return h===t||e>=r||e<0||d&&n-f>=s}function y(){var t=ku();if(g(t))return _(t);c=To(y,function(t){var n=r-(t-h);return d?me(n,s-(t-f)):n}(t))}function _(n){return c=t,p&&o?v(n):(o=u=t,a)}function m(){var n=ku(),e=g(n);if(o=arguments,u=this,h=n,e){if(c===t)return function(t){return f=t,c=To(y,r),l?v(t):a}(h);if(d)return xi(c),c=To(y,r),v(h)}return c===t&&(c=To(y,r)),a}return r=ms(r)||0,rs(i)&&(l=!!i.leading,s=(d="maxWait"in i)?_e(ms(i.maxWait)||0,r):s,p="trailing"in i?!!i.trailing:p),m.cancel=function(){c!==t&&xi(c),f=0,o=h=u=c=t},m.flush=function(){return c===t?a:_(ku())},m}var zu=Hr((function(t,n){return hr(t,1,n)})),Pu=Hr((function(t,n,e){return hr(t,ms(n)||0,e)}));function Du(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Ct(n);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var u=t.apply(this,n);return r.cache=o.set(i,u)||o,u};return r.cache=new(Du.Cache||We),r}function Lu(t){if("function"!=typeof t)throw new Ct(n);return function(){var n=arguments;switch(n.length){case 0:return!t.call(this);case 1:return!t.call(this,n[0]);case 2:return!t.call(this,n[0],n[1]);case 3:return!t.call(this,n[0],n[1],n[2])}return!t.apply(this,n)}}Du.Cache=We;var Fu=wi((function(t,n){var e=(n=1==n.length&&Wu(n[0])?In(n[0],Hn(ao())):In(yr(n,1),Hn(ao()))).length;return Hr((function(r){for(var i=-1,o=me(r.length,e);++i=n})),qu=Tr(function(){return arguments}())?Tr:function(t){return is(t)&&Pt.call(t,"callee")&&!Zt.call(t,"callee")},Wu=xt.isArray,Gu=_n?Hn(_n):function(t){return is(t)&&Ar(t)==C};function Zu(t){return null!=t&&es(t.length)&&!ts(t)}function Hu(t){return is(t)&&Zu(t)}var Qu=pe||ma,Ju=mn?Hn(mn):function(t){return is(t)&&Ar(t)==y};function Ku(t){if(!is(t))return!1;var n=Ar(t);return n==_||"[object DOMException]"==n||"string"==typeof t.message&&"string"==typeof t.name&&!ss(t)}function ts(t){if(!rs(t))return!1;var n=Ar(t);return n==m||n==w||"[object AsyncFunction]"==n||"[object Proxy]"==n}function ns(t){return"number"==typeof t&&t==ys(t)}function es(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=h}function rs(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}function is(t){return null!=t&&"object"==typeof t}var os=wn?Hn(wn):function(t){return is(t)&&vo(t)==b};function us(t){return"number"==typeof t||is(t)&&Ar(t)==x}function ss(t){if(!is(t)||Ar(t)!=E)return!1;var n=Wt(t);if(null===n)return!0;var e=Pt.call(n,"constructor")&&n.constructor;return"function"==typeof e&&e instanceof e&&zt.call(e)==Bt}var as=bn?Hn(bn):function(t){return is(t)&&Ar(t)==A},cs=xn?Hn(xn):function(t){return is(t)&&vo(t)==O};function hs(t){return"string"==typeof t||!Wu(t)&&is(t)&&Ar(t)==M}function fs(t){return"symbol"==typeof t||is(t)&&Ar(t)==S}var ls=En?Hn(En):function(t){return is(t)&&es(t.length)&&!!on[Ar(t)]},ds=qi(Lr),ps=qi((function(t,n){return t<=n}));function vs(t){if(!t)return[];if(Zu(t))return hs(t)?he(t):ki(t);if(sn&&t[sn])return function(t){for(var n,e=[];!(n=t.next()).done;)e.push(n.value);return e}(t[sn]());var n=vo(t);return(n==b?oe:n==O?ae:Xs)(t)}function gs(t){return t?(t=ms(t))===c||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function ys(t){var n=gs(t),e=n%1;return n==n?e?n-e:n:0}function _s(t){return t?sr(ys(t),0,l):0}function ms(t){if("number"==typeof t)return t;if(fs(t))return f;if(rs(t)){var n="function"==typeof t.valueOf?t.valueOf():t;t=rs(n)?n+"":n}if("string"!=typeof t)return 0===t?t:+t;t=Zn(t);var e=dt.test(t);return e||vt.test(t)?cn(t.slice(2),e?2:8):lt.test(t)?f:+t}function ws(t){return Ci(t,zs(t))}function bs(t){return null==t?"":ci(t)}var xs=Ii((function(t,n){if(jo(n)||Zu(n))Ci(n,Rs(n),t);else for(var e in n)Pt.call(n,e)&&nr(t,e,n[e])})),Es=Ii((function(t,n){Ci(n,zs(n),t)})),js=Ii((function(t,n,e,r){Ci(n,zs(n),t,r)})),As=Ii((function(t,n,e,r){Ci(n,Rs(n),t,r)})),Os=eo(ur),Ms=Hr((function(n,e){n=Mt(n);var r=-1,i=e.length,o=i>2?e[2]:t;for(o&&wo(e[0],e[1],o)&&(i=1);++r1),n})),Ci(t,io(t),e),r&&(e=ar(e,7,to));for(var i=n.length;i--;)fi(e,n[i]);return e})),Fs=eo((function(t,n){return null==t?{}:function(t,n){return Ur(t,n,(function(n,e){return Cs(t,e)}))}(t,n)}));function Bs(t,n){if(null==t)return{};var e=In(io(t),(function(t){return[t]}));return n=ao(n),Ur(t,e,(function(t,e){return n(t,e[0])}))}var $s=Hi(Rs),Vs=Hi(zs);function Xs(t){return null==t?[]:Qn(t,Rs(t))}var Ys=Pi((function(t,n,e){return n=n.toLowerCase(),t+(e?Us(n):n)}));function Us(t){return Ks(bs(t).toLowerCase())}function qs(t){return(t=bs(t))&&t.replace(yt,ne).replace(Qt,"")}var Ws=Pi((function(t,n,e){return t+(e?"-":"")+n.toLowerCase()})),Gs=Pi((function(t,n,e){return t+(e?" ":"")+n.toLowerCase()})),Zs=zi("toLowerCase"),Hs=Pi((function(t,n,e){return t+(e?"_":"")+n.toLowerCase()})),Qs=Pi((function(t,n,e){return t+(e?" ":"")+Ks(n)})),Js=Pi((function(t,n,e){return t+(e?" ":"")+n.toUpperCase()})),Ks=zi("toUpperCase");function ta(n,e,r){return n=bs(n),(e=r?t:e)===t?function(t){return nn.test(t)}(n)?function(t){return t.match(Kt)||[]}(n):function(t){return t.match(st)||[]}(n):n.match(e)||[]}var na=Hr((function(n,e){try{return jn(n,t,e)}catch(Bl){return Ku(Bl)?Bl:new jt(Bl)}})),ea=eo((function(t,n){return On(n,(function(n){n=Bo(n),or(t,n,Iu(t[n],t))})),t}));function ra(t){return function(){return t}}var ia=Fi(),oa=Fi(!0);function ua(t){return t}function sa(t){return zr("function"==typeof t?t:ar(t,1))}var aa=Hr((function(t,n){return function(e){return Cr(e,t,n)}})),ca=Hr((function(t,n){return function(e){return Cr(t,e,n)}}));function ha(t,n,e){var r=Rs(n),i=xr(n,r);null!=e||rs(n)&&(i.length||!r.length)||(e=n,n=t,t=this,i=xr(n,Rs(n)));var o=!(rs(e)&&"chain"in e&&!e.chain),u=ts(t);return On(i,(function(e){var r=n[e];t[e]=r,u&&(t.prototype[e]=function(){var n=this.__chain__;if(o||n){var e=t(this.__wrapped__);return(e.__actions__=ki(this.__actions__)).push({func:r,args:arguments,thisArg:t}),e.__chain__=n,e}return r.apply(t,Nn([this.value()],arguments))})})),t}function fa(){}var la=Xi(In),da=Xi(Sn),pa=Xi(Pn);function va(t){return bo(t)?Yn(Bo(t)):function(t){return function(n){return Er(n,t)}}(t)}var ga=Ui(),ya=Ui(!0);function _a(){return[]}function ma(){return!1}var wa,ba=Vi((function(t,n){return t+n}),0),xa=Gi("ceil"),Ea=Vi((function(t,n){return t/n}),1),ja=Gi("floor"),Aa=Vi((function(t,n){return t*n}),1),Oa=Gi("round"),Ma=Vi((function(t,n){return t-n}),0);return Be.after=function(t,e){if("function"!=typeof e)throw new Ct(n);return t=ys(t),function(){if(--t<1)return e.apply(this,arguments)}},Be.ary=Cu,Be.assign=xs,Be.assignIn=Es,Be.assignInWith=js,Be.assignWith=As,Be.at=Os,Be.before=Tu,Be.bind=Iu,Be.bindAll=ea,Be.bindKey=Nu,Be.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Wu(t)?t:[t]},Be.chain=vu,Be.chunk=function(n,e,r){e=(r?wo(n,e,r):e===t)?1:_e(ys(e),0);var i=null==n?0:n.length;if(!i||e<1)return[];for(var o=0,u=0,s=xt(yn(i/e));oo?0:o+r),(i=i===t||i>o?o:ys(i))<0&&(i+=o),i=r>i?0:_s(i);r>>0)?(n=bs(n))&&("string"==typeof e||null!=e&&!as(e))&&!(e=ci(e))&&ie(n)?bi(he(n),0,r):n.split(e,r):[]},Be.spread=function(t,e){if("function"!=typeof t)throw new Ct(n);return e=null==e?0:_e(ys(e),0),Hr((function(n){var r=n[e],i=bi(n,0,e);return r&&Nn(i,r),jn(t,this,i)}))},Be.tail=function(t){var n=null==t?0:t.length;return n?ri(t,1,n):[]},Be.take=function(n,e,r){return n&&n.length?ri(n,0,(e=r||e===t?1:ys(e))<0?0:e):[]},Be.takeRight=function(n,e,r){var i=null==n?0:n.length;return i?ri(n,(e=i-(e=r||e===t?1:ys(e)))<0?0:e,i):[]},Be.takeRightWhile=function(t,n){return t&&t.length?di(t,ao(n,3),!1,!0):[]},Be.takeWhile=function(t,n){return t&&t.length?di(t,ao(n,3)):[]},Be.tap=function(t,n){return n(t),t},Be.throttle=function(t,e,r){var i=!0,o=!0;if("function"!=typeof t)throw new Ct(n);return rs(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),Ru(t,e,{leading:i,maxWait:e,trailing:o})},Be.thru=gu,Be.toArray=vs,Be.toPairs=$s,Be.toPairsIn=Vs,Be.toPath=function(t){return Wu(t)?In(t,Bo):fs(t)?[t]:ki(Fo(bs(t)))},Be.toPlainObject=ws,Be.transform=function(t,n,e){var r=Wu(t),i=r||Qu(t)||ls(t);if(n=ao(n,4),null==e){var o=t&&t.constructor;e=i?r?new o:[]:rs(t)&&ts(o)?$e(Wt(t)):{}}return(i?On:wr)(t,(function(t,r,i){return n(e,t,r,i)})),e},Be.unary=function(t){return Cu(t,1)},Be.union=iu,Be.unionBy=ou,Be.unionWith=uu,Be.uniq=function(t){return t&&t.length?hi(t):[]},Be.uniqBy=function(t,n){return t&&t.length?hi(t,ao(n,2)):[]},Be.uniqWith=function(n,e){return e="function"==typeof e?e:t,n&&n.length?hi(n,t,e):[]},Be.unset=function(t,n){return null==t||fi(t,n)},Be.unzip=su,Be.unzipWith=au,Be.update=function(t,n,e){return null==t?t:li(t,n,_i(e))},Be.updateWith=function(n,e,r,i){return i="function"==typeof i?i:t,null==n?n:li(n,e,_i(r),i)},Be.values=Xs,Be.valuesIn=function(t){return null==t?[]:Qn(t,zs(t))},Be.without=cu,Be.words=ta,Be.wrap=function(t,n){return Bu(_i(n),t)},Be.xor=hu,Be.xorBy=fu,Be.xorWith=lu,Be.zip=du,Be.zipObject=function(t,n){return gi(t||[],n||[],nr)},Be.zipObjectDeep=function(t,n){return gi(t||[],n||[],Kr)},Be.zipWith=pu,Be.entries=$s,Be.entriesIn=Vs,Be.extend=Es,Be.extendWith=js,ha(Be,Be),Be.add=ba,Be.attempt=na,Be.camelCase=Ys,Be.capitalize=Us,Be.ceil=xa,Be.clamp=function(n,e,r){return r===t&&(r=e,e=t),r!==t&&(r=(r=ms(r))==r?r:0),e!==t&&(e=(e=ms(e))==e?e:0),sr(ms(n),e,r)},Be.clone=function(t){return ar(t,4)},Be.cloneDeep=function(t){return ar(t,5)},Be.cloneDeepWith=function(n,e){return ar(n,5,e="function"==typeof e?e:t)},Be.cloneWith=function(n,e){return ar(n,4,e="function"==typeof e?e:t)},Be.conformsTo=function(t,n){return null==n||cr(t,n,Rs(n))},Be.deburr=qs,Be.defaultTo=function(t,n){return null==t||t!=t?n:t},Be.divide=Ea,Be.endsWith=function(n,e,r){n=bs(n),e=ci(e);var i=n.length,o=r=r===t?i:sr(ys(r),0,i);return(r-=e.length)>=0&&n.slice(r,o)==e},Be.eq=Xu,Be.escape=function(t){return(t=bs(t))&&W.test(t)?t.replace(U,ee):t},Be.escapeRegExp=function(t){return(t=bs(t))&&nt.test(t)?t.replace(tt,"\\$&"):t},Be.every=function(n,e,r){var i=Wu(n)?Sn:pr;return r&&wo(n,e,r)&&(e=t),i(n,ao(e,3))},Be.find=mu,Be.findIndex=qo,Be.findKey=function(t,n){return Ln(t,ao(n,3),wr)},Be.findLast=wu,Be.findLastIndex=Wo,Be.findLastKey=function(t,n){return Ln(t,ao(n,3),br)},Be.floor=ja,Be.forEach=bu,Be.forEachRight=xu,Be.forIn=function(t,n){return null==t?t:_r(t,ao(n,3),zs)},Be.forInRight=function(t,n){return null==t?t:mr(t,ao(n,3),zs)},Be.forOwn=function(t,n){return t&&wr(t,ao(n,3))},Be.forOwnRight=function(t,n){return t&&br(t,ao(n,3))},Be.get=ks,Be.gt=Yu,Be.gte=Uu,Be.has=function(t,n){return null!=t&&go(t,n,Mr)},Be.hasIn=Cs,Be.head=Zo,Be.identity=ua,Be.includes=function(t,n,e,r){t=Zu(t)?t:Xs(t),e=e&&!r?ys(e):0;var i=t.length;return e<0&&(e=_e(i+e,0)),hs(t)?e<=i&&t.indexOf(n,e)>-1:!!i&&Bn(t,n,e)>-1},Be.indexOf=function(t,n,e){var r=null==t?0:t.length;if(!r)return-1;var i=null==e?0:ys(e);return i<0&&(i=_e(r+i,0)),Bn(t,n,i)},Be.inRange=function(n,e,r){return e=gs(e),r===t?(r=e,e=0):r=gs(r),function(t,n,e){return t>=me(n,e)&&t<_e(n,e)}(n=ms(n),e,r)},Be.invoke=Ns,Be.isArguments=qu,Be.isArray=Wu,Be.isArrayBuffer=Gu,Be.isArrayLike=Zu,Be.isArrayLikeObject=Hu,Be.isBoolean=function(t){return!0===t||!1===t||is(t)&&Ar(t)==g},Be.isBuffer=Qu,Be.isDate=Ju,Be.isElement=function(t){return is(t)&&1===t.nodeType&&!ss(t)},Be.isEmpty=function(t){if(null==t)return!0;if(Zu(t)&&(Wu(t)||"string"==typeof t||"function"==typeof t.splice||Qu(t)||ls(t)||qu(t)))return!t.length;var n=vo(t);if(n==b||n==O)return!t.size;if(jo(t))return!Pr(t).length;for(var e in t)if(Pt.call(t,e))return!1;return!0},Be.isEqual=function(t,n){return Ir(t,n)},Be.isEqualWith=function(n,e,r){var i=(r="function"==typeof r?r:t)?r(n,e):t;return i===t?Ir(n,e,t,r):!!i},Be.isError=Ku,Be.isFinite=function(t){return"number"==typeof t&&ve(t)},Be.isFunction=ts,Be.isInteger=ns,Be.isLength=es,Be.isMap=os,Be.isMatch=function(t,n){return t===n||Nr(t,n,ho(n))},Be.isMatchWith=function(n,e,r){return r="function"==typeof r?r:t,Nr(n,e,ho(e),r)},Be.isNaN=function(t){return us(t)&&t!=+t},Be.isNative=function(t){if(Eo(t))throw new jt("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Rr(t)},Be.isNil=function(t){return null==t},Be.isNull=function(t){return null===t},Be.isNumber=us,Be.isObject=rs,Be.isObjectLike=is,Be.isPlainObject=ss,Be.isRegExp=as,Be.isSafeInteger=function(t){return ns(t)&&t>=-9007199254740991&&t<=h},Be.isSet=cs,Be.isString=hs,Be.isSymbol=fs,Be.isTypedArray=ls,Be.isUndefined=function(n){return n===t},Be.isWeakMap=function(t){return is(t)&&vo(t)==k},Be.isWeakSet=function(t){return is(t)&&"[object WeakSet]"==Ar(t)},Be.join=function(t,n){return null==t?"":ge.call(t,n)},Be.kebabCase=Ws,Be.last=Ko,Be.lastIndexOf=function(n,e,r){var i=null==n?0:n.length;if(!i)return-1;var o=i;return r!==t&&(o=(o=ys(r))<0?_e(i+o,0):me(o,i-1)),e==e?function(t,n,e){for(var r=e+1;r--;)if(t[r]===n)return r;return r}(n,e,o):Fn(n,Vn,o,!0)},Be.lowerCase=Gs,Be.lowerFirst=Zs,Be.lt=ds,Be.lte=ps,Be.max=function(n){return n&&n.length?vr(n,ua,Or):t},Be.maxBy=function(n,e){return n&&n.length?vr(n,ao(e,2),Or):t},Be.mean=function(t){return Xn(t,ua)},Be.meanBy=function(t,n){return Xn(t,ao(n,2))},Be.min=function(n){return n&&n.length?vr(n,ua,Lr):t},Be.minBy=function(n,e){return n&&n.length?vr(n,ao(e,2),Lr):t},Be.stubArray=_a,Be.stubFalse=ma,Be.stubObject=function(){return{}},Be.stubString=function(){return""},Be.stubTrue=function(){return!0},Be.multiply=Aa,Be.nth=function(n,e){return n&&n.length?Xr(n,ys(e)):t},Be.noConflict=function(){return ln._===this&&(ln._=$t),this},Be.noop=fa,Be.now=ku,Be.pad=function(t,n,e){t=bs(t);var r=(n=ys(n))?ce(t):0;if(!n||r>=n)return t;var i=(n-r)/2;return Yi(Dn(i),e)+t+Yi(yn(i),e)},Be.padEnd=function(t,n,e){t=bs(t);var r=(n=ys(n))?ce(t):0;return n&&re){var i=n;n=e,e=i}if(r||n%1||e%1){var o=xe();return me(n+o*(e-n+an("1e-"+((o+"").length-1))),e)}return Gr(n,e)},Be.reduce=function(t,n,e){var r=Wu(t)?Rn:qn,i=arguments.length<3;return r(t,ao(n,4),e,i,lr)},Be.reduceRight=function(t,n,e){var r=Wu(t)?zn:qn,i=arguments.length<3;return r(t,ao(n,4),e,i,dr)},Be.repeat=function(n,e,r){return e=(r?wo(n,e,r):e===t)?1:ys(e),Zr(bs(n),e)},Be.replace=function(){var t=arguments,n=bs(t[0]);return t.length<3?n:n.replace(t[1],t[2])},Be.result=function(n,e,r){var i=-1,o=(e=mi(e,n)).length;for(o||(o=1,n=t);++ih)return[];var e=l,r=me(t,l);n=ao(n),t-=l;for(var i=Gn(r,n);++e=u)return n;var a=r-ce(i);if(a<1)return i;var c=s?bi(s,0,a).join(""):n.slice(0,a);if(o===t)return c+i;if(s&&(a+=c.length-a),as(o)){if(n.slice(a).search(o)){var h,f=c;for(o.global||(o=St(o.source,bs(ft.exec(o))+"g")),o.lastIndex=0;h=o.exec(f);)var l=h.index;c=c.slice(0,l===t?a:l)}}else if(n.indexOf(ci(o),a)!=a){var d=c.lastIndexOf(o);d>-1&&(c=c.slice(0,d))}return c+i},Be.unescape=function(t){return(t=bs(t))&&q.test(t)?t.replace(Y,le):t},Be.uniqueId=function(t){var n=++Dt;return bs(t)+n},Be.upperCase=Js,Be.upperFirst=Ks,Be.each=bu,Be.eachRight=xu,Be.first=Zo,ha(Be,(wa={},wr(Be,(function(t,n){Pt.call(Be.prototype,n)||(wa[n]=t)})),wa),{chain:!1}),Be.VERSION="4.17.21",On(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Be[t].placeholder=Be})),On(["drop","take"],(function(n,e){Ye.prototype[n]=function(r){r=r===t?1:_e(ys(r),0);var i=this.__filtered__&&!e?new Ye(this):this.clone();return i.__filtered__?i.__takeCount__=me(r,i.__takeCount__):i.__views__.push({size:me(r,l),type:n+(i.__dir__<0?"Right":"")}),i},Ye.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}})),On(["filter","map","takeWhile"],(function(t,n){var e=n+1,r=1==e||3==e;Ye.prototype[t]=function(t){var n=this.clone();return n.__iteratees__.push({iteratee:ao(t,3),type:e}),n.__filtered__=n.__filtered__||r,n}})),On(["head","last"],(function(t,n){var e="take"+(n?"Right":"");Ye.prototype[t]=function(){return this[e](1).value()[0]}})),On(["initial","tail"],(function(t,n){var e="drop"+(n?"":"Right");Ye.prototype[t]=function(){return this.__filtered__?new Ye(this):this[e](1)}})),Ye.prototype.compact=function(){return this.filter(ua)},Ye.prototype.find=function(t){return this.filter(t).head()},Ye.prototype.findLast=function(t){return this.reverse().find(t)},Ye.prototype.invokeMap=Hr((function(t,n){return"function"==typeof t?new Ye(this):this.map((function(e){return Cr(e,t,n)}))})),Ye.prototype.reject=function(t){return this.filter(Lu(ao(t)))},Ye.prototype.slice=function(n,e){n=ys(n);var r=this;return r.__filtered__&&(n>0||e<0)?new Ye(r):(n<0?r=r.takeRight(-n):n&&(r=r.drop(n)),e!==t&&(r=(e=ys(e))<0?r.dropRight(-e):r.take(e-n)),r)},Ye.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Ye.prototype.toArray=function(){return this.take(l)},wr(Ye.prototype,(function(n,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),o=Be[i?"take"+("last"==e?"Right":""):e],u=i||/^find/.test(e);o&&(Be.prototype[e]=function(){var e=this.__wrapped__,s=i?[1]:arguments,a=e instanceof Ye,c=s[0],h=a||Wu(e),f=function(t){var n=o.apply(Be,Nn([t],s));return i&&l?n[0]:n};h&&r&&"function"==typeof c&&1!=c.length&&(a=h=!1);var l=this.__chain__,d=!!this.__actions__.length,p=u&&!l,v=a&&!d;if(!u&&h){e=v?e:new Ye(this);var g=n.apply(e,s);return g.__actions__.push({func:gu,args:[f],thisArg:t}),new Xe(g,l)}return p&&v?n.apply(this,s):(g=this.thru(f),p?i?g.value()[0]:g.value():g)})})),On(["pop","push","shift","sort","splice","unshift"],(function(t){var n=Tt[t],e=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Be.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return n.apply(Wu(i)?i:[],t)}return this[e]((function(e){return n.apply(Wu(e)?e:[],t)}))}})),wr(Ye.prototype,(function(t,n){var e=Be[n];if(e){var r=e.name+"";Pt.call(Te,r)||(Te[r]=[]),Te[r].push({name:n,func:e})}})),Te[Bi(t,2).name]=[{name:"wrapper",func:t}],Ye.prototype.clone=function(){var t=new Ye(this.__wrapped__);return t.__actions__=ki(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=ki(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=ki(this.__views__),t},Ye.prototype.reverse=function(){if(this.__filtered__){var t=new Ye(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Ye.prototype.value=function(){var t=this.__wrapped__.value(),n=this.__dir__,e=Wu(t),r=n<0,i=e?t.length:0,o=function(t,n,e){for(var r=-1,i=e.length;++r=this.__values__.length;return{done:n,value:n?t:this.__values__[this.__index__++]}},Be.prototype.plant=function(n){for(var e,r=this;r instanceof Ve;){var i=Vo(r);i.__index__=0,i.__values__=t,e?o.__wrapped__=i:e=i;var o=i;r=r.__wrapped__}return o.__wrapped__=n,e},Be.prototype.reverse=function(){var n=this.__wrapped__;if(n instanceof Ye){var e=n;return this.__actions__.length&&(e=new Ye(this)),(e=e.reverse()).__actions__.push({func:gu,args:[ru],thisArg:t}),new Xe(e,this.__chain__)}return this.thru(ru)},Be.prototype.toJSON=Be.prototype.valueOf=Be.prototype.value=function(){return pi(this.__wrapped__,this.__actions__)},Be.prototype.first=Be.prototype.head,sn&&(Be.prototype[sn]=function(){return this}),Be}();pn?((pn.exports=de)._=de,dn._=de):ln._=de}.call(ni);var tl=Kf.exports;function nl(t,n){const e=function(t,n){const e=new Set,r=new Hf.Graph({directed:!0}),i=[];if(!t.hasNode(n))throw Error("node not in graph");return el(t,n,e,r,i),t.nodes().forEach((n=>{e.has(n)||el(t,n,e,r,i)})),i.forEach(((t,n)=>{r.node(t).thread=n+1{const r=function(t,n,e){const r=t.node(n),i=t.node(e);if(r.depthr.depth;){if(n===e)return 1;n=t.node(n).thread}}else if(i.depthi.depth;){if(e===n)return-1;e=t.node(e).thread}}return 0}(e,n.v,n.w);if(r<0){const e=t.edge(n)||{};e.reversed=!0,t.removeEdge(n),t.setEdge(n.w,n.v,e)}})),t}function el(t,n,e,r,i,o=0){if(!e.has(n)){e.add(n),i.push(n),r.setNode(n,{depth:o});t.outEdges(n).map((t=>t.w)).forEach((u=>{e.has(u)||r.setEdge(n,u,{delta:1}),el(t,u,e,r,i,o+1)}))}}var rl=function(){for(var t=0;t0?[{type:"min",nodes:[e[0]]},...n]:[{type:"min",nodes:[t.nodes()[0]]},...n]}const i=new Map;let o=0;return n.forEach((t=>{if(!t.nodes||0===t.nodes.length)return;const n=""+o++;t.nodes.forEach((t=>{i.set(t,n)})),e.setNode(n,{type:t.type,nodes:t.nodes})})),t.nodes().forEach((t=>{if(!i.has(t)){const n=""+o++,r={type:"same",nodes:[t]};i.set(t,n),e.setNode(n,r)}})),t.edges().forEach((n=>{const r=i.has(n.v)?i.get(n.v):n.v,o=i.has(n.w)?i.get(n.w):n.w,u=t.node(n.v)||{},s=t.node(n.w)||{},a=e.edge(r,o)||{delta:0};r===o?(a.delta=0,e.setEdge(r,o,a)):"l"===u.direction?(a.delta=Math.max(a.delta,"l"===s.direction?1:0),e.setEdge(o,r,a)):(a.delta=Math.max(a.delta,"l"===s.direction?0:1),e.setEdge(r,o,a))})),e}(t,n);!function(t){t.sources().forEach((n=>{"0"!==n&&t.setEdge("0",n,{temp:!0,delta:0})}))}(e),nl(e,"0"),function(t){const n=t.sources(),e=new Set,r=new Set;for(t.edges().forEach((t=>{t.v===t.w&&r.add(t)}));n.length>0;){const i=n.shift();e.add(i);let o=t.node(i);o||t.setNode(i,o={}),o.rank=0;for(const n of t.inEdges(i)){const e=il((t.edge(n)||{}).delta,1);o.rank=Math.max(o.rank,t.node(n.v).rank+e)}for(const n of t.outEdges(i))r.add(n);for(const u of t.nodes())n.indexOf(u)<0&&!e.has(u)&&!t.inEdges(u).some((t=>!r.has(t)))&&n.push(u)}}(e),function(t){function n(n){const e=t.node(n),r=tl.min(t.outEdges(n).map((n=>t.node(n.w).rank-t.edge(n).delta)));void 0!==r&&(e.rank=r)}t.edges().forEach((e=>{t.edge(e).temp&&n(e.w)}))}(e),t.nodes().forEach((n=>{t.node(n)||t.setNode(n,{})})),e.nodes().forEach((n=>{const r=e.node(n);r.nodes.forEach((n=>{t.node(n).rank=r.rank}))}))}function ul(t,n,e){return function(t,n,e){let r,i,o;n.length>e.length?(r=n,i=e):(r=e,i=n);const u=[];r.forEach((n=>{i.forEach(((e,r)=>{(t.hasEdge(n,e)||t.hasEdge(e,n))&&u.push(r)}))}));let s=1;for(;s{let n=t+s;for(c[n]++;n>0;)n%2&&(h+=c[n+1]),n=Math.floor((n-1)/2),c[n]++})),h}(t,n,e)}function sl(t,n){let e=!0;for(;e;){e=!1;for(let r=0;r0&&(r+=ul(t,n[e-1],n[e])),e+10)for(let i=1;i{const u=hl(ll(t,n,i,i-1,o,r));e.set(o,u)})),dl(n[i],e)}else for(let i=n.length-2;i>=0;--i){const e=new Map;n[i].forEach((o=>{const u=hl(ll(t,n,i,i+1,o,r));e.set(o,u)})),dl(n[i],e)}}function ll(t,n,e,r,i,o=!1){const u=n[e],s=n[r],a=[];return s.forEach(((n,e)=>{t.nodeEdges(n,i).length>0&&a.push(e)})),0===a.length&&o&&u.forEach(((n,e)=>{t.nodeEdges(n,i).length>0&&a.push(e+.5)})),a.sort(((t,n)=>t-n)),a}function dl(t,n){const e=new Map(t.map(((t,n)=>[t,n])));for(let r=1;r0;--i){let r=i-1,o=n.get(t[r]),u=n.get(t[i]);for(;-1===(o=n.get(t[r]))&&r>0;)r--;if(-1===u||-1===o)break;if(o===u&&(o=e.get(t[r]),u=e.get(t[i])),u>=o)break;[t[i],t[r]]=[t[r],t[i]]}}function pl(t,n=25){const e=function(t){const n=[];let e=t.nodes().filter((n=>0===t.node(n).rank)).concat(t.sources());return 0===e.length&&(e=t.nodes().slice(0,1)),Hf.alg.preorder(t,e).forEach((e=>{const r=t.node(e).rank;for(;r>=n.length;)n.push([]);n[r].push(e)})),n}(t);let r=e,i=0;for(;i++[t])),r}function vl(t,n){let e=0;for(let r=0;r{const i=`__${n.v}_${n.w}_${e}`;return t.setNode(i,{rank:e,dummy:!0,data:null,direction:r}),i})),o=[n.v,...i,n.w];o.forEach(((e,r)=>{r+1{const r=t.node(n);r.dy=r.value*e})),t.edges().forEach((r=>{const i=t.edge(r);i.value=n(i),i.dy=i.value*e}))}(s,i,n);const c=wl(s,a);a.forEach((n=>{let i=0;n.forEach(((n,o)=>{const u=c[o]/tl.sumBy(c)*t[1],a=0===i?0:e*u/5,h=u-2*a,f=tl.sumBy(n,(t=>s.node(t).dy)),l=n.map(((t,e)=>s.node(t).value&&n[e+1]?r(n[e],n[e+1],s):0)),d=Math.max(0,h-f),p=tl.sumBy(l)?d/tl.sumBy(l):0;let v=i+a;1===n.length&&(v+=(h-s.node(n[0]).dy)/2);let g=Number.MAX_VALUE;n.forEach(((t,n)=>{const e=s.node(t);e.y=v,e.spaceAbove=g,e.spaceBelow=l[n]*p,v+=e.dy+e.spaceBelow,g=e.spaceBelow,e.data&&void 0!==e.data.forceY&&(e.y=a+e.data.forceY*(h-e.dy))})),n.length>0&&(s.node(n[n.length-1]).spaceBelow=Number.MAX_VALUE),i+=u}))}));const h=function(t,n){const e=[];return n.forEach(((r,i)=>{if(i===n.length-1)return;let o=0;r.forEach((n=>{n.forEach((n=>{t.outEdges(n).forEach((n=>{const e=t.edge(n).dy,r=t.node(n.w).y-t.node(n.v).y,i=Math.abs(r)-e,u=e*e-i*i,s=u>=0?Math.sqrt(u):e;s>o&&(o=s)}))}))})),e.push(o)})),e}(s,a);!function(t,n,e,r){const i=tl.sumBy(r);let o;if(i>e)o=r.map((t=>e*t/i));else{const t=e-i;o=r.map((e=>e+t/(n.length-1)))}let u=0;n.forEach(((n,e)=>{n.forEach((n=>{n.forEach((n=>{t.node(n).x=u}))})),u+=o[e]}))}(s,a,t[0],h);const f=[];return s.nodes().forEach((t=>{const n=s.node(t);n.id=t,f.push(n)})),f}return u.scaleToFit=function(r,u){ml(r,i,o);const s=tl.sumBy(wl(r,u));s<=0?n=1:(n=t[1]/s,1!=e&&(n*=1-e))},u.size=function(n){return arguments.length?(t=n,u):t},u.separation=function(t){return arguments.length?(r=tl.isFunction(t)?t:()=>t,u):r},u.whitespace=function(t){return arguments.length?(e=t,u):e},u.scale=function(t){return arguments.length?(n=t,u):n},u}function ml(t,n,e){t.nodes().forEach((r=>{const i=tl.sumBy(t.inEdges(r),(e=>n(t.edge(e)))),o=tl.sumBy(t.outEdges(r),(e=>n(t.edge(e))));let u=t.node(r);u||t.setNode(r,u={}),u.value=Math.max(i,o),void 0===u.direction&&(u.direction=e(u)||"r")}))}function wl(t,n){if(0===n.length||0===n[0].length)return[];const e=n[0].length,r=new Array(e);for(let i=0;i{n.forEach(((n,e)=>{const i=tl.sumBy(n,(n=>t.node(n).value));r[e]=Math.max(r[e],i)}))})),r}function bl(t,n){const e=t.inEdges(n),r=t.outEdges(n),i=new Map;[...e,...r].forEach((t=>{i.has(t.name)||i.set(t.name,[]),i.get(t.name).push(t)}));const o=new Map(Array.from(i.entries()).map((([e,r])=>{const i=tl.sumBy(r,(n=>t.edge(n).value));return[e,tl.sumBy(r,(e=>t.edge(e).value*function(e){if(e.v===n)return t.node(e.w).y;if(e.w===n)return t.node(e.v).y;throw new Error}(e)))/i]}))),u=Array.from(o.keys());return u.sort(),u}function xl(t,n){if(null===n.w)return 0;if(null===n.v)return 0;if(n.w===n.v)return Math.PI/2;{const e=t.node(n.v),r=t.node(n.w);return Math.atan2(r.y-e.y,r.x-e.x)}}function El(t,n=!0){return function(e,r){const i=xl(t,e),o=xl(t,r),u=n?1:-1;return e.v===r.v&&e.w===r.w?"number"==typeof e.name&&"number"==typeof r.name?e.name-r.name:"string"==typeof e.name&&"string"==typeof r.name?e.name.localeCompare(r.name):0:Math.abs(i-o)<.001?e.v&&e.w&&r.v&&r.w?e.w===r.w?-1*(t.node(e.v).y-t.node(r.v).y):e.v===r.v?-1*(t.node(e.w).y-t.node(r.w).y):0:0:u*(i-o)}}function jl(t,n,e=!0){return function(r,i){if(r.name!==i.name)return n.indexOf(r.name)-n.indexOf(i.name);const o=xl(t,r),u=xl(t,i),s=e?1:-1;return Math.abs(o-u)<.001?r.v&&r.w&&i.v&&i.w?r.w===i.w?s*(o>0?-1:1)*(t.node(r.v).y-t.node(i.v).y):r.v===i.v?s*(o>0?-1:1)*(t.node(r.w).y-t.node(i.w).y):0:0:s*(o-u)}}function Al(t,n){let e=null;for(let r=0;r=0;--o)e=t[o].dy/2,t[o][n]-ei&&(t[o][n]=Math.max(e,i-e)),i=t[o][n]-e}function Ml(t){return function(n){!function(t,n){t.nodes().forEach((e=>{const r=t.node(e);let i=0,o=0;r.outgoing.forEach((e=>{const o=t.edge(e);o.x0=r.x+n.nodeWidth/2,o.y0=r.y+i+o.dy/2,o.d0=r.direction||"r",i+=o.dy})),r.incoming.forEach((e=>{const i=t.edge(e);i.x1=r.x-n.nodeWidth/2,i.y1=r.y+o+i.dy/2,i.d1=r.direction||"r",o+=i.dy}))}))}(n,t),function(t){t.nodes().forEach((n=>{const e=t.node(n),r=e.outgoing.map((n=>t.edge(n))),i=e.incoming.map((n=>t.edge(n)));r.sort(((t,n)=>t.y0-n.y0)),i.sort(((t,n)=>t.y1-n.y1)),Sl(r,"r0"),Sl(i,"r1")}))}(n);const e=[];return n.edges().forEach((t=>{const r=n.edge(t);r.id=`${t.v}-${t.w}-${t.name}`,e.push(r)})),e}}function Sl(t,n){t.forEach((t=>{t.Rmax=function(t){const n=t.x1-t.x0,e=t.y1-t.y0;return t.d0!==t.d1?Math.abs(e)/2.1:0!==e?(n*n+e*e)/Math.abs(4*e):1/0}(t),t[n]=Math.max(t.dy/2,t.d0===t.d1?.6*t.Rmax:5+t.dy/2)}));let e=Al(t,"r0"===n?t=>t.y1>t.y0:t=>t.y0>t.y1);if(null===e&&(e=t.length),Ol(t.slice(e),n),e>0){const r=[];for(let n=e-1;n>=0;n--)r.push(t[n]);Ol(r,n)}}function kl(t){const n=_l(),e=Ml(t);let r=[],i=[],o=null;function u(t=[],u=[],s={}){const a=function(t=[],n=[]){const e=new Hf.Graph({directed:!0,multigraph:!0});return n.forEach((t=>{e.setEdge(t.source,t.target,{data:t},t.type)})),e.nodes().forEach((t=>e.setNode(t,{data:{}}))),t.forEach((t=>{e.hasNode(t.id)&&(e.node(t.id).data=t,void 0!==t.direction&&(e.node(t.id).direction=t.direction))})),e.edges().forEach((t=>{e.edge(t).source=e.node(t.v),e.edge(t).target=e.node(t.w)})),e}(u,t);var c;return s.order?(ol(a,s.rankSets||[]),o=s.order,o.length>0&&o[0].length>0&&!tl.isArray(o[0][0])&&(o=o.map((t=>[t]))),o=o.map((t=>t.map((t=>t.filter((t=>void 0!==a.node(t)))))))):(ol(a,s.rankSets||[]),(c=a).edges().forEach((t=>{const n=c.node(t.v),e=c.node(t.w);let r=n.rank;const i=[];if(r+1<=e.rank){for("l"===n.direction&&i.push(r);++re.rank){for("l"!==n.direction&&i.push(r);r-- >e.rank+1;)i.push(r);"l"!==e.direction&&i.push(r),yl(c,t,i,"l")}})),o=pl(a)),r=n(a,o),function(t,{alignLinkTypes:n=!1}={}){t.nodes().forEach((e=>{const r=t.node(e);if(r.incoming=t.inEdges(e),r.outgoing=t.outEdges(e),n){const n=bl(t,e);r.incoming.sort(jl(t,n,!1)),r.outgoing.sort(jl(t,n,!0))}else r.incoming.sort(El(t,!1)),r.outgoing.sort(El(t,!0))}))}(a,{alignLinkTypes:s.alignLinkTypes||!1}),i=e(a),a}return u.nodes=function(){return r},u.links=function(){return i},u.order=function(){return o},u.size=function(t){return arguments.length?(n.size(t),u):n.size()},u.separation=function(t){return arguments.length?(n.separation(t),u):n.separation()},u.whitespace=function(t){return arguments.length?(n.whitespace(t),u):n.whitespace()},u.edgeValue=function(t){return u},u.scale=function(t){return arguments.length?(n.scale(t),u):n.scale()},u}function Cl(t){const n=Math.max(0===t.dy?0:2,t.dy)/2;let e=t.x0,r=t.x1,i=t.y0,o=t.y1;ri?1:-1,s=function(t){const n=t.x1-t.x0,e=t.y1-t.y0;return[t.dy/2,(n*n+e*e)/Math.abs(4*e)]}(t),a=Math.max(s[0],Math.min(s[1],(r-e)/3));let c=Math.max(s[0],Math.min(s[1],t.r0||a)),h=Math.max(s[0],Math.min(s[1],t.r1||a));const f=r-e,l=o-i-u*(c+h),d=Math.sqrt(f*f+l*l),p=-u*Math.acos(Math.min(1,(c+h)/d)),v=Math.atan2(l,f);let g=Math.PI/2+u*(v+p),y=n*u*Math.sin(g),_=n*Math.cos(g),m=e+1*c*Math.sin(Math.abs(g)),w=r-1*h*Math.sin(Math.abs(g)),b=i+c*u*(1-Math.cos(g)),x=o-h*u*(1-Math.cos(g));function E(t,e){const r=t*(o-i)>0?1:0;let u=1*t*(o-i)>0?e+n:e-n;return 0===g&&(u=e),"A"+u+" "+u+" "+Math.abs(g)+" 0 "+r+" "}(isNaN(g)||Math.abs(g)<.001)&&(g=c=h=0,m=e,w=r,b=i,x=o,y=0,_=n);const j="M"+[e,i-n]+" "+E(1,c)+[m+y,b-_]+" L"+[w+y,x-_]+" "+E(-1,h)+[r,o-n]+" L"+[r,o+n]+" "+E(1,h)+[w-y,x+_]+" L"+[m-y,b+_]+" "+E(-1,c)+[e,i+n]+" Z";return/NaN/.test(j)&&console.error("path NaN",t,j),j}function Tl(t,n,e,r){const i=new Un;return i.attr({transform:void 0!==t&&void 0!==n?`translate(${t}, ${n})`:void 0,"data-self":e,"data-parent":r}),i}const Il=(t,n)=>{const e=void 0!==t.title?t.title:t.id;return n&&e.length>n?`${e.substr(0,15)}...`:e};function Nl(t,{fontColor:n,nodeWidth:e,maxRank:r}){const{data:i}=t,o=function(t,n){let e=!1,r=!1;return t.rank{"function"==typeof f&&f(t)})),d.add(p),t.data){const e=Nl(t,{fontColor:l,nodeWidth:a,maxRank:n});d.add(e)}return d}const zl=["#ACD5FC","#E37816","#07CC80","#0871D4","#CB8E55","#9FAE29","#427565","#6D55A6","#FEF445","#E177C2","#F48B7B","#D74B05","#AA896F","#14A14D","#C5114D"],Pl=(t="",n,e="")=>{const r=document.getElementById(t);n?null==r||r.setAttribute("style",n):null==r||r.removeAttribute("style"),(null==r?void 0:r.innerHTML.replaceAll("'",'"'))!==e.replaceAll("'",'"')&&r&&(r.innerHTML=e)},Dl=t=>t.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((t,n)=>(n?"-":"")+t.toLowerCase()));class Ll extends te{constructor(t,n){super(t,n.width,n.height,n.canvasStyle,n.spacing),this.element=t,this.options=n}construct(t){const{width:n,height:e,spacing:r,nodeWidth:i}=this.options,o=kl({nodeWidth:i});o.size([n-i,e-r]);const u=t.nodes.map(((t,n)=>{const e=n%zl.length;return{...t,color:t.color??zl[e],colorIndex:e}})),s=o(t.edges,u,t.options);this.maxRank=o.order().length-1,this.graph=s}renderEdge(t,n){const{enableTooltip:e,tooltipId:r,tooltipBGColor:i,tooltipBorderColor:o,edgeOpacity:u,edgeGradientFill:s,tooltipTemplate:a}=this.options,c=this.graph.edge(t.v,t.w,t.name),h=this.graph.node(t.v),f=this.graph.node(t.w),l=Cl(c),d=this.canvas.gradient("linear",(function(t){var n,e,r;t.stop(0,null==(n=h.data)?void 0:n.color),t.stop(1,s?null==(e=f.data)?void 0:e.color:null==(r=h.data)?void 0:r.color)})),p=function(t,{id:n="",edgeColor:e,opacity:r=1}={}){const i=new wn({d:t});return i.id(n),i.fill(e).opacity(r),i}(l,{id:`${t.v}-${t.w}`,edgeColor:d,opacity:u});if(e&&h.data&&f.data){const t=a?a({source:h.data,target:f.data,value:c.value}):null;p.on("mousemove",(function(n){var e;const u=(s=n.pageX,a=n.pageY,["position: absolute;",`left: ${s+20}px;`,`top: ${a+20}px;`,`border: 1px solid ${o};`,"border-radius: 5px;",`background-color: ${i};`,"padding: 10px"]);var s,a;null==(e=Jn(`[id="${n.target.id}"]`))||e.front().opacity(1),Pl(r,u.join(" "),t)})),p.on("mouseout",(function(t){var n;Pl(r),null==(n=Jn(`[id="${t.target.id}"]`))||n.front().opacity(u)}))}n.add(p)}render({keepOldPosition:t=!1}={}){var n,e;const{nodeWidth:r,nodeBorderWidth:i,nodeBorderColor:o,enableTooltip:u,tooltipId:s,onNodeClick:a,fontColor:c,fontFamily:h,fontSize:f,fontWeight:l}=this.options,d=this.canvas.viewbox();this.clear();const p=((t={})=>{const n=[];for(const e in t){const r=`${Dl(e)}: ${t[e]};`;n.push(r)}return n.join(" ")})({fontSize:f,fontWeight:l,fontFamily:h,color:c}),v=Tl(r/2,0);v.attr("style",p);const g=(null==(n=this.graph)?void 0:n.nodes())||[],y=(null==(e=this.graph)?void 0:e.edges())||[],_=Tl();y.forEach((t=>{this.renderEdge(t,_)})),v.add(_);const m=Tl();if(g.forEach((t=>{const n=Rl(this.graph.node(t),this.maxRank,{nodeWidth:r,nodeBorderWidth:i,nodeBorderColor:o,onNodeClick:a,fontColor:c});m.add(n)})),v.add(m),this.add(v),t&&this.updateViewBox(d.x,d.y,d.width,d.height),u){const t=((t="apexsankey-tooltip-container")=>{const n=document.getElementById(t)||document.createElement("div");return n.id=t,n})(s);(document.body||document.getElementsByTagName("body")[0]).append(t)}}}const Fl={width:800,height:650,canvasStyle:"border: 1px solid #caced0",spacing:20,nodeWidth:20,nodeBorderWidth:1,nodeBorderColor:null,onNodeClick:void 0,edgeOpacity:.4,edgeGradientFill:!0,fontSize:"14px",fontFamily:"",fontWeight:400,fontColor:"#212121",enableTooltip:!0,tooltipId:"sankey-tooltip-container",tooltipBorderColor:"#BCBCBC",tooltipBGColor:"#FFFFFF",tooltipTemplate:({source:t,target:n,value:e})=>`\n
\n
\n
${t.title}
\n
=>
\n
\n
${n.title}
\n
: ${e}
\n
\n `};return class{constructor(t,n){this.element=t,this.options={...Fl,...n};const e=document.createElement("div");e.id="apexSankeyWrapper",e.style.position="relative",this.graph=new Ll(e,this.options),this.element.append(e)}render(t){if(!this.element)throw new Error("Element not found");return this.graph.construct(t),this.graph.render(),this.graph}}}));