I'm not competent to comment with regard to the question of involuntary commitment either in general or where you live. So I'll defer with regard to that. You might consider contacting your local NAMI office & see what guidance they might be able to provide. Here's a link to the NAMI website where you can search for your local office:
Home | NAMI: National Alliance on Mental Illness
Of course the greater question here, perhaps, is... if you're experiencing intense thoughts of hurting yourself or others, what are you doing about that? These kinds of thoughts require attention, in my opinion. And even if you feel you have them under control, they're still distressing to live with. And they can lead to unexpected consequences.
I've made 2 major attempts on my life (& been involuntarily committed as a result.) And in both cases if you had asked me the day before if I was in danger, I'd have said no. But in each case, I got up in the morning, decided I'd had it & I was going to do something about it... & so I did.

I think it's important to share what you are going though with someone... throw open the doors & windows & let the light shine in. Keeping all of this bottled up inside is a prescription for ongoing desperation & anxiety, from my perspective. So I hope that, in some way, you can find a way to reach out in real life for the help you need.

My best wishes to you...