export const tasks = [ {label: ['Change state','变化状态'], protocol: [['T₁ + T₂','T₁ + T₂'], ['Changed / Unchanged','有变化 / 无变化'], ['Stage 1 warm-start','第一阶段预热']]}, {label: ['Caption verification','描述核验'], protocol: [['T₁ + T₂ + fixed caption','双图 + 固定描述'], ['Yes / No','支持 / 不支持'], ['Stage 2 verification','第二阶段事实核验']]}, {label: ['Pairwise preference','成对偏好'], protocol: [['T₁ + T₂ + A/B','双图 + A/B'], ['A / B','A / B'], ['Stage 1 auxiliary task','第一阶段辅助任务']]}, {label: ['Listwise selection','列表选句'], protocol: [['T₁ + T₂ + candidate pool','双图 + 候选池'], ['One caption','一条描述'], ['Stage 1 and Stage 2 inference','两阶段正式推理']]}, ]; const motions = new WeakMap(); export function moveCards(list, cards, update) { const animate = !matchMedia('(prefers-reduced-motion: reduce)').matches && list.getClientRects().length > 0 && typeof list.animate === 'function'; const before = animate ? cards.map(card => card.getBoundingClientRect().top) : []; cards.forEach((card, index) => { motions.get(card)?.cancel(); const reference = list.children[index]; if (reference !== card) { if (list.moveBefore) list.moveBefore(card, reference); else list.insertBefore(card, reference); } update(card, index); }); if (!animate) return; const easing = getComputedStyle(list).getPropertyValue('--rank-settle').trim() || 'ease-out'; cards.forEach((card, index) => { const distance = before[index] - card.getBoundingClientRect().top; if (Math.abs(distance) <= 1) return; const duration = Math.min(510, 300 + Math.sqrt(Math.abs(distance)) * 10); motions.set(card, card.animate([{transform:`translateY(${distance}px)`}, {transform:'none'}], {duration, easing})); }); } export function renderProbes({byId, text, evidence, pair, escape, catalog}) { let conflict = false, reversed = false, visualRank = false; const state = byId('state-probe'), verify = byId('probe'), pairwise = byId('aux-probe'), listwise = byId('list-probe'); const evidenceDeck = byId('verify-images'); const verifyCases = ['000325','000400'].map(id => catalog.task_pairs[id]); const lists = catalog.task_pairs['001639']; const heading = (tag, title) => `

${tag}

${title}

`; const protocol = index => `
${[[text('Input','输入'),0],[text('Output','输出'),1],[text('Role','用途'),2]].map(([title, position]) => `
${title}
${text(...tasks[index].protocol[position])}
`).join('')}
`; const metric = (title, value, note) => `
${title}${value}
${note}
`; const toggles = (name, first, second) => `
`; const press = (container, choice) => container.querySelectorAll('[data-choice]').forEach(button => button.setAttribute('aria-pressed', Boolean(Number(button.dataset.choice)) === choice)); const say = message => { byId('task-announcement').textContent = message; }; const card = (id, caption) => `
  • ${escape(caption)}

  • `; function updateVerification(announce) { press(verify, conflict); evidenceDeck.querySelectorAll('.evidence-layer').forEach((layer, index) => { const active = index === Number(conflict); layer.dataset.active = active; layer.setAttribute('aria-hidden', !active); }); evidenceDeck.querySelector('figcaption').textContent = `LEVIR-CC · ${verifyCases[Number(conflict)].name.replace(/\.png$/u, '')}`; const display = verify.querySelector('.verify-meter'); const value = conflict ? '<0.1%' : '>99.9%'; const decision = conflict ? text('No','不支持') : text('Yes','支持'); display.dataset.conflict = conflict; display.style.setProperty('--likelihood', conflict ? '0.001' : '0.999'); display.querySelector('strong').textContent = value; display.querySelector('b').textContent = decision; if (announce) say(`${decision} · P(Yes) ${value}`); } function updatePair(announce) { const list = pairwise.querySelector('ol'); const cards = ['houses','unchanged'].map(id => list.querySelector(`[data-card="${id}"]`)); moveCards(list, reversed ? cards.reverse() : cards, (item, index) => { const preferred = item.dataset.card === 'houses'; item.classList.toggle('probe-picked', preferred); item.querySelector('code').textContent = index === 0 ? 'A' : 'B'; item.querySelector('strong').textContent = reversed ? preferred ? '91.5%' : '8.5%' : preferred ? '96.9%' : '3.1%'; }); pairwise.querySelector('[data-reverse]').setAttribute('aria-pressed', reversed); pairwise.querySelector('.order-comparison').dataset.reversed = reversed; if (announce) say(`${reversed ? 'B · 91.5%' : 'A · 96.9%'} · ${cards.find(item => item.dataset.card === 'houses').querySelector('p').textContent}`); } function updateList(announce) { press(listwise, visualRank); const list = listwise.querySelector('ol'); const key = visualRank ? 'stage2' : 'generator'; const sorted = [...lists.candidates].sort((first, second) => second[key] - first[key]); moveCards(list, sorted.map(item => list.querySelector(`[data-card="${item.beam}"]`)), (item, index) => { const position = sorted[index]; item.classList.toggle('probe-picked', index === 0); item.querySelector('code').textContent = `${index + 1} / BEAM #${String(position.beam).padStart(2, '0')}`; item.querySelector('strong').textContent = `${(position[key] * 100).toFixed(1)}%`; }); const action = listwise.querySelector('[data-apply]'); action.textContent = visualRank ? text('Restore generator ranking','恢复生成器排序') : text('Apply visual reranking','应用视觉重排'); listwise.querySelector('.list-score-type').textContent = visualRank ? text('Stage 2 probability','第二阶段选项概率') : text('Generator likelihood share','生成器似然份额'); if (announce) say(text(`Beam #${String(sorted[0].beam).padStart(2, '0')} ranks first.`, `Beam #${String(sorted[0].beam).padStart(2, '0')} 排名第一。`)); } verify.addEventListener('click', event => { const button = event.target.closest('[data-choice]'); if (!button || Boolean(Number(button.dataset.choice)) === conflict) return; conflict = !conflict; updateVerification(true); }); pairwise.addEventListener('click', event => { if (!event.target.closest('[data-reverse]')) return; reversed = !reversed; updatePair(true); }); listwise.addEventListener('click', event => { const choice = event.target.closest('[data-choice]'); const action = event.target.closest('[data-apply]'); if (!choice && !action) return; visualRank = action ? !visualRank : Boolean(Number(choice.dataset.choice)); updateList(true); }); return () => { byId('state-images').innerHTML = evidence(catalog.cases.find(item => item.name === 'test_000033.png')); state.innerHTML = `${heading(text('01 / IMAGE-ONLY DECISION','01 / 仅双图判断'), text('Did the scene physically change?','场景本身发生变化了吗?'))}
    ${text('Changed','有变化')}7.6%
    ${text('Unchanged','无变化')}92.4%
    ${text('Physical change','实质变化')}${text('Appearance-only differences','仅外观差异')}
    ${metric(text('STAGE 1 WARM-START PROBE','第一阶段预热任务'), '90.35%', text('Balanced accuracy · 1,929 pairs','平衡准确率 · 1,929 对影像'))}${protocol(0)}`; evidenceDeck.innerHTML = `
    ${text('VISUAL EVIDENCE','影像证据')}
    ${verifyCases.map(item => `
    ${pair(item)}
    `).join('')}
    `; verify.innerHTML = `${heading(text('02 / FIXED-TEXT IMAGE-SWAP PROBE','02 / 固定描述,替换双图'), text('Same caption. Different evidence.','同一句描述,换一组影像。'))}
    ${text('CAPTION REMAINS FIXED','固定描述')}houses are built along the road and some brushwoods disappear
    ${toggles(text('Image evidence','影像证据'),text('Supporting pair','支持描述的影像'),text('Conflicting pair','与描述冲突的影像'))}
    ${text('VISUAL SUPPORT · P(YES)','影像支持度 · P(YES)')}
    ${metric(text('VERIFICATION ACCURACY','事实核验准确率'), '90.63% → 94.92%', text('Before → after Stage 2 training · 512 queries','第二阶段训练前 → 后 · 512 次查询'))}${protocol(1)}`; updateVerification(false); byId('task-images').innerHTML = evidence(catalog.task_pairs['000109']); pairwise.innerHTML = `${heading(text('03 / ORDER-SWAP PROBE','03 / 交换选项顺序'), text('Same preference, different order.','改变顺序,偏好不变。'))}
      ${card('houses','houses are built in an open space')}${card('unchanged','no change has occurred')}
    ${text('Original order','原顺序')}A · 96.9%
    ${text('Reversed order','交换后')}B · 91.5%

    ${text('Same caption selected in both presentations.','两种顺序下都选中了同一句描述。')}

    ${metric(text('PAIRWISE ACCURACY','成对偏好准确率'), '88.36%', text('3,858 presentations','3,858 次呈现'))}${protocol(2)}`; updatePair(false); if (!lists) return; byId('list-images').innerHTML = evidence(lists); listwise.innerHTML = `${heading(text('04 / LISTWISE CANDIDATE SELECTION','04 / 列表选句'), text('From likelihood to visual evidence.','从生成似然到影像证据。'))} ${toggles(text('Ranking order','排序方式'),text('Generator ranking','生成器排序'),text('Stage 2 ranking','第二阶段排序'))}

      ${lists.candidates.map(item => card(item.beam, item.caption)).join('')}

    test_001639 · ${text('3 of 15 candidates shown · Stage 2 probabilities before length calibration.','展示 15 条中的 3 条 · 第二阶段概率未加句长校准。')}

    ${protocol(3)}`; updateList(false); }; }