<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="theme-color" content="#000000">
    <!--
      manifest.json provides metadata used when your web app is added to the
      homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
    -->
    <link rel="manifest" href="{{ contextPath }}/manifest.json">
    <link rel="shortcut icon" href="{{ contextPath }}/favicon.ico">

    <base href="{{ contextPath }}">
    <title>SCM-Manager</title>
    <script>
      var modernBrowser = (
        'fetch' in window &&
        'assign' in Object
      );
      if ( !modernBrowser ) {
        var scriptElement = document.createElement("script");
        scriptElement.async = false;
        scriptElement.src = "{{ contextPath }}/assets/polyfills.bundle.js";
        document.head.appendChild(scriptElement);
      }
      var linkElement = document.createElement("link");
      linkElement.rel = 'stylesheet';
      linkElement.type = 'text/css';
      var theme = localStorage.getItem('scm.theme');
      if (theme === 'light') {
        linkElement.href = "{{ contextPath }}/assets/ui-theme-light.css"
      } else if (theme === 'dark') {
        linkElement.href = "{{ contextPath }}/assets/ui-theme-dark.css"
      } else if (theme === 'highcontrast') {
        linkElement.href = "{{ contextPath }}/assets/ui-theme-highcontrast.css"
      } else {
        if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
          linkElement.href = "{{ contextPath }}/assets/ui-theme-dark.css"
        } else {
          linkElement.href = "{{ contextPath }}/assets/ui-theme-light.css"
        }
      }
      document.head.appendChild(linkElement);
    </script>
  </head>
  <body>
    <noscript>
      You need to enable JavaScript to run this app.
    </noscript>
    <div id="root"></div>
    <div id="modalRoot"></div>

    <script>
      window.ctxPath = "{{ contextPath }}";
      window.scmStage = "{{ scmStage }}";
    </script>
    <script src="{{ contextPath }}/assets/runtime.bundle.js"></script>
    <script src="{{ contextPath }}/assets/vendors~webapp.bundle.js"></script>
    <script src="{{ contextPath }}/assets/webapp.bundle.js"></script>

    {{#liveReloadURL}}
    <script src="{{liveReloadURL}}"></script>
    {{/liveReloadURL}}
  </body>
</html>
