import { type DefaultTheme, defineAdditionalConfig } from 'vitepress'
import pkg from '../../../packages/protocol-launcher/package.json' with { type: 'json' }

// https://vitepress.dev/reference/site-config
export default defineAdditionalConfig({
  description: '面向多种协议应用的一键启动链接生成器',
  themeConfig: {
    nav: [
      { text: '首页', link: '/zh/' },
      { text: '指南', link: '/zh/guide/getting-started', activeMatch: '/guide/' },
      {
        text: pkg.version,
        items: [
          {
            text: 'Changelog',
            link: 'https://github.com/zhensherlock/protocol-launcher/blob/main/packages/protocol-launcher/CHANGELOG.md',
          },
        ],
      },
    ],

    sidebar: [
      {
        text: '简介',
        items: [
          { text: '什么是 Protocol Launcher？', link: '/zh/guide/what-is-it' },
          { text: '快速开始', link: '/zh/guide/getting-started' },
        ],
      },
      {
        text: '应用程序',
        items: [
          { text: 'AFFiNE', link: '/zh/apps/affine' },
          { text: 'Agenda', link: '/zh/apps/agenda' },
          { text: 'Alfred', link: '/zh/apps/alfred' },
          { text: 'Antigravity', link: '/zh/apps/antigravity' },
          { text: 'Anybox', link: '/zh/apps/anybox' },
          { text: 'App Store', link: '/zh/apps/app-store' },
          { text: 'AppFlowy', link: '/zh/apps/appflowy' },
          { text: 'Appigo Todo', link: '/zh/apps/appigo-todo' },
          { text: 'Apple 地图', link: '/zh/apps/apple-map' },
          { text: 'Apple Script Editor', link: '/zh/apps/apple-script' },
          { text: 'Atom', link: '/zh/apps/atom' },
          { text: '1Writer', link: '/zh/apps/1writer' },
          { text: 'BBEdit', link: '/zh/apps/bbedit' },
          { text: 'Bear', link: '/zh/apps/bear' },
          { text: 'Beorg', link: '/zh/apps/beorg' },
          { text: 'BetterTouchTool', link: '/zh/apps/bettertouchtool' },
          { text: 'Bunch', link: '/zh/apps/bunch' },
          { text: 'Cal2Todo', link: '/zh/apps/cal2todo' },
          { text: 'Calca', link: '/zh/apps/calca' },
          { text: 'Capacities', link: '/zh/apps/capacities' },
          { text: 'Cherry Studio', link: '/zh/apps/cherry-studio' },
          { text: 'Coda', link: '/zh/apps/coda' },
          { text: 'CodeBuddy', link: '/zh/apps/code-buddy' },
          { text: 'CodeBuddy China', link: '/zh/apps/code-buddy-cn' },
          { text: 'CodeLite', link: '/zh/apps/codelite' },
          { text: 'CodeRunner', link: '/zh/apps/code-runner' },
          { text: 'CodeHub', link: '/zh/apps/codehub' },
          { text: 'Codex', link: '/zh/apps/codex' },
          { text: 'Craft', link: '/zh/apps/craft' },
          { text: 'Cubox', link: '/zh/apps/cubox' },
          { text: 'Cursor', link: '/zh/apps/cursor' },
          { text: '2Do', link: '/zh/apps/2do' },
          { text: 'Day One', link: '/zh/apps/day-one' },
          { text: 'DEVONthink', link: '/zh/apps/devonthink' },
          { text: 'dict.cc', link: '/zh/apps/dict-cc' },
          { text: 'Drafts', link: '/zh/apps/drafts' },
          { text: 'Editorial', link: '/zh/apps/editorial' },
          { text: 'Equipd Bible', link: '/zh/apps/equipd-bible' },
          { text: 'Due', link: '/zh/apps/due' },
          { text: 'Evernote', link: '/zh/apps/evernote' },
          { text: 'Fantastical', link: '/zh/apps/fantastical' },
          { text: 'FSNotes', link: '/zh/apps/fsnotes' },
          { text: 'Streets', link: '/zh/apps/ftstreets' },
          { text: 'GitHub Desktop', link: '/zh/apps/github-desktop' },
          { text: 'Gladys', link: '/zh/apps/gladys' },
          { text: 'GoodLinks', link: '/zh/apps/goodlinks' },
          { text: 'GoodTask', link: '/zh/apps/goodtask' },
          { text: 'GoLand', link: '/zh/apps/goland' },
          { text: 'Google Maps', link: '/zh/apps/google-maps' },
          { text: 'HBuilderX', link: '/zh/apps/hbuilderx' },
          { text: 'Hammerspoon', link: '/zh/apps/hammerspoon' },
          { text: 'Hookmark', link: '/zh/apps/hookmark' },
          { text: 'iA Writer', link: '/zh/apps/ia-writer' },
          { text: 'iCab Mobile', link: '/zh/apps/icab-mobile' },
          { text: 'IntelliJ IDEA', link: '/zh/apps/idea' },
          { text: 'Instapaper', link: '/zh/apps/instapaper' },
          { text: 'Interact Scratchpad', link: '/zh/apps/interact' },
          { text: 'iPGMail', link: '/zh/apps/ipgmail' },
          { text: 'Itsycal', link: '/zh/apps/itsycal' },
          { text: 'Jump Desktop', link: '/zh/apps/jump-desktop' },
          { text: 'Keyboard Maestro', link: '/zh/apps/keyboard-maestro' },
          { text: 'Kaleidoscope', link: '/zh/apps/kaleidoscope' },
          { text: 'Kiro', link: '/zh/apps/kiro' },
          { text: 'Lingma', link: '/zh/apps/lingma' },
          { text: 'Longshot', link: '/zh/apps/longshot' },
          { text: 'macOS', link: '/zh/apps/macos' },
          { text: 'MacVim', link: '/zh/apps/macvim' },
          { text: 'Mail Assistant', link: '/zh/apps/mail-assistant' },
          { text: 'miCal', link: '/zh/apps/mical' },
          { text: 'Microsoft Edge', link: '/zh/apps/microsoft-edge' },
          { text: 'Microsoft Teams', link: '/zh/apps/microsoft-teams' },
          { text: 'Motrix', link: '/zh/apps/motrix' },
          { text: 'MultiTimer', link: '/zh/apps/multi-timer' },
          { text: 'Navicat', link: '/zh/apps/navicat' },
          { text: 'NotePlan', link: '/zh/apps/noteplan' },
          { text: 'Nozbe', link: '/zh/apps/nozbe' },
          { text: 'Nova', link: '/zh/apps/nova' },
          { text: 'Obsidian', link: '/zh/apps/obsidian' },
          { text: 'OmniFocus', link: '/zh/apps/omnifocus' },
          { text: 'OpenCode', link: '/zh/apps/opencode' },
          { text: 'Opener', link: '/zh/apps/opener' },
          { text: 'Orchids', link: '/zh/apps/orchids' },
          { text: 'Overcast', link: '/zh/apps/overcast' },
          { text: 'PearAI', link: '/zh/apps/pearai' },
          { text: 'Pika', link: '/zh/apps/pika' },
          { text: 'Pleco', link: '/zh/apps/pleco' },
          { text: 'Prizmo', link: '/zh/apps/prizmo' },
          { text: 'PhpStorm', link: '/zh/apps/phpstorm' },
          { text: 'PyCharm', link: '/zh/apps/pycharm' },
          { text: 'Pythonista', link: '/zh/apps/pythonista' },
          { text: 'Pyto', link: '/zh/apps/pyto' },
          { text: 'Qoder', link: '/zh/apps/qoder' },
          { text: 'Quark', link: '/zh/apps/quark' },
          { text: 'Raycast', link: '/zh/apps/raycast' },
          { text: 'RustRover', link: '/zh/apps/rustrover' },
          { text: 'Scriptable', link: '/zh/apps/scriptable' },
          { text: 'Shopi', link: '/zh/apps/shopi' },
          { text: 'Shortcuts', link: '/zh/apps/shortcuts' },
          { text: 'Simple Scan', link: '/zh/apps/simple-scan' },
          { text: 'Sketch', link: '/zh/apps/sketch' },
          { text: 'Slack', link: '/zh/apps/slack' },
          { text: 'Soulver', link: '/zh/apps/soulver' },
          { text: 'SourceTree', link: '/zh/apps/sourcetree' },
          { text: 'Steam', link: '/zh/apps/steam' },
          { text: 'Story Planner', link: '/zh/apps/story-planner' },
          { text: 'Tally', link: '/zh/apps/tally' },
          { text: 'Telegram', link: '/zh/apps/telegram' },
          { text: 'Terminology', link: '/zh/apps/terminology' },
          { text: 'Termius', link: '/zh/apps/termius' },
          { text: 'Textastic', link: '/zh/apps/textastic' },
          { text: 'TextMate', link: '/zh/apps/textmate' },
          { text: 'Theia', link: '/zh/apps/theia' },
          { text: 'Things', link: '/zh/apps/things' },
          { text: 'Thunder', link: '/zh/apps/thunder' },
          { text: 'Todoist', link: '/zh/apps/todoist' },
          { text: 'Tower', link: '/zh/apps/tower' },
          { text: 'Trae', link: '/zh/apps/trae' },
          { text: 'Trae China', link: '/zh/apps/trae-cn' },
          { text: 'Trello', link: '/zh/apps/trello' },
          { text: 'Ulysses', link: '/zh/apps/ulysses' },
          { text: 'uPic', link: '/zh/apps/upic' },
          { text: 'Verdent', link: '/zh/apps/verdent' },
          { text: 'VS Code', link: '/zh/apps/vscode' },
          { text: 'VS Code Insiders', link: '/zh/apps/vscode-insiders' },
          { text: 'VSCodium', link: '/zh/apps/vscodium' },
          { text: 'WaterMinder', link: '/zh/apps/waterminder' },
          { text: 'Waze', link: '/zh/apps/waze' },
          { text: 'WebStorm', link: '/zh/apps/webstorm' },
          { text: 'WeMeet', link: '/zh/apps/wemeet' },
          { text: 'Where To', link: '/zh/apps/whereto' },
          { text: 'Windsurf', link: '/zh/apps/windsurf' },
          { text: 'Working Copy', link: '/zh/apps/working-copy' },
          { text: 'Xcode', link: '/zh/apps/xcode' },
          { text: 'Zed', link: '/zh/apps/zed' },
        ],
      },
      {
        text: '扩展',
        items: [{ text: '示例', link: '/zh/extra/examples' }],
      },
    ],

    search: { options: searchOptions() },
  },
})

function searchOptions(): Partial<DefaultTheme.AlgoliaSearchOptions> {
  return {
    placeholder: '搜索文档',
    translations: {
      button: {
        buttonText: '搜索文档',
        buttonAriaLabel: '搜索文档',
      },
      modal: {
        searchBox: {
          clearButtonTitle: '清除查询条件',
          clearButtonAriaLabel: '清除查询条件',
          closeButtonText: '关闭',
          closeButtonAriaLabel: '关闭',
          placeholderText: '搜索文档',
          placeholderTextAskAi: '向 AI 提问：',
          placeholderTextAskAiStreaming: '回答中...',
          searchInputLabel: '搜索',
          backToKeywordSearchButtonText: '返回关键字搜索',
          backToKeywordSearchButtonAriaLabel: '返回关键字搜索',
        },
        startScreen: {
          recentSearchesTitle: '搜索历史',
          noRecentSearchesText: '没有搜索历史',
          saveRecentSearchButtonTitle: '保存至搜索历史',
          removeRecentSearchButtonTitle: '从搜索历史中移除',
          favoriteSearchesTitle: '收藏',
          removeFavoriteSearchButtonTitle: '从收藏中移除',
          recentConversationsTitle: '最近的对话',
          removeRecentConversationButtonTitle: '从历史记录中删除对话',
        },
        errorScreen: {
          titleText: '无法获取结果',
          helpText: '你可能需要检查你的网络连接',
        },
        noResultsScreen: {
          noResultsText: '无法找到相关结果',
          suggestedQueryText: '你可以尝试查询',
          reportMissingResultsText: '你认为该查询应该有结果？',
          reportMissingResultsLinkText: '点击反馈',
        },
        resultsScreen: {
          askAiPlaceholder: '向 AI 提问： ',
        },
        askAiScreen: {
          disclaimerText: '答案由 AI 生成，可能不准确，请自行验证。',
          relatedSourcesText: '相关来源',
          thinkingText: '思考中...',
          copyButtonText: '复制',
          copyButtonCopiedText: '已复制！',
          copyButtonTitle: '复制',
          likeButtonTitle: '赞',
          dislikeButtonTitle: '踩',
          thanksForFeedbackText: '感谢你的反馈！',
          preToolCallText: '搜索中...',
          duringToolCallText: '搜索 ',
          afterToolCallText: '已搜索',
          // aggregatedToolCallText: '已搜索',
        },
        footer: {
          selectText: '选择',
          submitQuestionText: '提交问题',
          selectKeyAriaLabel: 'Enter 键',
          navigateText: '切换',
          navigateUpKeyAriaLabel: '向上箭头',
          navigateDownKeyAriaLabel: '向下箭头',
          closeText: '关闭',
          backToSearchText: '返回搜索',
          closeKeyAriaLabel: 'Esc 键',
          poweredByText: '搜索提供者',
        },
      },
    },
  }
}
