833 lines
31 KiB
HTML
833 lines
31 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||
<title>Encyclopedia of Technocapital Singularity Zoology — Interactive Knowledge Graph (v2.2.0)</title>
|
||
<style>
|
||
:root {
|
||
--bg-canvas: #020617;
|
||
--bg-panel: #0c1324;
|
||
--bg-card: #111a2e;
|
||
--border-col: #26344d;
|
||
--text-main: #e2e8f0;
|
||
--text-muted: #94a3b8;
|
||
--accent-red: #f43f5e;
|
||
--accent-cyan: #38bdf8;
|
||
--accent-gold: #f59e0b;
|
||
--accent-mint: #10b981;
|
||
}
|
||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||
body {
|
||
background: var(--bg-canvas);
|
||
color: var(--text-main);
|
||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "DejaVu Sans", sans-serif;
|
||
height: 100vh;
|
||
overflow: hidden;
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
header {
|
||
background: var(--bg-panel);
|
||
border-bottom: 2px solid var(--accent-red);
|
||
padding: 10px 18px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 14px;
|
||
z-index: 20;
|
||
}
|
||
.brand h1 {
|
||
font-size: 16px;
|
||
font-weight: 700;
|
||
letter-spacing: 0.3px;
|
||
color: var(--text-main);
|
||
}
|
||
.brand p {
|
||
font-size: 11.5px;
|
||
color: var(--text-muted);
|
||
margin-top: 2px;
|
||
}
|
||
.toolbar {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
flex-wrap: wrap;
|
||
}
|
||
.btn {
|
||
background: var(--bg-card);
|
||
color: var(--text-main);
|
||
border: 1px solid var(--border-col);
|
||
border-radius: 5px;
|
||
padding: 6px 11px;
|
||
font-size: 12px;
|
||
font-weight: 600;
|
||
cursor: pointer;
|
||
transition: all 0.15s ease;
|
||
}
|
||
.btn:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
|
||
.btn.active {
|
||
background: var(--accent-red);
|
||
border-color: var(--accent-red);
|
||
color: #121318;
|
||
}
|
||
.search-input {
|
||
background: #101217;
|
||
color: var(--text-main);
|
||
border: 1px solid var(--border-col);
|
||
border-radius: 5px;
|
||
padding: 6px 10px;
|
||
font-size: 12px;
|
||
width: 220px;
|
||
}
|
||
.search-input:focus { outline: none; border-color: var(--accent-cyan); }
|
||
.filter-select {
|
||
background: var(--bg-card);
|
||
color: var(--text-main);
|
||
border: 1px solid var(--border-col);
|
||
border-radius: 5px;
|
||
padding: 6px 9px;
|
||
font-size: 12px;
|
||
}
|
||
.workspace {
|
||
flex: 1;
|
||
display: flex;
|
||
position: relative;
|
||
overflow: hidden;
|
||
}
|
||
.left-sidebar {
|
||
width: 260px;
|
||
background: var(--bg-panel);
|
||
border-right: 1px solid var(--border-col);
|
||
padding: 12px;
|
||
overflow-y: auto;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 14px;
|
||
z-index: 10;
|
||
}
|
||
.panel-section h3 {
|
||
font-size: 11px;
|
||
text-transform: uppercase;
|
||
letter-spacing: 0.7px;
|
||
color: var(--accent-gold);
|
||
margin-bottom: 8px;
|
||
border-bottom: 1px solid var(--border-col);
|
||
padding-bottom: 4px;
|
||
}
|
||
.chk-row {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 7px;
|
||
font-size: 11.5px;
|
||
margin-bottom: 5px;
|
||
cursor: pointer;
|
||
color: var(--text-main);
|
||
}
|
||
.chk-swatch {
|
||
width: 10px;
|
||
height: 10px;
|
||
border-radius: 2px;
|
||
display: inline-block;
|
||
flex-shrink: 0;
|
||
}
|
||
.pill-grid {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 5px;
|
||
}
|
||
.coord-pill {
|
||
background: var(--bg-card);
|
||
border: 1px solid var(--border-col);
|
||
color: var(--accent-cyan);
|
||
padding: 3px 7px;
|
||
border-radius: 4px;
|
||
font-family: monospace;
|
||
font-size: 11px;
|
||
cursor: pointer;
|
||
}
|
||
.coord-pill:hover, .coord-pill.active {
|
||
background: var(--accent-cyan);
|
||
color: #101217;
|
||
font-weight: 700;
|
||
}
|
||
.canvas-wrap {
|
||
flex: 1;
|
||
position: relative;
|
||
background: radial-gradient(circle at center, #181B24 0%, #101217 100%);
|
||
}
|
||
canvas {
|
||
display: block;
|
||
width: 100%;
|
||
height: 100%;
|
||
cursor: grab;
|
||
}
|
||
canvas:active { cursor: grabbing; }
|
||
.hud-stats {
|
||
position: absolute;
|
||
bottom: 12px;
|
||
left: 14px;
|
||
background: rgba(20, 23, 31, 0.90);
|
||
border: 1px solid var(--border-col);
|
||
border-radius: 6px;
|
||
padding: 7px 12px;
|
||
font-family: monospace;
|
||
font-size: 11.5px;
|
||
color: var(--text-muted);
|
||
pointer-events: none;
|
||
}
|
||
.right-drawer {
|
||
width: 360px;
|
||
background: var(--bg-panel);
|
||
border-left: 1px solid var(--border-col);
|
||
padding: 14px;
|
||
overflow-y: auto;
|
||
z-index: 10;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 10px;
|
||
}
|
||
.drawer-title {
|
||
font-size: 15px;
|
||
font-weight: 700;
|
||
color: var(--text-main);
|
||
line-height: 1.3;
|
||
}
|
||
.badge-row {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 5px;
|
||
}
|
||
.badge {
|
||
padding: 2px 7px;
|
||
border-radius: 4px;
|
||
font-size: 10.5px;
|
||
font-weight: 700;
|
||
font-family: monospace;
|
||
background: var(--bg-card);
|
||
border: 1px solid var(--border-col);
|
||
}
|
||
.kv-box {
|
||
background: var(--bg-card);
|
||
border: 1px solid var(--border-col);
|
||
border-radius: 6px;
|
||
padding: 9px 10px;
|
||
font-size: 12px;
|
||
line-height: 1.45;
|
||
}
|
||
.kv-box strong { color: var(--accent-gold); }
|
||
.eq-list {
|
||
list-style: none;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 5px;
|
||
font-family: monospace;
|
||
font-size: 11px;
|
||
}
|
||
.eq-list li {
|
||
background: #141720;
|
||
padding: 6px 8px;
|
||
border-left: 3px solid var(--accent-mint);
|
||
border-radius: 3px;
|
||
}
|
||
.pdf-link {
|
||
display: inline-block;
|
||
text-align: center;
|
||
background: var(--accent-red);
|
||
color: #121318;
|
||
font-weight: 700;
|
||
font-size: 12px;
|
||
text-decoration: none;
|
||
padding: 8px 12px;
|
||
border-radius: 5px;
|
||
margin-top: 4px;
|
||
}
|
||
.pdf-link:hover { opacity: 0.9; }
|
||
.neighbor-list {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 4px;
|
||
max-height: 220px;
|
||
overflow-y: auto;
|
||
}
|
||
.neighbor-item {
|
||
background: var(--bg-card);
|
||
padding: 5px 8px;
|
||
border-radius: 4px;
|
||
font-size: 11.5px;
|
||
cursor: pointer;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
border: 1px solid transparent;
|
||
}
|
||
.neighbor-item:hover { border-color: var(--accent-cyan); }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<header>
|
||
<div class="brand">
|
||
<h1>ENCYCLOPEDIA OF TECHNOCAPITAL SINGULARITY ZOOLOGY — INTERACTIVE KNOWLEDGE GRAPH</h1>
|
||
<p>Standalone Sibling Repository (/workspace/encyclopedia-knowledge-graph) • 388 Nodes • 1,282 Deduplicated Edges • Zero Glossary Leak • v2.2.0</p>
|
||
</div>
|
||
<div class="toolbar">
|
||
<button class="btn active" data-mode="mode2_radar">Mode 2: ETI Radar (S+ -> D Periphery)</button>
|
||
<button class="btn" data-mode="mode1_trophic">Mode 1: Trophic Food-Web</button>
|
||
<button class="btn" data-mode="mode3_bipartite">Mode 3: Gen 0 -> Gen 1 Funnel</button>
|
||
<button class="btn" data-mode="mode4_hierarchy">Mode 4: 00–08 Folder Grid</button>
|
||
<input type="text" id="searchInput" class="search-input" placeholder="Search headword, Ingglish, or AQ (e.g. 125)..." />
|
||
<select id="flagFilter" class="filter-select">
|
||
<option value="all">Filter: All Nodes</option>
|
||
<option value="iso">G4 Isometric Fixed Points (Δ=0)</option>
|
||
<option value="twinp">G5 Twin-Prime Mutations</option>
|
||
<option value="g3">G3 Quantized Steps</option>
|
||
<option value="flex">13 Multi-Build Flex Pivots</option>
|
||
<option value="m7">M7_candidate_2026_11_28</option>
|
||
</select>
|
||
<button class="btn" id="resetViewBtn">Reset View</button>
|
||
<button class="btn" id="exportPngBtn">Export PNG</button>
|
||
</div>
|
||
</header>
|
||
|
||
<div class="workspace">
|
||
<aside class="left-sidebar">
|
||
<div class="panel-section">
|
||
<h3>Node Ontology (6 Classes)</h3>
|
||
<div id="nodeTypeToggles"></div>
|
||
</div>
|
||
<div class="panel-section">
|
||
<h3>Edge Relations (8 Types)</h3>
|
||
<div id="edgeRelToggles"></div>
|
||
</div>
|
||
<div class="panel-section">
|
||
<h3>13 Flex Pivots & Repdigit Hubs</h3>
|
||
<div class="pill-grid" id="flexPills"></div>
|
||
</div>
|
||
<div class="panel-section">
|
||
<h3>Glossary Isolation Status</h3>
|
||
<div class="kv-box" id="isolationBox" style="font-size:11px;"></div>
|
||
</div>
|
||
</aside>
|
||
|
||
<div class="canvas-wrap">
|
||
<canvas id="graphCanvas"></canvas>
|
||
<div class="hud-stats" id="hudStats">Loading Encyclopedia Knowledge Graph...</div>
|
||
</div>
|
||
|
||
<aside class="right-drawer" id="inspectorDrawer">
|
||
<div class="drawer-title" id="inspTitle">Click any node to inspect its Encyclopedia Article</div>
|
||
<div class="badge-row" id="inspBadges"></div>
|
||
<div id="inspBody" style="display:flex;flex-direction:column;gap:8px;"></div>
|
||
</aside>
|
||
</div>
|
||
<footer class="hs-global-footer" style="background:#1A1D26;border-top:1px solid #323846;padding:4px 14px;text-align:center;font-size:11px;color:#9BA3B8;z-index:20;">
|
||
<span class="hs-lemur-credit">hyperstitionstud.io/graph v2.2.0 • Made with <span class="hs-heart" role="img" aria-label="love" style="color:#FB7185;display:inline-block;padding:0 2px;">♥</span> by Lemurs.</span>
|
||
</footer>
|
||
|
||
<script src="graph-data.js?v=2.2.0"></script>
|
||
<script>
|
||
(function() {
|
||
const DATA = (window.HyperstitionStudio && window.HyperstitionStudio.EncyclopediaGraphData) || window.ENCYCLOPEDIA_GRAPH_DATA;
|
||
if (!DATA) {
|
||
document.getElementById("hudStats").textContent = "Error: graph-data.js not found.";
|
||
return;
|
||
}
|
||
const ENC_BASE = DATA.encyclopedia_base_path || "../technocapital-singularity-zoology/encyclopedia";
|
||
|
||
const canvas = document.getElementById("graphCanvas");
|
||
const ctx = canvas.getContext("2d");
|
||
|
||
let currentMode = "mode2_radar";
|
||
let camX = 0, camY = 0, camScale = 1.0;
|
||
let isDragging = false, dragStartX = 0, dragStartY = 0;
|
||
let selectedNode = null;
|
||
let searchQuery = "";
|
||
let activeFlag = "all";
|
||
|
||
const nodeMap = {};
|
||
DATA.nodes.forEach(n => { nodeMap[n.id] = n; });
|
||
|
||
const activeNodeTypes = new Set([
|
||
"TaxonAssemblageBuild",
|
||
"AQCoordinateHub",
|
||
"BilingualLexicalSpecimen",
|
||
"ConceptualOperatorOrIdiom",
|
||
"EncyclopediaVolume",
|
||
"OntologicalDivision"
|
||
]);
|
||
|
||
const activeEdgeRels = new Set([
|
||
"TROPHIC_GUILD_BRIDGE",
|
||
"G1_COLLAPSES_TO_ING_AQ",
|
||
"G2_CROSS_GEN_TWIN",
|
||
"G5_TWIN_PRIME_MUTATION",
|
||
"GEN0_WRITTEN_COLLISION",
|
||
"CLOSES_REPDIGIT_EQ",
|
||
"IN_GUILD_BUILD",
|
||
"IN_VOLUME"
|
||
]);
|
||
|
||
const ntColors = {
|
||
"TaxonAssemblageBuild": "#FF4D4D",
|
||
"AQCoordinateHub": "#00E5FF",
|
||
"BilingualLexicalSpecimen": "#7FFF7F",
|
||
"ConceptualOperatorOrIdiom": "#E6A800",
|
||
"EncyclopediaVolume": "#8B1A1A",
|
||
"OntologicalDivision": "#5CE1E6"
|
||
};
|
||
const ntContainer = document.getElementById("nodeTypeToggles");
|
||
Object.keys(ntColors).forEach(nt => {
|
||
const count = DATA.counts.nodes_by_type[nt] || 0;
|
||
const lbl = document.createElement("label");
|
||
lbl.className = "chk-row";
|
||
lbl.innerHTML = `<input type="checkbox" checked value="${nt}"/> <span class="chk-swatch" style="background:${ntColors[nt]}"></span> <span>${nt.replace(/([A-Z])/g, ' $1').trim()} (${count})</span>`;
|
||
lbl.querySelector("input").addEventListener("change", e => {
|
||
if (e.target.checked) activeNodeTypes.add(nt);
|
||
else activeNodeTypes.delete(nt);
|
||
draw();
|
||
});
|
||
ntContainer.appendChild(lbl);
|
||
});
|
||
|
||
const erColors = {
|
||
"TROPHIC_GUILD_BRIDGE": "#FF4D4D",
|
||
"G1_COLLAPSES_TO_ING_AQ": "#38BDF8",
|
||
"G2_CROSS_GEN_TWIN": "#EC4899",
|
||
"G5_TWIN_PRIME_MUTATION": "#A855F7",
|
||
"GEN0_WRITTEN_COLLISION": "#9CA3AF",
|
||
"CLOSES_REPDIGIT_EQ": "#F59E0B",
|
||
"IN_GUILD_BUILD": "#FFBF7F",
|
||
"IN_VOLUME": "#4B5563"
|
||
};
|
||
const erContainer = document.getElementById("edgeRelToggles");
|
||
Object.keys(erColors).forEach(rel => {
|
||
const count = DATA.counts.edges_by_relation[rel] || 0;
|
||
const lbl = document.createElement("label");
|
||
lbl.className = "chk-row";
|
||
lbl.innerHTML = `<input type="checkbox" checked value="${rel}"/> <span class="chk-swatch" style="background:${erColors[rel]}"></span> <span>${rel} (${count})</span>`;
|
||
lbl.querySelector("input").addEventListener("change", e => {
|
||
if (e.target.checked) activeEdgeRels.add(rel);
|
||
else activeEdgeRels.delete(rel);
|
||
draw();
|
||
});
|
||
erContainer.appendChild(lbl);
|
||
});
|
||
|
||
const flexContainer = document.getElementById("flexPills");
|
||
[333, 666, 777, 292, 260, 256, 211, 193, 191, 183, 166, 153, 137, 136, 133, 129, 125, 96, 95, 91, 81].forEach(c => {
|
||
const pill = document.createElement("span");
|
||
pill.className = "coord-pill";
|
||
pill.textContent = c;
|
||
pill.addEventListener("click", () => {
|
||
const target = nodeMap[`aq:${c}`];
|
||
if (target) {
|
||
selectNode(target);
|
||
centerOnNode(target);
|
||
}
|
||
});
|
||
flexContainer.appendChild(pill);
|
||
});
|
||
|
||
const iso = DATA.isolation_verified;
|
||
document.getElementById("isolationBox").innerHTML =
|
||
`<strong>Zero Glossary Leak:</strong> ${iso.zero_concepts_leaked_into_glossary ? "TRUE (VERIFIED)" : "FALSE"}<br/>` +
|
||
`<strong>Glossary SHA-256:</strong> <code>${iso.glossary_registry_sha256_post.slice(0, 16)}...</code>`;
|
||
|
||
function resizeCanvas() {
|
||
const rect = canvas.parentElement.getBoundingClientRect();
|
||
canvas.width = rect.width * window.devicePixelRatio;
|
||
canvas.height = rect.height * window.devicePixelRatio;
|
||
ctx.setTransform(window.devicePixelRatio, 0, 0, window.devicePixelRatio, 0, 0);
|
||
resetCamera();
|
||
}
|
||
|
||
function resetCamera() {
|
||
const rect = canvas.parentElement.getBoundingClientRect();
|
||
camScale = Math.min(rect.width / 1640, rect.height / 1040) * 0.94;
|
||
camX = (rect.width - 1600 * camScale) / 2;
|
||
camY = (rect.height - 1000 * camScale) / 2;
|
||
draw();
|
||
}
|
||
|
||
function centerOnNode(n) {
|
||
const rect = canvas.parentElement.getBoundingClientRect();
|
||
const pos = n.layouts[currentMode];
|
||
camScale = Math.max(camScale, 1.15);
|
||
camX = rect.width / 2 - pos.x * camScale;
|
||
camY = rect.height / 2 - pos.y * camScale;
|
||
draw();
|
||
}
|
||
|
||
const FLEX_SET = new Set([292, 256, 211, 193, 183, 153, 137, 136, 133, 125, 96, 95, 91, 81]);
|
||
function nodePassesFilter(n) {
|
||
if (!activeNodeTypes.has(n.node_type)) return false;
|
||
if (activeFlag === "iso" && !n.isometric) return false;
|
||
if (activeFlag === "twinp" && !n.twin_prime) return false;
|
||
if (activeFlag === "g3" && !n.g3_quantized_step) return false;
|
||
if (activeFlag === "flex" && !(n.is_flex_pivot || FLEX_SET.has(n.ing_aq))) return false;
|
||
if (activeFlag === "m7" && !((n.classes && n.classes.includes("M7_candidate_2026_11_28")) || n.id.includes("M7"))) return false;
|
||
if (searchQuery) {
|
||
const q = searchQuery.toLowerCase();
|
||
const matchLbl = (n.label || "").toLowerCase().includes(q);
|
||
const matchEng = (n.eng || "").toLowerCase().includes(q);
|
||
const matchIng = (n.ing || "").toLowerCase().includes(q);
|
||
const matchAq = String(n.ing_aq || n.aq_value || "") === q;
|
||
if (!matchLbl && !matchEng && !matchIng && !matchAq) return false;
|
||
}
|
||
return true;
|
||
}
|
||
|
||
function getNeighborhoodSet(centerNode) {
|
||
if (!centerNode) return null;
|
||
const s = new Set([centerNode.id]);
|
||
DATA.edges.forEach(e => {
|
||
if (!activeEdgeRels.has(e.relation)) return;
|
||
if (e.source === centerNode.id) s.add(e.target);
|
||
if (e.target === centerNode.id) s.add(e.source);
|
||
});
|
||
return s;
|
||
}
|
||
|
||
function draw() {
|
||
const rect = canvas.parentElement.getBoundingClientRect();
|
||
ctx.clearRect(0, 0, rect.width, rect.height);
|
||
ctx.save();
|
||
ctx.translate(camX, camY);
|
||
ctx.scale(camScale, camScale);
|
||
|
||
if (currentMode === "mode2_radar") {
|
||
const rings = [
|
||
[95, "#FF4D4D", "RING 1: TIER S+ CENTER (88-100 ETI — APEX PREDATOR)"],
|
||
[185, "#FF7F7F", "RING 2: TIER S (80-87 ETI — KEYSTONE GUILD)"],
|
||
[265, "#FFBF7F", "RING 3: TIER A (72-79 ETI — SYMBIONT LOCK)"],
|
||
[345, "#FFFF7F", "RING 4: TIER B (60-71 ETI — NOMAD SPECIALIST)"],
|
||
[415, "#7FFF7F", "RING 5: TIER C (52-59 ETI — NUCLEATION STUB / M7+)"],
|
||
[475, "#7FBFFF", "RING 6: TIER D PERIPHERY (44-51 ETI — EPISODIC Q-STUB)"]
|
||
];
|
||
rings.forEach(([r, col, txt]) => {
|
||
ctx.beginPath();
|
||
ctx.arc(800, 500, r, 0, Math.PI * 2);
|
||
ctx.strokeStyle = col + "55";
|
||
ctx.lineWidth = 1.5;
|
||
ctx.setLineDash([6, 4]);
|
||
ctx.stroke();
|
||
ctx.setLineDash([]);
|
||
ctx.fillStyle = col + "CC";
|
||
ctx.font = "bold 10px monospace";
|
||
ctx.textAlign = "center";
|
||
ctx.fillText(txt, 800, 500 - r + 12);
|
||
});
|
||
} else if (currentMode === "mode3_bipartite") {
|
||
const cols = [
|
||
[240, "GEN 0 WRITTEN SPECIMENS (190)"],
|
||
[500, "CONCEPTUAL OPERATORS (92)"],
|
||
[790, "ENCYCLOPEDIA VOLUMES (22)"],
|
||
[1080, "GEN 1 AQ HUBS (VAR -> 0.0)"],
|
||
[1340, "ETI BUILDS & 333/666/777"]
|
||
];
|
||
cols.forEach(([x, txt]) => {
|
||
ctx.beginPath();
|
||
ctx.moveTo(x, 40);
|
||
ctx.lineTo(x, 960);
|
||
ctx.strokeStyle = "#323846";
|
||
ctx.lineWidth = 1;
|
||
ctx.stroke();
|
||
ctx.fillStyle = "#F5C630";
|
||
ctx.font = "bold 11px monospace";
|
||
ctx.textAlign = "center";
|
||
ctx.fillText(txt, x, 30);
|
||
});
|
||
}
|
||
|
||
const egoSet = getNeighborhoodSet(selectedNode);
|
||
let visNodes = 0, visEdges = 0;
|
||
|
||
DATA.edges.forEach(e => {
|
||
if (!activeEdgeRels.has(e.relation) || e.source === e.target) return;
|
||
const n1 = nodeMap[e.source];
|
||
const n2 = nodeMap[e.target];
|
||
if (!n1 || !n2 || !nodePassesFilter(n1) || !nodePassesFilter(n2)) return;
|
||
const inEgo = !egoSet || (egoSet.has(n1.id) && egoSet.has(n2.id) && (n1.id === selectedNode.id || n2.id === selectedNode.id));
|
||
if (egoSet && !inEgo) return;
|
||
|
||
visEdges++;
|
||
const p1 = n1.layouts[currentMode];
|
||
const p2 = n2.layouts[currentMode];
|
||
ctx.beginPath();
|
||
ctx.moveTo(p1.x, p1.y);
|
||
ctx.lineTo(p2.x, p2.y);
|
||
ctx.strokeStyle = e.color + (egoSet ? "CC" : "44");
|
||
ctx.lineWidth = egoSet ? Math.max(1.5, e.weight * 0.8) : Math.max(0.8, e.weight * 0.45);
|
||
ctx.stroke();
|
||
});
|
||
|
||
DATA.nodes.forEach(n => {
|
||
if (!nodePassesFilter(n)) return;
|
||
const inEgo = !egoSet || egoSet.has(n.id);
|
||
visNodes++;
|
||
const pos = n.layouts[currentMode];
|
||
const r = Math.max(5, n.size * 0.36);
|
||
|
||
ctx.globalAlpha = inEgo ? 1.0 : 0.16;
|
||
ctx.beginPath();
|
||
ctx.arc(pos.x, pos.y, r, 0, Math.PI * 2);
|
||
ctx.fillStyle = n.color;
|
||
ctx.fill();
|
||
|
||
if (n.isometric || (selectedNode && selectedNode.id === n.id)) {
|
||
ctx.lineWidth = selectedNode && selectedNode.id === n.id ? 3.5 : 2.2;
|
||
ctx.strokeStyle = selectedNode && selectedNode.id === n.id ? "#FFFFFF" : "#F5C630";
|
||
ctx.stroke();
|
||
} else {
|
||
ctx.lineWidth = 1.0;
|
||
ctx.strokeStyle = "#121318";
|
||
ctx.stroke();
|
||
}
|
||
|
||
if (inEgo && (n.node_type === "TaxonAssemblageBuild" || n.node_type === "AQCoordinateHub" || (selectedNode && egoSet.has(n.id)) || camScale > 1.35)) {
|
||
ctx.fillStyle = "#F3F5FA";
|
||
ctx.font = n.node_type === "TaxonAssemblageBuild" ? "bold 11px sans-serif" : "10px monospace";
|
||
ctx.textAlign = "center";
|
||
ctx.fillText(n.label.slice(0, 32), pos.x, pos.y + r + 12);
|
||
}
|
||
});
|
||
|
||
ctx.globalAlpha = 1.0;
|
||
ctx.restore();
|
||
|
||
document.getElementById("hudStats").textContent =
|
||
`Mode: ${currentMode} | Visible Nodes: ${visNodes}/${DATA.counts.total_nodes} | Visible Edges: ${visEdges}/${DATA.counts.total_edges} | Zoom: ${(camScale*100).toFixed(0)}%` +
|
||
(selectedNode ? ` | Isolated: ${selectedNode.label}` : "");
|
||
}
|
||
|
||
function selectNode(n) {
|
||
selectedNode = n;
|
||
const titleEl = document.getElementById("inspTitle");
|
||
const badgesEl = document.getElementById("inspBadges");
|
||
const bodyEl = document.getElementById("inspBody");
|
||
|
||
if (!n) {
|
||
titleEl.textContent = "Click any node to inspect its Encyclopedia Article";
|
||
badgesEl.innerHTML = "";
|
||
bodyEl.innerHTML = `<div class="kv-box">Select any specimen, philosophical operator, ETI build, or AQ coordinate hub on the canvas (or click one of the 13 Flex Pivot pills on the left) to inspect its bidirectional Base-36 AQ telemetry, verified 333/666/777 equations, and Volume PDF link.</div>`;
|
||
draw();
|
||
return;
|
||
}
|
||
|
||
titleEl.textContent = n.full_term || n.full_title || n.label;
|
||
badgesEl.innerHTML = `<span class="badge" style="color:${n.color}">${n.node_type}</span>` +
|
||
`<span class="badge">Degree: ${n.degree}</span>` +
|
||
(n.isometric ? `<span class="badge" style="color:#F5C630">ISO Δ=0</span>` : "") +
|
||
(n.twin_prime ? `<span class="badge" style="color:#A855F7">TWIN-PRIME</span>` : "") +
|
||
(n.is_flex_pivot ? `<span class="badge" style="color:#00E5FF">13-FLEX PIVOT</span>` : "");
|
||
|
||
let htmlParts = [];
|
||
if (n.node_type === "BilingualLexicalSpecimen") {
|
||
const pe = n.eng_prime_rank ? ` [${n.eng_prime_rank}th PRIME]` : "";
|
||
const pi = n.ing_prime_rank ? ` [${n.ing_prime_rank}th PRIME]` : "";
|
||
htmlParts.push(`<div class="kv-box">
|
||
<strong>Gen 0 Written English:</strong> <code>${n.eng}</code> = <strong>${n.eng_aq}</strong>${pe}<br/>
|
||
<strong>Gen 1 CMUdict Ingglish:</strong> <code>${n.ing}</code> = <strong>${n.ing_aq}</strong>${pi}<br/>
|
||
<strong>Net Phonemic Drift (Δ):</strong> <code>${n.delta >= 0 ? '+' + n.delta : n.delta}</code><br/>
|
||
<strong>Guilds / Classes:</strong> <code>${(n.classes || []).join(", ")}</code>
|
||
</div>`);
|
||
if (n.sample_equations && n.sample_equations.length) {
|
||
htmlParts.push(`<div class="kv-box"><strong>Verified Archive Equations (333/666/777):</strong><ul class="eq-list" style="margin-top:6px;">` +
|
||
n.sample_equations.map(eq => `<li>${eq}</li>`).join("") + `</ul></div>`);
|
||
}
|
||
if (n.volume_pdf_rel) {
|
||
htmlParts.push(`<a class="pdf-link" href="${ENC_BASE}/${n.volume_pdf_rel}" target="_blank">Open Encyclopedia Volume PDF (${n.volume_pdf_rel.split('/').pop()})</a>`);
|
||
}
|
||
} else if (n.node_type === "ConceptualOperatorOrIdiom") {
|
||
htmlParts.push(`<div class="kv-box">
|
||
<strong>Category:</strong> ${n.category}<br/>
|
||
<strong>Gen 0 AQ:</strong> ${n.eng_aq} → <strong>Gen 1 Ingglish:</strong> <code>${n.ing}</code> (${n.ing_aq}, Δ=${n.delta >= 0 ? '+'+n.delta : n.delta})<br/><br/>
|
||
${n.definition}
|
||
</div>`);
|
||
if (n.volume_pdf_rel) {
|
||
htmlParts.push(`<a class="pdf-link" href="${ENC_BASE}/${n.volume_pdf_rel}" target="_blank">Open Encyclopedia Volume PDF</a>`);
|
||
}
|
||
} else if (n.node_type === "TaxonAssemblageBuild") {
|
||
htmlParts.push(`<div class="kv-box">
|
||
<strong>Rank & Tier:</strong> ${n.rank} — Tier ${n.tier_band} (${n.eti_score} ETI)<br/>
|
||
<strong>Roster Slot:</strong> ${n.roster_slot}<br/>
|
||
<strong>Double-Articulated (S×S6):</strong> ${n.double_articulated}<br/>
|
||
<strong>G1 Variance Collapsed:</strong> ${n.gen0_var_collapsed} → 0.0<br/>
|
||
<strong>6-Stat Profile:</strong> <code>${n.stat_bar_text}</code><br/>
|
||
<strong>Primary Locks:</strong><br/>• <code>${n.full_lock1}</code><br/>• <code>${n.full_lock2}</code>
|
||
</div>`);
|
||
} else if (n.node_type === "AQCoordinateHub") {
|
||
htmlParts.push(`<div class="kv-box">
|
||
<strong>Coordinate Value:</strong> AQ = <strong>${n.aq_value}</strong><br/>
|
||
<strong>G1 Variance Collapsed:</strong> ${n.gen0_variance_collapsed} → 0.0<br/>
|
||
<strong>Colliding Gen 1 Members (${n.member_count}):</strong><br/>
|
||
<code>${(n.members_ing || []).join(" == ") || "Macro Repdigit Attractor"}</code>
|
||
</div>`);
|
||
} else if (n.node_type === "EncyclopediaVolume") {
|
||
htmlParts.push(`<div class="kv-box">
|
||
<strong>Division:</strong> <code>${n.div_id}</code><br/>
|
||
<strong>Articles:</strong> ${n.article_count} (${n.page_count} pages)
|
||
</div>`);
|
||
htmlParts.push(`<a class="pdf-link" href="${ENC_BASE}/${n.div_id}/${n.slug}.pdf" target="_blank">Open Volume PDF (${n.slug}.pdf)</a>`);
|
||
} else {
|
||
htmlParts.push(`<div class="kv-box"><strong>Scope:</strong> ${n.description || ""}</div>`);
|
||
}
|
||
|
||
const neighbors = [];
|
||
DATA.edges.forEach(e => {
|
||
if (!activeEdgeRels.has(e.relation) || e.source === e.target) return;
|
||
if (e.source === n.id && nodeMap[e.target]) neighbors.push({node: nodeMap[e.target], rel: e.relation, lbl: e.label});
|
||
else if (e.target === n.id && nodeMap[e.source]) neighbors.push({node: nodeMap[e.source], rel: e.relation, lbl: e.label});
|
||
});
|
||
if (neighbors.length) {
|
||
htmlParts.push(`<div class="kv-box"><strong>Connected Neighbors (${neighbors.length}):</strong><div class="neighbor-list" style="margin-top:6px;" id="nbrList"></div></div>`);
|
||
}
|
||
bodyEl.innerHTML = htmlParts.join("");
|
||
|
||
if (neighbors.length) {
|
||
const nl = document.getElementById("nbrList");
|
||
neighbors.slice(0, 40).forEach(item => {
|
||
const row = document.createElement("div");
|
||
row.className = "neighbor-item";
|
||
row.innerHTML = `<span style="color:${item.node.color};font-weight:600;">${item.node.label.slice(0, 26)}</span> <span style="font-family:monospace;font-size:10px;color:#9BA3B8;">${item.rel}</span>`;
|
||
row.addEventListener("click", () => {
|
||
selectNode(item.node);
|
||
centerOnNode(item.node);
|
||
});
|
||
nl.appendChild(row);
|
||
});
|
||
}
|
||
draw();
|
||
}
|
||
|
||
function screenToWorld(sx, sy) {
|
||
return { x: (sx - camX) / camScale, y: (sy - camY) / camScale };
|
||
}
|
||
|
||
function findNodeAt(wx, wy) {
|
||
for (let i = DATA.nodes.length - 1; i >= 0; i--) {
|
||
const n = DATA.nodes[i];
|
||
if (!nodePassesFilter(n)) continue;
|
||
const pos = n.layouts[currentMode];
|
||
const r = Math.max(6, n.size * 0.42);
|
||
const dx = wx - pos.x, dy = wy - pos.y;
|
||
if (dx * dx + dy * dy <= r * r) return n;
|
||
}
|
||
return null;
|
||
}
|
||
|
||
canvas.addEventListener("mousedown", e => {
|
||
const rect = canvas.getBoundingClientRect();
|
||
const wpt = screenToWorld(e.clientX - rect.left, e.clientY - rect.top);
|
||
const hit = findNodeAt(wpt.x, wpt.y);
|
||
if (hit) {
|
||
selectNode(hit);
|
||
} else {
|
||
isDragging = true;
|
||
dragStartX = e.clientX - camX;
|
||
dragStartY = e.clientY - camY;
|
||
}
|
||
});
|
||
|
||
window.addEventListener("mousemove", e => {
|
||
if (isDragging) {
|
||
camX = e.clientX - dragStartX;
|
||
camY = e.clientY - dragStartY;
|
||
draw();
|
||
}
|
||
});
|
||
|
||
window.addEventListener("mouseup", () => { isDragging = false; });
|
||
|
||
canvas.addEventListener("dblclick", e => {
|
||
const rect = canvas.getBoundingClientRect();
|
||
const wpt = screenToWorld(e.clientX - rect.left, e.clientY - rect.top);
|
||
const hit = findNodeAt(wpt.x, wpt.y);
|
||
if (!hit) selectNode(null);
|
||
});
|
||
|
||
canvas.addEventListener("wheel", e => {
|
||
e.preventDefault();
|
||
const rect = canvas.getBoundingClientRect();
|
||
const mx = e.clientX - rect.left;
|
||
const my = e.clientY - rect.top;
|
||
const factor = e.deltaY < 0 ? 1.12 : 0.89;
|
||
const newScale = Math.max(0.25, Math.min(4.5, camScale * factor));
|
||
camX = mx - (mx - camX) * (newScale / camScale);
|
||
camY = my - (my - camY) * (newScale / camScale);
|
||
camScale = newScale;
|
||
draw();
|
||
}, { passive: false });
|
||
|
||
document.querySelectorAll("[data-mode]").forEach(btn => {
|
||
btn.addEventListener("click", () => {
|
||
document.querySelectorAll("[data-mode]").forEach(b => b.classList.remove("active"));
|
||
btn.classList.add("active");
|
||
currentMode = btn.getAttribute("data-mode");
|
||
resetCamera();
|
||
});
|
||
});
|
||
|
||
document.getElementById("searchInput").addEventListener("input", e => {
|
||
searchQuery = e.target.value.trim();
|
||
draw();
|
||
});
|
||
|
||
document.getElementById("flagFilter").addEventListener("change", e => {
|
||
activeFlag = e.target.value;
|
||
draw();
|
||
});
|
||
|
||
document.getElementById("resetViewBtn").addEventListener("click", () => {
|
||
selectedNode = null;
|
||
searchQuery = "";
|
||
activeFlag = "all";
|
||
document.getElementById("searchInput").value = "";
|
||
document.getElementById("flagFilter").value = "all";
|
||
selectNode(null);
|
||
resetCamera();
|
||
});
|
||
|
||
document.getElementById("exportPngBtn").addEventListener("click", () => {
|
||
const a = document.createElement("a");
|
||
a.download = `encyclopedia-knowledge-graph-${currentMode}.png`;
|
||
a.href = canvas.toDataURL("image/png");
|
||
a.click();
|
||
});
|
||
|
||
window.addEventListener("resize", resizeCanvas);
|
||
resizeCanvas();
|
||
|
||
// Deep-link query parameter support (?select=aq:137&mode=mode2_radar)
|
||
const urlParams = new URLSearchParams(window.location.search || "");
|
||
const reqMode = urlParams.get("mode");
|
||
if (reqMode && ["mode1_trophic", "mode2_radar", "mode3_bipartite"].includes(reqMode)) {
|
||
currentMode = reqMode;
|
||
document.querySelectorAll("[data-mode]").forEach(b => {
|
||
b.classList.toggle("active", b.getAttribute("data-mode") === reqMode);
|
||
});
|
||
}
|
||
const reqSelect = (urlParams.get("select") || "").trim();
|
||
let initialNode = nodeMap["build:S1"] || DATA.nodes[0];
|
||
if (reqSelect) {
|
||
const selLow = reqSelect.toLowerCase();
|
||
const selCoord = selLow.replace(/^aq:/, "");
|
||
const matchedNode = nodeMap[reqSelect] || DATA.nodes.find(n =>
|
||
String(n.id).toLowerCase() === selLow ||
|
||
String(n.ing_aq || "") === selCoord ||
|
||
String(n.aq_value || "") === selCoord ||
|
||
String(n.label || "").toLowerCase().includes(selLow)
|
||
);
|
||
if (matchedNode) {
|
||
initialNode = matchedNode;
|
||
}
|
||
}
|
||
selectNode(initialNode);
|
||
if (reqSelect && initialNode) {
|
||
centerOnNode(initialNode);
|
||
}
|
||
})();
|
||
</script>
|
||
</body>
|
||
</html>
|