```ts
/**
 * Tokenizes a string by splitting on runs of spaces and tabs,
 * respecting quoted sections (") and escape sequences (\).
 */
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 (unless we're in quotes)
        if (currentToken !== "") {
          tokens.push(currentToken);
          currentToken = "";
        }
        // Skip all consecutive separators
        while (i < input.length && (input[i] === " " || input[i] === "\t")) {
          i++;
        }
        continue;
      } else {
        // Inside quotes: spaces and tabs are literal
        currentToken += char;
        i++;
        continue;
      }
    }

    // Any other character: add to current token
    currentToken += char;
    i++;
  }

  // If we end while still in quotes, it's an error
  if (inQuotes) {
    throw new Error("Unterminated quote");
  }

  // Add the last token if any
  if (currentToken !== "") {
    tokens.push(currentToken);
  }

  return tokens;
}
```