/* botd-collect.mjs — run BotD automation detection, put the verdict into a hidden field.
   ES module (BotD ships ESM only). Telemetry ping to openfpcdn was patched out; CSP also
   blocks any external connection. Client-side signal only; the server treats it as a hint. */
import { load } from '/registration/assets/botd.esm.js';

(async function () {
  try {
    const botd = await load();
    const result = await botd.detect();
    // result = { bot: boolean, botKind?: string }
    const f = document.getElementById('botd-field');
    if (f) f.value = result && result.bot ? ('bot:' + (result.botKind || 'unknown')) : 'human';
  } catch (e) {
    // best-effort; absence of a verdict is itself handled server-side (slightly higher risk)
  }
})();
