Ibuprofen and pain pills 2nd trimester

A

This last weekend I ended up having an emergency surgery at 22 wks pregnant to remove my left ovary and a very large cyst. Baby is doing ok but I can’t help but worry about all the pain medicine I was on before and after surgery & how it may have affected my baby. Has anyone ever had surgery while pregnant or had a similar experience that can give me a little peace of mind? I’m trying not to worry but y’all know how it goes.