function dn(n,e){return n.parent===e.parent?1:2}function pn(n){return n.reduce(gn,0)/n.length}function gn(n,e){return n+e.x}function yn(n){return 1+n.reduce(xn,0)}function xn(n,e){return Math.max(n,e.y)}function mn(n){for(var e;e=n.children;)n=e[0];return n}function vn(n){for(var e;e=n.children;)n=e[e.length-1];return n}function wn(){var n=dn,e=1,t=1,r=!1;function i(u){var l,s=0;u.eachAfter(function(a){var d=a.children;d?(a.x=pn(d),a.y=yn(d)):(a.x=l?s+=n(a,l):0,a.y=0,l=a)});var c=mn(u),f=vn(u),h=c.x-n(c,f)/2,o=f.x+n(f,c)/2;return u.eachAfter(r?function(a){a.x=(a.x-u.x)*e,a.y=(u.y-a.y)*t}:function(a){a.x=(a.x-h)/(o-h)*e,a.y=(1-(u.y?a.y/u.y:1))*t})}return i.separation=function(u){return arguments.length?(n=u,i):n},i.size=function(u){return arguments.length?(r=!1,e=+u[0],t=+u[1],i):r?null:[e,t]},i.nodeSize=function(u){return arguments.length?(r=!0,e=+u[0],t=+u[1],i):r?[e,t]:null},i}function _n(n){var e=0,t=n.children,r=t&&t.length;if(!r)e=1;else for(;--r>=0;)e+=t[r].value;n.value=e}function zn(){return this.eachAfter(_n)}function An(n,e){let t=-1;for(const r of this)n.call(e,r,++t,this);return this}function Mn(n,e){for(var t=this,r=[t],i,u,l=-1;t=r.pop();)if(n.call(e,t,++l,this),i=t.children)for(u=i.length-1;u>=0;--u)r.push(i[u]);return this}function kn(n,e){for(var t=this,r=[t],i=[],u,l,s,c=-1;t=r.pop();)if(i.push(t),u=t.children)for(l=0,s=u.length;l=0;)t+=r[i].value;e.value=t})}function qn(n){return this.eachBefore(function(e){e.children&&e.children.sort(n)})}function In(n){for(var e=this,t=Nn(e,n),r=[e];e!==t;)e=e.parent,r.push(e);for(var i=r.length;n!==t;)r.splice(i,0,n),n=n.parent;return r}function Nn(n,e){if(n===e)return n;var t=n.ancestors(),r=e.ancestors(),i=null;for(n=t.pop(),e=r.pop();n===e;)i=n,n=t.pop(),e=r.pop();return i}function En(){for(var n=this,e=[n];n=n.parent;)e.push(n);return e}function Bn(){return Array.from(this)}function Ln(){var n=[];return this.eachBefore(function(e){e.children||n.push(e)}),n}function bn(){var n=this,e=[];return n.each(function(t){t!==n&&e.push({source:t.parent,target:t})}),e}function*Cn(){var n=this,e,t=[n],r,i,u;do for(e=t.reverse(),t=[];n=e.pop();)if(yield n,r=n.children)for(i=0,u=r.length;i=0;--s)i.push(u=l[s]=new S(l[s])),u.parent=r,u.depth=r.depth+1;return t.eachBefore(Z)}function Tn(){return O(this).eachBefore(On)}function $n(n){return n.children}function Dn(n){return Array.isArray(n)?n[1]:null}function On(n){n.data.value!==void 0&&(n.value=n.data.value),n.data=n.data.data}function Z(n){var e=0;do n.height=e;while((n=n.parent)&&n.height<++e)}function S(n){this.data=n,this.depth=this.height=0,this.parent=null}S.prototype=O.prototype={constructor:S,count:zn,each:An,eachAfter:kn,eachBefore:Mn,find:Rn,sum:Sn,sort:qn,path:In,ancestors:En,descendants:Bn,leaves:Ln,links:bn,copy:Tn,[Symbol.iterator]:Cn};function L(n){return n==null?null:F(n)}function F(n){if(typeof n!="function")throw new Error;return n}function q(){return 0}function N(n){return function(){return n}}const Vn=1664525,Wn=1013904223,G=4294967296;function V(){let n=1;return()=>(n=(Vn*n+Wn)%G)/G}function Pn(n){return typeof n=="object"&&"length"in n?n:Array.from(n)}function jn(n,e){let t=n.length,r,i;for(;t;)i=e()*t--|0,r=n[t],n[t]=n[i],n[i]=r;return n}function Kn(n){return J(n,V())}function J(n,e){for(var t=0,r=(n=jn(Array.from(n),e)).length,i=[],u,l;t0&&t*t>r*r+i*i}function W(n,e){for(var t=0;t1e-6?(R+Math.sqrt(R*R-4*I*H))/(2*I):H/R);return{x:r+z+k*D,y:i+A+M*D,r:D}}function nn(n,e,t){var r=n.x-e.x,i,u,l=n.y-e.y,s,c,f=r*r+l*l;f?(u=e.r+t.r,u*=u,c=n.r+t.r,c*=c,u>c?(i=(f+c-u)/(2*f),s=Math.sqrt(Math.max(0,c/f-i*i)),t.x=n.x-i*r-s*l,t.y=n.y-i*l+s*r):(i=(f+u-c)/(2*f),s=Math.sqrt(Math.max(0,u/f-i*i)),t.x=e.x+i*r-s*l,t.y=e.y+i*l+s*r)):(t.x=e.x+t.r,t.y=e.y)}function en(n,e){var t=n.r+e.r-1e-6,r=e.x-n.x,i=e.y-n.y;return t>0&&t*t>r*r+i*i}function tn(n){var e=n._,t=n.next._,r=e.r+t.r,i=(e.x*t.r+t.x*e.r)/r,u=(e.y*t.r+t.y*e.r)/r;return i*i+u*u}function C(n){this._=n,this.next=null,this.previous=null}function rn(n,e){if(!(u=(n=Pn(n)).length))return 0;var t,r,i,u,l,s,c,f,h,o,a;if(t=n[0],t.x=0,t.y=0,!(u>1))return t.r;if(r=n[1],t.x=-r.r,r.x=t.r,r.y=0,!(u>2))return t.r+r.r;nn(r,t,i=n[2]),t=new C(t),r=new C(r),i=new C(i),t.next=i.previous=r,r.next=t.previous=i,i.next=r.previous=t;n:for(c=3;cte(t(w,v,i))),m=x.map(cn),_=new Set(x).add("");for(const w of m)_.has(w)||(_.add(w),x.push(w),m.push(cn(w)),u.push(j));l=(w,v)=>x[v],s=(w,v)=>m[v]}for(h=0,c=u.length;h=0&&!(d=u[x],d.data!==j);--x)d.data=null}if(o.parent=Qn,o.eachBefore(function(x){x.depth=x.parent.depth+1,--c}).eachBefore(Z),o.parent=null,c>0)throw new Error("cycle");return o}return r.id=function(i){return arguments.length?(n=L(i),r):n},r.parentId=function(i){return arguments.length?(e=L(i),r):e},r.path=function(i){return arguments.length?(t=L(i),r):t},r}function te(n){n=`${n}`;let e=n.length;return K(n,e-1)&&!K(n,e-2)&&(n=n.slice(0,-1)),n[0]==="/"?n:`/${n}`}function cn(n){let e=n.length;if(e<2)return"";for(;--e>1&&!K(n,e););return n.slice(0,e)}function K(n,e){if(n[e]==="/"){let t=0;for(;e>0&&n[--e]==="\\";)++t;if((t&1)===0)return!0}return!1}function re(n,e){return n.parent===e.parent?1:2}function X(n){var e=n.children;return e?e[0]:n.t}function Y(n){var e=n.children;return e?e[e.length-1]:n.t}function ie(n,e,t){var r=t/(e.i-n.i);e.c-=r,e.s+=t,n.c+=r,e.z+=t,e.m+=t}function ue(n){for(var e=0,t=0,r=n.children,i=r.length,u;--i>=0;)u=r[i],u.z+=e,u.m+=e,e+=u.s+(t+=u.c)}function ae(n,e,t){return n.a.parent===e.parent?n.a:t}function T(n,e){this._=n,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}T.prototype=Object.create(S.prototype);function fe(n){for(var e=new T(n,0),t,r=[e],i,u,l,s;t=r.pop();)if(u=t._.children)for(t.children=new Array(s=u.length),l=s-1;l>=0;--l)r.push(i=t.children[l]=new T(u[l],l)),i.parent=t;return(e.parent=new T(null,0)).children=[e],e}function le(){var n=re,e=1,t=1,r=null;function i(f){var h=fe(f);if(h.eachAfter(u),h.parent.m=-h.z,h.eachBefore(l),r)f.eachBefore(c);else{var o=f,a=f,d=f;f.eachBefore(function(m){m.xa.x&&(a=m),m.depth>d.depth&&(d=m)});var p=o===a?1:n(o,a)/2,g=p-o.x,y=e/(a.x+p+g),x=t/(d.depth||1);f.eachBefore(function(m){m.x=(m.x+g)*y,m.y=m.depth*x})}return f}function u(f){var h=f.children,o=f.parent.children,a=f.i?o[f.i-1]:null;if(h){ue(f);var d=(h[0].z+h[h.length-1].z)/2;a?(f.z=a.z+n(f._,a._),f.m=f.z-d):f.z=d}else a&&(f.z=a.z+n(f._,a._));f.parent.A=s(f,a,f.parent.A||o[0])}function l(f){f._.x=f.z+f.parent.m,f.m+=f.parent.m}function s(f,h,o){if(h){for(var a=f,d=f,p=h,g=a.parent.children[0],y=a.m,x=d.m,m=p.m,_=g.m,w;p=Y(p),a=X(a),p&&a;)g=X(g),d=Y(d),d.a=f,w=p.z+m-a.z-y+n(p._,a._),w>0&&(ie(ae(p,f,o),f,w),y+=w,x+=w),m+=p.m,y+=a.m,_+=g.m,x+=d.m;p&&!Y(d)&&(d.t=p,d.m+=m-x),a&&!X(g)&&(g.t=a,g.m+=y-_,o=f)}return o}function c(f){f.x*=e,f.y=f.depth*t}return i.separation=function(f){return arguments.length?(n=f,i):n},i.size=function(f){return arguments.length?(r=!1,e=+f[0],t=+f[1],i):r?null:[e,t]},i.nodeSize=function(f){return arguments.length?(r=!0,e=+f[0],t=+f[1],i):r?[e,t]:null},i}function $(n,e,t,r,i){for(var u=n.children,l,s=-1,c=u.length,f=n.value&&(i-t)/n.value;++sm&&(m=f),z=y*y*v,_=Math.max(m/z,z/x),_>w){y-=f;break}w=_}l.push(c={value:y,dice:d1?r:1)},t}(hn);function ce(){var n=on,e=!1,t=1,r=1,i=[0],u=q,l=q,s=q,c=q,f=q;function h(a){return a.x0=a.y0=0,a.x1=t,a.y1=r,a.eachBefore(o),i=[0],e&&a.eachBefore(fn),a}function o(a){var d=i[a.depth],p=a.x0+d,g=a.y0+d,y=a.x1-d,x=a.y1-d;y=a-1){var m=u[o];m.x0=p,m.y0=g,m.x1=y,m.y1=x;return}for(var _=f[o],w=d/2+_,v=o+1,z=a-1;v>>1;f[k]x-g){var I=d?(p*M+y*A)/d:y;h(o,v,A,p,g,I,x),h(v,a,M,I,g,y,x)}else{var R=d?(g*M+x*A)/d:x;h(o,v,A,p,g,y,R),h(v,a,M,p,R,y,x)}}}function se(n,e,t,r,i){(n.depth&1?$:B)(n,e,t,r,i)}var oe=function n(e){function t(r,i,u,l,s){if((c=r._squarify)&&c.ratio===e)for(var c,f,h,o,a=-1,d,p=c.length,g=r.value;++a1?r:1)},t}(hn);export{S as Node,wn as cluster,O as hierarchy,Gn as pack,Kn as packEnclose,Zn as packSiblings,Jn as partition,ee as stratify,le as tree,ce as treemap,he as treemapBinary,B as treemapDice,oe as treemapResquarify,$ as treemapSlice,se as treemapSliceDice,on as treemapSquarify};export default null;