In May (was it only last month?), Donald Trump’s Republican competitors left the presidential primary race. GOP officials scrambled to endorse him. There was talk big donors were coming on board. Many conscientious conservatives were in a funk, disillusioned with a party (albeit only a plurality of primary voters) who could select a charlatan and a bigot. Lifelong Republicans were appalled at the elected leaders willing to carry water for a demagogue. There was widespread anxiety Trump would beat expectations in the general election just as he did in the primaries.

Six weeks later, it is a much brighter picture for #NeverTrump Republicans and the country at large. The media is critically examining his record, challenging his bigotry and inane pronouncements. When he suggested the president might be in league with Islamist terrorists, the media pounced. Trump’s temper tantrum in barring The Post from his campaign events underscored his frustration with a new level of scrutiny.

A short but impressive list of Republicans have declined to endorse or have un-endorsed Trump. Trump is “threatening” (huh!?) to fund his own campaign because donors have not come on board. A delegate rebellion, once a pipe dream, is now a reality. You know it is worrying to Trump if he simultaneously claims it is a Jeb Bush plot and a media hoax. Meanwhile, his own “campaign” is a joke — a skeleton of a presidential operation lacking the staff and data needed to win a national election (as opposed to a series of small primaries where true believers could carry the day).

Moreover, it turns out the vast majority of Americans do not take kindly to a racist, do not appreciate his proposal for a Muslim ban and do not approve of his response to the Orlando terrorist attack. In the primaries, “gaffes” seemed only to enhance his standing. The dumber his debate answers, the higher he went in the polls. Now, however, his outlandish comments are driving his poll numbers down. Maybe most Americans have not lost their minds, turned to political nihilism and rejected the American spirit of inclusion and fairness. It turns out what worked in the primaries doesn’t work in a general election context.

It is increasingly likely that either Trump will get dumped or he will lose by as healthy margin to Hillary Clinton. The Republic, it seems, may escape a brush with authoritarian buffoonery. (All caveats apply about Clinton’s FBI investigation, a severe economic downturn and other developments that could upend the race.)

That does, however, raise the troubling question: Why couldn’t the GOP have figured all this out before Trump got to 1,237 delegates? Right-wingers will smell a plot. (The MSM held back until he had the nomination!) But there were a number of factors in the primary — a huge field (dividing the not-Trump vote and shielding him in debates), a press entranced with his media show, the novelty of his “act,” and the collapse of his opponents at critical times (e.g., Sen. Marco Rubio’s pre-New Hampshire primary debate) — that aided Trump.

Still, there is something fundamentally amiss on the right that in a mere six weeks the country has figured out Trump, whereas Republicans in nine months plainly could not see the character they were embracing. That should highlight some troubling deficiencies on the right.

First, the anti-immigration obsession that had transfixed the right-wing inured many supposed gate-keepers (e.g., magazines, pundits) as well as the base to a candidate peddling a dangerous brew of nativism, protectionism and isolationism. If the “respectable” publications rant and rave about “amnesty,” one can imagine why Trump’s idea for a wall might have gotten traction rather than guffaws. It’s no coincidence Trump’s closest ally is Sen. Jeff Sessions (R-Ala.), an anti-immigration zealot who found Trump the perfect spokesman for his cause. Thankfully, the general electorate, including Republicans who did not vote in the primary, take a dim view of his xenophobia. They oppose mass deportation and a Muslim ban.

Second, over the past seven years, the anti-government tirades from talk radio, from Beltway groups such as Heritage Action and even from Sen. Ted Cruz (R-Tex.) saturated the base, convincing them that everyone with experience “betrayed them” and only outsiders devoid of exposure to governance had the secret sauce for peace and prosperity. In the general election, by contrast, Clinton has skewered Trump’s inane ideas and ridiculed his ignorance in ways the GOP field did not do consistently and zealously from the get-go.

Third, the “establishment” — the officialdom of the Republican National Committee — facilitated Trump’s rise, convinced he’d run as an independent (did they not realize how cheap he is?). Refusing to condemn him, declining to press him on releasing his tax returns, maintaining an excessively large debate contingent and actively condoning his candidacy all enabled Trump to achieve a degree of legitimacy he otherwise would never have gotten. A soulless party chairman who lacked fidelity to the ideals of the party unwittingly may have handed the election to Clinton and decimated the party itself.

One, therefore, is left with an unpleasant reality: A plurality of GOP voters wanted Trump. They did not care or may have actively embraced his lunacy, bigotry and ignorance. His rotten character and abject honesty elicited shrugs. They wore his “pants on fire” fact checks like badges of honor. A significant segment of the GOP primary electorate itself lacked common sense, standards of decency, and intolerance of bigotry and cruelty. No group was worse than the evangelical “leaders” who cheered him along the way.

A Republican wag joked that the GOP needs not only a new candidate but also a new base. There is something to that. In the 2016 postmortem, it will be worth examining the extent to which the GOP has promoted crackpots, become ghettoized in distorted right-wing media and lost track of what 21st-century America believes and looks like. That suggests conservative “leaders” need to do more leading, and less following, and the party as a whole has to expand its vision and its base. It’s time to stop reveling in ignorance and celebrating lost causes.

Barry Goldwater’s widow was recently quoted as saying, “Barry would be appalled by Mr. Trump’s behavior — the unintelligent and unfiltered and crude communications style. And he’s shallow — so, so shallow.” She continued, “Barry was so true to his convictions and would never be issuing these shallow, crude, accusatory criticisms of the other party or the other person.” She’s right, of course. And yet the GOP primary electorate did not see all that. It’s a problem when the rest of the country has to rescue the GOP and the country from Republican voters’ terrible judgment.

10 celebrities who say they’ll leave the U.S. if Donald Trump is elected president

WASHINGTON, DC - SEPTEMBER 16: Comedian Jon Stewart (C) joins Feel Good Foundation founder John Feel (L) to demand that Congress extend the Zadroga 9/11 health bill at the U.S. Capitol September 17, 2015 in Washington, DC. The former Daily Show host joined ailing police and firefighters in lobbying Congress for a permanent extension of the Zadroga Act's $1.6 billion health and monitoring effort for the 72,000 emergency responders who worked at Ground Zero. (Chip Somodevilla/Getty Images)