Theory of edge plasma in a spheromak