[
  {
    "path": ".github/workflows/ci.yml",
    "content": "name: ci\n\non:\n  push:\n    branches:\n      - main\n    paths-ignore:\n      - README.md\n      - README_CN.md\n  pull_request:\n    paths-ignore:\n      - README.md\n      - README_CN.md\n\njobs:\n  build-web:\n    runs-on: windows-latest\n    steps:\n    - name: Checkout\n      uses: actions/checkout@v4\n    - name: Set up Node\n      uses: actions/setup-node@v4\n      with:\n        node-version: 22\n        cache: 'npm'\n    - name: Install dependencies\n      run: npm install\n    - name: Build\n      env:\n        ONEDRIVE_AUTH: ${{ secrets.ONEDRIVE_AUTH }}\n        ONEDRIVE_GME: ${{ secrets.ONEDRIVE_GME }}\n        CLIENT_ID: ${{ secrets.CLIENT_ID }}\n        REDIRECT_URI: ${{ secrets.REDIRECT_URI }}\n      run: npm run build\n    - name: Upload artifact\n      id: deployment\n      uses: actions/upload-pages-artifact@v3\n      with:\n        path: './dist'\n\n  deploy:\n    if: github.event_name == 'push' && github.ref == 'refs/heads/main'\n    runs-on: ubuntu-latest\n    needs:\n      - build-web\n    permissions:\n      pages: write\n      id-token: write\n    environment:\n      name: github-pages\n      url: ${{ steps.deployment.outputs.page_url }}\n    steps:\n      - name: Setup Pages\n        uses: actions/configure-pages@v3\n      - name: Deploy to GitHub Pages\n        id: deployment\n        uses: actions/deploy-pages@v4\n\n  build-android:\n    runs-on: ubuntu-latest\n    env:\n      KEYSTORE: ${{ secrets.KEYSTORE }}\n    steps:\n      - name: Clone repository\n        uses: actions/checkout@v4\n      - uses: actions/setup-java@v4\n        with:\n          distribution: 'temurin'\n          java-version: '21'\n      - name: Decode and save keystore\n        if: env.KEYSTORE != ''\n        run: |\n          echo \"${{ secrets.KEYSTORE }}\" | base64 --decode > android/app/keystore.jks\n      - name: Save key.properties\n        if: env.KEYSTORE != ''\n        run: |\n          echo \"storePassword=${{ secrets.STORE_PASSWORD }}\" >> android/key.properties\n          echo \"keyPassword=${{ secrets.KEY_PASSWORD }}\" >> android/key.properties\n          echo \"keyAlias=${{ secrets.KEY_ALIAS }}\" >> android/key.properties\n          echo \"storeFile=keystore.jks\" >> android/key.properties\n      - name: Grant execute permission for gradlew\n        run: chmod +x android/gradlew\n\n      - name: Build release apk\n        if: env.KEYSTORE != ''\n        run: cd android && ./gradlew assembleRelease\n      - name: Rename release apk\n        if: env.KEYSTORE != ''\n        run: mv android/app/build/outputs/apk/release/app-release.apk OMP-android.apk\n      - name: Upload android artifact\n        if: env.KEYSTORE != ''\n        uses: actions/upload-artifact@v4\n        with:\n          name: OMP-android\n          path: OMP-android.apk\n\n      - name: Build debug apk\n        if: env.KEYSTORE == ''\n        run: cd android && ./gradlew assembleDebug\n      - name: Rename debug apk\n        if: env.KEYSTORE == ''\n        run: mv android/app/build/outputs/apk/debug/app-debug.apk OMP-android-debug.apk\n      - name: Upload android debug artifact\n        if: env.KEYSTORE == ''\n        uses: actions/upload-artifact@v4\n        with:\n          name: OMP-android-debug\n          path: OMP-android-debug.apk\n\n  release:\n    if: github.event_name == 'push' && github.ref == 'refs/heads/main'\n    runs-on: ubuntu-latest\n    needs:\n      - build-web\n      - build-android\n      - deploy\n    env:\n      KEYSTORE: ${{ secrets.KEYSTORE }}\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Get version\n        id: yq\n        uses: mikefarah/yq@master\n        with:\n          cmd: yq -r '.version' package.json\n      - name: Print version\n        run: echo ${{ steps.yq.outputs.result }}\n      - name: Prepare tag name\n        id: tag_name\n        run: |\n          VERSION=\"${{ steps.yq.outputs.result }}\"\n          TAG_NAME=\"v${VERSION}\"\n          echo \"TAG_NAME=$TAG_NAME\" >> \"$GITHUB_OUTPUT\"\n      - name: Check tag\n        uses: mukunku/tag-exists-action@v1.6.0\n        id: check-tag\n        with:\n          tag: ${{ steps.tag_name.outputs.TAG_NAME }}\n      - name: Eextract log\n        if: steps.check-tag.outputs.exists == 'false'\n        run: python extract_log.py ${{ steps.tag_name.outputs.TAG_NAME }}\n      - name: Download android artifact\n        if: steps.check-tag.outputs.exists == 'false' && env.KEYSTORE != ''\n        uses: actions/download-artifact@v4\n        with:\n          name: OMP-android\n          path: artifacts\n      - name: Release\n        if: steps.check-tag.outputs.exists == 'false' && env.KEYSTORE != ''\n        uses: softprops/action-gh-release@v2\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        with:\n          tag_name: ${{ steps.tag_name.outputs.TAG_NAME }}\n          body_path: CHANGELOG_${{ steps.tag_name.outputs.TAG_NAME }}.md\n          draft: false\n          prerelease: false\n          files: |\n            artifacts/OMP-android.apk"
  },
  {
    "path": ".gitignore",
    "content": "# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\npnpm-debug.log*\nlerna-debug.log*\n\nnode_modules\ndist\ndist-ssr\n*.local\n\n# Editor directories and files\n.vscode/*\n!.vscode/extensions.json\n.idea\n.DS_Store\n*.suo\n*.ntvs*\n*.njsproj\n*.sln\n*.sw?\n\n# env\n.env\n.env.development\n.env.production\n\n# auto generated\nsrc/data/info.ts\nsrc/locales/en/messages.ts\nsrc/locales/zh-CN/messages.ts\n"
  },
  {
    "path": ".swcrc",
    "content": "{\n  \"$schema\": \"https://json.schemastore.org/swcrc\",\n  \"jsc\": {\n    \"experimental\": {\n      \"plugins\": [\n          [\"@lingui/swc-plugin\",{}]\n      ]\n    },\n    \"parser\": {\n      \"syntax\": \"typescript\"\n    },\n    \"baseUrl\": \"./\",\n    \"paths\": {\n      \"@/*\": [\n        \"src/*\"\n      ]\n    }\n  },\n  \"minify\": false\n}"
  },
  {
    "path": "CHANGELOG.md",
    "content": "## v1.9.4\n### Changelog\n* Release android PWA apk\n\n### 更新日志\n* 发布 android PWA apk\n\n\n## v1.9.3\n### ⚠ Warning\nFor self-deployed instances, please check [readme.md](https://github.com/nini22P/omp/blob/main/readme.md#running-and-build) before upgrading to add any missing environment variables: `ONEDRIVE_AUTH`, `ONEDRIVE_GME`\n\n### ⚠ 警告\n自行部署的在升级前请查看 [readme_cn.md](https://github.com/nini22P/omp/blob/main/readme_cn.md#运行和编译) 添加缺失的环境变量: `ONEDRIVE_AUTH`, `ONEDRIVE_GME`\n\n### Changelog\n* Support for VNET (self-deployment required, please refer to [readme.md](https://github.com/nini22P/omp/blob/main/readme.md#running-and-build)) @xiaoman1221\n* Change title on playback\n* Hide the option to refetch media metadata in the menu when playing a video\n\n### 更新日志\n* 支持世纪互联（需自行部署，具体请查看 [readme_cn.md](https://github.com/nini22P/omp/blob/main/readme_cn.md#运行和编译)）@xiaoman1221\n* 播放时更改标题\n* 播放视频时隐藏菜单中重新获取媒体元数据的选项\n\n\n## v1.9.2\n### Changelog\n* Fixed playback control\n* Improved album cover color extraction\n\n### 更新日志\n* 修复播放控制\n* 改进专辑封面颜色提取\n\n\n## v1.9.1\n### Changelog\n* Same time lyrics highlighting to support translated text\n* Fixed the volume slider triggering swipe gestures\n\n### 更新日志\n* 相同时间的歌词高亮显示，以支持翻译文本\n* 修复音量滑条触发滑动手势的问题\n\n\n## v1.9.0\n### Changelog\n* Support for embedded lyrics in audio files\n* Added button tooltips\n* Added version display\n\n### 更新日志\n* 支持音频文件内嵌歌词\n* 添加按钮提示\n* 添加版本显示\n\n\n## v1.8.1\n### Changelog\n* Added the ability to play multiple discs using the play all button\n```\n- Folder examples, starting with disc and disk, case insensitive\n  - Disc1\n  - Disc 2\n  - Disk3\n  - Disk 4\n```\n* Improved theme color extraction\n* Improved video player style\n* Fixed some files not displaying\n\n### 更新日志\n* 可使用全部播放按钮多碟播放\n```\n- 文件夹样例，disc 和 disk 开头，不区分大小写\n  - Disc1\n  - Disc 2\n  - Disk3\n  - Disk 4\n```\n* 改进主题颜色提取\n* 改进视频播放器样式\n* 修复部分文件未显示\n\n\n## v1.8.0\n### Changelog\n* Multi-select list support\n* Improve the file search\n\n### 更新日志\n* 列表支持多选操作\n* 改进文件搜索\n\n\n## v1.7.4\n### Changelog\n* fix clear play queue on change  current account\n* fix language display issue\n\n### 更新日志\n* 修复选择当前账户时清空播放队列的问题\n* 修复语言显示的问题\n\n\n## v1.7.3\n### Changelog\n* Supports multiple accounts\n\n### 更新日志\n* 支持多账户\n\n\n## v1.7.2\n### Changelog\n* Add more menu options\n\n### 更新日志\n* 添加更多菜单选项\n\n\n## v1.7.0\n### Changelog\n* add playback rate menu\n* i18n migration to lingui\n\n### 更新日志\n* 添加播放速度菜单\n* i18n 迁移到 lingui\n\n\n## v1.6.4\n### Changelog\n* add volume control\n\n### 更新日志\n* 添加音量控制\n\n\n## v1.6.2\n###  Changelog\n\n- Fix playlist display bug\n\n###  更新日志\n- 修复播放列表显示问题\n\n\n## v1.6.1\n### Changelog\n- Fix float action button display bug\n\n### 更新日志\n- 修复浮动按钮显示问题\n\n\n## v1.6.0\n### Changelog\n- Ability to search in the current file list \n- Improved storage size of the local metadata cache (recommend clearing the local metadata cache once)\n\n### 更新日志\n- 能够在当前文件列表搜索\n- 优化本地元数据缓存的存储占用（建议清除一次本地元数据缓存）\n\n\n## v1.5.4\n### Changelog\n\n- Improvement of audio playback interface opening animation\n\n### 更新日志\n\n- 改进音频播放界面打开时的动画\n\n\n## v1.5.2\n### Changelog\n\n- Improved user experience\n- Fix known bugs\n\n### 更新日志\n\n- 改进用户体验\n- 修复已知 bug\n\n\n## v1.5.1\n###   Changelog\n- Now you don't need to log in to get to the main screen\n- Improved theme color extraction\n\n###   更新日志\n\n- 现在无需登录即可进入主界面\n- 改进主题色提取\n\n\n## v1.5.0\n### Changelog\n\n- New UI interface\n- Possibility to generate theme colors using album cover\n- @MakinoharaShoko has provided a new icon\n\n### 更新日志\n\n- 新的 UI 界面\n- 可以从专辑封面生成主题色\n- @MakinoharaShoko 提供了新的图标\n\n\n## v1.4.2\n### Features\n\n- Add multi-column lists and grids to files\n- Add HD Thumbnails option\n- Image Viewer Improvements\n\n\n### 特性\n\n- 文件添加多列列表和网格\n- 添加高清缩略图选项\n- 改进图像查看器\n\n\n## v1.4.1\n### Improved\n\n- Improved list performance\n\n### 改进\n\n- 改进了列表的性能\n\n\n## v1.4.0\n### Features\n\n- Support for viewing images\n- Add thumbnails to file list\n- Add sorting to file list\n\n### 特性\n\n- 支持查看图片\n- 文件列表添加缩略图\n- 文件列表添加排序\n\n\n## v1.3.1\n### Fix\n\n- Accidental playback after clicking on another file while paused\n\n---\n\n### 修复\n\n- 暂停时点击其他文件后意外播放\n\n\n## v1.3.0\n### Features\n\n- Ability to hide the title bar on the desktop\n- Add local metadata cache\n- Improved display of audio playback interface, playlists and play queues\n\n---\n\n### 特性\n- 桌面端可隐藏标题栏\n- 添加本地元数据缓存\n- 改进音频播放界面、播放列表和播放队列的显示\n\n\n## v1.2.0\n### ⚠ Change\n\n- Migration to webpack\n- Changed client ID\n\n#### How to retrieve previous data\n\nThis update has changed the client ID, you need to re-authorize, if you are a user of the old version, it will create new data in the new folder.\nFirst close OMP, then open ``Applications`` folder in OneDrive, find ``OMP 1`` folder, delete all files in it, then find ``OMP`` folder, move all files in it to ``OMP 1`` folder, delete ``OMP`` folder, and lastly rename ``OMP 1`` folder to ``OMP``.\n\n---\n\n### ⚠ 变更\n\n- 迁移到 webpack\n- 更改了客户端 ID\n\n#### 如何找回之前的数据\n\n本次更新更换了客户端 ID，需重新授权，如果是旧版本用户使用时会在新文件夹中创建新数据。\n首先关闭 OMP，然后打开 OneDrive 中的  `应用` 文件夹，找到 `OMP 1` 文件夹，删除里面的全部文件，然后找到 `OMP` 文件夹，将里面的全部文件移动到 `OMP 1` 文件夹，删除 `OMP` 文件夹，最后将 `OMP 1` 文件夹重命名为 `OMP`。\n\n\n## v1.1.0\n### Change\n\n* Move account logout to settings page\n\n### 变更\n\n* 账户注销移动到设置页\n\n\n## v1.0.0\n### Features\n\n- OneDrive Files View\n-  Music Playback\n-  Music Metadata\n-  Video Playback\n-  Play Queue\n-  Dark Mode\n-  Media Session\n-  PWA\n-  History Sync\n-  Playlists Sync\n\n---\n\n### 特性\n\n- OneDrive 文件查看\n-  音乐播放\n-  音乐元数据\n-  视频播放\n-  播放队列\n-  黑暗模式\n-  Media Session\n-  PWA\n-  播放历史同步\n-  播放列表同步"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU AFFERO GENERAL PUBLIC LICENSE\n                       Version 3, 19 November 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU Affero General Public License is a free, copyleft license for\nsoftware and other kinds of works, specifically designed to ensure\ncooperation with the community in the case of network server software.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nour General Public Licenses are intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  Developers that use our General Public Licenses protect your rights\nwith two steps: (1) assert copyright on the software, and (2) offer\nyou this License which gives you legal permission to copy, distribute\nand/or modify the software.\n\n  A secondary benefit of defending all users' freedom is that\nimprovements made in alternate versions of the program, if they\nreceive widespread use, become available for other developers to\nincorporate.  Many developers of free software are heartened and\nencouraged by the resulting cooperation.  However, in the case of\nsoftware used on network servers, this result may fail to come about.\nThe GNU General Public License permits making a modified version and\nletting the public access it on a server without ever releasing its\nsource code to the public.\n\n  The GNU Affero General Public License is designed specifically to\nensure that, in such cases, the modified source code becomes available\nto the community.  It requires the operator of a network server to\nprovide the source code of the modified version running there to the\nusers of that server.  Therefore, public use of a modified version, on\na publicly accessible server, gives the public access to the source\ncode of the modified version.\n\n  An older license, called the Affero General Public License and\npublished by Affero, was designed to accomplish similar goals.  This is\na different license, not a version of the Affero GPL, but Affero has\nreleased a new version of the Affero GPL which permits relicensing under\nthis license.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU Affero General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Remote Network Interaction; Use with the GNU General Public License.\n\n  Notwithstanding any other provision of this License, if you modify the\nProgram, your modified version must prominently offer all users\ninteracting with it remotely through a computer network (if your version\nsupports such interaction) an opportunity to receive the Corresponding\nSource of your version by providing access to the Corresponding Source\nfrom a network server at no charge, through some standard or customary\nmeans of facilitating copying of software.  This Corresponding Source\nshall include the Corresponding Source for any work covered by version 3\nof the GNU General Public License that is incorporated pursuant to the\nfollowing paragraph.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the work with which it is combined will remain governed by version\n3 of the GNU General Public License.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU Affero General Public License from time to time.  Such new versions\nwill be similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU Affero General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU Affero General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU Affero General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU Affero General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU Affero General Public License for more details.\n\n    You should have received a copy of the GNU Affero General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If your software can interact with users remotely through a computer\nnetwork, you should also make sure that it provides a way for users to\nget its source.  For example, if your program is a web application, its\ninterface could display a \"Source\" link that leads users to an archive\nof the code.  There are many ways you could offer source, and different\nsolutions will be better for different programs; see section 13 for the\nspecific requirements.\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU AGPL, see\n<https://www.gnu.org/licenses/>.\n"
  },
  {
    "path": "PRIVACY.md",
    "content": "# OMP Privacy Policy\r\n\r\n**Effective Date: [June 3, 2025]**\r\n\r\nWelcome to OMP (hereinafter referred to as \"this Application\" or \"we\")! This Application is a web application designed to help you manage and use media files in your OneDrive through official Microsoft APIs.\r\n\r\nWe highly value your privacy. This Privacy Policy (hereinafter referred to as \"this Policy\") is intended to explain how we handle (or, more accurately, **do not handle**) your information when you use our services. Please read this Policy carefully to ensure you understand and agree to it before using our services.\r\n\r\n**1. We Do Not Collect Your Personal Information**\r\n\r\nWe solemnly declare: OMP **will not collect, store, transmit, analyze, or sell any of your personally identifiable information or the content and metadata of your files in OneDrive on the developer's servers.**\r\n\r\nThe design philosophy of this Application is to maximize user privacy protection:\r\n\r\n* **Client-Side Operation:** This Application primarily runs directly in your browser.\r\n* **Direct Interaction:** The Application interacts with your OneDrive account via official Microsoft APIs. All data requests and transmissions occur directly between your local device and your OneDrive, under your authorization.\r\n* **No Developer Access:** The developer and this Application's servers (if any, they are only used to host the static web files of the application itself and do not process user data) cannot access, view, or store your personal OneDrive data or any personally identifiable information.\r\n\r\n**2. Data Usage and Authorization**\r\n\r\n* **User Authorization:** For this Application to access and operate on files in your OneDrive (e.g., listing files, reading media files for playback), you need to explicitly authorize this Application to access relevant data in your OneDrive account through Microsoft's OAuth 2.0 authorization process. The permissions we request include `User.Read` (to read basic user profile information), `Files.Read` (to read user's OneDrive files), and `Files.ReadWrite.AppFolder` (to read and write data in the application's dedicated folder, used for synchronizing history and playlists).\r\n* **Scope of Permission:** This Application will only access your OneDrive data within the scope of your authorization and solely for implementing the core functionalities of the Application (such as Browse, managing, and playing your specified media files, synchronizing your playback history and playlists). We will not request permissions beyond what is necessary for the Application's functions.\r\n* **Credential Security:** Your OneDrive login credentials (username and password) are processed and verified directly by Microsoft's authentication services. This Application will not obtain, record, or store these credentials. The MSAL (Microsoft Authentication Library) handles authentication tokens on the client-side (your browser).\r\n\r\n**3. Data Storage**\r\n\r\nThis Application itself **does not have independent servers to store any of your personal data or file content.** Data you generate or use through this Application is stored in the following locations:\r\n\r\n* **In Your OneDrive:**\r\n    * According to the design of this Application, specific application-related data will be stored in the `Apps/OMP` folder in your personal OneDrive.\r\n    * This data is under your control, and the developer cannot access it.\r\n* **In Your Browser's Local Storage:**\r\n    * **localStorage:**\r\n        * Used to cache MSAL's authentication state.\r\n        * Used to store the Application's UI settings (e.g., theme, view preferences).\r\n        * Used to store the current play queue status.\r\n    * **IndexedDB:**\r\n        * Used to cache media file metadata (such as song titles, artists, album cover information) to improve loading speed and reduce network requests.\r\n    * The data stored locally in your browser is for your personal use only, to enhance application experience and performance, and will not be transmitted to the developer or our servers.\r\n\r\n**4. Microsoft OneDrive's Privacy Policy**\r\n\r\nData you store in OneDrive and authorizations made through Microsoft's authentication services are subject to Microsoft Corporation's privacy policy. We strongly recommend that you review and understand Microsoft's official privacy statement to learn how they collect, use, and protect your data. You can visit [https://privacy.microsoft.com/](https://privacy.microsoft.com/) to view it (please note that this link may change; refer to Microsoft's official latest link).\r\n\r\n**5. Cookies and Browser Local Storage Technologies**\r\n\r\n* **Cookies:** This Application currently does not primarily set or rely on Cookies to track users or store permanent personal information directly. Microsoft's authentication services (MSAL) may use Cookies in their processes, which adhere to Microsoft's privacy practices.\r\n* **LocalStorage and IndexedDB:** As described in Section 3 \"Data Storage,\" this Application uses browser LocalStorage and IndexedDB technologies to store authentication cache, UI preferences, play queue, and media metadata.\r\n    * The information stored by these technologies is limited to data necessary for the application's operation and to enhance user experience, and it is retained only in your local browser and not sent to the developer.\r\n    * You can clear Cookies, LocalStorage, and IndexedDB data at any time through your browser settings. However, please note that clearing this data may reset some application settings to default or require you to log in again.\r\n\r\n**6. Data Security**\r\n\r\n* We communicate securely with the Microsoft OneDrive API via the industry-standard OAuth 2.0 protocol to ensure the security of your authorization process and data transmission (between your device and OneDrive).\r\n* The security of your personal data also depends on your proper safeguarding of your Microsoft account credentials and the security mechanisms of the Microsoft OneDrive service itself. We recommend using a strong password and enabling two-factor authentication for your Microsoft account.\r\n\r\n**7. Third-Party Services**\r\n\r\nOther than the Microsoft OneDrive API and Microsoft authentication services, this Application does not rely on other third-party services that actively collect your personal information and transmit it back to the developer. This Application uses various open-source libraries to build its features (as shown in the `package.json` file), and these libraries follow their respective open-source licensing agreements.\r\n\r\n**8. Children's Privacy**\r\n\r\nThis Application is not targeted at children under the age of 13 (or other applicable age as defined in your jurisdiction). We do not knowingly collect any personally identifiable information from children.\r\n\r\n**9. Changes to This Privacy Policy**\r\n\r\nWe may update this Privacy Policy from time to time to reflect changes in our practices or legal requirements. If we make any material changes, we will notify you by posting the updated Privacy Policy on our Application's website and indicating the \"Effective Date\" at the top of the policy. We encourage you to review this Privacy Policy periodically for any updates. Your continued use of this Application after the changes take effect signifies your acceptance of the revised Privacy Policy.\r\n\r\n**10. Contact Us**\r\n\r\nIf you have any questions, comments, or suggestions about this Privacy Policy or our handling of your information, please contact us through the following means:\r\n\r\n* **GitHub:** [https://github.com/nini22P/omp](https://github.com/nini22P/omp)\r\n\r\nThank you for using OMP!"
  },
  {
    "path": "PRIVACY_CN.md",
    "content": "# OMP 隐私政策\r\n\r\n**生效日期：[2025年6月3日]**\r\n\r\n欢迎使用 OMP（以下简称“本应用”或“我们”）！本应用是一款网页应用，旨在通过微软官方 API 帮助您管理和使用您 OneDrive 中的媒体文件。\r\n\r\n我们非常重视您的隐私。本隐私政策（以下简称“本政策”）旨在向您说明，当您使用我们的服务时，我们如何处理（或者更准确地说，**不处理**）您的信息。请仔细阅读本政策，确保您在充分理解并同意后使用我们的服务。\r\n\r\n**1. 我们不收集您的个人信息**\r\n\r\n我们郑重声明：OMP **不会在开发者服务器上收集、存储、传输、分析或出售任何您的个人身份信息或您 OneDrive 中的文件内容及元数据。**\r\n\r\n本应用的设计理念是最大限度地保护用户隐私：\r\n\r\n* **客户端运行：** 本应用主要在您的浏览器中直接运行。\r\n* **直接交互：** 应用通过微软官方 API 与您的 OneDrive 账户进行交互。所有数据请求和传输均在您授权的前提下，在您的本地设备和您的 OneDrive 之间直接进行。\r\n* **开发者无权限：** 开发者及本应用的服务器（如有，也仅用于托管应用本身的静态网页文件，不处理用户数据）无法访问、查看或存储您的个人 OneDrive 数据或任何个人身份信息。\r\n\r\n**2. 数据的使用与授权**\r\n\r\n* **用户授权：** 为了使本应用能够访问并操作您 OneDrive 中的文件（例如，列出文件、读取媒体文件以供播放），您需要通过微软的 OAuth 2.0 授权流程，明确授权本应用访问您 OneDrive 账户中的相关数据。我们请求的权限包括 `User.Read`（读取用户基本配置信息）、`Files.Read`（读取用户 OneDrive 文件）以及 `Files.ReadWrite.AppFolder`（在应用专属文件夹中读写数据，用于同步历史记录和播放列表）。\r\n* **权限范围：** 本应用仅会在您授权的范围内访问您的 OneDrive 数据，并且仅用于实现应用的核心功能（如浏览、管理和播放您指定的媒体文件，同步您的播放历史和播放列表）。我们不会请求超出应用功能所必需的权限。\r\n* **凭据安全：** 您的 OneDrive 登录凭据（用户名和密码）由微软的身份验证服务直接处理和验证，本应用不会获取、记录或存储您的这些凭据。MSAL 库（Microsoft Authentication Library）在客户端（您的浏览器）处理身份验证令牌。\r\n\r\n**3. 数据的存储**\r\n\r\n本应用本身**不设有独立的服务器来存储您的任何个人数据或文件内容。** 您通过本应用产生或使用的数据存储在以下位置：\r\n\r\n* **用户 OneDrive 中：**\r\n    * 根据本应用的的设计，应用相关的特定数据，会存储在您个人 OneDrive 的 `Apps/OMP` 文件夹下。\r\n    * 这些数据由您自己掌控，开发者无法访问。\r\n* **浏览器本地存储中：**\r\n    * **localStorage：**\r\n        * 用于缓存 MSAL 的身份验证状态。\r\n        * 用于存储应用的 UI 设置（例如主题、视图偏好等）。\r\n        * 用于存储当前的播放队列状态。\r\n    * **IndexedDB：**\r\n        * 用于缓存媒体文件的元数据（如歌曲标题、艺术家、专辑封面信息等），以提高加载速度和减少网络请求。\r\n    * 以上这些存储在浏览器本地的数据仅供您个人在本地设备上使用，用于提升应用体验和性能，不会被传输给开发者或我们的服务器。\r\n\r\n**4. 微软 OneDrive 的隐私政策**\r\n\r\n您在 OneDrive 中存储的数据以及通过微软身份验证服务进行的授权，均受微软公司隐私政策的约束。我们强烈建议您查阅并理解微软的官方隐私声明，以了解微软如何收集、使用和保护您的数据。您可以访问 [https://privacy.microsoft.com/](https://privacy.microsoft.com/) 查看（请注意，此链接可能会变更，请以微软官方最新链接为准）。\r\n\r\n**5. Cookies 和浏览器本地存储技术**\r\n\r\n* **Cookies：** 本应用目前主要不直接设置和依赖 Cookies 来追踪用户或存储永久性个人信息。微软身份验证服务（MSAL）可能会在其流程中使用 Cookies，这遵循微软的隐私实践。\r\n* **LocalStorage 和 IndexedDB：** 如第3点“数据的存储”中所述，本应用使用浏览器的 LocalStorage 和 IndexedDB 技术来存储身份验证缓存、UI偏好、播放队列以及媒体元数据。\r\n    * 这些技术存储的信息仅限于应用运行和提升用户体验所必需的数据，并且仅保留在您的本地浏览器中，不会发送给开发者。\r\n    * 您可以随时通过浏览器设置清除 Cookies、LocalStorage 和 IndexedDB 数据。但请注意，清除这些数据可能会导致部分应用设置恢复默认或需要重新登录。\r\n\r\n**6. 数据安全**\r\n\r\n* 我们通过行业标准的 OAuth 2.0 协议与微软 OneDrive API 进行安全通信，以确保您的授权过程和数据传输（在您的设备和 OneDrive 之间）的安全性。\r\n* 您个人数据的安全也依赖于您妥善保管您的微软账户凭据以及微软 OneDrive 服务本身的安全机制。我们建议您使用强密码并为您的微软账户启用双因素认证。\r\n\r\n**7. 第三方服务**\r\n\r\n除微软 OneDrive API 和微软身份验证服务外，本应用不依赖其他会主动收集您个人信息的第三方服务并将数据回传给开发者。本应用使用了多种开源库来构建功能（如 `package.json` 文件所示），这些库遵循其各自的开源许可协议。\r\n\r\n**8. 儿童隐私**\r\n\r\n本应用不针对13岁以下的儿童（或您所在司法管辖区定义的其他适用年龄）。我们不会有意收集任何儿童的个人身份信息。\r\n\r\n**9. 本隐私政策的变更**\r\n\r\n我们可能会不时更新本隐私政策，以反映我们实践的变化或法律法规的要求。如果我们做出任何重大变更，我们将通过在本应用的网站上发布更新后的隐私政策来通知您，并在政策顶部注明“生效日期”。我们鼓励您定期查看本隐私政策以了解任何更新。您在变更生效后继续使用本应用即表示您接受修订后的隐私政策。\r\n\r\n**10. 联系我们**\r\n\r\n如果您对本隐私政策或我们对您信息的处理有任何疑问、意见或建议，请通过以下方式与我们联系：\r\n\r\n* **GitHub：** [https://github.com/nini22P/omp](https://github.com/nini22P/omp)\r\n\r\n感谢您使用 OMP！"
  },
  {
    "path": "README.md",
    "content": "<img height=\"100px\" width=\"100px\" alt=\"logo\" src=\"https://github.com/nini22P/omp/assets/60903333/e2c099c6-15ad-46f1-a716-cb440b06c13e\"/>\n\n# OMP - OneDrive Media Player\n\n![ci](https://github.com/nini22P/omp/actions/workflows/ci.yml/badge.svg)\n<a href=\"https://apps.microsoft.com/detail/9p6w6x16q7l9?referrer=appbadge&mode=direct\">\n\t<img src=\"https://get.microsoft.com/images/en-us%20dark.svg\" height=\"30\"/>\n</a>\n<a href=\"https://afdian.com/a/nini22P\">\n  <img alt=\"Afdaian\" style=\"height: 30px;\" src=\"https://pic1.afdiancdn.com/static/img/welcome/button-sponsorme.png\">\n</a>\n[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/nini22p)\n\nEnglish | [中文](./README_CN.md)\n\n**Try OMP Now:**\n\n* **[Web Version](https://nini22p.github.io/omp/)**\n* **[Microsoft Store (PWA)](https://apps.microsoft.com/detail/9p6w6x16q7l9)**\n* **[Download Android APK (PWA)](https://github.com/nini22P/omp/releases/latest/download/OMP-android.apk)**\n\n## Features\n\n- [x] OneDrive Files View\n- [x] Music Playback\n- [x] Music Lyrics\n- [x] Video Playback\n- [x] Play Queue\n- [x] Dark Mode\n- [x] Media Session\n- [x] PWA\n- [x] History Sync\n- [x] Playlists Sync\n- [x] Support VNET\n\n## Screenshots\n\n![Audio light](./public/screenshots/audio-light.webp)\n![Audio dark](./public/screenshots/audio-dark.webp)\n\n## FAQ\n\n### Where is my data stored?\n\nAll of OMP data is stored in the `Apps / OMP` folder in your OneDrive. Where `history.json` is the history and `playlists.json` is the playlists. If you have lost your data, you can restore an older version by visiting the OneDrive web version.\n\n## Running and Build\n\n### App registrations\n\n1. Go to <https://portal.azure.com/>\n2. Into `App registrations` register an application\n3. `Supported account types` select the third item (`Accounts in any organizational directory and personal Microsoft accounts`)\n4. `Redirect URI` select `SPA`, url enter <http://localhost:8760> or the domain of your deploy\n5. `API Permissions` add `User.Read` `Files.Read` `Files.ReadWrite.AppFolder`\n\n### Run dev server\n\nAdd `.env.development` in project path\n\n```env\nONEDRIVE_AUTH=https://login.microsoftonline.com/common #VNET(https://login.partner.microsoftonline.cn/common)\nONEDRIVE_GME=https://graph.microsoft.com #VNET(https://microsoftgraph.chinacloudapi.cn)\nCLIENT_ID=<clientId>\nREDIRECT_URI=http://localhost:8760\n```\n\nRun `npm i && npm run dev`\n\n### Local build\n\nAdd `.env` in project path\n\n```env\nONEDRIVE_AUTH=https://login.microsoftonline.com/common #VNET(https://login.partner.microsoftonline.cn/common)\nONEDRIVE_GME=https://graph.microsoft.com #VNET(https://microsoftgraph.chinacloudapi.cn)\nCLIENT_ID=<clientId>\nREDIRECT_URI=<redirectUri>\n```\n\nRun `npm i && npm run build`\n\n## Donations\n\nThis project is free, if you think it works, feel free to donate to support it\n\n- [AFDIAN](https://afdian.com/a/nini22P)\n- [Ko-fi](https://ko-fi.com/nini22p)\n\n## License\n\n[AGPL 3.0](https://github.com/nini22P/omp/blob/main/LICENSE)\n\n## Privacy Policy\n[Privacy Policy](https://github.com/nini22P/omp/blob/main/PRIVACY.md)\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=nini22P/omp&type=Date)](https://star-history.com/#nini22P/omp&Date)\n"
  },
  {
    "path": "README_CN.md",
    "content": "<img height=\"100px\" width=\"100px\" alt=\"logo\" src=\"https://github.com/nini22P/omp/assets/60903333/e2c099c6-15ad-46f1-a716-cb440b06c13e\"/>\n\n# OMP - OneDrive 媒体播放器\n\n![ci](https://github.com/nini22P/omp/actions/workflows/ci.yml/badge.svg)\n<a href=\"https://apps.microsoft.com/detail/9p6w6x16q7l9?referrer=appbadge&mode=direct\">\n\t<img src=\"https://get.microsoft.com/images/zh-cn%20dark.svg\" height=\"30\"/>\n</a>\n<a href=\"https://afdian.com/a/nini22P\">\n  <img alt=\"Afdaian\" style=\"height: 30px;\" src=\"https://pic1.afdiancdn.com/static/img/welcome/button-sponsorme.png\">\n</a>\n[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/nini22p)\n\n[English](./README.md) | 中文\n\n**立即体验 OMP:**\n\n* **[网页版](https://nini22p.github.io/omp/)**\n* **[微软商店 (PWA)](https://apps.microsoft.com/detail/9p6w6x16q7l9)**\n* **[下载 Android APK (PWA)](https://github.com/nini22P/omp/releases/latest/download/OMP-android.apk)**\n\n## 功能\n\n- [x] OneDrive 文件查看\n- [x] 音乐播放\n- [x] 歌词显示\n- [x] 视频播放\n- [x] 播放队列\n- [x] 黑暗模式\n- [x] Media Session\n- [x] PWA\n- [x] 播放历史同步\n- [x] 播放列表同步\n- [x] 支持世纪互联版\n\n## 截图\n\n![音频 亮色模式](./public/screenshots/audio-light.webp)\n![音频 暗色模式](./public/screenshots/audio-dark.webp)\n\n## FAQ\n\n### 我的数据保存在哪里？\n\nOMP 的数据全部保存在你的 OneDrive 中的 `应用 / OMP` 文件夹中。其中 `history.json` 为历史记录，`playlists.json` 为播放列表，如果有数据丢失可以访问 OneDrive 网页版恢复旧版本数据。\n\n## 运行和编译\n\n### 注册应用\n\n1. 打开 <https://portal.azure.com/>\n2. 进入 `应用注册` 添加一个新应用\n3. `支持账户类型` 选择第三项 (`任何组织目录中的帐户和个人 Microsoft 帐户`)\n4. `重定向 URI` 选择 `SPA`, url 输入 <http://localhost:8760> 或者你部署访问的域名\n5. `API 权限` 添加 `User.Read` `Files.Read` `Files.ReadWrite.AppFolder`\n\n### 运行开发服务器\n\n在项目路径添加 `.env.development`\n\n```env\nONEDRIVE_AUTH=https://login.microsoftonline.com/common #世纪互联(https://login.partner.microsoftonline.cn/common)\nONEDRIVE_GME=https://graph.microsoft.com #世纪互联(https://microsoftgraph.chinacloudapi.cn)\nCLIENT_ID=<clientId>\nREDIRECT_URI=http://localhost:8760\n```\n\n运行 `npm i && npm run dev`\n\n### 本地编译\n\n在项目路径添加 `.env`\n\n```env\nONEDRIVE_AUTH=https://login.microsoftonline.com/common #世纪互联(https://login.partner.microsoftonline.cn/common)\nONEDRIVE_GME=https://graph.microsoft.com #世纪互联(https://microsoftgraph.chinacloudapi.cn)\nCLIENT_ID=<clientId>\nREDIRECT_URI=<redirectUri>\n```\n\n运行 `npm i && npm run build`\n\n## 捐赠\n\n这个项目完全免费，如果你觉得好用，欢迎捐赠支持\n\n- [爱发电](https://afdian.com/a/nini22P)\n- [Ko-fi](https://ko-fi.com/nini22p)\n\n## 许可\n\n[AGPL 3.0](https://github.com/nini22P/omp/blob/main/LICENSE)\n\n## 隐私政策\n[隐私政策](https://github.com/nini22P/omp/blob/main/PRIVACY_CN.md)\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=nini22P/omp&type=Date)](https://star-history.com/#nini22P/omp&Date)\n"
  },
  {
    "path": "android/.gitignore",
    "content": "# Gradle files\n.gradle/\nbuild/\napp/build/\napp/release/\n\n# Local configuration file (sdk path, etc)\nlocal.properties\n\n# Log/OS Files\n*.log\n\n# Android Studio generated files and folders\ncaptures/\n.externalNativeBuild/\n.cxx/\n*.apk\noutput.json\n\n# IntelliJ\n*.iml\n.idea/\nmisc.xml\ndeploymentTargetDropDown.xml\nrender.experimental.xml\n\n# Keystore files\nkey.properties\n**/*.keystore\n**/*.jks\n\n# Google Services (e.g. APIs or Firebase)\ngoogle-services.json\n\n# Android Profiling\n*.hprof\n"
  },
  {
    "path": "android/app/build.gradle",
    "content": "/*\n * Copyright 2019 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport groovy.xml.MarkupBuilder\n\nplugins {\n    id 'com.android.application'\n}\n\ndef twaManifest = [\n    applicationId: 'nini22p.omp',\n    hostName: 'nini22p.github.io', // The domain being opened in the TWA.\n    launchUrl: '/omp/', // The start path for the TWA. Must be relative to the domain.\n    name: 'OMP', // The application name.\n    launcherName: 'OMP', // The name shown on the Android Launcher.\n    themeColor: '#f7f7f7', // The color used for the status bar.\n    themeColorDark: '#3b3b3b', // The color used for the dark status bar.\n    navigationColor: '#f7f7f7', // The color used for the navigation bar.\n    navigationColorDark: '#3b3b3b', // The color used for the dark navbar.\n    navigationDividerColor: '#f7f7f7', // The navbar divider color.\n    navigationDividerColorDark: '#3b3b3b', // The dark navbar divider color.\n    backgroundColor: '#FFFFFF', // The color used for the splash screen background.\n    enableNotifications: false, // Set to true to enable notification delegation.\n    // Every shortcut must include the following fields:\n    // - name: String that will show up in the shortcut.\n    // - short_name: Shorter string used if |name| is too long.\n    // - url: Absolute path of the URL to launch the app with (e.g '/create').\n    // - icon: Name of the resource in the drawable folder to use as an icon.\n    shortcuts: [],\n    // The duration of fade out animation in milliseconds to be played when removing splash screen.\n    splashScreenFadeOutDuration: 300,\n    generatorApp: 'PWABuilder', // Application that generated the Android Project\n    // The fallback strategy for when Trusted Web Activity is not available. Possible values are\n    // 'customtabs' and 'webview'.\n    fallbackType: 'customtabs',\n    enableSiteSettingsShortcut: 'true',\n    orientation: 'default',\n]\n\ndef keystorePropertiesFile = rootProject.file(\"key.properties\")\ndef keystoreProperties = new Properties()\n\nif ( keystorePropertiesFile.exists() )\n    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))\n\nandroid {\n    compileSdkVersion 35\n    namespace \"nini22p.omp\"\n    defaultConfig {\n        applicationId \"nini22p.omp\"\n        minSdkVersion 23\n        targetSdkVersion 35\n        versionCode 1\n        versionName \"1.0.0.0\"\n\n        // The name for the application\n        resValue \"string\", \"appName\", twaManifest.name\n\n        // The name for the application on the Android Launcher\n        resValue \"string\", \"launcherName\", twaManifest.launcherName\n\n        // The URL that will be used when launching the TWA from the Android Launcher\n        def launchUrl = \"https://\" + twaManifest.hostName + twaManifest.launchUrl\n        resValue \"string\", \"launchUrl\", launchUrl\n\n        \n            // The URL the Web Manifest for the Progressive Web App that the TWA points to. This\n            // is used by Chrome OS and Meta Quest to open the Web version of the PWA instead of\n            // the TWA, as it will probably give a better user experience for non-mobile devices.\n            resValue \"string\", \"webManifestUrl\", 'https://nini22p.github.io/omp/manifest.json'\n        \n\n        \n            // This is used by Meta Quest.\n            resValue \"string\", \"fullScopeUrl\", 'https://nini22p.github.io/omp/'\n        \n\n        \n\n        // The hostname is used when building the intent-filter, so the TWA is able to\n        // handle Intents to open host url of the application.\n        resValue \"string\", \"hostName\", twaManifest.hostName\n\n        // This attribute sets the status bar color for the TWA. It can be either set here or in\n        // `res/values/colors.xml`. Setting in both places is an error and the app will not\n        // compile. If not set, the status bar color defaults to #FFFFFF - white.\n        resValue \"color\", \"colorPrimary\", twaManifest.themeColor\n\n        // This attribute sets the dark status bar color for the TWA. It can be either set here or in\n        // `res/values/colors.xml`. Setting in both places is an error and the app will not\n        // compile. If not set, the status bar color defaults to #000000 - white.\n        resValue \"color\", \"colorPrimaryDark\", twaManifest.themeColorDark\n\n        // This attribute sets the navigation bar color for the TWA. It can be either set here or\n        // in `res/values/colors.xml`. Setting in both places is an error and the app will not\n        // compile. If not set, the navigation bar color defaults to #FFFFFF - white.\n        resValue \"color\", \"navigationColor\", twaManifest.navigationColor\n\n        // This attribute sets the dark navigation bar color for the TWA. It can be either set here\n        // or in `res/values/colors.xml`. Setting in both places is an error and the app will not\n        // compile. If not set, the navigation bar color defaults to #000000 - black.\n        resValue \"color\", \"navigationColorDark\", twaManifest.navigationColorDark\n\n        // This attribute sets the navbar divider color for the TWA. It can be either \n        // set here or in `res/values/colors.xml`. Setting in both places is an error and the app \n        // will not compile. If not set, the divider color defaults to #00000000 - transparent.\n        resValue \"color\", \"navigationDividerColor\", twaManifest.navigationDividerColor\n\n        // This attribute sets the dark navbar divider color for the TWA. It can be either \n        // set here or in `res/values/colors.xml`. Setting in both places is an error and the \n        //app will not compile. If not set, the divider color defaults to #000000 - black.\n        resValue \"color\", \"navigationDividerColorDark\", twaManifest.navigationDividerColorDark\n\n        // Sets the color for the background used for the splash screen when launching the\n        // Trusted Web Activity.\n        resValue \"color\", \"backgroundColor\", twaManifest.backgroundColor\n\n        // Defines a provider authority for the Splash Screen\n        resValue \"string\", \"providerAuthority\", twaManifest.applicationId + '.fileprovider'\n\n        // The enableNotification resource is used to enable or disable the\n        // TrustedWebActivityService, by changing the android:enabled and android:exported\n        // attributes\n        resValue \"bool\", \"enableNotification\", twaManifest.enableNotifications.toString()\n\n        twaManifest.shortcuts.eachWithIndex { shortcut, index ->\n            resValue \"string\", \"shortcut_name_$index\", \"$shortcut.name\"\n            resValue \"string\", \"shortcut_short_name_$index\", \"$shortcut.short_name\"\n        }\n\n        // The splashScreenFadeOutDuration resource is used to set the duration of fade out animation in milliseconds\n        // to be played when removing splash screen. The default is 0 (no animation).\n        resValue \"integer\", \"splashScreenFadeOutDuration\", twaManifest.splashScreenFadeOutDuration.toString()\n\n        resValue \"string\", \"generatorApp\", twaManifest.generatorApp\n\n        resValue \"string\", \"fallbackType\", twaManifest.fallbackType\n\n        resValue \"bool\", \"enableSiteSettingsShortcut\", twaManifest.enableSiteSettingsShortcut\n        resValue \"string\", \"orientation\", twaManifest.orientation\n    }\n    signingConfigs {\n        if ( keystorePropertiesFile.exists() )\n        release {\n            storeFile file(keystoreProperties['storeFile'])\n            storePassword keystoreProperties['storePassword']\n            keyAlias keystoreProperties['keyAlias']\n            keyPassword keystoreProperties['keyPassword']\n        }\n    }\n    buildTypes {\n        release {\n            if ( keystorePropertiesFile.exists() )\n            signingConfig signingConfigs.release\n            minifyEnabled true\n        }\n    }\n    compileOptions {\n        sourceCompatibility JavaVersion.VERSION_21\n        targetCompatibility JavaVersion.VERSION_21\n    }\n    lintOptions {\n        checkReleaseBuilds false\n    }\n}\n\ntask generateShorcutsFile {\n    assert twaManifest.shortcuts.size() < 5, \"You can have at most 4 shortcuts.\"\n    twaManifest.shortcuts.eachWithIndex { s, i ->\n        assert s.name != null, 'Missing `name` in shortcut #' + i\n        assert s.short_name != null, 'Missing `short_name` in shortcut #' + i\n        assert s.url != null, 'Missing `icon` in shortcut #' + i\n        assert s.icon != null, 'Missing `url` in shortcut #' + i\n    }\n\n    def shortcutsFile = new File(\"$projectDir/src/main/res/xml\", \"shortcuts.xml\")\n\n    def xmlWriter = new StringWriter()\n    def xmlMarkup = new MarkupBuilder(new IndentPrinter(xmlWriter, \"    \", true))\n\n    xmlMarkup\n        .'shortcuts'('xmlns:android': 'http://schemas.android.com/apk/res/android') {\n            twaManifest.shortcuts.eachWithIndex { s, i ->\n                'shortcut'(\n                        'android:shortcutId': 'shortcut' + i,\n                        'android:enabled': 'true',\n                        'android:icon': '@drawable/' + s.icon,\n                        'android:shortcutShortLabel': '@string/shortcut_short_name_' + i,\n                        'android:shortcutLongLabel': '@string/shortcut_name_' + i) {\n                    'intent'(\n                            'android:action': 'android.intent.action.MAIN',\n                            'android:targetPackage': twaManifest.applicationId,\n                            'android:targetClass': twaManifest.applicationId + '.LauncherActivity',\n                            'android:data': s.url)\n                    'categories'('android:name': 'android.intent.category.LAUNCHER')\n                }\n            }\n        }\n    shortcutsFile.text = xmlWriter.toString() + '\\n'\n}\n\npreBuild.dependsOn(generateShorcutsFile)\n\nrepositories {\n    \n}\n\ndependencies {\n    implementation fileTree(include: ['*.jar'], dir: 'libs')\n    \n        implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.5.0'\n    \n}\n"
  },
  {
    "path": "android/app/src/main/AndroidManifest.xml",
    "content": "<!--\n    Copyright 2019 Google Inc. All Rights Reserved.\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n         http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n\n<!-- The \"package\" attribute is rewritten by the Gradle build with the value of applicationId.\n     It is still required here, as it is used to derive paths, for instance when referring\n     to an Activity by \".MyActivity\" instead of the full name. If more Activities are added to the\n     application, the package attribute will need to reflect the correct path in order to use\n     the abbreviated format. -->\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"nini22p.omp\">\n\n    \n\n    \n\n    \n\n    \n\n    <application\n        android:name=\"Application\"\n        android:allowBackup=\"true\"\n        android:icon=\"@mipmap/ic_launcher\"\n        android:label=\"@string/appName\"\n        \n        android:manageSpaceActivity=\"com.google.androidbrowserhelper.trusted.ManageDataLauncherActivity\"\n        \n        android:supportsRtl=\"true\"\n        android:theme=\"@android:style/Theme.Translucent.NoTitleBar\">\n\n        <meta-data\n            android:name=\"asset_statements\"\n            android:resource=\"@string/assetStatements\" />\n\n        \n            <meta-data\n                android:name=\"web_manifest_url\"\n                android:value=\"@string/webManifestUrl\" />\n        \n\n        <meta-data\n            android:name=\"twa_generator\"\n            android:value=\"@string/generatorApp\" />\n\n        \n\n        \n\n        \n            <activity android:name=\"com.google.androidbrowserhelper.trusted.ManageDataLauncherActivity\">\n            <meta-data\n                android:name=\"android.support.customtabs.trusted.MANAGE_SPACE_URL\"\n                android:value=\"@string/launchUrl\" />\n            </activity>\n        \n\n        <activity android:name=\"LauncherActivity\"\n            android:alwaysRetainTaskState=\"true\"\n            android:label=\"@string/launcherName\"\n            android:exported=\"true\">\n            <meta-data android:name=\"android.support.customtabs.trusted.DEFAULT_URL\"\n                android:value=\"@string/launchUrl\" />\n\n            <meta-data\n                android:name=\"android.support.customtabs.trusted.STATUS_BAR_COLOR\"\n                android:resource=\"@color/colorPrimary\" />\n\n            <meta-data\n                android:name=\"android.support.customtabs.trusted.STATUS_BAR_COLOR_DARK\"\n                android:resource=\"@color/colorPrimaryDark\" />\n\n            <meta-data\n                android:name=\"android.support.customtabs.trusted.NAVIGATION_BAR_COLOR\"\n                android:resource=\"@color/navigationColor\" />\n\n            <meta-data\n                android:name=\"android.support.customtabs.trusted.NAVIGATION_BAR_COLOR_DARK\"\n                android:resource=\"@color/navigationColorDark\" />\n\n            <meta-data\n                android:name=\"androix.browser.trusted.NAVIGATION_BAR_DIVIDER_COLOR\"\n                android:resource=\"@color/navigationDividerColor\" />\n\n            <meta-data\n                android:name=\"androix.browser.trusted.NAVIGATION_BAR_DIVIDER_COLOR_DARK\"\n                android:resource=\"@color/navigationDividerColorDark\" />\n\n            <meta-data android:name=\"android.support.customtabs.trusted.SPLASH_IMAGE_DRAWABLE\"\n                android:resource=\"@drawable/splash\"/>\n\n            <meta-data android:name=\"android.support.customtabs.trusted.SPLASH_SCREEN_BACKGROUND_COLOR\"\n                android:resource=\"@color/backgroundColor\"/>\n\n            <meta-data android:name=\"android.support.customtabs.trusted.SPLASH_SCREEN_FADE_OUT_DURATION\"\n                android:value=\"@integer/splashScreenFadeOutDuration\"/>\n\n            <meta-data android:name=\"android.support.customtabs.trusted.FILE_PROVIDER_AUTHORITY\"\n                android:value=\"@string/providerAuthority\"/>\n\n            <meta-data android:name=\"android.app.shortcuts\" android:resource=\"@xml/shortcuts\" />\n\n            <meta-data android:name=\"android.support.customtabs.trusted.FALLBACK_STRATEGY\"\n                android:value=\"@string/fallbackType\" />\n\n            \n\n            \n\n            <meta-data android:name=\"android.support.customtabs.trusted.SCREEN_ORIENTATION\"\n                android:value=\"@string/orientation\"/>\n\n            \n\n            \n\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"android.intent.category.LAUNCHER\" />\n            </intent-filter>\n\n            <intent-filter android:autoVerify=\"true\">\n                <action android:name=\"android.intent.action.VIEW\"/>\n                <category android:name=\"android.intent.category.DEFAULT\" />\n                <category android:name=\"android.intent.category.BROWSABLE\"/>\n                <data android:scheme=\"https\"\n                    android:host=\"@string/hostName\"/>\n            </intent-filter>\n\n            \n        </activity>\n\n        <activity android:name=\"com.google.androidbrowserhelper.trusted.FocusActivity\" />\n\n        <activity android:name=\"com.google.androidbrowserhelper.trusted.WebViewFallbackActivity\"\n            android:configChanges=\"orientation|screenSize\" />\n\n        <provider\n            android:name=\"androidx.core.content.FileProvider\"\n            android:authorities=\"@string/providerAuthority\"\n            android:grantUriPermissions=\"true\"\n            android:exported=\"false\">\n            <meta-data\n                android:name=\"android.support.FILE_PROVIDER_PATHS\"\n                android:resource=\"@xml/filepaths\" />\n        </provider>\n\n        <service\n            android:name=\".DelegationService\"\n            android:enabled=\"@bool/enableNotification\"\n            android:exported=\"@bool/enableNotification\">\n\n            \n\n            <intent-filter>\n                <action android:name=\"android.support.customtabs.trusted.TRUSTED_WEB_ACTIVITY_SERVICE\"/>\n                <category android:name=\"android.intent.category.DEFAULT\"/>\n            </intent-filter>\n        </service>\n\n        \n\n        \n    </application>\n</manifest>\n"
  },
  {
    "path": "android/app/src/main/java/nini22p/omp/Application.java",
    "content": "/*\n * Copyright 2020 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage nini22p.omp;\n\n\n\npublic class Application extends android.app.Application {\n\n  \n\n  @Override\n  public void onCreate() {\n      super.onCreate();\n      \n  }\n}\n"
  },
  {
    "path": "android/app/src/main/java/nini22p/omp/DelegationService.java",
    "content": "package nini22p.omp;\n\n\n\npublic class DelegationService extends\n        com.google.androidbrowserhelper.trusted.DelegationService {\n    @Override\n    public void onCreate() {\n        super.onCreate();\n\n        \n    }\n}\n\n"
  },
  {
    "path": "android/app/src/main/java/nini22p/omp/LauncherActivity.java",
    "content": "/*\n * Copyright 2020 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage nini22p.omp;\n\nimport android.content.pm.ActivityInfo;\nimport android.net.Uri;\nimport android.os.Build;\nimport android.os.Bundle;\n\n\n\npublic class LauncherActivity\n        extends com.google.androidbrowserhelper.trusted.LauncherActivity {\n    \n\n    \n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        // Setting an orientation crashes the app due to the transparent background on Android 8.0\n        // Oreo and below. We only set the orientation on Oreo and above. This only affects the\n        // splash screen and Chrome will still respect the orientation.\n        // See https://github.com/GoogleChromeLabs/bubblewrap/issues/496 for details.\n        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {\n            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);\n        } else {\n            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);\n        }\n    }\n\n    @Override\n    protected Uri getLaunchingUrl() {\n        // Get the original launch Url.\n        Uri uri = super.getLaunchingUrl();\n\n        \n\n        return uri;\n    }\n}\n"
  },
  {
    "path": "android/app/src/main/res/drawable-anydpi/shortcut_legacy_background.xml",
    "content": "<!--\n    Copyright 2020 Google Inc. All Rights Reserved.\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n         http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n<inset xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:aapt=\"http://schemas.android.com/aapt\"\n    android:inset=\"2dp\">\n    <aapt:attr name=\"android:drawable\">\n        <shape android:shape=\"oval\">\n            <solid android:color=\"@color/shortcut_background\" />\n            <size android:width=\"44dp\" android:height=\"44dp\" />\n        </shape>\n    </aapt:attr>\n</inset>\n"
  },
  {
    "path": "android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml",
    "content": "<!--\n    Copyright 2019 Google Inc. All Rights Reserved.\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n         http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:aapt=\"http://schemas.android.com/aapt\">\n    <background>\n        <layer-list>\n            <item android:drawable=\"@android:color/white\" />\n            <!-- \n                The paddings below give the icons a similar proportion as the\n                icon generated by WebAPKs.\n            -->\n            <item android:drawable=\"@mipmap/ic_maskable\"\n                android:top=\"8.5dp\"\n                android:right=\"8.5dp\"\n                android:left=\"8.5dp\"\n                android:bottom=\"8.5dp\" />\n        </layer-list>\n    </background>\n    <foreground android:drawable=\"@android:color/transparent\" />\n</adaptive-icon>\n"
  },
  {
    "path": "android/app/src/main/res/raw/web_app_manifest.json",
    "content": "{\n  \"name\": \"OMP\",\n  \"short_name\": \"OMP\",\n  \"start_url\": \"/omp/\",\n  \"display\": \"standalone\",\n  \"display_override\": [\n    \"window-controls-overlay\"\n  ],\n  \"description\": \"OneDrive Media Player / OneDrive 媒体播放器\",\n  \"dir\": \"auto\",\n  \"icons\": [\n    {\n      \"src\": \"./favicon.ico\",\n      \"type\": \"image/x-icon\",\n      \"sizes\": \"32x32\"\n    },\n    {\n      \"src\": \"./icon-192.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"192x192\"\n    },\n    {\n      \"src\": \"./icon-512.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"512x512\"\n    },\n    {\n      \"src\": \"./icon-192-maskable.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"192x192\",\n      \"purpose\": \"maskable\"\n    },\n    {\n      \"src\": \"./icon-512-maskable.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"512x512\",\n      \"purpose\": \"maskable\"\n    }\n  ],\n  \"screenshots\": [\n    {\n      \"src\": \"./screenshots/audio-light.webp\",\n      \"sizes\": \"1317x904\",\n      \"type\": \"image/webp\",\n      \"form_factor\": \"wide\",\n      \"description\": \"Audio Light\"\n    },\n    {\n      \"src\": \"./screenshots/audio-dark.webp\",\n      \"sizes\": \"1317x904\",\n      \"type\": \"image/webp\",\n      \"form_factor\": \"wide\",\n      \"description\": \"Audio Dark\"\n    },\n    {\n      \"src\": \"./screenshots/audio-light-narrow.webp\",\n      \"sizes\": \"1082x2402\",\n      \"type\": \"image/webp\",\n      \"form_factor\": \"narrow\",\n      \"description\": \"Audio Light\"\n    },\n    {\n      \"src\": \"./screenshots/audio-dark-narrow.webp\",\n      \"sizes\": \"1082x2402\",\n      \"type\": \"image/webp\",\n      \"form_factor\": \"narrow\",\n      \"description\": \"Audio Dark\"\n    }\n  ],\n  \"edge_side_panel\": {}\n}"
  },
  {
    "path": "android/app/src/main/res/values/colors.xml",
    "content": "<!--\n    Copyright 2020 Google Inc. All Rights Reserved.\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n         http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n<resources>\n    <color name=\"shortcut_background\">#F5F5F5</color>\n</resources>\n"
  },
  {
    "path": "android/app/src/main/res/values/strings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n    Copyright 2021 Google Inc. All Rights Reserved.\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n         http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n<resources>\n  \n\n  <!--\n    This variable below expresses the relationship between the app and the site,\n    as documented in the TWA documentation at\n    https://developers.google.com/web/updates/2017/10/using-twa#set_up_digital_asset_links_in_an_android_app\n    and is injected into the AndroidManifest.xml\n  -->\n  <string name=\"assetStatements\">\n    [{\n        \\\"relation\\\": [\\\"delegate_permission/common.handle_all_urls\\\"],\n        \\\"target\\\": {\n            \\\"namespace\\\": \\\"web\\\",\n            \\\"site\\\": \\\"https://nini22p.github.io\\\"\n        }\n    }]\n    \n  </string>  \n</resources>\n"
  },
  {
    "path": "android/app/src/main/res/xml/filepaths.xml",
    "content": "<!--\n    Copyright 2019 Google Inc. All Rights Reserved.\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n         http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n<paths>\n    <files-path path=\"twa_splash/\" name=\"twa_splash\" />\n</paths>\n"
  },
  {
    "path": "android/app/src/main/res/xml/shortcuts.xml",
    "content": "<shortcuts xmlns:android='http://schemas.android.com/apk/res/android' />\n"
  },
  {
    "path": "android/build.gradle",
    "content": "/*\n * Copyright 2019 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n\n    repositories {\n        google()\n        mavenCentral()\n    }\n    dependencies {\n        classpath 'com.android.tools.build:gradle:8.7.2'\n\n        // NOTE: Do not place your application dependencies here; they belong\n        // in the individual module build.gradle files\n    }\n}\n\nallprojects {\n    repositories {\n        google()\n        mavenCentral()\n    }\n}\n\ntasks.register('clean', Delete) {\n    delete rootProject.buildDir\n}\n"
  },
  {
    "path": "android/gradle/wrapper/gradle-wrapper.properties",
    "content": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-8.9-bin.zip\nnetworkTimeout=10000\nvalidateDistributionUrl=true\n"
  },
  {
    "path": "android/gradle.properties",
    "content": "# Project-wide Gradle settings.\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will override*\n# any settings specified in this file.\n# For more details on how to configure your build environment visit\n# http://www.gradle.org/docs/current/userguide/build_environment.html\n# Specifies the JVM arguments used for the daemon process.\n# The setting is particularly useful for tweaking memory settings.\norg.gradle.jvmargs=-Xmx1536m\n# When configured, Gradle will run in incubating parallel mode.\n# This option should only be used with decoupled projects. More details, visit\n# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects\n# org.gradle.parallel=true\nandroid.useAndroidX=true\n"
  },
  {
    "path": "android/gradlew",
    "content": "#!/bin/sh\n\n#\n# Copyright © 2015-2021 the original authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n##############################################################################\n#\n#   Gradle start up script for POSIX generated by Gradle.\n#\n#   Important for running:\n#\n#   (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is\n#       noncompliant, but you have some other compliant shell such as ksh or\n#       bash, then to run this script, type that shell name before the whole\n#       command line, like:\n#\n#           ksh Gradle\n#\n#       Busybox and similar reduced shells will NOT work, because this script\n#       requires all of these POSIX shell features:\n#         * functions;\n#         * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,\n#           «${var#prefix}», «${var%suffix}», and «$( cmd )»;\n#         * compound commands having a testable exit status, especially «case»;\n#         * various built-in commands including «command», «set», and «ulimit».\n#\n#   Important for patching:\n#\n#   (2) This script targets any POSIX shell, so it avoids extensions provided\n#       by Bash, Ksh, etc; in particular arrays are avoided.\n#\n#       The \"traditional\" practice of packing multiple parameters into a\n#       space-separated string is a well documented source of bugs and security\n#       problems, so this is (mostly) avoided, by progressively accumulating\n#       options in \"$@\", and eventually passing that to Java.\n#\n#       Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,\n#       and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;\n#       see the in-line comments for details.\n#\n#       There are tweaks for specific operating systems such as AIX, CygWin,\n#       Darwin, MinGW, and NonStop.\n#\n#   (3) This script is generated from the Groovy template\n#       https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt\n#       within the Gradle project.\n#\n#       You can find Gradle at https://github.com/gradle/gradle/.\n#\n##############################################################################\n\n# Attempt to set APP_HOME\n\n# Resolve links: $0 may be a link\napp_path=$0\n\n# Need this for daisy-chained symlinks.\nwhile\n    APP_HOME=${app_path%\"${app_path##*/}\"}  # leaves a trailing /; empty if no leading path\n    [ -h \"$app_path\" ]\ndo\n    ls=$( ls -ld \"$app_path\" )\n    link=${ls#*' -> '}\n    case $link in             #(\n      /*)   app_path=$link ;; #(\n      *)    app_path=$APP_HOME$link ;;\n    esac\ndone\n\n# This is normally unused\n# shellcheck disable=SC2034\nAPP_BASE_NAME=${0##*/}\n# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)\nAPP_HOME=$( cd \"${APP_HOME:-./}\" > /dev/null && pwd -P ) || exit\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=maximum\n\nwarn () {\n    echo \"$*\"\n} >&2\n\ndie () {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n} >&2\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\nnonstop=false\ncase \"$( uname )\" in                #(\n  CYGWIN* )         cygwin=true  ;; #(\n  Darwin* )         darwin=true  ;; #(\n  MSYS* | MINGW* )  msys=true    ;; #(\n  NONSTOP* )        nonstop=true ;;\nesac\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=$JAVA_HOME/jre/sh/java\n    else\n        JAVACMD=$JAVA_HOME/bin/java\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=java\n    if ! command -v java >/dev/null 2>&1\n    then\n        die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nfi\n\n# Increase the maximum file descriptors if we can.\nif ! \"$cygwin\" && ! \"$darwin\" && ! \"$nonstop\" ; then\n    case $MAX_FD in #(\n      max*)\n        # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.\n        # shellcheck disable=SC2039,SC3045\n        MAX_FD=$( ulimit -H -n ) ||\n            warn \"Could not query maximum file descriptor limit\"\n    esac\n    case $MAX_FD in  #(\n      '' | soft) :;; #(\n      *)\n        # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.\n        # shellcheck disable=SC2039,SC3045\n        ulimit -n \"$MAX_FD\" ||\n            warn \"Could not set maximum file descriptor limit to $MAX_FD\"\n    esac\nfi\n\n# Collect all arguments for the java command, stacking in reverse order:\n#   * args from the command line\n#   * the main class name\n#   * -classpath\n#   * -D...appname settings\n#   * --module-path (only if needed)\n#   * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.\n\n# For Cygwin or MSYS, switch paths to Windows format before running java\nif \"$cygwin\" || \"$msys\" ; then\n    APP_HOME=$( cygpath --path --mixed \"$APP_HOME\" )\n    CLASSPATH=$( cygpath --path --mixed \"$CLASSPATH\" )\n\n    JAVACMD=$( cygpath --unix \"$JAVACMD\" )\n\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    for arg do\n        if\n            case $arg in                                #(\n              -*)   false ;;                            # don't mess with options #(\n              /?*)  t=${arg#/} t=/${t%%/*}              # looks like a POSIX filepath\n                    [ -e \"$t\" ] ;;                      #(\n              *)    false ;;\n            esac\n        then\n            arg=$( cygpath --path --ignore --mixed \"$arg\" )\n        fi\n        # Roll the args list around exactly as many times as the number of\n        # args, so each arg winds up back in the position where it started, but\n        # possibly modified.\n        #\n        # NB: a `for` loop captures its iteration list before it begins, so\n        # changing the positional parameters here affects neither the number of\n        # iterations, nor the values presented in `arg`.\n        shift                   # remove old arg\n        set -- \"$@\" \"$arg\"      # push replacement arg\n    done\nfi\n\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS='\"-Xmx64m\" \"-Xms64m\"'\n\n# Collect all arguments for the java command:\n#   * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,\n#     and any embedded shellness will be escaped.\n#   * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be\n#     treated as '${Hostname}' itself on the command line.\n\nset -- \\\n        \"-Dorg.gradle.appname=$APP_BASE_NAME\" \\\n        -classpath \"$CLASSPATH\" \\\n        org.gradle.wrapper.GradleWrapperMain \\\n        \"$@\"\n\n# Stop when \"xargs\" is not available.\nif ! command -v xargs >/dev/null 2>&1\nthen\n    die \"xargs is not available\"\nfi\n\n# Use \"xargs\" to parse quoted args.\n#\n# With -n1 it outputs one arg per line, with the quotes and backslashes removed.\n#\n# In Bash we could simply go:\n#\n#   readarray ARGS < <( xargs -n1 <<<\"$var\" ) &&\n#   set -- \"${ARGS[@]}\" \"$@\"\n#\n# but POSIX shell has neither arrays nor command substitution, so instead we\n# post-process each arg (as a line of input to sed) to backslash-escape any\n# character that might be a shell metacharacter, then use eval to reverse\n# that process (while maintaining the separation between arguments), and wrap\n# the whole thing up as a single \"set\" statement.\n#\n# This will of course break if any of these variables contains a newline or\n# an unmatched quote.\n#\n\neval \"set -- $(\n        printf '%s\\n' \"$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\" |\n        xargs -n1 |\n        sed ' s~[^-[:alnum:]+,./:=@_]~\\\\&~g; ' |\n        tr '\\n' ' '\n    )\" '\"$@\"'\n\nexec \"$JAVACMD\" \"$@\"\n"
  },
  {
    "path": "android/gradlew.bat",
    "content": "@rem\n@rem Copyright 2015 the original author or authors.\n@rem\n@rem Licensed under the Apache License, Version 2.0 (the \"License\");\n@rem you may not use this file except in compliance with the License.\n@rem You may obtain a copy of the License at\n@rem\n@rem      https://www.apache.org/licenses/LICENSE-2.0\n@rem\n@rem Unless required by applicable law or agreed to in writing, software\n@rem distributed under the License is distributed on an \"AS IS\" BASIS,\n@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n@rem See the License for the specific language governing permissions and\n@rem limitations under the License.\n@rem\n\n@if \"%DEBUG%\"==\"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\"==\"\" set DIRNAME=.\n@rem This is normally unused\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Resolve any \".\" and \"..\" in APP_HOME to make it shorter.\nfor %%i in (\"%APP_HOME%\") do set APP_HOME=%%~fi\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\"-Xmx64m\" \"-Xms64m\"\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif %ERRORLEVEL% equ 0 goto execute\n\necho. 1>&2\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2\necho. 1>&2\necho Please set the JAVA_HOME variable in your environment to match the 1>&2\necho location of your Java installation. 1>&2\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto execute\n\necho. 1>&2\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2\necho. 1>&2\necho Please set the JAVA_HOME variable in your environment to match the 1>&2\necho location of your Java installation. 1>&2\n\ngoto fail\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %*\n\n:end\n@rem End local scope for the variables with windows NT shell\nif %ERRORLEVEL% equ 0 goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nset EXIT_CODE=%ERRORLEVEL%\nif %EXIT_CODE% equ 0 set EXIT_CODE=1\nif not \"\"==\"%GRADLE_EXIT_CONSOLE%\" exit %EXIT_CODE%\nexit /b %EXIT_CODE%\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "android/settings.gradle",
    "content": "include ':app'\n"
  },
  {
    "path": "eslint.config.mjs",
    "content": "import { fixupConfigRules } from '@eslint/compat'\nimport reactRefresh from 'eslint-plugin-react-refresh'\nimport globals from 'globals'\nimport tsParser from '@typescript-eslint/parser'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport js from '@eslint/js'\nimport { FlatCompat } from '@eslint/eslintrc'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\nconst compat = new FlatCompat({\n    baseDirectory: __dirname,\n    recommendedConfig: js.configs.recommended,\n    allConfig: js.configs.all\n})\n\nexport default [...fixupConfigRules(compat.extends(\n    'eslint:recommended',\n    'plugin:@typescript-eslint/recommended',\n    'plugin:react-hooks/recommended',\n)), {\n    plugins: {\n        'react-refresh': reactRefresh,\n    },\n\n    languageOptions: {\n        globals: {\n            ...globals.browser,\n            ...globals.node,\n        },\n\n        parser: tsParser,\n        ecmaVersion: 'latest',\n        sourceType: 'module',\n    },\n\n    rules: {\n        'react-refresh/only-export-components': 'warn',\n        quotes: ['warn', 'single'],\n        semi: ['warn', 'never'],\n    },\n}]"
  },
  {
    "path": "extract_log.py",
    "content": "import sys\n\ndef extract_log(version):\n    try:\n        with open(\"CHANGELOG.md\", \"r\", encoding=\"utf-8\") as file:\n            lines = file.readlines()\n    except FileNotFoundError:\n        print(\"Error: not found CHANGELOG.md\")\n        return\n\n    found = False\n    changelog_lines = []\n\n    for line in lines:\n        if line.startswith(f\"## {version}\"):\n            found = True\n            continue\n        elif line.startswith(\"## \") and found:\n            break\n        if found:\n            changelog_lines.append(line)\n\n    while changelog_lines and not changelog_lines[-1].strip():\n        changelog_lines.pop()\n\n    output = \"\".join(changelog_lines).strip()\n\n    output_file = f\"CHANGELOG_{version}.md\"\n    with open(output_file, \"w\", encoding=\"utf-8\") as file:\n        file.write(output)\n\n    print(f\"Changelog for {version} saved to {output_file}\")\n\nif __name__ == \"__main__\":\n    if len(sys.argv) != 2:\n        print(\"Usage: python extract_log.py <version>\")\n        sys.exit(1)\n\n    version = sys.argv[1]\n    extract_log(version)"
  },
  {
    "path": "generate-version-info.mjs",
    "content": "import { readFile, writeFile } from 'node:fs/promises'\n\nconst filePath = './src/data/info.ts'\n\nconst run = async (isDev) => {\n  const packageString = await readFile('./package.json', { encoding: 'utf-8' })\n  const version = JSON.parse(packageString).version\n\n  const finalVersion = isDev ? `${version}-dev` : version\n\n  const newInfo = `const INFO = {\n  version: '${finalVersion}',\n  dev: ${isDev},\n  buildTime: '${new Date().toISOString()}',\n}\n\nexport default INFO`\n\n  await writeFile(filePath, newInfo, { encoding: 'utf-8' })\n  console.log(`Generate version info to ${filePath}`)\n}\n\nconst isDev = process.argv.includes('--dev')\n\nrun(isDev).catch(err => {\n  console.error('Error updating the file:', err)\n})"
  },
  {
    "path": "lingui.config.js",
    "content": "/** @type {import('@lingui/conf').LinguiConfig} */\nmodule.exports = {\n  locales: ['en', 'zh-CN'],\n  sourceLocale: 'en',\n  catalogs: [\n    {\n      path: '<rootDir>/src/locales/{locale}/messages',\n      include: ['src'],\n    },\n  ],\n  format: 'po',\n}"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"omp\",\n  \"description\": \"OneDrive Media Player\",\n  \"private\": true,\n  \"version\": \"1.9.4\",\n  \"scripts\": {\n    \"build\": \"npm run generate && webpack --mode=production --node-env=production\",\n    \"build:dev\": \"npm run generate:dev && webpack --mode=production --node-env=production\",\n    \"build:android\": \"cd android && gradlew assembleRelease\",\n    \"dev\": \"npm run generate:dev && webpack serve\",\n    \"lint\": \"npm run generate && eslint src --report-unused-disable-directives --max-warnings 0\",\n    \"lint:dev\": \"npm run generate:dev && eslint src --report-unused-disable-directives --max-warnings 0\",\n    \"lingui\": \"lingui extract && lingui compile --typescript\",\n    \"generate\": \"node generate-version-info.mjs && npm run lingui\",\n    \"generate:dev\": \"node generate-version-info.mjs --dev && npm run lingui\"\n  },\n  \"dependencies\": {\n    \"@azure/msal-browser\": \"3.28.1\",\n    \"@azure/msal-react\": \"2.2.0\",\n    \"@emotion/react\": \"11.14.0\",\n    \"@emotion/styled\": \"11.14.0\",\n    \"@fontsource/roboto\": \"5.2.5\",\n    \"@lingui/macro\": \"5.3.2\",\n    \"@lingui/react\": \"5.3.2\",\n    \"@mui/icons-material\": \"7.1.1\",\n    \"@mui/material\": \"7.1.1\",\n    \"@react-spring/web\": \"10.0.1\",\n    \"@use-gesture/react\": \"^10.3.1\",\n    \"buffer\": \"^6.0.3\",\n    \"color\": \"5.0.0\",\n    \"extract-colors\": \"4.2.0\",\n    \"idb-keyval\": \"^6.2.1\",\n    \"music-metadata-browser\": \"^2.5.11\",\n    \"process\": \"^0.11.10\",\n    \"react\": \"^18.3.1\",\n    \"react-dom\": \"^18.3.1\",\n    \"react-router-dom\": \"7.6.1\",\n    \"react-virtualized\": \"9.22.6\",\n    \"short-uuid\": \"^5.2.0\",\n    \"swr\": \"2.3.3\",\n    \"zustand\": \"5.0.5\"\n  },\n  \"devDependencies\": {\n    \"@eslint/compat\": \"1.2.9\",\n    \"@eslint/eslintrc\": \"3.3.1\",\n    \"@eslint/js\": \"9.28.0\",\n    \"@lingui/cli\": \"5.3.2\",\n    \"@lingui/swc-plugin\": \"5.5.2\",\n    \"@pmmmwh/react-refresh-webpack-plugin\": \"0.6.0\",\n    \"@swc/core\": \"^1.11.29\",\n    \"@types/color\": \"4.2.0\",\n    \"@types/extract-colors\": \"^1.1.4\",\n    \"@types/node\": \"22.15.29\",\n    \"@types/react\": \"18.3.12\",\n    \"@types/react-dom\": \"18.3.1\",\n    \"@types/react-virtualized\": \"9.22.2\",\n    \"@typescript-eslint/eslint-plugin\": \"8.33.1\",\n    \"@typescript-eslint/parser\": \"8.33.1\",\n    \"autoprefixer\": \"10.4.21\",\n    \"compression-webpack-plugin\": \"^11.1.0\",\n    \"copy-webpack-plugin\": \"13.0.0\",\n    \"css-loader\": \"^7.1.2\",\n    \"dotenv-webpack\": \"^8.1.0\",\n    \"eslint\": \"9.28.0\",\n    \"eslint-define-config\": \"^2.1.0\",\n    \"eslint-plugin-react-hooks\": \"5.2.0\",\n    \"eslint-plugin-react-refresh\": \"0.4.20\",\n    \"globals\": \"16.2.0\",\n    \"html-webpack-plugin\": \"5.6.3\",\n    \"postcss\": \"8.5.4\",\n    \"postcss-loader\": \"^8.1.1\",\n    \"react-refresh\": \"0.17.0\",\n    \"style-loader\": \"^4.0.0\",\n    \"swc-loader\": \"^0.2.6\",\n    \"typescript\": \"5.8.3\",\n    \"webpack\": \"5.99.9\",\n    \"webpack-cli\": \"6.0.1\",\n    \"webpack-dev-server\": \"5.2.1\",\n    \"webpack-merge\": \"6.0.1\",\n    \"workbox-webpack-plugin\": \"7.3.0\"\n  }\n}\n"
  },
  {
    "path": "postcss.config.js",
    "content": "module.exports = {\n  // Add you postcss configuration here\n  // Learn more about it at https://github.com/webpack-contrib/postcss-loader#config-files\n  plugins: [['autoprefixer']],\n}\n"
  },
  {
    "path": "public/manifest.json",
    "content": "{\n  \"name\": \"OMP\",\n  \"short_name\": \"OMP\",\n  \"start_url\": \".\",\n  \"display\": \"standalone\",\n  \"display_override\": [\n    \"window-controls-overlay\"\n  ],\n  \"description\": \"OneDrive Media Player / OneDrive 媒体播放器\",\n  \"dir\": \"auto\",\n  \"icons\": [\n    {\n      \"src\": \"./favicon.ico\",\n      \"type\": \"image/x-icon\",\n      \"sizes\": \"32x32\"\n    },\n    {\n      \"src\": \"./icon-192.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"192x192\"\n    },\n    {\n      \"src\": \"./icon-512.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"512x512\"\n    },\n    {\n      \"src\": \"./icon-192-maskable.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"192x192\",\n      \"purpose\": \"maskable\"\n    },\n    {\n      \"src\": \"./icon-512-maskable.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"512x512\",\n      \"purpose\": \"maskable\"\n    }\n  ],\n  \"screenshots\": [\n    {\n      \"src\": \"./screenshots/audio-light.webp\",\n      \"sizes\": \"1317x904\",\n      \"type\": \"image/webp\",\n      \"form_factor\": \"wide\",\n      \"description\": \"Audio Light\"\n    },\n    {\n      \"src\": \"./screenshots/audio-dark.webp\",\n      \"sizes\": \"1317x904\",\n      \"type\": \"image/webp\",\n      \"form_factor\": \"wide\",\n      \"description\": \"Audio Dark\"\n    },\n    {\n      \"src\": \"./screenshots/audio-light-narrow.webp\",\n      \"sizes\": \"1082x2402\",\n      \"type\": \"image/webp\",\n      \"form_factor\": \"narrow\",\n      \"description\": \"Audio Light\"\n    },\n    {\n      \"src\": \"./screenshots/audio-dark-narrow.webp\",\n      \"sizes\": \"1082x2402\",\n      \"type\": \"image/webp\",\n      \"form_factor\": \"narrow\",\n      \"description\": \"Audio Dark\"\n    }\n  ],\n  \"edge_side_panel\": {}\n}"
  },
  {
    "path": "src/App.tsx",
    "content": "import { Outlet, useLocation } from 'react-router-dom'\nimport { Container, ThemeProvider, Paper, Box, useMediaQuery } from '@mui/material'\nimport Grid from '@mui/material/Grid'\nimport NavBar from './pages/NavBar'\nimport Player from './pages/Player/Player'\nimport SideBar from './pages/SideBar/SideBar'\nimport MobileSideBar from './pages/SideBar/MobileSideBar'\nimport useUser from './hooks/graph/useUser'\nimport useSync from './hooks/graph/useSync'\nimport useThemeColor from './hooks/ui/useThemeColor'\nimport LogIn from './pages/LogIn'\nimport useUiStore from './store/useUiStore'\nimport { useSpring, animated } from '@react-spring/web'\nimport { useMemo } from 'react'\nimport useCustomTheme from './hooks/ui/useCustomTheme'\nimport Search from './pages/Search'\nimport useStyles from './hooks/ui/useStyles'\n\nconst App = () => {\n  const customTheme = useCustomTheme()\n  const styles = useStyles(customTheme)\n  useThemeColor(customTheme)\n  const windowControlsOverlayOpen = useMediaQuery('(display-mode: window-controls-overlay)')\n\n  const { account } = useUser()\n  useSync()\n\n  const coverColor = useUiStore((state) => state.coverColor)\n\n  const [{ background }, api] = useSpring(\n    () => ({\n      background: `linear-gradient(45deg, ${coverColor}33, ${coverColor}15, ${coverColor}05, ${customTheme.palette.background.default})`,\n    })\n  )\n  useMemo(\n    () => api.start({\n      background: `linear-gradient(45deg, ${coverColor}33, ${coverColor}15, ${coverColor}05, ${customTheme.palette.background.default})`\n    }),\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [coverColor, customTheme.palette.background.default]\n  )\n\n  const location = useLocation()\n  const needLogin = useMemo(\n    () => (['/', '/history'].includes(location.pathname)) && !account,\n    [location, account]\n  )\n\n  return (\n    <ThemeProvider theme={customTheme}>\n      <Box sx={styles.scrollbar}>\n        <animated.div\n          style={{\n            width: '100vw',\n            height: '100dvh',\n            background: background,\n          }}\n        >\n          <NavBar />\n\n          <Container maxWidth=\"xl\" disableGutters={true} sx={{ height: '100%' }}>\n            <MobileSideBar />\n            <Grid container>\n              {/* 侧栏 */}\n              <Grid\n                size={{ xs: 0, sm: 3, lg: 2 }}\n                sx={{\n                  // overflowY: 'auto',\n                  display: { xs: 'none', sm: 'block' },\n                  padding: '0 0 0.5rem 0.5rem',\n                  paddingTop: 'calc(env(titlebar-area-height, 3rem) + 0.5rem)',\n                  height: 'calc(100dvh - 4.5rem - env(titlebar-area-height, 4.5rem))',\n                }}\n              >\n                {\n                  <Box sx={{\n                    height: '2.5rem',\n                    padding: '0.25rem',\n                    display: windowControlsOverlayOpen ? 'none' : 'block',\n                  }}\n                  >\n                    <Search type='bar' />\n                  </Box>\n                }\n                <SideBar />\n              </Grid>\n\n              {/* 主体内容 */}\n              <Grid\n                size={{ xs: 12, sm: 9, lg: 10 }}\n                sx={{\n                  padding: '0 0.5rem 0.5rem 0.5rem',\n                  paddingTop: {\n                    xs: 'calc(env(titlebar-area-height, 3rem) + 0.5rem)',\n                    sm: 'calc(env(titlebar-area-height, 0rem) + 0.5rem)'\n                  },\n                  height: 'calc(100dvh - 4.5rem - env(titlebar-area-height, 2rem))',\n                }}\n              >\n                <Paper\n                  sx={{\n                    width: '100%',\n                    height: '100%',\n                    overflowY: 'auto',\n                    backgroundColor: `${customTheme.palette.background.paper}99`\n                  }}>\n                  {needLogin ? <LogIn /> : <Outlet />}\n                </Paper>\n              </Grid>\n            </Grid>\n          </Container>\n\n          <Player />\n\n        </animated.div>\n      </Box>\n    </ThemeProvider>\n  )\n}\n\nexport default App"
  },
  {
    "path": "src/components/CommonList/CommonList.tsx",
    "content": "import { useState, useEffect, Key, CSSProperties, useRef } from 'react'\nimport Grid from '@mui/material/Grid'\nimport usePlayQueueStore from '../../store/usePlayQueueStore'\nimport usePlayerStore from '../../store/usePlayerStore'\nimport useUiStore from '../../store/useUiStore'\nimport { shufflePlayQueue } from '../../utils'\nimport CommonMenu from './CommonMenu'\nimport { FileItem } from '../../types/file'\nimport CommonListItem from './CommonListItem'\nimport { Box, Fab, List, useMediaQuery, useTheme } from '@mui/material'\nimport { AutoSizer, List as VirtualList } from 'react-virtualized'\nimport CommonListItemCard from './CommonListItemCard'\nimport ShuffleRoundedIcon from '@mui/icons-material/ShuffleRounded'\nimport PlayArrowRoundedIcon from '@mui/icons-material/PlayArrowRounded'\nimport MoreVertRoundedIcon from '@mui/icons-material/MoreVertRounded'\nimport { t } from '@lingui/macro'\nimport { useShallow } from 'zustand/shallow'\n\nconst CommonList = (\n  {\n    listData,\n    listType,\n    display = 'list',\n    scrollIndex,\n    activeIndex,\n    disableFAB,\n    func,\n  }: {\n    listData: FileItem[],\n    listType: 'files' | 'playlist' | 'playQueue',\n    display?: 'list' | 'multicolumnList' | 'grid',\n    scrollIndex?: number,\n    activeIndex?: number,\n    disableFAB?: boolean,\n    func?: {\n      open?: (index: number) => void,\n      remove?: (indexArray: number[]) => void,\n    },\n  }) => {\n\n  const [shuffle, updateShuffle] = useUiStore(useShallow((state) => [state.shuffle, state.updateShuffle]))\n\n  const updatePlayQueue = usePlayQueueStore.use.updatePlayQueue()\n  const updateCurrentIndex = usePlayQueueStore.use.updateCurrentIndex()\n\n  const updateAutoPlay = usePlayerStore((state) => state.updateAutoPlay)\n\n  const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null)\n  const [menuOpen, setMenuOpen] = useState(false)\n  const [dialogOpen, setDialogOpen] = useState(false)\n  const [selectIndex, setSelectIndex] = useState<number | null>(null)\n  const [selectIndexArray, setSelectIndexArray] = useState<number[]>([])\n\n  const isSelectMode = selectIndexArray.length > 0\n  const shuffleDisplay = listData.filter(item => item.fileType === 'audio' || item.fileType === 'video').length > 0\n  const playAllDisplay = shuffleDisplay || listData.filter(item => item.fileType === 'folder' && /^(disc|disk)\\s*\\d+$/.test(item.fileName.toLocaleLowerCase())).length > 0\n\n  const addSelectIndex = (index: number) => { setSelectIndexArray([...selectIndexArray, index].sort()) }\n\n  const removeSelectIndex = (index: number) => setSelectIndexArray(selectIndexArray.filter((_index) => index !== _index).sort())\n\n  const isSelected = (index: number) => selectIndexArray.includes(index)\n\n  useEffect(() => setSelectIndexArray([]), [listData]) //列表数据变化时退出选择模式\n\n  const switchSelect = (index: number) => isSelected(index) ? removeSelectIndex(index) : addSelectIndex(index)\n\n  const handleClickItem = (index: number) => {\n    if (func?.open)\n      func.open(index)\n  }\n\n  const handleClickPlayAll = () => {\n    handleClickItem(listData.findIndex(item => item.fileType === 'audio' || item.fileType === 'video'))\n  }\n\n  // 点击随机播放全部\n  const handleClickShuffleAll = () => {\n    if (listData) {\n      const list = listData\n        .filter((item) => item.fileType === 'audio' || item.fileType === 'video')\n        .map((item, index) => { return { index, ...item } })\n      if (!shuffle)\n        updateShuffle(true)\n      const shuffleList = shufflePlayQueue(list) || []\n      updatePlayQueue(shuffleList)\n      updateCurrentIndex(shuffleList[0].index)\n      updateAutoPlay(true)\n    }\n  }\n\n  const openMenu = (event: React.MouseEvent<HTMLElement>) => {\n    setMenuOpen(true)\n    setAnchorEl(event.currentTarget)\n  }\n\n  const handleClickMenu = (event: React.MouseEvent<HTMLElement>, selectIndex: number) => {\n    setSelectIndex(selectIndex)\n    openMenu(event)\n  }\n\n  const handleClickFABMenu = (event: React.MouseEvent<HTMLElement>) => {\n    openMenu(event)\n  }\n\n  const theme = useTheme()\n  const xs = useMediaQuery(theme.breakpoints.up('xs'))\n  const sm = useMediaQuery(theme.breakpoints.up('sm'))\n  const md = useMediaQuery(theme.breakpoints.up('md'))\n  const lg = useMediaQuery(theme.breakpoints.up('lg'))\n  const xl = useMediaQuery(theme.breakpoints.up('xl'))\n\n  const getGridCols = (): number => {\n    if (xl) return 6\n    if (lg) return 5\n    if (md) return 4\n    if (sm) return 3\n    if (xs) return 2\n    return 2\n  }\n\n  const getListCols = (): number => {\n    if (xl) return 3\n    if (lg) return 3\n    if (md) return 2\n    if (sm) return 1\n    if (xs) return 1\n    return 1\n  }\n\n  const gridCols = getGridCols()\n  const listCols = (display === 'multicolumnList') ? getListCols() : 1\n\n  const gridRenderer = ({ key, index, style }: { key: Key, index: number, style: CSSProperties }) => {\n    return (\n      listData\n      &&\n      <Grid container key={key} style={style}>\n        {\n          [...Array(gridCols)].map((_, i) => {\n            const itemIndex = index * gridCols + i\n            const item = listData[itemIndex]\n            return (\n              item\n              &&\n              <Grid\n                key={item.fileName}\n                size={{ xs: 12 / gridCols }}\n                sx={{ aspectRatio: '4/5', overflow: 'hidden' }}\n              >\n                <CommonListItemCard\n                  active={typeof activeIndex === 'number' ? activeIndex === itemIndex : false}\n                  item={item}\n                  index={itemIndex}\n                  selected={isSelected(itemIndex)}\n                  isSelectMode={isSelectMode}\n                  handleClickItem={isSelectMode ? () => switchSelect(itemIndex) : handleClickItem}\n                  handleClickMenu={handleClickMenu}\n                />\n              </Grid>\n            )\n          })\n        }\n      </Grid>\n    )\n  }\n\n  const rowRenderer = ({ key, index, style }: { key: Key, index: number, style: CSSProperties }) => {\n    return (\n      listData\n      &&\n      <Grid container key={key} style={style}>\n        {\n          [...Array(listCols)].map((_, i) => {\n            const itemIndex = index * listCols + i\n            const item = listData[itemIndex]\n            return (\n              item\n              &&\n              <Grid key={item.fileName} size={{ xs: 12 / listCols }}>\n                <CommonListItem\n                  active={typeof activeIndex === 'number' ? activeIndex === itemIndex : false}\n                  item={item}\n                  index={itemIndex}\n                  selected={isSelected(itemIndex)}\n                  isSelectMode={isSelectMode}\n                  handleClickItem={isSelectMode ? () => switchSelect(itemIndex) : handleClickItem}\n                  handleClickMenu={handleClickMenu}\n                />\n              </Grid>\n            )\n          })\n        }\n      </Grid>\n    )\n  }\n\n  const listRef = useRef<VirtualList | null>(null)\n  const updateListRowHeight = () => listRef.current && listRef.current.recomputeRowHeights()\n\n  // 打开播放队列时滚动到当前播放文件\n  useEffect(\n    () => {\n      if (listType === 'playQueue' && listRef.current && typeof scrollIndex === 'number') {\n        setTimeout(() => listRef.current?.scrollToRow(scrollIndex), 100)\n      }\n    },\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    []\n  )\n\n  // 滚动到之前点击过的文件夹\n  useEffect(\n    () => {\n      if (listType === 'files' && listRef.current && typeof scrollIndex === 'number') {\n        let index = scrollIndex\n\n        if (display === 'grid')\n          index = Math.ceil(scrollIndex / gridCols) - 1\n        if ((display === 'list' || display === 'multicolumnList'))\n          index = Math.ceil(scrollIndex / listCols) - 1\n\n        if (index && index >= 0) {\n          listRef.current?.scrollToRow(index)\n        }\n      }\n    },\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [scrollIndex, gridCols, listCols]\n  )\n\n  const scrollRef = useRef<HTMLDivElement | null>(null)\n  const fabRef = useRef<HTMLDivElement | null>(null)\n  const touchStartYRef = useRef(0)\n  useEffect(() => {\n    const scroll = scrollRef.current\n    const fab = fabRef.current\n    if (fab && isSelectMode) {\n      fab.style.transform = 'translateY(0)'\n    } else if (scroll && fab && !isSelectMode) {\n      const onWheel = (e: WheelEvent) => {\n        if (e.deltaY > 0)\n          fab.style.transform = 'translateY(200%)'\n        else\n          fab.style.transform = 'translateY(0)'\n      }\n      const onTouchStart = (e: TouchEvent) => {\n        touchStartYRef.current = (e.touches[0].clientY)\n      }\n      const onTouchMove = (e: TouchEvent) => {\n        if (e.touches[0].clientY > touchStartYRef.current) {\n          fab.style.transform = 'translateY(0)'\n          touchStartYRef.current = (e.touches[0].clientY)\n        }\n        else {\n          fab.style.transform = 'translateY(200%)'\n          touchStartYRef.current = (e.touches[0].clientY)\n        }\n\n      }\n      scroll.addEventListener('wheel', onWheel)\n      scroll.addEventListener('touchstart', onTouchStart)\n      scroll.addEventListener('touchmove', onTouchMove)\n      return () => {\n        scroll.removeEventListener('wheel', onWheel)\n        scroll.removeEventListener('touchstart', onTouchStart)\n        scroll.removeEventListener('touchmove', onTouchMove)\n      }\n    }\n  }, [isSelectMode])\n\n  return (\n    <Box sx={{ height: '100%', width: '100%', position: 'relative', overflow: 'hidden' }} >\n\n      {/* 文件列表 */}\n      <Grid container sx={{ flexDirection: 'column', flexWrap: 'nowrap', height: '100%' }}>\n        <Grid\n          size={12}\n          sx={{\n            flexGrow: 1,\n            overflow: 'hidden',\n          }}\n          ref={scrollRef}\n        >\n\n          {\n            display === 'grid'\n            &&\n            <AutoSizer onResize={() => updateListRowHeight()}>\n              {\n                ({ height, width }) =>\n                  <List>\n                    <VirtualList\n                      ref={(ref => (listRef.current = ref))}\n                      height={height - 8}\n                      width={width - 8}\n                      rowCount={Math.ceil(listData.length / gridCols)}\n                      rowHeight={width / gridCols / 4 * 5}\n                      rowRenderer={gridRenderer}\n                      scrollToAlignment={'center'}\n                      style={{ paddingBottom: isSelectMode ? '6rem' : '0rem' }}\n                    />\n                  </List>\n              }\n            </AutoSizer>\n          }\n          {\n            (display === 'list' || display === 'multicolumnList')\n            &&\n            <AutoSizer onResize={() => updateListRowHeight()}>\n              {\n                ({ height, width }) =>\n                  <List>\n                    <VirtualList\n                      ref={(ref => (listRef.current = ref))}\n                      height={height - 8}\n                      width={width - 8}\n                      rowCount={Math.ceil(listData.length / listCols)}\n                      rowHeight={72}\n                      rowRenderer={rowRenderer}\n                      scrollToAlignment={'center'}\n                      style={{ paddingBottom: isSelectMode ? '6rem' : '0rem' }}\n                    />\n                  </List>\n              }\n            </AutoSizer>\n          }\n        </Grid>\n      </Grid>\n\n      {/* 菜单 */}\n      <CommonMenu\n        listData={listData}\n        listType={listType}\n        anchorEl={anchorEl}\n        menuOpen={menuOpen}\n        dialogOpen={dialogOpen}\n        selectIndex={selectIndex}\n        selectIndexArray={selectIndexArray}\n        setAnchorEl={setAnchorEl}\n        setMenuOpen={setMenuOpen}\n        setDialogOpen={setDialogOpen}\n        setSelectIndex={setSelectIndex}\n        setSelectIndexArray={setSelectIndexArray}\n        handleClickRemove={func?.remove}\n      />\n\n      {/* FAB */}\n      <Box\n        ref={fabRef}\n        sx={{\n          position: 'absolute',\n          bottom: '2rem',\n          right: '2rem',\n          zIndex: 0,\n          display: 'flex',\n          flexDirection: 'row',\n          justifyContent: 'center',\n          alignItems: 'center',\n          gap: '0.5rem',\n          transition: 'all 0.2s ease-out',\n        }}\n      >\n        {\n          isSelectMode &&\n          <Fab size='small' onClick={handleClickFABMenu}>\n            <MoreVertRoundedIcon />\n          </Fab>\n        }\n        {\n          (listType !== 'playQueue') && !isSelectMode && !disableFAB &&\n          <>\n            {\n              shuffleDisplay &&\n              <Fab size='small' onClick={handleClickShuffleAll}>\n                <ShuffleRoundedIcon />\n              </Fab>\n            }\n            {\n              playAllDisplay &&\n              <Fab variant='extended' color='primary' onClick={handleClickPlayAll}>\n                <PlayArrowRoundedIcon />\n                <span style={{ marginLeft: '0.5rem' }}>{t`Play all`}</span>\n              </Fab>\n            }\n          </>\n        }\n\n      </Box>\n\n    </Box>\n  )\n}\n\nexport default CommonList"
  },
  {
    "path": "src/components/CommonList/CommonListItem.tsx",
    "content": "import { FileItem } from '@/types/file'\nimport { sizeConvert } from '@/utils'\nimport InsertDriveFileRoundedIcon from '@mui/icons-material/InsertDriveFileRounded'\nimport InsertPhotoRoundedIcon from '@mui/icons-material/InsertPhotoRounded'\nimport FolderOpenRoundedIcon from '@mui/icons-material/FolderOpenRounded'\nimport MusicNoteRoundedIcon from '@mui/icons-material/MusicNoteRounded'\nimport MovieRoundedIcon from '@mui/icons-material/MovieRounded'\nimport MoreVertRoundedIcon from '@mui/icons-material/MoreVertRounded'\nimport { ListItem, IconButton, ListItemButton, ListItemAvatar, Avatar, ListItemText, ListItemIcon, useTheme } from '@mui/material'\nimport { t } from '@lingui/macro'\n\nconst CommonListItem = ({\n  item,\n  index,\n  active,\n  selected,\n  isSelectMode,\n  handleClickItem,\n  handleClickMenu,\n}: {\n  item: FileItem,\n  index: number,\n  active?: boolean\n  selected?: boolean,\n  isSelectMode?: boolean,\n  handleClickItem: (index: number) => void,\n  handleClickMenu: (event: React.MouseEvent<HTMLElement>, index: number) => void,\n}) => {\n\n  const theme = useTheme()\n\n  return (\n    <ListItem\n      disablePadding\n      secondaryAction={\n        (item.fileType === 'audio' || item.fileType === 'video') && !isSelectMode &&\n        <div>\n          <IconButton\n            aria-label={t`More`}\n            onClick={(event) => {\n              event.stopPropagation()\n              handleClickMenu(event, index)\n            }}\n          >\n            <MoreVertRoundedIcon />\n          </IconButton>\n        </div>\n      }\n    >\n      <ListItemButton\n        onClick={() => handleClickItem(index)}\n        className={active ? 'active' : ''}\n        sx={{\n          outline: selected ? `3px solid ${theme.palette.primary.main}55` : '',\n          outlineOffset: '-5px'\n        }}\n      >\n        <ListItemAvatar sx={{ position: 'relative' }}>\n          <ListItemIcon sx={{ paddingLeft: 1 }}>\n            {item.fileType === 'folder' && <FolderOpenRoundedIcon />}\n            {item.fileType === 'audio' && <MusicNoteRoundedIcon />}\n            {item.fileType === 'video' && <MovieRoundedIcon />}\n            {item.fileType === 'picture' && <InsertPhotoRoundedIcon />}\n            {item.fileType === 'other' && <InsertDriveFileRoundedIcon />}\n          </ListItemIcon>\n          {\n            (item.thumbnails && item.thumbnails[0])\n            &&\n            <Avatar\n              variant=\"square\"\n              alt={item.fileName}\n              src={item.thumbnails[0].small.url}\n              imgProps={{ loading: 'lazy' }}\n              sx={{\n                position: 'absolute',\n                left: 0,\n                top: -6,\n                borderRadius: '0.5rem',\n              }}\n              onError={({ currentTarget }) => {\n                currentTarget.onerror = null\n                currentTarget.style.display = 'none'\n              }}\n            />\n          }\n        </ListItemAvatar>\n\n        <ListItemText\n          primary={item.fileName}\n          secondary={\n            `${sizeConvert(item.fileSize)}\n            ${item.lastModifiedDateTime\n              ? ` • ${new Date(item.lastModifiedDateTime).toLocaleString(undefined, {\n                year: 'numeric',\n                month: 'long',\n                day: 'numeric',\n                hour: 'numeric',\n                minute: 'numeric',\n              })}`\n              : ''}`\n          }\n        />\n      </ListItemButton>\n    </ListItem>\n  )\n}\n\nexport default CommonListItem"
  },
  {
    "path": "src/components/CommonList/CommonListItemCard.tsx",
    "content": "import { IconButton, ListItemButton, useTheme } from '@mui/material'\nimport { FileItem } from '@/types/file'\nimport InsertDriveFileRoundedIcon from '@mui/icons-material/InsertDriveFileRounded'\nimport InsertPhotoRoundedIcon from '@mui/icons-material/InsertPhotoRounded'\nimport FolderOpenRoundedIcon from '@mui/icons-material/FolderOpenRounded'\nimport MusicNoteRoundedIcon from '@mui/icons-material/MusicNoteRounded'\nimport MovieRoundedIcon from '@mui/icons-material/MovieRounded'\nimport MoreVertRoundedIcon from '@mui/icons-material/MoreVertRounded'\nimport Grid from '@mui/material/Grid'\nimport useUtils from '@/hooks/useUtils'\nimport { sizeConvert } from '@/utils'\nimport { t } from '@lingui/macro'\n\nconst CommonListItemCard = ({\n  item,\n  index,\n  active,\n  selected,\n  isSelectMode,\n  handleClickItem,\n  handleClickMenu,\n}: {\n  item: FileItem,\n  index: number,\n  active?: boolean,\n  selected?: boolean,\n  isSelectMode?: boolean,\n  handleClickItem: (index: number) => void,\n  handleClickMenu: (event: React.MouseEvent<HTMLElement>, index: number) => void,\n}) => {\n\n  const theme = useTheme()\n  const { getThumbnailUrl } = useUtils()\n\n  const thumbnailUrl = getThumbnailUrl(item)\n\n  return (\n    <ListItemButton\n      className={active ? 'active' : ''}\n      sx={{\n        width: '100%',\n        height: '100%',\n        padding: '0.5rem',\n        outline: selected ? `3px solid ${theme.palette.primary.main}55` : '',\n        outlineOffset: '-5px'\n      }}\n      onClick={() => handleClickItem(index)}\n    >\n      <Grid container sx={{ flexDirection: 'column', flexWrap: 'nowrap', width: '100%', height: '100%', gap: '0.25rem' }}>\n        <Grid size={12} sx={{ overflow: 'hidden', width: '100%', flexGrow: 1, borderRadius: '0.5rem', position: 'relative', border: `2px solid ${theme.palette.divider}` }}>\n          <Grid container sx={{ justifyContent: 'center', alignItems: 'center', height: '100%', width: '100%' }}>\n            {item.fileType === 'folder' && <FolderOpenRoundedIcon sx={{ width: '50%', height: '50%' }} />}\n            {item.fileType === 'audio' && <MusicNoteRoundedIcon sx={{ width: '50%', height: '50%' }} />}\n            {item.fileType === 'video' && <MovieRoundedIcon sx={{ width: '50%', height: '50%' }} />}\n            {item.fileType === 'picture' && <InsertPhotoRoundedIcon sx={{ width: '50%', height: '50%' }} />}\n            {item.fileType === 'other' && <InsertDriveFileRoundedIcon sx={{ width: '50%', height: '50%' }} />}\n          </Grid>\n          {\n            thumbnailUrl\n            &&\n            <img\n              src={thumbnailUrl}\n              onError={({ currentTarget }) => {\n                currentTarget.onerror = null\n                currentTarget.style.display = 'none'\n              }}\n              alt={item.fileName}\n              style={{ position: 'absolute', left: 0, top: 0, right: 0, bottom: 0, width: '100%', height: '100%', objectFit: 'cover', }}\n            />\n          }\n        </Grid>\n        <Grid container size={12} sx={{ width: '100%', justifyContent: 'space-between', alignItems: 'center', gap: '0.5rem' }}>\n          <Grid container sx={{ justifyContent: 'center', alignItems: 'center', width: '24px', height: '24px' }} >\n            {item.fileType === 'folder' && <FolderOpenRoundedIcon />}\n            {item.fileType === 'audio' && <MusicNoteRoundedIcon />}\n            {item.fileType === 'video' && <MovieRoundedIcon />}\n            {item.fileType === 'picture' && <InsertPhotoRoundedIcon />}\n            {item.fileType === 'other' && <InsertDriveFileRoundedIcon />}\n          </Grid>\n          <Grid container size='grow' sx={{ justifyContent: 'center', alignItems: 'center' }} >\n            <span style={{ display: 'block', width: '100%', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis', fontSize: 'smaller', lineHeight: '1.5' }}>{item.fileName}</span>\n            <span style={{ display: 'block', width: '100%', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis', fontSize: 'x-small', fontWeight: 'lighter' }}>{sizeConvert(item.fileSize)}</span>\n          </Grid>\n          <Grid size='auto'>\n            {\n              (item.fileType === 'audio' || item.fileType === 'video') && !isSelectMode &&\n              <IconButton\n                aria-label={t`More`}\n                size='small'\n                sx={{ padding: 0 }}\n                onMouseDown={(event) => event.stopPropagation()}\n                onTouchStart={(event) => event.stopPropagation()}\n                onKeyDown={(event) => event.stopPropagation()}\n                onClick={(event) => {\n                  event.stopPropagation()\n                  handleClickMenu(event, index)\n                }}\n              >\n                <MoreVertRoundedIcon />\n              </IconButton>\n            }\n          </Grid>\n        </Grid>\n      </Grid>\n\n    </ListItemButton>\n  )\n}\n\nexport default CommonListItemCard"
  },
  {
    "path": "src/components/CommonList/CommonMenu.tsx",
    "content": "import { t } from '@lingui/macro'\nimport { useNavigate } from 'react-router-dom'\nimport shortUUID from 'short-uuid'\nimport { Menu, MenuItem, ListItemText, Button, Dialog, DialogActions, DialogTitle, List, ListItem, ListItemButton, ListItemIcon } from '@mui/material'\nimport PlaylistAddRoundedIcon from '@mui/icons-material/PlaylistAddRounded'\nimport ListRoundedIcon from '@mui/icons-material/ListRounded'\nimport usePlayQueueStore from '../../store/usePlayQueueStore'\nimport usePlaylistsStore from '../../store/usePlaylistsStore'\nimport useUiStore from '../../store/useUiStore'\nimport { FileItem } from '../../types/file'\nimport { useShallow } from 'zustand/shallow'\n\nconst CommonMenu = (\n  {\n    listData,\n    listType,\n    anchorEl,\n    menuOpen,\n    dialogOpen,\n    selectIndex,\n    selectIndexArray,\n    setAnchorEl,\n    setMenuOpen,\n    setDialogOpen,\n    setSelectIndex,\n    setSelectIndexArray,\n    handleClickRemove,\n  }\n    :\n    {\n      listData: FileItem[],\n      listType: 'files' | 'playlist' | 'playQueue',\n      anchorEl: null | HTMLElement,\n      menuOpen: boolean,\n      dialogOpen: boolean,\n      selectIndex: number | null,\n      selectIndexArray: number[],\n      setAnchorEl: (anchorEl: null | HTMLElement) => void,\n      setMenuOpen: (menuOpen: boolean) => void,\n      setDialogOpen: (dialogOpen: boolean) => void,\n      setSelectIndex: (index: number | null) => void\n      setSelectIndexArray: (setSelectIndexArray: number[]) => void,\n      handleClickRemove?: (indexArray: number[]) => void,\n    }\n) => {\n\n  const navigate = useNavigate()\n\n  const [updateFolderTree] = useUiStore(\n    useShallow((state) => [state.updateFolderTree])\n  )\n\n  const playQueue = usePlayQueueStore.use.playQueue()\n  const updatePlayQueue = usePlayQueueStore.use.updatePlayQueue()\n\n  const [playlists, insertPlaylist, insertFilesToPlaylist] = usePlaylistsStore(\n    useShallow((state) => [state.playlists, state.insertPlaylist, state.insertFilesToPlaylist])\n  )\n  const [updateAudioViewIsShow, updateVideoViewIsShow, updatePlayQueueIsShow] = useUiStore(\n    useShallow((state) => [state.updateAudioViewIsShow, state.updateVideoViewIsShow, state.updatePlayQueueIsShow])\n  )\n\n  const handleCloseMenu = () => {\n    setMenuOpen(false)\n    setAnchorEl(null)\n  }\n\n  // 新建播放列表\n  const addNewPlaylist = () => {\n    const id = shortUUID().generate()\n    insertPlaylist({ id, title: t`New playlist`, fileList: [] })\n  }\n\n  // 添加到播放列表\n  const addToPlaylist = (id: string) => {\n    if (typeof selectIndex === 'number') {\n      insertFilesToPlaylist(id, [\n        {\n          fileName: listData[selectIndex].fileName,\n          filePath: listData[selectIndex].filePath,\n          fileSize: listData[selectIndex].fileSize,\n          fileType: listData[selectIndex].fileType,\n        }\n      ])\n      setSelectIndex(null)\n    } else if (selectIndexArray.length > 0) {\n      insertFilesToPlaylist(id,\n        selectIndexArray\n          .filter(index => listData[index].fileType === 'audio' || listData[index].fileType === 'video')\n          .map(index => (\n            {\n              fileName: listData[index].fileName,\n              filePath: listData[index].filePath,\n              fileSize: listData[index].fileSize,\n              fileType: listData[index].fileType,\n            }\n          )))\n      setSelectIndexArray([])\n    }\n    setDialogOpen(false)\n  }\n\n  // 添加到播放队列\n  const handleClickAddToPlayQueue = () => {\n    if (typeof selectIndex === 'number') {\n      if (playQueue) {\n        updatePlayQueue([...playQueue, { ...listData[selectIndex], index: Math.max(...playQueue.map(item => item.index)) + 1 }])\n      } else {\n        updatePlayQueue([{ ...listData[selectIndex], index: 0 }])\n      }\n    } else if (selectIndexArray && selectIndexArray.length > 0) {\n      if (playQueue) {\n        updatePlayQueue([\n          ...playQueue,\n          ...selectIndexArray\n            .filter(index => listData[index].fileType === 'audio' || listData[index].fileType === 'video')\n            .map((index, _index) => ({ ...listData[index], index: Math.max(...playQueue.map(item => item.index)) + _index + 1 }))\n        ])\n      } else {\n        updatePlayQueue(\n          selectIndexArray\n            .filter(index => listData[index].fileType === 'audio' || listData[index].fileType === 'video')\n            .map((index, _index) => ({ ...listData[index], index: _index }))\n        )\n      }\n    }\n    setMenuOpen(false)\n    setSelectIndex(null)\n    setSelectIndexArray([])\n  }\n\n  // 打开所在文件夹\n  const handleClickOpenInFolder = () => {\n    if (typeof selectIndex === 'number') {\n      updateFolderTree(listData[selectIndex].filePath.slice(0, -1))\n      navigate('/')\n      setMenuOpen(false)\n      setSelectIndex(null)\n      updateAudioViewIsShow(false)\n      updateVideoViewIsShow(false)\n      updatePlayQueueIsShow(false)\n    }\n  }\n\n  return (\n    <>\n      <Menu\n        anchorEl={anchorEl}\n        open={menuOpen}\n        onClose={handleCloseMenu}\n      >\n        <MenuItem onClick={() => {\n          setDialogOpen(true)\n          handleCloseMenu()\n        }}>\n          <ListItemText primary={t`Add to playlist`} />\n        </MenuItem>\n        {\n          (listType !== 'playQueue') &&\n          <MenuItem onClick={handleClickAddToPlayQueue}>\n            <ListItemText primary={t`Add to play queue`} />\n          </MenuItem>\n        }\n\n        {  // 在 Files 组件中隐藏\n          handleClickRemove && typeof selectIndex === 'number' &&\n          <MenuItem onClick={handleClickOpenInFolder}>\n            <ListItemText primary={t`Open in folder`} />\n          </MenuItem>\n        }\n\n        {\n          handleClickRemove &&\n          <MenuItem\n            onClick={() => {\n              if (typeof selectIndex === 'number') {\n                handleClickRemove([selectIndex])\n              } else if (selectIndexArray.length > 0) {\n                handleClickRemove(selectIndexArray)\n              }\n              setSelectIndex(null)\n              setSelectIndexArray([])\n              handleCloseMenu()\n            }}\n          >\n            <ListItemText primary={t`Remove`} />\n          </MenuItem>\n        }\n\n        {\n          typeof selectIndex === 'number' && (selectIndexArray.length === 0) &&\n          <MenuItem onClick={() => {\n            if (typeof selectIndex === 'number') {\n              setSelectIndexArray([...selectIndexArray, selectIndex])\n            }\n            handleCloseMenu()\n            setSelectIndex(null)\n          }}>\n            <ListItemText primary={t`Select`} />\n          </MenuItem>\n        }\n\n        {\n          <MenuItem onClick={() => {\n            setSelectIndex(null)\n            setSelectIndexArray(Array.from({ length: listData.length }, (v, i) => i))\n            handleCloseMenu()\n          }}>\n            <ListItemText primary={t`Select all`} />\n          </MenuItem>\n        }\n\n        {\n          (selectIndexArray.length > 0) &&\n          <MenuItem onClick={() => {\n            setSelectIndex(null)\n            setSelectIndexArray([])\n            handleCloseMenu()\n          }}>\n            <ListItemText primary={t`Cancel select`} />\n          </MenuItem>\n        }\n      </Menu>\n\n      <Dialog\n        open={dialogOpen}\n        onClose={() => setDialogOpen(false)}\n        fullWidth\n        maxWidth='xs'\n      >\n        <DialogTitle>{t`Add to playlist`}</DialogTitle>\n        <List>\n          {playlists?.map((item, index) =>\n            <ListItem\n              disablePadding\n              key={index}\n            >\n              <ListItemButton\n                sx={{ pl: 3 }}\n                onClick={() => addToPlaylist(item.id)}\n              >\n                <ListItemIcon>\n                  <ListRoundedIcon />\n                </ListItemIcon>\n                <ListItemText primary={item.title} />\n              </ListItemButton>\n            </ListItem>\n          )}\n          <ListItem disablePadding>\n            <ListItemButton\n              sx={{ pl: 3 }}\n              onClick={addNewPlaylist}\n            >\n              <ListItemIcon>\n                <PlaylistAddRoundedIcon />\n              </ListItemIcon>\n              <ListItemText primary={t`Add playlist`} />\n            </ListItemButton>\n          </ListItem>\n        </List>\n        <DialogActions>\n          <Button onClick={() => setDialogOpen(false)}>{t`Cancel`}</Button>\n        </DialogActions>\n      </Dialog>\n    </>\n\n  )\n}\n\nexport default CommonMenu"
  },
  {
    "path": "src/components/CommonList/ShuffleAll.tsx",
    "content": "import { ListItem, ListItemButton, ListItemIcon, ListItemText } from '@mui/material'\nimport { t } from '@lingui/macro'\nimport ShuffleRoundedIcon from '@mui/icons-material/ShuffleRounded'\n\nconst ShuffleAll = ({ handleClickShuffleAll }: { handleClickShuffleAll: () => void }) => {\n\n  return (\n    <ListItem\n      disablePadding\n      sx={{\n        '& .MuiListItemButton-root': {\n          paddingLeft: 4,\n        },\n        '& .MuiListItemIcon-root': {\n          minWidth: 0,\n          marginRight: 3,\n        },\n      }}\n    >\n      <ListItemButton onClick={handleClickShuffleAll}>\n        <ListItemIcon>\n          <ShuffleRoundedIcon />\n        </ListItemIcon>\n        <ListItemText primary={t`Shuffle all`} />\n      </ListItemButton>\n    </ListItem>\n  )\n}\n\nexport default ShuffleAll"
  },
  {
    "path": "src/components/Lyrics/Lyrics.tsx",
    "content": "import { useMemo, useRef } from 'react'\nimport { useMediaQuery, useTheme } from '@mui/material'\nimport { useSpring, animated } from '@react-spring/web'\nimport { t } from '@lingui/macro'\n\nconst Lyrics = ({ lyrics, currentTime }: { lyrics: string, currentTime: number }) => {\n  const theme = useTheme()\n  const lyricsRef = useRef<HTMLDivElement>(null)\n\n  const isMobile = useMediaQuery('(max-height: 600px) or (max-width: 600px)')\n\n  const xs = useMediaQuery(theme.breakpoints.up('xs'))\n  const sm = useMediaQuery(theme.breakpoints.up('sm'))\n  const md = useMediaQuery(theme.breakpoints.up('md'))\n  const lg = useMediaQuery(theme.breakpoints.up('lg'))\n  const xl = useMediaQuery(theme.breakpoints.up('xl'))\n\n  const lyricLineHeight = xl ? 44 : lg ? 46 : md ? 48 : sm ? 48 : xs ? 48 : 50\n\n  type Lyrics = {\n    time: number,\n    text: string,\n  }[];\n\n  function timeToSeconds(time: string) {\n    const regex = /(\\d{2}):(\\d{2})\\.(\\d{2,3})/\n    const match = time.match(regex)\n\n    if (match) {\n      const minutes = parseInt(match[1], 10)\n      const seconds = parseInt(match[2], 10)\n      let milliseconds = parseInt(match[3], 10)\n\n      if (match[3].length === 2) {\n        milliseconds *= 10\n      }\n\n      const totalSeconds = minutes * 60 + seconds + milliseconds / 1000\n      return totalSeconds\n    } else {\n      return -1\n    }\n  }\n\n  const lyricsList: Lyrics = lyrics\n    .split(/\\r?\\n/)\n    .map(item => (\n      {\n        time: timeToSeconds(item.split(']')[0]),\n        text: item.split(']')[1],\n      }\n    ))\n    .filter(item => item.time !== -1)\n\n  const currentLyricIndex = useMemo(\n    () => {\n      if (currentTime < lyricsList[0].time)\n        return -1\n      if (currentTime > lyricsList[lyricsList.length - 1].time)\n        return lyricsList.length - 1\n      return lyricsList.findIndex(item => item.time > currentTime) - 1\n    },\n    [currentTime, lyricsList]\n  )\n\n  const { scrollY } = useSpring({\n    scrollY: currentLyricIndex >= 0 ? currentLyricIndex * lyricLineHeight : 0,\n    config: { mass: 2, tension: 300, friction: 25 },\n  })\n\n  const isHighlight = (time: number) => lyricsList[currentLyricIndex] && time === lyricsList[currentLyricIndex].time\n\n  return (\n    <div key={'lyrics'} style={{ height: '100%', width: '100%', overflow: 'hidden' }}>\n      {\n        lyricsList.length === 0\n          ?\n          <div\n            style={{\n              height: '100%',\n              width: '100%',\n              display: 'flex',\n              justifyContent: 'center',\n              alignItems: 'center',\n            }}\n          >\n            <span>{t`No lyrics`}</span>\n          </div>\n          :\n          <animated.div\n            ref={lyricsRef}\n            style={{\n              height: '100%',\n              transform: scrollY.to(y => `translateY(-${y}px)`),\n            }}\n          >\n            <div style={{ height: '30%' }} />\n            {\n              lyricsList.map((item) =>\n                <div\n                  key={item.time + item.text}\n                  style={{\n                    display: 'flex',\n                    justifyContent: 'start',\n                    alignItems: 'center',\n                    height: isHighlight(item.time)\n                      ? lyricLineHeight * 1.6\n                      : lyricLineHeight,\n                    paddingLeft: isHighlight(item.time)\n                      ? isMobile ? 0 : '1rem'\n                      : isMobile ? '1rem' : '2rem',\n                  }}\n                >\n                  <p\n                    style={{\n                      fontSize: isHighlight(item.time)\n                        ? isMobile ? '1.5rem' : '1.5rem'\n                        : isMobile ? '1rem' : '1.2rem',\n                      color: isHighlight(item.time)\n                        ? theme.palette.text.primary\n                        : theme.palette.text.secondary,\n                      fontWeight: isHighlight(item.time)\n                        ? 'bold'\n                        : 'normal',\n                      transition: 'font-size 0.3s ease-out, color 0.3s ease, font-weight 0.3s ease',\n                    }}\n                  >\n                    {item.text}\n                  </p>\n                </div>\n              )\n            }\n            <div style={{ height: '100%' }} />\n          </animated.div>\n      }\n    </div>\n  )\n}\n\nexport default Lyrics\n"
  },
  {
    "path": "src/data/licenses.ts",
    "content": "export const licenses = [\n  {\n    'name': '@azure/msal-browser',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/AzureAD/microsoft-authentication-library-for-js',\n  },\n  {\n    'name': '@azure/msal-react',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/AzureAD/microsoft-authentication-library-for-js',\n  },\n  {\n    'name': '@emotion/react',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/emotion-js/emotion#main',\n  },\n  {\n    'name': '@emotion/styled',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/emotion-js/emotion#main',\n    'author': 'n/a'\n  },\n  {\n    'name': '@fontsource/roboto',\n    'licenseType': 'Apache-2.0',\n    'link': 'https://github.com/fontsource/font-files',\n    'author': 'Google Inc.'\n  },\n  {\n    'name': '@lingui',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/lingui/js-lingui',\n    'author': 'Lingui',\n  },\n  {\n    'name': '@mui/icons-material',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/mui/material-ui',\n    'author': 'MUI Team'\n  },\n  {\n    'name': '@mui/material',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/mui/material-ui',\n    'author': 'MUI Team'\n  },\n  {\n    'name': '@react-spring/web',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/pmndrs/react-spring',\n    'author': 'Poimandres'\n  },\n  {\n    'name': '@use-gesture/react',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/pmndrs/use-gesture',\n    'author': 'Poimandres'\n  },\n  {\n    'name': 'buffer',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/feross/buffer',\n    'author': 'Feross Aboukhadijeh feross@feross.org https://feross.org'\n  },\n  {\n    'name': 'color',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/Qix-/color',\n    'author': 'Josh Junon'\n  },\n  {\n    'name': 'extract-colors',\n    'licenseType': 'GPL-3.0',\n    'link': 'https://github.com/Namide/extract-colors',\n    'author': 'damien@doussaud.fr'\n  },\n  {\n    'name': 'idb-keyval',\n    'licenseType': 'Apache-2.0',\n    'link': 'https://github.com/jakearchibald/idb-keyval',\n    'author': 'Jake Archibald (https://github.com/jakearchibald)'\n  },\n  {\n    'name': 'music-metadata-browser',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/Borewit/music-metadata-browser',\n    'author': 'Borewit https://github.com/Borewit'\n  },\n  {\n    'name': 'react',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/facebook/react',\n    'author': 'n/a'\n  },\n  {\n    'name': 'react-dom',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/facebook/react',\n    'author': 'n/a'\n  },\n  {\n    'name': 'react-router-dom',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/remix-run/react-router',\n    'author': 'Remix Software <hello@remix.run>'\n  },\n  {\n    'name': 'react-virtualized',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/bvaughn/react-virtualized',\n    'author': 'Brian Vaughn',\n  },\n  {\n    'name': 'short-uuid',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/oculus42/short-uuid',\n    'author': 'Samuel Rouse'\n  },\n  {\n    'name': 'swr',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/vercel/swr',\n    'author': 'Vercel'\n  },\n  {\n    'name': 'zustand',\n    'licenseType': 'MIT',\n    'link': 'https://github.com/pmndrs/zustand',\n    'author': 'Poimandres'\n  }\n]"
  },
  {
    "path": "src/graph/authConfig.ts",
    "content": "/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { LogLevel } from '@azure/msal-browser'\n\n/**\n * Configuration object to be passed to MSAL instance on creation. \n * For a full list of MSAL.js configuration parameters, visit:\n * https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/configuration.md \n */\nexport const msalConfig = {\n  auth: {\n    clientId: process.env.CLIENT_ID as string,\n    authority: process.env.ONEDRIVE_AUTH,\n    redirectUri: process.env.REDIRECT_URI as string,\n  },\n  cache: {\n    cacheLocation: 'localStorage', // This configures where your cache will be stored\n    storeAuthStateInCookie: false, // Set this to \"true\" if you are having issues on IE11 or Edge\n  },\n  system: {\n    loggerOptions: {\n      loggerCallback: (level: unknown, message: string, containsPii: boolean) => {\n        if (containsPii) {\n          return\n        }\n        switch (level) {\n          case LogLevel.Error:\n            console.error(message)\n            return\n          // case LogLevel.Info:\n          //   console.info(message)\n          //   return\n          case LogLevel.Verbose:\n            console.debug(message)\n            return\n          case LogLevel.Warning:\n            console.warn(message)\n            return\n        }\n      }\n    }\n  }\n}\n/**\n * Scopes you add here will be prompted for user consent during sign-in.\n * By default, MSAL.js will add OIDC scopes (openid, profile, email) to any login request.\n * For more information about OIDC scopes, visit: \n * https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent#openid-connect-scopes\n */\nexport const loginRequest = {\n  scopes: ['User.Read', 'Files.Read', 'Files.ReadWrite.AppFolder']\n}\n\n/**\n * Add here the scopes to request when obtaining an access token for MS Graph API. For more information, see:\n * https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/resources-and-scopes.md\n */\nexport const graphConfig = {\n  graphMeEndpoint: process.env.ONEDRIVE_GME + '/v1.0'\n}"
  },
  {
    "path": "src/graph/graph.ts",
    "content": "import { graphConfig } from './authConfig'\n\n/**\n * Attaches a given access token to an MS Graph API call. Returns information about the user\n * @param accessToken \n */\nexport async function callMsGraph(accessToken: string) {\n  const headers = new Headers()\n  const bearer = `Bearer ${accessToken}`\n\n  headers.append('Authorization', bearer)\n\n  const options = {\n    method: 'GET',\n    headers: headers\n  }\n\n  return fetch(graphConfig.graphMeEndpoint, options)\n    .then(response => response.json())\n    .catch(error => console.log(error))\n}\n\n/**\n * 根据文件夹路径获取文件列表\n * @param path \n * @param accessToken \n * @returns \n */\nexport async function getFiles(path: string, accessToken: string) {\n  const headers = new Headers()\n  const bearer = `Bearer ${accessToken}`\n\n  headers.append('Authorization', bearer)\n\n  const options = {\n    method: 'GET',\n    headers: headers\n  }\n\n  return fetch(`${graphConfig.graphMeEndpoint}/me/drive/root:/${encodeURIComponent(path)}:/children?$top=2147483647&expand=thumbnails`, options)\n    .then(response => response.json())\n    .catch(error => console.log(error))\n}\n\n/**\n * 根据文件路径获取文件信息\n * @param path \n * @param accessToken \n * @returns \n */\nexport async function getFile(path: string, accessToken: string) {\n  const headers = new Headers()\n  const bearer = `Bearer ${accessToken}`\n\n  headers.append('Authorization', bearer)\n\n  const options = {\n    method: 'GET',\n    headers: headers\n  }\n\n  return fetch(`${graphConfig.graphMeEndpoint}/me/drive/root:/${encodeURIComponent(path)}`, options)\n    .then(response => response.json())\n    .catch(error => console.log(error))\n}\n\nexport const getAppRootFiles = async (path: string, accessToken: string) => {\n  const headers = new Headers()\n  const bearer = `Bearer ${accessToken}`\n\n  headers.append('Authorization', bearer)\n\n  const options = {\n    method: 'GET',\n    headers: headers\n  }\n\n  return fetch(`${graphConfig.graphMeEndpoint}/me/drive/special/approot/${encodeURIComponent(path)}/children`, options)\n    .then(response => response.json())\n    .catch(error => console.log(error))\n}\n\nexport const uploadAppRootJson = async (fileName: string, fileContent: BodyInit, accessToken: string) => {\n  const headers = new Headers()\n  const bearer = `Bearer ${accessToken}`\n\n  headers.append('Authorization', bearer)\n  headers.append('Content-Type', 'application/json')\n\n  const options = {\n    method: 'put',\n    headers: headers,\n    body: fileContent,\n  }\n\n  return fetch(`${graphConfig.graphMeEndpoint}/me/drive/special/approot:/${fileName}:/content`, options)\n    .then(response => response.json())\n    .catch(error => console.log(error))\n}\n\nexport const search = async (path: string, searchQuery: string, accessToken: string) => {\n  const headers = new Headers()\n  const bearer = `Bearer ${accessToken}`\n\n  headers.append('Authorization', bearer)\n\n  const options = {\n    method: 'GET',\n    headers: headers\n  }\n\n  return fetch(`${graphConfig.graphMeEndpoint}/me/drive/root:/${encodeURIComponent(path)}:/search(q='${searchQuery}')`, options)\n    .then(response => response.json())\n    .catch(error => console.log(error))\n}"
  },
  {
    "path": "src/hooks/graph/useFilesData.ts",
    "content": "import { getAppRootFiles, getFile, getFiles, search, uploadAppRootJson } from '@/graph/graph'\nimport { loginRequest } from '@/graph/authConfig'\nimport { useMsal } from '@azure/msal-react'\nimport { AccountInfo } from '@azure/msal-browser'\n\nconst useFilesData = () => {\n  const { instance } = useMsal()\n\n  /**\n* 获取文件夹数据\n* @param path \n* @returns\n*/\n  const getFilesData = async (account: AccountInfo, path: string) => {\n    await instance.initialize()\n    const acquireToken = await instance.acquireTokenSilent({ ...loginRequest, account: account })\n    const response = await getFiles(path, acquireToken.accessToken)\n    return response.value\n  }\n\n  /**\n   * 获取文件数据\n   * @param filePath \n   * @returns \n   */\n  const getFileData = async (account: AccountInfo, filePath: string) => {\n    await instance.initialize()\n    const acquireToken = await instance.acquireTokenSilent({ ...loginRequest, account: account })\n    const response = await getFile(filePath, acquireToken.accessToken)\n    return response\n  }\n\n  const getAppRootFilesData = async (account: AccountInfo, filePath: string) => {\n    await instance.initialize()\n    const acquireToken = await instance.acquireTokenSilent({ ...loginRequest, account: account })\n    const response = await getAppRootFiles(filePath, acquireToken.accessToken)\n    return response\n  }\n\n  const uploadAppRootJsonData = async (account: AccountInfo, fileName: string, fileContent: BodyInit) => {\n    await instance.initialize()\n    const acquireToken = await instance.acquireTokenSilent({ ...loginRequest, account: account })\n    const response = await uploadAppRootJson(fileName, fileContent, acquireToken.accessToken)\n    return response\n  }\n\n  const getSearchData = async (account: AccountInfo, path: string, searchQuery: string) => {\n    await instance.initialize()\n    const acquireToken = await instance.acquireTokenSilent({ ...loginRequest, account: account })\n    const response = await search(path, searchQuery, acquireToken.accessToken)\n    return response.value\n  }\n\n  return {\n    getFilesData,\n    getFileData,\n    getAppRootFilesData,\n    uploadAppRootJsonData,\n    getSearchData,\n  }\n}\n\nexport default useFilesData\n"
  },
  {
    "path": "src/hooks/graph/useSync.ts",
    "content": "import { useEffect, useMemo } from 'react'\nimport useSWR from 'swr'\nimport usePlaylistsStore from '@/store/usePlaylistsStore'\nimport useHistoryStore from '@/store/useHistoryStore'\nimport useFilesData from './useFilesData'\nimport { FileItem } from '@/types/file'\nimport { Playlist } from '@/types/playlist'\nimport { fetchJson } from '@/utils'\nimport useUser from './useUser'\nimport { useShallow } from 'zustand/shallow'\n\nconst useSync = () => {\n  const { account } = useUser()\n  const [historyList, updateHistoryList] = useHistoryStore(\n    useShallow((state) => [state.historyList, state.updateHistoryList])\n  )\n  const [playlists, updatePlaylists] = usePlaylistsStore(\n    useShallow((state) => [state.playlists, state.updatePlaylists])\n  )\n  const { getAppRootFilesData, uploadAppRootJsonData } = useFilesData()\n\n  // 自动从 OneDrive 获取应用数据\n  const appDatafetcher = async () => {\n    const appRootFiles = await getAppRootFilesData(account, '/')\n    const historyFile = appRootFiles.value.find((item: { name: string }) => item.name === 'history.json')\n    const playlistsFile = appRootFiles.value.find((item: { name: string }) => item.name === 'playlists.json')\n    let history = []\n    let playlists = []\n\n    if (historyFile) {\n      history = await fetchJson(historyFile['@microsoft.graph.downloadUrl'])\n    }\n    if (playlistsFile) {\n      playlists = await fetchJson(playlistsFile['@microsoft.graph.downloadUrl'])\n    }\n    console.log('Get app data')\n    return {\n      history: history.map((item: FileItem) => (\n        {\n          fileName: item.fileName,\n          filePath: item.filePath,\n          fileSize: item.fileSize,\n          fileType: item.fileType,\n        }\n      )),\n      playlists: playlists.map((playlist: Playlist) => (\n        {\n          id: playlist.id,\n          title: playlist.title,\n          fileList: playlist.fileList.map((item: FileItem) => (\n            {\n              fileName: item.fileName,\n              filePath: item.filePath,\n              fileSize: item.fileSize,\n              fileType: item.fileType,\n            }\n          )),\n        }\n      ))\n    }\n  }\n\n  const { data, error, isLoading } = useSWR<{ history: FileItem[], playlists: Playlist[] }>(account ? `${account.username}/fetchAppData` : null, appDatafetcher)\n\n  // 自动更新播放历史\n  useEffect(\n    () => {\n      if (!isLoading && !error && data?.history) {\n        updateHistoryList(data.history)\n      }\n    },\n    [data, error, isLoading, updateHistoryList]\n  )\n\n  // 自动上传播放历史\n  useMemo(\n    () => (historyList !== null) && uploadAppRootJsonData(account, 'history.json', JSON.stringify(historyList)),\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [historyList]\n  )\n\n  // 自动更新播放列表\n  useEffect(\n    () => {\n      if (!isLoading && !error && data?.playlists) {\n        updatePlaylists(data.playlists)\n      }\n    },\n    [data, error, isLoading, updatePlaylists]\n  )\n\n  // 自动上传播放列表\n  useMemo(\n    () => (playlists !== null) && uploadAppRootJsonData(account, 'playlists.json', JSON.stringify(playlists)),\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [playlists]\n  )\n\n}\n\nexport default useSync"
  },
  {
    "path": "src/hooks/graph/useUser.ts",
    "content": "import { useMsal } from '@azure/msal-react'\nimport { loginRequest } from '@/graph/authConfig'\nimport useUiStore from '@/store/useUiStore'\nimport { AccountInfo } from '@azure/msal-browser'\n\nconst useUser = () => {\n  const { instance, accounts } = useMsal()\n  const currentAccount = useUiStore(state => state.currentAccount)\n\n  const account: AccountInfo | null = accounts[currentAccount] || null\n\n  // 登入\n  const login = () => {\n    instance.loginRedirect(loginRequest)\n  }\n  //登出\n  const logout = (account: AccountInfo) => {\n    instance.logoutRedirect({\n      account: account,\n      postLogoutRedirectUri: '/',\n    })\n  }\n\n  return { accounts, account, login, logout }\n}\n\nexport default useUser"
  },
  {
    "path": "src/hooks/player/useMediaSession.ts",
    "content": "import { useCallback, useEffect } from 'react'\nimport usePlayerControl from './usePlayerControl'\nimport usePlayerStore from '@/store/usePlayerStore'\nimport { useShallow } from 'zustand/shallow'\n\nconst useMediaSession = (player: HTMLVideoElement | null) => {\n\n  const [\n    currentMetaData,\n    cover,\n  ] = usePlayerStore(\n    useShallow(\n      (state) => [\n        state.currentMetaData,\n        state.cover,\n      ]\n    )\n  )\n\n  const {\n    seekTo,\n    handleClickPlay,\n    handleClickPause,\n    handleClickNext,\n    handleClickPrev,\n    handleClickSeekforward,\n    handleClickSeekbackward,\n  } = usePlayerControl(player)\n\n  const defaultSkipTime = 10\n  // 更新 MediaSession 播放进度\n  const updatePositionState = useCallback(\n    () => {\n      if ('setPositionState' in navigator.mediaSession && player && !isNaN(player.duration)) {\n        console.log('Update MediaSession Position State')\n        navigator.mediaSession.setPositionState({\n          duration: player.duration,\n          playbackRate: player.playbackRate,\n          position: player.currentTime,\n        })\n      }\n    },\n    [player]\n  )\n\n  useEffect(\n    () => {\n      if (player)\n        player.onplaying = () => {\n          updatePositionState()\n        }\n    },\n    [player, updatePositionState]\n  )\n\n  // 设置 MediaSession\n  useEffect(\n    () => {\n      if ('mediaSession' in navigator && currentMetaData) {\n        console.log('Set MediaSession')\n        navigator.mediaSession.metadata = new MediaMetadata({\n          title: currentMetaData?.title,\n          artist: currentMetaData?.artist,\n          album: currentMetaData?.album,\n          artwork: [{ src: cover }]\n        })\n        navigator.mediaSession.setActionHandler('play', () => handleClickPlay())\n        navigator.mediaSession.setActionHandler('pause', () => handleClickPause())\n        navigator.mediaSession.setActionHandler('nexttrack', () => handleClickNext())\n        navigator.mediaSession.setActionHandler('previoustrack', () => handleClickPrev())\n        navigator.mediaSession.setActionHandler('seekbackward', (details) => {\n          const skipTime = details.seekOffset || defaultSkipTime\n          handleClickSeekbackward(skipTime)\n        })\n        navigator.mediaSession.setActionHandler('seekforward', (details) => {\n          const skipTime = details.seekOffset || defaultSkipTime\n          handleClickSeekforward(skipTime)\n        })\n        navigator.mediaSession.setActionHandler('seekto', (details) => {\n          if (details.seekTime) {\n            seekTo(details.seekTime)\n          }\n        })\n        return () => {\n          navigator.mediaSession.metadata = null\n          navigator.mediaSession.setPositionState(undefined)\n          navigator.mediaSession.setActionHandler('play', null)\n          navigator.mediaSession.setActionHandler('pause', null)\n          navigator.mediaSession.setActionHandler('nexttrack', null)\n          navigator.mediaSession.setActionHandler('previoustrack', null)\n          navigator.mediaSession.setActionHandler('seekbackward', null)\n          navigator.mediaSession.setActionHandler('seekforward', null)\n          navigator.mediaSession.setActionHandler('seekto', null)\n        }\n      }\n    },\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [cover, currentMetaData]\n  )\n}\n\nexport default useMediaSession"
  },
  {
    "path": "src/hooks/player/usePlayerControl.ts",
    "content": "import usePlayQueueStore from '@/store/usePlayQueueStore'\nimport usePlayerStore from '@/store/usePlayerStore'\nimport useUiStore from '@/store/useUiStore'\nimport { shufflePlayQueue } from '@/utils'\nimport { useEffect } from 'react'\nimport { useShallow } from 'zustand/shallow'\n\nconst usePlayerControl = (player: HTMLVideoElement | null) => {\n\n  const playQueue = usePlayQueueStore.use.playQueue()\n  const currentIndex = usePlayQueueStore.use.currentIndex()\n  const updateCurrentIndex = usePlayQueueStore.use.updateCurrentIndex()\n  const updatePlayQueue = usePlayQueueStore.use.updatePlayQueue()\n\n  const [\n    updateAutoPlay,\n    updateCurrentTime,\n  ] = usePlayerStore(\n    useShallow(\n      (state) => [\n        state.updateAutoPlay,\n        state.updateCurrentTime,\n      ]\n    )\n  )\n\n  const [\n    shuffle,\n    repeat,\n    volume,\n    playbackRate,\n    updateShuffle,\n    updateRepeat,\n  ] = useUiStore(\n    useShallow(\n      (state) => [\n        state.shuffle,\n        state.repeat,\n        state.volume,\n        state.playbackRate,\n        state.updateShuffle,\n        state.updateRepeat,\n      ]\n    )\n  )\n\n  // 播放开始\n  const handleClickPlay = () => {\n    updateAutoPlay(true)\n    player?.play()\n  }\n\n  // 播放暂停\n  const handleClickPause = () => {\n    updateAutoPlay(false)\n    player?.pause()\n  }\n\n  // 下一曲\n  const handleClickNext = () => {\n    if (player && playQueue) {\n      const next = playQueue[(playQueue.findIndex(item => item.index === currentIndex) + 1)]\n      // player.pause()\n      if (next) {\n        updateCurrentIndex(next.index)\n      } else\n        updateCurrentIndex(playQueue[0].index)\n    }\n  }\n\n  // 上一曲\n  const handleClickPrev = () => {\n    if (player && playQueue) {\n      const prev = playQueue[(playQueue.findIndex(item => item.index === currentIndex) - 1)]\n      // player.pause()\n      console.log(prev, playQueue.at(-1))\n      if (prev) {\n        updateCurrentIndex(prev.index)\n      } else\n        updateCurrentIndex(playQueue[playQueue.length - 1].index)\n    }\n  }\n\n  /**\n   * 快进\n   * @param skipTime \n   */\n  const handleClickSeekbackward = (skipTime: number) => {\n    if (player && !isNaN(player.duration)) {\n      player.currentTime = Math.max(player.currentTime - skipTime, 0)\n    }\n  }\n\n  /**\n   * 快退\n   * @param skipTime \n   */\n  const handleClickSeekforward = (skipTime: number) => {\n    if (player && !isNaN(player.duration)) {\n      player.currentTime = Math.min(player.currentTime + skipTime, player.duration)\n    }\n  }\n\n  /**\n   * 跳到指定位置\n   * @param seekTime \n   */\n  const seekTo = (seekTime: number) => {\n    if (player && !isNaN(player.duration)) {\n      player.currentTime = seekTime\n    }\n  }\n\n  /**\n * 点击进度条\n * @param current \n */\n  const handleTimeRangeonChange = (current: number | number[]) => {\n    if (player && !isNaN(player.duration) && typeof (current) === 'number') {\n      updateCurrentTime(player.duration / 1000 * Number(current))\n      seekTo(player.duration / 1000 * Number(current))\n    }\n  }\n\n  // 随机\n  useEffect(\n    () => {\n      if (shuffle && playQueue) {\n        const randomPlayQueue = shufflePlayQueue(playQueue, currentIndex)\n        updatePlayQueue(randomPlayQueue)\n      } else if (!shuffle && playQueue) {\n        updatePlayQueue([...playQueue].sort((a, b) => a.index - b.index))\n      }\n    },\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [shuffle]\n  )\n\n  const handleClickShuffle = () => updateShuffle(!shuffle)\n\n  // 重复\n  const handleClickRepeat = () => {\n    if (repeat === 'off')\n      updateRepeat('all')\n    if (repeat === 'all')\n      updateRepeat('one')\n    if (repeat === 'one')\n      updateRepeat('off')\n  }\n\n  useEffect(\n    () => {\n      if (player) {\n        player.volume = (isNaN(volume / 100) || volume < 0 || volume > 100) ? 0.8 : (volume / 100)\n      }\n    },\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [player && player.src, volume]\n  )\n\n  // 播放速度\n  useEffect(\n    () => {\n      if (player) {\n        player.playbackRate = playbackRate\n      }\n    },\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [player && player.src, playbackRate]\n  )\n\n  return {\n    seekTo,\n    handleClickPlay,\n    handleClickPause,\n    handleClickNext,\n    handleClickPrev,\n    handleClickSeekforward,\n    handleClickSeekbackward,\n    handleTimeRangeonChange,\n    handleClickShuffle,\n    handleClickRepeat,\n  }\n\n}\n\nexport default usePlayerControl"
  },
  {
    "path": "src/hooks/player/usePlayerCore.ts",
    "content": "import { useState, useMemo, useEffect } from 'react'\nimport useHistoryStore from '@/store/useHistoryStore'\nimport useLocalMetaDataStore from '@/store/useLocalMetaDataStore'\nimport usePlayQueueStore from '@/store/usePlayQueueStore'\nimport usePlayerStore from '@/store/usePlayerStore'\nimport useUiStore from '@/store/useUiStore'\nimport { checkFileType, getNetMetaData, pathConvert } from '@/utils'\nimport useFilesData from '../graph/useFilesData'\nimport { MetaData } from '@/types/MetaData'\nimport useUser from '../graph/useUser'\nimport { useShallow } from 'zustand/shallow'\n\nconst usePlayerCore = (player: HTMLVideoElement | null) => {\n\n  const { account } = useUser()\n\n  const { getFileData } = useFilesData()\n\n  const [\n    currentMetaData,\n    metadataUpdate,\n    autoPlay,\n    isLoading,\n    updateCurrentMetaData,\n    updateMetadataUpdate,\n    updateAutoPlay,\n    updateIsLoading,\n    updateCover,\n    updateCurrentTime,\n    updateDuration,\n  ] = usePlayerStore(\n    useShallow(\n      (state) => [\n        state.currentMetaData,\n        state.metadataUpdate,\n        state.autoPlay,\n        state.isLoading,\n        state.updateCurrentMetaData,\n        state.updateMetadataUpdate,\n        state.updateAutoPlay,\n        state.updateIsLoading,\n        state.updateCover,\n        state.updateCurrentTime,\n        state.updateDuration,\n      ]\n    )\n  )\n\n  const { getLocalMetaData, setLocalMetaData } = useLocalMetaDataStore()\n\n  const playQueue = usePlayQueueStore.use.playQueue()\n  const currentIndex = usePlayQueueStore.use.currentIndex()\n  const updateCurrentIndex = usePlayQueueStore.use.updateCurrentIndex()\n\n\n  const repeat = useUiStore((state) => state.repeat)\n  const [historyList, insertHistory] = useHistoryStore(\n    useShallow((state) => [state.historyList, state.insertHistory])\n  )\n\n  const [url, setUrl] = useState('')\n\n  const currentFile = playQueue?.filter(item => item.index === currentIndex)[0]\n  const fileType = currentFile && checkFileType(currentFile.fileName)\n\n  // 获取当前播放文件链接\n  useMemo(\n    () => {\n      if (player) {\n        player.src = ''\n      }\n      if (playQueue !== null && playQueue.length !== 0 && currentFile) {\n        updateIsLoading(true)\n        try {\n          getFileData(account, pathConvert(currentFile.filePath)).then((res) => {\n            setUrl(res['@microsoft.graph.downloadUrl'])\n          })\n        } catch (error) {\n          console.error(error)\n          updateAutoPlay(false)\n          updateIsLoading(false)\n          player?.pause()\n        }\n      }\n      return true\n    },\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [currentFile?.filePath]\n  )\n\n  useMemo(\n    () => {\n      if (player !== null && playQueue) {\n        updateDuration(0)\n        player.load()\n        player.onloadedmetadata = () => {\n          if (isLoading && autoPlay) {\n            player.play()\n            if (historyList && currentFile) {\n              insertHistory({\n                fileName: currentFile.fileName,\n                filePath: currentFile.filePath,\n                fileSize: currentFile.fileSize,\n                fileType: currentFile.fileType,\n              })\n            }\n          }\n          updateIsLoading(false)\n          updateDuration(player.duration)\n        }\n      }\n      return true\n    },\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [url]\n  )\n\n  // 设置当前播放进度\n  useEffect(\n    () => {\n      if (player)\n        player.ontimeupdate = () => {\n          updateCurrentTime(player.currentTime)\n        }\n    },\n    [player, updateCurrentTime]\n  )\n\n  // 播放结束时\n  const onEnded = () => {\n    if (playQueue) {\n      const next = playQueue[playQueue.findIndex(item => item.index === currentIndex) + 1]\n      const isPlayQueueEnd = currentIndex + 1 === playQueue?.length\n      if (repeat === 'one') {\n        player?.play()\n      } else if (repeat === 'off' || repeat === 'all') {\n        if (isPlayQueueEnd || !next) {\n          if (repeat === 'off') {\n            player?.pause()\n            updateAutoPlay(false)\n          }\n          updateCurrentIndex(playQueue[0].index)\n        } else\n          updateCurrentIndex(next.index)\n      }\n    }\n  }\n\n  // 更新当前 metadata\n  useEffect(\n    () => {\n      const updateMetaData = async () => {\n        if (playQueue && currentFile) {\n          const metaData: MetaData = await getLocalMetaData(currentFile.filePath)\n\n          if (!metaData) {\n            updateCover('./cover.svg')\n            updateCurrentMetaData(\n              {\n                title: currentFile.fileName || 'Not playing',\n                artist: '',\n                path: currentFile.filePath,\n              }\n            )\n          } else if (\n            fileType === 'audio'\n            &&\n            metaData\n            &&\n            metaData.path\n            &&\n            pathConvert(metaData.path) === pathConvert(currentFile.filePath)\n          ) {\n            console.log('Update current metaData: ', metaData)\n            updateCurrentMetaData(metaData)\n            if (metaData.cover?.length) {\n              const cover = metaData.cover[0]\n              if (cover && 'data' in cover.data && Array.isArray(cover.data.data)) {\n                updateCover(URL.createObjectURL(new Blob([new Uint8Array(cover.data.data as unknown as ArrayBufferLike)], { type: cover.format })))\n              } else if (cover) {\n                updateCover(URL.createObjectURL(new Blob([new Uint8Array(cover.data as ArrayBufferLike)], { type: cover.format })))\n              }\n            } else {\n              updateCover('./cover.svg')\n            }\n          }\n        }\n      }\n\n      updateMetaData()\n    },\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [currentFile?.filePath, metadataUpdate]\n  )\n\n  // 获取在线 metadata\n  useEffect(\n    () => {\n      const run = async () => {\n\n        if (playQueue && fileType === 'audio' && currentMetaData?.path) {\n          const localMetaData = await getLocalMetaData(currentMetaData?.path)\n\n          if (!localMetaData) {\n            const netMetaData = await getNetMetaData(currentMetaData?.path, url)\n            if (netMetaData) {\n              setLocalMetaData(netMetaData).then(() => updateMetadataUpdate())\n            }\n          }\n        }\n      }\n\n      run()\n    },\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [url]\n  )\n\n  // 设置标题\n  useEffect(\n    () => {\n      if (currentMetaData) {\n        document.title = `${currentMetaData.title}${currentMetaData.artist ? ` - ${currentMetaData.artist}` : ''}`\n      }\n      return () => {\n        document.title = 'OMP'\n      }\n    },\n    [currentMetaData, player?.paused]\n  )\n\n  return {\n    url,\n    onEnded,\n  }\n\n}\n\nexport default usePlayerCore"
  },
  {
    "path": "src/hooks/ui/useControlHide.ts",
    "content": "import { useEffect } from 'react'\nimport useUiStore from '../../store/useUiStore'\nimport { useShallow } from 'zustand/shallow'\n\nconst useControlHide = (type: string) => {\n  const [videoViewIsShow, updateControlIsShow] = useUiStore(\n    useShallow((state) => [state.videoViewIsShow, state.updateControlIsShow])\n  )\n  useEffect(\n    () => {\n      if (type === 'video' && videoViewIsShow) {\n        let timer: string | number | NodeJS.Timeout | undefined\n        const resetTimer = () => {\n          updateControlIsShow(true)\n          clearTimeout(timer)\n          timer = (setTimeout(() => updateControlIsShow(false), 5000))\n        }\n        resetTimer()\n        window.addEventListener('mousemove', resetTimer)\n        window.addEventListener('mousedown', resetTimer)\n        window.addEventListener('keydown', resetTimer)\n        return () => {\n          window.removeEventListener('mousemove', resetTimer)\n          window.removeEventListener('mousedown', resetTimer)\n          window.removeEventListener('keydown', resetTimer)\n          clearTimeout(timer)\n        }\n      } else {\n        updateControlIsShow(true)\n      }\n    },\n    [type, updateControlIsShow, videoViewIsShow]\n  )\n}\n\nexport default useControlHide"
  },
  {
    "path": "src/hooks/ui/useCustomTheme.ts",
    "content": "import usePlayerStore from '@/store/usePlayerStore'\nimport useUiStore from '@/store/useUiStore'\nimport { createTheme, useMediaQuery } from '@mui/material'\nimport { extractColors } from 'extract-colors'\nimport { useEffect, useMemo, useState } from 'react'\nimport Color, { ColorInstance } from 'color'\nimport { useShallow } from 'zustand/shallow'\n\nconst useCustomTheme = () => {\n  const [\n    coverColor,\n    CoverThemeColor,\n    colorMode,\n    updateCoverColor,\n  ] = useUiStore(\n    useShallow(\n      (state) => [\n        state.coverColor,\n        state.CoverThemeColor,\n        state.colorMode,\n        state.updateCoverColor,\n      ]\n    )\n  )\n\n  const cover = usePlayerStore((state) => state.cover)\n\n  useEffect(\n    () => {\n      if (colorMode === 'dark' || colorMode === 'light')\n        document.documentElement.setAttribute('data-theme', colorMode)\n      if (colorMode === 'auto')\n        document.documentElement.removeAttribute('data-theme')\n      return () => {\n        document.documentElement.removeAttribute('data-theme')\n      }\n    },\n    [colorMode]\n  )\n\n  const prefersColorSchemeDark = useMediaQuery('(prefers-color-scheme: dark)')\n  const prefersDarkMode = useMemo(() => colorMode === 'light' ? false : prefersColorSchemeDark || colorMode === 'dark', [colorMode, prefersColorSchemeDark])\n  const [coverColors, setCoverColors] = useState<{ lightMode: string, darkMode: string } | null>(null)\n\n  // 从专辑封面提取颜色\n  useEffect(\n    () => {\n      (async () => {\n        if (cover !== './cover.svg') {\n          const color = (await extractColors(cover))[0]\n          const getLightModeColor = (color:  ColorInstance): ColorInstance => color.isDark() ? color : getLightModeColor(color.lightness(color.lightness() - 1))\n          const lightModeColor = getLightModeColor(Color(color.hex)).hex()\n          const getDarkModeColor = (color: ColorInstance): ColorInstance => color.isLight() ? color : getDarkModeColor(color.lightness(color.lightness() + 1))\n          const darkModeColor = getDarkModeColor(Color(color.hex)).hex()\n          setCoverColors({ lightMode: lightModeColor, darkMode: darkModeColor })\n        }\n      })()\n    },\n    [cover]\n  )\n\n  useEffect(() => {\n    if (coverColors) {\n      updateCoverColor(prefersDarkMode ? coverColors.darkMode : coverColors.lightMode)\n    }\n  }, [coverColors, prefersDarkMode, updateCoverColor])\n\n  const colors = useMemo(() => ({\n    primary: CoverThemeColor ? coverColor : prefersDarkMode ? '#df7ef9' : '#8e24aa',\n  }), [CoverThemeColor, coverColor, prefersDarkMode])\n\n  const customTheme = useMemo(() => createTheme({\n    palette: {\n      mode: prefersDarkMode ? 'dark' : 'light',\n      background: {\n        default: prefersDarkMode ? '#3b3b3b' : '#f7f7f7',\n        paper: prefersDarkMode ? '#121212' : '#ffffff',\n      },\n      primary: {\n        main: colors.primary,\n      },\n      secondary: {\n        main: '#ff3d00',\n      },\n      error: {\n        main: '#ff1744',\n      },\n    },\n    components: {\n      MuiPaper: {\n        styleOverrides: {\n          root: {\n            borderRadius: '0.5rem',\n          },\n        },\n      },\n      MuiDrawer: {\n        styleOverrides: {\n          paper: {\n            top: 'calc(env(titlebar-area-height, 0rem) + 0.25rem)',\n            bottom: '0.25rem',\n            height: 'auto',\n            border: `${prefersDarkMode ? '#f7f7f722' : '#3b3b3b22'} solid 1px`,\n            boxShadow: `0px 5px 5px -3px ${prefersDarkMode ? '#f7f7f733' : '#3b3b3b33'}, 0px 8px 10px 1px ${prefersDarkMode ? '#f7f7f722' : '#3b3b3b22'}, 0px 3px 14px 2px ${prefersDarkMode ? '#f7f7f720' : '#3b3b3b20'}`,\n          },\n          paperAnchorLeft: {\n            left: '0.25rem',\n          },\n          paperAnchorRight: {\n            right: '0.25rem',\n          }\n        },\n      },\n      MuiBackdrop: {\n        styleOverrides: {\n          root: {\n            backgroundColor: 'transparent',\n          },\n        },\n      },\n      MuiButton: {\n        styleOverrides: {\n          root: {\n            borderRadius: '0.5rem',\n          }\n        }\n      },\n      MuiList: {\n        styleOverrides: {\n          root: {\n            padding: '0.25rem',\n            borderRadius: '0.5rem',\n          }\n        }\n      },\n      MuiListItemButton: {\n        styleOverrides: {\n          root: {\n            borderRadius: '0.5rem',\n            paddingLeft: '1rem',\n            paddingRight: '1rem',\n            '&.active': {\n              backgroundColor: prefersDarkMode ? '#f7f7f711' : '#3b3b3b11',\n            },\n            '&.active .MuiListItemIcon-root': {\n              color: colors.primary,\n            },\n            '&.active .MuiListItemText-root': {\n              color: colors.primary,\n            }\n          },\n        },\n      },\n      MuiListItemIcon: {\n        styleOverrides: {\n          root: {\n            minWidth: '0px !important',\n            marginRight: '1rem',\n          },\n        }\n      },\n      MuiListItemText: {\n        styleOverrides: {\n          primary: {\n            whiteSpace: 'nowrap',\n            overflow: 'hidden',\n            textOverflow: 'ellipsis',\n          },\n          secondary: {\n            whiteSpace: 'nowrap',\n            overflow: 'hidden',\n            textOverflow: 'ellipsis',\n            fontWeight: 'lighter',\n          },\n        }\n      },\n      MuiListItemSecondaryAction: {\n        styleOverrides: {\n          root: {\n            right: '0.5rem',\n          }\n        }\n      },\n      MuiDialog: {\n        styleOverrides: {\n          paper: {\n            border: `${prefersDarkMode ? '#f7f7f722' : '#3b3b3b22'} solid 1px`,\n            boxShadow: `5px 5px 10px 0px ${prefersDarkMode ? '#f7f7f722' : '#3b3b3b22'}`,\n          },\n          root: {\n            ' .MuiBackdrop-root': {\n              background: `${prefersDarkMode ? '#121212' : '#ffffff'}33`,\n              backdropFilter: 'blur(0.5px)',\n            },\n          }\n        }\n      },\n      MuiMenuItem: {\n        styleOverrides: {\n          root: {\n            borderRadius: '0.5rem',\n          }\n        }\n      },\n      MuiInputBase: {\n        styleOverrides: {\n          input: {\n            borderRadius: '0.5rem',\n            padding: '0.25rem',\n            ':focus': {\n              borderRadius: '0.5rem',\n              backgroundColor: '#00000000',\n            }\n          },\n        }\n      },\n    },\n  }),\n    [colors.primary, prefersDarkMode]\n  )\n\n  return customTheme\n}\n\nexport default useCustomTheme"
  },
  {
    "path": "src/hooks/ui/useFullscreen.ts",
    "content": "import useUiStore from '@/store/useUiStore'\nimport { useEffect } from 'react'\n\nconst useFullscreen = () => {\n\n  const updateFullscreen = useUiStore(state => state.updateFullscreen)\n\n  // 检测全屏\n  useEffect(() => {\n    const handleFullscreenChange = () => {\n      updateFullscreen(!!document.fullscreenElement)\n    }\n    document.addEventListener('fullscreenchange', handleFullscreenChange)\n    return () => {\n      document.removeEventListener('fullscreenchange', handleFullscreenChange)\n    }\n  })\n\n  const handleClickFullscreen = () => {\n    if (!document.fullscreenElement) {\n      document.documentElement.requestFullscreen()\n    } else if (document.fullscreenElement) {\n      document.exitFullscreen()\n    }\n  }\n\n  useEffect(() => {\n    const handleClickF11 = (e: KeyboardEvent) => {\n      if (e.code === 'F11') {\n        e.preventDefault()\n        handleClickFullscreen()\n      }\n    }\n    document.addEventListener('keydown', handleClickF11)\n    return () => {\n      document.removeEventListener('keydown', handleClickF11)\n    }\n  })\n\n  return { handleClickFullscreen }\n}\n\nexport default useFullscreen"
  },
  {
    "path": "src/hooks/ui/useStyles.ts",
    "content": "import { Theme } from '@mui/material'\nimport { useMemo } from 'react'\n\nconst useStyles = (theme: Theme) => {\n\n  const scrollbar = useMemo(() => ({\n    '& ::-webkit-scrollbar': {\n      width: '12px',\n      height: '12px',\n    },\n    '& ::-webkit-scrollbar-track': {\n      backgroundColor: 'transparent',\n    },\n    '& ::-webkit-scrollbar-thumb': {\n      background: theme.palette.primary.main,\n      borderRadius: '16px',\n      border: '3.5px solid transparent',\n      backgroundClip: 'content-box',\n      visibility: 'hidden',\n    },\n    '& :hover::-webkit-scrollbar-thumb': {\n      visibility: 'visible',\n    },\n  }),\n    [theme.palette.primary.main]\n  )\n\n  return { scrollbar }\n}\n\nexport default useStyles"
  },
  {
    "path": "src/hooks/ui/useThemeColor.ts",
    "content": "import { useEffect } from 'react'\nimport useUiStore from '../../store/useUiStore'\nimport { blendHex } from '@/utils'\nimport { Theme, useMediaQuery } from '@mui/material'\nimport { useShallow } from 'zustand/shallow'\nconst useThemeColor = (theme: Theme) => {\n\n  const [\n    audioViewIsShow,\n    audioViewTheme,\n    videoViewIsShow,\n    coverColor,\n  ] = useUiStore(\n    useShallow(\n      (state) => [\n        state.audioViewIsShow,\n        state.audioViewTheme,\n        state.videoViewIsShow,\n        state.coverColor,\n      ]\n    )\n  )\n\n  const windowControlsOverlayOpen = useMediaQuery('(display-mode: window-controls-overlay)')\n\n  useEffect(\n    () => {\n      const themeColorLight = document.getElementById('themeColorLight') as HTMLMetaElement\n      const themeColorDark = document.getElementById('themeColorDark') as HTMLMetaElement\n\n      if (themeColorLight && themeColorDark) {\n        if (!audioViewIsShow && !videoViewIsShow) {\n          themeColorLight.content = theme.palette.background.default\n          themeColorDark.content = theme.palette.background.default\n        }\n        else if (audioViewIsShow && audioViewTheme === 'classic') {\n          themeColorLight.content = '#1e1e1e'\n          themeColorDark.content = '#1e1e1e'\n        }\n        else if (audioViewIsShow && audioViewTheme === 'modern') {\n          const color = blendHex(`${theme.palette.background.default}`, windowControlsOverlayOpen ? `${coverColor}31` : `${coverColor}33`)\n          themeColorLight.content = color\n          themeColorDark.content = color\n        }\n      }\n    },\n    [audioViewIsShow, audioViewTheme, coverColor, theme.palette.background.default, videoViewIsShow, windowControlsOverlayOpen]\n  )\n\n}\n\nexport default useThemeColor"
  },
  {
    "path": "src/hooks/useDebounce.ts",
    "content": "import { useState, useEffect } from 'react'\n\nexport default function useDebounce<T>(value: T, delay: number): T {\n  const [debouncedValue, setDebouncedValue] = useState(value)\n\n  useEffect(\n    () => {\n      const handler = setTimeout(() => setDebouncedValue(value), delay)\n      return () => clearTimeout(handler)\n    },\n    [value, delay]\n  )\n\n  return debouncedValue\n}"
  },
  {
    "path": "src/hooks/useUtils.ts",
    "content": "import useUiStore from '@/store/useUiStore'\nimport { FileItem } from '@/types/file'\n\nconst useUtils = () => {\n  const hdThumbnails = useUiStore(state => state.hdThumbnails)\n  const getThumbnailUrl = (item: FileItem): string | null => {\n    if (item.thumbnails && item.thumbnails[0])\n      return hdThumbnails ? item.thumbnails[0].large.url : item.thumbnails[0].medium.url\n    return null\n  }\n\n  return { getThumbnailUrl }\n}\nexport default useUtils"
  },
  {
    "path": "src/index.css",
    "content": "* {\n  box-sizing: border-box;\n  padding: 0;\n  margin: 0;\n  /* scrollbar-width: thin; */\n}\n\nhtml {\n  background-color: #f7f7f7;\n}\n\n@media (prefers-color-scheme: dark) {\n  html {\n    background-color: #3b3b3b;\n  }\n}\n\n:root {\n  color-scheme: light dark;\n  font-synthesis: none;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n  -webkit-text-size-adjust: 100%;\n  text-size-adjust: 100%;\n  font-family: Roboto, Helvetica, Arial, sans-serif;\n  --custom-titlebar-height: 32px;\n  --titlebar-height: env(titlebar-area-height, var(--custom-titlebar-height));\n  --titlebar-center-safe-width: calc((50dvw - (100dvw - env(titlebar-area-x) - env(titlebar-area-width))) * 2)\n}\n\n:root[data-theme=\"light\"] {\n  color-scheme: light;\n  background-color: #f7f7f7;\n}\n\n:root[data-theme=\"dark\"] {\n  color-scheme: dark;\n  background-color: #3b3b3b;\n}\n\na {\n  text-decoration: inherit;\n}\n\n.app-region-drag {\n  -webkit-app-region: drag;\n  app-region: drag;\n}\n\n.app-region-no-drag {\n  -webkit-app-region: no-drag;\n  app-region: no-drag;\n}\n\n.pt-titlebar-area-height {\n  padding-top: env(titlebar-area-height, 0) !important;\n}\n\n.show-scrollbar::-webkit-scrollbar-thumb {\n  visibility: visible !important;\n}"
  },
  {
    "path": "src/index.html",
    "content": "<!DOCTYPE html>\n\n<head>\n  <meta charset=\"UTF-8\" />\n  <link rel=\"icon\" href=\"./logo.svg\" sizes=\"any\">\n  <link rel=\"apple-touch-icon\" href=\"./apple-touch-icon.png\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  <link rel=\"manifest\" href=\"./manifest.json\" />\n  <meta id=\"themeColorLight\" name=\"theme-color\" media=\"(prefers-color-scheme: light)\" content=\"#f7f7f7\" />\n  <meta id=\"themeColorDark\" name=\"theme-color\" media=\"(prefers-color-scheme: dark)\" content=\"#3b3b3b\" />\n  <title>OMP</title>\n  <meta name=\"description\" content=\"OneDrive Media Player\" />\n  <meta property=\"og:site_name\" content=\"OMP\" />\n  <meta property=\"og:title\" content=\"OMP\" />\n  <meta property=\"og:description\" content=\"OneDrive Media Player\" />\n  <meta property=\"og:type\" content=\"website\" />\n  <meta property=\"og:image\" content=\"./icon-512.png\" />\n  <meta property=\"og:image:width\" content=\"512\" />\n  <meta property=\"og:image:height\" content=\"512\" />\n  <meta property=\"twitter:card\" content=\"summary\" />\n  <meta property=\"twitter:image\" content=\"./icon-512.png\" />\n</head>\n\n<body>\n  <div id=\"root\"></div>\n</body>\n\n<script>\n  if (\"serviceWorker\" in navigator) {\n    window.addEventListener(\"load\", () => {\n      navigator.serviceWorker\n        .register(\"service-worker.js\")\n        .then((registration) => {\n          console.log(\"Service Worker registered: \", registration);\n        })\n        .catch((registrationError) => {\n          console.error(\"Service Worker registration failed: \", registrationError);\n        });\n    });\n  }\n</script>\n\n</html>"
  },
  {
    "path": "src/locales/en/messages.po",
    "content": "msgid \"\"\nmsgstr \"\"\n\"POT-Creation-Date: 2024-06-01 23:36+0800\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=utf-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"X-Generator: @lingui/cli\\n\"\n\"Language: en\\n\"\n\"Project-Id-Version: \\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"PO-Revision-Date: \\n\"\n\"Last-Translator: \\n\"\n\"Language-Team: \\n\"\n\"Plural-Forms: \\n\"\n\n#: src/pages/Setting.tsx:161\nmsgid \"About\"\nmsgstr \"About\"\n\n#: src/pages/Setting.tsx:95\nmsgid \"Account\"\nmsgstr \"Account\"\n\n#: src/pages/Setting.tsx:225\nmsgid \"Add account\"\nmsgstr \"Add account\"\n\n#: src/pages/SideBar/Playlists.tsx:52\n#: src/pages/Player/PlayerMenu.tsx:358\n#: src/components/CommonList/CommonMenu.tsx:257\nmsgid \"Add playlist\"\nmsgstr \"Add playlist\"\n\n#: src/components/CommonList/CommonMenu.tsx:161\nmsgid \"Add to play queue\"\nmsgstr \"Add to play queue\"\n\n#: src/pages/Player/PlayerMenu.tsx:234\n#: src/pages/Player/PlayerMenu.tsx:332\n#: src/components/CommonList/CommonMenu.tsx:156\n#: src/components/CommonList/CommonMenu.tsx:231\nmsgid \"Add to playlist\"\nmsgstr \"Add to playlist\"\n\n#: src/pages/Files/FilterMenu.tsx:105\nmsgid \"Ascending\"\nmsgstr \"Ascending\"\n\n#: src/pages/Setting.tsx:137\nmsgid \"Auto\"\nmsgstr \"Auto\"\n\n#: src/pages/Setting.tsx:176\nmsgid \"Build time\"\nmsgstr \"Build time\"\n\n#: src/pages/Setting.tsx:230\n#: src/pages/Playlist/Playlist.tsx:217\n#: src/pages/Playlist/Playlist.tsx:240\n#: src/pages/Player/PlayerMenu.tsx:363\n#: src/components/CommonList/CommonMenu.tsx:262\nmsgid \"Cancel\"\nmsgstr \"Cancel\"\n\n#: src/components/CommonList/CommonMenu.tsx:220\nmsgid \"Cancel select\"\nmsgstr \"Cancel select\"\n\n#: src/pages/Player/PlayerMenu.tsx:289\nmsgid \"Classic\"\nmsgstr \"Classic\"\n\n#: src/pages/Setting.tsx:118\nmsgid \"Clear\"\nmsgstr \"Clear\"\n\n#: src/pages/Player/VideoPlayerTopbar.tsx:56\n#: src/pages/Player/Audio/Modern.tsx:151\n#: src/pages/PictureView/PictureView.tsx:72\nmsgid \"Close\"\nmsgstr \"Close\"\n\n#: src/pages/Setting.tsx:144\nmsgid \"Color mode\"\nmsgstr \"Color mode\"\n\n#: src/pages/Search.tsx:183\nmsgid \"Current\"\nmsgstr \"Current\"\n\n#: src/pages/NavBar.tsx:122\nmsgid \"Currently using a development version, please be careful with your data!\"\nmsgstr \"Currently using a development version, please be careful with your data!\"\n\n#: src/pages/Setting.tsx:127\nmsgid \"Customize\"\nmsgstr \"Customize\"\n\n#: src/pages/Setting.tsx:139\nmsgid \"Dark\"\nmsgstr \"Dark\"\n\n#: src/pages/Setting.tsx:114\nmsgid \"Data\"\nmsgstr \"Data\"\n\n#: src/pages/Playlist/Playlist.tsx:191\nmsgid \"Delete\"\nmsgstr \"Delete\"\n\n#: src/pages/Files/FilterMenu.tsx:106\nmsgid \"Descending\"\nmsgstr \"Descending\"\n\n#: src/pages/Playlist/Playlist.tsx:213\nmsgid \"Enter new title\"\nmsgstr \"Enter new title\"\n\n#: src/pages/SideBar/SideBar.tsx:19\nmsgid \"Files\"\nmsgstr \"Files\"\n\n#: src/pages/Files/FilterMenu.tsx:114\nmsgid \"Folders first\"\nmsgstr \"Folders first\"\n\n#: src/pages/Player/PlayerControl.tsx:316\n#: src/pages/Player/Audio/Modern.tsx:201\nmsgid \"Fullscreen\"\nmsgstr \"Fullscreen\"\n\n#: src/pages/Search.tsx:182\nmsgid \"Global\"\nmsgstr \"Global\"\n\n#: src/pages/Files/FilterMenu.tsx:81\nmsgid \"Grid\"\nmsgstr \"Grid\"\n\n#: src/pages/Files/FilterMenu.tsx:118\nmsgid \"HD thumbnails\"\nmsgstr \"HD thumbnails\"\n\n#: src/pages/SideBar/SideBar.tsx:20\nmsgid \"History\"\nmsgstr \"History\"\n\n#: src/pages/Files/FilterMenu.tsx:94\nmsgid \"Last modified\"\nmsgstr \"Last modified\"\n\n#: src/pages/Setting.tsx:138\nmsgid \"Light\"\nmsgstr \"Light\"\n\n#: src/pages/Files/FilterMenu.tsx:79\nmsgid \"List\"\nmsgstr \"List\"\n\n#: src/pages/Setting.tsx:122\nmsgid \"Local metaData cache\"\nmsgstr \"Local metaData cache\"\n\n#: src/pages/Player/Audio/Modern.tsx:184\nmsgid \"Lyrics\"\nmsgstr \"Lyrics\"\n\n#: src/pages/Setting.tsx:98\nmsgid \"Manage\"\nmsgstr \"Manage\"\n\n#: src/pages/Files/FilterMenu.tsx:115\nmsgid \"Media only\"\nmsgstr \"Media only\"\n\n#: src/pages/Player/PlayerMenu.tsx:164\nmsgid \"Menu\"\nmsgstr \"Menu\"\n\n#: src/pages/Player/PlayerMenu.tsx:277\nmsgid \"Modern\"\nmsgstr \"Modern\"\n\n#: src/pages/Playlist/Playlist.tsx:157\n#: src/components/CommonList/CommonListItemCard.tsx:88\n#: src/components/CommonList/CommonListItem.tsx:39\nmsgid \"More\"\nmsgstr \"More\"\n\n#: src/pages/Files/FilterMenu.tsx:80\nmsgid \"Multicolumn list\"\nmsgstr \"Multicolumn list\"\n\n#: src/pages/Files/FilterMenu.tsx:92\nmsgid \"Name\"\nmsgstr \"Name\"\n\n#: src/pages/SideBar/Playlists.tsx:19\n#: src/pages/Player/PlayerMenu.tsx:131\n#: src/components/CommonList/CommonMenu.tsx:71\nmsgid \"New playlist\"\nmsgstr \"New playlist\"\n\n#: src/pages/Player/Audio/Modern.tsx:282\n#: src/components/Lyrics/Lyrics.tsx:87\nmsgid \"No lyrics\"\nmsgstr \"No lyrics\"\n\n#: src/pages/Playlist/Playlist.tsx:224\n#: src/pages/Playlist/Playlist.tsx:241\nmsgid \"OK\"\nmsgstr \"OK\"\n\n#: src/pages/Player/PlayerMenu.tsx:214\n#: src/components/CommonList/CommonMenu.tsx:168\nmsgid \"Open in folder\"\nmsgstr \"Open in folder\"\n\n#: src/pages/Setting.tsx:182\nmsgid \"Open source dependencies\"\nmsgstr \"Open source dependencies\"\n\n#: src/components/CommonList/CommonList.tsx:383\nmsgid \"Play all\"\nmsgstr \"Play all\"\n\n#: src/pages/Player/PlayerMenu.tsx:222\n#: src/pages/Player/PlayerControl.tsx:306\n#: src/pages/Player/Audio/Modern.tsx:169\nmsgid \"Play queue\"\nmsgstr \"Play queue\"\n\n#: src/pages/Player/PlayerMenu.tsx:201\n#: src/pages/Player/PlayerMenu.tsx:302\nmsgid \"Playback rate\"\nmsgstr \"Playback rate\"\n\n#: src/pages/Setting.tsx:107\n#: src/pages/LogIn.tsx:24\nmsgid \"Please use Microsoft account authorization to log in\"\nmsgstr \"Please use Microsoft account authorization to log in\"\n\n#: src/pages/Player/PlayerMenu.tsx:251\nmsgid \"Re-fetch metadata\"\nmsgstr \"Re-fetch metadata\"\n\n#: src/components/CommonList/CommonMenu.tsx:186\nmsgid \"Remove\"\nmsgstr \"Remove\"\n\n#: src/pages/Playlist/Playlist.tsx:185\n#: src/pages/Playlist/Playlist.tsx:203\nmsgid \"Rename\"\nmsgstr \"Rename\"\n\n#: src/pages/Search.tsx:120\n#: src/pages/Search.tsx:143\n#: src/pages/Search.tsx:145\n#: src/pages/Search.tsx:167\nmsgid \"Search\"\nmsgstr \"Search\"\n\n#: src/components/CommonList/CommonMenu.tsx:199\nmsgid \"Select\"\nmsgstr \"Select\"\n\n#: src/pages/Setting.tsx:196\nmsgid \"Select account\"\nmsgstr \"Select account\"\n\n#: src/components/CommonList/CommonMenu.tsx:209\nmsgid \"Select all\"\nmsgstr \"Select all\"\n\n#: src/pages/SideBar/SideBar.tsx:21\nmsgid \"Setting\"\nmsgstr \"Setting\"\n\n#: src/components/CommonList/ShuffleAll.tsx:24\nmsgid \"Shuffle all\"\nmsgstr \"Shuffle all\"\n\n#: src/pages/LogIn.tsx:26\nmsgid \"Sign in\"\nmsgstr \"登录\"\n\n#: src/pages/Setting.tsx:204\nmsgid \"Sign out\"\nmsgstr \"Sign out\"\n\n#: src/pages/Files/FilterMenu.tsx:93\nmsgid \"Size\"\nmsgstr \"Size\"\n\n#: src/pages/Player/PlayerMenu.tsx:242\nmsgid \"Switch fullscreen\"\nmsgstr \"Switch fullscreen\"\n\n#: src/pages/Player/PlayerMenu.tsx:192\n#: src/pages/Player/PlayerMenu.tsx:265\nmsgid \"Switch theme\"\nmsgstr \"Switch theme\"\n\n#: src/pages/Playlist/Playlist.tsx:237\nmsgid \"The playlist will be deleted\"\nmsgstr \"The playlist will be deleted\"\n\n#: src/pages/Setting.tsx:156\nmsgid \"Use album cover theme color\"\nmsgstr \"Use album cover theme color\"\n\n#: src/pages/Setting.tsx:170\nmsgid \"Version\"\nmsgstr \"Version\"\n"
  },
  {
    "path": "src/locales/zh-CN/messages.po",
    "content": "msgid \"\"\nmsgstr \"\"\n\"POT-Creation-Date: 2024-06-01 23:36+0800\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=utf-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"X-Generator: @lingui/cli\\n\"\n\"Language: zh-CN\\n\"\n\"Project-Id-Version: \\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"PO-Revision-Date: \\n\"\n\"Last-Translator: \\n\"\n\"Language-Team: \\n\"\n\"Plural-Forms: \\n\"\n\n#: src/pages/Setting.tsx:161\nmsgid \"About\"\nmsgstr \"关于\"\n\n#: src/pages/Setting.tsx:95\nmsgid \"Account\"\nmsgstr \"账户\"\n\n#: src/pages/Setting.tsx:225\nmsgid \"Add account\"\nmsgstr \"添加账户\"\n\n#: src/pages/SideBar/Playlists.tsx:52\n#: src/pages/Player/PlayerMenu.tsx:358\n#: src/components/CommonList/CommonMenu.tsx:257\nmsgid \"Add playlist\"\nmsgstr \"新建播放列表\"\n\n#: src/components/CommonList/CommonMenu.tsx:161\nmsgid \"Add to play queue\"\nmsgstr \"添加到播放队列\"\n\n#: src/pages/Player/PlayerMenu.tsx:234\n#: src/pages/Player/PlayerMenu.tsx:332\n#: src/components/CommonList/CommonMenu.tsx:156\n#: src/components/CommonList/CommonMenu.tsx:231\nmsgid \"Add to playlist\"\nmsgstr \"添加到播放列表\"\n\n#: src/pages/Files/FilterMenu.tsx:105\nmsgid \"Ascending\"\nmsgstr \"正序\"\n\n#: src/pages/Setting.tsx:137\nmsgid \"Auto\"\nmsgstr \"自动\"\n\n#: src/pages/Setting.tsx:176\nmsgid \"Build time\"\nmsgstr \"编译日期\"\n\n#: src/pages/Setting.tsx:230\n#: src/pages/Playlist/Playlist.tsx:217\n#: src/pages/Playlist/Playlist.tsx:240\n#: src/pages/Player/PlayerMenu.tsx:363\n#: src/components/CommonList/CommonMenu.tsx:262\nmsgid \"Cancel\"\nmsgstr \"取消\"\n\n#: src/components/CommonList/CommonMenu.tsx:220\nmsgid \"Cancel select\"\nmsgstr \"取消选择\"\n\n#: src/pages/Player/PlayerMenu.tsx:289\nmsgid \"Classic\"\nmsgstr \"经典\"\n\n#: src/pages/Setting.tsx:118\nmsgid \"Clear\"\nmsgstr \"清除\"\n\n#: src/pages/Player/VideoPlayerTopbar.tsx:56\n#: src/pages/Player/Audio/Modern.tsx:151\n#: src/pages/PictureView/PictureView.tsx:72\nmsgid \"Close\"\nmsgstr \"关闭\"\n\n#: src/pages/Setting.tsx:144\nmsgid \"Color mode\"\nmsgstr \"颜色模式\"\n\n#: src/pages/Search.tsx:183\nmsgid \"Current\"\nmsgstr \"当前\"\n\n#: src/pages/NavBar.tsx:122\nmsgid \"Currently using a development version, please be careful with your data!\"\nmsgstr \"当前正在使用开发版本，请注意数据安全!\"\n\n#: src/pages/Setting.tsx:127\nmsgid \"Customize\"\nmsgstr \"定制\"\n\n#: src/pages/Setting.tsx:139\nmsgid \"Dark\"\nmsgstr \"深色\"\n\n#: src/pages/Setting.tsx:114\nmsgid \"Data\"\nmsgstr \"数据\"\n\n#: src/pages/Playlist/Playlist.tsx:191\nmsgid \"Delete\"\nmsgstr \"删除\"\n\n#: src/pages/Files/FilterMenu.tsx:106\nmsgid \"Descending\"\nmsgstr \"倒序\"\n\n#: src/pages/Playlist/Playlist.tsx:213\nmsgid \"Enter new title\"\nmsgstr \"输入新标题\"\n\n#: src/pages/SideBar/SideBar.tsx:19\nmsgid \"Files\"\nmsgstr \"文件\"\n\n#: src/pages/Files/FilterMenu.tsx:114\nmsgid \"Folders first\"\nmsgstr \"文件夹优先\"\n\n#: src/pages/Player/PlayerControl.tsx:316\n#: src/pages/Player/Audio/Modern.tsx:201\nmsgid \"Fullscreen\"\nmsgstr \"全屏\"\n\n#: src/pages/Search.tsx:182\nmsgid \"Global\"\nmsgstr \"全局\"\n\n#: src/pages/Files/FilterMenu.tsx:81\nmsgid \"Grid\"\nmsgstr \"网格\"\n\n#: src/pages/Files/FilterMenu.tsx:118\nmsgid \"HD thumbnails\"\nmsgstr \"高清缩略图\"\n\n#: src/pages/SideBar/SideBar.tsx:20\nmsgid \"History\"\nmsgstr \"历史\"\n\n#: src/pages/Files/FilterMenu.tsx:94\nmsgid \"Last modified\"\nmsgstr \"最后修改\"\n\n#: src/pages/Setting.tsx:138\nmsgid \"Light\"\nmsgstr \"浅色\"\n\n#: src/pages/Files/FilterMenu.tsx:79\nmsgid \"List\"\nmsgstr \"列表\"\n\n#: src/pages/Setting.tsx:122\nmsgid \"Local metaData cache\"\nmsgstr \"本地元数据缓存\"\n\n#: src/pages/Player/Audio/Modern.tsx:184\nmsgid \"Lyrics\"\nmsgstr \"歌词\"\n\n#: src/pages/Setting.tsx:98\nmsgid \"Manage\"\nmsgstr \"管理\"\n\n#: src/pages/Files/FilterMenu.tsx:115\nmsgid \"Media only\"\nmsgstr \"仅限媒体\"\n\n#: src/pages/Player/PlayerMenu.tsx:164\nmsgid \"Menu\"\nmsgstr \"菜单\"\n\n#: src/pages/Player/PlayerMenu.tsx:277\nmsgid \"Modern\"\nmsgstr \"现代\"\n\n#: src/pages/Playlist/Playlist.tsx:157\n#: src/components/CommonList/CommonListItemCard.tsx:88\n#: src/components/CommonList/CommonListItem.tsx:39\nmsgid \"More\"\nmsgstr \"更多\"\n\n#: src/pages/Files/FilterMenu.tsx:80\nmsgid \"Multicolumn list\"\nmsgstr \"多列列表\"\n\n#: src/pages/Files/FilterMenu.tsx:92\nmsgid \"Name\"\nmsgstr \"名称\"\n\n#: src/pages/SideBar/Playlists.tsx:19\n#: src/pages/Player/PlayerMenu.tsx:131\n#: src/components/CommonList/CommonMenu.tsx:71\nmsgid \"New playlist\"\nmsgstr \"新播放列表\"\n\n#: src/pages/Player/Audio/Modern.tsx:282\n#: src/components/Lyrics/Lyrics.tsx:87\nmsgid \"No lyrics\"\nmsgstr \"无歌词\"\n\n#: src/pages/Playlist/Playlist.tsx:224\n#: src/pages/Playlist/Playlist.tsx:241\nmsgid \"OK\"\nmsgstr \"确定\"\n\n#: src/pages/Player/PlayerMenu.tsx:214\n#: src/components/CommonList/CommonMenu.tsx:168\nmsgid \"Open in folder\"\nmsgstr \"打开所在文件夹\"\n\n#: src/pages/Setting.tsx:182\nmsgid \"Open source dependencies\"\nmsgstr \"开源库\"\n\n#: src/components/CommonList/CommonList.tsx:383\nmsgid \"Play all\"\nmsgstr \"全部播放\"\n\n#: src/pages/Player/PlayerMenu.tsx:222\n#: src/pages/Player/PlayerControl.tsx:306\n#: src/pages/Player/Audio/Modern.tsx:169\nmsgid \"Play queue\"\nmsgstr \"播放队列\"\n\n#: src/pages/Player/PlayerMenu.tsx:201\n#: src/pages/Player/PlayerMenu.tsx:302\nmsgid \"Playback rate\"\nmsgstr \"播放速度\"\n\n#: src/pages/Setting.tsx:107\n#: src/pages/LogIn.tsx:24\nmsgid \"Please use Microsoft account authorization to log in\"\nmsgstr \"请使用微软账户授权登录\"\n\n#: src/pages/Player/PlayerMenu.tsx:251\nmsgid \"Re-fetch metadata\"\nmsgstr \"重新获取元数据\"\n\n#: src/components/CommonList/CommonMenu.tsx:186\nmsgid \"Remove\"\nmsgstr \"移除\"\n\n#: src/pages/Playlist/Playlist.tsx:185\n#: src/pages/Playlist/Playlist.tsx:203\nmsgid \"Rename\"\nmsgstr \"重命名\"\n\n#: src/pages/Search.tsx:120\n#: src/pages/Search.tsx:143\n#: src/pages/Search.tsx:145\n#: src/pages/Search.tsx:167\nmsgid \"Search\"\nmsgstr \"搜索\"\n\n#: src/components/CommonList/CommonMenu.tsx:199\nmsgid \"Select\"\nmsgstr \"选择\"\n\n#: src/pages/Setting.tsx:196\nmsgid \"Select account\"\nmsgstr \"选择账户\"\n\n#: src/components/CommonList/CommonMenu.tsx:209\nmsgid \"Select all\"\nmsgstr \"全选\"\n\n#: src/pages/SideBar/SideBar.tsx:21\nmsgid \"Setting\"\nmsgstr \"设置\"\n\n#: src/components/CommonList/ShuffleAll.tsx:24\nmsgid \"Shuffle all\"\nmsgstr \"全部随机播放\"\n\n#: src/pages/LogIn.tsx:26\nmsgid \"Sign in\"\nmsgstr \"登录\"\n\n#: src/pages/Setting.tsx:204\nmsgid \"Sign out\"\nmsgstr \"注销\"\n\n#: src/pages/Files/FilterMenu.tsx:93\nmsgid \"Size\"\nmsgstr \"大小\"\n\n#: src/pages/Player/PlayerMenu.tsx:242\nmsgid \"Switch fullscreen\"\nmsgstr \"切换全屏\"\n\n#: src/pages/Player/PlayerMenu.tsx:192\n#: src/pages/Player/PlayerMenu.tsx:265\nmsgid \"Switch theme\"\nmsgstr \"切换主题\"\n\n#: src/pages/Playlist/Playlist.tsx:237\nmsgid \"The playlist will be deleted\"\nmsgstr \"播放列表将会被删除\"\n\n#: src/pages/Setting.tsx:156\nmsgid \"Use album cover theme color\"\nmsgstr \"使用专辑封面主题色\"\n\n#: src/pages/Setting.tsx:170\nmsgid \"Version\"\nmsgstr \"版本号\"\n"
  },
  {
    "path": "src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { PublicClientApplication } from '@azure/msal-browser'\nimport { MsalProvider } from '@azure/msal-react'\nimport { msalConfig } from './graph/authConfig'\nimport { RouterProvider } from 'react-router-dom'\nimport { i18n } from '@lingui/core'\nimport { I18nProvider } from '@lingui/react'\nimport { messages as enMessages } from './locales/en/messages'\nimport { messages as zhCNMessages } from './locales/zh-CN/messages'\nimport './index.css'\nimport '@fontsource/roboto/300.css'\nimport '@fontsource/roboto/400.css'\nimport '@fontsource/roboto/500.css'\nimport '@fontsource/roboto/700.css'\nimport 'react-virtualized/styles.css'\nimport router from './router'\n\nconst msalInstance = new PublicClientApplication(msalConfig)\n\nconst messages = {\n  'en': enMessages,\n  'zh-CN': zhCNMessages,\n}\n\nconst languages = Object.keys(messages)\nconst langage = navigator.language\n\ni18n.load(messages)\n\ni18n.activate(languages.includes(langage) ? langage : 'en')\n\nReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(\n  <React.StrictMode>\n    <I18nProvider i18n={i18n}>\n      <MsalProvider instance={msalInstance}>\n        <RouterProvider router={router} />\n      </MsalProvider>\n    </I18nProvider>\n  </React.StrictMode>\n)\n"
  },
  {
    "path": "src/pages/Files/BreadcrumbNav.tsx",
    "content": "import { Breadcrumbs, Button } from '@mui/material'\nimport useUiStore from '../../store/useUiStore'\n\nconst BreadcrumbNav = ({ handleClickNav }: { handleClickNav: (index: number) => void }) => {\n\n  const folderTree = useUiStore((state) => state.folderTree)\n\n  return (\n    <Breadcrumbs\n      separator=\"›\"\n      sx={{\n        m: '0.25rem',\n      }}>\n      {\n        folderTree.map((name: string, index: number) =>\n          <Button\n            key={index}\n            color=\"inherit\"\n            size='small'\n            onClick={() => handleClickNav(index)}\n          >\n\n            <span style={{\n              maxWidth: '10rem',\n              overflow: 'hidden',\n              textOverflow: 'ellipsis',\n              whiteSpace: 'nowrap',\n              minWidth: 'auto',\n            }}>\n              {name}\n            </span>\n\n          </Button>\n        )\n      }\n    </Breadcrumbs>\n  )\n}\n\nexport default BreadcrumbNav"
  },
  {
    "path": "src/pages/Files/Files.tsx",
    "content": "import useSWR from 'swr'\nimport useUiStore from '../../store/useUiStore'\nimport useFilesData from '../../hooks/graph/useFilesData'\nimport BreadcrumbNav from './BreadcrumbNav'\nimport CommonList from '../../components/CommonList/CommonList'\nimport Loading from '../Loading'\nimport { remoteItemToFile, pathConvert } from '../../utils'\nimport { FileItem, RemoteItem } from '../../types/file'\nimport Grid from '@mui/material/Grid'\nimport FilterMenu from './FilterMenu'\nimport PictureView from '../PictureView/PictureView'\nimport { Divider } from '@mui/material'\nimport { useState } from 'react'\nimport useUser from '@/hooks/graph/useUser'\nimport { useNavigate } from 'react-router-dom'\nimport usePictureStore from '@/store/usePictureStore'\nimport usePlayQueueStore from '@/store/usePlayQueueStore'\nimport usePlayerStore from '@/store/usePlayerStore'\nimport { useShallow } from 'zustand/shallow'\n\nconst Files = () => {\n\n  const [\n    shuffle,\n    folderTree,\n    display,\n    sortBy,\n    orderBy,\n    foldersFirst,\n    mediaOnly,\n    updateFolderTree,\n    updateVideoViewIsShow,\n    updateShuffle,\n  ] = useUiStore(\n    useShallow(\n      (state) => [\n        state.shuffle,\n        state.folderTree,\n        state.display,\n        state.sortBy,\n        state.orderBy,\n        state.foldersFirst,\n        state.mediaOnly,\n        state.updateFolderTree,\n        state.updateVideoViewIsShow,\n        state.updateShuffle,\n      ]\n    )\n  )\n\n  const [updatePictureList, updateCurrentPicture] = usePictureStore(\n    useShallow((state) => [state.updatePictureList, state.updateCurrentPicture])\n  )\n\n  const updatePlayQueue = usePlayQueueStore.use.updatePlayQueue()\n  const updateCurrentIndex = usePlayQueueStore.use.updateCurrentIndex()\n\n  const updateAutoPlay = usePlayerStore(state => state.updateAutoPlay)\n\n  const { getFilesData } = useFilesData()\n  const navigate = useNavigate()\n\n  const { account } = useUser()\n\n  const path = pathConvert(folderTree)\n\n  const fileListFetcher = async (path: string) => {\n    const res: RemoteItem[] = await getFilesData(account, path)\n    return remoteItemToFile(res)\n  }\n\n  const { data: fileListData, error: fileListError, isLoading: fileListIsLoading } =\n    useSWR(\n      `${account.username}/${path}`,\n      () => fileListFetcher(path),\n      { revalidateOnFocus: false }\n    )\n\n  const filteredFileList = fileListData?.filter((item) => mediaOnly ? item.fileType !== 'other' : true)\n\n  const sortedFileList = filteredFileList?.sort((a, b) => {\n    if (foldersFirst) {\n      if (a.fileType === 'folder' && b.fileType !== 'folder') {\n        return -1\n      } else if (a.fileType !== 'folder' && b.fileType === 'folder') {\n        return 1\n      }\n    }\n\n    if (sortBy === 'name') {\n      if (orderBy === 'asc') {\n        return (a.fileName).localeCompare(b.fileName)\n      } else {\n        return (b.fileName).localeCompare(a.fileName)\n      }\n    } else if (sortBy === 'size') {\n      if (orderBy === 'asc') {\n        return a.fileSize - b.fileSize\n      } else {\n        return b.fileSize - a.fileSize\n      }\n    } else if (sortBy === 'datetime' && a.lastModifiedDateTime && b.lastModifiedDateTime) {\n      if (orderBy === 'asc') {\n        return new Date(a.lastModifiedDateTime).getTime() - new Date(b.lastModifiedDateTime).getTime()\n      } else {\n        return new Date(b.lastModifiedDateTime).getTime() - new Date(a.lastModifiedDateTime).getTime()\n      }\n    } else return 0\n  })\n\n  const [scrollPath, setScrollPath] = useState<FileItem['filePath'] | undefined>()\n  const scrollIndex = scrollPath ? sortedFileList?.findIndex(item => pathConvert(item.filePath) === pathConvert(scrollPath)) : undefined\n\n  const handleClickNav = (index: number) => {\n    if (index < folderTree.length - 1) {\n      setScrollPath(folderTree.slice(0, index + 2))\n      updateFolderTree(folderTree.slice(0, index + 1))\n    }\n  }\n\n  const open = (index: number) => {\n    const listData = sortedFileList\n    if (listData) {\n      const currentFile = listData[index]\n\n      if (currentFile && currentFile.fileType === 'folder') {\n        updateFolderTree(currentFile.filePath)\n        navigate('/')\n      }\n\n      if (currentFile && currentFile.fileType === 'picture') {\n        const list = listData.filter(item => item.fileType === 'picture')\n        updatePictureList(list)\n        updateCurrentPicture(currentFile)\n      }\n\n      if (currentFile && (currentFile.fileType === 'audio' || currentFile.fileType === 'video')) {\n        const list = listData\n          .filter((item) => item.fileType === 'audio' || item.fileType === 'video')\n          .map((item, _index) => ({ ...item, index: _index }))\n        if (shuffle) {\n          updateShuffle(false)\n        }\n        updatePlayQueue(list)\n        updateCurrentIndex(list.find(item => pathConvert(item.filePath) === pathConvert(currentFile.filePath))?.index || 0)\n        updateAutoPlay(true)\n        if (currentFile.fileType === 'video') {\n          updateVideoViewIsShow(true)\n        }\n      }\n\n      if (!currentFile) {\n        const discs = listData.filter(item => item.fileName.toLocaleLowerCase().includes('disc'))\n        if (discs.length > 0) {\n          Promise.all(discs.map(item => getFilesData(account, pathConvert(item.filePath)).then(res => remoteItemToFile(res))))\n            .then(files => {\n              const list = files\n                .flat()\n                .filter((item) => item.fileType === 'audio' || item.fileType === 'video')\n                .map((item, _index) => ({ ...item, index: _index }))\n\n              if (list.length > 0) {\n                if (shuffle) {\n                  updateShuffle(false)\n                }\n                updatePlayQueue(list)\n                updateCurrentIndex(0)\n                updateAutoPlay(true)\n                if (list[0].fileType === 'video') {\n                  updateVideoViewIsShow(true)\n                }\n              }\n            })\n        }\n      }\n    }\n  }\n\n  return (\n    <Grid container\n      sx={{\n        height: '100%',\n        overflow: 'auto',\n        flexDirection: 'column',\n        justifyContent: 'flex-start',\n        flexWrap: 'nowrap',\n      }}>\n      <Grid container\n        size={12}\n        justifyContent='space-between'\n        alignItems='center'\n        wrap='nowrap'\n        padding='0.125rem'\n        gap='0.25rem'\n      >\n        <Grid size='grow'>\n          <BreadcrumbNav handleClickNav={handleClickNav} />\n        </Grid>\n        <Grid size='auto' sx={{ display: 'flex', flexDirection: 'row', justifyItems: 'center', alignItems: 'center' }}>\n          <FilterMenu />\n        </Grid>\n      </Grid>\n      <Divider />\n      <Grid size={12} sx={{ flexGrow: 1, overflow: 'auto' }}>\n        {\n          (fileListIsLoading || !fileListData || !sortedFileList || fileListError)\n            ? <Loading />\n            : <CommonList\n              display={display}\n              listData={sortedFileList}\n              listType='files'\n              scrollIndex={scrollIndex}\n              func={{ open }}\n            />\n        }\n      </Grid>\n      <PictureView />\n    </Grid>\n  )\n}\n\nexport default Files"
  },
  {
    "path": "src/pages/Files/FilterMenu.tsx",
    "content": "import useUiStore from '@/store/useUiStore'\nimport FilterListRoundedIcon from '@mui/icons-material/FilterListRounded'\nimport { Checkbox, Divider, FormControlLabel, FormGroup, IconButton, Menu, Radio, RadioGroup } from '@mui/material'\nimport React from 'react'\nimport { t } from '@lingui/macro'\nimport { useShallow } from 'zustand/shallow'\n\nconst FilterMenu = () => {\n  const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null)\n  const open = Boolean(anchorEl)\n  const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n    setAnchorEl(event.currentTarget)\n  }\n  const handleClose = () => {\n    setAnchorEl(null)\n  }\n\n  const [\n    display,\n    sortBy,\n    orderBy,\n    foldersFirst,\n    mediaOnly,\n    hdThumbnails,\n    updateDisplay,\n    updateSortBy,\n    updateOrderBy,\n    updateFoldersFirst,\n    updateMediaOnly,\n    updateHDThumbnails\n  ] = useUiStore(\n    useShallow(\n      (state) => [\n        state.display,\n        state.sortBy,\n        state.orderBy,\n        state.foldersFirst,\n        state.mediaOnly,\n        state.hdThumbnails,\n        state.updateDisplay,\n        state.updateSortBy,\n        state.updateOrderBy,\n        state.updateFoldersFirst,\n        state.updateMediaOnly,\n        state.updateHDThumbnails,\n      ]\n    )\n  )\n\n  return (\n    <div>\n      <IconButton\n        id=\"filter-button\"\n        aria-controls={open ? 'filter-menu' : undefined}\n        aria-haspopup=\"true\"\n        aria-expanded={open ? 'true' : undefined}\n        onClick={handleClick}\n      >\n        <FilterListRoundedIcon />\n      </IconButton>\n\n      <Menu\n        id=\"filter-menu\"\n        anchorEl={anchorEl}\n        open={open}\n        onClose={handleClose}\n        MenuListProps={{\n          'aria-labelledby': 'filter-button',\n        }}\n        sx={{ userSelect: 'none' }}\n      >\n\n        <RadioGroup\n          aria-labelledby=\"display-radio-buttons-group-label\"\n          defaultValue={display}\n          name='display-radio-buttons-group'\n          sx={{ paddingLeft: 2 }}\n        >\n          <FormControlLabel value={'list'} control={<Radio />} label={t`List`} onChange={() => updateDisplay('list')} />\n          <FormControlLabel value={'multicolumnList'} control={<Radio />} label={t`Multicolumn list`} onChange={() => updateDisplay('multicolumnList')} />\n          <FormControlLabel value={'grid'} control={<Radio />} label={t`Grid`} onChange={() => updateDisplay('grid')} />\n        </RadioGroup>\n\n        <Divider />\n\n        <RadioGroup\n          aria-labelledby=\"sort-radio-buttons-group-label\"\n          defaultValue={sortBy}\n          name=\"sort-radio-buttons-group\"\n          sx={{ paddingLeft: 2 }}\n        >\n          <FormControlLabel value=\"name\" control={<Radio />} label={t`Name`} onChange={() => updateSortBy('name')} />\n          <FormControlLabel value=\"size\" control={<Radio />} label={t`Size`} onChange={() => updateSortBy('size')} />\n          <FormControlLabel value=\"datetime\" control={<Radio />} label={t`Last modified`} onChange={() => updateSortBy('datetime')} />\n        </RadioGroup>\n\n        <Divider />\n\n        <RadioGroup\n          aria-labelledby=\"order-radio-buttons-group-label\"\n          defaultValue={orderBy}\n          name=\"order-radio-buttons-group\"\n          sx={{ paddingLeft: 2 }}\n        >\n          <FormControlLabel value=\"asc\" control={<Radio />} label={t`Ascending`} onChange={() => updateOrderBy('asc')} />\n          <FormControlLabel value=\"desc\" control={<Radio />} label={t`Descending`} onChange={() => updateOrderBy('desc')} />\n        </RadioGroup>\n\n        <Divider />\n\n        <FormGroup\n          sx={{ paddingLeft: 2 }}\n        >\n          <FormControlLabel control={<Checkbox checked={foldersFirst} />} label={t`Folders first`} onChange={() => updateFoldersFirst(!foldersFirst)} />\n          <FormControlLabel control={<Checkbox checked={mediaOnly} />} label={t`Media only`} onChange={() => updateMediaOnly(!mediaOnly)} />\n          {\n            display === 'grid' &&\n            <FormControlLabel control={<Checkbox checked={hdThumbnails} />} label={t`HD thumbnails`} onChange={() => updateHDThumbnails(!hdThumbnails)} />\n          }\n\n        </FormGroup>\n\n      </Menu>\n    </div>\n\n  )\n}\n\nexport default FilterMenu"
  },
  {
    "path": "src/pages/History.tsx",
    "content": "import useHistoryStore from '../store/useHistoryStore'\nimport CommonList from '../components/CommonList/CommonList'\nimport Loading from './Loading'\nimport usePlayQueueStore from '@/store/usePlayQueueStore'\nimport usePlayerStore from '@/store/usePlayerStore'\nimport useUiStore from '@/store/useUiStore'\nimport { checkFileType } from '@/utils'\nimport { useShallow } from 'zustand/shallow'\n\nconst History = () => {\n  const [historyList, removeHistory] = useHistoryStore(\n    useShallow((state) => [state.historyList, state.removeHistory])\n  )\n  const [shuffle, updateVideoViewIsShow, updateShuffle,] = useUiStore(\n    useShallow((state) => [state.shuffle, state.updateVideoViewIsShow, state.updateShuffle])\n  )\n\n  const updatePlayQueue = usePlayQueueStore.use.updatePlayQueue()\n  const updateCurrentIndex = usePlayQueueStore.use.updateCurrentIndex()\n\n  const updateAutoPlay = usePlayerStore(state => state.updateAutoPlay)\n\n  const open = (index: number) => {\n    const listData = historyList\n    if (listData) {\n      const currentFile = listData[index]\n      if (currentFile) {\n        const list = listData\n          .map((item, _index) => ({ ...item, index: _index }))\n        if (shuffle) {\n          updateShuffle(false)\n        }\n        updatePlayQueue(list)\n        updateCurrentIndex(list[index].index)\n        updateAutoPlay(true)\n        if (checkFileType(currentFile.fileName) === 'video') {\n          updateVideoViewIsShow(true)\n        }\n      }\n    }\n  }\n\n  return (\n    <div style={{ height: '100%' }}>\n      {\n        (!historyList) ? <Loading />\n          : <CommonList\n            listData={historyList}\n            listType='files'\n            func={{ open, remove: removeHistory }}\n          />\n      }\n    </div>\n  )\n}\n\nexport default History"
  },
  {
    "path": "src/pages/Loading.tsx",
    "content": "import { CircularProgress } from '@mui/material'\n\nconst Loading = () => {\n  return (\n    <div\n      style={{\n        height: '100%',\n        display: 'flex',\n        justifyContent: 'center',\n        alignItems: 'center',\n      }}\n    >\n      <CircularProgress />\n    </div>\n  )\n}\nexport default Loading"
  },
  {
    "path": "src/pages/LogIn.tsx",
    "content": "import { Button, Container, IconButton, Link, Typography } from '@mui/material'\nimport GitHubIcon from '@mui/icons-material/GitHub'\nimport { t } from '@lingui/macro'\nimport useUser from '../hooks/graph/useUser'\n\nconst LogIn = () => {\n  const { login } = useUser()\n  return (\n    <Container\n      style={{\n        height: '100%',\n        display: 'flex',\n        flexDirection: 'column',\n        justifyContent: 'space-between',\n        alignItems: 'center',\n        padding: '1rem',\n        textAlign: 'center',\n      }}>\n      <IconButton component={Link} href='https://github.com/nini22P/omp'>\n        <GitHubIcon />\n      </IconButton>\n      <div>\n        <Typography variant=\"h5\" pb={2} >\n          {t`Please use Microsoft account authorization to log in`}\n        </Typography>\n        <Button size=\"large\" onClick={() => login()}>{t`Sign in`}</Button>\n      </div>\n      <footer>\n        Made with ❤ from <Link underline='none' href='https://github.com/nini22P'>22</Link>\n      </footer>\n    </Container>\n  )\n}\n\nexport default LogIn "
  },
  {
    "path": "src/pages/NavBar.tsx",
    "content": "import { Box, Typography, Container, IconButton, useMediaQuery, useTheme, Tooltip } from '@mui/material'\nimport MenuRoundedIcon from '@mui/icons-material/MenuRounded'\nimport useUiStore from '../store/useUiStore'\nimport Search from './Search'\nimport { useShallow } from 'zustand/shallow'\nimport INFO from '@/data/info'\nimport { t } from '@lingui/macro'\n\nconst NavBar = () => {\n  const [\n    mobileSideBarOpen,\n    audioViewIsShow,\n    videoViewIsShow,\n    updateMobileSideBarOpen,\n  ] = useUiStore(\n    useShallow(\n      (state) => [\n        state.mobileSideBarOpen,\n        state.audioViewIsShow,\n        state.videoViewIsShow,\n        state.updateMobileSideBarOpen,\n      ]\n    )\n  )\n  const windowControlsOverlayOpen = useMediaQuery('(display-mode: window-controls-overlay)')\n  const theme = useTheme()\n  const sm = useMediaQuery(theme.breakpoints.up('sm'))\n\n  return (\n    <Box\n      sx={{\n        position: 'fixed',\n        top: 'env(titlebar-area-y, 0)',\n        left: 'env(titlebar-area-x, 0rem)',\n        // width: 'env(titlebar-area-width, 100%)',\n        right: 0,\n        height: 'env(titlebar-area-height, 3.5rem)',\n      }}\n      className='app-region-drag'\n    >\n      <Container\n        maxWidth={'xl'}\n        disableGutters={true}\n        sx={{\n          top: 0,\n          left: 0,\n          display: 'flex',\n          justifyContent: 'space-between',\n          alignItems: 'center',\n          height: '100%',\n          px: { xs: windowControlsOverlayOpen ? 0 : '0.5rem', sm: windowControlsOverlayOpen ? '0.25rem' : '1.5rem' },\n          py: 'calc(env(titlebar-area-height, 0.5rem) - env(titlebar-area-height, 0rem) + 0.25rem)',\n          gap: '0.5rem',\n        }}\n      >\n        {/* 搜索栏 */}\n        <Box\n          sx={{\n            display: windowControlsOverlayOpen ? 'flex' : { xs: 'flex', sm: 'none' },\n            position: 'absolute',\n            alignItems: 'center',\n            height: '100%',\n            left: 'env(titlebar-area-x, 0rem)',\n            width: {\n              xs: windowControlsOverlayOpen ? 'env(titlebar-area-width)' : '100%',\n              md: '100%',\n            },\n            px: windowControlsOverlayOpen ? '0' : '0.5rem',\n            justifyContent: { xs: 'flex-end', sm: windowControlsOverlayOpen ? 'flex-end' : 'center', md: 'center' }\n          }}\n        >\n          <Box\n            sx={{\n              width: { xs: 'none', sm: '40%' },\n              maxWidth: { xs: 'auto', sm: 'var(--titlebar-center-safe-width)' },\n              height: { xs: 'auto', sm: '70%' },\n            }}\n            className={(audioViewIsShow || videoViewIsShow) ? 'app-region-drag' : 'app-region-no-drag'}\n          >\n            <Search type={sm ? 'bar' : 'icon'} />\n          </Box>\n        </Box>\n\n        {/* 标题 */}\n        <Box\n          sx={{\n            display: 'flex',\n            flexDirection: 'row',\n            alignItems: 'center',\n            height: '100%',\n          }}\n        >\n          <IconButton\n            onClick={() => updateMobileSideBarOpen(!mobileSideBarOpen)}\n            sx={{\n              display: { xs: '', sm: 'none' },\n              borderRadius: '0.2rem',\n              '.MuiTouchRipple-ripple .MuiTouchRipple-child': {\n                borderRadius: '0.2rem',\n              },\n            }}\n            className='app-region-no-drag'\n          >\n            <MenuRoundedIcon />\n          </IconButton>\n          <img\n            src='./logo.svg'\n            alt='logo'\n            style={{\n              height: '100%',\n              marginRight: windowControlsOverlayOpen ? '0.125rem' : '0.6125rem',\n            }}\n          />\n          <Typography\n            component=\"div\"\n            fontSize={windowControlsOverlayOpen ? '100%' : '1.25rem'}\n            style={{ textAlign: 'center' }}\n          >\n            OMP\n            {\n              INFO.dev &&\n              <Tooltip title={t`Currently using a development version, please be careful with your data!`}>\n                <span\n                  style={{\n                    marginLeft: '0.25rem',\n                    color: theme.palette.background.default,\n                    backgroundColor: theme.palette.text.primary,\n                    borderRadius: '0.2rem',\n                    padding: '0.05rem 0.3rem',\n                    cursor: 'help',\n                  }}\n                >DEV</span>\n              </Tooltip>\n            }\n          </Typography>\n\n\n        </Box>\n      </Container >\n    </Box >\n  )\n}\n\nexport default NavBar\n"
  },
  {
    "path": "src/pages/NotFound.tsx",
    "content": "import { useRouteError } from 'react-router-dom'\n\nconst NotFound = () => {\n  const error = useRouteError()\n  console.error(error)\n\n  return (\n    <div>\n    </div>\n  )\n}\n\nexport default NotFound"
  },
  {
    "path": "src/pages/PictureView/PictureList.tsx",
    "content": "import usePictureStore from '@/store/usePictureStore'\nimport { Box } from '@mui/material'\nimport PictureListItem from './PictureListItem'\nimport { Grid, WindowScroller } from 'react-virtualized'\nimport { CSSProperties, Key, useEffect, useRef } from 'react'\nimport { useShallow } from 'zustand/shallow'\n\nconst PictureList = () => {\n  const [\n    pictureList,\n    currentPicture,\n    updateCurrentPicture,\n  ] = usePictureStore(\n    useShallow(\n      (state) => [\n        state.pictureList,\n        state.currentPicture,\n        state.updateCurrentPicture,\n      ]\n    )\n  )\n\n  const currentIndex = pictureList.findIndex(picture => picture.id === currentPicture?.id)\n\n  const scrollContainerRef = useRef<HTMLElement | null>(null)\n  const gridRef = useRef<Grid | null>(null)\n\n  useEffect(() => {\n    const scrollContainer = scrollContainerRef.current\n    const grid = gridRef.current\n    if (scrollContainer && grid) {\n      const onWheel = (e: WheelEvent) => {\n        if (e.deltaY === 0) return\n        e.preventDefault()\n        const gridWidth = grid.props.columnWidth as number * grid.props.columnCount\n        let left: number = grid.state.scrollLeft + e.deltaY * 2\n        if (left < 0) left = 0\n        if (left + grid.props.width + 32 > gridWidth) left = gridWidth - grid.props.width + 32\n        grid.scrollToPosition({ scrollLeft: left, scrollTop: 0 })\n      }\n      scrollContainer.addEventListener('wheel', onWheel)\n      return () => scrollContainer.removeEventListener('wheel', onWheel)\n    }\n  }, [])\n\n\n  const cellRenderer = ({ columnIndex, key, style }: { columnIndex: number, key: Key, style: CSSProperties }) =>\n    <Box onClick={() => updateCurrentPicture(pictureList[columnIndex])} key={key} style={style} sx={{ padding: '4px', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>\n      <PictureListItem picture={pictureList[columnIndex]} isCurrent={columnIndex === currentIndex} />\n    </Box>\n\n  return (\n    <Box\n      display={'flex'}\n      flexDirection={'row'}\n      flexWrap={'nowrap'}\n      width={'100%'}\n      overflow={'auto'}\n      height='auto'\n      ref={scrollContainerRef}\n    >\n      <WindowScroller>\n        {({ height, width }) => (\n          <Grid\n            cellRenderer={cellRenderer}\n            ref={ref => gridRef.current = ref}\n            columnCount={pictureList.length}\n            columnWidth={104}\n            rowCount={1}\n            rowHeight={112}\n            height={height}\n            width={width}\n            autoHeight\n            scrollToColumn={currentIndex}\n            scrollToAlignment={'center'}\n            style={{\n              padding: '0 16px',\n            }}\n          />\n        )}\n      </WindowScroller>\n    </Box>\n  )\n}\n\nexport default PictureList"
  },
  {
    "path": "src/pages/PictureView/PictureListItem.tsx",
    "content": "import { FileItem } from '@/types/file'\nimport { Paper, useTheme } from '@mui/material'\n\nconst PictureListItem = ({ picture, isCurrent }: { picture: FileItem, isCurrent: boolean }) => {\n  const theme = useTheme()\n\n  return (\n    <Paper\n      sx={{\n        height: '96px',\n        display: 'flex',\n        justifyContent: 'center',\n        alignItems: 'center',\n        aspectRatio: '1/1',\n        cursor: 'pointer',\n        outline: isCurrent ? `3px solid ${theme.palette.primary.main}` : `2px solid ${theme.palette.divider}`,\n      }}\n    >\n      <img\n        src={picture.thumbnails ? picture.thumbnails[0].medium.url : ''}\n        alt={picture.fileName}\n        style={{ width: '100%', height: '100%', objectFit: 'contain', borderRadius: '0.5rem' }}\n        loading='lazy'\n      />\n    </Paper>\n  )\n}\n\nexport default PictureListItem"
  },
  {
    "path": "src/pages/PictureView/PictureView.tsx",
    "content": "import usePictureStore from '@/store/usePictureStore'\nimport CloseRoundedIcon from '@mui/icons-material/CloseRounded'\nimport { Box, Dialog, IconButton, Tooltip } from '@mui/material'\nimport PictureList from './PictureList'\nimport { useEffect, useRef } from 'react'\nimport { useShallow } from 'zustand/shallow'\nimport { t } from '@lingui/macro'\n\nconst PictureView = () => {\n\n  const [\n    currentPicture,\n    updatePictureList,\n    updateCurrentPicture,\n  ] = usePictureStore(\n    useShallow(\n      (state) => [\n        state.currentPicture,\n        state.updatePictureList,\n        state.updateCurrentPicture,\n      ]\n    )\n  )\n\n  const open = currentPicture !== null\n\n  const handleClose = () => {\n    updatePictureList([])\n    updateCurrentPicture(null)\n  }\n\n  const imgRef = useRef<HTMLImageElement | null>(null)\n\n  useEffect(\n    () => {\n      const imageElement = imgRef.current\n      if (imageElement) {\n        imageElement.src = currentPicture?.url || ''\n      }\n      return () => {\n        if (imageElement)\n          imageElement.src = ''\n      }\n    },\n    [currentPicture?.url]\n  )\n\n  return (\n    <Dialog\n      fullScreen\n      maxWidth='lg'\n      open={open}\n      onClose={handleClose}\n      sx={{\n        '& .MuiDialog-paper': {\n          marginTop: 'calc(env(titlebar-area-height, 0) + 1px)',\n          boxShadow: 'none',\n          height: '-webkit-fill-available',\n        },\n      }}\n    >\n      <Box\n        sx={{\n          width: '100%',\n          height: '100dvh',\n          display: 'flex',\n          flexDirection: 'column',\n          flexWrap: 'nowrap',\n        }}\n      >\n        <Box padding='0.5rem' display='flex' alignItems={'center'} gap={2} overflow={'hidden'}>\n          <Tooltip title={t`Close`}>\n            <IconButton onClick={(handleClose)}>\n              <CloseRoundedIcon />\n            </IconButton>\n          </Tooltip>\n          {currentPicture?.fileName}\n        </Box>\n        <Box sx={{ height: 0, flexGrow: 1, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>\n          <img\n            ref={imgRef}\n            src={currentPicture?.url}\n            alt={currentPicture?.fileName}\n            style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'contain' }}\n          />\n        </Box>\n        <PictureList />\n      </Box>\n    </Dialog>\n  )\n}\n\nexport default PictureView\n"
  },
  {
    "path": "src/pages/Player/Audio/Audio.tsx",
    "content": "import useUiStore from '@/store/useUiStore'\nimport { useMemo, useRef } from 'react'\nimport Classic from './Classic'\nimport Modern from './Modern'\nimport { animated, useSpring } from '@react-spring/web'\nimport { useDrag } from '@use-gesture/react'\nimport { useShallow } from 'zustand/shallow'\n\nconst Audio = ({ player }: { player: HTMLVideoElement | null }) => {\n\n  const [\n    audioViewIsShow,\n    audioViewTheme,\n    updateAudioViewIsShow,\n  ] = useUiStore(\n    useShallow(\n      (state) => [\n        state.audioViewIsShow,\n        state.audioViewTheme,\n        state.updateAudioViewIsShow,\n      ]\n    )\n  )\n\n  const topRef = useRef(0)\n  const [{ top, p, borderRadius }, api] = useSpring(() => ({\n    from: {\n      top: audioViewIsShow ? '0' : '100dvh',\n      p: audioViewIsShow ? '0' : '0.5rem',\n      borderRadius: '0.5rem',\n    },\n    // config: {\n    //   mass: 1,\n    //   tension: 190,\n    //   friction: 20,\n    // }\n  }))\n\n  const show = () => api.start({\n    to: { top: '0', p: '0', borderRadius: '0' },\n    // config: { clamp: false },\n  })\n\n  const hide = () => {\n    api.start({\n      from: { top: `${topRef.current}` },\n      to: { top: '100dvh', p: '0.5rem', borderRadius: '0.5rem' },\n      // config: { clamp: true },\n    })\n    topRef.current = 0\n  }\n\n  useMemo(\n    () => audioViewIsShow ? show() : hide(),\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [audioViewIsShow]\n  )\n\n  const bind = useDrag(({ down, movement: [, my], last, event }) => {\n    const element = event.target as HTMLElement\n\n    if (element.classList.contains('MuiSlider-thumb'))\n      return\n\n    if ('pointerType' in event && event.pointerType !== 'touch') {\n      return\n    }\n\n    if (last) {\n      if (my > 40) {\n        updateAudioViewIsShow(false)\n      } else {\n        topRef.current = 0\n        show()\n      }\n    } else if (down) {\n      topRef.current = my\n      api.start({ top: my > 0 ? `${my}px` : '0', borderRadius: '0.5rem' })\n    }\n  })\n\n  return (\n    <animated.div\n      {...bind()}\n      style={{\n        position: 'fixed',\n        maxWidth: '100%',\n        maxHeight: '100dvh',\n        top: top,\n        left: p,\n        right: p,\n        bottom: p,\n        touchAction: 'pan-x',\n      }}\n    >\n      {audioViewTheme === 'classic' && <Classic player={player} styles={{ borderRadius: borderRadius }} />}\n      {audioViewTheme === 'modern' && <Modern player={player} styles={{ borderRadius: borderRadius }} />}\n    </animated.div>\n  )\n}\n\nexport default Audio"
  },
  {
    "path": "src/pages/Player/Audio/Classic.tsx",
    "content": "import usePlayerControl from '@/hooks/player/usePlayerControl'\nimport useFullscreen from '@/hooks/ui/useFullscreen'\nimport usePlayQueueStore from '@/store/usePlayQueueStore'\nimport usePlayerStore from '@/store/usePlayerStore'\nimport useUiStore from '@/store/useUiStore'\nimport { timeShift } from '@/utils'\nimport { CloseFullscreen, FastForward, FastRewind, KeyboardArrowDownOutlined, OpenInFull, PanoramaOutlined, PauseCircleOutlined, PlayCircleOutlined, QueueMusicOutlined, Repeat, RepeatOne, Shuffle, SkipNext, SkipPrevious } from '@mui/icons-material'\nimport { Container, Box, IconButton, Typography, Slider, CircularProgress } from '@mui/material'\nimport Grid from '@mui/material/Grid'\nimport PlayerMenu from '../PlayerMenu'\nimport { SpringValue, animated } from '@react-spring/web'\nimport { useShallow } from 'zustand/shallow'\n\nconst Classic = ({ player, styles }: { player: HTMLVideoElement | null, styles: { borderRadius: SpringValue<string> } }) => {\n\n  const playQueue = usePlayQueueStore.use.playQueue()\n\n  const [\n    audioViewIsShow,\n    fullscreen,\n    backgroundIsShow,\n    shuffle,\n    repeat,\n    coverColor,\n    updateAudioViewIsShow,\n    updatePlayQueueIsShow,\n    updateBackgroundIsShow,\n  ] = useUiStore(\n    useShallow(\n      (state) => [\n        state.audioViewIsShow,\n        state.fullscreen,\n        state.backgroundIsShow,\n        state.shuffle,\n        state.repeat,\n        state.coverColor,\n        state.updateAudioViewIsShow,\n        state.updatePlayQueueIsShow,\n        state.updateBackgroundIsShow,\n      ]\n    )\n  )\n\n  const [\n    currentMetaData,\n    isLoading,\n    cover,\n    currentTime,\n    duration\n  ] = usePlayerStore(\n    useShallow(\n      (state) => [\n        state.currentMetaData,\n        state.isLoading,\n        state.cover,\n        state.currentTime,\n        state.duration,\n      ]\n    )\n  )\n\n  const {\n    handleClickPlay,\n    handleClickPause,\n    handleClickNext,\n    handleClickPrev,\n    handleClickSeekforward,\n    handleClickSeekbackward,\n    handleTimeRangeonChange,\n    handleClickShuffle,\n    handleClickRepeat,\n  } = usePlayerControl(player)\n\n  const { handleClickFullscreen } = useFullscreen()\n\n  return (\n    <animated.div\n      style={{\n        width: '100%',\n        height: '100%',\n        background:\n          (!backgroundIsShow || cover === './cover.svg')\n            ? `linear-gradient(rgba(50, 50, 50, 0.6), ${coverColor}bb), #000`\n            : `linear-gradient(rgba(50, 50, 50, 0.3), rgba(50, 50, 50, 0.3)), url(${cover}) no-repeat center / cover, #000`,\n        color: '#fff',\n        overflow: 'hidden',\n        ...styles,\n      }}\n    >\n\n      <Box sx={{ width: '100%', height: '100%', backdropFilter: (!backgroundIsShow || cover === './cover.svg') ? '' : 'blur(30px)' }}>\n        <Container\n          maxWidth={'xl'}\n          disableGutters={true}\n          className='pt-titlebar-area-height'\n          sx={{ height: '100%' }}\n        >\n          <Grid container\n            pt={{ xs: 1, sm: 2 }}\n            pb={{ xs: 1, sm: 2 }}\n            pl={{ xs: 0, sm: 2 }}\n            pr={{ xs: 0, sm: 2 }}\n            sx={{\n              width: '100%',\n              height: '100%',\n              justifyContent: 'space-evenly',\n              alignItems: 'start',\n              '.MuiSvgIcon-root': {\n                color: '#fff',\n              },\n            }}\n          >\n            <Grid size={6} pl={{ xs: 1, sm: 0 }} >\n              <IconButton\n                aria-label=\"close\"\n                onClick={() => updateAudioViewIsShow(!audioViewIsShow)}\n                className='app-region-no-drag'\n              >\n                <KeyboardArrowDownOutlined />\n              </IconButton>\n            </Grid>\n\n            <Grid size={6} pr={{ xs: 1, sm: 0 }} sx={{ display: 'flex', justifyContent: 'flex-end' }}>\n              <IconButton\n                aria-label=\"PlayQueue\"\n                onClick={() => updatePlayQueueIsShow(true)}\n                className='app-region-no-drag'\n              >\n                <QueueMusicOutlined />\n              </IconButton>\n              <IconButton\n                aria-label=\"NoBackground\"\n                onClick={() => updateBackgroundIsShow(!backgroundIsShow)}\n                className='app-region-no-drag'\n              >\n                <PanoramaOutlined style={!backgroundIsShow ? { color: '#aaa' } : {}} />\n              </IconButton>\n              <IconButton\n                aria-label=\"Full\"\n                onClick={() => handleClickFullscreen()}\n                className='app-region-no-drag'\n              >\n                {\n                  fullscreen\n                    ? <CloseFullscreen style={{ height: 20, width: 20 }} />\n                    : <OpenInFull style={{ height: 20, width: 20 }} />\n                }\n              </IconButton>\n              <PlayerMenu player={player} />\n            </Grid>\n\n            {/* 封面和音频信息 */}\n            <Grid container\n              size={12}\n              maxWidth={'lg'}\n              height={{ xs: 'calc(100dvh - 4rem - env(titlebar-area-height, 0px))', sm: 'auto' }}\n              flexDirection={{ xs: 'column', sm: 'row' }}\n              wrap='nowrap'\n              justifyContent={{ xs: 'end', sm: 'space-evenly' }}\n              alignItems={'center'}\n              pl={{ xs: 0, sm: 1 }}\n              pr={{ xs: 0, sm: 1 }}\n              pb={{ xs: 3, sm: 0 }}\n              gap={{ xs: 3, sm: 3 }}\n            >\n              {/* 封面 */}\n              <Grid\n                container\n                size={{ xs: 12, sm: 4 }}\n                flexGrow={1}\n                justifyContent={'center'}\n                alignItems={'center'}\n                overflow={'hidden'}\n              >\n                <img\n                  src={cover === './cover.svg' ? './cover.webp' : cover}\n                  alt='Cover'\n                  style={{\n                    height: '100%',\n                    maxHeight: '70dvh',\n                    width: '100%',\n                    objectFit: 'contain',\n                  }}\n                />\n              </Grid>\n\n              {/* 音频信息 */}\n              <Grid size={{ xs: 12, sm: 8 }} pl={{ xs: 0, lg: 5 }} textAlign={'center'}>\n                <Grid size={12} pl={4} pr={4} >\n                  <Typography variant=\"h6\" component=\"div\" textAlign={'center'} noWrap>\n                    {(!playQueue || !currentMetaData) ? 'Not playing' : currentMetaData.title}\n                  </Typography>\n                  <Typography variant=\"body1\" component=\"div\" textAlign={'center'} noWrap>\n                    {(playQueue && currentMetaData) && currentMetaData.artist}\n                  </Typography>\n                  <Typography variant=\"body1\" component=\"div\" textAlign={'center'} noWrap>\n                    {(playQueue && currentMetaData) && currentMetaData.album}\n                  </Typography>\n                </Grid>\n\n                {/* 播放进度条 */}\n                <Grid size={12} pl={{ xs: 3, sm: 0 }} pr={{ xs: 3, sm: 0 }} >\n                  <Slider\n                    size=\"small\"\n                    min={0}\n                    max={1000}\n                    value={(!duration) ? 0 : currentTime / duration * 1000}\n                    onChange={(_, current) => handleTimeRangeonChange(current)}\n                    sx={{ color: '#fff', width: '100%' }}\n                  />\n                  <Typography style={{ color: '#fff' }} sx={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between' }} >\n                    <span>{timeShift(currentTime)}</span>\n                    <span>{timeShift((duration) ? duration : 0)}</span>\n                  </Typography>\n                </Grid>\n\n                <Grid size={12} sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', wrap: 'nowrap' }}>\n                  <IconButton aria-label=\"shuffle\" onClick={() => handleClickShuffle()}>\n                    <Shuffle sx={{ height: 28, width: 28 }} style={(shuffle) ? { color: '#fff' } : { color: '#ccc' }} />\n                  </IconButton>\n                  <IconButton aria-label=\"previous\" onClick={() => handleClickPrev()} >\n                    <SkipPrevious sx={{ height: 48, width: 48 }} />\n                  </IconButton>\n                  <IconButton aria-label=\"backward\" sx={{ display: { sm: 'inline-grid', xs: 'none' } }} onClick={() => handleClickSeekbackward(10)} >\n                    <FastRewind sx={{ height: 32, width: 32 }} />\n                  </IconButton>\n                  {\n                    (!isLoading && player?.paused) &&\n                    <IconButton aria-label=\"play\" onClick={() => handleClickPlay()}>\n                      <PlayCircleOutlined sx={{ height: 64, width: 64 }} />\n                    </IconButton>\n                  }\n                  {\n                    (!isLoading && !player?.paused) &&\n                    <IconButton aria-label=\"pause\" onClick={() => handleClickPause()}>\n                      <PauseCircleOutlined sx={{ height: 64, width: 64 }} />\n                    </IconButton>\n                  }\n                  {\n                    isLoading &&\n                    <Box sx={{ height: 80, width: 80, padding: '13px', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>\n                      <CircularProgress color=\"inherit\" size={54} />\n                    </Box>\n                  }\n                  <IconButton aria-label=\"forward\" sx={{ display: { sm: 'inline-grid', xs: 'none' } }} onClick={() => handleClickSeekforward(10)} >\n                    <FastForward sx={{ height: 32, width: 32 }} />\n                  </IconButton>\n                  <IconButton aria-label=\"next\" onClick={handleClickNext} >\n                    <SkipNext sx={{ height: 48, width: 48 }} />\n                  </IconButton>\n                  <IconButton aria-label=\"repeat\" onClick={() => handleClickRepeat()} >\n                    {\n                      (repeat === 'one')\n                        ? <RepeatOne sx={{ height: 28, width: 28 }} />\n                        : <Repeat sx={{ height: 28, width: 28 }} style={(repeat === 'off') ? { color: '#ccc' } : {}} />\n                    }\n\n                  </IconButton>\n                </Grid>\n\n              </Grid>\n            </Grid>\n\n          </Grid>\n        </Container>\n      </Box>\n\n    </animated.div>\n\n  )\n}\n\nexport default Classic"
  },
  {
    "path": "src/pages/Player/Audio/Modern.tsx",
    "content": "import { Box, CircularProgress, Container, IconButton, Slider, Tab, Tabs, Tooltip, Typography, useMediaQuery, useTheme } from '@mui/material'\nimport Grid from '@mui/material/Grid'\nimport useFullscreen from '@/hooks/ui/useFullscreen'\nimport KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded'\nimport CloseFullscreenRoundedIcon from '@mui/icons-material/CloseFullscreenRounded'\nimport OpenInFullRoundedIcon from '@mui/icons-material/OpenInFullRounded'\nimport ShuffleRoundedIcon from '@mui/icons-material/ShuffleRounded'\nimport SkipPreviousRoundedIcon from '@mui/icons-material/SkipPreviousRounded'\nimport FastRewindRoundedIcon from '@mui/icons-material/FastRewindRounded'\nimport PlayCircleOutlineRoundedIcon from '@mui/icons-material/PlayCircleOutlineRounded'\nimport PauseCircleOutlineRoundedIcon from '@mui/icons-material/PauseCircleOutlineRounded'\nimport FastForwardRoundedIcon from '@mui/icons-material/FastForwardRounded'\nimport SkipNextRoundedIcon from '@mui/icons-material/SkipNextRounded'\nimport RepeatOneRoundedIcon from '@mui/icons-material/RepeatOneRounded'\nimport RepeatRoundedIcon from '@mui/icons-material/RepeatRounded'\nimport QueueMusicRoundedIcon from '@mui/icons-material/QueueMusicRounded'\nimport LyricsRoundedIcon from '@mui/icons-material/LyricsRounded'\nimport { SpringValue, animated, useSpring } from '@react-spring/web'\nimport { useMemo, useState } from 'react'\nimport { t } from '@lingui/macro'\nimport usePlayerControl from '@/hooks/player/usePlayerControl'\nimport usePlayQueueStore from '@/store/usePlayQueueStore'\nimport usePlayerStore from '@/store/usePlayerStore'\nimport useUiStore from '@/store/useUiStore'\nimport PlayerMenu from '../PlayerMenu'\nimport { timeShift } from '@/utils'\nimport { useShallow } from 'zustand/shallow'\nimport Lyrics from '@/components/Lyrics/Lyrics'\nimport VolumeControl from '../VolumeControl'\n\nconst Modern = ({ player, styles }: { player: HTMLVideoElement | null, styles: { borderRadius: SpringValue<string> } }) => {\n\n  const theme = useTheme()\n\n  const playQueue = usePlayQueueStore.use.playQueue()\n\n  const [\n    audioViewIsShow,\n    fullscreen,\n    shuffle,\n    repeat,\n    coverColor,\n    lyricsIsShow,\n    updateAudioViewIsShow,\n    updatePlayQueueIsShow,\n    updateLyricsIsShow,\n  ] = useUiStore(\n    useShallow(\n      (state) => [\n        state.audioViewIsShow,\n        state.fullscreen,\n        state.shuffle,\n        state.repeat,\n        state.coverColor,\n        state.lyricsIsShow,\n        state.updateAudioViewIsShow,\n        state.updatePlayQueueIsShow,\n        state.updateLyricsIsShow,\n      ]\n    )\n  )\n\n  const [\n    currentMetaData,\n    isLoading,\n    cover,\n    currentTime,\n    duration\n  ] = usePlayerStore(\n    useShallow(\n      (state) => [\n        state.currentMetaData,\n        state.isLoading,\n        state.cover,\n        state.currentTime,\n        state.duration,\n      ]\n    )\n  )\n\n  const {\n    handleClickPlay,\n    handleClickPause,\n    handleClickNext,\n    handleClickPrev,\n    handleClickSeekforward,\n    handleClickSeekbackward,\n    handleTimeRangeonChange,\n    handleClickShuffle,\n    handleClickRepeat,\n  } = usePlayerControl(player)\n\n  const { handleClickFullscreen } = useFullscreen()\n\n  const [{ background }, api] = useSpring(\n    () => ({\n      background: `linear-gradient(180deg, ${coverColor}33, ${coverColor}15, ${coverColor}05), ${theme.palette.background.default}`,\n    })\n  )\n  useMemo(\n    () => api.start({\n      background: `linear-gradient(180deg, ${coverColor}33, ${coverColor}15, ${coverColor}05), ${theme.palette.background.default}`\n    }),\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [coverColor, theme.palette.background.default]\n  )\n\n  const isMobile = useMediaQuery('(max-height: 600px) or (max-width: 600px)')\n\n  const [currentTab, setCurrentTab] = useState(0)\n\n  return (\n    <animated.div\n      style={{\n        width: '100%',\n        height: '100%',\n        background: background,\n        ...styles,\n      }}\n    >\n      <Container\n        maxWidth={'xl'}\n        disableGutters={true}\n        className={fullscreen ? '' : 'pt-titlebar-area-height'}\n        sx={{\n          height: '100%',\n        }}\n      >\n\n        <Grid\n          container\n          sx={{\n            flexDirection: 'column',\n            flexGrow: 1,\n            flexWrap: 'nowrap',\n            width: '100%',\n            height: '100%',\n            padding: '1rem',\n          }}\n        >\n\n          <Grid\n            container\n            sx={{\n              flexDirection: 'row',\n              justifyContent: 'space-between',\n              width: '100%',\n              height: 'auto',\n            }}>\n\n            <Tooltip title={t`Close`}>\n              <IconButton aria-label=\"close\" onClick={() => updateAudioViewIsShow(!audioViewIsShow)}>\n                <KeyboardArrowDownRoundedIcon />\n              </IconButton>\n            </Tooltip>\n\n            <Grid\n              container\n              sx={{\n                flexDirection: 'row',\n                justifyContent: 'flex-end',\n                alignItems: 'center',\n                gap: '0.25rem',\n              }}\n            >\n\n              {\n                !isMobile &&\n                <Tooltip title={t`Play queue`}>\n                  <IconButton\n                    aria-label=\"PlayQueue\"\n                    onClick={() => updatePlayQueueIsShow(true)}\n                    className='app-region-no-drag'\n                  >\n                    <QueueMusicRoundedIcon />\n                  </IconButton>\n                </Tooltip>\n              }\n\n              {!isMobile && <VolumeControl />}\n\n              {\n                !isMobile &&\n                <Tooltip title={t`Lyrics`}>\n                  <IconButton\n                    aria-label=\"Lyrics\"\n                    onClick={() => updateLyricsIsShow(!lyricsIsShow)}\n                    className='app-region-no-drag'\n                  >\n                    <LyricsRoundedIcon\n                      style={\n                        lyricsIsShow\n                          ? { height: 20, width: 20 }\n                          : { height: 20, width: 20, color: '#aaa' }\n                      }\n                    />\n                  </IconButton>\n                </Tooltip>\n              }\n\n              <Tooltip title={t`Fullscreen`}>\n                <IconButton\n                  aria-label=\"Full\"\n                  onClick={() => handleClickFullscreen()}\n                  className='app-region-no-drag'\n                >\n                  {\n                    fullscreen\n                      ? <CloseFullscreenRoundedIcon style={{ height: 20, width: 20 }} />\n                      : <OpenInFullRoundedIcon style={{ height: 20, width: 20 }} />\n                  }\n                </IconButton>\n              </Tooltip>\n\n              <PlayerMenu player={player} />\n            </Grid>\n          </Grid>\n\n          <Box\n            sx={{\n              width: '100%',\n              height: '100%',\n              overflow: 'hidden',\n              display: 'grid',\n              gridTemplateColumns: { xs: '1fr', sm: '3fr 4fr' },\n              gridTemplateRows: { xs: '1fr 1fr auto', sm: '1fr' },\n              // gap: { xs: '0', sm: '1rem' },\n              alignItems: 'center',\n              justifyContent: 'center',\n            }}\n          >\n\n            {/* 封面 */}\n            <Box\n              sx={{\n                aspectRatio: '1/1',\n                maxWidth: '100%',\n                maxHeight: '100%',\n                minHeight: '5rem',\n                minWidth: '5rem',\n                overflow: 'hidden',\n                padding: '1rem',\n                gridRow: { xs: '1', sm: isMobile ? '1 / 3' : '1' },\n                zIndex: 1,\n              }}>\n              <img\n                src={cover}\n                alt='Cover'\n                style={{\n                  height: '100%',\n                  width: '100%',\n                  objectFit: 'cover',\n                  borderRadius: '0.5rem',\n                }}\n              />\n            </Box>\n\n            {/* 歌词 */}\n            {\n              ((!isMobile && lyricsIsShow) || (isMobile && currentTab === 1)) &&\n              <Box\n                sx={{\n                  gridRow: { xs: 'auto', sm: isMobile ? 'auto' : '1 / 3' },\n                  overflow: 'hidden',\n                  height: '100%',\n                  padding: '1rem',\n                  pointerEvents: 'none',\n                }}\n              >\n                {\n                  currentMetaData && currentMetaData.lyrics\n                    ? <Lyrics lyrics={currentMetaData.lyrics} currentTime={currentTime} />\n                    : <div\n                      style={{\n                        height: '100%',\n                        width: '100%',\n                        display: 'flex',\n                        justifyContent: 'center',\n                        alignItems: 'center',\n                      }}\n                    >\n                      <span>{t`No lyrics`}</span>\n                    </div>\n                }\n              </Box>\n            }\n\n            {/* 播放控制 */}\n            {\n              (!isMobile || (isMobile && currentTab === 0)) &&\n              <Box\n                sx={{\n                  // gridColumn: { xs: 'auto', sm: '1 / 3' },\n                  display: 'flex',\n                  flexDirection: 'column',\n                  width: '100%',\n                  overflow: 'hidden',\n                  padding: '1rem',\n                  paddingBottom: '0',\n                }}\n              >\n\n                <Box sx={{ width: '100%', textOverflow: 'ellipsis' }}>\n                  <Typography variant=\"h5\" component=\"div\" noWrap>\n                    {(!playQueue || !currentMetaData) ? 'Not playing' : currentMetaData.title}\n                  </Typography>\n                  <Typography variant=\"subtitle2\" color={theme.palette.text.secondary} component=\"div\" noWrap sx={{ minHeight: '22px' }}>\n                    {(playQueue && currentMetaData) ? currentMetaData.artist : ''}\n                  </Typography>\n                  <Typography variant=\"subtitle1\" color={theme.palette.text.secondary} component=\"div\" noWrap sx={{ minHeight: '28px' }}>\n                    {(playQueue && currentMetaData) ? currentMetaData.album : ''}\n                  </Typography>\n                </Box>\n\n                <Slider\n                  size=\"small\"\n                  min={0}\n                  max={1000}\n                  value={(!duration) ? 0 : currentTime / duration * 1000}\n                  onChange={(_, current) => handleTimeRangeonChange(current)}\n                  sx={{\n                    width: '100%',\n                    height: '0.25rem',\n                  }}\n                />\n                <Typography sx={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', width: '100%' }} >\n                  <span>{timeShift(currentTime)}</span>\n                  <span>{timeShift((duration) ? duration : 0)}</span>\n                </Typography>\n\n                <Box\n                  sx={{\n                    display: 'flex',\n                    justifyContent: 'center',\n                    alignItems: 'center',\n                    wrap: 'nowrap',\n                    width: '100%'\n                  }}\n                >\n                  <IconButton aria-label=\"shuffle\" onClick={() => handleClickShuffle()}>\n                    <ShuffleRoundedIcon sx={{ height: 28, width: 28 }} style={(shuffle) ? {} : { color: '#aaa' }} />\n                  </IconButton>\n                  <IconButton aria-label=\"previous\" onClick={() => handleClickPrev()} >\n                    <SkipPreviousRoundedIcon sx={{ height: 48, width: 48 }} />\n                  </IconButton>\n                  <IconButton aria-label=\"backward\" sx={{ display: { md: 'inline-grid', xs: 'none' } }} onClick={() => handleClickSeekbackward(10)} >\n                    <FastRewindRoundedIcon sx={{ height: 32, width: 32 }} />\n                  </IconButton>\n                  {\n                    (!isLoading && player?.paused) &&\n                    <IconButton aria-label=\"play\" onClick={() => handleClickPlay()}>\n                      <PlayCircleOutlineRoundedIcon sx={{ height: 64, width: 64 }} />\n                    </IconButton>\n                  }\n                  {\n                    (!isLoading && !player?.paused) &&\n                    <IconButton aria-label=\"pause\" onClick={() => handleClickPause()}>\n                      <PauseCircleOutlineRoundedIcon sx={{ height: 64, width: 64 }} />\n                    </IconButton>\n                  }\n                  {\n                    isLoading &&\n                    <Box sx={{ height: 80, width: 80, padding: '13px', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>\n                      <CircularProgress color=\"inherit\" size={54} />\n                    </Box>\n                  }\n                  <IconButton aria-label=\"forward\" sx={{ display: { md: 'inline-grid', xs: 'none' } }} onClick={() => handleClickSeekforward(10)} >\n                    <FastForwardRoundedIcon sx={{ height: 32, width: 32 }} />\n                  </IconButton>\n                  <IconButton aria-label=\"next\" onClick={handleClickNext} >\n                    <SkipNextRoundedIcon sx={{ height: 48, width: 48 }} />\n                  </IconButton>\n                  <IconButton aria-label=\"repeat\" onClick={() => handleClickRepeat()} >\n                    {\n                      (repeat === 'one')\n                        ? <RepeatOneRoundedIcon sx={{ height: 28, width: 28 }} />\n                        : <RepeatRoundedIcon sx={{ height: 28, width: 28 }} style={(repeat === 'off') ? { color: '#aaa' } : {}} />\n                    }\n                  </IconButton>\n                </Box>\n\n              </Box>\n            }\n\n            {\n              isMobile &&\n              <Box\n                sx={{\n                  display: 'flex',\n                  flexDirection: 'row',\n                  justifyContent: 'space-evenly',\n                  alignItems: 'center',\n                  width: '100%',\n                  gridColumn: { xs: 'auto', sm: '2 / 3' },\n                }}\n              >\n                <VolumeControl />\n\n                <Tabs\n                  value={currentTab}\n                  onChange={(_, newValue) => setCurrentTab(newValue)}\n                  aria-label=\"player-tab\"\n                  sx={{ '& .MuiTab-root': { padding: 0, minWidth: '3rem' } }}\n                >\n                  <Tab icon={<PlayCircleOutlineRoundedIcon />} aria-label=\"play\" />\n                  <Tab icon={<LyricsRoundedIcon />} aria-label=\"lyrics\" />\n                </Tabs>\n\n                <IconButton\n                  aria-label=\"PlayQueue\"\n                  onClick={() => updatePlayQueueIsShow(true)}\n                  className='app-region-no-drag'\n                >\n                  <QueueMusicRoundedIcon />\n                </IconButton>\n\n              </Box>\n            }\n          </Box>\n\n        </Grid>\n\n      </Container>\n    </animated.div>\n  )\n}\n\nexport default Modern"
  },
  {
    "path": "src/pages/Player/PlayQueue.tsx",
    "content": "import { Box, Button, Drawer, useTheme } from '@mui/material'\nimport KeyboardArrowRightRoundedIcon from '@mui/icons-material/KeyboardArrowRightRounded'\nimport usePlayQueueStore from '@/store/usePlayQueueStore'\nimport useUiStore from '@/store/useUiStore'\nimport CommonList from '@/components/CommonList/CommonList'\nimport usePlayerStore from '@/store/usePlayerStore'\nimport { useShallow } from 'zustand/shallow'\nimport useStyles from '@/hooks/ui/useStyles'\n\nconst PlayQueue = () => {\n\n  const theme = useTheme()\n  const styles = useStyles(theme)\n\n  const playQueue = usePlayQueueStore.use.playQueue()\n  const currentIndex = usePlayQueueStore.use.currentIndex()\n  const updateCurrentIndex = usePlayQueueStore.use.updateCurrentIndex()\n  const updatePlayQueue = usePlayQueueStore.use.updatePlayQueue()\n\n  const [\n    playQueueIsShow,\n    updatePlayQueueIsShow\n  ] = useUiStore(\n    useShallow(\n      (state) => [\n        state.playQueueIsShow,\n        state.updatePlayQueueIsShow,\n      ]\n    )\n  )\n\n  const updateAutoPlay = usePlayerStore(state => state.updateAutoPlay)\n\n  const open = (index: number) => {\n    if (playQueue) {\n      updateAutoPlay(true)\n      updateCurrentIndex(playQueue[index].index)\n    }\n  }\n\n  const remove = (indexArray: number[]) =>\n    updatePlayQueue(playQueue?.filter(item => !indexArray.map(index => playQueue[index].index).filter(index => index !== currentIndex).includes(item.index)) || [])\n\n  return (\n    <Drawer\n      anchor={'right'}\n      open={playQueueIsShow}\n      onClose={() => updatePlayQueueIsShow(false)}\n      sx={{\n        '& .MuiDrawer-paper': {\n          width: { xs: 'calc(100vw - 0.5rem)', sm: '400px' }\n        },\n        ...styles.scrollbar\n      }}\n    >\n      <Box sx={{ display: 'flex', flexDirection: 'column', height: '100%', }} >\n        <Box sx={{ overflowY: 'auto', flexGrow: 1 }}>\n          {\n            playQueue &&\n            <CommonList\n              listData={playQueue}\n              listType='playQueue'\n              activeIndex={playQueue?.findIndex((item) => item.index === currentIndex)}\n              scrollIndex={playQueue?.findIndex((item) => item.index === currentIndex)}\n              func={{ open, remove }}\n            />\n          }\n        </Box>\n        <Box sx={{ width: '100%', flexGrow: 0, borderTop: `1px solid ${theme.palette.divider}` }}>\n          <Button fullWidth size='large' onClick={() => updatePlayQueueIsShow(false)}>\n            <KeyboardArrowRightRoundedIcon />\n          </Button>\n        </Box>\n      </Box>\n    </Drawer>\n  )\n}\n\nexport default PlayQueue"
  },
  {
    "path": "src/pages/Player/Player.tsx",
    "content": "import { useRef } from 'react'\nimport { Box } from '@mui/material'\nimport useUiStore from '@/store/useUiStore'\nimport useMediaSession from '@/hooks/player/useMediaSession'\nimport usePlayerCore from '@/hooks/player/usePlayerCore'\nimport VideoPlayer from './VideoPlayer'\nimport Audio from './Audio/Audio'\nimport PlayerControl from './PlayerControl'\nimport PlayQueue from './PlayQueue'\nimport VideoPlayerTopbar from './VideoPlayerTopbar'\n\nconst Player = () => {\n\n  const controlIsShow = useUiStore((state) => state.controlIsShow)\n\n  const playerRef = useRef<HTMLVideoElement>(null)\n  const player = playerRef.current   // 声明播放器对象\n\n  const { url, onEnded } = usePlayerCore(player)\n\n  // 向 mediaSession 发送当前播放进度\n  useMediaSession(player)\n\n  return (\n    <>\n      <VideoPlayer url={url} onEnded={onEnded} ref={playerRef} />\n      <VideoPlayerTopbar />\n      <Box\n        sx={{\n          position: 'fixed',\n          padding: '0 0.5rem 0.5rem 0.5rem',\n          transform: controlIsShow ? 'none' : 'translateY(8rem)',\n          transition: 'all 0.2s ease-out',\n          bottom: 0,\n          width: '100%',\n        }}\n      >\n        <PlayerControl player={player} />\n      </Box>\n      <Audio player={player} />\n      <PlayQueue />\n    </>\n  )\n}\n\nexport default Player"
  },
  {
    "path": "src/pages/Player/PlayerControl.tsx",
    "content": "import { Box, ButtonBase, CircularProgress, Container, IconButton, Paper, Slider, Tooltip, Typography, useTheme } from '@mui/material'\nimport Grid from '@mui/material/Grid'\nimport CloseFullscreenRoundedIcon from '@mui/icons-material/CloseFullscreenRounded'\nimport OpenInFullRoundedIcon from '@mui/icons-material/OpenInFullRounded'\nimport ShuffleRoundedIcon from '@mui/icons-material/ShuffleRounded'\nimport SkipPreviousRoundedIcon from '@mui/icons-material/SkipPreviousRounded'\nimport FastRewindRoundedIcon from '@mui/icons-material/FastRewindRounded'\nimport PlayCircleOutlineRoundedIcon from '@mui/icons-material/PlayCircleOutlineRounded'\nimport PauseCircleOutlineRoundedIcon from '@mui/icons-material/PauseCircleOutlineRounded'\nimport FastForwardRoundedIcon from '@mui/icons-material/FastForwardRounded'\nimport SkipNextRoundedIcon from '@mui/icons-material/SkipNextRounded'\nimport RepeatOneRoundedIcon from '@mui/icons-material/RepeatOneRounded'\nimport RepeatRoundedIcon from '@mui/icons-material/RepeatRounded'\nimport PlaylistPlayRoundedIcon from '@mui/icons-material/PlaylistPlayRounded'\nimport usePlayQueueStore from '@/store/usePlayQueueStore'\nimport usePlayerStore from '@/store/usePlayerStore'\nimport useUiStore from '@/store/useUiStore'\nimport useFullscreen from '@/hooks/ui/useFullscreen'\nimport usePlayerControl from '@/hooks/player/usePlayerControl'\nimport { checkFileType, timeShift } from '@/utils'\nimport PlayerMenu from './PlayerMenu'\nimport VolumeControl from './VolumeControl'\nimport { useEffect, useMemo } from 'react'\nimport useControlHide from '@/hooks/ui/useControlHide'\nimport { useShallow } from 'zustand/shallow'\nimport { t } from '@lingui/macro'\n\nconst PlayerControl = ({ player }: { player: HTMLVideoElement | null }) => {\n\n  const theme = useTheme()\n\n  const iconStyles = {\n    small: { width: 20, height: 20 },\n    large: { width: 38, height: 38 }\n  }\n\n  const playQueue = usePlayQueueStore.use.playQueue()\n  const currentIndex = usePlayQueueStore.use.currentIndex()\n\n  const [\n    audioViewIsShow,\n    videoViewIsShow,\n    playQueueIsShow,\n    fullscreen,\n    shuffle,\n    repeat,\n    updateAudioViewIsShow,\n    updateVideoViewIsShow,\n    updatePlayQueueIsShow,\n  ] = useUiStore(\n    useShallow(\n      (state) => [\n        state.audioViewIsShow,\n        state.videoViewIsShow,\n        state.playQueueIsShow,\n        state.fullscreen,\n        state.shuffle,\n        state.repeat,\n        state.updateAudioViewIsShow,\n        state.updateVideoViewIsShow,\n        state.updatePlayQueueIsShow,\n      ]\n    )\n  )\n\n  const [\n    currentMetaData,\n    isLoading,\n    cover,\n    currentTime,\n    duration,\n  ] = usePlayerStore(\n    useShallow(\n      (state) => [\n        state.currentMetaData,\n        state.isLoading,\n        state.cover,\n        state.currentTime,\n        state.duration,\n      ]\n    )\n  )\n\n  const {\n    handleClickPlay,\n    handleClickPause,\n    handleClickNext,\n    handleClickPrev,\n    handleClickSeekforward,\n    handleClickSeekbackward,\n    handleTimeRangeonChange,\n    handleClickShuffle,\n    handleClickRepeat,\n  } = usePlayerControl(player)\n\n  const { handleClickFullscreen } = useFullscreen()\n\n  const currentFile = playQueue?.find(item => item.index === currentIndex)\n  const type = useMemo(() => currentFile && checkFileType(currentFile.fileName) === 'video' ? 'video' : 'audio', [currentFile])\n\n  const handleClickMediaInfo = () => {\n    if (type === 'audio')\n      updateAudioViewIsShow(true)\n    if (type === 'video')\n      updateVideoViewIsShow(!videoViewIsShow)\n  }\n\n  useControlHide(type || 'audio')  // 播放视频时自动隐藏ui\n\n  // 根据格式自动切换\n  useEffect(\n    () => {\n      if (type === 'audio' && videoViewIsShow) {\n        updateVideoViewIsShow(false)\n        updateAudioViewIsShow(true)\n      }\n      if (type === 'video' && audioViewIsShow) {\n        updateAudioViewIsShow(false)\n        updateVideoViewIsShow(true)\n      }\n    },\n    [audioViewIsShow, type, updateAudioViewIsShow, updateVideoViewIsShow, videoViewIsShow]\n  )\n\n  return (\n    <Container maxWidth={'xl'} disableGutters={true}>\n      <Paper\n        sx={{\n          backgroundColor: `${theme.palette.background.paper}99`,\n          backdropFilter: 'blur(16px)',\n          width: '100%',\n        }}\n      >\n        <Grid container\n          sx={{ justifyContent: 'space-between', alignItems: 'center', textAlign: 'center', }}\n        >\n          {/* 播放进度 */}\n          {/* <Grid xs={12}> */}\n          <Grid\n            container\n            size={12}\n            pl={{ xs: 0, sm: 1 }}\n            pr={{ xs: 0, sm: 1 }}\n            sx={{ justifyContent: 'space-between', alignItems: 'center', textAlign: 'center' }}>\n            <Grid\n              size='auto'\n              sx={{ display: { sm: 'inline-grid', xs: 'none' } }}\n            >\n              <Typography\n                component='div'\n                color='text.secondary'\n              >\n                {timeShift(currentTime)}\n              </Typography>\n            </Grid >\n            <Grid\n              size='grow'\n              pl={{ xs: 1, sm: 2 }}\n              pr={{ xs: 1, sm: 2 }}\n            >\n              <Slider\n                size='small'\n                min={0}\n                max={1000}\n                value={(!duration) ? 0 : currentTime / duration * 1000}\n                onChange={(_, current) => handleTimeRangeonChange(current)}\n                sx={{\n                  padding: '12px 0 !important',\n                  height: '0.25rem',\n                }}\n              />\n            </Grid>\n            <Grid\n              size='auto'\n              sx={{ display: { sm: 'inline-grid', xs: 'none' } }}\n            >\n              <Typography\n                component='div'\n                color='text.secondary'\n              >\n                {timeShift((duration) ? duration : 0)}\n              </Typography>\n            </Grid>\n          </Grid>\n\n          <Grid container size={12} wrap={'nowrap'} sx={{ alignItems: 'center' }} >\n            {/* 媒体信息 */}\n            <Grid\n              container\n              size='grow'\n              textAlign={'left'}\n              minWidth={0}\n            >\n              <ButtonBase\n                sx={{ height: '4rem', width: '100%', borderRadius: '0.5rem' }}\n                onClick={() => handleClickMediaInfo()}>\n                <Grid size='grow' container sx={{ justifyContent: 'space-between', alignItems: 'center', textAlign: 'left', overflow: 'hidden', flexGrow: 'nowrap' }}>\n                  <Grid size=\"auto\" sx={{ width: '4rem', height: '4rem', padding: '0.5rem', display: type === 'video' ? 'none' : 'flex' }}>\n                    {\n                      (type === 'audio') &&\n                      <img\n                        src={cover}\n                        alt='Cover'\n                        style={{\n                          width: '100%',\n                          height: '100%',\n                          objectFit: 'cover',\n                          borderRadius: '0.5rem',\n                        }}\n                      />\n                    }\n                  </Grid>\n                  <Grid size='grow' sx={{ pl: 1 }} minWidth={0}>\n                    <Typography variant=\"body1\" component=\"div\" noWrap>\n                      {(!playQueue || !currentMetaData) ? 'Not playing' : currentMetaData.title}\n                    </Typography>\n                    <div>\n                      {\n                        (!playQueue || !currentMetaData) ||\n                        <Typography variant=\"subtitle1\" color=\"text.secondary\" component=\"div\" noWrap>\n                          {currentMetaData.artist && currentMetaData.artist}{currentMetaData.album && ` • ${currentMetaData.album}`}\n                        </Typography>\n                      }\n                    </div>\n                  </Grid>\n                </Grid>\n              </ButtonBase>\n            </Grid>\n\n            {/* 基本控制按钮 */}\n            <Grid container size={{ xs: 5, sm: 'auto' }} wrap='nowrap' paddingX={{ xs: 0, sm: 1 }} sx={{ justifyContent: 'center', alignItems: 'center', }} >\n              <IconButton\n                sx={{ display: { sm: 'inline-grid', xs: 'none' } }}\n                aria-label=\"shuffle\"\n                onClick={() => handleClickShuffle()}\n              >\n                <ShuffleRoundedIcon sx={iconStyles.small} style={(shuffle) ? {} : { color: '#aaa' }} />\n              </IconButton>\n\n              <IconButton aria-label=\"previous\" onClick={handleClickPrev} >\n                <SkipPreviousRoundedIcon />\n              </IconButton>\n\n              <IconButton\n                sx={{ display: { md: 'inline-grid', xs: 'none' } }}\n                aria-label=\"backward\"\n                onClick={() => handleClickSeekbackward(10)}\n              >\n                <FastRewindRoundedIcon sx={iconStyles.small} />\n              </IconButton>\n\n              {\n                (!isLoading && player?.paused) &&\n                <IconButton aria-label=\"play\" onClick={() => handleClickPlay()}>\n                  <PlayCircleOutlineRoundedIcon sx={iconStyles.large} />\n                </IconButton>\n              }\n              {\n                (!isLoading && !player?.paused) &&\n                <IconButton aria-label=\"pause\" onClick={() => handleClickPause()}>\n                  <PauseCircleOutlineRoundedIcon sx={iconStyles.large} />\n                </IconButton>\n              }\n              {\n                isLoading &&\n                <Box sx={{ padding: '11px', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>\n                  <CircularProgress style={{ color: '#666' }} size={32} />\n                </Box>\n              }\n\n              <IconButton\n                sx={{ display: { md: 'inline-grid', xs: 'none' } }}\n                aria-label=\"forward\"\n                onClick={() => handleClickSeekforward(10)}\n              >\n                <FastForwardRoundedIcon sx={iconStyles.small} />\n              </IconButton>\n\n              <IconButton aria-label=\"next\" onClick={handleClickNext} >\n                <SkipNextRoundedIcon />\n              </IconButton>\n\n              <IconButton\n                sx={{ display: { sm: 'inline-grid', xs: 'none' } }}\n                aria-label=\"repeat\"\n                onClick={() => handleClickRepeat()}\n              >\n                {\n                  (repeat === 'one')\n                    ? <RepeatOneRoundedIcon sx={iconStyles.small} />\n                    : <RepeatRoundedIcon sx={iconStyles.small} style={(repeat === 'off') ? { color: '#aaa' } : {}} />\n                }\n              </IconButton>\n            </Grid>\n\n            {/* 其他按钮 */}\n            <Grid\n              container\n              size='grow'\n              textAlign={'right'}\n              wrap='nowrap'\n              sx={{ display: { sm: 'block', xs: type === 'video' ? 'block' : 'none' } }}\n              pr={1}\n            >\n\n              <Tooltip title={t`Play queue`}>\n                <IconButton onClick={() => updatePlayQueueIsShow(!playQueueIsShow)} sx={{ display: { sm: 'inline-grid', xs: 'none' } }}>\n                  <PlaylistPlayRoundedIcon />\n                </IconButton>\n              </Tooltip>\n\n              <Box sx={{ display: 'inline-grid' }}>\n                <VolumeControl />\n              </Box>\n\n              <Tooltip title={t`Fullscreen`}>\n                <IconButton onClick={() => handleClickFullscreen()} sx={{ display: { sm: 'inline-grid', xs: 'none' } }} >\n                  {\n                    fullscreen\n                      ? <CloseFullscreenRoundedIcon sx={{ height: 18, width: 18 }} />\n                      : <OpenInFullRoundedIcon sx={{ height: 18, width: 18, }} />\n                  }\n                </IconButton>\n              </Tooltip>\n\n              <Box sx={{ display: 'inline-grid' }} >\n                <PlayerMenu player={player} />\n              </Box>\n            </Grid>\n\n          </Grid>\n\n        </Grid>\n      </Paper>\n    </Container >\n  )\n}\n\nexport default PlayerControl"
  },
  {
    "path": "src/pages/Player/PlayerMenu.tsx",
    "content": "import useUiStore from '@/store/useUiStore'\nimport MoreVertRoundedIcon from '@mui/icons-material/MoreVertRounded'\nimport SyncAltRoundedIcon from '@mui/icons-material/SyncAltRounded'\nimport SpeedRoundedIcon from '@mui/icons-material/SpeedRounded'\nimport NavigateBeforeRoundedIcon from '@mui/icons-material/NavigateBeforeRounded'\nimport NavigateNextRoundedIcon from '@mui/icons-material/NavigateNextRounded'\nimport CheckRoundedIcon from '@mui/icons-material/CheckRounded'\nimport PlaylistAddRoundedIcon from '@mui/icons-material/PlaylistAddRounded'\nimport ListRoundedIcon from '@mui/icons-material/ListRounded'\nimport FolderOpenRoundedIcon from '@mui/icons-material/FolderOpenRounded'\nimport PlaylistPlayRoundedIcon from '@mui/icons-material/PlaylistPlayRounded'\nimport CloseFullscreenRoundedIcon from '@mui/icons-material/CloseFullscreenRounded'\nimport OpenInFullRoundedIcon from '@mui/icons-material/OpenInFullRounded'\nimport CloudDownloadRoundedIcon from '@mui/icons-material/CloudDownloadRounded'\nimport { Box, Button, Dialog, DialogActions, DialogTitle, IconButton, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Menu, MenuItem, Tooltip } from '@mui/material'\nimport { useMemo, useState } from 'react'\nimport { t } from '@lingui/macro'\nimport usePlayQueueStore from '@/store/usePlayQueueStore'\nimport { useNavigate } from 'react-router-dom'\nimport usePlaylistsStore from '@/store/usePlaylistsStore'\nimport shortUUID from 'short-uuid'\nimport useFullscreen from '@/hooks/ui/useFullscreen'\nimport { useShallow } from 'zustand/shallow'\nimport usePlayerStore from '@/store/usePlayerStore'\nimport useLocalMetaDataStore from '@/store/useLocalMetaDataStore'\nimport { checkFileType, getNetMetaData } from '@/utils'\n\nconst PlayerMenu = ({ player }: { player: HTMLVideoElement | null }) => {\n\n  const navigate = useNavigate()\n\n  const [\n    currentMetaData,\n    updateMetadataUpdate,\n  ] = usePlayerStore(\n    useShallow(\n      (state) => [\n        state.currentMetaData,\n        state.updateMetadataUpdate,\n      ]\n    )\n  )\n\n  const { setLocalMetaData } = useLocalMetaDataStore()\n\n  const playQueue = usePlayQueueStore.use.playQueue()\n  const currentIndex = usePlayQueueStore.use.currentIndex()\n\n  const currentFile = useMemo(() => playQueue?.find((item) => item.index === currentIndex), [currentIndex, playQueue])\n  const fileType = currentFile && checkFileType(currentFile.fileName)\n\n  const [\n    audioViewTheme,\n    playbackRate,\n    audioViewIsShow,\n    fullscreen,\n    updateFolderTree,\n    updateAudioViewTheme,\n    updatePlaybackRate,\n    updateAudioViewIsShow,\n    updateVideoViewIsShow,\n    updatePlayQueueIsShow,\n  ] = useUiStore(\n    useShallow(\n      (state) => [\n        state.audioViewTheme,\n        state.playbackRate,\n        state.audioViewIsShow,\n        state.fullscreen,\n        state.updateFolderTree,\n        state.updateAudioViewTheme,\n        state.updatePlaybackRate,\n        state.updateAudioViewIsShow,\n        state.updateVideoViewIsShow,\n        state.updatePlayQueueIsShow,\n      ]\n    )\n  )\n\n  const [\n    playlists,\n    insertPlaylist,\n    insertFilesToPlaylist,\n  ] = usePlaylistsStore(\n    useShallow(\n      (state) => [\n        state.playlists,\n        state.insertPlaylist,\n        state.insertFilesToPlaylist,\n      ]\n    )\n  )\n\n  const { handleClickFullscreen } = useFullscreen()\n\n  const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null)\n  const [menuOpen, setMenuOpen] = useState(false)\n  const [menuStatus, setMenuStatus] = useState<null | 'playbackRate' | 'audioViewTheme'>(null)\n  const [addToPlaylistDialogOpen, setAddToPlaylistDialogOpen] = useState(false)\n\n  const handleClickMenu = (event: React.MouseEvent<HTMLElement>) => {\n    setAnchorEl(event.currentTarget)\n    setMenuOpen(true)\n  }\n\n  const handleCloseMenu = () => {\n    setAnchorEl(null)\n    setMenuOpen(false)\n    setMenuStatus(null)\n  }\n\n  const handleClickOpenPlayQueue = () => {\n    setMenuOpen(false)\n    updatePlayQueueIsShow(true)\n  }\n\n  // 打开所在文件夹\n  const handleClickOpenInFolder = () => {\n    if (currentFile) {\n      updateFolderTree(currentFile.filePath.slice(0, -1))\n      navigate('/')\n      setMenuOpen(false)\n      updateAudioViewIsShow(false)\n      updateVideoViewIsShow(false)\n    }\n  }\n\n  // 新建播放列表\n  const addNewPlaylist = () => {\n    const id = shortUUID().generate()\n    insertPlaylist({ id, title: t`New playlist`, fileList: [] })\n  }\n\n  // 添加到播放列表\n  const addToPlaylist = (id: string) => {\n    if (currentFile) {\n      insertFilesToPlaylist(id, [{\n        fileName: currentFile.fileName,\n        filePath: currentFile.filePath,\n        fileSize: currentFile.fileSize,\n        fileType: currentFile.fileType,\n      }])\n      setAddToPlaylistDialogOpen(false)\n    }\n  }\n\n  const handleClickSwitchFullscreen = () => {\n    setMenuOpen(false)\n    handleClickFullscreen()\n  }\n\n  const reFetchMetadata = async () => {\n    handleCloseMenu()\n    if (!currentMetaData?.path || !player?.src) return\n    const netMetaData = await getNetMetaData(currentMetaData?.path, player?.src)\n    if (netMetaData) {\n      setLocalMetaData(netMetaData).then(() => updateMetadataUpdate())\n    }\n  }\n\n  return (\n    <>\n      <Box>\n        <Tooltip title={t`Menu`}>\n          <IconButton onClick={(event) => handleClickMenu(event)}>\n            <MoreVertRoundedIcon />\n          </IconButton>\n        </Tooltip>\n        <Menu\n          anchorEl={anchorEl}\n          open={menuOpen}\n          onClose={handleCloseMenu}\n          anchorOrigin={{\n            vertical: audioViewIsShow ? 'bottom' : 'top',\n            horizontal: 'center',\n          }}\n          transformOrigin={{\n            vertical: audioViewIsShow ? 'top' : 'bottom',\n            horizontal: 'center',\n          }}\n        >\n          {\n            // 菜单\n            (!menuStatus) &&\n            <div>\n              {\n                audioViewIsShow &&\n                <MenuItem onClick={() => setMenuStatus('audioViewTheme')}>\n                  <ListItemIcon>\n                    <SyncAltRoundedIcon />\n                  </ListItemIcon>\n                  <ListItemText primary={t`Switch theme`} />\n                  <NavigateNextRoundedIcon />\n                </MenuItem>}\n\n              <MenuItem onClick={() => setMenuStatus('playbackRate')}>\n                <Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>\n                  <ListItemIcon>\n                    <SpeedRoundedIcon />\n                  </ListItemIcon>\n                  <ListItemText primary={t`Playback rate`} />\n                </Box>\n                <Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '0.5rem', marginLeft: '0.5rem' }}>\n                  {playbackRate.toFixed(2)} <NavigateNextRoundedIcon />\n                </Box>\n              </MenuItem>\n\n              {\n                currentFile &&\n                <MenuItem onClick={handleClickOpenInFolder}>\n                  <ListItemIcon>\n                    <FolderOpenRoundedIcon />\n                  </ListItemIcon>\n                  <ListItemText primary={t`Open in folder`} />\n                </MenuItem>\n              }\n\n              <MenuItem onClick={handleClickOpenPlayQueue}>\n                <ListItemIcon>\n                  <PlaylistPlayRoundedIcon />\n                </ListItemIcon>\n                <ListItemText primary={t`Play queue`} />\n              </MenuItem>\n\n              {\n                currentFile &&\n                <MenuItem onClick={() => {\n                  setAddToPlaylistDialogOpen(true)\n                  handleCloseMenu()\n                }}>\n                  <ListItemIcon>\n                    <PlaylistAddRoundedIcon />\n                  </ListItemIcon>\n                  <ListItemText primary={t`Add to playlist`} />\n                </MenuItem>\n              }\n\n              <MenuItem onClick={handleClickSwitchFullscreen} >\n                <ListItemIcon>\n                  {fullscreen ? <CloseFullscreenRoundedIcon /> : <OpenInFullRoundedIcon />}\n                </ListItemIcon>\n                <ListItemText primary={t`Switch fullscreen`} />\n              </MenuItem>\n\n              {\n                fileType === 'audio' &&\n                <MenuItem onClick={() => reFetchMetadata()}>\n                  <ListItemIcon>\n                    <CloudDownloadRoundedIcon />\n                  </ListItemIcon>\n                  <ListItemText primary={t`Re-fetch metadata`} />\n                </MenuItem>\n              }\n            </div>\n          }\n\n          {\n            // 主题\n            (menuStatus === 'audioViewTheme') &&\n            <div>\n              <MenuItem onClick={() => setMenuStatus(null)}>\n                <ListItemIcon>\n                  <NavigateBeforeRoundedIcon />\n                </ListItemIcon>\n                <ListItemText primary={t`Switch theme`} />\n              </MenuItem>\n\n              <MenuItem\n                onClick={() => {\n                  updateAudioViewTheme('modern')\n                  setMenuStatus(null)\n                }}\n              >\n                <ListItemIcon>\n                  <CheckRoundedIcon sx={{ visibility: audioViewTheme === 'modern' ? 'visible' : 'hidden' }} />\n                </ListItemIcon>\n                {t`Modern`}\n              </MenuItem>\n\n              <MenuItem\n                onClick={() => {\n                  updateAudioViewTheme('classic')\n                  setMenuStatus(null)\n                }}\n              >\n                <ListItemIcon>\n                  <CheckRoundedIcon sx={{ visibility: audioViewTheme === 'classic' ? 'visible' : 'hidden' }} />\n                </ListItemIcon>\n                {t`Classic`}\n              </MenuItem>\n            </div>\n          }\n\n          {\n            // 播放速度\n            (menuStatus === 'playbackRate') &&\n            <div>\n              <MenuItem onClick={() => setMenuStatus(null)}>\n                <ListItemIcon>\n                  <NavigateBeforeRoundedIcon />\n                </ListItemIcon>\n                <ListItemText primary={t`Playback rate`} />\n              </MenuItem>\n              {\n                [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 3, 4].map((speed) => (\n                  <MenuItem\n                    key={speed}\n                    onClick={() => {\n                      updatePlaybackRate(speed)\n                      setMenuStatus(null)\n                    }}\n                  >\n                    <ListItemIcon>\n                      <CheckRoundedIcon sx={{ visibility: speed === playbackRate ? 'visible' : 'hidden' }} />\n                    </ListItemIcon>\n                    {speed.toFixed(2)}\n                  </MenuItem>\n                ))\n              }\n            </div>\n          }\n\n        </Menu>\n      </Box>\n\n      <Dialog\n        open={addToPlaylistDialogOpen}\n        onClose={() => setAddToPlaylistDialogOpen(false)}\n        fullWidth\n        maxWidth='xs'\n      >\n        <DialogTitle>{t`Add to playlist`}</DialogTitle>\n        <List>\n          {playlists?.map((item, index) =>\n            <ListItem\n              disablePadding\n              key={index}\n            >\n              <ListItemButton\n                sx={{ pl: 3 }}\n                onClick={() => addToPlaylist(item.id)}\n              >\n                <ListItemIcon>\n                  <ListRoundedIcon />\n                </ListItemIcon>\n                <ListItemText primary={item.title} />\n              </ListItemButton>\n            </ListItem>\n          )}\n          <ListItem disablePadding>\n            <ListItemButton\n              sx={{ pl: 3 }}\n              onClick={addNewPlaylist}\n            >\n              <ListItemIcon>\n                <PlaylistAddRoundedIcon />\n              </ListItemIcon>\n              <ListItemText primary={t`Add playlist`} />\n            </ListItemButton>\n          </ListItem>\n        </List>\n        <DialogActions>\n          <Button onClick={() => setAddToPlaylistDialogOpen(false)}>{t`Cancel`}</Button>\n        </DialogActions>\n      </Dialog>\n    </>\n\n  )\n}\n\nexport default PlayerMenu"
  },
  {
    "path": "src/pages/Player/VideoPlayer.tsx",
    "content": "import { Ref, forwardRef, useMemo } from 'react'\nimport useFullscreen from '@/hooks/ui/useFullscreen'\nimport useUiStore from '@/store/useUiStore'\nimport { animated, useSpring } from '@react-spring/web'\n\nconst VideoPlayer = forwardRef(\n  ({ url, onEnded }: { url: string; onEnded: () => void }, ref: Ref<HTMLVideoElement> | null) => {\n\n    const videoViewIsShow = useUiStore((state) => state.videoViewIsShow)\n\n    const { handleClickFullscreen } = useFullscreen()\n\n    const [{ top, borderRadius }, api] = useSpring(() => ({\n      from: {\n        top: videoViewIsShow ? '0' : '100dvh',\n        borderRadius: videoViewIsShow ? '0' : '0.5rem',\n      },\n    }))\n\n    const show = () => api.start({\n      to: { top: '0', borderRadius: '0' },\n    })\n\n    const hide = () => {\n      api.start({\n        to: { top: '100dvh' },\n      })\n    }\n\n    useMemo(\n      () => videoViewIsShow ? show() : hide(),\n      // eslint-disable-next-line react-hooks/exhaustive-deps\n      [videoViewIsShow]\n    )\n\n    return (\n      <animated.div\n        style={{\n          width: '100%',\n          height: '100dvh',\n          position: 'fixed',\n          backgroundColor: 'black',\n          top: top,\n          borderRadius: borderRadius,\n        }}\n      >\n        <video\n          width={'100%'}\n          height={'100%'}\n          src={url}\n          ref={ref}\n          onEnded={() => onEnded()}\n          onDoubleClick={() => handleClickFullscreen()}\n        />\n      </animated.div>\n    )\n  }\n)\nexport default VideoPlayer"
  },
  {
    "path": "src/pages/Player/VideoPlayerTopbar.tsx",
    "content": "import { Box, IconButton, Tooltip, useTheme } from '@mui/material'\nimport useUiStore from '@/store/useUiStore'\nimport KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded'\nimport { useShallow } from 'zustand/shallow'\nimport { t } from '@lingui/macro'\n\nconst VideoPlayerTopbar = () => {\n\n  const theme = useTheme()\n\n  const [\n    videoViewIsShow,\n    controlIsShow,\n    updateVideoViewIsShow,\n    updateControlIsShow,\n  ] = useUiStore(\n    useShallow(\n      (state) => [\n        state.videoViewIsShow,\n        state.controlIsShow,\n        state.updateVideoViewIsShow,\n        state.updateControlIsShow,\n      ]\n    )\n  )\n\n  return (\n    <div style={{\n      position: 'fixed',\n      top: 0,\n      left: 0,\n      width: '100dvw',\n      height: 'var(--titlebar-height)',\n      display: 'flex',\n      justifyContent: 'center',\n      transform: videoViewIsShow && controlIsShow ? 'none' : 'translateY(calc(-1 * var(--titlebar-height)))',\n      transition: 'all 0.2s ease-out',\n    }}>\n      <Box\n        sx={{\n          width: '100%',\n          maxWidth: '1536px',\n          height: '100%',\n        }}\n      >\n        <div\n          style={{\n            width: 'fit-content',\n            height: '100%',\n            display: 'flex',\n            background: `${theme.palette.background.paper}99`,\n            backdropFilter: 'blur(16px)',\n          }}\n          className='app-region-no-drag'\n        >\n          <Tooltip title={t`Close`}>\n            <IconButton\n              aria-label=\"close\"\n              onClick={() => {\n                updateVideoViewIsShow(false)\n                updateControlIsShow(true)\n              }}\n              sx={{\n                height: '100%',\n                borderRadius: '0.25rem',\n                '.MuiTouchRipple-ripple .MuiTouchRipple-child': {\n                  borderRadius: '0.25rem',\n                },\n                aspectRatio: '1 / 1',\n              }}\n            >\n              <KeyboardArrowDownRoundedIcon />\n            </IconButton>\n          </Tooltip>\n        </div>\n      </Box>\n    </div>\n  )\n}\n\nexport default VideoPlayerTopbar"
  },
  {
    "path": "src/pages/Player/VolumeControl.tsx",
    "content": "import { IconButton, Popover, Box, Slider, Tooltip } from '@mui/material'\nimport { useState } from 'react'\nimport VolumeUpIcon from '@mui/icons-material/VolumeUp'\nimport VolumeDownIcon from '@mui/icons-material/VolumeDown'\nimport VolumeOffIcon from '@mui/icons-material/VolumeOff'\nimport useUiStore from '@/store/useUiStore'\nimport { useWheel } from '@use-gesture/react'\nimport { useShallow } from 'zustand/shallow'\n\nexport default function VolumeControl() {\n\n  const [\n    audioViewIsShow,\n    volume,\n    updateVolume,\n  ] = useUiStore(\n    useShallow(\n      (state) => [\n        state.audioViewIsShow,\n        state.volume,\n        state.updateVolume,\n      ]\n    )\n  )\n\n  const [volumeAnchorEl, setVolumeAnchorEl] = useState<HTMLElement | null>(null)\n  const volumeOpen = Boolean(volumeAnchorEl)\n\n  const bind = useWheel((state) => {\n    const _volume: number = Number((volume - state.movement[1] / 100).toFixed(0))\n    updateVolume(Math.min(Math.max(_volume, 0), 100))\n  })\n\n  return (\n    <div {...bind()}>\n      <Tooltip title={volume}>\n        <IconButton onClick={(event: React.MouseEvent<HTMLButtonElement>) => setVolumeAnchorEl(event.currentTarget)} >\n          {\n            volume === 0\n              ? <VolumeOffIcon />\n              : volume < 50\n                ? <VolumeDownIcon />\n                : <VolumeUpIcon />\n          }\n        </IconButton>\n      </Tooltip>\n      <Popover\n        open={volumeOpen}\n        onClose={() => setVolumeAnchorEl(null)}\n        anchorEl={volumeAnchorEl}\n        anchorOrigin={{\n          vertical: audioViewIsShow ? 'bottom' : 'top',\n          horizontal: 'center',\n        }}\n        transformOrigin={{\n          vertical: audioViewIsShow ? 'top' : 'bottom',\n          horizontal: 'center',\n        }}\n      >\n        <Box\n          sx={{\n            display: 'flex',\n            flexDirection: 'column',\n            justifyContent: 'center',\n            alignItems: 'center',\n            padding: '1rem 0.75rem 1.75rem 0.75rem',\n            gap: '1.5em',\n            minHeight: '240px',\n          }}\n        >\n          {volume}\n          <Slider\n            aria-label=\"Volume\"\n            orientation=\"vertical\"\n            value={volume}\n            min={0}\n            max={100}\n            onChange={(_, value) => updateVolume(value as number)}\n            sx={{\n              flexGrow: 1,\n            }}\n          />\n        </Box>\n      </Popover>\n    </div>\n  )\n}"
  },
  {
    "path": "src/pages/Playlist/Playlist.tsx",
    "content": "import { useEffect, useState } from 'react'\nimport { t } from '@lingui/macro'\nimport { useNavigate, useParams } from 'react-router-dom'\nimport { Button, ListItemText, Typography, Dialog, DialogTitle, DialogActions, Menu, MenuItem, DialogContent, TextField, Box, useTheme } from '@mui/material'\nimport Grid from '@mui/material/Grid'\nimport usePlaylistsStore from '../../store/usePlaylistsStore'\nimport CommonList from '../../components/CommonList/CommonList'\nimport Loading from '../Loading'\nimport useLocalMetaDataStore from '@/store/useLocalMetaDataStore'\nimport { MetaData } from '@/types/MetaData'\nimport usePlayQueueStore from '@/store/usePlayQueueStore'\nimport usePlayerStore from '@/store/usePlayerStore'\nimport useUiStore from '@/store/useUiStore'\nimport { checkFileType } from '@/utils'\nimport { useShallow } from 'zustand/shallow'\n\nconst Playlist = () => {\n  const navigate = useNavigate()\n  const { id } = useParams()\n  const theme = useTheme()\n\n  const [shuffle, updateVideoViewIsShow, updateShuffle,] = useUiStore(\n    useShallow((state) => [state.shuffle, state.updateVideoViewIsShow, state.updateShuffle])\n  )\n\n  const updatePlayQueue = usePlayQueueStore.use.updatePlayQueue()\n  const updateCurrentIndex = usePlayQueueStore.use.updateCurrentIndex()\n\n  const updateAutoPlay = usePlayerStore(state => state.updateAutoPlay)\n\n  const [playlists, renamePlaylist, removePlaylist, removeFilesFromPlaylist] = usePlaylistsStore(\n    useShallow((state) => [state.playlists, state.renamePlaylist, state.removePlaylist, state.removeFilesFromPlaylist])\n  )\n\n  const playlist = playlists?.find(playlistItem => playlistItem.id === id) //当前播放列表\n\n  const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null)\n  const [menuOpen, setMenuOpen] = useState(false)\n  const [renameDialogOpen, setRenameDialogOpen] = useState(false)\n  const [deleteDiaLogOpen, setDeleteDiaLogOpen] = useState(false)\n  const [newTitle, setNewTitle] = useState(playlist?.title)\n  const { getManyLocalMetaData } = useLocalMetaDataStore()\n  const [metaDataList, setMetaDataList] = useState<MetaData[]>([])\n\n  useEffect(\n    () => {\n      getManyLocalMetaData(playlist?.fileList.slice(0, 5).map(file => file.filePath) || [])\n        .then(metaDataList => metaDataList && setMetaDataList(metaDataList.filter(metaData => metaData)))\n      return () => {\n        setMetaDataList([])\n      }\n    },\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [playlist]\n  )\n\n  const open = (index: number) => {\n    const listData = playlist?.fileList\n    if (listData) {\n      const currentFile = listData[index]\n      if (currentFile) {\n        const list = listData\n          .map((item, _index) => ({ ...item, index: _index }))\n        if (shuffle) {\n          updateShuffle(false)\n        }\n        updatePlayQueue(list)\n        updateCurrentIndex(list[index].index)\n        updateAutoPlay(true)\n        if (checkFileType(currentFile.fileName) === 'video') {\n          updateVideoViewIsShow(true)\n        }\n      }\n    }\n  }\n\n  const handleClickMenu = (event: React.MouseEvent<HTMLElement>) => {\n    setMenuOpen(true)\n    setAnchorEl(event.currentTarget)\n  }\n\n  const handleCloseMenu = () => {\n    setMenuOpen(false)\n    setAnchorEl(null)\n  }\n\n  const handleCloseRenameDialog = () => {\n    setRenameDialogOpen(false)\n    setNewTitle(playlist?.title)\n  }\n\n  //从播放列表移除文件\n  const removeFiles = (indexArray: number[]) => {\n    if (id) {\n      removeFilesFromPlaylist(id, indexArray)\n    }\n  }\n\n  // 删除播放列表\n  const deletePlaylist = () => {\n    if (id && playlists) {\n      removePlaylist(id)\n      setDeleteDiaLogOpen(false)\n      setNewTitle('')\n      const prev = playlists[playlists?.findIndex((playlist) => playlist.id === id) - 1]\n      const next = playlists[playlists?.findIndex((playlist) => playlist.id === id) + 1]\n      const navigateToId = (prev) ? prev.id : (next) ? next.id : null\n      return navigate((navigateToId) ? `/playlist/${navigateToId}` : '/')\n    }\n  }\n\n  return (\n    <Box sx={{ height: '100%' }}>\n      {\n        (!playlist)\n          ? <Loading />\n          : <Grid container sx={{ flexDirection: 'column', height: '100%' }}>\n            <Grid\n              container\n              sx={{ position: 'relative' }}\n              alignItems={'baseline'}\n              gap={1}\n            >\n\n              {/* 背景 */}\n              <Box sx={{ position: 'absolute', height: '100%', width: '100%' }}>\n                {\n                  metaDataList[0] && metaDataList[0].cover && 'data' in metaDataList[0].cover[0].data &&\n                  <img\n                    src={URL.createObjectURL(new Blob([new Uint8Array(metaDataList[0].cover[0].data.data as unknown as ArrayBufferLike)], { type: 'image/png' }))}\n                    alt='Cover'\n                    style={{ width: '100%', height: '100%', objectFit: 'cover' }}\n                  />\n                }\n              </Box>\n\n              <Grid size={12} container\n                sx={{\n                  padding: '3rem 1rem 1rem 1rem',\n                  background: `linear-gradient(0deg, ${theme.palette.background.default}ff, ${theme.palette.background.default}99,${theme.palette.background.default}00)`,\n                  gap: '0.25rem',\n                  backdropFilter: 'blur(4px)',\n                }}\n              >\n                <Grid size={12}>\n                  <Typography variant='h4' noWrap>\n                    {playlist.title}\n                  </Typography>\n                </Grid>\n                <Grid size='auto'>\n                  <Button\n                    variant='contained'\n                    size='small'\n                    // startIcon={<MoreVertOutlined />}\n                    onClick={handleClickMenu}\n                  >\n                    {t`More`}\n                  </Button>\n                </Grid>\n              </Grid>\n\n            </Grid>\n\n            <Grid sx={{ flexGrow: 1 }}>\n              <CommonList\n                listData={playlist.fileList}\n                listType='playlist'\n                func={{ open, remove: removeFiles }}\n              />\n            </Grid>\n\n          </Grid>\n      }\n\n      {/* 菜单 */}\n      <Menu\n        anchorEl={anchorEl}\n        open={menuOpen}\n        onClose={handleCloseMenu}\n      >\n        <MenuItem onClick={() => {\n          setRenameDialogOpen(true)\n          handleCloseMenu()\n        }}>\n          <ListItemText primary={t`Rename`} />\n        </MenuItem>\n        <MenuItem onClick={() => {\n          setDeleteDiaLogOpen(true)\n          handleCloseMenu()\n        }}>\n          <ListItemText primary={t`Delete`} />\n        </MenuItem>\n      </Menu>\n\n      {/* 重命名播放列表 */}\n      <Dialog\n        open={renameDialogOpen}\n        onClose={handleCloseRenameDialog}\n        fullWidth\n        disableRestoreFocus\n        maxWidth='xs'\n      >\n        <DialogTitle>{t`Rename`}</DialogTitle>\n        <DialogContent>\n          <TextField\n            autoFocus\n            autoComplete='off'\n            margin=\"dense\"\n            fullWidth\n            variant=\"standard\"\n            value={newTitle}\n            onChange={(event) => setNewTitle(event.target.value)}\n            placeholder={t`Enter new title`}\n          />\n        </DialogContent>\n        <DialogActions>\n          <Button onClick={handleCloseRenameDialog}>{t`Cancel`}</Button>\n          <Button onClick={() => {\n            if (id && newTitle) {\n              renamePlaylist(id, newTitle)\n              setRenameDialogOpen(false)\n            }\n          }} >\n            {t`OK`}\n          </Button>\n        </DialogActions>\n      </Dialog>\n\n      {/* 删除播放列表 */}\n      <Dialog\n        open={deleteDiaLogOpen}\n        onClose={() => setDeleteDiaLogOpen(false)}\n        fullWidth\n        maxWidth='xs'\n      >\n        <DialogContent>\n          {t`The playlist will be deleted`}\n        </DialogContent>\n        <DialogActions>\n          <Button onClick={() => setDeleteDiaLogOpen(false)}>{t`Cancel`}</Button>\n          <Button onClick={deletePlaylist} >{t`OK`}</Button>\n        </DialogActions>\n      </Dialog>\n\n    </Box>\n  )\n}\n\nexport default Playlist"
  },
  {
    "path": "src/pages/Refresh.tsx",
    "content": "import { CircularProgress } from '@mui/material'\nimport { useEffect } from 'react'\nimport { useNavigate } from 'react-router-dom'\n\nconst Refresh = () => {\n  const navigate = useNavigate()\n\n  useEffect(() => {\n    navigate('/')\n    location.reload()\n  })\n  return (\n    <div\n      style={{\n        height: '100%',\n        display: 'flex',\n        justifyContent: 'center',\n        alignItems: 'center',\n      }}\n    >\n      <CircularProgress />\n    </div>\n  )\n}\n\nexport default Refresh"
  },
  {
    "path": "src/pages/Search.tsx",
    "content": "import { t } from '@lingui/macro'\nimport { Box, ButtonBase, Dialog, DialogContent, IconButton, InputAdornment, InputBase, LinearProgress, MenuItem, Select, useTheme } from '@mui/material'\nimport { useEffect, useState } from 'react'\nimport CloseRoundedIcon from '@mui/icons-material/CloseRounded'\nimport useFilesData from '@/hooks/graph/useFilesData'\nimport useUser from '@/hooks/graph/useUser'\nimport useUiStore from '@/store/useUiStore'\nimport { remoteItemToFile, pathConvert } from '@/utils'\nimport { RemoteItem } from '@/types/file'\nimport useSWR from 'swr'\nimport useDebounce from '@/hooks/useDebounce'\nimport CommonList from '@/components/CommonList/CommonList'\nimport SearchRoundedIcon from '@mui/icons-material/SearchRounded'\nimport { useLocation, useNavigate } from 'react-router-dom'\nimport { animated, useSpring } from '@react-spring/web'\nimport { useShallow } from 'zustand/shallow'\nimport useStyles from '@/hooks/ui/useStyles'\n\ntype SearchScope = 'global' | 'current'\n\nconst Search = ({ type = 'icon' }: { type?: 'icon' | 'bar' }) => {\n  const theme = useTheme()\n  const styles = useStyles(theme)\n\n  const [searchQuery, setSearchQuery] = useState('')\n  const debouncedSearchQuery = useDebounce(searchQuery, searchQuery.length > 0 ? 1000 : 0)\n  const [folderTree, updateFolderTree] = useUiStore(\n    useShallow(state => [state.folderTree, state.updateFolderTree])\n  )\n  const [searchScope, setSearchScope] = useState<SearchScope>('current')\n\n  const location = useLocation()\n  const navigate = useNavigate()\n\n  const isFileView = location.pathname === '/'\n\n  useEffect(() => isFileView ? setSearchScope('current') : setSearchScope('global'), [isFileView, location.pathname])\n\n  const path = searchScope === 'global' ? '/' : pathConvert(folderTree)\n\n  const [searchOpen, setSearchOpen] = useState(false)\n\n  const handleCloseSearh = () => {\n    setSearchOpen(false)\n    setSearchQuery('')\n  }\n\n  const { account } = useUser()\n\n  const { getFilesData, getSearchData } = useFilesData()\n\n  const fileListFetcher = async (path: string) => {\n    const res: RemoteItem[] = await getFilesData(account, path)\n    return remoteItemToFile(res)\n  }\n\n  const { data: filesData } = useSWR(account ? path : null, fileListFetcher)\n\n  const searchFetcher = async () => {\n    const res: RemoteItem[] = await getSearchData(account, path, searchQuery)\n    return remoteItemToFile(res)\n  }\n\n  const { data: searchData, isLoading: searchIsLoading } = useSWR(\n    (debouncedSearchQuery.length > 0) && account ? `${account.username}/${path}/${debouncedSearchQuery}` : null,\n    searchFetcher,\n  )\n\n  const filteredFilesData = debouncedSearchQuery.length > 0\n    ? filesData?.filter(item =>\n      item.fileName.toLocaleLowerCase().includes(debouncedSearchQuery.toLocaleLowerCase())\n      && ['folder', 'audio', 'video'].includes(item.fileType))\n    : []\n  const filteredData = [\n    ...filteredFilesData || [],\n    ...searchData?.filter(searchItem =>\n      !filteredFilesData?.find(item => (pathConvert(item.filePath) === pathConvert(searchItem.filePath)))\n      && ['folder', 'audio', 'video'].includes(searchItem.fileType))\n    || []\n  ]\n\n  const open = (index: number) => {\n    const currentFile = filteredData[index]\n    if (currentFile.fileType === 'folder') {\n      handleCloseSearh()\n      updateFolderTree(currentFile.filePath)\n      navigate('/')\n    } else {\n      handleCloseSearh()\n      updateFolderTree(currentFile.filePath.slice(0, currentFile.filePath.length - 1))\n      navigate('/')\n    }\n  }\n\n  const isShow = filteredData && filteredData.length > 0\n\n  const [{ height }] = useSpring(\n    () => ({\n      from: {\n        height: isShow ? '0' : '100dvh',\n      },\n      to: {\n        height: isShow ? '100dvh' : '0',\n      },\n      config: {\n        mass: 1,\n        tension: 190,\n        friction: 20,\n      }\n    }),\n    [isShow]\n  )\n\n  return (\n    <>\n      {\n        type === 'icon' &&\n        <IconButton\n          onClick={() => setSearchOpen(true)}\n          aria-label={t`Search`}\n          sx={{\n            borderRadius: '0.2rem',\n            '.MuiTouchRipple-ripple .MuiTouchRipple-child': {\n              borderRadius: '0.2rem',\n            },\n          }}\n        >\n          <SearchRoundedIcon />\n        </IconButton>\n      }\n      {\n        type === 'bar' &&\n        <ButtonBase\n          sx={{\n            background: `${theme.palette.background.paper}99`,\n            border: `1px solid ${theme.palette.divider}`,\n            borderRadius: '0.5rem',\n            width: '100%',\n            height: '100%',\n            color: theme.palette.text.secondary,\n          }}\n          onClick={() => setSearchOpen(true)}\n          aria-label={t`Search`}\n        >\n          {t`Search`}\n        </ButtonBase>\n      }\n\n      <Dialog\n        open={searchOpen}\n        onClose={handleCloseSearh}\n        maxWidth='xs'\n        fullWidth\n        disableRestoreFocus\n        sx={{\n          ...styles.scrollbar\n        }}\n      >\n        <Box\n          sx={{\n            padding: '0.5rem',\n            borderRadius: '0.5rem',\n          }}\n        >\n          <InputBase\n            autoFocus\n            placeholder={t`Search`}\n            sx={{ width: '100%', fontSize: '1rem' }}\n            value={searchQuery}\n            onChange={(ev) => setSearchQuery(ev.target.value)}\n            startAdornment={\n              <InputAdornment position='start'>\n                <Select\n                  value={searchScope}\n                  onChange={(event) => setSearchScope(event.target.value as SearchScope)}\n                  size='small'\n                  variant='standard'\n                  disableUnderline\n                  disabled={!isFileView}\n                  sx={{ margin: '0 0.5rem' }}\n                >\n                  <MenuItem value='global'>{t`Global`}</MenuItem>\n                  <MenuItem value='current'>{t`Current`}</MenuItem>\n                </Select>\n              </InputAdornment>\n            }\n            endAdornment={\n              searchQuery.length > 0 &&\n              <InputAdornment position=\"end\">\n                <IconButton\n                  aria-label=\"toggle password visibility\"\n                  onClick={() => setSearchQuery('')}\n                >\n                  <CloseRoundedIcon fontSize='small' />\n                </IconButton>\n              </InputAdornment>\n            }\n          />\n          {searchIsLoading && <LinearProgress sx={{ borderRadius: '0.5rem', height: '2px' }} />}\n        </Box>\n\n        <animated.div style={{ height: height, overflow: 'hidden' }}>\n          <DialogContent sx={{ padding: '0.125rem', height: '100%', borderTop: `1px solid ${theme.palette.divider}` }}>\n            <CommonList listData={filteredData} listType='files' disableFAB func={{ open }} />\n          </DialogContent>\n        </animated.div>\n\n      </Dialog>\n    </>\n  )\n}\n\nexport default Search"
  },
  {
    "path": "src/pages/Setting.tsx",
    "content": "import { Avatar, Button, Checkbox, Dialog, DialogActions, DialogTitle, Divider, FormControl, FormControlLabel, IconButton, List, ListItem, ListItemAvatar, ListItemButton, ListItemText, MenuItem, Select, SelectChangeEvent, Tooltip, useTheme } from '@mui/material'\nimport useUser from '../hooks/graph/useUser'\nimport { t } from '@lingui/macro'\nimport { licenses } from '../data/licenses'\nimport useLocalMetaDataStore from '../store/useLocalMetaDataStore'\nimport useUiStore from '@/store/useUiStore'\nimport { UiStatus } from '@/types/ui'\nimport { useState } from 'react'\nimport AddRoundedIcon from '@mui/icons-material/AddRounded'\nimport LogoutRoundedIcon from '@mui/icons-material/LogoutRounded'\nimport usePlayQueueStore from '@/store/usePlayQueueStore'\nimport usePlayerStore from '@/store/usePlayerStore'\nimport useHistoryStore from '@/store/useHistoryStore'\nimport usePlaylistsStore from '@/store/usePlaylistsStore'\nimport { AccountInfo } from '@azure/msal-browser'\nimport { useShallow } from 'zustand/shallow'\nimport INFO from '@/data/info'\n\nconst ListItemTitle = ({ title }: { title: string }) => {\n  const theme = useTheme()\n  return (\n    <ListItem>\n      <ListItemText inset sx={{ color: theme.palette.primary.main }} primary={title} />\n    </ListItem>\n  )\n}\n\nconst Setting = () => {\n\n  const { accounts, account, login, logout } = useUser()\n\n  const { clearLocalMetaData } = useLocalMetaDataStore()\n\n  const [\n    currentAccount,\n    CoverThemeColor,\n    colorMode,\n    updateFolderTree,\n    updateCurrentAccount,\n    updateCoverThemeColor,\n    updateColorMode,\n  ] = useUiStore(\n    useShallow(\n      (state) => [\n        state.currentAccount,\n        state.CoverThemeColor,\n        state.colorMode,\n        state.updateFolderTree,\n        state.updateCurrentAccount,\n        state.updateCoverThemeColor,\n        state.updateColorMode\n      ]\n    )\n  )\n\n  const resetPlayQueue = usePlayQueueStore.use.resetPlayQueue()\n  const resetPlayer = usePlayerStore(state => state.resetPlayer)\n  const updateHistoryList = useHistoryStore((state) => state.updateHistoryList)\n  const updatePlaylists = usePlaylistsStore((state) => state.updatePlaylists)\n\n  const [accountsDialogOpen, setAccountsDialogOpen] = useState(false)\n\n  const handleCloseAccountsDialog = () => setAccountsDialogOpen(false)\n\n  const handleChangeAccount = (index: number) => {\n    handleCloseAccountsDialog()\n    if (currentAccount === index) return\n    updateCurrentAccount(index)\n    updateFolderTree(['/'])\n    updateHistoryList(null)\n    updatePlaylists(null)\n    resetPlayQueue()\n    resetPlayer()\n  }\n\n  const handleLogout = (account: AccountInfo) => {\n    if (account.username === accounts[currentAccount].username) {\n      resetPlayQueue()\n      resetPlayer()\n      updateHistoryList(null)\n      updatePlaylists(null)\n      updateFolderTree(['/'])\n    }\n    if (currentAccount === accounts.length - 1) {\n      updateCurrentAccount((accounts.length - 1) <= 1 ? 0 : (accounts.length - 1))\n      updateFolderTree(['/'])\n    }\n    logout(account)\n  }\n\n  return (\n    <div style={{ width: '100%', height: '100%', overflow: 'auto' }}>\n\n      <List>\n        <ListItemTitle title={t`Account`} />\n        <ListItem\n          secondaryAction={\n            <Button onClick={() => setAccountsDialogOpen(true)}>{t`Manage`}</Button>\n          }\n        >\n          <ListItemAvatar>\n            {account && <Avatar aria-label={account.name}>{account.name?.split(' ')[0]}</Avatar>}\n          </ListItemAvatar>\n          {\n            account\n              ? <ListItemText primary={account.name} secondary={account.username} />\n              : <ListItemText primary={t`Please use Microsoft account authorization to log in`} secondary={' '} />\n          }\n\n        </ListItem>\n\n        <Divider sx={{ m: 1 }} />\n\n        <ListItemTitle title={t`Data`} />\n        <ListItem\n          secondaryAction={\n            <Button onClick={() => clearLocalMetaData()}>\n              {t`Clear`}\n            </Button>\n          }\n        >\n          <ListItemText inset primary={t`Local metaData cache`} secondary=' ' />\n        </ListItem>\n\n        <Divider sx={{ m: 1 }} />\n\n        <ListItemTitle title={t`Customize`} />\n        <ListItem\n          secondaryAction={\n            <FormControl variant=\"standard\">\n              <Select\n                labelId=\"color-mode-select-label\"\n                id=\"color-mode-select\"\n                value={colorMode}\n                onChange={(event: SelectChangeEvent) => updateColorMode(event.target.value as UiStatus['colorMode'])}\n              >\n                <MenuItem value={'auto'}> {t`Auto`} </MenuItem>\n                <MenuItem value={'light'}> {t`Light`} </MenuItem>\n                <MenuItem value={'dark'}> {t`Dark`} </MenuItem>\n              </Select>\n            </FormControl>\n          }\n        >\n          <ListItemText inset primary={t`Color mode`} secondary=' ' />\n        </ListItem>\n\n        <ListItem\n          secondaryAction={\n            <FormControlLabel\n              control={<Checkbox checked={CoverThemeColor} />}\n              label={false}\n              onChange={() => updateCoverThemeColor(!CoverThemeColor)}\n            />\n          }\n        >\n          <ListItemText inset primary={t`Use album cover theme color`} secondary=' ' />\n        </ListItem>\n\n        <Divider sx={{ m: 1 }} />\n\n        <ListItemTitle title={t`About`} />\n        <ListItem disablePadding>\n          <ListItemButton onClick={() => window.open('https://github.com/nini22P/omp', '_blank')}>\n            <ListItemText inset primary='OMP - OneDrive Media Player' secondary='AGPL-3.0' />\n          </ListItemButton>\n        </ListItem>\n\n        <ListItem disablePadding>\n          <ListItemButton onClick={() => window.open(INFO.dev ? 'https://github.com/nini22P/omp/tree/dev' : `https://github.com/nini22P/omp/releases/tag/v${INFO.version}`, '_blank')}>\n            <ListItemText inset primary={t`Version`} secondary={INFO.version} />\n          </ListItemButton>\n        </ListItem>\n\n        <ListItem disablePadding>\n          <ListItemButton>\n            <ListItemText inset primary={t`Build time`} secondary={(new Date(INFO.buildTime)).toLocaleString()} />\n          </ListItemButton>\n        </ListItem>\n\n        <Divider sx={{ m: 1 }} />\n\n        <ListItemTitle title={t`Open source dependencies`} />\n        {\n          licenses.map((license) =>\n            <ListItem key={license.name} disablePadding>\n              <ListItemButton onClick={() => window.open(license.link, '_blank')}>\n                <ListItemText inset primary={license.name} secondary={license.licenseType} />\n              </ListItemButton>\n            </ListItem>\n          )\n        }\n\n      </List>\n\n      <Dialog open={accountsDialogOpen} onClose={handleCloseAccountsDialog} >\n        <DialogTitle>{t`Select account`}</DialogTitle>\n        <List>\n          {\n            accounts.map((account, index) =>\n              <ListItem\n                key={index}\n                disablePadding\n                secondaryAction={\n                  <Tooltip title={t`Sign out`}>\n                    <IconButton onClick={() => handleLogout(account)}>\n                      <LogoutRoundedIcon />\n                    </IconButton>\n                  </Tooltip>\n                }>\n                <ListItemButton onClick={() => handleChangeAccount(index)}>\n                  <ListItemAvatar>\n                    <Avatar aria-label={account.name}>{account.name?.split(' ')[0]}</Avatar>\n                  </ListItemAvatar>\n                  <ListItemText primary={account.name} secondary={account.username} sx={{ paddingRight: 2 }} />\n                </ListItemButton>\n              </ListItem>)\n          }\n          <ListItem disablePadding>\n            <ListItemButton onClick={() => login()}>\n              <ListItemAvatar>\n                <Avatar>\n                  <AddRoundedIcon />\n                </Avatar>\n              </ListItemAvatar>\n              <ListItemText primary={t`Add account`} />\n            </ListItemButton>\n          </ListItem>\n        </List>\n        <DialogActions>\n          <Button onClick={handleCloseAccountsDialog}>{t`Cancel`}</Button>\n        </DialogActions>\n      </Dialog>\n\n    </div>\n\n  )\n}\nexport default Setting"
  },
  {
    "path": "src/pages/SideBar/MobileSideBar.tsx",
    "content": "import { Drawer, useTheme } from '@mui/material'\nimport useUiStore from '../../store/useUiStore'\nimport SideBar from './SideBar'\nimport { useShallow } from 'zustand/shallow'\nimport useStyles from '@/hooks/ui/useStyles'\n\nconst MobileSideBar = () => {\n\n  const [mobileSideBarOpen, updateMobileSideBarOpen] = useUiStore(\n    useShallow((state) => [state.mobileSideBarOpen, state.updateMobileSideBarOpen])\n  )\n\n  const theme = useTheme()\n  const styles = useStyles(theme)\n\n  return (\n    <Drawer\n      variant=\"temporary\"\n      open={mobileSideBarOpen}\n      onClose={() => updateMobileSideBarOpen(false)}\n      ModalProps={{\n        keepMounted: true,\n      }}\n      sx={{\n        display: { xs: 'block', sm: 'none' },\n        '& .MuiDrawer-paper': {\n          boxSizing: 'border-box',\n          minWidth: 260,\n          maxWidth: 280,\n        },\n        ...styles.scrollbar\n      }}\n    >\n      <SideBar />\n    </Drawer>\n  )\n}\n\nexport default MobileSideBar"
  },
  {
    "path": "src/pages/SideBar/Playlists.tsx",
    "content": "import { t } from '@lingui/macro'\nimport { NavLink, useNavigate } from 'react-router-dom'\nimport shortUUID from 'short-uuid'\nimport { List, ListItem, ListItemText, ListItemIcon, ListItemButton, Button } from '@mui/material'\nimport ListRoundedIcon from '@mui/icons-material/ListRounded'\nimport PlaylistAddRoundedIcon from '@mui/icons-material/PlaylistAddRounded'\nimport usePlaylistsStore from '../../store/usePlaylistsStore'\nimport { useShallow } from 'zustand/shallow'\n\nconst Playlists = ({ closeSideBar }: { closeSideBar: () => void }) => {\n\n  const navigate = useNavigate()\n  const [playlists, insertPlaylist] = usePlaylistsStore(\n    useShallow((state) => [state.playlists, state.insertPlaylist])\n  )\n\n  const addPlaylist = async () => {\n    const id = shortUUID().generate()\n    insertPlaylist({ id, title: t`New playlist`, fileList: [] })\n    return navigate(`/playlist/${id}`)\n  }\n\n  return (\n    playlists &&\n    <List>\n      {\n        playlists?.map((playlist, index) =>\n          <ListItem\n            disablePadding\n            key={index}\n            sx={{ paddingTop: '0.25rem' }}\n          >\n            <ListItemButton\n              component={NavLink}\n              to={`/playlist/${playlist.id}`}\n              onClick={closeSideBar}\n            >\n              <ListItemIcon>\n                <ListRoundedIcon />\n              </ListItemIcon>\n              <ListItemText primary={playlist.title} />\n            </ListItemButton>\n          </ListItem >\n        )\n      }\n      <ListItem>\n        <ListItemText>\n          <Button\n            startIcon={<PlaylistAddRoundedIcon />}\n            onClick={addPlaylist}\n          >\n            {t`Add playlist`}\n          </Button>\n        </ListItemText>\n      </ListItem >\n    </List>\n  )\n}\n\nexport default Playlists"
  },
  {
    "path": "src/pages/SideBar/SideBar.tsx",
    "content": "import { t } from '@lingui/macro'\nimport { Box, List, ListItem, ListItemButton, ListItemIcon, ListItemText } from '@mui/material'\nimport { NavLink } from 'react-router-dom'\nimport HistoryRoundedIcon from '@mui/icons-material/HistoryOutlined'\nimport SettingsRoundedIcon from '@mui/icons-material/SettingsRounded'\nimport FolderRoundedIcon from '@mui/icons-material/FolderRounded'\nimport useUiStore from '../../store/useUiStore'\nimport Playlists from './Playlists'\nimport { useRef } from 'react'\nimport { useShallow } from 'zustand/shallow'\n\nconst SideBar = () => {\n\n  const [mobileSideBarOpen, updateMobileSideBarOpen] = useUiStore(\n    useShallow((state) => [state.mobileSideBarOpen, state.updateMobileSideBarOpen])\n  )\n\n  const navData = [\n    { router: '/', icon: <FolderRoundedIcon />, label: t`Files` },\n    { router: '/history', icon: <HistoryRoundedIcon />, label: t`History` },\n    { router: '/setting', icon: <SettingsRoundedIcon />, label: t`Setting` },\n  ]\n\n  const closeSideBar = () => (mobileSideBarOpen) && updateMobileSideBarOpen(false)\n\n  const boxRef = useRef<HTMLDivElement | null>(null)\n\n  const showScrollbar = () => {\n    const element = boxRef.current\n    element?.classList.add('show-scrollbar')\n  }\n\n  const hiddenScrollbar = () => {\n    const element = boxRef.current\n    element?.classList.remove('show-scrollbar')\n  }\n\n  return (\n    <Box\n      sx={{\n        height: '100%',\n        overflow: 'auto',\n      }}\n      ref={boxRef}\n      onTouchStart={() => showScrollbar()}\n      onTouchEnd={() => hiddenScrollbar()}\n    >\n      <List disablePadding>\n        {\n          navData.map((item, index) =>\n            <ListItem\n              disablePadding\n              key={index}\n              sx={{ paddingBottom: '0.25rem' }}\n            >\n              <ListItemButton\n                component={NavLink}\n                to={item.router}\n                onClick={closeSideBar}\n              >\n                <ListItemIcon>\n                  {item.icon}\n                </ListItemIcon>\n                <ListItemText primary={item.label} />\n              </ListItemButton>\n            </ListItem>\n          )\n        }\n      </List>\n      <Playlists closeSideBar={closeSideBar} />\n    </Box >\n  )\n}\nexport default SideBar"
  },
  {
    "path": "src/router.tsx",
    "content": "import { createHashRouter } from 'react-router-dom'\nimport App from './App'\nimport Files from './pages/Files/Files'\nimport History from './pages/History'\nimport Playlist from './pages/Playlist/Playlist'\nimport NotFound from './pages/NotFound'\nimport Setting from './pages/Setting'\nimport Refresh from './pages/Refresh'\n\nconst router = createHashRouter([\n  {\n    path: '/',\n    element: <App />,\n    errorElement: <NotFound />,\n    children: [\n      {\n        path: '/',\n        element: <Files />,\n      },\n      {\n        path: '/history',\n        element: <History />,\n      },\n      {\n        path: '/playlist/:id',\n        element: <Playlist />,\n      },\n      {\n        path: '/setting',\n        element: <Setting />,\n      },\n      {\n        path: '/refresh',\n        element: <Refresh />\n      }\n    ]\n  },\n])\n\nexport default router"
  },
  {
    "path": "src/store/createSelectors.ts",
    "content": "import { StoreApi, UseBoundStore } from 'zustand'\n\ntype UseSelectors = Record<string, () => unknown>\n\ntype WithSelectors<S> = S extends { getState: () => infer T }\n  ? S & { use: { [K in keyof T]: () => T[K] } }\n  : never\n\nconst createSelectors = <S extends UseBoundStore<StoreApi<object>>>(\n  _store: S,\n) => {\n  const store = _store as WithSelectors<typeof _store>\n  store.use = {}\n  for (const k of Object.keys(store.getState())) {\n    ; (store.use as UseSelectors)[k] = () => store((s) => s[k as keyof typeof s])\n  }\n\n  return store\n}\n\nexport default createSelectors\n"
  },
  {
    "path": "src/store/storage.ts",
    "content": "import { get, set, del } from 'idb-keyval'\nimport { StateStorage } from 'zustand/middleware'\n\nexport const indexedDBstorage: StateStorage = {\n  getItem: async (name: string): Promise<string | null> => (await get(name)) || null,\n  setItem: async (name: string, value: string): Promise<void> => await set(name, value),\n  removeItem: async (name: string): Promise<void> => await del(name),\n}"
  },
  {
    "path": "src/store/useHistoryStore.ts",
    "content": "import { pathConvert } from '../utils'\nimport { HistoryStatus, HistoryAction } from '../types/history'\nimport { create } from 'zustand'\n\nconst useHistoryStore = create<HistoryStatus & HistoryAction>(\n  (set) => ({\n    historyList: null,\n    updateHistoryList: (historyList) => set(() => ({ historyList: historyList })),\n    insertHistory: (file) => set(\n      (state) => (\n        (state.historyList !== null)\n          ? {\n            historyList:\n              [\n                file,\n                ...state.historyList.filter((item) =>\n                  pathConvert(item.filePath) !== pathConvert(file.filePath))\n              ].slice(0, 200)\n          }\n          : { historyList: [file] }\n      )),\n    removeHistory: (indexArray) => set((state) => ({ historyList: state.historyList?.filter((_, index) => !indexArray.includes(index)) })),\n    clearHistoryList: () => set({ historyList: [] }),\n  })\n)\n\nexport default useHistoryStore"
  },
  {
    "path": "src/store/useLocalMetaDataStore.ts",
    "content": "import { MetaData } from '../types/MetaData'\nimport { pathConvert } from '../utils'\nimport { get, getMany, set, clear, entries, createStore } from 'idb-keyval'\n\nconst useLocalMetaDataStore = () => {\n\n  const metaDataStore = createStore('metadata', 'metadata-store')\n\n  const getLocalMetaData = async (filePath: MetaData['path']) => {\n    if (!filePath || filePath.length === 0) return null\n    else {\n      const metaData = await get(pathConvert(filePath), metaDataStore)\n      return metaData ? JSON.parse(metaData) : null\n    }\n  }\n\n  const getManyLocalMetaData = async (filePaths: MetaData['path'][]) => {\n    if (!filePaths || filePaths.length === 0) return null\n    else {\n      const metaData = await getMany(filePaths.map(pathConvert), metaDataStore)\n      return metaData.map(metaData => metaData ? JSON.parse(metaData) : null)\n    }\n  }\n\n  const setLocalMetaData = async (metaData: MetaData) => await set(pathConvert(metaData.path), JSON.stringify(metaData), metaDataStore)\n\n  const getAllLocalMetaData = async () => await entries(metaDataStore)\n\n  const clearLocalMetaData = async () => await clear(metaDataStore)\n\n  return { getLocalMetaData, getManyLocalMetaData, setLocalMetaData, getAllLocalMetaData, clearLocalMetaData }\n\n}\n\nexport default useLocalMetaDataStore"
  },
  {
    "path": "src/store/usePictureStore.ts",
    "content": "import { PictiureStatus, PictureAction } from '@/types/picture'\nimport { create } from 'zustand'\n\nconst usePictureStore = create<PictiureStatus & PictureAction>(\n  (set) => ({\n    pictureList: [],\n    currentPicture: null,\n    updatePictureList: (pictureList) => set(() => ({ pictureList: pictureList })),\n    updateCurrentPicture: (currentPicture) => set(() => ({ currentPicture: currentPicture })),\n  })\n)\n\nexport default usePictureStore"
  },
  {
    "path": "src/store/usePlayQueueStore.ts",
    "content": "import { PlayQueueStatus, PlayQueueAction } from '../types/playQueue'\nimport { createJSONStorage, persist } from 'zustand/middleware'\nimport { create } from 'zustand'\nimport createSelectors from './createSelectors'\n\nconst initialState: PlayQueueStatus = {\n  playQueue: null,\n  currentIndex: 0,\n}\n\nconst usePlayQueueStoreBase = create<PlayQueueStatus & PlayQueueAction>()(\n  persist((set) => ({\n    ...initialState,\n    updatePlayQueue: (playQueue) => set(() => ({ playQueue: playQueue })),\n    updateCurrentIndex: (currentIndex) => set(() => ({ currentIndex: currentIndex })),\n    resetPlayQueue: () => set(() => ({ ...initialState })),\n  }),\n    {\n      name: 'playqueue-store',\n      storage: createJSONStorage(() => localStorage),\n    }\n  )\n)\n\nconst usePlayQueueStore = createSelectors(usePlayQueueStoreBase)\n\nexport default usePlayQueueStore"
  },
  {
    "path": "src/store/usePlayerStore.ts",
    "content": "import { create } from 'zustand'\nimport { PlayerStatus, PlayerAction } from '../types/player'\n\nconst initialState: PlayerStatus = {\n  currentMetaData: null,\n  metadataUpdate: false,\n  autoPlay: false,\n  isLoading: false,\n  cover: './cover.svg',\n  currentTime: 0,\n  duration: 0,\n}\n\nconst usePlayerStore = create<PlayerStatus & PlayerAction>(\n  (set) => ({\n    ...initialState,\n    updateCurrentMetaData: (currentMetaData) => set(() => ({ currentMetaData: currentMetaData })),\n    updateMetadataUpdate: () => set((state) => ({ metadataUpdate: !state.metadataUpdate })),\n    updateAutoPlay: (autoPlay) => set(() => ({ autoPlay })),\n    updateIsLoading: (isLading) => set(() => ({ isLoading: isLading })),\n    updateCover: (cover) => set(() => (({ cover: cover }))),\n    updateCurrentTime: (currentTime) => set(() => ({ currentTime: currentTime })),\n    updateDuration: (duration) => set(() => ({ duration: duration })),\n    resetPlayer: () => set(() => ({ ...initialState })),\n  })\n)\n\nexport default usePlayerStore"
  },
  {
    "path": "src/store/usePlaylistsStore.ts",
    "content": "import { pathConvert } from '../utils'\nimport { PlaylistsStatus, PlaylistsAction } from '../types/playlist'\nimport { create } from 'zustand'\n\nconst usePlaylistsStore = create<PlaylistsStatus & PlaylistsAction>(\n  (set) => ({\n    playlists: null,\n    updatePlaylists: (playlists) => set(() => ({ playlists: playlists })),\n    insertPlaylist: (playlist) =>\n      set((state) => ({ playlists: (state.playlists) ? [playlist, ...state.playlists] : [playlist] })),\n    renamePlaylist: (id, title) =>\n      set((state) => ({\n        playlists: state.playlists?.map((playlist) =>\n          (playlist.id === id) ? { ...playlist, title: title } : playlist)\n      })),\n    removePlaylist: (id) => set((state) =>\n      ({ playlists: state.playlists?.filter(playlist => playlist.id !== id) })),\n    insertFilesToPlaylist: (id, files) =>\n      set((state) => ({\n        playlists: state.playlists?.map((playlist) =>\n          (playlist.id === id)\n            ? {\n              ...playlist,\n              fileList: files.concat(playlist.fileList.filter((item) =>\n                !files.map(item => pathConvert(item.filePath)).includes(pathConvert(item.filePath))\n              ))\n            }\n            : playlist\n        )\n      })),\n    removeFilesFromPlaylist: (id, indexArray) =>\n      set((state) => ({\n        playlists: state.playlists?.map((playlist) =>\n          (playlist.id === id)\n            ? {\n              ...playlist,\n              fileList: playlist.fileList.filter((file, index) => !indexArray.includes(index))\n            }\n            : playlist\n        )\n      })),\n  })\n)\n\nexport default usePlaylistsStore"
  },
  {
    "path": "src/store/useUiStore.ts",
    "content": "import { create } from 'zustand'\nimport { UiStatus, UiAction } from '../types/ui'\nimport { createJSONStorage, persist } from 'zustand/middleware'\n\nconst initialState: UiStatus = {\n  currentAccount: 0,\n  folderTree: ['/'],\n  audioViewIsShow: false,\n  audioViewTheme: 'modern',\n  videoViewIsShow: false,\n  controlIsShow: true,\n  playQueueIsShow: false,\n  fullscreen: false,\n  mobileSideBarOpen: false,\n  backgroundIsShow: true,\n  shuffle: false,\n  repeat: 'off',\n  volume: 80,\n  playbackRate: 1,\n  coverColor: '#8e24aa',\n  CoverThemeColor: true,\n  colorMode: 'auto',\n  display: 'multicolumnList',\n  sortBy: 'name',\n  orderBy: 'asc',\n  foldersFirst: true,\n  mediaOnly: true,\n  hdThumbnails: false,\n  lyricsIsShow: false,\n}\n\nconst useUiStore = create<UiStatus & UiAction>()(\n  persist(\n    (set) => ({\n      ...initialState,\n      updateCurrentAccount: (currentAccount) => set(() => ({ currentAccount: currentAccount })),\n      updateFolderTree: (folderTree) => set(() => ({ folderTree: folderTree })),\n      updateAudioViewIsShow: (audioViewIsShow) => set(() => ({ audioViewIsShow: audioViewIsShow })),\n      updateAudioViewTheme: (audioViewTheme) => set(() => ({ audioViewTheme: audioViewTheme })),\n      updateVideoViewIsShow: (videoViewIsShow) => set(() => ({ videoViewIsShow: videoViewIsShow })),\n      updateControlIsShow: (controlIsShow) => set(() => ({ controlIsShow: controlIsShow })),\n      updatePlayQueueIsShow: (playQueueIsShow) => set(() => ({ playQueueIsShow: playQueueIsShow })),\n      updateFullscreen: (fullscreen) => set(() => ({ fullscreen: fullscreen })),\n      updateMobileSideBarOpen: (mobileSideBarOpen) => set(() => ({ mobileSideBarOpen: mobileSideBarOpen })),\n      updateBackgroundIsShow: (backgroundIsShow) => set(() => ({ backgroundIsShow: backgroundIsShow })),\n      updateShuffle: (shuffle) => set(() => ({ shuffle: shuffle })),\n      updateRepeat: (repeat) => set(() => ({ repeat: repeat })),\n      updateVolume: (volume) => set(() => ({ volume: volume })),\n      updatePlaybackRate: (playbackRate) => set(() => ({ playbackRate })),\n      updateCoverColor: (coverColor) => set(() => ({ coverColor: coverColor })),\n      updateCoverThemeColor: (CoverThemeColor) => set(() => ({ CoverThemeColor: CoverThemeColor })),\n      updateColorMode: (colorMode) => set(() => ({ colorMode: colorMode })),\n      updateDisplay: (display) => set(() => ({ display: display })),\n      updateSortBy: (sortBy) => set(() => ({ sortBy: sortBy })),\n      updateOrderBy: (orderBy) => set(() => ({ orderBy: orderBy })),\n      updateFoldersFirst: (foldersFirst) => set(() => ({ foldersFirst: foldersFirst })),\n      updateMediaOnly: (mediaOnly) => set(() => ({ mediaOnly: mediaOnly })),\n      updateHDThumbnails: (hdThumbnails) => set(() => ({ hdThumbnails: hdThumbnails })),\n      updateLyricsIsShow: (lyricsIsShow) => set(() => ({ lyricsIsShow: lyricsIsShow })),\n    }),\n    {\n      name: 'ui-store',\n      storage: createJSONStorage(() => localStorage),\n    }\n  ))\n\nexport default useUiStore"
  },
  {
    "path": "src/types/MetaData.ts",
    "content": "import { IPicture } from 'music-metadata-browser'\n\nexport interface Cover extends IPicture {\n  width?: number,\n  height?: number,\n}\n\ninterface LocalStorageCover extends Omit<Cover, 'data'> {\n  data: { type: 'Buffer', data: string[] },\n}\n\nexport interface MetaData {\n  path: string[],\n  size?: number,\n  title: string,\n  artist?: string,\n  albumArtist?: string,\n  album?: string,\n  year?: number,\n  genre?: string[],\n  cover?: Cover[] | LocalStorageCover[],\n  lyrics?: string,\n}\n\nexport interface MetaDataListStatus {\n  metaDataList: MetaData[],\n}\n\nexport interface MetaDataListAction {\n  updateMetaDataList: (metaDataList: MetaDataListStatus['metaDataList']) => void\n  insertMetaDataList: (metaData: MetaData) => void\n  clearMetaDataList: () => void\n}"
  },
  {
    "path": "src/types/commonMenu.ts",
    "content": "import { FileItem } from './file'\n\nexport interface CommonMenuStatus {\n  anchorEl: HTMLElement | null,\n  menuOpen: boolean,\n  dialogOpen: boolean,\n  currentFile: FileItem | null,\n  handleClickRemove: ((filePathArray: string[][]) => void) | null,\n}\n\nexport interface CommonMenuAction {\n  updateAnchorEl: (anchorEl: CommonMenuStatus['anchorEl']) => void,\n  updateMenuOpen: (menuOpen: boolean) => void,\n  updateDialogOpen: (dialogOpen: CommonMenuStatus) => void,\n  updateCurrentFile: (currentFile: CommonMenuStatus['currentFile']) => void,\n  updateHandleClickRemove: (handleClickRemove: CommonMenuStatus['handleClickRemove']) => void,\n}"
  },
  {
    "path": "src/types/file.ts",
    "content": "export interface RemoteItem {\n  name: string,\n  size: number,\n  lastModifiedDateTime: string,\n  id: string,\n  thumbnails: Thumbnail[],\n  '@microsoft.graph.downloadUrl'?: string,\n  folder?: object,\n  parentReference: {\n    name: string,\n    path: string,\n  }\n}\n\nexport interface FileItem {\n  fileName: string,\n  filePath: string[],\n  fileSize: number,\n  fileType: 'folder' | 'audio' | 'video' | 'picture' | 'other',\n  lastModifiedDateTime?: string,\n  id?: string,\n  thumbnails?: Thumbnail[],\n  url?: string,\n}\n\nexport interface ThumbnailItem {\n  height: number,\n  width: number,\n  url: string,\n}\n\nexport interface Thumbnail {\n  id: string,\n  small: ThumbnailItem,\n  medium: ThumbnailItem,\n  large: ThumbnailItem,\n}"
  },
  {
    "path": "src/types/history.ts",
    "content": "import { FileItem } from './file'\n\nexport interface HistoryStatus {\n  historyList: FileItem[] | null,\n}\n\nexport interface HistoryAction {\n  updateHistoryList: (historyList: HistoryStatus['historyList']) => void,\n  insertHistory: (file: FileItem) => void,\n  removeHistory: (indexArray: number[]) => void,\n  clearHistoryList: () => void,\n}"
  },
  {
    "path": "src/types/picture.ts",
    "content": "import { FileItem } from './file'\n\nexport interface PictiureStatus {\n  pictureList: FileItem[],\n  currentPicture: FileItem | null,\n}\n\nexport interface PictureAction {\n  updatePictureList: (pictureList: PictiureStatus['pictureList']) => void,\n  updateCurrentPicture: (currentPicture: PictiureStatus['currentPicture']) => void,\n}"
  },
  {
    "path": "src/types/playQueue.ts",
    "content": "import { FileItem } from './file'\n\nexport interface PlayQueueItem extends FileItem {\n  index: number,\n}\n\nexport interface PlayQueueStatus {\n  playQueue: PlayQueueItem[] | null,\n  currentIndex: number,\n}\n\nexport interface PlayQueueAction {\n  updatePlayQueue: (PlayQueue: PlayQueueStatus['playQueue']) => void,\n  updateCurrentIndex: (index: PlayQueueStatus['currentIndex']) => void,\n  resetPlayQueue: () => void,\n}"
  },
  {
    "path": "src/types/player.ts",
    "content": "import { MetaData } from './MetaData'\n\nexport interface PlayerStatus {\n  currentMetaData: MetaData | null,\n  metadataUpdate: boolean,\n  autoPlay: boolean,\n  isLoading: boolean,\n  cover: string,\n  currentTime: number,\n  duration: number,\n}\n\nexport interface PlayerAction {\n  updateCurrentMetaData: (currentMetaData: PlayerStatus['currentMetaData']) => void,\n  updateMetadataUpdate: () => void,\n  updateAutoPlay: (autoPlay: PlayerStatus['autoPlay']) => void,\n  updateIsLoading: (isLoading: PlayerStatus['isLoading']) => void,\n  updateCover: (cover: PlayerStatus['cover']) => void,\n  updateCurrentTime: (currentTime: PlayerStatus['currentTime']) => void,\n  updateDuration: (duration: PlayerStatus['duration']) => void,\n  resetPlayer: () => void,\n}"
  },
  {
    "path": "src/types/playlist.ts",
    "content": "import { FileItem } from './file'\n\nexport interface Playlist {\n  id: string,\n  title: string,\n  fileList: FileItem[],\n}\n\nexport interface PlaylistsStatus {\n  playlists: Playlist[] | null,\n}\n\nexport interface PlaylistsAction {\n  updatePlaylists: (playlists: PlaylistsStatus['playlists']) => void,\n  insertPlaylist: (playlist: Playlist) => void,\n  renamePlaylist: (id: Playlist['id'], title: Playlist['title']) => void,\n  removePlaylist: (id: Playlist['id']) => void,\n  insertFilesToPlaylist: (id: Playlist['id'], files: FileItem[]) => void,\n  removeFilesFromPlaylist: (id: Playlist['id'], indexArray: number[]) => void,\n}"
  },
  {
    "path": "src/types/ui.ts",
    "content": "export interface UiStatus {\n  currentAccount: number,\n  folderTree: string[],\n  audioViewIsShow: boolean,\n  audioViewTheme: 'classic' | 'modern',\n  videoViewIsShow: boolean,\n  controlIsShow: boolean,\n  playQueueIsShow: boolean,\n  fullscreen: boolean,\n  mobileSideBarOpen: boolean,\n  backgroundIsShow: boolean,\n  shuffle: boolean,\n  repeat: 'off' | 'all' | 'one',\n  volume: number,\n  playbackRate: number,\n  coverColor: string,\n  CoverThemeColor: boolean,\n  colorMode: 'auto' | 'light' | 'dark',\n  display: 'list' | 'multicolumnList' | 'grid',\n  sortBy: 'name' | 'size' | 'datetime',\n  orderBy: 'asc' | 'desc',\n  foldersFirst: boolean,\n  mediaOnly: boolean,\n  hdThumbnails: boolean,\n  lyricsIsShow: boolean,\n}\n\nexport interface UiAction {\n  updateCurrentAccount: (currentAccount: UiStatus['currentAccount']) => void,\n  updateFolderTree: (folderTree: UiStatus['folderTree']) => void,\n  updateAudioViewIsShow: (audioViewIsShow: UiStatus['audioViewIsShow']) => void,\n  updateAudioViewTheme: (audioViewTheme: UiStatus['audioViewTheme']) => void,\n  updateVideoViewIsShow: (videoViewIsShow: UiStatus['videoViewIsShow']) => void,\n  updateControlIsShow: (controlIsShow: UiStatus['controlIsShow']) => void,\n  updatePlayQueueIsShow: (PlayQueueIsShow: UiStatus['playQueueIsShow']) => void,\n  updateFullscreen: (fullscreen: UiStatus['fullscreen']) => void,\n  updateMobileSideBarOpen: (mobileSideBarOpen: UiStatus['mobileSideBarOpen']) => void,\n  updateBackgroundIsShow: (backgroundIsShow: UiStatus['backgroundIsShow']) => void,\n  updateShuffle: (shuffle: UiStatus['shuffle']) => void,\n  updateRepeat: (loop: UiStatus['repeat']) => void,\n  updateVolume: (volume: UiStatus['volume']) => void,\n  updatePlaybackRate: (playbackRate: UiStatus['playbackRate']) => void,\n  updateCoverColor: (coverColor: UiStatus['coverColor']) => void,\n  updateCoverThemeColor: (CoverThemeColor: UiStatus['CoverThemeColor']) => void,\n  updateColorMode: (colorMode: UiStatus['colorMode']) => void,\n  updateDisplay: (display: UiStatus['display']) => void,\n  updateSortBy: (sortBy: UiStatus['sortBy']) => void,\n  updateOrderBy: (orderBy: UiStatus['orderBy']) => void,\n  updateFoldersFirst: (foldersFirst: UiStatus['foldersFirst']) => void,\n  updateMediaOnly: (mediaOnly: UiStatus['mediaOnly']) => void,\n  updateHDThumbnails: (hdThumbnails: UiStatus['hdThumbnails']) => void,\n  updateLyricsIsShow: (lyricsIsShow: UiStatus['lyricsIsShow']) => void,\n}"
  },
  {
    "path": "src/utils.ts",
    "content": "import * as mm from 'music-metadata-browser'\nimport { FileItem, RemoteItem } from './types/file'\nimport { PlayQueueItem, PlayQueueStatus } from './types/playQueue'\nimport { Cover, MetaData } from './types/MetaData'\n\n/**\n * 将时间转换为分钟\n * @param time \n * @returns \n */\nexport const timeShift = (time: number) => {\n  const minute = Math.floor(time / 60).toFixed().toString().padStart(2, '0')\n  const second = (time % 60).toFixed().toString().padStart(2, '0')\n  return `${minute} : ${second}`\n}\n\nconst isAudio = (name: string) => (/.(wav|mp3|aac|ogg|flac|m4a|opus)$/i).test(name)\nconst isVideo = (name: string) => (/.(mp4|mkv|avi|mov|rmvb|webm|flv)$/i).test(name)\nconst isPicture = (name: string) => (/.(jpg|jpeg|png|bmp|webp|avif|tiff|gif|svg|ico)$/i.test(name))\n\nexport const checkFileType = (name: string): FileItem['fileType'] => {\n  if (isAudio(name))\n    return 'audio'\n  if (isVideo(name))\n    return 'video'\n  if (isPicture(name))\n    return 'picture'\n  return 'other'\n}\n\n/**\n * 创建随机播放队列，如果传入当前播放id时歌曲会排到第一\n * @param playQueue 播放队列\n * @param currentIndex 当前播放id\n * @returns \n */\nexport const shufflePlayQueue = (playQueue: PlayQueueItem[], currentIndex?: PlayQueueStatus['currentIndex']) => {\n  const randomPlayQueue = [...playQueue]\n  for (let i = randomPlayQueue.length - 1; i > 0; i--) {\n    const j = Math.floor(Math.random() * (i + 1));\n    [randomPlayQueue[i], randomPlayQueue[j]] = [randomPlayQueue[j], randomPlayQueue[i]]\n  }\n  if (currentIndex !== undefined)\n    return randomPlayQueue.filter(item => item.index === currentIndex).concat(randomPlayQueue.filter(item => item.index !== currentIndex))\n  else return randomPlayQueue\n}\n\nexport const nowTime = () => {\n  const dateTime = new Date()\n  return `${dateTime.getFullYear}-${dateTime.getMonth}-${dateTime.getDay} ${dateTime.getHours}:${dateTime.getMinutes}`\n}\n\nexport const sizeConvert = (fileSize: FileItem['fileSize']) => {\n  return ((fileSize / 1024) < 1024)\n    ? `${(fileSize / 1024).toFixed(2)} KB`\n    : ((fileSize / 1024 / 1024) < 1024)\n      ? `${(fileSize / 1024 / 1024).toFixed(2)} MB`\n      : `${(fileSize / 1024 / 1024 / 1024).toFixed(2)} GB`\n}\n\nexport const pathConvert = (filePath: FileItem['filePath']) => (filePath.join('/') === '/') ? '/' : filePath.slice(1).join('/')\n\n/**\n * 根据 url 解析 json\n * @param url \n * @returns \n */\nexport const fetchJson = async (url: string) => {\n  try {\n    const response = await fetch(url)\n    const json = response.json()\n    return json\n  } catch (error) {\n    console.error(error)\n  }\n}\n\nexport const hexToRgba = (hex: string) => {\n  const r = parseInt(hex.slice(1, 3), 16)\n  const g = parseInt(hex.slice(3, 5), 16)\n  const b = parseInt(hex.slice(5, 7), 16)\n  const a = hex.length > 7 ? parseInt(hex.slice(7, 9), 16) / 255 : 1\n  return [r, g, b, a]\n}\n\nexport const blendHex = (colorHex1: string, colorHex2: string) => {\n  const colorRGBA1 = hexToRgba(colorHex1)\n  const colorRGBA2 = hexToRgba(colorHex2)\n  const red = colorRGBA1[0] * (1 - colorRGBA2[3]) + colorRGBA2[0] * colorRGBA2[3]\n  const green = colorRGBA1[1] * (1 - colorRGBA2[3]) + colorRGBA2[1] * colorRGBA2[3]\n  const blue = colorRGBA1[2] * (1 - colorRGBA2[3]) + colorRGBA2[2] * colorRGBA2[3]\n  const color = [Math.round(red), Math.round(green), Math.round(blue)]\n  return `rgb(${color.join(', ')})`\n}\n\nexport const compressImage = (image: Cover): Promise<Cover> => {\n  return new Promise((resolve, reject) => {\n    const img = new Image()\n    const url = URL.createObjectURL(new Blob([new Uint8Array(image.data as ArrayBufferLike)], { type: image.format }))\n    img.src = url\n    img.onload = () => {\n      const canvas = document.createElement('canvas')\n      const ctx = canvas.getContext('2d')\n      canvas.width = img.width\n      canvas.height = img.height\n      ctx?.drawImage(img, 0, 0, img.width, img.height)\n      canvas.toBlob((blob) => {\n        URL.revokeObjectURL(url)\n        blob?.arrayBuffer().then((buffer) => {\n          resolve({\n            ...image,\n            format: 'image/webp',\n            data: Buffer.from(new Uint8Array(buffer)),\n            width: img.width,\n            height: img.height,\n          })\n        })\n      }, 'image/webp', 0.8)\n    }\n    img.onerror = (error) => {\n      reject(error)\n    }\n  })\n}\n\nexport const remoteItemToFile = (res: RemoteItem[]): FileItem[] => res.map((item) => ({\n  fileName: item.name,\n  filePath: ['/', ...item.parentReference.path.replace('/drive/root:', '').split('/').filter(item => item.length > 0).map(item => decodeURIComponent(item)), item.name],\n  fileSize: item.size,\n  fileType: (item.folder) ? 'folder' : checkFileType(item.name),\n  lastModifiedDateTime: item.lastModifiedDateTime,\n  id: item.id,\n  thumbnails: item.thumbnails,\n  url: item['@microsoft.graph.downloadUrl'],\n}))\n\nexport const getNetMetaData = async (path: string[], url: string) => {\n  console.log('Start get net metadata: ', path.slice(-1)[0])\n  try {\n    const metadata = await mm.fetchFromUrl(url)\n    console.log('Get net metadata: ', metadata)\n    if (metadata && metadata.common.title !== undefined) {\n      const cover = !metadata.common.picture ? undefined : await Promise.all(metadata.common.picture.map(async (item: Cover) => await compressImage(item)))\n      const lyrics = metadata.common.lyrics !== undefined && metadata.common.lyrics[0]\n        || metadata.native['ID3v2.3'] && metadata.native['ID3v2.3'].find(item => item.id.toLocaleLowerCase().includes('lyrics'))?.value\n        || null\n      const metaData: MetaData = {\n        path: path,\n        title: metadata.common.title,\n        artist: metadata.common.artist,\n        albumArtist: metadata.common.albumartist,\n        album: metadata.common.album,\n        year: metadata.common.year,\n        genre: metadata.common.genre,\n        cover: cover,\n        lyrics: lyrics,\n      }\n      return metaData\n    }\n  } catch (error) {\n    console.log('Failed to get net metadata', error)\n    return null\n  }\n}"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"allowSyntheticDefaultImports\": true,\n    \"noImplicitAny\": true,\n    \"moduleResolution\": \"Node\",\n    \"target\": \"es5\",\n    \"lib\": [\n      \"es2019\",\n      \"dom\"\n    ],\n    \"allowJs\": false,\n    \"resolveJsonModule\": true,\n    \"jsx\": \"react-jsx\",\n    \"esModuleInterop\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"strict\": true,\n    \"baseUrl\": \"./\",\n    \"paths\": {\n      \"@/*\": [\n        \"src/*\"\n      ]\n    },\n    \"types\": [\n      \"./node_modules/@lingui/macro/index.d.ts\"\n    ]\n  },\n  \"include\": [\n    \"**/*.ts\",\n    \"**/*.tsx\",\n  ]\n}"
  },
  {
    "path": "webpack.config.cjs",
    "content": "/* eslint-disable @typescript-eslint/no-require-imports */\nconst webpack = require('webpack')\nconst { merge } = require('webpack-merge')\nconst path = require('path')\nconst Dotenv = require('dotenv-webpack')\nconst HtmlWebpackPlugin = require('html-webpack-plugin')\nconst CopyWebpackPlugin = require('copy-webpack-plugin')\nconst WorkboxWebpackPlugin = require('workbox-webpack-plugin')\nconst CompressionPlugin = require('compression-webpack-plugin')\nconst ReactRefreshPlugin = require('@pmmmwh/react-refresh-webpack-plugin')\nconst isProduction = process.env.NODE_ENV == 'production'\n\nconst config = {\n  entry: './src/main.tsx',\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: '[name].[contenthash].js',\n    clean: true,\n  },\n  optimization: {\n    splitChunks: {\n      chunks: 'all',\n    },\n  },\n  plugins: [\n    new webpack.ProvidePlugin({\n      process: 'process/browser',\n      Buffer: ['buffer', 'Buffer'],\n      React: 'react',\n    }),\n    new HtmlWebpackPlugin({\n      template: './src/index.html',\n    }),\n    new CopyWebpackPlugin({\n      patterns: [{ from: 'public' }],\n    }),\n  ],\n  module: {\n    rules: [\n      {\n        test: /\\.(ts|tsx)$/i,\n        exclude: /(node_modules)/,\n        use: [\n          {\n            loader: require.resolve('swc-loader'),\n            options: {\n              jsc: {\n                transform: {\n                  react: {\n                    development: !isProduction,\n                    refresh: !isProduction,\n                  },\n                },\n              },\n            },\n          },\n        ],\n      },\n      {\n        test: /\\.css$/i,\n        use: ['style-loader', 'css-loader', 'postcss-loader'],\n      },\n      {\n        test: /\\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,\n        type: 'asset',\n      },\n    ],\n  },\n  resolve: {\n    extensions: ['.tsx', '.ts', '.jsx', '.js'],\n    fallback: {\n      'buffer': require.resolve('buffer'),\n      'process/browser': require.resolve('process/browser')\n    },\n  },\n}\n\nconst prodConfig = {\n  mode: 'production',\n  plugins: [\n    new Dotenv({ path: '.env', systemvars: true }),\n    new WorkboxWebpackPlugin.GenerateSW(),\n    new CompressionPlugin(),\n  ]\n}\n\nconst devConfig = {\n  mode: 'development',\n  devServer: {\n    // open: true,\n    host: 'localhost',\n    port: 8760,\n  },\n  plugins: [\n    new Dotenv({ path: '.env.development' }),\n    new ReactRefreshPlugin(),\n  ]\n}\n\nmodule.exports = () => merge(config, isProduction ? prodConfig : devConfig)\n"
  }
]