Just wanted to send you my support. I know that sadness, darkness and loneliness.
One thing that has been helpful for me is to understand that when I start sinking into that pit where all feels lost, it is because I'm re-experiencing some trauma from abandonment or rejection. In other words, it's inside my head. In reality, I'm going to be just fine no matter what happens. Others can see it but I can't, because I'm wearing my lenses that determine how I perceive things about my life.
I might be sad for awhile as I grieve and face being alone, but I will be okay in the end.
The choices that people make are about themselves. Your W is doing what she is doing because it feels right to her in the circumstances, not because of your value or worth (to her or to anyone.) Just as you see things through your filter, she sees them through her filter. And neither one of you determine one another's intrinsic worth.
Hang in there and don't let yourself sink. I find repeating "I'm going to be okay" and "this isn't about me" to be the best way to stop it when I feel the all consuming darkness rising up.
You told me that all is not necessarily lost, even when it feels hopeless. Try to remember that advice for yourself, too.