سلام
دستورات شما مطابق زیر تغییر میکنند:
\documentclass{book}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{arrows,calc,positioning,shadows.blur,arrows.meta}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{fadings,shapes.arrows}
\usepackage{titletoc}
\usepackage{etoolbox}
\usepackage[fontsize={14,24}]{xepersian}
\settextfont{IRXLotus}
\definecolor{titlecolor}{RGB}{13,151,225}
\definecolor{headcolor2}{RGB}{212,237,252}
\definecolor{headcolor}{RGB}{0,177,235}
\makeatletter
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{10mm}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode
\advance\leftskip\@tempdima
\hskip -\leftskip
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bfseries#1\nobreak\hfill\nobreak\hb@xt@\@pnumwidth{\hss#2}
\begin{tikzpicture}[remember picture, overlay]%
\tikzset{ ashadow/.style={opacity=.725, shadow xshift=-0.1, shadow yshift=-0.1},}
%\begin{scope}
\draw [drop shadow={ashadow, color=gray}](0,.5)--(11.8,.5) [rounded corners=1]arc (90:270:.3 and .4) [rounded corners=2]-- (0,-.3)[rounded corners=2] arc (270:90:.4 and .4);%
\draw[color=white, left color=headcolor, right color=headcolor2](0,.5)--(11.8,.5) [rounded corners=1]arc (90:270:.3 and .4) [rounded corners=2]-- (0,-.3)[rounded corners=2] arc (270:90:.4 and .4);%
\fill [drop shadow={ashadow, color=gray}](12,.1) circle [radius=.4];
\fill[shade,inner color=titlecolor!20,outer color=headcolor2,draw=headcolor2] (12,.1) circle [radius=.4];
\%end{scope}
\end{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\par\medskip
\penalty\@highpenalty
\endgroup
\fi
}
\renewcommand*\l@section{\@dottedtocline{1}{4mm}{8mm}}
\makeatother
\begin{document}
\tableofcontents
\chapter{گروه}
\section{حلقه}
\section{ایدال}
\chapter{این هم فصلی دیگر}
\section{داخلی}
\section{خارجی}
\chapter{ عنوان این فصل کمی طولانی است.
عنوان این فصل کمی طولانی است.}
\end{document}
خروجی شما با نسخههای اولیهی تکلایو 2018 مطابق زیر است:
ویرایش دوم در راستای درخواست شما در قسمت نظرات:
کد را به صورت زیر تغییر دهید:
\makeatletter
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{8mm}%
\begingroup
\parindent\z@\rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode
\advance\leftskip\@tempdima
\hskip-\leftskip
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bfseries#1\nobreak\hfill\nobreak\hb@xt@\@pnumwidth{\hss#2}
\begin{tikzpicture}[remember picture, overlay]%
\tikzset{ ashadow/.style={opacity=.725, shadow xshift=-0.1, shadow yshift=-0.1},}
%\begin{scope}
\draw [drop shadow={ashadow, color=gray}](0,.5)--(11.8,.5) [rounded corners=1]arc (90:270:.3 and .4) [rounded corners=2]-- (0,-.3)[rounded corners=2] arc (270:90:.4 and .4);%
\draw[color=white, left color=headcolor, right color=headcolor2](0,.5)--(11.8,.5) [rounded corners=1]arc (90:270:.3 and .4) [rounded corners=2]-- (0,-.3)[rounded corners=2] arc (270:90:.4 and .4);%
\fill [drop shadow={ashadow, color=gray}](12,.1) circle [radius=.4];
\fill[shade,inner color=titlecolor!20,outer color=headcolor2,draw=headcolor2] (12,.1) circle [radius=.4];
\%end{scope}
\end{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\par\medskip
\penalty\@highpenalty
\endgroup
\fi
}
\makeatother
با این خروجی:
موفق باشید.