\ProvidesPackage{awesome-beamer-theme}[]


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\RequirePackage{kvoptions}
\SetupKeyvalOptions{family=awesome,prefix=awesome@}

\newif\ifawesome@english@
\DeclareVoidOption{english}{\awesome@english@true}
\DeclareVoidOption{german}{\awesome@english@false}

\DeclareBoolOption{notoc}
\DeclareBoolOption{secslide}
\DeclareBoolOption{subsecslide}
\DeclareBoolOption{nonumbersinframetitle}

\DeclareDefaultOption{\PassOptionsToPackage{\CurrentOption}{smile}}

\ProcessKeyvalOptions*

\ifawesome@english@\RequirePackage[french]{babel}\else\RequirePackage[ngerman]{babel}\fi


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\RequirePackage{calc}
\RequirePackage{microtype}
\RequirePackage{etoolbox}
\RequirePackage{tcolorbox}
\tcbuselibrary{skins}
\RequirePackage[
	tikz,
	hyperref,
	pdftitle={\noexpand\inserttitle},
	pdfauthor={\noexpand\insertauthor},
	pdfsubject={\noexpand\inserttitle}
]{smile}

\usetikzlibrary{overlay-beamer-styles,decorations.markings}
\tikzset{
	node distance = 5mm,
	invisible/.style={opacity=0},
	muted/.style={opacity=0.3},
	visible on/.style={alt={#1{}{invisible}}},
	hidden on/.style={alt={#1{invisible}{}}},
	muted on/.style={alt={#1{muted}{}}},
	unmuted on/.style={alt={#1{}{muted}}},
	alt/.code args={<#1>#2#3}{%
		\alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}
	},
	modal background/.style={fill=gray,opacity=0.8},
	modal box/.style={draw=black,rnd,fill=white,lw,shadow,inner sep=3mm,text width=0.66\paperwidth},
	modal title/.style={roundednode,fill=black,text=white}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\def\maketitle{
	\begin{frame}[noframenumbering,plain]
		\titlepage
	\end{frame}
	\ifawesome@notoc\else
		\begin{frame}{Table des matières}
			\tableofcontents
		\end{frame}
	\fi
}

\let\oldft\frametitle
\renewcommand\frametitle[2][]{%
	\ifx\relax#1\relax\oldft{#2}\else%
		\ifnum\beamer@autobreakcount>0\oldft[#1]{#2}\else%
			\oldft{#2\hfill\normalfont\large\color{darkgray}\raisebox{0.3ex}{#1}}%
		\fi%
	\fi%
}

\BeforeBeginEnvironment{tabular}{\def\arraystretch{1.1}}

\providebool{wideframe}
\define@key{beamerframe}{wide}[true]{
	\booltrue{wideframe}
	\begingroup
}

\apptocmd{\beamer@reseteecodes}{%
	\ifbool{wideframe}{%
		\endgroup
		\boolfalse{wideframe}
	}{}
}{}{}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\newcounter{framesinsection}
\newcounter{framesinsubsection}
\counterwithin*{framesinsection}{section}
\counterwithin*{framesinsubsection}{subsection}

\def\stepframe{%
	\ifbeamer@isfragile%
		\stepcounter{framesinsection}%
		\stepcounter{framesinsubsection}%
	\else%
		\ifbeamer@noframenumbering\else%
			\stepcounter{framesinsection}%
			\stepcounter{framesinsubsection}%
		\fi%
	\fi%
	\ifnum\theframesinsection=0\setcounter{framesinsection}{1}\fi%
	\ifnum\theframesinsubsection=0\setcounter{framesinsubsection}{1}\fi%
}

\BeforeBeginEnvironment{frame}{\stepframe}
\pretocmd\againframe{\stepframe}{}{}

\def\refreshcountsinaux{%
	\immediate\write\@auxout{\global\noexpand\@namedef{s@totalsubsectionframes-\arabic{section}-\arabic{subsection}}{\theframesinsubsection}}%
	\immediate\write\@auxout{\global\noexpand\@namedef{s@totalsectionframes-\arabic{section}}{\theframesinsection}}%
}

\newcounter{secinc}
\pretocmd\section{%
	% At this point, the section command has not yet incremented the section counter, so we need to do this by ourselves
	\setcounter{secinc}{\thesection + 1}%
	\refreshcountsinaux%
	\immediate\write\@auxout{\global\noexpand\@namedef{s@frameatsecstart-\arabic{secinc}}{\insertframenumber}}%
}{}{}

\newcounter{subsecinc}
\pretocmd\subsection{%
	% At this point, the subsection command has not yet incremented the subsection counter, so we need to do this by ourselves
	\setcounter{subsecinc}{\thesubsection + 1}%
	\refreshcountsinaux%
	\immediate\write\@auxout{\global\noexpand\@namedef{s@frameatsubsecstart-\arabic{section}-\arabic{subsecinc}}{\insertframenumber}}%
}{}{}

\AtEndDocument{\refreshcountsinaux}

\def\framespersection{%
	\ifcsdef{s@totalsectionframes-\arabic{section}}{%
		\csname s@totalsectionframes-\arabic{section}\endcsname%
	}{0}%
}

\def\framespersubsection{%
	\ifcsdef{s@totalsubsectionframes-\arabic{section}-\arabic{subsection}}{%
		\csname s@totalsubsectionframes-\arabic{section}-\arabic{subsection}\endcsname%
	}{0}%
}

\def\insertsectionstartframe{%
	\ifcsdef{s@frameatsecstart-\arabic{section}}{%
		\csname s@frameatsecstart-\arabic{section}\endcsname%
	}{0}%
}

\def\insertsubsectionstartframe{%
	\ifcsdef{s@frameatsubsecstart-\arabic{section}-\arabic{subsection}}{%
		\csname s@frameatsubsecstart-\arabic{section}-\arabic{subsection}\endcsname%
	}{0}%
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\setbeamercolor{alerted text}{fg=accent}

\setbeamercolor{subtitle}{fg=darkgray}
\setbeamercolor{frametitle}{fg=black}
\setbeamercolor{framesubtitle}{fg=darkgray}

\setbeamercolor{details}{fg=black}
\setbeamercolor{author}{fg=black}

\setbeamercolor{section number projected}{bg=black, fg=accent}
\setbeamercolor{subsection number projected}{fg=lightgray, fg=accent}

\setbeamercolor{structure}{fg=black}
\setbeamercolor{normal text}{fg=black}
\setbeamercolor{separator}{fg=accent, bg=accent}
\setbeamercolor{footline}{bg=lightgray}
\setbeamercolor{footlineright}{fg=white, bg=accent}

\setbeamercolor{block body}{bg=lightgray}
\setbeamercolor{block title}{bg=black, fg=white}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\setbeamerfont{title}{
	size=\LARGE,
	shape=\bfseries\scshape
}

\setbeamerfont{subtitle}{
	size=\large,
	shape=\normalfont
}

\setbeamerfont{author}{
	size=\normalsize,
	shape=\normalfont
}

\setbeamerfont{details}{
	size=\footnotesize,
	shape=\normalfont
}

\setbeamerfont{footline}{
	size=\tiny,
	shape=\normalfont
}

\setbeamerfont{footnote}{
	size=\tiny,
	shape=\normalfont
}

\setbeamerfont{frametitle}{
	size=\LARGE,
	shape=\bfseries\scshape
}

\setbeamerfont{framesubtitle}{
	size=\normalsize,
	shape=\normalfont
}

\setbeamerfont{block title}{
	size=\normalfont,
	shape=\strut
}

\setbeamerfont{blockdef}{
	size=\large,
	shape=\bfseries
}

\setbeamerfont{description item}{
	shape=\bfseries
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\newlength\awesome@sidebarwidth\setlength{\awesome@sidebarwidth}{0.15\paperwidth}
\newlength\awesome@textmargin\setlength{\awesome@textmargin}{0.05\paperwidth}
\setbeamersize{description width=0.5cm}
\setbeamersize{sidebar width left=\awesome@sidebarwidth}
\setbeamersize{sidebar width right=\z@}
\setbeamersize{text margin left=\awesome@textmargin}
\setbeamersize{text margin right=\awesome@textmargin}

\setbeamertemplate{caption}{\insertcaption}
\setbeamertemplate{blocks}[rounded][shadow=false]
\setbeamertemplate{itemize item}[circle]
\setbeamertemplate{itemize subitem}[circle]

\addtobeamertemplate{frametitle continuation}{\color{gray}(}{)}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{headline}{}

\setbeamertemplate{section in toc}{%
	\usebeamercolor[fg]{section number projected}\inserttocsectionnumber.%
	\usebeamercolor[fg]{normal text}~\inserttocsection%
}

\newenvironment{wide}{\begingroup\leavevmode%
	\hspace*{-\awesome@sidebarwidth}\fboxsep\z@\minipage{\linewidth+2cm}%
}{\endminipage\endgroup}

\setbeamertemplate{subsection in toc}{%
	\mbox{\hskip2em%
		\usebeamercolor[fg]{section number projected}\inserttocsectionnumber.%
		\usebeamercolor[fg]{subsection number projected}\textsubscript{\inserttocsubsectionnumber}%
		\usebeamercolor[fg]{normal text}~\inserttocsubsection%
	}%
}

\setbeamertemplate{separator}{%
	\usebeamercolor{separator}\textcolor{fg}{\rule{.7\textwidth}{\smile@linewidth}}%
}

\setbeamertemplate{frametitle}{%
	\vspace{1em}\ifawesome@nonumbersinframetitle\ifbool{wideframe}{\hspace{-\awesome@sidebarwidth}}{}\else\hspace{-\awesome@sidebarwidth}\begin{beamercolorbox}[wd=\awesome@sidebarwidth]{frametitle}%
		\ifx\insertsection\empty\else%
			\color{accent}\thesection%
			\ifx\insertsubsection\empty%
				\ifnum\framespersection>1%
					.\color{black!25!white}\scalebox{.7}{\theframesinsection}%
				\fi%
			\else%
				.\thesubsection%
				\ifnum\framespersubsection>1%
					.\color{black!25!white}\scalebox{.7}{\theframesinsubsection}%
				\fi%
			\fi%
		\fi
	\end{beamercolorbox}\fi%
	\begin{beamercolorbox}{frametitle}%
		\insertframetitle%
	\end{beamercolorbox}
	\ifx\insertframesubtitle\empty\else%
	\begin{beamercolorbox}{framesubtitle}%
		\ifawesome@nonumbersinframetitle\ifbool{wideframe}{\hspace{-\awesome@sidebarwidth}}{}\fi\usebeamerfont{subtitle}\insertframesubtitle%
	\end{beamercolorbox}\fi%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newtcolorbox{beamerbox}[3][]{boxrule=\smile@linewidth,
IfBlankTF={#3}{toprule=2mm}{title=#3},colback=#2!5!white,colframe=#2!75!black,left=0em,
lefttitle=4mm, arc=\smile@rounding, enhanced, segmentation engine=path,
segmentation style={lcr, solid, shorten >=1mm,shorten <=1mm, line width=\smile@linewidth},#1}

\renewenvironment{definition}[1][\empty]{%
	\begin{beamerbox}{gray}{#1}%
}{\end{beamerbox}}

\renewenvironment{block}[1][]{%
	\begin{beamerbox}{accent}{#1}%
}{\end{beamerbox}}

\renewenvironment{examples}[1][]{%
	\begin{beamerbox}{green}{#1}%
}{\end{beamerbox}}

\renewenvironment{alertblock}[1][]{%
	\begin{beamerbox}{red}{#1}%
}{\end{beamerbox}}

\newenvironment<>{modal}[1][]{%
	\def\titlename{#1}%
	\visibleenv#2%
	\begin{tikzpicture}[o,node distance=0pt]%
		\fill[modal background] (current page.south west) rectangle (current page.north east);%
		\node[modal box] at (current page) (MODALCONTENT) \bgroup%
}{%
		\egroup;%
		\if\expandafter\isempty\expandafter{\titlename}\else\node[modal title] at (MODALCONTENT.north) {\titlename};\fi
	\end{tikzpicture}%
	\endvisibleenv%
}

\ensureinfocommand{title}
\ensureinfocommand{author}
\ensureinfocommand{background}
\ensureinfocommand{email}
\ensureinfocommand{uni}
\ensureinfocommand{location}
\def\inserttitle{\ifdefined\@title\@title\fi}
\def\insertshorttitle{\ifdefined\@shorttitle\@shorttitle\fi}
\def\insertauthor{\ifdefined\@author\@author\fi}
\def\insertshortauthor{\ifdefined\@shortauthor\@shortauthor\fi}
\def\insertemail{\ifdefined\@email\href{mailto:\@email}{\@email}\fi}
\def\insertuni{\ifdefined\@uni\@uni\fi}
\def\insertlocation{\ifdefined\@location\@location\fi}

\tikzfading[
	name=title page picture fading,
	left color=transparent!0,
	right color=transparent!100,
]

\def\ps@navigation@titlepage{\setbeamertemplate{footline}{}\@nameuse{ps@navigation}}

\newlength\lhswidth\setlength{\lhswidth}{.55\textwidth}
\newlength\titlewidth
\newlength\subtitlewidth
\newlength\maxwidth
\setbeamertemplate{title page}{\begin{wide}
	\def\titlecontent{\usebeamerfont{title}\usebeamercolor[fg]{title}\inserttitle}%
	\def\subtitlecontent{\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle}%
	\settowidth\titlewidth\titlecontent%
	\settowidth\subtitlewidth\subtitlecontent%
	\setlength\maxwidth{\ifdim\titlewidth>\subtitlewidth\titlewidth\else\subtitlewidth\fi}%
	\thispagestyle{navigation@titlepage}%
	\begin{minipage}{\lhswidth}
		\raggedright%
		\titlecontent\\
		\vspace{0.25cm}
		\subtitlecontent\\
		\vspace*{-0.25cm}
		\textcolor{accent}{\rule{\ifdim\maxwidth<\lhswidth\maxwidth\else\lhswidth\fi}{\smile@linewidth}}\\[2em]
		\usebeamerfont{author}\usebeamercolor[fg]{author}%
		\insertauthor\\
		\usebeamerfont{details}\usebeamercolor[fg]{details}%
		\insertemail\\[2em]
		\usebeamerfont{details}\usebeamercolor[fg]{details}%
		\insertinstitute\\
		\insertuni\\[2em]
		\insertdate
	\end{minipage}

	\ifdefined\@background
		\begin{tikzpicture}[remember picture, overlay]
			\clip (current page.south east)
				-- (current page.north east)
				-- ++(-5.1, 0)
				-- ++(-3, -\paperheight)
				-- cycle;

			\node[
				anchor=south east,
				inner sep=0,
				outer sep=0
			] at (current page.south east) {
				\includegraphics[height=\paperheight]{\@background}
			};

			%\fill[
			%	black, path fading=title page picture fading,
			%	fading angle=-15
			%]
			%(current page.south east)
			%rectangle
			%++(-10, \dimexpr\paperheight+1cm);
		\end{tikzpicture}
	\fi
\end{wide}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newlength\maxfooterwd\maxfooterwd=0pt
\def\updatemaxfooterwd#1{\ifdim#1>\maxfooterwd%
	\global\maxfooterwd=#1%
	\immediate\write\@auxout{\global\maxfooterwd=\the#1}%
\fi}
% Make sure we always put the current max footer width into the aux file
\AtEndDocument{\immediate\write\@auxout{\global\maxfooterwd=\the\maxfooterwd}}
\newsavebox\footerright
\def\setfooter#1#2#3{\savebox\footerright{\color{white}\hspace{0.3cm}#3\hspace{0.3cm}}
	\updatemaxfooterwd{\wd\footerright}\leavevmode\hbox{%
	\usebeamerfont{footline}%
	\begin{beamercolorbox}[wd=\dimexpr\textwidth-\maxfooterwd\relax,ht=2.5ex,dp=1ex]{footline}%
		\hspace{0.3cm}#1\hfill#2\hfill\null%
	\end{beamercolorbox}%
	\begin{beamercolorbox}[wd=\maxfooterwd,ht=2.5ex,dp=1ex]{footlineright}%
		\centerline{\usebox\footerright}%
	\end{beamercolorbox}%
}}

\def\awesome@smalldot{\tikz[baseline=-.6ex]\node[circle,inner sep=0.16,draw=.,fill=.]{};}
\def\awesome@fulldot{\tikz[baseline=-.6ex]\node[circle,inner sep=0.32ex,draw=.,fill=.]{};}
\def\awesome@emptydot{\tikz[baseline=-.6ex]\node[circle,inner sep=0.32ex,draw=.,fill=none]{};}

\newcounter{pagenumbertolinkto}
\setbeamertemplate{footline}{%
	\setfooter{\insertshortauthor}{%
		\hyperlinkdocumentstart{\insertshorttitle}\hspace{.7em}\awesome@smalldot\hspace{.7em}\hypersetup{urlcolor=black}\href{\doclicenseURL}{\doclicenseIcon}\hspace{.7em}\awesome@smalldot\hspace{.7em}\insertsection%
		\ifx\insertsubsection\empty%
			\hspace{.4em}%
			\ifnum\framespersection>1%
				\foreach \i in {1, ..., \framespersection}{%
					\ifnum \i=\theframesinsection%
						~\awesome@fulldot%
					\else%
						\setcounter{pagenumbertolinkto}{\i + \insertsectionstartframe}%
						~\hyperlink{page:\thepagenumbertolinkto}{\awesome@emptydot}%
					\fi%
				}%
			\fi%
		\else%
			\hspace{.7em}\awesome@smalldot\hspace{.7em}\insertsubsection%
			\hspace{.7em}%
			\ifnum\framespersubsection>1%
				\foreach \i in {1, ..., \framespersubsection}{%
					\ifnum \i=\theframesinsubsection%
						~\awesome@fulldot%
					\else%
						\setcounter{pagenumbertolinkto}{\i + \insertsubsectionstartframe}%
						~\hyperlink{page:\thepagenumbertolinkto}{\awesome@emptydot}%
					\fi%
				}%
			\fi%
		\fi%
	}{\ifawesome@english@ Page\else Seite\fi~\insertframenumber~/~\inserttotalframenumber}%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\ps@navigation@toc{%
	\setbeamertemplate{footline}{\setfooter{\insertshortauthor}{\hyperlinkdocumentstart{\insertshorttitle}\hspace{.7em}\awesome@smalldot\hspace{.7em}\hypersetup{urlcolor=black}\href{\doclicenseURL}{\doclicenseIcon}}{Table des matières}}%
	\@nameuse{ps@navigation}%
}

\def\ps@navigation@sec{%
	\setbeamertemplate{footline}{%
		\setfooter{\insertshortauthor}%
		{\hyperlinkdocumentstart{\insertshorttitle}\hspace{.7em}\awesome@smalldot\hspace{.7em}\hypersetup{urlcolor=black}\href{\doclicenseURL}{\doclicenseIcon}}%
		{\ifawesome@english@ Section\else Kapitel\fi~\thesection\ifx\insertsubsection\empty\else.\thesubsection\fi}%
	}%
	\@nameuse{ps@navigation}%
}

\pretocmd\tableofcontents{\thispagestyle{navigation@toc}}{}{}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Kinda hacky, but AtBeginEnvironment does not work with beamer tex.stackexchange.com/a/436338/286979
\pretocmd\beamer@checkframetitle{%
	\transfade[duration=0.1]%
	\ifbeamer@isfragile%
		\label{page:\insertframenumber}%
	\else\ifbeamer@noframenumbering\else\hypertarget{page:\insertframenumber}{}\fi\fi%
}


\AtBeginSection[]{\ifawesome@secslide
	\begin{frame}[c,noframenumbering]\thispagestyle{navigation@sec}%
		\begin{wide}\centering%
		\usebeamerfont{title}%
		\usebeamercolor[fg]{section number projected}%
		\scalebox{1.3}{ \raisebox{-1pt}{\insertsectionnumber}}.~%
		\usebeamercolor[fg]{title}%
		\insertsectionhead%
		\end{wide}%
	\end{frame}
\fi}

\AtBeginSubsection[]{\ifawesome@subsecslide
	\begin{frame}[c,noframenumbering]\thispagestyle{navigation@sec}%
		\begin{wide}\centering%
		\usebeamerfont{title}%
		\usebeamercolor[fg]{section number projected}%
		\scalebox{1.3}{\raisebox{-1pt}{\insertsectionnumber}}.%
		\usebeamercolor[fg]{subsection number projected}%
		\textsubscript{\insertsubsectionnumber}~%
		\usebeamercolor[fg]{title}%
		\insertsubsectionhead%
		\end{wide}%
	\end{frame}
\fi}

\AtEndDocument{
	{\setbeamercolor{background canvas}{bg=accent}
	\begin{frame}[b,noframenumbering]\thispagestyle{navigation@titlepage}%
		\begin{wide}\color{white}%
			\Large\textbf{\insertauthor}\vskip0.5em\scriptsize\insertlocation,~\insertdate\hfill\large\hypersetup{urlcolor=white}\href{\doclicenseURL}{\doclicenseIcon}%
		\end{wide}%
	\end{frame}}
}
