know-do-graph 0.1.0__py3-none-any.whl
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.
- agents/__init__.py +0 -0
- agents/extraction_agent/__init__.py +0 -0
- agents/extraction_agent/agent.py +170 -0
- agents/graph_agent/__init__.py +5 -0
- agents/graph_agent/agent.py +373 -0
- agents/graph_agent/tools.py +2106 -0
- agents/maintenance_agent/__init__.py +0 -0
- agents/maintenance_agent/agent.py +283 -0
- agents/orchestrator/__init__.py +0 -0
- agents/orchestrator/agent.py +217 -0
- agents/review_agent/__init__.py +0 -0
- agents/review_agent/agent.py +188 -0
- agents/review_agent/tools.py +472 -0
- api/__init__.py +0 -0
- api/main.py +136 -0
- api/routes/__init__.py +0 -0
- api/routes/agent.py +81 -0
- api/routes/entries.py +411 -0
- api/routes/graph.py +132 -0
- api/routes/mem.py +179 -0
- api/routes/remote.py +815 -0
- api/routes/remote_sync.py +230 -0
- api/routes/retrieve.py +88 -0
- core/__init__.py +0 -0
- core/app_state.py +9 -0
- core/events.py +84 -0
- core/extraction/__init__.py +0 -0
- core/extraction/wikilink_parser.py +48 -0
- core/graph/__init__.py +0 -0
- core/graph/graph.py +204 -0
- core/memory/__init__.py +0 -0
- core/memory/memgraph.py +458 -0
- core/resources/starter.db +0 -0
- core/retrieval/__init__.py +0 -0
- core/retrieval/embedder.py +122 -0
- core/retrieval/fusion.py +52 -0
- core/retrieval/progressive.py +399 -0
- core/retrieval/retrieval.py +346 -0
- core/retrieval/vector_store.py +91 -0
- core/schemas/__init__.py +0 -0
- core/schemas/edge.py +46 -0
- core/schemas/entry.py +388 -0
- core/storage/__init__.py +0 -0
- core/storage/database.py +104 -0
- core/storage/models.py +66 -0
- core/storage/repository.py +243 -0
- core/sync/__init__.py +20 -0
- core/sync/autolink.py +301 -0
- core/sync/db_merge.py +297 -0
- core/sync/db_watcher.py +84 -0
- core/sync/remote_sync.py +345 -0
- examples/__init__.py +0 -0
- examples/example_entries.py +206 -0
- examples/pymatgen_interface_examples.py +811 -0
- frontend/dist/assets/index-BLfo7ZZu.css +1 -0
- frontend/dist/assets/index-G-mYbZ9R.js +83 -0
- frontend/dist/assets/index-G-mYbZ9R.js.map +1 -0
- frontend/dist/index.html +92 -0
- know_do_graph-0.1.0.dist-info/METADATA +765 -0
- know_do_graph-0.1.0.dist-info/RECORD +63 -0
- know_do_graph-0.1.0.dist-info/WHEEL +4 -0
- know_do_graph-0.1.0.dist-info/entry_points.txt +2 -0
- main.py +944 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--bg-0: #0a0d12;--bg-1: #0d1117;--bg-2: #161b22;--bg-3: #1c2128;--bg-elev: #21262d;--border: #30363d;--border-soft: #21262d;--text: #e6edf3;--text-muted: #8b949e;--text-dim: #6e7681;--accent: #58a6ff;--accent-soft: #79c0ff;--accent-bg: rgba(31, 111, 235, .15);--success: #3fb950;--warn: #d29922;--danger: #f85149;--edge-color: #444c56;--c-capability: #238636;--c-procedure: #1f6feb;--c-workflow: #d29922;--c-tool: #8957e5;--c-repository: #bf8700;--c-environment: #1a7f5a;--c-dependency: #cf222e;--c-data: #388bfd;--c-analytical: #a371f7;--c-memory: #6e7781;--c-generic: #444c56;--toolbar-h: 56px;--panel-w: 380px;--radius: 8px;--radius-sm: 6px;--radius-pill: 999px;--ease: cubic-bezier(.4, 0, .2, 1);--dur-fast: .12s;--dur: .2s}*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}html,body{height:100%}body{font-family:Inter,system-ui,-apple-system,Segoe UI,sans-serif;font-size:13px;line-height:1.45;background:var(--bg-0);color:var(--text);-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;overflow:hidden}code,kbd,pre{font-family:JetBrains Mono,SF Mono,Menlo,monospace}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:var(--border);border-radius:var(--radius-pill);border:2px solid var(--bg-2)}::-webkit-scrollbar-thumb:hover{background:var(--text-dim)}button{font:inherit;color:inherit;background:none;border:none;cursor:pointer}input,select{font:inherit;color:inherit}body{display:flex;flex-direction:column;height:100vh}#error-banner{background:#3d0b0b;border-bottom:1px solid var(--danger);color:#ffa198;padding:8px 16px;font-size:13px;text-align:center}#error-banner[hidden]{display:none}#main{display:flex;flex:1;min-height:0;overflow:hidden}#canvas{position:relative;flex:1;overflow:hidden;background:radial-gradient(circle at 30% 20%,rgba(88,166,255,.04),transparent 60%),radial-gradient(circle at 80% 80%,rgba(137,87,229,.04),transparent 55%),var(--bg-1)}#graph-svg{width:100%;height:100%;cursor:grab;display:block}#graph-svg:active{cursor:grabbing}#loading{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;font-size:14px;color:var(--text-muted);background:var(--bg-1);z-index:10}#loading.hidden{display:none}#detail{width:var(--panel-w);background:var(--bg-2);border-left:1px solid var(--border);overflow-y:auto;flex-shrink:0;display:flex;flex-direction:column;transition:width var(--dur) var(--ease),border-color var(--dur) var(--ease)}#detail.hidden{width:0;border-left-color:transparent;overflow:hidden}@media (max-width: 900px){:root{--panel-w: 320px}.toolbar-actions .btn{padding:6px 10px}}@media (max-width: 700px){#toolbar{flex-wrap:wrap;height:auto;padding:8px 12px}#detail{position:absolute;right:0;top:0;bottom:0;height:100%;z-index:50;box-shadow:-8px 0 30px #00000080}}#toolbar{display:flex;align-items:center;gap:14px;height:var(--toolbar-h);padding:0 18px;background:linear-gradient(180deg,#161b22,#131820);border-bottom:1px solid var(--border);flex-shrink:0}.brand{display:flex;align-items:center;gap:8px;flex-shrink:0}.brand-dot{width:10px;height:10px;border-radius:50%;background:linear-gradient(135deg,var(--accent),#8957e5);box-shadow:0 0 12px #58a6ff99}.brand h1{font-size:14px;font-weight:600;letter-spacing:-.01em;color:var(--text);white-space:nowrap}.search-wrap{position:relative;flex:1;max-width:420px;min-width:200px;display:flex;align-items:center}.search-wrap .search-icon{position:absolute;left:10px;color:var(--text-dim);pointer-events:none}.search-wrap input{width:100%;background:var(--bg-1);border:1px solid var(--border);border-radius:var(--radius-sm);color:var(--text);padding:7px 36px 7px 30px;font-size:13px;transition:border-color var(--dur-fast),box-shadow var(--dur-fast)}.search-wrap input:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-bg)}.search-wrap .kbd-hint{position:absolute;right:8px;background:var(--bg-elev);border:1px solid var(--border);border-radius:4px;color:var(--text-dim);padding:1px 6px;font-size:11px;pointer-events:none}.search-wrap input:focus+.kbd-hint{display:none}#type-filter{background:var(--bg-1);border:1px solid var(--border);border-radius:var(--radius-sm);padding:6px 10px;font-size:13px;cursor:pointer}#type-filter:focus{outline:none;border-color:var(--accent)}.toolbar-actions{display:flex;gap:6px;align-items:center}.color-mode-wrap{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--text-muted)}.color-mode-wrap select{background:var(--bg-1);border:1px solid var(--border);border-radius:var(--radius-sm);color:var(--text);padding:5px 8px;font-size:12px;cursor:pointer}.color-mode-wrap select:focus{outline:none;border-color:var(--accent)}.btn{background:var(--bg-elev);border:1px solid var(--border);border-radius:var(--radius-sm);color:var(--text);padding:6px 12px;font-size:12px;font-weight:500;transition:background var(--dur-fast),border-color var(--dur-fast),color var(--dur-fast);white-space:nowrap}.btn:hover{background:#2d333b;border-color:#444c56}.btn.active{background:var(--accent-bg);border-color:var(--accent);color:var(--accent-soft)}.toolbar-status{display:flex;align-items:center;gap:10px;margin-left:auto}.badge{font-size:11px;padding:3px 9px;border-radius:var(--radius-pill);border:1px solid var(--border);color:var(--text-muted);white-space:nowrap;transition:all var(--dur)}.badge.connected{border-color:#3fb95066;color:var(--success);background:#3fb95014}.badge.updating{border-color:var(--accent);color:var(--accent-soft);background:var(--accent-bg)}.badge.disconnected{border-color:#f8514966;color:var(--danger);background:#f8514914}.stats{font-size:12px;color:var(--text-muted);white-space:nowrap;font-variant-numeric:tabular-nums}#tooltip{position:fixed;background:var(--bg-3);border:1px solid var(--border);border-radius:var(--radius);padding:10px 14px;font-size:12px;pointer-events:none;opacity:0;transition:opacity var(--dur-fast);max-width:300px;z-index:100;box-shadow:0 12px 30px #0000008c}#tooltip.visible{opacity:1}#tooltip .tt-title{font-weight:600;font-size:13px;color:var(--accent);margin-bottom:6px}#tooltip .tt-row{display:flex;gap:8px;margin-top:3px}#tooltip .tt-key{color:var(--text-muted);flex-shrink:0;min-width:64px}#tooltip .tt-val{color:var(--text);word-break:break-word}#tooltip .tt-tags span{background:var(--bg-elev);border:1px solid var(--border);border-radius:var(--radius-pill);padding:1px 7px;font-size:11px;margin:2px 2px 0 0;display:inline-block}#detail-header{display:flex;align-items:center;justify-content:space-between;padding:14px 18px 12px;border-bottom:1px solid var(--border);flex-shrink:0;position:sticky;top:0;background:var(--bg-2);z-index:2}#detail-header h2{font-size:14px;font-weight:600;color:var(--accent);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#detail-close{color:var(--text-muted);font-size:22px;line-height:1;padding:0 4px;border-radius:4px;transition:color var(--dur-fast),background var(--dur-fast)}#detail-close:hover{color:var(--text);background:var(--bg-elev)}#detail-body{padding:16px 18px 20px;flex:1}.detail-section{margin-bottom:20px}.detail-section-title{font-size:10px;font-weight:700;text-transform:uppercase;color:var(--text-muted);letter-spacing:.08em;margin-bottom:8px}.detail-kv{display:flex;gap:10px;margin-bottom:6px;font-size:12px;align-items:flex-start}.detail-kv .k{color:var(--text-muted);min-width:120px;flex-shrink:0}.detail-kv .v{color:var(--text);word-break:break-word}.tag-pill{background:var(--bg-elev);border:1px solid var(--border);border-radius:var(--radius-pill);padding:2px 10px;font-size:11px;margin:2px 3px 0 0;display:inline-block;color:var(--text)}.content-block{background:var(--bg-1);border:1px solid var(--border);border-radius:var(--radius-sm);padding:10px 12px;font-size:12px;line-height:1.6;color:#c9d1d9;white-space:pre-wrap;max-height:280px;overflow-y:auto}.edge-list-item{display:flex;align-items:center;gap:8px;padding:6px 0;border-bottom:1px solid var(--border-soft);font-size:12px}.edge-list-item:last-child{border-bottom:none}.rel-badge{background:var(--bg-elev);border:1px solid var(--border);border-radius:4px;padding:1px 6px;font-size:10px;color:var(--accent-soft);white-space:nowrap}.node-link{color:var(--accent);cursor:pointer;text-decoration:underline dotted;text-underline-offset:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.node-link:hover{color:var(--accent-soft)}.dir-badge{font-size:11px;color:var(--text-muted)}.script-card{margin-bottom:12px;padding:10px;background:var(--bg-1);border:1px solid var(--border);border-radius:var(--radius-sm)}.script-card a.dl-btn{display:inline-block;margin-top:8px;background:linear-gradient(135deg,#e36209,#d15704);color:#fff;border-radius:var(--radius-sm);padding:6px 14px;font-size:12px;text-decoration:none;font-weight:600;transition:transform var(--dur-fast),box-shadow var(--dur-fast)}.script-card a.dl-btn:hover{transform:translateY(-1px);box-shadow:0 4px 12px #e3620966}.asset-tree{display:flex;flex-direction:column;gap:6px}.asset-folder{background:var(--bg-1);border:1px solid var(--border);border-radius:var(--radius-sm);overflow:hidden}.asset-folder-summary{display:flex;align-items:center;gap:8px;padding:8px 10px;cursor:pointer;-webkit-user-select:none;user-select:none;font-size:12px;list-style:none;background:var(--bg-2);border-bottom:1px solid var(--border-soft)}.asset-folder-summary::-webkit-details-marker{display:none}.asset-folder[open] .asset-folder-summary{border-bottom-color:var(--border)}.asset-folder-icon{font-size:13px}.asset-folder-name{font-weight:600;color:var(--text);text-transform:lowercase;letter-spacing:.02em}.asset-folder-count{margin-left:auto;font-size:10px;padding:1px 7px;border-radius:var(--radius-pill);background:var(--bg-elev);border:1px solid var(--border);color:var(--text-muted)}.asset-folder-body{padding:8px 10px;display:flex;flex-direction:column;gap:8px}.asset-item{background:var(--bg-2);border:1px solid var(--border-soft);border-radius:var(--radius-sm);padding:8px 10px}.asset-item-head{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-bottom:4px}.asset-filename{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;color:var(--accent-soft);word-break:break-all;flex:1 1 auto;min-width:0}.asset-tag{font-size:10px;padding:1px 6px;border-radius:4px;background:var(--bg-elev);border:1px solid var(--border);color:var(--text-muted);text-transform:lowercase}.asset-kind-link{color:#79c0ff;border-color:#79c0ff66}.asset-kind-text{color:#b392f0;border-color:#b392f066}.asset-kind-file{color:#d2a8ff;border-color:#d2a8ff66}.asset-desc{font-size:11px;color:var(--text-muted);margin:4px 0;line-height:1.5}.asset-meta-row{display:flex;gap:8px;font-size:11px;margin-top:2px}.asset-meta-row .k{color:var(--text-muted);min-width:60px}.asset-meta-row .v{color:var(--text);word-break:break-word}.asset-btn{display:inline-block;margin-top:6px;padding:4px 10px;font-size:11px;font-weight:600;text-decoration:none;border-radius:var(--radius-sm);border:1px solid var(--border);background:var(--bg-elev);color:var(--text);transition:transform var(--dur-fast),box-shadow var(--dur-fast),background var(--dur-fast)}.asset-btn:hover{transform:translateY(-1px);background:#2d333b}.asset-btn.dl{background:linear-gradient(135deg,#e36209,#d15704);border-color:transparent;color:#fff}.asset-btn.dl:hover{box-shadow:0 4px 12px #e3620966}.asset-btn.link{background:linear-gradient(135deg,#1f6feb,#1158c7);border-color:transparent;color:#fff}.asset-btn.link:hover{box-shadow:0 4px 12px #1f6feb66}#legend{position:absolute;bottom:16px;left:16px;background:#161b22eb;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border:1px solid var(--border);border-radius:var(--radius);padding:10px 14px;font-size:11px;z-index:5;max-width:200px}#legend .leg-title{font-weight:600;color:var(--text-muted);margin-bottom:6px;font-size:10px;text-transform:uppercase;letter-spacing:.08em}.leg-item{display:flex;align-items:center;gap:8px;margin-top:4px;color:#c9d1d9}.leg-dot{width:10px;height:10px;border-radius:50%;flex-shrink:0;box-shadow:0 0 0 1px #ffffff1f}.score-ramp-svg{display:block;margin:6px 0 2px;border-radius:3px}.ramp-labels{display:flex;justify-content:space-between;font-size:10px;color:var(--text-muted)}.edge{stroke-opacity:.55;stroke-width:1.5;transition:stroke-opacity var(--dur-fast),stroke-width var(--dur-fast)}.edge.highlighted{stroke-opacity:1;stroke-width:2.5}.node circle{stroke-width:2;transition:r var(--dur-fast) var(--ease),opacity var(--dur-fast);cursor:pointer}.node circle:hover{filter:brightness(1.2)}.node.dimmed circle,.node.dimmed text{opacity:.18}.node.selected circle{stroke:var(--accent);stroke-width:3;filter:drop-shadow(0 0 6px rgba(88,166,255,.6))}.node text{font-size:11px;fill:#c9d1d9;font-family:Inter,sans-serif;font-weight:500;pointer-events:none;dominant-baseline:central;paint-order:stroke;stroke:#0d1117d9;stroke-width:3px;stroke-linejoin:round}.edge-label{font-size:9px;fill:var(--text-muted);pointer-events:none;font-family:JetBrains Mono,monospace}body.labels-off .node text:not(.score-label),body.labels-off .edge-label{display:none!important}.node .score-label{font-size:9px;fill:#fffffff2;font-weight:700;pointer-events:none;text-anchor:middle;dominant-baseline:hanging;stroke:#00000080;stroke-width:2px;paint-order:stroke}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();const Ot="";async function Qt(t){const e=await fetch(`${Ot}${t}`);if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);return e.json()}const bt={getFullGraph:()=>Qt("/graph/full"),getEntry:t=>Qt(`/entries/${t}`),searchEntries:({q:t,type:e,limit:n=200,includeScores:r=!0})=>{const i=new URLSearchParams({q:t,limit:String(n)});return r&&i.set("include_scores","true"),e&&i.set("entry_type",e),Qt(`/entries/search?${i}`)},scriptDownloadUrl:(t,e)=>`${Ot}/entries/${t}/scripts/${encodeURIComponent(e)}`,assetUrl:(t,e,n)=>`${Ot}/entries/${t}/assets/${encodeURIComponent(e)}/${n.split("/").map(encodeURIComponent).join("/")}`,listAssets:t=>Qt(`/entries/${t}/assets`),syncRemote:async(t,{force:e=!0}={})=>{const n=await fetch(`${Ot}/remote-sync/${encodeURIComponent(t)}?force=${e?"true":"false"}`,{method:"POST"});if(!n.ok)throw new Error(`HTTP ${n.status}: ${n.statusText}`);return n.json()},eventsUrl:()=>`${Ot}/graph/events`},C={allNodes:[],allEdges:[],selectedId:null,showLabels:!0,colorMode:"type",apiMatchIds:null,searchScores:{}},Ht=new Map;function ot(t,e){return Ht.has(t)||Ht.set(t,new Set),Ht.get(t).add(e),()=>Ht.get(t).delete(e)}function X(t,e){const n=Ht.get(t);if(n)for(const r of n)try{r(e)}catch(i){console.error(`[state] listener for "${t}" threw:`,i)}}const H={GRAPH_LOADED:"graph:loaded",GRAPH_REFRESH:"graph:refresh",NODE_SELECTED:"node:selected",NODE_CLEARED:"node:cleared",FILTERS_CHANGED:"filters:changed",SCORE_MODE_CHANGED:"scoreMode:changed",COLOR_MODE_CHANGED:"colorMode:changed",LABELS_CHANGED:"labels:changed",SSE_STATUS:"sse:status"};function ie(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Dr(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Vn(t){let e,n,r;t.length!==2?(e=ie,n=(s,f)=>ie(t(s),f),r=(s,f)=>t(s)-f):(e=t===ie||t===Dr?t:Rr,n=t,r=t);function i(s,f,c=0,u=s.length){if(c<u){if(e(f,f)!==0)return u;do{const h=c+u>>>1;n(s[h],f)<0?c=h+1:u=h}while(c<u)}return c}function a(s,f,c=0,u=s.length){if(c<u){if(e(f,f)!==0)return u;do{const h=c+u>>>1;n(s[h],f)<=0?c=h+1:u=h}while(c<u)}return c}function o(s,f,c=0,u=s.length){const h=i(s,f,c,u-1);return h>c&&r(s[h-1],f)>-r(s[h],f)?h-1:h}return{left:i,center:o,right:a}}function Rr(){return 0}function Ir(t){return t===null?NaN:+t}const zr=Vn(ie),Or=zr.right;Vn(Ir).center;const Hr=Math.sqrt(50),Pr=Math.sqrt(10),Fr=Math.sqrt(2);function fe(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),o=a>=Hr?10:a>=Pr?5:a>=Fr?2:1;let s,f,c;return i<0?(c=Math.pow(10,-i)/o,s=Math.round(t*c),f=Math.round(e*c),s/c<t&&++s,f/c>e&&--f,c=-c):(c=Math.pow(10,i)*o,s=Math.round(t/c),f=Math.round(e/c),s*c<t&&++s,f*c>e&&--f),f<s&&.5<=n&&n<2?fe(t,e,n*2):[s,f,c]}function Br(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const r=e<t,[i,a,o]=r?fe(e,t,n):fe(t,e,n);if(!(a>=i))return[];const s=a-i+1,f=new Array(s);if(r)if(o<0)for(let c=0;c<s;++c)f[c]=(a-c)/-o;else for(let c=0;c<s;++c)f[c]=(a-c)*o;else if(o<0)for(let c=0;c<s;++c)f[c]=(i+c)/-o;else for(let c=0;c<s;++c)f[c]=(i+c)*o;return f}function ze(t,e,n){return e=+e,t=+t,n=+n,fe(t,e,n)[2]}function qr(t,e,n){e=+e,t=+t,n=+n;const r=e<t,i=r?ze(e,t,n):ze(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function Gr(t,e){let n;for(const r of t)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);return n}var Xr={value:()=>{}};function Ut(){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 ae(n)}function ae(t){this._=t}function Vr(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}})}ae.prototype=Ut.prototype={constructor:ae,on:function(t,e){var n=this._,r=Vr(t+"",n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(t=r[a]).type)&&(i=Yr(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++a<o;)if(i=(t=r[a]).type)n[i]=fn(n[i],t.name,e);else if(e==null)for(i in n)n[i]=fn(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 ae(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=this._[t],r=0,i=a.length;r<i;++r)a[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,a=r.length;i<a;++i)r[i].value.apply(e,n)}};function Yr(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function fn(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Xr,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var Oe="http://www.w3.org/1999/xhtml";const un={svg:"http://www.w3.org/2000/svg",xhtml:Oe,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Me(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),un.hasOwnProperty(e)?{space:un[e],local:t}:t}function Ur(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Oe&&e.documentElement.namespaceURI===Oe?e.createElement(t):e.createElementNS(n,t)}}function Kr(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Yn(t){var e=Me(t);return(e.local?Kr:Ur)(e)}function Wr(){}function We(t){return t==null?Wr:function(){return this.querySelector(t)}}function Qr(t){typeof t!="function"&&(t=We(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a=e[i],o=a.length,s=r[i]=new Array(o),f,c,u=0;u<o;++u)(f=a[u])&&(c=t.call(f,f.__data__,u,a))&&("__data__"in f&&(c.__data__=f.__data__),s[u]=c);return new W(r,this._parents)}function Zr(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Jr(){return[]}function Un(t){return t==null?Jr:function(){return this.querySelectorAll(t)}}function jr(t){return function(){return Zr(t.apply(this,arguments))}}function ti(t){typeof t=="function"?t=jr(t):t=Un(t);for(var e=this._groups,n=e.length,r=[],i=[],a=0;a<n;++a)for(var o=e[a],s=o.length,f,c=0;c<s;++c)(f=o[c])&&(r.push(t.call(f,f.__data__,c,o)),i.push(f));return new W(r,i)}function Kn(t){return function(){return this.matches(t)}}function Wn(t){return function(e){return e.matches(t)}}var ei=Array.prototype.find;function ni(t){return function(){return ei.call(this.children,t)}}function ri(){return this.firstElementChild}function ii(t){return this.select(t==null?ri:ni(typeof t=="function"?t:Wn(t)))}var ai=Array.prototype.filter;function oi(){return Array.from(this.children)}function si(t){return function(){return ai.call(this.children,t)}}function ci(t){return this.selectAll(t==null?oi:si(typeof t=="function"?t:Wn(t)))}function fi(t){typeof t!="function"&&(t=Kn(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a=e[i],o=a.length,s=r[i]=[],f,c=0;c<o;++c)(f=a[c])&&t.call(f,f.__data__,c,a)&&s.push(f);return new W(r,this._parents)}function Qn(t){return new Array(t.length)}function ui(){return new W(this._enter||this._groups.map(Qn),this._parents)}function ue(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}ue.prototype={constructor:ue,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 li(t){return function(){return t}}function hi(t,e,n,r,i,a){for(var o=0,s,f=e.length,c=a.length;o<c;++o)(s=e[o])?(s.__data__=a[o],r[o]=s):n[o]=new ue(t,a[o]);for(;o<f;++o)(s=e[o])&&(i[o]=s)}function di(t,e,n,r,i,a,o){var s,f,c=new Map,u=e.length,h=a.length,l=new Array(u),g;for(s=0;s<u;++s)(f=e[s])&&(l[s]=g=o.call(f,f.__data__,s,e)+"",c.has(g)?i[s]=f:c.set(g,f));for(s=0;s<h;++s)g=o.call(t,a[s],s,a)+"",(f=c.get(g))?(r[s]=f,f.__data__=a[s],c.delete(g)):n[s]=new ue(t,a[s]);for(s=0;s<u;++s)(f=e[s])&&c.get(l[s])===f&&(i[s]=f)}function gi(t){return t.__data__}function pi(t,e){if(!arguments.length)return Array.from(this,gi);var n=e?di:hi,r=this._parents,i=this._groups;typeof t!="function"&&(t=li(t));for(var a=i.length,o=new Array(a),s=new Array(a),f=new Array(a),c=0;c<a;++c){var u=r[c],h=i[c],l=h.length,g=mi(t.call(u,u&&u.__data__,c,r)),_=g.length,y=s[c]=new Array(_),v=o[c]=new Array(_),m=f[c]=new Array(l);n(u,h,y,v,m,g,e);for(var w=0,S=0,p,M;w<_;++w)if(p=y[w]){for(w>=S&&(S=w+1);!(M=v[S])&&++S<_;);p._next=M||null}}return o=new W(o,r),o._enter=s,o._exit=f,o}function mi(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function yi(){return new W(this._exit||this._groups.map(Qn),this._parents)}function vi(t,e,n){var r=this.enter(),i=this,a=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?a.remove():n(a),r&&i?r.merge(i).order():i}function bi(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,a=r.length,o=Math.min(i,a),s=new Array(i),f=0;f<o;++f)for(var c=n[f],u=r[f],h=c.length,l=s[f]=new Array(h),g,_=0;_<h;++_)(g=c[_]||u[_])&&(l[_]=g);for(;f<i;++f)s[f]=n[f];return new W(s,this._parents)}function _i(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function wi(t){t||(t=xi);function e(h,l){return h&&l?t(h.__data__,l.__data__):!h-!l}for(var n=this._groups,r=n.length,i=new Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,f=i[a]=new Array(s),c,u=0;u<s;++u)(c=o[u])&&(f[u]=c);f.sort(e)}return new W(i,this._parents).order()}function xi(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Ei(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Mi(){return Array.from(this)}function Ni(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function Si(){let t=0;for(const e of this)++t;return t}function $i(){return!this.node()}function Ai(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&t.call(s,s.__data__,a,i);return this}function ki(t){return function(){this.removeAttribute(t)}}function Ti(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Ci(t,e){return function(){this.setAttribute(t,e)}}function Li(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Di(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Ri(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 Ii(t,e){var n=Me(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?Ti:ki:typeof e=="function"?n.local?Ri:Di:n.local?Li:Ci)(n,e))}function Zn(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function zi(t){return function(){this.style.removeProperty(t)}}function Oi(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Hi(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function Pi(t,e,n){return arguments.length>1?this.each((e==null?zi:typeof e=="function"?Hi:Oi)(t,e,n??"")):Tt(this.node(),t)}function Tt(t,e){return t.style.getPropertyValue(e)||Zn(t).getComputedStyle(t,null).getPropertyValue(e)}function Fi(t){return function(){delete this[t]}}function Bi(t,e){return function(){this[t]=e}}function qi(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Gi(t,e){return arguments.length>1?this.each((e==null?Fi:typeof e=="function"?qi:Bi)(t,e)):this.node()[t]}function Jn(t){return t.trim().split(/^|\s+/)}function Qe(t){return t.classList||new jn(t)}function jn(t){this._node=t,this._names=Jn(t.getAttribute("class")||"")}jn.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 tr(t,e){for(var n=Qe(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function er(t,e){for(var n=Qe(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function Xi(t){return function(){tr(this,t)}}function Vi(t){return function(){er(this,t)}}function Yi(t,e){return function(){(e.apply(this,arguments)?tr:er)(this,t)}}function Ui(t,e){var n=Jn(t+"");if(arguments.length<2){for(var r=Qe(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?Yi:e?Xi:Vi)(n,e))}function Ki(){this.textContent=""}function Wi(t){return function(){this.textContent=t}}function Qi(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Zi(t){return arguments.length?this.each(t==null?Ki:(typeof t=="function"?Qi:Wi)(t)):this.node().textContent}function Ji(){this.innerHTML=""}function ji(t){return function(){this.innerHTML=t}}function ta(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function ea(t){return arguments.length?this.each(t==null?Ji:(typeof t=="function"?ta:ji)(t)):this.node().innerHTML}function na(){this.nextSibling&&this.parentNode.appendChild(this)}function ra(){return this.each(na)}function ia(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function aa(){return this.each(ia)}function oa(t){var e=typeof t=="function"?t:Yn(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function sa(){return null}function ca(t,e){var n=typeof t=="function"?t:Yn(t),r=e==null?sa:typeof e=="function"?e:We(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function fa(){var t=this.parentNode;t&&t.removeChild(this)}function ua(){return this.each(fa)}function la(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ha(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function da(t){return this.select(t?ha:la)}function ga(t){return arguments.length?this.property("__data__",t):this.node().__data__}function pa(t){return function(e){t.call(this,e,this.__data__)}}function ma(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 ya(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,a;n<i;++n)a=e[n],(!t.type||a.type===t.type)&&a.name===t.name?this.removeEventListener(a.type,a.listener,a.options):e[++r]=a;++r?e.length=r:delete this.__on}}}function va(t,e,n){return function(){var r=this.__on,i,a=pa(e);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=e;return}}this.addEventListener(t.type,a,n),i={type:t.type,name:t.name,value:e,listener:a,options:n},r?r.push(i):this.__on=[i]}}function ba(t,e,n){var r=ma(t+""),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var f=0,c=s.length,u;f<c;++f)for(i=0,u=s[f];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=e?va:ya,i=0;i<a;++i)this.each(s(r[i],e,n));return this}function nr(t,e,n){var r=Zn(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 _a(t,e){return function(){return nr(this,t,e)}}function wa(t,e){return function(){return nr(this,t,e.apply(this,arguments))}}function xa(t,e){return this.each((typeof e=="function"?wa:_a)(t,e))}function*Ea(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var rr=[null];function W(t,e){this._groups=t,this._parents=e}function Kt(){return new W([[document.documentElement]],rr)}function Ma(){return this}W.prototype=Kt.prototype={constructor:W,select:Qr,selectAll:ti,selectChild:ii,selectChildren:ci,filter:fi,data:pi,enter:ui,exit:yi,join:vi,merge:bi,selection:Ma,order:_i,sort:wi,call:Ei,nodes:Mi,node:Ni,size:Si,empty:$i,each:Ai,attr:Ii,style:Pi,property:Gi,classed:Ui,text:Zi,html:ea,raise:ra,lower:aa,append:oa,insert:ca,remove:ua,clone:da,datum:ga,on:ba,dispatch:xa,[Symbol.iterator]:Ea};function nt(t){return typeof t=="string"?new W([[document.querySelector(t)]],[document.documentElement]):new W([[t]],rr)}function Na(t){let e;for(;e=t.sourceEvent;)t=e;return t}function ht(t,e){if(t=Na(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]}const Sa={passive:!1},qt={capture:!0,passive:!1};function Ce(t){t.stopImmediatePropagation()}function St(t){t.preventDefault(),t.stopImmediatePropagation()}function ir(t){var e=t.document.documentElement,n=nt(t).on("dragstart.drag",St,qt);"onselectstart"in e?n.on("selectstart.drag",St,qt):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function ar(t,e){var n=t.document.documentElement,r=nt(t).on("dragstart.drag",null);e&&(r.on("click.drag",St,qt),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 Zt=t=>()=>t;function He(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:f,dy:c,dispatch:u}){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:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}He.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function $a(t){return!t.ctrlKey&&!t.button}function Aa(){return this.parentNode}function ka(t,e){return e??{x:t.x,y:t.y}}function Ta(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ca(){var t=$a,e=Aa,n=ka,r=Ta,i={},a=Ut("start","drag","end"),o=0,s,f,c,u,h=0;function l(p){p.on("mousedown.drag",g).filter(r).on("touchstart.drag",v).on("touchmove.drag",m,Sa).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(p,M){if(!(u||!t.call(this,p,M))){var N=S(this,e.call(this,p,M),p,M,"mouse");N&&(nt(p.view).on("mousemove.drag",_,qt).on("mouseup.drag",y,qt),ir(p.view),Ce(p),c=!1,s=p.clientX,f=p.clientY,N("start",p))}}function _(p){if(St(p),!c){var M=p.clientX-s,N=p.clientY-f;c=M*M+N*N>h}i.mouse("drag",p)}function y(p){nt(p.view).on("mousemove.drag mouseup.drag",null),ar(p.view,c),St(p),i.mouse("end",p)}function v(p,M){if(t.call(this,p,M)){var N=p.changedTouches,L=e.call(this,p,M),D=N.length,z,R;for(z=0;z<D;++z)(R=S(this,L,p,M,N[z].identifier,N[z]))&&(Ce(p),R("start",p,N[z]))}}function m(p){var M=p.changedTouches,N=M.length,L,D;for(L=0;L<N;++L)(D=i[M[L].identifier])&&(St(p),D("drag",p,M[L]))}function w(p){var M=p.changedTouches,N=M.length,L,D;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),L=0;L<N;++L)(D=i[M[L].identifier])&&(Ce(p),D("end",p,M[L]))}function S(p,M,N,L,D,z){var R=a.copy(),P=ht(z||N,M),A,F,d;if((d=n.call(p,new He("beforestart",{sourceEvent:N,target:l,identifier:D,active:o,x:P[0],y:P[1],dx:0,dy:0,dispatch:R}),L))!=null)return A=d.x-P[0]||0,F=d.y-P[1]||0,function x(b,E,k){var T=P,$;switch(b){case"start":i[D]=x,$=o++;break;case"end":delete i[D],--o;case"drag":P=ht(k||E,M),$=o;break}R.call(b,p,new He(b,{sourceEvent:E,subject:d,target:l,identifier:D,active:$,x:P[0]+A,y:P[1]+F,dx:P[0]-T[0],dy:P[1]-T[1],dispatch:R}),L)}}return l.filter=function(p){return arguments.length?(t=typeof p=="function"?p:Zt(!!p),l):t},l.container=function(p){return arguments.length?(e=typeof p=="function"?p:Zt(p),l):e},l.subject=function(p){return arguments.length?(n=typeof p=="function"?p:Zt(p),l):n},l.touchable=function(p){return arguments.length?(r=typeof p=="function"?p:Zt(!!p),l):r},l.on=function(){var p=a.on.apply(a,arguments);return p===a?l:p},l.clickDistance=function(p){return arguments.length?(h=(p=+p)*p,l):Math.sqrt(h)},l}function Ze(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function or(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Wt(){}var Gt=.7,le=1/Gt,$t="\\s*([+-]?\\d+)\\s*",Xt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",st="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",La=/^#([0-9a-f]{3,8})$/,Da=new RegExp(`^rgb\\(${$t},${$t},${$t}\\)$`),Ra=new RegExp(`^rgb\\(${st},${st},${st}\\)$`),Ia=new RegExp(`^rgba\\(${$t},${$t},${$t},${Xt}\\)$`),za=new RegExp(`^rgba\\(${st},${st},${st},${Xt}\\)$`),Oa=new RegExp(`^hsl\\(${Xt},${st},${st}\\)$`),Ha=new RegExp(`^hsla\\(${Xt},${st},${st},${Xt}\\)$`),ln={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};Ze(Wt,gt,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:hn,formatHex:hn,formatHex8:Pa,formatHsl:Fa,formatRgb:dn,toString:dn});function hn(){return this.rgb().formatHex()}function Pa(){return this.rgb().formatHex8()}function Fa(){return sr(this).formatHsl()}function dn(){return this.rgb().formatRgb()}function gt(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=La.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?gn(e):n===3?new U(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Jt(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Jt(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=Da.exec(t))?new U(e[1],e[2],e[3],1):(e=Ra.exec(t))?new U(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Ia.exec(t))?Jt(e[1],e[2],e[3],e[4]):(e=za.exec(t))?Jt(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Oa.exec(t))?yn(e[1],e[2]/100,e[3]/100,1):(e=Ha.exec(t))?yn(e[1],e[2]/100,e[3]/100,e[4]):ln.hasOwnProperty(t)?gn(ln[t]):t==="transparent"?new U(NaN,NaN,NaN,0):null}function gn(t){return new U(t>>16&255,t>>8&255,t&255,1)}function Jt(t,e,n,r){return r<=0&&(t=e=n=NaN),new U(t,e,n,r)}function Ba(t){return t instanceof Wt||(t=gt(t)),t?(t=t.rgb(),new U(t.r,t.g,t.b,t.opacity)):new U}function Pe(t,e,n,r){return arguments.length===1?Ba(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}Ze(U,Pe,or(Wt,{brighter(t){return t=t==null?le:Math.pow(le,t),new U(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Gt:Math.pow(Gt,t),new U(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new U(wt(this.r),wt(this.g),wt(this.b),he(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:pn,formatHex:pn,formatHex8:qa,formatRgb:mn,toString:mn}));function pn(){return`#${_t(this.r)}${_t(this.g)}${_t(this.b)}`}function qa(){return`#${_t(this.r)}${_t(this.g)}${_t(this.b)}${_t((isNaN(this.opacity)?1:this.opacity)*255)}`}function mn(){const t=he(this.opacity);return`${t===1?"rgb(":"rgba("}${wt(this.r)}, ${wt(this.g)}, ${wt(this.b)}${t===1?")":`, ${t})`}`}function he(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function wt(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function _t(t){return t=wt(t),(t<16?"0":"")+t.toString(16)}function yn(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new rt(t,e,n,r)}function sr(t){if(t instanceof rt)return new rt(t.h,t.s,t.l,t.opacity);if(t instanceof Wt||(t=gt(t)),!t)return new rt;if(t instanceof rt)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),o=NaN,s=a-i,f=(a+i)/2;return s?(e===a?o=(n-r)/s+(n<r)*6:n===a?o=(r-e)/s+2:o=(e-n)/s+4,s/=f<.5?a+i:2-a-i,o*=60):s=f>0&&f<1?0:o,new rt(o,s,f,t.opacity)}function Ga(t,e,n,r){return arguments.length===1?sr(t):new rt(t,e,n,r??1)}function rt(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}Ze(rt,Ga,or(Wt,{brighter(t){return t=t==null?le:Math.pow(le,t),new rt(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Gt:Math.pow(Gt,t),new rt(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(Le(t>=240?t-240:t+120,i,r),Le(t,i,r),Le(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new rt(vn(this.h),jt(this.s),jt(this.l),he(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=he(this.opacity);return`${t===1?"hsl(":"hsla("}${vn(this.h)}, ${jt(this.s)*100}%, ${jt(this.l)*100}%${t===1?")":`, ${t})`}`}}));function vn(t){return t=(t||0)%360,t<0?t+360:t}function jt(t){return Math.max(0,Math.min(1,t||0))}function Le(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 Je=t=>()=>t;function Xa(t,e){return function(n){return t+n*e}}function Va(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 Ya(t){return(t=+t)==1?cr:function(e,n){return n-e?Va(e,n,t):Je(isNaN(e)?n:e)}}function cr(t,e){var n=e-t;return n?Xa(t,n):Je(isNaN(t)?e:t)}const de=function t(e){var n=Ya(e);function r(i,a){var o=n((i=Pe(i)).r,(a=Pe(a)).r),s=n(i.g,a.g),f=n(i.b,a.b),c=cr(i.opacity,a.opacity);return function(u){return i.r=o(u),i.g=s(u),i.b=f(u),i.opacity=c(u),i+""}}return r.gamma=t,r}(1);function Ua(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=t[i]*(1-a)+e[i]*a;return r}}function Ka(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Wa(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,i=new Array(r),a=new Array(n),o;for(o=0;o<r;++o)i[o]=je(t[o],e[o]);for(;o<n;++o)a[o]=e[o];return function(s){for(o=0;o<r;++o)a[o]=i[o](s);return a}}function Qa(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function et(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Za(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]=je(t[i],e[i]):r[i]=e[i];return function(a){for(i in n)r[i]=n[i](a);return r}}var Fe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,De=new RegExp(Fe.source,"g");function Ja(t){return function(){return t}}function ja(t){return function(e){return t(e)+""}}function fr(t,e){var n=Fe.lastIndex=De.lastIndex=0,r,i,a,o=-1,s=[],f=[];for(t=t+"",e=e+"";(r=Fe.exec(t))&&(i=De.exec(e));)(a=i.index)>n&&(a=e.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,f.push({i:o,x:et(r,i)})),n=De.lastIndex;return n<e.length&&(a=e.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?f[0]?ja(f[0].x):Ja(e):(e=f.length,function(c){for(var u=0,h;u<e;++u)s[(h=f[u]).i]=h.x(c);return s.join("")})}function je(t,e){var n=typeof e,r;return e==null||n==="boolean"?Je(e):(n==="number"?et:n==="string"?(r=gt(e))?(e=r,de):fr:e instanceof gt?de:e instanceof Date?Qa:Ka(e)?Ua:Array.isArray(e)?Wa:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Za:et)(t,e)}function to(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var bn=180/Math.PI,Be={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ur(t,e,n,r,i,a){var o,s,f;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(f=t*n+e*r)&&(n-=t*f,r-=e*f),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,f/=s),t*r<e*n&&(t=-t,e=-e,f=-f,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(e,t)*bn,skewX:Math.atan(f)*bn,scaleX:o,scaleY:s}}var te;function eo(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Be:ur(e.a,e.b,e.c,e.d,e.e,e.f)}function no(t){return t==null||(te||(te=document.createElementNS("http://www.w3.org/2000/svg","g")),te.setAttribute("transform",t),!(t=te.transform.baseVal.consolidate()))?Be:(t=t.matrix,ur(t.a,t.b,t.c,t.d,t.e,t.f))}function lr(t,e,n,r){function i(c){return c.length?c.pop()+" ":""}function a(c,u,h,l,g,_){if(c!==h||u!==l){var y=g.push("translate(",null,e,null,n);_.push({i:y-4,x:et(c,h)},{i:y-2,x:et(u,l)})}else(h||l)&&g.push("translate("+h+e+l+n)}function o(c,u,h,l){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),l.push({i:h.push(i(h)+"rotate(",null,r)-2,x:et(c,u)})):u&&h.push(i(h)+"rotate("+u+r)}function s(c,u,h,l){c!==u?l.push({i:h.push(i(h)+"skewX(",null,r)-2,x:et(c,u)}):u&&h.push(i(h)+"skewX("+u+r)}function f(c,u,h,l,g,_){if(c!==h||u!==l){var y=g.push(i(g)+"scale(",null,",",null,")");_.push({i:y-4,x:et(c,h)},{i:y-2,x:et(u,l)})}else(h!==1||l!==1)&&g.push(i(g)+"scale("+h+","+l+")")}return function(c,u){var h=[],l=[];return c=t(c),u=t(u),a(c.translateX,c.translateY,u.translateX,u.translateY,h,l),o(c.rotate,u.rotate,h,l),s(c.skewX,u.skewX,h,l),f(c.scaleX,c.scaleY,u.scaleX,u.scaleY,h,l),c=u=null,function(g){for(var _=-1,y=l.length,v;++_<y;)h[(v=l[_]).i]=v.x(g);return h.join("")}}}var ro=lr(eo,"px, ","px)","deg)"),io=lr(no,", ",")",")"),ao=1e-12;function _n(t){return((t=Math.exp(t))+1/t)/2}function oo(t){return((t=Math.exp(t))-1/t)/2}function so(t){return((t=Math.exp(2*t))-1)/(t+1)}const co=function t(e,n,r){function i(a,o){var s=a[0],f=a[1],c=a[2],u=o[0],h=o[1],l=o[2],g=u-s,_=h-f,y=g*g+_*_,v,m;if(y<ao)m=Math.log(l/c)/e,v=function(L){return[s+L*g,f+L*_,c*Math.exp(e*L*m)]};else{var w=Math.sqrt(y),S=(l*l-c*c+r*y)/(2*c*n*w),p=(l*l-c*c-r*y)/(2*l*n*w),M=Math.log(Math.sqrt(S*S+1)-S),N=Math.log(Math.sqrt(p*p+1)-p);m=(N-M)/e,v=function(L){var D=L*m,z=_n(M),R=c/(n*w)*(z*so(e*D+M)-oo(M));return[s+R*g,f+R*_,c*z/_n(e*D+M)]}}return v.duration=m*1e3*e/Math.SQRT2,v}return i.rho=function(a){var o=Math.max(.001,+a),s=o*o,f=s*s;return t(o,s,f)},i}(Math.SQRT2,2,4);var Ct=0,Pt=0,Dt=0,hr=1e3,ge,Ft,pe=0,xt=0,Ne=0,Vt=typeof performance=="object"&&performance.now?performance:Date,dr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function tn(){return xt||(dr(fo),xt=Vt.now()+Ne)}function fo(){xt=0}function me(){this._call=this._time=this._next=null}me.prototype=en.prototype={constructor:me,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?tn():+n)+(e==null?0:+e),!this._next&&Ft!==this&&(Ft?Ft._next=this:ge=this,Ft=this),this._call=t,this._time=n,qe()},stop:function(){this._call&&(this._call=null,this._time=1/0,qe())}};function en(t,e,n){var r=new me;return r.restart(t,e,n),r}function uo(){tn(),++Ct;for(var t=ge,e;t;)(e=xt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Ct}function wn(){xt=(pe=Vt.now())+Ne,Ct=Pt=0;try{uo()}finally{Ct=0,ho(),xt=0}}function lo(){var t=Vt.now(),e=t-pe;e>hr&&(Ne-=e,pe=t)}function ho(){for(var t,e=ge,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:ge=n);Ft=t,qe(r)}function qe(t){if(!Ct){Pt&&(Pt=clearTimeout(Pt));var e=t-xt;e>24?(t<1/0&&(Pt=setTimeout(wn,t-Vt.now()-Ne)),Dt&&(Dt=clearInterval(Dt))):(Dt||(pe=Vt.now(),Dt=setInterval(lo,hr)),Ct=1,dr(wn))}}function xn(t,e,n){var r=new me;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}var go=Ut("start","end","cancel","interrupt"),po=[],gr=0,En=1,Ge=2,oe=3,Mn=4,Xe=5,se=6;function Se(t,e,n,r,i,a){var o=t.__transition;if(!o)t.__transition={};else if(n in o)return;mo(t,n,{name:e,index:r,group:i,on:go,tween:po,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:gr})}function nn(t,e){var n=it(t,e);if(n.state>gr)throw new Error("too late; already scheduled");return n}function ct(t,e){var n=it(t,e);if(n.state>oe)throw new Error("too late; already running");return n}function it(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function mo(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=en(a,0,n.time);function a(c){n.state=En,n.timer.restart(o,n.delay,n.time),n.delay<=c&&o(c-n.delay)}function o(c){var u,h,l,g;if(n.state!==En)return f();for(u in r)if(g=r[u],g.name===n.name){if(g.state===oe)return xn(o);g.state===Mn?(g.state=se,g.timer.stop(),g.on.call("interrupt",t,t.__data__,g.index,g.group),delete r[u]):+u<e&&(g.state=se,g.timer.stop(),g.on.call("cancel",t,t.__data__,g.index,g.group),delete r[u])}if(xn(function(){n.state===oe&&(n.state=Mn,n.timer.restart(s,n.delay,n.time),s(c))}),n.state=Ge,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Ge){for(n.state=oe,i=new Array(l=n.tween.length),u=0,h=-1;u<l;++u)(g=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(i[++h]=g);i.length=h+1}}function s(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(f),n.state=Xe,1),h=-1,l=i.length;++h<l;)i[h].call(t,u);n.state===Xe&&(n.on.call("end",t,t.__data__,n.index,n.group),f())}function f(){n.state=se,n.timer.stop(),delete r[e];for(var c in r)return;delete t.__transition}}function ce(t,e){var n=t.__transition,r,i,a=!0,o;if(n){e=e==null?null:e+"";for(o in n){if((r=n[o]).name!==e){a=!1;continue}i=r.state>Ge&&r.state<Xe,r.state=se,r.timer.stop(),r.on.call(i?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[o]}a&&delete t.__transition}}function yo(t){return this.each(function(){ce(this,t)})}function vo(t,e){var n,r;return function(){var i=ct(this,t),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===e){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function bo(t,e,n){var r,i;if(typeof n!="function")throw new Error;return function(){var a=ct(this,t),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:e,value:n},f=0,c=i.length;f<c;++f)if(i[f].name===e){i[f]=s;break}f===c&&i.push(s)}a.tween=i}}function _o(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=it(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===t)return o.value;return null}return this.each((e==null?vo:bo)(n,t,e))}function rn(t,e,n){var r=t._id;return t.each(function(){var i=ct(this,r);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return it(i,r).value[e]}}function pr(t,e){var n;return(typeof e=="number"?et:e instanceof gt?de:(n=gt(e))?(e=n,de):fr)(t,e)}function wo(t){return function(){this.removeAttribute(t)}}function xo(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Eo(t,e,n){var r,i=n+"",a;return function(){var o=this.getAttribute(t);return o===i?null:o===r?a:a=e(r=o,n)}}function Mo(t,e,n){var r,i=n+"",a;return function(){var o=this.getAttributeNS(t.space,t.local);return o===i?null:o===r?a:a=e(r=o,n)}}function No(t,e,n){var r,i,a;return function(){var o,s=n(this),f;return s==null?void this.removeAttribute(t):(o=this.getAttribute(t),f=s+"",o===f?null:o===r&&f===i?a:(i=f,a=e(r=o,s)))}}function So(t,e,n){var r,i,a;return function(){var o,s=n(this),f;return s==null?void this.removeAttributeNS(t.space,t.local):(o=this.getAttributeNS(t.space,t.local),f=s+"",o===f?null:o===r&&f===i?a:(i=f,a=e(r=o,s)))}}function $o(t,e){var n=Me(t),r=n==="transform"?io:pr;return this.attrTween(t,typeof e=="function"?(n.local?So:No)(n,r,rn(this,"attr."+t,e)):e==null?(n.local?xo:wo)(n):(n.local?Mo:Eo)(n,r,e))}function Ao(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function ko(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function To(t,e){var n,r;function i(){var a=e.apply(this,arguments);return a!==r&&(n=(r=a)&&ko(t,a)),n}return i._value=e,i}function Co(t,e){var n,r;function i(){var a=e.apply(this,arguments);return a!==r&&(n=(r=a)&&Ao(t,a)),n}return i._value=e,i}function Lo(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=Me(t);return this.tween(n,(r.local?To:Co)(r,e))}function Do(t,e){return function(){nn(this,t).delay=+e.apply(this,arguments)}}function Ro(t,e){return e=+e,function(){nn(this,t).delay=e}}function Io(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Do:Ro)(e,t)):it(this.node(),e).delay}function zo(t,e){return function(){ct(this,t).duration=+e.apply(this,arguments)}}function Oo(t,e){return e=+e,function(){ct(this,t).duration=e}}function Ho(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?zo:Oo)(e,t)):it(this.node(),e).duration}function Po(t,e){if(typeof e!="function")throw new Error;return function(){ct(this,t).ease=e}}function Fo(t){var e=this._id;return arguments.length?this.each(Po(e,t)):it(this.node(),e).ease}function Bo(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;ct(this,t).ease=n}}function qo(t){if(typeof t!="function")throw new Error;return this.each(Bo(this._id,t))}function Go(t){typeof t!="function"&&(t=Kn(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a=e[i],o=a.length,s=r[i]=[],f,c=0;c<o;++c)(f=a[c])&&t.call(f,f.__data__,c,a)&&s.push(f);return new pt(r,this._parents,this._name,this._id)}function Xo(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,a=Math.min(r,i),o=new Array(r),s=0;s<a;++s)for(var f=e[s],c=n[s],u=f.length,h=o[s]=new Array(u),l,g=0;g<u;++g)(l=f[g]||c[g])&&(h[g]=l);for(;s<r;++s)o[s]=e[s];return new pt(o,this._parents,this._name,this._id)}function Vo(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 Yo(t,e,n){var r,i,a=Vo(e)?nn:ct;return function(){var o=a(this,t),s=o.on;s!==r&&(i=(r=s).copy()).on(e,n),o.on=i}}function Uo(t,e){var n=this._id;return arguments.length<2?it(this.node(),n).on.on(t):this.each(Yo(n,t,e))}function Ko(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function Wo(){return this.on("end.remove",Ko(this._id))}function Qo(t){var e=this._name,n=this._id;typeof t!="function"&&(t=We(t));for(var r=this._groups,i=r.length,a=new Array(i),o=0;o<i;++o)for(var s=r[o],f=s.length,c=a[o]=new Array(f),u,h,l=0;l<f;++l)(u=s[l])&&(h=t.call(u,u.__data__,l,s))&&("__data__"in u&&(h.__data__=u.__data__),c[l]=h,Se(c[l],e,n,l,c,it(u,n)));return new pt(a,this._parents,e,n)}function Zo(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Un(t));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var f=r[s],c=f.length,u,h=0;h<c;++h)if(u=f[h]){for(var l=t.call(u,u.__data__,h,f),g,_=it(u,n),y=0,v=l.length;y<v;++y)(g=l[y])&&Se(g,e,n,y,l,_);a.push(l),o.push(u)}return new pt(a,o,e,n)}var Jo=Kt.prototype.constructor;function jo(){return new Jo(this._groups,this._parents)}function ts(t,e){var n,r,i;return function(){var a=Tt(this,t),o=(this.style.removeProperty(t),Tt(this,t));return a===o?null:a===n&&o===r?i:i=e(n=a,r=o)}}function mr(t){return function(){this.style.removeProperty(t)}}function es(t,e,n){var r,i=n+"",a;return function(){var o=Tt(this,t);return o===i?null:o===r?a:a=e(r=o,n)}}function ns(t,e,n){var r,i,a;return function(){var o=Tt(this,t),s=n(this),f=s+"";return s==null&&(f=s=(this.style.removeProperty(t),Tt(this,t))),o===f?null:o===r&&f===i?a:(i=f,a=e(r=o,s))}}function rs(t,e){var n,r,i,a="style."+e,o="end."+a,s;return function(){var f=ct(this,t),c=f.on,u=f.value[a]==null?s||(s=mr(e)):void 0;(c!==n||i!==u)&&(r=(n=c).copy()).on(o,i=u),f.on=r}}function is(t,e,n){var r=(t+="")=="transform"?ro:pr;return e==null?this.styleTween(t,ts(t,r)).on("end.style."+t,mr(t)):typeof e=="function"?this.styleTween(t,ns(t,r,rn(this,"style."+t,e))).each(rs(this._id,t)):this.styleTween(t,es(t,r,e),n).on("end.style."+t,null)}function as(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function os(t,e,n){var r,i;function a(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&as(t,o,n)),r}return a._value=e,a}function ss(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,os(t,e,n??""))}function cs(t){return function(){this.textContent=t}}function fs(t){return function(){var e=t(this);this.textContent=e??""}}function us(t){return this.tween("text",typeof t=="function"?fs(rn(this,"text",t)):cs(t==null?"":t+""))}function ls(t){return function(e){this.textContent=t.call(this,e)}}function hs(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&ls(i)),e}return r._value=t,r}function ds(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,hs(t))}function gs(){for(var t=this._name,e=this._id,n=yr(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,f,c=0;c<s;++c)if(f=o[c]){var u=it(f,e);Se(f,t,n,c,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new pt(r,this._parents,t,n)}function ps(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},f={value:function(){--i===0&&a()}};n.each(function(){var c=ct(this,r),u=c.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(s),e._.interrupt.push(s),e._.end.push(f)),c.on=e}),i===0&&a()})}var ms=0;function pt(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function yr(){return++ms}var lt=Kt.prototype;pt.prototype={constructor:pt,select:Qo,selectAll:Zo,selectChild:lt.selectChild,selectChildren:lt.selectChildren,filter:Go,merge:Xo,selection:jo,transition:gs,call:lt.call,nodes:lt.nodes,node:lt.node,size:lt.size,empty:lt.empty,each:lt.each,on:Uo,attr:$o,attrTween:Lo,style:is,styleTween:ss,text:us,textTween:ds,remove:Wo,tween:_o,delay:Io,duration:Ho,ease:Fo,easeVarying:qo,end:ps,[Symbol.iterator]:lt[Symbol.iterator]};function ys(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var vs={time:null,delay:0,duration:250,ease:ys};function bs(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 _s(t){var e,n;t instanceof pt?(e=t._id,t=t._name):(e=yr(),(n=vs).time=tn(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,f,c=0;c<s;++c)(f=o[c])&&Se(f,t,e,c,o,n||bs(f,e));return new pt(r,this._parents,t,e)}Kt.prototype.interrupt=yo;Kt.prototype.transition=_s;function ws(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return vr(this.cover(e,n),e,n,t)}function vr(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,a=t._root,o={data:r},s=t._x0,f=t._y0,c=t._x1,u=t._y1,h,l,g,_,y,v,m,w;if(!a)return t._root=o,t;for(;a.length;)if((y=e>=(h=(s+c)/2))?s=h:c=h,(v=n>=(l=(f+u)/2))?f=l:u=l,i=a,!(a=a[m=v<<1|y]))return i[m]=o,t;if(g=+t._x.call(null,a.data),_=+t._y.call(null,a.data),e===g&&n===_)return o.next=a,i?i[m]=o:t._root=o,t;do i=i?i[m]=new Array(4):t._root=new Array(4),(y=e>=(h=(s+c)/2))?s=h:c=h,(v=n>=(l=(f+u)/2))?f=l:u=l;while((m=v<<1|y)===(w=(_>=l)<<1|g>=h));return i[w]=a,i[m]=o,t}function xs(t){var e,n,r=t.length,i,a,o=new Array(r),s=new Array(r),f=1/0,c=1/0,u=-1/0,h=-1/0;for(n=0;n<r;++n)isNaN(i=+this._x.call(null,e=t[n]))||isNaN(a=+this._y.call(null,e))||(o[n]=i,s[n]=a,i<f&&(f=i),i>u&&(u=i),a<c&&(c=a),a>h&&(h=a));if(f>u||c>h)return this;for(this.cover(f,c).cover(u,h),n=0;n<r;++n)vr(this,o[n],s[n],t[n]);return this}function Es(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,a=(r=Math.floor(e))+1;else{for(var o=i-n||1,s=this._root,f,c;n>t||t>=i||r>e||e>=a;)switch(c=(e<r)<<1|t<n,f=new Array(4),f[c]=s,s=f,o*=2,c){case 0:i=n+o,a=r+o;break;case 1:n=i-o,a=r+o;break;case 2:i=n+o,r=a-o;break;case 3:n=i-o,r=a-o;break}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this}function Ms(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function Ns(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 G(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function Ss(t,e,n){var r,i=this._x0,a=this._y0,o,s,f,c,u=this._x1,h=this._y1,l=[],g=this._root,_,y;for(g&&l.push(new G(g,i,a,u,h)),n==null?n=1/0:(i=t-n,a=e-n,u=t+n,h=e+n,n*=n);_=l.pop();)if(!(!(g=_.node)||(o=_.x0)>u||(s=_.y0)>h||(f=_.x1)<i||(c=_.y1)<a))if(g.length){var v=(o+f)/2,m=(s+c)/2;l.push(new G(g[3],v,m,f,c),new G(g[2],o,m,v,c),new G(g[1],v,s,f,m),new G(g[0],o,s,v,m)),(y=(e>=m)<<1|t>=v)&&(_=l[l.length-1],l[l.length-1]=l[l.length-1-y],l[l.length-1-y]=_)}else{var w=t-+this._x.call(null,g.data),S=e-+this._y.call(null,g.data),p=w*w+S*S;if(p<n){var M=Math.sqrt(n=p);i=t-M,a=e-M,u=t+M,h=e+M,r=g.data}}return r}function $s(t){if(isNaN(u=+this._x.call(null,t))||isNaN(h=+this._y.call(null,t)))return this;var e,n=this._root,r,i,a,o=this._x0,s=this._y0,f=this._x1,c=this._y1,u,h,l,g,_,y,v,m;if(!n)return this;if(n.length)for(;;){if((_=u>=(l=(o+f)/2))?o=l:f=l,(y=h>=(g=(s+c)/2))?s=g:c=g,e=n,!(n=n[v=y<<1|_]))return this;if(!n.length)break;(e[v+1&3]||e[v+2&3]||e[v+3&3])&&(r=e,m=v)}for(;n.data!==t;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):e?(a?e[v]=a: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[m]=n:this._root=n),this):(this._root=a,this)}function As(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function ks(){return this._root}function Ts(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function Cs(t){var e=[],n,r=this._root,i,a,o,s,f;for(r&&e.push(new G(r,this._x0,this._y0,this._x1,this._y1));n=e.pop();)if(!t(r=n.node,a=n.x0,o=n.y0,s=n.x1,f=n.y1)&&r.length){var c=(a+s)/2,u=(o+f)/2;(i=r[3])&&e.push(new G(i,c,u,s,f)),(i=r[2])&&e.push(new G(i,a,u,c,f)),(i=r[1])&&e.push(new G(i,c,o,s,u)),(i=r[0])&&e.push(new G(i,a,o,c,u))}return this}function Ls(t){var e=[],n=[],r;for(this._root&&e.push(new G(this._root,this._x0,this._y0,this._x1,this._y1));r=e.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,f=r.x1,c=r.y1,u=(o+f)/2,h=(s+c)/2;(a=i[0])&&e.push(new G(a,o,s,u,h)),(a=i[1])&&e.push(new G(a,u,s,f,h)),(a=i[2])&&e.push(new G(a,o,h,u,c)),(a=i[3])&&e.push(new G(a,u,h,f,c))}n.push(r)}for(;r=n.pop();)t(r.node,r.x0,r.y0,r.x1,r.y1);return this}function Ds(t){return t[0]}function Rs(t){return arguments.length?(this._x=t,this):this._x}function Is(t){return t[1]}function zs(t){return arguments.length?(this._y=t,this):this._y}function an(t,e,n){var r=new on(e??Ds,n??Is,NaN,NaN,NaN,NaN);return t==null?r:r.addAll(t)}function on(t,e,n,r,i,a){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function Nn(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var Y=an.prototype=on.prototype;Y.copy=function(){var t=new on(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=Nn(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]=Nn(r));return t};Y.add=ws;Y.addAll=xs;Y.cover=Es;Y.data=Ms;Y.extent=Ns;Y.find=Ss;Y.remove=$s;Y.removeAll=As;Y.root=ks;Y.size=Ts;Y.visit=Cs;Y.visitAfter=Ls;Y.x=Rs;Y.y=zs;function V(t){return function(){return t}}function mt(t){return(t()-.5)*1e-6}function Os(t){return t.x+t.vx}function Hs(t){return t.y+t.vy}function Ps(t){var e,n,r,i=1,a=1;typeof t!="function"&&(t=V(t==null?1:+t));function o(){for(var c,u=e.length,h,l,g,_,y,v,m=0;m<a;++m)for(h=an(e,Os,Hs).visitAfter(s),c=0;c<u;++c)l=e[c],y=n[l.index],v=y*y,g=l.x+l.vx,_=l.y+l.vy,h.visit(w);function w(S,p,M,N,L){var D=S.data,z=S.r,R=y+z;if(D){if(D.index>l.index){var P=g-D.x-D.vx,A=_-D.y-D.vy,F=P*P+A*A;F<R*R&&(P===0&&(P=mt(r),F+=P*P),A===0&&(A=mt(r),F+=A*A),F=(R-(F=Math.sqrt(F)))/F*i,l.vx+=(P*=F)*(R=(z*=z)/(v+z)),l.vy+=(A*=F)*R,D.vx-=P*(R=1-R),D.vy-=A*R)}return}return p>g+R||N<g-R||M>_+R||L<_-R}}function s(c){if(c.data)return c.r=n[c.data.index];for(var u=c.r=0;u<4;++u)c[u]&&c[u].r>c.r&&(c.r=c[u].r)}function f(){if(e){var c,u=e.length,h;for(n=new Array(u),c=0;c<u;++c)h=e[c],n[h.index]=+t(h,c,e)}}return o.initialize=function(c,u){e=c,r=u,f()},o.iterations=function(c){return arguments.length?(a=+c,o):a},o.strength=function(c){return arguments.length?(i=+c,o):i},o.radius=function(c){return arguments.length?(t=typeof c=="function"?c:V(+c),f(),o):t},o}function Fs(t){return t.index}function Sn(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function Bs(t){var e=Fs,n=h,r,i=V(30),a,o,s,f,c,u=1;t==null&&(t=[]);function h(v){return 1/Math.min(s[v.source.index],s[v.target.index])}function l(v){for(var m=0,w=t.length;m<u;++m)for(var S=0,p,M,N,L,D,z,R;S<w;++S)p=t[S],M=p.source,N=p.target,L=N.x+N.vx-M.x-M.vx||mt(c),D=N.y+N.vy-M.y-M.vy||mt(c),z=Math.sqrt(L*L+D*D),z=(z-a[S])/z*v*r[S],L*=z,D*=z,N.vx-=L*(R=f[S]),N.vy-=D*R,M.vx+=L*(R=1-R),M.vy+=D*R}function g(){if(o){var v,m=o.length,w=t.length,S=new Map(o.map((M,N)=>[e(M,N,o),M])),p;for(v=0,s=new Array(m);v<w;++v)p=t[v],p.index=v,typeof p.source!="object"&&(p.source=Sn(S,p.source)),typeof p.target!="object"&&(p.target=Sn(S,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,f=new Array(w);v<w;++v)p=t[v],f[v]=s[p.source.index]/(s[p.source.index]+s[p.target.index]);r=new Array(w),_(),a=new Array(w),y()}}function _(){if(o)for(var v=0,m=t.length;v<m;++v)r[v]=+n(t[v],v,t)}function y(){if(o)for(var v=0,m=t.length;v<m;++v)a[v]=+i(t[v],v,t)}return l.initialize=function(v,m){o=v,c=m,g()},l.links=function(v){return arguments.length?(t=v,g(),l):t},l.id=function(v){return arguments.length?(e=v,l):e},l.iterations=function(v){return arguments.length?(u=+v,l):u},l.strength=function(v){return arguments.length?(n=typeof v=="function"?v:V(+v),_(),l):n},l.distance=function(v){return arguments.length?(i=typeof v=="function"?v:V(+v),y(),l):i},l}const qs=1664525,Gs=1013904223,$n=4294967296;function Xs(){let t=1;return()=>(t=(qs*t+Gs)%$n)/$n}function Vs(t){return t.x}function Ys(t){return t.y}var Us=10,Ks=Math.PI*(3-Math.sqrt(5));function Ws(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),a=0,o=.6,s=new Map,f=en(h),c=Ut("tick","end"),u=Xs();t==null&&(t=[]);function h(){l(),c.call("tick",e),n<r&&(f.stop(),c.call("end",e))}function l(y){var v,m=t.length,w;y===void 0&&(y=1);for(var S=0;S<y;++S)for(n+=(a-n)*i,s.forEach(function(p){p(n)}),v=0;v<m;++v)w=t[v],w.fx==null?w.x+=w.vx*=o:(w.x=w.fx,w.vx=0),w.fy==null?w.y+=w.vy*=o:(w.y=w.fy,w.vy=0);return e}function g(){for(var y=0,v=t.length,m;y<v;++y){if(m=t[y],m.index=y,m.fx!=null&&(m.x=m.fx),m.fy!=null&&(m.y=m.fy),isNaN(m.x)||isNaN(m.y)){var w=Us*Math.sqrt(.5+y),S=y*Ks;m.x=w*Math.cos(S),m.y=w*Math.sin(S)}(isNaN(m.vx)||isNaN(m.vy))&&(m.vx=m.vy=0)}}function _(y){return y.initialize&&y.initialize(t,u),y}return g(),e={tick:l,restart:function(){return f.restart(h),e},stop:function(){return f.stop(),e},nodes:function(y){return arguments.length?(t=y,g(),s.forEach(_),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?(a=+y,e):a},velocityDecay:function(y){return arguments.length?(o=1-y,e):1-o},randomSource:function(y){return arguments.length?(u=y,s.forEach(_),e):u},force:function(y,v){return arguments.length>1?(v==null?s.delete(y):s.set(y,_(v)),e):s.get(y)},find:function(y,v,m){var w=0,S=t.length,p,M,N,L,D;for(m==null?m=1/0:m*=m,w=0;w<S;++w)L=t[w],p=y-L.x,M=v-L.y,N=p*p+M*M,N<m&&(D=L,m=N);return D},on:function(y,v){return arguments.length>1?(c.on(y,v),e):c.on(y)}}}function Qs(){var t,e,n,r,i=V(-30),a,o=1,s=1/0,f=.81;function c(g){var _,y=t.length,v=an(t,Vs,Ys).visitAfter(h);for(r=g,_=0;_<y;++_)e=t[_],v.visit(l)}function u(){if(t){var g,_=t.length,y;for(a=new Array(_),g=0;g<_;++g)y=t[g],a[y.index]=+i(y,g,t)}}function h(g){var _=0,y,v,m=0,w,S,p;if(g.length){for(w=S=p=0;p<4;++p)(y=g[p])&&(v=Math.abs(y.value))&&(_+=y.value,m+=v,w+=v*y.x,S+=v*y.y);g.x=w/m,g.y=S/m}else{y=g,y.x=y.data.x,y.y=y.data.y;do _+=a[y.data.index];while(y=y.next)}g.value=_}function l(g,_,y,v){if(!g.value)return!0;var m=g.x-e.x,w=g.y-e.y,S=v-_,p=m*m+w*w;if(S*S/f<p)return p<s&&(m===0&&(m=mt(n),p+=m*m),w===0&&(w=mt(n),p+=w*w),p<o&&(p=Math.sqrt(o*p)),e.vx+=m*g.value*r/p,e.vy+=w*g.value*r/p),!0;if(g.length||p>=s)return;(g.data!==e||g.next)&&(m===0&&(m=mt(n),p+=m*m),w===0&&(w=mt(n),p+=w*w),p<o&&(p=Math.sqrt(o*p)));do g.data!==e&&(S=a[g.data.index]*r/p,e.vx+=m*S,e.vy+=w*S);while(g=g.next)}return c.initialize=function(g,_){t=g,n=_,u()},c.strength=function(g){return arguments.length?(i=typeof g=="function"?g:V(+g),u(),c):i},c.distanceMin=function(g){return arguments.length?(o=g*g,c):Math.sqrt(o)},c.distanceMax=function(g){return arguments.length?(s=g*g,c):Math.sqrt(s)},c.theta=function(g){return arguments.length?(f=g*g,c):Math.sqrt(f)},c}function Zs(t){var e=V(.1),n,r,i;typeof t!="function"&&(t=V(t==null?0:+t));function a(s){for(var f=0,c=n.length,u;f<c;++f)u=n[f],u.vx+=(i[f]-u.x)*r[f]*s}function o(){if(n){var s,f=n.length;for(r=new Array(f),i=new Array(f),s=0;s<f;++s)r[s]=isNaN(i[s]=+t(n[s],s,n))?0:+e(n[s],s,n)}}return a.initialize=function(s){n=s,o()},a.strength=function(s){return arguments.length?(e=typeof s=="function"?s:V(+s),o(),a):e},a.x=function(s){return arguments.length?(t=typeof s=="function"?s:V(+s),o(),a):t},a}function Js(t){var e=V(.1),n,r,i;typeof t!="function"&&(t=V(t==null?0:+t));function a(s){for(var f=0,c=n.length,u;f<c;++f)u=n[f],u.vy+=(i[f]-u.y)*r[f]*s}function o(){if(n){var s,f=n.length;for(r=new Array(f),i=new Array(f),s=0;s<f;++s)r[s]=isNaN(i[s]=+t(n[s],s,n))?0:+e(n[s],s,n)}}return a.initialize=function(s){n=s,o()},a.strength=function(s){return arguments.length?(e=typeof s=="function"?s:V(+s),o(),a):e},a.y=function(s){return arguments.length?(t=typeof s=="function"?s:V(+s),o(),a):t},a}function js(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function ye(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 Lt(t){return t=ye(Math.abs(t)),t?t[1]:NaN}function tc(t,e){return function(n,r){for(var i=n.length,a=[],o=0,s=t[0],f=0;i>0&&s>0&&(f+s+1>r&&(s=Math.max(1,r-f)),a.push(n.substring(i-=s,i+s)),!((f+=s+1)>r));)s=t[o=(o+1)%t.length];return a.reverse().join(e)}}function ec(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var nc=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ve(t){if(!(e=nc.exec(t)))throw new Error("invalid format: "+t);var e;return new sn({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]})}ve.prototype=sn.prototype;function sn(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+""}sn.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 rc(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 be;function ic(t,e){var n=ye(t,e);if(!n)return be=void 0,t.toPrecision(e);var r=n[0],i=n[1],a=i-(be=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+ye(t,Math.max(0,e+a-1))[0]}function An(t,e){var n=ye(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 kn={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:js,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)=>An(t*100,e),r:An,s:ic,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Tn(t){return t}var Cn=Array.prototype.map,Ln=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ac(t){var e=t.grouping===void 0||t.thousands===void 0?Tn:tc(Cn.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+"",a=t.numerals===void 0?Tn:ec(Cn.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",s=t.minus===void 0?"−":t.minus+"",f=t.nan===void 0?"NaN":t.nan+"";function c(h,l){h=ve(h);var g=h.fill,_=h.align,y=h.sign,v=h.symbol,m=h.zero,w=h.width,S=h.comma,p=h.precision,M=h.trim,N=h.type;N==="n"?(S=!0,N="g"):kn[N]||(p===void 0&&(p=12),M=!0,N="g"),(m||g==="0"&&_==="=")&&(m=!0,g="0",_="=");var L=(l&&l.prefix!==void 0?l.prefix:"")+(v==="$"?n:v==="#"&&/[boxX]/.test(N)?"0"+N.toLowerCase():""),D=(v==="$"?r:/[%p]/.test(N)?o:"")+(l&&l.suffix!==void 0?l.suffix:""),z=kn[N],R=/[defgprs%]/.test(N);p=p===void 0?6:/[gprs]/.test(N)?Math.max(1,Math.min(21,p)):Math.max(0,Math.min(20,p));function P(A){var F=L,d=D,x,b,E;if(N==="c")d=z(A)+d,A="";else{A=+A;var k=A<0||1/A<0;if(A=isNaN(A)?f:z(Math.abs(A),p),M&&(A=rc(A)),k&&+A==0&&y!=="+"&&(k=!1),F=(k?y==="("?y:s:y==="-"||y==="("?"":y)+F,d=(N==="s"&&!isNaN(A)&&be!==void 0?Ln[8+be/3]:"")+d+(k&&y==="("?")":""),R){for(x=-1,b=A.length;++x<b;)if(E=A.charCodeAt(x),48>E||E>57){d=(E===46?i+A.slice(x+1):A.slice(x))+d,A=A.slice(0,x);break}}}S&&!m&&(A=e(A,1/0));var T=F.length+A.length+d.length,$=T<w?new Array(w-T+1).join(g):"";switch(S&&m&&(A=e($+A,$.length?w-d.length:1/0),$=""),_){case"<":A=F+A+d+$;break;case"=":A=F+$+A+d;break;case"^":A=$.slice(0,T=$.length>>1)+F+A+d+$.slice(T);break;default:A=$+F+A+d;break}return a(A)}return P.toString=function(){return h+""},P}function u(h,l){var g=Math.max(-8,Math.min(8,Math.floor(Lt(l)/3)))*3,_=Math.pow(10,-g),y=c((h=ve(h),h.type="f",h),{suffix:Ln[8+g/3]});return function(v){return y(_*v)}}return{format:c,formatPrefix:u}}var ee,br,_r;oc({thousands:",",grouping:[3],currency:["$",""]});function oc(t){return ee=ac(t),br=ee.format,_r=ee.formatPrefix,ee}function sc(t){return Math.max(0,-Lt(Math.abs(t)))}function cc(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Lt(e)/3)))*3-Lt(Math.abs(t)))}function fc(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Lt(e)-Lt(t))+1}function uc(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function lc(t){return function(){return t}}function hc(t){return+t}var Dn=[0,1];function yt(t){return t}function Ve(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:lc(isNaN(e)?NaN:.5)}function dc(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function gc(t,e,n){var r=t[0],i=t[1],a=e[0],o=e[1];return i<r?(r=Ve(i,r),a=n(o,a)):(r=Ve(r,i),a=n(a,o)),function(s){return a(r(s))}}function pc(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),a=new Array(r),o=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<r;)i[o]=Ve(t[o],t[o+1]),a[o]=n(e[o],e[o+1]);return function(s){var f=Or(t,s,1,r)-1;return a[f](i[f](s))}}function mc(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function yc(){var t=Dn,e=Dn,n=je,r,i,a,o=yt,s,f,c;function u(){var l=Math.min(t.length,e.length);return o!==yt&&(o=dc(t[0],t[l-1])),s=l>2?pc:gc,f=c=null,h}function h(l){return l==null||isNaN(l=+l)?a:(f||(f=s(t.map(r),e,n)))(r(o(l)))}return h.invert=function(l){return o(i((c||(c=s(e,t.map(r),et)))(l)))},h.domain=function(l){return arguments.length?(t=Array.from(l,hc),u()):t.slice()},h.range=function(l){return arguments.length?(e=Array.from(l),u()):e.slice()},h.rangeRound=function(l){return e=Array.from(l),n=to,u()},h.clamp=function(l){return arguments.length?(o=l?!0:yt,u()):o!==yt},h.interpolate=function(l){return arguments.length?(n=l,u()):n},h.unknown=function(l){return arguments.length?(a=l,h):a},function(l,g){return r=l,i=g,u()}}function vc(t,e,n,r){var i=qr(t,e,n),a;switch(r=ve(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(a=cc(i,o))&&(r.precision=a),_r(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=fc(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=sc(i))&&(r.precision=a-(r.type==="%")*2);break}}return br(r)}function bc(t){var e=t.domain;return t.ticks=function(n){var r=e();return Br(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return vc(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,a=r.length-1,o=r[i],s=r[a],f,c,u=10;for(s<o&&(c=o,o=s,s=c,c=i,i=a,a=c);u-- >0;){if(c=ze(o,s,n),c===f)return r[i]=o,r[a]=s,e(r);if(c>0)o=Math.floor(o/c)*c,s=Math.ceil(s/c)*c;else if(c<0)o=Math.ceil(o*c)/c,s=Math.floor(s*c)/c;else break;f=c}return t},t}function Rn(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function _c(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function wc(t){return t<0?-t*t:t*t}function xc(t){var e=t(yt,yt),n=1;function r(){return n===1?t(yt,yt):n===.5?t(_c,wc):t(Rn(n),Rn(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},bc(e)}function wr(){var t=xc(yc());return t.copy=function(){return mc(t,wr()).exponent(t.exponent())},uc.apply(t,arguments),t}function Ec(){return wr.apply(null,arguments).exponent(.5)}function $e(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}function Ae(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}Ae($e("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));Ae($e("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf"));var Mc=Ae($e("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4"));Ae($e("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));const ne=t=>()=>t;function Nc(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 dt(t,e,n){this.k=t,this.x=e,this.y=n}dt.prototype={constructor:dt,scale:function(t){return t===1?this:new dt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new dt(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 ke=new dt(1,0,0);dt.prototype;function Re(t){t.stopImmediatePropagation()}function Rt(t){t.preventDefault(),t.stopImmediatePropagation()}function Sc(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function $c(){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 In(){return this.__zoom||ke}function Ac(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function kc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Tc(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],a=t.invertY(e[0][1])-n[0][1],o=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function Cc(){var t=Sc,e=$c,n=Tc,r=Ac,i=kc,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,f=co,c=Ut("start","zoom","end"),u,h,l,g=500,_=150,y=0,v=10;function m(d){d.property("__zoom",In).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",z).on("dblclick.zoom",R).filter(i).on("touchstart.zoom",P).on("touchmove.zoom",A).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(d,x,b,E){var k=d.selection?d.selection():d;k.property("__zoom",In),d!==k?M(d,x,b,E):k.interrupt().each(function(){N(this,arguments).event(E).start().zoom(null,typeof x=="function"?x.apply(this,arguments):x).end()})},m.scaleBy=function(d,x,b,E){m.scaleTo(d,function(){var k=this.__zoom.k,T=typeof x=="function"?x.apply(this,arguments):x;return k*T},b,E)},m.scaleTo=function(d,x,b,E){m.transform(d,function(){var k=e.apply(this,arguments),T=this.__zoom,$=b==null?p(k):typeof b=="function"?b.apply(this,arguments):b,O=T.invert($),B=typeof x=="function"?x.apply(this,arguments):x;return n(S(w(T,B),$,O),k,o)},b,E)},m.translateBy=function(d,x,b,E){m.transform(d,function(){return n(this.__zoom.translate(typeof x=="function"?x.apply(this,arguments):x,typeof b=="function"?b.apply(this,arguments):b),e.apply(this,arguments),o)},null,E)},m.translateTo=function(d,x,b,E,k){m.transform(d,function(){var T=e.apply(this,arguments),$=this.__zoom,O=E==null?p(T):typeof E=="function"?E.apply(this,arguments):E;return n(ke.translate(O[0],O[1]).scale($.k).translate(typeof x=="function"?-x.apply(this,arguments):-x,typeof b=="function"?-b.apply(this,arguments):-b),T,o)},E,k)};function w(d,x){return x=Math.max(a[0],Math.min(a[1],x)),x===d.k?d:new dt(x,d.x,d.y)}function S(d,x,b){var E=x[0]-b[0]*d.k,k=x[1]-b[1]*d.k;return E===d.x&&k===d.y?d:new dt(d.k,E,k)}function p(d){return[(+d[0][0]+ +d[1][0])/2,(+d[0][1]+ +d[1][1])/2]}function M(d,x,b,E){d.on("start.zoom",function(){N(this,arguments).event(E).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).event(E).end()}).tween("zoom",function(){var k=this,T=arguments,$=N(k,T).event(E),O=e.apply(k,T),B=b==null?p(O):typeof b=="function"?b.apply(k,T):b,at=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),q=k.__zoom,j=typeof x=="function"?x.apply(k,T):x,ft=f(q.invert(B).concat(at/q.k),j.invert(B).concat(at/j.k));return function(tt){if(tt===1)tt=j;else{var ut=ft(tt),Te=at/ut[2];tt=new dt(Te,B[0]-ut[0]*Te,B[1]-ut[1]*Te)}$.zoom(null,tt)}})}function N(d,x,b){return!b&&d.__zooming||new L(d,x)}function L(d,x){this.that=d,this.args=x,this.active=0,this.sourceEvent=null,this.extent=e.apply(d,x),this.taps=0}L.prototype={event:function(d){return d&&(this.sourceEvent=d),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(d,x){return this.mouse&&d!=="mouse"&&(this.mouse[1]=x.invert(this.mouse[0])),this.touch0&&d!=="touch"&&(this.touch0[1]=x.invert(this.touch0[0])),this.touch1&&d!=="touch"&&(this.touch1[1]=x.invert(this.touch1[0])),this.that.__zoom=x,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(d){var x=nt(this.that).datum();c.call(d,this.that,new Nc(d,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:c}),x)}};function D(d,...x){if(!t.apply(this,arguments))return;var b=N(this,x).event(d),E=this.__zoom,k=Math.max(a[0],Math.min(a[1],E.k*Math.pow(2,r.apply(this,arguments)))),T=ht(d);if(b.wheel)(b.mouse[0][0]!==T[0]||b.mouse[0][1]!==T[1])&&(b.mouse[1]=E.invert(b.mouse[0]=T)),clearTimeout(b.wheel);else{if(E.k===k)return;b.mouse=[T,E.invert(T)],ce(this),b.start()}Rt(d),b.wheel=setTimeout($,_),b.zoom("mouse",n(S(w(E,k),b.mouse[0],b.mouse[1]),b.extent,o));function $(){b.wheel=null,b.end()}}function z(d,...x){if(l||!t.apply(this,arguments))return;var b=d.currentTarget,E=N(this,x,!0).event(d),k=nt(d.view).on("mousemove.zoom",B,!0).on("mouseup.zoom",at,!0),T=ht(d,b),$=d.clientX,O=d.clientY;ir(d.view),Re(d),E.mouse=[T,this.__zoom.invert(T)],ce(this),E.start();function B(q){if(Rt(q),!E.moved){var j=q.clientX-$,ft=q.clientY-O;E.moved=j*j+ft*ft>y}E.event(q).zoom("mouse",n(S(E.that.__zoom,E.mouse[0]=ht(q,b),E.mouse[1]),E.extent,o))}function at(q){k.on("mousemove.zoom mouseup.zoom",null),ar(q.view,E.moved),Rt(q),E.event(q).end()}}function R(d,...x){if(t.apply(this,arguments)){var b=this.__zoom,E=ht(d.changedTouches?d.changedTouches[0]:d,this),k=b.invert(E),T=b.k*(d.shiftKey?.5:2),$=n(S(w(b,T),E,k),e.apply(this,x),o);Rt(d),s>0?nt(this).transition().duration(s).call(M,$,E,d):nt(this).call(m.transform,$,E,d)}}function P(d,...x){if(t.apply(this,arguments)){var b=d.touches,E=b.length,k=N(this,x,d.changedTouches.length===E).event(d),T,$,O,B;for(Re(d),$=0;$<E;++$)O=b[$],B=ht(O,this),B=[B,this.__zoom.invert(B),O.identifier],k.touch0?!k.touch1&&k.touch0[2]!==B[2]&&(k.touch1=B,k.taps=0):(k.touch0=B,T=!0,k.taps=1+!!u);u&&(u=clearTimeout(u)),T&&(k.taps<2&&(h=B[0],u=setTimeout(function(){u=null},g)),ce(this),k.start())}}function A(d,...x){if(this.__zooming){var b=N(this,x).event(d),E=d.changedTouches,k=E.length,T,$,O,B;for(Rt(d),T=0;T<k;++T)$=E[T],O=ht($,this),b.touch0&&b.touch0[2]===$.identifier?b.touch0[0]=O:b.touch1&&b.touch1[2]===$.identifier&&(b.touch1[0]=O);if($=b.that.__zoom,b.touch1){var at=b.touch0[0],q=b.touch0[1],j=b.touch1[0],ft=b.touch1[1],tt=(tt=j[0]-at[0])*tt+(tt=j[1]-at[1])*tt,ut=(ut=ft[0]-q[0])*ut+(ut=ft[1]-q[1])*ut;$=w($,Math.sqrt(tt/ut)),O=[(at[0]+j[0])/2,(at[1]+j[1])/2],B=[(q[0]+ft[0])/2,(q[1]+ft[1])/2]}else if(b.touch0)O=b.touch0[0],B=b.touch0[1];else return;b.zoom("touch",n(S($,O,B),b.extent,o))}}function F(d,...x){if(this.__zooming){var b=N(this,x).event(d),E=d.changedTouches,k=E.length,T,$;for(Re(d),l&&clearTimeout(l),l=setTimeout(function(){l=null},g),T=0;T<k;++T)$=E[T],b.touch0&&b.touch0[2]===$.identifier?delete b.touch0:b.touch1&&b.touch1[2]===$.identifier&&delete b.touch1;if(b.touch1&&!b.touch0&&(b.touch0=b.touch1,delete b.touch1),b.touch0)b.touch0[1]=this.__zoom.invert(b.touch0[0]);else if(b.end(),b.taps===2&&($=ht($,this),Math.hypot(h[0]-$[0],h[1]-$[1])<v)){var O=nt(this).on("dblclick.zoom");O&&O.apply(this,arguments)}}}return m.wheelDelta=function(d){return arguments.length?(r=typeof d=="function"?d:ne(+d),m):r},m.filter=function(d){return arguments.length?(t=typeof d=="function"?d:ne(!!d),m):t},m.touchable=function(d){return arguments.length?(i=typeof d=="function"?d:ne(!!d),m):i},m.extent=function(d){return arguments.length?(e=typeof d=="function"?d:ne([[+d[0][0],+d[0][1]],[+d[1][0],+d[1][1]]]),m):e},m.scaleExtent=function(d){return arguments.length?(a[0]=+d[0],a[1]=+d[1],m):[a[0],a[1]]},m.translateExtent=function(d){return arguments.length?(o[0][0]=+d[0][0],o[1][0]=+d[1][0],o[0][1]=+d[0][1],o[1][1]=+d[1][1],m):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},m.constrain=function(d){return arguments.length?(n=d,m):n},m.duration=function(d){return arguments.length?(s=+d,m):s},m.interpolate=function(d){return arguments.length?(f=d,m):f},m.on=function(){var d=c.on.apply(c,arguments);return d===c?m:d},m.clickDistance=function(d){return arguments.length?(y=(d=+d)*d,m):Math.sqrt(y)},m.tapDistance=function(d){return arguments.length?(v=+d,m):v},m}const Yt={capability:"#238636",procedure:"#1f6feb",workflow:"#d29922",tool:"#8957e5",repository:"#bf8700",environment:"#1a7f5a",dependency:"#cf222e",data:"#388bfd",analytical:"#a371f7",memory:"#6e7781",heuristic:"#db61a2",constraint:"#f85149",generic:"#444c56"},Lc=Object.keys(Yt),Ye=t=>Yt[t]||Yt.generic,xr={unverified:"#6e7781",self_tested:"#1f6feb",peer_reviewed:"#238636",community_tested:"#a371f7",bugged:"#cf222e",deprecated:"#444c56"},Er={L1:"#238636",L2:"#1f6feb",L3:"#db61a2",L4:"#f85149"},_e=[{value:"type",label:"Entry type",kind:"categorical"},{value:"level",label:"Skill level (L1–L4)",kind:"categorical"},{value:"verification",label:"Verification",kind:"categorical"},{value:"relevance",label:"Relevance",kind:"ramp"},{value:"timestamp",label:"Created",kind:"ramp"},{value:"usage_count",label:"Usage count",kind:"ramp"},{value:"trust_score",label:"Trust score",kind:"ramp"}];let Bt,vt,K,Et,Nt,Z={};function we(){return{svgSel:vt,sceneSel:K,zoom:Et,rScale:Nt,degreeMap:Z,simulation:Bt}}function Dc(){return Bt}function Rc(t,e,n=.8){C.allNodes=t,C.allEdges=e,document.getElementById("loading").classList.add("hidden");const r=document.getElementById("graph-svg");vt=nt(r),K=vt.select("#scene"),K.selectAll("*").remove(),Et=Cc().scaleExtent([.05,5]).on("zoom",s=>K.attr("transform",s.transform)),vt.call(Et),Z={},t.forEach(s=>{Z[s.id]=0}),e.forEach(s=>{const f=s.source.id||s.source,c=s.target.id||s.target;Z[f]=(Z[f]||0)+1,Z[c]=(Z[c]||0)+1}),Nt=Ec().domain([0,Gr(Object.values(Z))||1]).range([7,22]);const i=K.append("g").attr("class","edges").selectAll(".edge").data(e).enter().append("line").attr("class","edge").attr("stroke","var(--edge-color)").attr("marker-end","url(#arrow)"),a=K.append("g").attr("class","edge-labels").selectAll(".edge-label").data(e).enter().append("text").attr("class","edge-label").text(s=>s.relation||""),o=K.append("g").attr("class","nodes").selectAll(".node").data(t,s=>s.id).enter().append("g").attr("class","node");return o.append("circle").attr("r",s=>Nt(Z[s.id]||0)).attr("fill",s=>Ye(s.entry_type)).attr("stroke",s=>gt(Ye(s.entry_type)).brighter(1).toString()),o.append("text").attr("x",s=>Nt(Z[s.id]||0)+4).text(s=>s.title),o.append("text").attr("class","score-label").attr("y",s=>Nt(Z[s.id]||0)+4).style("display","none"),Bt&&Bt.stop(),Bt=Ws(t).alpha(n).force("link",Bs(e).id(s=>s.id).distance(95)).force("charge",Qs().strength(-240)).force("x",Zs(r.clientWidth/2).strength(.05)).force("y",Js(r.clientHeight/2).strength(.05)).force("collide",Ps(s=>Nt(Z[s.id]||0)+8)).on("tick",()=>{i.attr("x1",s=>s.source.x).attr("y1",s=>s.source.y).attr("x2",s=>s.target.x).attr("y2",s=>s.target.y),a.attr("x",s=>(s.source.x+s.target.x)/2).attr("y",s=>(s.source.y+s.target.y)/2),o.attr("transform",s=>`translate(${s.x},${s.y})`)}),X(H.GRAPH_LOADED,{nodes:t,edges:e}),{nodeSel:o,edgeSel:i,edgeLabelSel:a}}function Mr(t){if(!K)return;const e=new Set([t]);C.allEdges.forEach(n=>{const r=n.source.id||n.source,i=n.target.id||n.target;r===t&&e.add(i),i===t&&e.add(r)}),K.selectAll(".node").classed("dimmed",n=>!e.has(n.id)).classed("selected",n=>n.id===t),K.selectAll(".edge").classed("highlighted",n=>{const r=n.source.id||n.source,i=n.target.id||n.target;return r===t||i===t}).attr("stroke",n=>{const r=n.source.id||n.source,i=n.target.id||n.target;return r===t||i===t?"var(--accent)":"var(--edge-color)"}).attr("marker-end",n=>{const r=n.source.id||n.source,i=n.target.id||n.target;return r===t||i===t?"url(#arrow-hl)":"url(#arrow)"})}function Ic(){K&&(K.selectAll(".node").classed("dimmed",!1).classed("selected",!1),K.selectAll(".edge").classed("highlighted",!1).attr("stroke","var(--edge-color)").attr("marker-end","url(#arrow)"))}function Nr(){if(!vt||!Et)return;const t=document.getElementById("graph-svg"),e=t.clientWidth,n=t.clientHeight;vt.transition().duration(400).call(Et.transform,ke.translate(e/2,n/2).scale(1).translate(-e/2,-n/2))}function zc(t){if(!vt||!Et)return;const e=C.allNodes.find(o=>o.id===t);if(!e||e.x==null)return;const n=document.getElementById("graph-svg"),r=n.clientWidth,i=n.clientHeight,a=1.2;vt.transition().duration(450).call(Et.transform,ke.translate(r/2-e.x*a,i/2-e.y*a).scale(a))}function I(t){return String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function J(t){return String(t??"").replace(/'/g,"\\'")}function Sr(t,e){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>t(...r),e)}}const cn=()=>document.getElementById("tooltip");function Oc(t,e){const n=cn();if(!n)return;const r=e.metadata||{};let i=`<div class="tt-title">${I(e.title)}</div>`;i+=Mt("type",e.entry_type||"—"),i+=Mt("slug",e.slug||"—");const a=C.searchScores[e.id];if(a!=null&&(i+=Mt("relevance",`${Math.round(a*100)}%`)),r.refinement_status&&(i+=Mt("status",r.refinement_status)),r.trust_score!=null&&(i+=Mt("trust",r.trust_score)),r.usage_count!=null&&(i+=Mt("usage",r.usage_count)),e.tags&&e.tags.length){const o=e.tags.map(s=>`<span>${I(s)}</span>`).join("");i+=`<div class="tt-row"><span class="tt-key">tags</span><span class="tt-val tt-tags">${o}</span></div>`}n.innerHTML=i,$r(t),n.classList.add("visible")}function Mt(t,e){return`<div class="tt-row"><span class="tt-key">${t}</span><span class="tt-val">${I(e)}</span></div>`}function $r(t){const e=cn();if(!e)return;const n=14,r=e.offsetWidth,i=e.offsetHeight;let a=t.clientX+n,o=t.clientY+n;a+r>window.innerWidth&&(a=t.clientX-r-n),o+i>window.innerHeight&&(o=t.clientY-i-n),e.style.left=a+"px",e.style.top=o+"px"}function zn(){var t;(t=cn())==null||t.classList.remove("visible")}let On,Hn,re;function Hc(t){const{sceneSel:e}=we();if(!e)return;const n=e.selectAll(".node");n.call(Ca().clickDistance(5).on("start",i=>{On=i.x,Hn=i.y,re=!1}).on("drag",(i,a)=>{if(!re){if(Math.hypot(i.x-On,i.y-Hn)<5)return;re=!0,a.fx=a.x,a.fy=a.y}a.fx=i.x,a.fy=i.y;const o=t();o&&o.alpha()<.1&&o.alpha(.3).restart()}).on("end",(i,a)=>{a.fx=null,a.fy=null,re=!1})),n.select("circle").on("mouseover",(i,a)=>Oc(i,a)).on("mousemove",i=>$r(i)).on("mouseout",()=>zn()).on("click",(i,a)=>{i.stopPropagation(),X(H.NODE_SELECTED,a.id)});const{svgSel:r}=we();r.on("click",()=>{zn(),X(H.NODE_CLEARED)})}function Pc(){Fc(),Bc(),qc(),Gc(),Ar()}function Fc(){const t=document.getElementById("type-filter");if(t)for(const e of Lc){const n=document.createElement("option");n.value=e,n.textContent=e,t.appendChild(n)}}function Bc(){const t=document.getElementById("color-mode");if(t){t.innerHTML="";for(const e of _e){const n=document.createElement("option");n.value=e.value,n.textContent=e.label,e.value===C.colorMode&&(n.selected=!0),t.appendChild(n)}}}function qc(){const t=document.getElementById("toggle-labels"),e=document.getElementById("color-mode"),n=document.getElementById("reset-view");Pn(t),t==null||t.addEventListener("click",()=>{C.showLabels=!C.showLabels,Pn(t),Ar(),X(H.LABELS_CHANGED,C.showLabels)}),e==null||e.addEventListener("change",r=>{C.colorMode=r.target.value||"type",X(H.COLOR_MODE_CHANGED,C.colorMode),X(H.SCORE_MODE_CHANGED,C.colorMode)}),n==null||n.addEventListener("click",()=>Nr())}function Ar(){document.body.classList.toggle("labels-off",!C.showLabels)}function Pn(t){t&&(t.textContent=`Labels: ${C.showLabels?"on":"off"}`,t.classList.toggle("active",C.showLabels))}function Gc(){const t=document.getElementById("live-badge");if(!t)return;const e={connected:{cls:"badge connected",text:"● live"},updating:{cls:"badge updating",text:"↻ updating…"},disconnected:{cls:"badge disconnected",text:"○ reconnecting…"}};ot(H.SSE_STATUS,n=>{const r=e[n]||e.disconnected;t.className=r.cls,t.textContent=r.text})}const Xc=t=>Mc(.2+Math.max(0,Math.min(1,t))*.75),Fn="#2a2a2a";let Ue={};function Vc(t){const e=[],n=[],r=[];for(const a of t){if(a.timestamp){const o=+new Date(a.timestamp);Number.isNaN(o)||e.push(o)}typeof a.usage_count=="number"&&n.push(a.usage_count),typeof a.trust_score=="number"&&r.push(a.trust_score)}const i=a=>a.length?[Math.min(...a),Math.max(...a)]:null;Ue={timestamp:i(e),usage_count:i(n),trust_score:i(r)}}function kr(t,e){if(e==="relevance"){const n=C.searchScores[t.id];return n??null}if(e==="timestamp"){if(!t.timestamp)return null;const n=Ue.timestamp;if(!n)return null;const[r,i]=n;if(i===r)return .5;const a=+new Date(t.timestamp);return Number.isNaN(a)?null:(a-r)/(i-r)}if(e==="usage_count"){if(typeof t.usage_count!="number")return null;const n=Ue.usage_count;if(!n)return null;const[r,i]=n;return i===r?.5:(t.usage_count-r)/(i-r)}return e==="trust_score"?typeof t.trust_score!="number"?null:t.trust_score:null}function Yc(t){const e=_e.find(n=>n.value===t);return(e==null?void 0:e.kind)==="ramp"}function Bn(t,e){if(e==="type")return Ye(t.entry_type);if(e==="level")return Er[t.skill_level]||Fn;if(e==="verification")return xr[t.verification_status]||Yt.generic;const n=kr(t,e);return n==null?Fn:Xc(n)}function Uc(t,e,n){if(e==="relevance")return Math.round(n*100)+"%";if(e==="timestamp"){const r=new Date(t.timestamp);return Number.isNaN(+r)?"":r.toISOString().slice(0,10)}return e==="usage_count"?String(t.usage_count):e==="trust_score"?t.trust_score.toFixed(2):""}function Tr(){const{sceneSel:t}=we();if(!t)return;Vc(C.allNodes);const e=C.colorMode||"type";t.selectAll(".node circle").attr("fill",r=>Bn(r,e)).attr("stroke",r=>{const i=gt(Bn(r,e));return i?i.brighter(1).toString():"#fff"});const n=Yc(e);t.selectAll(".node .score-label").each(function(r){const i=n?kr(r,e):null;nt(this).style("display",i==null?"none":null).text(i==null?"":Uc(r,e,i))})}let At,kt,Ke;function Kc(){At=document.getElementById("search-input"),kt=document.getElementById("type-filter"),Ke=document.getElementById("stats"),At.addEventListener("input",Qc),kt.addEventListener("change",()=>{xe(),X(H.FILTERS_CHANGED)}),ot(H.GRAPH_LOADED,()=>xe()),ot(H.COLOR_MODE_CHANGED,()=>Tr())}const Wc=Sr(async(t,e)=>{try{const n=await bt.searchEntries({q:t,type:e});C.apiMatchIds=new Set(n.map(r=>r.id)),C.searchScores={},n.forEach(r=>{r._score!=null&&(C.searchScores[r.id]=r._score)}),xe(),X(H.FILTERS_CHANGED)}catch(n){console.warn("API search failed:",n)}},350);function Qc(){const t=At.value.trim(),e=kt.value;t.length>=2&&!t.startsWith("#")?Wc(t,e):(C.apiMatchIds=null,C.searchScores={}),xe(),X(H.FILTERS_CHANGED)}function xe(){const{sceneSel:t}=we();if(!t)return;const e=(At==null?void 0:At.value.trim())||"",n=(kt==null?void 0:kt.value)||"";let r=null,i=e.toLowerCase();e.startsWith("#")&&(r=e.slice(1).toLowerCase().trim(),i="");const a=new Set;t.selectAll(".node").style("display",o=>{let s;if(r)s=Array.isArray(o.tags)&&o.tags.some(u=>u.toLowerCase().includes(r));else if(i){const u=o.title.toLowerCase().includes(i),h=(o.slug||"").toLowerCase().includes(i),l=Array.isArray(o.tags)&&o.tags.some(_=>_.toLowerCase().includes(i)),g=C.apiMatchIds?C.apiMatchIds.has(o.id):!1;s=u||h||l||g}else s=!0;const f=!n||o.entry_type===n,c=s&&f;return c&&a.add(o.id),c?null:"none"}),t.selectAll(".edge").style("display",o=>qn(o,a)),t.selectAll(".edge-label").style("display",o=>qn(o,a)),Tr(),Zc(a.size,!!(i||r||n))}function qn(t,e){const n=t.source.id||t.source,r=t.target.id||t.target;return e.has(n)&&e.has(r)?null:"none"}function Zc(t,e){if(!Ke)return;const n=C.allNodes.length;Ke.textContent=e&&t<n?`${t}/${n} nodes · ${C.allEdges.length} edges`:`${n} nodes · ${C.allEdges.length} edges`}function Jc(){const t=document.getElementById("detail-close");t==null||t.addEventListener("click",Ee),ot(H.NODE_SELECTED,Gn),ot(H.NODE_CLEARED,Ee),window.kdgFocusNode=e=>X(H.NODE_SELECTED,e),window.kdgFocusNodeBySlug=e=>{const n=C.allNodes.find(r=>r.slug===e);n&&X(H.NODE_SELECTED,n.id)},window.kdgSyncRemote=async(e,n)=>{var i;const r=document.getElementById(n);r&&(r.disabled=!0,r.textContent="Syncing…");try{const a=await bt.syncRemote(e,{force:!0});await Gn(e);const o=((i=a==null?void 0:a.result)==null?void 0:i.status)||"done";r&&(r.textContent=`↻ Sync now (last: ${o})`)}catch(a){r&&(r.textContent=`Sync failed: ${a.message}`)}finally{r&&(r.disabled=!1)}}}async function Gn(t){C.selectedId=t;let e;try{e=await bt.getEntry(t)}catch{e=C.allNodes.find(i=>i.id===t)}if(!e)return;const n=document.getElementById("detail"),r=document.getElementById("detail-body");document.getElementById("detail-title").textContent=e.title||t,r.innerHTML=jc(e,t),n.classList.remove("hidden"),Mr(t),zc(t)}function Ee(){var t;(t=document.getElementById("detail"))==null||t.classList.add("hidden"),C.selectedId=null,Ic()}function jc(t,e){const n=t.metadata||{};let r="";r+=It("Identity",[Q("ID",t.id),Q("Slug",t.slug),Q("Type",t.entry_type)]),t.content&&(r+=`<div class="detail-section">
|
|
2
|
+
<div class="detail-section-title">Content</div>
|
|
3
|
+
<div class="content-block">${I(t.content)}</div>
|
|
4
|
+
</div>`),t.tags&&t.tags.length&&(r+=`<div class="detail-section">
|
|
5
|
+
<div class="detail-section-title">Tags</div>
|
|
6
|
+
<div>${t.tags.map(s=>`<span class="tag-pill">${I(s)}</span>`).join("")}</div>
|
|
7
|
+
</div>`);const i=[Q("Refinement status",n.refinement_status),Q("Trust score",n.trust_score),Q("Usage count",n.usage_count),Q("Source provenance",n.source_provenance),Q("Extraction method",n.extraction_method),Q("Verification",n.verification_status)].filter(Boolean);i.length&&(r+=It("Metadata",i)),n.remote_source&&(r+=nf(t.id,n.remote_source)),t.assets&&t.assets.length?r+=af(t):t.scripts&&t.scripts.length&&(r+=sf(t)),n.related_environments&&n.related_environments.length&&(r+=It("Related environments",[Q("",n.related_environments.join(", "))])),n.runtime_requirements&&n.runtime_requirements.length&&(r+=It("Runtime requirements",[Q("",n.runtime_requirements.join(", "))])),n.external_refs&&n.external_refs.length&&(r+=It("External refs",[Q("",n.external_refs.join(", "))])),t.internal_refs&&t.internal_refs.length&&(r+=`<div class="detail-section">
|
|
8
|
+
<div class="detail-section-title">Wikilinks (${t.internal_refs.length})</div>
|
|
9
|
+
${t.internal_refs.map(s=>`<div class="edge-list-item"><span class="node-link" onclick="kdgFocusNodeBySlug('${J(s)}')">${I(s)}</span></div>`).join("")}
|
|
10
|
+
</div>`);const a=C.allEdges.filter(s=>(s.source.id||s.source)===e),o=C.allEdges.filter(s=>(s.target.id||s.target)===e);if(a.length||o.length){r+=`<div class="detail-section"><div class="detail-section-title">Connections (${a.length+o.length})</div>`;for(const s of a){const f=s.target.id||s.target,c=C.allNodes.find(u=>u.id===f);r+=Xn("→",s.relation,f,c)}for(const s of o){const f=s.source.id||s.source,c=C.allNodes.find(u=>u.id===f);r+=Xn("←",s.relation,f,c)}r+="</div>"}return n.custom&&Object.keys(n.custom).length&&(r+=`<div class="detail-section">
|
|
11
|
+
<div class="detail-section-title">Custom metadata</div>
|
|
12
|
+
<pre class="content-block">${I(JSON.stringify(n.custom,null,2))}</pre>
|
|
13
|
+
</div>`),r}function Q(t,e){return e==null||e===""?"":`<div class="detail-kv"><span class="k">${I(t)}</span><span class="v">${I(String(e))}</span></div>`}function It(t,e){const n=e.filter(Boolean).join("");return n?`<div class="detail-section"><div class="detail-section-title">${I(t)}</div>${n}</div>`:""}function Xn(t,e,n,r){const i=r?r.title:n;return`<div class="edge-list-item">
|
|
14
|
+
<span class="dir-badge">${t}</span>
|
|
15
|
+
<span class="rel-badge">${I(e||"link")}</span>
|
|
16
|
+
<span class="node-link" onclick="kdgFocusNode('${J(n)}')">${I(i)}</span>
|
|
17
|
+
</div>`}const tf=["scripts","references","docs","examples","data","notes"],ef={scripts:"⚙",references:"🔗",docs:"📄",examples:"🧪",data:"📊",notes:"📝"};function nf(t,e){const n={ok:"#2e8b57",stale:"#c98306",error:"#c0392b",never:"#888"}[e.status]||"#888",r=e.fetched_at?new Date(e.fetched_at).toLocaleString():"—",i=`kdg-sync-btn-${t}`,a=`<a href="${J(e.url)}" target="_blank" rel="noopener">${I(e.url)}</a>`,o=e.kind==="github"?`<div class="detail-kv"><span class="k">GitHub</span><span class="v">${I(e.owner||"?")}/${I(e.repo||"?")} @ <code>${I(e.ref||"main")}</code></span></div>
|
|
18
|
+
<div class="detail-kv"><span class="k">Path</span><span class="v"><code>${I(e.path||"")}</code></span></div>`:"",s=e.last_error?`<div class="detail-kv"><span class="k">Last error</span><span class="v" style="color:#c0392b">${I(e.last_error)}</span></div>`:"";return`<div class="detail-section">
|
|
19
|
+
<div class="detail-section-title">
|
|
20
|
+
Remote source
|
|
21
|
+
<span style="margin-left:.5em;padding:1px 6px;border-radius:8px;background:${n};color:#fff;font-size:.75em;text-transform:uppercase">${I(e.status||"never")}</span>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="detail-kv"><span class="k">URL</span><span class="v">${a}</span></div>
|
|
24
|
+
${o}
|
|
25
|
+
<div class="detail-kv"><span class="k">Last fetched</span><span class="v">${I(r)}</span></div>
|
|
26
|
+
<div class="detail-kv"><span class="k">Auto-sync</span><span class="v">${e.auto_sync?`every ${e.sync_interval_seconds}s`:"off"}</span></div>
|
|
27
|
+
${s}
|
|
28
|
+
<div style="margin-top:.5em">
|
|
29
|
+
<button id="${i}" class="tag-pill" style="cursor:pointer;border:none"
|
|
30
|
+
onclick="kdgSyncRemote('${J(t)}','${i}')">↻ Sync now</button>
|
|
31
|
+
</div>
|
|
32
|
+
</div>`}function rf(t){const e={};for(const r of t){const i=r.folder||"notes";(e[i]||(e[i]=[])).push(r)}const n={};for(const r of tf)e[r]&&(n[r]=e[r]);for(const r of Object.keys(e).sort())r in n||(n[r]=e[r]);return n}function af(t){const e=rf(t.assets),n=Object.keys(e);if(!n.length)return"";const r=n.map((a,o)=>{const s=e[a],f=o===0?" open":"",c=ef[a]||"📁",u=s.map(h=>of(t.id,h)).join("");return`<details class="asset-folder"${f}>
|
|
33
|
+
<summary class="asset-folder-summary">
|
|
34
|
+
<span class="asset-folder-icon">${c}</span>
|
|
35
|
+
<span class="asset-folder-name">${I(a)}</span>
|
|
36
|
+
<span class="asset-folder-count">${s.length}</span>
|
|
37
|
+
</summary>
|
|
38
|
+
<div class="asset-folder-body">${u}</div>
|
|
39
|
+
</details>`});return`<div class="detail-section">
|
|
40
|
+
<div class="detail-section-title">Assets (${t.assets.length})</div>
|
|
41
|
+
<div class="asset-tree">${r.join("")}</div>
|
|
42
|
+
</div>`}function of(t,e){const n=bt.assetUrl(t,e.folder,e.filename),r=e.requirements&&e.requirements.length?e.requirements.join(", "):"",i=e.language?`<span class="asset-tag">${I(e.language)}</span>`:"",a=`<span class="asset-tag asset-kind-${J(e.kind||"file")}">${I(e.kind||"file")}</span>`,o=typeof e.size=="number"?`${(e.size/1024).toFixed(1)} KB`:"",s=e.description?`<div class="asset-desc">${I(e.description)}</div>`:"",f=r?`<div class="asset-meta-row"><span class="k">requires</span><span class="v">${I(r)}</span></div>`:"",c=o?`<div class="asset-meta-row"><span class="k">size</span><span class="v">${I(o)}</span></div>`:"";let u;return e.kind==="link"?u=`<a class="asset-btn link" href="${J(e.download_url||n)}" target="_blank" rel="noopener">↗ Open link</a>`:e.kind==="text"?u=`<a class="asset-btn" href="${J(n)}" target="_blank" rel="noopener">⤴ View</a>`:u=`<a class="asset-btn dl" href="${J(n)}" download="${J(e.filename.split("/").pop())}">↓ Download</a>`,`<div class="asset-item">
|
|
43
|
+
<div class="asset-item-head">
|
|
44
|
+
<span class="asset-filename" title="${J(e.filename)}">${I(e.filename)}</span>
|
|
45
|
+
${a}${i}
|
|
46
|
+
</div>
|
|
47
|
+
${s}
|
|
48
|
+
${f}${c}
|
|
49
|
+
${u}
|
|
50
|
+
</div>`}function sf(t){const e=t.scripts.map(n=>{const r=n.requirements&&n.requirements.length?n.requirements.join(", "):"—",i=bt.scriptDownloadUrl(t.id,n.filename);return`<div class="asset-item">
|
|
51
|
+
<div class="asset-item-head">
|
|
52
|
+
<span class="asset-filename">${I(n.filename)}</span>
|
|
53
|
+
<span class="asset-tag">${I(n.language||"unknown")}</span>
|
|
54
|
+
</div>
|
|
55
|
+
${n.description?`<div class="asset-desc">${I(n.description)}</div>`:""}
|
|
56
|
+
<div class="asset-meta-row"><span class="k">requires</span><span class="v">${I(r)}</span></div>
|
|
57
|
+
<a class="asset-btn dl" href="${J(i)}" download="${J(n.filename)}">↓ Download</a>
|
|
58
|
+
</div>`}).join("");return`<div class="detail-section">
|
|
59
|
+
<div class="detail-section-title">Scripts (${t.scripts.length})</div>
|
|
60
|
+
<details class="asset-folder" open>
|
|
61
|
+
<summary class="asset-folder-summary">
|
|
62
|
+
<span class="asset-folder-icon">⚙</span>
|
|
63
|
+
<span class="asset-folder-name">scripts</span>
|
|
64
|
+
<span class="asset-folder-count">${t.scripts.length}</span>
|
|
65
|
+
</summary>
|
|
66
|
+
<div class="asset-folder-body">${e}</div>
|
|
67
|
+
</details>
|
|
68
|
+
</div>`}function cf(){zt(),ot(H.COLOR_MODE_CHANGED,zt),ot(H.SCORE_MODE_CHANGED,zt),ot(H.FILTERS_CHANGED,zt),ot(H.GRAPH_LOADED,zt)}function zt(){const t=document.getElementById("legend");if(!t)return;const e=C.colorMode||"type",n=_e.find(r=>r.value===e)||_e[0];if(n.kind==="ramp"){ff(t,n,e);return}if(e==="verification"){Ie(t,"Verification",xr);return}if(e==="level"){Ie(t,"Skill level",Er);return}Ie(t,"Entry types",Yt)}function ff(t,e,n){const r=uf(n);t.innerHTML=`
|
|
69
|
+
<div class="leg-title">${e.label}</div>
|
|
70
|
+
<svg class="score-ramp-svg" width="160" height="14">
|
|
71
|
+
<defs>
|
|
72
|
+
<linearGradient id="ramp-grad" x1="0" x2="1" y1="0" y2="0">
|
|
73
|
+
<stop offset="0%" stop-color="#180f3e"/>
|
|
74
|
+
<stop offset="28%" stop-color="#6a2089"/>
|
|
75
|
+
<stop offset="56%" stop-color="#c84b6a"/>
|
|
76
|
+
<stop offset="78%" stop-color="#f57c3b"/>
|
|
77
|
+
<stop offset="100%" stop-color="#fde724"/>
|
|
78
|
+
</linearGradient>
|
|
79
|
+
</defs>
|
|
80
|
+
<rect width="160" height="14" fill="url(#ramp-grad)" rx="3"/>
|
|
81
|
+
</svg>
|
|
82
|
+
<div class="ramp-labels"><span>${r.low}</span><span>${r.high}</span></div>`}function uf(t){const e=C.allNodes||[];if(t==="relevance")return{low:Object.keys(C.searchScores||{}).length>0?"low":"search to score",high:"high"};if(t==="timestamp"){const n=e.map(r=>r.timestamp&&+new Date(r.timestamp)).filter(r=>r&&!Number.isNaN(r));return n.length?{low:new Date(Math.min(...n)).toISOString().slice(0,10),high:new Date(Math.max(...n)).toISOString().slice(0,10)}:{low:"—",high:"—"}}if(t==="usage_count"){const n=e.filter(r=>typeof r.usage_count=="number").map(r=>r.usage_count);return n.length?{low:String(Math.min(...n)),high:String(Math.max(...n))}:{low:"—",high:"—"}}if(t==="trust_score"){const n=e.filter(r=>typeof r.trust_score=="number").map(r=>r.trust_score);return n.length?{low:Math.min(...n).toFixed(2),high:Math.max(...n).toFixed(2)}:{low:"—",high:"—"}}return{low:"low",high:"high"}}function Ie(t,e,n){t.innerHTML=`<div class="leg-title">${e}</div>`;for(const[r,i]of Object.entries(n)){const a=document.createElement("div");a.className="leg-item",a.innerHTML=`<div class="leg-dot" style="background:${i}"></div>${r}`,t.appendChild(a)}}function lf(){document.addEventListener("keydown",t=>{const e=t.target,n=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement;if(t.key==="/"&&!n){t.preventDefault();const r=document.getElementById("search-input");r==null||r.focus(),r==null||r.select();return}if(t.key==="Escape"){const r=document.getElementById("search-input");document.activeElement===r?r.blur():Ee();return}t.key==="r"&&!n&&!t.metaKey&&!t.ctrlKey&&Nr()})}const hf=5e3;function df(t){let e,n=!1;function r(){e=new EventSource(bt.eventsUrl()),e.onopen=()=>X(H.SSE_STATUS,"connected"),e.onmessage=i=>{let a;try{a=JSON.parse(i.data)}catch{return}a.type!=="ping"&&(X(H.SSE_STATUS,"updating"),t(a),setTimeout(()=>X(H.SSE_STATUS,"connected"),1500))},e.onerror=()=>{X(H.SSE_STATUS,"disconnected"),e.close(),n||setTimeout(r,hf)}}return r(),()=>{n=!0,e==null||e.close()}}function Cr(t,e,n=.8){Rc(t,e,n),Hc(Dc)}async function gf(){try{const t=await bt.getFullGraph();Cr(t.nodes,t.edges)}catch(t){pf(`Failed to load graph: ${t.message}.`)}}const Lr=Sr(async()=>{const t={};C.allNodes.forEach(e=>{e.x!=null&&(t[e.id]={x:e.x,y:e.y})});try{const e=await bt.getFullGraph();e.nodes.forEach(n=>{t[n.id]&&(n.x=t[n.id].x,n.y=t[n.id].y)}),Cr(e.nodes,e.edges,.05),C.selectedId&&(e.nodes.find(n=>n.id===C.selectedId)?Mr(C.selectedId):Ee())}catch(e){console.warn("softRefresh failed:",e)}},500);function pf(t){var n;(n=document.getElementById("loading"))==null||n.classList.add("hidden");const e=document.getElementById("error-banner");e&&(e.textContent=`${t} Make sure the API server is running.`,e.hidden=!1)}Pc();Kc();Jc();cf();lf();ot(H.GRAPH_REFRESH,Lr);gf();df(()=>Lr());
|
|
83
|
+
//# sourceMappingURL=index-G-mYbZ9R.js.map
|