// If any check fails, print a detailed warning to the console and skip.
console.warn(
`[Visualizer Warning] Malformed track object found at frame ${appState.currentFrame+1}. The 'historyLog' property is missing or not an array. Skipping this track.`,
{problematicTrack:track}// This logs the entire object for inspection.
);
continue;// Safely skip to the next track in the loop.
}
// --- END: Enhanced Safeguard and Detailed Logging ---
// Filter history logs to include only frames up to the current one.