use bytewise for keys

I think I got it right this time. The important part is generating the right min/max keys for ranges: bytewise encodes so that `null` is always sorted first, and `undefined` is always sorted last, so if `true` is our wildcard value, we just have to replace it with the appropriate value to create the min/max range keys.

Other than that it's just a matter of encoding/decoding the array, with the length prepended/removed to keep grouping levels grouped :)