Semi-infinite flags. II: Local and global intersection cohomology of quasimaps spaces Algebraic groups. Volume I: Algebraic geometry. Generalities. Commutative groups. With an appendix `Local class fields' by Michiel Hazewinkel 