@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.
@@ -0,0 +1 @@
1
+ const rn={charge:!0,link:!0,collide:!0,gravity:!1},U=.55;function nt(t,n,e){var i,r=1;t==null&&(t=0),n==null&&(n=0),e==null&&(e=0);function s(){var o,a=i.length,u,h=0,c=0,d=0;for(o=0;o<a;++o)u=i[o],h+=u.x||0,c+=u.y||0,d+=u.z||0;for(h=(h/a-t)*r,c=(c/a-n)*r,d=(d/a-e)*r,o=0;o<a;++o)u=i[o],h&&(u.x-=h),c&&(u.y-=c),d&&(u.z-=d)}return s.initialize=function(o){i=o},s.x=function(o){return arguments.length?(t=+o,s):t},s.y=function(o){return arguments.length?(n=+o,s):n},s.z=function(o){return arguments.length?(e=+o,s):e},s.strength=function(o){return arguments.length?(r=+o,s):r},s}function wn(t){const n=+this._x.call(null,t);return sn(this.cover(n),n,t)}function sn(t,n,e){if(isNaN(n))return t;var i,r=t._root,s={data:e},o=t._x0,a=t._x1,u,h,c,d,g;if(!r)return t._root=s,t;for(;r.length;)if((c=n>=(u=(o+a)/2))?o=u:a=u,i=r,!(r=r[d=+c]))return i[d]=s,t;if(h=+t._x.call(null,r.data),n===h)return s.next=r,i?i[d]=s:t._root=s,t;do i=i?i[d]=new Array(2):t._root=new Array(2),(c=n>=(u=(o+a)/2))?o=u:a=u;while((d=+c)==(g=+(h>=u)));return i[g]=r,i[d]=s,t}function vn(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 s=0,o;s<n;++s)isNaN(o=+this._x.call(null,t[s]))||(e[s]=o,o<i&&(i=o),o>r&&(r=o));if(i>r)return this;this.cover(i).cover(r);for(let s=0;s<n;++s)sn(this,e[s],t[s]);return this}function Mn(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,s,o;n>t||t>=e;)switch(o=+(t<n),s=new Array(2),s[o]=r,r=s,i*=2,o){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 mn(){var t=[];return this.visit(function(n){if(!n.length)do t.push(n.data);while(n=n.next)}),t}function zn(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 Nn(t,n){var e,i=this._x0,r,s,o=this._x1,a=[],u=this._root,h,c;for(u&&a.push(new tt(u,i,o)),n==null?n=1/0:(i=t-n,o=t+n);h=a.pop();)if(!(!(u=h.node)||(r=h.x0)>o||(s=h.x1)<i))if(u.length){var d=(r+s)/2;a.push(new tt(u[1],d,s),new tt(u[0],r,d)),(c=+(t>=d))&&(h=a[a.length-1],a[a.length-1]=a[a.length-1-c],a[a.length-1-c]=h)}else{var g=Math.abs(t-+this._x.call(null,u.data));g<n&&(n=g,i=t-g,o=t+g,e=u.data)}return e}function An(t){if(isNaN(u=+this._x.call(null,t)))return this;var n,e=this._root,i,r,s,o=this._x0,a=this._x1,u,h,c,d,g;if(!e)return this;if(e.length)for(;;){if((c=u>=(h=(o+a)/2))?o=h:a=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(s=e.next)&&delete e.next,r?(s?r.next=s:delete r.next,this):n?(s?n[d]=s: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=s,this)}function In(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this}function kn(){return this._root}function Sn(){var t=0;return this.visit(function(n){if(!n.length)do++t;while(n=n.next)}),t}function $n(t){var n=[],e,i=this._root,r,s,o;for(i&&n.push(new tt(i,this._x0,this._x1));e=n.pop();)if(!t(i=e.node,s=e.x0,o=e.x1)&&i.length){var a=(s+o)/2;(r=i[1])&&n.push(new tt(r,a,o)),(r=i[0])&&n.push(new tt(r,s,a))}return this}function bn(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 s,o=i.x0,a=i.x1,u=(o+a)/2;(s=r[0])&&n.push(new tt(s,o,u)),(s=r[1])&&n.push(new tt(s,u,a))}e.push(i)}for(;i=e.pop();)t(i.node,i.x0,i.x1);return this}function En(t){return t[0]}function qn(t){return arguments.length?(this._x=t,this):this._x}function kt(t,n){var e=new St(n??En,NaN,NaN);return t==null?e:e.addAll(t)}function St(t,n,e){this._x=t,this._x0=n,this._x1=e,this._root=void 0}function Lt(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var X=kt.prototype=St.prototype;X.copy=function(){var t=new St(this._x,this._x0,this._x1),n=this._root,e,i;if(!n)return t;if(!n.length)return t._root=Lt(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]=Lt(i));return t};X.add=wn;X.addAll=vn;X.cover=Mn;X.data=mn;X.extent=zn;X.find=Nn;X.remove=An;X.removeAll=In;X.root=kn;X.size=Sn;X.visit=$n;X.visitAfter=bn;X.x=qn;function Tn(t){const n=+this._x.call(null,t),e=+this._y.call(null,t);return on(this.cover(n,e),n,e,t)}function on(t,n,e,i){if(isNaN(n)||isNaN(e))return t;var r,s=t._root,o={data:i},a=t._x0,u=t._y0,h=t._x1,c=t._y1,d,g,_,f,M,y,l,x;if(!s)return t._root=o,t;for(;s.length;)if((M=n>=(d=(a+h)/2))?a=d:h=d,(y=e>=(g=(u+c)/2))?u=g:c=g,r=s,!(s=s[l=y<<1|M]))return r[l]=o,t;if(_=+t._x.call(null,s.data),f=+t._y.call(null,s.data),n===_&&e===f)return o.next=s,r?r[l]=o:t._root=o,t;do r=r?r[l]=new Array(4):t._root=new Array(4),(M=n>=(d=(a+h)/2))?a=d:h=d,(y=e>=(g=(u+c)/2))?u=g:c=g;while((l=y<<1|M)===(x=(f>=g)<<1|_>=d));return r[x]=s,r[l]=o,t}function On(t){var n,e,i=t.length,r,s,o=new Array(i),a=new Array(i),u=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(s=+this._y.call(null,n))||(o[e]=r,a[e]=s,r<u&&(u=r),r>c&&(c=r),s<h&&(h=s),s>d&&(d=s));if(u>c||h>d)return this;for(this.cover(u,h).cover(c,d),e=0;e<i;++e)on(this,o[e],a[e],t[e]);return this}function Cn(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,i=this._y0,r=this._x1,s=this._y1;if(isNaN(e))r=(e=Math.floor(t))+1,s=(i=Math.floor(n))+1;else{for(var o=r-e||1,a=this._root,u,h;e>t||t>=r||i>n||n>=s;)switch(h=(n<i)<<1|t<e,u=new Array(4),u[h]=a,a=u,o*=2,h){case 0:r=e+o,s=i+o;break;case 1:e=r-o,s=i+o;break;case 2:r=e+o,i=s-o;break;case 3:e=r-o,i=s-o;break}this._root&&this._root.length&&(this._root=a)}return this._x0=e,this._y0=i,this._x1=r,this._y1=s,this}function Fn(){var t=[];return this.visit(function(n){if(!n.length)do t.push(n.data);while(n=n.next)}),t}function Ln(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 Dn(t,n,e){var i,r=this._x0,s=this._y0,o,a,u,h,c=this._x1,d=this._y1,g=[],_=this._root,f,M;for(_&&g.push(new B(_,r,s,c,d)),e==null?e=1/0:(r=t-e,s=n-e,c=t+e,d=n+e,e*=e);f=g.pop();)if(!(!(_=f.node)||(o=f.x0)>c||(a=f.y0)>d||(u=f.x1)<r||(h=f.y1)<s))if(_.length){var y=(o+u)/2,l=(a+h)/2;g.push(new B(_[3],y,l,u,h),new B(_[2],o,l,y,h),new B(_[1],y,a,u,l),new B(_[0],o,a,y,l)),(M=(n>=l)<<1|t>=y)&&(f=g[g.length-1],g[g.length-1]=g[g.length-1-M],g[g.length-1-M]=f)}else{var x=t-+this._x.call(null,_.data),v=n-+this._y.call(null,_.data),m=x*x+v*v;if(m<e){var w=Math.sqrt(e=m);r=t-w,s=n-w,c=t+w,d=n+w,i=_.data}}return i}function Rn(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,s,o=this._x0,a=this._y0,u=this._x1,h=this._y1,c,d,g,_,f,M,y,l;if(!e)return this;if(e.length)for(;;){if((f=c>=(g=(o+u)/2))?o=g:u=g,(M=d>=(_=(a+h)/2))?a=_:h=_,n=e,!(e=e[y=M<<1|f]))return this;if(!e.length)break;(n[y+1&3]||n[y+2&3]||n[y+3&3])&&(i=n,l=y)}for(;e.data!==t;)if(r=e,!(e=e.next))return this;return(s=e.next)&&delete e.next,r?(s?r.next=s:delete r.next,this):n?(s?n[y]=s:delete n[y],(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=s,this)}function Gn(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this}function Pn(){return this._root}function jn(){var t=0;return this.visit(function(n){if(!n.length)do++t;while(n=n.next)}),t}function Un(t){var n=[],e,i=this._root,r,s,o,a,u;for(i&&n.push(new B(i,this._x0,this._y0,this._x1,this._y1));e=n.pop();)if(!t(i=e.node,s=e.x0,o=e.y0,a=e.x1,u=e.y1)&&i.length){var h=(s+a)/2,c=(o+u)/2;(r=i[3])&&n.push(new B(r,h,c,a,u)),(r=i[2])&&n.push(new B(r,s,c,h,u)),(r=i[1])&&n.push(new B(r,h,o,a,c)),(r=i[0])&&n.push(new B(r,s,o,h,c))}return this}function Wn(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 s,o=i.x0,a=i.y0,u=i.x1,h=i.y1,c=(o+u)/2,d=(a+h)/2;(s=r[0])&&n.push(new B(s,o,a,c,d)),(s=r[1])&&n.push(new B(s,c,a,u,d)),(s=r[2])&&n.push(new B(s,o,d,c,h)),(s=r[3])&&n.push(new B(s,c,d,u,h))}e.push(i)}for(;i=e.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function Yn(t){return t[0]}function Kn(t){return arguments.length?(this._x=t,this):this._x}function Bn(t){return t[1]}function Hn(t){return arguments.length?(this._y=t,this):this._y}function $t(t,n,e){var i=new bt(n??Yn,e??Bn,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function bt(t,n,e,i,r,s){this._x=t,this._y=n,this._x0=e,this._y0=i,this._x1=r,this._y1=s,this._root=void 0}function Dt(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var H=$t.prototype=bt.prototype;H.copy=function(){var t=new bt(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=Dt(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]=Dt(i));return t};H.add=Tn;H.addAll=On;H.cover=Cn;H.data=Fn;H.extent=Ln;H.find=Dn;H.remove=Rn;H.removeAll=Gn;H.root=Pn;H.size=jn;H.visit=Un;H.visitAfter=Wn;H.x=Kn;H.y=Hn;function Xn(t){const n=+this._x.call(null,t),e=+this._y.call(null,t),i=+this._z.call(null,t);return an(this.cover(n,e,i),n,e,i,t)}function an(t,n,e,i,r){if(isNaN(n)||isNaN(e)||isNaN(i))return t;var s,o=t._root,a={data:r},u=t._x0,h=t._y0,c=t._z0,d=t._x1,g=t._y1,_=t._z1,f,M,y,l,x,v,m,w,A,$,p;if(!o)return t._root=a,t;for(;o.length;)if((m=n>=(f=(u+d)/2))?u=f:d=f,(w=e>=(M=(h+g)/2))?h=M:g=M,(A=i>=(y=(c+_)/2))?c=y:_=y,s=o,!(o=o[$=A<<2|w<<1|m]))return s[$]=a,t;if(l=+t._x.call(null,o.data),x=+t._y.call(null,o.data),v=+t._z.call(null,o.data),n===l&&e===x&&i===v)return a.next=o,s?s[$]=a:t._root=a,t;do s=s?s[$]=new Array(8):t._root=new Array(8),(m=n>=(f=(u+d)/2))?u=f:d=f,(w=e>=(M=(h+g)/2))?h=M:g=M,(A=i>=(y=(c+_)/2))?c=y:_=y;while(($=A<<2|w<<1|m)===(p=(v>=y)<<2|(x>=M)<<1|l>=f));return s[p]=o,s[$]=a,t}function Vn(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 s=1/0,o=1/0,a=1/0,u=-1/0,h=-1/0,c=-1/0;for(let d=0,g,_,f,M;d<n;++d)isNaN(_=+this._x.call(null,g=t[d]))||isNaN(f=+this._y.call(null,g))||isNaN(M=+this._z.call(null,g))||(e[d]=_,i[d]=f,r[d]=M,_<s&&(s=_),_>u&&(u=_),f<o&&(o=f),f>h&&(h=f),M<a&&(a=M),M>c&&(c=M));if(s>u||o>h||a>c)return this;this.cover(s,o,a).cover(u,h,c);for(let d=0;d<n;++d)an(this,e[d],i[d],r[d],t[d]);return this}function Qn(t,n,e){if(isNaN(t=+t)||isNaN(n=+n)||isNaN(e=+e))return this;var i=this._x0,r=this._y0,s=this._z0,o=this._x1,a=this._y1,u=this._z1;if(isNaN(i))o=(i=Math.floor(t))+1,a=(r=Math.floor(n))+1,u=(s=Math.floor(e))+1;else{for(var h=o-i||1,c=this._root,d,g;i>t||t>=o||r>n||n>=a||s>e||e>=u;)switch(g=(e<s)<<2|(n<r)<<1|t<i,d=new Array(8),d[g]=c,c=d,h*=2,g){case 0:o=i+h,a=r+h,u=s+h;break;case 1:i=o-h,a=r+h,u=s+h;break;case 2:o=i+h,r=a-h,u=s+h;break;case 3:i=o-h,r=a-h,u=s+h;break;case 4:o=i+h,a=r+h,s=u-h;break;case 5:i=o-h,a=r+h,s=u-h;break;case 6:o=i+h,r=a-h,s=u-h;break;case 7:i=o-h,r=a-h,s=u-h;break}this._root&&this._root.length&&(this._root=c)}return this._x0=i,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=u,this}function Zn(){var t=[];return this.visit(function(n){if(!n.length)do t.push(n.data);while(n=n.next)}),t}function Jn(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 D(t,n,e,i,r,s,o){this.node=t,this.x0=n,this.y0=e,this.z0=i,this.x1=r,this.y1=s,this.z1=o}function te(t,n,e,i){var r,s=this._x0,o=this._y0,a=this._z0,u,h,c,d,g,_,f=this._x1,M=this._y1,y=this._z1,l=[],x=this._root,v,m;for(x&&l.push(new D(x,s,o,a,f,M,y)),i==null?i=1/0:(s=t-i,o=n-i,a=e-i,f=t+i,M=n+i,y=e+i,i*=i);v=l.pop();)if(!(!(x=v.node)||(u=v.x0)>f||(h=v.y0)>M||(c=v.z0)>y||(d=v.x1)<s||(g=v.y1)<o||(_=v.z1)<a))if(x.length){var w=(u+d)/2,A=(h+g)/2,$=(c+_)/2;l.push(new D(x[7],w,A,$,d,g,_),new D(x[6],u,A,$,w,g,_),new D(x[5],w,h,$,d,A,_),new D(x[4],u,h,$,w,A,_),new D(x[3],w,A,c,d,g,$),new D(x[2],u,A,c,w,g,$),new D(x[1],w,h,c,d,A,$),new D(x[0],u,h,c,w,A,$)),(m=(e>=$)<<2|(n>=A)<<1|t>=w)&&(v=l[l.length-1],l[l.length-1]=l[l.length-1-m],l[l.length-1-m]=v)}else{var p=t-+this._x.call(null,x.data),S=n-+this._y.call(null,x.data),q=e-+this._z.call(null,x.data),C=p*p+S*S+q*q;if(C<i){var O=Math.sqrt(i=C);s=t-O,o=n-O,a=e-O,f=t+O,M=n+O,y=e+O,r=x.data}}return r}const ne=(t,n,e,i,r,s)=>Math.sqrt((t-i)**2+(n-r)**2+(e-s)**2);function ee(t,n,e,i){const r=[],s=t-i,o=n-i,a=e-i,u=t+i,h=n+i,c=e+i;return this.visit((d,g,_,f,M,y,l)=>{if(!d.length)do{const x=d.data;ne(t,n,e,this._x(x),this._y(x),this._z(x))<=i&&r.push(x)}while(d=d.next);return g>u||_>h||f>c||M<s||y<o||l<a}),r}function ie(t){if(isNaN(g=+this._x.call(null,t))||isNaN(_=+this._y.call(null,t))||isNaN(f=+this._z.call(null,t)))return this;var n,e=this._root,i,r,s,o=this._x0,a=this._y0,u=this._z0,h=this._x1,c=this._y1,d=this._z1,g,_,f,M,y,l,x,v,m,w,A;if(!e)return this;if(e.length)for(;;){if((x=g>=(M=(o+h)/2))?o=M:h=M,(v=_>=(y=(a+c)/2))?a=y:c=y,(m=f>=(l=(u+d)/2))?u=l:d=l,n=e,!(e=e[w=m<<2|v<<1|x]))return this;if(!e.length)break;(n[w+1&7]||n[w+2&7]||n[w+3&7]||n[w+4&7]||n[w+5&7]||n[w+6&7]||n[w+7&7])&&(i=n,A=w)}for(;e.data!==t;)if(r=e,!(e=e.next))return this;return(s=e.next)&&delete e.next,r?(s?r.next=s:delete r.next,this):n?(s?n[w]=s:delete n[w],(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=s,this)}function re(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this}function se(){return this._root}function oe(){var t=0;return this.visit(function(n){if(!n.length)do++t;while(n=n.next)}),t}function ae(t){var n=[],e,i=this._root,r,s,o,a,u,h,c;for(i&&n.push(new D(i,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=n.pop();)if(!t(i=e.node,s=e.x0,o=e.y0,a=e.z0,u=e.x1,h=e.y1,c=e.z1)&&i.length){var d=(s+u)/2,g=(o+h)/2,_=(a+c)/2;(r=i[7])&&n.push(new D(r,d,g,_,u,h,c)),(r=i[6])&&n.push(new D(r,s,g,_,d,h,c)),(r=i[5])&&n.push(new D(r,d,o,_,u,g,c)),(r=i[4])&&n.push(new D(r,s,o,_,d,g,c)),(r=i[3])&&n.push(new D(r,d,g,a,u,h,_)),(r=i[2])&&n.push(new D(r,s,g,a,d,h,_)),(r=i[1])&&n.push(new D(r,d,o,a,u,g,_)),(r=i[0])&&n.push(new D(r,s,o,a,d,g,_))}return this}function fe(t){var n=[],e=[],i;for(this._root&&n.push(new D(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 s,o=i.x0,a=i.y0,u=i.z0,h=i.x1,c=i.y1,d=i.z1,g=(o+h)/2,_=(a+c)/2,f=(u+d)/2;(s=r[0])&&n.push(new D(s,o,a,u,g,_,f)),(s=r[1])&&n.push(new D(s,g,a,u,h,_,f)),(s=r[2])&&n.push(new D(s,o,_,u,g,c,f)),(s=r[3])&&n.push(new D(s,g,_,u,h,c,f)),(s=r[4])&&n.push(new D(s,o,a,f,g,_,d)),(s=r[5])&&n.push(new D(s,g,a,f,h,_,d)),(s=r[6])&&n.push(new D(s,o,_,f,g,c,d)),(s=r[7])&&n.push(new D(s,g,_,f,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 ce(t){return t[0]}function ue(t){return arguments.length?(this._x=t,this):this._x}function he(t){return t[1]}function le(t){return arguments.length?(this._y=t,this):this._y}function de(t){return t[2]}function ge(t){return arguments.length?(this._z=t,this):this._z}function Et(t,n,e,i){var r=new qt(n??ce,e??he,i??de,NaN,NaN,NaN,NaN,NaN,NaN);return t==null?r:r.addAll(t)}function qt(t,n,e,i,r,s,o,a,u){this._x=t,this._y=n,this._z=e,this._x0=i,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=u,this._root=void 0}function Rt(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var K=Et.prototype=qt.prototype;K.copy=function(){var t=new qt(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=Rt(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]=Rt(i));return t};K.add=Xn;K.addAll=Vn;K.cover=Qn;K.data=Zn;K.extent=Jn;K.find=te;K.findAllWithinRadius=ee;K.remove=ie;K.removeAll=re;K.root=se;K.size=oe;K.visit=ae;K.visitAfter=fe;K.x=ue;K.y=le;K.z=ge;function Y(t){return function(){return t}}function Q(t){return(t()-.5)*1e-6}function Mt(t){return t.x+t.vx}function Gt(t){return t.y+t.vy}function pe(t){return t.z+t.vz}function et(t){var n,e,i,r,s=1,o=1;typeof t!="function"&&(t=Y(t==null?1:+t));function a(){for(var c,d=n.length,g,_,f,M,y,l,x,v=0;v<o;++v)for(g=(e===1?kt(n,Mt):e===2?$t(n,Mt,Gt):e===3?Et(n,Mt,Gt,pe):null).visitAfter(u),c=0;c<d;++c)_=n[c],l=i[_.index],x=l*l,f=_.x+_.vx,e>1&&(M=_.y+_.vy),e>2&&(y=_.z+_.vz),g.visit(m);function m(w,A,$,p,S,q,C){var O=[A,$,p,S,q,C],z=O[0],k=O[1],I=O[2],N=O[e],E=O[e+1],T=O[e+2],L=w.data,R=w.r,b=l+R;if(L){if(L.index>_.index){var G=f-L.x-L.vx,W=e>1?M-L.y-L.vy:0,P=e>2?y-L.z-L.vz:0,j=G*G+W*W+P*P;j<b*b&&(G===0&&(G=Q(r),j+=G*G),e>1&&W===0&&(W=Q(r),j+=W*W),e>2&&P===0&&(P=Q(r),j+=P*P),j=(b-(j=Math.sqrt(j)))/j*s,_.vx+=(G*=j)*(b=(R*=R)/(x+R)),e>1&&(_.vy+=(W*=j)*b),e>2&&(_.vz+=(P*=j)*b),L.vx-=G*(b=1-b),e>1&&(L.vy-=W*b),e>2&&(L.vz-=P*b))}return}return z>f+b||N<f-b||e>1&&(k>M+b||E<M-b)||e>2&&(I>y+b||T<y-b)}}function u(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 a.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()},a.iterations=function(c){return arguments.length?(o=+c,a):o},a.strength=function(c){return arguments.length?(s=+c,a):s},a.radius=function(c){return arguments.length?(t=typeof c=="function"?c:Y(+c),h(),a):t},a}function _e(t){return t.index}function Pt(t,n){var e=t.get(n);if(!e)throw new Error("node not found: "+n);return e}function ft(t){var n=_e,e=g,i,r=Y(30),s,o,a,u,h,c,d=1;t==null&&(t=[]);function g(l){return 1/Math.min(u[l.source.index],u[l.target.index])}function _(l){for(var x=0,v=t.length;x<d;++x)for(var m=0,w,A,$,p=0,S=0,q=0,C,O;m<v;++m)w=t[m],A=w.source,$=w.target,p=$.x+$.vx-A.x-A.vx||Q(c),a>1&&(S=$.y+$.vy-A.y-A.vy||Q(c)),a>2&&(q=$.z+$.vz-A.z-A.vz||Q(c)),C=Math.sqrt(p*p+S*S+q*q),C=(C-s[m])/C*l*i[m],p*=C,S*=C,q*=C,$.vx-=p*(O=h[m]),a>1&&($.vy-=S*O),a>2&&($.vz-=q*O),A.vx+=p*(O=1-O),a>1&&(A.vy+=S*O),a>2&&(A.vz+=q*O)}function f(){if(o){var l,x=o.length,v=t.length,m=new Map(o.map((A,$)=>[n(A,$,o),A])),w;for(l=0,u=new Array(x);l<v;++l)w=t[l],w.index=l,typeof w.source!="object"&&(w.source=Pt(m,w.source)),typeof w.target!="object"&&(w.target=Pt(m,w.target)),u[w.source.index]=(u[w.source.index]||0)+1,u[w.target.index]=(u[w.target.index]||0)+1;for(l=0,h=new Array(v);l<v;++l)w=t[l],h[l]=u[w.source.index]/(u[w.source.index]+u[w.target.index]);i=new Array(v),M(),s=new Array(v),y()}}function M(){if(o)for(var l=0,x=t.length;l<x;++l)i[l]=+e(t[l],l,t)}function y(){if(o)for(var l=0,x=t.length;l<x;++l)s[l]=+r(t[l],l,t)}return _.initialize=function(l,...x){o=l,c=x.find(v=>typeof v=="function")||Math.random,a=x.find(v=>[1,2,3].includes(v))||2,f()},_.links=function(l){return arguments.length?(t=l,f(),_):t},_.id=function(l){return arguments.length?(n=l,_):n},_.iterations=function(l){return arguments.length?(d=+l,_):d},_.strength=function(l){return arguments.length?(e=typeof l=="function"?l:Y(+l),M(),_):e},_.distance=function(l){return arguments.length?(r=typeof l=="function"?l:Y(+l),y(),_):r},_}var xe={value:()=>{}};function fn(){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 _t(e)}function _t(t){this._=t}function ye(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}})}_t.prototype=fn.prototype={constructor:_t,on:function(t,n){var e=this._,i=ye(t+"",e),r,s=-1,o=i.length;if(arguments.length<2){for(;++s<o;)if((r=(t=i[s]).type)&&(r=we(e[r],t.name)))return r;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++s<o;)if(r=(t=i[s]).type)e[r]=jt(e[r],t.name,n);else if(n==null)for(r in e)e[r]=jt(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 _t(t)},call:function(t,n){if((r=arguments.length-2)>0)for(var e=new Array(r),i=0,r,s;i<r;++i)e[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],i=0,r=s.length;i<r;++i)s[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,s=i.length;r<s;++r)i[r].value.apply(n,e)}};function we(t,n){for(var e=0,i=t.length,r;e<i;++e)if((r=t[e]).name===n)return r.value}function jt(t,n,e){for(var i=0,r=t.length;i<r;++i)if(t[i].name===n){t[i]=xe,t=t.slice(0,i).concat(t.slice(i+1));break}return e!=null&&t.push({name:n,value:e}),t}var ct=0,dt=0,lt=0,cn=1e3,xt,gt,yt=0,ot=0,wt=0,pt=typeof performance=="object"&&performance.now?performance:Date,un=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function hn(){return ot||(un(ve),ot=pt.now()+wt)}function ve(){ot=0}function At(){this._call=this._time=this._next=null}At.prototype=ln.prototype={constructor:At,restart:function(t,n,e){if(typeof t!="function")throw new TypeError("callback is not a function");e=(e==null?hn():+e)+(n==null?0:+n),!this._next&&gt!==this&&(gt?gt._next=this:xt=this,gt=this),this._call=t,this._time=e,It()},stop:function(){this._call&&(this._call=null,this._time=1/0,It())}};function ln(t,n,e){var i=new At;return i.restart(t,n,e),i}function Me(){hn(),++ct;for(var t=xt,n;t;)(n=ot-t._time)>=0&&t._call.call(void 0,n),t=t._next;--ct}function Ut(){ot=(yt=pt.now())+wt,ct=dt=0;try{Me()}finally{ct=0,ze(),ot=0}}function me(){var t=pt.now(),n=t-yt;n>cn&&(wt-=n,yt=t)}function ze(){for(var t,n=xt,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:xt=e);gt=t,It(i)}function It(t){if(!ct){dt&&(dt=clearTimeout(dt));var n=t-ot;n>24?(t<1/0&&(dt=setTimeout(Ut,t-pt.now()-wt)),lt&&(lt=clearInterval(lt))):(lt||(yt=pt.now(),lt=setInterval(me,cn)),ct=1,un(Ut))}}const Ne=1664525,Ae=1013904223,Wt=4294967296;function Ie(){let t=1;return()=>(t=(Ne*t+Ae)%Wt)/Wt}var Yt=3;function mt(t){return t.x}function Kt(t){return t.y}function ke(t){return t.z}var Se=10,$e=Math.PI*(3-Math.sqrt(5)),be=Math.PI*20/(9+Math.sqrt(221));function it(t,n){n=n||2;var e=Math.min(Yt,Math.max(1,Math.round(n))),i,r=1,s=.001,o=1-Math.pow(s,1/300),a=0,u=.6,h=new Map,c=ln(_),d=fn("tick","end"),g=Ie();t==null&&(t=[]);function _(){f(),d.call("tick",i),r<s&&(c.stop(),d.call("end",i))}function f(l){var x,v=t.length,m;l===void 0&&(l=1);for(var w=0;w<l;++w)for(r+=(a-r)*o,h.forEach(function(A){A(r)}),x=0;x<v;++x)m=t[x],m.fx==null?m.x+=m.vx*=u:(m.x=m.fx,m.vx=0),e>1&&(m.fy==null?m.y+=m.vy*=u:(m.y=m.fy,m.vy=0)),e>2&&(m.fz==null?m.z+=m.vz*=u:(m.z=m.fz,m.vz=0));return i}function M(){for(var l=0,x=t.length,v;l<x;++l){if(v=t[l],v.index=l,v.fx!=null&&(v.x=v.fx),v.fy!=null&&(v.y=v.fy),v.fz!=null&&(v.z=v.fz),isNaN(v.x)||e>1&&isNaN(v.y)||e>2&&isNaN(v.z)){var m=Se*(e>2?Math.cbrt(.5+l):e>1?Math.sqrt(.5+l):l),w=l*$e,A=l*be;e===1?v.x=m:e===2?(v.x=m*Math.cos(w),v.y=m*Math.sin(w)):(v.x=m*Math.sin(w)*Math.cos(A),v.y=m*Math.cos(w),v.z=m*Math.sin(w)*Math.sin(A))}(isNaN(v.vx)||e>1&&isNaN(v.vy)||e>2&&isNaN(v.vz))&&(v.vx=0,e>1&&(v.vy=0),e>2&&(v.vz=0))}}function y(l){return l.initialize&&l.initialize(t,g,e),l}return M(),i={tick:f,restart:function(){return c.restart(_),i},stop:function(){return c.stop(),i},numDimensions:function(l){return arguments.length?(e=Math.min(Yt,Math.max(1,Math.round(l))),h.forEach(y),i):e},nodes:function(l){return arguments.length?(t=l,M(),h.forEach(y),i):t},alpha:function(l){return arguments.length?(r=+l,i):r},alphaMin:function(l){return arguments.length?(s=+l,i):s},alphaDecay:function(l){return arguments.length?(o=+l,i):+o},alphaTarget:function(l){return arguments.length?(a=+l,i):a},velocityDecay:function(l){return arguments.length?(u=1-l,i):1-u},randomSource:function(l){return arguments.length?(g=l,h.forEach(y),i):g},force:function(l,x){return arguments.length>1?(x==null?h.delete(l):h.set(l,y(x)),i):h.get(l)},find:function(){var l=Array.prototype.slice.call(arguments),x=l.shift()||0,v=(e>1?l.shift():null)||0,m=(e>2?l.shift():null)||0,w=l.shift()||1/0,A=0,$=t.length,p,S,q,C,O,z;for(w*=w,A=0;A<$;++A)O=t[A],p=x-O.x,S=v-(O.y||0),q=m-(O.z||0),C=p*p+S*S+q*q,C<w&&(z=O,w=C);return z},on:function(l,x){return arguments.length>1?(d.on(l,x),i):d.on(l)}}}function rt(){var t,n,e,i,r,s=Y(-30),o,a=1,u=1/0,h=.81;function c(f){var M,y=t.length,l=(n===1?kt(t,mt):n===2?$t(t,mt,Kt):n===3?Et(t,mt,Kt,ke):null).visitAfter(g);for(r=f,M=0;M<y;++M)e=t[M],l.visit(_)}function d(){if(t){var f,M=t.length,y;for(o=new Array(M),f=0;f<M;++f)y=t[f],o[y.index]=+s(y,f,t)}}function g(f){var M=0,y,l,x=0,v,m,w,A,$=f.length;if($){for(v=m=w=A=0;A<$;++A)(y=f[A])&&(l=Math.abs(y.value))&&(M+=y.value,x+=l,v+=l*(y.x||0),m+=l*(y.y||0),w+=l*(y.z||0));M*=Math.sqrt(4/$),f.x=v/x,n>1&&(f.y=m/x),n>2&&(f.z=w/x)}else{y=f,y.x=y.data.x,n>1&&(y.y=y.data.y),n>2&&(y.z=y.data.z);do M+=o[y.data.index];while(y=y.next)}f.value=M}function _(f,M,y,l,x){if(!f.value)return!0;var v=[y,l,x][n-1],m=f.x-e.x,w=n>1?f.y-e.y:0,A=n>2?f.z-e.z:0,$=v-M,p=m*m+w*w+A*A;if($*$/h<p)return p<u&&(m===0&&(m=Q(i),p+=m*m),n>1&&w===0&&(w=Q(i),p+=w*w),n>2&&A===0&&(A=Q(i),p+=A*A),p<a&&(p=Math.sqrt(a*p)),e.vx+=m*f.value*r/p,n>1&&(e.vy+=w*f.value*r/p),n>2&&(e.vz+=A*f.value*r/p)),!0;if(f.length||p>=u)return;(f.data!==e||f.next)&&(m===0&&(m=Q(i),p+=m*m),n>1&&w===0&&(w=Q(i),p+=w*w),n>2&&A===0&&(A=Q(i),p+=A*A),p<a&&(p=Math.sqrt(a*p)));do f.data!==e&&($=o[f.data.index]*r/p,e.vx+=m*$,n>1&&(e.vy+=w*$),n>2&&(e.vz+=A*$));while(f=f.next)}return c.initialize=function(f,...M){t=f,i=M.find(y=>typeof y=="function")||Math.random,n=M.find(y=>[1,2,3].includes(y))||2,d()},c.strength=function(f){return arguments.length?(s=typeof f=="function"?f:Y(+f),d(),c):s},c.distanceMin=function(f){return arguments.length?(a=f*f,c):Math.sqrt(a)},c.distanceMax=function(f){return arguments.length?(u=f*f,c):Math.sqrt(u)},c.theta=function(f){return arguments.length?(h=f*f,c):Math.sqrt(h)},c}function Tt(t){var n=Y(.1),e,i,r;typeof t!="function"&&(t=Y(t==null?0:+t));function s(a){for(var u=0,h=e.length,c;u<h;++u)c=e[u],c.vx+=(r[u]-c.x)*i[u]*a}function o(){if(e){var a,u=e.length;for(i=new Array(u),r=new Array(u),a=0;a<u;++a)i[a]=isNaN(r[a]=+t(e[a],a,e))?0:+n(e[a],a,e)}}return s.initialize=function(a){e=a,o()},s.strength=function(a){return arguments.length?(n=typeof a=="function"?a:Y(+a),o(),s):n},s.x=function(a){return arguments.length?(t=typeof a=="function"?a:Y(+a),o(),s):t},s}function Ot(t){var n=Y(.1),e,i,r;typeof t!="function"&&(t=Y(t==null?0:+t));function s(a){for(var u=0,h=e.length,c;u<h;++u)c=e[u],c.vy+=(r[u]-c.y)*i[u]*a}function o(){if(e){var a,u=e.length;for(i=new Array(u),r=new Array(u),a=0;a<u;++a)i[a]=isNaN(r[a]=+t(e[a],a,e))?0:+n(e[a],a,e)}}return s.initialize=function(a){e=a,o()},s.strength=function(a){return arguments.length?(n=typeof a=="function"?a:Y(+a),o(),s):n},s.y=function(a){return arguments.length?(t=typeof a=="function"?a:Y(+a),o(),s):t},s}function Ct(t){var n=Y(.1),e,i,r;typeof t!="function"&&(t=Y(t==null?0:+t));function s(a){for(var u=0,h=e.length,c;u<h;++u)c=e[u],c.vz+=(r[u]-c.z)*i[u]*a}function o(){if(e){var a,u=e.length;for(i=new Array(u),r=new Array(u),a=0;a<u;++a)i[a]=isNaN(r[a]=+t(e[a],a,e))?0:+n(e[a],a,e)}}return s.initialize=function(a){e=a,o()},s.strength=function(a){return arguments.length?(n=typeof a=="function"?a:Y(+a),o(),s):n},s.z=function(a){return arguments.length?(t=typeof a=="function"?a:Y(+a),o(),s):t},s}function Ee(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 qe(t){let n=t>>>0;return()=>(n=Math.imul(n,1664525)+1013904223>>>0,n/4294967296)}function ut(t){return qe(Ee(t))}const Z=.55,Te=12,Oe=60,zt=60;function Ce(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 Fe(t,n,e){const[i,r,s]=t,o=i*Math.cos(n)+s*Math.sin(n),a=-i*Math.sin(n)+s*Math.cos(n),u=r*Math.cos(e)-a*Math.sin(e),h=r*Math.sin(e)+a*Math.cos(e);return[o,u,h]}function Le(t,n,e){const i=f=>Math.hypot(f[0],f[1],f[2]),r=i(n),s=i(e);if(r<1e-9||s<1e-9)return t;const o=[n[0]/r,n[1]/r,n[2]/r],a=[e[0]/s,e[1]/s,e[2]/s],u=[o[1]*a[2]-o[2]*a[1],o[2]*a[0]-o[0]*a[2],o[0]*a[1]-o[1]*a[0]],h=i(u),c=o[0]*a[0]+o[1]*a[1]+o[2]*a[2];if(h<1e-9)return c>0?t:[-t[0],-t[1],-t[2]];const d=[u[0]/h,u[1]/h,u[2]/h],g=d[0]*t[0]+d[1]*t[1]+d[2]*t[2],_=[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+_[0]*h+d[0]*g*(1-c),t[1]*c+_[1]*h+d[1]*g*(1-c),t[2]*c+_[2]*h+d[2]*g*(1-c)]}function Bt(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 Nt(t,n,e){const i=n<=1?0:1-2*(t+.5)/n,r=Math.sqrt(Math.max(0,1-i*i)),s=t*Math.PI*(3-Math.sqrt(5));return[Math.cos(s)*r*e,i*e,Math.sin(s)*r*e]}function Ft(t,n,e=()=>{},i="clumps",r=ut){const s=new Map(t.map(z=>[z.id,z])),o=new Map,a=[];for(const z of t)z.group===null?a.push(z):o.set(z.group,[...o.get(z.group)??[],z]);const u=new Map,h=new Map,c=new Map,d=new Set;let g=0;const _=Math.max(1,o.size),f=new Map;for(const[z,k]of o){const I=k.filter(b=>b.seed!==void 0),N=[0,0,0];for(const b of I)N[0]+=b.seed[0],N[1]+=b.seed[1],N[2]+=b.seed[2];I.length>0&&(N[0]/=I.length,N[1]/=I.length,N[2]/=I.length,c.set(z,N)),k.every(b=>b.frozen===!0&&b.seed!==void 0)&&d.add(z);const E=new Map,T=I.length===0?Ce(k):null,L=T===null?void 0:f.get(T);if(I.length===k.length)for(const b of k)E.set(b.id,[b.seed[0]-N[0],b.seed[1]-N[1],b.seed[2]-N[2]]);else if(L!==void 0){const b=r(z),G=b()*Math.PI*2,W=(b()-.5)*Math.PI;k.forEach((P,j)=>{E.set(P.id,Fe(L[j]??[0,0,0],G,W))})}else{const b=k.map(F=>{const V={id:F.id,r:F.radius};return F.seed!==void 0&&(V.x=F.seed[0]-N[0],V.y=F.seed[1]-N[1],V.z=F.seed[2]-N[2],F.frozen===!0&&(V.fx=V.x,V.fy=V.y,V.fz=V.z)),V}),G=new Set(k.map(F=>F.id)),W=[];for(const F of k)for(const V of F.parents)G.has(V)&&W.push({source:V,target:F.id});const P=new Map(k.map(F=>[F.id,F.radius])),j=it(b,3).force("link",ft(W).id(F=>F.id).distance(n.link?F=>(P.get(F.source.id)??Z)+(P.get(F.target.id)??Z)+1.4:2.2)).force("charge",rt().strength(F=>n.charge?-6*(F.r/Z)**2:-6).distanceMax(Te)).force("center",nt(0,0,0)).stop();n.collide&&j.force("collide",et().radius(F=>F.r*1.2));for(let F=0;F<Oe;F++)j.tick();const J=[0,0,0];for(const F of b)J[0]+=F.x??0,J[1]+=F.y??0,J[2]+=F.z??0;J[0]/=b.length,J[1]/=b.length,J[2]/=b.length;for(const F of b)E.set(F.id,[(F.x??0)-J[0],(F.y??0)-J[1],(F.z??0)-J[2]]);T!==null&&f.set(T,k.map(F=>E.get(F.id)??[0,0,0]))}let R=Z;for(const b of k){const G=E.get(b.id)??[0,0,0];u.set(b.id,G),R=Math.max(R,Math.hypot(G[0],G[1],G[2])+b.radius)}h.set(z,R),g+=1,g%50===0&&e(.3*(g/_))}e(.3);const M=z=>{const k=s.get(z);return k!==void 0&&k.group!==null?`group:${k.group}`:z},y=[],l=new Map;let x=!1;for(const[z]of o){const k=`group:${z}`,I=h.get(z)??Z,N={id:k,r:I},E=c.get(z);E!==void 0&&(N.x=E[0],N.y=E[1],N.z=E[2],d.has(z)&&(N.fx=E[0],N.fy=E[1],N.fz=E[2],x=!0)),l.set(k,I),y.push(N)}for(const z of a){const k={id:z.id,r:z.radius};z.seed!==void 0&&(k.x=z.seed[0],k.y=z.seed[1],k.z=z.seed[2],z.frozen===!0&&(k.fx=z.seed[0],k.fy=z.seed[1],k.fz=z.seed[2],x=!0)),l.set(z.id,z.radius),y.push(k)}const v=new Set,m=[];for(const z of t)for(const k of z.parents){if(!s.has(k))continue;const I=M(k),N=M(z.id);if(I===N)continue;const E=`${I}\0${N}`;v.has(E)||(v.add(E),m.push({source:I,target:N}))}const w=new Map;for(const z of m)if(z.source.startsWith("group:")!==z.target.startsWith("group:")){const k=z.source.startsWith("group:")?z.source:z.target,I=z.source.startsWith("group:")?z.target:z.source;w.has(k)||w.set(k,I)}const A=new Map;for(const z of y){const k=w.get(z.id);k!==void 0&&A.set(k,[...A.get(k)??[],z])}const $=y.reduce((z,k)=>z+k.r*k.r,0),p=y.filter(z=>!z.id.startsWith("group:"));p.forEach((z,k)=>{if(z.x!==void 0)return;const[I,N,E]=Nt(k,p.length,Math.sqrt($)*1.2+10);z.x=I,z.y=N,z.z=E});for(const[z,k]of A){const I=y.find(E=>E.id===z),N=Math.sqrt(k.reduce((E,T)=>E+T.r*T.r,0))*1.4+2;k.forEach((E,T)=>{if(E.x!==void 0)return;const[L,R,b]=Nt(T,k.length,N);E.x=(I?.x??0)+L,E.y=(I?.y??0)+R,E.z=(I?.z??0)+b})}const S=new Set;if(i==="spokes"){const z=I=>{const N=o.get(I)??[],E=new Set(N.map(L=>L.id)),T=N.find(L=>L.parents.some(R=>!E.has(R)))??N[0];return T===void 0?[0,0,0]:u.get(T.id)??[0,0,0]},k=[];for(const I of y){if(I.id.startsWith("group:")&&w.has(I.id)){S.add(I.id);continue}if(I.id.startsWith("group:"))k.push(I);else{const N=A.get(I.id)??[];let E=I.r;const T=Bt(I.r,N,h);for(const L of N){const R=L.id.slice(6),b=z(R);E=Math.max(E,T+Math.hypot(b[0],b[1],b[2])+2*(h.get(R)??Z))}k.push({id:I.id,r:E,x:I.x,y:I.y,z:I.z,...I.fx!==void 0?{fx:I.fx,fy:I.fy,fz:I.fz}:{}})}}if(!k.every(I=>I.fx!==void 0)){const I=it(k,3).force("charge",rt().strength(N=>-1.5*N.r)).force("collide",et().radius(N=>N.r*.9)).stop();x||I.force("center",nt(0,0,0));for(let N=0;N<zt;N++)I.tick(),N%5===0&&e(.3+.7*(N/zt))}for(const I of k){const N=y.find(E=>E.id===I.id);N!==void 0&&N!==I&&(N.x=I.x,N.y=I.y,N.z=I.z)}for(const I of y){if(I.id.startsWith("group:")||!A.has(I.id))continue;const N=A.get(I.id)??[],E=Bt(I.r,N,h);N.forEach((T,L)=>{if(T.fx!==void 0||c.has(T.id.slice(6)))return;const R=z(T.id.slice(6)),b=Nt(L,N.length,1),G=.35+.65*(L*.6180339887%1),W=I.r+1.4+E*G+Math.hypot(R[0],R[1],R[2]);T.x=(I.x??0)+b[0]*W,T.y=(I.y??0)+b[1]*W,T.z=(I.z??0)+b[2]*W})}}if(!y.every(z=>z.fx!==void 0)&&i!=="spokes"){const z=it(y,3).force("link",ft(m).id(N=>N.id).distance(n.link?N=>(l.get(N.source.id)??Z)+(l.get(N.target.id)??Z)+1.4:2.2)).stop(),k=rt().strength(N=>n.charge?-6*(N.r/Z)**2:-6);if(n.reach!==void 0&&k.distanceMax(n.reach),z.force("charge",k),x||z.force("center",nt(0,0,0)),n.collide&&z.force("collide",et().radius(N=>N.r*1.05)),n.gravity){const N=E=>Math.min(1,(E.r/Z)**2*.08);z.force("gx",Tt(0).strength(N)).force("gy",Ot(0).strength(N)).force("gz",Ct(0).strength(N))}const I=zt;for(let N=0;N<I;N++)z.tick(),N%5===0&&e(.3+.7*(N/I))}const C=new Map(y.map(z=>[z.id,z]));if(i==="spokes")for(const[z,k]of o){if(k.some(P=>P.seed!==void 0))continue;const I=`group:${z}`,N=C.get(I),E=w.get(I),T=E===void 0?void 0:C.get(E);if(N===void 0||T===void 0)continue;const L=[(N.x??0)-(T.x??0),(N.y??0)-(T.y??0),(N.z??0)-(T.z??0)],R=new Set(k.map(P=>P.id)),b=k.find(P=>P.parents.some(j=>!R.has(j)))??k[0],G=u.get(b.id)??[0,0,0],W=[-G[0],-G[1],-G[2]];for(const P of k){const j=u.get(P.id)??[0,0,0];u.set(P.id,Le(j,W,L))}}const O={};for(const z of t){const k=C.get(M(z.id)),I=[k?.x??0,k?.y??0,k?.z??0],N=z.group===null?[0,0,0]:u.get(z.id)??[0,0,0];O[z.id]=[I[0]+N[0],I[1]+N[1],I[2]+N[2]]}return e(1),O}const Ht=80;function dn(t,n,e=()=>{},i=ut){const r=t.some(g=>g.seed===void 0),s=r?Ft(t,n,g=>e(.05*g),"spokes",i):{};e(.05);const o=t.map(g=>{const _=g.seed??s[g.id],f={id:g.id,r:g.radius};return _!==void 0&&(f.x=_[0],f.y=_[1],f.z=_[2],g.frozen===!0&&g.seed!==void 0&&(f.fx=_[0],f.fy=_[1],f.fz=_[2])),f}),a=new Set(t.map(g=>g.id)),u=[];for(const g of t)for(const _ of g.parents)a.has(_)&&u.push({source:_,target:g.id});const h=new Map(t.map(g=>[g.id,g.radius])),c=o.some(g=>g.fx!==void 0);if(!o.every(g=>g.fx!==void 0)){const g=it(o,3).force("link",ft(u).id(f=>f.id).distance(n.link?f=>(h.get(f.source.id)??U)+(h.get(f.target.id)??U)+1.4:2.2)).stop(),_=rt().strength(f=>n.charge?-6*(f.r/U)**2:-6);if(n.reach!==void 0&&_.distanceMax(n.reach),g.force("charge",_),c||g.force("center",nt(0,0,0)),n.collide&&g.force("collide",et().radius(f=>f.r*1.2)),n.gravity){const f=M=>(M.r/U)**2*.08;g.force("gx",Tt(0).strength(f)).force("gy",Ot(0).strength(f)).force("gz",Ct(0).strength(f))}r&&g.alpha(.6);for(let f=0;f<Ht;f++)g.tick(),f%2===0&&e(.05+.95*(f/Ht))}const d={};for(const g of o)d[g.id]=[g.x??0,g.y??0,g.z??0];return e(1),d}function De(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 Re(t,n=3,e=new Map,i=rn,r=new Set){const s=[];for(const x of t)for(const v of x.parents)s.push({source:v,target:x.id});const o=De(t),a=Math.max(...o,1),u=o.map(x=>U*(.5+x/a*1.2)),h=new Map(t.map((x,v)=>[x.id,u[v]??U])),c=t.map(x=>{const v=e.get(x.id);return v===void 0?{id:x.id}:r.has(x.id)?{id:x.id,x:v[0],y:v[1],z:v[2],fx:v[0],fy:v[1],fz:v[2]}:{id:x.id,x:v[0],y:v[1],z:v[2]}}),d=x=>r.has(x.id)&&x.fx!==void 0;let g=c,_=s;if(r.size>0){const x=new Set(c.filter(w=>!d(w)).map(w=>w.id));_=s.filter(w=>x.has(w.source)||x.has(w.target));const v=new Set(x);for(const w of _)v.add(w.source),v.add(w.target);g=c.filter(w=>v.has(w.id));const m=new Set(g.map(w=>w.id));_=_.filter(w=>m.has(w.source)&&m.has(w.target))}const f=rt().strength(i.charge?x=>r.has(x.id)?0:-6*((h.get(x.id)??U)/U)**2:x=>r.has(x.id)?0:-6);i.reach!==void 0&&f.distanceMax(i.reach);const M=it(g,n).force("link",ft(_).id(x=>x.id).distance(i.link?x=>(h.get(x.source.id)??U)+(h.get(x.target.id)??U)+1.4:2.2)).force("charge",f).stop();if(r.size===0&&M.force("center",n===2?nt(0,0):nt(0,0,0)),i.collide&&M.force("collide",et().radius(x=>(h.get(x.id)??U)*1.2)),i.gravity){const x=v=>((h.get(v.id)??U)/U)**2*.08;M.force("gx",Tt(0).strength(x)).force("gy",Ot(0).strength(x)),n===3&&M.force("gz",Ct(0).strength(x))}const y=g.length===0?0:e.size>0?90:150;let l=0;return{total:y,moving:g.length,step:x=>{for(let v=0;v<x&&l<y;v++,l++)M.tick()},place:()=>t.map((x,v)=>{const m=c[v];return{id:x.id,position:[m?.x??0,m?.y??0,m?.z??0],radius:u[v]??U}})}}function Ge(t,n=3,e=new Map,i=rn,r=new Set){const s=Re(t,n,e,i,r);return s.step(s.total),s.place()}const Xt=160,Vt=120,Qt=5,Pe=.9,Zt=.3,je=.9;function gn(t,n){const e=new Map;for(const[i,r]of t)e.set(i,n===0||r/n>je?0:Math.log(n/Math.max(1,r)));return e}function Ue(t,n,e=()=>{}){const i=p=>typeof p.attrs?.plugin=="string"?p.attrs.plugin:null,r=p=>p.attrs?.kind==="star"&&i(p)!==null,s=t.filter(r),o=new Map(s.map(p=>[i(p),p])),a=t.filter(p=>!r(p)),u=new Map;for(const p of a){const S=i(p);p.group===null||S===null||!o.has(S)||u.set(p.group,(u.get(p.group)??new Set).add(S))}const h=new Map;for(const p of u.values())for(const S of p)h.set(S,(h.get(S)??0)+1);const c=gn(h,u.size),d=Math.max(1e-9,...c.values()),g=new Map;for(const p of u.values()){const S=[...p].sort();for(let q=0;q<S.length;q++)for(let C=q+1;C<S.length;C++){const O=`${S[q]}\0${S[C]}`;g.set(O,(g.get(O)??0)+1)}}const _=Math.max(6,Math.sqrt(s.length)*4,Math.sqrt(a.length)*1.6),f=s.map(p=>Jt(p,_,ut(`star:${p.id}`))),M=[];for(const[p,S]of g){const[q,C]=p.split("\0"),O=Math.min(h.get(q)??1,h.get(C)??1);M.push({source:o.get(q).id,target:o.get(C).id,share:S/Math.max(1,O)})}if(f.length>0&&f.some(p=>p.fx===void 0)){const p=it(f,3).force("link",ft(M).id(S=>S.id).distance(S=>_*(1.1-Number(S.share))).strength(S=>.05+.6*Number(S.share))).force("charge",rt().strength(-30).distanceMax(_*3)).force("collide",et().radius(S=>S.r*3)).force("center",nt(0,0,0)).stop();for(let S=0;S<Xt;S++)p.tick(),S%4===0&&e(.4*(S/Xt))}const y=new Map(f.map(p=>[p.id,[p.x??0,p.y??0,p.z??0]]));e(.4);const l=[...f.map(p=>({...p,fx:p.x??0,fy:p.y??0,fz:p.z??0})),...a.map(p=>{const S=i(p),q=S===null?void 0:o.get(S),C=q===void 0?void 0:y.get(q.id);return Jt(p,2,ut(`stage:${p.id}`),C)})],x=new Set(t.map(p=>p.id)),v=new Map(t.map(p=>[p.id,p.radius])),m=[];for(const p of a){for(const z of p.parents)x.has(z)&&m.push({source:z,target:p.id,strength:1,length:(v.get(z)??U)+p.radius+1.4});const S=i(p),q=S===null?void 0:o.get(S),C=S===null?0:c.get(S)??0,O=p.group===null?1:Math.max(1,u.get(p.group)?.size??1);if(q!==void 0&&C>0){const z=C/d,k=(Zt+(Pe-Zt)*z)/Math.sqrt(O);m.push({source:q.id,target:p.id,strength:k,length:q.radius+p.radius+1})}}const w=it(l,3).force("link",ft(m).id(p=>p.id).distance(p=>Number(p.length)).strength(p=>Number(p.strength))).stop();if(n.charge){const p=rt().strength(S=>-6*(S.r/U)**2);p.distanceMax(Math.min(n.reach??Qt,Qt)),w.force("charge",p)}n.collide&&w.force("collide",et().radius(p=>p.r*1.2));const A=l.some(p=>p.fx===void 0);for(let p=0;A&&p<Vt;p++)w.tick(),p%4===0&&e(.4+.6*(p/Vt));const $={};for(const p of l)$[p.id]=[p.x??0,p.y??0,p.z??0];return e(1),$}function Jt(t,n,e,i=[0,0,0]){const r={id:t.id,r:t.radius},s=t.seed??[i[0]+(e()-.5)*2*n,i[1]+(e()-.5)*2*n,i[2]+(e()-.5)*2*n];return r.x=s[0],r.y=s[1],r.z=s[2],t.frozen===!0&&t.seed!==void 0&&(r.fx=s[0],r.fy=s[1],r.fz=s[2]),r}const ht=.4,We=400,at=.35,Ye=.01,Ke=3;function tn(t,n,e){let i=0,r=0;for(const s of new Set([...t,...n])){const o=e.get(s)??0;r+=o,t.has(s)&&n.has(s)&&(i+=o)}return r===0?0:i/r}const nn=1.4,Be=Math.PI/3;function He(t,n){const e=new Map,i=new Map(t.map(c=>[c.id,c])),r=new Map,s=[];for(const c of t){const d=c.parents.find(g=>i.has(g));d===void 0?s.push(c):r.set(d,[...r.get(d)??[],c])}const o=new Map,a=[];s.forEach((c,d)=>{const g=st(n),_=d===0?0:c.radius*2+nn;e.set(c.id,[g[0]*_,g[1]*_,g[2]*_]),o.set(c.id,g),a.push(c)});for(let c=a.shift();c!==void 0;c=a.shift()){const d=e.get(c.id),g=o.get(c.id);for(const _ of r.get(c.id)??[]){if(e.has(_.id))continue;const f=n()*Be,M=Xe(g,n),y=pn([g[0]*Math.cos(f)+M[0]*Math.sin(f),g[1]*Math.cos(f)+M[1]*Math.sin(f),g[2]*Math.cos(f)+M[2]*Math.sin(f)]),l=c.radius+_.radius+nn;e.set(_.id,[d[0]+y[0]*l,d[1]+y[1]*l,d[2]+y[2]*l]),o.set(_.id,y),a.push(_)}}for(const c of t)e.has(c.id)||e.set(c.id,[0,0,0]);const u=[0,0,0];for(const c of e.values())u[0]+=c[0]/e.size,u[1]+=c[1]/e.size,u[2]+=c[2]/e.size;let h=U;for(const c of t){const d=e.get(c.id),g=[d[0]-u[0],d[1]-u[1],d[2]-u[2]];e.set(c.id,g),h=Math.max(h,Math.hypot(g[0],g[1],g[2])+c.radius)}return{local:e,radius:h}}function pn(t){const n=Math.max(1e-9,Math.hypot(t[0],t[1],t[2]));return[t[0]/n,t[1]/n,t[2]/n]}function Xe(t,n){const e=Math.abs(t[0])<.9?[1,0,0]:[0,1,0],i=pn([t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]),r=[t[1]*i[2]-t[2]*i[1],t[2]*i[0]-t[0]*i[2],t[0]*i[1]-t[1]*i[0]],s=n()*Math.PI*2;return[i[0]*Math.cos(s)+r[0]*Math.sin(s),i[1]*Math.cos(s)+r[1]*Math.sin(s),i[2]*Math.cos(s)+r[2]*Math.sin(s)]}function st(t){const n=t()*2-1,e=t()*Math.PI*2,i=Math.sqrt(1-n*n);return[i*Math.cos(e),i*Math.sin(e),n]}class Ve{size;cells=new Map;constructor(n){this.size=n}key(n){return`${Math.floor(n[0]/this.size)},${Math.floor(n[1]/this.size)},${Math.floor(n[2]/this.size)}`}add(n){const e=this.key(n.centre);this.cells.set(e,[...this.cells.get(e)??[],n])}touching(n,e){const i=[],[r,s,o]=[Math.floor(n[0]/this.size),Math.floor(n[1]/this.size),Math.floor(n[2]/this.size)];for(let a=-1;a<=1;a++)for(let u=-1;u<=1;u++)for(let h=-1;h<=1;h++)for(const c of this.cells.get(`${r+a},${s+u},${o+h}`)??[]){const d=e+c.particle.radius+ht;Math.hypot(n[0]-c.centre[0],n[1]-c.centre[1],n[2]-c.centre[2])<d&&i.push(c)}return i}}function en(t,n,e,i){let r=[n[0]-t.centre[0],n[1]-t.centre[1],n[2]-t.centre[2]];const s=Math.hypot(r[0],r[1],r[2]);r=s<1e-9?st(i):[r[0]/s,r[1]/s,r[2]/s];const o=e+t.particle.radius+ht;return[t.centre[0]+r[0]*o,t.centre[1]+r[1]*o,t.centre[2]+r[2]*o]}function Qe(t,n,e=()=>{}){const i={},r={};if(t.length>0&&t.every(f=>f.frozen===!0&&f.seed!==void 0)){for(const f of t)i[f.id]=f.seed;return e(1),{positions:i,arrival:r}}const s=new Map;for(const f of t){if(f.group===null){i[f.id]=[0,0,0];continue}s.set(f.group,[...s.get(f.group)??[],f])}const o=[...s].map(([f,M])=>{const y=new Set;let l=Number.POSITIVE_INFINITY;for(const m of M){const w=m.attrs?.plugin;typeof w=="string"&&y.add(w);const A=m.attrs?.createdAt;typeof A=="number"&&A<l&&(l=A)}if(M.every(m=>m.frozen===!0&&m.seed!==void 0)){const m=M.map(p=>p.seed),w=[0,1,2].map(p=>m.reduce((S,q)=>S+q[p],0)/m.length),A=new Map;let $=U;for(const p of M){const S=p.seed,q=[S[0]-w[0],S[1]-w[1],S[2]-w[2]];A.set(p.id,q),$=Math.max($,Math.hypot(q[0],q[1],q[2])+p.radius)}return{key:f,nodes:M,plugins:y,created:l,local:A,radius:$,held:!0,centre:w}}const{local:x,radius:v}=He(M,ut(`turn:${f}`));return{key:f,nodes:M,plugins:y,created:l,local:x,radius:v,held:!1}});o.sort((f,M)=>f.created-M.created||(f.key<M.key?-1:f.key>M.key?1:0));const a=new Map;for(const f of o)for(const M of f.plugins)a.set(M,(a.get(M)??0)+1);const u=gn(a,o.length),h=Math.max(U,...o.map(f=>f.radius)),c=new Ve(2*h+ht),d=[];let g=0;const _=(f,M,y)=>{const l={particle:f,centre:y};d.push(l),c.add(l),g=Math.max(g,Math.hypot(y[0],y[1],y[2])+f.radius);for(const x of f.nodes){const v=f.local.get(x.id)??[0,0,0];i[x.id]=f.held&&x.seed!==void 0?x.seed:[y[0]+v[0],y[1]+v[1],y[2]+v[2]],r[x.id]=M}};return o.forEach((f,M)=>{f.held&&f.centre!==void 0&&_(f,M,f.centre)}),o.forEach((f,M)=>{if(f.held)return;const y=ut(`accrete:${f.key}`);let l;if(d.length===0)l=[0,0,0];else{let x=d[d.length-1],v=-1;for(const S of d){const q=tn(f.plugins,S.particle.plugins,u);q>=v&&(x=S,v=q)}const m=g+Ke*f.radius+h,w=Math.max(.5,f.radius*.5),A=st(y);let $=[A[0]*m,A[1]*m,A[2]*m],p=null;for(let S=0;S<We&&p===null;S++){const q=st(y),C=[x.centre[0]-$[0],x.centre[1]-$[1],x.centre[2]-$[2]],O=Math.max(1e-9,Math.hypot(C[0],C[1],C[2])),z=[q[0]*(1-at)+C[0]/O*at,q[1]*(1-at)+C[1]/O*at,q[2]*(1-at)+C[2]/O*at],k=[$[0]+z[0]*w,$[1]+z[1]*w,$[2]+z[2]*w],I=c.touching(k,f.radius);if(I.length===0){if(Math.hypot(k[0],k[1],k[2])>m*2){const T=st(y);$=[T[0]*m,T[1]*m,T[2]*m]}else $=k;continue}let N=I[0],E=-1;for(const T of I){const L=tn(f.plugins,T.particle.plugins,u);L>E&&(N=T,E=L)}if(y()<Math.max(Ye,E)&&(p=en(N,$,f.radius,y),c.touching(p,f.radius-1e-6).some(T=>T!==N&&_n(p,f.radius,T))&&(p=null)),p===null){const T=en(N,$,f.radius,y),L=[T[0]-N.centre[0],T[1]-N.centre[1],T[2]-N.centre[2]],R=Math.max(1e-9,Math.hypot(L[0],L[1],L[2]));$=[T[0]+L[0]/R*w,T[1]+L[1]/R*w,T[2]+L[2]/R*w]}}l=p??Ze(x,f.radius,c,y)}_(f,M,l),M%8===0&&e(M/Math.max(1,o.length))}),e(1),{positions:i,arrival:r}}function _n(t,n,e){return Math.hypot(t[0]-e.centre[0],t[1]-e.centre[1],t[2]-e.centre[2])<n+e.particle.radius+ht*.5}function Ze(t,n,e,i){for(let o=0;o<8;o++)for(let a=0;a<24;a++){const u=st(i),h=n+t.particle.radius+ht+o*n,c=[t.centre[0]+u[0]*h,t.centre[1]+u[1]*h,t.centre[2]+u[2]*h];if(!e.touching(c,n).some(d=>_n(c,n,d)))return c}const r=st(i),s=n+t.particle.radius+ht+8*n;return[t.centre[0]+r[0]*s,t.centre[1]+r[1]*s,t.centre[2]+r[2]*s]}function Je(t){const n=new Map(t.map(f=>[f.id,f])),e=new Map,i=(f,M)=>{const y=e.get(f.id);if(y!==void 0)return y;if(M.has(f.id)||f.parentIds.length===0)return e.set(f.id,0),0;M.add(f.id);let l=0;for(const x of f.parentIds){const v=n.get(x);v&&(l=Math.max(l,i(v,M)+1))}return e.set(f.id,l),l};for(const f of t)i(f,new Set);const r=new Map,s=[],o=(f,M)=>f.id.localeCompare(M.id,void 0,{numeric:!0});for(const f of t){const M=f.parentIds.find(l=>n.has(l));if(M===void 0){s.push(f);continue}const y=r.get(M)??[];y.push(f),r.set(M,y)}s.sort(o);for(const f of r.values())f.sort(o);const a=new Map;let u=0;const h=new Set,c=f=>{h.add(f.id);const M=(r.get(f.id)??[]).filter(v=>!h.has(v.id));if(M.length===0){const v=u++;return a.set(f.id,v),[v,v]}let y=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(const v of M){const[m,w]=c(v);y=Math.min(y,m),l=Math.max(l,w)}const x=(y+l)/2;return a.set(f.id,x),[y,l]};for(const f of s)c(f);for(const f of t)a.has(f.id)||c(f);const d=Math.max(...Array.from(e.values()),0)+1,g=Math.max(u-1,0);return{placements:t.map(f=>({id:f.id,x:a.get(f.id)??0,tier:e.get(f.id)??0})),width:g,tierCount:d}}const ti=2.6,ni=2;function ei(t){const n=t.map(s=>s.metric??0),e=Math.max(...n,0),i=Je(t),r=new Map(i.placements.map(s=>[s.id,s]));return t.map(s=>{const o=r.get(s.id),a=((o?.x??0)-i.width/2)*ni,u=((i.tierCount-1)/2-(o?.tier??0))*ti,h=s.metric??0,c=e>0?.55+h/e*1:1,d=[a,u,0];return{id:s.id,position:d,radius:U*c}})}function vt(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 xn(t){const n=t.attrs?.metric;return typeof n=="number"?n:void 0}function yn(t){const n={};for(const e of t)n[e.id]=e.position;return n}const ii={id:"galaxy",label:"GALAXY",needs:[],run:(t,n)=>({positions:dn(t.nodes.map(vt),t.physics,n)})},ri={id:"spokes",label:"SPOKES",needs:[],run:(t,n)=>({positions:Ft(t.nodes.map(vt),t.physics,n,"spokes")})},si={id:"clumps",label:"CLUMPS",needs:[],run:(t,n)=>({positions:Ft(t.nodes.map(vt),t.physics,n,"clumps")})},oi={id:"ranked",label:"RANKED",needs:[],run:(t,n)=>{const e=t.nodes.map(r=>{const s={id:r.id,parentIds:r.parents},o=xn(r);return o!==void 0&&(s.metric=o),s}),i=yn(ei(e));return n(1),{positions:i}}},ai={id:"molecule",label:"MOLECULE",needs:[],run:(t,n)=>{const e=t.nodes.map(o=>{const a={id:o.id,parents:o.parents},u=xn(o);return u!==void 0&&(a.metric=u),a}),i=new Map,r=new Set;for(const o of t.nodes)o.seed!==void 0&&i.set(o.id,o.seed),o.frozen===!0&&r.add(o.id);const s=yn(Ge(e,3,i,t.physics,r));return n(1),{positions:s}}},fi={id:"constellations",label:"CONSTELLATIONS",needs:["plugin"],run:(t,n)=>({positions:Ue(t.nodes,t.physics,n)})},ci={id:"hubs",label:"HUBS",needs:[],run:(t,n)=>({positions:dn(t.nodes.map(vt),t.physics,n)})},ui={id:"accretion",label:"ACCRETION",needs:["plugin"],run:(t,n)=>Qe(t.nodes,t.physics,n)},hi=[ii,ri,si,fi,ci,ui,oi,ai];function li(t){return hi.find(n=>n.id===t)}self.onmessage=t=>{const{generation:n,nodes:e,physics:i,arrangement:r}=t.data;let s=-1;const o=h=>{const c=Math.floor(h*100);c!==s&&(s=c,self.postMessage({generation:n,type:"progress",fraction:h}))},a=li(r);if(a===void 0){self.postMessage({generation:n,type:"failed",reason:`no layout engine named ${r}`});return}const{positions:u}=a.run({nodes:e,physics:i},o);self.postMessage({generation:n,type:"done",positions:u})};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-CEiEnrkY.js","./_commonjsHelpers-CE1G-McA.js","./index-bL2L8RXR.js","./index-CVUcpNtC.css"])))=>i.map(i=>d[i]);
2
- import{_ as h,b as u,I as c}from"./index-bL2L8RXR.js";const d={gray:"gray",hot:"hot",jet:"jet",cool:"cool"},m={wl:"contrast",pan:"pan",length:"measurement",angle:"angle"};class _{name="niivue";host;path;nv=null;module=null;layout="mpr";tool="wl";colormap="gray";slice=0;slices=0;refused=0;disposed=!1;constructor(s,t){this.host=s,this.path=t}async open(s){const t=document.createElement("canvas");t.className="image-canvas",s.appendChild(t),this.host.readout_set("LOADING"),this.host.progress_set({label:"READING VOLUME",done:0,total:0});const e=performance.now();if(this.module=await h(()=>import("./index-CEiEnrkY.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),this.disposed)return;const i=new this.module.Niivue({isResizeCanvas:!0,logLevel:"error",dragAndDropEnabled:!1,crosshairWidth:.4,crosshairWidthUnit:"percent"});i.onLocationChange=o=>{const r=o,l=r.vox?.[2];l!==void 0&&(this.slice=l+1),this.host.readout_set(`${this.slices>0?`SLICE ${this.slice} OF ${this.slices} · `:""}${r.string??""}`)},await i.attachToCanvas(t);const n=this.path.split("/").pop()??"volume.nii.gz";try{await i.loadVolumes([{url:u(this.host.source.url_of(this.path),location.href),name:n}])}catch(o){this.refused=1,this.host.progress_set(null),this.host.readout_set("REFUSED 1 OF 1"),this.host.note(`image: ${this.path}: ${o instanceof Error?o.message:String(o)}`);return}if(this.host.progress_set(null),this.disposed)return;this.nv=i;const a=i.volumes[0]?.dims;this.slices=a?.[3]??0,i.setSliceType(i.sliceTypeMultiplanar),this.layout="mpr",this.host.readout_set(`${this.slices} SLICES`),this.host.note(`image: ${n} drawn in ${Math.round(performance.now()-e)} ms`),this.host.regard(this.path)}async layout_set(s){return s==="slab"||this.nv===null?!1:(this.nv.setSliceType(s==="single"?this.nv.sliceTypeAxial:s==="mpr"?this.nv.sliceTypeMultiplanar:this.nv.sliceTypeRender),this.layout=s,this.host.readout_set(`${this.slices} SLICES`),!0)}slice_set(s){if(this.nv===null||this.slices===0)return!1;const t=Math.max(1,Math.min(s,this.slices)),e=this.slice>0?this.slice:Math.ceil(this.slices/2);return this.nv.moveCrosshairInVox(0,0,t-e),this.slice=t,!0}wl_set(s,t){const e=this.nv?.volumes[0];return this.nv===null||e===void 0?!1:(e.cal_min=s,e.cal_max=t,this.nv.updateGLVolume(),!0)}colormap_set(s){const t=this.nv?.volumes[0];return this.nv===null||t?.id===void 0?!1:(this.colormap=s,this.nv.setColormap(t.id,d[s]),!0)}toolsOffered_get(){return c}ghost_set(s){return!1}tool_set(s){const t=m[s];return this.nv===null||t===void 0?!1:(this.nv.setDragMode(t),this.tool=s,!0)}annotations_export(){return Promise.resolve(null)}annotations_import(){return Promise.resolve(0)}async slices_fill(){return this.nv!==null}state_get(){return{engine:"niivue",layout:this.layout,slice:this.slice,slices:this.slices,tool:this.tool,primaryTool:this.tool,refused:this.refused,annotations:0,filled:this.nv!==null,colormap:this.colormap}}dispose(){this.disposed=!0,this.nv=null}}export{_ as NiivueEngine};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-BjMVTIAp.js","./_commonjsHelpers-CE1G-McA.js","./index-D3RLyWos.js","./index-CVUcpNtC.css"])))=>i.map(i=>d[i]);
2
+ import{_ as h,b as u,I as c}from"./index-D3RLyWos.js";const d={gray:"gray",hot:"hot",jet:"jet",cool:"cool"},m={wl:"contrast",pan:"pan",length:"measurement",angle:"angle"};class _{name="niivue";host;path;nv=null;module=null;layout="mpr";tool="wl";colormap="gray";slice=0;slices=0;refused=0;disposed=!1;constructor(s,t){this.host=s,this.path=t}async open(s){const t=document.createElement("canvas");t.className="image-canvas",s.appendChild(t),this.host.readout_set("LOADING"),this.host.progress_set({label:"READING VOLUME",done:0,total:0});const e=performance.now();if(this.module=await h(()=>import("./index-BjMVTIAp.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),this.disposed)return;const i=new this.module.Niivue({isResizeCanvas:!0,logLevel:"error",dragAndDropEnabled:!1,crosshairWidth:.4,crosshairWidthUnit:"percent"});i.onLocationChange=o=>{const r=o,l=r.vox?.[2];l!==void 0&&(this.slice=l+1),this.host.readout_set(`${this.slices>0?`SLICE ${this.slice} OF ${this.slices} · `:""}${r.string??""}`)},await i.attachToCanvas(t);const n=this.path.split("/").pop()??"volume.nii.gz";try{await i.loadVolumes([{url:u(this.host.source.url_of(this.path),location.href),name:n}])}catch(o){this.refused=1,this.host.progress_set(null),this.host.readout_set("REFUSED 1 OF 1"),this.host.note(`image: ${this.path}: ${o instanceof Error?o.message:String(o)}`);return}if(this.host.progress_set(null),this.disposed)return;this.nv=i;const a=i.volumes[0]?.dims;this.slices=a?.[3]??0,i.setSliceType(i.sliceTypeMultiplanar),this.layout="mpr",this.host.readout_set(`${this.slices} SLICES`),this.host.note(`image: ${n} drawn in ${Math.round(performance.now()-e)} ms`),this.host.regard(this.path)}async layout_set(s){return s==="slab"||this.nv===null?!1:(this.nv.setSliceType(s==="single"?this.nv.sliceTypeAxial:s==="mpr"?this.nv.sliceTypeMultiplanar:this.nv.sliceTypeRender),this.layout=s,this.host.readout_set(`${this.slices} SLICES`),!0)}slice_set(s){if(this.nv===null||this.slices===0)return!1;const t=Math.max(1,Math.min(s,this.slices)),e=this.slice>0?this.slice:Math.ceil(this.slices/2);return this.nv.moveCrosshairInVox(0,0,t-e),this.slice=t,!0}wl_set(s,t){const e=this.nv?.volumes[0];return this.nv===null||e===void 0?!1:(e.cal_min=s,e.cal_max=t,this.nv.updateGLVolume(),!0)}colormap_set(s){const t=this.nv?.volumes[0];return this.nv===null||t?.id===void 0?!1:(this.colormap=s,this.nv.setColormap(t.id,d[s]),!0)}toolsOffered_get(){return c}ghost_set(s){return!1}tool_set(s){const t=m[s];return this.nv===null||t===void 0?!1:(this.nv.setDragMode(t),this.tool=s,!0)}annotations_export(){return Promise.resolve(null)}annotations_import(){return Promise.resolve(0)}async slices_fill(){return this.nv!==null}state_get(){return{engine:"niivue",layout:this.layout,slice:this.slice,slices:this.slices,tool:this.tool,primaryTool:this.tool,refused:this.refused,annotations:0,filled:this.nv!==null,colormap:this.colormap}}dispose(){this.disposed=!0,this.nv=null}}export{_ as NiivueEngine};
@@ -1,4 +1,4 @@
1
- import{m as v,as as _e,R as ft,K as Ge,L as Le,W as ke,N as We,k as de,E as X,t as vt,i as Me,x as ce,F as ht,Z as St,h as dt,D as Tt,al as wt,c as yt,at as Ct,d as Ve,au as xt,y as ue,ak as le,av as ze,j as pe}from"./cornerstoneEngine-56y7wcWv.js";import{ae as Ne,am as De,an as re,K as B,k as Z,al as $,D as se,U as $e,X as Be,B as Q,J as Et,E as Rt,ak as _t,$ as He,a2 as Mt,Z as Vt,b as Dt,_ as Ke,ao as Bt,ap as be,aq as mt,ar as Te,as as Ot,z as Ut,at as Ft,au as Pt,av as ae,ad as Gt,R as Lt,aw as Y,ah as kt,ai as Wt,C as zt,P as Nt,I as $t,a as Ht}from"./Texture-CNw8sdIb.js";import"./index-bL2L8RXR.js";import"./_commonjsHelpers-CE1G-McA.js";function Kt(t){return t}function ye(t){if(t===null||t==="null")return null;if(t==="true")return!0;if(t==="false")return!1;if(!(t===void 0||t==="undefined"))return t[0]==="["&&t[t.length-1]==="]"?t.substring(1,t.length-1).split(",").map(e=>ye(e.trim())):t===""||Number.isNaN(Number(t))?t:Number(t)}function bt(t=!0,e=window.location.search){const r={},s=t?ye:Kt;return new URLSearchParams(e).forEach((n,a)=>{a&&(r[a]=n?s(n):!0)}),r}var It={toNativeType:ye,extractURLParameters:bt},jt={IS_START:0,IS_NONE:0,IS_ROTATE:1,IS_PAN:2,IS_SPIN:3,IS_DOLLY:4,IS_CAMERA_POSE:11,IS_WINDOW_LEVEL:1024,IS_SLICE:1025},Ce={States:jt},{vtkErrorMacro:Qt,VOID:Yt}=v;function Xt(t,e,r,s){return t.getRenderWindow().getViews()[0].worldToDisplay(e,r,s,t)}function Zt(t,e,r,s){return t.getRenderWindow().getViews()[0].displayToWorld(e,r,s,t)}var Jt={computeWorldToDisplay:Xt,computeDisplayToWorld:Zt};function qt(t,e){e.classHierarchy.push("vtkInteractorObserver");const r={...t};function s(){for(;e.subscribedEvents.length;)e.subscribedEvents.pop().unsubscribe()}function n(){Ne.handledEvents.forEach(a=>{t[`handle${a}`]&&e.subscribedEvents.push(e._interactor[`on${a}`](o=>e.processEvents?t[`handle${a}`](o):Yt,e.priority))})}t.setInteractor=a=>{a!==e._interactor&&(s(),e._interactor=a,a&&e.enabled&&n(),t.modified())},t.setEnabled=a=>{a!==e.enabled&&(s(),a&&(e._interactor?n():Qt(`
1
+ import{m as v,as as _e,R as ft,K as Ge,L as Le,W as ke,N as We,k as de,E as X,t as vt,i as Me,x as ce,F as ht,Z as St,h as dt,D as Tt,al as wt,c as yt,at as Ct,d as Ve,au as xt,y as ue,ak as le,av as ze,j as pe}from"./cornerstoneEngine-BIu8DPDK.js";import{ae as Ne,am as De,an as re,K as B,k as Z,al as $,D as se,U as $e,X as Be,B as Q,J as Et,E as Rt,ak as _t,$ as He,a2 as Mt,Z as Vt,b as Dt,_ as Ke,ao as Bt,ap as be,aq as mt,ar as Te,as as Ot,z as Ut,at as Ft,au as Pt,av as ae,ad as Gt,R as Lt,aw as Y,ah as kt,ai as Wt,C as zt,P as Nt,I as $t,a as Ht}from"./Texture-B-lj_eg9.js";import"./index-D3RLyWos.js";import"./_commonjsHelpers-CE1G-McA.js";function Kt(t){return t}function ye(t){if(t===null||t==="null")return null;if(t==="true")return!0;if(t==="false")return!1;if(!(t===void 0||t==="undefined"))return t[0]==="["&&t[t.length-1]==="]"?t.substring(1,t.length-1).split(",").map(e=>ye(e.trim())):t===""||Number.isNaN(Number(t))?t:Number(t)}function bt(t=!0,e=window.location.search){const r={},s=t?ye:Kt;return new URLSearchParams(e).forEach((n,a)=>{a&&(r[a]=n?s(n):!0)}),r}var It={toNativeType:ye,extractURLParameters:bt},jt={IS_START:0,IS_NONE:0,IS_ROTATE:1,IS_PAN:2,IS_SPIN:3,IS_DOLLY:4,IS_CAMERA_POSE:11,IS_WINDOW_LEVEL:1024,IS_SLICE:1025},Ce={States:jt},{vtkErrorMacro:Qt,VOID:Yt}=v;function Xt(t,e,r,s){return t.getRenderWindow().getViews()[0].worldToDisplay(e,r,s,t)}function Zt(t,e,r,s){return t.getRenderWindow().getViews()[0].displayToWorld(e,r,s,t)}var Jt={computeWorldToDisplay:Xt,computeDisplayToWorld:Zt};function qt(t,e){e.classHierarchy.push("vtkInteractorObserver");const r={...t};function s(){for(;e.subscribedEvents.length;)e.subscribedEvents.pop().unsubscribe()}function n(){Ne.handledEvents.forEach(a=>{t[`handle${a}`]&&e.subscribedEvents.push(e._interactor[`on${a}`](o=>e.processEvents?t[`handle${a}`](o):Yt,e.priority))})}t.setInteractor=a=>{a!==e._interactor&&(s(),e._interactor=a,a&&e.enabled&&n(),t.modified())},t.setEnabled=a=>{a!==e.enabled&&(s(),a&&(e._interactor?n():Qt(`
2
2
  The interactor must be set before subscribing to events
3
3
  `)),e.enabled=a,t.modified())},t.computeDisplayToWorld=(a,o,i,u)=>a?e._interactor.getView().displayToWorld(o,i,u,a):null,t.computeWorldToDisplay=(a,o,i,u)=>a?e._interactor.getView().worldToDisplay(o,i,u,a):null,t.setPriority=a=>{r.setPriority(a)&&e._interactor&&(s(),n())}}var At={enabled:!0,priority:0,processEvents:!0,subscribedEvents:[]};function Ie(t,e,r={}){Object.assign(e,At,r),v.obj(t,e),v.event(t,e,"InteractionEvent"),v.event(t,e,"StartInteractionEvent"),v.event(t,e,"EndInteractionEvent"),v.get(t,e,["_interactor","enabled"]),v.setGet(t,e,["priority","processEvents"]),v.moveToProtected(t,e,["interactor"]),qt(t,e)}var en=v.newInstance(Ie,"vtkInteractorObserver"),tn={newInstance:en,extend:Ie,...Jt},{States:N}=Ce,ge={Rotate:N.IS_ROTATE,Pan:N.IS_PAN,Spin:N.IS_SPIN,Dolly:N.IS_DOLLY,CameraPose:N.IS_CAMERA_POSE,WindowLevel:N.IS_WINDOW_LEVEL,Slice:N.IS_SLICE};function nn(t,e){e.classHierarchy.push("vtkInteractorStyle"),Object.keys(ge).forEach(r=>{v.event(t,e,`Start${r}Event`),t[`start${r}`]=()=>{e.state===N.IS_NONE&&(e.state=ge[r],e._interactor.requestAnimation(t),t.invokeStartInteractionEvent({type:"StartInteractionEvent"}),t[`invokeStart${r}Event`]({type:`Start${r}Event`}))},v.event(t,e,`End${r}Event`),t[`end${r}`]=()=>{e.state===ge[r]&&(e.state=N.IS_NONE,e._interactor.cancelAnimation(t),t.invokeEndInteractionEvent({type:"EndInteractionEvent"}),t[`invokeEnd${r}Event`]({type:`End${r}Event`}),e._interactor.render())}}),e.getRenderer=r=>e.focusedRenderer||r.pokedRenderer,t.handleKeyPress=r=>{const s=e._interactor;let n=null;switch(r.key){case"r":case"R":e.getRenderer(r).resetCamera(),s.render();break;case"w":case"W":n=e.getRenderer(r).getActors(),n.forEach(a=>{const o=a.getProperty();o.setRepresentationToWireframe&&o.setRepresentationToWireframe()}),s.render();break;case"s":case"S":n=e.getRenderer(r).getActors(),n.forEach(a=>{const o=a.getProperty();o.setRepresentationToSurface&&o.setRepresentationToSurface()}),s.render();break;case"v":case"V":n=e.getRenderer(r).getActors(),n.forEach(a=>{const o=a.getProperty();o.setRepresentationToPoints&&o.setRepresentationToPoints()}),s.render();break}}}var rn={state:N.IS_NONE,handleObservers:1,autoAdjustCameraClippingRange:1};function je(t,e,r={}){Object.assign(e,rn,r),tn.extend(t,e,r),v.setGet(t,e,["focusedRenderer"]),nn(t,e)}var an=v.newInstance(je,"vtkInteractorStyle"),xe={newInstance:an,extend:je,...Ce},{States:W}=Ce;function sn(t,e){e.classHierarchy.push("vtkInteractorStyleTrackballCamera"),t.handleMouseMove=r=>{const s=r.position,n=e.getRenderer(r);switch(e.state){case W.IS_ROTATE:t.handleMouseRotate(n,s),t.invokeInteractionEvent({type:"InteractionEvent"});break;case W.IS_PAN:t.handleMousePan(n,s),t.invokeInteractionEvent({type:"InteractionEvent"});break;case W.IS_DOLLY:e.wheelDolly||(t.handleMouseDolly(n,s),t.invokeInteractionEvent({type:"InteractionEvent"}));break;case W.IS_SPIN:t.handleMouseSpin(n,s),t.invokeInteractionEvent({type:"InteractionEvent"});break}e.previousPosition=s},t.handleButton3D=r=>{if(r&&r.pressed&&r.device===De.RightController&&(r.input===re.Trigger||r.input===re.TrackPad)){t.startCameraPose();return}r&&!r.pressed&&r.device===De.RightController&&(r.input===re.Trigger||r.input===re.TrackPad)&&e.state===W.IS_CAMERA_POSE&&t.endCameraPose()},t.handleMove3D=r=>{e.state===W.IS_CAMERA_POSE&&t.updateCameraPose(r)},t.updateCameraPose=r=>{const s=e.getRenderer(r).getActiveCamera(),n=s.getPhysicalTranslation(),a=.5*.05*s.getPhysicalScale(),o=s.physicalOrientationToWorldDirection([r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w]);s.setPhysicalTranslation(n[0]+o[0]*a,n[1]+o[1]*a,n[2]+o[2]*a)},t.handleLeftButtonPress=r=>{e.previousPosition=r.position,r.shiftKey?r.controlKey||r.altKey?t.startDolly():t.startPan():r.controlKey||r.altKey?t.startSpin():t.startRotate()},t.handleLeftButtonRelease=()=>{switch(e.state){case W.IS_DOLLY:t.endDolly();break;case W.IS_PAN:t.endPan();break;case W.IS_SPIN:t.endSpin();break;case W.IS_ROTATE:t.endRotate();break}},t.handleStartMouseWheel=()=>{e.wheelDolly=!0,t.startDolly()},t.handleEndMouseWheel=()=>{t.endDolly(),e.wheelDolly=!1},t.handleStartPinch=r=>{e.previousScale=r.scale,t.startDolly()},t.handleEndPinch=()=>{t.endDolly()},t.handleStartRotate=r=>{e.previousRotation=r.rotation,t.startRotate()},t.handleEndRotate=()=>{t.endRotate()},t.handleStartPan=r=>{e.previousTranslation=r.translation,t.startPan()},t.handleEndPan=()=>{t.endPan()},t.handlePinch=r=>{t.dollyByFactor(e.getRenderer(r),r.scale/e.previousScale),e.previousScale=r.scale},t.handlePan=r=>{const s=e.getRenderer(r).getActiveCamera();let n=s.getFocalPoint();n=t.computeWorldToDisplay(e.getRenderer(r),n[0],n[1],n[2]);const a=n[2],o=r.translation,i=e.previousTranslation,u=t.computeDisplayToWorld(e.getRenderer(r),n[0]+o[0]-i[0],n[1]+o[1]-i[1],a),p=t.computeDisplayToWorld(e.getRenderer(r),n[0],n[1],a),c=[];c[0]=p[0]-u[0],c[1]=p[1]-u[1],c[2]=p[2]-u[2],n=s.getFocalPoint();const l=s.getPosition();s.setFocalPoint(c[0]+n[0],c[1]+n[1],c[2]+n[2]),s.setPosition(c[0]+l[0],c[1]+l[1],c[2]+l[2]),e._interactor.getLightFollowCamera()&&e.getRenderer(r).updateLightsGeometryToFollowCamera(),s.orthogonalizeViewUp(),e.previousTranslation=r.translation},t.handleRotate=r=>{const s=e.getRenderer(r).getActiveCamera();s.roll(r.rotation-e.previousRotation),s.orthogonalizeViewUp(),e.previousRotation=r.rotation},t.handleMouseRotate=(r,s)=>{if(!e.previousPosition)return;const n=e._interactor,a=s.x-e.previousPosition.x,o=s.y-e.previousPosition.y,i=n.getView().getViewportSize(r);let u=-.1,p=-.1;i[0]&&i[1]&&(u=-20/i[1],p=-20/i[0]);const c=a*p*e.motionFactor,l=o*u*e.motionFactor,g=r.getActiveCamera();!Number.isNaN(c)&&!Number.isNaN(l)&&(g.azimuth(c),g.elevation(l),g.orthogonalizeViewUp()),e.autoAdjustCameraClippingRange&&r.resetCameraClippingRange(),n.getLightFollowCamera()&&r.updateLightsGeometryToFollowCamera()},t.handleMouseSpin=(r,s)=>{if(!e.previousPosition)return;const n=e._interactor,a=r.getActiveCamera(),o=n.getView().getViewportCenter(r),i=_e(Math.atan2(e.previousPosition.y-o[1],e.previousPosition.x-o[0])),u=_e(Math.atan2(s.y-o[1],s.x-o[0]))-i;Number.isNaN(u)||(a.roll(u),a.orthogonalizeViewUp())},t.handleMousePan=(r,s)=>{if(!e.previousPosition)return;const n=r.getActiveCamera();let a=n.getFocalPoint();a=t.computeWorldToDisplay(r,a[0],a[1],a[2]);const o=a[2],i=t.computeDisplayToWorld(r,s.x,s.y,o),u=t.computeDisplayToWorld(r,e.previousPosition.x,e.previousPosition.y,o),p=[];p[0]=u[0]-i[0],p[1]=u[1]-i[1],p[2]=u[2]-i[2],a=n.getFocalPoint();const c=n.getPosition();n.setFocalPoint(p[0]+a[0],p[1]+a[1],p[2]+a[2]),n.setPosition(p[0]+c[0],p[1]+c[1],p[2]+c[2]),e._interactor.getLightFollowCamera()&&r.updateLightsGeometryToFollowCamera()},t.handleMouseDolly=(r,s)=>{if(!e.previousPosition)return;const n=s.y-e.previousPosition.y,a=e._interactor.getView().getViewportCenter(r),o=e.motionFactor*n/a[1];t.dollyByFactor(r,1.1**o)},t.handleMouseWheel=r=>{const s=1-r.spinY/e.zoomFactor;t.dollyByFactor(e.getRenderer(r),s)},t.dollyByFactor=(r,s)=>{if(Number.isNaN(s))return;const n=r.getActiveCamera();n.getParallelProjection()?n.setParallelScale(n.getParallelScale()/s):(n.dolly(s),e.autoAdjustCameraClippingRange&&r.resetCameraClippingRange()),e._interactor.getLightFollowCamera()&&r.updateLightsGeometryToFollowCamera()}}var on={motionFactor:10,zoomFactor:10,wheelDolly:!1};function Qe(t,e,r={}){Object.assign(e,on,r),xe.extend(t,e,r),v.setGet(t,e,["motionFactor","zoomFactor"]),sn(t,e)}var cn=v.newInstance(Qe,"vtkInteractorStyleTrackballCamera"),un={newInstance:cn,extend:Qe},{vtkErrorMacro:ln}=ft,fe=["setBindGroup","setIndexBuffer","setVertexBuffer","draw","drawIndexed"];function pn(t,e){e.classHierarchy.push("vtkWebGPURenderEncoder"),t.begin=r=>{e.drawCallbacks=[],e.handle=r.beginRenderPass(e.description),e.label&&e.handle.pushDebugGroup(e.label)},t.end=()=>{for(let r=0;r<e.drawCallbacks.length;r++){const s=e.drawCallbacks[r],n=s.pipeline;t.setPipeline(n);for(let a=0;a<s.callbacks.length;a++)s.callbacks[a](t)}e.label&&e.handle.popDebugGroup(),e.handle.end(),e.boundPipeline=null},t.setPipeline=r=>{if(e.boundPipeline===r)return;e.handle.setPipeline(r.getHandle());const s=r.getPipelineDescription(),n=s.fragment?.targets;if(e.colorTextureViews.length!==n.length)console.log(`mismatched attachment counts on pipeline ${n.length} while encoder has ${e.colorTextureViews.length}`),console.trace();else for(let a=0;a<e.colorTextureViews.length;a++){const o=e.colorTextureViews[a].getTexture()?.getFormat();o&&o!==n[a].format&&(console.log(`mismatched attachments for attachment ${a} on pipeline ${n[a].format} while encoder has ${o}`),console.trace())}if(!!e.depthTextureView!="depthStencil"in s)console.log("mismatched depth attachments"),console.trace();else if(e.depthTextureView){const a=e.depthTextureView.getTexture()?.getFormat();a&&a!==s.depthStencil.format&&(console.log(`mismatched depth attachments on pipeline ${s.depthStencil.format} while encoder has ${a}`),console.trace())}e.boundPipeline=r},t.replaceShaderCode=r=>{e.replaceShaderCodeFunction(r)},t.setColorTextureView=(r,s)=>{e.colorTextureViews[r]!==s&&(e.colorTextureViews[r]=s)},t.activateBindGroup=r=>{const s=e.boundPipeline.getDevice(),n=e.boundPipeline.getBindGroupLayoutIndex(r.getLabel());if(n<0){ln(`vtkWebGPURenderEncoder: could not find bind group layout ${r.getLabel()}`);return}e.handle.setBindGroup(n,r.getBindGroup(s));const a=s.getBindGroupLayoutDescription(r.getBindGroupLayout(s)),o=s.getBindGroupLayoutDescription(e.boundPipeline.getBindGroupLayout(n));a!==o&&(console.log(`renderEncoder ${e.pipelineHash} mismatched bind group layouts bind group has
4
4
  ${a}
package/dist/index.html CHANGED
@@ -12,7 +12,7 @@
12
12
  href="https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap"
13
13
  rel="stylesheet"
14
14
  />
15
- <script type="module" crossorigin src="./assets/index-bL2L8RXR.js"></script>
15
+ <script type="module" crossorigin src="./assets/index-D3RLyWos.js"></script>
16
16
  <link rel="stylesheet" crossorigin href="./assets/index-CVUcpNtC.css">
17
17
  </head>
18
18
  <body>
@@ -308,9 +308,11 @@
308
308
  <button class="strategy-pill universe-view" title="every feed its own molecule, or the shapes folded to one molecule each">FEEDS</button>
309
309
  <button class="strategy-pill universe-scale" title="what sizes a sphere: its jobs (log scale) or nothing, every sphere alike">JOBS</button>
310
310
  <button class="strategy-pill universe-density" title="a stage as one sphere with its count (SHAPE), or every job as its own point (CENSUS)">SHAPE</button>
311
- <button class="strategy-pill universe-arrangement" title="the space's own emergent shape (GALAXY), each feed a spoke from its shape's hub (SPOKES), or the feeds packed round it (CLUMPS)">GALAXY</button>
311
+ <button class="strategy-pill universe-arrangement" title="the space's own emergent shape (GALAXY), each feed a spoke from its shape's hub (SPOKES), packed round it (CLUMPS), pulled to the plugin stars it ran (CONSTELLATIONS), hung from what it began from (DATA), or grown in the order it was made, kin sticking to kin (ACCRETION)">GALAXY</button>
312
312
  <button class="strategy-pill universe-draw" title="every sphere a point of light (STARS), or lit and solid (SPHERES); a feed you enter is always solid">STARS</button>
313
+ <button class="strategy-pill universe-captions" title="the hubs' words over the picture — what each is and how many feeds it holds (universe captions on|off)">CAPTIONS ON</button>
313
314
  <button class="strategy-pill universe-gravity" title="mass-weighted centring: what gathers the clusters (a knob for play; universe physics … by word)">GRAVITY ON</button>
315
+ <button class="strategy-pill universe-replay rail-off" title="the space's history, feed by feed in the order they were made (universe replay [speed]|pause|stop|at &lt;date&gt;; Esc stops)">REPLAY</button>
314
316
  <button class="strategy-pill universe-refresh" title="ask the session for the space again">REFRESH</button>
315
317
  <button class="strategy-pill universe-open" title="this feed in a RUNS pane of its own">OPEN FEED</button>
316
318
  <button class="strategy-pill universe-back" title="climb out to the whole space (Esc)">BACK</button>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fnndsc/argus",
3
- "version": "0.16.5",
3
+ "version": "0.18.0",
4
4
  "description": "ARGUS: the LCARS web surface for mise — a browser console over a calypso session",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -20,7 +20,7 @@
20
20
  "@cornerstonejs/metadata": "^5.8.2",
21
21
  "@cornerstonejs/tools": "^5.8.2",
22
22
  "@cornerstonejs/utils": "^5.8.2",
23
- "@fnndsc/menu": "^0.11.0",
23
+ "@fnndsc/menu": "^0.13.0",
24
24
  "@kitware/vtk.js": "^36.4.1",
25
25
  "@niivue/niivue": "^0.69.0",
26
26
  "@types/three": "^0.185.4",
@@ -32,7 +32,7 @@
32
32
  "three": "^0.185.1"
33
33
  },
34
34
  "devDependencies": {
35
- "@fnndsc/orrery": "0.1.0",
35
+ "@fnndsc/orrery": "0.2.0",
36
36
  "@types/jest": "^30.0.0",
37
37
  "jest": "^30.2.0",
38
38
  "jest-environment-jsdom": "^30.2.0",