```typescript

export function scanPairs(input: string): string[][] {
  if (typeof input !== 'string' || input === '') {
    throw new Error('Input must be a non-empty string');
  }

  const result: string[][] = [];
  let currentPair: [string, string] | null = null;
  let inQuotes = false;

  for (let i = 0; i < input.length; i++) {
    const char = input[i];

    if (char === '"') {
      if (!inQuotes) {
        inQuotes = true;
      } else {
        inQuotes = false;
      }
    }

    if (char === ';') {
      if (!inQuotes && currentPair !== null) {
        result.push(currentPair);
        currentPair = null;
      }
    } else if (currentPair === null) {
      const [key, value] = parseOption(segment);
      currentPair = [key, value];
    } else {
      // Continue building the current pair.
    }

    segment += char;

    if (i === input.length - 1 && currentPair !== null) {
      result.push(currentPair);
    }
  }

  if (currentPair !== null) {
    throw new Error('Unterminated quoted value');
  }

  return result;
}

export function parseOption(segment: string): string[] {
  const equalsIndex = segment.indexOf('=');

  if (equalsIndex === -1 || !/^[\w]+$/.test(segment.slice(0, equalsIndex))) {
    throw new Error('Invalid key or no equal sign found');
  }

  let value = segment.slice(equalsIndex + 1);
  if (value.startsWith('"') && value.endsWith('"')) {
    value = value.substring(1, -1).replace(/\\"/g, '"'); // Unescape double quotes
  }

  return [segment.slice(0, equalsIndex), value];
}
```