```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 = "";

  for (const chunk of chunks) {
    pending += chunk;
  }

  let frameStart = -1;
  let frameEnd = -1;

  for (let i = 0; i < pending.length; i++) {
    if (pending[i] === marker) {
      if (frameStart !== -1 && pending[i + 1] === marker) {
        // Double marker, end the current frame
        frames.push(pending.substring(frameStart, i));
        frameStart = -1;
      } else if (frameStart === -1) {
        // Single marker, start a new frame
        frameStart = i;
      }
    } else if (frameStart !== -1 && pending[i] !== marker) {
      // End of the current frame
      frameEnd = i;
      frames.push(pending.substring(frameStart, frameEnd));
      frameStart = -1;
    }
  }

  // If there's a frame that hasn't ended yet, add it to the list
  if (frameStart !== -1) {
    frames.push(pending.substring(frameStart));
  }

  return { frames, pending: "" };
}
```