@hpcc-js/graph 2.87.1 → 2.87.3

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.
Files changed (59) hide show
  1. package/LICENSE +43 -43
  2. package/README.md +256 -256
  3. package/dist/index.es6.js +11 -11
  4. package/dist/index.es6.js.map +1 -1
  5. package/dist/index.js +11 -11
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.min.js +1 -1
  8. package/dist/index.min.js.map +1 -1
  9. package/package.json +9 -9
  10. package/src/AdjacencyGraph.ts +224 -224
  11. package/src/Edge.css +23 -23
  12. package/src/Edge.ts +257 -257
  13. package/src/Graph.css +18 -18
  14. package/src/Graph.ts +1075 -1075
  15. package/src/GraphData.ts +187 -187
  16. package/src/GraphLayouts.ts +173 -173
  17. package/src/Sankey.css +46 -46
  18. package/src/Sankey.ts +291 -291
  19. package/src/Subgraph.css +10 -10
  20. package/src/Subgraph.ts +165 -165
  21. package/src/Vertex.css +3 -3
  22. package/src/Vertex.ts +282 -282
  23. package/src/__package__.ts +3 -3
  24. package/src/__tests__/data.ts +444 -444
  25. package/src/__tests__/index.ts +1 -1
  26. package/src/__tests__/test1.ts +18 -18
  27. package/src/__tests__/test2.ts +80 -80
  28. package/src/__tests__/test3.ts +46 -46
  29. package/src/__tests__/test4.ts +66 -66
  30. package/src/__tests__/test5.ts +85 -85
  31. package/src/graph2/dataGraph.ts +305 -305
  32. package/src/graph2/graph.css +34 -34
  33. package/src/graph2/graph.ts +135 -135
  34. package/src/graph2/graphReactT.ts +44 -44
  35. package/src/graph2/graphT.ts +1330 -1330
  36. package/src/graph2/index.ts +7 -7
  37. package/src/graph2/layouts/circle.ts +37 -37
  38. package/src/graph2/layouts/dagre.ts +132 -132
  39. package/src/graph2/layouts/dagreWorker.ts +36 -36
  40. package/src/graph2/layouts/forceDirected.ts +117 -117
  41. package/src/graph2/layouts/forceDirectedWorker.ts +32 -32
  42. package/src/graph2/layouts/geoForceDirected.ts +112 -112
  43. package/src/graph2/layouts/graphviz.ts +124 -124
  44. package/src/graph2/layouts/graphvizWorker.ts +71 -71
  45. package/src/graph2/layouts/index.ts +7 -7
  46. package/src/graph2/layouts/layout.ts +105 -105
  47. package/src/graph2/layouts/null.ts +35 -35
  48. package/src/graph2/layouts/placeholders.ts +103 -103
  49. package/src/graph2/layouts/tree.ts +328 -328
  50. package/src/graph2/liteMap.ts +72 -72
  51. package/src/graph2/liteSVGZooom.ts +61 -61
  52. package/src/graph2/sankeyGraph.css +45 -45
  53. package/src/graph2/sankeyGraph.ts +316 -316
  54. package/src/graph2/subgraph.tsx +30 -30
  55. package/src/graph2/vertex.tsx +31 -31
  56. package/src/index.ts +8 -8
  57. package/src/test.ts +649 -649
  58. package/types/__package__.d.ts +2 -2
  59. package/types-3.4/__package__.d.ts +2 -2
@@ -1,117 +1,117 @@
1
- import { forceCenter as d3ForceCenter, forceLink as d3ForceLink, forceManyBody as d3ForceManyBody, forceSimulation as d3ForceSimulation, forceX as d3ForceX, forceY as d3ForceY } from "d3-force";
2
-
3
- import { Layout } from "./layout";
4
-
5
- import { Options } from "./forceDirectedWorker";
6
-
7
- // Non worker ---
8
-
9
- export class ForceDirectedBase extends Layout {
10
-
11
- protected _links;
12
- protected _charge;
13
- protected _center;
14
- protected _simulation;
15
-
16
- constructor(graph, readonly _options: Options) {
17
- super(graph);
18
- }
19
-
20
- start() {
21
- return super.start().then(() => {
22
-
23
- const size = this._graph.size();
24
- const data = this._graph.graphData();
25
- const vertices = data.allVertices();
26
- const edges = data.allEdges();
27
- edges.forEach(e => delete e.points);
28
-
29
- this._links = d3ForceLink(edges)
30
- .id(d => d.id)
31
- .distance(this._options.linkDistance)
32
- .strength(this._options.linkStrength)
33
- ;
34
-
35
- this._charge = d3ForceManyBody()
36
- .strength(this._options.repulsionStrength)
37
- .distanceMin(this._options.distanceMin)
38
- .distanceMax(this._options.distanceMax)
39
- ;
40
-
41
- this._center = d3ForceCenter(size.width / 2, size.height / 2);
42
-
43
- const fx = d3ForceX()
44
- .strength(this._options.forceStrength)
45
- ;
46
- const fy = d3ForceY()
47
- .strength(this._options.forceStrength)
48
- ;
49
-
50
- this._simulation = d3ForceSimulation(vertices.map(v => {
51
- const { width, height } = v.element.node().getBBox();
52
- v.fx = (this._options.pinCentroid && v.props.centroid) ? size.width / 2 : undefined;
53
- v.fy = (this._options.pinCentroid && v.props.centroid) ? size.height / 2 : undefined;
54
- v["width"] = width;
55
- v["height"] = height;
56
- return v;
57
- }))
58
- .force("link", this._links)
59
- .force("charge", this._charge)
60
- .force("center", this._center)
61
- .force("x", fx)
62
- .force("y", fy)
63
- .alpha(this._options.alpha / 2)
64
- .alphaMin(this._options.alphaMin)
65
- .alphaDecay(this._options.alphaDecay)
66
- .velocityDecay(this._options.velocityDecay)
67
- .stop()
68
- ;
69
-
70
- return this;
71
- });
72
- }
73
-
74
- stop() {
75
- this._simulation.stop();
76
- return super.stop();
77
- }
78
- }
79
-
80
- export class ForceDirected extends ForceDirectedBase {
81
-
82
- start() {
83
- return super.start().then(() => {
84
- this._simulation.tick(this._options.iterations);
85
- this.stop();
86
- this._graph
87
- .moveVertices(false)
88
- .moveEdges(false)
89
- ;
90
- return this;
91
- });
92
- }
93
- }
94
-
95
- export class ForceDirectedAnimated extends ForceDirectedBase {
96
-
97
- start() {
98
- return super.start().then(() => {
99
- return new Promise<this>(resolve => {
100
- this._simulation
101
- .on("tick", () => {
102
- this._graph
103
- .moveVertices(false)
104
- .moveEdges(false)
105
- ;
106
- this._graph.progress("layout-tick");
107
- })
108
- .on("end", () => {
109
- this._running = false;
110
- resolve(this);
111
- })
112
- .restart()
113
- ;
114
- });
115
- });
116
- }
117
- }
1
+ import { forceCenter as d3ForceCenter, forceLink as d3ForceLink, forceManyBody as d3ForceManyBody, forceSimulation as d3ForceSimulation, forceX as d3ForceX, forceY as d3ForceY } from "d3-force";
2
+
3
+ import { Layout } from "./layout";
4
+
5
+ import { Options } from "./forceDirectedWorker";
6
+
7
+ // Non worker ---
8
+
9
+ export class ForceDirectedBase extends Layout {
10
+
11
+ protected _links;
12
+ protected _charge;
13
+ protected _center;
14
+ protected _simulation;
15
+
16
+ constructor(graph, readonly _options: Options) {
17
+ super(graph);
18
+ }
19
+
20
+ start() {
21
+ return super.start().then(() => {
22
+
23
+ const size = this._graph.size();
24
+ const data = this._graph.graphData();
25
+ const vertices = data.allVertices();
26
+ const edges = data.allEdges();
27
+ edges.forEach(e => delete e.points);
28
+
29
+ this._links = d3ForceLink(edges)
30
+ .id(d => d.id)
31
+ .distance(this._options.linkDistance)
32
+ .strength(this._options.linkStrength)
33
+ ;
34
+
35
+ this._charge = d3ForceManyBody()
36
+ .strength(this._options.repulsionStrength)
37
+ .distanceMin(this._options.distanceMin)
38
+ .distanceMax(this._options.distanceMax)
39
+ ;
40
+
41
+ this._center = d3ForceCenter(size.width / 2, size.height / 2);
42
+
43
+ const fx = d3ForceX()
44
+ .strength(this._options.forceStrength)
45
+ ;
46
+ const fy = d3ForceY()
47
+ .strength(this._options.forceStrength)
48
+ ;
49
+
50
+ this._simulation = d3ForceSimulation(vertices.map(v => {
51
+ const { width, height } = v.element.node().getBBox();
52
+ v.fx = (this._options.pinCentroid && v.props.centroid) ? size.width / 2 : undefined;
53
+ v.fy = (this._options.pinCentroid && v.props.centroid) ? size.height / 2 : undefined;
54
+ v["width"] = width;
55
+ v["height"] = height;
56
+ return v;
57
+ }))
58
+ .force("link", this._links)
59
+ .force("charge", this._charge)
60
+ .force("center", this._center)
61
+ .force("x", fx)
62
+ .force("y", fy)
63
+ .alpha(this._options.alpha / 2)
64
+ .alphaMin(this._options.alphaMin)
65
+ .alphaDecay(this._options.alphaDecay)
66
+ .velocityDecay(this._options.velocityDecay)
67
+ .stop()
68
+ ;
69
+
70
+ return this;
71
+ });
72
+ }
73
+
74
+ stop() {
75
+ this._simulation.stop();
76
+ return super.stop();
77
+ }
78
+ }
79
+
80
+ export class ForceDirected extends ForceDirectedBase {
81
+
82
+ start() {
83
+ return super.start().then(() => {
84
+ this._simulation.tick(this._options.iterations);
85
+ this.stop();
86
+ this._graph
87
+ .moveVertices(false)
88
+ .moveEdges(false)
89
+ ;
90
+ return this;
91
+ });
92
+ }
93
+ }
94
+
95
+ export class ForceDirectedAnimated extends ForceDirectedBase {
96
+
97
+ start() {
98
+ return super.start().then(() => {
99
+ return new Promise<this>(resolve => {
100
+ this._simulation
101
+ .on("tick", () => {
102
+ this._graph
103
+ .moveVertices(false)
104
+ .moveEdges(false)
105
+ ;
106
+ this._graph.progress("layout-tick");
107
+ })
108
+ .on("end", () => {
109
+ this._running = false;
110
+ resolve(this);
111
+ })
112
+ .restart()
113
+ ;
114
+ });
115
+ });
116
+ }
117
+ }
@@ -1,44 +1,44 @@
1
- export interface Node {
2
- id: string;
3
- text: string;
4
- }
5
-
6
- export interface Link {
7
- id: string;
8
- source: Node;
9
- target: Node;
10
- }
11
-
12
- export interface Data {
13
- nodes: Node[];
14
- links: Link[];
15
- }
16
-
17
- export interface Options {
18
- alpha: number;
19
- alphaMin: number;
20
- alphaDecay: number;
21
- velocityDecay: number;
22
- repulsionStrength: number;
23
- linkDistance: number;
24
- linkStrength: number;
25
- iterations: number;
26
- pinCentroid: boolean;
27
- forceStrength: number;
28
- distanceMin: number;
29
- distanceMax: number;
30
- }
1
+ export interface Node {
2
+ id: string;
3
+ text: string;
4
+ }
5
+
6
+ export interface Link {
7
+ id: string;
8
+ source: Node;
9
+ target: Node;
10
+ }
11
+
12
+ export interface Data {
13
+ nodes: Node[];
14
+ links: Link[];
15
+ }
16
+
17
+ export interface Options {
18
+ alpha: number;
19
+ alphaMin: number;
20
+ alphaDecay: number;
21
+ velocityDecay: number;
22
+ repulsionStrength: number;
23
+ linkDistance: number;
24
+ linkStrength: number;
25
+ iterations: number;
26
+ pinCentroid: boolean;
27
+ forceStrength: number;
28
+ distanceMin: number;
29
+ distanceMax: number;
30
+ }
31
31
 
32
32
  export function forceDirected(data: Data, options: Options) {
33
33
  // eslint-disable-next-line quotes
34
- const workerCode = `var forceDirected=function(t){"use strict";function n(t){return function(){return t}}function e(){return 1e-6*(Math.random()-.5)}function r(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,o,s,u,a,c,f,l,h,v=t._root,y={data:r},p=t._x0,_=t._y0,d=t._x1,g=t._y1;if(!v)return t._root=y,t;for(;v.length;)if((c=n>=(o=(p+d)/2))?p=o:d=o,(f=e>=(s=(_+g)/2))?_=s:g=s,i=v,!(v=v[l=f<<1|c]))return i[l]=y,t;if(u=+t._x.call(null,v.data),a=+t._y.call(null,v.data),n===u&&e===a)return y.next=v,i?i[l]=y:t._root=y,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(c=n>=(o=(p+d)/2))?p=o:d=o,(f=e>=(s=(_+g)/2))?_=s:g=s}while((l=f<<1|c)==(h=(a>=s)<<1|u>=o));return i[h]=v,i[l]=y,t}function i(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function o(t){return t[0]}function s(t){return t[1]}function u(t,n,e){var r=new a(null==n?o:n,null==e?s:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function a(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function c(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var f=u.prototype=a.prototype;f.copy=function(){var t,n,e=new a(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=c(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=c(n));return e},f.add=function(t){var n=+this._x.call(null,t),e=+this._y.call(null,t);return r(this.cover(n,e),n,e,t)},f.addAll=function(t){var n,e,i,o,s=t.length,u=new Array(s),a=new Array(s),c=1/0,f=1/0,l=-1/0,h=-1/0;for(e=0;e<s;++e)isNaN(i=+this._x.call(null,n=t[e]))||isNaN(o=+this._y.call(null,n))||(u[e]=i,a[e]=o,i<c&&(c=i),i>l&&(l=i),o<f&&(f=o),o>h&&(h=o));if(c>l||f>h)return this;for(this.cover(c,f).cover(l,h),e=0;e<s;++e)r(this,u[e],a[e],t[e]);return this},f.cover=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(e))i=(e=Math.floor(t))+1,o=(r=Math.floor(n))+1;else{for(var s,u,a=i-e,c=this._root;e>t||t>=i||r>n||n>=o;)switch(u=(n<r)<<1|t<e,(s=new Array(4))[u]=c,c=s,a*=2,u){case 0:i=e+a,o=r+a;break;case 1:e=i-a,o=r+a;break;case 2:i=e+a,r=o-a;break;case 3:e=i-a,r=o-a}this._root&&this._root.length&&(this._root=c)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},f.data=function(){var t=[];return this.visit((function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)})),t},f.extent=function(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]]},f.find=function(t,n,e){var r,o,s,u,a,c,f,l=this._x0,h=this._y0,v=this._x1,y=this._y1,p=[],_=this._root;for(_&&p.push(new i(_,l,h,v,y)),null==e?e=1/0:(l=t-e,h=n-e,v=t+e,y=n+e,e*=e);c=p.pop();)if(!(!(_=c.node)||(o=c.x0)>v||(s=c.y0)>y||(u=c.x1)<l||(a=c.y1)<h))if(_.length){var d=(o+u)/2,g=(s+a)/2;p.push(new i(_[3],d,g,u,a),new i(_[2],o,g,d,a),new i(_[1],d,s,u,g),new i(_[0],o,s,d,g)),(f=(n>=g)<<1|t>=d)&&(c=p[p.length-1],p[p.length-1]=p[p.length-1-f],p[p.length-1-f]=c)}else{var x=t-+this._x.call(null,_.data),w=n-+this._y.call(null,_.data),m=x*x+w*w;if(m<e){var b=Math.sqrt(e=m);l=t-b,h=n-b,v=t+b,y=n+b,r=_.data}}return r},f.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var n,e,r,i,o,s,u,a,c,f,l,h,v=this._root,y=this._x0,p=this._y0,_=this._x1,d=this._y1;if(!v)return this;if(v.length)for(;;){if((c=o>=(u=(y+_)/2))?y=u:_=u,(f=s>=(a=(p+d)/2))?p=a:d=a,n=v,!(v=v[l=f<<1|c]))return this;if(!v.length)break;(n[l+1&3]||n[l+2&3]||n[l+3&3])&&(e=n,h=l)}for(;v.data!==t;)if(r=v,!(v=v.next))return this;return(i=v.next)&&delete v.next,r?(i?r.next=i:delete r.next,this):n?(i?n[l]=i:delete n[l],(v=n[0]||n[1]||n[2]||n[3])&&v===(n[3]||n[2]||n[1]||n[0])&&!v.length&&(e?e[h]=v:this._root=v),this):(this._root=i,this)},f.removeAll=function(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this},f.root=function(){return this._root},f.size=function(){var t=0;return this.visit((function(n){if(!n.length)do{++t}while(n=n.next)})),t},f.visit=function(t){var n,e,r,o,s,u,a=[],c=this._root;for(c&&a.push(new i(c,this._x0,this._y0,this._x1,this._y1));n=a.pop();)if(!t(c=n.node,r=n.x0,o=n.y0,s=n.x1,u=n.y1)&&c.length){var f=(r+s)/2,l=(o+u)/2;(e=c[3])&&a.push(new i(e,f,l,s,u)),(e=c[2])&&a.push(new i(e,r,l,f,u)),(e=c[1])&&a.push(new i(e,f,o,s,l)),(e=c[0])&&a.push(new i(e,r,o,f,l))}return this},f.visitAfter=function(t){var n,e=[],r=[];for(this._root&&e.push(new i(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var o=n.node;if(o.length){var s,u=n.x0,a=n.y0,c=n.x1,f=n.y1,l=(u+c)/2,h=(a+f)/2;(s=o[0])&&e.push(new i(s,u,a,l,h)),(s=o[1])&&e.push(new i(s,l,a,c,h)),(s=o[2])&&e.push(new i(s,u,h,l,f)),(s=o[3])&&e.push(new i(s,l,h,c,f))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},f.x=function(t){return arguments.length?(this._x=t,this):this._x},f.y=function(t){return arguments.length?(this._y=t,this):this._y};var l="\$";function h(){}function v(t,n){var e=new h;if(t instanceof h)t.each((function(t,n){e.set(n,t)}));else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==n)for(;++i<o;)e.set(i,t[i]);else for(;++i<o;)e.set(n(r=t[i],i,t),r)}else if(t)for(var s in t)e.set(s,t[s]);return e}function y(){}h.prototype=v.prototype={constructor:h,has:function(t){return l+t in this},get:function(t){return this[l+t]},set:function(t,n){return this[l+t]=n,this},remove:function(t){var n=l+t;return n in this&&delete this[n]},clear:function(){for(var t in this)t[0]===l&&delete this[t]},keys:function(){var t=[];for(var n in this)n[0]===l&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)n[0]===l&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)n[0]===l&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)n[0]===l&&++t;return t},empty:function(){for(var t in this)if(t[0]===l)return!1;return!0},each:function(t){for(var n in this)n[0]===l&&t(this[n],n.slice(1),this)}};var p=v.prototype;function _(t){return t.index}function d(t,n){var e=t.get(n);if(!e)throw new Error("missing: "+n);return e}y.prototype={constructor:y,has:p.has,add:function(t){return this[l+(t+="")]=t,this},remove:p.remove,clear:p.clear,values:p.keys,size:p.size,empty:p.empty,each:p.each};var g={value:function(){}};function x(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new w(r)}function w(t){this._=t}function m(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function b(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=g,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}w.prototype=x.prototype={constructor:w,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\\s+/).map((function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))),s=-1,u=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++s<u;)if(e=(t=o[s]).type)i[e]=b(i[e],t.name,n);else if(null==n)for(e in i)i[e]=b(i[e],t.name,null);return this}for(;++s<u;)if((e=(t=o[s]).type)&&(e=m(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new w(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var A,N,M=0,k=0,E=0,T=0,j=0,S=0,q="object"==typeof performance&&performance.now?performance:Date,D="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function O(){return j||(D(P),j=q.now()+S)}function P(){j=0}function z(){this._call=this._time=this._next=null}function C(t,n,e){var r=new z;return r.restart(t,n,e),r}function F(){j=(T=q.now())+S,M=k=0;try{!function(){O(),++M;for(var t,n=A;n;)(t=j-n._time)>=0&&n._call.call(null,t),n=n._next;--M}()}finally{M=0,function(){var t,n,e=A,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:A=n);N=t,Y(r)}(),j=0}}function I(){var t=q.now(),n=t-T;n>1e3&&(S-=n,T=t)}function Y(t){M||(k&&(k=clearTimeout(k)),t-j>24?(t<1/0&&(k=setTimeout(F,t-q.now()-S)),E&&(E=clearInterval(E))):(E||(T=q.now(),E=setInterval(I,1e3)),M=1,D(F)))}function K(t){return t.x}function L(t){return t.y}z.prototype=C.prototype={constructor:z,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?O():+e)+(null==n?0:+n),this._next||N===this||(N?N._next=this:A=this,N=this),this._call=t,this._time=e,Y()},stop:function(){this._call&&(this._call=null,this._time=1/0,Y())}};var U=Math.PI*(3-Math.sqrt(5));var W="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var \$,B,G={exports:{}};
34
+ const workerCode = `var forceDirected=function(t){"use strict";function n(t){return function(){return t}}function e(){return 1e-6*(Math.random()-.5)}function r(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,o,s,u,a,c,f,l,h,v=t._root,y={data:r},p=t._x0,_=t._y0,d=t._x1,g=t._y1;if(!v)return t._root=y,t;for(;v.length;)if((c=n>=(o=(p+d)/2))?p=o:d=o,(f=e>=(s=(_+g)/2))?_=s:g=s,i=v,!(v=v[l=f<<1|c]))return i[l]=y,t;if(u=+t._x.call(null,v.data),a=+t._y.call(null,v.data),n===u&&e===a)return y.next=v,i?i[l]=y:t._root=y,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(c=n>=(o=(p+d)/2))?p=o:d=o,(f=e>=(s=(_+g)/2))?_=s:g=s}while((l=f<<1|c)==(h=(a>=s)<<1|u>=o));return i[h]=v,i[l]=y,t}function i(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function o(t){return t[0]}function s(t){return t[1]}function u(t,n,e){var r=new a(null==n?o:n,null==e?s:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function a(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function c(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var f=u.prototype=a.prototype;f.copy=function(){var t,n,e=new a(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=c(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=c(n));return e},f.add=function(t){var n=+this._x.call(null,t),e=+this._y.call(null,t);return r(this.cover(n,e),n,e,t)},f.addAll=function(t){var n,e,i,o,s=t.length,u=new Array(s),a=new Array(s),c=1/0,f=1/0,l=-1/0,h=-1/0;for(e=0;e<s;++e)isNaN(i=+this._x.call(null,n=t[e]))||isNaN(o=+this._y.call(null,n))||(u[e]=i,a[e]=o,i<c&&(c=i),i>l&&(l=i),o<f&&(f=o),o>h&&(h=o));if(c>l||f>h)return this;for(this.cover(c,f).cover(l,h),e=0;e<s;++e)r(this,u[e],a[e],t[e]);return this},f.cover=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(e))i=(e=Math.floor(t))+1,o=(r=Math.floor(n))+1;else{for(var s,u,a=i-e,c=this._root;e>t||t>=i||r>n||n>=o;)switch(u=(n<r)<<1|t<e,(s=new Array(4))[u]=c,c=s,a*=2,u){case 0:i=e+a,o=r+a;break;case 1:e=i-a,o=r+a;break;case 2:i=e+a,r=o-a;break;case 3:e=i-a,r=o-a}this._root&&this._root.length&&(this._root=c)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},f.data=function(){var t=[];return this.visit(function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)}),t},f.extent=function(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]]},f.find=function(t,n,e){var r,o,s,u,a,c,f,l=this._x0,h=this._y0,v=this._x1,y=this._y1,p=[],_=this._root;for(_&&p.push(new i(_,l,h,v,y)),null==e?e=1/0:(l=t-e,h=n-e,v=t+e,y=n+e,e*=e);c=p.pop();)if(!(!(_=c.node)||(o=c.x0)>v||(s=c.y0)>y||(u=c.x1)<l||(a=c.y1)<h))if(_.length){var d=(o+u)/2,g=(s+a)/2;p.push(new i(_[3],d,g,u,a),new i(_[2],o,g,d,a),new i(_[1],d,s,u,g),new i(_[0],o,s,d,g)),(f=(n>=g)<<1|t>=d)&&(c=p[p.length-1],p[p.length-1]=p[p.length-1-f],p[p.length-1-f]=c)}else{var x=t-+this._x.call(null,_.data),w=n-+this._y.call(null,_.data),m=x*x+w*w;if(m<e){var b=Math.sqrt(e=m);l=t-b,h=n-b,v=t+b,y=n+b,r=_.data}}return r},f.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var n,e,r,i,o,s,u,a,c,f,l,h,v=this._root,y=this._x0,p=this._y0,_=this._x1,d=this._y1;if(!v)return this;if(v.length)for(;;){if((c=o>=(u=(y+_)/2))?y=u:_=u,(f=s>=(a=(p+d)/2))?p=a:d=a,n=v,!(v=v[l=f<<1|c]))return this;if(!v.length)break;(n[l+1&3]||n[l+2&3]||n[l+3&3])&&(e=n,h=l)}for(;v.data!==t;)if(r=v,!(v=v.next))return this;return(i=v.next)&&delete v.next,r?(i?r.next=i:delete r.next,this):n?(i?n[l]=i:delete n[l],(v=n[0]||n[1]||n[2]||n[3])&&v===(n[3]||n[2]||n[1]||n[0])&&!v.length&&(e?e[h]=v:this._root=v),this):(this._root=i,this)},f.removeAll=function(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this},f.root=function(){return this._root},f.size=function(){var t=0;return this.visit(function(n){if(!n.length)do{++t}while(n=n.next)}),t},f.visit=function(t){var n,e,r,o,s,u,a=[],c=this._root;for(c&&a.push(new i(c,this._x0,this._y0,this._x1,this._y1));n=a.pop();)if(!t(c=n.node,r=n.x0,o=n.y0,s=n.x1,u=n.y1)&&c.length){var f=(r+s)/2,l=(o+u)/2;(e=c[3])&&a.push(new i(e,f,l,s,u)),(e=c[2])&&a.push(new i(e,r,l,f,u)),(e=c[1])&&a.push(new i(e,f,o,s,l)),(e=c[0])&&a.push(new i(e,r,o,f,l))}return this},f.visitAfter=function(t){var n,e=[],r=[];for(this._root&&e.push(new i(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var o=n.node;if(o.length){var s,u=n.x0,a=n.y0,c=n.x1,f=n.y1,l=(u+c)/2,h=(a+f)/2;(s=o[0])&&e.push(new i(s,u,a,l,h)),(s=o[1])&&e.push(new i(s,l,a,c,h)),(s=o[2])&&e.push(new i(s,u,h,l,f)),(s=o[3])&&e.push(new i(s,l,h,c,f))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},f.x=function(t){return arguments.length?(this._x=t,this):this._x},f.y=function(t){return arguments.length?(this._y=t,this):this._y};var l="\$";function h(){}function v(t,n){var e=new h;if(t instanceof h)t.each(function(t,n){e.set(n,t)});else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==n)for(;++i<o;)e.set(i,t[i]);else for(;++i<o;)e.set(n(r=t[i],i,t),r)}else if(t)for(var s in t)e.set(s,t[s]);return e}function y(){}h.prototype=v.prototype={constructor:h,has:function(t){return l+t in this},get:function(t){return this[l+t]},set:function(t,n){return this[l+t]=n,this},remove:function(t){var n=l+t;return n in this&&delete this[n]},clear:function(){for(var t in this)t[0]===l&&delete this[t]},keys:function(){var t=[];for(var n in this)n[0]===l&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)n[0]===l&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)n[0]===l&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)n[0]===l&&++t;return t},empty:function(){for(var t in this)if(t[0]===l)return!1;return!0},each:function(t){for(var n in this)n[0]===l&&t(this[n],n.slice(1),this)}};var p=v.prototype;function _(t){return t.index}function d(t,n){var e=t.get(n);if(!e)throw new Error("missing: "+n);return e}y.prototype={constructor:y,has:p.has,add:function(t){return this[l+(t+="")]=t,this},remove:p.remove,clear:p.clear,values:p.keys,size:p.size,empty:p.empty,each:p.each};var g={value:function(){}};function x(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new w(r)}function w(t){this._=t}function m(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function b(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=g,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}w.prototype=x.prototype={constructor:w,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\\s+/).map(function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})),s=-1,u=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++s<u;)if(e=(t=o[s]).type)i[e]=b(i[e],t.name,n);else if(null==n)for(e in i)i[e]=b(i[e],t.name,null);return this}for(;++s<u;)if((e=(t=o[s]).type)&&(e=m(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new w(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var A,N,M=0,k=0,E=0,T=0,j=0,S=0,q="object"==typeof performance&&performance.now?performance:Date,D="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function O(){return j||(D(P),j=q.now()+S)}function P(){j=0}function z(){this._call=this._time=this._next=null}function C(t,n,e){var r=new z;return r.restart(t,n,e),r}function F(){j=(T=q.now())+S,M=k=0;try{!function(){O(),++M;for(var t,n=A;n;)(t=j-n._time)>=0&&n._call.call(null,t),n=n._next;--M}()}finally{M=0,function(){var t,n,e=A,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:A=n);N=t,Y(r)}(),j=0}}function I(){var t=q.now(),n=t-T;n>1e3&&(S-=n,T=t)}function Y(t){M||(k&&(k=clearTimeout(k)),t-j>24?(t<1/0&&(k=setTimeout(F,t-q.now()-S)),E&&(E=clearInterval(E))):(E||(T=q.now(),E=setInterval(I,1e3)),M=1,D(F)))}function K(t){return t.x}function L(t){return t.y}z.prototype=C.prototype={constructor:z,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?O():+e)+(null==n?0:+n),this._next||N===this||(N?N._next=this:A=this,N=this),this._call=t,this._time=e,Y()},stop:function(){this._call&&(this._call=null,this._time=1/0,Y())}};var U=Math.PI*(3-Math.sqrt(5));var W="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var \$,B,G={exports:{}};
35
35
  /*!
36
36
  * @overview es6-promise - a tiny implementation of Promises/A+.
37
37
  * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
38
38
  * @license Licensed under MIT license
39
39
  * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
40
40
  * @version v4.2.8+1e68dce6
41
- */function H(){return \$||(\$=1,G.exports=function(){function t(t){var n=typeof t;return null!==t&&("object"===n||"function"===n)}function n(t){return"function"==typeof t}var e=void 0;e=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var r=e,i=0,o=void 0,s=void 0,u=function(t,n){w[i]=t,w[i+1]=n,2===(i+=2)&&(s?s(m):A())};function a(t){s=t}function c(t){u=t}var f="undefined"!=typeof window?window:void 0,l=f||{},h=l.MutationObserver||l.WebKitMutationObserver,v="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),y="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){return function(){return process.nextTick(m)}}function _(){return void 0!==o?function(){o(m)}:x()}function d(){var t=0,n=new h(m),e=document.createTextNode("");return n.observe(e,{characterData:!0}),function(){e.data=t=++t%2}}function g(){var t=new MessageChannel;return t.port1.onmessage=m,function(){return t.port2.postMessage(0)}}function x(){var t=setTimeout;return function(){return t(m,1)}}var w=new Array(1e3);function m(){for(var t=0;t<i;t+=2)(0,w[t])(w[t+1]),w[t]=void 0,w[t+1]=void 0;i=0}function b(){try{var t=Function("return this")().require("vertx");return o=t.runOnLoop||t.runOnContext,_()}catch(t){return x()}}var A=void 0;function N(t,n){var e=this,r=new this.constructor(E);void 0===r[k]&&J(r);var i=e._state;if(i){var o=arguments[i-1];u((function(){return \$(i,r,o,e._result)}))}else L(e,r,t,n);return r}function M(t){var n=this;if(t&&"object"==typeof t&&t.constructor===n)return t;var e=new n(E);return F(e,t),e}A=v?p():h?d():y?g():void 0===f?b():x();var k=Math.random().toString(36).substring(2);function E(){}var T=void 0,j=1,S=2;function q(){return new TypeError("You cannot resolve a promise with itself")}function D(){return new TypeError("A promises callback cannot return that same promise.")}function O(t,n,e,r){try{t.call(n,e,r)}catch(t){return t}}function P(t,n,e){u((function(t){var r=!1,i=O(e,n,(function(e){r||(r=!0,n!==e?F(t,e):Y(t,e))}),(function(n){r||(r=!0,K(t,n))}),"Settle: "+(t._label||" unknown promise"));!r&&i&&(r=!0,K(t,i))}),t)}function z(t,n){n._state===j?Y(t,n._result):n._state===S?K(t,n._result):L(n,void 0,(function(n){return F(t,n)}),(function(n){return K(t,n)}))}function C(t,e,r){e.constructor===t.constructor&&r===N&&e.constructor.resolve===M?z(t,e):void 0===r?Y(t,e):n(r)?P(t,e,r):Y(t,e)}function F(n,e){if(n===e)K(n,q());else if(t(e)){var r=void 0;try{r=e.then}catch(t){return void K(n,t)}C(n,e,r)}else Y(n,e)}function I(t){t._onerror&&t._onerror(t._result),U(t)}function Y(t,n){t._state===T&&(t._result=n,t._state=j,0!==t._subscribers.length&&u(U,t))}function K(t,n){t._state===T&&(t._state=S,t._result=n,u(I,t))}function L(t,n,e,r){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=n,i[o+j]=e,i[o+S]=r,0===o&&t._state&&u(U,t)}function U(t){var n=t._subscribers,e=t._state;if(0!==n.length){for(var r=void 0,i=void 0,o=t._result,s=0;s<n.length;s+=3)r=n[s],i=n[s+e],r?\$(e,r,i,o):i(o);t._subscribers.length=0}}function \$(t,e,r,i){var o=n(r),s=void 0,u=void 0,a=!0;if(o){try{s=r(i)}catch(t){a=!1,u=t}if(e===s)return void K(e,D())}else s=i;e._state!==T||(o&&a?F(e,s):!1===a?K(e,u):t===j?Y(e,s):t===S&&K(e,s))}function B(t,n){try{n((function(n){F(t,n)}),(function(n){K(t,n)}))}catch(n){K(t,n)}}var G=0;function H(){return G++}function J(t){t[k]=G++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Q(){return new Error("Array Methods must be provided an Array")}var R=function(){function t(t,n){this._instanceConstructor=t,this.promise=new t(E),this.promise[k]||J(this.promise),r(n)?(this.length=n.length,this._remaining=n.length,this._result=new Array(this.length),0===this.length?Y(this.promise,this._result):(this.length=this.length||0,this._enumerate(n),0===this._remaining&&Y(this.promise,this._result))):K(this.promise,Q())}return t.prototype._enumerate=function(t){for(var n=0;this._state===T&&n<t.length;n++)this._eachEntry(t[n],n)},t.prototype._eachEntry=function(t,n){var e=this._instanceConstructor,r=e.resolve;if(r===M){var i=void 0,o=void 0,s=!1;try{i=t.then}catch(t){s=!0,o=t}if(i===N&&t._state!==T)this._settledAt(t._state,n,t._result);else if("function"!=typeof i)this._remaining--,this._result[n]=t;else if(e===et){var u=new e(E);s?K(u,o):C(u,t,i),this._willSettleAt(u,n)}else this._willSettleAt(new e((function(n){return n(t)})),n)}else this._willSettleAt(r(t),n)},t.prototype._settledAt=function(t,n,e){var r=this.promise;r._state===T&&(this._remaining--,t===S?K(r,e):this._result[n]=e),0===this._remaining&&Y(r,this._result)},t.prototype._willSettleAt=function(t,n){var e=this;L(t,void 0,(function(t){return e._settledAt(j,n,t)}),(function(t){return e._settledAt(S,n,t)}))},t}();function V(t){return new R(this,t).promise}function X(t){var n=this;return r(t)?new n((function(e,r){for(var i=t.length,o=0;o<i;o++)n.resolve(t[o]).then(e,r)})):new n((function(t,n){return n(new TypeError("You must pass an array to race."))}))}function Z(t){var n=new this(E);return K(n,t),n}function tt(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function nt(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var et=function(){function t(n){this[k]=H(),this._result=this._state=void 0,this._subscribers=[],E!==n&&("function"!=typeof n&&tt(),this instanceof t?B(this,n):nt())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var e=this,r=e.constructor;return n(t)?e.then((function(n){return r.resolve(t()).then((function(){return n}))}),(function(n){return r.resolve(t()).then((function(){throw n}))})):e.then(t,t)},t}();function rt(){var t=void 0;if(void 0!==W)t=W;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if(n){var e=null;try{e=Object.prototype.toString.call(n.resolve())}catch(t){}if("[object Promise]"===e&&!n.cast)return}t.Promise=et}return et.prototype.then=N,et.all=V,et.race=X,et.resolve=M,et.reject=Z,et._setScheduler=a,et._setAsap=c,et._asap=u,et.polyfill=rt,et.Promise=et,et}()),G.exports}function J(t,r){var i=t.nodes,o=t.links,s=function(t){var r,i,o,s,u,a=_,c=function(t){return 1/Math.min(s[t.source.index],s[t.target.index])},f=n(30),l=1;function h(n){for(var o=0,s=t.length;o<l;++o)for(var a,c,f,h,v,y,p,_=0;_<s;++_)c=(a=t[_]).source,h=(f=a.target).x+f.vx-c.x-c.vx||e(),v=f.y+f.vy-c.y-c.vy||e(),h*=y=((y=Math.sqrt(h*h+v*v))-i[_])/y*n*r[_],v*=y,f.vx-=h*(p=u[_]),f.vy-=v*p,c.vx+=h*(p=1-p),c.vy+=v*p}function y(){if(o){var n,e,c=o.length,f=t.length,l=v(o,a);for(n=0,s=new Array(c);n<f;++n)(e=t[n]).index=n,"object"!=typeof e.source&&(e.source=d(l,e.source)),"object"!=typeof e.target&&(e.target=d(l,e.target)),s[e.source.index]=(s[e.source.index]||0)+1,s[e.target.index]=(s[e.target.index]||0)+1;for(n=0,u=new Array(f);n<f;++n)e=t[n],u[n]=s[e.source.index]/(s[e.source.index]+s[e.target.index]);r=new Array(f),p(),i=new Array(f),g()}}function p(){if(o)for(var n=0,e=t.length;n<e;++n)r[n]=+c(t[n],n,t)}function g(){if(o)for(var n=0,e=t.length;n<e;++n)i[n]=+f(t[n],n,t)}return null==t&&(t=[]),h.initialize=function(t){o=t,y()},h.links=function(n){return arguments.length?(t=n,y(),h):t},h.id=function(t){return arguments.length?(a=t,h):a},h.iterations=function(t){return arguments.length?(l=+t,h):l},h.strength=function(t){return arguments.length?(c="function"==typeof t?t:n(+t),p(),h):c},h.distance=function(t){return arguments.length?(f="function"==typeof t?t:n(+t),g(),h):f},h}(o).id((function(t){return t.id})).distance(r.linkDistance).strength(r.linkStrength),a=function(){var t,r,i,o,s=n(-30),a=1,c=1/0,f=.81;function l(n){var e,o=t.length,s=u(t,K,L).visitAfter(v);for(i=n,e=0;e<o;++e)r=t[e],s.visit(y)}function h(){if(t){var n,e,r=t.length;for(o=new Array(r),n=0;n<r;++n)e=t[n],o[e.index]=+s(e,n,t)}}function v(t){var n,e,r,i,s,u=0,a=0;if(t.length){for(r=i=s=0;s<4;++s)(n=t[s])&&(e=Math.abs(n.value))&&(u+=n.value,a+=e,r+=e*n.x,i+=e*n.y);t.x=r/a,t.y=i/a}else{(n=t).x=n.data.x,n.y=n.data.y;do{u+=o[n.data.index]}while(n=n.next)}t.value=u}function y(t,n,s,u){if(!t.value)return!0;var l=t.x-r.x,h=t.y-r.y,v=u-n,y=l*l+h*h;if(v*v/f<y)return y<c&&(0===l&&(y+=(l=e())*l),0===h&&(y+=(h=e())*h),y<a&&(y=Math.sqrt(a*y)),r.vx+=l*t.value*i/y,r.vy+=h*t.value*i/y),!0;if(!(t.length||y>=c)){(t.data!==r||t.next)&&(0===l&&(y+=(l=e())*l),0===h&&(y+=(h=e())*h),y<a&&(y=Math.sqrt(a*y)));do{t.data!==r&&(v=o[t.data.index]*i/y,r.vx+=l*v,r.vy+=h*v)}while(t=t.next)}}return l.initialize=function(n){t=n,h()},l.strength=function(t){return arguments.length?(s="function"==typeof t?t:n(+t),h(),l):s},l.distanceMin=function(t){return arguments.length?(a=t*t,l):Math.sqrt(a)},l.distanceMax=function(t){return arguments.length?(c=t*t,l):Math.sqrt(c)},l.theta=function(t){return arguments.length?(f=t*t,l):Math.sqrt(f)},l}().strength(r.repulsionStrength);return function(t){var n,e=1,r=.001,i=1-Math.pow(r,1/300),o=0,s=.6,u=v(),a=C(f),c=x("tick","end");function f(){l(),c.call("tick",n),e<r&&(a.stop(),c.call("end",n))}function l(r){var a,c,f=t.length;void 0===r&&(r=1);for(var l=0;l<r;++l)for(e+=(o-e)*i,u.each((function(t){t(e)})),a=0;a<f;++a)null==(c=t[a]).fx?c.x+=c.vx*=s:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=s:(c.y=c.fy,c.vy=0);return n}function h(){for(var n,e=0,r=t.length;e<r;++e){if((n=t[e]).index=e,null!=n.fx&&(n.x=n.fx),null!=n.fy&&(n.y=n.fy),isNaN(n.x)||isNaN(n.y)){var i=10*Math.sqrt(e),o=e*U;n.x=i*Math.cos(o),n.y=i*Math.sin(o)}(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}}function y(n){return n.initialize&&n.initialize(t),n}return null==t&&(t=[]),h(),n={tick:l,restart:function(){return a.restart(f),n},stop:function(){return a.stop(),n},nodes:function(e){return arguments.length?(t=e,h(),u.each(y),n):t},alpha:function(t){return arguments.length?(e=+t,n):e},alphaMin:function(t){return arguments.length?(r=+t,n):r},alphaDecay:function(t){return arguments.length?(i=+t,n):+i},alphaTarget:function(t){return arguments.length?(o=+t,n):o},velocityDecay:function(t){return arguments.length?(s=1-t,n):1-s},force:function(t,e){return arguments.length>1?(null==e?u.remove(t):u.set(t,y(e)),n):u.get(t)},find:function(n,e,r){var i,o,s,u,a,c=0,f=t.length;for(null==r?r=1/0:r*=r,c=0;c<f;++c)(s=(i=n-(u=t[c]).x)*i+(o=e-u.y)*o)<r&&(a=u,r=s);return a},on:function(t,e){return arguments.length>1?(c.on(t,e),n):c.on(t)}}}(i).force("link",s).force("charge",a).force("center",function(t,n){var e;function r(){var r,i,o=e.length,s=0,u=0;for(r=0;r<o;++r)s+=(i=e[r]).x,u+=i.y;for(s=s/o-t,u=u/o-n,r=0;r<o;++r)(i=e[r]).x-=s,i.y-=u}return null==t&&(t=0),null==n&&(n=0),r.initialize=function(t){e=t},r.x=function(n){return arguments.length?(t=+n,r):t},r.y=function(t){return arguments.length?(n=+t,r):n},r}()).alpha(r.alpha).alphaMin(r.alphaMin).alphaDecay(r.alphaDecay).velocityDecay(r.velocityDecay).stop().tick(r.iterations),{nodes:i,links:o}}return B||(B=1,H().polyfill()),self.onmessage=function(t){var n=J.apply(void 0,t.data);self.postMessage(n)},t.forceDirected=J,t}({});`;
41
+ */function H(){return \$||(\$=1,G.exports=function(){function t(t){var n=typeof t;return null!==t&&("object"===n||"function"===n)}function n(t){return"function"==typeof t}var e=void 0;e=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var r=e,i=0,o=void 0,s=void 0,u=function(t,n){w[i]=t,w[i+1]=n,2===(i+=2)&&(s?s(m):A())};function a(t){s=t}function c(t){u=t}var f="undefined"!=typeof window?window:void 0,l=f||{},h=l.MutationObserver||l.WebKitMutationObserver,v="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),y="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){return function(){return process.nextTick(m)}}function _(){return void 0!==o?function(){o(m)}:x()}function d(){var t=0,n=new h(m),e=document.createTextNode("");return n.observe(e,{characterData:!0}),function(){e.data=t=++t%2}}function g(){var t=new MessageChannel;return t.port1.onmessage=m,function(){return t.port2.postMessage(0)}}function x(){var t=setTimeout;return function(){return t(m,1)}}var w=new Array(1e3);function m(){for(var t=0;t<i;t+=2)(0,w[t])(w[t+1]),w[t]=void 0,w[t+1]=void 0;i=0}function b(){try{var t=Function("return this")().require("vertx");return o=t.runOnLoop||t.runOnContext,_()}catch(t){return x()}}var A=void 0;function N(t,n){var e=this,r=new this.constructor(E);void 0===r[k]&&J(r);var i=e._state;if(i){var o=arguments[i-1];u(function(){return \$(i,r,o,e._result)})}else L(e,r,t,n);return r}function M(t){var n=this;if(t&&"object"==typeof t&&t.constructor===n)return t;var e=new n(E);return F(e,t),e}A=v?p():h?d():y?g():void 0===f?b():x();var k=Math.random().toString(36).substring(2);function E(){}var T=void 0,j=1,S=2;function q(){return new TypeError("You cannot resolve a promise with itself")}function D(){return new TypeError("A promises callback cannot return that same promise.")}function O(t,n,e,r){try{t.call(n,e,r)}catch(t){return t}}function P(t,n,e){u(function(t){var r=!1,i=O(e,n,function(e){r||(r=!0,n!==e?F(t,e):Y(t,e))},function(n){r||(r=!0,K(t,n))},"Settle: "+(t._label||" unknown promise"));!r&&i&&(r=!0,K(t,i))},t)}function z(t,n){n._state===j?Y(t,n._result):n._state===S?K(t,n._result):L(n,void 0,function(n){return F(t,n)},function(n){return K(t,n)})}function C(t,e,r){e.constructor===t.constructor&&r===N&&e.constructor.resolve===M?z(t,e):void 0===r?Y(t,e):n(r)?P(t,e,r):Y(t,e)}function F(n,e){if(n===e)K(n,q());else if(t(e)){var r=void 0;try{r=e.then}catch(t){return void K(n,t)}C(n,e,r)}else Y(n,e)}function I(t){t._onerror&&t._onerror(t._result),U(t)}function Y(t,n){t._state===T&&(t._result=n,t._state=j,0!==t._subscribers.length&&u(U,t))}function K(t,n){t._state===T&&(t._state=S,t._result=n,u(I,t))}function L(t,n,e,r){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=n,i[o+j]=e,i[o+S]=r,0===o&&t._state&&u(U,t)}function U(t){var n=t._subscribers,e=t._state;if(0!==n.length){for(var r=void 0,i=void 0,o=t._result,s=0;s<n.length;s+=3)r=n[s],i=n[s+e],r?\$(e,r,i,o):i(o);t._subscribers.length=0}}function \$(t,e,r,i){var o=n(r),s=void 0,u=void 0,a=!0;if(o){try{s=r(i)}catch(t){a=!1,u=t}if(e===s)return void K(e,D())}else s=i;e._state!==T||(o&&a?F(e,s):!1===a?K(e,u):t===j?Y(e,s):t===S&&K(e,s))}function B(t,n){try{n(function(n){F(t,n)},function(n){K(t,n)})}catch(n){K(t,n)}}var G=0;function H(){return G++}function J(t){t[k]=G++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Q(){return new Error("Array Methods must be provided an Array")}var R=function(){function t(t,n){this._instanceConstructor=t,this.promise=new t(E),this.promise[k]||J(this.promise),r(n)?(this.length=n.length,this._remaining=n.length,this._result=new Array(this.length),0===this.length?Y(this.promise,this._result):(this.length=this.length||0,this._enumerate(n),0===this._remaining&&Y(this.promise,this._result))):K(this.promise,Q())}return t.prototype._enumerate=function(t){for(var n=0;this._state===T&&n<t.length;n++)this._eachEntry(t[n],n)},t.prototype._eachEntry=function(t,n){var e=this._instanceConstructor,r=e.resolve;if(r===M){var i=void 0,o=void 0,s=!1;try{i=t.then}catch(t){s=!0,o=t}if(i===N&&t._state!==T)this._settledAt(t._state,n,t._result);else if("function"!=typeof i)this._remaining--,this._result[n]=t;else if(e===et){var u=new e(E);s?K(u,o):C(u,t,i),this._willSettleAt(u,n)}else this._willSettleAt(new e(function(n){return n(t)}),n)}else this._willSettleAt(r(t),n)},t.prototype._settledAt=function(t,n,e){var r=this.promise;r._state===T&&(this._remaining--,t===S?K(r,e):this._result[n]=e),0===this._remaining&&Y(r,this._result)},t.prototype._willSettleAt=function(t,n){var e=this;L(t,void 0,function(t){return e._settledAt(j,n,t)},function(t){return e._settledAt(S,n,t)})},t}();function V(t){return new R(this,t).promise}function X(t){var n=this;return r(t)?new n(function(e,r){for(var i=t.length,o=0;o<i;o++)n.resolve(t[o]).then(e,r)}):new n(function(t,n){return n(new TypeError("You must pass an array to race."))})}function Z(t){var n=new this(E);return K(n,t),n}function tt(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function nt(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var et=function(){function t(n){this[k]=H(),this._result=this._state=void 0,this._subscribers=[],E!==n&&("function"!=typeof n&&tt(),this instanceof t?B(this,n):nt())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var e=this,r=e.constructor;return n(t)?e.then(function(n){return r.resolve(t()).then(function(){return n})},function(n){return r.resolve(t()).then(function(){throw n})}):e.then(t,t)},t}();function rt(){var t=void 0;if(void 0!==W)t=W;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if(n){var e=null;try{e=Object.prototype.toString.call(n.resolve())}catch(t){}if("[object Promise]"===e&&!n.cast)return}t.Promise=et}return et.prototype.then=N,et.all=V,et.race=X,et.resolve=M,et.reject=Z,et._setScheduler=a,et._setAsap=c,et._asap=u,et.polyfill=rt,et.Promise=et,et}()),G.exports}function J(t,r){var i=t.nodes,o=t.links,s=function(t){var r,i,o,s,u,a=_,c=function(t){return 1/Math.min(s[t.source.index],s[t.target.index])},f=n(30),l=1;function h(n){for(var o=0,s=t.length;o<l;++o)for(var a,c,f,h,v,y,p,_=0;_<s;++_)c=(a=t[_]).source,h=(f=a.target).x+f.vx-c.x-c.vx||e(),v=f.y+f.vy-c.y-c.vy||e(),h*=y=((y=Math.sqrt(h*h+v*v))-i[_])/y*n*r[_],v*=y,f.vx-=h*(p=u[_]),f.vy-=v*p,c.vx+=h*(p=1-p),c.vy+=v*p}function y(){if(o){var n,e,c=o.length,f=t.length,l=v(o,a);for(n=0,s=new Array(c);n<f;++n)(e=t[n]).index=n,"object"!=typeof e.source&&(e.source=d(l,e.source)),"object"!=typeof e.target&&(e.target=d(l,e.target)),s[e.source.index]=(s[e.source.index]||0)+1,s[e.target.index]=(s[e.target.index]||0)+1;for(n=0,u=new Array(f);n<f;++n)e=t[n],u[n]=s[e.source.index]/(s[e.source.index]+s[e.target.index]);r=new Array(f),p(),i=new Array(f),g()}}function p(){if(o)for(var n=0,e=t.length;n<e;++n)r[n]=+c(t[n],n,t)}function g(){if(o)for(var n=0,e=t.length;n<e;++n)i[n]=+f(t[n],n,t)}return null==t&&(t=[]),h.initialize=function(t){o=t,y()},h.links=function(n){return arguments.length?(t=n,y(),h):t},h.id=function(t){return arguments.length?(a=t,h):a},h.iterations=function(t){return arguments.length?(l=+t,h):l},h.strength=function(t){return arguments.length?(c="function"==typeof t?t:n(+t),p(),h):c},h.distance=function(t){return arguments.length?(f="function"==typeof t?t:n(+t),g(),h):f},h}(o).id(function(t){return t.id}).distance(r.linkDistance).strength(r.linkStrength),a=function(){var t,r,i,o,s=n(-30),a=1,c=1/0,f=.81;function l(n){var e,o=t.length,s=u(t,K,L).visitAfter(v);for(i=n,e=0;e<o;++e)r=t[e],s.visit(y)}function h(){if(t){var n,e,r=t.length;for(o=new Array(r),n=0;n<r;++n)e=t[n],o[e.index]=+s(e,n,t)}}function v(t){var n,e,r,i,s,u=0,a=0;if(t.length){for(r=i=s=0;s<4;++s)(n=t[s])&&(e=Math.abs(n.value))&&(u+=n.value,a+=e,r+=e*n.x,i+=e*n.y);t.x=r/a,t.y=i/a}else{(n=t).x=n.data.x,n.y=n.data.y;do{u+=o[n.data.index]}while(n=n.next)}t.value=u}function y(t,n,s,u){if(!t.value)return!0;var l=t.x-r.x,h=t.y-r.y,v=u-n,y=l*l+h*h;if(v*v/f<y)return y<c&&(0===l&&(y+=(l=e())*l),0===h&&(y+=(h=e())*h),y<a&&(y=Math.sqrt(a*y)),r.vx+=l*t.value*i/y,r.vy+=h*t.value*i/y),!0;if(!(t.length||y>=c)){(t.data!==r||t.next)&&(0===l&&(y+=(l=e())*l),0===h&&(y+=(h=e())*h),y<a&&(y=Math.sqrt(a*y)));do{t.data!==r&&(v=o[t.data.index]*i/y,r.vx+=l*v,r.vy+=h*v)}while(t=t.next)}}return l.initialize=function(n){t=n,h()},l.strength=function(t){return arguments.length?(s="function"==typeof t?t:n(+t),h(),l):s},l.distanceMin=function(t){return arguments.length?(a=t*t,l):Math.sqrt(a)},l.distanceMax=function(t){return arguments.length?(c=t*t,l):Math.sqrt(c)},l.theta=function(t){return arguments.length?(f=t*t,l):Math.sqrt(f)},l}().strength(r.repulsionStrength);return function(t){var n,e=1,r=.001,i=1-Math.pow(r,1/300),o=0,s=.6,u=v(),a=C(f),c=x("tick","end");function f(){l(),c.call("tick",n),e<r&&(a.stop(),c.call("end",n))}function l(r){var a,c,f=t.length;void 0===r&&(r=1);for(var l=0;l<r;++l)for(e+=(o-e)*i,u.each(function(t){t(e)}),a=0;a<f;++a)null==(c=t[a]).fx?c.x+=c.vx*=s:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=s:(c.y=c.fy,c.vy=0);return n}function h(){for(var n,e=0,r=t.length;e<r;++e){if((n=t[e]).index=e,null!=n.fx&&(n.x=n.fx),null!=n.fy&&(n.y=n.fy),isNaN(n.x)||isNaN(n.y)){var i=10*Math.sqrt(e),o=e*U;n.x=i*Math.cos(o),n.y=i*Math.sin(o)}(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}}function y(n){return n.initialize&&n.initialize(t),n}return null==t&&(t=[]),h(),n={tick:l,restart:function(){return a.restart(f),n},stop:function(){return a.stop(),n},nodes:function(e){return arguments.length?(t=e,h(),u.each(y),n):t},alpha:function(t){return arguments.length?(e=+t,n):e},alphaMin:function(t){return arguments.length?(r=+t,n):r},alphaDecay:function(t){return arguments.length?(i=+t,n):+i},alphaTarget:function(t){return arguments.length?(o=+t,n):o},velocityDecay:function(t){return arguments.length?(s=1-t,n):1-s},force:function(t,e){return arguments.length>1?(null==e?u.remove(t):u.set(t,y(e)),n):u.get(t)},find:function(n,e,r){var i,o,s,u,a,c=0,f=t.length;for(null==r?r=1/0:r*=r,c=0;c<f;++c)(s=(i=n-(u=t[c]).x)*i+(o=e-u.y)*o)<r&&(a=u,r=s);return a},on:function(t,e){return arguments.length>1?(c.on(t,e),n):c.on(t)}}}(i).force("link",s).force("charge",a).force("center",function(t,n){var e;function r(){var r,i,o=e.length,s=0,u=0;for(r=0;r<o;++r)s+=(i=e[r]).x,u+=i.y;for(s=s/o-t,u=u/o-n,r=0;r<o;++r)(i=e[r]).x-=s,i.y-=u}return null==t&&(t=0),null==n&&(n=0),r.initialize=function(t){e=t},r.x=function(n){return arguments.length?(t=+n,r):t},r.y=function(t){return arguments.length?(n=+t,r):n},r}()).alpha(r.alpha).alphaMin(r.alphaMin).alphaDecay(r.alphaDecay).velocityDecay(r.velocityDecay).stop().tick(r.iterations),{nodes:i,links:o}}return B||(B=1,H().polyfill()),self.onmessage=function(t){var n=J.apply(void 0,t.data);self.postMessage(n)},t.forceDirected=J,t}({});`;
42
42
 
43
43
  const workerBlob = new Blob([workerCode], { type: "application/javascript" });
44
44
  const workerUrl = URL.createObjectURL(workerBlob);
@@ -1,112 +1,112 @@
1
- export const tmp = 42;
2
- /*
3
- import { forceLink as d3ForceLink, forceManyBody as d3ForceManyBody, forceSimulation as d3ForceSimulation } from "d3-force";
4
- import { Layout } from "./layout";
5
-
6
- export class GeoForceDirectedBase extends Layout {
7
-
8
- protected _links;
9
- protected _charge;
10
- protected _simulation;
11
-
12
- constructor(graph, readonly _options = defaultOptions) {
13
- super(graph);
14
- }
15
-
16
- start() {
17
- return super.start().then(() => {
18
- const data = this._graph.graphData();
19
- this._links = d3ForceLink(data.edges())
20
- .id(d => d.id)
21
- .distance(this._options.linkDistance)
22
- .strength(this._options.linkStrength)
23
- ;
24
- this._charge = d3ForceManyBody()
25
- .strength(d => this._options.charge * Math.max(d.width, d.height))
26
- ;
27
- this._simulation = d3ForceSimulation()
28
- .force("link", this._links)
29
- .force("charge", this._charge)
30
- .nodes(data.vertices().map(v => {
31
- // const { width, height } = v.widget.getBBox();
32
- // v["width"] = width;
33
- // v["height"] = height;
34
- return v;
35
- }))
36
- .stop()
37
- ;
38
-
39
- return this;
40
- });
41
- }
42
-
43
- stop() {
44
- this._simulation.stop();
45
- return super.stop();
46
- }
47
- }
48
-
49
- export class GeoForceDirected extends GeoForceDirectedBase {
50
-
51
- start() {
52
- return super.start().then(() => {
53
- const vertices = this._graph.graphData().vertices();
54
- vertices.forEach(vp => {
55
- if (vp.lat && vp.lng) {
56
- // const [x, y] = this._graph.project(vp.lat, vp.lng);
57
- // vp.fx = x;
58
- // vp.fy = y;
59
- }
60
- });
61
-
62
- this._simulation
63
- // .velocityDecay(0.1)
64
- .restart()
65
- ;
66
- let total = vertices.length;
67
- total = Math.min(total * total, 500);
68
- for (let i = 0; i < total; ++i) {
69
- this._simulation.tick();
70
- }
71
- this._simulation.stop();
72
- vertices.forEach(vp => {
73
- if (vp.lat && vp.lng) {
74
- delete vp.fx;
75
- delete vp.fy;
76
- }
77
- });
78
-
79
- this._graph
80
- .moveVertices(true)
81
- .moveEdges(true)
82
- ;
83
- this.stop();
84
-
85
- return this;
86
- });
87
- }
88
- }
89
-
90
- export class GeoForceDirectedAnimated extends GeoForceDirectedBase {
91
-
92
- start() {
93
- super.start();
94
- return new Promise<this>(resolve => {
95
- this._simulation
96
- .velocityDecay(this._options.velocityDecay)
97
- .on("tick", () => {
98
- this._graph
99
- .moveVertices(false)
100
- .moveEdges(false)
101
- ;
102
- })
103
- .on("end", () => {
104
- this._running = false;
105
- resolve(this);
106
- })
107
- .restart()
108
- ;
109
- });
110
- }
111
- }
112
- */
1
+ export const tmp = 42;
2
+ /*
3
+ import { forceLink as d3ForceLink, forceManyBody as d3ForceManyBody, forceSimulation as d3ForceSimulation } from "d3-force";
4
+ import { Layout } from "./layout";
5
+
6
+ export class GeoForceDirectedBase extends Layout {
7
+
8
+ protected _links;
9
+ protected _charge;
10
+ protected _simulation;
11
+
12
+ constructor(graph, readonly _options = defaultOptions) {
13
+ super(graph);
14
+ }
15
+
16
+ start() {
17
+ return super.start().then(() => {
18
+ const data = this._graph.graphData();
19
+ this._links = d3ForceLink(data.edges())
20
+ .id(d => d.id)
21
+ .distance(this._options.linkDistance)
22
+ .strength(this._options.linkStrength)
23
+ ;
24
+ this._charge = d3ForceManyBody()
25
+ .strength(d => this._options.charge * Math.max(d.width, d.height))
26
+ ;
27
+ this._simulation = d3ForceSimulation()
28
+ .force("link", this._links)
29
+ .force("charge", this._charge)
30
+ .nodes(data.vertices().map(v => {
31
+ // const { width, height } = v.widget.getBBox();
32
+ // v["width"] = width;
33
+ // v["height"] = height;
34
+ return v;
35
+ }))
36
+ .stop()
37
+ ;
38
+
39
+ return this;
40
+ });
41
+ }
42
+
43
+ stop() {
44
+ this._simulation.stop();
45
+ return super.stop();
46
+ }
47
+ }
48
+
49
+ export class GeoForceDirected extends GeoForceDirectedBase {
50
+
51
+ start() {
52
+ return super.start().then(() => {
53
+ const vertices = this._graph.graphData().vertices();
54
+ vertices.forEach(vp => {
55
+ if (vp.lat && vp.lng) {
56
+ // const [x, y] = this._graph.project(vp.lat, vp.lng);
57
+ // vp.fx = x;
58
+ // vp.fy = y;
59
+ }
60
+ });
61
+
62
+ this._simulation
63
+ // .velocityDecay(0.1)
64
+ .restart()
65
+ ;
66
+ let total = vertices.length;
67
+ total = Math.min(total * total, 500);
68
+ for (let i = 0; i < total; ++i) {
69
+ this._simulation.tick();
70
+ }
71
+ this._simulation.stop();
72
+ vertices.forEach(vp => {
73
+ if (vp.lat && vp.lng) {
74
+ delete vp.fx;
75
+ delete vp.fy;
76
+ }
77
+ });
78
+
79
+ this._graph
80
+ .moveVertices(true)
81
+ .moveEdges(true)
82
+ ;
83
+ this.stop();
84
+
85
+ return this;
86
+ });
87
+ }
88
+ }
89
+
90
+ export class GeoForceDirectedAnimated extends GeoForceDirectedBase {
91
+
92
+ start() {
93
+ super.start();
94
+ return new Promise<this>(resolve => {
95
+ this._simulation
96
+ .velocityDecay(this._options.velocityDecay)
97
+ .on("tick", () => {
98
+ this._graph
99
+ .moveVertices(false)
100
+ .moveEdges(false)
101
+ ;
102
+ })
103
+ .on("end", () => {
104
+ this._running = false;
105
+ resolve(this);
106
+ })
107
+ .restart()
108
+ ;
109
+ });
110
+ }
111
+ }
112
+ */