* Utility function for producing reorderings given a list of levels
* Produces a map saying which visual index maps to which source index.
* The levels array must not have values greater than 126 (this is the Bidi maximum explicit depth plus one). Failure to follow this invariant may lead to incorrect results, but is still safe.