Step 1: Simplify the denominator.
Given integral:
\[
I=\int \frac{1}{\left(\sin x+\cos x+\sqrt{2\sin 2x}\right)^2}\,dx
\]
Since
\[
\sin 2x=2\sin x\cos x,
\]
we get
\[
2\sin 2x=4\sin x\cos x
\]
Therefore,
\[
\sqrt{2\sin 2x}=2\sqrt{\sin x\cos x}
\]
So,
\[
\sin x+\cos x+\sqrt{2\sin 2x}
=
\sin x+\cos x+2\sqrt{\sin x\cos x}
\]
\[
=
(\sqrt{\sin x}+\sqrt{\cos x})^2
\]
Hence,
\[
\left(\sin x+\cos x+\sqrt{2\sin 2x}\right)^2
=
(\sqrt{\sin x}+\sqrt{\cos x})^4
\]
Step 2: Put \(t=\sqrt{\tan x}\).
Let
\[
t=\sqrt{\tan x}
\]
Then,
\[
\tan x=t^2
\]
Also,
\[
\sin x=\frac{t^2}{\sqrt{1+t^4}},
\quad
\cos x=\frac{1}{\sqrt{1+t^4}}
\]
So,
\[
\sqrt{\sin x}=\frac{t}{(1+t^4)^{1/4}}
\]
and
\[
\sqrt{\cos x}=\frac{1}{(1+t^4)^{1/4}}
\]
Thus,
\[
(\sqrt{\sin x}+\sqrt{\cos x})^4
=
\left(\frac{t+1}{(1+t^4)^{1/4}}\right)^4
\]
\[
=
\frac{(1+t)^4}{1+t^4}
\]
Step 3: Transform \(dx\).
Since
\[
\tan x=t^2,
\]
differentiate:
\[
\sec^2x\,dx=2t\,dt
\]
But
\[
\sec^2x=1+\tan^2x=1+t^4
\]
Hence,
\[
dx=\frac{2t}{1+t^4}\,dt
\]
Step 4: Substitute in the integral.
\[
I=\int \frac{1}{\frac{(1+t)^4}{1+t^4}}\cdot \frac{2t}{1+t^4}\,dt
\]
\[
I=\int \frac{1+t^4}{(1+t)^4}\cdot \frac{2t}{1+t^4}\,dt
\]
\[
I=\int \frac{2t}{(1+t)^4}\,dt
\]
Step 5: Integrate.
Let
\[
u=1+t
\]
Then,
\[
t=u-1
\]
and
\[
dt=du
\]
So,
\[
I=\int \frac{2(u-1)}{u^4}\,du
\]
\[
I=\int \left(\frac{2}{u^3}-\frac{2}{u^4}\right)\,du
\]
\[
I=2\int u^{-3}\,du-2\int u^{-4}\,du
\]
\[
I=2\left(\frac{u^{-2}}{-2}\right)-2\left(\frac{u^{-3}}{-3}\right)
\]
\[
I=-\frac{1}{u^2}+\frac{2}{3u^3}
\]
\[
I=\frac{-3u+2}{3u^3}
\]
\[
I=-\frac{3u-2}{3u^3}
\]
Since
\[
u=1+t,
\]
we get
\[
I=-\frac{3(1+t)-2}{3(1+t)^3}
\]
\[
I=-\frac{1+3t}{3(1+t)^3}
\]
Now substituting
\[
t=\sqrt{\tan x},
\]
we get
\[
I=-\frac{1+3\sqrt{\tan x}}{3(1+\sqrt{\tan x})^3}+C
\]
Step 6: Final conclusion.
Therefore,
\[
\boxed{-\frac{1+3\sqrt{\tan x}}{3(1+\sqrt{\tan x})^3}+C}
\]