Theoretical study of the regioselective cyclization of enaminones in the construction of benzofurans and indoles