summaryrefslogtreecommitdiff
path: root/build/server/chunks/624.js
diff options
context:
space:
mode:
authorKirill Rogovoy <[email protected]>2021-07-23 16:29:33 +0300
committerKirill Rogovoy <[email protected]>2021-07-23 16:29:33 +0300
commitc20eff6f40a994945f8b24d095c4f6f2f270c925 (patch)
tree012cfce86923362f8879f9394388c810074120d4 /build/server/chunks/624.js
parent356381d14cb1ff3cbd39c7e396dd14379336451b (diff)
Add README and upload production build
Diffstat (limited to 'build/server/chunks/624.js')
-rw-r--r--build/server/chunks/624.js2510
1 files changed, 2510 insertions, 0 deletions
diff --git a/build/server/chunks/624.js b/build/server/chunks/624.js
new file mode 100644
index 0000000..8fd3f14
--- /dev/null
+++ b/build/server/chunks/624.js
@@ -0,0 +1,2510 @@
+exports.id = 624;
+exports.ids = [624];
+exports.modules = {
+
+/***/ 265:
+/***/ (function(__unused_webpack_module, exports) {
+
+// https://github.com/vasturiano/d3-binarytree v0.2.0 Copyright 2021 Vasco Asturiano
+(function (global, factory) {
+ true ? factory(exports) : 0;
+})(this, function (exports) {
+ 'use strict';
+
+ function tree_add(d) {
+ var x = +this._x.call(null, d);
+ return add(this.cover(x), x, d);
+ }
+
+ function add(tree, x, d) {
+ if (isNaN(x)) return tree; // ignore invalid points
+
+ var parent,
+ node = tree._root,
+ leaf = {
+ data: d
+ },
+ x0 = tree._x0,
+ x1 = tree._x1,
+ xm,
+ xp,
+ right,
+ i,
+ j; // If the tree is empty, initialize the root as a leaf.
+
+ if (!node) return tree._root = leaf, tree; // Find the existing leaf for the new point, or add it.
+
+ while (node.length) {
+ if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm;else x1 = xm;
+ if (parent = node, !(node = node[i = +right])) return parent[i] = leaf, tree;
+ } // Is the new point is exactly coincident with the existing point?
+
+
+ xp = +tree._x.call(null, node.data);
+ if (x === xp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree; // Otherwise, split the leaf node until the old and new point are separated.
+
+ do {
+ parent = parent ? parent[i] = new Array(2) : tree._root = new Array(2);
+ if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm;else x1 = xm;
+ } while ((i = +right) === (j = +(xp >= xm)));
+
+ return parent[j] = node, parent[i] = leaf, tree;
+ }
+
+ function addAll(data) {
+ var i,
+ n = data.length,
+ x,
+ xz = new Array(n),
+ x0 = Infinity,
+ x1 = -Infinity; // Compute the points and their extent.
+
+ for (i = 0; i < n; ++i) {
+ if (isNaN(x = +this._x.call(null, data[i]))) continue;
+ xz[i] = x;
+ if (x < x0) x0 = x;
+ if (x > x1) x1 = x;
+ } // If there were no (valid) points, abort.
+
+
+ if (x0 > x1) return this; // Expand the tree to cover the new points.
+
+ this.cover(x0).cover(x1); // Add the new points.
+
+ for (i = 0; i < n; ++i) {
+ add(this, xz[i], data[i]);
+ }
+
+ return this;
+ }
+
+ function tree_cover(x) {
+ if (isNaN(x = +x)) return this; // ignore invalid points
+
+ var x0 = this._x0,
+ x1 = this._x1; // If the binarytree has no extent, initialize them.
+ // Integer extent are necessary so that if we later double the extent,
+ // the existing half boundaries don’t change due to floating point error!
+
+ if (isNaN(x0)) {
+ x1 = (x0 = Math.floor(x)) + 1;
+ } // Otherwise, double repeatedly to cover.
+ else {
+ var z = x1 - x0 || 1,
+ node = this._root,
+ parent,
+ i;
+
+ while (x0 > x || x >= x1) {
+ i = +(x < x0);
+ parent = new Array(2), parent[i] = node, node = parent, z *= 2;
+
+ switch (i) {
+ case 0:
+ x1 = x0 + z;
+ break;
+
+ case 1:
+ x0 = x1 - z;
+ break;
+ }
+ }
+
+ if (this._root && this._root.length) this._root = node;
+ }
+
+ this._x0 = x0;
+ this._x1 = x1;
+ return this;
+ }
+
+ function tree_data() {
+ var data = [];
+ this.visit(function (node) {
+ if (!node.length) do data.push(node.data); while (node = node.next);
+ });
+ return data;
+ }
+
+ function tree_extent(_) {
+ return arguments.length ? this.cover(+_[0][0]).cover(+_[1][0]) : isNaN(this._x0) ? undefined : [[this._x0], [this._x1]];
+ }
+
+ function Half(node, x0, x1) {
+ this.node = node;
+ this.x0 = x0;
+ this.x1 = x1;
+ }
+
+ function tree_find(x, radius) {
+ var data,
+ x0 = this._x0,
+ x1,
+ x2,
+ x3 = this._x1,
+ halves = [],
+ node = this._root,
+ q,
+ i;
+ if (node) halves.push(new Half(node, x0, x3));
+ if (radius == null) radius = Infinity;else {
+ x0 = x - radius;
+ x3 = x + radius;
+ }
+
+ while (q = halves.pop()) {
+ // Stop searching if this half can’t contain a closer node.
+ if (!(node = q.node) || (x1 = q.x0) > x3 || (x2 = q.x1) < x0) continue; // Bisect the current half.
+
+ if (node.length) {
+ var xm = (x1 + x2) / 2;
+ halves.push(new Half(node[1], xm, x2), new Half(node[0], x1, xm)); // Visit the closest half first.
+
+ if (i = +(x >= xm)) {
+ q = halves[halves.length - 1];
+ halves[halves.length - 1] = halves[halves.length - 1 - i];
+ halves[halves.length - 1 - i] = q;
+ }
+ } // Visit this point. (Visiting coincident points isn’t necessary!)
+ else {
+ var d = Math.abs(x - +this._x.call(null, node.data));
+
+ if (d < radius) {
+ radius = d;
+ x0 = x - d;
+ x3 = x + d;
+ data = node.data;
+ }
+ }
+ }
+
+ return data;
+ }
+
+ function tree_remove(d) {
+ if (isNaN(x = +this._x.call(null, d))) return this; // ignore invalid points
+
+ var parent,
+ node = this._root,
+ retainer,
+ previous,
+ next,
+ x0 = this._x0,
+ x1 = this._x1,
+ x,
+ xm,
+ right,
+ i,
+ j; // If the tree is empty, initialize the root as a leaf.
+
+ if (!node) return this; // Find the leaf node for the point.
+ // While descending, also retain the deepest parent with a non-removed sibling.
+
+ if (node.length) while (true) {
+ if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm;else x1 = xm;
+ if (!(parent = node, node = node[i = +right])) return this;
+ if (!node.length) break;
+ if (parent[i + 1 & 1]) retainer = parent, j = i;
+ } // Find the point to remove.
+
+ while (node.data !== d) if (!(previous = node, node = node.next)) return this;
+
+ if (next = node.next) delete node.next; // If there are multiple coincident points, remove just the point.
+
+ if (previous) return next ? previous.next = next : delete previous.next, this; // If this is the root point, remove it.
+
+ if (!parent) return this._root = next, this; // Remove this leaf.
+
+ next ? parent[i] = next : delete parent[i]; // If the parent now contains exactly one leaf, collapse superfluous parents.
+
+ if ((node = parent[0] || parent[1]) && node === (parent[1] || parent[0]) && !node.length) {
+ if (retainer) retainer[j] = node;else this._root = node;
+ }
+
+ return this;
+ }
+
+ function removeAll(data) {
+ for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]);
+
+ return this;
+ }
+
+ function tree_root() {
+ return this._root;
+ }
+
+ function tree_size() {
+ var size = 0;
+ this.visit(function (node) {
+ if (!node.length) do ++size; while (node = node.next);
+ });
+ return size;
+ }
+
+ function tree_visit(callback) {
+ var halves = [],
+ q,
+ node = this._root,
+ child,
+ x0,
+ x1;
+ if (node) halves.push(new Half(node, this._x0, this._x1));
+
+ while (q = halves.pop()) {
+ if (!callback(node = q.node, x0 = q.x0, x1 = q.x1) && node.length) {
+ var xm = (x0 + x1) / 2;
+ if (child = node[1]) halves.push(new Half(child, xm, x1));
+ if (child = node[0]) halves.push(new Half(child, x0, xm));
+ }
+ }
+
+ return this;
+ }
+
+ function tree_visitAfter(callback) {
+ var halves = [],
+ next = [],
+ q;
+ if (this._root) halves.push(new Half(this._root, this._x0, this._x1));
+
+ while (q = halves.pop()) {
+ var node = q.node;
+
+ if (node.length) {
+ var child,
+ x0 = q.x0,
+ x1 = q.x1,
+ xm = (x0 + x1) / 2;
+ if (child = node[0]) halves.push(new Half(child, x0, xm));
+ if (child = node[1]) halves.push(new Half(child, xm, x1));
+ }
+
+ next.push(q);
+ }
+
+ while (q = next.pop()) {
+ callback(q.node, q.x0, q.x1);
+ }
+
+ return this;
+ }
+
+ function defaultX(d) {
+ return d[0];
+ }
+
+ function tree_x(_) {
+ return arguments.length ? (this._x = _, this) : this._x;
+ }
+
+ function binarytree(nodes, x) {
+ var tree = new Binarytree(x == null ? defaultX : x, NaN, NaN);
+ return nodes == null ? tree : tree.addAll(nodes);
+ }
+
+ function Binarytree(x, x0, x1) {
+ this._x = x;
+ this._x0 = x0;
+ this._x1 = x1;
+ this._root = undefined;
+ }
+
+ function leaf_copy(leaf) {
+ var copy = {
+ data: leaf.data
+ },
+ next = copy;
+
+ while (leaf = leaf.next) next = next.next = {
+ data: leaf.data
+ };
+
+ return copy;
+ }
+
+ var treeProto = binarytree.prototype = Binarytree.prototype;
+
+ treeProto.copy = function () {
+ var copy = new Binarytree(this._x, this._x0, this._x1),
+ node = this._root,
+ nodes,
+ child;
+ if (!node) return copy;
+ if (!node.length) return copy._root = leaf_copy(node), copy;
+ nodes = [{
+ source: node,
+ target: copy._root = new Array(2)
+ }];
+
+ while (node = nodes.pop()) {
+ for (var i = 0; i < 2; ++i) {
+ if (child = node.source[i]) {
+ if (child.length) nodes.push({
+ source: child,
+ target: node.target[i] = new Array(2)
+ });else node.target[i] = leaf_copy(child);
+ }
+ }
+ }
+
+ return copy;
+ };
+
+ treeProto.add = tree_add;
+ treeProto.addAll = addAll;
+ treeProto.cover = tree_cover;
+ treeProto.data = tree_data;
+ treeProto.extent = tree_extent;
+ treeProto.find = tree_find;
+ treeProto.remove = tree_remove;
+ treeProto.removeAll = removeAll;
+ treeProto.root = tree_root;
+ treeProto.size = tree_size;
+ treeProto.visit = tree_visit;
+ treeProto.visitAfter = tree_visitAfter;
+ treeProto.x = tree_x;
+ exports.binarytree = binarytree;
+ Object.defineProperty(exports, '__esModule', {
+ value: true
+ });
+});
+
+/***/ }),
+
+/***/ 624:
+/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+// ESM COMPAT FLAG
+__webpack_require__.r(__webpack_exports__);
+
+// EXPORTS
+__webpack_require__.d(__webpack_exports__, {
+ "forceCenter": function() { return /* reexport */ center; },
+ "forceCollide": function() { return /* reexport */ collide; },
+ "forceLink": function() { return /* reexport */ src_link; },
+ "forceManyBody": function() { return /* reexport */ manyBody; },
+ "forceRadial": function() { return /* reexport */ radial; },
+ "forceSimulation": function() { return /* reexport */ simulation; },
+ "forceX": function() { return /* reexport */ src_x; },
+ "forceY": function() { return /* reexport */ src_y; },
+ "forceZ": function() { return /* reexport */ src_z; }
+});
+
+;// CONCATENATED MODULE: ./node_modules/d3-force-3d/src/center.js
+/* harmony default export */ function center(x, y, z) {
+ var nodes,
+ strength = 1;
+ if (x == null) x = 0;
+ if (y == null) y = 0;
+ if (z == null) z = 0;
+
+ function force() {
+ var i,
+ n = nodes.length,
+ node,
+ sx = 0,
+ sy = 0,
+ sz = 0;
+
+ for (i = 0; i < n; ++i) {
+ node = nodes[i], sx += node.x || 0, sy += node.y || 0, sz += node.z || 0;
+ }
+
+ for (sx = (sx / n - x) * strength, sy = (sy / n - y) * strength, sz = (sz / n - z) * strength, i = 0; i < n; ++i) {
+ node = nodes[i];
+
+ if (sx) {
+ node.x -= sx;
+ }
+
+ if (sy) {
+ node.y -= sy;
+ }
+
+ if (sz) {
+ node.z -= sz;
+ }
+ }
+ }
+
+ force.initialize = function (_) {
+ nodes = _;
+ };
+
+ force.x = function (_) {
+ return arguments.length ? (x = +_, force) : x;
+ };
+
+ force.y = function (_) {
+ return arguments.length ? (y = +_, force) : y;
+ };
+
+ force.z = function (_) {
+ return arguments.length ? (z = +_, force) : z;
+ };
+
+ force.strength = function (_) {
+ return arguments.length ? (strength = +_, force) : strength;
+ };
+
+ return force;
+}
+// EXTERNAL MODULE: ./node_modules/d3-binarytree/dist/d3-binarytree.js
+var d3_binarytree = __webpack_require__(265);
+;// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/add.js
+/* harmony default export */ function add(d) {
+ const x = +this._x.call(null, d),
+ y = +this._y.call(null, d);
+ return add_add(this.cover(x, y), x, y, d);
+}
+
+function add_add(tree, x, y, d) {
+ if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points
+
+ var parent,
+ node = tree._root,
+ leaf = {
+ data: d
+ },
+ x0 = tree._x0,
+ y0 = tree._y0,
+ x1 = tree._x1,
+ y1 = tree._y1,
+ xm,
+ ym,
+ xp,
+ yp,
+ right,
+ bottom,
+ i,
+ j; // If the tree is empty, initialize the root as a leaf.
+
+ if (!node) return tree._root = leaf, tree; // Find the existing leaf for the new point, or add it.
+
+ while (node.length) {
+ if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm;else x1 = xm;
+ if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym;else y1 = ym;
+ if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree;
+ } // Is the new point is exactly coincident with the existing point?
+
+
+ xp = +tree._x.call(null, node.data);
+ yp = +tree._y.call(null, node.data);
+ if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree; // Otherwise, split the leaf node until the old and new point are separated.
+
+ do {
+ parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4);
+ if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm;else x1 = xm;
+ if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym;else y1 = ym;
+ } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | xp >= xm));
+
+ return parent[j] = node, parent[i] = leaf, tree;
+}
+
+function addAll(data) {
+ var d,
+ i,
+ n = data.length,
+ x,
+ y,
+ xz = new Array(n),
+ yz = new Array(n),
+ x0 = Infinity,
+ y0 = Infinity,
+ x1 = -Infinity,
+ y1 = -Infinity; // Compute the points and their extent.
+
+ for (i = 0; i < n; ++i) {
+ if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue;
+ xz[i] = x;
+ yz[i] = y;
+ if (x < x0) x0 = x;
+ if (x > x1) x1 = x;
+ if (y < y0) y0 = y;
+ if (y > y1) y1 = y;
+ } // If there were no (valid) points, abort.
+
+
+ if (x0 > x1 || y0 > y1) return this; // Expand the tree to cover the new points.
+
+ this.cover(x0, y0).cover(x1, y1); // Add the new points.
+
+ for (i = 0; i < n; ++i) {
+ add_add(this, xz[i], yz[i], data[i]);
+ }
+
+ return this;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/cover.js
+/* harmony default export */ function cover(x, y) {
+ if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points
+
+ var x0 = this._x0,
+ y0 = this._y0,
+ x1 = this._x1,
+ y1 = this._y1; // If the quadtree has no extent, initialize them.
+ // Integer extent are necessary so that if we later double the extent,
+ // the existing quadrant boundaries don’t change due to floating point error!
+
+ if (isNaN(x0)) {
+ x1 = (x0 = Math.floor(x)) + 1;
+ y1 = (y0 = Math.floor(y)) + 1;
+ } // Otherwise, double repeatedly to cover.
+ else {
+ var z = x1 - x0 || 1,
+ node = this._root,
+ parent,
+ i;
+
+ while (x0 > x || x >= x1 || y0 > y || y >= y1) {
+ i = (y < y0) << 1 | x < x0;
+ parent = new Array(4), parent[i] = node, node = parent, z *= 2;
+
+ switch (i) {
+ case 0:
+ x1 = x0 + z, y1 = y0 + z;
+ break;
+
+ case 1:
+ x0 = x1 - z, y1 = y0 + z;
+ break;
+
+ case 2:
+ x1 = x0 + z, y0 = y1 - z;
+ break;
+
+ case 3:
+ x0 = x1 - z, y0 = y1 - z;
+ break;
+ }
+ }
+
+ if (this._root && this._root.length) this._root = node;
+ }
+
+ this._x0 = x0;
+ this._y0 = y0;
+ this._x1 = x1;
+ this._y1 = y1;
+ return this;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/data.js
+/* harmony default export */ function data() {
+ var data = [];
+ this.visit(function (node) {
+ if (!node.length) do data.push(node.data); while (node = node.next);
+ });
+ return data;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/extent.js
+/* harmony default export */ function extent(_) {
+ return arguments.length ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) : isNaN(this._x0) ? undefined : [[this._x0, this._y0], [this._x1, this._y1]];
+}
+;// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/quad.js
+/* harmony default export */ function quad(node, x0, y0, x1, y1) {
+ this.node = node;
+ this.x0 = x0;
+ this.y0 = y0;
+ this.x1 = x1;
+ this.y1 = y1;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/find.js
+
+/* harmony default export */ function find(x, y, radius) {
+ var data,
+ x0 = this._x0,
+ y0 = this._y0,
+ x1,
+ y1,
+ x2,
+ y2,
+ x3 = this._x1,
+ y3 = this._y1,
+ quads = [],
+ node = this._root,
+ q,
+ i;
+ if (node) quads.push(new quad(node, x0, y0, x3, y3));
+ if (radius == null) radius = Infinity;else {
+ x0 = x - radius, y0 = y - radius;
+ x3 = x + radius, y3 = y + radius;
+ radius *= radius;
+ }
+
+ while (q = quads.pop()) {
+ // Stop searching if this quadrant can’t contain a closer node.
+ if (!(node = q.node) || (x1 = q.x0) > x3 || (y1 = q.y0) > y3 || (x2 = q.x1) < x0 || (y2 = q.y1) < y0) continue; // Bisect the current quadrant.
+
+ if (node.length) {
+ var xm = (x1 + x2) / 2,
+ ym = (y1 + y2) / 2;
+ quads.push(new quad(node[3], xm, ym, x2, y2), new quad(node[2], x1, ym, xm, y2), new quad(node[1], xm, y1, x2, ym), new quad(node[0], x1, y1, xm, ym)); // Visit the closest quadrant first.
+
+ if (i = (y >= ym) << 1 | x >= xm) {
+ q = quads[quads.length - 1];
+ quads[quads.length - 1] = quads[quads.length - 1 - i];
+ quads[quads.length - 1 - i] = q;
+ }
+ } // Visit this point. (Visiting coincident points isn’t necessary!)
+ else {
+ var dx = x - +this._x.call(null, node.data),
+ dy = y - +this._y.call(null, node.data),
+ d2 = dx * dx + dy * dy;
+
+ if (d2 < radius) {
+ var d = Math.sqrt(radius = d2);
+ x0 = x - d, y0 = y - d;
+ x3 = x + d, y3 = y + d;
+ data = node.data;
+ }
+ }
+ }
+
+ return data;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/remove.js
+/* harmony default export */ function remove(d) {
+ if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points
+
+ var parent,
+ node = this._root,
+ retainer,
+ previous,
+ next,
+ x0 = this._x0,
+ y0 = this._y0,
+ x1 = this._x1,
+ y1 = this._y1,
+ x,
+ y,
+ xm,
+ ym,
+ right,
+ bottom,
+ i,
+ j; // If the tree is empty, initialize the root as a leaf.
+
+ if (!node) return this; // Find the leaf node for the point.
+ // While descending, also retain the deepest parent with a non-removed sibling.
+
+ if (node.length) while (true) {
+ if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm;else x1 = xm;
+ if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym;else y1 = ym;
+ if (!(parent = node, node = node[i = bottom << 1 | right])) return this;
+ if (!node.length) break;
+ if (parent[i + 1 & 3] || parent[i + 2 & 3] || parent[i + 3 & 3]) retainer = parent, j = i;
+ } // Find the point to remove.
+
+ while (node.data !== d) if (!(previous = node, node = node.next)) return this;
+
+ if (next = node.next) delete node.next; // If there are multiple coincident points, remove just the point.
+
+ if (previous) return next ? previous.next = next : delete previous.next, this; // If this is the root point, remove it.
+
+ if (!parent) return this._root = next, this; // Remove this leaf.
+
+ next ? parent[i] = next : delete parent[i]; // If the parent now contains exactly one leaf, collapse superfluous parents.
+
+ if ((node = parent[0] || parent[1] || parent[2] || parent[3]) && node === (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) {
+ if (retainer) retainer[j] = node;else this._root = node;
+ }
+
+ return this;
+}
+function removeAll(data) {
+ for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]);
+
+ return this;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/root.js
+/* harmony default export */ function root() {
+ return this._root;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/size.js
+/* harmony default export */ function size() {
+ var size = 0;
+ this.visit(function (node) {
+ if (!node.length) do ++size; while (node = node.next);
+ });
+ return size;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/visit.js
+
+/* harmony default export */ function visit(callback) {
+ var quads = [],
+ q,
+ node = this._root,
+ child,
+ x0,
+ y0,
+ x1,
+ y1;
+ if (node) quads.push(new quad(node, this._x0, this._y0, this._x1, this._y1));
+
+ while (q = quads.pop()) {
+ if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) {
+ var xm = (x0 + x1) / 2,
+ ym = (y0 + y1) / 2;
+ if (child = node[3]) quads.push(new quad(child, xm, ym, x1, y1));
+ if (child = node[2]) quads.push(new quad(child, x0, ym, xm, y1));
+ if (child = node[1]) quads.push(new quad(child, xm, y0, x1, ym));
+ if (child = node[0]) quads.push(new quad(child, x0, y0, xm, ym));
+ }
+ }
+
+ return this;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/visitAfter.js
+
+/* harmony default export */ function visitAfter(callback) {
+ var quads = [],
+ next = [],
+ q;
+ if (this._root) quads.push(new quad(this._root, this._x0, this._y0, this._x1, this._y1));
+
+ while (q = quads.pop()) {
+ var node = q.node;
+
+ if (node.length) {
+ var child,
+ x0 = q.x0,
+ y0 = q.y0,
+ x1 = q.x1,
+ y1 = q.y1,
+ xm = (x0 + x1) / 2,
+ ym = (y0 + y1) / 2;
+ if (child = node[0]) quads.push(new quad(child, x0, y0, xm, ym));
+ if (child = node[1]) quads.push(new quad(child, xm, y0, x1, ym));
+ if (child = node[2]) quads.push(new quad(child, x0, ym, xm, y1));
+ if (child = node[3]) quads.push(new quad(child, xm, ym, x1, y1));
+ }
+
+ next.push(q);
+ }
+
+ while (q = next.pop()) {
+ callback(q.node, q.x0, q.y0, q.x1, q.y1);
+ }
+
+ return this;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/x.js
+function defaultX(d) {
+ return d[0];
+}
+/* harmony default export */ function x(_) {
+ return arguments.length ? (this._x = _, this) : this._x;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/y.js
+function defaultY(d) {
+ return d[1];
+}
+/* harmony default export */ function y(_) {
+ return arguments.length ? (this._y = _, this) : this._y;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/quadtree.js
+
+
+
+
+
+
+
+
+
+
+
+
+function quadtree(nodes, x, y) {
+ var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN);
+ return nodes == null ? tree : tree.addAll(nodes);
+}
+
+function Quadtree(x, y, x0, y0, x1, y1) {
+ this._x = x;
+ this._y = y;
+ this._x0 = x0;
+ this._y0 = y0;
+ this._x1 = x1;
+ this._y1 = y1;
+ this._root = undefined;
+}
+
+function leaf_copy(leaf) {
+ var copy = {
+ data: leaf.data
+ },
+ next = copy;
+
+ while (leaf = leaf.next) next = next.next = {
+ data: leaf.data
+ };
+
+ return copy;
+}
+
+var treeProto = quadtree.prototype = Quadtree.prototype;
+
+treeProto.copy = function () {
+ var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1),
+ node = this._root,
+ nodes,
+ child;
+ if (!node) return copy;
+ if (!node.length) return copy._root = leaf_copy(node), copy;
+ nodes = [{
+ source: node,
+ target: copy._root = new Array(4)
+ }];
+
+ while (node = nodes.pop()) {
+ for (var i = 0; i < 4; ++i) {
+ if (child = node.source[i]) {
+ if (child.length) nodes.push({
+ source: child,
+ target: node.target[i] = new Array(4)
+ });else node.target[i] = leaf_copy(child);
+ }
+ }
+ }
+
+ return copy;
+};
+
+treeProto.add = add;
+treeProto.addAll = addAll;
+treeProto.cover = cover;
+treeProto.data = data;
+treeProto.extent = extent;
+treeProto.find = find;
+treeProto.remove = remove;
+treeProto.removeAll = removeAll;
+treeProto.root = root;
+treeProto.size = size;
+treeProto.visit = visit;
+treeProto.visitAfter = visitAfter;
+treeProto.x = x;
+treeProto.y = y;
+// EXTERNAL MODULE: ./node_modules/d3-octree/dist/d3-octree.js
+var d3_octree = __webpack_require__(681);
+;// CONCATENATED MODULE: ./node_modules/d3-force-3d/src/constant.js
+/* harmony default export */ function constant(x) {
+ return function () {
+ return x;
+ };
+}
+;// CONCATENATED MODULE: ./node_modules/d3-force-3d/src/jiggle.js
+/* harmony default export */ function jiggle(random) {
+ return (random() - 0.5) * 1e-6;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-force-3d/src/collide.js
+
+
+
+
+
+
+function collide_x(d) {
+ return d.x + d.vx;
+}
+
+function collide_y(d) {
+ return d.y + d.vy;
+}
+
+function z(d) {
+ return d.z + d.vz;
+}
+
+/* harmony default export */ function collide(radius) {
+ var nodes,
+ nDim,
+ radii,
+ random,
+ strength = 1,
+ iterations = 1;
+ if (typeof radius !== "function") radius = constant(radius == null ? 1 : +radius);
+
+ function force() {
+ var i,
+ n = nodes.length,
+ tree,
+ node,
+ xi,
+ yi,
+ zi,
+ ri,
+ ri2;
+
+ for (var k = 0; k < iterations; ++k) {
+ tree = (nDim === 1 ? (0,d3_binarytree.binarytree)(nodes, collide_x) : nDim === 2 ? quadtree(nodes, collide_x, collide_y) : nDim === 3 ? (0,d3_octree.octree)(nodes, collide_x, collide_y, z) : null).visitAfter(prepare);
+
+ for (i = 0; i < n; ++i) {
+ node = nodes[i];
+ ri = radii[node.index], ri2 = ri * ri;
+ xi = node.x + node.vx;
+
+ if (nDim > 1) {
+ yi = node.y + node.vy;
+ }
+
+ if (nDim > 2) {
+ zi = node.z + node.vz;
+ }
+
+ tree.visit(apply);
+ }
+ }
+
+ function apply(treeNode, arg1, arg2, arg3, arg4, arg5, arg6) {
+ var args = [arg1, arg2, arg3, arg4, arg5, arg6];
+ var x0 = args[0],
+ y0 = args[1],
+ z0 = args[2],
+ x1 = args[nDim],
+ y1 = args[nDim + 1],
+ z1 = args[nDim + 2];
+ var data = treeNode.data,
+ rj = treeNode.r,
+ r = ri + rj;
+
+ if (data) {
+ if (data.index > node.index) {
+ var x = xi - data.x - data.vx,
+ y = nDim > 1 ? yi - data.y - data.vy : 0,
+ z = nDim > 2 ? zi - data.z - data.vz : 0,
+ l = x * x + y * y + z * z;
+
+ if (l < r * r) {
+ if (x === 0) x = jiggle(random), l += x * x;
+ if (nDim > 1 && y === 0) y = jiggle(random), l += y * y;
+ if (nDim > 2 && z === 0) z = jiggle(random), l += z * z;
+ l = (r - (l = Math.sqrt(l))) / l * strength;
+ node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj));
+
+ if (nDim > 1) {
+ node.vy += (y *= l) * r;
+ }
+
+ if (nDim > 2) {
+ node.vz += (z *= l) * r;
+ }
+
+ data.vx -= x * (r = 1 - r);
+
+ if (nDim > 1) {
+ data.vy -= y * r;
+ }
+
+ if (nDim > 2) {
+ data.vz -= z * r;
+ }
+ }
+ }
+
+ return;
+ }
+
+ return x0 > xi + r || x1 < xi - r || nDim > 1 && (y0 > yi + r || y1 < yi - r) || nDim > 2 && (z0 > zi + r || z1 < zi - r);
+ }
+ }
+
+ function prepare(treeNode) {
+ if (treeNode.data) return treeNode.r = radii[treeNode.data.index];
+
+ for (var i = treeNode.r = 0; i < Math.pow(2, nDim); ++i) {
+ if (treeNode[i] && treeNode[i].r > treeNode.r) {
+ treeNode.r = treeNode[i].r;
+ }
+ }
+ }
+
+ function initialize() {
+ if (!nodes) return;
+ var i,
+ n = nodes.length,
+ node;
+ radii = new Array(n);
+
+ for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes);
+ }
+
+ force.initialize = function (_nodes, ...args) {
+ nodes = _nodes;
+ random = args.find(arg => typeof arg === 'function') || Math.random;
+ nDim = args.find(arg => [1, 2, 3].includes(arg)) || 2;
+ initialize();
+ };
+
+ force.iterations = function (_) {
+ return arguments.length ? (iterations = +_, force) : iterations;
+ };
+
+ force.strength = function (_) {
+ return arguments.length ? (strength = +_, force) : strength;
+ };
+
+ force.radius = function (_) {
+ return arguments.length ? (radius = typeof _ === "function" ? _ : constant(+_), initialize(), force) : radius;
+ };
+
+ return force;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-force-3d/src/link.js
+
+
+
+function index(d) {
+ return d.index;
+}
+
+function link_find(nodeById, nodeId) {
+ var node = nodeById.get(nodeId);
+ if (!node) throw new Error("node not found: " + nodeId);
+ return node;
+}
+
+/* harmony default export */ function src_link(links) {
+ var id = index,
+ strength = defaultStrength,
+ strengths,
+ distance = constant(30),
+ distances,
+ nodes,
+ nDim,
+ count,
+ bias,
+ random,
+ iterations = 1;
+ if (links == null) links = [];
+
+ function defaultStrength(link) {
+ return 1 / Math.min(count[link.source.index], count[link.target.index]);
+ }
+
+ function force(alpha) {
+ for (var k = 0, n = links.length; k < iterations; ++k) {
+ for (var i = 0, link, source, target, x = 0, y = 0, z = 0, l, b; i < n; ++i) {
+ link = links[i], source = link.source, target = link.target;
+ x = target.x + target.vx - source.x - source.vx || jiggle(random);
+
+ if (nDim > 1) {
+ y = target.y + target.vy - source.y - source.vy || jiggle(random);
+ }
+
+ if (nDim > 2) {
+ z = target.z + target.vz - source.z - source.vz || jiggle(random);
+ }
+
+ l = Math.sqrt(x * x + y * y + z * z);
+ l = (l - distances[i]) / l * alpha * strengths[i];
+ x *= l, y *= l, z *= l;
+ target.vx -= x * (b = bias[i]);
+
+ if (nDim > 1) {
+ target.vy -= y * b;
+ }
+
+ if (nDim > 2) {
+ target.vz -= z * b;
+ }
+
+ source.vx += x * (b = 1 - b);
+
+ if (nDim > 1) {
+ source.vy += y * b;
+ }
+
+ if (nDim > 2) {
+ source.vz += z * b;
+ }
+ }
+ }
+ }
+
+ function initialize() {
+ if (!nodes) return;
+ var i,
+ n = nodes.length,
+ m = links.length,
+ nodeById = new Map(nodes.map((d, i) => [id(d, i, nodes), d])),
+ link;
+
+ for (i = 0, count = new Array(n); i < m; ++i) {
+ link = links[i], link.index = i;
+ if (typeof link.source !== "object") link.source = link_find(nodeById, link.source);
+ if (typeof link.target !== "object") link.target = link_find(nodeById, link.target);
+ count[link.source.index] = (count[link.source.index] || 0) + 1;
+ count[link.target.index] = (count[link.target.index] || 0) + 1;
+ }
+
+ for (i = 0, bias = new Array(m); i < m; ++i) {
+ link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]);
+ }
+
+ strengths = new Array(m), initializeStrength();
+ distances = new Array(m), initializeDistance();
+ }
+
+ function initializeStrength() {
+ if (!nodes) return;
+
+ for (var i = 0, n = links.length; i < n; ++i) {
+ strengths[i] = +strength(links[i], i, links);
+ }
+ }
+
+ function initializeDistance() {
+ if (!nodes) return;
+
+ for (var i = 0, n = links.length; i < n; ++i) {
+ distances[i] = +distance(links[i], i, links);
+ }
+ }
+
+ force.initialize = function (_nodes, ...args) {
+ nodes = _nodes;
+ random = args.find(arg => typeof arg === 'function') || Math.random;
+ nDim = args.find(arg => [1, 2, 3].includes(arg)) || 2;
+ initialize();
+ };
+
+ force.links = function (_) {
+ return arguments.length ? (links = _, initialize(), force) : links;
+ };
+
+ force.id = function (_) {
+ return arguments.length ? (id = _, force) : id;
+ };
+
+ force.iterations = function (_) {
+ return arguments.length ? (iterations = +_, force) : iterations;
+ };
+
+ force.strength = function (_) {
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initializeStrength(), force) : strength;
+ };
+
+ force.distance = function (_) {
+ return arguments.length ? (distance = typeof _ === "function" ? _ : constant(+_), initializeDistance(), force) : distance;
+ };
+
+ return force;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-dispatch/src/dispatch.js
+var noop = {
+ value: () => {}
+};
+
+function dispatch() {
+ for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {
+ if (!(t = arguments[i] + "") || t in _ || /[\s.]/.test(t)) throw new Error("illegal type: " + t);
+ _[t] = [];
+ }
+
+ return new Dispatch(_);
+}
+
+function Dispatch(_) {
+ this._ = _;
+}
+
+function parseTypenames(typenames, types) {
+ return typenames.trim().split(/^|\s+/).map(function (t) {
+ var name = "",
+ i = t.indexOf(".");
+ if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
+ if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t);
+ return {
+ type: t,
+ name: name
+ };
+ });
+}
+
+Dispatch.prototype = dispatch.prototype = {
+ constructor: Dispatch,
+ on: function (typename, callback) {
+ var _ = this._,
+ T = parseTypenames(typename + "", _),
+ t,
+ i = -1,
+ n = T.length; // If no callback was specified, return the callback of the given type and name.
+
+ if (arguments.length < 2) {
+ while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;
+
+ return;
+ } // If a type was specified, set the callback for the given type and name.
+ // Otherwise, if a null callback was specified, remove callbacks of the given name.
+
+
+ if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
+
+ while (++i < n) {
+ if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);
+ }
+
+ return this;
+ },
+ copy: function () {
+ var copy = {},
+ _ = this._;
+
+ for (var t in _) copy[t] = _[t].slice();
+
+ return new Dispatch(copy);
+ },
+ call: function (type, that) {
+ if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];
+ if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
+
+ for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
+ },
+ apply: function (type, that, args) {
+ if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
+
+ for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
+ }
+};
+
+function get(type, name) {
+ for (var i = 0, n = type.length, c; i < n; ++i) {
+ if ((c = type[i]).name === name) {
+ return c.value;
+ }
+ }
+}
+
+function set(type, name, callback) {
+ for (var i = 0, n = type.length; i < n; ++i) {
+ if (type[i].name === name) {
+ type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));
+ break;
+ }
+ }
+
+ if (callback != null) type.push({
+ name: name,
+ value: callback
+ });
+ return type;
+}
+
+/* harmony default export */ var src_dispatch = (dispatch);
+;// CONCATENATED MODULE: ./node_modules/d3-timer/src/timer.js
+var timer_frame = 0,
+ // is an animation frame pending?
+timeout = 0,
+ // is a timeout pending?
+interval = 0,
+ // are any timers active?
+pokeDelay = 1000,
+ // how frequently we check for clock skew
+taskHead,
+ taskTail,
+ clockLast = 0,
+ clockNow = 0,
+ clockSkew = 0,
+ clock = typeof performance === "object" && performance.now ? performance : Date,
+ setFrame = false ? 0 : function (f) {
+ setTimeout(f, 17);
+};
+function now() {
+ return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
+}
+
+function clearNow() {
+ clockNow = 0;
+}
+
+function Timer() {
+ this._call = this._time = this._next = null;
+}
+Timer.prototype = timer.prototype = {
+ constructor: Timer,
+ restart: function (callback, delay, time) {
+ if (typeof callback !== "function") throw new TypeError("callback is not a function");
+ time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
+
+ if (!this._next && taskTail !== this) {
+ if (taskTail) taskTail._next = this;else taskHead = this;
+ taskTail = this;
+ }
+
+ this._call = callback;
+ this._time = time;
+ sleep();
+ },
+ stop: function () {
+ if (this._call) {
+ this._call = null;
+ this._time = Infinity;
+ sleep();
+ }
+ }
+};
+function timer(callback, delay, time) {
+ var t = new Timer();
+ t.restart(callback, delay, time);
+ return t;
+}
+function timerFlush() {
+ now(); // Get the current time, if not already set.
+
+ ++timer_frame; // Pretend we’ve set an alarm, if we haven’t already.
+
+ var t = taskHead,
+ e;
+
+ while (t) {
+ if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);
+ t = t._next;
+ }
+
+ --timer_frame;
+}
+
+function wake() {
+ clockNow = (clockLast = clock.now()) + clockSkew;
+ timer_frame = timeout = 0;
+
+ try {
+ timerFlush();
+ } finally {
+ timer_frame = 0;
+ nap();
+ clockNow = 0;
+ }
+}
+
+function poke() {
+ var now = clock.now(),
+ delay = now - clockLast;
+ if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
+}
+
+function nap() {
+ var t0,
+ t1 = taskHead,
+ t2,
+ time = Infinity;
+
+ while (t1) {
+ if (t1._call) {
+ if (time > t1._time) time = t1._time;
+ t0 = t1, t1 = t1._next;
+ } else {
+ t2 = t1._next, t1._next = null;
+ t1 = t0 ? t0._next = t2 : taskHead = t2;
+ }
+ }
+
+ taskTail = t0;
+ sleep(time);
+}
+
+function sleep(time) {
+ if (timer_frame) return; // Soonest alarm already set, or will be.
+
+ if (timeout) timeout = clearTimeout(timeout);
+ var delay = time - clockNow; // Strictly less than if we recomputed clockNow.
+
+ if (delay > 24) {
+ if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
+ if (interval) interval = clearInterval(interval);
+ } else {
+ if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
+ timer_frame = 1, setFrame(wake);
+ }
+}
+;// CONCATENATED MODULE: ./node_modules/d3-force-3d/src/lcg.js
+// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use
+const a = 1664525;
+const c = 1013904223;
+const m = 4294967296; // 2^32
+
+/* harmony default export */ function lcg() {
+ let s = 1;
+ return () => (s = (a * s + c) % m) / m;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-force-3d/src/simulation.js
+
+
+
+var MAX_DIMENSIONS = 3;
+function simulation_x(d) {
+ return d.x;
+}
+function simulation_y(d) {
+ return d.y;
+}
+function simulation_z(d) {
+ return d.z;
+}
+var initialRadius = 10,
+ initialAngleRoll = Math.PI * (3 - Math.sqrt(5)),
+ // Golden ratio angle
+initialAngleYaw = Math.PI * 20 / (9 + Math.sqrt(221)); // Markov irrational number
+
+/* harmony default export */ function simulation(nodes, numDimensions) {
+ numDimensions = numDimensions || 2;
+ var nDim = Math.min(MAX_DIMENSIONS, Math.max(1, Math.round(numDimensions))),
+ simulation,
+ alpha = 1,
+ alphaMin = 0.001,
+ alphaDecay = 1 - Math.pow(alphaMin, 1 / 300),
+ alphaTarget = 0,
+ velocityDecay = 0.6,
+ forces = new Map(),
+ stepper = timer(step),
+ event = src_dispatch("tick", "end"),
+ random = lcg();
+ if (nodes == null) nodes = [];
+
+ function step() {
+ tick();
+ event.call("tick", simulation);
+
+ if (alpha < alphaMin) {
+ stepper.stop();
+ event.call("end", simulation);
+ }
+ }
+
+ function tick(iterations) {
+ var i,
+ n = nodes.length,
+ node;
+ if (iterations === undefined) iterations = 1;
+
+ for (var k = 0; k < iterations; ++k) {
+ alpha += (alphaTarget - alpha) * alphaDecay;
+ forces.forEach(function (force) {
+ force(alpha);
+ });
+
+ for (i = 0; i < n; ++i) {
+ node = nodes[i];
+ if (node.fx == null) node.x += node.vx *= velocityDecay;else node.x = node.fx, node.vx = 0;
+
+ if (nDim > 1) {
+ if (node.fy == null) node.y += node.vy *= velocityDecay;else node.y = node.fy, node.vy = 0;
+ }
+
+ if (nDim > 2) {
+ if (node.fz == null) node.z += node.vz *= velocityDecay;else node.z = node.fz, node.vz = 0;
+ }
+ }
+ }
+
+ return simulation;
+ }
+
+ function initializeNodes() {
+ for (var i = 0, n = nodes.length, node; i < n; ++i) {
+ node = nodes[i], node.index = i;
+ if (node.fx != null) node.x = node.fx;
+ if (node.fy != null) node.y = node.fy;
+ if (node.fz != null) node.z = node.fz;
+
+ if (isNaN(node.x) || nDim > 1 && isNaN(node.y) || nDim > 2 && isNaN(node.z)) {
+ var radius = initialRadius * (nDim > 2 ? Math.cbrt(0.5 + i) : nDim > 1 ? Math.sqrt(0.5 + i) : i),
+ rollAngle = i * initialAngleRoll,
+ yawAngle = i * initialAngleYaw;
+
+ if (nDim === 1) {
+ node.x = radius;
+ } else if (nDim === 2) {
+ node.x = radius * Math.cos(rollAngle);
+ node.y = radius * Math.sin(rollAngle);
+ } else {
+ // 3 dimensions: use spherical distribution along 2 irrational number angles
+ node.x = radius * Math.sin(rollAngle) * Math.cos(yawAngle);
+ node.y = radius * Math.cos(rollAngle);
+ node.z = radius * Math.sin(rollAngle) * Math.sin(yawAngle);
+ }
+ }
+
+ if (isNaN(node.vx) || nDim > 1 && isNaN(node.vy) || nDim > 2 && isNaN(node.vz)) {
+ node.vx = 0;
+
+ if (nDim > 1) {
+ node.vy = 0;
+ }
+
+ if (nDim > 2) {
+ node.vz = 0;
+ }
+ }
+ }
+ }
+
+ function initializeForce(force) {
+ if (force.initialize) force.initialize(nodes, random, nDim);
+ return force;
+ }
+
+ initializeNodes();
+ return simulation = {
+ tick: tick,
+ restart: function () {
+ return stepper.restart(step), simulation;
+ },
+ stop: function () {
+ return stepper.stop(), simulation;
+ },
+ numDimensions: function (_) {
+ return arguments.length ? (nDim = Math.min(MAX_DIMENSIONS, Math.max(1, Math.round(_))), forces.forEach(initializeForce), simulation) : nDim;
+ },
+ nodes: function (_) {
+ return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation) : nodes;
+ },
+ alpha: function (_) {
+ return arguments.length ? (alpha = +_, simulation) : alpha;
+ },
+ alphaMin: function (_) {
+ return arguments.length ? (alphaMin = +_, simulation) : alphaMin;
+ },
+ alphaDecay: function (_) {
+ return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay;
+ },
+ alphaTarget: function (_) {
+ return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget;
+ },
+ velocityDecay: function (_) {
+ return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay;
+ },
+ randomSource: function (_) {
+ return arguments.length ? (random = _, forces.forEach(initializeForce), simulation) : random;
+ },
+ force: function (name, _) {
+ return arguments.length > 1 ? (_ == null ? forces.delete(name) : forces.set(name, initializeForce(_)), simulation) : forces.get(name);
+ },
+ find: function () {
+ var args = Array.prototype.slice.call(arguments);
+ var x = args.shift() || 0,
+ y = (nDim > 1 ? args.shift() : null) || 0,
+ z = (nDim > 2 ? args.shift() : null) || 0,
+ radius = args.shift() || Infinity;
+ var i = 0,
+ n = nodes.length,
+ dx,
+ dy,
+ dz,
+ d2,
+ node,
+ closest;
+ radius *= radius;
+
+ for (i = 0; i < n; ++i) {
+ node = nodes[i];
+ dx = x - node.x;
+ dy = y - (node.y || 0);
+ dz = z - (node.z || 0);
+ d2 = dx * dx + dy * dy + dz * dz;
+ if (d2 < radius) closest = node, radius = d2;
+ }
+
+ return closest;
+ },
+ on: function (name, _) {
+ return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name);
+ }
+ };
+}
+;// CONCATENATED MODULE: ./node_modules/d3-force-3d/src/manyBody.js
+
+
+
+
+
+
+/* harmony default export */ function manyBody() {
+ var nodes,
+ nDim,
+ node,
+ random,
+ alpha,
+ strength = constant(-30),
+ strengths,
+ distanceMin2 = 1,
+ distanceMax2 = Infinity,
+ theta2 = 0.81;
+
+ function force(_) {
+ var i,
+ n = nodes.length,
+ tree = (nDim === 1 ? (0,d3_binarytree.binarytree)(nodes, simulation_x) : nDim === 2 ? quadtree(nodes, simulation_x, simulation_y) : nDim === 3 ? (0,d3_octree.octree)(nodes, simulation_x, simulation_y, simulation_z) : null).visitAfter(accumulate);
+
+ for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply);
+ }
+
+ function initialize() {
+ if (!nodes) return;
+ var i,
+ n = nodes.length,
+ node;
+ strengths = new Array(n);
+
+ for (i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes);
+ }
+
+ function accumulate(treeNode) {
+ var strength = 0,
+ q,
+ c,
+ weight = 0,
+ x,
+ y,
+ z,
+ i;
+ var numChildren = treeNode.length; // For internal nodes, accumulate forces from children.
+
+ if (numChildren) {
+ for (x = y = z = i = 0; i < numChildren; ++i) {
+ if ((q = treeNode[i]) && (c = Math.abs(q.value))) {
+ strength += q.value, weight += c, x += c * (q.x || 0), y += c * (q.y || 0), z += c * (q.z || 0);
+ }
+ }
+
+ strength *= Math.sqrt(4 / numChildren); // scale accumulated strength according to number of dimensions
+
+ treeNode.x = x / weight;
+
+ if (nDim > 1) {
+ treeNode.y = y / weight;
+ }
+
+ if (nDim > 2) {
+ treeNode.z = z / weight;
+ }
+ } // For leaf nodes, accumulate forces from coincident nodes.
+ else {
+ q = treeNode;
+ q.x = q.data.x;
+
+ if (nDim > 1) {
+ q.y = q.data.y;
+ }
+
+ if (nDim > 2) {
+ q.z = q.data.z;
+ }
+
+ do strength += strengths[q.data.index]; while (q = q.next);
+ }
+
+ treeNode.value = strength;
+ }
+
+ function apply(treeNode, x1, arg1, arg2, arg3) {
+ if (!treeNode.value) return true;
+ var x2 = [arg1, arg2, arg3][nDim - 1];
+ var x = treeNode.x - node.x,
+ y = nDim > 1 ? treeNode.y - node.y : 0,
+ z = nDim > 2 ? treeNode.z - node.z : 0,
+ w = x2 - x1,
+ l = x * x + y * y + z * z; // Apply the Barnes-Hut approximation if possible.
+ // Limit forces for very close nodes; randomize direction if coincident.
+
+ if (w * w / theta2 < l) {
+ if (l < distanceMax2) {
+ if (x === 0) x = jiggle(random), l += x * x;
+ if (nDim > 1 && y === 0) y = jiggle(random), l += y * y;
+ if (nDim > 2 && z === 0) z = jiggle(random), l += z * z;
+ if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);
+ node.vx += x * treeNode.value * alpha / l;
+
+ if (nDim > 1) {
+ node.vy += y * treeNode.value * alpha / l;
+ }
+
+ if (nDim > 2) {
+ node.vz += z * treeNode.value * alpha / l;
+ }
+ }
+
+ return true;
+ } // Otherwise, process points directly.
+ else if (treeNode.length || l >= distanceMax2) return; // Limit forces for very close nodes; randomize direction if coincident.
+
+
+ if (treeNode.data !== node || treeNode.next) {
+ if (x === 0) x = jiggle(random), l += x * x;
+ if (nDim > 1 && y === 0) y = jiggle(random), l += y * y;
+ if (nDim > 2 && z === 0) z = jiggle(random), l += z * z;
+ if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);
+ }
+
+ do if (treeNode.data !== node) {
+ w = strengths[treeNode.data.index] * alpha / l;
+ node.vx += x * w;
+
+ if (nDim > 1) {
+ node.vy += y * w;
+ }
+
+ if (nDim > 2) {
+ node.vz += z * w;
+ }
+ } while (treeNode = treeNode.next);
+ }
+
+ force.initialize = function (_nodes, ...args) {
+ nodes = _nodes;
+ random = args.find(arg => typeof arg === 'function') || Math.random;
+ nDim = args.find(arg => [1, 2, 3].includes(arg)) || 2;
+ initialize();
+ };
+
+ force.strength = function (_) {
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength;
+ };
+
+ force.distanceMin = function (_) {
+ return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2);
+ };
+
+ force.distanceMax = function (_) {
+ return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2);
+ };
+
+ force.theta = function (_) {
+ return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2);
+ };
+
+ return force;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-force-3d/src/radial.js
+
+/* harmony default export */ function radial(radius, x, y, z) {
+ var nodes,
+ nDim,
+ strength = constant(0.1),
+ strengths,
+ radiuses;
+ if (typeof radius !== "function") radius = constant(+radius);
+ if (x == null) x = 0;
+ if (y == null) y = 0;
+ if (z == null) z = 0;
+
+ function force(alpha) {
+ for (var i = 0, n = nodes.length; i < n; ++i) {
+ var node = nodes[i],
+ dx = node.x - x || 1e-6,
+ dy = (node.y || 0) - y || 1e-6,
+ dz = (node.z || 0) - z || 1e-6,
+ r = Math.sqrt(dx * dx + dy * dy + dz * dz),
+ k = (radiuses[i] - r) * strengths[i] * alpha / r;
+ node.vx += dx * k;
+
+ if (nDim > 1) {
+ node.vy += dy * k;
+ }
+
+ if (nDim > 2) {
+ node.vz += dz * k;
+ }
+ }
+ }
+
+ function initialize() {
+ if (!nodes) return;
+ var i,
+ n = nodes.length;
+ strengths = new Array(n);
+ radiuses = new Array(n);
+
+ for (i = 0; i < n; ++i) {
+ radiuses[i] = +radius(nodes[i], i, nodes);
+ strengths[i] = isNaN(radiuses[i]) ? 0 : +strength(nodes[i], i, nodes);
+ }
+ }
+
+ force.initialize = function (initNodes, ...args) {
+ nodes = initNodes;
+ nDim = args.find(arg => [1, 2, 3].includes(arg)) || 2;
+ initialize();
+ };
+
+ force.strength = function (_) {
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength;
+ };
+
+ force.radius = function (_) {
+ return arguments.length ? (radius = typeof _ === "function" ? _ : constant(+_), initialize(), force) : radius;
+ };
+
+ force.x = function (_) {
+ return arguments.length ? (x = +_, force) : x;
+ };
+
+ force.y = function (_) {
+ return arguments.length ? (y = +_, force) : y;
+ };
+
+ force.z = function (_) {
+ return arguments.length ? (z = +_, force) : z;
+ };
+
+ return force;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-force-3d/src/x.js
+
+/* harmony default export */ function src_x(x) {
+ var strength = constant(0.1),
+ nodes,
+ strengths,
+ xz;
+ if (typeof x !== "function") x = constant(x == null ? 0 : +x);
+
+ function force(alpha) {
+ for (var i = 0, n = nodes.length, node; i < n; ++i) {
+ node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha;
+ }
+ }
+
+ function initialize() {
+ if (!nodes) return;
+ var i,
+ n = nodes.length;
+ strengths = new Array(n);
+ xz = new Array(n);
+
+ for (i = 0; i < n; ++i) {
+ strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
+ }
+ }
+
+ force.initialize = function (_) {
+ nodes = _;
+ initialize();
+ };
+
+ force.strength = function (_) {
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength;
+ };
+
+ force.x = function (_) {
+ return arguments.length ? (x = typeof _ === "function" ? _ : constant(+_), initialize(), force) : x;
+ };
+
+ return force;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-force-3d/src/y.js
+
+/* harmony default export */ function src_y(y) {
+ var strength = constant(0.1),
+ nodes,
+ strengths,
+ yz;
+ if (typeof y !== "function") y = constant(y == null ? 0 : +y);
+
+ function force(alpha) {
+ for (var i = 0, n = nodes.length, node; i < n; ++i) {
+ node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha;
+ }
+ }
+
+ function initialize() {
+ if (!nodes) return;
+ var i,
+ n = nodes.length;
+ strengths = new Array(n);
+ yz = new Array(n);
+
+ for (i = 0; i < n; ++i) {
+ strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
+ }
+ }
+
+ force.initialize = function (_) {
+ nodes = _;
+ initialize();
+ };
+
+ force.strength = function (_) {
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength;
+ };
+
+ force.y = function (_) {
+ return arguments.length ? (y = typeof _ === "function" ? _ : constant(+_), initialize(), force) : y;
+ };
+
+ return force;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-force-3d/src/z.js
+
+/* harmony default export */ function src_z(z) {
+ var strength = constant(0.1),
+ nodes,
+ strengths,
+ zz;
+ if (typeof z !== "function") z = constant(z == null ? 0 : +z);
+
+ function force(alpha) {
+ for (var i = 0, n = nodes.length, node; i < n; ++i) {
+ node = nodes[i], node.vz += (zz[i] - node.z) * strengths[i] * alpha;
+ }
+ }
+
+ function initialize() {
+ if (!nodes) return;
+ var i,
+ n = nodes.length;
+ strengths = new Array(n);
+ zz = new Array(n);
+
+ for (i = 0; i < n; ++i) {
+ strengths[i] = isNaN(zz[i] = +z(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
+ }
+ }
+
+ force.initialize = function (_) {
+ nodes = _;
+ initialize();
+ };
+
+ force.strength = function (_) {
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength;
+ };
+
+ force.z = function (_) {
+ return arguments.length ? (z = typeof _ === "function" ? _ : constant(+_), initialize(), force) : z;
+ };
+
+ return force;
+}
+;// CONCATENATED MODULE: ./node_modules/d3-force-3d/src/index.js
+
+
+
+
+
+
+
+
+
+
+/***/ }),
+
+/***/ 681:
+/***/ (function(__unused_webpack_module, exports) {
+
+// https://github.com/vasturiano/d3-octree v0.2.0 Copyright 2021 Vasco Asturiano
+(function (global, factory) {
+ true ? factory(exports) : 0;
+})(this, function (exports) {
+ 'use strict';
+
+ function tree_add(d) {
+ var x = +this._x.call(null, d),
+ y = +this._y.call(null, d),
+ z = +this._z.call(null, d);
+ return add(this.cover(x, y, z), x, y, z, d);
+ }
+
+ function add(tree, x, y, z, d) {
+ if (isNaN(x) || isNaN(y) || isNaN(z)) return tree; // ignore invalid points
+
+ var parent,
+ node = tree._root,
+ leaf = {
+ data: d
+ },
+ x0 = tree._x0,
+ y0 = tree._y0,
+ z0 = tree._z0,
+ x1 = tree._x1,
+ y1 = tree._y1,
+ z1 = tree._z1,
+ xm,
+ ym,
+ zm,
+ xp,
+ yp,
+ zp,
+ right,
+ bottom,
+ deep,
+ i,
+ j; // If the tree is empty, initialize the root as a leaf.
+
+ if (!node) return tree._root = leaf, tree; // Find the existing leaf for the new point, or add it.
+
+ while (node.length) {
+ if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm;else x1 = xm;
+ if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym;else y1 = ym;
+ if (deep = z >= (zm = (z0 + z1) / 2)) z0 = zm;else z1 = zm;
+ if (parent = node, !(node = node[i = deep << 2 | bottom << 1 | right])) return parent[i] = leaf, tree;
+ } // Is the new point is exactly coincident with the existing point?
+
+
+ xp = +tree._x.call(null, node.data);
+ yp = +tree._y.call(null, node.data);
+ zp = +tree._z.call(null, node.data);
+ if (x === xp && y === yp && z === zp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree; // Otherwise, split the leaf node until the old and new point are separated.
+
+ do {
+ parent = parent ? parent[i] = new Array(8) : tree._root = new Array(8);
+ if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm;else x1 = xm;
+ if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym;else y1 = ym;
+ if (deep = z >= (zm = (z0 + z1) / 2)) z0 = zm;else z1 = zm;
+ } while ((i = deep << 2 | bottom << 1 | right) === (j = (zp >= zm) << 2 | (yp >= ym) << 1 | xp >= xm));
+
+ return parent[j] = node, parent[i] = leaf, tree;
+ }
+
+ function addAll(data) {
+ var d,
+ i,
+ n = data.length,
+ x,
+ y,
+ z,
+ xz = new Array(n),
+ yz = new Array(n),
+ zz = new Array(n),
+ x0 = Infinity,
+ y0 = Infinity,
+ z0 = Infinity,
+ x1 = -Infinity,
+ y1 = -Infinity,
+ z1 = -Infinity; // Compute the points and their extent.
+
+ for (i = 0; i < n; ++i) {
+ if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d)) || isNaN(z = +this._z.call(null, d))) continue;
+ xz[i] = x;
+ yz[i] = y;
+ zz[i] = z;
+ if (x < x0) x0 = x;
+ if (x > x1) x1 = x;
+ if (y < y0) y0 = y;
+ if (y > y1) y1 = y;
+ if (z < z0) z0 = z;
+ if (z > z1) z1 = z;
+ } // If there were no (valid) points, abort.
+
+
+ if (x0 > x1 || y0 > y1 || z0 > z1) return this; // Expand the tree to cover the new points.
+
+ this.cover(x0, y0, z0).cover(x1, y1, z1); // Add the new points.
+
+ for (i = 0; i < n; ++i) {
+ add(this, xz[i], yz[i], zz[i], data[i]);
+ }
+
+ return this;
+ }
+
+ function tree_cover(x, y, z) {
+ if (isNaN(x = +x) || isNaN(y = +y) || isNaN(z = +z)) return this; // ignore invalid points
+
+ var x0 = this._x0,
+ y0 = this._y0,
+ z0 = this._z0,
+ x1 = this._x1,
+ y1 = this._y1,
+ z1 = this._z1; // If the octree has no extent, initialize them.
+ // Integer extent are necessary so that if we later double the extent,
+ // the existing octant boundaries don’t change due to floating point error!
+
+ if (isNaN(x0)) {
+ x1 = (x0 = Math.floor(x)) + 1;
+ y1 = (y0 = Math.floor(y)) + 1;
+ z1 = (z0 = Math.floor(z)) + 1;
+ } // Otherwise, double repeatedly to cover.
+ else {
+ var t = x1 - x0 || 1,
+ node = this._root,
+ parent,
+ i;
+
+ while (x0 > x || x >= x1 || y0 > y || y >= y1 || z0 > z || z >= z1) {
+ i = (z < z0) << 2 | (y < y0) << 1 | x < x0;
+ parent = new Array(8), parent[i] = node, node = parent, t *= 2;
+
+ switch (i) {
+ case 0:
+ x1 = x0 + t, y1 = y0 + t, z1 = z0 + t;
+ break;
+
+ case 1:
+ x0 = x1 - t, y1 = y0 + t, z1 = z0 + t;
+ break;
+
+ case 2:
+ x1 = x0 + t, y0 = y1 - t, z1 = z0 + t;
+ break;
+
+ case 3:
+ x0 = x1 - t, y0 = y1 - t, z1 = z0 + t;
+ break;
+
+ case 4:
+ x1 = x0 + t, y1 = y0 + t, z0 = z1 - t;
+ break;
+
+ case 5:
+ x0 = x1 - t, y1 = y0 + t, z0 = z1 - t;
+ break;
+
+ case 6:
+ x1 = x0 + t, y0 = y1 - t, z0 = z1 - t;
+ break;
+
+ case 7:
+ x0 = x1 - t, y0 = y1 - t, z0 = z1 - t;
+ break;
+ }
+ }
+
+ if (this._root && this._root.length) this._root = node;
+ }
+
+ this._x0 = x0;
+ this._y0 = y0;
+ this._z0 = z0;
+ this._x1 = x1;
+ this._y1 = y1;
+ this._z1 = z1;
+ return this;
+ }
+
+ function tree_data() {
+ var data = [];
+ this.visit(function (node) {
+ if (!node.length) do data.push(node.data); while (node = node.next);
+ });
+ return data;
+ }
+
+ function tree_extent(_) {
+ return arguments.length ? this.cover(+_[0][0], +_[0][1], +_[0][2]).cover(+_[1][0], +_[1][1], +_[1][2]) : isNaN(this._x0) ? undefined : [[this._x0, this._y0, this._z0], [this._x1, this._y1, this._z1]];
+ }
+
+ function Octant(node, x0, y0, z0, x1, y1, z1) {
+ this.node = node;
+ this.x0 = x0;
+ this.y0 = y0;
+ this.z0 = z0;
+ this.x1 = x1;
+ this.y1 = y1;
+ this.z1 = z1;
+ }
+
+ function tree_find(x, y, z, radius) {
+ var data,
+ x0 = this._x0,
+ y0 = this._y0,
+ z0 = this._z0,
+ x1,
+ y1,
+ z1,
+ x2,
+ y2,
+ z2,
+ x3 = this._x1,
+ y3 = this._y1,
+ z3 = this._z1,
+ octs = [],
+ node = this._root,
+ q,
+ i;
+ if (node) octs.push(new Octant(node, x0, y0, z0, x3, y3, z3));
+ if (radius == null) radius = Infinity;else {
+ x0 = x - radius, y0 = y - radius, z0 = z - radius;
+ x3 = x + radius, y3 = y + radius, z3 = z + radius;
+ radius *= radius;
+ }
+
+ while (q = octs.pop()) {
+ // Stop searching if this octant can’t contain a closer node.
+ if (!(node = q.node) || (x1 = q.x0) > x3 || (y1 = q.y0) > y3 || (z1 = q.z0) > z3 || (x2 = q.x1) < x0 || (y2 = q.y1) < y0 || (z2 = q.z1) < z0) continue; // Bisect the current octant.
+
+ if (node.length) {
+ var xm = (x1 + x2) / 2,
+ ym = (y1 + y2) / 2,
+ zm = (z1 + z2) / 2;
+ octs.push(new Octant(node[7], xm, ym, zm, x2, y2, z2), new Octant(node[6], x1, ym, zm, xm, y2, z2), new Octant(node[5], xm, y1, zm, x2, ym, z2), new Octant(node[4], x1, y1, zm, xm, ym, z2), new Octant(node[3], xm, ym, z1, x2, y2, zm), new Octant(node[2], x1, ym, z1, xm, y2, zm), new Octant(node[1], xm, y1, z1, x2, ym, zm), new Octant(node[0], x1, y1, z1, xm, ym, zm)); // Visit the closest octant first.
+
+ if (i = (z >= zm) << 2 | (y >= ym) << 1 | x >= xm) {
+ q = octs[octs.length - 1];
+ octs[octs.length - 1] = octs[octs.length - 1 - i];
+ octs[octs.length - 1 - i] = q;
+ }
+ } // Visit this point. (Visiting coincident points isn’t necessary!)
+ else {
+ var dx = x - +this._x.call(null, node.data),
+ dy = y - +this._y.call(null, node.data),
+ dz = z - +this._z.call(null, node.data),
+ d2 = dx * dx + dy * dy + dz * dz;
+
+ if (d2 < radius) {
+ var d = Math.sqrt(radius = d2);
+ x0 = x - d, y0 = y - d, z0 = z - d;
+ x3 = x + d, y3 = y + d, z3 = z + d;
+ data = node.data;
+ }
+ }
+ }
+
+ return data;
+ }
+
+ function tree_remove(d) {
+ if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d)) || isNaN(z = +this._z.call(null, d))) return this; // ignore invalid points
+
+ var parent,
+ node = this._root,
+ retainer,
+ previous,
+ next,
+ x0 = this._x0,
+ y0 = this._y0,
+ z0 = this._z0,
+ x1 = this._x1,
+ y1 = this._y1,
+ z1 = this._z1,
+ x,
+ y,
+ z,
+ xm,
+ ym,
+ zm,
+ right,
+ bottom,
+ deep,
+ i,
+ j; // If the tree is empty, initialize the root as a leaf.
+
+ if (!node) return this; // Find the leaf node for the point.
+ // While descending, also retain the deepest parent with a non-removed sibling.
+
+ if (node.length) while (true) {
+ if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm;else x1 = xm;
+ if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym;else y1 = ym;
+ if (deep = z >= (zm = (z0 + z1) / 2)) z0 = zm;else z1 = zm;
+ if (!(parent = node, node = node[i = deep << 2 | bottom << 1 | right])) return this;
+ if (!node.length) break;
+ if (parent[i + 1 & 7] || parent[i + 2 & 7] || parent[i + 3 & 7] || parent[i + 4 & 7] || parent[i + 5 & 7] || parent[i + 6 & 7] || parent[i + 7 & 7]) retainer = parent, j = i;
+ } // Find the point to remove.
+
+ while (node.data !== d) if (!(previous = node, node = node.next)) return this;
+
+ if (next = node.next) delete node.next; // If there are multiple coincident points, remove just the point.
+
+ if (previous) return next ? previous.next = next : delete previous.next, this; // If this is the root point, remove it.
+
+ if (!parent) return this._root = next, this; // Remove this leaf.
+
+ next ? parent[i] = next : delete parent[i]; // If the parent now contains exactly one leaf, collapse superfluous parents.
+
+ if ((node = parent[0] || parent[1] || parent[2] || parent[3] || parent[4] || parent[5] || parent[6] || parent[7]) && node === (parent[7] || parent[6] || parent[5] || parent[4] || parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) {
+ if (retainer) retainer[j] = node;else this._root = node;
+ }
+
+ return this;
+ }
+
+ function removeAll(data) {
+ for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]);
+
+ return this;
+ }
+
+ function tree_root() {
+ return this._root;
+ }
+
+ function tree_size() {
+ var size = 0;
+ this.visit(function (node) {
+ if (!node.length) do ++size; while (node = node.next);
+ });
+ return size;
+ }
+
+ function tree_visit(callback) {
+ var octs = [],
+ q,
+ node = this._root,
+ child,
+ x0,
+ y0,
+ z0,
+ x1,
+ y1,
+ z1;
+ if (node) octs.push(new Octant(node, this._x0, this._y0, this._z0, this._x1, this._y1, this._z1));
+
+ while (q = octs.pop()) {
+ if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, z0 = q.z0, x1 = q.x1, y1 = q.y1, z1 = q.z1) && node.length) {
+ var xm = (x0 + x1) / 2,
+ ym = (y0 + y1) / 2,
+ zm = (z0 + z1) / 2;
+ if (child = node[7]) octs.push(new Octant(child, xm, ym, zm, x1, y1, z1));
+ if (child = node[6]) octs.push(new Octant(child, x0, ym, zm, xm, y1, z1));
+ if (child = node[5]) octs.push(new Octant(child, xm, y0, zm, x1, ym, z1));
+ if (child = node[4]) octs.push(new Octant(child, x0, y0, zm, xm, ym, z1));
+ if (child = node[3]) octs.push(new Octant(child, xm, ym, z0, x1, y1, zm));
+ if (child = node[2]) octs.push(new Octant(child, x0, ym, z0, xm, y1, zm));
+ if (child = node[1]) octs.push(new Octant(child, xm, y0, z0, x1, ym, zm));
+ if (child = node[0]) octs.push(new Octant(child, x0, y0, z0, xm, ym, zm));
+ }
+ }
+
+ return this;
+ }
+
+ function tree_visitAfter(callback) {
+ var octs = [],
+ next = [],
+ q;
+ if (this._root) octs.push(new Octant(this._root, this._x0, this._y0, this._z0, this._x1, this._y1, this._z1));
+
+ while (q = octs.pop()) {
+ var node = q.node;
+
+ if (node.length) {
+ var child,
+ x0 = q.x0,
+ y0 = q.y0,
+ z0 = q.z0,
+ x1 = q.x1,
+ y1 = q.y1,
+ z1 = q.z1,
+ xm = (x0 + x1) / 2,
+ ym = (y0 + y1) / 2,
+ zm = (z0 + z1) / 2;
+ if (child = node[0]) octs.push(new Octant(child, x0, y0, z0, xm, ym, zm));
+ if (child = node[1]) octs.push(new Octant(child, xm, y0, z0, x1, ym, zm));
+ if (child = node[2]) octs.push(new Octant(child, x0, ym, z0, xm, y1, zm));
+ if (child = node[3]) octs.push(new Octant(child, xm, ym, z0, x1, y1, zm));
+ if (child = node[4]) octs.push(new Octant(child, x0, y0, zm, xm, ym, z1));
+ if (child = node[5]) octs.push(new Octant(child, xm, y0, zm, x1, ym, z1));
+ if (child = node[6]) octs.push(new Octant(child, x0, ym, zm, xm, y1, z1));
+ if (child = node[7]) octs.push(new Octant(child, xm, ym, zm, x1, y1, z1));
+ }
+
+ next.push(q);
+ }
+
+ while (q = next.pop()) {
+ callback(q.node, q.x0, q.y0, q.z0, q.x1, q.y1, q.z1);
+ }
+
+ return this;
+ }
+
+ function defaultX(d) {
+ return d[0];
+ }
+
+ function tree_x(_) {
+ return arguments.length ? (this._x = _, this) : this._x;
+ }
+
+ function defaultY(d) {
+ return d[1];
+ }
+
+ function tree_y(_) {
+ return arguments.length ? (this._y = _, this) : this._y;
+ }
+
+ function defaultZ(d) {
+ return d[2];
+ }
+
+ function tree_z(_) {
+ return arguments.length ? (this._z = _, this) : this._z;
+ }
+
+ function octree(nodes, x, y, z) {
+ var tree = new Octree(x == null ? defaultX : x, y == null ? defaultY : y, z == null ? defaultZ : z, NaN, NaN, NaN, NaN, NaN, NaN);
+ return nodes == null ? tree : tree.addAll(nodes);
+ }
+
+ function Octree(x, y, z, x0, y0, z0, x1, y1, z1) {
+ this._x = x;
+ this._y = y;
+ this._z = z;
+ this._x0 = x0;
+ this._y0 = y0;
+ this._z0 = z0;
+ this._x1 = x1;
+ this._y1 = y1;
+ this._z1 = z1;
+ this._root = undefined;
+ }
+
+ function leaf_copy(leaf) {
+ var copy = {
+ data: leaf.data
+ },
+ next = copy;
+
+ while (leaf = leaf.next) next = next.next = {
+ data: leaf.data
+ };
+
+ return copy;
+ }
+
+ var treeProto = octree.prototype = Octree.prototype;
+
+ treeProto.copy = function () {
+ var copy = new Octree(this._x, this._y, this._z, this._x0, this._y0, this._z0, this._x1, this._y1, this._z1),
+ node = this._root,
+ nodes,
+ child;
+ if (!node) return copy;
+ if (!node.length) return copy._root = leaf_copy(node), copy;
+ nodes = [{
+ source: node,
+ target: copy._root = new Array(8)
+ }];
+
+ while (node = nodes.pop()) {
+ for (var i = 0; i < 8; ++i) {
+ if (child = node.source[i]) {
+ if (child.length) nodes.push({
+ source: child,
+ target: node.target[i] = new Array(8)
+ });else node.target[i] = leaf_copy(child);
+ }
+ }
+ }
+
+ return copy;
+ };
+
+ treeProto.add = tree_add;
+ treeProto.addAll = addAll;
+ treeProto.cover = tree_cover;
+ treeProto.data = tree_data;
+ treeProto.extent = tree_extent;
+ treeProto.find = tree_find;
+ treeProto.remove = tree_remove;
+ treeProto.removeAll = removeAll;
+ treeProto.root = tree_root;
+ treeProto.size = tree_size;
+ treeProto.visit = tree_visit;
+ treeProto.visitAfter = tree_visitAfter;
+ treeProto.x = tree_x;
+ treeProto.y = tree_y;
+ treeProto.z = tree_z;
+ exports.octree = octree;
+ Object.defineProperty(exports, '__esModule', {
+ value: true
+ });
+});
+
+/***/ })
+
+};
+; \ No newline at end of file