A unified theory for bubble dynamics