Spaces:
Running

direction-qa / index.html
boreum0302's picture
Direction QA: final 1000 QA (500 left/right + 500 towards/away), shuffled option order; model responses taken down
986ec23 verified
Raw History Blame Contribute Delete
21 kB
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Direction QA</title>
<link rel="icon" href="data:,">
<style>
:root{--bg:#0f151c;--side:#131b24;--panel:#17212c;--panel2:#1d2935;--line:#2a3745;--line2:#3a4a5c;--ink:#e8edf4;--muted:#94a3b6;--faint:#6c7b8e;
--accent:#55d8af;--accent-ink:#0b2a21;--accent-soft:#163a31;--band:#55d8af30;--ref:#f2b45c;--r:12px}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.6 Inter,system-ui,-apple-system,"Segoe UI","Apple SD Gothic Neo","Noto Sans KR",sans-serif}
button,select,input{font:inherit;color:inherit}
button,select{background:var(--panel2);border:1px solid var(--line2);border-radius:8px;padding:6px 12px;cursor:pointer}
button:hover,select:hover{border-color:var(--accent)}
input[type=search]{width:100%;background:var(--panel2);border:1px solid var(--line2);border-radius:8px;padding:6px 10px}
header{position:sticky;top:0;z-index:5;display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 22px;border-bottom:1px solid var(--line);background:#0f151cee}
h1{font-size:17px;margin:0}
header small{color:var(--muted);font-size:12.5px}
main{display:grid;grid-template-columns:270px minmax(0,1fr);max-width:1700px;margin:auto}
aside{position:sticky;top:57px;height:calc(100vh - 57px);display:flex;flex-direction:column;border-right:1px solid var(--line);background:var(--side)}
.filters{padding:14px;display:grid;gap:8px;border-bottom:1px solid var(--line)}
.filters select{width:100%}
#list{overflow:auto;padding:6px 8px 20px;flex:1}
.item{display:block;width:100%;text-align:left;margin:3px 0;padding:7px 10px;border-radius:8px;background:transparent;border:1px solid transparent}
.item:hover{background:var(--panel);border-color:var(--line)}
.item.active{background:var(--accent-soft);border-color:var(--accent)}
.item .t{font-size:12.5px;font-weight:600}
.item .s{font-size:11.5px;color:var(--muted)}
.content{padding:18px 24px 40px;min-width:0}
.toolbar{display:flex;gap:10px;align-items:center;margin-bottom:12px}
#pos{color:var(--muted);font-size:13px;font-variant-numeric:tabular-nums}
.pair{display:grid;grid-template-columns:minmax(0,980px);gap:14px}
.vlabel{font-size:13.5px;font-weight:600;margin:0 0 6px}
.vlabel span{color:var(--ref);font-weight:500}
.stage{position:relative;background:#000;border-radius:var(--r);overflow:hidden;line-height:0}
.stage svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.stage video{width:100%;aspect-ratio:16/9;display:block}
.badge{position:absolute;left:10px;top:10px;line-height:1.4;padding:2px 9px;border-radius:999px;background:#000b;color:#fff;font-size:12.5px;font-variant-numeric:tabular-nums}
.badge.in{background:var(--accent);color:var(--accent-ink);font-weight:700}
.player{margin:12px 0 4px;display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.scrub{position:relative;flex:1;min-width:260px;height:38px}
.rail{position:absolute;left:0;right:0;top:16px;height:6px;border-radius:3px;background:var(--line)}
#band{position:absolute;top:12px;height:14px;border-radius:5px;background:var(--band);border:1px solid var(--accent)}
#fband{position:absolute;top:12px;height:14px;border-radius:5px;background:#f2b45c26;border:1px dashed var(--ref);display:none}
.legend{font-size:12px;color:var(--muted);margin:2px 0 0}
.legend b{color:var(--ref);font-weight:600}
#refmark{position:absolute;top:6px;width:3px;height:26px;margin-left:-1.5px;border-radius:2px;background:var(--ref)}
.knob{position:absolute;top:10px;width:18px;height:18px;margin-left:-9px;border-radius:50%;background:var(--ink);box-shadow:0 0 0 3px var(--bg);pointer-events:none}
.ticks{position:absolute;left:0;right:0;top:29px;display:flex;justify-content:space-between;font-size:10px;color:var(--faint);pointer-events:none}
#slider{position:absolute;inset:0;width:100%;margin:0;opacity:0;cursor:pointer}
#clock{min-width:96px;color:var(--accent);font-size:13.5px;font-variant-numeric:tabular-nums}
.card{margin-top:12px;background:var(--panel);border:1px solid var(--line);border-radius:var(--r);padding:16px 20px;max-width:980px}
.type{font-size:12px;color:var(--muted);letter-spacing:.3px}
#question{font-size:17px;line-height:1.7;margin:6px 0 12px}
.option{display:flex;gap:12px;align-items:center;padding:9px 13px;margin:7px 0;border:1px solid var(--line2);border-radius:9px;background:var(--panel2)}
.option .L{width:26px;height:26px;border-radius:7px;display:grid;place-items:center;background:var(--line);font-weight:700;font-size:13px;flex:none}
.show .option.correct{border-color:var(--accent);background:var(--accent-soft)}
.show .option.correct .L{background:var(--accent);color:var(--accent-ink)}
.prompt{display:none;white-space:pre-wrap;font:12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;background:var(--panel2);border:1px solid var(--line2);border-radius:9px;padding:10px 13px;margin-top:10px;max-height:60vh;overflow:auto}
.prompt.on{display:block}
.foot{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:10px;font-size:12.5px;color:var(--faint)}
#toast{position:fixed;right:20px;bottom:20px;background:var(--accent);color:var(--accent-ink);padding:7px 13px;border-radius:8px;font-weight:600;opacity:0;transition:.2s;pointer-events:none}
#toast.on{opacity:1}
@media(max-width:760px){main{display:block}aside{position:static;height:auto;max-height:40vh}.pair{grid-template-columns:1fr}.content,header{padding:12px 16px}}
</style>
<link rel="stylesheet" href="stats.css">
<link rel="stylesheet" href="review.css">
</head>
<body>
<header>
<div><h1>Direction QA</h1><small>๊ณ ์ • ์นด๋ฉ”๋ผ ยท ํ•œ ์‚ฌ๋žŒ ยท ๋ฐฉํ–ฅ QA 1,000๊ฐœ ยท ์ขŒ์šฐ 500๊ฐœ + ์•ž๋’ค 500๊ฐœ ยท ๋ณด๊ธฐ ์ˆœ์„œ ๋ฌธํ•ญ๋งˆ๋‹ค ์„ž์Œ</small></div>
<nav class="view-tabs" role="tablist" aria-label="Collection views"><button id="videosTab" role="tab" aria-selected="true" aria-controls="collectionView">์˜์ƒ ยท QA</button><button id="statsTab" role="tab" aria-selected="false" aria-controls="statsView">ํ…œํ”Œ๋ฆฟ ยท ํ†ต๊ณ„</button></nav>
<button id="copyTop" type="button">ID ๋ณต์‚ฌ</button>
</header>
<div style="padding:6px 24px"><a href="https://huggingface.co/datasets/boreum0302/4d-direction-qa" target="_blank" rel="noopener">32-frame evaluation dataset</a></div>
<main id="collectionView" role="tabpanel" aria-labelledby="videosTab">
<aside>
<div class="filters">
<div class="filter-field"><label for="sourceF">Video source</label><select id="sourceF"><option value="">All</option></select></div>
<div class="filter-field"><label for="playbackF">์žฌ์ƒ ๋ฐฉํ–ฅ</label><select id="playbackF"><option value="">์ „์ฒด</option><option value="original">์›๋ณธ</option><option value="reversed">์—ญ์žฌ์ƒ</option></select></div>
<div class="filter-field"><label for="typeF">QA type</label><select id="typeF"><option value="">์ „์ฒด ์œ ํ˜•</option></select></div>
<div class="filter-field" style="display:none"><label for="outcomeF">๋ชจ๋ธ ์ •์˜ค ํŒจํ„ด</label><select id="outcomeF" disabled><option value="">ํ‰๊ฐ€ ์‘๋‹ต ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘โ€ฆ</option></select></div>
<input id="search" type="search" placeholder="ID ยท ๋ฌผ์ฒด ๊ฒ€์ƒ‰">
</div>
<div id="count" aria-live="polite" style="padding:0 14px;font-size:12px;color:var(--muted)"></div>
<div id="list"></div>
</aside>
<section class="content">
<div id="loadError" role="alert" hidden></div>
<div class="toolbar"><button id="prev">โ† ์ด์ „</button><span id="pos"></span><button id="next">๋‹ค์Œ โ†’</button></div>
<div id="emptyState" class="empty-state" hidden>์„ ํƒํ•œ ํ•„ํ„ฐ์— ํ•ด๋‹นํ•˜๋Š” ๋ฌธํ•ญ์ด ์—†์Šต๋‹ˆ๋‹ค. ํ•„ํ„ฐ๋‚˜ ๊ฒ€์ƒ‰์–ด๋ฅผ ๋ฐ”๊ฟ” ์ฃผ์„ธ์š”.</div>
<div id="reviewPanel">
<div class="review-grid">
<div class="video-panel">
<div class="pair">
<div><div class="vlabel" id="playbackLabel"></div><div class="stage"><video id="v1" muted playsinline preload="auto"></video><svg id="s1" viewBox="0 0 1280 720" style="display:none"></svg><span class="badge" id="b1"></span></div></div>
</div>
<div class="player">
<label id="boxControl" style="display:none"><input id="bx" type="checkbox" checked> ๋Œ€์ƒ ํ‘œ์‹œ</label>
<button id="playQ">์žฌ์ƒ</button>
<div class="scrub"><div class="rail"></div><div id="band"></div><div id="fband"></div><div id="refmark"></div><div class="knob" id="knob"></div>
<div class="ticks" id="ticks"></div>
<input type="range" id="slider" min="0" max="1" step="1" value="0" aria-label="frame"></div>
<span id="clock"></span>
</div>
<div class="legend" id="legend"></div>
</div>
<div class="card qa-panel show" id="card">
<div class="type" id="type"></div><div id="objectNames" style="font-size:12px;color:var(--muted)"></div>
<div id="question"></div>
<div id="options"></div>
<div class="gt-summary" id="gtAnswer"></div>
<div class="foot"><span><label><input type="checkbox" id="gt" checked> ์ •๋‹ต ํ‘œ์‹œ</label> <label><input type="checkbox" id="tp"> Prompt</label></span><span><span id="qid"></span> <button id="copyId" type="button">ID ๋ณต์‚ฌ</button></span></div>
<pre class="prompt" id="prompt"></pre>
</div>
</div>
<section class="model-responses" aria-labelledby="responsesTitle" style="display:none">
<div class="model-responses-heading"><h2 id="responsesTitle">๋ชจ๋ธ ์‘๋‹ต</h2><small>๋ฌธํ•ญ๋‹น 1ํšŒ ยท thinking ๋”</small></div>
<div class="model-response-grid">
<article class="card response-card"><div class="response-title"><h3>4B model response</h3><span class="verdict" id="verdict4B"></span></div><div class="prediction" id="prediction4B"></div><pre class="response-text" id="response4B"></pre></article>
<article class="card response-card"><div class="response-title"><h3>9B model response</h3><span class="verdict" id="verdict9B"></span></div><div class="prediction" id="prediction9B"></div><pre class="response-text" id="response9B"></pre></article>
</div>
</section>
</div>
</section>
</main>
<section id="statsView" class="stats-view" role="tabpanel" aria-labelledby="statsTab" hidden>
<div class="stats-heading"><div><div class="stats-eyebrow">COLLECTION OVERVIEW</div><h2>ํ…œํ”Œ๋ฆฟ & ๋ฐ์ดํ„ฐ ๋ถ„ํฌ</h2><p>1,000 questions ยท direction</p></div><span class="stats-seal">โ— ๊ฒ€์ˆ˜ ๋Œ€์ƒ 1,000๋ฌธํ•ญ</span></div>
<div id="statsMetrics" class="metrics-grid"></div>
<section class="source-overview" aria-labelledby="sourceOverviewTitle"><div class="stats-title"><h3 id="sourceOverviewTitle">Video source๋ณ„ Scene ยท QA ์ˆ˜</h3></div><p id="sceneDefinition" class="stats-subtitle"></p><div class="table-wrap"><table class="stats-table source-summary-table"><thead><tr><th scope="col">Video Source</th><th scope="col" class="num-cell">Scene ์ˆ˜</th><th scope="col" class="num-cell">QA ์ˆ˜</th></tr></thead><tbody id="sourceSummaryRows"></tbody><tfoot><tr><th scope="row">์ดํ•ฉ</th><td id="sourceSummaryScenes" class="num-cell"></td><td id="sourceSummaryQuestions" class="num-cell"></td></tr></tfoot></table></div></section>
<div class="stats-controls"><label>QA ์œ ํ˜• <select id="statsType"><option value="">์ „์ฒด ์œ ํ˜•</option></select></label><label>Video source <select id="statsSource"><option value="">์ „์ฒด ์†Œ์Šค</option></select></label><span id="statsScope" aria-live="polite">๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘โ€ฆ</span></div>
<section class="stats-block"><div class="stats-title"><span class="stats-index">01</span><h3>์งˆ๋ฌธ ยท ๋ณด๊ธฐ ํ…œํ”Œ๋ฆฟ</h3></div><p class="stats-subtitle">์งˆ๋ฌธ์€ ํด๋ฆฝ ์ „์ฒด๋ฅผ ๋ฌป์Šต๋‹ˆ๋‹ค. ๋ณด๊ธฐ ๋„ค ๊ฐœ์˜ ์ˆœ์„œ๋Š” ๋ฌธํ•ญ๋งˆ๋‹ค ์„ž์—ฌ ์žˆ์Šต๋‹ˆ๋‹ค.</p><div class="table-wrap"><table class="stats-table"><thead><tr><th scope="col">์œ ํ˜•</th><th scope="col">Question template</th><th scope="col">Option template</th></tr></thead><tbody id="templateRows"></tbody></table></div></section>
<section class="stats-block"><div class="stats-title"><span class="stats-index">02</span><h3>์˜์ƒ ยท QA ์ˆ˜</h3></div><p id="videoDefinition" class="stats-subtitle"></p><div class="table-wrap"><table class="stats-table"><thead><tr><th scope="col">์œ ํ˜•</th><th scope="col">Video source</th><th scope="col" style="text-align:right">๊ณ ์œ  ์˜์ƒ</th><th scope="col" style="text-align:right">QA ์ˆ˜</th></tr></thead><tbody id="countRows"></tbody></table></div></section>
<section class="stats-block"><div class="stats-title"><span class="stats-index">03</span><h3>GT ๋ถ„ํฌ</h3></div><p id="gtDefinition" class="stats-subtitle"></p><div class="table-wrap"><table class="stats-table"><thead><tr><th scope="col">์œ ํ˜•</th><th scope="col">Video source</th><th scope="col" style="text-align:right">QA ์ˆ˜</th><th scope="col">์ •๋‹ต ์˜๋ฏธ๋ณ„ ๊ฐœ์ˆ˜ ยท ๋น„์œจ</th></tr></thead><tbody id="gtRows"></tbody></table></div></section>
</section>
<div id="toast">๋ณต์‚ฌ๋จ</div>
<script src="model-results.js"></script>
<script>
const $=id=>document.getElementById(id);
const v1=$('v1');
const Review=globalThis.DirectionReview;
let D,R=null,Q=[],cur=0,loop=null,raf=0;
const readJSON=url=>fetch(url).then(r=>{if(!r.ok)throw Error('๋ถˆ๋Ÿฌ์˜ค๊ธฐ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค. ์ƒˆ๋กœ๊ณ ์นจํ•ด ์ฃผ์„ธ์š”.');return r.json()});
Promise.all([readJSON('data.json'),Promise.resolve(null)]).then(([d,results])=>{D=d;
R=null;
$('outcomeF').innerHTML='';for(const pattern of Review.patterns){const o=document.createElement('option');o.value=pattern.value;o.textContent=pattern.label;$('outcomeF').append(o)}$('outcomeF').disabled=!R;
for(const source of [...new Set(D.questions.map(q=>q.video_source))]){const o=document.createElement('option');o.value=source;o.textContent=source;$('sourceF').append(o)}
for(const t of D.types){const o=document.createElement('option');o.value=t;o.textContent=t;$('typeF').append(o)}
let h='';try{h=decodeURIComponent(location.hash.slice(1))}catch(e){}filter();const k=Q.findIndex(q=>q.id===h);show(k<0?0:k)}).catch(()=>{stop();$('reviewPanel').hidden=true;$('loadError').textContent='๋ฌธํ•ญ์„ ๋ถˆ๋Ÿฌ์˜ค์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค. ์ƒˆ๋กœ๊ณ ์นจํ•ด ์ฃผ์„ธ์š”.';$('loadError').hidden=false;$('pos').textContent='0 / 0';$('prev').disabled=$('next').disabled=$('copyTop').disabled=true});
function filter(){if(!D)return;const source=$('sourceF').value,t=$('typeF').value,s=$('search').value.trim().toLowerCase();
const base=D.questions.filter(q=>(!source||q.video_source===source)&&(!$('playbackF').value||q.playback===$('playbackF').value)&&(!t||q.type===t)&&(!s||(q.id+' '+q.question+' '+q.label+' '+q.playback).toLowerCase().includes(s)));
const counts=Review.counts(base,R);for(const option of $('outcomeF').options){const pattern=Review.patterns.find(p=>p.value===option.value);option.textContent=`${pattern.label} (${counts[option.value].toLocaleString()})`}
Q=base.filter(q=>Review.matches(q,$('outcomeF').value,R));
$('count').textContent=`${Q.length.toLocaleString()} / ${D.questions.length.toLocaleString()} questions`;
const L=$('list');L.innerHTML='';
Q.forEach((q,k)=>{const b=document.createElement('button');b.className='item';b.dataset.k=k;
b.innerHTML=`<div class="t">${q.type}</div><div class="s">${q.playback} ยท ${q.label} ยท ${q.clip_seconds.toFixed(1)}์ดˆ</div>`;b.onclick=()=>show(k);L.append(b)})}
$('outcomeF').onchange=()=>{filter();show(0)};$('playbackF').onchange=()=>{filter();show(0)};$('sourceF').onchange=()=>{filter();show(0)};$('typeF').onchange=()=>{filter();show(0)};$('search').oninput=()=>{filter();show(0)};
const colors=['#ff6b6b','#4dabf7','#ffd43b'];
const esc=s=>String(s).replace(/[&<>"]/g,c=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;'}[c]));
function drawBoxes(q){return (q.boxes||[]).map(([x0,y0,x1,y1],n)=>`<rect x="${x0*1280}" y="${y0*720}" width="${(x1-x0)*1280}" height="${(y1-y0)*720}" fill="none" stroke="${colors[n%3]}" stroke-width="4"/><text x="${x0*1280+4}" y="${y0*720+25}" fill="${colors[n%3]}" font-size="26" font-weight="bold">${esc(q.labels[n])}</text>`).join('')}
$('bx').onchange=ui;
// ํด๋ฆฝ ๋‹จ์œ„(run-261103): ๋ฌธํ•ญ๋งˆ๋‹ค ํด๋ฆฝ ํ”„๋ ˆ์ž„ 0..n-1, clip_fps(8)
function last(q){return q.clip_frames-1}
function fps(q){return q.clip_fps||D.fps}
function tOf(q,k){return (k+.5)/fps(q)}
function kOf(q,t){return [Math.max(0,Math.min(last(q),Math.floor(t*fps(q)))),true]}
function show(k){if(!Q.length){stop();v1.removeAttribute('src');v1.load();$('reviewPanel').hidden=true;$('emptyState').hidden=false;$('pos').textContent='0 / 0';$('prev').disabled=$('next').disabled=$('copyTop').disabled=true;return}cur=Math.max(0,Math.min(Q.length-1,k));const q=Q[cur];stop();
$('reviewPanel').hidden=false;$('emptyState').hidden=true;$('prev').disabled=cur===0;$('next').disabled=cur===Q.length-1;$('copyTop').disabled=false;
document.querySelectorAll('.item').forEach(e=>e.classList.toggle('active',+e.dataset.k===cur));
document.querySelector(`.item[data-k="${cur}"]`)?.scrollIntoView({block:'nearest'});
history.replaceState(null,'','#'+encodeURIComponent(q.id));
$('pos').textContent=`${cur+1} / ${Q.length}`;$('type').textContent=q.video_source+' ยท '+q.type;$('question').textContent=q.question;$('prompt').textContent=q.teacher_prompt||R?.evaluation?.prompt_by_type?.[q.type]||R?.evaluation?.prompt||D.prompt||'';$('qid').textContent=q.id;
$('boxControl').style.display=q.boxes?'inline':'none';
$('objectNames').textContent=q.names?q.names.map((n,k)=>(q.labels[k]+': '+n)).join(' ยท '):'';
$('s1').innerHTML=drawBoxes(q);
$('s1').style.display='none';
$('playbackLabel').textContent=q.playback==='original'?'์›๋ณธ ํด๋ฆฝ':'์—ญ์žฌ์ƒ ํด๋ฆฝ';
$('options').innerHTML=Object.entries(q.options).map(([L,t])=>`<div class="option${L===q.answer?' correct':''}"><span class="L">${esc(L)}</span><span>${esc(t)}</span></div>`).join('');
$('gtAnswer').textContent=`GT ยท ${q.answer} โ€” ${q.options[q.answer]}`;
for(const size of ['4B','9B']){const response=Review.responseFor(q,size,R),verdict=$('verdict'+size);verdict.className='verdict';if(Review.isPending(q,R)){verdict.textContent='ํ‰๊ฐ€ ์ „';$('prediction'+size).textContent='';$('response'+size).textContent='์ด ๋ฌธํ•ญ์€ ์•„์ง ํ‰๊ฐ€ํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.'}else if(response){const correct=response.pred===q.answer;verdict.textContent=correct?'์ •๋‹ต':'์˜ค๋‹ต';verdict.classList.add(correct?'correct':'wrong');$('prediction'+size).textContent=response.pred?`์˜ˆ์ธก ${response.pred} ยท ${q.options[response.pred]}`:'๋‹ต ํŒŒ์‹ฑ ์‹คํŒจ';$('response'+size).textContent=response.response}else{verdict.textContent='์‘๋‹ต ์—†์Œ';$('prediction'+size).textContent='';$('response'+size).textContent='ํ‰๊ฐ€ ์‘๋‹ต์„ ๋ถˆ๋Ÿฌ์˜ค์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค.'}}
const n=last(q);$('slider').max=n;$('band').style.left='0%';$('band').style.width='100%';$('refmark').style.left='0%';$('fband').style.display='none';
$('ticks').innerHTML=[0,Math.round(n/2),n].map(x=>`<span>${x}</span>`).join('');
$('legend').innerHTML=`ํด๋ฆฝ ${q.clip_frames}ํ”„๋ ˆ์ž„ ยท ${q.clip_seconds.toFixed(2)}์ดˆ ยท ${fps(q)} fps`+(q.future?' ยท <b>์ •๋‹ต์„ ์ •ํ•œ ๋‹ค์Œ ์›€์ง์ž„์€ ํด๋ฆฝ ๋’ค๋ผ ๋ชจ๋ธ์— ์ฃผ์ง€ ์•Š์Œ</b>':'');
v1.src=q.video;v1.onloadeddata=()=>seek(0)}
function seek(k){const q=Q[cur];if(!q)return;v1.currentTime=tOf(q,k);ui()}
function ui(){const q=Q[cur];if(!q)return;const [k]=kOf(q,v1.currentTime);
for(const b of [$('b1')]){b.textContent=`frame ${k} / ${last(q)}`;b.classList.toggle('in',true)}
$('s1').style.display=q.boxes&&$('bx').checked&&k===0?'block':'none';
$('slider').value=k;$('knob').style.left=(k/Math.max(1,last(q))*100)+'%';$('clock').textContent=`${v1.currentTime.toFixed(2)} s`}
function tick(){
if(loop&&v1.currentTime>=loop[1]){v1.currentTime=loop[0]}
ui();raf=requestAnimationFrame(tick)}
function play(a,b){stop();loop=[a,b];v1.currentTime=a;v1.play();raf=requestAnimationFrame(tick)}
function stop(){loop=null;v1.pause();cancelAnimationFrame(raf)}
$('playQ').onclick=()=>{const q=Q[cur];if(q)play(0,q.clip_frames/fps(q)-.01)}; // ํด๋ฆฝ ์ „์ฒด
$('slider').oninput=e=>{stop();seek(+e.target.value)};
$('prev').onclick=()=>show(cur-1);$('next').onclick=()=>show(cur+1);
$('gt').onchange=e=>$('card').classList.toggle('show',e.target.checked);
$('tp').onchange=e=>$('prompt').classList.toggle('on',e.target.checked);
function copy(){if(!Q[cur])return;navigator.clipboard.writeText(Q[cur].id);$('toast').classList.add('on');setTimeout(()=>$('toast').classList.remove('on'),900)}
$('copyId').onclick=copy;$('copyTop').onclick=copy;
document.addEventListener('keydown',e=>{if(['INPUT','SELECT','TEXTAREA','BUTTON'].includes(e.target.tagName))return;const q=Q[cur];if(!q)return;
if(e.key==='j')show(cur+1);else if(e.key==='k')show(cur-1);
else if(e.key==='ArrowRight'||e.key==='ArrowLeft'){e.preventDefault();stop();seek(Math.max(0,Math.min(last(q),kOf(q,v1.currentTime)[0]+(e.key==='ArrowRight'?1:-1))))}
else if(e.key===' '){e.preventDefault();loop?stop():$('playQ').click()}});
</script>
<script src="stats.js"></script>
</body>
</html>