xcode-graph 0.1.1 → 0.2.1
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/README.md +266 -44
- package/custom-elements.json +902 -427
- package/dist/chunk.js +14 -0
- package/dist/elk-api.js +196 -0
- package/dist/elk-worker.js +24 -0
- package/dist/graph.types.js +23 -0
- package/dist/micro-layout.worker.js +1 -0
- package/dist/xcode-graph.service.js +2787 -4878
- package/dist/xcodegraph.js +19712 -1
- package/package.json +32 -49
- package/vscode.css-custom-data.json +0 -5
- package/vscode.html-custom-data.json +10 -20
- package/web-types.json +23 -46
- package/dist/elk.bundled.js +0 -6700
- package/dist/flow.js +0 -883
- package/dist/xcode-graph.js +0 -17150
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var e;
|
|
2
|
+
(function(e) {
|
|
3
|
+
e.App = "app", e.Framework = "framework", e.Library = "library", e.TestUnit = "test-unit", e.TestUi = "test-ui", e.Cli = "cli", e.Package = "package";
|
|
4
|
+
})(e ||= {});
|
|
5
|
+
var t;
|
|
6
|
+
(function(e) {
|
|
7
|
+
e.iOS = "iOS", e.macOS = "macOS", e.visionOS = "visionOS", e.tvOS = "tvOS", e.watchOS = "watchOS";
|
|
8
|
+
})(t ||= {});
|
|
9
|
+
var n;
|
|
10
|
+
(function(e) {
|
|
11
|
+
e.Local = "local", e.External = "external";
|
|
12
|
+
})(n ||= {});
|
|
13
|
+
var r;
|
|
14
|
+
(function(e) {
|
|
15
|
+
e.Target = "target", e.Project = "project", e.Sdk = "sdk", e.XCFramework = "xcframework";
|
|
16
|
+
})(r ||= {});
|
|
17
|
+
var i;
|
|
18
|
+
(function(e) {
|
|
19
|
+
e.Local = "local", e.Registry = "registry", e.Git = "git";
|
|
20
|
+
})(i ||= {});
|
|
21
|
+
const a = Object.values(e), o = Object.values(t), s = Object.values(n);
|
|
22
|
+
Object.values(i);
|
|
23
|
+
export { n as a, i as c, s as i, a as n, o, e as r, t as s, r as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e;(function(e){e.Entry=`entry`,e.InternalFramework=`internal-framework`,e.InternalLib=`internal-lib`,e.Utility=`utility`,e.Test=`test`,e.Tool=`tool`})(e||={});var t;(function(e){e.Project=`project`,e.Package=`package`})(t||={});var n;(function(e){e.Inherit=`INHERIT`,e.IncludeChildren=`INCLUDE_CHILDREN`,e.SeparateChildren=`SEPARATE_CHILDREN`})(n||={}),Object.values(e),Object.values(t);function r(e,t){var n,r=1;e??=0,t??=0;function i(){var i,a=n.length,o,s=0,c=0;for(i=0;i<a;++i)o=n[i],s+=o.x,c+=o.y;for(s=(s/a-e)*r,c=(c/a-t)*r,i=0;i<a;++i)o=n[i],o.x-=s,o.y-=c}return i.initialize=function(e){n=e},i.x=function(t){return arguments.length?(e=+t,i):e},i.y=function(e){return arguments.length?(t=+e,i):t},i.strength=function(e){return arguments.length?(r=+e,i):r},i}function i(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return a(this.cover(t,n),t,n,e)}function a(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,a=e._root,o={data:r},s=e._x0,c=e._y0,l=e._x1,u=e._y1,d,f,p,m,h,g,_,v;if(!a)return e._root=o,e;for(;a.length;)if((h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f,i=a,!(a=a[_=g<<1|h]))return i[_]=o,e;if(p=+e._x.call(null,a.data),m=+e._y.call(null,a.data),t===p&&n===m)return o.next=a,i?i[_]=o:e._root=o,e;do i=i?i[_]=[,,,,]:e._root=[,,,,],(h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f;while((_=g<<1|h)==(v=(m>=f)<<1|p>=d));return i[v]=a,i[_]=o,e}function o(e){var t,n,r=e.length,i,o,s=Array(r),c=Array(r),l=1/0,u=1/0,d=-1/0,f=-1/0;for(n=0;n<r;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(o=+this._y.call(null,t))||(s[n]=i,c[n]=o,i<l&&(l=i),i>d&&(d=i),o<u&&(u=o),o>f&&(f=o));if(l>d||u>f)return this;for(this.cover(l,u).cover(d,f),n=0;n<r;++n)a(this,s[n],c[n],e[n]);return this}function s(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,a=(r=Math.floor(t))+1;else{for(var o=i-n||1,s=this._root,c,l;n>e||e>=i||r>t||t>=a;)switch(l=(t<r)<<1|e<n,c=[,,,,],c[l]=s,s=c,o*=2,l){case 0:i=n+o,a=r+o;break;case 1:n=i-o,a=r+o;break;case 2:i=n+o,r=a-o;break;case 3:n=i-o,r=a-o;break}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this}function c(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function l(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function u(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}function d(e,t,n){var r,i=this._x0,a=this._y0,o,s,c,l,d=this._x1,f=this._y1,p=[],m=this._root,h,g;for(m&&p.push(new u(m,i,a,d,f)),n==null?n=1/0:(i=e-n,a=t-n,d=e+n,f=t+n,n*=n);h=p.pop();)if(!(!(m=h.node)||(o=h.x0)>d||(s=h.y0)>f||(c=h.x1)<i||(l=h.y1)<a))if(m.length){var _=(o+c)/2,v=(s+l)/2;p.push(new u(m[3],_,v,c,l),new u(m[2],o,v,_,l),new u(m[1],_,s,c,v),new u(m[0],o,s,_,v)),(g=(t>=v)<<1|e>=_)&&(h=p[p.length-1],p[p.length-1]=p[p.length-1-g],p[p.length-1-g]=h)}else{var y=e-+this._x.call(null,m.data),b=t-+this._y.call(null,m.data),x=y*y+b*b;if(x<n){var S=Math.sqrt(n=x);i=e-S,a=t-S,d=e+S,f=t+S,r=m.data}}return r}function f(e){if(isNaN(u=+this._x.call(null,e))||isNaN(d=+this._y.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._y0,c=this._x1,l=this._y1,u,d,f,p,m,h,g,_;if(!n)return this;if(n.length)for(;;){if((m=u>=(f=(o+c)/2))?o=f:c=f,(h=d>=(p=(s+l)/2))?s=p:l=p,t=n,!(n=n[g=h<<1|m]))return this;if(!n.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(r=t,_=g)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[g]=a:delete t[g],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[_]=n:this._root=n),this):(this._root=a,this)}function p(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function m(){return this._root}function h(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function g(e){var t=[],n,r=this._root,i,a,o,s,c;for(r&&t.push(new u(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.y0,s=n.x1,c=n.y1)&&r.length){var l=(a+s)/2,d=(o+c)/2;(i=r[3])&&t.push(new u(i,l,d,s,c)),(i=r[2])&&t.push(new u(i,a,d,l,c)),(i=r[1])&&t.push(new u(i,l,o,s,d)),(i=r[0])&&t.push(new u(i,a,o,l,d))}return this}function _(e){var t=[],n=[],r;for(this._root&&t.push(new u(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,c=r.x1,l=r.y1,d=(o+c)/2,f=(s+l)/2;(a=i[0])&&t.push(new u(a,o,s,d,f)),(a=i[1])&&t.push(new u(a,d,s,c,f)),(a=i[2])&&t.push(new u(a,o,f,d,l)),(a=i[3])&&t.push(new u(a,d,f,c,l))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function v(e){return e[0]}function y(e){return arguments.length?(this._x=e,this):this._x}function b(e){return e[1]}function x(e){return arguments.length?(this._y=e,this):this._y}function S(e,t,n){var r=new C(t??v,n??b,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function C(e,t,n,r,i,a){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function w(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var T=S.prototype=C.prototype;T.copy=function(){var e=new C(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=w(t),e;for(n=[{source:t,target:e._root=[,,,,]}];t=n.pop();)for(var i=0;i<4;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=[,,,,]}):t.target[i]=w(r));return e},T.add=i,T.addAll=o,T.cover=s,T.data=c,T.extent=l,T.find=d,T.remove=f,T.removeAll=p,T.root=m,T.size=h,T.visit=g,T.visitAfter=_,T.x=y,T.y=x;function E(e){return function(){return e}}function D(e){return(e()-.5)*1e-6}function ee(e){return e.x+e.vx}function te(e){return e.y+e.vy}function O(e){var t,n,r,i=1,a=1;typeof e!=`function`&&(e=E(e==null?1:+e));function o(){for(var e,o=t.length,c,l,u,d,f,p,m=0;m<a;++m)for(c=S(t,ee,te).visitAfter(s),e=0;e<o;++e)l=t[e],f=n[l.index],p=f*f,u=l.x+l.vx,d=l.y+l.vy,c.visit(h);function h(e,t,n,a,o){var s=e.data,c=e.r,m=f+c;if(s){if(s.index>l.index){var h=u-s.x-s.vx,g=d-s.y-s.vy,_=h*h+g*g;_<m*m&&(h===0&&(h=D(r),_+=h*h),g===0&&(g=D(r),_+=g*g),_=(m-(_=Math.sqrt(_)))/_*i,l.vx+=(h*=_)*(m=(c*=c)/(p+c)),l.vy+=(g*=_)*m,s.vx-=h*(m=1-m),s.vy-=g*m)}return}return t>u+m||a<u-m||n>d+m||o<d-m}}function s(e){if(e.data)return e.r=n[e.data.index];for(var t=e.r=0;t<4;++t)e[t]&&e[t].r>e.r&&(e.r=e[t].r)}function c(){if(t){var r,i=t.length,a;for(n=Array(i),r=0;r<i;++r)a=t[r],n[a.index]=+e(a,r,t)}}return o.initialize=function(e,n){t=e,r=n,c()},o.iterations=function(e){return arguments.length?(a=+e,o):a},o.strength=function(e){return arguments.length?(i=+e,o):i},o.radius=function(t){return arguments.length?(e=typeof t==`function`?t:E(+t),c(),o):e},o}var k={value:()=>{}};function A(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new j(n)}function j(e){this._=e}function M(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}j.prototype=A.prototype={constructor:j,on:function(e,t){var n=this._,r=M(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=N(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=P(n[i],e.name,t);else if(t==null)for(i in n)n[i]=P(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new j(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function N(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function P(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=k,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var F=0,I=0,L=0,R=1e3,z,B,V=0,H=0,U=0,W=typeof performance==`object`&&performance.now?performance:Date,G=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function K(){return H||=(G(ne),W.now()+U)}function ne(){H=0}function q(){this._call=this._time=this._next=null}q.prototype=J.prototype={constructor:q,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?K():+n)+(t==null?0:+t),!this._next&&B!==this&&(B?B._next=this:z=this,B=this),this._call=e,this._time=n,X()},stop:function(){this._call&&(this._call=null,this._time=1/0,X())}};function J(e,t,n){var r=new q;return r.restart(e,t,n),r}function re(){K(),++F;for(var e=z,t;e;)(t=H-e._time)>=0&&e._call.call(void 0,t),e=e._next;--F}function Y(){H=(V=W.now())+U,F=I=0;try{re()}finally{F=0,ae(),H=0}}function ie(){var e=W.now(),t=e-V;t>R&&(U-=t,V=e)}function ae(){for(var e,t=z,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:z=n);B=e,X(r)}function X(e){F||(I&&=clearTimeout(I),e-H>24?(e<1/0&&(I=setTimeout(Y,e-W.now()-U)),L&&=clearInterval(L)):(L||=(V=W.now(),setInterval(ie,R)),F=1,G(Y)))}const Z=4294967296;function oe(){let e=1;return()=>(e=(1664525*e+1013904223)%Z)/Z}function se(e){return e.x}function ce(e){return e.y}var le=10,ue=Math.PI*(3-Math.sqrt(5));function Q(e){var t,n=1,r=.001,i=1-r**(1/300),a=0,o=.6,s=new Map,c=J(d),l=A(`tick`,`end`),u=oe();e??=[];function d(){f(),l.call(`tick`,t),n<r&&(c.stop(),l.call(`end`,t))}function f(r){var c,l=e.length,u;r===void 0&&(r=1);for(var d=0;d<r;++d)for(n+=(a-n)*i,s.forEach(function(e){e(n)}),c=0;c<l;++c)u=e[c],u.fx==null?u.x+=u.vx*=o:(u.x=u.fx,u.vx=0),u.fy==null?u.y+=u.vy*=o:(u.y=u.fy,u.vy=0);return t}function p(){for(var t=0,n=e.length,r;t<n;++t){if(r=e[t],r.index=t,r.fx!=null&&(r.x=r.fx),r.fy!=null&&(r.y=r.fy),isNaN(r.x)||isNaN(r.y)){var i=le*Math.sqrt(.5+t),a=t*ue;r.x=i*Math.cos(a),r.y=i*Math.sin(a)}(isNaN(r.vx)||isNaN(r.vy))&&(r.vx=r.vy=0)}}function m(t){return t.initialize&&t.initialize(e,u),t}return p(),t={tick:f,restart:function(){return c.restart(d),t},stop:function(){return c.stop(),t},nodes:function(n){return arguments.length?(e=n,p(),s.forEach(m),t):e},alpha:function(e){return arguments.length?(n=+e,t):n},alphaMin:function(e){return arguments.length?(r=+e,t):r},alphaDecay:function(e){return arguments.length?(i=+e,t):+i},alphaTarget:function(e){return arguments.length?(a=+e,t):a},velocityDecay:function(e){return arguments.length?(o=1-e,t):1-o},randomSource:function(e){return arguments.length?(u=e,s.forEach(m),t):u},force:function(e,n){return arguments.length>1?(n==null?s.delete(e):s.set(e,m(n)),t):s.get(e)},find:function(t,n,r){var i=0,a=e.length,o,s,c,l,u;for(r==null?r=1/0:r*=r,i=0;i<a;++i)l=e[i],o=t-l.x,s=n-l.y,c=o*o+s*s,c<r&&(u=l,r=c);return u},on:function(e,n){return arguments.length>1?(l.on(e,n),t):l.on(e)}}}function $(){var e,t,n,r,i=E(-30),a,o=1,s=1/0,c=.81;function l(n){var i,a=e.length,o=S(e,se,ce).visitAfter(d);for(r=n,i=0;i<a;++i)t=e[i],o.visit(f)}function u(){if(e){var t,n=e.length,r;for(a=Array(n),t=0;t<n;++t)r=e[t],a[r.index]=+i(r,t,e)}}function d(e){var t=0,n,r,i=0,o,s,c;if(e.length){for(o=s=c=0;c<4;++c)(n=e[c])&&(r=Math.abs(n.value))&&(t+=n.value,i+=r,o+=r*n.x,s+=r*n.y);e.x=o/i,e.y=s/i}else{n=e,n.x=n.data.x,n.y=n.data.y;do t+=a[n.data.index];while(n=n.next)}e.value=t}function f(e,i,l,u){if(!e.value)return!0;var d=e.x-t.x,f=e.y-t.y,p=u-i,m=d*d+f*f;if(p*p/c<m)return m<s&&(d===0&&(d=D(n),m+=d*d),f===0&&(f=D(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)),t.vx+=d*e.value*r/m,t.vy+=f*e.value*r/m),!0;if(!(e.length||m>=s)){(e.data!==t||e.next)&&(d===0&&(d=D(n),m+=d*d),f===0&&(f=D(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)));do e.data!==t&&(p=a[e.data.index]*r/m,t.vx+=d*p,t.vy+=f*p);while(e=e.next)}}return l.initialize=function(t,r){e=t,n=r,u()},l.strength=function(e){return arguments.length?(i=typeof e==`function`?e:E(+e),u(),l):i},l.distanceMin=function(e){return arguments.length?(o=e*e,l):Math.sqrt(o)},l.distanceMax=function(e){return arguments.length?(s=e*e,l):Math.sqrt(s)},l.theta=function(e){return arguments.length?(c=e*e,l):Math.sqrt(c)},l}function de(e){var t=E(.1),n,r,i;typeof e!=`function`&&(e=E(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vx+=(i[t]-o.x)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:E(+e),o(),a):t},a.x=function(t){return arguments.length?(e=typeof t==`function`?t:E(+t),o(),a):e},a}function fe(e){var t=E(.1),n,r,i;typeof e!=`function`&&(e=E(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vy+=(i[t]-o.y)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:E(+e),o(),a):t},a.y=function(t){return arguments.length?(e=typeof t==`function`?t:E(+t),o(),a):e},a}const pe=[e.Entry,e.InternalFramework,e.InternalLib,e.Utility,e.Test,e.Tool];function me(t,n){let i=t.nodes,a=i.length;if(a===0)return{clusterId:t.id,width:n.minClusterSize,height:n.minClusterSize,relativePositions:new Map};let o=new Map;for(let n of i){let r=t.metadata?.get(n.id)?.role??e.InternalLib;o.set(r,(o.get(r)??0)+1)}let s=0,c=new Map;for(let e of pe){let t=o.get(e)??0,n=Math.sqrt(s/a);s+=t;let r=Math.sqrt(s/a);t===0?c.set(e,{min:n,max:n}):c.set(e,{min:n,max:r})}let l=n.nodeRadius*2+n.clusterNodeSpacing,u=a**.6*l*1.3,d=50+Math.max(0,a-15)*2,f=Math.max(n.minClusterSize/2,u+d),p=f*2,m=i.map(r=>({id:r.id,x:(Math.random()-.5)*10,y:(Math.random()-.5)*10,vx:0,vy:0,role:t.metadata?.get(r.id)?.role??e.InternalLib,radius:n.nodeRadius})),h=Q(m).force(`collide`,O().radius(e=>e.radius+n.nodeCollisionPadding)).force(`orbit`,e=>{let t=e*.8;for(let e of m){let n=c.get(e.role)??{min:0,max:1},r=n.min*(f-20),i=n.max*(f-20),a=Math.hypot(e.x,e.y)||1e-6;if(a<r){let n=a-r,i=e.x/a*n*t,o=e.y/a*n*t;e.vx-=i,e.vy-=o}else if(a>i){let n=a-i,r=e.x/a*n*t,o=e.y/a*n*t;e.vx-=r,e.vy-=o}}}).force(`center`,r(0,0).strength(.02)).force(`charge`,$().strength(n.nodeCharge));for(let e=0;e<150&&(h.tick(),!(h.alpha()<.001));e++);h.stop();let g=new Map;for(let e of m)g.set(e.id,{id:e.id,clusterId:t.id,x:e.x,y:e.y,vx:0,vy:0,radius:e.radius});return{clusterId:t.id,width:p,height:p,relativePositions:g}}function he(e,t){let n=Array.from(e.relativePositions.values()).map(e=>({...e,ox:e.x,oy:e.y}));if(n.length===0)return e;let r=Q(n).force(`x`,de(e=>e.ox).strength(.1)).force(`y`,fe(e=>e.oy).strength(.1)).force(`charge`,$().strength(-30)).force(`collide`,O().radius(e=>(e.radius??t.nodeRadius)+t.clusterNodeSpacing).strength(.9).iterations(2)).stop();for(let e=0;e<50&&(r.tick(),!(r.alpha()<.001));e++);let i=new Map,a=1/0,o=-1/0,s=1/0,c=-1/0;for(let t of n){let n=e.relativePositions.get(t.id);n&&i.set(t.id,{...n,x:t.x,y:t.y}),t.x<a&&(a=t.x),t.x>o&&(o=t.x),t.y<s&&(s=t.y),t.y>c&&(c=t.y)}let l=Math.max(Math.abs(a),Math.abs(o),Math.abs(s),Math.abs(c))*2+100,u=Math.max(e.width,l);return{...e,relativePositions:i,width:u,height:u}}function ge(e){return{...e,metadata:new Map(e.metadata)}}const _e={computeMicro(e,t){let n=me(ge(e),t);return n=he(n,t),{clusterId:n.clusterId,width:n.width,height:n.height,relativePositions:Array.from(n.relativePositions.entries())}}};self.onmessage=e=>{let t=_e.computeMicro(e.data.cluster,e.data.config);self.postMessage(t)};
|