The invention provides compounds of formulas (I) or (II), wherein the variables are defined in the specification, or a pharmaceutically-acceptable salt thereof, that are inhibitors of replication of the hepatitis C virus. The invention also provides pharmaceutical compositions comprising such compounds, methods of using such compounds to treat hepatitis C viral infections, and processes and intermediates useful for preparing such compounds.