SLU5MPRESWCNLCXQO5TBKWDU6DS4EMUUFR3HDKYZQ4XURO5VPBPQC
}
// Split a log after `fight`.
function split_log(x: Log, fight: number): [Log, Log] {
const split_fight = x.fights.find(f => f.id === fight)!;
return [
{ ...x, fights: x.fights.filter(f => f.id <= fight) },
{ ...x, fights: x.fights.filter(f => f.id > fight), startTime: new Date(x.startTime.valueOf() + split_fight.startTime) }
];
res.push(merge_logs(prev, log));
} else {
res.push(log);
res_log = merge_logs(prev, log);
}
const splits = split_points(res_log);
if(splits.length > 0) {
for(const split of splits) {
const [a, b] = split_log(res_log, split);
res.push(a);
res_log = b;
}