Collapse repeated spaces, trim line edges, and tidy pasted text in one pass.
This trims each line, collapses runs of spaces and tabs into a single space, and squeezes three or more blank lines down to one — the standard cleanup for text pasted out of PDFs, emails and web pages.
Does it change single spaces between words? No — normal single spacing is untouched. Only runs of 2+ spaces/tabs change.
What about paragraph breaks? One blank line between paragraphs is preserved; larger gaps shrink to one blank line.