Historically, what did “well regulated militia” actually mean?

Basically the title. The actual written language of the 2nd Amendment is, “A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed." That reads like a run-on sentence to me, so I’m not sure how to interpret it.

From a historical standpoint, did the Founding Fathers actually intend for every American to have a gun, even in times of peace? (I’m not asking about AR-15s specifically; they didn’t exist at the time, so we couldn’t possibly know if the Founding Fathers would’ve supported them or not.) What I’m asking is, the NRA interpretation of 2A is “every American should have a gun, during times of war and peace, and there should be zero gov’t restrictions on ANYONE’s ability to acquire one.” Is this actually what 2A says? Or does 2A, as the Founding Fathers wrote it, allow for SOME restrictions (for example, a psych evaluation or something) before someone could purchase a gun?

TIA.