Hopf bifurcation of a delayed worm model with two latent periods