Direct superconducting pairing versus Jahn–Teller distortions; an analysis of a competition