From 802ee60c9cbfeb3f3b646cc2d31551a4ade2f8f5 Mon Sep 17 00:00:00 2001 From: Rosie Date: Wed, 12 Apr 2023 22:42:48 +0100 Subject: [PATCH] Fix theming for newer versions (#18) This PR features the following: - Themes all semantic and raw colors for the native side (chat area) - Use a unique hook method that hooks whatever keys are in your theme.json - Add version and type to the JS bridge so that the JS side can show it in debug logs - Fix image BG for newer versions - Lower cache time to 3 minutes --- .github/workflows/debug.yml | 66 -- .github/workflows/stable.yml | 44 +- Discord.ipa | 4 +- Makefile | 2 +- Resources/themes.js | 16 +- control | 6 +- package-lock.json | 1361 ++++++++++++++++++++++ package.json | 7 + pnpm-lock.yaml | 27 + rollup.config.js | 2 +- src/Enmity.h | 4 +- src/Enmity.x | 7 +- src/Plugins.x | 3 +- src/Theme.h | 13 + src/Theme.x | 2067 ---------------------------------- src/Theme.xi | 554 +++++++++ src/Utils.x | 2 +- 17 files changed, 2021 insertions(+), 2164 deletions(-) delete mode 100644 .github/workflows/debug.yml create mode 100644 package-lock.json delete mode 100644 src/Theme.x create mode 100644 src/Theme.xi diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml deleted file mode 100644 index e6746bc..0000000 --- a/.github/workflows/debug.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Create a debug build (PRIVATE) -on: - workflow_dispatch: - -jobs: - build: - name: Build and publish Enmity for iOS - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - with: - ref: 'main' - submodules: true - - - name: Check cache - id: verify-cache - run: | - echo "::set-output name=heads::`git ls-remote https://github.com/theos/theos | head -n 1 | cut -f 1`-`git ls-remote https://github.com/theos/sdks | head -n 1 | cut -f 1`" - - name: Use cache - uses: actions/cache@v2 - with: - path: | - ${{ github.workspace }}/theos - key: ${{ runner.os }}-${{ steps.verify-cache.outputs.heads }} - - - name: Prepare Theos - uses: Randomblock1/theos-action@v1 - - - name: Prepare Azule - run : | - git clone https://github.com/Al4ise/Azule ${{ github.workspace }}/Azule - - name: Prepare Enmity Patcher - run : | - curl -L https://github.com/enmity-mod/patcher/releases/latest/download/patcher.mac-amd64 -o ${{ github.workspace }}/patcher - chmod +x patcher - - name: Patch Discord - run : | - ${{ github.workspace }}/patcher - mkdir out - - name: Build package - run: > - rm -f packages/* - make clean package - mv $(find packages -name "*.deb" -print -quit) out/enmity.deb - - name: Create Enmity.ipa - run : | - ${{ github.workspace }}/Azule/azule -i Enmity.ipa -o out -f out/enmity.deb - mv out/Enmity+enmity.deb.ipa out/enmity.ipa - - name: Build dev deb - run: | - rm -f packages/* - echo $"$(sed 's/Name\:.*/Name\: Enmity (Dev)/' control)" > control - echo $"$(sed 's/Package\:.*/Package\: app.enmity.dev/' control)" > control - make clean package FINALPACKAGE=1 DEVTOOLS=1 - mv $(find packages -name "*.deb" -print -quit) out/enmity.dev.deb - - name: Create Enmity.Dev.ipa - run : | - ${{ github.workspace }}/Azule/azule -i Enmity.ipa -o out -f out/enmity.dev.deb - mv out/Enmity+enmity.dev.deb.ipa out/enmity.dev.ipa - - name: Create release - uses: softprops/action-gh-release@v1 - with: - tag_name: DEBUG - prerelease: true - files: | - out/* diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index 64c6d2d..8e52441 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -1,11 +1,7 @@ name: Create a stable release on: push: - tags: - - '*' pull_request: - tags: - - '*' workflow_dispatch: jobs: @@ -42,6 +38,10 @@ jobs: curl -L https://github.com/enmity-mod/patcher/releases/latest/download/patcher.mac-amd64 -o ${{ github.workspace }}/patcher chmod +x patcher + - name: Prepare coreutils + + run: brew install coreutils + - name: Patch Discord run : | ${{ github.workspace }}/patcher @@ -53,10 +53,14 @@ jobs: gmake clean package FINALPACKAGE=1 mv $(find packages -name "*.deb" -print -quit) out/Enmity.deb + - name: Retrieve version + id: version + run: echo "::set-output name=EM_VERSION::$(cat control | grep -E 'Version:(.*)' | awk '{ print $2 }')" + - name: Create Enmity.ipa run : | - ${{ github.workspace }}/Azule/azule -i Enmity.ipa -o out -f out/enmity.deb - mv out/Enmity+enmity.deb.ipa out/Enmity.ipa + ${{ github.workspace }}/Azule/azule -i Enmity.ipa -o out -f $PWD/out/Enmity.deb + mv out/Enmity+Enmity.deb.ipa out/Enmity.ipa - name: Build dev deb run: | @@ -66,14 +70,32 @@ jobs: gmake clean package FINALPACKAGE=1 DEVTOOLS=1 mv $(find packages -name "*.deb" -print -quit) out/Enmity.Development.deb + - name: Build regular rootless deb + run: | + rm -f packages/* + echo $"$(sed 's/Name\:.*/Name\: Enmity (Rootless)/' control)" > control + echo $"$(sed 's/Package\:.*/Package\: app.enmity.rootless/' control)" > control + gmake clean package FINALPACKAGE=1 THEOS_PACKAGE_SCHEME=rootless + mv $(find packages -name "*.deb" -print -quit) out/Enmity.Rootless.deb + + - name: Build dev rootless deb + run: | + rm -f packages/* + echo $"$(sed 's/Name\:.*/Name\: Enmity (Rootless)/' control)" > control + echo $"$(sed 's/Package\:.*/Package\: app.enmity.rootless/' control)" > control + gmake clean package FINALPACKAGE=1 DEVTOOLS=1 THEOS_PACKAGE_SCHEME=rootless + mv $(find packages -name "*.deb" -print -quit) out/Enmity.Rootless.Development.deb + - name: Create Enmity.Dev.ipa run : | - ${{ github.workspace }}/Azule/azule -i Enmity.ipa -o out -f out/Enmity.Development.deb + ${{ github.workspace }}/Azule/azule -i Enmity.ipa -o out -f $PWD/out/Enmity.Development.deb mv out/Enmity+Enmity.Development.deb.ipa out/Enmity.Development.ipa - name: Create release - uses: softprops/action-gh-release@v1 + uses: marvinpinto/action-automatic-releases@latest with: - tag_name: v${{ github.ref_name }} - files: | - out/* + repo_token: "${{ secrets.GITHUB_TOKEN }}" + prerelease: false + automatic_release_tag: v${{ steps.version.outputs.EM_VERSION }} + title: "Enmity v${{ steps.version.outputs.EM_VERSION }}" + files: out/* \ No newline at end of file diff --git a/Discord.ipa b/Discord.ipa index 3d475fd..aaa6cb7 100644 --- a/Discord.ipa +++ b/Discord.ipa @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:af63a9d4ec7016a93356b3d44a44d5d161880347f3c85b7ffc51168eeb0e621d -size 125108237 +oid sha256:d34ccc795293c1d29fb48324096464869a37d9120237b0c646012e07d385cb72 +size 84120794 diff --git a/Makefile b/Makefile index 34362a5..a0a2799 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ include $(THEOS)/makefiles/common.mk DEBUG_IP = 192.168.0.35 TWEAK_NAME = Enmity DEVTOOLS = 0 -Enmity_FILES = $(shell find src -name "*.x") +Enmity_FILES = $(shell find src -name "*.x" && find src -name "*.xi") Enmity_CFLAGS = -DDEBUG_IP=@\"$(DEBUG_IP)\" -DDEVTOOLS=$(DEVTOOLS) -fobjc-arc Enmity_FRAMEWORKS = UIKit Foundation CoreGraphics CoreImage diff --git a/Resources/themes.js b/Resources/themes.js index 790998b..17079b2 100644 --- a/Resources/themes.js +++ b/Resources/themes.js @@ -8,16 +8,16 @@ Object.freeze = function (obj, ...args) { try { const theme = %@; - if (obj.hasOwnProperty?.('BACKGROUND_PRIMARY')) { - return oObjectFreeze.call(this, Object.assign(obj, theme.theme_color_map), ...args); + if (obj.hasOwnProperty?.('BACKGROUND_PRIMARY') || obj.hasOwnProperty?.('BACKGROUND_SECONDARY')) { + return oObjectFreeze.call(this, Object.assign(obj, theme.spec === 2 + ? theme.semanticColors ?? theme.theme_color_map + : theme.theme_color_map), ...args); } - if (obj.hasOwnProperty?.('PRIMARY_DARK')) { - return oObjectFreeze.call(this, Object.assign(obj, theme.colours), ...args); - } - - if (obj.hasOwnProperty?.('CHAT_GREY')) { - return oObjectFreeze.call(this, Object.assign(obj,theme.unsafe_colors), ...args); + if (obj.hasOwnProperty?.('PRIMARY_100') || obj.hasOwnProperty?.('RED_400')) { + return oObjectFreeze.call(this, Object.assign(obj, theme.spec === 2 + ? theme.rawColors ?? theme.colours ?? theme.colors + : theme.colours), ...args); } } catch (e) { console.log(e); diff --git a/control b/control index 0e5fbc8..10b6cc6 100644 --- a/control +++ b/control @@ -1,10 +1,10 @@ Package: app.enmity Name: Enmity -Version: 2.1.4 +Version: 2.2.2 Architecture: iphoneos-arm Description: The power of addons, all in your hand. -Maintainer: Zoey, eternal -Author: Enmity Team +Maintainer: Rosie +Author: Zoey & Eternal Section: Tweaks Depends: mobilesubstrate (>= 0.9.5000) SileoDepiction: https://repo.enmity.app/depictions/enmity.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..0c70933 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1361 @@ +{ + "name": "tweak", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "dependencies": { + "@rollup/plugin-commonjs": "^22.0.1", + "@rollup/plugin-node-resolve": "^13.3.0", + "esbuild": "^0.14.47", + "react-devtools-core": "^4.24.7", + "rollup": "^2.75.7", + "rollup-plugin-esbuild": "^4.9.1" + }, + "devDependencies": { + "xregexp": "^5.1.1" + } + }, + "node_modules/@babel/runtime-corejs3": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.21.0.tgz", + "integrity": "sha512-TDD4UJzos3JJtM+tHX+w2Uc+KWj7GV+VKKFdMVd2Rx8sdA19hcc3P3AHFYd5LVOw+pYuSd5lICC3gm52B6Rwxw==", + "dev": true, + "dependencies": { + "core-js-pure": "^3.25.1", + "regenerator-runtime": "^0.13.11" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.14.54.tgz", + "integrity": "sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@rollup/plugin-commonjs": { + "version": "22.0.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-22.0.2.tgz", + "integrity": "sha512-//NdP6iIwPbMTcazYsiBMbJW7gfmpHom33u1beiIoHDEM0Q9clvtQB1T0efvMqHeKsGohiHo97BCPCkBXdscwg==", + "dependencies": { + "@rollup/pluginutils": "^3.1.0", + "commondir": "^1.0.1", + "estree-walker": "^2.0.1", + "glob": "^7.1.6", + "is-reference": "^1.2.1", + "magic-string": "^0.25.7", + "resolve": "^1.17.0" + }, + "engines": { + "node": ">= 12.0.0" + }, + "peerDependencies": { + "rollup": "^2.68.0" + } + }, + "node_modules/@rollup/plugin-node-resolve": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.3.0.tgz", + "integrity": "sha512-Lus8rbUo1eEcnS4yTFKLZrVumLPY+YayBdWXgFSHYhTT2iJbMhoaaBL3xl5NCdeRytErGr8tZ0L71BMRmnlwSw==", + "dependencies": { + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", + "deepmerge": "^4.2.2", + "is-builtin-module": "^3.1.0", + "is-module": "^1.0.0", + "resolve": "^1.19.0" + }, + "engines": { + "node": ">= 10.0.0" + }, + "peerDependencies": { + "rollup": "^2.42.0" + } + }, + "node_modules/@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "dependencies": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0" + } + }, + "node_modules/@rollup/pluginutils/node_modules/estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==" + }, + "node_modules/@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==" + }, + "node_modules/@types/node": { + "version": "18.14.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.14.6.tgz", + "integrity": "sha512-93+VvleD3mXwlLI/xASjw0FzKcwzl3OdTCzm1LaRfqgS21gfFtK3zDXM5Op9TeeMsJVOaJ2VRDpT9q4Y3d0AvA==" + }, + "node_modules/@types/resolve": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", + "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/builtin-modules": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", + "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/core-js-pure": { + "version": "3.29.0", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.29.0.tgz", + "integrity": "sha512-v94gUjN5UTe1n0yN/opTihJ8QBWD2O8i19RfTZR7foONPWArnjB96QA/wk5ozu1mm6ja3udQCzOzwQXTxi3xOQ==", + "dev": true, + "hasInstallScript": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deepmerge": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.0.tgz", + "integrity": "sha512-z2wJZXrmeHdvYJp/Ux55wIjqo81G5Bp4c+oELTW+7ar6SogWHajt5a9gO3s3IDaGSAXjDk0vlQKN3rms8ab3og==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/es-module-lexer": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", + "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==" + }, + "node_modules/esbuild": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.54.tgz", + "integrity": "sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/linux-loong64": "0.14.54", + "esbuild-android-64": "0.14.54", + "esbuild-android-arm64": "0.14.54", + "esbuild-darwin-64": "0.14.54", + "esbuild-darwin-arm64": "0.14.54", + "esbuild-freebsd-64": "0.14.54", + "esbuild-freebsd-arm64": "0.14.54", + "esbuild-linux-32": "0.14.54", + "esbuild-linux-64": "0.14.54", + "esbuild-linux-arm": "0.14.54", + "esbuild-linux-arm64": "0.14.54", + "esbuild-linux-mips64le": "0.14.54", + "esbuild-linux-ppc64le": "0.14.54", + "esbuild-linux-riscv64": "0.14.54", + "esbuild-linux-s390x": "0.14.54", + "esbuild-netbsd-64": "0.14.54", + "esbuild-openbsd-64": "0.14.54", + "esbuild-sunos-64": "0.14.54", + "esbuild-windows-32": "0.14.54", + "esbuild-windows-64": "0.14.54", + "esbuild-windows-arm64": "0.14.54" + } + }, + "node_modules/esbuild-android-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.54.tgz", + "integrity": "sha512-Tz2++Aqqz0rJ7kYBfz+iqyE3QMycD4vk7LBRyWaAVFgFtQ/O8EJOnVmTOiDWYZ/uYzB4kvP+bqejYdVKzE5lAQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-android-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.54.tgz", + "integrity": "sha512-F9E+/QDi9sSkLaClO8SOV6etqPd+5DgJje1F9lOWoNncDdOBL2YF59IhsWATSt0TLZbYCf3pNlTHvVV5VfHdvg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.54.tgz", + "integrity": "sha512-jtdKWV3nBviOd5v4hOpkVmpxsBy90CGzebpbO9beiqUYVMBtSc0AL9zGftFuBon7PNDcdvNCEuQqw2x0wP9yug==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.54.tgz", + "integrity": "sha512-OPafJHD2oUPyvJMrsCvDGkRrVCar5aVyHfWGQzY1dWnzErjrDuSETxwA2HSsyg2jORLY8yBfzc1MIpUkXlctmw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.54.tgz", + "integrity": "sha512-OKwd4gmwHqOTp4mOGZKe/XUlbDJ4Q9TjX0hMPIDBUWWu/kwhBAudJdBoxnjNf9ocIB6GN6CPowYpR/hRCbSYAg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.54.tgz", + "integrity": "sha512-sFwueGr7OvIFiQT6WeG0jRLjkjdqWWSrfbVwZp8iMP+8UHEHRBvlaxL6IuKNDwAozNUmbb8nIMXa7oAOARGs1Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-32": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.54.tgz", + "integrity": "sha512-1ZuY+JDI//WmklKlBgJnglpUL1owm2OX+8E1syCD6UAxcMM/XoWd76OHSjl/0MR0LisSAXDqgjT3uJqT67O3qw==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.54.tgz", + "integrity": "sha512-EgjAgH5HwTbtNsTqQOXWApBaPVdDn7XcK+/PtJwZLT1UmpLoznPd8c5CxqsH2dQK3j05YsB3L17T8vE7cp4cCg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.54.tgz", + "integrity": "sha512-qqz/SjemQhVMTnvcLGoLOdFpCYbz4v4fUo+TfsWG+1aOu70/80RV6bgNpR2JCrppV2moUQkww+6bWxXRL9YMGw==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.54.tgz", + "integrity": "sha512-WL71L+0Rwv+Gv/HTmxTEmpv0UgmxYa5ftZILVi2QmZBgX3q7+tDeOQNqGtdXSdsL8TQi1vIaVFHUPDe0O0kdig==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-mips64le": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.54.tgz", + "integrity": "sha512-qTHGQB8D1etd0u1+sB6p0ikLKRVuCWhYQhAHRPkO+OF3I/iSlTKNNS0Lh2Oc0g0UFGguaFZZiPJdJey3AGpAlw==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-ppc64le": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.54.tgz", + "integrity": "sha512-j3OMlzHiqwZBDPRCDFKcx595XVfOfOnv68Ax3U4UKZ3MTYQB5Yz3X1mn5GnodEVYzhtZgxEBidLWeIs8FDSfrQ==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-riscv64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.54.tgz", + "integrity": "sha512-y7Vt7Wl9dkOGZjxQZnDAqqn+XOqFD7IMWiewY5SPlNlzMX39ocPQlOaoxvT4FllA5viyV26/QzHtvTjVNOxHZg==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-s390x": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.54.tgz", + "integrity": "sha512-zaHpW9dziAsi7lRcyV4r8dhfG1qBidQWUXweUjnw+lliChJqQr+6XD71K41oEIC3Mx1KStovEmlzm+MkGZHnHA==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-netbsd-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.54.tgz", + "integrity": "sha512-PR01lmIMnfJTgeU9VJTDY9ZerDWVFIUzAtJuDHwwceppW7cQWjBBqP48NdeRtoP04/AtO9a7w3viI+PIDr6d+w==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-openbsd-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.54.tgz", + "integrity": "sha512-Qyk7ikT2o7Wu76UsvvDS5q0amJvmRzDyVlL0qf5VLsLchjCa1+IAvd8kTBgUxD7VBUUVgItLkk609ZHUc1oCaw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-sunos-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.54.tgz", + "integrity": "sha512-28GZ24KmMSeKi5ueWzMcco6EBHStL3B6ubM7M51RmPwXQGLe0teBGJocmWhgwccA1GeFXqxzILIxXpHbl9Q/Kw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-32": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.54.tgz", + "integrity": "sha512-T+rdZW19ql9MjS7pixmZYVObd9G7kcaZo+sETqNH4RCkuuYSuv9AGHUVnPoP9hhuE1WM1ZimHz1CIBHBboLU7w==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.54.tgz", + "integrity": "sha512-AoHTRBUuYwXtZhjXZbA1pGfTo8cJo3vZIcWGLiUcTNgHpJJMC1rVA44ZereBHMJtotyN71S8Qw0npiCIkW96cQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.54.tgz", + "integrity": "sha512-M0kuUvXhot1zOISQGXwWn6YtS+Y/1RT9WrVIOywZnJHo3jCDyewAc79aKNQWFCQm+xNHVTq9h8dZKvygoXQQRg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==" + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/is-builtin-module": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.1.tgz", + "integrity": "sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==", + "dependencies": { + "builtin-modules": "^3.3.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-core-module": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==" + }, + "node_modules/is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/joycon": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", + "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", + "engines": { + "node": ">=10" + } + }, + "node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==" + }, + "node_modules/magic-string": { + "version": "0.25.9", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "dependencies": { + "sourcemap-codec": "^1.4.8" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/react-devtools-core": { + "version": "4.27.2", + "resolved": "https://registry.npmjs.org/react-devtools-core/-/react-devtools-core-4.27.2.tgz", + "integrity": "sha512-8SzmIkpO87alD7Xr6gWIEa1jHkMjawOZ+6egjazlnjB4UUcbnzGDf/vBJ4BzGuWWEM+pzrxuzsPpcMqlQkYK2g==", + "dependencies": { + "shell-quote": "^1.6.1", + "ws": "^7" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==", + "dev": true + }, + "node_modules/resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "dependencies": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/rollup": { + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", + "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/rollup-plugin-esbuild": { + "version": "4.10.3", + "resolved": "https://registry.npmjs.org/rollup-plugin-esbuild/-/rollup-plugin-esbuild-4.10.3.tgz", + "integrity": "sha512-RILwUCgnCL5vo8vyZ/ZpwcqRuE5KmLizEv6BujBQfgXFZ6ggcS0FiYvQN+gsTJfWCMaU37l0Fosh4eEufyO97Q==", + "dependencies": { + "@rollup/pluginutils": "^4.1.1", + "debug": "^4.3.3", + "es-module-lexer": "^0.9.3", + "joycon": "^3.0.1", + "jsonc-parser": "^3.0.0" + }, + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "esbuild": ">=0.10.1", + "rollup": "^1.20.0 || ^2.0.0" + } + }, + "node_modules/rollup-plugin-esbuild/node_modules/@rollup/pluginutils": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-4.2.1.tgz", + "integrity": "sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==", + "dependencies": { + "estree-walker": "^2.0.1", + "picomatch": "^2.2.2" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/shell-quote": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.0.tgz", + "integrity": "sha512-QHsz8GgQIGKlRi24yFc6a6lN69Idnx634w49ay6+jA5yFh7a1UY+4Rp6HPx/L/1zcEDPEij8cIsiqR6bQsE5VQ==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "deprecated": "Please use @jridgewell/sourcemap-codec instead" + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/ws": { + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xregexp": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-5.1.1.tgz", + "integrity": "sha512-fKXeVorD+CzWvFs7VBuKTYIW63YD1e1osxwQ8caZ6o1jg6pDAbABDG54LCIq0j5cy7PjRvGIq6sef9DYPXpncg==", + "dev": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.16.5" + } + } + }, + "dependencies": { + "@babel/runtime-corejs3": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.21.0.tgz", + "integrity": "sha512-TDD4UJzos3JJtM+tHX+w2Uc+KWj7GV+VKKFdMVd2Rx8sdA19hcc3P3AHFYd5LVOw+pYuSd5lICC3gm52B6Rwxw==", + "dev": true, + "requires": { + "core-js-pure": "^3.25.1", + "regenerator-runtime": "^0.13.11" + } + }, + "@esbuild/linux-loong64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.14.54.tgz", + "integrity": "sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw==", + "optional": true + }, + "@rollup/plugin-commonjs": { + "version": "22.0.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-22.0.2.tgz", + "integrity": "sha512-//NdP6iIwPbMTcazYsiBMbJW7gfmpHom33u1beiIoHDEM0Q9clvtQB1T0efvMqHeKsGohiHo97BCPCkBXdscwg==", + "requires": { + "@rollup/pluginutils": "^3.1.0", + "commondir": "^1.0.1", + "estree-walker": "^2.0.1", + "glob": "^7.1.6", + "is-reference": "^1.2.1", + "magic-string": "^0.25.7", + "resolve": "^1.17.0" + } + }, + "@rollup/plugin-node-resolve": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.3.0.tgz", + "integrity": "sha512-Lus8rbUo1eEcnS4yTFKLZrVumLPY+YayBdWXgFSHYhTT2iJbMhoaaBL3xl5NCdeRytErGr8tZ0L71BMRmnlwSw==", + "requires": { + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", + "deepmerge": "^4.2.2", + "is-builtin-module": "^3.1.0", + "is-module": "^1.0.0", + "resolve": "^1.19.0" + } + }, + "@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "requires": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + }, + "dependencies": { + "estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==" + } + } + }, + "@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==" + }, + "@types/node": { + "version": "18.14.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.14.6.tgz", + "integrity": "sha512-93+VvleD3mXwlLI/xASjw0FzKcwzl3OdTCzm1LaRfqgS21gfFtK3zDXM5Op9TeeMsJVOaJ2VRDpT9q4Y3d0AvA==" + }, + "@types/resolve": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", + "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", + "requires": { + "@types/node": "*" + } + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "builtin-modules": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", + "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==" + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "core-js-pure": { + "version": "3.29.0", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.29.0.tgz", + "integrity": "sha512-v94gUjN5UTe1n0yN/opTihJ8QBWD2O8i19RfTZR7foONPWArnjB96QA/wk5ozu1mm6ja3udQCzOzwQXTxi3xOQ==", + "dev": true + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + }, + "deepmerge": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.0.tgz", + "integrity": "sha512-z2wJZXrmeHdvYJp/Ux55wIjqo81G5Bp4c+oELTW+7ar6SogWHajt5a9gO3s3IDaGSAXjDk0vlQKN3rms8ab3og==" + }, + "es-module-lexer": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", + "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==" + }, + "esbuild": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.54.tgz", + "integrity": "sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA==", + "requires": { + "@esbuild/linux-loong64": "0.14.54", + "esbuild-android-64": "0.14.54", + "esbuild-android-arm64": "0.14.54", + "esbuild-darwin-64": "0.14.54", + "esbuild-darwin-arm64": "0.14.54", + "esbuild-freebsd-64": "0.14.54", + "esbuild-freebsd-arm64": "0.14.54", + "esbuild-linux-32": "0.14.54", + "esbuild-linux-64": "0.14.54", + "esbuild-linux-arm": "0.14.54", + "esbuild-linux-arm64": "0.14.54", + "esbuild-linux-mips64le": "0.14.54", + "esbuild-linux-ppc64le": "0.14.54", + "esbuild-linux-riscv64": "0.14.54", + "esbuild-linux-s390x": "0.14.54", + "esbuild-netbsd-64": "0.14.54", + "esbuild-openbsd-64": "0.14.54", + "esbuild-sunos-64": "0.14.54", + "esbuild-windows-32": "0.14.54", + "esbuild-windows-64": "0.14.54", + "esbuild-windows-arm64": "0.14.54" + } + }, + "esbuild-android-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.54.tgz", + "integrity": "sha512-Tz2++Aqqz0rJ7kYBfz+iqyE3QMycD4vk7LBRyWaAVFgFtQ/O8EJOnVmTOiDWYZ/uYzB4kvP+bqejYdVKzE5lAQ==", + "optional": true + }, + "esbuild-android-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.54.tgz", + "integrity": "sha512-F9E+/QDi9sSkLaClO8SOV6etqPd+5DgJje1F9lOWoNncDdOBL2YF59IhsWATSt0TLZbYCf3pNlTHvVV5VfHdvg==", + "optional": true + }, + "esbuild-darwin-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.54.tgz", + "integrity": "sha512-jtdKWV3nBviOd5v4hOpkVmpxsBy90CGzebpbO9beiqUYVMBtSc0AL9zGftFuBon7PNDcdvNCEuQqw2x0wP9yug==", + "optional": true + }, + "esbuild-darwin-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.54.tgz", + "integrity": "sha512-OPafJHD2oUPyvJMrsCvDGkRrVCar5aVyHfWGQzY1dWnzErjrDuSETxwA2HSsyg2jORLY8yBfzc1MIpUkXlctmw==", + "optional": true + }, + "esbuild-freebsd-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.54.tgz", + "integrity": "sha512-OKwd4gmwHqOTp4mOGZKe/XUlbDJ4Q9TjX0hMPIDBUWWu/kwhBAudJdBoxnjNf9ocIB6GN6CPowYpR/hRCbSYAg==", + "optional": true + }, + "esbuild-freebsd-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.54.tgz", + "integrity": "sha512-sFwueGr7OvIFiQT6WeG0jRLjkjdqWWSrfbVwZp8iMP+8UHEHRBvlaxL6IuKNDwAozNUmbb8nIMXa7oAOARGs1Q==", + "optional": true + }, + "esbuild-linux-32": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.54.tgz", + "integrity": "sha512-1ZuY+JDI//WmklKlBgJnglpUL1owm2OX+8E1syCD6UAxcMM/XoWd76OHSjl/0MR0LisSAXDqgjT3uJqT67O3qw==", + "optional": true + }, + "esbuild-linux-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.54.tgz", + "integrity": "sha512-EgjAgH5HwTbtNsTqQOXWApBaPVdDn7XcK+/PtJwZLT1UmpLoznPd8c5CxqsH2dQK3j05YsB3L17T8vE7cp4cCg==", + "optional": true + }, + "esbuild-linux-arm": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.54.tgz", + "integrity": "sha512-qqz/SjemQhVMTnvcLGoLOdFpCYbz4v4fUo+TfsWG+1aOu70/80RV6bgNpR2JCrppV2moUQkww+6bWxXRL9YMGw==", + "optional": true + }, + "esbuild-linux-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.54.tgz", + "integrity": "sha512-WL71L+0Rwv+Gv/HTmxTEmpv0UgmxYa5ftZILVi2QmZBgX3q7+tDeOQNqGtdXSdsL8TQi1vIaVFHUPDe0O0kdig==", + "optional": true + }, + "esbuild-linux-mips64le": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.54.tgz", + "integrity": "sha512-qTHGQB8D1etd0u1+sB6p0ikLKRVuCWhYQhAHRPkO+OF3I/iSlTKNNS0Lh2Oc0g0UFGguaFZZiPJdJey3AGpAlw==", + "optional": true + }, + "esbuild-linux-ppc64le": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.54.tgz", + "integrity": "sha512-j3OMlzHiqwZBDPRCDFKcx595XVfOfOnv68Ax3U4UKZ3MTYQB5Yz3X1mn5GnodEVYzhtZgxEBidLWeIs8FDSfrQ==", + "optional": true + }, + "esbuild-linux-riscv64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.54.tgz", + "integrity": "sha512-y7Vt7Wl9dkOGZjxQZnDAqqn+XOqFD7IMWiewY5SPlNlzMX39ocPQlOaoxvT4FllA5viyV26/QzHtvTjVNOxHZg==", + "optional": true + }, + "esbuild-linux-s390x": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.54.tgz", + "integrity": "sha512-zaHpW9dziAsi7lRcyV4r8dhfG1qBidQWUXweUjnw+lliChJqQr+6XD71K41oEIC3Mx1KStovEmlzm+MkGZHnHA==", + "optional": true + }, + "esbuild-netbsd-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.54.tgz", + "integrity": "sha512-PR01lmIMnfJTgeU9VJTDY9ZerDWVFIUzAtJuDHwwceppW7cQWjBBqP48NdeRtoP04/AtO9a7w3viI+PIDr6d+w==", + "optional": true + }, + "esbuild-openbsd-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.54.tgz", + "integrity": "sha512-Qyk7ikT2o7Wu76UsvvDS5q0amJvmRzDyVlL0qf5VLsLchjCa1+IAvd8kTBgUxD7VBUUVgItLkk609ZHUc1oCaw==", + "optional": true + }, + "esbuild-sunos-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.54.tgz", + "integrity": "sha512-28GZ24KmMSeKi5ueWzMcco6EBHStL3B6ubM7M51RmPwXQGLe0teBGJocmWhgwccA1GeFXqxzILIxXpHbl9Q/Kw==", + "optional": true + }, + "esbuild-windows-32": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.54.tgz", + "integrity": "sha512-T+rdZW19ql9MjS7pixmZYVObd9G7kcaZo+sETqNH4RCkuuYSuv9AGHUVnPoP9hhuE1WM1ZimHz1CIBHBboLU7w==", + "optional": true + }, + "esbuild-windows-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.54.tgz", + "integrity": "sha512-AoHTRBUuYwXtZhjXZbA1pGfTo8cJo3vZIcWGLiUcTNgHpJJMC1rVA44ZereBHMJtotyN71S8Qw0npiCIkW96cQ==", + "optional": true + }, + "esbuild-windows-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.54.tgz", + "integrity": "sha512-M0kuUvXhot1zOISQGXwWn6YtS+Y/1RT9WrVIOywZnJHo3jCDyewAc79aKNQWFCQm+xNHVTq9h8dZKvygoXQQRg==", + "optional": true + }, + "estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "is-builtin-module": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.1.tgz", + "integrity": "sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==", + "requires": { + "builtin-modules": "^3.3.0" + } + }, + "is-core-module": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "requires": { + "has": "^1.0.3" + } + }, + "is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==" + }, + "is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "requires": { + "@types/estree": "*" + } + }, + "joycon": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", + "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==" + }, + "jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==" + }, + "magic-string": { + "version": "0.25.9", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "requires": { + "sourcemap-codec": "^1.4.8" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "requires": { + "wrappy": "1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + }, + "react-devtools-core": { + "version": "4.27.2", + "resolved": "https://registry.npmjs.org/react-devtools-core/-/react-devtools-core-4.27.2.tgz", + "integrity": "sha512-8SzmIkpO87alD7Xr6gWIEa1jHkMjawOZ+6egjazlnjB4UUcbnzGDf/vBJ4BzGuWWEM+pzrxuzsPpcMqlQkYK2g==", + "requires": { + "shell-quote": "^1.6.1", + "ws": "^7" + } + }, + "regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==", + "dev": true + }, + "resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "requires": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "rollup": { + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", + "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", + "requires": { + "fsevents": "~2.3.2" + } + }, + "rollup-plugin-esbuild": { + "version": "4.10.3", + "resolved": "https://registry.npmjs.org/rollup-plugin-esbuild/-/rollup-plugin-esbuild-4.10.3.tgz", + "integrity": "sha512-RILwUCgnCL5vo8vyZ/ZpwcqRuE5KmLizEv6BujBQfgXFZ6ggcS0FiYvQN+gsTJfWCMaU37l0Fosh4eEufyO97Q==", + "requires": { + "@rollup/pluginutils": "^4.1.1", + "debug": "^4.3.3", + "es-module-lexer": "^0.9.3", + "joycon": "^3.0.1", + "jsonc-parser": "^3.0.0" + }, + "dependencies": { + "@rollup/pluginutils": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-4.2.1.tgz", + "integrity": "sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==", + "requires": { + "estree-walker": "^2.0.1", + "picomatch": "^2.2.2" + } + } + } + }, + "shell-quote": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.0.tgz", + "integrity": "sha512-QHsz8GgQIGKlRi24yFc6a6lN69Idnx634w49ay6+jA5yFh7a1UY+4Rp6HPx/L/1zcEDPEij8cIsiqR6bQsE5VQ==" + }, + "sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==" + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "ws": { + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "requires": {} + }, + "xregexp": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-5.1.1.tgz", + "integrity": "sha512-fKXeVorD+CzWvFs7VBuKTYIW63YD1e1osxwQ8caZ6o1jg6pDAbABDG54LCIq0j5cy7PjRvGIq6sef9DYPXpncg==", + "dev": true, + "requires": { + "@babel/runtime-corejs3": "^7.16.5" + } + } + } +} diff --git a/package.json b/package.json index 485e1e1..0ed4a5a 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,8 @@ { + "type": "module", + "scripts": { + "build": "rm -f packages/* && gmake clean package FINALPACKAGE=1 && mv $(find packages -name \"*.deb\") packages/Enmity.Debug.deb" + }, "dependencies": { "@rollup/plugin-commonjs": "^22.0.1", "@rollup/plugin-node-resolve": "^13.3.0", @@ -6,5 +10,8 @@ "react-devtools-core": "^4.24.7", "rollup": "^2.75.7", "rollup-plugin-esbuild": "^4.9.1" + }, + "devDependencies": { + "xregexp": "^5.1.1" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a3a7e1b..5424c80 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,6 +7,7 @@ specifiers: react-devtools-core: ^4.24.7 rollup: ^2.75.7 rollup-plugin-esbuild: ^4.9.1 + xregexp: ^5.1.1 dependencies: '@rollup/plugin-commonjs': 22.0.1_rollup@2.75.7 @@ -16,8 +17,19 @@ dependencies: rollup: 2.75.7 rollup-plugin-esbuild: 4.9.1_qrpxjnto46iodaa4efitqiw3he +devDependencies: + xregexp: 5.1.1 + packages: + /@babel/runtime-corejs3/7.20.13: + resolution: {integrity: sha512-p39/6rmY9uvlzRiLZBIB3G9/EBr66LBMcYm7fIDeSBNdRjF2AGD3rFZucUyAgGHC2N+7DdLvVi33uTjSE44FIw==} + engines: {node: '>=6.9.0'} + dependencies: + core-js-pure: 3.28.0 + regenerator-runtime: 0.13.11 + dev: true + /@rollup/plugin-commonjs/22.0.1_rollup@2.75.7: resolution: {integrity: sha512-dGfEZvdjDHObBiP5IvwTKMVeq/tBZGMBHZFMdIV1ClMM/YoWS34xrHFGfag9SN2ZtMgNZRFruqvxZQEa70O6nQ==} engines: {node: '>= 12.0.0'} @@ -111,6 +123,11 @@ packages: resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} dev: false + /core-js-pure/3.28.0: + resolution: {integrity: sha512-DSOVleA9/v3LNj/vFxAPfUHttKTzrB2RXhAPvR5TPXn4vrra3Z2ssytvRyt8eruJwAfwAiFADEbrjcRdcvPLQQ==} + requiresBuild: true + dev: true + /debug/4.3.4: resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} @@ -471,6 +488,10 @@ packages: - utf-8-validate dev: false + /regenerator-runtime/0.13.11: + resolution: {integrity: sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==} + dev: true + /resolve/1.22.1: resolution: {integrity: sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==} hasBin: true @@ -535,3 +556,9 @@ packages: utf-8-validate: optional: true dev: false + + /xregexp/5.1.1: + resolution: {integrity: sha512-fKXeVorD+CzWvFs7VBuKTYIW63YD1e1osxwQ8caZ6o1jg6pDAbABDG54LCIq0j5cy7PjRvGIq6sef9DYPXpncg==} + dependencies: + '@babel/runtime-corejs3': 7.20.13 + dev: true diff --git a/rollup.config.js b/rollup.config.js index 7feee29..aab0a3a 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -8,7 +8,7 @@ function addWindowDeclaration() { name: 'window-is-this', generateBundle: (_, bundle) => { for (const file in bundle) { - bundle[file].code = 'const window = this;' + bundle[file].code; + bundle[file].code += 'const window = this;'; } } } diff --git a/src/Enmity.h b/src/Enmity.h index 4010dab..99ac1bc 100644 --- a/src/Enmity.h +++ b/src/Enmity.h @@ -8,6 +8,8 @@ #define ENMITY_PATH [NSString stringWithFormat:@"%@/%@", NSHomeDirectory(), @"Documents/Enmity.js"] #define ENMITY_SOURCE [NSURL URLWithString:@"enmity"] +#define VERSION @"2.2.2" +#define TYPE @"Regular" // Disable logs in release mode #ifdef DEBUG @@ -16,4 +18,4 @@ #else # define IS_DEBUG false # define NSLog(...) (void)0 -#endif +#endif \ No newline at end of file diff --git a/src/Enmity.x b/src/Enmity.x index c4c1976..59f1e3b 100644 --- a/src/Enmity.x +++ b/src/Enmity.x @@ -72,8 +72,11 @@ } // Initialize addon states - NSString *addonInit = @"window.plugins = { enabled: [], disabled: [] };"; - %orig([addonInit dataUsingEncoding:NSUTF8StringEncoding], ENMITY_SOURCE, false); + %orig([@"window.plugins = { enabled: [], disabled: [] };" dataUsingEncoding:NSUTF8StringEncoding], ENMITY_SOURCE, false); + + // Add versioning + NSString *formattedVersion = [NSString stringWithFormat:@"window.tweak = { version: \"%@\", type: \"%@\" };", VERSION, TYPE]; + %orig([formattedVersion dataUsingEncoding:NSUTF8StringEncoding], ENMITY_SOURCE, false); // Inject themes NSArray *themesList = getThemes(); diff --git a/src/Plugins.x b/src/Plugins.x index 1c2f134..5800cb0 100644 --- a/src/Plugins.x +++ b/src/Plugins.x @@ -133,7 +133,8 @@ NSString* wrapPlugin(NSString *code, int pluginID, NSString *name) { "try {"\ "%@"\ "} catch(err) {"\ - "console.error(`Fatal error with %@: ${err}`);"\ + "const error = new Error(`Fatal error with %@: ${err}`);"\ + "console.error(error.stack);"\ "}"\ "}, %d, []);"\ "__r(%d);", code, name, pluginID, pluginID diff --git a/src/Theme.h b/src/Theme.h index 57c50e7..3a39be0 100644 --- a/src/Theme.h +++ b/src/Theme.h @@ -1,5 +1,18 @@ #define THEMES_PATH [NSString stringWithFormat:@"%@/%@", NSHomeDirectory(), @"Documents/Themes"] +#define HOOK_TABLE_CELL(name) %hook name \ + - (void)setBackgroundColor:(UIColor*)arg1 { \ + NSString *url = getBackgroundURL(); \ + \ + if (url) { \ + %orig([UIColor clearColor]); \ + return; \ + } \ + \ + %orig(arg1); \ + } \ +%end + BOOL installTheme(NSURL *url); BOOL uninstallTheme(NSString *name); NSString* getThemeName(NSURL *url); diff --git a/src/Theme.x b/src/Theme.x deleted file mode 100644 index cc12ab6..0000000 --- a/src/Theme.x +++ /dev/null @@ -1,2067 +0,0 @@ -#import -#import -#import "Enmity.h" - -NSDictionary *colors = nil; -NSDictionary *background = nil; - -// Convert an UIColor element to a hex string -NSString* hexStringFromColor(UIColor * color) { - const CGFloat *components = CGColorGetComponents(color.CGColor); - - CGFloat r = components[0]; - CGFloat g = components[1]; - CGFloat b = components[2]; - CGFloat a = components[3]; - - return [NSString stringWithFormat:@"#%02lX%02lX%02lX%02lX", - lroundf(r * 255), - lroundf(g * 255), - lroundf(b * 255), - lroundf(a * 255) - ]; -} - -// Convert a hex color string to an UIColor element -UIColor* colorFromHexString(NSString *hexString) { - unsigned rgbValue = 0; - NSScanner *scanner = [NSScanner scannerWithString:hexString]; - [scanner setScanLocation: 1]; - [scanner scanHexInt: &rgbValue]; - - return [UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16)/255.0 green:((rgbValue & 0xFF00) >> 8)/255.0 blue:(rgbValue & 0xFF)/255.0 alpha:1.0]; -} - -// Convert a RGBA color string to an UIColor element -UIColor* colorFromRGBAString(NSString *rgbaString) { - NSRegularExpression *rgbaRegex = [NSRegularExpression regularExpressionWithPattern:@"\\((.*)\\)" options:NSRegularExpressionCaseInsensitive error:nil]; - NSArray *matches = [rgbaRegex matchesInString:rgbaString options:0 range:NSMakeRange(0, [rgbaString length])]; - NSString *value = [[NSString alloc] init]; - - for (NSTextCheckingResult *match in matches) { - NSRange matchRange = [match rangeAtIndex:1]; - value = [rgbaString substringWithRange:matchRange]; - } - - NSArray *values = [value componentsSeparatedByString:@","]; - NSMutableArray *rgbaValues = [[NSMutableArray alloc] init]; - for (NSString* v in values) { - NSString *trimmed = [v stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; - [rgbaValues addObject:[NSNumber numberWithFloat:[trimmed floatValue]]]; - } - - return [UIColor colorWithRed:[[rgbaValues objectAtIndex:0] floatValue]/255.0f green:[[rgbaValues objectAtIndex:1] floatValue]/255.0f blue:[[rgbaValues objectAtIndex:2] floatValue]/255.0f alpha:[[rgbaValues objectAtIndex:3] floatValue]]; -} - -// Get the name of a theme via it's url -NSString* getThemeName(NSURL *url) { - NSString *stripped = [[url lastPathComponent] stringByReplacingOccurrencesOfString:@".disable" withString:@""]; - return [stripped stringByReplacingOccurrencesOfString:@".json" withString:@""]; -} - -// Install a theme -BOOL installTheme(NSURL *url) { - NSString *dest = [NSString stringWithFormat:@"%@/%@", THEMES_PATH, [url lastPathComponent]]; - - BOOL success = downloadFile(url.absoluteString, dest); - return success; -} - -// Check if a plugin exists -BOOL checkTheme(NSString *name) { - NSString *path = [NSString stringWithFormat:@"%@/%@.json", THEMES_PATH, name]; - NSFileManager *fileManager = [NSFileManager defaultManager]; - - if ([fileManager fileExistsAtPath:path]) { - return true; - } - - return false; -} - -// Uninstall a theme -BOOL uninstallTheme(NSString *name) { - NSString *themePath = [NSString stringWithFormat:@"%@/%@.json", THEMES_PATH, name]; - NSFileManager *fileManager = [NSFileManager defaultManager]; - - if (![fileManager fileExistsAtPath:themePath]) { - return false; - } - - NSError *err; - [fileManager - removeItemAtPath:themePath - error:&err]; - - if (err) { - return false; - } - - return true; -} - -// Get the installed themes -NSArray* getThemes() { - NSArray *files = readFolder(THEMES_PATH); - NSMutableArray *themes = [[NSMutableArray alloc] init]; - for (NSString *theme in files) { - if (![theme containsString:@".json"]) { - continue; - } - - [themes addObject:[theme stringByReplacingOccurrencesOfString:@".json" withString:@""]]; - } - - return [themes copy]; -} - -// Get the theme name -NSString* getTheme() { - NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; - NSString *theme = [userDefaults stringForKey:@"theme"]; - - return theme; -} - -// Get the theme mode -int getMode() { - NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; - int mode = [userDefaults integerForKey:@"theme_mode"]; - - return mode; -} - -// Get the theme map -NSDictionary* getThemeMap() { - NSString *name = getTheme(); - if (name == nil) { - return nil; - } - - NSString *themeJson = getThemeJSON(name); - if (themeJson == nil) { - return nil; - } - - NSError *error; - NSMutableDictionary *theme = [NSJSONSerialization JSONObjectWithData:[themeJson dataUsingEncoding:NSUTF8StringEncoding] options:0 error:&error]; - if (error) { - return nil; - } - - int mode = getMode(); - NSDictionary *themeColorMap = theme[@"theme_color_map"]; - NSMutableDictionary *themeMap = [[NSMutableDictionary alloc] init]; - for (NSString* colourName in themeColorMap) { - NSString *colour = themeColorMap[colourName][mode]; - [themeMap setObject:colour forKey:colourName]; - } - - return [themeMap copy]; -} - -// Get the theme file daata -NSString* getThemeJSON(NSString *name) { - NSString *themeFile = [NSString stringWithFormat:@"%@/%@.json", THEMES_PATH, name]; - if (!checkFileExists(themeFile)) { - setTheme(nil, nil); - return nil; - } - - NSData *data = [NSData dataWithContentsOfFile:themeFile]; - return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; -} - -// Set the theme name -void setTheme(NSString *name, NSString *mode) { - NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; - - if (name == nil && mode == nil) { - [userDefaults removeObjectForKey:@"theme"]; - [userDefaults removeObjectForKey:@"theme_mode"]; - colors = [[NSMutableDictionary alloc] init]; - background = [[NSMutableDictionary alloc] init]; - return; - } - - [userDefaults setObject:name forKey:@"theme"]; - [userDefaults setInteger:[mode intValue] forKey:@"theme_mode"]; - colors = nil; - background = nil; -} - -NSDictionary *getBackgroundMap() { - NSString *name = getTheme(); - if (name == nil) { - return nil; - } - - NSString *themeJson = getThemeJSON(name); - if (themeJson == nil) { - return nil; - } - - NSError *error; - NSMutableDictionary *theme = [NSJSONSerialization JSONObjectWithData:[themeJson dataUsingEncoding:NSUTF8StringEncoding] options:0 error:&error]; - if (error) { - return nil; - } - - return [theme[@"background"] copy]; -} - -// Get the bg blur -int getBackgroundBlur() { - if (background == nil) { - background = getBackgroundMap(); - } - - if (![background objectForKey:@"blur"]) { - return 0; - } - - return [[background objectForKey:@"blur"] intValue]; -} - -// Get the bg image -NSString *getBackgroundURL() { - if (background == nil) { - background = getBackgroundMap(); - } - - if (![background objectForKey:@"url"]) { - return @""; - } - - return [background objectForKey:@"url"]; -} - -// Get the bg alpha -float getBackgroundAlpha() { - if (background == nil) { - background = getBackgroundMap(); - } - - if (![background objectForKey:@"alpha"]) { - return 1.0; - } - - return [[background objectForKey:@"alpha"] floatValue]; -} - -// Get a color -UIColor* getColor(NSString *name) { - if (colors == nil) { - colors = getThemeMap(); - } - - if (![colors objectForKey:name]) { - return NULL; - } - - NSString *value = colors[name]; - UIColor *color; - - if ([value containsString:@"rgba"]) { - color = colorFromRGBAString(value); - } else { - color = colorFromHexString(value); - } - - return color; -} - - -@interface UIKeyboard : UIView -@end - -@interface UIKeyboardDockView : UIView -@end - -@interface TUIPredictionView : UIView -@end - -@interface TUIEmojiSearchInputView : UIView -@end - -%group KEYBOARD -id originalKeyboardColor; -%hook UIKeyboard -- (void)didMoveToWindow { - %orig; - - id color = getColor(@"KEYBOARD"); - if (originalKeyboardColor != nil && originalKeyboardColor != color) { - originalKeyboardColor = [self backgroundColor]; - } - if (color != nil) { - [self setBackgroundColor:color]; - } else { - [self setBackgroundColor:originalKeyboardColor]; - } -} -%end - -%hook UIKeyboardDockView -- (void)didMoveToWindow { - %orig; - - id color = getColor(@"KEYBOARD"); - if (originalKeyboardColor != nil && originalKeyboardColor != color) { - originalKeyboardColor = [self backgroundColor]; - } - if (color != nil) { - [self setBackgroundColor:color]; - } else { - [self setBackgroundColor:originalKeyboardColor]; - } -} -%end - -%hook UIKBRenderConfig -- (void)setLightKeyboard:(BOOL)arg1 { - %orig(NO); -} -%end - -%hook TUIPredictionView -- (void)didMoveToWindow { - %orig; - - - id color = getColor(@"KEYBOARD"); - if (originalKeyboardColor != nil && originalKeyboardColor != color) { - originalKeyboardColor = [self backgroundColor]; - } - if (color != nil) { - [self setBackgroundColor:color]; - - for (UIView *subview in self.subviews) { - [subview setBackgroundColor:color]; - } - } else { - [self setBackgroundColor:originalKeyboardColor]; - for (UIView *subview in self.subviews) { - [subview setBackgroundColor:originalKeyboardColor]; - } - } -} -%end - -%hook TUIEmojiSearchInputView -- (void)didMoveToWindow { - %orig; - - id color = getColor(@"KEYBOARD"); - if (originalKeyboardColor != nil && originalKeyboardColor != color) { - originalKeyboardColor = [self backgroundColor]; - } - if (color != nil) { - [self setBackgroundColor:color]; - } else { - [self setBackgroundColor:originalKeyboardColor]; - } -} -%end -%end - - -@interface DCDUploadProgressView : UIView -@end - -%hook DCDUploadProgressView -- (void)didMoveToWindow { - %orig; - - id color = getColor(@"BACKGROUND_SECONDARY_ALT"); - if (color != nil) { - UIView *subview = self.subviews[0]; - [subview setBackgroundColor:color]; - } -} -%end - -%hook DCDBaseMessageTableViewCell -- (void)setBackgroundColor:(UIColor*)arg1 { - NSString *url = getBackgroundURL(); - - if (url) { - %orig([UIColor clearColor]); - return; - } - - %orig(arg1); -} -%end - -%hook DCDSeparatorTableViewCell -- (void)setBackgroundColor:(UIColor*)arg1 { - NSString *url = getBackgroundURL(); - - if (url) { - %orig([UIColor clearColor]); - return; - } - - %orig(arg1); -} -%end - -%hook DCDBlockedMessageTableViewCell -- (void)setBackgroundColor:(UIColor*)arg1 { - NSString *url = getBackgroundURL(); - - if (url) { - %orig([UIColor clearColor]); - return; - } - - %orig(arg1); -} -%end - -%hook DCDSystemMessageTableViewCell -- (void)setBackgroundColor:(UIColor*)arg1 { - NSString *url = getBackgroundURL(); - - if (url) { - %orig([UIColor clearColor]); - return; - } - - %orig(arg1); -} -%end - -%hook DCDLoadingTableViewCell -- (void)setBackgroundColor:(UIColor*)arg1 { - NSString *url = getBackgroundURL(); - - if (url) { - %orig([UIColor clearColor]); - return; - } - - %orig(arg1); -} -%end - -@interface DCDChat : UIView -@end - -%hook DCDChat -- (void)configureSubviewsWithContentAdjustment:(double)arg1 { - %orig; - - id chatColor = getColor(@"BACKGROUND_PRIMARY"); - if (chatColor) { - [self setBackgroundColor:chatColor]; - } - - UIView *subview = [self.subviews firstObject]; - if ([subview isKindOfClass:[UIImageView class]]) { - return; - } - - if (background == nil) { - background = getBackgroundMap(); - } - - if (background == nil) { - return; - } - - NSString *url = getBackgroundURL(); - - if (url) { - int blur = getBackgroundBlur(); - [subview setBackgroundColor:[UIColor clearColor]]; - UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:url]]]; - - CIImage *ciImage = [CIImage imageWithCGImage:image.CGImage]; - CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur"]; - [filter setValue:ciImage forKey:kCIInputImageKey]; - [filter setValue:[NSNumber numberWithFloat: blur] forKey:@"inputRadius"]; - CIImage *result = [filter valueForKey:kCIOutputImageKey]; - CIImage *croppedImage = [result imageByCroppingToRect:ciImage.extent]; - - UIImageView *imageView = [[UIImageView alloc] initWithImage:[[UIImage alloc] initWithCIImage:croppedImage]]; - imageView.frame = subview.frame; - imageView.alpha = getBackgroundAlpha(); - [self insertSubview:imageView atIndex:0]; - } -} -%end - -%ctor { - %init - - NSBundle* bundle = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/TextInputUI.framework"]; - if (!bundle.loaded) [bundle load]; - %init(KEYBOARD); -} - -// Rain hellfire on discord. -%hook DCDThemeColor -+ (id)HEADER_PRIMARY { - id original = %orig; - id color = getColor(@"HEADER_PRIMARY"); - - if (color) { - return color; - } - - return original; -} - -+ (id)HEADER_SECONDARY { - id original = %orig; - id color = getColor(@"HEADER_SECONDARY"); - - if (color) { - return color; - } - - return original; -} - -+ (id)TEXT_NORMAL { - id original = %orig; - id color = getColor(@"TEXT_NORMAL"); - - if (color) { - return color; - } - - return original; -} - -+ (id)TEXT_MUTED { - id original = %orig; - id color = getColor(@"TEXT_MUTED"); - - if (color) { - return color; - } - - return original; -} - -+ (id)TEXT_LINK { - id original = %orig; - id color = getColor(@"TEXT_LINK"); - - if (color) { - return color; - } - - return original; -} - -+ (id)TEXT_LINK_LOW_SATURATION { - id original = %orig; - id color = getColor(@"TEXT_LINK_LOW_SATURATION"); - - if (color) { - return color; - } - - return original; -} - -+ (id)TEXT_POSITIVE { - id original = %orig; - id color = getColor(@"TEXT_POSITIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)TEXT_WARNING { - id original = %orig; - id color = getColor(@"TEXT_WARNING"); - - if (color) { - return color; - } - - return original; -} - -+ (id)TEXT_DANGER { - id original = %orig; - id color = getColor(@"TEXT_DANGER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)TEXT_BRAND { - id original = %orig; - id color = getColor(@"TEXT_BRAND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)INTERACTIVE_NORMAL { - id original = %orig; - id color = getColor(@"INTERACTIVE_NORMAL"); - - if (color) { - return color; - } - - return original; -} - -+ (id)INTERACTIVE_HOVER { - id original = %orig; - id color = getColor(@"INTERACTIVE_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)INTERACTIVE_ACTIVE { - id original = %orig; - id color = getColor(@"INTERACTIVE_ACTIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)INTERACTIVE_MUTED { - id original = %orig; - id color = getColor(@"INTERACTIVE_MUTED"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BACKGROUND_PRIMARY { - id original = %orig; - id color = getColor(@"BACKGROUND_PRIMARY"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BACKGROUND_SECONDARY { - id original = %orig; - id color = getColor(@"BACKGROUND_SECONDARY"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BACKGROUND_SECONDARY_ALT { - id original = %orig; - id color = getColor(@"BACKGROUND_SECONDARY_ALT"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BACKGROUND_TERTIARY { - id original = %orig; - id color = getColor(@"BACKGROUND_TERTIARY"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BACKGROUND_ACCENT { - id original = %orig; - id color = getColor(@"BACKGROUND_ACCENT"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BACKGROUND_FLOATING { - id original = %orig; - id color = getColor(@"BACKGROUND_FLOATING"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BACKGROUND_NESTED_FLOATING { - id original = %orig; - id color = getColor(@"BACKGROUND_NESTED_FLOATING"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BACKGROUND_MOBILE_PRIMARY { - id original = %orig; - id color = getColor(@"BACKGROUND_MOBILE_PRIMARY"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BACKGROUND_MOBILE_SECONDARY { - id original = %orig; - id color = getColor(@"BACKGROUND_MOBILE_SECONDARY"); - - if (color) { - return color; - } - - return original; -} - -+ (id)CHAT_BACKGROUND { - id original = %orig; - id color = getColor(@"CHAT_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)CHAT_BORDER { - id original = %orig; - id color = getColor(@"CHAT_BORDER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)CHAT_INPUT_CONTAINER_BACKGROUND { - id original = %orig; - id color = getColor(@"CHAT_INPUT_CONTAINER_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BACKGROUND_MODIFIER_HOVER { - id original = %orig; - id color = getColor(@"BACKGROUND_MODIFIER_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BACKGROUND_MODIFIER_ACTIVE { - id original = %orig; - id color = getColor(@"BACKGROUND_MODIFIER_ACTIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BACKGROUND_MODIFIER_SELECTED { - id original = %orig; - id color = getColor(@"BACKGROUND_MODIFIER_SELECTED"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BACKGROUND_MODIFIER_ACCENT { - id original = %orig; - id color = getColor(@"BACKGROUND_MODIFIER_ACCENT"); - - if (color) { - return color; - } - - return original; -} - -+ (id)INFO_POSITIVE_BACKGROUND { - id original = %orig; - id color = getColor(@"INFO_POSITIVE_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)INFO_POSITIVE_FOREGROUND { - id original = %orig; - id color = getColor(@"INFO_POSITIVE_FOREGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)INFO_POSITIVE_TEXT { - id original = %orig; - id color = getColor(@"INFO_POSITIVE_TEXT"); - - if (color) { - return color; - } - - return original; -} - -+ (id)INFO_WARNING_BACKGROUND { - id original = %orig; - id color = getColor(@"INFO_WARNING_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)INFO_WARNING_FOREGROUND { - id original = %orig; - id color = getColor(@"INFO_WARNING_FOREGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)INFO_WARNING_TEXT { - id original = %orig; - id color = getColor(@"INFO_WARNING_TEXT"); - - if (color) { - return color; - } - - return original; -} - -+ (id)INFO_DANGER_BACKGROUND { - id original = %orig; - id color = getColor(@"INFO_DANGER_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)INFO_DANGER_FOREGROUND { - id original = %orig; - id color = getColor(@"INFO_DANGER_FOREGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)INFO_DANGER_TEXT { - id original = %orig; - id color = getColor(@"INFO_DANGER_TEXT"); - - if (color) { - return color; - } - - return original; -} - -+ (id)INFO_HELP_BACKGROUND { - id original = %orig; - id color = getColor(@"INFO_HELP_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)INFO_HELP_FOREGROUND { - id original = %orig; - id color = getColor(@"INFO_HELP_FOREGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)INFO_HELP_TEXT { - id original = %orig; - id color = getColor(@"INFO_HELP_TEXT"); - - if (color) { - return color; - } - - return original; -} - -+ (id)STATUS_POSITIVE_BACKGROUND { - id original = %orig; - id color = getColor(@"STATUS_POSITIVE_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)STATUS_POSITIVE_TEXT { - id original = %orig; - id color = getColor(@"STATUS_POSITIVE_TEXT"); - - if (color) { - return color; - } - - return original; -} - -+ (id)STATUS_WARNING_BACKGROUND { - id original = %orig; - id color = getColor(@"STATUS_WARNING_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)STATUS_WARNING_TEXT { - id original = %orig; - id color = getColor(@"STATUS_WARNING_TEXT"); - - if (color) { - return color; - } - - return original; -} - -+ (id)STATUS_DANGER_BACKGROUND { - id original = %orig; - id color = getColor(@"STATUS_DANGER_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)STATUS_DANGER_TEXT { - id original = %orig; - id color = getColor(@"STATUS_DANGER_TEXT"); - - if (color) { - return color; - } - - return original; -} - -+ (id)STATUS_DANGER { - id original = %orig; - id color = getColor(@"STATUS_DANGER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)STATUS_POSITIVE { - id original = %orig; - id color = getColor(@"STATUS_POSITIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)STATUS_WARNING { - id original = %orig; - id color = getColor(@"STATUS_WARNING"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_DANGER_BACKGROUND { - id original = %orig; - id color = getColor(@"BUTTON_DANGER_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_DANGER_BACKGROUND_HOVER { - id original = %orig; - id color = getColor(@"BUTTON_DANGER_BACKGROUND_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_DANGER_BACKGROUND_ACTIVE { - id original = %orig; - id color = getColor(@"BUTTON_DANGER_BACKGROUND_ACTIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_DANGER_BACKGROUND_DISABLED { - id original = %orig; - id color = getColor(@"BUTTON_DANGER_BACKGROUND_DISABLED"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_POSITIVE_BACKGROUND { - id original = %orig; - id color = getColor(@"BUTTON_POSITIVE_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_POSITIVE_BACKGROUND_HOVER { - id original = %orig; - id color = getColor(@"BUTTON_POSITIVE_BACKGROUND_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_POSITIVE_BACKGROUND_ACTIVE { - id original = %orig; - id color = getColor(@"BUTTON_POSITIVE_BACKGROUND_ACTIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_POSITIVE_BACKGROUND_DISABLED { - id original = %orig; - id color = getColor(@"BUTTON_POSITIVE_BACKGROUND_DISABLED"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_SECONDARY_BACKGROUND { - id original = %orig; - id color = getColor(@"BUTTON_SECONDARY_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_SECONDARY_BACKGROUND_HOVER { - id original = %orig; - id color = getColor(@"BUTTON_SECONDARY_BACKGROUND_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_SECONDARY_BACKGROUND_ACTIVE { - id original = %orig; - id color = getColor(@"BUTTON_SECONDARY_BACKGROUND_ACTIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_SECONDARY_BACKGROUND_DISABLED { - id original = %orig; - id color = getColor(@"BUTTON_SECONDARY_BACKGROUND_DISABLED"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_DANGER_TEXT { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_DANGER_TEXT"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_DANGER_BORDER { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_DANGER_BORDER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_DANGER_BACKGROUND { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_DANGER_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_DANGER_BACKGROUND_HOVER { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_DANGER_BACKGROUND_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_DANGER_TEXT_HOVER { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_DANGER_TEXT_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_DANGER_BORDER_HOVER { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_DANGER_BORDER_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_DANGER_BACKGROUND_ACTIVE { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_DANGER_BACKGROUND_ACTIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_DANGER_TEXT_ACTIVE { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_DANGER_TEXT_ACTIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_DANGER_BORDER_ACTIVE { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_DANGER_BORDER_ACTIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_POSITIVE_TEXT { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_POSITIVE_TEXT"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_POSITIVE_BORDER { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_POSITIVE_BORDER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_POSITIVE_BACKGROUND { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_POSITIVE_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_POSITIVE_BACKGROUND_HOVER { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_POSITIVE_BACKGROUND_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_POSITIVE_TEXT_HOVER { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_POSITIVE_TEXT_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_POSITIVE_BORDER_HOVER { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_POSITIVE_BORDER_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_POSITIVE_BACKGROUND_ACTIVE { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_POSITIVE_BACKGROUND_ACTIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_POSITIVE_TEXT_ACTIVE { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_POSITIVE_TEXT_ACTIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_POSITIVE_BORDER_ACTIVE { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_POSITIVE_BORDER_ACTIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_BRAND_TEXT { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_BRAND_TEXT"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_BRAND_BORDER { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_BRAND_BORDER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_BRAND_BACKGROUND { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_BRAND_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_BRAND_BACKGROUND_HOVER { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_BRAND_BACKGROUND_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_BRAND_TEXT_HOVER { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_BRAND_TEXT_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_BRAND_BORDER_HOVER { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_BRAND_BORDER_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_BRAND_BACKGROUND_ACTIVE { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_BRAND_BACKGROUND_ACTIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_BRAND_TEXT_ACTIVE { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_BRAND_TEXT_ACTIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_BRAND_BORDER_ACTIVE { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_BRAND_BORDER_ACTIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_PRIMARY_TEXT { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_PRIMARY_TEXT"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_PRIMARY_BORDER { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_PRIMARY_BORDER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_PRIMARY_BACKGROUND { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_PRIMARY_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_PRIMARY_BACKGROUND_HOVER { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_PRIMARY_BACKGROUND_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_PRIMARY_TEXT_HOVER { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_PRIMARY_TEXT_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_PRIMARY_BORDER_HOVER { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_PRIMARY_BORDER_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_PRIMARY_BACKGROUND_ACTIVE { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_PRIMARY_BACKGROUND_ACTIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_PRIMARY_TEXT_ACTIVE { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_PRIMARY_TEXT_ACTIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BUTTON_OUTLINE_PRIMARY_BORDER_ACTIVE { - id original = %orig; - id color = getColor(@"BUTTON_OUTLINE_PRIMARY_BORDER_ACTIVE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)MODAL_BACKGROUND { - id original = %orig; - id color = getColor(@"MODAL_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)MODAL_FOOTER_BACKGROUND { - id original = %orig; - id color = getColor(@"MODAL_FOOTER_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)SCROLLBAR_THIN_THUMB { - id original = %orig; - id color = getColor(@"SCROLLBAR_THIN_THUMB"); - - if (color) { - return color; - } - - return original; -} - -+ (id)SCROLLBAR_THIN_TRACK { - id original = %orig; - id color = getColor(@"SCROLLBAR_THIN_TRACK"); - - if (color) { - return color; - } - - return original; -} - -+ (id)SCROLLBAR_AUTO_THUMB { - id original = %orig; - id color = getColor(@"SCROLLBAR_AUTO_THUMB"); - - if (color) { - return color; - } - - return original; -} - -+ (id)SCROLLBAR_AUTO_TRACK { - id original = %orig; - id color = getColor(@"SCROLLBAR_AUTO_TRACK"); - - if (color) { - return color; - } - - return original; -} - -+ (id)SCROLLBAR_AUTO_SCROLLBAR_COLOR_THUMB { - id original = %orig; - id color = getColor(@"SCROLLBAR_AUTO_SCROLLBAR_COLOR_THUMB"); - - if (color) { - return color; - } - - return original; -} - -+ (id)SCROLLBAR_AUTO_SCROLLBAR_COLOR_TRACK { - id original = %orig; - id color = getColor(@"SCROLLBAR_AUTO_SCROLLBAR_COLOR_TRACK"); - - if (color) { - return color; - } - - return original; -} - -+ (id)INPUT_BACKGROUND { - id original = %orig; - id color = getColor(@"INPUT_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)INPUT_PLACEHOLDER_TEXT { - id original = %orig; - id color = getColor(@"INPUT_PLACEHOLDER_TEXT"); - - if (color) { - return color; - } - - return original; -} - -+ (id)ELEVATION_STROKE { - id original = %orig; - id color = getColor(@"ELEVATION_STROKE"); - - if (color) { - return color; - } - - return original; -} - -+ (id)ELEVATION_LOW { - id original = %orig; - id color = getColor(@"ELEVATION_LOW"); - - if (color) { - return color; - } - - return original; -} - -+ (id)ELEVATION_MEDIUM { - id original = %orig; - id color = getColor(@"ELEVATION_MEDIUM"); - - if (color) { - return color; - } - - return original; -} - -+ (id)ELEVATION_HIGH { - id original = %orig; - id color = getColor(@"ELEVATION_HIGH"); - - if (color) { - return color; - } - - return original; -} - -+ (id)LOGO_PRIMARY { - id original = %orig; - id color = getColor(@"LOGO_PRIMARY"); - - if (color) { - return color; - } - - return original; -} - -+ (id)FOCUS_PRIMARY { - id original = %orig; - id color = getColor(@"FOCUS_PRIMARY"); - - if (color) { - return color; - } - - return original; -} - -+ (id)CONTROL_BRAND_FOREGROUND { - id original = %orig; - id color = getColor(@"CONTROL_BRAND_FOREGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)CONTROL_BRAND_FOREGROUND_NEW { - id original = %orig; - id color = getColor(@"CONTROL_BRAND_FOREGROUND_NEW"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BACKGROUND_MENTIONED { - id original = %orig; - id color = getColor(@"BACKGROUND_MENTIONED"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BACKGROUND_MENTIONED_HOVER { - id original = %orig; - id color = getColor(@"BACKGROUND_MENTIONED_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BACKGROUND_MESSAGE_HOVER { - id original = %orig; - id color = getColor(@"BACKGROUND_MESSAGE_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BACKGROUND_MESSAGE_AUTOMOD { - id original = %orig; - id color = getColor(@"BACKGROUND_MESSAGE_AUTOMOD"); - - if (color) { - return color; - } - - return original; -} - -+ (id)BACKGROUND_MESSAGE_AUTOMOD_HOVER { - id original = %orig; - id color = getColor(@"BACKGROUND_MESSAGE_AUTOMOD_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)CHANNELS_DEFAULT { - id original = %orig; - id color = getColor(@"CHANNELS_DEFAULT"); - - if (color) { - return color; - } - - return original; -} - -+ (id)CHANNEL_ICON { - id original = %orig; - id color = getColor(@"CHANNEL_ICON"); - - if (color) { - return color; - } - - return original; -} - -+ (id)CHANNEL_TEXT_AREA_PLACEHOLDER { - id original = %orig; - id color = getColor(@"CHANNEL_TEXT_AREA_PLACEHOLDER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)GUILD_HEADER_TEXT_SHADOW { - id original = %orig; - id color = getColor(@"GUILD_HEADER_TEXT_SHADOW"); - - if (color) { - return color; - } - - return original; -} - -+ (id)CHANNELTEXTAREA_BACKGROUND { - id original = %orig; - id color = getColor(@"CHANNELTEXTAREA_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)ACTIVITY_CARD_BACKGROUND { - id original = %orig; - id color = getColor(@"ACTIVITY_CARD_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)TEXTBOX_MARKDOWN_SYNTAX { - id original = %orig; - id color = getColor(@"TEXTBOX_MARKDOWN_SYNTAX"); - - if (color) { - return color; - } - - return original; -} - -+ (id)SPOILER_REVEALED_BACKGROUND { - id original = %orig; - id color = getColor(@"SPOILER_REVEALED_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)SPOILER_HIDDEN_BACKGROUND { - id original = %orig; - id color = getColor(@"SPOILER_HIDDEN_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)ANDROID_NAVIGATION_BAR_BACKGROUND { - id original = %orig; - id color = getColor(@"ANDROID_NAVIGATION_BAR_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)DEPRECATED_CARD_BG { - id original = %orig; - id color = getColor(@"DEPRECATED_CARD_BG"); - - if (color) { - return color; - } - - return original; -} - -+ (id)DEPRECATED_CARD_EDITABLE_BG { - id original = %orig; - id color = getColor(@"DEPRECATED_CARD_EDITABLE_BG"); - - if (color) { - return color; - } - - return original; -} - -+ (id)DEPRECATED_STORE_BG { - id original = %orig; - id color = getColor(@"DEPRECATED_STORE_BG"); - - if (color) { - return color; - } - - return original; -} - -+ (id)DEPRECATED_QUICKSWITCHER_INPUT_BACKGROUND { - id original = %orig; - id color = getColor(@"DEPRECATED_QUICKSWITCHER_INPUT_BACKGROUND"); - - if (color) { - return color; - } - - return original; -} - -+ (id)DEPRECATED_QUICKSWITCHER_INPUT_PLACEHOLDER { - id original = %orig; - id color = getColor(@"DEPRECATED_QUICKSWITCHER_INPUT_PLACEHOLDER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)DEPRECATED_TEXT_INPUT_BG { - id original = %orig; - id color = getColor(@"DEPRECATED_TEXT_INPUT_BG"); - - if (color) { - return color; - } - - return original; -} - -+ (id)DEPRECATED_TEXT_INPUT_BORDER { - id original = %orig; - id color = getColor(@"DEPRECATED_TEXT_INPUT_BORDER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)DEPRECATED_TEXT_INPUT_BORDER_HOVER { - id original = %orig; - id color = getColor(@"DEPRECATED_TEXT_INPUT_BORDER_HOVER"); - - if (color) { - return color; - } - - return original; -} - -+ (id)DEPRECATED_TEXT_INPUT_BORDER_DISABLED { - id original = %orig; - id color = getColor(@"DEPRECATED_TEXT_INPUT_BORDER_DISABLED"); - - if (color) { - return color; - } - - return original; -} - -+ (id)DEPRECATED_TEXT_INPUT_PREFIX { - id original = %orig; - id color = getColor(@"DEPRECATED_TEXT_INPUT_PREFIX"); - - if (color) { - return color; - } - - return original; -} -%end \ No newline at end of file diff --git a/src/Theme.xi b/src/Theme.xi new file mode 100644 index 0000000..e8666df --- /dev/null +++ b/src/Theme.xi @@ -0,0 +1,554 @@ +#import +#import +#import +#import "substrate.h" +#import "Enmity.h" +#import "Theme.h" + +NSDictionary *semanticColors = nil; +NSDictionary *rawColors = nil; +NSDictionary *background = nil; + +// Convert an UIColor element to a hex string +NSString* hexStringFromColor(UIColor * color) { + const CGFloat *components = CGColorGetComponents(color.CGColor); + + CGFloat r = components[0]; + CGFloat g = components[1]; + CGFloat b = components[2]; + CGFloat a = components[3]; + + return [NSString stringWithFormat:@"#%02lX%02lX%02lX%02lX", + lroundf(r * 255), + lroundf(g * 255), + lroundf(b * 255), + lroundf(a * 255) + ]; +} + +// Convert a hex color string to an UIColor element +UIColor* colorFromHexString(NSString *hexString) { + unsigned rgbValue = 0; + NSScanner *scanner = [NSScanner scannerWithString:hexString]; + [scanner setScanLocation: 1]; + [scanner scanHexInt: &rgbValue]; + + return [UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16)/255.0 green:((rgbValue & 0xFF00) >> 8)/255.0 blue:(rgbValue & 0xFF)/255.0 alpha:1.0]; +} + +// Convert a RGBA color string to an UIColor element +UIColor* colorFromRGBAString(NSString *rgbaString) { + NSRegularExpression *rgbaRegex = [NSRegularExpression regularExpressionWithPattern:@"\\((.*)\\)" options:NSRegularExpressionCaseInsensitive error:nil]; + NSArray *matches = [rgbaRegex matchesInString:rgbaString options:0 range:NSMakeRange(0, [rgbaString length])]; + NSString *value = [[NSString alloc] init]; + + for (NSTextCheckingResult *match in matches) { + NSRange matchRange = [match rangeAtIndex:1]; + value = [rgbaString substringWithRange:matchRange]; + } + + NSArray *values = [value componentsSeparatedByString:@","]; + NSMutableArray *rgbaValues = [[NSMutableArray alloc] init]; + for (NSString* v in values) { + NSString *trimmed = [v stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; + [rgbaValues addObject:[NSNumber numberWithFloat:[trimmed floatValue]]]; + } + + return [UIColor colorWithRed:[[rgbaValues objectAtIndex:0] floatValue]/255.0f green:[[rgbaValues objectAtIndex:1] floatValue]/255.0f blue:[[rgbaValues objectAtIndex:2] floatValue]/255.0f alpha:[[rgbaValues objectAtIndex:3] floatValue]]; +} + +// Get the name of a theme via it's url +NSString* getThemeName(NSURL *url) { + NSString *stripped = [[url lastPathComponent] stringByReplacingOccurrencesOfString:@".disable" withString:@""]; + return [stripped stringByReplacingOccurrencesOfString:@".json" withString:@""]; +} + +// Install a theme +BOOL installTheme(NSURL *url) { + NSString *dest = [NSString stringWithFormat:@"%@/%@", THEMES_PATH, [url lastPathComponent]]; + + BOOL success = downloadFile(url.absoluteString, dest); + return success; +} + +// Check if a theme exists +BOOL checkTheme(NSString *name) { + NSString *path = [NSString stringWithFormat:@"%@/%@.json", THEMES_PATH, name]; + NSFileManager *fileManager = [NSFileManager defaultManager]; + + if ([fileManager fileExistsAtPath:path]) { + return true; + } + + return false; +} + +// Uninstall a theme +BOOL uninstallTheme(NSString *name) { + NSString *themePath = [NSString stringWithFormat:@"%@/%@.json", THEMES_PATH, name]; + NSFileManager *fileManager = [NSFileManager defaultManager]; + + if (![fileManager fileExistsAtPath:themePath]) { + return false; + } + + NSError *err; + [fileManager + removeItemAtPath:themePath + error:&err]; + + if (err) { + return false; + } + + return true; +} + +// Get the installed themes +NSArray* getThemes() { + NSArray *files = readFolder(THEMES_PATH); + NSMutableArray *themes = [[NSMutableArray alloc] init]; + for (NSString *theme in files) { + if (![theme containsString:@".json"]) { + continue; + } + + [themes addObject:[theme stringByReplacingOccurrencesOfString:@".json" withString:@""]]; + } + + return [themes copy]; +} + +// Get the theme name +NSString* getTheme() { + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; + NSString *theme = [userDefaults stringForKey:@"theme"]; + + return theme; +} + +// Get the theme mode +int getMode() { + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; + int mode = [userDefaults integerForKey:@"theme_mode"]; + + return mode; +} + +// Get the theme map +NSDictionary* getThemeMap(NSString *kind) { + NSString *name = getTheme(); + if (name == nil) { + return nil; + } + + NSString *themeJson = getThemeJSON(name); + if (themeJson == nil) { + return nil; + } + + NSError *error; + NSMutableDictionary *theme = [NSJSONSerialization JSONObjectWithData:[themeJson dataUsingEncoding:NSUTF8StringEncoding] options:0 error:&error]; + if (error) { + return nil; + } + + int mode = getMode(); + + // conditions: + // kind: semantic/raw + // spec: legacy/updated + if ([kind isEqual:@"semantic"]) { + NSDictionary *colorMap = theme[@"semanticColors"] ? theme[@"semanticColors"] : theme[@"theme_color_map"]; + NSMutableDictionary *themeMap = [[NSMutableDictionary alloc] init]; + for (NSString* colorName in colorMap) { + [themeMap setObject:colorMap[colorName][mode] forKey: colorName]; + } + + return [themeMap copy]; + } + + if ([kind isEqual:@"raw"]) { + NSDictionary *colorMap = theme[@"rawColors"] ? theme[@"rawColors"] : theme[@"colours"]; + NSMutableDictionary *themeMap = [[NSMutableDictionary alloc] init]; + for (NSString* colorName in colorMap) { + NSString *color = colorMap[colorName]; + NSString *replacesPrimaryDark = [color stringByReplacingOccurrencesOfString:@"PRIMARY_DARK" withString:@"PRIMARY"]; + NSString *replacesPrimaryLight = [replacesPrimaryDark stringByReplacingOccurrencesOfString:@"PRIMARY_LIGHT" withString:@"PRIMARY"]; + NSString *replacesBrandNew = [replacesPrimaryLight stringByReplacingOccurrencesOfString:@"BRAND_NEW" withString:@"BRAND"]; + NSString *replacesStatus = [replacesBrandNew stringByReplacingOccurrencesOfString:@"STATUS_" withString:@""]; + [themeMap setObject:replacesStatus forKey: colorName]; + } + + return [themeMap copy]; + } + + return [theme[@"semanticColors"] copy]; +} + +// Get the theme file daata +NSString* getThemeJSON(NSString *name) { + NSString *themeFile = [NSString stringWithFormat:@"%@/%@.json", THEMES_PATH, name]; + if (!checkFileExists(themeFile)) { + setTheme(nil, nil); + return nil; + } + + NSData *data = [NSData dataWithContentsOfFile:themeFile]; + return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; +} + +// Set the theme name +void setTheme(NSString *name, NSString *mode) { + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; + + if (name == nil && mode == nil) { + [userDefaults removeObjectForKey:@"theme"]; + [userDefaults removeObjectForKey:@"theme_mode"]; + semanticColors = [[NSMutableDictionary alloc] init]; + rawColors = [[NSMutableDictionary alloc] init]; + background = [[NSMutableDictionary alloc] init]; + return; + } + + [userDefaults setObject:name forKey:@"theme"]; + [userDefaults setInteger:[mode intValue] forKey:@"theme_mode"]; + semanticColors = nil; + rawColors = nil; + background = nil; +} + +NSDictionary *getBackgroundMap() { + NSString *name = getTheme(); + if (name == nil) { + return nil; + } + + NSString *themeJson = getThemeJSON(name); + if (themeJson == nil) { + return nil; + } + + NSError *error; + NSMutableDictionary *theme = [NSJSONSerialization JSONObjectWithData:[themeJson dataUsingEncoding:NSUTF8StringEncoding] options:0 error:&error]; + if (error) { + return nil; + } + + return [theme[@"background"] copy]; +} + +// Get the bg blur +int getBackgroundBlur() { + if (background == nil) { + background = getBackgroundMap(); + } + + if (![background objectForKey:@"blur"]) { + return 0; + } + + return [[background objectForKey:@"blur"] intValue]; +} + +// Get the bg image +NSString *getBackgroundURL() { + if (background == nil) { + background = getBackgroundMap(); + } + + if (![background objectForKey:@"url"]) { + return @""; + } + + return [background objectForKey:@"url"]; +} + +// Get the bg alpha +float getBackgroundAlpha() { + if (background == nil) { + background = getBackgroundMap(); + } + + if (![background objectForKey:@"alpha"]) { + return 1.0; + } + + return [[background objectForKey:@"alpha"] floatValue]; +} + +// Get a color +UIColor* getColor(NSString *name, NSString *kind) { + if ([kind isEqual:@"semantic"]) { + if (!semanticColors) { + semanticColors = getThemeMap(kind); + } + + if (![semanticColors objectForKey:name]) { + return NULL; + } + + NSString *value = semanticColors[name]; + UIColor *color; + + if ([value containsString:@"rgba"]) { + color = colorFromRGBAString(value); + } else { + color = colorFromHexString(value); + } + + return color; + } + + if ([kind isEqual:@"raw"]) { + if (!rawColors) { + rawColors = getThemeMap(kind); + } + + if (![rawColors objectForKey:name]) { + return NULL; + } + + NSString *value = rawColors[name]; + UIColor *color; + + if ([value containsString:@"rgba"]) { + color = colorFromRGBAString(value); + } else { + color = colorFromHexString(value); + } + + return color; + } + + return NULL; +} + + +@interface UIKeyboard : UIView +@end + +@interface UIKeyboardDockView : UIView +@end + +@interface TUIPredictionView : UIView +@end + +@interface TUIEmojiSearchInputView : UIView +@end + +%group KEYBOARD + + id originalKeyboardColor; + + %hook UIKeyboard + - (void)didMoveToWindow { + %orig; + + id color = getColor(@"KEYBOARD", @"semantic"); + if (originalKeyboardColor != nil && originalKeyboardColor != color) { + originalKeyboardColor = [self backgroundColor]; + } + if (color != nil) { + [self setBackgroundColor:color]; + } else { + [self setBackgroundColor:originalKeyboardColor]; + } + } + + %end + + %hook UIKeyboardDockView + + - (void)didMoveToWindow { + %orig; + + id color = getColor(@"KEYBOARD", @"semantic"); + if (originalKeyboardColor != nil && originalKeyboardColor != color) { + originalKeyboardColor = [self backgroundColor]; + } + if (color != nil) { + [self setBackgroundColor:color]; + } else { + [self setBackgroundColor:originalKeyboardColor]; + } + } + + %end + + %hook UIKBRenderConfig + + - (void)setLightKeyboard:(BOOL)arg1 { + %orig(NO); + } + + %end + + %hook TUIPredictionView + - (void)didMoveToWindow { + %orig; + + + id color = getColor(@"KEYBOARD", @"semantic"); + if (originalKeyboardColor != nil && originalKeyboardColor != color) { + originalKeyboardColor = [self backgroundColor]; + } + if (color != nil) { + [self setBackgroundColor:color]; + + for (UIView *subview in self.subviews) { + [subview setBackgroundColor:color]; + } + } else { + [self setBackgroundColor:originalKeyboardColor]; + + for (UIView *subview in self.subviews) { + [subview setBackgroundColor:originalKeyboardColor]; + } + } + } + %end + + %hook TUIEmojiSearchInputView + + - (void)didMoveToWindow { + %orig; + + id color = getColor(@"KEYBOARD", @"semantic"); + if (originalKeyboardColor != nil && originalKeyboardColor != color) { + originalKeyboardColor = [self backgroundColor]; + } + if (color != nil) { + [self setBackgroundColor:color]; + } else { + [self setBackgroundColor:originalKeyboardColor]; + } + } + %end + +%end + + +@interface DCDUploadProgressView : UIView +@end + +%hook DCDUploadProgressView +- (void)didMoveToWindow { + %orig; + + id color = getColor(@"BACKGROUND_SECONDARY_ALT", @"semantic"); + if (color != nil) { + UIView *subview = self.subviews[0]; + [subview setBackgroundColor:color]; + } +} +%end + +HOOK_TABLE_CELL(DCDBaseMessageTableViewCell) +HOOK_TABLE_CELL(DCDSeparatorTableViewCell) +HOOK_TABLE_CELL(DCDBlockedMessageTableViewCell) +HOOK_TABLE_CELL(DCDSystemMessageTableViewCell) +HOOK_TABLE_CELL(DCDLoadingTableViewCell) + +@interface DCDChat : UIView +@end + +%hook DCDChat +- (void)configureSubviewsWithContentAdjustment:(double)arg1 { + %orig; + + id chatColor = getColor(@"CHAT_BACKGROUND", @"semantic"); + + if (!chatColor) { + chatColor = getColor(@"BACKGROUND_PRIMARY", @"semantic"); + } + + if (chatColor) { + [self setBackgroundColor:chatColor]; + } + + if (background == nil) { + background = getBackgroundMap(); + } + + if (background == nil) { + NSLog(@"Background is still nil! Background: %@", background); + return; + } + + NSString *url = getBackgroundURL(); + + // ! THIS PATCH IS TEMPORARY ! + // for the time being this is done in the native side because it is extremely buggy on the js side + // for documentation purposes, the following issues are occuring with the current way that i am doing it on the js side (patch the common component that loads a linear gradient behind the chat area) + // 1. background is not transparent when using regular dark/light and not client themes + // 2. background does not apply on tabsv2 + // 3. chat area is not interactive at all (unscrollable and chatinput is dead) + // 4. toggling between chat area and member view triggers fast flashing of the image + // 5. image is not positioned properly some of the time + // + // once i figure out how to properly do this on the js side (preferrably not patching View.render too) i will remove this implementation and do the proper js implementation. + UIView *subview = [self.subviews count] >= 3 + ? self.subviews[2] + : self.subviews[0]; + + if (subview && [subview isKindOfClass:[UIImageView class]]) { + return NSLog(@"Image is a UIImageView!: %@", (id)[NSNumber numberWithBool:[subview isKindOfClass:[UIImageView class]] ]); + } + + if (subview && url) { + int blur = getBackgroundBlur(); + [subview setBackgroundColor:[UIColor clearColor]]; + UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:url]]]; + + CIImage *ciImage = [CIImage imageWithCGImage:image.CGImage]; + CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur"]; + [filter setValue:ciImage forKey:kCIInputImageKey]; + [filter setValue:[NSNumber numberWithFloat: blur] forKey:@"inputRadius"]; + CIImage *result = [filter valueForKey:kCIOutputImageKey]; + CIImage *croppedImage = [result imageByCroppingToRect:ciImage.extent]; + + UIImageView *imageView = [[UIImageView alloc] initWithImage:[[UIImage alloc] initWithCIImage:croppedImage]]; + imageView.frame = subview.frame; + imageView.alpha = getBackgroundAlpha(); + [self insertSubview:imageView atIndex:0]; + } +} +%end + +%ctor { + %init + + NSBundle* bundle = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/TextInputUI.framework"]; + if (!bundle.loaded) [bundle load]; + %init(KEYBOARD); +} + +void SwizzleFromDict(NSString *kind, Class class) { + NSDictionary *dict = getThemeMap(kind); + + for (NSString *colorName in dict) { + NSString *originalMethodName = colorName; + SEL originalSelector = NSSelectorFromString(originalMethodName); + IMP originalImplementation = method_getImplementation(class_getClassMethod(class, originalSelector)); + + // cast the IMP to return an id + id (*getOriginalColor)(Class, SEL) = (id (*)(Class, SEL))originalImplementation; + + MSHookMessageEx(class, originalSelector, (IMP)imp_implementationWithBlock(^UIColor *(id self) { + id color = getColor(colorName, kind); + + if (color) { + return color; + } + + return getOriginalColor(class, originalSelector); + }), NULL); + } +} + +%ctor { + // https://github.com/vendetta-mod/VendettaTweak/blob/rewrite/Sources/VendettaTweak/Themes.x.swift#L61 + SwizzleFromDict(@"semantic", object_getClass(NSClassFromString(@"DCDThemeColor"))); + SwizzleFromDict(@"raw", object_getClass(NSClassFromString(@"UIColor"))); +} \ No newline at end of file diff --git a/src/Utils.x b/src/Utils.x index cc13af5..b4bf25a 100644 --- a/src/Utils.x +++ b/src/Utils.x @@ -17,7 +17,7 @@ BOOL checkForUpdate() { } NSMutableURLRequest *enmityRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.github.com/repos/enmity-mod/enmity/commits?path=dist%2FEnmity.js&page=1&per_page=1"]]; - enmityRequest.timeoutInterval = 5.0; + enmityRequest.timeoutInterval = 3.0; enmityRequest.cachePolicy = NSURLRequestReloadIgnoringCacheData; NSHTTPURLResponse *response; NSError *err;