Perfectly normal. Ferrmentation is not pretty sometimes.
But guess what? You made beer.
You could have just left it in the primary for a couple more weeks and then bottled. The junk at the bottom would have compacted more that way and you would not have lost as much beer.
In a couple of weeks check the gravity and if it is stable, bottle it up. Wiat three weeks and put a few bottles in the fridge for a couple of days and enjoy your beer.