function waitForFilecheck(cb, timeout = 5000) {
const start = Date.now();
const t = setInterval(() => {
if (window.Filecheck) { clearInterval(t); cb(window.Filecheck); }
else if (Date.now() - start > timeout) { clearInterval(t); console.error('Filecheck failed to load'); }
}, 50);
}
waitForFilecheck((Filecheck) => {
const fc = Filecheck('pk_live_…');
const intake = fc.elements.create('intake', { workflowId: 'wf_…' });
intake.on('status', ({ canProceed, jobId }) => { /* … */ });
intake.mount('#fc-slot');
});