<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
    <title>Alfresco Content App</title>
    <link rel="stylesheet" href="https://unpkg.com/docute@3/dist/docute.css" />
    <link rel="icon" type="image/png" href="favicon-96x96.png" sizes="96x96" />
  </head>
  <body>
    <div id="app"></div>
    <script src="https://unpkg.com/docute@3/dist/docute.js"></script>
    <script src="https://unpkg.com/prismjs/components/prism-typescript.js"></script>
    <script>
      const langs = [
        { title: 'English', path: '/' },
        { title: '日本語', path: '/ja/', matchPath: /^\/ja[\/$]/ }
      ];

      docute.init({
        url: '.',
        toc: ($route) => {
          const isJapaneseLang = $route.path.split('/')[1] === 'ja';
          const wasJapaneseLang = $route.from.path.split('/')[1] === 'ja';

          if (wasJapaneseLang !== isJapaneseLang) {
            const isFirstPageLoad = $route.from.path === '/' && $route.from.meta.name !== 'home';
            if (!isFirstPageLoad) {
              document.location.reload();
            }
          }

          if (isJapaneseLang) {
            return './ja/toc.md';
          }
          return './toc.md';
        },
        nav: {
          default: [
            {
              title: 'English',
              type: 'dropdown',
              items: langs
            },
            {
              title: 'Home',
              path: '/'
            },
            {
              title: 'App features',
              path: '/features/'
            },
            {
              title: 'Getting Started',
              path: '/getting-started/'
            },
            {
              title: 'Extending',
              path: '/extending/'
            },
            {
              title: 'Tutorials',
              path: '/tutorials/'
            },
            {
              title: 'Get Help',
              path: '/help'
            }
          ],
          ja: [
            {
              title: '日本語',
              type: 'dropdown',
              items: langs
            },
            {
              title: 'ホーム',
              path: '/ja/'
            },
            {
              title: 'アプリの機能',
              path: '/ja/features/'
            },
            {
              title: '入門',
              path: '/ja/getting-started/'
            },
            {
              title: '拡張',
              path: '/ja/extending/'
            },
            {
              title: 'チュートリアル',
              path: '/ja/tutorials/'
            },
            {
              title: 'ヘルプ',
              path: '/ja/help'
            }
          ]
        },
        icons: [
          {
            icon: 'github',
            label: 'Contribute on GitHub',
            link: 'https://github.com/Alfresco/alfresco-content-app'
          }
        ]
      });
    </script>
  </body>
</html>