fxFX '+used.length+'
';
+ for(const {name,i} of rows){
+ out+='
'+
+ (name==='None'?'':
+ '');
+ out+='';
+ if(name!=='None')out+='';
+ out+='
';
+ }
+ return out+'
';
+}
+
+/* ONE deterministic reference graph. OUTPUT is a compatibility projection,
+ not an independent PCM route. Native owns actual graph ACK and audio. */
+function syncWireOutputProjection(){
+ for(const t of tracks){
+ const primary=wireEdges.find(e=>e.enabled&&e.sourceId===t.id&&e.kind==='primary');
+ const dest=primary&&tracks.concat(master).find(x=>x.id===primary.destId);
+ t.output=dest?dest.kind==='master'?'Master':dest.name:'SOURCE ONLY (No Main)';
+ }
+}
+function wireGraphCommit(ops,{record=true}={}){
+ const before=record?wireWsSnapshot():null;
+ const result=ArSonWireGraph.applyWireTransaction({
+ channels:tracks,mainId:master.id,edges:wireEdges,nextId:nextWireId
+ },ops);
+ if(!result.ok){say('ROUTING GUARDIAN: '+result.error+' · graph unchanged');return false;}
+ wireEdges=result.edges;nextWireId=result.nextId;
+ if(selectedWireEdgeId!==null&&!wireEdges.some(e=>e.id===selectedWireEdgeId))selectedWireEdgeId=null;
+ syncWireOutputProjection();
+ if(record)wireWsRecord(before);
+ return true;
+}
+function wireFor(src,dst){return wireEdges.find(e=>e.enabled&&e.sourceId===src&&e.destId===dst);}
+function outgoingWires(id){return wireEdges.filter(e=>e.enabled&&e.sourceId===id);}
+function wireOutgoingCount(id){return outgoingWires(id).filter(e=>e.destId!==master.id).length;}
+function wireIsCycle(src,dst){
+ if(src===dst)return true;
+ const candidate={id:nextWireId,sourceId:src,destId:dst,kind:'send',mode:'send',levelDb:0,enabled:true};
+ const result=ArSonWireGraph.validateCandidateGraph(tracks,master.id,
+ [...wireEdges.filter(e=>e.sourceId!==src||e.destId!==dst),candidate]);
+ return !result.ok&&result.error==='FEEDBACK_CYCLE';
+}
+function hasLegacySendTo(){return false;} // old slots migrated, never a second graph
+function wireSourceTrack(id){return tracks.find(t=>t.id===id&&t.kind!=='master');}
+// Transient WIRE source focus is separate from mixer-channel selection.
+ // Clearing this tool never alters a committed route or native audio state.
+function clearWireIntent(){
+ if(!wireIntent&&!wireSourcePinned)return;
+ wireIntent=false;wireSourcePinned=false;wireSourceId=null;
+ wireAnchorId=null;wireHoverId=null;
+ refreshWireRoutingNodes();
+}
+function selectWireSource(t){
+ if(!t||t.kind==='master')return false;
+ wireSourceId=t.id;wireSourcePinned=true;wireIntent=true;wireAnchorId=null;wireHoverId=null;
+ tracks.forEach(x=>x.selected=x.id===t.id);master.selected=false;
+ render();say('SOURCE '+t.name+' · drag solid OUT → hollow IN, or click an IN jack · GUI DEMO');
+ return true;
+}
+function closeRouteChoice(){pendingBusRoute=null;wireWsPendingBefore=null;const p=document.getElementById('routeChoice');if(p)p.hidden=true;}
+function showRouteChoice(source,dest,anchor){
+ if(!source||!dest||dest.kind!=='bus')return false;
+ if(hasLegacySendTo(source,dest)){say('BUS ROUTE BLOCKED: hidden legacy SEND to '+dest.name+' · migrate legacy path first');return false;}
+ if(wireIsCycle(source.id,dest.id)){say('BUS ROUTE REJECTED: feedback path');return false;}
+ pendingBusRoute={sourceId:source.id,destId:dest.id};
+ const p=document.getElementById('routeChoice');if(!p)return false;
+ document.getElementById('routeChoiceTitle').textContent='ROUTE '+source.name+' → '+dest.name;
+ document.getElementById('routeChoiceDescription').textContent='Choose a serial route through '+dest.name+' only, or keep your current primary output plus a parallel send.';
+ p.hidden=false;
+ const a=anchor?.getBoundingClientRect?.(),r=document.querySelector('.console-pane')?.getBoundingClientRect?.();
+ if(a&&r&&p.style?.setProperty){
+ p.style.setProperty('left',Math.max(8,Math.min(r.width-292,a.left-r.left-100))+'px');
+ p.style.setProperty('top',Math.max(8,Math.min(r.height-205,a.top-r.top-191))+'px');
+ }
+ say('Bus routing choice required · no graph change until VIA BUS ONLY or PARALLEL is selected');
+ return true;
+}
+function commitRouteChoice(kind){
+ const p=pendingBusRoute,source=p&&wireSourceTrack(p.sourceId),dest=p&&tracks.find(t=>t.id===p.destId);
+ if(!source||!dest){closeRouteChoice();return false;}
+ const type=kind==='only'?'ROUTE_ONLY':kind==='parallel'?'CONNECT':null;
+ if(!type)return false;
+ const ok=wireGraphCommit([{type,sourceId:source.id,destId:dest.id}]);
+ closeRouteChoice();if(!ok)return false;
+ render();kickWireSpring(source.id,dest.id);
+ say(source.name+' → '+dest.name+' · '+(kind==='only'?'ROUTE ONLY':'PARALLEL SEND')+' · reference only');
+ return true;
+}
+function requestWireConnection(source,dest,anchor){
+ if(!source||!dest||source.id===dest.id)return false;
+ const existing=wireFor(source.id,dest.id);
+ if(existing){selectWireEdge(existing);return true;}
+ if(dest.kind==='master'){
+ if(!wireGraphCommit([{type:'CONNECT',sourceId:source.id,destId:master.id}]))return false;
+ render();say(source.name+' → MAIN connected · reference only');return true;
+ }
+ if(dest.kind==='bus')return showRouteChoice(source,dest,anchor);
+ return wireConnect(source,dest);
+}
+function wireConnect(source,dest){
+ if(!source||source.kind==='master'||!dest||dest.kind==='master'||source.id===dest.id)return false;
+ const old=wireFor(source.id,dest.id);
+ if(old){selectWireEdge(old);return true;}
+ if(!wireGraphCommit([{type:'CONNECT',sourceId:source.id,destId:dest.id,mode:wireMode}]))return false;
+ render();kickWireSpring(source.id,dest.id);
+ say('WIRE '+source.name+' → '+dest.name+' · reference graph, no JS PCM');return true;
+}
+
+/* Atomic V18 wire replug: preserve the same edge id, gain, mode, and tap.
+ Existing graph is untouched on illegal destinations or canceled gestures. */
+function replugWireEdge(sourceId,oldDestId,nextDestId){
+ const edge=wireFor(sourceId,oldDestId);
+ if(!edge||!wireSourceTrack(sourceId)){say('WIRE REPLUG: stale edge; graph kept');return false;}
+ if(nextDestId===oldDestId)return true;
+ const op=nextDestId===null?{type:'REMOVE',sourceId,edgeId:edge.id}:
+ {type:'RETARGET',sourceId,edgeId:edge.id,destId:nextDestId};
+ if(!wireGraphCommit([op],{record:false}))return false;
+ wireAnchorId=nextDestId;render();
+ if(nextDestId!==null&&nextDestId!==master.id)kickWireSpring(sourceId,nextDestId);
+ say('WIRE '+(nextDestId===null?'unplugged':'replugged')+' · edge '+edge.id+' · reference only');
+ return true;
+}
+function wireConnectRange(source,anchorId,finalId){
+ const page=Number(document.getElementById('bankSelect').value)||0;
+ const filter=document.getElementById('viewFilter').value;
+ const shown=tracks.filter(t=>filter==='all'||(filter==='solo'?t.solo:t.kind===filter))
+ .slice(page*bankCapacity(),(page+1)*bankCapacity());
+ const a=shown.findIndex(x=>x.id===anchorId),b=shown.findIndex(x=>x.id===finalId);
+ if(a<0||b<0){say('WIRE RANGE: same bank only');return false;}
+ const targets=shown.slice(Math.min(a,b),Math.max(a,b)+1)
+ .filter(t=>t.id!==source.id&&!wireFor(source.id,t.id));
+ if(!targets.length)return false;
+ if(!wireGraphCommit(targets.map(t=>({type:'CONNECT',sourceId:source.id,destId:t.id}))))return false;
+ render();say('WIRE RANGE · '+targets.length+' accepted edges · reference only');return true;
+}
+function wireDbText(db){return db<=-60?'−∞':(db>0?'+':'')+Number(db).toFixed(1)+' dB';}
+function wireGainValue(db){return Math.round(Math.max(-60,Math.min(6,Number(db)||0))*10)/10;}
+function armedWireSource(){return wireIntent&&wireSourcePinned?wireSourceTrack(wireSourceId):null;}
+function wireGainPercent(db){return Math.max(0,Math.min(100,(Number(db)+60)/66*100));}
+/* OUT is a solid physical jack, IN is an empty receiving jack.
+ Every non-MAIN strip can originate a wire. Coordinates never assume x1>x0. */
+/* V49: one committed edge identity owns selection, drag and gain.
+ A visual cable is a control; an SVG path is never the routing graph. */
+function incomingWireEdges(id){return wireEdges.filter(e=>e.enabled&&e.destId===id);}
+function selectedWireEdge(){return wireEdges.find(e=>e.enabled&&e.id===selectedWireEdgeId)||null;}
+function selectWireEdge(edge,inspect=false){
+ if(!edge||!edge.enabled||!wireEdges.some(e=>e.id===edge.id))return;
+ selectedWireEdgeId=edge.id;
+ if(inspect){
+ const ws=document.getElementById('wireWorkspace');
+ wireWsOpen=true;wireWsMode='routes';if(ws)ws.hidden=false;
+ wireWsInspect={src:edge.sourceId,dst:edge.destId};wireWsRemoveConfirm=null;
+ renderWireWorkspace();renderWireWsInspector();
+ }
+ render();
+ say('WIRE '+wireWsLabel(edge.sourceId)+' → '+wireWsLabel(edge.destId)+
+ ' selected · '+wireDbText(edge.levelDb)+' · GUI DEMO');
+}
+function wireTray(t){
+ const isMain=t.kind==='master';
+ const focus=selection().filter(x=>x.kind!=='master');
+ const source=armedWireSource()||(isMain&&focus.length===1?focus[0]:null);
+ const isSource=!!source&&source.id===t.id;
+ const direct=isMain&&source?wireFor(source.id,master.id):null;
+ const incoming=isMain?(direct?[direct]:[]):incomingWireEdges(t.id);
+ const armedEdge=source?wireFor(source.id,t.id):null;
+ const selected=incoming.find(e=>e.id===selectedWireEdgeId);
+ const incomingCount=isMain?incomingWireEdges(master.id).length:incoming.length;
+ const edge=selected||(incoming.length===1?incoming[0]:armedEdge)||null;
+ const connected=incoming.length>0,hasAnyArrival=incomingCount>0;
+ const legacy=false;
+ const linked=isMain?!!direct:connected;
+ const sourceLinked=!!armedEdge;
+ const canWire=!!(source&&!isSource)||(!isMain&&hasAnyArrival);
+ const label=isMain?(linked?'MAIN ON':'MAIN OFF'):
+ incomingCount>1?incomingCount+' incoming wires · inspect routes':
+ hasAnyArrival&&!source?'IN connected · inspect route':
+ !source?'NO SOURCE':isSource?'SOURCE':
+ linked?'CONNECTED':'CONNECT';
+ const sender=edge?wireSourceTrack(edge.sourceId):null;
+ const modeLabel=edge?(isMain?'Focused CH→MAIN · drag this exact plug to replug or unplug':
+ edge.mode==='routeOnly'?'Route Only · drag IN to replug / unplug':
+ edge.mode==='send'?'Post-fader Send · drag IN to replug / unplug':
+ 'Pre FX Mult · drag IN to replug / unplug'):
+ hasAnyArrival?'Select one incoming route to inspect':
+ legacy?'Existing SEND slot · managed in legacy routing':
+ 'Choose OUT then click IN, or drag an OUT jack here';
+ const from='';
+ code+='';
+ code+=''+(t.kind==='audio'?'▥':t.kind==='bus'?'↪':t.kind==='fx'?'∿':'➜')+''+(t.safe?'SAFE':'')+(t.group?''+escapeHtml(t.group)+'':'')+(t.kind==='audio'?'':'')+(t.kind!=='master'&&wireOutgoingCount(t.id)?'⇢'+wireOutgoingCount(t.id)+'':'')+'
';
+ if(t.kind==='audio')code+='
IN
';
+ else if(t.kind==='bus'||t.kind==='fx')code+='
IN'+(t.kind==='bus'?'GROUP':'FX RETURN')+'
';
+ else code+='
INSUM BUS
';
+ code+='
OUT
';
+ code+=sectionFx(t)+sectionSend(t);
+ code+='PAN
';
+
+ code+=''
+ +''
+ +''
+ +'
';
+ code+=sectionFader(t);
+ code+=''+(sofEnabled&&t.kind==='audio'?'S ': '')+formatDb(sofEnabled&&t.kind==='audio'?getSofLevel(t):t.level)+'
';
+ return code;
+}
+const DENSITY_WIDTH=Object.freeze({comfort:150,standard:134,compact:130});
+function bankGeometry(){
+ const body=document.querySelector('.console-body');
+ const panel=Number(body?.clientWidth)||0;
+ // One budget for the section rail, source strips and pinned MAIN.
+ // Floating Plugin Manager must never consume a mixer bank.
+ const rail=Number(document.querySelector('.section-rail')?.clientWidth)||32;
+ return {panel,usable:Math.max(0,panel-rail)};
+}
+function bankCapacity(){
+ const {panel,usable}=bankGeometry();
+ const mode=document.querySelector('.console-body')?.dataset.density||'comfort';
+ const minimum=DENSITY_WIDTH[mode]||DENSITY_WIDTH.comfort;
+ // 2px subpixel grace prevents 1680px banks from losing a whole channel at 149.82px.
+ return panel?Math.max(1,Math.min(10,Math.floor((usable+2)/minimum)-1)):10;
+}
+function render(pageOverride){
+ const filter=document.getElementById('viewFilter').value;
+ const visible=tracks.filter(t=>filter==='all'||(filter==='solo'?t.solo:t.kind===filter));
+ const selector=document.getElementById('bankSelect'),previous=Number(selector.value)||0;
+ const capacity=bankCapacity(),count=Math.max(1,Math.ceil(visible.length/capacity));
+ const page=Math.max(0,Math.min(Number.isInteger(pageOverride)?pageOverride:previous,count-1));
+ selector.innerHTML=Array.from({length:count},(_,i)=>'
+ out.classList.toggle('is-snap-locked',id!==null));
+}
+/* V26 Focus Signal Flow — one read-only display graph for both directions.
+ Keep legacy Send, Split and Bus primary paths visible without changing the
+ underlying audio topology or introducing duplicate wire edges. */
+
+/* V34 Smart WIRE Navigator / Matrix.
+ View-only channel/bank discovery and existing route admission are separate.
+ No new route graph or global SVG animation loop is created. */
+let wireWsOpen=false,wireWsMode='find',wireWsQuery='',wireWsBusId=null,wireWsDestinationId=null,
+ wireWsInspect=null,wireWsRemoveConfirm=null,wireWsHistory=[],wireWsPendingBefore=null,wireWsEditBefore=null;
+
+/* Scoped WIRE-only undo. Never rewinds fader, FX, mute, mixer bank or meters.
+ Refuse stale replay after another graph/scene mutation. */
+function wireWsSnapshot(){
+ return {edges:clone(wireEdges),nextId:nextWireId,
+ outputs:tracks.map(t=>[t.id,t.output]),trackIds:tracks.map(t=>t.id)};
+}
+function wireWsSignature(state){return JSON.stringify(state);}
+function wireWsRecord(before){
+ if(!before)return;
+ const after=wireWsSnapshot(),afterSig=wireWsSignature(after);
+ // The same action may arrive through a socket and the Matrix controller;
+ // capture its accepted graph ONCE, never create duplicate Undo steps.
+ if(wireWsSignature(before)===afterSig||wireWsHistory.at(-1)?.afterSig===afterSig)return;
+ wireWsHistory.push({before,afterSig});
+ if(wireWsHistory.length>10)wireWsHistory.shift();
+ const btn=document.getElementById('wireWsUndo');if(btn)btn.disabled=false;
+}
+function wireWsUndo(){
+ const entry=wireWsHistory[wireWsHistory.length-1];
+ if(!entry){say('WIRE: no routing change to undo');return false;}
+ if(wireWsSignature(wireWsSnapshot())!==entry.afterSig){
+ wireWsHistory=[];wireWsPendingBefore=null;
+ say('WIRE UNDO canceled: graph changed outside Navigator · current routes preserved');
+ renderWireWorkspace();return false;
+ }
+ const valid=ArSonWireGraph.validateCandidateGraph(tracks,master.id,entry.before.edges);
+ if(!valid.ok){say('WIRE UNDO BLOCKED: '+valid.error);return false;}
+ wireWsHistory.pop();wireEdges=clone(entry.before.edges);nextWireId=entry.before.nextId;
+ selectedWireEdgeId=wireEdges.some(e=>e.id===selectedWireEdgeId)?selectedWireEdgeId:null;
+ syncWireOutputProjection();
+ wireWsInspect=null;wireWsRemoveConfirm=null;
+ render();renderWireWorkspace();
+ say('WIRE UNDO · previous routing restored · unrelated mixer settings kept');
+ return true;
+}
+function wireWsId(id){return 'CH'+String(id).padStart(2,'0');}
+function wireWsLabel(id){
+ const t=tracks.concat(master).find(x=>x.id===id);return t?(t.kind==='master'?'MAIN':wireWsId(id))+' · '+t.name:wireWsId(id);
+}
+function wireWsBank(id){
+ const filter=document.getElementById('viewFilter')?.value||'all';
+ const shown=tracks.filter(t=>filter==='all'||(filter==='solo'?t.solo:t.kind===filter));
+ const index=shown.findIndex(t=>t.id===id);
+ return index<0?'Hidden by filter':'Bank '+(Math.floor(index/Math.max(1,bankCapacity()))+1);
+}
+function wireWsRoutes(){return wireDisplayRoutes();}
+function wireWsFindEdge(src,dst){return wireEdges.find(e=>e.enabled&&e.sourceId===src&&e.destId===dst);}
+function wireWsRouteKind(src,dst,routes){
+ const edge=wireWsFindEdge(src,dst);
+ if(edge)return {kind:'wire',edge};
+ const linked=routes.find(e=>e.sourceId===src&&e.destId===dst);
+ return linked?{kind:linked.kind,edge:null}:null;
+}
+function wireWsMatches(t){
+ const q=wireWsQuery.trim().toLowerCase();
+ return !q||('ch'+String(t.id).padStart(2,'0')+' '+t.id+' '+t.name+' '+t.kind).toLowerCase().includes(q);
+}
+function wireWsCanJoin(src,dst){
+ const a=wireSourceTrack(src),b=wireSourceTrack(dst);
+ return !!(a&&b&&a.id!==b.id&&!wireFor(src,dst)&&!wireIsCycle(src,dst));
+}
+function wireWsChooseMode(mode){
+ wireWsDestinationId=null; // Deliberate mode selection leaves the receiving socket inspector.
+ const previous=wireWsMode;
+ wireWsMode=['find','routes','bus','matrix'].includes(mode)?mode:'find';
+ wireWsInspect=null;wireWsRemoveConfirm=null;
+ if(previous!==wireWsMode){wireWsQuery='';const search=document.getElementById('wireWsSearch');if(search)search.value='';}
+ const panel=document.getElementById('wireWorkspace');
+ if(panel)panel.classList.toggle('is-matrix',wireWsMode==='matrix');
+ renderWireWorkspace();
+}
+function wireWsToggle(mode){
+ const panel=document.getElementById('wireWorkspace');
+ if(!panel)return;
+ if(wireWsOpen&&wireWsMode===mode){wireWsOpen=false;panel.hidden=true;}
+ else {setWireConfig(false);wireWsOpen=true;panel.hidden=false;wireWsChooseMode(mode);}
+ for(const id of ['wireNavigatorToggle','wireMatrixToggle']){
+ const el=document.getElementById(id);if(el)
+ el.setAttribute('aria-expanded',String(wireWsOpen&&
+ (id==='wireMatrixToggle'?wireWsMode==='matrix':wireWsMode!=='matrix')));
+ }
+ if(wireWsOpen&&wireWsMode==='find')document.getElementById('wireWsSearch')?.focus?.();
+}
+/* Multiple incoming cables must be selected explicitly before an edit.
+ Opening this inspector never arms a new source or modifies the graph. */
+function inspectIncomingWireRoutes(destination){
+ const arrivals=wireWsRoutes().filter(route=>route.destId===destination.id);
+ if(!arrivals.length)return;
+ setWireConfig(false);wireWsDestinationId=destination.id;wireWsMode='routes';wireWsOpen=true;
+ wireWsInspect=arrivals.length===1?{src:arrivals[0].sourceId,dst:destination.id}:null;
+ wireWsRemoveConfirm=null;
+ const panel=document.getElementById('wireWorkspace');
+ if(panel)panel.hidden=false;
+ document.getElementById('wireNavigatorToggle').setAttribute('aria-expanded','true');
+ document.getElementById('wireMatrixToggle').setAttribute('aria-expanded','false');
+ renderWireWorkspace();
+ say('IN '+wireWsLabel(destination.id)+' · '+arrivals.length+' incoming route'+(arrivals.length===1?'':'s')+' · select a cable to inspect');
+}
+function wireWsJump(id){
+ const target=wireSourceTrack(id);if(!target)return;
+ const filter=document.getElementById('viewFilter');
+ let list=tracks.filter(t=>filter.value==='all'||(filter.value==='solo'?t.solo:t.kind===filter.value));
+ if(!list.some(t=>t.id===id)){filter.value='all';list=tracks;}
+ const idx=list.findIndex(t=>t.id===id);
+ render(Math.floor(Math.max(0,idx)/Math.max(1,bankCapacity())));
+ say('WIRE NAVIGATOR · showing '+wireWsLabel(id)+' · patch source unchanged');
+}
+function wireWsListRow(t,source,routes,mode){
+ const connected=source?wireWsRouteKind(source.id,t.id,routes):null;
+ const href=source?source.id+':'+t.id:null;
+ const possible=source&&t.id!==source.id&&wireWsCanJoin(source.id,t.id);
+ const linked=!!connected;
+ const action=linked?
+ '':
+ possible?'':
+ '';
+ return ''+
+ ''+
+ ''+wireWsId(t.id)+' · '+escapeHtml(t.name)+''+
+ ''+escapeHtml(wireWsBank(t.id))+''+
+ (linked?''+(connected.kind==='wire'?'● WIRE':'● '+escapeHtml(connected.kind.toUpperCase()))+'':'')+
+ action+'
';
+}
+function wireWsRouteRow(route,direction){
+ const src=tracks.find(t=>t.id===route.sourceId),dst=tracks.find(t=>t.id===route.destId);
+ if(!src||!dst)return '';
+ const other=direction==='out'?dst:src;
+ const info=wireWsRouteKind(src.id,dst.id,wireWsRoutes());
+ return ''+
+ ''+
+ (direction==='out'?'→ ':'← ')+escapeHtml(wireWsLabel(other.id))+''+
+ ''+escapeHtml(wireWsBank(other.id))+''+
+ escapeHtml(info?.kind||route.kind)+''+
+ ''+
+ '
';
+}
+function wireWsMatrixMarkup(source,routes){
+ const all=tracks.filter(t=>t.kind!=='master');
+ const targets=all.filter(wireWsMatches);
+ // Matrix is deliberately capped; the search exposes all stable IDs without
+ // creating a huge DOM for 100+ strips or slowing audio UI interactions.
+ const rows=(source?[source,...all.filter(t=>t.id!==source.id)]:all).slice(0,16);
+ const columns=targets.slice(0,22);
+ if(!columns.length)return 'No matching channel. Search CH number or track name.
';
+ const cols=columns.map(t=>''+wireWsId(t.id)+' | ').join('');
+ const matrix=rows.map(src=>{
+ const cells=columns.map(dst=>{
+ const key=src.id+':'+dst.id,info=wireWsRouteKind(src.id,dst.id,routes),self=src.id===dst.id,
+ permitted=!self&&wireWsCanJoin(src.id,dst.id),cls=info?(info.edge?'is-linked':'is-legacy'):'',
+ action=info?'data-ws-inspect':'data-ws-join',
+ symbol=info?(info.edge?'●':'◆'):(permitted?'+':'–');
+ return ' | ';
+ }).join('');
+ return '| '+wireWsId(src.id)+' · '+escapeHtml(src.name)+' | '+cells+'
';
+ }).join('');
+ return ''+
+ (all.length>16||targets.length>22?'':'');
+}
+function renderWireWsInspector(){
+ if(!wireWsOpen)return;
+ const panel=document.getElementById('wireWsInspector');
+ if(!panel)return;
+ const p=wireWsInspect,info=p&&wireWsRouteKind(p.src,p.dst,wireWsRoutes());
+ if(!info){panel.hidden=true;return;}
+ panel.hidden=false;
+ const src=tracks.find(t=>t.id===p.src),dst=tracks.concat(master).find(t=>t.id===p.dst);
+ if(!src||!dst){panel.hidden=true;return;}
+ const edge=info.edge,key=p.src+':'+p.dst;
+ const controls=edge?
+ ''+
+ ''+
+ ''+edge.levelDb+' dB'+
+ ''+
+ ''+
+ '
':
+ 'Managed by existing '+escapeHtml(info.kind.toUpperCase())+' routing. No duplicate WIRE edge.
';
+ panel.innerHTML=''+escapeHtml(wireWsLabel(p.src))+' → '+escapeHtml(wireWsLabel(p.dst))+''+
+ ''+escapeHtml(info.kind.toUpperCase())+''+controls+
+ ''+
+ '
';
+}
+function renderWireWorkspace(){
+ if(!wireWsOpen)return;
+ const panel=document.getElementById('wireWorkspace');
+ if(!panel||panel.hidden)return;
+ panel.classList.toggle('is-matrix',wireWsMode==='matrix');
+ const source=armedWireSource(),routes=wireWsRoutes();
+ document.getElementById('wireWsSource').textContent=wireWsDestinationId?
+ 'IN '+wireWsLabel(wireWsDestinationId)+' · routes':source?wireWsLabel(source.id)+' OUT':'Choose source OUT';
+ for(const tab of panel.querySelectorAll('[data-ws-mode]'))
+ tab.setAttribute('aria-selected',String(tab.dataset.wsMode===wireWsMode));
+ const sel=document.getElementById('wireWsSourceSelect'),selected=source?.id||0;
+ const options=''+tracks.map(t=>
+ '').join('');
+ if(sel.innerHTML!==options)sel.innerHTML=options;
+ sel.value=String(selected||'');
+ const busSel=document.getElementById('wireWsBus'),buses=tracks.filter(t=>t.kind==='bus');
+ busSel.hidden=wireWsMode!=='bus';
+ const busOpt=buses.map(t=>'').join('');
+ if(busSel.innerHTML!==busOpt)busSel.innerHTML=busOpt;
+ if(!buses.some(t=>t.id===wireWsBusId))wireWsBusId=buses[0]?.id||null;
+ busSel.value=String(wireWsBusId||'');
+ const list=document.getElementById('wireWsList');
+ const foot=document.getElementById('wireWsFoot');
+ if(wireWsMode==='find'){
+ const matches=tracks.filter(t=>t.kind!=='master'&&t.id!==source?.id&&wireWsMatches(t));
+ list.innerHTML=matches.slice(0,75).map(t=>wireWsListRow(t,source,routes,'find')).join('')||
+ 'No destination matches your search.
';
+ foot.textContent=(source?'SOURCE '+wireWsId(source.id)+' retained · ':'Select an OUT source · ')+
+ matches.length+' matching destinations, across all banks';
+ }else if(wireWsMode==='routes'){
+ const focused=wireWsDestinationId?tracks.find(t=>t.id===wireWsDestinationId):source;
+ const inbound=focused?routes.filter(e=>e.destId===focused.id):[];
+ const outbound=focused?routes.filter(e=>e.sourceId===focused.id):[];
+ list.innerHTML=focused?
+ 'OUTGOING · '+outbound.length+'
'+
+ (outbound.map(e=>wireWsRouteRow(e,'out')).join('')||'No outgoing routes
')+
+ 'INCOMING · '+inbound.length+'
'+
+ (inbound.map(e=>wireWsRouteRow(e,'in')).join('')||'No incoming routes
'):
+ 'Select source OUT above to see all incoming and outgoing routes.
';
+ foot.textContent='Jump ↗ preserves source selection · only real WIRE edges are editable';
+ }else if(wireWsMode==='bus'){
+ const bus=tracks.find(t=>t.id===wireWsBusId&&t.kind==='bus');
+ const sources=tracks.filter(t=>t.id!==bus?.id&&t.kind!=='master'&&wireWsMatches(t));
+ list.innerHTML='Choose a Bus to build its send mix.
';
+ // Destination-first rows need a dedicated model-aware control, not a reversed wire.
+ if(bus)list.innerHTML=sources.slice(0,75).map(t=>{
+ const info=wireWsRouteKind(t.id,bus.id,routes),can=wireWsCanJoin(t.id,bus.id);
+ return ''+escapeHtml(wireWsLabel(t.id))+''+
+ ''+escapeHtml(wireWsBank(t.id))+''+
+ (info?'● '+escapeHtml(info.kind.toUpperCase())+'':'')+
+ (info?'':
+ '')+
+ '
';
+ }).join('')||'No source matches.
';
+ foot.textContent='MIX TO '+(bus?wireWsLabel(bus.id):'Bus')+
+ ' · choose sources across banks · Bus decision remains explicit';
+ }else{
+ list.innerHTML=wireWsMatrixMarkup(source,routes);
+ foot.textContent='Crosspoint ● WIRE / ◆ existing legacy · routes are never bank-specific';
+ }
+ renderWireWsInspector();
+ const undo=document.getElementById('wireWsUndo');if(undo)undo.disabled=wireWsHistory.length===0;
+}
+
+function wireDisplayRoutes(){
+ // Projection of ONE canonical graph. No independent output/SEND ghost paths.
+ return wireEdges.filter(e=>e.enabled).map(e=>({
+ id:e.id,sourceId:e.sourceId,destId:e.destId,kind:'wire'
+ }));
+}
+function wireLegendHtml(focus,routes){
+ const inRoutes=routes.filter(e=>e.destId===focus.id);
+ const outRoutes=routes.filter(e=>e.sourceId===focus.id);
+ const fmtId=t=>t.kind==='master'?'MAIN':'CH'+String(t.id).padStart(2,'0');
+ const badges=(list,incoming)=>{
+ const nodes=list.map(e=>tracks.concat(master).find(t=>t.id===(incoming?e.sourceId:e.destId))).filter(Boolean);
+ const visible=nodes.slice(0,2).map(t=>{
+ const icon=incoming?
+ '':
+ '';
+ return ''+icon+''+fmtId(t)+'';
+ }).join('');
+ const rest=nodes.length>2?'+'+(nodes.length-2)+'':'';
+ return visible+rest||'—';
+ };
+ return ''+fmtId(focus)+''+
+ ''+
+ 'IN'+badges(inRoutes,true)+''+
+ ''+
+ 'OUT'+badges(outRoutes,false)+'';
+}
+/* V46: geometry from existing physical pins, never label-bearing buttons.
+ Applies to incoming/outgoing/context, drag, snap and impact alike. */
+function wireJackRect(button){
+ if(!button)return null;
+ const dot=button.querySelector?.(button.classList.contains('wire-node-out')?'.wire-pin':'.wire-arrow');
+ return (dot||button).getBoundingClientRect?.()||null;
+}
+/* One pair of short MAIN-colored stubs is a projection of ONE real edgeId. */
+/* One accepted CH→MAIN edge is represented by two local cable fragments.
+ Physical coordinates are measured from actual sockets; never connect strips
+ with a long SVG crossing banks or alter the audio graph. */
+function paintMainWireFragment(strip,edge,isMain){
+ const section=strip?.querySelector('.send-section.wire-section');
+ if(!section)return;
+ let layer=section.querySelector('.wire-main-fragment');
+ if(!edge||document.querySelector('.console-body')?.classList.contains('collapsed-send')){
+ layer?.remove();return;
+ }
+ // Pointer-motion repaint must not synchronously remeasure every channel.
+ // Structural render, bank, density and resize remount the section; a
+ // changed accepted edgeId invalidates this tiny projection automatically.
+ if(layer?.dataset.edgeId===String(edge.id))return;
+ const jack=section.querySelector(isMain?'.wire-node-in .wire-arrow':'.wire-node-out .wire-pin');
+ const sectionRect=section.getBoundingClientRect(),pin=jack?.getBoundingClientRect();
+ if(!pin||!sectionRect.width||!sectionRect.height)return;
+ const x=pin.left+pin.width/2-sectionRect.left;
+ const y=pin.top+pin.height/2-sectionRect.top;
+ const lower=Math.min(sectionRect.height-2,Math.max(y+5,sectionRect.height-2));
+ const dx=Math.min(8,Math.max(3,sectionRect.width*.07));
+ const start=isMain?[x+dx,lower]:[x,y];
+ const end=isMain?[x,y]:[x+dx,lower];
+ const c1=isMain?[start[0],start[1]-Math.max(8,(lower-y)*.65)]:
+ [start[0],start[1]+Math.max(8,(lower-y)*.65)];
+ const c2=isMain?[end[0]+dx*.65,end[1]+Math.max(4,(lower-y)*.35)]:
+ [end[0]+dx*.65,end[1]-Math.max(4,(lower-y)*.35)];
+ const path='M'+start.map(n=>n.toFixed(2)).join(' ')+
+ ' C'+c1.map(n=>n.toFixed(2)).join(' ')+','+
+ c2.map(n=>n.toFixed(2)).join(' ')+','+
+ end.map(n=>n.toFixed(2)).join(' ');
+ const sig=edge.id+':'+sectionRect.width.toFixed(1)+':'+sectionRect.height.toFixed(1)+':'+path;
+ if(layer?.dataset.geometry===sig)return;
+ if(!layer){
+ layer=document.createElementNS('http://www.w3.org/2000/svg','svg');
+ layer.setAttribute('class','wire-main-fragment');
+ layer.setAttribute('aria-hidden','true');
+ section.appendChild(layer);
+ }
+ layer.dataset.geometry=sig;layer.dataset.edgeId=String(edge.id);
+ layer.setAttribute('viewBox','0 0 '+sectionRect.width+' '+sectionRect.height);
+ const p=(className,d)=>'';
+ layer.innerHTML=p('wire-main-shadow',path)+p('wire-main-jacket',path)+
+ p('wire-main-sheen',path)+
+ '';
+ layer.style.setProperty('--main-wire-hue',master.color);
+}
+function syncMainWireFragments(){
+ // Render the physical MAIN fragments for ONE selected channel only.
+ // A pinned routing source is a patch action, not selection for cable display.
+ const selectedChannels=selection().filter(t=>t.kind!=='master');
+ const focus=selectedChannels.length===1?selectedChannels[0]:null;
+ const chosenEdge=focus?wireFor(focus.id,master.id):null;
+ const folded=document.querySelector('.console-body')?.classList.contains('collapsed-send');
+ for(const t of tracks){
+ const edge=wireFor(t.id,master.id),lane=document.querySelector('.strip[data-id="'+t.id+'"]');
+ paintMainWireFragment(lane,!folded&&focus?.id===t.id?edge:null,false);
+ const node=lane?.querySelector('.wire-node-out');
+ if(node){
+ if(edge)node.setAttribute('data-wire-main-edge',String(edge.id));
+ else node.removeAttribute('data-wire-main-edge');
+ node.style.setProperty('--main-wire-hue',master.color);
+ }
+ }
+ paintMainWireFragment(masterEl,!folded?chosenEdge:null,true);
+ const node=masterEl.querySelector('.wire-node-in');
+ if(node){
+ if(chosenEdge&&!folded)node.setAttribute('data-wire-main-edge',String(chosenEdge.id));
+ else node.removeAttribute('data-wire-main-edge');
+ node.style.setProperty('--main-wire-hue',master.color);
+ }
+}
+function renderWireRouting(){
+ syncMainWireFragments();
+ if(wireWsOpen&&!wireGesture?.active)renderWireWorkspace();
+ document.querySelector('.console-body')?.classList.toggle('wire-intent',!!wireIntent);
+ const svg=document.getElementById('wireLayer'),viewport=document.getElementById('viewport');
+ const dragging=!!(wireGesture?.active&&wireGesture.point);
+ const focus=armedWireSource(),routes=wireDisplayRoutes();
+ // Display focus must NOT depend on an armed OUT. A mixer channel being
+ // inspected always reveals its existing INCOMING and OUTGOING cables.
+ // The separate 'focus' remains the only authority for making new routes.
+ const selectedChannels=selection().filter(t=>t.kind!=='master');
+ const source=dragging?wireSourceTrack(wireGesture.sourceId):
+ (selectedChannels.length===1?selectedChannels[0]:null);
+ const controlSource=focus||source;
+ const legend=document.getElementById('wireLegend'),main=document.getElementById('wireMaster');
+ if(legend){
+ const filter=document.getElementById('viewFilter').value;
+ const bankVisible=tracks.filter(t=>filter==='all'||(filter==='solo'?t.solo:t.kind===filter));
+ const sourceIndex=bankVisible.findIndex(t=>t.id===focus?.id);
+ const sourceInBank=sourceIndex>=0&&Math.floor(sourceIndex/bankCapacity())===(Number(document.getElementById('bankSelect').value)||0);
+ const markup=focus&&!sourceInBank?
+ ''+
+ 'Click any IN on this bank':
+ controlSource?wireLegendHtml(controlSource,routes):'Select a channel for IN / OUT';
+ const picker=focus?'CH'+
+ String(focus.id).padStart(2,'0')+' OUT →'+
+ '':'';
+ const fullMarkup=markup+picker;
+ if(legend.innerHTML!==fullMarkup)legend.innerHTML=fullMarkup;
+ }
+ const configSource=document.getElementById('wireConfigSource');
+ if(configSource)configSource.textContent=controlSource?wireWsLabel(controlSource.id)+' · '+(focus?'OUT armed':'selected channel'):'Select a channel or OUT jack to inspect routing';
+ if(main){
+ main.disabled=!controlSource;
+ if(!controlSource){main.textContent='MAIN';main.setAttribute('aria-pressed','false');}
+ }
+ if(main&&controlSource){
+ const direct=!!wireFor(controlSource.id,master.id);
+ main.textContent=direct?'MAIN ON':'MAIN OFF';main.setAttribute('aria-pressed',String(direct));
+ main.title='Direct source output: '+controlSource.output+' · click to toggle Main only when currently mapped to Main or Source Only';
+ }
+ if(!svg||!viewport)return;
+ if(!source||document.querySelector('.console-body')?.classList.contains('collapsed-send')){
+ if(svg.childNodes?.length)svg.replaceChildren?.();
+ syncVisibleWireDots(svg); // no visible cables means no illuminated receiving rings
+ return;
+ }
+ const vp=viewport.getBoundingClientRect?.();
+ const wireBay=viewport.querySelector('.strip .send-section')?.getBoundingClientRect?.();
+ if(vp&&wireBay)svg.style.clipPath='inset('+Math.max(0,wireBay.top-vp.top)+'px 0px '+Math.max(0,vp.bottom-wireBay.bottom)+'px 0px)';
+ const fromEl=viewport.querySelector?.('.strip[data-id="'+source.id+'"] .wire-node-out');
+ const from=wireJackRect(fromEl);
+ const visibleSource=!!from?.width;
+ const bankIn=viewport.querySelector?.('#tracks .strip .wire-node-in');
+ const bankRect=wireJackRect(bankIn);
+ if(!vp||!vp.width||!vp.height||(!visibleSource&&!bankRect?.width)){svg.innerHTML='';syncVisibleWireDots(svg);return;}
+ svg.setAttribute('viewBox','0 0 '+vp.width+' '+vp.height);
+ // An off-bank SOURCE enters via the left patch-bay boundary. This is a
+ // labelled portal, never a fabricated channel position across unseen banks.
+ const anchor=visibleSource?from:bankRect;
+ const x0=visibleSource?from.left-vp.left+from.width/2:12;
+ const y0=anchor.top-vp.top+anchor.height*.5;
+ const well=(visibleSource?fromEl:bankIn).closest?.('.send-section')?.getBoundingClientRect?.();
+ const sagLimit=wireSagClearance(anchor,well);
+ const paths=[];
+ wireMotionGeometry=new Map();
+ // Never render unrelated channels. Navigator and Matrix inspect all routes.
+ // Physical incoming cables remain visible even when OUT is unarmed.
+ // If patch source is pinned, also show inputs of the inspected channel.
+ const incoming=wireView==='out'?[]:
+ routes.filter(e=>e.destId===source.id&&e.sourceId!==e.destId&&e.destId!==master.id);
+ let offBankIncoming=0;
+ for(const edge of incoming){
+ const sender=wireSourceTrack(edge.sourceId);
+ const fromNode=viewport.querySelector?.('.strip[data-id="'+edge.sourceId+'"] .wire-node-out');
+ const fromRect=wireJackRect(fromNode);
+ const toNode=viewport.querySelector?.('.strip[data-id="'+edge.destId+'"] .wire-node-in');
+ const toRect=wireJackRect(toNode);
+ if(!sender||!toRect?.width)continue;
+ // An off-bank source starts at the left patch-bay portal. Never fake a
+ // hidden strip position or suppress a real incoming signal cable.
+ const offBank=!fromRect?.width;
+ const xb=toRect.left-vp.left+toRect.width*.5,yb=toRect.top-vp.top+toRect.height*.5;
+ const xa=offBank?11:fromRect.left-vp.left+fromRect.width*.5;
+ const ya=offBank?yb+Math.min(9,offBankIncoming++*3):fromRect.top-vp.top+fromRect.height*.5;
+ const senderBay=fromNode?.closest?.('.send-section')?.getBoundingClientRect?.();
+ const rise=offBank?wireSagClearance(toRect,toNode.closest?.('.send-section')?.getBoundingClientRect?.()):
+ wireSagClearance(fromRect,senderBay);
+ const d=wirePathFor(edge,xa,ya,xb,yb,rise),key=wireCableKey(edge);
+ paths.push(''+
+ '');
+ if(offBank)paths.push(''+
+ 'CH'+String(edge.sourceId).padStart(2,'0')+'');
+ }
+ // Front layer: all outgoing routes from selected channel (including existing
+ // legacy Sends, primary Bus and split links), plus the original hover hint.
+ const outgoing=routes.filter(e=>e.sourceId===source.id&&
+ (!dragging||!wireGesture.movingEdgeId||
+ !wireEdges.some(w=>w.id===wireGesture.movingEdgeId&&w.destId===e.destId&&w.sourceId===source.id)));
+ if(!dragging&&!!focus&&wireHoverId!==null&&wireHoverId!==source.id&&!outgoing.some(e=>e.destId===wireHoverId))
+ outgoing.push({sourceId:source.id,destId:wireHoverId,kind:'preview',preview:true});
+ for(const edge of outgoing){
+ const dest=tracks.find(t=>t.id===edge.destId);
+ if(!dest)continue;
+ const rect=wireJackRect(viewport.querySelector?.('.strip[data-id="'+dest.id+'"] .wire-node-in'));
+ if(!rect||!rect.width)continue;
+ const x1=rect.left-vp.left+rect.width/2,y1=rect.top-vp.top+rect.height/2;
+ const d=wirePathFor(edge,x0,visibleSource?y0:y1,x1,y1,sagLimit),color=source.color||'#93e5b4';
+ paths.push(''+
+ '');
+ }
+ if(!visibleSource&&paths.some(p=>p.includes('wire-outgoing-line'))){
+ paths.push('');
+ }
+ if(dragging){
+ let x1=Math.max(2,Math.min(vp.width-2,wireGesture.point.x-vp.left));
+ let y1=Math.max(2,Math.min(vp.height-2,wireGesture.point.y-vp.top));
+ const snap=tracks.concat(master).find(t=>t.id===wireGesture.snapId);
+ const rect=snap?wireJackRect(viewport.querySelector?.('.strip[data-id="'+snap.id+'"] .wire-node-in')):null;
+ if(rect?.width){
+ // True magnetic PREVIEW: if the receiving ring is lit, the cable endpoint
+ // visibly docks into that ring. Exiting 24px undocks immediately and
+ // continues with the mouse. This never commits route state during drag.
+ x1=rect.left-vp.left+rect.width*.5;
+ y1=rect.top-vp.top+rect.height*.5;
+ }
+ const d=wirePathData(x0,y0,x1,y1,sagLimit);
+ paths.push(''+
+ ''+
+ (snap?'':''));
+ }
+ svg.innerHTML=paths.join('');
+ // Exactly one transparent hit geometry per real edge. Avoid endpoint sockets
+ // by reserving 6% of path length at both ends; previews/legacy stay passive.
+ if(!dragging){
+ const represented=new Set();
+ const lines=[...svg.querySelectorAll('path.wire-outgoing-line,path.wire-incoming-line,path.wire-context-line')];
+ for(const line of lines){
+ const edge=wireFor(Number(line.dataset.from),Number(line.dataset.to));
+ if(!edge||represented.has(edge.id))continue;
+ represented.add(edge.id);
+ if(edge.id===selectedWireEdgeId)line.classList.add('is-wire-selected');
+ const hit=document.createElementNS('http://www.w3.org/2000/svg','path');
+ hit.setAttribute('class','wire-interaction-hit'+(edge.id===selectedWireEdgeId?' is-wire-selected':''));
+ hit.setAttribute('data-edge-id',String(edge.id));
+ hit.setAttribute('data-cable-key',wireCableKey(edge));
+ hit.setAttribute('d',line.getAttribute('d'));
+ hit.setAttribute('pathLength','100');
+ hit.setAttribute('stroke-dasharray','0 6 88 6');
+ svg.appendChild(hit);
+ }
+ }
+ if(!dragging)syncVisibleWireDots(svg);
+}
+
+/* Only visible SVG cables paint matching physical dot hue/opacity.
+ No RAF repaint and no forced active light on hidden/off-bank channels. */
+function syncVisibleWireDots(svg){
+ const visible=new Map();
+ // Physical WIRE material follows accepted edges only; legacy SEND/OUT/split
+ // metadata remains in Navigator but cannot light an unplugged WIRE jack.
+ const committed=wireEdges.filter(e=>e.enabled);
+ const custom=committed.filter(e=>e.destId!==master.id);
+ const arrivals=new Set(custom.map(e=>String(e.destId)));
+ const sends=new Set(custom.map(e=>String(e.sourceId)));
+ for(const path of svg.querySelectorAll('path.wire-incoming-line,path.wire-outgoing-line,path.wire-context-line')){
+ // A hover hint is not a plugged-in cable. Keep snap/hover illumination
+ // independent of physical connection state and endpoint paint.
+ if(path.dataset.routeKind==='preview'||
+ !wireFor(Number(path.dataset.from),Number(path.dataset.to)))continue;
+ const color=path.getAttribute('stroke'),opacity=Number(path.getAttribute('opacity'));
+ if(!color||!Number.isFinite(opacity))continue;
+ for(const [id,direction] of [[path.dataset.from,'out'],[path.dataset.to,'in']]){
+ const key=id+':'+direction;
+ if(!id||(visible.has(key)&&visible.get(key).opacity>=opacity))continue;
+ visible.set(key,{color,opacity});
+ }
+ }
+ for(const node of document.querySelectorAll('.strip .wire-node-out,.strip .wire-node-in')){
+ const isInput=node.classList.contains('wire-node-in');
+ const trackId=node.closest('.strip')?.dataset.id;
+ const key=trackId+':'+(isInput?'in':'out');
+ const connected=isInput?committed.some(e=>String(e.destId)===trackId):sends.has(trackId);
+ if(connected)node.setAttribute('data-wire-connected','true');
+ else node.removeAttribute('data-wire-connected');
+ // Connected paint follows committed model; cable display focus never changes it.
+ // The receiving ring uses --ch (its own channel); the inner dot still
+ // uses the incoming wire's SVG hue and opacity.
+ if(isInput){
+ if(arrivals.has(trackId))node.setAttribute('data-wire-arrival','true');
+ else node.removeAttribute('data-wire-arrival');
+ }
+ const edge=visible.get(key);
+ // Visual paint follows the visible committed WIRE path, not a legacy
+ // SEND or an off-bank hidden connection. Keep graph state separate.
+ node.dataset.wirePaint=(edge||( !isInput&&sends.has(trackId)))?'connected':'idle';
+ if(!edge){
+ if(!isInput&&sends.has(trackId)){
+ const t=tracks.find(x=>String(x.id)===trackId);
+ if(t)node.style.setProperty('--wire-edge-color',t.color);
+ node.style.setProperty('--wire-edge-opacity','1');
+ }
+ node.removeAttribute('data-wire-visible');
+ if(isInput||!sends.has(trackId)){
+ node.style.removeProperty('--wire-edge-color');
+ node.style.removeProperty('--wire-edge-opacity');
+ }
+ continue;
+ }
+ node.setAttribute('data-wire-visible','true');
+ if(node.style.getPropertyValue('--wire-edge-color')!==edge.color)node.style.setProperty('--wire-edge-color',edge.color);
+ const alpha=String(edge.opacity);
+ if(node.style.getPropertyValue('--wire-edge-opacity')!==alpha)node.style.setProperty('--wire-edge-opacity',alpha);
+ }
+}
+/* A wire can be selected without changing the armed source. The existing
+ route inspector remains the non-drag remove/accessibility alternative. */
+document.getElementById('wireLayer').addEventListener('click',ev=>{
+ const hit=ev.target.closest?.('path.wire-interaction-hit');
+ if(!hit)return;
+ const edge=wireEdges.find(e=>e.enabled&&e.id===Number(hit.dataset.edgeId));
+ if(!edge)return;
+ ev.stopPropagation();selectWireEdge(edge);
+});
+document.getElementById('wireLayer').addEventListener('dblclick',ev=>{
+ const hit=ev.target.closest?.('path.wire-interaction-hit');
+ const edge=hit&&wireEdges.find(e=>e.enabled&&e.id===Number(hit.dataset.edgeId));
+ if(!edge)return;
+ ev.stopPropagation();selectWireEdge(edge,true);
+});
+function queueWireGestureFrame(){
+ if(wireFramePending)return;
+ wireFramePending=true;
+ requestAnimationFrame(()=>{
+ wireFramePending=false;
+ if(!wireGesture?.active)return;
+ const snap=wireSnapTarget(wireGesture.point,wireGesture.sourceId,wireGesture.originDestId);
+ wireGesture.snapId=snap?.track.id??null;
+ setWireSnapTarget(wireGesture.snapId);
+ renderWireRouting();
+ });
+}
+function syncActiveSend(t){
+ if(t.kind==='master'||t.kind==='fx')return;
+ t.sendSlots[t.activeSend]={send:t.send,sendOn:t.sendOn,pre:t.pre,sendLevel:t.sendLevel,sendPan:t.sendPan};
+}
+function openSendSlot(t,index){
+ syncActiveSend(t);t.activeSend=index;
+ Object.assign(t,clone(t.sendSlots[index]));
+}
+function wouldFeedback(source,destination){
+ const first=tracks.find(x=>(x.kind==='bus'||x.kind==='fx')&&x.name===destination);
+ if(!first)return false;
+ const seen=new Set(),pending=[first];
+ while(pending.length){
+ const current=pending.pop();
+ if(current.id===source.id)return true;
+ if(seen.has(current.id))continue;seen.add(current.id);
+ const outgoing=[current.output];
+ if(current.kind==='bus'){
+ current.sendSlots.forEach((slot,i)=>{const live=i===current.activeSend?{send:current.send,sendOn:current.sendOn}:slot;if(live.sendOn)outgoing.push(live.send);});
+ }
+ outgoing.forEach(name=>{const next=tracks.find(x=>(x.kind==='bus'||x.kind==='fx')&&x.name===name);if(next&&!seen.has(next.id))pending.push(next);});
+ }
+ return false;
+}
+const COPY_KEYS=['fx','slotBypass','fxOn','eq','pan','trim','mute','solo','level'];
+function copyChannels(){
+ const src=selection()[0];if(!src){say('Select a channel to copy settings');return;}
+ clipboard=Object.fromEntries(COPY_KEYS.map(k=>[k,clone(src[k])]));
+ say('Copied mixer settings from '+src.name+' (does not copy hardware I/O)');
+}
+function pasteChannels(){
+ if(!clipboard){say('No channel settings in clipboard');return;}
+ const list=selection();if(!list.length){say('Select destination channels before pasting');return;}
+ for(const t of list){
+ for(const k of COPY_KEYS){
+ if((t.kind==='master'||t.kind==='fx')&&['send','sendOn','pre','sendLevel','sendPan','activeSend','sendSlots'].includes(k))continue;
+ if((k==='send')&&wouldFeedback(t,clipboard[k]))continue;
+ t[k]=clone(clipboard[k]);
+ }
+ }
+ render();say('Pasted compatible settings to '+list.length+' selected channel(s) · hardware I/O unchanged');
+}
+function refreshScenes(){
+ const el=document.getElementById('sceneSelect'),selected=el.value;
+ el.innerHTML=''+scenes.map((x,i)=>'').join('');
+ if(selected&&scenes[Number(selected)])el.value=selected;
+}
+function saveScene(){
+ const name='Scene '+(scenes.length+1);
+ scenes.push({name,wireGraphVersion:1,nextId,nextGroup,wireEdges:clone(wireEdges),nextWireId,wireMode,wireSourceId,wireAnchorId,tracks:clone(tracks),master:clone(master),filter:document.getElementById('viewFilter').value,narrow:document.querySelector('.console-body').classList.contains('narrow'),density:document.querySelector('.console-body').dataset.density||'comfort'});
+ refreshScenes();document.getElementById('sceneSelect').value=String(scenes.length-1);
+ say('Scene saved: '+scenes[scenes.length-1].name+' · local reference session only');
+}
+function recallScene(){
+ const value=document.getElementById('sceneSelect').value;
+ if(value===''){say('Choose a saved Scene');return;}
+ const scene=scenes[Number(value)];if(!scene)return;
+ const protectedChannels=new Map(tracks.concat(master).filter(t=>t.safe).map(t=>[t.id,clone(t)]));
+ let nextTracks=clone(scene.tracks).map(t=>protectedChannels.get(t.id)||t);
+ for(const [id,t] of protectedChannels)if(t.kind!=='master'&&!nextTracks.some(x=>x.id===id))
+ nextTracks.push(t);
+ const nextMaster=protectedChannels.get(master.id)||clone(scene.master);
+ if(nextMaster.id!==master.id){say('SCENE REJECTED: MAIN identity changed');return;}
+ const migrated=ArSonWireGraph.migrateLegacy(nextTracks,nextMaster.id,
+ clone(scene.wireEdges||[]),scene.nextWireId||1,{graphVersion:scene.wireGraphVersion||0});
+ if(!migrated.ok){say('SCENE REJECTED: '+migrated.error);return;}
+ const protectedIds=new Set(protectedChannels.keys());
+ const retain=wireEdges.filter(e=>protectedIds.has(e.sourceId)||protectedIds.has(e.destId));
+ let nextEdges=migrated.edges.filter(e=>!protectedIds.has(e.sourceId)&&!protectedIds.has(e.destId));
+ const taken=new Set(retain.map(e=>e.id));
+ let seq=Math.max(1,scene.nextWireId||1,...retain.map(e=>e.id+1),...nextEdges.map(e=>e.id+1));
+ nextEdges=nextEdges.map(e=>{if(taken.has(e.id))e.id=seq++;taken.add(e.id);return e;});
+ nextEdges=[...retain,...nextEdges];
+ const valid=ArSonWireGraph.validateCandidateGraph(nextTracks,nextMaster.id,nextEdges);
+ if(!valid.ok){say('SCENE REJECTED: '+valid.error+' · current graph kept');return;}
+ if(sofEnabled)toggleSof(false);
+ tracks=nextTracks;master=nextMaster;wireEdges=nextEdges;
+ nextId=Math.max(scene.nextId||1,...tracks.map(t=>t.id+1),master.id+1);
+ nextGroup=scene.nextGroup||1;nextWireId=Math.max(seq,...wireEdges.map(e=>e.id+1),1);
+ wireMode=scene.wireMode||'send';wireSourceId=scene.wireSourceId||null;
+ wireAnchorId=scene.wireAnchorId??null;selectedWireEdgeId=null;
+ wireWsHistory=[];wireWsInspect=null;wireWsRemoveConfirm=null;
+ document.getElementById('wireMode').value=wireMode;
+ document.getElementById('viewFilter').value=scene.filter;
+ syncWireOutputProjection();
+ setDensity(scene.density||(scene.narrow?'compact':'comfort'));
+ render();say('Scene '+scene.name+' accepted · reference graph only');
+}
+function groupSelected(){
+ const selected=selection().filter(t=>t.kind!=='master');
+ if(selected.length<2){say('Ctrl-click at least two channels to create a group');return;}
+ const group='G'+nextGroup++;selected.forEach(t=>t.group=group);
+ render();say('Linked '+selected.length+' channels in '+group+' (relative faders and M/S)');
+}
+function ungroupSelected(){
+ const selected=selection().filter(t=>t.kind!=='master'),groups=new Set(selected.map(t=>t.group).filter(Boolean));
+ tracks.forEach(t=>{if(groups.has(t.group))t.group=null;});
+ render();say(groups.size?'Removed '+groups.size+' channel group(s)':'Select a grouped channel to ungroup');
+}
+function handleField(event){
+ const el=event.target,field=el.dataset.field;if(!field)return;
+ const t=findTrack(el);if(!t)return;
+ if(field==='wireGain'){
+ const edge=wireEdges.find(x=>x.id===Number(el.dataset.wireId)&&x.destId===t.id);
+ if(!edge){say('WIRE gain rejected: stale connection');return;}
+ const previous=edge.levelDb;
+ if(!wireGraphCommit([{type:'GAIN',sourceId:edge.sourceId,edgeId:edge.id,
+ levelDb:wireGainValue(el.value)}],{record:false})){el.value=previous;return;}
+ const accepted=wireFor(edge.sourceId,edge.destId);
+ if(el.style?.setProperty)el.style.setProperty('--wire-pct',wireGainPercent(accepted.levelDb)+'%');
+ if(el.parentElement?.style?.setProperty){el.parentElement.style.setProperty('--wire-pct',wireGainPercent(accepted.levelDb)+'%');el.parentElement.style.setProperty('--wire-deg',(-135+wireGainPercent(accepted.levelDb)*2.7).toFixed(1)+'deg');}
+ if(el.parentElement)el.parentElement.title=wireDbText(accepted.levelDb);
+ if(event.type==='change')say('WIRE '+tracks.find(x=>x.id===edge.sourceId)?.name+' → '+t.name+' · '+wireDbText(accepted.levelDb)+' · GUI DEMO ONLY');
+ return;
+ }
+ if(field==='fx'){t.fx[Number(el.dataset.slot)]=el.value;t.slotBypass[Number(el.dataset.slot)]=false;say(t.name+' · FX '+(Number(el.dataset.slot)+1)+': '+el.value);refreshStrip(t);}
+ else if(field==='level'){
+ if(sofEnabled&&t.kind==='audio'){
+ if(setSofLevel(t,Number(el.value))){const readout=el.closest('.strip')?.querySelector('.db-value');if(readout)readout.textContent='S '+formatDb(getSofLevel(t));syncFaderVisual(t,el.closest('.strip'));if(event.type==='change')say(t.name+' → '+sofTarget+' send '+formatDb(getSofLevel(t))+' dB');}
+ else el.value=getSofLevel(t);
+ return;
+ }
+ const old=t.level;t.level=Number(el.value);
+ const root=el.closest('.strip');syncFaderVisual(t,root);
+ if(t.group&&!event.altKey){
+ const delta=t.level-old;
+ tracks.filter(peer=>peer.group===t.group&&peer.id!==t.id).forEach(peer=>{
+ peer.level=Math.max(-60,Math.min(10,Math.round((peer.level+delta)*10)/10));
+ const other=document.querySelector('.strip[data-id="'+peer.id+'"]');
+ if(other){const fader=other.querySelector('.fader'),db=other.querySelector('.db-value');if(fader)fader.value=peer.level;if(db)db.textContent=formatDb(peer.level);syncFaderVisual(peer,other);}
+ });
+ }
+ if(event.type==='change')say(t.name+' fader '+formatDb(t.level)+' dB'+(t.group?' (linked '+t.group+')':''));
+}
+ else if(field==='pan'){
+ let value=Number(el.value);if(!Number.isFinite(value))return;
+ value=Math.max(-100,Math.min(100,value));
+ // Hardware-like center detent: capture inside ±7, hold through ±12,
+ // release outside ±12. A finished drag inside ±12 snaps to dead center.
+ // Keyboard arrows remain fine-resolution (bypass sticky detent).
+ const keyboard=el.dataset.panKeyboard==='true';
+ const bypass=!!event.altKey||el.dataset.panAltPointer==='true';
+ const latched=el.dataset.panDetent==='true';
+ const range=event.type==='change'?12:latched?12:7;
+ if(!keyboard&&!bypass&&Math.abs(value)<=range){value=0;el.value='0';}
+ el.dataset.panDetent=String(!keyboard&&value===0&&!bypass);
+ if(event.type==='change')delete el.dataset.panKeyboard;
+ t.pan=value;
+ el.setAttribute?.('aria-valuetext',value===0?'Center':value<0?'Left '+Math.abs(value):'Right '+value);
+ const wrapper=el.closest('.pan-control');
+ if(wrapper){wrapper.setAttribute('style',panStyle(value));wrapper.classList?.toggle('is-centered',value===0);}
+ const label=wrapper?wrapper.nextElementSibling:el.nextElementSibling;
+ if(label)label.textContent=panLabel(value);
+ if(event.type==='change')say(t.name+' pan '+panLabel(value));
+}
+ else if(field==='trim'){t.trim=Number(el.value);if(el.style?.setProperty)el.style.setProperty('--range-pct',rangePct(t.trim,-24,24)+'%');const readout=el.closest('.trim-section')?.querySelector('.trim-value');if(readout)readout.textContent=formatDb(t.trim);if(event.type==='change')say(t.name+' digital trim '+formatDb(t.trim)+' dB');}
+ else if(field==='sendLevel'){t.sendLevel=Number(el.value);if(el.style?.setProperty)el.style.setProperty('--range-pct',rangePct(t.sendLevel,-60,6)+'%');el.nextElementSibling.textContent=formatDb(t.sendLevel);}
+ else if(field==='sendPan'){t.sendPan=Number(el.value);el.nextElementSibling.textContent=t.sendPan===0?'C':t.sendPan<0?'L'+Math.abs(t.sendPan):'R'+t.sendPan;}
+ else if(field==='activeSend'){const slot=Number(el.value.slice(1))-1;if(slot<0||slot>=16)return;openSendSlot(t,slot);refreshStrip(t);say(t.name+' · selected Send '+(slot+1));return;}
+ else if(field==='output'){
+ if(t.kind==='master'){t.output=el.value;say('Physical MAIN output → '+el.value+' · reference only');return;}
+ const current=wireEdges.find(edge=>edge.sourceId===t.id&&edge.kind==='primary');
+ const selected=el.value,dest=selected==='Master'?master:tracks.find(ch=>ch.name===selected);
+ const ops=[];
+ if(selected==='SOURCE ONLY (No Main)'){
+ if(current)ops.push({type:'REMOVE',sourceId:t.id,edgeId:current.id});
+ }else if(dest&&dest.kind==='master'){
+ if(current&¤t.destId!==master.id)ops.push({type:'REMOVE',sourceId:t.id,edgeId:current.id});
+ if(!wireFor(t.id,master.id))ops.push({type:'CONNECT',sourceId:t.id,destId:master.id});
+ }else if(dest){
+ ops.push({type:'ROUTE_ONLY',sourceId:t.id,destId:dest.id});
+ }else{
+ say('Unsupported internal OUT: use physical I/O setup');
+ refreshStrip(t);return;
+ }
+ if(ops.length&&!wireGraphCommit(ops)){refreshStrip(t);return;}
+ render();say('OUT '+t.name+' → '+t.output+' · canonical graph reference');return;
+ }
+ else if(field==='input'){
+ const split=parseSplitSource(el.value);
+ const ops=wireEdges.filter(e=>e.destId===t.id&&e.kind==='split').map(e=>
+ ({type:'REMOVE',sourceId:e.sourceId,edgeId:e.id}));
+ if(split){
+ if(!wireSourceTrack(split.sourceId)||split.sourceId===t.id){
+ say('SPLIT REJECTED: invalid source');refreshStrip(t);return;
+ }
+ ops.push({type:'CONNECT',sourceId:split.sourceId,destId:t.id,mode:
+ split.tap==='PRE'?'splitPre':'splitPost'});
+ }
+ if(ops.length&&!wireGraphCommit(ops)){refreshStrip(t);return;}
+ t.input=el.value;render();
+ say(split?'SPLIT accepted in reference graph · no native PCM':
+ t.name+' physical input → '+el.value+' · reference only');return;
+ }
+ else if(field==='send'){say('Legacy SEND slot is display-only; patch via WIRE');refreshStrip(t);return;}
+ else{t[field]=el.value;say(t.name+' '+field+' → '+el.value);}
+ if(['send','sendLevel','sendPan'].includes(field))syncActiveSend(t);
+ selectTrack(t);
+}
+
+/* Real pointer fader binding for the isolated reference.
+ One gesture, no rebuilding strips during drag, and source range remains keyboard-accessible.
+ The 29x62 visual cap center is aligned to this same travel ruler. */
+let faderGesture=null;
+const consoleBody=document.querySelector('.console-body');
+function setFaderFromPointer(ev,gesture){
+ const input=gesture.input,travel=gesture.travel?.getBoundingClientRect?.();
+ if(!travel||travel.height<=0)return;
+ const max=Number(input.max)||10,min=Number(input.min)||-60;
+ const frac=Math.max(0,Math.min(1,(ev.clientY-travel.top)/travel.height));
+ const gain=Math.round((max-(max-min)*frac)*10)/10;
+ input.value=String(gain);
+ handleField({target:input,type:'input',altKey:!!ev.altKey});
+}
+consoleBody.addEventListener('pointerdown',ev=>{
+ if(ev.button!==undefined&&ev.button!==0)return;
+ // The live receiving socket and its near-side well are a physical cable plug.
+ // Respect adjacent OUT, gain and remove targets, never steal their pointer.
+ const directIn=ev.target.closest?.('.wire-node-in');
+ const tray=!directIn?ev.target.closest?.('.wire-tray'):null;
+ const other=ev.target.closest?.('.wire-node-out,.wire-pot');
+ const socket=directIn||(!other?tray?.querySelector?.('.wire-node-in'):null);
+ const receiver=socket?findTrack(socket):null;
+ const activeSource=armedWireSource();
+ const selectedSources=selection().filter(t=>t.kind!=='master');
+ // MAIN has N summed incoming edges; the physical jack presents exactly ONE
+ // focused edgeId. Resolve that committed identity before pointer capture,
+ // rather than depending on selection timing or any hidden primary OUT field.
+ const mainEdgeId=receiver?.kind==='master'?
+ Number(socket.getAttribute('data-wire-main-edge')):null;
+ const focusedMainEdge=Number.isSafeInteger(mainEdgeId)&&mainEdgeId>0?
+ wireEdges.find(e=>e.enabled&&e.id===mainEdgeId&&e.destId===master.id):null;
+ const incoming=receiver?(receiver.kind==='master'?
+ (focusedMainEdge?[focusedMainEdge]:[]):incomingWireEdges(receiver.id)):[];
+ const existing=incoming.find(e=>e.id===selectedWireEdgeId)||
+ (incoming.length===1?incoming[0]:
+ (activeSource&&receiver?wireFor(activeSource.id,receiver.id):null));
+ const socketRect=existing?socket.getBoundingClientRect?.():null;
+ const near=!!socketRect&&Math.hypot(ev.clientX-(socketRect.left+socketRect.width/2),ev.clientY-(socketRect.top+socketRect.height/2))<=22;
+ if(existing&&near){
+ wireSuppressClick=false;
+ wireGesture={pointerId:ev.pointerId,sourceId:existing.sourceId,originDestId:receiver.id,
+ movingEdgeId:existing.id,startX:ev.clientX,startY:ev.clientY,
+ point:{x:ev.clientX,y:ev.clientY},snapId:receiver.id,active:false};
+ ev.preventDefault?.();
+ socket.setPointerCapture?.(ev.pointerId);
+ return;
+ }
+ const node=ev.target.closest?.('.wire-node-out');
+ if(node){
+ const src=findTrack(node);
+ if(src&&src.kind!=='master'&&Number.isFinite(ev.clientX)&&Number.isFinite(ev.clientY)){
+ wireSuppressClick=false;
+ wireGesture={pointerId:ev.pointerId,sourceId:src.id,startX:ev.clientX,startY:ev.clientY,
+ point:{x:ev.clientX,y:ev.clientY},originDestId:null,movingEdgeId:null,snapId:null,active:false};
+ ev.preventDefault?.();
+ node.setPointerCapture?.(ev.pointerId);
+ return;
+ }
+ }
+ const pan=ev.target.closest?.('.center-pan');
+ if(pan){delete pan.dataset.panKeyboard;pan.dataset.panAltPointer=String(!!ev.altKey);return;}
+ const box=ev.target.closest?.('.fader-box');
+ if(!box)return;
+ const input=box.querySelector('.fader'),travel=box.querySelector('.fader-travel');
+ if(!input||!travel)return;
+ ev.preventDefault?.();
+ faderGesture={pointerId:ev.pointerId,box,input,travel};
+ box.setPointerCapture?.(ev.pointerId);
+ setFaderFromPointer(ev,faderGesture);
+});
+window.addEventListener('pointermove',ev=>{
+ if(wireGesture&&ev.pointerId===wireGesture.pointerId){
+ const g=wireGesture;
+ if(!Number.isFinite(ev.clientX)||!Number.isFinite(ev.clientY))return;
+ if(!g.active&&Math.hypot(ev.clientX-g.startX,ev.clientY-g.startY)>=(g.movingEdgeId!==null?10:5)){
+ g.active=true;wireHoverId=null; // source selection changes only on an accepted drop
+ if(g.movingEdgeId!==null)consoleBody.querySelector?.('.strip[data-id="'+g.originDestId+'"] .wire-node-in')?.classList.add('is-replug-origin');
+ consoleBody.classList.add('wire-dragging');
+ consoleBody.querySelector?.('.strip[data-id="'+g.sourceId+'"] .wire-node-out')?.classList.add('is-drag-origin');
+ }
+ if(g.active){g.point={x:ev.clientX,y:ev.clientY};queueWireGestureFrame();}
+ return;
+ }
+ if(!faderGesture||ev.pointerId!==faderGesture.pointerId)return;
+ setFaderFromPointer(ev,faderGesture);
+});
+function finishFaderPointer(ev){
+ if(wireGesture&&ev.pointerId===wireGesture.pointerId){
+ const g=wireGesture;
+ const snap=g.active?wireSnapTarget({x:ev.clientX,y:ev.clientY},g.sourceId,g.originDestId,'release'):null;
+ wireGesture=null;setWireSnapTarget(null);
+ consoleBody.querySelector?.('.strip[data-id="'+g.originDestId+'"] .wire-node-in')?.classList.remove('is-replug-origin');
+ consoleBody.classList.remove('wire-dragging');
+ consoleBody.querySelectorAll?.('.wire-node-out.is-drag-origin').forEach(n=>n.classList.remove('is-drag-origin'));
+ if(g.active){
+ if(g.movingEdgeId!==null){
+ const bay=consoleBody.querySelector('.strip .send-section')?.getBoundingClientRect();
+ const vp=document.getElementById('viewport')?.getBoundingClientRect();
+ const masterBay=masterEl.querySelector('.send-section')?.getBoundingClientRect();
+ const blankMainBay=!snap&&masterBay&&ev.clientX>=masterBay.left&&
+ ev.clientX<=masterBay.right&&ev.clientY>=masterBay.top&&ev.clientY<=masterBay.bottom;
+ const blankInBay=!snap&&((bay&&vp&&ev.clientX>=vp.left&&ev.clientX<=vp.right&&
+ ev.clientY>=bay.top&&ev.clientY<=bay.bottom)||blankMainBay);
+ const edge=wireEdges.find(e=>e.id===g.movingEdgeId&&e.destId===g.originDestId);
+ if(!edge||(!snap&&!blankInBay)){
+ say('WIRE drop canceled · invalid area; routing unchanged');
+ }else{
+ const before=wireWsSnapshot();
+ if(replugWireEdge(g.sourceId,g.originDestId,snap?.track.id??null)){
+ wireWsRecord(before);
+ selectedWireEdgeId=snap?g.movingEdgeId:null;
+ }
+ }
+ }else{
+ const hit=document.elementFromPoint?.(ev.clientX,ev.clientY)||ev.target;
+ const input=snap?.element||hit?.closest?.('.wire-node-in');
+ const target=snap?.track||(input?findTrack(input):null),source=wireSourceTrack(g.sourceId);
+ if(target&&source&&target.id!==source.id){
+ wireSourceId=source.id;wireSourcePinned=true;wireIntent=true;wireAnchorId=target.id;
+ requestWireConnection(source,target,input);
+ }else say('WIRE drop canceled · release in destination WIRE bay (graph unchanged)');
+ }
+ renderWireRouting();wireSuppressClick=true;
+ }else if(g.sourceId){wireSuppressClick=false;}
+ return;
+ }
+ for(const pan of consoleBody.querySelectorAll?.('.center-pan[data-pan-alt-pointer]')||[])
+ delete pan.dataset.panAltPointer;
+ if(!faderGesture||ev.pointerId!==faderGesture.pointerId)return;
+ setFaderFromPointer(ev,faderGesture);
+ const g=faderGesture;faderGesture=null;
+ g.box.releasePointerCapture?.(ev.pointerId);
+ const t=findTrack(g.input);
+ if(t)say(t.name+' fader '+formatDb(sofEnabled&&t.kind==='audio'?getSofLevel(t):t.level)+' dB');
+}
+window.addEventListener('pointerup',finishFaderPointer);
+window.addEventListener('pointercancel',ev=>{
+ if(wireGesture&&ev.pointerId===wireGesture.pointerId){const g=wireGesture;wireGesture=null;setWireSnapTarget(null);consoleBody.querySelector?.('.strip[data-id="'+g.originDestId+'"] .wire-node-in')?.classList.remove('is-replug-origin');consoleBody.classList.remove('wire-dragging');consoleBody.querySelectorAll?.('.wire-node-out.is-drag-origin').forEach(n=>n.classList.remove('is-drag-origin'));renderWireRouting();say('WIRE drag canceled · graph unchanged');}
+ if(faderGesture&&ev.pointerId===faderGesture.pointerId)faderGesture=null;
+ for(const pan of consoleBody.querySelectorAll?.('.center-pan[data-pan-alt-pointer]')||[])
+ delete pan.dataset.panAltPointer;
+});
+
+consoleBody.addEventListener('keydown',event=>{
+ const el=event.target.closest?.('.center-pan');
+ if(el&&['ArrowLeft','ArrowRight','ArrowUp','ArrowDown','PageUp','PageDown','Home','End'].includes(event.key))
+ el.dataset.panKeyboard='true';
+});
+document.querySelector('.console-body').addEventListener('input',handleField);
+document.querySelector('.console-body').addEventListener('change',handleField);
+document.querySelector('.console-body').addEventListener('click',e=>{
+ const btn=e.target.closest('[data-action]');if(!btn)return;
+ const t=findTrack(btn);if(!t)return;
+ const a=btn.dataset.action;
+ if(a==='wireExpand'){document.querySelector('.section-rail [data-section="send"]')?.click();return;}
+ if(a==='resetClip'){
+ t.clip=false;btn.classList.remove('clipping');
+ btn.closest('.fader-section')?.querySelector('.peak')?.classList.remove('clipping');
+ say(t.name+' · clip latch cleared');return;
+ }
+ if(wireSuppressClick&&['wireSource','wireRoute'].includes(a)){wireSuppressClick=false;return;}
+ if(a==='wireSource'){
+ selectWireSource(t);return;
+ }
+ if(a==='wireRoute'){
+ const source=armedWireSource();
+ const inbound=t.kind==='master'?[]:wireWsRoutes().filter(route=>route.destId===t.id);
+ // An armed OUT has priority for a NEW route, including BUS receivers
+ // already fed by other channels. Inspect only without a valid armed source,
+ // on the source's own IN, or when that exact source -> IN already exists.
+ // This preserves Route Only / Parallel and avoids implicit disconnects.
+ const sourceAlreadyInbound=!!source&&inbound.some(route=>route.sourceId===source.id);
+ if(t.kind!=='master'&&inbound.length&&(!source||t.id===source.id||sourceAlreadyInbound)){
+ inspectIncomingWireRoutes(t);return;
+ }
+ if(t.kind==='master'){
+ const selected=selection().filter(x=>x.kind!=='master');
+ const focused=source||(selected.length===1?selected[0]:null);
+ if(!focused){say('Select one channel to inspect MAIN');return;}
+ const edge=wireFor(focused.id,master.id);
+ if(edge){selectWireEdge(edge);return;}
+ requestWireConnection(focused,t,btn);return;
+ }
+ if(!source||t.id===source.id){say('Select a source and another destination');return;}
+ if(e.shiftKey&&wireAnchorId!==null){wireConnectRange(source,wireAnchorId,t.id);wireAnchorId=t.id;return;}
+ requestWireConnection(source,t,btn);wireAnchorId=t.id;return;
+ }
+ if(a==='rename'||a==='editIdentity')return; // double-click edits; single-click selects
+ if(a==='format'&&t.kind==='audio'){t.format=t.format==='mono'?'stereo':'mono';refreshStrip(t);say(t.name+' processing → '+t.format.toUpperCase()+' · physical source '+t.input+' unchanged (reference only)');return;}
+ if(a==='openPlugin'){openFastPicker(t,Number(btn.dataset.slot),btn);return;}
+ if(a==='removeFx'){if(deferNativeFxIntent('Remove FX insert'))return;const i=Number(btn.dataset.slot);t.fx[i]='None';t.slotBypass[i]=false;if(t.fxInsertIds)t.fxInsertIds[i]=null;fxReorderUndo=null;refreshStrip(t);say(t.name+' · cleared FX insert '+(i+1));return;}
+ if(a==='slotPower'){if(deferNativeFxIntent('FX insert bypass'))return;const slot=Number(btn.dataset.slot);if(t.fx[slot]==='None'){say(t.name+': choose an effect before toggling bypass');return;}t.slotBypass[slot]=!t.slotBypass[slot];refreshStrip(t);say(t.name+': FX '+(slot+1)+(t.slotBypass[slot]?' bypassed':' enabled'));return;}
+ if(a==='eq')t.eq=!t.eq;
+ else if(a==='fxOn'){if(deferNativeFxIntent('FX chain bypass'))return;t.fxOn=!t.fxOn;}
+ else if(a==='pre'){t.pre=!t.pre;syncActiveSend(t);}
+ else if(a==='sendOn'){say('Legacy SEND disabled; patch via WIRE');return;}
+ else if(['mute','solo','cue','mon','phase'].includes(a)){
+ t[a]=!t[a];
+ if(t.group&&(a==='mute'||a==='solo')){
+ tracks.filter(other=>other.group===t.group&&other.id!==t.id).forEach(other=>{other[a]=t[a];refreshStrip(other);});
+ }
+ }
+ refreshStrip(t);selectTrack(t);if(a==='solo'&&document.getElementById('viewFilter').value==='solo')render();say(t.name+': '+a+' '+(t[a]?'on':'off'));
+});
+document.querySelector('.console-body').addEventListener('dblclick',e=>{
+ const t=findTrack(e.target);if(!t)return;
+ if(e.target.closest?.('.wire-gain,.wire-pot')){
+ const el=e.target.closest('.wire-pot')?.querySelector('.wire-gain')||e.target.closest('.wire-gain');el.value='0';handleField({target:el,type:'change'});return;
+ }
+ if(e.target.classList.contains('fader')){t.level=0;refreshStrip(t);say(t.name+' fader reset to 0.0 dB');}
+ if(e.target.classList.contains('center-pan')){t.pan=0;refreshStrip(t);say(t.name+' pan centered');}
+ if(e.target.closest('.footer-label,.strip-identity-top'))openChannelIdentity(t,e.target);
+});
+/* V16: rearrange channel model order by stable IDs, never swap signal
+ processors, channel IDs, existing patch edges, or pinned MAIN. */
+let channelDragId=null;
+function moveChannelTo(id,destId,after=false){
+ if(id===destId)return false;
+ const i=tracks.findIndex(t=>t.id===id),dest=tracks.find(t=>t.id===destId);
+ if(i<0||!dest)return false;
+ const item=tracks.splice(i,1)[0],j=tracks.indexOf(dest);
+ tracks.splice(j+(after?1:0),0,item);
+ return true;
+}
+function clearChannelDrag(){
+ channelDragId=null;
+ document.querySelectorAll('#tracks .strip').forEach(el=>
+ el.classList.remove('channel-dragging','channel-drop-before','channel-drop-after'));
+}
+const arrangeSurface=document.querySelector('.console-body');
+arrangeSurface.addEventListener('dragstart',e=>{
+ const header=e.target.closest?.('.strip-identity-top[draggable="true"]');
+ if(!header)return;
+ const t=findTrack(header);if(!t||t.kind==='master')return;
+ channelDragId=t.id;
+ e.dataTransfer?.setData('application/x-arsonmix-channel',String(t.id));
+ if(e.dataTransfer)e.dataTransfer.effectAllowed='move';
+ header.closest('.strip').classList.add('channel-dragging');
+},true);
+arrangeSurface.addEventListener('dragover',e=>{
+ if(channelDragId===null)return;
+ const target=e.target.closest?.('#tracks .strip');if(!target)return;
+ e.preventDefault();
+ if(e.dataTransfer)e.dataTransfer.dropEffect='move';
+ document.querySelectorAll('#tracks .strip').forEach(el=>
+ el.classList.remove('channel-drop-before','channel-drop-after'));
+ const after=e.clientX>=target.getBoundingClientRect().left+target.getBoundingClientRect().width/2;
+ target.classList.add(after?'channel-drop-after':'channel-drop-before');
+},true);
+arrangeSurface.addEventListener('drop',e=>{
+ if(channelDragId===null)return;
+ e.preventDefault();e.stopPropagation();
+ const target=e.target.closest?.('#tracks .strip'),id=channelDragId;
+ const destId=Number(target?.dataset.id);
+ const after=!!target&&e.clientX>=target.getBoundingClientRect().left+target.getBoundingClientRect().width/2;
+ clearChannelDrag();
+ if(!target||!moveChannelTo(id,destId,after))return;
+ const t=tracks.find(x=>x.id===id);
+ render();say(t.name+' moved to strip '+(tracks.indexOf(t)+1)+' · signal routing unchanged');
+},true);
+arrangeSurface.addEventListener('dragend',clearChannelDrag,true);
+arrangeSurface.addEventListener('keydown',e=>{
+ if(!e.altKey||!['ArrowLeft','ArrowRight'].includes(e.key))return;
+ const top=e.target.closest?.('.strip-identity-top');if(!top)return;
+ const t=findTrack(top),i=t?tracks.indexOf(t):-1,step=e.key==='ArrowRight'?1:-1;
+ if(i<0||i+step<0||i+step>=tracks.length)return;
+ e.preventDefault();e.stopPropagation();
+ if(!moveChannelTo(t.id,tracks[i+step].id,step>0))return;
+ render(Math.floor((i+step)/bankCapacity()));
+ document.querySelector('#tracks .strip[data-id="'+t.id+'"] .strip-identity-top')?.focus();
+ say(t.name+' moved '+(step>0?'right':'left')+' · channel ID unchanged');
+},true);
+/* FX V53: the focused 16px grip alone owns drag; no row-wide HTML DnD.
+ No state mutation on dragover, cross-channel drop, Escape, or dragend. */
+function clearFxDrag(){
+ fxDrag=null;
+ consoleBody.querySelectorAll('.fxslot-row').forEach(row=>
+ row.classList.remove('dragged','drop-before','drop-after'));
+}
+consoleBody.addEventListener('dragstart',e=>{
+ const grip=e.target.closest?.('.fx-grip[draggable="true"]');
+ if(!grip||!e.dataTransfer)return;
+ const row=grip.closest('.fxslot-row'),t=findTrack(grip),slot=Number(row?.dataset.slot);
+ if(!t||!Number.isInteger(slot)||t.fx[slot]==='None'||fxNativeTransactionRequired()){
+ e.preventDefault();say('FX reorder unavailable without accepted native operation');return;
+ }
+ ensureFxInsertIds(t);
+ const insertId=t.fxInsertIds[slot]?.id;
+ if(!insertId||insertId!==grip.dataset.insertId){e.preventDefault();return;}
+ fxDrag={channelId:t.id,slot,insertId};
+ e.dataTransfer.effectAllowed='move';
+ e.dataTransfer.setData('application/x-arsonmix-fx',t.id+':'+insertId);
+ row.classList.add('dragged');
+},true);
+consoleBody.addEventListener('dragover',e=>{
+ if(!fxDrag)return;
+ const row=e.target.closest?.('.fxslot-row'),t=row&&findTrack(row);
+ if(!row)return;
+ e.preventDefault();
+ const slot=Number(row.dataset.slot);
+ const valid=t?.id===fxDrag.channelId&&t.fx[slot]!=='None'&&slot!==fxDrag.slot;
+ if(e.dataTransfer)e.dataTransfer.dropEffect=valid?'move':'none';
+ consoleBody.querySelectorAll('.fxslot-row').forEach(x=>x.classList.remove('drop-before','drop-after'));
+ if(valid)row.classList.add(slot{
+ if(!fxDrag)return;
+ const row=e.target.closest?.('.fxslot-row');
+ if(!row){clearFxDrag();return;}
+ e.preventDefault();e.stopPropagation();
+ const gesture=fxDrag,t=findTrack(row),to=Number(row.dataset.slot);
+ clearFxDrag();
+ if(!t||t.id!==gesture.channelId){say('Cross-channel FX transfer refused: native plugin state/lease not transferable');return;}
+ ensureFxInsertIds(t);
+ if(t.fxInsertIds[gesture.slot]?.id!==gesture.insertId){say('FX reordered elsewhere; canceled stale drag');return;}
+ if(!moveReferenceFx(t,gesture.slot,to))say('FX move canceled · order unchanged');
+},true);
+consoleBody.addEventListener('dragend',clearFxDrag,true);
+consoleBody.addEventListener('keydown',e=>{
+ const grip=e.target.closest?.('.fx-grip');
+ if(!grip)return;
+ const t=findTrack(grip),from=Number(grip.dataset.slot);
+ if(!t)return;
+ if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()==='z'){
+ e.preventDefault();undoReferenceFx(t);return;
+ }
+ if(e.altKey&&!e.ctrlKey&&!e.metaKey&&['ArrowUp','ArrowDown'].includes(e.key)){
+ e.preventDefault();
+ const used=t.fx.map((name,i)=>name==='None'?-1:i).filter(i=>i>=0);
+ const current=used.indexOf(from),next=used[current+(e.key==='ArrowUp'?-1:1)];
+ if(Number.isInteger(next)&&!moveReferenceFx(t,from,next))
+ say('FX move unavailable');
+ }
+},true);
+document.addEventListener('keydown',e=>{
+ if(e.key==='Escape'&&fxDrag){clearFxDrag();e.preventDefault();}
+},true);
+document.querySelector('.console-body').addEventListener('pointerover',e=>{
+ const btn=e.target.closest?.('[data-action="wireRoute"]');
+ const t=btn?findTrack(btn):null;
+ if(wireGesture?.active||!t||t.kind==='master'||t.id===wireSourceId||wireHoverId===t.id)return;
+ wireHoverId=t.id;renderWireRouting();
+});
+document.querySelector('.console-body').addEventListener('pointerout',e=>{
+ if(wireHoverId===null)return;
+ const btn=e.target.closest?.('[data-action="wireRoute"]');
+ if(!btn)return;
+ if(e.relatedTarget?.closest?.('[data-action="wireRoute"]')===btn)return;
+ wireHoverId=null;renderWireRouting();
+});
+// Pointer-relative knob: 198px of travel over 66dB instead of a 22px hit area.
+let sendKnobDrag=null;
+const sendControlSurface=document.querySelector('.console-body');
+sendControlSurface.addEventListener('pointerdown',e=>{
+ const pot=e.target.closest?.('.wire-pot:not(.is-idle)');
+ if(!pot||e.button!==0)return;
+ const input=pot.querySelector('.wire-gain');if(!input)return;
+ wireIntent=true;
+ sendKnobDrag={id:e.pointerId,pot,input,x:e.clientX,y:e.clientY,start:Number(input.value)||0};
+ const edge=wireEdges.find(x=>x.id===Number(input.dataset.wireId));
+ if(edge){wireSourceId=edge.sourceId;wireSourcePinned=true;}
+ pot.setPointerCapture?.(e.pointerId);e.preventDefault();e.stopPropagation();
+});
+sendControlSurface.addEventListener('pointermove',e=>{
+ const g=sendKnobDrag;if(!g||g.id!==e.pointerId)return;
+ const distance=e.clientX-g.x-(e.clientY-g.y),next=wireGainValue(g.start+distance/(e.shiftKey?14:3));
+ if(Number(g.input.value)!==next){g.input.value=String(next);handleField({target:g.input,type:'input'});}
+ e.preventDefault();
+});
+function finishSendKnob(e,cancel=false){
+ const g=sendKnobDrag;if(!g||g.id!==e.pointerId)return;
+ sendKnobDrag=null;g.pot.releasePointerCapture?.(e.pointerId);
+ if(cancel){g.input.value=String(g.start);handleField({target:g.input,type:'input'});say('SEND gain canceled · original gain restored');}
+ else handleField({target:g.input,type:'change'});
+ // Keep the SAME knob DOM through click/double-click. Replacing its node on pointerup
+ // swallows the second click and breaks unity reset. Only repaint the SVG/status.
+ renderWireRouting();e.preventDefault();
+}
+sendControlSurface.addEventListener('pointerup',e=>finishSendKnob(e));
+sendControlSurface.addEventListener('pointercancel',e=>finishSendKnob(e,true));
+/* V49: shared bounded range control for hardware mouse + precision trackpad.
+ Handle the physical fader face, not its intentionally pointer-inert input. */
+const wheelResidue=new WeakMap();
+document.querySelector('.console-body').addEventListener('wheel',e=>{
+ if(e.ctrlKey||wireGesture||faderGesture||!Number.isFinite(e.deltaY)||e.deltaY===0)return;
+ const target=e.target.closest?.('.wire-pot,.fader-box,input[type="range"]');
+ if(!target)return;
+ const input=target.matches?.('input[type="range"]')?target:
+ target.querySelector?.('input[type="range"]');
+ const allowed=new Set(['level','pan','wireGain','trim','sendLevel','sendPan']);
+ if(!input||input.disabled||!allowed.has(input.dataset.field))return;
+ const min=Number(input.min),max=Number(input.max),prev=Number(input.value);
+ if(![min,max,prev].every(Number.isFinite))return;
+ e.preventDefault();
+ const pixels=e.deltaY*(e.deltaMode===1?16:e.deltaMode===2?240:1);
+ const accumulated=(wheelResidue.get(input)||0)+pixels;
+ const detents=Math.trunc(accumulated/100);
+ wheelResidue.set(input,accumulated-detents*100);
+ if(!detents)return;
+ const step=e.shiftKey?(input.dataset.field==='pan'||input.dataset.field==='sendPan'?1:.1):
+ (input.dataset.field==='pan'||input.dataset.field==='sendPan'?2:.5);
+ const resolution=Number(input.step)||.1;
+ const next=Math.round(Math.max(min,Math.min(max,prev-detents*step))/resolution)*resolution;
+ if(next===prev)return;
+ input.value=String(next);
+ if(input.dataset.field==='pan')input.dataset.panKeyboard='true';
+ handleField({target:input,type:'input',altKey:e.altKey});
+},{passive:false});
+// Ordinary strip gestures may focus their channel, but touching the pinned
+// MAIN receive jack must never change the *source* under inspection. Capture
+// selection runs before bubble-phase wireGesture creation: selecting MAIN
+// here used to destroy the unique CH focus and made its plug undraggable.
+// MASTER identity remains separately selectable without affecting WIRE.
+consoleBody.addEventListener('pointerdown',e=>{
+ if(e.button!==0)return;
+ const t=findTrack(e.target);
+ if(t?.kind==='master'&&e.target.closest?.('.wire-node-in,.wire-tray,.wire-fold-summary'))
+ return;
+ if(t)selectTrack(t,e.ctrlKey||e.metaKey||e.shiftKey);
+},true);
+// Proximity uses one delegated pointer signal and static CSS, never a
+// per-frame wire redraw, audio operation or DOM remount.
+let nearWireOut=null;
+consoleBody.addEventListener('pointermove',e=>{
+ if(e.pointerType==='touch'||e.buttons||wireGesture?.active){
+ // A stale approach highlight must never survive dragging or canceled drops.
+ nearWireOut?.classList.remove('is-near');nearWireOut=null;return;
+ }
+ const tray=e.target.closest?.('.wire-tray');
+ let out=tray?.querySelector('.wire-node-out:not(:disabled)')||null;
+ if(out){
+ const r=out.getBoundingClientRect();
+ if(Math.hypot(e.clientX-(r.left+r.width/2),e.clientY-(r.top+r.height/2))>Math.max(r.width,r.height)/2+16)out=null;
+ }
+ if(nearWireOut!==out){
+ nearWireOut?.classList.remove('is-near');
+ nearWireOut=out;nearWireOut?.classList.add('is-near');
+ }
+});
+consoleBody.addEventListener('pointerleave',()=>{
+ nearWireOut?.classList.remove('is-near');nearWireOut=null;
+});
+// The 16px OUT proximity halo is clickable without enlarging its hardware.
+ // IN, knob and other data actions keep their own event owners.
+consoleBody.addEventListener('click',e=>{
+ if(e.target.closest?.('.wire-node-out,.wire-node-in,.wire-pot,[data-action]'))return;
+ const tray=e.target.closest?.('.wire-tray');
+ const out=tray?.querySelector('.wire-node-out.is-near:not(:disabled)');
+ const source=out?findTrack(out):null;
+ if(!source||source.kind==='master')return;
+ e.stopPropagation(); // explicit patch, not a click-away
+ selectWireSource(source);
+});
+// A click elsewhere releases the source; bank navigation, WIRE workspace
+// and route-choice remain in the active routing workflow.
+document.addEventListener('click',e=>{
+ if(!armedWireSource()||wireGesture||pendingBusRoute)return;
+ if(e.target.closest?.('.wire-node-out,.wire-node-in,.wire-pot,.wire-disconnect,#wireWorkspace,#wireConfigWindow,#wireNavigatorToggle,#wireMatrixToggle,#wireConfigToggle,[data-wire-open],#routeChoice,#bankPrev,#bankNext,#bankSelect,#viewFilter,#wireMaster,[data-wire-destination],[data-wire-jump-source],.wire-offbank-source,.wire-v34-tool'))return;
+ clearWireIntent();
+});
+window.addEventListener('blur',()=>{
+ if(armedWireSource()&&!wireGesture&&!pendingBusRoute)clearWireIntent();
+});
+document.querySelector('.section-rail').addEventListener('click',e=>{
+ const button=e.target.closest('[data-section]');if(!button)return;
+ const name=button.dataset.section,body=document.querySelector('.console-body');
+ if(body.classList.contains('narrow')&&['fx','send'].includes(name)){
+ say('Exit Narrow view before expanding '+name.toUpperCase());return;
+ }
+ const collapsed=body.classList.toggle('collapsed-'+name);
+ button.classList.toggle('collapsed',collapsed);
+ button.setAttribute('aria-expanded',String(!collapsed));
+ button.setAttribute('aria-pressed',String(!collapsed));
+ button.title=(collapsed?'Expand ':'Collapse ')+name.toUpperCase()+' section';
+ say((name==='send'?'WIRE PATCH BAY':name.toUpperCase())+(collapsed?' compact':' expanded')+' · FX rack and fader remain aligned');
+ requestAnimationFrame(renderWireRouting); // FX rack changed height; redraw only after layout, never on an audio tick
+});
+document.getElementById('viewFilter').addEventListener('change',()=>{render();say('Channel display filtered: '+document.getElementById('viewFilter').value);});
+document.getElementById('mode').addEventListener('click',()=>{
+ const compact=document.querySelector('.console-body').classList.contains('narrow');
+ const value=setDensity(compact?'comfort':'compact');
+ say('Mixer density: '+value+' · all live controls remain reachable');
+});
+document.getElementById('densitySelect').addEventListener('change',()=>{
+ const value=setDensity(document.getElementById('densitySelect').value);
+ say('Mixer density: '+value+' · Master remains pinned');
+});
+const moreTools=document.getElementById('moreTools');
+document.addEventListener('pointerdown',e=>{
+ if(moreTools.open&&!moreTools.contains(e.target))moreTools.open=false;
+},true);
+document.addEventListener('focusin',e=>{
+ if(moreTools.open&&!moreTools.contains(e.target))moreTools.open=false;
+},true);
+document.addEventListener('keydown',e=>{
+ if(e.key==='Escape'&&moreTools.open){moreTools.open=false;e.preventDefault();}
+});
+// Modeless configuration lives above the mixer: no persistent setup strip.
+function setWireConfig(open,restoreFocus=false){
+ const panel=document.getElementById('wireConfigWindow');
+ const trigger=document.getElementById('wireConfigToggle');
+ if(open&&wireWsOpen)document.getElementById('wireWsClose').click();
+ panel.hidden=!open;
+ trigger.setAttribute('aria-expanded',String(open));
+ if(open){renderWireRouting();document.getElementById('wireMode').focus();}
+ else if(restoreFocus)trigger.focus();
+}
+document.getElementById('wireConfigToggle').addEventListener('click',()=>{
+ setWireConfig(document.getElementById('wireConfigWindow').hidden);
+});
+document.getElementById('wireConfigClose').addEventListener('click',()=>setWireConfig(false,true));
+document.getElementById('wireConfigWindow').addEventListener('keydown',e=>{
+ if(e.key==='Escape'){e.preventDefault();e.stopPropagation();setWireConfig(false,true);}
+});
+document.getElementById('copy').addEventListener('click',copyChannels);
+document.getElementById('paste').addEventListener('click',pasteChannels);
+document.getElementById('group').addEventListener('click',groupSelected);
+document.getElementById('ungroup').addEventListener('click',ungroupSelected);
+document.getElementById('saveScene').addEventListener('click',saveScene);
+document.getElementById('recallScene').addEventListener('click',recallScene);
+document.getElementById('sceneSafe').addEventListener('click',setSnapshotSafe);
+function sayWireBankContext(base){
+ const source=armedWireSource();
+ const inBank=!!document.querySelector('#tracks .strip[data-id="'+source?.id+'"]');
+ say(source&&!inBank?'FROM CH'+String(source.id).padStart(2,'0')+' ('+source.name+') kept · click an IN on this bank · '+base:base);
+}
+/* V33 persistent source + universal cross-bank destination. Semantic routing graph
+ uses stable channel IDs: never infer patch identity from bank position. */
+
+/* V34 operator events: delegated inside one modeless WIRE workspace. */
+document.getElementById('wireNavigatorToggle').addEventListener('click',()=>wireWsToggle('find'));
+document.getElementById('wireMatrixToggle').addEventListener('click',()=>wireWsToggle('matrix'));
+document.querySelectorAll('[data-wire-open]').forEach(button=>button.addEventListener('click',()=>{
+ moreTools.open=false;
+ const mode=button.dataset.wireOpen;
+ if(mode==='config')setWireConfig(true);
+ else wireWsToggle(mode==='matrix'?'matrix':'find');
+}));
+document.getElementById('wireWsUndo').addEventListener('click',wireWsUndo);
+document.getElementById('wireWsClose').addEventListener('click',()=>{
+ wireWsOpen=false;document.getElementById('wireWorkspace').hidden=true;
+ document.getElementById('wireNavigatorToggle').setAttribute('aria-expanded','false');
+ document.getElementById('wireMatrixToggle').setAttribute('aria-expanded','false');
+});
+document.getElementById('wireWorkspace').addEventListener('keydown',e=>{
+ if(e.key==='Escape'){e.stopPropagation?.();document.getElementById('wireWsClose').click();}
+});
+document.getElementById('wireWorkspace').addEventListener('click',e=>{
+ const tab=e.target.closest?.('[data-ws-mode]');
+ if(tab){wireWsChooseMode(tab.dataset.wsMode);return;}
+ const jump=e.target.closest?.('[data-ws-jump]');
+ if(jump){wireWsJump(Number(jump.dataset.wsJump));return;}
+ const inspect=e.target.closest?.('[data-ws-inspect]');
+ if(inspect){
+ const parts=inspect.dataset.wsInspect.split(':').map(Number);
+ if(parts.length!==2||parts.some(x=>!Number.isInteger(x)))return;
+ wireWsInspect={src:parts[0],dst:parts[1]};wireWsRemoveConfirm=null;
+ renderWireWsInspector();return;
+ }
+ const disconnect=e.target.closest?.('[data-ws-remove]');
+ if(disconnect){
+ const key=disconnect.dataset.wsRemove;
+ if(wireWsRemoveConfirm!==key){wireWsRemoveConfirm=key;renderWireWsInspector();return;}
+ const parts=key.split(':').map(Number),edge=wireWsFindEdge(parts[0],parts[1]);
+ wireWsRemoveConfirm=null;wireWsInspect=null;
+ if(edge){const before=wireWsSnapshot();replugWireEdge(parts[0],parts[1],null);wireWsRecord(before);}
+ renderWireWorkspace();return;
+ }
+ const join=e.target.closest?.('[data-ws-join]');
+ if(!join)return;
+ const parts=join.dataset.wsJoin.split(':').map(Number);
+ if(parts.length!==2||parts.some(x=>!Number.isInteger(x)))return;
+ const src=wireSourceTrack(parts[0]),dst=wireSourceTrack(parts[1]);
+ if(!src||!dst||src.id===dst.id)return;
+ const info=wireWsRouteKind(src.id,dst.id,wireWsRoutes());
+ if(info){wireWsInspect={src:src.id,dst:dst.id};renderWireWsInspector();return;}
+ if(!wireWsCanJoin(src.id,dst.id)){
+ say('WIRE rejected: feedback cycle or invalid destination · graph unchanged');return;
+ }
+ // A matrix crosspoint explicitly sets FROM. Normal destination-first TO BUS
+ // never moves the displayed mixer bank or a third-party routing endpoint.
+ if(wireWsMode!=='bus'&&(!armedWireSource()||armedWireSource().id!==src.id))
+ selectWireSource(src);
+ const before=wireWsSnapshot();
+ requestWireConnection(src,dst,join);
+ if(document.getElementById('routeChoice')?.hidden===false)wireWsPendingBefore=before;
+ else wireWsRecord(before);
+ renderWireWorkspace();
+});
+document.getElementById('wireWsSearch').addEventListener('input',e=>{
+ wireWsQuery=String(e.target.value||'').slice(0,80);renderWireWorkspace();
+});
+document.getElementById('wireWsSourceSelect').addEventListener('change',e=>{
+ const src=wireSourceTrack(Number(e.target.value));
+ if(src)selectWireSource(src);
+ renderWireWorkspace();
+});
+document.getElementById('wireWsBus').addEventListener('change',e=>{
+ const b=tracks.find(t=>t.id===Number(e.target.value)&&t.kind==='bus');
+ if(b)wireWsBusId=b.id;
+ renderWireWorkspace();
+});
+document.getElementById('wireWsInspector').addEventListener('focusin',e=>{
+ if(e.target.closest?.('[data-ws-gain],[data-ws-tap]'))wireWsEditBefore=wireWsSnapshot();
+});
+document.getElementById('wireWsInspector').addEventListener('input',e=>{
+ const gain=e.target.closest?.('[data-ws-gain]');
+ if(!gain)return;
+ const edge=wireEdges.find(x=>x.id===Number(gain.dataset.wsGain)&&x.enabled);
+ if(!edge||edge.destId===master.id)return;
+ const amount=Math.max(-60,Math.min(6,Math.round(Number(gain.value)||0)));
+ if(!wireGraphCommit([{type:'GAIN',sourceId:edge.sourceId,edgeId:edge.id,
+ levelDb:amount}],{record:false}))return;
+ document.getElementById('wireWsGainText').textContent=amount+' dB';
+});
+document.getElementById('wireWsInspector').addEventListener('change',e=>{
+ const gain=e.target.closest?.('[data-ws-gain]'),tap=e.target.closest?.('[data-ws-tap]');
+ if(tap){
+ const edge=wireEdges.find(x=>x.id===Number(tap.dataset.wsTap)&&x.enabled);
+ if(!edge||!wireGraphCommit([{type:'MODE',sourceId:edge.sourceId,edgeId:edge.id,
+ mode:tap.value==='split'?'split':'send'}],{record:false}))return;
+ }
+ if(gain||tap){
+ wireWsRecord(wireWsEditBefore);wireWsEditBefore=null;render();renderWireWorkspace();
+ say('WIRE inspector accepted · reference graph only');
+ }
+});
+
+document.getElementById('wireLegend').addEventListener('change',e=>{
+ const picker=e.target.closest('[data-wire-destination]');
+ if(!picker||!picker.value)return;
+ const source=armedWireSource(),dest=wireSourceTrack(Number(picker.value));
+ picker.value='';
+ if(!source||!dest||source.id===dest.id)return;
+ requestWireConnection(source,dest,picker);
+ // An off-screen destination remains represented by a named, accessible route
+ // badge/legend; never draw a fictional cable spanning unseen mixer pages.
+ renderWireRouting();
+});
+document.getElementById('wireLegend').addEventListener('click',e=>{
+ if(!e.target.closest('[data-wire-jump-source]'))return;
+ const source=armedWireSource();if(!source)return;
+ const filter=document.getElementById('viewFilter');
+ let shown=tracks.filter(t=>filter.value==='all'||(filter.value==='solo'?t.solo:t.kind===filter.value));
+ if(!shown.some(t=>t.id===source.id)){filter.value='all';shown=tracks;}
+ const index=shown.findIndex(t=>t.id===source.id);
+ render(Math.floor(Math.max(0,index)/bankCapacity()));
+ say('Returned to CH'+String(source.id).padStart(2,'0')+' · SOURCE kept · choose another bank to patch remotely');
+});
+document.getElementById('bankSelect').addEventListener('change',()=>{render();sayWireBankContext('Switched mixer fader bank');});
+document.getElementById('bankPrev').addEventListener('click',()=>{
+ const sel=document.getElementById('bankSelect'),n=visibleBankCount();
+ if(!n){sel.value='all';render();say('No channels available in the active layer');return;}
+ const old=Number(sel.value)||0;sel.value=String((old-1+n)%n);render();sayWireBankContext('Previous fader bank');
+});
+document.getElementById('bankNext').addEventListener('click',()=>{
+ const sel=document.getElementById('bankSelect'),n=visibleBankCount();
+ if(!n){sel.value='all';render();say('No channels available in the active layer');return;}
+ const old=Number(sel.value)||0;sel.value=String((old+1)%n);render();sayWireBankContext('Next fader bank');
+});
+document.getElementById('wireMode').addEventListener('change',()=>{
+ const selected=document.getElementById('wireMode').value;
+ wireMode=selected==='split'?'split':'send';
+ say('WIRE MODE '+(wireMode==='send'?'FOLLOW FADER (FL-style send)':'INDEPENDENT (pre-insert mult)')+' · new edges only · GUI DEMO');
+});
+document.getElementById('wireView').addEventListener('change',()=>{
+ const next=document.getElementById('wireView').value;
+ wireView=['focus','out'].includes(next)?next:'focus';
+ renderWireRouting(); // Visualization only: never touch wireEdges or DSP state
+ say('WIRE VIEW '+(wireView==='focus'?'SELECTED · incoming and outgoing':'SELECTED OUT ONLY')+' · display only');
+});
+function toggleDirectMain(){
+ const t=armedWireSource()||selection().find(x=>x.kind!=='master');
+ if(!t){say('Select a channel for MAIN');return;}
+ const edge=wireFor(t.id,master.id);
+ const op=edge?{type:'REMOVE',sourceId:t.id,edgeId:edge.id}:
+ {type:'CONNECT',sourceId:t.id,destId:master.id};
+ if(!wireGraphCommit([op]))return;
+ render();say(t.name+(edge?' MAIN unplugged':' MAIN connected')+' · reference only');
+}
+document.getElementById('routeOnly').addEventListener('click',()=>commitRouteChoice('only'));
+document.getElementById('routeParallel').addEventListener('click',()=>commitRouteChoice('parallel'));
+document.getElementById('routeChoiceClose').addEventListener('click',closeRouteChoice);
+document.getElementById('wireMaster').addEventListener('click',toggleDirectMain);
+document.getElementById('sofToggle').addEventListener('click',()=>toggleSof());
+document.getElementById('sofTarget').addEventListener('change',()=>{sofTarget=document.getElementById('sofTarget').value;render();say('Sends target: '+sofTarget);});
+document.getElementById('addTrack').addEventListener('click',()=>{
+ const n=tracks.filter(t=>t.kind==='audio').length+1,t=make('Track '+n,'audio',COLORS[(n-1)%COLORS.length]);const firstBus=tracks.findIndex(x=>x.kind==='bus');tracks.splice(firstBus<0?tracks.length:firstBus,0,t);
+ if(!wireGraphCommit([{type:'CONNECT',sourceId:t.id,destId:master.id}],{record:false})){tracks=tracks.filter(x=>x.id!==t.id);return;}revealTrack(t);say('Added '+t.name+' → MAIN · reference only');
+});
+document.getElementById('addFx').addEventListener('click',()=>{
+ const n=tracks.filter(t=>t.kind==='fx').length+1,t=make('FX '+n,'fx','#8b709a');
+ t.fx[0]='Studio Reverb';tracks.push(t);if(!wireGraphCommit([{type:'CONNECT',sourceId:t.id,destId:master.id}],{record:false})){tracks.pop();return;}revealTrack(t);
+ say('Added FX Return '+t.name+' · send destination with insert processing');
+});
+document.getElementById('addBus').addEventListener('click',()=>{
+ const n=tracks.filter(t=>t.kind==='bus').length+1,t=make('Bus '+String.fromCharCode(65+((n-1)%26)),'bus','#846e9e');tracks.push(t);if(!wireGraphCommit([{type:'CONNECT',sourceId:t.id,destId:master.id}],{record:false})){tracks.pop();return;}revealTrack(t);say('Added '+t.name+' · visual only');
+});
+document.getElementById('clearCue').addEventListener('click',()=>{tracks.forEach(t=>t.cue=false);master.cue=false;render();say('All Cue / PFL requests cleared · no hardware monitor connected');});
+document.getElementById('reset').addEventListener('click',()=>{if(preview)togglePreview();document.getElementById('viewFilter').value='all';document.getElementById('bankSelect').value='all';sofEnabled=false;document.getElementById('sofToggle').classList.remove('active');document.getElementById('sofToggle').setAttribute('aria-pressed','false');document.querySelector('.console-body').classList.remove('sends-mode');setDensity('comfort');init();say('Reference mixer reset; saved scenes remain available.');});
+
+// Browser-only catalog contract. Only the native host can actually scan or instantiate VST3.
+const plugEl=id=>document.getElementById(id);
+function pluginTargetLabel(){
+ const t=activeFxTarget&&tracks.concat(master).find(x=>x.id===activeFxTarget.channelId);
+ return t? t.name+' · Insert '+(activeFxTarget.slot+1):'Select a channel + insert slot';
+}
+function renderChannelIdentityChoices(){
+ document.getElementById('identityIcons').innerHTML=CHANNEL_ICONS.map(icon=>
+ ''
+ ).join('');
+ document.getElementById('identityColors').innerHTML=CHANNEL_PALETTE.map(color=>
+ ''
+ ).join('');
+}
+function closeChannelIdentity(){identityTrackId=null;document.getElementById('channelIdentity').hidden=true;}
+function openChannelIdentity(t,anchor){
+ if(!t)return;
+ setFastPicker(false); // non-modal Plugin Manager remains usable while editing channels
+ identityTrackId=t.id;identityColor=t.color;identityIcon=iconFor(t);
+ const dialog=document.getElementById('channelIdentity');
+ document.getElementById('identityTitle').textContent='CHANNEL IDENTITY · '+t.name;
+ document.getElementById('identityName').value=t.name;
+ renderChannelIdentityChoices();dialog.hidden=false;
+ const parent=document.querySelector('.console-pane'),a=anchor?.getBoundingClientRect?.(),p=parent?.getBoundingClientRect?.();
+ if(a&&p&&dialog.style?.setProperty){
+ dialog.style.setProperty('left',Math.max(8,Math.min(p.width-302,a.left-p.left+a.width/2-148))+'px');
+ dialog.style.setProperty('top',Math.max(8,Math.min(p.height-295,a.top-p.top+18))+'px');
+ }
+ document.getElementById('identityName').focus?.();
+}
+function applyChannelIdentity(){
+ const t=tracks.concat(master).find(x=>x.id===identityTrackId);
+ if(!t){closeChannelIdentity();return;}
+ const name=String(document.getElementById('identityName').value||'').trim().replace(/\s+/g,' ').slice(0,30);
+ if(!name){say('Channel name cannot be empty');return;}
+ if(tracks.concat(master).some(other=>other.id!==t.id&&other.name.toLowerCase()===name.toLowerCase())){
+ say('Channel name already exists: '+name);return;
+ }
+ const old=t.name;
+ t.name=name;t.icon=CHANNEL_ICONS.includes(identityIcon)?identityIcon:iconFor(t);
+ t.color=CHANNEL_PALETTE.includes(identityColor)?identityColor:t.color;
+ tracks.forEach(x=>{
+ if(x.output===old)x.output=name;
+ if(x.send===old)x.send=name;
+ x.sendSlots.forEach(slot=>{if(slot.send===old)slot.send=name;});
+ });
+ if(sofTarget===old)sofTarget=name;
+ closeChannelIdentity();render();say('Channel identity updated · '+name+' · routing references preserved');
+}
+document.getElementById('identityClose').addEventListener('click',closeChannelIdentity);
+document.getElementById('identityCancel').addEventListener('click',closeChannelIdentity);
+document.getElementById('identitySave').addEventListener('click',applyChannelIdentity);
+document.getElementById('identityName').addEventListener('keydown',e=>{
+ if(e.key==='Enter'){e.preventDefault();applyChannelIdentity();}
+ else if(e.key==='Escape'){e.preventDefault();closeChannelIdentity();}
+});
+document.getElementById('identityIcons').addEventListener('click',e=>{
+ const button=e.target.closest('[data-identity-icon]');if(!button)return;
+ identityIcon=button.dataset.identityIcon;renderChannelIdentityChoices();
+});
+document.getElementById('identityColors').addEventListener('click',e=>{
+ const button=e.target.closest('[data-identity-color]');if(!button)return;
+ identityColor=button.dataset.identityColor;renderChannelIdentityChoices();
+});
+
+// Plugin Manager is a modeless, movable tool window. Never captures background mixer input.
+let pluginWindowMove=null;
+function positionPluginWindow(ev){
+ const panel=plugEl('pluginBrowser'),parent=document.querySelector('.console-pane');
+ const bounds=parent?.getBoundingClientRect?.();
+ if(!pluginWindowMove||!bounds||!panel.style?.setProperty)return;
+ const w=panel.offsetWidth||400,h=panel.offsetHeight||390;
+ const left=Math.max(4,Math.min(bounds.width-w-4,ev.clientX-bounds.left-pluginWindowMove.dx));
+ const top=Math.max(4,Math.min(bounds.height-h-4,ev.clientY-bounds.top-pluginWindowMove.dy));
+ panel.style.setProperty('left',left+'px','important');
+ panel.style.setProperty('top',top+'px','important');
+ panel.style.setProperty('right','auto','important');
+ panel.style.setProperty('bottom','auto','important');
+}
+plugEl('pluginDragHandle').addEventListener('pointerdown',ev=>{
+ if(ev.button!==undefined&&ev.button!==0)return;
+ if(ev.target.closest?.('button,input,select'))return;
+ const panel=plugEl('pluginBrowser'),r=panel.getBoundingClientRect?.();
+ if(!r)return;
+ pluginWindowMove={pointerId:ev.pointerId,dx:ev.clientX-r.left,dy:ev.clientY-r.top};
+ plugEl('pluginDragHandle').setPointerCapture?.(ev.pointerId);
+});
+plugEl('pluginDragHandle').addEventListener('pointermove',ev=>{
+ if(pluginWindowMove&&ev.pointerId===pluginWindowMove.pointerId)positionPluginWindow(ev);
+});
+plugEl('pluginDragHandle').addEventListener('pointerup',ev=>{
+ if(!pluginWindowMove||ev.pointerId!==pluginWindowMove.pointerId)return;
+ positionPluginWindow(ev);pluginWindowMove=null;
+ plugEl('pluginDragHandle').releasePointerCapture?.(ev.pointerId);
+});
+plugEl('pluginDragHandle').addEventListener('pointercancel',ev=>{
+ if(pluginWindowMove&&ev.pointerId===pluginWindowMove.pointerId)pluginWindowMove=null;
+});
+plugEl('pluginMinimize').addEventListener('click',()=>{
+ const panel=plugEl('pluginBrowser'),minimized=panel.classList.toggle('minimized');
+ plugEl('pluginMinimize').setAttribute('aria-expanded',String(!minimized));
+ plugEl('pluginMinimize').textContent=minimized?'+':'−';
+});
+document.querySelector('.console-body').addEventListener('keydown',e=>{
+ if(e.key!=='F2'&&e.key!=='Enter')return;
+ const top=e.target.closest?.('.strip-identity-top'),bottom=e.target.closest?.('.footer-label .name');
+ if(!top&&!bottom)return;
+ const t=findTrack(e.target);if(!t)return;
+ e.preventDefault();openChannelIdentity(t,top||bottom);
+});
+
+function setBrowser(open){
+ pluginOpen=!!open;
+ plugEl('pluginBrowser').hidden=!pluginOpen;
+ // Plugin Manager is floating and NEVER changes bank width or rebuilds strips.
+ document.querySelector('.console-body').classList.remove('plugin-open');
+ plugEl('pluginsButton').setAttribute('aria-expanded',String(pluginOpen));
+ if(pluginOpen){
+ // The FX fast picker is an independent tool, not a modal child of the manager.
+ renderPluginCatalog();renderScanPaths();
+ const input=plugEl('pluginSearch');if(input.focus)input.focus();
+ }
+}
+function setFastPicker(open){
+ quickOpen=!!open;
+ plugEl('fastPicker').hidden=!quickOpen;
+}
+function renderFastPicker(){
+ const q=String(plugEl('fastSearch').value||'').trim().toLowerCase();
+ const list=pluginCatalog.filter(p=>!p.hidden&&!['error','disabled'].includes(p.status)&&
+ [p.name,p.category,p.vendor].join(' ').toLowerCase().includes(q))
+ .sort((a,b)=>Number(b.favorite)-Number(a.favorite)||a.name.localeCompare(b.name));
+ plugEl('fastResults').innerHTML=list.length?list.map(p=>
+ ''
+ ).join(''):'No matching effects
';
+}
+function openFastPicker(t,slot,anchor){
+ // Non-modal manager stays open: the user may audition/search and continue mixing.
+ const first=t||selection()[0]||tracks[0];
+ if(!first)return;
+ const empty=first.fx.findIndex(x=>x==='None');
+ activeFxTarget={channelId:first.id,slot:Number.isInteger(slot)?slot:empty<0?0:empty};
+ plugEl('fastTarget').textContent=first.name+' · FX '+(activeFxTarget.slot+1);
+ plugEl('fastSearch').value='';
+ const pane=document.querySelector('.console-pane'),r=anchor?.getBoundingClientRect?.(),p=pane?.getBoundingClientRect?.();
+ const picker=plugEl('fastPicker');
+ if(r&&p&&picker.style?.setProperty){
+ const x=Math.min(Math.max(6,r.left-p.left),Math.max(6,p.width-310));
+ const y=Math.min(Math.max(8,r.bottom-p.top+3),Math.max(8,p.height-330));
+ picker.style.setProperty('left',x+'px');picker.style.setProperty('top',y+'px');
+ }
+ setFastPicker(true);renderFastPicker();plugEl('fastSearch').focus?.();
+}
+function openPluginBrowser(t,slot){ // manager button and F8, deliberately separate from Add FX
+ const first=t||selection()[0]||tracks[0];
+ if(first){
+ const empty=first.fx.findIndex(x=>x==='None');
+ activeFxTarget={channelId:first.id,slot:Number.isInteger(slot)?slot:empty<0?0:empty};
+ }
+ plugEl('pluginTarget').textContent=pluginTargetLabel();
+ setBrowser(true);
+}
+function renderScanPaths(){
+ const container=plugEl('pluginPaths');
+ container.innerHTML=scanPaths.map((p,i)=>''+escapeHtml(p)+''+(i?'':'Default')+'
').join('');
+}
+function catalogById(id){return pluginCatalog.find(p=>p.id===id);}
+function renderPluginCatalog(){
+ const q=String(plugEl('pluginSearch').value||'').trim().toLowerCase();
+ const cat=plugEl('pluginCategory').value||'all';
+ const mode=plugEl('pluginView').value||'all';
+ const list=pluginCatalog.filter(p=>{
+ if(cat!=='all'&&p.category!==cat)return false;
+ if(mode==='favorites'&&!p.favorite)return false;
+ if(mode==='recent'&&!pluginRecent.includes(p.id))return false;
+ if(mode==='hidden'&&!p.hidden)return false;
+ if(mode!=='hidden'&&p.hidden)return false;
+ return [p.name,p.vendor,p.category,p.format].join(' ').toLowerCase().includes(q);
+ }).sort((a,b)=> mode==='recent'?pluginRecent.indexOf(a.id)-pluginRecent.indexOf(b.id):a.name.localeCompare(b.name));
+ plugEl('pluginResults').innerHTML=list.length?list.map(p=>{
+ const isBad=p.status==='error'||p.status==='disabled';
+ const status=p.status==='demo'?'UI only':p.status==='ready'?'Listed':p.status==='error'?'Error':'Disabled';
+ const latency=p.latencySamples==null?'Latency unknown':p.latencySamples+' smp (reported)';
+ const usedBy=tracks.concat(master).filter(t=>t.fx.includes(p.name)).map(t=>t.name);
+ return ''+escapeHtml(p.format)+''+status+'
';
+ }).join(''):'No effects match · try another category or clear the search.
';
+ plugEl('pluginCount').textContent=list.length+' shown / '+pluginCatalog.length+' listed';
+}
+function insertCatalogPlugin(id){
+ const plugin=catalogById(id);
+ if(!plugin||plugin.hidden||plugin.status==='error'||plugin.status==='disabled'){say('This effect is not available for insertion.');return;}
+ if(!activeFxTarget){say('Choose a channel FX insert before loading an effect.');return;}
+ const t=tracks.concat(master).find(x=>x.id===activeFxTarget.channelId);
+ if(!t||!Number.isInteger(activeFxTarget.slot)||activeFxTarget.slot<0||activeFxTarget.slot>=t.fx.length){say('Selected FX slot is no longer available.');return;}
+ t.fx[activeFxTarget.slot]=plugin.name;t.slotBypass[activeFxTarget.slot]=false;
+ pluginRecent=[plugin.id,...pluginRecent.filter(x=>x!==plugin.id)].slice(0,20);savePluginPreferences();
+ refreshStrip(t);setFastPicker(false); // leave non-modal manager open after FX selection
+ say(t.name+' · FX '+(activeFxTarget.slot+1)+' → '+plugin.name+' · GUI reference only (no native DSP)');
+}
+function acceptPluginManifest(items){
+ if(!Array.isArray(items)||items.length>512)return false;
+ const added=[];const ids=new Set();
+ for(const item of items){
+ if(!item||typeof item.name!=='string'||!item.name.trim()||item.kind!=='effect')continue;
+ const name=item.name.trim().slice(0,80);
+ const vendor=typeof item.vendor==='string'?item.vendor.slice(0,60):'Unknown vendor';
+ const format=['VST3','VST2','AU','CLAP','Native'].includes(item.format)?item.format:'Unknown';
+ const status=['ready','disabled','error'].includes(item.status)?item.status:'disabled';
+ const category=['EQ','Dynamics','Reverb','Delay','Modulation','Utility'].includes(item.category)?item.category:'Utility';
+ const id=typeof item.id==='string'?item.id.slice(0,100):name+'@'+vendor+'@'+format;
+ if(ids.has(id))continue;ids.add(id);
+ added.push({id,name,vendor,category,format,status,latencySamples:Number.isFinite(item.latencySamples)&&item.latencySamples>=0?Math.round(item.latencySamples):null,favorite:false,hidden:false});
+ }
+ if(!added.length)return false;
+ pluginCatalog=added;pluginRecent=[];restorePluginPreferences();
+ plugEl('pluginView').value='all';plugEl('pluginCategory').value='all';plugEl('pluginSearch').value='';
+ renderPluginCatalog();say('Imported '+added.length+' plugin metadata records · not a native scan, no plugin instantiated');
+ return true;
+}
+plugEl('pluginsButton').addEventListener('click',()=>pluginOpen?setBrowser(false):openPluginBrowser());
+plugEl('pluginClose').addEventListener('click',()=>setBrowser(false));
+plugEl('pluginSearch').addEventListener('input',renderPluginCatalog);
+plugEl('fastSearch').addEventListener('input',renderFastPicker);
+plugEl('fastClose').addEventListener('click',()=>setFastPicker(false));
+plugEl('fastManage').addEventListener('click',()=>{setFastPicker(false);plugEl('pluginTarget').textContent=pluginTargetLabel();setBrowser(true);});
+plugEl('fastResults').addEventListener('click',e=>{
+ const btn=e.target.closest('[data-fast-id]');if(btn)insertCatalogPlugin(btn.dataset.fastId);
+});
+/* V25 Quick VST picker: dismiss on outside pointer or focus transfer.
+ Capture phase closes old picker BEFORE target activation; clicks inside
+ either popup stay interactive, no document-level per-frame poll. */
+const dismissPluginOverlays=(target)=>{
+ if(!target||typeof target.closest!=='function')return;
+ // Quick Picker is transient; Plugin Manager is an independent modeless tool.
+ // Do not close the manager when the engineer interacts with a mixer strip.
+ if(quickOpen&&!plugEl('fastPicker').contains(target))setFastPicker(false);
+};
+document.addEventListener?.('pointerdown',e=>dismissPluginOverlays(e.target),true);
+document.addEventListener?.('focusin',e=>dismissPluginOverlays(e.target),true);
+window.addEventListener('blur',()=>{if(quickOpen)setFastPicker(false);});
+plugEl('fastSearch').addEventListener('keydown',e=>{
+ if(e.key==='Enter'){
+ const b=plugEl('fastResults').querySelector('.fast-effect');
+ if(b){e.preventDefault();insertCatalogPlugin(b.dataset.fastId);}
+ }else if(e.key==='Escape'){e.preventDefault();setFastPicker(false);}
+});
+plugEl('pluginAddPath').addEventListener('click',()=>{
+ const input=plugEl('pluginNewPath'),raw=String(input.value||'').trim();
+ if(!raw||raw.length>260){say('Enter a valid plugin folder path (max 260 characters)');return;}
+ if(!scanPaths.includes(raw))scanPaths.push(raw);
+ input.value='';renderScanPaths();
+ say('Added search path to UI reference; native VST3 scanning not connected');
+});
+plugEl('pluginPaths').addEventListener('click',e=>{
+ const btn=e.target.closest('[data-path-index]');if(!btn)return;
+ const i=Number(btn.dataset.pathIndex);if(i>0&&i{
+ const scanner=window.ArSonMixNativePlugins?.scan;
+ if(typeof scanner==='function'){
+ plugEl('pluginScanStatus').textContent='Native scan requested · awaiting verified results';
+ try{
+ Promise.resolve(scanner({paths:[...scanPaths],verify:true})).then(result=>{
+ if(Array.isArray(result)){
+ const good=acceptPluginManifest(result);
+ plugEl('pluginScanStatus').textContent=good?'Native scan metadata received · verify status before inserting':'Native scanner returned no usable audio effects';
+ }else plugEl('pluginScanStatus').textContent='Native scan requested · waiting for host catalog update';
+ }).catch(()=>{plugEl('pluginScanStatus').textContent='Native scan failed · inspect scanner logs';});
+ }catch(error){plugEl('pluginScanStatus').textContent='Native scan could not start';}
+ }else{
+ plugEl('pluginScanStatus').textContent='Windows VST3 scan requires installed native host · GitHub Pages cannot access local plugin files';
+ say('Plugin Manager setup only: scanning requires native ArSonMix executable');
+ }
+});
+plugEl('pluginCategory').addEventListener('change',renderPluginCatalog);
+plugEl('pluginView').addEventListener('change',renderPluginCatalog);
+plugEl('pluginResults').addEventListener('click',e=>{
+ const btn=e.target.closest('[data-plugin-action]');if(!btn)return;
+ const plugin=catalogById(btn.dataset.pluginId);if(!plugin)return;
+ const a=btn.dataset.pluginAction;
+ if(a==='fav')plugin.favorite=!plugin.favorite;
+ else if(a==='hide')plugin.hidden=!plugin.hidden;
+ else if(a==='choose'){insertCatalogPlugin(plugin.id);return;}
+ if(a==='fav'||a==='hide')savePluginPreferences();
+ renderPluginCatalog();
+});
+plugEl('pluginImport').addEventListener('click',()=>{if(plugEl('pluginFile').click)plugEl('pluginFile').click();});
+plugEl('pluginFile').addEventListener('change',e=>{
+ const file=e.target.files&&e.target.files[0];if(!file)return;
+ if(file.size>2000000){say('Plugin metadata JSON too large (2 MB maximum)');return;}
+ const reader=new FileReader();
+ reader.onload=()=>{try{const data=JSON.parse(reader.result);if(!acceptPluginManifest(data)){say('No valid effect entries in JSON. Expected [{name,kind:"effect",format,status,...}]');}}catch(error){say('Invalid plugin metadata JSON.');}};
+ reader.readAsText(file);
+ e.target.value='';
+});
+// Explicitly metadata-only integration point; does not scan filesystem or instantiate FX.
+window.ArSonMixReference=Object.freeze({setPluginCatalog:acceptPluginManifest});
+
+function togglePreview(){
+ preview=!preview;
+ const b=document.getElementById('preview');
+ b.textContent=preview?'■ Stop Meter Preview':'▶ Preview Meters';b.classList.toggle('active',preview);b.setAttribute('aria-pressed',String(preview));
+ document.getElementById('transport').textContent=preview?'Meter preview running':'Stopped';
+ if(preview){say('Meters use generated UI-only values. No capture, DSP or audio output.');requestAnimationFrame(animateMeters);}
+ else{
+ tracks.concat(master).forEach(t=>{t.meterL=t.meterR=0;});
+ meterPeakHolds.clear();
+ document.querySelectorAll('.meter-fill').forEach(x=>x.style.setProperty('--lit','0%'));
+ document.querySelectorAll('.meter-peak-hold').forEach(x=>{x.style.opacity='0';});
+ }
+}
+document.getElementById('preview').addEventListener('click',togglePreview);
+function animateMeters(ts){
+ if(!preview)return;
+ if(ts-lastTick>80){lastTick=ts;meterFrame++;
+ const anySolo=tracks.some(t=>t.solo);
+ tracks.concat(master).forEach((t,i)=>{
+ const routedThroughSoloBus=t.kind==='audio'&&tracks.some(bus=>bus.kind==='bus'&&bus.solo&&t.output===bus.name);
+ const fedBySoloChannel=t.kind==='bus'&&tracks.some(ch=>ch.solo&&(ch.output===t.name||ch.send===t.name));
+ const suppressed=t.mute||(anySolo&&!t.solo&&!routedThroughSoloBus&&!fedBySoloChannel&&t.kind!=='master');
+ const modulation=.46+.23*Math.sin(meterFrame*.13+i*1.21)+.17*Math.sin(meterFrame*.31+i*2.2);
+ const leftDbfs=suppressed?METER_DBFS_MIN:demoMeterDbfs(t.level,modulation);
+ // Stereo differences are measured in dB, not arbitrary LED percentages.
+ const rightDbfs=suppressed?METER_DBFS_MIN:Math.max(METER_DBFS_MIN,
+ Math.min(METER_DBFS_MAX,leftDbfs-1+0.8*Math.sin(meterFrame*.15+i)));
+ const root=document.querySelector('.strip[data-id="'+t.id+'"]');if(!root)return;
+ const l=root.querySelector('.meter-fill.left'),r=root.querySelector('.meter-fill.right');
+ displayMeterDbfs(l,leftDbfs,ts,t.id+':L');
+ displayMeterDbfs(r,rightDbfs,ts,t.id+':R');
+ if((leftDbfs>=-0.1||rightDbfs>=-0.1)&&!t.clip){
+ t.clip=true;
+ root.querySelector('.peak')?.classList.add('clipping');
+ root.querySelector('.clip-indicator')?.classList.add('clipping');
+ }
+ });
+ }
+ requestAnimationFrame(animateMeters);
+}
+window.addEventListener('keydown',e=>{
+ const textEntry=e.target.closest&&e.target.closest('input,textarea,select,[contenteditable="true"]');
+ if((e.ctrlKey||e.metaKey)&&!textEntry){
+ if(e.key.toLowerCase()==='c'){e.preventDefault();copyChannels();return;}
+ if(e.key.toLowerCase()==='v'){e.preventDefault();pasteChannels();return;}
+ if(e.key.toLowerCase()==='g'){e.preventDefault();e.shiftKey?ungroupSelected():groupSelected();return;}
+ }
+ if(e.key==='Escape'&&wireGesture){
+ wireGesture=null;setWireSnapTarget(null);consoleBody.classList.remove('wire-dragging');
+ consoleBody.querySelectorAll('.is-replug-origin,.is-drag-origin').forEach(el=>
+ el.classList.remove('is-replug-origin','is-drag-origin'));
+ renderWireRouting();say('WIRE canceled · original edge unchanged');return;
+ }
+ if(e.key==='Escape'&&sofEnabled){toggleSof(false);return;}
+ if(e.key==='F8'&&!textEntry){e.preventDefault();pluginOpen?setBrowser(false):openPluginBrowser();return;}
+ if(e.key==='Escape'&&identityTrackId!==null){closeChannelIdentity();return;}
+ if(e.key==='Escape'&&quickOpen){setFastPicker(false);return;}
+ if(e.key==='Escape'&&pluginOpen){setBrowser(false);return;}
+ if(e.key==='Escape'&&(wireIntent||wireSourcePinned)){
+ clearWireIntent();say('WIRE idle · click OUT to patch');return;
+ }
+ if(e.key==='Escape'&&preview)togglePreview();
+ if(e.target===document.body&&(e.key==='ArrowRight'||e.key==='ArrowLeft')){
+ const width={comfort:150,standard:125,compact:105}[document.querySelector('.console-body').dataset.density]||150;
+ document.getElementById(e.key==='ArrowRight'?'bankNext':'bankPrev').click();
+ }
+});
+let resizeQueued=false;
+window.addEventListener('resize',()=>{
+ if(resizeQueued)return;resizeQueued=true;
+ requestAnimationFrame(()=>{resizeQueued=false;render();});
+});
+restorePluginPreferences();init();
+})();
+
+
+
+
+
\ No newline at end of file
diff --git a/site/preview/mixer.html b/site/preview/mixer.html
deleted file mode 100644
index 4397c1399..000000000
--- a/site/preview/mixer.html
+++ /dev/null
@@ -1,5302 +0,0 @@
-
-
-
-
-
-
-ArSonMix — Live Console Reference
-
-
-
-
-
ArSonMixMixer · Reference SessionOPERATOR-FIRST · SINGLE LIVE CONSOLE REFERENCE
-
-
-
-
BANK
-
-
-
-
-
-
-
-
-
-
-
-
-
- More ···
-
-
-
-
- Live MixerCH01 · click destination arrows10 audio tracks · 1 bus · master
-
-
-
-
-
-
-
CHANNEL IDENTITY
-
-
-
CHANNEL ICON
-
CHANNEL COLOR
-
-
-
-
-
-
ROUTE TO BUS
-
Choose whether the original Main feed should remain.
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/site/preview/perf.html b/site/preview/perf.html
deleted file mode 100644
index bcb6849eb..000000000
--- a/site/preview/perf.html
+++ /dev/null
@@ -1,33 +0,0 @@
-
-ArSonMix Mixer Performance Lab
-
-ArSonMix · Mixer Perf Lab
-
-
-Open direct mixerLoading…
-
-
-No measurements. rAF intervals are scheduling proxies, not GPU paint/input latency. Unsupported Long Tasks API is reported as null, not zero.
-
\ No newline at end of file
diff --git a/tests/approved_native_buttons_v34_contract_test.py b/tests/approved_native_buttons_v34_contract_test.py
index 54dbf437c..2baf361df 100644
--- a/tests/approved_native_buttons_v34_contract_test.py
+++ b/tests/approved_native_buttons_v34_contract_test.py
@@ -1,20 +1,19 @@
-"""Approved native-sized PNG buttons stay pixel-aligned and retain mixer intent."""
+"""Historical V34 key dimensions are now verified on the only approved GUI."""
from pathlib import Path
import struct
ROOT=Path(__file__).resolve().parents[1]
-HTML=(ROOT/"site/preview-v34/index.html").read_text(encoding="utf-8")
-SPRITE=(ROOT/"site/preview-v34/assets/mute-solo-pfl-56x37.png").read_bytes()
-
-assert SPRITE[:8]==b"\x89PNG\r\n\x1a\n", "sprite must be PNG"
-assert struct.unpack(">II",SPRITE[16:24])==(112,111), "2x3 56x37 frames"
-assert SPRITE[25]==6, "sprite must be RGBA for transparent housing"
-assert "codepen-buttons-wrapper" not in HTML, "obsolete layered mock controls remain"
-assert HTML.count('class="ar-native-key ar-native-key--')==3
-for kind,action,y in (("mute","mute","0"),("solo","solo","50%"),("pfl","cue","100%")):
- assert f'ar-native-key--{kind}" data-action="{action}"' in HTML
- assert f'ar-native-key--{kind}[aria-pressed="true"]' in HTML
-assert 'background-color:transparent!important' in HTML
-assert 'background-size:200% 300%!important' in HTML
-assert 'transform:none!important' in HTML
-print("PASS approved native MUTE/SOLO/PFL sprite: geometry, alpha, actions, states")
+HTML=(ROOT/"site/preview/index.html").read_text(encoding="utf-8")
+CSS=(ROOT/"site/preview/assets/mixer-control-keys.css").read_text(encoding="utf-8")
+SPRITE=(ROOT/"site/preview/assets/mute-solo-pfl-56x37.png").read_bytes()
+assert SPRITE[:8]==bytes.fromhex("89504e470d0a1a0a")
+assert struct.unpack(">II",SPRITE[16:24])==(112,111)
+assert SPRITE[25]==6
+assert "switch-section mx-hw-row" in HTML
+assert "mixer-control-keys.css" in HTML
+assert "mute-solo-pfl-56x37.png" in CSS
+assert "background-size:200% 300%" in CSS
+assert "aria-pressed" in CSS
+assert not (ROOT/"site/preview-v34").exists()
+assert not (ROOT/"site/preview-v2").exists()
+print("PASS: ONE approved PNG hardware-key component; no V34/V2 source renderer")
diff --git a/tests/approved_native_gui_bundle_test.py b/tests/approved_native_gui_bundle_test.py
index ff19498c2..c52a3c407 100644
--- a/tests/approved_native_gui_bundle_test.py
+++ b/tests/approved_native_gui_bundle_test.py
@@ -30,7 +30,7 @@ def test_native_is_exact_assembled_public_pages_plus_nonvisual_native_seam(self)
self.assertEqual((out / "assets" / asset.name).read_bytes(), asset.read_bytes(),
"Native /preview/ asset differs: " + asset.name)
for name in ("mixer-control-keys.css", "mixer-control-keys.js", "mute-solo-pfl-56x37.png"):
- button = (ROOT / "site/preview-buttons/assets" / name).read_bytes()
+ button = (ROOT / "site/preview/assets" / name).read_bytes()
self.assertEqual((out / "assets" / name).read_bytes(), button)
self.assertIn("assets/mixer-control-keys.css?rev=", native)
self.assertNotIn("console-native.html", native)
diff --git a/tests/ci_workflow_efficiency_test.mjs b/tests/ci_workflow_efficiency_test.mjs
index e7a64eabb..d13da3f7c 100644
--- a/tests/ci_workflow_efficiency_test.mjs
+++ b/tests/ci_workflow_efficiency_test.mjs
@@ -43,7 +43,7 @@ const selected = (paths, file) => paths.some(p => globMatches(p, file));
test('visual GUI changes never consume Windows native runner on a PR or on main', () => {
for (const filename of [
- 'site/preview-v2/index.html', 'site/preview-v2/assets/mixer-fader-assembly.css',
+ 'site/preview/index.html', 'site/preview/assets/mixer-fader-assembly.css',
'web/mixer-layout.js', 'web/mixer-io.js',
'AR-MIX-Live-FX-Host-Standalone-v0.3.html'
]) {
@@ -111,7 +111,7 @@ test('docs and isolated CI tests do not fan out into unrelated builds', () => {
}
});
-test('ordinary GUI PR and main use current targeted checks; full history is explicit', () => {
+test('ordinary GUI PR and main use current targeted checks; historical skin never mounts', () => {
assert.match(ui, /concurrency:\s+group: ui-smoke-/);
assert.match(ui, /cancel-in-progress: true/);
assert.match(ui, /python tests\/pages_wire_first_canonical_main_smoke.py/);
@@ -119,8 +119,8 @@ test('ordinary GUI PR and main use current targeted checks; full history is expl
assert.match(ui, /node tests\/wire_main_native_handoff_contract.test.cjs/);
assert.match(ui, /python tests\/pages_v51_portrait_led_peak_hold_smoke.py/);
const fullOnly = [...ui.matchAll(/^\s{8}if: .*workflow_dispatch.*integration\/product-/gm)].length;
- assert.ok(fullOnly >= 35, 'Historical/extended GUI steps must be opt-in, found ' + fullOnly);
- assert.match(ui, /python tests\/pages_css_architecture_v27_smoke.py/);
+ assert.ok(fullOnly >= 15, 'Extended GUI checks must remain opt-in, found ' + fullOnly);
+ assert.doesNotMatch(ui, /Mount pinned V24 historical|Mount pinned V27 GUI/, 'Do not overwrite sole approved GUI with rejected historical skin');
assert.match(ui, /retention-days: 3/);
});
diff --git a/tests/css_v15_restore.py b/tests/css_v15_restore.py
index 406d5fc36..ef0daa92a 100644
--- a/tests/css_v15_restore.py
+++ b/tests/css_v15_restore.py
@@ -3,7 +3,7 @@
from pathlib import Path
from css_v16_restore import reconstruct,manifest as manifest_v16
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
+HTML=ROOT/"site/preview/index.html"
ASSETS=HTML.parent/"assets"
LEDGER=ROOT/"tests/fixtures/css-v15-cross-owner-removals.json"
diff --git a/tests/css_v16_restore.py b/tests/css_v16_restore.py
index e19629e46..9f8afe28d 100644
--- a/tests/css_v16_restore.py
+++ b/tests/css_v16_restore.py
@@ -8,7 +8,7 @@
import json,re,tempfile
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
+HTML=ROOT/"site/preview/index.html"
WIRE=HTML.parent/"assets/mixer-wire-dots.css"
LEDGER=ROOT/"tests/fixtures/css-v16-wire-inline-migration.json"
diff --git a/tests/css_v17_restore.py b/tests/css_v17_restore.py
index 3799af75e..d143acf1b 100644
--- a/tests/css_v17_restore.py
+++ b/tests/css_v17_restore.py
@@ -2,7 +2,7 @@
import json,re,tempfile
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
+HTML=ROOT/"site/preview/index.html"
OWNER=HTML.parent/"assets/mixer-plugin-browser.css"
LEDGER=ROOT/"tests/fixtures/css-v17-plugin-overlay-migration.json"
diff --git a/tests/css_v18_restore.py b/tests/css_v18_restore.py
index bfaf9ae73..2aa52d80e 100644
--- a/tests/css_v18_restore.py
+++ b/tests/css_v18_restore.py
@@ -2,7 +2,7 @@
import json,re,tempfile
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
+HTML=ROOT/"site/preview/index.html"
CHROME=HTML.parent/"assets/mixer-chrome-material.css"
LEDGER=ROOT/"tests/fixtures/css-v18-chrome-inline-consolidation.json"
diff --git a/tests/css_v19_restore.py b/tests/css_v19_restore.py
index 91319065c..c7a2d0f3b 100644
--- a/tests/css_v19_restore.py
+++ b/tests/css_v19_restore.py
@@ -8,7 +8,7 @@
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
+HTML=ROOT/"site/preview/index.html"
SECTIONS=HTML.parent/"assets/mixer-section-controls.css"
CHROME=HTML.parent/"assets/mixer-chrome-material.css"
LEDGER=ROOT/"tests/fixtures/css-v19-operator-owner-migration.json"
diff --git a/tests/css_v20_restore.py b/tests/css_v20_restore.py
index aaa42e60f..0f621e0d4 100644
--- a/tests/css_v20_restore.py
+++ b/tests/css_v20_restore.py
@@ -7,7 +7,7 @@
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
+HTML=ROOT/"site/preview/index.html"
LEDGER=ROOT/"tests/fixtures/css-v20-legacy-shadow-pruning.json"
def fingerprint(text):
diff --git a/tests/css_v21_restore.py b/tests/css_v21_restore.py
index e9a5c0fdc..f5583948d 100644
--- a/tests/css_v21_restore.py
+++ b/tests/css_v21_restore.py
@@ -8,7 +8,7 @@
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
+HTML=ROOT/"site/preview/index.html"
CHROME=HTML.parent/"assets/mixer-chrome-material.css"
LEDGER=ROOT/"tests/fixtures/css-v21-chassis-geometry-migration.json"
diff --git a/tests/css_v22_restore.py b/tests/css_v22_restore.py
index 87f6b9046..1267b571b 100644
--- a/tests/css_v22_restore.py
+++ b/tests/css_v22_restore.py
@@ -8,7 +8,7 @@
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
+HTML=ROOT/"site/preview/index.html"
CHROME=HTML.parent/"assets/mixer-chrome-material.css"
LEDGER=ROOT/"tests/fixtures/css-v22-legacy-key-material-migration.json"
diff --git a/tests/css_v23_restore.py b/tests/css_v23_restore.py
index 75eb52804..73f2022ff 100644
--- a/tests/css_v23_restore.py
+++ b/tests/css_v23_restore.py
@@ -6,7 +6,7 @@
import json,re,tempfile
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
+HTML=ROOT/"site/preview/index.html"
ASSETS=HTML.parent/"assets"
LEDGER=ROOT/"tests/fixtures/css-v23-cascade-winners.json"
diff --git a/tests/css_v24_restore.py b/tests/css_v24_restore.py
index 9a8789a07..f6b5b3b7b 100644
--- a/tests/css_v24_restore.py
+++ b/tests/css_v24_restore.py
@@ -6,7 +6,7 @@
import json,tempfile
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
+HTML=ROOT/"site/preview/index.html"
ASSETS=HTML.parent/"assets"
LEDGER=ROOT/"tests/fixtures/css-v24-three-component-owner-pruning.json"
diff --git a/tests/css_v25_restore.py b/tests/css_v25_restore.py
index 150d330ea..5921798b5 100644
--- a/tests/css_v25_restore.py
+++ b/tests/css_v25_restore.py
@@ -8,7 +8,7 @@
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
+HTML=ROOT/"site/preview/index.html"
OWNER=HTML.parent/"assets/mixer-control-keys.css"
LEDGER=ROOT/"tests/fixtures/css-v25-physical-key-owner-migration.json"
diff --git a/tests/css_v26_restore.py b/tests/css_v26_restore.py
index 539542fef..ea26662aa 100644
--- a/tests/css_v26_restore.py
+++ b/tests/css_v26_restore.py
@@ -6,7 +6,7 @@
import json,re,tempfile
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
+HTML=ROOT/"site/preview/index.html"
KEY=HTML.parent/"assets/mixer-control-keys.css"
LEDGER=ROOT/"tests/fixtures/css-v26-retired-socket-removals.json"
diff --git a/tests/css_v27_restore.py b/tests/css_v27_restore.py
index d9a742ade..3eb1a0b8b 100644
--- a/tests/css_v27_restore.py
+++ b/tests/css_v27_restore.py
@@ -7,7 +7,7 @@
import json,re,tempfile
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
+HTML=ROOT/"site/preview/index.html"
ASSETS=HTML.parent/"assets"
LEDGER=ROOT/"tests/fixtures/css-v27-scoped-material-pruning.json"
diff --git a/tests/css_v28_restore.py b/tests/css_v28_restore.py
index 5f827a058..04b241e77 100644
--- a/tests/css_v28_restore.py
+++ b/tests/css_v28_restore.py
@@ -9,7 +9,7 @@
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
+HTML=ROOT/"site/preview/index.html"
OWNER=HTML.parent/"assets/mixer-chrome-material.css"
LEDGER=ROOT/"tests/fixtures/css-v28-inline-chrome-owner.json"
diff --git a/tests/native_artifact_packaging_contract_test.mjs b/tests/native_artifact_packaging_contract_test.mjs
index 6b33b1a86..501caa4b7 100644
--- a/tests/native_artifact_packaging_contract_test.mjs
+++ b/tests/native_artifact_packaging_contract_test.mjs
@@ -40,8 +40,8 @@ test('JUCE embeds only generated approved Pages DOM, CSS, JS, and PNG button var
assert.match(sourceBlock,/ARMIX_APPROVED_GUI_BINARIES/);
assert.doesNotMatch(sourceBlock,/web\/index\.html|web\/console-native\.html/);
assert.match(cmake,/build_approved_native_gui\.py/);
- assert.match(cmake,/site\/preview-v2/);
- assert.match(cmake,/site\/preview-buttons/);
+ assert.match(cmake,/site\/preview\/\*/);
+ assert.doesNotMatch(cmake,/site\/preview-v2|site\/preview-buttons/);
assert.match(nativeMain,/ApprovedGuiResources\.h/);
assert.match(nativeMain,/resolveApprovedGuiResource \(path, data, size, mime\)/);
assert.doesNotMatch(nativeMain,/BinaryData::consolenative_html|BinaryData::index_html|BinaryData::app_js/);
diff --git a/tests/pages_contextual_buttons_smoke.py b/tests/pages_contextual_buttons_smoke.py
index 6f93f27c8..4453b89f5 100644
--- a/tests/pages_contextual_buttons_smoke.py
+++ b/tests/pages_contextual_buttons_smoke.py
@@ -10,7 +10,7 @@
ROOT=Path(__file__).resolve().parents[1]
OWNER='mixer-contextual-buttons.css'
SCRIPT='mixer-contextual-buttons.js'
-CANON=ROOT/'site/preview-v2/index.html'
+CANON=ROOT/'site/preview/index.html'
def css_for(el):
@@ -102,8 +102,8 @@ def check_page(browser,path,label):
def main():
- css=(ROOT/'site/preview-v2/assets'/OWNER).read_text('utf-8')
- js=(ROOT/'site/preview-v2/assets'/SCRIPT).read_text('utf-8')
+ css=(ROOT/'site/preview/assets'/OWNER).read_text('utf-8')
+ js=(ROOT/'site/preview/assets'/SCRIPT).read_text('utf-8')
assert '.mx-hw-key' not in css.replace('(.mx-hw-key)',''), 'MUTE/SOLO/PFL owner was targeted'
assert 'transform:none!important' in css and 'repeating-linear-gradient' in css
assert "event.preventDefault()" in js and "event.button!==0" in js
@@ -113,20 +113,19 @@ def main():
subprocess.run([sys.executable,str(ROOT/'scripts/build_pages.py'),
'--out',str(dist),'--sha','v6-ci','--branch','main'],
cwd=ROOT,check=True,capture_output=True,text=True)
- for target in ('preview','preview-v2','preview-buttons'):
+ for target in ('preview',):
assets=dist/target/'assets'
- assert (assets/OWNER).read_bytes()==(ROOT/'site/preview-v2/assets'/OWNER).read_bytes(),target
- assert (assets/SCRIPT).read_bytes()==(ROOT/'site/preview-v2/assets'/SCRIPT).read_bytes(),target
- png_src=ROOT/'site/preview-buttons/assets'
- png_pub=dist/'preview-buttons/assets'
+ assert (assets/OWNER).read_bytes()==(ROOT/'site/preview/assets'/OWNER).read_bytes(),target
+ assert (assets/SCRIPT).read_bytes()==(ROOT/'site/preview/assets'/SCRIPT).read_bytes(),target
+ png_src=ROOT/'site/preview/assets'
+ png_pub=dist/'preview/assets'
for file in ('mixer-control-keys.css','mixer-control-keys.js','mute-solo-pfl-56x37.png'):
assert (png_pub/file).read_bytes()==(png_src/file).read_bytes(),file
with sync_playwright() as p:
browser=p.chromium.launch(headless=True)
for file,label in (
(CANON,'canonical'),
- (dist/'preview/mixer.html','public'),
- (dist/'preview-buttons/index.html','png')
+ (dist/'preview/index.html','png')
):
check_page(browser,file,label)
browser.close()
diff --git a/tests/pages_contextual_contrast_smoke.py b/tests/pages_contextual_contrast_smoke.py
index d1bc627a1..06cc58a67 100644
--- a/tests/pages_contextual_contrast_smoke.py
+++ b/tests/pages_contextual_contrast_smoke.py
@@ -12,8 +12,8 @@
from playwright.sync_api import sync_playwright
ROOT=Path(__file__).resolve().parents[1]
-PAGE=ROOT/"site/preview-v2/index.html"
-CSS=ROOT/"site/preview-v2/assets/mixer-contextual-buttons.css"
+PAGE=ROOT/"site/preview/index.html"
+CSS=ROOT/"site/preview/assets/mixer-contextual-buttons.css"
def luminance(hexv):
rgb=[int(hexv[i:i+2],16)/255 for i in (1,3,5)]
@@ -116,8 +116,7 @@ def main():
with sync_playwright() as p:
browser=p.chromium.launch(headless=True)
for path,label in ((PAGE,"canonical"),
- (dst/"preview/mixer.html","published-mixer"),
- (dst/"preview-buttons/index.html","approved-png")):
+ (dst/"preview/index.html","approved-png")):
page=browser.new_page(viewport={"width":1680,"height":900})
verify(page,label,path)
page.close()
diff --git a/tests/pages_controls_v6_smoke.py b/tests/pages_controls_v6_smoke.py
index e9b824cb6..212fc4479 100644
--- a/tests/pages_controls_v6_smoke.py
+++ b/tests/pages_controls_v6_smoke.py
@@ -1,149 +1,56 @@
-"""ArSonMix public preview V6: CSS ownership, small-key legibility, state and WIRE.
-Test the SAME source shipped to /preview/ and /preview-v2/, never a mock.
-"""
+"""Approved ONE /preview/ hardware key regression; no rejected CSS-only/SVG variant."""
import asyncio
from pathlib import Path
from playwright.async_api import async_playwright
ROOT=Path(__file__).resolve().parents[1]
-PAGE=ROOT/"site/preview-v2/index.html"
-STYLE=ROOT/"site/preview-v2/assets/mixer-control-keys.css"
-RUNTIME=ROOT/"site/preview-v2/assets/mixer-control-keys.js"
+PAGE=ROOT/"site/preview/index.html"
+CSS=ROOT/"site/preview/assets/mixer-control-keys.css"
+JS=ROOT/"site/preview/assets/mixer-control-keys.js"
+SPRITE="mute-solo-pfl-56x37.png"
-def assert_ownership():
+def source_gate():
html=PAGE.read_text(encoding="utf-8")
- css=STYLE.read_text(encoding="utf-8")
- js=RUNTIME.read_text(encoding="utf-8")
- wire_css=(PAGE.parent/"assets"/"mixer-wire-dots.css").read_text(encoding="utf-8")
- assert "wireWsCanJoin" in html and "data:image/svg+xml;base64" in (html+wire_css)
+ css=CSS.read_text(encoding="utf-8")
assert "switch-section mx-hw-row" in html
- assert "assets/mixer-control-keys.css" in html and "assets/mixer-control-keys.js" in html
- # Legacy stylesheet comments/selectors still exist for unrelated sections;
- # the live DOM must never instantiate either retired hardware wrapper.
- assert '' not in html
- assert "ArSonMix V5 backlit hardware material" not in html
- assert "Source port: https://codepen.io/praktikdan/pen/jbqBWm" not in html
- assert css.count(".mx-hw-row>button.mx-hw-key")>=5
- assert "Owner-approved V5" not in css and ".codepen-buttons-wrapper" not in css
- assert "filter:blur" not in css.replace(" ","").lower()
- # SOLO/PFL retain SVG masks; MUTE is rendered by CSS only.
- assert "!!window.ArSonMixHardwareKeys &&
- !!document.querySelector('#tracks .strip[data-id="1"] .mx-mute-face') &&
- document.querySelectorAll('#tracks .strip[data-id="1"] svg.mx-hw-face').length===2""")
- rows=await page.locator(".mx-hw-row").count()
- assert rows>=6,(width,rows)
- assert await page.locator(".codepen-buttons-wrapper,.hw-switch-socket").count()==0
- first=page.locator('#tracks .strip[data-id="1"]')
- keys=first.locator(".mx-hw-row>button.mx-hw-key")
- assert await keys.count()==3
- details=await keys.evaluate_all("""xs=>xs.map(e=>{
- const s=getComputedStyle(e),r=e.getBoundingClientRect();
- const svg=e.querySelector('svg.mx-hw-face');
- const cssFace=e.querySelector('.mx-mute-face');
- return {
- kind:e.dataset.hwKind,action:e.dataset.action,
- label:svg?.querySelector('mask text')?.textContent||e.querySelector('.mx-mute-legend')?.textContent,
- masks:svg?.querySelectorAll('mask').length||0,
- texts:svg?.querySelectorAll('mask text').length||0,
- ambient:!!svg?.querySelector('rect[fill="#edf6fa"]'),
- cap:!!svg?.querySelector('linearGradient[id^="mx-cap"]'),
- shine:!!svg?.querySelector('linearGradient[id^="mx-shine"]'),
- cssFace:!!cssFace,
- faceGradient:cssFace?getComputedStyle(cssFace,'::before').backgroundImage:null,
- led:s.getPropertyValue('--mx-hw-led').trim(),
- h:r.height,w:r.width,x:r.x,y:r.y,filter:s.filter,
- glow:getComputedStyle(e,'::before').opacity,
- lamp:svg?getComputedStyle(svg.querySelector('.mx-hw-lamp')).opacity:null,
- background:s.backgroundImage,focus:e.getAttribute('aria-label')
- };
- })""")
- assert [d["kind"] for d in details]==["mute","solo","cue"],details
- assert [d["action"] for d in details]==["mute","solo","cue"],details
- assert [d["label"] for d in details]==["MUTE","SOLO","PFL"],details
- assert [d["led"] for d in details]==["255,78,90","255,207,68","101,210,236"],details
- assert details[0]["cssFace"] and details[0]["masks"]==0,details
- assert "linear-gradient" in details[0]["faceGradient"],details
- assert details[0]["background"]=="none",details
- assert all(d["masks"]==1 and d["texts"]==1 and d["ambient"] and d["cap"] and d["shine"]
- for d in details[1:]),details
- assert all(abs(d["h"]-29)<.7 and d["w"]>=26 for d in details),details
- assert max(d["y"] for d in details)-min(d["y"] for d in details)<.6,details
- assert max(d["w"] for d in details)-min(d["w"] for d in details)<1.7,details
- assert all(details[i]["x"]+details[i]["w"]<=details[i+1]["x"]+.3 for i in range(2)),details
- assert all(d["filter"]=="none" for d in details),details
- assert all(d["glow"]=="0" and d["lamp"]=="0" for d in details[1:]),details
- assert all(d["focus"] for d in details),details
- before=await keys.nth(0).evaluate("(e)=>getComputedStyle(e.querySelector('.mx-mute-face'),'::before').backgroundImage")
- await keys.nth(0).hover()
- after=await keys.nth(0).evaluate("(e)=>getComputedStyle(e.querySelector('.mx-mute-face'),'::before').backgroundImage")
- assert before==after,"MUTE hover must not repaint the cap"
- if width==1680:
- await page.screenshot(path="pages-mixer-v6-OFF-1680.png")
- for n in range(3):await keys.nth(n).click()
- assert await page.locator('#tracks .strip[data-id="1"] .mx-hw-row>button[aria-pressed="true"]').count()==3
- on=await page.locator('#tracks .strip[data-id="1"] .mx-hw-row>button').evaluate_all("""xs=>xs.map(e=>{
- const svg=e.querySelector('svg.mx-hw-face');
- return {
- kind:e.dataset.hwKind,
- face:!!e.querySelector('.mx-mute-face'),
- legend:e.querySelector('.mx-mute-legend')?getComputedStyle(e.querySelector('.mx-mute-legend')).color:null,
- lamp:svg?getComputedStyle(svg.querySelector('.mx-hw-lamp')).opacity:null,
- glow:getComputedStyle(e,'::before').opacity,
- rgb:svg?getComputedStyle(svg.querySelector('linearGradient[id^="mx-lamp"] stop')).stopColor:null
- };
- })""")
- assert on[0]["face"] and on[0]["legend"]=="rgb(242, 231, 231)",on
- assert all(x["glow"]=="1" and x["lamp"]=="1" for x in on[1:]),on
- assert [x["rgb"] for x in on[1:]]==["rgb(255, 207, 68)","rgb(101, 210, 236)"],on
- if width==1680:
- await page.screenshot(path="pages-mixer-v6-ON-1680.png")
- await keys.nth(0).click()
- state=await page.locator('#tracks .strip[data-id="1"] .mx-hw-row>button').evaluate_all(
- "xs=>xs.map(x=>x.getAttribute('aria-pressed'))")
- assert state==['false','true','true'],state
- await page.locator('#tracks .strip[data-id="1"] button[data-action="solo"]').click()
- await page.wait_for_function("""()=>{
- const row=document.querySelector('#tracks .strip[data-id="1"] .mx-hw-row');
- return !!row?.querySelector('.mx-mute-face') && row.querySelectorAll('svg.mx-hw-face').length===2;
- }""")
- assert await page.locator('#tracks .strip[data-id="1"] .mx-hw-row>button').count()==3
+ assert "assets/mixer-control-keys.css" in html
+ assert "assets/mixer-control-keys.js" in html
+ assert "background-size:200% 300%" in css
+ assert "aria-pressed" in css
+ assert SPRITE in css
+ assert JS.is_file()
+ assert (PAGE.parent/"assets"/SPRITE).is_file()
+ assert not (ROOT/"site/preview-v2").exists()
+ assert not (ROOT/"site/preview-buttons").exists()
async def main():
- assert_ownership()
+ source_gate()
async with async_playwright() as p:
browser=await p.chromium.launch(headless=True)
- for width in (1366,1680):
+ for width in (1366,1680,1920):
page=await browser.new_page(viewport={"width":width,"height":900})
errors=[]
- page.on("pageerror",lambda e:errors.append(str(e)))
+ page.on("pageerror",lambda exc:errors.append(str(exc)))
await page.goto(PAGE.as_uri())
- await assert_mixer(page,width)
+ keys=page.locator('#tracks .strip[data-id="1"] .mx-hw-row>button.mx-hw-key')
+ await keys.first.wait_for()
+ assert await keys.count()==3
+ labels=await keys.evaluate_all("els=>els.map(x=>x.dataset.hwKind)")
+ assert labels==["mute","solo","cue"],labels
+ assert await page.locator("#wireLayer").count()==1
+ assert await page.locator(".mx-mute-face,svg.mx-hw-face").count()==0
+ before=await keys.evaluate_all("els=>els.map(x=>x.getAttribute('aria-pressed'))")
+ faces=await keys.evaluate_all(
+ "els=>els.map(x=>getComputedStyle(x,'::before').backgroundImage)")
+ assert all(SPRITE in face for face in faces),(width,faces)
+ for i in range(3):
+ await keys.nth(i).click()
+ after=await keys.evaluate_all("els=>els.map(x=>x.getAttribute('aria-pressed'))")
+ assert all(x!=y for x,y in zip(before,after)),(width,before,after)
assert not errors,(width,errors)
await page.close()
await browser.close()
- print("PASS: CSS-built MUTE, V6 SOLO/PFL masked icons, stable 29px keys, OFF/ON toggle, WIRE intact")
+ print("PASS: one /preview/ PNG MUTE/SOLO/PFL owner, 3 widths, WIRE and latch states")
if __name__=="__main__":
asyncio.run(main())
diff --git a/tests/pages_css_architecture_v10_smoke.py b/tests/pages_css_architecture_v10_smoke.py
index 3061b55c2..6f396e53b 100644
--- a/tests/pages_css_architecture_v10_smoke.py
+++ b/tests/pages_css_architecture_v10_smoke.py
@@ -5,7 +5,7 @@
from playwright.async_api import async_playwright
ROOT = Path(__file__).resolve().parents[1]
-HTML = ROOT / "site/preview-v2/index.html"
+HTML = ROOT / "site/preview/index.html"
OWNERS = (
"mixer-console-foundation.css",
"mixer-channel-grid.css",
diff --git a/tests/pages_css_architecture_v11_smoke.py b/tests/pages_css_architecture_v11_smoke.py
index cdee2a64b..569b49aa0 100644
--- a/tests/pages_css_architecture_v11_smoke.py
+++ b/tests/pages_css_architecture_v11_smoke.py
@@ -11,7 +11,7 @@
from pages_css_architecture_v10_smoke import source_gate
ROOT = Path(__file__).resolve().parents[1]
-HTML = ROOT / "site/preview-v2/index.html"
+HTML = ROOT / "site/preview/index.html"
OWNED = (
"mixer-section-controls.css",
"mixer-section-layout.css",
diff --git a/tests/pages_css_ownership_v8_smoke.py b/tests/pages_css_ownership_v8_smoke.py
index 9d73ad3f5..cb52203b9 100644
--- a/tests/pages_css_ownership_v8_smoke.py
+++ b/tests/pages_css_ownership_v8_smoke.py
@@ -7,8 +7,8 @@
from playwright.async_api import async_playwright
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/'site/preview-v2/index.html'
-ASSETS=ROOT/'site/preview-v2/assets'
+HTML=ROOT/'site/preview/index.html'
+ASSETS=ROOT/'site/preview/assets'
RACK=ASSETS/'mixer-fx-rack.css'
PLUGIN=ASSETS/'mixer-plugin-browser.css'
diff --git a/tests/pages_css_ownership_v9_smoke.py b/tests/pages_css_ownership_v9_smoke.py
index dad7c5698..adf6e484d 100644
--- a/tests/pages_css_ownership_v9_smoke.py
+++ b/tests/pages_css_ownership_v9_smoke.py
@@ -5,7 +5,7 @@
from playwright.async_api import async_playwright
ROOT = Path(__file__).resolve().parents[1]
-HTML = ROOT / 'site/preview-v2/index.html'
+HTML = ROOT / 'site/preview/index.html'
OWNERS = [('mixer-pan-controls.css', 30, '.center-pan'),
('mixer-fader-assembly.css', 100, '.fader-travel'),
('mixer-meter-display.css', 45, '.meter-box')]
diff --git a/tests/pages_fx_rail_v53_smoke.py b/tests/pages_fx_rail_v53_smoke.py
index 9f3f55625..8d6925799 100644
--- a/tests/pages_fx_rail_v53_smoke.py
+++ b/tests/pages_fx_rail_v53_smoke.py
@@ -3,7 +3,7 @@
from pathlib import Path
from playwright.sync_api import sync_playwright
-PAGE=Path(__file__).resolve().parents[1]/"site/preview-v2/index.html"
+PAGE=Path(__file__).resolve().parents[1]/"site/preview/index.html"
BREAKPOINTS=((1366,768),(1378,911),(1680,900),(1920,1080))
DENSITIES=("comfort","standard","compact")
diff --git a/tests/pages_inter_utility_v7_smoke.py b/tests/pages_inter_utility_v7_smoke.py
index 14762750b..71d8b4735 100644
--- a/tests/pages_inter_utility_v7_smoke.py
+++ b/tests/pages_inter_utility_v7_smoke.py
@@ -6,8 +6,8 @@
from playwright.async_api import async_playwright
ROOT=Path(__file__).resolve().parents[1]
-PAGE=ROOT/'site/preview-v2/index.html'
-ASSET=ROOT/'site/preview-v2/assets'
+PAGE=ROOT/'site/preview/index.html'
+ASSET=ROOT/'site/preview/assets'
ENGINE_FONT=ROOT/'web/styles-src/00-font-and-assets.css'
def source_contract():
diff --git a/tests/pages_m1_meter_gain_calibration_smoke.py b/tests/pages_m1_meter_gain_calibration_smoke.py
index a34c63b23..21ffa6308 100644
--- a/tests/pages_m1_meter_gain_calibration_smoke.py
+++ b/tests/pages_m1_meter_gain_calibration_smoke.py
@@ -13,7 +13,7 @@
from playwright.sync_api import sync_playwright
ROOT = Path(__file__).resolve().parents[1]
-CANON = ROOT / "site/preview-v2/index.html"
+CANON = ROOT / "site/preview/index.html"
ASSETS = CANON.parent / "assets"
def close(a, b, tolerance=0.65):
@@ -199,8 +199,8 @@ def main():
subprocess.run([sys.executable,str(ROOT/"scripts/build_pages.py"),
"--out",str(dist),"--sha","m1-calibrated","--branch","m1"],
cwd=ROOT,check=True,capture_output=True,text=True)
- published=dist/"preview/mixer.html"
- assert published.read_bytes()==CANON.read_bytes(),"Published mixer source drift"
+ published=dist/"preview/index.html"
+ subprocess.run([sys.executable,str(ROOT/"tests/single_preview_publication_contract_test.py"),str(dist)],cwd=ROOT,check=True,capture_output=True,text=True)
expected_ruler_keys={
"mixer-fader-assembly.css":"css-owner-v27-fader-rollback-pre-v52-tail",
"mixer-meter-display.css":"css-owner-v27-meter-pruned",
@@ -217,7 +217,7 @@ def main():
(CANON,"canonical",1680,900),
(CANON,"canonical",1920,1080),
(published,"pages",1680,900),
- (dist/"preview-buttons/index.html","png",1366,768)):
+ (published,"approved-png",1366,768)):
page=browser.new_page(viewport={"width":width,"height":height})
errors=[]
page.on("pageerror",lambda exc:errors.append(str(exc)))
diff --git a/tests/pages_m3_operator_visual_interaction_smoke.py b/tests/pages_m3_operator_visual_interaction_smoke.py
index ad261e6a5..ad18c32aa 100644
--- a/tests/pages_m3_operator_visual_interaction_smoke.py
+++ b/tests/pages_m3_operator_visual_interaction_smoke.py
@@ -4,7 +4,7 @@
from playwright.sync_api import sync_playwright
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
+HTML=ROOT/"site/preview/index.html"
def physical(page,density,width):
page.locator("#densitySelect").select_option(density)
diff --git a/tests/pages_micro_button_assets_v1_smoke.py b/tests/pages_micro_button_assets_v1_smoke.py
index 63d9c3963..030dfd8a9 100644
--- a/tests/pages_micro_button_assets_v1_smoke.py
+++ b/tests/pages_micro_button_assets_v1_smoke.py
@@ -8,8 +8,8 @@
from playwright.sync_api import sync_playwright
ROOT=Path(__file__).resolve().parents[1]
-ASSET=ROOT/'site/preview-v2/assets'
-PAGE=ROOT/'site/preview-v2/index.html'
+ASSET=ROOT/'site/preview/assets'
+PAGE=ROOT/'site/preview/index.html'
SQUARE='micro-hardware-17x17-2x4.png'
FORMAT='format-hardware-25x15-2x1.png'
diff --git a/tests/pages_micro_fader_visual_v18_smoke.py b/tests/pages_micro_fader_visual_v18_smoke.py
index cb7446100..2ca4c0985 100644
--- a/tests/pages_micro_fader_visual_v18_smoke.py
+++ b/tests/pages_micro_fader_visual_v18_smoke.py
@@ -9,8 +9,8 @@
from playwright.sync_api import sync_playwright
ROOT=Path(__file__).resolve().parents[1]
-SOURCE=ROOT/"site/preview-v2/index.html"
-ASSETS=ROOT/"site/preview-v2/assets"
+SOURCE=ROOT/"site/preview/index.html"
+ASSETS=ROOT/"site/preview/assets"
def same_box(a,b):
return all(abs(a[k]-b[k])<=0.6 for k in ("x","y","width","height"))
@@ -111,8 +111,7 @@ def main():
with sync_playwright() as playwright:
browser=playwright.chromium.launch(headless=True)
for path,label in ((SOURCE,"canonical"),
- (dist/"preview/mixer.html","public"),
- (dist/"preview-buttons/index.html","png")):
+ (dist/"preview/index.html","png")):
page=browser.new_page(viewport={"width":1680,"height":900},device_scale_factor=1)
check(page,path,label)
browser.close()
diff --git a/tests/pages_mute_css_reference_smoke.py b/tests/pages_mute_css_reference_smoke.py
index 16b24090c..9d77eda7e 100644
--- a/tests/pages_mute_css_reference_smoke.py
+++ b/tests/pages_mute_css_reference_smoke.py
@@ -1,108 +1,25 @@
-"""Verify a genuine code-rendered MUTE hardware key on the shipped Pages GUI.
-
-PNG screenshots are design references ONLY. The shipping material is HTML/CSS:
-beveled grey OFF face, recessed red bar, red ON face, white lower reflection.
-Run as part of the existing Chromium UI smoke workflow.
-"""
-import asyncio
+"""Retired CSS-only MUTE regression replaced by CURRENT approved PNG key contract."""
from pathlib import Path
-from playwright.async_api import async_playwright
+import re
+import struct
ROOT=Path(__file__).resolve().parents[1]
-ASSETS=ROOT/"site/preview-v2/assets"
-PAGE=ROOT/"site/preview-v2/index.html"
-
-
-def assert_source():
- css=(ASSETS/"mixer-control-keys.css").read_text(encoding="utf-8")
- js=(ASSETS/"mixer-control-keys.js").read_text(encoding="utf-8")
- build=(ROOT/"scripts/build_pages.py").read_text(encoding="utf-8")
- for name in ("M-MUTE-OFF.png","M-MUTE-ON.png"):
- assert not (ASSETS/name).exists(), "Reference bitmap must not ship: "+name
- assert name not in css+js+build, "Runtime may not reference user screenshot: "+name
- section=css[css.index("/* MUTE is rendered entirely from CSS/HTML"):]
- assert "linear-gradient" in section and "box-shadow" in section
- assert "aspect-ratio:56 / 37" in section
- assert "25cqw" in section,"MUTE legend must scale with channel width"
- assert "url(" not in section and "data:image" not in section
- assert "semantic==='mute'" in js and "mx-mute-face" in js
- assert "aria-pressed" in section
- assert "resize?.observe(button);" in js # SOLO/PFL existing renderer retained
-
-
-async def check_mute(page,width):
- await page.wait_for_function("""()=>!!document.querySelector(
- '#tracks .strip[data-id="1"] button[data-hw-kind="mute"] .mx-mute-face')""")
- mute=page.locator('#tracks .strip[data-id="1"] button[data-hw-kind="mute"]')
- async def state():
- return await mute.evaluate("""el=>{
- const face=el.querySelector('.mx-mute-face');
- const caption=face?.querySelector('.mx-mute-legend');
- const lamp=face?.querySelector('.mx-mute-lamp');
- const r=el.getBoundingClientRect(),s=getComputedStyle(el);
- const p=getComputedStyle(face,'::before');
- return {
- pressed:el.getAttribute('aria-pressed'),
- action:el.dataset.action,
- width:r.width,height:r.height,
- caption:caption?.textContent,
- captionColor:getComputedStyle(caption).color,
- captionSize:parseFloat(getComputedStyle(caption).fontSize),
- faceBg:p.backgroundImage,faceShadow:p.boxShadow,
- lamp:getComputedStyle(lamp).display,
- lowerReflection:getComputedStyle(face,'::after').opacity,
- nativeImages:el.querySelectorAll('img,svg,canvas').length,
- buttonBg:s.backgroundImage,
- hoverState:s.transitionDuration
- };
- }""")
- off=await state()
- assert off["action"]=="mute" and off["pressed"]=="false",off
- assert off["caption"]=="MUTE" and off["nativeImages"]==0,off
- assert off["buttonBg"]=="none" and "linear-gradient" in off["faceBg"],off
- assert "inset" in off["faceShadow"] and off["lamp"]!="none",off
- assert off["lowerReflection"]=="0",off
- assert abs(off["height"]-29)<.8 and off["width"]>=26,off
- assert abs(off["captionSize"]-off["width"]*.25)<1.0,off # container-scaled 25cqw
- await mute.hover()
- assert (await state())["faceBg"]==off["faceBg"],"Passive hover changes material"
- await mute.click()
- on=await state()
- assert on["pressed"]=="true" and on["faceBg"]!=off["faceBg"],on
- assert on["captionColor"]!=off["captionColor"],on
- assert on["lamp"]=="none" and on["lowerReflection"]=="1",on
- assert on["nativeImages"]==0 and on["action"]=="mute",on
- if width==1680:
- await mute.screenshot(path="mute-css-on-1680.png")
- await mute.click()
- off2=await state()
- assert off2["pressed"]=="false" and off2["faceBg"]==off["faceBg"],off2
- assert off2["lamp"]!="none" and off2["lowerReflection"]=="0",off2
- # SOLO and PFL are independent from the MUTE material and state.
- siblings=await page.locator('#tracks .strip[data-id="1"] .mx-hw-row>button').evaluate_all(
- "xs=>xs.map(x=>({action:x.dataset.action,hasSVG:!!x.querySelector('svg.mx-hw-face')}))")
- assert siblings==[
- {"action":"mute","hasSVG":False},
- {"action":"solo","hasSVG":True},
- {"action":"cue","hasSVG":True},
- ],siblings
-
-
-async def main():
- assert_source()
- async with async_playwright() as p:
- browser=await p.chromium.launch(headless=True)
- for width in (1366,1680):
- page=await browser.new_page(viewport={"width":width,"height":900})
- errors=[]
- page.on("pageerror",lambda err:errors.append(str(err)))
- await page.goto(PAGE.as_uri())
- await check_mute(page,width)
- assert not errors,(width,errors)
- await page.close()
- await browser.close()
- print("PASS CSS-only MUTE, ON/OFF/OFF toggle, correct bevel and white underline; no PNG/SVG runtime; SOLO/PFL preserved")
-
-
-if __name__=="__main__":
- asyncio.run(main())
+ASSETS=ROOT/"site/preview/assets"
+HTML=(ROOT/"site/preview/index.html").read_text(encoding="utf-8")
+CSS=(ASSETS/"mixer-control-keys.css").read_text(encoding="utf-8")
+JS=(ASSETS/"mixer-control-keys.js").read_text(encoding="utf-8")
+SPRITE=(ASSETS/"mute-solo-pfl-56x37.png").read_bytes()
+
+assert SPRITE[:8]==bytes.fromhex("89504e470d0a1a0a")
+assert struct.unpack(">II",SPRITE[16:24])==(112,111)
+assert SPRITE[25]==6
+assert "assets/mixer-control-keys.css" in HTML
+assert "assets/mixer-control-keys.js" in HTML
+assert "mute-solo-pfl-56x37.png" in CSS
+assert "background-size:200% 300%" in CSS
+assert "aria-pressed" in CSS
+assert HTML.count("mixer-control-keys.css")==1
+assert JS.strip(),"approved input owner JS must not be missing"
+assert not (ROOT/"site/preview-v2").exists()
+assert not (ROOT/"site/preview-buttons").exists()
+print("PASS: approved PNG MUTE/SOLO/PFL replaces rejected CSS-only reference")
diff --git a/tests/pages_png_buttons_wire_reconciliation_smoke.py b/tests/pages_png_buttons_wire_reconciliation_smoke.py
index 036003f62..5c689c7f1 100644
--- a/tests/pages_png_buttons_wire_reconciliation_smoke.py
+++ b/tests/pages_png_buttons_wire_reconciliation_smoke.py
@@ -16,8 +16,8 @@
from playwright.sync_api import sync_playwright
ROOT=Path(__file__).resolve().parents[1]
-REFERENCE=ROOT/"site/preview-v2"
-OWNER=ROOT/"site/preview-buttons/assets"
+REFERENCE=ROOT/"site/preview"
+OWNER=ROOT/"site/preview/assets"
SPECIAL=("mixer-control-keys.css","mixer-control-keys.js")
SPRITE="mute-solo-pfl-56x37.png"
@@ -60,7 +60,7 @@ def verify_bundle(dist):
assert (generated/"assets"/name).read_bytes()==(REFERENCE/"assets"/name).read_bytes(),name
png=(generated/"assets"/SPRITE).read_bytes()
- assert png==(ROOT/"site/preview-v34/assets"/SPRITE).read_bytes()
+ assert png==(REFERENCE/"assets"/SPRITE).read_bytes()
assert png[:8]==bytes.fromhex("89504e470d0a1a0a")
assert struct.unpack(">II",png[16:24])==(112,111)
assert png[25]==6,"Must keep RGBA transparency"
diff --git a/tests/pages_v50_wire_popout_layout_smoke.py b/tests/pages_v50_wire_popout_layout_smoke.py
index 0d0706834..668f39c54 100644
--- a/tests/pages_v50_wire_popout_layout_smoke.py
+++ b/tests/pages_v50_wire_popout_layout_smoke.py
@@ -3,7 +3,7 @@
from pathlib import Path
from playwright.sync_api import sync_playwright
-HTML=Path(__file__).resolve().parents[1]/"site/preview-v2/index.html"
+HTML=Path(__file__).resolve().parents[1]/"site/preview/index.html"
def launch(page,kind):
ids={"routes":"wireNavigatorToggle","matrix":"wireMatrixToggle","config":"wireConfigToggle"}
diff --git a/tests/pages_v51_portrait_led_peak_hold_smoke.py b/tests/pages_v51_portrait_led_peak_hold_smoke.py
index 0ffaaacd6..5a456bddd 100644
--- a/tests/pages_v51_portrait_led_peak_hold_smoke.py
+++ b/tests/pages_v51_portrait_led_peak_hold_smoke.py
@@ -7,8 +7,8 @@
from playwright.sync_api import sync_playwright
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
-CSS=ROOT/"site/preview-v2/assets/mixer-meter-display.css"
+HTML=ROOT/"site/preview/index.html"
+CSS=ROOT/"site/preview/assets/mixer-meter-display.css"
def inspect_geometry(page,density,w):
page.locator("#densitySelect").select_option(density)
diff --git a/tests/pages_v52_fader_recess_smoke.py b/tests/pages_v52_fader_recess_smoke.py
index 3cdce4155..a3f24f3c0 100644
--- a/tests/pages_v52_fader_recess_smoke.py
+++ b/tests/pages_v52_fader_recess_smoke.py
@@ -9,9 +9,9 @@
from playwright.sync_api import sync_playwright
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
-FADER=ROOT/"site/preview-v2/assets/mixer-fader-assembly.css"
-METER=ROOT/"site/preview-v2/assets/mixer-meter-display.css"
+HTML=ROOT/"site/preview/index.html"
+FADER=ROOT/"site/preview/assets/mixer-fader-assembly.css"
+METER=ROOT/"site/preview/assets/mixer-meter-display.css"
APPROVED_V27_METER_BLOB="e168fe3fde3b176ce46f2c637a17db65bc510944"
APPROVED_PRE_V52_FADER_BLOB="8a2eac41b3508e35d8a6c49855512e8a0868b0e6"
@@ -39,9 +39,8 @@ def audit_checkpoint():
)
assert '#14232e!important' in css
assert "mixer-fader-assembly.css?v=css-owner-v27-fader-rollback-pre-v52-tail" in html
- assert "REFERENCE_WORKFLOW_QA_ONLY" in (
- ROOT/"site/preview/candidate.json").read_text(encoding="utf-8"), (
- "Public /preview/ must keep canonical GUI source, not a parallel stale demo"
+ assert not (ROOT/"site/preview/candidate.json").exists(), (
+ "Legacy candidate metadata must not exist in the approved source"
)
def inspect(page,width,height,density):
diff --git a/tests/pages_v54_wire_fx_context_smoke.py b/tests/pages_v54_wire_fx_context_smoke.py
index 59847f7f0..6e34cd602 100644
--- a/tests/pages_v54_wire_fx_context_smoke.py
+++ b/tests/pages_v54_wire_fx_context_smoke.py
@@ -3,7 +3,7 @@
from pathlib import Path
from playwright.sync_api import sync_playwright
-PAGE=Path(__file__).resolve().parents[1]/"site/preview-v2/index.html"
+PAGE=Path(__file__).resolve().parents[1]/"site/preview/index.html"
def wire(page,ch,direction):
node=".wire-node-out" if direction=="out" else ".wire-node-in"
diff --git a/tests/pages_v55_context_wire_fader_smoke.py b/tests/pages_v55_context_wire_fader_smoke.py
index 51f838402..f3bc7347b 100644
--- a/tests/pages_v55_context_wire_fader_smoke.py
+++ b/tests/pages_v55_context_wire_fader_smoke.py
@@ -2,7 +2,7 @@
"""V55 context-aware physical WIRE dot paint; preserve owner-restored V51 fader shadow."""
from pathlib import Path
from playwright.sync_api import sync_playwright
-PAGE=Path(__file__).resolve().parents[1]/"site/preview-v2/index.html"
+PAGE=Path(__file__).resolve().parents[1]/"site/preview/index.html"
def node(page,ch,direction):
sel=".wire-node-out" if direction=="out" else ".wire-node-in"
dot=".wire-pin" if direction=="out" else ".wire-arrow"
diff --git a/tests/pages_wire_dot_v42_smoke.py b/tests/pages_wire_dot_v42_smoke.py
index f56cbaab6..6c62882e3 100644
--- a/tests/pages_wire_dot_v42_smoke.py
+++ b/tests/pages_wire_dot_v42_smoke.py
@@ -2,7 +2,7 @@
"""Public ArSonMix V42: original OUT pin fill, drag follower and magnetic IN."""
from pathlib import Path
from playwright.sync_api import sync_playwright
-PAGE=Path(__file__).resolve().parents[1]/"site/preview-v2/index.html"
+PAGE=Path(__file__).resolve().parents[1]/"site/preview/index.html"
WIRE_STYLE=PAGE.with_name("assets")/"mixer-wire-dots.css"
assert 'assets/mixer-wire-dots.css?v=v59-selected-wire-quiet' in PAGE.read_text(encoding="utf-8")
assert 'wire-node-out .wire-pin' in WIRE_STYLE.read_text(encoding="utf-8")
diff --git a/tests/pages_wire_first_canonical_main_smoke.py b/tests/pages_wire_first_canonical_main_smoke.py
index 944b9cbde..b2bde7ddf 100644
--- a/tests/pages_wire_first_canonical_main_smoke.py
+++ b/tests/pages_wire_first_canonical_main_smoke.py
@@ -3,7 +3,7 @@
from pathlib import Path
from playwright.sync_api import sync_playwright
-PAGE=Path(__file__).resolve().parents[1]/"site/preview-v2/index.html"
+PAGE=Path(__file__).resolve().parents[1]/"site/preview/index.html"
def edge(page, channel, endpoint):
selector=(f'#tracks .strip[data-id="{channel}"] .wire-node-out'
diff --git a/tests/pages_wire_focus_v40_smoke.py b/tests/pages_wire_focus_v40_smoke.py
index deaa95719..24d691b98 100644
--- a/tests/pages_wire_focus_v40_smoke.py
+++ b/tests/pages_wire_focus_v40_smoke.py
@@ -3,7 +3,7 @@
from pathlib import Path
from playwright.sync_api import sync_playwright
-PAGE=Path(__file__).resolve().parents[1]/"site/preview-v2/index.html"
+PAGE=Path(__file__).resolve().parents[1]/"site/preview/index.html"
def main():
with sync_playwright() as pw:
diff --git a/tests/pages_wire_incoming_v43_smoke.py b/tests/pages_wire_incoming_v43_smoke.py
index 8c6b3f33f..be5b675af 100644
--- a/tests/pages_wire_incoming_v43_smoke.py
+++ b/tests/pages_wire_incoming_v43_smoke.py
@@ -5,8 +5,8 @@
from playwright.sync_api import sync_playwright
ROOT=Path(__file__).resolve().parents[1]
-CANONICAL=ROOT/"site/preview-v2/index.html"
-WIRE_CSS=ROOT/"site/preview-v2/assets/mixer-wire-dots.css"
+CANONICAL=ROOT/"site/preview/index.html"
+WIRE_CSS=ROOT/"site/preview/assets/mixer-wire-dots.css"
def center(el):
r=el.bounding_box()
diff --git a/tests/pages_wire_v44_finish_smoke.py b/tests/pages_wire_v44_finish_smoke.py
index b06887855..ea99c23bf 100644
--- a/tests/pages_wire_v44_finish_smoke.py
+++ b/tests/pages_wire_v44_finish_smoke.py
@@ -6,8 +6,8 @@
from pages_wire_incoming_v43_smoke import center, impact_peak
ROOT=Path(__file__).resolve().parents[1]
-SRC=ROOT/"site/preview-v2/index.html"
-CSS=ROOT/"site/preview-v2/assets/mixer-wire-dots.css"
+SRC=ROOT/"site/preview/index.html"
+CSS=ROOT/"site/preview/assets/mixer-wire-dots.css"
def box(loc):
r=loc.bounding_box()
diff --git a/tests/pages_wire_v45_socket_layout_smoke.py b/tests/pages_wire_v45_socket_layout_smoke.py
index 9c5f2773c..3f3149627 100644
--- a/tests/pages_wire_v45_socket_layout_smoke.py
+++ b/tests/pages_wire_v45_socket_layout_smoke.py
@@ -9,8 +9,8 @@
from pages_wire_incoming_v43_smoke import center
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
-STYLE=ROOT/"site/preview-v2/assets/mixer-wire-dots.css"
+HTML=ROOT/"site/preview/index.html"
+STYLE=ROOT/"site/preview/assets/mixer-wire-dots.css"
def rect(loc):
box=loc.bounding_box()
diff --git a/tests/pages_wire_v46_precision_smoke.py b/tests/pages_wire_v46_precision_smoke.py
index 95a8f1e0d..3da0f7352 100644
--- a/tests/pages_wire_v46_precision_smoke.py
+++ b/tests/pages_wire_v46_precision_smoke.py
@@ -12,8 +12,8 @@
from playwright.sync_api import sync_playwright
ROOT=Path(__file__).resolve().parents[1]
-HTML=ROOT/"site/preview-v2/index.html"
-CSS=ROOT/"site/preview-v2/assets/mixer-wire-dots.css"
+HTML=ROOT/"site/preview/index.html"
+CSS=ROOT/"site/preview/assets/mixer-wire-dots.css"
def center(loc):
box=loc.bounding_box()
@@ -53,7 +53,7 @@ def main():
assert public.read_bytes()==HTML.read_bytes(),"published /preview/ HTML is stale"
assert (dist/"preview/assets/mixer-wire-dots.css").read_bytes()==CSS.read_bytes(),"public WIRE CSS differs"
assert "assets/mixer-wire-dots.css?v=v59-selected-wire-quiet" in public.read_text("utf-8")
- assert (dist/"preview/assets/mixer-wire-out-align-v48.css").read_bytes()==(ROOT/"site/preview-v2/assets/mixer-wire-out-align-v48.css").read_bytes(), "V48 alignment stylesheet missing from /preview/"
+ assert (dist/"preview/assets/mixer-wire-out-align-v48.css").read_bytes()==(ROOT/"site/preview/assets/mixer-wire-out-align-v48.css").read_bytes(), "V48 alignment stylesheet missing from /preview/"
assert "assets/mixer-wire-out-align-v48.css?v=out-center-v48" in public.read_text("utf-8")
with sync_playwright() as pw:
diff --git a/tests/pages_wire_v49_direct_controls_smoke.py b/tests/pages_wire_v49_direct_controls_smoke.py
index b56bb13b1..86d282dd6 100644
--- a/tests/pages_wire_v49_direct_controls_smoke.py
+++ b/tests/pages_wire_v49_direct_controls_smoke.py
@@ -4,7 +4,7 @@
from playwright.sync_api import sync_playwright
ROOT=Path(__file__).resolve().parents[1]
-PAGE=ROOT/"site/preview-v2/index.html"
+PAGE=ROOT/"site/preview/index.html"
def center(box):
assert box and box["width"] and box["height"], box
diff --git a/tests/preview_v15_drag_wire_smoke.py b/tests/preview_v15_drag_wire_smoke.py
index 14f9e5d48..49f444ef6 100644
--- a/tests/preview_v15_drag_wire_smoke.py
+++ b/tests/preview_v15_drag_wire_smoke.py
@@ -10,7 +10,7 @@
HERE=Path(__file__).resolve()
ROOT=next(p for p in HERE.parents if (p/".github").is_dir())
-PAGE=HERE.with_name("index.html") if HERE.parent.name=="audition-mixer-study" else ROOT/"site/preview-v2/index.html"
+PAGE=HERE.with_name("index.html") if HERE.parent.name=="audition-mixer-study" else ROOT/"site/preview/index.html"
def assert_true(value,message):
if not value: raise AssertionError(message)
diff --git a/tests/preview_v2_v7_visual_smoke.py b/tests/preview_v2_v7_visual_smoke.py
index 09f095a73..a90ad2fd9 100644
--- a/tests/preview_v2_v7_visual_smoke.py
+++ b/tests/preview_v2_v7_visual_smoke.py
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
"""Run headless real-Chromium physical geometry and workflow audit for Pages V7.
-This is an independent review of the published /preview-v2/ snapshot in main,
+This is an independent review of the approved /preview/ source in main,
NOT a validation of native ASIO/VST3 audio. Screenshots are uploaded by UI smoke.
-No external web request; local site/preview-v2/index.html only.
+No external web request; local site/preview/index.html only.
"""
from __future__ import annotations
from pathlib import Path
@@ -11,7 +11,7 @@
from playwright.sync_api import sync_playwright
ROOT = Path(__file__).resolve().parents[1]
-PAGE = (ROOT / "site/preview-v2/index.html").resolve()
+PAGE = (ROOT / "site/preview/index.html").resolve()
PUBLIC = (ROOT / "_preview-public-qa/preview/index.html").resolve()
SIZES = [(1366, 768), (1666, 888), (1711, 1005), (1920, 1080)]
diff --git a/tests/reconciled_gui_engine_contract_test.mjs b/tests/reconciled_gui_engine_contract_test.mjs
index 5fede272e..d9846a65b 100644
--- a/tests/reconciled_gui_engine_contract_test.mjs
+++ b/tests/reconciled_gui_engine_contract_test.mjs
@@ -62,7 +62,8 @@ test('JUCE native resources use EXACT assembled Pages /preview/, not archived we
assert.doesNotMatch(cmake,/^\s+web\/index\.html web\/styles\.css/m);
assert.match(generator,/scripts" \/ "build_pages\.py"/);
assert.match(pagesBuilder,/APPROVED_SINGLE_GUI/);
- assert.match(pagesBuilder,/buttons_dest=dst\/'preview'/);
+ assert.match(pagesBuilder,/dest = dst \/ "preview"/);
+ assert.match(pagesBuilder,/SOURCE = ROOT \/ "site" \/ "preview"/);
assert.match(generator,/approvedPagesHtmlSha256/);
assert.match(generator,/SCAFFOLD_ONLY__NOT_LIVE_PCM/);
assert.match(nativeAdapter,/acceptedGraphConnected: false/);
diff --git a/tests/single_preview_publication_contract_test.py b/tests/single_preview_publication_contract_test.py
index 3603b1d76..712e25e45 100644
--- a/tests/single_preview_publication_contract_test.py
+++ b/tests/single_preview_publication_contract_test.py
@@ -4,10 +4,14 @@
ROOT=Path(__file__).resolve().parents[1]
DST=Path(sys.argv[1]).resolve() if len(sys.argv)>1 else ROOT/'dist-pages'
gui=DST/'preview'
+# There is exactly one checked-in renderer and one hardware-button asset owner.
+for retired in ("preview-v2","preview-buttons","preview-v33","preview-v34"):
+ if (ROOT/"site"/retired).exists():
+ raise AssertionError("REJECTED alternate source still checked in: site/"+retired)
def require(ok,why):
if not ok: raise AssertionError('SINGLE APPROVED PREVIEW FAILED: '+why)
html=(gui/'index.html').read_text(encoding='utf-8')
-source=(ROOT/'site/preview-v2/index.html').read_text(encoding='utf-8')
+source=(ROOT/'site/preview/index.html').read_text(encoding='utf-8')
build=json.loads((gui/'build.json').read_text(encoding='utf-8'))
require(build.get('kind')=='APPROVED_SINGLE_GUI' and build.get('canonical_url')=='/preview/','wrong public GUI identity')
require(build.get('live_audio') is False,'browser must not claim PCM')
@@ -22,13 +26,13 @@ def require(ok,why):
pattern=re.compile(re.escape(token)+r'(?:\?[^"\s>]+)?')
require(len(pattern.findall(expected))==1,'approved key CSS/JS link missing or duplicated: '+name)
expected=pattern.sub(token+'?rev='+revisions[name],expected)
- approved=ROOT/'site/preview-buttons/assets'/name
+ approved=ROOT/'site/preview/assets'/name
target=gui/'assets'/name
require(target.read_bytes()==approved.read_bytes(),'wrong PNG-button CSS/JS: '+name)
require(html==expected,'rendered /preview/ DOM differs from exact source + approved PNG-key revision assembly')
for name in ('mixer-wire-dots.css','knob-ICON.svg'):
- require((gui/'assets'/name).read_bytes()==(ROOT/'site/preview-v2/assets'/name).read_bytes(),'WIRE source drift: '+name)
-require((gui/'assets/mute-solo-pfl-56x37.png').read_bytes()==(ROOT/'site/preview-buttons/assets/mute-solo-pfl-56x37.png').read_bytes(),'approved PNG sprite mismatch')
+ require((gui/'assets'/name).read_bytes()==(ROOT/'site/preview/assets'/name).read_bytes(),'WIRE source drift: '+name)
+require((gui/'assets/mute-solo-pfl-56x37.png').read_bytes()==(ROOT/'site/preview/assets/mute-solo-pfl-56x37.png').read_bytes(),'approved PNG sprite mismatch')
require(not (gui/'candidate.json').exists(),'legacy preview candidate metadata still published')
require('http-equiv="refresh"' in (gui/'mixer.html').read_text(encoding='utf-8'),'old mixer.html must redirect, never be another GUI')
for old in ('preview-v2','preview-buttons','preview-v33','preview-v34'):
diff --git a/tests/wire_graph_canonical_model.test.cjs b/tests/wire_graph_canonical_model.test.cjs
index a8a5a2aeb..853cfc687 100644
--- a/tests/wire_graph_canonical_model.test.cjs
+++ b/tests/wire_graph_canonical_model.test.cjs
@@ -1,7 +1,7 @@
#!/usr/bin/env node
'use strict';
const assert=require('node:assert/strict');
-const graph=require('../site/preview-v2/assets/wire-graph-model.js');
+const graph=require('../site/preview/assets/wire-graph-model.js');
const channels=[{id:1,name:'CH1',output:'Master'},{id:2,name:'CH2',output:'Master'},
{id:3,name:'CH3',output:'Master'}];
const base=graph.migrateLegacy(channels,9);
diff --git a/tests/wire_knob_asset_contract_test.py b/tests/wire_knob_asset_contract_test.py
index 27a93939b..cd62dc4d7 100644
--- a/tests/wire_knob_asset_contract_test.py
+++ b/tests/wire_knob_asset_contract_test.py
@@ -1,4 +1,4 @@
-"""Regression: CSS knob mask must exist for the public Live GUI and Preview V2.
+"""Regression: one approved /preview/ SVG knob exists and matches CSS mask.
The reference knob was intentionally supplied as SVG. A missing CSS mask asset
makes the knob entirely transparent even though WIRE routing still works.
@@ -9,11 +9,10 @@
from xml.etree import ElementTree as ET
root = Path(__file__).resolve().parents[1]
-ref = root / "site/preview-v2/index.html"
-svg = root / "site/preview-v2/assets/knob-ICON.svg"
-legacy_preview = root / "site/preview/assets/knob-ICON.svg"
+ref = root / "site/preview/index.html"
+svg = root / "site/preview/assets/knob-ICON.svg"
html = ref.read_text(encoding="utf-8")
-wire_owner = (root / "site/preview-v2/assets/mixer-wire-dots.css").read_text(encoding="utf-8")
+wire_owner = (root / "site/preview/assets/mixer-wire-dots.css").read_text(encoding="utf-8")
# WIRE declarations may be owned by the existing component stylesheet after V16.
material = html + "\n" + wire_owner
# Inline the supplied SVG exactly: CSS masks loaded from file:// or another
@@ -21,8 +20,7 @@
match = re.search(r'data:image/svg\+xml;base64,([A-Za-z0-9+/=]+)', material)
assert match, "SVG silhouette missing from live HTML and WIRE CSS owner"
assert svg.is_file() and svg.stat().st_size > 100, "Preview V2 SVG knob missing"
-assert legacy_preview.is_file(), "Main Live GUI /preview/ SVG knob missing"
-assert svg.read_bytes() == legacy_preview.read_bytes(), "Live preview knob differs from source"
+assert svg.is_file(), "Canonical /preview/ knob source missing"
assert b64decode(match.group(1)) == svg.read_bytes(), "Inline WIRE mask does not match supplied SVG"
assert 'mask-mode:alpha!important' in material, "WIRE SVG must use explicit alpha mask mode"
xml = ET.parse(svg).getroot()
diff --git a/tests/wire_main_native_handoff_contract.test.cjs b/tests/wire_main_native_handoff_contract.test.cjs
index 036be23a3..8a70665f4 100644
--- a/tests/wire_main_native_handoff_contract.test.cjs
+++ b/tests/wire_main_native_handoff_contract.test.cjs
@@ -8,8 +8,8 @@ const path=require("node:path");
const root=path.resolve(__dirname,"..");
const read=p=>fs.readFileSync(path.join(root,p),"utf8");
const contract=JSON.parse(read("contracts/console-puzzle-v8.json"));
-const ui=read("site/preview-v2/index.html");
-const css=read("site/preview-v2/assets/mixer-wire-dots.css");
+const ui=read("site/preview/index.html");
+const css=read("site/preview/assets/mixer-wire-dots.css");
const handoff=read("docs/workstreams/WIRE_V59_MAIN_NATIVE_ENGINE_RECONCILIATION_20261104.md");
assert.equal(contract.schemaVersion,6,"The installed Console v8 envelope must not be replaced");
diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js
index 6b43c23c3..274ead9d0 100644
--- a/web/approved-native-bridge.js
+++ b/web/approved-native-bridge.js
@@ -6,7 +6,7 @@
"use strict";
const backend = window.__JUCE__?.backend;
const descriptor = Object.freeze({
- source: "site/preview-v2 + site/preview-buttons",
+ source: "site/preview/",
pagesRoute: "/preview/",
nativeTransport: Boolean(backend?.emitEvent && backend?.addEventListener),
acceptedGraphConnected: false,