A photoswitchable macrocycle controls anion-templated pseudorotaxane formation and axle relocalization