function resolveBlockDir(
  str: string,
  fallback: ?BidiDirection,
): BidiDirection {
  fallback = fallback || UnicodeBidiDirection.NEUTRAL;
  if (!str.length) {
    return fallback;
  }
  const blockDir = firstStrongCharDir(str);
  return (blockDir === UnicodeBidiDirection.NEUTRAL) ? fallback : blockDir;
}
Returns the direction of a block of text, based on the direction of its
first strong character (has Bidi_Class value of L, R, or AL), or a fallback
direction, if no strong character is found.

This function is supposed to be used in respect to Higher-Level Protocol
rule HL1. (http://www.unicode.org/reports/tr9/#HL1)

@param str       A text block; e.g. paragraph, table cell, tag
@param fallback  Fallback direction, used if no strong direction detected
                 for the block (default = NEUTRAL)
@return          The resolved direction