%% The LaTeX package tcolorbox - version 4.22 (2019/11/15)
%% tcbdocumentation.code.tex: Code for LaTeX documentations
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2019 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
\tcb@set@library@version{4.22}

\tcbuselibrary{listings,skins,xparse,external}

\RequirePackage{pifont}[2005/04/12]
\RequirePackage{marvosym}[2011/07/20]
\ifdefined\printindex\else\RequirePackage{makeidx}[2000/03/29]\fi
\RequirePackage{refcount}[2011/10/16]
\RequirePackage{hyperref}[2012/02/06]
\ifdefined\marginnote\else\RequirePackage{marginnote}[2012/03/29]\fi

\definecolor{Option}{rgb}{0.118,0.546,0.222}
\definecolor{Definition}{rgb}{0.784,0.06,0.176}
\definecolor{ExampleFrame}{rgb}{0.628,0.705,0.942}
\definecolor{ExampleBack}{rgb}{0.963,0.971,0.994}
\definecolor{Hyperlink}{rgb}{0.281,0.275,0.485}
\definecolor{Fade}{rgb}{0.5,0.5,0.5}

\def\colDef#1{\textcolor{\kvtcb@col@command}{#1}}
\def\colOpt#1{\textcolor{\kvtcb@col@opt}{#1}}
\def\colFade#1{\textcolor{\kvtcb@col@fade}{#1}}

\lstdefinestyle{tcbdocumentation}{language={[LaTeX]TeX},
    aboveskip={0\p@ \@plus 6\p@},
    belowskip={0\p@ \@plus 6\p@},
    columns=fullflexible,
    keepspaces=true,
    breaklines=true,
    prebreak={\Righttorque},
    postbreak={\space\Lefttorque},
    breakatwhitespace=true,
    basicstyle=\ttfamily\footnotesize,
    extendedchars=true,
    moredelim={[is][\itshape\rmfamily]{^^a7}{^^a7}},
    nolol,inputencoding=\kvtcb@listingencoding}

% The following macros are taken from ltxdoc
\DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}}
\def\meta@font@select{\rmfamily\itshape}

\AtEndPreamble{%
  \@ifpackageloaded{doc}{%
  }{% code taken from doc.sty
    \ifx\l@nohyphenation\undefined
      \newlanguage\l@nohyphenation
    \fi
    \DeclareRobustCommand\meta[1]{%
         \ensuremath\langle
         \ifmmode \expandafter \nfss@text \fi
         {%
          \meta@font@select
          \edef\meta@hyphen@restore
            {\hyphenchar\the\font\the\hyphenchar\font}%
          \hyphenchar\font\m@ne
          \language\l@nohyphenation
          #1\/%
          \meta@hyphen@restore
         }\ensuremath\rangle
    }%
  }%
}%

\def\marg#1{%
  {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}}
\def\oarg#1{%
  \colOpt{{\ttfamily[}\meta{#1}{\ttfamily]}}}

\newrobustcmd\tcb@cs[1]{{\catcode`\_=12\relax\catcode`\@11\relax\ttfamily\char`\\\scantokens{#1}\unskip}}
\newrobustcmd\tcb@scantokens[1]{{\catcode`\_=12\relax\catcode`\@11\relax\ttfamily\scantokens{#1}\unskip}}

\newif\iftcb@doc@toindex
\newif\iftcb@doc@colorize
\newif\iftcb@doc@annotate

% language specific texts
\tcbset{
  doclang/.cd,
  color/.store in=\kvtcb@text@color,
  colors/.store in=\kvtcb@text@colors,
  counter/.store in=\kvtcb@text@counter,
  counters/.store in=\kvtcb@text@counters,
  environment content/.store in=\kvtcb@text@envcontent,
  environment/.store in=\kvtcb@text@env,
  environments/.store in=\kvtcb@text@envs,
  index/.store in=\kvtcb@text@index,
  key/.store in=\kvtcb@text@key,
  keys/.store in=\kvtcb@text@keys,
  length/.store in=\kvtcb@text@length,
  lengths/.store in=\kvtcb@text@lengths,
  new/.store in=\kvtcb@text@new,
  path/.store in=\kvtcb@text@path,
  paths/.store in=\kvtcb@text@paths,
  pageshort/.store in=\kvtcb@text@pageshort,
  updated/.store in=\kvtcb@text@updated,
  value/.store in=\kvtcb@text@value,
  values/.store in=\kvtcb@text@values,
}

% documentation options
\tcbset{
  documentation listing options/.store in=\kvtcb@doclistingoptions,%
  documentation listing style/.style={documentation listing options={style=#1}},%
  documentation minted language/.store in=\kvtcb@docminted@language,
  documentation minted style/.store in=\kvtcb@docmintstyle,
  documentation minted options/.store in=\kvtcb@docmintoptions,
  color command/.store in=\kvtcb@col@command,
  color environment/.store in=\kvtcb@col@environment,
  color key/.store in=\kvtcb@col@key,
  color value/.store in=\kvtcb@col@value,
  color counter/.store in=\kvtcb@col@counter,
  color length/.store in=\kvtcb@col@length,
  color color/.store in=\kvtcb@col@color,
  color fade/.store in=\kvtcb@col@fade,
  color path/.store in=\kvtcb@col@path,
  color definition/.style={color command={#1},color environment={#1},color key={#1},
    color value={#1},color color={#1},color counter={#1},color length={#1}, color path={#1}},
  color option/.store in=\kvtcb@col@opt,
  color hyperlink/.store in=\kvtcb@colhyper,
  color frame/.store in=\kvtcb@colhyper,
  index actual/.store in=\idx@actual,
  index quote/.store in=\idx@quote,
  index level/.store in=\idx@level,
  index format/.store in=\idx@format,
  index colorize/.is if=tcb@doc@colorize,%
  index annotate/.is if=tcb@doc@annotate,%
  index command/.code={\def\kvtcb@index@command##1{#1{##1}}},%
  index command name/.code={\def\kvtcb@index@command##1{\index[#1]{##1}}},%
  doc left/.dimstore in=\kvtcb@doc@left,
  doc right/.dimstore in=\kvtcb@doc@right,
  doc left indent/.dimstore in=\kvtcb@doc@indentleft,
  doc right indent/.dimstore in=\kvtcb@doc@indentright,
  doc head command/.style={doc@head@command/.style={#1}},
  doc head environment/.style={doc@head@environment/.style={#1}},
  doc head key/.style={doc@head@key/.style={#1}},
  doc head path/.style={doc@head@path/.style={#1}},
  doc head/.style={doc head command={#1},doc head environment={#1},doc head key={#1},
    doc head path={#1}},
  doc label/.store in=\kvtcb@doc@label,
  before doc body command/.store in=\kvtcb@doc@body@command@before,
  after doc body command/.store in=\kvtcb@doc@body@command@after,
  before doc body environment/.store in=\kvtcb@doc@body@environment@before,
  after doc body environment/.store in=\kvtcb@doc@body@environment@after,
  before doc body key/.store in=\kvtcb@doc@body@key@before,
  after doc body key/.store in=\kvtcb@doc@body@key@after,
  before doc body path/.store in=\kvtcb@doc@body@path@before,
  after doc body path/.store in=\kvtcb@doc@body@path@after,
  before doc body/.style={before doc body command={#1},before doc body environment={#1},
    before doc body key={#1},before doc body path={#1}},
  after doc body/.style={after doc body command={#1},after doc body environment={#1}
    ,after doc body key={#1},after doc body path={#1}},
  doc description/.store in=\kvtcb@doc@description,%
  doc into index/.is if=tcb@doc@toindex,%
  doc updated/.style={before upper={\tcbdocmarginnote{\tcbdocupdated{#1}}}},
  doc new/.style={before upper={\tcbdocmarginnote{\tcbdocnew{#1}}}},
  doc new and updated/.style 2 args={before upper={\tcbdocmarginnote{\tcbdocnew{#1}\\\tcbdocupdated{#2}}}},
  doc marginnote/.style={doc@marginnote/.style={#1}},
  keywords bold/.is choice,%
  keywords bold/.default=true,%
  keywords bold/true/.code={\let\tcb@doc@bfseries\bfseries},
  keywords bold/false/.code={\let\tcb@doc@bfseries\mdseries},
}


% styles
\tcbset{
  docexample/.style={colframe=ExampleFrame,colback=ExampleBack,
    before skip=\medskipamount,after skip=\medskipamount,
    fontlower=\footnotesize},
  documentation minted language=latex,
  documentation minted style=,
  documentation minted options={tabsize=2,fontsize=\small},
  index default settings/.style={index actual={@},index quote={"},index level={!}},
  index german settings/.style={index actual={=},index quote={!},index level={>}},
  english language/.code={\tcbset{doclang/.cd,
    color=color,colors=Colors,
    counter=counter,counters=Counters,
    environment content=environment content,
    environment=environment,environments=Environments,
    path=path operation,paths=Path operations,
    index=Index,
    key=key,keys=Keys,
    length=length,lengths=Lengths,
    new=New,
    pageshort={P.},
    updated=Updated,
    value=value,values=Values}},
}

\AtBeginDocument{%
  \csname tcb@doc@index@\idx@format\endcsname%
  \hypersetup{
  citecolor=\kvtcb@colhyper,
  linkcolor=\kvtcb@colhyper,
  urlcolor=\kvtcb@colhyper,
  filecolor=\kvtcb@colhyper,
  menucolor=\kvtcb@colhyper
}}

\def\dispExample{\tcb@layer@pushup\tcbset{docexample}\begingroup\tcbwritetemp}

\def\enddispExample{%
  \endtcbwritetemp\endgroup%
  \begin{tcolorbox}%
  \tcb@doc@usetemplisting%
  \tcblower%
  \tcbusetemp%
  \end{tcolorbox}%
}

\newenvironment{dispExample*}[1]{%
  \tcb@layer@pushup\tcbset{docexample,#1}\begingroup\tcbwritetemp%
  }{\enddispExample}

\def\dispListing{\tcb@layer@pushup\tcbset{docexample}\begingroup\tcbwritetemp}

\def\enddispListing{%
  \endtcbwritetemp\endgroup%
  \begin{tcolorbox}%
  \tcb@doc@usetemplisting%
  \end{tcolorbox}%
}

\newenvironment{dispListing*}[1]{%
  \tcb@layer@pushup\tcbset{docexample,#1}\begingroup\tcbwritetemp%
  }{\enddispListing}

% index auxiliary macros
\def\tcb@Index@Print@CA#1#2#3{%
  \iftcb@doc@colorize\textcolor{#2}{\tcb@scantokens{#1}}\else\tcb@scantokens{#1}\fi%
  \iftcb@doc@annotate\ #3\fi%
}

\def\tcb@Index@Print@C#1#2{%
  \iftcb@doc@colorize\textcolor{#2}{\tcb@scantokens{#1}}\else\tcb@scantokens{#1}\fi%
}

\def\tcb@Index@Print@ComCA#1#2#3{%
  \iftcb@doc@colorize\textcolor{#2}{\tcb@cs{#1}}\else\tcb@cs{#1}\fi%
  \iftcb@doc@annotate\ #3\fi%
}

\def\tcb@Index@Print@ComC#1#2{%
  \iftcb@doc@colorize\textcolor{#2}{\tcb@cs{#1}}\else\tcb@cs{#1}\fi%
}

\newrobustcmd{\tcbIndexPrintComC}[1]{\tcb@Index@Print@ComC{#1}{\kvtcb@col@command}}
\def\tcb@Print@Com#1{\textcolor{\kvtcb@col@command}{\tcb@doc@bfseries\tcb@cs{#1}}}

\newrobustcmd{\tcbIndexPrintEnvCA}[1]{\tcb@Index@Print@CA{#1}{\kvtcb@col@environment}{\kvtcb@text@env}}
\newrobustcmd{\tcbIndexPrintEnvC}[1]{\tcb@Index@Print@C{#1}{\kvtcb@col@environment}}
\def\tcb@Print@Env#1{\textcolor{\kvtcb@col@environment}{\tcb@doc@bfseries\tcb@scantokens{#1}}}

\newrobustcmd{\tcbIndexPrintKeyCA}[1]{\tcb@Index@Print@CA{#1}{\kvtcb@col@key}{\kvtcb@text@key}}
\newrobustcmd{\tcbIndexPrintKeyC}[1]{\tcb@Index@Print@C{#1}{\kvtcb@col@key}}
\def\tcb@Print@Key#1{\textcolor{\kvtcb@col@key}{\tcb@doc@bfseries\tcb@scantokens{#1}}}

\newrobustcmd{\tcbIndexPrintPathCA}[1]{\tcb@Index@Print@CA{#1}{\kvtcb@col@path}{\kvtcb@text@path}}
\newrobustcmd{\tcbIndexPrintPathC}[1]{\tcb@Index@Print@C{#1}{\kvtcb@col@path}}
\def\tcb@Print@Path#1{\textcolor{\kvtcb@col@path}{\tcb@doc@bfseries\tcb@scantokens{#1}}}

\newrobustcmd{\tcbIndexPrintValCA}[1]{\tcb@Index@Print@CA{#1}{\kvtcb@col@value}{\kvtcb@text@value}}
\newrobustcmd{\tcbIndexPrintValC}[1]{\tcb@Index@Print@C{#1}{\kvtcb@col@value}}
\def\tcb@Print@Val#1{\textcolor{\kvtcb@col@value}{\tcb@doc@bfseries\tcb@scantokens{#1}}}

\newrobustcmd{\tcbIndexPrintColCA}[1]{\tcb@Index@Print@CA{#1}{\kvtcb@col@color}{\kvtcb@text@color}}
\newrobustcmd{\tcbIndexPrintColC}[1]{\tcb@Index@Print@C{#1}{\kvtcb@col@color}}
\def\tcb@Print@Col#1{\textcolor{\kvtcb@col@color}{\tcb@doc@bfseries\tcb@scantokens{#1}}}

\newrobustcmd{\tcbIndexPrintCountCA}[1]{\tcb@Index@Print@CA{#1}{\kvtcb@col@counter}{\kvtcb@text@counter}}
\newrobustcmd{\tcbIndexPrintCountC}[1]{\tcb@Index@Print@C{#1}{\kvtcb@col@counter}}
\def\tcb@Print@Count#1{\textcolor{\kvtcb@col@counter}{\tcb@doc@bfseries\tcb@scantokens{#1}}}

\newrobustcmd{\tcbIndexPrintLenCA}[1]{\tcb@Index@Print@ComCA{#1}{\kvtcb@col@length}{\kvtcb@text@length}}
\newrobustcmd{\tcbIndexPrintLenC}[1]{\tcb@Index@Print@ComC{#1}{\kvtcb@col@length}}
\def\tcb@Print@Len#1{\textcolor{\kvtcb@col@length}{\tcb@doc@bfseries\tcb@cs{#1}}}

\def\tcb@index@Com#1{\iftcb@doc@toindex\kvtcb@index@command{#1\idx@actual\tcbIndexPrintComC{#1}}\fi}
\def\tcb@index@Env#1{\iftcb@doc@toindex\kvtcb@index@command{#1\idx@actual\tcbIndexPrintEnvCA{#1}}\kvtcb@index@command{\kvtcb@text@envs\idx@level#1\idx@actual\tcbIndexPrintEnvC{#1}}\fi}
\def\tcb@index@Key#1{\iftcb@doc@toindex\kvtcb@index@command{#1\idx@actual\tcbIndexPrintKeyCA{#1}}\kvtcb@index@command{\kvtcb@text@keys\idx@level#1\idx@actual\tcbIndexPrintKeyC{#1}}\fi}%
\def\tcb@index@KeyPath#1#2{\iftcb@doc@toindex\kvtcb@index@command{#2\idx@actual\tcbIndexPrintKeyCA{#2}}\kvtcb@index@command{\kvtcb@text@keys\idx@level#1\idx@actual\tcbIndexPrintKeyC{/#1/}\idx@level#2\idx@actual\tcbIndexPrintKeyC{#2}}\fi}%
\def\tcb@index@Path#1{\iftcb@doc@toindex\kvtcb@index@command{#1\idx@actual\tcbIndexPrintPathCA{#1}}\kvtcb@index@command{\kvtcb@text@paths\idx@level#1\idx@actual\tcbIndexPrintPathC{#1}}\fi}
\def\tcb@index@Val#1{\iftcb@doc@toindex\kvtcb@index@command{#1\idx@actual\tcbIndexPrintValCA{#1}}\kvtcb@index@command{\kvtcb@text@values\idx@level#1\idx@actual\tcbIndexPrintValC{#1}}\fi}
\def\tcb@index@Col#1{\iftcb@doc@toindex\kvtcb@index@command{#1\idx@actual\tcbIndexPrintColCA{#1}}\kvtcb@index@command{\kvtcb@text@colors\idx@level#1\idx@actual\tcbIndexPrintColC{#1}}\fi}
\def\tcb@index@Count#1{\iftcb@doc@toindex\kvtcb@index@command{#1\idx@actual\tcbIndexPrintCountCA{#1}}\kvtcb@index@command{\kvtcb@text@counters\idx@level#1\idx@actual\tcbIndexPrintCountC{#1}}\fi}
\def\tcb@index@Len#1{\iftcb@doc@toindex\kvtcb@index@command{#1\idx@actual\tcbIndexPrintLenCA{#1}}\kvtcb@index@command{\kvtcb@text@lengths\idx@level#1\idx@actual\tcbIndexPrintLenC{#1}}\fi}

\def\brackets#1{{\ttfamily\char`\{}#1{\ttfamily\char`\}}}

\newenvironment{tcb@manual@entry}{\begin{list}{}{%
  \setlength{\leftmargin}{\kvtcb@doc@left}%
  \setlength{\itemindent}{0pt}%
  \setlength{\itemsep}{0pt}%
  \setlength{\parsep}{0pt}%
  \setlength{\rightmargin}{\kvtcb@doc@right}%
  }\item}{\end{list}}

\def\tcb@manual@top#1{\itemsep=0pt\parskip=0pt\item\strut{#1}\par\topsep=0pt}

\def\tcb@doc@do@description{%
  \ifx\kvtcb@doc@description\@empty\else\tcblower\raggedleft(\kvtcb@doc@description)\fi%
}

\newtcolorbox{tcb@doc@head}[1]{blank,colback=white,colframe=white,
  code={\tcbdimto\tcb@temp@grow@left{-\kvtcb@doc@indentleft}%
        \tcbdimto\tcb@temp@grow@right{-\kvtcb@doc@indentright}},
  grow to left by=\tcb@temp@grow@left,%
  grow to right by=\tcb@temp@grow@right,
  sidebyside,sidebyside align=top,
  sidebyside gap=-\tcb@w@upper@real,
  phantom=\phantomsection,%
  enlarge bottom by=-0.2\baselineskip,#1}

% main documentation environments
\newenvironment{docCommand}[3][]{\tcbset{doc label={#2},#1}%
  \begin{tcb@manual@entry}%
  \begin{tcb@doc@head}{doc@head@command}%
  \tcb@Print@Com{#2}\tcb@index@Com{#2}\protected@edef\@currentlabel{\noexpand\tcb@cs{#2}}\label{com:\kvtcb@doc@label}{\ttfamily #3}%
  \tcb@doc@do@description%
  \end{tcb@doc@head}\nobreak\tcbset{before upper=}\kvtcb@doc@body@command@before\ignorespaces}%
  {\ifvmode\else\unskip\fi\kvtcb@doc@body@command@after\end{tcb@manual@entry}}

\newenvironment{docCommand*}{\bgroup\tcb@doc@toindexfalse\begin{docCommand}}{\end{docCommand}\egroup}

\newenvironment{docEnvironment}[3][]{\tcbset{doc label={#2},#1}%
  \begin{tcb@manual@entry}%
  \begin{tcb@doc@head}{doc@head@environment}%
  \strut\cs{begin}\brackets{\tcb@Print@Env{#2}}\tcb@index@Env{#2}\protected@edef\@currentlabel{#2}\label{env:\kvtcb@doc@label}{\ttfamily #3}\par%
  \strut~~\meta{\kvtcb@text@envcontent}\par%
  \strut\cs{end}\brackets{\tcb@Print@Env{#2}}%
  \tcb@doc@do@description%
  \end{tcb@doc@head}\nobreak\tcbset{before upper=}\kvtcb@doc@body@environment@before\ignorespaces}%
  {\ifvmode\else\unskip\fi\kvtcb@doc@body@environment@after\end{tcb@manual@entry}}

\newenvironment{docEnvironment*}{\bgroup\tcb@doc@toindexfalse\begin{docEnvironment}}{\end{docEnvironment}\egroup}

\NewDocumentEnvironment{docKey}{ O{} +O{} m m +m }{\tcbset{doc label={#3},#2,doc description={#5}}%
  \begin{tcb@manual@entry}%
  \begin{tcb@doc@head}{doc@head@key}%
  \ifblank{#1}{%
    \tcb@Print@Key{#3}\tcb@index@Key{#3}\protected@edef\@currentlabel{#3}\label{key:\kvtcb@doc@label}{\ttfamily #4}%
  }{%
    \tcb@Print@Key{/#1/#3}%
    \tcb@index@KeyPath{#1}{#3}\protected@edef\@currentlabel{/#1/#3}\label{key:/#1/\kvtcb@doc@label}{\ttfamily #4}%
  }%
  \tcb@doc@do@description%
  \end{tcb@doc@head}\nobreak\tcbset{before upper=}\kvtcb@doc@body@key@before\ignorespaces}%
  {\ifvmode\else\unskip\fi\kvtcb@doc@body@key@after\end{tcb@manual@entry}}

\newenvironment{docKey*}{\bgroup\tcb@doc@toindexfalse\begin{docKey}}{\end{docKey}\egroup}

\def\tcbmakedocSubKey#1#2{%
  \NewDocumentEnvironment{#1}{ O{} +O{} m m +m }{%
    \ifblank{##1}{\def\tcb@key@path{#2}}{\def\tcb@key@path{#2/##1}}%
    \begin{docKey}[\tcb@key@path][##2]{##3}{##4}{##5}}%
      {\end{docKey}}%
  \newenvironment{#1*}{\bgroup\tcb@doc@toindexfalse\begin{#1}}{\end{#1}\egroup}%
}

\newenvironment{docPathOperation}[3][]{\tcbset{doc label={#2},#1}%
  \begin{tcb@manual@entry}%
  \begin{tcb@doc@head}{doc@head@path}%
  \colFade{\tcb@cs{path ...}}\
  \tcb@Print@Path{#2}\tcb@index@Path{#2}\protected@edef\@currentlabel{#2}\label{path:\kvtcb@doc@label}{\ttfamily #3}%
  \ \colFade{\tcb@scantokens{...;}}
  \tcb@doc@do@description%
  \end{tcb@doc@head}\nobreak\tcbset{before upper=}\kvtcb@doc@body@path@before\ignorespaces}%
  {\ifvmode\else\unskip\fi\kvtcb@doc@body@path@after\end{tcb@manual@entry}}

\newenvironment{docPathOperation*}{\bgroup\tcb@doc@toindexfalse\begin{docPathOperation}}{\end{docPathOperation}\egroup}

\DeclareDocumentCommand\docAuxCommand{sm}{%
  \tcb@Print@Com{#2}%
  \IfBooleanTF{#1}{}{\tcb@index@Com{#2}}%
}

\DeclareDocumentCommand\docAuxEnvironment{sm}{%
  \tcb@Print@Env{#2}%
  \IfBooleanTF{#1}{}{\tcb@index@Env{#2}}%
}

\DeclareDocumentCommand\docAuxKey{sO{}m}{%
  \ifblank{#2}{%
    \tcb@Print@Key{#3}%
    \IfBooleanTF{#1}{}{\tcb@index@Key{#3}}%
  }{%
    \tcb@Print@Key{/#2/#3}%
    \IfBooleanTF{#1}{}{\tcb@index@KeyPath{#2}{#3}}%
}}

\DeclareDocumentCommand\docColor{sm}{%
  \tcb@Print@Col{#2}%
  \IfBooleanTF{#1}{}{\tcb@index@Col{#2}}%
}

\DeclareDocumentCommand\docCounter{sm}{%
  \tcb@Print@Count{#2}%
  \IfBooleanTF{#1}{}{\tcb@index@Count{#2}}%
}

\DeclareDocumentCommand\docLength{sm}{%
  \tcb@Print@Len{#2}%
  \IfBooleanTF{#1}{}{\tcb@index@Len{#2}}%
}

\DeclareDocumentCommand\docValue{sm}{%
  \tcb@Print@Val{#2}%
  \IfBooleanTF{#1}{}{\tcb@index@Val{#2}}%
}

\setrefcountdefault{-1}
\DeclareDocumentCommand\tcb@ref@doc{msm}{%
  \hyperref[#1:#3]{\texttt{\ref*{#1:#3}}%
  \IfBooleanTF{#2}{}{%
    \ifnum\getpagerefnumber{#1:#3}=\thepage%
    \else%
      \textsuperscript{\ding{213}\,\kvtcb@text@pageshort\,\pageref*{#1:#3}}%
    \fi}}%
}

\def\refCom{\tcb@ref@doc{com}}
\def\refEnv{\tcb@ref@doc{env}}
\def\refKey{\tcb@ref@doc{key}}
\def\refPathOperation{\tcb@ref@doc{path}}

\def\refAux#1{\textcolor{\kvtcb@colhyper}{\tcb@scantokens{#1}}}
\def\refAuxcs#1{\textcolor{\kvtcb@colhyper}{\tcb@cs{#1}}}

\newenvironment{absquote}
               {\list{}{\leftmargin2cm\rightmargin\leftmargin}%
                \item\relax\footnotesize}
               {\endlist}

\newcommand{\tcbdocmarginnote}[2][]{%
  \marginnote{%
  \begin{tcolorbox}[enhanced jigsaw,size=fbox,boxrule=1pt,leftrule=0pt,rightrule=0pt,
    arc=0pt,outer arc=1pt,boxsep=1pt,top=1pt,bottom=1pt,
    nobeforeafter,width=\marginparwidth,
    colframe=red!50!white,colback=red!25!yellow!5!white,fontupper=\scriptsize,
    if odd page or oneside={flushright upper}{flushleft upper},
    doc@marginnote,#1]#2\end{tcolorbox}}}

\newcommand*{\tcbdocnew}[1]{\kvtcb@text@new: #1}
\newcommand*{\tcbdocupdated}[1]{\kvtcb@text@updated: #1}

%--- index macros taken from pgfmanual-en-macros
\def\tcb@doc@index@pgf@{%
  \ifdefined\c@IndexColumns%
    \c@IndexColumns=2%
  \fi%
  \def\theindex{\@restonecoltrue
    \columnseprule \z@  \columnsep 29\p@
    \twocolumn[\index@prologue]%
    \parindent -30pt%
    \columnsep 15pt%
    \parskip 0pt plus 1pt%
    \leftskip 30pt%
    \rightskip 0pt plus 2cm%
    \small%
    \def\@idxitem{\par}%
    \let\item\@idxitem\ignorespaces}
  \def\endtheindex{\onecolumn}%
  \def\noindexing{\let\index=\@gobble}%
}

\def\tcb@doc@index@pgfsection{%
  \def\index@prologue{\section*{\kvtcb@text@index}\addcontentsline{toc}{section}{\kvtcb@text@index}%
    \par\noindent%
  }%
  \tcb@doc@index@pgf@%
}

\def\tcb@doc@index@pgfchapter{%
  \def\index@prologue{\ifdefined\phantomsection\phantomsection\fi\@makeschapterhead{\kvtcb@text@index}\addcontentsline{toc}{chapter}{\kvtcb@text@index}}%
  \tcb@doc@index@pgf@%
}

\let\tcb@doc@index@pgf=\tcb@doc@index@pgfsection%

\def\tcb@doc@index@doc{%
  \let\tcb@index@Com=\SpecialMainIndex%%
  \let\tcb@index@Env=\SpecialMainEnvIndex%
  \tcbset{index german settings}%
  \EnableCrossrefs%
  \PageIndex%
}

\def\tcb@doc@index@off{}%

\tcbset{%
  reset@documentation/.style={%
    },
  documentation listing style=tcbdocumentation,
  doc left=2em,
  doc right=0pt,
  doc left indent=-2em,
  doc right indent=0pt,
  doc head=,
  before doc body=,
  after doc body=,
  doc description=,
  doc into index=true,
  doc marginnote=,
  initialize@reset=reset@documentation,
  color option=Option,
  color definition=Definition,
  color hyperlink=Hyperlink,
  color fade=Fade,
  index command=\index,%
  index format=pgf,
  index default settings,
  index colorize=false,
  index annotate=true,
  english language,
  keywords bold,
}

% deprecated
\tcbset{
  before example/.store in=\kvtcb@beforeexample,
  after example/.store in=\kvtcb@afterexample,
    before example=\par\smallskip,
    after example=,
}
