```ts
export function drainFrames(chunks: string[], marker: string): { frames: string[]; pending: string } {
  if (marker.length !== 1) {
    throw new Error("Marker must be a single character");
  }

  const frames: string[] = [];
  let frame = "";
  let pending = "";

  for (const chunk of chunks) {
    let i = 0;
    while (i < chunk.length) {
      if (chunk[i] === marker && i + 1 < chunk.length && chunk[i + 1] === marker) {
        // Found a doubled marker, add it to the frame and skip the next character
        frame += marker;
        i += 2;
      } else if (chunk[i] === marker) {
        // Found a lone marker, end the current frame and start a new one
        frames.push(frame);
        frame = "";
        i++;
      } else {
        // Add non-marker character to the current frame
        frame += chunk[i];
        i++;
      }
    }

    // Append any remaining characters as pending text
    pending += frame;
    frame = "";
  }

  // If the last character is a marker, it remains pending
  if (pending.endsWith(marker)) {
    frames.push(pending.slice(0, -1));
    pending = marker;
  } else {
    frames.push(pending);
    pending = "";
  }

  return { frames, pending };
}
```