@fnndsc/argus 0.16.5 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{Settings-m2_gzqFo.js → Settings-0BtPR8Wf.js} +1 -1
- package/dist/assets/{Texture-CNw8sdIb.js → Texture-B-lj_eg9.js} +1 -1
- package/dist/assets/{addVolumesToViewports-C_AtNstI.js → addVolumesToViewports-CGj99Yo7.js} +1 -1
- package/dist/assets/{cornerstoneEngine-56y7wcWv.js → cornerstoneEngine-BIu8DPDK.js} +2 -2
- package/dist/assets/{index-g0DeZJl2.js → index-BSxa_TT4.js} +1 -1
- package/dist/assets/{index-CEiEnrkY.js → index-BjMVTIAp.js} +1 -1
- package/dist/assets/{index-NtXPCzOK.js → index-BlbwwKJU.js} +1 -1
- package/dist/assets/{index-2cJqPO1p.js → index-CLBcMXje.js} +1 -1
- package/dist/assets/index-D3RLyWos.js +4255 -0
- package/dist/assets/{index-DqRYV6KU.js → index-Dl6u9QLH.js} +1 -1
- package/dist/assets/{index-C3cucXqK.js → index-eDvpvfGy.js} +1 -1
- package/dist/assets/layoutWorker-CfJVM55D.js +1 -0
- package/dist/assets/{niivueEngine-Blo6UL6H.js → niivueEngine-DswitPEw.js} +2 -2
- package/dist/assets/{slabScene-DPvwI_9Z.js → slabScene-CjreQf7z.js} +1 -1
- package/dist/index.html +4 -2
- package/package.json +3 -3
- package/dist/assets/index-bL2L8RXR.js +0 -4237
- package/dist/assets/layoutWorker-D4Dj2D15.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const Ut={charge:!0,link:!0,collide:!0,gravity:!1},X=.55;function et(t,n,e){var i,r=1;t==null&&(t=0),n==null&&(n=0),e==null&&(e=0);function o(){var f,s=i.length,a,h=0,c=0,d=0;for(f=0;f<s;++f)a=i[f],h+=a.x||0,c+=a.y||0,d+=a.z||0;for(h=(h/s-t)*r,c=(c/s-n)*r,d=(d/s-e)*r,f=0;f<s;++f)a=i[f],h&&(a.x-=h),c&&(a.y-=c),d&&(a.z-=d)}return o.initialize=function(f){i=f},o.x=function(f){return arguments.length?(t=+f,o):t},o.y=function(f){return arguments.length?(n=+f,o):n},o.z=function(f){return arguments.length?(e=+f,o):e},o.strength=function(f){return arguments.length?(r=+f,o):r},o}function rn(t){const n=+this._x.call(null,t);return Xt(this.cover(n),n,t)}function Xt(t,n,e){if(isNaN(n))return t;var i,r=t._root,o={data:e},f=t._x0,s=t._x1,a,h,c,d,g;if(!r)return t._root=o,t;for(;r.length;)if((c=n>=(a=(f+s)/2))?f=a:s=a,i=r,!(r=r[d=+c]))return i[d]=o,t;if(h=+t._x.call(null,r.data),n===h)return o.next=r,i?i[d]=o:t._root=o,t;do i=i?i[d]=new Array(2):t._root=new Array(2),(c=n>=(a=(f+s)/2))?f=a:s=a;while((d=+c)==(g=+(h>=a)));return i[g]=r,i[d]=o,t}function on(t){Array.isArray(t)||(t=Array.from(t));const n=t.length,e=new Float64Array(n);let i=1/0,r=-1/0;for(let o=0,f;o<n;++o)isNaN(f=+this._x.call(null,t[o]))||(e[o]=f,f<i&&(i=f),f>r&&(r=f));if(i>r)return this;this.cover(i).cover(r);for(let o=0;o<n;++o)Xt(this,e[o],t[o]);return this}function sn(t){if(isNaN(t=+t))return this;var n=this._x0,e=this._x1;if(isNaN(n))e=(n=Math.floor(t))+1;else{for(var i=e-n||1,r=this._root,o,f;n>t||t>=e;)switch(f=+(t<n),o=new Array(2),o[f]=r,r=o,i*=2,f){case 0:e=n+i;break;case 1:n=e-i;break}this._root&&this._root.length&&(this._root=r)}return this._x0=n,this._x1=e,this}function fn(){var t=[];return this.visit(function(n){if(!n.length)do t.push(n.data);while(n=n.next)}),t}function an(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function tt(t,n,e){this.node=t,this.x0=n,this.x1=e}function un(t,n){var e,i=this._x0,r,o,f=this._x1,s=[],a=this._root,h,c;for(a&&s.push(new tt(a,i,f)),n==null?n=1/0:(i=t-n,f=t+n);h=s.pop();)if(!(!(a=h.node)||(r=h.x0)>f||(o=h.x1)<i))if(a.length){var d=(r+o)/2;s.push(new tt(a[1],d,o),new tt(a[0],r,d)),(c=+(t>=d))&&(h=s[s.length-1],s[s.length-1]=s[s.length-1-c],s[s.length-1-c]=h)}else{var g=Math.abs(t-+this._x.call(null,a.data));g<n&&(n=g,i=t-g,f=t+g,e=a.data)}return e}function cn(t){if(isNaN(a=+this._x.call(null,t)))return this;var n,e=this._root,i,r,o,f=this._x0,s=this._x1,a,h,c,d,g;if(!e)return this;if(e.length)for(;;){if((c=a>=(h=(f+s)/2))?f=h:s=h,n=e,!(e=e[d=+c]))return this;if(!e.length)break;n[d+1&1]&&(i=n,g=d)}for(;e.data!==t;)if(r=e,!(e=e.next))return this;return(o=e.next)&&delete e.next,r?(o?r.next=o:delete r.next,this):n?(o?n[d]=o:delete n[d],(e=n[0]||n[1])&&e===(n[1]||n[0])&&!e.length&&(i?i[g]=e:this._root=e),this):(this._root=o,this)}function hn(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this}function ln(){return this._root}function dn(){var t=0;return this.visit(function(n){if(!n.length)do++t;while(n=n.next)}),t}function gn(t){var n=[],e,i=this._root,r,o,f;for(i&&n.push(new tt(i,this._x0,this._x1));e=n.pop();)if(!t(i=e.node,o=e.x0,f=e.x1)&&i.length){var s=(o+f)/2;(r=i[1])&&n.push(new tt(r,s,f)),(r=i[0])&&n.push(new tt(r,o,s))}return this}function pn(t){var n=[],e=[],i;for(this._root&&n.push(new tt(this._root,this._x0,this._x1));i=n.pop();){var r=i.node;if(r.length){var o,f=i.x0,s=i.x1,a=(f+s)/2;(o=r[0])&&n.push(new tt(o,f,a)),(o=r[1])&&n.push(new tt(o,a,s))}e.push(i)}for(;i=e.pop();)t(i.node,i.x0,i.x1);return this}function _n(t){return t[0]}function xn(t){return arguments.length?(this._x=t,this):this._x}function mt(t,n){var e=new zt(n??_n,NaN,NaN);return t==null?e:e.addAll(t)}function zt(t,n,e){this._x=t,this._x0=n,this._x1=e,this._root=void 0}function Ot(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var H=mt.prototype=zt.prototype;H.copy=function(){var t=new zt(this._x,this._x0,this._x1),n=this._root,e,i;if(!n)return t;if(!n.length)return t._root=Ot(n),t;for(e=[{source:n,target:t._root=new Array(2)}];n=e.pop();)for(var r=0;r<2;++r)(i=n.source[r])&&(i.length?e.push({source:i,target:n.target[r]=new Array(2)}):n.target[r]=Ot(i));return t};H.add=rn;H.addAll=on;H.cover=sn;H.data=fn;H.extent=an;H.find=un;H.remove=cn;H.removeAll=hn;H.root=ln;H.size=dn;H.visit=gn;H.visitAfter=pn;H.x=xn;function yn(t){const n=+this._x.call(null,t),e=+this._y.call(null,t);return Bt(this.cover(n,e),n,e,t)}function Bt(t,n,e,i){if(isNaN(n)||isNaN(e))return t;var r,o=t._root,f={data:i},s=t._x0,a=t._y0,h=t._x1,c=t._y1,d,g,p,u,w,v,l,_;if(!o)return t._root=f,t;for(;o.length;)if((w=n>=(d=(s+h)/2))?s=d:h=d,(v=e>=(g=(a+c)/2))?a=g:c=g,r=o,!(o=o[l=v<<1|w]))return r[l]=f,t;if(p=+t._x.call(null,o.data),u=+t._y.call(null,o.data),n===p&&e===u)return f.next=o,r?r[l]=f:t._root=f,t;do r=r?r[l]=new Array(4):t._root=new Array(4),(w=n>=(d=(s+h)/2))?s=d:h=d,(v=e>=(g=(a+c)/2))?a=g:c=g;while((l=v<<1|w)===(_=(u>=g)<<1|p>=d));return r[_]=o,r[l]=f,t}function vn(t){var n,e,i=t.length,r,o,f=new Array(i),s=new Array(i),a=1/0,h=1/0,c=-1/0,d=-1/0;for(e=0;e<i;++e)isNaN(r=+this._x.call(null,n=t[e]))||isNaN(o=+this._y.call(null,n))||(f[e]=r,s[e]=o,r<a&&(a=r),r>c&&(c=r),o<h&&(h=o),o>d&&(d=o));if(a>c||h>d)return this;for(this.cover(a,h).cover(c,d),e=0;e<i;++e)Bt(this,f[e],s[e],t[e]);return this}function wn(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,i=this._y0,r=this._x1,o=this._y1;if(isNaN(e))r=(e=Math.floor(t))+1,o=(i=Math.floor(n))+1;else{for(var f=r-e||1,s=this._root,a,h;e>t||t>=r||i>n||n>=o;)switch(h=(n<i)<<1|t<e,a=new Array(4),a[h]=s,s=a,f*=2,h){case 0:r=e+f,o=i+f;break;case 1:e=r-f,o=i+f;break;case 2:r=e+f,i=o-f;break;case 3:e=r-f,i=o-f;break}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._y0=i,this._x1=r,this._y1=o,this}function Mn(){var t=[];return this.visit(function(n){if(!n.length)do t.push(n.data);while(n=n.next)}),t}function mn(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function B(t,n,e,i,r){this.node=t,this.x0=n,this.y0=e,this.x1=i,this.y1=r}function zn(t,n,e){var i,r=this._x0,o=this._y0,f,s,a,h,c=this._x1,d=this._y1,g=[],p=this._root,u,w;for(p&&g.push(new B(p,r,o,c,d)),e==null?e=1/0:(r=t-e,o=n-e,c=t+e,d=n+e,e*=e);u=g.pop();)if(!(!(p=u.node)||(f=u.x0)>c||(s=u.y0)>d||(a=u.x1)<r||(h=u.y1)<o))if(p.length){var v=(f+a)/2,l=(s+h)/2;g.push(new B(p[3],v,l,a,h),new B(p[2],f,l,v,h),new B(p[1],v,s,a,l),new B(p[0],f,s,v,l)),(w=(n>=l)<<1|t>=v)&&(u=g[g.length-1],g[g.length-1]=g[g.length-1-w],g[g.length-1-w]=u)}else{var _=t-+this._x.call(null,p.data),x=n-+this._y.call(null,p.data),m=_*_+x*x;if(m<e){var y=Math.sqrt(e=m);r=t-y,o=n-y,c=t+y,d=n+y,i=p.data}}return i}function Nn(t){if(isNaN(c=+this._x.call(null,t))||isNaN(d=+this._y.call(null,t)))return this;var n,e=this._root,i,r,o,f=this._x0,s=this._y0,a=this._x1,h=this._y1,c,d,g,p,u,w,v,l;if(!e)return this;if(e.length)for(;;){if((u=c>=(g=(f+a)/2))?f=g:a=g,(w=d>=(p=(s+h)/2))?s=p:h=p,n=e,!(e=e[v=w<<1|u]))return this;if(!e.length)break;(n[v+1&3]||n[v+2&3]||n[v+3&3])&&(i=n,l=v)}for(;e.data!==t;)if(r=e,!(e=e.next))return this;return(o=e.next)&&delete e.next,r?(o?r.next=o:delete r.next,this):n?(o?n[v]=o:delete n[v],(e=n[0]||n[1]||n[2]||n[3])&&e===(n[3]||n[2]||n[1]||n[0])&&!e.length&&(i?i[l]=e:this._root=e),this):(this._root=o,this)}function An(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this}function In(){return this._root}function kn(){var t=0;return this.visit(function(n){if(!n.length)do++t;while(n=n.next)}),t}function bn(t){var n=[],e,i=this._root,r,o,f,s,a;for(i&&n.push(new B(i,this._x0,this._y0,this._x1,this._y1));e=n.pop();)if(!t(i=e.node,o=e.x0,f=e.y0,s=e.x1,a=e.y1)&&i.length){var h=(o+s)/2,c=(f+a)/2;(r=i[3])&&n.push(new B(r,h,c,s,a)),(r=i[2])&&n.push(new B(r,o,c,h,a)),(r=i[1])&&n.push(new B(r,h,f,s,c)),(r=i[0])&&n.push(new B(r,o,f,h,c))}return this}function $n(t){var n=[],e=[],i;for(this._root&&n.push(new B(this._root,this._x0,this._y0,this._x1,this._y1));i=n.pop();){var r=i.node;if(r.length){var o,f=i.x0,s=i.y0,a=i.x1,h=i.y1,c=(f+a)/2,d=(s+h)/2;(o=r[0])&&n.push(new B(o,f,s,c,d)),(o=r[1])&&n.push(new B(o,c,s,a,d)),(o=r[2])&&n.push(new B(o,f,d,c,h)),(o=r[3])&&n.push(new B(o,c,d,a,h))}e.push(i)}for(;i=e.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function Sn(t){return t[0]}function qn(t){return arguments.length?(this._x=t,this):this._x}function En(t){return t[1]}function On(t){return arguments.length?(this._y=t,this):this._y}function Nt(t,n,e){var i=new At(n??Sn,e??En,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function At(t,n,e,i,r,o){this._x=t,this._y=n,this._x0=e,this._y0=i,this._x1=r,this._y1=o,this._root=void 0}function Tt(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var K=Nt.prototype=At.prototype;K.copy=function(){var t=new At(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root,e,i;if(!n)return t;if(!n.length)return t._root=Tt(n),t;for(e=[{source:n,target:t._root=new Array(4)}];n=e.pop();)for(var r=0;r<4;++r)(i=n.source[r])&&(i.length?e.push({source:i,target:n.target[r]=new Array(4)}):n.target[r]=Tt(i));return t};K.add=yn;K.addAll=vn;K.cover=wn;K.data=Mn;K.extent=mn;K.find=zn;K.remove=Nn;K.removeAll=An;K.root=In;K.size=kn;K.visit=bn;K.visitAfter=$n;K.x=qn;K.y=On;function Tn(t){const n=+this._x.call(null,t),e=+this._y.call(null,t),i=+this._z.call(null,t);return Kt(this.cover(n,e,i),n,e,i,t)}function Kt(t,n,e,i,r){if(isNaN(n)||isNaN(e)||isNaN(i))return t;var o,f=t._root,s={data:r},a=t._x0,h=t._y0,c=t._z0,d=t._x1,g=t._y1,p=t._z1,u,w,v,l,_,x,m,y,A,b,S;if(!f)return t._root=s,t;for(;f.length;)if((m=n>=(u=(a+d)/2))?a=u:d=u,(y=e>=(w=(h+g)/2))?h=w:g=w,(A=i>=(v=(c+p)/2))?c=v:p=v,o=f,!(f=f[b=A<<2|y<<1|m]))return o[b]=s,t;if(l=+t._x.call(null,f.data),_=+t._y.call(null,f.data),x=+t._z.call(null,f.data),n===l&&e===_&&i===x)return s.next=f,o?o[b]=s:t._root=s,t;do o=o?o[b]=new Array(8):t._root=new Array(8),(m=n>=(u=(a+d)/2))?a=u:d=u,(y=e>=(w=(h+g)/2))?h=w:g=w,(A=i>=(v=(c+p)/2))?c=v:p=v;while((b=A<<2|y<<1|m)===(S=(x>=v)<<2|(_>=w)<<1|l>=u));return o[S]=f,o[b]=s,t}function Fn(t){Array.isArray(t)||(t=Array.from(t));const n=t.length,e=new Float64Array(n),i=new Float64Array(n),r=new Float64Array(n);let o=1/0,f=1/0,s=1/0,a=-1/0,h=-1/0,c=-1/0;for(let d=0,g,p,u,w;d<n;++d)isNaN(p=+this._x.call(null,g=t[d]))||isNaN(u=+this._y.call(null,g))||isNaN(w=+this._z.call(null,g))||(e[d]=p,i[d]=u,r[d]=w,p<o&&(o=p),p>a&&(a=p),u<f&&(f=u),u>h&&(h=u),w<s&&(s=w),w>c&&(c=w));if(o>a||f>h||s>c)return this;this.cover(o,f,s).cover(a,h,c);for(let d=0;d<n;++d)Kt(this,e[d],i[d],r[d],t[d]);return this}function Dn(t,n,e){if(isNaN(t=+t)||isNaN(n=+n)||isNaN(e=+e))return this;var i=this._x0,r=this._y0,o=this._z0,f=this._x1,s=this._y1,a=this._z1;if(isNaN(i))f=(i=Math.floor(t))+1,s=(r=Math.floor(n))+1,a=(o=Math.floor(e))+1;else{for(var h=f-i||1,c=this._root,d,g;i>t||t>=f||r>n||n>=s||o>e||e>=a;)switch(g=(e<o)<<2|(n<r)<<1|t<i,d=new Array(8),d[g]=c,c=d,h*=2,g){case 0:f=i+h,s=r+h,a=o+h;break;case 1:i=f-h,s=r+h,a=o+h;break;case 2:f=i+h,r=s-h,a=o+h;break;case 3:i=f-h,r=s-h,a=o+h;break;case 4:f=i+h,s=r+h,o=a-h;break;case 5:i=f-h,s=r+h,o=a-h;break;case 6:f=i+h,r=s-h,o=a-h;break;case 7:i=f-h,r=s-h,o=a-h;break}this._root&&this._root.length&&(this._root=c)}return this._x0=i,this._y0=r,this._z0=o,this._x1=f,this._y1=s,this._z1=a,this}function Cn(){var t=[];return this.visit(function(n){if(!n.length)do t.push(n.data);while(n=n.next)}),t}function Pn(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function F(t,n,e,i,r,o,f){this.node=t,this.x0=n,this.y0=e,this.z0=i,this.x1=r,this.y1=o,this.z1=f}function jn(t,n,e,i){var r,o=this._x0,f=this._y0,s=this._z0,a,h,c,d,g,p,u=this._x1,w=this._y1,v=this._z1,l=[],_=this._root,x,m;for(_&&l.push(new F(_,o,f,s,u,w,v)),i==null?i=1/0:(o=t-i,f=n-i,s=e-i,u=t+i,w=n+i,v=e+i,i*=i);x=l.pop();)if(!(!(_=x.node)||(a=x.x0)>u||(h=x.y0)>w||(c=x.z0)>v||(d=x.x1)<o||(g=x.y1)<f||(p=x.z1)<s))if(_.length){var y=(a+d)/2,A=(h+g)/2,b=(c+p)/2;l.push(new F(_[7],y,A,b,d,g,p),new F(_[6],a,A,b,y,g,p),new F(_[5],y,h,b,d,A,p),new F(_[4],a,h,b,y,A,p),new F(_[3],y,A,c,d,g,b),new F(_[2],a,A,c,y,g,b),new F(_[1],y,h,c,d,A,b),new F(_[0],a,h,c,y,A,b)),(m=(e>=b)<<2|(n>=A)<<1|t>=y)&&(x=l[l.length-1],l[l.length-1]=l[l.length-1-m],l[l.length-1-m]=x)}else{var S=t-+this._x.call(null,_.data),W=n-+this._y.call(null,_.data),U=e-+this._z.call(null,_.data),j=S*S+W*W+U*U;if(j<i){var E=Math.sqrt(i=j);o=t-E,f=n-E,s=e-E,u=t+E,w=n+E,v=e+E,r=_.data}}return r}const Gn=(t,n,e,i,r,o)=>Math.sqrt((t-i)**2+(n-r)**2+(e-o)**2);function Ln(t,n,e,i){const r=[],o=t-i,f=n-i,s=e-i,a=t+i,h=n+i,c=e+i;return this.visit((d,g,p,u,w,v,l)=>{if(!d.length)do{const _=d.data;Gn(t,n,e,this._x(_),this._y(_),this._z(_))<=i&&r.push(_)}while(d=d.next);return g>a||p>h||u>c||w<o||v<f||l<s}),r}function Rn(t){if(isNaN(g=+this._x.call(null,t))||isNaN(p=+this._y.call(null,t))||isNaN(u=+this._z.call(null,t)))return this;var n,e=this._root,i,r,o,f=this._x0,s=this._y0,a=this._z0,h=this._x1,c=this._y1,d=this._z1,g,p,u,w,v,l,_,x,m,y,A;if(!e)return this;if(e.length)for(;;){if((_=g>=(w=(f+h)/2))?f=w:h=w,(x=p>=(v=(s+c)/2))?s=v:c=v,(m=u>=(l=(a+d)/2))?a=l:d=l,n=e,!(e=e[y=m<<2|x<<1|_]))return this;if(!e.length)break;(n[y+1&7]||n[y+2&7]||n[y+3&7]||n[y+4&7]||n[y+5&7]||n[y+6&7]||n[y+7&7])&&(i=n,A=y)}for(;e.data!==t;)if(r=e,!(e=e.next))return this;return(o=e.next)&&delete e.next,r?(o?r.next=o:delete r.next,this):n?(o?n[y]=o:delete n[y],(e=n[0]||n[1]||n[2]||n[3]||n[4]||n[5]||n[6]||n[7])&&e===(n[7]||n[6]||n[5]||n[4]||n[3]||n[2]||n[1]||n[0])&&!e.length&&(i?i[A]=e:this._root=e),this):(this._root=o,this)}function Wn(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this}function Yn(){return this._root}function Un(){var t=0;return this.visit(function(n){if(!n.length)do++t;while(n=n.next)}),t}function Xn(t){var n=[],e,i=this._root,r,o,f,s,a,h,c;for(i&&n.push(new F(i,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=n.pop();)if(!t(i=e.node,o=e.x0,f=e.y0,s=e.z0,a=e.x1,h=e.y1,c=e.z1)&&i.length){var d=(o+a)/2,g=(f+h)/2,p=(s+c)/2;(r=i[7])&&n.push(new F(r,d,g,p,a,h,c)),(r=i[6])&&n.push(new F(r,o,g,p,d,h,c)),(r=i[5])&&n.push(new F(r,d,f,p,a,g,c)),(r=i[4])&&n.push(new F(r,o,f,p,d,g,c)),(r=i[3])&&n.push(new F(r,d,g,s,a,h,p)),(r=i[2])&&n.push(new F(r,o,g,s,d,h,p)),(r=i[1])&&n.push(new F(r,d,f,s,a,g,p)),(r=i[0])&&n.push(new F(r,o,f,s,d,g,p))}return this}function Bn(t){var n=[],e=[],i;for(this._root&&n.push(new F(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));i=n.pop();){var r=i.node;if(r.length){var o,f=i.x0,s=i.y0,a=i.z0,h=i.x1,c=i.y1,d=i.z1,g=(f+h)/2,p=(s+c)/2,u=(a+d)/2;(o=r[0])&&n.push(new F(o,f,s,a,g,p,u)),(o=r[1])&&n.push(new F(o,g,s,a,h,p,u)),(o=r[2])&&n.push(new F(o,f,p,a,g,c,u)),(o=r[3])&&n.push(new F(o,g,p,a,h,c,u)),(o=r[4])&&n.push(new F(o,f,s,u,g,p,d)),(o=r[5])&&n.push(new F(o,g,s,u,h,p,d)),(o=r[6])&&n.push(new F(o,f,p,u,g,c,d)),(o=r[7])&&n.push(new F(o,g,p,u,h,c,d))}e.push(i)}for(;i=e.pop();)t(i.node,i.x0,i.y0,i.z0,i.x1,i.y1,i.z1);return this}function Kn(t){return t[0]}function Hn(t){return arguments.length?(this._x=t,this):this._x}function Qn(t){return t[1]}function Vn(t){return arguments.length?(this._y=t,this):this._y}function Zn(t){return t[2]}function Jn(t){return arguments.length?(this._z=t,this):this._z}function It(t,n,e,i){var r=new kt(n??Kn,e??Qn,i??Zn,NaN,NaN,NaN,NaN,NaN,NaN);return t==null?r:r.addAll(t)}function kt(t,n,e,i,r,o,f,s,a){this._x=t,this._y=n,this._z=e,this._x0=i,this._y0=r,this._z0=o,this._x1=f,this._y1=s,this._z1=a,this._root=void 0}function Ft(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var Y=It.prototype=kt.prototype;Y.copy=function(){var t=new kt(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root,e,i;if(!n)return t;if(!n.length)return t._root=Ft(n),t;for(e=[{source:n,target:t._root=new Array(8)}];n=e.pop();)for(var r=0;r<8;++r)(i=n.source[r])&&(i.length?e.push({source:i,target:n.target[r]=new Array(8)}):n.target[r]=Ft(i));return t};Y.add=Tn;Y.addAll=Fn;Y.cover=Dn;Y.data=Cn;Y.extent=Pn;Y.find=jn;Y.findAllWithinRadius=Ln;Y.remove=Rn;Y.removeAll=Wn;Y.root=Yn;Y.size=Un;Y.visit=Xn;Y.visitAfter=Bn;Y.x=Hn;Y.y=Vn;Y.z=Jn;function R(t){return function(){return t}}function V(t){return(t()-.5)*1e-6}function _t(t){return t.x+t.vx}function Dt(t){return t.y+t.vy}function te(t){return t.z+t.vz}function ft(t){var n,e,i,r,o=1,f=1;typeof t!="function"&&(t=R(t==null?1:+t));function s(){for(var c,d=n.length,g,p,u,w,v,l,_,x=0;x<f;++x)for(g=(e===1?mt(n,_t):e===2?Nt(n,_t,Dt):e===3?It(n,_t,Dt,te):null).visitAfter(a),c=0;c<d;++c)p=n[c],l=i[p.index],_=l*l,u=p.x+p.vx,e>1&&(w=p.y+p.vy),e>2&&(v=p.z+p.vz),g.visit(m);function m(y,A,b,S,W,U,j){var E=[A,b,S,W,U,j],M=E[0],I=E[1],N=E[2],z=E[e],$=E[e+1],O=E[e+2],T=y.data,P=y.r,k=l+P;if(T){if(T.index>p.index){var D=u-T.x-T.vx,L=e>1?w-T.y-T.vy:0,C=e>2?v-T.z-T.vz:0,G=D*D+L*L+C*C;G<k*k&&(D===0&&(D=V(r),G+=D*D),e>1&&L===0&&(L=V(r),G+=L*L),e>2&&C===0&&(C=V(r),G+=C*C),G=(k-(G=Math.sqrt(G)))/G*o,p.vx+=(D*=G)*(k=(P*=P)/(_+P)),e>1&&(p.vy+=(L*=G)*k),e>2&&(p.vz+=(C*=G)*k),T.vx-=D*(k=1-k),e>1&&(T.vy-=L*k),e>2&&(T.vz-=C*k))}return}return M>u+k||z<u-k||e>1&&(I>w+k||$<w-k)||e>2&&(N>v+k||O<v-k)}}function a(c){if(c.data)return c.r=i[c.data.index];for(var d=c.r=0;d<Math.pow(2,e);++d)c[d]&&c[d].r>c.r&&(c.r=c[d].r)}function h(){if(n){var c,d=n.length,g;for(i=new Array(d),c=0;c<d;++c)g=n[c],i[g.index]=+t(g,c,n)}}return s.initialize=function(c,...d){n=c,r=d.find(g=>typeof g=="function")||Math.random,e=d.find(g=>[1,2,3].includes(g))||2,h()},s.iterations=function(c){return arguments.length?(f=+c,s):f},s.strength=function(c){return arguments.length?(o=+c,s):o},s.radius=function(c){return arguments.length?(t=typeof c=="function"?c:R(+c),h(),s):t},s}function ne(t){return t.index}function Ct(t,n){var e=t.get(n);if(!e)throw new Error("node not found: "+n);return e}function lt(t){var n=ne,e=g,i,r=R(30),o,f,s,a,h,c,d=1;t==null&&(t=[]);function g(l){return 1/Math.min(a[l.source.index],a[l.target.index])}function p(l){for(var _=0,x=t.length;_<d;++_)for(var m=0,y,A,b,S=0,W=0,U=0,j,E;m<x;++m)y=t[m],A=y.source,b=y.target,S=b.x+b.vx-A.x-A.vx||V(c),s>1&&(W=b.y+b.vy-A.y-A.vy||V(c)),s>2&&(U=b.z+b.vz-A.z-A.vz||V(c)),j=Math.sqrt(S*S+W*W+U*U),j=(j-o[m])/j*l*i[m],S*=j,W*=j,U*=j,b.vx-=S*(E=h[m]),s>1&&(b.vy-=W*E),s>2&&(b.vz-=U*E),A.vx+=S*(E=1-E),s>1&&(A.vy+=W*E),s>2&&(A.vz+=U*E)}function u(){if(f){var l,_=f.length,x=t.length,m=new Map(f.map((A,b)=>[n(A,b,f),A])),y;for(l=0,a=new Array(_);l<x;++l)y=t[l],y.index=l,typeof y.source!="object"&&(y.source=Ct(m,y.source)),typeof y.target!="object"&&(y.target=Ct(m,y.target)),a[y.source.index]=(a[y.source.index]||0)+1,a[y.target.index]=(a[y.target.index]||0)+1;for(l=0,h=new Array(x);l<x;++l)y=t[l],h[l]=a[y.source.index]/(a[y.source.index]+a[y.target.index]);i=new Array(x),w(),o=new Array(x),v()}}function w(){if(f)for(var l=0,_=t.length;l<_;++l)i[l]=+e(t[l],l,t)}function v(){if(f)for(var l=0,_=t.length;l<_;++l)o[l]=+r(t[l],l,t)}return p.initialize=function(l,..._){f=l,c=_.find(x=>typeof x=="function")||Math.random,s=_.find(x=>[1,2,3].includes(x))||2,u()},p.links=function(l){return arguments.length?(t=l,u(),p):t},p.id=function(l){return arguments.length?(n=l,p):n},p.iterations=function(l){return arguments.length?(d=+l,p):d},p.strength=function(l){return arguments.length?(e=typeof l=="function"?l:R(+l),w(),p):e},p.distance=function(l){return arguments.length?(r=typeof l=="function"?l:R(+l),v(),p):r},p}var ee={value:()=>{}};function Ht(){for(var t=0,n=arguments.length,e={},i;t<n;++t){if(!(i=arguments[t]+"")||i in e||/[\s.]/.test(i))throw new Error("illegal type: "+i);e[i]=[]}return new ht(e)}function ht(t){this._=t}function ie(t,n){return t.trim().split(/^|\s+/).map(function(e){var i="",r=e.indexOf(".");if(r>=0&&(i=e.slice(r+1),e=e.slice(0,r)),e&&!n.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:i}})}ht.prototype=Ht.prototype={constructor:ht,on:function(t,n){var e=this._,i=ie(t+"",e),r,o=-1,f=i.length;if(arguments.length<2){for(;++o<f;)if((r=(t=i[o]).type)&&(r=re(e[r],t.name)))return r;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++o<f;)if(r=(t=i[o]).type)e[r]=Pt(e[r],t.name,n);else if(n==null)for(r in e)e[r]=Pt(e[r],t.name,null);return this},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new ht(t)},call:function(t,n){if((r=arguments.length-2)>0)for(var e=new Array(r),i=0,r,o;i<r;++i)e[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],i=0,r=o.length;i<r;++i)o[i].value.apply(n,e)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,o=i.length;r<o;++r)i[r].value.apply(n,e)}};function re(t,n){for(var e=0,i=t.length,r;e<i;++e)if((r=t[e]).name===n)return r.value}function Pt(t,n,e){for(var i=0,r=t.length;i<r;++i)if(t[i].name===n){t[i]=ee,t=t.slice(0,i).concat(t.slice(i+1));break}return e!=null&&t.push({name:n,value:e}),t}var it=0,ot=0,rt=0,Qt=1e3,dt,st,gt=0,nt=0,pt=0,ct=typeof performance=="object"&&performance.now?performance:Date,Vt=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Zt(){return nt||(Vt(oe),nt=ct.now()+pt)}function oe(){nt=0}function wt(){this._call=this._time=this._next=null}wt.prototype=Jt.prototype={constructor:wt,restart:function(t,n,e){if(typeof t!="function")throw new TypeError("callback is not a function");e=(e==null?Zt():+e)+(n==null?0:+n),!this._next&&st!==this&&(st?st._next=this:dt=this,st=this),this._call=t,this._time=e,Mt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Mt())}};function Jt(t,n,e){var i=new wt;return i.restart(t,n,e),i}function se(){Zt(),++it;for(var t=dt,n;t;)(n=nt-t._time)>=0&&t._call.call(void 0,n),t=t._next;--it}function jt(){nt=(gt=ct.now())+pt,it=ot=0;try{se()}finally{it=0,ae(),nt=0}}function fe(){var t=ct.now(),n=t-gt;n>Qt&&(pt-=n,gt=t)}function ae(){for(var t,n=dt,e,i=1/0;n;)n._call?(i>n._time&&(i=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:dt=e);st=t,Mt(i)}function Mt(t){if(!it){ot&&(ot=clearTimeout(ot));var n=t-nt;n>24?(t<1/0&&(ot=setTimeout(jt,t-ct.now()-pt)),rt&&(rt=clearInterval(rt))):(rt||(gt=ct.now(),rt=setInterval(fe,Qt)),it=1,Vt(jt))}}const ue=1664525,ce=1013904223,Gt=4294967296;function he(){let t=1;return()=>(t=(ue*t+ce)%Gt)/Gt}var Lt=3;function xt(t){return t.x}function Rt(t){return t.y}function le(t){return t.z}var de=10,ge=Math.PI*(3-Math.sqrt(5)),pe=Math.PI*20/(9+Math.sqrt(221));function at(t,n){n=n||2;var e=Math.min(Lt,Math.max(1,Math.round(n))),i,r=1,o=.001,f=1-Math.pow(o,1/300),s=0,a=.6,h=new Map,c=Jt(p),d=Ht("tick","end"),g=he();t==null&&(t=[]);function p(){u(),d.call("tick",i),r<o&&(c.stop(),d.call("end",i))}function u(l){var _,x=t.length,m;l===void 0&&(l=1);for(var y=0;y<l;++y)for(r+=(s-r)*f,h.forEach(function(A){A(r)}),_=0;_<x;++_)m=t[_],m.fx==null?m.x+=m.vx*=a:(m.x=m.fx,m.vx=0),e>1&&(m.fy==null?m.y+=m.vy*=a:(m.y=m.fy,m.vy=0)),e>2&&(m.fz==null?m.z+=m.vz*=a:(m.z=m.fz,m.vz=0));return i}function w(){for(var l=0,_=t.length,x;l<_;++l){if(x=t[l],x.index=l,x.fx!=null&&(x.x=x.fx),x.fy!=null&&(x.y=x.fy),x.fz!=null&&(x.z=x.fz),isNaN(x.x)||e>1&&isNaN(x.y)||e>2&&isNaN(x.z)){var m=de*(e>2?Math.cbrt(.5+l):e>1?Math.sqrt(.5+l):l),y=l*ge,A=l*pe;e===1?x.x=m:e===2?(x.x=m*Math.cos(y),x.y=m*Math.sin(y)):(x.x=m*Math.sin(y)*Math.cos(A),x.y=m*Math.cos(y),x.z=m*Math.sin(y)*Math.sin(A))}(isNaN(x.vx)||e>1&&isNaN(x.vy)||e>2&&isNaN(x.vz))&&(x.vx=0,e>1&&(x.vy=0),e>2&&(x.vz=0))}}function v(l){return l.initialize&&l.initialize(t,g,e),l}return w(),i={tick:u,restart:function(){return c.restart(p),i},stop:function(){return c.stop(),i},numDimensions:function(l){return arguments.length?(e=Math.min(Lt,Math.max(1,Math.round(l))),h.forEach(v),i):e},nodes:function(l){return arguments.length?(t=l,w(),h.forEach(v),i):t},alpha:function(l){return arguments.length?(r=+l,i):r},alphaMin:function(l){return arguments.length?(o=+l,i):o},alphaDecay:function(l){return arguments.length?(f=+l,i):+f},alphaTarget:function(l){return arguments.length?(s=+l,i):s},velocityDecay:function(l){return arguments.length?(a=1-l,i):1-a},randomSource:function(l){return arguments.length?(g=l,h.forEach(v),i):g},force:function(l,_){return arguments.length>1?(_==null?h.delete(l):h.set(l,v(_)),i):h.get(l)},find:function(){var l=Array.prototype.slice.call(arguments),_=l.shift()||0,x=(e>1?l.shift():null)||0,m=(e>2?l.shift():null)||0,y=l.shift()||1/0,A=0,b=t.length,S,W,U,j,E,M;for(y*=y,A=0;A<b;++A)E=t[A],S=_-E.x,W=x-(E.y||0),U=m-(E.z||0),j=S*S+W*W+U*U,j<y&&(M=E,y=j);return M},on:function(l,_){return arguments.length>1?(d.on(l,_),i):d.on(l)}}}function ut(){var t,n,e,i,r,o=R(-30),f,s=1,a=1/0,h=.81;function c(u){var w,v=t.length,l=(n===1?mt(t,xt):n===2?Nt(t,xt,Rt):n===3?It(t,xt,Rt,le):null).visitAfter(g);for(r=u,w=0;w<v;++w)e=t[w],l.visit(p)}function d(){if(t){var u,w=t.length,v;for(f=new Array(w),u=0;u<w;++u)v=t[u],f[v.index]=+o(v,u,t)}}function g(u){var w=0,v,l,_=0,x,m,y,A,b=u.length;if(b){for(x=m=y=A=0;A<b;++A)(v=u[A])&&(l=Math.abs(v.value))&&(w+=v.value,_+=l,x+=l*(v.x||0),m+=l*(v.y||0),y+=l*(v.z||0));w*=Math.sqrt(4/b),u.x=x/_,n>1&&(u.y=m/_),n>2&&(u.z=y/_)}else{v=u,v.x=v.data.x,n>1&&(v.y=v.data.y),n>2&&(v.z=v.data.z);do w+=f[v.data.index];while(v=v.next)}u.value=w}function p(u,w,v,l,_){if(!u.value)return!0;var x=[v,l,_][n-1],m=u.x-e.x,y=n>1?u.y-e.y:0,A=n>2?u.z-e.z:0,b=x-w,S=m*m+y*y+A*A;if(b*b/h<S)return S<a&&(m===0&&(m=V(i),S+=m*m),n>1&&y===0&&(y=V(i),S+=y*y),n>2&&A===0&&(A=V(i),S+=A*A),S<s&&(S=Math.sqrt(s*S)),e.vx+=m*u.value*r/S,n>1&&(e.vy+=y*u.value*r/S),n>2&&(e.vz+=A*u.value*r/S)),!0;if(u.length||S>=a)return;(u.data!==e||u.next)&&(m===0&&(m=V(i),S+=m*m),n>1&&y===0&&(y=V(i),S+=y*y),n>2&&A===0&&(A=V(i),S+=A*A),S<s&&(S=Math.sqrt(s*S)));do u.data!==e&&(b=f[u.data.index]*r/S,e.vx+=m*b,n>1&&(e.vy+=y*b),n>2&&(e.vz+=A*b));while(u=u.next)}return c.initialize=function(u,...w){t=u,i=w.find(v=>typeof v=="function")||Math.random,n=w.find(v=>[1,2,3].includes(v))||2,d()},c.strength=function(u){return arguments.length?(o=typeof u=="function"?u:R(+u),d(),c):o},c.distanceMin=function(u){return arguments.length?(s=u*u,c):Math.sqrt(s)},c.distanceMax=function(u){return arguments.length?(a=u*u,c):Math.sqrt(a)},c.theta=function(u){return arguments.length?(h=u*u,c):Math.sqrt(h)},c}function bt(t){var n=R(.1),e,i,r;typeof t!="function"&&(t=R(t==null?0:+t));function o(s){for(var a=0,h=e.length,c;a<h;++a)c=e[a],c.vx+=(r[a]-c.x)*i[a]*s}function f(){if(e){var s,a=e.length;for(i=new Array(a),r=new Array(a),s=0;s<a;++s)i[s]=isNaN(r[s]=+t(e[s],s,e))?0:+n(e[s],s,e)}}return o.initialize=function(s){e=s,f()},o.strength=function(s){return arguments.length?(n=typeof s=="function"?s:R(+s),f(),o):n},o.x=function(s){return arguments.length?(t=typeof s=="function"?s:R(+s),f(),o):t},o}function $t(t){var n=R(.1),e,i,r;typeof t!="function"&&(t=R(t==null?0:+t));function o(s){for(var a=0,h=e.length,c;a<h;++a)c=e[a],c.vy+=(r[a]-c.y)*i[a]*s}function f(){if(e){var s,a=e.length;for(i=new Array(a),r=new Array(a),s=0;s<a;++s)i[s]=isNaN(r[s]=+t(e[s],s,e))?0:+n(e[s],s,e)}}return o.initialize=function(s){e=s,f()},o.strength=function(s){return arguments.length?(n=typeof s=="function"?s:R(+s),f(),o):n},o.y=function(s){return arguments.length?(t=typeof s=="function"?s:R(+s),f(),o):t},o}function St(t){var n=R(.1),e,i,r;typeof t!="function"&&(t=R(t==null?0:+t));function o(s){for(var a=0,h=e.length,c;a<h;++a)c=e[a],c.vz+=(r[a]-c.z)*i[a]*s}function f(){if(e){var s,a=e.length;for(i=new Array(a),r=new Array(a),s=0;s<a;++s)i[s]=isNaN(r[s]=+t(e[s],s,e))?0:+n(e[s],s,e)}}return o.initialize=function(s){e=s,f()},o.strength=function(s){return arguments.length?(n=typeof s=="function"?s:R(+s),f(),o):n},o.z=function(s){return arguments.length?(t=typeof s=="function"?s:R(+s),f(),o):t},o}function _e(t){let n=2166136261;for(let e=0;e<t.length;e++)n^=t.charCodeAt(e),n=Math.imul(n,16777619);return n>>>0}function xe(t){let n=t>>>0;return()=>(n=Math.imul(n,1664525)+1013904223>>>0,n/4294967296)}function tn(t){return xe(_e(t))}const Z=.55,ye=12,ve=60,yt=60;function we(t){const n=new Map(t.map((e,i)=>[e.id,i]));return t.map(e=>`${e.parents.map(r=>n.get(r)??-1).join(".")}:${e.radius.toFixed(2)}`).join("|")}function Me(t,n,e){const[i,r,o]=t,f=i*Math.cos(n)+o*Math.sin(n),s=-i*Math.sin(n)+o*Math.cos(n),a=r*Math.cos(e)-s*Math.sin(e),h=r*Math.sin(e)+s*Math.cos(e);return[f,a,h]}function me(t,n,e){const i=u=>Math.hypot(u[0],u[1],u[2]),r=i(n),o=i(e);if(r<1e-9||o<1e-9)return t;const f=[n[0]/r,n[1]/r,n[2]/r],s=[e[0]/o,e[1]/o,e[2]/o],a=[f[1]*s[2]-f[2]*s[1],f[2]*s[0]-f[0]*s[2],f[0]*s[1]-f[1]*s[0]],h=i(a),c=f[0]*s[0]+f[1]*s[1]+f[2]*s[2];if(h<1e-9)return c>0?t:[-t[0],-t[1],-t[2]];const d=[a[0]/h,a[1]/h,a[2]/h],g=d[0]*t[0]+d[1]*t[1]+d[2]*t[2],p=[d[1]*t[2]-d[2]*t[1],d[2]*t[0]-d[0]*t[2],d[0]*t[1]-d[1]*t[0]];return[t[0]*c+p[0]*h+d[0]*g*(1-c),t[1]*c+p[1]*h+d[1]*g*(1-c),t[2]*c+p[2]*h+d[2]*g*(1-c)]}function Wt(t,n,e){if(n.length===0)return t;let i=0;for(const r of n)i+=e.get(r.id.slice(6))??Z;return i/=n.length,Math.max(t+2,Math.sqrt(n.length)*i*1.6)}function vt(t,n,e){const i=n<=1?0:1-2*(t+.5)/n,r=Math.sqrt(Math.max(0,1-i*i)),o=t*Math.PI*(3-Math.sqrt(5));return[Math.cos(o)*r*e,i*e,Math.sin(o)*r*e]}function qt(t,n,e=()=>{},i="clumps",r=tn){const o=new Map(t.map(M=>[M.id,M])),f=new Map,s=[];for(const M of t)M.group===null?s.push(M):f.set(M.group,[...f.get(M.group)??[],M]);const a=new Map,h=new Map,c=new Map,d=new Set;let g=0;const p=Math.max(1,f.size),u=new Map;for(const[M,I]of f){const N=I.filter(k=>k.seed!==void 0),z=[0,0,0];for(const k of N)z[0]+=k.seed[0],z[1]+=k.seed[1],z[2]+=k.seed[2];N.length>0&&(z[0]/=N.length,z[1]/=N.length,z[2]/=N.length,c.set(M,z)),I.every(k=>k.frozen===!0&&k.seed!==void 0)&&d.add(M);const $=new Map,O=N.length===0?we(I):null,T=O===null?void 0:u.get(O);if(N.length===I.length)for(const k of I)$.set(k.id,[k.seed[0]-z[0],k.seed[1]-z[1],k.seed[2]-z[2]]);else if(T!==void 0){const k=r(M),D=k()*Math.PI*2,L=(k()-.5)*Math.PI;I.forEach((C,G)=>{$.set(C.id,Me(T[G]??[0,0,0],D,L))})}else{const k=I.map(q=>{const Q={id:q.id,r:q.radius};return q.seed!==void 0&&(Q.x=q.seed[0]-z[0],Q.y=q.seed[1]-z[1],Q.z=q.seed[2]-z[2],q.frozen===!0&&(Q.fx=Q.x,Q.fy=Q.y,Q.fz=Q.z)),Q}),D=new Set(I.map(q=>q.id)),L=[];for(const q of I)for(const Q of q.parents)D.has(Q)&&L.push({source:Q,target:q.id});const C=new Map(I.map(q=>[q.id,q.radius])),G=at(k,3).force("link",lt(L).id(q=>q.id).distance(n.link?q=>(C.get(q.source.id)??Z)+(C.get(q.target.id)??Z)+1.4:2.2)).force("charge",ut().strength(q=>n.charge?-6*(q.r/Z)**2:-6).distanceMax(ye)).force("center",et(0,0,0)).stop();n.collide&&G.force("collide",ft().radius(q=>q.r*1.2));for(let q=0;q<ve;q++)G.tick();const J=[0,0,0];for(const q of k)J[0]+=q.x??0,J[1]+=q.y??0,J[2]+=q.z??0;J[0]/=k.length,J[1]/=k.length,J[2]/=k.length;for(const q of k)$.set(q.id,[(q.x??0)-J[0],(q.y??0)-J[1],(q.z??0)-J[2]]);O!==null&&u.set(O,I.map(q=>$.get(q.id)??[0,0,0]))}let P=Z;for(const k of I){const D=$.get(k.id)??[0,0,0];a.set(k.id,D),P=Math.max(P,Math.hypot(D[0],D[1],D[2])+k.radius)}h.set(M,P),g+=1,g%50===0&&e(.3*(g/p))}e(.3);const w=M=>{const I=o.get(M);return I!==void 0&&I.group!==null?`group:${I.group}`:M},v=[],l=new Map;let _=!1;for(const[M]of f){const I=`group:${M}`,N=h.get(M)??Z,z={id:I,r:N},$=c.get(M);$!==void 0&&(z.x=$[0],z.y=$[1],z.z=$[2],d.has(M)&&(z.fx=$[0],z.fy=$[1],z.fz=$[2],_=!0)),l.set(I,N),v.push(z)}for(const M of s){const I={id:M.id,r:M.radius};M.seed!==void 0&&(I.x=M.seed[0],I.y=M.seed[1],I.z=M.seed[2],M.frozen===!0&&(I.fx=M.seed[0],I.fy=M.seed[1],I.fz=M.seed[2],_=!0)),l.set(M.id,M.radius),v.push(I)}const x=new Set,m=[];for(const M of t)for(const I of M.parents){if(!o.has(I))continue;const N=w(I),z=w(M.id);if(N===z)continue;const $=`${N}\0${z}`;x.has($)||(x.add($),m.push({source:N,target:z}))}const y=new Map;for(const M of m)if(M.source.startsWith("group:")!==M.target.startsWith("group:")){const I=M.source.startsWith("group:")?M.source:M.target,N=M.source.startsWith("group:")?M.target:M.source;y.has(I)||y.set(I,N)}const A=new Map;for(const M of v){const I=y.get(M.id);I!==void 0&&A.set(I,[...A.get(I)??[],M])}const b=v.reduce((M,I)=>M+I.r*I.r,0),S=v.filter(M=>!M.id.startsWith("group:"));S.forEach((M,I)=>{if(M.x!==void 0)return;const[N,z,$]=vt(I,S.length,Math.sqrt(b)*1.2+10);M.x=N,M.y=z,M.z=$});for(const[M,I]of A){const N=v.find($=>$.id===M),z=Math.sqrt(I.reduce(($,O)=>$+O.r*O.r,0))*1.4+2;I.forEach(($,O)=>{if($.x!==void 0)return;const[T,P,k]=vt(O,I.length,z);$.x=(N?.x??0)+T,$.y=(N?.y??0)+P,$.z=(N?.z??0)+k})}const W=new Set;if(i==="spokes"){const M=N=>{const z=f.get(N)??[],$=new Set(z.map(T=>T.id)),O=z.find(T=>T.parents.some(P=>!$.has(P)))??z[0];return O===void 0?[0,0,0]:a.get(O.id)??[0,0,0]},I=[];for(const N of v){if(N.id.startsWith("group:")&&y.has(N.id)){W.add(N.id);continue}if(N.id.startsWith("group:"))I.push(N);else{const z=A.get(N.id)??[];let $=N.r;const O=Wt(N.r,z,h);for(const T of z){const P=T.id.slice(6),k=M(P);$=Math.max($,O+Math.hypot(k[0],k[1],k[2])+2*(h.get(P)??Z))}I.push({id:N.id,r:$,x:N.x,y:N.y,z:N.z,...N.fx!==void 0?{fx:N.fx,fy:N.fy,fz:N.fz}:{}})}}if(!I.every(N=>N.fx!==void 0)){const N=at(I,3).force("charge",ut().strength(z=>-1.5*z.r)).force("collide",ft().radius(z=>z.r*.9)).stop();_||N.force("center",et(0,0,0));for(let z=0;z<yt;z++)N.tick(),z%5===0&&e(.3+.7*(z/yt))}for(const N of I){const z=v.find($=>$.id===N.id);z!==void 0&&z!==N&&(z.x=N.x,z.y=N.y,z.z=N.z)}for(const N of v){if(N.id.startsWith("group:")||!A.has(N.id))continue;const z=A.get(N.id)??[],$=Wt(N.r,z,h);z.forEach((O,T)=>{if(O.fx!==void 0||c.has(O.id.slice(6)))return;const P=M(O.id.slice(6)),k=vt(T,z.length,1),D=.35+.65*(T*.6180339887%1),L=N.r+1.4+$*D+Math.hypot(P[0],P[1],P[2]);O.x=(N.x??0)+k[0]*L,O.y=(N.y??0)+k[1]*L,O.z=(N.z??0)+k[2]*L})}}if(!v.every(M=>M.fx!==void 0)&&i!=="spokes"){const M=at(v,3).force("link",lt(m).id(z=>z.id).distance(n.link?z=>(l.get(z.source.id)??Z)+(l.get(z.target.id)??Z)+1.4:2.2)).stop(),I=ut().strength(z=>n.charge?-6*(z.r/Z)**2:-6);if(n.reach!==void 0&&I.distanceMax(n.reach),M.force("charge",I),_||M.force("center",et(0,0,0)),n.collide&&M.force("collide",ft().radius(z=>z.r*1.05)),n.gravity){const z=$=>Math.min(1,($.r/Z)**2*.08);M.force("gx",bt(0).strength(z)).force("gy",$t(0).strength(z)).force("gz",St(0).strength(z))}const N=yt;for(let z=0;z<N;z++)M.tick(),z%5===0&&e(.3+.7*(z/N))}const j=new Map(v.map(M=>[M.id,M]));if(i==="spokes")for(const[M,I]of f){if(I.some(C=>C.seed!==void 0))continue;const N=`group:${M}`,z=j.get(N),$=y.get(N),O=$===void 0?void 0:j.get($);if(z===void 0||O===void 0)continue;const T=[(z.x??0)-(O.x??0),(z.y??0)-(O.y??0),(z.z??0)-(O.z??0)],P=new Set(I.map(C=>C.id)),k=I.find(C=>C.parents.some(G=>!P.has(G)))??I[0],D=a.get(k.id)??[0,0,0],L=[-D[0],-D[1],-D[2]];for(const C of I){const G=a.get(C.id)??[0,0,0];a.set(C.id,me(G,L,T))}}const E={};for(const M of t){const I=j.get(w(M.id)),N=[I?.x??0,I?.y??0,I?.z??0],z=M.group===null?[0,0,0]:a.get(M.id)??[0,0,0];E[M.id]=[N[0]+z[0],N[1]+z[1],N[2]+z[2]]}return e(1),E}const Yt=80;function ze(t,n,e=()=>{},i=tn){const r=t.some(g=>g.seed===void 0),o=r?qt(t,n,g=>e(.05*g),"spokes",i):{};e(.05);const f=t.map(g=>{const p=g.seed??o[g.id],u={id:g.id,r:g.radius};return p!==void 0&&(u.x=p[0],u.y=p[1],u.z=p[2],g.frozen===!0&&g.seed!==void 0&&(u.fx=p[0],u.fy=p[1],u.fz=p[2])),u}),s=new Set(t.map(g=>g.id)),a=[];for(const g of t)for(const p of g.parents)s.has(p)&&a.push({source:p,target:g.id});const h=new Map(t.map(g=>[g.id,g.radius])),c=f.some(g=>g.fx!==void 0);if(!f.every(g=>g.fx!==void 0)){const g=at(f,3).force("link",lt(a).id(u=>u.id).distance(n.link?u=>(h.get(u.source.id)??X)+(h.get(u.target.id)??X)+1.4:2.2)).stop(),p=ut().strength(u=>n.charge?-6*(u.r/X)**2:-6);if(n.reach!==void 0&&p.distanceMax(n.reach),g.force("charge",p),c||g.force("center",et(0,0,0)),n.collide&&g.force("collide",ft().radius(u=>u.r*1.2)),n.gravity){const u=w=>(w.r/X)**2*.08;g.force("gx",bt(0).strength(u)).force("gy",$t(0).strength(u)).force("gz",St(0).strength(u))}r&&g.alpha(.6);for(let u=0;u<Yt;u++)g.tick(),u%2===0&&e(.05+.95*(u/Yt))}const d={};for(const g of f)d[g.id]=[g.x??0,g.y??0,g.z??0];return e(1),d}function Ne(t){const n=new Map;for(const e of t)for(const i of e.parents)n.set(i,(n.get(i)??0)+1),n.set(e.id,(n.get(e.id)??0)+1);return t.map(e=>e.metric??n.get(e.id)??1)}function Ae(t,n=3,e=new Map,i=Ut,r=new Set){const o=[];for(const _ of t)for(const x of _.parents)o.push({source:x,target:_.id});const f=Ne(t),s=Math.max(...f,1),a=f.map(_=>X*(.5+_/s*1.2)),h=new Map(t.map((_,x)=>[_.id,a[x]??X])),c=t.map(_=>{const x=e.get(_.id);return x===void 0?{id:_.id}:r.has(_.id)?{id:_.id,x:x[0],y:x[1],z:x[2],fx:x[0],fy:x[1],fz:x[2]}:{id:_.id,x:x[0],y:x[1],z:x[2]}}),d=_=>r.has(_.id)&&_.fx!==void 0;let g=c,p=o;if(r.size>0){const _=new Set(c.filter(y=>!d(y)).map(y=>y.id));p=o.filter(y=>_.has(y.source)||_.has(y.target));const x=new Set(_);for(const y of p)x.add(y.source),x.add(y.target);g=c.filter(y=>x.has(y.id));const m=new Set(g.map(y=>y.id));p=p.filter(y=>m.has(y.source)&&m.has(y.target))}const u=ut().strength(i.charge?_=>r.has(_.id)?0:-6*((h.get(_.id)??X)/X)**2:_=>r.has(_.id)?0:-6);i.reach!==void 0&&u.distanceMax(i.reach);const w=at(g,n).force("link",lt(p).id(_=>_.id).distance(i.link?_=>(h.get(_.source.id)??X)+(h.get(_.target.id)??X)+1.4:2.2)).force("charge",u).stop();if(r.size===0&&w.force("center",n===2?et(0,0):et(0,0,0)),i.collide&&w.force("collide",ft().radius(_=>(h.get(_.id)??X)*1.2)),i.gravity){const _=x=>((h.get(x.id)??X)/X)**2*.08;w.force("gx",bt(0).strength(_)).force("gy",$t(0).strength(_)),n===3&&w.force("gz",St(0).strength(_))}const v=g.length===0?0:e.size>0?90:150;let l=0;return{total:v,moving:g.length,step:_=>{for(let x=0;x<_&&l<v;x++,l++)w.tick()},place:()=>t.map((_,x)=>{const m=c[x];return{id:_.id,position:[m?.x??0,m?.y??0,m?.z??0],radius:a[x]??X}})}}function Ie(t,n=3,e=new Map,i=Ut,r=new Set){const o=Ae(t,n,e,i,r);return o.step(o.total),o.place()}function ke(t){const n=new Map(t.map(u=>[u.id,u])),e=new Map,i=(u,w)=>{const v=e.get(u.id);if(v!==void 0)return v;if(w.has(u.id)||u.parentIds.length===0)return e.set(u.id,0),0;w.add(u.id);let l=0;for(const _ of u.parentIds){const x=n.get(_);x&&(l=Math.max(l,i(x,w)+1))}return e.set(u.id,l),l};for(const u of t)i(u,new Set);const r=new Map,o=[],f=(u,w)=>u.id.localeCompare(w.id,void 0,{numeric:!0});for(const u of t){const w=u.parentIds.find(l=>n.has(l));if(w===void 0){o.push(u);continue}const v=r.get(w)??[];v.push(u),r.set(w,v)}o.sort(f);for(const u of r.values())u.sort(f);const s=new Map;let a=0;const h=new Set,c=u=>{h.add(u.id);const w=(r.get(u.id)??[]).filter(x=>!h.has(x.id));if(w.length===0){const x=a++;return s.set(u.id,x),[x,x]}let v=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(const x of w){const[m,y]=c(x);v=Math.min(v,m),l=Math.max(l,y)}const _=(v+l)/2;return s.set(u.id,_),[v,l]};for(const u of o)c(u);for(const u of t)s.has(u.id)||c(u);const d=Math.max(...Array.from(e.values()),0)+1,g=Math.max(a-1,0);return{placements:t.map(u=>({id:u.id,x:s.get(u.id)??0,tier:e.get(u.id)??0})),width:g,tierCount:d}}const be=2.6,$e=2;function Se(t){const n=t.map(o=>o.metric??0),e=Math.max(...n,0),i=ke(t),r=new Map(i.placements.map(o=>[o.id,o]));return t.map(o=>{const f=r.get(o.id),s=((f?.x??0)-i.width/2)*$e,a=((i.tierCount-1)/2-(f?.tier??0))*be,h=o.metric??0,c=e>0?.55+h/e*1:1,d=[s,a,0];return{id:o.id,position:d,radius:X*c}})}function Et(t){const n={id:t.id,parents:t.parents,radius:t.radius,group:t.group};return t.seed!==void 0&&(n.seed=t.seed),t.frozen!==void 0&&(n.frozen=t.frozen),n}function nn(t){const n=t.attrs?.metric;return typeof n=="number"?n:void 0}function en(t){const n={};for(const e of t)n[e.id]=e.position;return n}const qe={id:"galaxy",label:"GALAXY",needs:[],run:(t,n)=>({positions:ze(t.nodes.map(Et),t.physics,n)})},Ee={id:"spokes",label:"SPOKES",needs:[],run:(t,n)=>({positions:qt(t.nodes.map(Et),t.physics,n,"spokes")})},Oe={id:"clumps",label:"CLUMPS",needs:[],run:(t,n)=>({positions:qt(t.nodes.map(Et),t.physics,n,"clumps")})},Te={id:"ranked",label:"RANKED",needs:[],run:(t,n)=>{const e=t.nodes.map(r=>{const o={id:r.id,parentIds:r.parents},f=nn(r);return f!==void 0&&(o.metric=f),o}),i=en(Se(e));return n(1),{positions:i}}},Fe={id:"molecule",label:"MOLECULE",needs:[],run:(t,n)=>{const e=t.nodes.map(f=>{const s={id:f.id,parents:f.parents},a=nn(f);return a!==void 0&&(s.metric=a),s}),i=new Map,r=new Set;for(const f of t.nodes)f.seed!==void 0&&i.set(f.id,f.seed),f.frozen===!0&&r.add(f.id);const o=en(Ie(e,3,i,t.physics,r));return n(1),{positions:o}}},De=[qe,Ee,Oe,Te,Fe];function Ce(t){return De.find(n=>n.id===t)}self.onmessage=t=>{const{generation:n,nodes:e,physics:i,arrangement:r}=t.data;let o=-1;const f=h=>{const c=Math.floor(h*100);c!==o&&(o=c,self.postMessage({generation:n,type:"progress",fraction:h}))},s=Ce(r);if(s===void 0){self.postMessage({generation:n,type:"failed",reason:`no layout engine named ${r}`});return}const{positions:a}=s.run({nodes:e,physics:i},f);self.postMessage({generation:n,type:"done",positions:a})};
|