Just as it had been for the previous three thousand years.
that was outwitted, outgunned and outmaneuvered by a dynamic, capitalist, free, tiny little island on the other side of the globe.
Out gunned, yes, but certainly not outwitted. They knew very well that the British were importing poison and they did everything they could to stop it. They just didn't have the firepower to succeed.
This was a case of the drug dealers possessing more firepower than the government they were destroying.
China eventually started growing domestic Opium in an attempt to crash the market and deprive the British of profitability. That strategy actually helped push the British out of the drug trade. The British eventually decided the embarrassment of being drug dealers wasn't sufficiently made up by their profits from the drug trade, though the Chinese allege that the British kept the trade going until World War II.
And resulting loss of public legitimacy is as plausible an explanation for the end of the regime as the effects of opium use.