```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 pending = '';
  let inFrame = false;

  for (const chunk of chunks) {
    for (let i = 0; i < chunk.length; i++) {
      if (chunk[i] === marker) {
        if (i + 1 < chunk.length && chunk[i + 1] === marker) {
          // Double marker found, add literal marker to current frame
          if (inFrame) {
            frames[frames.length - 1] += marker;
          } else {
            pending += marker;
          }
          i++; // Skip the next character as it's part of the double marker
        } else {
          // Single marker found, end current frame and start a new one
          if (inFrame) {
            frames.push(pending);
            pending = '';
          }
          inFrame = !inFrame;
        }
      } else {
        if (inFrame) {
          frames[frames.length - 1] += chunk[i];
        } else {
          pending += chunk[i];
        }
      }
    }
  }

  // If the last character was a marker, it might be part of a double marker
  if (pending.endsWith(marker)) {
    pending = pending.slice(0, -1);
  }

  return { frames, pending };
}
```