OP, I'm not going to give advice about the situation as lots more knowledgeable posters have given you excellent opinions already. I just wanted to go back to how you are feeling.
A few months back I found myself in a situation with 12yr old DD. She's autistic so quite vulnerable and very easily led. She's home educated and has been developing artwork of a particular anime style and imo, is quite talented. I agreed to let her use my TikTok account to share her artwork. This was on the very strict proviso that no private chats with anyone, only comments on threads. DD agreed. She was posting her creations and getting lots of likes and attention. I was monitoring it - noticed she'd started putting pronouns and LGBTQ tags on her work, so we had a discussion. My concerns were that she didn't understand was she was referring to, and that it would attract a more adult audience. She'd copied the popular hash tags on other similar anime posts. Plus, this particular anime brand has quite a lot of same sex relationships (which is fine, no issues with her depicting or reading about that).
I never use TikTok so I totally screwed up as I didn't know where the DMs were kept. I also trusted her 100% to keep her word. We're really close so I had no reason to doubt her. Late one night I had her phone - I can't remember why, something trivial - and I noticed a screenshot in the photo gallery. It was a DM. Then I found a couple more screenshots in her photo gallery - I went to TikTok and sure enough she'd been DM'ing someone, but had deleted most of the history. This person was another girl apparently 9 yrs old- but very, very clearly not 9 yrs old. Thankfully no graphic photos or conversation but my DD referred to this person as her "girlfriend" and they were having conversations about meeting up!!! When I looked further, it seems as if this other person had pursued her - had changed their profile picture to "I love DD" etc. Lots of tagging her in videos of romantic gestures and "I'm going to do this for you when we meet DD" etc.
I felt honestly like I was going to throw up. I thought that my DD would have ALWAYS told me, we're really close. I was absolutely gutted that she didn't talk to me about it. I'm very laid back and if she'd said she wanted to talk to someone, or that she'd been talking to someone, I wouldn't have gone bat shit, we'd have had a conversation. And she knows this. It's the deceit and lying that I was the most gutted about. I felt for a few weeks that maybe our relationship wasn't what I thought it was. I felt really really sad.
It did feel like grooming. I have no idea if this other individual is an adult or just a teen. But they're certainly not 9 yrs old!! I have had so many conversations with DD about grooming and other people sending inappropriate DMs, and we'd talked about people not always being who they claimed to be. She's always told me before if someone weird has messaged her through Roblox etc, so I was so certain that she wouldn't do something like this.
Also, I know I'm to blame for trusting her with TikTok. I was very divided about whether to allow her to use my account, but I thought just sharing artwork via my account was harmless. And it did really encourage her to develop her skills and confidence - but I can't trust her now. TikTok is blocked on our router, all passwords to my account changed and I've put a ton of extra security on her phone/iPad because she's lost my trust. We had no raised voices at any time, we've talked about this calmly and she accepts the consequences. I've told her that I feel really sad about taking away something she's been enjoying but I can't trust her right now, so I don't have any choice. It's not a "punishment" but a consequence of her actions.
My DD did apologise and give me a hug. She says she doesn't know why she didn't talk to me. In one of the DMs she says she isn't ready to tell her mum that she's gay. I said to her, why do you think I'd be bothered by that??? (For context, I have a few very close gay male friends and she absolutely knows that I have zero issues around people being straight/gay etc). I said that I felt sad that she felt that she couldn't talk to me, and that I never wanted her to ever feel like that. And that I love her unconditionally and there's nothing wrong with liking boys, girls, both or neither. There's no "wrong".
With a bit of time that's passed, I think it was just about DD trying to develop her identity and was less about not being able to talk to me, and more just about trying to figure herself out. Also, adult themes are excruciating for youngsters to talk about, especially when it's about them personally. My DD always has and does tell me everything about other stuff - I think she just didn't know how to bring this subject up.
The reason, OP for this very very long post is just to say I know the circumstances are very different, but I went through very similar emotions to you. Lots of private tears. I kept conversations with my DD very matter of fact, calm, and loving.
My DD sometimes struggles to raise subjects, so we have WhatsApp now. If she wants to tell me something that's difficult face to face, she messages me. That's helped a lot. I know that's different for you OP as you've removed her phone but if DD doesn't want to talk directly to you, could you have a worry box or something where she can write down things that she wants you to know but finds difficult to say?
I hope you're OK. I know how awful this feels and all I can say is that you will get over this, and it's not a reflection on your relationship with her. You handled it really well by staying calm, and that's brilliant. Whatever route you opt to take, you will get past this - it's just the shock right now. And DD will have learnt that she needs to come and talk to you, even if it's a difficult conversation. That's the message I'd be trying to reinforce to her, and figuring out how she can do that should a similar thing ever happen in the future (even if it's years down the line).