```ts
/**
 * Tokenizes a string by splitting on runs of spaces and tabs,
 * respecting quoted sections (double quotes) and escape sequences (backslash).
 */
export function tokenize(input: string): string[] {
  if (input === '') {
    return [];
  }

  const tokens: string[] = [];
  let currentToken = '';
  let inQuotes = false;
  let i = 0;

  while (i < input.length) {
    const char = input[i];

    if (char === '\\') {
      // Escape sequence: take the next character literally, if any
      if (i + 1 >= input.length) {
        throw new Error('Trailing backslash');
      }
      currentToken += input[i + 1];
      i += 2;
      continue;
    }

    if (char === '"') {
      // Toggle quoted mode
      inQuotes = !inQuotes;
      i++;
      continue;
    }

    if (char === ' ' || char === '\t') {
      if (!inQuotes) {
        // End of token if not in quotes
        if (currentToken !== '') {
          tokens.push(currentToken);
          currentToken = '';
        }
        i++;
        // Skip all consecutive separators
        while (i < input.length && (input[i] === ' ' || input[i] === '\t')) {
          i++;
        }
        continue;
      } else {
        // Inside quotes: space/tab is part of the token
        currentToken += char;
        i++;
        continue;
      }
    }

    // Regular character
    currentToken += char;
    i++;
  }

  if (inQuotes) {
    throw new Error('Unterminated quote');
  }

  // Add final token if any
  if (currentToken !== '') {
    tokens.push(currentToken);
  }

  return tokens;
}
```