In this section
- Earth render · globalgrid2050 / marketing/earth.html lines 1–340
- Showcase render · globalgrid2050 / marketing/showcase.html lines 1–119
- Federated Relationships render · globalgrid2050 / pipelinenews_intelligence/202608311343/assets/202608282200-federated-relationships.mjs lines 1–91
Earth
A web page in the marketing folder of GlobalGrid2050. Published at https://globalgrid2050.com/marketing/earth.html.
renderglobalgrid2050 / marketing/earth.html · lines 1–340 of 340 · Entry point · pattern animate (shared by 7 files)
- What it does
- It draws its content. Defines handleTextureLoad, handleTexError, initSystem, animate. Uses libraries three, three/addons/controls/OrbitControls.js. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage upstream_foresight (topic 'markets-data'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
- Inputs & outputs
- Out: web page; WebGL/WebGPU drawing.
- Downstream impact
- It is itself an entry point, published at https://globalgrid2050.com/marketing/earth.html.
- What it achieves
- It is built from the handle texture load helper (`handleTextureLoad`), the handle tex error helper (`handleTexError`) and the init system helper (`initSystem`). Defines `handleTextureLoad`, `handleTexError`, `initSystem` and 1 more. It responds to click, start and resize events.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- globalgrid2050 · marketing · page
- Uses
- three, three/addons/controls/OrbitControls.js, https://unpkg.com/three@0.160.0/build/three.module.js, https://unpkg.com/three@0.160.0/examples/jsm/
- Used by
- none found
- Produces
- handleTextureLoad, handleTexError, initSystem, animate
- Defines here
- handleTextureLoad, handleTexError, initSystem, animate
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 marketing/earth.html:1-340 · blob 6b873ea3f88b05408b6e58d73b27bc57cfe51f76 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>VENTUS | SYSTEM INTERFACE</title>
<style>
body { margin: 0; background: #000; overflow: hidden; font-family: 'Courier New', Courier, monospace; }
/* View Panel */
.view-panel {
position: absolute; top: 0; left: 0; width: 100vw; height: 100vh;
opacity: 1; pointer-events: auto; z-index: 1;
}
/* Instrument-Grade HUD */
.hud {
position: absolute; bottom: 40px; left: 20px; color: #00ffff; pointer-events: none;
text-shadow: 0 0 6px rgba(0, 255, 255, 0.5); border-left: 3px solid #00ffff; padding-left: 15px; z-index: 10;
}
.label { font-size: 18px; font-weight: bold; letter-spacing: 2px; line-height: 1.5; }
.meta { font-size: 9px; opacity: 0.5; margin-top: 10px; line-height: 1.4; transition: color 0.2s; }
/* Clickable Override Alert */
.status-alert { color: #ffae00; font-weight: bold; opacity: 0.8; pointer-events: auto; cursor: pointer; }
.status-alert:hover { opacity: 1; text-decoration: underline; }
.status-alert::after { content: " ↩ RESUME"; font-size: 8px; opacity: 0.7; }
/* Data Credits / Sourcing (Enlarged) */
.credits {
position: absolute; bottom: 25px; right: 25px; color: #fff; opacity: 0.7;
font-size: 11px; letter-spacing: 1px; text-align: right; z-index: 10;
pointer-events: none; text-transform: uppercase; line-height: 1.6;
}
/* Pulsing Loader */
#loader {
position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
color: #00ffff; font-size: 12px; letter-spacing: 2px; z-index: 20;
transition: opacity 0.5s; animation: pulse 1.2s infinite;
}
@keyframes pulse { 0% { opacity: 0.3; } 50% { opacity: 1; } 100% { opacity: 0.3; } }
</style>
</head>
<body>
<div id="loader">INITIALIZING SYSTEM...</div>
<div id="globe-view" class="view-panel"></div>
<div class="hud">
<div class="label" id="timeDisplay"></div>
<div class="meta" id="interactionState">[AUTO ROTATION ACTIVE]</div>
<div class="meta" id="metaDisplay">
ENGINE: THREE.JS (SYSTEM GLOBE)<br>
IMAGERY: PBR SATELLITE + EMISSIVE NIGHT<br>
DYNAMICS: UTC SYNCHRONIZED ROTATION
</div>
</div>
<div class="credits">
<strong>DATA & IMAGERY SOURCES</strong><br>
SATELLITE & TOPOLOGY: NASA / VISIBLE EARTH<br>
TEXTURE CURATION: THREE-GLOBE<br>
RENDERING ENGINE: THREE.JS WebGL
</div>
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/"
}
}
</script>
<script type="module">
import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
// ── SYSTEM STATE ────────────────────────────────────────────────────────────
const State = {
rotating: true,
targetDate: new Date('2050-01-01T00:00:00Z').getTime(),
currentTime: new Date(),
enginesReady: { three: false }
};
// ── TIME MODULE ─────────────────────────────────────────────────────────────
const TimeModule = {
init() {
this.displayEl = document.getElementById('timeDisplay');
this.monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
this.tick();
setInterval(() => this.tick(), 1000);
},
tick() {
State.currentTime = new Date();
const now = State.currentTime;
const year = now.getUTCFullYear();
const month = this.monthNames[now.getUTCMonth()];
const date = now.getUTCDate();
const h = String(now.getUTCHours()).padStart(2, '0');
const m = String(now.getUTCMinutes()).padStart(2, '0');
const s = String(now.getUTCSeconds()).padStart(2, '0');
const currentStr = `${date} ${month} ${year} ${h}:${m}:${s} UTC`;
const distance = State.targetDate - now.getTime();
if (distance < 0) {
this.displayEl.innerHTML = `${currentStr}<br>TARGET 2050 REACHED`;
return;
}
const days = Math.floor(distance / (1000 * 60 * 60 * 24));
const hours = String(Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))).padStart(2, '0');
const mins = String(Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60))).padStart(2, '0');
const secs = String(Math.floor((distance % (1000 * 60)) / 1000)).padStart(2, '0');
this.displayEl.innerHTML = `${currentStr}<br>${days} days, ${hours}:${mins}:${secs} to 2050!`;
}
};
// ── UI CONTROLLER ───────────────────────────────────────────────────────────
const UI = {
init() {
this.interactionState = document.getElementById('interactionState');
this.loaderEl = document.getElementById('loader');
// Allow user to resume rotation after manual override
this.interactionState.addEventListener('click', () => {
if (!State.rotating) this.setRotation(true);
});
this.render();
},
setRotation(isRotating) {
State.rotating = isRotating;
this.render();
},
checkReadiness() {
if (State.enginesReady.three) {
this.loaderEl.style.opacity = '0';
setTimeout(() => { if (this.loaderEl.style.opacity === '0') this.loaderEl.style.display = 'none'; }, 500);
}
},
render() {
this.interactionState.innerText = State.rotating ? '[AUTO ROTATION ACTIVE]' : '[MANUAL OVERRIDE]';
this.interactionState.className = State.rotating ? 'meta' : 'meta status-alert';
}
};
// ── THREE.JS ENGINE ─────────────────────────────────────────────────────────
const ThreeEngine = {
scene: null, camera: null, renderer: null, earth: null, controls: null, stars: null, sunLight: null,
clock: new THREE.Clock(),
init() {
const container = document.getElementById('globe-view');
this.scene = new THREE.Scene();
this.camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 1000);
this.camera.position.z = window.innerHeight > window.innerWidth ? 30 : 20;
this.renderer = new THREE.WebGLRenderer({ antialias: true, powerPreference: "high-performance", alpha: true });
this.renderer.setSize(window.innerWidth, window.innerHeight);
this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
container.appendChild(this.renderer.domElement);
this.buildStarfield();
const earthGroup = new THREE.Group();
earthGroup.rotation.z = 23.5 * (Math.PI / 180);
this.scene.add(earthGroup);
const texLoader = new THREE.TextureLoader();
this.earthGeometry = new THREE.SphereGeometry(5, 64, 64);
let texturesLoaded = 0;
const requiredTextures = 3;
const handleTextureLoad = () => {
texturesLoaded++;
if (texturesLoaded >= requiredTextures) {
State.enginesReady.three = true;
UI.checkReadiness();
}
};
const handleTexError = () => {
this.earthMaterial.color = new THREE.Color(0x0a1a2a);
texturesLoaded++; // Prevent loader hanging if CDN fails
if (texturesLoaded >= requiredTextures) {
State.enginesReady.three = true;
UI.checkReadiness();
}
};
// PBR Material with Night Emissive Glow
this.earthMaterial = new THREE.MeshStandardMaterial({
map: texLoader.load('https://unpkg.com/three-globe/example/img/earth-blue-marble.jpg', handleTextureLoad, undefined, handleTexError),
bumpMap: texLoader.load('https://unpkg.com/three-globe/example/img/earth-topology.png', handleTextureLoad, undefined, handleTexError),
emissiveMap: texLoader.load('https://unpkg.com/three-globe/example/img/earth-night.jpg', handleTextureLoad, undefined, handleTexError),
emissive: new THREE.Color(0xffffff),
emissiveIntensity: 0.8,
bumpScale: 0.1,
roughness: 1.0,
metalness: 0.0
});
this.earth = new THREE.Mesh(this.earthGeometry, this.earthMaterial);
earthGroup.add(this.earth);
// Subtle Atmospheric Rim
const atmosphereGeometry = new THREE.SphereGeometry(5.05, 64, 64);
const atmosphereMaterial = new THREE.MeshBasicMaterial({
color: 0x00ffff,
transparent: true,
opacity: 0.05
});
const atmosphere = new THREE.Mesh(atmosphereGeometry, atmosphereMaterial);
earthGroup.add(atmosphere);
this.scene.add(new THREE.AmbientLight(0xffffff, 0.02));
this.sunLight = new THREE.DirectionalLight(0xffffff, 2.5);
this.scene.add(this.sunLight);
this.controls = new OrbitControls(this.camera, this.renderer.domElement);
this.controls.enableDamping = true;
this.controls.dampingFactor = 0.05;
this.controls.minDistance = 5.2;
this.controls.maxDistance = 150;
this.controls.enablePan = false;
// Camera Inertia
this.controls.rotateSpeed = 0.4;
this.controls.zoomSpeed = 0.6;
this.controls.addEventListener('start', () => { if(State.rotating) UI.setRotation(false); });
window.addEventListener('resize', () => this.onWindowResize());
window.addEventListener('beforeunload', () => this.dispose());
},
buildStarfield() {
const starsGeometry = new THREE.BufferGeometry();
const starsMaterial = new THREE.PointsMaterial({ color: 0xFFFFFF, size: 0.05, opacity: 0.8, transparent: true });
const starVertices = [];
const radius = 300;
// True spherical distribution
for(let i = 0; i < 3000; i++) {
const theta = Math.random() * Math.PI * 2;
const phi = Math.acos((Math.random() * 2) - 1);
const x = radius * Math.sin(phi) * Math.cos(theta);
const y = radius * Math.sin(phi) * Math.sin(theta);
const z = radius * Math.cos(phi);
starVertices.push(x, y, z);
}
starsGeometry.setAttribute('position', new THREE.Float32BufferAttribute(starVertices, 3));
this.stars = new THREE.Points(starsGeometry, starsMaterial);
this.scene.add(this.stars);
},
update() {
const delta = this.clock.getDelta();
// Dynamic Sun locked to UTC
const now = State.currentTime;
const t = (now.getUTCHours() + now.getUTCMinutes() / 60 + now.getUTCSeconds() / 3600) / 24;
this.sunLight.position.set(
Math.cos(t * Math.PI * 2) * 20,
0,
Math.sin(t * Math.PI * 2) * 20
);
if (State.rotating && this.earth) {
const rotationSpeed = (Math.PI * 2) / 86400 * 1000;
this.earth.rotation.y += rotationSpeed * delta;
}
this.controls.update();
// Subtle cinematic camera drift when idle
if (State.rotating) {
this.camera.position.x += Math.sin(performance.now() * 0.0001) * 0.002;
}
this.renderer.render(this.scene, this.camera);
},
onWindowResize() {
this.camera.aspect = window.innerWidth / window.innerHeight;
this.camera.updateProjectionMatrix();
this.renderer.setSize(window.innerWidth, window.innerHeight);
},
dispose() {
if (this.controls) this.controls.dispose();
if (this.renderer) {
this.renderer.dispose();
if (this.renderer.domElement && this.renderer.domElement.parentNode) {
this.renderer.domElement.parentNode.removeChild(this.renderer.domElement);
}
}
if (this.earthGeometry) this.earthGeometry.dispose();
if (this.earthMaterial) {
this.earthMaterial.dispose();
if (this.earthMaterial.map) this.earthMaterial.map.dispose();
if (this.earthMaterial.bumpMap) this.earthMaterial.bumpMap.dispose();
if (this.earthMaterial.emissiveMap) this.earthMaterial.emissiveMap.dispose();
}
if (this.stars) {
this.stars.geometry.dispose();
this.stars.material.dispose();
}
}
};
// ── BOOT SEQUENCE ───────────────────────────────────────────────────────────
function initSystem() {
TimeModule.init();
UI.init();
ThreeEngine.init();
function animate() {
requestAnimationFrame(animate);
ThreeEngine.update();
}
animate();
}
initSystem();
</script>
</body>
</html>Showcase
A map page in the marketing folder of GlobalGrid2050 that maps grid 400kV, grid 275kV, grid 132kV and grid 66kV. Published at https://globalgrid2050.com/marketing/showcase.html.
renderglobalgrid2050 / marketing/showcase.html · lines 1–119 of 119 · Entry point
- What it does
- It maps grid 400kV, grid 275kV, grid 132kV and grid 66kV. Defines rotateGlobe. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage upstream_foresight (topic 'markets-data'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: 66kV.
- Inputs & outputs
- Out: web page; interactive map. Voltage levels named: 66kV.
- Downstream impact
- It is itself an entry point, published at https://globalgrid2050.com/marketing/showcase.html.
- What it achieves
- It is built from the rotate globe helper (`rotateGlobe`). Defines `rotateGlobe`. Its code works with 66 kV. It responds to click events.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- globalgrid2050 · marketing · page
- Uses
- https://unpkg.com/maplibre-gl@^3.0.0/dist/maplibre-gl.js, https://unpkg.com/maplibre-gl@^3.0.0/dist/maplibre-gl.css
- Used by
- none found
- Produces
- rotateGlobe
- Defines here
- rotateGlobe
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 marketing/showcase.html:1-119 · blob cbf1bc45ae09920f64c4c6bf3cbac4d8a216bcbf · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>VENTUS | Global 3D Showcase</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="https://unpkg.com/maplibre-gl@^3.0.0/dist/maplibre-gl.js"></script>
<link href="https://unpkg.com/maplibre-gl@^3.0.0/dist/maplibre-gl.css" rel="stylesheet" />
<style>
body { margin: 0; padding: 0; background: #000; overflow: hidden; }
#map { position: absolute; top: 0; bottom: 0; width: 100%; }
.showcase-overlay {
position: absolute; top: 20px; left: 20px; pointer-events: none;
color: #fff; font-family: sans-serif; text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}
.main-logo { font-size: 24px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; }
.sub-logo { font-size: 11px; opacity: 0.7; letter-spacing: 1px; }
#toggle-rotation {
position: absolute; bottom: 20px; right: 20px;
background: rgba(255, 255, 255, 0.05); color: rgba(255, 255, 255, 0.7);
border: 1px solid rgba(255, 255, 255, 0.2); padding: 8px 12px;
cursor: pointer; font-size: 10px; text-transform: uppercase; border-radius: 4px;
}
</style>
</head>
<body>
<div id="map"></div>
<div class="showcase-overlay">
<div class="main-logo">Ventus</div>
<div class="sub-logo">Cables & Connectivity®<br>GLOBAL INFRASTRUCTURE UNIFICATION 2050</div>
</div>
<button id="toggle-rotation">⏸ PAUSE SPIN</button>
<script>
const ROTATION_SPEED = 4;
let isUserInteracting = false;
let spinEnabled = true;
const map = new maplibregl.Map({
container: 'map',
style: {
version: 8,
sources: {
'carto-dark': {
type: 'raster',
tiles: ['https://basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}.png'],
tileSize: 256
}
},
layers: [{ id: 'background', type: 'raster', source: 'carto-dark' }]
},
center: [-3.5, 54.5], // Center on UK heart
zoom: 3.5,
projection: 'globe',
attributionControl: false
});
function rotateGlobe() {
if (spinEnabled && !isUserInteracting && map.getZoom() < 5) {
let center = map.getCenter();
center.lng += ROTATION_SPEED;
map.easeTo({ center, duration: 1000, easing: (n) => n });
}
}
map.on('load', () => {
// --- 1. THE UK HV GRID (66kV and Above) ---
const gridLayers = [
{ id: 'grid-400', url: '../grid_400kv.geojson', color: '#ff9d00', width: 2 },
{ id: 'grid-275', url: '../grid_275kv.geojson', color: '#ff9d00', width: 1.5 },
{ id: 'grid-132', url: '../grid_132kv.geojson', color: '#ff9d00', width: 1 },
{ id: 'grid-66', url: '../grid_66kv.geojson', color: '#ff9d00', width: 0.8 }
];
gridLayers.forEach(layer => {
map.addSource(layer.id, { type: 'geojson', data: layer.url });
map.addLayer({
id: layer.id, type: 'line', source: layer.id,
paint: { 'line-color': layer.color, 'line-width': layer.width, 'line-opacity': 0.8 }
});
});
// --- 2. GLOBAL SUBSEA FIBRE (The Ground Truth) ---
map.addSource('subsea-live', { type: 'geojson', data: '../subsea_data_cables.geojson' });
map.addLayer({
id: 'subsea-live-layer', type: 'line', source: 'subsea-live',
paint: { 'line-color': '#00ffff', 'line-width': 1.2, 'line-opacity': 0.6 }
});
// --- 3. DEEP SUBSEA ILLUSTRATIVE (Dashed Cyan) ---
map.addSource('deep-subsea', { type: 'geojson', data: '../deep_subsea_illustrative.geojson' });
map.addLayer({
id: 'deep-subsea-layer', type: 'line', source: 'deep-subsea',
paint: { 'line-color': '#00ffff', 'line-width': 1.5, 'line-dasharray': [2, 2] }
});
// --- 4. UNIFICATION ESTIMATES (The Global Macro-Web) ---
map.addSource('unification', { type: 'geojson', data: '../unification_deep_subsea_estimates.geojson' });
map.addLayer({
id: 'unification-layer', type: 'line', source: 'unification',
paint: { 'line-color': '#b200ff', 'line-width': 2, 'line-dasharray': [4, 4] }
});
map.on('moveend', rotateGlobe);
rotateGlobe();
});
map.on('mousedown', () => isUserInteracting = true);
map.on('mouseup', () => isUserInteracting = false);
const toggleBtn = document.getElementById('toggle-rotation');
toggleBtn.addEventListener('click', () => {
spinEnabled = !spinEnabled;
toggleBtn.innerText = spinEnabled ? "⏸ PAUSE SPIN" : "▶ START SPIN";
if (spinEnabled) rotateGlobe();
});
</script>
</body>
</html>Federated Relationships
A JavaScript module in the assets folder of GlobalGrid2050 that fetches verified projection (`fetchVerifiedProjection`), using SHA-256.
renderglobalgrid2050 / pipelinenews_intelligence/202608311343/assets/202608282200-federated-relationships.mjs · lines 1–91 of 91 · version 2026-08-28 22:00 · Not reached from any entry point (candidate for review) · pattern mountFederatedRelationships (shared by 2 files)
- What it does
- It draws its content. Defines invariant, bytesToHex, fetchVerifiedProjection, render, mountFederatedRelationships. Side effects: changes the web page (DOM); makes network requests.
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'pipelinenews'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
- What it achieves
- It fetches verified projection (`fetchVerifiedProjection`) and is built from the bytes to hex helper (`bytesToHex`) and the render step (`render`). Defines `invariant`, `bytesToHex`, `fetchVerifiedProjection` and 2 more.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · pipelinenews_intelligence/202608311343/assets · JavaScript module
- Uses
- none found
- Used by
- mentioned in Standalone (comment link)
- Produces
- FEDERATED_RELATIONSHIP_CARTRIDGE_CONTRACT, mountFederatedRelationships
- Defines here
- invariant, bytesToHex, fetchVerifiedProjection, render, mountFederatedRelationships
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 pipelinenews_intelligence/202608311343/assets/202608282200-federated-relationships.mjs:1-91 · blob b6d6db56bf61afb519cdb7f62a582277d9e4d9ac · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, network · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
const GENERATION = "202608282200";
export const FEDERATED_RELATIONSHIP_CARTRIDGE_CONTRACT = Object.freeze({
schema: "pipelinenews.federated-relationship-cartridge.v1",
generation: GENERATION,
activation: "dynamic-import-on-user-open; projection-fetch-after-explicit-open",
maximumPayloadRequests: 1,
expectedRows: 3,
projectBindings: 0,
});
function invariant(condition, message) {
if (!condition) throw new Error(message);
}
function bytesToHex(bytes) {
return [...bytes].map((value) => value.toString(16).padStart(2, "0")).join("");
}
async function fetchVerifiedProjection(asset) {
invariant(asset && typeof asset.url === "string", "relationship payload URL missing");
invariant(Number.isInteger(asset.bytes) && asset.bytes > 0, "relationship payload byte pin missing");
invariant(/^[a-f0-9]{64}$/u.test(asset.sha256), "relationship payload digest pin missing");
const target = new URL(asset.url, document.baseURI);
invariant(target.origin === location.origin, "cross-origin relationship payload rejected");
const response = await fetch(target, { cache: "force-cache" });
invariant(response.ok, `relationship payload returned HTTP ${response.status}`);
const raw = new Uint8Array(await response.arrayBuffer());
invariant(raw.byteLength === asset.bytes, "relationship payload byte drift");
invariant(globalThis.crypto?.subtle, "Web Crypto unavailable");
const digest = bytesToHex(new Uint8Array(await crypto.subtle.digest("SHA-256", raw)));
invariant(digest === asset.sha256, "relationship payload digest drift");
return JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(raw));
}
function render(host, projection) {
invariant(projection.schema === "pipelinenews.federated-relationship-status-browser.v1", "relationship schema changed");
invariant(projection.generation === GENERATION, "relationship generation changed");
invariant(projection.heading === "RELATIONSHIP EVIDENCE — CANDIDATES AND ABSTENTIONS", "safe heading changed");
invariant(projection.project_bindings === 0, "project binding entered projection");
invariant(projection.confirmed_ownership_rows === 0 && projection.confirmed_operator_rows === 0, "confirmed role entered projection");
invariant(Array.isArray(projection.rows) && projection.rows.length === 3, "relationship row count changed");
invariant(projection.rows.every((row) => row.decision === "ABSTAIN" && row.eligible_for_join === false), "abstention law changed");
const heading = document.createElement("h3");
heading.textContent = projection.heading;
const notice = document.createElement("p");
notice.textContent = "Governance status only. Candidate counts are not ownership, operator, developer or project-identity facts.";
const table = document.createElement("table");
table.className = "projects-table";
const thead = document.createElement("thead");
const header = document.createElement("tr");
for (const label of ["FAMILY", "SEGMENT", "CANDIDATE ROWS", "REQUESTED ROLE", "DECISION", "JOIN", "CAVEAT"]) {
const cell = document.createElement("th");
cell.scope = "col";
cell.textContent = label;
header.append(cell);
}
thead.append(header);
const tbody = document.createElement("tbody");
for (const row of projection.rows) {
const tr = document.createElement("tr");
const values = [
row.relationship_family,
row.segment,
Number(row.candidate_rows).toLocaleString("en-GB"),
row.requested_role,
row.decision,
row.eligible_for_join ? "ELIGIBLE" : "NO",
row.caveat,
];
for (const value of values) {
const td = document.createElement("td");
td.textContent = String(value);
tr.append(td);
}
tbody.append(tr);
}
table.append(thead, tbody);
host.replaceChildren(heading, notice, table);
host.dataset.federatedRelationshipState = "ready";
}
export async function mountFederatedRelationships({ host, payloadAsset }) {
invariant(host instanceof HTMLElement, "relationship host missing");
invariant(!host.dataset.federatedRelationshipMounted, "relationship cartridge mounted twice");
host.dataset.federatedRelationshipMounted = "true";
const projection = await fetchVerifiedProjection(payloadAsset);
render(host, projection);
return Object.freeze({ payloadRequests: 1, rows: projection.rows.length, projectBindings: 0 });
}