%%%
% Mappy
%%%
\def\filedateMappy{2026/04/17}%
\def\fileversionMappy{0.1a}%
\message{-- \filedateMappy\space v\fileversionMappy}%
%
\setKVdefault[Mappy]{Largeur=0.5\linewidth,Auteur=CoMaps,Temps={1/35,1/30,2/22,0/47,4/10,7/20},Distance=100,Essence=15,Peage=25,Bouchon=3,Depart=Position actuelle,Arrivee=Paris}%

\makeatletter
\NewDocumentEnvironment{Mappy}{o}{%
  \useKVdefault[Mappy]%
  \setKV[Mappy]{#1}%
  \edef\PfC@RetiensListeTemps{\useKV[Mappy]{Temps}}%
  \setsepchar[*]{,*/}\ignoreemptyitems%
  \readlist*\PfC@ListeTemps{\PfC@RetiensListeTemps}%
  \reademptyitems%
  \begin{tcolorbox}[%
    enhanced,%
    colback=white,
    colframe=gray!15,
    top=2em,
    left=1em,
    right=1em,
    bottom=1em,
    width={\useKV[Mappy]{Largeur}}]
    {\Huge\color{LightGray}\faUserCircle}\hfill{\Huge\useKV[Mappy]{Auteur}}\hfill{\Huge\color{LightGray}\faMapSigns}
    \begin{center}
      \begin{tcolorbox}[nobeforeafter,colback=LightGray!15,width=0.8\linewidth,enhanced,
        overlay unbroken and first={
          \node[anchor=north east] at (frame.north west) {\Huge \faAngleLeft};
          \node[anchor=north west] at (frame.north east) {\large \faPlus};
          \node[anchor=south west] at (frame.south east) {\large \faArrowsAltV};
          \node[anchor=north west,Gray] at (frame.south west) {\faCalendar*[regular] : Partir maintenant};
          \node[anchor=north east,Gray] at (frame.south east) {\faCog Mes options};
        }
        ]
        De : {\large\useKV[Mappy]{Depart}}
        \par\bigskip\par
        Vers : {\large\useKV[Mappy]{Arrivee}}
      \end{tcolorbox}
    \end{center}
    \par\medskip\par
    \begin{center}
      \footnotesize
      \begin{tabular}{ccccccc}
        \faSortAmountDown*&\faCar&\faMotorcycle&\faTaxi&\faTrain&\faBus&\faBicycle\\
        Trier&%
               \SI{\PfC@ListeTemps[1,1]}{\hour}~\num{\PfC@ListeTemps[1,2]}
                                 &\SI{\PfC@ListeTemps[2,1]}{\hour}~\num{\PfC@ListeTemps[2,2]}
                                               &\SI{\PfC@ListeTemps[3,1]}{\hour}~\num{\PfC@ListeTemps[3,2]}
                                                       &\SI{\PfC@ListeTemps[4,2]}{\minute}
                                                                &\SI{\PfC@ListeTemps[5,1]}{\hour}~\num{\PfC@ListeTemps[5,2]}
                                                                       &\SI{\PfC@ListeTemps[6,1]}{\hour}~\num{\PfC@ListeTemps[6,2]}\\
        \hhline{~-~~~~~}
      \end{tabular}
    \end{center}
    \par\hrulefill\par
    {\Large\bfseries Itinéraire recommandé}\hfill{\Large\bfseries\Temps{;;;\PfC@ListeTemps[1,1];\PfC@ListeTemps[1,2]}}\par\smallskip\par
    \Lg[km]{\useKV[Mappy]{Distance}}~\faGasPump~\Prix{\useKV[Mappy]{Essence}}~\faRoad~\Prix{\useKV[Mappy]{Peage}}\hfill{\faCarCrash~+\Temps{;;;;\useKV[Mappy]{Bouchon}}}
  \end{tcolorbox}
}{}%
\makeatother