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

  let joinedText = chunks.join("");
  const frames: string[] = [];
  let pending = "";

  for (let i = 0; i < joinedText.length; i++) {
    const currentChar = joinedText[i];
    const nextChar = joinedText[i + 1];

    if (currentChar === marker) {
      if (nextChar !== marker || frames.length > 0) {
        pending += currentChar;
      } else {
        // Found a doubled pair, end the last frame
        frames.push(pending);
        pending = "";
        i++; // Skip the next character as it's part of the frame
      }
    } else if (frames.length === 0 && currentChar !== marker) {
      pending += currentChar;
    } else {
      frames.push(pending + currentChar);
      pending = "";
    }
  }

  return { frames, pending };
}
```