%%
%% This is file `scrlayer-scrpage.sty',
%% generated with the docstrip utility, extended by scrdocstrip.
%%
%% The original source files were:
%%
%% scrlayer-scrpage.dtx  (with options: `interface,trace,scrpage,identify')
%% scrlayer.dtx  (with options: `interface,trace,scrpage,init')
%% scrlayer-scrpage.dtx  (with options: `interface,trace,scrpage,init')
%% scrlayer.dtx  (with options: `interface,trace,scrpage,options')
%% scrlayer-scrpage.dtx  (with options: `interface,trace,scrpage,options')
%% scrlayer.dtx  (with options: `interface,trace,scrpage,body')
%% scrlayer-scrpage.dtx  (with options: `interface,trace,scrpage,body')
%% scrlogo.dtx  (with options: `logo')
%% 
%% Copyright (c) 2012-2014 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 may
%% find a complete unmodified copy of LaTeX2e at
%% <http://www.ctan.org/pub/tex-archive/macros/latex/base/>.
%% 
%%% From File: $Id: scrlayer-scrpage.dtx 2070 2015-04-08 09:02:19Z kohm $ (identify)
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{scrlayer-scrpage}[%
  2015/05/06 v3.17a KOMA-Script
  package
  (end user interface for scrlayer)]
%%% From File: $Id: scrlayer.dtx 1962 2015-02-26 08:34:33Z kohm $ (init)
\RequirePackage{scrlayer}
\scr@ifundefinedorrelax{scrlayer@AtEndOfPackage}{%
  \AtEndOfPackage{\let\scrlayer@AtEndOfPackage\@firstofone}%
}{%
  \ifx\scrlayer@AtEndOfPackage\@firstofone
    \AtEndOfPackage{\let\scrlayer@AtEndOfPackage\@firstofone}%
  \fi
}
\let\scrlayer@AtEndOfPackage\AtEndOfPackage
\scrlayerInitInterface
%%% From File: $Id: scrlayer-scrpage.dtx 2070 2015-04-08 09:02:19Z kohm $ (init)
\AtEndOfPackage{%
  \sls@auto@pagestyleset%
}
\newcommand*{\sls@auto@pagestyleset}{%
  \scr@ifundefinedorrelax{KOMAClassName}{%
    \PackageInfoNoLine{scrlayer-scrpage}{%
      auto-selection of `pagestyleset=standard'}%
    \FamilyExecuteOptions[.scrlayer-scrpage.sty]{KOMA}{pagestyleset=standard}%
  }{%
    \PackageInfoNoLine{scrlayer-scrpage}{%
      auto-selection of `pagestyleset=KOMA-Script'}%
    \FamilyExecuteOptions[.scrlayer-scrpage.sty]{KOMA}%
    {pagestyleset=KOMA-Script}%
  }%
}
%%% From File: $Id: scrlayer.dtx 1962 2015-02-26 08:34:33Z kohm $ (options)
\KOMA@key{markcase}{%
\scrlayer@AtEndOfPackage{%
  \begingroup
    \KOMA@set@ncmdkey{markcase}{reserved@a}{%
      {upper}{0},{lower}{1},{used}{2},%
      {ignoreuppercase}{3},{nouppercase}{3},%
      {ignoreupper}{3},{noupper}{3}%
    }{#1}%
    \ifx\FamilyKeyState\FamilyKeyStateProcessed
      \aftergroup\FamilyKeyStateProcessed
      \ifnum \reserved@a>\m@ne
        \aftergroup\let\aftergroup\MakeMarkcase
        \ifcase \reserved@a
          \aftergroup\MakeUppercase
          \aftergroup\scrlayer@forceignoreuppercasefalse
        \or
          \aftergroup\MakeLowercase
          \aftergroup\scrlayer@forceignoreuppercasefalse
        \or
          \aftergroup\@firstofone
          \aftergroup\scrlayer@forceignoreuppercasefalse
        \else
          \aftergroup\scrlayer@ignoreuppercase
          \aftergroup\scrlayer@forceignoreuppercasetrue
        \fi
      \fi
    \else
      \aftergroup\FamilyKeyStateUnknownValue
    \fi
  \endgroup
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \KOMA@kav@removekey{.scrlayer.sty}{markcase}%
    \KOMA@kav@xadd{.scrlayer.sty}{markcase}{#1}%
  \fi
}%
}
\KOMA@key{autooneside}[true]{%
  \KOMA@set@ifkey{autooneside}{scrlayer@autooneside}{#1}%
  \KOMA@kav@replacebool{.scrlayer.sty}{autooneside}{scrlayer@autooneside}%
}
\KOMA@key{automark}[]{%
  \scrlayer@testunexpectedarg{automark}{#1}%
  \scrlayer@AtEndOfPackage{%
    \if@chapter
      \automark[section]{chapter}%
    \else
      \automark[subsection]{section}%
    \fi
  }%
  \FamilyKeyStateProcessed
  \KOMA@kav@removekey{.scrlayer.sty}{automark}%
  \KOMA@kav@removekey{.scrlayer.sty}{manualmark}%
  \KOMA@kav@add{.scrlayer.sty}{automark}{}%
}
\KOMA@key{manualmark}[]{%
  \scrlayer@testunexpectedarg{manualmark}{#1}%
  \scrlayer@AtEndOfPackage{\manualmark}%
  \FamilyKeyStateProcessed
  \KOMA@kav@removekey{.scrlayer.sty}{automark}%
  \KOMA@kav@removekey{.scrlayer.sty}{manualmark}%
  \KOMA@kav@add{.scrlayer.sty}{manualmark}{}%
}
\KOMA@key{onpsselect}{%
  \l@addto@macro{\@ps@initialhook}{#1}%
  \FamilyKeyStateProcessed
  \KOMA@kav@add{.scrlayer.sty}{onpsselect}{#1}%
}
\KOMA@key{onpsinit}{%
  \l@addto@macro{\@ps@hook}{#1}%
  \FamilyKeyStateProcessed
  \KOMA@kav@add{.scrlayer.sty}{onpsinit}{#1}%
}
\KOMA@key{onpsoneside}{%
  \l@addto@macro{\@ps@onesidehook}{#1}%
  \FamilyKeyStateProcessed
  \KOMA@kav@add{.scrlayer.sty}{onpsoneside}{#1}%
}
\KOMA@key{onpstwoside}{%
  \l@addto@macro{\@ps@twosidehook}{#1}%
  \FamilyKeyStateProcessed
  \KOMA@kav@add{.scrlayer.sty}{onpstwoside}{#1}%
}
\KOMA@key{onpsoddpage}{%
  \l@addto@macro{\@ps@oddpagehook}{#1}%
  \FamilyKeyStateProcessed
  \KOMA@kav@add{.scrlayer.sty}{onpsoddpage}{#1}%
}
\KOMA@key{onpsevenpage}{%
  \l@addto@macro{\@ps@evenpagehook}{#1}%
  \FamilyKeyStateProcessed
  \KOMA@kav@add{.scrlayer.sty}{onpsevenpage}{#1}%
}
\KOMA@key{onpsfloatpage}{%
  \l@addto@macro{\@ps@floatpagehook}{#1}%
  \FamilyKeyStateProcessed
  \KOMA@kav@add{.scrlayer.sty}{onpsfloatpage}{#1}%
}
\KOMA@key{onpsnonfloatpage}{%
  \l@addto@macro{\@ps@nonfloatpagehook}{#1}%
  \FamilyKeyStateProcessed
  \KOMA@kav@add{.scrlayer.sty}{onpsnonfloatpage}{#1}%
}
\KOMA@key{onpsbackground}{%
  \l@addto@macro{\@ps@backgroundhook}{#1}%
  \FamilyKeyStateProcessed
  \KOMA@kav@add{.scrlayer.sty}{onpsbackground}{#1}%
}
\KOMA@key{onpsforeground}{%
  \l@addto@macro{\@ps@foregroundhook}{#1}%
  \FamilyKeyStateProcessed
  \KOMA@kav@add{.scrlayer.sty}{onpsforeground}{#1}%
}
\KOMA@key{deactivatepagestylelayers}[true]{%
  \KOMA@set@ifkey{deactivatepagestylelayers}{scrlayer@deactivate@layers}{#1}%
  \KOMA@kav@replacebool{.scrlayer.sty}{deactivatepagestylelayers}
                       {scrlayer@deactivate@layers}%
}
\KOMA@key{draft}[true]{%
  \KOMA@set@ifkey{draft}{scrlayer@draft}{#1}%
  \KOMA@kav@replacebool{.scrlayer.sty}{draft}{scrlayer@draft}%
}
\KOMA@key{forceoverwrite}[true]{%
  \KOMA@set@ifkey{forceoverwrite}{scrlayer@forceoverwrite}{#1}%
  \KOMA@kav@replacebool{.scrlayer.sty}{forceoverwrite}{scrlayer@forceoverwrite}%
}
\KOMA@key{autoremoveinterfaces}[true]{%
  \KOMA@set@ifkey{autoremoveinterfaces}{scrlayer@autoremoveinterfaces}{#1}%
  \KOMA@kav@replacebool{.scrlayer.sty}{autoremoveinterfaces}
                       {scrlayer@autoremoveinterfaces}%
}
%%% From File: $Id: scrlayer-scrpage.dtx 2070 2015-04-08 09:02:19Z kohm $ (options)
\KOMA@key{headwidth}{%
  \begingroup
    \sls@split@at@iicolons#1:::\@nil
    \ifx\reserved@a\@empty \let\reserved@a\sls@headwidth\fi
    \edef\reserved@a{%
      \noexpand\endgroup
      \noexpand\sls@set@hf@width{head}{\reserved@b}{\reserved@c}{\reserved@a}%
      \noexpand\FamilyKeyStateProcessed
      \noexpand\KOMA@kav@replacevalue{.scrlayer-scrpage.sty}{headwidth}{%
        \reserved@a:\reserved@b:\reserved@c
      }%
    }%
  \reserved@a
}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@headwidth}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@headwidth@default}
\KOMA@key{footwidth}{%
  \begingroup
    \sls@split@at@iicolons#1:::\@nil
    \ifx\reserved@a\@empty \let\reserved@a\sls@footwidth\fi
    \edef\reserved@a{%
      \noexpand\endgroup
      \noexpand\sls@set@hf@width{foot}{\reserved@b}{\reserved@c}{\reserved@a}%
      \noexpand\FamilyKeyStateProcessed
      \noexpand\KOMA@kav@replacevalue{.scrlayer-scrpage.sty}{footwidth}{%
        \reserved@a:\reserved@b:\reserved@c
      }%
    }%
  \reserved@a
}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@footwidth}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@footwidth@default}
\scrlayerAddToInterface\sls@split@at@iicolons{%
  \def\sls@split@at@iicolons#1:#2:#3:#4\@nil{%
    \ifstr{#4}{}{}{%
      \ifstr{#4}{:}{}{%
        \ifstr{#4}{::}{}{%
          \PackageWarning{scrlayer}{extra `:' found!\MessageBreak
            You've used more than two colons at the argument\MessageBreak
            of a two value option.\MessageBreak
            The extra value(s) will be ignored%
          }%
        }%
      }%
    }%
    \def\reserved@a{#1}%
    \def\reserved@b{#2}%
    \def\reserved@c{#3}%
  }%
}
\scrlayerAddToInterface\sls@set@hf@width{%
  \newcommand*{\sls@set@hf@width}[4]{%
    \sls@settowidthof{\@tempdima}{#4}%
    \ifdim\@tempdima>\paperwidth
      \PackageWarning
        {scrlayer-scrpage}%
        {You've set width of #1 to a value\MessageBreak
          greater than width of page!\MessageBreak%
          I'll reduce width of #1 to width of page}%
      \setlength{\@tempdima}{\paperwidth}%
    \else
      \ifdim\@tempdima<\z@
         \PackageWarning
           {scrlayer-scrpage}%
           {You've set width of #1 to negative value!\MessageBreak%
             I'll set it to 0pt}%
         \setlength{\@tempdima}{\z@}%
       \fi
    \fi
    \expandafter\edef\csname sls@#1width\endcsname{\the\@tempdima}%
    \setlength{\@tempdima}{\textwidth}%
    \addtolength{\@tempdima}{-\csname sls@#1width\endcsname}%
    \ifstr{#2}{}{%
      \ifdim \csname sls@#1width\endcsname
           = \dimexpr \textwidth+\marginparwidth+\marginparsep\relax
        \setlength{\@tempdimb}{\z@}
      \else
        \if@twoside
          \setlength{\@tempdimb}{.3333333333\@tempdima}%
        \else
          \setlength{\@tempdimb}{.5\@tempdima}%
        \fi
      \fi
    }{%
      \sls@settowidthof{\@tempdimb}{#2}%
    }%
    \ifstr{#3}{}{%
      \addtolength{\@tempdima}{-\@tempdimb}%
    }{%
      \sls@settowidthof{\@tempdima}{#3}%
      \setlength{\@tempdima}{-\@tempdima}%
    }%
    \ifdim\@tempdimb<\z@
      \setlength{\@tempdimb}{-\@tempdimb}%
      \expandafter\edef\csname sls@odd#1shift\endcsname{-\the\@tempdimb}%
    \else
      \expandafter\edef\csname sls@odd#1shift\endcsname{\the\@tempdimb}%
    \fi
    \ifdim\@tempdima<\z@
      \setlength{\@tempdima}{-\@tempdima}%
      \expandafter\edef\csname sls@even#1shift\endcsname{-\the\@tempdima}%
    \else
      \expandafter\edef\csname sls@even#1shift\endcsname{\the\@tempdima}%
    \fi
  }%
}
\scrlayerAddToInterface\sls@headwidth{%
  \scr@ifundefinedorrelax{@headwidth}{%
    \newcommand*{\sls@headwidth}{\textwidth}%
    \KOMA@kav@add{.scrlayer-scrpage.sty}{headwidth}{\textwidth:0pt:0pt}%
  }{%
    \newcommand*{\sls@headwidth}{\@headwidth}%
    \KOMA@kav@xadd{.scrlayer-scrpage.sty}{headwidth}{\@headwidth:0pt:0pt}%
  }%
}
\scrlayerAddToInterface\sls@oddheadshift{\newcommand*{\sls@oddheadshift}{0pt}}
\scrlayerAddToInterface\sls@evenheadshift{\newcommand*{\sls@evenheadshift}{0pt}}
\scrlayerAddToInterface\sls@footwidth{%
  \scr@ifundefinedorrelax{@footwidth}{%
    \newcommand*{\sls@footwidth}{\textwidth}%
    \KOMA@kav@add{.scrlayer-scrpage.sty}{footwidth}{\textwidth:0pt:0pt}
  }{%
    \newcommand*{\sls@footwidth}{\@footwidth}%
    \KOMA@kav@xadd{.scrlayer-scrpage.sty}{footwidth}{\@footwidth:0pt:0pt}
  }%
}
\scrlayerAddToInterface\sls@oddfootshift{\newcommand*{\sls@oddfootshift}{0pt}}
\scrlayerAddToInterface\sls@evenfootshift{\newcommand*{\sls@evenfootshift}{0pt}}
\scrlayerAddToInterface\sls@settotwidthof{%
  \newcommand*{\sls@settowidthof}[2]{%
    \ifstr{#2}{paper}{%
      \setlength{#1}{\paperwidth}%
    }{%
      \ifstr{#2}{text}{%
        \setlength{#1}{\textwidth}%
      }{%
        \ifstr{#2}{marginpar}{%
          \setlength{#1}{\dimexpr \marginparwidth+\marginparsep\relax}%
        }{%
          \ifstr{#2}{textwithmarginpar}{%
            \setlength{#1}{\dimexpr\textwidth
                                  +\marginparwidth
                                  +\marginparsep\relax}%
          }{%
            \ifstr{#2}{head}{%
              \setlength{#1}{\sls@headwidth}%
            }{%
              \ifstr{#2}{foot}{%
                \setlength{#1}{\sls@footwidth}%
              }{%
                \ifstr{#2}{headtopline}{%
                  \setlength{#1}{\sls@headabove@linelength}%
                }{%
                  \ifstr{#2}{headsepline}{%
                    \setlength{#1}{\sls@headbelow@linelength}%
                  }{%
                    \ifstr{#2}{footsepline}{%
                      \setlength{#1}{\sls@footabove@linelength}%
                    }{%
                      \ifstr{#2}{footbotline}{%
                        \setlength{#1}{\sls@footbelow@linelength}%
                      }{%
                        \ifstr{#2}{page}{%
                          \setlength{#1}{\paperwidth}%
                          \begingroup
                          \expandafter\expandafter\expandafter\endgroup
                          \expandafter\ifx\csname ta@bcor\endcsname\relax\else
                            \addtolength{#1}{-\ta@bcor}%
                          \fi
                        }{%
                          \setlength{#1}{\dimexpr #2\relax}%
                        }%
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }%
  }%
}
\scrlayerAddToInterface\sls@deftowidthof{%
  \newcommand*{\sls@deftowidthof}[2]{%
    \ifstr{#2}{autohead}{%
      \expandafter\def\csname #1\endcsname{\sls@headwidth}%
    }{%
      \ifstr{#2}{autofoot}{%
        \expandafter\def\csname #1\endcsname{\sls@footwidth}%
      }{%
        \sls@settowidthof{\@tempdima}{#2}%
        \expandafter\edef\csname #1\endcsname{\the\@tempdima}%
      }%
    }%
  }%
}
\KOMA@key{headtopline}[:]{%
  \sls@set@values[headtopline]{head}{above}{#1}%
}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@headtopline}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@headtopline@default}
\KOMA@key{headsepline}[:]{%
  \sls@set@values[headsepline]{head}{below}{#1}%
}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@headsepline}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@headsepline@default}
\KOMA@key{footsepline}[:]{%
  \sls@set@values[footsepline]{foot}{above}{#1}%
}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@footsepline}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@footsepline@default}
\KOMA@key{footbotline}[:]{%
  \sls@set@values[footbotline]{foot}{below}{#1}%
}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@footbotline}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@footbotline@default}
\scrlayerAddToInterface\sls@set@values{%
  \newcommand*{\sls@set@values}[4][]{%
    \begingroup
      \ifstr{#1}{}{%
        \FamilyKeyStateUnknown
      }{%
        \KOMA@set@ifkey{#1}{@tempswa}{#4}%
      }%
      \ifx\FamilyKeyState\FamilyKeyStateProcessed
        \if@tempswa
          \edef\reserved@b{%
            \noexpand\endgroup
            \noexpand\@namedef{sls@#2#3@linethickness}{.4pt}%
            \noexpand\@namedef{sls@#2#3@linelength}{%
              \expandafter\noexpand\csname sls@#2width\endcsname
            }%
          }%
        \else
          \def\reserved@b{%
            \endgroup
            \@namedef{sls@#2#3@linethickness}{0pt}%
            \@namedef{sls@#2#3@linelength}{0pt}%
          }%
        \fi
      \else
        \let\reserved@a\@empty
        \let\reserved@b\@empty
        \sls@split@at@colon#4::\@nil
        \ifx\reserved@a\@empty
          \def\reserved@a{\endgroup\@namedef{sls@#2#3@linethickness}{.4pt}}%
        \else
          \setlength{\@tempdima}{\dimexpr\reserved@a\relax}%
          \edef\reserved@a{%
            \noexpand\endgroup
            \noexpand\@namedef{sls@#2#3@linethickness}{\the\@tempdima}%
          }%
        \fi
        \ifx\reserved@b\@empty
          \def\reserved@b{%
            \reserved@a
            \@namedef{sls@#2#3@linelength}{\@nameuse{sls@#2width}}%
          }%
        \else
          \edef\reserved@b{%
            \noexpand\reserved@a
            \noexpand\sls@deftowidthof{sls@#2#3@linelength}{\reserved@b}%
          }%
        \fi
      \fi
    \reserved@b
    \FamilyKeyStateProcessed
    \ifstr{#1}{}{}{%
      \KOMA@kav@xreplacevalue{.scrlayer-scrpage.sty}{#1}{%
        \csname sls@#2#3@linethickness\endcsname
        :\csname sls@#2#3@linelength\endcsname
      }%
    }%
  }%
}
\scrlayerAddToInterface\sls@split@at@colon{%
  \def\sls@split@at@colon#1:#2:#3\@nil{%
    \ifstr{#3}{}{}{%
      \ifstr{#3}{:}{}{%
        \PackageWarning{scrlayer}{extra `:' found!\MessageBreak
          You've used more than one colon at the argument\MessageBreak
          of a two value option.\MessageBreak
          The extra value(s) will be ignored%
        }%
      }%
    }%
    \def\reserved@a{#1}%
    \def\reserved@b{#2}%
  }%
}
\scrlayerAddToInterface\sls@headabove@linelength{%
  \newcommand*{\sls@headabove@linelength}{\sls@headwidth}%
}
\scrlayerAddToInterface\sls@headabove{%
  \newcommand*{\sls@headabove@linethickness}{0pt}%
}
\KOMA@kav@xadd{.scrlayer-scrpage.sty}{headtopline}{%
  \expandafter\noexpand\sls@headabove@linethickness:%
  \expandafter\noexpand\sls@headabove@linelength}
\scrlayerAddToInterface\sls@headbelow@linelength{%
  \newcommand*{\sls@headbelow@linelength}{\sls@headwidth}%
}
\scrlayerAddToInterface\sls@headbelow@linethickness{%
  \newcommand*{\sls@headbelow@linethickness}{0pt}%
}
\KOMA@kav@xadd{.scrlayer-scrpage.sty}{headsepline}{%
  \expandafter\noexpand\sls@headbelow@linethickness:%
  \expandafter\noexpand\sls@headbelow@linelength}
\scrlayerAddToInterface\sls@footabove@linelength{%
  \newcommand*{\sls@footabove@linelength}{\sls@footwidth}%
}
\scrlayerAddToInterface\sls@footabove@linethickness{%
  \newcommand*{\sls@footabove@linethickness}{0pt}%
}
\KOMA@kav@xadd{.scrlayer-scrpage.sty}{footsepline}{%
  \expandafter\noexpand\sls@footabove@linethickness:%
  \expandafter\noexpand\sls@footabove@linelength}
\scrlayerAddToInterface\sls@footbelow@linelength{%
  \newcommand*{\sls@footbelow@linelength}{\sls@footwidth}%
}
\scrlayerAddToInterface\sls@footbelow@linethickness{%
  \newcommand*{\sls@footbelow@linethickness}{0pt}%
}
\KOMA@kav@xadd{.scrlayer-scrpage.sty}{footbotline}{%
  \expandafter\noexpand\sls@footbelow@linethickness:%
  \expandafter\noexpand\sls@footbelow@linelength}
\scrlayerAddCsToInterface{ifsls@plain@head@above@line}{%
  \KOMA@ifkey{plainheadtopline}{sls@plain@head@above@line}%
  \scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@plainheadtopline}%
  \scrlayer@AddCsToInterface{%
    KV@KOMA.scrlayer-scrpage.sty@plainheadtopline@default}%
  \scrlayer@AddCsToInterface{sls@plain@head@above@linetrue}
  \scrlayer@AddCsToInterface{sls@plain@head@above@linefalse}
}
\scrlayerAddCsToInterface{ifsls@plain@head@sbelow@line}{%
  \KOMA@ifkey{plainheadsepline}{sls@plain@head@below@line}%
  \scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@plainheadsepline}%
  \scrlayer@AddCsToInterface{%
    KV@KOMA.scrlayer-scrpage.sty@plainheadsepline@default}%
  \scrlayer@AddCsToInterface{sls@plain@head@below@linetrue}%
  \scrlayer@AddCsToInterface{sls@plain@head@below@linefalse}%
}
\scrlayerAddCsToInterface{ifsls@plain@foot@above@line}{%
  \KOMA@ifkey{plainfootsepline}{sls@plain@foot@above@line}%
  \scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@plainfootsepline}%
  \scrlayer@AddCsToInterface{%
    KV@KOMA.scrlayer-scrpage.sty@plainfootsepline@default}%
  \scrlayer@AddCsToInterface{sls@plain@foot@above@linetrue}%
  \scrlayer@AddCsToInterface{sls@plain@foot@above@linefalse}%
}
\scrlayerAddCsToInterface{ifsls@plain@foot@below@line}{%
  \KOMA@ifkey{plainfootbotline}{sls@plain@foot@below@line}%
  \scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@plainfootbotline}%
  \scrlayer@AddCsToInterface{%
    KV@KOMA.scrlayer-scrpage.sty@plainfootbotline@default}%
  \scrlayer@AddCsToInterface{sls@plain@foot@below@linetrue}%
  \scrlayer@AddCsToInterface{sls@plain@foot@below@linefalse}%
}
\scrlayerAddToInterface\sls@hfline@adjust{%
  \newcommand*{\sls@hfline@adjust}{0}%
}
\KOMA@kav@add{.scrlayer-scrpage.sty}{ilines}{}
\KOMA@key{ilines}[]{%
  \ifx\relax#1\relax
    \renewcommand*{\sls@hfline@adjust}{0}%
    \FamilyKeyStateProcessed
    \KOMA@kav@removekey{.scrlayer-scrpage.sty}{ilines}%
    \KOMA@kav@removekey{.scrlayer-scrpage.sty}{clines}%
    \KOMA@kav@removekey{.scrlayer-scrpage.sty}{olines}%
    \KOMA@kav@add{.scrlayer-scrpage.sty}{ilines}{}%
  \else
    \def\FamilyKeyStateProcessed{unexpected value}%
  \fi
}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@ilines}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@ilines@default}
\KOMA@key{clines}[]{%
  \ifx\relax#1\relax
    \renewcommand*{\sls@hfline@adjust}{1}%
    \FamilyKeyStateProcessed
    \KOMA@kav@removekey{.scrlayer-scrpage.sty}{ilines}%
    \KOMA@kav@removekey{.scrlayer-scrpage.sty}{clines}%
    \KOMA@kav@removekey{.scrlayer-scrpage.sty}{olines}%
    \KOMA@kav@add{.scrlayer-scrpage.sty}{clines}{}%
  \else
    \def\FamilyKeyStateProcessed{unexpected value}%
  \fi
}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@clines}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@clines@default}
\KOMA@key{olines}[]{%
  \ifx\relax#1\relax
    \renewcommand*{\sls@hfline@adjust}{2}%
    \FamilyKeyStateProcessed
    \KOMA@kav@removekey{.scrlayer-scrpage.sty}{ilines}%
    \KOMA@kav@removekey{.scrlayer-scrpage.sty}{clines}%
    \KOMA@kav@removekey{.scrlayer-scrpage.sty}{olines}%
    \KOMA@kav@add{.scrlayer-scrpage.sty}{olines}{}%
  \else
    \def\FamilyKeyStateProcessed{unexpected value}%
  \fi
}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@olines}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@olines@default}
\KOMA@key{pagestyleset}{%
  \scr@ifundefinedorrelax{sls@ps@style@#1}{%
    \FamilyKeyStateUnknownValue
  }{%
    \let\sls@auto@pagestyleset\relax
    \@nameuse{sls@ps@style@#1}%
    \FamilyKeyStateProcessed
    \KOMA@kav@replacevalue{.scrlayer-scrpage.sty}{pagestyleset}{#1}%
  }%
}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@pagestyleset}
\scrlayerAddToInterface\sls@ps@style@standard{%
  \newcommand*{\sls@ps@style@standard}{%
    \let\MakeMarkcase\MakeUppercase
    \scrlayer@AtEndOfPackage{%
      \pagestyle{scrheadings}%
      \clearpairofpagestyles
      \ihead{\headmark}%
      \ohead{\pagemark}%
      \cfoot[\if@twoside\else\pagemark\fi]{}%
    }%
  }%
}
\scrlayerAddCsToInterface{sls@ps@style@KOMA-Script}{%
  \@namedef{sls@ps@style@KOMA-Script}{%
    \let\MakeMarkcase\@firstofone
    \scrlayer@AtEndOfPackage{%
      \pagestyle{scrheadings}%
      \clearpairofpagestyles
      \ohead{\if@twoside\headmark\fi}%
      \chead{\if@twoside\else\headmark\fi}%
      \ofoot[\if@twoside\pagemark\fi]{\if@twoside\pagemark\fi}%
      \cfoot[\if@twoside\else\pagemark\fi]{\if@twoside\else\pagemark\fi}%
      \scr@ifundefinedorrelax{KOMAClassName}{}{%
        \ifstr{\KOMAClassName}{scrlttr2}{%
          \clearpairofpagestyles
          \lehead[\ifnum\@pageat=\z@\pagemark\fi]
                 {\ifnum\@pageat=\z@\pagemark\else\leftmark\fi}%
          \lohead[\ifnum\@pageat=\z@\pagemark\fi]
                 {\ifnum\@pageat=\z@\pagemark\else\leftmark\fi}%
          \chead[\ifnum\@pageat=\@ne\pagemark\fi]
                {\ifcase\@pageat \rightmark\or \pagemark\or \rightmark\fi}%
          \rehead[\ifnum\@pageat=\tw@\pagemark\fi]
                 {\ifcase\@pageat \leftmark\or \rightmark\or \pagemark
                   \else \rightmark\fi}%
          \rohead[\ifnum\@pageat=\tw@\pagemark\fi]
                 {\ifcase\@pageat \leftmark\or \rightmark\or \pagemark
                   \else \rightmark\fi}%
          \lefoot[\ifnum\@pageat=\thr@@\pagemark\fi]
                 {\ifnum\@pageat=\thr@@\pagemark\fi}%
          \cfoot[\ifnum\@pageat=4 \pagemark\fi]
                {\ifnum\@pageat=4 \pagemark\fi}%
          \refoot[\ifnum\@pageat=5 \pagemark\fi]
                 {\ifnum\@pageat=5 \pagemark\fi}%
        }{}%
      }%
    }%
  }%
}
\KOMA@DeclareDeprecatedOption[scrlayer-scrpage]{komastyle}{%
  pagestyleset=KOMA-Script}
\KOMA@DeclareDeprecatedOption[scrlayer-scrpage]{standardstyle}{%
  pagestyleset=standard}
\KOMA@DeclareDeprecatedOption[scrlayer-scrpage]{markuppercase}{markcase=upper}
\KOMA@DeclareDeprecatedOption[scrlayer-scrpage]{markusedcase}{markcase=used}
\KOMA@DeclareDeprecatedOption[scrlayer-scrpage]{nouppercase}{%
  markcase=ignoreuppercase%
}
\KOMA@ifkey{hmode}{sls@leavevmode}
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@hmode}%
\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@hmode@default}%
\scrlayer@AddCsToInterface{sls@leavevmode@linetrue}
\scrlayer@AddCsToInterface{sls@leavevmode@linefalse}
%%% From File: $Id: scrlayer.dtx 1962 2015-02-26 08:34:33Z kohm $ (body)
\KOMAProcessOptions\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @markcase\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @autooneside\endcsname\relax
\expandafter\let\csname KV@KOMA.\@currname.\@currext @automark\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @automark@default\endcsname\relax
\expandafter\let\csname KV@KOMA.\@currname.\@currext @manualmark\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @manualmark@default\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpsselect\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpsselect@default\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpsinit\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpsinit@default\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpsoneside\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpsoneside@default\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpstwoside\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpstwoside@default\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpsoddpage\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpsoddpage@default\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpsevenpage\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpsevenpage@default\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpsfloatpage\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpsfloatpage@default\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpsnonfloatpage\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpsnonfloatpage@default\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpsbackground\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpsbackground@default\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpsforeground\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @onpsforeground@default\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @deactivatepagestylelayers\endcsname
  \relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @deactivatepagestylelayers@default\endcsname
  \relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @draft\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @draft@default\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @forceoverwrite\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @forceoverwrite@default\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @autoremoveinterfaces\endcsname\relax
\expandafter\let
  \csname KV@KOMA.\@currname.\@currext @autoremoveinterfaces@default\endcsname
  \relax
%%% From File: $Id: scrlayer-scrpage.dtx 2070 2015-04-08 09:02:19Z kohm $ (body)
\scrlayerAddToInterface\setheadwidth{%
  \newcommand*{\setheadwidth}[2][]{%
    \KOMAoptions{headwidth=#2:#1}%
  }%
}
\scrlayerAddToInterface\setfootwidth{%
  \newcommand*{\setfootwidth}[2][]{%
    \KOMAoptions{footwidth=#2:#1}%
  }%
}
\scrlayerAddToInterface\setheadtopline{%
  \newcommand*{\setheadtopline}{\sls@setline{head}{above}}%
}
\scrlayerAddToInterface\setheadsepline{%
  \newcommand*{\setheadsepline}{\sls@setline{head}{below}}%
}
\scrlayerAddToInterface\setfootsepline{%
  \newcommand*{\setfootsepline}{\sls@setline{foot}{above}}%
}
\scrlayerAddToInterface\setfootbotline{%
  \newcommand*{\setfootbotline}{\sls@setline{foot}{below}}%
}
\scrlayerAddToInterface\sls@setline{%
  \newcommand*\sls@setline[2]{%
    \@ifnextchar[%]
    {\sls@@setline{#1}{#2}}{\sls@@@setline{#1#2}}%
  }%
}
\scrlayerAddToInterface\sls@@setline{%
  \def\sls@@setline#1#2[#3]{%
    \ifstr{#3}{auto}{%
      \sls@deftowidthof{sls@#1#2@linelength}{#3#1}%
    }{%
      \sls@deftowidthof{sls@#1#2@linelength}{#3}%
    }%
    \sls@@@setline{#1#2}%
  }%
}
\scrlayerAddToInterface\sls@@@setline{%
  \def\sls@@@setline#1#2{%
    \edef\@tempa{#2}\edef\@tempb{current}%
    \ifstr{#2}{}{}{%
      \ifstr{#2}{current}{}{%
        \setlength{\@tempdima}{#2}%
        \ifstr{#1}{headabove}{%
          \KOMAExecuteOptions[.scrlayer-scrpage.sty]{headtopline=\@tempdima}%
        }{\ifstr{#1}{headbelow}{%
            \KOMAExecuteOptions[.scrlayer-scrpage.sty]{headsepline=\@tempdima}%
          }{%
            \ifstr{#1}{footabove}{%
              \KOMAExecuteOptions[.scrlayer-scrpage.sty]%
                                 {footsepline=\@tempdima}%
            }{%
              \KOMAExecuteOptions[.scrlayer-scrpage.sty]%
                                 {footbotline=\@tempdima}%
            }%
          }%
        }%
      }%
    }%
    \PackageWarning{scrlayer-scrpage}{%
      Command deprecated!\MessageBreak
      Usage of `\string\setheadtopline',
      `\string\setheadsepline',\MessageBreak
      `\string\setfootsepline', and `\string\setfootbotline'\MessageBreak
      became deprecated with scrlayer-scrpage.\MessageBreak
      You should use KOMA-Script options\MessageBreak
      `headsepline', `headtopline', `footsepline',\MessageBreak
      or `footbotline' with values\MessageBreak
      `<line thickness>:<line length>' to setup\MessageBreak
      the line length and thickness, and\MessageBreak
      `\string\setkomafont' or `\string\addtokomafont' to\MessageBreak
      setup the colour%
    }%
    \@ifnextchar[%]
    {%
      \sls@@@@setline{#1}%
    }{%
    }%
  }%
}
\scrlayerAddToInterface\sls@@@@setline{%
  \def\sls@@@@setline#1[#2]{%
    \ifstr{#1}{headabove}{\setkomafont{headtopline}{#2}}{%
      \ifstr{#1}{headbelow}{\setkomafont{headsepline}{#2}}{%
        \ifstr{#1}{footabove}{\setkomafont{footsepline}{#2}}{%
          \setkomafont{footbotline}{#2}%
        }%
      }%
    }%
  }%
}
\@ifundefined{scr@fnt@headtopline}{%
  \@ifundefined{@headtoplinefont}{%
    \scrlayer@AddCsToInterface{@headtoplinefont}%
  }{}%
  \newkomafont{headtopline}{}%
  \scrlayer@AddCsToInterface{scr@fnt@headtopline}%
}{}
\@ifundefined{scr@fnt@headsepline}{%
  \@ifundefined{@headseplinefont}{%
    \scrlayer@AddCsToInterface{@headseplinefont}%
  }{}%
  \newkomafont{headsepline}{}%
  \scrlayer@AddCsToInterface{scr@fnt@headsepline}%
}{}
\@ifundefined{scr@fnt@footsepline}{%
  \@ifundefined{@footseplinefont}{%
    \scrlayer@AddCsToInterface{@footseplinefont}%
  }{}%
  \newkomafont{footsepline}{}%
  \scrlayer@AddCsToInterface{scr@fnt@footsepline}%
}{}
\@ifundefined{scr@fnt@footbotline}{%
  \@ifundefined{@footbotlinefont}{%
    \scrlayer@AddCsToInterface{@footbotlinefont}%
  }{}%
  \newkomafont{footbotline}{}%
  \scrlayer@AddCsToInterface{scr@fnt@footbotline}%
}{}
\AtBeginDocument{%
  \ifdim \headheight <\baselineskip
    \PackageWarningNoLine{scrlayer-scrpage}{Very small head height
      detected!\MessageBreak
      Using scrlayer-scrpage the head height\MessageBreak
      should be at least \string\baselineskip, which is\MessageBreak
      \the\baselineskip\space currently.\MessageBreak
      But head height is currently
      \the\headheight\space only.\MessageBreak
      You may use\MessageBreak
      \@ifpackageloaded{geometry}{%
        geometry option `head=\the\baselineskip'%
      }{%
        \@ifpackageloaded{typearea}{%
          typearea option `headheight=\the\baselineskip'%
        }{%
          \string\setlength{\string\headheight}{\the\baselineskip}%
        }%
      }\MessageBreak
      to avoid this warning%
    }%
  \fi
}
\scrlayerAddToInterface\defpagestyle{%
  \newcommand*{\defpagestyle}[3]{%
    \sls@defhead{#1}#2\@empty\@empty\@empty
    \sls@deffoot{#1}#3\@empty\@empty\@empty
    \DeclarePageStyleByLayers{#1}{%
      #1.head.odd,#1.head.even,#1.head.oneside,%
      #1.head.above.line,#1.head.below.line,%
      #1.foot.odd,#1.foot.even,#1.foot.oneside,%
      #1.foot.above.line,#1.foot.below.line%
    }%
    \edef\reserved@a{%
      \noexpand\scrlayerOnAutoRemoveInterface[scrlayer-scrpage.sty]{%
        \noexpand\DestroyLayer{#1.head.odd}%
        \noexpand\DestroyLayer{#1.head.even}%
        \noexpand\DestroyLayer{#1.head.oneside}%
        \noexpand\DestroyLayer{#1.head.above.line}%
        \noexpand\DestroyLayer{#1.head.below.line}%
        \noexpand\DestroyLayer{#1.foot.odd}%
        \noexpand\DestroyLayer{#1.foot.even}%
        \noexpand\DestroyLayer{#1.foot.oneside}%
        \noexpand\DestroyLayer{#1.foot.above.line}%
        \noexpand\DestroyLayer{#1.foot.below.line}%
        \noexpand\ifstr{\noexpand\currentpagestyle}{#1}{%
          \noexpand\PackageWarning{scrlayer-scrpage}{%
            page style `#1' not longer valid.\noexpand\MessageBreak
            The page style has been defined using\noexpand\MessageBreak
            interface `scrlayer-scrpage.sty', that\noexpand\MessageBreak
            has been removed%
          }%
        }{}%
        \noexpand\DestroyRealLayerPageStyle{#1}%
      }%
    }\reserved@a
  }%
}
\scrlayerAddToInterface\sls@defhead{%
  \newcommand*\sls@defhead[1]{%
    \@ifnextchar(%)
    {\sls@@defhead{#1}}%
    {\sls@@defhead{#1}(\sls@headabove@linelength,\sls@headabove@linethickness)}%
  }%
}
\scrlayerAddToInterface\sls@@defhead{%
  \def\sls@@defhead#1(#2,#3)#4#5#6{%
    \@ifnextchar(%)
    {\sls@@@defhead{#1}({#2},{#3}){#4}{#5}{#6}}%
    {\sls@@@defhead{#1}%
                   ({#2},{#3})%
                   {#4}{#5}{#6}%
                   (\sls@headbelow@linelength,\sls@headbelow@linethickness)}%
  }%
}
\scrlayerAddToInterface\sls@@@defhead{%
  \def\sls@@@defhead#1(#2,#3)#4#5#6(#7,#8){%
    \DeclareLayer[%
      background,%
      hoffset=\sls@leftmargin{head},%
      voffset=\sls@topmargin+\dp\strutbox,%
      width=\sls@headwidth,%
      height=0pt,%
      align=bl,%
      contents={%
        {\normalfont\usekomafont{pageheadfoot}{\usekomafont{pagehead}{%
              \sls@hf@rule{headtop}{#2}{#3}}}}%
      }%
    ]{#1.head.above.line}%
    \DeclareLayer[%
      background,%
      hoffset=\sls@leftmargin{head},%
      voffset=\sls@topmargin+\headheight-\ht\strutbox+#8,%
      width=\sls@headwidth,%
      height=0pt,%
      align=tl,%
      contents={%
        {\normalfont\usekomafont{pageheadfoot}{\usekomafont{pagehead}{%
              \sls@hf@rule{headsep}{#7}{#8}}}}%
      }%
    ]{#1.head.below.line}%
    \DeclareLayer[%
      background,evenpage,twoside,%
      head,%
      hoffset=\sls@leftmargin{head},%
      width=\sls@headwidth,%
      contents={%
        \sls@secure@box\headheight{%
          \normalfont{\usekomafont{pageheadfoot}{\usekomafont{pagehead}{#4}}}}}%
    ]{#1.head.even}%
    \DeclareLayer[%
      background,oddpage,twoside,%
      head,%
      hoffset=\sls@leftmargin{head},%
      width=\sls@headwidth,%
      contents={%
        \sls@secure@box\headheight{%
          \normalfont{\usekomafont{pageheadfoot}{\usekomafont{pagehead}{#5}}}}}%
    ]{#1.head.odd}%
    \DeclareLayer[%
      background,oddpage,oneside,%
      head,%
      hoffset=\sls@leftmargin{head},%
      width=\sls@headwidth,%
      contents={%
        \sls@secure@box\headheight{%
          \normalfont{\usekomafont{pageheadfoot}{\usekomafont{pagehead}{#6}}}}}%
    ]{#1.head.oneside}%
  }%
}
\scrlayerAddToInterface\sls@deffoot{%
  \newcommand*\sls@deffoot[1]{%
    \@ifnextchar(%)
    {\sls@@deffoot{#1}}%
    {\sls@@deffoot{#1}(\sls@footabove@linelength,\sls@footabove@linethickness)}%
  }%
}
\scrlayerAddToInterface\sls@@deffoot{%
  \def\sls@@deffoot#1(#2,#3)#4#5#6{%
    \@ifnextchar(%)
    {\sls@@@deffoot{#1}({#2},{#3}){#4}{#5}{#6}}%
    {\sls@@@deffoot{#1}%
                   ({#2},{#3})%
                   {#4}{#5}{#6}%
                   (\sls@footbelow@linelength,\sls@footbelow@linethickness)}%
  }%
}
\scrlayerAddToInterface\sls@@@deffoot{%
  \def\sls@@@deffoot#1(#2,#3)#4#5#6(#7,#8){%
    \DeclareLayer[%
      foreground,%
      hoffset=\sls@leftmargin{foot},%
      voffset=\sls@topmargin
              +\headheight+\headsep
              +\textheight
              +\footskip-\footheight
              +2\dp\strutbox,%
      width=\sls@footwidth,%
      height=0pt,%
      align=bl,%
      contents={%
        {\normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{%
              \sls@hf@rule{footsep}{#2}{#3}}}}%
      }%
    ]{#1.foot.above.line}%
    \DeclareLayer[%
      foreground,%
      hoffset=\sls@leftmargin{foot},%
      voffset=\sls@topmargin
              +\headheight+\headsep
              +\textheight
              +\footskip
              +2\dp\strutbox
              +#8,%
      width=\sls@footwidth,%
      height=0pt,%
      align=bl,%
      contents={%
        {\normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{%
              \sls@hf@rule{footbot}{#7}{#8}}}}%
      }%
    ]{#1.foot.below.line}%
    \DeclareLayer[%
      foreground,evenpage,twoside,%
      foot,%
      hoffset=\sls@leftmargin{foot},%
      width=\sls@footwidth,%
      contents={%
        \sls@secure@box\footheight{%
          \normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{#4}}}}%
    ]{#1.foot.even}%
    \DeclareLayer[%
      foreground,oddpage,twoside,%
      foot,%
      hoffset=\sls@leftmargin{foot},%
      width=\sls@footwidth,%
      contents={%
        \sls@secure@box\footheight{%
          \normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{#5}}}}%
    ]{#1.foot.odd}%
    \DeclareLayer[%
      foreground,oddpage,oneside,%
      foot,%
      hoffset=\sls@leftmargin{foot},%
      width=\sls@footwidth,%
      contents={%
        \sls@secure@box\footheight{%
          \normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{#6}}}}%
    ]{#1.foot.oneside}%
  }%
}
\scrlayerAddToInterface\sls@secure@box{%
  \newcommand*{\sls@secure@box}[2]{%
    \begingroup
      \setbox\z@\vbox{%
        \ifsls@leavevmode\leavevmode\expandafter\ignorespaces\fi
        #2%
      }%
      \ifdim #1<\dimexpr \ht\z@+\dp\z@\relax
        \PackageWarning{scrlayer-scrpage}{%
          \string#1 to low.\MessageBreak
          At least \the\dimexpr \ht\z@+\dp\z@\relax\space needed,\MessageBreak
          but only \the#1 found.\MessageBreak
          I'll enlarge \string#1, for further\MessageBreak
          processing, but you should do this yourself,\MessageBreak
          e.g.,
          \scr@ifundefinedorrelax{geometry}{%
            \scr@ifundefinedorrelax{typearea}{%
              using\MessageBreak
              \space\space\string\setlength{\string#1}{%
                \the\dimexpr \ht\z@+\dp\z@\relax}\MessageBreak
              in your preamble%
            }{%
              setting typearea's option\MessageBreak
              `\expandafter\@gobble\string#1=\the\dimexpr \ht\z@+\dp\z@\relax'%
            }%
          }{%
            \ifx #1\headheight
              setting geometry's option\MessageBreak
              `head=\the\dimexpr \ht\z@+\dp\z@\relax'%
            \else
              using\MessageBreak
              \space\space\string\setlength{\string#1}{%
                \the\dimexpr \ht\z@+\dp\z@\relax}\MessageBreak
              in your preamble%
            \fi
          }%
          .\MessageBreak
          I'll also
          \ifx #1\headheight decrease \string\topmargin
          \else increase \string\footskip\fi
        }%
        \@tempdima\dimexpr \ht\z@+\dp\z@\relax
        \ifx #1\headheight
          \global\advance\topmargin by \dimexpr #1-(\ht\z@+\dp\z@)\relax
          \dp\z@\dimexpr \dp\z@+\ht\z@+\dp\z@-\headheight\relax
        \else
          \global\advance\footskip by \dimexpr \ht\z@+\dp\z@-#1\relax
        \fi
        \global#1\@tempdima
      \fi
      \usebox\z@
    \endgroup
  }%
}
\@ifundefined{scr@fnt@pagehead}{%
  \scrlayer@AddCsToInterface{scr@fnt@pagehead}%
  \@ifundefined{@pageheadfont}{%
    \newkomafont{pagehead}{}%
    \scrlayer@AddCsToInterface{@pageheadfont}%
  }{%
    \newcommand*{\scr@fnt@pagehead}{\@pageheadfont}%
  }%
}{}
\@ifundefined{scr@fnt@pageheadfoot}{%
  \newcommand*{\scr@fnt@pageheadfoot}{\headfont}%
  \scrlayer@AddCsToInterface{scr@fnt@pageheadfoot}%
  \@ifundefined{headfont}{%
    \newcommand*{\headfont}{\normalcolor\slshape}%
  }{}
}{}
\scr@ifundefinedorrelax{scr@fnt@wrn@pagehead}{}{%
  \PackageInfo{scrlayer-scrpage}{%
    deactivating warning for font element\MessageBreak
    `pagehead'}%
  \let\scr@fnt@wrn@pagehead\relax
}
\@ifundefined{scr@fnt@pagefoot}{%
  \scrlayer@AddCsToInterface{scr@fnt@pagefoot}%
  \def\scr@fnt@pagefoot{\footfont}%
  \@ifundefined{footfont}{%
    \newcommand*{\footfont}{}%
    \scrlayer@AddCsToInterface{footfont}%
  }{}%
}{}
\scr@ifundefinedorrelax{scr@fnt@wrn@pagefoot}{}{%
  \PackageInfo{scrlayer-scrpage}{%
    deactivating warning for font element\MessageBreak
    `pagefoot'}%
  \let\scr@fnt@wrn@pagefoot\relax
}
\scrlayerAddToInterface\sls@hf@rule{%
  \newcommand*\sls@hf@rule[3]{%
    \begingroup
      \normalfont\usekomafont{#1line}{%
        \vbox to \z@{%
          \kern -\dimexpr #3\relax
          \ifnum \sls@hfline@adjust>\z@ \@tempswatrue \else \@tempswafalse\fi
          \if@twoside\ifodd\value{page}\else
            \ifnum \sls@hfline@adjust<\tw@ \@tempswatrue\else \@tempswafalse\fi
          \fi\fi
          \if@tempswa
            \hskip \z@\@plus 1fill\@minus \paperwidth
          \fi
          \vrule \@width\dimexpr #2\relax \@height\dimexpr #3\relax \@depth\z@
          \ifnum \sls@hfline@adjust<\tw@ \@tempswatrue\else \@tempswafalse\fi
          \if@twoside\ifodd\value{page}\else
            \ifnum \sls@hfline@adjust>\z@ \@tempswatrue \else \@tempswafalse\fi
          \fi\fi
          \if@tempswa
            \hskip \z@\@plus 1fill\@minus \paperwidth\null
          \fi
        }%
      }%
    \endgroup
  }%
}
\scrlayerAddToInterface\sls@topmargin{%
  \newcommand*{\sls@topmargin}{\dimexpr\topmargin+1in\relax}%
}
\scrlayerAddToInterface\sls@leftmargin{%
  \newcommand*{\sls@leftmargin}[1]{%
    \dimexpr
    \if@twoside
      \ifodd\value{page}
        \oddsidemargin+\csname sls@odd#1shift\endcsname
      \else
        \evensidemargin+\csname sls@even#1shift\endcsname
      \fi
    \else
      \oddsidemargin+\csname sls@odd#1shift\endcsname
    \fi
    +1in\relax
  }%
}
\scrlayerAddToInterface\newpagestyle{%
  \newcommand*\newpagestyle[3]{%
    \@ifundefined{ps@#1}{\defpagestyle{#1}{#2}{#3}}{%
      \PackageError{scrlayer-scrpage}{Page style `#1' already defined}{%
        Only not yet defined page style may be defined using
        \string\newpagestyle.\MessageBreak
        You may use either \string\renewpagestyle, \string\providepagestyle,
        or \string\defpagestyle\MessageBreak
        with already defined page styles.\MessageBreak
        If you'll continue, your command will be ignored.%
      }%
    }%
  }%
}
\scrlayerAddToInterface\renewpagestyle{%
  \newcommand*\renewpagestyle[3]{%
    \@ifundefined{ps@#1}{%
      \PackageError{scrlayer-scrpage}{Undefined page style `#1'}{%
        Only already defined page style may be re-defined using
        \string\renewpagestyle.\MessageBreak
        You may use either \string\newpagestyle, \string\providepagestyle,
        or \string\defpagestyle\MessageBreak
        with not yet defined page styles.\MessageBreak
        If you'll continue, your command will be ignored.%
      }%
    }{%
      \defpagestyle{#1}{#2}{#3}%
    }%
  }%
}
\scrlayerAddToInterface\providepagestyle{%
  \newcommand*\providepagestyle[3]{%
    \@ifundefined{ps@#1}{%
      \defpagestyle{#1}{#2}{#3}%
    }{%
      \PackageInfo{scrlayer-scrpage}{%
        page style `#1' already defined.\MessageBreak
        New definition ignored%
      }%
    }%
  }%
}
\scrlayerAddToInterface{\deftriplepagestyle}{%
  \newcommand*{\deftriplepagestyle}[1]{%
    \let\@tempa\defpagestyle
    \scrlayer@triplestyle{#1}%
  }%
}
\scrlayerAddToInterface{\newtriplepagestyle}{%
  \newcommand*{\newtriplepagestyle}[1]{%
    \let\@tempa\newpagestyle
    \scrlayer@triplestyle{#1}%
  }%
}
\scrlayerAddToInterface{\renewtriplepagestyle}{%
  \newcommand*{\renewtriplepagestyle}[1]{%
    \let\@tempa\renewpagestyle
    \scrlayer@triplestyle{#1}%
  }%
}
\scrlayerAddToInterface{\providetriplepagestyle}{%
  \newcommand*{\providetriplepagestyle}[1]{%
    \let\@tempa\providepagestyle
    \scrlayer@triplestyle{#1}%
  }%
}
\scrlayerAddToInterface\scrlayer@triplestyle{%
  \def\scrlayer@triplestyle#1{%
    \@ifnextchar[%]
    {\scrlayer@@triplestyle{#1}}%
    {\scrlayer@@triplestyle{#1}[\z@]}%
  }
}
\scrlayerAddToInterface\scrlayer@@triplestyle{%
  \def\scrlayer@@triplestyle#1[#2]{%
   \@ifnextchar[%]
    {\scrlayer@@@triplestyle{#1}[#2]}%
    {\scrlayer@@@triplestyle{#1}[\z@][#2]}%
  }%
}
\scrlayerAddToInterface\scrlayer@@@triplestyle{%
  \def\scrlayer@@@triplestyle#1[#2][#3]#4#5#6#7#8#9{%
    \@tempa{#1}{%
      (\sls@headwidth,#2)%
      {%
        \makebox[\z@][l]{#6}\hfill
        \makebox[\z@][c]{#5}\hfill
        \makebox[\z@][r]{#4}%
      }{%
        \makebox[\z@][l]{#4}\hfill
        \makebox[\z@][c]{#5}\hfill
        \makebox[\z@][r]{#6}%
      }{%
        \makebox[\z@][l]{#4}\hfill
        \makebox[\z@][c]{#5}\hfill
        \makebox[\z@][r]{#6}%
      }%
      (\sls@headwidth,#3)%
    }{%
      (\sls@footwidth,#3)%
      {%
        \makebox[\z@][l]{#9}\hfill
        \makebox[\z@][c]{#8}\hfill
        \makebox[\z@][r]{#7}%
      }{%
        \makebox[\z@][l]{#7}\hfill
        \makebox[\z@][c]{#8}\hfill
        \makebox[\z@][r]{#9}%
      }{%
        \makebox[\z@][l]{#7}\hfill
        \makebox[\z@][c]{#8}\hfill
        \makebox[\z@][r]{#9}%
      }%
      (\sls@footwidth,#2)%
    }%
  }%
}
\scrlayerAddToInterface{\deftripstyle}{%
  \newcommand*{\deftripstyle}{%
    \PackageWarning{scrlayer-scrpage}{%
      Command \string\deftripstyle\space is deprecate.\MessageBreak
      You should replace it by \string\deftriplepagestyle,\MessageBreak
      e.g.,%
    }%
    \let\deftripstyle\deftriplepagestyle
    \deftripstyle
  }%
}
\scrlayerAddToInterface\defpairofpagestyles{%
  \newcommand*{\defpairofpagestyles}[3][]{%
    \def\reserved@a##1##2##3##4##5##6##7\@nil{##1##2##3##4##5##6}%
    \edef\reserved@a{\expandafter\reserved@a #2xxxxxx\@nil}%
    \ifstr\reserved@a{plain.}{%
      \PackageError{scrlayer-scrpage}{plain page style `#2' not allowed}{%
        You may not define a plain page style using
        \string\defpairofpagestyles, \string\newpairofpagestyles,
        \string\renewpairofpagestyles, or\MessageBreak
        \string\providepairofpagestyles.  I'd suggest to simply define the
        corresponding\MessageBreak
        non-plain page style to also define the plain one.\MessageBreak
        If you'll continue, your command will be ignored.}%
    }{%
      \sls@init@pair@page@style*{#2}%
      \sls@init@pair@page@style*{plain.#2}%
      \ifx\relax #1\relax\else
        \scr@ifundefinedorrelax{sls@ps@#1@even@left@head}{%
          \PackageError{scrlayer-scrpage}{`#1' not a pair page style}{%
            Only pair page styles may be used to initialise new pairs of page
            styles. So\MessageBreak
            optional argument of \string\defpairofpagestyles,
            \string\newpairofpagestyles,\MessageBreak
            \string\renewpairofpagestyles, or \string\providepairofpagestyle has
            to be a pair\MessageBreak
            page style or should be unused.\MessageBreak
            If you'll continue, the initialisation will be ignored.}%
        }{%
          \sls@init@pair@page@style{#2}{#1}%
          \scr@ifundefinedorrelax{sls@ps@plain.#1@even@left@head}{%
            \sls@init@pair@page@style{plain.#2}{#1}%
          }{%
            \sls@init@pair@page@style{plain.#2}{plain.#1}%
          }%
        }%
      \fi
      \edef\reserved@a{%
        \noexpand\scrlayerOnAutoRemoveInterface[scrlayer-scrpage.sty]{%
          \noexpand\sls@init@pair@page@style**{#2}%
          \noexpand\sls@init@pair@page@style**{plain.#2}%
          \noexpand\expandafter\noexpand\ifx\noexpand
          \csname ps@plain.#2\noexpand\endcsname\noexpand\ps@plain
          \noexpand\PackageWarning{scrlayer-scrpage}{%
            page style `#2' not longer valid.\noexpand\MessageBreak
            This was the current plain page style.\noexpand\MessageBreak
            Making current plain page style empty.\noexpand\MessageBreak
            The page style has been defined using\noexpand\MessageBreak
            interface `scrlayer-scrpage.sty', that\noexpand\MessageBreak
            has been removed%
          }%
          \noexpand\def\noexpand\ps@plain{%
            \noexpand\def\noexpand\@oddhead{}\noexpand\def\noexpand\@evenhead{}%
            \noexpand\def\noexpand\@oddhead{}\noexpand\def\noexpand\@evenhead{}%
          }%
          \noexpand\fi
        }%
      }\reserved@a
      \sls@def@pair@page@style@member{#2}%
      \AddToLayerPageStyleOptions{#2}{%
        onselect={%
          \DeclarePageStyleAlias{plain}{plain.#2}%
          \DeclarePageStyleAlias{headings}{#2}%
          \def\sls@currentheadings{#2}%
          \def\sls@currentplain{plain.#2}%
          #3%
        }%
      }%
      \sls@def@pair@page@style@member{plain.#2}%
      \AddToLayerPageStyleOptions{plain.#2}{%
        onselect={%
          \DeclarePageStyleAlias{plain}{plain.#2}%
          \DeclarePageStyleAlias{headings}{#2}%
          \def\sls@currentheadings{#2}%
          \def\sls@currentplain{plain.#2}%
          #3%
        },%
        oninit={%
          \expandafter
          \ifx\csname ifsls@plain@head@above@line\expandafter\endcsname
            \csname iftrue\endcsname\else
            \let\sls@headabove@linelength\z@
            \let\sls@headabove@linethickness\z@
          \fi
          \expandafter
          \ifx\csname ifsls@plain@head@below@line\expandafter\endcsname
              \csname iftrue\endcsname\else
            \let\sls@headbelow@linelength\z@
            \let\sls@headbelow@linethickness\z@
          \fi
          \expandafter
          \ifx\csname ifsls@plain@foot@above@line\expandafter\endcsname
              \csname iftrue\endcsname\else
            \let\sls@footabove@linelength\z@
            \let\sls@footabove@linethickness\z@
          \fi
          \expandafter
          \ifx\csname ifsls@plain@foot@below@line\expandafter\endcsname
              \csname iftrue\endcsname\else
            \let\sls@footbelow@linelength\z@
            \let\sls@footbelow@linethickness\z@
          \fi
        }%
      }%
    }%
  }%
}
\scrlayerAddToInterface\sls@currentheadings{%
  \newcommand*\sls@currentheadings{scrheadings}%
}
\scrlayerAddToInterface\sls@currentplain{%
  \newcommand*\sls@currentplain{plain.scrheadings}%
}
\scrlayerAddToInterface\sls@init@pair@page@style{%
  \newcommand*{\sls@init@pair@page@style}{%
    \@ifstar {%
      \@ifstar {%
        \sls@let@pair@page@style\relax
      }{%
        \sls@let@pair@page@style\@empty
      }
    }{%
      \sls@init@@pair@page@style
    }%
  }%
}
\scrlayerAddToInterface\sls@init@@pair@page@style{%
  \newcommand*{\sls@init@@pair@page@style}[2]{%
    \expandafter\let\csname sls@ps@#1@even@left@head\expandafter\endcsname
    \csname sls@ps@#2@even@left@head\endcsname
    \expandafter\let\csname sls@ps@#1@even@middle@head\expandafter\endcsname
    \csname sls@ps@#2@even@middle@head\endcsname
    \expandafter\let\csname sls@ps@#1@even@right@head\expandafter\endcsname
    \csname sls@ps@#2@even@right@head\endcsname
    \expandafter\let\csname sls@ps@#1@odd@left@head\expandafter\endcsname
    \csname sls@ps@#2@odd@left@head\endcsname
    \expandafter\let\csname sls@ps@#1@odd@middle@head\expandafter\endcsname
    \csname sls@ps@#2@odd@middle@head\endcsname
    \expandafter\let\csname sls@ps@#1@odd@right@head\expandafter\endcsname
    \csname sls@ps@#2@odd@right@head\endcsname
    \expandafter\let\csname sls@ps@#1@even@left@foot\expandafter\endcsname
    \csname sls@ps@#2@even@left@foot\endcsname
    \expandafter\let\csname sls@ps@#1@even@middle@foot\expandafter\endcsname
    \csname sls@ps@#2@even@middle@foot\endcsname
    \expandafter\let\csname sls@ps@#1@even@right@foot\expandafter\endcsname
    \csname sls@ps@#2@even@right@foot\endcsname
    \expandafter\let\csname sls@ps@#1@odd@left@foot\expandafter\endcsname
    \csname sls@ps@#2@odd@left@foot\endcsname
    \expandafter\let\csname sls@ps@#1@odd@middle@foot\expandafter\endcsname
    \csname sls@ps@#2@odd@middle@foot\endcsname
    \expandafter\let\csname sls@ps@#1@odd@right@foot\expandafter\endcsname
    \csname sls@ps@#2@odd@right@foot\endcsname
  }%
}
\scrlayerAddToInterface\sls@let@pair@page@style{%
  \newcommand*{\sls@let@pair@page@style}[2]{%
    \expandafter\let\csname sls@ps@#2@even@left@head\endcsname #1%
    \expandafter\let\csname sls@ps@#2@even@middle@head\endcsname #1%
    \expandafter\let\csname sls@ps@#2@even@right@head\endcsname #1%
    \expandafter\let\csname sls@ps@#2@odd@left@head\endcsname #1%
    \expandafter\let\csname sls@ps@#2@odd@middle@head\endcsname #1%
    \expandafter\let\csname sls@ps@#2@odd@right@head\endcsname #1%
    \expandafter\let\csname sls@ps@#2@even@left@foot\endcsname #1%
    \expandafter\let\csname sls@ps@#2@even@middle@foot\endcsname #1%
    \expandafter\let\csname sls@ps@#2@even@right@foot\endcsname #1%
    \expandafter\let\csname sls@ps@#2@odd@left@foot\endcsname #1%
    \expandafter\let\csname sls@ps@#2@odd@middle@foot\endcsname #1%
    \expandafter\let\csname sls@ps@#2@odd@right@foot\endcsname #1%
  }%
}
\scrlayerAddToInterface\sls@def@pair@page@style@member{%
  \newcommand*{\sls@def@pair@page@style@member}[1]{%
    \defpagestyle{#1}{%
      {%
        \makebox[0pt][l]{\parbox{\sls@headwidth}{\raggedright
            \strut\@nameuse{sls@ps@#1@even@left@head}\strut}}%
        \parbox{\sls@headwidth}{\centering
          \strut\@nameuse{sls@ps@#1@even@middle@head}\strut}%
        \makebox[0pt][r]{\parbox{\sls@headwidth}{\raggedleft
            \strut\@nameuse{sls@ps@#1@even@right@head}\strut}}%
      }{%
        \makebox[0pt][l]{\parbox{\sls@headwidth}{\raggedright
            \strut\@nameuse{sls@ps@#1@odd@left@head}\strut}}%
        \parbox{\sls@headwidth}{\centering
          \strut\@nameuse{sls@ps@#1@odd@middle@head}\strut}%
        \makebox[0pt][r]{\parbox{\sls@headwidth}{\raggedleft
            \strut\@nameuse{sls@ps@#1@odd@right@head}\strut}}%
      }{%
        \makebox[0pt][l]{\parbox{\sls@headwidth}{\raggedright
            \strut\@nameuse{sls@ps@#1@odd@left@head}\strut}}%
        \parbox{\sls@headwidth}{\centering
          \strut\@nameuse{sls@ps@#1@odd@middle@head}\strut}%
        \makebox[0pt][r]{\parbox{\sls@headwidth}{\raggedleft
            \strut\@nameuse{sls@ps@#1@odd@right@head}\strut}}%
      }%
    }{%
      {%
        \makebox[0pt][l]{\parbox{\sls@footwidth}{\raggedright
            \strut\@nameuse{sls@ps@#1@even@left@foot}\strut}}%
        \parbox{\sls@footwidth}{\centering
          \strut\@nameuse{sls@ps@#1@even@middle@foot}\strut}%
        \makebox[0pt][r]{\parbox{\sls@footwidth}{\raggedleft
            \strut\@nameuse{sls@ps@#1@even@right@foot}\strut}}%
      }{%
        \makebox[0pt][l]{\parbox{\sls@footwidth}{\raggedright
            \strut\@nameuse{sls@ps@#1@odd@left@foot}\strut}}%
        \parbox{\sls@footwidth}{\centering
          \strut\@nameuse{sls@ps@#1@odd@middle@foot}\strut}%
        \makebox[0pt][r]{\parbox{\sls@footwidth}{\raggedleft
            \strut\@nameuse{sls@ps@#1@odd@right@foot}\strut}}%
      }{%
        \makebox[0pt][l]{\parbox{\sls@footwidth}{\raggedright
            \strut\@nameuse{sls@ps@#1@odd@left@foot}\strut}}%
        \parbox{\sls@footwidth}{\centering
          \strut\@nameuse{sls@ps@#1@odd@middle@foot}\strut}%
        \makebox[0pt][r]{\parbox{\sls@footwidth}{\raggedleft
            \strut\@nameuse{sls@ps@#1@odd@right@foot}\strut}}%
      }%
    }%
  }%
}
\scrlayerAddToInterface\newpairofpagestyles{%
  \newcommand*{\newpairofpagestyles}[3][]{%
    \scr@ifundefinedorrelax{ps@#2}{%
      \@ifundefined{ps@plain.#2}{\defpairofpagestyles[#1]{#2}{#3}}{%
        \PackageError{scrlayer-scrpage}{%
          Plain page style of `#2' already defined}{%
          You may only define a new pair of page styles, if neither the style
          itself\MessageBreak
          nor it's plain page style has already been defined.\MessageBreak
          You may use only \string\defpairofpagestyles\space or
          \string\providepairofpagestyles\space with partly\MessageBreak
          already defined page styles.\MessageBreak
          If you'll continue, your command will be ignored.%
        }%
      }%
    }{%
      \PackageError{scrlayer-scrpage}{%
        Page style `#2' already defined}{%
        You may only define a new pair of page styles, if neither the style
        itself\MessageBreak
        nor it's plain page style has already been defined.\MessageBreak
        You may use either \string\renewpairsofpagestyles,
        \string\defpairofpagestyles, or\MessageBreak
        \string\providepairofpagestyles\space with already defined page
        styles.\MessageBreak
        If you'll continue, your command will be ignored.%
      }%
    }%
  }%
}
\scrlayerAddToInterface\renewpairofpagestyles{%
  \newcommand*{\renewpairofpagestyles}[3][]{%
    \scr@ifundefinedorrelax{ps@#2}{%
      \PackageError{scrlayer-scrpage}{%
        Undefined page style `#2'}{%
        You may only redefine existing pairs of page styles. You may use
        either\MessageBreak
        \string\newpairsofpagestyles, \string\defpairofpagestyles, or
        \string\providepairofpagestyles\MessageBreak
        with not yet defined page styles.\MessageBreak
        If you'll continue, your command will be ignored.%
      }%
    }{%
      \@ifundefined{ps@plain.#2}{%
        \PackageError{scrlayer-scrpage}{%
          Undefined plain page style of `#2'}{%
          You may only redefine existing pairs of page styles. You may use
          either\MessageBreak
          \string\defpairofpagestyles\space or
          \string\providepairofpagestyles\space with partly already
          defined\MessageBreak
          page styles.\MessageBreak
          If you'll continue, your command will be ignored.%
        }%
      }{\defpairofpagestyles[#1]{#2}{#3}}%
    }%
  }%
}
\scrlayerAddToInterface\providepairofpagestyles{%
  \newcommand*{\providepairofpagestyles}[3][]{%
    \scr@ifundefinedorrelax{ps@#2}{%
      \@ifundefined{ps@plain.#2}{\defpairofpagestyles[#1]{#2}{#3}}{%
        \PackageInfo{scrlayer-scrpage}{%
          Plain page style of `#2' already\MessageBreak
          defined. Definition ignored}%
      }%
    }{%
      \PackageInfo{scrlayer-scrpage}{%
        Page style of `#2' already defined.\MessageBreak
        Definition ignored}%
    }%
  }%
}
\newpairofpagestyles{scrheadings}{}%
\DeclarePageStyleAlias{scrplain}{plain.scrheadings}
\scrlayerOnAutoRemoveInterface{\DestroyPageStyleAlias{scrplain}}
\scrlayerAddToInterface\ihead{%
  \newcommand*{\ihead}{\@ifstar {\@dblarg\@@@ihead}{\@ihead}}%
}
\scrlayerAddToInterface\@ihead{%
  \newcommand*{\@ihead}{\@ifnextchar[{\@@@ihead}{\@@ihead}}%
}
\scrlayerAddToInterface\@@ihead{%
  \newcommand*{\@@ihead}[1]{\rehead{#1}\lohead{#1}}%
}
\scrlayerAddToInterface\@@@ihead{%
  \newcommand*{\@@@ihead}[2][]{\rehead[{#1}]{#2}\lohead[{#1}]{#2}}%
}
\scrlayerAddToInterface\ohead{%
  \newcommand*{\ohead}{\@ifstar {\@dblarg\@@@ohead}{\@ohead}}%
}
\scrlayerAddToInterface\@ohead{%
  \newcommand*{\@ohead}{\@ifnextchar[{\@@@ohead}{\@@ohead}}%
}
\scrlayerAddToInterface\@@ohead{%
  \newcommand*{\@@ohead}[1]{\lehead{#1}\rohead{#1}}%
}
\scrlayerAddToInterface\@@@ohead{%
  \newcommand*{\@@@ohead}[2][]{\lehead[{#1}]{#2}\rohead[{#1}]{#2}}%
}
\scrlayerAddToInterface\chead{%
  \newcommand*{\chead}{\@ifstar {\@dblarg\@@@chead}{\@chead}}%
}
\scrlayerAddToInterface\@chead{%
  \newcommand*{\@chead}{\@ifnextchar[{\@@@chead}{\@@chead}}%
}
\scrlayerAddToInterface\@@chead{%
  \newcommand*{\@@chead}[1]{\cehead{#1}\cohead{#1}}%
}
\scrlayerAddToInterface\@@@chead{%
  \newcommand*{\@@@chead}[2][]{\cehead[{#1}]{#2}\cohead[{#1}]{#2}}%
}
\scrlayerAddToInterface\lehead{%
  \newcommand*{\lehead}{\sls@renewelement{even}{left}{head}}%
}
\scrlayerAddToInterface\lohead{%
  \newcommand*{\lohead}{\sls@renewelement{odd}{left}{head}}%
}
\scrlayerAddToInterface\rehead{%
  \newcommand*{\rehead}{\sls@renewelement{even}{right}{head}}%
}
\scrlayerAddToInterface\rohead{%
  \newcommand*{\rohead}{\sls@renewelement{odd}{right}{head}}%
}
\scrlayerAddToInterface\cehead{%
  \newcommand*{\cehead}{\sls@renewelement{even}{middle}{head}}%
}
\scrlayerAddToInterface\cohead{%
  \newcommand*{\cohead}{\sls@renewelement{odd}{middle}{head}}%
}
\scrlayerAddToInterface\ifoot{%
  \newcommand*{\ifoot}{\@ifstar {\@dblarg\@@@ifoot}{\@ifoot}}%
}
\scrlayerAddToInterface\@ifoot{%
  \newcommand*{\@ifoot}{\@ifnextchar[{\@@@ifoot}{\@@ifoot}}%
}
\scrlayerAddToInterface\@@ifoot{%
  \newcommand*{\@@ifoot}[1]{\refoot{#1}\lofoot{#1}}%
}
\scrlayerAddToInterface\@@@ifoot{%
  \newcommand*{\@@@ifoot}[2][]{\refoot[{#1}]{#2}\lofoot[{#1}]{#2}}%
}
\scrlayerAddToInterface\ofoot{%
  \newcommand*{\ofoot}{\@ifstar {\@dblarg\@@@ofoot}{\@ofoot}}%
}
\scrlayerAddToInterface\@ofoot{%
  \newcommand*{\@ofoot}{\@ifnextchar[{\@@@ofoot}{\@@ofoot}}%
}
\scrlayerAddToInterface\@@ofoot{%
  \newcommand*{\@@ofoot}[1]{\lefoot{#1}\rofoot{#1}}%
}
\scrlayerAddToInterface\@@@ofoot{%
  \newcommand*{\@@@ofoot}[2][]{\lefoot[{#1}]{#2}\rofoot[{#1}]{#2}}%
}
\scrlayerAddToInterface\cfoot{%
  \newcommand*{\cfoot}{\@ifstar {\@dblarg\@@@cfoot}{\@cfoot}}%
}
\scrlayerAddToInterface\@cfoot{%
  \newcommand*{\@cfoot}{\@ifnextchar[{\@@@cfoot}{\@@cfoot}}%
}
\scrlayerAddToInterface\@@cfoot{%
  \newcommand*{\@@cfoot}[1]{\cefoot{#1}\cofoot{#1}}%
}
\scrlayerAddToInterface\@@@cfoot{%
  \newcommand*{\@@@cfoot}[2][]{\cefoot[{#1}]{#2}\cofoot[{#1}]{#2}}%
}
\scrlayerAddToInterface\lefoot{%
  \newcommand*{\lefoot}{\sls@renewelement{even}{left}{foot}}%
}
\scrlayerAddToInterface\lofoot{%
  \newcommand*{\lofoot}{\sls@renewelement{odd}{left}{foot}}%
}
\scrlayerAddToInterface\refoot{%
  \newcommand*{\refoot}{\sls@renewelement{even}{right}{foot}}%
}
\scrlayerAddToInterface\rofoot{%
  \newcommand*{\rofoot}{\sls@renewelement{odd}{right}{foot}}%
}
\scrlayerAddToInterface\cefoot{%
  \newcommand*{\cefoot}{\sls@renewelement{even}{middle}{foot}}%
}
\scrlayerAddToInterface\cofoot{%
  \newcommand*{\cofoot}{\sls@renewelement{odd}{middle}{foot}}%
}
\scrlayerAddToInterface\sls@renewelement{%
  \newcommand*{\sls@renewelement}[3]{%
    \@ifstar{\@dblarg{\sls@@@@renewelement{#1}{#2}{#3}}}%
            {\sls@@renewelement{#1}{#2}{#3}}%
  }%
}
\scrlayerAddToInterface\sls@@renewelement{%
  \newcommand*{\sls@@renewelement}[3]{%
    \@ifnextchar[%]
    {\sls@@@@renewelement{#1}{#2}{#3}}%
    {\sls@@@renewelement{#1}{#2}{#3}}%
  }%
}
\scrlayerAddToInterface\sls@@@renewelement{%
  \newcommand*{\sls@@@renewelement}[4]{%
    \scr@ifundefinedorrelax{sls@ps@\sls@currentheadings @#1@#2@#3}{%
      \@namedef{sls@ps@scrheadings@#1@#2@#3}{#4}%
    }{%
      \@namedef{sls@ps@\sls@currentheadings @#1@#2@#3}{#4}%
    }%
  }%
}
\scrlayerAddToInterface\sls@@@@renewelement{%
  \def\sls@@@@renewelement#1#2#3[#4]#5{%
    \sls@@renewplainelement{#1}{#2}{#3}{#4}%
    \sls@@@renewelement{#1}{#2}{#3}{#5}%
  }%
}
\scrlayerAddToInterface\sls@@renewplainelement{%
  \newcommand*{\sls@@renewplainelement}[4]{%
    \scr@ifundefinedorrelax{sls@ps@\sls@currentplain @#1@#2@#3}{%
      \@namedef{sls@ps@plain.scrheadings@#1@#2@#3}{#4}%
    }{%
      \@namedef{sls@ps@\sls@currentplain @#1@#2@#3}{#4}%
    }%
  }%
}
\scrlayerAddToInterface\clearmainofpairofpagestyles{%
  \newcommand*{\clearmainofpairofpagestyles}{%
    \ihead{}\chead{}\ohead{}\ifoot{}\cfoot{}\ofoot{}%
  }%
}
\scrlayerAddToInterface\clearscrheadings{%
  \let\clearscrheadings\clearmainofpairofpagestyles
}
\scrlayerAddToInterface\clearplainofpairofpagestyles{%
  \newcommand*{\clearplainofpairofpagestyles}{%
    \sls@@renewplainelement{odd}{left}{head}{}%
    \sls@@renewplainelement{odd}{right}{head}{}%
    \sls@@renewplainelement{odd}{middle}{head}{}%
    \sls@@renewplainelement{even}{left}{head}{}%
    \sls@@renewplainelement{even}{right}{head}{}%
    \sls@@renewplainelement{even}{middle}{head}{}%
    \sls@@renewplainelement{odd}{left}{foot}{}%
    \sls@@renewplainelement{odd}{right}{foot}{}%
    \sls@@renewplainelement{odd}{middle}{foot}{}%
    \sls@@renewplainelement{even}{left}{foot}{}%
    \sls@@renewplainelement{even}{right}{foot}{}%
    \sls@@renewplainelement{even}{middle}{foot}{}%
  }%
}
\scrlayerAddToInterface\clearscrplain{%
  \let\clearscrplain\clearplainofpairofpagestyles
}
\scrlayerAddToInterface\clearpairofpagestyles{%
  \newcommand*{\clearpairofpagestyles}{%
    \ihead[]{}\chead[]{}\ohead[]{}\ifoot[]{}\cfoot[]{}\ofoot[]{}%
  }%
}
\scrlayerAddToInterface\clearscrheadfoot{%
  \let\clearscrheadfoot\clearpairofpagestyles
}
\scrlayerAddToInterface\ps@useheadings{%
  \newcommand*\ps@useheadings{%
    \PackageWarning{scrlayer-scrpage}{incompatible page style!\MessageBreak
      Page styles like `headings' and `plain'\MessageBreak
      are incompatible with the page styles\MessageBreak
      of scrlayer-scrpage. You shouldn't mix\MessageBreak
      them up. Therefore page style\MessageBreak
      `useheadings' is not longer provided.\MessageBreak
      Usage is deprecated and will be replaced\MessageBreak
      by `scrheadings'%
    }%
    \let\ps@useheadings\ps@scrheadings
    \ps@useheadings
  }%
}
\scrlayerAddCsToInterface{ps@plain.useheadings}{%
  \@namedef{ps@plain.useheadings}{\@nameuse{ps@plain.scrheadings}}%
}
%%% From File: $Id: scrlogo.dtx 1380 2013-10-01 15:31:55Z mjk $
\@ifundefined{KOMAScript}{%
  \DeclareRobustCommand{\KOMAScript}{\textsf{K\kern.05em O\kern.05em%
      M\kern.05em A\kern.1em-\kern.1em Script}}}{}
\endinput
%%
%% End of file `scrlayer-scrpage.sty'.
