[
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\ngithub: [mariotaku] \npatreon: # Replace with a single Patreon username\nopen_collective: # Replace with a single Open Collective username\nko_fi: # Replace with a single Ko-fi username\ntidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel\ncommunity_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry\nliberapay: # Replace with a single Liberapay username\nissuehunt: # Replace with a single IssueHunt username\notechie: # Replace with a single Otechie username\ncustom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: \"[BUG]\"\nlabels: ''\nassignees: ''\n\n---\n\n## Issue Summary\n\nA clear and concise description of what the bug is.\n\n## Steps to Reproduce\n\nSteps to reproduce the behavior:\n\n1. Go to '...'\n2. Click on '....'\n3. Select '....'\n4. See error\n\n## Expected Behavior\n\nA clear and concise description of what you expected to happen.\n\n## Basic Information\n\n<!-- Please complete information below. Issue without context might get closed.-->\n\n### IHSplay Information\n\n<!-- Find app & system information by open :question: button, select Feedback and share the info below. -->\n\n### Computer Setup\n\n<!-- Describe your computer setup, like OS version, GPU model, monitor resolution etc. -->\n\n## Additional Context\n\nAdd any other context about the problem here. For example error message on the screen, and settings in IHSplay\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Is your feature request related to a problem? Please describe.**\nA clear and concise description of what the problem is. Ex. I'm always frustrated when [...]\n\n**Describe the solution you'd like**\nA clear and concise description of what you want to happen.\n\n**Describe alternatives you've considered**\nA clear and concise description of any alternative solutions or features you've considered.\n\n**Additional context**\nAdd any other context or screenshots about the feature request here.\n"
  },
  {
    "path": ".github/workflows/build-test.yml",
    "content": "name: Build Test\n\non:\n  push:\n    # Don't run for tags\n    tags-ignore:\n      - '**'\n    branches:\n      - '**'\nenv:\n  # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)\n  BUILD_TYPE: Release\n\njobs:\n  build-webos:\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions/checkout@v4\n        with:\n          fetch-depth: 0\n          submodules: recursive\n\n      - name: Download ares-cli-rs\n        uses: robinraju/release-downloader@v1.9\n        with:\n          repository: \"webosbrew/ares-cli-rs\"\n          latest: true\n          fileName: \"ares-package_*.deb\"\n          out-file-path: \"temp\"\n\n      - name: Download Homebrew Toolbox\n        uses: robinraju/release-downloader@v1.9\n        with:\n          repository: \"webosbrew/dev-toolbox-cli\"\n          latest: true\n          fileName: \"webosbrew-toolbox-*.deb\"\n          out-file-path: \"temp\"\n\n      - name: Install Tools\n        run: sudo apt-get install ./temp/*.deb\n\n      - name: Download webOS NDK\n        uses: robinraju/release-downloader@v1.9\n        with:\n          repository: \"openlgtv/buildroot-nc4\"\n          latest: true\n          fileName: \"arm-webos-linux-gnueabi_sdk-buildroot.tar.gz\"\n          out-file-path: \"/tmp\"\n\n      - name: Extract webOS NDK\n        shell: bash\n        working-directory: /tmp\n        run: |\n          tar xzf arm-webos-linux-gnueabi_sdk-buildroot.tar.gz\n          ./arm-webos-linux-gnueabi_sdk-buildroot/relocate-sdk.sh\n\n      - name: Build\n        env:\n          TOOLCHAIN_FILE: /tmp/arm-webos-linux-gnueabi_sdk-buildroot/usr/share/buildroot/toolchainfile.cmake\n        run: ./tools/webos/easy_build.sh -DCMAKE_BUILD_TYPE=$BUILD_TYPE\n\n      - name: Add Commit Hash Suffix\n        shell: bash\n        working-directory: dist\n        run: for file in *.ipk ; do mv $file ${file//_arm/-${GITHUB_SHA:0:8}_arm} ; done\n\n      - uses: actions/upload-artifact@v4\n        with:\n          name: webos-snapshot\n          path: dist/*.ipk\n\n      - name: Compatibility Check\n        run: webosbrew-ipk-verify -f markdown -d -o $GITHUB_STEP_SUMMARY dist/*.ipk\n\n  build-raspi:\n    runs-on: ubuntu-20.04\n\n    steps:\n      - uses: actions/checkout@v4\n        with:\n          submodules: recursive\n\n      - name: Run apt-get update\n        shell: bash\n        run: sudo apt-get -y -qq update\n\n      - name: Prepare Sysroot\n        id: pi-sysroot\n        uses: mariotaku/raspbian-sysroot-action@v1.2\n        with:\n          release: bullseye\n          packages: ${{github.workspace}}/deploy/raspbian/sysroot-packages.list\n\n      - name: Install Build Tools\n        shell: bash\n        # apt-get update was implicitly called, so we don't have to call it here\n        run: sudo apt-get -y -qq install crossbuild-essential-armhf cmake\n\n      - name: Create Build Environment\n        # Some projects don't allow in-source building, so create a separate build directory\n        # We'll use this as our working directory for all subsequent commands\n        run: cmake -E make_directory ${{github.workspace}}/build\n\n      - name: Configure CMake\n        # Use a bash shell, so we can use the same syntax for environment variable\n        # access regardless of the host operating system\n        shell: bash\n        working-directory: ${{github.workspace}}/build\n        # Note the current convention is to use the -S and -B options here to specify source\n        # and build directories, but this is only available with CMake 3.13 and higher.\n        # The CMake binaries on the GitHub Actions machines are (as of this writing) 3.12\n        run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DTARGET_RASPI=ON\n          -DCMAKE_TOOLCHAIN_FILE=${{steps.pi-sysroot.outputs.cmake-toolchain}}\n\n\n      - name: Build\n        working-directory: ${{github.workspace}}/build\n        shell: bash\n        # Execute the build.  You can specify a specific target with \"--target <NAME>\"\n        run: |\n          cmake --build . --config $BUILD_TYPE\n"
  },
  {
    "path": ".github/workflows/release.yml",
    "content": "name: Release\n\non:\n  release:\n    types: [ created ]\n\nenv:\n  # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)\n  BUILD_TYPE: Debug\n\njobs:\n  build-webos:\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions/checkout@v4\n        with:\n          submodules: recursive\n\n      - name: Download ares-cli-rs\n        uses: robinraju/release-downloader@v1.9\n        with:\n          repository: \"webosbrew/ares-cli-rs\"\n          latest: true\n          fileName: \"ares-package_*.deb\"\n          out-file-path: \"temp\"\n\n      - name: Download Homebrew Toolbox\n        uses: robinraju/release-downloader@v1.9\n        with:\n          repository: \"webosbrew/dev-toolbox-cli\"\n          latest: true\n          fileName: \"webosbrew-toolbox-gen-manifest_*.deb\"\n          out-file-path: \"temp\"\n\n      - name: Install Tools\n        run: sudo apt-get install ./temp/*.deb\n\n      - name: Download webOS NDK\n        uses: robinraju/release-downloader@v1.9\n        with:\n          repository: \"openlgtv/buildroot-nc4\"\n          latest: true\n          fileName: \"arm-webos-linux-gnueabi_sdk-buildroot.tar.gz\"\n          out-file-path: \"/tmp\"\n\n      - name: Extract webOS NDK\n        shell: bash\n        working-directory: /tmp\n        run: |\n          tar xzf arm-webos-linux-gnueabi_sdk-buildroot.tar.gz\n          ./arm-webos-linux-gnueabi_sdk-buildroot/relocate-sdk.sh\n\n      - name: Build\n        env:\n          TOOLCHAIN_FILE: /tmp/arm-webos-linux-gnueabi_sdk-buildroot/usr/share/buildroot/toolchainfile.cmake\n        run: ./tools/webos/easy_build.sh -DCMAKE_BUILD_TYPE=$BUILD_TYPE\n\n      - name: Create Release (webOS)\n        id: create_release_webos\n        uses: ncipollo/release-action@v1.14.0\n        with:\n          token: ${{ secrets.GITHUB_TOKEN }}\n          name: Release ${{ steps.tagName.outputs.tag }}\n          allowUpdates: true\n          omitNameDuringUpdate: true\n          omitBodyDuringUpdate: true\n          omitPrereleaseDuringUpdate: true\n          artifacts: dist/*.ipk,dist/*.manifest.json\n"
  },
  {
    "path": ".gitignore",
    "content": "### C++ template\n# Prerequisites\n*.d\n\n# Compiled Object files\n*.slo\n*.lo\n*.o\n*.obj\n\n# Precompiled Headers\n*.gch\n*.pch\n\n# Compiled Dynamic libraries\n*.so\n*.dylib\n*.dll\n\n# Fortran module files\n*.mod\n*.smod\n\n# Compiled Static libraries\n*.lai\n*.la\n*.a\n*.lib\n\n# Executables\n*.exe\n*.out\n*.app\n\n### C template\n# Prerequisites\n\n# Object files\n*.ko\n*.elf\n\n# Linker output\n*.ilk\n*.map\n*.exp\n\n# Precompiled Headers\n\n# Libraries\n\n# Shared objects (inc. Windows DLLs)\n*.so.*\n\n# Executables\n*.i*86\n*.x86_64\n*.hex\n\n# Debug files\n*.dSYM/\n*.su\n*.idb\n*.pdb\n\n# Kernel Module Compile Results\n*.mod*\n*.cmd\n.tmp_versions/\nmodules.order\nModule.symvers\nMkfile.old\ndkms.conf\n\n# Everything under .idea directory\n.idea/\n\n### CMake template\nCMakeLists.txt.user\nCMakeCache.txt\nCMakeFiles\nCMakeScripts\nTesting\nMakefile\ncmake_install.cmake\ninstall_manifest.txt\ncompile_commands.json\nCTestTestfile.cmake\n_deps\nbuild/\ndist/"
  },
  {
    "path": ".gitmodules",
    "content": "[submodule \"third_party/lvgl\"]\n\tpath = third_party/lvgl\n\turl = https://github.com/lvgl/lvgl.git\n[submodule \"third_party/ihslib\"]\n\tpath = core\n\turl = https://github.com/mariotaku/ihslib.git\n[submodule \"cmake/sanitizers\"]\n\tpath = cmake/sanitizers\n\turl = https://github.com/arsenm/sanitizers-cmake.git\n[submodule \"third_party/ss4s\"]\n\tpath = third_party/ss4s\n\turl = https://github.com/mariotaku/ss4s.git\n[submodule \"third_party/commons\"]\n\tpath = third_party/commons\n\turl = https://github.com/mariotaku/commons-c.git\n"
  },
  {
    "path": ".run/ihsplay.run.xml",
    "content": "<component name=\"ProjectRunConfigurationManager\">\n  <configuration default=\"false\" name=\"ihsplay\" type=\"com.jetbrains.cidr.remote.gdbserver.type\" factoryName=\"com.jetbrains.cidr.remote.gdbserver.factory\" PROGRAM_PARAMS=\":1234 ihsplay\" REDIRECT_INPUT=\"false\" ELEVATE=\"false\" USE_EXTERNAL_CONSOLE=\"false\" WORKING_DIR=\"file:///media/developer/apps/usr/palm/applications/org.mariotaku.ihsplay\" PASS_PARENT_ENVS_2=\"false\" PROJECT_NAME=\"ihsplay\" TARGET_NAME=\"ihsplay-install\" CONFIG_NAME=\"webOS Debug\" version=\"1\" RUN_TARGET_PROJECT_NAME=\"ihsplay\" RUN_TARGET_NAME=\"ihsplay\">\n    <envs>\n      <env name=\"APPID\" value=\"org.mariotaku.ihsplay\" />\n      <env name=\"LD_LIBRARY_PATH\" value=\"/media/developer/apps/usr/palm/applications/org.mariotaku.ihsplay/lib\" />\n      <env name=\"HOME\" value=\"/media/developer/apps/usr/palm/applications/org.mariotaku.ihsplay\" />\n      <env name=\"XDG_RUNTIME_DIR\" value=\"/tmp/xdg\" />\n    </envs>\n    <custom-gdb-server version=\"1\" gdb-connect=\"um7380:1234\" executable=\"/media/developer/bin/gdbserver\" warmup-ms=\"0\" download-type=\"NONE\" sshConfigName=\"root@um7380:22 agent\" uploadFile=\"/tmp/CLion/debug/ihsplay\" defaultGdbServerArgs=\":1234 /tmp/CLion/debug/ihsplay\">\n      <debugger toolchainName=\"webOS\" />\n    </custom-gdb-server>\n    <method v=\"2\">\n      <option name=\"CLION.COMPOUND.BUILD\" enabled=\"true\" />\n    </method>\n  </configuration>\n</component>"
  },
  {
    "path": "CMakeLists.txt",
    "content": "cmake_minimum_required(VERSION 3.16)\n\nexecute_process(COMMAND git describe --tags --abbrev=0 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\n        OUTPUT_VARIABLE IHSPLAY_VERSION ERROR_QUIET)\nif (IHSPLAY_VERSION)\n    string(STRIP \"${IHSPLAY_VERSION}\" IHSPLAY_VERSION)\n    string(SUBSTRING \"${IHSPLAY_VERSION}\" 1 -1 IHSPLAY_VERSION)\nelse ()\n    set(IHSPLAY_VERSION \"0.0.0\")\nendif ()\n\nproject(ihsplay VERSION ${IHSPLAY_VERSION} LANGUAGES C)\n\n# To suppress warnings for MbedTLS\nif (POLICY CMP0048)\n    cmake_policy(SET CMP0048 NEW)\nendif ()\n# To suppress warnings for ExternalProject DOWNLOAD_EXTRACT_TIMESTAMP\nif (POLICY CMP0135)\n    cmake_policy(SET CMP0135 NEW)\nendif ()\n\nenable_testing()\n\n# Somehow the directory containing FindMbedTLS.cmake must be in the first place\nlist(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/core/scripts ${CMAKE_SOURCE_DIR}/third_party/commons/cmake\n        ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_SOURCE_DIR}/cmake/sanitizers/cmake)\n\noption(IHSPLAY_WIP_FEATURES \"Enable Work-in-Progress Features\" OFF)\noption(IHSPLAY_FEATURE_FORCE_FULLSCREEN \"Force full screen mode\" OFF)\n\nset(IHSPLAY_FEATURE_LIBCEC ON)\n\noption(COMMONS_LV_SDL_IMG_USE_IMAGE \"Don't use SDL_Image\" OFF)\n\nset(COMMONS_LOGGING_SDL ON)\nset(COMMONS_LOGGING_LVGL ON)\nset(COMMONS_LOGGING_SS4S ON)\n\nget_filename_component(CMAKE_C_COMPILER_NAME \"${CMAKE_C_COMPILER}\" NAME)\n\nif (CMAKE_C_COMPILER_NAME MATCHES \"^arm-webos-linux-gnueabi-\")\n    set(TARGET_WEBOS TRUE)\nendif ()\n\n# Use `pkg-config` to link needed libraries.\nfind_package(PkgConfig REQUIRED)\nfind_package(Freetype REQUIRED)\nfind_package(Fontconfig REQUIRED)\nfind_package(MbedTLS)\n\n# Use SDL2 for window creation and event handling.\nif (TARGET_WEBOS)\n    set(CMAKE_INSTALL_LIBDIR lib/backports)\n    set(SDL2_BACKPORT_REVISION \"webOS-2.30.x\")\n    include(ExternalSDL2BackportForWebOS)\n    unset(CMAKE_INSTALL_LIBDIR)\nelse ()\n    pkg_check_modules(SDL2 REQUIRED sdl2>=2.0.14)\nendif()\npkg_check_modules(PROTOBUF_C libprotobuf-c)\npkg_check_modules(OPUS opus)\n\nif (NOT PROTOBUF_C_FOUND)\n    list(APPEND CMAKE_MESSAGE_INDENT \"  \")\n    message(STATUS \"Including protobuf-c from source...\")\n    include(ExternalProtobufC)\n    list(POP_BACK CMAKE_MESSAGE_INDENT)\nendif ()\n\nif (NOT OPUS_FOUND)\n    list(APPEND CMAKE_MESSAGE_INDENT \"  \")\n    message(STATUS \"Including opus from source...\")\n    include(ExternalOPUS)\n    list(POP_BACK CMAKE_MESSAGE_INDENT)\nendif ()\n\nif (NOT MBEDTLS_FOUND)\n    list(APPEND CMAKE_MESSAGE_INDENT \"  \")\n    message(STATUS \"Including mbedtls from source...\")\n    include(ExternalMbedTLS)\n    list(POP_BACK CMAKE_MESSAGE_INDENT)\nendif ()\n\nif (TARGET_WEBOS)\n#    set(IHSLIB_SDL_TARGETVERSION \"2.28.0\")\n    set(SS4S_MODULE_DISABLE_MMAL ON)\nendif ()\n\nadd_subdirectory(core)\n\nadd_subdirectory(third_party/lvgl EXCLUDE_FROM_ALL)\n\ntarget_include_directories(lvgl SYSTEM PRIVATE ${SDL2_INCLUDE_DIRS})\ntarget_include_directories(lvgl SYSTEM PRIVATE ${FREETYPE_INCLUDE_DIRS})\n\ntarget_link_libraries(lvgl PRIVATE ${SDL2_LIBRARIES} ${FREETYPE_LIBRARIES})\ntarget_compile_definitions(lvgl PUBLIC LV_CONF_PATH=../../../app/lvgl/lv_conf.h)\n\nadd_subdirectory(third_party/ss4s)\nadd_subdirectory(third_party/commons)\n\nset(CMAKE_C_STANDARD 11)\n\nadd_subdirectory(app)\ntarget_include_directories(ihsplay PRIVATE app)\n\ntarget_link_libraries(ihsplay PRIVATE lvgl ihslib ihslib-hid-sdl ss4s commons-array-list commons-os-info\n        commons-logging commons-ss4s-modules-list)\ntarget_link_libraries(ihsplay PRIVATE lv_gridview)\n\nget_target_property(SS4S_MODULE_LIBRARY_OUTPUT_DIRECTORY ss4s SS4S_MODULE_LIBRARY_OUTPUT_DIRECTORY)\n\ntarget_include_directories(ihsplay SYSTEM PRIVATE ${SDL2_INCLUDE_DIRS} ${OPUS_INCLUDE_DIRS} ${MBEDTLS_INCLUDE_DIRS})\ntarget_link_libraries(ihsplay PRIVATE ${SDL2_LIBRARIES} ${OPUS_LIBRARIES} Fontconfig::Fontconfig Freetype::Freetype\n        ${MBEDCRYPTO_LIBRARY})\n\nif (TARGET_WEBOS)\n    set(IHSPLAY_FEATURE_LIBCEC OFF)\n    set(IHSPLAY_FEATURE_FORCE_FULLSCREEN ON)\n    target_link_libraries(ihsplay PRIVATE commons-luna-sync)\n\n    set_target_properties(ihsplay PROPERTIES\n            BUILD_WITH_INSTALL_RPATH TRUE\n            INSTALL_RPATH_USE_LINK_PATH TRUE\n            INSTALL_RPATH \"$ORIGIN/lib/backports:$ORIGIN\")\n    include(PackageWebOS)\nelse ()\n    set(CMAKE_INSTALL_PREFIX /usr)\n    include(GNUInstallDirs)\nendif ()\n\nif (IHSPLAY_FEATURE_LIBCEC AND TARGET commons-cec-sdl)\n    target_link_libraries(ihsplay PRIVATE commons-cec-sdl)\nelse ()\n    set(IHSPLAY_FEATURE_LIBCEC OFF)\nendif ()\n\nif (IHSPLAY_SANITIZE_ADDRESS)\n    target_compile_options(ihsplay PRIVATE -fsanitize=address)\n    target_link_options(ihsplay PRIVATE -fsanitize=address)\n    target_link_libraries(ihsplay PRIVATE asan)\nendif ()\n\nif (CMAKE_BUILD_TYPE STREQUAL \"Debug\")\n    set(IHSPLAY_IS_DEBUG ON)\nendif ()\n\nconfigure_file(app/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)\ntarget_include_directories(ihsplay PRIVATE ${CMAKE_CURRENT_BINARY_DIR})\n\nadd_subdirectory(tests)"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://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 General Public License is a free, copyleft license for\nsoftware and other kinds of works.\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,\nthe GNU General Public License is 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.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\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  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\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 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. Use with the GNU Affero General Public License.\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 Affero 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 special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe 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 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 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 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 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 General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    {project}  Copyright (C) {year}  {fullname}\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\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 GPL, see\n<http://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": "```\n    ______  _______       __\n   /  _/ / / / ___/____  / /___ ___  __      In-Home\n   / // /_/ /\\__ \\/ __ \\/ / __ `/ / / /     Streaming\n _/ // __  /___/ / /_/ / / /_/ / /_/ /     Player\n/___/_/ /_//____/ .___/_/\\__,_/\\__, /     For Steam\n               /_/            /____/\n```\n\nIHSplay is an SDL2 based Steam Link Client, primarily targeting webOS TV\nand Raspberry Pi.\n\nThe application will be providing a TV remote / gamepad friendly UI, and\nlow latency video / audio output, as well as generic mouse / keyboard /\ngamepad support.\n\n---\n\n![Home UI](https://user-images.githubusercontent.com/830358/219081008-e5eb646a-76fa-4683-9869-35e3923618ce.png)\n\n![Streaming Overlay](https://user-images.githubusercontent.com/830358/207047480-8cc96496-4fab-4a0e-8d1a-896183c54a6e.png)\n\n\nStay tuned!\n"
  },
  {
    "path": "app/.gitignore",
    "content": "./config.h"
  },
  {
    "path": "app/CMakeLists.txt",
    "content": "add_executable(ihsplay\n        main.c\n        app.c\n        app_events.c\n        app_gamepad.c\n        )\n\nadd_subdirectory(settings)\nadd_subdirectory(backend)\nadd_subdirectory(lvgl)\nadd_subdirectory(ui)\nadd_subdirectory(util)\nadd_subdirectory(platform)"
  },
  {
    "path": "app/app.c",
    "content": "#include <stdlib.h>\n#include <assert.h>\n\n#include \"app.h\"\n#include \"ui/app_ui.h\"\n#include \"backend/host_manager.h\"\n#include \"backend/stream_manager.h\"\n#include \"backend/input_manager.h\"\n#include \"util/client_info.h\"\n\napp_t *app_create(app_settings_t *settings, void *disp) {\n    assert(settings != NULL);\n    assert(disp != NULL);\n    app_t *app = calloc(1, sizeof(app_t));\n    app->settings = settings;\n    app->main_thread_id = SDL_ThreadID();\n    app->running = true;\n    bool client_info_loaded = client_info_load(&app->client_info);\n    assert(client_info_loaded);\n    app->input_manager = input_manager_create();\n    app->host_manager = host_manager_create(app);\n    app->stream_manager = stream_manager_create(app);\n    app->ui = app_ui_create(app, (lv_disp_t *) disp);\n    app_ui_created(app->ui);\n    return app;\n}\n\nvoid app_destroy(app_t *app) {\n    app_ui_destroy(app->ui);\n    stream_manager_destroy(app->stream_manager);\n    host_manager_destroy(app->host_manager);\n    input_manager_destroy(app->input_manager);\n    client_info_clear(&app->client_info);\n    free(app);\n}\n\nvoid app_quit(app_t *app) {\n    stream_manager_stop_active(app->stream_manager);\n    app->running = false;\n}\n\nvoid app_assert_main_thread(app_t *app) {\n    assert(app->main_thread_id == SDL_ThreadID());\n}"
  },
  {
    "path": "app/app.h",
    "content": "#pragma once\n\n#include <stdbool.h>\n#include <SDL.h>\n\n#include \"ihslib.h\"\n#include \"ss4s.h\"\n#include \"settings/app_settings.h\"\n#include \"util/client_info.h\"\n#include \"os_info.h\"\n\ntypedef struct app_ui_t app_ui_t;\ntypedef struct stream_manager_t stream_manager_t;\ntypedef struct host_manager_t host_manager_t;\ntypedef struct input_manager_t input_manager_t;\n\ntypedef struct app_t {\n    bool running;\n    SDL_threadID main_thread_id;\n    app_ui_t *ui;\n    app_settings_t *settings;\n    client_info_t client_info;\n    os_info_t os_info;\n    host_manager_t *host_manager;\n    stream_manager_t *stream_manager;\n    input_manager_t *input_manager;\n} app_t;\n\ntypedef enum app_event_type_t {\n    APP_EVENT_BEGIN = SDL_USEREVENT,\n    APP_RUN_ON_MAIN,\n    APP_UI_EVENT_BEGIN,\n    APP_UI_NAV_QUIT,\n    APP_UI_NAV_BACK,\n    APP_UI_REQUEST_OVERLAY,\n    APP_UI_CLOSE_OVERLAY,\n    APP_UI_GAMEPAD_DEVICE_CHANGED,\n    APP_UI_EVENT_LAST,\n    APP_EVENT_LAST,\n} app_event_type_t;\n\ntypedef void(*app_run_action_fn)(app_t *, void *);\n\nvoid app_preinit(int argc, char *argv[]);\n\napp_t *app_create(app_settings_t *settings, void *disp);\n\nvoid app_destroy(app_t *app);\n\nvoid app_quit(app_t *app);\n\nvoid app_post_event(app_t *app, app_event_type_t type, void *data1, void *data2);\n\nvoid app_run_on_main(app_t *app, app_run_action_fn action, void *data);\n\nvoid app_run_on_main_sync(app_t *app, app_run_action_fn action, void *data);\n\nvoid app_sdl_input_event(app_t *app, const SDL_Event *event);\n\nvoid app_assert_main_thread(app_t *app);\n\nvoid app_ihs_log(IHS_LogLevel level, const char *tag, const char *message);"
  },
  {
    "path": "app/app_events.c",
    "content": "#include \"app.h\"\n\ntypedef struct bus_blocking_action_t {\n    app_run_action_fn action;\n\n    void *data;\n    SDL_mutex *mutex;\n    SDL_cond *cond;\n    bool done;\n} bus_action_sync_t;\n\nstatic void invoke_action_sync(app_t *app, void *data);\n\nvoid app_post_event(app_t *app, app_event_type_t type, void *data1, void *data2) {\n    (void) app;\n    SDL_Event event;\n    event.user.type = type;\n    event.user.data1 = data1;\n    event.user.data2 = data2;\n    SDL_PushEvent(&event);\n}\n\nvoid app_run_on_main(app_t *app, app_run_action_fn action, void *data) {\n    (void) app;\n    app_post_event(app, APP_RUN_ON_MAIN, action, data);\n}\n\nvoid app_run_on_main_sync(app_t *app, app_run_action_fn action, void *data) {\n    bus_action_sync_t sync = {\n            .action = action,\n            .data = data,\n            .mutex = SDL_CreateMutex(),\n            .cond = SDL_CreateCond(),\n            .done = false,\n    };\n    app_run_on_main(app, invoke_action_sync, &sync);\n    SDL_LockMutex(sync.mutex);\n    while (!sync.done) {\n        SDL_CondWait(sync.cond, sync.mutex);\n    }\n    SDL_UnlockMutex(sync.mutex);\n    SDL_DestroyMutex(sync.mutex);\n    SDL_DestroyCond(sync.cond);\n}\n\nstatic void invoke_action_sync(app_t *app, void *data) {\n    (void) app;\n    bus_action_sync_t *sync = data;\n    SDL_LockMutex(sync->mutex);\n    sync->action(app, sync->data);\n    sync->done = true;\n    SDL_CondSignal(sync->cond);\n    SDL_UnlockMutex(sync->mutex);\n}"
  },
  {
    "path": "app/app_gamepad.c",
    "content": "#include \"ui/app_ui.h\"\n\n#include \"lvgl/keypad.h\"\n#include \"app.h\"\n#include \"backend/input_manager.h\"\n\nvoid app_sdl_input_event(app_t *app, const SDL_Event *event) {\n    switch (event->type) {\n        case SDL_CONTROLLERDEVICEADDED: {\n            input_manager_sdl_gamepad_added(app->input_manager, event->cdevice.which);\n            app_post_event(app, APP_UI_GAMEPAD_DEVICE_CHANGED, NULL, NULL);\n            break;\n        }\n        case SDL_CONTROLLERDEVICEREMOVED: {\n            input_manager_sdl_gamepad_removed(app->input_manager, event->cdevice.which);\n            app_post_event(app, APP_UI_GAMEPAD_DEVICE_CHANGED, NULL, NULL);\n            break;\n        }\n        case SDL_KEYUP:\n        case SDL_KEYDOWN: {\n            app_indev_keypad_sdl_key_event(app->ui->indev.keypad, &event->key);\n            break;\n        }\n        case SDL_CONTROLLERBUTTONUP:\n        case SDL_CONTROLLERBUTTONDOWN: {\n            app_indev_keypad_sdl_cbutton_event(app->ui->indev.keypad, &event->cbutton);\n            break;\n        }\n    }\n}"
  },
  {
    "path": "app/backend/CMakeLists.txt",
    "content": "target_sources(ihsplay PRIVATE host_manager.c input_manager.c)\nadd_subdirectory(stream)"
  },
  {
    "path": "app/backend/host_manager.c",
    "content": "#include <assert.h>\n\n#include \"app.h\"\n#include \"host_manager.h\"\n\n#include \"array_list.h\"\n#include \"util/refcounter.h\"\n#include \"util/listeners_list.h\"\n#include \"ui/common/error_messages.h\"\n#include \"logging.h\"\n\nstruct host_manager_t {\n    app_t *app;\n    IHS_Client *client;\n    SDL_TimerID timer;\n    array_list_t *hosts;\n    array_list_t *listeners;\n};\n\ntypedef struct host_manager_session_error_t {\n    IHS_HostInfo host;\n    uint32_t result;\n} host_manager_enum_error_t;\n\ntypedef struct host_manager_authorization_result_t {\n    IHS_HostInfo host;\n    uint64_t steam_id;\n} host_manager_authorization_result_t;\n\ntypedef struct host_manager_streaming_result_t {\n    IHS_HostInfo host;\n    IHS_SessionInfo session;\n} host_manager_streaming_result_t;\n\nstatic void client_host_discovered(IHS_Client *client, const IHS_HostInfo *host, void *context);\n\nstatic void client_authorization_success(IHS_Client *client, const IHS_HostInfo *host, uint64_t steamId,\n                                         void *context);\n\nstatic void client_authorization_failed(IHS_Client *client, const IHS_HostInfo *host,\n                                        IHS_AuthorizationResult result, void *context);\n\nstatic void client_streaming_success(IHS_Client *client, const IHS_HostInfo *host, const IHS_SocketAddress *address,\n                                     const uint8_t *sessionKey, size_t sessionKeyLen, void *context);\n\nstatic void client_streaming_failed(IHS_Client *client, const IHS_HostInfo *host, IHS_StreamingResult result,\n                                    void *context);\n\nstatic void client_host_discovered_main(app_t *app, void *data);\n\nstatic void client_streaming_success_main(app_t *app, void *data);\n\nstatic void client_streaming_failed_main(app_t *app, void *data);\n\nstatic void client_authorization_success_main(app_t *app, void *data);\n\nstatic void client_authorization_failed_main(app_t *app, void *data);\n\nstatic int compare_host_name(const void *a, const void *b);\n\nstatic const IHS_ClientDiscoveryCallbacks discovery_callbacks = {\n        .discovered = client_host_discovered,\n};\n\nstatic const IHS_ClientAuthorizationCallbacks authorization_callbacks = {\n        .success = client_authorization_success,\n        .failed = client_authorization_failed,\n};\n\nstatic const IHS_ClientStreamingCallbacks streaming_callbacks = {\n        .success = client_streaming_success,\n        .failed = client_streaming_failed,\n};\n\nhost_manager_t *host_manager_create(app_t *app) {\n    host_manager_t *manager = SDL_calloc(1, sizeof(host_manager_t));\n    manager->app = app;\n    manager->client = IHS_ClientCreate(&app->client_info.config);\n    manager->hosts = array_list_create(sizeof(IHS_HostInfo), 16);\n    manager->listeners = listeners_list_create();\n    IHS_ClientSetLogFunction(manager->client, app_ihs_log);\n    IHS_ClientSetDiscoveryCallbacks(manager->client, &discovery_callbacks, manager);\n    IHS_ClientSetAuthorizationCallbacks(manager->client, &authorization_callbacks, manager);\n    IHS_ClientSetStreamingCallbacks(manager->client, &streaming_callbacks, manager);\n    return manager;\n}\n\nvoid host_manager_destroy(host_manager_t *manager) {\n    IHS_ClientStop(manager->client);\n    IHS_ClientThreadedJoin(manager->client);\n    IHS_ClientDestroy(manager->client);\n    listeners_list_destroy(manager->listeners);\n    array_list_destroy(manager->hosts);\n    SDL_free(manager);\n}\n\nvoid host_manager_discovery_start(host_manager_t *manager) {\n    IHS_ClientStartDiscovery(manager->client, 10000);\n}\n\nvoid host_manager_discovery_stop(host_manager_t *manager) {\n    IHS_ClientStopDiscovery(manager->client);\n}\n\narray_list_t *host_manager_get_hosts(host_manager_t *manager) {\n    return manager->hosts;\n}\n\nvoid host_manager_session_request(host_manager_t *manager, const IHS_HostInfo *host) {\n    IHS_StreamingRequest request = {\n            .audioChannelCount = 2,\n            .streamingEnable.audio = true,\n            .streamingEnable.video = true,\n            .streamingEnable.input = true,\n            .maxResolution.x = 1920,\n            .maxResolution.y = 1080,\n    };\n    IHS_ClientStreamingRequest(manager->client, host, &request);\n}\n\nvoid host_manager_register_listener(host_manager_t *manager, const host_manager_listener_t *listener, void *context) {\n    listeners_list_add(manager->listeners, listener, context);\n}\n\nvoid host_manager_unregister_listener(host_manager_t *manager, const host_manager_listener_t *listener) {\n    listeners_list_remove(manager->listeners, listener);\n}\n\nvoid host_manager_authorization_request(host_manager_t *manager, const IHS_HostInfo *host, const char *pin) {\n    IHS_ClientAuthorizationRequest(manager->client, host, pin);\n}\n\nbool host_manager_authorization_cancel(host_manager_t *manager) {\n    return IHS_ClientAuthorizationCancel(manager->client);\n}\n\nstatic void client_host_discovered(IHS_Client *client, const IHS_HostInfo *host, void *context) {\n    (void) client;\n    host_manager_t *manager = context;\n    IHS_HostInfo *host_copy = SDL_calloc(1, sizeof(IHS_HostInfo));\n    *host_copy = *host;\n    app_run_on_main(manager->app, client_host_discovered_main, host_copy);\n}\n\nstatic void client_authorization_success(IHS_Client *client, const IHS_HostInfo *host, uint64_t steamId,\n                                         void *context) {\n    (void) client;\n    host_manager_t *manager = context;\n    host_manager_authorization_result_t *result = SDL_calloc(1, sizeof(host_manager_authorization_result_t));\n    result->host = *host;\n    result->steam_id = steamId;\n    app_run_on_main(manager->app, client_authorization_success_main, result);\n}\n\nstatic void client_authorization_failed(IHS_Client *client, const IHS_HostInfo *host, IHS_AuthorizationResult result,\n                                        void *context) {\n    (void) client;\n    host_manager_t *manager = context;\n    commons_log_error(\"Client\", \"Authorization failed: %u\", result);\n    host_manager_enum_error_t *error = SDL_calloc(1, sizeof(host_manager_enum_error_t));\n    error->host = *host;\n    error->result = result;\n    app_run_on_main(manager->app, client_authorization_failed_main, error);\n}\n\nstatic void client_streaming_success(IHS_Client *client, const IHS_HostInfo *host, const IHS_SocketAddress *address,\n                                     const uint8_t *sessionKey, size_t sessionKeyLen, void *context) {\n    (void) client;\n    host_manager_t *manager = context;\n    host_manager_streaming_result_t *result = SDL_calloc(1, sizeof(host_manager_streaming_result_t));\n    result->host = *host;\n    result->session.address = *address;\n    SDL_memcpy(result->session.sessionKey, sessionKey, sessionKeyLen);\n    result->session.sessionKeyLen = sessionKeyLen;\n    app_run_on_main(manager->app, client_streaming_success_main, result);\n}\n\nstatic void client_streaming_failed(IHS_Client *client, const IHS_HostInfo *host, IHS_StreamingResult result,\n                                    void *context) {\n    (void) client;\n    host_manager_t *manager = context;\n    commons_log_error(\"Client\", \"Failed to start streaming: %s\", streaming_result_str(result));\n    host_manager_enum_error_t *error = SDL_calloc(1, sizeof(host_manager_enum_error_t));\n    error->host = *host;\n    error->result = result;\n    app_run_on_main(manager->app, client_streaming_failed_main, error);\n}\n\nstatic void client_host_discovered_main(app_t *app, void *data) {\n    host_manager_t *manager = app->host_manager;\n    IHS_HostInfo *host = data;\n    IHS_HostInfo *info = NULL;\n    array_list_t *hosts = manager->hosts;\n    int insert_index = -1, update_index = -1;\n    int old_size = array_list_size(hosts);\n    for (int i = 0, j = old_size; i < j; ++i) {\n        IHS_HostInfo *item = array_list_get(hosts, i);\n        if (item->clientId == host->clientId) {\n            info = item;\n            update_index = i;\n            break;\n        } else if (compare_host_name(item, host) > 0) {\n            if (insert_index == -1) {\n                insert_index = i;\n            }\n        }\n    }\n    host_manager_hosts_change change_type;\n    int change_index;\n    if (info == NULL) {\n        commons_log_debug(\"Hosts\", \"New host discovered: %s\", host->hostname);\n        info = array_list_add(hosts, insert_index);\n        change_type = HOST_MANAGER_HOSTS_NEW;\n        change_index = insert_index < 0 ? old_size : insert_index;\n    } else {\n        change_type = HOST_MANAGER_HOSTS_UPDATE;\n        assert(update_index >= 0);\n        change_index = update_index;\n    }\n    assert(info != NULL);\n    *info = *host;\n    SDL_free(host);\n\n    listeners_list_notify(manager->listeners, host_manager_listener_t, hosts_changed, hosts, change_type,\n                          change_index);\n}\n\nstatic void client_streaming_success_main(app_t *app, void *data) {\n    host_manager_t *manager = app->host_manager;\n    host_manager_streaming_result_t *result = data;\n\n    listeners_list_notify(manager->listeners, host_manager_listener_t, session_started, &result->host, &result->session);\n    SDL_free(result);\n}\n\nstatic void client_streaming_failed_main(app_t *app, void *data) {\n    host_manager_t *manager = app->host_manager;\n    host_manager_enum_error_t *error = data;\n\n    listeners_list_notify(manager->listeners, host_manager_listener_t, session_start_failed, &error->host,\n                          error->result);\n    SDL_free(error);\n}\n\nstatic void client_authorization_success_main(app_t *app, void *data) {\n    host_manager_t *manager = app->host_manager;\n    host_manager_authorization_result_t *result = data;\n    listeners_list_notify(manager->listeners, host_manager_listener_t, authorized, &result->host,\n                          result->steam_id);\n    SDL_free(result);\n\n}\n\nstatic void client_authorization_failed_main(app_t *app, void *data) {\n    host_manager_t *manager = app->host_manager;\n    host_manager_enum_error_t *error = data;\n\n    listeners_list_notify(manager->listeners, host_manager_listener_t, authorization_failed, &error->host,\n                          error->result);\n    SDL_free(error);\n}\n\nstatic int compare_host_name(const void *a, const void *b) {\n    const IHS_HostInfo *info1 = a;\n    const IHS_HostInfo *info2 = b;\n    return strncasecmp(info1->hostname, info2->hostname, 63);\n}"
  },
  {
    "path": "app/backend/host_manager.h",
    "content": "#pragma once\n\n#include <ihslib.h>\n\ntypedef struct app_t app_t;\ntypedef struct host_manager_t host_manager_t;\ntypedef struct array_list_t array_list_t;\n\ntypedef enum host_manager_hosts_change {\n    HOST_MANAGER_HOSTS_NEW,\n    HOST_MANAGER_HOSTS_UPDATE\n} host_manager_hosts_change;\n\ntypedef struct host_manager_listener_t {\n    void (*hosts_changed)(array_list_t *list, host_manager_hosts_change change, int index, void *context);\n\n    void (*session_started)(const IHS_HostInfo *host, const IHS_SessionInfo *config, void *context);\n\n    void (*session_start_failed)(const IHS_HostInfo *host, IHS_StreamingResult result, void *context);\n\n    void (*authorized)(const IHS_HostInfo *host, uint64_t steam_id, void *context);\n\n    void (*authorization_failed)(const IHS_HostInfo *host, IHS_AuthorizationResult result, void *context);\n} host_manager_listener_t;\n\nhost_manager_t *host_manager_create(app_t *app);\n\nvoid host_manager_destroy(host_manager_t *manager);\n\nvoid host_manager_discovery_start(host_manager_t *manager);\n\nvoid host_manager_discovery_stop(host_manager_t *manager);\n\narray_list_t *host_manager_get_hosts(host_manager_t *manager);\n\nvoid host_manager_session_request(host_manager_t *manager, const IHS_HostInfo *host);\n\nvoid host_manager_register_listener(host_manager_t *manager, const host_manager_listener_t *listener, void *context);\n\nvoid host_manager_unregister_listener(host_manager_t *manager, const host_manager_listener_t *listener);\n\nvoid host_manager_authorization_request(host_manager_t *manager, const IHS_HostInfo *host, const char *pin);\n\nbool host_manager_authorization_cancel(host_manager_t *manager);"
  },
  {
    "path": "app/backend/input_manager.c",
    "content": "#include \"logging.h\"\n#include \"input_manager.h\"\n\n#include <assert.h>\n\n#include \"ihslib/hid/sdl.h\"\n\nstatic void insert_controller(input_manager_t *manager, SDL_JoystickID id, SDL_GameController *controller);\n\nstatic void remove_controller_at(input_manager_t *manager, size_t index);\n\nstatic int manager_index(const input_manager_t *manager, SDL_JoystickID id);\n\nstatic int js_count(void *context);\n\nstatic int js_index(SDL_JoystickID instance_id, void *context);\n\nstatic SDL_JoystickID js_instance_id(int index, void *context);\n\nstatic SDL_GameController *js_controller(int index, void *context);\n\nstatic int instance_id_compar(const void *id, const void *item);\n\nstatic const IHS_HIDProviderSDLDeviceList hid_device_list = {\n        .count = js_count,\n        .index = js_index,\n        .instanceId = js_instance_id,\n        .controller = js_controller,\n};\n\ninput_manager_t *input_manager_create() {\n    input_manager_t *manager = calloc(1, sizeof(input_manager_t));\n    array_list_init(&manager->controllers, sizeof(opened_controller_t), 8);\n    manager->hid_provider = IHS_HIDProviderSDLCreateUnmanaged(&hid_device_list, manager);\n    return manager;\n}\n\nvoid input_manager_destroy(input_manager_t *manager) {\n    IHS_HIDProviderSDLDestroy(manager->hid_provider);\n    for (int i = 0, j = array_list_size(&manager->controllers); i < j; i++) {\n        opened_controller_t *controller = array_list_get(&manager->controllers, i);\n        SDL_GameControllerClose(controller->controller);\n    }\n    array_list_deinit(&manager->controllers);\n    free(manager);\n}\n\nIHS_HIDProvider *input_manager_get_hid_provider(input_manager_t *manager) {\n    return manager->hid_provider;\n}\n\nvoid input_manager_sdl_gamepad_added(input_manager_t *manager, int which) {\n    SDL_GameController *controller = SDL_GameControllerOpen(which);\n    if (controller == NULL) {\n        commons_log_error(\"Input\", \"Failed to open gamepad #%d: %s\", which, SDL_GetError());\n        return;\n    }\n    SDL_Joystick *joystick = SDL_GameControllerGetJoystick(controller);\n    SDL_JoystickID id = SDL_JoystickInstanceID(joystick);\n    insert_controller(manager, id, controller);\n    commons_log_info(\"Input\", \"Gamepad #%d: %s added.\", id, SDL_JoystickName(joystick));\n}\n\nvoid input_manager_sdl_gamepad_removed(input_manager_t *manager, SDL_JoystickID which) {\n    commons_log_info(\"Input\", \"Removing gamepad, instance_id: #%d.\", which);\n    int index = manager_index(manager, which);\n    assert(index >= 0);\n    opened_controller_t *controller = array_list_get(&manager->controllers, index);\n    SDL_GameControllerClose(controller->controller);\n    remove_controller_at(manager, index);\n    commons_log_info(\"Input\", \"Gamepad #%d removed.\", which);\n}\n\nsize_t input_manager_sdl_gamepad_count(const input_manager_t *manager) {\n    return array_list_size(&manager->controllers);\n}\n\nvoid input_manager_ignore_next_mouse_movement(input_manager_t *manager) {\n    manager->ignore_next_mouse_movement = true;\n}\n\nbool input_manager_get_and_reset_mouse_movement(input_manager_t *manager) {\n    bool ignore = manager->ignore_next_mouse_movement;\n    manager->ignore_next_mouse_movement = false;\n    return ignore;\n}\n\nstatic void insert_controller(input_manager_t *manager, SDL_JoystickID id, SDL_GameController *controller) {\n    int insert_after;\n    for (insert_after = (int) (array_list_size(&manager->controllers) - 1); insert_after >= 0; insert_after--) {\n        opened_controller_t *item = array_list_get(&manager->controllers, insert_after);\n        if (id >= item->id) {\n            break;\n        }\n    }\n    opened_controller_t *new_item = array_list_add(&manager->controllers, insert_after + 1);\n    new_item->id = id;\n    new_item->controller = controller;\n}\n\nstatic void remove_controller_at(input_manager_t *manager, size_t index) {\n    array_list_remove(&manager->controllers, (int) index);\n}\n\nstatic int manager_index(const input_manager_t *manager, SDL_JoystickID id) {\n    return array_list_bsearch(&manager->controllers, &id, instance_id_compar);\n}\n\nstatic int js_count(void *context) {\n    input_manager_t *manager = context;\n    return (int) array_list_size(&manager->controllers);\n}\n\nstatic int js_index(SDL_JoystickID instance_id, void *context) {\n    input_manager_t *manager = context;\n    for (int i = 0, j = array_list_size(&manager->controllers); i < j; i++) {\n        opened_controller_t *item = array_list_get(&manager->controllers, i);\n        if (item->id == instance_id) {\n            return i;\n        }\n    }\n    return -1;\n}\n\nstatic SDL_JoystickID js_instance_id(int index, void *context) {\n    input_manager_t *manager = context;\n    opened_controller_t *item = array_list_get(&manager->controllers, index);\n    if (item == NULL) {\n        return -1;\n    }\n    return item->id;\n}\n\nstatic SDL_GameController *js_controller(int index, void *context) {\n    input_manager_t *manager = context;\n    opened_controller_t *item = array_list_get(&manager->controllers, index);\n    if (item == NULL) {\n        return NULL;\n    }\n    return item->controller;\n}\n\nstatic int instance_id_compar(const void *id, const void *item) {\n    return *((SDL_JoystickID *) id) - ((const opened_controller_t *) item)->id;\n}"
  },
  {
    "path": "app/backend/input_manager.h",
    "content": "#pragma once\n\n#include <SDL2/SDL.h>\n#include <stdbool.h>\n#include \"ihslib/hid/sdl.h\"\n#include \"array_list.h\"\n\ntypedef struct opened_controller_t {\n    SDL_GameController *controller;\n    SDL_JoystickID id;\n} opened_controller_t;\n\ntypedef struct input_manager_t {\n    array_list_t controllers;\n    IHS_HIDProvider *hid_provider;\n    bool ignore_next_mouse_movement;\n} input_manager_t;\n\ninput_manager_t *input_manager_create();\n\nvoid input_manager_destroy(input_manager_t *manager);\n\nIHS_HIDProvider *input_manager_get_hid_provider(input_manager_t *manager);\n\nvoid input_manager_sdl_gamepad_added(input_manager_t *manager, int which);\n\nvoid input_manager_sdl_gamepad_removed(input_manager_t *manager, SDL_JoystickID which);\n\nsize_t input_manager_sdl_gamepad_count(const input_manager_t *manager);\n\n/**\n * Tell the app to ignore next mouse movement, for manual moving the cursor position\n * @param manager\n */\nvoid input_manager_ignore_next_mouse_movement(input_manager_t *manager);\n\nbool input_manager_get_and_reset_mouse_movement(input_manager_t *manager);\n"
  },
  {
    "path": "app/backend/stream/CMakeLists.txt",
    "content": "target_sources(ihsplay PRIVATE stream_manager.c stream_media.c stream_input.c)"
  },
  {
    "path": "app/backend/stream/stream_input.c",
    "content": "#include \"app.h\"\n#include \"ui/app_ui.h\"\n\n#include \"stream_input.h\"\n#include \"stream_manager_internal.h\"\n#include \"backend/input_manager.h\"\n\nbool stream_input_handle_key_event(stream_manager_t *manager, const SDL_KeyboardEvent *event) {\n#ifdef __WEBOS__\n    SDL_Keysym keysym = event->keysym;\n    switch ((int) keysym.scancode) {\n        case SDL_SCANCODE_WEBOS_EXIT: {\n            if (event->state == SDL_RELEASED) {\n                stream_manager_set_overlay_opened(manager, true);\n            }\n            return true;\n        }\n        case SDL_SCANCODE_WEBOS_BACK: {\n            // TODO: Send ESC key\n            return true;\n        }\n    }\n#endif\n    if (event->keysym.sym == SDLK_ESCAPE) {\n        if (event->state == SDL_RELEASED) {\n            stream_manager_set_overlay_opened(manager, true);\n        }\n        return true;\n    }\n    if (!manager->app->settings->enable_input) {\n        return true;\n    }\n    if (event->state == SDL_PRESSED) {\n        IHS_SessionSendKeyDown(manager->session, event->keysym.scancode);\n    } else {\n        IHS_SessionSendKeyUp(manager->session, event->keysym.scancode);\n    }\n    return true;\n}\n\nbool stream_input_handle_mouse_event(stream_manager_t *manager, const SDL_Event *event) {\n    if (!manager->app->settings->enable_input) {\n        return true;\n    }\n    switch (event->type) {\n        case SDL_MOUSEMOTION: {\n            if (input_manager_get_and_reset_mouse_movement(manager->app->input_manager)) {\n                break;\n            }\n            if (manager->app->settings->relmouse) {\n                IHS_SessionSendMouseMovement(manager->session, event->motion.xrel, event->motion.yrel);\n            } else {\n                int w, h;\n                SDL_GetWindowSize(manager->app->ui->window, &w, &h);\n                IHS_SessionSendMousePosition(manager->session, (float) event->motion.x / (float) w,\n                                             (float) event->motion.y / (float) h);\n            }\n            return true;\n        }\n        case SDL_MOUSEBUTTONDOWN:\n        case SDL_MOUSEBUTTONUP: {\n            IHS_StreamInputMouseButton button = 0;\n            switch (event->button.button) {\n                case SDL_BUTTON_LEFT:\n                    button = IHS_MOUSE_BUTTON_LEFT;\n                    break;\n                case SDL_BUTTON_RIGHT:\n                    button = IHS_MOUSE_BUTTON_RIGHT;\n                    break;\n                case SDL_BUTTON_MIDDLE:\n                    button = IHS_MOUSE_BUTTON_MIDDLE;\n                    break;\n                case SDL_BUTTON_X1:\n                    button = IHS_MOUSE_BUTTON_X1;\n                    break;\n                case SDL_BUTTON_X2:\n                    button = IHS_MOUSE_BUTTON_X2;\n                    break;\n            }\n            if (button != 0) {\n                if (event->button.state == SDL_RELEASED) {\n                    IHS_SessionSendMouseUp(manager->session, button);\n                } else {\n                    IHS_SessionSendMouseDown(manager->session, button);\n                }\n            }\n            return true;\n        }\n        case SDL_MOUSEWHEEL: {\n            Sint32 x = event->wheel.x, y = event->wheel.y;\n            if (event->wheel.direction == SDL_MOUSEWHEEL_FLIPPED) {\n                x *= -1;\n                y *= -1;\n            }\n            if (x != 0) {\n                IHS_SessionSendMouseWheel(manager->session, x < 0 ? IHS_MOUSE_WHEEL_LEFT : IHS_MOUSE_WHEEL_RIGHT);\n            }\n            if (y != 0) {\n                IHS_SessionSendMouseWheel(manager->session, y > 0 ? IHS_MOUSE_WHEEL_UP : IHS_MOUSE_WHEEL_DOWN);\n            }\n            return true;\n        }\n    }\n    return false;\n}"
  },
  {
    "path": "app/backend/stream/stream_input.h",
    "content": "#pragma once\n\n#include \"stream_manager.h\"\n\nbool stream_input_handle_key_event(stream_manager_t *manager, const SDL_KeyboardEvent *event);\n\nbool stream_input_handle_mouse_event(stream_manager_t *manager, const SDL_Event *event);\n"
  },
  {
    "path": "app/backend/stream/stream_manager.c",
    "content": "#include <assert.h>\n#include \"stream_manager.h\"\n#include \"stream_manager_internal.h\"\n\n#include \"app.h\"\n#include \"ui/app_ui.h\"\n#include \"util/listeners_list.h\"\n\n#include \"ihslib/hid/sdl.h\"\n\n#include \"ss4s.h\"\n\n#include \"stream_media.h\"\n#include \"stream_input.h\"\n\n#include \"backend/input_manager.h\"\n#include \"logging.h\"\n\nstatic void session_initialized(IHS_Session *session, void *context);\n\nstatic void session_finalized(IHS_Session *session, void *context);\n\nstatic void session_configuring(IHS_Session *session, IHS_SessionConfig *config, void *context);\n\nstatic void session_connected(IHS_Session *session, void *context);\n\nstatic void session_disconnected(IHS_Session *session, void *context);\n\nstatic void session_show_cursor(IHS_Session *session, float x, float y, void *context);\n\n// Main thread callbacks\n\nstatic void session_connected_main(app_t *app, void *context);\n\nstatic void session_disconnected_main(app_t *app, void *context);\n\nstatic void session_show_cursor_main(app_t *app, void *context);\n\nstatic void destroy_session_main(app_t *app, void *context);\n\nstatic void controller_back_pressed(stream_manager_t *manager);\n\nstatic void controller_back_released(stream_manager_t *manager);\n\nstatic Uint32 back_timer_callback(Uint32 duration, void *param);\n\nstatic void back_timer_progress_main(app_t *app, void *context);\n\nstatic void back_timer_finish_main(app_t *app, void *context);\n\nstatic void grab_mouse(stream_manager_t *manager, bool grab);\n\n#define BACK_COUNTER_MAX 100\n\ntypedef struct event_context_t {\n    stream_manager_t *manager;\n    void *arg1;\n    uint32_t value1;\n} event_context_t;\n\nstatic const IHS_StreamSessionCallbacks session_callbacks = {\n        .initialized = session_initialized,\n        .configuring = session_configuring,\n        .connected = session_connected,\n        .disconnected = session_disconnected,\n        .finalized = session_finalized,\n};\n\nstatic const IHS_StreamInputCallbacks input_callbacks = {\n        .showCursor = session_show_cursor,\n//        .hideCursor = session_hide_cursor,\n//        .setCursor = session_set_cursor,\n//        .cursorImage = session_cursor_image,\n};\n\nstream_manager_t *stream_manager_create(app_t *app) {\n    assert(app->input_manager != NULL);\n    stream_manager_t *manager = calloc(1, sizeof(stream_manager_t));\n    manager->app = app;\n    manager->listeners = listeners_list_create();\n    return manager;\n}\n\nvoid stream_manager_destroy(stream_manager_t *manager) {\n    switch (manager->state) {\n        case STREAM_MANAGER_STATE_IDLE: {\n            break;\n        }\n        default: {\n            destroy_session_main(manager->app, manager->session);\n            break;\n        }\n    }\n    listeners_list_destroy(manager->listeners);\n    free(manager);\n}\n\nvoid stream_manager_register_listener(stream_manager_t *manager, const stream_manager_listener_t *listener,\n                                      void *context) {\n    listeners_list_add(manager->listeners, listener, context);\n}\n\nvoid stream_manager_unregister_listener(stream_manager_t *manager, const stream_manager_listener_t *listener) {\n    listeners_list_remove(manager->listeners, listener);\n}\n\nbool stream_manager_start_session(stream_manager_t *manager, const IHS_SessionInfo *info) {\n    app_assert_main_thread(manager->app);\n    if (manager->state != STREAM_MANAGER_STATE_IDLE) {\n        return false;\n    }\n    // Reset all states for last session\n    manager->back_counter = 0;\n    manager->back_timer = 0;\n    manager->overlay_opened = false;\n    manager->requested_disconnect = false;\n\n    stream_media_session_t *media = stream_media_create(manager);\n    manager->media = media;\n    IHS_Session *session = IHS_SessionCreate(&manager->app->client_info.config, info);\n    IHS_SessionSetLogFunction(session, app_ihs_log);\n    IHS_SessionSetSessionCallbacks(session, &session_callbacks, manager);\n    IHS_SessionSetInputCallbacks(session, &input_callbacks, manager);\n    IHS_SessionSetAudioCallbacks(session, stream_media_audio_callbacks(), media);\n    IHS_SessionSetVideoCallbacks(session, stream_media_video_callbacks(), media);\n    IHS_SessionHIDAddProvider(session, input_manager_get_hid_provider(manager->app->input_manager));\n    manager->state = STREAM_MANAGER_STATE_CONNECTING;\n    commons_log_info(\"StreamManager\", \"Change state to CONNECTING\");\n    manager->session = session;\n\n    stream_media_set_viewport_size(media, manager->viewport_width, manager->viewport_height);\n    stream_media_set_overlay_height(media, manager->overlay_height);\n\n    IHS_SessionConnect(session);\n    return true;\n}\n\nIHS_Session *stream_manager_active_session(const stream_manager_t *manager) {\n    if (manager->state != STREAM_MANAGER_STATE_STREAMING) {\n        return NULL;\n    }\n    return manager->session;\n}\n\nvoid stream_manager_stop_active(stream_manager_t *manager) {\n    if (manager->state != STREAM_MANAGER_STATE_STREAMING) {\n        return;\n    }\n    manager->requested_disconnect = true;\n    IHS_SessionDisconnect(manager->session);\n}\n\nbool stream_manager_intercept_event(const stream_manager_t *manager, const SDL_Event *event) {\n    if (manager->state != STREAM_MANAGER_STATE_STREAMING) {\n        // Ignore events when idle\n        return false;\n    }\n    if (manager->overlay_opened) {\n        // No input event should be handled when overlay opened\n        return false;\n    }\n    switch (event->type) {\n        // Following events MUST be handled by the app too\n        case SDL_CONTROLLERDEVICEADDED:\n        case SDL_CONTROLLERDEVICEREMOVED:\n        case SDL_CONTROLLERDEVICEREMAPPED:\n            return false;\n    }\n    return true;\n}\n\nvoid stream_manager_handle_event(stream_manager_t *manager, const SDL_Event *event) {\n    if (manager->state != STREAM_MANAGER_STATE_STREAMING) {\n        return;\n    }\n    if (manager->overlay_opened) {\n        switch (event->type) {\n            // Following events be always handled by IHS, even with overlay opened\n            case SDL_CONTROLLERDEVICEADDED:\n            case SDL_CONTROLLERDEVICEREMOVED:\n            case SDL_CONTROLLERDEVICEREMAPPED:\n                break;\n            default:\n                return;\n        }\n    }\n    switch (event->type) {\n        case SDL_KEYDOWN:\n        case SDL_KEYUP: {\n            // Keyboard events\n            stream_input_handle_key_event(manager, &event->key);\n            break;\n        }\n        case SDL_MOUSEMOTION:\n        case SDL_MOUSEBUTTONDOWN:\n        case SDL_MOUSEBUTTONUP:\n        case SDL_MOUSEWHEEL: {\n            stream_input_handle_mouse_event(manager, event);\n            break;\n        }\n        case SDL_CONTROLLERBUTTONDOWN: {\n            if (event->cbutton.button == SDL_CONTROLLER_BUTTON_BACK) {\n                controller_back_pressed(manager);\n            }\n            break;\n        }\n        case SDL_CONTROLLERBUTTONUP: {\n            if (event->cbutton.button == SDL_CONTROLLER_BUTTON_BACK) {\n                controller_back_released(manager);\n            }\n            break;\n        }\n    }\n    if (manager->app->settings->enable_input) {\n        IHS_HIDHandleSDLEvent(manager->session, event);\n    }\n}\n\nvoid stream_manager_set_viewport_size(stream_manager_t *manager, int width, int height) {\n    manager->viewport_width = width;\n    manager->viewport_height = height;\n    if (manager->media != NULL) {\n        stream_media_set_viewport_size(manager->media, width, height);\n    }\n}\n\nbool stream_manager_is_overlay_opened(const stream_manager_t *manager) {\n    if (manager->state != STREAM_MANAGER_STATE_STREAMING) {\n        return false;\n    }\n    return manager->overlay_opened;\n}\n\nvoid stream_manager_set_overlay_height(stream_manager_t *manager, int height) {\n    manager->overlay_height = height;\n    if (manager->media != NULL) {\n        stream_media_set_overlay_height(manager->media, height);\n    }\n}\n\nbool stream_manager_set_overlay_opened(stream_manager_t *manager, bool opened) {\n    app_assert_main_thread(manager->app);\n    if (manager->state != STREAM_MANAGER_STATE_STREAMING) {\n        return false;\n    }\n    manager->overlay_opened = opened;\n    stream_media_set_overlay_shown(manager->media, opened);\n    if (opened) {\n        app_post_event(manager->app, APP_UI_REQUEST_OVERLAY, NULL, NULL);\n    } else {\n        app_post_event(manager->app, APP_UI_CLOSE_OVERLAY, NULL, NULL);\n    }\n    grab_mouse(manager, !opened);\n    return true;\n}\n\nvoid stream_manager_set_capture_size(stream_manager_t *manager, int width, int height) {\n    manager->capture_width = width;\n    manager->capture_height = height;\n}\n\nbool stream_manager_is_active(const stream_manager_t *manager) {\n    return manager->state == STREAM_MANAGER_STATE_STREAMING;\n}\n\nstatic void session_initialized(IHS_Session *session, void *context) {\n    stream_manager_t *manager = (stream_manager_t *) context;\n    assert (manager->state == STREAM_MANAGER_STATE_CONNECTING);\n    IHS_SessionConnect(session);\n}\n\nstatic void session_finalized(IHS_Session *session, void *context) {\n    stream_manager_t *manager = (stream_manager_t *) context;\n    assert(manager->state == STREAM_MANAGER_STATE_DISCONNECTING);\n    assert(manager->session == session);\n    manager->state = STREAM_MANAGER_STATE_IDLE;\n    commons_log_info(\"StreamManager\", \"Change state to IDLE\");\n    app_run_on_main(manager->app, destroy_session_main, session);\n}\n\nstatic void session_configuring(IHS_Session *session, IHS_SessionConfig *config, void *context) {\n    (void) session;\n    stream_manager_t *manager = (stream_manager_t *) context;\n    assert (manager->media != NULL);\n    config->enableHevc = stream_media_supports_hevc(manager->media);\n}\n\nstatic void session_connected(IHS_Session *session, void *context) {\n    stream_manager_t *manager = (stream_manager_t *) context;\n    assert(manager->state == STREAM_MANAGER_STATE_CONNECTING);\n    assert(manager->session == session);\n    manager->state = STREAM_MANAGER_STATE_STREAMING;\n    commons_log_info(\"StreamManager\", \"Change state to STREAMING\");\n    event_context_t ec = {\n            .manager = manager,\n            .arg1 = (void *) IHS_SessionGetInfo(session),\n    };\n    app_run_on_main_sync(manager->app, session_connected_main, &ec);\n    if (manager->app->settings->enable_input) {\n        IHS_SessionHIDNotifyDeviceChange(session);\n    }\n}\n\nstatic void session_disconnected(IHS_Session *session, void *context) {\n    stream_manager_t *manager = (stream_manager_t *) context;\n    assert(manager->state != STREAM_MANAGER_STATE_DISCONNECTING);\n    assert(manager->session == session);\n    if (manager->back_timer != 0) {\n        SDL_RemoveTimer(manager->back_timer);\n        manager->back_timer = 0;\n    }\n    bool requested = manager->requested_disconnect;\n    manager->state = STREAM_MANAGER_STATE_DISCONNECTING;\n    commons_log_info(\"StreamManager\", \"Change state to DISCONNECTING\");\n    event_context_t ec = {\n            .manager = manager,\n            .arg1 = (void *) IHS_SessionGetInfo(session),\n            .value1 = requested\n    };\n    app_run_on_main_sync(manager->app, session_disconnected_main, &ec);\n}\n\nstatic void session_show_cursor(IHS_Session *session, float x, float y, void *context) {\n    (void) session;\n    stream_manager_t *manager = (stream_manager_t *) context;\n    if (manager->capture_width <= 0 && manager->capture_height <= 0 || manager->viewport_width <= 0 ||\n        manager->viewport_height <= 0) {\n        return;\n    }\n    if (stream_manager_is_overlay_opened(manager)) {\n        return;\n    }\n    float scale = SDL_min((float) manager->viewport_width / manager->capture_width,\n                          (float) manager->viewport_height / manager->capture_height);\n    float dst_width = (float) manager->capture_width * scale, dst_height = (float) manager->capture_height * scale;\n    SDL_Point *point = calloc(1, sizeof(SDL_Point));\n    point->x = (int) (((float) manager->viewport_width - dst_width) / 2.0f + dst_width * x);\n    point->y = (int) (((float) manager->viewport_height - dst_height) / 2.0f + dst_height * y);\n    app_run_on_main(manager->app, session_show_cursor_main, point);\n}\n\nstatic void session_connected_main(app_t *app, void *context) {\n    (void) app;\n    event_context_t *ec = context;\n    stream_manager_t *manager = ec->manager;\n    listeners_list_notify(manager->listeners, stream_manager_listener_t, connected, (const IHS_SessionInfo *) ec->arg1);\n    grab_mouse(manager, true);\n}\n\nstatic void session_disconnected_main(app_t *app, void *context) {\n    (void) app;\n    event_context_t *ec = context;\n    stream_manager_t *manager = ec->manager;\n    grab_mouse(manager, false);\n    listeners_list_notify(manager->listeners, stream_manager_listener_t, disconnected,\n                          (const IHS_SessionInfo *) ec->arg1, ec->value1);\n}\n\nstatic void session_show_cursor_main(app_t *app, void *context) {\n    stream_manager_t *manager = app->stream_manager;\n    SDL_Point *point = context;\n    input_manager_ignore_next_mouse_movement(manager->app->input_manager);\n//    SDL_WarpMouseInWindow(app->ui->window, point->x, point->y);\n    free(context);\n}\n\nstatic void destroy_session_main(app_t *app, void *context) {\n    (void) app;\n    IHS_Session *session = context;\n    IHS_SessionThreadedJoin(session);\n    IHS_SessionDestroy(session);\n    stream_media_destroy(app->stream_manager->media);\n    app->stream_manager->media = NULL;\n}\n\nstatic void controller_back_pressed(stream_manager_t *manager) {\n    if (manager->state != STREAM_MANAGER_STATE_STREAMING || manager->back_timer != 0) {\n        return;\n    }\n    manager->back_counter = 0;\n    manager->back_timer = SDL_AddTimer(300, back_timer_callback, manager);\n}\n\nstatic void controller_back_released(stream_manager_t *manager) {\n    if (manager->state != STREAM_MANAGER_STATE_STREAMING || manager->back_timer == 0) {\n        return;\n    }\n    SDL_RemoveTimer(manager->back_timer);\n    manager->back_timer = 0;\n    commons_log_info(\"Streaming\", \"Overlay timer cancelled\");\n    // This function is expected to be called in main thread.\n    app_assert_main_thread(manager->app);\n    listeners_list_notify(manager->listeners, stream_manager_listener_t, overlay_progress_finished, false);\n}\n\nstatic void grab_mouse(stream_manager_t *manager, bool grab) {\n    if (manager->state != STREAM_MANAGER_STATE_STREAMING) {\n        SDL_SetRelativeMouseMode(SDL_FALSE);\n        return;\n    }\n    SDL_SetRelativeMouseMode(grab ? SDL_TRUE : SDL_FALSE);\n}\n\n\nstatic Uint32 back_timer_callback(Uint32 duration, void *param) {\n    (void) duration;\n    stream_manager_t *manager = (stream_manager_t *) param;\n    if (manager->state != STREAM_MANAGER_STATE_STREAMING) {\n        return 0;\n    }\n    manager->back_counter += 1;\n    if (manager->back_counter >= BACK_COUNTER_MAX) {\n        manager->back_timer = 0;\n        manager->back_counter = 0;\n        IHS_HIDResetSDLGameControllers(manager->session);\n        commons_log_info(\"Streaming\", \"Requesting overlay\");\n        app_run_on_main(manager->app, back_timer_finish_main, manager);\n        return 0;\n    } else {\n        app_run_on_main(manager->app, back_timer_progress_main, manager);\n    }\n    return 16;\n}\n\nstatic void back_timer_progress_main(app_t *app, void *context) {\n    (void) app;\n    stream_manager_t *manager = (stream_manager_t *) context;\n    listeners_list_notify(manager->listeners, stream_manager_listener_t, overlay_progress, manager->back_counter);\n}\n\nstatic void back_timer_finish_main(app_t *app, void *context) {\n    (void) app;\n    stream_manager_t *manager = (stream_manager_t *) context;\n    stream_manager_set_overlay_opened(manager, true);\n    listeners_list_notify(manager->listeners, stream_manager_listener_t, overlay_progress_finished, true);\n}"
  },
  {
    "path": "app/backend/stream/stream_manager.h",
    "content": "#pragma once\n\n#include \"ihslib.h\"\n\n#include <SDL.h>\n\ntypedef struct app_t app_t;\ntypedef struct host_manager_t host_manager_t;\n\ntypedef struct stream_manager_t stream_manager_t;\n\ntypedef struct stream_manager_callbacks_t {\n    void (*connected)(const IHS_SessionInfo *info, void *context);\n\n    void (*disconnected)(const IHS_SessionInfo *info, bool requested, void *context);\n\n    void (*overlay_progress)(int percentage, void *context);\n\n    void (*overlay_progress_finished)(bool requested, void *context);\n} stream_manager_listener_t;\n\nstream_manager_t *stream_manager_create(app_t *app);\n\nvoid stream_manager_destroy(stream_manager_t *manager);\n\nvoid stream_manager_register_listener(stream_manager_t *manager, const stream_manager_listener_t *listener,\n                                      void *context);\n\nvoid stream_manager_unregister_listener(stream_manager_t *manager, const stream_manager_listener_t *listener);\n\nbool stream_manager_start_session(stream_manager_t *manager, const IHS_SessionInfo *info);\n\nIHS_Session *stream_manager_active_session(const stream_manager_t *manager);\n\nvoid stream_manager_stop_active(stream_manager_t *manager);\n\n/**\n * Check if an event should only be dispatched to stream manager. This method call should not change any state\n * @return true if the event should only be processed by this manager\n */\nbool stream_manager_intercept_event(const stream_manager_t *manager, const SDL_Event *event);\n\nvoid stream_manager_handle_event(stream_manager_t *manager, const SDL_Event *event);\n\nvoid stream_manager_set_viewport_size(stream_manager_t *manager, int width, int height);\n\nbool stream_manager_is_overlay_opened(const stream_manager_t *manager);\n\nvoid stream_manager_set_overlay_height(stream_manager_t *manager, int height);\n\nbool stream_manager_set_overlay_opened(stream_manager_t *manager, bool opened);\n\nvoid stream_manager_set_capture_size(stream_manager_t *manager, int width, int height);\n\nbool stream_manager_is_active(const stream_manager_t *manager);"
  },
  {
    "path": "app/backend/stream/stream_manager_internal.h",
    "content": "#pragma once\n\n#include \"stream_manager.h\"\n#include \"stream_media.h\"\n\n#include \"array_list.h\"\n\ntypedef enum stream_manager_state_t {\n    STREAM_MANAGER_STATE_IDLE,\n    STREAM_MANAGER_STATE_CONNECTING,\n    STREAM_MANAGER_STATE_STREAMING,\n    STREAM_MANAGER_STATE_DISCONNECTING,\n} stream_manager_state_t;\n\nstruct stream_manager_t {\n    app_t *app;\n    array_list_t *listeners;\n\n    stream_manager_state_t state;\n\n    stream_media_session_t *media;\n    IHS_Session *session;\n    SDL_TimerID back_timer;\n    int back_counter;\n    bool overlay_opened;\n    bool requested_disconnect;\n\n    int viewport_width, viewport_height;\n    int capture_width, capture_height;\n    int overlay_height;\n};\n"
  },
  {
    "path": "app/backend/stream/stream_media.c",
    "content": "#include <stdlib.h>\n#include \"stream_media.h\"\n\n#include \"ss4s.h\"\n#include \"stream_manager.h\"\n#include \"app.h\"\n#include \"logging.h\"\n#include \"util/video/sps/include/sps_util.h\"\n\n#include <opus_multistream.h>\n#include <SDL2/SDL.h>\n\nstruct stream_media_session_t {\n    stream_manager_t *manager;\n    SDL_mutex *lock;\n    SS4S_Player *player;\n    SS4S_VideoCapabilities video_cap;\n\n    SS4S_VideoInfo video_info;\n    OpusMSDecoder *opus_decoder;\n    size_t pcm_unit_size;\n    int16_t *pcm_buffer;\n\n    int pcm_buffer_size;\n    int viewport_width, viewport_height;\n    int overlay_height;\n};\n\nstatic int audio_start(IHS_Session *session, const IHS_StreamAudioConfig *config, void *context);\n\nstatic void audio_stop(IHS_Session *session, void *context);\n\nstatic int audio_submit(IHS_Session *session, IHS_Buffer *data, void *context);\n\nstatic int video_start(IHS_Session *session, const IHS_StreamVideoConfig *config, void *context);\n\nstatic void video_stop(IHS_Session *session, void *context);\n\nstatic int video_submit(IHS_Session *session, IHS_Buffer *data, IHS_StreamVideoFrameFlag flags, void *context);\n\nstatic int video_set_capture_size(IHS_Session *session, int width, int height, void *context);\n\nstatic const IHS_StreamAudioCallbacks audio_callbacks = {\n        .start = audio_start,\n        .stop = audio_stop,\n        .submit = audio_submit,\n};\n\nstatic const IHS_StreamVideoCallbacks video_callbacks = {\n        .start = video_start,\n        .stop = video_stop,\n        .submit = video_submit,\n        .setCaptureSize = video_set_capture_size,\n};\n\nstream_media_session_t *stream_media_create(stream_manager_t *manager) {\n    stream_media_session_t *media_session = calloc(1, sizeof(stream_media_session_t));\n    media_session->manager = manager;\n    media_session->lock = SDL_CreateMutex();\n    media_session->player = SS4S_PlayerOpen();\n    SS4S_PlayerSetWaitAudioVideoReady(media_session->player, true);\n\n    SS4S_GetVideoCapabilities(&media_session->video_cap);\n    return media_session;\n}\n\nvoid stream_media_destroy(stream_media_session_t *media_session) {\n    SS4S_PlayerClose(media_session->player);\n    SDL_DestroyMutex(media_session->lock);\n    free(media_session);\n}\n\nvoid stream_media_set_viewport_size(stream_media_session_t *media_session, int width, int height) {\n    SDL_LockMutex(media_session->lock);\n    media_session->viewport_width = width;\n    media_session->viewport_height = height;\n    SDL_UnlockMutex(media_session->lock);\n}\n\nvoid stream_media_set_overlay_height(stream_media_session_t *media_session, int height) {\n    SDL_LockMutex(media_session->lock);\n    media_session->overlay_height = height;\n    SDL_UnlockMutex(media_session->lock);\n}\n\nvoid stream_media_set_overlay_shown(stream_media_session_t *media_session, bool overlay) {\n    if (media_session->video_cap.transform & SS4S_VIDEO_CAP_TRANSFORM_UI_COMPOSITING) {\n        return;\n    }\n    if (overlay) {\n        SDL_LockMutex(media_session->lock);\n        int ui_width = media_session->viewport_width, ui_height = media_session->viewport_height,\n                overlay_height = media_session->overlay_height;\n        if (ui_width <= 0 || ui_height <= 0 || overlay_height <= 0) {\n            SDL_UnlockMutex(media_session->lock);\n            return;\n        }\n        SS4S_VideoRect src = {\n                .x = 0, .y = 0,\n                .width = media_session->video_info.width,\n                .height = media_session->video_info.height * (ui_height - overlay_height) / ui_height\n        };\n        SDL_UnlockMutex(media_session->lock);\n\n        SS4S_VideoRect dest = {0, 0, ui_width, ui_height - overlay_height};\n        SS4S_PlayerVideoSetDisplayArea(media_session->player, &src, &dest);\n    } else {\n        SS4S_PlayerVideoSetDisplayArea(media_session->player, NULL, NULL);\n    }\n}\n\nbool stream_media_supports_hevc(stream_media_session_t *media_session) {\n    return media_session->video_cap.codecs & SS4S_VIDEO_H265;\n}\n\nconst IHS_StreamAudioCallbacks *stream_media_audio_callbacks() {\n    return &audio_callbacks;\n}\n\nconst IHS_StreamVideoCallbacks *stream_media_video_callbacks() {\n    return &video_callbacks;\n}\n\nstatic int audio_start(IHS_Session *session, const IHS_StreamAudioConfig *config, void *context) {\n    (void) session;\n    commons_log_info(\"Media\", \"Audio start. codec=%u, channels=%u, sampleRate=%u\", config->codec,\n                     config->channels, config->frequency);\n    if (config->codec != IHS_StreamAudioCodecOpus) {\n        return -1;\n    }\n    stream_media_session_t *media_session = (stream_media_session_t *) context;\n    SDL_LockMutex(media_session->lock);\n    int rc;\n    unsigned char mapping[2] = {0, 1};\n    const int samples_per_frame = 240;\n    media_session->pcm_buffer_size = samples_per_frame * 64;\n    media_session->pcm_unit_size = config->channels * sizeof(int16_t);\n\n    media_session->opus_decoder = opus_multistream_decoder_create(config->frequency, config->channels,\n                                                                  1, 1, mapping, &rc);\n    media_session->pcm_buffer = calloc(media_session->pcm_unit_size, media_session->pcm_buffer_size);\n    SS4S_AudioInfo info = {\n            .codec = SS4S_AUDIO_PCM_S16LE,\n            .numOfChannels = (int) config->channels,\n            .sampleRate = (int) config->frequency,\n            .samplesPerFrame = samples_per_frame,\n            .appName = \"IHSplay\",\n            .streamName = \"Streaming\",\n    };\n    SDL_UnlockMutex(media_session->lock);\n    return SS4S_PlayerAudioOpen(media_session->player, &info);\n}\n\nstatic void audio_stop(IHS_Session *session, void *context) {\n    (void) session;\n    stream_media_session_t *media_session = (stream_media_session_t *) context;\n    SS4S_PlayerAudioClose(media_session->player);\n    opus_multistream_decoder_destroy(media_session->opus_decoder);\n    free(media_session->pcm_buffer);\n}\n\nstatic int audio_submit(IHS_Session *session, IHS_Buffer *data, void *context) {\n    (void) session;\n    stream_media_session_t *media_session = (stream_media_session_t *) context;\n    int decode_len = opus_multistream_decode(media_session->opus_decoder, data->data + data->offset, data->size,\n                                             media_session->pcm_buffer, media_session->pcm_buffer_size, 0);\n    return SS4S_PlayerAudioFeed(media_session->player, (const unsigned char *) media_session->pcm_buffer,\n                                media_session->pcm_unit_size * decode_len);\n}\n\nstatic int video_start(IHS_Session *session, const IHS_StreamVideoConfig *config, void *context) {\n    (void) session;\n    SS4S_VideoCodec codec;\n    switch (config->codec) {\n        case IHS_StreamVideoCodecH264:\n            codec = SS4S_VIDEO_H264;\n            break;\n        case IHS_StreamVideoCodecHEVC:\n            codec = SS4S_VIDEO_H265;\n            break;\n        default:\n            return -1;\n    }\n    stream_media_session_t *media_session = (stream_media_session_t *) context;\n    SDL_LockMutex(media_session->lock);\n    commons_log_info(\"Media\", \"Video start. codec=%u, width=%u, height=%u\", config->codec, config->width,\n                     config->height);\n    SS4S_VideoInfo info = {\n            .codec = codec,\n            .width = (int) config->width,\n            .height = (int) config->height,\n    };\n    media_session->video_info = info;\n    SDL_UnlockMutex(media_session->lock);\n    return SS4S_PlayerVideoOpen(media_session->player, &info);\n}\n\nstatic void video_stop(IHS_Session *session, void *context) {\n    (void) session;\n    stream_media_session_t *media_session = (stream_media_session_t *) context;\n    SS4S_PlayerVideoClose(media_session->player);\n}\n\nstatic int video_submit(IHS_Session *session, IHS_Buffer *data, IHS_StreamVideoFrameFlag flags, void *context) {\n    (void) session;\n    stream_media_session_t *media_session = (stream_media_session_t *) context;\n    SS4S_VideoFeedFlags sflgs = 0;\n    if (flags & IHS_StreamVideoFrameKeyFrame) {\n        SDL_LockMutex(media_session->lock);\n        sflgs = SS4S_VIDEO_FEED_DATA_KEYFRAME;\n        sps_dimension_t dimension = {0, 0};\n        bool dimension_parsed = false;\n        switch (media_session->video_info.codec) {\n            case SS4S_VIDEO_H264: {\n                dimension_parsed = sps_util_parse_dimension_h264(IHS_BufferPointer(data), data->size, &dimension);\n                break;\n            }\n            case SS4S_VIDEO_H265: {\n                dimension_parsed = sps_util_parse_dimension_hevc(IHS_BufferPointer(data), data->size, &dimension);\n                break;\n            }\n            default: {\n                commons_log_fatal(\"Media\", \"Unexpected video codec %s!!\",\n                                  SS4S_VideoCodecName(media_session->video_info.codec));\n                abort();\n            }\n        }\n        if (!dimension_parsed) {\n            commons_log_warn(\"Media\", \"Can't parse NAL Unit.\");\n            commons_log_hexdump(COMMONS_LOG_LEVEL_WARN, \"Media\", IHS_BufferPointer(data), data->size);\n        }\n        if (dimension_parsed && (dimension.width != media_session->video_info.width ||\n                                 dimension.height != media_session->video_info.height)) {\n            commons_log_info(\"Media\", \"Size change detected by NAL header. (%d*%d)=>(%d*%d)\",\n                             media_session->video_info.width, media_session->video_info.height, dimension.width,\n                             dimension.height);\n            media_session->video_info.width = dimension.width;\n            media_session->video_info.height = dimension.height;\n            SS4S_PlayerVideoSizeChanged(media_session->player, dimension.width, dimension.height);\n        }\n        SDL_UnlockMutex(media_session->lock);\n    }\n    return SS4S_PlayerVideoFeed(media_session->player, data->data + data->offset, data->size, sflgs);\n}\n\nstatic int video_set_capture_size(IHS_Session *session, int width, int height, void *context) {\n    (void) session;\n    stream_media_session_t *media_session = (stream_media_session_t *) context;\n    stream_manager_set_capture_size(media_session->manager, width, height);\n    return 0;\n}"
  },
  {
    "path": "app/backend/stream/stream_media.h",
    "content": "#pragma once\n\n#include \"ihslib.h\"\n\ntypedef struct stream_media_session_t stream_media_session_t;\ntypedef struct stream_manager_t stream_manager_t;\n\nstream_media_session_t *stream_media_create(stream_manager_t *manager);\n\nvoid stream_media_destroy(stream_media_session_t *media);\n\nvoid stream_media_set_viewport_size(stream_media_session_t *media_session, int width, int height);\n\nvoid stream_media_set_overlay_height(stream_media_session_t *media_session, int height);\n\nvoid stream_media_set_overlay_shown(stream_media_session_t *media_session, bool overlay);\nbool stream_media_supports_hevc(stream_media_session_t *media_session);\n\nconst IHS_StreamAudioCallbacks *stream_media_audio_callbacks();\n\nconst IHS_StreamVideoCallbacks *stream_media_video_callbacks();"
  },
  {
    "path": "app/backend/stream_manager.h",
    "content": "#pragma once\n\n#include \"stream/stream_manager.h\""
  },
  {
    "path": "app/config.h.in",
    "content": "#pragma once\n\n#define IHSPLAY_VERSION_STRING \"@PROJECT_VERSION@\"\n#define SS4S_MODULES_INI_PATH \"@SS4S_MODULES_INI_PATH_RUNTIME@\"\n#cmakedefine01 IHSPLAY_IS_DEBUG\n#cmakedefine01 IHSPLAY_WIP_FEATURES\n#cmakedefine01 IHSPLAY_FEATURE_FORCE_FULLSCREEN\n#cmakedefine01 IHSPLAY_FEATURE_LIBCEC"
  },
  {
    "path": "app/lvgl/CMakeLists.txt",
    "content": "target_sources(ihsplay PRIVATE\n        display.c\n        mouse.c\n        keypad.c\n        theme.c)\n\nadd_subdirectory(ext)"
  },
  {
    "path": "app/lvgl/display.c",
    "content": "#include \"display.h\"\n\n#include <src/draw/sdl/lv_draw_sdl.h>\n#include <assert.h>\n\nstatic void flush_cb(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *src);\n\nlv_disp_t *app_lv_disp_init(SDL_Window *window) {\n    int width, height;\n    SDL_GetWindowSize(window, &width, &height);\n    assert(width > 0 || height > 0);\n    SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, \"1\");\n    SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);\n    lv_disp_draw_buf_t *draw_buf = malloc(sizeof(lv_disp_draw_buf_t));\n    SDL_Texture *texture = lv_draw_sdl_create_screen_texture(renderer, width, height);\n    lv_disp_draw_buf_init(draw_buf, texture, NULL, width * height);\n    lv_disp_drv_t *driver = malloc(sizeof(lv_disp_drv_t));\n    lv_disp_drv_init(driver);\n\n    lv_draw_sdl_drv_param_t *param = lv_mem_alloc(sizeof(lv_draw_sdl_drv_param_t));\n    param->renderer = renderer;\n    param->user_data = window;\n    driver->user_data = param;\n    driver->draw_buf = draw_buf;\n    driver->dpi = (int) (width / 5.333333);\n    driver->flush_cb = flush_cb;\n    driver->hor_res = width;\n    driver->ver_res = height;\n    SDL_SetRenderTarget(renderer, texture);\n    lv_disp_t *disp = lv_disp_drv_register(driver);\n    disp->bg_color = lv_color_black();\n    disp->bg_opa = LV_OPA_TRANSP;\n    return disp;\n}\n\nvoid app_lv_disp_deinit(lv_disp_t *disp) {\n    lv_disp_drv_t *drv = disp->driver;\n\n    lv_draw_ctx_t *draw_ctx = drv->draw_ctx;\n    drv->draw_ctx_deinit(drv, draw_ctx);\n    free(draw_ctx);\n\n    lv_disp_draw_buf_t *draw_buf = drv->draw_buf;\n    SDL_DestroyTexture(draw_buf->buf1);\n    free(draw_buf);\n\n    lv_draw_sdl_drv_param_t *param = drv->user_data;\n    SDL_DestroyRenderer(param->renderer);\n    free(param);\n\n    // Set act_scr to NULL to suppress warning when we remove the display\n    disp->act_scr = NULL;\n\n    lv_disp_remove(disp);\n\n    free(drv);\n}\n\nstatic void flush_cb(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *src) {\n    LV_UNUSED(src);\n    if (area->x2 < 0 || area->y2 < 0 ||\n        area->x1 > disp_drv->hor_res - 1 || area->y1 > disp_drv->ver_res - 1) {\n        lv_disp_flush_ready(disp_drv);\n        return;\n    }\n\n    if (lv_disp_flush_is_last(disp_drv)) {\n        lv_draw_sdl_drv_param_t *param = disp_drv->user_data;\n        SDL_Renderer *renderer = param->renderer;\n        SDL_Texture *texture = disp_drv->draw_buf->buf1;\n        SDL_SetRenderTarget(renderer, NULL);\n        SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);\n        SDL_RenderClear(renderer);\n        SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);\n        SDL_RenderCopy(renderer, texture, NULL, NULL);\n        SDL_RenderPresent(renderer);\n        SDL_SetRenderTarget(renderer, texture);\n    }\n    lv_disp_flush_ready(disp_drv);\n}"
  },
  {
    "path": "app/lvgl/display.h",
    "content": "#pragma once\n\n#include <lvgl.h>\n#include <SDL.h>\n\nlv_disp_t *app_lv_disp_init(SDL_Window *window);\n\nvoid app_lv_disp_deinit(lv_disp_t *disp);\n"
  },
  {
    "path": "app/lvgl/ext/CMakeLists.txt",
    "content": "target_sources(ihsplay PRIVATE lv_child_group.c msgbox_ext.c lv_dir_focus.c)"
  },
  {
    "path": "app/lvgl/ext/lv_child_group.c",
    "content": "#include \"lv_child_group.h\"\n\nvoid cb_child_group_add(lv_event_t *event) {\n    lv_obj_t *child = lv_event_get_param(event);\n    if (!child || !lv_obj_is_group_def(child)) return;\n    lv_group_t *group = lv_event_get_user_data(event);\n    if (lv_obj_get_group(child)) {\n        lv_group_remove_obj(child);\n    }\n    lv_group_add_obj(group, child);\n}"
  },
  {
    "path": "app/lvgl/ext/lv_child_group.h",
    "content": "#pragma once\n\n#include \"lvgl.h\"\n\nvoid cb_child_group_add(lv_event_t *event);"
  },
  {
    "path": "app/lvgl/ext/lv_dir_focus.c",
    "content": "#include \"lv_dir_focus.h\"\n\nstatic lv_style_prop_t props[4] = {\n        LV_STYLE_PROP_INV,\n        LV_STYLE_PROP_INV,\n        LV_STYLE_PROP_INV,\n        LV_STYLE_PROP_INV\n};\n\ntypedef enum focus_dir_index {\n    DIR_INDEX_LEFT = 0,\n    DIR_INDEX_RIGHT = 1,\n    DIR_INDEX_TOP = 2,\n    DIR_INDEX_BOTTOM = 3,\n} focus_dir_index;\n\nvoid lv_dir_focus_register() {\n    LV_ASSERT(lv_is_initialized());\n    props[DIR_INDEX_LEFT] = lv_style_register_prop(LV_STYLE_PROP_FLAG_NONE);\n    props[DIR_INDEX_RIGHT] = lv_style_register_prop(LV_STYLE_PROP_FLAG_NONE);\n    props[DIR_INDEX_TOP] = lv_style_register_prop(LV_STYLE_PROP_FLAG_NONE);\n    props[DIR_INDEX_BOTTOM] = lv_style_register_prop(LV_STYLE_PROP_FLAG_NONE);\n}\n\nvoid lv_obj_set_dir_focus_obj(lv_obj_t *obj, lv_dir_t dir, const lv_obj_t *to_focus) {\n    lv_style_value_t value = {.ptr = to_focus};\n    if (dir & LV_DIR_LEFT) {\n        lv_obj_set_local_style_prop(obj, props[DIR_INDEX_LEFT], value, 0);\n    }\n    if (dir & LV_DIR_RIGHT) {\n        lv_obj_set_local_style_prop(obj, props[DIR_INDEX_RIGHT], value, 0);\n    }\n    if (dir & LV_DIR_TOP) {\n        lv_obj_set_local_style_prop(obj, props[DIR_INDEX_TOP], value, 0);\n    }\n    if (dir & LV_DIR_BOTTOM) {\n        lv_obj_set_local_style_prop(obj, props[DIR_INDEX_BOTTOM], value, 0);\n    }\n}\n\nbool lv_obj_focus_dir(lv_obj_t *obj, lv_dir_t dir) {\n    lv_style_value_t value;\n    switch (dir) {\n        case LV_DIR_LEFT:\n            if (lv_obj_get_local_style_prop(obj, props[DIR_INDEX_LEFT], &value, 0) != LV_RES_OK) {\n                return false;\n            }\n            break;\n        case LV_DIR_RIGHT:\n            if (lv_obj_get_local_style_prop(obj, props[DIR_INDEX_RIGHT], &value, 0) != LV_RES_OK) {\n                return false;\n            }\n            break;\n        case LV_DIR_TOP:\n            if (lv_obj_get_local_style_prop(obj, props[DIR_INDEX_TOP], &value, 0) != LV_RES_OK) {\n                return false;\n            }\n            break;\n        case LV_DIR_BOTTOM:\n            if (lv_obj_get_local_style_prop(obj, props[DIR_INDEX_BOTTOM], &value, 0) != LV_RES_OK) {\n                return false;\n            }\n            break;\n        default:\n            return false;\n    }\n    lv_group_t *group = lv_obj_get_group(obj);\n    lv_obj_t **group_item = NULL;\n    _LV_LL_READ(&group->obj_ll, group_item) {\n        if (*group_item == value.ptr) {\n            break;\n        }\n    }\n    if (group_item == NULL) {\n        return false;\n    }\n    lv_group_focus_obj(*group_item);\n    return true;\n}\n\nbool lv_obj_focus_dir_by_key(lv_obj_t *obj, lv_key_t dir) {\n    switch (dir) {\n        case LV_KEY_LEFT: {\n            return lv_obj_focus_dir(obj, LV_DIR_LEFT);\n        }\n        case LV_KEY_RIGHT: {\n            return lv_obj_focus_dir(obj, LV_DIR_RIGHT);\n        }\n        case LV_KEY_UP: {\n            return lv_obj_focus_dir(obj, LV_DIR_TOP);\n        }\n        case LV_KEY_DOWN: {\n            return lv_obj_focus_dir(obj, LV_DIR_BOTTOM);\n        }\n        default: {\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "app/lvgl/ext/lv_dir_focus.h",
    "content": "#pragma once\n\n#include \"lvgl.h\"\n\n\nvoid lv_dir_focus_register();\n\nvoid lv_obj_set_dir_focus_obj(lv_obj_t *obj, lv_dir_t dir, const lv_obj_t *to_focus);\n\nbool lv_obj_focus_dir(lv_obj_t *obj, lv_dir_t dir);\n\nbool lv_obj_focus_dir_by_key(lv_obj_t *obj, lv_key_t dir);"
  },
  {
    "path": "app/lvgl/ext/msgbox_ext.c",
    "content": "#include \"msgbox_ext.h\"\n#include \"ui/app_ui.h\"\n#include \"lv_child_group.h\"\n\nstatic void msgbox_key(lv_event_t *event);\n\nstatic void msgbox_cancel(lv_event_t *event);\n\nstatic void msgbox_destroy(lv_event_t *event);\n\nvoid msgbox_inject_nav(app_ui_t *ui, lv_obj_t *obj) {\n    lv_group_t *group = lv_group_create();\n    group->user_data = ui;\n    app_ui_push_modal_group(ui, group);\n    lv_obj_add_event_cb(obj, cb_child_group_add, LV_EVENT_CHILD_CREATED, group);\n    lv_obj_add_event_cb(obj, msgbox_key, LV_EVENT_KEY, NULL);\n    lv_obj_add_event_cb(obj, msgbox_cancel, LV_EVENT_CANCEL, NULL);\n    lv_obj_add_event_cb(obj, msgbox_destroy, LV_EVENT_DELETE, group);\n}\n\nvoid msgbox_fix_sizes(lv_obj_t *obj, const char *btn_texts[]) {\n    lv_obj_t *btns = lv_msgbox_get_btns(obj);\n    if (btns != NULL) {\n        int i;\n        for (i = 0; btn_texts[i][0] != '\\0'; i++);\n        lv_obj_set_width(btns, i * LV_DPX(70) + (i - 1) * LV_DPX(10));\n    }\n}\n\nstatic void msgbox_key(lv_event_t *event) {\n    lv_obj_t *target = lv_event_get_target(event);\n    lv_group_t *group = lv_obj_get_group(target);\n    if (!group) return;\n    switch (lv_event_get_key(event)) {\n        case LV_KEY_UP: {\n            lv_group_focus_prev(group);\n            break;\n        }\n        case LV_KEY_DOWN: {\n            lv_group_focus_next(group);\n            break;\n        }\n        default: {\n            break;\n        }\n    }\n}\n\nstatic void msgbox_cancel(lv_event_t *event) {\n    lv_obj_t *mbox = lv_event_get_current_target(event);\n    lv_obj_t *target = lv_event_get_target(event);\n    lv_group_t *group = lv_obj_get_group(target);\n    if (!group) return;\n    lv_obj_t *btns = lv_msgbox_get_btns(mbox);\n    if (btns && !lv_obj_has_flag(btns, LV_OBJ_FLAG_HIDDEN) &&\n        !lv_btnmatrix_has_btn_ctrl(btns, 0, LV_BTNMATRIX_CTRL_DISABLED)) {\n        lv_msgbox_close(mbox);\n    }\n}\n\nstatic void msgbox_destroy(lv_event_t *event) {\n    lv_group_t *group = lv_event_get_user_data(event);\n    app_ui_remove_modal_group(group->user_data, group);\n    lv_group_remove_all_objs(group);\n    lv_group_del(group);\n}"
  },
  {
    "path": "app/lvgl/ext/msgbox_ext.h",
    "content": "#pragma once\n\n#include \"lvgl.h\"\n\ntypedef struct app_ui_t app_ui_t;\n\nvoid msgbox_inject_nav(app_ui_t *ui, lv_obj_t *obj);\n\nvoid msgbox_fix_sizes(lv_obj_t *obj, const char *btn_texts[]);"
  },
  {
    "path": "app/lvgl/fonts/bootstrap-icons/regular.h",
    "content": "#pragma once\nconst unsigned char ttf_bootstrap_icons_data[] = {\n  0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x80, 0x00, 0x03, 0x00, 0x30, 0x47, 0x53, 0x55, 0x42,\n  0xb8, 0xfc, 0xb8, 0xea, 0x00, 0x00, 0x01, 0x68, 0x00, 0x00, 0x00, 0x28, 0x4f, 0x53, 0x2f, 0x32,\n  0x3f, 0x32, 0x50, 0xfb, 0x00, 0x00, 0x01, 0xc8, 0x00, 0x00, 0x00, 0x60, 0x63, 0x6d, 0x61, 0x70,\n  0xb6, 0x0c, 0xaf, 0x9e, 0x00, 0x00, 0x02, 0xb8, 0x00, 0x00, 0x00, 0x9c, 0x67, 0x6c, 0x79, 0x66,\n  0xf3, 0xe0, 0xad, 0xaa, 0x00, 0x00, 0x03, 0x54, 0x00, 0x00, 0x0a, 0x54, 0x68, 0x65, 0x61, 0x64,\n  0x60, 0xac, 0xa0, 0x3f, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x00, 0x36, 0x68, 0x68, 0x65, 0x61,\n  0x02, 0x70, 0x01, 0x12, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x00, 0x24, 0x68, 0x6d, 0x74, 0x78,\n  0x01, 0x29, 0xff, 0xff, 0x00, 0x00, 0x01, 0x44, 0x00, 0x00, 0x00, 0x24, 0x6c, 0x6f, 0x63, 0x61,\n  0x19, 0x5a, 0x16, 0x91, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x22, 0x6d, 0x61, 0x78, 0x70,\n  0x01, 0x47, 0x01, 0x31, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x20, 0x6e, 0x61, 0x6d, 0x65,\n  0x06, 0xf1, 0x1f, 0x96, 0x00, 0x00, 0x02, 0x28, 0x00, 0x00, 0x00, 0x90, 0x70, 0x6f, 0x73, 0x74,\n  0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, 0x20, 0x00, 0x01, 0x00, 0x00,\n  0x00, 0x10, 0x01, 0x25, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0a,\n  0x00, 0x0a, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,\n  0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n  0x00, 0xd3, 0x00, 0xef, 0x01, 0x3b, 0x02, 0x06, 0x02, 0x64, 0x02, 0xe4, 0x03, 0x23, 0x03, 0x4d,\n  0x03, 0x7c, 0x03, 0xd6, 0x04, 0x40, 0x04, 0x98, 0x04, 0xdf, 0x04, 0xfd, 0x05, 0x2a, 0x00, 0x00,\n  0x00, 0x01, 0x00, 0x00, 0x01, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x2c, 0xff, 0xf9, 0xff, 0xe3,\n  0x01, 0x49, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n  0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n  0x00, 0x00, 0x00, 0x00, 0xff, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n  0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x26,\n  0x00, 0x26, 0x00, 0x02, 0x44, 0x46, 0x4c, 0x54, 0x00, 0x12, 0x6c, 0x61, 0x74, 0x6e, 0x00, 0x0e,\n  0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,\n  0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0e, 0x4d, 0xb9, 0x5b, 0x5f, 0x0f, 0x3c, 0xf5,\n  0x08, 0x0b, 0x01, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x25, 0xb0, 0x80, 0x00, 0x00, 0x00, 0x00,\n  0x7c, 0x25, 0xb0, 0x80, 0xff, 0xf9, 0xff, 0xe3, 0x01, 0x49, 0x01, 0x33, 0x00, 0x00, 0x00, 0x08,\n  0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01, 0x2c, 0x01, 0x90, 0x00, 0x05,\n  0x00, 0x00, 0x00, 0xbe, 0x00, 0xd2, 0x00, 0x00, 0x00, 0x2a, 0x00, 0xbe, 0x00, 0xd2, 0x00, 0x00,\n  0x00, 0x90, 0x00, 0x0e, 0x00, 0x4d, 0x00, 0x00, 0x02, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x00,\n  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n  0x00, 0x00, 0x50, 0x66, 0x45, 0x64, 0x00, 0xc0, 0xf2, 0x29, 0xf6, 0xce, 0x01, 0x2c, 0x00, 0x00,\n  0x00, 0x1b, 0x01, 0x47, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x4e, 0x00, 0x03,\n  0x00, 0x01, 0x04, 0x09, 0x00, 0x01, 0x00, 0x1e, 0x00, 0x24, 0x00, 0x03, 0x00, 0x01, 0x04, 0x09,\n  0x00, 0x02, 0x00, 0x0e, 0x00, 0x16, 0x00, 0x03, 0x00, 0x01, 0x04, 0x09, 0x00, 0x03, 0x00, 0x1e,\n  0x00, 0x24, 0x00, 0x03, 0x00, 0x01, 0x04, 0x09, 0x00, 0x04, 0x00, 0x1e, 0x00, 0x24, 0x00, 0x03,\n  0x00, 0x01, 0x04, 0x09, 0x00, 0x05, 0x00, 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x04, 0x09,\n  0x00, 0x06, 0x00, 0x1e, 0x00, 0x24, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69,\n  0x00, 0x6f, 0x00, 0x6e, 0x00, 0x20, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x30, 0x00, 0x52, 0x00, 0x65,\n  0x00, 0x67, 0x00, 0x75, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x72, 0x00, 0x62, 0x00, 0x6f, 0x00, 0x6f,\n  0x00, 0x74, 0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00, 0x61, 0x00, 0x70, 0x00, 0x2d, 0x00, 0x69,\n  0x00, 0x63, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x73, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03,\n  0x00, 0x00, 0x00, 0x14, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x04, 0x00, 0x88,\n  0x00, 0x00, 0x00, 0x1e, 0x00, 0x10, 0x00, 0x03, 0x00, 0x0e, 0xf2, 0x29, 0xf2, 0xcc, 0xf2, 0xd4,\n  0xf3, 0x02, 0xf3, 0xe2, 0xf4, 0xf2, 0xf4, 0xff, 0xf5, 0x04, 0xf5, 0xed, 0xf6, 0x59, 0xf6, 0x5b,\n  0xf6, 0x5e, 0xf6, 0xc1, 0xf6, 0xce, 0xff, 0xff, 0x00, 0x00, 0xf2, 0x29, 0xf2, 0xcc, 0xf2, 0xd4,\n  0xf3, 0x02, 0xf3, 0xe2, 0xf4, 0xf1, 0xf4, 0xff, 0xf5, 0x04, 0xf5, 0xed, 0xf6, 0x59, 0xf6, 0x5b,\n  0xf6, 0x5e, 0xf6, 0xc1, 0xf6, 0xce, 0xff, 0xff, 0x0d, 0xd9, 0x0d, 0x37, 0x0d, 0x30, 0x0d, 0x03,\n  0x0c, 0x24, 0x0b, 0x16, 0x0b, 0x0a, 0x0b, 0x06, 0x0a, 0x1f, 0x09, 0xb6, 0x09, 0xa6, 0x09, 0xb0,\n  0x09, 0x4a, 0x09, 0x3f, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n  0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0xff, 0xfd, 0x01, 0x11, 0x01, 0x2d, 0x00, 0x11,\n  0x00, 0x45, 0x00, 0x57, 0x00, 0x8b, 0x00, 0x00, 0x13, 0x26, 0x06, 0x07, 0x0e, 0x01, 0x07, 0x06,\n  0x07, 0x14, 0x16, 0x36, 0x37, 0x3e, 0x01, 0x37, 0x36, 0x34, 0x17, 0x30, 0x27, 0x26, 0x27, 0x26,\n  0x37, 0x36, 0x3f, 0x01, 0x34, 0x26, 0x27, 0x26, 0x2b, 0x01, 0x26, 0x0f, 0x01, 0x06, 0x22, 0x27,\n  0x2e, 0x01, 0x07, 0x06, 0x07, 0x0e, 0x01, 0x17, 0x16, 0x1f, 0x01, 0x16, 0x17, 0x1e, 0x01, 0x17,\n  0x1e, 0x02, 0x3e, 0x01, 0x32, 0x16, 0x17, 0x16, 0x37, 0x3e, 0x01, 0x37, 0x36, 0x27, 0x26, 0x06,\n  0x07, 0x0e, 0x01, 0x07, 0x06, 0x07, 0x14, 0x16, 0x36, 0x37, 0x3e, 0x01, 0x37, 0x36, 0x34, 0x17,\n  0x30, 0x27, 0x26, 0x27, 0x26, 0x37, 0x36, 0x3f, 0x01, 0x34, 0x26, 0x27, 0x26, 0x2b, 0x01, 0x26,\n  0x0f, 0x01, 0x06, 0x22, 0x27, 0x2e, 0x01, 0x07, 0x06, 0x07, 0x0e, 0x01, 0x17, 0x16, 0x1f, 0x01,\n  0x16, 0x17, 0x1e, 0x01, 0x17, 0x1e, 0x02, 0x3e, 0x01, 0x32, 0x16, 0x17, 0x16, 0x37, 0x3e, 0x01,\n  0x37, 0x36, 0xd2, 0x01, 0x0f, 0x08, 0x0b, 0x12, 0x04, 0x03, 0x01, 0x01, 0x11, 0x09, 0x0c, 0x10,\n  0x04, 0x02, 0x3e, 0x03, 0x0f, 0x08, 0x10, 0x02, 0x04, 0x1a, 0x02, 0x0f, 0x08, 0x0e, 0x10, 0x01,\n  0x0a, 0x0c, 0x0f, 0x13, 0x06, 0x0b, 0x12, 0x17, 0x16, 0x0a, 0x08, 0x0d, 0x10, 0x01, 0x01, 0x05,\n  0x01, 0x05, 0x04, 0x06, 0x0f, 0x0a, 0x08, 0x0b, 0x15, 0x0f, 0x15, 0x0c, 0x12, 0x09, 0x0e, 0x11,\n  0x08, 0x16, 0x0c, 0x0a, 0x3f, 0x01, 0x0f, 0x08, 0x0b, 0x12, 0x04, 0x03, 0x01, 0x01, 0x11, 0x09,\n  0x0c, 0x10, 0x04, 0x02, 0x3e, 0x03, 0x0f, 0x08, 0x10, 0x02, 0x04, 0x1a, 0x02, 0x0f, 0x08, 0x0e,\n  0x10, 0x01, 0x0a, 0x0c, 0x0f, 0x13, 0x06, 0x0b, 0x12, 0x17, 0x16, 0x0a, 0x08, 0x0d, 0x10, 0x01,\n  0x01, 0x05, 0x01, 0x05, 0x04, 0x06, 0x0f, 0x0a, 0x08, 0x0b, 0x15, 0x0f, 0x15, 0x0c, 0x12, 0x09,\n  0x0e, 0x11, 0x08, 0x16, 0x0c, 0x0a, 0x01, 0x2c, 0x01, 0x03, 0x05, 0x05, 0x14, 0x0c, 0x09, 0x09,\n  0x06, 0x02, 0x02, 0x05, 0x06, 0x17, 0x0b, 0x09, 0x0d, 0xdb, 0x02, 0x0a, 0x0a, 0x13, 0x17, 0x24,\n  0x10, 0x02, 0x01, 0x10, 0x04, 0x08, 0x02, 0x04, 0x05, 0x06, 0x04, 0x07, 0x04, 0x09, 0x04, 0x08,\n  0x0b, 0x25, 0x1e, 0x17, 0x0e, 0x02, 0x10, 0x09, 0x10, 0x16, 0x0b, 0x08, 0x08, 0x02, 0x08, 0x05,\n  0x05, 0x05, 0x05, 0x07, 0x03, 0x1a, 0x17, 0x16, 0xde, 0x01, 0x03, 0x05, 0x05, 0x14, 0x0c, 0x09,\n  0x09, 0x06, 0x02, 0x02, 0x05, 0x06, 0x17, 0x0b, 0x09, 0x0d, 0xdb, 0x02, 0x0a, 0x0a, 0x13, 0x17,\n  0x24, 0x10, 0x02, 0x01, 0x10, 0x04, 0x08, 0x02, 0x04, 0x05, 0x06, 0x04, 0x07, 0x04, 0x09, 0x04,\n  0x08, 0x0b, 0x25, 0x1e, 0x17, 0x0e, 0x02, 0x10, 0x09, 0x10, 0x16, 0x0b, 0x08, 0x08, 0x02, 0x08,\n  0x05, 0x05, 0x05, 0x05, 0x07, 0x03, 0x1a, 0x17, 0x16, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,\n  0x01, 0x04, 0x00, 0xe2, 0x00, 0x0e, 0x00, 0x00, 0x37, 0x27, 0x26, 0x3e, 0x01, 0x3b, 0x01, 0x32,\n  0x1e, 0x01, 0x06, 0x0f, 0x01, 0x06, 0x22, 0x88, 0x5a, 0x05, 0x01, 0x0a, 0x08, 0xb4, 0x05, 0x0a,\n  0x04, 0x01, 0x04, 0x5a, 0x05, 0x12, 0x5b, 0x67, 0x06, 0x0f, 0x0a, 0x06, 0x0a, 0x0b, 0x04, 0x67,\n  0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x2c, 0x01, 0x23, 0x00, 0x0b, 0x00, 0x17,\n  0x00, 0x27, 0x00, 0x37, 0x00, 0x00, 0x37, 0x22, 0x26, 0x34, 0x36, 0x3b, 0x01, 0x32, 0x16, 0x14,\n  0x06, 0x23, 0x27, 0x22, 0x26, 0x34, 0x36, 0x3b, 0x01, 0x32, 0x16, 0x14, 0x06, 0x23, 0x07, 0x14,\n  0x16, 0x3b, 0x01, 0x32, 0x36, 0x3d, 0x01, 0x34, 0x26, 0x2b, 0x01, 0x22, 0x06, 0x15, 0x17, 0x22,\n  0x26, 0x3d, 0x01, 0x34, 0x36, 0x3b, 0x01, 0x32, 0x16, 0x1d, 0x01, 0x14, 0x06, 0x23, 0x2f, 0x04,\n  0x05, 0x05, 0x04, 0xce, 0x04, 0x06, 0x06, 0x04, 0xa9, 0x04, 0x05, 0x05, 0x04, 0x84, 0x04, 0x05,\n  0x05, 0x04, 0xd8, 0x10, 0x0c, 0xf4, 0x0c, 0x10, 0x10, 0x0c, 0xf4, 0x0c, 0x10, 0x1c, 0x04, 0x05,\n  0x05, 0x04, 0xf4, 0x04, 0x05, 0x05, 0x04, 0xea, 0x06, 0x08, 0x05, 0x05, 0x08, 0x06, 0x26, 0x05,\n  0x08, 0x06, 0x06, 0x08, 0x05, 0xd8, 0x0b, 0x11, 0x11, 0x0b, 0x84, 0x0b, 0x11, 0x11, 0x0b, 0x8d,\n  0x05, 0x04, 0x84, 0x03, 0x06, 0x06, 0x03, 0x84, 0x04, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,\n  0x01, 0x26, 0x01, 0x06, 0x00, 0x08, 0x00, 0x12, 0x00, 0x1b, 0x00, 0x24, 0x00, 0x30, 0x00, 0x69,\n  0x00, 0x8c, 0x00, 0x00, 0x37, 0x14, 0x06, 0x22, 0x26, 0x34, 0x36, 0x32, 0x16, 0x07, 0x32, 0x36,\n  0x34, 0x26, 0x22, 0x06, 0x14, 0x16, 0x33, 0x37, 0x14, 0x06, 0x22, 0x26, 0x34, 0x36, 0x32, 0x16,\n  0x07, 0x32, 0x36, 0x34, 0x26, 0x22, 0x06, 0x14, 0x16, 0x27, 0x33, 0x15, 0x33, 0x15, 0x23, 0x15,\n  0x23, 0x35, 0x23, 0x35, 0x33, 0x27, 0x26, 0x36, 0x3f, 0x01, 0x36, 0x16, 0x17, 0x36, 0x32, 0x17,\n  0x34, 0x36, 0x1f, 0x01, 0x1e, 0x01, 0x07, 0x16, 0x17, 0x1e, 0x02, 0x17, 0x16, 0x07, 0x0e, 0x01,\n  0x27, 0x26, 0x27, 0x26, 0x2f, 0x01, 0x26, 0x27, 0x26, 0x22, 0x07, 0x06, 0x0f, 0x01, 0x06, 0x07,\n  0x06, 0x07, 0x06, 0x26, 0x27, 0x26, 0x37, 0x3e, 0x02, 0x37, 0x36, 0x37, 0x17, 0x0e, 0x04, 0x17,\n  0x16, 0x33, 0x36, 0x37, 0x36, 0x3f, 0x01, 0x36, 0x37, 0x36, 0x32, 0x17, 0x16, 0x1f, 0x01, 0x16,\n  0x17, 0x16, 0x17, 0x32, 0x37, 0x36, 0x2e, 0x04, 0x22, 0xd8, 0x06, 0x08, 0x05, 0x05, 0x08, 0x06,\n  0x1c, 0x03, 0x06, 0x06, 0x07, 0x06, 0x06, 0x03, 0x2f, 0x05, 0x08, 0x05, 0x05, 0x08, 0x05, 0x1c,\n  0x04, 0x06, 0x06, 0x08, 0x05, 0x05, 0x76, 0x13, 0x13, 0x13, 0x13, 0x12, 0x12, 0x1b, 0x01, 0x04,\n  0x04, 0x24, 0x04, 0x07, 0x01, 0x12, 0x29, 0x13, 0x07, 0x04, 0x25, 0x04, 0x04, 0x03, 0x04, 0x03,\n  0x0b, 0x13, 0x0c, 0x01, 0x01, 0x07, 0x04, 0x0f, 0x08, 0x0f, 0x0e, 0x04, 0x09, 0x08, 0x0c, 0x0b,\n  0x10, 0x2a, 0x10, 0x0b, 0x0c, 0x08, 0x09, 0x04, 0x0e, 0x0f, 0x08, 0x0f, 0x04, 0x07, 0x01, 0x01,\n  0x0c, 0x13, 0x0b, 0x03, 0x05, 0x25, 0x18, 0x10, 0x12, 0x0a, 0x02, 0x05, 0x03, 0x05, 0x09, 0x09,\n  0x04, 0x07, 0x09, 0x0e, 0x0e, 0x14, 0x34, 0x14, 0x0e, 0x0e, 0x09, 0x07, 0x04, 0x09, 0x09, 0x05,\n  0x03, 0x05, 0x02, 0x0a, 0x12, 0x10, 0x30, 0x3e, 0xbb, 0x04, 0x05, 0x05, 0x08, 0x05, 0x05, 0x20,\n  0x05, 0x08, 0x06, 0x06, 0x08, 0x05, 0x09, 0x04, 0x05, 0x05, 0x08, 0x06, 0x06, 0x20, 0x06, 0x07,\n  0x06, 0x06, 0x07, 0x06, 0x38, 0x12, 0x13, 0x13, 0x13, 0x13, 0x3d, 0x04, 0x06, 0x01, 0x0a, 0x01,\n  0x04, 0x04, 0x02, 0x02, 0x04, 0x04, 0x01, 0x0a, 0x01, 0x08, 0x04, 0x03, 0x03, 0x0b, 0x2b, 0x34,\n  0x16, 0x1a, 0x10, 0x08, 0x08, 0x01, 0x01, 0x0d, 0x04, 0x0b, 0x08, 0x0e, 0x06, 0x09, 0x09, 0x06,\n  0x0e, 0x08, 0x0a, 0x05, 0x0d, 0x01, 0x01, 0x08, 0x08, 0x10, 0x1a, 0x16, 0x34, 0x2b, 0x0b, 0x04,\n  0x02, 0x06, 0x05, 0x10, 0x28, 0x2d, 0x2c, 0x0c, 0x05, 0x01, 0x09, 0x04, 0x08, 0x0a, 0x10, 0x08,\n  0x0b, 0x0b, 0x08, 0x10, 0x09, 0x09, 0x04, 0x09, 0x01, 0x05, 0x0c, 0x2c, 0x2d, 0x28, 0x10, 0x0a,\n  0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x2c, 0x01, 0x07, 0x00, 0x2e, 0x00, 0x43, 0x00, 0x00,\n  0x35, 0x34, 0x37, 0x36, 0x37, 0x3e, 0x01, 0x3b, 0x01, 0x17, 0x16, 0x17, 0x1e, 0x01, 0x1d, 0x01,\n  0x07, 0x06, 0x07, 0x0e, 0x01, 0x2b, 0x01, 0x14, 0x17, 0x33, 0x32, 0x16, 0x14, 0x06, 0x2b, 0x01,\n  0x22, 0x26, 0x34, 0x36, 0x3b, 0x01, 0x36, 0x35, 0x23, 0x27, 0x26, 0x27, 0x2e, 0x01, 0x35, 0x37,\n  0x0e, 0x01, 0x1d, 0x01, 0x14, 0x1e, 0x01, 0x3b, 0x01, 0x32, 0x3e, 0x01, 0x3d, 0x01, 0x34, 0x2e,\n  0x01, 0x27, 0x23, 0x22, 0x01, 0x01, 0x03, 0x04, 0x10, 0x0d, 0xe1, 0x05, 0x07, 0x06, 0x08, 0x0b,\n  0x01, 0x01, 0x03, 0x04, 0x10, 0x0c, 0x4b, 0x04, 0x0e, 0x04, 0x06, 0x06, 0x04, 0x70, 0x04, 0x06,\n  0x06, 0x04, 0x0e, 0x05, 0x4b, 0x06, 0x07, 0x06, 0x08, 0x0b, 0x1a, 0x03, 0x04, 0x04, 0x09, 0x05,\n  0xe2, 0x07, 0x07, 0x04, 0x05, 0x08, 0x06, 0xe0, 0x08, 0xe1, 0x03, 0x03, 0x07, 0x06, 0x08, 0x0b,\n  0x01, 0x01, 0x03, 0x04, 0x10, 0x0d, 0x70, 0x06, 0x07, 0x06, 0x08, 0x0b, 0x13, 0x09, 0x06, 0x07,\n  0x06, 0x06, 0x07, 0x06, 0x09, 0x13, 0x01, 0x01, 0x03, 0x04, 0x10, 0x0d, 0x80, 0x02, 0x09, 0x05,\n  0x70, 0x08, 0x07, 0x04, 0x05, 0x08, 0x05, 0x71, 0x07, 0x07, 0x04, 0x01, 0x00, 0x02, 0xff, 0xfd,\n  0xff, 0xfd, 0x01, 0x2f, 0x01, 0x2f, 0x00, 0x47, 0x00, 0x50, 0x00, 0x00, 0x13, 0x2e, 0x01, 0x06,\n  0x0f, 0x01, 0x0e, 0x01, 0x2f, 0x01, 0x26, 0x0e, 0x01, 0x1f, 0x01, 0x16, 0x06, 0x0f, 0x01, 0x0e,\n  0x01, 0x16, 0x1f, 0x01, 0x1e, 0x01, 0x0f, 0x01, 0x06, 0x1e, 0x01, 0x3f, 0x01, 0x36, 0x16, 0x1f,\n  0x01, 0x1e, 0x01, 0x36, 0x3f, 0x01, 0x3e, 0x01, 0x1f, 0x01, 0x16, 0x3e, 0x01, 0x2f, 0x01, 0x26,\n  0x36, 0x3f, 0x01, 0x3e, 0x01, 0x26, 0x2f, 0x01, 0x2e, 0x01, 0x3f, 0x01, 0x36, 0x2e, 0x01, 0x0f,\n  0x01, 0x06, 0x26, 0x27, 0x07, 0x22, 0x26, 0x34, 0x36, 0x32, 0x16, 0x14, 0x06, 0xb0, 0x03, 0x17,\n  0x17, 0x03, 0x02, 0x04, 0x18, 0x0c, 0x05, 0x0c, 0x17, 0x09, 0x06, 0x03, 0x07, 0x0a, 0x0d, 0x06,\n  0x0d, 0x09, 0x09, 0x0d, 0x06, 0x0d, 0x0a, 0x07, 0x03, 0x06, 0x09, 0x17, 0x0b, 0x06, 0x0c, 0x18,\n  0x04, 0x02, 0x03, 0x17, 0x17, 0x03, 0x02, 0x04, 0x18, 0x0c, 0x06, 0x0b, 0x17, 0x09, 0x06, 0x03,\n  0x07, 0x0a, 0x0d, 0x06, 0x0d, 0x09, 0x09, 0x0d, 0x06, 0x0d, 0x0a, 0x07, 0x03, 0x06, 0x09, 0x17,\n  0x0b, 0x06, 0x0c, 0x18, 0x04, 0x1c, 0x17, 0x20, 0x20, 0x2e, 0x20, 0x20, 0x01, 0x18, 0x0d, 0x09,\n  0x09, 0x0d, 0x06, 0x0d, 0x0a, 0x07, 0x03, 0x06, 0x09, 0x17, 0x0b, 0x06, 0x0c, 0x18, 0x04, 0x02,\n  0x03, 0x17, 0x17, 0x03, 0x02, 0x04, 0x18, 0x0c, 0x05, 0x0c, 0x17, 0x09, 0x06, 0x03, 0x07, 0x0a,\n  0x0d, 0x06, 0x0d, 0x09, 0x09, 0x0d, 0x06, 0x0d, 0x0a, 0x07, 0x03, 0x06, 0x09, 0x17, 0x0b, 0x06,\n  0x0c, 0x18, 0x04, 0x02, 0x03, 0x17, 0x17, 0x03, 0x02, 0x04, 0x18, 0x0c, 0x06, 0x0b, 0x17, 0x09,\n  0x06, 0x03, 0x07, 0x0a, 0x0d, 0xb3, 0x20, 0x2e, 0x20, 0x20, 0x2e, 0x20, 0x00, 0x03, 0x00, 0x00,\n  0x00, 0x00, 0x01, 0x2c, 0x01, 0x07, 0x00, 0x0b, 0x00, 0x1b, 0x00, 0x2b, 0x00, 0x00, 0x37, 0x26,\n  0x06, 0x1d, 0x01, 0x14, 0x16, 0x3f, 0x01, 0x36, 0x34, 0x2f, 0x01, 0x34, 0x36, 0x3b, 0x01, 0x32,\n  0x16, 0x1d, 0x01, 0x14, 0x06, 0x2b, 0x01, 0x22, 0x26, 0x35, 0x25, 0x34, 0x26, 0x2b, 0x01, 0x22,\n  0x06, 0x1d, 0x01, 0x14, 0x16, 0x3b, 0x01, 0x32, 0x36, 0x35, 0x7f, 0x04, 0x0a, 0x0a, 0x04, 0x42,\n  0x04, 0x04, 0xc1, 0x16, 0x10, 0xe1, 0x0f, 0x16, 0x16, 0x10, 0xe0, 0x10, 0x16, 0x01, 0x19, 0x0b,\n  0x07, 0xe1, 0x08, 0x0b, 0x0b, 0x08, 0xe1, 0x07, 0x0b, 0xcd, 0x03, 0x05, 0x06, 0x5e, 0x06, 0x05,\n  0x03, 0x2f, 0x03, 0x0a, 0x03, 0x43, 0x10, 0x16, 0x16, 0x10, 0x96, 0x10, 0x15, 0x15, 0x10, 0x96,\n  0x08, 0x0b, 0x0b, 0x08, 0x96, 0x08, 0x0b, 0x0b, 0x08, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,\n  0x01, 0x2c, 0x01, 0x2d, 0x00, 0x0c, 0x00, 0x18, 0x00, 0x00, 0x25, 0x14, 0x0e, 0x01, 0x22, 0x2e,\n  0x01, 0x34, 0x3e, 0x01, 0x32, 0x1e, 0x01, 0x27, 0x26, 0x06, 0x1d, 0x01, 0x14, 0x16, 0x3f, 0x01,\n  0x36, 0x34, 0x27, 0x01, 0x2c, 0x28, 0x45, 0x52, 0x45, 0x28, 0x28, 0x45, 0x52, 0x45, 0x28, 0xad,\n  0x04, 0x0a, 0x0a, 0x04, 0x42, 0x04, 0x04, 0x96, 0x29, 0x45, 0x28, 0x28, 0x45, 0x52, 0x45, 0x28,\n  0x28, 0x45, 0x0e, 0x03, 0x05, 0x06, 0x5e, 0x06, 0x05, 0x03, 0x2f, 0x03, 0x0a, 0x03, 0x00, 0x02,\n  0x00, 0x00, 0x00, 0x00, 0x01, 0x0d, 0x01, 0x1a, 0x00, 0x03, 0x00, 0x1b, 0x00, 0x00, 0x13, 0x15,\n  0x33, 0x35, 0x07, 0x34, 0x36, 0x37, 0x27, 0x0e, 0x01, 0x1e, 0x02, 0x3e, 0x01, 0x26, 0x27, 0x07,\n  0x1e, 0x02, 0x0e, 0x02, 0x2e, 0x02, 0x8d, 0x12, 0x67, 0x1a, 0x17, 0x0a, 0x21, 0x1e, 0x12, 0x3d,\n  0x4c, 0x3d, 0x15, 0x1e, 0x21, 0x09, 0x13, 0x18, 0x06, 0x10, 0x20, 0x2a, 0x2c, 0x24, 0x14, 0x01,\n  0x19, 0x83, 0x83, 0x92, 0x19, 0x2c, 0x0d, 0x10, 0x12, 0x47, 0x4a, 0x2f, 0x01, 0x2e, 0x4a, 0x47,\n  0x13, 0x10, 0x0b, 0x25, 0x2c, 0x2a, 0x1f, 0x0c, 0x07, 0x1b, 0x27, 0x00, 0x00, 0x03, 0x00, 0x00,\n  0x00, 0x00, 0x01, 0x2c, 0x01, 0x2d, 0x00, 0x0c, 0x00, 0x34, 0x00, 0x3d, 0x00, 0x00, 0x25, 0x14,\n  0x0e, 0x01, 0x22, 0x2e, 0x01, 0x34, 0x3e, 0x01, 0x32, 0x1e, 0x01, 0x07, 0x33, 0x32, 0x36, 0x37,\n  0x3e, 0x01, 0x32, 0x16, 0x15, 0x14, 0x07, 0x0e, 0x01, 0x07, 0x06, 0x1d, 0x01, 0x14, 0x16, 0x3b,\n  0x01, 0x32, 0x36, 0x3d, 0x01, 0x34, 0x3e, 0x01, 0x37, 0x36, 0x35, 0x34, 0x26, 0x22, 0x07, 0x06,\n  0x07, 0x06, 0x16, 0x17, 0x32, 0x36, 0x34, 0x26, 0x22, 0x06, 0x14, 0x16, 0x01, 0x2c, 0x28, 0x45,\n  0x52, 0x45, 0x28, 0x28, 0x45, 0x52, 0x45, 0x28, 0xc5, 0x10, 0x01, 0x03, 0x01, 0x01, 0x0d, 0x15,\n  0x0e, 0x05, 0x03, 0x15, 0x05, 0x06, 0x03, 0x02, 0x0f, 0x02, 0x03, 0x07, 0x17, 0x05, 0x07, 0x1d,\n  0x29, 0x0e, 0x10, 0x01, 0x01, 0x03, 0x2e, 0x08, 0x0b, 0x0b, 0x11, 0x0a, 0x0a, 0x96, 0x29, 0x45,\n  0x28, 0x28, 0x45, 0x52, 0x45, 0x28, 0x28, 0x45, 0x04, 0x03, 0x02, 0x09, 0x0c, 0x0b, 0x0b, 0x08,\n  0x06, 0x04, 0x10, 0x07, 0x0a, 0x0c, 0x04, 0x02, 0x03, 0x03, 0x02, 0x02, 0x09, 0x0a, 0x11, 0x07,\n  0x0a, 0x0d, 0x15, 0x15, 0x09, 0x0b, 0x16, 0x02, 0x03, 0x79, 0x0a, 0x0f, 0x0a, 0x0a, 0x0f, 0x0a,\n  0x00, 0x04, 0x00, 0x00, 0xff, 0xff, 0x01, 0x2d, 0x01, 0x2d, 0x00, 0x25, 0x00, 0x34, 0x00, 0x3d,\n  0x00, 0x46, 0x00, 0x00, 0x37, 0x1e, 0x02, 0x33, 0x32, 0x3e, 0x01, 0x34, 0x2e, 0x01, 0x22, 0x0e,\n  0x01, 0x07, 0x17, 0x36, 0x17, 0x37, 0x35, 0x34, 0x36, 0x32, 0x16, 0x15, 0x14, 0x0e, 0x02, 0x23,\n  0x07, 0x16, 0x0e, 0x02, 0x2e, 0x01, 0x27, 0x17, 0x16, 0x3e, 0x01, 0x2e, 0x01, 0x07, 0x17, 0x1e,\n  0x01, 0x0e, 0x01, 0x2f, 0x01, 0x16, 0x37, 0x14, 0x16, 0x32, 0x36, 0x34, 0x26, 0x22, 0x06, 0x37,\n  0x32, 0x16, 0x14, 0x06, 0x22, 0x26, 0x34, 0x36, 0x06, 0x0a, 0x2a, 0x3b, 0x21, 0x29, 0x45, 0x28,\n  0x28, 0x45, 0x50, 0x43, 0x29, 0x03, 0x51, 0x0b, 0x0d, 0x25, 0x22, 0x2f, 0x21, 0x09, 0x10, 0x16,\n  0x0b, 0x35, 0x01, 0x0a, 0x12, 0x15, 0x13, 0x0d, 0x02, 0x1c, 0x0c, 0x18, 0x0a, 0x09, 0x18, 0x0c,\n  0x13, 0x0a, 0x07, 0x08, 0x12, 0x09, 0x12, 0x05, 0x51, 0x16, 0x20, 0x16, 0x16, 0x20, 0x16, 0x26,\n  0x0c, 0x11, 0x11, 0x18, 0x10, 0x10, 0x6a, 0x1f, 0x30, 0x1b, 0x28, 0x45, 0x52, 0x45, 0x28, 0x25,\n  0x40, 0x27, 0x21, 0x07, 0x01, 0x36, 0x01, 0x17, 0x22, 0x22, 0x17, 0x0c, 0x15, 0x10, 0x09, 0x25,\n  0x0b, 0x12, 0x0c, 0x03, 0x08, 0x10, 0x0a, 0x15, 0x04, 0x0a, 0x18, 0x18, 0x0a, 0x04, 0x08, 0x04,\n  0x12, 0x12, 0x07, 0x03, 0x08, 0x0b, 0x79, 0x10, 0x16, 0x16, 0x1f, 0x17, 0x17, 0x0d, 0x11, 0x17,\n  0x11, 0x11, 0x17, 0x11, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x2c, 0x01, 0x07, 0x00, 0x0c,\n  0x00, 0x21, 0x00, 0x3d, 0x00, 0x00, 0x37, 0x34, 0x36, 0x3b, 0x01, 0x32, 0x16, 0x14, 0x06, 0x2b,\n  0x01, 0x22, 0x26, 0x37, 0x33, 0x1e, 0x02, 0x1d, 0x01, 0x14, 0x0e, 0x01, 0x2b, 0x01, 0x22, 0x2e,\n  0x01, 0x3d, 0x01, 0x34, 0x3e, 0x01, 0x33, 0x37, 0x23, 0x22, 0x06, 0x07, 0x06, 0x0f, 0x01, 0x15,\n  0x14, 0x16, 0x17, 0x16, 0x1f, 0x01, 0x33, 0x32, 0x36, 0x37, 0x36, 0x3f, 0x01, 0x35, 0x34, 0x26,\n  0x27, 0x26, 0x27, 0x2f, 0x05, 0x04, 0xbc, 0x04, 0x05, 0x05, 0x04, 0xbc, 0x04, 0x05, 0xd7, 0x01,\n  0x05, 0x08, 0x05, 0x04, 0x07, 0x07, 0xe2, 0x05, 0x08, 0x05, 0x04, 0x07, 0x08, 0xe1, 0xe1, 0x0d,\n  0x10, 0x04, 0x03, 0x01, 0x01, 0x0b, 0x08, 0x06, 0x07, 0x06, 0xe1, 0x0c, 0x10, 0x04, 0x03, 0x01,\n  0x01, 0x0b, 0x08, 0x06, 0x07, 0x2f, 0x04, 0x05, 0x05, 0x08, 0x05, 0x05, 0xc9, 0x01, 0x04, 0x07,\n  0x07, 0x71, 0x05, 0x08, 0x05, 0x04, 0x07, 0x07, 0x71, 0x06, 0x08, 0x05, 0x13, 0x0b, 0x08, 0x06,\n  0x07, 0x06, 0x70, 0x0d, 0x10, 0x04, 0x03, 0x01, 0x01, 0x0b, 0x08, 0x06, 0x07, 0x06, 0x70, 0x0d,\n  0x10, 0x04, 0x03, 0x01, 0x00, 0x04, 0xff, 0xff, 0x00, 0x00, 0x01, 0x2d, 0x01, 0x1a, 0x00, 0x0f,\n  0x00, 0x1f, 0x00, 0x29, 0x00, 0x33, 0x00, 0x00, 0x37, 0x22, 0x06, 0x1d, 0x01, 0x14, 0x16, 0x3b,\n  0x01, 0x32, 0x36, 0x3d, 0x01, 0x34, 0x26, 0x23, 0x27, 0x22, 0x06, 0x1d, 0x01, 0x14, 0x16, 0x3b,\n  0x01, 0x32, 0x36, 0x3d, 0x01, 0x34, 0x26, 0x23, 0x07, 0x34, 0x36, 0x3b, 0x01, 0x36, 0x16, 0x1d,\n  0x01, 0x21, 0x15, 0x21, 0x15, 0x14, 0x06, 0x2b, 0x01, 0x22, 0x26, 0x35, 0x42, 0x04, 0x06, 0x06,\n  0x04, 0xa8, 0x04, 0x06, 0x06, 0x04, 0xbd, 0x13, 0x1a, 0x1a, 0x13, 0xd2, 0x13, 0x1a, 0x1a, 0x13,\n  0xec, 0x0f, 0x0b, 0xd2, 0x0b, 0x0f, 0xfe, 0xfa, 0x01, 0x06, 0x0f, 0x0b, 0xd2, 0x0b, 0x0f, 0x5e,\n  0x06, 0x04, 0x12, 0x04, 0x06, 0x06, 0x04, 0x12, 0x04, 0x06, 0xbb, 0x1a, 0x12, 0xae, 0x12, 0x1a,\n  0x1a, 0x12, 0xae, 0x12, 0x1a, 0x2c, 0x0b, 0x0e, 0x01, 0x0f, 0x0b, 0x0c, 0x13, 0x8f, 0x0b, 0x0f,\n  0x0f, 0x0b, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x2c, 0x01, 0x2c, 0x00, 0x03, 0x00, 0x07,\n  0x00, 0x0b, 0x00, 0x0f, 0x00, 0x00, 0x13, 0x07, 0x15, 0x33, 0x07, 0x17, 0x35, 0x23, 0x1f, 0x02,\n  0x3d, 0x01, 0x07, 0x15, 0x33, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x88, 0x01, 0xa3, 0xa3, 0xa3,\n  0x01, 0x12, 0x10, 0x66, 0x73, 0x11, 0x78, 0x01, 0x78, 0x17, 0x8f, 0x9d, 0x17, 0x79, 0x00, 0x01,\n  0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x01, 0x07, 0x00, 0x1b, 0x00, 0x00, 0x37, 0x26, 0x34, 0x36,\n  0x32, 0x1f, 0x01, 0x37, 0x36, 0x32, 0x16, 0x14, 0x0f, 0x01, 0x17, 0x16, 0x14, 0x06, 0x22, 0x2f,\n  0x01, 0x07, 0x06, 0x22, 0x26, 0x34, 0x3f, 0x01, 0x28, 0x03, 0x06, 0x08, 0x03, 0x60, 0x60, 0x03,\n  0x08, 0x06, 0x03, 0x61, 0x61, 0x03, 0x06, 0x08, 0x03, 0x60, 0x60, 0x03, 0x08, 0x06, 0x03, 0x61,\n  0xf6, 0x03, 0x08, 0x06, 0x03, 0x61, 0x61, 0x03, 0x06, 0x08, 0x03, 0x60, 0x60, 0x03, 0x08, 0x06,\n  0x03, 0x61, 0x61, 0x03, 0x06, 0x08, 0x03, 0x60,\n};\nextern const unsigned char ttf_bootstrap_icons_data[];\n#define ttf_bootstrap_icons_size 3496\n"
  },
  {
    "path": "app/lvgl/fonts/bootstrap-icons/symbols.h",
    "content": "#pragma once\n\n#define BS_SYMBOL_CARET_DOWN_FILL \"\\xef\\x88\\xa9\"\n#define BS_SYMBOL_COLLECTION \"\\xef\\x8b\\x8c\"\n#define BS_SYMBOL_CONTROLLER \"\\xef\\x8b\\x94\"\n#define BS_SYMBOL_DISPLAY \"\\xef\\x8c\\x82\"\n#define BS_SYMBOL_GEAR_FILL \"\\xef\\x8f\\xa2\"\n#define BS_SYMBOL_PLAY_BTN \"\\xef\\x93\\xb1\"\n#define BS_SYMBOL_PLAY_CIRCLE_FILL \"\\xef\\x93\\xb2\"\n#define BS_SYMBOL_POWER \"\\xef\\x93\\xbf\"\n#define BS_SYMBOL_QUESTION_CIRCLE_FILL \"\\xef\\x94\\x84\"\n#define BS_SYMBOL_TV \"\\xef\\x97\\xad\"\n#define BS_SYMBOL_X_LG \"\\xef\\x99\\x99\"\n#define BS_SYMBOL_APPLE \"\\xef\\x99\\x9b\"\n#define BS_SYMBOL_WINDOWS \"\\xef\\x99\\x9e\"\n#define BS_SYMBOL_STEAM \"\\xef\\x9b\\x81\"\n#define BS_SYMBOL_WINDOW_DESKTOP \"\\xef\\x9b\\x8e\"\n"
  },
  {
    "path": "app/lvgl/keypad.c",
    "content": "#include \"mouse.h\"\n#include \"logging.h\"\n#include \"app.h\"\n#include \"ui/app_ui.h\"\n\n#include <SDL.h>\n\ntypedef struct keyboard_state_t {\n    app_t *app;\n    bool ignore_input;\n    /**\n     * Key code of last pressed key event, will be 0 if released\n     */\n    uint32_t key;\n    /**\n     * Key code of last key event, no matter its released or not\n     */\n    uint32_t ev_key;\n    lv_indev_state_t state;\n    bool changed;\n} keyboard_state_t;\n\nstatic void read_cb(lv_indev_drv_t *drv, lv_indev_data_t *data);\n\nstatic void handle_esc(keyboard_state_t *state);\n\nstatic uint32_t key_from_keysym(const SDL_Keysym *keysym);\n\nstatic uint32_t key_from_cbutton(uint8_t button);\n\nlv_indev_t *app_indev_keypad_init(app_t *app) {\n    lv_indev_drv_t *driver = malloc(sizeof(lv_indev_drv_t));\n    lv_indev_drv_init(driver);\n    driver->type = LV_INDEV_TYPE_KEYPAD;\n    driver->read_cb = read_cb;\n    keyboard_state_t *state = calloc(1, sizeof(keyboard_state_t));\n    state->app = app;\n    driver->user_data = state;\n    lv_indev_t *indev = lv_indev_drv_register(driver);\n    lv_indev_set_group(indev, lv_group_get_default());\n    return indev;\n}\n\nvoid app_indev_keypad_deinit(lv_indev_t *indev) {\n    lv_indev_drv_t *driver = indev->driver;\n    lv_indev_delete(indev);\n    free(driver->user_data);\n    free(driver);\n}\n\nvoid app_indev_keypad_set_ignore(lv_indev_t *indev, bool ignore) {\n    keyboard_state_t *state = indev->driver->user_data;\n    state->ignore_input = ignore;\n}\n\nvoid app_indev_keypad_sdl_key_event(lv_indev_t *indev, const SDL_KeyboardEvent *event) {\n    keyboard_state_t *state = indev->driver->user_data;\n    uint32_t key = key_from_keysym(&event->keysym);\n    if (key == 0) {\n#ifdef SDL_WEBOS_SCANCODE_EXIT\n        if (event->state == SDL_RELEASED && event->keysym.scancode == SDL_WEBOS_SCANCODE_EXIT) {\n            app_post_event(state->app, APP_UI_NAV_QUIT, NULL, NULL);\n        }\n#endif\n        return;\n    }\n    if (event->state == SDL_PRESSED) {\n        if (state->key == 0) {\n            state->key = state->ev_key = key;\n            state->state = LV_INDEV_STATE_PRESSED;\n            state->changed = true;\n        }\n    } else if (event->state == SDL_RELEASED) {\n        if (state->key == key) {\n            state->ev_key = key;\n            state->key = 0;\n            state->state = LV_INDEV_STATE_RELEASED;\n            state->changed = true;\n        }\n    }\n}\n\nvoid app_indev_keypad_sdl_cbutton_event(lv_indev_t *indev, const SDL_ControllerButtonEvent *event) {\n    uint32_t key = key_from_cbutton(event->button);\n    if (key == 0) {\n        return;\n    }\n    keyboard_state_t *state = indev->driver->user_data;\n    if (event->state == SDL_PRESSED) {\n        if (state->key == 0) {\n            state->key = state->ev_key = key;\n            state->state = LV_INDEV_STATE_PRESSED;\n            state->changed = true;\n        }\n    } else if (event->state == SDL_RELEASED) {\n        if (state->key == key) {\n            state->ev_key = key;\n            state->key = 0;\n            state->state = LV_INDEV_STATE_RELEASED;\n            state->changed = true;\n        }\n    }\n}\n\nvoid app_indev_keypad_inject_key(lv_indev_t *indev, lv_key_t key, bool pressed) {\n    keyboard_state_t *state = indev->driver->user_data;\n    if (pressed) {\n        if (state->key == 0) {\n            state->key = state->ev_key = key;\n            state->state = LV_INDEV_STATE_PRESSED;\n            state->changed = true;\n        }\n    } else {\n        if (state->key == key) {\n            state->ev_key = key;\n            state->key = 0;\n            state->state = LV_INDEV_STATE_RELEASED;\n            state->changed = true;\n        }\n    }\n}\n\nstatic void read_cb(lv_indev_drv_t *drv, lv_indev_data_t *data) {\n    keyboard_state_t *state = drv->user_data;\n    if (state->changed && state->ev_key == LV_KEY_ESC) {\n        handle_esc(state);\n    }\n    state->changed = false;\n    data->key = state->key;\n    if (state->ignore_input) {\n        data->state = false;\n    } else {\n        data->state = state->state;\n    }\n    data->continue_reading = false;\n}\n\n/**\n * Special case for esc keys\n * @param state\n */\nstatic void handle_esc(keyboard_state_t *state) {\n    lv_group_t *group = app_ui_get_input_group(state->app->ui);\n    lv_obj_t *focused = lv_group_get_focused(group);\n    if (focused == NULL) {\n        // Next key event will not be handled by any object. Send global BACK event\n        if (state->state == LV_INDEV_STATE_RELEASED) {\n            app_post_event(state->app, APP_UI_NAV_BACK, NULL, NULL);\n        }\n        return;\n    }\n    // TODO: for things like dropdown, cancel event will be sent when ESC pressed.\n    //  So we can compare PRESS and RELEASE event to see if it's closed or not. Send BACK event if no state change.\n    if (state->state == LV_INDEV_STATE_PRESSED) {\n        // Backup object state (e.g. is dropdown opened)\n    } else {\n        // Compare object state, and send BACK event if no change.\n        app_post_event(state->app, APP_UI_NAV_BACK, NULL, NULL);\n    }\n}\n\nstatic uint32_t key_from_keysym(const SDL_Keysym *keysym) {\n    switch (keysym->sym) {\n        case SDLK_UP:\n            return LV_KEY_UP;\n        case SDLK_DOWN:\n            return LV_KEY_DOWN;\n        case SDLK_LEFT:\n            return LV_KEY_LEFT;\n        case SDLK_RIGHT:\n            return LV_KEY_RIGHT;\n        case SDLK_RETURN:\n        case SDLK_RETURN2:\n        case SDLK_KP_ENTER:\n            return LV_KEY_ENTER;\n        case SDLK_ESCAPE:\n            return LV_KEY_ESC;\n        case SDLK_TAB:\n            return keysym->mod & KMOD_SHIFT ? LV_KEY_PREV : LV_KEY_NEXT;\n        default:\n#ifdef SDL_WEBOS_SCANCODE_BACK\n            switch ((int) keysym->scancode) {\n                case SDL_WEBOS_SCANCODE_BACK:\n                    return LV_KEY_ESC;\n                case SDL_WEBOS_SCANCODE_CH_UP:\n                    return LV_KEY_PREV;\n                case SDL_WEBOS_SCANCODE_CH_DOWN:\n                    return LV_KEY_NEXT;\n                default:\n                    break;\n            }\n#endif\n            return 0;\n    }\n}\n\nstatic uint32_t key_from_cbutton(uint8_t button) {\n    switch (button) {\n        case SDL_CONTROLLER_BUTTON_DPAD_UP:\n            return LV_KEY_UP;\n        case SDL_CONTROLLER_BUTTON_DPAD_DOWN:\n            return LV_KEY_DOWN;\n        case SDL_CONTROLLER_BUTTON_DPAD_LEFT:\n            return LV_KEY_LEFT;\n        case SDL_CONTROLLER_BUTTON_DPAD_RIGHT:\n            return LV_KEY_RIGHT;\n        case SDL_CONTROLLER_BUTTON_A:\n            return LV_KEY_ENTER;\n        case SDL_CONTROLLER_BUTTON_B:\n            return LV_KEY_ESC;\n        case SDL_CONTROLLER_BUTTON_BACK:\n            return LV_KEY_NEXT;\n        default:\n            return 0;\n    }\n}"
  },
  {
    "path": "app/lvgl/keypad.h",
    "content": "#pragma once\n\n#include <lvgl.h>\n#include <SDL2/SDL.h>\n\ntypedef struct app_t app_t;\n\nlv_indev_t *app_indev_keypad_init(app_t *app);\n\nvoid app_indev_keypad_deinit(lv_indev_t *indev);\n\nvoid app_indev_keypad_set_ignore(lv_indev_t *indev, bool ignore);\n\nvoid app_indev_keypad_sdl_key_event(lv_indev_t *indev, const SDL_KeyboardEvent *event);\n\nvoid app_indev_keypad_sdl_cbutton_event(lv_indev_t *indev, const SDL_ControllerButtonEvent *event);\n\nvoid app_indev_keypad_inject_key(lv_indev_t *indev, lv_key_t key, bool pressed);"
  },
  {
    "path": "app/lvgl/lv_conf.h",
    "content": "#ifndef LV_CONF_H\n#define LV_CONF_H\n\n#include <stdint.h>\n\n/* Use 32-bit color depth */\n#define LV_COLOR_DEPTH     32\n\n#define LV_DPI_DEF         360\n\n/* Use stdlib to allocate/free memory */\n#define LV_MEM_CUSTOM      1\n#define LV_MEM_CUSTOM_INCLUDE   <string.h>   /*Header for the dynamic memory function*/\n#define LV_MEM_CUSTOM_ALLOC     malloc\n#define LV_MEM_CUSTOM_FREE      free\n#define LV_MEM_CUSTOM_REALLOC   realloc\n\n/* Use the standard `memcpy` and `memset` instead of LVGL's own functions. */\n#define LV_MEMCPY_MEMSET_STD    1\n\n#define LV_DISP_DEF_REFR_PERIOD 17\n#define LV_INDEV_DEF_READ_PERIOD 5\n\n#define LV_USE_REFR_DEBUG 0\n\n/* Let LVGL call SDL_GetTicks automatically so we can skip creating a separate timer thread. */\n#define LV_TICK_CUSTOM     1\n#define LV_TICK_CUSTOM_INCLUDE  <SDL.h>\n#define LV_TICK_CUSTOM_SYS_TIME_EXPR (SDL_GetTicks())\n\n#define LV_DRAW_COMPLEX 1\n#define LV_SHADOW_CACHE_SIZE    0\n#define LV_IMG_CACHE_DEF_SIZE       0\n\n#define LV_GRADIENT_MAX_STOPS 8\n\n/* Use SDL draw backend */\n#define LV_USE_GPU_SDL    1\n#define LV_GPU_SDL_INCLUDE_PATH <SDL.h>\n#define LV_GPU_SDL_CUSTOM_BLEND_MODE 0\n\n/*Change the built in (v)snprintf functions*/\n#define LV_SPRINTF_CUSTOM   1\n#if LV_SPRINTF_CUSTOM\n#  define LV_SPRINTF_INCLUDE <stdio.h>\n#  define lv_snprintf     snprintf\n#  define lv_vsnprintf    vsnprintf\n#else   /*LV_SPRINTF_CUSTOM*/\n#  define LV_SPRINTF_USE_FLOAT 0\n#endif  /*LV_SPRINTF_CUSTOM*/\n\n/*Enable the log module*/\n#define LV_USE_LOG      1\n#if LV_USE_LOG\n\n/*How important log should be added:\n *LV_LOG_LEVEL_TRACE       A lot of logs to give detailed information\n *LV_LOG_LEVEL_INFO        Log important events\n *LV_LOG_LEVEL_WARN        Log if something unwanted happened but didn't cause a problem\n *LV_LOG_LEVEL_ERROR       Only critical issue, when the system may fail\n *LV_LOG_LEVEL_USER        Only logs added by the user\n *LV_LOG_LEVEL_NONE        Do not log anything*/\n#  define LV_LOG_LEVEL    LV_LOG_LEVEL_WARN\n\n/*1: Print the log with 'printf';\n *0: User need to register a callback with `lv_log_register_print_cb()`*/\n#  define LV_LOG_PRINTF   0\n\n/*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/\n#  define LV_LOG_TRACE_MEM            1\n#  define LV_LOG_TRACE_TIMER          1\n#  define LV_LOG_TRACE_INDEV          1\n#  define LV_LOG_TRACE_DISP_REFR      1\n#  define LV_LOG_TRACE_EVENT          1\n#  define LV_LOG_TRACE_OBJ_CREATE     1\n#  define LV_LOG_TRACE_LAYOUT         1\n#  define LV_LOG_TRACE_ANIM           1\n\n#endif  /*LV_USE_LOG*/\n\n/* Abort on assertion failure */\n#define LV_ASSERT_HANDLER_INCLUDE   <stdlib.h>\n#define LV_ASSERT_HANDLER   abort();\n\n#define LV_USE_USER_DATA      1\n\n/* Use 32bit coordinates */\n#define LV_USE_LARGE_COORD  1\n\n#define LV_USE_FREETYPE 1\n\n#define LV_FONT_UNSCII_16    1\n\n#define LV_FONT_DEFAULT &lv_font_unscii_16\n\n#define LV_TXT_ENC LV_TXT_ENC_UTF8\n\n\n/*==================\n *  WIDGET USAGE\n *================*/\n\n/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/\n\n#define LV_USE_ARC          1\n\n#define LV_USE_ANIMIMG        0\n\n#define LV_USE_BAR          1\n\n#define LV_USE_BTN          1\n\n#define LV_USE_BTNMATRIX    1\n\n#define LV_USE_CANVAS       1\n\n#define LV_USE_CHECKBOX     1\n\n\n#define LV_USE_DROPDOWN     1   /*Requires: lv_label*/\n\n#define LV_USE_IMG          1   /*Requires: lv_label*/\n\n#define LV_USE_LABEL        1\n#if LV_USE_LABEL\n#  define LV_LABEL_TEXT_SELECTION         1   /*Enable selecting text of the label*/\n#  define LV_LABEL_LONG_TXT_HINT    1   /*Store some extra info in labels to speed up drawing of very long texts*/\n#endif\n\n#define LV_USE_LINE         1\n\n#define LV_USE_ROLLER       0   /*Requires: lv_label*/\n#if LV_USE_ROLLER\n#  define LV_ROLLER_INF_PAGES       7   /*Number of extra \"pages\" when the roller is infinite*/\n#endif\n\n#define LV_USE_SLIDER       1   /*Requires: lv_bar*/\n\n#define LV_USE_SWITCH    0\n\n#define LV_USE_TEXTAREA   0     /*Requires: lv_label*/\n#if LV_USE_TEXTAREA != 0\n#  define LV_TEXTAREA_DEF_PWD_SHOW_TIME     1500    /*ms*/\n#endif\n\n#define LV_USE_TABLE  0\n\n/*==================\n * EXTRA COMPONENTS\n *==================*/\n\n/*-----------\n * Widgets\n *----------*/\n#define LV_USE_CALENDAR     0\n#if LV_USE_CALENDAR\n# define LV_CALENDAR_WEEK_STARTS_MONDAY 0\n# if LV_CALENDAR_WEEK_STARTS_MONDAY\n#  define LV_CALENDAR_DEFAULT_DAY_NAMES {\"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\", \"Su\"}\n# else\n#  define LV_CALENDAR_DEFAULT_DAY_NAMES {\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"}\n# endif\n\n# define LV_CALENDAR_DEFAULT_MONTH_NAMES {\"January\", \"February\", \"March\",  \"April\", \"May\",  \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"}\n# define LV_USE_CALENDAR_HEADER_ARROW       1\n# define LV_USE_CALENDAR_HEADER_DROPDOWN    1\n#endif  /*LV_USE_CALENDAR*/\n\n#define LV_USE_CHART        0\n\n#define LV_USE_COLORWHEEL   0\n\n#define LV_USE_GRIDVIEW     1\n\n#define LV_USE_IMGBTN       1\n\n#define LV_USE_KEYBOARD     0\n\n#define LV_USE_LED          1\n\n#define LV_USE_LIST         1\n\n#define LV_USE_METER        0\n\n#define LV_USE_MSGBOX       1\n\n#define LV_USE_SPINBOX      0\n\n#define LV_USE_SPINNER      1\n\n#define LV_USE_TABVIEW      1\n\n#define LV_USE_TILEVIEW     0\n\n#define LV_USE_WIN          1\n\n#define LV_USE_SPAN         1\n#if LV_USE_SPAN\n/*A line text can contain maximum num of span descriptor */\n#  define LV_SPAN_SNIPPET_STACK_SIZE   64\n#endif\n\n/*-----------\n * Themes\n *----------*/\n/*A simple, impressive and very complete theme*/\n#define LV_USE_THEME_DEFAULT    0\n#if LV_USE_THEME_DEFAULT\n\n/*0: Light mode; 1: Dark mode*/\n# define LV_THEME_DEFAULT_DARK     0\n\n/*1: Enable grow on press*/\n# define LV_THEME_DEFAULT_GROW              0\n\n/*Default transition time in [ms]*/\n# define LV_THEME_DEFAULT_TRANSITON_TIME    80\n#endif /*LV_USE_THEME_DEFAULT*/\n\n/*An very simple them that is a good starting point for a custom theme*/\n#define LV_USE_THEME_BASIC    1\n\n/*A theme designed for monochrome displays*/\n#define LV_USE_THEME_MONO       0\n\n/*-----------\n * Layouts\n *----------*/\n\n/*A layout similar to Flexbox in CSS.*/\n#define LV_USE_FLEX     1\n\n/*A layout similar to Grid in CSS.*/\n#define LV_USE_GRID     1\n\n/*-----------\n * Extras\n *----------*/\n\n#define LV_USE_FRAGMENT  1\n#define LV_USE_QRCODE    1\n\n/*----------\n * Icon font symbol overrides\n *---------*/\n#define LV_SYMBOL_DOWN \"\\xef\\x88\\xa9\" /*BS_SYMBOL_CARET_DOWN_FILL*/\n\n#endif /*LV_CONF_H*/"
  },
  {
    "path": "app/lvgl/mouse.c",
    "content": "#include \"mouse.h\"\n\n#include <SDL.h>\n\nstatic void read_cb(lv_indev_drv_t *drv, lv_indev_data_t *data);\n\nlv_indev_t *app_lv_mouse_indev_init() {\n    lv_indev_drv_t *driver = malloc(sizeof(lv_indev_drv_t));\n    lv_indev_drv_init(driver);\n    driver->type = LV_INDEV_TYPE_POINTER;\n    driver->read_cb = read_cb;\n    lv_indev_t *indev = lv_indev_drv_register(driver);\n    lv_indev_set_group(indev, lv_group_get_default());\n    return indev;\n}\n\n\nvoid app_lv_mouse_indev_deinit(lv_indev_t *indev) {\n    lv_indev_drv_t *driver = indev->driver;\n    lv_indev_delete(indev);\n    free(driver);\n}\n\nstatic void read_cb(lv_indev_drv_t *drv, lv_indev_data_t *data) {\n    int x, y;\n    Uint32 buttons = SDL_GetMouseState(&x, &y);\n    data->state = (buttons & SDL_BUTTON_LEFT) ? LV_INDEV_STATE_PRESSED : LV_INDEV_STATE_RELEASED;\n    data->point.x = x;\n    data->point.y = y;\n    data->continue_reading = false;\n}"
  },
  {
    "path": "app/lvgl/mouse.h",
    "content": "#pragma once\n\n#include <lvgl.h>\n\nlv_indev_t *app_lv_mouse_indev_init();\n\nvoid app_lv_mouse_indev_deinit(lv_indev_t *indev);"
  },
  {
    "path": "app/lvgl/theme.c",
    "content": "#include \"theme.h\"\n#include \"config.h\"\n\n#include \"ui/app_ui.h\"\n\n#include \"ext/msgbox_ext.h\"\n\nstatic void apply_cb(lv_theme_t *theme, lv_obj_t *obj);\n\ntypedef struct theme_context_t {\n    app_ui_t *ui;\n\n    lv_style_t scr;\n\n    lv_style_t obj;\n\n    lv_style_t focused;\n\n    lv_style_t label;\n\n    lv_style_t btn;\n    lv_style_t btn_focused;\n    lv_style_t btn_pressed;\n\n    lv_style_t dropdown_list;\n\n    lv_style_t modal_bg;\n\n    lv_style_t msgbox;\n    lv_style_t msgbox_backdrop;\n    lv_style_t msgbox_title;\n    lv_style_t msgbox_text;\n    lv_style_t msgbox_btns;\n    lv_style_t msgbox_btns_item;\n    lv_style_t msgbox_btns_item_focused;\n    lv_style_t msgbox_btns_item_pressed;\n\n    lv_style_t win_title;\n    lv_style_t win_btn;\n    lv_style_t win_header;\n    lv_style_t win_content;\n\n    lv_style_t arc_indic;\n    lv_style_t arc_indic_primary;\n\n} theme_context_t;\n\nvoid app_theme_init(lv_theme_t *theme, app_ui_t *ui) {\n    theme_context_t *styles = lv_mem_alloc(sizeof(theme_context_t));\n    lv_memset_00(styles, sizeof(theme_context_t));\n    styles->ui = ui;\n\n    theme->font_small = ui->font.small;\n    theme->font_normal = ui->font.body;\n    theme->font_large = ui->font.heading3;\n\n    lv_color_t primary_color = lv_color_hex(0x1387b8);\n    lv_color_t accent_color = lv_color_lighten(primary_color, 1);\n    lv_color_t focus_color = lv_color_make(31, 169, 255);\n\n    theme->color_primary = primary_color;\n\n    lv_style_init(&styles->scr);\n\n    const static lv_grad_dsc_t grad = {\n            .dir = LV_GRAD_DIR_VER,\n            .stops = {\n                    {.color = {.ch = {.red = 0x11, .green = 0x1d, .blue = 0x2e, .alpha = 255}}, .frac = 0},\n                    {.color = {.ch = {.red = 0x05, .green = 0x18, .blue = 0x39, .alpha = 255}}, .frac = 63},\n                    {.color = {.ch = {.red = 0x0a, .green = 0x1b, .blue = 0x48, .alpha = 255}}, .frac = 119},\n                    {.color = {.ch = {.red = 0x13, .green = 0x2e, .blue = 0x62, .alpha = 255}}, .frac = 172},\n                    {.color = {.ch = {.red = 0x14, .green = 0x4b, .blue = 0x7e, .alpha = 255}}, .frac = 216},\n                    {.color = {.ch = {.red = 0x13, .green = 0x64, .blue = 0x97, .alpha = 255}}, .frac = 255},\n            },\n            .stops_count = 6,\n    };\n    lv_style_set_bg_grad(&styles->scr, &grad);\n    lv_style_set_bg_opa(&styles->scr, LV_OPA_COVER);\n\n    lv_style_init(&styles->obj);\n    lv_style_set_text_color(&styles->obj, lv_color_white());\n    lv_style_set_pad_gap(&styles->obj, LV_DPX(10));\n\n    lv_style_init(&styles->focused);\n    lv_style_set_outline_width(&styles->focused, LV_DPX(2));\n    lv_style_set_outline_opa(&styles->focused, LV_OPA_COVER);\n    lv_style_set_outline_color(&styles->focused, primary_color);\n    lv_style_set_outline_pad(&styles->focused, LV_DPX(5));\n    lv_style_set_radius(&styles->focused, LV_DPX(5));\n\n    lv_style_init(&styles->label);\n    lv_style_set_text_font(&styles->label, ui->font.body);\n\n    lv_style_init(&styles->btn);\n    lv_style_set_pad_all(&styles->btn, LV_DPX(10));\n    lv_style_set_bg_color(&styles->btn, lv_color_white());\n    lv_style_set_bg_opa(&styles->btn, LV_OPA_20);\n\n    lv_style_init(&styles->btn_focused);\n    lv_style_set_bg_color(&styles->btn_focused, focus_color);\n    lv_style_set_bg_opa(&styles->btn_focused, LV_OPA_COVER);\n\n    lv_style_init(&styles->btn_pressed);\n    lv_style_set_bg_color(&styles->btn_pressed, lv_color_darken(focus_color, LV_OPA_20));\n    lv_style_set_bg_opa(&styles->btn_pressed, LV_OPA_COVER);\n\n    lv_style_init(&styles->dropdown_list);\n    lv_style_set_pad_ver(&styles->dropdown_list, LV_DPX(20));\n    lv_style_set_pad_hor(&styles->dropdown_list, LV_DPX(15));\n    lv_style_set_text_line_space(&styles->dropdown_list, LV_DPX(20));\n\n    lv_style_init(&styles->modal_bg);\n    lv_style_set_bg_color(&styles->modal_bg, lv_color_hex(0x25282e));\n    lv_style_set_bg_opa(&styles->modal_bg, LV_OPA_COVER);\n    lv_style_set_shadow_color(&styles->modal_bg, lv_color_black());\n    lv_style_set_shadow_opa(&styles->modal_bg, LV_OPA_30);\n    lv_style_set_shadow_width(&styles->modal_bg, LV_DPX(20));\n    lv_style_set_shadow_ofs_y(&styles->modal_bg, LV_DPX(10));\n    lv_style_set_radius(&styles->modal_bg, LV_DPX(5));\n    lv_style_set_min_width(&styles->modal_bg, LV_DPX(480));\n    lv_style_set_max_width(&styles->modal_bg, LV_DPX(576));\n\n    lv_style_init(&styles->msgbox);\n    lv_style_set_pad_top(&styles->msgbox, LV_DPX(16));\n    lv_style_set_pad_bottom(&styles->msgbox, LV_DPX(8));\n    lv_style_set_pad_hor(&styles->msgbox, LV_DPX(8));\n    lv_style_set_flex_main_place(&styles->msgbox, LV_FLEX_ALIGN_END);\n\n    lv_style_init(&styles->msgbox_backdrop);\n    lv_style_set_bg_color(&styles->msgbox_backdrop, lv_color_black());\n    lv_style_set_bg_opa(&styles->msgbox_backdrop, LV_OPA_30);\n\n    lv_style_init(&styles->msgbox_title);\n    lv_style_set_text_font(&styles->msgbox_title, ui->font.heading2);\n    lv_style_set_text_letter_space(&styles->msgbox_title, LV_DPX(1));\n    lv_style_set_pad_hor(&styles->msgbox_title, LV_DPX(16));\n\n    lv_style_init(&styles->msgbox_text);\n    lv_style_set_text_font(&styles->msgbox_text, ui->font.body);\n    lv_style_set_pad_top(&styles->msgbox_text, LV_DPX(8));\n    lv_style_set_pad_hor(&styles->msgbox_text, LV_DPX(16));\n    lv_style_set_pad_bottom(&styles->msgbox_text, LV_DPX(16));\n\n    lv_style_init(&styles->msgbox_btns);\n\n    lv_style_init(&styles->msgbox_btns_item);\n    lv_style_set_radius(&styles->msgbox_btns_item, LV_DPX(2));\n    lv_style_set_text_font(&styles->msgbox_btns_item, ui->font.small);\n    lv_style_set_text_color(&styles->msgbox_btns_item, accent_color);\n\n    lv_style_init(&styles->msgbox_btns_item_focused);\n    lv_style_set_bg_color(&styles->msgbox_btns_item_focused, primary_color);\n    lv_style_set_bg_opa(&styles->msgbox_btns_item_focused, LV_OPA_10);\n\n    lv_style_init(&styles->msgbox_btns_item_pressed);\n    lv_style_set_bg_color(&styles->msgbox_btns_item_pressed, primary_color);\n    lv_style_set_bg_opa(&styles->msgbox_btns_item_pressed, LV_OPA_20);\n\n    lv_style_init(&styles->win_title);\n    lv_style_set_text_font(&styles->win_title, ui->font.heading2);\n\n    lv_style_init(&styles->win_btn);\n    lv_style_set_text_font(&styles->win_btn, ui->iconfont.heading3);\n    lv_style_set_radius(&styles->win_btn, LV_RADIUS_CIRCLE);\n    lv_style_set_min_height(&styles->win_btn, LV_DPX(40));\n    lv_style_set_max_height(&styles->win_btn, LV_DPX(40));\n\n    lv_style_init(&styles->win_header);\n    lv_style_set_min_height(&styles->win_header, LV_DPX(60));\n    lv_style_set_pad_hor(&styles->win_header, LV_DPX(30));\n    lv_style_set_pad_top(&styles->win_header, LV_DPX(20));\n    lv_style_set_pad_bottom(&styles->win_header, LV_DPX(10));\n\n    lv_style_init(&styles->win_content);\n    lv_style_set_pad_hor(&styles->win_content, LV_DPX(30));\n    lv_style_set_pad_top(&styles->win_content, LV_DPX(10));\n    lv_style_set_pad_bottom(&styles->win_content, LV_DPX(15));\n\n    lv_style_init(&styles->arc_indic);\n    lv_style_set_arc_color(&styles->arc_indic, lv_color_lighten(accent_color, LV_OPA_80));\n    lv_style_set_arc_opa(&styles->arc_indic, LV_OPA_20);\n    lv_style_set_arc_width(&styles->arc_indic, LV_DPX(15));\n    lv_style_set_arc_rounded(&styles->arc_indic, true);\n\n    lv_style_init(&styles->arc_indic_primary);\n    lv_style_set_arc_color(&styles->arc_indic_primary, accent_color);\n    lv_style_set_arc_opa(&styles->arc_indic_primary, LV_OPA_COVER);\n\n    theme->user_data = styles;\n\n    lv_theme_set_apply_cb(theme, apply_cb);\n}\n\nvoid app_theme_deinit(lv_theme_t *theme) {\n    theme_context_t *styles = theme->user_data;\n    lv_style_reset(&styles->arc_indic_primary);\n    lv_style_reset(&styles->arc_indic);\n\n    lv_style_reset(&styles->win_content);\n    lv_style_reset(&styles->win_header);\n    lv_style_reset(&styles->win_btn);\n    lv_style_reset(&styles->win_title);\n\n    lv_style_reset(&styles->msgbox_btns_item_pressed);\n    lv_style_reset(&styles->msgbox_btns_item_focused);\n    lv_style_reset(&styles->msgbox_btns_item);\n    lv_style_reset(&styles->msgbox_btns);\n    lv_style_reset(&styles->msgbox_text);\n    lv_style_reset(&styles->msgbox_title);\n    lv_style_reset(&styles->msgbox_backdrop);\n    lv_style_reset(&styles->msgbox);\n\n    lv_style_reset(&styles->modal_bg);\n\n    lv_style_reset(&styles->dropdown_list);\n\n    lv_style_reset(&styles->btn_focused);\n    lv_style_reset(&styles->btn_pressed);\n    lv_style_reset(&styles->btn);\n\n    lv_style_reset(&styles->focused);\n    lv_style_reset(&styles->obj);\n    lv_style_reset(&styles->scr);\n\n    free(styles);\n}\n\nlv_coord_t app_win_header_size(lv_theme_t *theme) {\n    if (theme->apply_cb != apply_cb) {\n        return LV_SIZE_CONTENT;\n    }\n    theme_context_t *styles = theme->user_data;\n    lv_style_value_t value;\n    if (lv_style_get_prop(&styles->win_header, LV_STYLE_MIN_HEIGHT, &value) != LV_RES_OK) {\n        return LV_SIZE_CONTENT;\n    }\n    return value.num;\n}\n\nlv_obj_t *app_lv_win_create(lv_obj_t *parent) {\n    lv_theme_t *theme = lv_disp_get_theme(lv_obj_get_disp(parent));\n    lv_obj_t *win = lv_win_create(parent, app_win_header_size(theme));\n    lv_obj_t *header = lv_win_get_header(win);\n    lv_obj_clear_flag(header, LV_OBJ_FLAG_SCROLLABLE);\n\n#if IHSPLAY_WIP_FEATURES\n    lv_obj_t *footer = lv_obj_create(win);\n    lv_obj_set_style_bg_opa(footer, LV_OPA_30, 0);\n    lv_obj_set_style_bg_color(footer, lv_color_black(), 0);\n    lv_obj_set_style_pad_hor(footer, lv_obj_get_style_pad_left(header, 0), 0);\n    lv_obj_set_size(footer, LV_PCT(100), LV_DPX(40));\n    lv_obj_set_flex_flow(footer, LV_FLEX_FLOW_ROW);\n    lv_obj_set_flex_align(footer, LV_FLEX_ALIGN_END, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);\n\n    lv_obj_t *prompt_a = lv_label_create(footer);\n    lv_label_set_text(prompt_a, \"(A) Open\");\n\n    lv_obj_t *prompt_b = lv_label_create(footer);\n    lv_label_set_text(prompt_b, \"(B) Back\");\n#endif\n    return win;\n}\n\nstatic void apply_cb(lv_theme_t *theme, lv_obj_t *obj) {\n    theme_context_t *styles = theme->user_data;\n    lv_obj_t *parent = lv_obj_get_parent(obj);\n    if (parent == NULL) {\n        lv_obj_add_style(obj, &styles->scr, 0);\n        return;\n    }\n    lv_obj_add_style(obj, &styles->obj, 0);\n    if (lv_obj_has_class(obj, &lv_btn_class)) {\n        lv_obj_add_style(obj, &styles->btn, 0);\n        lv_obj_add_style(obj, &styles->btn_pressed, LV_STATE_PRESSED);\n        lv_obj_add_style(obj, &styles->btn_focused, LV_STATE_FOCUS_KEY);\n        if (parent->parent != NULL && lv_obj_check_type(parent->parent, &lv_win_class)) {\n            if (lv_win_get_header(parent->parent) == obj->parent) {\n                lv_obj_add_style(obj, &styles->win_btn, 0);\n            }\n        }\n    } else if (lv_obj_has_class(obj, &lv_label_class)) {\n        lv_obj_add_style(obj, &styles->label, 0);\n        if (lv_obj_check_type(parent, &lv_msgbox_class)) {\n            if (lv_msgbox_get_title(parent) == NULL && lv_msgbox_get_content(parent) == NULL) {\n                // Title was not assigned, and the content was not created either. Assume this is the title\n                lv_obj_add_style(obj, &styles->msgbox_title, 0);\n            }\n        } else if (parent->parent != NULL) {\n            if (lv_obj_check_type(parent->parent, &lv_msgbox_class)) {\n                if (lv_msgbox_get_content(parent->parent) == lv_obj_get_parent(obj)) {\n                    lv_obj_add_style(obj, &styles->msgbox_text, 0);\n                }\n            } else if (lv_obj_check_type(parent->parent, &lv_win_class)) {\n                if (lv_win_get_header(parent->parent) == lv_obj_get_parent(obj)) {\n                    lv_obj_add_style(obj, &styles->win_title, 0);\n                }\n            }\n        }\n    } else if (lv_obj_has_class(obj, &lv_dropdown_class)) {\n        lv_obj_add_style(obj, &styles->label, 0);\n        lv_obj_add_style(obj, &styles->focused, LV_STATE_FOCUS_KEY);\n    } else if (lv_obj_has_class(obj, &lv_dropdownlist_class)) {\n        lv_obj_add_style(obj, &styles->modal_bg, 0);\n        lv_obj_add_style(obj, &styles->modal_bg, 0);\n        lv_obj_add_style(obj, &styles->label, LV_PART_SELECTED);\n        lv_obj_add_style(obj, &styles->dropdown_list, 0);\n        lv_obj_add_style(obj, &styles->dropdown_list, LV_PART_SELECTED);\n    } else if (lv_obj_has_class(obj, &lv_btnmatrix_class)) {\n        if (lv_obj_check_type(parent, &lv_msgbox_class)) {\n            lv_obj_add_style(obj, &styles->msgbox_btns, 0);\n            lv_obj_add_style(obj, &styles->msgbox_btns_item, LV_PART_ITEMS);\n            lv_obj_add_style(obj, &styles->msgbox_btns_item_focused, LV_PART_ITEMS | LV_STATE_FOCUSED);\n            lv_obj_add_style(obj, &styles->msgbox_btns_item_pressed, LV_PART_ITEMS | LV_STATE_PRESSED);\n        }\n    } else if (lv_obj_check_type(obj, &lv_msgbox_class)) {\n        lv_obj_add_style(obj, &styles->modal_bg, 0);\n        lv_obj_add_style(obj, &styles->msgbox, 0);\n        msgbox_inject_nav(styles->ui, obj);\n    } else if (lv_obj_check_type(obj, &lv_msgbox_backdrop_class)) {\n        lv_obj_add_style(obj, &styles->msgbox_backdrop, 0);\n    } else if (lv_obj_check_type(obj, &lv_spinner_class)) {\n        lv_obj_add_style(obj, &styles->arc_indic, 0);\n        lv_obj_add_style(obj, &styles->arc_indic, LV_PART_INDICATOR);\n        lv_obj_add_style(obj, &styles->arc_indic_primary, LV_PART_INDICATOR);\n    } else if (lv_obj_check_type(obj, &lv_arc_class)) {\n        lv_obj_add_style(obj, &styles->arc_indic, 0);\n        lv_obj_add_style(obj, &styles->arc_indic, LV_PART_INDICATOR);\n        lv_obj_add_style(obj, &styles->arc_indic_primary, LV_PART_INDICATOR);\n    } else if (lv_obj_check_type(parent, &lv_win_class)) {\n        if (obj == lv_win_get_header(parent)) {\n            lv_obj_add_style(obj, &styles->win_header, 0);\n        } else if (obj == lv_win_get_content(parent)) {\n            lv_obj_add_style(obj, &styles->win_content, 0);\n        }\n    }\n}\n"
  },
  {
    "path": "app/lvgl/theme.h",
    "content": "#pragma once\n\n#include <lvgl.h>\n\ntypedef struct app_ui_t app_ui_t;\n\nvoid app_theme_init(lv_theme_t *theme, app_ui_t *ui);\n\nvoid app_theme_deinit(lv_theme_t *theme);\n\nlv_coord_t app_win_header_size(lv_theme_t *theme);\n\nlv_obj_t *app_lv_win_create(lv_obj_t *parent);"
  },
  {
    "path": "app/main.c",
    "content": "#include <SDL.h>\n#include <lvgl.h>\n\n#include \"app.h\"\n#include \"config.h\"\n\n#include \"ui/app_ui.h\"\n\n#include \"lvgl/display.h\"\n#include \"lvgl/ext/lv_dir_focus.h\"\n\n#include \"ss4s.h\"\n\n#include \"backend/host_manager.h\"\n#include \"backend/stream_manager.h\"\n#include \"backend/input_manager.h\"\n\n#include \"logging.h\"\n#include \"logging_ext_ss4s.h\"\n#include \"logging_ext_sdl.h\"\n#include \"logging_ext_lvgl.h\"\n#include \"os_info.h\"\n\n#if IHSPLAY_FEATURE_LIBCEC\n\n#include \"cec_sdl.h\"\n\n#endif\n\nstatic void process_events();\n\nstatic void logging_init();\n\nstatic app_t *app = NULL;\n\nstatic bool use_windowed();\n\nint main(int argc, char *argv[]) {\n    logging_init();\n    app_preinit(argc, argv);\n    SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC);\n\n    os_info_t os_info;\n    if (os_info_get(&os_info) == 0) {\n        char *str = os_info_str(&os_info);\n        commons_log_info(\"APP\", \"System: %s\", str);\n        free(str);\n    }\n\n    app_settings_t settings;\n    app_settings_init(&settings, &os_info);\n\n    SS4S_Config ss4s_config = {\n            .audioDriver = settings.audio_driver,\n            .videoDriver = settings.video_driver,\n            .loggingFunction = commons_ss4s_logf,\n    };\n    SS4S_Init(argc, argv, &ss4s_config);\n    IHS_Init();\n    SDL_RegisterEvents((APP_EVENT_LAST - APP_EVENT_BEGIN) + 1);\n    lv_init();\n    lv_dir_focus_register();\n\n    int w = 1920, h = 1080;\n    SDL_DisplayMode mode;\n    SDL_GetDisplayMode(0, 0, &mode);\n    /* Get display size. Fallback to 1920x1080 if failed. */\n    if (mode.w > 0 && mode.h > 0) {\n        w = mode.w;\n        h = mode.h;\n    }\n    Uint32 fullscreen_flag;\n#ifdef TARGET_WEBOS\n    fullscreen_flag = SDL_WINDOW_FULLSCREEN;\n#elif IHSPLAY_FEATURE_FORCE_FULLSCREEN\n    fullscreen_flag = SDL_WINDOW_FULLSCREEN_DESKTOP;\n#else\n    bool windowed = use_windowed();\n    if (windowed) {\n        w = 1920;\n        h = 1080;\n        fullscreen_flag = SDL_WINDOW_RESIZABLE;\n    } else {\n        fullscreen_flag = SDL_WINDOW_FULLSCREEN_DESKTOP;\n    }\n#endif\n    /* Caveat: Don't use SDL_WINDOW_FULLSCREEN_DESKTOP on webOS. On older platforms it's not supported. */\n    SDL_Window *window = SDL_CreateWindow(\"IHSplay\", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h,\n                                          SDL_WINDOW_ALLOW_HIGHDPI | fullscreen_flag);\n    SS4S_PostInit(argc, argv);\n\n    lv_disp_t *disp = app_lv_disp_init(window);\n    lv_disp_set_default(disp);\n\n    app = app_create(&settings, disp);\n    app->os_info = os_info;\n\n#if IHSPLAY_FEATURE_LIBCEC\n    cec_sdl_ctx_t cec;\n    cec_sdl_init(&cec, \"IHSplay\");\n#endif\n\n    while (app->running) {\n        process_events();\n        uint32_t next_delay = lv_task_handler();\n        SDL_Delay(stream_manager_is_active(app->stream_manager) ? 1 : next_delay);\n    }\n    // Drain remaining events\n    process_events();\n\n#if IHSPLAY_FEATURE_LIBCEC\n    cec_sdl_deinit(&cec);\n#endif\n\n    app_destroy(app);\n\n    app_lv_disp_deinit(disp);\n\n    app_settings_deinit(&settings);\n\n    SDL_DestroyWindow(window);\n    IHS_Quit();\n\n    SS4S_Quit();\n\n    SDL_Quit();\n    commons_logging_deinit();\n    os_info_clear(&os_info);\n    return 0;\n}\n\nstatic void process_events() {\n    SDL_Event event;\n    while (SDL_PollEvent(&event)) {\n        switch (event.type) {\n            case SDL_KEYUP:\n            case SDL_KEYDOWN:\n            case SDL_MOUSEMOTION:\n            case SDL_MOUSEBUTTONDOWN:\n            case SDL_MOUSEBUTTONUP:\n            case SDL_CONTROLLERAXISMOTION:\n            case SDL_CONTROLLERBUTTONDOWN:\n            case SDL_CONTROLLERBUTTONUP:\n            case SDL_CONTROLLERDEVICEADDED:\n            case SDL_CONTROLLERDEVICEREMOVED: {\n                bool intercept_by_stream = stream_manager_intercept_event(app->stream_manager, &event);\n                if (!intercept_by_stream) {\n                    app_sdl_input_event(app, &event);\n                }\n                stream_manager_handle_event(app->stream_manager, &event);\n                break;\n            }\n            case SDL_APP_WILLENTERBACKGROUND: {\n#if IHSPLAY_FEATURE_FORCE_FULLSCREEN\n                stream_manager_stop_active(app->stream_manager);\n#endif\n                break;\n            }\n            case SDL_APP_DIDENTERFOREGROUND: {\n                lv_obj_invalidate(lv_scr_act());\n                break;\n            }\n            case SDL_QUIT: {\n                app_quit(app);\n                break;\n            }\n            case APP_RUN_ON_MAIN: {\n                void (*action)(app_t *, void *) = event.user.data1;\n                void *data = event.user.data2;\n                action(app, data);\n                break;\n            }\n            default: {\n                if (event.type > APP_UI_EVENT_BEGIN && event.type < APP_UI_EVENT_LAST) {\n                    app_ui_event_data_t data = {.data1 = event.user.data1, .data2 = event.user.data2};\n                    if (!app_ui_dispatch_event(app->ui, event.type, &data)) {\n                        commons_log_debug(\"UI\", \"Unhandled UI event 0x%x\", event.type);\n                    }\n                }\n                break;\n            }\n        }\n    }\n}\n\nstatic void logging_init() {\n    commons_logging_init(\"ihsplay\");\n    lv_log_register_print_cb(commons_lv_log);\n    SDL_LogSetAllPriority(SDL_LOG_PRIORITY_VERBOSE);\n    SDL_LogSetOutputFunction(commons_sdl_log, NULL);\n}\n\nstatic bool use_windowed() {\n    const char *v = SDL_getenv(\"IHSPLAY_WINDOWED\");\n    if (v == NULL) {\n        return false;\n    }\n    return strcmp(v, \"1\") == 0 || strcmp(v, \"true\") == 0;\n}\n\nvoid app_ihs_log(IHS_LogLevel level, const char *tag, const char *message) {\n    char app_tag[32] = \"IHS.\";\n    strncpy(app_tag + 4, tag, 28);\n    commons_log_printf((commons_log_level) level, app_tag, \"%s\", message);\n}"
  },
  {
    "path": "app/platform/CMakeLists.txt",
    "content": "if (TARGET_WEBOS)\n    add_subdirectory(webos)\nelse()\n    add_subdirectory(common)\nendif ()"
  },
  {
    "path": "app/platform/common/CMakeLists.txt",
    "content": "target_sources(ihsplay PRIVATE app_common.c client_info_common.c)"
  },
  {
    "path": "app/platform/common/app_common.c",
    "content": "#include \"app.h\"\n\nvoid app_preinit(int argc, char *argv[]) {\n\n}\n\nvoid app_ui_set_handle_nav_back(app_ui_t *ui, bool handle) {\n}"
  },
  {
    "path": "app/platform/common/client_info_common.c",
    "content": "#include \"util/client_info.h\"\n\nbool client_info_load(client_info_t *info) {\n    client_info_load_default(info);\n    return true;\n}"
  },
  {
    "path": "app/platform/webos/CMakeLists.txt",
    "content": "pkg_check_modules(PBNJSON_C REQUIRED pbnjson_c)\ntarget_sources(ihsplay PRIVATE app_webos.c client_info_webos.c)\ntarget_include_directories(ihsplay PRIVATE ${PBNJSON_C_INCLUDE_DIRS})\ntarget_link_libraries(ihsplay PRIVATE ${PBNJSON_C_LIBRARIES})"
  },
  {
    "path": "app/platform/webos/app_webos.c",
    "content": "#include \"app.h\"\n\nvoid app_preinit(int argc, char *argv[]) {\n    (void) argc;\n    (void) argv;\n\n    SDL_SetHint(SDL_HINT_WEBOS_ACCESS_POLICY_KEYS_EXIT, \"true\");\n    SDL_SetHint(SDL_HINT_WEBOS_CURSOR_SLEEP_TIME, \"5000\");\n}\n\nvoid app_ui_set_handle_nav_back(app_ui_t *ui, bool handle) {\n    (void) ui;\n    SDL_SetHint(SDL_HINT_WEBOS_ACCESS_POLICY_KEYS_BACK, handle ? \"true\" : \"false\");\n}"
  },
  {
    "path": "app/platform/webos/client_info_webos.c",
    "content": "#include \"util/client_info.h\"\n\n#include <string.h>\n#include <stdio.h>\n#include <pbnjson.h>\n\n#include \"lunasynccall.h\"\n#include \"logging.h\"\n\n#include <mbedtls/sha1.h>\n#include <mbedtls/sha256.h>\n\nbool client_info_load(client_info_t *info) {\n    memset(info, 0, sizeof(*info));\n    char *payload = NULL;\n    const char *uri = \"luna://com.webos.service.config/getConfigs\";\n    if (!HLunaServiceCallSync(uri, \"{\\\"configNames\\\":[\\\"tv.model.serialnumber\\\", \\\"tv.model.modelname\\\"]}\", true,\n                              &payload) || !payload) {\n        commons_log_warn(\"OSInfo\", \"Failed to call %s\", uri);\n        return client_info_load_default(info);\n    }\n\n    JSchemaInfo schemaInfo;\n    jschema_info_init(&schemaInfo, jschema_all(), NULL, NULL);\n    jdomparser_ref parser = jdomparser_create(&schemaInfo, 0);\n    jdomparser_feed(parser, payload, (int) strlen(payload));\n    jdomparser_end(parser);\n    jvalue_ref body = jdomparser_get_result(parser);\n    jvalue_ref configs = jobject_get(body, j_cstr_to_buffer(\"configs\"));\n    if (jis_null(configs)) {\n        jdomparser_release(&parser);\n        return client_info_load_default(info);\n    }\n    jvalue_ref serial_number = jobject_get(configs, j_cstr_to_buffer(\"tv.model.serialnumber\"));\n    jvalue_ref module_name = jobject_get(configs, j_cstr_to_buffer(\"tv.model.modelname\"));\n    if (!jis_string(serial_number) || !jis_string(module_name)) {\n        jdomparser_release(&parser);\n        return client_info_load_default(info);\n    }\n    raw_buffer serial_number_buf = jstring_get(serial_number);\n    raw_buffer module_name_buf = jstring_get(module_name);\n\n    unsigned char sha1[20];\n    mbedtls_sha1((const unsigned char *) serial_number_buf.m_str, serial_number_buf.m_len, sha1);\n    memcpy(&info->device_id, &sha1[4], 16);\n\n    mbedtls_sha256((const unsigned char *) serial_number_buf.m_str, serial_number_buf.m_len, info->secret_key, 0);\n\n    char name[64];\n    snprintf(name, 64, \"webOS TV %.*s\", module_name_buf.m_len, module_name_buf.m_str);\n    info->name = strndup(name, 64);\n\n    jdomparser_release(&parser);\n\n    info->config.deviceId = info->device_id;\n    info->config.secretKey = info->secret_key;\n    info->config.deviceName = info->name;\n\n    return true;\n}"
  },
  {
    "path": "app/settings/CMakeLists.txt",
    "content": "target_sources(ihsplay PRIVATE settings.c)"
  },
  {
    "path": "app/settings/app_settings.h",
    "content": "#pragma once\n\n#include <stdbool.h>\n#include <stdint.h>\n\n#include \"array_list.h\"\n\ntypedef struct os_info_t os_info_t;\n\ntypedef struct app_settings_t {\n    bool enable_input;\n    bool relmouse;\n    /** The pointer references to modules */\n    const char *audio_driver;\n    /** The pointer references to modules */\n    const char *video_driver;\n    array_list_t modules;\n    uint64_t selected_client_id;\n} app_settings_t;\n\nvoid app_settings_init(app_settings_t *settings, const os_info_t *os_info);\n\nvoid app_settings_deinit(app_settings_t *settings);"
  },
  {
    "path": "app/settings/settings.c",
    "content": "#include <string.h>\n\n#include \"app_settings.h\"\n\n#include \"ss4s_modules.h\"\n\n#include \"array_list.h\"\n#include \"os_info.h\"\n#include \"logging.h\"\n\nvoid app_settings_init(app_settings_t *settings, const os_info_t *os_info) {\n    memset(settings, 0, sizeof(app_settings_t));\n    int errno;\n    if ((errno = SS4S_ModulesList(&settings->modules, os_info)) != 0) {\n        commons_log_error(\"SS4S\", \"Can't load modules list: %s\", strerror(errno));\n    }\n    settings->enable_input = true;\n    settings->relmouse = true;\n\n    SS4S_ModulePreferences preferences = {.audio_module = NULL, .video_module = NULL};\n    SS4S_ModuleSelection selection = {.audio_module = NULL, .video_module = NULL};\n    // TODO: check result\n    SS4S_ModulesSelect(&settings->modules, &preferences, &selection, true);\n    settings->video_driver = SS4S_ModuleInfoGetId(selection.video_module);\n    settings->audio_driver = SS4S_ModuleInfoGetId(selection.audio_module);\n}\n\nvoid app_settings_deinit(app_settings_t *settings) {\n    SS4S_ModulesListClear(&settings->modules);\n}\n"
  },
  {
    "path": "app/ui/CMakeLists.txt",
    "content": "target_sources(ihsplay PRIVATE\n        app_ui.c\n        app_ui_font.c\n        launcher.c\n        hosts/hosts_fragment.c\n        settings/settings.c\n        settings/basic.c\n        settings/widgets.c)\n\nadd_subdirectory(common)\nadd_subdirectory(connection)\nadd_subdirectory(session)\nadd_subdirectory(support)\n"
  },
  {
    "path": "app/ui/app_ui.c",
    "content": "#include <stdlib.h>\n\n#include <lvgl.h>\n#include <src/draw/sdl/lv_draw_sdl.h>\n\n#include \"app_ui.h\"\n#include \"launcher.h\"\n#include \"lvgl/fonts/bootstrap-icons/regular.h\"\n#include \"lvgl/keypad.h\"\n#include \"lvgl/mouse.h\"\n#include \"lvgl/theme.h\"\n#include \"backend/stream_manager.h\"\n\nstatic void app_input_populate_group(app_ui_t *ui);\n\nstatic void app_ui_focus_cb(lv_group_t *group);\n\napp_ui_t *app_ui_create(app_t *app, lv_disp_t *disp) {\n    lv_draw_sdl_drv_param_t *param = disp->driver->user_data;\n    app_ui_t *ui = calloc(1, sizeof(app_ui_t));\n    ui->app = app;\n    ui->window = param->user_data;\n    ui->root = lv_disp_get_scr_act(disp);\n    ui->fm = lv_fragment_manager_create(NULL);\n\n    lv_group_t *group = lv_group_create();\n    group->user_data = ui;\n    lv_group_set_editing(group, 0);\n    lv_group_set_default(group);\n    lv_group_set_focus_cb(group, app_ui_focus_cb);\n    ui->group = group;\n    _lv_ll_init(&ui->modal_groups, sizeof(lv_group_t *));\n\n    ui->indev.mouse = app_lv_mouse_indev_init();\n    ui->indev.keypad = app_indev_keypad_init(app);\n\n    app_ui_fontset_set_default_size(ui, &ui->font);\n    app_ui_fontset_set_default_size(ui, &ui->iconfont);\n\n    app_ui_fontset_init_fc(&ui->font, \"sans-serif\");\n    app_ui_fontset_init_mem(&ui->iconfont, \"bootstrap-icons\", ttf_bootstrap_icons_data,\n                            ttf_bootstrap_icons_size);\n    app_ui_fontset_apply_fallback(&ui->font, &ui->iconfont);\n\n    lv_obj_set_style_bg_opa(ui->root, LV_OPA_0, 0);\n\n    lv_style_init(&ui->styles.action_btn_label);\n    lv_style_set_text_font(&ui->styles.action_btn_label, ui->iconfont.heading2);\n\n    lv_theme_set_parent(&ui->theme, lv_disp_get_theme(disp));\n    app_theme_init(&ui->theme, ui);\n    lv_disp_set_theme(disp, &ui->theme);\n    return ui;\n}\n\nvoid app_ui_created(app_ui_t *ui) {\n    app_ui_push_fragment(ui, &launcher_fragment_class, NULL);\n    app_ui_resized(ui, lv_obj_get_width(ui->root), lv_obj_get_height(ui->root));\n}\n\nvoid app_ui_destroy(app_ui_t *ui) {\n    lv_group_set_default(NULL);\n    lv_group_del(ui->group);\n    _lv_ll_clear(&ui->modal_groups);\n\n    lv_style_reset(&ui->styles.action_btn_label);\n\n    app_ui_fontset_deinit(&ui->iconfont);\n    app_ui_fontset_deinit(&ui->font);\n    lv_fragment_manager_del(ui->fm);\n\n    app_indev_keypad_deinit(ui->indev.keypad);\n    app_lv_mouse_indev_deinit(ui->indev.mouse);\n\n    app_theme_deinit(&ui->theme);\n\n    free(ui);\n}\n\nvoid app_ui_resized(app_ui_t *ui, int width, int height) {\n    stream_manager_set_viewport_size(ui->app->stream_manager, width, height);\n}\n\nvoid app_ui_set_ignore_keys(app_ui_t *ui, bool ignore) {\n    app_indev_keypad_set_ignore(ui->indev.keypad, ignore);\n}\n\nlv_fragment_t *app_ui_create_fragment(app_ui_t *ui, const lv_fragment_class_t *cls, void *args) {\n    app_ui_fragment_args_t fargs = {ui->app, args};\n    return lv_fragment_create(cls, &fargs);\n}\n\nvoid app_ui_push_fragment(app_ui_t *ui, const lv_fragment_class_t *cls, void *args) {\n    lv_fragment_t *f = app_ui_create_fragment(ui, cls, args);\n    lv_fragment_manager_push(ui->fm, f, &ui->root);\n    app_ui_update_nav_back(ui);\n}\n\nvoid app_ui_remove_fragment(app_ui_t *ui, lv_fragment_t *f) {\n    lv_fragment_manager_remove(ui->fm, f);\n    app_ui_update_nav_back(ui);\n}\n\nvoid app_ui_pop_top_fragment(app_ui_t *ui) {\n    lv_fragment_manager_pop(ui->fm);\n    app_ui_update_nav_back(ui);\n}\n\nbool app_ui_dispatch_event(app_ui_t *ui, app_event_type_t type, app_ui_event_data_t *data) {\n    bool handled = lv_fragment_manager_send_event(ui->fm, type, data);\n    if (type == APP_UI_NAV_QUIT && !handled) {\n        app_quit(ui->app);\n        return true;\n    }\n    return handled;\n}\n\nvoid app_ui_push_modal_group(app_ui_t *ui, lv_group_t *group) {\n    LV_ASSERT_NULL(group);\n    lv_group_t **tail = _lv_ll_ins_tail(&ui->modal_groups);\n    *tail = group;\n    app_input_populate_group(ui);\n}\n\nvoid app_ui_remove_modal_group(app_ui_t *ui, lv_group_t *group) {\n    lv_group_t **node = NULL;\n    _LV_LL_READ_BACK(&ui->modal_groups, node) {\n        if (*node == group) break;\n    }\n    if (node) {\n        _lv_ll_remove(&ui->modal_groups, node);\n        lv_mem_free(node);\n    }\n    app_input_populate_group(ui);\n}\n\nlv_group_t *app_ui_get_input_group(app_ui_t *ui) {\n    return ui->indev.keypad->group;\n}\n\nvoid app_ui_update_nav_back(app_ui_t *ui) {\n    size_t stack_size = lv_fragment_manager_get_stack_size(ui->fm);\n    LV_ASSERT(stack_size > 0);\n    app_ui_set_handle_nav_back(ui, stack_size > 1);\n}\n\nstatic void app_input_populate_group(app_ui_t *ui) {\n    lv_group_t *group = NULL;\n    lv_group_t *const *tail = _lv_ll_get_tail(&ui->modal_groups);\n    if (tail) {\n        group = *tail;\n    }\n    if (!group) {\n        group = ui->group;\n    }\n    if (!group) {\n        group = lv_group_get_default();\n    }\n    lv_indev_set_group(ui->indev.keypad, group);\n    lv_indev_set_group(ui->indev.mouse, group);\n}\n\nstatic void app_ui_focus_cb(lv_group_t *group) {\n\n}"
  },
  {
    "path": "app/ui/app_ui.h",
    "content": "#pragma once\n\n#include <lvgl.h>\n#include <SDL.h>\n#include \"app.h\"\n#include \"app_ui_font.h\"\n\ntypedef struct app_t app_t;\n\n\ntypedef struct app_ui_t {\n    app_t *app;\n    lv_theme_t theme;\n    lv_obj_t *root;\n    lv_fragment_manager_t *fm;\n    SDL_Window *window;\n    app_ui_fontset_t font;\n    app_ui_fontset_t iconfont;\n    lv_group_t *group;\n    lv_ll_t modal_groups;\n    struct {\n        lv_indev_t *mouse;\n        lv_indev_t *keypad;\n    } indev;\n    struct {\n        lv_style_t action_btn_label;\n    } styles;\n} app_ui_t;\n\ntypedef struct app_ui_fragment_args_t {\n    app_t *app;\n    void *data;\n} app_ui_fragment_args_t;\n\ntypedef struct app_ui_event_data_t {\n    void *data1;\n    void *data2;\n} app_ui_event_data_t;\n\napp_ui_t *app_ui_create(app_t *app, lv_disp_t *disp);\n\nvoid app_ui_created(app_ui_t *ui);\n\nvoid app_ui_destroy(app_ui_t *ui);\n\nvoid app_ui_resized(app_ui_t *ui, int width, int height);\n\nvoid app_ui_set_ignore_keys(app_ui_t *ui, bool ignore);\n\nlv_fragment_t *app_ui_create_fragment(app_ui_t *ui, const lv_fragment_class_t *cls, void *args);\n\nvoid app_ui_push_fragment(app_ui_t *ui, const lv_fragment_class_t *cls, void *args);\n\nvoid app_ui_remove_fragment(app_ui_t *ui, lv_fragment_t *f);\n\nvoid app_ui_pop_top_fragment(app_ui_t *ui);\n\n/**\n * @warning DO NOT call this directly!\n * @return true if this event has been handled by someone\n */\nbool app_ui_dispatch_event(app_ui_t *ui, app_event_type_t type, app_ui_event_data_t *data);\n\nvoid app_ui_push_modal_group(app_ui_t *ui, lv_group_t *group);\n\nvoid app_ui_remove_modal_group(app_ui_t *ui, lv_group_t *group);\n\nlv_group_t *app_ui_get_input_group(app_ui_t *ui);\n\nvoid app_ui_update_nav_back(app_ui_t *ui);\n\nvoid app_ui_set_handle_nav_back(app_ui_t *ui, bool handle);"
  },
  {
    "path": "app/ui/app_ui_font.c",
    "content": "#include \"app_ui.h\"\n#include \"app_ui_font.h\"\n\n#include <fontconfig/fontconfig.h>\n#include <assert.h>\n\nstatic lv_font_t *load_font(const lv_ft_info_t *info, lv_coord_t size);\n\nstatic bool fontset_load_fc(app_ui_fontset_t *set, FcPattern *font);\n\nvoid app_ui_fontset_set_default_size(const app_ui_t *ui, app_ui_fontset_t *set) {\n    set->sizes.heading1 = LV_DPX(42);\n    set->sizes.heading2 = LV_DPX(28);\n    set->sizes.heading3 = LV_DPX(21);\n    set->sizes.body = LV_DPX(16);\n    set->sizes.small = LV_DPX(14);\n    set->sizes.huge = LV_DPX(96);\n}\n\n\nvoid app_ui_fontset_init_mem(app_ui_fontset_t *set, const char *name, const void *mem, size_t size) {\n    lv_ft_info_t ft_info = {.name = name, .mem = mem, .mem_size = size, .style = FT_FONT_STYLE_NORMAL};\n    set->body = load_font(&ft_info, set->sizes.body);\n    set->heading1 = load_font(&ft_info, set->sizes.heading1);\n    set->heading2 = load_font(&ft_info, set->sizes.heading2);\n    set->heading3 = load_font(&ft_info, set->sizes.heading3);\n    set->small = load_font(&ft_info, set->sizes.small);\n    set->huge = load_font(&ft_info, set->sizes.huge);\n}\n\nvoid app_ui_fontset_init_fc(app_ui_fontset_t *set, const char *name) {\n    //does not necessarily have to be a specific name.  You could put anything here and Fontconfig WILL find a font for you\n    FcPattern *pattern = FcNameParse((const FcChar8 *) name);\n    assert(pattern != NULL);\n\n    FcConfigSubstitute(NULL, pattern, FcMatchPattern);\n    FcDefaultSubstitute(pattern);\n\n    FcResult result;\n\n    FcPattern *font = FcFontMatch(NULL, pattern, &result);\n\n    fontset_load_fc(set, font);\n\n    if (font) {\n        FcPatternDestroy(font);\n        font = NULL;\n    }\n    FcPatternDestroy(pattern);\n    pattern = NULL;\n#ifdef FONT_FAMILY_FALLBACK\n    const i18n_entry_t *loc_entry = i18n_entry(i18n_locale());\n    pattern = FcNameParse((const FcChar8 *) ((loc_entry && loc_entry->font) ? loc_entry->font : FONT_FAMILY_FALLBACK));\n    if (pattern) {\n        FcLangSet *ls = FcLangSetCreate();\n        if (loc_entry) {\n            FcLangSetAdd(ls, (const FcChar8 *) loc_entry->locale);\n            FcPatternAddLangSet(pattern, FC_LANG, ls);\n        }\n\n        FcConfigSubstitute(NULL, pattern, FcMatchPattern);\n        FcDefaultSubstitute(pattern);\n\n        font = FcFontMatch(NULL, pattern, &result);\n        if (font) {\n            fontset.fallback = calloc(1, sizeof(app_fontset_t));\n            if (fontset_load_fc(fontset.fallback, font)) {\n                fontset.normal->fallback = fontset.fallback->normal;\n                fontset.large->fallback = fontset.fallback->large;\n                fontset.small->fallback = fontset.fallback->small;\n            } else {\n                free(fontset.fallback);\n                fontset.fallback = NULL;\n            }\n            FcPatternDestroy(font);\n            font = NULL;\n        }\n        FcLangSetDestroy(ls);\n        FcPatternDestroy(pattern);\n        pattern = NULL;\n    }\n#endif\n}\n\nvoid app_ui_fontset_apply_fallback(app_ui_fontset_t *set, const app_ui_fontset_t *fallback) {\n    set->small->fallback = fallback->small;\n    set->body->fallback = fallback->body;\n    set->heading3->fallback = fallback->heading3;\n    set->heading2->fallback = fallback->heading2;\n    set->heading1->fallback = fallback->heading1;\n    set->huge->fallback = fallback->huge;\n}\n\nvoid app_ui_fontset_deinit(app_ui_fontset_t *set) {\n    lv_ft_font_destroy(set->small);\n    lv_ft_font_destroy(set->body);\n    lv_ft_font_destroy(set->heading3);\n    lv_ft_font_destroy(set->heading2);\n    lv_ft_font_destroy(set->heading1);\n    lv_ft_font_destroy(set->huge);\n}\n\nstatic lv_font_t *load_font(const lv_ft_info_t *info, lv_coord_t size) {\n    lv_ft_info_t ft_info = *info;\n    ft_info.font = NULL;\n    ft_info.weight = size;\n    if (!lv_ft_font_init(&ft_info)) {\n        LV_LOG_ERROR(\"Failed to load font\");\n    }\n    return ft_info.font;\n}\n\n\nstatic bool fontset_load_fc(app_ui_fontset_t *set, FcPattern *font) {\n    //The pointer stored in 'file' is tied to 'font'; therefore, when 'font' is freed, this pointer is freed automatically.\n    //If you want to return the filename of the selected font, pass a buffer and copy the file name into that buffer\n    FcChar8 *file = NULL;\n\n    if (FcPatternGetString(font, FC_FILE, 0, &file) == FcResultMatch) {\n        lv_ft_info_t ft_info = {.name = (char *) file, .style = FT_FONT_STYLE_NORMAL};\n        set->body = load_font(&ft_info, set->sizes.body);\n        set->heading1 = load_font(&ft_info, set->sizes.heading1);\n        set->heading2 = load_font(&ft_info, set->sizes.heading2);\n        set->heading3 = load_font(&ft_info, set->sizes.heading3);\n        set->small = load_font(&ft_info, set->sizes.small);\n        set->huge = load_font(&ft_info, set->sizes.huge);\n        return true;\n    }\n    return false;\n}"
  },
  {
    "path": "app/ui/app_ui_font.h",
    "content": "#pragma once\n\n#include <stdint.h>\n#include \"lvgl.h\"\n\ntypedef struct app_t app_t;\ntypedef struct app_ui_t app_ui_t;\n\ntypedef struct app_ui_font_sizes_t {\n    uint16_t heading1;\n    uint16_t heading2;\n    uint16_t heading3;\n    uint16_t small;\n    uint16_t body;\n} app_ui_font_sizes_t;\n\ntypedef struct app_ui_fontset_t {\n    struct {\n        uint16_t heading1;\n        uint16_t heading2;\n        uint16_t heading3;\n        uint16_t body;\n        uint16_t small;\n        uint16_t huge;\n    } sizes;\n    lv_font_t *heading1;\n    lv_font_t *heading2;\n    lv_font_t *heading3;\n    lv_font_t *body;\n    lv_font_t *small;\n    lv_font_t *huge;\n} app_ui_fontset_t;\n\nvoid app_ui_fontset_set_default_size(const app_ui_t *ui, app_ui_fontset_t *set);\n\nvoid app_ui_fontset_init_mem(app_ui_fontset_t *set, const char *name, const void *mem, size_t size);\n\nvoid app_ui_fontset_init_fc(app_ui_fontset_t *set, const char *name);\n\nvoid app_ui_fontset_apply_fallback(app_ui_fontset_t *set, const app_ui_fontset_t*fallback);\n\nvoid app_ui_fontset_deinit(app_ui_fontset_t *set);"
  },
  {
    "path": "app/ui/common/CMakeLists.txt",
    "content": "target_sources(ihsplay PRIVATE\n        error_messages.c\n        progress_dialog.c\n        group_utils.c\n        )"
  },
  {
    "path": "app/ui/common/error_messages.c",
    "content": "#include \"error_messages.h\"\n\nconst char *authorization_result_str(IHS_AuthorizationResult result) {\n    switch (result) {\n        case IHS_AuthorizationDenied:\n            return \"Host denied authorization\";\n        case IHS_AuthorizationNotLoggedIn:\n            return \"Not logged in\";\n        case IHS_AuthorizationOffline:\n            return \"Host is offline\";\n        case IHS_AuthorizationBusy:\n            return \"Host is busy\";\n        case IHS_AuthorizationTimedOut:\n            return \"Authorization timed out\";\n        case IHS_AuthorizationCanceled:\n            return \"Authorization cancelled\";\n        default:\n            return \"Unknown error\";\n    }\n}\n\nconst char *streaming_result_str(IHS_StreamingResult result) {\n    switch (result) {\n        case IHS_StreamingUnauthorized: {\n            return \"Unauthorized\";\n        }\n        case IHS_StreamingScreenLocked: {\n            return \"Screen is locked\";\n        }\n        case IHS_StreamingBusy: {\n            return \"Host is busy\";\n        }\n        case IHS_StreamingPINRequired: {\n            return \"PIN is not supported\";\n        }\n        case IHS_StreamingTimeout: {\n            return \"Request timed out\";\n        }\n        default: {\n            return \"Unknown error\";\n        }\n    }\n}"
  },
  {
    "path": "app/ui/common/error_messages.h",
    "content": "#pragma once\n\n#include \"ihslib.h\"\n\nconst char *authorization_result_str(IHS_AuthorizationResult result);\n\nconst char *streaming_result_str(IHS_StreamingResult result);\n"
  },
  {
    "path": "app/ui/common/group_utils.c",
    "content": "\n#include \"group_utils.h\"\n\nlv_obj_t *ui_group_first_in_parent(lv_group_t *group, lv_obj_t *parent) {\n    lv_obj_t **obj = NULL;\n    _LV_LL_READ(&group->obj_ll, obj) {\n        lv_obj_t *cur = *obj;\n        if (cur == parent) {\n            return cur;\n        }\n        while (cur != NULL) {\n            cur = lv_obj_get_parent(cur);\n            if (cur == parent) {\n                return *obj;\n            }\n        }\n    }\n    return NULL;\n}"
  },
  {
    "path": "app/ui/common/group_utils.h",
    "content": "#pragma once\n\n#include \"lvgl.h\"\n\nlv_obj_t * ui_group_first_in_parent(lv_group_t *group, lv_obj_t*parent);"
  },
  {
    "path": "app/ui/common/progress_dialog.c",
    "content": "#include \"progress_dialog.h\"\n\nlv_obj_t *progress_dialog_create(const char *message) {\n    lv_obj_t *dialog = lv_msgbox_create(NULL, NULL, NULL, NULL, false);\n    lv_obj_t *content = lv_msgbox_get_content(dialog);\n    lv_obj_set_layout(content, LV_LAYOUT_FLEX);\n    lv_obj_set_flex_flow(content, LV_FLEX_FLOW_ROW);\n    lv_obj_set_flex_align(content, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);\n    lv_obj_t *spinner = lv_spinner_create(content, 1000, 60);\n    lv_obj_set_style_arc_width(spinner, lv_dpx(10), 0);\n    lv_obj_set_style_arc_width(spinner, lv_dpx(10), LV_PART_INDICATOR);\n    lv_obj_set_size(spinner, lv_dpx(50), lv_dpx(50));\n    lv_obj_set_flex_grow(spinner, 0);\n    lv_obj_t *label = lv_label_create(content);\n    lv_obj_set_style_pad_hor(label, LV_DPX(20), 0);\n    lv_label_set_text(label, message);\n    lv_obj_set_flex_grow(label, 1);\n\n    lv_obj_center(dialog);\n    return dialog;\n}\n\nvoid progress_dialog_set_message(lv_obj_t *obj, const char *message) {\n    lv_obj_t *content = lv_msgbox_get_content(obj);\n    for (int i = (int) lv_obj_get_child_cnt(content) - 1; i >= 0; --i) {\n        lv_obj_t *child = lv_obj_get_child(content, i);\n        if (!lv_obj_check_type(child, &lv_label_class)) {\n            continue;\n        }\n        lv_label_set_text(obj, message);\n    }\n}"
  },
  {
    "path": "app/ui/common/progress_dialog.h",
    "content": "#pragma once\n\n#include \"lvgl.h\"\n\nlv_obj_t *progress_dialog_create(const char *message);\n\nvoid progress_dialog_set_message(lv_obj_t *obj, const char *message);"
  },
  {
    "path": "app/ui/connection/CMakeLists.txt",
    "content": "target_sources(ihsplay PRIVATE connection_fragment.c pin_fragment.c conn_error_fragment.c)"
  },
  {
    "path": "app/ui/connection/conn_error_fragment.c",
    "content": "#include \"conn_error_fragment.h\"\n#include \"ui/app_ui.h\"\n\ntypedef struct conn_error_fragment_t {\n    lv_fragment_t base;\n    app_t *app;\n    char *error_message;\n} conn_error_fragment_t;\n\nstatic void conn_error_ctor(lv_fragment_t *self, void *arg);\n\nstatic void conn_error_dtor(lv_fragment_t *self);\n\nstatic lv_obj_t *conn_error_create_obj(lv_fragment_t *self, lv_obj_t *container);\n\nstatic void conn_error_obj_created(lv_fragment_t *self, lv_obj_t *obj);\n\nconst lv_fragment_class_t conn_error_fragment_class = {\n        .constructor_cb = conn_error_ctor,\n        .destructor_cb = conn_error_dtor,\n        .create_obj_cb = conn_error_create_obj,\n        .obj_created_cb = conn_error_obj_created,\n        .instance_size = sizeof(conn_error_fragment_t)\n};\n\nstatic void conn_error_ctor(lv_fragment_t *self, void *arg) {\n    conn_error_fragment_t *fragment = (conn_error_fragment_t *) self;\n    app_ui_fragment_args_t *args = arg;\n    fragment->app = args->app;\n    conn_error_fragment_data *data = args->data;\n    fragment->error_message = strdup(data->message);\n}\n\nstatic void conn_error_dtor(lv_fragment_t *self) {\n    conn_error_fragment_t *fragment = (conn_error_fragment_t *) self;\n    free(fragment->error_message);\n}\n\nstatic lv_obj_t *conn_error_create_obj(lv_fragment_t *self, lv_obj_t *container) {\n    conn_error_fragment_t *fragment = (conn_error_fragment_t *) self;\n    lv_obj_t *obj = lv_obj_create(container);\n    lv_obj_set_style_pad_gap(obj, LV_DPX(10), 0);\n    lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_COLUMN);\n    lv_obj_set_flex_align(obj, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);\n\n    lv_obj_t *conn_error_label = lv_label_create(obj);\n    lv_label_set_text(conn_error_label, fragment->error_message);\n    return obj;\n}\n\nstatic void conn_error_obj_created(lv_fragment_t *self, lv_obj_t *obj) {\n}"
  },
  {
    "path": "app/ui/connection/conn_error_fragment.h",
    "content": "#pragma once\n\n#include \"lvgl.h\"\n\ntypedef struct conn_error_fragment_data {\n    const char *message;\n} conn_error_fragment_data;\n\nextern const lv_fragment_class_t conn_error_fragment_class;"
  },
  {
    "path": "app/ui/connection/connection_fragment.c",
    "content": "#include \"connection_fragment.h\"\n\n#include \"backend/host_manager.h\"\n\n#include \"lvgl/theme.h\"\n#include \"ui/app_ui.h\"\n#include \"ui/common/error_messages.h\"\n#include \"ui/session/session.h\"\n#include \"util/random.h\"\n#include \"pin_fragment.h\"\n#include \"conn_error_fragment.h\"\n\n\ntypedef struct connection_fragment_t {\n    lv_fragment_t base;\n    app_t *app;\n    IHS_HostInfo host;\n    lv_obj_t *content;\n    lv_obj_t *title;\n} connection_fragment_t;\n\nstatic void conn_ctor(lv_fragment_t *self, void *arg);\n\nstatic lv_obj_t *conn_create_obj(lv_fragment_t *self, lv_obj_t *container);\n\nstatic void conn_obj_created(lv_fragment_t *self, lv_obj_t *obj);\n\nstatic void conn_obj_will_del(lv_fragment_t *self, lv_obj_t *obj);\n\nstatic void session_started(const IHS_HostInfo *host, const IHS_SessionInfo *info, void *context);\n\nstatic void session_start_failed(const IHS_HostInfo *host, IHS_StreamingResult result, void *context);\n\nstatic void authorized(const IHS_HostInfo *host, uint64_t steam_id, void *context);\n\nstatic void authorization_failed(const IHS_HostInfo *host, IHS_AuthorizationResult result, void *context);\n\nstatic void open_authorization(connection_fragment_t *fragment, const IHS_HostInfo *info);\n\nstatic void conn_show_page(connection_fragment_t *fragment, const lv_fragment_class_t *cls, void *data);\n\nconst lv_fragment_class_t connection_fragment_class = {\n        .constructor_cb = conn_ctor,\n        .create_obj_cb = conn_create_obj,\n        .obj_created_cb = conn_obj_created,\n        .obj_will_delete_cb = conn_obj_will_del,\n        .instance_size = sizeof(connection_fragment_t)\n};\n\nstatic const host_manager_listener_t conn_host_listener = {\n        .session_started = session_started,\n        .session_start_failed = session_start_failed,\n        .authorized = authorized,\n        .authorization_failed = authorization_failed,\n};\n\nstatic void conn_ctor(lv_fragment_t *self, void *arg) {\n    connection_fragment_t *fragment = (connection_fragment_t *) self;\n    app_ui_fragment_args_t *args = arg;\n    fragment->app = args->app;\n    fragment->host = (*(IHS_HostInfo *) args->data);\n    free(args->data);\n}\n\nstatic lv_obj_t *conn_create_obj(lv_fragment_t *self, lv_obj_t *container) {\n    connection_fragment_t *fragment = (connection_fragment_t *) self;\n    lv_obj_t *win = app_lv_win_create(container);\n    fragment->title = lv_win_add_title(win, \"Connecting\");\n    fragment->content = lv_win_get_content(win);\n    return win;\n}\n\nstatic void conn_obj_created(lv_fragment_t *self, lv_obj_t *obj) {\n    connection_fragment_t *fragment = (connection_fragment_t *) self;\n    host_manager_t *hosts_manager = fragment->app->host_manager;\n    host_manager_register_listener(hosts_manager, &conn_host_listener, fragment);\n    host_manager_session_request(hosts_manager, &fragment->host);\n}\n\nstatic void conn_obj_will_del(lv_fragment_t *self, lv_obj_t *obj) {\n    connection_fragment_t *fragment = (connection_fragment_t *) self;\n    host_manager_t *hosts_manager = fragment->app->host_manager;\n    host_manager_unregister_listener(hosts_manager, &conn_host_listener);\n}\n\nvoid connection_fragment_set_title(lv_fragment_t *self, const char *title) {\n    connection_fragment_t *fragment = (connection_fragment_t *) self;\n    lv_label_set_text(fragment->title, title);\n}\n\nstatic void session_started(const IHS_HostInfo *host, const IHS_SessionInfo *info, void *context) {\n    connection_fragment_t *fragment = (connection_fragment_t *) context;\n    session_fragment_args_t args = {\n            .host = *host,\n            .session = *info,\n    };\n    app_ui_push_fragment(fragment->app->ui, &session_fragment_class, &args);\n    app_ui_remove_fragment(fragment->app->ui, (lv_fragment_t *) fragment);\n}\n\nstatic void session_start_failed(const IHS_HostInfo *host, IHS_StreamingResult result, void *context) {\n    connection_fragment_t *fragment = (connection_fragment_t *) context;\n    if (result == IHS_StreamingUnauthorized) {\n        open_authorization(fragment, host);\n    } else {\n        conn_error_fragment_data data = {\n                .message = streaming_result_str(result),\n        };\n        conn_show_page(fragment, &conn_error_fragment_class, &data);\n    }\n}\n\nstatic void authorized(const IHS_HostInfo *host, uint64_t steam_id, void *context) {\n    (void) host;\n    (void) steam_id;\n    connection_fragment_t *fragment = (connection_fragment_t *) context;\n    // TODO Hide authorization UI\n    // TODO Performance test?\n    host_manager_t *hosts_manager = fragment->app->host_manager;\n    host_manager_session_request(hosts_manager, &fragment->host);\n}\n\nstatic void authorization_failed(const IHS_HostInfo *host, IHS_AuthorizationResult result, void *context) {\n    (void) host;\n    connection_fragment_t *fragment = (connection_fragment_t *) context;\n    conn_error_fragment_data data = {\n            .message = authorization_result_str(result),\n    };\n    conn_show_page(fragment, &conn_error_fragment_class, &data);\n}\n\nstatic void open_authorization(connection_fragment_t *fragment, const IHS_HostInfo *info) {\n    char pin[8];\n    random_pin(pin);\n    host_manager_authorization_request(fragment->app->host_manager, info, pin);\n    conn_show_page(fragment, &pin_fragment_class, pin);\n}\n\nstatic void conn_show_page(connection_fragment_t *fragment, const lv_fragment_class_t *cls, void *data) {\n    lv_fragment_t *pin_fragment = app_ui_create_fragment(fragment->app->ui, cls, data);\n    lv_fragment_manager_replace(fragment->base.child_manager, pin_fragment, &fragment->content);\n    lv_obj_set_size(pin_fragment->obj, LV_PCT(100), LV_PCT(100));\n}"
  },
  {
    "path": "app/ui/connection/connection_fragment.h",
    "content": "#pragma once\n\n#include \"lvgl.h\"\n\nextern const lv_fragment_class_t connection_fragment_class;\n\nvoid connection_fragment_set_title(lv_fragment_t *self, const char *title);\n"
  },
  {
    "path": "app/ui/connection/pin_fragment.c",
    "content": "#include \"pin_fragment.h\"\n#include \"ui/app_ui.h\"\n#include \"connection_fragment.h\"\n\ntypedef struct pin_fragment_t {\n    lv_fragment_t base;\n    app_t *app;\n    char pin[8];\n} pin_fragment_t;\n\nstatic void pin_ctor(lv_fragment_t *self, void *arg);\n\nstatic lv_obj_t *pin_create_obj(lv_fragment_t *self, lv_obj_t *container);\n\nstatic void pin_obj_created(lv_fragment_t *self, lv_obj_t *obj);\n\nconst lv_fragment_class_t pin_fragment_class = {\n        .constructor_cb = pin_ctor,\n        .create_obj_cb = pin_create_obj,\n        .obj_created_cb = pin_obj_created,\n        .instance_size = sizeof(pin_fragment_t)\n};\n\nstatic void pin_ctor(lv_fragment_t *self, void *arg) {\n    pin_fragment_t *fragment = (pin_fragment_t *) self;\n    app_ui_fragment_args_t *args = arg;\n    fragment->app = args->app;\n    strncpy(fragment->pin, args->data, sizeof(fragment->pin) - 1);\n}\n\nstatic lv_obj_t *pin_create_obj(lv_fragment_t *self, lv_obj_t *container) {\n    pin_fragment_t *fragment = (pin_fragment_t *) self;\n    lv_obj_t *obj = lv_obj_create(container);\n    lv_obj_set_style_pad_gap(obj, LV_DPX(10), 0);\n    lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_COLUMN);\n    lv_obj_set_flex_align(obj, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);\n\n    lv_obj_t *pin_label = lv_label_create(obj);\n    lv_obj_set_style_text_font(pin_label, fragment->app->ui->font.huge, 0);\n    lv_label_set_text(pin_label, fragment->pin);\n\n    lv_obj_t *hint1 = lv_label_create(obj);\n    lv_label_set_text(hint1, \"Input PIN above on the computer to pair with this device\");\n    return obj;\n}\n\nstatic void pin_obj_created(lv_fragment_t *self, lv_obj_t *obj) {\n    lv_fragment_t *parent = lv_fragment_get_parent(self);\n    connection_fragment_set_title(parent, \"Pairing\");\n}"
  },
  {
    "path": "app/ui/connection/pin_fragment.h",
    "content": "#pragma once\n\n#include \"lvgl.h\"\n\nextern const lv_fragment_class_t pin_fragment_class;"
  },
  {
    "path": "app/ui/hosts/hosts_fragment.c",
    "content": "#include \"hosts_fragment.h\"\n\n#include \"app.h\"\n#include \"backend/host_manager.h\"\n#include \"lv_gridview.h\"\n#include \"ui/app_ui.h\"\n#include \"ui/session/session.h\"\n#include \"array_list.h\"\n#include \"lvgl/fonts/bootstrap-icons/symbols.h\"\n#include \"util/random.h\"\n#include \"lvgl/ext/msgbox_ext.h\"\n#include \"ui/common/error_messages.h\"\n#include \"logging.h\"\n#include \"lvgl/theme.h\"\n#include \"ui/launcher.h\"\n\ntypedef struct hosts_fragment {\n    lv_fragment_t base;\n    app_t *app;\n    lv_fragment_t *launcher_fragment;\n    lv_obj_t *grid_view;\n    lv_obj_t *msgbox;\n} hosts_fragment;\n\ntypedef struct host_obj_holder {\n    lv_obj_t *icon;\n    lv_obj_t *os_icon;\n    lv_obj_t *name;\n} host_obj_holder;\n\nstatic void constructor(lv_fragment_t *self, void *arg);\n\nstatic void destructor(lv_fragment_t *self);\n\nstatic lv_obj_t *create_obj(lv_fragment_t *self, lv_obj_t *container);\n\nstatic void obj_created(lv_fragment_t *self, lv_obj_t *obj);\n\nstatic void obj_will_delete(lv_fragment_t *self, lv_obj_t *obj);\n\nstatic void obj_deleted(lv_fragment_t *self, lv_obj_t *obj);\n\nstatic bool event_cb(lv_fragment_t *self, int code, void *data);\n\nstatic void hosts_changed(array_list_t *list, host_manager_hosts_change change_type, int change_index, void *context);\n\nstatic int host_item_count(lv_obj_t *grid, void *data);\n\nstatic lv_obj_t *host_item_create(lv_obj_t *grid);\n\nstatic void host_item_delete(lv_event_t *e);\n\nstatic void host_item_clicked(lv_event_t *e);\n\nstatic void size_changed_cb(lv_event_t *e);\n\nstatic void grid_focused(lv_event_t *e);\n\nstatic void grid_unfocused(lv_event_t *e);\n\nstatic void grid_key_cb(lv_event_t *e);\n\nstatic void host_item_bind(lv_obj_t *grid, lv_obj_t *item_view, void *data, int position);\n\nstatic void grid_size_populate(hosts_fragment *fragment);\n\nstatic lv_obj_t *open_msgbox(hosts_fragment *fragment, const char *title, const char *message, const char *btns[]);\n\nstatic void close_msgbox(hosts_fragment *fragment);\n\nstatic void msgbox_confirm_cb(lv_event_t *e);\n\nstatic void msgbox_del_cb(lv_event_t *e);\n\nstatic void authorization_cancel_cb(lv_event_t *e);\n\nconst lv_fragment_class_t hosts_fragment_class = {\n        .constructor_cb = constructor,\n        .destructor_cb = destructor,\n        .create_obj_cb = create_obj,\n        .obj_created_cb = obj_created,\n        .obj_will_delete_cb = obj_will_delete,\n        .obj_deleted_cb = obj_deleted,\n        .event_cb = event_cb,\n        .instance_size = sizeof(hosts_fragment),\n};\n\nstatic const host_manager_listener_t host_manager_listener = {\n        .hosts_changed = hosts_changed,\n};\n\nstatic const lv_gridview_adapter_t hosts_adapter = {\n        .item_count = host_item_count,\n        .create_view = host_item_create,\n        .bind_view = host_item_bind,\n};\n\nvoid hosts_fragment_focus_hosts(lv_fragment_t *self) {\n    if (self->cls != &hosts_fragment_class) {\n        return;\n    }\n    hosts_fragment *fragment = (hosts_fragment *) self;\n    lv_group_focus_obj(fragment->grid_view);\n    lv_gridview_focus_when_available(fragment->grid_view, 0);\n}\n\nstatic void constructor(lv_fragment_t *self, void *arg) {\n    hosts_fragment *fragment = (hosts_fragment *) self;\n    app_ui_fragment_args_t *args = arg;\n    fragment->app = args->app;\n    fragment->launcher_fragment = args->data;\n}\n\nstatic void destructor(lv_fragment_t *self) {\n    LV_UNUSED(self);\n}\n\nstatic lv_obj_t *create_obj(lv_fragment_t *self, lv_obj_t *container) {\n    hosts_fragment *fragment = (hosts_fragment *) self;\n    lv_obj_t *win = app_lv_win_create(container);\n    lv_win_add_title(win, \"Select Computer\");\n\n    lv_obj_t *content = lv_win_get_content(win);\n    lv_obj_set_style_pad_hor(content, 0, 0);\n\n    fragment->grid_view = lv_gridview_create(content);\n    lv_obj_set_size(fragment->grid_view, LV_PCT(100), LV_PCT(100));\n    lv_obj_update_layout(fragment->grid_view);\n\n    lv_obj_set_user_data(fragment->grid_view, fragment);\n    lv_obj_set_style_pad_bottom(fragment->grid_view, LV_DPX(30), 0);\n    lv_obj_set_style_pad_hor(fragment->grid_view, LV_DPX(30), 0);\n    lv_obj_set_style_pad_gap(fragment->grid_view, LV_DPX(15), 0);\n    lv_obj_set_style_pad_right(fragment->grid_view, LV_DPX(13), LV_PART_SCROLLBAR);\n    lv_gridview_set_adapter(fragment->grid_view, &hosts_adapter);\n\n    grid_size_populate(fragment);\n    lv_obj_add_event_cb(fragment->grid_view, size_changed_cb, LV_EVENT_SIZE_CHANGED, fragment);\n    lv_obj_add_event_cb(fragment->grid_view, host_item_clicked, LV_EVENT_CLICKED, fragment);\n    lv_obj_add_event_cb(fragment->grid_view, grid_focused, LV_EVENT_FOCUSED, fragment);\n    lv_obj_add_event_cb(fragment->grid_view, grid_unfocused, LV_EVENT_DEFOCUSED, fragment);\n    lv_obj_add_event_cb(fragment->grid_view, grid_key_cb, LV_EVENT_KEY, fragment);\n\n    return win;\n}\n\nstatic void obj_created(lv_fragment_t *self, lv_obj_t *obj) {\n    LV_UNUSED(obj);\n    hosts_fragment *fragment = (hosts_fragment *) self;\n    host_manager_t *hosts_manager = fragment->app->host_manager;\n    host_manager_register_listener(hosts_manager, &host_manager_listener, fragment);\n    lv_gridview_set_data(fragment->grid_view, host_manager_get_hosts(hosts_manager));\n    lv_group_t *group = app_ui_get_input_group(fragment->app->ui);\n    if (group != NULL && lv_group_get_focused(group) == NULL) {\n        hosts_fragment_focus_hosts(self);\n    }\n\n    host_manager_discovery_start(hosts_manager);\n}\n\nstatic void obj_will_delete(lv_fragment_t *self, lv_obj_t *obj) {\n    LV_UNUSED(obj);\n    hosts_fragment *fragment = (hosts_fragment *) self;\n    host_manager_discovery_stop(fragment->app->host_manager);\n}\n\nstatic void obj_deleted(lv_fragment_t *self, lv_obj_t *obj) {\n    LV_UNUSED(obj);\n    hosts_fragment *fragment = (hosts_fragment *) self;\n    host_manager_unregister_listener(fragment->app->host_manager, &host_manager_listener);\n}\n\nstatic void hosts_changed(array_list_t *list, host_manager_hosts_change change_type, int change_index, void *context) {\n    hosts_fragment *fragment = (hosts_fragment *) context;\n    lv_obj_t *grid = fragment->grid_view;\n    switch (change_type) {\n        case HOST_MANAGER_HOSTS_NEW: {\n            lv_gridview_data_change_t changes[] = {\n                    {.start = change_index, .remove_count = 0, .add_count = 1}\n            };\n            lv_gridview_set_data_advanced(grid, list, changes, 1);\n            break;\n        }\n        case HOST_MANAGER_HOSTS_UPDATE: {\n            lv_gridview_data_change_t changes[] = {\n                    {.start = change_index, .remove_count = 1, .add_count = 1}\n            };\n            lv_gridview_set_data_advanced(grid, list, changes, 1);\n            break;\n        }\n    }\n}\n\nstatic lv_obj_t *open_msgbox(hosts_fragment *fragment, const char *title, const char *message, const char *btns[]) {\n    close_msgbox(fragment);\n    lv_obj_t *mbox = lv_msgbox_create(NULL, title, message, btns, false);\n    msgbox_fix_sizes(mbox, btns);\n    lv_obj_add_event_cb(mbox, msgbox_del_cb, LV_EVENT_DELETE, fragment);\n    lv_obj_center(mbox);\n    return fragment->msgbox = mbox;\n}\n\nstatic void close_msgbox(hosts_fragment *fragment) {\n    if (fragment->msgbox == NULL) {\n        return;\n    }\n    lv_msgbox_close(fragment->msgbox);\n    fragment->msgbox = NULL;\n}\n\nstatic void msgbox_confirm_cb(lv_event_t *e) {\n    lv_obj_t *mbox = lv_event_get_current_target(e);\n    lv_event_stop_processing(e);\n    lv_msgbox_close(mbox);\n}\n\nstatic void msgbox_del_cb(lv_event_t *e) {\n    hosts_fragment *fragment = lv_event_get_user_data(e);\n    if (lv_event_get_current_target(e) != fragment->msgbox) {\n        return;\n    }\n    fragment->msgbox = NULL;\n}\n\nstatic void authorization_cancel_cb(lv_event_t *e) {\n    hosts_fragment *fragment = lv_event_get_user_data(e);\n    lv_obj_t *mbox = lv_event_get_current_target(e);\n    lv_event_stop_processing(e);\n    lv_msgbox_close(mbox);\n    host_manager_authorization_cancel(fragment->app->host_manager);\n}\n\nstatic int host_item_count(lv_obj_t *grid, void *data) {\n    LV_UNUSED(grid);\n    return array_list_size(data);\n}\n\nstatic lv_obj_t *host_item_create(lv_obj_t *grid) {\n    hosts_fragment *fragment = lv_obj_get_user_data(grid);\n    lv_obj_t *item_view = lv_btn_create(grid);\n    lv_group_remove_obj(item_view);\n    lv_obj_set_style_radius(item_view, 0, 0);\n    lv_obj_set_layout(item_view, LV_LAYOUT_FLEX);\n    lv_obj_set_flex_flow(item_view, LV_FLEX_FLOW_COLUMN);\n    lv_obj_set_flex_align(item_view, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);\n    host_obj_holder *holder = malloc(sizeof(host_obj_holder));\n    item_view->user_data = holder;\n\n    holder->icon = lv_obj_create(item_view);\n    lv_obj_remove_style_all(holder->icon);\n    lv_obj_clear_flag(holder->icon, LV_OBJ_FLAG_CLICKABLE);\n    lv_obj_set_size(holder->icon, LV_DPX(128), LV_DPX(128));\n    lv_obj_set_style_text_font(holder->icon, fragment->app->ui->iconfont.huge, 0);\n    lv_obj_set_style_bg_color(holder->icon, lv_color_white(), 0);\n    lv_obj_set_style_bg_opa(holder->icon, LV_OPA_30, 0);\n    lv_obj_set_style_radius(holder->icon, LV_RADIUS_CIRCLE, 0);\n    lv_obj_set_style_bg_img_src(holder->icon, BS_SYMBOL_DISPLAY, 0);\n\n    holder->os_icon = lv_obj_create(holder->icon);\n    lv_obj_remove_style_all(holder->os_icon);\n    lv_obj_clear_flag(holder->os_icon, LV_OBJ_FLAG_CLICKABLE);\n    lv_obj_set_size(holder->os_icon, LV_DPX(40), LV_DPX(40));\n    lv_obj_set_style_text_font(holder->os_icon, fragment->app->ui->iconfont.heading2, 0);\n    lv_obj_align(holder->os_icon, LV_ALIGN_CENTER, 0, -LV_DPX(4));\n\n    holder->name = lv_label_create(item_view);\n    lv_obj_add_event_cb(item_view, host_item_delete, LV_EVENT_DELETE, NULL);\n    lv_obj_set_size(item_view, LV_SIZE_CONTENT, LV_SIZE_CONTENT);\n    lv_obj_add_flag(item_view, LV_OBJ_FLAG_EVENT_BUBBLE);\n    return item_view;\n}\n\nstatic void host_item_delete(lv_event_t *e) {\n    free(lv_event_get_current_target(e)->user_data);\n}\n\nstatic void host_item_bind(lv_obj_t *grid, lv_obj_t *item_view, void *data, int position) {\n    LV_UNUSED(grid);\n    host_obj_holder *holder = item_view->user_data;\n    IHS_HostInfo *item = array_list_get(data, position);\n    lv_label_set_text(holder->name, item->hostname);\n    if (item->ostype >= IHS_SteamOSTypeWindows) {\n        lv_obj_set_style_bg_img_src(holder->os_icon, BS_SYMBOL_WINDOWS, 0);\n    } else if (item->ostype >= IHS_SteamOSTypeMacos && item->ostype < IHS_SteamOSTypeUnknown) {\n        lv_obj_set_style_bg_img_src(holder->os_icon, BS_SYMBOL_APPLE, 0);\n    } else {\n        lv_obj_set_style_bg_img_src(holder->os_icon, LV_SYMBOL_DUMMY, 0);\n    }\n}\n\nstatic void grid_size_populate(hosts_fragment *fragment) {\n    lv_coord_t content_width = lv_obj_get_content_width(fragment->grid_view);\n    int col_count = 5;\n    if (content_width > 0) {\n        lv_coord_t pad_column = lv_obj_get_style_pad_column(fragment->grid_view, 0);\n        col_count = (content_width + pad_column) / (LV_DPX(150) + pad_column);\n    }\n    lv_gridview_set_config(fragment->grid_view, col_count, LV_DPX(200), LV_GRID_ALIGN_STRETCH,\n                           LV_GRID_ALIGN_STRETCH);\n}\n\nstatic void host_item_clicked(lv_event_t *e) {\n    hosts_fragment *fragment = e->user_data;\n    lv_obj_t *target = lv_event_get_target(e);\n    lv_obj_t *grid = fragment->grid_view;\n    if (target->parent != grid) return;\n    int index = lv_gridview_get_item_data_index(grid, target);\n    if (index < 0) return;\n    const IHS_HostInfo *item = array_list_get(lv_gridview_get_data(grid), index);\n    launcher_fragment_set_selected_host(fragment->launcher_fragment, item->clientId);\n\n    app_ui_pop_top_fragment(fragment->app->ui);\n}\n\nstatic void size_changed_cb(lv_event_t *e) {\n    hosts_fragment *fragment = e->user_data;\n    grid_size_populate(fragment);\n}\n\nstatic void grid_focused(lv_event_t *e) {\n    if (e->target == e->current_target) {\n        array_list_t *data = lv_gridview_get_data(e->target);\n        if (data == NULL || array_list_size(data) == 0) {\n            return;\n        }\n        lv_gridview_focus(e->target, 0);\n    } else {\n        int index = lv_gridview_get_focused_index(e->current_target);\n        if (index >= 0) {\n            lv_obj_t *item_view = lv_gridview_get_item_view(e->current_target, index);\n            if (item_view != NULL && lv_obj_has_state(item_view, LV_STATE_FOCUSED)) {\n                lv_obj_add_state(item_view, LV_STATE_FOCUS_KEY);\n            }\n        }\n    }\n}\n\nstatic void grid_unfocused(lv_event_t *e) {\n    if (e->target != e->current_target) return;\n    lv_gridview_focus(e->target, -1);\n}\n\nstatic void grid_key_cb(lv_event_t *e) {\n    if (e->target != e->current_target || e->stop_processing) return;\n    switch (lv_event_get_key(e)) {\n        case LV_KEY_UP: {\n            lv_group_focus_prev(lv_group_get_default());\n            break;\n        }\n    }\n}\n\nstatic bool event_cb(lv_fragment_t *self, int code, void *data) {\n    (void) data;\n    hosts_fragment *fragment = (hosts_fragment *) self;\n    if (code == APP_UI_NAV_BACK) {\n        app_ui_pop_top_fragment(fragment->app->ui);\n        return true;\n    }\n    return false;\n}\n"
  },
  {
    "path": "app/ui/hosts/hosts_fragment.h",
    "content": "#pragma once\n\n#include <lvgl.h>\n\nextern const lv_fragment_class_t hosts_fragment_class;\n\nvoid hosts_fragment_focus_hosts(lv_fragment_t *self);"
  },
  {
    "path": "app/ui/launcher.c",
    "content": "#include <assert.h>\n#include \"app.h\"\n#include \"app_ui.h\"\n#include \"config.h\"\n\n#include \"launcher.h\"\n\n#include \"hosts/hosts_fragment.h\"\n#include \"settings/settings.h\"\n#include \"support/support.h\"\n\n#include \"lvgl/fonts/bootstrap-icons/symbols.h\"\n\n\n#include \"backend/host_manager.h\"\n#include \"array_list.h\"\n#include \"lvgl/ext/lv_dir_focus.h\"\n#include \"lvgl/theme.h\"\n#include \"ui/connection/connection_fragment.h\"\n#include \"backend/input_manager.h\"\n\ntypedef struct launcher_fragment {\n    lv_fragment_t base;\n    app_t *app;\n    lv_coord_t row_dsc[5], col_dsc[4];\n    struct {\n        lv_style_t root;\n        lv_style_t option_icon;\n    } styles;\n    lv_obj_t *nav_content;\n    lv_obj_t *selected_host;\n    lv_obj_t *gamepads;\n\n    uint64_t selected_host_id;\n\n    int num_launch_options;\n} launcher_fragment;\n\nstatic void constructor(lv_fragment_t *self, void *arg);\n\nstatic void destructor(lv_fragment_t *self);\n\nstatic lv_obj_t *create_obj(lv_fragment_t *self, lv_obj_t *container);\n\nstatic void obj_created(lv_fragment_t *self, lv_obj_t *obj);\n\nstatic void obj_will_delete(lv_fragment_t *self, lv_obj_t *obj);\n\nstatic void obj_deleted(lv_fragment_t *self, lv_obj_t *obj);\n\nstatic void hosts_changed(array_list_t *list, host_manager_hosts_change change_type, int change_index, void *context);\n\nstatic void launcher_gamepads_changed(launcher_fragment *fragment);;\n\nstatic bool event_cb(lv_fragment_t *self, int type, void *data);\n\nstatic lv_obj_t *launch_option_create_label_action(launcher_fragment *fragment, const char *icon, const char *label);\n\nstatic lv_obj_t *launch_option_get_label(lv_obj_t *obj);\n\nstatic void launch_option_set_text(lv_obj_t *obj, const char *label);\n\nstatic void focus_content(lv_event_t *e);\n\nstatic void open_settings(lv_event_t *e);\n\nstatic void open_support(lv_event_t *e);\n\nstatic void select_host(lv_event_t *e);\n\nstatic void request_session(lv_event_t *e);\n\nstatic void launcher_quit(lv_event_t *e);\n\nstatic void hosts_update(launcher_fragment *fragment);\n\nstatic const IHS_HostInfo *get_selected_host(launcher_fragment *fragment);\n\nconst lv_fragment_class_t launcher_fragment_class = {\n        .constructor_cb = constructor,\n        .destructor_cb = destructor,\n        .create_obj_cb = create_obj,\n        .obj_created_cb = obj_created,\n        .obj_will_delete_cb = obj_will_delete,\n        .obj_deleted_cb = obj_deleted,\n        .event_cb = event_cb,\n        .instance_size = sizeof(launcher_fragment),\n};\n\nstatic const host_manager_listener_t host_manager_listener = {\n        .hosts_changed = hosts_changed,\n};\n\nstatic void constructor(lv_fragment_t *self, void *arg) {\n    app_ui_fragment_args_t *fargs = arg;\n    launcher_fragment *fragment = (launcher_fragment *) self;\n    fragment->app = fargs->app;\n    fragment->col_dsc[0] = LV_DPX(250);\n    fragment->col_dsc[1] = LV_DPX(350);\n    fragment->col_dsc[2] = LV_GRID_TEMPLATE_LAST;\n    fragment->row_dsc[0] = LV_DPX(40);\n    fragment->row_dsc[1] = LV_DPX(40);\n    fragment->row_dsc[2] = LV_DPX(40);\n    fragment->row_dsc[3] = LV_GRID_FR(1);\n    fragment->row_dsc[4] = LV_GRID_TEMPLATE_LAST;\n\n    lv_style_init(&fragment->styles.root);\n    lv_style_set_pad_gap(&fragment->styles.root, LV_DPX(10));\n    lv_style_set_pad_hor(&fragment->styles.root, 0);\n    lv_style_set_pad_top(&fragment->styles.root, LV_DPX(40));\n    lv_style_set_pad_bottom(&fragment->styles.root, 0);\n\n    lv_style_init(&fragment->styles.option_icon);\n    lv_style_set_text_font(&fragment->styles.option_icon, fragment->app->ui->font.heading3);\n    lv_style_set_translate_y(&fragment->styles.option_icon, LV_DPX(4));\n}\n\nstatic void destructor(lv_fragment_t *self) {\n    launcher_fragment *fragment = (launcher_fragment *) self;\n    lv_style_reset(&fragment->styles.option_icon);\n    lv_style_reset(&fragment->styles.root);\n}\n\nstatic lv_obj_t *create_obj(lv_fragment_t *self, lv_obj_t *container) {\n    launcher_fragment *fragment = (launcher_fragment *) self;\n    fragment->num_launch_options = 0;\n    lv_obj_t *win = app_lv_win_create(container);\n\n    lv_win_add_title(win, \"IHSplay\");\n\n//    lv_obj_add_event_cb(actions, focus_content, LV_EVENT_KEY, fragment);\n    lv_obj_add_event_cb(lv_win_get_header(win), focus_content, LV_EVENT_KEY, fragment);\n\n    lv_obj_t *btn_settings = lv_win_add_btn(win, BS_SYMBOL_GEAR_FILL, LV_DPX(40));\n    lv_obj_add_event_cb(btn_settings, open_settings, LV_EVENT_CLICKED, fragment);\n    lv_obj_add_flag(btn_settings, LV_OBJ_FLAG_EVENT_BUBBLE);\n#if !IHSPLAY_WIP_FEATURES\n    lv_obj_add_flag(btn_settings, LV_OBJ_FLAG_HIDDEN);\n#endif\n\n    lv_obj_t *btn_support = lv_win_add_btn(win, BS_SYMBOL_QUESTION_CIRCLE_FILL, LV_DPX(40));\n    lv_obj_add_event_cb(btn_support, open_support, LV_EVENT_CLICKED, fragment);\n    lv_obj_add_flag(btn_support, LV_OBJ_FLAG_EVENT_BUBBLE);\n\n    lv_obj_t *btn_quit = lv_win_add_btn(win, BS_SYMBOL_X_LG, LV_DPX(40));\n    lv_obj_add_event_cb(btn_quit, launcher_quit, LV_EVENT_CLICKED, fragment->app);\n    lv_obj_add_flag(btn_quit, LV_OBJ_FLAG_EVENT_BUBBLE);\n\n    lv_obj_t *nav_content = lv_win_get_content(win);\n    lv_obj_add_event_cb(nav_content, focus_content, LV_EVENT_KEY, fragment);\n    fragment->nav_content = nav_content;\n\n    lv_obj_set_layout(nav_content, LV_LAYOUT_GRID);\n    lv_obj_set_grid_dsc_array(nav_content, fragment->col_dsc, fragment->row_dsc);\n    lv_obj_set_style_pad_gap(nav_content, LV_DPX(20), 0);\n\n    lv_obj_t *btn_play = lv_btn_create(nav_content);\n    lv_obj_add_flag(btn_play, LV_OBJ_FLAG_EVENT_BUBBLE);\n    lv_obj_set_size(btn_play, LV_SIZE_CONTENT, LV_DPX(180));\n    lv_obj_set_flex_flow(btn_play, LV_FLEX_FLOW_COLUMN);\n    lv_obj_set_flex_align(btn_play, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);\n    lv_obj_set_grid_cell(btn_play, LV_GRID_ALIGN_STRETCH, 0, 1, LV_GRID_ALIGN_START, 0, 4);\n\n    lv_obj_t *img_play = lv_label_create(btn_play);\n    lv_obj_set_style_text_font(img_play, fragment->app->ui->iconfont.heading1, 0);\n    lv_label_set_text_static(img_play, BS_SYMBOL_PLAY_CIRCLE_FILL);\n    lv_obj_t *label_play = lv_label_create(btn_play);\n    lv_label_set_text(label_play, \"Start Streaming\");\n\n    lv_obj_add_event_cb(btn_play, request_session, LV_EVENT_CLICKED, fragment);\n\n    lv_obj_t *selected_host = launch_option_create_label_action(fragment, BS_SYMBOL_DISPLAY, NULL);\n    fragment->selected_host = selected_host;\n\n    lv_obj_add_event_cb(selected_host, select_host, LV_EVENT_CLICKED, fragment);\n\n    lv_obj_t *gamepads = launch_option_create_label_action(fragment, BS_SYMBOL_CONTROLLER, NULL);\n    fragment->gamepads = gamepads;\n\n    lv_obj_set_dir_focus_obj(btn_settings, LV_DIR_RIGHT, btn_support);\n    lv_obj_set_dir_focus_obj(btn_settings, LV_DIR_BOTTOM, btn_play);\n    lv_obj_set_dir_focus_obj(btn_support, LV_DIR_RIGHT, btn_quit);\n    lv_obj_set_dir_focus_obj(btn_support, LV_DIR_LEFT, btn_settings);\n    lv_obj_set_dir_focus_obj(btn_support, LV_DIR_BOTTOM, btn_play);\n    lv_obj_set_dir_focus_obj(btn_quit, LV_DIR_LEFT, btn_support);\n    lv_obj_set_dir_focus_obj(btn_quit, LV_DIR_BOTTOM, btn_play);\n\n    lv_obj_set_dir_focus_obj(btn_play, LV_DIR_TOP, btn_settings);\n    lv_obj_set_dir_focus_obj(btn_play, LV_DIR_RIGHT, selected_host);\n\n    lv_obj_set_dir_focus_obj(selected_host, LV_DIR_LEFT, btn_play);\n    lv_obj_set_dir_focus_obj(selected_host, LV_DIR_TOP, btn_settings);\n    lv_obj_set_dir_focus_obj(selected_host, LV_DIR_BOTTOM, gamepads);\n\n    lv_obj_set_dir_focus_obj(gamepads, LV_DIR_LEFT, btn_play);\n    lv_obj_set_dir_focus_obj(gamepads, LV_DIR_TOP, selected_host);\n\n    return win;\n}\n\nstatic void obj_created(lv_fragment_t *self, lv_obj_t *obj) {\n    launcher_fragment *fragment = (launcher_fragment *) self;\n\n    hosts_update(fragment);\n    host_manager_t *hosts_manager = fragment->app->host_manager;\n    host_manager_register_listener(hosts_manager, &host_manager_listener, fragment);\n    host_manager_discovery_start(hosts_manager);\n\n    hosts_update(fragment);\n    launcher_gamepads_changed(fragment);\n}\n\nstatic void obj_will_delete(lv_fragment_t *self, lv_obj_t *obj) {\n    launcher_fragment *fragment = (launcher_fragment *) self;\n    host_manager_discovery_stop(fragment->app->host_manager);\n    host_manager_unregister_listener(fragment->app->host_manager, &host_manager_listener);\n}\n\nstatic void obj_deleted(lv_fragment_t *self, lv_obj_t *obj) {\n    LV_UNUSED(obj);\n}\n\nvoid launcher_fragment_set_selected_host(lv_fragment_t *self, uint64_t client_id) {\n    launcher_fragment *fragment = (launcher_fragment *) self;\n    fragment->selected_host_id = client_id;\n}\n\nstatic void hosts_changed(array_list_t *list, host_manager_hosts_change change_type, int change_index, void *context) {\n    launcher_fragment *fragment = (launcher_fragment *) context;\n    if (array_list_size(list) > 0 && fragment->selected_host_id == 0) {\n        const IHS_HostInfo *host = array_list_get(list, 0);\n        fragment->selected_host_id = host->clientId;\n    }\n    hosts_update(fragment);\n}\n\nstatic void launcher_gamepads_changed(launcher_fragment *fragment) {\n    input_manager_t *manager = fragment->app->input_manager;\n    size_t count = input_manager_sdl_gamepad_count(manager);\n    lv_obj_t *label = launch_option_get_label(fragment->gamepads);\n    if (count == 0) {\n        lv_label_set_text(label, \"No gamepad connected\");\n    } else if (count == 1) {\n        lv_label_set_text(label, \"1 gamepad connected\");\n    } else {\n        lv_label_set_text_fmt(label, \"%u gamepads connected\", count);\n    }\n}\n\nstatic bool event_cb(lv_fragment_t *self, int type, void *data) {\n    (void) data;\n    launcher_fragment *fragment = (launcher_fragment *) self;\n    switch (type) {\n        case APP_UI_GAMEPAD_DEVICE_CHANGED:\n            launcher_gamepads_changed(fragment);\n            return true;\n        case APP_UI_NAV_BACK:\n            return true;\n        default:\n            return false;\n    }\n}\n\nstatic lv_obj_t *launch_option_create_label_action(launcher_fragment *fragment, const char *icon, const char *label) {\n    int row_pos = fragment->num_launch_options++;\n    lv_obj_t *action = lv_btn_create(fragment->nav_content);\n    lv_obj_add_flag(action, LV_OBJ_FLAG_EVENT_BUBBLE);\n    lv_obj_set_grid_cell(action, LV_GRID_ALIGN_STRETCH, 1, 1, LV_GRID_ALIGN_STRETCH, row_pos, 1);\n    lv_obj_set_size(action, LV_SIZE_CONTENT, LV_SIZE_CONTENT);\n    lv_obj_set_flex_flow(action, LV_FLEX_FLOW_ROW);\n    lv_obj_set_flex_align(action, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);\n\n    lv_obj_t *icon_obj = lv_img_create(action);\n    lv_obj_add_style(icon_obj, &fragment->styles.option_icon, 0);\n    lv_img_set_src(icon_obj, icon);\n\n    lv_obj_t *label_obj = lv_label_create(action);\n    lv_obj_set_flex_grow(label_obj, 1);\n    if (label != NULL) {\n        lv_label_set_text(label_obj, label);\n    }\n\n    return action;\n}\n\nstatic lv_obj_t *launch_option_get_label(lv_obj_t *obj) {\n    return lv_obj_get_child(obj, 1);\n}\n\nstatic void launch_option_set_text(lv_obj_t *obj, const char *label) {\n    lv_label_set_text(launch_option_get_label(obj), label);\n}\n\nstatic void focus_content(lv_event_t *e) {\n    lv_obj_t *current_target = lv_event_get_current_target(e);\n    lv_obj_t *target = lv_event_get_target(e);\n    if (lv_obj_get_parent(target) != current_target) {\n        return;\n    }\n    lv_obj_focus_dir_by_key(target, lv_event_get_key(e));\n}\n\nstatic void open_settings(lv_event_t *e) {\n    launcher_fragment *fragment = lv_event_get_user_data(e);\n    app_ui_push_fragment(fragment->app->ui, &settings_fragment_class, NULL);\n}\n\nstatic void open_support(lv_event_t *e) {\n    launcher_fragment *fragment = lv_event_get_user_data(e);\n    app_ui_push_fragment(fragment->app->ui, &support_fragment_class, NULL);\n}\n\nstatic void select_host(lv_event_t *e) {\n    launcher_fragment *fragment = lv_event_get_user_data(e);\n    app_ui_push_fragment(fragment->app->ui, &hosts_fragment_class, fragment);\n}\n\nstatic void request_session(lv_event_t *e) {\n    launcher_fragment *fragment = lv_event_get_user_data(e);\n    const IHS_HostInfo *host = get_selected_host(fragment);\n    if (host == NULL) {\n        return;\n    }\n    IHS_HostInfo *data = calloc(1, sizeof(IHS_HostInfo));\n    *data = *host;\n    app_ui_push_fragment(fragment->app->ui, &connection_fragment_class, data);\n}\n\nstatic void launcher_quit(lv_event_t *e) {\n    app_quit(lv_event_get_user_data(e));\n}\n\nstatic void hosts_update(launcher_fragment *fragment) {\n    const IHS_HostInfo *host = get_selected_host(fragment);\n    if (host != NULL) {\n        launch_option_set_text(fragment->selected_host, host->hostname);\n    } else {\n        launch_option_set_text(fragment->selected_host, \"Select computer...\");\n    }\n}\n\nstatic const IHS_HostInfo *get_selected_host(launcher_fragment *fragment) {\n    host_manager_t *manager = fragment->app->host_manager;\n    array_list_t *hosts = host_manager_get_hosts(manager);\n    const IHS_HostInfo *host = NULL;\n    for (int i = 0, j = array_list_size(hosts); i < j; i++) {\n        const IHS_HostInfo *info = array_list_get(hosts, i);\n        if (fragment->selected_host_id == info->clientId) {\n            host = info;\n            break;\n        }\n    }\n    return host;\n}\n"
  },
  {
    "path": "app/ui/launcher.h",
    "content": "#pragma once\n\n#include <lvgl.h>\n\nextern const lv_fragment_class_t launcher_fragment_class;\n\nvoid launcher_fragment_set_selected_host(lv_fragment_t *self, uint64_t client_id);"
  },
  {
    "path": "app/ui/session/CMakeLists.txt",
    "content": "target_sources(ihsplay PRIVATE\n        session.c\n        connection_progress.c\n        streaming_overlay.c\n        )"
  },
  {
    "path": "app/ui/session/connection_progress.c",
    "content": "#include \"connection_progress.h\"\n#include \"session.h\"\n#include \"app.h\"\n#include \"ui/app_ui.h\"\n\ntypedef struct connection_progress_fragment {\n    lv_fragment_t base;\n    app_t *app;\n    lv_coord_t col_dsc[3], row_dsc[3];\n} connection_progress_fragment;\n\nvoid constructor(lv_fragment_t *self, void *args) {\n    connection_progress_fragment *fragment = (connection_progress_fragment *) self;\n    fragment->app = args;\n}\n\nlv_obj_t *create_obj_cb(lv_fragment_t *self, lv_obj_t *container) {\n    connection_progress_fragment *fragment = (connection_progress_fragment *) self;\n    lv_fragment_t *session_fragment = lv_fragment_get_parent(self);\n    lv_obj_t *content = lv_obj_create(container);\n    lv_obj_remove_style_all(content);\n    lv_obj_add_style(content, session_fragment_get_overlay_style(session_fragment), 0);\n\n    lv_obj_set_layout(content, LV_LAYOUT_GRID);\n    fragment->col_dsc[0] = LV_GRID_CONTENT;\n    fragment->col_dsc[1] = LV_GRID_FR(1);\n    fragment->col_dsc[2] = LV_GRID_TEMPLATE_LAST;\n\n    fragment->row_dsc[0] = LV_GRID_FR(1);\n    fragment->row_dsc[1] = LV_DPX(50);\n    fragment->row_dsc[2] = LV_GRID_TEMPLATE_LAST;\n\n    lv_obj_set_grid_dsc_array(content, fragment->col_dsc, fragment->row_dsc);\n\n    lv_obj_t *title = lv_label_create(content);\n    lv_obj_set_style_text_font(title, lv_theme_get_font_large(content), 0);\n    lv_obj_set_grid_cell(title, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_START, 0, 1);\n    lv_obj_set_style_pad_top(title, LV_DPX(20), 0);\n    lv_label_set_text_static(title, \"Connecting\");\n\n    lv_obj_t *subtitle = lv_label_create(content);\n    lv_obj_set_style_pad_top(subtitle, LV_DPX(15), 0);\n    lv_obj_set_grid_cell(subtitle, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_START, 1, 1);\n    lv_label_set_text_fmt(subtitle, \"Setting up streaming for %s...\", session_fragment_get_host_name(session_fragment));\n\n    lv_obj_t *spinner = lv_spinner_create(content, 1000, 60);\n    lv_obj_set_style_arc_width(spinner, LV_DPX(10), 0);\n    lv_obj_set_style_arc_width(spinner, LV_DPX(10), LV_PART_INDICATOR);\n    lv_obj_set_size(spinner, LV_DPX(50), LV_DPX(50));\n    lv_obj_set_grid_cell(spinner, LV_GRID_ALIGN_END, 1, 1, LV_GRID_ALIGN_CENTER, 0, 2);\n\n    return content;\n}\n\nconst lv_fragment_class_t connection_progress_class = {\n        .constructor_cb = constructor,\n        .create_obj_cb = create_obj_cb,\n        .instance_size = sizeof(connection_progress_fragment),\n};"
  },
  {
    "path": "app/ui/session/connection_progress.h",
    "content": "#pragma once\n\n#include \"lvgl.h\"\n\nextern const lv_fragment_class_t connection_progress_class;"
  },
  {
    "path": "app/ui/session/session.c",
    "content": "#include <assert.h>\n#include \"session.h\"\n#include \"ihslib.h\"\n#include \"ui/app_ui.h\"\n#include \"app.h\"\n#include \"ui/common/progress_dialog.h\"\n#include \"array_list.h\"\n#include \"backend/stream_manager.h\"\n#include \"streaming_overlay.h\"\n#include \"backend/host_manager.h\"\n#include \"connection_progress.h\"\n#include \"backend/input_manager.h\"\n#include \"logging.h\"\n#include \"config.h\"\n\ntypedef struct session_fragment_t {\n    lv_fragment_t base;\n    app_t *app;\n    session_fragment_args_t args;\n\n    array_list_t *cursors;\n    SDL_Cursor *blank_cursor;\n    uint64_t cursor_id;\n    bool cursor_visible;\n\n    lv_fragment_t *overlay;\n\n    lv_obj_t *overlay_hint;\n    lv_obj_t *overlay_progress;\n\n    struct {\n        lv_style_t overlay;\n    } styles;\n} session_fragment_t;\n\ntypedef struct cursor_t {\n    uint64_t id;\n    SDL_Cursor *cursor;\n} cursor_t;\n\nstatic void constructor(lv_fragment_t *self, void *args);\n\nstatic void destructor(lv_fragment_t *self);\n\nstatic lv_obj_t *create_obj(lv_fragment_t *self, lv_obj_t *container);\n\nstatic void obj_created(lv_fragment_t *self, lv_obj_t *obj);\n\nstatic void obj_will_delete(lv_fragment_t *self, lv_obj_t *obj);\n\nstatic bool event_cb(lv_fragment_t *self, int code, void *userdata);\n\nconst lv_fragment_class_t session_fragment_class = {\n        .constructor_cb = constructor,\n        .destructor_cb = destructor,\n        .create_obj_cb = create_obj,\n        .obj_created_cb = obj_created,\n        .obj_will_delete_cb = obj_will_delete,\n        .event_cb = event_cb,\n        .instance_size = sizeof(session_fragment_t)\n};\n\nstatic void session_connected_main(const IHS_SessionInfo *info, void *context);\n\nstatic void session_disconnected_main(const IHS_SessionInfo *info, bool requested, void *context);\n\nstatic void session_overlay_progress(int percentage, void *context);\n\nstatic void session_overlay_progress_finished(bool requested, void *context);\n\nconst static stream_manager_listener_t stream_manager_listener = {\n        .connected = session_connected_main,\n        .disconnected = session_disconnected_main,\n        .overlay_progress = session_overlay_progress,\n        .overlay_progress_finished = session_overlay_progress_finished,\n};\n\n\nstatic void session_show_cursor(IHS_Session *session, float x, float y, void *context);\n\nstatic void session_hide_cursor(IHS_Session *session, void *context);\n\nstatic bool session_set_cursor(IHS_Session *session, uint64_t cursorId, void *context);\n\nstatic void session_cursor_image(IHS_Session *session, const IHS_StreamInputCursorImage *image, void *context);\n\nstatic const cursor_t *session_current_cursor(session_fragment_t *fragment);\n\nstatic void disconnected_dialog_cb(lv_event_t *e);\n\nstatic void screen_clicked_cb(lv_event_t *e);\n\nstatic void set_overlay_visible(session_fragment_t *fragment, bool visible);\n\nstatic void constructor(lv_fragment_t *self, void *args) {\n    session_fragment_t *fragment = (session_fragment_t *) self;\n    const app_ui_fragment_args_t *fargs = args;\n    fragment->app = fargs->app;\n#if IHSPLAY_IS_DEBUG\n    if (fargs->data == NULL) {\n        memset(&fragment->args, 0, sizeof(fragment->args));\n    } else {\n        fragment->args = *(session_fragment_args_t *) fargs->data;\n    }\n#else\n    assert (fargs->data != NULL);\n    fragment->args = *(session_fragment_args_t *) fargs->data;\n#endif\n    fragment->cursors = array_list_create(sizeof(cursor_t), 16);\n    const static Uint8 blank_pixel[1] = {0};\n    fragment->blank_cursor = SDL_CreateCursor(blank_pixel, blank_pixel, 1, 1, 0, 0);\n\n    lv_coord_t overlay_height = LV_DPX(100);\n\n    lv_style_init(&fragment->styles.overlay);\n    lv_style_set_border_side(&fragment->styles.overlay, LV_BORDER_SIDE_TOP);\n    lv_style_set_border_width(&fragment->styles.overlay, LV_DPX(2));\n    lv_style_set_border_color(&fragment->styles.overlay, lv_palette_main(LV_PALETTE_BLUE));\n    lv_style_set_bg_color(&fragment->styles.overlay, lv_palette_main(LV_PALETTE_BLUE_GREY));\n    lv_style_set_bg_opa(&fragment->styles.overlay, LV_OPA_80);\n    lv_style_set_pad_ver(&fragment->styles.overlay, LV_DPX(5));\n    lv_style_set_pad_hor(&fragment->styles.overlay, LV_DPX(30));\n    lv_style_set_width(&fragment->styles.overlay, LV_PCT(100));\n    lv_style_set_height(&fragment->styles.overlay, overlay_height);\n    lv_style_set_align(&fragment->styles.overlay, LV_ALIGN_BOTTOM_MID);\n\n    stream_manager_set_overlay_height(fragment->app->stream_manager, overlay_height);\n}\n\nstatic void destructor(lv_fragment_t *self) {\n    session_fragment_t *fragment = (session_fragment_t *) self;\n    lv_style_reset(&fragment->styles.overlay);\n    array_list_destroy(fragment->cursors);\n    SDL_FreeCursor(fragment->blank_cursor);\n}\n\nstatic lv_obj_t *create_obj(lv_fragment_t *self, lv_obj_t *container) {\n    session_fragment_t *fragment = (session_fragment_t *) self;\n    lv_obj_t *obj = lv_obj_create(container);\n    lv_obj_remove_style_all(obj);\n    lv_obj_set_size(obj, LV_PCT(100), LV_PCT(100));\n    lv_obj_add_event_cb(obj, screen_clicked_cb, LV_EVENT_CLICKED, fragment);\n\n    lv_obj_t *overlay_hint = lv_obj_create(obj);\n    lv_obj_set_size(overlay_hint, LV_SIZE_CONTENT, LV_DPX(60));\n    lv_obj_set_style_bg_opa(overlay_hint, LV_OPA_80, 0);\n    lv_obj_set_style_bg_color(overlay_hint, lv_palette_main(LV_PALETTE_BLUE_GREY), 0);\n    lv_obj_set_layout(overlay_hint, LV_LAYOUT_FLEX);\n    lv_obj_set_flex_flow(overlay_hint, LV_FLEX_FLOW_ROW);\n    lv_obj_set_flex_align(overlay_hint, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START);\n    lv_obj_set_style_pad_ver(overlay_hint, LV_DPX(15), 0);\n    lv_obj_set_style_pad_hor(overlay_hint, LV_DPX(20), 0);\n    lv_obj_set_style_pad_gap(overlay_hint, LV_DPX(15), 0);\n\n    lv_obj_t *overlay_label = lv_label_create(overlay_hint);\n    lv_label_set_text_static(overlay_label, \"Long press to open the menu\");\n\n    lv_obj_t *overlay_progress = lv_arc_create(overlay_hint);\n    lv_obj_set_size(overlay_progress, LV_DPX(30), LV_DPX(30));\n    lv_arc_set_bg_angles(overlay_progress, 0, 360);\n    lv_arc_set_angles(overlay_progress, 0, 360);\n    lv_arc_set_rotation(overlay_progress, 270);\n    lv_arc_set_range(overlay_progress, 0, 99);\n    lv_arc_set_value(overlay_progress, 30);\n    lv_obj_set_style_arc_width(overlay_progress, LV_DPX(5), 0);\n    lv_obj_set_style_arc_width(overlay_progress, LV_DPX(5), LV_PART_INDICATOR);\n\n    fragment->overlay_hint = overlay_hint;\n    fragment->overlay_progress = overlay_progress;\n\n    lv_obj_add_flag(overlay_hint, LV_OBJ_FLAG_HIDDEN);\n    lv_obj_align(overlay_hint, LV_ALIGN_LEFT_MID, 0, LV_PCT(10));\n\n    return obj;\n}\n\nstatic void obj_created(lv_fragment_t *self, lv_obj_t *obj) {\n    LV_UNUSED(obj);\n    session_fragment_t *fragment = (session_fragment_t *) self;\n\n    fragment->overlay = lv_fragment_create(&connection_progress_class, fragment->app);\n    lv_fragment_manager_replace(fragment->base.child_manager, fragment->overlay, &fragment->base.obj);\n\n    stream_manager_t *stream_manager = fragment->app->stream_manager;\n    stream_manager_register_listener(stream_manager, &stream_manager_listener, fragment);\n    if (fragment->args.session.sessionKeyLen > 0) {\n        stream_manager_start_session(stream_manager, &fragment->args.session);\n    }\n\n    app_ui_set_ignore_keys(fragment->app->ui, true);\n\n    lv_obj_set_style_bg_opa(lv_scr_act(), LV_OPA_TRANSP, 0);\n}\n\nstatic void obj_will_delete(lv_fragment_t *self, lv_obj_t *obj) {\n    LV_UNUSED(obj);\n    session_fragment_t *fragment = (session_fragment_t *) self;\n    app_ui_set_ignore_keys(fragment->app->ui, false);\n\n    stream_manager_unregister_listener(fragment->app->stream_manager, &stream_manager_listener);\n\n    lv_obj_set_style_bg_opa(lv_scr_act(), LV_OPA_COVER, 0);\n}\n\nstatic bool event_cb(lv_fragment_t *self, int code, void *userdata) {\n    LV_UNUSED(userdata);\n    session_fragment_t *fragment = (session_fragment_t *) self;\n    switch (code) {\n        case APP_UI_REQUEST_OVERLAY: {\n            set_overlay_visible(fragment, true);\n            return true;\n        }\n        case APP_UI_CLOSE_OVERLAY: {\n            set_overlay_visible(fragment, false);\n            return true;\n        }\n        case APP_UI_NAV_BACK: {\n            stream_manager_t *stream_manager = fragment->app->stream_manager;\n            if (stream_manager_is_overlay_opened(stream_manager)) {\n                stream_manager_set_overlay_opened(stream_manager, false);\n                return true;\n            }\n            return false;\n        }\n        case APP_UI_NAV_QUIT: {\n            return true;\n        }\n        default:\n            break;\n    }\n    return false;\n}\n\nstatic void session_connected_main(const IHS_SessionInfo *info, void *context) {\n    LV_UNUSED(info);\n    session_fragment_t *fragment = (session_fragment_t *) context;\n\n    if (fragment->overlay != NULL) {\n        lv_fragment_manager_remove(fragment->base.child_manager, fragment->overlay);\n        fragment->overlay = NULL;\n    }\n}\n\nstatic void session_disconnected_main(const IHS_SessionInfo *info, bool requested, void *context) {\n    LV_UNUSED(info);\n    session_fragment_t *fragment = (session_fragment_t *) context;\n//    SDL_SetCursor(SDL_GetDefaultCursor());\n    if (!requested) {\n        static const char *btn_txts[] = {\"OK\", \"\"};\n        lv_obj_t *mbox = lv_msgbox_create(NULL, NULL, \"Disconnected.\", btn_txts, false);\n        lv_obj_add_event_cb(mbox, disconnected_dialog_cb, LV_EVENT_VALUE_CHANGED, NULL);\n        lv_obj_center(mbox);\n    }\n    app_ui_pop_top_fragment(fragment->app->ui);\n}\n\nstatic void session_overlay_progress(int percentage, void *context) {\n    session_fragment_t *fragment = (session_fragment_t *) context;\n    if (lv_obj_has_flag(fragment->overlay_hint, LV_OBJ_FLAG_HIDDEN)) {\n        lv_obj_clear_flag(fragment->overlay_hint, LV_OBJ_FLAG_HIDDEN);\n    }\n    lv_arc_set_value(fragment->overlay_progress, (int16_t) percentage);\n}\n\nstatic void session_overlay_progress_finished(bool requested, void *context) {\n    session_fragment_t *fragment = (session_fragment_t *) context;\n    lv_obj_add_flag(fragment->overlay_hint, LV_OBJ_FLAG_HIDDEN);\n}\n\nstatic void session_show_cursor(IHS_Session *session, float x, float y, void *context) {\n    session_fragment_t *fragment = context;\n    commons_log_info(\"Session\", \"show_cursor: x=%f, y=%f\", x, y);\n\n    if (!fragment->cursor_visible) {\n        fragment->cursor_visible = true;\n        const cursor_t *cursor = session_current_cursor(fragment);\n        if (cursor != NULL) {\n//            SDL_SetCursor(cursor->cursor);\n        }\n    }\n}\n\nstatic bool session_set_cursor(IHS_Session *session, uint64_t cursorId, void *context) {\n    session_fragment_t *fragment = context;\n    fragment->cursor_id = cursorId;\n    const cursor_t *cursor = session_current_cursor(fragment);\n    if (!cursor) {\n        return false;\n    }\n    if (fragment->cursor_visible) {\n        SDL_SetCursor(cursor->cursor);\n    }\n    return true;\n}\n\nstatic void session_hide_cursor(IHS_Session *session, void *context) {\n    session_fragment_t *fragment = context;\n    if (fragment->cursor_visible) {\n        fragment->cursor_visible = false;\n        SDL_SetCursor(fragment->blank_cursor);\n    }\n}\n\nstatic const cursor_t *session_current_cursor(session_fragment_t *fragment) {\n    cursor_t *cursor = NULL;\n    for (int i = 0, j = array_list_size(fragment->cursors); i < j; ++i) {\n        cursor_t *item = array_list_get(fragment->cursors, i);\n        if (item->id == fragment->cursor_id) {\n            cursor = item;\n            break;\n        }\n    }\n    return cursor;\n}\n\nstatic void session_cursor_image(IHS_Session *session, const IHS_StreamInputCursorImage *image, void *context) {\n    session_fragment_t *fragment = context;\n    cursor_t *cursor = NULL;\n    for (int i = 0, j = array_list_size(fragment->cursors); i < j; ++i) {\n        cursor_t *item = array_list_get(fragment->cursors, i);\n        if (item->id == image->width) {\n            cursor = item;\n            break;\n        }\n    }\n    if (cursor == NULL) {\n        cursor = array_list_add(fragment->cursors, -1);\n    } else {\n        SDL_FreeCursor(cursor->cursor);\n    }\n    SDL_Surface *surface = SDL_CreateRGBSurfaceFrom((void *) image->image, image->width, image->height, 32,\n                                                    image->width * 4, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);\n    cursor->id = image->cursorId;\n    cursor->cursor = SDL_CreateColorCursor(surface, image->hotX, image->hotY);\n    SDL_FreeSurface(surface);\n\n    if (fragment->cursor_visible && fragment->cursor_id == cursor->id) {\n        SDL_SetCursor(cursor->cursor);\n    }\n}\n\nstatic void disconnected_dialog_cb(lv_event_t *e) {\n    lv_obj_t *msgbox = lv_event_get_current_target(e);\n    lv_msgbox_close_async(msgbox);\n}\n\nstatic void screen_clicked_cb(lv_event_t *e) {\n    session_fragment_t *fragment = lv_event_get_user_data(e);\n    stream_manager_t *manager = fragment->app->stream_manager;\n    if (!stream_manager_is_overlay_opened(manager)) {\n        return;\n    }\n    stream_manager_set_overlay_opened(manager, false);\n}\n\nstatic void set_overlay_visible(session_fragment_t *fragment, bool visible) {\n    if (visible == (fragment->overlay != NULL && fragment->overlay->cls == &streaming_overlay_class)) {\n        return;\n    }\n    app_ui_set_ignore_keys(fragment->app->ui, !visible);\n    if (visible) {\n        lv_fragment_t *overlay_fragment = lv_fragment_create(&streaming_overlay_class, fragment->app);\n        lv_fragment_manager_replace(fragment->base.child_manager, overlay_fragment, &fragment->base.obj);\n        fragment->overlay = overlay_fragment;\n    } else {\n        lv_fragment_manager_remove(fragment->base.child_manager, fragment->overlay);\n        fragment->overlay = NULL;\n    }\n}\n\nlv_style_t *session_fragment_get_overlay_style(lv_fragment_t *fragment) {\n    return &((session_fragment_t *) fragment)->styles.overlay;\n}\n\nconst char *session_fragment_get_host_name(lv_fragment_t *fragment) {\n    return ((session_fragment_t *) fragment)->args.host.hostname;\n}"
  },
  {
    "path": "app/ui/session/session.h",
    "content": "#pragma once\n\n#include \"lvgl.h\"\n#include \"ihslib.h\"\n\ntypedef struct session_fragment_args_t {\n    IHS_HostInfo host;\n    IHS_SessionInfo session;\n} session_fragment_args_t;\n\nextern const lv_fragment_class_t session_fragment_class;\n\nlv_style_t *session_fragment_get_overlay_style(lv_fragment_t *fragment);\n\nconst char *session_fragment_get_host_name(lv_fragment_t *fragment);"
  },
  {
    "path": "app/ui/session/streaming_overlay.c",
    "content": "#include \"streaming_overlay.h\"\n#include \"lvgl/fonts/bootstrap-icons/symbols.h\"\n\n#include \"app.h\"\n#include \"ui/app_ui.h\"\n#include \"backend/stream_manager.h\"\n#include \"session.h\"\n\ntypedef struct streaming_overlay_fragment_t {\n    lv_fragment_t base;\n    app_t *app;\n    struct {\n    } styles;\n} streaming_overlay_fragment_t;\n\nstatic void constructor_cb(lv_fragment_t *self, void *args);\n\nstatic void destructor_cb(lv_fragment_t *self);\n\nstatic lv_obj_t *create_obj_cb(lv_fragment_t *self, lv_obj_t *container);\n\nstatic void obj_created_cb(lv_fragment_t *self, lv_obj_t *obj);\n\nstatic void quit_clicked_cb(lv_event_t *e);\n\nconst lv_fragment_class_t streaming_overlay_class = {\n        .constructor_cb = constructor_cb,\n        .destructor_cb = destructor_cb,\n        .create_obj_cb = create_obj_cb,\n        .obj_created_cb = obj_created_cb,\n        .instance_size = sizeof(streaming_overlay_fragment_t),\n};\n\nstatic void constructor_cb(lv_fragment_t *self, void *args) {\n    streaming_overlay_fragment_t *fragment = (streaming_overlay_fragment_t *) self;\n    fragment->app = args;\n\n}\n\nstatic void destructor_cb(lv_fragment_t *self) {\n}\n\nstatic lv_obj_t *create_obj_cb(lv_fragment_t *self, lv_obj_t *container) {\n    streaming_overlay_fragment_t *fragment = (streaming_overlay_fragment_t *) self;\n    lv_fragment_t *session_fragment = lv_fragment_get_parent(self);\n    lv_obj_t *content = lv_obj_create(container);\n    lv_obj_remove_style_all(content);\n    lv_obj_add_style(content, session_fragment_get_overlay_style(session_fragment), 0);\n    lv_obj_set_style_pad_hor(content, LV_DPX(30), 0);\n    lv_obj_add_flag(content, LV_OBJ_FLAG_CLICKABLE);\n\n    lv_obj_t *quit = lv_btn_create(content);\n    lv_obj_set_style_radius(quit, LV_DPX(4), 0);\n    lv_obj_add_event_cb(quit, quit_clicked_cb, LV_EVENT_CLICKED, self);\n    lv_obj_t *quit_label = lv_label_create(quit);\n    lv_obj_add_style(quit_label, &fragment->app->ui->styles.action_btn_label, 0);\n    lv_label_set_text(quit_label, BS_SYMBOL_POWER);\n\n    lv_obj_align(quit, LV_ALIGN_LEFT_MID, 0, 0);\n\n    return content;\n}\n\nstatic void obj_created_cb(lv_fragment_t *self, lv_obj_t *obj) {\n\n}\n\nstatic void quit_clicked_cb(lv_event_t *e) {\n    streaming_overlay_fragment_t *fragment = lv_event_get_user_data(e);\n    stream_manager_stop_active(fragment->app->stream_manager);\n}"
  },
  {
    "path": "app/ui/session/streaming_overlay.h",
    "content": "#pragma once\n\n#include \"lvgl.h\"\n\nextern const lv_fragment_class_t streaming_overlay_class;"
  },
  {
    "path": "app/ui/settings/basic.c",
    "content": "#include \"app.h\"\n#include \"basic.h\"\n#include \"widgets.h\"\n\n#include \"config.h\"\n\ntypedef struct basic_fragment {\n    lv_fragment_t base;\n    app_t *app;\n} basic_fragment;\n\nstatic void constructor(lv_fragment_t *self, void *arg) {\n\n}\n\nstatic void destructor(lv_fragment_t *self) {\n\n}\n\nstatic lv_obj_t *create_obj(lv_fragment_t *self, lv_obj_t *container) {\n    lv_obj_t *list = lv_obj_create(container);\n    lv_obj_remove_style_all(list);\n    lv_obj_set_size(list, LV_PCT(100), LV_PCT(100));\n    lv_obj_set_layout(list, LV_LAYOUT_FLEX);\n    lv_obj_set_flex_flow(list, LV_FLEX_FLOW_ROW_WRAP);\n    lv_obj_set_style_pad_ver(list, LV_DPX(15), 0);\n    lv_obj_set_style_pad_hor(list, LV_DPX(20), 0);\n    lv_obj_set_style_pad_gap(list, LV_DPX(10), 0);\n\n#if IHSPLAY_WIP_FEATURES\n    settings_select_create(list, \"Resolution\");\n    settings_select_create(list, \"Framerate\");\n    settings_select_create(list, \"Bitrate\");\n#endif\n    settings_select_create(list, \"Audio Backend\");\n    settings_select_create(list, \"Video Decoder\");\n    return list;\n}\n\nstatic void obj_created(lv_fragment_t *self, lv_obj_t *obj) {\n\n}\n\nstatic void obj_will_delete(lv_fragment_t *self, lv_obj_t *obj) {\n\n}\n\nstatic void obj_deleted(lv_fragment_t *self, lv_obj_t *obj) {\n\n}\n\nconst lv_fragment_class_t settings_basic_fragment_class = {\n        .constructor_cb = constructor,\n        .destructor_cb = destructor,\n        .create_obj_cb = create_obj,\n        .obj_created_cb = obj_created,\n        .obj_will_delete_cb = obj_will_delete,\n        .obj_deleted_cb = obj_deleted,\n        .instance_size = sizeof(basic_fragment),\n};"
  },
  {
    "path": "app/ui/settings/basic.h",
    "content": "#pragma once\n\n#include <lvgl.h>\n\nextern const lv_fragment_class_t settings_basic_fragment_class;"
  },
  {
    "path": "app/ui/settings/settings.c",
    "content": "#include \"settings.h\"\n\n#include \"app.h\"\n#include \"ui/launcher.h\"\n#include \"lvgl/theme.h\"\n#include \"basic.h\"\n#include \"ui/app_ui.h\"\n\ntypedef struct settings_fragment {\n    lv_fragment_t base;\n    app_t *app;\n    lv_obj_t *content;\n} settings_fragment;\n\nstatic void constructor(lv_fragment_t *self, void *arg);\n\nstatic void destructor(lv_fragment_t *self);\n\nstatic lv_obj_t *create_obj(lv_fragment_t *self, lv_obj_t *container);\n\nstatic void obj_created(lv_fragment_t *self, lv_obj_t *obj);\n\nstatic void obj_will_delete(lv_fragment_t *self, lv_obj_t *obj);\n\nstatic void obj_deleted(lv_fragment_t *self, lv_obj_t *obj);\n\nstatic bool event_cb(lv_fragment_t *self, int code, void *data);\n\nconst lv_fragment_class_t settings_fragment_class = {\n        .constructor_cb = constructor,\n        .destructor_cb = destructor,\n        .create_obj_cb = create_obj,\n        .obj_created_cb = obj_created,\n        .obj_will_delete_cb = obj_will_delete,\n        .obj_deleted_cb = obj_deleted,\n        .event_cb = event_cb,\n        .instance_size = sizeof(settings_fragment),\n};\n\nstatic void constructor(lv_fragment_t *self, void *arg) {\n    settings_fragment *fragment = (settings_fragment *) self;\n    fragment->app = ((app_ui_fragment_args_t *) arg)->app;\n}\n\nstatic void destructor(lv_fragment_t *self) {\n}\n\nstatic lv_obj_t *create_obj(lv_fragment_t *self, lv_obj_t *container) {\n    settings_fragment *fragment = (settings_fragment *) self;\n    lv_obj_t *win = app_lv_win_create(container);\n    lv_win_add_title(win, \"Settings\");\n    fragment->content = lv_win_get_content(win);\n    return win;\n}\n\nstatic void obj_created(lv_fragment_t *self, lv_obj_t *obj) {\n    settings_fragment *fragment = (settings_fragment *) self;\n    lv_fragment_t *f = lv_fragment_create(&settings_basic_fragment_class, NULL);\n    lv_fragment_manager_replace(self->child_manager, f, &fragment->content);\n}\n\nstatic void obj_will_delete(lv_fragment_t *self, lv_obj_t *obj) {\n    LV_UNUSED(obj);\n}\n\nstatic void obj_deleted(lv_fragment_t *self, lv_obj_t *obj) {\n    LV_UNUSED(obj);\n}\n\nstatic bool event_cb(lv_fragment_t *self, int code, void *data) {\n    (void) data;\n    settings_fragment *fragment = (settings_fragment *) self;\n    if (code == APP_UI_NAV_BACK) {\n        app_ui_pop_top_fragment(fragment->app->ui);\n        return true;\n    }\n    return false;\n}"
  },
  {
    "path": "app/ui/settings/settings.h",
    "content": "#pragma once\n\n#include <lvgl.h>\n\nextern const lv_fragment_class_t settings_fragment_class;"
  },
  {
    "path": "app/ui/settings/widgets.c",
    "content": "#include \"widgets.h\"\n\nlv_obj_t *settings_select_create(lv_obj_t *parent, const char *name) {\n    lv_obj_t *item = lv_label_create(parent);\n    lv_label_set_text(item, name);\n    lv_obj_set_width(item, LV_PCT(100));\n\n    lv_obj_t *dropdown = lv_dropdown_create(item);\n    lv_obj_set_width(dropdown, LV_PCT(50));\n    lv_obj_align(dropdown, LV_ALIGN_RIGHT_MID, 0, 0);\n\n    return item;\n}"
  },
  {
    "path": "app/ui/settings/widgets.h",
    "content": "#pragma once\n\n#include <lvgl.h>\n\nlv_obj_t *settings_select_create(lv_obj_t *parent, const char *name);"
  },
  {
    "path": "app/ui/support/CMakeLists.txt",
    "content": "target_sources(ihsplay PRIVATE support.c wiki.c feedback.c)"
  },
  {
    "path": "app/ui/support/feedback.c",
    "content": "#include \"wiki.h\"\n#include \"ss4s.h\"\n#include \"config.h\"\n#include \"app.h\"\n\ntypedef struct feedback_fragment_t {\n    lv_fragment_t base;\n    app_t *app;\n} feedback_fragment_t;\n\nstatic void feedback_ctor(lv_fragment_t *self, void *arg);\n\nstatic lv_obj_t *create_obj(lv_fragment_t *self, lv_obj_t *parent);\n\nconst lv_fragment_class_t feedback_fragment_class = {\n        .constructor_cb = feedback_ctor,\n        .create_obj_cb = create_obj,\n        .instance_size = sizeof(feedback_fragment_t)\n};\n\nstatic void feedback_ctor(lv_fragment_t *self, void *arg) {\n    ((feedback_fragment_t *) self)->app = arg;\n}\n\nstatic lv_obj_t *create_obj(lv_fragment_t *self, lv_obj_t *parent) {\n    app_t *app = ((feedback_fragment_t *) self)->app;\n    lv_obj_t *content = lv_obj_create(parent);\n    lv_obj_set_size(content, LV_PCT(100), LV_PCT(100));\n    lv_obj_set_layout(content, LV_LAYOUT_FLEX);\n    lv_obj_set_flex_flow(content, LV_FLEX_FLOW_ROW_WRAP);\n\n    lv_obj_t *hint1 = lv_label_create(content);\n    lv_obj_set_width(hint1, LV_PCT(100));\n    lv_label_set_text(hint1, \"Please include information below when you send feedback. \"\n                             \"You can also scan the QR code to copy the text.\");\n\n    lv_obj_t *qrcode = lv_qrcode_create(content, LV_DPX(200), lv_color_black(), lv_color_white());\n    lv_obj_set_style_pad_all(qrcode, LV_DPX(5), 0);\n    lv_obj_set_style_bg_opa(qrcode, LV_OPA_COVER, 0);\n    lv_obj_set_style_bg_color(qrcode, lv_color_white(), 0);\n\n    static const char *info_fmt = \"Version: %s\\n\"\n                                  \"Audio Module: %s\\n\"\n                                  \"Video Module: %s\\n\"\n                                  \"System: %s\\n\";\n    lv_obj_t *info_label = lv_label_create(content);\n    char *os_str = os_info_str(&app->os_info);\n    lv_label_set_text_fmt(info_label, info_fmt, IHSPLAY_VERSION_STRING, SS4S_GetAudioModuleName(),\n                          SS4S_GetVideoModuleName(), os_str);\n    if (os_str != NULL) {\n        free(os_str);\n    }\n    lv_obj_set_flex_grow(info_label, 1);\n\n    const char *info_txt = lv_label_get_text(info_label);\n    lv_qrcode_update(qrcode, info_txt, strlen(info_txt));\n\n    return content;\n}"
  },
  {
    "path": "app/ui/support/feedback.h",
    "content": "#pragma once\n\n#include <lvgl.h>\n\nextern const lv_fragment_class_t feedback_fragment_class;"
  },
  {
    "path": "app/ui/support/support.c",
    "content": "#include \"support.h\"\n#include \"wiki.h\"\n#include \"feedback.h\"\n#include \"app.h\"\n#include \"lvgl/theme.h\"\n#include \"ui/app_ui.h\"\n\ntypedef struct support_fragment_t {\n    lv_fragment_t base;\n    lv_coord_t col_dsc[3], row_dsc[4];\n    lv_obj_t *win_content;\n    int num_btns;\n    app_t *app;\n} support_fragment_t;\n\nstatic void constructor(lv_fragment_t *self, void *args);\n\nstatic lv_obj_t *create_obj(lv_fragment_t *self, lv_obj_t *parent);\n\nstatic void obj_created(lv_fragment_t *self, lv_obj_t *obj);\n\nstatic bool event_cb(lv_fragment_t *self, int code, void *data);\n\nstatic void show_page(lv_fragment_t *self, const lv_fragment_class_t *cls);\n\nstatic lv_obj_t *add_btn(support_fragment_t *fragment, lv_obj_t *parent, const char *text,\n                         const lv_fragment_class_t *cls);\n\nstatic void btn_click_cb(lv_event_t *e);\n\nstatic void btn_key_cb(lv_event_t *e);\n\nconst lv_fragment_class_t support_fragment_class = {\n        .constructor_cb = constructor,\n        .create_obj_cb = create_obj,\n        .obj_created_cb = obj_created,\n        .event_cb = event_cb,\n        .instance_size = sizeof(support_fragment_t)\n};\n\nstatic void constructor(lv_fragment_t *self, void *args) {\n    support_fragment_t *fragment = (support_fragment_t *) self;\n    fragment->app = ((app_ui_fragment_args_t *) args)->app;\n    fragment->col_dsc[0] = LV_DPX(200);\n    fragment->col_dsc[1] = LV_GRID_FR(1);\n    fragment->col_dsc[2] = LV_GRID_TEMPLATE_LAST;\n    fragment->row_dsc[0] = LV_DPX(40);\n    fragment->row_dsc[1] = LV_DPX(40);\n    fragment->row_dsc[2] = LV_GRID_FR(1);\n    fragment->row_dsc[3] = LV_GRID_TEMPLATE_LAST;\n    fragment->num_btns = 0;\n}\n\nstatic lv_obj_t *create_obj(lv_fragment_t *self, lv_obj_t *parent) {\n    support_fragment_t *fragment = (support_fragment_t *) self;\n    lv_obj_t *win = app_lv_win_create(parent);\n    lv_win_add_title(win, \"Support\");\n    lv_obj_set_size(win, LV_PCT(100), LV_PCT(100));\n    fragment->win_content = lv_win_get_content(win);\n    lv_obj_set_style_pad_row(fragment->win_content, LV_DPX(15), 0);\n    lv_obj_set_style_pad_column(fragment->win_content, LV_DPX(30), 0);\n    lv_obj_set_layout(fragment->win_content, LV_LAYOUT_GRID);\n    lv_obj_set_grid_dsc_array(fragment->win_content, fragment->col_dsc, fragment->row_dsc);\n    lv_obj_add_event_cb(fragment->win_content, btn_click_cb, LV_EVENT_CLICKED, fragment);\n    lv_obj_add_event_cb(fragment->win_content, btn_key_cb, LV_EVENT_KEY, fragment);\n\n\n    add_btn(fragment, fragment->win_content, \"Get Help\", &wiki_fragment_class);\n    add_btn(fragment, fragment->win_content, \"Feedback\", &feedback_fragment_class);\n\n    return win;\n}\n\nstatic void obj_created(lv_fragment_t *self, lv_obj_t *obj) {\n    show_page(self, &wiki_fragment_class);\n}\n\nstatic bool event_cb(lv_fragment_t *self, int code, void *data) {\n    (void) data;\n    support_fragment_t *fragment = (support_fragment_t *) self;\n    if (code == APP_UI_NAV_BACK) {\n        app_ui_pop_top_fragment(fragment->app->ui);\n        return true;\n    }\n    return false;\n}\n\nstatic lv_obj_t *add_btn(support_fragment_t *fragment, lv_obj_t *parent, const char *text,\n                         const lv_fragment_class_t *cls) {\n    LV_ASSERT_NULL(cls);\n    lv_obj_t *btn = lv_btn_create(parent);\n    lv_obj_t *label = lv_label_create(btn);\n    lv_label_set_text(label, text);\n    lv_obj_set_grid_cell(btn, LV_GRID_ALIGN_STRETCH, 0, 1, LV_GRID_ALIGN_STRETCH, fragment->num_btns++, 1);\n    lv_obj_set_user_data(btn, (void *) cls);\n    lv_obj_add_flag(btn, LV_OBJ_FLAG_EVENT_BUBBLE);\n    return btn;\n}\n\nstatic void show_page(lv_fragment_t *self, const lv_fragment_class_t *cls) {\n    support_fragment_t *fragment = (support_fragment_t *) self;\n    lv_fragment_t *page = lv_fragment_create(cls, fragment->app);\n    lv_fragment_manager_replace(self->child_manager, page, &fragment->win_content);\n    lv_obj_set_grid_cell(page->obj, LV_GRID_ALIGN_STRETCH, 1, 1, LV_GRID_ALIGN_STRETCH, 0, 3);\n}\n\nstatic void btn_click_cb(lv_event_t *e) {\n    lv_obj_t *target = lv_event_get_target(e);\n    if (!lv_obj_check_type(target, &lv_btn_class)) {\n        return;\n    }\n    const lv_fragment_class_t *cls = lv_obj_get_user_data(target);\n    lv_fragment_t *self = lv_event_get_user_data(e);\n    show_page(self, cls);\n}\n\nstatic void btn_key_cb(lv_event_t *e) {\n    lv_obj_t *target = lv_event_get_target(e);\n    if (!lv_obj_check_type(target, &lv_btn_class)) {\n        return;\n    }\n    lv_fragment_t *self = lv_event_get_user_data(e);\n    lv_coord_t pos = lv_obj_get_style_grid_cell_row_pos(target, 0);\n    lv_group_t *group = lv_obj_get_group(target);\n    switch (lv_event_get_key(e)) {\n        case LV_KEY_UP: {\n            if (pos > 0) {\n                lv_group_focus_prev(group);\n            }\n            break;\n        }\n        case LV_KEY_DOWN: {\n            support_fragment_t *fragment = (support_fragment_t *) self;\n            if (pos < fragment->num_btns - 1) {\n                lv_group_focus_next(group);\n            }\n            break;\n        }\n    }\n}"
  },
  {
    "path": "app/ui/support/support.h",
    "content": "#pragma once\n\n#include <lvgl.h>\n\nextern const lv_fragment_class_t support_fragment_class;"
  },
  {
    "path": "app/ui/support/wiki.c",
    "content": "#include \"wiki.h\"\n\nstatic lv_obj_t *create_obj(lv_fragment_t *self, lv_obj_t *parent);\n\nconst lv_fragment_class_t wiki_fragment_class = {\n        .create_obj_cb = create_obj,\n        .instance_size = sizeof(lv_fragment_t)\n};\n\nstatic lv_obj_t *create_obj(lv_fragment_t *self, lv_obj_t *parent) {\n    lv_obj_t *content = lv_obj_create(parent);\n    lv_obj_set_size(content, LV_PCT(100), LV_PCT(100));\n    lv_obj_set_layout(content, LV_LAYOUT_FLEX);\n    lv_obj_set_flex_flow(content, LV_FLEX_FLOW_COLUMN);\n    lv_obj_t *hint = lv_label_create(content);\n    lv_obj_set_size(hint, LV_PCT(100), LV_SIZE_CONTENT);\n    const char *url = \"https://github.com/mariotaku/ihsplay/wiki\";\n\n    lv_label_set_text_fmt(hint, \"Open %s for guides and frequently asked questions. Or scan the QR code below.\", url);\n\n    lv_obj_t *qrcode = lv_qrcode_create(content, LV_DPX(200), lv_color_black(), lv_color_white());\n    lv_obj_set_style_bg_opa(qrcode, LV_OPA_COVER, 0);\n    lv_obj_set_style_bg_color(qrcode, lv_color_white(), 0);\n\n    lv_qrcode_update(qrcode, url, strlen(url));\n\n    return content;\n}"
  },
  {
    "path": "app/ui/support/wiki.h",
    "content": "#pragma once\n\n#include <lvgl.h>\n\nextern const lv_fragment_class_t wiki_fragment_class;"
  },
  {
    "path": "app/util/CMakeLists.txt",
    "content": "target_sources(ihsplay PRIVATE listeners_list.c random.c client_info.c)\n\nadd_subdirectory(video)"
  },
  {
    "path": "app/util/client_info.c",
    "content": "#include <stdlib.h>\n#include <string.h>\n#include \"client_info.h\"\n\nstatic const uint8_t secretKey[32] = {\n        11, 45, 14, 19, 19, 8, 1, 0,\n        11, 45, 14, 19, 19, 8, 1, 0,\n        11, 45, 14, 19, 19, 8, 1, 0,\n        11, 45, 14, 19, 19, 8, 1, 0,\n};\n\nbool client_info_load_default(client_info_t *info) {\n    memset(info, 0, sizeof(*info));\n    info->config.deviceName = \"IHSplay\";\n    // TODO: generate random number and store them\n    info->config.deviceId = 11451419190810;\n    info->config.secretKey = secretKey;\n    return true;\n}\n\nvoid client_info_clear(client_info_t *info) {\n    if (info->name != NULL) {\n        free(info->name);\n    }\n    memset(info, 0, sizeof(*info));\n}\n"
  },
  {
    "path": "app/util/client_info.h",
    "content": "#pragma once\n\n#include \"ihslib.h\"\n\ntypedef struct client_info_t {\n    uint64_t device_id;\n    uint8_t secret_key[32];\n    char *name;\n    IHS_ClientConfig config;\n} client_info_t;\n\n\nbool client_info_load(client_info_t *info);\n\nbool client_info_load_default(client_info_t *info);\n\nvoid client_info_clear(client_info_t *info);"
  },
  {
    "path": "app/util/listeners_list.c",
    "content": "#include \"listeners_list.h\"\n\narray_list_t *listeners_list_create() {\n    return array_list_create(sizeof(registered_listener_t), 16);\n}\n\nvoid listeners_list_destroy(array_list_t *list) {\n    for (int i = 0, j = array_list_size(list); i < j; ++i) {\n        registered_listener_t *l = array_list_get(list, i);\n        if (l->refcounter.lock != NULL) {\n            refcounter_destroy(&l->refcounter);\n        }\n    }\n    array_list_destroy(list);\n}\n\nvoid listeners_list_add(array_list_t *list, const void *listener, void *context) {\n    registered_listener_t *item = array_list_add(list, -1);\n    memset(item, 0, sizeof(registered_listener_t));\n    refcounter_init(&item->refcounter);\n    item->listener = listener;\n    item->context = context;\n}\n\nvoid listeners_list_remove(array_list_t *list, const void *listener) {\n    registered_listener_t *to_unregister = NULL;\n    int i;\n    for (i = array_list_size(list) - 1; i >= 0; --i) {\n        registered_listener_t *item = array_list_get(list, i);\n        if (item->listener == listener) {\n            to_unregister = item;\n            break;\n        }\n    }\n    if (to_unregister == NULL || to_unregister->refcounter.counter == 0) return;\n    if (refcounter_unref(&to_unregister->refcounter)) {\n        refcounter_destroy(&to_unregister->refcounter);\n        array_list_remove(list, i);\n    }\n}"
  },
  {
    "path": "app/util/listeners_list.h",
    "content": "#pragma once\n\n#include \"array_list.h\"\n#include \"refcounter.h\"\n\ntypedef struct registered_listener_t {\n    const void *listener;\n    void *context;\n    refcounter_t refcounter;\n} registered_listener_t;\n\narray_list_t *listeners_list_create();\n\nvoid listeners_list_destroy(array_list_t *list);\n\nvoid listeners_list_add(array_list_t *list, const void *listener, void *context);\n\nvoid listeners_list_remove(array_list_t *list, const void *listener);\n\n#define listeners_list_notify(lst, t, f, ...) {                                     \\\n    for(int i = array_list_size(lst) - 1; i >= 0; i--) {                            \\\n        registered_listener_t *reg = array_list_get(lst, i);                        \\\n        if (reg->refcounter.counter == 0) {                                         \\\n            continue;                                                               \\\n        }                                                                           \\\n        const t *l = (const t*) reg->listener;                                      \\\n        refcounter_ref(&reg->refcounter);                                           \\\n        if (l->f) l->f(__VA_ARGS__, reg->context);                                  \\\n        if (refcounter_unref(&reg->refcounter)){                                    \\\n            refcounter_destroy(&reg->refcounter);                                   \\\n            array_list_remove(lst, i);                                              \\\n        }                                                                           \\\n    }                                                                               \\\n}                                                                                   \\\n(void) lst\n"
  },
  {
    "path": "app/util/random.c",
    "content": "#include <stdio.h>\n#include <stdlib.h>\n#include <time.h>\n#include \"random.h\"\n\nvoid random_pin(char *pin) {\n    srand(time(NULL)); // NOLINT(cert-msc51-cpp)\n    sprintf(pin, \"%04u\", rand() / (RAND_MAX / 9999)); // NOLINT(cert-msc50-cpp)\n}"
  },
  {
    "path": "app/util/random.h",
    "content": "#pragma once\n\nvoid random_pin(char *pin);"
  },
  {
    "path": "app/util/refcounter.h",
    "content": "#pragma once\n\n#include <SDL.h>\n#include <stdbool.h>\n\ntypedef struct refcounter_t {\n    int counter;\n    SDL_mutex *lock;\n} refcounter_t;\n\nstatic inline void refcounter_init(refcounter_t *counter) {\n    counter->counter = 1;\n    counter->lock = SDL_CreateMutex();\n}\n\nstatic inline void refcounter_destroy(refcounter_t *counter) {\n    SDL_assert(counter->counter == 0 && counter->lock != NULL);\n    SDL_DestroyMutex(counter->lock);\n    counter->lock = NULL;\n}\n\nstatic inline void refcounter_ref(refcounter_t *counter) {\n    SDL_assert(counter->counter > 0);\n    SDL_LockMutex(counter->lock);\n    counter->counter++;\n    SDL_UnlockMutex(counter->lock);\n}\n\nstatic inline bool refcounter_unref(refcounter_t *counter) {\n    SDL_assert(counter->counter > 0);\n    SDL_LockMutex(counter->lock);\n    counter->counter--;\n    SDL_UnlockMutex(counter->lock);\n    return counter->counter == 0;\n}"
  },
  {
    "path": "app/util/video/CMakeLists.txt",
    "content": "add_subdirectory(sps)\ntarget_link_libraries(ihsplay PRIVATE sps_util)"
  },
  {
    "path": "app/util/video/sps/CMakeLists.txt",
    "content": "add_library(sps_util STATIC sps_util_h264.c sps_util_h265.c common.c bitstream.c)\ntarget_include_directories(sps_util PUBLIC include PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})\n\nadd_subdirectory(tests)"
  },
  {
    "path": "app/util/video/sps/bitstream.c",
    "content": "\n#include \"bitstream.h\"\n\n\nvoid bitstream_init(bitstream_t *buf, const unsigned char *data, size_t size) {\n    buf->data = data;\n    buf->data_size = size;\n    buf->offset = 0;\n    buf->consecutive_zeroes = 0;\n}\n\nbool bitstream_read_bits(bitstream_t *buf, uint32_t size, uint32_t *value) {\n    if (size > 32) return false;\n    uint32_t result = 0;\n    for (uint32_t i = 0; i < size; i++) {\n        if ((buf->offset + i) % 8 == 0) {\n            uint32_t byte_index = (buf->offset + i) / 8;\n            if (byte_index >= buf->data_size) {\n                return false;\n            }\n            unsigned char b = buf->data[byte_index];\n            if (b == 0) {\n                buf->consecutive_zeroes++;\n            } else if (b == 0x03 && buf->consecutive_zeroes == 2) {\n                if (++byte_index >= buf->data_size) {\n                    return false;\n                }\n                buf->offset += 8;\n                buf->consecutive_zeroes = buf->data[byte_index] == 0;\n            } else {\n                buf->consecutive_zeroes = 0;\n            }\n        }\n        uint32_t cur_offset = buf->offset + i;\n        uint32_t byte_index = cur_offset / 8;\n        if (byte_index >= buf->data_size) {\n            return false;\n        }\n        uint8_t bit_offset = 7 - cur_offset % 8;\n        result |= (buf->data[byte_index] >> bit_offset & 0x1) << (size - i - 1);\n    }\n    buf->offset += size;\n    *value = result;\n    return true;\n}\n\n\nbool bitstream_skip_bits(bitstream_t *buf, uint32_t size) {\n    uint32_t tmp;\n    for (int i = 0; i < size; i += 16) {\n        if (!bitstream_read_bits(buf, size - i < 16 ? size - i : 16, &tmp)) return false;\n    }\n    return true;\n}\n\nbool bitstream_read_ueg(bitstream_t *buf, uint32_t *value) {\n    uint32_t bitcount = 0;\n    uint32_t tmp;\n\n    for (;;) {\n        if (!bitstream_read_bits(buf, 1, &tmp)) return false;\n        if (tmp == 0) {\n            bitcount++;\n        } else {\n            // bitOffset--;\n            break;\n        }\n    }\n\n    // bitOffset --;\n    uint32_t result = 0;\n    if (bitcount) {\n        if (!bitstream_read_bits(buf, bitcount, &tmp)) {\n            return false;\n        }\n        result = (uint32_t) ((1 << bitcount) - 1 + tmp);\n    }\n    *value = result;\n    return true;\n}\n\nbool bitstream_read_eg(bitstream_t *buf, int32_t *value) {\n    uint32_t tmp;\n    if (!bitstream_read_ueg(buf, &tmp)) {\n        return false;\n    }\n    if (tmp & 0x01) {\n        *value = (int32_t) (tmp + 1) / 2;\n    } else {\n        *value = (int32_t) -(tmp / 2);\n    }\n    return true;\n}\n\nbool bitstream_skip_scaling_list(bitstream_t *buf, uint8_t count) {\n    uint32_t lastScale = 8, nextScale = 8;\n    int32_t deltaScale;\n    for (uint8_t j = 0; j < count; j++) {\n        if (nextScale != 0) {\n            if (!bitstream_read_eg(buf, &deltaScale)) return false;\n            nextScale = (lastScale + deltaScale + 256) % 256;\n        }\n        lastScale = (nextScale == 0 ? lastScale : nextScale);\n    }\n    return true;\n}\n"
  },
  {
    "path": "app/util/video/sps/bitstream.h",
    "content": "#pragma once\n\n#include <stdint.h>\n#include <stdbool.h>\n#include <stddef.h>\n\ntypedef struct bitstream_t {\n    const unsigned char *data;\n    size_t data_size;\n    uint32_t offset;\n    uint32_t consecutive_zeroes;\n} bitstream_t;\n\nvoid bitstream_init(bitstream_t *buf, const unsigned char *data, size_t size);\n\nbool bitstream_read_bits(bitstream_t *buf, uint32_t size, uint32_t *value);\n\nbool bitstream_read_eg(bitstream_t *buf, int32_t *value);\n\nbool bitstream_read_ueg(bitstream_t *buf, uint32_t *value);\n\nbool bitstream_skip_bits(bitstream_t *buf, uint32_t size);\n\nbool bitstream_skip_scaling_list(bitstream_t *buf, uint8_t count);\n\nstatic inline bool bitstream_read1(bitstream_t *buf, bool *value) {\n    uint32_t tmp;\n    if (!bitstream_read_bits(buf, 1, &tmp)) return false;\n    *value = tmp;\n    return true;\n}\n\nstatic inline bool bitstream_read2(bitstream_t *buf, uint8_t *value) {\n    uint32_t tmp;\n    if (!bitstream_read_bits(buf, 2, &tmp)) return false;\n    *value = tmp;\n    return true;\n}\n\nstatic inline bool bitstream_read3(bitstream_t *buf, uint8_t *value) {\n    uint32_t tmp;\n    if (!bitstream_read_bits(buf, 3, &tmp)) return false;\n    *value = tmp;\n    return true;\n}\n\nstatic inline bool bitstream_read4(bitstream_t *buf, uint8_t *value) {\n    uint32_t tmp;\n    if (!bitstream_read_bits(buf, 4, &tmp)) return false;\n    *value = tmp;\n    return true;\n}\n\nstatic inline bool bitstream_read8(bitstream_t *buf, uint8_t *value) {\n    uint32_t tmp;\n    if (!bitstream_read_bits(buf, 8, &tmp)) return false;\n    *value = tmp;\n    return true;\n}\n"
  },
  {
    "path": "app/util/video/sps/common.c",
    "content": "#include \"common.h\"\n\nint sps_util_nal_skip_start_code(const unsigned char *data, size_t size, size_t begin) {\n    int consecutive_zeroes = 0;\n    bool found = false;\n    for (size_t i = begin; i < size; ++i) {\n        unsigned char b = data[i];\n        if (found) {\n            return (int) i;\n        } else if (b == 0) {\n            consecutive_zeroes++;\n        } else if (consecutive_zeroes >= 2 && b == 1) {\n            found = true;\n            continue;\n        } else {\n            consecutive_zeroes = 0;\n        }\n    }\n    return -1;\n}"
  },
  {
    "path": "app/util/video/sps/common.h",
    "content": "#pragma once\n\n#include <stddef.h>\n#include <stdint.h>\n\n#include \"bitstream.h\"\n\n#define bitstream_skip_bits_checked(s, v) if (!bitstream_skip_bits((s), (v))) return false\n\n#define bitstream_read1_checked(s, v) if (!bitstream_read1((s), (v))) return false\n\n#define bitstream_read2_checked(s, v) if (!bitstream_read2((s), (v))) return false\n\n#define bitstream_read3_checked(s, v) if (!bitstream_read3((s), (v))) return false\n\n#define bitstream_read4_checked(s, v) if (!bitstream_read4((s), (v))) return false\n\n#define bitstream_read8_checked(s, v) if (!bitstream_read8((s), (v))) return false\n\n#define bitstream_read_eg_checked(s, v) if (!bitstream_read_eg((s), (v))) return false\n\n#define bitstream_read_ueg_checked(s, v) if (!bitstream_read_ueg((s), (v))) return false\n\n#define bitstream_skip_scaling_list_checked(s, v) if (!bitstream_skip_scaling_list((s), (v))) return false\n\n#define CHECK_RETURN(ret) if (!(ret)) return false\n\n/**\n *\n * @return Index of the first byte of the NAL needed\n */\nint sps_util_nal_skip_start_code(const unsigned char *data, size_t size, size_t begin);"
  },
  {
    "path": "app/util/video/sps/include/sps_util.h",
    "content": "#pragma once\n\n#include <stdint.h>\n#include <stdbool.h>\n#include <stddef.h>\n\ntypedef struct sps_dimension_t {\n    uint16_t width;\n    uint16_t height;\n} sps_dimension_t;\n\nbool sps_util_parse_dimension_h264(const unsigned char *data, size_t size, sps_dimension_t *dimension);\n\nbool sps_util_parse_dimension_hevc(const unsigned char *data, size_t size, sps_dimension_t *dimension);"
  },
  {
    "path": "app/util/video/sps/sps_util_h264.c",
    "content": "#include \"sps_util.h\"\n#include \"bitstream.h\"\n#include \"common.h\"\n\n#define EXTENDED_SAR 255\n\nstatic bool skip_vui_parameters(bitstream_t *buf);\n\nstatic bool skip_hrd_parameters(bitstream_t *buf);\n\nbool sps_util_parse_dimension_h264(const unsigned char *data, size_t size, sps_dimension_t *dimension) {\n    int begin = 0;\n    while ((begin = sps_util_nal_skip_start_code(data, size, begin)) >= 0) {\n        if ((data[begin] & 0x1F) == 0x07/* SPS */) {\n            break;\n        }\n    }\n    if (begin < 0|| begin >= size) {\n        return false;\n    }\n    bitstream_t buf;\n    bitstream_init(&buf, data + begin, size - begin);\n\n    uint8_t subwc[] = {1, 2, 2, 1};\n    uint8_t subhc[] = {1, 2, 1, 1};\n\n    uint32_t chroma_format_idc = 1;\n\n    uint32_t width, height;\n\n    // nalu_header\n    bitstream_skip_bits_checked(&buf, 8);\n    uint8_t profile_idc;\n    bitstream_read8_checked(&buf, &profile_idc);\n    // constraint_set[0-5]_flag\n    bitstream_skip_bits_checked(&buf, 6);\n\n    /* skip reserved_zero_2bits */\n    if (!bitstream_skip_bits(&buf, 2))\n        return false;\n\n    // level_idc\n    bitstream_skip_bits_checked(&buf, 8);\n\n    uint32_t tmp;\n    // id\n    bitstream_read_ueg_checked(&buf, &tmp);\n\n    if (profile_idc == 100 || profile_idc == 110 ||\n        profile_idc == 122 || profile_idc == 244 || profile_idc == 44 ||\n        profile_idc == 83 || profile_idc == 86 || profile_idc == 118 ||\n        profile_idc == 128 || profile_idc == 138 || profile_idc == 139 ||\n        profile_idc == 134 || profile_idc == 135) {\n        if (!bitstream_read_ueg(&buf, &chroma_format_idc)) return false;\n        if (chroma_format_idc > 3) return false;\n        if (chroma_format_idc == 3) {\n            // separate_colour_plane_flag\n            bitstream_skip_bits_checked(&buf, 1);\n        }\n\n        // bit_depth_luma_minus8\n        bitstream_read_ueg_checked(&buf, &tmp);\n        // bit_depth_chroma_minus8\n        bitstream_read_ueg_checked(&buf, &tmp);\n        // qpprime_y_zero_transform_bypass_flag\n        bitstream_skip_bits_checked(&buf, 1);\n\n        bool scaling_matrix_present_flag;\n        bitstream_read1_checked(&buf, &scaling_matrix_present_flag);\n        if (scaling_matrix_present_flag) {\n            for (int i = 0; i < ((chroma_format_idc != 3) ? 8 : 12); i++) {\n                bool scaling_list_present_flag;\n                bitstream_read1_checked(&buf, &scaling_list_present_flag);\n                if (scaling_list_present_flag) {\n                    bitstream_skip_scaling_list_checked(&buf, i < 6 ? 16 : 64);\n                }\n            }\n        }\n    }\n\n    // log2_max_frame_num_minus4\n    bitstream_read_ueg_checked(&buf, &tmp);\n\n    uint32_t pic_order_cnt_type;\n    bitstream_read_ueg_checked(&buf, &pic_order_cnt_type);\n    if (pic_order_cnt_type == 0) {\n        // log2_max_pic_order_cnt_lsb_minus4\n        bitstream_read_ueg_checked(&buf, &tmp);\n    } else if (pic_order_cnt_type == 1) {\n        // delta_pic_order_always_zero_flag\n        bitstream_skip_bits_checked(&buf, 1);\n        // offset_for_non_ref_pic\n        bitstream_read_eg_checked(&buf, (int32_t *) (&tmp));\n        // offset_for_top_to_bottom_field\n        bitstream_read_eg_checked(&buf, (int32_t *) (&tmp));\n        uint32_t num_ref_frames_in_pic_order_cnt_cycle;\n        bitstream_read_ueg_checked(&buf, &num_ref_frames_in_pic_order_cnt_cycle);\n\n        for (int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) {\n            // offset_for_ref_frame[i]\n            bitstream_read_eg_checked(&buf, (int32_t *) (&tmp));\n        }\n    }\n\n    // num_ref_frames\n    bitstream_read_ueg_checked(&buf, &tmp);\n    // gaps_in_frame_num_value_allowed_flag\n    bitstream_skip_bits_checked(&buf, 1);\n    uint32_t pic_width_in_mbs_minus1;\n    if (!bitstream_read_ueg(&buf, &pic_width_in_mbs_minus1)) return false;\n    uint32_t pic_height_in_map_units_minus1;\n    if (!bitstream_read_ueg(&buf, &pic_height_in_map_units_minus1)) return false;\n\n    bool frame_mbs_only_flag = 0;\n    bitstream_read1_checked(&buf, &frame_mbs_only_flag);\n\n    if (!frame_mbs_only_flag) {\n        // mb_adaptive_frame_field_flag\n        bitstream_skip_bits_checked(&buf, 1);\n    }\n\n    // direct_8x8_inference_flag\n    bitstream_skip_bits(&buf, 1);\n    bool frame_cropping_flag;\n    bitstream_read1_checked(&buf, &frame_cropping_flag);\n    uint32_t frame_crop_left_offset = 0, frame_crop_right_offset = 0, frame_crop_top_offset = 0,\n            frame_crop_bottom_offset = 0;\n    if (frame_cropping_flag) {\n        bitstream_read_ueg_checked(&buf, &frame_crop_left_offset);\n        bitstream_read_ueg_checked(&buf, &frame_crop_right_offset);\n        bitstream_read_ueg_checked(&buf, &frame_crop_top_offset);\n        bitstream_read_ueg_checked(&buf, &frame_crop_bottom_offset);\n    }\n\n    bool vui_parameters_present_flag = false;\n    bitstream_read1_checked(&buf, &vui_parameters_present_flag);\n    if (vui_parameters_present_flag) {\n        if (!skip_vui_parameters(&buf)) return false;\n    }\n\n    /* Calculate width and height */\n    width = ((int) pic_width_in_mbs_minus1 + 1);\n    width *= 16;\n    height = ((int) pic_height_in_map_units_minus1 + 1);\n    height *= 16 * (2 - frame_mbs_only_flag);\n\n    if (frame_cropping_flag) {\n        const uint32_t crop_unit_x = subwc[chroma_format_idc];\n        const uint32_t crop_unit_y = subhc[chroma_format_idc] * (2 - frame_mbs_only_flag);\n\n        width -= (frame_crop_left_offset + frame_crop_right_offset) * crop_unit_x;\n        height -= (frame_crop_top_offset + frame_crop_bottom_offset) * crop_unit_y;\n    }\n\n    if ((int) width <= 0 || (int) height <= 0 || width % 2 != 0 || height % 2 != 0) {\n        return false;\n    }\n\n    dimension->width = width;\n    dimension->height = height;\n    return true;\n}\n\nstatic bool skip_vui_parameters(bitstream_t *buf) {\n    bool aspect_ratio_info_present_flag = false;\n    bitstream_read1_checked(buf, &aspect_ratio_info_present_flag);\n    if (aspect_ratio_info_present_flag) {\n        uint8_t aspect_ratio_idc;\n        bitstream_read8(buf, &aspect_ratio_idc);\n        if (aspect_ratio_idc == EXTENDED_SAR) {\n            // sar_width\n            bitstream_skip_bits(buf, 16);\n            // sar_height\n            bitstream_skip_bits(buf, 16);\n        }\n    }\n\n    bool overscan_info_present_flag = false;\n    bitstream_read1_checked(buf, &overscan_info_present_flag);\n    if (overscan_info_present_flag) {\n        // overscan_appropriate_flag\n        bitstream_skip_bits(buf, 1);\n    }\n\n    bool video_signal_type_present_flag = false;\n    bitstream_read1_checked(buf, &video_signal_type_present_flag);\n    if (video_signal_type_present_flag) {\n        // video_format\n        bitstream_skip_bits(buf, 3);\n        // video_full_range_flag\n        bitstream_skip_bits(buf, 1);\n        bool colour_description_present_flag = false;\n        bitstream_read1_checked(buf, &colour_description_present_flag);\n        if (colour_description_present_flag) {\n            bitstream_skip_bits(buf, 8);\n            bitstream_skip_bits(buf, 8);\n            bitstream_skip_bits(buf, 8);\n        }\n    }\n\n    bool chroma_loc_info_present_flag = false;\n    bitstream_read1_checked(buf, &chroma_loc_info_present_flag);\n    if (chroma_loc_info_present_flag) {\n        bitstream_skip_bits(buf, 5);\n        bitstream_skip_bits(buf, 5);\n    }\n\n    bool timing_info_present_flag = false;\n    bitstream_read1_checked(buf, &timing_info_present_flag);\n    if (timing_info_present_flag) {\n        // num_units_in_tick\n        bitstream_skip_bits(buf, 32);\n        // time_scale\n        bitstream_skip_bits(buf, 32);\n        // fixed_frame_rate_flag\n        bitstream_skip_bits(buf, 1);\n    }\n\n    bool nal_hrd_parameters_present_flag = false;\n    bitstream_read1_checked(buf, &nal_hrd_parameters_present_flag);\n    if (nal_hrd_parameters_present_flag) {\n        if (!skip_hrd_parameters(buf))\n            return false;\n    }\n\n    bool vcl_hrd_parameters_present_flag = false;\n    bitstream_read1_checked(buf, &vcl_hrd_parameters_present_flag);\n    if (vcl_hrd_parameters_present_flag) {\n        if (!skip_hrd_parameters(buf))\n            return false;\n    }\n\n    if (nal_hrd_parameters_present_flag || vcl_hrd_parameters_present_flag) {\n        // low_delay_hrd_flag\n        bitstream_skip_bits(buf, 1);\n    }\n\n    // pic_struct_present_flag\n    bitstream_skip_bits(buf, 1);\n    bool bitstream_restriction_flag = false;\n    bitstream_read1_checked(buf, &bitstream_restriction_flag);\n    if (bitstream_restriction_flag) {\n        // motion_vectors_over_pic_boundaries_flag\n        bitstream_skip_bits(buf, 1);\n        uint32_t tmp;\n        // max_bytes_per_pic_denom\n        bitstream_read_ueg(buf, &tmp);\n        // max_bits_per_mb_denom\n        bitstream_read_ueg(buf, &tmp);\n        // log2_max_mv_length_horizontal\n        bitstream_read_ueg(buf, &tmp);\n        // log2_max_mv_length_vertical\n        bitstream_read_ueg(buf, &tmp);\n        // num_reorder_frames\n        bitstream_read_ueg(buf, &tmp);\n        // max_dec_frame_buffering\n        bitstream_read_ueg(buf, &tmp);\n    }\n\n    return true;\n}\n\nstatic bool skip_hrd_parameters(bitstream_t *buf) {\n    uint32_t cpb_cnt_minus1;\n    bitstream_read_ueg(buf, &cpb_cnt_minus1);\n    if (cpb_cnt_minus1 > 31) return false;\n\n    // bit_rate_scale\n    bitstream_skip_bits(buf, 4);\n    // cpb_size_scale\n    bitstream_skip_bits(buf, 4);\n\n    uint32_t tmp;\n\n    for (int sched_sel_idx = 0; sched_sel_idx <= cpb_cnt_minus1; sched_sel_idx++) {\n        // bit_rate_value_minus1[sched_sel_idx]\n        bitstream_read_ueg(buf, &tmp);\n        // cpb_size_value_minus1[sched_sel_idx]\n        bitstream_read_ueg(buf, &tmp);\n        // cbr_flag[sched_sel_idx]\n        bitstream_skip_bits(buf, 1);\n    }\n\n    // initial_cpb_removal_delay_length_minus1\n    bitstream_skip_bits(buf, 5);\n    // cpb_removal_delay_length_minus1\n    bitstream_skip_bits(buf, 5);\n    // dpb_output_delay_length_minus1\n    bitstream_skip_bits(buf, 5);\n    // time_offset_length\n    bitstream_skip_bits(buf, 5);\n    return true;\n}\n"
  },
  {
    "path": "app/util/video/sps/sps_util_h265.c",
    "content": "/**\n * @see https://www.itu.int/rec/T-REC-H.265\n */\n#include <stdio.h>\n#include \"sps_util.h\"\n#include \"bitstream.h\"\n#include \"common.h\"\n\n#define EXTENDED_SAR 255\n\nstatic bool parse_profile_info(bitstream_t *buf);\n\nstatic bool parse_profile_tier_level(bitstream_t *buf, uint8_t max_sub_layers_minus1);\n\nbool sps_util_parse_dimension_hevc(const unsigned char *data, size_t size, sps_dimension_t *dimension) {\n    int begin = 0;\n    while ((begin = sps_util_nal_skip_start_code(data, size, begin)) >= 0) {\n        if ((data[begin] & 0x7E) >> 1 == 33/* SPS */) {\n            break;\n        }\n    }\n    if (begin < 0 || begin >= size) {\n        return false;\n    }\n    bitstream_t buf;\n    bitstream_init(&buf, data + begin, size - begin);\n\n    uint8_t subwc[] = {1, 2, 2, 1, 1};\n    uint8_t subhc[] = {1, 2, 1, 1, 1};\n\n    uint8_t max_sub_layers_minus1 = 0;\n\n    uint32_t tmp;\n\n    // sps_video_parameter_set_id\n    bitstream_skip_bits_checked(&buf, 4);\n    // sps_max_sub_layers_minus1\n    bitstream_read3_checked(&buf, &max_sub_layers_minus1);\n    // sps_temporal_id_nesting_flag\n    bitstream_skip_bits(&buf, 1);\n\n    if (!parse_profile_tier_level(&buf, max_sub_layers_minus1)) {\n        return false;\n    }\n\n    // seq_parameter_set_id\n    if (!bitstream_read_ueg(&buf, &tmp)) return false;\n\n    uint32_t chroma_format_idc;\n    if (!bitstream_read_ueg(&buf, &chroma_format_idc)) return false;\n    if (chroma_format_idc == 3) {\n        // separate_colour_plane_flag:1\n        bitstream_skip_bits(&buf, 1);\n    }\n\n    uint32_t pic_width_in_luma_samples;\n    uint32_t pic_height_in_luma_samples;\n    if (!bitstream_read_ueg(&buf, &pic_width_in_luma_samples)) return false;\n    if (!bitstream_read_ueg(&buf, &pic_height_in_luma_samples)) return false;\n\n    if (pic_width_in_luma_samples <= 0 || pic_height_in_luma_samples <= 0) return false;\n\n    bool conformance_window_flag = false;\n    bitstream_read1(&buf, &conformance_window_flag);\n    uint32_t conf_win_left_offset = 0, conf_win_right_offset = 0, conf_win_top_offset = 0, conf_win_bottom_offset = 0;\n    if (conformance_window_flag) {\n        bitstream_read_ueg_checked(&buf, &conf_win_left_offset);\n        bitstream_read_ueg_checked(&buf, &conf_win_right_offset);\n        bitstream_read_ueg_checked(&buf, &conf_win_top_offset);\n        bitstream_read_ueg_checked(&buf, &conf_win_bottom_offset);\n    }\n\n    uint32_t width = pic_width_in_luma_samples, height = pic_height_in_luma_samples;\n    if (conformance_window_flag) {\n        const uint8_t crop_unit_x = subwc[chroma_format_idc];\n        const uint8_t crop_unit_y = subhc[chroma_format_idc];\n        width -= (conf_win_left_offset + conf_win_right_offset) * crop_unit_x;\n        height -= (conf_win_top_offset + conf_win_bottom_offset) * crop_unit_y;\n    }\n\n    if ((int) width <= 0 || (int) height <= 0 || width % 2 != 0 || height % 2 != 0) {\n        return false;\n    }\n\n    dimension->width = width;\n    dimension->height = height;\n    return true;\n}\n\nstatic bool parse_profile_info(bitstream_t *buf) {\n    // profile_space:2\n    bitstream_skip_bits_checked(buf, 2);\n    // tier_flag:1\n    bitstream_skip_bits_checked(buf, 1);\n    // profile_idc:5\n    bitstream_skip_bits_checked(buf, 5);\n\n    for (int i = 0; i < 32; i++) {\n        // profile_compatibility_flag[i]\n        bitstream_skip_bits_checked(buf, 1);\n    }\n    // progressive_source_flag\n    bitstream_skip_bits_checked(buf, 1);\n    // interlaced_source_flag\n    bitstream_skip_bits_checked(buf, 1);\n    // non_packed_constraint_flag\n    bitstream_skip_bits_checked(buf, 1);\n    // frame_only_constraint_flag\n    bitstream_skip_bits_checked(buf, 1);\n\n    bitstream_skip_bits_checked(buf, 44);\n\n    return true;\n}\n\nstatic bool parse_profile_tier_level(bitstream_t *buf, uint8_t max_sub_layers_minus1) {\n    bool sub_layer_profile_present_flag[6];\n    bool sub_layer_level_present_flag[6];\n\n    CHECK_RETURN(parse_profile_info(buf));\n\n    // level_idc\n    bitstream_skip_bits(buf, 8);\n\n    for (int i = 0; i < max_sub_layers_minus1; i++) {\n        bitstream_read1_checked(buf, &sub_layer_profile_present_flag[i]);\n        bitstream_read1_checked(buf, &sub_layer_level_present_flag[i]);\n    }\n\n    if (max_sub_layers_minus1 > 0) {\n        for (int i = max_sub_layers_minus1; i < 8; i++) {\n            // skip 2 bits\n            bitstream_skip_bits_checked(buf, 2);\n        }\n    }\n\n    for (int i = 0; i < max_sub_layers_minus1; i++) {\n        if (sub_layer_profile_present_flag[i]) {\n            CHECK_RETURN(parse_profile_info(buf));\n        }\n\n        if (sub_layer_level_present_flag[i]) {\n            // sub_layer_level_idc[i]\n            bitstream_skip_bits_checked(buf, 8);\n        }\n    }\n    return true;\n}"
  },
  {
    "path": "app/util/video/sps/tests/CMakeLists.txt",
    "content": "add_executable(test_dimension_h265 test_dimension_h265.c)\ntarget_link_libraries(test_dimension_h265 sps_util)\n\nadd_test(test_dimension_h265 test_dimension_h265)\n\nadd_executable(test_sps_parsing sps_parser_tests.c)\ntarget_link_libraries(test_sps_parsing sps_util)\n\nadd_test(test_sps_parsing test_sps_parsing)\n\nadd_executable(test_nal_start_code test_nal_start_code.c)\ntarget_link_libraries(test_nal_start_code sps_util)\ntarget_include_directories(test_nal_start_code PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../)\n\nadd_test(test_nal_start_code test_nal_start_code)"
  },
  {
    "path": "app/util/video/sps/tests/sample_data.h",
    "content": "#pragma once\n\n#include <stdint.h>\n\nstatic const uint8_t sample_data_sps_h265_1[] = {\n        0x00, 0x00, 0x00, 0x01,\n        0x42, 0x01, 0x01, 0x21, 0x40, 0x00, 0x00, 0x03, 0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03,\n        0x00, 0x7b, 0xa0, 0x03, 0xc0, 0x80, 0x11, 0x07, 0xcb, 0x96, 0x5d, 0x29, 0x08, 0x46, 0x45, 0xfd,\n        0x0c, 0x05, 0xa8, 0x30, 0x30, 0x30, 0x20, 0x00, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x07, 0x81,\n};"
  },
  {
    "path": "app/util/video/sps/tests/sps_parser_tests.c",
    "content": "#include \"sps_util.h\"\n\n#include <assert.h>\n\nstatic const unsigned char h264_test_data[] = {\n        0x00, 0x00, 0x00, 0x01, 0x67, 0x64, 0x00, 0x2a,\n        0xac, 0x2b, 0x40, 0x3c, 0x01, 0x13, 0xf2, 0xe0,\n        0x2d, 0x41, 0x81, 0x81, 0xa9, 0x40, 0x00, 0x00,\n        0xfa, 0x00, 0x00, 0x75, 0x30, 0x23, 0xc7, 0x0a,\n        0xa8\n};\n\nstatic const unsigned char h265_test_data[] = {\n        0x00, 0x00, 0x00, 0x01, 0x42, 0x01, 0x01, 0x21,\n        0x40, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00,\n        0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x7B, 0xA0,\n        0x03, 0xC0, 0x80, 0x11, 0x07, 0xCB, 0x96, 0xB4,\n        0xA4, 0x21, 0x19, 0x2E, 0x30, 0x16, 0xA0, 0xC0,\n        0xC0, 0xD4, 0x82, 0x00, 0x00, 0x03, 0x00, 0x02,\n        0x00, 0x00, 0x03, 0x00, 0x78, 0x5F, 0x1A, 0x2D\n};\n\nvoid test_sps_parse_dimension_h264(void) {\n    sps_dimension_t dimension;\n    assert(sps_util_parse_dimension_h264(h264_test_data, sizeof(h264_test_data), &dimension));\n    assert(dimension.width == 1920);\n    assert(dimension.height == 1080);\n}\n\nvoid test_sps_parse_dimension_hevc(void) {\n    sps_dimension_t dimension;\n    assert(sps_util_parse_dimension_hevc(h265_test_data, sizeof(h265_test_data), &dimension));\n    assert(dimension.width == 1920);\n    assert(dimension.height == 1080);\n}\n\n// not needed when using generate_test_runner.rb\nint main() {\n    test_sps_parse_dimension_h264();\n    test_sps_parse_dimension_hevc();\n    return 0;\n}"
  },
  {
    "path": "app/util/video/sps/tests/test_dimension_h265.c",
    "content": "#include <assert.h>\n#include \"sample_data.h\"\n#include \"sps_util.h\"\n\nint main() {\n    sps_dimension_t dimension;\n    assert(sps_util_parse_dimension_hevc(sample_data_sps_h265_1, sizeof(sample_data_sps_h265_1), &dimension));\n    assert(dimension.width == 1920);\n    assert(dimension.height == 1080);\n    return 0;\n}"
  },
  {
    "path": "app/util/video/sps/tests/test_nal_start_code.c",
    "content": "#include <assert.h>\n#include \"common.h\"\n\nint main() {\n    unsigned char data1[] = {0x00, 0x00, 0x00, 0x01, 0x33};\n    assert(sps_util_nal_skip_start_code(data1, 5, 0) == 4);\n    unsigned char data2[] = {0x00, 0x00, 0x00, 0x02, 0x33};\n    assert(sps_util_nal_skip_start_code(data2, 5, 0) == -1);\n    unsigned char data3[] = {0x00, 0x00, 0x00, 0x00, 0x01, 0x33};\n    assert(sps_util_nal_skip_start_code(data3, 6, 0) == 5);\n    unsigned char data4[] = {0x00, 0x01};\n    assert(sps_util_nal_skip_start_code(data4, 2, 0) == -1);\n    return 0;\n}"
  },
  {
    "path": "cmake/AresPackage.cmake",
    "content": "execute_process(COMMAND ares-package \"${CPACK_TEMPORARY_DIRECTORY}\" -o \"${CPACK_PACKAGE_DIRECTORY}\"\n        -e include\n        -e cmake\n        -e pkgconfig\n        -e \"libmbedtls[.].*\"\n        -e \"libmbedx509[.].*\"\n        )\n\nfind_program(GEN_MANIFEST_CMD webosbrew-gen-manifest)\nif (GEN_MANIFEST_CMD)\n    execute_process(COMMAND \"${GEN_MANIFEST_CMD}\" -p \"${CPACK_PACKAGE_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}.ipk\"\n            -o \"${CPACK_PACKAGE_DIRECTORY}/${CPACK_PACKAGE_NAME}.manifest.json\"\n            -i \"https://github.com/mariotaku/ihsplay/raw/master/deploy/webos/largeIcon.png\"\n            -l \"https://github.com/mariotaku/ihsplay\"\n            )\nelse ()\n    message(\"Skip webOS homebrew manifest generation because command line tool is not found\")\nendif ()"
  },
  {
    "path": "cmake/CleanupNameLink.cmake",
    "content": "file(GLOB_RECURSE FOUND_LIBS \"${CPACK_TEMPORARY_INSTALL_DIRECTORY}/**/*.so*\")\n\nfunction(get_soname PATH)\n    set(SONAME PARENT_SCOPE)\n    execute_process(COMMAND objdump -p ${PATH} OUTPUT_VARIABLE OBJDUMP_OUTPUT COMMAND_ERROR_IS_FATAL ANY)\n    string(REGEX MATCH [[SONAME +([^ ]+)]] SONAME_MATCHES \"${OBJDUMP_OUTPUT}\")\n    if (SONAME_MATCHES)\n        string(STRIP \"${CMAKE_MATCH_1}\" SONAME)\n        set(SONAME ${SONAME} PARENT_SCOPE)\n    endif ()\nendfunction()\n\nforeach (FOUND_LIB ${FOUND_LIBS})\n    cmake_path(GET FOUND_LIB FILENAME LIB_BASENAME)\n    cmake_path(GET FOUND_LIB PARENT_PATH LIB_DIRNAME)\n    if (IS_SYMLINK ${FOUND_LIB})\n        message(\"Delete symlink ${LIB_BASENAME}\")\n        file(REMOVE ${FOUND_LIB})\n    else ()\n        get_soname(${FOUND_LIB})\n        if (NOT SONAME STREQUAL LIB_BASENAME)\n            message(\"Rename ${LIB_BASENAME} => ${SONAME}\")\n            file(RENAME ${FOUND_LIB} ${LIB_DIRNAME}/${SONAME})\n        endif ()\n    endif ()\nendforeach ()"
  },
  {
    "path": "cmake/PackageDebian.cmake",
    "content": "include(CPack)\n"
  },
  {
    "path": "cmake/PackageWebOS.cmake",
    "content": "get_filename_component(CMAKE_C_COMPILER_NAME \"${CMAKE_C_COMPILER}\" NAME)\nif (CMAKE_C_COMPILER_NAME MATCHES \"^arm-webos-linux-gnueabi-\")\n    set(CPACK_PACKAGE_ARCHITECTURE \"arm\")\nelse ()\n    message(FATAL_ERROR \"Unknown build architecture inferred from C compiler ${CMAKE_C_COMPILER_NAME}\")\nendif ()\n\nset(CPACK_PACKAGE_NAME \"org.mariotaku.ihsplay\")\nset(CPACK_GENERATOR \"External\")\nset(CPACK_EXTERNAL_PACKAGE_SCRIPT \"${CMAKE_SOURCE_DIR}/cmake/AresPackage.cmake\")\nset(CPACK_EXTERNAL_ENABLE_STAGING TRUE)\nset(CPACK_MONOLITHIC_INSTALL TRUE)\nset(CPACK_PACKAGE_DIRECTORY ${CMAKE_SOURCE_DIR}/dist)\nset(CPACK_PACKAGE_FILE_NAME \"${CPACK_PACKAGE_NAME}_${PROJECT_VERSION}_${CPACK_PACKAGE_ARCHITECTURE}\")\nset(CPACK_PRE_BUILD_SCRIPTS \"${CMAKE_SOURCE_DIR}/cmake/CleanupNameLink.cmake\")\n\n# Copy manifest\nconfigure_file(deploy/webos/appinfo.in.json ./appinfo.json @ONLY)\n\ninstall(TARGETS ihsplay RUNTIME DESTINATION .)\ninstall(DIRECTORY ${CMAKE_SOURCE_DIR}/deploy/webos/ DESTINATION . PATTERN \".*\" EXCLUDE PATTERN \"*.in\" EXCLUDE\n        PATTERN \"*.in.json\" EXCLUDE)\ninstall(FILES \"${CMAKE_BINARY_DIR}/appinfo.json\" DESTINATION .)\n\n# Will use all cores on CMake 3.20+\nset(CPACK_THREADS 0)\n\nif (NOT ENV{CI})\n    add_custom_target(webos-package-ihsplay COMMAND cpack DEPENDS ihsplay)\n\n    if (ENV{ARES_DEVICE})\n        set(ares_arguments \"-d\" $ENV{ARES_DEVICE})\n    endif ()\n\n    add_custom_target(webos-install-ihsplay\n            COMMAND ares-install \"${CPACK_PACKAGE_FILE_NAME}.ipk\" ${ares_arguments}\n            WORKING_DIRECTORY ${CPACK_PACKAGE_DIRECTORY}\n            DEPENDS webos-package-ihsplay\n    )\n\n    add_custom_target(webos-launch-ihsplay\n            COMMAND ares-launch \"${CPACK_PACKAGE_NAME}\" ${ares_arguments}\n            DEPENDS webos-install-ihsplay\n    )\n\nendif ()\n\ninclude(CPack)"
  },
  {
    "path": "deploy/raspbian/sysroot-packages.list",
    "content": "libsdl2-dev\nlibopus-dev\nlibmbedtls-dev\nlibraspberrypi-dev\nlibprotobuf-c-dev\nlibfreetype6-dev\nlibfontconfig-dev\nlibcec-dev"
  },
  {
    "path": "deploy/webos/appinfo.in.json",
    "content": "{\n  \"id\": \"@CPACK_PACKAGE_NAME@\",\n  \"type\": \"native\",\n  \"main\": \"ihsplay\",\n  \"icon\": \"icon.png\",\n  \"largeIcon\": \"largeIcon.png\",\n  \"iconColor\": \"#ffffff\",\n  \"title\": \"IHSplay\",\n  \"version\": \"@PROJECT_VERSION@\",\n  \"requiredPermissions\": [\n    \"settings\",\n    \"activities.callbacks\"\n  ],\n  \"supportTouchMode\": \"full\"\n}"
  },
  {
    "path": "tests/CMakeLists.txt",
    "content": "enable_testing()\n\nfunction(ihsplay_add_test NAME)\n    cmake_parse_arguments(TEST \"\" \"\" \"SOURCES;ARGS;INCLUDES;LIBRARIES\" ${ARGN})\n    set(IHSPLAY_TEST_CASE \"ihsplay_test_${NAME}\")\n\n    add_executable(${IHSPLAY_TEST_CASE} ${TEST_SOURCES})\n    target_include_directories(${IHSPLAY_TEST_CASE} PRIVATE ${CMAKE_SOURCE_DIR}/app ${TEST_INCLUDES})\n    if (TEST_LIBRARIES)\n        target_link_libraries(${IHSPLAY_TEST_CASE} PRIVATE ${TEST_LIBRARIES})\n    endif ()\n    set_target_properties(${IHSPLAY_TEST_CASE} PROPERTIES\n            BUILD_WITH_INSTALL_RPATH TRUE\n            INSTALL_RPATH_USE_LINK_PATH TRUE\n            INSTALL_RPATH \"${IHSPLAY_MODULE_LIBRARY_OUTPUT_DIRECTORY}\")\n\n    add_test(${NAME} ${IHSPLAY_TEST_CASE} ${TEST_ARGS})\n    set_tests_properties(${NAME} PROPERTIES SKIP_RETURN_CODE 127)\n    set(IHSPLAY_TEST_CASE ${IHSPLAY_TEST_CASE} PARENT_SCOPE)\nendfunction()\n\nadd_subdirectory(app)"
  },
  {
    "path": "tests/app/CMakeLists.txt",
    "content": "add_subdirectory(utils)"
  },
  {
    "path": "tests/app/utils/CMakeLists.txt",
    "content": ""
  },
  {
    "path": "tools/resource-tools/.gitignore",
    "content": "node_modules/"
  },
  {
    "path": "tools/resource-tools/.nvmrc",
    "content": "16"
  },
  {
    "path": "tools/resource-tools/async-transform.ts",
    "content": "import {BufferFile, StreamFile} from \"vinyl\";\nimport through2 from \"through2\";\nimport * as stream from \"stream\";\n\ntype File = BufferFile | StreamFile;\n\nexport default function asyncTransform(fn: (file: BufferFile | StreamFile) => Promise<File | void>): stream.Transform {\n    return through2.obj((file, _, cb) => fn(file)\n        .then(ret => cb(null, ret || file))\n        .catch(e => cb(e)));\n}"
  },
  {
    "path": "tools/resource-tools/binheader.ts",
    "content": "import {BufferFile} from \"vinyl\";\nimport {camelCase, constantCase, pascalCase, snakeCase} from \"change-case\";\nimport asyncTransform from \"./async-transform\";\n\nexport type Case = 'camelCase' | 'PascalCase' | 'snake_case' | 'UPPER_CASE';\n\nexport interface Option {\n    naming: Case;\n    prefix: string;\n}\n\nfunction joinWithCase(segments: string[], naming: Case): string {\n    switch (naming) {\n        case \"camelCase\": {\n            return camelCase(segments.map(s => pascalCase(s)).join());\n        }\n        case \"PascalCase\": {\n            return segments.map(s => pascalCase(s)).join();\n        }\n        case \"UPPER_CASE\": {\n            return segments.map(s => constantCase(s)).join('_');\n        }\n        case \"snake_case\": {\n            return segments.map(s => snakeCase(s)).join('_');\n        }\n    }\n}\n\nexport default function binHeader(option?: Partial<Option>) {\n    option = option || {};\n    return asyncTransform(async file => {\n        if (!file.isBuffer()) {\n            throw new Error('Only buffer file is supported!');\n        }\n        const bf = file as BufferFile;\n        const buffer = bf.contents;\n        const hexArray = buffer.toJSON().data.map(item => {\n            return `0x${item.toString(16).padStart(2, '0')}`\n        });\n        const naming = option.naming ?? 'snake_case';\n        const dataSymbol = joinWithCase([option.prefix, bf.stem, 'data'].filter(v => v), naming);\n        const sizeSymbol = joinWithCase([option.prefix, bf.stem, 'size'].filter(v => v), naming);\n\n        let source = '#pragma once\\n';\n        source += `const unsigned char ${dataSymbol}[] = {\\n`;\n        const cols = 16;\n        for (let i = 0; i < hexArray.length; i += cols) {\n            source += `  ${hexArray.slice(i, Math.min(i + cols, hexArray.length)).join(', ')},\\n`;\n        }\n        source += '};\\n';\n        source += `extern const unsigned char ${dataSymbol}[];\\n`;\n        source += `#define ${sizeSymbol} ${buffer.length}\\n`;\n\n        bf.contents = Buffer.from(source);\n        bf.extname = '.h';\n    });\n}"
  },
  {
    "path": "tools/resource-tools/codepoints.ts",
    "content": "import fs from \"fs/promises\";\nimport asyncTransform from \"./async-transform\";\nimport {R_OK} from \"constants\";\nimport {pickBy} from 'lodash';\n\nasync function codepointsList(path: string, type: string, filter: ((name: string) => boolean)): Promise<Record<string, number>> {\n    const content = await fs.readFile(path, {encoding: 'utf-8'});\n    switch (type) {\n        case '.codepoints': {\n            const lines: string[] = content.split('\\n');\n            return Object.fromEntries(lines.map((line): [string, number] => {\n                const split = line.trim().split(' ');\n                if (split.length !== 2 || !filter(split[0])) return null;\n                return [split[0], Number.parseInt(split[1], 16)];\n            }).filter(v => v));\n        }\n        case '.json': {\n            return pickBy(JSON.parse(content), (value, key) => filter(key));\n        }\n        default: {\n            throw new Error(`Unsupported file ${path}`);\n        }\n    }\n}\n\nasync function selectedList(path: string): Promise<string[]> {\n    const lines = (await fs.readFile(path, {encoding: 'utf-8'})).split('\\n');\n    return lines.map(line => line.trim()).filter(v => v);\n}\n\nexport default function codepoints() {\n    return asyncTransform(async file => {\n        const lstFile = file.clone();\n        lstFile.extname = '.list';\n        const list = await selectedList(lstFile.path);\n        file.list = list;\n\n        const cpFile = file.clone();\n        cpFile.extname = '.codepoints';\n        try {\n            await fs.access(cpFile.path, R_OK)\n        } catch (e) {\n            cpFile.extname = '.json';\n        }\n        file.codepoints = await codepointsList(cpFile.path, cpFile.extname, cp => list.includes(cp));\n        return file;\n    });\n}"
  },
  {
    "path": "tools/resource-tools/gulp-subset-font.ts",
    "content": "import asyncTransform from \"./async-transform\";\nimport sf from 'subset-font';\nimport {BufferFile} from \"vinyl\";\n\nexport default function subsetFont(text: string | ((file: File) => string)) {\n    return asyncTransform(async file => {\n        if (!file.isBuffer()) {\n            throw new Error('Only buffer file is supported!');\n        }\n        const bf = file as BufferFile;\n        const buffer = bf.contents;\n        bf.contents = await sf(buffer, typeof text === 'function' ? text(file) : text, {\n            targetFormat: 'truetype'\n        });\n        bf.extname = '.ttf';\n    });\n}"
  },
  {
    "path": "tools/resource-tools/gulpfile.ts",
    "content": "import {dest, parallel, src} from \"gulp\";\nimport binheader from \"./binheader\";\nimport codepoints from \"./codepoints\";\nimport rename from \"gulp-rename\";\nimport subsetFont from \"./gulp-subset-font\";\nimport symheader from \"./symheader\";\n\nconst outDir = '../../app/lvgl/fonts/bootstrap-icons';\n\nfunction codepointsMetadata(file: any): Record<string, number> {\n    return file.codepoints;\n}\n\nasync function iconfont() {\n    return src('res/bootstrap-icons.woff2')\n        .pipe(codepoints())\n        .pipe(subsetFont(file => String.fromCodePoint(...Object.values(codepointsMetadata(file)))))\n        .pipe(binheader({naming: 'snake_case', prefix: 'ttf'}))\n        .pipe(rename(file => {\n            file.basename = 'regular';\n        }))\n        .pipe(dest(outDir));\n}\n\nasync function symlist() {\n    return src('res/bootstrap-icons.woff2')\n        .pipe(codepoints())\n        .pipe(symheader({prefix: 'BS'}))\n        .pipe(rename(file => {\n            file.basename = 'symbols';\n        }))\n        .pipe(dest(outDir));\n}\n\nexports['iconfonts'] = parallel(iconfont, symlist);"
  },
  {
    "path": "tools/resource-tools/package.json",
    "content": "{\n  \"name\": \"ihsplay-tools\",\n  \"version\": \"1.0.0\",\n  \"private\": true,\n  \"description\": \"\",\n  \"scripts\": {\n    \"iconfonts\": \"gulp iconfonts\"\n  },\n  \"engines\": {\n    \"node\": \">=14\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"devDependencies\": {\n    \"@types/fontmin\": \"^0.9.0\",\n    \"@types/gulp\": \"^4.0.9\",\n    \"@types/gulp-rename\": \"^2.0.1\",\n    \"@types/lodash\": \"^4.14.191\",\n    \"@types/subset-font\": \"^1.4.0\",\n    \"@types/through2\": \"^2.0.36\",\n    \"change-case\": \"^4.1.2\",\n    \"gulp\": \"^4.0.2\",\n    \"gulp-flatmap\": \"^1.0.2\",\n    \"gulp-rename\": \"^2.0.0\",\n    \"lodash\": \"^4.17.21\",\n    \"subset-font\": \"^1.6.1\",\n    \"through2\": \"^4.0.2\",\n    \"ts-node\": \"^10.9.1\",\n    \"typescript\": \"^4.8.3\"\n  }\n}\n"
  },
  {
    "path": "tools/resource-tools/res/bootstrap-icons.json",
    "content": "{\n  \"123\": 63103,\n  \"alarm-fill\": 61697,\n  \"alarm\": 61698,\n  \"align-bottom\": 61699,\n  \"align-center\": 61700,\n  \"align-end\": 61701,\n  \"align-middle\": 61702,\n  \"align-start\": 61703,\n  \"align-top\": 61704,\n  \"alt\": 61705,\n  \"app-indicator\": 61706,\n  \"app\": 61707,\n  \"archive-fill\": 61708,\n  \"archive\": 61709,\n  \"arrow-90deg-down\": 61710,\n  \"arrow-90deg-left\": 61711,\n  \"arrow-90deg-right\": 61712,\n  \"arrow-90deg-up\": 61713,\n  \"arrow-bar-down\": 61714,\n  \"arrow-bar-left\": 61715,\n  \"arrow-bar-right\": 61716,\n  \"arrow-bar-up\": 61717,\n  \"arrow-clockwise\": 61718,\n  \"arrow-counterclockwise\": 61719,\n  \"arrow-down-circle-fill\": 61720,\n  \"arrow-down-circle\": 61721,\n  \"arrow-down-left-circle-fill\": 61722,\n  \"arrow-down-left-circle\": 61723,\n  \"arrow-down-left-square-fill\": 61724,\n  \"arrow-down-left-square\": 61725,\n  \"arrow-down-left\": 61726,\n  \"arrow-down-right-circle-fill\": 61727,\n  \"arrow-down-right-circle\": 61728,\n  \"arrow-down-right-square-fill\": 61729,\n  \"arrow-down-right-square\": 61730,\n  \"arrow-down-right\": 61731,\n  \"arrow-down-short\": 61732,\n  \"arrow-down-square-fill\": 61733,\n  \"arrow-down-square\": 61734,\n  \"arrow-down-up\": 61735,\n  \"arrow-down\": 61736,\n  \"arrow-left-circle-fill\": 61737,\n  \"arrow-left-circle\": 61738,\n  \"arrow-left-right\": 61739,\n  \"arrow-left-short\": 61740,\n  \"arrow-left-square-fill\": 61741,\n  \"arrow-left-square\": 61742,\n  \"arrow-left\": 61743,\n  \"arrow-repeat\": 61744,\n  \"arrow-return-left\": 61745,\n  \"arrow-return-right\": 61746,\n  \"arrow-right-circle-fill\": 61747,\n  \"arrow-right-circle\": 61748,\n  \"arrow-right-short\": 61749,\n  \"arrow-right-square-fill\": 61750,\n  \"arrow-right-square\": 61751,\n  \"arrow-right\": 61752,\n  \"arrow-up-circle-fill\": 61753,\n  \"arrow-up-circle\": 61754,\n  \"arrow-up-left-circle-fill\": 61755,\n  \"arrow-up-left-circle\": 61756,\n  \"arrow-up-left-square-fill\": 61757,\n  \"arrow-up-left-square\": 61758,\n  \"arrow-up-left\": 61759,\n  \"arrow-up-right-circle-fill\": 61760,\n  \"arrow-up-right-circle\": 61761,\n  \"arrow-up-right-square-fill\": 61762,\n  \"arrow-up-right-square\": 61763,\n  \"arrow-up-right\": 61764,\n  \"arrow-up-short\": 61765,\n  \"arrow-up-square-fill\": 61766,\n  \"arrow-up-square\": 61767,\n  \"arrow-up\": 61768,\n  \"arrows-angle-contract\": 61769,\n  \"arrows-angle-expand\": 61770,\n  \"arrows-collapse\": 61771,\n  \"arrows-expand\": 61772,\n  \"arrows-fullscreen\": 61773,\n  \"arrows-move\": 61774,\n  \"aspect-ratio-fill\": 61775,\n  \"aspect-ratio\": 61776,\n  \"asterisk\": 61777,\n  \"at\": 61778,\n  \"award-fill\": 61779,\n  \"award\": 61780,\n  \"back\": 61781,\n  \"backspace-fill\": 61782,\n  \"backspace-reverse-fill\": 61783,\n  \"backspace-reverse\": 61784,\n  \"backspace\": 61785,\n  \"badge-3d-fill\": 61786,\n  \"badge-3d\": 61787,\n  \"badge-4k-fill\": 61788,\n  \"badge-4k\": 61789,\n  \"badge-8k-fill\": 61790,\n  \"badge-8k\": 61791,\n  \"badge-ad-fill\": 61792,\n  \"badge-ad\": 61793,\n  \"badge-ar-fill\": 61794,\n  \"badge-ar\": 61795,\n  \"badge-cc-fill\": 61796,\n  \"badge-cc\": 61797,\n  \"badge-hd-fill\": 61798,\n  \"badge-hd\": 61799,\n  \"badge-tm-fill\": 61800,\n  \"badge-tm\": 61801,\n  \"badge-vo-fill\": 61802,\n  \"badge-vo\": 61803,\n  \"badge-vr-fill\": 61804,\n  \"badge-vr\": 61805,\n  \"badge-wc-fill\": 61806,\n  \"badge-wc\": 61807,\n  \"bag-check-fill\": 61808,\n  \"bag-check\": 61809,\n  \"bag-dash-fill\": 61810,\n  \"bag-dash\": 61811,\n  \"bag-fill\": 61812,\n  \"bag-plus-fill\": 61813,\n  \"bag-plus\": 61814,\n  \"bag-x-fill\": 61815,\n  \"bag-x\": 61816,\n  \"bag\": 61817,\n  \"bar-chart-fill\": 61818,\n  \"bar-chart-line-fill\": 61819,\n  \"bar-chart-line\": 61820,\n  \"bar-chart-steps\": 61821,\n  \"bar-chart\": 61822,\n  \"basket-fill\": 61823,\n  \"basket\": 61824,\n  \"basket2-fill\": 61825,\n  \"basket2\": 61826,\n  \"basket3-fill\": 61827,\n  \"basket3\": 61828,\n  \"battery-charging\": 61829,\n  \"battery-full\": 61830,\n  \"battery-half\": 61831,\n  \"battery\": 61832,\n  \"bell-fill\": 61833,\n  \"bell\": 61834,\n  \"bezier\": 61835,\n  \"bezier2\": 61836,\n  \"bicycle\": 61837,\n  \"binoculars-fill\": 61838,\n  \"binoculars\": 61839,\n  \"blockquote-left\": 61840,\n  \"blockquote-right\": 61841,\n  \"book-fill\": 61842,\n  \"book-half\": 61843,\n  \"book\": 61844,\n  \"bookmark-check-fill\": 61845,\n  \"bookmark-check\": 61846,\n  \"bookmark-dash-fill\": 61847,\n  \"bookmark-dash\": 61848,\n  \"bookmark-fill\": 61849,\n  \"bookmark-heart-fill\": 61850,\n  \"bookmark-heart\": 61851,\n  \"bookmark-plus-fill\": 61852,\n  \"bookmark-plus\": 61853,\n  \"bookmark-star-fill\": 61854,\n  \"bookmark-star\": 61855,\n  \"bookmark-x-fill\": 61856,\n  \"bookmark-x\": 61857,\n  \"bookmark\": 61858,\n  \"bookmarks-fill\": 61859,\n  \"bookmarks\": 61860,\n  \"bookshelf\": 61861,\n  \"bootstrap-fill\": 61862,\n  \"bootstrap-reboot\": 61863,\n  \"bootstrap\": 61864,\n  \"border-all\": 61865,\n  \"border-bottom\": 61866,\n  \"border-center\": 61867,\n  \"border-inner\": 61868,\n  \"border-left\": 61869,\n  \"border-middle\": 61870,\n  \"border-outer\": 61871,\n  \"border-right\": 61872,\n  \"border-style\": 61873,\n  \"border-top\": 61874,\n  \"border-width\": 61875,\n  \"border\": 61876,\n  \"bounding-box-circles\": 61877,\n  \"bounding-box\": 61878,\n  \"box-arrow-down-left\": 61879,\n  \"box-arrow-down-right\": 61880,\n  \"box-arrow-down\": 61881,\n  \"box-arrow-in-down-left\": 61882,\n  \"box-arrow-in-down-right\": 61883,\n  \"box-arrow-in-down\": 61884,\n  \"box-arrow-in-left\": 61885,\n  \"box-arrow-in-right\": 61886,\n  \"box-arrow-in-up-left\": 61887,\n  \"box-arrow-in-up-right\": 61888,\n  \"box-arrow-in-up\": 61889,\n  \"box-arrow-left\": 61890,\n  \"box-arrow-right\": 61891,\n  \"box-arrow-up-left\": 61892,\n  \"box-arrow-up-right\": 61893,\n  \"box-arrow-up\": 61894,\n  \"box-seam\": 61895,\n  \"box\": 61896,\n  \"braces\": 61897,\n  \"bricks\": 61898,\n  \"briefcase-fill\": 61899,\n  \"briefcase\": 61900,\n  \"brightness-alt-high-fill\": 61901,\n  \"brightness-alt-high\": 61902,\n  \"brightness-alt-low-fill\": 61903,\n  \"brightness-alt-low\": 61904,\n  \"brightness-high-fill\": 61905,\n  \"brightness-high\": 61906,\n  \"brightness-low-fill\": 61907,\n  \"brightness-low\": 61908,\n  \"broadcast-pin\": 61909,\n  \"broadcast\": 61910,\n  \"brush-fill\": 61911,\n  \"brush\": 61912,\n  \"bucket-fill\": 61913,\n  \"bucket\": 61914,\n  \"bug-fill\": 61915,\n  \"bug\": 61916,\n  \"building\": 61917,\n  \"bullseye\": 61918,\n  \"calculator-fill\": 61919,\n  \"calculator\": 61920,\n  \"calendar-check-fill\": 61921,\n  \"calendar-check\": 61922,\n  \"calendar-date-fill\": 61923,\n  \"calendar-date\": 61924,\n  \"calendar-day-fill\": 61925,\n  \"calendar-day\": 61926,\n  \"calendar-event-fill\": 61927,\n  \"calendar-event\": 61928,\n  \"calendar-fill\": 61929,\n  \"calendar-minus-fill\": 61930,\n  \"calendar-minus\": 61931,\n  \"calendar-month-fill\": 61932,\n  \"calendar-month\": 61933,\n  \"calendar-plus-fill\": 61934,\n  \"calendar-plus\": 61935,\n  \"calendar-range-fill\": 61936,\n  \"calendar-range\": 61937,\n  \"calendar-week-fill\": 61938,\n  \"calendar-week\": 61939,\n  \"calendar-x-fill\": 61940,\n  \"calendar-x\": 61941,\n  \"calendar\": 61942,\n  \"calendar2-check-fill\": 61943,\n  \"calendar2-check\": 61944,\n  \"calendar2-date-fill\": 61945,\n  \"calendar2-date\": 61946,\n  \"calendar2-day-fill\": 61947,\n  \"calendar2-day\": 61948,\n  \"calendar2-event-fill\": 61949,\n  \"calendar2-event\": 61950,\n  \"calendar2-fill\": 61951,\n  \"calendar2-minus-fill\": 61952,\n  \"calendar2-minus\": 61953,\n  \"calendar2-month-fill\": 61954,\n  \"calendar2-month\": 61955,\n  \"calendar2-plus-fill\": 61956,\n  \"calendar2-plus\": 61957,\n  \"calendar2-range-fill\": 61958,\n  \"calendar2-range\": 61959,\n  \"calendar2-week-fill\": 61960,\n  \"calendar2-week\": 61961,\n  \"calendar2-x-fill\": 61962,\n  \"calendar2-x\": 61963,\n  \"calendar2\": 61964,\n  \"calendar3-event-fill\": 61965,\n  \"calendar3-event\": 61966,\n  \"calendar3-fill\": 61967,\n  \"calendar3-range-fill\": 61968,\n  \"calendar3-range\": 61969,\n  \"calendar3-week-fill\": 61970,\n  \"calendar3-week\": 61971,\n  \"calendar3\": 61972,\n  \"calendar4-event\": 61973,\n  \"calendar4-range\": 61974,\n  \"calendar4-week\": 61975,\n  \"calendar4\": 61976,\n  \"camera-fill\": 61977,\n  \"camera-reels-fill\": 61978,\n  \"camera-reels\": 61979,\n  \"camera-video-fill\": 61980,\n  \"camera-video-off-fill\": 61981,\n  \"camera-video-off\": 61982,\n  \"camera-video\": 61983,\n  \"camera\": 61984,\n  \"camera2\": 61985,\n  \"capslock-fill\": 61986,\n  \"capslock\": 61987,\n  \"card-checklist\": 61988,\n  \"card-heading\": 61989,\n  \"card-image\": 61990,\n  \"card-list\": 61991,\n  \"card-text\": 61992,\n  \"caret-down-fill\": 61993,\n  \"caret-down-square-fill\": 61994,\n  \"caret-down-square\": 61995,\n  \"caret-down\": 61996,\n  \"caret-left-fill\": 61997,\n  \"caret-left-square-fill\": 61998,\n  \"caret-left-square\": 61999,\n  \"caret-left\": 62000,\n  \"caret-right-fill\": 62001,\n  \"caret-right-square-fill\": 62002,\n  \"caret-right-square\": 62003,\n  \"caret-right\": 62004,\n  \"caret-up-fill\": 62005,\n  \"caret-up-square-fill\": 62006,\n  \"caret-up-square\": 62007,\n  \"caret-up\": 62008,\n  \"cart-check-fill\": 62009,\n  \"cart-check\": 62010,\n  \"cart-dash-fill\": 62011,\n  \"cart-dash\": 62012,\n  \"cart-fill\": 62013,\n  \"cart-plus-fill\": 62014,\n  \"cart-plus\": 62015,\n  \"cart-x-fill\": 62016,\n  \"cart-x\": 62017,\n  \"cart\": 62018,\n  \"cart2\": 62019,\n  \"cart3\": 62020,\n  \"cart4\": 62021,\n  \"cash-stack\": 62022,\n  \"cash\": 62023,\n  \"cast\": 62024,\n  \"chat-dots-fill\": 62025,\n  \"chat-dots\": 62026,\n  \"chat-fill\": 62027,\n  \"chat-left-dots-fill\": 62028,\n  \"chat-left-dots\": 62029,\n  \"chat-left-fill\": 62030,\n  \"chat-left-quote-fill\": 62031,\n  \"chat-left-quote\": 62032,\n  \"chat-left-text-fill\": 62033,\n  \"chat-left-text\": 62034,\n  \"chat-left\": 62035,\n  \"chat-quote-fill\": 62036,\n  \"chat-quote\": 62037,\n  \"chat-right-dots-fill\": 62038,\n  \"chat-right-dots\": 62039,\n  \"chat-right-fill\": 62040,\n  \"chat-right-quote-fill\": 62041,\n  \"chat-right-quote\": 62042,\n  \"chat-right-text-fill\": 62043,\n  \"chat-right-text\": 62044,\n  \"chat-right\": 62045,\n  \"chat-square-dots-fill\": 62046,\n  \"chat-square-dots\": 62047,\n  \"chat-square-fill\": 62048,\n  \"chat-square-quote-fill\": 62049,\n  \"chat-square-quote\": 62050,\n  \"chat-square-text-fill\": 62051,\n  \"chat-square-text\": 62052,\n  \"chat-square\": 62053,\n  \"chat-text-fill\": 62054,\n  \"chat-text\": 62055,\n  \"chat\": 62056,\n  \"check-all\": 62057,\n  \"check-circle-fill\": 62058,\n  \"check-circle\": 62059,\n  \"check-square-fill\": 62060,\n  \"check-square\": 62061,\n  \"check\": 62062,\n  \"check2-all\": 62063,\n  \"check2-circle\": 62064,\n  \"check2-square\": 62065,\n  \"check2\": 62066,\n  \"chevron-bar-contract\": 62067,\n  \"chevron-bar-down\": 62068,\n  \"chevron-bar-expand\": 62069,\n  \"chevron-bar-left\": 62070,\n  \"chevron-bar-right\": 62071,\n  \"chevron-bar-up\": 62072,\n  \"chevron-compact-down\": 62073,\n  \"chevron-compact-left\": 62074,\n  \"chevron-compact-right\": 62075,\n  \"chevron-compact-up\": 62076,\n  \"chevron-contract\": 62077,\n  \"chevron-double-down\": 62078,\n  \"chevron-double-left\": 62079,\n  \"chevron-double-right\": 62080,\n  \"chevron-double-up\": 62081,\n  \"chevron-down\": 62082,\n  \"chevron-expand\": 62083,\n  \"chevron-left\": 62084,\n  \"chevron-right\": 62085,\n  \"chevron-up\": 62086,\n  \"circle-fill\": 62087,\n  \"circle-half\": 62088,\n  \"circle-square\": 62089,\n  \"circle\": 62090,\n  \"clipboard-check\": 62091,\n  \"clipboard-data\": 62092,\n  \"clipboard-minus\": 62093,\n  \"clipboard-plus\": 62094,\n  \"clipboard-x\": 62095,\n  \"clipboard\": 62096,\n  \"clock-fill\": 62097,\n  \"clock-history\": 62098,\n  \"clock\": 62099,\n  \"cloud-arrow-down-fill\": 62100,\n  \"cloud-arrow-down\": 62101,\n  \"cloud-arrow-up-fill\": 62102,\n  \"cloud-arrow-up\": 62103,\n  \"cloud-check-fill\": 62104,\n  \"cloud-check\": 62105,\n  \"cloud-download-fill\": 62106,\n  \"cloud-download\": 62107,\n  \"cloud-drizzle-fill\": 62108,\n  \"cloud-drizzle\": 62109,\n  \"cloud-fill\": 62110,\n  \"cloud-fog-fill\": 62111,\n  \"cloud-fog\": 62112,\n  \"cloud-fog2-fill\": 62113,\n  \"cloud-fog2\": 62114,\n  \"cloud-hail-fill\": 62115,\n  \"cloud-hail\": 62116,\n  \"cloud-haze-1\": 62117,\n  \"cloud-haze-fill\": 62118,\n  \"cloud-haze\": 62119,\n  \"cloud-haze2-fill\": 62120,\n  \"cloud-lightning-fill\": 62121,\n  \"cloud-lightning-rain-fill\": 62122,\n  \"cloud-lightning-rain\": 62123,\n  \"cloud-lightning\": 62124,\n  \"cloud-minus-fill\": 62125,\n  \"cloud-minus\": 62126,\n  \"cloud-moon-fill\": 62127,\n  \"cloud-moon\": 62128,\n  \"cloud-plus-fill\": 62129,\n  \"cloud-plus\": 62130,\n  \"cloud-rain-fill\": 62131,\n  \"cloud-rain-heavy-fill\": 62132,\n  \"cloud-rain-heavy\": 62133,\n  \"cloud-rain\": 62134,\n  \"cloud-slash-fill\": 62135,\n  \"cloud-slash\": 62136,\n  \"cloud-sleet-fill\": 62137,\n  \"cloud-sleet\": 62138,\n  \"cloud-snow-fill\": 62139,\n  \"cloud-snow\": 62140,\n  \"cloud-sun-fill\": 62141,\n  \"cloud-sun\": 62142,\n  \"cloud-upload-fill\": 62143,\n  \"cloud-upload\": 62144,\n  \"cloud\": 62145,\n  \"clouds-fill\": 62146,\n  \"clouds\": 62147,\n  \"cloudy-fill\": 62148,\n  \"cloudy\": 62149,\n  \"code-slash\": 62150,\n  \"code-square\": 62151,\n  \"code\": 62152,\n  \"collection-fill\": 62153,\n  \"collection-play-fill\": 62154,\n  \"collection-play\": 62155,\n  \"collection\": 62156,\n  \"columns-gap\": 62157,\n  \"columns\": 62158,\n  \"command\": 62159,\n  \"compass-fill\": 62160,\n  \"compass\": 62161,\n  \"cone-striped\": 62162,\n  \"cone\": 62163,\n  \"controller\": 62164,\n  \"cpu-fill\": 62165,\n  \"cpu\": 62166,\n  \"credit-card-2-back-fill\": 62167,\n  \"credit-card-2-back\": 62168,\n  \"credit-card-2-front-fill\": 62169,\n  \"credit-card-2-front\": 62170,\n  \"credit-card-fill\": 62171,\n  \"credit-card\": 62172,\n  \"crop\": 62173,\n  \"cup-fill\": 62174,\n  \"cup-straw\": 62175,\n  \"cup\": 62176,\n  \"cursor-fill\": 62177,\n  \"cursor-text\": 62178,\n  \"cursor\": 62179,\n  \"dash-circle-dotted\": 62180,\n  \"dash-circle-fill\": 62181,\n  \"dash-circle\": 62182,\n  \"dash-square-dotted\": 62183,\n  \"dash-square-fill\": 62184,\n  \"dash-square\": 62185,\n  \"dash\": 62186,\n  \"diagram-2-fill\": 62187,\n  \"diagram-2\": 62188,\n  \"diagram-3-fill\": 62189,\n  \"diagram-3\": 62190,\n  \"diamond-fill\": 62191,\n  \"diamond-half\": 62192,\n  \"diamond\": 62193,\n  \"dice-1-fill\": 62194,\n  \"dice-1\": 62195,\n  \"dice-2-fill\": 62196,\n  \"dice-2\": 62197,\n  \"dice-3-fill\": 62198,\n  \"dice-3\": 62199,\n  \"dice-4-fill\": 62200,\n  \"dice-4\": 62201,\n  \"dice-5-fill\": 62202,\n  \"dice-5\": 62203,\n  \"dice-6-fill\": 62204,\n  \"dice-6\": 62205,\n  \"disc-fill\": 62206,\n  \"disc\": 62207,\n  \"discord\": 62208,\n  \"display-fill\": 62209,\n  \"display\": 62210,\n  \"distribute-horizontal\": 62211,\n  \"distribute-vertical\": 62212,\n  \"door-closed-fill\": 62213,\n  \"door-closed\": 62214,\n  \"door-open-fill\": 62215,\n  \"door-open\": 62216,\n  \"dot\": 62217,\n  \"download\": 62218,\n  \"droplet-fill\": 62219,\n  \"droplet-half\": 62220,\n  \"droplet\": 62221,\n  \"earbuds\": 62222,\n  \"easel-fill\": 62223,\n  \"easel\": 62224,\n  \"egg-fill\": 62225,\n  \"egg-fried\": 62226,\n  \"egg\": 62227,\n  \"eject-fill\": 62228,\n  \"eject\": 62229,\n  \"emoji-angry-fill\": 62230,\n  \"emoji-angry\": 62231,\n  \"emoji-dizzy-fill\": 62232,\n  \"emoji-dizzy\": 62233,\n  \"emoji-expressionless-fill\": 62234,\n  \"emoji-expressionless\": 62235,\n  \"emoji-frown-fill\": 62236,\n  \"emoji-frown\": 62237,\n  \"emoji-heart-eyes-fill\": 62238,\n  \"emoji-heart-eyes\": 62239,\n  \"emoji-laughing-fill\": 62240,\n  \"emoji-laughing\": 62241,\n  \"emoji-neutral-fill\": 62242,\n  \"emoji-neutral\": 62243,\n  \"emoji-smile-fill\": 62244,\n  \"emoji-smile-upside-down-fill\": 62245,\n  \"emoji-smile-upside-down\": 62246,\n  \"emoji-smile\": 62247,\n  \"emoji-sunglasses-fill\": 62248,\n  \"emoji-sunglasses\": 62249,\n  \"emoji-wink-fill\": 62250,\n  \"emoji-wink\": 62251,\n  \"envelope-fill\": 62252,\n  \"envelope-open-fill\": 62253,\n  \"envelope-open\": 62254,\n  \"envelope\": 62255,\n  \"eraser-fill\": 62256,\n  \"eraser\": 62257,\n  \"exclamation-circle-fill\": 62258,\n  \"exclamation-circle\": 62259,\n  \"exclamation-diamond-fill\": 62260,\n  \"exclamation-diamond\": 62261,\n  \"exclamation-octagon-fill\": 62262,\n  \"exclamation-octagon\": 62263,\n  \"exclamation-square-fill\": 62264,\n  \"exclamation-square\": 62265,\n  \"exclamation-triangle-fill\": 62266,\n  \"exclamation-triangle\": 62267,\n  \"exclamation\": 62268,\n  \"exclude\": 62269,\n  \"eye-fill\": 62270,\n  \"eye-slash-fill\": 62271,\n  \"eye-slash\": 62272,\n  \"eye\": 62273,\n  \"eyedropper\": 62274,\n  \"eyeglasses\": 62275,\n  \"facebook\": 62276,\n  \"file-arrow-down-fill\": 62277,\n  \"file-arrow-down\": 62278,\n  \"file-arrow-up-fill\": 62279,\n  \"file-arrow-up\": 62280,\n  \"file-bar-graph-fill\": 62281,\n  \"file-bar-graph\": 62282,\n  \"file-binary-fill\": 62283,\n  \"file-binary\": 62284,\n  \"file-break-fill\": 62285,\n  \"file-break\": 62286,\n  \"file-check-fill\": 62287,\n  \"file-check\": 62288,\n  \"file-code-fill\": 62289,\n  \"file-code\": 62290,\n  \"file-diff-fill\": 62291,\n  \"file-diff\": 62292,\n  \"file-earmark-arrow-down-fill\": 62293,\n  \"file-earmark-arrow-down\": 62294,\n  \"file-earmark-arrow-up-fill\": 62295,\n  \"file-earmark-arrow-up\": 62296,\n  \"file-earmark-bar-graph-fill\": 62297,\n  \"file-earmark-bar-graph\": 62298,\n  \"file-earmark-binary-fill\": 62299,\n  \"file-earmark-binary\": 62300,\n  \"file-earmark-break-fill\": 62301,\n  \"file-earmark-break\": 62302,\n  \"file-earmark-check-fill\": 62303,\n  \"file-earmark-check\": 62304,\n  \"file-earmark-code-fill\": 62305,\n  \"file-earmark-code\": 62306,\n  \"file-earmark-diff-fill\": 62307,\n  \"file-earmark-diff\": 62308,\n  \"file-earmark-easel-fill\": 62309,\n  \"file-earmark-easel\": 62310,\n  \"file-earmark-excel-fill\": 62311,\n  \"file-earmark-excel\": 62312,\n  \"file-earmark-fill\": 62313,\n  \"file-earmark-font-fill\": 62314,\n  \"file-earmark-font\": 62315,\n  \"file-earmark-image-fill\": 62316,\n  \"file-earmark-image\": 62317,\n  \"file-earmark-lock-fill\": 62318,\n  \"file-earmark-lock\": 62319,\n  \"file-earmark-lock2-fill\": 62320,\n  \"file-earmark-lock2\": 62321,\n  \"file-earmark-medical-fill\": 62322,\n  \"file-earmark-medical\": 62323,\n  \"file-earmark-minus-fill\": 62324,\n  \"file-earmark-minus\": 62325,\n  \"file-earmark-music-fill\": 62326,\n  \"file-earmark-music\": 62327,\n  \"file-earmark-person-fill\": 62328,\n  \"file-earmark-person\": 62329,\n  \"file-earmark-play-fill\": 62330,\n  \"file-earmark-play\": 62331,\n  \"file-earmark-plus-fill\": 62332,\n  \"file-earmark-plus\": 62333,\n  \"file-earmark-post-fill\": 62334,\n  \"file-earmark-post\": 62335,\n  \"file-earmark-ppt-fill\": 62336,\n  \"file-earmark-ppt\": 62337,\n  \"file-earmark-richtext-fill\": 62338,\n  \"file-earmark-richtext\": 62339,\n  \"file-earmark-ruled-fill\": 62340,\n  \"file-earmark-ruled\": 62341,\n  \"file-earmark-slides-fill\": 62342,\n  \"file-earmark-slides\": 62343,\n  \"file-earmark-spreadsheet-fill\": 62344,\n  \"file-earmark-spreadsheet\": 62345,\n  \"file-earmark-text-fill\": 62346,\n  \"file-earmark-text\": 62347,\n  \"file-earmark-word-fill\": 62348,\n  \"file-earmark-word\": 62349,\n  \"file-earmark-x-fill\": 62350,\n  \"file-earmark-x\": 62351,\n  \"file-earmark-zip-fill\": 62352,\n  \"file-earmark-zip\": 62353,\n  \"file-earmark\": 62354,\n  \"file-easel-fill\": 62355,\n  \"file-easel\": 62356,\n  \"file-excel-fill\": 62357,\n  \"file-excel\": 62358,\n  \"file-fill\": 62359,\n  \"file-font-fill\": 62360,\n  \"file-font\": 62361,\n  \"file-image-fill\": 62362,\n  \"file-image\": 62363,\n  \"file-lock-fill\": 62364,\n  \"file-lock\": 62365,\n  \"file-lock2-fill\": 62366,\n  \"file-lock2\": 62367,\n  \"file-medical-fill\": 62368,\n  \"file-medical\": 62369,\n  \"file-minus-fill\": 62370,\n  \"file-minus\": 62371,\n  \"file-music-fill\": 62372,\n  \"file-music\": 62373,\n  \"file-person-fill\": 62374,\n  \"file-person\": 62375,\n  \"file-play-fill\": 62376,\n  \"file-play\": 62377,\n  \"file-plus-fill\": 62378,\n  \"file-plus\": 62379,\n  \"file-post-fill\": 62380,\n  \"file-post\": 62381,\n  \"file-ppt-fill\": 62382,\n  \"file-ppt\": 62383,\n  \"file-richtext-fill\": 62384,\n  \"file-richtext\": 62385,\n  \"file-ruled-fill\": 62386,\n  \"file-ruled\": 62387,\n  \"file-slides-fill\": 62388,\n  \"file-slides\": 62389,\n  \"file-spreadsheet-fill\": 62390,\n  \"file-spreadsheet\": 62391,\n  \"file-text-fill\": 62392,\n  \"file-text\": 62393,\n  \"file-word-fill\": 62394,\n  \"file-word\": 62395,\n  \"file-x-fill\": 62396,\n  \"file-x\": 62397,\n  \"file-zip-fill\": 62398,\n  \"file-zip\": 62399,\n  \"file\": 62400,\n  \"files-alt\": 62401,\n  \"files\": 62402,\n  \"film\": 62403,\n  \"filter-circle-fill\": 62404,\n  \"filter-circle\": 62405,\n  \"filter-left\": 62406,\n  \"filter-right\": 62407,\n  \"filter-square-fill\": 62408,\n  \"filter-square\": 62409,\n  \"filter\": 62410,\n  \"flag-fill\": 62411,\n  \"flag\": 62412,\n  \"flower1\": 62413,\n  \"flower2\": 62414,\n  \"flower3\": 62415,\n  \"folder-check\": 62416,\n  \"folder-fill\": 62417,\n  \"folder-minus\": 62418,\n  \"folder-plus\": 62419,\n  \"folder-symlink-fill\": 62420,\n  \"folder-symlink\": 62421,\n  \"folder-x\": 62422,\n  \"folder\": 62423,\n  \"folder2-open\": 62424,\n  \"folder2\": 62425,\n  \"fonts\": 62426,\n  \"forward-fill\": 62427,\n  \"forward\": 62428,\n  \"front\": 62429,\n  \"fullscreen-exit\": 62430,\n  \"fullscreen\": 62431,\n  \"funnel-fill\": 62432,\n  \"funnel\": 62433,\n  \"gear-fill\": 62434,\n  \"gear-wide-connected\": 62435,\n  \"gear-wide\": 62436,\n  \"gear\": 62437,\n  \"gem\": 62438,\n  \"geo-alt-fill\": 62439,\n  \"geo-alt\": 62440,\n  \"geo-fill\": 62441,\n  \"geo\": 62442,\n  \"gift-fill\": 62443,\n  \"gift\": 62444,\n  \"github\": 62445,\n  \"globe\": 62446,\n  \"globe2\": 62447,\n  \"google\": 62448,\n  \"graph-down\": 62449,\n  \"graph-up\": 62450,\n  \"grid-1x2-fill\": 62451,\n  \"grid-1x2\": 62452,\n  \"grid-3x2-gap-fill\": 62453,\n  \"grid-3x2-gap\": 62454,\n  \"grid-3x2\": 62455,\n  \"grid-3x3-gap-fill\": 62456,\n  \"grid-3x3-gap\": 62457,\n  \"grid-3x3\": 62458,\n  \"grid-fill\": 62459,\n  \"grid\": 62460,\n  \"grip-horizontal\": 62461,\n  \"grip-vertical\": 62462,\n  \"hammer\": 62463,\n  \"hand-index-fill\": 62464,\n  \"hand-index-thumb-fill\": 62465,\n  \"hand-index-thumb\": 62466,\n  \"hand-index\": 62467,\n  \"hand-thumbs-down-fill\": 62468,\n  \"hand-thumbs-down\": 62469,\n  \"hand-thumbs-up-fill\": 62470,\n  \"hand-thumbs-up\": 62471,\n  \"handbag-fill\": 62472,\n  \"handbag\": 62473,\n  \"hash\": 62474,\n  \"hdd-fill\": 62475,\n  \"hdd-network-fill\": 62476,\n  \"hdd-network\": 62477,\n  \"hdd-rack-fill\": 62478,\n  \"hdd-rack\": 62479,\n  \"hdd-stack-fill\": 62480,\n  \"hdd-stack\": 62481,\n  \"hdd\": 62482,\n  \"headphones\": 62483,\n  \"headset\": 62484,\n  \"heart-fill\": 62485,\n  \"heart-half\": 62486,\n  \"heart\": 62487,\n  \"heptagon-fill\": 62488,\n  \"heptagon-half\": 62489,\n  \"heptagon\": 62490,\n  \"hexagon-fill\": 62491,\n  \"hexagon-half\": 62492,\n  \"hexagon\": 62493,\n  \"hourglass-bottom\": 62494,\n  \"hourglass-split\": 62495,\n  \"hourglass-top\": 62496,\n  \"hourglass\": 62497,\n  \"house-door-fill\": 62498,\n  \"house-door\": 62499,\n  \"house-fill\": 62500,\n  \"house\": 62501,\n  \"hr\": 62502,\n  \"hurricane\": 62503,\n  \"image-alt\": 62504,\n  \"image-fill\": 62505,\n  \"image\": 62506,\n  \"images\": 62507,\n  \"inbox-fill\": 62508,\n  \"inbox\": 62509,\n  \"inboxes-fill\": 62510,\n  \"inboxes\": 62511,\n  \"info-circle-fill\": 62512,\n  \"info-circle\": 62513,\n  \"info-square-fill\": 62514,\n  \"info-square\": 62515,\n  \"info\": 62516,\n  \"input-cursor-text\": 62517,\n  \"input-cursor\": 62518,\n  \"instagram\": 62519,\n  \"intersect\": 62520,\n  \"journal-album\": 62521,\n  \"journal-arrow-down\": 62522,\n  \"journal-arrow-up\": 62523,\n  \"journal-bookmark-fill\": 62524,\n  \"journal-bookmark\": 62525,\n  \"journal-check\": 62526,\n  \"journal-code\": 62527,\n  \"journal-medical\": 62528,\n  \"journal-minus\": 62529,\n  \"journal-plus\": 62530,\n  \"journal-richtext\": 62531,\n  \"journal-text\": 62532,\n  \"journal-x\": 62533,\n  \"journal\": 62534,\n  \"journals\": 62535,\n  \"joystick\": 62536,\n  \"justify-left\": 62537,\n  \"justify-right\": 62538,\n  \"justify\": 62539,\n  \"kanban-fill\": 62540,\n  \"kanban\": 62541,\n  \"key-fill\": 62542,\n  \"key\": 62543,\n  \"keyboard-fill\": 62544,\n  \"keyboard\": 62545,\n  \"ladder\": 62546,\n  \"lamp-fill\": 62547,\n  \"lamp\": 62548,\n  \"laptop-fill\": 62549,\n  \"laptop\": 62550,\n  \"layer-backward\": 62551,\n  \"layer-forward\": 62552,\n  \"layers-fill\": 62553,\n  \"layers-half\": 62554,\n  \"layers\": 62555,\n  \"layout-sidebar-inset-reverse\": 62556,\n  \"layout-sidebar-inset\": 62557,\n  \"layout-sidebar-reverse\": 62558,\n  \"layout-sidebar\": 62559,\n  \"layout-split\": 62560,\n  \"layout-text-sidebar-reverse\": 62561,\n  \"layout-text-sidebar\": 62562,\n  \"layout-text-window-reverse\": 62563,\n  \"layout-text-window\": 62564,\n  \"layout-three-columns\": 62565,\n  \"layout-wtf\": 62566,\n  \"life-preserver\": 62567,\n  \"lightbulb-fill\": 62568,\n  \"lightbulb-off-fill\": 62569,\n  \"lightbulb-off\": 62570,\n  \"lightbulb\": 62571,\n  \"lightning-charge-fill\": 62572,\n  \"lightning-charge\": 62573,\n  \"lightning-fill\": 62574,\n  \"lightning\": 62575,\n  \"link-45deg\": 62576,\n  \"link\": 62577,\n  \"linkedin\": 62578,\n  \"list-check\": 62579,\n  \"list-nested\": 62580,\n  \"list-ol\": 62581,\n  \"list-stars\": 62582,\n  \"list-task\": 62583,\n  \"list-ul\": 62584,\n  \"list\": 62585,\n  \"lock-fill\": 62586,\n  \"lock\": 62587,\n  \"mailbox\": 62588,\n  \"mailbox2\": 62589,\n  \"map-fill\": 62590,\n  \"map\": 62591,\n  \"markdown-fill\": 62592,\n  \"markdown\": 62593,\n  \"mask\": 62594,\n  \"megaphone-fill\": 62595,\n  \"megaphone\": 62596,\n  \"menu-app-fill\": 62597,\n  \"menu-app\": 62598,\n  \"menu-button-fill\": 62599,\n  \"menu-button-wide-fill\": 62600,\n  \"menu-button-wide\": 62601,\n  \"menu-button\": 62602,\n  \"menu-down\": 62603,\n  \"menu-up\": 62604,\n  \"mic-fill\": 62605,\n  \"mic-mute-fill\": 62606,\n  \"mic-mute\": 62607,\n  \"mic\": 62608,\n  \"minecart-loaded\": 62609,\n  \"minecart\": 62610,\n  \"moisture\": 62611,\n  \"moon-fill\": 62612,\n  \"moon-stars-fill\": 62613,\n  \"moon-stars\": 62614,\n  \"moon\": 62615,\n  \"mouse-fill\": 62616,\n  \"mouse\": 62617,\n  \"mouse2-fill\": 62618,\n  \"mouse2\": 62619,\n  \"mouse3-fill\": 62620,\n  \"mouse3\": 62621,\n  \"music-note-beamed\": 62622,\n  \"music-note-list\": 62623,\n  \"music-note\": 62624,\n  \"music-player-fill\": 62625,\n  \"music-player\": 62626,\n  \"newspaper\": 62627,\n  \"node-minus-fill\": 62628,\n  \"node-minus\": 62629,\n  \"node-plus-fill\": 62630,\n  \"node-plus\": 62631,\n  \"nut-fill\": 62632,\n  \"nut\": 62633,\n  \"octagon-fill\": 62634,\n  \"octagon-half\": 62635,\n  \"octagon\": 62636,\n  \"option\": 62637,\n  \"outlet\": 62638,\n  \"paint-bucket\": 62639,\n  \"palette-fill\": 62640,\n  \"palette\": 62641,\n  \"palette2\": 62642,\n  \"paperclip\": 62643,\n  \"paragraph\": 62644,\n  \"patch-check-fill\": 62645,\n  \"patch-check\": 62646,\n  \"patch-exclamation-fill\": 62647,\n  \"patch-exclamation\": 62648,\n  \"patch-minus-fill\": 62649,\n  \"patch-minus\": 62650,\n  \"patch-plus-fill\": 62651,\n  \"patch-plus\": 62652,\n  \"patch-question-fill\": 62653,\n  \"patch-question\": 62654,\n  \"pause-btn-fill\": 62655,\n  \"pause-btn\": 62656,\n  \"pause-circle-fill\": 62657,\n  \"pause-circle\": 62658,\n  \"pause-fill\": 62659,\n  \"pause\": 62660,\n  \"peace-fill\": 62661,\n  \"peace\": 62662,\n  \"pen-fill\": 62663,\n  \"pen\": 62664,\n  \"pencil-fill\": 62665,\n  \"pencil-square\": 62666,\n  \"pencil\": 62667,\n  \"pentagon-fill\": 62668,\n  \"pentagon-half\": 62669,\n  \"pentagon\": 62670,\n  \"people-fill\": 62671,\n  \"people\": 62672,\n  \"percent\": 62673,\n  \"person-badge-fill\": 62674,\n  \"person-badge\": 62675,\n  \"person-bounding-box\": 62676,\n  \"person-check-fill\": 62677,\n  \"person-check\": 62678,\n  \"person-circle\": 62679,\n  \"person-dash-fill\": 62680,\n  \"person-dash\": 62681,\n  \"person-fill\": 62682,\n  \"person-lines-fill\": 62683,\n  \"person-plus-fill\": 62684,\n  \"person-plus\": 62685,\n  \"person-square\": 62686,\n  \"person-x-fill\": 62687,\n  \"person-x\": 62688,\n  \"person\": 62689,\n  \"phone-fill\": 62690,\n  \"phone-landscape-fill\": 62691,\n  \"phone-landscape\": 62692,\n  \"phone-vibrate-fill\": 62693,\n  \"phone-vibrate\": 62694,\n  \"phone\": 62695,\n  \"pie-chart-fill\": 62696,\n  \"pie-chart\": 62697,\n  \"pin-angle-fill\": 62698,\n  \"pin-angle\": 62699,\n  \"pin-fill\": 62700,\n  \"pin\": 62701,\n  \"pip-fill\": 62702,\n  \"pip\": 62703,\n  \"play-btn-fill\": 62704,\n  \"play-btn\": 62705,\n  \"play-circle-fill\": 62706,\n  \"play-circle\": 62707,\n  \"play-fill\": 62708,\n  \"play\": 62709,\n  \"plug-fill\": 62710,\n  \"plug\": 62711,\n  \"plus-circle-dotted\": 62712,\n  \"plus-circle-fill\": 62713,\n  \"plus-circle\": 62714,\n  \"plus-square-dotted\": 62715,\n  \"plus-square-fill\": 62716,\n  \"plus-square\": 62717,\n  \"plus\": 62718,\n  \"power\": 62719,\n  \"printer-fill\": 62720,\n  \"printer\": 62721,\n  \"puzzle-fill\": 62722,\n  \"puzzle\": 62723,\n  \"question-circle-fill\": 62724,\n  \"question-circle\": 62725,\n  \"question-diamond-fill\": 62726,\n  \"question-diamond\": 62727,\n  \"question-octagon-fill\": 62728,\n  \"question-octagon\": 62729,\n  \"question-square-fill\": 62730,\n  \"question-square\": 62731,\n  \"question\": 62732,\n  \"rainbow\": 62733,\n  \"receipt-cutoff\": 62734,\n  \"receipt\": 62735,\n  \"reception-0\": 62736,\n  \"reception-1\": 62737,\n  \"reception-2\": 62738,\n  \"reception-3\": 62739,\n  \"reception-4\": 62740,\n  \"record-btn-fill\": 62741,\n  \"record-btn\": 62742,\n  \"record-circle-fill\": 62743,\n  \"record-circle\": 62744,\n  \"record-fill\": 62745,\n  \"record\": 62746,\n  \"record2-fill\": 62747,\n  \"record2\": 62748,\n  \"reply-all-fill\": 62749,\n  \"reply-all\": 62750,\n  \"reply-fill\": 62751,\n  \"reply\": 62752,\n  \"rss-fill\": 62753,\n  \"rss\": 62754,\n  \"rulers\": 62755,\n  \"save-fill\": 62756,\n  \"save\": 62757,\n  \"save2-fill\": 62758,\n  \"save2\": 62759,\n  \"scissors\": 62760,\n  \"screwdriver\": 62761,\n  \"search\": 62762,\n  \"segmented-nav\": 62763,\n  \"server\": 62764,\n  \"share-fill\": 62765,\n  \"share\": 62766,\n  \"shield-check\": 62767,\n  \"shield-exclamation\": 62768,\n  \"shield-fill-check\": 62769,\n  \"shield-fill-exclamation\": 62770,\n  \"shield-fill-minus\": 62771,\n  \"shield-fill-plus\": 62772,\n  \"shield-fill-x\": 62773,\n  \"shield-fill\": 62774,\n  \"shield-lock-fill\": 62775,\n  \"shield-lock\": 62776,\n  \"shield-minus\": 62777,\n  \"shield-plus\": 62778,\n  \"shield-shaded\": 62779,\n  \"shield-slash-fill\": 62780,\n  \"shield-slash\": 62781,\n  \"shield-x\": 62782,\n  \"shield\": 62783,\n  \"shift-fill\": 62784,\n  \"shift\": 62785,\n  \"shop-window\": 62786,\n  \"shop\": 62787,\n  \"shuffle\": 62788,\n  \"signpost-2-fill\": 62789,\n  \"signpost-2\": 62790,\n  \"signpost-fill\": 62791,\n  \"signpost-split-fill\": 62792,\n  \"signpost-split\": 62793,\n  \"signpost\": 62794,\n  \"sim-fill\": 62795,\n  \"sim\": 62796,\n  \"skip-backward-btn-fill\": 62797,\n  \"skip-backward-btn\": 62798,\n  \"skip-backward-circle-fill\": 62799,\n  \"skip-backward-circle\": 62800,\n  \"skip-backward-fill\": 62801,\n  \"skip-backward\": 62802,\n  \"skip-end-btn-fill\": 62803,\n  \"skip-end-btn\": 62804,\n  \"skip-end-circle-fill\": 62805,\n  \"skip-end-circle\": 62806,\n  \"skip-end-fill\": 62807,\n  \"skip-end\": 62808,\n  \"skip-forward-btn-fill\": 62809,\n  \"skip-forward-btn\": 62810,\n  \"skip-forward-circle-fill\": 62811,\n  \"skip-forward-circle\": 62812,\n  \"skip-forward-fill\": 62813,\n  \"skip-forward\": 62814,\n  \"skip-start-btn-fill\": 62815,\n  \"skip-start-btn\": 62816,\n  \"skip-start-circle-fill\": 62817,\n  \"skip-start-circle\": 62818,\n  \"skip-start-fill\": 62819,\n  \"skip-start\": 62820,\n  \"slack\": 62821,\n  \"slash-circle-fill\": 62822,\n  \"slash-circle\": 62823,\n  \"slash-square-fill\": 62824,\n  \"slash-square\": 62825,\n  \"slash\": 62826,\n  \"sliders\": 62827,\n  \"smartwatch\": 62828,\n  \"snow\": 62829,\n  \"snow2\": 62830,\n  \"snow3\": 62831,\n  \"sort-alpha-down-alt\": 62832,\n  \"sort-alpha-down\": 62833,\n  \"sort-alpha-up-alt\": 62834,\n  \"sort-alpha-up\": 62835,\n  \"sort-down-alt\": 62836,\n  \"sort-down\": 62837,\n  \"sort-numeric-down-alt\": 62838,\n  \"sort-numeric-down\": 62839,\n  \"sort-numeric-up-alt\": 62840,\n  \"sort-numeric-up\": 62841,\n  \"sort-up-alt\": 62842,\n  \"sort-up\": 62843,\n  \"soundwave\": 62844,\n  \"speaker-fill\": 62845,\n  \"speaker\": 62846,\n  \"speedometer\": 62847,\n  \"speedometer2\": 62848,\n  \"spellcheck\": 62849,\n  \"square-fill\": 62850,\n  \"square-half\": 62851,\n  \"square\": 62852,\n  \"stack\": 62853,\n  \"star-fill\": 62854,\n  \"star-half\": 62855,\n  \"star\": 62856,\n  \"stars\": 62857,\n  \"stickies-fill\": 62858,\n  \"stickies\": 62859,\n  \"sticky-fill\": 62860,\n  \"sticky\": 62861,\n  \"stop-btn-fill\": 62862,\n  \"stop-btn\": 62863,\n  \"stop-circle-fill\": 62864,\n  \"stop-circle\": 62865,\n  \"stop-fill\": 62866,\n  \"stop\": 62867,\n  \"stoplights-fill\": 62868,\n  \"stoplights\": 62869,\n  \"stopwatch-fill\": 62870,\n  \"stopwatch\": 62871,\n  \"subtract\": 62872,\n  \"suit-club-fill\": 62873,\n  \"suit-club\": 62874,\n  \"suit-diamond-fill\": 62875,\n  \"suit-diamond\": 62876,\n  \"suit-heart-fill\": 62877,\n  \"suit-heart\": 62878,\n  \"suit-spade-fill\": 62879,\n  \"suit-spade\": 62880,\n  \"sun-fill\": 62881,\n  \"sun\": 62882,\n  \"sunglasses\": 62883,\n  \"sunrise-fill\": 62884,\n  \"sunrise\": 62885,\n  \"sunset-fill\": 62886,\n  \"sunset\": 62887,\n  \"symmetry-horizontal\": 62888,\n  \"symmetry-vertical\": 62889,\n  \"table\": 62890,\n  \"tablet-fill\": 62891,\n  \"tablet-landscape-fill\": 62892,\n  \"tablet-landscape\": 62893,\n  \"tablet\": 62894,\n  \"tag-fill\": 62895,\n  \"tag\": 62896,\n  \"tags-fill\": 62897,\n  \"tags\": 62898,\n  \"telegram\": 62899,\n  \"telephone-fill\": 62900,\n  \"telephone-forward-fill\": 62901,\n  \"telephone-forward\": 62902,\n  \"telephone-inbound-fill\": 62903,\n  \"telephone-inbound\": 62904,\n  \"telephone-minus-fill\": 62905,\n  \"telephone-minus\": 62906,\n  \"telephone-outbound-fill\": 62907,\n  \"telephone-outbound\": 62908,\n  \"telephone-plus-fill\": 62909,\n  \"telephone-plus\": 62910,\n  \"telephone-x-fill\": 62911,\n  \"telephone-x\": 62912,\n  \"telephone\": 62913,\n  \"terminal-fill\": 62914,\n  \"terminal\": 62915,\n  \"text-center\": 62916,\n  \"text-indent-left\": 62917,\n  \"text-indent-right\": 62918,\n  \"text-left\": 62919,\n  \"text-paragraph\": 62920,\n  \"text-right\": 62921,\n  \"textarea-resize\": 62922,\n  \"textarea-t\": 62923,\n  \"textarea\": 62924,\n  \"thermometer-half\": 62925,\n  \"thermometer-high\": 62926,\n  \"thermometer-low\": 62927,\n  \"thermometer-snow\": 62928,\n  \"thermometer-sun\": 62929,\n  \"thermometer\": 62930,\n  \"three-dots-vertical\": 62931,\n  \"three-dots\": 62932,\n  \"toggle-off\": 62933,\n  \"toggle-on\": 62934,\n  \"toggle2-off\": 62935,\n  \"toggle2-on\": 62936,\n  \"toggles\": 62937,\n  \"toggles2\": 62938,\n  \"tools\": 62939,\n  \"tornado\": 62940,\n  \"trash-fill\": 62941,\n  \"trash\": 62942,\n  \"trash2-fill\": 62943,\n  \"trash2\": 62944,\n  \"tree-fill\": 62945,\n  \"tree\": 62946,\n  \"triangle-fill\": 62947,\n  \"triangle-half\": 62948,\n  \"triangle\": 62949,\n  \"trophy-fill\": 62950,\n  \"trophy\": 62951,\n  \"tropical-storm\": 62952,\n  \"truck-flatbed\": 62953,\n  \"truck\": 62954,\n  \"tsunami\": 62955,\n  \"tv-fill\": 62956,\n  \"tv\": 62957,\n  \"twitch\": 62958,\n  \"twitter\": 62959,\n  \"type-bold\": 62960,\n  \"type-h1\": 62961,\n  \"type-h2\": 62962,\n  \"type-h3\": 62963,\n  \"type-italic\": 62964,\n  \"type-strikethrough\": 62965,\n  \"type-underline\": 62966,\n  \"type\": 62967,\n  \"ui-checks-grid\": 62968,\n  \"ui-checks\": 62969,\n  \"ui-radios-grid\": 62970,\n  \"ui-radios\": 62971,\n  \"umbrella-fill\": 62972,\n  \"umbrella\": 62973,\n  \"union\": 62974,\n  \"unlock-fill\": 62975,\n  \"unlock\": 62976,\n  \"upc-scan\": 62977,\n  \"upc\": 62978,\n  \"upload\": 62979,\n  \"vector-pen\": 62980,\n  \"view-list\": 62981,\n  \"view-stacked\": 62982,\n  \"vinyl-fill\": 62983,\n  \"vinyl\": 62984,\n  \"voicemail\": 62985,\n  \"volume-down-fill\": 62986,\n  \"volume-down\": 62987,\n  \"volume-mute-fill\": 62988,\n  \"volume-mute\": 62989,\n  \"volume-off-fill\": 62990,\n  \"volume-off\": 62991,\n  \"volume-up-fill\": 62992,\n  \"volume-up\": 62993,\n  \"vr\": 62994,\n  \"wallet-fill\": 62995,\n  \"wallet\": 62996,\n  \"wallet2\": 62997,\n  \"watch\": 62998,\n  \"water\": 62999,\n  \"whatsapp\": 63000,\n  \"wifi-1\": 63001,\n  \"wifi-2\": 63002,\n  \"wifi-off\": 63003,\n  \"wifi\": 63004,\n  \"wind\": 63005,\n  \"window-dock\": 63006,\n  \"window-sidebar\": 63007,\n  \"window\": 63008,\n  \"wrench\": 63009,\n  \"x-circle-fill\": 63010,\n  \"x-circle\": 63011,\n  \"x-diamond-fill\": 63012,\n  \"x-diamond\": 63013,\n  \"x-octagon-fill\": 63014,\n  \"x-octagon\": 63015,\n  \"x-square-fill\": 63016,\n  \"x-square\": 63017,\n  \"x\": 63018,\n  \"youtube\": 63019,\n  \"zoom-in\": 63020,\n  \"zoom-out\": 63021,\n  \"bank\": 63022,\n  \"bank2\": 63023,\n  \"bell-slash-fill\": 63024,\n  \"bell-slash\": 63025,\n  \"cash-coin\": 63026,\n  \"check-lg\": 63027,\n  \"coin\": 63028,\n  \"currency-bitcoin\": 63029,\n  \"currency-dollar\": 63030,\n  \"currency-euro\": 63031,\n  \"currency-exchange\": 63032,\n  \"currency-pound\": 63033,\n  \"currency-yen\": 63034,\n  \"dash-lg\": 63035,\n  \"exclamation-lg\": 63036,\n  \"file-earmark-pdf-fill\": 63037,\n  \"file-earmark-pdf\": 63038,\n  \"file-pdf-fill\": 63039,\n  \"file-pdf\": 63040,\n  \"gender-ambiguous\": 63041,\n  \"gender-female\": 63042,\n  \"gender-male\": 63043,\n  \"gender-trans\": 63044,\n  \"headset-vr\": 63045,\n  \"info-lg\": 63046,\n  \"mastodon\": 63047,\n  \"messenger\": 63048,\n  \"piggy-bank-fill\": 63049,\n  \"piggy-bank\": 63050,\n  \"pin-map-fill\": 63051,\n  \"pin-map\": 63052,\n  \"plus-lg\": 63053,\n  \"question-lg\": 63054,\n  \"recycle\": 63055,\n  \"reddit\": 63056,\n  \"safe-fill\": 63057,\n  \"safe2-fill\": 63058,\n  \"safe2\": 63059,\n  \"sd-card-fill\": 63060,\n  \"sd-card\": 63061,\n  \"skype\": 63062,\n  \"slash-lg\": 63063,\n  \"translate\": 63064,\n  \"x-lg\": 63065,\n  \"safe\": 63066,\n  \"apple\": 63067,\n  \"microsoft\": 63069,\n  \"windows\": 63070,\n  \"behance\": 63068,\n  \"dribbble\": 63071,\n  \"line\": 63072,\n  \"medium\": 63073,\n  \"paypal\": 63074,\n  \"pinterest\": 63075,\n  \"signal\": 63076,\n  \"snapchat\": 63077,\n  \"spotify\": 63078,\n  \"stack-overflow\": 63079,\n  \"strava\": 63080,\n  \"wordpress\": 63081,\n  \"vimeo\": 63082,\n  \"activity\": 63083,\n  \"easel2-fill\": 63084,\n  \"easel2\": 63085,\n  \"easel3-fill\": 63086,\n  \"easel3\": 63087,\n  \"fan\": 63088,\n  \"fingerprint\": 63089,\n  \"graph-down-arrow\": 63090,\n  \"graph-up-arrow\": 63091,\n  \"hypnotize\": 63092,\n  \"magic\": 63093,\n  \"person-rolodex\": 63094,\n  \"person-video\": 63095,\n  \"person-video2\": 63096,\n  \"person-video3\": 63097,\n  \"person-workspace\": 63098,\n  \"radioactive\": 63099,\n  \"webcam-fill\": 63100,\n  \"webcam\": 63101,\n  \"yin-yang\": 63102,\n  \"bandaid-fill\": 63104,\n  \"bandaid\": 63105,\n  \"bluetooth\": 63106,\n  \"body-text\": 63107,\n  \"boombox\": 63108,\n  \"boxes\": 63109,\n  \"dpad-fill\": 63110,\n  \"dpad\": 63111,\n  \"ear-fill\": 63112,\n  \"ear\": 63113,\n  \"envelope-check-1\": 63114,\n  \"envelope-check-fill\": 63115,\n  \"envelope-check\": 63116,\n  \"envelope-dash-1\": 63117,\n  \"envelope-dash-fill\": 63118,\n  \"envelope-dash\": 63119,\n  \"envelope-exclamation-1\": 63120,\n  \"envelope-exclamation-fill\": 63121,\n  \"envelope-exclamation\": 63122,\n  \"envelope-plus-fill\": 63123,\n  \"envelope-plus\": 63124,\n  \"envelope-slash-1\": 63125,\n  \"envelope-slash-fill\": 63126,\n  \"envelope-slash\": 63127,\n  \"envelope-x-1\": 63128,\n  \"envelope-x-fill\": 63129,\n  \"envelope-x\": 63130,\n  \"explicit-fill\": 63131,\n  \"explicit\": 63132,\n  \"git\": 63133,\n  \"infinity\": 63134,\n  \"list-columns-reverse\": 63135,\n  \"list-columns\": 63136,\n  \"meta\": 63137,\n  \"mortorboard-fill\": 63138,\n  \"mortorboard\": 63139,\n  \"nintendo-switch\": 63140,\n  \"pc-display-horizontal\": 63141,\n  \"pc-display\": 63142,\n  \"pc-horizontal\": 63143,\n  \"pc\": 63144,\n  \"playstation\": 63145,\n  \"plus-slash-minus\": 63146,\n  \"projector-fill\": 63147,\n  \"projector\": 63148,\n  \"qr-code-scan\": 63149,\n  \"qr-code\": 63150,\n  \"quora\": 63151,\n  \"quote\": 63152,\n  \"robot\": 63153,\n  \"send-check-fill\": 63154,\n  \"send-check\": 63155,\n  \"send-dash-fill\": 63156,\n  \"send-dash\": 63157,\n  \"send-exclamation-1\": 63158,\n  \"send-exclamation-fill\": 63159,\n  \"send-exclamation\": 63160,\n  \"send-fill\": 63161,\n  \"send-plus-fill\": 63162,\n  \"send-plus\": 63163,\n  \"send-slash-fill\": 63164,\n  \"send-slash\": 63165,\n  \"send-x-fill\": 63166,\n  \"send-x\": 63167,\n  \"send\": 63168,\n  \"steam\": 63169,\n  \"terminal-dash-1\": 63170,\n  \"terminal-dash\": 63171,\n  \"terminal-plus\": 63172,\n  \"terminal-split\": 63173,\n  \"ticket-detailed-fill\": 63174,\n  \"ticket-detailed\": 63175,\n  \"ticket-fill\": 63176,\n  \"ticket-perforated-fill\": 63177,\n  \"ticket-perforated\": 63178,\n  \"ticket\": 63179,\n  \"tiktok\": 63180,\n  \"window-dash\": 63181,\n  \"window-desktop\": 63182,\n  \"window-fullscreen\": 63183,\n  \"window-plus\": 63184,\n  \"window-split\": 63185,\n  \"window-stack\": 63186,\n  \"window-x\": 63187,\n  \"xbox\": 63188,\n  \"ethernet\": 63189,\n  \"hdmi-fill\": 63190,\n  \"hdmi\": 63191,\n  \"usb-c-fill\": 63192,\n  \"usb-c\": 63193,\n  \"usb-fill\": 63194,\n  \"usb-plug-fill\": 63195,\n  \"usb-plug\": 63196,\n  \"usb-symbol\": 63197,\n  \"usb\": 63198,\n  \"boombox-fill\": 63199,\n  \"displayport-1\": 63200,\n  \"displayport\": 63201,\n  \"gpu-card\": 63202,\n  \"memory\": 63203,\n  \"modem-fill\": 63204,\n  \"modem\": 63205,\n  \"motherboard-fill\": 63206,\n  \"motherboard\": 63207,\n  \"optical-audio-fill\": 63208,\n  \"optical-audio\": 63209,\n  \"pci-card\": 63210,\n  \"router-fill\": 63211,\n  \"router\": 63212,\n  \"ssd-fill\": 63213,\n  \"ssd\": 63214,\n  \"thunderbolt-fill\": 63215,\n  \"thunderbolt\": 63216,\n  \"usb-drive-fill\": 63217,\n  \"usb-drive\": 63218,\n  \"usb-micro-fill\": 63219,\n  \"usb-micro\": 63220,\n  \"usb-mini-fill\": 63221,\n  \"usb-mini\": 63222,\n  \"cloud-haze2\": 63223,\n  \"device-hdd-fill\": 63224,\n  \"device-hdd\": 63225,\n  \"device-ssd-fill\": 63226,\n  \"device-ssd\": 63227,\n  \"displayport-fill\": 63228,\n  \"mortarboard-fill\": 63229,\n  \"mortarboard\": 63230,\n  \"terminal-x\": 63231,\n  \"arrow-through-heart-fill\": 63232,\n  \"arrow-through-heart\": 63233,\n  \"badge-sd-fill\": 63234,\n  \"badge-sd\": 63235,\n  \"bag-heart-fill\": 63236,\n  \"bag-heart\": 63237,\n  \"balloon-fill\": 63238,\n  \"balloon-heart-fill\": 63239,\n  \"balloon-heart\": 63240,\n  \"balloon\": 63241,\n  \"box2-fill\": 63242,\n  \"box2-heart-fill\": 63243,\n  \"box2-heart\": 63244,\n  \"box2\": 63245,\n  \"braces-asterisk\": 63246,\n  \"calendar-heart-fill\": 63247,\n  \"calendar-heart\": 63248,\n  \"calendar2-heart-fill\": 63249,\n  \"calendar2-heart\": 63250,\n  \"chat-heart-fill\": 63251,\n  \"chat-heart\": 63252,\n  \"chat-left-heart-fill\": 63253,\n  \"chat-left-heart\": 63254,\n  \"chat-right-heart-fill\": 63255,\n  \"chat-right-heart\": 63256,\n  \"chat-square-heart-fill\": 63257,\n  \"chat-square-heart\": 63258,\n  \"clipboard-check-fill\": 63259,\n  \"clipboard-data-fill\": 63260,\n  \"clipboard-fill\": 63261,\n  \"clipboard-heart-fill\": 63262,\n  \"clipboard-heart\": 63263,\n  \"clipboard-minus-fill\": 63264,\n  \"clipboard-plus-fill\": 63265,\n  \"clipboard-pulse\": 63266,\n  \"clipboard-x-fill\": 63267,\n  \"clipboard2-check-fill\": 63268,\n  \"clipboard2-check\": 63269,\n  \"clipboard2-data-fill\": 63270,\n  \"clipboard2-data\": 63271,\n  \"clipboard2-fill\": 63272,\n  \"clipboard2-heart-fill\": 63273,\n  \"clipboard2-heart\": 63274,\n  \"clipboard2-minus-fill\": 63275,\n  \"clipboard2-minus\": 63276,\n  \"clipboard2-plus-fill\": 63277,\n  \"clipboard2-plus\": 63278,\n  \"clipboard2-pulse-fill\": 63279,\n  \"clipboard2-pulse\": 63280,\n  \"clipboard2-x-fill\": 63281,\n  \"clipboard2-x\": 63282,\n  \"clipboard2\": 63283,\n  \"emoji-kiss-fill\": 63284,\n  \"emoji-kiss\": 63285,\n  \"envelope-heart-fill\": 63286,\n  \"envelope-heart\": 63287,\n  \"envelope-open-heart-fill\": 63288,\n  \"envelope-open-heart\": 63289,\n  \"envelope-paper-fill\": 63290,\n  \"envelope-paper-heart-fill\": 63291,\n  \"envelope-paper-heart\": 63292,\n  \"envelope-paper\": 63293,\n  \"filetype-aac\": 63294,\n  \"filetype-ai\": 63295,\n  \"filetype-bmp\": 63296,\n  \"filetype-cs\": 63297,\n  \"filetype-css\": 63298,\n  \"filetype-csv\": 63299,\n  \"filetype-doc\": 63300,\n  \"filetype-docx\": 63301,\n  \"filetype-exe\": 63302,\n  \"filetype-gif\": 63303,\n  \"filetype-heic\": 63304,\n  \"filetype-html\": 63305,\n  \"filetype-java\": 63306,\n  \"filetype-jpg\": 63307,\n  \"filetype-js\": 63308,\n  \"filetype-jsx\": 63309,\n  \"filetype-key\": 63310,\n  \"filetype-m4p\": 63311,\n  \"filetype-md\": 63312,\n  \"filetype-mdx\": 63313,\n  \"filetype-mov\": 63314,\n  \"filetype-mp3\": 63315,\n  \"filetype-mp4\": 63316,\n  \"filetype-otf\": 63317,\n  \"filetype-pdf\": 63318,\n  \"filetype-php\": 63319,\n  \"filetype-png\": 63320,\n  \"filetype-ppt-1\": 63321,\n  \"filetype-ppt\": 63322,\n  \"filetype-psd\": 63323,\n  \"filetype-py\": 63324,\n  \"filetype-raw\": 63325,\n  \"filetype-rb\": 63326,\n  \"filetype-sass\": 63327,\n  \"filetype-scss\": 63328,\n  \"filetype-sh\": 63329,\n  \"filetype-svg\": 63330,\n  \"filetype-tiff\": 63331,\n  \"filetype-tsx\": 63332,\n  \"filetype-ttf\": 63333,\n  \"filetype-txt\": 63334,\n  \"filetype-wav\": 63335,\n  \"filetype-woff\": 63336,\n  \"filetype-xls-1\": 63337,\n  \"filetype-xls\": 63338,\n  \"filetype-xml\": 63339,\n  \"filetype-yml\": 63340,\n  \"heart-arrow\": 63341,\n  \"heart-pulse-fill\": 63342,\n  \"heart-pulse\": 63343,\n  \"heartbreak-fill\": 63344,\n  \"heartbreak\": 63345,\n  \"hearts\": 63346,\n  \"hospital-fill\": 63347,\n  \"hospital\": 63348,\n  \"house-heart-fill\": 63349,\n  \"house-heart\": 63350,\n  \"incognito\": 63351,\n  \"magnet-fill\": 63352,\n  \"magnet\": 63353,\n  \"person-heart\": 63354,\n  \"person-hearts\": 63355,\n  \"phone-flip\": 63356,\n  \"plugin\": 63357,\n  \"postage-fill\": 63358,\n  \"postage-heart-fill\": 63359,\n  \"postage-heart\": 63360,\n  \"postage\": 63361,\n  \"postcard-fill\": 63362,\n  \"postcard-heart-fill\": 63363,\n  \"postcard-heart\": 63364,\n  \"postcard\": 63365,\n  \"search-heart-fill\": 63366,\n  \"search-heart\": 63367,\n  \"sliders2-vertical\": 63368,\n  \"sliders2\": 63369,\n  \"trash3-fill\": 63370,\n  \"trash3\": 63371,\n  \"valentine\": 63372,\n  \"valentine2\": 63373,\n  \"wrench-adjustable-circle-fill\": 63374,\n  \"wrench-adjustable-circle\": 63375,\n  \"wrench-adjustable\": 63376,\n  \"filetype-json\": 63377,\n  \"filetype-pptx\": 63378,\n  \"filetype-xlsx\": 63379,\n  \"1-circle-1\": 63380,\n  \"1-circle-fill-1\": 63381,\n  \"1-circle-fill\": 63382,\n  \"1-circle\": 63383,\n  \"1-square-fill\": 63384,\n  \"1-square\": 63385,\n  \"2-circle-1\": 63386,\n  \"2-circle-fill-1\": 63387,\n  \"2-circle-fill\": 63388,\n  \"2-circle\": 63389,\n  \"2-square-fill\": 63390,\n  \"2-square\": 63391,\n  \"3-circle-1\": 63392,\n  \"3-circle-fill-1\": 63393,\n  \"3-circle-fill\": 63394,\n  \"3-circle\": 63395,\n  \"3-square-fill\": 63396,\n  \"3-square\": 63397,\n  \"4-circle-1\": 63398,\n  \"4-circle-fill-1\": 63399,\n  \"4-circle-fill\": 63400,\n  \"4-circle\": 63401,\n  \"4-square-fill\": 63402,\n  \"4-square\": 63403,\n  \"5-circle-1\": 63404,\n  \"5-circle-fill-1\": 63405,\n  \"5-circle-fill\": 63406,\n  \"5-circle\": 63407,\n  \"5-square-fill\": 63408,\n  \"5-square\": 63409,\n  \"6-circle-1\": 63410,\n  \"6-circle-fill-1\": 63411,\n  \"6-circle-fill\": 63412,\n  \"6-circle\": 63413,\n  \"6-square-fill\": 63414,\n  \"6-square\": 63415,\n  \"7-circle-1\": 63416,\n  \"7-circle-fill-1\": 63417,\n  \"7-circle-fill\": 63418,\n  \"7-circle\": 63419,\n  \"7-square-fill\": 63420,\n  \"7-square\": 63421,\n  \"8-circle-1\": 63422,\n  \"8-circle-fill-1\": 63423,\n  \"8-circle-fill\": 63424,\n  \"8-circle\": 63425,\n  \"8-square-fill\": 63426,\n  \"8-square\": 63427,\n  \"9-circle-1\": 63428,\n  \"9-circle-fill-1\": 63429,\n  \"9-circle-fill\": 63430,\n  \"9-circle\": 63431,\n  \"9-square-fill\": 63432,\n  \"9-square\": 63433,\n  \"airplane-engines-fill\": 63434,\n  \"airplane-engines\": 63435,\n  \"airplane-fill\": 63436,\n  \"airplane\": 63437,\n  \"alexa\": 63438,\n  \"alipay\": 63439,\n  \"android\": 63440,\n  \"android2\": 63441,\n  \"box-fill\": 63442,\n  \"box-seam-fill\": 63443,\n  \"browser-chrome\": 63444,\n  \"browser-edge\": 63445,\n  \"browser-firefox\": 63446,\n  \"browser-safari\": 63447,\n  \"c-circle-1\": 63448,\n  \"c-circle-fill-1\": 63449,\n  \"c-circle-fill\": 63450,\n  \"c-circle\": 63451,\n  \"c-square-fill\": 63452,\n  \"c-square\": 63453,\n  \"capsule-pill\": 63454,\n  \"capsule\": 63455,\n  \"car-front-fill\": 63456,\n  \"car-front\": 63457,\n  \"cassette-fill\": 63458,\n  \"cassette\": 63459,\n  \"cc-circle-1\": 63460,\n  \"cc-circle-fill-1\": 63461,\n  \"cc-circle-fill\": 63462,\n  \"cc-circle\": 63463,\n  \"cc-square-fill\": 63464,\n  \"cc-square\": 63465,\n  \"cup-hot-fill\": 63466,\n  \"cup-hot\": 63467,\n  \"currency-rupee\": 63468,\n  \"dropbox\": 63469,\n  \"escape\": 63470,\n  \"fast-forward-btn-fill\": 63471,\n  \"fast-forward-btn\": 63472,\n  \"fast-forward-circle-fill\": 63473,\n  \"fast-forward-circle\": 63474,\n  \"fast-forward-fill\": 63475,\n  \"fast-forward\": 63476,\n  \"filetype-sql\": 63477,\n  \"fire\": 63478,\n  \"google-play\": 63479,\n  \"h-circle-1\": 63480,\n  \"h-circle-fill-1\": 63481,\n  \"h-circle-fill\": 63482,\n  \"h-circle\": 63483,\n  \"h-square-fill\": 63484,\n  \"h-square\": 63485,\n  \"indent\": 63486,\n  \"lungs-fill\": 63487,\n  \"lungs\": 63488,\n  \"microsoft-teams\": 63489,\n  \"p-circle-1\": 63490,\n  \"p-circle-fill-1\": 63491,\n  \"p-circle-fill\": 63492,\n  \"p-circle\": 63493,\n  \"p-square-fill\": 63494,\n  \"p-square\": 63495,\n  \"pass-fill\": 63496,\n  \"pass\": 63497,\n  \"prescription\": 63498,\n  \"prescription2\": 63499,\n  \"r-circle-1\": 63500,\n  \"r-circle-fill-1\": 63501,\n  \"r-circle-fill\": 63502,\n  \"r-circle\": 63503,\n  \"r-square-fill\": 63504,\n  \"r-square\": 63505,\n  \"repeat-1\": 63506,\n  \"repeat\": 63507,\n  \"rewind-btn-fill\": 63508,\n  \"rewind-btn\": 63509,\n  \"rewind-circle-fill\": 63510,\n  \"rewind-circle\": 63511,\n  \"rewind-fill\": 63512,\n  \"rewind\": 63513,\n  \"train-freight-front-fill\": 63514,\n  \"train-freight-front\": 63515,\n  \"train-front-fill\": 63516,\n  \"train-front\": 63517,\n  \"train-lightrail-front-fill\": 63518,\n  \"train-lightrail-front\": 63519,\n  \"truck-front-fill\": 63520,\n  \"truck-front\": 63521,\n  \"ubuntu\": 63522,\n  \"unindent\": 63523,\n  \"unity\": 63524,\n  \"universal-access-circle\": 63525,\n  \"universal-access\": 63526,\n  \"virus\": 63527,\n  \"virus2\": 63528,\n  \"wechat\": 63529,\n  \"yelp\": 63530,\n  \"sign-stop-fill\": 63531,\n  \"sign-stop-lights-fill\": 63532,\n  \"sign-stop-lights\": 63533,\n  \"sign-stop\": 63534,\n  \"sign-turn-left-fill\": 63535,\n  \"sign-turn-left\": 63536,\n  \"sign-turn-right-fill\": 63537,\n  \"sign-turn-right\": 63538,\n  \"sign-turn-slight-left-fill\": 63539,\n  \"sign-turn-slight-left\": 63540,\n  \"sign-turn-slight-right-fill\": 63541,\n  \"sign-turn-slight-right\": 63542,\n  \"sign-yield-fill\": 63543,\n  \"sign-yield\": 63544,\n  \"ev-station-fill\": 63545,\n  \"ev-station\": 63546,\n  \"fuel-pump-diesel-fill\": 63547,\n  \"fuel-pump-diesel\": 63548,\n  \"fuel-pump-fill\": 63549,\n  \"fuel-pump\": 63550,\n  \"0-circle-fill\": 63551,\n  \"0-circle\": 63552,\n  \"0-square-fill\": 63553,\n  \"0-square\": 63554,\n  \"rocket-fill\": 63555,\n  \"rocket-takeoff-fill\": 63556,\n  \"rocket-takeoff\": 63557,\n  \"rocket\": 63558,\n  \"stripe\": 63559,\n  \"subscript\": 63560,\n  \"superscript\": 63561,\n  \"trello\": 63562,\n  \"envelope-at-fill\": 63563,\n  \"envelope-at\": 63564,\n  \"regex\": 63565,\n  \"text-wrap\": 63566,\n  \"sign-dead-end-fill\": 63567,\n  \"sign-dead-end\": 63568,\n  \"sign-do-not-enter-fill\": 63569,\n  \"sign-do-not-enter\": 63570,\n  \"sign-intersection-fill\": 63571,\n  \"sign-intersection-side-fill\": 63572,\n  \"sign-intersection-side\": 63573,\n  \"sign-intersection-t-fill\": 63574,\n  \"sign-intersection-t\": 63575,\n  \"sign-intersection-y-fill\": 63576,\n  \"sign-intersection-y\": 63577,\n  \"sign-intersection\": 63578,\n  \"sign-merge-left-fill\": 63579,\n  \"sign-merge-left\": 63580,\n  \"sign-merge-right-fill\": 63581,\n  \"sign-merge-right\": 63582,\n  \"sign-no-left-turn-fill\": 63583,\n  \"sign-no-left-turn\": 63584,\n  \"sign-no-parking-fill\": 63585,\n  \"sign-no-parking\": 63586,\n  \"sign-no-right-turn-fill\": 63587,\n  \"sign-no-right-turn\": 63588,\n  \"sign-railroad-fill\": 63589,\n  \"sign-railroad\": 63590,\n  \"building-add\": 63591,\n  \"building-check\": 63592,\n  \"building-dash\": 63593,\n  \"building-down\": 63594,\n  \"building-exclamation\": 63595,\n  \"building-fill-add\": 63596,\n  \"building-fill-check\": 63597,\n  \"building-fill-dash\": 63598,\n  \"building-fill-down\": 63599,\n  \"building-fill-exclamation\": 63600,\n  \"building-fill-gear\": 63601,\n  \"building-fill-lock\": 63602,\n  \"building-fill-slash\": 63603,\n  \"building-fill-up\": 63604,\n  \"building-fill-x\": 63605,\n  \"building-fill\": 63606,\n  \"building-gear\": 63607,\n  \"building-lock\": 63608,\n  \"building-slash\": 63609,\n  \"building-up\": 63610,\n  \"building-x\": 63611,\n  \"buildings-fill\": 63612,\n  \"buildings\": 63613,\n  \"bus-front-fill\": 63614,\n  \"bus-front\": 63615,\n  \"ev-front-fill\": 63616,\n  \"ev-front\": 63617,\n  \"globe-americas\": 63618,\n  \"globe-asia-australia\": 63619,\n  \"globe-central-south-asia\": 63620,\n  \"globe-europe-africa\": 63621,\n  \"house-add-fill\": 63622,\n  \"house-add\": 63623,\n  \"house-check-fill\": 63624,\n  \"house-check\": 63625,\n  \"house-dash-fill\": 63626,\n  \"house-dash\": 63627,\n  \"house-down-fill\": 63628,\n  \"house-down\": 63629,\n  \"house-exclamation-fill\": 63630,\n  \"house-exclamation\": 63631,\n  \"house-gear-fill\": 63632,\n  \"house-gear\": 63633,\n  \"house-lock-fill\": 63634,\n  \"house-lock\": 63635,\n  \"house-slash-fill\": 63636,\n  \"house-slash\": 63637,\n  \"house-up-fill\": 63638,\n  \"house-up\": 63639,\n  \"house-x-fill\": 63640,\n  \"house-x\": 63641,\n  \"person-add\": 63642,\n  \"person-down\": 63643,\n  \"person-exclamation\": 63644,\n  \"person-fill-add\": 63645,\n  \"person-fill-check\": 63646,\n  \"person-fill-dash\": 63647,\n  \"person-fill-down\": 63648,\n  \"person-fill-exclamation\": 63649,\n  \"person-fill-gear\": 63650,\n  \"person-fill-lock\": 63651,\n  \"person-fill-slash\": 63652,\n  \"person-fill-up\": 63653,\n  \"person-fill-x\": 63654,\n  \"person-gear\": 63655,\n  \"person-lock\": 63656,\n  \"person-slash\": 63657,\n  \"person-up\": 63658,\n  \"scooter\": 63659,\n  \"taxi-front-fill\": 63660,\n  \"taxi-front\": 63661,\n  \"amd\": 63662,\n  \"database-add\": 63663,\n  \"database-check\": 63664,\n  \"database-dash\": 63665,\n  \"database-down\": 63666,\n  \"database-exclamation\": 63667,\n  \"database-fill-add\": 63668,\n  \"database-fill-check\": 63669,\n  \"database-fill-dash\": 63670,\n  \"database-fill-down\": 63671,\n  \"database-fill-exclamation\": 63672,\n  \"database-fill-gear\": 63673,\n  \"database-fill-lock\": 63674,\n  \"database-fill-slash\": 63675,\n  \"database-fill-up\": 63676,\n  \"database-fill-x\": 63677,\n  \"database-fill\": 63678,\n  \"database-gear\": 63679,\n  \"database-lock\": 63680,\n  \"database-slash\": 63681,\n  \"database-up\": 63682,\n  \"database-x\": 63683,\n  \"database\": 63684,\n  \"houses-fill\": 63685,\n  \"houses\": 63686,\n  \"nvidia\": 63687,\n  \"person-vcard-fill\": 63688,\n  \"person-vcard\": 63689,\n  \"sina-weibo\": 63690,\n  \"tencent-qq\": 63691,\n  \"wikipedia\": 63692\n}"
  },
  {
    "path": "tools/resource-tools/res/bootstrap-icons.list",
    "content": "apple\ncaret-down-fill\ncollection\ncontroller\ndisplay\ngear-fill\nplay-btn\nplay-circle-fill\npower\nquestion-circle-fill\nsteam\ntv\nwindow-desktop\nwindows\nx-lg"
  },
  {
    "path": "tools/resource-tools/symheader.ts",
    "content": "import asyncTransform from \"./async-transform\";\n\nexport interface Option {\n    prefix: string;\n}\n\nfunction codepointsMetadata(file: any): Record<string, number> {\n    return file.codepoints;\n}\n\nexport default function symheader(option?: Partial<Option>) {\n    return asyncTransform(async file => {\n        const codepoints: Record<string, number> = codepointsMetadata(file);\n        let content = '#pragma once\\n\\n';\n        const encoder = new TextEncoder();\n        for (let key in codepoints) {\n            const cp: number = codepoints[key];\n            const value = Array.from(encoder.encode(String.fromCodePoint(cp)))\n                .map(v => `\\\\x${v.toString(16)}`).join('');\n            const name = key.toUpperCase().replace(/[^0-9a-z_]/ig, '_');\n            content += `#define ${option.prefix}_SYMBOL_${name} \"${value}\"\\n`;\n        }\n        file.contents = Buffer.from(content);\n        file.extname = '.h';\n    })\n}"
  },
  {
    "path": "tools/resource-tools/tsconfig.json",
    "content": "{\n  // these options are overrides used only by ts-node\n  \"ts-node\": {\n    \"compilerOptions\": {\n      \"module\": \"commonjs\"\n    }\n  },\n  \"compilerOptions\": {\n    \"target\": \"ES6\",\n    \"moduleResolution\": \"Node\",\n    \"esModuleInterop\": true,\n    \"downlevelIteration\": true,\n    \"allowSyntheticDefaultImports\": true\n  }\n}"
  },
  {
    "path": "tools/webos/easy_build.sh",
    "content": "#!/usr/bin/env bash\n\nif [ ! -d app ] || [ ! -f CMakeLists.txt ]; then\n  echo \"Please invoke this script in project root directory\"\n  exit 1\nfi\n\nCMAKE_BIN=$(which cmake)\nCPACK_BIN=$(which cpack)\nif [ -z \"${CMAKE_BINARY_DIR}\" ]; then\n  CMAKE_BINARY_DIR=build\nfi\n\nif [ ! -x \"$CMAKE_BIN\" ]; then\n  echo \"Please install CMake.\"\n  exit 1\nfi\n\nif [ -z \"$CI\" ]; then\n  echo \"Update submodules\"\n  git submodule update --init --recursive\nfi\n\nif [ -z \"${TOOLCHAIN_FILE}\" ]; then\n  echo \"Setup environment\"\n  . /opt/webos-sdk-x86_64/1.0.g/environment-setup-armv7a-neon-webos-linux-gnueabi\n  TOOLCHAIN_FILE=/opt/webos-sdk-x86_64/1.0.g/sysroots/x86_64-webossdk-linux/usr/share/cmake/OEToolchainConfig.cmake\nfi\n\necho \"Configure project\"\nif [ ! -d \"${CMAKE_BINARY_DIR}\" ]; then\n  mkdir -p \"${CMAKE_BINARY_DIR}\"\nfi\n\nBUILD_OPTIONS=\"-DTARGET_WEBOS=ON -DBUILD_TESTS=OFF\"\n\n# shellcheck disable=SC2068\n$CMAKE_BIN -B\"${CMAKE_BINARY_DIR}\" -DCMAKE_TOOLCHAIN_FILE=\"${TOOLCHAIN_FILE}\" $BUILD_OPTIONS $@ || exit 1\n\n$CMAKE_BIN --build \"${CMAKE_BINARY_DIR}\" -- -j \"$(nproc)\" || exit 1\n\necho \"Build package\"\ncd \"${CMAKE_BINARY_DIR}\" || exit 1\n$CPACK_BIN"
  },
  {
    "path": "tools/webos/easy_install.sh",
    "content": "#!/bin/sh\n\nTARGET=\"$1\"\nARES_DEVICE=$(ares-device -d | xargs) cmake --build .. --target \"webos-launch-${TARGET}\"\n"
  }
]