Usually non-government organisations get to decide who their members are. For example, I can't become president of the local bowling club by getting a lot of my friends to register "bowling" and vote me in despite the wishes of the paying members.
Instead, to become a member of the bowling club, I have to apply to become a member, of which I can be rejected, for pretty much any reason at all aside from a few limited reasons listed in anti-discrimination law. For example, being a recent outspoken member of a rival bowling club would be a reason to reject.
This is freedom of association. People can voluntarily form groups consisting of members they mutually accept. It's the basis of the right to form political parties in almost every liberal democracy.
Except the United States, it seems.
In Australia, when applying for political party membership there are particular exclusions, such as running against an endorsed candidate of that party in the past. Even being a member of another party within the past gets questions asked. People can and have been kicked out of parties just for saying rude things on social media. Also, if accepted, an annual membership fee, determined by the party, must be paid.
This is free association. It's 1st amendment stuff. But it seems like political parties in the U.S. don't have 1st amendment rights. For the Democrats, you've got Bernie Sanders running, who runs against Democrats as a socialist. And with the Republicans, you've got Trump, who has been a Democrat for most of this century.
If the U.S. government(s) determine who can be members of political parties, not the parties as private organisations themselves, surely this is a gross violation of not only the first amendment but democracy itself.
Perhaps someone from the U.S. can explain this, as on the face of it the U.S. governments meddling with political parties seems more like its China than the place with a Bill of Rights.