Current File : //usr/share/texlive/texmf-dist/tex/latex/koma-script/tocbasic.sty
%%
%% This is file `tocbasic.sty',
%% generated with the docstrip utility, extended by scrdocstrip.
%%
%% The original source files were:
%%
%% tocbasic.dtx  (with options: `package,identify')
%% tocbasic.dtx  (with options: `package,prepare')
%% scrkernel-tocstyle.dtx  (with options: `package,prepare')
%% tocbasic.dtx  (with options: `package,option')
%% scrkernel-tocstyle.dtx  (with options: `package,option')
%% tocbasic.dtx  (with options: `package,body')
%% scrkernel-tocstyle.dtx  (with options: `package,body')
%% scrkernel-tocstyle.dtx  (with options: `package,style,gobble')
%% scrkernel-tocstyle.dtx  (with options: `package,style,dottedtocline')
%% scrkernel-tocstyle.dtx  (with options: `package,style,undottedtocline')
%% scrkernel-tocstyle.dtx  (with options: `package,style,largetocline')
%% scrkernel-tocstyle.dtx  (with options: `package,style,tocline')
%% scrkernel-tocstyle.dtx  (with options: `package,style,toctext')
%% scrkernel-tocstyle.dtx  (with options: `package,style,default')
%% tocbasic.dtx  (with options: `package,exit')
%% scrlogo.dtx  (with options: `logo')
%% 
%% Copyright (c) 2008-2019 Markus Kohm [komascript at gmx info]
%% 
%% This file was generated from file(s) of the KOMA-Script bundle.
%% ---------------------------------------------------------------
%% 
%% It may be distributed under the conditions of the
%% LaTeX Project Public License in the version distributed together
%% with KOMA-Script, see file `lppl.txt' or `lppl-de.txt'.
%% 
%% This file may only be distributed together with a copy of the
%% KOMA-Script bundle.  You may however distribute the
%% KOMA-Script bundle without all such generated files.  See also
%% `lppl.txt' or `lppl-de.txt' for additional information.
%% 
%% The list of files belonging to KOMA-Script distribution is given in
%% the file `manifest.txt'.  See also `lppl.txt' or `lppl-de.txt' for
%% additional information.
%% 
%% If this file is a beta version, you may not be allowed to distribute
%% it.  Look at the comments below to see if this is the case.
%% 
%% English and German manuals are part of KOMA-Script bundle.
%% ----------------------------------------------------------
%% 
%% See `README'.
%% 
%% The KOMA-Script bundle (but maybe not this file) was based upon the
%% LaTeX 2.09 Script family created by Frank Neukam 1993 and the LaTeX2e
%% standard classes created by The LaTeX3 Project 1994-1996.  You can
%% find a complete unmodified copy of LaTeX2e at
%% <http://mirror.ctan.org/tex-archive/macros/latex/base/>.
%% 
%%% From File: $Id: tocbasic.dtx 3518 2020-08-25 08:26:01Z kohm $
%%%            (run: identify)
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{tocbasic}[%
  2021/03/17 v3.33 KOMA-Script
  package
  (handling toc-files)%
]
%%% From File: $Id: tocbasic.dtx 3518 2020-08-25 08:26:01Z kohm $
%%%            (run: prepare)
%%% From File: $Id: scrkernel-tocstyle.dtx 3507 2020-06-11 14:57:03Z kohm $
%%%            (run: prepare)
%%% From File: $Id: tocbasic.dtx 3518 2020-08-25 08:26:01Z kohm $
%%%            (run: option)
\ProcessOptions\relax
%%% From File: $Id: scrkernel-tocstyle.dtx 3507 2020-06-11 14:57:03Z kohm $
%%%            (run: option)
%%% From File: $Id: tocbasic.dtx 3518 2020-08-25 08:26:01Z kohm $
%%%            (run: body)
\RequirePackage{scrbase}
\AfterPackage*{multitoc}{%
  \@ifpackagelater{multitoc}{2018/08/31}{}{%
    \PackageWarningNoLine{tocbasic}{%
      Usage of package `multitoc' is not recommended!\MessageBreak
      Note, this package generally results in empty ToCs\MessageBreak
      for all extension but `toc', `lof' and `lot' and\MessageBreak
      even for these extensions if you do not use the\MessageBreak
      corresponding multitoc options.\MessageBreak
      It is recommended to use:\MessageBreak
      \space\space\string\usepackage{multicol}\MessageBreak
      \space\space\string\BeforeStartingTOC{\string\begin{multicols}{2}}%
      \MessageBreak
      \space\space\string\AfterStartingTOC{\string\end{multicols}}%
      \MessageBreak
      instead of loading package `multitoc'.\MessageBreak
      See the KOMA-Script manual for more information\MessageBreak
      about using \string\BeforeStartingTOC\space and
      \string\AfterStartingTOC\MessageBreak
      and the multicol manual for more information\MessageBreak
      about the `multicols' environment%
    }%
  }%
}
\newcommand*{\tb@listoftocs}{}
\providecommand*{\ifattoclist}{%
  \PackageWarning{tocbasic}{Usage of deprecated command
    `\string\ifattoclist'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifattoclist' by `\string\Ifattoclist'%
  }%
  \Ifattoclist
}
\newcommand{\Ifattoclist}[1]{%
  \begingroup
    \def\do##1##2{%
      \edef\reserved@a{##1}%
      \ifx\reserved@a\reserved@b\@tempswatrue\fi
    }%
    \edef\reserved@b{#1}\@tempswafalse\tb@listoftocs
    \if@tempswa\aftergroup\@firstoftwo\else\aftergroup\@secondoftwo\fi
  \endgroup
}
\newcommand*{\addtotoclist}{%
  \kernel@ifnextchar [%]
    \scr@@addtotoclist\scr@addtotoclist
}
\newcommand*{\scr@addtotoclist}{%
  \ifx\@currname\@empty
    \def\reserved@a{\scr@@addtotoclist[]}%
  \else
    \edef\reserved@a{\noexpand\scr@@addtotoclist[\@currname.\@currext]}%
  \fi
  \reserved@a
}
\newcommand*{\scr@@addtotoclist}[2][]{%
  \Ifattoclist{#2}{%
    \PackageError{tocbasic}{%
      file extension `#2' cannot be used twice
    }{%
      File extension `#2' is already used by a toc-file, while
      \ifx\relax#1\relax someone\else #2\fi\MessageBreak
      tried to use it again for a toc-file.\MessageBreak
      This may be either an incompatibility of packages, an error at a
      package,\MessageBreak
      or a mistake by the user.\MessageBreak
    }%
  }{%
    \begingroup
      \protected@edef\reserved@a{%
        \noexpand\g@addto@macro\noexpand\tb@listoftocs{%
          \noexpand\do{#2}{#1}}}\reserved@a
    \endgroup
    \ifx\relax #1\relax\else
      \@ifundefined{tb@#1@add@hook}{}{%
        \edef\reserved@a{%
          \noexpand\def\noexpand\@currext{#2}%
          \noexpand\@nameuse{tb@#1@add@hook}%
          \noexpand\def\noexpand\@currext{\@currext}%
        }\reserved@a
      }%
    \fi
    \edef\reserved@a{%
      \noexpand\def\noexpand\@currext{#2}%
      \noexpand\@nameuse{tb@@add@hook}%
      \noexpand\def\noexpand\@currext{\@currext}%
    }\reserved@a
  }%
}
\newcommand*{\owneroftoc}[2][\@firstofone]{%
  \begingroup
    \let\reserved@a\endgroup
    \def\do##1##2{\Ifstr{#2}{##1}{\def\reserved@a{\endgroup#1{##2}}}{}}%
    \tb@listoftocs
  \reserved@a
}
\newcommand*{\categoryoftoc}{\owneroftoc}
\newcommand*{\AtAddToTocList}{%
  \kernel@ifnextchar [%]
    \@@AtAddToTocList\@AtAddToTocList
}
\newcommand*{\@AtAddToTocList}{%
  \ifx\@currname\@empty
    \def\reserved@a{\@@AtAddToTocList[]}%
  \else
    \edef\reserved@a{\noexpand\@@AtAddToTocList[\@currname.\@currext]}%
  \fi
  \reserved@a
}
\newcommand*{\@@AtAddToTocList}[1][]{%
  \@ifundefined{tb@#1@add@hook}{\@namedef{tb@#1@add@hook}{}}{}%
  \expandafter\g@addto@macro\csname tb@#1@add@hook\endcsname
}
\newcommand*{\tocbasic@extend@babel}[1]{%
  \scr@ifundefinedorrelax{bbl@set@language}{%
    \PackageInfo{tocbasic}{babel extension for `#1' omitted\MessageBreak
      because of missing \string\bbl@set@language}%
  }{%
    \Iftocfeature{#1}{nobabel}{%
      \PackageInfo{tocbasic}{omitting babel extension for `#1'\MessageBreak
        because of feature `nobabel' available\MessageBreak
        for `#1'}%
    }{%
      \scr@ifundefinedorrelax{BabelContentsFiles}{%
        \PackageInfo{tocbasic}{setting babel extension for `#1'}%
        \expandafter\gdef\expandafter\bbl@set@language
        \expandafter##\expandafter1%
        \expandafter{%
          \bbl@set@language{##1}%
          \addtocontents{#1}{\xstring\select@language{\languagename}}%
        }%
      }{%
        \@expandtwoargs\in@{,#1,}{,\BabelContentsFiles,}%
        \ifin@
          \PackageInfo{tocbasic}{omitting babel extension for
            `#1'\MessageBreak
            because it is already in \string\BabelContentsFiles}%
        \else
          \PackageInfo{tocbasic}{setting babel extension for `#1'}%
          \xdef\BabelContentsFiles{\BabelContentsFiles,#1}%
        \fi
      }%
    }%
  }%
}
\AtAddToTocList[]{\expandafter\tocbasic@extend@babel\expandafter{\@currext}}
\newcommand*{\removefromtoclist}{%
  \kernel@ifnextchar [%]
    \scr@removefromtoclist\scr@@removefromtoclist
}
\newcommand*{\scr@removefromtoclist}[2][]{%
  \begingroup
    \let\tb@oldlist\tb@listoftocs
    \def\do##1##2{%
      \edef\reserved@a{##1}%
      \ifx\reserved@a\reserved@b
        \begingroup
          \edef\@currext{##2}%
          \edef\reserved@b{#1}%
          \ifx\@currext\reserved@b
          \else
            \g@addto@macro\tb@listoftocs{\do{##1}{##2}}%
          \fi
        \endgroup
      \else
        \g@addto@macro\tb@listoftocs{\do{##1}{##2}}%
      \fi
    }%
    \edef\reserved@b{#2}\global\let\tb@listoftocs\@empty
    \tb@oldlist
  \endgroup
}
\newcommand*{\scr@@removefromtoclist}[1]{%
  \begingroup
    \let\tb@oldlist\tb@listoftocs
    \def\do##1##2{%
      \edef\reserved@a{##1}%
      \ifx\reserved@a\reserved@b
      \else
        \g@addto@macro\tb@listoftocs{\do{##1}{##2}}%
      \fi
    }%
    \edef\reserved@b{#1}\global\let\tb@listoftocs\@empty
    \tb@oldlist
  \endgroup
}
\newcommand{\doforeachtocfile}{%
  \kernel@ifnextchar [%]
    \@doforeachtocfile\@@doforeachtocfile
}
\newcommand{\@doforeachtocfile}[2][]{%
  \def\do##1##2{%
    \edef\reserved@a{#1}\edef\reserved@b{##2}\ifx\reserved@a\reserved@b
      \edef\@currext{##1}#2%
    \fi
  }%
  \edef\reserved@a{%
    \noexpand\tb@listoftocs
    \noexpand\def\noexpand\@currext{\@currext}%
  }\reserved@a
  \let\do\relax
}
\newcommand{\@@doforeachtocfile}[1]{%
  \def\do##1##2{%
    \edef\@currext{##1}#1%
  }%
  \edef\reserved@a{%
    \noexpand\tb@listoftocs
    \noexpand\def\noexpand\@currext{\@currext}%
  }\reserved@a
  \let\do\relax
}
\newcommand{\addtoeachtocfile}{%
  \kernel@ifnextchar [%]
    \@addtoeachtocfile\@@addtoeachtocfile
}
\newcommand{\@addtoeachtocfile}[2][]{%
  \doforeachtocfile[{#1}]{\addtocontents{\@currext}{#2}}%
}
\newcommand{\@@addtoeachtocfile}[1]{%
  \doforeachtocfile{\addtocontents{\@currext}{#1}}%
}
\newcommand{\addcontentslinetoeachtocfile}{%
  \kernel@ifnextchar [%]
    \@addcontentslinetoeachtocfile\@@addcontentslinetoeachtocfile
}
\newcommand{\@addcontentslinetoeachtocfile}[3][]{%
  \doforeachtocfile[{#1}]{\addcontentsline{\@currext}{#2}{#3}}%
}
\newcommand{\@@addcontentslinetoeachtocfile}[2]{%
  \doforeachtocfile{\addcontentsline{\@currext}{#1}{#2}}%
}
\newcommand*{\addxcontentsline}[2]{%
  \kernel@ifnextchar [%]
  {\@addxcontentsline{#1}{#2}}%
  {\@addxcontentsline{#1}{#2}[]}%
}
\newcommand*{\@addxcontentsline}{}
\def\@addxcontentsline#1#2[#3]#4{%
  \scr@ifundefinedorrelax{add#2#1entry}{%
    \tocbasic@addxcontentsline{#1}{#2}{#3}{#4}%
  }{%
    \@nameuse{add#2#1entry}{#3}{#4}%
  }%
}
\newcommand*{\nonumberline}{}%
\newcommand*{\tocbasic@addxcontentsline}[4]{%
  \if\relax\detokenize{#3}\relax
    \addcontentsline{#1}{#2}{\protect\nonumberline#4}%
  \else
    \addcontentsline{#1}{#2}{\protect\numberline{#3}#4}%
  \fi
}
\newcommand{\addxcontentslinetoeachtocfile}{%
  \kernel@ifnextchar [%]
    \@addxcontentslinetoeachtocfile\@@addxcontentslinetoeachtocfile
}
\newcommand{\@addxcontentslinetoeachtocfile}[2][]{%
  \kernel@ifnextchar [%]
    {\@@@addxcontentslinetoeachtocfile[{#1}]{#2}}%
    {\@@@addxcontentslinetoeachtocfile[{#1}]{#2}[]}
}
\newcommand*{\@@@addxcontentslinetoeachtocfile}{}
\def\@@@addxcontentslinetoeachtocfile[#1]#2[#3]#4{%
  \doforeachtocfile[{#1}]{\addxcontentsline{\@currext}{#2}[#3]{#4}}%
}
\newcommand{\@@addxcontentslinetoeachtocfile}[1]{%
  \kernel@ifnextchar [%]
    {\@@@@addxcontentslinetoeachtocfile{#1}}%
    {\@@@@addxcontentslinetoeachtocfile{#1}[]}%
}
\newcommand*{\@@@@addxcontentslinetoeachtocfile}{}
\def\@@@@addxcontentslinetoeachtocfile#1[#2]#3{%
  \doforeachtocfile{\addxcontentsline{\@currext}{#1}[{#2}]{#3}}%
}
\newcommand*{\tocbasic@starttoc}[1]{%
  \begingroup
    \tocbasic@reentrant@warning
    \def\tocbasic@reentrant@warning{%
      \PackageWarning{tocbasic}{%
        Loading one auxiliary file inside the setup context\MessageBreak
        of another auxiliary file is not recommended.\MessageBreak
        In this case settings for `\@currext' could also influence\MessageBreak
        settings of `#1' and local states of `#1' can also\MessageBreak
        influence local states of `\@currext'%
      }%
    }%
    \edef\@currext{#1}%
    \Iftocfeature{\@currext}{noparskipfake}{}{%
      \ifvmode
        \@tempskipa\lastskip
        \vskip-\lastskip
        \addtolength{\@tempskipa}{\parskip}%
        \vskip\@tempskipa
      \fi
    }%
    \setlength{\parskip}{\z@}%
    \setlength{\parindent}{\z@}%
    \setlength{\parfillskip}{\z@\@plus 1fil}%
    \csname tocbasic@@before@hook\endcsname
    \csname tb@#1@before@hook\endcsname
    \@starttoc{#1}%
    \BeforeClosingMainAux{%
      \addtocontents{#1}{%
        \string\providecommand\string\tocbasic@end@toc@file{}%
        \string\tocbasic@end@toc@file
      }%
    }%
    \edef\@currext{#1}%
    \csname tb@#1@after@hook\endcsname
    \csname tocbasic@@after@hook\endcsname
  \endgroup
}
\newcommand*{\tocbasic@end@toc@file}{\par}
\newcommand*{\tocbasic@reentrant@warning}{}
\newcommand*{\tocbasic@@before@hook}{}
\newcommand*{\tocbasic@@after@hook}{}
\newcommand{\BeforeStartingTOC}[2][]{%
  \ifx\relax#1\relax
    \g@addto@macro\tocbasic@@before@hook{#2}%
  \else
    \@ifundefined{tb@#1@before@hook}{%
      \expandafter\global\expandafter\let\csname tb@#1@before@hook\endcsname
      \@empty
    }{}%
    \expandafter\g@addto@macro\csname tb@#1@before@hook\endcsname{#2}%
  \fi
}
\newcommand{\AfterStartingTOC}[2][]{%
  \ifx\relax#1\relax
    \g@addto@macro\tocbasic@@after@hook{#2}%
  \else
    \@ifundefined{tb@#1@after@hook}{%
      \expandafter\global\expandafter\let\csname tb@#1@after@hook\endcsname
      \@empty
    }{}%
    \expandafter\g@addto@macro\csname tb@#1@after@hook\endcsname{#2}%
  \fi
}
\newcommand*{\listoftoc}{%
  \kernel@ifstar \tocbasic@starttoc\@listoftoc
}
\newcommand*{\@listoftoc}[2][]{%
  \begingroup
    \def\list@fname{#1}%
    \@ifundefined{listof#2name}{%
      \ifx\list@fname\@empty
        \PackageWarning{tocbasic}{%
          You should either define \expandafter\string\csname
          listof#2name\endcsname\MessageBreak
          or use the optional argument of \string\listoftoc\space\MessageBreak
          to set the term to be used for the\MessageBreak
          heading of list of #2}%
        \def\list@fname{\listofname~#2}%
      \fi
    }{%
      \expandafter\let\expandafter\list@fname\csname listof#2name\endcsname
    }%
    \edef\@currext{#2}%
    \Iftocfeature{\@currext}{onecolumn}{%
      \Iftocfeature{\@currext}{leveldown}{}{%
        \if@twocolumn
          \aftergroup\twocolumn\onecolumn
        \fi
      }%
    }{}%
    \Iftocfeature{\@currext}{numberline}{\def\nonumberline{\numberline{}}}{}%
    \expandafter\tocbasic@listhead\expandafter{\list@fname}%
    \scr@ifundefinedorrelax{microtypesetup}{}{%
      \Iftocfeature{\@currext}{noprotrusion}{}{%
        \microtypesetup{protrusion=false}%
        \PackageInfo{tocbasic}{%
          character protrusion at \@currext\space deactivated}%
      }%
    }%
    \tocbasic@starttoc{#2}%
  \endgroup
}
\@ifpackageloaded{tocbibind}{}{%
  \AtBeginDocument{%
    \@ifpackageloaded{tocbibind}{%
      \PackageInfo{tocbasic}{usage of `tocbibind' detected}%
      \newcommand*{\tb@tocbibindpatch}[3]{%
        \long\def\reserved@a{\tocfile{#2}{#1} }%
        \ifx #3\reserved@a
          \PackageWarningNoLine{tocbasic}{%
            `tocbibind' redefinition of `\string#3'\MessageBreak
            detected.\MessageBreak
            Note: Loading `tocbibind' without option `not#1'\MessageBreak
            can break several features of `tocbasic'%
            \scr@ifundefinedorrelax{KOMAClassName}{%
              .\MessageBreak
              Loading `tocbibind' before `tocbasic' would avoid\MessageBreak
              this warning message%
            }{}%
          }%
        \fi
      }%
      \tb@tocbibindpatch{toc}{\contentsname}{\tableofcontents}%
      \tb@tocbibindpatch{lof}{\listfigurename}{\listoffigures}%
      \tb@tocbibindpatch{lot}{\listtablename}{\listoftables}%
    }{}%
  }%
}
\newcommand*{\listofname}{List of}
\newcommand*{\listofeachtoc}{%
  \kernel@ifnextchar [%]
    \@listofeachtoc\@@listofeachtoc
}
\newcommand{\@listofeachtoc}[1][]{%
  \doforeachtocfile[{#1}]{\listoftoc{\@currext}}%
}
\newcommand{\@@listofeachtoc}[1]{%
  \doforeachtocfile{\listoftoc{\@currext}}%
}
\providecommand*{\ext@toc}{toc}
\newcommand*{\tocbasic@listhead}[1]{%
  \@ifundefined{tocbasic@listhead@\@currext}{%
    \scr@ifundefinedorrelax{chapter}{%
      \expandafter\def\csname tocbasic@listhead@\@currext\endcsname##1{%
        \Iftocfeature{\@currext}{leveldown}{%
          \Iftocfeature{\@currext}{numbered}{%
            \subsection[##1]{##1}%
          }{%
            \subsection*{##1}%
            \ifvmode\@tempcnta\lastpenalty\@tempskipa\lastskip\unskip\fi
            \begingroup
              \Iftocfeature{\@currext}{totoc}{%
                \expandafter\addxcontentsline\expandafter{\ext@toc}%
                {subsection}{##1}%
              }{}%
              \c@secnumdepth=-\maxdimen
              \subsectionmark{##1}%
            \endgroup
            \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi
          }%
        }{%
          \Iftocfeature{\@currext}{numbered}{%
            \section[##1]{##1}%
          }{%
            \section*{##1}%
            \ifvmode\@tempcnta\lastpenalty\@tempskipa\lastskip\unskip\fi
            \begingroup
              \Iftocfeature{\@currext}{totoc}{%
                \expandafter\addxcontentsline\expandafter{\ext@toc}%
                {section}{##1}%
              }{}%
              \@ifundefined{@mkdouble}{%
                \@mkboth{\MakeMarkcase{##1}}{\MakeMarkcase{##1}}%
              }{%
                \@mkdouble{\MakeMarkcase{##1}}%
              }%
            \endgroup
            \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi
          }%
        }%
      }%
    }{%
      \expandafter\def\csname tocbasic@listhead@\@currext\endcsname##1{%
        \Iftocfeature{\@currext}{leveldown}{%
          \Iftocfeature{\@currext}{numbered}{%
            \section{##1}%
          }{%
            \Iftocfeature{\@currext}{totoc}{%
              \@ifundefined{addsec}{%
                \section*{##1}%
                \ifvmode\@tempcnta\lastpenalty\@tempskipa\lastskip\unskip\fi
                \begingroup
                  \@ifundefined{@mkright}{%
                    \IfActiveMkBoth{\markright{\MakeMarkcase{##1}}}{}%
                  }{%
                    \@mkright{\MakeMarkcase{##1}}%
                  }%
                  \expandafter\addxcontentsline\expandafter{\ext@toc}%
                  {section}{##1}%
                \endgroup
                \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi
              }{%
                \addsec{##1}%
              }%
            }{%
              \section*{##1}%
              \ifvmode\@tempcnta\lastpenalty\@tempskipa\lastskip\unskip\fi
              \begingroup
                \@ifundefined{addsecmark}{%
                  \c@secnumdepth=-\maxdimen
                  \sectionmark{##1}%
                }{%
                  \addsecmark{##1}%
                }%
              \endgroup
              \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi
            }%
          }%
        }{%
          \Iftocfeature{\@currext}{numbered}{%
            \chapter[##1]{##1}%
          }{%
            \chapter*{##1}%
            \ifvmode\@tempcnta\lastpenalty\@tempskipa\lastskip\unskip\fi
            \begingroup
              \@ifundefined{@mkdouble}{%
                \@mkboth{\MakeMarkcase{##1}}{\MakeMarkcase{##1}}%
              }{%
                \@mkdouble{\MakeMarkcase{##1}}%
              }%
              \Iftocfeature{\@currext}{totoc}{%
                \expandafter\addxcontentsline\expandafter{\ext@toc}%
                {chapter}{##1}%
              }{}%
            \endgroup
            \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi
          }%
        }%
      }%
    }%
  }{}%
  \csname tb@@beforehead@hook\endcsname
  \csname tb@\@currext @beforehead@hook\endcsname
  \csname tocbasic@listhead@\@currext\endcsname{#1}%
  \csname tb@\@currext @afterhead@hook\endcsname
  \csname tb@@afterhead@hook\endcsname
}
\newcommand{\BeforeTOCHead}[2][]{%
  \@ifundefined{tb@#1@beforehead@hook}{%
    \expandafter\global\expandafter\let\csname tb@#1@beforehead@hook\endcsname
    \@empty
  }{}%
  \expandafter\g@addto@macro\csname tb@#1@beforehead@hook\endcsname{#2}%
}
\newcommand{\AfterTOCHead}[2][]{%
  \@ifundefined{tb@#1@afterhead@hook}{%
    \expandafter\global\expandafter\let\csname tb@#1@afterhead@hook\endcsname
    \@empty
  }{}%
  \expandafter\g@addto@macro\csname tb@#1@afterhead@hook\endcsname{#2}%
}
\newcommand*{\deftocheading}[1]{%
  \@namedef{tocbasic@listhead@#1}##1}
\newcommand*{\setuptoc}[2]{%
  \@for\@tempa:=#2\do{%
    \scr@trim@spaces\@tempa
    \@namedef{tocbasic@#1@feature@\@tempa}{}%
  }%
}
\newcommand*{\unsettoc}[2]{%
  \@for\@tempa:=#2\do{%
    \scr@trim@spaces\@tempa
    \expandafter\let\csname tocbasic@#1@feature@\@tempa\endcsname\relax
  }%
}
\setuptoc{toc}{nobabel}
\setuptoc{lof}{nobabel}
\setuptoc{lot}{nobabel}
\providecommand*{\iftocfeature}{%
  \PackageWarning{tocbasic}{Usage of deprecated command
    `\string\iftocfeature'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\iftocfeature' by `\string\Iftocfeature'%
  }%
  \Iftocfeature
}
\newcommand*{\Iftocfeature}[2]{%
  \scr@ifundefinedorrelax{tocbasic@#1@feature@#2}{%
    \expandafter\@secondoftwo
  }{%
    \expandafter\@firstoftwo
  }%
}
\newcommand*{\tocbasicautomode}{%
  \let\tb@saved@starttoc\@starttoc
  \let\@starttoc\tocbasic@starttoc
  \BeforeStartingTOC{%
    \let\@starttoc\tb@saved@starttoc
    \expandafter\Ifattoclist\expandafter{\@currext}{}{%
      \addtotoclist[tocbasicautomode]{\@currext}%
    }%
  }%
}
\DefineFamily{KOMAarg}
\DefineFamilyMember[.toc]{KOMAarg}
\newcommand*{\DeclareNewTOC}[2][]{%
  \newif\iftb@nt@float
  \newif\iftb@nt@nonfloat
  \newif\iftb@nt@forcenames
  \def\tb@nt@floattype{\tb@nt@autofloattype}%
  \def\tb@nt@floatpos{tbp}%
  \def\tb@nt@ext{#2}%
  \edef\tb@nt@type{#2}%
  \let\tb@nt@types\relax
  \def\tb@nt@owner{float}%
  \def\tb@nt@name{\expandafter\protect\expandafter\MakeUppercase\tb@nt@type}%
  \let\tb@nt@listname\relax
  \let\tb@nt@counterwithin\@empty
  \let\tb@nt@atbegin\@empty
  \let\tb@nt@atend\@empty
  \def\tb@nt@tocentrystyle{default}%
  \def\tb@nt@tocstyle@options{level=1}%
  \IfArgIsEmpty{#1}{%
    \begingroup
      \let\scr@dte@current\tb@nt@type
      \@ExecuteTOCEntryStyleInitCode{\tb@nt@tocentrystyle}{\tb@nt@type}%
      \def\do@endgroup{\endgroup}%
      \def\do##1{%
        \Ifstr{##1}{numwidth}{%
          \l@addto@macro\do@endgroup{%
            \l@addto@macro{\tb@nt@tocstyle@options}{,numwidth=1.5em}%
          }%
        }{%
          \Ifstr{##1}{indent}{%
            \l@addto@macro\do@endgroup{%
              \l@addto@macro{\tb@nt@tocstyle@options}{,indent=1em}%
            }%
          }{}%
        }%
        \kernel@ifnextchar[%]
          {\@dodefault}%
          {}%
      }%
      \def\@dodefault[##1]{}%
      \scr@dte@doopts
    \do@endgroup
  }{%
    \let\tb@nt@extra@relax@opts\@empty
    \DefineFamilyKey[.toc]{KOMAarg}{type}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@type{##1}}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{tocentrystyle}[default]{%
      \IfArgIsEmpty{##1}{%
        \edef\tb@nt@tocentrystyle{##1}%
        \FamilyKeyStateProcessed
      }{%
        \scr@ifundefinedorrelax{scr@dte@def@l@##1}{%
          \FamilyKeyStateUnknownValue
        }{%
          \edef\tb@nt@tocentrystyle{##1}%
          \FamilyKeyStateProcessed
        }%
      }%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{extension}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@ext{##1}}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{owner}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@owner{##1}}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{category}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@owner{##1}}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{@else@}{\FamilyKeyStateProcessed}%
    \FamilyExecuteOptions[.toc]{KOMAarg}{#1}%
    \RelaxFamilyKey[.toc]{KOMAarg}{@else@}%
  }%
  \expandafter\newcommand\csname ext@\tb@nt@type\endcsname{}%
  \expandafter\let\csname ext@\tb@nt@type\endcsname\tb@nt@ext
  \addtotoclist[\tb@nt@owner]{\csname ext@\tb@nt@type\endcsname}%
  \IfArgIsEmpty{#1}{}{%
    \DefineFamilyKey[.toc]{KOMAarg}{type}{\FamilyKeyStateProcessed}%
    \DefineFamilyKey[.toc]{KOMAarg}{tocentrystyle}{\FamilyKeyStateProcessed}%
    \DefineFamilyKey[.toc]{KOMAarg}{extension}{\FamilyKeyStateProcessed}%
    \DefineFamilyKey[.toc]{KOMAarg}{category}{\FamilyKeyStateProcessed}%
    \Ifstr{\tb@nt@tocentrystyle}{}{}{%
      \begingroup
        \let\scr@dte@current\tb@nt@type
        \@ExecuteTOCEntryStyleInitCode{\tb@nt@tocentrystyle}{\tb@nt@type}%
        \def\do@endgroup{\endgroup}%
        \def\do##1{%
          \l@addto@macro\do@endgroup{%
            \l@addto@macro\tb@nt@extra@relax@opts{%
              \RelaxFamilyKey[.toc]{KOMAarg}{toc##1}%
              \RelaxFamilyKey[.toc]{KOMAarg}{tocentry##1}%
              \RelaxFamilyKey[.toc]{KOMAarg}{tocentry##1:}%
            }%
          }%
          \kernel@ifnextchar[%]
            {\@dodefault{##1}}%
            {\@donodefault{##1}}%
        }%
        \def\@donodefault##1{%
          \l@addto@macro\do@endgroup{%
            \DefineFamilyKey[.toc]{KOMAarg}{toc##1}{%
              \PackageWarning{tocbasic}{you should use `tocentry##1'
                instead\MessageBreak
                of `toc##1'}%
              \l@addto@macro{\tb@nt@tocstyle@options}{,##1={####1}}%
              \FamilyKeyStateProcessed
            }%
            \DefineFamilyKey[.toc]{KOMAarg}{tocentry##1}{%
              \l@addto@macro{\tb@nt@tocstyle@options}{,##1={####1}}%
              \FamilyKeyStateProcessed
            }%
            \DefineFamilyKey[.toc]{KOMAarg}{tocentry##1:}{%
              \l@addto@macro{\tb@nt@tocstyle@options}{,##1:={####1}}%
            }%
          }%
        }%
        \def\@dodefault##1[##2]{%
          \l@addto@macro\do@endgroup{%
            \DefineFamilyKey[.toc]{KOMAarg}{toc##1}[##2]{%
              \PackageWarning{tocbasic}{you should use `tocentry##1'
                instead\MessageBreak
                of `toc##1'}%
              \l@addto@macro{\tb@nt@tocstyle@options}{,##1={####1}}%
              \FamilyKeyStateProcessed
            }%
            \DefineFamilyKey[.toc]{KOMAarg}{tocentry##1}[##2]{%
              \l@addto@macro{\tb@nt@tocstyle@options}{,##1={####1}}%
              \FamilyKeyStateProcessed
            }%
            \DefineFamilyKey[.toc]{KOMAarg}{tocentry##1:}{%
              \l@addto@macro{\tb@nt@tocstyle@options}{,##1:={####1}}%
            }%
          }%
        }%
        \scr@dte@doopts
      \do@endgroup
    }%
    \FamilyStringKey[.toc]{KOMAarg}{atbegin}{\tb@nt@atbegin}%
    \FamilyStringKey[.toc]{KOMAarg}{atend}{\tb@nt@atend}%
    \DefineFamilyKey[.toc]{KOMAarg}{counterwithin}{%
      \edef\tb@nt@counterwithin{##1}\FamilyKeyStateProcessed
    }%
    \FamilyBoolKey[.toc]{KOMAarg}{float}{tb@nt@float}%
    \DefineFamilyKey[.toc]{KOMAarg}{floatpos}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@floatpos{##1}}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{floattype}{%
      \FamilySetCounterMacro{KOMAarg}{floattype}{\reserved@d}{##1}%
      \ifx\FamilyKeyState\FamilyKeyStateProcessed
        \ifnum 0=
          \ifnum\reserved@d<1 0 \else\ifnum\reserved@d>31 0 \else 1 \fi\fi
          \FamilyKeyStateUnknownValue
        \else
          \let\tb@nt@floattype\reserved@d
        \fi
      \fi
    }%
    \FamilyBoolKey[.toc]{KOMAarg}{forcenames}{tb@nt@forcenames}%
    \DefineFamilyKey[.toc]{KOMAarg}{hang}{%
      \scr@ifundefinedorrelax{KV@KOMAarg.toc@tocnumwidth}{%
        \PackageWarning{tocbasic}{%
          deprecated option `hang'.\MessageBreak
          Option will be ignored, because toc entry style\MessageBreak
          `\tb@nt@tocentrystyle' does not provide option `numwidth'%
        }%
      }{%
        \PackageWarning{tocbasic}{%
          deprecated option `hang'.\MessageBreak
          You should replace option `hang' by option\MessageBreak
          `tocentrynumwidth'%
        }%
        \l@addto@macro\tb@nt@tocstyle@options{,numwidth={##1}}%
      }%
      \FamilyKeyStateProcessed
    }%
    \scr@ifundefinedorrelax{KV@KOMAarg.toc@tocnumwidth}{}{%
      \l@addto@macro\tb@nt@tocstyle@options{,numwidth=1.5em}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{indent}{%
      \scr@ifundefinedorrelax{KV@KOMAarg.toc@tocindent}{%
        \PackageWarning{tocbasic}{%
          deprecated option `indent'.\MessageBreak
          Option will be ignored, because toc entry style\MessageBreak
          `\tb@nt@tocentrystyle' does not provide option `indent'%
        }%
      }{%
        \PackageWarning{tocbasic}{%
          deprecated option `indent'.\MessageBreak
          You should replace option `indent' by option\MessageBreak
          `tocentryindent'%
        }%
        \l@addto@macro\tb@nt@tocstyle@options{,indent={##1}}%
      }%
      \FamilyKeyStateProcessed
    }%
    \scr@ifundefinedorrelax{KV@KOMAarg.toc@tocindent}{}{%
      \l@addto@macro\tb@nt@tocstyle@options{,indent=1em}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{level}{%
      \PackageWarning{tocbasic}{%
        deprecated option `level'.\MessageBreak
        You should replace option `level' by option\MessageBreak
        `tocentrylevel'%
      }%
      \l@addto@macro\tb@nt@tocstyle@options{,level={##1}}%
      \FamilyKeyStateProcessed
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{listname}{%
      \tb@ifvalueisnotempty{##1}{\def\tb@nt@listname{##1}}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{name}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@name{##1}}%
    }%
    \FamilyBoolKey[.toc]{KOMAarg}{nonfloat}{tb@nt@nonfloat}%
    \DefineFamilyKey[.toc]{KOMAarg}{types}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@types{##1}}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{setup}{%
      \setuptoc\tb@nt@ext{##1}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{unset}{%
      \unsettoc\tb@nt@ext{##1}%
    }%
    \FamilyExecuteOptions[.toc]{KOMAarg}{#1}%
    \RelaxFamilyKey[.toc]{KOMAarg}{unset}%
    \RelaxFamilyKey[.toc]{KOMAarg}{setup}%
    \RelaxFamilyKey[.toc]{KOMAarg}{types}%
    \RelaxFamilyKey[.toc]{KOMAarg}{nonfloat}%
    \RelaxFamilyKey[.toc]{KOMAarg}{name}%
    \RelaxFamilyKey[.toc]{KOMAarg}{listname}%
    \RelaxFamilyKey[.toc]{KOMAarg}{level}%
    \RelaxFamilyKey[.toc]{KOMAarg}{indent}%
    \RelaxFamilyKey[.toc]{KOMAarg}{hang}%
    \RelaxFamilyKey[.toc]{KOMAarg}{forcenames}%
    \RelaxFamilyKey[.toc]{KOMAarg}{floatpos}%
    \RelaxFamilyKey[.toc]{KOMAarg}{float}%
    \RelaxFamilyKey[.toc]{KOMAarg}{counterwithin}%
    \RelaxFamilyKey[.toc]{KOMAarg}{atend}%
    \RelaxFamilyKey[.toc]{KOMAarg}{atbegin}%
    \tb@nt@extra@relax@opts
    \RelaxFamilyKey[.toc]{KOMAarg}{category}%
    \RelaxFamilyKey[.toc]{KOMAarg}{owner}%
    \RelaxFamilyKey[.toc]{KOMAarg}{extension}%
    \RelaxFamilyKey[.toc]{KOMAarg}{tocentrystyle}%
    \RelaxFamilyKey[.toc]{KOMAarg}{type}%
  }%
  \expandafter\let\csname tb@nt@type@\tb@nt@ext\endcsname\tb@nt@type
  \scr@ifundefinedorrelax{tb@nt@types}{%
    \edef\tb@nt@types{\tb@nt@type s}%
  }{}%
  \scr@ifundefinedorrelax{tb@nt@listname}{%
    \protected@edef\tb@nt@listname{List of \protect\MakeUppercase\tb@nt@types}%
  }{}%
  \@ifundefined{\tb@nt@type name}{%
    \expandafter\protected@edef\csname \tb@nt@type name\endcsname{\tb@nt@name}%
  }{%
    \iftb@nt@forcenames
      \expandafter\protected@edef\csname \tb@nt@type name\endcsname
      {\tb@nt@name}%
    \fi
  }%
  \@ifundefined{list\tb@nt@type name}{%
    \expandafter\let\csname list\tb@nt@type name\endcsname\tb@nt@listname
  }{%
    \iftb@nt@forcenames
      \expandafter\let\csname list\tb@nt@type name\endcsname\tb@nt@listname
    \fi
  }%
  \expandafter\newcommand\csname listof\tb@nt@ext name\expandafter\endcsname
    \expandafter{\csname list\tb@nt@type name\endcsname}%
  \begingroup\edef\@tempa{\endgroup
    \noexpand\newcommand*\csname listof\tb@nt@types\endcsname{%
      \noexpand\listoftoc{%
        \expandafter\noexpand\csname ext@\tb@nt@type\endcsname}%
    }%
  }\@tempa
  \Ifstr{\tb@nt@tocentrystyle}{}{%
    \@ifundefined{l@\tb@nt@type}{%
      \PackageWarning{tocbasic}{%
        \expandafter\string\csname l@\tb@nt@type\endcsname\space
        undefined!\MessageBreak
        I hope you know, what you are doing, but\MessageBreak
        maybe it would be better to use proper\MessageBreak
        `tocentrystyle' settings%
      }%
    }{}%
  }{%
    \edef\reserved@a{%
      \noexpand\DeclareTOCStyleEntry[%
        {\unexpanded\expandafter{\tb@nt@tocstyle@options}}%
      ]{\tb@nt@tocentrystyle}{\tb@nt@type}%
    }%
    \reserved@a
  }%
  \@ifundefined{listof\tb@nt@ext entryname}{%
    \expandafter\let\csname listof\tb@nt@ext entryname\endcsname\tb@nt@name
  }{}%
  \begingroup\edef\@tempa{\endgroup
    \noexpand\newcommand*\csname setup\tb@nt@types\endcsname{%
      \noexpand\setuptoc{\tb@nt@ext}%
    }%
  }\@tempa
  \@tempswafalse
  \iftb@nt@float
    \expandafter\newcommand\expandafter*\csname fps@\tb@nt@type\expandafter
    \endcsname\expandafter{\tb@nt@floatpos}%
    \expandafter\newcommand\expandafter*\csname ftype@\tb@nt@type\expandafter
    \endcsname\expandafter{\tb@nt@floattype}%
    \begingroup
      \edef\@tempa{%
        \noexpand\endgroup
        \noexpand\newenvironment{\tb@nt@type}{%
          \noexpand\kernel@ifnextchar[%]
          {\noexpand\tb@atbegin@after\noexpand\@float{\tb@nt@type}}%
          {\noexpand\edef\noexpand\reserved@a{%
              \noexpand\noexpand\noexpand\tb@atbegin@after
              \noexpand\noexpand\noexpand\@float{\tb@nt@type}%
              [\noexpand\csname fps@\tb@nt@type\noexpand\endcsname]}%
            \noexpand\reserved@a}%
        }{%
          \noexpand\csname \tb@nt@type @atend\noexpand\endcsname
          \noexpand\end@float
        }%
        \noexpand\newenvironment{\tb@nt@type*}{%
          \noexpand\kernel@ifnextchar[%]
          {\noexpand\tb@atbegin@after\noexpand\@dblfloat{\tb@nt@type}}%
          {\noexpand\edef\noexpand\reserved@a{%
              \noexpand\noexpand\noexpand\tb@atbegin@after
              \noexpand\noexpand\noexpand\@dblfloat{\tb@nt@type}%
              [\noexpand\csname fps@\tb@nt@type\noexpand\endcsname]}%
            \noexpand\reserved@a}%
        }{%
          \noexpand\csname \tb@nt@type @atend\noexpand\endcsname
          \noexpand\end@dblfloat
        }%
      }%
    \@tempa
    \@tempswatrue
  \fi
  \iftb@nt@nonfloat
    \begingroup
      \edef\@tempa{%
        \noexpand\endgroup
        \noexpand\newenvironment{\tb@nt@type-}{%
          \noexpand\trivlist\noexpand\item\noexpand\relax
          \noexpand\minipage{\noexpand\linewidth}%
          \noexpand\def\noexpand\@captype{\tb@nt@type}%
          \noexpand\csname \tb@nt@type @atbegin\noexpand\endcsname
        }{%
          \noexpand\csname \tb@nt@type @atend\noexpand\endcsname
          \noexpand\endminipage\noexpand\endtrivlist
        }%
      }%
    \@tempa
    \@tempswatrue
  \fi
  \if@tempswa
    \@ifundefined{c@\tb@nt@type}{%
      \newcounter{\tb@nt@type}%
    }{%
      \PackageWarning{tocbasic}{using already defined counter `\tb@nt@type'}%
    }%
    \ifx\tb@nt@counterwithin\@empty\else
      \@addtoreset{\tb@nt@type}{\tb@nt@counterwithin}%
      \begingroup\edef\@tempa{%
        \noexpand\endgroup
        \noexpand\renewcommand*\expandafter\noexpand
        \csname the\tb@nt@type\endcsname{%
          \expandafter\noexpand\csname the\tb@nt@counterwithin\endcsname
          .\noexpand\arabic{\tb@nt@type}%
        }%
      }\@tempa
    \fi
    \begingroup
      \edef\@tempa{%
        \noexpand\endgroup
        \noexpand\newcommand*\expandafter\noexpand
        \csname \tb@nt@type format\endcsname{%
          \expandafter\noexpand\csname \tb@nt@type name\endcsname
          \noexpand\nobreakspace
          \expandafter\noexpand\csname the\tb@nt@type\endcsname
          \ifx\tb@nt@counterwithin\@empty\else
            \noexpand\csname autodot\endcsname
          \fi
        }%
        \noexpand\newcommand*\expandafter\noexpand
        \csname fnum@\tb@nt@type\endcsname{%
          \expandafter\noexpand\csname \tb@nt@type format\endcsname
        }%
      }%
    \@tempa
    \expandafter\newcommand\expandafter*\csname \tb@nt@type @atbegin\expandafter
    \endcsname\expandafter{\tb@nt@atbegin}%
    \expandafter\newcommand\expandafter*\csname \tb@nt@type @atend\expandafter
    \endcsname\expandafter{\tb@nt@atend}%
  \fi
}
\newcommand*{\tb@atbegin@after}[3]{}
\def\tb@atbegin@after#1#2[#3]{%
  #1{#2}[#3]%
  \csname #2@atbegin\endcsname
}
\newcommand*{\tb@ifvalueisnotempty}[1]{%
  \Ifstr{#1}{}{%
    \FamilyKeyStateUnknownValue
    \expandafter\@gobble
  }{%
    \FamilyKeyStateProcessed
    \expandafter\@firstofone
  }%
}
\newcommand*{\tb@nt@autofloattype}{16}
%%% From File: $Id: scrkernel-tocstyle.dtx 3507 2020-06-11 14:57:03Z kohm $
%%%            (run: body)
\newcommand*{\scr@numberline}[1]{%
  \numberline@box{%
    \numberline@prefix
    \Ifstr{#1}{}{#1}{%
      \numberline@numberformat{#1}%
    }%
    \numberline@postfix
  }%
}
\newcommand*{\usetocbasicnumberline}[1][%
  \PackageInfo{tocbasic}{Using my definition of `\string\numberline'}%
]{%
  \@tempswatrue
  \begingroup
    \def\scr@numberline##1{\global\@tempswafalse}%
    \@tempdima\maxdimen
    \sbox\@tempboxa{\numberline{0}}%
  \endgroup
  \if@tempswa #1\renewcommand*{\numberline}[1]{\scr@numberline{##1}}\fi
}
\newcommand*{\numberline@prefix}{}
\newcommand*{\numberline@postfix}{\hfil}
\newcommand*{\numberline@numberformat}[1]{%
  \Ifstr{#1}{}{}{\numberline@numberprefix#1\numberline@numberpostfix}%
}
\newcommand*{\numberline@numberprefix}{}
\newcommand*{\numberline@numberpostfix}{}
\newcommand*{\numberline@box}[1]{\hb@xt@\@tempdima{#1}}
\DefineFamily{KOMAarg}
\DefineFamilyMember[.dte]{KOMAarg}
\newcommand*{\@DefineTOCEntryOption}[2]{%
  \edef\scr@dte@doopts{%
    \unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2}%
  }%
  \kernel@ifnextchar [%]
    {\@DefineTOCEntryOptionWithDefault{#1}{#2}}%
    {\@DefineTOCEntryOptionWithoutDefault{#1}{#2}}%
}
\newcommand*{\@DefineTOCEntryOptionWithoutDefault}[3]{%
  \DefineFamilyKey[.dte]{KOMAarg}{#2}{#3}%
}
\newcommand*{\@DefineTOCEntryOptionWithDefault}{}
\def\@DefineTOCEntryOptionWithDefault#1#2[#3]#4{%
  \l@addto@macro\scr@dte@doopts{[{#3}]}%
  \DefineFamilyKey[.dte]{KOMAarg}{#2}[{#3}]{#4}%
}
\newcommand*{\@RelaxTOCEntryOptions}{%
  \begingroup
    \def\do@endgroup{\endgroup}%
    \def\do##1{%
      \l@addto@macro\do@endgroup{%
        \RelaxFamilyKey[.dte]{KOMAarg}{##1}%
      }%
      \scr@dte@gobbleopt
    }%
    \scr@dte@doopts
  \do@endgroup
}
\newcommand{\scr@dte@gobbleopt}[1][]{}
\newcommand*{\@DefineTOCEntryListOption}[2]{%
  \kernel@ifnextchar [%]
    {\@DefineTOCEntryListOptionWithDefault{#1}{#2}}
    {\@DefineTOCEntryListOptionWithoutDefault{#1}{#2}}%
}
\newcommand*{\@DefineTOCEntryListOptionWithoutDefault}[5]{%
  \@TOCEntryStyleNeedsCommandByOption{#1}{#3}{#4}{#2}{#5}%
  \@DefineTOCEntryOption{#1}{#2}{%
    \expandafter\protected@edef\csname #3\scr@dte@current#4\endcsname{##1}%
    \FamilyKeyStateProcessed
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
    \scr@ifundefinedorrelax{#3##1#4}{\FamilyKeyStateUnknownValue}{%
      \expandafter\let
      \csname #3\scr@dte@current#4\expandafter\endcsname
      \csname #3##1#4\endcsname
      \FamilyKeyStateProcessed
    }%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2+}{%
    \expandafter\protected@edef\csname #2\scr@dte@current#4\endcsname{%
      \csname #2\scr@dte@current#4\endcsname,##1}%
    \FamilyKeyStateProcessed
  }%
  \edef\scr@dte@doopts{%
    \unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}\noexpand\do{#2+}%
  }%
}
\newcommand*{\@DefineTOCEntryListOptionWithDefault}{}
\def\@DefineTOCEntryListOptionWithDefault#1#2[#3]#4#5#6{%
  \@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5}{#2}{#6}%
  \@DefineTOCEntryOption{#1}{#2}[{#3]}{%
    \expandafter\protected@edef\csname #4\scr@dte@current#5\endcsname{##1}%
    \FamilyKeyStateProcessed
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
    \scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{%
      \expandafter\let
      \csname #4\scr@dte@current#5\expandafter\endcsname
      \csname #4##1#5\endcsname
      \FamilyKeyStateProcessed
    }%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2+}{%
    \expandafter\protected@edef\csname #4\scr@dte@current#5\endcsname{%
      \csname #4\scr@dte@current#5\endcsname,##1}%
    \FamilyKeyStateProcessed
  }%
  \edef\scr@dte@doopts{%
    \unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}\noexpand\do{#2+}%
  }%
}
\newcommand*{\@DefineTOCEntryLengthOption}[2]{%
  \kernel@ifnextchar [%]
    {\@DefineTOCEntryLengthOptionWithDefault{#1}{#2}}
    {\@DefineTOCEntryLengthOptionWithoutDefault{#1}{#2}}%
}
\newcommand*{\@DefineTOCEntryLengthOptionWithoutDefault}[5]{%
  \@TOCEntryStyleNeedsCommandByOption{#1}{#3}{#4}{#2}{#5}%
  \@DefineTOCEntryOption{#1}{#2}{%
    \@DefineTOCEntryLengthOptionMacro{#2}{#3}{#4}{##1}%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
    \scr@ifundefinedorrelax{#3##1#4}{\FamilyKeyStateUnknownValue}{%
      \expandafter\let
      \csname #3\scr@dte@current#4\expandafter\endcsname
      \csname #3##1#4\endcsname
      \FamilyKeyStateProcessed
    }%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2+}{%
    \@DefineTOCEntryAddLengthOptionMacro{#2+}{#3}{#4}{##1}%
  }%
  \edef\scr@dte@doopts{%
    \unexpanded\expandafter{\scr@dte@doopts}%
    \noexpand\do{#2:}\noexpand\do{#2+}%
  }%
}
\newcommand*{\@DefineTOCEntryLengthOptionWithDefault}{}
\def\@DefineTOCEntryLengthOptionWithDefault#1#2[#3]#4#5#6{%
  \@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5}{#2}{#6}%
  \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
    \@DefineTOCEntryLengthOptionMacro{#2}{#4}{#5}{##1}%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
    \scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{%
      \expandafter\let
      \csname #4\scr@dte@current#5\expandafter\endcsname
      \csname #4##1#5\endcsname
      \FamilyKeyStateProcessed
    }%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2+}{%
    \@DefineTOCEntryAddLengthOptionMacro{#2+}{#4}{#5}{##1}%
  }%
  \edef\scr@dte@doopts{%
    \unexpanded\expandafter{\scr@dte@doopts}%
    \noexpand\do{#2:}\noexpand\do{#2+}%
  }%
}
\newcommand*{\@DefineTOCEntryLengthOptionMacro}[4]{%
  \protected@edef\reserved@a{%
    \noexpand\FamilySetLength{KOMAarg}{#1}{\noexpand\@tempskipa}{#4}%
  }\reserved@a
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \ifscr@dte@expandtopt
      \expandafter\edef\csname #2\scr@dte@current#3\endcsname{%
        \the\@tempskipa}%
    \else
      \expandafter\protected@edef\csname #2\scr@dte@current#3\endcsname{#4}%
    \fi
  \fi
}
\newcommand*{\@DefineTOCEntryAddLengthOptionMacro}[4]{%
  \@ifundefined{#2\scr@dte@current#3}{%
    \FamilyKeyStateUnknownValue
  }{%
    \protected@edef\reserved@a{%
      \noexpand\FamilySetLength{KOMAarg}{#1}{\noexpand\@tempskipa}{#4}%
    }\reserved@a
    \ifx\FamilyKeyState\FamilyKeyStateProcessed
      \ifscr@dte@expandtopt
        \expandafter\edef\csname #2\scr@dte@current#3\endcsname{%
          \the\glueexpr\@tempskipa
          +\csname #2\scr@dte@current#3\endcsname\relax}%
      \else
        \expandafter\protected@edef\csname #2\scr@dte@current#3\endcsname{%
          \the\glueexpr #4%
            +\csname #2\scr@dte@current#3\endcsname\relax}%
      \fi
    \fi
  }%
}
\newcommand*{\@DefineTOCEntryNumberOption}[2]{%
  \kernel@ifnextchar [%]
    {\@DefineTOCEntryNumberOptionWithDefault{#1}{#2}}
    {\@DefineTOCEntryNumberOptionWithoutDefault{#1}{#2}}%
}
\newcommand*{\@DefineTOCEntryNumberOptionWithoutDefault}[5]{%
  \@TOCEntryStyleNeedsCommandByOption{#1}{#3}{#4}{#2}{#5}%
  \@DefineTOCEntryOption{#1}{#2}{%
    \@DefineTOCEntryNumberOptionMacro{#2}{#3}{#4}{##1}%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
    \scr@ifundefinedorrelax{#3##1#4}{\FamilyKeyStateUnknownValue}{%
      \expandafter\let
      \csname #3\scr@dte@current#4\expandafter\endcsname
      \csname #3##1#4\endcsname
      \FamilyKeyStateProcessed
    }%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2+}{%
    \@DefineTOCEntryAddNumberOptionMacro{#2+}{#3}{#4}{##1}%
  }%
  \edef\scr@dte@doopts{%
    \unexpanded\expandafter{\scr@dte@doopts}%
    \noexpand\do{#2:}\noexpand\do{#2+}%
  }%
}
\newcommand*{\@DefineTOCEntryNumberOptionWithDefault}{}
\def\@DefineTOCEntryNumberOptionWithDefault#1#2[#3]#4#5#6{%
  \@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5}{#2}{#6}%
  \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
    \@DefineTOCEntryNumberOptionMacro{#2}{#4}{#5}{##1}%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
    \scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{%
      \expandafter\let
      \csname #4\scr@dte@current#5\expandafter\endcsname
      \csname #4##1#5\endcsname
      \FamilyKeyStateProcessed
    }%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2+}{%
    \@DefineTOCEntryAddNumberOptionMacro{#2+}{#4}{#5}{##1}%
  }%
  \edef\scr@dte@doopts{%
    \unexpanded\expandafter{\scr@dte@doopts}%
    \noexpand\do{#2:}\noexpand\do{#2+}%
  }%
}
\newcommand*{\@DefineTOCEntryNumberOptionMacro}[4]{%
  \protected@edef\reserved@a{%
    \noexpand\FamilySetCounterMacro{KOMAarg}{#1}{%
      \expandafter\noexpand\csname #2\scr@dte@current#3\endcsname
    }{#4}%
  }\reserved@a
}
\newcommand*{\@DefineTOCEntryAddNumberOptionMacro}[4]{%
  \@ifundefined{#2\scr@dte@current#3}{%
    \FamilyKeyStateUnknownValue
  }{%
    \FamilySetCounterMacro{KOMAarg}{#1}{%
      \reserved@a
    }{#4}%
    \ifx\FamilyKeyState\FamilyKeyStateProcessed
      \expandafter\edef\csname #2\scr@dte@current#3\endcsname{%
        \the\numexpr \reserved@a+\csname #2\scr@dte@current#3\endcsname\relax
      }%
    \fi
  }%
}
\newcommand*{\@DefineTOCEntryBooleanOption}[2]{%
  \kernel@ifnextchar [%]
    {\@DefineTOCEntryBoolOptionWithDefault{#1}{#2}}
    {\@DefineTOCEntryBoolOptionWithoutDefault{#1}{#2}}%
}
\newcommand*{\@DefineTOCEntryBoolOptionWithoutDefault}[5]{%
  \@TOCEntryStyleNeedsCommandByOption{#1}{if#3}{#4}{#2}{#5}%
  \@TOCEntryStyleNeedsCommandByOption{#1}{#3}{#4false}{#2}{#5}%
  \@TOCEntryStyleNeedsCommandByOption{#1}{#3}{#4false}{#2}{#5}%
  \@DefineTOCEntryOption{#1}{#2}[true]{%
    \@DefineTOCEntryBoolOptionMacro{#2}{#3}{#4}{##1}%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
    \scr@ifundefinedorrelax{if#3##1#4}{\FamilyKeyStateUnknownValue}{%
      \expandafter\let
      \csname if#3\scr@dte@current#4\expandafter\endcsname
      \csname if#3##1#4\endcsname
      \FamilyKeyStateProcessed
    }%
  }%
  \edef\scr@dte@doopts{%
    \unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
  }%
}
\newcommand*{\@DefineTOCEntryBoolOptionWithDefault}{}
\def\@DefineTOCEntryBoolOptionWithDefault#1#2[#3]#4#5#6{%
  \@TOCEntryStyleNeedsCommandByOption{#1}{if#4}{#5}{#2}{#6}%
  \@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5true}{#2}{#6}%
  \@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5false}{#2}{#6}%
  \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
    \@DefineTOCEntryBoolOptionMacro{#2}{#4}{#5}{##1}%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
    \scr@ifundefinedorrelax{if#4##1#5}{\FamilyKeyStateUnknownValue}{%
      \expandafter\let
      \csname if#4\scr@dte@current#5\expandafter\endcsname
      \csname if#4##1#5\endcsname
      \FamilyKeyStateProcessed
    }%
  }%
  \edef\scr@dte@doopts{%
    \unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
  }%
}
\newcommand*{\@DefineTOCEntryBoolOptionMacro}[4]{%
  \@ifundefined{if#2\scr@dte@current#3}{%
    \expandafter\newif\csname if#2\scr@dte@current#3\endcsname
  }{}%
  \FamilySetBool{KOMAarg}{#1}{#2\scr@dte@current#3}{#4}%
}
\newcommand*{\@DefineTOCEntryIfOption}[2]{%
  \kernel@ifnextchar [%]
    {\@DefineTOCEntryIfOptionWithDefault{#1}{#2}}
    {\@DefineTOCEntryIfOptionWithoutDefault{#1}{#2}}%
}
\newcommand*{\@DefineTOCEntryIfOptionWithoutDefault}[5]{%
  \@TOCEntryStyleNeedsCommandByOption{#1}{If#3}{#4}{#2}{#5}%
  \@DefineTOCEntryOption{#1}{#2}[true]{%
    \@DefineTOCEntryIfOptionMacro{#2}{#3}{#4}{##1}%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
    \scr@ifundefinedorrelax{If#3##1#4}{\FamilyKeyStateUnknownValue}{%
      \expandafter\let
      \csname If#3\scr@dte@current#4\expandafter\endcsname
      \csname If#3##1#4\endcsname
      \FamilyKeyStateProcessed
    }%
  }%
  \edef\scr@dte@doopts{%
    \unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
  }%
}
\newcommand*{\@DefineTOCEntryIfOptionWithDefault}{}
\def\@DefineTOCEntryIfOptionWithDefault#1#2[#3]#4#5#6{%
  \@TOCEntryStyleNeedsCommandByOption{#1}{If#4}{#5}{#2}{#6}%
  \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
    \@DefineTOCEntryIfOptionMacro{#2}{#4}{#5}{##1}%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
    \scr@ifundefinedorrelax{If#4##1#5}{\FamilyKeyStateUnknownValue}{%
      \expandafter\let
      \csname If#4\scr@dte@current#5\expandafter\endcsname
      \csname If#4##1#5\endcsname
      \FamilyKeyStateProcessed
    }%
  }%
  \edef\scr@dte@doopts{%
    \unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
  }%
}
\newcommand*{\@DefineTOCEntryIfOptionMacro}[4]{%
  \FamilySetBool{KOMAarg}{#1}{@tempswa}{#4}%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \if@tempswa
      \expandafter\let\csname If#2\scr@dte@current#3\endcsname\@firstoftwo
    \else
      \expandafter\let\csname If#2\scr@dte@current#3\endcsname\@secondoftwo
    \fi
  \fi
}
\newcommand*{\@DefineTOCEntryCommandOption}[2]{%
  \kernel@ifnextchar [%]
    {\@DefineTOCEntryCommandOptionWithDefault{#1}{#2}}
    {\@DefineTOCEntryCommandOptionWithoutDefault{#1}{#2}}%
}
\newcommand*{\@DefineTOCEntryCommandOptionWithoutDefault}[4]{%
  \@testopt{\@@DefineTOCEntryCommandOptionWithoutDefault{#1}{#2}{#3}{#4}}0%
}
\newcommand*{\@@DefineTOCEntryCommandOptionWithoutDefault}{}%
\def\@@DefineTOCEntryCommandOptionWithoutDefault#1#2#3#4[#5]#6{%
  \@TOCEntryStyleNeedsCommandByOption{#1}{#3}{#4}{#2}{#6}%
  \ifcase #5
    \@DefineTOCEntryOption{#1}{#2}{%
      \@DefineTOCEntryCommandOptionMacro{#2}{#3}{#4}[#5]{##1}%
    }%
    \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
      \scr@ifundefinedorrelax{#3##1#4}{\FamilyKeyStateUnknownValue}{%
        \expandafter\let
        \csname #3\scr@dte@current#4\expandafter\endcsname
        \csname #3##1#4\endcsname
        \FamilyKeyStateProcessed
      }%
    }%
    \edef\scr@dte@doopts{%
      \unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
    }%
  \or
    \@DefineTOCEntryOption{#1}{#2}{%
      \@DefineTOCEntryCommandOptionMacro{#2}{#3}{#4}[#5]{##1{####1}}%
    }%
    \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
      \scr@ifundefinedorrelax{#3##1#4}{\FamilyKeyStateUnknownValue}{%
        \expandafter\let
        \csname #3\scr@dte@current#4\expandafter\endcsname
        \csname #3##1#4\endcsname
        \FamilyKeyStateProcessed
      }%
    }%
    \edef\scr@dte@doopts{%
      \unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
    }%
  \else
    \PackageError{tocbasic%
    }{only one argument supported}{%
      \string\DefineTOCEntryCommandOption\space currently supports only
      commands with\MessageBreak
      at most one argument not #5}%
  \fi
}
\newcommand*{\@DefineTOCEntryCommandOptionWithDefault}{}
\def\@DefineTOCEntryCommandOptionWithDefault#1#2[#3]#4#5{%
  \@testopt{\@@DefineTOCEntryCommandOptionWithDefault{#1}{#2}{#3}{#4}{#5}}0%
}
\def\@@DefineTOCEntryCommandOptionWithDefault#1#2#3#4#5[#6]#7{%
  \@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5}{#2}{#7}%
  \ifcase #6
    \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
      \@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1}%
    }%
    \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
      \scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{%
        \expandafter\let
        \csname #4\scr@dte@current#5\expandafter\endcsname
        \csname #4##1#5\endcsname
        \FamilyKeyStateProcessed
      }%
    }%
    \edef\scr@dte@doopts{%
      \unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
    }%
  \or
    \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
      \@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}}%
    }%
    \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
      \scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{%
        \expandafter\let
        \csname #4\scr@dte@current#5\expandafter\endcsname
        \csname #4##1#5\endcsname
        \FamilyKeyStateProcessed
      }%
    }%
    \edef\scr@dte@doopts{%
      \unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
    }%
  \or
    \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
      \@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}}%
    }%
    \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
      \scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{%
        \expandafter\let
        \csname #4\scr@dte@current#5\expandafter\endcsname
        \csname #4##1#5\endcsname
        \FamilyKeyStateProcessed
      }%
    }%
    \edef\scr@dte@doopts{%
      \unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
    }%
  \else
    \PackageError{tocbasic%
    }{only one argument supported}{%
      \string\DefineTOCEntryCommandOption\space currently supports only
      commands with\MessageBreak
      at most two argument not #6}%
  \fi
}
\newcommand*{\@DefineTOCEntryCommandOptionMacro}[3]{%
  \@testopt{\@@DefineTOCEntryCommandOptionMacro{#1}{#2}{#3}}0%
}
\newcommand*{\@@DefineTOCEntryCommandOptionMacro}{}
\long\def\@@DefineTOCEntryCommandOptionMacro#1#2#3[#4]#5{%
  \let\l@ngrel@x\long
  \expandafter\@yargdef\csname #2\scr@dte@current#3\endcsname\@ne{#4}{#5}%
  \FamilyKeyStateProcessed
}
\newcommand{\@AddToDeclareTOCEntryStylePreCheckNeeds}[1]{%
  \expandafter\providecommand\csname scr@dte@precheck\endcsname[1]{}%
  \expandafter\l@addto@macro@a\csname scr@dte@precheck\endcsname
}
\newcommand{\@PreToDeclareTOCEntryStylePreCheckNeeds}[1]{%
  \expandafter\providecommand\csname scr@dte@precheck\endcsname[1]{}%
  \expandafter\l@preto@macro@a\csname scr@dte@precheck\endcsname
}
\newcommand*{\@TOCEntryStyleNeedsCommandByOption}[5]{%
  \expandafter\providecommand\expandafter*\csname scr@dte@#1@needs\endcsname{}%
  \expandafter\l@addto@macro\csname scr@dte@#1@needs\endcsname{%
    \do{#2}{#3}{#4}{#5}%
  }%
}
\newcommand{\TOCEntryStyleInitCode}[1]{%
  \scr@ifundefinedorrelax{scr@dte@#1@init}{%
    \expandafter\providecommand\expandafter*%
    \csname scr@dte@#1@init\endcsname[1]%
  }{%
    \expandafter\l@addto@macro@a\csname scr@dte@#1@init\endcsname
  }%
}
\newcommand{\TOCEntryStyleStartInitCode}[1]{%
  \scr@ifundefinedorrelax{scr@dte@#1@init}{%
    \expandafter\providecommand\expandafter*%
    \csname scr@dte@#1@init\endcsname[1]%
  }{%
    \expandafter\l@preto@macro@a\csname scr@dte@#1@init\endcsname
  }%
}
\newcommand*{\@ExecuteTOCEntryStyleInitCode}[2]{%
  \let\scr@dte@doopts\@empty
  \expandafter\let\csname scr@dte@#1@needs\endcsname\relax
  \scr@ifundefinedorrelax{scr@dte@#1@init}{}{%
    \def\DefineTOCEntryBooleanOption{\@DefineTOCEntryBooleanOption{#1}}%
    \def\DefineTOCEntryCommandOption{\@DefineTOCEntryCommandOption{#1}}%
    \def\DefineTOCEntryIfOption{\@DefineTOCEntryIfOption{#1}}%
    \def\DefineTOCEntryLengthOption{\@DefineTOCEntryLengthOption{#1}}%
    \def\DefineTOCEntryListOption{\@DefineTOCEntryListOption{#1}}%
    \def\DefineTOCEntryNumberOption{\@DefineTOCEntryNumberOption{#1}}%
    \def\DefineTOCEntryOption{\@DefineTOCEntryOption{#1}}%
    \def\AddToDeclareTOCEntryStylePreCheckNeeds{%
      \@AddToDeclareTOCEntryStylePreCheckNeeds{#1}}%
    \def\PreToDeclareTOCEntryStylePreCheckNeeds{%
      \@PreToDeclareTOCEntryStylePreCheckNeeds{#1}}%
    \def\TOCEntryStyleNeedsCommandByOption{%
      \@TOCEntryStyleNeedsCommandByOption{#1}}%
    \@nameuse{scr@dte@#1@init}{#2}%
    \let\TOCEntryStyleNeedsCommandByOption\relax
    \let\PreToDeclareTOCEntryStylePreCheckNeeds\relax
    \let\AddToDeclareTOCEntryStylePreCheckNeeds\relax
    \let\DefineTOCEntryOption\relax
    \let\DefineTOCEntryNumberOption\relax
    \let\DefineTOCEntryListOption\relax
    \let\DefineTOCEntryLengthOption\relax
    \let\DefineTOCEntryIfOption\relax
    \let\DefineTOCEntryCommandOption\relax
    \let\DefineTOCEntryBooleanOption\relax
  }%
}
\newcommand*{\DeclareTOCStyleEntry}[3][]{%
  \scr@ifundefinedorrelax{scr@dte@def@l@#2}{%
    \PackageError{tocbasic%
    }{toc entry style `#2' undefined}{%
      Somebody told me to define toc entry `#3' with style `#2',\MessageBreak
      but I do not know style `#2'.\MessageBreak
      You should first define the style then define the entry.\MessageBreak
      If you'll continue, I'll ignore the command. This could result
      in\MessageBreak
      further error messages.%
    }%
  }{%
    \let\scr@dte@precheck\@gobble
    \def\scr@dte@current{#3}%
    \@ExecuteTOCEntryStyleInitCode{#2}{#3}%
    \IfArgIsEmpty{#1}{}{%
      \FamilyBoolKey[.dte]{KOMAarg}{expandtopt}{scr@dte@expandtopt}%
      \scr@dte@expandtoptfalse
      \FamilyExecuteOptions[.dte]{KOMAarg}{#1}%
      \RelaxFamilyKey[.dte]{KOMAarg}{expandtopt}%
    }%
    \@RelaxTOCEntryOptions
    \let\scr@dte@doopts\relax
    \let\scr@dte@current\relax
    \scr@ifundefinedorrelax{#3tocdepth}{%
      \expandafter\let\csname #3tocdepth\expandafter\endcsname
      \csname #3numdepth\endcsname
    }{}%
    \scr@dte@precheck{#3}%
    \let\scr@dte@precheck\relax
    \begingroup
      \aftergroup\@tempswatrue
      \def\do##1##2##3##4{%
        \scr@ifundefinedorrelax{##1#3##2}{%
          \PackageError{tocbasic%
          }{toc style `#2' needs ##4}{%
            Usually the ##4 is defined using option `##3'.\MessageBreak
            In some cases it may be set defining command
            `\expandafter\string\csname ##1#3##2\endcsname'.\MessageBreak
            If you'll continue, I'll ignore the command. This could result
            in\MessageBreak
            further error messages.%
          }%
          \aftergroup\@tempswafalse
        }{}%
      }%
      \do{}{tocdepth}{level}{toc style level}%
      \@nameuse{scr@dte@#2@needs}%
    \endgroup
    \if@tempswa
      \@nameuse{scr@dte@def@l@#2}{#3}%
      \expandafter\edef\csname scr@dte@#3@style\endcsname{#2}%
      \expandafter\edef\csname scr@tso@#3@style\endcsname{#2}%
      \expandafter\let\csname toclevel@#3\expandafter\endcsname
      \csname #3tocdepth\endcsname
      \if@atdocument\else
        \scr@ifundefinedorrelax{AfterPackage}{%
          \AtBeginDocument
        }{%
          \AfterPackage*{hyperref}%
        }%
        {%
          \expandafter\let\csname toclevel@#3\expandafter\endcsname
          \csname #3tocdepth\endcsname
        }%
      \fi
    \fi
  }%
}
\newcommand*{\DeclareTOCStyleEntries}[3][]{%
  \edef\reserved@a{#3}%
  \@for \reserved@a:=\reserved@a \do {%
    \scr@trim@spaces\reserved@a
    \ifx\reserved@a\@empty\else
      \IfArgIsEmpty{#1}{%
        \edef\reserved@a{%
          \unexpanded{\DeclareTOCStyleEntry{#2}}{\reserved@a}}%
      }{%
        \edef\reserved@a{%
          \unexpanded{\DeclareTOCStyleEntry[{#1}]{#2}}{\reserved@a}}%
      }%
      \reserved@a
    \fi
  }%
}
\newcommand*{\DeclareTOCEntryStyle}[1]{%
  \kernel@ifnextchar [%]
    {\@DeclareTOCEntryStyle{#1}}%
    {\@DeclareTOCEntryStyle{#1}[]}%
}
\newcommand{\@DeclareTOCEntryStyle}{}
\long\def\@DeclareTOCEntryStyle#1[#2]#3{%
  \@namedef{scr@dte@def@l@#1}##1{%
    \@namedef{l@##1}####1####2{%
      \TOC@EntryStartHook{##1}%
      #3%
      \TOC@EntryEndHook{##1}%
    }%
  }%
  \TOCEntryStyleInitCode{#1}{%
    \DefineTOCEntryNumberOption{level}{}{tocdepth}{toc entry level}%
    #2%
  }%
}
\newcommand*{\TOC@EntryStartHook}[1]{}
\newcommand*{\TOC@EntryEndHook}[1]{}
\newcommand*{\CloneTOCEntryStyle}[2]{%
  \expandafter\let\csname scr@dte@def@l@#2\expandafter\endcsname
  \csname scr@dte@def@l@#1\endcsname
  \expandafter\let\csname scr@dte@#2@init\expandafter\endcsname
  \csname scr@dte@#1@init\endcsname
}
\providecommand*\@pnumwidth{1.55em}
\providecommand*\@tocrmarg {2.55em}
\providecommand*\@dotsep   {4.5}
%%% From File: $Id: scrkernel-tocstyle.dtx 3507 2020-06-11 14:57:03Z kohm $
%%%            (run: style,gobble)
\DeclareTOCEntryStyle{gobble}{}%
%%% From File: $Id: scrkernel-tocstyle.dtx 3507 2020-06-11 14:57:03Z kohm $
%%%            (run: style,dottedtocline)
\DeclareTOCEntryStyle{dottedtocline}[{%
  \DefineTOCEntryLengthOption{indent}%
    {scr@tso@}{@indent}{entry indent}%
  \DefineTOCEntryLengthOption{numwidth}%
    {scr@tso@}{@numwidth}{entry number width}%
  \@ifundefined{#1tocdepth}{%
    \Ifstr{#1}{part}{\@namedef{#1tocdepth}{-1}}{%
      \Ifstr{#1}{chapter}{\@namedef{#1tocdepth}{0}}{%
        \Ifstr{#1}{section}{\@namedef{#1tocdepth}{1}}{%
          \Ifstr{#1}{subsection}{\@namedef{#1tocdepth}{2}}{%
            \Ifstr{#1}{subsubsection}{\@namedef{#1tocdepth}{3}}{%
              \Ifstr{#1}{paragraph}{\@namedef{#1tocdepth}{4}}{%
                \Ifstr{#1}{subparagraph}{\@namedef{#1tocdepth}{5}}{%
                  \Ifstr{#1}{figure}{\@namedef{#1tocdepth}{1}}{%
                    \Ifstr{#1}{table}{\@namedef{#1tocdepth}{1}}{%
                      \expandafter\let\csname #1tocdepth\expandafter\endcsname
                      \csname #1numdepth\endcsname
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }%
  }{}%
  \@ifundefined{scr@tso@#1@indent}{%
    \@ifundefined{scr@#1@tocindent}{%
      \Ifstr{#1}{figure}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
        \Ifstr{#1}{table}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
          \Ifstr{#1}{part}{\@namedef{scr@tso@#1@indent}{0em}}{%
            \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@indent}{0em}}{%
              \scr@ifundefinedorrelax{l@chapter}{%
                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{0pt}}{%
                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                    \Ifstr{#1}{subsubsection}{%
                      \@namedef{scr@tso@#1@indent}{3.8em}%
                    }{%
                      \Ifstr{#1}{paragraph}{%
                        \@namedef{scr@tso@#1@indent}{7em}%
                      }{%
                        \Ifstr{#1}{subparagraph}{%
                          \@namedef{scr@tso@#1@indent}{10em}%
                        }{%
                        }%
                      }%
                    }%
                  }%
                }%
              }{%
                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{3.8em}}{%
                    \Ifstr{#1}{subsubsection}{%
                      \@namedef{scr@tso@#1@indent}{7.0em}%
                    }{%
                      \Ifstr{#1}{paragraph}{%
                        \@namedef{scr@tso@#1@indent}{10em}%
                      }{%
                        \Ifstr{#1}{subparagraph}{%
                          \@namedef{scr@tso@#1@indent}{12em}%
                        }{%
                        }%
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }{%
      \@namedef{scr@tso@#1@indent}{\@nameuse{scr@#1@tocindent}}%
    }%
  }{}%
  \@ifundefined{scr@tso@#1@numwidth}{%
    \@ifundefined{scr@#1@tocnumwidth}{%
      \Ifstr{#1}{figure}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
        \Ifstr{#1}{table}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
          \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@numwidth}{1.5em}}{%
            \scr@ifundefinedorrelax{chapter}{%
              \Ifstr{#1}{section}{\@namedef{scr@tso@#1@numwidth}{1.5em}}{%
                \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
                  \Ifstr{#1}{subsubsection}{%
                    \@namedef{scr@tso@#1@numwidth}{3.2em}%
                  }{%
                    \Ifstr{#1}{paragraph}{%
                      \@namedef{scr@tso@#1@numwidth}{4.1em}%
                    }{%
                      \Ifstr{#1}{subparagraph}{%
                        \@namedef{scr@tso@#1@numwidth}{5m}%
                      }{%
                      }%
                    }%
                  }%
                }%
              }%
            }{%
              \Ifstr{#1}{section}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
                \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@numwidth}{3.2em}}{%
                  \Ifstr{#1}{subsubsection}{%
                    \@namedef{scr@tso@#1@numwidth}{3.1em}%
                  }{%
                    \Ifstr{#1}{paragraph}{%
                      \@namedef{scr@tso@#1@numwidth}{5em}%
                    }{%
                      \Ifstr{#1}{subparagraph}{%
                        \@namedef{scr@tso@#1@numwidth}{6em}%
                      }{%
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }{%
      \@namedef{scr@tso@#1@numwidth}{\@nameuse{scr@#1@tocnumwidth}}%
    }%
  }{}%
}]{%
  \Iftocfeature{\@currext}{noindent}{%
    \@dottedtocline{\@nameuse{#1tocdepth}}{\z@}%
                   {\@nameuse{scr@tso@#1@numwidth}}{##1}{##2}%
  }{%
    \@dottedtocline{\@nameuse{#1tocdepth}}{\@nameuse{scr@tso@#1@indent}}%
                   {\@nameuse{scr@tso@#1@numwidth}}{##1}{##2}%
  }%
}
%%% From File: $Id: scrkernel-tocstyle.dtx 3507 2020-06-11 14:57:03Z kohm $
%%%            (run: style,undottedtocline)
\DeclareTOCEntryStyle{undottedtocline}[{%
  \DefineTOCEntryLengthOption{indent}%
    {scr@tso@}{@indent}{entry indent}%
  \DefineTOCEntryLengthOption{numwidth}%
    {scr@tso@}{@numwidth}{entry number width}%
  \@ifundefined{#1tocdepth}{%
    \Ifstr{#1}{part}{\@namedef{#1tocdepth}{-1}}{%
      \Ifstr{#1}{chapter}{\@namedef{#1tocdepth}{0}}{%
        \Ifstr{#1}{section}{\@namedef{#1tocdepth}{1}}{%
          \Ifstr{#1}{subsection}{\@namedef{#1tocdepth}{2}}{%
            \Ifstr{#1}{subsubsection}{\@namedef{#1tocdepth}{3}}{%
              \Ifstr{#1}{paragraph}{\@namedef{#1tocdepth}{4}}{%
                \Ifstr{#1}{subparagraph}{\@namedef{#1tocdepth}{5}}{%
                  \Ifstr{#1}{figure}{\@namedef{#1tocdepth}{1}}{%
                    \Ifstr{#1}{table}{\@namedef{#1tocdepth}{1}}{%
                      \expandafter\let\csname #1tocdepth\expandafter\endcsname
                      \csname #1numdepth\endcsname
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }%
  }{}%
  \@ifundefined{scr@tso@#1@indent}{%
    \@ifundefined{scr@#1@tocindent}{%
      \Ifstr{#1}{figure}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
        \Ifstr{#1}{table}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
          \Ifstr{#1}{part}{\@namedef{scr@tso@#1@indent}{0em}}{%
            \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@indent}{0em}}{%
              \scr@ifundefinedorrelax{l@chapter}{%
                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{0pt}}{%
                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                    \Ifstr{#1}{subsubsection}{%
                      \@namedef{scr@tso@#1@indent}{3.8em}%
                    }{%
                      \Ifstr{#1}{paragraph}{%
                        \@namedef{scr@tso@#1@indent}{7em}%
                      }{%
                        \Ifstr{#1}{subparagraph}{%
                          \@namedef{scr@tso@#1@indent}{10em}%
                        }{%
                        }%
                      }%
                    }%
                  }%
                }%
              }{%
                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{3.8em}}{%
                    \Ifstr{#1}{subsubsection}{%
                      \@namedef{scr@tso@#1@indent}{7.0em}%
                    }{%
                      \Ifstr{#1}{paragraph}{%
                        \@namedef{scr@tso@#1@indent}{10em}%
                      }{%
                        \Ifstr{#1}{subparagraph}{%
                          \@namedef{scr@tso@#1@indent}{12em}%
                        }{%
                        }%
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }{%
      \@namedef{scr@tso@#1@indent}{\@nameuse{scr@#1@tocindent}}%
    }%
  }{}%
  \@ifundefined{scr@tso@#1@numwidth}{%
    \@ifundefined{scr@#1@tocnumwidth}{%
      \Ifstr{#1}{figure}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
        \Ifstr{#1}{table}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
          \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@numwidth}{1.5em}}{%
            \scr@ifundefinedorrelax{chapter}{%
              \Ifstr{#1}{section}{\@namedef{scr@tso@#1@numwidth}{1.5em}}{%
                \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
                  \Ifstr{#1}{subsubsection}{%
                    \@namedef{scr@tso@#1@numwidth}{3.2em}%
                  }{%
                    \Ifstr{#1}{paragraph}{%
                      \@namedef{scr@tso@#1@numwidth}{4.1em}%
                    }{%
                      \Ifstr{#1}{subparagraph}{%
                        \@namedef{scr@tso@#1@numwidth}{5m}%
                      }{%
                      }%
                    }%
                  }%
                }%
              }%
            }{%
              \Ifstr{#1}{section}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
                \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@numwidth}{3.2em}}{%
                  \Ifstr{#1}{subsubsection}{%
                    \@namedef{scr@tso@#1@numwidth}{3.1em}%
                  }{%
                    \Ifstr{#1}{paragraph}{%
                      \@namedef{scr@tso@#1@numwidth}{5em}%
                    }{%
                      \Ifstr{#1}{subparagraph}{%
                        \@namedef{scr@tso@#1@numwidth}{6em}%
                      }{%
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }{%
      \@namedef{scr@tso@#1@numwidth}{\@nameuse{scr@#1@tocnumwidth}}%
    }%
  }{}%
}]{%
  \ifnum \c@tocdepth >\numexpr \@nameuse{#1tocdepth}-\@ne\relax
    \ifnum \@nameuse{#1tocdepth}<\@ne
      \scr@ifundefinedorrelax{chapter}{%
        \addpenalty\@secpenalty
        \addvspace{1.0em \@plus\p@}%
      }{%
        \addpenalty{-\@highpenalty}%
        \vskip 1.0em \@plus\p@
      }%
    \else
      \addpenalty\@secpenalty
      \addvspace{1.0em \@plus\p@}%
    \fi
    \setlength\@tempdima{\@nameuse{scr@tso@#1@numwidth}}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode
      \bfseries
      \advance\leftskip\@tempdima
      \Iftocfeature{\@currext}{noindent}{%
        \hskip -\leftskip
      }{%
        \advance\leftskip\@nameuse{scr@tso@#1@indent}%
        \hskip -\dimexpr \leftskip-\@nameuse{scr@tso@#1@indent}\relax
      }%
      ##1%
      \nobreak
      \hfil \nobreak\hb@xt@\@pnumwidth{\hss ##2}%
      \par
      \penalty\@highpenalty
    \endgroup
  \fi
}
%%% From File: $Id: scrkernel-tocstyle.dtx 3507 2020-06-11 14:57:03Z kohm $
%%%            (run: style, largetocline)
\DeclareTOCEntryStyle{largetocline}[{%
  \DefineTOCEntryLengthOption{indent}%
    {scr@tso@}{@indent}{entry indent}%
  \@ifundefined{#1tocdepth}{%
    \Ifstr{#1}{part}{\@namedef{#1tocdepth}{-1}}{%
      \Ifstr{#1}{chapter}{\@namedef{#1tocdepth}{0}}{%
        \Ifstr{#1}{section}{\@namedef{#1tocdepth}{1}}{%
          \Ifstr{#1}{subsection}{\@namedef{#1tocdepth}{2}}{%
            \Ifstr{#1}{subsubsection}{\@namedef{#1tocdepth}{3}}{%
              \Ifstr{#1}{paragraph}{\@namedef{#1tocdepth}{4}}{%
                \Ifstr{#1}{subparagraph}{\@namedef{#1tocdepth}{5}}{%
                  \Ifstr{#1}{figure}{\@namedef{#1tocdepth}{1}}{%
                    \Ifstr{#1}{table}{\@namedef{#1tocdepth}{1}}{%
                      \expandafter\let\csname #1tocdepth\expandafter\endcsname
                      \csname #1numdepth\endcsname
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }%
  }{}%
  \@ifundefined{scr@tso@#1@indent}{%
    \@ifundefined{scr@#1@tocindent}{%
      \Ifstr{#1}{figure}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
        \Ifstr{#1}{table}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
          \Ifstr{#1}{part}{\@namedef{scr@tso@#1@indent}{0em}}{%
            \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@indent}{0em}}{%
              \scr@ifundefinedorrelax{l@chapter}{%
                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{0pt}}{%
                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                    \Ifstr{#1}{subsubsection}{%
                      \@namedef{scr@tso@#1@indent}{3.8em}%
                    }{%
                      \Ifstr{#1}{paragraph}{%
                        \@namedef{scr@tso@#1@indent}{7em}%
                      }{%
                        \Ifstr{#1}{subparagraph}{%
                          \@namedef{scr@tso@#1@indent}{10em}%
                        }{%
                        }%
                      }%
                    }%
                  }%
                }%
              }{%
                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{3.8em}}{%
                    \Ifstr{#1}{subsubsection}{%
                      \@namedef{scr@tso@#1@indent}{7.0em}%
                    }{%
                      \Ifstr{#1}{paragraph}{%
                        \@namedef{scr@tso@#1@indent}{10em}%
                      }{%
                        \Ifstr{#1}{subparagraph}{%
                          \@namedef{scr@tso@#1@indent}{12em}%
                        }{%
                        }%
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }{%
      \@namedef{scr@tso@#1@indent}{\@nameuse{scr@#1@tocindent}}%
    }%
  }{}%
}]{%
  \ifnum \c@tocdepth >\numexpr \@nameuse{#1tocdepth}-\@ne\relax
    \ifnum \@nameuse{#1tocdepth}<\@ne
      \scr@ifundefinedorrelax{chapter}{%
        \addpenalty\@secpenalty
        \addvspace{2.25em \@plus\p@}%
      }{%
        \addpenalty{-\@highpenalty}%
        \addvspace{2.25em \@plus\p@}%
      }%
    \else
      \addpenalty\@secpenalty
      \addvspace{2.25em \@plus\p@}%
    \fi
    \setlength\@tempdima{3em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode
      \large
      \bfseries
      \Iftocfeature{\@currext}{noindent}{%
      }{%
        \advance\leftskip\@nameuse{scr@tso@#1@indent}%
      }%
      ##1%
      \hfil \nobreak\hb@xt@\@pnumwidth{\hss ##2}%
      \par
      \nobreak
      \ifnum 0=
        \scr@ifundefinedorrelax{chapter}{\if@compatibility 1\else 0\fi}{1}\relax
        \global\@nobreaktrue
        \everypar{\global\@nobreakfalse\everypar{}}%
      \fi
    \endgroup
  \fi
}
%%% From File: $Id: scrkernel-tocstyle.dtx 3507 2020-06-11 14:57:03Z kohm $
%%%            (run: style,tocline)
\DeclareTOCEntryStyle{tocline}[{%
  \DefineTOCEntryLengthOption{beforeskip}%
    {scr@tso@}{@beforeskip}{vertical skip before the entry}%
  \DefineTOCEntryIfOption{breakafternumber}%
    {scr@tso@}{@breakafternumber}{line break after number flag}%
  \DefineTOCEntryIfOption{dynnumwidth}%
    {scr@tso@}{@dynnumwidth}{dynamic number width flag}%
  \DefineTOCEntryListOption{indentfollows}%
    {scr@tso@}{@indentfollows}{list of levels that define the indent}%
  \DefineTOCEntryIfOption{dynindent}%
    {scr@tso@}{@dynindent}{dynamic indent width flag}%
  \DefineTOCEntryCommandOption{entryformat}%
    {scr@tso@}{@entryformat}[1]{entry format}%
  \DefineTOCEntryCommandOption{entrynumberformat}%
    {scr@tso@}{@numberformat}[1]{entry number format}%
  \DefineTOCEntryCommandOption{linefill}[\TOCLineLeaderFill]%
    {scr@tso@}{@linefill}{filling between text and page number}%
  \DefineTOCEntryLengthOption{numsep}%
    {scr@tso@}{@numsep}{entry number separation}%
  \DefineTOCEntryCommandOption{onstarthigherlevel}%
    {scr@tso@}{@LastTOCLevelWasLower}{start higher level entry hook}%
  \DefineTOCEntryCommandOption{onstartlowerlevel}%
    {scr@tso@}{@LastTOCLevelWasHigher}{start lower level entry hook}%
  \DefineTOCEntryCommandOption{onstartsamelevel}%
    {scr@tso@}{@LastTOCLevelWasSame}{start same level entry hook}%
  \DefineTOCEntryCommandOption{pagenumberbox}%
    {scr@tso@}{@pagenumberbox}[1]{page number box}%
  \DefineTOCEntryCommandOption{pagenumberformat}%
    {scr@tso@}{@pagenumberformat}[1]{page number format}%
  \DefineTOCEntryLengthOption{pagenumberwidth}%
    {scr@tso@}{@pagenumberwidth}{width of page number box}%
  \DefineTOCEntryLengthOption{rightindent}%
    {scr@tso@}{@rightindent}{entry's text right indent}%
  \DefineTOCEntryOption{raggedentrytext}[true]{%
    \FamilySetBool{KOMAarg}{raggedentrytext}{@tempswa}{##1}%
    \ifx\FamilyKeyState\FamilyKeyStateProcessed
      \if@tempswa
        \expandafter\let\csname ragged\scr@dte@current entry\endcsname
        \raggedright
      \else
        \expandafter\let\csname ragged\scr@dte@current entry\endcsname
        \relax
      \fi
    \fi
  }%
  \DefineTOCEntryIfOption{raggedpagenumber}%
    {scr@tso@}{@raggedpage}{page number ragged flag}%
  \DefineTOCEntryLengthOption{indent}%
    {scr@tso@}{@indent}{entry indent}%
  \DefineTOCEntryLengthOption{numwidth}%
    {scr@tso@}{@numwidth}{entry number width}%
  \scr@ifundefinedorrelax{#1tocdepth}{%
    \Ifstrstart{#1}{sub}{%
      \scr@ifundefinedorrelax{\scr@dte@nosub{#1}tocdepth}{}{%
        \expandafter\edef\csname #1tocdepth\endcsname{%
          \the\numexpr \noexpand\@nameuse{\scr@dte@nosub{#1}tocdepth}+\@ne\relax
        }%
      }%
    }{}%
  }{}%
  \@ifundefined{#1tocdepth}{%
    \Ifstr{#1}{part}{\@namedef{#1tocdepth}{-1}}{%
      \Ifstr{#1}{chapter}{\@namedef{#1tocdepth}{0}}{%
        \Ifstr{#1}{section}{\@namedef{#1tocdepth}{1}}{%
          \Ifstr{#1}{subsection}{\@namedef{#1tocdepth}{2}}{%
            \Ifstr{#1}{subsubsection}{\@namedef{#1tocdepth}{3}}{%
              \Ifstr{#1}{paragraph}{\@namedef{#1tocdepth}{4}}{%
                \Ifstr{#1}{subparagraph}{\@namedef{#1tocdepth}{5}}{%
                  \Ifstr{#1}{figure}{\@namedef{#1tocdepth}{1}}{%
                    \Ifstr{#1}{table}{\@namedef{#1tocdepth}{1}}{%
                      \expandafter\let\csname #1tocdepth\expandafter\endcsname
                      \csname #1numdepth\endcsname
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }%
  }{}%
  \scr@ifundefinedorrelax{scr@tso@#1@indent}{%
    \@ifundefined{scr@#1@tocindent}{%
      \Ifstrstart{#1}{sub}{%
        \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@indent}{%
          \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@numwidth}{}{%
            \expandafter\edef\csname scr@tso@#1@indent\endcsname{%
              \glueexpr \noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@numwidth}%
              \relax
            }%
          }%
        }{%
          \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@numwidth}{%
            \expandafter\edef\csname scr@tso@#1@indent\endcsname{%
              \glueexpr \noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@indent}%
              \relax
            }%
          }{%
            \expandafter\edef\csname scr@tso@#1@indent\endcsname{%
              \glueexpr \noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@indent}%
                       +\noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@numwidth}%
              \relax
            }%
          }%
        }%
      }{}%
    }{%
      \@namedef{scr@tso@#1@indent}{\@nameuse{scr@#1@tocindent}}%
    }%
  }{}%
  \scr@ifundefinedorrelax{scr@tso@#1@pagenumberwidth}{%
    \Ifstrstart{#1}{sub}{%
      \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@pagenumberwidth}{%
        \@namedef{scr@tso@#1@pagenumberwidth}{\@pnumwidth}%
      }{%
        \expandafter\let
        \csname scr@tso@#1@pagenumberwidth\expandafter\endcsname
        \csname scr@tso@\scr@dte@nosub{#1}@pagenumberwidth\endcsname
      }%
    }{%
      \@namedef{scr@tso@#1@pagenumberwidth}{\@pnumwidth}%
    }%
  }{}%
  \scr@ifundefinedorrelax{scr@tso@#1@rightindent}{%
    \Ifstrstart{#1}{sub}{%
      \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@rightindent}{%
        \@namedef{scr@tso@#1@rightindent}{\@tocrmarg}%
      }{%
        \expandafter\let
        \csname scr@tso@#1@rightindent\expandafter\endcsname
        \csname scr@tso@\scr@dte@nosub{#1}@rightindent\endcsname
      }%
    }{%
      \@namedef{scr@tso@#1@rightindent}{\@tocrmarg}%
    }%
  }{}%
  \@ifundefined{scr@tso@#1@indent}{%
      \Ifstr{#1}{figure}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
        \Ifstr{#1}{table}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
          \Ifstr{#1}{part}{\@namedef{scr@tso@#1@indent}{0em}}{%
            \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@indent}{0em}}{%
              \scr@ifundefinedorrelax{l@chapter}{%
                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{0pt}}{%
                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                    \Ifstr{#1}{subsubsection}{%
                      \@namedef{scr@tso@#1@indent}{3.8em}%
                    }{%
                      \Ifstr{#1}{paragraph}{%
                        \@namedef{scr@tso@#1@indent}{7em}%
                      }{%
                        \Ifstr{#1}{subparagraph}{%
                          \@namedef{scr@tso@#1@indent}{10em}%
                        }{%
                        }%
                      }%
                    }%
                  }%
                }%
              }{%
                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{3.8em}}{%
                    \Ifstr{#1}{subsubsection}{%
                      \@namedef{scr@tso@#1@indent}{7.0em}%
                    }{%
                      \Ifstr{#1}{paragraph}{%
                        \@namedef{scr@tso@#1@indent}{10em}%
                      }{%
                        \Ifstr{#1}{subparagraph}{%
                          \@namedef{scr@tso@#1@indent}{12em}%
                        }{%
                        }%
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
  }{}%
  \scr@ifundefinedorrelax{scr@tso@#1@numwidth}{%
    \scr@ifundefinedorrelax{scr@#1@tocnumwidth}{%
      \Ifstrstart{#1}{sub}{%
        \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@numwidth}{}{%
          \expandafter\edef\csname scr@tso@#1@numwidth\endcsname{%
            \glueexpr \noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@numwidth}%
                     +.9em%
            \relax
          }%
        }%
      }{}%
    }{%
      \@namedef{scr@tso@#1@numwidth}{\@nameuse{scr@#1@tocnumwidth}}%
    }%
  }{}%
  \@ifundefined{scr@tso@#1@numwidth}{%
      \Ifstr{#1}{figure}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
        \Ifstr{#1}{table}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
          \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@numwidth}{1.5em}}{%
            \scr@ifundefinedorrelax{chapter}{%
              \Ifstr{#1}{section}{\@namedef{scr@tso@#1@numwidth}{1.5em}}{%
                \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
                  \Ifstr{#1}{subsubsection}{%
                    \@namedef{scr@tso@#1@numwidth}{3.2em}%
                  }{%
                    \Ifstr{#1}{paragraph}{%
                      \@namedef{scr@tso@#1@numwidth}{4.1em}%
                    }{%
                      \Ifstr{#1}{subparagraph}{%
                        \@namedef{scr@tso@#1@numwidth}{5m}%
                      }{%
                      }%
                    }%
                  }%
                }%
              }%
            }{%
              \Ifstr{#1}{section}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
                \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@numwidth}{3.2em}}{%
                  \Ifstr{#1}{subsubsection}{%
                    \@namedef{scr@tso@#1@numwidth}{3.1em}%
                  }{%
                    \Ifstr{#1}{paragraph}{%
                      \@namedef{scr@tso@#1@numwidth}{5em}%
                    }{%
                      \Ifstr{#1}{subparagraph}{%
                        \@namedef{scr@tso@#1@numwidth}{6em}%
                      }{%
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
  }{}%
  \expandafter\providecommand%
  \csname scr@tso@#1@LastTOCLevelWasLower\endcsname{\LastTOCLevelWasLower}%
  \expandafter\providecommand%
  \csname scr@tso@#1@LastTOCLevelWasSame\endcsname{\LastTOCLevelWasSame}%
  \expandafter\providecommand%
  \csname scr@tso@#1@LastTOCLevelWasHigher\endcsname{\LastTOCLevelWasHigher}%
  \@ifundefined{scr@tso@#1@beforeskip}{%
    \Ifstr{#1}{part}{%
      \@namedef{scr@tso@#1@beforeskip}{\glueexpr 2.25em \@plus\p@\relax}%
    }{%
      \Ifstr{#1}{chapter}{%
        \@namedef{scr@tso@#1@beforeskip}{\glueexpr 1.0em \@plus\p@\relax}%
      }{%
        \Ifstr{#1}{section}{%
          \scr@ifundefinedorrelax{l@chapter}{%
            \@namedef{scr@tso@#1@beforeskip}{\glueexpr 1.0em \@plus\p@\relax}%
          }{}%
        }{}%
      }%
    }%
    \expandafter\providecommand\expandafter*%
    \csname scr@tso@#1@beforeskip\endcsname{\glueexpr \z@ plus .2\p@\relax}%
  }{}%
  \@ifundefined{scr@dte@#1@maxnumwidth}{%
    \expandafter\newlength\csname scr@dte@#1@maxnumwidth\endcsname
    \setlength{\@nameuse{scr@dte@#1@maxnumwidth}}{\z@}%
  }{}%
  \providecommand*{\scr@dte@donumwidth}{}%
  \g@addto@macro{\scr@dte@donumwidth}{\do{#1}}%
  \expandafter\providecommand\expandafter*%
  \csname scr@tso@#1@numsep\endcsname{.4em}%
  \expandafter\providecommand%
  \csname scr@tso@#1@numberformat\endcsname[1]{##1}%
  \Ifstr{#1}{part}{%
    \expandafter\providecommand%
    \csname scr@tso@#1@entryformat\endcsname[1]{\large\bfseries ##1}%
  }{%
    \Ifstr{#1}{chapter}{%
      \expandafter\providecommand%
      \csname scr@tso@#1@entryformat\endcsname[1]{\bfseries ##1}%
    }{%
      \scr@ifundefinedorrelax{l@chapter}{%
        \Ifstr{#1}{section}{%
          \expandafter\providecommand%
          \csname scr@tso@#1@entryformat\endcsname[1]{\bfseries ##1}%
        }{}%
      }{}%
      \expandafter\providecommand%
      \csname scr@tso@#1@entryformat\endcsname[1]{##1}%
    }%
  }%
  \expandafter\providecommand
  \csname Ifscr@tso@#1@breakafternumber\endcsname[2]{##2}%
  \@ifundefined{scr@tso@#1@linefill}{%
    \Ifstr{#1}{part}{%
      \@namedef{scr@tso@#1@linefill}{\hfill}%
    }{%
      \Ifstr{#1}{chapter}{%
        \@namedef{scr@tso@#1@linefill}{\hfill}%
      }{%
        \scr@ifundefinedorrelax{l@chapter}{%
          \Ifstr{#1}{section}{%
            \@namedef{scr@tso@#1@linefill}{\hfill}%
          }{}%
        }{}%
        \expandafter\providecommand%
        \csname scr@tso@#1@linefill\endcsname{\TOCLineLeaderFill\relax}%
      }%
    }%
  }{}%
  \expandafter\providecommand\csname Ifscr@tso@#1@raggedpage\endcsname[2]{##2}%
  \Ifstr{#1}{part}{%
    \expandafter\providecommand%
    \csname scr@tso@#1@pagenumberformat\endcsname[1]{\large\bfseries ##1}%
  }{%
    \Ifstr{#1}{chapter}{%
      \expandafter\providecommand%
      \csname scr@tso@#1@pagenumberformat\endcsname[1]{\bfseries ##1}%
    }{%
      \scr@ifundefinedorrelax{l@chapter}{%
        \Ifstr{#1}{section}{%
          \expandafter\providecommand%
          \csname scr@tso@#1@pagenumberformat\endcsname[1]{\bfseries ##1}%
        }{}%
      }{}%
      \expandafter\providecommand%
      \csname scr@tso@#1@pagenumberformat\endcsname[1]{%
        \normalfont\normalcolor ##1}%
    }%
  }%
  \expandafter\providecommand%
  \csname scr@tso@#1@pagenumberbox\endcsname[1]{%
    \hb@xt@\@nameuse{scr@dte@pagenumberwidth}{\hfil ##1}}%
  \expandafter\providecommand\csname Ifscr@tso@#1@dynnumwidth\endcsname[2]{##2}%
  \expandafter\providecommand\csname Ifscr@tso@#1@dynindent\endcsname[2]{##2}%
  \scr@ifundefinedorrelax{scr@tso@#1@indentfollows}{%
    \Ifstrstart{#1}{sub}{%
      \expandafter\edef\csname scr@tso@#1@indentfollows\endcsname{%
        \scr@dte@nosub{#1}%
      }%
    }{%
      \expandafter\let\csname scr@tso@#1@indentfollows\endcsname\@empty
    }%
  }{}%
}]{%
  \scr@dte@tocline{#1}{##1}{##2}%
}
\AtBeginDocument{%
  \BeforeClosingMainAux{%
    \begingroup
      \def\do#1{%
        \relax
        \scr@ifundefinedorrelax{scr@dte@#1@maxnumwidth}{}{%
          \ifdim \@nameuse{scr@dte@#1@maxnumwidth}>\z@
            \if@filesw
              \protected@write\@mainaux{}{%
                \string\global\string\@namedef{scr@dte@#1@lastmaxnumwidth}%
                {\the\@nameuse{scr@dte@#1@maxnumwidth}}%
              }%
            \fi
            \@nameuse{scr@dte@#1@maxnumwidth}\z@
          \fi
        }%
      }%
      \@nameuse{scr@dte@donumwidth}%
    \endgroup
  }%
}
\newcommand*{\scr@dte@nosub}[1]{\@scr@dte@nosub #1\relax}
\newcommand*{\@scr@dte@nosub}{}
\def\@scr@dte@nosub sub#1\relax{#1}
\newlength\scr@dte@tocline@numberwidth
\newcommand*{\scr@dte@tocline}[3]{%
  \ifnum \@nameuse{#1tocdepth}>\c@tocdepth
  \else
    \tocbasic@DependOnPenaltyAndTOCLevel{#1}%
    \addvspace{\@nameuse{scr@tso@#1@beforeskip}}\relax
    \@nameuse{Ifscr@tso@#1@dynindent}{%
      \expandafter\ifx\csname scr@tso@#1@indentfollows\endcsname\@empty
        \PackageWarning{tocbasic}{`dynindent' for `#1' not available}%
      \else
        \edef\reserved@a{\@nameuse{scr@tso@#1@indentfollows}}%
        \@for \reserved@a:=\reserved@a\do {%
          \scr@trim@spaces\reserved@a
          \ifx\reserved@a\@empty\else
            \scr@ifundefinedorrelax{\reserved@a tocdepth}{%
            }{%
              \ifnum \@nameuse{\reserved@a tocdepth}<\@nameuse{#1tocdepth}%
                \@tempdima\@nameuse{scr@tso@\reserved@a @indent}\relax
                \@nameuse{Ifscr@tso@\reserved@a @dynnumwidth}{%
                  \scr@ifundefinedorrelax
                  {scr@dte@\reserved@a @lastmaxnumwidth}{%
                    \advance\@tempdima
                    \@nameuse{scr@tso@\reserved@a @numwidth}\relax
                  }{%
                    \advance\@tempdima
                    \@nameuse{scr@dte@\reserved@a @lastmaxnumwidth}\relax
                  }%
                }{%
                  \advance\@tempdima
                  \@nameuse{scr@tso@\reserved@a @numwidth}\relax
                }%
                \ifdim \@tempdima>\@nameuse{scr@tso@#1@indent}\relax
                  \expandafter\edef\csname scr@tso@#1@indent\endcsname
                  {\the\@tempdima}%
                \fi
              \fi
            }%
          \fi
        }%
      \fi
    }{}%
    {%
      \Iftocfeature{\@currext}{noindent}{%
        \leftskip \z@
      }{%
        \leftskip \@nameuse{scr@tso@#1@indent}\relax
      }%
      \rightskip \@nameuse{scr@tso@#1@rightindent}\relax
      \parfillskip -\rightskip
      \@nameuse{Ifscr@tso@#1@raggedpage}{%
        \addtolength{\parfillskip}{\z@ \@plus 1fil}%
      }{}%
      \Iftocfeature{\@currext}{noindent}{%
        \parindent \z@
      }{%
        \parindent \@nameuse{scr@tso@#1@indent}\relax
      }%
      \@afterindenttrue
      \interlinepenalty\@M
      \expandafter\ifx\csname ragged#1entry\endcsname\raggedright
        \addtolength\rightskip\@flushglue
      \else
        \def\reserved@a{\raggedright}%
        \expandafter\ifx\csname ragged#1entry\endcsname\reserved@a
          \addtolength\rightskip\@flushglue
        \else
          \renewcommand\reserved@a{\raggedright}%
          \expandafter\ifx\csname ragged#1entry\endcsname\reserved@a
            \addtolength\rightskip\@flushglue
          \fi
        \fi
      \fi
      \leavevmode
      \@tempdima \@nameuse{scr@tso@#1@numwidth}\relax
      \@nameuse{Ifscr@tso@#1@dynnumwidth}{%
        \scr@ifundefinedorrelax{scr@dte@#1@lastmaxnumwidth}{}{%
          \ifdim \@nameuse{scr@dte@#1@lastmaxnumwidth}>\@tempdima
            \@tempdima\@nameuse{scr@dte@#1@lastmaxnumwidth}\relax
          \fi
        }%
      }{}%
      \advance\leftskip \@tempdima
      \null\nobreak\hskip -\leftskip
      {%
        \usetocbasicnumberline
        \let\scr@dte@numberline@box\numberline@box
        \def\numberline@box##1{%
          \sbox\scr@dte@tocline@numbox{\@nameuse{scr@tso@#1@numberformat}{##1}}%
          \global\scr@dte@tocline@numberwidth
          \dimexpr\wd\scr@dte@tocline@numbox+\@nameuse{scr@tso@#1@numsep}\relax
          \relax
          \ifdim \scr@dte@tocline@numberwidth
                >\@nameuse{scr@dte@#1@maxnumwidth}\relax
            \global\@nameuse{scr@dte@#1@maxnumwidth}\scr@dte@tocline@numberwidth
          \fi
          \@nameuse{Ifscr@tso@#1@dynnumwidth}{}{%
            \ifdim \scr@dte@tocline@numberwidth
                  >\dimexpr \@nameuse{scr@tso@#1@numwidth}%
                           +\@nameuse{scr@tso@#1@numsep}\relax\relax
              \PackageWarning{tocbasic%
              }{%
                number width of #1 toc entries should be
                increased!\MessageBreak
                Currently used number width =
                \the\wd\scr@dte@tocline@numbox,\MessageBreak
                Wanted number separation
                \space\space\space =
                \the\dimexpr\@nameuse{scr@tso@#1@numsep}\relax,\MessageBreak
                Reserved number width \space\space\space\space\space\space =
                \the\dimexpr\@nameuse{scr@tso@#1@numwidth}\relax%
              }%
            \fi
          }%
          \scr@dte@numberline@box{\@nameuse{scr@tso@#1@numberformat}{##1}}%
          \@nameuse{Ifscr@tso@#1@breakafternumber}{%
            {\parfillskip\@flushglue\par}\nobreak\hskip-\leftskip
          }{}%
        }%
        \@nameuse{scr@tso@#1@entryformat}{%
          #2%
          \nobreak
          {%
            \normalfont\normalsize\@nameuse{scr@tso@#1@linefill}%
            \nobreak
            \expandafter\let\expandafter\scr@dte@pagenumberwidth
            \csname scr@tso@#1@pagenumberwidth\endcsname
            \@nameuse{scr@tso@#1@pagenumberbox}{%
              \@nameuse{scr@tso@#1@pagenumberformat}{#3}%
            }%
          }%
          \@par
        }%
      }%
    }%
    \tocbasic@SetPenaltyByTOCLevel{#1}%
  \fi
}
\newsavebox\scr@dte@tocline@numbox
\newcommand*{\tocbasic@DependOnPenaltyAndTOCLevel}[1]{%
  \ifnum \lastpenalty<\numexpr 20009-\@nameuse{#1tocdepth}\relax
    \@nameuse{scr@tso@#1@LastTOCLevelWasHigher}%
  \else\ifnum \lastpenalty=\numexpr 20009-\@nameuse{#1tocdepth}\relax
      \@nameuse{scr@tso@#1@LastTOCLevelWasSame}%
    \else
      \@nameuse{scr@tso@#1@LastTOCLevelWasLower}%
    \fi
  \fi
}
\newcommand*{\tocbasic@SetPenaltyByTOCLevel}[1]{%
  \penalty \numexpr 20009-\@nameuse{#1tocdepth}\relax
}
\newcommand*{\LastTOCLevelWasHigher}{\ifvmode\addpenalty{\@lowpenalty}\fi}
\newcommand*{\LastTOCLevelWasSame}{\ifvmode\addpenalty{\@lowpenalty}\fi}
\newcommand*{\LastTOCLevelWasLower}{}
\newcommand*{\TOCLineLeaderFill}[1][.]{%
  \leaders\hbox{$\m@th
    \mkern \@dotsep mu\hbox{#1}\mkern \@dotsep
    mu$}\hfill
}
%%% From File: $Id: scrkernel-tocstyle.dtx 3507 2020-06-11 14:57:03Z kohm $
%%%            (run: style,toctext)
\DeclareTOCEntryStyle{toctext}[{%
  \DefineTOCEntryLengthOption{beforeskip}%
    {scr@tso@}{@beforeskip}{vertical skip before the entry}%
  \DefineTOCEntryCommandOption{entryformat}%
    {scr@tso@}{@entryformat}[1]{entry format}%
  \DefineTOCEntryCommandOption{entrynumberformat}%
    {scr@tso@}{@numberformat}[1]{entry number format}%
  \DefineTOCEntryCommandOption{prepagenumber}%
    {scr@tso@}{@prepagenumber}{separator between text and page number}%
  \DefineTOCEntryLengthOption{numsep}%
    {scr@tso@}{@numsep}{entry number separation}%
  \DefineTOCEntryCommandOption{onstartfirstentry}%
    {scr@tso@}{@onstartfirstentry}{output at start of paragraph}%
  \DefineTOCEntryCommandOption{onstartentry}%
    {scr@tso@}{@onstartentry}{output at start of all entries but the first}%
  \DefineTOCEntryCommandOption{onendlastentry}%
    {scr@tso@}{@onendlastentry}{output at end of paragraph}%
  \DefineTOCEntryCommandOption{afterpar}%
    {scr@tso@}{@afterpar}{settings after end of paragraph}%
  \DefineTOCEntryCommandOption{onendentry}%
    {scr@tso@}{@onendentry}{output at end of all entries but the last}%
  \DefineTOCEntryCommandOption{pagenumberformat}%
    {scr@tso@}{@pagenumberformat}[1]{page number format}%
  \DefineTOCEntryLengthOption{rightindent}%
    {scr@tso@}{@rightindent}{entry's text right indent}%
  \DefineTOCEntryIfOption{raggedright}%
    {scr@tso@}{@raggedright}{use raggedright for the whole paragraph}%
  \DefineTOCEntryLengthOption{indent}%
    {scr@tso@}{@indent}{entry indent}%
  \scr@ifundefinedorrelax{#1tocdepth}{%
    \Ifstrstart{#1}{sub}{%
      \scr@ifundefinedorrelax{\scr@dte@nosub{#1}tocdepth}{}{%
        \expandafter\edef\csname #1tocdepth\endcsname{%
          \the\numexpr \noexpand\@nameuse{\scr@dte@nosub{#1}tocdepth}+\@ne\relax
        }%
      }%
    }{}%
  }{}%
  \@ifundefined{#1tocdepth}{%
    \Ifstr{#1}{part}{\@namedef{#1tocdepth}{-1}}{%
      \Ifstr{#1}{chapter}{\@namedef{#1tocdepth}{0}}{%
        \Ifstr{#1}{section}{\@namedef{#1tocdepth}{1}}{%
          \Ifstr{#1}{subsection}{\@namedef{#1tocdepth}{2}}{%
            \Ifstr{#1}{subsubsection}{\@namedef{#1tocdepth}{3}}{%
              \Ifstr{#1}{paragraph}{\@namedef{#1tocdepth}{4}}{%
                \Ifstr{#1}{subparagraph}{\@namedef{#1tocdepth}{5}}{%
                  \Ifstr{#1}{figure}{\@namedef{#1tocdepth}{1}}{%
                    \Ifstr{#1}{table}{\@namedef{#1tocdepth}{1}}{%
                      \expandafter\let\csname #1tocdepth\expandafter\endcsname
                      \csname #1numdepth\endcsname
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }%
  }{}%
  \scr@ifundefinedorrelax{scr@tso@#1@indent}{%
    \@ifundefined{scr@#1@tocindent}{%
      \Ifstrstart{#1}{sub}{%
        \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@indent}{%
          \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@numwidth}{}{%
            \expandafter\edef\csname scr@tso@#1@indent\endcsname{%
              \glueexpr \noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@numwidth}%
              \relax
            }%
          }%
        }{%
          \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@numwidth}{%
            \expandafter\edef\csname scr@tso@#1@indent\endcsname{%
              \glueexpr \noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@indent}%
              \relax
            }%
          }{%
            \expandafter\edef\csname scr@tso@#1@indent\endcsname{%
              \glueexpr \noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@indent}%
                       +\noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@numwidth}%
              \relax
            }%
          }%
        }%
      }{}%
    }{%
      \@namedef{scr@tso@#1@indent}{\@nameuse{scr@#1@tocindent}}%
    }%
  }{}%
  \scr@ifundefinedorrelax{scr@tso@#1@rightindent}{%
    \Ifstrstart{#1}{sub}{%
      \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@rightindent}{%
        \@namedef{scr@tso@#1@rightindent}{\@tocrmarg}%
      }{%
        \expandafter\let
        \csname scr@tso@#1@rightindent\expandafter\endcsname
        \csname scr@tso@\scr@dte@nosub{#1}@rightindent\endcsname
      }%
    }{%
      \@namedef{scr@tso@#1@rightindent}{\@tocrmarg}%
    }%
  }{}%
  \@ifundefined{scr@tso@#1@indent}{%
      \Ifstr{#1}{figure}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
        \Ifstr{#1}{table}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
          \Ifstr{#1}{part}{\@namedef{scr@tso@#1@indent}{0em}}{%
            \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@indent}{0em}}{%
              \scr@ifundefinedorrelax{l@chapter}{%
                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{0pt}}{%
                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                    \Ifstr{#1}{subsubsection}{%
                      \@namedef{scr@tso@#1@indent}{3.8em}%
                    }{%
                      \Ifstr{#1}{paragraph}{%
                        \@namedef{scr@tso@#1@indent}{7em}%
                      }{%
                        \Ifstr{#1}{subparagraph}{%
                          \@namedef{scr@tso@#1@indent}{10em}%
                        }{%
                        }%
                      }%
                    }%
                  }%
                }%
              }{%
                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{3.8em}}{%
                    \Ifstr{#1}{subsubsection}{%
                      \@namedef{scr@tso@#1@indent}{7.0em}%
                    }{%
                      \Ifstr{#1}{paragraph}{%
                        \@namedef{scr@tso@#1@indent}{10em}%
                      }{%
                        \Ifstr{#1}{subparagraph}{%
                          \@namedef{scr@tso@#1@indent}{12em}%
                        }{%
                        }%
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
  }{}%
  \expandafter\providecommand\expandafter*%
  \csname scr@tso@#1@beforeskip\endcsname{\z@}%
  \expandafter\providecommand\expandafter*%
  \csname scr@tso@#1@numsep\endcsname{.4em}%
  \expandafter\providecommand%
  \csname scr@tso@#1@onstartfirstentry\endcsname{}%
  \expandafter\providecommand%
  \csname scr@tso@#1@onstartentry\endcsname{}%
  \expandafter\providecommand%
  \csname scr@tso@#1@onendlastentry\endcsname{}%
  \expandafter\providecommand%
  \csname scr@tso@#1@onendentry\endcsname{\quad}%
  \expandafter\providecommand%
  \csname scr@tso@#1@afterpar\endcsname{}%
  \expandafter\providecommand%
  \csname scr@tso@#1@numberformat\endcsname[1]{##1}%
      \expandafter\providecommand%
      \csname scr@tso@#1@entryformat\endcsname[1]{##1}%
  \expandafter\providecommand%
  \csname Ifscr@tso@#1@raggedright\endcsname[2]{##2}%
  \expandafter\providecommand%
  \csname scr@tso@#1@prepagenumber\endcsname{\nobreakspace}%
}]{%
  \scr@dte@toctext{#1}{##1}{##2}%
}
\newcommand*{\scr@dte@toctext}[3]{%
  \ifnum \@nameuse{#1tocdepth}>\c@tocdepth
  \else
    \ifhmode
      \scr@dte@toctext@lastend
      \@nameuse{scr@tso@#1@onstartentry}%
    \else
      \addvspace{\@nameuse{scr@tso@#1@beforeskip}}%
      \leavevmode
      \def\par{%
        \scr@dte@toctext@raggedright
        \scr@dte@toctext@parend
        \@par
        \scr@dte@toctext@afterpar
        \global\let\scr@dte@toctext@afterpar\relax
        \global\let\scr@dte@toctext@parend\relax
        \global\let\scr@dte@toctext@raggedright\relax
      }%
      \global\let\scr@dte@toctext@afterpar\@empty
      \Iftocfeature{\@currext}{noindent}{%
        \leftskip \z@
      }{%
        \leftskip \@nameuse{scr@tso@#1@indent}\relax
      }%
      \rightskip \@nameuse{scr@tso@#1@rightindent}\relax
      \parfillskip \z@ \@plus 1fill\relax
      \ifx\addvspace\scr@dte@xaddvspace\else
        \let\scr@dte@saddvspace\addvspace
        \def\scr@dte@xaddvspace{%
          \let\addvspace\scr@dte@saddvspace\par\addvspace}%
        \let\addvspace\scr@dte@xaddvspace
      \fi
      \ifx\addpenalty\scr@dte@xaddpenalty\else
        \let\scr@dte@saddpenalty\addpenalty
        \def\scr@dte@xaddpenalty{%
          \let\addpenalty\scr@dte@saddpenalty\par\addpenalty}%
      \fi
      \@nameuse{scr@tso@#1@onstartfirstentry}%
    \fi
    \@nameuse{Ifscr@tso@#1@raggedright}{%
      \let\\\@centercr
      \gdef\scr@dte@toctext@raggedright{%
        \@rightskip\@flushglue
        \addtolength\rightskip\@rightskip
      }%
    }{}%
    \l@addto@macro\scr@dte@toctext@afterpar{\@nameuse{scr@tso@#1@afterpar}}%
    \expandafter\global\expandafter\let\expandafter\scr@dte@toctext@lastend
    \csname scr@tso@#1@onendentry\endcsname
    \expandafter\global\expandafter\let\expandafter\scr@dte@toctext@parend
    \csname scr@tso@#1@onendlastentry\endcsname
    {%
      \usetocbasicnumberline
      \def\numberline@box##1{%
        \mbox{%
          \@nameuse{scr@tso@#1@numberformat}{\ignorespaces ##1\unskip}%
          \hskip\@nameuse{scr@tso@#1@numsep}\relax
        }%
      }%
      \@nameuse{scr@tso@#1@entryformat}{%
        \ignorespaces#2\unskip
        \@nameuse{scr@tso@#1@prepagenumber}%
        \@nameuse{scr@tso@#1@pagenumberformat}{\ignorespaces #3\unskip}%
      }%
    }%
  \fi
}
\newcommand*{\scr@dte@toctext@raggedright}{}
\newcommand*{\scr@dte@toctext@parend}{}
\newcommand*{\scr@dte@toctext@lastend}{}
%%% From File: $Id: scrkernel-tocstyle.dtx 3507 2020-06-11 14:57:03Z kohm $
%%%            (run: style,dottedtocline)
\CloneTOCEntryStyle{dottedtocline}{default}
%%% From File: $Id: tocbasic.dtx 3518 2020-08-25 08:26:01Z kohm $
%%%            (run: exit)
\AtBeginDocument{%
  \@ifundefined{MakeMarkcase}{%
    \scr@ifundefinedorrelax{KOMAClassName}{%
      \let\MakeMarkcase\MakeUppercase
    }{%
      \let\MakeMarkcase\@firstofone
    }%
  }{}%
}
%%% From File: $Id: scrlogo.dtx 3527 2020-09-11 09:44:32Z kohm $
\@ifundefined{KOMAScript}{%
  \DeclareRobustCommand{\KOMAScript}{\textsf{K\kern.05em O\kern.05em%
      M\kern.05em A\kern.1em-\kern.1em Script}}}{}
\endinput
%%
%% End of file `tocbasic.sty'.