  Topological phases of light exhibit unique properties beyond the realm of
conventional photonics. In particular the valley-Hall topological insulator has
been realized in a variety of photonic structures because it can be easily
induced by breaking certain lattice symmetries. However, the valley-Chern
numbers are usually fixed by design and the corresponding topological edge
states are forced to propagate in a fixed direction. Here, we propose a
mechanism to induce topological transitions via accidental Dirac points in
metasurfaces composed of interacting dipole emitters/antennas. For a fixed
arrangement of dipoles, we show that the topological phase depends critically
on the surrounding electromagnetic environment which mediates the dipole-dipole
interactions. To access different topological phases we embed the metasurface
inside a cavity waveguide where one can tune the dominant dipolar coupling from
short-range Coulomb interactions to long-range photon-mediated interactions by
reducing the cavity width; this results in a topological transition
characterized by an inversion of the valley-Chern numbers. Consequently, we
show that one can switch the chirality of the topological edge states by
modifying only the electromagnetic environment in which the dipoles are
embedded. This mechanism could have important implications for other
topological phases such as photonic higher-order topological insulators.
