Mechanisms of the transition metal-mediated hydroarylation of alkynes and allenes