function getParseMode(value, { mode = 'auto', viewValueStates } = {}) {
  const separatorsRe = /[., ]/g;
  const separators = value.match(separatorsRe) || [];
  // @ts-expect-error [wait-for-platform-types]
  const decimalPlaces = (value.split(separatorsRe) || []).at(-1).length;
  const isCurViewFormattedAndUserIsEditing =
    viewValueStates?.includes('formatted') && mode === 'user-edited';

  // When a user edits an existing value, we already formatted it with a certain locale.
  // For best UX, we stick with this locale. However, we only do this when the user has
  // entered at least 3 decimal places.
  const shouldUseCurLocale = isCurViewFormattedAndUserIsEditing && decimalPlaces > 2;

  const shouldUseLocale =
    shouldUseCurLocale ||
    !separators.length ||
    (mode === 'auto' && separators.length === 1 && decimalPlaces >= 3);
  if (shouldUseLocale) {
    return 'withLocale';
  }

  const shouldUseHeuristic =
    (isCurViewFormattedAndUserIsEditing && decimalPlaces <= 2) ||
    separators.length === 1 ||
    separators[0] !== separators[separators.length - 1];
  if (shouldUseHeuristic) {
    return 'heuristic';
  }

  return 'unparseable';
}
Determines the best possible parsing mode.

It has 3 "methods" of returning numbers
- 'unparseable': becomes just numbers
- 'withLocale': result depends on given or global locale
- 'heuristic': result depends on considering separators

@example
parseNumber('1.234.567'); // method: unparseable => 1234567
parseNumber('1.234'); // method: withLocale => depending on locale 1234 or 1.234
parseNumber('1.234,56'); // method: heuristic => 1234.56
parseNumber('1 234.56'); // method: heuristic => 1234.56
parseNumber('1,234.56'); // method: heuristic => 1234.56

@param {string} value Clean number (only [0-9 ,.]) to be parsed
@param {{mode?:'auto'|'pasted'|'user-edited'; viewValueStates?:string[]}} options
@return {string} unparseable|withLocale|heuristic