2. Given the ellipse $C: \frac{x^{2}}{a^{2}}+\frac{y^{2}}{b^{2}}=1(a>b>0)$ with left and right foci $F_{1}$ and $F_{2}$, respectively, and $P$ as any point on the ellipse $C$, $M=|| P F_{1}|-| P F_{2}||+\left|P F_{1}\right| \cdot\left|P F_{2}\right|$. Then the maximum value of $M$ is $\qquad$
2. $M=\left\{\begin{array}{ll}a^{2}+1, & c \geqslant 1 ; \\ 2 c+b^{2}, & 0<c<1 .\end{array}\right.$

Let $P(x, y)$, then
$$
\begin{array}{l}
\left|P F_{1}\right|=a+e x,\left|P F_{2}\right|=a-e x . \\
\text { Hence } M=2 e|x|+a^{2}-e^{2} x^{2} \\
=a^{2}+1-(e|x|-1)^{2} \\
=a^{2}+1-e^{2}\left(|x|-\frac{1}{e}\right)^{2} .
\end{array}
$$

When $c \geqslant 1$, $|x|=\frac{1}{e}=\frac{a}{c}, M_{\text {max }}=a^{2}+1$;
When $0<c<1$, $|x|=a, M_{\text {max }}=2 c+b^{2}$.