import {evaluateLab,labScene,labMetricHTML,labChart,focusedModes} from './experience-labs.js?v=20261008'; import {makeDataset,distance,nearest,softmax,quantizationMSE,poincareDistance,decay,hybridRank,permitted,compact,exactMinCut,cutEdges,typedDecision} from './capability-math.js?v=20261007-16'; const root=document.getElementById('rv-capability-lab'); const E=(id,title,group,kind,path,headline,body,boundary)=>({id,title,group,kind,path,headline,body,boundary}); const exhibits=[ E('contrast','Contrastive geometry','LEARN','illustration','ruvector-typesafe-train','Related signals converge. Unrelated signals separate.','Colored examples move toward distinct class centers. Adjust separation to see overlap become structure. Useful for understanding representations before designing a labeled training trial.','Synthetic interpolation, not encoder training or an InfoNCE optimization.'), E('retrieval','Vector retrieval','RECALL','local math','ruvector-core','One query. A universe of possible context.','Every query computes all 360 Euclidean distances and highlights its ten closest synthetic vectors. Compare this exact baseline with the native WASM HNSW engine below.','Exact JavaScript on synthetic 3D coordinates. Separate from the RuVector WASM benchmark.'), E('attention','Attention mechanisms','REASON','local math','ruvector-attention','A field of information. A focused distribution.','Stable softmax converts query similarity into attention weights. Temperature controls concentration. RuVector has separate standard, sparse, geometric and graph attention implementations.','Local softmax example. No RuVector attention crate is loaded by this exhibit.'), E('hyperbolic','Hyperbolic search','RECALL','local math','ruvector-hyperbolic-hnsw','Room for an exponentially branching hierarchy.','A radial taxonomy lives inside the Poincaré disk. Its displayed distance uses the hyperbolic metric, where points near the boundary are far apart. The lines visualize hierarchy.','Local Poincaré distance calculation. The hierarchy is synthetic; this is not hyperbolic HNSW execution.'), E('graph','Graph propagation','REASON','illustration','ruvector-gnn','Context travels through relationships.','Animated messages traverse neighborhood links. Graph neural networks aggregate neighbor representations; the dedicated reranking surface can reorder retrieval candidates.','Illustrative message flow. No GNN weights or graph model are trained here.'), E('mincut','Dynamic graph cuts','REASON','local math','ruvector-mincut','Find the narrow bridge between connected systems.','An eight-node weighted graph separates into two communities. Exhaustive enumeration finds its exact minimum cut; the cut edges glow coral. This makes structural bottlenecks visible.','Exact small-graph enumeration in JavaScript. Not the dynamic RuVector min-cut algorithm.'), E('hybrid','Hybrid retrieval','RECALL','local math','ruvector-graph','Combine similarity with a second signal.','Blend inverse Euclidean distance and a synthetic lexical score. The mixing parameter changes which candidates appear first. A real deployment needs calibrated scores and source-aware relevance checks.','Actual weighted synthetic ranking. No text tokenization or production hybrid adapter.'), E('memory','Trajectory memory','LEARN','local math','ruvector-agent-memory','A past query becomes a reusable starting point.','New queries retain their coordinate and nearest results in an in-page history. Amber echoes show retained trajectories. Reuse earlier answers to understand memory-assisted entry points.','In-page fixture history, capped at 32. Not SONA or ReasoningBank execution.'), E('sona','SONA adaptation','LEARN','illustration','sona','Feedback enters. A bounded learning proposal emerges.','Follow trajectory, reward, MicroLoRA, consolidation and evaluation. SONA exposes feedback-driven adaptation; recorded outcomes are the learning trigger, not a read alone.','Architecture animation only. No adapter weights change and no quality gain is claimed.'), E('temporal','Temporal recall','RECALL','local math','ruvector-temporal-coherence','Memory fades at a rate you can control.','Age applies an exponential recency weight. The half-life slider changes which memories remain bright. Temporal relevance requires domain validation; recent does not always mean useful.','Local exponential decay over synthetic ages. Not the temporal-coherence graph engine.'), E('compact','Memory compaction','LEARN','local math','ruvector-agent-memory','Capacity has a cost. Retain with intent.','Adjust the memory budget and switch between least recently used and least frequently used retention. Select a memory to inspect its age, access count and retention reason. The top 10 overlap measures which original answers survive.','Actual fixture sorting. No persistent memories are deleted; default core compaction integration is separate.'), E('compress','Quantization','DEPLOY','local math','ruvector-pq-search','Less precision. A smaller coordinate payload.','Scalar rounding converts original synthetic coordinates into discrete levels. Change bit depth to see the lattice and actual reconstruction error. Production PQ and RaBitQ use their own encodings.','Local scalar rounding, not product quantization. Payload excludes index and metadata overhead.'), E('route','Typed decisions','REASON','local math','ruvector-router-core','Route when confident. Abstain when uncertain.','Nearest-centroid scores become normalized probabilities. An adjustable confidence threshold produces either a synthetic route or an explicit abstention. Use the separate typesafe package for text decisions.','Synthetic centroid fixture. Not a trained router or the @ruvector/typesafe encoder.'), E('access','Capability masks','DEPLOY','local math','ruvector-capgated','Retrieval crosses an explicit permission boundary.','Four colored namespaces carry independent access bits. Toggle the allowed classes; only permitted vectors compete for nearest-neighbor results. Evaluate authorization and leakage independently.','Local bitmask prefilter demo. Not an application identity boundary or the research ANN implementation.'), E('rvf','RVF cognitive artifacts','DEPLOY','illustration','rvf','Vectors. Models. Graphs. One portable artifact.','An exploded container exposes vectors, metadata, graph, overlays, index and witness layers. Select a layer to inspect its role. Artifact witnesses provide tamper evidence, not encryption.','Architecture illustration. No RVF file is constructed, signed, verified or booted here.'), E('federation','Shared memory primitives','DEPLOY','illustration','ruvector-replication','Independent agents. Visible lineage. Shared context.','Packet trails connect local memory islands. Replication primitives, vector clocks and shared memory are separate building blocks with explicit trust and data boundaries.','Simulated packet motion. No remote traffic; replication and Raft are not a complete production network plane.')]; const crateURL=e=>'https://github.com/ruvnet/RuVector/tree/main/crates/'+e.path; const C=['#7ef0cf','#7ba5ff','#ff966a','#c899ff']; root.innerHTML=`
RUVECTOR / INTELLIGENCE OBSERVATORY

A universe that remembers.
A geometry that learns.

Sixteen exhibits across recall, reasoning, learning and deployment. Explore the mechanism, inspect its evidence, then open the implementation.

16 CAPABILITIES · SVG THEATREOpen measured WASM search ↓
${['ALL','RECALL','REASON','LEARN','DEPLOY'].map(g=>``).join('')}
${exhibits.map((e,i)=>``).join('')}
SVG / SYNTHETIC DATA
CHAPTER 01 / 16
${C.map((c,i)=>``).join('')}

Open implementation ↗
${exhibits.map((e,i)=>``).join('')}
`; const $=id=>document.getElementById('rvcl-'+id),points=makeDataset(); let mode='contrast',view='canopy',replay=1,selectedLayer=0,phase=0,paused=matchMedia('(prefers-reduced-motion:reduce)').matches,visible=false,strength=.7,bits=8,policy='lru',mask=15,zoom=1,query=[.2,.1,.3],history=[],tour=false,last=0,activeTime=0,lastDraw=0,previousPositions=null,transition=1; let selectedPoint=null; let result=compute(),focusedResult=null; function compute(){const allowed=mode==='access'?permitted(points,mask):points,n=nearest(allowed,query),weights=softmax(points.map(p=>-distance(p.v,query)),Math.max(.04,strength)),cut=exactMinCut(),decision=typedDecision(query,Math.max(.1,strength*.6)),retained=new Set(compact(points,64,policy).map(p=>p.id)),halfLife=4+strength*68;return{n,weights,cut,decision,retained,halfLife,allowed:new Set(allowed.map(p=>p.id)),hybrid:hybridRank(points,query,strength)};} function metric(label,value,detail){return `
${label}${value}${detail}
`} function chart(){let rows,label,note; if(mode==='attention'){rows=result.weights.map((v,i)=>({id:points[i].id,v,c:points[i].c})).sort((a,b)=>b.v-a.v).slice(0,5);label='TOP ATTENTION WEIGHTS';note='Stable softmax probabilities sum to 1 across all 360 synthetic vectors.';} else if(mode==='temporal'){rows=[0,12,24,48,72].map(age=>({id:age+'h',v:decay(age,result.halfLife),c:0}));label='AGE / RECENCY WEIGHT';note=`Half-life ${result.halfLife.toFixed(1)} hours. Weight at one half-life is exactly 0.5.`;} else if(mode==='route'){rows=result.decision.scores.map((v,i)=>({id:'R'+i,v,c:i}));label='CENTROID ROUTE PROBABILITIES';note='Threshold 0.60. These fixture scores are not calibrated production confidence.';} else if(mode==='compress'){rows=[2,4,8].map(b=>({id:b+' bit',v:quantizationMSE(points,b),c:b===bits?0:1}));label='SCALAR RECONSTRUCTION MSE';note='Measured rounding error on the same 1,080 coordinates. Neither index size nor latency is measured.';} else if(mode==='hybrid'){rows=result.hybrid.slice(0,5).map(p=>({id:p.id,v:p.score,c:p.c}));label='TOP BLENDED RETRIEVAL SCORES';note='Synthetic lexical signal plus inverse Euclidean distance. Scores depend on the mixing parameter.';} else if(mode==='mincut'){rows=result.cut.edges.map(([a,b,w])=>({id:a+'→'+b,v:w,c:2}));label='EXACT CUT EDGE WEIGHTS';note='All partitions with node 0 on one side were enumerated. The complementary partition is equivalent.';} else {rows=result.n.slice(0,5).map(p=>({id:p.id,v:p.d,c:p.c}));label='EXACT SYNTHETIC QUERY DISTANCES';note='Distances use the original coordinates. The exhibit projection does not modify the retrieval dataset.';} const max=Math.max(.001,...rows.map(x=>x.v)); let series=null,chartNote=''; if(mode==='temporal'){series=Array.from({length:73},(_,age)=>decay(age,result.halfLife));chartNote='AGE 0 → 72h / RECENCY WEIGHT';} if(mode==='compress'){series=Array.from({length:7},(_,i)=>quantizationMSE(points,i+2));chartNote='2 → 8 BITS / SCALAR MSE';} if(mode==='attention'){series=[...result.weights].sort((a,b)=>b-a).slice(0,64);chartNote='TOP 64 ATTENTION WEIGHTS / DESCENDING';} if(mode==='retrieval'||mode==='memory'){series=nearest(points,query,30).map(p=>p.d);chartNote='EXACT TOP 30 DISTANCES / LOWER IS CLOSER';} if(mode==='hybrid'){series=Array.from({length:21},(_,i)=>hybridRank(points,query,i/20)[0].score);chartNote='MIX 0 → 1 / TOP BLENDED SCORE';} if(series){const hi=Math.max(.000001,...series),lo=Math.min(0,...series),span=hi-lo||1,xy=series.map((v,i)=>[40+i/(series.length-1)*400,150-(v-lo)/span*120]),d=xy.map((a,i)=>(i?'L':'M')+a[0].toFixed(1)+' '+a[1].toFixed(1)).join(' '),fill=d+'L440 150L40 150Z';$('bars').innerHTML=`${[0,1,2,3].map(i=>`${(hi-i/3*hi).toPrecision(2)}`).join('')}${xy.filter((_,i)=>i%Math.max(1,Math.floor(series.length/10))===0).map(a=>``).join('')}${chartNote}`;$('chart-label').textContent=label;$('evidence').textContent=note+' The canopy is a synthetic visual hierarchy, not an engine search trace.';return;} if(['sona','rvf','graph','federation','contrast'].includes(mode)){const labels=mode==='sona'?['TRAJECTORY','REWARD','ADAPTER','EVAL']:mode==='rvf'?['VECTORS','GRAPH','OVERLAY','WITNESS']:mode==='federation'?['LOCAL','CLOCK','MERGE','REPLICA']:mode==='graph'?['INPUT','NEIGHBORS','AGGREGATE','RERANK']:['ANCHOR','POSITIVE','NEGATIVE','REPRESENT'];let d='';labels.forEach((text,i)=>{const x=55+i*120,y=85+(i%2?25:-25);if(i)d+=``;d+=`${text}`;});$('bars').innerHTML=d;$('chart-label').textContent='ARCHITECTURE / VECTOR FLOW';$('evidence').textContent='Illustrative stage relationships. Open the implementation for the executable capability. The visual hierarchy is not an engine trace.';return;} $('bars').innerHTML=rows.map((p,i)=>`${p.id}${p.v.toFixed(4)}`).join('');$('chart-label').textContent=label;$('evidence').textContent=note; } function update(){result=compute();focusedResult=focusedModes.includes(mode)?evaluateLab(mode,{points,query,bits,strength,policy}):null;const e=exhibits.find(e=>e.id===mode),index=exhibits.indexOf(e),n=result.n;root.classList.toggle('rvcl-paused',paused);root.dataset.mode=mode;root.dataset.vectorView=view;root.querySelectorAll('[data-rvcl-view]').forEach(b=>b.setAttribute('aria-pressed',String(b.dataset.rvclView===view)));$('name').textContent=e.title.toUpperCase();$('title').textContent=e.title;$('caption').textContent=e.headline;$('chapter').textContent=e.group+' / '+String(index+1).padStart(2,'0');$('boundary').textContent=e.kind.toUpperCase()+' · SYNTHETIC DATA · '+view.toUpperCase()+' LAYOUT';$('status').textContent=e.kind==='local math'?'LOCAL COMPUTATION / CHECKABLE FIXTURE':'ARCHITECTURE ILLUSTRATION';$('explain').textContent=e.body;$('disclosure').textContent=e.boundary;$('source').href=crateURL(e);$('progress-label').textContent='CHAPTER '+String(index+1).padStart(2,'0')+' / 16';$('scopes').hidden=mode!=='access';$('replay').value=Math.round(replay*100); let special=['NEAREST DISTANCE',n[0]?.d.toFixed(3)??'None','Exact Euclidean metric'],fourth=['QUERY HISTORY',history.length,'In-page trajectories']; if(mode==='attention')special=['WEIGHT SUM',result.weights.reduce((a,b)=>a+b,0).toFixed(4),'Normalized softmax']; if(mode==='mincut'){special=['MIN CUT',result.cut.weight,'Exact weighted cut'];fourth=['CUT EDGES',result.cut.edges.length,'Synthetic eight-node graph'];} if(mode==='hyperbolic')special=['POINCARÉ DISTANCE',poincareDistance([.25,0],[.5,.25]).toFixed(3),'Fixed example pair inside unit disk']; if(mode==='compress'){special=['ROUNDING MSE',quantizationMSE(points,bits).toFixed(5),'Actual scalar reconstruction error'];fourth=['COORDINATE PAYLOAD',bits*3+' bits','Theoretical packed 3D coordinates'];} if(mode==='route'){special=['TOP CONFIDENCE',result.decision.confidence.toFixed(3),'Synthetic normalized centroid scores'];fourth=['DECISION',result.decision.abstain?'ABSTAIN':'ROUTE '+result.decision.index,'Fixture threshold 0.60'];} if(mode==='compact'){special=['RETAINED',64,policy.toUpperCase()+' fixture sorting'];fourth=['CAPACITY EVICTIONS',points.length-64,'Synthetic fixture only'];} if(mode==='temporal')special=['HALF-LIFE',result.halfLife.toFixed(1)+' h','Exponential age weighting']; if(mode==='access'){special=['ELIGIBLE',result.allowed.size,'Exact permission-mask prefilter'];fourth=['ACCESS MASK',mask.toString(2).padStart(4,'0'),'Four synthetic namespaces'];} $('zoom').parentElement.hidden=Boolean(focusedResult);$('bits').parentElement.hidden=mode!=='compress';$('policy').parentElement.hidden=mode!=='compact';$('parameter-label').hidden=!['contrast','attention','hybrid','temporal','route','compact'].includes(mode); $('parameter-label').firstChild.textContent=mode==='compact'?'Memory budget ':mode==='route'?'Confidence gate ':mode==='temporal'?'Half life ':mode==='attention'?'Temperature ':mode==='hybrid'?'Semantic weight ':'Separation '; $('metrics').innerHTML=metric('SYNTHETIC VECTORS',360,'3D fixture · deterministic seed')+metric('EXHIBIT MODE',e.kind==='local math'?'COMPUTED':'ILLUSTRATED','WASM engine is separate below')+metric(...special)+metric(...fourth);chart();if(focusedResult){$('bars').innerHTML=labChart(focusedResult);$('chart-label').textContent=mode==='route'?'NORMALIZED SCORES / CONFIDENCE GATE':'ORIGINAL TOP 10 / MINT SURVIVES · CORAL LOST';$('metrics').innerHTML=labMetricHTML(focusedResult);$('boundary').textContent='COMPUTED LOCALLY · SEEDED FIXTURE 731 · NO NETWORK';$('evidence').textContent=mode==='compress'?'Exact top 10 is compared with top 10 after scalar rounding. Coordinate payload excludes metadata and index overhead.':mode==='compact'?'Top 10 overlap is recomputed after retention. Inspecting the fixture changes no persistent memory.':'The confidence gate changes acceptance, not the normalized scores. Coverage is measured over 360 synthetic vectors; it is not accuracy.';}root.querySelectorAll('[data-rvcl-mode]').forEach(b=>b.setAttribute('aria-pressed',String(b.dataset.rvclMode===mode)));$('play').textContent=paused?'Resume motion':'Pause motion';$('tour').textContent=tour?'Stop cinematic tour':'Start cinematic tour';draw();} function sphere(p){const [x,y,z]=p.v,a=phase*.11,xx=x*Math.cos(a)+z*Math.sin(a),zz=z*Math.cos(a)-x*Math.sin(a),k=1/(1.7-zz*.35);return [600+xx*470*k,295+y*360*k,k];} function canopy(p){const rank=Math.floor(p.id/4),depth=1+Math.floor(Math.log2(rank+1)),first=2**(depth-1)-1,slot=rank-first,width=2**(depth-1),x=180+p.c*280+((slot+.5)/width-.5)*240,y=490-depth*58;return [x+Math.sin(phase*.19+p.id*.03)*3,y+Math.cos(phase*.16+p.id*.07)*2,.65];} function position(p){const i=p.id,c=p.c,a=i*.61803398875*Math.PI*2,base=view==='canopy'?canopy(p):sphere(p),t=strength; if(view==='hyper'&&!['rvf','sona','mincut','federation'].includes(mode)){const rank=Math.floor(i/4),depth=1+Math.floor(Math.log2(rank+1)),r=248*Math.tanh(depth*.31),angle=c*Math.PI/2+(((rank+.5)/(90))-.5)*1.3;return [600+Math.cos(angle)*r,295+Math.sin(angle)*r,.7];} if(view==='trace'&&!['rvf','sona','mincut','federation'].includes(mode)){return [150+(i%6)*180+(base[0]-600)*.09,260+(Math.floor(i/6)%20-10)*11,.6];} if(view==='canopy'&&['retrieval','attention','graph','memory','temporal','compact','compress','hybrid','access'].includes(mode))return base; if(mode==='contrast'||mode==='route'){const k=mode==='route'?.83:t;return [base[0]*(1-k)+(600+Math.cos(c*Math.PI/2)*215)*k,base[1]*(1-k)+(295+Math.sin(c*Math.PI/2)*155)*k,base[2]];} if(mode==='attention'){const r=170+Math.sin(i*.17+phase*.2)*55;return [600+Math.cos(a+phase*.06)*r,295+Math.sin(a+phase*.06)*r*.85,.7];} if(mode==='hyperbolic'){const depth=1+(i%6),r=245*Math.tanh(depth*.35),ang=(Math.floor(i/6)%60)/60*Math.PI*2;return [600+r*Math.cos(ang),295+r*Math.sin(ang),.6];} if(mode==='mincut'){const g=c<2?0:1,ang=i*Math.PI*.17;return [400+g*400+Math.cos(ang)*(60+i%75),295+Math.sin(ang)*(50+i%95),.6];} if(mode==='compress'){const l=2**bits-1;return sphere({...p,v:p.v.map(x=>Math.round((x+1)*l/2)*2/l-1)});} if(mode==='temporal'){const r=70+p.age*2.7;return [600+Math.cos(a+phase*.07)*r,295+Math.sin(a+phase*.07)*r*.77,.6];} if(mode==='rvf'){const layer=i%6,u=(i%30)/29,v=Math.floor(i/30)%12/11;return [370+u*340+v*150,140+v*100-u*75+layer*51,.7];} if(mode==='sona'){const step=i%5;return [180+step*210+(base[0]-600)*.17,270+(base[1]-295)*.36+Math.sin(step+phase*.3)*15,.6];} if(mode==='federation'){const island=i%6,theta=island*Math.PI/3;return [600+Math.cos(theta)*285+(base[0]-600)*.18,295+Math.sin(theta)*170+(base[1]-295)*.21,.6];} if(mode==='hybrid'){return [base[0],base[1]+Math.sin(i*.1+phase)*8,base[2]];} return base;} const line=(a,b,color,opacity=.2,width=.6,curve=0)=>``; function draw(){if(focusedResult){$('geometry').innerHTML=labScene(focusedResult,{selected:selectedPoint});$('clock').textContent='COMPUTED / LOCAL FIXTURE';return;}const target=points.map(position);transition=Math.min(1,transition+.055);const p=target.map((a,i)=>previousPositions? a.map((v,j)=>previousPositions[i][j]*(1-transition)+v*transition):a),n=mode==='hybrid'?result.hybrid.slice(0,10):result.n,ids=new Set(n.map(x=>x.id));let html=''; if(view==='canopy'&&!['rvf','sona','mincut','federation','hyperbolic','route','contrast'].includes(mode)){ const rootPoint=[600,495]; for(let i=0;i=0?p[parent]:rootPoint,b=p[i],hot=ids.has(i),depth=1+Math.floor(Math.log2(rank+1)),shown=replay>=depth/8,col=hot?'#ff9b69':C[points[i].c],opacity=shown?(hot?.85:.18):.025;html+=line(a,b,col,opacity,hot?1.6:.65,(b[1]-a[1])*.15);if(hot&&shown){const f=(phase*.3+i*.09)%1;html+=``;}} html+=`QUERY ROOT`; } for(let r=1;r<=6;r++)html+=``; if(mode==='hyperbolic'){html+='';for(let i=0;i<180;i+=3){const parent=Math.floor(i/6)*6;html+=line(p[parent],p[i],'#7ba5ff',.23,.8,-15);}} if(view!=='canopy'&&['retrieval','graph','memory','hybrid','access','attention'].includes(mode)){const q=sphere({v:query});for(let i=0;i`;}}} if(mode==='rvf'){['VECTORS','METADATA','GRAPH','OVERLAYS','INDEX','WITNESS'].forEach((s,i)=>{const y=125+i*51;html+=`${s}`;});} if(mode==='sona'){const labels=['TRAJECTORY','REWARD','MICROLORA','CONSOLIDATE','EVALUATE'];labels.forEach((label,i)=>{const x=180+i*210;html+=`${label}`;if(i<4)html+=line([x+58,270],[x+152,270],C[i%4],.5,1.5);});} if(mode==='federation'){for(let i=0;i<6;i++){const a=[600+Math.cos(i*Math.PI/3)*285,295+Math.sin(i*Math.PI/3)*170],b=[600+Math.cos((i+1)*Math.PI/3)*285,295+Math.sin((i+1)*Math.PI/3)*170];html+=line(a,b,C[i%4],.5,1,Math.sin(phase)*35);const f=(phase*.2+i*.16)%1;html+=`MEMORY ${i+1}`;}} if(mode==='mincut'){const nodes=Array.from({length:8},(_,i)=>[i<4?330+Math.cos(i*Math.PI/2)*85:870+Math.cos(i*Math.PI/2)*85,295+Math.sin(i*Math.PI/2)*95]);cutEdges.forEach(([a,b,w])=>{const cut=Boolean(result.cut.mask&(1<${w}`;});nodes.forEach((a,i)=>html+=`${i}`);} if(mode==='memory')history.forEach((q,i)=>{const a=sphere({v:q});html+=``;}); p.forEach((a,i)=>{const point=points[i],hit=ids.has(i)&&!['rvf','sona','federation','mincut','contrast'].includes(mode),eligible=result.allowed.has(i),keep=result.retained.has(i),weight=mode==='temporal'?decay(point.age,result.halfLife):mode==='compact'?(keep?1:.07):mode==='access'?(eligible?1:.035):1,opacity=(hit?1:.35+.25*Math.sin(phase+i))*weight,r=mode==='attention'?1+Math.sqrt(result.weights[i])*24:hit?3.7:1.1+a[2]*1.5;html+=``;if(hit)html+=``;}); if(['retrieval','memory','hybrid','access','route'].includes(mode)){const q=sphere({v:query});html+=`QUERY`;} $('geometry').innerHTML=`${html}`;$('clock').textContent=exhibits.find(e=>e.id===mode).kind.toUpperCase()+' / '+(paused?'PAUSED':'LIVE SVG');} function choose(id){if(!exhibits.some(e=>e.id===id))return;previousPositions=points.map(position);transition=0;mode=id;activeTime=0;update();} root.addEventListener('click',e=>{const v=e.target.closest('[data-rvcl-view]');if(v){previousPositions=points.map(position);transition=0;view=v.dataset.rvclView;update();return;}const layer=e.target.closest('[data-rvcl-layer]');if(layer){selectedLayer=Number(layer.dataset.rvclLayer);update();return;}const b=e.target.closest('[data-rvcl-mode]');if(b){choose(b.dataset.rvclMode);if(b.classList.contains('rvcl-card'))$('svg').scrollIntoView({behavior:paused?'auto':'smooth',block:'center'});return;}const g=e.target.closest('[data-rvcl-group]');if(g){root.querySelectorAll('[data-rvcl-group]').forEach(b=>b.setAttribute('aria-pressed',String(b===g)));root.querySelectorAll('.rvcl-tabs [data-rvcl-mode]').forEach(b=>b.hidden=g.dataset.rvclGroup!=='ALL'&&b.dataset.group!==g.dataset.rvclGroup);return;}const scope=e.target.closest('[data-rvcl-scope]');if(scope){mask^=1<32)history.shift();update();} $('query').onclick=()=>{const i=(history.length*71+19)%360;query=points[i].v.slice();record();};$('play').onclick=()=>{paused=!paused;update();};$('tour').onclick=()=>{tour=!tour;if(tour)paused=false;activeTime=0;update();}; const step=delta=>choose(exhibits[(exhibits.findIndex(e=>e.id===mode)+delta+exhibits.length)%exhibits.length].id);$('prev').onclick=()=>step(-1);$('next').onclick=()=>step(1); $('replay').oninput=e=>{replay=Number(e.target.value)/100;draw();};$('strength').oninput=e=>{strength=Number(e.target.value)/100;update();};$('bits').onchange=e=>{bits=Number(e.target.value);update();};$('policy').onchange=e=>{policy=e.target.value;update();};$('zoom').oninput=e=>{zoom=Number(e.target.value)/100;draw();}; new IntersectionObserver(entries=>{visible=entries[0].isIntersecting;},{rootMargin:'120px'}).observe($('svg')); matchMedia('(prefers-reduced-motion:reduce)').addEventListener('change',e=>{paused=e.matches;update();}); function frame(now){const dt=Math.min(.1,(now-last)/1000||0);last=now;if(visible&&!document.hidden&&!paused){phase+=dt;activeTime+=dt;replay=Math.min(1,replay+dt/6);if(tour&&activeTime>8)step(1);if(now-lastDraw>50){lastDraw=now;if(!focusedResult)draw();$('replay').value=Math.round(replay*100);$('progress').value=tour?activeTime:0;}}requestAnimationFrame(frame);}update();requestAnimationFrame(frame);