已知函数 $f(x)=\left\{\begin{array}{l}\sin \left[2 \pi\left(x-a+\frac{1}{3}\right)\right], x < a, \\ x^2-2(a+1) x+a^2+3, x \geqslant a,\end{array}\right.$ 若 $f(x)$ 在 $(0,+\infty)$ 上恰好有 5 个零点, 则 $a$ 的取值 范围是
$\text{A.}$ $\left[\frac{4}{3}, \frac{11}{6}\right)$
$\text{B.}$ $\left(\frac{4}{3}, \frac{11}{6}\right] \cup\left(\frac{7}{3}, \frac{17}{6}\right]$
$\text{C.}$ $\left[\frac{11}{6}, \frac{7}{3}\right)$
$\text{D.}$ $\left(\frac{4}{3}, \frac{3}{2}\right] \cup\left(\frac{11}{6}, \frac{7}{3}\right]$