simple-code-graph-viewer 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +7 -0
- package/README.md +74 -0
- package/bin/simple-code-graph-viewer.mjs +76 -0
- package/dist/index.d.ts +70 -0
- package/dist/simple-code-graph-viewer.cjs +2 -0
- package/dist/simple-code-graph-viewer.cjs.map +1 -0
- package/dist/simple-code-graph-viewer.js +3634 -0
- package/dist/simple-code-graph-viewer.js.map +1 -0
- package/dist/standalone/assets/index-_tc9ln9U.js +1 -0
- package/dist/standalone/assets/index-piR7mScM.css +1 -0
- package/dist/standalone/index.html +27 -0
- package/dist/standalone/sample-graph.json +214 -0
- package/dist/style.css +1 -0
- package/package.json +71 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2026 Mike Rötgers
|
|
2
|
+
|
|
3
|
+
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:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# simple-code-graph-viewer
|
|
2
|
+
|
|
3
|
+
[](https://github.com/MikeRoetgers/simple-code-graph-viewer/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/simple-code-graph-viewer)
|
|
5
|
+
[](https://github.com/MikeRoetgers/simple-code-graph-viewer/blob/main/LICENSE.md)
|
|
6
|
+
|
|
7
|
+
Simple library that creates an interactive force-directed graph visualization for dependencies between classes combined with general code metrics. Embeddable in your own application. Based on D3.js. I'm using it exclusively with [gdscript-code-graph](https://github.com/MikeRoetgers/gdscript-code-graph). Should be straightforward to replicate for other languages.
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
Install:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install simple-code-graph-viewer
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Use:
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import { renderGraph, validateGraphData } from 'simple-code-graph-viewer';
|
|
25
|
+
import 'simple-code-graph-viewer/style.css';
|
|
26
|
+
|
|
27
|
+
const response = await fetch('/my-graph.json');
|
|
28
|
+
const json = await response.json();
|
|
29
|
+
const data = validateGraphData(json);
|
|
30
|
+
|
|
31
|
+
const container = document.getElementById('app');
|
|
32
|
+
const { destroy } = renderGraph(container, data, {
|
|
33
|
+
width: window.innerWidth,
|
|
34
|
+
height: window.innerHeight,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Later to clean up:
|
|
38
|
+
destroy();
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Input Schema
|
|
42
|
+
|
|
43
|
+
Detailed description can be found in [schema.md](docs/schema.md).
|
|
44
|
+
|
|
45
|
+
## API
|
|
46
|
+
|
|
47
|
+
### `renderGraph(container, data, options?)`
|
|
48
|
+
|
|
49
|
+
Renders the interactive graph into a DOM element.
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
function renderGraph(
|
|
53
|
+
container: HTMLElement,
|
|
54
|
+
data: GraphData,
|
|
55
|
+
options?: RenderOptions,
|
|
56
|
+
): { destroy: () => void }
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Parameters:**
|
|
60
|
+
|
|
61
|
+
- `container` — the DOM element to render into
|
|
62
|
+
- `data` — validated `GraphData` object
|
|
63
|
+
- `options.width` — SVG width in pixels (default: 960)
|
|
64
|
+
- `options.height` — SVG height in pixels (default: 600)
|
|
65
|
+
|
|
66
|
+
**Returns:** an object with a `destroy()` method that stops the simulation, removes the SVG, and cleans up event listeners.
|
|
67
|
+
|
|
68
|
+
### `validateGraphData(data)`
|
|
69
|
+
|
|
70
|
+
Validates a raw JSON object against the v1.0 schema. Returns the typed `GraphData` on success, throws `SchemaValidationError` on failure.
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
function validateGraphData(data: unknown): GraphData
|
|
74
|
+
```
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import { createServer } from 'node:http';
|
|
5
|
+
import { resolve } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import sirv from 'sirv';
|
|
8
|
+
|
|
9
|
+
const args = process.argv.slice(2);
|
|
10
|
+
|
|
11
|
+
if (args.length === 0) {
|
|
12
|
+
console.error('Usage: simple-code-graph-viewer <path-to-graph.json>');
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const jsonPath = resolve(args[0]);
|
|
17
|
+
|
|
18
|
+
let graphJson;
|
|
19
|
+
try {
|
|
20
|
+
const raw = readFileSync(jsonPath, 'utf-8');
|
|
21
|
+
graphJson = JSON.parse(raw);
|
|
22
|
+
} catch (err) {
|
|
23
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
24
|
+
console.error(`Error reading ${jsonPath}: ${msg}`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const graphPayload = JSON.stringify(graphJson);
|
|
29
|
+
|
|
30
|
+
const distDir = fileURLToPath(new URL('../dist/standalone/', import.meta.url));
|
|
31
|
+
const serve = sirv(distDir, { single: true });
|
|
32
|
+
|
|
33
|
+
const server = createServer((req, res) => {
|
|
34
|
+
if (req.url === '/__graph_data__.json') {
|
|
35
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
36
|
+
res.end(graphPayload);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
serve(req, res);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
function listen(port) {
|
|
43
|
+
return new Promise((resolve, reject) => {
|
|
44
|
+
server.once('error', (err) => {
|
|
45
|
+
reject(err);
|
|
46
|
+
});
|
|
47
|
+
server.listen(port, () => resolve(port));
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const DEFAULT_PORT = 3000;
|
|
52
|
+
const MAX_TRIES = 20;
|
|
53
|
+
|
|
54
|
+
let port = DEFAULT_PORT;
|
|
55
|
+
for (let i = 0; i < MAX_TRIES; i++) {
|
|
56
|
+
try {
|
|
57
|
+
await listen(port);
|
|
58
|
+
break;
|
|
59
|
+
} catch {
|
|
60
|
+
port++;
|
|
61
|
+
if (i === MAX_TRIES - 1) {
|
|
62
|
+
console.error(`Could not find an available port after ${MAX_TRIES} attempts.`);
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const url = `http://localhost:${port}`;
|
|
69
|
+
console.log(`Serving simple-code-graph-viewer at ${url}`);
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
const open = await import('open');
|
|
73
|
+
await open.default(url);
|
|
74
|
+
} catch {
|
|
75
|
+
// If open fails, just continue — user can open the URL manually
|
|
76
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export declare interface Evidence {
|
|
2
|
+
file: string;
|
|
3
|
+
line: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export declare interface FunctionMetrics {
|
|
7
|
+
name: string;
|
|
8
|
+
line: number;
|
|
9
|
+
cc: number;
|
|
10
|
+
loc: number;
|
|
11
|
+
mi: number | null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export declare interface GraphData {
|
|
15
|
+
schema_version: string;
|
|
16
|
+
meta: GraphMeta;
|
|
17
|
+
nodes: GraphNode[];
|
|
18
|
+
links: GraphLink[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export declare interface GraphLink {
|
|
22
|
+
source: string;
|
|
23
|
+
target: string;
|
|
24
|
+
kind: string;
|
|
25
|
+
weight: number;
|
|
26
|
+
evidence: Evidence[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export declare interface GraphMeta {
|
|
30
|
+
repo: string;
|
|
31
|
+
generated_at: string;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export declare interface GraphNode {
|
|
36
|
+
id: string;
|
|
37
|
+
kind: string;
|
|
38
|
+
language: string;
|
|
39
|
+
name: string;
|
|
40
|
+
metrics: NodeMetrics;
|
|
41
|
+
tags: string[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export declare interface NodeMetrics {
|
|
45
|
+
loc: number | null;
|
|
46
|
+
cc: number | null;
|
|
47
|
+
mi: number | null;
|
|
48
|
+
mi_min?: number | null;
|
|
49
|
+
mi_median?: number | null;
|
|
50
|
+
max_cc?: number | null;
|
|
51
|
+
median_cc?: number | null;
|
|
52
|
+
functions?: FunctionMetrics[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export declare function renderGraph(container: HTMLElement, data: GraphData, options?: RenderOptions): {
|
|
56
|
+
destroy: () => void;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export declare interface RenderOptions {
|
|
60
|
+
width?: number;
|
|
61
|
+
height?: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export declare class SchemaValidationError extends Error {
|
|
65
|
+
constructor(message: string);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export declare function validateGraphData(data: unknown): GraphData;
|
|
69
|
+
|
|
70
|
+
export { }
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Te=["1.0"];class B extends Error{constructor(e){super(e),this.name="SchemaValidationError"}}function Yn(t){if(typeof t!="object"||t===null)throw new B("Graph data must be a non-null object");const e=t;if(typeof e.schema_version!="string")throw new B("Missing or invalid schema_version");if(!Te.includes(e.schema_version))throw new B(`Unsupported schema_version "${e.schema_version}". Supported: ${Te.join(", ")}`);if(typeof e.meta!="object"||e.meta===null)throw new B("meta must be a non-null object");if(!Array.isArray(e.nodes))throw new B("nodes must be an array");for(let r=0;r<e.nodes.length;r++){const i=e.nodes[r];if(typeof i.id!="string")throw new B(`nodes[${r}] must have a string "id"`);if(typeof i.name!="string")throw new B(`nodes[${r}] must have a string "name"`);if(typeof i.kind!="string")throw new B(`nodes[${r}] must have a string "kind"`);if(typeof i.language!="string")throw new B(`nodes[${r}] must have a string "language"`);if(typeof i.metrics!="object"||i.metrics===null)throw new B(`nodes[${r}] must have a non-null object "metrics"`);if(!Array.isArray(i.tags))throw new B(`nodes[${r}] must have an array "tags"`);if(i.metrics!=null&&typeof i.metrics=="object"){const o=i.metrics;"functions"in o&&!Array.isArray(o.functions)&&console.warn(`Warning: nodes[${r}].metrics.functions should be an array`)}}if(!Array.isArray(e.links))throw new B("links must be an array");for(let r=0;r<e.links.length;r++){const i=e.links[r];if(typeof i.source!="string")throw new B(`links[${r}] must have a string "source"`);if(typeof i.target!="string")throw new B(`links[${r}] must have a string "target"`);if(typeof i.kind!="string")throw new B(`links[${r}] must have a string "kind"`);if(typeof i.weight!="number")throw new B(`links[${r}] must have a number "weight"`);if(!Array.isArray(i.evidence))throw new B(`links[${r}] must have an array "evidence"`)}const n=new Set(e.nodes.map(r=>r.id));if(n.size!==e.nodes.length)throw new B("Duplicate node IDs detected");for(const r of e.links)n.has(r.source)||console.warn(`Warning: link source "${r.source}" does not match any node id`),n.has(r.target)||console.warn(`Warning: link target "${r.target}" does not match any node id`);return t}var ue="http://www.w3.org/1999/xhtml";const Ie={svg:"http://www.w3.org/2000/svg",xhtml:ue,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function te(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Ie.hasOwnProperty(e)?{space:Ie[e],local:t}:t}function Gn(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===ue&&e.documentElement.namespaceURI===ue?e.createElement(t):e.createElementNS(n,t)}}function Un(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function ln(t){var e=te(t);return(e.local?Un:Gn)(e)}function Kn(){}function ve(t){return t==null?Kn:function(){return this.querySelector(t)}}function Wn(t){typeof t!="function"&&(t=ve(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],a=o.length,s=r[i]=new Array(a),c,u,l=0;l<a;++l)(c=o[l])&&(u=t.call(c,c.__data__,l,o))&&("__data__"in c&&(u.__data__=c.__data__),s[l]=u);return new K(r,this._parents)}function Zn(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Qn(){return[]}function fn(t){return t==null?Qn:function(){return this.querySelectorAll(t)}}function Jn(t){return function(){return Zn(t.apply(this,arguments))}}function jn(t){typeof t=="function"?t=Jn(t):t=fn(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var a=e[o],s=a.length,c,u=0;u<s;++u)(c=a[u])&&(r.push(t.call(c,c.__data__,u,a)),i.push(c));return new K(r,i)}function hn(t){return function(){return this.matches(t)}}function dn(t){return function(e){return e.matches(t)}}var tr=Array.prototype.find;function er(t){return function(){return tr.call(this.children,t)}}function nr(){return this.firstElementChild}function rr(t){return this.select(t==null?nr:er(typeof t=="function"?t:dn(t)))}var ir=Array.prototype.filter;function or(){return Array.from(this.children)}function ar(t){return function(){return ir.call(this.children,t)}}function sr(t){return this.selectAll(t==null?or:ar(typeof t=="function"?t:dn(t)))}function ur(t){typeof t!="function"&&(t=hn(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],a=o.length,s=r[i]=[],c,u=0;u<a;++u)(c=o[u])&&t.call(c,c.__data__,u,o)&&s.push(c);return new K(r,this._parents)}function mn(t){return new Array(t.length)}function cr(){return new K(this._enter||this._groups.map(mn),this._parents)}function qt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}qt.prototype={constructor:qt,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function lr(t){return function(){return t}}function fr(t,e,n,r,i,o){for(var a=0,s,c=e.length,u=o.length;a<u;++a)(s=e[a])?(s.__data__=o[a],r[a]=s):n[a]=new qt(t,o[a]);for(;a<c;++a)(s=e[a])&&(i[a]=s)}function hr(t,e,n,r,i,o,a){var s,c,u=new Map,l=e.length,h=o.length,f=new Array(l),d;for(s=0;s<l;++s)(c=e[s])&&(f[s]=d=a.call(c,c.__data__,s,e)+"",u.has(d)?i[s]=c:u.set(d,c));for(s=0;s<h;++s)d=a.call(t,o[s],s,o)+"",(c=u.get(d))?(r[s]=c,c.__data__=o[s],u.delete(d)):n[s]=new qt(t,o[s]);for(s=0;s<l;++s)(c=e[s])&&u.get(f[s])===c&&(i[s]=c)}function dr(t){return t.__data__}function mr(t,e){if(!arguments.length)return Array.from(this,dr);var n=e?hr:fr,r=this._parents,i=this._groups;typeof t!="function"&&(t=lr(t));for(var o=i.length,a=new Array(o),s=new Array(o),c=new Array(o),u=0;u<o;++u){var l=r[u],h=i[u],f=h.length,d=gr(t.call(l,l&&l.__data__,u,r)),x=d.length,y=s[u]=new Array(x),v=a[u]=new Array(x),g=c[u]=new Array(f);n(l,h,y,v,g,d,e);for(var b=0,N=0,p,_;b<x;++b)if(p=y[b]){for(b>=N&&(N=b+1);!(_=v[N])&&++N<x;);p._next=_||null}}return a=new K(a,r),a._enter=s,a._exit=c,a}function gr(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function pr(){return new K(this._exit||this._groups.map(mn),this._parents)}function yr(t,e,n){var r=this.enter(),i=this,o=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function vr(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),c=0;c<a;++c)for(var u=n[c],l=r[c],h=u.length,f=s[c]=new Array(h),d,x=0;x<h;++x)(d=u[x]||l[x])&&(f[x]=d);for(;c<i;++c)s[c]=n[c];return new K(s,this._parents)}function wr(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,o=r[i],a;--i>=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function xr(t){t||(t=_r);function e(h,f){return h&&f?t(h.__data__,f.__data__):!h-!f}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a=n[o],s=a.length,c=i[o]=new Array(s),u,l=0;l<s;++l)(u=a[l])&&(c[l]=u);c.sort(e)}return new K(i,this._parents).order()}function _r(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function br(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Cr(){return Array.from(this)}function Mr(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null}function Er(){let t=0;for(const e of this)++t;return t}function Nr(){return!this.node()}function kr(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,a=i.length,s;o<a;++o)(s=i[o])&&t.call(s,s.__data__,o,i);return this}function Ar(t){return function(){this.removeAttribute(t)}}function Sr(t){return function(){this.removeAttributeNS(t.space,t.local)}}function $r(t,e){return function(){this.setAttribute(t,e)}}function Tr(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Ir(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Lr(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function zr(t,e){var n=te(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?Sr:Ar:typeof e=="function"?n.local?Lr:Ir:n.local?Tr:$r)(n,e))}function gn(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Dr(t){return function(){this.style.removeProperty(t)}}function Rr(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Pr(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function Fr(t,e,n){return arguments.length>1?this.each((e==null?Dr:typeof e=="function"?Pr:Rr)(t,e,n??"")):yt(this.node(),t)}function yt(t,e){return t.style.getPropertyValue(e)||gn(t).getComputedStyle(t,null).getPropertyValue(e)}function Hr(t){return function(){delete this[t]}}function Or(t,e){return function(){this[t]=e}}function Br(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Xr(t,e){return arguments.length>1?this.each((e==null?Hr:typeof e=="function"?Br:Or)(t,e)):this.node()[t]}function pn(t){return t.trim().split(/^|\s+/)}function we(t){return t.classList||new yn(t)}function yn(t){this._node=t,this._names=pn(t.getAttribute("class")||"")}yn.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function vn(t,e){for(var n=we(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function wn(t,e){for(var n=we(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function qr(t){return function(){vn(this,t)}}function Vr(t){return function(){wn(this,t)}}function Yr(t,e){return function(){(e.apply(this,arguments)?vn:wn)(this,t)}}function Gr(t,e){var n=pn(t+"");if(arguments.length<2){for(var r=we(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?Yr:e?qr:Vr)(n,e))}function Ur(){this.textContent=""}function Kr(t){return function(){this.textContent=t}}function Wr(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Zr(t){return arguments.length?this.each(t==null?Ur:(typeof t=="function"?Wr:Kr)(t)):this.node().textContent}function Qr(){this.innerHTML=""}function Jr(t){return function(){this.innerHTML=t}}function jr(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function ti(t){return arguments.length?this.each(t==null?Qr:(typeof t=="function"?jr:Jr)(t)):this.node().innerHTML}function ei(){this.nextSibling&&this.parentNode.appendChild(this)}function ni(){return this.each(ei)}function ri(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ii(){return this.each(ri)}function oi(t){var e=typeof t=="function"?t:ln(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function ai(){return null}function si(t,e){var n=typeof t=="function"?t:ln(t),r=e==null?ai:typeof e=="function"?e:ve(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function ui(){var t=this.parentNode;t&&t.removeChild(this)}function ci(){return this.each(ui)}function li(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function fi(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function hi(t){return this.select(t?fi:li)}function di(t){return arguments.length?this.property("__data__",t):this.node().__data__}function mi(t){return function(e){t.call(this,e,this.__data__)}}function gi(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function pi(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,o;n<i;++n)o=e[n],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):e[++r]=o;++r?e.length=r:delete this.__on}}}function yi(t,e,n){return function(){var r=this.__on,i,o=mi(e);if(r){for(var a=0,s=r.length;a<s;++a)if((i=r[a]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=e;return}}this.addEventListener(t.type,o,n),i={type:t.type,name:t.name,value:e,listener:o,options:n},r?r.push(i):this.__on=[i]}}function vi(t,e,n){var r=gi(t+""),i,o=r.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,u=s.length,l;c<u;++c)for(i=0,l=s[c];i<o;++i)if((a=r[i]).type===l.type&&a.name===l.name)return l.value}return}for(s=e?yi:pi,i=0;i<o;++i)this.each(s(r[i],e,n));return this}function xn(t,e,n){var r=gn(t),i=r.CustomEvent;typeof i=="function"?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function wi(t,e){return function(){return xn(this,t,e)}}function xi(t,e){return function(){return xn(this,t,e.apply(this,arguments))}}function _i(t,e){return this.each((typeof e=="function"?xi:wi)(t,e))}function*bi(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length,a;i<o;++i)(a=r[i])&&(yield a)}var _n=[null];function K(t,e){this._groups=t,this._parents=e}function At(){return new K([[document.documentElement]],_n)}function Ci(){return this}K.prototype=At.prototype={constructor:K,select:Wn,selectAll:jn,selectChild:rr,selectChildren:sr,filter:ur,data:mr,enter:cr,exit:pr,join:yr,merge:vr,selection:Ci,order:wr,sort:xr,call:br,nodes:Cr,node:Mr,size:Er,empty:Nr,each:kr,attr:zr,style:Fr,property:Xr,classed:Gr,text:Zr,html:ti,raise:ni,lower:ii,append:oi,insert:si,remove:ci,clone:hi,datum:di,on:vi,dispatch:_i,[Symbol.iterator]:bi};function j(t){return typeof t=="string"?new K([[document.querySelector(t)]],[document.documentElement]):new K([[t]],_n)}function Mi(t){let e;for(;e=t.sourceEvent;)t=e;return t}function it(t,e){if(t=Mi(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}function Ft(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Ei(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function bn(t){let e,n,r;t.length!==2?(e=Ft,n=(s,c)=>Ft(t(s),c),r=(s,c)=>t(s)-c):(e=t===Ft||t===Ei?t:Ni,n=t,r=t);function i(s,c,u=0,l=s.length){if(u<l){if(e(c,c)!==0)return l;do{const h=u+l>>>1;n(s[h],c)<0?u=h+1:l=h}while(u<l)}return u}function o(s,c,u=0,l=s.length){if(u<l){if(e(c,c)!==0)return l;do{const h=u+l>>>1;n(s[h],c)<=0?u=h+1:l=h}while(u<l)}return u}function a(s,c,u=0,l=s.length){const h=i(s,c,u,l-1);return h>u&&r(s[h-1],c)>-r(s[h],c)?h-1:h}return{left:i,center:a,right:o}}function Ni(){return 0}function ki(t){return t===null?NaN:+t}const Ai=bn(Ft),Si=Ai.right;bn(ki).center;class Le extends Map{constructor(e,n=Ii){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,i]of e)this.set(r,i)}get(e){return super.get(ze(this,e))}has(e){return super.has(ze(this,e))}set(e,n){return super.set($i(this,e),n)}delete(e){return super.delete(Ti(this,e))}}function ze({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function $i({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function Ti({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function Ii(t){return t!==null&&typeof t=="object"?t.valueOf():t}const Li=Math.sqrt(50),zi=Math.sqrt(10),Di=Math.sqrt(2);function Vt(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=Li?10:o>=zi?5:o>=Di?2:1;let s,c,u;return i<0?(u=Math.pow(10,-i)/a,s=Math.round(t*u),c=Math.round(e*u),s/u<t&&++s,c/u>e&&--c,u=-u):(u=Math.pow(10,i)*a,s=Math.round(t/u),c=Math.round(e/u),s*u<t&&++s,c*u>e&&--c),c<s&&.5<=n&&n<2?Vt(t,e,n*2):[s,c,u]}function Ri(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const r=e<t,[i,o,a]=r?Vt(e,t,n):Vt(t,e,n);if(!(o>=i))return[];const s=o-i+1,c=new Array(s);if(r)if(a<0)for(let u=0;u<s;++u)c[u]=(o-u)/-a;else for(let u=0;u<s;++u)c[u]=(o-u)*a;else if(a<0)for(let u=0;u<s;++u)c[u]=(i+u)/-a;else for(let u=0;u<s;++u)c[u]=(i+u)*a;return c}function ce(t,e,n){return e=+e,t=+t,n=+n,Vt(t,e,n)[2]}function Pi(t,e,n){e=+e,t=+t,n=+n;const r=e<t,i=r?ce(e,t,n):ce(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function Cn(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}const De=Symbol("implicit");function xe(){var t=new Le,e=[],n=[],r=De;function i(o){let a=t.get(o);if(a===void 0){if(r!==De)return r;t.set(o,a=e.push(o)-1)}return n[a%n.length]}return i.domain=function(o){if(!arguments.length)return e.slice();e=[],t=new Le;for(const a of o)t.has(a)||t.set(a,e.push(a)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return xe(e,n).unknown(r)},Cn.apply(i,arguments),i}function _e(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Mn(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function St(){}var Mt=.7,Yt=1/Mt,gt="\\s*([+-]?\\d+)\\s*",Et="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",tt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Fi=/^#([0-9a-f]{3,8})$/,Hi=new RegExp(`^rgb\\(${gt},${gt},${gt}\\)$`),Oi=new RegExp(`^rgb\\(${tt},${tt},${tt}\\)$`),Bi=new RegExp(`^rgba\\(${gt},${gt},${gt},${Et}\\)$`),Xi=new RegExp(`^rgba\\(${tt},${tt},${tt},${Et}\\)$`),qi=new RegExp(`^hsl\\(${Et},${tt},${tt}\\)$`),Vi=new RegExp(`^hsla\\(${Et},${tt},${tt},${Et}\\)$`),Re={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};_e(St,dt,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Pe,formatHex:Pe,formatHex8:Yi,formatHsl:Gi,formatRgb:Fe,toString:Fe});function Pe(){return this.rgb().formatHex()}function Yi(){return this.rgb().formatHex8()}function Gi(){return En(this).formatHsl()}function Fe(){return this.rgb().formatRgb()}function dt(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Fi.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?He(e):n===3?new U(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Tt(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Tt(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Hi.exec(t))?new U(e[1],e[2],e[3],1):(e=Oi.exec(t))?new U(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Bi.exec(t))?Tt(e[1],e[2],e[3],e[4]):(e=Xi.exec(t))?Tt(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=qi.exec(t))?Xe(e[1],e[2]/100,e[3]/100,1):(e=Vi.exec(t))?Xe(e[1],e[2]/100,e[3]/100,e[4]):Re.hasOwnProperty(t)?He(Re[t]):t==="transparent"?new U(NaN,NaN,NaN,0):null}function He(t){return new U(t>>16&255,t>>8&255,t&255,1)}function Tt(t,e,n,r){return r<=0&&(t=e=n=NaN),new U(t,e,n,r)}function Ui(t){return t instanceof St||(t=dt(t)),t?(t=t.rgb(),new U(t.r,t.g,t.b,t.opacity)):new U}function le(t,e,n,r){return arguments.length===1?Ui(t):new U(t,e,n,r??1)}function U(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}_e(U,le,Mn(St,{brighter(t){return t=t==null?Yt:Math.pow(Yt,t),new U(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Mt:Math.pow(Mt,t),new U(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new U(ft(this.r),ft(this.g),ft(this.b),Gt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Oe,formatHex:Oe,formatHex8:Ki,formatRgb:Be,toString:Be}));function Oe(){return`#${lt(this.r)}${lt(this.g)}${lt(this.b)}`}function Ki(){return`#${lt(this.r)}${lt(this.g)}${lt(this.b)}${lt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Be(){const t=Gt(this.opacity);return`${t===1?"rgb(":"rgba("}${ft(this.r)}, ${ft(this.g)}, ${ft(this.b)}${t===1?")":`, ${t})`}`}function Gt(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ft(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function lt(t){return t=ft(t),(t<16?"0":"")+t.toString(16)}function Xe(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Q(t,e,n,r)}function En(t){if(t instanceof Q)return new Q(t.h,t.s,t.l,t.opacity);if(t instanceof St||(t=dt(t)),!t)return new Q;if(t instanceof Q)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,c=(o+i)/2;return s?(e===o?a=(n-r)/s+(n<r)*6:n===o?a=(r-e)/s+2:a=(e-n)/s+4,s/=c<.5?o+i:2-o-i,a*=60):s=c>0&&c<1?0:a,new Q(a,s,c,t.opacity)}function Wi(t,e,n,r){return arguments.length===1?En(t):new Q(t,e,n,r??1)}function Q(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}_e(Q,Wi,Mn(St,{brighter(t){return t=t==null?Yt:Math.pow(Yt,t),new Q(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Mt:Math.pow(Mt,t),new Q(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new U(ie(t>=240?t-240:t+120,i,r),ie(t,i,r),ie(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Q(qe(this.h),It(this.s),It(this.l),Gt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Gt(this.opacity);return`${t===1?"hsl(":"hsla("}${qe(this.h)}, ${It(this.s)*100}%, ${It(this.l)*100}%${t===1?")":`, ${t})`}`}}));function qe(t){return t=(t||0)%360,t<0?t+360:t}function It(t){return Math.max(0,Math.min(1,t||0))}function ie(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const be=t=>()=>t;function Zi(t,e){return function(n){return t+n*e}}function Qi(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function Ji(t){return(t=+t)==1?Nn:function(e,n){return n-e?Qi(e,n,t):be(isNaN(e)?n:e)}}function Nn(t,e){var n=e-t;return n?Zi(t,n):be(isNaN(t)?e:t)}const Ut=(function t(e){var n=Ji(e);function r(i,o){var a=n((i=le(i)).r,(o=le(o)).r),s=n(i.g,o.g),c=n(i.b,o.b),u=Nn(i.opacity,o.opacity);return function(l){return i.r=a(l),i.g=s(l),i.b=c(l),i.opacity=u(l),i+""}}return r.gamma=t,r})(1);function ji(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(o){for(i=0;i<n;++i)r[i]=t[i]*(1-o)+e[i]*o;return r}}function to(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function eo(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,i=new Array(r),o=new Array(n),a;for(a=0;a<r;++a)i[a]=Ce(t[a],e[a]);for(;a<n;++a)o[a]=e[a];return function(s){for(a=0;a<r;++a)o[a]=i[a](s);return o}}function no(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Z(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function ro(t,e){var n={},r={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?n[i]=Ce(t[i],e[i]):r[i]=e[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var fe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,oe=new RegExp(fe.source,"g");function io(t){return function(){return t}}function oo(t){return function(e){return t(e)+""}}function kn(t,e){var n=fe.lastIndex=oe.lastIndex=0,r,i,o,a=-1,s=[],c=[];for(t=t+"",e=e+"";(r=fe.exec(t))&&(i=oe.exec(e));)(o=i.index)>n&&(o=e.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,c.push({i:a,x:Z(r,i)})),n=oe.lastIndex;return n<e.length&&(o=e.slice(n),s[a]?s[a]+=o:s[++a]=o),s.length<2?c[0]?oo(c[0].x):io(e):(e=c.length,function(u){for(var l=0,h;l<e;++l)s[(h=c[l]).i]=h.x(u);return s.join("")})}function Ce(t,e){var n=typeof e,r;return e==null||n==="boolean"?be(e):(n==="number"?Z:n==="string"?(r=dt(e))?(e=r,Ut):kn:e instanceof dt?Ut:e instanceof Date?no:to(e)?ji:Array.isArray(e)?eo:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?ro:Z)(t,e)}function ao(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var Ve=180/Math.PI,he={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function An(t,e,n,r,i,o){var a,s,c;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),t*r<e*n&&(t=-t,e=-e,c=-c,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*Ve,skewX:Math.atan(c)*Ve,scaleX:a,scaleY:s}}var Lt;function so(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?he:An(e.a,e.b,e.c,e.d,e.e,e.f)}function uo(t){return t==null||(Lt||(Lt=document.createElementNS("http://www.w3.org/2000/svg","g")),Lt.setAttribute("transform",t),!(t=Lt.transform.baseVal.consolidate()))?he:(t=t.matrix,An(t.a,t.b,t.c,t.d,t.e,t.f))}function Sn(t,e,n,r){function i(u){return u.length?u.pop()+" ":""}function o(u,l,h,f,d,x){if(u!==h||l!==f){var y=d.push("translate(",null,e,null,n);x.push({i:y-4,x:Z(u,h)},{i:y-2,x:Z(l,f)})}else(h||f)&&d.push("translate("+h+e+f+n)}function a(u,l,h,f){u!==l?(u-l>180?l+=360:l-u>180&&(u+=360),f.push({i:h.push(i(h)+"rotate(",null,r)-2,x:Z(u,l)})):l&&h.push(i(h)+"rotate("+l+r)}function s(u,l,h,f){u!==l?f.push({i:h.push(i(h)+"skewX(",null,r)-2,x:Z(u,l)}):l&&h.push(i(h)+"skewX("+l+r)}function c(u,l,h,f,d,x){if(u!==h||l!==f){var y=d.push(i(d)+"scale(",null,",",null,")");x.push({i:y-4,x:Z(u,h)},{i:y-2,x:Z(l,f)})}else(h!==1||f!==1)&&d.push(i(d)+"scale("+h+","+f+")")}return function(u,l){var h=[],f=[];return u=t(u),l=t(l),o(u.translateX,u.translateY,l.translateX,l.translateY,h,f),a(u.rotate,l.rotate,h,f),s(u.skewX,l.skewX,h,f),c(u.scaleX,u.scaleY,l.scaleX,l.scaleY,h,f),u=l=null,function(d){for(var x=-1,y=f.length,v;++x<y;)h[(v=f[x]).i]=v.x(d);return h.join("")}}}var co=Sn(so,"px, ","px)","deg)"),lo=Sn(uo,", ",")",")"),fo=1e-12;function Ye(t){return((t=Math.exp(t))+1/t)/2}function ho(t){return((t=Math.exp(t))-1/t)/2}function mo(t){return((t=Math.exp(2*t))-1)/(t+1)}const go=(function t(e,n,r){function i(o,a){var s=o[0],c=o[1],u=o[2],l=a[0],h=a[1],f=a[2],d=l-s,x=h-c,y=d*d+x*x,v,g;if(y<fo)g=Math.log(f/u)/e,v=function(I){return[s+I*d,c+I*x,u*Math.exp(e*I*g)]};else{var b=Math.sqrt(y),N=(f*f-u*u+r*y)/(2*u*n*b),p=(f*f-u*u-r*y)/(2*f*n*b),_=Math.log(Math.sqrt(N*N+1)-N),A=Math.log(Math.sqrt(p*p+1)-p);g=(A-_)/e,v=function(I){var S=I*g,L=Ye(_),z=u/(n*b)*(L*mo(e*S+_)-ho(_));return[s+z*d,c+z*x,u*L/Ye(e*S+_)]}}return v.duration=g*1e3*e/Math.SQRT2,v}return i.rho=function(o){var a=Math.max(.001,+o),s=a*a,c=s*s;return t(a,s,c)},i})(Math.SQRT2,2,4);function po(t){return function(){return t}}function yo(t){return+t}var Ge=[0,1];function st(t){return t}function de(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:po(isNaN(e)?NaN:.5)}function vo(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function wo(t,e,n){var r=t[0],i=t[1],o=e[0],a=e[1];return i<r?(r=de(i,r),o=n(a,o)):(r=de(r,i),o=n(o,a)),function(s){return o(r(s))}}function xo(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<r;)i[a]=de(t[a],t[a+1]),o[a]=n(e[a],e[a+1]);return function(s){var c=Si(t,s,1,r)-1;return o[c](i[c](s))}}function _o(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function bo(){var t=Ge,e=Ge,n=Ce,r,i,o,a=st,s,c,u;function l(){var f=Math.min(t.length,e.length);return a!==st&&(a=vo(t[0],t[f-1])),s=f>2?xo:wo,c=u=null,h}function h(f){return f==null||isNaN(f=+f)?o:(c||(c=s(t.map(r),e,n)))(r(a(f)))}return h.invert=function(f){return a(i((u||(u=s(e,t.map(r),Z)))(f)))},h.domain=function(f){return arguments.length?(t=Array.from(f,yo),l()):t.slice()},h.range=function(f){return arguments.length?(e=Array.from(f),l()):e.slice()},h.rangeRound=function(f){return e=Array.from(f),n=ao,l()},h.clamp=function(f){return arguments.length?(a=f?!0:st,l()):a!==st},h.interpolate=function(f){return arguments.length?(n=f,l()):n},h.unknown=function(f){return arguments.length?(o=f,h):o},function(f,d){return r=f,i=d,l()}}function Co(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Kt(t,e){if(!isFinite(t)||t===0)return null;var n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function vt(t){return t=Kt(Math.abs(t)),t?t[1]:NaN}function Mo(t,e){return function(n,r){for(var i=n.length,o=[],a=0,s=t[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),o.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=t[a=(a+1)%t.length];return o.reverse().join(e)}}function Eo(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var No=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Wt(t){if(!(e=No.exec(t)))throw new Error("invalid format: "+t);var e;return new Me({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Wt.prototype=Me.prototype;function Me(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}Me.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function ko(t){t:for(var e=t.length,n=1,r=-1,i;n<e;++n)switch(t[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+t[n])break t;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var Zt;function Ao(t,e){var n=Kt(t,e);if(!n)return Zt=void 0,t.toPrecision(e);var r=n[0],i=n[1],o=i-(Zt=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Kt(t,Math.max(0,e+o-1))[0]}function Ue(t,e){var n=Kt(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const Ke={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Co,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Ue(t*100,e),r:Ue,s:Ao,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function We(t){return t}var Ze=Array.prototype.map,Qe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function So(t){var e=t.grouping===void 0||t.thousands===void 0?We:Mo(Ze.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?We:Eo(Ze.call(t.numerals,String)),a=t.percent===void 0?"%":t.percent+"",s=t.minus===void 0?"−":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function u(h,f){h=Wt(h);var d=h.fill,x=h.align,y=h.sign,v=h.symbol,g=h.zero,b=h.width,N=h.comma,p=h.precision,_=h.trim,A=h.type;A==="n"?(N=!0,A="g"):Ke[A]||(p===void 0&&(p=12),_=!0,A="g"),(g||d==="0"&&x==="=")&&(g=!0,d="0",x="=");var I=(f&&f.prefix!==void 0?f.prefix:"")+(v==="$"?n:v==="#"&&/[boxX]/.test(A)?"0"+A.toLowerCase():""),S=(v==="$"?r:/[%p]/.test(A)?a:"")+(f&&f.suffix!==void 0?f.suffix:""),L=Ke[A],z=/[defgprs%]/.test(A);p=p===void 0?6:/[gprs]/.test(A)?Math.max(1,Math.min(21,p)):Math.max(0,Math.min(20,p));function D($){var P=I,m=S,C,w,E;if(A==="c")m=L($)+m,$="";else{$=+$;var T=$<0||1/$<0;if($=isNaN($)?c:L(Math.abs($),p),_&&($=ko($)),T&&+$==0&&y!=="+"&&(T=!1),P=(T?y==="("?y:s:y==="-"||y==="("?"":y)+P,m=(A==="s"&&!isNaN($)&&Zt!==void 0?Qe[8+Zt/3]:"")+m+(T&&y==="("?")":""),z){for(C=-1,w=$.length;++C<w;)if(E=$.charCodeAt(C),48>E||E>57){m=(E===46?i+$.slice(C+1):$.slice(C))+m,$=$.slice(0,C);break}}}N&&!g&&($=e($,1/0));var M=P.length+$.length+m.length,k=M<b?new Array(b-M+1).join(d):"";switch(N&&g&&($=e(k+$,k.length?b-m.length:1/0),k=""),x){case"<":$=P+$+m+k;break;case"=":$=P+k+$+m;break;case"^":$=k.slice(0,M=k.length>>1)+P+$+m+k.slice(M);break;default:$=k+P+$+m;break}return o($)}return D.toString=function(){return h+""},D}function l(h,f){var d=Math.max(-8,Math.min(8,Math.floor(vt(f)/3)))*3,x=Math.pow(10,-d),y=u((h=Wt(h),h.type="f",h),{suffix:Qe[8+d/3]});return function(v){return y(x*v)}}return{format:u,formatPrefix:l}}var zt,$n,Tn;$o({thousands:",",grouping:[3],currency:["$",""]});function $o(t){return zt=So(t),$n=zt.format,Tn=zt.formatPrefix,zt}function To(t){return Math.max(0,-vt(Math.abs(t)))}function Io(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(vt(e)/3)))*3-vt(Math.abs(t)))}function Lo(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,vt(e)-vt(t))+1}function zo(t,e,n,r){var i=Pi(t,e,n),o;switch(r=Wt(r??",f"),r.type){case"s":{var a=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(o=Io(i,a))&&(r.precision=o),Tn(r,a)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=Lo(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=To(i))&&(r.precision=o-(r.type==="%")*2);break}}return $n(r)}function Do(t){var e=t.domain;return t.ticks=function(n){var r=e();return Ri(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return zo(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,o=r.length-1,a=r[i],s=r[o],c,u,l=10;for(s<a&&(u=a,a=s,s=u,u=i,i=o,o=u);l-- >0;){if(u=ce(a,s,n),u===c)return r[i]=a,r[o]=s,e(r);if(u>0)a=Math.floor(a/u)*u,s=Math.ceil(s/u)*u;else if(u<0)a=Math.ceil(a*u)/u,s=Math.floor(s*u)/u;else break;c=u}return t},t}function Je(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Ro(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Po(t){return t<0?-t*t:t*t}function Fo(t){var e=t(st,st),n=1;function r(){return n===1?t(st,st):n===.5?t(Ro,Po):t(Je(n),Je(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},Do(e)}function In(){var t=Fo(bo());return t.copy=function(){return _o(t,In()).exponent(t.exponent())},Cn.apply(t,arguments),t}function Ln(){return In.apply(null,arguments).exponent(.5)}function zn(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(r*6,++r*6);return n}const Ho=zn("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),Oo=zn("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab"),Bo=960,Xo=600;function qo(){return xe(Oo)}function Vo(){return xe(Ho)}const Yo=6;function Go(){const t=Ln().domain([0,2e3]).range([4,20]).clamp(!0);return e=>e===null?Yo:t(e)}function Uo(){const t=Ln().domain([0,20]).range([1,8]).clamp(!0);return e=>t(e)}function Ko(t,e){var n,r=1;t==null&&(t=0),e==null&&(e=0);function i(){var o,a=n.length,s,c=0,u=0;for(o=0;o<a;++o)s=n[o],c+=s.x,u+=s.y;for(c=(c/a-t)*r,u=(u/a-e)*r,o=0;o<a;++o)s=n[o],s.x-=c,s.y-=u}return i.initialize=function(o){n=o},i.x=function(o){return arguments.length?(t=+o,i):t},i.y=function(o){return arguments.length?(e=+o,i):e},i.strength=function(o){return arguments.length?(r=+o,i):r},i}function Wo(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return Dn(this.cover(e,n),e,n,t)}function Dn(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o=t._root,a={data:r},s=t._x0,c=t._y0,u=t._x1,l=t._y1,h,f,d,x,y,v,g,b;if(!o)return t._root=a,t;for(;o.length;)if((y=e>=(h=(s+u)/2))?s=h:u=h,(v=n>=(f=(c+l)/2))?c=f:l=f,i=o,!(o=o[g=v<<1|y]))return i[g]=a,t;if(d=+t._x.call(null,o.data),x=+t._y.call(null,o.data),e===d&&n===x)return a.next=o,i?i[g]=a:t._root=a,t;do i=i?i[g]=new Array(4):t._root=new Array(4),(y=e>=(h=(s+u)/2))?s=h:u=h,(v=n>=(f=(c+l)/2))?c=f:l=f;while((g=v<<1|y)===(b=(x>=f)<<1|d>=h));return i[b]=o,i[g]=a,t}function Zo(t){var e,n,r=t.length,i,o,a=new Array(r),s=new Array(r),c=1/0,u=1/0,l=-1/0,h=-1/0;for(n=0;n<r;++n)isNaN(i=+this._x.call(null,e=t[n]))||isNaN(o=+this._y.call(null,e))||(a[n]=i,s[n]=o,i<c&&(c=i),i>l&&(l=i),o<u&&(u=o),o>h&&(h=o));if(c>l||u>h)return this;for(this.cover(c,u).cover(l,h),n=0;n<r;++n)Dn(this,a[n],s[n],t[n]);return this}function Qo(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1;else{for(var a=i-n||1,s=this._root,c,u;n>t||t>=i||r>e||e>=o;)switch(u=(e<r)<<1|t<n,c=new Array(4),c[u]=s,s=c,a*=2,u){case 0:i=n+a,o=r+a;break;case 1:n=i-a,o=r+a;break;case 2:i=n+a,r=o-a;break;case 3:n=i-a,r=o-a;break}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this}function Jo(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function jo(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function V(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function ta(t,e,n){var r,i=this._x0,o=this._y0,a,s,c,u,l=this._x1,h=this._y1,f=[],d=this._root,x,y;for(d&&f.push(new V(d,i,o,l,h)),n==null?n=1/0:(i=t-n,o=e-n,l=t+n,h=e+n,n*=n);x=f.pop();)if(!(!(d=x.node)||(a=x.x0)>l||(s=x.y0)>h||(c=x.x1)<i||(u=x.y1)<o))if(d.length){var v=(a+c)/2,g=(s+u)/2;f.push(new V(d[3],v,g,c,u),new V(d[2],a,g,v,u),new V(d[1],v,s,c,g),new V(d[0],a,s,v,g)),(y=(e>=g)<<1|t>=v)&&(x=f[f.length-1],f[f.length-1]=f[f.length-1-y],f[f.length-1-y]=x)}else{var b=t-+this._x.call(null,d.data),N=e-+this._y.call(null,d.data),p=b*b+N*N;if(p<n){var _=Math.sqrt(n=p);i=t-_,o=e-_,l=t+_,h=e+_,r=d.data}}return r}function ea(t){if(isNaN(l=+this._x.call(null,t))||isNaN(h=+this._y.call(null,t)))return this;var e,n=this._root,r,i,o,a=this._x0,s=this._y0,c=this._x1,u=this._y1,l,h,f,d,x,y,v,g;if(!n)return this;if(n.length)for(;;){if((x=l>=(f=(a+c)/2))?a=f:c=f,(y=h>=(d=(s+u)/2))?s=d:u=d,e=n,!(n=n[v=y<<1|x]))return this;if(!n.length)break;(e[v+1&3]||e[v+2&3]||e[v+3&3])&&(r=e,g=v)}for(;n.data!==t;)if(i=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,i?(o?i.next=o:delete i.next,this):e?(o?e[v]=o:delete e[v],(n=e[0]||e[1]||e[2]||e[3])&&n===(e[3]||e[2]||e[1]||e[0])&&!n.length&&(r?r[g]=n:this._root=n),this):(this._root=o,this)}function na(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function ra(){return this._root}function ia(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function oa(t){var e=[],n,r=this._root,i,o,a,s,c;for(r&&e.push(new V(r,this._x0,this._y0,this._x1,this._y1));n=e.pop();)if(!t(r=n.node,o=n.x0,a=n.y0,s=n.x1,c=n.y1)&&r.length){var u=(o+s)/2,l=(a+c)/2;(i=r[3])&&e.push(new V(i,u,l,s,c)),(i=r[2])&&e.push(new V(i,o,l,u,c)),(i=r[1])&&e.push(new V(i,u,a,s,l)),(i=r[0])&&e.push(new V(i,o,a,u,l))}return this}function aa(t){var e=[],n=[],r;for(this._root&&e.push(new V(this._root,this._x0,this._y0,this._x1,this._y1));r=e.pop();){var i=r.node;if(i.length){var o,a=r.x0,s=r.y0,c=r.x1,u=r.y1,l=(a+c)/2,h=(s+u)/2;(o=i[0])&&e.push(new V(o,a,s,l,h)),(o=i[1])&&e.push(new V(o,l,s,c,h)),(o=i[2])&&e.push(new V(o,a,h,l,u)),(o=i[3])&&e.push(new V(o,l,h,c,u))}n.push(r)}for(;r=n.pop();)t(r.node,r.x0,r.y0,r.x1,r.y1);return this}function sa(t){return t[0]}function ua(t){return arguments.length?(this._x=t,this):this._x}function ca(t){return t[1]}function la(t){return arguments.length?(this._y=t,this):this._y}function Ee(t,e,n){var r=new Ne(e??sa,n??ca,NaN,NaN,NaN,NaN);return t==null?r:r.addAll(t)}function Ne(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function je(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var Y=Ee.prototype=Ne.prototype;Y.copy=function(){var t=new Ne(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,n,r;if(!e)return t;if(!e.length)return t._root=je(e),t;for(n=[{source:e,target:t._root=new Array(4)}];e=n.pop();)for(var i=0;i<4;++i)(r=e.source[i])&&(r.length?n.push({source:r,target:e.target[i]=new Array(4)}):e.target[i]=je(r));return t};Y.add=Wo;Y.addAll=Zo;Y.cover=Qo;Y.data=Jo;Y.extent=jo;Y.find=ta;Y.remove=ea;Y.removeAll=na;Y.root=ra;Y.size=ia;Y.visit=oa;Y.visitAfter=aa;Y.x=ua;Y.y=la;function ht(t){return function(){return t}}function ut(t){return(t()-.5)*1e-6}function fa(t){return t.x+t.vx}function ha(t){return t.y+t.vy}function da(t){var e,n,r,i=1,o=1;typeof t!="function"&&(t=ht(t==null?1:+t));function a(){for(var u,l=e.length,h,f,d,x,y,v,g=0;g<o;++g)for(h=Ee(e,fa,ha).visitAfter(s),u=0;u<l;++u)f=e[u],y=n[f.index],v=y*y,d=f.x+f.vx,x=f.y+f.vy,h.visit(b);function b(N,p,_,A,I){var S=N.data,L=N.r,z=y+L;if(S){if(S.index>f.index){var D=d-S.x-S.vx,$=x-S.y-S.vy,P=D*D+$*$;P<z*z&&(D===0&&(D=ut(r),P+=D*D),$===0&&($=ut(r),P+=$*$),P=(z-(P=Math.sqrt(P)))/P*i,f.vx+=(D*=P)*(z=(L*=L)/(v+L)),f.vy+=($*=P)*z,S.vx-=D*(z=1-z),S.vy-=$*z)}return}return p>d+z||A<d-z||_>x+z||I<x-z}}function s(u){if(u.data)return u.r=n[u.data.index];for(var l=u.r=0;l<4;++l)u[l]&&u[l].r>u.r&&(u.r=u[l].r)}function c(){if(e){var u,l=e.length,h;for(n=new Array(l),u=0;u<l;++u)h=e[u],n[h.index]=+t(h,u,e)}}return a.initialize=function(u,l){e=u,r=l,c()},a.iterations=function(u){return arguments.length?(o=+u,a):o},a.strength=function(u){return arguments.length?(i=+u,a):i},a.radius=function(u){return arguments.length?(t=typeof u=="function"?u:ht(+u),c(),a):t},a}function ma(t){return t.index}function tn(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function ga(t){var e=ma,n=h,r,i=ht(30),o,a,s,c,u,l=1;t==null&&(t=[]);function h(v){return 1/Math.min(s[v.source.index],s[v.target.index])}function f(v){for(var g=0,b=t.length;g<l;++g)for(var N=0,p,_,A,I,S,L,z;N<b;++N)p=t[N],_=p.source,A=p.target,I=A.x+A.vx-_.x-_.vx||ut(u),S=A.y+A.vy-_.y-_.vy||ut(u),L=Math.sqrt(I*I+S*S),L=(L-o[N])/L*v*r[N],I*=L,S*=L,A.vx-=I*(z=c[N]),A.vy-=S*z,_.vx+=I*(z=1-z),_.vy+=S*z}function d(){if(a){var v,g=a.length,b=t.length,N=new Map(a.map((_,A)=>[e(_,A,a),_])),p;for(v=0,s=new Array(g);v<b;++v)p=t[v],p.index=v,typeof p.source!="object"&&(p.source=tn(N,p.source)),typeof p.target!="object"&&(p.target=tn(N,p.target)),s[p.source.index]=(s[p.source.index]||0)+1,s[p.target.index]=(s[p.target.index]||0)+1;for(v=0,c=new Array(b);v<b;++v)p=t[v],c[v]=s[p.source.index]/(s[p.source.index]+s[p.target.index]);r=new Array(b),x(),o=new Array(b),y()}}function x(){if(a)for(var v=0,g=t.length;v<g;++v)r[v]=+n(t[v],v,t)}function y(){if(a)for(var v=0,g=t.length;v<g;++v)o[v]=+i(t[v],v,t)}return f.initialize=function(v,g){a=v,u=g,d()},f.links=function(v){return arguments.length?(t=v,d(),f):t},f.id=function(v){return arguments.length?(e=v,f):e},f.iterations=function(v){return arguments.length?(l=+v,f):l},f.strength=function(v){return arguments.length?(n=typeof v=="function"?v:ht(+v),x(),f):n},f.distance=function(v){return arguments.length?(i=typeof v=="function"?v:ht(+v),y(),f):i},f}var pa={value:()=>{}};function $t(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Ht(n)}function Ht(t){this._=t}function ya(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Ht.prototype=$t.prototype={constructor:Ht,on:function(t,e){var n=this._,r=ya(t+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o<a;)if((i=(t=r[o]).type)&&(i=va(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<a;)if(i=(t=r[o]).type)n[i]=en(n[i],t.name,e);else if(e==null)for(i in n)n[i]=en(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Ht(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};function va(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function en(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=pa,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var wt=0,bt=0,xt=0,Rn=1e3,Qt,Ct,Jt=0,mt=0,ee=0,Nt=typeof performance=="object"&&performance.now?performance:Date,Pn=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ke(){return mt||(Pn(wa),mt=Nt.now()+ee)}function wa(){mt=0}function jt(){this._call=this._time=this._next=null}jt.prototype=Ae.prototype={constructor:jt,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?ke():+n)+(e==null?0:+e),!this._next&&Ct!==this&&(Ct?Ct._next=this:Qt=this,Ct=this),this._call=t,this._time=n,me()},stop:function(){this._call&&(this._call=null,this._time=1/0,me())}};function Ae(t,e,n){var r=new jt;return r.restart(t,e,n),r}function xa(){ke(),++wt;for(var t=Qt,e;t;)(e=mt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--wt}function nn(){mt=(Jt=Nt.now())+ee,wt=bt=0;try{xa()}finally{wt=0,ba(),mt=0}}function _a(){var t=Nt.now(),e=t-Jt;e>Rn&&(ee-=e,Jt=t)}function ba(){for(var t,e=Qt,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Qt=n);Ct=t,me(r)}function me(t){if(!wt){bt&&(bt=clearTimeout(bt));var e=t-mt;e>24?(t<1/0&&(bt=setTimeout(nn,t-Nt.now()-ee)),xt&&(xt=clearInterval(xt))):(xt||(Jt=Nt.now(),xt=setInterval(_a,Rn)),wt=1,Pn(nn))}}function rn(t,e,n){var r=new jt;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}const Ca=1664525,Ma=1013904223,on=4294967296;function Ea(){let t=1;return()=>(t=(Ca*t+Ma)%on)/on}function Na(t){return t.x}function ka(t){return t.y}var Aa=10,Sa=Math.PI*(3-Math.sqrt(5));function $a(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,s=new Map,c=Ae(h),u=$t("tick","end"),l=Ea();t==null&&(t=[]);function h(){f(),u.call("tick",e),n<r&&(c.stop(),u.call("end",e))}function f(y){var v,g=t.length,b;y===void 0&&(y=1);for(var N=0;N<y;++N)for(n+=(o-n)*i,s.forEach(function(p){p(n)}),v=0;v<g;++v)b=t[v],b.fx==null?b.x+=b.vx*=a:(b.x=b.fx,b.vx=0),b.fy==null?b.y+=b.vy*=a:(b.y=b.fy,b.vy=0);return e}function d(){for(var y=0,v=t.length,g;y<v;++y){if(g=t[y],g.index=y,g.fx!=null&&(g.x=g.fx),g.fy!=null&&(g.y=g.fy),isNaN(g.x)||isNaN(g.y)){var b=Aa*Math.sqrt(.5+y),N=y*Sa;g.x=b*Math.cos(N),g.y=b*Math.sin(N)}(isNaN(g.vx)||isNaN(g.vy))&&(g.vx=g.vy=0)}}function x(y){return y.initialize&&y.initialize(t,l),y}return d(),e={tick:f,restart:function(){return c.restart(h),e},stop:function(){return c.stop(),e},nodes:function(y){return arguments.length?(t=y,d(),s.forEach(x),e):t},alpha:function(y){return arguments.length?(n=+y,e):n},alphaMin:function(y){return arguments.length?(r=+y,e):r},alphaDecay:function(y){return arguments.length?(i=+y,e):+i},alphaTarget:function(y){return arguments.length?(o=+y,e):o},velocityDecay:function(y){return arguments.length?(a=1-y,e):1-a},randomSource:function(y){return arguments.length?(l=y,s.forEach(x),e):l},force:function(y,v){return arguments.length>1?(v==null?s.delete(y):s.set(y,x(v)),e):s.get(y)},find:function(y,v,g){var b=0,N=t.length,p,_,A,I,S;for(g==null?g=1/0:g*=g,b=0;b<N;++b)I=t[b],p=y-I.x,_=v-I.y,A=p*p+_*_,A<g&&(S=I,g=A);return S},on:function(y,v){return arguments.length>1?(u.on(y,v),e):u.on(y)}}}function Ta(){var t,e,n,r,i=ht(-30),o,a=1,s=1/0,c=.81;function u(d){var x,y=t.length,v=Ee(t,Na,ka).visitAfter(h);for(r=d,x=0;x<y;++x)e=t[x],v.visit(f)}function l(){if(t){var d,x=t.length,y;for(o=new Array(x),d=0;d<x;++d)y=t[d],o[y.index]=+i(y,d,t)}}function h(d){var x=0,y,v,g=0,b,N,p;if(d.length){for(b=N=p=0;p<4;++p)(y=d[p])&&(v=Math.abs(y.value))&&(x+=y.value,g+=v,b+=v*y.x,N+=v*y.y);d.x=b/g,d.y=N/g}else{y=d,y.x=y.data.x,y.y=y.data.y;do x+=o[y.data.index];while(y=y.next)}d.value=x}function f(d,x,y,v){if(!d.value)return!0;var g=d.x-e.x,b=d.y-e.y,N=v-x,p=g*g+b*b;if(N*N/c<p)return p<s&&(g===0&&(g=ut(n),p+=g*g),b===0&&(b=ut(n),p+=b*b),p<a&&(p=Math.sqrt(a*p)),e.vx+=g*d.value*r/p,e.vy+=b*d.value*r/p),!0;if(d.length||p>=s)return;(d.data!==e||d.next)&&(g===0&&(g=ut(n),p+=g*g),b===0&&(b=ut(n),p+=b*b),p<a&&(p=Math.sqrt(a*p)));do d.data!==e&&(N=o[d.data.index]*r/p,e.vx+=g*N,e.vy+=b*N);while(d=d.next)}return u.initialize=function(d,x){t=d,n=x,l()},u.strength=function(d){return arguments.length?(i=typeof d=="function"?d:ht(+d),l(),u):i},u.distanceMin=function(d){return arguments.length?(a=d*d,u):Math.sqrt(a)},u.distanceMax=function(d){return arguments.length?(s=d*d,u):Math.sqrt(s)},u.theta=function(d){return arguments.length?(c=d*d,u):Math.sqrt(c)},u}const Ia=100,La=-200,za=20;function Da(t,e,n,r){return $a(t).force("link",ga(e).id(i=>i.id).distance(Ia)).force("charge",Ta().strength(La)).force("center",Ko(n/2,r/2)).force("collide",da().radius(za))}function Ra(t,e,n,r){const i=t.selectAll(".mv-node").data(e).join("g").attr("class","mv-node");return i.append("circle").attr("r",o=>r(o.metrics.loc)).attr("fill",o=>n(o.kind)),i.append("text").text(o=>o.name).attr("dx",0).attr("dy",o=>r(o.metrics.loc)+12),i}function Pa(t,e,n,r){return t.selectAll(".mv-link").data(e).join("line").attr("class","mv-link").attr("stroke",i=>n(i.kind)).attr("stroke-width",i=>r(i.weight))}const Fa={passive:!1},kt={capture:!0,passive:!1};function ae(t){t.stopImmediatePropagation()}function pt(t){t.preventDefault(),t.stopImmediatePropagation()}function Fn(t){var e=t.document.documentElement,n=j(t).on("dragstart.drag",pt,kt);"onselectstart"in e?n.on("selectstart.drag",pt,kt):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Hn(t,e){var n=t.document.documentElement,r=j(t).on("dragstart.drag",null);e&&(r.on("click.drag",pt,kt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Dt=t=>()=>t;function ge(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:c,dy:u,dispatch:l}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:l}})}ge.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function Ha(t){return!t.ctrlKey&&!t.button}function Oa(){return this.parentNode}function Ba(t,e){return e??{x:t.x,y:t.y}}function Xa(){return navigator.maxTouchPoints||"ontouchstart"in this}function qa(){var t=Ha,e=Oa,n=Ba,r=Xa,i={},o=$t("start","drag","end"),a=0,s,c,u,l,h=0;function f(p){p.on("mousedown.drag",d).filter(r).on("touchstart.drag",v).on("touchmove.drag",g,Fa).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(p,_){if(!(l||!t.call(this,p,_))){var A=N(this,e.call(this,p,_),p,_,"mouse");A&&(j(p.view).on("mousemove.drag",x,kt).on("mouseup.drag",y,kt),Fn(p.view),ae(p),u=!1,s=p.clientX,c=p.clientY,A("start",p))}}function x(p){if(pt(p),!u){var _=p.clientX-s,A=p.clientY-c;u=_*_+A*A>h}i.mouse("drag",p)}function y(p){j(p.view).on("mousemove.drag mouseup.drag",null),Hn(p.view,u),pt(p),i.mouse("end",p)}function v(p,_){if(t.call(this,p,_)){var A=p.changedTouches,I=e.call(this,p,_),S=A.length,L,z;for(L=0;L<S;++L)(z=N(this,I,p,_,A[L].identifier,A[L]))&&(ae(p),z("start",p,A[L]))}}function g(p){var _=p.changedTouches,A=_.length,I,S;for(I=0;I<A;++I)(S=i[_[I].identifier])&&(pt(p),S("drag",p,_[I]))}function b(p){var _=p.changedTouches,A=_.length,I,S;for(l&&clearTimeout(l),l=setTimeout(function(){l=null},500),I=0;I<A;++I)(S=i[_[I].identifier])&&(ae(p),S("end",p,_[I]))}function N(p,_,A,I,S,L){var z=o.copy(),D=it(L||A,_),$,P,m;if((m=n.call(p,new ge("beforestart",{sourceEvent:A,target:f,identifier:S,active:a,x:D[0],y:D[1],dx:0,dy:0,dispatch:z}),I))!=null)return $=m.x-D[0]||0,P=m.y-D[1]||0,function C(w,E,T){var M=D,k;switch(w){case"start":i[S]=C,k=a++;break;case"end":delete i[S],--a;case"drag":D=it(T||E,_),k=a;break}z.call(w,p,new ge(w,{sourceEvent:E,subject:m,target:f,identifier:S,active:k,x:D[0]+$,y:D[1]+P,dx:D[0]-M[0],dy:D[1]-M[1],dispatch:z}),I)}}return f.filter=function(p){return arguments.length?(t=typeof p=="function"?p:Dt(!!p),f):t},f.container=function(p){return arguments.length?(e=typeof p=="function"?p:Dt(p),f):e},f.subject=function(p){return arguments.length?(n=typeof p=="function"?p:Dt(p),f):n},f.touchable=function(p){return arguments.length?(r=typeof p=="function"?p:Dt(!!p),f):r},f.on=function(){var p=o.on.apply(o,arguments);return p===o?f:p},f.clickDistance=function(p){return arguments.length?(h=(p=+p)*p,f):Math.sqrt(h)},f}var Va=$t("start","end","cancel","interrupt"),Ya=[],On=0,an=1,pe=2,Ot=3,sn=4,ye=5,Bt=6;function ne(t,e,n,r,i,o){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;Ga(t,n,{name:e,index:r,group:i,on:Va,tween:Ya,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:On})}function Se(t,e){var n=J(t,e);if(n.state>On)throw new Error("too late; already scheduled");return n}function et(t,e){var n=J(t,e);if(n.state>Ot)throw new Error("too late; already running");return n}function J(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Ga(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=Ae(o,0,n.time);function o(u){n.state=an,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var l,h,f,d;if(n.state!==an)return c();for(l in r)if(d=r[l],d.name===n.name){if(d.state===Ot)return rn(a);d.state===sn?(d.state=Bt,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete r[l]):+l<e&&(d.state=Bt,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete r[l])}if(rn(function(){n.state===Ot&&(n.state=sn,n.timer.restart(s,n.delay,n.time),s(u))}),n.state=pe,n.on.call("start",t,t.__data__,n.index,n.group),n.state===pe){for(n.state=Ot,i=new Array(f=n.tween.length),l=0,h=-1;l<f;++l)(d=n.tween[l].value.call(t,t.__data__,n.index,n.group))&&(i[++h]=d);i.length=h+1}}function s(u){for(var l=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=ye,1),h=-1,f=i.length;++h<f;)i[h].call(t,l);n.state===ye&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=Bt,n.timer.stop(),delete r[e];for(var u in r)return;delete t.__transition}}function Xt(t,e){var n=t.__transition,r,i,o=!0,a;if(n){e=e==null?null:e+"";for(a in n){if((r=n[a]).name!==e){o=!1;continue}i=r.state>pe&&r.state<ye,r.state=Bt,r.timer.stop(),r.on.call(i?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[a]}o&&delete t.__transition}}function Ua(t){return this.each(function(){Xt(this,t)})}function Ka(t,e){var n,r;return function(){var i=et(this,t),o=i.tween;if(o!==n){r=n=o;for(var a=0,s=r.length;a<s;++a)if(r[a].name===e){r=r.slice(),r.splice(a,1);break}}i.tween=r}}function Wa(t,e,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=et(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:e,value:n},c=0,u=i.length;c<u;++c)if(i[c].name===e){i[c]=s;break}c===u&&i.push(s)}o.tween=i}}function Za(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=J(this.node(),n).tween,i=0,o=r.length,a;i<o;++i)if((a=r[i]).name===t)return a.value;return null}return this.each((e==null?Ka:Wa)(n,t,e))}function $e(t,e,n){var r=t._id;return t.each(function(){var i=et(this,r);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return J(i,r).value[e]}}function Bn(t,e){var n;return(typeof e=="number"?Z:e instanceof dt?Ut:(n=dt(e))?(e=n,Ut):kn)(t,e)}function Qa(t){return function(){this.removeAttribute(t)}}function Ja(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ja(t,e,n){var r,i=n+"",o;return function(){var a=this.getAttribute(t);return a===i?null:a===r?o:o=e(r=a,n)}}function ts(t,e,n){var r,i=n+"",o;return function(){var a=this.getAttributeNS(t.space,t.local);return a===i?null:a===r?o:o=e(r=a,n)}}function es(t,e,n){var r,i,o;return function(){var a,s=n(this),c;return s==null?void this.removeAttribute(t):(a=this.getAttribute(t),c=s+"",a===c?null:a===r&&c===i?o:(i=c,o=e(r=a,s)))}}function ns(t,e,n){var r,i,o;return function(){var a,s=n(this),c;return s==null?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local),c=s+"",a===c?null:a===r&&c===i?o:(i=c,o=e(r=a,s)))}}function rs(t,e){var n=te(t),r=n==="transform"?lo:Bn;return this.attrTween(t,typeof e=="function"?(n.local?ns:es)(n,r,$e(this,"attr."+t,e)):e==null?(n.local?Ja:Qa)(n):(n.local?ts:ja)(n,r,e))}function is(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function os(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function as(t,e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&os(t,o)),n}return i._value=e,i}function ss(t,e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&is(t,o)),n}return i._value=e,i}function us(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=te(t);return this.tween(n,(r.local?as:ss)(r,e))}function cs(t,e){return function(){Se(this,t).delay=+e.apply(this,arguments)}}function ls(t,e){return e=+e,function(){Se(this,t).delay=e}}function fs(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?cs:ls)(e,t)):J(this.node(),e).delay}function hs(t,e){return function(){et(this,t).duration=+e.apply(this,arguments)}}function ds(t,e){return e=+e,function(){et(this,t).duration=e}}function ms(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?hs:ds)(e,t)):J(this.node(),e).duration}function gs(t,e){if(typeof e!="function")throw new Error;return function(){et(this,t).ease=e}}function ps(t){var e=this._id;return arguments.length?this.each(gs(e,t)):J(this.node(),e).ease}function ys(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;et(this,t).ease=n}}function vs(t){if(typeof t!="function")throw new Error;return this.each(ys(this._id,t))}function ws(t){typeof t!="function"&&(t=hn(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],a=o.length,s=r[i]=[],c,u=0;u<a;++u)(c=o[u])&&t.call(c,c.__data__,u,o)&&s.push(c);return new at(r,this._parents,this._name,this._id)}function xs(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var c=e[s],u=n[s],l=c.length,h=a[s]=new Array(l),f,d=0;d<l;++d)(f=c[d]||u[d])&&(h[d]=f);for(;s<r;++s)a[s]=e[s];return new at(a,this._parents,this._name,this._id)}function _s(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function bs(t,e,n){var r,i,o=_s(e)?Se:et;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}function Cs(t,e){var n=this._id;return arguments.length<2?J(this.node(),n).on.on(t):this.each(bs(n,t,e))}function Ms(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function Es(){return this.on("end.remove",Ms(this._id))}function Ns(t){var e=this._name,n=this._id;typeof t!="function"&&(t=ve(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s=r[a],c=s.length,u=o[a]=new Array(c),l,h,f=0;f<c;++f)(l=s[f])&&(h=t.call(l,l.__data__,f,s))&&("__data__"in l&&(h.__data__=l.__data__),u[f]=h,ne(u[f],e,n,f,u,J(l,n)));return new at(o,this._parents,e,n)}function ks(t){var e=this._name,n=this._id;typeof t!="function"&&(t=fn(t));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var c=r[s],u=c.length,l,h=0;h<u;++h)if(l=c[h]){for(var f=t.call(l,l.__data__,h,c),d,x=J(l,n),y=0,v=f.length;y<v;++y)(d=f[y])&&ne(d,e,n,y,f,x);o.push(f),a.push(l)}return new at(o,a,e,n)}var As=At.prototype.constructor;function Ss(){return new As(this._groups,this._parents)}function $s(t,e){var n,r,i;return function(){var o=yt(this,t),a=(this.style.removeProperty(t),yt(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}function Xn(t){return function(){this.style.removeProperty(t)}}function Ts(t,e,n){var r,i=n+"",o;return function(){var a=yt(this,t);return a===i?null:a===r?o:o=e(r=a,n)}}function Is(t,e,n){var r,i,o;return function(){var a=yt(this,t),s=n(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(t),yt(this,t))),a===c?null:a===r&&c===i?o:(i=c,o=e(r=a,s))}}function Ls(t,e){var n,r,i,o="style."+e,a="end."+o,s;return function(){var c=et(this,t),u=c.on,l=c.value[o]==null?s||(s=Xn(e)):void 0;(u!==n||i!==l)&&(r=(n=u).copy()).on(a,i=l),c.on=r}}function zs(t,e,n){var r=(t+="")=="transform"?co:Bn;return e==null?this.styleTween(t,$s(t,r)).on("end.style."+t,Xn(t)):typeof e=="function"?this.styleTween(t,Is(t,r,$e(this,"style."+t,e))).each(Ls(this._id,t)):this.styleTween(t,Ts(t,r,e),n).on("end.style."+t,null)}function Ds(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function Rs(t,e,n){var r,i;function o(){var a=e.apply(this,arguments);return a!==i&&(r=(i=a)&&Ds(t,a,n)),r}return o._value=e,o}function Ps(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,Rs(t,e,n??""))}function Fs(t){return function(){this.textContent=t}}function Hs(t){return function(){var e=t(this);this.textContent=e??""}}function Os(t){return this.tween("text",typeof t=="function"?Hs($e(this,"text",t)):Fs(t==null?"":t+""))}function Bs(t){return function(e){this.textContent=t.call(this,e)}}function Xs(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&Bs(i)),e}return r._value=t,r}function qs(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Xs(t))}function Vs(){for(var t=this._name,e=this._id,n=qn(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,c,u=0;u<s;++u)if(c=a[u]){var l=J(c,e);ne(c,t,n,u,a,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new at(r,this._parents,t,n)}function Ys(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(o,a){var s={value:a},c={value:function(){--i===0&&o()}};n.each(function(){var u=et(this,r),l=u.on;l!==t&&(e=(t=l).copy(),e._.cancel.push(s),e._.interrupt.push(s),e._.end.push(c)),u.on=e}),i===0&&o()})}var Gs=0;function at(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function qn(){return++Gs}var rt=At.prototype;at.prototype={constructor:at,select:Ns,selectAll:ks,selectChild:rt.selectChild,selectChildren:rt.selectChildren,filter:ws,merge:xs,selection:Ss,transition:Vs,call:rt.call,nodes:rt.nodes,node:rt.node,size:rt.size,empty:rt.empty,each:rt.each,on:Cs,attr:rs,attrTween:us,style:zs,styleTween:Ps,text:Os,textTween:qs,remove:Es,tween:Za,delay:fs,duration:ms,ease:ps,easeVarying:vs,end:Ys,[Symbol.iterator]:rt[Symbol.iterator]};function Us(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Ks={time:null,delay:0,duration:250,ease:Us};function Ws(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Zs(t){var e,n;t instanceof at?(e=t._id,t=t._name):(e=qn(),(n=Ks).time=ke(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,c,u=0;u<s;++u)(c=a[u])&&ne(c,t,e,u,a,n||Ws(c,e));return new at(r,this._parents,t,e)}At.prototype.interrupt=Ua;At.prototype.transition=Zs;const Rt=t=>()=>t;function Qs(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function ot(t,e,n){this.k=t,this.x=e,this.y=n}ot.prototype={constructor:ot,scale:function(t){return t===1?this:new ot(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new ot(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Vn=new ot(1,0,0);ot.prototype;function se(t){t.stopImmediatePropagation()}function _t(t){t.preventDefault(),t.stopImmediatePropagation()}function Js(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function js(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function un(){return this.__zoom||Vn}function tu(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function eu(){return navigator.maxTouchPoints||"ontouchstart"in this}function nu(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function ru(){var t=Js,e=js,n=nu,r=tu,i=eu,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,c=go,u=$t("start","zoom","end"),l,h,f,d=500,x=150,y=0,v=10;function g(m){m.property("__zoom",un).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",z).filter(i).on("touchstart.zoom",D).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",P).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(m,C,w,E){var T=m.selection?m.selection():m;T.property("__zoom",un),m!==T?_(m,C,w,E):T.interrupt().each(function(){A(this,arguments).event(E).start().zoom(null,typeof C=="function"?C.apply(this,arguments):C).end()})},g.scaleBy=function(m,C,w,E){g.scaleTo(m,function(){var T=this.__zoom.k,M=typeof C=="function"?C.apply(this,arguments):C;return T*M},w,E)},g.scaleTo=function(m,C,w,E){g.transform(m,function(){var T=e.apply(this,arguments),M=this.__zoom,k=w==null?p(T):typeof w=="function"?w.apply(this,arguments):w,R=M.invert(k),F=typeof C=="function"?C.apply(this,arguments):C;return n(N(b(M,F),k,R),T,a)},w,E)},g.translateBy=function(m,C,w,E){g.transform(m,function(){return n(this.__zoom.translate(typeof C=="function"?C.apply(this,arguments):C,typeof w=="function"?w.apply(this,arguments):w),e.apply(this,arguments),a)},null,E)},g.translateTo=function(m,C,w,E,T){g.transform(m,function(){var M=e.apply(this,arguments),k=this.__zoom,R=E==null?p(M):typeof E=="function"?E.apply(this,arguments):E;return n(Vn.translate(R[0],R[1]).scale(k.k).translate(typeof C=="function"?-C.apply(this,arguments):-C,typeof w=="function"?-w.apply(this,arguments):-w),M,a)},E,T)};function b(m,C){return C=Math.max(o[0],Math.min(o[1],C)),C===m.k?m:new ot(C,m.x,m.y)}function N(m,C,w){var E=C[0]-w[0]*m.k,T=C[1]-w[1]*m.k;return E===m.x&&T===m.y?m:new ot(m.k,E,T)}function p(m){return[(+m[0][0]+ +m[1][0])/2,(+m[0][1]+ +m[1][1])/2]}function _(m,C,w,E){m.on("start.zoom",function(){A(this,arguments).event(E).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(E).end()}).tween("zoom",function(){var T=this,M=arguments,k=A(T,M).event(E),R=e.apply(T,M),F=w==null?p(R):typeof w=="function"?w.apply(T,M):w,X=Math.max(R[1][0]-R[0][0],R[1][1]-R[0][1]),H=T.__zoom,q=typeof C=="function"?C.apply(T,M):C,G=c(H.invert(F).concat(X/H.k),q.invert(F).concat(X/q.k));return function(W){if(W===1)W=q;else{var nt=G(W),re=X/nt[2];W=new ot(re,F[0]-nt[0]*re,F[1]-nt[1]*re)}k.zoom(null,W)}})}function A(m,C,w){return!w&&m.__zooming||new I(m,C)}function I(m,C){this.that=m,this.args=C,this.active=0,this.sourceEvent=null,this.extent=e.apply(m,C),this.taps=0}I.prototype={event:function(m){return m&&(this.sourceEvent=m),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(m,C){return this.mouse&&m!=="mouse"&&(this.mouse[1]=C.invert(this.mouse[0])),this.touch0&&m!=="touch"&&(this.touch0[1]=C.invert(this.touch0[0])),this.touch1&&m!=="touch"&&(this.touch1[1]=C.invert(this.touch1[0])),this.that.__zoom=C,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(m){var C=j(this.that).datum();u.call(m,this.that,new Qs(m,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:u}),C)}};function S(m,...C){if(!t.apply(this,arguments))return;var w=A(this,C).event(m),E=this.__zoom,T=Math.max(o[0],Math.min(o[1],E.k*Math.pow(2,r.apply(this,arguments)))),M=it(m);if(w.wheel)(w.mouse[0][0]!==M[0]||w.mouse[0][1]!==M[1])&&(w.mouse[1]=E.invert(w.mouse[0]=M)),clearTimeout(w.wheel);else{if(E.k===T)return;w.mouse=[M,E.invert(M)],Xt(this),w.start()}_t(m),w.wheel=setTimeout(k,x),w.zoom("mouse",n(N(b(E,T),w.mouse[0],w.mouse[1]),w.extent,a));function k(){w.wheel=null,w.end()}}function L(m,...C){if(f||!t.apply(this,arguments))return;var w=m.currentTarget,E=A(this,C,!0).event(m),T=j(m.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",X,!0),M=it(m,w),k=m.clientX,R=m.clientY;Fn(m.view),se(m),E.mouse=[M,this.__zoom.invert(M)],Xt(this),E.start();function F(H){if(_t(H),!E.moved){var q=H.clientX-k,G=H.clientY-R;E.moved=q*q+G*G>y}E.event(H).zoom("mouse",n(N(E.that.__zoom,E.mouse[0]=it(H,w),E.mouse[1]),E.extent,a))}function X(H){T.on("mousemove.zoom mouseup.zoom",null),Hn(H.view,E.moved),_t(H),E.event(H).end()}}function z(m,...C){if(t.apply(this,arguments)){var w=this.__zoom,E=it(m.changedTouches?m.changedTouches[0]:m,this),T=w.invert(E),M=w.k*(m.shiftKey?.5:2),k=n(N(b(w,M),E,T),e.apply(this,C),a);_t(m),s>0?j(this).transition().duration(s).call(_,k,E,m):j(this).call(g.transform,k,E,m)}}function D(m,...C){if(t.apply(this,arguments)){var w=m.touches,E=w.length,T=A(this,C,m.changedTouches.length===E).event(m),M,k,R,F;for(se(m),k=0;k<E;++k)R=w[k],F=it(R,this),F=[F,this.__zoom.invert(F),R.identifier],T.touch0?!T.touch1&&T.touch0[2]!==F[2]&&(T.touch1=F,T.taps=0):(T.touch0=F,M=!0,T.taps=1+!!l);l&&(l=clearTimeout(l)),M&&(T.taps<2&&(h=F[0],l=setTimeout(function(){l=null},d)),Xt(this),T.start())}}function $(m,...C){if(this.__zooming){var w=A(this,C).event(m),E=m.changedTouches,T=E.length,M,k,R,F;for(_t(m),M=0;M<T;++M)k=E[M],R=it(k,this),w.touch0&&w.touch0[2]===k.identifier?w.touch0[0]=R:w.touch1&&w.touch1[2]===k.identifier&&(w.touch1[0]=R);if(k=w.that.__zoom,w.touch1){var X=w.touch0[0],H=w.touch0[1],q=w.touch1[0],G=w.touch1[1],W=(W=q[0]-X[0])*W+(W=q[1]-X[1])*W,nt=(nt=G[0]-H[0])*nt+(nt=G[1]-H[1])*nt;k=b(k,Math.sqrt(W/nt)),R=[(X[0]+q[0])/2,(X[1]+q[1])/2],F=[(H[0]+G[0])/2,(H[1]+G[1])/2]}else if(w.touch0)R=w.touch0[0],F=w.touch0[1];else return;w.zoom("touch",n(N(k,R,F),w.extent,a))}}function P(m,...C){if(this.__zooming){var w=A(this,C).event(m),E=m.changedTouches,T=E.length,M,k;for(se(m),f&&clearTimeout(f),f=setTimeout(function(){f=null},d),M=0;M<T;++M)k=E[M],w.touch0&&w.touch0[2]===k.identifier?delete w.touch0:w.touch1&&w.touch1[2]===k.identifier&&delete w.touch1;if(w.touch1&&!w.touch0&&(w.touch0=w.touch1,delete w.touch1),w.touch0)w.touch0[1]=this.__zoom.invert(w.touch0[0]);else if(w.end(),w.taps===2&&(k=it(k,this),Math.hypot(h[0]-k[0],h[1]-k[1])<v)){var R=j(this).on("dblclick.zoom");R&&R.apply(this,arguments)}}}return g.wheelDelta=function(m){return arguments.length?(r=typeof m=="function"?m:Rt(+m),g):r},g.filter=function(m){return arguments.length?(t=typeof m=="function"?m:Rt(!!m),g):t},g.touchable=function(m){return arguments.length?(i=typeof m=="function"?m:Rt(!!m),g):i},g.extent=function(m){return arguments.length?(e=typeof m=="function"?m:Rt([[+m[0][0],+m[0][1]],[+m[1][0],+m[1][1]]]),g):e},g.scaleExtent=function(m){return arguments.length?(o[0]=+m[0],o[1]=+m[1],g):[o[0],o[1]]},g.translateExtent=function(m){return arguments.length?(a[0][0]=+m[0][0],a[1][0]=+m[1][0],a[0][1]=+m[0][1],a[1][1]=+m[1][1],g):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},g.constrain=function(m){return arguments.length?(n=m,g):n},g.duration=function(m){return arguments.length?(s=+m,g):s},g.interpolate=function(m){return arguments.length?(c=m,g):c},g.on=function(){var m=u.on.apply(u,arguments);return m===u?g:m},g.clickDistance=function(m){return arguments.length?(y=(m=+m)*m,g):Math.sqrt(y)},g.tapDistance=function(m){return arguments.length?(v=+m,g):v},g}function iu(t,e){const n=ru().scaleExtent([.1,10]).on("zoom",r=>{e.attr("transform",r.transform.toString())});return t.call(n),n}function ou(t,e){const n=qa().on("start",(r,i)=>{r.active||e.alphaTarget(.3).restart(),i.fx=i.x,i.fy=i.y}).on("drag",(r,i)=>{i.fx=r.x,i.fy=r.y}).on("end",(r,i)=>{r.active||e.alphaTarget(0),i.fx=null,i.fy=null});t.call(n)}function au(t,e,n,r){return e.on("click.highlight",(i,o)=>{i.stopPropagation();const a=r.filter(c=>{if(c.source.id!==o.id&&c.target.id!==o.id)return!1;const u=n.filter(l=>l===c).node();return u!==null&&!u.classList.contains("mv-hidden")}),s=new Set([o.id]);for(const c of a)s.add(c.source.id),s.add(c.target.id);e.classed("mv-highlighted",c=>s.has(c.id)).classed("mv-dimmed",c=>!s.has(c.id)),n.classed("mv-highlighted",function(c){return this.classList.contains("mv-hidden")?!1:c.source.id===o.id||c.target.id===o.id}).classed("mv-dimmed",function(c){return this.classList.contains("mv-hidden")?!1:c.source.id!==o.id&&c.target.id!==o.id})}),t.on("click.highlight",()=>{e.classed("mv-highlighted",!1).classed("mv-dimmed",!1),n.classed("mv-highlighted",!1).classed("mv-dimmed",!1)}),()=>{e.on("click.highlight",null),t.on("click.highlight",null)}}function su(t,e,n){const r=[...new Set(n.map(a=>a.kind))],i=document.createElement("div");i.className="mv-filter-panel",i.setAttribute("role","group"),i.setAttribute("aria-label","Edge kind filters");const o=document.createElement("div");o.className="mv-filter-heading",o.textContent="Edge Kinds",i.appendChild(o);for(const a of r){const s=document.createElement("label");s.className="mv-filter-label";const c=document.createElement("input");c.type="checkbox",c.checked=!0,c.dataset.kind=a,c.addEventListener("change",()=>{e.filter(l=>l.kind===a).classed("mv-hidden",!c.checked)}),s.appendChild(c),s.appendChild(document.createTextNode(` ${a}`)),i.appendChild(s)}return t.appendChild(i),()=>{i.remove()}}function uu(t,e){const n=document.createElement("div");n.className="mv-search";const r=document.createElement("input");r.type="text",r.placeholder="Search nodes...",r.className="mv-search-input",r.setAttribute("aria-label","Search nodes");let i=null;return r.addEventListener("input",()=>{i&&clearTimeout(i),i=setTimeout(()=>{const o=r.value.trim().toLowerCase();if(o===""){e.classed("mv-search-dimmed",!1);return}e.classed("mv-search-dimmed",a=>!a.name.toLowerCase().includes(o))},150)}),n.appendChild(r),t.appendChild(n),()=>{i&&clearTimeout(i),n.remove()}}function cu(t,e){const n=document.createElement("div");n.className="mv-evidence-sidebar",n.classList.add("mv-hidden"),t.appendChild(n);function r(a){n.classList.remove("mv-hidden"),n.replaceChildren(),t.dispatchEvent(new CustomEvent("mv-sidebar-open",{detail:"evidence"}));const s=document.createElement("div");s.className="mv-evidence-header";const c=document.createElement("span");c.textContent=`${a.source.name} → ${a.target.name}`;const u=document.createElement("button");u.className="mv-evidence-close",u.textContent="×",u.setAttribute("aria-label","Close"),u.addEventListener("click",i),s.appendChild(c),s.appendChild(u),n.appendChild(s);const l=document.createElement("div");l.className="mv-evidence-kind",l.textContent=`Kind: ${a.kind}`,n.appendChild(l);const h=document.createElement("ul");h.className="mv-evidence-list";for(const f of a.evidence){const d=document.createElement("li");d.textContent=`${f.file}:${f.line}`,h.appendChild(d)}n.appendChild(h)}function i(){n.classList.add("mv-hidden")}e.style("cursor","pointer").on("click",(a,s)=>{a.stopPropagation(),r(s)});function o(a){a.detail!=="evidence"&&i()}return t.addEventListener("mv-sidebar-open",o),{destroy:()=>{n.remove(),t.removeEventListener("mv-sidebar-open",o),e.on("click",null)},hideSidebar:i,sidebarElement:n}}const cn={loc:"LOC",cc:"CC",mi:"MI",max_cc:"CC (Max)",median_cc:"CC (Median)",mi_min:"MI (Min)",mi_median:"MI (Median)"};function lu(t){return t in cn?cn[t]:t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function O(t,...e){const n=document.createElement("p");for(const r of e)if(typeof r=="string")n.appendChild(document.createTextNode(r));else{const i=document.createElement(r.tag);i.textContent=r.text,n.appendChild(i)}t.appendChild(n)}function ct(t,e){const n=document.createElement("table");n.className="mv-modal-benchmarks";for(const[r,i]of e){const o=document.createElement("tr"),a=document.createElement("td");a.textContent=r;const s=document.createElement("td");s.textContent=i,o.appendChild(a),o.appendChild(s),n.appendChild(o)}t.appendChild(n)}const Pt={loc:{title:"LOC — Lines of Code",build(t){O(t,"Count of non-empty, non-comment-only lines in the file. Lines with code followed by an inline comment are counted."),O(t,{tag:"strong",text:"Lower is better."}," Smaller files are easier to understand and maintain."),ct(t,[["1–100","Good — small, easy to maintain"],["100–300","Moderate — consider if it does too much"],["300–500","Concerning — likely needs splitting"],["500+","Bad — strong candidate for refactoring"]])}},cc:{title:"CC — Cyclomatic Complexity",build(t){O(t,"Number of independent code paths through a function. Starts at 1, then +1 for each ",{tag:"code",text:"if"},", ",{tag:"code",text:"elif"},", ",{tag:"code",text:"while"},", ",{tag:"code",text:"for"},", ",{tag:"code",text:"match"}," branch, ",{tag:"code",text:"and"},"/",{tag:"code",text:"or"}," operator, or ternary expression."),O(t,{tag:"strong",text:"Lower is better."}," Fewer paths = easier testing."),ct(t,[["1–5","Good — simple, easy to test"],["6–10","Moderate — still manageable"],["11–20","Concerning — hard to test thoroughly"],["21+","Bad — should be refactored"]])}},max_cc:{title:"CC (Max) — Maximum Cyclomatic Complexity",build(t){O(t,"The highest CC among all functions in the file. Identifies the single most complex function (the “hotspot”)."),O(t,"A file with CC (Max) = 15 means at least one function has 15 independent code paths."),O(t,{tag:"strong",text:"Lower is better."}),ct(t,[["1–5","Good — simple, easy to test"],["6–10","Moderate — still manageable"],["11–20","Concerning — hard to test thoroughly"],["21+","Bad — should be refactored"]])}},median_cc:{title:"CC (Median) — Median Cyclomatic Complexity",build(t){O(t,"The median CC across all functions in the file. Represents the ",{tag:"em",text:"typical"}," function complexity."),O(t,"Unlike CC (Max), this is not skewed by one bad function. A value above 5 suggests most functions are moderately complex."),O(t,{tag:"strong",text:"Lower is better."}),ct(t,[["1–5","Good — simple, easy to test"],["6–10","Moderate — still manageable"],["11–20","Concerning — hard to test thoroughly"],["21+","Bad — should be refactored"]])}},mi:{title:"MI — File-Level Maintainability Index",build(t){O(t,"How hard is this file ",{tag:"em",text:"as a whole"}," to wrap your head around? A composite score (0–171) combining size (LOC), complexity (CC), and information density (Halstead volume)."),O(t,{tag:"strong",text:"Formula:"}," ",{tag:"code",text:"MI = 171 − 5.2·ln(V) − 0.23·CC − 16.2·ln(LOC)"}),O(t,"File-level MI is almost always lower than any individual function’s MI, because it aggregates volume and LOC across the entire file. A file with 15 perfectly clean functions can still score low simply because there’s a lot of code in total. Use MI (Min) and MI (Median) for a per-function perspective."),O(t,{tag:"strong",text:"Higher is better."}),ct(t,[["> 85","Highly maintainable"],["65–85","Moderate"],["< 65","Low"]])}},mi_min:{title:"MI (Min) — Worst Per-Function MI",build(t){O(t,"How bad is the worst individual function? The ",{tag:"em",text:"lowest"}," MI among all functions in the file."),O(t,"Because file-level MI aggregates across the whole file, it can look low even when every function is fine. MI (Min) cuts through that noise—if this number is healthy, no single function is a problem."),O(t,{tag:"strong",text:"Higher is better."}),ct(t,[["> 85","Highly maintainable"],["65–85","Moderate"],["< 65","Low"]])}},mi_median:{title:"MI (Median) — Median Per-Function MI",build(t){O(t,"How maintainable is the ",{tag:"em",text:"typical"}," function? The median MI across all functions in the file."),O(t,"If MI (Median) is high but MI (Min) is low, most functions are healthy and only one outlier needs attention. If both are low, the file has widespread maintainability issues."),O(t,{tag:"strong",text:"Higher is better."}),ct(t,[["> 85","Highly maintainable"],["65–85","Moderate"],["< 65","Low"]])}}};function fu(t,e,n){const r=document.createElement("div");r.className="mv-node-detail-sidebar",r.classList.add("mv-hidden"),t.appendChild(r);let i=null;function o(l){r.classList.remove("mv-hidden"),r.replaceChildren(),t.dispatchEvent(new CustomEvent("mv-sidebar-open",{detail:"node-detail"}));const h=document.createElement("div");h.className="mv-node-detail-header";const f=document.createElement("span");f.textContent=l.name;const d=document.createElement("button");d.className="mv-node-detail-close",d.textContent="×",d.setAttribute("aria-label","Close"),d.addEventListener("click",c),h.appendChild(f),h.appendChild(d),r.appendChild(h);const x=document.createElement("div");x.className="mv-node-detail-section";const y=document.createElement("div");y.className="mv-node-detail-section-heading",y.textContent="Info",x.appendChild(y);const v=document.createElement("table");v.className="mv-node-detail-table",s(v,"ID",l.id),s(v,"Kind",l.kind),s(v,"Language",l.language),l.tags.length>0&&s(v,"Tags",l.tags.join(", ")),x.appendChild(v),r.appendChild(x);const g=document.createElement("div");g.className="mv-node-detail-section";const b=document.createElement("div");b.className="mv-node-detail-section-heading",b.textContent="Metrics",g.appendChild(b);const N=document.createElement("table");N.className="mv-node-detail-table";const p=l.metrics,_=Object.keys(p);for(const S of _){const L=p[S];if(typeof L!="number"&&L!==null)continue;const z=lu(S),D=L==null?"—":String(L);s(N,z,D,S in Pt?S:void 0)}g.appendChild(N),r.appendChild(g);const A=l.metrics.functions;if(A&&A.length>0){const S=[...A].sort((M,k)=>k.cc-M.cc),L=5,z=S.length>L,D=document.createElement("div");D.className="mv-node-detail-section";const $=document.createElement("div");$.className="mv-node-detail-section-heading",$.textContent=`Functions (${S.length})`,D.appendChild($);const P=document.createElement("div");P.className="mv-node-detail-functions";const m=document.createElement("table");m.className="mv-node-detail-fn-table";const C=document.createElement("thead"),w=document.createElement("tr"),E={LOC:"loc",CC:"cc",MI:"mi"};for(const M of["Name","Line","LOC","CC","MI"]){const k=document.createElement("th");k.textContent=M,M in E&&(k.title=Pt[E[M]].title),w.appendChild(k)}C.appendChild(w),m.appendChild(C);const T=document.createElement("tbody");if(S.forEach((M,k)=>{const R=document.createElement("tr");z&&k>=L&&R.classList.add("mv-hidden");const F=document.createElement("td");F.className="mv-node-detail-fn-name",F.textContent=M.name,F.title=M.name,R.appendChild(F);const X=document.createElement("td");X.textContent=`L${M.line}`,R.appendChild(X);const H=document.createElement("td");H.textContent=String(M.loc),R.appendChild(H);const q=document.createElement("td");q.textContent=String(M.cc),M.cc>10&&q.classList.add("mv-node-detail-fn-warn"),R.appendChild(q);const G=document.createElement("td");M.mi===null?G.textContent="—":(G.textContent=String(M.mi),M.mi<65&&G.classList.add("mv-node-detail-fn-warn")),R.appendChild(G),T.appendChild(R)}),m.appendChild(T),P.appendChild(m),z){const M=document.createElement("button");M.className="mv-node-detail-fn-toggle",M.textContent=`Show all (${S.length})`;let k=!1;M.addEventListener("click",()=>{k=!k,T.querySelectorAll("tr").forEach((F,X)=>{X>=L&&F.classList.toggle("mv-hidden",!k)}),M.textContent=k?"Show less":`Show all (${S.length})`}),P.appendChild(M)}D.appendChild(P),r.appendChild(D)}const I=n.filter(S=>S.source.id===l.id||S.target.id===l.id);if(I.length>0){const S=document.createElement("div");S.className="mv-node-detail-section";const L=document.createElement("div");L.className="mv-node-detail-section-heading",L.textContent=`Connections (${I.length})`,S.appendChild(L);const z=document.createElement("ul");z.className="mv-node-detail-connections";for(const D of I){const $=document.createElement("li"),P=D.source.id===l.id,m=P?D.target:D.source,C=P?"→":"←",w=document.createElement("a");w.className="mv-node-detail-conn-link",w.href="#",w.textContent=`${C} ${m.name}`,w.addEventListener("click",T=>{T.preventDefault(),T.stopPropagation();const M=e.filter(k=>k.id===m.id).node();M&&M.dispatchEvent(new MouseEvent("click",{bubbles:!0}))});const E=document.createElement("span");E.className="mv-node-detail-conn-kind",E.textContent=` (${D.kind})`,$.appendChild(w),$.appendChild(E),z.appendChild($)}S.appendChild(z),r.appendChild(S)}}function a(l){const h=document.querySelector(".mv-metric-modal-overlay");h&&h.remove();const f=document.createElement("div");f.className="mv-metric-modal-overlay",f.setAttribute("role","dialog"),f.setAttribute("aria-modal","true");const d=document.createElement("div");d.className="mv-metric-modal";const x=document.createElement("div");x.className="mv-metric-modal-header";const y=document.createElement("span");y.className="mv-metric-modal-title";const v=`mv-modal-title-${Date.now()}`;y.id=v,f.setAttribute("aria-labelledby",v),y.textContent=l.title;const g=document.createElement("button");g.className="mv-metric-modal-close",g.textContent="×",g.setAttribute("aria-label","Close"),x.appendChild(y),x.appendChild(g),d.appendChild(x);const b=document.createElement("div");b.className="mv-metric-modal-body",l.build(b),d.appendChild(b),f.appendChild(d),document.body.appendChild(f),i=f;function N(){f.remove(),i=null,document.removeEventListener("keydown",p)}function p(_){_.key==="Escape"&&N()}g.addEventListener("click",N),f.addEventListener("click",_=>{_.target===f&&N()}),document.addEventListener("keydown",p)}function s(l,h,f,d){const x=document.createElement("tr"),y=document.createElement("td");if(y.className="mv-node-detail-label",y.textContent=h,d&&d in Pt){const g=document.createElement("button");g.type="button",g.className="mv-metric-info",g.textContent="?",g.addEventListener("click",b=>{b.stopPropagation(),a(Pt[d])}),y.appendChild(g)}const v=document.createElement("td");v.className="mv-node-detail-value",v.textContent=f,x.appendChild(y),x.appendChild(v),l.appendChild(x)}function c(){r.classList.add("mv-hidden")}e.on("click.nodedetail",(l,h)=>{l.stopPropagation(),o(h)});function u(l){l.detail!=="node-detail"&&c()}return t.addEventListener("mv-sidebar-open",u),{destroy:()=>{i?.remove(),i=null,r.remove(),t.removeEventListener("mv-sidebar-open",u),e.on("click.nodedetail",null)},hideSidebar:c,sidebarElement:r}}function hu(t,e,n,r){const i=document.createElement("div");i.className="mv-controls",t.appendChild(i);const o=su(i,n,r),a=uu(i,e),s=cu(t,n),c=fu(t,e,r);function u(l){const h=l.target;!s.sidebarElement.contains(h)&&!c.sidebarElement.contains(h)&&(s.hideSidebar(),c.hideSidebar())}return t.addEventListener("click",u),()=>{o(),a(),s.destroy(),c.destroy(),t.removeEventListener("click",u),i.remove()}}function du(t,e,n){const r=n?.width??Bo,i=n?.height??Xo,o=getComputedStyle(t);o.position==="static"&&(t.style.position="relative"),o.overflow==="visible"&&(t.style.overflow="hidden");const a=qo(),s=Vo(),c=Go(),u=Uo(),l=e.nodes.map(_=>({..._})),h=new Map(l.map(_=>[_.id,_])),f=e.links.filter(_=>h.has(_.source)&&h.has(_.target)).map(_=>({source:h.get(_.source),target:h.get(_.target),kind:_.kind,weight:_.weight,evidence:_.evidence})),d=j(t).append("svg").attr("width",r).attr("height",i).attr("viewBox",`0 0 ${r} ${i}`),x=d.append("g");iu(d,x);const y=Pa(x,f,s,u),v=Ra(x,l,a,c),g=Da(l,f,r,i);ou(v,g);const b=au(d,v,y,f),N=hu(t,v,y,f);g.on("tick",()=>{y.attr("x1",_=>_.source.x).attr("y1",_=>_.source.y).attr("x2",_=>_.target.x).attr("y2",_=>_.target.y),v.attr("transform",_=>`translate(${_.x},${_.y})`)});function p(){b(),N(),g.stop(),d.remove()}return{destroy:p}}exports.SchemaValidationError=B;exports.renderGraph=du;exports.validateGraphData=Yn;
|
|
2
|
+
//# sourceMappingURL=simple-code-graph-viewer.cjs.map
|