Add side panels, task selection, graph animation, and project docs

- Foldable left panel (user profile) and right panel (task details)
- Clicking a task in the list or graph node selects it and shows details
- Both views (task list + graph) always mounted via absolute inset-0 for
  correct canvas dimensions; tabs toggle visibility with opacity
- Graph node selection animation: other nodes repel outward (charge -600),
  then selected node smoothly slides to center (500ms cubic ease-out),
  then charge restores to -120 and graph stabilizes
- Graph re-fits on tab switch and panel resize via ResizeObserver
- Fix UUID string IDs throughout (backend returns UUIDs, not integers)
- Add TaskDetailPanel, UserPanel components
- Add CLAUDE.md project documentation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Alvis
2026-04-08 11:23:06 +00:00
parent 5c7edd4bbc
commit f1d51b8cc8
23998 changed files with 3242708 additions and 0 deletions

21
frontend/node_modules/d3-binarytree/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 Vasco Asturiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

181
frontend/node_modules/d3-binarytree/README.md generated vendored Normal file
View File

@@ -0,0 +1,181 @@
d3-binarytree
==============
[![NPM package][npm-img]][npm-url]
[![Build Size][build-size-img]][build-size-url]
[![NPM Downloads][npm-downloads-img]][npm-downloads-url]
Ported version of D3's [Quadtree](https://github.com/d3/d3-quadtree), to use with one-dimensional data structures, by removing the y coordinate.
A [binary tree](https://en.wikipedia.org/wiki/Binary_tree) recursively partitions arrays into segments, dividing each array into two equally-sized halves. Each distinct point exists in a unique leaf [node](#nodes); coincident points are represented by a linked list. Binary trees can accelerate various spatial operations, such as the [BarnesHut approximation](https://en.wikipedia.org/wiki/BarnesHut_simulation) for computing many-body forces, collision detection, and searching for nearby points.
See also [d3-quadtree](https://github.com/d3/d3-quadtree) and [d3-octree](https://github.com/vasturiano/d3-octree).
## Installing
If you use npm, `npm install d3-binarytree`. You can also load directly from the global [npmJS](https://npmjs.com) registry, as a bundled [standalone library](https://unpkg.com/d3-binarytree). In vanilla, a `d3` global is exported:
```html
<script src="https://unpkg.com/d3-binarytree"></script>
<script>
const binarytree = d3.binarytree();
</script>
```
## API Reference
<a name="binarytree" href="#binarytree">#</a> d3.<b>binarytree</b>([<i>data</i>[, <i>x</i>]])
[<>](https://github.com/d3/d3-binarytree/blob/master/src/binarytree.js#L13 "Source")
Creates a new, empty binarytree with an empty [extent](#binarytree_extent) and the default [*x*-](#binarytree_x)accessor. If *data* is specified, [adds](#binarytree_addAll) the specified array of data to the binarytree. This is equivalent to:
```js
const tree = d3.binarytree()
.addAll(data);
```
If *x* is also specified, sets the [*x*-](#binarytree_x) accessor to the specified functions before adding the specified array of data to the binarytree, equivalent to:
```js
const tree = d3.binarytree()
.x(x)
.addAll(data);
```
<a name="binarytree_x" href="#binarytree_x">#</a> <i>binarytree</i>.<b>x</b>([<i>x</i>]) [<>](https://github.com/d3/d3-binarytree/blob/master/src/x.js "Source")
If *x* is specified, sets the current *x*-coordinate accessor and returns the binarytree. If *x* is not specified, returns the current *x*-accessor, which defaults to:
```js
function x(d) {
return d[0];
}
```
The *x*-acccessor is used to derive the *x*-coordinate of data when [adding](#binarytree_add) to and [removing](#binarytree_remove) from the tree. It is also used when [finding](#binarytree_find) to re-access the coordinates of data previously added to the tree; therefore, the *x*-accessor must be consistent, returning the same value given the same input.
<a name="binarytree_extent" href="#binarytree_extent">#</a> <i>binarytree</i>.<b>extent</b>([*extent*])
[<>](https://github.com/d3/d3-binarytree/blob/master/src/extent.js "Source")
If *extent* is specified, expands the binarytree to [cover](#binarytree_cover) the specified points [[*x0*], [*x1*]] and returns the binarytree. If *extent* is not specified, returns the binarytrees current extent [[*x0*], [*x1*]], where *x0* is the inclusive lower bound and *x1* is the inclusive upper bound, or undefined if the binarytree has no extent. The extent may also be expanded by calling [*binarytree*.cover](#binarytree_cover) or [*binarytree*.add](#binarytree_add).
<a name="binarytree_cover" href="#binarytree_cover">#</a> <i>binarytree</i>.<b>cover</b>(<i>x</i>)
[<>](https://github.com/d3/d3-binarytree/blob/master/src/cover.js "Source")
Expands the binarytree to cover the specified point ⟨*x*⟩, and returns the binarytree. If the binarytrees extent already covers the specified point, this method does nothing. If the binarytree has an extent, the extent is repeatedly doubled to cover the specified point, wrapping the [root](#binarytree_root) [node](#nodes) as necessary; if the binarytree is empty, the extent is initialized to the extent [[⌊*x*⌋], [⌈*x*⌉]]. (Rounding is necessary such that if the extent is later doubled, the boundaries of existing segments do not change due to floating point error.)
<a name="binarytree_add" href="#binarytree_add">#</a> <i>binarytree</i>.<b>add</b>(<i>datum</i>)
[<>](https://github.com/d3/d3-binarytree/blob/master/src/add.js "Source")
Adds the specified *datum* to the binarytree, deriving its coordinates ⟨*x*⟩ using the current [*x*-](#binarytree_x)accessor, and returns the binarytree. If the new point is outside the current [extent](#binarytree_extent) of the binarytree, the binarytree is automatically expanded to [cover](#binarytree_cover) the new point.
<a name="binarytree_addAll" href="#binarytree_addAll">#</a> <i>binarytree</i>.<b>addAll</b>(<i>data</i>)
[<>](https://github.com/d3/d3-binarytree/blob/master/src/add.js#L41 "Source")
Adds the specified array of *data* to the binarytree, deriving each elements coordinates ⟨*x*⟩ using the current [*x*-](#binarytree_x)accessor, and return this binarytree. This is approximately equivalent to calling [*binarytree*.add](#binarytree_add) repeatedly:
```js
for (let i = 0, n = data.length; i < n; ++i) {
binarytree.add(data[i]);
}
```
However, this method results in a more compact binarytree because the extent of the *data* is computed first before adding the data.
<a name="binarytree_remove" href="#binarytree_remove">#</a> <i>binarytree</i>.<b>remove</b>(<i>datum</i>)
[<>](https://github.com/d3/d3-binarytree/blob/master/src/remove.js "Source")
Removes the specified *datum* to the binarytree, deriving its coordinates ⟨*x*⟩ using the current [*x*-](#binarytree_x)accessor, and returns the binarytree. If the specified *datum* does not exist in this binarytree, this method does nothing.
<a name="binarytree_removeAll" href="#binarytree_removeAll">#</a> <i>binarytree</i>.<b>removeAll</b>(<i>data</i>)
[<>](https://github.com/d3/d3-binarytree/blob/master/src/remove.js#L53 "Source")
Removes the specified *data* from the binarytree, deriving their coordinates ⟨*x*⟩ using the current [*x*-](#binarytree_x)accessor, and returns the binarytree. If a specified *datum* does not exist in this binarytree, it is ignored.
<a name="binarytree_copy" href="#binarytree_copy">#</a> <i>binarytree</i>.<b>copy</b>()
Returns a copy of the binarytree. All [nodes](#nodes) in the returned binarytree are identical copies of the corresponding node in the binarytree; however, any data in the binarytree is shared by reference and not copied.
<a name="binarytree_root" href="#binarytree_root">#</a> <i>binarytree</i>.<b>root</b>()
[<>](https://github.com/d3/d3-binarytree/blob/master/src/root.js "Source")
Returns the root [node](#nodes) of the binarytree.
<a name="binarytree_data" href="#binarytree_data">#</a> <i>binarytree</i>.<b>data</b>()
[<>](https://github.com/d3/d3-binarytree/blob/master/src/data.js "Source")
Returns an array of all data in the binarytree.
<a name="binarytree_size" href="#binarytree_size">#</a> <i>binarytree</i>.<b>size</b>()
[<>](https://github.com/d3/d3-binarytree/blob/master/src/size.js "Source")
Returns the total number of data in the binarytree.
<a name="binarytree_find" href="#binarytree_find">#</a> <i>binarytree</i>.<b>find</b>(<i>x</i>[, <i>radius</i>])
[<>](https://github.com/d3/d3-binarytree/blob/master/src/find.js "Source")
Returns the datum closest to the position ⟨*x*⟩ with the given search *radius*. If *radius* is not specified, it defaults to infinity. If there is no datum within the search area, returns undefined.
<a name="binarytree_visit" href="#binarytree_visit">#</a> <i>binarytree</i>.<b>visit</b>(<i>callback</i>)
[<>](https://github.com/d3/d3-binarytree/blob/master/src/visit.js "Source")
Visits each [node](#nodes) in the binarytree in pre-order traversal, invoking the specified *callback* with arguments *node*, *x0*, *x1* for each node, where *node* is the node being visited, ⟨*x0*⟩ is the lower bound of the node, and ⟨*x1*⟩ is the upper bound, and returns the binarytree. (Assuming that positive *x* is right, ⟨*x0*⟩ is the left boundary and ⟨*x1*⟩ is the right boundary; however, the coordinate system is arbitrary, so more formally *x0* <= *x1*.)
If the *callback* returns true for a given node, then the children of that node are not visited; otherwise, all child nodes are visited. This can be used to quickly visit only parts of the tree, for example when using the [BarnesHut approximation](https://en.wikipedia.org/wiki/BarnesHut_simulation). Note, however, that child segments are always visited in sibling order: left, right. In cases such as [search](#binarytree_find), visiting siblings in a specific order may be faster.
As an example, the following visits the binarytree and returns all the nodes within a range [xmin, xmax], ignoring segments that cannot possibly contain any such node:
```js
function search(binarytree, xmin, xmax) {
const results = [];
binarytree.visit(function(node, x1, x2) {
if (!node.length) {
do {
const d = node.data;
if (d[0] >= xmin && d[0] < xmax) {
results.push(d);
}
} while (node = node.next);
}
return x1 >= xmax || x2 < xmin;
});
return results;
}
```
<a name="binarytree_visitAfter" href="#binarytree_visitAfter">#</a> <i>binarytree</i>.<b>visitAfter</b>(<i>callback</i>)
[<>](https://github.com/d3/d3-binarytree/blob/master/src/visitAfter.js "Source")
Visits each [node](#nodes) in the binarytree in post-order traversal, invoking the specified *callback* with arguments *node*, *x0*, *x1* for each node, where *node* is the node being visited, ⟨*x0*⟩ is the lower bound of the node, and ⟨*x1*⟩ are the upper bound, and returns the binarytree. (Assuming that positive *x* is right, ⟨*x0*⟩ is the left boundary and ⟨*x1*⟩ is the right boundary; however, the coordinate system is arbitrary, so more formally *x0* <= *x1*.) Returns *root*.
### Nodes
Internal nodes of the binarytree are represented as two-element arrays in left-to-right order:
* `0` - the left half, if any.
* `1` - the right half, if any.
A child half may be undefined if it is empty.
Leaf nodes are represented as objects with the following properties:
* `data` - the data associated with this point, as passed to [*binarytree*.add](#binarytree_add).
* `next` - the next datum in this leaf, if any.
The `length` property may be used to distinguish leaf nodes from internal nodes: it is undefined for leaf nodes, and 4 for internal nodes. For example, to iterate over all data in a leaf node:
```js
if (!node.length) do console.log(node.data); while (node = node.next);
```
The points *x*--coordinate **must not be modified** while the point is in the binarytree. To update a points position, [remove](#binarytree_remove) the point and then re-[add](#binarytree_add) it to the binarytree at the new position. Alternatively, you may discard the existing binarytree entirely and create a new one from scratch; this may be more efficient if many of the points have moved.
[npm-img]: https://img.shields.io/npm/v/d3-binarytree
[npm-url]: https://npmjs.org/package/d3-binarytree
[build-size-img]: https://img.shields.io/bundlephobia/minzip/d3-binarytree
[build-size-url]: https://bundlephobia.com/result?p=d3-binarytree
[npm-downloads-img]: https://img.shields.io/npm/dt/d3-binarytree
[npm-downloads-url]: https://www.npmtrends.com/d3-binarytree

View File

@@ -0,0 +1,358 @@
// https://github.com/vasturiano/d3-binarytree v1.0.2
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.d3 = global.d3 || {}));
})(this, (function (exports) { 'use strict';
function tree_add(d) {
const 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) {
if (!Array.isArray(data)) data = Array.from(data);
const n = data.length;
const xz = new Float64Array(n);
let x0 = Infinity,
x1 = -Infinity;
// Compute the points and their extent.
for (let i = 0, x; 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 (let 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 dont 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 cant 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 isnt 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;
}));

View File

@@ -0,0 +1,2 @@
// https://github.com/vasturiano/d3-binarytree v1.0.2
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t="undefined"!=typeof globalThis?globalThis:t||self).d3=t.d3||{})}(this,(function(t){"use strict";function r(t,r,e){if(isNaN(r))return t;var n,i,o,s,h,a,u=t._root,f={data:e},l=t._x0,x=t._x1;if(!u)return t._root=f,t;for(;u.length;)if((s=r>=(i=(l+x)/2))?l=i:x=i,n=u,!(u=u[h=+s]))return n[h]=f,t;if(r===(o=+t._x.call(null,u.data)))return f.next=u,n?n[h]=f:t._root=f,t;do{n=n?n[h]=new Array(2):t._root=new Array(2),(s=r>=(i=(l+x)/2))?l=i:x=i}while((h=+s)==(a=+(o>=i)));return n[a]=u,n[h]=f,t}function e(t,r,e){this.node=t,this.x0=r,this.x1=e}function n(t){return t[0]}function i(t,r){var e=new o(null==r?n:r,NaN,NaN);return null==t?e:e.addAll(t)}function o(t,r,e){this._x=t,this._x0=r,this._x1=e,this._root=void 0}function s(t){for(var r={data:t.data},e=r;t=t.next;)e=e.next={data:t.data};return r}var h=i.prototype=o.prototype;h.copy=function(){var t,r,e=new o(this._x,this._x0,this._x1),n=this._root;if(!n)return e;if(!n.length)return e._root=s(n),e;for(t=[{source:n,target:e._root=new Array(2)}];n=t.pop();)for(var i=0;i<2;++i)(r=n.source[i])&&(r.length?t.push({source:r,target:n.target[i]=new Array(2)}):n.target[i]=s(r));return e},h.add=function(t){const e=+this._x.call(null,t);return r(this.cover(e),e,t)},h.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,n=new Float64Array(e);let i=1/0,o=-1/0;for(let r,s=0;s<e;++s)isNaN(r=+this._x.call(null,t[s]))||(n[s]=r,r<i&&(i=r),r>o&&(o=r));if(i>o)return this;this.cover(i).cover(o);for(let i=0;i<e;++i)r(this,n[i],t[i]);return this},h.cover=function(t){if(isNaN(t=+t))return this;var r=this._x0,e=this._x1;if(isNaN(r))e=(r=Math.floor(t))+1;else{for(var n,i,o=e-r||1,s=this._root;r>t||t>=e;)switch(i=+(t<r),(n=new Array(2))[i]=s,s=n,o*=2,i){case 0:e=r+o;break;case 1:r=e-o}this._root&&this._root.length&&(this._root=s)}return this._x0=r,this._x1=e,this},h.data=function(){var t=[];return this.visit((function(r){if(!r.length)do{t.push(r.data)}while(r=r.next)})),t},h.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},h.find=function(t,r){var n,i,o,s,h,a=this._x0,u=this._x1,f=[],l=this._root;for(l&&f.push(new e(l,a,u)),null==r?r=1/0:(a=t-r,u=t+r);s=f.pop();)if(!(!(l=s.node)||(i=s.x0)>u||(o=s.x1)<a))if(l.length){var x=(i+o)/2;f.push(new e(l[1],x,o),new e(l[0],i,x)),(h=+(t>=x))&&(s=f[f.length-1],f[f.length-1]=f[f.length-1-h],f[f.length-1-h]=s)}else{var _=Math.abs(t-+this._x.call(null,l.data));_<r&&(r=_,a=t-_,u=t+_,n=l.data)}return n},h.remove=function(t){if(isNaN(o=+this._x.call(null,t)))return this;var r,e,n,i,o,s,h,a,u,f=this._root,l=this._x0,x=this._x1;if(!f)return this;if(f.length)for(;;){if((h=o>=(s=(l+x)/2))?l=s:x=s,r=f,!(f=f[a=+h]))return this;if(!f.length)break;r[a+1&1]&&(e=r,u=a)}for(;f.data!==t;)if(n=f,!(f=f.next))return this;return(i=f.next)&&delete f.next,n?(i?n.next=i:delete n.next,this):r?(i?r[a]=i:delete r[a],(f=r[0]||r[1])&&f===(r[1]||r[0])&&!f.length&&(e?e[u]=f:this._root=f),this):(this._root=i,this)},h.removeAll=function(t){for(var r=0,e=t.length;r<e;++r)this.remove(t[r]);return this},h.root=function(){return this._root},h.size=function(){var t=0;return this.visit((function(r){if(!r.length)do{++t}while(r=r.next)})),t},h.visit=function(t){var r,n,i,o,s=[],h=this._root;for(h&&s.push(new e(h,this._x0,this._x1));r=s.pop();)if(!t(h=r.node,i=r.x0,o=r.x1)&&h.length){var a=(i+o)/2;(n=h[1])&&s.push(new e(n,a,o)),(n=h[0])&&s.push(new e(n,i,a))}return this},h.visitAfter=function(t){var r,n=[],i=[];for(this._root&&n.push(new e(this._root,this._x0,this._x1));r=n.pop();){var o=r.node;if(o.length){var s,h=r.x0,a=r.x1,u=(h+a)/2;(s=o[0])&&n.push(new e(s,h,u)),(s=o[1])&&n.push(new e(s,u,a))}i.push(r)}for(;r=i.pop();)t(r.node,r.x0,r.x1);return this},h.x=function(t){return arguments.length?(this._x=t,this):this._x},t.binarytree=i}));

46
frontend/node_modules/d3-binarytree/package.json generated vendored Normal file
View File

@@ -0,0 +1,46 @@
{
"name": "d3-binarytree",
"version": "1.0.2",
"description": "One-dimensional recursive spatial subdivision.",
"keywords": [
"d3",
"d3-module",
"binary",
"tree",
"kdtree"
],
"homepage": "https://github.com/vasturiano/d3-binarytree",
"license": "MIT",
"author": {
"name": "Vasco Asturiano",
"url": "https://github.com/vasturiano"
},
"type": "module",
"unpkg": "dist/d3-binarytree.min.js",
"jsdelivr": "dist/d3-binarytree.min.js",
"main": "src/index.js",
"module": "src/index.js",
"exports": {
"umd": "./dist/d3-binarytree.min.js",
"default": "./src/index.js"
},
"repository": {
"type": "git",
"url": "https://github.com/vasturiano/d3-binarytree.git"
},
"sideEffects": false,
"scripts": {
"test": "mocha 'test/**/*-test.js' && eslint src test",
"prepare": "rm -rf dist && yarn test && rollup -c"
},
"files": [
"src/**/*.js",
"dist/**/*.js"
],
"devDependencies": {
"@rollup/plugin-terser": "^0.4.0",
"eslint": "^8.33.0",
"mocha": "^10.2.0",
"rollup": "^3.14.0"
}
}

68
frontend/node_modules/d3-binarytree/src/add.js generated vendored Normal file
View File

@@ -0,0 +1,68 @@
export default function(d) {
const 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;
}
export function addAll(data) {
if (!Array.isArray(data)) data = Array.from(data);
const n = data.length;
const xz = new Float64Array(n);
let x0 = Infinity,
x1 = -Infinity;
// Compute the points and their extent.
for (let i = 0, x; 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 (let i = 0; i < n; ++i) {
add(this, xz[i], data[i]);
}
return this;
}

68
frontend/node_modules/d3-binarytree/src/binarytree.js generated vendored Normal file
View File

@@ -0,0 +1,68 @@
import tree_add, {addAll as tree_addAll} from "./add.js";
import tree_cover from "./cover.js";
import tree_data from "./data.js";
import tree_extent from "./extent.js";
import tree_find from "./find.js";
import tree_remove, {removeAll as tree_removeAll} from "./remove.js";
import tree_root from "./root.js";
import tree_size from "./size.js";
import tree_visit from "./visit.js";
import tree_visitAfter from "./visitAfter.js";
import tree_x, {defaultX} from "./x.js";
export default 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 = tree_addAll;
treeProto.cover = tree_cover;
treeProto.data = tree_data;
treeProto.extent = tree_extent;
treeProto.find = tree_find;
treeProto.remove = tree_remove;
treeProto.removeAll = tree_removeAll;
treeProto.root = tree_root;
treeProto.size = tree_size;
treeProto.visit = tree_visit;
treeProto.visitAfter = tree_visitAfter;
treeProto.x = tree_x;

36
frontend/node_modules/d3-binarytree/src/cover.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
export default function(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 dont 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;
}

7
frontend/node_modules/d3-binarytree/src/data.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
export default function() {
var data = [];
this.visit(function(node) {
if (!node.length) do data.push(node.data); while (node = node.next)
});
return data;
}

5
frontend/node_modules/d3-binarytree/src/extent.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export default function(_) {
return arguments.length
? this.cover(+_[0][0]).cover(+_[1][0])
: isNaN(this._x0) ? undefined : [[this._x0], [this._x1]];
}

58
frontend/node_modules/d3-binarytree/src/find.js generated vendored Normal file
View File

@@ -0,0 +1,58 @@
import Half from "./half.js";
export default function(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 cant 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 isnt 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;
}

5
frontend/node_modules/d3-binarytree/src/half.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export default function(node, x0, x1) {
this.node = node;
this.x0 = x0;
this.x1 = x1;
}

1
frontend/node_modules/d3-binarytree/src/index.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {default as binarytree} from "./binarytree.js";

56
frontend/node_modules/d3-binarytree/src/remove.js generated vendored Normal file
View File

@@ -0,0 +1,56 @@
export default function(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;
}
export function removeAll(data) {
for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]);
return this;
}

3
frontend/node_modules/d3-binarytree/src/root.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export default function() {
return this._root;
}

7
frontend/node_modules/d3-binarytree/src/size.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
export default function() {
var size = 0;
this.visit(function(node) {
if (!node.length) do ++size; while (node = node.next)
});
return size;
}

14
frontend/node_modules/d3-binarytree/src/visit.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import Half from "./half.js";
export default function(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;
}

19
frontend/node_modules/d3-binarytree/src/visitAfter.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
import Half from "./half.js";
export default function(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;
}

7
frontend/node_modules/d3-binarytree/src/x.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
export function defaultX(d) {
return d[0];
}
export default function(_) {
return arguments.length ? (this._x = _, this) : this._x;
}