%%
%% This is file `scrbook-xetex-bidi.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bidi.dtx  (with options: `table,scrbook-xetex-bidi.def')
%% 
%%   __________________________________________________
%%   Vafa Khalighi
%% 
%%   Copyright (c) 2007--2025  Vafa Khalighi
%%   Copyright (c) 2018--2020 bidi-tex GitHub Organization
%% 
%%   It may be distributed and/or modified under the LaTeX Project Public License,
%%   version 1.3c or higher (your choice). The latest version of
%%   this license is at: http://www.latex-project.org/lppl.txt
%% 
%%   This work is “author-maintained” (as per LPPL maintenance status)
%%   by Vafa Khalighi.
%% 
%% 
%% \CheckSum{54357}
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\ProvidesFile{scrbook-xetex-bidi.def}[2025/09/30 v1.5 bidi adaptations for scrbook class for XeTeX engine]
\newcommand{\scr@saved@LTRfootnotetext}{}
\newcommand{\scr@saved@RTLfootnotetext}{}
\let\scr@saved@footnotetext\@footnotetext
\let\scr@saved@LTRfootnotetext\@LTRfootnotetext
\let\scr@saved@RTLfootnotetext\@RTLfootnotetext
\renewcommand{\@footnotetext}[1]{%
  \scr@saved@footnotetext{#1}%
  \csname FN@mf@prepare\endcsname
}
\renewcommand{\@LTRfootnotetext}[1]{%
  \scr@saved@LTRfootnotetext{#1}%
  \csname FN@mf@prepare\endcsname
}
\renewcommand{\@RTLfootnotetext}[1]{%
  \scr@saved@RTLfootnotetext{#1}%
  \csname FN@mf@prepare\endcsname
}
\renewcommand\deffootnote[4][]{%
  \expandafter\ifnum\scr@v@is@ge{3.22}\relax
    \long\def\@makefntext##1{%
      \ExecuteDoHook{footnote/text/begin}%
      \raggedfootnote
      \if@RTL
        \rightskip
      \else
        \leftskip
      \fi
      #2
      \l@addto@macro\@trivlist{%
        \ifnum\@listdepth=\@ne\advance
          \if@RTL
            \rightmargin #2\relax
          \else
            \leftmargin #2\relax
          \fi
        \fi
      }%
      \parindent #3\noindent
      \IfArgIsEmpty{#1}{}{%
        \hskip \dimexpr #1-#2\relax
      }%
      \ftn@font\hbox to \z@{\hss\@@makefnmark}##1%
      \ExecuteDoHook{footnote/text/end}%
    }%
  \else
    \ClassInfo{\KOMAClassName}{%
      Using old \string\@makefntext\space due to compatibility
      level\MessageBreak
      less than 3.22}%
    \long\def\@makefntext##1{%
      \setlength{\@tempdimc}{#3}%
      \def\@tempa{#1}\ifx\@tempa\@empty
        \@setpar{\@@par
          \@tempdima = \hsize
          \addtolength{\@tempdima}{-#2}%
          \if@RTL
            \parshape \@ne \z@ \@tempdima
          \else
            \parshape \@ne #2 \@tempdima
          \fi
          }%
      \else
        \addtolength{\@tempdimc}{#2}%
        \addtolength{\@tempdimc}{-#1}%
        \@setpar{\@@par
          \@tempdima = \hsize
          \addtolength{\@tempdima}{-#1}%
          \@tempdimb = \hsize
          \addtolength{\@tempdimb}{-#2}%
          \if@RTL
            \parshape \tw@ \z@ \@tempdima \z@ \@tempdimb
          \else
            \parshape \tw@ #1 \@tempdima #2 \@tempdimb
          \fi
        }%
      \fi
      \par
      \parindent\@tempdimc\noindent
      \ftn@font\hbox to \z@{\hss\@@makefnmark}##1%
    }%
  \fi
  \def\@@makefnmark{\hbox{\ftnm@font{#4}}}%
}
\deffootnote[1em]{1.5em}{1em}{\textsuperscript{\thefootnotemark}}
\renewcommand*\left@footnoterule{%
  \normalsize\ftn@rule@test@values
  \kern-\dimexpr 2.6\p@+\ftn@rule@height\relax
  \ifx\@textbottom\relax\else\vskip \z@ \@plus.05fil\fi
  {\usekomafont{footnoterule}{%
      \hrule \@height\ftn@rule@height \@width\ftn@rule@width}}%
  \kern 2.6\p@}
\renewcommand*\right@footnoterule{%
  \normalsize\ftn@rule@test@values
  \kern-\dimexpr 2.6\p@+\ftn@rule@height\relax
  \ifx\@textbottom\relax\else\vskip \z@ \@plus.05fil\fi
  \nointerlineskip
  {\usekomafont{footnoterule}{%
      \hbox to \columnwidth{\hskip \dimexpr\columnwidth-\ftn@rule@width\relax  \leavevmode\leaders\hrule\@height\ftn@rule@height\hfill\kern\z@}}}%
  \kern 2.6\p@}
\renewcommand*\maketitle[1][1]{%
  \expandafter\ifnum \csname scr@v@3.12\endcsname>\scr@compatibility\relax
  \else
    \def\and{%
      \end{tabular}%
      \hskip 1em \@plus.17fil%
      \begin{tabular}[t]{c}%
    }%
  \fi
  \if@titlepage
    \begin{titlepage}
      \setcounter{page}{%
        #1%
      }%
      \if@titlepageiscoverpage
        \edef\titlepage@restore{%
          \noexpand\endgroup
          \noexpand\global\noexpand\@colht\the\@colht
          \noexpand\global\noexpand\@colroom\the\@colroom
          \noexpand\global\vsize\the\vsize
          \noexpand\global\noexpand\@titlepageiscoverpagefalse
          \noexpand\let\noexpand\titlepage@restore\noexpand\relax
        }%
        \begingroup
        \topmargin=\dimexpr \coverpagetopmargin-1in\relax
        \oddsidemargin=\dimexpr \coverpageleftmargin-1in\relax
        \evensidemargin=\dimexpr \coverpageleftmargin-1in\relax
        \textwidth=\dimexpr
        \paperwidth-\coverpageleftmargin-\coverpagerightmargin\relax
        \textheight=\dimexpr
        \paperheight-\coverpagetopmargin-\coverpagebottommargin\relax
        \headheight=0pt
        \headsep=0pt
        \footskip=\baselineskip
        \@colht=\textheight
        \@colroom=\textheight
        \vsize=\textheight
        \columnwidth=\textwidth
        \hsize=\columnwidth
        \linewidth=\hsize
      \else
        \let\titlepage@restore\relax
      \fi
      \let\footnotesize\small
      \let\right@footnoterule\relax
      \let\left@footnoterule\relax
      \let\textwidth@footnoterule\relax
      \let\footnote\thanks
      \let\LTRfootnote\LTRthanks
      \let\RTLfootnote\RTLthanks
      \renewcommand*\thefootnote{\@fnsymbol\c@footnote}%
      \let\@oldmakefnmark\@makefnmark
      \renewcommand*{\@makefnmark}{\rlap\@oldmakefnmark}%
      \ifx\@extratitle\@empty
        \ifx\@frontispiece\@empty
        \else
          \if@twoside\mbox{}\next@tpage\fi
          \noindent\@frontispiece\next@tdpage
        \fi
      \else
        \noindent\@extratitle
        \ifx\@frontispiece\@empty
        \else
          \next@tpage
          \noindent\@frontispiece
        \fi
        \next@tdpage
      \fi
      \setparsizes{\z@}{\z@}{\z@\@plus 1fil}\par@updaterelative
      \ifx\@titlehead\@empty \else
        \begin{minipage}[t]{\textwidth}%
          \usekomafont{titlehead}{\@titlehead\par}%
        \end{minipage}\par
      \fi
      \null\vfill
      \begin{center}
        \ifx\@subject\@empty \else
          {\usekomafont{subject}{\@subject\par}}%
          \vskip 3em
        \fi
        {\usekomafont{title}{\huge \@title\par}}%
        \vskip 1em
        {\ifx\@subtitle\@empty\else\usekomafont{subtitle}{\@subtitle\par}\fi}%
        \vskip 2em
        {%
          \usekomafont{author}{%
            \lineskip 0.75em
            \begin{tabular}[t]{c}
              \@author
            \end{tabular}\par
          }%
        }%
        \vskip 1.5em
        {\usekomafont{date}{\@date \par}}%
        \vskip \z@ \@plus3fill
        {\usekomafont{publishers}{\@publishers \par}}%
        \vskip 3em
      \end{center}\par
      \@thanks\global\let\@thanks\@empty
      \vfill\null
      \if@twoside
        \@tempswatrue
        \expandafter\ifnum \@nameuse{scr@v@3.12}>\scr@compatibility\relax
        \else
          \ifx\@uppertitleback\@empty\ifx\@lowertitleback\@empty
            \@tempswafalse
          \fi\fi
        \fi
        \if@tempswa
          \next@tpage
          \begin{minipage}[t]{\textwidth}
            \@uppertitleback
          \end{minipage}\par
          \vfill
          \begin{minipage}[b]{\textwidth}
            \@lowertitleback
          \end{minipage}\par
          \@thanks\global\let\@thanks\@empty
        \fi
      \else
        \ifx\@uppertitleback\@empty\else
          \ClassWarning{\KOMAClassName}{%
            non empty \string\uppertitleback\space ignored
            by \string\maketitle\MessageBreak
            in `twoside=false' mode%
          }%
        \fi
        \ifx\@lowertitleback\@empty\else
          \ClassWarning{\KOMAClassName}{%
            non empty \string\lowertitleback\space ignored
            by \string\maketitle\MessageBreak
            in `twoside=false' mode%
          }%
        \fi
      \fi
      \ifx\@dedication\@empty
      \else
        \next@tdpage\null\vfill
        {\centering\usekomafont{dedication}{\@dedication \par}}%
        \vskip \z@ \@plus3fill
        \@thanks\global\let\@thanks\@empty
        \cleardoubleemptypage
      \fi
      \ifx\titlepage@restore\relax\else\clearpage\titlepage@restore\fi
    \end{titlepage}
  \else
    \par
    \@tempcnta=%
    #1%
    \relax\ifnum\@tempcnta=1\else
      \ClassWarning{\KOMAClassName}{%
        Optional argument of \string\maketitle\space ignored\MessageBreak
        in `titlepage=false' mode%
      }%
    \fi
    \ifx\@uppertitleback\@empty\else
      \ClassWarning{\KOMAClassName}{%
        non empty \string\uppertitleback\space ignored
        by \string\maketitle\MessageBreak
        in `titlepage=false' mode%
      }%
    \fi
    \ifx\@lowertitleback\@empty\else
      \ClassWarning{\KOMAClassName}{%
        non empty \string\lowertitleback\space ignored
        by \string\maketitle\MessageBreak
        in `titlepage=false' mode%
      }%
    \fi
    \begingroup
      \let\titlepage@restore\relax
      \renewcommand*\thefootnote{\@fnsymbol\c@footnote}%
      \let\@oldmakefnmark\@makefnmark
      \renewcommand*{\@makefnmark}{\rlap\@oldmakefnmark}%
      \next@tdpage
      \if@twocolumn
        \ifnum \col@number=\@ne
          \ifx\@extratitle\@empty
            \ifx\@frontispiece\@empty\else\if@twoside\mbox{}\fi\fi
          \else
            \@makeextratitle
          \fi
          \ifx\@frontispiece\@empty
            \ifx\@extratitle\@empty\else\next@tdpage\fi
          \else
            \next@tpage
            \@makefrontispiece
            \next@tdpage
          \fi
          \@maketitle
        \else
          \ifx\@extratitle\@empty
            \ifx\@frontispiece\@empty\else\if@twoside\mbox{}\fi\fi
          \else
            \twocolumn[\@makeextratitle]%
          \fi
          \ifx\@frontispiece\@empty
            \ifx\@extratitle\@empty\else\next@tdpage\fi
          \else
            \next@tpage
            \twocolumn[\@makefrontispiece]%
            \next@tdpage
          \fi
          \twocolumn[\@maketitle]%
        \fi
      \else
        \ifx\@extratitle\@empty
          \ifx\@frontispiece\@empty\else \mbox{}\fi
        \else
          \@makeextratitle
        \fi
        \ifx\@frontispiece\@empty
          \ifx\@extratitle\@empty\else\next@tdpage\fi
        \else
          \next@tpage
          \@makefrontispiece
          \next@tdpage
        \fi
        \@maketitle
      \fi
      \ifx\titlepagestyle\@empty\else\thispagestyle{\titlepagestyle}\fi
      \@thanks\global\let\@thanks\@empty
    \endgroup
  \fi
  \setcounter{footnote}{0}%
  \expandafter\ifnum \csname scr@v@3.12\endcsname>\scr@compatibility\relax
    \let\thanks\relax
    \let\LTRthanks\relax
    \let\RTLthanks\relax
    \let\maketitle\relax
    \let\@maketitle\relax
    \global\let\@thanks\@empty
    \global\let\@author\@empty
    \global\let\@date\@empty
    \global\let\@title\@empty
    \global\let\@subtitle\@empty
    \global\let\@extratitle\@empty
    \global\let\@frontispiece\@empty
    \global\let\@titlehead\@empty
    \global\let\@subject\@empty
    \global\let\@publishers\@empty
    \global\let\@uppertitleback\@empty
    \global\let\@lowertitleback\@empty
    \global\let\@dedication\@empty
    \global\let\author\relax
    \global\let\title\relax
    \global\let\extratitle\relax
    \global\let\titlehead\relax
    \global\let\subject\relax
    \global\let\publishers\relax
    \global\let\uppertitleback\relax
    \global\let\lowertitleback\relax
    \global\let\dedication\relax
    \global\let\date\relax
  \fi
  \global\let\and\relax
}%
\def\raggedsection{\if@RTL\raggedleft\else\raggedright\fi}
\renewcommand*\autodot{\if@altsecnumformat\@SepMark\fi}
\renewcommand*\thesection{%
  \expandafter\ifnum\scr@v@is@gt{2.97d}%
    \if@mainmatter\thechapter\@SepMark\fi
  \else
  \thechapter\@SepMark%
  \fi
  \@arabic\c@section
}
\renewcommand*{\thesubsection}{\thesection\@SepMark\@arabic\c@subsection}
\renewcommand*{\thesubsubsection}{%
  \thesubsection\@SepMark\@arabic\c@subsubsection
}
\renewcommand*{\theparagraph}{\thesubsubsection\@SepMark\@arabic\c@paragraph}
\renewcommand*{\thesubparagraph}{%
  \theparagraph\@SepMark\@arabic\c@subparagraph
}
\expandafter\ifnum\scr@v@is@le{2.97d}%
  \renewcommand*\thefigure{\thechapter\@SepMark\@arabic\c@figure}
\fi
\expandafter\ifnum\scr@v@is@le{2.97d}%
  \renewcommand*\thetable{\thechapter\@SepMark\@arabic\c@table}
\fi
\renewcommand*{\theequation}{%
  \expandafter\ifnum\scr@v@is@gt{2.97d}%
    \if@mainmatter\thechapter\@SepMark\fi
  \else
    \thechapter\@SepMark%
  \fi
  \@arabic\c@equation
}
\renewenvironment{thebibliography}[1]{%
  \if@bib@break@
    \bib@beginhook
  \else
    \ifx\bibpreamble\relax\else\ifx\bibpreamble\@empty\else
        \setchapterpreamble{\bibpreamble}%
    \fi\fi
    \bib@heading
    \bib@beginhook
    \bib@before@hook
  \fi
  \renewcommand{\BreakBibliography}[1]{%
    \@bib@break
    \end{thebibliography}%
    \begingroup ##1\endgroup
    \begin{thebibliography}{#1}
  }%
   \if@RTL\if@LTRbibitems\@RTLfalse\else\fi\else\if@RTLbibitems\@RTLtrue\else\fi\fi
   \bidi@@thebibliography@font@hook%
  \list{%
    \@biblabel{\@arabic\c@enumiv}%
  }{%
    \settowidth\labelwidth{\@biblabel{#1}}%
    \leftmargin\labelwidth
    \advance\leftmargin\labelsep
    \@openbib@code
    \if@bib@break@
      \edef\@tempa{%
        \noexpand\usecounter{enumiv}%
        \noexpand\setcounter{enumiv}{\the\c@enumiv}%
      }\@tempa
      \no@bib@break
    \else
      \usecounter{enumiv}%
    \fi
    \let\p@enumiv\@empty
    \renewcommand*\theenumiv{\@arabic\c@enumiv}%
  }%
  \sloppy\clubpenalty4000 \widowpenalty4000
  \sfcode`\.=\@m
}{%
  \if@bib@break@
    \def\@noitemerr{%
      \@latex@warning{%
        \string\BreakBibliography\space at begin of `thebibliography'
        environment\MessageBreak
        or following \string\BreakBibliography}%
    }%
  \else
    \def\@noitemerr{%
      \@latex@warning{%
        Empty `thebibliography' environment or
        \string\BreakBibliography\MessageBreak
        before end of `thebibliography' environment}%
    }%
  \fi
  \endlist
  \if@bib@break@
  \else
    \bib@after@hook
    \let\bib@before@hook\@empty
    \let\bib@after@hook\@empty
  \fi
  \bib@endhook
}
\renewcommand*{\raggeddictum}{\if@RTL\raggedright\else\raggedleft\fi}
\renewcommand*{\raggeddictumtext}{\if@RTL\raggedleft\else\raggedright\fi}
\renewcommand*{\raggeddictumauthor}{\if@RTL\raggedright\else\raggedleft\fi}
\renewcommand\marginline[1]{%
  \marginpar[\if@RTL\raggedright\else\raggedleft\fi{#1}]{\if@RTL\raggedleft\else\raggedright\fi #1}%
}
\renewcommand{\@@makecaption}[3]{%
  \cap@margin
  \begingroup
    \ifonelinecaptions
      \def\stepcounter##1{\advance\value{##1}\@ne}%
      \let\refstepcounter\stepcounter
      \let\label\@gobble
      \let\@footnotetext=\@gobble
      \let\@LTRfootnotetext=\@gobble
      \let\@RTLfootnotetext=\@gobble
      \let\hypertarget\@gobbletwo
      \edef\@xnewline{%
        \unexpanded{\ClassInfo{\KOMAClassName}{%
            Workaround for not recommended usage of \string\\ or\MessageBreak
            \string\newline in caption text
          }%
          \hspace*{\linewidth}\hspace{1sp}%
        }%
        \unexpanded\expandafter{\@xnewline}%
      }%
      \edef\@xcentercr{%
        \unexpanded{\ClassInfo{\KOMAClassName}{%
            Workaround for not recommended usage of \string\\ or\MessageBreak
            \string\newline in caption text
          }%
          \hspace*{\linewidth}\hspace{1sp}%
        }%
        \unexpanded\expandafter{\@xcentercr}%
      }%
      \settowidth{\@tempdima}{\scr@@makesinglelinecaption{#1}{#2}{#3}}%
      \ifdim\@tempdima>\cap@width
        \aftergroup\scr@makemultilinecaption
      \else
        \aftergroup\scr@makesinglelinecaption
      \fi
    \else
      \aftergroup\scr@makemultilinecaption
    \fi
  \endgroup
  {#1}{#2}{#3}%
}
\renewcommand{\scr@makesinglelinecaption}[3]{%
  {%
    \usefontofkomafont{caption}{%
      \hb@xt@\hsize{%
        \cap@left
        \if@RTL
          \beginR
        \fi
        \scr@@makesinglelinecaption{#1}{#2}{#3}%
        \if@RTL
          \endR
        \fi
        \cap@right
      }\par\kern\dp\strutbox%
    }%
  }\kern-\dp\strutbox
}
\renewcommand{\@makecaption}[2]{%
  \if@captionabove
    \vskip\belowcaptionskip
  \else
    \vskip\abovecaptionskip
  \fi
  \@@makecaption\@firstofone{#1}{#2}%
  \if@captionabove
    \vskip\abovecaptionskip
  \else
    \vskip\belowcaptionskip
  \fi
}

\renewcommand{\scr@@makesinglelinecaption}[3]{%
    {\usekomafont{caption}{\strut\ignorespaces
      #1{{\usekomafont{captionlabel}{#2\captionformat}}}%
      \ignorespaces #3\unskip}}%
}

\renewcommand{\scr@makemultilinecaption}[3]{%
  {%
    \usefontofkomafont{caption}{%
      \hb@xt@\hsize{%
        \cap@left
        \vbox{\hsize\cap@width\linewidth\hsize
          \scr@ifundefinedorrelax{@captype}{%
            \ClassWarning{\KOMAClassName}{%
              `\string\caption' outside float.\MessageBreak
              Seems you are using `\string\caption' outside a
              float.\MessageBreak
              Maybe you are using a package that uses
              `\string\@makecaption'\MessageBreak
              without setting `\string\@captype' before.\MessageBreak
              Because I cannot detect the caption type, I'm using\MessageBreak
              the empty one.%
            }%
            \let\@captype\@empty
          }{}%
          \scr@ifundefinedorrelax{ragged\@captype caption}{\raggedcaption}{%
            \@nameuse{ragged\@captype caption}%
          }%
          \ifdofullc@p
            \@hangfrom{%
              \strut
              \scr@smashdp{%
                #1{%
                  \usekomafont{caption}{%
                    \usekomafont{captionlabel}{#2\captionformat}%
                  }%
                }%
              }%
            }%
            {{\usekomafont{caption}{#3\scr@endstrut}}\par}%
          \else
            \ifdim\cap@indent<\z@
              \strut
              #1{%
                {\usekomafont{caption}{%
                  \usekomafont{captionlabel}{#2\captionformat}%
                }%
              }\par}%
              \noindent{{\usekomafont{caption}{%
                  \hspace*{-\cap@indent}#3\scr@endstrut
              }}\par}%
            \else
              \if@capbreak
                \strut
                #1{%
                  {\usekomafont{caption}{%
                    \usekomafont{captionlabel}{#2\captionformat}%
                  }
                }\par}%
                \noindent\@hangfrom{\hspace*{\cap@indent}}%
                {{\usekomafont{caption}{#3\scr@endstrut}}\par}%
              \else
                \@hangfrom{\scr@smashdp\strut\hspace*{\cap@indent}}%
                {%
                  \hspace{-\cap@indent}%
                  \scr@smashdp{%
                    #1{\usekomafont{caption}{%
                        \usekomafont{captionlabel}{#2\captionformat}%
                      }%
                    }%
                  }%
                  {{\usekomafont{caption}{#3\scr@endstrut}}\par}%
                }%
              \fi
            \fi
          \fi
        }%
        \cap@right
      }\par\kern\dp\strutbox
    }%
  }\kern-\dp\strutbox
}

\bidi@AfterFile{longtable-xetex-bidi.def}{%
  \if@komalongtable
    \renewcommand{\LT@makecaption}[3]{%
      \LT@mcol\LT@cols c{%
        \hbox to\z@{\hss\parbox[t]\linewidth{%
            \if@captionabove\else\vskip\belowcaptionskip\fi
            \@@makecaption{#1}{#2}{#3}%
            \endgraf
            \if@captionabove\vskip\abovecaptionskip\fi
          }%
          \hss
        }%
      }%
    }%
    \renewcommand*{\scr@LT@array}{}%
    \let\scr@LT@array=\LT@array
    \renewcommand*{\LT@array}{%
      \def\@captype{table}%
      \@ifundefined{LTcaptype}{}{%
        \Ifstr{\LTcaptype}{}{}{\let\@captype\LTcaptype}%
      }%
      \csname tocbasic_if_caption_above:TF\endcsname
        {\@captionabovetrue}{\@captionabovefalse}%
      \def\captionabove{\noalign{\global\@captionabovetrue}%
        \LT@caption}%
      \def\captionbelow{\noalign{\global\@captionabovefalse}%
        \LT@caption}%
      \scr@LT@array
    }%
    \ClassInfo{\KOMAClassName}{%
      longtable captions redefined%
    }%
  \fi
}

\CloneTOCEntryStyle{tocline}{part}
\TOCEntryStyleStartInitCode{part}{%
  \expandafter\renewcommand%
  \csname scr@tso@#1@linefill\endcsname{\hfill}%
  \expandafter\renewcommand%
  \csname scr@tso@#1@entryformat\endcsname[1]{\usekomafont{partentry}{##1}}%
  \expandafter\renewcommand%
  \csname scr@tso@#1@pagenumberformat\endcsname[1]{%
    {\usekomafont{partentry}{\usekomafont{partentrypagenumber}{##1}}}}%
  \expandafter\renewcommand\expandafter*%
  \csname scr@tso@#1@beforeskip\endcsname{2.25em \@plus\p@}%
}

\CloneTOCEntryStyle{tocline}{chapter}
\TOCEntryStyleStartInitCode{chapter}{%
  \expandafter\renewcommand%
  \csname scr@tso@#1@linefill\endcsname{%
    \if@chapterentrywithdots
      {\usekomafont{chapterentrydots}{\TOCLineLeaderFill}}\relax
    \else
      \hfill
    \fi
  }%
  \expandafter\renewcommand%
  \csname scr@tso@#1@entryformat\endcsname{\usekomafont{chapterentry}}%
  \expandafter\renewcommand%
  \csname scr@tso@#1@pagenumberformat\endcsname[1]{%
    {\usekomafont{chapterentry}{\usekomafont{chapterentrypagenumber}{##1}}}}%
  \expandafter\renewcommand\expandafter*%
  \csname scr@tso@#1@beforeskip\endcsname{1.0em \@plus\p@}%
}

\CloneTOCEntryStyle{tocline}{section}
\TOCEntryStyleStartInitCode{section}{%
  \expandafter\renewcommand%
  \csname scr@tso@#1@linefill\endcsname{\TOCLineLeaderFill\relax}%
      \expandafter\renewcommand%
      \csname scr@tso@#1@pagenumberformat\endcsname[1]{%
        {\normalfont\normalcolor ##1}}%
}

\CloneTOCEntryStyle{section}{default}

\DeclareSectionCommand[%
  style=chapter,%
  level=\z@,%
  pagestyle=plain,%
  tocstyle=chapter,%
  tocindent=\z@,%
  tocnumwidth=1.5em%
]{chapter}
\DeclareSectionCommand[%
  style=section,%
  level=1,%
  indent=\z@,%
  beforeskip=-3.5ex \@plus -1ex \@minus -.2ex,%
  afterskip=2.3ex \@plus.2ex,%
  tocstyle=section,%
  tocindentfollows=chapter,%
  tocindent=1.5em,%
  tocnumwidth=2.3em%
]{section}
\DeclareSectionCommand[%
  style=part,%
  level=\m@ne,%
  pagestyle=plain,%
  tocstyle=part,%
  toclevel=\m@ne,%
  tocindent=\z@,%
  tocnumwidth=2em%
]{part}
\DeclareSectionCommand[%
  style=section,%
  level=2,%
  indent=\z@,%
  beforeskip=-3.25ex\@plus -1ex \@minus -.2ex,%
  afterskip=1.5ex \@plus .2ex,%
  tocstyle=section,%
  tocindent=3.8em,%
  tocnumwidth=3.2em%
]{subsection}
\DeclareSectionCommand[%
  style=section,%
  level=3,%
  indent=\z@,%
  beforeskip=-3.25ex\@plus -1ex \@minus -.2ex,%
  afterskip=1.5ex \@plus .2ex,%
  tocstyle=section,%
  tocindent=7.0em,%
  tocnumwidth=4.1em%
]{subsubsection}
\DeclareSectionCommand[%
  style=section,%
  level=4,%
  indent=\z@,%
  beforeskip=3.25ex \@plus1ex \@minus.2ex,%
  afterskip=-1em,%
  tocindentfollows=subsubsection,%
  tocstyle=section,%
  tocindent=10em,%
  tocnumwidth=5em%
]{paragraph}
\DeclareSectionCommand[%
  style=section,%
  level=5,%
  indent=\scr@parindent,%
  beforeskip=3.25ex \@plus1ex \@minus .2ex,%
  afterskip=-1em,%
  tocstyle=section,%
  tocindent=12em,%
  tocnumwidth=6em%
]{subparagraph}
\endinput
%%
%% End of file `scrbook-xetex-bidi.def'.
