At the time of independence, Dir was a state ruled by