Mn-doped WSe2 as an efficient electrocatalyst for hydrogen production and as anode material for lithium-ion batteries