screw-bugs 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +83 -13
  2. package/dist/browser-playwright/launch.js +27 -10
  3. package/dist/browser-playwright/page.d.ts +50 -28
  4. package/dist/browser-playwright/page.js +101 -91
  5. package/dist/browser-playwright/recorder.d.ts +154 -0
  6. package/dist/browser-playwright/recorder.js +382 -0
  7. package/dist/build-info.json +3 -3
  8. package/dist/cli/commands.js +56 -11
  9. package/dist/cli/mcp.d.ts +11 -4
  10. package/dist/cli/mcp.js +86 -23
  11. package/dist/cli/operations.d.ts +30 -2
  12. package/dist/cli/operations.js +126 -20
  13. package/dist/cli/report-links.js +2 -2
  14. package/dist/cli/report-server.d.ts +41 -9
  15. package/dist/cli/report-server.js +139 -23
  16. package/dist/cli/share.d.ts +71 -4
  17. package/dist/cli/share.js +540 -109
  18. package/dist/cli/sign-in.d.ts +22 -10
  19. package/dist/cli/sign-in.js +23 -23
  20. package/dist/core/engine.js +54 -13
  21. package/dist/core/liveness.js +3 -1
  22. package/dist/core/services.d.ts +29 -4
  23. package/dist/core/share.d.ts +31 -0
  24. package/dist/core/share.js +139 -0
  25. package/dist/core/steps.d.ts +5 -0
  26. package/dist/core/steps.js +15 -1
  27. package/dist/core/video.d.ts +6 -0
  28. package/dist/core/video.js +8 -0
  29. package/dist/report/html.d.ts +4 -2
  30. package/dist/report/html.js +36 -13
  31. package/dist/report/icons.d.ts +3 -0
  32. package/dist/report/icons.js +5 -1
  33. package/dist/report/index.d.ts +3 -1
  34. package/dist/report/index.js +3 -1
  35. package/dist/report/live.d.ts +7 -0
  36. package/dist/report/live.js +135 -0
  37. package/dist/report/menu-bar.d.ts +3 -3
  38. package/dist/report/menu-bar.js +3 -3
  39. package/dist/report/player.d.ts +3 -3
  40. package/dist/report/player.js +3 -3
  41. package/dist/report/share-page.d.ts +48 -0
  42. package/dist/report/share-page.js +291 -0
  43. package/dist/report/styles.d.ts +2 -0
  44. package/dist/report/styles.js +2 -2
  45. package/dist/report/view.js +2 -0
  46. package/dist/report/walkthrough.d.ts +5 -2
  47. package/dist/report/walkthrough.js +17 -5
  48. package/dist/schema/accounts.js +10 -1
  49. package/dist/schema/evidence.d.ts +15 -8
  50. package/dist/schema/evidence.js +9 -4
  51. package/dist/schema/findings.js +1 -1
  52. package/dist/schema/job.d.ts +205 -65
  53. package/dist/schema/job.js +63 -11
  54. package/dist/schema/ledger.d.ts +80 -16
  55. package/dist/schema/ledger.js +36 -0
  56. package/dist/schema/share.d.ts +17 -0
  57. package/dist/schema/share.js +22 -0
  58. package/package.json +1 -1
@@ -231,3 +231,11 @@ export const stillStretches = (frames, frameMs) => {
231
231
  add(start * frameMs, frames.length * frameMs);
232
232
  return stretches;
233
233
  };
234
+ /**
235
+ * `stretches` cut at the end of a video `videoMs` long, leaving out those no longer
236
+ * `STILL_MIN_MS` long. Read back at a constant rate, a video with a frame only where the page
237
+ * changed can run on past its end: ffmpeg shows its last frame as long as the gap before it.
238
+ */
239
+ export const stillWithin = (stretches, videoMs) => stretches
240
+ .map((s) => ({ fromMs: s.fromMs, toMs: Math.min(s.toMs, videoMs) }))
241
+ .filter((s) => s.toMs - s.fromMs >= STILL_MIN_MS);
@@ -11,7 +11,9 @@ import { type RenderOptions } from './assets.js';
11
11
  * (a case with no video to play stops the player, which says so in the video's place); a click
12
12
  * on a case, a scrubber segment or a case link makes that case current (scrolling it to the line,
13
13
  * with scroll detection held off for 700 ms meanwhile); with "Loop case" off the current case
14
- * follows the playhead. A timecode seeks the player there, playing on only when it was playing.
14
+ * follows the playhead. With "Skip inactive" on (as the walkthrough's, and remembered with it), it
15
+ * jumps over the stretches where nothing happened (`idleStretches`) while it plays; a stretch that
16
+ * runs past the end of the case being looped starts the case again instead. A timecode seeks the player there, playing on only when it was playing.
15
17
  * The status filters hide cards (a hidden current case hands over to the
16
18
  * first shown). Screenshots open in a modal viewer that steps through the case's shots (arrow
17
19
  * keys, Esc, focus back where it was). A screenshot that cannot load says so in its figure, as
@@ -19,7 +21,7 @@ import { type RenderOptions } from './assets.js';
19
21
  * failed. Without script: the video has its own controls, timecodes open the video at their time
20
22
  * and screenshots open the image.
21
23
  */
22
- export declare const REPORT_SCRIPT = "(()=>{const d=document,r=d.documentElement,K='screw-bugs-theme';\nconst still=()=>matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst topEdge=()=>{const b=d.querySelector('.menubar');return b?Math.max(0,b.getBoundingClientRect().bottom):0};\nconst pad=n=>String(n).padStart(2,'0');\nconst clock=s=>{s=Math.max(0,Math.floor(s||0));const h=Math.floor(s/3600),m=Math.floor(s%3600/60);return(h?h+':'+pad(m):String(m))+':'+pad(s%60)};\nlet theme='system';try{theme=localStorage.getItem(K)||theme}catch(e){}r.dataset.theme=theme;\nconst themeCycle=(b,key)=>{\n const r=document.documentElement,T=['light','dark','system'],N={light:'Light theme',dark:'Dark theme',system:'Theme from system'};\n const at=()=>{const i=T.indexOf(r.dataset.theme);return i<0?2:i};\n const show=()=>{const i=at(),f=document.getElementById('favicon'),h=f&&f.dataset[T[i]];if(h)f.href=h;b.setAttribute('aria-label',N[T[i]]+'. Switch to '+N[T[(i+1)%3]].toLowerCase());b.title=N[T[i]]};\n show();\n b.addEventListener('click',()=>{const m=T[(at()+1)%3];r.dataset.theme=m;if(key)try{localStorage.setItem(key,m)}catch(e){}show()});\n};\nconst chrome=()=>{\n d.querySelectorAll('.menubar .theme').forEach(b=>{themeCycle(b,K);b.hidden=false});\n if(location.protocol==='http:'&&(location.hostname==='127.0.0.1'||location.hostname==='localhost'))d.querySelectorAll('a.share-btn').forEach(a=>{a.hidden=false});\n d.querySelectorAll('time.when[datetime]').forEach(e=>{\n const t=new Date(e.getAttribute('datetime'));if(isNaN(t.getTime()))return;const p={};\n try{new Intl.DateTimeFormat('en-US',{month:'short',day:'numeric',year:'numeric',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(t).forEach(x=>{p[x.type]=x.value});\n const y=d.createElement('span');y.className='year';y.textContent=', '+p.year;\n e.replaceChildren(p.month+' '+p.day,y,' '+String.fromCharCode(183)+' '+p.hour+':'+p.minute);\n e.title=new Intl.DateTimeFormat('en-US',{dateStyle:'full',timeStyle:'long'}).format(t)}catch(x){}\n });\n d.querySelectorAll('.prompt').forEach(p=>{\n const t=p.querySelector('.prompt-text'),b=p.querySelector('.prompt-more');if(!t||!b)return;\n const fits=()=>{if(!p.classList.contains('open'))b.hidden=t.scrollHeight<=t.clientHeight+1};\n fits();if(window.ResizeObserver)new ResizeObserver(fits).observe(t);if(d.fonts&&d.fonts.ready)d.fonts.ready.then(fits);\n b.addEventListener('click',()=>{const o=p.classList.toggle('open');b.textContent=o?'Show less':'Show full prompt';b.setAttribute('aria-expanded',String(o));fits()});\n });\n};\nconst bare=u=>{const i=u.indexOf('://');return i<0?u:u.slice(i+3)};\nconst player=(p,o)=>{\n const v=d.getElementById(p+'-video'),fig=v.closest('.player'),note=d.getElementById(p+'-unloaded'),c=d.getElementById(p+'-controls'),url=d.getElementById(p+'-url');\n const srcs=new Map([...fig.querySelectorAll('[data-session-src]')].map(e=>[e.dataset.session,e.dataset.sessionSrc]));\n const order=[...srcs.keys()];\n const urls=[...fig.querySelectorAll('[data-url]')].map(e=>({s:e.dataset.s,t:Number(e.dataset.at),u:e.dataset.url}));\n const dead=new Set(),errs=new Map(),empty=d.getElementById(p+'-none');let shown=0,cur=v.dataset.session,down=null,held=false,ask=0,auto=false,rate=1,raf=0,drag=false;\n const play=c.querySelector('.play'),now=c.querySelector('.now'),total=c.querySelector('.total'),bar=c.querySelector('.scrub'),head=c.querySelector('.head'),tracks=[...c.querySelectorAll('.track')];\n v.removeAttribute('controls');c.hidden=false;\n const big=d.getElementById(p+'-start');\n if(big){big.hidden=false;big.addEventListener('click',()=>{grow();v.play().catch(()=>{})});v.addEventListener('play',()=>big.remove(),{once:true})}\n const track=()=>tracks.find(t=>t.dataset.s===cur);\n const len=()=>{const t=track(),n=t?Number(t.dataset.total):0;return n>0?n:(isFinite(v.duration)?v.duration:0)};\n const paint=()=>{\n const L=len(),t=v.currentTime,f=L?Math.min(1,t/L):0,k=track();\n tracks.forEach(x=>{x.hidden=x!==k});head.style.left=(f*100)+'%';\n const done=k&&k.querySelector('.done');if(done)done.style.width=(f*100)+'%';\n now.textContent=clock(t);total.textContent=clock(L);\n bar.setAttribute('aria-valuemax',String(Math.round(L)));bar.setAttribute('aria-valuenow',String(Math.round(t)));bar.setAttribute('aria-valuetext',clock(t)+' of '+clock(L));\n play.classList.toggle('playing',!v.paused);play.setAttribute('aria-label',v.paused?'Play':'Pause');\n if(url){let u='';if(down!=='')for(const x of urls){if(x.s===cur&&x.t<=t+0.02)u=x.u}url.textContent=bare(u);url.parentElement.title=u}\n };\n const update=()=>{paint();if(o.tick)o.tick(v.currentTime)};\n const frame=()=>{update();raf=v.paused?0:requestAnimationFrame(frame)};\n const show=s=>{if(down===null)held=!v.paused;down=s;v.pause();fig.classList.add('broken');c.hidden=true;if(empty)empty.hidden=true;if(note){++shown;note.hidden=false;const a=note.querySelector('a');if(a){a.href=srcs.get(s);a.textContent=srcs.get(s)}const ft=note.querySelector('.fix-text'),fd=note.querySelector('.fix-done');if(ft){ft.hidden=true;ft.value=''}if(fd)fd.textContent=''}if(o.broken)o.broken()};\n const fine=()=>{if(down===null)return;down=null;fig.classList.remove('broken');c.hidden=false;if(note)note.hidden=true;if(empty)empty.hidden=true;if(o.fine)o.fine()};\n const none=()=>{if(down===null)held=!v.paused;++ask;auto=false;down='';v.pause();fig.classList.add('broken');c.hidden=true;if(note)note.hidden=true;if(empty)empty.hidden=false;paint();if(o.broken)o.broken()};\n const playing=()=>down===null?!v.paused:held;\n const next=s=>order.slice(order.indexOf(s)+1).find(n=>!dead.has(n));\n const load=(s,t,go,a)=>{\n const my=++ask;auto=!!a;if(dead.has(s))return show(s);\n if(s!==cur||!v.currentSrc||v.error){cur=s;v.dataset.session=s;v.src=srcs.get(s);v.load()}\n const done=()=>{if(my!==ask)return;auto=false;fine();v.playbackRate=rate;v.currentTime=t;update();if(go)v.play().catch(()=>{})};\n if(v.readyState>0)done();else v.addEventListener('loadedmetadata',done,{once:true});\n };\n const bad=()=>{const e=v.error;if(!e)return;dead.add(cur);errs.set(cur,'error code '+e.code+(e.message?': '+e.message:''));if(down==='')return;const n=auto?next(cur):undefined;if(n!==undefined)return load(n,0,true,true);auto=false;show(cur)};\n ['timeupdate','seeked','loadedmetadata','pause','play','durationchange'].forEach(n=>v.addEventListener(n,update));\n v.addEventListener('play',()=>{if(!raf)raf=requestAnimationFrame(frame)});\n addEventListener('resize',update);\n v.addEventListener('error',bad);if(v.error)queueMicrotask(bad);\n const fix=d.getElementById(p+'-fix');\n if(fix){const box=fix.parentElement,ta=box.querySelector('.fix-text'),said=box.querySelector('.fix-done');\n fix.addEventListener('click',()=>{\n let t=ta.dataset.template||'';\n [['video',down?srcs.get(down)||'':''],['page',location.href],['browser',navigator.userAgent],['error',errs.get(down)||'nothing']].forEach(([k,x])=>{t=t.split('{'+k+'}').join(x)});\n const g=shown;ta.value=t;const ok=()=>{if(g!==shown)return;said.textContent='Copied. Paste it into your coding agent.'};\n const by=()=>{if(g!==shown)return;ta.hidden=false;ta.focus();ta.setSelectionRange(0,t.length);ta.scrollTop=0;let c=false;try{c=d.execCommand('copy')}catch(x){}if(c)ok();else said.textContent='Copy the prompt below.'};\n if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(t).then(ok,by);else by();\n })}\n v.addEventListener('ended',()=>{if(o.ended&&o.ended())return;const n=next(cur);if(n!==undefined)load(n,0,true,true)});\n play.addEventListener('click',()=>{if(v.paused)v.play().catch(()=>{});else v.pause()});\n v.addEventListener('click',()=>{if(down!==null)return;if(grow())v.play().catch(()=>{});else play.click()});\n c.querySelectorAll('[data-rate]').forEach(b=>b.addEventListener('click',()=>{rate=Number(b.dataset.rate);v.playbackRate=rate;v.defaultPlaybackRate=rate;c.querySelectorAll('[data-rate]').forEach(x=>x.setAttribute('aria-pressed',String(x===b)))}));\n const seek=t=>{const L=len();t=Math.max(0,L?Math.min(L,t):t);v.currentTime=t;if(o.seek)o.seek(t);update()};\n const at=e=>{const b=bar.getBoundingClientRect();return Math.max(0,Math.min(1,(e.clientX-b.left)/b.width))*len()};\n bar.addEventListener('pointerdown',e=>{if(e.button>0||down!==null)return;drag=true;bar.setPointerCapture(e.pointerId);seek(at(e))});\n bar.addEventListener('pointermove',e=>{if(drag)seek(at(e))});\n ['pointerup','pointercancel'].forEach(n=>bar.addEventListener(n,()=>{drag=false}));\n bar.addEventListener('keydown',e=>{\n const k=e.key,t=v.currentTime,by={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-10,PageUp:10}[k];\n const to=by!==undefined?t+by:k==='Home'?0:k==='End'?len():null;if(to===null)return;e.preventDefault();seek(to);\n });\n const full=c.querySelector('.full'),screen=o.full||fig.querySelector('.screen');\n const api=!!(d.fullscreenEnabled&&screen.requestFullscreen),inPage=()=>!!o.inPage&&(o.inPage()||!api);\n const mark=()=>{const f=d.fullscreenElement===screen||screen.classList.contains('focus');full.classList.toggle('out',f);full.setAttribute('aria-label',f?'Exit fullscreen':'Fullscreen');update()};\n let back=0;const focus=on=>{if(on)back=scrollY;screen.classList.toggle('focus',on);scrollTo({top:on?0:back,behavior:'auto'});mark()};\n const grow=()=>{if(!o.expand||!o.inPage||!o.inPage()||d.fullscreenElement||screen.classList.contains('focus'))return false;focus(true);return true};\n if(!api&&!o.inPage)full.hidden=true;\n else{full.addEventListener('click',()=>{const f=screen.classList.contains('focus');if(d.fullscreenElement){d.exitFullscreen().catch(()=>{});if(f)focus(false)}else if(f)focus(false);else if(inPage())focus(true);else screen.requestFullscreen().catch(()=>{})});\n d.addEventListener('fullscreenchange',mark);\n d.addEventListener('keydown',e=>{if(e.key==='Escape'&&!e.defaultPrevented&&screen.classList.contains('focus')&&!d.querySelector('dialog[open]')){e.preventDefault();focus(false)}})}\n d.addEventListener('keydown',e=>{if(e.key!==' '||down!==null||e.defaultPrevented||d.querySelector('dialog[open]')||e.target.closest('button,a,input,textarea,select,summary,[role=slider]'))return;e.preventDefault();play.click()});\n return {v,load,none,playing,update,len,cur:()=>cur,down:()=>down,has:s=>srcs.has(s)};\n};\n\nconst badImg=i=>{const f=i.closest('figure');if(!f||f.classList.contains('broken'))return;f.classList.add('broken');f.querySelectorAll('.unloaded').forEach(u=>u.removeAttribute('aria-hidden'))};\nconst scan=()=>d.querySelectorAll('figure img').forEach(i=>{if(i.complete&&i.naturalWidth===0)badImg(i)});\nd.addEventListener('error',e=>{const t=e.target;if(t instanceof Element&&t.matches('figure img'))badImg(t)},true);\naddEventListener('load',scan);\nd.addEventListener('DOMContentLoaded',()=>{\n chrome();scan();\n const cards=[...d.querySelectorAll('.case[data-i]')],segs=[...d.querySelectorAll('.seg[data-case]')];\n const np=d.getElementById('rp-now'),loopB=d.getElementById('rp-loop'),dlg=d.getElementById('viewer');\n const N=cards.length,dash=String.fromCharCode(8211);let cur=null,loop=true,lock=0,lastT=0,P=null,sr=0;\n const timed=c=>!!c&&c.dataset.t0!==undefined;\n const span=c=>[Number(c.dataset.t0),Number(c.dataset.t1)];\n const shown=()=>cards.filter(c=>!c.hidden);\n const line=()=>{const b=topEdge();if(matchMedia('(max-width: 900px)').matches){const s=d.querySelector('.rp-left');return s?s.getBoundingClientRect().bottom+24:b+120}return Math.round(b+(innerHeight-b)*0.3)};\n const playable=c=>timed(c)&&!!P&&P.has(c.dataset.s);\n const chip=c=>{if(!playable(c)||P.down()!==null)return '';const s=span(c);return (loop?'Looping ':'Playing ')+clock(s[0])+dash+clock(s[1])};\n const paintNow=()=>{\n if(!np||!cur)return;\n np.querySelector('.np-st').replaceChildren(cur.querySelector('.case-head .st').cloneNode(true));\n np.querySelector('.np-n').textContent=cur.dataset.i+' / '+N;\n np.querySelector('.np-title').textContent=cur.querySelector('.case-go').textContent;\n np.querySelector('.np-status').textContent=cur.dataset.label+': ';\n const ch=np.querySelector('.np-chip'),t=chip(cur);ch.querySelector('span').textContent=t||'No video';ch.classList.toggle('none',!t);\n };\n const toCard=c=>{lock=Date.now()+700;const y=c.getBoundingClientRect().top+scrollY-line()+2;scrollTo({top:Math.max(0,y),behavior:still()?'auto':'smooth'})};\n const setCurrent=(c,seek,scroll)=>{\n if(!c)return;\n if(c!==cur){if(cur){cur.classList.remove('on');cur.removeAttribute('aria-current')}cur=c;c.classList.add('on');c.setAttribute('aria-current','true');segs.forEach(x=>x.classList.toggle('on',x.dataset.case===c.dataset.id));paintNow()}\n if(seek&&P){if(playable(c)){const a=span(c)[0];lastT=a;P.load(c.dataset.s,a,P.playing())}else P.none()}\n if(scroll)toCard(c);\n };\n const caseAt=(s,t)=>{let f=null;for(const c of shown()){if(timed(c)&&c.dataset.s===s){const x=span(c);if(t>=x[0]&&t<x[1])f=c}}return f};\n const onScroll=()=>{\n if(Date.now()<lock)return;const vis=shown();if(!vis.length)return;\n const L=line();let pick=vis[0];for(const c of vis){if(c.getBoundingClientRect().top<=L)pick=c}\n const last=vis[vis.length-1];if(innerHeight+scrollY>=r.scrollHeight-2&&last.getBoundingClientRect().bottom<=innerHeight)pick=last;\n if(pick!==cur)setCurrent(pick,true,false);\n };\n const stk=d.querySelector('.rp-sticky'),head=d.querySelector('.rp-head');\n const fit=()=>{if(stk)stk.style.setProperty('--rp-top',Math.round(stk.getBoundingClientRect().top)+'px')};\n fit();addEventListener('resize',fit);addEventListener('load',fit);\n if(head&&window.ResizeObserver)new ResizeObserver(fit).observe(head);\n addEventListener('scroll',()=>{if(!sr)sr=requestAnimationFrame(()=>{sr=0;fit();onScroll()})},{passive:true});\n if(d.getElementById('rp-video'))P=player('rp',{\n broken:paintNow,fine:paintNow,\n tick:t=>{\n if(!cur||P.down()!==null||P.v.seeking)return;const s=P.cur();\n if(loop){if(timed(cur)&&cur.dataset.s===s){const x=span(cur);if(!P.v.paused&&t>=x[1]-0.03&&lastT<x[1]){lastT=x[0];P.v.currentTime=x[0];return}}}\n else{const c=caseAt(s,t);if(c&&c!==cur)setCurrent(c,false,true)}\n lastT=t;\n },\n seek:t=>{lastT=t;const c=caseAt(P.cur(),t);if(c&&c!==cur)setCurrent(c,false,true)},\n ended:()=>{\n if(!cur)return false;\n if(loop&&timed(cur)&&cur.dataset.s===P.cur()){P.load(P.cur(),span(cur)[0],true);return true}\n if(!loop){const later=shown().find(c=>timed(c)&&Number(c.dataset.s)>Number(P.cur())&&P.has(c.dataset.s));if(later){setCurrent(later,false,true);P.load(later.dataset.s,span(later)[0],true);return true}}\n return false;\n },\n });\n if(loopB)loopB.addEventListener('click',()=>{loop=!loop;loopB.setAttribute('aria-pressed',String(loop));paintNow()});\n const filter=f=>{\n d.querySelectorAll('[data-filter]').forEach(x=>x.setAttribute('aria-pressed',String(x.dataset.filter===f)));\n cards.forEach(c=>{c.hidden=!(f==='all'||c.dataset.status===f)});\n segs.forEach(x=>{const c=cards.find(k=>k.dataset.id===x.dataset.case);x.classList.toggle('off',!!c&&c.hidden)});\n if(cur&&cur.hidden)setCurrent(shown()[0],true,false);\n };\n d.querySelectorAll('[data-filter]').forEach(b=>b.addEventListener('click',()=>filter(b.dataset.filter)));\n d.querySelectorAll('.filters').forEach(f=>f.classList.add('live'));\n let vCase=null,vIdx=0,opener=null;\n const q=s=>dlg.querySelector(s);\n const list=c=>{const t=c&&c.querySelector('template.shots');return t?[...t.content.children]:[]};\n const showShot=()=>{\n const l=list(vCase),f=l[vIdx];if(!f)return;\n q('.v-body').replaceChildren(f.cloneNode(true));\n q('.v-st').replaceChildren(vCase.querySelector('.case-head .st').cloneNode(true));\n q('.v-title').textContent=vCase.querySelector('.case-go').textContent;\n q('.v-what').textContent=f.dataset.cap+(l.length>1?' ('+(vIdx+1)+' of '+l.length+')':'');\n q('.v-prev').disabled=vIdx===0;q('.v-next').disabled=vIdx>=l.length-1;scan();\n };\n if(dlg){\n q('.v-prev').addEventListener('click',()=>{if(vIdx>0){vIdx--;showShot()}});\n q('.v-next').addEventListener('click',()=>{if(vIdx<list(vCase).length-1){vIdx++;showShot()}});\n q('.v-close').addEventListener('click',()=>dlg.close());\n dlg.addEventListener('click',e=>{if(e.target===dlg)dlg.close()});\n dlg.addEventListener('keydown',e=>{if(e.key==='ArrowLeft'){e.preventDefault();q('.v-prev').click()}else if(e.key==='ArrowRight'){e.preventDefault();q('.v-next').click()}});\n dlg.addEventListener('close',()=>{q('.v-body').replaceChildren();if(opener&&opener.isConnected)opener.focus()});\n }\n d.addEventListener('click',e=>{\n const t=e.target;if(!(t instanceof Element))return;\n const tc=t.closest('a.tc[data-t]');\n if(tc){if(!P||!P.has(tc.dataset.s))return;e.preventDefault();const s=tc.dataset.s,at=Number(tc.dataset.t),c=caseAt(s,at)||tc.closest('.case')||(dlg&&dlg.open?vCase:null);if(dlg&&dlg.open)dlg.close();if(c)setCurrent(c,false,!tc.closest('.case'));lastT=at;P.load(s,at,P.playing());return}\n const go=t.closest('a[href^=\"#case-\"]');\n if(go){const c=d.getElementById(go.getAttribute('href').slice(1));if(!c||!c.matches('.case[data-i]'))return;e.preventDefault();if(c.hidden)filter('all');toCard(c);setCurrent(c,true,false);return}\n const shot=t.closest('[data-shot]');\n if(shot&&dlg&&dlg.showModal){e.preventDefault();opener=shot;vCase=shot.closest('.case');vIdx=Number(shot.dataset.shot)||0;showShot();dlg.showModal();q('.v-close').focus();return}\n const c=t.closest('.case[data-i]');\n if(!c||t.closest('a,summary,details,input,label')||(t.closest('button')&&!t.closest('.case-go')))return;\n toCard(c);setCurrent(c,true,false);\n });\n const first=cards.find(c=>timed(c)&&(!P||P.has(c.dataset.s)))||cards[0];\n if(first){setCurrent(first,false,false);if(timed(first))lastT=span(first)[0]}\n});\n})();";
24
+ export declare const REPORT_SCRIPT = "(()=>{const d=document,r=d.documentElement,K='screw-bugs-theme';\nconst still=()=>matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst topEdge=()=>{const b=d.querySelector('.menubar');return b?Math.max(0,b.getBoundingClientRect().bottom):0};\nconst pad=n=>String(n).padStart(2,'0');\nconst clock=s=>{s=Math.max(0,Math.floor(s||0));const h=Math.floor(s/3600),m=Math.floor(s%3600/60);return(h?h+':'+pad(m):String(m))+':'+pad(s%60)};\nlet theme='system';try{theme=localStorage.getItem(K)||theme}catch(e){}r.dataset.theme=theme;\nconst themeCycle=(b,key)=>{\n const r=document.documentElement,T=['light','dark','system'],N={light:'Light theme',dark:'Dark theme',system:'Theme from system'};\n const at=()=>{const i=T.indexOf(r.dataset.theme);return i<0?2:i};\n const show=()=>{const i=at(),f=document.getElementById('favicon'),h=f&&f.dataset[T[i]];if(h)f.href=h;b.setAttribute('aria-label',N[T[i]]+'. Switch to '+N[T[(i+1)%3]].toLowerCase());b.title=N[T[i]]};\n show();\n b.addEventListener('click',()=>{const m=T[(at()+1)%3];r.dataset.theme=m;if(key)try{localStorage.setItem(key,m)}catch(e){}show()});\n};\nconst chrome=()=>{\n d.querySelectorAll('.menubar .theme').forEach(b=>{themeCycle(b,K);b.hidden=false});\n if(location.protocol==='http:')d.querySelectorAll('a.share-btn').forEach(a=>{a.hidden=false});\n d.querySelectorAll('time.when[datetime]').forEach(e=>{\n const t=new Date(e.getAttribute('datetime'));if(isNaN(t.getTime()))return;const p={};\n try{new Intl.DateTimeFormat('en-US',{month:'short',day:'numeric',year:'numeric',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(t).forEach(x=>{p[x.type]=x.value});\n const y=d.createElement('span');y.className='year';y.textContent=', '+p.year;\n e.replaceChildren(p.month+' '+p.day,y,' '+String.fromCharCode(183)+' '+p.hour+':'+p.minute);\n e.title=new Intl.DateTimeFormat('en-US',{dateStyle:'full',timeStyle:'long'}).format(t)}catch(x){}\n });\n d.querySelectorAll('.prompt').forEach(p=>{\n const t=p.querySelector('.prompt-text'),b=p.querySelector('.prompt-more');if(!t||!b)return;\n const fits=()=>{if(!p.classList.contains('open'))b.hidden=t.scrollHeight<=t.clientHeight+1};\n fits();if(window.ResizeObserver)new ResizeObserver(fits).observe(t);if(d.fonts&&d.fonts.ready)d.fonts.ready.then(fits);\n b.addEventListener('click',()=>{const o=p.classList.toggle('open');b.textContent=o?'Show less':'Show full prompt';b.setAttribute('aria-expanded',String(o));fits()});\n });\n};\nconst bare=u=>{const i=u.indexOf('://');return i<0?u:u.slice(i+3)};\nconst player=(p,o)=>{\n const v=d.getElementById(p+'-video'),fig=v.closest('.player'),note=d.getElementById(p+'-unloaded'),c=d.getElementById(p+'-controls'),url=d.getElementById(p+'-url');\n const srcs=new Map([...fig.querySelectorAll('[data-session-src]')].map(e=>[e.dataset.session,e.dataset.sessionSrc]));\n const order=[...srcs.keys()];\n const urls=[...fig.querySelectorAll('[data-url]')].map(e=>({s:e.dataset.s,t:Number(e.dataset.at),u:e.dataset.url}));\n const dead=new Set(),errs=new Map(),empty=d.getElementById(p+'-none');let shown=0,cur=v.dataset.session,down=null,held=false,ask=0,auto=false,rate=1,raf=0,drag=false;\n const play=c.querySelector('.play'),now=c.querySelector('.now'),total=c.querySelector('.total'),bar=c.querySelector('.scrub'),head=c.querySelector('.head'),tracks=[...c.querySelectorAll('.track')];\n v.removeAttribute('controls');c.hidden=false;\n const big=d.getElementById(p+'-start');\n if(big){big.hidden=false;big.addEventListener('click',()=>{grow();v.play().catch(()=>{})});v.addEventListener('play',()=>big.remove(),{once:true})}\n const track=()=>tracks.find(t=>t.dataset.s===cur);\n const len=()=>{const t=track(),n=t?Number(t.dataset.total):0;return n>0?n:(isFinite(v.duration)?v.duration:0)};\n const paint=()=>{\n const L=len(),t=v.currentTime,f=L?Math.min(1,t/L):0,k=track();\n tracks.forEach(x=>{x.hidden=x!==k});head.style.left=(f*100)+'%';\n const done=k&&k.querySelector('.done');if(done)done.style.width=(f*100)+'%';\n now.textContent=clock(t);total.textContent=clock(L);\n bar.setAttribute('aria-valuemax',String(Math.round(L)));bar.setAttribute('aria-valuenow',String(Math.round(t)));bar.setAttribute('aria-valuetext',clock(t)+' of '+clock(L));\n play.classList.toggle('playing',!v.paused);play.setAttribute('aria-label',v.paused?'Play':'Pause');\n if(url){let u='';if(down!=='')for(const x of urls){if(x.s===cur&&x.t<=t+0.02)u=x.u}url.textContent=bare(u);url.parentElement.title=u}\n };\n const update=()=>{paint();if(o.tick)o.tick(v.currentTime)};\n const frame=()=>{update();raf=v.paused?0:requestAnimationFrame(frame)};\n const show=s=>{if(down===null)held=!v.paused;down=s;v.pause();fig.classList.add('broken');c.hidden=true;if(empty)empty.hidden=true;if(note){++shown;note.hidden=false;const a=note.querySelector('a');if(a){a.href=srcs.get(s);a.textContent=srcs.get(s)}const ft=note.querySelector('.fix-text'),fd=note.querySelector('.fix-done');if(ft){ft.hidden=true;ft.value=''}if(fd)fd.textContent=''}if(o.broken)o.broken()};\n const fine=()=>{if(down===null)return;down=null;fig.classList.remove('broken');c.hidden=false;if(note)note.hidden=true;if(empty)empty.hidden=true;if(o.fine)o.fine()};\n const none=()=>{if(down===null)held=!v.paused;++ask;auto=false;down='';v.pause();fig.classList.add('broken');c.hidden=true;if(note)note.hidden=true;if(empty)empty.hidden=false;paint();if(o.broken)o.broken()};\n const playing=()=>down===null?!v.paused:held;\n const next=s=>order.slice(order.indexOf(s)+1).find(n=>!dead.has(n));\n const load=(s,t,go,a)=>{\n const my=++ask;auto=!!a;if(dead.has(s))return show(s);\n if(s!==cur||!v.currentSrc||v.error){cur=s;v.dataset.session=s;v.src=srcs.get(s);v.load()}\n const done=()=>{if(my!==ask)return;auto=false;fine();v.playbackRate=rate;v.currentTime=t;update();if(go)v.play().catch(()=>{})};\n if(v.readyState>0)done();else v.addEventListener('loadedmetadata',done,{once:true});\n };\n const bad=()=>{const e=v.error;if(!e)return;dead.add(cur);errs.set(cur,'error code '+e.code+(e.message?': '+e.message:''));if(down==='')return;const n=auto?next(cur):undefined;if(n!==undefined)return load(n,0,true,true);auto=false;show(cur)};\n ['timeupdate','seeked','loadedmetadata','pause','play','durationchange'].forEach(n=>v.addEventListener(n,update));\n v.addEventListener('play',()=>{if(!raf)raf=requestAnimationFrame(frame)});\n addEventListener('resize',update);\n v.addEventListener('error',bad);if(v.error)queueMicrotask(bad);\n const fix=d.getElementById(p+'-fix');\n if(fix){const box=fix.parentElement,ta=box.querySelector('.fix-text'),said=box.querySelector('.fix-done');\n fix.addEventListener('click',()=>{\n let t=ta.dataset.template||'';\n [['video',down?srcs.get(down)||'':''],['page',location.href],['browser',navigator.userAgent],['error',errs.get(down)||'nothing']].forEach(([k,x])=>{t=t.split('{'+k+'}').join(x)});\n const g=shown;ta.value=t;const ok=()=>{if(g!==shown)return;said.textContent='Copied. Paste it into your coding agent.'};\n const by=()=>{if(g!==shown)return;ta.hidden=false;ta.focus();ta.setSelectionRange(0,t.length);ta.scrollTop=0;let c=false;try{c=d.execCommand('copy')}catch(x){}if(c)ok();else said.textContent='Copy the prompt below.'};\n if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(t).then(ok,by);else by();\n })}\n v.addEventListener('ended',()=>{if(o.ended&&o.ended())return;const n=next(cur);if(n!==undefined)load(n,0,true,true)});\n play.addEventListener('click',()=>{if(v.paused)v.play().catch(()=>{});else v.pause()});\n v.addEventListener('click',()=>{if(down!==null)return;if(grow())v.play().catch(()=>{});else play.click()});\n c.querySelectorAll('[data-rate]').forEach(b=>b.addEventListener('click',()=>{rate=Number(b.dataset.rate);v.playbackRate=rate;v.defaultPlaybackRate=rate;c.querySelectorAll('[data-rate]').forEach(x=>x.setAttribute('aria-pressed',String(x===b)))}));\n const seek=t=>{const L=len();t=Math.max(0,L?Math.min(L,t):t);v.currentTime=t;if(o.seek)o.seek(t);update()};\n const at=e=>{const b=bar.getBoundingClientRect();return Math.max(0,Math.min(1,(e.clientX-b.left)/b.width))*len()};\n bar.addEventListener('pointerdown',e=>{if(e.button>0||down!==null)return;drag=true;bar.setPointerCapture(e.pointerId);seek(at(e))});\n bar.addEventListener('pointermove',e=>{if(drag)seek(at(e))});\n ['pointerup','pointercancel'].forEach(n=>bar.addEventListener(n,()=>{drag=false}));\n bar.addEventListener('keydown',e=>{\n const k=e.key,t=v.currentTime,by={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-10,PageUp:10}[k];\n const to=by!==undefined?t+by:k==='Home'?0:k==='End'?len():null;if(to===null)return;e.preventDefault();seek(to);\n });\n const full=c.querySelector('.full'),screen=o.full||fig.querySelector('.screen');\n const api=!!(d.fullscreenEnabled&&screen.requestFullscreen),inPage=()=>!!o.inPage&&(o.inPage()||!api);\n const mark=()=>{const f=d.fullscreenElement===screen||screen.classList.contains('focus');full.classList.toggle('out',f);full.setAttribute('aria-label',f?'Exit fullscreen':'Fullscreen');update()};\n let back=0;const focus=on=>{if(on)back=scrollY;screen.classList.toggle('focus',on);scrollTo({top:on?0:back,behavior:'auto'});mark()};\n const grow=()=>{if(!o.expand||!o.inPage||!o.inPage()||d.fullscreenElement||screen.classList.contains('focus'))return false;focus(true);return true};\n if(!api&&!o.inPage)full.hidden=true;\n else{full.addEventListener('click',()=>{const f=screen.classList.contains('focus');if(d.fullscreenElement){d.exitFullscreen().catch(()=>{});if(f)focus(false)}else if(f)focus(false);else if(inPage())focus(true);else screen.requestFullscreen().catch(()=>{})});\n d.addEventListener('fullscreenchange',mark);\n d.addEventListener('keydown',e=>{if(e.key==='Escape'&&!e.defaultPrevented&&screen.classList.contains('focus')&&!d.querySelector('dialog[open]')){e.preventDefault();focus(false)}})}\n d.addEventListener('keydown',e=>{if(e.key!==' '||down!==null||e.defaultPrevented||d.querySelector('dialog[open]')||e.target.closest('button,a,input,textarea,select,summary,[role=slider]'))return;e.preventDefault();play.click()});\n return {v,load,none,playing,update,len,cur:()=>cur,down:()=>down,has:s=>srcs.has(s)};\n};\n\nconst badImg=i=>{const f=i.closest('figure');if(!f||f.classList.contains('broken'))return;f.classList.add('broken');f.querySelectorAll('.unloaded').forEach(u=>u.removeAttribute('aria-hidden'))};\nconst scan=()=>d.querySelectorAll('figure img').forEach(i=>{if(i.complete&&i.naturalWidth===0)badImg(i)});\nd.addEventListener('error',e=>{const t=e.target;if(t instanceof Element&&t.matches('figure img'))badImg(t)},true);\naddEventListener('load',scan);\nd.addEventListener('DOMContentLoaded',()=>{\n chrome();scan();\n const cards=[...d.querySelectorAll('.case[data-i]')],segs=[...d.querySelectorAll('.seg[data-case]')];\n const np=d.getElementById('rp-now'),loopB=d.getElementById('rp-loop'),skipB=d.getElementById('rp-skip'),dlg=d.getElementById('viewer');\n const idle=[...d.querySelectorAll('.idle[data-a]')].map(e=>({s:e.closest('.track').dataset.s,a:Number(e.dataset.a),b:Number(e.dataset.b)}));\n let skip=!!skipB;const sk='screw-bugs-skip';try{skip=skip&&localStorage.getItem(sk)!=='off'}catch(e){}if(skipB)skipB.setAttribute('aria-pressed',String(skip));\n const N=cards.length,dash=String.fromCharCode(8211);let cur=null,loop=true,lock=0,lastT=0,P=null,sr=0;\n const timed=c=>!!c&&c.dataset.t0!==undefined;\n const span=c=>[Number(c.dataset.t0),Number(c.dataset.t1)];\n const shown=()=>cards.filter(c=>!c.hidden);\n const line=()=>{const b=topEdge();if(matchMedia('(max-width: 900px)').matches){const s=d.querySelector('.rp-left');return s?s.getBoundingClientRect().bottom+24:b+120}return Math.round(b+(innerHeight-b)*0.3)};\n const playable=c=>timed(c)&&!!P&&P.has(c.dataset.s);\n const chip=c=>{if(!playable(c)||P.down()!==null)return '';const s=span(c);return (loop?'Looping ':'Playing ')+clock(s[0])+dash+clock(s[1])};\n const paintNow=()=>{\n if(!np||!cur)return;\n np.querySelector('.np-st').replaceChildren(cur.querySelector('.case-head .st').cloneNode(true));\n np.querySelector('.np-n').textContent=cur.dataset.i+' / '+N;\n np.querySelector('.np-title').textContent=cur.querySelector('.case-go').textContent;\n np.querySelector('.np-status').textContent=cur.dataset.label+': ';\n const ch=np.querySelector('.np-chip'),t=chip(cur);ch.querySelector('span').textContent=t||'No video';ch.classList.toggle('none',!t);\n };\n const toCard=c=>{lock=Date.now()+700;const y=c.getBoundingClientRect().top+scrollY-line()+2;scrollTo({top:Math.max(0,y),behavior:still()?'auto':'smooth'})};\n const setCurrent=(c,seek,scroll)=>{\n if(!c)return;\n if(c!==cur){if(cur){cur.classList.remove('on');cur.removeAttribute('aria-current')}cur=c;c.classList.add('on');c.setAttribute('aria-current','true');segs.forEach(x=>x.classList.toggle('on',x.dataset.case===c.dataset.id));paintNow()}\n if(seek&&P){if(playable(c)){const a=span(c)[0];lastT=a;P.load(c.dataset.s,a,P.playing())}else P.none()}\n if(scroll)toCard(c);\n };\n const caseAt=(s,t)=>{let f=null;for(const c of shown()){if(timed(c)&&c.dataset.s===s){const x=span(c);if(t>=x[0]&&t<x[1])f=c}}return f};\n const onScroll=()=>{\n if(Date.now()<lock)return;const vis=shown();if(!vis.length)return;\n const L=line();let pick=vis[0];for(const c of vis){if(c.getBoundingClientRect().top<=L)pick=c}\n const last=vis[vis.length-1];if(innerHeight+scrollY>=r.scrollHeight-2&&last.getBoundingClientRect().bottom<=innerHeight)pick=last;\n if(pick!==cur)setCurrent(pick,true,false);\n };\n const stk=d.querySelector('.rp-sticky'),head=d.querySelector('.rp-head');\n const fit=()=>{if(stk)stk.style.setProperty('--rp-top',Math.round(stk.getBoundingClientRect().top)+'px')};\n fit();addEventListener('resize',fit);addEventListener('load',fit);\n if(head&&window.ResizeObserver)new ResizeObserver(fit).observe(head);\n addEventListener('scroll',()=>{if(!sr)sr=requestAnimationFrame(()=>{sr=0;fit();onScroll()})},{passive:true});\n if(d.getElementById('rp-video'))P=player('rp',{\n broken:paintNow,fine:paintNow,\n tick:t=>{\n if(!cur||P.down()!==null||P.v.seeking)return;const s=P.cur();\n const lp=loop&&timed(cur)&&cur.dataset.s===s,x=lp?span(cur):null;\n if(lp&&!P.v.paused&&t>=x[1]-0.03&&lastT<x[1]){lastT=x[0];P.v.currentTime=x[0];return}\n if(skip&&!P.v.paused){const gap=idle.find(g=>g.s===s&&t>=g.a&&t<g.b-0.05);if(gap){let to=gap.b;if(lp&&lastT<x[1]&&to>=x[1]-0.03)to=x[0];lastT=to;P.v.currentTime=to;return}}\n if(!loop){const c=caseAt(s,t);if(c&&c!==cur)setCurrent(c,false,true)}\n lastT=t;\n },\n seek:t=>{lastT=t;const c=caseAt(P.cur(),t);if(c&&c!==cur)setCurrent(c,false,true)},\n ended:()=>{\n if(!cur)return false;\n if(loop&&timed(cur)&&cur.dataset.s===P.cur()){P.load(P.cur(),span(cur)[0],true);return true}\n if(!loop){const later=shown().find(c=>timed(c)&&Number(c.dataset.s)>Number(P.cur())&&P.has(c.dataset.s));if(later){setCurrent(later,false,true);P.load(later.dataset.s,span(later)[0],true);return true}}\n return false;\n },\n });\n if(loopB)loopB.addEventListener('click',()=>{loop=!loop;loopB.setAttribute('aria-pressed',String(loop));paintNow()});\n if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip));try{localStorage.setItem(sk,skip?'on':'off')}catch(e){}});\n const filter=f=>{\n d.querySelectorAll('[data-filter]').forEach(x=>x.setAttribute('aria-pressed',String(x.dataset.filter===f)));\n cards.forEach(c=>{c.hidden=!(f==='all'||c.dataset.status===f)});\n segs.forEach(x=>{const c=cards.find(k=>k.dataset.id===x.dataset.case);x.classList.toggle('off',!!c&&c.hidden)});\n if(cur&&cur.hidden)setCurrent(shown()[0],true,false);\n };\n d.querySelectorAll('[data-filter]').forEach(b=>b.addEventListener('click',()=>filter(b.dataset.filter)));\n d.querySelectorAll('.filters').forEach(f=>f.classList.add('live'));\n let vCase=null,vIdx=0,opener=null;\n const q=s=>dlg.querySelector(s);\n const list=c=>{const t=c&&c.querySelector('template.shots');return t?[...t.content.children]:[]};\n const showShot=()=>{\n const l=list(vCase),f=l[vIdx];if(!f)return;\n q('.v-body').replaceChildren(f.cloneNode(true));\n q('.v-st').replaceChildren(vCase.querySelector('.case-head .st').cloneNode(true));\n q('.v-title').textContent=vCase.querySelector('.case-go').textContent;\n q('.v-what').textContent=f.dataset.cap+(l.length>1?' ('+(vIdx+1)+' of '+l.length+')':'');\n q('.v-prev').disabled=vIdx===0;q('.v-next').disabled=vIdx>=l.length-1;scan();\n };\n if(dlg){\n q('.v-prev').addEventListener('click',()=>{if(vIdx>0){vIdx--;showShot()}});\n q('.v-next').addEventListener('click',()=>{if(vIdx<list(vCase).length-1){vIdx++;showShot()}});\n q('.v-close').addEventListener('click',()=>dlg.close());\n dlg.addEventListener('click',e=>{if(e.target===dlg)dlg.close()});\n dlg.addEventListener('keydown',e=>{if(e.key==='ArrowLeft'){e.preventDefault();q('.v-prev').click()}else if(e.key==='ArrowRight'){e.preventDefault();q('.v-next').click()}});\n dlg.addEventListener('close',()=>{q('.v-body').replaceChildren();if(opener&&opener.isConnected)opener.focus()});\n }\n d.addEventListener('click',e=>{\n const t=e.target;if(!(t instanceof Element))return;\n const tc=t.closest('a.tc[data-t]');\n if(tc){if(!P||!P.has(tc.dataset.s))return;e.preventDefault();const s=tc.dataset.s,at=Number(tc.dataset.t),c=caseAt(s,at)||tc.closest('.case')||(dlg&&dlg.open?vCase:null);if(dlg&&dlg.open)dlg.close();if(c)setCurrent(c,false,!tc.closest('.case'));lastT=at;P.load(s,at,P.playing());return}\n const go=t.closest('a[href^=\"#case-\"]');\n if(go){const c=d.getElementById(go.getAttribute('href').slice(1));if(!c||!c.matches('.case[data-i]'))return;e.preventDefault();if(c.hidden)filter('all');toCard(c);setCurrent(c,true,false);return}\n const shot=t.closest('[data-shot]');\n if(shot&&dlg&&dlg.showModal){e.preventDefault();opener=shot;vCase=shot.closest('.case');vIdx=Number(shot.dataset.shot)||0;showShot();dlg.showModal();q('.v-close').focus();return}\n const c=t.closest('.case[data-i]');\n if(!c||t.closest('a,summary,details,input,label')||(t.closest('button')&&!t.closest('.case-go')))return;\n toCard(c);setCurrent(c,true,false);\n });\n const first=cards.find(c=>timed(c)&&(!P||P.has(c.dataset.s)))||cards[0];\n if(first){setCurrent(first,false,false);if(timed(first))lastT=span(first)[0]}\n});\n})();";
23
25
  /**
24
26
  * Images and video load from the run folder by relative path (`'self'`, and `file:` for a report
25
27
  * opened from disk); styles are inline, but for Google Fonts' stylesheet, whose fonts come from
@@ -5,11 +5,12 @@ import { assetsOf, contentPolicy } from './assets.js';
5
5
  import { favicon, generatorMeta, html, icon, Markup, promptBlock, safeRelative, statusIcon, textParts, webFonts, } from './markup.js';
6
6
  import { controlsBlock, PLAYER_JS, playableSessions, playerWindow, shapeStyle, share, toggleButton, videoFixPrompt, } from './player.js';
7
7
  import { CHROME_LOGO } from './logos.js';
8
+ import { renderLivePage } from './live.js';
8
9
  import { topBar } from './menu-bar.js';
9
10
  import { cspHash } from './sha256.js';
10
11
  import { cardShot, viewerShot } from './shots.js';
11
12
  import { styles } from './styles.js';
12
- import { cardShots, caseShots, caseSpans, caseViews, checksNote, countsOf, countWords, browserWords, deviceWords, durationOf, evaluationOf, formatBytes, formatClock, formatTime, formatTimecode, fragmentSeconds, reportHeading, runMs, severityLabel, statusLabel, statuses, stepParts, uploadNotes, urlAt, urlTimeline, verdictOf, waitNote, } from './view.js';
13
+ import { cardShots, caseShots, caseSpans, caseViews, checksNote, countsOf, countWords, browserWords, deviceWords, durationOf, evaluationOf, formatBytes, formatClock, formatTime, formatTimecode, fragmentSeconds, idleStretches, reportHeading, runMs, severityLabel, statusLabel, statuses, stepParts, uploadNotes, urlAt, urlTimeline, verdictOf, waitNote, } from './view.js';
13
14
  import { renderWalkthrough } from './walkthrough.js';
14
15
  /*
15
16
  * The report: one page, one player. At the top, the run in a line and what was asked; then the
@@ -28,7 +29,9 @@ import { renderWalkthrough } from './walkthrough.js';
28
29
  * (a case with no video to play stops the player, which says so in the video's place); a click
29
30
  * on a case, a scrubber segment or a case link makes that case current (scrolling it to the line,
30
31
  * with scroll detection held off for 700 ms meanwhile); with "Loop case" off the current case
31
- * follows the playhead. A timecode seeks the player there, playing on only when it was playing.
32
+ * follows the playhead. With "Skip inactive" on (as the walkthrough's, and remembered with it), it
33
+ * jumps over the stretches where nothing happened (`idleStretches`) while it plays; a stretch that
34
+ * runs past the end of the case being looped starts the case again instead. A timecode seeks the player there, playing on only when it was playing.
32
35
  * The status filters hide cards (a hidden current case hands over to the
33
36
  * first shown). Screenshots open in a modal viewer that steps through the case's shots (arrow
34
37
  * keys, Esc, focus back where it was). A screenshot that cannot load says so in its figure, as
@@ -44,7 +47,9 @@ addEventListener('load',scan);
44
47
  d.addEventListener('DOMContentLoaded',()=>{
45
48
  chrome();scan();
46
49
  const cards=[...d.querySelectorAll('.case[data-i]')],segs=[...d.querySelectorAll('.seg[data-case]')];
47
- const np=d.getElementById('rp-now'),loopB=d.getElementById('rp-loop'),dlg=d.getElementById('viewer');
50
+ const np=d.getElementById('rp-now'),loopB=d.getElementById('rp-loop'),skipB=d.getElementById('rp-skip'),dlg=d.getElementById('viewer');
51
+ const idle=[...d.querySelectorAll('.idle[data-a]')].map(e=>({s:e.closest('.track').dataset.s,a:Number(e.dataset.a),b:Number(e.dataset.b)}));
52
+ let skip=!!skipB;const sk='screw-bugs-skip';try{skip=skip&&localStorage.getItem(sk)!=='off'}catch(e){}if(skipB)skipB.setAttribute('aria-pressed',String(skip));
48
53
  const N=cards.length,dash=String.fromCharCode(8211);let cur=null,loop=true,lock=0,lastT=0,P=null,sr=0;
49
54
  const timed=c=>!!c&&c.dataset.t0!==undefined;
50
55
  const span=c=>[Number(c.dataset.t0),Number(c.dataset.t1)];
@@ -83,8 +88,10 @@ d.addEventListener('DOMContentLoaded',()=>{
83
88
  broken:paintNow,fine:paintNow,
84
89
  tick:t=>{
85
90
  if(!cur||P.down()!==null||P.v.seeking)return;const s=P.cur();
86
- if(loop){if(timed(cur)&&cur.dataset.s===s){const x=span(cur);if(!P.v.paused&&t>=x[1]-0.03&&lastT<x[1]){lastT=x[0];P.v.currentTime=x[0];return}}}
87
- else{const c=caseAt(s,t);if(c&&c!==cur)setCurrent(c,false,true)}
91
+ const lp=loop&&timed(cur)&&cur.dataset.s===s,x=lp?span(cur):null;
92
+ if(lp&&!P.v.paused&&t>=x[1]-0.03&&lastT<x[1]){lastT=x[0];P.v.currentTime=x[0];return}
93
+ if(skip&&!P.v.paused){const gap=idle.find(g=>g.s===s&&t>=g.a&&t<g.b-0.05);if(gap){let to=gap.b;if(lp&&lastT<x[1]&&to>=x[1]-0.03)to=x[0];lastT=to;P.v.currentTime=to;return}}
94
+ if(!loop){const c=caseAt(s,t);if(c&&c!==cur)setCurrent(c,false,true)}
88
95
  lastT=t;
89
96
  },
90
97
  seek:t=>{lastT=t;const c=caseAt(P.cur(),t);if(c&&c!==cur)setCurrent(c,false,true)},
@@ -96,6 +103,7 @@ d.addEventListener('DOMContentLoaded',()=>{
96
103
  },
97
104
  });
98
105
  if(loopB)loopB.addEventListener('click',()=>{loop=!loop;loopB.setAttribute('aria-pressed',String(loop));paintNow()});
106
+ if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip));try{localStorage.setItem(sk,skip?'on':'off')}catch(e){}});
99
107
  const filter=f=>{
100
108
  d.querySelectorAll('[data-filter]').forEach(x=>x.setAttribute('aria-pressed',String(x.dataset.filter===f)));
101
109
  cards.forEach(c=>{c.hidden=!(f==='all'||c.dataset.status===f)});
@@ -179,6 +187,8 @@ const reportStyles = /* css */ `
179
187
  height but the player, which shrinks to what is left; its window then fits that space, at the
180
188
  recording's shape (\`--win-h\` and \`--win-w\` are what the window adds around the screen).
181
189
  \`--win-cap\` is the widest the window may be; \`--player-cap\` the tallest the player may be. */
190
+ /* Over the case segments, an inactive stretch dims the segment under it. */
191
+ .rp-sticky .idle { background: color-mix(in srgb, var(--bg) 55%, transparent); pointer-events: none; }
182
192
  .rp-sticky { --stuck: calc(var(--bar) + 20px); --fit-gap: 20px; --win-cap: 100cqw; position: sticky; top: var(--stuck); display: flex; flex-direction: column; max-height: calc(100dvh - max(var(--rp-top, 0px), var(--stuck)) - var(--fit-gap)); container-type: inline-size; }
183
193
  .rp-sticky > * { flex: none; }
184
194
  .rp-sticky > .player { flex: 0 1 auto; min-height: 0; height: calc((var(--win-cap) - var(--win-w)) / var(--arw, 1.6) + var(--win-h)); max-height: var(--player-cap, none); container-type: size; }
@@ -653,6 +663,7 @@ const playerBlock = (bundle, views, spans, playable, hosted) => {
653
663
  const firstSpan = firstCase ? spans.get(firstCase.entry.id) : undefined;
654
664
  const first = playable.find((p) => p.number === firstSpan?.session) ?? playable[0];
655
665
  const problems = (bundle.ledger.sessions ?? []).filter((s) => s.videoProblem || !s.video);
666
+ const idle = idleStretches(bundle);
656
667
  const notes = problems.length > 0
657
668
  ? html `<ul class="video-notes">
658
669
  ${problems.map((s) => html `<li>
@@ -687,20 +698,31 @@ const playerBlock = (bundle, views, spans, playable, hosted) => {
687
698
  sessions: playable,
688
699
  progress: false,
689
700
  label: 'Seek in the recording; each segment is a case',
690
- marks: (session, length) => views.flatMap((view) => {
701
+ marks: (session, length) => views
702
+ .flatMap((view) => {
691
703
  const span = spans.get(view.entry.id);
692
704
  if (span === undefined || span.session !== session)
693
705
  return [];
694
706
  return [
695
707
  html `<span
696
- class="seg s-${view.entry.status}"
697
- data-case="${view.entry.id}"
698
- title="${`${view.entry.title} (${statusLabel[view.entry.status]})`}"
699
- style="${`left:${share(span.startMs, length)};width:calc(${share(span.endMs - span.startMs, length)} - 2px)`}"
700
- ></span>`,
708
+ class="seg s-${view.entry.status}"
709
+ data-case="${view.entry.id}"
710
+ title="${`${view.entry.title} (${statusLabel[view.entry.status]})`}"
711
+ style="${`left:${share(span.startMs, length)};width:calc(${share(span.endMs - span.startMs, length)} - 2px)`}"
712
+ ></span>`,
701
713
  ];
702
- }),
703
- toggles: toggleButton('rp-loop', html `Loop<span class="wide"> case</span>`, true),
714
+ })
715
+ .concat(idle
716
+ .filter((g) => g.session === session)
717
+ .map((g) => html `<span
718
+ class="idle"
719
+ data-a="${fragmentSeconds(g.fromMs)}"
720
+ data-b="${fragmentSeconds(g.toMs)}"
721
+ style="${`left:${share(g.fromMs, length)};width:${share(g.toMs - g.fromMs, length)}`}"
722
+ ></span>`)),
723
+ toggles: html `${toggleButton('rp-loop', html `Loop<span class="wide"> case</span>`, true)}${idle.length > 0
724
+ ? toggleButton('rp-skip', html `Skip<span class="wide"> inactive</span>`, true)
725
+ : ''}`,
704
726
  })}
705
727
  <div class="nowplaying" id="rp-now" aria-live="polite">
706
728
  <span class="np-st">${firstEntry ? statusIcon(firstEntry.status) : ''}</span>
@@ -897,4 +919,5 @@ export const renderHtmlReport = (bundle, options) => {
897
919
  export const ReportRendererHtml = Layer.succeed(ReportRenderer, {
898
920
  html: (bundle) => renderHtmlReport(bundle),
899
921
  walkthrough: (bundle) => renderWalkthrough(bundle),
922
+ live: (page) => renderLivePage(page),
900
923
  });
@@ -10,12 +10,15 @@ export declare const ICONS: {
10
10
  readonly 'chevrons-up-down': '<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>';
11
11
  readonly 'circle-question-mark': '<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>';
12
12
  readonly maximize: '<path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/>';
13
+ readonly copy: '<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>';
14
+ readonly 'external-link': '<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>';
13
15
  readonly 'file-text': '<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/>';
14
16
  readonly keyboard: '<path d="M10 8h.01"/><path d="M12 12h.01"/><path d="M14 8h.01"/><path d="M16 12h.01"/><path d="M18 8h.01"/><path d="M6 8h.01"/><path d="M7 16h10"/><path d="M8 12h.01"/><rect width="20" height="16" x="2" y="4" rx="2"/>';
15
17
  readonly minimize: '<path d="M8 3v3a2 2 0 0 1-2 2H3"/><path d="M21 8h-3a2 2 0 0 1-2-2V3"/><path d="M3 16h3a2 2 0 0 1 2 2v3"/><path d="M16 21v-3a2 2 0 0 1 2-2h3"/>';
16
18
  readonly minus: '<path d="M5 12h14"/>';
17
19
  readonly mouse: '<rect x="5" y="2" width="14" height="20" rx="7"/><path d="M12 6v4"/>';
18
20
  readonly 'mouse-left': '<path d="M12 7.318V10"/><path d="M5 10v5a7 7 0 0 0 14 0V9c0-3.527-2.608-6.515-6-7"/><circle cx="7" cy="4" r="2"/>';
21
+ readonly 'mouse-pointer-2': '<path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"/>';
19
22
  readonly monitor: '<rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/>';
20
23
  readonly moon: '<path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"/>';
21
24
  readonly pause: '<rect x="14" y="3" width="5" height="18" rx="1"/><rect x="5" y="3" width="5" height="18" rx="1"/>';
@@ -19,7 +19,8 @@
19
19
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20
20
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21
21
  *
22
- * Of these, check, chevron-left, chevron-right, file-text, maximize, minus, monitor, moon, share,
22
+ * Of these, check, chevron-left, chevron-right, copy, external-link, file-text, maximize, minus,
23
+ * monitor, moon, share,
23
24
  * smartphone and x are derived from the Feather project, under its MIT License:
24
25
  *
25
26
  * The MIT License (MIT) (for the icons listed above)
@@ -56,12 +57,15 @@ export const ICONS = {
56
57
  'chevrons-up-down': '<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',
57
58
  'circle-question-mark': '<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',
58
59
  maximize: '<path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/>',
60
+ copy: '<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',
61
+ 'external-link': '<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',
59
62
  'file-text': '<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/>',
60
63
  keyboard: '<path d="M10 8h.01"/><path d="M12 12h.01"/><path d="M14 8h.01"/><path d="M16 12h.01"/><path d="M18 8h.01"/><path d="M6 8h.01"/><path d="M7 16h10"/><path d="M8 12h.01"/><rect width="20" height="16" x="2" y="4" rx="2"/>',
61
64
  minimize: '<path d="M8 3v3a2 2 0 0 1-2 2H3"/><path d="M21 8h-3a2 2 0 0 1-2-2V3"/><path d="M3 16h3a2 2 0 0 1 2 2v3"/><path d="M16 21v-3a2 2 0 0 1 2-2h3"/>',
62
65
  minus: '<path d="M5 12h14"/>',
63
66
  mouse: '<rect x="5" y="2" width="14" height="20" rx="7"/><path d="M12 6v4"/>',
64
67
  'mouse-left': '<path d="M12 7.318V10"/><path d="M5 10v5a7 7 0 0 0 14 0V9c0-3.527-2.608-6.515-6-7"/><circle cx="7" cy="4" r="2"/>',
68
+ 'mouse-pointer-2': '<path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"/>',
65
69
  monitor: '<rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/>',
66
70
  moon: '<path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"/>',
67
71
  pause: '<rect x="14" y="3" width="5" height="18" rx="1"/><rect x="5" y="3" width="5" height="18" rx="1"/>',
@@ -2,7 +2,9 @@ export * from './html.js';
2
2
  export * from './pr-summary.js';
3
3
  export { SHARE_START_PATH } from './menu-bar.js';
4
4
  export { stepText } from './view.js';
5
- export { hex, hmacSha256, sha256 } from './sha256.js';
5
+ export { base64, cspHash, hex, hmacSha256, sha256 } from './sha256.js';
6
6
  export { renderWalkthrough, WALKTHROUGH_CSP, WALKTHROUGH_SCRIPT, walkthroughCsp, } from './walkthrough.js';
7
7
  export { AssetBaseUrl, type RenderOptions } from './assets.js';
8
8
  export { renderSignInPage, SIGN_IN_CSP, SIGN_IN_SCRIPT } from './sign-in.js';
9
+ export { LIVE_CSP, LIVE_REFRESH_S, renderLivePage } from './live.js';
10
+ export { renderSharePage, SHARE_PAGE_SCRIPT, SHARE_POLL_MS, SHARE_WEBP_QUALITY, type SharePage, sharePageCsp, } from './share-page.js';
@@ -2,7 +2,9 @@ export * from './html.js';
2
2
  export * from './pr-summary.js';
3
3
  export { SHARE_START_PATH } from './menu-bar.js';
4
4
  export { stepText } from './view.js';
5
- export { hex, hmacSha256, sha256 } from './sha256.js';
5
+ export { base64, cspHash, hex, hmacSha256, sha256 } from './sha256.js';
6
6
  export { renderWalkthrough, WALKTHROUGH_CSP, WALKTHROUGH_SCRIPT, walkthroughCsp, } from './walkthrough.js';
7
7
  export { AssetBaseUrl } from './assets.js';
8
8
  export { renderSignInPage, SIGN_IN_CSP, SIGN_IN_SCRIPT } from './sign-in.js';
9
+ export { LIVE_CSP, LIVE_REFRESH_S, renderLivePage } from './live.js';
10
+ export { renderSharePage, SHARE_PAGE_SCRIPT, SHARE_POLL_MS, SHARE_WEBP_QUALITY, sharePageCsp, } from './share-page.js';
@@ -0,0 +1,7 @@
1
+ import type { LivePage } from '../core/index.js';
2
+ /** How often the page reloads itself while the run is going, in seconds. */
3
+ export declare const LIVE_REFRESH_S = 3;
4
+ /** No script, nothing from elsewhere: only its own styles and the favicon's data URL. */
5
+ export declare const LIVE_CSP = "default-src 'none'; img-src data:; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'";
6
+ /** The whole `live.html`. */
7
+ export declare const renderLivePage: (page: LivePage) => string;
@@ -0,0 +1,135 @@
1
+ import { progressText, runFiles, summaryOf } from '../schema/index.js';
2
+ import { favicon, html, Markup, safeRelative } from './markup.js';
3
+ import { dark, light } from './styles.js';
4
+ import { countsOf, formatTime, statusLabel } from './view.js';
5
+ /*
6
+ * `live.html`: the page a person watches a run on while it goes. Written by the run with every
7
+ * ledger write (see the engine), it reloads itself every `LIVE_REFRESH_S` seconds while the run is
8
+ * going; once the run ended it stops and links the report (and the walkthrough). No script.
9
+ */
10
+ /** How often the page reloads itself while the run is going, in seconds. */
11
+ export const LIVE_REFRESH_S = 3;
12
+ /** No script, nothing from elsewhere: only its own styles and the favicon's data URL. */
13
+ export const LIVE_CSP = "default-src 'none'; img-src data:; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'";
14
+ const liveStyles = /* css */ `
15
+ :root { ${light} }
16
+ @media (prefers-color-scheme: dark) { :root { ${dark} } }
17
+ * { box-sizing: border-box; }
18
+ body { margin: 0; background: var(--bg); color: var(--text);
19
+ font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
20
+ main { max-width: 760px; margin: 0 auto; padding: 32px 16px 48px; }
21
+ h1 { font-size: 20px; margin: 0 0 4px; }
22
+ .sub, .note { color: var(--muted); font-size: 13px; margin: 0; }
23
+ .now { margin: 20px 0 8px; padding: 12px 14px; border: 1px solid var(--accent-border);
24
+ background: var(--accent-subtle); border-radius: 8px; font-weight: 600; }
25
+ .now.ended { border-color: var(--border); background: var(--panel); }
26
+ .now a { color: var(--link); }
27
+ .counts { margin: 0 0 16px; color: var(--muted); }
28
+ ol { list-style: none; padding: 0; margin: 0 0 16px; border: 1px solid var(--border);
29
+ border-radius: 8px; overflow: hidden; }
30
+ li { display: flex; gap: 12px; align-items: baseline; padding: 10px 14px;
31
+ border-top: 1px solid var(--border); background: var(--panel); }
32
+ li:first-child { border-top: 0; }
33
+ li.current { background: var(--accent-subtle); }
34
+ .state { flex: none; width: 112px; font-size: 13px; font-weight: 600; }
35
+ .s-failed, .s-blocked { color: var(--fail-text); }
36
+ .s-pending, .s-not_verified { color: var(--muted); }
37
+ .title { min-width: 0; overflow-wrap: anywhere; }
38
+ .title code { font-size: 12px; color: var(--muted); }
39
+ .reason { display: block; font-size: 13px; color: var(--muted); }
40
+ `;
41
+ const isEnded = (page) => page.ledger.state === 'finished' || page.ledger.state === 'errored';
42
+ /** A case's state as the page shows it: its result, or running, or pending while the run goes. */
43
+ const stateOf = (page, entry, index) => {
44
+ if (isEnded(page) || entry.status !== 'not_verified' || entry.reason !== undefined)
45
+ return { key: entry.status, label: statusLabel[entry.status] };
46
+ const current = page.ledger.progress?.case;
47
+ if (current === index + 1) {
48
+ const { step, kind } = page.ledger.progress ?? {};
49
+ return {
50
+ key: 'running',
51
+ label: step === undefined ? 'Running' : `Running step ${step}${kind ? ` (${kind})` : ''}`,
52
+ };
53
+ }
54
+ return { key: 'pending', label: 'Pending' };
55
+ };
56
+ const countsLine = (cases) => {
57
+ const counts = countsOf(cases);
58
+ return (`${counts.passed} passed, ${counts.failed} failed, ${counts.blocked} blocked, ` +
59
+ `${counts.not_verified} not verified`);
60
+ };
61
+ /** What the run is doing now, or how it ended and where its report is. */
62
+ const nowLine = (page) => {
63
+ const { ledger } = page;
64
+ if (!isEnded(page)) {
65
+ const where = progressText(ledger);
66
+ return html `<p class="now" role="status">
67
+ ${where === undefined
68
+ ? ledger.state === 'queued'
69
+ ? 'Starting the browser…'
70
+ : 'The run is going.'
71
+ : `Running ${where}.`}
72
+ </p>`;
73
+ }
74
+ const report = safeRelative(page.report);
75
+ const walkthrough = safeRelative(page.walkthrough);
76
+ const how = ledger.state === 'finished' ? 'The run finished.' : `The run stopped: ${ledger.error ?? ''}`;
77
+ const links = [
78
+ ...(report ? [html `<a href="${report}">Open the report</a>`] : []),
79
+ ...(walkthrough ? [html `<a href="${walkthrough}">watch it step by step</a>`] : []),
80
+ ];
81
+ return html `<p class="now ended" role="status">
82
+ ${how}
83
+ ${links.length === 0
84
+ ? `Its report could not be written; \`screw-bugs report ${ledger.jobId}\` tries again.`
85
+ : html `${links.length === 2 ? html `${links[0]} or ${links[1]}` : links[0]}.`}
86
+ </p>`;
87
+ };
88
+ /** The whole `live.html`. */
89
+ export const renderLivePage = (page) => {
90
+ const { ledger, spec } = page;
91
+ const ended = isEnded(page);
92
+ const updated = ledger.heartbeatAt ?? ledger.startedAt;
93
+ const heading = summaryOf(spec).text;
94
+ return html `<!doctype html>
95
+ <html lang="en">
96
+ <head>
97
+ <meta charset="utf-8" />
98
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
99
+ <meta http-equiv="Content-Security-Policy" content="${LIVE_CSP}" />
100
+ ${ended ? '' : html `<meta http-equiv="refresh" content="${LIVE_REFRESH_S}" />`}
101
+ <title>${ended ? 'Run ended' : 'Running'} · screw-bugs</title>
102
+ ${favicon}
103
+ <style>
104
+ ${new Markup(liveStyles)}
105
+ </style>
106
+ </head>
107
+ <body>
108
+ <main>
109
+ <h1>${spec.title?.trim() ? spec.title : heading}</h1>
110
+ <p class="sub">Job ${ledger.jobId} · ${spec.url}</p>
111
+ ${nowLine(page)}
112
+ <p class="counts">${countsLine(ledger.cases)}</p>
113
+ <ol>
114
+ ${ledger.cases.map((entry, index) => {
115
+ const state = stateOf(page, entry, index);
116
+ return html `<li class="${state.key === 'running' ? 'current' : ''}">
117
+ <span class="${`state s-${state.key}`}">${state.label}</span>
118
+ <span class="title"
119
+ >${entry.title} <code>${entry.id}</code> ${entry.reason !== undefined
120
+ ? html `<span class="reason">${entry.reason}</span>`
121
+ : ''}</span
122
+ >
123
+ </li>`;
124
+ })}
125
+ </ol>
126
+ <p class="note">
127
+ ${updated !== undefined ? `Last updated ${formatTime(updated)}. ` : ''}${ended
128
+ ? `This page no longer changes; ${runFiles.html} has the results.`
129
+ : `This page reloads itself every ${LIVE_REFRESH_S} s while the run is going. ` +
130
+ 'If “last updated” stops moving, the run has stopped: its status then gives its report.'}
131
+ </p>
132
+ </main>
133
+ </body>
134
+ </html>`.value;
135
+ };
@@ -9,9 +9,9 @@ export declare const REPO: string;
9
9
  export declare const SHARE_START_PATH = "/.screw-bugs/share/start";
10
10
  /**
11
11
  * The Share button, in the place of Cloud's Sign in button: a link to the report server's start of
12
- * a share. Hidden until the page's script finds it was served by the local report server (`http:`
13
- * on 127.0.0.1 or localhost): opened from disk or on a host such as screw-bugs Cloud, there is no
14
- * server to share it.
12
+ * a share. Hidden until the page's script finds it was served over `http:`, as the local report
13
+ * server serves it (on 127.0.0.1, or a tailnet address with `SCREW_BUGS_REPORT_HOST`): opened from
14
+ * disk or on a host such as screw-bugs Cloud (`https:`), there is no server to share it.
15
15
  */
16
16
  export declare const shareButton: (jobId: string) => Markup;
17
17
  /**
@@ -17,9 +17,9 @@ export const REPO = REPO_URL.replace('https://github.com/', '');
17
17
  export const SHARE_START_PATH = '/.screw-bugs/share/start';
18
18
  /**
19
19
  * The Share button, in the place of Cloud's Sign in button: a link to the report server's start of
20
- * a share. Hidden until the page's script finds it was served by the local report server (`http:`
21
- * on 127.0.0.1 or localhost): opened from disk or on a host such as screw-bugs Cloud, there is no
22
- * server to share it.
20
+ * a share. Hidden until the page's script finds it was served over `http:`, as the local report
21
+ * server serves it (on 127.0.0.1, or a tailnet address with `SCREW_BUGS_REPORT_HOST`): opened from
22
+ * disk or on a host such as screw-bugs Cloud (`https:`), there is no server to share it.
23
23
  */
24
24
  export const shareButton = (jobId) => html `<a
25
25
  class="share-btn"
@@ -73,8 +73,8 @@ export declare const controlsBlock: (options: {
73
73
  export declare const share: (ms: number, of: number | undefined) => string;
74
74
  /**
75
75
  * The script both pages start with: the theme (set before anything is painted, kept where the
76
- * browser allows, and the menu bar's theme button, `THEME_BUTTON_JS`), the Share button (shown only on a page the local report server served: `http:`
77
- * on 127.0.0.1 or localhost), where the sticky menu bar ends (`topEdge`), when the run started in the reader's
76
+ * browser allows, and the menu bar's theme button, `THEME_BUTTON_JS`), the Share button (shown only on a page served over `http:`, as the local report server serves
77
+ * it), where the sticky menu bar ends (`topEdge`), when the run started in the reader's
78
78
  * own time zone (`Nov 4, 2026 · 23:50`, with the full date and zone as its title), the prompt's
79
79
  * "Show full prompt" (offered only when it does not fit, measured again whenever the prompt's box
80
80
  * changes size and once the page's fonts have loaded; while open it stays, as "Show less"), and `player(prefix, hooks)`, which takes over the video:
@@ -99,4 +99,4 @@ export declare const share: (ms: number, of: number | undefined) => string;
99
99
  * hooks use. The big play button over the video shows from the start until the video first plays
100
100
  * (by whatever control), and never after. Plain ES2020; no backslashes, so it reads the same in the TypeScript source.
101
101
  */
102
- export declare const PLAYER_JS = "const d=document,r=d.documentElement,K='screw-bugs-theme';\nconst still=()=>matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst topEdge=()=>{const b=d.querySelector('.menubar');return b?Math.max(0,b.getBoundingClientRect().bottom):0};\nconst pad=n=>String(n).padStart(2,'0');\nconst clock=s=>{s=Math.max(0,Math.floor(s||0));const h=Math.floor(s/3600),m=Math.floor(s%3600/60);return(h?h+':'+pad(m):String(m))+':'+pad(s%60)};\nlet theme='system';try{theme=localStorage.getItem(K)||theme}catch(e){}r.dataset.theme=theme;\nconst themeCycle=(b,key)=>{\n const r=document.documentElement,T=['light','dark','system'],N={light:'Light theme',dark:'Dark theme',system:'Theme from system'};\n const at=()=>{const i=T.indexOf(r.dataset.theme);return i<0?2:i};\n const show=()=>{const i=at(),f=document.getElementById('favicon'),h=f&&f.dataset[T[i]];if(h)f.href=h;b.setAttribute('aria-label',N[T[i]]+'. Switch to '+N[T[(i+1)%3]].toLowerCase());b.title=N[T[i]]};\n show();\n b.addEventListener('click',()=>{const m=T[(at()+1)%3];r.dataset.theme=m;if(key)try{localStorage.setItem(key,m)}catch(e){}show()});\n};\nconst chrome=()=>{\n d.querySelectorAll('.menubar .theme').forEach(b=>{themeCycle(b,K);b.hidden=false});\n if(location.protocol==='http:'&&(location.hostname==='127.0.0.1'||location.hostname==='localhost'))d.querySelectorAll('a.share-btn').forEach(a=>{a.hidden=false});\n d.querySelectorAll('time.when[datetime]').forEach(e=>{\n const t=new Date(e.getAttribute('datetime'));if(isNaN(t.getTime()))return;const p={};\n try{new Intl.DateTimeFormat('en-US',{month:'short',day:'numeric',year:'numeric',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(t).forEach(x=>{p[x.type]=x.value});\n const y=d.createElement('span');y.className='year';y.textContent=', '+p.year;\n e.replaceChildren(p.month+' '+p.day,y,' '+String.fromCharCode(183)+' '+p.hour+':'+p.minute);\n e.title=new Intl.DateTimeFormat('en-US',{dateStyle:'full',timeStyle:'long'}).format(t)}catch(x){}\n });\n d.querySelectorAll('.prompt').forEach(p=>{\n const t=p.querySelector('.prompt-text'),b=p.querySelector('.prompt-more');if(!t||!b)return;\n const fits=()=>{if(!p.classList.contains('open'))b.hidden=t.scrollHeight<=t.clientHeight+1};\n fits();if(window.ResizeObserver)new ResizeObserver(fits).observe(t);if(d.fonts&&d.fonts.ready)d.fonts.ready.then(fits);\n b.addEventListener('click',()=>{const o=p.classList.toggle('open');b.textContent=o?'Show less':'Show full prompt';b.setAttribute('aria-expanded',String(o));fits()});\n });\n};\nconst bare=u=>{const i=u.indexOf('://');return i<0?u:u.slice(i+3)};\nconst player=(p,o)=>{\n const v=d.getElementById(p+'-video'),fig=v.closest('.player'),note=d.getElementById(p+'-unloaded'),c=d.getElementById(p+'-controls'),url=d.getElementById(p+'-url');\n const srcs=new Map([...fig.querySelectorAll('[data-session-src]')].map(e=>[e.dataset.session,e.dataset.sessionSrc]));\n const order=[...srcs.keys()];\n const urls=[...fig.querySelectorAll('[data-url]')].map(e=>({s:e.dataset.s,t:Number(e.dataset.at),u:e.dataset.url}));\n const dead=new Set(),errs=new Map(),empty=d.getElementById(p+'-none');let shown=0,cur=v.dataset.session,down=null,held=false,ask=0,auto=false,rate=1,raf=0,drag=false;\n const play=c.querySelector('.play'),now=c.querySelector('.now'),total=c.querySelector('.total'),bar=c.querySelector('.scrub'),head=c.querySelector('.head'),tracks=[...c.querySelectorAll('.track')];\n v.removeAttribute('controls');c.hidden=false;\n const big=d.getElementById(p+'-start');\n if(big){big.hidden=false;big.addEventListener('click',()=>{grow();v.play().catch(()=>{})});v.addEventListener('play',()=>big.remove(),{once:true})}\n const track=()=>tracks.find(t=>t.dataset.s===cur);\n const len=()=>{const t=track(),n=t?Number(t.dataset.total):0;return n>0?n:(isFinite(v.duration)?v.duration:0)};\n const paint=()=>{\n const L=len(),t=v.currentTime,f=L?Math.min(1,t/L):0,k=track();\n tracks.forEach(x=>{x.hidden=x!==k});head.style.left=(f*100)+'%';\n const done=k&&k.querySelector('.done');if(done)done.style.width=(f*100)+'%';\n now.textContent=clock(t);total.textContent=clock(L);\n bar.setAttribute('aria-valuemax',String(Math.round(L)));bar.setAttribute('aria-valuenow',String(Math.round(t)));bar.setAttribute('aria-valuetext',clock(t)+' of '+clock(L));\n play.classList.toggle('playing',!v.paused);play.setAttribute('aria-label',v.paused?'Play':'Pause');\n if(url){let u='';if(down!=='')for(const x of urls){if(x.s===cur&&x.t<=t+0.02)u=x.u}url.textContent=bare(u);url.parentElement.title=u}\n };\n const update=()=>{paint();if(o.tick)o.tick(v.currentTime)};\n const frame=()=>{update();raf=v.paused?0:requestAnimationFrame(frame)};\n const show=s=>{if(down===null)held=!v.paused;down=s;v.pause();fig.classList.add('broken');c.hidden=true;if(empty)empty.hidden=true;if(note){++shown;note.hidden=false;const a=note.querySelector('a');if(a){a.href=srcs.get(s);a.textContent=srcs.get(s)}const ft=note.querySelector('.fix-text'),fd=note.querySelector('.fix-done');if(ft){ft.hidden=true;ft.value=''}if(fd)fd.textContent=''}if(o.broken)o.broken()};\n const fine=()=>{if(down===null)return;down=null;fig.classList.remove('broken');c.hidden=false;if(note)note.hidden=true;if(empty)empty.hidden=true;if(o.fine)o.fine()};\n const none=()=>{if(down===null)held=!v.paused;++ask;auto=false;down='';v.pause();fig.classList.add('broken');c.hidden=true;if(note)note.hidden=true;if(empty)empty.hidden=false;paint();if(o.broken)o.broken()};\n const playing=()=>down===null?!v.paused:held;\n const next=s=>order.slice(order.indexOf(s)+1).find(n=>!dead.has(n));\n const load=(s,t,go,a)=>{\n const my=++ask;auto=!!a;if(dead.has(s))return show(s);\n if(s!==cur||!v.currentSrc||v.error){cur=s;v.dataset.session=s;v.src=srcs.get(s);v.load()}\n const done=()=>{if(my!==ask)return;auto=false;fine();v.playbackRate=rate;v.currentTime=t;update();if(go)v.play().catch(()=>{})};\n if(v.readyState>0)done();else v.addEventListener('loadedmetadata',done,{once:true});\n };\n const bad=()=>{const e=v.error;if(!e)return;dead.add(cur);errs.set(cur,'error code '+e.code+(e.message?': '+e.message:''));if(down==='')return;const n=auto?next(cur):undefined;if(n!==undefined)return load(n,0,true,true);auto=false;show(cur)};\n ['timeupdate','seeked','loadedmetadata','pause','play','durationchange'].forEach(n=>v.addEventListener(n,update));\n v.addEventListener('play',()=>{if(!raf)raf=requestAnimationFrame(frame)});\n addEventListener('resize',update);\n v.addEventListener('error',bad);if(v.error)queueMicrotask(bad);\n const fix=d.getElementById(p+'-fix');\n if(fix){const box=fix.parentElement,ta=box.querySelector('.fix-text'),said=box.querySelector('.fix-done');\n fix.addEventListener('click',()=>{\n let t=ta.dataset.template||'';\n [['video',down?srcs.get(down)||'':''],['page',location.href],['browser',navigator.userAgent],['error',errs.get(down)||'nothing']].forEach(([k,x])=>{t=t.split('{'+k+'}').join(x)});\n const g=shown;ta.value=t;const ok=()=>{if(g!==shown)return;said.textContent='Copied. Paste it into your coding agent.'};\n const by=()=>{if(g!==shown)return;ta.hidden=false;ta.focus();ta.setSelectionRange(0,t.length);ta.scrollTop=0;let c=false;try{c=d.execCommand('copy')}catch(x){}if(c)ok();else said.textContent='Copy the prompt below.'};\n if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(t).then(ok,by);else by();\n })}\n v.addEventListener('ended',()=>{if(o.ended&&o.ended())return;const n=next(cur);if(n!==undefined)load(n,0,true,true)});\n play.addEventListener('click',()=>{if(v.paused)v.play().catch(()=>{});else v.pause()});\n v.addEventListener('click',()=>{if(down!==null)return;if(grow())v.play().catch(()=>{});else play.click()});\n c.querySelectorAll('[data-rate]').forEach(b=>b.addEventListener('click',()=>{rate=Number(b.dataset.rate);v.playbackRate=rate;v.defaultPlaybackRate=rate;c.querySelectorAll('[data-rate]').forEach(x=>x.setAttribute('aria-pressed',String(x===b)))}));\n const seek=t=>{const L=len();t=Math.max(0,L?Math.min(L,t):t);v.currentTime=t;if(o.seek)o.seek(t);update()};\n const at=e=>{const b=bar.getBoundingClientRect();return Math.max(0,Math.min(1,(e.clientX-b.left)/b.width))*len()};\n bar.addEventListener('pointerdown',e=>{if(e.button>0||down!==null)return;drag=true;bar.setPointerCapture(e.pointerId);seek(at(e))});\n bar.addEventListener('pointermove',e=>{if(drag)seek(at(e))});\n ['pointerup','pointercancel'].forEach(n=>bar.addEventListener(n,()=>{drag=false}));\n bar.addEventListener('keydown',e=>{\n const k=e.key,t=v.currentTime,by={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-10,PageUp:10}[k];\n const to=by!==undefined?t+by:k==='Home'?0:k==='End'?len():null;if(to===null)return;e.preventDefault();seek(to);\n });\n const full=c.querySelector('.full'),screen=o.full||fig.querySelector('.screen');\n const api=!!(d.fullscreenEnabled&&screen.requestFullscreen),inPage=()=>!!o.inPage&&(o.inPage()||!api);\n const mark=()=>{const f=d.fullscreenElement===screen||screen.classList.contains('focus');full.classList.toggle('out',f);full.setAttribute('aria-label',f?'Exit fullscreen':'Fullscreen');update()};\n let back=0;const focus=on=>{if(on)back=scrollY;screen.classList.toggle('focus',on);scrollTo({top:on?0:back,behavior:'auto'});mark()};\n const grow=()=>{if(!o.expand||!o.inPage||!o.inPage()||d.fullscreenElement||screen.classList.contains('focus'))return false;focus(true);return true};\n if(!api&&!o.inPage)full.hidden=true;\n else{full.addEventListener('click',()=>{const f=screen.classList.contains('focus');if(d.fullscreenElement){d.exitFullscreen().catch(()=>{});if(f)focus(false)}else if(f)focus(false);else if(inPage())focus(true);else screen.requestFullscreen().catch(()=>{})});\n d.addEventListener('fullscreenchange',mark);\n d.addEventListener('keydown',e=>{if(e.key==='Escape'&&!e.defaultPrevented&&screen.classList.contains('focus')&&!d.querySelector('dialog[open]')){e.preventDefault();focus(false)}})}\n d.addEventListener('keydown',e=>{if(e.key!==' '||down!==null||e.defaultPrevented||d.querySelector('dialog[open]')||e.target.closest('button,a,input,textarea,select,summary,[role=slider]'))return;e.preventDefault();play.click()});\n return {v,load,none,playing,update,len,cur:()=>cur,down:()=>down,has:s=>srcs.has(s)};\n};\n";
102
+ export declare const PLAYER_JS = "const d=document,r=d.documentElement,K='screw-bugs-theme';\nconst still=()=>matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst topEdge=()=>{const b=d.querySelector('.menubar');return b?Math.max(0,b.getBoundingClientRect().bottom):0};\nconst pad=n=>String(n).padStart(2,'0');\nconst clock=s=>{s=Math.max(0,Math.floor(s||0));const h=Math.floor(s/3600),m=Math.floor(s%3600/60);return(h?h+':'+pad(m):String(m))+':'+pad(s%60)};\nlet theme='system';try{theme=localStorage.getItem(K)||theme}catch(e){}r.dataset.theme=theme;\nconst themeCycle=(b,key)=>{\n const r=document.documentElement,T=['light','dark','system'],N={light:'Light theme',dark:'Dark theme',system:'Theme from system'};\n const at=()=>{const i=T.indexOf(r.dataset.theme);return i<0?2:i};\n const show=()=>{const i=at(),f=document.getElementById('favicon'),h=f&&f.dataset[T[i]];if(h)f.href=h;b.setAttribute('aria-label',N[T[i]]+'. Switch to '+N[T[(i+1)%3]].toLowerCase());b.title=N[T[i]]};\n show();\n b.addEventListener('click',()=>{const m=T[(at()+1)%3];r.dataset.theme=m;if(key)try{localStorage.setItem(key,m)}catch(e){}show()});\n};\nconst chrome=()=>{\n d.querySelectorAll('.menubar .theme').forEach(b=>{themeCycle(b,K);b.hidden=false});\n if(location.protocol==='http:')d.querySelectorAll('a.share-btn').forEach(a=>{a.hidden=false});\n d.querySelectorAll('time.when[datetime]').forEach(e=>{\n const t=new Date(e.getAttribute('datetime'));if(isNaN(t.getTime()))return;const p={};\n try{new Intl.DateTimeFormat('en-US',{month:'short',day:'numeric',year:'numeric',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(t).forEach(x=>{p[x.type]=x.value});\n const y=d.createElement('span');y.className='year';y.textContent=', '+p.year;\n e.replaceChildren(p.month+' '+p.day,y,' '+String.fromCharCode(183)+' '+p.hour+':'+p.minute);\n e.title=new Intl.DateTimeFormat('en-US',{dateStyle:'full',timeStyle:'long'}).format(t)}catch(x){}\n });\n d.querySelectorAll('.prompt').forEach(p=>{\n const t=p.querySelector('.prompt-text'),b=p.querySelector('.prompt-more');if(!t||!b)return;\n const fits=()=>{if(!p.classList.contains('open'))b.hidden=t.scrollHeight<=t.clientHeight+1};\n fits();if(window.ResizeObserver)new ResizeObserver(fits).observe(t);if(d.fonts&&d.fonts.ready)d.fonts.ready.then(fits);\n b.addEventListener('click',()=>{const o=p.classList.toggle('open');b.textContent=o?'Show less':'Show full prompt';b.setAttribute('aria-expanded',String(o));fits()});\n });\n};\nconst bare=u=>{const i=u.indexOf('://');return i<0?u:u.slice(i+3)};\nconst player=(p,o)=>{\n const v=d.getElementById(p+'-video'),fig=v.closest('.player'),note=d.getElementById(p+'-unloaded'),c=d.getElementById(p+'-controls'),url=d.getElementById(p+'-url');\n const srcs=new Map([...fig.querySelectorAll('[data-session-src]')].map(e=>[e.dataset.session,e.dataset.sessionSrc]));\n const order=[...srcs.keys()];\n const urls=[...fig.querySelectorAll('[data-url]')].map(e=>({s:e.dataset.s,t:Number(e.dataset.at),u:e.dataset.url}));\n const dead=new Set(),errs=new Map(),empty=d.getElementById(p+'-none');let shown=0,cur=v.dataset.session,down=null,held=false,ask=0,auto=false,rate=1,raf=0,drag=false;\n const play=c.querySelector('.play'),now=c.querySelector('.now'),total=c.querySelector('.total'),bar=c.querySelector('.scrub'),head=c.querySelector('.head'),tracks=[...c.querySelectorAll('.track')];\n v.removeAttribute('controls');c.hidden=false;\n const big=d.getElementById(p+'-start');\n if(big){big.hidden=false;big.addEventListener('click',()=>{grow();v.play().catch(()=>{})});v.addEventListener('play',()=>big.remove(),{once:true})}\n const track=()=>tracks.find(t=>t.dataset.s===cur);\n const len=()=>{const t=track(),n=t?Number(t.dataset.total):0;return n>0?n:(isFinite(v.duration)?v.duration:0)};\n const paint=()=>{\n const L=len(),t=v.currentTime,f=L?Math.min(1,t/L):0,k=track();\n tracks.forEach(x=>{x.hidden=x!==k});head.style.left=(f*100)+'%';\n const done=k&&k.querySelector('.done');if(done)done.style.width=(f*100)+'%';\n now.textContent=clock(t);total.textContent=clock(L);\n bar.setAttribute('aria-valuemax',String(Math.round(L)));bar.setAttribute('aria-valuenow',String(Math.round(t)));bar.setAttribute('aria-valuetext',clock(t)+' of '+clock(L));\n play.classList.toggle('playing',!v.paused);play.setAttribute('aria-label',v.paused?'Play':'Pause');\n if(url){let u='';if(down!=='')for(const x of urls){if(x.s===cur&&x.t<=t+0.02)u=x.u}url.textContent=bare(u);url.parentElement.title=u}\n };\n const update=()=>{paint();if(o.tick)o.tick(v.currentTime)};\n const frame=()=>{update();raf=v.paused?0:requestAnimationFrame(frame)};\n const show=s=>{if(down===null)held=!v.paused;down=s;v.pause();fig.classList.add('broken');c.hidden=true;if(empty)empty.hidden=true;if(note){++shown;note.hidden=false;const a=note.querySelector('a');if(a){a.href=srcs.get(s);a.textContent=srcs.get(s)}const ft=note.querySelector('.fix-text'),fd=note.querySelector('.fix-done');if(ft){ft.hidden=true;ft.value=''}if(fd)fd.textContent=''}if(o.broken)o.broken()};\n const fine=()=>{if(down===null)return;down=null;fig.classList.remove('broken');c.hidden=false;if(note)note.hidden=true;if(empty)empty.hidden=true;if(o.fine)o.fine()};\n const none=()=>{if(down===null)held=!v.paused;++ask;auto=false;down='';v.pause();fig.classList.add('broken');c.hidden=true;if(note)note.hidden=true;if(empty)empty.hidden=false;paint();if(o.broken)o.broken()};\n const playing=()=>down===null?!v.paused:held;\n const next=s=>order.slice(order.indexOf(s)+1).find(n=>!dead.has(n));\n const load=(s,t,go,a)=>{\n const my=++ask;auto=!!a;if(dead.has(s))return show(s);\n if(s!==cur||!v.currentSrc||v.error){cur=s;v.dataset.session=s;v.src=srcs.get(s);v.load()}\n const done=()=>{if(my!==ask)return;auto=false;fine();v.playbackRate=rate;v.currentTime=t;update();if(go)v.play().catch(()=>{})};\n if(v.readyState>0)done();else v.addEventListener('loadedmetadata',done,{once:true});\n };\n const bad=()=>{const e=v.error;if(!e)return;dead.add(cur);errs.set(cur,'error code '+e.code+(e.message?': '+e.message:''));if(down==='')return;const n=auto?next(cur):undefined;if(n!==undefined)return load(n,0,true,true);auto=false;show(cur)};\n ['timeupdate','seeked','loadedmetadata','pause','play','durationchange'].forEach(n=>v.addEventListener(n,update));\n v.addEventListener('play',()=>{if(!raf)raf=requestAnimationFrame(frame)});\n addEventListener('resize',update);\n v.addEventListener('error',bad);if(v.error)queueMicrotask(bad);\n const fix=d.getElementById(p+'-fix');\n if(fix){const box=fix.parentElement,ta=box.querySelector('.fix-text'),said=box.querySelector('.fix-done');\n fix.addEventListener('click',()=>{\n let t=ta.dataset.template||'';\n [['video',down?srcs.get(down)||'':''],['page',location.href],['browser',navigator.userAgent],['error',errs.get(down)||'nothing']].forEach(([k,x])=>{t=t.split('{'+k+'}').join(x)});\n const g=shown;ta.value=t;const ok=()=>{if(g!==shown)return;said.textContent='Copied. Paste it into your coding agent.'};\n const by=()=>{if(g!==shown)return;ta.hidden=false;ta.focus();ta.setSelectionRange(0,t.length);ta.scrollTop=0;let c=false;try{c=d.execCommand('copy')}catch(x){}if(c)ok();else said.textContent='Copy the prompt below.'};\n if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(t).then(ok,by);else by();\n })}\n v.addEventListener('ended',()=>{if(o.ended&&o.ended())return;const n=next(cur);if(n!==undefined)load(n,0,true,true)});\n play.addEventListener('click',()=>{if(v.paused)v.play().catch(()=>{});else v.pause()});\n v.addEventListener('click',()=>{if(down!==null)return;if(grow())v.play().catch(()=>{});else play.click()});\n c.querySelectorAll('[data-rate]').forEach(b=>b.addEventListener('click',()=>{rate=Number(b.dataset.rate);v.playbackRate=rate;v.defaultPlaybackRate=rate;c.querySelectorAll('[data-rate]').forEach(x=>x.setAttribute('aria-pressed',String(x===b)))}));\n const seek=t=>{const L=len();t=Math.max(0,L?Math.min(L,t):t);v.currentTime=t;if(o.seek)o.seek(t);update()};\n const at=e=>{const b=bar.getBoundingClientRect();return Math.max(0,Math.min(1,(e.clientX-b.left)/b.width))*len()};\n bar.addEventListener('pointerdown',e=>{if(e.button>0||down!==null)return;drag=true;bar.setPointerCapture(e.pointerId);seek(at(e))});\n bar.addEventListener('pointermove',e=>{if(drag)seek(at(e))});\n ['pointerup','pointercancel'].forEach(n=>bar.addEventListener(n,()=>{drag=false}));\n bar.addEventListener('keydown',e=>{\n const k=e.key,t=v.currentTime,by={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-10,PageUp:10}[k];\n const to=by!==undefined?t+by:k==='Home'?0:k==='End'?len():null;if(to===null)return;e.preventDefault();seek(to);\n });\n const full=c.querySelector('.full'),screen=o.full||fig.querySelector('.screen');\n const api=!!(d.fullscreenEnabled&&screen.requestFullscreen),inPage=()=>!!o.inPage&&(o.inPage()||!api);\n const mark=()=>{const f=d.fullscreenElement===screen||screen.classList.contains('focus');full.classList.toggle('out',f);full.setAttribute('aria-label',f?'Exit fullscreen':'Fullscreen');update()};\n let back=0;const focus=on=>{if(on)back=scrollY;screen.classList.toggle('focus',on);scrollTo({top:on?0:back,behavior:'auto'});mark()};\n const grow=()=>{if(!o.expand||!o.inPage||!o.inPage()||d.fullscreenElement||screen.classList.contains('focus'))return false;focus(true);return true};\n if(!api&&!o.inPage)full.hidden=true;\n else{full.addEventListener('click',()=>{const f=screen.classList.contains('focus');if(d.fullscreenElement){d.exitFullscreen().catch(()=>{});if(f)focus(false)}else if(f)focus(false);else if(inPage())focus(true);else screen.requestFullscreen().catch(()=>{})});\n d.addEventListener('fullscreenchange',mark);\n d.addEventListener('keydown',e=>{if(e.key==='Escape'&&!e.defaultPrevented&&screen.classList.contains('focus')&&!d.querySelector('dialog[open]')){e.preventDefault();focus(false)}})}\n d.addEventListener('keydown',e=>{if(e.key!==' '||down!==null||e.defaultPrevented||d.querySelector('dialog[open]')||e.target.closest('button,a,input,textarea,select,summary,[role=slider]'))return;e.preventDefault();play.click()});\n return {v,load,none,playing,update,len,cur:()=>cur,down:()=>down,has:s=>srcs.has(s)};\n};\n";
@@ -188,8 +188,8 @@ export const share = (ms, of) => of === undefined || of <= 0
188
188
  : `${Math.round(Math.max(0, Math.min(1, ms / of)) * 1e6) / 1e4}%`;
189
189
  /**
190
190
  * The script both pages start with: the theme (set before anything is painted, kept where the
191
- * browser allows, and the menu bar's theme button, `THEME_BUTTON_JS`), the Share button (shown only on a page the local report server served: `http:`
192
- * on 127.0.0.1 or localhost), where the sticky menu bar ends (`topEdge`), when the run started in the reader's
191
+ * browser allows, and the menu bar's theme button, `THEME_BUTTON_JS`), the Share button (shown only on a page served over `http:`, as the local report server serves
192
+ * it), where the sticky menu bar ends (`topEdge`), when the run started in the reader's
193
193
  * own time zone (`Nov 4, 2026 · 23:50`, with the full date and zone as its title), the prompt's
194
194
  * "Show full prompt" (offered only when it does not fit, measured again whenever the prompt's box
195
195
  * changes size and once the page's fonts have loaded; while open it stays, as "Show less"), and `player(prefix, hooks)`, which takes over the video:
@@ -223,7 +223,7 @@ let theme='system';try{theme=localStorage.getItem(K)||theme}catch(e){}r.dataset.
223
223
  ${THEME_BUTTON_JS}
224
224
  const chrome=()=>{
225
225
  d.querySelectorAll('.menubar .theme').forEach(b=>{themeCycle(b,K);b.hidden=false});
226
- if(location.protocol==='http:'&&(location.hostname==='127.0.0.1'||location.hostname==='localhost'))d.querySelectorAll('a.share-btn').forEach(a=>{a.hidden=false});
226
+ if(location.protocol==='http:')d.querySelectorAll('a.share-btn').forEach(a=>{a.hidden=false});
227
227
  d.querySelectorAll('time.when[datetime]').forEach(e=>{
228
228
  const t=new Date(e.getAttribute('datetime'));if(isNaN(t.getTime()))return;const p={};
229
229
  try{new Intl.DateTimeFormat('en-US',{month:'short',day:'numeric',year:'numeric',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(t).forEach(x=>{p[x.type]=x.value});