if(id in map) return map[id].selected = true; out.push(map[id] = {...item});
if(id in map) map[id].selected = true; else out.push(map[id] = {...item});