diff --git a/.bundlewatch.config.json b/.bundlewatch.config.json index 908d88be06..ea2aa4f98c 100644 --- a/.bundlewatch.config.json +++ b/.bundlewatch.config.json @@ -4,13 +4,22 @@ "path": "./framework/core/js/dist/*.js", "maxSize": "150KB" }, + { + "path": "./framework/core/js/dist/*/**/*.js", + "maxSize": "30KB" + }, { "path": "./extensions/*/js/dist/*.js", "maxSize": "30KB" + }, + { + "path": "./extensions/*/js/dist/*/**/*.js", + "maxSize": "30KB" } ], "defaultCompression": "gzip", "ci": { + "repoBranchBase": "2.x", "trackBranches": ["2.x"] } } diff --git a/.editorconfig b/.editorconfig index 1feb43fc7b..0fb3984996 100644 --- a/.editorconfig +++ b/.editorconfig @@ -23,3 +23,6 @@ indent_size = 2 [*.neon] indent_style = tab + +[{install,update}.php] +indent_size = 2 diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 1b1671ecf2..da1a5abaae 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -40,7 +40,7 @@ body: validations: required: false - type: textarea - id: enironment + id: environment attributes: label: Environment value: | diff --git a/.github/workflows/REUSABLE_backend.yml b/.github/workflows/REUSABLE_backend.yml index e368261ff7..0b4a837e38 100644 --- a/.github/workflows/REUSABLE_backend.yml +++ b/.github/workflows/REUSABLE_backend.yml @@ -31,7 +31,8 @@ on: description: Versions of PHP to test with. Should be array of strings encoded as JSON array type: string required: false - default: '["8.1", "8.2"]' + # Keep PHP versions synced with build-install-packages.yml + default: '["8.2", "8.3"]' php_extensions: description: PHP extensions to install. @@ -43,7 +44,7 @@ on: description: Versions of databases to test with. Should be array of strings encoded as JSON array type: string required: false - default: '["mysql:5.7", "mysql:8.0.30", "mariadb"]' + default: '["mysql:5.7", "mysql:8.0.30", "mysql:8.1.0", "mariadb", "sqlite:3", "postgres:10"]' php_ini_values: description: PHP ini values @@ -51,14 +52,29 @@ on: required: false default: error_reporting=E_ALL + runner_type: + description: The type of runner to use for the jobs. This should be one of the types supported by the `runs-on` keyword. + type: string + required: false + default: 'ubuntu-latest' + + secrets: + composer_auth: + description: The Composer auth tokens to use for private packages. + required: false + env: COMPOSER_ROOT_VERSION: dev-main # `inputs.composer_directory` defaults to `inputs.backend_directory` FLARUM_TEST_TMP_DIR_LOCAL: tests/integration/tmp + COMPOSER_AUTH: ${{ secrets.composer_auth }} + DB_DATABASE: flarum_test + DB_USERNAME: root + DB_PASSWORD: root jobs: test: - runs-on: ubuntu-latest + runs-on: ${{ inputs.runner_type }} strategy: matrix: @@ -72,25 +88,46 @@ jobs: # Expands the matrix by naming DBs. - service: 'mysql:5.7' db: MySQL 5.7 + driver: mysql - service: 'mysql:8.0.30' db: MySQL 8.0 + driver: mysql - service: mariadb db: MariaDB + driver: mysql + - service: 'mysql:8.1.0' + db: MySQL 8.1 + driver: mysql + - service: 'sqlite:3' + db: SQLite + driver: sqlite + - service: 'postgres:10' + db: PostgreSQL 10 + driver: pgsql # Include Database prefix tests with only one PHP version. - php: ${{ fromJSON(inputs.php_versions)[0] }} service: 'mysql:5.7' db: MySQL 5.7 + driver: mysql prefix: flarum_ prefixStr: (prefix) - php: ${{ fromJSON(inputs.php_versions)[0] }} - service: 'mysql:8.0.30' - db: MySQL 8.0 + service: mariadb + db: MariaDB + driver: mysql prefix: flarum_ prefixStr: (prefix) - php: ${{ fromJSON(inputs.php_versions)[0] }} - service: mariadb - db: MariaDB + service: 'sqlite:3' + db: SQLite + driver: sqlite + prefix: flarum_ + prefixStr: (prefix) + - php: ${{ fromJSON(inputs.php_versions)[0] }} + service: 'postgres:10' + db: PostgreSQL 10 + driver: pgsql prefix: flarum_ prefixStr: (prefix) @@ -98,12 +135,46 @@ jobs: exclude: - php: ${{ fromJSON(inputs.php_versions)[1] }} service: 'mysql:8.0.30' + - php: ${{ fromJSON(inputs.php_versions)[0] }} + service: mariadb + - php: ${{ fromJSON(inputs.php_versions)[1] }} + service: mariadb + - php: ${{ fromJSON(inputs.php_versions)[0] }} + service: 'mysql:8.1.0' + - php: ${{ fromJSON(inputs.php_versions)[1] }} + service: 'mysql:8.1.0' + - php: ${{ fromJSON(inputs.php_versions)[0] }} + service: 'sqlite:3' + - php: ${{ fromJSON(inputs.php_versions)[1] }} + service: 'sqlite:3' + - php: ${{ fromJSON(inputs.php_versions)[0] }} + service: 'postgres:10' + - php: ${{ fromJSON(inputs.php_versions)[1] }} + service: 'postgres:10' services: mysql: - image: ${{ matrix.service }} + image: ${{ matrix.driver == 'mysql' && matrix.service || '' }} + env: + MYSQL_DATABASE: ${{ env.DB_DATABASE }} + MYSQL_USER: ${{ env.DB_USERNAME }} + MYSQL_PASSWORD: ${{ env.DB_PASSWORD }} + MYSQL_ROOT_PASSWORD: ${{ env.DB_PASSWORD }} ports: - 13306:3306 + postgres: + image: ${{ matrix.driver == 'pgsql' && matrix.service || '' }} + env: + POSTGRES_DB: ${{ env.DB_DATABASE }} + POSTGRES_USER: ${{ env.DB_USERNAME }} + POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }} + ports: + - 15432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 name: 'PHP ${{ matrix.php }} / ${{ matrix.db }} ${{ matrix.prefixStr }}' @@ -124,6 +195,7 @@ jobs: ini-values: ${{ matrix.php_ini_values }} - name: Create MySQL Database + if: ${{ matrix.driver == 'mysql' }} run: | sudo systemctl start mysql mysql -uroot -proot -e 'CREATE DATABASE flarum_test;' --port 13306 @@ -150,13 +222,13 @@ jobs: fi working-directory: ${{ inputs.backend_directory }} env: - DB_PORT: 13306 - DB_PASSWORD: root + DB_PORT: ${{ matrix.driver == 'mysql' && 13306 || 15432 }} DB_PREFIX: ${{ matrix.prefix }} + DB_DRIVER: ${{ matrix.driver }} COMPOSER_PROCESS_TIMEOUT: 600 phpstan: - runs-on: ubuntu-latest + runs-on: ${{ inputs.runner_type }} strategy: matrix: diff --git a/.github/workflows/REUSABLE_frontend.yml b/.github/workflows/REUSABLE_frontend.yml index b124b88a0f..221f6c851c 100644 --- a/.github/workflows/REUSABLE_frontend.yml +++ b/.github/workflows/REUSABLE_frontend.yml @@ -74,7 +74,7 @@ on: description: The node version to use for the workflow. type: number required: false - default: 16 + default: 20 js_package_manager: description: "Enable TypeScript?" @@ -86,30 +86,41 @@ on: type: string required: false + runner_type: + description: The type of runner to use for the jobs. This should be one of the types supported by the `runs-on` keyword. + type: string + required: false + default: 'ubuntu-latest' + secrets: bundlewatch_github_token: description: The GitHub token to use for Bundlewatch. required: false + composer_auth: + description: The Composer auth tokens to use for private packages. + required: false env: COMPOSER_ROOT_VERSION: dev-main ci_script: ${{ inputs.js_package_manager == 'yarn' && 'yarn install --immutable' || 'npm ci' }} cache_dependency_path: ${{ inputs.cache_dependency_path || format(inputs.js_package_manager == 'yarn' && '{0}/yarn.lock' || '{0}/package-lock.json', inputs.frontend_directory) }} + COMPOSER_AUTH: ${{ secrets.composer_auth }} + DISABLE_V8_COMPILE_CACHE: 1 jobs: build: name: Checks & Build - runs-on: ubuntu-latest + runs-on: ${{ inputs.runner_type }} if: >- ((github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) || github.event_name != 'pull_request') steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ inputs.node_version }} cache: ${{ inputs.js_package_manager }} @@ -132,7 +143,7 @@ jobs: working-directory: ${{ inputs.frontend_directory }} - name: JS Checks & Production Build - uses: flarum/action-build@v3 + uses: flarum/action-build@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} build_script: ${{ inputs.build_script }} diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index e10c6cf5bd..57fc784e01 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -8,4 +8,4 @@ jobs: with: enable_backend_testing: true backend_directory: . - monorepo_tests: "framework/core extensions/akismet extensions/approval extensions/flags extensions/likes extensions/mentions extensions/nicknames extensions/statistics extensions/sticky extensions/subscriptions extensions/suspend extensions/tags php-packages/testing/tests" + monorepo_tests: "framework/core extensions/akismet extensions/approval extensions/flags extensions/likes extensions/mentions extensions/nicknames extensions/statistics extensions/sticky extensions/subscriptions extensions/suspend extensions/tags extensions/messages php-packages/testing/tests" diff --git a/.github/workflows/build-install-packages.yml b/.github/workflows/build-install-packages.yml new file mode 100644 index 0000000000..5ecdd320fc --- /dev/null +++ b/.github/workflows/build-install-packages.yml @@ -0,0 +1,29 @@ +name: Build Install Packages + +on: + release: + types: [released] + +env: + VERSION: ${{ github.event.release.tag_name }} + PHP_VERSIONS: '8.2 8.3' + INSTALL_PACKAGES_INPUTS: '{ "flarum_version": "{0}", "php_versions": "{1}" }' + +jobs: + delay: + name: Wait for packagist to publish new packages + runs-on: ubuntu-latest + steps: + - run: sleep 30m + + build: + name: Build Installation Packages + runs-on: ubuntu-latest + steps: + - name: Trigger build in flarum/installation-packages + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: Build Flarum Install Packages + repo: flarum/installation-packages + token: ${{ secrets.PACKAGES_BUILD_TOKEN }} + inputs: ${{ format(env.INSTALL_PACKAGES_INPUTS, env.VERSION, env.PHP_VERSIONS) }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 3499a1d86a..b3c55a1013 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ * recover temporary solution for html entities in browser title (e72541e35de4f71f9d870bbd9bb46ddf586bdf1d) * custom contrast color affected by parents (577890d89c593ae5b6cb96083fab69e2f1ae600c) * reply placeholder wrong positioning (253a3d281dbf5ce3fa712b629b80587cf67e7dbe) +* (mentions) missed post mentions UI changes with lazy loading [#3832] +* (mentions) cannot use newly introduced mentionables extender [#3849] +* (mentions) missing slug from post mention links ([5a4bb7c](5a4bb7ccf226f66dd44816cb69b3d7cfe4ad7f7c)) ## [v1.8.0](https://github.com/flarum/framework/compare/v1.7.1...v1.8.0) ### Fixed @@ -467,7 +470,7 @@ looks rather complex and messy compared to the full list of changes made for thi - Pass filter params to getApiDocument (https://github.com/flarum/framework/pull/3037) - Use author filter instead of gambit to get a user's discussions (https://github.com/flarum/framework/pull/3068) - [A11Y] Accessibility improvements for the Search component (https://github.com/flarum/framework/pull/3017) -- Add determinsm to extension order resolution (https://github.com/flarum/framework/pull/3076) +- Add determinism to extension order resolution (https://github.com/flarum/framework/pull/3076) - Add cache control headers to the admin area (https://github.com/flarum/framework/pull/3097) ### Fixed diff --git a/README.md b/README.md index d58b971a5f..466607d4b3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- +

@@ -7,7 +7,6 @@ Total Downloads Latest Version License -huntr StyleCI

@@ -21,7 +20,7 @@ * **Powerful and extensible.** Customize, extend, and integrate Flarum to suit your community. Flarum’s architecture is amazingly flexible, with a powerful Extension API. -![Screenshot of a Flarum instance, showing multiple discussions and tags.](https://flarum.org/assets/img/home-screenshot.png) +![Screenshot of a Flarum instance, showing multiple discussions and tags.](https://flarum.org/assets/flarum/home-screenshot.png) ## Installation @@ -38,3 +37,4 @@ If you discover a security vulnerability within Flarum, please send an e-mail to ## License Flarum is open-source software licensed under the [MIT License](https://github.com/flarum/flarum/blob/master/LICENSE). + diff --git a/composer.json b/composer.json index 45565be0ab..236635165a 100644 --- a/composer.json +++ b/composer.json @@ -46,13 +46,14 @@ "Flarum\\Lock\\": "extensions/lock/src", "Flarum\\Mentions\\": "extensions/mentions/src", "Flarum\\Nicknames\\": "extensions/nicknames/src", - "Flarum\\PackageManager\\": "extensions/package-manager/src", + "Flarum\\ExtensionManager\\": "extensions/package-manager/src", "Flarum\\Pusher\\": "extensions/pusher/src", "Flarum\\Statistics\\": "extensions/statistics/src", "Flarum\\Sticky\\": "extensions/sticky/src", "Flarum\\Subscriptions\\": "extensions/subscriptions/src", "Flarum\\Suspend\\": "extensions/suspend/src", "Flarum\\Tags\\": "extensions/tags/src", + "Flarum\\Messages\\": "extensions/messages/src", "Flarum\\PHPStan\\": "php-packages/phpstan/src", "Flarum\\Testing\\": "php-packages/testing/src" }, @@ -70,13 +71,14 @@ "Flarum\\Lock\\Tests\\": "extensions/lock/tests", "Flarum\\Mentions\\Tests\\": "extensions/mentions/tests", "Flarum\\Nicknames\\Tests\\": "extensions/nicknames/tests", - "Flarum\\PackageManager\\Tests\\": "extensions/package-manager/tests", + "Flarum\\ExtensionManager\\Tests\\": "extensions/package-manager/tests", "Flarum\\Pusher\\Tests\\": "extensions/pusher/tests", "Flarum\\Statistics\\Tests\\": "extensions/statistics/tests", "Flarum\\Sticky\\Tests\\": "extensions/sticky/tests", "Flarum\\Subscriptions\\Tests\\": "extensions/subscriptions/tests", "Flarum\\Suspend\\Tests\\": "extensions/suspend/tests", "Flarum\\Tags\\Tests\\": "extensions/tags/tests", + "Flarum\\Messages\\Tests\\": "extensions/messages/tests", "Flarum\\Testing\\Tests\\": "php-packages/testing/tests" } }, @@ -94,44 +96,47 @@ "flarum/markdown": "self.version", "flarum/mentions": "self.version", "flarum/nicknames": "self.version", - "flarum/package-manager": "self.version", + "flarum/extension-manager": "self.version", "flarum/pusher": "self.version", "flarum/statistics": "self.version", "flarum/sticky": "self.version", "flarum/subscriptions": "self.version", "flarum/suspend": "self.version", "flarum/tags": "self.version", + "flarum/messages": "self.version", "flarum/phpstan": "self.version", "flarum/testing": "self.version" }, "require": { - "php": "^8.1", + "php": "^8.2", "ext-json": "*", - "components/font-awesome": "^5.15.0", - "composer/composer": "^2.0", - "dflydev/fig-cookies": "^v3.0", + "components/font-awesome": "^6.5.2", + "composer/composer": "^2.7", + "dflydev/fig-cookies": "^3.0", "doctrine/dbal": "^3.6.2", - "dragonmantank/cron-expression": "^v3.3", - "franzl/whoops-middleware": "^2.0", + "dragonmantank/cron-expression": "^3.3", + "fakerphp/faker": "^1.9.1", + "flarum/json-api-server": "^0.1.0", + "franzl/whoops-middleware": "2.0", "guzzlehttp/guzzle": "*", - "illuminate/bus": "^10.0", - "illuminate/cache": "^10.0", - "illuminate/config": "^10.0", - "illuminate/console": "^10.0", - "illuminate/container": "^10.0", - "illuminate/contracts": "^10.0", - "illuminate/database": "^10.0", - "illuminate/events": "^10.0", - "illuminate/filesystem": "^10.0", - "illuminate/hashing": "^10.0", - "illuminate/mail": "^10.0", - "illuminate/queue": "^10.0", - "illuminate/session": "^10.0", - "illuminate/support": "^10.0", - "illuminate/validation": "^10.0", - "illuminate/view": "^10.0", - "intervention/image": "^2.7.2", - "jenssegers/agent": "^v2.6", + "illuminate/bus": "^11.0", + "illuminate/cache": "^11.0", + "illuminate/config": "^11.0", + "illuminate/console": "^11.0", + "illuminate/container": "^11.0", + "illuminate/contracts": "^11.0", + "illuminate/database": "^11.0", + "illuminate/events": "^11.0", + "illuminate/filesystem": "^11.0", + "illuminate/hashing": "^11.0", + "illuminate/mail": "^11.0", + "illuminate/queue": "^11.0", + "illuminate/session": "^11.0", + "illuminate/support": "^11.0", + "illuminate/validation": "^11.0", + "illuminate/view": "^11.0", + "intervention/image": "^3.2", + "jenssegers/agent": "^2.6", "laminas/laminas-diactoros": "^3.0", "laminas/laminas-httphandlerrunner": "^2.6", "laminas/laminas-stratigility": "^3.10", @@ -139,38 +144,35 @@ "league/flysystem-memory": "^3.15", "matthiasmullie/minify": "^1.3", "middlewares/base-path": "^v2.1", - "middlewares/base-path-router": "^v2.0.1", - "middlewares/request-handler": "^v2.0.2", + "middlewares/base-path-router": "^2.0.1", + "middlewares/request-handler": "^2.0.2", "monolog/monolog": "^3.3", - "nesbot/carbon": "^2.66", + "nesbot/carbon": "^3.0", "nikic/fast-route": "^1.3", "psr/http-message": "^1.1", "psr/http-server-handler": "^1.0.2", "psr/http-server-middleware": "^1.0.2", "pusher/pusher-php-server": "^7.2", "s9e/text-formatter": "^2.13", - "staudenmeir/eloquent-eager-limit": "^1.8.2", - "sycho/json-api": "^0.5.0", "sycho/sourcemap": "^2.0.0", - "symfony/config": "^6.3", - "symfony/console": "^6.3", - "symfony/event-dispatcher": "^6.3", - "symfony/http-client": "^6.3", - "symfony/mailer": "^6.3", - "symfony/mailgun-mailer": "^6.3", - "symfony/mime": "^6.3", + "symfony/config": "^7.0", + "symfony/console": "^7.0", + "symfony/event-dispatcher": "^7.0", + "symfony/http-client": "^7.0", + "symfony/mailgun-mailer": "^7.0", + "symfony/mime": "^7.0", "symfony/polyfill-intl-messageformatter": "^1.27", - "symfony/postmark-mailer": "^6.3", - "symfony/translation": "^6.3", - "symfony/yaml": "^6.3", + "symfony/postmark-mailer": "^7.0", + "symfony/translation": "^7.0", + "symfony/yaml": "^7.0", "wikimedia/less.php": "^4.1" }, "require-dev": { "mockery/mockery": "^1.5", - "phpunit/phpunit": "^9.0", + "phpunit/phpunit": "^11.0", "phpstan/phpstan": "^1.10.0", - "nunomaduro/larastan": "^2.6", - "symfony/var-dumper": "^6.3" + "larastan/larastan": "^2.7", + "symfony/var-dumper": "^7.0" }, "config": { "sort-packages": true @@ -198,6 +200,7 @@ "extensions/subscriptions", "extensions/suspend", "extensions/tags", + "extensions/messages", "php-packages/testing/tests" ], "branch-alias": { diff --git a/extensions/akismet/.gitignore b/extensions/akismet/.gitignore index 4ebb168a05..e60e512061 100644 --- a/extensions/akismet/.gitignore +++ b/extensions/akismet/.gitignore @@ -4,6 +4,7 @@ composer.phar .DS_Store Thumbs.db +tests/.phpunit.cache tests/.phpunit.result.cache /tests/integration/tmp .vagrant diff --git a/extensions/akismet/LICENSE b/extensions/akismet/LICENSE index 54ac29ab2c..bb6e15d87e 100644 --- a/extensions/akismet/LICENSE +++ b/extensions/akismet/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019-2021 Stichting Flarum (Flarum Foundation) +Copyright (c) 2019-2024 Stichting Flarum (Flarum Foundation) Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/extensions/akismet/js/dist-typings/admin/extend.d.ts b/extensions/akismet/js/dist-typings/admin/extend.d.ts new file mode 100644 index 0000000000..4c1b0a6159 --- /dev/null +++ b/extensions/akismet/js/dist-typings/admin/extend.d.ts @@ -0,0 +1,2 @@ +declare const _default: import("flarum/common/extenders/Admin").default[]; +export default _default; diff --git a/extensions/akismet/js/dist-typings/admin/index.d.ts b/extensions/akismet/js/dist-typings/admin/index.d.ts index cb0ff5c3b5..6d2293da0b 100644 --- a/extensions/akismet/js/dist-typings/admin/index.d.ts +++ b/extensions/akismet/js/dist-typings/admin/index.d.ts @@ -1 +1 @@ -export {}; +export { default as extend } from './extend'; diff --git a/extensions/akismet/js/dist/admin.js b/extensions/akismet/js/dist/admin.js index edab775bbb..4f453d5d01 100644 --- a/extensions/akismet/js/dist/admin.js +++ b/extensions/akismet/js/dist/admin.js @@ -1,2 +1,2 @@ -(()=>{var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};(()=>{"use strict";e.r(t);const a=flarum.core.compat["admin/app"];var r=e.n(a);r().initializers.add("flarum-akismet",(()=>{r().extensionData.for("flarum-akismet").registerSetting({setting:"flarum-akismet.api_key",type:"text",label:r().translator.trans("flarum-akismet.admin.akismet_settings.api_key_label")}).registerSetting({setting:"flarum-akismet.delete_blatant_spam",type:"boolean",label:r().translator.trans("flarum-akismet.admin.akismet_settings.delete_blatant_spam_label"),help:r().translator.trans("flarum-akismet.admin.akismet_settings.delete_blatant_spam_help")}).registerPermission({icon:"fas fa-vote-yea",label:r().translator.trans("flarum-akismet.admin.permissions.bypass_akismet"),permission:"bypassAkismet"},"start")}))})(),module.exports=t})(); +(()=>{var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var s in a)e.o(a,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:a[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};(()=>{"use strict";e.r(t),e.d(t,{extend:()=>n});const a=flarum.reg.get("core","admin/app");var s=e.n(a);const r=flarum.reg.get("core","common/extenders"),n=[(new(e.n(r)().Admin)).setting((()=>({setting:"flarum-akismet.api_key",type:"text",label:s().translator.trans("flarum-akismet.admin.akismet_settings.api_key_label")}))).setting((()=>({setting:"flarum-akismet.delete_blatant_spam",type:"boolean",label:s().translator.trans("flarum-akismet.admin.akismet_settings.delete_blatant_spam_label"),help:s().translator.trans("flarum-akismet.admin.akismet_settings.delete_blatant_spam_help")}))).permission((()=>({icon:"fas fa-vote-yea",label:s().translator.trans("flarum-akismet.admin.permissions.bypass_akismet"),permission:"bypassAkismet"})),"start")];s().initializers.add("flarum-akismet",(()=>{}))})(),module.exports=t})(); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/extensions/akismet/js/dist/admin.js.map b/extensions/akismet/js/dist/admin.js.map index 0a7ca2b6e6..3df1ba0704 100644 --- a/extensions/akismet/js/dist/admin.js.map +++ b/extensions/akismet/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,IACzBH,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCExDC,IAAAA,aAAAA,IAAqB,kBAAkB,KACrCA,IAAAA,cAAAA,IACO,kBACJC,gBAAgB,CACfC,QAAS,yBACTC,KAAM,OACNC,MAAOJ,IAAAA,WAAAA,MAAqB,yDAE7BC,gBAAgB,CAEfC,QAAS,qCACTC,KAAM,UACNC,MAAOJ,IAAAA,WAAAA,MAAqB,mEAC5BK,KAAML,IAAAA,WAAAA,MAAqB,oEAE5BM,mBACC,CACEC,KAAM,kBACNH,MAAOJ,IAAAA,WAAAA,MAAqB,mDAC5BQ,WAAY,iBAEd,QACD,G","sources":["webpack://@flarum/akismet/webpack/bootstrap","webpack://@flarum/akismet/webpack/runtime/compat get default export","webpack://@flarum/akismet/webpack/runtime/define property getters","webpack://@flarum/akismet/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/akismet/webpack/runtime/make namespace object","webpack://@flarum/akismet/external root \"flarum.core.compat['admin/app']\"","webpack://@flarum/akismet/./src/admin/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","import app from 'flarum/admin/app';\n\napp.initializers.add('flarum-akismet', () => {\n app.extensionData\n .for('flarum-akismet')\n .registerSetting({\n setting: 'flarum-akismet.api_key',\n type: 'text',\n label: app.translator.trans('flarum-akismet.admin.akismet_settings.api_key_label'),\n })\n .registerSetting({\n //https://blog.akismet.com/2014/04/23/theres-a-ninja-in-your-akismet/\n setting: 'flarum-akismet.delete_blatant_spam',\n type: 'boolean',\n label: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_label'),\n help: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_help'),\n })\n .registerPermission(\n {\n icon: 'fas fa-vote-yea',\n label: app.translator.trans('flarum-akismet.admin.permissions.bypass_akismet'),\n permission: 'bypassAkismet',\n },\n 'start'\n );\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","registerSetting","setting","type","label","help","registerPermission","icon","permission"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,IACzBH,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,qDCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,oBCE5D,IAAgB,I,MAAI,WAAeW,SAAQ,KAAM,CAC/CA,QAAS,yBACTC,KAAM,OACNC,MAAO,eAAeC,MAAM,2DAC1BH,SAAQ,KAAM,CAEhBA,QAAS,qCACTC,KAAM,UACNC,MAAO,eAAeC,MAAM,mEAC5BC,KAAM,eAAeD,MAAM,sEACzBE,YAAW,KAAM,CACnBC,KAAM,kBACNJ,MAAO,eAAeC,MAAM,mDAC5BE,WAAY,mBACV,UCdJ,iBAAiBE,IAAI,kBAAkB,Q","sources":["webpack://@flarum/akismet/webpack/bootstrap","webpack://@flarum/akismet/webpack/runtime/compat get default export","webpack://@flarum/akismet/webpack/runtime/define property getters","webpack://@flarum/akismet/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/akismet/webpack/runtime/make namespace object","webpack://@flarum/akismet/external root \"flarum.reg.get('core', 'admin/app')\"","webpack://@flarum/akismet/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/akismet/./src/admin/extend.tsx","webpack://@flarum/akismet/./src/admin/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'admin/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","import Extend from 'flarum/common/extenders';\nimport app from 'flarum/admin/app';\nexport default [new Extend.Admin().setting(() => ({\n setting: 'flarum-akismet.api_key',\n type: 'text',\n label: app.translator.trans('flarum-akismet.admin.akismet_settings.api_key_label')\n})).setting(() => ({\n // https://blog.akismet.com/2014/04/23/theres-a-ninja-in-your-akismet/\n setting: 'flarum-akismet.delete_blatant_spam',\n type: 'boolean',\n label: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_label'),\n help: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_help')\n})).permission(() => ({\n icon: 'fas fa-vote-yea',\n label: app.translator.trans('flarum-akismet.admin.permissions.bypass_akismet'),\n permission: 'bypassAkismet'\n}), 'start')];","import app from 'flarum/admin/app';\nexport { default as extend } from './extend';\napp.initializers.add('flarum-akismet', () => {\n // ...\n});"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","reg","setting","type","label","trans","help","permission","icon","add"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/akismet/js/dist/forum.js b/extensions/akismet/js/dist/forum.js index 31cfeae5cf..205c1f29ec 100644 --- a/extensions/akismet/js/dist/forum.js +++ b/extensions/akismet/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var t={n:e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},d:(e,o)=>{for(var r in o)t.o(o,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{"use strict";t.r(e);const o=flarum.core.compat["common/extend"],r=flarum.core.compat["forum/app"];var a=t.n(r);const n=flarum.core.compat["forum/utils/PostControls"];var s=t.n(n);const l=flarum.core.compat["forum/components/Post"];var m=t.n(l);a().initializers.add("flarum-akismet",(()=>{(0,o.extend)(s(),"destructiveControls",(function(t,e){if(t.has("approve")){const o=e.flags();if(o&&o.some((t=>"akismet"===(null==t?void 0:t.type())))){const e=t.get("approve");e&&"object"==typeof e&&"children"in e&&(e.children=a().translator.trans("flarum-akismet.forum.post.not_spam_button"))}}})),(0,o.override)(m().prototype,"flagReason",(function(t,e){return"akismet"===e.type()?a().translator.trans("flarum-akismet.forum.post.akismet_flagged_text"):t(e)}))}))})(),module.exports=e})(); +(()=>{var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};(()=>{"use strict";const t=flarum.reg.get("core","common/extend"),r=flarum.reg.get("core","forum/app");var o=e.n(r);const a=flarum.reg.get("core","forum/utils/PostControls");var n=e.n(a);const s=flarum.reg.get("core","forum/components/Post");var m=e.n(s);o().initializers.add("flarum-akismet",(()=>{(0,t.extend)(n(),"destructiveControls",(function(e,t){if(e.has("approve")){const r=t.flags();if(r&&r.some((e=>"akismet"===e?.type()))){const t=e.get("approve");t&&"object"==typeof t&&"children"in t&&(t.children=o().translator.trans("flarum-akismet.forum.post.not_spam_button"))}}})),(0,t.override)(m().prototype,"flagReason",(function(e,t){return"akismet"===t.type()?o().translator.trans("flarum-akismet.forum.post.akismet_flagged_text"):e(t)}))}))})(),module.exports={}})(); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/extensions/akismet/js/dist/forum.js.map b/extensions/akismet/js/dist/forum.js.map index f511abfb79..58c4bd06a3 100644 --- a/extensions/akismet/js/dist/forum.js.map +++ b/extensions/akismet/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,a,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,4B,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,yB,aCSxDC,IAAAA,aAAAA,IAAqB,kBAAkB,MACrCC,EAAAA,EAAAA,QAAOC,IAAc,uBAAuB,SAAUC,EAAmCC,GACvF,GAAID,EAAME,IAAI,WAAY,CACxB,MAAMC,EAAQF,EAAKE,QAEnB,GAAIA,GAASA,EAAMC,MAAMC,GAA0B,aAAb,MAAJA,OAAI,EAAJA,EAAMC,UAAuB,CAC7D,MAAMC,EAAcP,EAAMf,IAAI,WAC1BsB,GAAsC,iBAAhBA,GAA4B,aAAcA,IAClEA,EAAYC,SAAWX,IAAAA,WAAAA,MAAqB,6CAEhD,CACF,CACF,KAEAY,EAAAA,EAAAA,UAASC,IAAAA,UAAyB,cAAc,SAAUC,EAAUN,GAClE,MAAoB,YAAhBA,EAAKC,OACAT,IAAAA,WAAAA,MAAqB,kDAGvBc,EAASN,EAClB,GAAE,G","sources":["webpack://@flarum/akismet/webpack/bootstrap","webpack://@flarum/akismet/webpack/runtime/compat get default export","webpack://@flarum/akismet/webpack/runtime/define property getters","webpack://@flarum/akismet/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/akismet/webpack/runtime/make namespace object","webpack://@flarum/akismet/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/akismet/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/akismet/external root \"flarum.core.compat['forum/utils/PostControls']\"","webpack://@flarum/akismet/external root \"flarum.core.compat['forum/components/Post']\"","webpack://@flarum/akismet/./src/forum/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/PostControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/Post'];","import { extend, override } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport type Post from 'flarum/common/models/Post';\nimport type ItemList from 'flarum/common/utils/ItemList';\n\nimport PostControls from 'flarum/forum/utils/PostControls';\nimport PostComponent from 'flarum/forum/components/Post';\nimport type Mithril from 'mithril';\n\napp.initializers.add('flarum-akismet', () => {\n extend(PostControls, 'destructiveControls', function (items: ItemList, post: Post) {\n if (items.has('approve')) {\n const flags = post.flags();\n\n if (flags && flags.some((flag) => flag?.type() === 'akismet')) {\n const approveItem = items.get('approve');\n if (approveItem && typeof approveItem === 'object' && 'children' in approveItem) {\n approveItem.children = app.translator.trans('flarum-akismet.forum.post.not_spam_button');\n }\n }\n }\n });\n\n override(PostComponent.prototype, 'flagReason', function (original, flag) {\n if (flag.type() === 'akismet') {\n return app.translator.trans('flarum-akismet.forum.post.akismet_flagged_text');\n }\n\n return original(flag);\n });\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","extend","PostControls","items","post","has","flags","some","flag","type","approveItem","children","override","PostComponent","original"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,I,mBCAlF,MAAM,EAA+BI,OAAOC,IAAIP,IAAI,OAAQ,iBCAtD,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,4B,aCA5D,MAAM,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,yB,aCI5D,iBAAiBQ,IAAI,kBAAkB,MACrC,IAAAC,QAAO,IAAc,uBAAuB,SAAUC,EAAOC,GAC3D,GAAID,EAAME,IAAI,WAAY,CACxB,MAAMC,EAAQF,EAAKE,QACnB,GAAIA,GAASA,EAAMC,MAAKC,GAAyB,YAAjBA,GAAMC,SAAuB,CAC3D,MAAMC,EAAcP,EAAMV,IAAI,WAC1BiB,GAAsC,iBAAhBA,GAA4B,aAAcA,IAClEA,EAAYC,SAAW,eAAeC,MAAM,6CAEhD,CACF,CACF,KACA,IAAAC,UAAS,cAAyB,cAAc,SAAUC,EAAUN,GAClE,MAAoB,YAAhBA,EAAKC,OACA,eAAeG,MAAM,kDAEvBE,EAASN,EAClB,GAAE,G","sources":["webpack://@flarum/akismet/webpack/bootstrap","webpack://@flarum/akismet/webpack/runtime/compat get default export","webpack://@flarum/akismet/webpack/runtime/define property getters","webpack://@flarum/akismet/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/akismet/external root \"flarum.reg.get('core', 'common/extend')\"","webpack://@flarum/akismet/external root \"flarum.reg.get('core', 'forum/app')\"","webpack://@flarum/akismet/external root \"flarum.reg.get('core', 'forum/utils/PostControls')\"","webpack://@flarum/akismet/external root \"flarum.reg.get('core', 'forum/components/Post')\"","webpack://@flarum/akismet/./src/forum/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extend');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/utils/PostControls');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/Post');","import { extend, override } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport PostControls from 'flarum/forum/utils/PostControls';\nimport PostComponent from 'flarum/forum/components/Post';\napp.initializers.add('flarum-akismet', () => {\n extend(PostControls, 'destructiveControls', function (items, post) {\n if (items.has('approve')) {\n const flags = post.flags();\n if (flags && flags.some(flag => flag?.type() === 'akismet')) {\n const approveItem = items.get('approve');\n if (approveItem && typeof approveItem === 'object' && 'children' in approveItem) {\n approveItem.children = app.translator.trans('flarum-akismet.forum.post.not_spam_button');\n }\n }\n }\n });\n override(PostComponent.prototype, 'flagReason', function (original, flag) {\n if (flag.type() === 'akismet') {\n return app.translator.trans('flarum-akismet.forum.post.akismet_flagged_text');\n }\n return original(flag);\n });\n});"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","flarum","reg","add","extend","items","post","has","flags","some","flag","type","approveItem","children","trans","override","original"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/akismet/js/package.json b/extensions/akismet/js/package.json index 0ae17ecda3..ca7327e835 100644 --- a/extensions/akismet/js/package.json +++ b/extensions/akismet/js/package.json @@ -19,7 +19,7 @@ "@flarum/prettier-config": "^1.0.0", "flarum-tsconfig": "^1.0.2", "prettier": "^2.5.1", - "flarum-webpack-config": "^2.0.0", + "flarum-webpack-config": "^3.0.0", "webpack": "^5.76.0", "webpack-cli": "^4.9.1", "typescript": "^4.5.4", diff --git a/extensions/akismet/js/src/admin/extend.tsx b/extensions/akismet/js/src/admin/extend.tsx new file mode 100644 index 0000000000..de7109eb00 --- /dev/null +++ b/extensions/akismet/js/src/admin/extend.tsx @@ -0,0 +1,26 @@ +import Extend from 'flarum/common/extenders'; +import app from 'flarum/admin/app'; + +export default [ + new Extend.Admin() + .setting(() => ({ + setting: 'flarum-akismet.api_key', + type: 'text', + label: app.translator.trans('flarum-akismet.admin.akismet_settings.api_key_label'), + })) + .setting(() => ({ + // https://blog.akismet.com/2014/04/23/theres-a-ninja-in-your-akismet/ + setting: 'flarum-akismet.delete_blatant_spam', + type: 'boolean', + label: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_label'), + help: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_help'), + })) + .permission( + () => ({ + icon: 'fas fa-vote-yea', + label: app.translator.trans('flarum-akismet.admin.permissions.bypass_akismet'), + permission: 'bypassAkismet', + }), + 'start' + ), +]; diff --git a/extensions/akismet/js/src/admin/index.ts b/extensions/akismet/js/src/admin/index.ts index 133ee61081..cc9e8301a3 100644 --- a/extensions/akismet/js/src/admin/index.ts +++ b/extensions/akismet/js/src/admin/index.ts @@ -1,26 +1,7 @@ import app from 'flarum/admin/app'; +export { default as extend } from './extend'; + app.initializers.add('flarum-akismet', () => { - app.extensionData - .for('flarum-akismet') - .registerSetting({ - setting: 'flarum-akismet.api_key', - type: 'text', - label: app.translator.trans('flarum-akismet.admin.akismet_settings.api_key_label'), - }) - .registerSetting({ - //https://blog.akismet.com/2014/04/23/theres-a-ninja-in-your-akismet/ - setting: 'flarum-akismet.delete_blatant_spam', - type: 'boolean', - label: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_label'), - help: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_help'), - }) - .registerPermission( - { - icon: 'fas fa-vote-yea', - label: app.translator.trans('flarum-akismet.admin.permissions.bypass_akismet'), - permission: 'bypassAkismet', - }, - 'start' - ); + // ... }); diff --git a/extensions/akismet/js/tsconfig.json b/extensions/akismet/js/tsconfig.json index 4d40354629..7c80f51247 100644 --- a/extensions/akismet/js/tsconfig.json +++ b/extensions/akismet/js/tsconfig.json @@ -15,7 +15,7 @@ "declarationDir": "./dist-typings", "paths": { "flarum/*": ["../../../framework/core/js/dist-typings/*"], - "flarum/flags/*": ["../../flags/js/dist-typings/*"] + "ext:flarum/flags/*": ["../../flags/js/dist-typings/*"] } } } diff --git a/extensions/akismet/src/Akismet.php b/extensions/akismet/src/Akismet.php index 0182144ec3..cf6767e617 100644 --- a/extensions/akismet/src/Akismet.php +++ b/extensions/akismet/src/Akismet.php @@ -47,7 +47,7 @@ protected function sendRequest(string $type): ResponseInterface $client = new Client(); return $client->request('POST', "$this->apiUrl/$type", [ - 'headers' => [ + 'headers' => [ 'User-Agent' => "Flarum/$this->flarumVersion | Akismet/$this->extensionVersion", ], 'form_params' => $this->params, diff --git a/extensions/akismet/tests/phpunit.integration.xml b/extensions/akismet/tests/phpunit.integration.xml index 7319d929ae..e3e14eab99 100644 --- a/extensions/akismet/tests/phpunit.integration.xml +++ b/extensions/akismet/tests/phpunit.integration.xml @@ -1,22 +1,20 @@ - + ../src/ - + ./integration diff --git a/extensions/akismet/tests/phpunit.unit.xml b/extensions/akismet/tests/phpunit.unit.xml index 66262dd9ff..67367a782d 100644 --- a/extensions/akismet/tests/phpunit.unit.xml +++ b/extensions/akismet/tests/phpunit.unit.xml @@ -1,28 +1,23 @@ - + ../src/ - + ./unit - - - diff --git a/extensions/approval/.gitignore b/extensions/approval/.gitignore index 4ebb168a05..e60e512061 100644 --- a/extensions/approval/.gitignore +++ b/extensions/approval/.gitignore @@ -4,6 +4,7 @@ composer.phar .DS_Store Thumbs.db +tests/.phpunit.cache tests/.phpunit.result.cache /tests/integration/tmp .vagrant diff --git a/extensions/approval/LICENSE b/extensions/approval/LICENSE index 54ac29ab2c..bb6e15d87e 100644 --- a/extensions/approval/LICENSE +++ b/extensions/approval/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019-2021 Stichting Flarum (Flarum Foundation) +Copyright (c) 2019-2024 Stichting Flarum (Flarum Foundation) Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/extensions/approval/extend.php b/extensions/approval/extend.php index 85801046c7..71f984c7a6 100644 --- a/extensions/approval/extend.php +++ b/extensions/approval/extend.php @@ -7,9 +7,10 @@ * LICENSE file that was distributed with this source code. */ -use Flarum\Api\Serializer\BasicDiscussionSerializer; -use Flarum\Api\Serializer\PostSerializer; +use Flarum\Api\Resource; +use Flarum\Api\Schema; use Flarum\Approval\Access; +use Flarum\Approval\Api\PostResourceFields; use Flarum\Approval\Event\PostWasApproved; use Flarum\Approval\Listener; use Flarum\Discussion\Discussion; @@ -36,17 +37,13 @@ ->default('is_approved', true) ->cast('is_approved', 'bool'), - (new Extend\ApiSerializer(BasicDiscussionSerializer::class)) - ->attribute('isApproved', function (BasicDiscussionSerializer $serializer, Discussion $discussion): bool { - return $discussion->is_approved; - }), + (new Extend\ApiResource(Resource\DiscussionResource::class)) + ->fields(fn () => [ + Schema\Boolean::make('isApproved'), + ]), - (new Extend\ApiSerializer(PostSerializer::class)) - ->attribute('isApproved', function ($serializer, Post $post) { - return (bool) $post->is_approved; - })->attribute('canApprove', function (PostSerializer $serializer, Post $post) { - return (bool) $serializer->getActor()->can('approvePosts', $post->discussion); - }), + (new Extend\ApiResource(Resource\PostResource::class)) + ->fields(PostResourceFields::class), new Extend\Locales(__DIR__.'/locale'), diff --git a/extensions/approval/js/admin.js b/extensions/approval/js/admin.ts similarity index 100% rename from extensions/approval/js/admin.js rename to extensions/approval/js/admin.ts diff --git a/extensions/approval/js/dist/admin.js b/extensions/approval/js/dist/admin.js index e5040a910d..59706b7961 100644 --- a/extensions/approval/js/dist/admin.js +++ b/extensions/approval/js/dist/admin.js @@ -1,2 +1,2 @@ -(()=>{var r={n:s=>{var e=s&&s.__esModule?()=>s.default:()=>s;return r.d(e,{a:e}),e},d:(s,e)=>{for(var a in e)r.o(e,a)&&!r.o(s,a)&&Object.defineProperty(s,a,{enumerable:!0,get:e[a]})},o:(r,s)=>Object.prototype.hasOwnProperty.call(r,s),r:r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})}},s={};(()=>{"use strict";r.r(s);const e=flarum.core.compat["common/extend"],a=flarum.core.compat["admin/app"];var o=r.n(a);o().initializers.add("flarum-approval",(()=>{(0,e.extend)(o(),"getRequiredPermissions",(function(r,s){"discussion.startWithoutApproval"===s&&r.push("startDiscussion"),"discussion.replyWithoutApproval"===s&&r.push("discussion.reply")})),o().extensionData.for("flarum-approval").registerPermission({icon:"fas fa-check",label:o().translator.trans("flarum-approval.admin.permissions.start_discussions_without_approval_label"),permission:"discussion.startWithoutApproval"},"start",95).registerPermission({icon:"fas fa-check",label:o().translator.trans("flarum-approval.admin.permissions.reply_without_approval_label"),permission:"discussion.replyWithoutApproval"},"reply",95).registerPermission({icon:"fas fa-check",label:o().translator.trans("flarum-approval.admin.permissions.approve_posts_label"),permission:"discussion.approvePosts"},"moderate",65)}))})(),module.exports=s})(); +(()=>{var e={n:r=>{var s=r&&r.__esModule?()=>r.default:()=>r;return e.d(s,{a:s}),s},d:(r,s)=>{for(var o in s)e.o(s,o)&&!e.o(r,o)&&Object.defineProperty(r,o,{enumerable:!0,get:s[o]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};(()=>{"use strict";e.r(r),e.d(r,{extend:()=>i});const s=flarum.reg.get("core","common/extend"),o=flarum.reg.get("core","admin/app");var a=e.n(o);const t=flarum.reg.get("core","common/extenders"),i=[(new(e.n(t)().Admin)).permission((()=>({icon:"fas fa-check",label:a().translator.trans("flarum-approval.admin.permissions.start_discussions_without_approval_label"),permission:"discussion.startWithoutApproval"})),"start",95).permission((()=>({icon:"fas fa-check",label:a().translator.trans("flarum-approval.admin.permissions.reply_without_approval_label"),permission:"discussion.replyWithoutApproval"})),"reply",95).permission((()=>({icon:"fas fa-check",label:a().translator.trans("flarum-approval.admin.permissions.approve_posts_label"),permission:"discussion.approvePosts"})),"moderate",65)];a().initializers.add("flarum-approval",(()=>{(0,s.extend)(a(),"getRequiredPermissions",(function(e,r){"discussion.startWithoutApproval"===r&&e.push("startDiscussion"),"discussion.replyWithoutApproval"===r&&e.push("discussion.reply")}))}))})(),module.exports=r})(); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/extensions/approval/js/dist/admin.js.map b/extensions/approval/js/dist/admin.js.map index 690954d7ad..e910199314 100644 --- a/extensions/approval/js/dist/admin.js.map +++ b/extensions/approval/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,a,aCGxDC,IAAAA,aAAAA,IAAqB,mBAAmB,MACtCC,EAAAA,EAAAA,QAAOD,IAAK,0BAA0B,SAAUE,EAAUC,GACrC,oCAAfA,GACFD,EAASE,KAAK,mBAEG,oCAAfD,GACFD,EAASE,KAAK,mBAElB,IAEAJ,IAAAA,cAAAA,IACO,mBACJK,mBACC,CACEC,KAAM,eACNC,MAAOP,IAAAA,WAAAA,MAAqB,8EAC5BG,WAAY,mCAEd,QACA,IAEDE,mBACC,CACEC,KAAM,eACNC,MAAOP,IAAAA,WAAAA,MAAqB,kEAC5BG,WAAY,mCAEd,QACA,IAEDE,mBACC,CACEC,KAAM,eACNC,MAAOP,IAAAA,WAAAA,MAAqB,yDAC5BG,WAAY,2BAEd,WACA,GACD,G","sources":["webpack://@flarum/approval/webpack/bootstrap","webpack://@flarum/approval/webpack/runtime/compat get default export","webpack://@flarum/approval/webpack/runtime/define property getters","webpack://@flarum/approval/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/approval/webpack/runtime/make namespace object","webpack://@flarum/approval/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/approval/external root \"flarum.core.compat['admin/app']\"","webpack://@flarum/approval/./src/admin/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/admin/app';\n\napp.initializers.add('flarum-approval', () => {\n extend(app, 'getRequiredPermissions', function (required, permission) {\n if (permission === 'discussion.startWithoutApproval') {\n required.push('startDiscussion');\n }\n if (permission === 'discussion.replyWithoutApproval') {\n required.push('discussion.reply');\n }\n });\n\n app.extensionData\n .for('flarum-approval')\n .registerPermission(\n {\n icon: 'fas fa-check',\n label: app.translator.trans('flarum-approval.admin.permissions.start_discussions_without_approval_label'),\n permission: 'discussion.startWithoutApproval',\n },\n 'start',\n 95\n )\n .registerPermission(\n {\n icon: 'fas fa-check',\n label: app.translator.trans('flarum-approval.admin.permissions.reply_without_approval_label'),\n permission: 'discussion.replyWithoutApproval',\n },\n 'reply',\n 95\n )\n .registerPermission(\n {\n icon: 'fas fa-check',\n label: app.translator.trans('flarum-approval.admin.permissions.approve_posts_label'),\n permission: 'discussion.approvePosts',\n },\n 'moderate',\n 65\n );\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","extend","required","permission","push","registerPermission","icon","label"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,qDCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,iBCAtD,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,oBCE5D,IAAgB,I,MAAI,WAAeW,YAAW,KAAM,CAClDC,KAAM,eACNC,MAAO,eAAeC,MAAM,8EAC5BH,WAAY,qCACV,QAAS,IAAIA,YAAW,KAAM,CAChCC,KAAM,eACNC,MAAO,eAAeC,MAAM,kEAC5BH,WAAY,qCACV,QAAS,IAAIA,YAAW,KAAM,CAChCC,KAAM,eACNC,MAAO,eAAeC,MAAM,yDAC5BH,WAAY,6BACV,WAAY,KCXhB,iBAAiBI,IAAI,mBAAmB,MACtC,IAAAC,QAAO,IAAK,0BAA0B,SAAUC,EAAUN,GACrC,oCAAfA,GACFM,EAASC,KAAK,mBAEG,oCAAfP,GACFM,EAASC,KAAK,mBAElB,GAAE,G","sources":["webpack://@flarum/approval/webpack/bootstrap","webpack://@flarum/approval/webpack/runtime/compat get default export","webpack://@flarum/approval/webpack/runtime/define property getters","webpack://@flarum/approval/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/approval/webpack/runtime/make namespace object","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'common/extend')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'admin/app')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/approval/./src/admin/extend.tsx","webpack://@flarum/approval/./src/admin/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extend');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'admin/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","import Extend from 'flarum/common/extenders';\nimport app from 'flarum/admin/app';\nexport default [new Extend.Admin().permission(() => ({\n icon: 'fas fa-check',\n label: app.translator.trans('flarum-approval.admin.permissions.start_discussions_without_approval_label'),\n permission: 'discussion.startWithoutApproval'\n}), 'start', 95).permission(() => ({\n icon: 'fas fa-check',\n label: app.translator.trans('flarum-approval.admin.permissions.reply_without_approval_label'),\n permission: 'discussion.replyWithoutApproval'\n}), 'reply', 95).permission(() => ({\n icon: 'fas fa-check',\n label: app.translator.trans('flarum-approval.admin.permissions.approve_posts_label'),\n permission: 'discussion.approvePosts'\n}), 'moderate', 65)];","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/admin/app';\nexport { default as extend } from './extend';\napp.initializers.add('flarum-approval', () => {\n extend(app, 'getRequiredPermissions', function (required, permission) {\n if (permission === 'discussion.startWithoutApproval') {\n required.push('startDiscussion');\n }\n if (permission === 'discussion.replyWithoutApproval') {\n required.push('discussion.reply');\n }\n });\n});"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","reg","permission","icon","label","trans","add","extend","required","push"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/approval/js/dist/forum.js b/extensions/approval/js/dist/forum.js index 496ddc3cf1..00687827af 100644 --- a/extensions/approval/js/dist/forum.js +++ b/extensions/approval/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var o={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return o.d(r,{a:r}),r},d:(t,r)=>{for(var e in r)o.o(r,e)&&!o.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:r[e]})},o:(o,t)=>Object.prototype.hasOwnProperty.call(o,t),r:o=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})}},t={};(()=>{"use strict";o.r(t);const r=flarum.core.compat["common/extend"],e=flarum.core.compat["forum/app"];var a=o.n(e);const p=flarum.core.compat["common/models/Discussion"];var n=o.n(p);const s=flarum.core.compat["common/models/Post"];var i=o.n(s);const c=flarum.core.compat["common/components/Badge"];var u=o.n(c);const l=flarum.core.compat["forum/components/DiscussionListItem"];var d=o.n(l);const v=flarum.core.compat["forum/components/Post"];var f=o.n(v);const A=flarum.core.compat["forum/components/CommentPost"];var y=o.n(A);const b=flarum.core.compat["common/components/Button"];var g=o.n(b);const h=flarum.core.compat["forum/utils/PostControls"];var _=o.n(h);a().initializers.add("flarum-approval",(()=>{n().prototype.isApproved=n().attribute("isApproved"),(0,r.extend)(n().prototype,"badges",(function(o){this.isApproved()||o.has("hidden")||o.add("awaitingApproval",m(u(),{type:"awaitingApproval",icon:"fas fa-gavel",label:a().translator.trans("flarum-approval.forum.badge.awaiting_approval_tooltip")}))})),i().prototype.isApproved=i().attribute("isApproved"),i().prototype.canApprove=i().attribute("canApprove"),(0,r.extend)(d().prototype,"elementAttrs",(function(o){this.attrs.discussion.isApproved()||(o.className+=" DiscussionListItem--unapproved")})),(0,r.extend)(f().prototype,"elementAttrs",(function(o){this.attrs.post.isApproved()||(o.className+=" Post--unapproved")})),(0,r.extend)(y().prototype,"headerItems",(function(o){this.attrs.post.isApproved()||this.attrs.post.isHidden()||o.add("unapproved",a().translator.trans("flarum-approval.forum.post.awaiting_approval_text"))})),(0,r.override)(f().prototype,"flagReason",(function(o,t){return"approval"===t.type()?a().translator.trans("flarum-approval.forum.post.awaiting_approval_text"):o(t)})),(0,r.extend)(_(),"destructiveControls",(function(o,t){!t.isApproved()&&t.canApprove()&&o.add("approve",m(g(),{icon:"fas fa-check",onclick:_().approveAction.bind(t)},a().translator.trans("flarum-approval.forum.post_controls.approve_button")),10)})),_().approveAction=function(){this.save({isApproved:!0}),1===this.number()&&this.discussion().pushAttributes({isApproved:!0})}}),-10)})(),module.exports=t})(); +(()=>{var t={n:o=>{var r=o&&o.__esModule?()=>o.default:()=>o;return t.d(r,{a:r}),r},d:(o,r)=>{for(var e in r)t.o(r,e)&&!t.o(o,e)&&Object.defineProperty(o,e,{enumerable:!0,get:r[e]})},o:(t,o)=>Object.prototype.hasOwnProperty.call(t,o)};(()=>{"use strict";const o=flarum.reg.get("core","common/extend"),r=flarum.reg.get("core","forum/app");var e=t.n(r);const a=flarum.reg.get("core","common/models/Discussion");var n=t.n(a);const p=flarum.reg.get("core","common/models/Post");var s=t.n(p);const i=flarum.reg.get("core","common/components/Badge");var c=t.n(i);const u=flarum.reg.get("core","forum/components/DiscussionListItem");var l=t.n(u);const d=flarum.reg.get("core","forum/components/Post");var v=t.n(d);const f=flarum.reg.get("core","forum/components/CommentPost");var g=t.n(f);const A=flarum.reg.get("core","common/components/Button");var h=t.n(A);const b=flarum.reg.get("core","forum/utils/PostControls");var y=t.n(b);e().initializers.add("flarum-approval",(()=>{n().prototype.isApproved=n().attribute("isApproved"),(0,o.extend)(n().prototype,"badges",(function(t){this.isApproved()||t.has("hidden")||t.add("awaitingApproval",m(c(),{type:"awaitingApproval",icon:"fas fa-gavel",label:e().translator.trans("flarum-approval.forum.badge.awaiting_approval_tooltip")}))})),s().prototype.isApproved=s().attribute("isApproved"),s().prototype.canApprove=s().attribute("canApprove"),(0,o.extend)(l().prototype,"elementAttrs",(function(t){this.attrs.discussion.isApproved()||(t.className+=" DiscussionListItem--unapproved")})),(0,o.extend)(v().prototype,"elementAttrs",(function(t){this.attrs.post.isApproved()||(t.className+=" Post--unapproved")})),(0,o.extend)(g().prototype,"headerItems",(function(t){this.attrs.post.isApproved()||this.attrs.post.isHidden()||t.add("unapproved",e().translator.trans("flarum-approval.forum.post.awaiting_approval_text"))})),(0,o.override)(v().prototype,"flagReason",(function(t,o){return"approval"===o.type()?e().translator.trans("flarum-approval.forum.post.awaiting_approval_text"):t(o)})),(0,o.extend)(y(),"destructiveControls",(function(t,o){!o.isApproved()&&o.canApprove()&&t.add("approve",m(h(),{icon:"fas fa-check",onclick:y().approveAction.bind(o)},e().translator.trans("flarum-approval.forum.post_controls.approve_button")),10)})),y().approveAction=function(){this.save({isApproved:!0}),1===this.number()&&this.discussion().pushAttributes({isApproved:!0})}}),-10)})(),module.exports={}})(); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/extensions/approval/js/dist/forum.js.map b/extensions/approval/js/dist/forum.js.map index 97acdfa5e8..e8cf338603 100644 --- a/extensions/approval/js/dist/forum.js.map +++ b/extensions/approval/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,a,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,4B,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,sB,aCAxD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,uBAAuB,SAAUtB,EAAOgB,IACtDA,EAAKd,cAAgBc,EAAKO,cAC7BvB,EAAMI,IACJ,UACAC,EAACmB,IAAM,CAAChB,KAAK,eAAeiB,QAASH,IAAAA,cAAAA,KAAgCN,IAClEnB,IAAAA,WAAAA,MAAqB,uDAExB,GAGN,IAEAyB,IAAAA,cAA6B,WAC3BrB,KAAKyB,KAAK,CAAExB,YAAY,IAEF,IAAlBD,KAAK0B,UACP1B,KAAKY,aAAae,eAAe,CAAE1B,YAAY,GAEnD,CAAC,IAEF,G","sources":["webpack://@flarum/approval/webpack/bootstrap","webpack://@flarum/approval/webpack/runtime/compat get default export","webpack://@flarum/approval/webpack/runtime/define property getters","webpack://@flarum/approval/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/approval/webpack/runtime/make namespace object","webpack://@flarum/approval/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/approval/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/approval/external root \"flarum.core.compat['common/models/Discussion']\"","webpack://@flarum/approval/external root \"flarum.core.compat['common/models/Post']\"","webpack://@flarum/approval/external root \"flarum.core.compat['common/components/Badge']\"","webpack://@flarum/approval/external root \"flarum.core.compat['forum/components/DiscussionListItem']\"","webpack://@flarum/approval/external root \"flarum.core.compat['forum/components/Post']\"","webpack://@flarum/approval/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@flarum/approval/external root \"flarum.core.compat['common/components/Button']\"","webpack://@flarum/approval/external root \"flarum.core.compat['forum/utils/PostControls']\"","webpack://@flarum/approval/./src/forum/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Discussion'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Post'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Badge'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionListItem'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/Post'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/CommentPost'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/PostControls'];","import { extend, override } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport Discussion from 'flarum/common/models/Discussion';\nimport Post from 'flarum/common/models/Post';\nimport Badge from 'flarum/common/components/Badge';\nimport DiscussionListItem from 'flarum/forum/components/DiscussionListItem';\nimport PostComponent from 'flarum/forum/components/Post';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport Button from 'flarum/common/components/Button';\nimport PostControls from 'flarum/forum/utils/PostControls';\n\napp.initializers.add(\n 'flarum-approval',\n () => {\n Discussion.prototype.isApproved = Discussion.attribute('isApproved');\n\n extend(Discussion.prototype, 'badges', function (items) {\n if (!this.isApproved() && !items.has('hidden')) {\n items.add(\n 'awaitingApproval',\n \n );\n }\n });\n\n Post.prototype.isApproved = Post.attribute('isApproved');\n Post.prototype.canApprove = Post.attribute('canApprove');\n\n extend(DiscussionListItem.prototype, 'elementAttrs', function (attrs) {\n if (!this.attrs.discussion.isApproved()) {\n attrs.className += ' DiscussionListItem--unapproved';\n }\n });\n\n extend(PostComponent.prototype, 'elementAttrs', function (attrs) {\n if (!this.attrs.post.isApproved()) {\n attrs.className += ' Post--unapproved';\n }\n });\n\n extend(CommentPost.prototype, 'headerItems', function (items) {\n if (!this.attrs.post.isApproved() && !this.attrs.post.isHidden()) {\n items.add('unapproved', app.translator.trans('flarum-approval.forum.post.awaiting_approval_text'));\n }\n });\n\n override(PostComponent.prototype, 'flagReason', function (original, flag) {\n if (flag.type() === 'approval') {\n return app.translator.trans('flarum-approval.forum.post.awaiting_approval_text');\n }\n\n return original(flag);\n });\n\n extend(PostControls, 'destructiveControls', function (items, post) {\n if (!post.isApproved() && post.canApprove()) {\n items.add(\n 'approve',\n ,\n 10\n );\n }\n });\n\n PostControls.approveAction = function () {\n this.save({ isApproved: true });\n\n if (this.number() === 1) {\n this.discussion().pushAttributes({ isApproved: true });\n }\n };\n },\n -10\n); // set initializer priority to run after reports\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","Discussion","extend","items","this","isApproved","has","add","m","Badge","type","icon","label","Post","DiscussionListItem","attrs","discussion","className","PostComponent","post","CommentPost","isHidden","override","original","flag","PostControls","canApprove","Button","onclick","save","number","pushAttributes"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,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AUU,GACnDR,KAAKQ,MAAMG,KAAKd,eACnBW,EAAME,WAAa,oBAEvB,KACA,IAAAZ,QAAO,cAAuB,eAAe,SAAUC,GAChDC,KAAKQ,MAAMG,KAAKd,cAAiBG,KAAKQ,MAAMG,KAAKC,YACpDb,EAAMH,IAAI,aAAc,eAAeU,MAAM,qDAEjD,KACA,IAAAO,UAAS,cAAyB,cAAc,SAAUC,EAAUC,GAClE,MAAoB,aAAhBA,EAAKZ,OACA,eAAeG,MAAM,qDAEvBQ,EAASC,EAClB,KACA,IAAAjB,QAAO,IAAc,uBAAuB,SAAUC,EAAOY,IACtDA,EAAKd,cAAgBc,EAAKJ,cAC7BR,EAAMH,IAAI,UAAWM,EAAE,IAAQ,CAC7BE,KAAM,eACNY,QAAS,kBAA2BC,KAAKN,IACxC,eAAeL,MAAM,uDAAwD,GAEpF,IACA,kBAA6B,WAC3BN,KAAKkB,KAAK,CACRrB,YAAY,IAEQ,IAAlBG,KAAKmB,UACPnB,KAAKS,aAAaW,eAAe,CAC/BvB,YAAY,GAGlB,CAAC,IACC,G","sources":["webpack://@flarum/approval/webpack/bootstrap","webpack://@flarum/approval/webpack/runtime/compat get default export","webpack://@flarum/approval/webpack/runtime/define property getters","webpack://@flarum/approval/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'common/extend')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'forum/app')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'common/models/Discussion')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'common/models/Post')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'common/components/Badge')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'forum/components/DiscussionListItem')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'forum/components/Post')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'forum/components/CommentPost')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'common/components/Button')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'forum/utils/PostControls')\"","webpack://@flarum/approval/./src/forum/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extend');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/models/Discussion');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/models/Post');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Badge');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/DiscussionListItem');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/Post');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/CommentPost');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Button');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/utils/PostControls');","import { extend, override } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport Discussion from 'flarum/common/models/Discussion';\nimport Post from 'flarum/common/models/Post';\nimport Badge from 'flarum/common/components/Badge';\nimport DiscussionListItem from 'flarum/forum/components/DiscussionListItem';\nimport PostComponent from 'flarum/forum/components/Post';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport Button from 'flarum/common/components/Button';\nimport PostControls from 'flarum/forum/utils/PostControls';\napp.initializers.add('flarum-approval', () => {\n Discussion.prototype.isApproved = Discussion.attribute('isApproved');\n extend(Discussion.prototype, 'badges', function (items) {\n if (!this.isApproved() && !items.has('hidden')) {\n items.add('awaitingApproval', m(Badge, {\n type: \"awaitingApproval\",\n icon: \"fas fa-gavel\",\n label: app.translator.trans('flarum-approval.forum.badge.awaiting_approval_tooltip')\n }));\n }\n });\n Post.prototype.isApproved = Post.attribute('isApproved');\n Post.prototype.canApprove = Post.attribute('canApprove');\n extend(DiscussionListItem.prototype, 'elementAttrs', function (attrs) {\n if (!this.attrs.discussion.isApproved()) {\n attrs.className += ' DiscussionListItem--unapproved';\n }\n });\n extend(PostComponent.prototype, 'elementAttrs', function (attrs) {\n if (!this.attrs.post.isApproved()) {\n attrs.className += ' Post--unapproved';\n }\n });\n extend(CommentPost.prototype, 'headerItems', function (items) {\n if (!this.attrs.post.isApproved() && !this.attrs.post.isHidden()) {\n items.add('unapproved', app.translator.trans('flarum-approval.forum.post.awaiting_approval_text'));\n }\n });\n override(PostComponent.prototype, 'flagReason', function (original, flag) {\n if (flag.type() === 'approval') {\n return app.translator.trans('flarum-approval.forum.post.awaiting_approval_text');\n }\n return original(flag);\n });\n extend(PostControls, 'destructiveControls', function (items, post) {\n if (!post.isApproved() && post.canApprove()) {\n items.add('approve', m(Button, {\n icon: \"fas fa-check\",\n onclick: PostControls.approveAction.bind(post)\n }, app.translator.trans('flarum-approval.forum.post_controls.approve_button')), 10);\n }\n });\n PostControls.approveAction = function () {\n this.save({\n isApproved: true\n });\n if (this.number() === 1) {\n this.discussion().pushAttributes({\n isApproved: true\n });\n }\n };\n}, -10); // set initializer priority to run after reports"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","flarum","reg","add","isApproved","extend","items","this","has","m","type","icon","label","trans","canApprove","attrs","discussion","className","post","isHidden","override","original","flag","onclick","bind","save","number","pushAttributes"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/approval/js/forum.js b/extensions/approval/js/forum.ts similarity index 100% rename from extensions/approval/js/forum.js rename to extensions/approval/js/forum.ts diff --git a/extensions/approval/js/package.json b/extensions/approval/js/package.json index 2a84b15246..4dec237d17 100644 --- a/extensions/approval/js/package.json +++ b/extensions/approval/js/package.json @@ -5,7 +5,7 @@ "prettier": "@flarum/prettier-config", "devDependencies": { "prettier": "^2.5.1", - "flarum-webpack-config": "^2.0.0", + "flarum-webpack-config": "^3.0.0", "webpack": "^5.76.0", "webpack-cli": "^4.9.1", "@flarum/prettier-config": "^1.0.0" diff --git a/extensions/approval/js/src/admin/extend.tsx b/extensions/approval/js/src/admin/extend.tsx new file mode 100644 index 0000000000..687f3da29b --- /dev/null +++ b/extensions/approval/js/src/admin/extend.tsx @@ -0,0 +1,33 @@ +import Extend from 'flarum/common/extenders'; +import app from 'flarum/admin/app'; + +export default [ + new Extend.Admin() + .permission( + () => ({ + icon: 'fas fa-check', + label: app.translator.trans('flarum-approval.admin.permissions.start_discussions_without_approval_label'), + permission: 'discussion.startWithoutApproval', + }), + 'start', + 95 + ) + .permission( + () => ({ + icon: 'fas fa-check', + label: app.translator.trans('flarum-approval.admin.permissions.reply_without_approval_label'), + permission: 'discussion.replyWithoutApproval', + }), + 'reply', + 95 + ) + .permission( + () => ({ + icon: 'fas fa-check', + label: app.translator.trans('flarum-approval.admin.permissions.approve_posts_label'), + permission: 'discussion.approvePosts', + }), + 'moderate', + 65 + ), +]; diff --git a/extensions/approval/js/src/admin/index.js b/extensions/approval/js/src/admin/index.js deleted file mode 100644 index 7d9a95a202..0000000000 --- a/extensions/approval/js/src/admin/index.js +++ /dev/null @@ -1,43 +0,0 @@ -import { extend } from 'flarum/common/extend'; -import app from 'flarum/admin/app'; - -app.initializers.add('flarum-approval', () => { - extend(app, 'getRequiredPermissions', function (required, permission) { - if (permission === 'discussion.startWithoutApproval') { - required.push('startDiscussion'); - } - if (permission === 'discussion.replyWithoutApproval') { - required.push('discussion.reply'); - } - }); - - app.extensionData - .for('flarum-approval') - .registerPermission( - { - icon: 'fas fa-check', - label: app.translator.trans('flarum-approval.admin.permissions.start_discussions_without_approval_label'), - permission: 'discussion.startWithoutApproval', - }, - 'start', - 95 - ) - .registerPermission( - { - icon: 'fas fa-check', - label: app.translator.trans('flarum-approval.admin.permissions.reply_without_approval_label'), - permission: 'discussion.replyWithoutApproval', - }, - 'reply', - 95 - ) - .registerPermission( - { - icon: 'fas fa-check', - label: app.translator.trans('flarum-approval.admin.permissions.approve_posts_label'), - permission: 'discussion.approvePosts', - }, - 'moderate', - 65 - ); -}); diff --git a/extensions/approval/js/src/admin/index.ts b/extensions/approval/js/src/admin/index.ts new file mode 100644 index 0000000000..edfeecbf6c --- /dev/null +++ b/extensions/approval/js/src/admin/index.ts @@ -0,0 +1,15 @@ +import { extend } from 'flarum/common/extend'; +import app from 'flarum/admin/app'; + +export { default as extend } from './extend'; + +app.initializers.add('flarum-approval', () => { + extend(app, 'getRequiredPermissions', function (required, permission) { + if (permission === 'discussion.startWithoutApproval') { + required.push('startDiscussion'); + } + if (permission === 'discussion.replyWithoutApproval') { + required.push('discussion.reply'); + } + }); +}); diff --git a/extensions/approval/js/tsconfig.json b/extensions/approval/js/tsconfig.json new file mode 100644 index 0000000000..d7b48770ca --- /dev/null +++ b/extensions/approval/js/tsconfig.json @@ -0,0 +1,15 @@ +{ + // Use Flarum's tsconfig as a starting point + "extends": "flarum-tsconfig", + // This will match all .ts, .tsx, .d.ts, .js, .jsx files in your `src` folder + // and also tells your Typescript server to read core's global typings for + // access to `dayjs` and `$` in the global namespace. + "include": ["src/**/*", "../../../*/*/js/dist-typings/@types/**/*", "@types/**/*"], + "compilerOptions": { + // This will output typings to `dist-typings` + "declarationDir": "./dist-typings", + "paths": { + "flarum/*": ["../../../framework/core/js/dist-typings/*"] + } + } +} diff --git a/extensions/approval/src/Api/PostResourceFields.php b/extensions/approval/src/Api/PostResourceFields.php new file mode 100644 index 0000000000..1219e478af --- /dev/null +++ b/extensions/approval/src/Api/PostResourceFields.php @@ -0,0 +1,29 @@ +writable(fn (Post $post, Context $context) => $context->getActor()->can('approve', $post)) + // set by the ApproveContent listener. + ->set(fn () => null), + Schema\Boolean::make('canApprove') + ->get(fn (Post $post, Context $context) => $context->getActor()->can('approvePosts', $post->discussion)), + ]; + } +} diff --git a/extensions/approval/src/Listener/ApproveContent.php b/extensions/approval/src/Listener/ApproveContent.php index e3d259eb0e..7d21e8821f 100755 --- a/extensions/approval/src/Listener/ApproveContent.php +++ b/extensions/approval/src/Listener/ApproveContent.php @@ -11,6 +11,7 @@ use Flarum\Approval\Event\PostWasApproved; use Flarum\Post\Event\Saving; +use Flarum\User\Exception\PermissionDeniedException; use Illuminate\Contracts\Events\Dispatcher; class ApproveContent @@ -20,23 +21,42 @@ public function subscribe(Dispatcher $events): void $events->listen(Saving::class, $this->approvePost(...)); } + /** + * @throws PermissionDeniedException + */ public function approvePost(Saving $event): void { $attributes = $event->data['attributes']; $post = $event->post; + // Nothing to do if it is already approved. + if ($post->is_approved) { + return; + } + + /* + * We approve a post in one of two cases: + * - The post was unapproved and the allowed action is approving it. We trigger an event. + * - The post was unapproved and the allowed actor is hiding or un-hiding it. + * We approve it silently if the action is unhiding. + */ + $approvingSilently = false; + if (isset($attributes['isApproved'])) { $event->actor->assertCan('approve', $post); $isApproved = (bool) $attributes['isApproved']; - } elseif (! empty($attributes['isHidden']) && $event->actor->can('approve', $post)) { + } elseif (isset($attributes['isHidden']) && $event->actor->can('approve', $post)) { $isApproved = true; + $approvingSilently = $attributes['isHidden']; } if (! empty($isApproved)) { $post->is_approved = true; - $post->raise(new PostWasApproved($post, $event->actor)); + if (! $approvingSilently) { + $post->raise(new PostWasApproved($post, $event->actor)); + } } } } diff --git a/extensions/approval/tests/integration/InteractsWithUnapprovedContent.php b/extensions/approval/tests/integration/InteractsWithUnapprovedContent.php index 3f33097a6a..6b6b70d310 100644 --- a/extensions/approval/tests/integration/InteractsWithUnapprovedContent.php +++ b/extensions/approval/tests/integration/InteractsWithUnapprovedContent.php @@ -10,19 +10,23 @@ namespace Flarum\Approval\Tests\integration; use Carbon\Carbon; +use Flarum\Discussion\Discussion; +use Flarum\Group\Group; +use Flarum\Post\Post; +use Flarum\User\User; trait InteractsWithUnapprovedContent { protected function prepareUnapprovedDatabaseContent() { $this->prepareDatabase([ - 'users' => [ + User::class => [ ['id' => 1, 'username' => 'Muralf', 'email' => 'muralf@machine.local', 'is_email_confirmed' => 1], $this->normalUser(), ['id' => 3, 'username' => 'acme', 'email' => 'acme@machine.local', 'is_email_confirmed' => 1], ['id' => 4, 'username' => 'luceos', 'email' => 'luceos@machine.local', 'is_email_confirmed' => 1], ], - 'discussions' => [ + Discussion::class => [ ['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 1, 'comment_count' => 1, 'is_approved' => 1, 'is_private' => 0], ['id' => 2, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 2, 'comment_count' => 1, 'is_approved' => 0, 'is_private' => 1], ['id' => 3, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 3, 'comment_count' => 1, 'is_approved' => 0, 'is_private' => 1], @@ -31,7 +35,7 @@ protected function prepareUnapprovedDatabaseContent() ['id' => 6, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 6, 'comment_count' => 1, 'is_approved' => 0, 'is_private' => 1], ['id' => 7, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 7, 'comment_count' => 1, 'is_approved' => 1, 'is_private' => 0], ], - 'posts' => [ + Post::class => [ ['id' => 1, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'is_private' => 0, 'is_approved' => 1, 'number' => 1], ['id' => 2, 'discussion_id' => 2, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'is_private' => 0, 'is_approved' => 1, 'number' => 1], ['id' => 3, 'discussion_id' => 3, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'is_private' => 0, 'is_approved' => 1, 'number' => 1], @@ -45,7 +49,7 @@ protected function prepareUnapprovedDatabaseContent() ['id' => 10, 'discussion_id' => 7, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'is_private' => 0, 'is_approved' => 1, 'number' => 4], ['id' => 11, 'discussion_id' => 7, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'is_private' => 1, 'is_approved' => 0, 'number' => 5], ], - 'groups' => [ + Group::class => [ ['id' => 4, 'name_singular' => 'Acme', 'name_plural' => 'Acme', 'is_hidden' => 0] ], 'group_user' => [ @@ -60,7 +64,7 @@ protected function prepareUnapprovedDatabaseContent() /** * null: Guest, 2: Normal User. */ - public function unallowedUsers(): array + public static function unallowedUsers(): array { return [[null], [2]]; } @@ -68,7 +72,7 @@ public function unallowedUsers(): array /** * 1: Admin, 3: Permission Given, 4: Discussions Author. */ - public function allowedUsers(): array + public static function allowedUsers(): array { return [[1], [3], [4]]; } diff --git a/extensions/approval/tests/integration/api/ApprovePostsTest.php b/extensions/approval/tests/integration/api/ApprovePostsTest.php new file mode 100644 index 0000000000..d5d3c5ead0 --- /dev/null +++ b/extensions/approval/tests/integration/api/ApprovePostsTest.php @@ -0,0 +1,122 @@ +extension('flarum-approval'); + + $this->prepareDatabase([ + User::class => [ + ['id' => 1, 'username' => 'Muralf', 'email' => 'muralf@machine.local', 'is_email_confirmed' => 1], + $this->normalUser(), + ['id' => 3, 'username' => 'acme', 'email' => 'acme@machine.local', 'is_email_confirmed' => 1], + ['id' => 4, 'username' => 'luceos', 'email' => 'luceos@machine.local', 'is_email_confirmed' => 1], + ], + Discussion::class => [ + ['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 1, 'comment_count' => 1, 'is_approved' => 1], + ], + Post::class => [ + ['id' => 1, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'hidden_at' => null, 'is_approved' => 1, 'number' => 1], + ['id' => 2, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'hidden_at' => null, 'is_approved' => 1, 'number' => 2], + ['id' => 3, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'hidden_at' => null, 'is_approved' => 0, 'number' => 3], + ['id' => 4, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'hidden_at' => Carbon::now(), 'is_approved' => 1, 'number' => 4], + ['id' => 5, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'hidden_at' => null, 'is_approved' => 0, 'number' => 5], + ], + Group::class => [ + ['id' => 4, 'name_singular' => 'Acme', 'name_plural' => 'Acme', 'is_hidden' => 0], + ['id' => 5, 'name_singular' => 'Acme', 'name_plural' => 'Acme', 'is_hidden' => 0], + ], + 'group_user' => [ + ['user_id' => 3, 'group_id' => 4], + ], + 'group_permission' => [ + ['group_id' => 4, 'permission' => 'discussion.approvePosts'], + ] + ]); + } + + #[Test] + public function can_approve_unapproved_post() + { + $response = $this->send( + $this->request('PATCH', '/api/posts/3', [ + 'authenticatedAs' => 3, + 'json' => [ + 'data' => [ + 'attributes' => [ + 'isApproved' => true + ] + ] + ] + ]) + ); + + $this->assertEquals(200, $response->getStatusCode(), $response->getBody()->getContents()); + $this->assertEquals(1, $this->database()->table('posts')->where('id', 3)->where('is_approved', 1)->count()); + } + + #[Test] + public function cannot_approve_post_without_permission() + { + $response = $this->send( + $this->request('PATCH', '/api/posts/3', [ + 'authenticatedAs' => 4, + 'json' => [ + 'data' => [ + 'attributes' => [ + 'isApproved' => true + ] + ] + ] + ]) + ); + + $this->assertEquals(403, $response->getStatusCode(), $response->getBody()->getContents()); + $this->assertEquals(0, $this->database()->table('posts')->where('id', 3)->where('is_approved', 1)->count()); + } + + #[Test] + public function hiding_post_silently_approves_it() + { + $response = $this->send( + $this->request('PATCH', '/api/posts/5', [ + 'authenticatedAs' => 3, + 'json' => [ + 'data' => [ + 'attributes' => [ + 'isHidden' => true + ] + ] + ] + ]) + ); + + $this->assertEquals(200, $response->getStatusCode(), $response->getBody()->getContents()); + $this->assertEquals(1, $this->database()->table('posts')->where('id', 5)->where('is_approved', 1)->count()); + } +} diff --git a/extensions/approval/tests/integration/api/CreatePostsTest.php b/extensions/approval/tests/integration/api/CreatePostsTest.php new file mode 100644 index 0000000000..e8a87600b7 --- /dev/null +++ b/extensions/approval/tests/integration/api/CreatePostsTest.php @@ -0,0 +1,155 @@ +extension('flarum-flags', 'flarum-approval'); + + $this->prepareDatabase([ + User::class => [ + ['id' => 1, 'username' => 'Muralf', 'email' => 'muralf@machine.local', 'is_email_confirmed' => 1], + $this->normalUser(), + ['id' => 3, 'username' => 'acme', 'email' => 'acme@machine.local', 'is_email_confirmed' => 1], + ['id' => 4, 'username' => 'luceos', 'email' => 'luceos@machine.local', 'is_email_confirmed' => 1], + ], + Discussion::class => [ + ['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 1, 'comment_count' => 1, 'is_approved' => 1], + ['id' => 2, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 2, 'comment_count' => 1, 'is_approved' => 0], + ['id' => 3, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 3, 'comment_count' => 1, 'is_approved' => 0], + ], + Post::class => [ + ['id' => 1, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'is_private' => 0, 'is_approved' => 1, 'number' => 1], + ['id' => 2, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'is_private' => 0, 'is_approved' => 1, 'number' => 2], + ['id' => 3, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'is_private' => 0, 'is_approved' => 1, 'number' => 3], + ['id' => 4, 'discussion_id' => 2, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'is_private' => 0, 'is_approved' => 1, 'number' => 1], + ['id' => 5, 'discussion_id' => 2, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'is_private' => 0, 'is_approved' => 1, 'number' => 2], + ['id' => 6, 'discussion_id' => 2, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'is_private' => 0, 'is_approved' => 1, 'number' => 3], + ['id' => 7, 'discussion_id' => 3, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'is_private' => 0, 'is_approved' => 1, 'number' => 1], + ['id' => 8, 'discussion_id' => 3, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'is_private' => 0, 'is_approved' => 1, 'number' => 2], + ['id' => 9, 'discussion_id' => 3, 'user_id' => 4, 'type' => 'comment', 'content' => '

Text

', 'is_private' => 0, 'is_approved' => 0, 'number' => 3], + ], + Group::class => [ + ['id' => 4, 'name_singular' => 'Acme', 'name_plural' => 'Acme', 'is_hidden' => 0], + ['id' => 5, 'name_singular' => 'Acme', 'name_plural' => 'Acme', 'is_hidden' => 0], + ], + 'group_user' => [ + ['user_id' => 3, 'group_id' => 4], + ['user_id' => 2, 'group_id' => 5], + ], + 'group_permission' => [ + ['group_id' => 4, 'permission' => 'discussion.startWithoutApproval'], + ['group_id' => 5, 'permission' => 'discussion.replyWithoutApproval'], + ['group_id' => Group::MEMBER_ID, 'permission' => 'postWithoutThrottle'], + ] + ]); + } + + #[Test] + #[DataProvider('startDiscussionDataProvider')] + public function can_start_discussion_without_approval_when_allowed(int $authenticatedAs, bool $allowed) + { + $this->database()->table('group_permission')->where('group_id', Group::MEMBER_ID)->where('permission', 'discussion.startWithoutApproval')->delete(); + + $response = $this->send( + $this->request('POST', '/api/discussions', [ + 'authenticatedAs' => $authenticatedAs, + 'json' => [ + 'data' => [ + 'type' => 'discussions', + 'attributes' => [ + 'title' => 'This is a new discussion', + 'content' => 'This is a new discussion', + ] + ] + ] + ]) + ); + + $body = $response->getBody()->getContents(); + $json = json_decode($body, true); + + $this->assertEquals(201, $response->getStatusCode(), $body); + $this->assertEquals($allowed ? 1 : 0, $this->database()->table('discussions')->where('id', $json['data']['id'])->value('is_approved')); + } + + #[Test] + #[DataProvider('replyToDiscussionDataProvider')] + public function can_reply_without_approval_when_allowed(?int $authenticatedAs, bool $allowed) + { + $this->database()->table('group_permission')->where('group_id', Group::MEMBER_ID)->where('permission', 'discussion.replyWithoutApproval')->delete(); + + $response = $this->send( + $this->request('POST', '/api/posts', [ + 'authenticatedAs' => $authenticatedAs, + 'json' => [ + 'data' => [ + 'type' => 'posts', + 'attributes' => [ + 'content' => 'This is a new reply', + ], + 'relationships' => [ + 'discussion' => [ + 'data' => [ + 'type' => 'discussions', + 'id' => 1 + ] + ] + ] + ] + ] + ]) + ); + + $body = $response->getBody()->getContents(); + $json = json_decode($body, true); + + $this->assertEquals(201, $response->getStatusCode(), $body); + $this->assertEquals($allowed ? 1 : 0, $this->database()->table('posts')->where('id', $json['data']['id'])->value('is_approved')); + } + + public static function startDiscussionDataProvider(): array + { + return [ + 'Admin' => [1, true], + 'User without permission' => [2, false], + 'Permission Given' => [3, true], + 'Another user without permission' => [4, false], + ]; + } + + public static function replyToDiscussionDataProvider(): array + { + return [ + 'Admin' => [1, true], + 'User without permission' => [3, false], + 'Permission Given' => [2, true], + 'Another user without permission' => [4, false], + ]; + } +} diff --git a/extensions/approval/tests/integration/api/ListDiscussionsTest.php b/extensions/approval/tests/integration/api/ListDiscussionsTest.php index 2ebb639519..1f4976128d 100644 --- a/extensions/approval/tests/integration/api/ListDiscussionsTest.php +++ b/extensions/approval/tests/integration/api/ListDiscussionsTest.php @@ -13,6 +13,8 @@ use Flarum\Testing\integration\RetrievesAuthorizedUsers; use Flarum\Testing\integration\TestCase; use Illuminate\Support\Arr; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; class ListDiscussionsTest extends TestCase { @@ -28,10 +30,8 @@ protected function setUp(): void $this->prepareUnapprovedDatabaseContent(); } - /** - * @dataProvider unallowedUsers - * @test - */ + #[Test] + #[DataProvider('unallowedUsers')] public function can_only_see_approved_if_not_allowed_to_approve(?int $authenticatedAs) { $response = $this->send( @@ -44,10 +44,8 @@ public function can_only_see_approved_if_not_allowed_to_approve(?int $authentica $this->assertEqualsCanonicalizing([1, 4, 5, 7], Arr::pluck($body['data'], 'id')); } - /** - * @dataProvider allowedUsers - * @test - */ + #[Test] + #[DataProvider('allowedUsers')] public function can_see_unapproved_if_allowed_to_approve(int $authenticatedAs) { $response = $this->send( diff --git a/extensions/approval/tests/integration/api/ListPostsTest.php b/extensions/approval/tests/integration/api/ListPostsTest.php index 844d0f7965..ce06f2440b 100644 --- a/extensions/approval/tests/integration/api/ListPostsTest.php +++ b/extensions/approval/tests/integration/api/ListPostsTest.php @@ -13,6 +13,8 @@ use Flarum\Testing\integration\RetrievesAuthorizedUsers; use Flarum\Testing\integration\TestCase; use Illuminate\Support\Arr; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; class ListPostsTest extends TestCase { @@ -28,10 +30,8 @@ protected function setUp(): void $this->prepareUnapprovedDatabaseContent(); } - /** - * @dataProvider unallowedUsers - * @test - */ + #[Test] + #[DataProvider('unallowedUsers')] public function can_only_see_approved_if_not_allowed_to_approve(?int $authenticatedAs) { $response = $this->send( @@ -50,10 +50,8 @@ public function can_only_see_approved_if_not_allowed_to_approve(?int $authentica $this->assertEqualsCanonicalizing([7, 8, 10], Arr::pluck($body['data'], 'id')); } - /** - * @dataProvider allowedUsers - * @test - */ + #[Test] + #[DataProvider('allowedUsers')] public function can_see_unapproved_if_allowed_to_approve(int $authenticatedAs) { $response = $this->send( diff --git a/extensions/approval/tests/phpunit.integration.xml b/extensions/approval/tests/phpunit.integration.xml index 7319d929ae..e3e14eab99 100644 --- a/extensions/approval/tests/phpunit.integration.xml +++ b/extensions/approval/tests/phpunit.integration.xml @@ -1,22 +1,20 @@ - + ../src/ - + ./integration diff --git a/extensions/approval/tests/phpunit.unit.xml b/extensions/approval/tests/phpunit.unit.xml index 66262dd9ff..67367a782d 100644 --- a/extensions/approval/tests/phpunit.unit.xml +++ b/extensions/approval/tests/phpunit.unit.xml @@ -1,28 +1,23 @@ - + ../src/ - + ./unit - - - diff --git a/extensions/bbcode/.gitignore b/extensions/bbcode/.gitignore index 4ebb168a05..e60e512061 100644 --- a/extensions/bbcode/.gitignore +++ b/extensions/bbcode/.gitignore @@ -4,6 +4,7 @@ composer.phar .DS_Store Thumbs.db +tests/.phpunit.cache tests/.phpunit.result.cache /tests/integration/tmp .vagrant diff --git a/extensions/bbcode/LICENSE b/extensions/bbcode/LICENSE index 54ac29ab2c..bb6e15d87e 100644 --- a/extensions/bbcode/LICENSE +++ b/extensions/bbcode/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019-2021 Stichting Flarum (Flarum Foundation) +Copyright (c) 2019-2024 Stichting Flarum (Flarum Foundation) Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/extensions/embed/.gitignore b/extensions/embed/.gitignore index 4ebb168a05..e60e512061 100644 --- a/extensions/embed/.gitignore +++ b/extensions/embed/.gitignore @@ -4,6 +4,7 @@ composer.phar .DS_Store Thumbs.db +tests/.phpunit.cache tests/.phpunit.result.cache /tests/integration/tmp .vagrant diff --git a/extensions/embed/LICENSE b/extensions/embed/LICENSE index 54ac29ab2c..bb6e15d87e 100644 --- a/extensions/embed/LICENSE +++ b/extensions/embed/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019-2021 Stichting Flarum (Flarum Foundation) +Copyright (c) 2019-2024 Stichting Flarum (Flarum Foundation) Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/extensions/embed/js/dist/forum.js b/extensions/embed/js/dist/forum.js index 4876d5d717..2bf677a3a5 100644 --- a/extensions/embed/js/dist/forum.js +++ b/extensions/embed/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var e={648:e=>{!function(t){if("undefined"!=typeof window){var n=!0,o="",i=0,r="",a=null,c="",u=!1,s={resize:1,click:1},d=128,l=!0,m=1,f="bodyOffset",p=f,h=!0,g="",v={},y=32,w=null,b=!1,T=!1,S="[iFrameSizer]",E=S.length,O="",M={max:1,min:1,bodyScroll:1,documentElementScroll:1},I="child",N=window.parent,x="*",A=0,C=!1,k=null,z=16,P=1,R="scroll",F=R,L=window,j=function(){re("onMessage function not defined")},D=function(){},q=function(){},H={height:function(){return re("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return re("Custom width calculation function not defined"),document.body.scrollWidth}},W={},B=!1;try{var J=Object.create({},{passive:{get:function(){B=!0}}});window.addEventListener("test",ee,J),window.removeEventListener("test",ee,J)}catch(e){}var U,_,V,X,Y,K,Q,$={bodyOffset:function(){return document.body.offsetHeight+he("marginTop")+he("marginBottom")},offset:function(){return $.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return H.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,ve($))},min:function(){return Math.min.apply(null,ve($))},grow:function(){return $.max()},lowestElement:function(){return Math.max($.bodyOffset()||$.documentElementOffset(),ge("bottom",we()))},taggedElement:function(){return ye("bottom","data-iframe-height")}},G={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return H.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(G.bodyScroll(),G.documentElementScroll())},max:function(){return Math.max.apply(null,ve(G))},min:function(){return Math.min.apply(null,ve(G))},rightMostElement:function(){return ge("right",we())},taggedElement:function(){return ye("right","data-iframe-width")}},Z=(U=be,Y=null,K=0,Q=function(){K=Date.now(),Y=null,X=U.apply(_,V),Y||(_=V=null)},function(){var e=Date.now();K||(K=e);var t=z-(e-K);return _=this,V=arguments,t<=0||t>z?(Y&&(clearTimeout(Y),Y=null),K=e,X=U.apply(_,V),Y||(_=V=null)):Y||(Y=setTimeout(Q,t)),X});te(window,"message",(function(s){var m,f={init:function(){var e,m,f;g=s.data,N=s.source,function(){function e(e){return"true"===e}var a=g.substr(E).split(":");O=a[0],i=t!==a[1]?Number(a[1]):i,u=t!==a[2]?e(a[2]):u,b=t!==a[3]?e(a[3]):b,y=t!==a[4]?Number(a[4]):y,n=t!==a[6]?e(a[6]):n,r=a[7],p=t!==a[8]?a[8]:p,o=a[9],c=a[10],A=t!==a[11]?Number(a[11]):A,v.enable=t!==a[12]&&e(a[12]),I=t!==a[13]?a[13]:I,F=t!==a[14]?a[14]:F,T=t!==a[15]?Boolean(a[15]):T}(),ie("Initialising iFrame ("+window.location.href+")"),function(){function e(){var e=window.iFrameResizer;ie("Reading data from page: "+JSON.stringify(e)),Object.keys(e).forEach(ae,e),j="onMessage"in e?e.onMessage:j,D="onReady"in e?e.onReady:D,x="targetOrigin"in e?e.targetOrigin:x,p="heightCalculationMethod"in e?e.heightCalculationMethod:p,F="widthCalculationMethod"in e?e.widthCalculationMethod:F}function t(e,t){return"function"==typeof e&&(ie("Setup custom "+t+"CalcMethod"),H[t]=e,e="custom"),e}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),p=t(p,"height"),F=t(F,"width")),ie("TargetOrigin for parent set to: "+x)}(),t===r&&(r=i+"px"),ce("margin",(m="margin",-1!==(f=r).indexOf("-")&&(re("Negative CSS value ignored for "+m),f=""),f)),ce("background",o),ce("padding",c),(e=document.createElement("div")).style.clear="both",e.style.display="block",e.style.height="0",document.body.appendChild(e),le(),me(),document.documentElement.style.height="",document.body.style.height="",ie('HTML & body height set to "auto"'),ie("Enable public methods"),L.parentIFrame={autoResize:function(e){return!0===e&&!1===n?(n=!0,fe()):!1===e&&!0===n&&(n=!1,se("remove"),null!==a&&a.disconnect(),clearInterval(w)),Me(0,0,"autoResize",JSON.stringify(n)),n},close:function(){Me(0,0,"close")},getId:function(){return O},getPageInfo:function(e){"function"==typeof e?(q=e,Me(0,0,"pageInfo")):(q=function(){},Me(0,0,"pageInfoStop"))},moveToAnchor:function(e){v.findTarget(e)},reset:function(){Oe("parentIFrame.reset")},scrollTo:function(e,t){Me(t,e,"scrollTo")},scrollToOffset:function(e,t){Me(t,e,"scrollToOffset")},sendMessage:function(e,t){Me(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod:function(e){p=e,le()},setWidthCalculationMethod:function(e){F=e,me()},setTargetOrigin:function(e){ie("Set targetOrigin: "+e),x=e},size:function(e,t){Te("size","parentIFrame.size("+(e||"")+(t?","+t:"")+")",e,t)}},function(){function e(e){Me(0,0,e.type,e.screenY+":"+e.screenX)}function t(t,n){ie("Add event listener: "+n),te(window.document,t,e)}!0===T&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),fe(),v=function(){function e(){return{x:window.pageXOffset!==t?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==t?window.pageYOffset:document.documentElement.scrollTop}}function n(t){var n=t.getBoundingClientRect(),o=e();return{x:parseInt(n.left,10)+parseInt(o.x,10),y:parseInt(n.top,10)+parseInt(o.y,10)}}function o(e){function o(e){var t=n(e);ie("Moving to in page link (#"+i+") at x: "+t.x+" y: "+t.y),Me(t.y,t.x,"scrollToOffset")}var i=e.split("#")[1]||e,r=decodeURIComponent(i),a=document.getElementById(r)||document.getElementsByName(r)[0];t!==a?o(a):(ie("In page link (#"+i+") not found in iFrame, so sending to parent"),Me(0,0,"inPageLink","#"+i))}function i(){var e=window.location.hash,t=window.location.href;""!==e&&"#"!==e&&o(t)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&te(e,"click",t)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),e)}function a(){te(window,"hashchange",i)}function c(){setTimeout(i,d)}function u(){Array.prototype.forEach&&document.querySelectorAll?(ie("Setting up location.hash handlers"),r(),a(),c()):re("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}return v.enable?u():ie("In page linking not enabled"),{findTarget:o}}(),Te("init","Init message from host page"),D(),l=!1,setTimeout((function(){h=!1}),d)},reset:function(){h?ie("Page reset ignored by init"):(ie("Page size reset by host page"),Ee("resetPage"))},resize:function(){Te("resizeParent","Parent window requested size check")},moveToAnchor:function(){v.findTarget(C())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var e=C();ie("PageInfoFromParent called from parent: "+e),q(JSON.parse(e)),ie(" --")},message:function(){var e=C();ie("onMessage called from parent: "+e),j(JSON.parse(e)),ie(" --")}};function M(){return s.data.split("]")[1].split(":")[0]}function C(){return s.data.substr(s.data.indexOf(":")+1)}function k(){return s.data.split(":")[2]in{true:1,false:1}}S===(""+s.data).substr(0,E)&&(!1===l?(m=M())in f?f[m]():!e.exports&&"iFrameResize"in window||"jQuery"in window&&"iFrameResize"in window.jQuery.prototype||k()||re("Unexpected message ("+s.data+")"):k()?f.init():ie('Ignored message of type "'+M()+'". Received before initialization.'))})),te(window,"readystatechange",Ie),Ie()}function ee(){}function te(e,t,n,o){e.addEventListener(t,n,!!B&&(o||{}))}function ne(e){return e.charAt(0).toUpperCase()+e.slice(1)}function oe(e){return S+"["+O+"] "+e}function ie(e){b&&"object"==typeof window.console&&console.log(oe(e))}function re(e){"object"==typeof window.console&&console.warn(oe(e))}function ae(e){var t=e.split("Callback");if(2===t.length){var n="on"+t[0].charAt(0).toUpperCase()+t[0].slice(1);this[n]=this[e],delete this[e],re("Deprecated: '"+e+"' has been renamed '"+n+"'. The old method will be removed in the next major version.")}}function ce(e,n){t!==n&&""!==n&&"null"!==n&&(document.body.style[e]=n,ie("Body "+e+' set to "'+n+'"'))}function ue(e){var t={add:function(t){function n(){Te(e.eventName,e.eventType)}W[t]=n,te(window,t,n,{passive:!0})},remove:function(e){var t,n,o=W[e];delete W[e],t=e,n=o,window.removeEventListener(t,n,!1)}};e.eventNames&&Array.prototype.map?(e.eventName=e.eventNames[0],e.eventNames.map(t[e.method])):t[e.method](e.eventName),ie(ne(e.method)+" event listener: "+e.eventType)}function se(e){ue({method:e,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]}),ue({method:e,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]}),ue({method:e,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]}),ue({method:e,eventType:"Input",eventName:"input"}),ue({method:e,eventType:"Mouse Up",eventName:"mouseup"}),ue({method:e,eventType:"Mouse Down",eventName:"mousedown"}),ue({method:e,eventType:"Orientation Change",eventName:"orientationchange"}),ue({method:e,eventType:"Print",eventName:["afterprint","beforeprint"]}),ue({method:e,eventType:"Ready State Change",eventName:"readystatechange"}),ue({method:e,eventType:"Touch Start",eventName:"touchstart"}),ue({method:e,eventType:"Touch End",eventName:"touchend"}),ue({method:e,eventType:"Touch Cancel",eventName:"touchcancel"}),ue({method:e,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]}),ue({method:e,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]}),ue({method:e,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]}),"child"===I&&ue({method:e,eventType:"IFrame Resized",eventName:"resize"})}function de(e,t,n,o){return t!==e&&(e in n||(re(e+" is not a valid option for "+o+"CalculationMethod."),e=t),ie(o+' calculation method set to "'+e+'"')),e}function le(){p=de(p,f,$,"height")}function me(){F=de(F,R,G,"width")}function fe(){var e;!0===n?(se("add"),e=0>y,window.MutationObserver||window.WebKitMutationObserver?e?pe():a=function(){function e(e){function t(e){!1===e.complete&&(ie("Attach listeners to "+e.src),e.addEventListener("load",o,!1),e.addEventListener("error",i,!1),a.push(e))}"attributes"===e.type&&"src"===e.attributeName?t(e.target):"childList"===e.type&&Array.prototype.forEach.call(e.target.querySelectorAll("img"),t)}function t(e){ie("Remove listeners from "+e.src),e.removeEventListener("load",o,!1),e.removeEventListener("error",i,!1),function(e){a.splice(a.indexOf(e),1)}(e)}function n(e,n,o){t(e.target),Te(n,o+": "+e.target.src)}function o(e){n(e,"imageLoad","Image loaded")}function i(e){n(e,"imageLoadFailed","Image load failed")}function r(t){Te("mutationObserver","mutationObserver: "+t[0].target+" "+t[0].type),t.forEach(e)}var a=[],c=window.MutationObserver||window.WebKitMutationObserver,u=function(){var e=document.querySelector("body");return u=new c(r),ie("Create body MutationObserver"),u.observe(e,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}),u}();return{disconnect:function(){"disconnect"in u&&(ie("Disconnect body MutationObserver"),u.disconnect(),a.forEach(t))}}}():(ie("MutationObserver not supported in this browser!"),pe())):ie("Auto Resize disabled")}function pe(){0!==y&&(ie("setInterval: "+y+"ms"),w=setInterval((function(){Te("interval","setInterval: "+y)}),Math.abs(y)))}function he(e,t){var n=0;return t=t||document.body,n=null!==(n=document.defaultView.getComputedStyle(t,null))?n[e]:0,parseInt(n,10)}function ge(e,t){for(var n=t.length,o=0,i=0,r=ne(e),a=Date.now(),c=0;ci&&(i=o);return a=Date.now()-a,ie("Parsed "+n+" HTML elements"),ie("Element position calculated in "+a+"ms"),function(e){e>z/2&&ie("Event throttle increased to "+(z=2*e)+"ms")}(a),i}function ve(e){return[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll()]}function ye(e,t){var n=document.querySelectorAll("["+t+"]");return 0===n.length&&(re("No tagged elements ("+t+") found on page"),document.querySelectorAll("body *")),ge(e,n)}function we(){return document.querySelectorAll("body *")}function be(e,n,o,i){var r,a;!function(){function e(e,t){return!(Math.abs(e-t)<=A)}return r=t!==o?o:$[p](),a=t!==i?i:G[F](),e(m,r)||u&&e(P,a)}()&&"init"!==e?!(e in{init:1,interval:1,size:1})&&(p in M||u&&F in M)?Oe(n):e in{interval:1}||ie("No change in size detected"):(Se(),Me(m=r,P=a,e))}function Te(e,t,n,o){C&&e in s?ie("Trigger event cancelled: "+e):(e in{reset:1,resetPage:1,init:1}||ie("Trigger event: "+t),"init"===e?be(e,t,n,o):Z(e,t,n,o))}function Se(){C||(C=!0,ie("Trigger event lock on")),clearTimeout(k),k=setTimeout((function(){C=!1,ie("Trigger event lock off"),ie("--")}),d)}function Ee(e){m=$[p](),P=G[F](),Me(m,P,e)}function Oe(e){var t=p;p=f,ie("Reset trigger event: "+e),Se(),Ee("reset"),p=t}function Me(e,n,o,i,r){var a;t===r?r=x:ie("Message targetOrigin: "+r),ie("Sending message to host page ("+(a=O+":"+e+":"+n+":"+o+(t!==i?":"+i:""))+")"),N.postMessage(S+a,r)}function Ie(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}}()}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{"use strict";n.r(o),n(648);const e=flarum.core.compat["common/extend"],t=flarum.core.compat["forum/app"];var i=n.n(t);const r=flarum.core.compat["common/utils/Stream"];var a=n.n(r);const c=flarum.core.compat["forum/ForumApplication"];var u=n.n(c);const s=flarum.core.compat["forum/components/Composer"];var d=n.n(s);const l=flarum.core.compat["forum/components/PostStream"];var f=n.n(l);const p=flarum.core.compat["common/components/ModalManager"];var h=n.n(p);const g=flarum.core.compat["forum/components/PostMeta"];var v=n.n(g);const y=flarum.core.compat["forum/components/DiscussionPage"];var w=n.n(y);(0,e.extend)(u().prototype,"mount",(function(){m.route.param("hideFirstPost")&&(0,e.extend)(f().prototype,"view",(e=>{1===e.children[0].attrs["data-number"]&&e.children.splice(0,1)}))})),(0,e.override)(m.route.Link,"view",(function(e,t){return t.attrs.href=t.attrs.href.replace("/embed","/d"),t.attrs.target="_blank",e(t)})),(0,e.override)(v().prototype,"getPermalink",((e,t)=>e(t).replace("/embed","/d"))),i().pageInfo=a()({});const b=function(){const e=i().pageInfo();this.$().css("top",Math.max(0,e.scrollTop-e.offsetTop))};(0,e.extend)(h().prototype,"show",b),(0,e.extend)(d().prototype,"show",b),window.iFrameResizer={readyCallback:function(){window.parentIFrame.getPageInfo(i().pageInfo)}},(0,e.extend)(f().prototype,"goToNumber",(function(e,t){if("reply"===t&&"parentIFrame"in window&&i().composer.isFullScreen()){const e=this.$(".PostStream-item:last").offset().top;window.parentIFrame.scrollToOffset(0,e)}})),(0,e.extend)(w().prototype,"sidebarItems",(function(e){e.remove("scrubber");const t=this.discussion.replyCount();e.add("replies",m("h3",null,m("a",{route:i().route.discussion(this.discussion).replace("/embed","/d")},t," comment",1==t?"":"s")),100);const n=e.get("controls").attrs;n.className=n.className.replace("App-primaryControl","")})),i().routes.discussion={path:"/embed/:id",component:w()},i().routes["discussion.near"]={path:"/embed/:id/:near",component:w()}})(),module.exports=o})(); +(()=>{var e={424:e=>{!function(t){if("undefined"!=typeof window){var n=!0,o="",i=0,r="",a=null,c="",s=!1,u={resize:1,click:1},d=128,l=!0,m=1,f="bodyOffset",p=f,g=!0,h="",v={},y=32,w=null,b=!1,T=!1,E="[iFrameSizer]",O="",S={max:1,min:1,bodyScroll:1,documentElementScroll:1},M="child",I=window.parent,N="*",x=0,A=!1,C=null,k=16,z=1,R="scroll",P=R,F=window,L=function(){ie("onMessage function not defined")},D=function(){},j=function(){},q={height:function(){return ie("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return ie("Custom width calculation function not defined"),document.body.scrollWidth}},H={},W=!1;try{var B=Object.create({},{passive:{get:function(){W=!0}}});window.addEventListener("test",Z,B),window.removeEventListener("test",Z,B)}catch(e){}var J,U,V,X,Y,_,K,Q={bodyOffset:function(){return document.body.offsetHeight+ge("marginTop")+ge("marginBottom")},offset:function(){return Q.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return q.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,ve(Q))},min:function(){return Math.min.apply(null,ve(Q))},grow:function(){return Q.max()},lowestElement:function(){return Math.max(Q.bodyOffset()||Q.documentElementOffset(),he("bottom",we()))},taggedElement:function(){return ye("bottom","data-iframe-height")}},$={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return q.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max($.bodyScroll(),$.documentElementScroll())},max:function(){return Math.max.apply(null,ve($))},min:function(){return Math.min.apply(null,ve($))},rightMostElement:function(){return he("right",we())},taggedElement:function(){return ye("right","data-iframe-width")}},G=(J=be,Y=null,_=0,K=function(){_=Date.now(),Y=null,X=J.apply(U,V),Y||(U=V=null)},function(){var e=Date.now();_||(_=e);var t=k-(e-_);return U=this,V=arguments,t<=0||t>k?(Y&&(clearTimeout(Y),Y=null),_=e,X=J.apply(U,V),Y||(U=V=null)):Y||(Y=setTimeout(K,t)),X});"iframeResizer"in window||(window.iframeChildListener=function(e){Ie({data:e,sameDomian:!0})},ee(window,"message",Ie),ee(window,"readystatechange",Ne),Ne())}function Z(){}function ee(e,t,n,o){e.addEventListener(t,n,!!W&&(o||{}))}function te(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ne(e){return E+"["+O+"] "+e}function oe(e){b&&"object"==typeof window.console&&console.log(ne(e))}function ie(e){"object"==typeof window.console&&console.warn(ne(e))}function re(){var e,u;!function(){function e(e){return"true"===e}var a=h.slice(13).split(":");O=a[0],i=t===a[1]?i:Number(a[1]),s=t===a[2]?s:e(a[2]),b=t===a[3]?b:e(a[3]),y=t===a[4]?y:Number(a[4]),n=t===a[6]?n:e(a[6]),r=a[7],p=t===a[8]?p:a[8],o=a[9],c=a[10],x=t===a[11]?x:Number(a[11]),v.enable=t!==a[12]&&e(a[12]),M=t===a[13]?M:a[13],P=t===a[14]?P:a[14],T=t===a[15]?T:e(a[15])}(),oe("Initialising iFrame ("+window.location.href+")"),function(){function e(e,t){return"function"==typeof e&&(oe("Setup custom "+t+"CalcMethod"),q[t]=e,e="custom"),e}var t;"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(t=window.iFrameResizer,oe("Reading data from page: "+JSON.stringify(t)),Object.keys(t).forEach(ae,t),L="onMessage"in t?t.onMessage:L,D="onReady"in t?t.onReady:D,N="targetOrigin"in t?t.targetOrigin:N,p="heightCalculationMethod"in t?t.heightCalculationMethod:p,P="widthCalculationMethod"in t?t.widthCalculationMethod:P,p=e(p,"height"),P=e(P,"width")),oe("TargetOrigin for parent set to: "+N)}(),t===r&&(r=i+"px"),ce("margin",(-1!==(u=r).indexOf("-")&&(ie("Negative CSS value ignored for margin"),u=""),u)),ce("background",o),ce("padding",c),(e=document.createElement("div")).style.clear="both",e.style.display="block",e.style.height="0",document.body.appendChild(e),le(),me(),document.documentElement.style.height="",document.body.style.height="",oe('HTML & body height set to "auto"'),oe("Enable public methods"),F.parentIFrame={autoResize:function(e){return!0===e&&!1===n?(n=!0,fe()):!1===e&&!0===n&&(n=!1,ue("remove"),null!==a&&a.disconnect(),clearInterval(w)),Me(0,0,"autoResize",JSON.stringify(n)),n},close:function(){Me(0,0,"close")},getId:function(){return O},getPageInfo:function(e){"function"==typeof e?(j=e,Me(0,0,"pageInfo")):(j=function(){},Me(0,0,"pageInfoStop"))},moveToAnchor:function(e){v.findTarget(e)},reset:function(){Se("parentIFrame.reset")},scrollTo:function(e,t){Me(t,e,"scrollTo")},scrollToOffset:function(e,t){Me(t,e,"scrollToOffset")},sendMessage:function(e,t){Me(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod:function(e){p=e,le()},setWidthCalculationMethod:function(e){P=e,me()},setTargetOrigin:function(e){oe("Set targetOrigin: "+e),N=e},size:function(e,t){Te("size","parentIFrame.size("+(e||"")+(t?","+t:"")+")",e,t)}},function(){function e(e){Me(0,0,e.type,e.screenY+":"+e.screenX)}function t(t,n){oe("Add event listener: "+n),ee(window.document,t,e)}!0===T&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),fe(),v=function(){function e(e){var n=e.getBoundingClientRect(),o={x:window.pageXOffset===t?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===t?document.documentElement.scrollTop:window.pageYOffset};return{x:parseInt(n.left,10)+parseInt(o.x,10),y:parseInt(n.top,10)+parseInt(o.y,10)}}function n(n){var o=n.split("#")[1]||n,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];t===r?(oe("In page link (#"+o+") not found in iFrame, so sending to parent"),Me(0,0,"inPageLink","#"+o)):function(t){var n=e(t);oe("Moving to in page link (#"+o+") at x: "+n.x+" y: "+n.y),Me(n.y,n.x,"scrollToOffset")}(r)}function o(){var e=window.location.hash,t=window.location.href;""!==e&&"#"!==e&&n(t)}return v.enable?Array.prototype.forEach&&document.querySelectorAll?(oe("Setting up location.hash handlers"),Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),(function(e){"#"!==e.getAttribute("href")&&ee(e,"click",(function(e){e.preventDefault(),n(this.getAttribute("href"))}))})),ee(window,"hashchange",o),setTimeout(o,d)):ie("In page linking not fully supported in this browser! (See README.md for IE8 workaround)"):oe("In page linking not enabled"),{findTarget:n}}(),Te("init","Init message from host page"),D()}function ae(e){var t=e.split("Callback");if(2===t.length){var n="on"+t[0].charAt(0).toUpperCase()+t[0].slice(1);this[n]=this[e],delete this[e],ie("Deprecated: '"+e+"' has been renamed '"+n+"'. The old method will be removed in the next major version.")}}function ce(e,n){t!==n&&""!==n&&"null"!==n&&(document.body.style[e]=n,oe("Body "+e+' set to "'+n+'"'))}function se(e){var t={add:function(t){function n(){Te(e.eventName,e.eventType)}H[t]=n,ee(window,t,n,{passive:!0})},remove:function(e){var t,n,o=H[e];delete H[e],t=e,n=o,window.removeEventListener(t,n,!1)}};e.eventNames&&Array.prototype.map?(e.eventName=e.eventNames[0],e.eventNames.map(t[e.method])):t[e.method](e.eventName),oe(te(e.method)+" event listener: "+e.eventType)}function ue(e){se({method:e,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]}),se({method:e,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]}),se({method:e,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]}),se({method:e,eventType:"Input",eventName:"input"}),se({method:e,eventType:"Mouse Up",eventName:"mouseup"}),se({method:e,eventType:"Mouse Down",eventName:"mousedown"}),se({method:e,eventType:"Orientation Change",eventName:"orientationchange"}),se({method:e,eventType:"Print",eventNames:["afterprint","beforeprint"]}),se({method:e,eventType:"Ready State Change",eventName:"readystatechange"}),se({method:e,eventType:"Touch Start",eventName:"touchstart"}),se({method:e,eventType:"Touch End",eventName:"touchend"}),se({method:e,eventType:"Touch Cancel",eventName:"touchcancel"}),se({method:e,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]}),se({method:e,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]}),se({method:e,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]}),"child"===M&&se({method:e,eventType:"IFrame Resized",eventName:"resize"})}function de(e,t,n,o){return t!==e&&(e in n||(ie(e+" is not a valid option for "+o+"CalculationMethod."),e=t),oe(o+' calculation method set to "'+e+'"')),e}function le(){p=de(p,f,Q,"height")}function me(){P=de(P,R,$,"width")}function fe(){var e;!0===n?(ue("add"),e=0>y,window.MutationObserver||window.WebKitMutationObserver?e?pe():a=function(){function e(e){function t(e){!1===e.complete&&(oe("Attach listeners to "+e.src),e.addEventListener("load",o,!1),e.addEventListener("error",i,!1),a.push(e))}"attributes"===e.type&&"src"===e.attributeName?t(e.target):"childList"===e.type&&Array.prototype.forEach.call(e.target.querySelectorAll("img"),t)}function t(e){oe("Remove listeners from "+e.src),e.removeEventListener("load",o,!1),e.removeEventListener("error",i,!1),function(e){a.splice(a.indexOf(e),1)}(e)}function n(e,n,o){t(e.target),Te(n,o+": "+e.target.src)}function o(e){n(e,"imageLoad","Image loaded")}function i(e){n(e,"imageLoadFailed","Image load failed")}function r(t){Te("mutationObserver","mutationObserver: "+t[0].target+" "+t[0].type),t.forEach(e)}var a=[],c=window.MutationObserver||window.WebKitMutationObserver,s=function(){var e=document.querySelector("body");return s=new c(r),oe("Create body MutationObserver"),s.observe(e,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}),s}();return{disconnect:function(){"disconnect"in s&&(oe("Disconnect body MutationObserver"),s.disconnect(),a.forEach(t))}}}():(oe("MutationObserver not supported in this browser!"),pe())):oe("Auto Resize disabled")}function pe(){0!==y&&(oe("setInterval: "+y+"ms"),w=setInterval((function(){Te("interval","setInterval: "+y)}),Math.abs(y)))}function ge(e,t){var n=0;return t=t||document.body,n=null===(n=document.defaultView.getComputedStyle(t,null))?0:n[e],parseInt(n,10)}function he(e,t){for(var n=t.length,o=0,i=0,r=te(e),a=Date.now(),c=0;ci&&(i=o);return a=Date.now()-a,oe("Parsed "+n+" HTML elements"),oe("Element position calculated in "+a+"ms"),function(e){e>k/2&&oe("Event throttle increased to "+(k=2*e)+"ms")}(a),i}function ve(e){return[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll()]}function ye(e,t){var n=document.querySelectorAll("["+t+"]");return 0===n.length&&(ie("No tagged elements ("+t+") found on page"),document.querySelectorAll("body *")),he(e,n)}function we(){return document.querySelectorAll("body *")}function be(e,n,o,i){var r,a;!function(){function e(e,t){return!(Math.abs(e-t)<=x)}return r=t===o?Q[p]():o,a=t===i?$[P]():i,e(m,r)||s&&e(z,a)}()&&"init"!==e?!(e in{init:1,interval:1,size:1})&&(p in S||s&&P in S)?Se(n):e in{interval:1}||oe("No change in size detected"):(Ee(),Me(m=r,z=a,e))}function Te(e,t,n,o){A&&e in u?oe("Trigger event cancelled: "+e):(e in{reset:1,resetPage:1,init:1}||oe("Trigger event: "+t),"init"===e?be(e,t,n,o):G(e,t,n,o))}function Ee(){A||(A=!0,oe("Trigger event lock on")),clearTimeout(C),C=setTimeout((function(){A=!1,oe("Trigger event lock off"),oe("--")}),d)}function Oe(e){m=Q[p](),z=$[P](),Me(m,z,e)}function Se(e){var t=p;p=f,oe("Reset trigger event: "+e),Ee(),Oe("reset"),p=t}function Me(e,n,o,i,r){var a;t===r?r=N:oe("Message targetOrigin: "+r),oe("Sending message to host page ("+(a=O+":"+e+":"+n+":"+o+(t===i?"":":"+i))+")"),I.postMessage(E+a,r)}function Ie(n){var o,i={init:function(){h=n.data,I=n.source,re(),l=!1,setTimeout((function(){g=!1}),d)},reset:function(){g?oe("Page reset ignored by init"):(oe("Page size reset by host page"),Oe("resetPage"))},resize:function(){Te("resizeParent","Parent window requested size check")},moveToAnchor:function(){v.findTarget(a())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var e=a();oe("PageInfoFromParent called from parent: "+e),j(JSON.parse(e)),oe(" --")},message:function(){var e=a();oe("onMessage called from parent: "+e),L(JSON.parse(e)),oe(" --")}};function r(){return n.data.split("]")[1].split(":")[0]}function a(){return n.data.slice(n.data.indexOf(":")+1)}function c(){return n.data.split(":")[2]in{true:1,false:1}}E===(""+n.data).slice(0,13)&&(!1===l?(o=r())in i?i[o]():!e.exports&&"iFrameResize"in window||window.jQuery!==t&&"iFrameResize"in window.jQuery.prototype||c()||ie("Unexpected message ("+n.data+")"):c()?i.init():oe('Ignored message of type "'+r()+'". Received before initialization.'))}function Ne(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}}()}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";n(424);const e=flarum.reg.get("core","common/extend"),t=flarum.reg.get("core","forum/app");var o=n.n(t);const i=flarum.reg.get("core","common/utils/Stream");var r=n.n(i);const a=flarum.reg.get("core","forum/ForumApplication");var c=n.n(a);const s=flarum.reg.get("core","common/components/ModalManager");var u=n.n(s);const d=flarum.reg.get("core","forum/components/PostMeta");var l=n.n(d);const f=flarum.reg.get("core","forum/components/DiscussionPage");var p=n.n(f);(0,e.extend)(c().prototype,"mount",(function(){m.route.param("hideFirstPost")&&(0,e.extend)("flarum/forum/components/PostStream","view",(e=>{1===e.children[0].attrs["data-number"]&&e.children.splice(0,1)}))})),(0,e.override)(m.route.Link,"view",(function(e,t){return t.attrs.href=t.attrs.href.replace("/embed","/d"),t.attrs.target="_blank",e(t)})),(0,e.override)(l().prototype,"getPermalink",((e,t)=>e(t).replace("/embed","/d"))),o().pageInfo=r()({});const g=function(){const e=o().pageInfo();this.$().css("top",Math.max(0,e.scrollTop-e.offsetTop))};(0,e.extend)(u().prototype,"show",g),(0,e.extend)("flarum/forum/components/Composer","show",g),window.iFrameResizer={readyCallback:function(){window.parentIFrame.getPageInfo(o().pageInfo)}},(0,e.extend)("flarum/forum/components/PostStream","goToNumber",(function(e,t){if("reply"===t&&"parentIFrame"in window&&o().composer.isFullScreen()){const e=this.$(".PostStream-item:last").offset().top;window.parentIFrame.scrollToOffset(0,e)}})),(0,e.extend)(p().prototype,"sidebarItems",(function(e){e.remove("scrubber");const t=this.discussion.replyCount();e.add("replies",m("h3",null,m("a",{route:o().route.discussion(this.discussion).replace("/embed","/d")},t," comment",1==t?"":"s")),100);const n=e.get("controls").attrs;n.className=n.className.replace("App-primaryControl","")})),o().routes.discussion={path:"/embed/:id",component:p()},o().routes["discussion.near"]={path:"/embed/:id/:near",component:p()}})(),module.exports={}})(); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/extensions/embed/js/dist/forum.js.map b/extensions/embed/js/dist/forum.js.map index 2060f4e6cc..770be9c6ec 100644 --- a/extensions/embed/js/dist/forum.js.map +++ b/extensions/embed/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"file":"forum.js","mappings":"sBAWC,SAAWA,GACV,GAAsB,oBAAXC,OAAX,CAEA,IAAIC,GAAa,EAEfC,EAAiB,GACjBC,EAAa,EACbC,EAAgB,GAChBC,EAAe,KACfC,EAAc,GACdC,GAAiB,EACjBC,EAAkB,CAAEC,OAAQ,EAAGC,MAAO,GACtCC,EAAmB,IACnBC,GAAW,EACXC,EAAS,EACTC,EAAwB,aACxBC,EAAiBD,EACjBE,GAAW,EACXC,EAAU,GACVC,EAAc,CAAC,EACfC,EAAW,GACXC,EAAgB,KAChBC,GAAU,EACVC,GAAc,EACdC,EAAQ,gBACRC,EAAWD,EAAME,OACjBC,EAAO,GACPC,EAAuB,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CACF,KAEA5B,EAAAA,EAAAA,QAAO6B,IAAAA,UAA0B,gBAAgB,SAAUC,GACzDA,EAAMvH,OAAO,YAEb,MAAMwH,EAAQ5Q,KAAK6Q,WAAWC,aAE9BH,EAAM3H,IACJ,UACA+F,EAAA,UACEA,EAAA,KAAGC,MAAOa,IAAAA,MAAAA,WAAqB7P,KAAK6Q,YAAYnB,QAAQ,SAAU,OAC/DkB,EAAM,WAAkB,GAATA,EAAa,GAAK,MAGtC,KAGF,MAAMvB,EAAQsB,EAAMhT,IAAI,YAAY0R,MACpCA,EAAM0B,UAAY1B,EAAM0B,UAAUrB,QAAQ,qBAAsB,GAClE,IAEAG,IAAAA,OAAAA,WAA2B,CAAEmB,KAAM,aAAcC,UAAWP,KAC5Db,IAAAA,OAAAA,mBAAgC,CAAEmB,KAAM,mBAAoBC,UAAWP,I","sources":["webpack://@flarum/embed/../../../node_modules/iframe-resizer/js/iframeResizer.contentWindow.js","webpack://@flarum/embed/webpack/bootstrap","webpack://@flarum/embed/webpack/runtime/compat get default export","webpack://@flarum/embed/webpack/runtime/define property getters","webpack://@flarum/embed/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/embed/webpack/runtime/make namespace object","webpack://@flarum/embed/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/embed/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/embed/external root \"flarum.core.compat['common/utils/Stream']\"","webpack://@flarum/embed/external root \"flarum.core.compat['forum/ForumApplication']\"","webpack://@flarum/embed/external root \"flarum.core.compat['forum/components/Composer']\"","webpack://@flarum/embed/external root \"flarum.core.compat['forum/components/PostStream']\"","webpack://@flarum/embed/external root \"flarum.core.compat['common/components/ModalManager']\"","webpack://@flarum/embed/external root \"flarum.core.compat['forum/components/PostMeta']\"","webpack://@flarum/embed/external root \"flarum.core.compat['forum/components/DiscussionPage']\"","webpack://@flarum/embed/./src/forum/index.js"],"sourcesContent":["/*\n * File: iframeResizer.contentWindow.js\n * Desc: Include this file in any page being loaded into an iframe\n * to force the iframe to resize to the content size.\n * Requires: iframeResizer.js on host page.\n * Doc: https://github.com/davidjbradshaw/iframe-resizer\n * Author: David J. Bradshaw - dave@bradshaw.net\n *\n */\n\n// eslint-disable-next-line sonarjs/cognitive-complexity, no-shadow-restricted-names\n;(function (undefined) {\n if (typeof window === 'undefined') return // don't run for server side render\n\n var autoResize = true,\n base = 10,\n bodyBackground = '',\n bodyMargin = 0,\n bodyMarginStr = '',\n bodyObserver = null,\n bodyPadding = '',\n calculateWidth = false,\n doubleEventList = { resize: 1, click: 1 },\n eventCancelTimer = 128,\n firstRun = true,\n height = 1,\n heightCalcModeDefault = 'bodyOffset',\n heightCalcMode = heightCalcModeDefault,\n initLock = true,\n initMsg = '',\n inPageLinks = {},\n interval = 32,\n intervalTimer = null,\n logging = false,\n mouseEvents = false,\n msgID = '[iFrameSizer]', // Must match host page msg ID\n msgIdLen = msgID.length,\n myID = '',\n resetRequiredMethods = {\n max: 1,\n min: 1,\n bodyScroll: 1,\n documentElementScroll: 1\n },\n resizeFrom = 'child',\n sendPermit = true,\n target = window.parent,\n targetOriginDefault = '*',\n tolerance = 0,\n triggerLocked = false,\n triggerLockedTimer = null,\n throttledTimer = 16,\n width = 1,\n widthCalcModeDefault = 'scroll',\n widthCalcMode = widthCalcModeDefault,\n win = window,\n onMessage = function () {\n warn('onMessage function not defined')\n },\n onReady = function () {},\n onPageInfo = function () {},\n customCalcMethods = {\n height: function () {\n warn('Custom height calculation function not defined')\n return document.documentElement.offsetHeight\n },\n width: function () {\n warn('Custom width calculation function not defined')\n return document.body.scrollWidth\n }\n },\n eventHandlersByName = {},\n passiveSupported = false\n\n function noop() {}\n\n try {\n var options = Object.create(\n {},\n {\n passive: {\n get: function () {\n passiveSupported = true\n }\n }\n }\n )\n window.addEventListener('test', noop, options)\n window.removeEventListener('test', noop, options)\n } catch (error) {\n /* */\n }\n\n function addEventListener(el, evt, func, options) {\n el.addEventListener(evt, func, passiveSupported ? options || {} : false)\n }\n\n function removeEventListener(el, evt, func) {\n el.removeEventListener(evt, func, false)\n }\n\n function capitalizeFirstLetter(string) {\n return string.charAt(0).toUpperCase() + string.slice(1)\n }\n\n // Based on underscore.js\n function throttle(func) {\n var context,\n args,\n result,\n timeout = null,\n previous = 0,\n later = function () {\n previous = Date.now()\n timeout = null\n result = func.apply(context, args)\n if (!timeout) {\n // eslint-disable-next-line no-multi-assign\n context = args = null\n }\n }\n\n return function () {\n var now = Date.now()\n\n if (!previous) {\n previous = now\n }\n\n var remaining = throttledTimer - (now - previous)\n\n context = this\n args = arguments\n\n if (remaining <= 0 || remaining > throttledTimer) {\n if (timeout) {\n clearTimeout(timeout)\n timeout = null\n }\n\n previous = now\n result = func.apply(context, args)\n\n if (!timeout) {\n // eslint-disable-next-line no-multi-assign\n context = args = null\n }\n } else if (!timeout) {\n timeout = setTimeout(later, remaining)\n }\n\n return result\n }\n }\n\n function formatLogMsg(msg) {\n return msgID + '[' + myID + '] ' + msg\n }\n\n function log(msg) {\n if (logging && 'object' === typeof window.console) {\n // eslint-disable-next-line no-console\n console.log(formatLogMsg(msg))\n }\n }\n\n function warn(msg) {\n if ('object' === typeof window.console) {\n // eslint-disable-next-line no-console\n console.warn(formatLogMsg(msg))\n }\n }\n\n function init() {\n readDataFromParent()\n log('Initialising iFrame (' + window.location.href + ')')\n readDataFromPage()\n setMargin()\n setBodyStyle('background', bodyBackground)\n setBodyStyle('padding', bodyPadding)\n injectClearFixIntoBodyElement()\n checkHeightMode()\n checkWidthMode()\n stopInfiniteResizingOfIFrame()\n setupPublicMethods()\n setupMouseEvents()\n startEventListeners()\n inPageLinks = setupInPageLinks()\n sendSize('init', 'Init message from host page')\n onReady()\n }\n\n function readDataFromParent() {\n function strBool(str) {\n return 'true' === str\n }\n\n var data = initMsg.substr(msgIdLen).split(':')\n\n myID = data[0]\n bodyMargin = undefined !== data[1] ? Number(data[1]) : bodyMargin // For V1 compatibility\n calculateWidth = undefined !== data[2] ? strBool(data[2]) : calculateWidth\n logging = undefined !== data[3] ? strBool(data[3]) : logging\n interval = undefined !== data[4] ? Number(data[4]) : interval\n autoResize = undefined !== data[6] ? strBool(data[6]) : autoResize\n bodyMarginStr = data[7]\n heightCalcMode = undefined !== data[8] ? data[8] : heightCalcMode\n bodyBackground = data[9]\n bodyPadding = data[10]\n tolerance = undefined !== data[11] ? Number(data[11]) : tolerance\n inPageLinks.enable = undefined !== data[12] ? strBool(data[12]) : false\n resizeFrom = undefined !== data[13] ? data[13] : resizeFrom\n widthCalcMode = undefined !== data[14] ? data[14] : widthCalcMode\n mouseEvents = undefined !== data[15] ? Boolean(data[15]) : mouseEvents\n }\n\n function depricate(key) {\n var splitName = key.split('Callback')\n\n if (splitName.length === 2) {\n var name =\n 'on' + splitName[0].charAt(0).toUpperCase() + splitName[0].slice(1)\n this[name] = this[key]\n delete this[key]\n warn(\n \"Deprecated: '\" +\n key +\n \"' has been renamed '\" +\n name +\n \"'. The old method will be removed in the next major version.\"\n )\n }\n }\n\n function readDataFromPage() {\n function readData() {\n var data = window.iFrameResizer\n\n log('Reading data from page: ' + JSON.stringify(data))\n Object.keys(data).forEach(depricate, data)\n\n onMessage = 'onMessage' in data ? data.onMessage : onMessage\n onReady = 'onReady' in data ? data.onReady : onReady\n targetOriginDefault =\n 'targetOrigin' in data ? data.targetOrigin : targetOriginDefault\n heightCalcMode =\n 'heightCalculationMethod' in data\n ? data.heightCalculationMethod\n : heightCalcMode\n widthCalcMode =\n 'widthCalculationMethod' in data\n ? data.widthCalculationMethod\n : widthCalcMode\n }\n\n function setupCustomCalcMethods(calcMode, calcFunc) {\n if ('function' === typeof calcMode) {\n log('Setup custom ' + calcFunc + 'CalcMethod')\n customCalcMethods[calcFunc] = calcMode\n calcMode = 'custom'\n }\n\n return calcMode\n }\n\n if (\n 'iFrameResizer' in window &&\n Object === window.iFrameResizer.constructor\n ) {\n readData()\n heightCalcMode = setupCustomCalcMethods(heightCalcMode, 'height')\n widthCalcMode = setupCustomCalcMethods(widthCalcMode, 'width')\n }\n\n log('TargetOrigin for parent set to: ' + targetOriginDefault)\n }\n\n function chkCSS(attr, value) {\n if (-1 !== value.indexOf('-')) {\n warn('Negative CSS value ignored for ' + attr)\n value = ''\n }\n return value\n }\n\n function setBodyStyle(attr, value) {\n if (undefined !== value && '' !== value && 'null' !== value) {\n document.body.style[attr] = value\n log('Body ' + attr + ' set to \"' + value + '\"')\n }\n }\n\n function setMargin() {\n // If called via V1 script, convert bodyMargin from int to str\n if (undefined === bodyMarginStr) {\n bodyMarginStr = bodyMargin + 'px'\n }\n\n setBodyStyle('margin', chkCSS('margin', bodyMarginStr))\n }\n\n function stopInfiniteResizingOfIFrame() {\n document.documentElement.style.height = ''\n document.body.style.height = ''\n log('HTML & body height set to \"auto\"')\n }\n\n function manageTriggerEvent(options) {\n var listener = {\n add: function (eventName) {\n function handleEvent() {\n sendSize(options.eventName, options.eventType)\n }\n\n eventHandlersByName[eventName] = handleEvent\n\n addEventListener(window, eventName, handleEvent, { passive: true })\n },\n remove: function (eventName) {\n var handleEvent = eventHandlersByName[eventName]\n delete eventHandlersByName[eventName]\n\n removeEventListener(window, eventName, handleEvent)\n }\n }\n\n if (options.eventNames && Array.prototype.map) {\n options.eventName = options.eventNames[0]\n options.eventNames.map(listener[options.method])\n } else {\n listener[options.method](options.eventName)\n }\n\n log(\n capitalizeFirstLetter(options.method) +\n ' event listener: ' +\n options.eventType\n )\n }\n\n function manageEventListeners(method) {\n manageTriggerEvent({\n method: method,\n eventType: 'Animation Start',\n eventNames: ['animationstart', 'webkitAnimationStart']\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Animation Iteration',\n eventNames: ['animationiteration', 'webkitAnimationIteration']\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Animation End',\n eventNames: ['animationend', 'webkitAnimationEnd']\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Input',\n eventName: 'input'\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Mouse Up',\n eventName: 'mouseup'\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Mouse Down',\n eventName: 'mousedown'\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Orientation Change',\n eventName: 'orientationchange'\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Print',\n eventName: ['afterprint', 'beforeprint']\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Ready State Change',\n eventName: 'readystatechange'\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Touch Start',\n eventName: 'touchstart'\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Touch End',\n eventName: 'touchend'\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Touch Cancel',\n eventName: 'touchcancel'\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Transition Start',\n eventNames: [\n 'transitionstart',\n 'webkitTransitionStart',\n 'MSTransitionStart',\n 'oTransitionStart',\n 'otransitionstart'\n ]\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Transition Iteration',\n eventNames: [\n 'transitioniteration',\n 'webkitTransitionIteration',\n 'MSTransitionIteration',\n 'oTransitionIteration',\n 'otransitioniteration'\n ]\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Transition End',\n eventNames: [\n 'transitionend',\n 'webkitTransitionEnd',\n 'MSTransitionEnd',\n 'oTransitionEnd',\n 'otransitionend'\n ]\n })\n if ('child' === resizeFrom) {\n manageTriggerEvent({\n method: method,\n eventType: 'IFrame Resized',\n eventName: 'resize'\n })\n }\n }\n\n function checkCalcMode(calcMode, calcModeDefault, modes, type) {\n if (calcModeDefault !== calcMode) {\n if (!(calcMode in modes)) {\n warn(\n calcMode + ' is not a valid option for ' + type + 'CalculationMethod.'\n )\n calcMode = calcModeDefault\n }\n log(type + ' calculation method set to \"' + calcMode + '\"')\n }\n\n return calcMode\n }\n\n function checkHeightMode() {\n heightCalcMode = checkCalcMode(\n heightCalcMode,\n heightCalcModeDefault,\n getHeight,\n 'height'\n )\n }\n\n function checkWidthMode() {\n widthCalcMode = checkCalcMode(\n widthCalcMode,\n widthCalcModeDefault,\n getWidth,\n 'width'\n )\n }\n\n function startEventListeners() {\n if (true === autoResize) {\n manageEventListeners('add')\n setupMutationObserver()\n } else {\n log('Auto Resize disabled')\n }\n }\n\n // function stopMsgsToParent() {\n // log('Disable outgoing messages')\n // sendPermit = false\n // }\n\n // function removeMsgListener() {\n // log('Remove event listener: Message')\n // removeEventListener(window, 'message', receiver)\n // }\n\n function disconnectMutationObserver() {\n if (null !== bodyObserver) {\n /* istanbul ignore next */ // Not testable in PhantonJS\n bodyObserver.disconnect()\n }\n }\n\n function stopEventListeners() {\n manageEventListeners('remove')\n disconnectMutationObserver()\n clearInterval(intervalTimer)\n }\n\n // function teardown() {\n // stopMsgsToParent()\n // removeMsgListener()\n // if (true === autoResize) stopEventListeners()\n // }\n\n function injectClearFixIntoBodyElement() {\n var clearFix = document.createElement('div')\n clearFix.style.clear = 'both'\n // Guard against the following having been globally redefined in CSS.\n clearFix.style.display = 'block'\n clearFix.style.height = '0'\n document.body.appendChild(clearFix)\n }\n\n function setupInPageLinks() {\n function getPagePosition() {\n return {\n x:\n window.pageXOffset !== undefined\n ? window.pageXOffset\n : document.documentElement.scrollLeft,\n y:\n window.pageYOffset !== undefined\n ? window.pageYOffset\n : document.documentElement.scrollTop\n }\n }\n\n function getElementPosition(el) {\n var elPosition = el.getBoundingClientRect(),\n pagePosition = getPagePosition()\n\n return {\n x: parseInt(elPosition.left, 10) + parseInt(pagePosition.x, 10),\n y: parseInt(elPosition.top, 10) + parseInt(pagePosition.y, 10)\n }\n }\n\n function findTarget(location) {\n function jumpToTarget(target) {\n var jumpPosition = getElementPosition(target)\n\n log(\n 'Moving to in page link (#' +\n hash +\n ') at x: ' +\n jumpPosition.x +\n ' y: ' +\n jumpPosition.y\n )\n sendMsg(jumpPosition.y, jumpPosition.x, 'scrollToOffset') // X&Y reversed at sendMsg uses height/width\n }\n\n var hash = location.split('#')[1] || location, // Remove # if present\n hashData = decodeURIComponent(hash),\n target =\n document.getElementById(hashData) ||\n document.getElementsByName(hashData)[0]\n\n if (undefined !== target) {\n jumpToTarget(target)\n } else {\n log(\n 'In page link (#' +\n hash +\n ') not found in iFrame, so sending to parent'\n )\n sendMsg(0, 0, 'inPageLink', '#' + hash)\n }\n }\n\n function checkLocationHash() {\n var hash = window.location.hash\n var href = window.location.href\n\n if ('' !== hash && '#' !== hash) {\n findTarget(href)\n }\n }\n\n function bindAnchors() {\n function setupLink(el) {\n function linkClicked(e) {\n e.preventDefault()\n\n /* jshint validthis:true */\n findTarget(this.getAttribute('href'))\n }\n\n if ('#' !== el.getAttribute('href')) {\n addEventListener(el, 'click', linkClicked)\n }\n }\n\n Array.prototype.forEach.call(\n document.querySelectorAll('a[href^=\"#\"]'),\n setupLink\n )\n }\n\n function bindLocationHash() {\n addEventListener(window, 'hashchange', checkLocationHash)\n }\n\n function initCheck() {\n // Check if page loaded with location hash after init resize\n setTimeout(checkLocationHash, eventCancelTimer)\n }\n\n function enableInPageLinks() {\n /* istanbul ignore else */ // Not testable in phantonJS\n if (Array.prototype.forEach && document.querySelectorAll) {\n log('Setting up location.hash handlers')\n bindAnchors()\n bindLocationHash()\n initCheck()\n } else {\n warn(\n 'In page linking not fully supported in this browser! (See README.md for IE8 workaround)'\n )\n }\n }\n\n if (inPageLinks.enable) {\n enableInPageLinks()\n } else {\n log('In page linking not enabled')\n }\n\n return {\n findTarget: findTarget\n }\n }\n\n function setupMouseEvents() {\n if (mouseEvents !== true) return\n\n function sendMouse(e) {\n sendMsg(0, 0, e.type, e.screenY + ':' + e.screenX)\n }\n\n function addMouseListener(evt, name) {\n log('Add event listener: ' + name)\n addEventListener(window.document, evt, sendMouse)\n }\n\n addMouseListener('mouseenter', 'Mouse Enter')\n addMouseListener('mouseleave', 'Mouse Leave')\n }\n\n function setupPublicMethods() {\n log('Enable public methods')\n\n win.parentIFrame = {\n autoResize: function autoResizeF(resize) {\n if (true === resize && false === autoResize) {\n autoResize = true\n startEventListeners()\n } else if (false === resize && true === autoResize) {\n autoResize = false\n stopEventListeners()\n }\n sendMsg(0, 0, 'autoResize', JSON.stringify(autoResize))\n return autoResize\n },\n\n close: function closeF() {\n sendMsg(0, 0, 'close')\n // teardown()\n },\n\n getId: function getIdF() {\n return myID\n },\n\n getPageInfo: function getPageInfoF(callback) {\n if ('function' === typeof callback) {\n onPageInfo = callback\n sendMsg(0, 0, 'pageInfo')\n } else {\n onPageInfo = function () {}\n sendMsg(0, 0, 'pageInfoStop')\n }\n },\n\n moveToAnchor: function moveToAnchorF(hash) {\n inPageLinks.findTarget(hash)\n },\n\n reset: function resetF() {\n resetIFrame('parentIFrame.reset')\n },\n\n scrollTo: function scrollToF(x, y) {\n sendMsg(y, x, 'scrollTo') // X&Y reversed at sendMsg uses height/width\n },\n\n scrollToOffset: function scrollToF(x, y) {\n sendMsg(y, x, 'scrollToOffset') // X&Y reversed at sendMsg uses height/width\n },\n\n sendMessage: function sendMessageF(msg, targetOrigin) {\n sendMsg(0, 0, 'message', JSON.stringify(msg), targetOrigin)\n },\n\n setHeightCalculationMethod: function setHeightCalculationMethodF(\n heightCalculationMethod\n ) {\n heightCalcMode = heightCalculationMethod\n checkHeightMode()\n },\n\n setWidthCalculationMethod: function setWidthCalculationMethodF(\n widthCalculationMethod\n ) {\n widthCalcMode = widthCalculationMethod\n checkWidthMode()\n },\n\n setTargetOrigin: function setTargetOriginF(targetOrigin) {\n log('Set targetOrigin: ' + targetOrigin)\n targetOriginDefault = targetOrigin\n },\n\n size: function sizeF(customHeight, customWidth) {\n var valString =\n '' + (customHeight || '') + (customWidth ? ',' + customWidth : '')\n sendSize(\n 'size',\n 'parentIFrame.size(' + valString + ')',\n customHeight,\n customWidth\n )\n }\n }\n }\n\n function initInterval() {\n if (0 !== interval) {\n log('setInterval: ' + interval + 'ms')\n intervalTimer = setInterval(function () {\n sendSize('interval', 'setInterval: ' + interval)\n }, Math.abs(interval))\n }\n }\n\n // Not testable in PhantomJS\n /* istanbul ignore next */\n function setupBodyMutationObserver() {\n function addImageLoadListners(mutation) {\n function addImageLoadListener(element) {\n if (false === element.complete) {\n log('Attach listeners to ' + element.src)\n element.addEventListener('load', imageLoaded, false)\n element.addEventListener('error', imageError, false)\n elements.push(element)\n }\n }\n\n if (mutation.type === 'attributes' && mutation.attributeName === 'src') {\n addImageLoadListener(mutation.target)\n } else if (mutation.type === 'childList') {\n Array.prototype.forEach.call(\n mutation.target.querySelectorAll('img'),\n addImageLoadListener\n )\n }\n }\n\n function removeFromArray(element) {\n elements.splice(elements.indexOf(element), 1)\n }\n\n function removeImageLoadListener(element) {\n log('Remove listeners from ' + element.src)\n element.removeEventListener('load', imageLoaded, false)\n element.removeEventListener('error', imageError, false)\n removeFromArray(element)\n }\n\n function imageEventTriggered(event, type, typeDesc) {\n removeImageLoadListener(event.target)\n sendSize(type, typeDesc + ': ' + event.target.src)\n }\n\n function imageLoaded(event) {\n imageEventTriggered(event, 'imageLoad', 'Image loaded')\n }\n\n function imageError(event) {\n imageEventTriggered(event, 'imageLoadFailed', 'Image load failed')\n }\n\n function mutationObserved(mutations) {\n sendSize(\n 'mutationObserver',\n 'mutationObserver: ' + mutations[0].target + ' ' + mutations[0].type\n )\n\n // Deal with WebKit / Blink asyncing image loading when tags are injected into the page\n mutations.forEach(addImageLoadListners)\n }\n\n function createMutationObserver() {\n var target = document.querySelector('body'),\n config = {\n attributes: true,\n attributeOldValue: false,\n characterData: true,\n characterDataOldValue: false,\n childList: true,\n subtree: true\n }\n\n observer = new MutationObserver(mutationObserved)\n\n log('Create body MutationObserver')\n observer.observe(target, config)\n\n return observer\n }\n\n var elements = [],\n MutationObserver =\n window.MutationObserver || window.WebKitMutationObserver,\n observer = createMutationObserver()\n\n return {\n disconnect: function () {\n if ('disconnect' in observer) {\n log('Disconnect body MutationObserver')\n observer.disconnect()\n elements.forEach(removeImageLoadListener)\n }\n }\n }\n }\n\n function setupMutationObserver() {\n var forceIntervalTimer = 0 > interval\n\n // Not testable in PhantomJS\n /* istanbul ignore if */ if (\n window.MutationObserver ||\n window.WebKitMutationObserver\n ) {\n if (forceIntervalTimer) {\n initInterval()\n } else {\n bodyObserver = setupBodyMutationObserver()\n }\n } else {\n log('MutationObserver not supported in this browser!')\n initInterval()\n }\n }\n\n // document.documentElement.offsetHeight is not reliable, so\n // we have to jump through hoops to get a better value.\n function getComputedStyle(prop, el) {\n var retVal = 0\n el = el || document.body // Not testable in phantonJS\n\n retVal = document.defaultView.getComputedStyle(el, null)\n retVal = null !== retVal ? retVal[prop] : 0\n\n return parseInt(retVal, base)\n }\n\n function chkEventThottle(timer) {\n if (timer > throttledTimer / 2) {\n throttledTimer = 2 * timer\n log('Event throttle increased to ' + throttledTimer + 'ms')\n }\n }\n\n // Idea from https://github.com/guardian/iframe-messenger\n function getMaxElement(side, elements) {\n var elementsLength = elements.length,\n elVal = 0,\n maxVal = 0,\n Side = capitalizeFirstLetter(side),\n timer = Date.now()\n\n for (var i = 0; i < elementsLength; i++) {\n elVal =\n elements[i].getBoundingClientRect()[side] +\n getComputedStyle('margin' + Side, elements[i])\n if (elVal > maxVal) {\n maxVal = elVal\n }\n }\n\n timer = Date.now() - timer\n\n log('Parsed ' + elementsLength + ' HTML elements')\n log('Element position calculated in ' + timer + 'ms')\n\n chkEventThottle(timer)\n\n return maxVal\n }\n\n function getAllMeasurements(dimensions) {\n return [\n dimensions.bodyOffset(),\n dimensions.bodyScroll(),\n dimensions.documentElementOffset(),\n dimensions.documentElementScroll()\n ]\n }\n\n function getTaggedElements(side, tag) {\n function noTaggedElementsFound() {\n warn('No tagged elements (' + tag + ') found on page')\n return document.querySelectorAll('body *')\n }\n\n var elements = document.querySelectorAll('[' + tag + ']')\n\n if (elements.length === 0) noTaggedElementsFound()\n\n return getMaxElement(side, elements)\n }\n\n function getAllElements() {\n return document.querySelectorAll('body *')\n }\n\n var getHeight = {\n bodyOffset: function getBodyOffsetHeight() {\n return (\n document.body.offsetHeight +\n getComputedStyle('marginTop') +\n getComputedStyle('marginBottom')\n )\n },\n\n offset: function () {\n return getHeight.bodyOffset() // Backwards compatability\n },\n\n bodyScroll: function getBodyScrollHeight() {\n return document.body.scrollHeight\n },\n\n custom: function getCustomWidth() {\n return customCalcMethods.height()\n },\n\n documentElementOffset: function getDEOffsetHeight() {\n return document.documentElement.offsetHeight\n },\n\n documentElementScroll: function getDEScrollHeight() {\n return document.documentElement.scrollHeight\n },\n\n max: function getMaxHeight() {\n return Math.max.apply(null, getAllMeasurements(getHeight))\n },\n\n min: function getMinHeight() {\n return Math.min.apply(null, getAllMeasurements(getHeight))\n },\n\n grow: function growHeight() {\n return getHeight.max() // Run max without the forced downsizing\n },\n\n lowestElement: function getBestHeight() {\n return Math.max(\n getHeight.bodyOffset() || getHeight.documentElementOffset(),\n getMaxElement('bottom', getAllElements())\n )\n },\n\n taggedElement: function getTaggedElementsHeight() {\n return getTaggedElements('bottom', 'data-iframe-height')\n }\n },\n getWidth = {\n bodyScroll: function getBodyScrollWidth() {\n return document.body.scrollWidth\n },\n\n bodyOffset: function getBodyOffsetWidth() {\n return document.body.offsetWidth\n },\n\n custom: function getCustomWidth() {\n return customCalcMethods.width()\n },\n\n documentElementScroll: function getDEScrollWidth() {\n return document.documentElement.scrollWidth\n },\n\n documentElementOffset: function getDEOffsetWidth() {\n return document.documentElement.offsetWidth\n },\n\n scroll: function getMaxWidth() {\n return Math.max(getWidth.bodyScroll(), getWidth.documentElementScroll())\n },\n\n max: function getMaxWidth() {\n return Math.max.apply(null, getAllMeasurements(getWidth))\n },\n\n min: function getMinWidth() {\n return Math.min.apply(null, getAllMeasurements(getWidth))\n },\n\n rightMostElement: function rightMostElement() {\n return getMaxElement('right', getAllElements())\n },\n\n taggedElement: function getTaggedElementsWidth() {\n return getTaggedElements('right', 'data-iframe-width')\n }\n }\n\n function sizeIFrame(\n triggerEvent,\n triggerEventDesc,\n customHeight,\n customWidth\n ) {\n function resizeIFrame() {\n height = currentHeight\n width = currentWidth\n\n sendMsg(height, width, triggerEvent)\n }\n\n function isSizeChangeDetected() {\n function checkTolarance(a, b) {\n var retVal = Math.abs(a - b) <= tolerance\n return !retVal\n }\n\n currentHeight =\n undefined !== customHeight ? customHeight : getHeight[heightCalcMode]()\n currentWidth =\n undefined !== customWidth ? customWidth : getWidth[widthCalcMode]()\n\n return (\n checkTolarance(height, currentHeight) ||\n (calculateWidth && checkTolarance(width, currentWidth))\n )\n }\n\n function isForceResizableEvent() {\n return !(triggerEvent in { init: 1, interval: 1, size: 1 })\n }\n\n function isForceResizableCalcMode() {\n return (\n heightCalcMode in resetRequiredMethods ||\n (calculateWidth && widthCalcMode in resetRequiredMethods)\n )\n }\n\n function logIgnored() {\n log('No change in size detected')\n }\n\n function checkDownSizing() {\n if (isForceResizableEvent() && isForceResizableCalcMode()) {\n resetIFrame(triggerEventDesc)\n } else if (!(triggerEvent in { interval: 1 })) {\n logIgnored()\n }\n }\n\n var currentHeight, currentWidth\n\n if (isSizeChangeDetected() || 'init' === triggerEvent) {\n lockTrigger()\n resizeIFrame()\n } else {\n checkDownSizing()\n }\n }\n\n var sizeIFrameThrottled = throttle(sizeIFrame)\n\n function sendSize(triggerEvent, triggerEventDesc, customHeight, customWidth) {\n function recordTrigger() {\n if (!(triggerEvent in { reset: 1, resetPage: 1, init: 1 })) {\n log('Trigger event: ' + triggerEventDesc)\n }\n }\n\n function isDoubleFiredEvent() {\n return triggerLocked && triggerEvent in doubleEventList\n }\n\n if (!isDoubleFiredEvent()) {\n recordTrigger()\n if (triggerEvent === 'init') {\n sizeIFrame(triggerEvent, triggerEventDesc, customHeight, customWidth)\n } else {\n sizeIFrameThrottled(\n triggerEvent,\n triggerEventDesc,\n customHeight,\n customWidth\n )\n }\n } else {\n log('Trigger event cancelled: ' + triggerEvent)\n }\n }\n\n function lockTrigger() {\n if (!triggerLocked) {\n triggerLocked = true\n log('Trigger event lock on')\n }\n clearTimeout(triggerLockedTimer)\n triggerLockedTimer = setTimeout(function () {\n triggerLocked = false\n log('Trigger event lock off')\n log('--')\n }, eventCancelTimer)\n }\n\n function triggerReset(triggerEvent) {\n height = getHeight[heightCalcMode]()\n width = getWidth[widthCalcMode]()\n\n sendMsg(height, width, triggerEvent)\n }\n\n function resetIFrame(triggerEventDesc) {\n var hcm = heightCalcMode\n heightCalcMode = heightCalcModeDefault\n\n log('Reset trigger event: ' + triggerEventDesc)\n lockTrigger()\n triggerReset('reset')\n\n heightCalcMode = hcm\n }\n\n function sendMsg(height, width, triggerEvent, msg, targetOrigin) {\n function setTargetOrigin() {\n if (undefined === targetOrigin) {\n targetOrigin = targetOriginDefault\n } else {\n log('Message targetOrigin: ' + targetOrigin)\n }\n }\n\n function sendToParent() {\n var size = height + ':' + width,\n message =\n myID +\n ':' +\n size +\n ':' +\n triggerEvent +\n (undefined !== msg ? ':' + msg : '')\n\n log('Sending message to host page (' + message + ')')\n target.postMessage(msgID + message, targetOrigin)\n }\n\n if (true === sendPermit) {\n setTargetOrigin()\n sendToParent()\n }\n }\n\n function receiver(event) {\n var processRequestFromParent = {\n init: function initFromParent() {\n initMsg = event.data\n target = event.source\n\n init()\n firstRun = false\n setTimeout(function () {\n initLock = false\n }, eventCancelTimer)\n },\n\n reset: function resetFromParent() {\n if (!initLock) {\n log('Page size reset by host page')\n triggerReset('resetPage')\n } else {\n log('Page reset ignored by init')\n }\n },\n\n resize: function resizeFromParent() {\n sendSize('resizeParent', 'Parent window requested size check')\n },\n\n moveToAnchor: function moveToAnchorF() {\n inPageLinks.findTarget(getData())\n },\n inPageLink: function inPageLinkF() {\n this.moveToAnchor()\n }, // Backward compatability\n\n pageInfo: function pageInfoFromParent() {\n var msgBody = getData()\n log('PageInfoFromParent called from parent: ' + msgBody)\n onPageInfo(JSON.parse(msgBody))\n log(' --')\n },\n\n message: function messageFromParent() {\n var msgBody = getData()\n\n log('onMessage called from parent: ' + msgBody)\n // eslint-disable-next-line sonarjs/no-extra-arguments\n onMessage(JSON.parse(msgBody))\n log(' --')\n }\n }\n\n function isMessageForUs() {\n return msgID === ('' + event.data).substr(0, msgIdLen) // ''+ Protects against non-string messages\n }\n\n function getMessageType() {\n return event.data.split(']')[1].split(':')[0]\n }\n\n function getData() {\n return event.data.substr(event.data.indexOf(':') + 1)\n }\n\n function isMiddleTier() {\n return (\n (!(typeof module !== 'undefined' && module.exports) &&\n 'iFrameResize' in window) ||\n ('jQuery' in window && 'iFrameResize' in window.jQuery.prototype)\n )\n }\n\n function isInitMsg() {\n // Test if this message is from a child below us. This is an ugly test, however, updating\n // the message format would break backwards compatibity.\n return event.data.split(':')[2] in { true: 1, false: 1 }\n }\n\n function callFromParent() {\n var messageType = getMessageType()\n\n if (messageType in processRequestFromParent) {\n processRequestFromParent[messageType]()\n } else if (!isMiddleTier() && !isInitMsg()) {\n warn('Unexpected message (' + event.data + ')')\n }\n }\n\n function processMessage() {\n if (false === firstRun) {\n callFromParent()\n } else if (isInitMsg()) {\n processRequestFromParent.init()\n } else {\n log(\n 'Ignored message of type \"' +\n getMessageType() +\n '\". Received before initialization.'\n )\n }\n }\n\n if (isMessageForUs()) {\n processMessage()\n }\n }\n\n // Normally the parent kicks things off when it detects the iFrame has loaded.\n // If this script is async-loaded, then tell parent page to retry init.\n function chkLateLoaded() {\n if ('loading' !== document.readyState) {\n window.parent.postMessage('[iFrameResizerChild]Ready', '*')\n }\n }\n\n addEventListener(window, 'message', receiver)\n addEventListener(window, 'readystatechange', chkLateLoaded)\n chkLateLoaded()\n\n \n})()\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/Stream'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/ForumApplication'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/Composer'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/PostStream'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/ModalManager'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/PostMeta'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionPage'];","import 'iframe-resizer/js/iframeResizer.contentWindow.js';\n\nimport { override, extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport Stream from 'flarum/common/utils/Stream';\nimport ForumApplication from 'flarum/forum/ForumApplication';\nimport Composer from 'flarum/forum/components/Composer';\nimport PostStream from 'flarum/forum/components/PostStream';\nimport ModalManager from 'flarum/common/components/ModalManager';\nimport PostMeta from 'flarum/forum/components/PostMeta';\n\nimport DiscussionPage from 'flarum/forum/components/DiscussionPage';\n\nextend(ForumApplication.prototype, 'mount', function () {\n if (m.route.param('hideFirstPost')) {\n extend(PostStream.prototype, 'view', (vdom) => {\n if (vdom.children[0].attrs['data-number'] === 1) {\n vdom.children.splice(0, 1);\n }\n });\n }\n});\n\noverride(m.route.Link, 'view', function (original, vnode) {\n vnode.attrs.href = vnode.attrs.href.replace('/embed', '/d');\n vnode.attrs.target = '_blank';\n // TODO: If href leads to a post within this discussion that we have\n // already loaded, then scroll to it?\n return original(vnode);\n});\n\n// Trim the /embed prefix off of post permalinks\noverride(PostMeta.prototype, 'getPermalink', (original, post) => {\n return original(post).replace('/embed', '/d');\n});\n\napp.pageInfo = Stream({});\n\nconst reposition = function () {\n const info = app.pageInfo();\n this.$().css('top', Math.max(0, info.scrollTop - info.offsetTop));\n};\n\nextend(ModalManager.prototype, 'show', reposition);\nextend(Composer.prototype, 'show', reposition);\n\nwindow.iFrameResizer = {\n readyCallback: function () {\n window.parentIFrame.getPageInfo(app.pageInfo);\n },\n};\n\nextend(PostStream.prototype, 'goToNumber', function (promise, number) {\n if (number === 'reply' && 'parentIFrame' in window && app.composer.isFullScreen()) {\n const itemTop = this.$('.PostStream-item:last').offset().top;\n window.parentIFrame.scrollToOffset(0, itemTop);\n }\n});\n\nextend(DiscussionPage.prototype, 'sidebarItems', function (items) {\n items.remove('scrubber');\n\n const count = this.discussion.replyCount();\n\n items.add(\n 'replies',\n

\n \n {count} comment{count == 1 ? '' : 's'}\n \n

,\n 100\n );\n\n const attrs = items.get('controls').attrs;\n attrs.className = attrs.className.replace('App-primaryControl', '');\n});\n\napp.routes['discussion'] = { path: '/embed/:id', component: DiscussionPage };\napp.routes['discussion.near'] = { path: '/embed/:id/:near', component: DiscussionPage };\n"],"names":["undefined","window","autoResize","bodyBackground","bodyMargin","bodyMarginStr","bodyObserver","bodyPadding","calculateWidth","doubleEventList","resize","click","eventCancelTimer","firstRun","height","heightCalcModeDefault","heightCalcMode","initLock","initMsg","inPageLinks","interval","intervalTimer","logging","mouseEvents","msgID","msgIdLen","length","myID","resetRequiredMethods","max","min","bodyScroll","documentElementScroll","resizeFrom","target","parent","targetOriginDefault","tolerance","triggerLocked","triggerLockedTimer","throttledTimer","width","widthCalcModeDefault","widthCalcMode","win","onMessage","warn","onReady","onPageInfo","customCalcMethods","document","documentElement","offsetHeight","body","scrollWidth","eventHandlersByName","passiveSupported","options","Object","create","passive","get","addEventListener","noop","removeEventListener","error","func","context","args","result","timeout","previous","later","getHeight","bodyOffset","getComputedStyle","offset","scrollHeight","custom","documentElementOffset","Math","apply","getAllMeasurements","grow","lowestElement","getMaxElement","getAllElements","taggedElement","getTaggedElements","getWidth","offsetWidth","scroll","rightMostElement","sizeIFrameThrottled","sizeIFrame","Date","now","remaining","this","arguments","clearTimeout","setTimeout","event","messageType","processRequestFromParent","init","clearFix","attr","value","data","source","strBool","str","substr","split","Number","enable","Boolean","readDataFromParent","log","location","href","readData","iFrameResizer","JSON","stringify","keys","forEach","depricate","targetOrigin","heightCalculationMethod","widthCalculationMethod","setupCustomCalcMethods","calcMode","calcFunc","constructor","readDataFromPage","setBodyStyle","indexOf","createElement","style","clear","display","appendChild","checkHeightMode","checkWidthMode","parentIFrame","startEventListeners","manageEventListeners","disconnect","clearInterval","sendMsg","close","getId","getPageInfo","callback","moveToAnchor","hash","findTarget","reset","resetIFrame","scrollTo","x","y","scrollToOffset","sendMessage","msg","setHeightCalculationMethod","setWidthCalculationMethod","setTargetOrigin","size","customHeight","customWidth","sendSize","sendMouse","e","type","screenY","screenX","addMouseListener","evt","name","setupMouseEvents","getPagePosition","pageXOffset","scrollLeft","pageYOffset","scrollTop","getElementPosition","el","elPosition","getBoundingClientRect","pagePosition","parseInt","left","top","jumpToTarget","jumpPosition","hashData","decodeURIComponent","getElementById","getElementsByName","checkLocationHash","bindAnchors","setupLink","linkClicked","preventDefault","getAttribute","Array","prototype","call","querySelectorAll","bindLocationHash","initCheck","enableInPageLinks","setupInPageLinks","triggerReset","getData","inPageLink","pageInfo","msgBody","parse","message","getMessageType","isInitMsg","true","false","module","exports","jQuery","chkLateLoaded","capitalizeFirstLetter","string","charAt","toUpperCase","slice","formatLogMsg","console","key","splitName","manageTriggerEvent","listener","add","eventName","handleEvent","eventType","remove","eventNames","map","method","checkCalcMode","calcModeDefault","modes","forceIntervalTimer","MutationObserver","WebKitMutationObserver","initInterval","addImageLoadListners","mutation","addImageLoadListener","element","complete","src","imageLoaded","imageError","elements","push","attributeName","removeImageLoadListener","splice","removeFromArray","imageEventTriggered","typeDesc","mutationObserved","mutations","observer","querySelector","observe","attributes","attributeOldValue","characterData","characterDataOldValue","childList","subtree","createMutationObserver","setupBodyMutationObserver","setInterval","abs","prop","retVal","defaultView","side","elementsLength","elVal","maxVal","Side","timer","i","chkEventThottle","dimensions","tag","triggerEvent","triggerEventDesc","currentHeight","currentWidth","checkTolarance","a","b","isSizeChangeDetected","lockTrigger","resetPage","hcm","postMessage","readyState","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","n","getter","__esModule","d","definition","o","defineProperty","enumerable","obj","hasOwnProperty","r","Symbol","toStringTag","flarum","core","compat","extend","ForumApplication","m","route","param","PostStream","vdom","children","attrs","override","Link","original","vnode","replace","PostMeta","post","app","Stream","reposition","info","$","css","offsetTop","ModalManager","Composer","readyCallback","promise","number","itemTop","DiscussionPage","items","count","discussion","replyCount","className","path","component"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":"sBAWC,SAAWA,GACV,GAAsB,oBAAXC,OAAX,CAEA,IAAIC,GAAa,EAEfC,EAAiB,GACjBC,EAAa,EACbC,EAAgB,GAChBC,EAAe,KACfC,EAAc,GACdC,GAAiB,EACjBC,EAAkB,CAAEC,OAAQ,EAAGC,MAAO,GACtCC,EAAmB,IACnBC,GAAW,EACXC,EAAS,EACTC,EAAwB,aACxBC,EAAiBD,EACjBE,GAAW,EACXC,EAAU,GAC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AAO,WAAqB,GAATA,EAAa,GAAK,MAAO,KAC/C,MAAMlB,EAAQiB,EAAM/R,IAAI,YAAY8Q,MACpCA,EAAMqB,UAAYrB,EAAMqB,UAAUhB,QAAQ,qBAAsB,GAClE,IACA,WAAuB,WAAI,CACzBiB,KAAM,aACNC,UAAW,KAEb,WAAW,mBAAqB,CAC9BD,KAAM,mBACNC,UAAW,I","sources":["webpack://@flarum/embed/../../../node_modules/iframe-resizer/js/iframeResizer.contentWindow.js","webpack://@flarum/embed/webpack/bootstrap","webpack://@flarum/embed/webpack/runtime/compat get default export","webpack://@flarum/embed/webpack/runtime/define property getters","webpack://@flarum/embed/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/embed/external root \"flarum.reg.get('core', 'common/extend')\"","webpack://@flarum/embed/external root \"flarum.reg.get('core', 'forum/app')\"","webpack://@flarum/embed/external root \"flarum.reg.get('core', 'common/utils/Stream')\"","webpack://@flarum/embed/external root \"flarum.reg.get('core', 'forum/ForumApplication')\"","webpack://@flarum/embed/external root \"flarum.reg.get('core', 'common/components/ModalManager')\"","webpack://@flarum/embed/external root \"flarum.reg.get('core', 'forum/components/PostMeta')\"","webpack://@flarum/embed/external root \"flarum.reg.get('core', 'forum/components/DiscussionPage')\"","webpack://@flarum/embed/./src/forum/index.js"],"sourcesContent":["/*\n * File: iframeResizer.contentWindow.js\n * Desc: Include this file in any page being loaded into an iframe\n * to force the iframe to resize to the content size.\n * Requires: iframeResizer.js on host page.\n * Doc: https://iframe-resizer.com\n * Author: David J. Bradshaw - info@iframe-resizer.com\n *\n */\n\n// eslint-disable-next-line sonarjs/cognitive-complexity, no-shadow-restricted-names\n;(function (undefined) {\n if (typeof window === 'undefined') return // don't run for server side render\n\n var autoResize = true,\n base = 10,\n bodyBackground = '',\n bodyMargin = 0,\n bodyMarginStr = '',\n bodyObserver = null,\n bodyPadding = '',\n calculateWidth = false,\n doubleEventList = { resize: 1, click: 1 },\n eventCancelTimer = 128,\n firstRun = true,\n height = 1,\n heightCalcModeDefault = 'bodyOffset',\n heightCalcMode = heightCalcModeDefault,\n initLock = true,\n initMsg = '',\n inPageLinks = {},\n interval = 32,\n intervalTimer = null,\n logging = false,\n mouseEvents = false,\n msgID = '[iFrameSizer]', // Must match host page msg ID\n msgIdLen = msgID.length,\n myID = '',\n resetRequiredMethods = {\n max: 1,\n min: 1,\n bodyScroll: 1,\n documentElementScroll: 1\n },\n resizeFrom = 'child',\n sendPermit = true,\n target = window.parent,\n targetOriginDefault = '*',\n tolerance = 0,\n triggerLocked = false,\n triggerLockedTimer = null,\n throttledTimer = 16,\n width = 1,\n widthCalcModeDefault = 'scroll',\n widthCalcMode = widthCalcModeDefault,\n win = window,\n onMessage = function () {\n warn('onMessage function not defined')\n },\n onReady = function () {},\n onPageInfo = function () {},\n customCalcMethods = {\n height: function () {\n warn('Custom height calculation function not defined')\n return document.documentElement.offsetHeight\n },\n width: function () {\n warn('Custom width calculation function not defined')\n return document.body.scrollWidth\n }\n },\n eventHandlersByName = {},\n passiveSupported = false\n\n function noop() {}\n\n try {\n var options = Object.create(\n {},\n {\n passive: {\n // eslint-disable-next-line getter-return\n get: function () {\n passiveSupported = true\n }\n }\n }\n )\n window.addEventListener('test', noop, options)\n window.removeEventListener('test', noop, options)\n } catch (error) {\n /* */\n }\n\n function addEventListener(el, evt, func, options) {\n el.addEventListener(evt, func, passiveSupported ? options || {} : false)\n }\n\n function removeEventListener(el, evt, func) {\n el.removeEventListener(evt, func, false)\n }\n\n function capitalizeFirstLetter(string) {\n return string.charAt(0).toUpperCase() + string.slice(1)\n }\n\n // Based on underscore.js\n function throttle(func) {\n var context,\n args,\n result,\n timeout = null,\n previous = 0,\n later = function () {\n previous = Date.now()\n timeout = null\n result = func.apply(context, args)\n if (!timeout) {\n // eslint-disable-next-line no-multi-assign\n context = args = null\n }\n }\n\n return function () {\n var now = Date.now()\n\n if (!previous) {\n previous = now\n }\n\n var remaining = throttledTimer - (now - previous)\n\n context = this\n args = arguments\n\n if (remaining <= 0 || remaining > throttledTimer) {\n if (timeout) {\n clearTimeout(timeout)\n timeout = null\n }\n\n previous = now\n result = func.apply(context, args)\n\n if (!timeout) {\n // eslint-disable-next-line no-multi-assign\n context = args = null\n }\n } else if (!timeout) {\n timeout = setTimeout(later, remaining)\n }\n\n return result\n }\n }\n\n function formatLogMsg(msg) {\n return msgID + '[' + myID + '] ' + msg\n }\n\n function log(msg) {\n if (logging && 'object' === typeof window.console) {\n // eslint-disable-next-line no-console\n console.log(formatLogMsg(msg))\n }\n }\n\n function warn(msg) {\n if ('object' === typeof window.console) {\n // eslint-disable-next-line no-console\n console.warn(formatLogMsg(msg))\n }\n }\n\n function init() {\n readDataFromParent()\n log('Initialising iFrame (' + window.location.href + ')')\n readDataFromPage()\n setMargin()\n setBodyStyle('background', bodyBackground)\n setBodyStyle('padding', bodyPadding)\n injectClearFixIntoBodyElement()\n checkHeightMode()\n checkWidthMode()\n stopInfiniteResizingOfIFrame()\n setupPublicMethods()\n setupMouseEvents()\n startEventListeners()\n inPageLinks = setupInPageLinks()\n sendSize('init', 'Init message from host page')\n onReady()\n }\n\n function readDataFromParent() {\n function strBool(str) {\n return 'true' === str\n }\n\n var data = initMsg.slice(msgIdLen).split(':')\n\n myID = data[0]\n bodyMargin = undefined === data[1] ? bodyMargin : Number(data[1]) // For V1 compatibility\n calculateWidth = undefined === data[2] ? calculateWidth : strBool(data[2])\n logging = undefined === data[3] ? logging : strBool(data[3])\n interval = undefined === data[4] ? interval : Number(data[4])\n autoResize = undefined === data[6] ? autoResize : strBool(data[6])\n bodyMarginStr = data[7]\n heightCalcMode = undefined === data[8] ? heightCalcMode : data[8]\n bodyBackground = data[9]\n bodyPadding = data[10]\n tolerance = undefined === data[11] ? tolerance : Number(data[11])\n inPageLinks.enable = undefined === data[12] ? false : strBool(data[12])\n resizeFrom = undefined === data[13] ? resizeFrom : data[13]\n widthCalcMode = undefined === data[14] ? widthCalcMode : data[14]\n mouseEvents = undefined === data[15] ? mouseEvents : strBool(data[15])\n }\n\n function depricate(key) {\n var splitName = key.split('Callback')\n\n if (splitName.length === 2) {\n var name =\n 'on' + splitName[0].charAt(0).toUpperCase() + splitName[0].slice(1)\n this[name] = this[key]\n delete this[key]\n warn(\n \"Deprecated: '\" +\n key +\n \"' has been renamed '\" +\n name +\n \"'. The old method will be removed in the next major version.\"\n )\n }\n }\n\n function readDataFromPage() {\n function readData() {\n var data = window.iFrameResizer\n\n log('Reading data from page: ' + JSON.stringify(data))\n Object.keys(data).forEach(depricate, data)\n\n onMessage = 'onMessage' in data ? data.onMessage : onMessage\n onReady = 'onReady' in data ? data.onReady : onReady\n targetOriginDefault =\n 'targetOrigin' in data ? data.targetOrigin : targetOriginDefault\n heightCalcMode =\n 'heightCalculationMethod' in data\n ? data.heightCalculationMethod\n : heightCalcMode\n widthCalcMode =\n 'widthCalculationMethod' in data\n ? data.widthCalculationMethod\n : widthCalcMode\n }\n\n function setupCustomCalcMethods(calcMode, calcFunc) {\n if ('function' === typeof calcMode) {\n log('Setup custom ' + calcFunc + 'CalcMethod')\n customCalcMethods[calcFunc] = calcMode\n calcMode = 'custom'\n }\n\n return calcMode\n }\n\n if (\n 'iFrameResizer' in window &&\n Object === window.iFrameResizer.constructor\n ) {\n readData()\n heightCalcMode = setupCustomCalcMethods(heightCalcMode, 'height')\n widthCalcMode = setupCustomCalcMethods(widthCalcMode, 'width')\n }\n\n log('TargetOrigin for parent set to: ' + targetOriginDefault)\n }\n\n function chkCSS(attr, value) {\n if (-1 !== value.indexOf('-')) {\n warn('Negative CSS value ignored for ' + attr)\n value = ''\n }\n return value\n }\n\n function setBodyStyle(attr, value) {\n if (undefined !== value && '' !== value && 'null' !== value) {\n document.body.style[attr] = value\n log('Body ' + attr + ' set to \"' + value + '\"')\n }\n }\n\n function setMargin() {\n // If called via V1 script, convert bodyMargin from int to str\n if (undefined === bodyMarginStr) {\n bodyMarginStr = bodyMargin + 'px'\n }\n\n setBodyStyle('margin', chkCSS('margin', bodyMarginStr))\n }\n\n function stopInfiniteResizingOfIFrame() {\n document.documentElement.style.height = ''\n document.body.style.height = ''\n log('HTML & body height set to \"auto\"')\n }\n\n function manageTriggerEvent(options) {\n var listener = {\n add: function (eventName) {\n function handleEvent() {\n sendSize(options.eventName, options.eventType)\n }\n\n eventHandlersByName[eventName] = handleEvent\n\n addEventListener(window, eventName, handleEvent, { passive: true })\n },\n remove: function (eventName) {\n var handleEvent = eventHandlersByName[eventName]\n delete eventHandlersByName[eventName]\n\n removeEventListener(window, eventName, handleEvent)\n }\n }\n\n if (options.eventNames && Array.prototype.map) {\n options.eventName = options.eventNames[0]\n options.eventNames.map(listener[options.method])\n } else {\n listener[options.method](options.eventName)\n }\n\n log(\n capitalizeFirstLetter(options.method) +\n ' event listener: ' +\n options.eventType\n )\n }\n\n function manageEventListeners(method) {\n manageTriggerEvent({\n method: method,\n eventType: 'Animation Start',\n eventNames: ['animationstart', 'webkitAnimationStart']\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Animation Iteration',\n eventNames: ['animationiteration', 'webkitAnimationIteration']\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Animation End',\n eventNames: ['animationend', 'webkitAnimationEnd']\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Input',\n eventName: 'input'\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Mouse Up',\n eventName: 'mouseup'\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Mouse Down',\n eventName: 'mousedown'\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Orientation Change',\n eventName: 'orientationchange'\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Print',\n eventNames: ['afterprint', 'beforeprint']\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Ready State Change',\n eventName: 'readystatechange'\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Touch Start',\n eventName: 'touchstart'\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Touch End',\n eventName: 'touchend'\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Touch Cancel',\n eventName: 'touchcancel'\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Transition Start',\n eventNames: [\n 'transitionstart',\n 'webkitTransitionStart',\n 'MSTransitionStart',\n 'oTransitionStart',\n 'otransitionstart'\n ]\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Transition Iteration',\n eventNames: [\n 'transitioniteration',\n 'webkitTransitionIteration',\n 'MSTransitionIteration',\n 'oTransitionIteration',\n 'otransitioniteration'\n ]\n })\n manageTriggerEvent({\n method: method,\n eventType: 'Transition End',\n eventNames: [\n 'transitionend',\n 'webkitTransitionEnd',\n 'MSTransitionEnd',\n 'oTransitionEnd',\n 'otransitionend'\n ]\n })\n if ('child' === resizeFrom) {\n manageTriggerEvent({\n method: method,\n eventType: 'IFrame Resized',\n eventName: 'resize'\n })\n }\n }\n\n function checkCalcMode(calcMode, calcModeDefault, modes, type) {\n if (calcModeDefault !== calcMode) {\n if (!(calcMode in modes)) {\n warn(\n calcMode + ' is not a valid option for ' + type + 'CalculationMethod.'\n )\n calcMode = calcModeDefault\n }\n log(type + ' calculation method set to \"' + calcMode + '\"')\n }\n\n return calcMode\n }\n\n function checkHeightMode() {\n heightCalcMode = checkCalcMode(\n heightCalcMode,\n heightCalcModeDefault,\n getHeight,\n 'height'\n )\n }\n\n function checkWidthMode() {\n widthCalcMode = checkCalcMode(\n widthCalcMode,\n widthCalcModeDefault,\n getWidth,\n 'width'\n )\n }\n\n function startEventListeners() {\n if (true === autoResize) {\n manageEventListeners('add')\n setupMutationObserver()\n } else {\n log('Auto Resize disabled')\n }\n }\n\n // function stopMsgsToParent() {\n // log('Disable outgoing messages')\n // sendPermit = false\n // }\n\n // function removeMsgListener() {\n // log('Remove event listener: Message')\n // removeEventListener(window, 'message', receiver)\n // }\n\n function disconnectMutationObserver() {\n if (null !== bodyObserver) {\n /* istanbul ignore next */ // Not testable in PhantonJS\n bodyObserver.disconnect()\n }\n }\n\n function stopEventListeners() {\n manageEventListeners('remove')\n disconnectMutationObserver()\n clearInterval(intervalTimer)\n }\n\n // function teardown() {\n // stopMsgsToParent()\n // removeMsgListener()\n // if (true === autoResize) stopEventListeners()\n // }\n\n function injectClearFixIntoBodyElement() {\n var clearFix = document.createElement('div')\n clearFix.style.clear = 'both'\n // Guard against the following having been globally redefined in CSS.\n clearFix.style.display = 'block'\n clearFix.style.height = '0'\n document.body.appendChild(clearFix)\n }\n\n function setupInPageLinks() {\n function getPagePosition() {\n return {\n x:\n window.pageXOffset === undefined\n ? document.documentElement.scrollLeft\n : window.pageXOffset,\n y:\n window.pageYOffset === undefined\n ? document.documentElement.scrollTop\n : window.pageYOffset\n }\n }\n\n function getElementPosition(el) {\n var elPosition = el.getBoundingClientRect(),\n pagePosition = getPagePosition()\n\n return {\n x: parseInt(elPosition.left, 10) + parseInt(pagePosition.x, 10),\n y: parseInt(elPosition.top, 10) + parseInt(pagePosition.y, 10)\n }\n }\n\n function findTarget(location) {\n function jumpToTarget(target) {\n var jumpPosition = getElementPosition(target)\n\n log(\n 'Moving to in page link (#' +\n hash +\n ') at x: ' +\n jumpPosition.x +\n ' y: ' +\n jumpPosition.y\n )\n sendMsg(jumpPosition.y, jumpPosition.x, 'scrollToOffset') // X&Y reversed at sendMsg uses height/width\n }\n\n var hash = location.split('#')[1] || location, // Remove # if present\n hashData = decodeURIComponent(hash),\n target =\n document.getElementById(hashData) ||\n document.getElementsByName(hashData)[0]\n\n if (undefined === target) {\n log(\n 'In page link (#' +\n hash +\n ') not found in iFrame, so sending to parent'\n )\n sendMsg(0, 0, 'inPageLink', '#' + hash)\n } else {\n jumpToTarget(target)\n }\n }\n\n function checkLocationHash() {\n var hash = window.location.hash\n var href = window.location.href\n\n if ('' !== hash && '#' !== hash) {\n findTarget(href)\n }\n }\n\n function bindAnchors() {\n function setupLink(el) {\n function linkClicked(e) {\n e.preventDefault()\n\n /* jshint validthis:true */\n findTarget(this.getAttribute('href'))\n }\n\n if ('#' !== el.getAttribute('href')) {\n addEventListener(el, 'click', linkClicked)\n }\n }\n\n Array.prototype.forEach.call(\n document.querySelectorAll('a[href^=\"#\"]'),\n setupLink\n )\n }\n\n function bindLocationHash() {\n addEventListener(window, 'hashchange', checkLocationHash)\n }\n\n function initCheck() {\n // Check if page loaded with location hash after init resize\n setTimeout(checkLocationHash, eventCancelTimer)\n }\n\n function enableInPageLinks() {\n /* istanbul ignore else */ // Not testable in phantonJS\n if (Array.prototype.forEach && document.querySelectorAll) {\n log('Setting up location.hash handlers')\n bindAnchors()\n bindLocationHash()\n initCheck()\n } else {\n warn(\n 'In page linking not fully supported in this browser! (See README.md for IE8 workaround)'\n )\n }\n }\n\n if (inPageLinks.enable) {\n enableInPageLinks()\n } else {\n log('In page linking not enabled')\n }\n\n return {\n findTarget: findTarget\n }\n }\n\n function setupMouseEvents() {\n if (mouseEvents !== true) return\n\n function sendMouse(e) {\n sendMsg(0, 0, e.type, e.screenY + ':' + e.screenX)\n }\n\n function addMouseListener(evt, name) {\n log('Add event listener: ' + name)\n addEventListener(window.document, evt, sendMouse)\n }\n\n addMouseListener('mouseenter', 'Mouse Enter')\n addMouseListener('mouseleave', 'Mouse Leave')\n }\n\n function setupPublicMethods() {\n log('Enable public methods')\n\n win.parentIFrame = {\n autoResize: function autoResizeF(resize) {\n if (true === resize && false === autoResize) {\n autoResize = true\n startEventListeners()\n } else if (false === resize && true === autoResize) {\n autoResize = false\n stopEventListeners()\n }\n sendMsg(0, 0, 'autoResize', JSON.stringify(autoResize))\n return autoResize\n },\n\n close: function closeF() {\n sendMsg(0, 0, 'close')\n // teardown()\n },\n\n getId: function getIdF() {\n return myID\n },\n\n getPageInfo: function getPageInfoF(callback) {\n if ('function' === typeof callback) {\n onPageInfo = callback\n sendMsg(0, 0, 'pageInfo')\n } else {\n onPageInfo = function () {}\n sendMsg(0, 0, 'pageInfoStop')\n }\n },\n\n moveToAnchor: function moveToAnchorF(hash) {\n inPageLinks.findTarget(hash)\n },\n\n reset: function resetF() {\n resetIFrame('parentIFrame.reset')\n },\n\n scrollTo: function scrollToF(x, y) {\n sendMsg(y, x, 'scrollTo') // X&Y reversed at sendMsg uses height/width\n },\n\n scrollToOffset: function scrollToF(x, y) {\n sendMsg(y, x, 'scrollToOffset') // X&Y reversed at sendMsg uses height/width\n },\n\n sendMessage: function sendMessageF(msg, targetOrigin) {\n sendMsg(0, 0, 'message', JSON.stringify(msg), targetOrigin)\n },\n\n setHeightCalculationMethod: function setHeightCalculationMethodF(\n heightCalculationMethod\n ) {\n heightCalcMode = heightCalculationMethod\n checkHeightMode()\n },\n\n setWidthCalculationMethod: function setWidthCalculationMethodF(\n widthCalculationMethod\n ) {\n widthCalcMode = widthCalculationMethod\n checkWidthMode()\n },\n\n setTargetOrigin: function setTargetOriginF(targetOrigin) {\n log('Set targetOrigin: ' + targetOrigin)\n targetOriginDefault = targetOrigin\n },\n\n size: function sizeF(customHeight, customWidth) {\n var valString =\n '' + (customHeight || '') + (customWidth ? ',' + customWidth : '')\n sendSize(\n 'size',\n 'parentIFrame.size(' + valString + ')',\n customHeight,\n customWidth\n )\n }\n }\n }\n\n function initInterval() {\n if (0 !== interval) {\n log('setInterval: ' + interval + 'ms')\n intervalTimer = setInterval(function () {\n sendSize('interval', 'setInterval: ' + interval)\n }, Math.abs(interval))\n }\n }\n\n // Not testable in PhantomJS\n /* istanbul ignore next */\n function setupBodyMutationObserver() {\n function addImageLoadListners(mutation) {\n function addImageLoadListener(element) {\n if (false === element.complete) {\n log('Attach listeners to ' + element.src)\n element.addEventListener('load', imageLoaded, false)\n element.addEventListener('error', imageError, false)\n elements.push(element)\n }\n }\n\n if (mutation.type === 'attributes' && mutation.attributeName === 'src') {\n addImageLoadListener(mutation.target)\n } else if (mutation.type === 'childList') {\n Array.prototype.forEach.call(\n mutation.target.querySelectorAll('img'),\n addImageLoadListener\n )\n }\n }\n\n function removeFromArray(element) {\n elements.splice(elements.indexOf(element), 1)\n }\n\n function removeImageLoadListener(element) {\n log('Remove listeners from ' + element.src)\n element.removeEventListener('load', imageLoaded, false)\n element.removeEventListener('error', imageError, false)\n removeFromArray(element)\n }\n\n function imageEventTriggered(event, type, typeDesc) {\n removeImageLoadListener(event.target)\n sendSize(type, typeDesc + ': ' + event.target.src)\n }\n\n function imageLoaded(event) {\n imageEventTriggered(event, 'imageLoad', 'Image loaded')\n }\n\n function imageError(event) {\n imageEventTriggered(event, 'imageLoadFailed', 'Image load failed')\n }\n\n function mutationObserved(mutations) {\n sendSize(\n 'mutationObserver',\n 'mutationObserver: ' + mutations[0].target + ' ' + mutations[0].type\n )\n\n // Deal with WebKit / Blink asyncing image loading when tags are injected into the page\n mutations.forEach(addImageLoadListners)\n }\n\n function createMutationObserver() {\n var target = document.querySelector('body'),\n config = {\n attributes: true,\n attributeOldValue: false,\n characterData: true,\n characterDataOldValue: false,\n childList: true,\n subtree: true\n }\n\n observer = new MutationObserver(mutationObserved)\n\n log('Create body MutationObserver')\n observer.observe(target, config)\n\n return observer\n }\n\n var elements = [],\n MutationObserver =\n window.MutationObserver || window.WebKitMutationObserver,\n observer = createMutationObserver()\n\n return {\n disconnect: function () {\n if ('disconnect' in observer) {\n log('Disconnect body MutationObserver')\n observer.disconnect()\n elements.forEach(removeImageLoadListener)\n }\n }\n }\n }\n\n function setupMutationObserver() {\n var forceIntervalTimer = 0 > interval\n\n // Not testable in PhantomJS\n /* istanbul ignore if */ if (\n window.MutationObserver ||\n window.WebKitMutationObserver\n ) {\n if (forceIntervalTimer) {\n initInterval()\n } else {\n bodyObserver = setupBodyMutationObserver()\n }\n } else {\n log('MutationObserver not supported in this browser!')\n initInterval()\n }\n }\n\n // document.documentElement.offsetHeight is not reliable, so\n // we have to jump through hoops to get a better value.\n function getComputedStyle(prop, el) {\n var retVal = 0\n el = el || document.body // Not testable in phantonJS\n\n retVal = document.defaultView.getComputedStyle(el, null)\n retVal = null === retVal ? 0 : retVal[prop]\n\n return parseInt(retVal, base)\n }\n\n function chkEventThottle(timer) {\n if (timer > throttledTimer / 2) {\n throttledTimer = 2 * timer\n log('Event throttle increased to ' + throttledTimer + 'ms')\n }\n }\n\n // Idea from https://github.com/guardian/iframe-messenger\n function getMaxElement(side, elements) {\n var elementsLength = elements.length,\n elVal = 0,\n maxVal = 0,\n Side = capitalizeFirstLetter(side),\n timer = Date.now()\n\n for (var i = 0; i < elementsLength; i++) {\n elVal =\n elements[i].getBoundingClientRect()[side] +\n getComputedStyle('margin' + Side, elements[i])\n if (elVal > maxVal) {\n maxVal = elVal\n }\n }\n\n timer = Date.now() - timer\n\n log('Parsed ' + elementsLength + ' HTML elements')\n log('Element position calculated in ' + timer + 'ms')\n\n chkEventThottle(timer)\n\n return maxVal\n }\n\n function getAllMeasurements(dimensions) {\n return [\n dimensions.bodyOffset(),\n dimensions.bodyScroll(),\n dimensions.documentElementOffset(),\n dimensions.documentElementScroll()\n ]\n }\n\n function getTaggedElements(side, tag) {\n function noTaggedElementsFound() {\n warn('No tagged elements (' + tag + ') found on page')\n return document.querySelectorAll('body *')\n }\n\n var elements = document.querySelectorAll('[' + tag + ']')\n\n if (elements.length === 0) noTaggedElementsFound()\n\n return getMaxElement(side, elements)\n }\n\n function getAllElements() {\n return document.querySelectorAll('body *')\n }\n\n var getHeight = {\n bodyOffset: function getBodyOffsetHeight() {\n return (\n document.body.offsetHeight +\n getComputedStyle('marginTop') +\n getComputedStyle('marginBottom')\n )\n },\n\n offset: function () {\n return getHeight.bodyOffset() // Backwards compatibility\n },\n\n bodyScroll: function getBodyScrollHeight() {\n return document.body.scrollHeight\n },\n\n custom: function getCustomWidth() {\n return customCalcMethods.height()\n },\n\n documentElementOffset: function getDEOffsetHeight() {\n return document.documentElement.offsetHeight\n },\n\n documentElementScroll: function getDEScrollHeight() {\n return document.documentElement.scrollHeight\n },\n\n max: function getMaxHeight() {\n return Math.max.apply(null, getAllMeasurements(getHeight))\n },\n\n min: function getMinHeight() {\n return Math.min.apply(null, getAllMeasurements(getHeight))\n },\n\n grow: function growHeight() {\n return getHeight.max() // Run max without the forced downsizing\n },\n\n lowestElement: function getBestHeight() {\n return Math.max(\n getHeight.bodyOffset() || getHeight.documentElementOffset(),\n getMaxElement('bottom', getAllElements())\n )\n },\n\n taggedElement: function getTaggedElementsHeight() {\n return getTaggedElements('bottom', 'data-iframe-height')\n }\n },\n getWidth = {\n bodyScroll: function getBodyScrollWidth() {\n return document.body.scrollWidth\n },\n\n bodyOffset: function getBodyOffsetWidth() {\n return document.body.offsetWidth\n },\n\n custom: function getCustomWidth() {\n return customCalcMethods.width()\n },\n\n documentElementScroll: function getDEScrollWidth() {\n return document.documentElement.scrollWidth\n },\n\n documentElementOffset: function getDEOffsetWidth() {\n return document.documentElement.offsetWidth\n },\n\n scroll: function getMaxWidth() {\n return Math.max(getWidth.bodyScroll(), getWidth.documentElementScroll())\n },\n\n max: function getMaxWidth() {\n return Math.max.apply(null, getAllMeasurements(getWidth))\n },\n\n min: function getMinWidth() {\n return Math.min.apply(null, getAllMeasurements(getWidth))\n },\n\n rightMostElement: function rightMostElement() {\n return getMaxElement('right', getAllElements())\n },\n\n taggedElement: function getTaggedElementsWidth() {\n return getTaggedElements('right', 'data-iframe-width')\n }\n }\n\n function sizeIFrame(\n triggerEvent,\n triggerEventDesc,\n customHeight,\n customWidth\n ) {\n function resizeIFrame() {\n height = currentHeight\n width = currentWidth\n\n sendMsg(height, width, triggerEvent)\n }\n\n function isSizeChangeDetected() {\n function checkTolarance(a, b) {\n var retVal = Math.abs(a - b) <= tolerance\n return !retVal\n }\n\n currentHeight =\n undefined === customHeight ? getHeight[heightCalcMode]() : customHeight\n currentWidth =\n undefined === customWidth ? getWidth[widthCalcMode]() : customWidth\n\n return (\n checkTolarance(height, currentHeight) ||\n (calculateWidth && checkTolarance(width, currentWidth))\n )\n }\n\n function isForceResizableEvent() {\n return !(triggerEvent in { init: 1, interval: 1, size: 1 })\n }\n\n function isForceResizableCalcMode() {\n return (\n heightCalcMode in resetRequiredMethods ||\n (calculateWidth && widthCalcMode in resetRequiredMethods)\n )\n }\n\n function logIgnored() {\n log('No change in size detected')\n }\n\n function checkDownSizing() {\n if (isForceResizableEvent() && isForceResizableCalcMode()) {\n resetIFrame(triggerEventDesc)\n } else if (!(triggerEvent in { interval: 1 })) {\n logIgnored()\n }\n }\n\n var currentHeight, currentWidth\n\n if (isSizeChangeDetected() || 'init' === triggerEvent) {\n lockTrigger()\n resizeIFrame()\n } else {\n checkDownSizing()\n }\n }\n\n var sizeIFrameThrottled = throttle(sizeIFrame)\n\n function sendSize(triggerEvent, triggerEventDesc, customHeight, customWidth) {\n function recordTrigger() {\n if (!(triggerEvent in { reset: 1, resetPage: 1, init: 1 })) {\n log('Trigger event: ' + triggerEventDesc)\n }\n }\n\n function isDoubleFiredEvent() {\n return triggerLocked && triggerEvent in doubleEventList\n }\n\n if (isDoubleFiredEvent()) {\n log('Trigger event cancelled: ' + triggerEvent)\n } else {\n recordTrigger()\n if (triggerEvent === 'init') {\n sizeIFrame(triggerEvent, triggerEventDesc, customHeight, customWidth)\n } else {\n sizeIFrameThrottled(\n triggerEvent,\n triggerEventDesc,\n customHeight,\n customWidth\n )\n }\n }\n }\n\n function lockTrigger() {\n if (!triggerLocked) {\n triggerLocked = true\n log('Trigger event lock on')\n }\n clearTimeout(triggerLockedTimer)\n triggerLockedTimer = setTimeout(function () {\n triggerLocked = false\n log('Trigger event lock off')\n log('--')\n }, eventCancelTimer)\n }\n\n function triggerReset(triggerEvent) {\n height = getHeight[heightCalcMode]()\n width = getWidth[widthCalcMode]()\n\n sendMsg(height, width, triggerEvent)\n }\n\n function resetIFrame(triggerEventDesc) {\n var hcm = heightCalcMode\n heightCalcMode = heightCalcModeDefault\n\n log('Reset trigger event: ' + triggerEventDesc)\n lockTrigger()\n triggerReset('reset')\n\n heightCalcMode = hcm\n }\n\n function sendMsg(height, width, triggerEvent, msg, targetOrigin) {\n function setTargetOrigin() {\n if (undefined === targetOrigin) {\n targetOrigin = targetOriginDefault\n } else {\n log('Message targetOrigin: ' + targetOrigin)\n }\n }\n\n function sendToParent() {\n var size = height + ':' + width,\n message =\n myID +\n ':' +\n size +\n ':' +\n triggerEvent +\n (undefined === msg ? '' : ':' + msg)\n\n log('Sending message to host page (' + message + ')')\n target.postMessage(msgID + message, targetOrigin)\n }\n\n if (true === sendPermit) {\n setTargetOrigin()\n sendToParent()\n }\n }\n\n function receiver(event) {\n var processRequestFromParent = {\n init: function initFromParent() {\n initMsg = event.data\n target = event.source\n\n init()\n firstRun = false\n setTimeout(function () {\n initLock = false\n }, eventCancelTimer)\n },\n\n reset: function resetFromParent() {\n if (initLock) {\n log('Page reset ignored by init')\n } else {\n log('Page size reset by host page')\n triggerReset('resetPage')\n }\n },\n\n resize: function resizeFromParent() {\n sendSize('resizeParent', 'Parent window requested size check')\n },\n\n moveToAnchor: function moveToAnchorF() {\n inPageLinks.findTarget(getData())\n },\n inPageLink: function inPageLinkF() {\n this.moveToAnchor()\n }, // Backward compatibility\n\n pageInfo: function pageInfoFromParent() {\n var msgBody = getData()\n log('PageInfoFromParent called from parent: ' + msgBody)\n onPageInfo(JSON.parse(msgBody))\n log(' --')\n },\n\n message: function messageFromParent() {\n var msgBody = getData()\n\n log('onMessage called from parent: ' + msgBody)\n // eslint-disable-next-line sonarjs/no-extra-arguments\n onMessage(JSON.parse(msgBody))\n log(' --')\n }\n }\n\n function isMessageForUs() {\n return msgID === ('' + event.data).slice(0, msgIdLen) // ''+ Protects against non-string messages\n }\n\n function getMessageType() {\n return event.data.split(']')[1].split(':')[0]\n }\n\n function getData() {\n return event.data.slice(event.data.indexOf(':') + 1)\n }\n\n function isMiddleTier() {\n return (\n (!(typeof module !== 'undefined' && module.exports) &&\n 'iFrameResize' in window) ||\n (window.jQuery !== undefined &&\n 'iFrameResize' in window.jQuery.prototype)\n )\n }\n\n function isInitMsg() {\n // Test if this message is from a child below us. This is an ugly test, however, updating\n // the message format would break backwards compatibility.\n return event.data.split(':')[2] in { true: 1, false: 1 }\n }\n\n function callFromParent() {\n var messageType = getMessageType()\n\n if (messageType in processRequestFromParent) {\n processRequestFromParent[messageType]()\n } else if (!isMiddleTier() && !isInitMsg()) {\n warn('Unexpected message (' + event.data + ')')\n }\n }\n\n function processMessage() {\n if (false === firstRun) {\n callFromParent()\n } else if (isInitMsg()) {\n processRequestFromParent.init()\n } else {\n log(\n 'Ignored message of type \"' +\n getMessageType() +\n '\". Received before initialization.'\n )\n }\n }\n\n if (isMessageForUs()) {\n processMessage()\n }\n }\n\n // Normally the parent kicks things off when it detects the iFrame has loaded.\n // If this script is async-loaded, then tell parent page to retry init.\n function chkLateLoaded() {\n if ('loading' !== document.readyState) {\n window.parent.postMessage('[iFrameResizerChild]Ready', '*')\n }\n }\n\n // Setup if not already running\n if (!('iframeResizer' in window)) {\n window.iframeChildListener = function (data) {\n receiver({ data, sameDomian: true })\n }\n addEventListener(window, 'message', receiver)\n addEventListener(window, 'readystatechange', chkLateLoaded)\n chkLateLoaded()\n }\n\n \n})()\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extend');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/utils/Stream');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/ForumApplication');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/ModalManager');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/PostMeta');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/DiscussionPage');","import 'iframe-resizer/js/iframeResizer.contentWindow.js';\nimport { override, extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport Stream from 'flarum/common/utils/Stream';\nimport ForumApplication from 'flarum/forum/ForumApplication';\nimport ModalManager from 'flarum/common/components/ModalManager';\nimport PostMeta from 'flarum/forum/components/PostMeta';\nimport DiscussionPage from 'flarum/forum/components/DiscussionPage';\nextend(ForumApplication.prototype, 'mount', function () {\n if (m.route.param('hideFirstPost')) {\n extend('flarum/forum/components/PostStream', 'view', vdom => {\n if (vdom.children[0].attrs['data-number'] === 1) {\n vdom.children.splice(0, 1);\n }\n });\n }\n});\noverride(m.route.Link, 'view', function (original, vnode) {\n vnode.attrs.href = vnode.attrs.href.replace('/embed', '/d');\n vnode.attrs.target = '_blank';\n // TODO: If href leads to a post within this discussion that we have\n // already loaded, then scroll to it?\n return original(vnode);\n});\n\n// Trim the /embed prefix off of post permalinks\noverride(PostMeta.prototype, 'getPermalink', (original, post) => {\n return original(post).replace('/embed', '/d');\n});\napp.pageInfo = Stream({});\nconst reposition = function () {\n const info = app.pageInfo();\n this.$().css('top', Math.max(0, info.scrollTop - info.offsetTop));\n};\nextend(ModalManager.prototype, 'show', reposition);\nextend('flarum/forum/components/Composer', 'show', reposition);\nwindow.iFrameResizer = {\n readyCallback: function () {\n window.parentIFrame.getPageInfo(app.pageInfo);\n }\n};\nextend('flarum/forum/components/PostStream', 'goToNumber', function (promise, number) {\n if (number === 'reply' && 'parentIFrame' in window && app.composer.isFullScreen()) {\n const itemTop = this.$('.PostStream-item:last').offset().top;\n window.parentIFrame.scrollToOffset(0, itemTop);\n }\n});\nextend(DiscussionPage.prototype, 'sidebarItems', function (items) {\n items.remove('scrubber');\n const count = this.discussion.replyCount();\n items.add('replies', m(\"h3\", null, m(\"a\", {\n route: app.route.discussion(this.discussion).replace('/embed', '/d')\n }, count, \" comment\", count == 1 ? '' : 's')), 100);\n const attrs = items.get('controls').attrs;\n attrs.className = attrs.className.replace('App-primaryControl', '');\n});\napp.routes['discussion'] = {\n path: '/embed/:id',\n component: DiscussionPage\n};\napp.routes['discussion.near'] = {\n path: '/embed/:id/:near',\n component: DiscussionPage\n};"],"names":["undefined","window","autoResize","bodyBackground","bodyMargin","bodyMarginStr","bodyObserver","bodyPadding","calculateWidth","doubleEventList","resize","click","eventCancelTimer","firstRun","height","heightCalcModeDefault","heightCalcMode","initLock","initMsg","inPageLinks","interval","intervalTimer","logging","mouseEvents","msgID","myID","resetRequiredMethods","max","min","bodyScroll","documentElementScroll","resizeFrom","target","parent","targetOriginDefault","tolerance","triggerLocked","triggerLockedTimer","throttledTimer","width","widthCalcModeDefault","widthCalcMode","win","onMessage","warn","onReady","onPageInfo","customCalcMethods","document","documentElement","offsetHeight","body","scrollWidth","eventHandlersByName","passiveSupported","options","Object","create","passive","get","addEventListener","noop","removeEventListener","error","func","context","args","result","timeout","previous","later","getHeight","bodyOffset","getComputedStyle","offset","scrollHeight","custom","documentElementOffset","Math","apply","getAllMeasurements","grow","lowestElement","getMaxElement","getAllElements","taggedElement","getTaggedElements","getWidth","offsetWidth","scroll","rightMostElement","sizeIFrameThrottled","sizeIFrame","Date","now","remaining","this","arguments","clearTimeout","setTimeout","iframeChildListener","data","receiver","sameDomian","chkLateLoaded","el","evt","capitalizeFirstLetter","string","charAt","toUpperCase","slice","formatLogMsg","msg","log","console","init","clearFix","value","strBool","str","split","Number","enable","readDataFromParent","location","href","setupCustomCalcMethods","calcMode","calcFunc","iFrameResizer","constructor","JSON","stringify","keys","forEach","depricate","targetOrigin","heightCalculationMethod","widthCalculationMethod","readDataFromPage","setBodyStyle","indexOf","createElement","style","clear","display","appendChild","checkHeightMode","checkWidthMode","parentIFrame","startEventListeners","manageEventListeners","disconnect","clearInterval","sendMsg","close","getId","getPageInfo","callback","moveToAnchor","hash","findTarget","reset","resetIFrame","scrollTo","x","y","scrollToOffset","sendMessage","setHeightCalculationMethod","setWidthCalculationMethod","setTargetOrigin","size","customHeight","customWidth","sendSize","sendMouse","e","type","screenY","screenX","addMouseListener","name","setupMouseEvents","getElementPosition","elPosition","getBoundingClientRect","pagePosition","pageXOffset","scrollLeft","pageYOffset","scrollTop","parseInt","left","top","hashData","decodeURIComponent","getElementById","getElementsByName","jumpPosition","jumpToTarget","checkLocationHash","Array","prototype","querySelectorAll","call","getAttribute","preventDefault","setupInPageLinks","key","splitName","length","attr","manageTriggerEvent","listener","add","eventName","handleEvent","eventType","remove","eventNames","map","method","checkCalcMode","calcModeDefault","modes","forceIntervalTimer","MutationObserver","WebKitMutationObserver","initInterval","addImageLoadListners","mutation","addImageLoadListener","element","complete","src","imageLoaded","imageError","elements","push","attributeName","removeImageLoadListener","splice","removeFromArray","imageEventTriggered","event","typeDesc","mutationObserved","mutations","observer","querySelector","observe","attributes","attributeOldValue","characterData","characterDataOldValue","childList","subtree","createMutationObserver","setupBodyMutationObserver","setInterval","abs","prop","retVal","defaultView","side","elementsLength","elVal","maxVal","Side","timer","i","chkEventThottle","dimensions","tag","triggerEvent","triggerEventDesc","currentHeight","currentWidth","checkTolarance","a","b","isSizeChangeDetected","lockTrigger","resetPage","triggerReset","hcm","message","postMessage","messageType","processRequestFromParent","source","getData","inPageLink","pageInfo","msgBody","parse","getMessageType","isInitMsg","true","false","module","exports","jQuery","readyState","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","n","getter","__esModule","d","definition","o","defineProperty","enumerable","obj","hasOwnProperty","flarum","reg","extend","m","route","param","vdom","children","attrs","override","Link","original","vnode","replace","post","reposition","info","$","css","offsetTop","readyCallback","promise","number","isFullScreen","itemTop","items","count","discussion","replyCount","className","path","component"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/embed/js/package.json b/extensions/embed/js/package.json index b66469f390..5ab81b028d 100644 --- a/extensions/embed/js/package.json +++ b/extensions/embed/js/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "prettier": "^2.5.1", - "flarum-webpack-config": "^2.0.0", + "flarum-webpack-config": "^3.0.0", "webpack": "^5.76.0", "webpack-cli": "^4.9.1", "@flarum/prettier-config": "^1.0.0" diff --git a/extensions/embed/js/src/forum/index.js b/extensions/embed/js/src/forum/index.js index ecdd52508c..f858688120 100644 --- a/extensions/embed/js/src/forum/index.js +++ b/extensions/embed/js/src/forum/index.js @@ -4,8 +4,6 @@ import { override, extend } from 'flarum/common/extend'; import app from 'flarum/forum/app'; import Stream from 'flarum/common/utils/Stream'; import ForumApplication from 'flarum/forum/ForumApplication'; -import Composer from 'flarum/forum/components/Composer'; -import PostStream from 'flarum/forum/components/PostStream'; import ModalManager from 'flarum/common/components/ModalManager'; import PostMeta from 'flarum/forum/components/PostMeta'; @@ -13,7 +11,7 @@ import DiscussionPage from 'flarum/forum/components/DiscussionPage'; extend(ForumApplication.prototype, 'mount', function () { if (m.route.param('hideFirstPost')) { - extend(PostStream.prototype, 'view', (vdom) => { + extend('flarum/forum/components/PostStream', 'view', (vdom) => { if (vdom.children[0].attrs['data-number'] === 1) { vdom.children.splice(0, 1); } @@ -42,7 +40,7 @@ const reposition = function () { }; extend(ModalManager.prototype, 'show', reposition); -extend(Composer.prototype, 'show', reposition); +extend('flarum/forum/components/Composer', 'show', reposition); window.iFrameResizer = { readyCallback: function () { @@ -50,7 +48,7 @@ window.iFrameResizer = { }, }; -extend(PostStream.prototype, 'goToNumber', function (promise, number) { +extend('flarum/forum/components/PostStream', 'goToNumber', function (promise, number) { if (number === 'reply' && 'parentIFrame' in window && app.composer.isFullScreen()) { const itemTop = this.$('.PostStream-item:last').offset().top; window.parentIFrame.scrollToOffset(0, itemTop); diff --git a/extensions/embed/less/forum.less b/extensions/embed/less/forum.less index b352032ece..4b0959f862 100644 --- a/extensions/embed/less/forum.less +++ b/extensions/embed/less/forum.less @@ -50,7 +50,7 @@ padding: 15px 15px; .scrolled & { - .box-shadow(0 2px 6px @shadow-color); + box-shadow: 0 2px 6px var(--shadow-color); } } @@ -69,7 +69,7 @@ margin: 0; &, a { - color: @muted-color; + color: var(--muted-color); } } } diff --git a/extensions/emoji/.gitignore b/extensions/emoji/.gitignore index 4ebb168a05..e60e512061 100644 --- a/extensions/emoji/.gitignore +++ b/extensions/emoji/.gitignore @@ -4,6 +4,7 @@ composer.phar .DS_Store Thumbs.db +tests/.phpunit.cache tests/.phpunit.result.cache /tests/integration/tmp .vagrant diff --git a/extensions/emoji/LICENSE b/extensions/emoji/LICENSE index 54ac29ab2c..bb6e15d87e 100644 --- a/extensions/emoji/LICENSE +++ b/extensions/emoji/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019-2021 Stichting Flarum (Flarum Foundation) +Copyright (c) 2019-2024 Stichting Flarum (Flarum Foundation) Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/extensions/emoji/extend.php b/extensions/emoji/extend.php index 54a5d79780..66598208c3 100644 --- a/extensions/emoji/extend.php +++ b/extensions/emoji/extend.php @@ -11,9 +11,13 @@ use s9e\TextFormatter\Configurator; return [ + (new Extend\Frontend('admin')) + ->js(__DIR__.'/js/dist/admin.js'), + (new Extend\Frontend('forum')) ->js(__DIR__.'/js/dist/forum.js') - ->css(__DIR__.'/less/forum.less'), + ->css(__DIR__.'/less/forum.less') + ->jsDirectory(__DIR__.'/js/dist/forum'), (new Extend\Formatter) ->configure(function (Configurator $config) { @@ -29,4 +33,8 @@ }), new Extend\Locales(__DIR__.'/locale'), + + (new Extend\Settings) + ->serializeToForum('flarum-emoji.cdn', 'flarum-emoji.cdn') + ->default('flarum-emoji.cdn', 'https://cdn.jsdelivr.net/gh/twitter/twemoji@[version]/assets/'), ]; diff --git a/extensions/emoji/js/.prettierrc.json b/extensions/emoji/js/.prettierrc.json deleted file mode 100644 index 944d65352b..0000000000 --- a/extensions/emoji/js/.prettierrc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "printWidth": 150, - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "es5" -} diff --git a/extensions/emoji/js/admin.js b/extensions/emoji/js/admin.js new file mode 100644 index 0000000000..3e69ff3b97 --- /dev/null +++ b/extensions/emoji/js/admin.js @@ -0,0 +1 @@ +export * from './src/admin'; diff --git a/extensions/emoji/js/dist/admin.js b/extensions/emoji/js/dist/admin.js new file mode 100644 index 0000000000..36cffcf3c0 --- /dev/null +++ b/extensions/emoji/js/dist/admin.js @@ -0,0 +1,2 @@ +(()=>{var d={n:u=>{var f=u&&u.__esModule?()=>u.default:()=>u;return d.d(f,{a:f}),f},d:(u,f)=>{for(var c in f)d.o(f,c)&&!d.o(u,c)&&Object.defineProperty(u,c,{enumerable:!0,get:f[c]})},o:(d,u)=>Object.prototype.hasOwnProperty.call(d,u),r:d=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(d,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(d,"__esModule",{value:!0})}},u={};(()=>{"use strict";d.r(u),d.d(u,{extend:()=>r});const f=flarum.reg.get("core","admin/app");var c=d.n(f);const e=flarum.reg.get("core","common/extenders");var b=d.n(e),a=function(){var d={base:"https://twemoji.maxcdn.com/v/14.0.2/",ext:".png",size:"72x72",className:"emoji",convert:{fromCodePoint:function(d){var u="string"==typeof d?parseInt(d,16):d;return u<65536?t(u):t(55296+((u-=65536)>>10),56320+(1023&u))},toCodePoint:h},onerror:function(){this.parentNode&&this.parentNode.replaceChild(r(this.alt,!1),this)},parse:function(u,f){return f&&"function"!=typeof f||(f={callback:f}),("string"==typeof u?l:s)(u,{callback:f.callback||n,attributes:"function"==typeof f.attributes?f.attributes:p,base:"string"==typeof f.base?f.base:d.base,ext:f.ext||d.ext,size:f.folder||(c=f.size||d.size,"number"==typeof c?c+"x"+c:c),className:f.className||d.className,onerror:f.onerror||d.onerror});var c},replace:g,test:function(d){f.lastIndex=0;var u=f.test(d);return f.lastIndex=0,u}},u={"&":"&","<":"<",">":">","'":"'",'"':"""},f=/(?:\ud83d\udc68\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffc-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb\udffd-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb-\udffd\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb-\udffe]|\ud83d\udc68\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc68\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc68\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffc-\udfff]|\ud83e\uddd1\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb\udffd-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb-\udffd\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d[\udc68\udc69]|\ud83e\udef1\ud83c\udffb\u200d\ud83e\udef2\ud83c[\udffc-\udfff]|\ud83e\udef1\ud83c\udffc\u200d\ud83e\udef2\ud83c[\udffb\udffd-\udfff]|\ud83e\udef1\ud83c\udffd\u200d\ud83e\udef2\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\udef1\ud83c\udffe\u200d\ud83e\udef2\ud83c[\udffb-\udffd\udfff]|\ud83e\udef1\ud83c\udfff\u200d\ud83e\udef2\ud83c[\udffb-\udffe]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc68|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d[\udc68\udc69]|\ud83e\uddd1\u200d\ud83e\udd1d\u200d\ud83e\uddd1|\ud83d\udc6b\ud83c[\udffb-\udfff]|\ud83d\udc6c\ud83c[\udffb-\udfff]|\ud83d\udc6d\ud83c[\udffb-\udfff]|\ud83d\udc8f\ud83c[\udffb-\udfff]|\ud83d\udc91\ud83c[\udffb-\udfff]|\ud83e\udd1d\ud83c[\udffb-\udfff]|\ud83d[\udc6b-\udc6d\udc8f\udc91]|\ud83e\udd1d)|(?:\ud83d[\udc68\udc69]|\ud83e\uddd1)(?:\ud83c[\udffb-\udfff])?\u200d(?:\u2695\ufe0f|\u2696\ufe0f|\u2708\ufe0f|\ud83c[\udf3e\udf73\udf7c\udf84\udf93\udfa4\udfa8\udfeb\udfed]|\ud83d[\udcbb\udcbc\udd27\udd2c\ude80\ude92]|\ud83e[\uddaf-\uddb3\uddbc\uddbd])|(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75]|\u26f9)((?:\ud83c[\udffb-\udfff]|\ufe0f)\u200d[\u2640\u2642]\ufe0f)|(?:\ud83c[\udfc3\udfc4\udfca]|\ud83d[\udc6e\udc70\udc71\udc73\udc77\udc81\udc82\udc86\udc87\ude45-\ude47\ude4b\ude4d\ude4e\udea3\udeb4-\udeb6]|\ud83e[\udd26\udd35\udd37-\udd39\udd3d\udd3e\uddb8\uddb9\uddcd-\uddcf\uddd4\uddd6-\udddd])(?:\ud83c[\udffb-\udfff])?\u200d[\u2640\u2642]\ufe0f|(?:\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f|\ud83c\udff3\ufe0f\u200d\ud83c\udf08|\ud83d\ude36\u200d\ud83c\udf2b\ufe0f|\u2764\ufe0f\u200d\ud83d\udd25|\u2764\ufe0f\u200d\ud83e\ude79|\ud83c\udff4\u200d\u2620\ufe0f|\ud83d\udc15\u200d\ud83e\uddba|\ud83d\udc3b\u200d\u2744\ufe0f|\ud83d\udc41\u200d\ud83d\udde8|\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc6f\u200d\u2640\ufe0f|\ud83d\udc6f\u200d\u2642\ufe0f|\ud83d\ude2e\u200d\ud83d\udca8|\ud83d\ude35\u200d\ud83d\udcab|\ud83e\udd3c\u200d\u2640\ufe0f|\ud83e\udd3c\u200d\u2642\ufe0f|\ud83e\uddde\u200d\u2640\ufe0f|\ud83e\uddde\u200d\u2642\ufe0f|\ud83e\udddf\u200d\u2640\ufe0f|\ud83e\udddf\u200d\u2642\ufe0f|\ud83d\udc08\u200d\u2b1b)|[#*0-9]\ufe0f?\u20e3|(?:[©®\u2122\u265f]\ufe0f)|(?:\ud83c[\udc04\udd70\udd71\udd7e\udd7f\ude02\ude1a\ude2f\ude37\udf21\udf24-\udf2c\udf36\udf7d\udf96\udf97\udf99-\udf9b\udf9e\udf9f\udfcd\udfce\udfd4-\udfdf\udff3\udff5\udff7]|\ud83d[\udc3f\udc41\udcfd\udd49\udd4a\udd6f\udd70\udd73\udd76-\udd79\udd87\udd8a-\udd8d\udda5\udda8\uddb1\uddb2\uddbc\uddc2-\uddc4\uddd1-\uddd3\udddc-\uddde\udde1\udde3\udde8\uddef\uddf3\uddfa\udecb\udecd-\udecf\udee0-\udee5\udee9\udef0\udef3]|[\u203c\u2049\u2139\u2194-\u2199\u21a9\u21aa\u231a\u231b\u2328\u23cf\u23ed-\u23ef\u23f1\u23f2\u23f8-\u23fa\u24c2\u25aa\u25ab\u25b6\u25c0\u25fb-\u25fe\u2600-\u2604\u260e\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262a\u262e\u262f\u2638-\u263a\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267b\u267f\u2692-\u2697\u2699\u269b\u269c\u26a0\u26a1\u26a7\u26aa\u26ab\u26b0\u26b1\u26bd\u26be\u26c4\u26c5\u26c8\u26cf\u26d1\u26d3\u26d4\u26e9\u26ea\u26f0-\u26f5\u26f8\u26fa\u26fd\u2702\u2708\u2709\u270f\u2712\u2714\u2716\u271d\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u2764\u27a1\u2934\u2935\u2b05-\u2b07\u2b1b\u2b1c\u2b50\u2b55\u3030\u303d\u3297\u3299])(?:\ufe0f|(?!\ufe0e))|(?:(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75\udd90]|[\u261d\u26f7\u26f9\u270c\u270d])(?:\ufe0f|(?!\ufe0e))|(?:\ud83c[\udf85\udfc2-\udfc4\udfc7\udfca]|\ud83d[\udc42\udc43\udc46-\udc50\udc66-\udc69\udc6e\udc70-\udc78\udc7c\udc81-\udc83\udc85-\udc87\udcaa\udd7a\udd95\udd96\ude45-\ude47\ude4b-\ude4f\udea3\udeb4-\udeb6\udec0\udecc]|\ud83e[\udd0c\udd0f\udd18-\udd1c\udd1e\udd1f\udd26\udd30-\udd39\udd3d\udd3e\udd77\uddb5\uddb6\uddb8\uddb9\uddbb\uddcd-\uddcf\uddd1-\udddd\udec3-\udec5\udef0-\udef6]|[\u270a\u270b]))(?:\ud83c[\udffb-\udfff])?|(?:\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc73\udb40\udc63\udb40\udc74\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc77\udb40\udc6c\udb40\udc73\udb40\udc7f|\ud83c\udde6\ud83c[\udde8-\uddec\uddee\uddf1\uddf2\uddf4\uddf6-\uddfa\uddfc\uddfd\uddff]|\ud83c\udde7\ud83c[\udde6\udde7\udde9-\uddef\uddf1-\uddf4\uddf6-\uddf9\uddfb\uddfc\uddfe\uddff]|\ud83c\udde8\ud83c[\udde6\udde8\udde9\uddeb-\uddee\uddf0-\uddf5\uddf7\uddfa-\uddff]|\ud83c\udde9\ud83c[\uddea\uddec\uddef\uddf0\uddf2\uddf4\uddff]|\ud83c\uddea\ud83c[\udde6\udde8\uddea\uddec\udded\uddf7-\uddfa]|\ud83c\uddeb\ud83c[\uddee-\uddf0\uddf2\uddf4\uddf7]|\ud83c\uddec\ud83c[\udde6\udde7\udde9-\uddee\uddf1-\uddf3\uddf5-\uddfa\uddfc\uddfe]|\ud83c\udded\ud83c[\uddf0\uddf2\uddf3\uddf7\uddf9\uddfa]|\ud83c\uddee\ud83c[\udde8-\uddea\uddf1-\uddf4\uddf6-\uddf9]|\ud83c\uddef\ud83c[\uddea\uddf2\uddf4\uddf5]|\ud83c\uddf0\ud83c[\uddea\uddec-\uddee\uddf2\uddf3\uddf5\uddf7\uddfc\uddfe\uddff]|\ud83c\uddf1\ud83c[\udde6-\udde8\uddee\uddf0\uddf7-\uddfb\uddfe]|\ud83c\uddf2\ud83c[\udde6\udde8-\udded\uddf0-\uddff]|\ud83c\uddf3\ud83c[\udde6\udde8\uddea-\uddec\uddee\uddf1\uddf4\uddf5\uddf7\uddfa\uddff]|\ud83c\uddf4\ud83c\uddf2|\ud83c\uddf5\ud83c[\udde6\uddea-\udded\uddf0-\uddf3\uddf7-\uddf9\uddfc\uddfe]|\ud83c\uddf6\ud83c\udde6|\ud83c\uddf7\ud83c[\uddea\uddf4\uddf8\uddfa\uddfc]|\ud83c\uddf8\ud83c[\udde6-\uddea\uddec-\uddf4\uddf7-\uddf9\uddfb\uddfd-\uddff]|\ud83c\uddf9\ud83c[\udde6\udde8\udde9\uddeb-\udded\uddef-\uddf4\uddf7\uddf9\uddfb\uddfc\uddff]|\ud83c\uddfa\ud83c[\udde6\uddec\uddf2\uddf3\uddf8\uddfe\uddff]|\ud83c\uddfb\ud83c[\udde6\udde8\uddea\uddec\uddee\uddf3\uddfa]|\ud83c\uddfc\ud83c[\uddeb\uddf8]|\ud83c\uddfd\ud83c\uddf0|\ud83c\uddfe\ud83c[\uddea\uddf9]|\ud83c\uddff\ud83c[\udde6\uddf2\uddfc]|\ud83c[\udccf\udd8e\udd91-\udd9a\udde6-\uddff\ude01\ude32-\ude36\ude38-\ude3a\ude50\ude51\udf00-\udf20\udf2d-\udf35\udf37-\udf7c\udf7e-\udf84\udf86-\udf93\udfa0-\udfc1\udfc5\udfc6\udfc8\udfc9\udfcf-\udfd3\udfe0-\udff0\udff4\udff8-\udfff]|\ud83d[\udc00-\udc3e\udc40\udc44\udc45\udc51-\udc65\udc6a\udc6f\udc79-\udc7b\udc7d-\udc80\udc84\udc88-\udc8e\udc90\udc92-\udca9\udcab-\udcfc\udcff-\udd3d\udd4b-\udd4e\udd50-\udd67\udda4\uddfb-\ude44\ude48-\ude4a\ude80-\udea2\udea4-\udeb3\udeb7-\udebf\udec1-\udec5\uded0-\uded2\uded5-\uded7\udedd-\udedf\udeeb\udeec\udef4-\udefc\udfe0-\udfeb\udff0]|\ud83e[\udd0d\udd0e\udd10-\udd17\udd20-\udd25\udd27-\udd2f\udd3a\udd3c\udd3f-\udd45\udd47-\udd76\udd78-\uddb4\uddb7\uddba\uddbc-\uddcc\uddd0\uddde-\uddff\ude70-\ude74\ude78-\ude7c\ude80-\ude86\ude90-\udeac\udeb0-\udeba\udec0-\udec2\uded0-\uded9\udee0-\udee7]|[\u23e9-\u23ec\u23f0\u23f3\u267e\u26ce\u2705\u2728\u274c\u274e\u2753-\u2755\u2795-\u2797\u27b0\u27bf\ue50a])|\ufe0f/g,c=/\uFE0F/g,e=String.fromCharCode(8205),b=/[&<>'"]/g,a=/^(?:iframe|noframes|noscript|script|select|style|textarea)$/,t=String.fromCharCode;return d;function r(d,u){return document.createTextNode(u?d.replace(c,""):d)}function n(d,u){return"".concat(u.base,u.size,"/",d,u.ext)}function o(d,u){for(var f,c,e=d.childNodes,b=e.length;b--;)3===(c=(f=e[b]).nodeType)?u.push(f):1!==c||"ownerSVGElement"in f||a.test(f.nodeName.toLowerCase())||o(f,u);return u}function i(d){return h(d.indexOf(e)<0?d.replace(c,""):d)}function s(d,u){for(var c,e,b,a,t,n,s,l,m,p,g,h,x,y=o(d,[]),v=y.length;v--;){for(b=!1,a=document.createDocumentFragment(),n=(t=y[v]).nodeValue,l=0;s=f.exec(n);){if((m=s.index)!==l&&a.appendChild(r(n.slice(l,m),!0)),h=i(g=s[0]),l=m+g.length,x=u.callback(h,u),h&&x){for(e in(p=new Image).onerror=u.onerror,p.setAttribute("draggable","false"),c=u.attributes(g,h))c.hasOwnProperty(e)&&0!==e.indexOf("on")&&!p.hasAttribute(e)&&p.setAttribute(e,c[e]);p.className=u.className,p.alt=g,p.src=x,b=!0,a.appendChild(p)}p||a.appendChild(r(g,!1)),p=null}b&&(l")}return e}))}function m(d){return u[d]}function p(){return null}function g(d,u){return String(d).replace(f,u)}function h(d,u){for(var f=[],c=0,e=0,b=0;b({setting:"flarum-emoji.cdn",type:"text",label:c().translator.trans("flarum-emoji.admin.settings.cdn_label"),help:c().translator.trans("flarum-emoji.admin.settings.cdn_help",{version:t})})))];c().initializers.add("flarum-emoji",(()=>{}))})(),module.exports=u})(); +//# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/extensions/emoji/js/dist/admin.js.map b/extensions/emoji/js/dist/admin.js.map new file mode 100644 index 0000000000..bbfdce7593 --- /dev/null +++ b/extensions/emoji/js/dist/admin.js.map @@ -0,0 +1 @@ +{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WA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AeE,SAAQ,KAAM,CAC/CA,QAAS,mBACTC,KAAM,OACNC,MAAO,eAAeC,MAAM,yCAC5BC,KAAM,eAAeD,MAAM,uCAAwC,CACjEL,QAASA,SCNb,iBAAiBC,IAAI,gBAAgB,Q","sources":["webpack://@flarum/emoji/webpack/bootstrap","webpack://@flarum/emoji/webpack/runtime/compat get default export","webpack://@flarum/emoji/webpack/runtime/define property getters","webpack://@flarum/emoji/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/emoji/webpack/runtime/make namespace object","webpack://@flarum/emoji/external root \"flarum.reg.get('core', 'admin/app')\"","webpack://@flarum/emoji/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/emoji/../../../node_modules/twemoji/dist/twemoji.esm.js","webpack://@flarum/emoji/./src/common/cdn.js","webpack://@flarum/emoji/./src/admin/extend.tsx","webpack://@flarum/emoji/./src/admin/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'admin/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","/*! Copyright Twitter Inc. and other contributors. Licensed under MIT */\nvar twemoji=function(){\"use strict\";var twemoji={base:\"https://twemoji.maxcdn.com/v/14.0.2/\",ext:\".png\",size:\"72x72\",className:\"emoji\",convert:{fromCodePoint:fromCodePoint,toCodePoint:toCodePoint},onerror:function onerror(){if(this.parentNode){this.parentNode.replaceChild(createText(this.alt,false),this)}},parse:parse,replace:replace,test:test},escaper={\"&\":\"&\",\"<\":\"<\",\">\":\">\",\"'\":\"'\",'\"':\""\"},re=/(?:\\ud83d\\udc68\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83e\\uddd1\\ud83c[\\udffc-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83e\\uddd1\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83e\\uddd1\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83e\\uddd1\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83e\\uddd1\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udffe]|\\ud83d\\udc68\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffb\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffc-\\udfff]|\\ud83d\\udc68\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffc\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83d\\udc68\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffd\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83d\\udc68\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffe\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83d\\udc68\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udfff\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udffe]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffc-\\udfff]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffc-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udffe]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udffe]|\\ud83e\\uddd1\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83e\\uddd1\\ud83c[\\udffc-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffb\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83e\\uddd1\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffc\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83e\\uddd1\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83e\\uddd1\\ud83c\\udffd\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83e\\uddd1\\ud83c\\udffe\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udffe]|\\ud83e\\uddd1\\ud83c\\udfff\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68|\\ud83d\\udc69\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d[\\udc68\\udc69]|\\ud83e\\udef1\\ud83c\\udffb\\u200d\\ud83e\\udef2\\ud83c[\\udffc-\\udfff]|\\ud83e\\udef1\\ud83c\\udffc\\u200d\\ud83e\\udef2\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83e\\udef1\\ud83c\\udffd\\u200d\\ud83e\\udef2\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83e\\udef1\\ud83c\\udffe\\u200d\\ud83e\\udef2\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83e\\udef1\\ud83c\\udfff\\u200d\\ud83e\\udef2\\ud83c[\\udffb-\\udffe]|\\ud83d\\udc68\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68|\\ud83d\\udc69\\u200d\\u2764\\ufe0f\\u200d\\ud83d[\\udc68\\udc69]|\\ud83e\\uddd1\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1|\\ud83d\\udc6b\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc6c\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc6d\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc8f\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc91\\ud83c[\\udffb-\\udfff]|\\ud83e\\udd1d\\ud83c[\\udffb-\\udfff]|\\ud83d[\\udc6b-\\udc6d\\udc8f\\udc91]|\\ud83e\\udd1d)|(?:\\ud83d[\\udc68\\udc69]|\\ud83e\\uddd1)(?:\\ud83c[\\udffb-\\udfff])?\\u200d(?:\\u2695\\ufe0f|\\u2696\\ufe0f|\\u2708\\ufe0f|\\ud83c[\\udf3e\\udf73\\udf7c\\udf84\\udf93\\udfa4\\udfa8\\udfeb\\udfed]|\\ud83d[\\udcbb\\udcbc\\udd27\\udd2c\\ude80\\ude92]|\\ud83e[\\uddaf-\\uddb3\\uddbc\\uddbd])|(?:\\ud83c[\\udfcb\\udfcc]|\\ud83d[\\udd74\\udd75]|\\u26f9)((?:\\ud83c[\\udffb-\\udfff]|\\ufe0f)\\u200d[\\u2640\\u2642]\\ufe0f)|(?:\\ud83c[\\udfc3\\udfc4\\udfca]|\\ud83d[\\udc6e\\udc70\\udc71\\udc73\\udc77\\udc81\\udc82\\udc86\\udc87\\ude45-\\ude47\\ude4b\\ude4d\\ude4e\\udea3\\udeb4-\\udeb6]|\\ud83e[\\udd26\\udd35\\udd37-\\udd39\\udd3d\\udd3e\\uddb8\\uddb9\\uddcd-\\uddcf\\uddd4\\uddd6-\\udddd])(?:\\ud83c[\\udffb-\\udfff])?\\u200d[\\u2640\\u2642]\\ufe0f|(?:\\ud83d\\udc68\\u200d\\ud83d\\udc68\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc68\\u200d\\ud83d\\udc68\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc68\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc69\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc68\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc68\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc69\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc69\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\ud83d\\udc69\\u200d\\ud83d[\\udc66\\udc67]|\\ud83c\\udff3\\ufe0f\\u200d\\u26a7\\ufe0f|\\ud83c\\udff3\\ufe0f\\u200d\\ud83c\\udf08|\\ud83d\\ude36\\u200d\\ud83c\\udf2b\\ufe0f|\\u2764\\ufe0f\\u200d\\ud83d\\udd25|\\u2764\\ufe0f\\u200d\\ud83e\\ude79|\\ud83c\\udff4\\u200d\\u2620\\ufe0f|\\ud83d\\udc15\\u200d\\ud83e\\uddba|\\ud83d\\udc3b\\u200d\\u2744\\ufe0f|\\ud83d\\udc41\\u200d\\ud83d\\udde8|\\ud83d\\udc68\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc6f\\u200d\\u2640\\ufe0f|\\ud83d\\udc6f\\u200d\\u2642\\ufe0f|\\ud83d\\ude2e\\u200d\\ud83d\\udca8|\\ud83d\\ude35\\u200d\\ud83d\\udcab|\\ud83e\\udd3c\\u200d\\u2640\\ufe0f|\\ud83e\\udd3c\\u200d\\u2642\\ufe0f|\\ud83e\\uddde\\u200d\\u2640\\ufe0f|\\ud83e\\uddde\\u200d\\u2642\\ufe0f|\\ud83e\\udddf\\u200d\\u2640\\ufe0f|\\ud83e\\udddf\\u200d\\u2642\\ufe0f|\\ud83d\\udc08\\u200d\\u2b1b)|[#*0-9]\\ufe0f?\\u20e3|(?:[©®\\u2122\\u265f]\\ufe0f)|(?:\\ud83c[\\udc04\\udd70\\udd71\\udd7e\\udd7f\\ude02\\ude1a\\ude2f\\ude37\\udf21\\udf24-\\udf2c\\udf36\\udf7d\\udf96\\udf97\\udf99-\\udf9b\\udf9e\\udf9f\\udfcd\\udfce\\udfd4-\\udfdf\\udff3\\udff5\\udff7]|\\ud83d[\\udc3f\\udc41\\udcfd\\udd49\\udd4a\\udd6f\\udd70\\udd73\\udd76-\\udd79\\udd87\\udd8a-\\udd8d\\udda5\\udda8\\uddb1\\uddb2\\uddbc\\uddc2-\\uddc4\\uddd1-\\uddd3\\udddc-\\uddde\\udde1\\udde3\\udde8\\uddef\\uddf3\\uddfa\\udecb\\udecd-\\udecf\\udee0-\\udee5\\udee9\\udef0\\udef3]|[\\u203c\\u2049\\u2139\\u2194-\\u2199\\u21a9\\u21aa\\u231a\\u231b\\u2328\\u23cf\\u23ed-\\u23ef\\u23f1\\u23f2\\u23f8-\\u23fa\\u24c2\\u25aa\\u25ab\\u25b6\\u25c0\\u25fb-\\u25fe\\u2600-\\u2604\\u260e\\u2611\\u2614\\u2615\\u2618\\u2620\\u2622\\u2623\\u2626\\u262a\\u262e\\u262f\\u2638-\\u263a\\u2640\\u2642\\u2648-\\u2653\\u2660\\u2663\\u2665\\u2666\\u2668\\u267b\\u267f\\u2692-\\u2697\\u2699\\u269b\\u269c\\u26a0\\u26a1\\u26a7\\u26aa\\u26ab\\u26b0\\u26b1\\u26bd\\u26be\\u26c4\\u26c5\\u26c8\\u26cf\\u26d1\\u26d3\\u26d4\\u26e9\\u26ea\\u26f0-\\u26f5\\u26f8\\u26fa\\u26fd\\u2702\\u2708\\u2709\\u270f\\u2712\\u2714\\u2716\\u271d\\u2721\\u2733\\u2734\\u2744\\u2747\\u2757\\u2763\\u2764\\u27a1\\u2934\\u2935\\u2b05-\\u2b07\\u2b1b\\u2b1c\\u2b50\\u2b55\\u3030\\u303d\\u3297\\u3299])(?:\\ufe0f|(?!\\ufe0e))|(?:(?:\\ud83c[\\udfcb\\udfcc]|\\ud83d[\\udd74\\udd75\\udd90]|[\\u261d\\u26f7\\u26f9\\u270c\\u270d])(?:\\ufe0f|(?!\\ufe0e))|(?:\\ud83c[\\udf85\\udfc2-\\udfc4\\udfc7\\udfca]|\\ud83d[\\udc42\\udc43\\udc46-\\udc50\\udc66-\\udc69\\udc6e\\udc70-\\udc78\\udc7c\\udc81-\\udc83\\udc85-\\udc87\\udcaa\\udd7a\\udd95\\udd96\\ude45-\\ude47\\ude4b-\\ude4f\\udea3\\udeb4-\\udeb6\\udec0\\udecc]|\\ud83e[\\udd0c\\udd0f\\udd18-\\udd1c\\udd1e\\udd1f\\udd26\\udd30-\\udd39\\udd3d\\udd3e\\udd77\\uddb5\\uddb6\\uddb8\\uddb9\\uddbb\\uddcd-\\uddcf\\uddd1-\\udddd\\udec3-\\udec5\\udef0-\\udef6]|[\\u270a\\u270b]))(?:\\ud83c[\\udffb-\\udfff])?|(?:\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc65\\udb40\\udc6e\\udb40\\udc67\\udb40\\udc7f|\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc73\\udb40\\udc63\\udb40\\udc74\\udb40\\udc7f|\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc77\\udb40\\udc6c\\udb40\\udc73\\udb40\\udc7f|\\ud83c\\udde6\\ud83c[\\udde8-\\uddec\\uddee\\uddf1\\uddf2\\uddf4\\uddf6-\\uddfa\\uddfc\\uddfd\\uddff]|\\ud83c\\udde7\\ud83c[\\udde6\\udde7\\udde9-\\uddef\\uddf1-\\uddf4\\uddf6-\\uddf9\\uddfb\\uddfc\\uddfe\\uddff]|\\ud83c\\udde8\\ud83c[\\udde6\\udde8\\udde9\\uddeb-\\uddee\\uddf0-\\uddf5\\uddf7\\uddfa-\\uddff]|\\ud83c\\udde9\\ud83c[\\uddea\\uddec\\uddef\\uddf0\\uddf2\\uddf4\\uddff]|\\ud83c\\uddea\\ud83c[\\udde6\\udde8\\uddea\\uddec\\udded\\uddf7-\\uddfa]|\\ud83c\\uddeb\\ud83c[\\uddee-\\uddf0\\uddf2\\uddf4\\uddf7]|\\ud83c\\uddec\\ud83c[\\udde6\\udde7\\udde9-\\uddee\\uddf1-\\uddf3\\uddf5-\\uddfa\\uddfc\\uddfe]|\\ud83c\\udded\\ud83c[\\uddf0\\uddf2\\uddf3\\uddf7\\uddf9\\uddfa]|\\ud83c\\uddee\\ud83c[\\udde8-\\uddea\\uddf1-\\uddf4\\uddf6-\\uddf9]|\\ud83c\\uddef\\ud83c[\\uddea\\uddf2\\uddf4\\uddf5]|\\ud83c\\uddf0\\ud83c[\\uddea\\uddec-\\uddee\\uddf2\\uddf3\\uddf5\\uddf7\\uddfc\\uddfe\\uddff]|\\ud83c\\uddf1\\ud83c[\\udde6-\\udde8\\uddee\\uddf0\\uddf7-\\uddfb\\uddfe]|\\ud83c\\uddf2\\ud83c[\\udde6\\udde8-\\udded\\uddf0-\\uddff]|\\ud83c\\uddf3\\ud83c[\\udde6\\udde8\\uddea-\\uddec\\uddee\\uddf1\\uddf4\\uddf5\\uddf7\\uddfa\\uddff]|\\ud83c\\uddf4\\ud83c\\uddf2|\\ud83c\\uddf5\\ud83c[\\udde6\\uddea-\\udded\\uddf0-\\uddf3\\uddf7-\\uddf9\\uddfc\\uddfe]|\\ud83c\\uddf6\\ud83c\\udde6|\\ud83c\\uddf7\\ud83c[\\uddea\\uddf4\\uddf8\\uddfa\\uddfc]|\\ud83c\\uddf8\\ud83c[\\udde6-\\uddea\\uddec-\\uddf4\\uddf7-\\uddf9\\uddfb\\uddfd-\\uddff]|\\ud83c\\uddf9\\ud83c[\\udde6\\udde8\\udde9\\uddeb-\\udded\\uddef-\\uddf4\\uddf7\\uddf9\\uddfb\\uddfc\\uddff]|\\ud83c\\uddfa\\ud83c[\\udde6\\uddec\\uddf2\\uddf3\\uddf8\\uddfe\\uddff]|\\ud83c\\uddfb\\ud83c[\\udde6\\udde8\\uddea\\uddec\\uddee\\uddf3\\uddfa]|\\ud83c\\uddfc\\ud83c[\\uddeb\\uddf8]|\\ud83c\\uddfd\\ud83c\\uddf0|\\ud83c\\uddfe\\ud83c[\\uddea\\uddf9]|\\ud83c\\uddff\\ud83c[\\udde6\\uddf2\\uddfc]|\\ud83c[\\udccf\\udd8e\\udd91-\\udd9a\\udde6-\\uddff\\ude01\\ude32-\\ude36\\ude38-\\ude3a\\ude50\\ude51\\udf00-\\udf20\\udf2d-\\udf35\\udf37-\\udf7c\\udf7e-\\udf84\\udf86-\\udf93\\udfa0-\\udfc1\\udfc5\\udfc6\\udfc8\\udfc9\\udfcf-\\udfd3\\udfe0-\\udff0\\udff4\\udff8-\\udfff]|\\ud83d[\\udc00-\\udc3e\\udc40\\udc44\\udc45\\udc51-\\udc65\\udc6a\\udc6f\\udc79-\\udc7b\\udc7d-\\udc80\\udc84\\udc88-\\udc8e\\udc90\\udc92-\\udca9\\udcab-\\udcfc\\udcff-\\udd3d\\udd4b-\\udd4e\\udd50-\\udd67\\udda4\\uddfb-\\ude44\\ude48-\\ude4a\\ude80-\\udea2\\udea4-\\udeb3\\udeb7-\\udebf\\udec1-\\udec5\\uded0-\\uded2\\uded5-\\uded7\\udedd-\\udedf\\udeeb\\udeec\\udef4-\\udefc\\udfe0-\\udfeb\\udff0]|\\ud83e[\\udd0d\\udd0e\\udd10-\\udd17\\udd20-\\udd25\\udd27-\\udd2f\\udd3a\\udd3c\\udd3f-\\udd45\\udd47-\\udd76\\udd78-\\uddb4\\uddb7\\uddba\\uddbc-\\uddcc\\uddd0\\uddde-\\uddff\\ude70-\\ude74\\ude78-\\ude7c\\ude80-\\ude86\\ude90-\\udeac\\udeb0-\\udeba\\udec0-\\udec2\\uded0-\\uded9\\udee0-\\udee7]|[\\u23e9-\\u23ec\\u23f0\\u23f3\\u267e\\u26ce\\u2705\\u2728\\u274c\\u274e\\u2753-\\u2755\\u2795-\\u2797\\u27b0\\u27bf\\ue50a])|\\ufe0f/g,UFE0Fg=/\\uFE0F/g,U200D=String.fromCharCode(8205),rescaper=/[&<>'\"]/g,shouldntBeParsed=/^(?:iframe|noframes|noscript|script|select|style|textarea)$/,fromCharCode=String.fromCharCode;return twemoji;function createText(text,clean){return document.createTextNode(clean?text.replace(UFE0Fg,\"\"):text)}function escapeHTML(s){return s.replace(rescaper,replacer)}function defaultImageSrcGenerator(icon,options){return\"\".concat(options.base,options.size,\"/\",icon,options.ext)}function grabAllTextNodes(node,allText){var childNodes=node.childNodes,length=childNodes.length,subnode,nodeType;while(length--){subnode=childNodes[length];nodeType=subnode.nodeType;if(nodeType===3){allText.push(subnode)}else if(nodeType===1&&!(\"ownerSVGElement\"in subnode)&&!shouldntBeParsed.test(subnode.nodeName.toLowerCase())){grabAllTextNodes(subnode,allText)}}return allText}function grabTheRightIcon(rawText){return toCodePoint(rawText.indexOf(U200D)<0?rawText.replace(UFE0Fg,\"\"):rawText)}function parseNode(node,options){var allText=grabAllTextNodes(node,[]),length=allText.length,attrib,attrname,modified,fragment,subnode,text,match,i,index,img,rawText,iconId,src;while(length--){modified=false;fragment=document.createDocumentFragment();subnode=allText[length];text=subnode.nodeValue;i=0;while(match=re.exec(text)){index=match.index;if(index!==i){fragment.appendChild(createText(text.slice(i,index),true))}rawText=match[0];iconId=grabTheRightIcon(rawText);i=index+rawText.length;src=options.callback(iconId,options);if(iconId&&src){img=new Image;img.onerror=options.onerror;img.setAttribute(\"draggable\",\"false\");attrib=options.attributes(rawText,iconId);for(attrname in attrib){if(attrib.hasOwnProperty(attrname)&&attrname.indexOf(\"on\")!==0&&!img.hasAttribute(attrname)){img.setAttribute(attrname,attrib[attrname])}}img.className=options.className;img.alt=rawText;img.src=src;modified=true;fragment.appendChild(img)}if(!img)fragment.appendChild(createText(rawText,false));img=null}if(modified){if(i\")}return ret})}function replacer(m){return escaper[m]}function returnNull(){return null}function toSizeSquaredAsset(value){return typeof value===\"number\"?value+\"x\"+value:value}function fromCodePoint(codepoint){var code=typeof codepoint===\"string\"?parseInt(codepoint,16):codepoint;if(code<65536){return fromCharCode(code)}code-=65536;return fromCharCode(55296+(code>>10),56320+(code&1023))}function parse(what,how){if(!how||typeof how===\"function\"){how={callback:how}}return(typeof what===\"string\"?parseString:parseNode)(what,{callback:how.callback||defaultImageSrcGenerator,attributes:typeof how.attributes===\"function\"?how.attributes:returnNull,base:typeof how.base===\"string\"?how.base:twemoji.base,ext:how.ext||twemoji.ext,size:how.folder||toSizeSquaredAsset(how.size||twemoji.size),className:how.className||twemoji.className,onerror:how.onerror||twemoji.onerror})}function replace(text,callback){return String(text).replace(re,callback)}function test(text){re.lastIndex=0;var result=re.test(text);re.lastIndex=0;return result}function toCodePoint(unicodeSurrogates,sep){var r=[],c=0,p=0,i=0;while(i ({\n setting: 'flarum-emoji.cdn',\n type: 'text',\n label: app.translator.trans('flarum-emoji.admin.settings.cdn_label'),\n help: app.translator.trans('flarum-emoji.admin.settings.cdn_help', {\n version: version\n })\n}))];","import app from 'flarum/admin/app';\nexport { default as extend } from './extend';\napp.initializers.add('flarum-emoji', () => {\n // ...\n});"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","reg","twemoji","base","ext","size","className","convert","fromCodePoint","codepoint","code","parseInt","fromCharCode","toCodePoint","onerror","this","parentNode","replaceChild","createText","alt","parse","what","how","callback","parseString","parseNode","defaultImageSrcGenerator","attributes","returnNull","folder","replace","test","text","re","lastIndex","result","escaper","UFE0Fg","U200D","String","rescaper","shouldntBeParsed","clean","document","createTextNode","icon","options","concat","grabAllTextNodes","node","allText","subnode","nodeType","childNodes","length","push","nodeName","toLowerCase","grabTheRightIcon","rawText","indexOf","attrib","attrname","modified","fragment","match","i","index","img","iconId","src","createDocumentFragment","nodeValue","exec","appendChild","slice","Image","setAttribute","hasAttribute","str","ret","replacer","m","unicodeSurrogates","sep","r","c","p","charCodeAt","toString","join","version","add","setting","type","label","trans","help"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/emoji/js/dist/forum.js b/extensions/emoji/js/dist/forum.js index 1524427255..a86ae14629 100644 --- a/extensions/emoji/js/dist/forum.js +++ b/extensions/emoji/js/dist/forum.js @@ -1,3 +1,3 @@ /*! For license information please see forum.js.LICENSE.txt */ -(()=>{var d={n:e=>{var u=e&&e.__esModule?()=>e.default:()=>e;return d.d(u,{a:u}),u},d:(e,u)=>{for(var a in u)d.o(u,a)&&!d.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:u[a]})},o:(d,e)=>Object.prototype.hasOwnProperty.call(d,e),r:d=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(d,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(d,"__esModule",{value:!0})}},e={};(()=>{"use strict";d.r(e);const u=flarum.core.compat["forum/app"];var a=d.n(u);const n=JSON.parse('{"🇦":["regional_indicator_a"],"🇧":["regional_indicator_b"],"🇨":["regional_indicator_c"],"🇩":["regional_indicator_d"],"🇪":["regional_indicator_e"],"🇫":["regional_indicator_f"],"🇬":["regional_indicator_g"],"🇭":["regional_indicator_h"],"🇮":["regional_indicator_i"],"🇯":["regional_indicator_j"],"🇰":["regional_indicator_k"],"🇱":["regional_indicator_l"],"🇲":["regional_indicator_m"],"🇳":["regional_indicator_n"],"🇴":["regional_indicator_o"],"🇵":["regional_indicator_p"],"🇶":["regional_indicator_q"],"🇷":["regional_indicator_r"],"🇸":["regional_indicator_s"],"🇹":["regional_indicator_t"],"🇺":["regional_indicator_u"],"🇻":["regional_indicator_v"],"🇼":["regional_indicator_w"],"🇽":["regional_indicator_x"],"🇾":["regional_indicator_y"],"🇿":["regional_indicator_z"],"😀":["grinning","grinning_face"],"😃":["grinning_face_with_big_eyes","smiley"],"😄":["grinning_face_with_closed_eyes","smile"],"😁":["beaming_face","grin"],"😆":["laughing","lol","satisfied","squinting_face"],"😅":["grinning_face_with_sweat","sweat_smile"],"🤣":["rofl"],"😂":["joy","lmao","tears_of_joy"],"🙂":["slightly_smiling_face"],"🙃":["upside_down_face"],"🫠":["melt","melting_face"],"😉":["wink","winking_face"],"😊":["blush","smiling_face_with_closed_eyes"],"😇":["halo","innocent"],"🥰":["smiling_face_with_3_hearts"],"😍":["heart_eyes","smiling_face_with_heart_eyes"],"🤩":["star_struck"],"😘":["blowing_a_kiss","kissing_heart"],"😗":["kissing","kissing_face"],"☺️":["relaxed","smiling_face"],"😚":["kissing_closed_eyes","kissing_face_with_closed_eyes"],"😙":["kissing_face_with_smiling_eyes","kissing_smiling_eyes"],"🥲":["smiling_face_with_tear"],"😋":["savoring_food","yum"],"😛":["face_with_tongue","stuck_out_tongue"],"😜":["stuck_out_tongue_winking_eye"],"🤪":["zany","zany_face"],"😝":["stuck_out_tongue_closed_eyes"],"🤑":["money_mouth_face"],"🤗":["hug","hugging","hugging_face"],"🤭":["face_with_hand_over_mouth","hand_over_mouth"],"🫢":["face_with_open_eyes_hand_over_mouth","gasp"],"🫣":["face_with_peeking_eye","peek"],"🤫":["shush","shushing_face"],"🤔":["thinking","thinking_face","wtf"],"🫡":["salute","saluting_face"],"🤐":["zipper_mouth","zipper_mouth_face"],"🤨":["face_with_raised_eyebrow","raised_eyebrow"],"😐️":["neutral","neutral_face"],"😑":["expressionless","expressionless_face"],"😶":["no_mouth"],"🫥":["dotted_line_face"],"😶‍🌫️":["in_clouds"],"😏":["smirk","smirking","smirking_face"],"😒":["unamused","unamused_face"],"🙄":["rolling_eyes"],"😬":["grimacing","grimacing_face"],"😮‍💨":["exhale","exhaling"],"🤥":["lying","lying_face"],"😌":["relieved","relieved_face"],"😔":["pensive","pensive_face"],"😪":["sleepy","sleepy_face"],"🤤":["drooling","drooling_face"],"😴":["sleeping","sleeping_face"],"😷":["mask","medical_mask"],"🤒":["face_with_thermometer"],"🤕":["face_with_head_bandage"],"🤢":["nauseated","nauseated_face"],"🤮":["face_vomiting","vomiting"],"🤧":["sneezing","sneezing_face"],"🥵":["hot","hot_face"],"🥶":["cold","cold_face"],"🥴":["woozy","woozy_face"],"😵":["dizzy_face","knocked_out"],"😵‍💫":["dizzy_eyes"],"🤯":["exploding_head"],"🤠":["cowboy","cowboy_face"],"🥳":["hooray","partying","partying_face"],"🥸":["disguised","disguised_face"],"😎":["smiling_face_with_sunglasses","sunglasses_cool","too_cool"],"🤓":["nerd","nerd_face"],"🧐":["face_with_monocle"],"😕":["confused","confused_face"],"🫤":["face_with_diagonal_mouth"],"😟":["worried","worried_face"],"🙁":["slightly_frowning_face"],"☹️":["white_frowning_face"],"😮":["face_with_open_mouth","open_mouth"],"😯":["hushed","hushed_face"],"😲":["astonished","astonished_face"],"😳":["flushed","flushed_face"],"🥺":["pleading","pleading_face"],"🥹":["face_holding_back_tears","watery_eyes"],"😦":["frowning","frowning_face"],"😧":["anguished","anguished_face"],"😨":["fearful","fearful_face"],"😰":["anxious","anxious_face","cold_sweat"],"😥":["disappointed_relieved","sad_relieved_face"],"😢":["cry","crying_face"],"😭":["loudly_crying_face","sob"],"😱":["scream","screaming_in_fear"],"😖":["confounded","confounded_face"],"😣":["persevere","persevering_face"],"😞":["disappointed","disappointed_face"],"😓":["downcast_face","sweat"],"😩":["weary","weary_face"],"😫":["tired","tired_face"],"🥱":["yawn","yawning","yawning_face"],"😤":["nose_steam","triumph"],"😡":["pout","pouting_face","rage"],"😠":["angry","angry_face"],"🤬":["censored","face_with_symbols_on_mouth"],"😈":["smiling_imp"],"👿":["angry_imp","imp"],"💀":["skull"],"☠️":["skull_and_crossbones"],"💩":["poop","shit"],"🤡":["clown","clown_face"],"👹":["japanese_ogre","ogre"],"👺":["goblin","japanese_goblin"],"👻":["ghost"],"👽️":["alien"],"👾":["alien_monster","space_invader"],"🤖":["robot","robot_face"],"😺":["grinning_cat","smiley_cat"],"😸":["grinning_cat_with_closed_eyes","smile_cat"],"😹":["joy_cat","tears_of_joy_cat"],"😻":["heart_eyes_cat","smiling_cat_with_heart_eyes"],"😼":["smirk_cat","wry_smile_cat"],"😽":["kissing_cat"],"🙀":["scream_cat","weary_cat"],"😿":["crying_cat"],"😾":["pouting_cat"],"🙈":["see_no_evil"],"🙉":["hear_no_evil"],"🙊":["speak_no_evil"],"💋":["kiss"],"💌":["love_letter"],"💘":["cupid","heart_with_arrow"],"💝":["gift_heart","heart_with_ribbon"],"💖":["sparkling_heart"],"💗":["growing_heart","heartpulse"],"💓":["beating_heart","heartbeat"],"💞":["revolving_hearts"],"💕":["two_hearts"],"💟":["heart_decoration"],"❣️":["heart_exclamation"],"💔":["broken_heart"],"❤️‍🔥":["heart_on_fire"],"❤️‍🩹":["mending_heart"],"❤️":["heart","red_heart"],"🧡":["orange_heart"],"💛":["yellow_heart"],"💚":["green_heart"],"💙":["blue_heart"],"💜":["purple_heart"],"🤎":["brown_heart"],"🖤":["black_heart"],"🤍":["white_heart"],"💯":["100"],"💢":["anger"],"💥":["boom","collision"],"💫":["dizzy"],"💦":["sweat_drops"],"💨":["dash","dashing_away"],"🕳️":["hole"],"💣️":["bomb"],"💬":["speech_balloon"],"👁‍🗨":["eye_in_speech_bubble"],"🗨️":["left_speech_bubble"],"🗯️":["right_anger_bubble"],"💭":["thought_balloon"],"💤":["zzz"],"👋":["wave","waving_hand"],"🤚":["raised_back_of_hand"],"🖐️":["raised_hand_with_fingers_splayed"],"✋":["high_five","raised_hand"],"🖖":["vulcan"],"🫱":["rightwards_hand"],"🫲":["leftwards_hand"],"🫳":["palm_down"],"🫴":["palm_up"],"👌":["ok_hand"],"🤌":["pinch","pinched_fingers"],"🤏":["pinching_hand"],"✌️":["v","victory"],"🤞":["fingers_crossed"],"🫰":["hand_with_index_finger_and_thumb_crossed"],"🤟":["love_you_gesture"],"🤘":["metal","sign_of_the_horns"],"🤙":["call_me_hand"],"👈️":["point_left"],"👉️":["point_right"],"👆️":["point_up"],"🖕":["middle_finger"],"👇️":["point_down"],"☝️":["point_up_2"],"🫵":["point_forward"],"👍️":["+1","thumbsup","yes"],"👎️":["-1","no","thumbsdown"],"✊":["fist"],"👊":["punch"],"🤛":["left_facing_fist"],"🤜":["right_facing_fist"],"👏":["clap","clapping_hands"],"🙌":["raised_hands"],"🫶":["heart_hands"],"👐":["open_hands"],"🤲":["palms_up_together"],"🤝":["handshake"],"🙏":["folded_hands","pray"],"✍️":["writing_hand"],"💅":["nail_care","nail_polish"],"🤳":["selfie"],"💪":["muscle","right_bicep"],"🦾":["mechanical_arm"],"🦿":["mechanical_leg"],"🦵":["leg"],"🦶":["foot"],"👂️":["ear"],"🦻":["ear_with_hearing_aid","hearing_aid"],"👃":["nose"],"🧠":["brain"],"🫀":["anatomical_heart"],"🫁":["lungs"],"🦷":["tooth"],"🦴":["bone"],"👀":["eyes"],"👁️":["eye"],"👅":["tongue"],"👄":["lips","mouth"],"🫦":["biting_lip"],"👶":["baby"],"🧒":["child"],"👦":["boy"],"👧":["girl"],"🧑":["adult"],"👱":["blond_haired"],"👨":["man"],"🧔":["person_bearded"],"🧔‍♂️":["man_bearded"],"🧔‍♀️":["woman_bearded"],"👨‍🦰":["man_red_haired"],"👨‍🦱":["man_curly_haired"],"👨‍🦳":["man_white_haired"],"👨‍🦲":["man_bald"],"👩":["woman"],"👩‍🦰":["woman_red_haired"],"🧑‍🦰":["red_haired"],"👩‍🦱":["woman_curly_haired"],"🧑‍🦱":["curly_haired"],"👩‍🦳":["woman_white_haired"],"🧑‍🦳":["white_haired"],"👩‍🦲":["woman_bald"],"🧑‍🦲":["bald"],"👱‍♀️":["woman_blond_haired"],"👱‍♂️":["man_blond_haired"],"🧓":["older_adult"],"👴":["older_man"],"👵":["older_woman"],"🙍":["person_frowning"],"🙍‍♂️":["man_frowning"],"🙍‍♀️":["woman_frowning"],"🙎":["person_pouting","pouting"],"🙎‍♂️":["man_pouting"],"🙎‍♀️":["woman_pouting"],"🙅":["no_good","person_gesturing_no"],"🙅‍♂️":["man_gesturing_no"],"🙅‍♀️":["woman_gesturing_no"],"🙆":["all_good","person_gesturing_ok"],"🙆‍♂️":["man_gesturing_ok"],"🙆‍♀️":["woman_gesturing_ok"],"💁":["person_tipping_hand"],"💁‍♂️":["man_tipping_hand"],"💁‍♀️":["woman_tipping_hand"],"🙋":["person_raising_hand"],"🙋‍♂️":["man_raising_hand"],"🙋‍♀️":["woman_raising_hand"],"🧏":["deaf_person"],"🧏‍♂️":["deaf_man"],"🧏‍♀️":["deaf_woman"],"🙇":["bow","person_bowing"],"🙇‍♂️":["man_bowing"],"🙇‍♀️":["woman_bowing"],"🤦":["facepalm","person_facepalming"],"🤦‍♂️":["man_facepalming"],"🤦‍♀️":["woman_facepalming"],"🤷":["person_shrugging","shrug"],"🤷‍♂️":["man_shrugging"],"🤷‍♀️":["woman_shrugging"],"🧑‍⚕️":["health_worker"],"👨‍⚕️":["man_health_worker"],"👩‍⚕️":["woman_health_worker"],"🧑‍🎓":["student"],"👨‍🎓":["man_student"],"👩‍🎓":["woman_student"],"🧑‍🏫":["teacher"],"👨‍🏫":["man_teacher"],"👩‍🏫":["woman_teacher"],"🧑‍⚖️":["judge"],"👨‍⚖️":["man_judge"],"👩‍⚖️":["woman_judge"],"🧑‍🌾":["farmer"],"👨‍🌾":["man_farmer"],"👩‍🌾":["woman_farmer"],"🧑‍🍳":["cook"],"👨‍🍳":["man_cook"],"👩‍🍳":["woman_cook"],"🧑‍🔧":["mechanic"],"👨‍🔧":["man_mechanic"],"👩‍🔧":["woman_mechanic"],"🧑‍🏭":["factory_worker"],"👨‍🏭":["man_factory_worker"],"👩‍🏭":["woman_factory_worker"],"🧑‍💼":["office_worker"],"👨‍💼":["man_office_worker"],"👩‍💼":["woman_office_worker"],"🧑‍🔬":["scientist"],"👨‍🔬":["man_scientist"],"👩‍🔬":["woman_scientist"],"🧑‍💻":["technologist"],"👨‍💻":["man_technologist"],"👩‍💻":["woman_technologist"],"🧑‍🎤":["singer"],"👨‍🎤":["man_singer"],"👩‍🎤":["woman_singer"],"🧑‍🎨":["artist"],"👨‍🎨":["man_artist"],"👩‍🎨":["woman_artist"],"🧑‍✈️":["pilot"],"👨‍✈️":["man_pilot"],"👩‍✈️":["woman_pilot"],"🧑‍🚀":["astronaut"],"👨‍🚀":["man_astronaut"],"👩‍🚀":["woman_astronaut"],"🧑‍🚒":["firefighter"],"👨‍🚒":["man_firefighter"],"👩‍🚒":["woman_firefighter"],"👮":["cop","police_officer"],"👮‍♂️":["man_police_officer"],"👮‍♀️":["woman_police_officer"],"🕵️":["detective"],"🕵️‍♂️":["man_detective"],"🕵️‍♀️":["woman_detective"],"💂":["guard"],"💂‍♂️":["man_guard"],"💂‍♀️":["woman_guard"],"🥷":["ninja"],"👷":["construction_worker"],"👷‍♂️":["man_construction_worker"],"👷‍♀️":["woman_construction_worker"],"🫅":["person_with_crown","royalty"],"🤴":["prince"],"👸":["princess"],"👳":["person_wearing_turban"],"👳‍♂️":["man_wearing_turban"],"👳‍♀️":["woman_wearing_turban"],"👲":["person_with_skullcap"],"🧕":["woman_with_headscarf"],"🤵":["person_in_tuxedo"],"🤵‍♂️":["man_in_tuxedo"],"🤵‍♀️":["woman_in_tuxedo"],"👰":["person_with_veil"],"👰‍♂️":["man_with_veil"],"👰‍♀️":["woman_with_veil"],"🤰":["pregnant_woman"],"🫃":["pregnant_man"],"🫄":["pregnant_person"],"🤱":["breast_feeding"],"👩‍🍼":["woman_feeding_baby"],"👨‍🍼":["man_feeding_baby"],"🧑‍🍼":["person_feeding_baby"],"👼":["angel"],"🎅":["santa"],"🤶":["mrs_claus"],"🧑‍🎄":["mx_claus"],"🦸":["superhero"],"🦸‍♂️":["man_superhero"],"🦸‍♀️":["woman_superhero"],"🦹":["supervillain"],"🦹‍♂️":["man_supervillain"],"🦹‍♀️":["woman_supervillain"],"🧙":["mage"],"🧙‍♂️":["man_mage"],"🧙‍♀️":["woman_mage"],"🧚":["fairy"],"🧚‍♂️":["man_fairy"],"🧚‍♀️":["woman_fairy"],"🧛":["vampire"],"🧛‍♂️":["man_vampire"],"🧛‍♀️":["woman_vampire"],"🧜":["merperson"],"🧜‍♂️":["merman"],"🧜‍♀️":["mermaid"],"🧝":["elf"],"🧝‍♂️":["man_elf"],"🧝‍♀️":["woman_elf"],"🧞":["genie"],"🧞‍♂️":["man_genie"],"🧞‍♀️":["woman_genie"],"🧟":["zombie"],"🧟‍♂️":["man_zombie"],"🧟‍♀️":["woman_zombie"],"🧌":["troll"],"💆":["massage","person_getting_massage"],"💆‍♂️":["man_getting_massage"],"💆‍♀️":["woman_getting_massage"],"💇":["haircut","person_getting_haircut"],"💇‍♂️":["man_getting_haircut"],"💇‍♀️":["woman_getting_haircut"],"🚶":["person_walking","walking"],"🚶‍♂️":["man_walking"],"🚶‍♀️":["woman_walking"],"🧍":["person_standing","standing"],"🧍‍♂️":["man_standing"],"🧍‍♀️":["woman_standing"],"🧎":["kneeling","person_kneeling"],"🧎‍♂️":["man_kneeling"],"🧎‍♀️":["woman_kneeling"],"🧑‍🦯":["person_with_probing_cane","person_with_white_cane"],"👨‍🦯":["man_with_probing_cane","man_with_white_cane"],"👩‍🦯":["woman_with_probing_cane","woman_with_white_cane"],"🧑‍🦼":["person_in_motorized_wheelchair"],"👨‍🦼":["man_in_motorized_wheelchair"],"👩‍🦼":["woman_in_motorized_wheelchair"],"🧑‍🦽":["person_in_manual_wheelchair"],"👨‍🦽":["man_in_manual_wheelchair"],"👩‍🦽":["woman_in_manual_wheelchair"],"🏃":["person_running","running"],"🏃‍♂️":["man_running"],"🏃‍♀️":["woman_running"],"💃":["dancer","woman_dancing"],"🕺":["man_dancing"],"🕴️":["levitate","levitating","person_in_suit_levitating"],"👯":["dancers","people_with_bunny_ears_partying"],"👯‍♂️":["men_with_bunny_ears_partying"],"👯‍♀️":["women_with_bunny_ears_partying"],"🧖":["person_in_steamy_room"],"🧖‍♂️":["man_in_steamy_room"],"🧖‍♀️":["woman_in_steamy_room"],"🧗":["climbing","person_climbing"],"🧗‍♂️":["man_climbing"],"🧗‍♀️":["woman_climbing"],"🤺":["fencer","fencing","person_fencing"],"🏇":["horse_racing"],"⛷️":["person_skiing","skier","skiing"],"🏂️":["person_snowboarding","snowboarder","snowboarding"],"🏌️":["golfer","golfing","person_golfing"],"🏌️‍♂️":["man_golfing"],"🏌️‍♀️":["woman_golfing"],"🏄️":["person_surfing","surfer","surfing"],"🏄‍♂️":["man_surfing"],"🏄‍♀️":["woman_surfing"],"🚣":["person_rowing_boat","rowboat"],"🚣‍♂️":["man_rowing_boat"],"🚣‍♀️":["woman_rowing_boat"],"🏊️":["person_swimming","swimmer","swimming"],"🏊‍♂️":["man_swimming"],"🏊‍♀️":["woman_swimming"],"⛹️":["person_bouncing_ball"],"⛹️‍♂️":["man_bouncing_ball"],"⛹️‍♀️":["woman_bouncing_ball"],"🏋️":["person_lifting_weights","weight_lifter","weight_lifting"],"🏋️‍♂️":["man_lifting_weights"],"🏋️‍♀️":["woman_lifting_weights"],"🚴":["bicyclist","biking","person_biking"],"🚴‍♂️":["man_biking"],"🚴‍♀️":["woman_biking"],"🚵":["mountain_bicyclist","mountain_biking","person_mountain_biking"],"🚵‍♂️":["man_mountain_biking"],"🚵‍♀️":["woman_mountain_biking"],"🤸":["cartwheeling","person_cartwheel"],"🤸‍♂️":["man_cartwheeling"],"🤸‍♀️":["woman_cartwheeling"],"🤼":["people_wrestling","wrestlers","wrestling"],"🤼‍♂️":["men_wrestling"],"🤼‍♀️":["women_wrestling"],"🤽":["person_playing_water_polo","water_polo"],"🤽‍♂️":["man_playing_water_polo"],"🤽‍♀️":["woman_playing_water_polo"],"🤾":["handball","person_playing_handball"],"🤾‍♂️":["man_playing_handball"],"🤾‍♀️":["woman_playing_handball"],"🤹":["juggler","juggling","person_juggling"],"🤹‍♂️":["man_juggling"],"🤹‍♀️":["woman_juggling"],"🧘":["person_in_lotus_position"],"🧘‍♂️":["man_in_lotus_position"],"🧘‍♀️":["woman_in_lotus_position"],"🛀":["bath","person_taking_bath"],"🛌":["person_in_bed","sleeping_accommodation"],"🧑‍🤝‍🧑":["people_holding_hands"],"👭":["two_women_holding_hands"],"👫":["couple"],"👬":["two_men_holding_hands"],"💏":["couple_kiss","couplekiss"],"👩‍❤️‍💋‍👨":["kiss_mw","kiss_wm"],"👨‍❤️‍💋‍👨":["kiss_mm"],"👩‍❤️‍💋‍👩":["kiss_ww"],"💑":["couple_with_heart"],"👩‍❤️‍👨":["couple_with_heart_mw","couple_with_heart_wm"],"👨‍❤️‍👨":["couple_with_heart_mm"],"👩‍❤️‍👩":["couple_with_heart_ww"],"👪️":["family"],"👨‍👩‍👦":["family_mwb"],"👨‍👩‍👧":["family_mwg"],"👨‍👩‍👧‍👦":["family_mwgb"],"👨‍👩‍👦‍👦":["family_mwbb"],"👨‍👩‍👧‍👧":["family_mwgg"],"👨‍👨‍👦":["family_mmb"],"👨‍👨‍👧":["family_mmg"],"👨‍👨‍👧‍👦":["family_mmgb"],"👨‍👨‍👦‍👦":["family_mmbb"],"👨‍👨‍👧‍👧":["family_mmgg"],"👩‍👩‍👦":["family_wwb"],"👩‍👩‍👧":["family_wwg"],"👩‍👩‍👧‍👦":["family_wwgb"],"👩‍👩‍👦‍👦":["family_wwbb"],"👩‍👩‍👧‍👧":["family_wwgg"],"👨‍👦":["family_mb"],"👨‍👦‍👦":["family_mbb"],"👨‍👧":["family_mg"],"👨‍👧‍👦":["family_mgb"],"👨‍👧‍👧":["family_mgg"],"👩‍👦":["family_wb"],"👩‍👦‍👦":["family_wbb"],"👩‍👧":["family_wg"],"👩‍👧‍👦":["family_wgb"],"👩‍👧‍👧":["family_wgg"],"🗣️":["speaking_head"],"👤":["bust_in_silhouette"],"👥":["busts_in_silhouette"],"🫂":["people_hugging"],"👣":["footprints"],"🏻":["tone1","tone_light"],"🏼":["tone2","tone_medium_light"],"🏽":["tone3","tone_medium"],"🏾":["tone4","tone_medium_dark"],"🏿":["tone5","tone_dark"],"🦰":["red_hair"],"🦱":["curly_hair"],"🦳":["white_hair"],"🦲":["no_hair"],"🐵":["monkey_face"],"🐒":["monkey"],"🦍":["gorilla"],"🦧":["orangutan"],"🐶":["dog_face"],"🐕️":["dog"],"🦮":["guide_dog"],"🐕‍🦺":["service_dog"],"🐩":["poodle"],"🐺":["wolf","wolf_face"],"🦊":["fox","fox_face"],"🦝":["raccoon"],"🐱":["cat_face"],"🐈️":["cat"],"🐈‍⬛":["black_cat"],"🦁":["lion","lion_face"],"🐯":["tiger_face"],"🐅":["tiger"],"🐆":["leopard"],"🐴":["horse_face"],"🐎":["horse","racehorse"],"🦄":["unicorn","unicorn_face"],"🦓":["zebra"],"🦌":["deer"],"🦬":["bison"],"🐮":["cow_face"],"🐂":["ox"],"🐃":["water_buffalo"],"🐄":["cow"],"🐷":["pig_face"],"🐖":["pig"],"🐗":["boar"],"🐽":["pig_nose"],"🐏":["ram"],"🐑":["ewe","sheep"],"🐐":["goat"],"🐪":["dromedary_camel"],"🐫":["camel"],"🦙":["llama"],"🦒":["giraffe"],"🐘":["elephant"],"🦣":["mammoth"],"🦏":["rhino","rhinoceros"],"🦛":["hippo"],"🐭":["mouse_face"],"🐁":["mouse"],"🐀":["rat"],"🐹":["hamster","hamster_face"],"🐰":["rabbit_face"],"🐇":["rabbit"],"🐿️":["chipmunk"],"🦫":["beaver"],"🦔":["hedgehog"],"🦇":["bat"],"🐻":["bear","bear_face"],"🐻‍❄️":["polar_bear","polar_bear_face"],"🐨":["koala","koala_face"],"🐼":["panda","panda_face"],"🦥":["sloth"],"🦦":["otter"],"🦨":["skunk"],"🦘":["kangaroo"],"🦡":["badger"],"🐾":["paw_prints"],"🦃":["turkey"],"🐔":["chicken","chicken_face"],"🐓":["rooster"],"🐣":["hatching_chick"],"🐤":["baby_chick"],"🐥":["hatched_chick"],"🐦️":["bird","bird_face"],"🐧":["penguin","penguin_face"],"🕊️":["dove"],"🦅":["eagle"],"🦆":["duck"],"🦢":["swan"],"🦉":["owl"],"🦤":["dodo"],"🪶":["feather"],"🦩":["flamingo"],"🦚":["peacock"],"🦜":["parrot"],"🐸":["frog","frog_face"],"🐊":["crocodile"],"🐢":["turtle"],"🦎":["lizard"],"🐍":["snake"],"🐲":["dragon_face"],"🐉":["dragon"],"🦕":["sauropod"],"🦖":["t-rex","trex"],"🐳":["spouting_whale"],"🐋":["whale"],"🐬":["dolphin"],"🦭":["seal"],"🐟️":["fish"],"🐠":["tropical_fish"],"🐡":["blowfish"],"🦈":["shark"],"🐙":["octopus"],"🐚":["shell"],"🪸":["coral"],"🐌":["snail"],"🦋":["butterfly"],"🐛":["bug"],"🐜":["ant"],"🐝":["bee"],"🪲":["beetle"],"🐞":["lady_beetle"],"🦗":["cricket"],"🪳":["cockroach"],"🕷️":["spider"],"🕸️":["spider_web"],"🦂":["scorpion"],"🦟":["mosquito"],"🪰":["fly"],"🪱":["worm"],"🦠":["microbe"],"💐":["bouquet"],"🌸":["cherry_blossom"],"💮":["white_flower"],"🪷":["lotus"],"🏵️":["rosette"],"🌹":["rose"],"🥀":["wilted_flower"],"🌺":["hibiscus"],"🌻":["sunflower"],"🌼":["blossom"],"🌷":["tulip"],"🌱":["seedling"],"🪴":["potted_plant"],"🌲":["evergreen_tree"],"🌳":["deciduous_tree"],"🌴":["palm_tree"],"🌵":["cactus"],"🌾":["ear_of_rice","sheaf_of_rice"],"🌿":["herb"],"☘️":["shamrock"],"🍀":["four_leaf_clover"],"🍁":["maple_leaf"],"🍂":["fallen_leaf"],"🍃":["leaves"],"🪹":["empty_nest","nest"],"🪺":["nest_with_eggs"],"🍇":["grapes"],"🍈":["melon"],"🍉":["watermelon"],"🍊":["orange","tangerine"],"🍋":["lemon"],"🍌":["banana"],"🍍":["pineapple"],"🥭":["mango"],"🍎":["apple","red_apple"],"🍏":["green_apple"],"🍐":["pear"],"🍑":["peach"],"🍒":["cherries"],"🍓":["strawberry"],"🫐":["blueberries"],"🥝":["kiwi"],"🍅":["tomato"],"🫒":["olive"],"🥥":["coconut"],"🥑":["avocado"],"🍆":["eggplant"],"🥔":["potato"],"🥕":["carrot"],"🌽":["corn","ear_of_corn"],"🌶️":["hot_pepper"],"🫑":["bell_pepper"],"🥒":["cucumber"],"🥬":["leafy_green"],"🥦":["broccoli"],"🧄":["garlic"],"🧅":["onion"],"🍄":["mushroom"],"🥜":["peanuts"],"🫘":["beans"],"🌰":["chestnut"],"🍞":["bread"],"🥐":["croissant"],"🥖":["baguette_bread"],"🫓":["flatbread"],"🥨":["pretzel"],"🥯":["bagel"],"🥞":["pancakes"],"🧇":["waffle"],"🧀":["cheese"],"🍖":["meat_on_bone"],"🍗":["poultry_leg"],"🥩":["cut_of_meat"],"🥓":["bacon"],"🍔":["hamburger"],"🍟":["french_fries","fries"],"🍕":["pizza"],"🌭":["hotdog"],"🥪":["sandwich"],"🌮":["taco"],"🌯":["burrito"],"🫔":["tamale"],"🥙":["stuffed_flatbread"],"🧆":["falafel"],"🥚":["egg"],"🍳":["cooking","fried_egg"],"🥘":["shallow_pan_of_food"],"🍲":["pot_of_food","stew"],"🫕":["fondue"],"🥣":["bowl_with_spoon"],"🥗":["green_salad","salad"],"🍿":["popcorn"],"🧈":["butter"],"🧂":["salt"],"🥫":["canned_food"],"🍱":["bento","bento_box"],"🍘":["rice_cracker"],"🍙":["rice_ball"],"🍚":["cooked_rice","rice"],"🍛":["curry","curry_rice"],"🍜":["ramen","steaming_bowl"],"🍝":["spaghetti"],"🍠":["sweet_potato"],"🍢":["oden"],"🍣":["sushi"],"🍤":["fried_shrimp"],"🍥":["fish_cake"],"🥮":["moon_cake"],"🍡":["dango"],"🥟":["dumpling"],"🥠":["fortune_cookie"],"🥡":["takeout_box"],"🦀":["crab"],"🦞":["lobster"],"🦐":["shrimp"],"🦑":["squid"],"🦪":["oyster"],"🍦":["icecream","soft_serve"],"🍧":["shaved_ice"],"🍨":["ice_cream"],"🍩":["doughnut"],"🍪":["cookie"],"🎂":["birthday","birthday_cake"],"🍰":["cake","shortcake"],"🧁":["cupcake"],"🥧":["pie"],"🍫":["chocolate_bar"],"🍬":["candy"],"🍭":["lollipop"],"🍮":["custard"],"🍯":["honey_pot"],"🍼":["baby_bottle"],"🥛":["glass_of_milk","milk"],"☕️":["coffee"],"🫖":["teapot"],"🍵":["tea"],"🍶":["sake"],"🍾":["champagne"],"🍷":["wine_glass"],"🍸️":["cocktail"],"🍹":["tropical_drink"],"🍺":["beer"],"🍻":["beers"],"🥂":["clinking_glasses"],"🥃":["tumbler_glass","whisky"],"🫗":["pour","pouring_liquid"],"🥤":["cup_with_straw"],"🧋":["boba_drink","bubble_tea"],"🧃":["beverage_box","juice_box"],"🧉":["mate"],"🧊":["ice","ice_cube"],"🥢":["chopsticks"],"🍽️":["fork_knife_plate"],"🍴":["fork_and_knife"],"🥄":["spoon"],"🔪":["knife"],"🫙":["jar"],"🏺":["amphora"],"🌍️":["earth_africa","earth_europe"],"🌎️":["earth_americas"],"🌏️":["earth_asia"],"🌐":["globe_with_meridians"],"🗺️":["world_map"],"🗾":["japan_map"],"🧭":["compass"],"🏔️":["mountain_snow"],"⛰️":["mountain"],"🌋":["volcano"],"🗻":["mount_fuji"],"🏕️":["camping"],"🏖️":["beach","beach_with_umbrella"],"🏜️":["desert"],"🏝️":["desert_island","island"],"🏞️":["national_park"],"🏟️":["stadium"],"🏛️":["classical_building"],"🏗️":["building_construction","construction_site"],"🧱":["bricks"],"🪨":["rock"],"🪵":["wood"],"🛖":["hut"],"🏘️":["homes","houses"],"🏚️":["derelict_house","house_abandoned"],"🏠️":["house"],"🏡":["house_with_garden"],"🏢":["office"],"🏣":["post_office"],"🏤":["european_post_office"],"🏥":["hospital"],"🏦":["bank"],"🏨":["hotel"],"🏩":["love_hotel"],"🏪":["convenience_store"],"🏫":["school"],"🏬":["department_store"],"🏭️":["factory"],"🏯":["japanese_castle"],"🏰":["castle","european_castle"],"💒":["wedding"],"🗼":["tokyo_tower"],"🗽":["statue_of_liberty"],"⛪️":["church"],"🕌":["mosque"],"🛕":["hindu_temple"],"🕍":["synagogue"],"⛩️":["shinto_shrine"],"🕋":["kaaba"],"⛲️":["fountain"],"⛺️":["tent"],"🌁":["foggy"],"🌃":["night_with_stars"],"🏙️":["cityscape"],"🌄":["sunrise_over_mountains"],"🌅":["sunrise"],"🌆":["city_dusk"],"🌇":["city_sunrise","city_sunset"],"🌉":["bridge_at_night"],"♨️":["hotsprings"],"🎠":["carousel_horse"],"🛝":["playground_slide","slide"],"🎡":["ferris_wheel"],"🎢":["roller_coaster"],"💈":["barber","barber_pole"],"🎪":["circus_tent"],"🚂":["steam_locomotive"],"🚃":["railway_car"],"🚄":["bullettrain_side"],"🚅":["bullettrain_front"],"🚆":["train"],"🚇️":["metro"],"🚈":["light_rail"],"🚉":["station"],"🚊":["tram"],"🚝":["monorail"],"🚞":["mountain_railway"],"🚋":["tram_car"],"🚌":["bus"],"🚍️":["oncoming_bus"],"🚎":["trolleybus"],"🚐":["minibus"],"🚑️":["ambulance"],"🚒":["fire_engine"],"🚓":["police_car"],"🚔️":["oncoming_police_car"],"🚕":["taxi"],"🚖":["oncoming_taxi"],"🚗":["car","red_car"],"🚘️":["oncoming_automobile"],"🚙":["blue_car","suv"],"🛻":["pickup_truck"],"🚚":["delivery_truck","truck"],"🚛":["articulated_lorry"],"🚜":["tractor"],"🏎️":["racing_car"],"🏍️":["motorcycle"],"🛵":["motor_scooter"],"🦽":["manual_wheelchair"],"🦼":["motorized_wheelchair"],"🛺":["auto_rickshaw"],"🚲️":["bicycle","bike"],"🛴":["scooter"],"🛹":["skateboard"],"🛼":["roller_skate"],"🚏":["busstop"],"🛣️":["motorway"],"🛤️":["railway_track"],"🛢️":["oil_drum"],"⛽️":["fuelpump"],"🛞":["wheel"],"🚨":["rotating_light"],"🚥":["traffic_light"],"🚦":["vertical_traffic_light"],"🛑":["octagonal_sign","stop_sign"],"🚧":["construction"],"⚓️":["anchor"],"🛟":["lifebuoy","ring_buoy"],"⛵️":["sailboat"],"🛶":["canoe"],"🚤":["speedboat"],"🛳️":["cruise_ship","passenger_ship"],"⛴️":["ferry"],"🛥️":["motorboat"],"🚢":["ship"],"✈️":["airplane"],"🛩️":["small_airplane"],"🛫":["airplane_departure"],"🛬":["airplane_arriving"],"🪂":["parachute"],"💺":["seat"],"🚁":["helicopter"],"🚟":["suspension_railway"],"🚠":["mountain_cableway"],"🚡":["aerial_tramway"],"🛰️":["satellite"],"🚀":["rocket"],"🛸":["flying_saucer"],"🛎️":["bellhop"],"🧳":["luggage"],"⌛️":["hourglass"],"⏳️":["hourglass_flowing_sand"],"⌚️":["watch"],"⏰":["alarm_clock"],"⏱️":["stopwatch"],"⏲️":["timer_clock"],"🕰️":["clock"],"🕛️":["clock12"],"🕧️":["clock1230"],"🕐️":["clock1"],"🕜️":["clock130"],"🕑️":["clock2"],"🕝️":["clock230"],"🕒️":["clock3"],"🕞️":["clock330"],"🕓️":["clock4"],"🕟️":["clock430"],"🕔️":["clock5"],"🕠️":["clock530"],"🕕️":["clock6"],"🕡️":["clock630"],"🕖️":["clock7"],"🕢️":["clock730"],"🕗️":["clock8"],"🕣️":["clock830"],"🕘️":["clock9"],"🕤️":["clock930"],"🕙️":["clock10"],"🕥️":["clock1030"],"🕚️":["clock11"],"🕦️":["clock1130"],"🌑":["new_moon"],"🌒":["waxing_crescent_moon"],"🌓":["first_quarter_moon"],"🌔":["waxing_gibbous_moon"],"🌕️":["full_moon"],"🌖":["waning_gibbous_moon"],"🌗":["last_quarter_moon"],"🌘":["waning_crescent_moon"],"🌙":["crescent_moon"],"🌚":["new_moon_with_face"],"🌛":["first_quarter_moon_with_face"],"🌜️":["last_quarter_moon_with_face"],"🌡️":["thermometer"],"☀️":["sun"],"🌝":["full_moon_with_face"],"🌞":["sun_with_face"],"🪐":["ringed_planet","saturn"],"⭐️":["star"],"🌟":["glowing_star","star2"],"🌠":["shooting_star","stars"],"🌌":["milky_way"],"☁️":["cloud"],"⛅️":["partly_sunny","sun_behind_cloud"],"⛈️":["stormy","thunder_cloud_and_rain"],"🌤️":["sun_behind_small_cloud","sunny"],"🌥️":["cloudy","sun_behind_large_cloud"],"🌦️":["sun_and_rain","sun_behind_rain_cloud"],"🌧️":["cloud_with_rain","rainy"],"🌨️":["cloud_with_snow","snowy"],"🌩️":["cloud_with_lightning","lightning"],"🌪️":["tornado"],"🌫️":["fog"],"🌬️":["wind_blowing_face"],"🌀":["cyclone"],"🌈":["rainbow"],"🌂":["closed_umbrella"],"☂️":["umbrella"],"☔️":["umbrella_with_rain"],"⛱️":["beach_umbrella","umbrella_on_ground"],"⚡️":["high_voltage","zap"],"❄️":["snowflake"],"☃️":["snowman2"],"⛄️":["snowman"],"☄️":["comet"],"🔥":["fire"],"💧":["droplet"],"🌊":["ocean","water_wave"],"🎃":["jack_o_lantern"],"🎄":["christmas_tree"],"🎆":["fireworks"],"🎇":["sparkler"],"🧨":["firecracker"],"✨":["sparkles"],"🎈":["balloon"],"🎉":["party","party_popper","tada"],"🎊":["confetti_ball"],"🎋":["tanabata_tree"],"🎍":["bamboo"],"🎎":["dolls"],"🎏":["carp_streamer","flags"],"🎐":["wind_chime"],"🎑":["moon_ceremony","rice_scene"],"🧧":["red_envelope"],"🎀":["ribbon"],"🎁":["gift"],"🎗️":["reminder_ribbon"],"🎟️":["admission_tickets","tickets"],"🎫":["ticket"],"🎖️":["military_medal"],"🏆️":["trophy"],"🏅":["sports_medal"],"🥇":["1st","first_place_medal"],"🥈":["2nd","second_place_medal"],"🥉":["3rd","third_place_medal"],"⚽️":["soccer"],"⚾️":["baseball"],"🥎":["softball"],"🏀":["basketball"],"🏐":["volleyball"],"🏈":["football"],"🏉":["rugby_football"],"🎾":["tennis"],"🥏":["flying_disc"],"🎳":["bowling"],"🏏":["cricket_game"],"🏑":["field_hockey"],"🏒":["hockey"],"🥍":["lacrosse"],"🏓":["ping_pong"],"🏸":["badminton"],"🥊":["boxing_glove"],"🥋":["martial_arts_uniform"],"🥅":["goal_net"],"⛳️":["golf"],"⛸️":["ice_skate"],"🎣":["fishing_pole","fishing_pole_and_fish"],"🤿":["diving_mask"],"🎽":["running_shirt","running_shirt_with_sash"],"🎿":["ski"],"🛷":["sled"],"🥌":["curling_stone"],"🎯":["bullseye","dart","direct_hit"],"🪀":["yo_yo"],"🪁":["kite"],"🎱":["8ball","billiards"],"🔮":["crystal_ball"],"🪄":["magic_wand"],"🧿":["nazar_amulet"],"🪬":["hamsa"],"🎮️":["controller","video_game"],"🕹️":["joystick"],"🎰":["slot_machine"],"🎲":["game_die"],"🧩":["jigsaw","puzzle_piece"],"🧸":["teddy_bear"],"🪅":["pinata"],"🪩":["disco","disco_ball","mirror_ball"],"🪆":["nesting_dolls"],"♠️":["spades"],"♥️":["hearts"],"♦️":["diamonds"],"♣️":["clubs"],"♟️":["chess_pawn"],"🃏":["black_joker"],"🀄️":["mahjong"],"🎴":["flower_playing_cards"],"🎭️":["performing_arts"],"🖼️":["frame_with_picture","framed_picture"],"🎨":["art","palette"],"🧵":["thread"],"🪡":["sewing_needle"],"🧶":["yarn"],"🪢":["knot"],"👓️":["eyeglasses","glasses"],"🕶️":["sunglasses"],"🥽":["goggles"],"🥼":["lab_coat"],"🦺":["safety_vest"],"👔":["necktie"],"👕":["shirt"],"👖":["jeans"],"🧣":["scarf"],"🧤":["gloves"],"🧥":["coat"],"🧦":["socks"],"👗":["dress"],"👘":["kimono"],"🥻":["sari"],"🩱":["one_piece_swimsuit"],"🩲":["briefs"],"🩳":["shorts"],"👙":["bikini"],"👚":["womans_clothes"],"👛":["purse"],"👜":["handbag"],"👝":["clutch_bag","pouch"],"🛍️":["shopping_bags"],"🎒":["backpack","school_satchel"],"🩴":["thong_sandal"],"👞":["mans_shoe"],"👟":["athletic_shoe","sneaker"],"🥾":["hiking_boot"],"🥿":["flat_shoe","womans_flat_shoe"],"👠":["high_heel"],"👡":["sandal"],"🩰":["ballet_shoes"],"👢":["boot"],"👑":["crown"],"👒":["womans_hat"],"🎩":["top_hat","tophat"],"🎓️":["graduation_cap","mortar_board"],"🧢":["billed_cap"],"🪖":["military_helmet"],"⛑️":["helmet_with_cross","rescue_worker_helmet"],"📿":["prayer_beads"],"💄":["lipstick"],"💍":["ring"],"💎":["gem"],"🔇":["mute","no_sound"],"🔈️":["low_volume","quiet_sound","speaker"],"🔉":["medium_volumne","sound"],"🔊":["high_volume","loud_sound"],"📢":["loudspeaker"],"📣":["mega","megaphone"],"📯":["postal_horn"],"🔔":["bell"],"🔕":["no_bell"],"🎼":["musical_score"],"🎵":["musical_note"],"🎶":["musical_notes","notes"],"🎙️":["studio_microphone"],"🎚️":["level_slider"],"🎛️":["control_knobs"],"🎤":["microphone"],"🎧️":["headphones"],"📻️":["radio"],"🎷":["saxophone"],"🪗":["accordion"],"🎸":["guitar"],"🎹":["musical_keyboard"],"🎺":["trumpet"],"🎻":["violin"],"🪕":["banjo"],"🥁":["drum"],"🪘":["long_drum"],"📱":["android","iphone","mobile_phone"],"📲":["calling","mobile_phone_arrow"],"☎️":["telephone"],"📞":["telephone_receiver"],"📟️":["pager"],"📠":["fax","fax_machine"],"🔋":["battery"],"🪫":["low_battery"],"🔌":["electric_plug"],"💻️":["laptop"],"🖥️":["computer","desktop_computer"],"🖨️":["printer"],"⌨️":["keyboard"],"🖱️":["computer_mouse"],"🖲️":["trackball"],"💽":["computer_disk","minidisc"],"💾":["floppy_disk"],"💿️":["cd","optical_disk"],"📀":["dvd"],"🧮":["abacus"],"🎥":["movie_camera"],"🎞️":["film_frames"],"📽️":["film_projector"],"🎬️":["clapper"],"📺️":["tv"],"📷️":["camera"],"📸":["camera_with_flash"],"📹️":["video_camera"],"📼":["vhs","videocassette"],"🔍️":["mag"],"🔎":["mag_right"],"🕯️":["candle"],"💡":["bulb","light_bulb"],"🔦":["flashlight"],"🏮":["izakaya_lantern","red_paper_lantern"],"🪔":["diya_lamp"],"📔":["notebook_with_decorative_cover"],"📕":["closed_book"],"📖":["book","open_book"],"📗":["green_book"],"📘":["blue_book"],"📙":["orange_book"],"📚️":["books"],"📓":["notebook"],"📒":["ledger"],"📃":["page_with_curl"],"📜":["scroll"],"📄":["page_facing_up"],"📰":["newspaper"],"🗞️":["rolled_up_newspaper"],"📑":["bookmark_tabs"],"🔖":["bookmark"],"🏷️":["label"],"💰️":["moneybag"],"🪙":["coin"],"💴":["yen"],"💵":["dollar"],"💶":["euro"],"💷":["pound"],"💸":["money_with_wings"],"💳️":["credit_card"],"🧾":["receipt"],"💹":["chart"],"✉️":["envelope"],"📧":["e-mail","email"],"📨":["incoming_envelope"],"📩":["envelope_with_arrow"],"📤️":["outbox_tray"],"📥️":["inbox_tray"],"📦️":["package"],"📫️":["mailbox"],"📪️":["mailbox_closed"],"📬️":["mailbox_with_mail"],"📭️":["mailbox_with_no_mail"],"📮":["postbox"],"🗳️":["ballot_box"],"✏️":["pencil"],"✒️":["black_nib"],"🖋️":["fountain_pen"],"🖊️":["pen"],"🖌️":["paintbrush"],"🖍️":["crayon"],"📝":["memo"],"💼":["briefcase"],"📁":["file_folder"],"📂":["open_file_folder"],"🗂️":["card_index_dividers"],"📅":["date"],"📆":["calendar"],"🗒️":["notepad_spiral"],"🗓️":["calendar_spiral"],"📇":["card_index"],"📈":["chart_increasing","chart_with_upwards_trend"],"📉":["chart_decreasing","chart_with_downwards_trend"],"📊":["bar_chart"],"📋️":["clipboard"],"📌":["pushpin"],"📍":["round_pushpin"],"📎":["paperclip"],"🖇️":["paperclips"],"📏":["straight_ruler"],"📐":["triangular_ruler"],"✂️":["scissors"],"🗃️":["card_file_box"],"🗄️":["file_cabinet"],"🗑️":["trashcan","wastebasket"],"🔒️":["lock","locked"],"🔓️":["unlock","unlocked"],"🔏":["lock_with_ink_pen","locked_with_pen"],"🔐":["closed_lock_with_key","locked_with_key"],"🔑":["key"],"🗝️":["old_key"],"🔨":["hammer"],"🪓":["axe"],"⛏️":["pick"],"⚒️":["hammer_and_pick"],"🛠️":["hammer_and_wrench"],"🗡️":["dagger"],"⚔️":["crossed_swords"],"🔫":["gun","pistol"],"🪃":["boomerang"],"🏹":["bow_and_arrow"],"🛡️":["shield"],"🪚":["carpentry_saw"],"🔧":["wrench"],"🪛":["screwdriver"],"🔩":["nut_and_bolt"],"⚙️":["gear"],"🗜️":["clamp","compression"],"⚖️":["scales"],"🦯":["probing_cane","white_cane"],"🔗":["link"],"⛓️":["chains"],"🪝":["hook"],"🧰":["toolbox"],"🧲":["magnet"],"🪜":["ladder"],"⚗️":["alembic"],"🧪":["test_tube"],"🧫":["petri_dish"],"🧬":["dna","double_helix"],"🔬":["microscope"],"🔭":["telescope"],"📡":["satellite_antenna"],"💉":["syringe"],"🩸":["drop_of_blood"],"💊":["pill"],"🩹":["adhesive_bandage","bandaid"],"🩼":["crutch"],"🩺":["stethoscope"],"🩻":["x-ray","xray"],"🚪":["door"],"🛗":["elevator"],"🪞":["mirror"],"🪟":["window"],"🛏️":["bed"],"🛋️":["couch_and_lamp"],"🪑":["chair"],"🚽":["toilet"],"🪠":["plunger"],"🚿":["shower"],"🛁":["bathtub"],"🪤":["mouse_trap"],"🪒":["razor"],"🧴":["lotion_bottle"],"🧷":["safety_pin"],"🧹":["broom"],"🧺":["basket"],"🧻":["roll_of_paper","toilet_paper"],"🪣":["bucket"],"🧼":["soap"],"🫧":["bubbles"],"🪥":["toothbrush"],"🧽":["sponge"],"🧯":["fire_extinguisher"],"🛒":["shopping_cart"],"🚬":["cigarette","smoking"],"⚰️":["coffin"],"🪦":["headstone"],"⚱️":["funeral_urn"],"🗿":["moai","moyai"],"🪧":["placard"],"🪪":["id_card"],"🏧":["atm"],"🚮":["litter_bin","put_litter_in_its_place"],"🚰":["potable_water"],"♿️":["handicapped","wheelchair"],"🚹️":["mens"],"🚺️":["womens"],"🚻":["bathroom","restroom"],"🚼️":["baby_symbol"],"🚾":["water_closet","wc"],"🛂":["passport_control"],"🛃":["customs"],"🛄":["baggage_claim"],"🛅":["left_luggage"],"⚠️":["warning"],"🚸":["children_crossing"],"⛔️":["no_entry"],"🚫":["no_entry_sign"],"🚳":["no_bicycles"],"🚭️":["no_smoking"],"🚯":["do_not_litter","no_littering"],"🚱":["non-potable_water"],"🚷":["no_pedestrians"],"📵":["no_mobile_phones"],"🔞":["no_one_under_18","underage"],"☢️":["radioactive"],"☣️":["biohazard"],"⬆️":["arrow_up"],"↗️":["arrow_upper_right"],"➡️":["arrow_right"],"↘️":["arrow_lower_right"],"⬇️":["arrow_down"],"↙️":["arrow_lower_left"],"⬅️":["arrow_left"],"↖️":["arrow_upper_left"],"↕️":["arrow_up_down"],"↔️":["left_right_arrow"],"↩️":["arrow_left_hook","leftwards_arrow_with_hook"],"↪️":["arrow_right_hook","rightwards_arrow_with_hook"],"⤴️":["arrow_heading_up"],"⤵️":["arrow_heading_down"],"🔃":["arrows_clockwise","clockwise"],"🔄":["arrows_counterclockwise","counterclockwise"],"🔙":["back"],"🔚":["end"],"🔛":["on"],"🔜":["soon"],"🔝":["top"],"🛐":["place_of_worship"],"⚛️":["atom","atom_symbol"],"🕉️":["om"],"✡️":["star_of_david"],"☸️":["wheel_of_dharma"],"☯️":["yin_yang"],"✝️":["latin_cross"],"☦️":["orthodox_cross"],"☪️":["star_and_crescent"],"☮️":["peace","peace_symbol"],"🕎":["menorah"],"🔯":["six_pointed_star"],"♈️":["aries"],"♉️":["taurus"],"♊️":["gemini"],"♋️":["cancer"],"♌️":["leo"],"♍️":["virgo"],"♎️":["libra"],"♏️":["scorpius"],"♐️":["sagittarius"],"♑️":["capricorn"],"♒️":["aquarius"],"♓️":["pisces"],"⛎":["ophiuchus"],"🔀":["shuffle","twisted_rightwards_arrows"],"🔁":["repeat"],"🔂":["repeat_one"],"▶️":["arrow_forward","play"],"⏩️":["fast_forward"],"⏭️":["next_track"],"⏯️":["play_pause"],"◀️":["arrow_backward","reverse"],"⏪️":["fast_reverse","rewind"],"⏮️":["previous_track"],"🔼":["arrow_up_small","up"],"⏫":["arrow_double_up","fast_up"],"🔽":["arrow_down_small","down"],"⏬":["arrow_double_down","fast_down"],"⏸️":["pause"],"⏹️":["stop"],"⏺️":["record"],"⏏️":["eject"],"🎦":["cinema"],"🔅":["dim_button","low_brightness"],"🔆":["bright_button","high_brightness"],"📶":["antenna_bars","signal_strength"],"📳":["vibration_mode"],"📴":["mobile_phone_off"],"♀️":["female","female_sign"],"♂️":["male","male_sign"],"⚧️":["transgender_symbol"],"✖️":["multiplication","multiply"],"➕":["plus"],"➖":["minus"],"➗":["divide","division"],"🟰":["heavy_equals_sign"],"♾️":["infinity"],"‼️":["bangbang","double_exclamation"],"⁉️":["exclamation_question","interrobang"],"❓️":["question"],"❔":["white_question"],"❕":["white_exclamation"],"❗️":["exclamation"],"〰️":["wavy_dash"],"💱":["currency_exchange"],"💲":["heavy_dollar_sign"],"⚕️":["medical","medical_symbol"],"♻️":["recycle","recycling_symbol"],"⚜️":["fleur-de-lis"],"🔱":["trident"],"📛":["name_badge"],"🔰":["beginner"],"⭕️":["hollow_red_circle","red_o"],"✅":["check_mark_button","white_check_mark"],"☑️":["ballot_box_with_check"],"✔️":["check_mark","heavy_check_mark"],"❌":["cross_mark","x"],"❎":["cross_mark_button","negative_squared_cross_mark"],"➰":["curly_loop"],"➿":["double_curly_loop","loop"],"〽️":["part_alternation_mark"],"✳️":["eight_spoked_asterisk"],"✴️":["eight_pointed_black_star"],"❇️":["sparkle"],"©️":["copyright"],"®️":["registered"],"™️":["tm","trade_mark"],"#️⃣":["hash","number_sign"],"*️⃣":["asterisk"],"0️⃣":["zero"],"1️⃣":["one"],"2️⃣":["two"],"3️⃣":["three"],"4️⃣":["four"],"5️⃣":["five"],"6️⃣":["six"],"7️⃣":["seven"],"8️⃣":["eight"],"9️⃣":["nine"],"🔟":["ten"],"🔠":["capital_abcd"],"🔡":["abcd"],"🔢":["1234"],"🔣":["symbols"],"🔤":["abc"],"🅰️":["a","a_blood"],"🆎":["ab","ab_blood"],"🅱️":["b","b_blood"],"🆑":["cl"],"🆒":["cool"],"🆓":["free"],"ℹ️":["info","information_source"],"🆔":["id"],"Ⓜ️":["m"],"🆕":["new"],"🆖":["ng"],"🅾️":["o","o_blood"],"🆗":["ok"],"🅿️":["parking"],"🆘":["sos"],"🆙":["up2"],"🆚":["vs"],"🈁":["ja_here","koko"],"🈂️":["ja_service_charge"],"🈷️":["ja_monthly_amount"],"🈶":["ja_not_free_of_carge"],"🈯️":["ja_reserved"],"🉐":["ideograph_advantage","ja_bargain"],"🈹":["ja_discount"],"🈚️":["ja_free_of_charge"],"🈲":["ja_prohibited"],"🉑":["accept","ja_acceptable"],"🈸":["ja_application"],"🈴":["ja_passing_grade"],"🈳":["ja_vacancy"],"㊗️":["congratulations","ja_congratulations"],"㊙️":["ja_secret","secret"],"🈺":["ja_open_for_business"],"🈵":["ja_no_vacancy"],"🔴":["red_circle"],"🟠":["orange_circle"],"🟡":["yellow_circle"],"🟢":["green_circle"],"🔵":["blue_circle"],"🟣":["purple_circle"],"🟤":["brown_circle"],"⚫️":["black_circle"],"⚪️":["white_circle"],"🟥":["red_square"],"🟧":["orange_square"],"🟨":["yellow_square"],"🟩":["green_square"],"🟦":["blue_square"],"🟪":["purple_square"],"🟫":["brown_square"],"⬛️":["black_large_square"],"⬜️":["white_large_square"],"◼️":["black_medium_square"],"◻️":["white_medium_square"],"◾️":["black_medium_small_square"],"◽️":["white_medium_small_square"],"▪️":["black_small_square"],"▫️":["white_small_square"],"🔶":["large_orange_diamond"],"🔷":["large_blue_diamond"],"🔸":["small_orange_diamond"],"🔹":["small_blue_diamond"],"🔺":["small_red_triangle"],"🔻":["small_red_triangle_down"],"💠":["diamond_shape_with_a_dot_inside","diamond_with_a_dot"],"🔘":["radio_button"],"🔳":["white_square_button"],"🔲":["black_square_button"],"🏁":["checkered_flag"],"🚩":["triangular_flag","triangular_flag_on_post"],"🎌":["crossed_flags"],"🏴":["black_flag"],"🏳️":["white_flag"],"🏳️‍🌈":["rainbow_flag"],"🏳️‍⚧️":["transgender_flag"],"🏴‍☠️":["jolly_roger","pirate_flag"],"🇦🇨":["ascension_island","flag_ac"],"🇦🇩":["andorra","flag_ad"],"🇦🇪":["flag_ae","united_arab_emirates"],"🇦🇫":["afghanistan","flag_af"],"🇦🇬":["antigua_barbuda","flag_ag"],"🇦🇮":["anguilla","flag_ai"],"🇦🇱":["albania","flag_al"],"🇦🇲":["armenia","flag_am"],"🇦🇴":["angola","flag_ao"],"🇦🇶":["antarctica","flag_aq"],"🇦🇷":["argentina","flag_ar"],"🇦🇸":["american_samoa","flag_as"],"🇦🇹":["austria","flag_at"],"🇦🇺":["australia","flag_au"],"🇦🇼":["aruba","flag_aw"],"🇦🇽":["aland_islands","flag_ax"],"🇦🇿":["azerbaijan","flag_az"],"🇧🇦":["bosnia_herzegovina","flag_ba"],"🇧🇧":["barbados","flag_bb"],"🇧🇩":["bangladesh","flag_bd"],"🇧🇪":["belgium","flag_be"],"🇧🇫":["burkina_faso","flag_bf"],"🇧🇬":["bulgaria","flag_bg"],"🇧🇭":["bahrain","flag_bh"],"🇧🇮":["burundi","flag_bi"],"🇧🇯":["benin","flag_bj"],"🇧🇱":["flag_bl","st_barthelemy"],"🇧🇲":["bermuda","flag_bm"],"🇧🇳":["brunei","flag_bn"],"🇧🇴":["bolivia","flag_bo"],"🇧🇶":["caribbean_netherlands","flag_bq"],"🇧🇷":["brazil","flag_br"],"🇧🇸":["bahamas","flag_bs"],"🇧🇹":["bhutan","flag_bt"],"🇧🇻":["bouvet_island","flag_bv"],"🇧🇼":["botswana","flag_bw"],"🇧🇾":["belarus","flag_by"],"🇧🇿":["belize","flag_bz"],"🇨🇦":["canada","flag_ca"],"🇨🇨":["cocos_islands","flag_cc"],"🇨🇩":["congo_kinshasa","flag_cd"],"🇨🇫":["central_african_republic","flag_cf"],"🇨🇬":["congo_brazzaville","flag_cg"],"🇨🇭":["flag_ch","switzerland"],"🇨🇮":["cote_divoire","flag_ci"],"🇨🇰":["cook_islands","flag_ck"],"🇨🇱":["chile","flag_cl"],"🇨🇲":["cameroon","flag_cm"],"🇨🇳":["china","flag_cn"],"🇨🇴":["colombia","flag_co"],"🇨🇵":["clipperton_island","flag_cp"],"🇨🇷":["costa_rica","flag_cr"],"🇨🇺":["cuba","flag_cu"],"🇨🇻":["cape_verde","flag_cv"],"🇨🇼":["curacao","flag_cw"],"🇨🇽":["christmas_island","flag_cx"],"🇨🇾":["cyprus","flag_cy"],"🇨🇿":["czech_republic","czechia","flag_cz"],"🇩🇪":["flag_de","germany"],"🇩🇬":["diego_garcia","flag_dg"],"🇩🇯":["djibouti","flag_dj"],"🇩🇰":["denmark","flag_dk"],"🇩🇲":["dominica","flag_dm"],"🇩🇴":["dominican_republic","flag_do"],"🇩🇿":["algeria","flag_dz"],"🇪🇦":["ceuta_melilla","flag_ea"],"🇪🇨":["ecuador","flag_ec"],"🇪🇪":["estonia","flag_ee"],"🇪🇬":["egypt","flag_eg"],"🇪🇭":["flag_eh","western_sahara"],"🇪🇷":["eritrea","flag_er"],"🇪🇸":["flag_es","spain"],"🇪🇹":["ethiopia","flag_et"],"🇪🇺":["european_union","flag_eu"],"🇫🇮":["finland","flag_fi"],"🇫🇯":["fiji","flag_fj"],"🇫🇰":["falkland_islands","flag_fk"],"🇫🇲":["flag_fm","micronesia"],"🇫🇴":["faroe_islands","flag_fo"],"🇫🇷":["flag_fr","france"],"🇬🇦":["flag_ga","gabon"],"🇬🇧":["flag_gb","uk","united_kingdom"],"🇬🇩":["flag_gd","grenada"],"🇬🇪":["flag_ge","georgia"],"🇬🇫":["flag_gf","french_guiana"],"🇬🇬":["flag_gg","guernsey"],"🇬🇭":["flag_gh","ghana"],"🇬🇮":["flag_gi","gibraltar"],"🇬🇱":["flag_gl","greenland"],"🇬🇲":["flag_gm","gambia"],"🇬🇳":["flag_gn","guinea"],"🇬🇵":["flag_gp","guadeloupe"],"🇬🇶":["equatorial_guinea","flag_gq"],"🇬🇷":["flag_gr","greece"],"🇬🇸":["flag_gs","south_georgia_south_sandwich_islands"],"🇬🇹":["flag_gt","guatemala"],"🇬🇺":["flag_gu","guam"],"🇬🇼":["flag_gw","guinea_bissau"],"🇬🇾":["flag_gy","guyana"],"🇭🇰":["flag_hk","hong_kong"],"🇭🇲":["flag_hm","heard_mcdonald_islands"],"🇭🇳":["flag_hn","honduras"],"🇭🇷":["croatia","flag_hr"],"🇭🇹":["flag_ht","haiti"],"🇭🇺":["flag_hu","hungary"],"🇮🇨":["canary_islands","flag_ic"],"🇮🇩":["flag_id","indonesia"],"🇮🇪":["flag_ie","ireland"],"🇮🇱":["flag_il","israel"],"🇮🇲":["flag_im","isle_of_man"],"🇮🇳":["flag_in","india"],"🇮🇴":["british_indian_ocean_territory","flag_io"],"🇮🇶":["flag_iq","iraq"],"🇮🇷":["flag_ir","iran"],"🇮🇸":["flag_is","iceland"],"🇮🇹":["flag_it","italy"],"🇯🇪":["flag_je","jersey"],"🇯🇲":["flag_jm","jamaica"],"🇯🇴":["flag_jo","jordan"],"🇯🇵":["flag_jp","japan"],"🇰🇪":["flag_ke","kenya"],"🇰🇬":["flag_kg","kyrgyzstan"],"🇰🇭":["cambodia","flag_kh"],"🇰🇮":["flag_ki","kiribati"],"🇰🇲":["comoros","flag_km"],"🇰🇳":["flag_kn","st_kitts_nevis"],"🇰🇵":["flag_kp","north_korea"],"🇰🇷":["flag_kr","south_korea"],"🇰🇼":["flag_kw","kuwait"],"🇰🇾":["cayman_islands","flag_ky"],"🇰🇿":["flag_kz","kazakhstan"],"🇱🇦":["flag_la","laos"],"🇱🇧":["flag_lb","lebanon"],"🇱🇨":["flag_lc","st_lucia"],"🇱🇮":["flag_li","liechtenstein"],"🇱🇰":["flag_lk","sri_lanka"],"🇱🇷":["flag_lr","liberia"],"🇱🇸":["flag_ls","lesotho"],"🇱🇹":["flag_lt","lithuania"],"🇱🇺":["flag_lu","luxembourg"],"🇱🇻":["flag_lv","latvia"],"🇱🇾":["flag_ly","libya"],"🇲🇦":["flag_ma","morocco"],"🇲🇨":["flag_mc","monaco"],"🇲🇩":["flag_md","moldova"],"🇲🇪":["flag_me","montenegro"],"🇲🇫":["flag_mf","st_martin"],"🇲🇬":["flag_mg","madagascar"],"🇲🇭":["flag_mh","marshall_islands"],"🇲🇰":["flag_mk","macedonia"],"🇲🇱":["flag_ml","mali"],"🇲🇲":["burma","flag_mm","myanmar"],"🇲🇳":["flag_mn","mongolia"],"🇲🇴":["flag_mo","macao","macau"],"🇲🇵":["flag_mp","northern_mariana_islands"],"🇲🇶":["flag_mq","martinique"],"🇲🇷":["flag_mr","mauritania"],"🇲🇸":["flag_ms","montserrat"],"🇲🇹":["flag_mt","malta"],"🇲🇺":["flag_mu","mauritius"],"🇲🇻":["flag_mv","maldives"],"🇲🇼":["flag_mw","malawi"],"🇲🇽":["flag_mx","mexico"],"🇲🇾":["flag_my","malaysia"],"🇲🇿":["flag_mz","mozambique"],"🇳🇦":["flag_na","namibia"],"🇳🇨":["flag_nc","new_caledonia"],"🇳🇪":["flag_ne","niger"],"🇳🇫":["flag_nf","norfolk_island"],"🇳🇬":["flag_ng","nigeria"],"🇳🇮":["flag_ni","nicaragua"],"🇳🇱":["flag_nl","netherlands"],"🇳🇴":["flag_no","norway"],"🇳🇵":["flag_np","nepal"],"🇳🇷":["flag_nr","nauru"],"🇳🇺":["flag_nu","niue"],"🇳🇿":["flag_nz","new_zealand"],"🇴🇲":["flag_om","oman"],"🇵🇦":["flag_pa","panama"],"🇵🇪":["flag_pe","peru"],"🇵🇫":["flag_pf","french_polynesia"],"🇵🇬":["flag_pg","papua_new_guinea"],"🇵🇭":["flag_ph","philippines"],"🇵🇰":["flag_pk","pakistan"],"🇵🇱":["flag_pl","poland"],"🇵🇲":["flag_pm","st_pierre_miquelon"],"🇵🇳":["flag_pn","pitcairn_islands"],"🇵🇷":["flag_pr","puerto_rico"],"🇵🇸":["flag_ps","palestinian_territories"],"🇵🇹":["flag_pt","portugal"],"🇵🇼":["flag_pw","palau"],"🇵🇾":["flag_py","paraguay"],"🇶🇦":["flag_qa","qatar"],"🇷🇪":["flag_re","reunion"],"🇷🇴":["flag_ro","romania"],"🇷🇸":["flag_rs","serbia"],"🇷🇺":["flag_ru","russia"],"🇷🇼":["flag_rw","rwanda"],"🇸🇦":["flag_sa","saudi_arabia"],"🇸🇧":["flag_sb","solomon_islands"],"🇸🇨":["flag_sc","seychelles"],"🇸🇩":["flag_sd","sudan"],"🇸🇪":["flag_se","sweden"],"🇸🇬":["flag_sg","singapore"],"🇸🇭":["flag_sh","st_helena"],"🇸🇮":["flag_si","slovenia"],"🇸🇯":["flag_sj","svalbard_jan_mayen"],"🇸🇰":["flag_sk","slovakia"],"🇸🇱":["flag_sl","sierra_leone"],"🇸🇲":["flag_sm","san_marino"],"🇸🇳":["flag_sn","senegal"],"🇸🇴":["flag_so","somalia"],"🇸🇷":["flag_sr","suriname"],"🇸🇸":["flag_ss","south_sudan"],"🇸🇹":["flag_st","sao_tome_principe"],"🇸🇻":["el_salvador","flag_sv"],"🇸🇽":["flag_sx","sint_maarten"],"🇸🇾":["flag_sy","syria"],"🇸🇿":["eswatini","flag_sz","swaziland"],"🇹🇦":["flag_ta","tristan_da_cunha"],"🇹🇨":["flag_tc","turks_caicos_islands"],"🇹🇩":["chad","flag_td"],"🇹🇫":["flag_tf","french_southern_territories"],"🇹🇬":["flag_tg","togo"],"🇹🇭":["flag_th","thailand"],"🇹🇯":["flag_tj","tajikistan"],"🇹🇰":["flag_tk","tokelau"],"🇹🇱":["flag_tl","timor_leste"],"🇹🇲":["flag_tm","turkmenistan"],"🇹🇳":["flag_tn","tunisia"],"🇹🇴":["flag_to","tonga"],"🇹🇷":["flag_tr","turkey_tr"],"🇹🇹":["flag_tt","trinidad_tobago"],"🇹🇻":["flag_tv","tuvalu"],"🇹🇼":["flag_tw","taiwan"],"🇹🇿":["flag_tz","tanzania"],"🇺🇦":["flag_ua","ukraine"],"🇺🇬":["flag_ug","uganda"],"🇺🇲":["flag_um","us_outlying_islands"],"🇺🇳":["flag_un","un","united_nations"],"🇺🇸":["flag_us","united_states","usa"],"🇺🇾":["flag_uy","uruguay"],"🇺🇿":["flag_uz","uzbekistan"],"🇻🇦":["flag_va","vatican_city"],"🇻🇨":["flag_vc","st_vincent_grenadines"],"🇻🇪":["flag_ve","venezuela"],"🇻🇬":["british_virgin_islands","flag_vg"],"🇻🇮":["flag_vi","us_virgin_islands"],"🇻🇳":["flag_vn","vietnam"],"🇻🇺":["flag_vu","vanuatu"],"🇼🇫":["flag_wf","wallis_futuna"],"🇼🇸":["flag_ws","samoa"],"🇽🇰":["flag_xk","kosovo"],"🇾🇪":["flag_ye","yemen"],"🇾🇹":["flag_yt","mayotte"],"🇿🇦":["flag_za","south_africa"],"🇿🇲":["flag_zm","zambia"],"🇿🇼":["flag_zw","zimbabwe"],"🏴󠁧󠁢󠁥󠁮󠁧󠁿":["england","flag_gbeng"],"🏴󠁧󠁢󠁳󠁣󠁴󠁿":["flag_gbsct","scotland"],"🏴󠁧󠁢󠁷󠁬󠁳󠁿":["flag_gbwls","wales"]}'),o=flarum.core.compat["common/extend"],i=flarum.core.compat["common/components/TextEditor"];var _=d.n(i);const r=flarum.core.compat["common/components/TextEditorButton"];var f=d.n(r);const c=flarum.core.compat["common/utils/KeyboardNavigatable"];var t=d.n(c);function l(d){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(d){return typeof d}:function(d){return d&&"function"==typeof Symbol&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},l(d)}function s(d,e,u){return(e=function(d){var e=function(d,e){if("object"!==l(d)||null===d)return d;var u=d[Symbol.toPrimitive];if(void 0!==u){var a=u.call(d,e);if("object"!==l(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(d)}(d,"string");return"symbol"===l(e)?e:String(e)}(e))in d?Object.defineProperty(d,e,{value:u,enumerable:!0,configurable:!0,writable:!0}):d[e]=u,d}const g=flarum.core.compat["common/Fragment"];var b=d.n(g);class h extends(b()){constructor(){super(...arguments),s(this,"items",[]),s(this,"active",!1),s(this,"index",0),s(this,"keyWasJustPressed",!1)}view(){return m("ul",{className:"Dropdown-menu EmojiDropdown"},m("li",{className:"Dropdown-header"},app.translator.trans("flarum-emoji.forum.composer.type_to_search_text")),this.items.map((d=>m("li",{key:d.attrs.key},d))))}show(d,e){this.$().show().css({left:d+"px",top:e+"px"}),this.active=!0}hide(){this.$().hide(),this.active=!1}navigate(d){this.keyWasJustPressed=!0,this.setIndex(this.index+d,!0),clearTimeout(this.keyWasJustPressedTimeout),this.keyWasJustPressedTimeout=setTimeout((()=>this.keyWasJustPressed=!1),500)}complete(){this.$("li:not(.Dropdown-header)").eq(this.index).find("button").click()}setIndex(d,e){if(this.keyWasJustPressed&&!e)return;const u=this.$(),a=u.find("li:not(.Dropdown-header)");let n=d;n<0?n=a.length-1:n>=a.length&&(n=0),this.index=n;const o=a.removeClass("active").eq(n).addClass("active");if(e){const d=u.scrollTop(),e=u.offset().top,a=e+u.outerHeight(),n=o.offset().top,i=n+o.outerHeight();let _;na&&(_=d-a+i+parseInt(u.css("padding-bottom"),10)),void 0!==_&&u.stop(!0).animate({scrollTop:_},100)}}}var p=function(){var d={base:"https://twemoji.maxcdn.com/v/14.0.2/",ext:".png",size:"72x72",className:"emoji",convert:{fromCodePoint:function(d){var e="string"==typeof d?parseInt(d,16):d;return e<65536?_(e):_(55296+((e-=65536)>>10),56320+(1023&e))},toCodePoint:h},onerror:function(){this.parentNode&&this.parentNode.replaceChild(r(this.alt,!1),this)},parse:function(e,u){return u&&"function"!=typeof u||(u={callback:u}),("string"==typeof e?s:l)(e,{callback:u.callback||f,attributes:"function"==typeof u.attributes?u.attributes:m,base:"string"==typeof u.base?u.base:d.base,ext:u.ext||d.ext,size:u.folder||(a=u.size||d.size,"number"==typeof a?a+"x"+a:a),className:u.className||d.className,onerror:u.onerror||d.onerror});var a},replace:b,test:function(d){u.lastIndex=0;var e=u.test(d);return u.lastIndex=0,e}},e={"&":"&","<":"<",">":">","'":"'",'"':"""},u=/(?:\ud83d\udc68\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffc-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb\udffd-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb-\udffd\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb-\udffe]|\ud83d\udc68\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc68\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc68\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffc-\udfff]|\ud83e\uddd1\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb\udffd-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb-\udffd\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d[\udc68\udc69]|\ud83e\udef1\ud83c\udffb\u200d\ud83e\udef2\ud83c[\udffc-\udfff]|\ud83e\udef1\ud83c\udffc\u200d\ud83e\udef2\ud83c[\udffb\udffd-\udfff]|\ud83e\udef1\ud83c\udffd\u200d\ud83e\udef2\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\udef1\ud83c\udffe\u200d\ud83e\udef2\ud83c[\udffb-\udffd\udfff]|\ud83e\udef1\ud83c\udfff\u200d\ud83e\udef2\ud83c[\udffb-\udffe]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc68|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d[\udc68\udc69]|\ud83e\uddd1\u200d\ud83e\udd1d\u200d\ud83e\uddd1|\ud83d\udc6b\ud83c[\udffb-\udfff]|\ud83d\udc6c\ud83c[\udffb-\udfff]|\ud83d\udc6d\ud83c[\udffb-\udfff]|\ud83d\udc8f\ud83c[\udffb-\udfff]|\ud83d\udc91\ud83c[\udffb-\udfff]|\ud83e\udd1d\ud83c[\udffb-\udfff]|\ud83d[\udc6b-\udc6d\udc8f\udc91]|\ud83e\udd1d)|(?:\ud83d[\udc68\udc69]|\ud83e\uddd1)(?:\ud83c[\udffb-\udfff])?\u200d(?:\u2695\ufe0f|\u2696\ufe0f|\u2708\ufe0f|\ud83c[\udf3e\udf73\udf7c\udf84\udf93\udfa4\udfa8\udfeb\udfed]|\ud83d[\udcbb\udcbc\udd27\udd2c\ude80\ude92]|\ud83e[\uddaf-\uddb3\uddbc\uddbd])|(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75]|\u26f9)((?:\ud83c[\udffb-\udfff]|\ufe0f)\u200d[\u2640\u2642]\ufe0f)|(?:\ud83c[\udfc3\udfc4\udfca]|\ud83d[\udc6e\udc70\udc71\udc73\udc77\udc81\udc82\udc86\udc87\ude45-\ude47\ude4b\ude4d\ude4e\udea3\udeb4-\udeb6]|\ud83e[\udd26\udd35\udd37-\udd39\udd3d\udd3e\uddb8\uddb9\uddcd-\uddcf\uddd4\uddd6-\udddd])(?:\ud83c[\udffb-\udfff])?\u200d[\u2640\u2642]\ufe0f|(?:\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f|\ud83c\udff3\ufe0f\u200d\ud83c\udf08|\ud83d\ude36\u200d\ud83c\udf2b\ufe0f|\u2764\ufe0f\u200d\ud83d\udd25|\u2764\ufe0f\u200d\ud83e\ude79|\ud83c\udff4\u200d\u2620\ufe0f|\ud83d\udc15\u200d\ud83e\uddba|\ud83d\udc3b\u200d\u2744\ufe0f|\ud83d\udc41\u200d\ud83d\udde8|\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc6f\u200d\u2640\ufe0f|\ud83d\udc6f\u200d\u2642\ufe0f|\ud83d\ude2e\u200d\ud83d\udca8|\ud83d\ude35\u200d\ud83d\udcab|\ud83e\udd3c\u200d\u2640\ufe0f|\ud83e\udd3c\u200d\u2642\ufe0f|\ud83e\uddde\u200d\u2640\ufe0f|\ud83e\uddde\u200d\u2642\ufe0f|\ud83e\udddf\u200d\u2640\ufe0f|\ud83e\udddf\u200d\u2642\ufe0f|\ud83d\udc08\u200d\u2b1b)|[#*0-9]\ufe0f?\u20e3|(?:[©®\u2122\u265f]\ufe0f)|(?:\ud83c[\udc04\udd70\udd71\udd7e\udd7f\ude02\ude1a\ude2f\ude37\udf21\udf24-\udf2c\udf36\udf7d\udf96\udf97\udf99-\udf9b\udf9e\udf9f\udfcd\udfce\udfd4-\udfdf\udff3\udff5\udff7]|\ud83d[\udc3f\udc41\udcfd\udd49\udd4a\udd6f\udd70\udd73\udd76-\udd79\udd87\udd8a-\udd8d\udda5\udda8\uddb1\uddb2\uddbc\uddc2-\uddc4\uddd1-\uddd3\udddc-\uddde\udde1\udde3\udde8\uddef\uddf3\uddfa\udecb\udecd-\udecf\udee0-\udee5\udee9\udef0\udef3]|[\u203c\u2049\u2139\u2194-\u2199\u21a9\u21aa\u231a\u231b\u2328\u23cf\u23ed-\u23ef\u23f1\u23f2\u23f8-\u23fa\u24c2\u25aa\u25ab\u25b6\u25c0\u25fb-\u25fe\u2600-\u2604\u260e\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262a\u262e\u262f\u2638-\u263a\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267b\u267f\u2692-\u2697\u2699\u269b\u269c\u26a0\u26a1\u26a7\u26aa\u26ab\u26b0\u26b1\u26bd\u26be\u26c4\u26c5\u26c8\u26cf\u26d1\u26d3\u26d4\u26e9\u26ea\u26f0-\u26f5\u26f8\u26fa\u26fd\u2702\u2708\u2709\u270f\u2712\u2714\u2716\u271d\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u2764\u27a1\u2934\u2935\u2b05-\u2b07\u2b1b\u2b1c\u2b50\u2b55\u3030\u303d\u3297\u3299])(?:\ufe0f|(?!\ufe0e))|(?:(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75\udd90]|[\u261d\u26f7\u26f9\u270c\u270d])(?:\ufe0f|(?!\ufe0e))|(?:\ud83c[\udf85\udfc2-\udfc4\udfc7\udfca]|\ud83d[\udc42\udc43\udc46-\udc50\udc66-\udc69\udc6e\udc70-\udc78\udc7c\udc81-\udc83\udc85-\udc87\udcaa\udd7a\udd95\udd96\ude45-\ude47\ude4b-\ude4f\udea3\udeb4-\udeb6\udec0\udecc]|\ud83e[\udd0c\udd0f\udd18-\udd1c\udd1e\udd1f\udd26\udd30-\udd39\udd3d\udd3e\udd77\uddb5\uddb6\uddb8\uddb9\uddbb\uddcd-\uddcf\uddd1-\udddd\udec3-\udec5\udef0-\udef6]|[\u270a\u270b]))(?:\ud83c[\udffb-\udfff])?|(?:\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc73\udb40\udc63\udb40\udc74\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc77\udb40\udc6c\udb40\udc73\udb40\udc7f|\ud83c\udde6\ud83c[\udde8-\uddec\uddee\uddf1\uddf2\uddf4\uddf6-\uddfa\uddfc\uddfd\uddff]|\ud83c\udde7\ud83c[\udde6\udde7\udde9-\uddef\uddf1-\uddf4\uddf6-\uddf9\uddfb\uddfc\uddfe\uddff]|\ud83c\udde8\ud83c[\udde6\udde8\udde9\uddeb-\uddee\uddf0-\uddf5\uddf7\uddfa-\uddff]|\ud83c\udde9\ud83c[\uddea\uddec\uddef\uddf0\uddf2\uddf4\uddff]|\ud83c\uddea\ud83c[\udde6\udde8\uddea\uddec\udded\uddf7-\uddfa]|\ud83c\uddeb\ud83c[\uddee-\uddf0\uddf2\uddf4\uddf7]|\ud83c\uddec\ud83c[\udde6\udde7\udde9-\uddee\uddf1-\uddf3\uddf5-\uddfa\uddfc\uddfe]|\ud83c\udded\ud83c[\uddf0\uddf2\uddf3\uddf7\uddf9\uddfa]|\ud83c\uddee\ud83c[\udde8-\uddea\uddf1-\uddf4\uddf6-\uddf9]|\ud83c\uddef\ud83c[\uddea\uddf2\uddf4\uddf5]|\ud83c\uddf0\ud83c[\uddea\uddec-\uddee\uddf2\uddf3\uddf5\uddf7\uddfc\uddfe\uddff]|\ud83c\uddf1\ud83c[\udde6-\udde8\uddee\uddf0\uddf7-\uddfb\uddfe]|\ud83c\uddf2\ud83c[\udde6\udde8-\udded\uddf0-\uddff]|\ud83c\uddf3\ud83c[\udde6\udde8\uddea-\uddec\uddee\uddf1\uddf4\uddf5\uddf7\uddfa\uddff]|\ud83c\uddf4\ud83c\uddf2|\ud83c\uddf5\ud83c[\udde6\uddea-\udded\uddf0-\uddf3\uddf7-\uddf9\uddfc\uddfe]|\ud83c\uddf6\ud83c\udde6|\ud83c\uddf7\ud83c[\uddea\uddf4\uddf8\uddfa\uddfc]|\ud83c\uddf8\ud83c[\udde6-\uddea\uddec-\uddf4\uddf7-\uddf9\uddfb\uddfd-\uddff]|\ud83c\uddf9\ud83c[\udde6\udde8\udde9\uddeb-\udded\uddef-\uddf4\uddf7\uddf9\uddfb\uddfc\uddff]|\ud83c\uddfa\ud83c[\udde6\uddec\uddf2\uddf3\uddf8\uddfe\uddff]|\ud83c\uddfb\ud83c[\udde6\udde8\uddea\uddec\uddee\uddf3\uddfa]|\ud83c\uddfc\ud83c[\uddeb\uddf8]|\ud83c\uddfd\ud83c\uddf0|\ud83c\uddfe\ud83c[\uddea\uddf9]|\ud83c\uddff\ud83c[\udde6\uddf2\uddfc]|\ud83c[\udccf\udd8e\udd91-\udd9a\udde6-\uddff\ude01\ude32-\ude36\ude38-\ude3a\ude50\ude51\udf00-\udf20\udf2d-\udf35\udf37-\udf7c\udf7e-\udf84\udf86-\udf93\udfa0-\udfc1\udfc5\udfc6\udfc8\udfc9\udfcf-\udfd3\udfe0-\udff0\udff4\udff8-\udfff]|\ud83d[\udc00-\udc3e\udc40\udc44\udc45\udc51-\udc65\udc6a\udc6f\udc79-\udc7b\udc7d-\udc80\udc84\udc88-\udc8e\udc90\udc92-\udca9\udcab-\udcfc\udcff-\udd3d\udd4b-\udd4e\udd50-\udd67\udda4\uddfb-\ude44\ude48-\ude4a\ude80-\udea2\udea4-\udeb3\udeb7-\udebf\udec1-\udec5\uded0-\uded2\uded5-\uded7\udedd-\udedf\udeeb\udeec\udef4-\udefc\udfe0-\udfeb\udff0]|\ud83e[\udd0d\udd0e\udd10-\udd17\udd20-\udd25\udd27-\udd2f\udd3a\udd3c\udd3f-\udd45\udd47-\udd76\udd78-\uddb4\uddb7\uddba\uddbc-\uddcc\uddd0\uddde-\uddff\ude70-\ude74\ude78-\ude7c\ude80-\ude86\ude90-\udeac\udeb0-\udeba\udec0-\udec2\uded0-\uded9\udee0-\udee7]|[\u23e9-\u23ec\u23f0\u23f3\u267e\u26ce\u2705\u2728\u274c\u274e\u2753-\u2755\u2795-\u2797\u27b0\u27bf\ue50a])|\ufe0f/g,a=/\uFE0F/g,n=String.fromCharCode(8205),o=/[&<>'"]/g,i=/^(?:iframe|noframes|noscript|script|select|style|textarea)$/,_=String.fromCharCode;return d;function r(d,e){return document.createTextNode(e?d.replace(a,""):d)}function f(d,e){return"".concat(e.base,e.size,"/",d,e.ext)}function c(d,e){for(var u,a,n=d.childNodes,o=n.length;o--;)3===(a=(u=n[o]).nodeType)?e.push(u):1!==a||"ownerSVGElement"in u||i.test(u.nodeName.toLowerCase())||c(u,e);return e}function t(d){return h(d.indexOf(n)<0?d.replace(a,""):d)}function l(d,e){for(var a,n,o,i,_,f,l,s,g,m,b,h,p,w=c(d,[]),k=w.length;k--;){for(o=!1,i=document.createDocumentFragment(),f=(_=w[k]).nodeValue,s=0;l=u.exec(f);){if((g=l.index)!==s&&i.appendChild(r(f.slice(s,g),!0)),h=t(b=l[0]),s=g+b.length,p=e.callback(h,e),h&&p){for(n in(m=new Image).onerror=e.onerror,m.setAttribute("draggable","false"),a=e.attributes(b,h))a.hasOwnProperty(n)&&0!==n.indexOf("on")&&!m.hasAttribute(n)&&m.setAttribute(n,a[n]);m.className=e.className,m.alt=b,m.src=p,o=!0,i.appendChild(m)}m||i.appendChild(r(b,!1)),m=null}o&&(s")}return n}))}function g(d){return e[d]}function m(){return null}function b(d,e){return String(d).replace(u,e)}function h(d,e){for(var u=[],a=0,n=0,o=0;o({loading:"lazy"})};a().initializers.add("flarum-emoji",(()=>{!function(){const d=Object.keys(n),e=$('
'),u=new h;(0,o.extend)(_().prototype,"oncreate",(function(){const d=this.$(".TextEditor-editor").wrap('
');this.navigator=new(t()),this.navigator.when((()=>u.active)).onUp((()=>u.navigate(-1))).onDown((()=>u.navigate(1))).onSelect(u.complete.bind(u)).onCancel(u.hide.bind(u)).bindTo(d),d.after(e)})),(0,o.extend)(_().prototype,"buildEditorParams",(function(a){let o,i,_;const r=d=>{this.attrs.composer.editor.replaceBeforeCursor(i-1,d+" "),u.hide()};a.inputListeners.push((()=>{const a=this.attrs.composer.editor.getSelectionRange(),f=a[0];if(a[1]-f>0)return;const c=this.attrs.composer.editor.getLastNChars(15);i=0;for(let d=c.length-1;d>=0;d--){const e=c.substr(d,1);if(!/[a-z0-9]|\+|\-|_|\:/.test(e))break;if(":"===e&&(0==d||/\s/.test(c.substr(d-1,1)))){o=d+1,i=f-c.length+d+1;break}}if(u.hide(),u.active=!1,i){_=c.substring(o).toLowerCase();const a=function(d){let{emoji:e,name:a,code:n}=d;return m("button",{key:e,onclick:()=>r(e),onmouseenter:function(){u.setIndex($(this).parent().index()-1)}},m("img",{alt:e,className:"emoji",draggable:"false",loading:"lazy",src:"".concat(j,"72x72/").concat(n,".png")}),a)};(()=>{const o=[],r=function(d){const e=new RegExp("\\((["+"+.*?[]{}()^$|\\".replace(/(.)/g,"\\$1")+"])\\)","g");return new RegExp("(.*)"+d.toLowerCase().replace(/(.)/g,"($1)(.*?)").replace(e,"(\\$1)")+"$","i")}(_);let f=7;const c=e=>{for(let u=0;u0;u++){const a=d[u];if(-1===o.indexOf(a)){const d=n[a];for(let u of d)if(e(u)){--f,o.push(a);break}}}};c((d=>0===d.indexOf(_))),c((d=>r.test(d)));const t=o.map((d=>({emoji:d,name:n[d][0],code:v(d)}))).map(a);if(t.length){u.items=t,m.render(e[0],u.render()),u.show();const d=this.attrs.composer.editor.getCaretCoordinates(i),a=u.$().outerWidth(),n=u.$().outerHeight(),o=u.$().offsetParent();let _=d.left,r=d.top+15;r+n>o.height()&&(r=d.top-n-15),_+a>o.width()&&(_=o.width()-a),r=Math.max(-(o.offset().top-$(document).scrollTop()),r),_=Math.max(-o.offset().left,_),u.show(_,r)}})(),u.setIndex(0),u.$().scrollTop(0),u.active=!0}}))})),(0,o.extend)(_().prototype,"toolbarItems",(function(d){d.add("emoji",m(f(),{onclick:()=>this.attrs.composer.editor.insertAtCursor(" :"),icon:"far fa-smile"},app.translator.trans("flarum-emoji.forum.composer.emoji_tooltip")))}))}(),(0,o.override)(q().prototype,"contentHtml",(function(d){const e=d();if(this.oldContentHtml!==e){const d=w.parse(function(d){const e=document.implementation.createHTMLDocument();return e.body.innerHTML=d,e.body}(e),C);this.emojifiedContentHtml=d.innerHTML,this.oldContentHtml=e}return this.emojifiedContentHtml})),(0,o.override)(s9e.TextFormatter,"preview",((d,e,u)=>{d(e,u),w.parse(u,C)}))}))})(),module.exports=e})(); +(()=>{var d,u,f={},e={};function c(d){var u=e[d];if(void 0!==u)return u.exports;var t=e[d]={exports:{}};return f[d](t,t.exports,c),t.exports}c.m=f,c.n=d=>{var u=d&&d.__esModule?()=>d.default:()=>d;return c.d(u,{a:u}),u},c.d=(d,u)=>{for(var f in u)c.o(u,f)&&!c.o(d,f)&&Object.defineProperty(d,f,{enumerable:!0,get:u[f]})},c.f={},c.e=d=>Promise.all(Object.keys(c.f).reduce(((u,f)=>(c.f[f](d,u),u)),[])),c.u=d=>"forum/emojiMap.js",c.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(d){if("object"==typeof window)return window}}(),c.o=(d,u)=>Object.prototype.hasOwnProperty.call(d,u),d={},u="module.exports:",c.l=(f,e,t,o)=>{if(d[f])d[f].push(e);else{var r,n;if(void 0!==t)for(var a=document.getElementsByTagName("script"),i=0;i{r.onerror=r.onload=null,clearTimeout(l);var c=d[f];if(delete d[f],r.parentNode&&r.parentNode.removeChild(r),c&&c.forEach((d=>d(e))),u)return u(e)},l=setTimeout(b.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=b.bind(null,r.onerror),r.onload=b.bind(null,r.onload),n&&document.head.appendChild(r)}},c.r=d=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(d,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(d,"__esModule",{value:!0})},(()=>{var d;c.g.importScripts&&(d=c.g.location+"");var u=c.g.document;if(!d&&u&&(u.currentScript&&"SCRIPT"===u.currentScript.tagName.toUpperCase()&&(d=u.currentScript.src),!d)){var f=u.getElementsByTagName("script");if(f.length)for(var e=f.length-1;e>-1&&(!d||!/^http(s?):/.test(d));)d=f[e--].src}if(!d)throw new Error("Automatic publicPath is not supported in this browser");d=d.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),c.p=d})(),c.f.compat=(d,u)=>{const f=c.l;c.l=flarum.reg.loadChunk.bind(flarum.reg,f)},(()=>{var d={170:0};c.f.j=(u,f)=>{var e=c.o(d,u)?d[u]:void 0;if(0!==e)if(e)f.push(e[2]);else{var t=new Promise(((f,c)=>e=d[u]=[f,c]));f.push(e[2]=t);var o=c.p+c.u(u),r=new Error;c.l(o,(f=>{if(c.o(d,u)&&(0!==(e=d[u])&&(d[u]=void 0),e)){var t=f&&("load"===f.type?"missing":f.type),o=f&&f.target&&f.target.src;r.message="Loading chunk "+u+" failed.\n("+t+": "+o+")",r.name="ChunkLoadError",r.type=t,r.request=o,e[1](r)}}),"chunk-"+u,u)}};var u=(u,f)=>{var e,t,[o,r,n]=f,a=0;if(o.some((u=>0!==d[u]))){for(e in r)c.o(r,e)&&(c.m[e]=r[e]);n&&n(c)}for(u&&u(f);a{"use strict";const d=flarum.reg.get("core","forum/app");var u=c.n(d);const f=flarum.reg.get("core","common/extend"),e=flarum.reg.get("core","common/components/TextEditorButton");var t=c.n(e);const o=flarum.reg.get("core","common/utils/KeyboardNavigatable");var r=c.n(o);const n=flarum.reg.get("core","common/components/Tooltip");var a=c.n(n);const i=flarum.reg.get("core","common/utils/AutocompleteReader");var s=c.n(i);function b(d){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(d){return typeof d}:function(d){return d&&"function"==typeof Symbol&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},b(d)}function l(d,u,f){return(u=function(d){var u=function(d){if("object"!=b(d)||!d)return d;var u=d[Symbol.toPrimitive];if(void 0!==u){var f=u.call(d,"string");if("object"!=b(f))return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(d)}(d);return"symbol"==b(u)?u:u+""}(u))in d?Object.defineProperty(d,u,{value:f,enumerable:!0,configurable:!0,writable:!0}):d[u]=f,d}const p=flarum.reg.get("core","common/Fragment");var h=c.n(p);class g extends(h()){constructor(){super(...arguments),l(this,"items",[]),l(this,"active",!1),l(this,"index",0),l(this,"keyWasJustPressed",!1)}view(){return m("ul",{className:"Dropdown-menu EmojiDropdown"},m("li",{className:"Dropdown-header"},app.translator.trans("flarum-emoji.forum.composer.type_to_search_text")),this.items.map((d=>m("li",{key:d.attrs.key},d))))}show(d,u){this.$().show().css({left:d+"px",top:u+"px"}),this.active=!0}hide(){this.$().hide(),this.active=!1}navigate(d){this.keyWasJustPressed=!0,this.setIndex(this.index+d,!0),clearTimeout(this.keyWasJustPressedTimeout),this.keyWasJustPressedTimeout=setTimeout((()=>this.keyWasJustPressed=!1),500)}complete(){this.$("li:not(.Dropdown-header)").eq(this.index).find("button").click()}setIndex(d,u){if(this.keyWasJustPressed&&!u)return;const f=this.$(),e=f.find("li:not(.Dropdown-header)");let c=d;c<0?c=e.length-1:c>=e.length&&(c=0),this.index=c;const t=e.removeClass("active").eq(c).addClass("active");if(u){const d=f.scrollTop(),u=f.offset().top,e=u+f.outerHeight(),c=t.offset().top,o=c+t.outerHeight();let r;ce&&(r=d-e+o+parseInt(f.css("padding-bottom"),10)),void 0!==r&&f.stop(!0).animate({scrollTop:r},100)}}}flarum.reg.add("flarum-emoji","forum/fragments/AutocompleteDropdown",g);var v=function(){var d={base:"https://twemoji.maxcdn.com/v/14.0.2/",ext:".png",size:"72x72",className:"emoji",convert:{fromCodePoint:function(d){var u="string"==typeof d?parseInt(d,16):d;return u<65536?r(u):r(55296+((u-=65536)>>10),56320+(1023&u))},toCodePoint:g},onerror:function(){this.parentNode&&this.parentNode.replaceChild(n(this.alt,!1),this)},parse:function(u,f){return f&&"function"!=typeof f||(f={callback:f}),("string"==typeof u?l:b)(u,{callback:f.callback||a,attributes:"function"==typeof f.attributes?f.attributes:p,base:"string"==typeof f.base?f.base:d.base,ext:f.ext||d.ext,size:f.folder||(e=f.size||d.size,"number"==typeof e?e+"x"+e:e),className:f.className||d.className,onerror:f.onerror||d.onerror});var e},replace:h,test:function(d){f.lastIndex=0;var u=f.test(d);return f.lastIndex=0,u}},u={"&":"&","<":"<",">":">","'":"'",'"':"""},f=/(?:\ud83d\udc68\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffc-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb\udffd-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb-\udffd\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb-\udffe]|\ud83d\udc68\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc68\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc68\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffc-\udfff]|\ud83e\uddd1\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb\udffd-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb-\udffd\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d[\udc68\udc69]|\ud83e\udef1\ud83c\udffb\u200d\ud83e\udef2\ud83c[\udffc-\udfff]|\ud83e\udef1\ud83c\udffc\u200d\ud83e\udef2\ud83c[\udffb\udffd-\udfff]|\ud83e\udef1\ud83c\udffd\u200d\ud83e\udef2\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\udef1\ud83c\udffe\u200d\ud83e\udef2\ud83c[\udffb-\udffd\udfff]|\ud83e\udef1\ud83c\udfff\u200d\ud83e\udef2\ud83c[\udffb-\udffe]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc68|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d[\udc68\udc69]|\ud83e\uddd1\u200d\ud83e\udd1d\u200d\ud83e\uddd1|\ud83d\udc6b\ud83c[\udffb-\udfff]|\ud83d\udc6c\ud83c[\udffb-\udfff]|\ud83d\udc6d\ud83c[\udffb-\udfff]|\ud83d\udc8f\ud83c[\udffb-\udfff]|\ud83d\udc91\ud83c[\udffb-\udfff]|\ud83e\udd1d\ud83c[\udffb-\udfff]|\ud83d[\udc6b-\udc6d\udc8f\udc91]|\ud83e\udd1d)|(?:\ud83d[\udc68\udc69]|\ud83e\uddd1)(?:\ud83c[\udffb-\udfff])?\u200d(?:\u2695\ufe0f|\u2696\ufe0f|\u2708\ufe0f|\ud83c[\udf3e\udf73\udf7c\udf84\udf93\udfa4\udfa8\udfeb\udfed]|\ud83d[\udcbb\udcbc\udd27\udd2c\ude80\ude92]|\ud83e[\uddaf-\uddb3\uddbc\uddbd])|(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75]|\u26f9)((?:\ud83c[\udffb-\udfff]|\ufe0f)\u200d[\u2640\u2642]\ufe0f)|(?:\ud83c[\udfc3\udfc4\udfca]|\ud83d[\udc6e\udc70\udc71\udc73\udc77\udc81\udc82\udc86\udc87\ude45-\ude47\ude4b\ude4d\ude4e\udea3\udeb4-\udeb6]|\ud83e[\udd26\udd35\udd37-\udd39\udd3d\udd3e\uddb8\uddb9\uddcd-\uddcf\uddd4\uddd6-\udddd])(?:\ud83c[\udffb-\udfff])?\u200d[\u2640\u2642]\ufe0f|(?:\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f|\ud83c\udff3\ufe0f\u200d\ud83c\udf08|\ud83d\ude36\u200d\ud83c\udf2b\ufe0f|\u2764\ufe0f\u200d\ud83d\udd25|\u2764\ufe0f\u200d\ud83e\ude79|\ud83c\udff4\u200d\u2620\ufe0f|\ud83d\udc15\u200d\ud83e\uddba|\ud83d\udc3b\u200d\u2744\ufe0f|\ud83d\udc41\u200d\ud83d\udde8|\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc6f\u200d\u2640\ufe0f|\ud83d\udc6f\u200d\u2642\ufe0f|\ud83d\ude2e\u200d\ud83d\udca8|\ud83d\ude35\u200d\ud83d\udcab|\ud83e\udd3c\u200d\u2640\ufe0f|\ud83e\udd3c\u200d\u2642\ufe0f|\ud83e\uddde\u200d\u2640\ufe0f|\ud83e\uddde\u200d\u2642\ufe0f|\ud83e\udddf\u200d\u2640\ufe0f|\ud83e\udddf\u200d\u2642\ufe0f|\ud83d\udc08\u200d\u2b1b)|[#*0-9]\ufe0f?\u20e3|(?:[©®\u2122\u265f]\ufe0f)|(?:\ud83c[\udc04\udd70\udd71\udd7e\udd7f\ude02\ude1a\ude2f\ude37\udf21\udf24-\udf2c\udf36\udf7d\udf96\udf97\udf99-\udf9b\udf9e\udf9f\udfcd\udfce\udfd4-\udfdf\udff3\udff5\udff7]|\ud83d[\udc3f\udc41\udcfd\udd49\udd4a\udd6f\udd70\udd73\udd76-\udd79\udd87\udd8a-\udd8d\udda5\udda8\uddb1\uddb2\uddbc\uddc2-\uddc4\uddd1-\uddd3\udddc-\uddde\udde1\udde3\udde8\uddef\uddf3\uddfa\udecb\udecd-\udecf\udee0-\udee5\udee9\udef0\udef3]|[\u203c\u2049\u2139\u2194-\u2199\u21a9\u21aa\u231a\u231b\u2328\u23cf\u23ed-\u23ef\u23f1\u23f2\u23f8-\u23fa\u24c2\u25aa\u25ab\u25b6\u25c0\u25fb-\u25fe\u2600-\u2604\u260e\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262a\u262e\u262f\u2638-\u263a\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267b\u267f\u2692-\u2697\u2699\u269b\u269c\u26a0\u26a1\u26a7\u26aa\u26ab\u26b0\u26b1\u26bd\u26be\u26c4\u26c5\u26c8\u26cf\u26d1\u26d3\u26d4\u26e9\u26ea\u26f0-\u26f5\u26f8\u26fa\u26fd\u2702\u2708\u2709\u270f\u2712\u2714\u2716\u271d\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u2764\u27a1\u2934\u2935\u2b05-\u2b07\u2b1b\u2b1c\u2b50\u2b55\u3030\u303d\u3297\u3299])(?:\ufe0f|(?!\ufe0e))|(?:(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75\udd90]|[\u261d\u26f7\u26f9\u270c\u270d])(?:\ufe0f|(?!\ufe0e))|(?:\ud83c[\udf85\udfc2-\udfc4\udfc7\udfca]|\ud83d[\udc42\udc43\udc46-\udc50\udc66-\udc69\udc6e\udc70-\udc78\udc7c\udc81-\udc83\udc85-\udc87\udcaa\udd7a\udd95\udd96\ude45-\ude47\ude4b-\ude4f\udea3\udeb4-\udeb6\udec0\udecc]|\ud83e[\udd0c\udd0f\udd18-\udd1c\udd1e\udd1f\udd26\udd30-\udd39\udd3d\udd3e\udd77\uddb5\uddb6\uddb8\uddb9\uddbb\uddcd-\uddcf\uddd1-\udddd\udec3-\udec5\udef0-\udef6]|[\u270a\u270b]))(?:\ud83c[\udffb-\udfff])?|(?:\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc73\udb40\udc63\udb40\udc74\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc77\udb40\udc6c\udb40\udc73\udb40\udc7f|\ud83c\udde6\ud83c[\udde8-\uddec\uddee\uddf1\uddf2\uddf4\uddf6-\uddfa\uddfc\uddfd\uddff]|\ud83c\udde7\ud83c[\udde6\udde7\udde9-\uddef\uddf1-\uddf4\uddf6-\uddf9\uddfb\uddfc\uddfe\uddff]|\ud83c\udde8\ud83c[\udde6\udde8\udde9\uddeb-\uddee\uddf0-\uddf5\uddf7\uddfa-\uddff]|\ud83c\udde9\ud83c[\uddea\uddec\uddef\uddf0\uddf2\uddf4\uddff]|\ud83c\uddea\ud83c[\udde6\udde8\uddea\uddec\udded\uddf7-\uddfa]|\ud83c\uddeb\ud83c[\uddee-\uddf0\uddf2\uddf4\uddf7]|\ud83c\uddec\ud83c[\udde6\udde7\udde9-\uddee\uddf1-\uddf3\uddf5-\uddfa\uddfc\uddfe]|\ud83c\udded\ud83c[\uddf0\uddf2\uddf3\uddf7\uddf9\uddfa]|\ud83c\uddee\ud83c[\udde8-\uddea\uddf1-\uddf4\uddf6-\uddf9]|\ud83c\uddef\ud83c[\uddea\uddf2\uddf4\uddf5]|\ud83c\uddf0\ud83c[\uddea\uddec-\uddee\uddf2\uddf3\uddf5\uddf7\uddfc\uddfe\uddff]|\ud83c\uddf1\ud83c[\udde6-\udde8\uddee\uddf0\uddf7-\uddfb\uddfe]|\ud83c\uddf2\ud83c[\udde6\udde8-\udded\uddf0-\uddff]|\ud83c\uddf3\ud83c[\udde6\udde8\uddea-\uddec\uddee\uddf1\uddf4\uddf5\uddf7\uddfa\uddff]|\ud83c\uddf4\ud83c\uddf2|\ud83c\uddf5\ud83c[\udde6\uddea-\udded\uddf0-\uddf3\uddf7-\uddf9\uddfc\uddfe]|\ud83c\uddf6\ud83c\udde6|\ud83c\uddf7\ud83c[\uddea\uddf4\uddf8\uddfa\uddfc]|\ud83c\uddf8\ud83c[\udde6-\uddea\uddec-\uddf4\uddf7-\uddf9\uddfb\uddfd-\uddff]|\ud83c\uddf9\ud83c[\udde6\udde8\udde9\uddeb-\udded\uddef-\uddf4\uddf7\uddf9\uddfb\uddfc\uddff]|\ud83c\uddfa\ud83c[\udde6\uddec\uddf2\uddf3\uddf8\uddfe\uddff]|\ud83c\uddfb\ud83c[\udde6\udde8\uddea\uddec\uddee\uddf3\uddfa]|\ud83c\uddfc\ud83c[\uddeb\uddf8]|\ud83c\uddfd\ud83c\uddf0|\ud83c\uddfe\ud83c[\uddea\uddf9]|\ud83c\uddff\ud83c[\udde6\uddf2\uddfc]|\ud83c[\udccf\udd8e\udd91-\udd9a\udde6-\uddff\ude01\ude32-\ude36\ude38-\ude3a\ude50\ude51\udf00-\udf20\udf2d-\udf35\udf37-\udf7c\udf7e-\udf84\udf86-\udf93\udfa0-\udfc1\udfc5\udfc6\udfc8\udfc9\udfcf-\udfd3\udfe0-\udff0\udff4\udff8-\udfff]|\ud83d[\udc00-\udc3e\udc40\udc44\udc45\udc51-\udc65\udc6a\udc6f\udc79-\udc7b\udc7d-\udc80\udc84\udc88-\udc8e\udc90\udc92-\udca9\udcab-\udcfc\udcff-\udd3d\udd4b-\udd4e\udd50-\udd67\udda4\uddfb-\ude44\ude48-\ude4a\ude80-\udea2\udea4-\udeb3\udeb7-\udebf\udec1-\udec5\uded0-\uded2\uded5-\uded7\udedd-\udedf\udeeb\udeec\udef4-\udefc\udfe0-\udfeb\udff0]|\ud83e[\udd0d\udd0e\udd10-\udd17\udd20-\udd25\udd27-\udd2f\udd3a\udd3c\udd3f-\udd45\udd47-\udd76\udd78-\uddb4\uddb7\uddba\uddbc-\uddcc\uddd0\uddde-\uddff\ude70-\ude74\ude78-\ude7c\ude80-\ude86\ude90-\udeac\udeb0-\udeba\udec0-\udec2\uded0-\uded9\udee0-\udee7]|[\u23e9-\u23ec\u23f0\u23f3\u267e\u26ce\u2705\u2728\u274c\u274e\u2753-\u2755\u2795-\u2797\u27b0\u27bf\ue50a])|\ufe0f/g,e=/\uFE0F/g,c=String.fromCharCode(8205),t=/[&<>'"]/g,o=/^(?:iframe|noframes|noscript|script|select|style|textarea)$/,r=String.fromCharCode;return d;function n(d,u){return document.createTextNode(u?d.replace(e,""):d)}function a(d,u){return"".concat(u.base,u.size,"/",d,u.ext)}function i(d,u){for(var f,e,c=d.childNodes,t=c.length;t--;)3===(e=(f=c[t]).nodeType)?u.push(f):1!==e||"ownerSVGElement"in f||o.test(f.nodeName.toLowerCase())||i(f,u);return u}function s(d){return g(d.indexOf(c)<0?d.replace(e,""):d)}function b(d,u){for(var e,c,t,o,r,a,b,l,m,p,h,g,v,w=i(d,[]),y=w.length;y--;){for(t=!1,o=document.createDocumentFragment(),a=(r=w[y]).nodeValue,l=0;b=f.exec(a);){if((m=b.index)!==l&&o.appendChild(n(a.slice(l,m),!0)),g=s(h=b[0]),l=m+h.length,v=u.callback(g,u),g&&v){for(c in(p=new Image).onerror=u.onerror,p.setAttribute("draggable","false"),e=u.attributes(h,g))e.hasOwnProperty(c)&&0!==c.indexOf("on")&&!p.hasAttribute(c)&&p.setAttribute(c,e[c]);p.className=u.className,p.alt=h,p.src=v,t=!0,o.appendChild(p)}p||o.appendChild(n(h,!1)),p=null}t&&(l")}return c}))}function m(d){return u[d]}function p(){return null}function h(d,u){return String(d).replace(f,u)}function g(d,u){for(var f=[],e=0,c=0,t=0;t({loading:"lazy"})}}u().initializers.add("flarum-emoji",(()=>{!function(){let d=null;(0,f.extend)("flarum/common/components/TextEditor","oninit",(function(){this._loaders.push((async()=>await c.e(101).then(c.bind(c,232)).then((u=>d=u.default)))),this.commonEmoji=["😀","😁","😂","😃","😄","😅","😆","😇","😈","😉","😊","😋","😌","😍","😎","😏","😐️","😑","😒","😓","😔","😕","😖","😗","😘","😙","😚","😛","😜","😝","😞","😟","😠","😡","😢","😣","😤","😥","😦","😧","😨","😩","😪","😫","😬","😭","😮","😮‍💨","😯","😰","😱","😲","😳","😴","😵","😵‍💫","😶","😶‍🌫️","😷","😸","😹","😺","😻","😼","😽","😾","😿","🙀","🙁","🙂","🙃","🙄"]})),(0,f.extend)("flarum/common/components/TextEditor","onbuild",(function(){this.emojiDropdown=new g;const d=this.$(".TextEditor-editor").wrap('
');this.navigator=new(r()),this.navigator.when((()=>this.emojiDropdown.active)).onUp((()=>this.emojiDropdown.navigate(-1))).onDown((()=>this.emojiDropdown.navigate(1))).onSelect(this.emojiDropdown.complete.bind(this.emojiDropdown)).onCancel(this.emojiDropdown.hide.bind(this.emojiDropdown)).bindTo(d),d.after($('
'))})),(0,f.extend)("flarum/common/components/TextEditor","buildEditorParams",(function(u){const f=Object.keys(d),e=k(),c=new(s())(":");u.inputListeners.push((()=>{const u=this.attrs.composer.editor.getSelectionRange(),t=u[0];if(u[1]-t>0)return;const o=this.attrs.composer.editor.getLastNChars(15),r=c.check(o,t,/[a-z0-9]|\+|\-|_|\:/);if(this.emojiDropdown.hide(),this.emojiDropdown.active=!1,r){const u=r.typed,c=this.emojiDropdown,t=d=>{this.attrs.composer.editor.replaceBeforeCursor(r.absoluteStart-1,d+" "),this.emojiDropdown.hide()},o=function(d){let{emoji:u,name:f,code:o}=d;return m(a(),{text:f},m("button",{key:u,onclick:()=>t(u),onmouseenter:function(){c.setIndex($(this).parent().index()-1)}},m("img",{alt:u,className:"emoji",draggable:"false",loading:"lazy",src:`${e}72x72/${o}.png`,title:f})))};(()=>{const e=[],c=function(d){const u=new RegExp("\\((["+"+.*?[]{}()^$|\\".replace(/(.)/g,"\\$1")+"])\\)","g");return new RegExp("(.*)"+d.toLowerCase().replace(/(.)/g,"($1)(.*?)").replace(u,"(\\$1)")+"$","i")}(u);let t=40;const n=u=>{for(let c=0;c0;c++){const o=f[c];if(-1===e.indexOf(o)){const f=d[o];for(let d of f)if(u(d,o)){--t,e.push(o);break}}}};n(((d,f)=>u?0===d.indexOf(u):this.commonEmoji?.includes(f))),n((d=>c.test(d)));const a=e.map((u=>({emoji:u,name:d[u][0],code:x(u)}))).map(o);if(a.length){this.emojiDropdown.items=a,m.render(this.$(".ComposerBody-emojiDropdownContainer")[0],this.emojiDropdown.render()),this.emojiDropdown.show();const d=this.attrs.composer.editor.getCaretCoordinates(r.absoluteStart),u=this.emojiDropdown.$().outerWidth(),f=this.emojiDropdown.$().outerHeight(),e=this.emojiDropdown.$().offsetParent();let c=d.left,t=d.top+15;t+f>e.height()&&(t=d.top-f-15),c+u>e.width()&&(c=e.width()-u),t=Math.max(-(e.offset().top-$(document).scrollTop()),t),c=Math.max(-e.offset().left,c),this.emojiDropdown.show(c,t)}})(),this.emojiDropdown.setIndex(0),this.emojiDropdown.$().scrollTop(0),this.emojiDropdown.active=!0}}))})),(0,f.extend)("flarum/common/components/TextEditor","toolbarItems",(function(d){d.add("emoji",m(t(),{onclick:()=>this.attrs.composer.editor.insertAtCursor(" :"),icon:"far fa-smile"},app.translator.trans("flarum-emoji.forum.composer.emoji_tooltip")))}))}(),(0,f.override)(T().prototype,"contentHtml",(function(d){const u=d();if(this.oldContentHtml!==u){const d=w.parse(function(d){const u=document.implementation.createHTMLDocument();return u.body.innerHTML=d,u.body}(u),S());this.emojifiedContentHtml=d.innerHTML,this.oldContentHtml=u}return this.emojifiedContentHtml})),(0,f.override)(s9e.TextFormatter,"preview",((d,u,f)=>{d(u,f),w.parse(f,S())}))}))})(),module.exports={}})(); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/extensions/emoji/js/dist/forum.js.map b/extensions/emoji/js/dist/forum.js.map index 994a80c657..f6c4326361 100644 --- a/extensions/emoji/js/dist/forum.js.map +++ b/extensions/emoji/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"file":"forum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BAAgB,SAAUtI,GACrDA,EAAMkM,IACJ,QACAxM,EAACyM,IAAgB,CAAC3B,QAASA,IAAMzK,KAAKI,MAAMsJ,SAASC,OAAO0C,eAAe,MAAOnH,KAAK,gBACpFrF,IAAIC,WAAWC,MAAM,8CAG5B,GACF,CDxKEuM,IDoBAC,EAAAA,EAAAA,UAASC,IAAAA,UAAgB,eAAe,SAAUC,GAChD,MAAMC,EAAcD,IAEpB,GAAIzM,KAAK2M,iBAAmBD,EAAa,CAWvC,MAAME,EAAejK,EAAAA,MAtB3B,SAAmBuE,GACjB,MAAM2F,EAAM7H,SAAS8H,eAAeC,qBAGpC,OAFAF,EAAIG,KAAKC,UAAY/F,EAEd2F,EAAIG,IACb,CAiByCE,CAAUR,GAAcvH,GAG3DnF,KAAKmN,qBAAuBP,EAAaK,UAEzCjN,KAAK2M,eAAiBD,CACxB,CAEA,OAAO1M,KAAKmN,oBACd,KAEAZ,EAAAA,EAAAA,UAASa,IAAIC,cAAe,WAAW,CAACZ,EAAUnI,EAAMgJ,KACtDb,EAASnI,EAAMgJ,GAEf3K,EAAAA,MAAc2K,EAASnI,EAAQ,GC7CpB","sources":["webpack://@flarum/emoji/webpack/bootstrap","webpack://@flarum/emoji/webpack/runtime/compat get default export","webpack://@flarum/emoji/webpack/runtime/define property getters","webpack://@flarum/emoji/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/emoji/webpack/runtime/make namespace object","webpack://@flarum/emoji/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/emoji/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/emoji/external root \"flarum.core.compat['common/components/TextEditor']\"","webpack://@flarum/emoji/external root \"flarum.core.compat['common/components/TextEditorButton']\"","webpack://@flarum/emoji/external root \"flarum.core.compat['common/utils/KeyboardNavigatable']\"","webpack://@flarum/emoji/../../../js-packages/webpack-config/node_modules/@babel/runtime/helpers/esm/typeof.js","webpack://@flarum/emoji/../../../js-packages/webpack-config/node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack://@flarum/emoji/../../../js-packages/webpack-config/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","webpack://@flarum/emoji/../../../js-packages/webpack-config/node_modules/@babel/runtime/helpers/esm/toPrimitive.js","webpack://@flarum/emoji/external root \"flarum.core.compat['common/Fragment']\"","webpack://@flarum/emoji/./src/forum/fragments/AutocompleteDropdown.js","webpack://@flarum/emoji/../../../node_modules/twemoji/dist/twemoji.esm.js","webpack://@flarum/emoji/./src/forum/helpers/getEmojiIconCode.js","webpack://@flarum/emoji/./src/forum/cdn.js","webpack://@flarum/emoji/external root \"flarum.core.compat['common/models/Post']\"","webpack://@flarum/emoji/./src/forum/renderEmoji.js","webpack://@flarum/emoji/./src/forum/index.js","webpack://@flarum/emoji/./src/forum/addComposerAutocomplete.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/TextEditor'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/TextEditorButton'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/KeyboardNavigatable'];","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}","import toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}","import _typeof from \"./typeof.js\";\nexport default function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Fragment'];","import Fragment from 'flarum/common/Fragment';\n\nexport default class AutocompleteDropdown extends Fragment {\n items = [];\n active = false;\n index = 0;\n keyWasJustPressed = false;\n\n view() {\n return (\n
    \n
  • {app.translator.trans('flarum-emoji.forum.composer.type_to_search_text')}
  • \n {this.items.map((item) => (\n
  • {item}
  • \n ))}\n
\n );\n }\n\n show(left, top) {\n this.$()\n .show()\n .css({\n left: left + 'px',\n top: top + 'px',\n });\n this.active = true;\n }\n\n hide() {\n this.$().hide();\n this.active = false;\n }\n\n navigate(delta) {\n this.keyWasJustPressed = true;\n this.setIndex(this.index + delta, true);\n clearTimeout(this.keyWasJustPressedTimeout);\n this.keyWasJustPressedTimeout = setTimeout(() => (this.keyWasJustPressed = false), 500);\n }\n\n complete() {\n this.$('li:not(.Dropdown-header)').eq(this.index).find('button').click();\n }\n\n setIndex(index, scrollToItem) {\n if (this.keyWasJustPressed && !scrollToItem) return;\n\n const $dropdown = this.$();\n const $items = $dropdown.find('li:not(.Dropdown-header)');\n let rangedIndex = index;\n\n if (rangedIndex < 0) {\n rangedIndex = $items.length - 1;\n } else if (rangedIndex >= $items.length) {\n rangedIndex = 0;\n }\n\n this.index = rangedIndex;\n\n const $item = $items.removeClass('active').eq(rangedIndex).addClass('active');\n\n if (scrollToItem) {\n const dropdownScroll = $dropdown.scrollTop();\n const dropdownTop = $dropdown.offset().top;\n const dropdownBottom = dropdownTop + $dropdown.outerHeight();\n const itemTop = $item.offset().top;\n const itemBottom = itemTop + $item.outerHeight();\n\n let scrollTop;\n if (itemTop < dropdownTop) {\n scrollTop = dropdownScroll - dropdownTop + itemTop - parseInt($dropdown.css('padding-top'), 10);\n } else if (itemBottom > dropdownBottom) {\n scrollTop = dropdownScroll - dropdownBottom + itemBottom + parseInt($dropdown.css('padding-bottom'), 10);\n }\n\n if (typeof scrollTop !== 'undefined') {\n $dropdown.stop(true).animate({ scrollTop }, 100);\n }\n }\n }\n}\n","/*! Copyright Twitter Inc. and other contributors. Licensed under MIT */\nvar twemoji=function(){\"use strict\";var twemoji={base:\"https://twemoji.maxcdn.com/v/14.0.2/\",ext:\".png\",size:\"72x72\",className:\"emoji\",convert:{fromCodePoint:fromCodePoint,toCodePoint:toCodePoint},onerror:function onerror(){if(this.parentNode){this.parentNode.replaceChild(createText(this.alt,false),this)}},parse:parse,replace:replace,test:test},escaper={\"&\":\"&\",\"<\":\"<\",\">\":\">\",\"'\":\"'\",'\"':\""\"},re=/(?:\\ud83d\\udc68\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83e\\uddd1\\ud83c[\\udffc-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83e\\uddd1\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83e\\uddd1\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83e\\uddd1\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83e\\uddd1\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udffe]|\\ud83d\\udc68\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffb\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffc-\\udfff]|\\ud83d\\udc68\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffc\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83d\\udc68\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffd\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83d\\udc68\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffe\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83d\\udc68\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udfff\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udffe]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffc-\\udfff]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffc-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udffe]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udffe]|\\ud83e\\uddd1\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83e\\uddd1\\ud83c[\\udffc-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffb\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83e\\uddd1\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffc\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83e\\uddd1\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83e\\uddd1\\ud83c\\udffd\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83e\\uddd1\\ud83c\\udffe\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udffe]|\\ud83e\\uddd1\\ud83c\\udfff\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68|\\ud83d\\udc69\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d[\\udc68\\udc69]|\\ud83e\\udef1\\ud83c\\udffb\\u200d\\ud83e\\udef2\\ud83c[\\udffc-\\udfff]|\\ud83e\\udef1\\ud83c\\udffc\\u200d\\ud83e\\udef2\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83e\\udef1\\ud83c\\udffd\\u200d\\ud83e\\udef2\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83e\\udef1\\ud83c\\udffe\\u200d\\ud83e\\udef2\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83e\\udef1\\ud83c\\udfff\\u200d\\ud83e\\udef2\\ud83c[\\udffb-\\udffe]|\\ud83d\\udc68\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68|\\ud83d\\udc69\\u200d\\u2764\\ufe0f\\u200d\\ud83d[\\udc68\\udc69]|\\ud83e\\uddd1\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1|\\ud83d\\udc6b\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc6c\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc6d\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc8f\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc91\\ud83c[\\udffb-\\udfff]|\\ud83e\\udd1d\\ud83c[\\udffb-\\udfff]|\\ud83d[\\udc6b-\\udc6d\\udc8f\\udc91]|\\ud83e\\udd1d)|(?:\\ud83d[\\udc68\\udc69]|\\ud83e\\uddd1)(?:\\ud83c[\\udffb-\\udfff])?\\u200d(?:\\u2695\\ufe0f|\\u2696\\ufe0f|\\u2708\\ufe0f|\\ud83c[\\udf3e\\udf73\\udf7c\\udf84\\udf93\\udfa4\\udfa8\\udfeb\\udfed]|\\ud83d[\\udcbb\\udcbc\\udd27\\udd2c\\ude80\\ude92]|\\ud83e[\\uddaf-\\uddb3\\uddbc\\uddbd])|(?:\\ud83c[\\udfcb\\udfcc]|\\ud83d[\\udd74\\udd75]|\\u26f9)((?:\\ud83c[\\udffb-\\udfff]|\\ufe0f)\\u200d[\\u2640\\u2642]\\ufe0f)|(?:\\ud83c[\\udfc3\\udfc4\\udfca]|\\ud83d[\\udc6e\\udc70\\udc71\\udc73\\udc77\\udc81\\udc82\\udc86\\udc87\\ude45-\\ude47\\ude4b\\ude4d\\ude4e\\udea3\\udeb4-\\udeb6]|\\ud83e[\\udd26\\udd35\\udd37-\\udd39\\udd3d\\udd3e\\uddb8\\uddb9\\uddcd-\\uddcf\\uddd4\\uddd6-\\udddd])(?:\\ud83c[\\udffb-\\udfff])?\\u200d[\\u2640\\u2642]\\ufe0f|(?:\\ud83d\\udc68\\u200d\\ud83d\\udc68\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc68\\u200d\\ud83d\\udc68\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc68\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc69\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc68\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc68\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc69\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc69\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\ud83d\\udc69\\u200d\\ud83d[\\udc66\\udc67]|\\ud83c\\udff3\\ufe0f\\u200d\\u26a7\\ufe0f|\\ud83c\\udff3\\ufe0f\\u200d\\ud83c\\udf08|\\ud83d\\ude36\\u200d\\ud83c\\udf2b\\ufe0f|\\u2764\\ufe0f\\u200d\\ud83d\\udd25|\\u2764\\ufe0f\\u200d\\ud83e\\ude79|\\ud83c\\udff4\\u200d\\u2620\\ufe0f|\\ud83d\\udc15\\u200d\\ud83e\\uddba|\\ud83d\\udc3b\\u200d\\u2744\\ufe0f|\\ud83d\\udc41\\u200d\\ud83d\\udde8|\\ud83d\\udc68\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc6f\\u200d\\u2640\\ufe0f|\\ud83d\\udc6f\\u200d\\u2642\\ufe0f|\\ud83d\\ude2e\\u200d\\ud83d\\udca8|\\ud83d\\ude35\\u200d\\ud83d\\udcab|\\ud83e\\udd3c\\u200d\\u2640\\ufe0f|\\ud83e\\udd3c\\u200d\\u2642\\ufe0f|\\ud83e\\uddde\\u200d\\u2640\\ufe0f|\\ud83e\\uddde\\u200d\\u2642\\ufe0f|\\ud83e\\udddf\\u200d\\u2640\\ufe0f|\\ud83e\\udddf\\u200d\\u2642\\ufe0f|\\ud83d\\udc08\\u200d\\u2b1b)|[#*0-9]\\ufe0f?\\u20e3|(?:[©®\\u2122\\u265f]\\ufe0f)|(?:\\ud83c[\\udc04\\udd70\\udd71\\udd7e\\udd7f\\ude02\\ude1a\\ude2f\\ude37\\udf21\\udf24-\\udf2c\\udf36\\udf7d\\udf96\\udf97\\udf99-\\udf9b\\udf9e\\udf9f\\udfcd\\udfce\\udfd4-\\udfdf\\udff3\\udff5\\udff7]|\\ud83d[\\udc3f\\udc41\\udcfd\\udd49\\udd4a\\udd6f\\udd70\\udd73\\udd76-\\udd79\\udd87\\udd8a-\\udd8d\\udda5\\udda8\\uddb1\\uddb2\\uddbc\\uddc2-\\uddc4\\uddd1-\\uddd3\\udddc-\\uddde\\udde1\\udde3\\udde8\\uddef\\uddf3\\uddfa\\udecb\\udecd-\\udecf\\udee0-\\udee5\\udee9\\udef0\\udef3]|[\\u203c\\u2049\\u2139\\u2194-\\u2199\\u21a9\\u21aa\\u231a\\u231b\\u2328\\u23cf\\u23ed-\\u23ef\\u23f1\\u23f2\\u23f8-\\u23fa\\u24c2\\u25aa\\u25ab\\u25b6\\u25c0\\u25fb-\\u25fe\\u2600-\\u2604\\u260e\\u2611\\u2614\\u2615\\u2618\\u2620\\u2622\\u2623\\u2626\\u262a\\u262e\\u262f\\u2638-\\u263a\\u2640\\u2642\\u2648-\\u2653\\u2660\\u2663\\u2665\\u2666\\u2668\\u267b\\u267f\\u2692-\\u2697\\u2699\\u269b\\u269c\\u26a0\\u26a1\\u26a7\\u26aa\\u26ab\\u26b0\\u26b1\\u26bd\\u26be\\u26c4\\u26c5\\u26c8\\u26cf\\u26d1\\u26d3\\u26d4\\u26e9\\u26ea\\u26f0-\\u26f5\\u26f8\\u26fa\\u26fd\\u2702\\u2708\\u2709\\u270f\\u2712\\u2714\\u2716\\u271d\\u2721\\u2733\\u2734\\u2744\\u2747\\u2757\\u2763\\u2764\\u27a1\\u2934\\u2935\\u2b05-\\u2b07\\u2b1b\\u2b1c\\u2b50\\u2b55\\u3030\\u303d\\u3297\\u3299])(?:\\ufe0f|(?!\\ufe0e))|(?:(?:\\ud83c[\\udfcb\\udfcc]|\\ud83d[\\udd74\\udd75\\udd90]|[\\u261d\\u26f7\\u26f9\\u270c\\u270d])(?:\\ufe0f|(?!\\ufe0e))|(?:\\ud83c[\\udf85\\udfc2-\\udfc4\\udfc7\\udfca]|\\ud83d[\\udc42\\udc43\\udc46-\\udc50\\udc66-\\udc69\\udc6e\\udc70-\\udc78\\udc7c\\udc81-\\udc83\\udc85-\\udc87\\udcaa\\udd7a\\udd95\\udd96\\ude45-\\ude47\\ude4b-\\ude4f\\udea3\\udeb4-\\udeb6\\udec0\\udecc]|\\ud83e[\\udd0c\\udd0f\\udd18-\\udd1c\\udd1e\\udd1f\\udd26\\udd30-\\udd39\\udd3d\\udd3e\\udd77\\uddb5\\uddb6\\uddb8\\uddb9\\uddbb\\uddcd-\\uddcf\\uddd1-\\udddd\\udec3-\\udec5\\udef0-\\udef6]|[\\u270a\\u270b]))(?:\\ud83c[\\udffb-\\udfff])?|(?:\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc65\\udb40\\udc6e\\udb40\\udc67\\udb40\\udc7f|\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc73\\udb40\\udc63\\udb40\\udc74\\udb40\\udc7f|\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc77\\udb40\\udc6c\\udb40\\udc73\\udb40\\udc7f|\\ud83c\\udde6\\ud83c[\\udde8-\\uddec\\uddee\\uddf1\\uddf2\\uddf4\\uddf6-\\uddfa\\uddfc\\uddfd\\uddff]|\\ud83c\\udde7\\ud83c[\\udde6\\udde7\\udde9-\\uddef\\uddf1-\\uddf4\\uddf6-\\uddf9\\uddfb\\uddfc\\uddfe\\uddff]|\\ud83c\\udde8\\ud83c[\\udde6\\udde8\\udde9\\uddeb-\\uddee\\uddf0-\\uddf5\\uddf7\\uddfa-\\uddff]|\\ud83c\\udde9\\ud83c[\\uddea\\uddec\\uddef\\uddf0\\uddf2\\uddf4\\uddff]|\\ud83c\\uddea\\ud83c[\\udde6\\udde8\\uddea\\uddec\\udded\\uddf7-\\uddfa]|\\ud83c\\uddeb\\ud83c[\\uddee-\\uddf0\\uddf2\\uddf4\\uddf7]|\\ud83c\\uddec\\ud83c[\\udde6\\udde7\\udde9-\\uddee\\uddf1-\\uddf3\\uddf5-\\uddfa\\uddfc\\uddfe]|\\ud83c\\udded\\ud83c[\\uddf0\\uddf2\\uddf3\\uddf7\\uddf9\\uddfa]|\\ud83c\\uddee\\ud83c[\\udde8-\\uddea\\uddf1-\\uddf4\\uddf6-\\uddf9]|\\ud83c\\uddef\\ud83c[\\uddea\\uddf2\\uddf4\\uddf5]|\\ud83c\\uddf0\\ud83c[\\uddea\\uddec-\\uddee\\uddf2\\uddf3\\uddf5\\uddf7\\uddfc\\uddfe\\uddff]|\\ud83c\\uddf1\\ud83c[\\udde6-\\udde8\\uddee\\uddf0\\uddf7-\\uddfb\\uddfe]|\\ud83c\\uddf2\\ud83c[\\udde6\\udde8-\\udded\\uddf0-\\uddff]|\\ud83c\\uddf3\\ud83c[\\udde6\\udde8\\uddea-\\uddec\\uddee\\uddf1\\uddf4\\uddf5\\uddf7\\uddfa\\uddff]|\\ud83c\\uddf4\\ud83c\\uddf2|\\ud83c\\uddf5\\ud83c[\\udde6\\uddea-\\udded\\uddf0-\\uddf3\\uddf7-\\uddf9\\uddfc\\uddfe]|\\ud83c\\uddf6\\ud83c\\udde6|\\ud83c\\uddf7\\ud83c[\\uddea\\uddf4\\uddf8\\uddfa\\uddfc]|\\ud83c\\uddf8\\ud83c[\\udde6-\\uddea\\uddec-\\uddf4\\uddf7-\\uddf9\\uddfb\\uddfd-\\uddff]|\\ud83c\\uddf9\\ud83c[\\udde6\\udde8\\udde9\\uddeb-\\udded\\uddef-\\uddf4\\uddf7\\uddf9\\uddfb\\uddfc\\uddff]|\\ud83c\\uddfa\\ud83c[\\udde6\\uddec\\uddf2\\uddf3\\uddf8\\uddfe\\uddff]|\\ud83c\\uddfb\\ud83c[\\udde6\\udde8\\uddea\\uddec\\uddee\\uddf3\\uddfa]|\\ud83c\\uddfc\\ud83c[\\uddeb\\uddf8]|\\ud83c\\uddfd\\ud83c\\uddf0|\\ud83c\\uddfe\\ud83c[\\uddea\\uddf9]|\\ud83c\\uddff\\ud83c[\\udde6\\uddf2\\uddfc]|\\ud83c[\\udccf\\udd8e\\udd91-\\udd9a\\udde6-\\uddff\\ude01\\ude32-\\ude36\\ude38-\\ude3a\\ude50\\ude51\\udf00-\\udf20\\udf2d-\\udf35\\udf37-\\udf7c\\udf7e-\\udf84\\udf86-\\udf93\\udfa0-\\udfc1\\udfc5\\udfc6\\udfc8\\udfc9\\udfcf-\\udfd3\\udfe0-\\udff0\\udff4\\udff8-\\udfff]|\\ud83d[\\udc00-\\udc3e\\udc40\\udc44\\udc45\\udc51-\\udc65\\udc6a\\udc6f\\udc79-\\udc7b\\udc7d-\\udc80\\udc84\\udc88-\\udc8e\\udc90\\udc92-\\udca9\\udcab-\\udcfc\\udcff-\\udd3d\\udd4b-\\udd4e\\udd50-\\udd67\\udda4\\uddfb-\\ude44\\ude48-\\ude4a\\ude80-\\udea2\\udea4-\\udeb3\\udeb7-\\udebf\\udec1-\\udec5\\uded0-\\uded2\\uded5-\\uded7\\udedd-\\udedf\\udeeb\\udeec\\udef4-\\udefc\\udfe0-\\udfeb\\udff0]|\\ud83e[\\udd0d\\udd0e\\udd10-\\udd17\\udd20-\\udd25\\udd27-\\udd2f\\udd3a\\udd3c\\udd3f-\\udd45\\udd47-\\udd76\\udd78-\\uddb4\\uddb7\\uddba\\uddbc-\\uddcc\\uddd0\\uddde-\\uddff\\ude70-\\ude74\\ude78-\\ude7c\\ude80-\\ude86\\ude90-\\udeac\\udeb0-\\udeba\\udec0-\\udec2\\uded0-\\uded9\\udee0-\\udee7]|[\\u23e9-\\u23ec\\u23f0\\u23f3\\u267e\\u26ce\\u2705\\u2728\\u274c\\u274e\\u2753-\\u2755\\u2795-\\u2797\\u27b0\\u27bf\\ue50a])|\\ufe0f/g,UFE0Fg=/\\uFE0F/g,U200D=String.fromCharCode(8205),rescaper=/[&<>'\"]/g,shouldntBeParsed=/^(?:iframe|noframes|noscript|script|select|style|textarea)$/,fromCharCode=String.fromCharCode;return twemoji;function createText(text,clean){return document.createTextNode(clean?text.replace(UFE0Fg,\"\"):text)}function escapeHTML(s){return s.replace(rescaper,replacer)}function defaultImageSrcGenerator(icon,options){return\"\".concat(options.base,options.size,\"/\",icon,options.ext)}function grabAllTextNodes(node,allText){var childNodes=node.childNodes,length=childNodes.length,subnode,nodeType;while(length--){subnode=childNodes[length];nodeType=subnode.nodeType;if(nodeType===3){allText.push(subnode)}else if(nodeType===1&&!(\"ownerSVGElement\"in subnode)&&!shouldntBeParsed.test(subnode.nodeName.toLowerCase())){grabAllTextNodes(subnode,allText)}}return allText}function grabTheRightIcon(rawText){return toCodePoint(rawText.indexOf(U200D)<0?rawText.replace(UFE0Fg,\"\"):rawText)}function parseNode(node,options){var allText=grabAllTextNodes(node,[]),length=allText.length,attrib,attrname,modified,fragment,subnode,text,match,i,index,img,rawText,iconId,src;while(length--){modified=false;fragment=document.createDocumentFragment();subnode=allText[length];text=subnode.nodeValue;i=0;while(match=re.exec(text)){index=match.index;if(index!==i){fragment.appendChild(createText(text.slice(i,index),true))}rawText=match[0];iconId=grabTheRightIcon(rawText);i=index+rawText.length;src=options.callback(iconId,options);if(iconId&&src){img=new Image;img.onerror=options.onerror;img.setAttribute(\"draggable\",\"false\");attrib=options.attributes(rawText,iconId);for(attrname in attrib){if(attrib.hasOwnProperty(attrname)&&attrname.indexOf(\"on\")!==0&&!img.hasAttribute(attrname)){img.setAttribute(attrname,attrib[attrname])}}img.className=options.className;img.alt=rawText;img.src=src;modified=true;fragment.appendChild(img)}if(!img)fragment.appendChild(createText(rawText,false));img=null}if(modified){if(i\")}return ret})}function replacer(m){return escaper[m]}function returnNull(){return null}function toSizeSquaredAsset(value){return typeof value===\"number\"?value+\"x\"+value:value}function fromCodePoint(codepoint){var code=typeof codepoint===\"string\"?parseInt(codepoint,16):codepoint;if(code<65536){return fromCharCode(code)}code-=65536;return fromCharCode(55296+(code>>10),56320+(code&1023))}function parse(what,how){if(!how||typeof how===\"function\"){how={callback:how}}return(typeof what===\"string\"?parseString:parseNode)(what,{callback:how.callback||defaultImageSrcGenerator,attributes:typeof how.attributes===\"function\"?how.attributes:returnNull,base:typeof how.base===\"string\"?how.base:twemoji.base,ext:how.ext||twemoji.ext,size:how.folder||toSizeSquaredAsset(how.size||twemoji.size),className:how.className||twemoji.className,onerror:how.onerror||twemoji.onerror})}function replace(text,callback){return String(text).replace(re,callback)}function test(text){re.lastIndex=0;var result=re.test(text);re.lastIndex=0;return result}function toCodePoint(unicodeSurrogates,sep){var r=[],c=0,p=0,i=0;while(i ({\n loading: 'lazy',\n }),\n};\n\n/**\n * Parses an HTML string into a `` node containing the HTML content.\n *\n * Vanilla JS implementation of jQuery's `$.parseHTML()`,\n * sourced from http://youmightnotneedjquery.com/\n */\nfunction parseHTML(str) {\n const tmp = document.implementation.createHTMLDocument();\n tmp.body.innerHTML = str;\n\n return tmp.body;\n}\n\nexport default function renderEmoji() {\n override(Post.prototype, 'contentHtml', function (original) {\n const contentHtml = original();\n\n if (this.oldContentHtml !== contentHtml) {\n // We need to parse the HTML string into a DOM node, then give it to Twemoji.\n //\n // This prevents some issues with the default find-replace that would be performed\n // on a string passed to `Twemoji.parse()`.\n //\n // The parse function can only handle a single DOM node provided, so we need to\n // wrap it in a node. In our `parseHTML` implementation, we wrap it in a ``\n // element. This gets stripped below.\n //\n // See https://github.com/flarum/core/issues/2958\n const emojifiedDom = twemoji.parse(parseHTML(contentHtml), options);\n\n // Steal the HTML string inside the emojified DOM `` tag.\n this.emojifiedContentHtml = emojifiedDom.innerHTML;\n\n this.oldContentHtml = contentHtml;\n }\n\n return this.emojifiedContentHtml;\n });\n\n override(s9e.TextFormatter, 'preview', (original, text, element) => {\n original(text, element);\n\n twemoji.parse(element, options);\n });\n}\n","import app from 'flarum/forum/app';\n\nimport addComposerAutocomplete from './addComposerAutocomplete';\nimport renderEmoji from './renderEmoji';\n\napp.initializers.add('flarum-emoji', () => {\n // After typing ':' in the composer, show a dropdown suggesting a bunch of\n // emoji that the user could use.\n addComposerAutocomplete();\n\n // render emoji as image in Posts content and title.\n renderEmoji();\n});\n","import emojiMap from 'simple-emoji-map';\n\nimport { extend } from 'flarum/common/extend';\nimport TextEditor from 'flarum/common/components/TextEditor';\nimport TextEditorButton from 'flarum/common/components/TextEditorButton';\nimport KeyboardNavigatable from 'flarum/common/utils/KeyboardNavigatable';\n\nimport AutocompleteDropdown from './fragments/AutocompleteDropdown';\nimport getEmojiIconCode from './helpers/getEmojiIconCode';\nimport cdn from './cdn';\n\nexport default function addComposerAutocomplete() {\n const emojiKeys = Object.keys(emojiMap);\n const $container = $('
');\n const dropdown = new AutocompleteDropdown();\n\n extend(TextEditor.prototype, 'oncreate', function () {\n const $editor = this.$('.TextEditor-editor').wrap('
');\n\n this.navigator = new KeyboardNavigatable();\n this.navigator\n .when(() => dropdown.active)\n .onUp(() => dropdown.navigate(-1))\n .onDown(() => dropdown.navigate(1))\n .onSelect(dropdown.complete.bind(dropdown))\n .onCancel(dropdown.hide.bind(dropdown))\n .bindTo($editor);\n\n $editor.after($container);\n });\n\n extend(TextEditor.prototype, 'buildEditorParams', function (params) {\n let relEmojiStart;\n let absEmojiStart;\n let typed;\n\n const applySuggestion = (replacement) => {\n this.attrs.composer.editor.replaceBeforeCursor(absEmojiStart - 1, replacement + ' ');\n\n dropdown.hide();\n };\n\n params.inputListeners.push(() => {\n const selection = this.attrs.composer.editor.getSelectionRange();\n\n const cursor = selection[0];\n\n if (selection[1] - cursor > 0) return;\n\n // Search backwards from the cursor for an ':' symbol. If we find\n // one and followed by a whitespace, we will want to show the\n // autocomplete dropdown!\n const lastChunk = this.attrs.composer.editor.getLastNChars(15);\n absEmojiStart = 0;\n for (let i = lastChunk.length - 1; i >= 0; i--) {\n const character = lastChunk.substr(i, 1);\n // check what user typed, emoji names only contains alphanumeric,\n // underline, '+' and '-'\n if (!/[a-z0-9]|\\+|\\-|_|\\:/.test(character)) break;\n // make sure ':' preceded by a whitespace or newline\n if (character === ':' && (i == 0 || /\\s/.test(lastChunk.substr(i - 1, 1)))) {\n relEmojiStart = i + 1;\n absEmojiStart = cursor - lastChunk.length + i + 1;\n break;\n }\n }\n\n dropdown.hide();\n dropdown.active = false;\n\n if (absEmojiStart) {\n typed = lastChunk.substring(relEmojiStart).toLowerCase();\n\n const makeSuggestion = function ({ emoji, name, code }) {\n return (\n applySuggestion(emoji)}\n onmouseenter={function () {\n dropdown.setIndex($(this).parent().index() - 1);\n }}\n >\n {emoji}\n {name}\n \n );\n };\n\n const buildSuggestions = () => {\n const similarEmoji = [];\n\n // Build a regular expression to do a fuzzy match of the given input string\n const fuzzyRegexp = function (str) {\n const reEscape = new RegExp('\\\\(([' + '+.*?[]{}()^$|\\\\'.replace(/(.)/g, '\\\\$1') + '])\\\\)', 'g');\n return new RegExp('(.*)' + str.toLowerCase().replace(/(.)/g, '($1)(.*?)').replace(reEscape, '(\\\\$1)') + '$', 'i');\n };\n const regTyped = fuzzyRegexp(typed);\n\n let maxSuggestions = 7;\n\n const findMatchingEmojis = (matcher) => {\n for (let i = 0; i < emojiKeys.length && maxSuggestions > 0; i++) {\n const curEmoji = emojiKeys[i];\n\n if (similarEmoji.indexOf(curEmoji) === -1) {\n const names = emojiMap[curEmoji];\n for (let name of names) {\n if (matcher(name)) {\n --maxSuggestions;\n similarEmoji.push(curEmoji);\n break;\n }\n }\n }\n }\n };\n\n // First, try to find all emojis starting with the given string\n findMatchingEmojis((emoji) => emoji.indexOf(typed) === 0);\n\n // If there are still suggestions left, try for some fuzzy matches\n findMatchingEmojis((emoji) => regTyped.test(emoji));\n\n const suggestions = similarEmoji\n .map((emoji) => ({\n emoji,\n name: emojiMap[emoji][0],\n code: getEmojiIconCode(emoji),\n }))\n .map(makeSuggestion);\n\n if (suggestions.length) {\n dropdown.items = suggestions;\n m.render($container[0], dropdown.render());\n\n dropdown.show();\n const coordinates = this.attrs.composer.editor.getCaretCoordinates(absEmojiStart);\n const width = dropdown.$().outerWidth();\n const height = dropdown.$().outerHeight();\n const parent = dropdown.$().offsetParent();\n let left = coordinates.left;\n let top = coordinates.top + 15;\n\n // Keep the dropdown inside the editor.\n if (top + height > parent.height()) {\n top = coordinates.top - height - 15;\n }\n if (left + width > parent.width()) {\n left = parent.width() - width;\n }\n\n // Prevent the dropdown from going off screen on mobile\n top = Math.max(-(parent.offset().top - $(document).scrollTop()), top);\n left = Math.max(-parent.offset().left, left);\n\n dropdown.show(left, top);\n }\n };\n\n buildSuggestions();\n\n dropdown.setIndex(0);\n dropdown.$().scrollTop(0);\n dropdown.active = true;\n }\n });\n });\n\n extend(TextEditor.prototype, 'toolbarItems', function (items) {\n items.add(\n 'emoji',\n this.attrs.composer.editor.insertAtCursor(' :')} icon=\"far fa-smile\">\n {app.translator.trans('flarum-emoji.forum.composer.emoji_tooltip')}\n \n );\n });\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","_typeof","iterator","constructor","_defineProperty","arg","input","hint","prim","toPrimitive","undefined","res","TypeError","String","toPropertyKey","configurable","writable","AutocompleteDropdown","Fragment","arguments","view","m","className","app","translator","trans","this","items","map","item","attrs","show","left","top","$","css","active","hide","navigate","delta","keyWasJustPressed","setIndex","index","clearTimeout","keyWasJustPressedTimeout","setTimeout","complete","eq","find","click","scrollToItem","$dropdown","$items","rangedIndex","length","$item","removeClass","addClass","dropdownScroll","scrollTop","dropdownTop","offset","dropdownBottom","outerHeight","itemTop","itemBottom","parseInt","stop","animate","twemoji","base","ext","size","convert","fromCodePoint","codepoint","code","fromCharCode","toCodePoint","onerror","parentNode","replaceChild","createText","alt","parse","what","how","callback","parseString","parseNode","defaultImageSrcGenerator","attributes","returnNull","folder","replace","test","text","re","lastIndex","result","escaper","UFE0Fg","U200D","rescaper","shouldntBeParsed","clean","document","createTextNode","icon","options","concat","grabAllTextNodes","node","allText","subnode","nodeType","childNodes","push","nodeName","toLowerCase","grabTheRightIcon","rawText","indexOf","attrib","attrname","modified","fragment","match","i","img","iconId","src","createDocumentFragment","nodeValue","exec","appendChild","slice","Image","setAttribute","hasAttribute","str","ret","replacer","unicodeSurrogates","sep","r","c","p","charCodeAt","toString","join","getEmojiIconCode","emoji","version","loading","emojiKeys","keys","emojiMap","$container","dropdown","extend","TextEditor","$editor","wrap","navigator","KeyboardNavigatable","when","onUp","onDown","onSelect","bind","onCancel","bindTo","after","params","relEmojiStart","absEmojiStart","typed","applySuggestion","replacement","composer","editor","replaceBeforeCursor","inputListeners","selection","getSelectionRange","cursor","lastChunk","getLastNChars","character","substr","substring","makeSuggestion","_ref","name","onclick","onmouseenter","parent","draggable","cdn","buildSuggestions","similarEmoji","regTyped","reEscape","RegExp","fuzzyRegexp","maxSuggestions","findMatchingEmojis","matcher","curEmoji","names","suggestions","render","coordinates","getCaretCoordinates","width","outerWidth","height","offsetParent","Math","max","add","TextEditorButton","insertAtCursor","addComposerAutocomplete","override","Post","original","contentHtml","oldContentHtml","emojifiedDom","tmp","implementation","createHTMLDocument","body","innerHTML","parseHTML","emojifiedContentHtml","s9e","TextFormatter","element"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":";UAAIA,EACAC,OCAAC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaE,QAGrB,IAAIC,EAASN,EAAyBE,GAAY,CAGjDG,QAAS,CAAC,GAOX,OAHAE,EAAoBL,GAAUI,EAAQA,EAAOD,QAASJ,GAG/CK,EAAOD,OACf,CAGAJ,EAAoBO,EAAID,ECxBxBN,EAAoBQ,EAAKH,IACxB,IAAII,EAASJ,GAAUA,EAAOK,WAC7B,IAAOL,EAAiB,QACxB,IAAM,EAEP,OADAL,EAAoBW,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdT,EAAoBW,EAAI,CAACP,EAASS,KACjC,IAAI,IAAIC,KAAOD,EACXb,EAAoBe,EAAEF,EAAYC,KAASd,EAAoBe,EAAEX,EAASU,IAC5EE,OAAOC,eAAeb,EAASU,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDd,EAAoBoB,EAAI,CAAC,EAGzBpB,EAAoBqB,EAAKC,GACjBC,QAAQC,IAAIR,OAAOS,KAAKzB,EAAoBoB,GAAGM,QAAO,CAACC,EAAUb,KACvEd,EAAoBoB,EAAEN,GAAKQ,EAASK,GAC7BA,IACL,KCNJ3B,EAAoB4B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GAAclH,KAG3DnL,KAAK8S,qBAAuBP,EAAaK,UACzC5S,KAAKsS,eAAiBD,CACxB,CACA,OAAOrS,KAAK8S,oBACd,KACA,IAAAX,UAASY,IAAIC,cAAe,WAAW,CAACZ,EAAU7H,EAAM0I,KACtDb,EAAS7H,EAAM0I,GACf,EAAQpJ,MAAMoJ,EAAS9H,IAAU,GCvCtB","sources":["webpack://@flarum/emoji/webpack/runtime/load script","webpack://@flarum/emoji/webpack/bootstrap","webpack://@flarum/emoji/webpack/runtime/compat get default export","webpack://@flarum/emoji/webpack/runtime/define property getters","webpack://@flarum/emoji/webpack/runtime/ensure chunk","webpack://@flarum/emoji/webpack/runtime/get javascript chunk filename","webpack://@flarum/emoji/webpack/runtime/global","webpack://@flarum/emoji/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/emoji/webpack/runtime/make namespace object","webpack://@flarum/emoji/webpack/runtime/publicPath","webpack://@flarum/emoji/webpack/runtime/compat","webpack://@flarum/emoji/webpack/runtime/jsonp chunk loading","webpack://@flarum/emoji/external root \"flarum.reg.get('core', 'forum/app')\"","webpack://@flarum/emoji/external root \"flarum.reg.get('core', 'common/extend')\"","webpack://@flarum/emoji/external root \"flarum.reg.get('core', 'common/components/TextEditorButton')\"","webpack://@flarum/emoji/external root \"flarum.reg.get('core', 'common/utils/KeyboardNavigatable')\"","webpack://@flarum/emoji/external root \"flarum.reg.get('core', 'common/components/Tooltip')\"","webpack://@flarum/emoji/external root \"flarum.reg.get('core', 'common/utils/AutocompleteReader')\"","webpack://@flarum/emoji/../../../node_modules/@babel/runtime/helpers/esm/typeof.js","webpack://@flarum/emoji/../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack://@flarum/emoji/../../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","webpack://@flarum/emoji/../../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js","webpack://@flarum/emoji/external root \"flarum.reg.get('core', 'common/Fragment')\"","webpack://@flarum/emoji/./src/forum/fragments/AutocompleteDropdown.js","webpack://@flarum/emoji/../../../node_modules/twemoji/dist/twemoji.esm.js","webpack://@flarum/emoji/./src/forum/helpers/getEmojiIconCode.js","webpack://@flarum/emoji/./src/common/cdn.js","webpack://@flarum/emoji/./src/forum/addComposerAutocomplete.js","webpack://@flarum/emoji/external root \"flarum.reg.get('core', 'common/models/Post')\"","webpack://@flarum/emoji/./src/forum/renderEmoji.js","webpack://@flarum/emoji/./src/forum/index.js"],"sourcesContent":["var inProgress = {};\nvar dataWebpackPrefix = \"module.exports:\";\n// loadScript function to load a script via script tag\n__webpack_require__.l = (url, done, key, chunkId) => {\n\tif(inProgress[url]) { inProgress[url].push(done); return; }\n\tvar script, needAttach;\n\tif(key !== undefined) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tfor(var i = 0; i < scripts.length; i++) {\n\t\t\tvar s = scripts[i];\n\t\t\tif(s.getAttribute(\"src\") == url || s.getAttribute(\"data-webpack\") == dataWebpackPrefix + key) { script = s; break; }\n\t\t}\n\t}\n\tif(!script) {\n\t\tneedAttach = true;\n\t\tscript = document.createElement('script');\n\n\t\tscript.charset = 'utf-8';\n\t\tscript.timeout = 120;\n\t\tif (__webpack_require__.nc) {\n\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n\t\t}\n\t\tscript.setAttribute(\"data-webpack\", dataWebpackPrefix + key);\n\n\t\tscript.src = url;\n\t}\n\tinProgress[url] = [done];\n\tvar onScriptComplete = (prev, event) => {\n\t\t// avoid mem leaks in IE.\n\t\tscript.onerror = script.onload = null;\n\t\tclearTimeout(timeout);\n\t\tvar doneFns = inProgress[url];\n\t\tdelete inProgress[url];\n\t\tscript.parentNode && script.parentNode.removeChild(script);\n\t\tdoneFns && doneFns.forEach((fn) => (fn(event)));\n\t\tif(prev) return prev(event);\n\t}\n\tvar timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);\n\tscript.onerror = onScriptComplete.bind(null, script.onerror);\n\tscript.onload = onScriptComplete.bind(null, script.onload);\n\tneedAttach && document.head.appendChild(script);\n};","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + \"forum/emojiMap\" + \".js\";\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')\n\t\tscriptUrl = document.currentScript.src;\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) {\n\t\t\tvar i = scripts.length - 1;\n\t\t\twhile (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;\n\t\t}\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","__webpack_require__.f.compat = (chunkId, promises) => {\n\n\tconst originalLoadChunk = __webpack_require__.l;\n\t__webpack_require__.l = flarum.reg.loadChunk.bind(flarum.reg, originalLoadChunk);\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t170: 0\n};\n\n__webpack_require__.f.j = (chunkId, promises) => {\n\t\t// JSONP chunk loading for javascript\n\t\tvar installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n\t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n\t\t\t// a Promise means \"currently loading\".\n\t\t\tif(installedChunkData) {\n\t\t\t\tpromises.push(installedChunkData[2]);\n\t\t\t} else {\n\t\t\t\tif(true) { // all chunks have JS\n\t\t\t\t\t// setup Promise in chunk cache\n\t\t\t\t\tvar promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));\n\t\t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n\t\t\t\t\t// start chunk loading\n\t\t\t\t\tvar url = __webpack_require__.p + __webpack_require__.u(chunkId);\n\t\t\t\t\t// create error before stack unwound to get useful stacktrace later\n\t\t\t\t\tvar error = new Error();\n\t\t\t\t\tvar loadingEnded = (event) => {\n\t\t\t\t\t\tif(__webpack_require__.o(installedChunks, chunkId)) {\n\t\t\t\t\t\t\tinstalledChunkData = installedChunks[chunkId];\n\t\t\t\t\t\t\tif(installedChunkData !== 0) installedChunks[chunkId] = undefined;\n\t\t\t\t\t\t\tif(installedChunkData) {\n\t\t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n\t\t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n\t\t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n\t\t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n\t\t\t\t\t\t\t\terror.type = errorType;\n\t\t\t\t\t\t\t\terror.request = realSrc;\n\t\t\t\t\t\t\t\tinstalledChunkData[1](error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t__webpack_require__.l(url, loadingEnded, \"chunk-\" + chunkId, chunkId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n};\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n// no on chunks loaded\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkmodule_exports\"] = self[\"webpackChunkmodule_exports\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extend');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/TextEditorButton');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/utils/KeyboardNavigatable');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Tooltip');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/utils/AutocompleteReader');","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}\nexport { _typeof as default };","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperty(e, r, t) {\n return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\nexport { _defineProperty as default };","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}\nexport { toPropertyKey as default };","import _typeof from \"./typeof.js\";\nfunction toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nexport { toPrimitive as default };","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/Fragment');","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport Fragment from 'flarum/common/Fragment';\nexport default class AutocompleteDropdown extends Fragment {\n constructor() {\n super(...arguments);\n _defineProperty(this, \"items\", []);\n _defineProperty(this, \"active\", false);\n _defineProperty(this, \"index\", 0);\n _defineProperty(this, \"keyWasJustPressed\", false);\n }\n view() {\n return m(\"ul\", {\n className: \"Dropdown-menu EmojiDropdown\"\n }, m(\"li\", {\n className: \"Dropdown-header\"\n }, app.translator.trans('flarum-emoji.forum.composer.type_to_search_text')), this.items.map(item => m(\"li\", {\n key: item.attrs.key\n }, item)));\n }\n show(left, top) {\n this.$().show().css({\n left: left + 'px',\n top: top + 'px'\n });\n this.active = true;\n }\n hide() {\n this.$().hide();\n this.active = false;\n }\n navigate(delta) {\n this.keyWasJustPressed = true;\n this.setIndex(this.index + delta, true);\n clearTimeout(this.keyWasJustPressedTimeout);\n this.keyWasJustPressedTimeout = setTimeout(() => this.keyWasJustPressed = false, 500);\n }\n complete() {\n this.$('li:not(.Dropdown-header)').eq(this.index).find('button').click();\n }\n setIndex(index, scrollToItem) {\n if (this.keyWasJustPressed && !scrollToItem) return;\n const $dropdown = this.$();\n const $items = $dropdown.find('li:not(.Dropdown-header)');\n let rangedIndex = index;\n if (rangedIndex < 0) {\n rangedIndex = $items.length - 1;\n } else if (rangedIndex >= $items.length) {\n rangedIndex = 0;\n }\n this.index = rangedIndex;\n const $item = $items.removeClass('active').eq(rangedIndex).addClass('active');\n if (scrollToItem) {\n const dropdownScroll = $dropdown.scrollTop();\n const dropdownTop = $dropdown.offset().top;\n const dropdownBottom = dropdownTop + $dropdown.outerHeight();\n const itemTop = $item.offset().top;\n const itemBottom = itemTop + $item.outerHeight();\n let scrollTop;\n if (itemTop < dropdownTop) {\n scrollTop = dropdownScroll - dropdownTop + itemTop - parseInt($dropdown.css('padding-top'), 10);\n } else if (itemBottom > dropdownBottom) {\n scrollTop = dropdownScroll - dropdownBottom + itemBottom + parseInt($dropdown.css('padding-bottom'), 10);\n }\n if (typeof scrollTop !== 'undefined') {\n $dropdown.stop(true).animate({\n scrollTop\n }, 100);\n }\n }\n }\n}\nflarum.reg.add('flarum-emoji', 'forum/fragments/AutocompleteDropdown', AutocompleteDropdown);","/*! Copyright Twitter Inc. and other contributors. Licensed under MIT */\nvar twemoji=function(){\"use strict\";var twemoji={base:\"https://twemoji.maxcdn.com/v/14.0.2/\",ext:\".png\",size:\"72x72\",className:\"emoji\",convert:{fromCodePoint:fromCodePoint,toCodePoint:toCodePoint},onerror:function onerror(){if(this.parentNode){this.parentNode.replaceChild(createText(this.alt,false),this)}},parse:parse,replace:replace,test:test},escaper={\"&\":\"&\",\"<\":\"<\",\">\":\">\",\"'\":\"'\",'\"':\""\"},re=/(?:\\ud83d\\udc68\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83e\\uddd1\\ud83c[\\udffc-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83e\\uddd1\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83e\\uddd1\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83e\\uddd1\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83e\\uddd1\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udffe]|\\ud83d\\udc68\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffb\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffc-\\udfff]|\\ud83d\\udc68\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffc\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83d\\udc68\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffd\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83d\\udc68\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udffe\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83d\\udc68\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\ud83c\\udfff\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udffe]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffc-\\udfff]|\\ud83d\\udc69\\ud83c\\udffb\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffc-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83d\\udc69\\ud83c\\udffc\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83d\\udc69\\ud83c\\udffd\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83d\\udc69\\ud83c\\udffe\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc68\\ud83c[\\udffb-\\udffe]|\\ud83d\\udc69\\ud83c\\udfff\\u200d\\ud83e\\udd1d\\u200d\\ud83d\\udc69\\ud83c[\\udffb-\\udffe]|\\ud83e\\uddd1\\ud83c\\udffb\\u200d\\u2764\\ufe0f\\u200d\\ud83e\\uddd1\\ud83c[\\udffc-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffb\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffc\\u200d\\u2764\\ufe0f\\u200d\\ud83e\\uddd1\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffc\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffd\\u200d\\u2764\\ufe0f\\u200d\\ud83e\\uddd1\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83e\\uddd1\\ud83c\\udffd\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udffe\\u200d\\u2764\\ufe0f\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83e\\uddd1\\ud83c\\udffe\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83e\\uddd1\\ud83c\\udfff\\u200d\\u2764\\ufe0f\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udffe]|\\ud83e\\uddd1\\ud83c\\udfff\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc68\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68|\\ud83d\\udc69\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d[\\udc68\\udc69]|\\ud83e\\udef1\\ud83c\\udffb\\u200d\\ud83e\\udef2\\ud83c[\\udffc-\\udfff]|\\ud83e\\udef1\\ud83c\\udffc\\u200d\\ud83e\\udef2\\ud83c[\\udffb\\udffd-\\udfff]|\\ud83e\\udef1\\ud83c\\udffd\\u200d\\ud83e\\udef2\\ud83c[\\udffb\\udffc\\udffe\\udfff]|\\ud83e\\udef1\\ud83c\\udffe\\u200d\\ud83e\\udef2\\ud83c[\\udffb-\\udffd\\udfff]|\\ud83e\\udef1\\ud83c\\udfff\\u200d\\ud83e\\udef2\\ud83c[\\udffb-\\udffe]|\\ud83d\\udc68\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68|\\ud83d\\udc69\\u200d\\u2764\\ufe0f\\u200d\\ud83d[\\udc68\\udc69]|\\ud83e\\uddd1\\u200d\\ud83e\\udd1d\\u200d\\ud83e\\uddd1|\\ud83d\\udc6b\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc6c\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc6d\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc8f\\ud83c[\\udffb-\\udfff]|\\ud83d\\udc91\\ud83c[\\udffb-\\udfff]|\\ud83e\\udd1d\\ud83c[\\udffb-\\udfff]|\\ud83d[\\udc6b-\\udc6d\\udc8f\\udc91]|\\ud83e\\udd1d)|(?:\\ud83d[\\udc68\\udc69]|\\ud83e\\uddd1)(?:\\ud83c[\\udffb-\\udfff])?\\u200d(?:\\u2695\\ufe0f|\\u2696\\ufe0f|\\u2708\\ufe0f|\\ud83c[\\udf3e\\udf73\\udf7c\\udf84\\udf93\\udfa4\\udfa8\\udfeb\\udfed]|\\ud83d[\\udcbb\\udcbc\\udd27\\udd2c\\ude80\\ude92]|\\ud83e[\\uddaf-\\uddb3\\uddbc\\uddbd])|(?:\\ud83c[\\udfcb\\udfcc]|\\ud83d[\\udd74\\udd75]|\\u26f9)((?:\\ud83c[\\udffb-\\udfff]|\\ufe0f)\\u200d[\\u2640\\u2642]\\ufe0f)|(?:\\ud83c[\\udfc3\\udfc4\\udfca]|\\ud83d[\\udc6e\\udc70\\udc71\\udc73\\udc77\\udc81\\udc82\\udc86\\udc87\\ude45-\\ude47\\ude4b\\ude4d\\ude4e\\udea3\\udeb4-\\udeb6]|\\ud83e[\\udd26\\udd35\\udd37-\\udd39\\udd3d\\udd3e\\uddb8\\uddb9\\uddcd-\\uddcf\\uddd4\\uddd6-\\udddd])(?:\\ud83c[\\udffb-\\udfff])?\\u200d[\\u2640\\u2642]\\ufe0f|(?:\\ud83d\\udc68\\u200d\\ud83d\\udc68\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc68\\u200d\\ud83d\\udc68\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc68\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc69\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc68\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc68\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc69\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc69\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\ud83d\\udc69\\u200d\\ud83d[\\udc66\\udc67]|\\ud83c\\udff3\\ufe0f\\u200d\\u26a7\\ufe0f|\\ud83c\\udff3\\ufe0f\\u200d\\ud83c\\udf08|\\ud83d\\ude36\\u200d\\ud83c\\udf2b\\ufe0f|\\u2764\\ufe0f\\u200d\\ud83d\\udd25|\\u2764\\ufe0f\\u200d\\ud83e\\ude79|\\ud83c\\udff4\\u200d\\u2620\\ufe0f|\\ud83d\\udc15\\u200d\\ud83e\\uddba|\\ud83d\\udc3b\\u200d\\u2744\\ufe0f|\\ud83d\\udc41\\u200d\\ud83d\\udde8|\\ud83d\\udc68\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc6f\\u200d\\u2640\\ufe0f|\\ud83d\\udc6f\\u200d\\u2642\\ufe0f|\\ud83d\\ude2e\\u200d\\ud83d\\udca8|\\ud83d\\ude35\\u200d\\ud83d\\udcab|\\ud83e\\udd3c\\u200d\\u2640\\ufe0f|\\ud83e\\udd3c\\u200d\\u2642\\ufe0f|\\ud83e\\uddde\\u200d\\u2640\\ufe0f|\\ud83e\\uddde\\u200d\\u2642\\ufe0f|\\ud83e\\udddf\\u200d\\u2640\\ufe0f|\\ud83e\\udddf\\u200d\\u2642\\ufe0f|\\ud83d\\udc08\\u200d\\u2b1b)|[#*0-9]\\ufe0f?\\u20e3|(?:[©®\\u2122\\u265f]\\ufe0f)|(?:\\ud83c[\\udc04\\udd70\\udd71\\udd7e\\udd7f\\ude02\\ude1a\\ude2f\\ude37\\udf21\\udf24-\\udf2c\\udf36\\udf7d\\udf96\\udf97\\udf99-\\udf9b\\udf9e\\udf9f\\udfcd\\udfce\\udfd4-\\udfdf\\udff3\\udff5\\udff7]|\\ud83d[\\udc3f\\udc41\\udcfd\\udd49\\udd4a\\udd6f\\udd70\\udd73\\udd76-\\udd79\\udd87\\udd8a-\\udd8d\\udda5\\udda8\\uddb1\\uddb2\\uddbc\\uddc2-\\uddc4\\uddd1-\\uddd3\\udddc-\\uddde\\udde1\\udde3\\udde8\\uddef\\uddf3\\uddfa\\udecb\\udecd-\\udecf\\udee0-\\udee5\\udee9\\udef0\\udef3]|[\\u203c\\u2049\\u2139\\u2194-\\u2199\\u21a9\\u21aa\\u231a\\u231b\\u2328\\u23cf\\u23ed-\\u23ef\\u23f1\\u23f2\\u23f8-\\u23fa\\u24c2\\u25aa\\u25ab\\u25b6\\u25c0\\u25fb-\\u25fe\\u2600-\\u2604\\u260e\\u2611\\u2614\\u2615\\u2618\\u2620\\u2622\\u2623\\u2626\\u262a\\u262e\\u262f\\u2638-\\u263a\\u2640\\u2642\\u2648-\\u2653\\u2660\\u2663\\u2665\\u2666\\u2668\\u267b\\u267f\\u2692-\\u2697\\u2699\\u269b\\u269c\\u26a0\\u26a1\\u26a7\\u26aa\\u26ab\\u26b0\\u26b1\\u26bd\\u26be\\u26c4\\u26c5\\u26c8\\u26cf\\u26d1\\u26d3\\u26d4\\u26e9\\u26ea\\u26f0-\\u26f5\\u26f8\\u26fa\\u26fd\\u2702\\u2708\\u2709\\u270f\\u2712\\u2714\\u2716\\u271d\\u2721\\u2733\\u2734\\u2744\\u2747\\u2757\\u2763\\u2764\\u27a1\\u2934\\u2935\\u2b05-\\u2b07\\u2b1b\\u2b1c\\u2b50\\u2b55\\u3030\\u303d\\u3297\\u3299])(?:\\ufe0f|(?!\\ufe0e))|(?:(?:\\ud83c[\\udfcb\\udfcc]|\\ud83d[\\udd74\\udd75\\udd90]|[\\u261d\\u26f7\\u26f9\\u270c\\u270d])(?:\\ufe0f|(?!\\ufe0e))|(?:\\ud83c[\\udf85\\udfc2-\\udfc4\\udfc7\\udfca]|\\ud83d[\\udc42\\udc43\\udc46-\\udc50\\udc66-\\udc69\\udc6e\\udc70-\\udc78\\udc7c\\udc81-\\udc83\\udc85-\\udc87\\udcaa\\udd7a\\udd95\\udd96\\ude45-\\ude47\\ude4b-\\ude4f\\udea3\\udeb4-\\udeb6\\udec0\\udecc]|\\ud83e[\\udd0c\\udd0f\\udd18-\\udd1c\\udd1e\\udd1f\\udd26\\udd30-\\udd39\\udd3d\\udd3e\\udd77\\uddb5\\uddb6\\uddb8\\uddb9\\uddbb\\uddcd-\\uddcf\\uddd1-\\udddd\\udec3-\\udec5\\udef0-\\udef6]|[\\u270a\\u270b]))(?:\\ud83c[\\udffb-\\udfff])?|(?:\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc65\\udb40\\udc6e\\udb40\\udc67\\udb40\\udc7f|\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc73\\udb40\\udc63\\udb40\\udc74\\udb40\\udc7f|\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc77\\udb40\\udc6c\\udb40\\udc73\\udb40\\udc7f|\\ud83c\\udde6\\ud83c[\\udde8-\\uddec\\uddee\\uddf1\\uddf2\\uddf4\\uddf6-\\uddfa\\uddfc\\uddfd\\uddff]|\\ud83c\\udde7\\ud83c[\\udde6\\udde7\\udde9-\\uddef\\uddf1-\\uddf4\\uddf6-\\uddf9\\uddfb\\uddfc\\uddfe\\uddff]|\\ud83c\\udde8\\ud83c[\\udde6\\udde8\\udde9\\uddeb-\\uddee\\uddf0-\\uddf5\\uddf7\\uddfa-\\uddff]|\\ud83c\\udde9\\ud83c[\\uddea\\uddec\\uddef\\uddf0\\uddf2\\uddf4\\uddff]|\\ud83c\\uddea\\ud83c[\\udde6\\udde8\\uddea\\uddec\\udded\\uddf7-\\uddfa]|\\ud83c\\uddeb\\ud83c[\\uddee-\\uddf0\\uddf2\\uddf4\\uddf7]|\\ud83c\\uddec\\ud83c[\\udde6\\udde7\\udde9-\\uddee\\uddf1-\\uddf3\\uddf5-\\uddfa\\uddfc\\uddfe]|\\ud83c\\udded\\ud83c[\\uddf0\\uddf2\\uddf3\\uddf7\\uddf9\\uddfa]|\\ud83c\\uddee\\ud83c[\\udde8-\\uddea\\uddf1-\\uddf4\\uddf6-\\uddf9]|\\ud83c\\uddef\\ud83c[\\uddea\\uddf2\\uddf4\\uddf5]|\\ud83c\\uddf0\\ud83c[\\uddea\\uddec-\\uddee\\uddf2\\uddf3\\uddf5\\uddf7\\uddfc\\uddfe\\uddff]|\\ud83c\\uddf1\\ud83c[\\udde6-\\udde8\\uddee\\uddf0\\uddf7-\\uddfb\\uddfe]|\\ud83c\\uddf2\\ud83c[\\udde6\\udde8-\\udded\\uddf0-\\uddff]|\\ud83c\\uddf3\\ud83c[\\udde6\\udde8\\uddea-\\uddec\\uddee\\uddf1\\uddf4\\uddf5\\uddf7\\uddfa\\uddff]|\\ud83c\\uddf4\\ud83c\\uddf2|\\ud83c\\uddf5\\ud83c[\\udde6\\uddea-\\udded\\uddf0-\\uddf3\\uddf7-\\uddf9\\uddfc\\uddfe]|\\ud83c\\uddf6\\ud83c\\udde6|\\ud83c\\uddf7\\ud83c[\\uddea\\uddf4\\uddf8\\uddfa\\uddfc]|\\ud83c\\uddf8\\ud83c[\\udde6-\\uddea\\uddec-\\uddf4\\uddf7-\\uddf9\\uddfb\\uddfd-\\uddff]|\\ud83c\\uddf9\\ud83c[\\udde6\\udde8\\udde9\\uddeb-\\udded\\uddef-\\uddf4\\uddf7\\uddf9\\uddfb\\uddfc\\uddff]|\\ud83c\\uddfa\\ud83c[\\udde6\\uddec\\uddf2\\uddf3\\uddf8\\uddfe\\uddff]|\\ud83c\\uddfb\\ud83c[\\udde6\\udde8\\uddea\\uddec\\uddee\\uddf3\\uddfa]|\\ud83c\\uddfc\\ud83c[\\uddeb\\uddf8]|\\ud83c\\uddfd\\ud83c\\uddf0|\\ud83c\\uddfe\\ud83c[\\uddea\\uddf9]|\\ud83c\\uddff\\ud83c[\\udde6\\uddf2\\uddfc]|\\ud83c[\\udccf\\udd8e\\udd91-\\udd9a\\udde6-\\uddff\\ude01\\ude32-\\ude36\\ude38-\\ude3a\\ude50\\ude51\\udf00-\\udf20\\udf2d-\\udf35\\udf37-\\udf7c\\udf7e-\\udf84\\udf86-\\udf93\\udfa0-\\udfc1\\udfc5\\udfc6\\udfc8\\udfc9\\udfcf-\\udfd3\\udfe0-\\udff0\\udff4\\udff8-\\udfff]|\\ud83d[\\udc00-\\udc3e\\udc40\\udc44\\udc45\\udc51-\\udc65\\udc6a\\udc6f\\udc79-\\udc7b\\udc7d-\\udc80\\udc84\\udc88-\\udc8e\\udc90\\udc92-\\udca9\\udcab-\\udcfc\\udcff-\\udd3d\\udd4b-\\udd4e\\udd50-\\udd67\\udda4\\uddfb-\\ude44\\ude48-\\ude4a\\ude80-\\udea2\\udea4-\\udeb3\\udeb7-\\udebf\\udec1-\\udec5\\uded0-\\uded2\\uded5-\\uded7\\udedd-\\udedf\\udeeb\\udeec\\udef4-\\udefc\\udfe0-\\udfeb\\udff0]|\\ud83e[\\udd0d\\udd0e\\udd10-\\udd17\\udd20-\\udd25\\udd27-\\udd2f\\udd3a\\udd3c\\udd3f-\\udd45\\udd47-\\udd76\\udd78-\\uddb4\\uddb7\\uddba\\uddbc-\\uddcc\\uddd0\\uddde-\\uddff\\ude70-\\ude74\\ude78-\\ude7c\\ude80-\\ude86\\ude90-\\udeac\\udeb0-\\udeba\\udec0-\\udec2\\uded0-\\uded9\\udee0-\\udee7]|[\\u23e9-\\u23ec\\u23f0\\u23f3\\u267e\\u26ce\\u2705\\u2728\\u274c\\u274e\\u2753-\\u2755\\u2795-\\u2797\\u27b0\\u27bf\\ue50a])|\\ufe0f/g,UFE0Fg=/\\uFE0F/g,U200D=String.fromCharCode(8205),rescaper=/[&<>'\"]/g,shouldntBeParsed=/^(?:iframe|noframes|noscript|script|select|style|textarea)$/,fromCharCode=String.fromCharCode;return twemoji;function createText(text,clean){return document.createTextNode(clean?text.replace(UFE0Fg,\"\"):text)}function escapeHTML(s){return s.replace(rescaper,replacer)}function defaultImageSrcGenerator(icon,options){return\"\".concat(options.base,options.size,\"/\",icon,options.ext)}function grabAllTextNodes(node,allText){var childNodes=node.childNodes,length=childNodes.length,subnode,nodeType;while(length--){subnode=childNodes[length];nodeType=subnode.nodeType;if(nodeType===3){allText.push(subnode)}else if(nodeType===1&&!(\"ownerSVGElement\"in subnode)&&!shouldntBeParsed.test(subnode.nodeName.toLowerCase())){grabAllTextNodes(subnode,allText)}}return allText}function grabTheRightIcon(rawText){return toCodePoint(rawText.indexOf(U200D)<0?rawText.replace(UFE0Fg,\"\"):rawText)}function parseNode(node,options){var allText=grabAllTextNodes(node,[]),length=allText.length,attrib,attrname,modified,fragment,subnode,text,match,i,index,img,rawText,iconId,src;while(length--){modified=false;fragment=document.createDocumentFragment();subnode=allText[length];text=subnode.nodeValue;i=0;while(match=re.exec(text)){index=match.index;if(index!==i){fragment.appendChild(createText(text.slice(i,index),true))}rawText=match[0];iconId=grabTheRightIcon(rawText);i=index+rawText.length;src=options.callback(iconId,options);if(iconId&&src){img=new Image;img.onerror=options.onerror;img.setAttribute(\"draggable\",\"false\");attrib=options.attributes(rawText,iconId);for(attrname in attrib){if(attrib.hasOwnProperty(attrname)&&attrname.indexOf(\"on\")!==0&&!img.hasAttribute(attrname)){img.setAttribute(attrname,attrib[attrname])}}img.className=options.className;img.alt=rawText;img.src=src;modified=true;fragment.appendChild(img)}if(!img)fragment.appendChild(createText(rawText,false));img=null}if(modified){if(i\")}return ret})}function replacer(m){return escaper[m]}function returnNull(){return null}function toSizeSquaredAsset(value){return typeof value===\"number\"?value+\"x\"+value:value}function fromCodePoint(codepoint){var code=typeof codepoint===\"string\"?parseInt(codepoint,16):codepoint;if(code<65536){return fromCharCode(code)}code-=65536;return fromCharCode(55296+(code>>10),56320+(code&1023))}function parse(what,how){if(!how||typeof how===\"function\"){how={callback:how}}return(typeof what===\"string\"?parseString:parseNode)(what,{callback:how.callback||defaultImageSrcGenerator,attributes:typeof how.attributes===\"function\"?how.attributes:returnNull,base:typeof how.base===\"string\"?how.base:twemoji.base,ext:how.ext||twemoji.ext,size:how.folder||toSizeSquaredAsset(how.size||twemoji.size),className:how.className||twemoji.className,onerror:how.onerror||twemoji.onerror})}function replace(text,callback){return String(text).replace(re,callback)}function test(text){re.lastIndex=0;var result=re.test(text);re.lastIndex=0;return result}function toCodePoint(unicodeSurrogates,sep){var r=[],c=0,p=0,i=0;while(i await import(/* webpackChunkName: 'forum/emojiMap', webpackMode: 'lazy-once' */ './emojiMap').then(m => emojiMap = m.default));\n // prettier-ignore\n this.commonEmoji = ['😀', '😁', '😂', '😃', '😄', '😅', '😆', '😇', '😈', '😉', '😊', '😋', '😌', '😍', '😎', '😏', '😐️', '😑', '😒', '😓', '😔', '😕', '😖', '😗', '😘', '😙', '😚', '😛', '😜', '😝', '😞', '😟', '😠', '😡', '😢', '😣', '😤', '😥', '😦', '😧', '😨', '😩', '😪', '😫', '😬', '😭', '😮', '😮‍💨', '😯', '😰', '😱', '😲', '😳', '😴', '😵', '😵‍💫', '😶', '😶‍🌫️', '😷', '😸', '😹', '😺', '😻', '😼', '😽', '😾', '😿', '🙀', '🙁', '🙂', '🙃', '🙄'];\n });\n extend('flarum/common/components/TextEditor', 'onbuild', function () {\n this.emojiDropdown = new AutocompleteDropdown();\n const $editor = this.$('.TextEditor-editor').wrap('
');\n this.navigator = new KeyboardNavigatable();\n this.navigator.when(() => this.emojiDropdown.active).onUp(() => this.emojiDropdown.navigate(-1)).onDown(() => this.emojiDropdown.navigate(1)).onSelect(this.emojiDropdown.complete.bind(this.emojiDropdown)).onCancel(this.emojiDropdown.hide.bind(this.emojiDropdown)).bindTo($editor);\n $editor.after($('
'));\n });\n extend('flarum/common/components/TextEditor', 'buildEditorParams', function (params) {\n const emojiKeys = Object.keys(emojiMap);\n const resolvedCdn = cdn();\n const autocompleteReader = new AutocompleteReader(':');\n params.inputListeners.push(() => {\n const selection = this.attrs.composer.editor.getSelectionRange();\n const cursor = selection[0];\n if (selection[1] - cursor > 0) return;\n const lastChunk = this.attrs.composer.editor.getLastNChars(15);\n const autocompleting = autocompleteReader.check(lastChunk, cursor, /[a-z0-9]|\\+|\\-|_|\\:/);\n this.emojiDropdown.hide();\n this.emojiDropdown.active = false;\n if (autocompleting) {\n const typed = autocompleting.typed;\n const emojiDropdown = this.emojiDropdown;\n const applySuggestion = replacement => {\n this.attrs.composer.editor.replaceBeforeCursor(autocompleting.absoluteStart - 1, replacement + ' ');\n this.emojiDropdown.hide();\n };\n const makeSuggestion = function (_ref) {\n let {\n emoji,\n name,\n code\n } = _ref;\n return m(Tooltip, {\n text: name\n }, m(\"button\", {\n key: emoji,\n onclick: () => applySuggestion(emoji),\n onmouseenter: function () {\n emojiDropdown.setIndex($(this).parent().index() - 1);\n }\n }, m(\"img\", {\n alt: emoji,\n className: \"emoji\",\n draggable: \"false\",\n loading: \"lazy\",\n src: `${resolvedCdn}72x72/${code}.png`,\n title: name\n })));\n };\n const buildSuggestions = () => {\n const similarEmoji = [];\n\n // Build a regular expression to do a fuzzy match of the given input string\n const fuzzyRegexp = function (str) {\n const reEscape = new RegExp('\\\\(([' + '+.*?[]{}()^$|\\\\'.replace(/(.)/g, '\\\\$1') + '])\\\\)', 'g');\n return new RegExp('(.*)' + str.toLowerCase().replace(/(.)/g, '($1)(.*?)').replace(reEscape, '(\\\\$1)') + '$', 'i');\n };\n const regTyped = fuzzyRegexp(typed);\n let maxSuggestions = 40;\n const findMatchingEmojis = matcher => {\n for (let i = 0; i < emojiKeys.length && maxSuggestions > 0; i++) {\n const curEmoji = emojiKeys[i];\n if (similarEmoji.indexOf(curEmoji) === -1) {\n const names = emojiMap[curEmoji];\n for (let name of names) {\n if (matcher(name, curEmoji)) {\n --maxSuggestions;\n similarEmoji.push(curEmoji);\n break;\n }\n }\n }\n }\n };\n\n // First, try to find all emojis starting with the given string\n findMatchingEmojis((emojiName, emoji) => {\n // If no input is provided yet, match the most common emojis.\n if (!typed) {\n return this.commonEmoji?.includes(emoji);\n }\n return emojiName.indexOf(typed) === 0;\n });\n\n // If there are still suggestions left, try for some fuzzy matches\n findMatchingEmojis(emojiName => regTyped.test(emojiName));\n const suggestions = similarEmoji.map(emoji => ({\n emoji,\n name: emojiMap[emoji][0],\n code: getEmojiIconCode(emoji)\n })).map(makeSuggestion);\n if (suggestions.length) {\n this.emojiDropdown.items = suggestions;\n m.render(this.$('.ComposerBody-emojiDropdownContainer')[0], this.emojiDropdown.render());\n this.emojiDropdown.show();\n const coordinates = this.attrs.composer.editor.getCaretCoordinates(autocompleting.absoluteStart);\n const width = this.emojiDropdown.$().outerWidth();\n const height = this.emojiDropdown.$().outerHeight();\n const parent = this.emojiDropdown.$().offsetParent();\n let left = coordinates.left;\n let top = coordinates.top + 15;\n\n // Keep the dropdown inside the editor.\n if (top + height > parent.height()) {\n top = coordinates.top - height - 15;\n }\n if (left + width > parent.width()) {\n left = parent.width() - width;\n }\n\n // Prevent the dropdown from going off screen on mobile\n top = Math.max(-(parent.offset().top - $(document).scrollTop()), top);\n left = Math.max(-parent.offset().left, left);\n this.emojiDropdown.show(left, top);\n }\n };\n buildSuggestions();\n this.emojiDropdown.setIndex(0);\n this.emojiDropdown.$().scrollTop(0);\n this.emojiDropdown.active = true;\n }\n });\n });\n extend('flarum/common/components/TextEditor', 'toolbarItems', function (items) {\n items.add('emoji', m(TextEditorButton, {\n onclick: () => this.attrs.composer.editor.insertAtCursor(' :'),\n icon: \"far fa-smile\"\n }, app.translator.trans('flarum-emoji.forum.composer.emoji_tooltip')));\n });\n}flarum.reg.addChunkModule('101', '232', 'flarum-emoji', 'forum/emojiMap');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/models/Post');","import twemoji from 'twemoji';\nimport { override } from 'flarum/common/extend';\nimport Post from 'flarum/common/models/Post';\nimport cdn from '../common/cdn';\nfunction options() {\n return {\n base: cdn(),\n attributes: () => ({\n loading: 'lazy'\n })\n };\n}\n\n/**\n * Parses an HTML string into a `` node containing the HTML content.\n *\n * Vanilla JS implementation of jQuery's `$.parseHTML()`,\n * sourced from http://youmightnotneedjquery.com/\n */\nfunction parseHTML(str) {\n const tmp = document.implementation.createHTMLDocument();\n tmp.body.innerHTML = str;\n return tmp.body;\n}\nexport default function renderEmoji() {\n override(Post.prototype, 'contentHtml', function (original) {\n const contentHtml = original();\n if (this.oldContentHtml !== contentHtml) {\n // We need to parse the HTML string into a DOM node, then give it to Twemoji.\n //\n // This prevents some issues with the default find-replace that would be performed\n // on a string passed to `Twemoji.parse()`.\n //\n // The parse function can only handle a single DOM node provided, so we need to\n // wrap it in a node. In our `parseHTML` implementation, we wrap it in a ``\n // element. This gets stripped below.\n //\n // See https://github.com/flarum/core/issues/2958\n const emojifiedDom = twemoji.parse(parseHTML(contentHtml), options());\n\n // Steal the HTML string inside the emojified DOM `` tag.\n this.emojifiedContentHtml = emojifiedDom.innerHTML;\n this.oldContentHtml = contentHtml;\n }\n return this.emojifiedContentHtml;\n });\n override(s9e.TextFormatter, 'preview', (original, text, element) => {\n original(text, element);\n twemoji.parse(element, options());\n });\n}","import app from 'flarum/forum/app';\nimport addComposerAutocomplete from './addComposerAutocomplete';\nimport renderEmoji from './renderEmoji';\napp.initializers.add('flarum-emoji', () => {\n // After typing ':' in the composer, show a dropdown suggesting a bunch of\n // emoji that the user could use.\n addComposerAutocomplete();\n\n // render emoji as image in Posts content and title.\n renderEmoji();\n});"],"names":["inProgress","dataWebpackPrefix","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","m","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","f","e","chunkId","Promise","all","keys","reduce","promises","u","g","globalThis","this","Function","window","obj","prop","prototype","hasOwnProperty","call","l","url","done","push","script","needAttach","scripts","document","getElementsByTagName","i","length","s","getAttribute","createElement","charset","timeout","nc","setAttribute","src","onScriptComplete","prev","event","onerror","onload","clearTimeout","doneFns","parentNode","removeChild","forEach","fn","setTimeout","bind","type","target","head","appendChild","r","Symbol","toStringTag","value","scriptUrl","importScripts","location","currentScript","tagName","toUpperCase","test","Error","replace","p","compat","originalLoadChunk","flarum","reg","loadChunk","installedChunks","j","installedChunkData","promise","resolve","reject","error","errorType","realSrc","message","name","request","webpackJsonpCallback","parentChunkLoadingFunction","data","chunkIds","moreModules","runtime","some","id","chunkLoadingGlobal","self","_typeof","iterator","constructor","_defineProperty","t","toPrimitive","TypeError","String","toPropertyKey","configurable","writable","AutocompleteDropdown","super","arguments","view","className","app","translator","trans","items","map","item","attrs","show","left","top","$","css","active","hide","navigate","delta","keyWasJustPressed","setIndex","index","keyWasJustPressedTimeout","complete","eq","find","click","scrollToItem","$dropdown","$items","rangedIndex","$item","removeClass","addClass","dropdownScroll","scrollTop","dropdownTop","offset","dropdownBottom","outerHeight","itemTop","itemBottom","parseInt","stop","animate","add","twemoji","base","ext","size","convert","fromCodePoint","codepoint","code","fromCharCode","toCodePoint","replaceChild","createText","alt","parse","what","how","callback","parseString","parseNode","defaultImageSrcGenerator","attributes","returnNull","folder","text","re","lastIndex","result","escaper","UFE0Fg","U200D","rescaper","shouldntBeParsed","clean","createTextNode","icon","options","concat","grabAllTextNodes","node","allText","subnode","nodeType","childNodes","nodeName","toLowerCase","grabTheRightIcon","rawText","indexOf","attrib","attrname","modified","fragment","match","img","iconId","createDocumentFragment","nodeValue","exec","slice","Image","hasAttribute","str","ret","replacer","unicodeSurrogates","sep","c","charCodeAt","toString","join","getEmojiIconCode","emoji","version","forum","attribute","addChunkModule","cdn","loading","emojiMap","extend","_loaders","async","then","default","commonEmoji","emojiDropdown","$editor","wrap","navigator","when","onUp","onDown","onSelect","onCancel","bindTo","after","params","emojiKeys","resolvedCdn","autocompleteReader","inputListeners","selection","composer","editor","getSelectionRange","cursor","lastChunk","getLastNChars","autocompleting","check","typed","applySuggestion","replacement","replaceBeforeCursor","absoluteStart","makeSuggestion","_ref","onclick","onmouseenter","parent","draggable","title","similarEmoji","regTyped","reEscape","RegExp","fuzzyRegexp","maxSuggestions","findMatchingEmojis","matcher","curEmoji","names","emojiName","includes","suggestions","render","coordinates","getCaretCoordinates","width","outerWidth","height","offsetParent","Math","max","buildSuggestions","insertAtCursor","addComposerAutocomplete","override","original","contentHtml","oldContentHtml","emojifiedDom","tmp","implementation","createHTMLDocument","body","innerHTML","parseHTML","emojifiedContentHtml","s9e","TextFormatter","element"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/emoji/js/dist/forum/emojiMap.js b/extensions/emoji/js/dist/forum/emojiMap.js new file mode 100644 index 0000000000..c54730d724 --- /dev/null +++ b/extensions/emoji/js/dist/forum/emojiMap.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunkmodule_exports=self.webpackChunkmodule_exports||[]).push([[101],{232:(a,e,_)=>{_.r(e),_.d(e,{default:()=>n});const n=JSON.parse('{"🇦":["regional_indicator_a"],"🇧":["regional_indicator_b"],"🇨":["regional_indicator_c"],"🇩":["regional_indicator_d"],"🇪":["regional_indicator_e"],"🇫":["regional_indicator_f"],"🇬":["regional_indicator_g"],"🇭":["regional_indicator_h"],"🇮":["regional_indicator_i"],"🇯":["regional_indicator_j"],"🇰":["regional_indicator_k"],"🇱":["regional_indicator_l"],"🇲":["regional_indicator_m"],"🇳":["regional_indicator_n"],"🇴":["regional_indicator_o"],"🇵":["regional_indicator_p"],"🇶":["regional_indicator_q"],"🇷":["regional_indicator_r"],"🇸":["regional_indicator_s"],"🇹":["regional_indicator_t"],"🇺":["regional_indicator_u"],"🇻":["regional_indicator_v"],"🇼":["regional_indicator_w"],"🇽":["regional_indicator_x"],"🇾":["regional_indicator_y"],"🇿":["regional_indicator_z"],"😀":["grinning","grinning_face"],"😃":["grinning_face_with_big_eyes","smiley"],"😄":["grinning_face_with_closed_eyes","smile"],"😁":["beaming_face","grin"],"😆":["laughing","lol","satisfied","squinting_face"],"😅":["grinning_face_with_sweat","sweat_smile"],"🤣":["rofl"],"😂":["joy","lmao","tears_of_joy"],"🙂":["slightly_smiling_face"],"🙃":["upside_down_face"],"🫠":["melt","melting_face"],"😉":["wink","winking_face"],"😊":["blush","smiling_face_with_closed_eyes"],"😇":["halo","innocent"],"🥰":["smiling_face_with_3_hearts"],"😍":["heart_eyes","smiling_face_with_heart_eyes"],"🤩":["star_struck"],"😘":["blowing_a_kiss","kissing_heart"],"😗":["kissing","kissing_face"],"☺️":["relaxed","smiling_face"],"😚":["kissing_closed_eyes","kissing_face_with_closed_eyes"],"😙":["kissing_face_with_smiling_eyes","kissing_smiling_eyes"],"🥲":["smiling_face_with_tear"],"😋":["savoring_food","yum"],"😛":["face_with_tongue","stuck_out_tongue"],"😜":["stuck_out_tongue_winking_eye"],"🤪":["zany","zany_face"],"😝":["stuck_out_tongue_closed_eyes"],"🤑":["money_mouth_face"],"🤗":["hug","hugging","hugging_face"],"🤭":["face_with_hand_over_mouth","hand_over_mouth"],"🫢":["face_with_open_eyes_hand_over_mouth","gasp"],"🫣":["face_with_peeking_eye","peek"],"🤫":["shush","shushing_face"],"🤔":["thinking","thinking_face","wtf"],"🫡":["salute","saluting_face"],"🤐":["zipper_mouth","zipper_mouth_face"],"🤨":["face_with_raised_eyebrow","raised_eyebrow"],"😐️":["neutral","neutral_face"],"😑":["expressionless","expressionless_face"],"😶":["no_mouth"],"🫥":["dotted_line_face"],"😶‍🌫️":["in_clouds"],"😏":["smirk","smirking","smirking_face"],"😒":["unamused","unamused_face"],"🙄":["rolling_eyes"],"😬":["grimacing","grimacing_face"],"😮‍💨":["exhale","exhaling"],"🤥":["lying","lying_face"],"😌":["relieved","relieved_face"],"😔":["pensive","pensive_face"],"😪":["sleepy","sleepy_face"],"🤤":["drooling","drooling_face"],"😴":["sleeping","sleeping_face"],"😷":["mask","medical_mask"],"🤒":["face_with_thermometer"],"🤕":["face_with_head_bandage"],"🤢":["nauseated","nauseated_face"],"🤮":["face_vomiting","vomiting"],"🤧":["sneezing","sneezing_face"],"🥵":["hot","hot_face"],"🥶":["cold","cold_face"],"🥴":["woozy","woozy_face"],"😵":["dizzy_face","knocked_out"],"😵‍💫":["dizzy_eyes"],"🤯":["exploding_head"],"🤠":["cowboy","cowboy_face"],"🥳":["hooray","partying","partying_face"],"🥸":["disguised","disguised_face"],"😎":["smiling_face_with_sunglasses","sunglasses_cool","too_cool"],"🤓":["nerd","nerd_face"],"🧐":["face_with_monocle"],"😕":["confused","confused_face"],"🫤":["face_with_diagonal_mouth"],"😟":["worried","worried_face"],"🙁":["slightly_frowning_face"],"☹️":["white_frowning_face"],"😮":["face_with_open_mouth","open_mouth"],"😯":["hushed","hushed_face"],"😲":["astonished","astonished_face"],"😳":["flushed","flushed_face"],"🥺":["pleading","pleading_face"],"🥹":["face_holding_back_tears","watery_eyes"],"😦":["frowning","frowning_face"],"😧":["anguished","anguished_face"],"😨":["fearful","fearful_face"],"😰":["anxious","anxious_face","cold_sweat"],"😥":["disappointed_relieved","sad_relieved_face"],"😢":["cry","crying_face"],"😭":["loudly_crying_face","sob"],"😱":["scream","screaming_in_fear"],"😖":["confounded","confounded_face"],"😣":["persevere","persevering_face"],"😞":["disappointed","disappointed_face"],"😓":["downcast_face","sweat"],"😩":["weary","weary_face"],"😫":["tired","tired_face"],"🥱":["yawn","yawning","yawning_face"],"😤":["nose_steam","triumph"],"😡":["pout","pouting_face","rage"],"😠":["angry","angry_face"],"🤬":["censored","face_with_symbols_on_mouth"],"😈":["smiling_imp"],"👿":["angry_imp","imp"],"💀":["skull"],"☠️":["skull_and_crossbones"],"💩":["poop","shit"],"🤡":["clown","clown_face"],"👹":["japanese_ogre","ogre"],"👺":["goblin","japanese_goblin"],"👻":["ghost"],"👽️":["alien"],"👾":["alien_monster","space_invader"],"🤖":["robot","robot_face"],"😺":["grinning_cat","smiley_cat"],"😸":["grinning_cat_with_closed_eyes","smile_cat"],"😹":["joy_cat","tears_of_joy_cat"],"😻":["heart_eyes_cat","smiling_cat_with_heart_eyes"],"😼":["smirk_cat","wry_smile_cat"],"😽":["kissing_cat"],"🙀":["scream_cat","weary_cat"],"😿":["crying_cat"],"😾":["pouting_cat"],"🙈":["see_no_evil"],"🙉":["hear_no_evil"],"🙊":["speak_no_evil"],"💋":["kiss"],"💌":["love_letter"],"💘":["cupid","heart_with_arrow"],"💝":["gift_heart","heart_with_ribbon"],"💖":["sparkling_heart"],"💗":["growing_heart","heartpulse"],"💓":["beating_heart","heartbeat"],"💞":["revolving_hearts"],"💕":["two_hearts"],"💟":["heart_decoration"],"❣️":["heart_exclamation"],"💔":["broken_heart"],"❤️‍🔥":["heart_on_fire"],"❤️‍🩹":["mending_heart"],"❤️":["heart","red_heart"],"🧡":["orange_heart"],"💛":["yellow_heart"],"💚":["green_heart"],"💙":["blue_heart"],"💜":["purple_heart"],"🤎":["brown_heart"],"🖤":["black_heart"],"🤍":["white_heart"],"💯":["100"],"💢":["anger"],"💥":["boom","collision"],"💫":["dizzy"],"💦":["sweat_drops"],"💨":["dash","dashing_away"],"🕳️":["hole"],"💣️":["bomb"],"💬":["speech_balloon"],"👁‍🗨":["eye_in_speech_bubble"],"🗨️":["left_speech_bubble"],"🗯️":["right_anger_bubble"],"💭":["thought_balloon"],"💤":["zzz"],"👋":["wave","waving_hand"],"🤚":["raised_back_of_hand"],"🖐️":["raised_hand_with_fingers_splayed"],"✋":["high_five","raised_hand"],"🖖":["vulcan"],"🫱":["rightwards_hand"],"🫲":["leftwards_hand"],"🫳":["palm_down"],"🫴":["palm_up"],"👌":["ok_hand"],"🤌":["pinch","pinched_fingers"],"🤏":["pinching_hand"],"✌️":["v","victory"],"🤞":["fingers_crossed"],"🫰":["hand_with_index_finger_and_thumb_crossed"],"🤟":["love_you_gesture"],"🤘":["metal","sign_of_the_horns"],"🤙":["call_me_hand"],"👈️":["point_left"],"👉️":["point_right"],"👆️":["point_up"],"🖕":["middle_finger"],"👇️":["point_down"],"☝️":["point_up_2"],"🫵":["point_forward"],"👍️":["+1","thumbsup","yes"],"👎️":["-1","no","thumbsdown"],"✊":["fist"],"👊":["punch"],"🤛":["left_facing_fist"],"🤜":["right_facing_fist"],"👏":["clap","clapping_hands"],"🙌":["raised_hands"],"🫶":["heart_hands"],"👐":["open_hands"],"🤲":["palms_up_together"],"🤝":["handshake"],"🙏":["folded_hands","pray"],"✍️":["writing_hand"],"💅":["nail_care","nail_polish"],"🤳":["selfie"],"💪":["muscle","right_bicep"],"🦾":["mechanical_arm"],"🦿":["mechanical_leg"],"🦵":["leg"],"🦶":["foot"],"👂️":["ear"],"🦻":["ear_with_hearing_aid","hearing_aid"],"👃":["nose"],"🧠":["brain"],"🫀":["anatomical_heart"],"🫁":["lungs"],"🦷":["tooth"],"🦴":["bone"],"👀":["eyes"],"👁️":["eye"],"👅":["tongue"],"👄":["lips","mouth"],"🫦":["biting_lip"],"👶":["baby"],"🧒":["child"],"👦":["boy"],"👧":["girl"],"🧑":["adult"],"👱":["blond_haired"],"👨":["man"],"🧔":["person_bearded"],"🧔‍♂️":["man_bearded"],"🧔‍♀️":["woman_bearded"],"👨‍🦰":["man_red_haired"],"👨‍🦱":["man_curly_haired"],"👨‍🦳":["man_white_haired"],"👨‍🦲":["man_bald"],"👩":["woman"],"👩‍🦰":["woman_red_haired"],"🧑‍🦰":["red_haired"],"👩‍🦱":["woman_curly_haired"],"🧑‍🦱":["curly_haired"],"👩‍🦳":["woman_white_haired"],"🧑‍🦳":["white_haired"],"👩‍🦲":["woman_bald"],"🧑‍🦲":["bald"],"👱‍♀️":["woman_blond_haired"],"👱‍♂️":["man_blond_haired"],"🧓":["older_adult"],"👴":["older_man"],"👵":["older_woman"],"🙍":["person_frowning"],"🙍‍♂️":["man_frowning"],"🙍‍♀️":["woman_frowning"],"🙎":["person_pouting","pouting"],"🙎‍♂️":["man_pouting"],"🙎‍♀️":["woman_pouting"],"🙅":["no_good","person_gesturing_no"],"🙅‍♂️":["man_gesturing_no"],"🙅‍♀️":["woman_gesturing_no"],"🙆":["all_good","person_gesturing_ok"],"🙆‍♂️":["man_gesturing_ok"],"🙆‍♀️":["woman_gesturing_ok"],"💁":["person_tipping_hand"],"💁‍♂️":["man_tipping_hand"],"💁‍♀️":["woman_tipping_hand"],"🙋":["person_raising_hand"],"🙋‍♂️":["man_raising_hand"],"🙋‍♀️":["woman_raising_hand"],"🧏":["deaf_person"],"🧏‍♂️":["deaf_man"],"🧏‍♀️":["deaf_woman"],"🙇":["bow","person_bowing"],"🙇‍♂️":["man_bowing"],"🙇‍♀️":["woman_bowing"],"🤦":["facepalm","person_facepalming"],"🤦‍♂️":["man_facepalming"],"🤦‍♀️":["woman_facepalming"],"🤷":["person_shrugging","shrug"],"🤷‍♂️":["man_shrugging"],"🤷‍♀️":["woman_shrugging"],"🧑‍⚕️":["health_worker"],"👨‍⚕️":["man_health_worker"],"👩‍⚕️":["woman_health_worker"],"🧑‍🎓":["student"],"👨‍🎓":["man_student"],"👩‍🎓":["woman_student"],"🧑‍🏫":["teacher"],"👨‍🏫":["man_teacher"],"👩‍🏫":["woman_teacher"],"🧑‍⚖️":["judge"],"👨‍⚖️":["man_judge"],"👩‍⚖️":["woman_judge"],"🧑‍🌾":["farmer"],"👨‍🌾":["man_farmer"],"👩‍🌾":["woman_farmer"],"🧑‍🍳":["cook"],"👨‍🍳":["man_cook"],"👩‍🍳":["woman_cook"],"🧑‍🔧":["mechanic"],"👨‍🔧":["man_mechanic"],"👩‍🔧":["woman_mechanic"],"🧑‍🏭":["factory_worker"],"👨‍🏭":["man_factory_worker"],"👩‍🏭":["woman_factory_worker"],"🧑‍💼":["office_worker"],"👨‍💼":["man_office_worker"],"👩‍💼":["woman_office_worker"],"🧑‍🔬":["scientist"],"👨‍🔬":["man_scientist"],"👩‍🔬":["woman_scientist"],"🧑‍💻":["technologist"],"👨‍💻":["man_technologist"],"👩‍💻":["woman_technologist"],"🧑‍🎤":["singer"],"👨‍🎤":["man_singer"],"👩‍🎤":["woman_singer"],"🧑‍🎨":["artist"],"👨‍🎨":["man_artist"],"👩‍🎨":["woman_artist"],"🧑‍✈️":["pilot"],"👨‍✈️":["man_pilot"],"👩‍✈️":["woman_pilot"],"🧑‍🚀":["astronaut"],"👨‍🚀":["man_astronaut"],"👩‍🚀":["woman_astronaut"],"🧑‍🚒":["firefighter"],"👨‍🚒":["man_firefighter"],"👩‍🚒":["woman_firefighter"],"👮":["cop","police_officer"],"👮‍♂️":["man_police_officer"],"👮‍♀️":["woman_police_officer"],"🕵️":["detective"],"🕵️‍♂️":["man_detective"],"🕵️‍♀️":["woman_detective"],"💂":["guard"],"💂‍♂️":["man_guard"],"💂‍♀️":["woman_guard"],"🥷":["ninja"],"👷":["construction_worker"],"👷‍♂️":["man_construction_worker"],"👷‍♀️":["woman_construction_worker"],"🫅":["person_with_crown","royalty"],"🤴":["prince"],"👸":["princess"],"👳":["person_wearing_turban"],"👳‍♂️":["man_wearing_turban"],"👳‍♀️":["woman_wearing_turban"],"👲":["person_with_skullcap"],"🧕":["woman_with_headscarf"],"🤵":["person_in_tuxedo"],"🤵‍♂️":["man_in_tuxedo"],"🤵‍♀️":["woman_in_tuxedo"],"👰":["person_with_veil"],"👰‍♂️":["man_with_veil"],"👰‍♀️":["woman_with_veil"],"🤰":["pregnant_woman"],"🫃":["pregnant_man"],"🫄":["pregnant_person"],"🤱":["breast_feeding"],"👩‍🍼":["woman_feeding_baby"],"👨‍🍼":["man_feeding_baby"],"🧑‍🍼":["person_feeding_baby"],"👼":["angel"],"🎅":["santa"],"🤶":["mrs_claus"],"🧑‍🎄":["mx_claus"],"🦸":["superhero"],"🦸‍♂️":["man_superhero"],"🦸‍♀️":["woman_superhero"],"🦹":["supervillain"],"🦹‍♂️":["man_supervillain"],"🦹‍♀️":["woman_supervillain"],"🧙":["mage"],"🧙‍♂️":["man_mage"],"🧙‍♀️":["woman_mage"],"🧚":["fairy"],"🧚‍♂️":["man_fairy"],"🧚‍♀️":["woman_fairy"],"🧛":["vampire"],"🧛‍♂️":["man_vampire"],"🧛‍♀️":["woman_vampire"],"🧜":["merperson"],"🧜‍♂️":["merman"],"🧜‍♀️":["mermaid"],"🧝":["elf"],"🧝‍♂️":["man_elf"],"🧝‍♀️":["woman_elf"],"🧞":["genie"],"🧞‍♂️":["man_genie"],"🧞‍♀️":["woman_genie"],"🧟":["zombie"],"🧟‍♂️":["man_zombie"],"🧟‍♀️":["woman_zombie"],"🧌":["troll"],"💆":["massage","person_getting_massage"],"💆‍♂️":["man_getting_massage"],"💆‍♀️":["woman_getting_massage"],"💇":["haircut","person_getting_haircut"],"💇‍♂️":["man_getting_haircut"],"💇‍♀️":["woman_getting_haircut"],"🚶":["person_walking","walking"],"🚶‍♂️":["man_walking"],"🚶‍♀️":["woman_walking"],"🧍":["person_standing","standing"],"🧍‍♂️":["man_standing"],"🧍‍♀️":["woman_standing"],"🧎":["kneeling","person_kneeling"],"🧎‍♂️":["man_kneeling"],"🧎‍♀️":["woman_kneeling"],"🧑‍🦯":["person_with_probing_cane","person_with_white_cane"],"👨‍🦯":["man_with_probing_cane","man_with_white_cane"],"👩‍🦯":["woman_with_probing_cane","woman_with_white_cane"],"🧑‍🦼":["person_in_motorized_wheelchair"],"👨‍🦼":["man_in_motorized_wheelchair"],"👩‍🦼":["woman_in_motorized_wheelchair"],"🧑‍🦽":["person_in_manual_wheelchair"],"👨‍🦽":["man_in_manual_wheelchair"],"👩‍🦽":["woman_in_manual_wheelchair"],"🏃":["person_running","running"],"🏃‍♂️":["man_running"],"🏃‍♀️":["woman_running"],"💃":["dancer","woman_dancing"],"🕺":["man_dancing"],"🕴️":["levitate","levitating","person_in_suit_levitating"],"👯":["dancers","people_with_bunny_ears_partying"],"👯‍♂️":["men_with_bunny_ears_partying"],"👯‍♀️":["women_with_bunny_ears_partying"],"🧖":["person_in_steamy_room"],"🧖‍♂️":["man_in_steamy_room"],"🧖‍♀️":["woman_in_steamy_room"],"🧗":["climbing","person_climbing"],"🧗‍♂️":["man_climbing"],"🧗‍♀️":["woman_climbing"],"🤺":["fencer","fencing","person_fencing"],"🏇":["horse_racing"],"⛷️":["person_skiing","skier","skiing"],"🏂️":["person_snowboarding","snowboarder","snowboarding"],"🏌️":["golfer","golfing","person_golfing"],"🏌️‍♂️":["man_golfing"],"🏌️‍♀️":["woman_golfing"],"🏄️":["person_surfing","surfer","surfing"],"🏄‍♂️":["man_surfing"],"🏄‍♀️":["woman_surfing"],"🚣":["person_rowing_boat","rowboat"],"🚣‍♂️":["man_rowing_boat"],"🚣‍♀️":["woman_rowing_boat"],"🏊️":["person_swimming","swimmer","swimming"],"🏊‍♂️":["man_swimming"],"🏊‍♀️":["woman_swimming"],"⛹️":["person_bouncing_ball"],"⛹️‍♂️":["man_bouncing_ball"],"⛹️‍♀️":["woman_bouncing_ball"],"🏋️":["person_lifting_weights","weight_lifter","weight_lifting"],"🏋️‍♂️":["man_lifting_weights"],"🏋️‍♀️":["woman_lifting_weights"],"🚴":["bicyclist","biking","person_biking"],"🚴‍♂️":["man_biking"],"🚴‍♀️":["woman_biking"],"🚵":["mountain_bicyclist","mountain_biking","person_mountain_biking"],"🚵‍♂️":["man_mountain_biking"],"🚵‍♀️":["woman_mountain_biking"],"🤸":["cartwheeling","person_cartwheel"],"🤸‍♂️":["man_cartwheeling"],"🤸‍♀️":["woman_cartwheeling"],"🤼":["people_wrestling","wrestlers","wrestling"],"🤼‍♂️":["men_wrestling"],"🤼‍♀️":["women_wrestling"],"🤽":["person_playing_water_polo","water_polo"],"🤽‍♂️":["man_playing_water_polo"],"🤽‍♀️":["woman_playing_water_polo"],"🤾":["handball","person_playing_handball"],"🤾‍♂️":["man_playing_handball"],"🤾‍♀️":["woman_playing_handball"],"🤹":["juggler","juggling","person_juggling"],"🤹‍♂️":["man_juggling"],"🤹‍♀️":["woman_juggling"],"🧘":["person_in_lotus_position"],"🧘‍♂️":["man_in_lotus_position"],"🧘‍♀️":["woman_in_lotus_position"],"🛀":["bath","person_taking_bath"],"🛌":["person_in_bed","sleeping_accommodation"],"🧑‍🤝‍🧑":["people_holding_hands"],"👭":["two_women_holding_hands"],"👫":["couple"],"👬":["two_men_holding_hands"],"💏":["couple_kiss","couplekiss"],"👩‍❤️‍💋‍👨":["kiss_mw","kiss_wm"],"👨‍❤️‍💋‍👨":["kiss_mm"],"👩‍❤️‍💋‍👩":["kiss_ww"],"💑":["couple_with_heart"],"👩‍❤️‍👨":["couple_with_heart_mw","couple_with_heart_wm"],"👨‍❤️‍👨":["couple_with_heart_mm"],"👩‍❤️‍👩":["couple_with_heart_ww"],"👪️":["family"],"👨‍👩‍👦":["family_mwb"],"👨‍👩‍👧":["family_mwg"],"👨‍👩‍👧‍👦":["family_mwgb"],"👨‍👩‍👦‍👦":["family_mwbb"],"👨‍👩‍👧‍👧":["family_mwgg"],"👨‍👨‍👦":["family_mmb"],"👨‍👨‍👧":["family_mmg"],"👨‍👨‍👧‍👦":["family_mmgb"],"👨‍👨‍👦‍👦":["family_mmbb"],"👨‍👨‍👧‍👧":["family_mmgg"],"👩‍👩‍👦":["family_wwb"],"👩‍👩‍👧":["family_wwg"],"👩‍👩‍👧‍👦":["family_wwgb"],"👩‍👩‍👦‍👦":["family_wwbb"],"👩‍👩‍👧‍👧":["family_wwgg"],"👨‍👦":["family_mb"],"👨‍👦‍👦":["family_mbb"],"👨‍👧":["family_mg"],"👨‍👧‍👦":["family_mgb"],"👨‍👧‍👧":["family_mgg"],"👩‍👦":["family_wb"],"👩‍👦‍👦":["family_wbb"],"👩‍👧":["family_wg"],"👩‍👧‍👦":["family_wgb"],"👩‍👧‍👧":["family_wgg"],"🗣️":["speaking_head"],"👤":["bust_in_silhouette"],"👥":["busts_in_silhouette"],"🫂":["people_hugging"],"👣":["footprints"],"🏻":["tone1","tone_light"],"🏼":["tone2","tone_medium_light"],"🏽":["tone3","tone_medium"],"🏾":["tone4","tone_medium_dark"],"🏿":["tone5","tone_dark"],"🦰":["red_hair"],"🦱":["curly_hair"],"🦳":["white_hair"],"🦲":["no_hair"],"🐵":["monkey_face"],"🐒":["monkey"],"🦍":["gorilla"],"🦧":["orangutan"],"🐶":["dog_face"],"🐕️":["dog"],"🦮":["guide_dog"],"🐕‍🦺":["service_dog"],"🐩":["poodle"],"🐺":["wolf","wolf_face"],"🦊":["fox","fox_face"],"🦝":["raccoon"],"🐱":["cat_face"],"🐈️":["cat"],"🐈‍⬛":["black_cat"],"🦁":["lion","lion_face"],"🐯":["tiger_face"],"🐅":["tiger"],"🐆":["leopard"],"🐴":["horse_face"],"🐎":["horse","racehorse"],"🦄":["unicorn","unicorn_face"],"🦓":["zebra"],"🦌":["deer"],"🦬":["bison"],"🐮":["cow_face"],"🐂":["ox"],"🐃":["water_buffalo"],"🐄":["cow"],"🐷":["pig_face"],"🐖":["pig"],"🐗":["boar"],"🐽":["pig_nose"],"🐏":["ram"],"🐑":["ewe","sheep"],"🐐":["goat"],"🐪":["dromedary_camel"],"🐫":["camel"],"🦙":["llama"],"🦒":["giraffe"],"🐘":["elephant"],"🦣":["mammoth"],"🦏":["rhino","rhinoceros"],"🦛":["hippo"],"🐭":["mouse_face"],"🐁":["mouse"],"🐀":["rat"],"🐹":["hamster","hamster_face"],"🐰":["rabbit_face"],"🐇":["rabbit"],"🐿️":["chipmunk"],"🦫":["beaver"],"🦔":["hedgehog"],"🦇":["bat"],"🐻":["bear","bear_face"],"🐻‍❄️":["polar_bear","polar_bear_face"],"🐨":["koala","koala_face"],"🐼":["panda","panda_face"],"🦥":["sloth"],"🦦":["otter"],"🦨":["skunk"],"🦘":["kangaroo"],"🦡":["badger"],"🐾":["paw_prints"],"🦃":["turkey"],"🐔":["chicken","chicken_face"],"🐓":["rooster"],"🐣":["hatching_chick"],"🐤":["baby_chick"],"🐥":["hatched_chick"],"🐦️":["bird","bird_face"],"🐧":["penguin","penguin_face"],"🕊️":["dove"],"🦅":["eagle"],"🦆":["duck"],"🦢":["swan"],"🦉":["owl"],"🦤":["dodo"],"🪶":["feather"],"🦩":["flamingo"],"🦚":["peacock"],"🦜":["parrot"],"🐸":["frog","frog_face"],"🐊":["crocodile"],"🐢":["turtle"],"🦎":["lizard"],"🐍":["snake"],"🐲":["dragon_face"],"🐉":["dragon"],"🦕":["sauropod"],"🦖":["t-rex","trex"],"🐳":["spouting_whale"],"🐋":["whale"],"🐬":["dolphin"],"🦭":["seal"],"🐟️":["fish"],"🐠":["tropical_fish"],"🐡":["blowfish"],"🦈":["shark"],"🐙":["octopus"],"🐚":["shell"],"🪸":["coral"],"🐌":["snail"],"🦋":["butterfly"],"🐛":["bug"],"🐜":["ant"],"🐝":["bee"],"🪲":["beetle"],"🐞":["lady_beetle"],"🦗":["cricket"],"🪳":["cockroach"],"🕷️":["spider"],"🕸️":["spider_web"],"🦂":["scorpion"],"🦟":["mosquito"],"🪰":["fly"],"🪱":["worm"],"🦠":["microbe"],"💐":["bouquet"],"🌸":["cherry_blossom"],"💮":["white_flower"],"🪷":["lotus"],"🏵️":["rosette"],"🌹":["rose"],"🥀":["wilted_flower"],"🌺":["hibiscus"],"🌻":["sunflower"],"🌼":["blossom"],"🌷":["tulip"],"🌱":["seedling"],"🪴":["potted_plant"],"🌲":["evergreen_tree"],"🌳":["deciduous_tree"],"🌴":["palm_tree"],"🌵":["cactus"],"🌾":["ear_of_rice","sheaf_of_rice"],"🌿":["herb"],"☘️":["shamrock"],"🍀":["four_leaf_clover"],"🍁":["maple_leaf"],"🍂":["fallen_leaf"],"🍃":["leaves"],"🪹":["empty_nest","nest"],"🪺":["nest_with_eggs"],"🍇":["grapes"],"🍈":["melon"],"🍉":["watermelon"],"🍊":["orange","tangerine"],"🍋":["lemon"],"🍌":["banana"],"🍍":["pineapple"],"🥭":["mango"],"🍎":["apple","red_apple"],"🍏":["green_apple"],"🍐":["pear"],"🍑":["peach"],"🍒":["cherries"],"🍓":["strawberry"],"🫐":["blueberries"],"🥝":["kiwi"],"🍅":["tomato"],"🫒":["olive"],"🥥":["coconut"],"🥑":["avocado"],"🍆":["eggplant"],"🥔":["potato"],"🥕":["carrot"],"🌽":["corn","ear_of_corn"],"🌶️":["hot_pepper"],"🫑":["bell_pepper"],"🥒":["cucumber"],"🥬":["leafy_green"],"🥦":["broccoli"],"🧄":["garlic"],"🧅":["onion"],"🍄":["mushroom"],"🥜":["peanuts"],"🫘":["beans"],"🌰":["chestnut"],"🍞":["bread"],"🥐":["croissant"],"🥖":["baguette_bread"],"🫓":["flatbread"],"🥨":["pretzel"],"🥯":["bagel"],"🥞":["pancakes"],"🧇":["waffle"],"🧀":["cheese"],"🍖":["meat_on_bone"],"🍗":["poultry_leg"],"🥩":["cut_of_meat"],"🥓":["bacon"],"🍔":["hamburger"],"🍟":["french_fries","fries"],"🍕":["pizza"],"🌭":["hotdog"],"🥪":["sandwich"],"🌮":["taco"],"🌯":["burrito"],"🫔":["tamale"],"🥙":["stuffed_flatbread"],"🧆":["falafel"],"🥚":["egg"],"🍳":["cooking","fried_egg"],"🥘":["shallow_pan_of_food"],"🍲":["pot_of_food","stew"],"🫕":["fondue"],"🥣":["bowl_with_spoon"],"🥗":["green_salad","salad"],"🍿":["popcorn"],"🧈":["butter"],"🧂":["salt"],"🥫":["canned_food"],"🍱":["bento","bento_box"],"🍘":["rice_cracker"],"🍙":["rice_ball"],"🍚":["cooked_rice","rice"],"🍛":["curry","curry_rice"],"🍜":["ramen","steaming_bowl"],"🍝":["spaghetti"],"🍠":["sweet_potato"],"🍢":["oden"],"🍣":["sushi"],"🍤":["fried_shrimp"],"🍥":["fish_cake"],"🥮":["moon_cake"],"🍡":["dango"],"🥟":["dumpling"],"🥠":["fortune_cookie"],"🥡":["takeout_box"],"🦀":["crab"],"🦞":["lobster"],"🦐":["shrimp"],"🦑":["squid"],"🦪":["oyster"],"🍦":["icecream","soft_serve"],"🍧":["shaved_ice"],"🍨":["ice_cream"],"🍩":["doughnut"],"🍪":["cookie"],"🎂":["birthday","birthday_cake"],"🍰":["cake","shortcake"],"🧁":["cupcake"],"🥧":["pie"],"🍫":["chocolate_bar"],"🍬":["candy"],"🍭":["lollipop"],"🍮":["custard"],"🍯":["honey_pot"],"🍼":["baby_bottle"],"🥛":["glass_of_milk","milk"],"☕️":["coffee"],"🫖":["teapot"],"🍵":["tea"],"🍶":["sake"],"🍾":["champagne"],"🍷":["wine_glass"],"🍸️":["cocktail"],"🍹":["tropical_drink"],"🍺":["beer"],"🍻":["beers"],"🥂":["clinking_glasses"],"🥃":["tumbler_glass","whisky"],"🫗":["pour","pouring_liquid"],"🥤":["cup_with_straw"],"🧋":["boba_drink","bubble_tea"],"🧃":["beverage_box","juice_box"],"🧉":["mate"],"🧊":["ice","ice_cube"],"🥢":["chopsticks"],"🍽️":["fork_knife_plate"],"🍴":["fork_and_knife"],"🥄":["spoon"],"🔪":["knife"],"🫙":["jar"],"🏺":["amphora"],"🌍️":["earth_africa","earth_europe"],"🌎️":["earth_americas"],"🌏️":["earth_asia"],"🌐":["globe_with_meridians"],"🗺️":["world_map"],"🗾":["japan_map"],"🧭":["compass"],"🏔️":["mountain_snow"],"⛰️":["mountain"],"🌋":["volcano"],"🗻":["mount_fuji"],"🏕️":["camping"],"🏖️":["beach","beach_with_umbrella"],"🏜️":["desert"],"🏝️":["desert_island","island"],"🏞️":["national_park"],"🏟️":["stadium"],"🏛️":["classical_building"],"🏗️":["building_construction","construction_site"],"🧱":["bricks"],"🪨":["rock"],"🪵":["wood"],"🛖":["hut"],"🏘️":["homes","houses"],"🏚️":["derelict_house","house_abandoned"],"🏠️":["house"],"🏡":["house_with_garden"],"🏢":["office"],"🏣":["post_office"],"🏤":["european_post_office"],"🏥":["hospital"],"🏦":["bank"],"🏨":["hotel"],"🏩":["love_hotel"],"🏪":["convenience_store"],"🏫":["school"],"🏬":["department_store"],"🏭️":["factory"],"🏯":["japanese_castle"],"🏰":["castle","european_castle"],"💒":["wedding"],"🗼":["tokyo_tower"],"🗽":["statue_of_liberty"],"⛪️":["church"],"🕌":["mosque"],"🛕":["hindu_temple"],"🕍":["synagogue"],"⛩️":["shinto_shrine"],"🕋":["kaaba"],"⛲️":["fountain"],"⛺️":["tent"],"🌁":["foggy"],"🌃":["night_with_stars"],"🏙️":["cityscape"],"🌄":["sunrise_over_mountains"],"🌅":["sunrise"],"🌆":["city_dusk"],"🌇":["city_sunrise","city_sunset"],"🌉":["bridge_at_night"],"♨️":["hotsprings"],"🎠":["carousel_horse"],"🛝":["playground_slide","slide"],"🎡":["ferris_wheel"],"🎢":["roller_coaster"],"💈":["barber","barber_pole"],"🎪":["circus_tent"],"🚂":["steam_locomotive"],"🚃":["railway_car"],"🚄":["bullettrain_side"],"🚅":["bullettrain_front"],"🚆":["train"],"🚇️":["metro"],"🚈":["light_rail"],"🚉":["station"],"🚊":["tram"],"🚝":["monorail"],"🚞":["mountain_railway"],"🚋":["tram_car"],"🚌":["bus"],"🚍️":["oncoming_bus"],"🚎":["trolleybus"],"🚐":["minibus"],"🚑️":["ambulance"],"🚒":["fire_engine"],"🚓":["police_car"],"🚔️":["oncoming_police_car"],"🚕":["taxi"],"🚖":["oncoming_taxi"],"🚗":["car","red_car"],"🚘️":["oncoming_automobile"],"🚙":["blue_car","suv"],"🛻":["pickup_truck"],"🚚":["delivery_truck","truck"],"🚛":["articulated_lorry"],"🚜":["tractor"],"🏎️":["racing_car"],"🏍️":["motorcycle"],"🛵":["motor_scooter"],"🦽":["manual_wheelchair"],"🦼":["motorized_wheelchair"],"🛺":["auto_rickshaw"],"🚲️":["bicycle","bike"],"🛴":["scooter"],"🛹":["skateboard"],"🛼":["roller_skate"],"🚏":["busstop"],"🛣️":["motorway"],"🛤️":["railway_track"],"🛢️":["oil_drum"],"⛽️":["fuelpump"],"🛞":["wheel"],"🚨":["rotating_light"],"🚥":["traffic_light"],"🚦":["vertical_traffic_light"],"🛑":["octagonal_sign","stop_sign"],"🚧":["construction"],"⚓️":["anchor"],"🛟":["lifebuoy","ring_buoy"],"⛵️":["sailboat"],"🛶":["canoe"],"🚤":["speedboat"],"🛳️":["cruise_ship","passenger_ship"],"⛴️":["ferry"],"🛥️":["motorboat"],"🚢":["ship"],"✈️":["airplane"],"🛩️":["small_airplane"],"🛫":["airplane_departure"],"🛬":["airplane_arriving"],"🪂":["parachute"],"💺":["seat"],"🚁":["helicopter"],"🚟":["suspension_railway"],"🚠":["mountain_cableway"],"🚡":["aerial_tramway"],"🛰️":["satellite"],"🚀":["rocket"],"🛸":["flying_saucer"],"🛎️":["bellhop"],"🧳":["luggage"],"⌛️":["hourglass"],"⏳️":["hourglass_flowing_sand"],"⌚️":["watch"],"⏰":["alarm_clock"],"⏱️":["stopwatch"],"⏲️":["timer_clock"],"🕰️":["clock"],"🕛️":["clock12"],"🕧️":["clock1230"],"🕐️":["clock1"],"🕜️":["clock130"],"🕑️":["clock2"],"🕝️":["clock230"],"🕒️":["clock3"],"🕞️":["clock330"],"🕓️":["clock4"],"🕟️":["clock430"],"🕔️":["clock5"],"🕠️":["clock530"],"🕕️":["clock6"],"🕡️":["clock630"],"🕖️":["clock7"],"🕢️":["clock730"],"🕗️":["clock8"],"🕣️":["clock830"],"🕘️":["clock9"],"🕤️":["clock930"],"🕙️":["clock10"],"🕥️":["clock1030"],"🕚️":["clock11"],"🕦️":["clock1130"],"🌑":["new_moon"],"🌒":["waxing_crescent_moon"],"🌓":["first_quarter_moon"],"🌔":["waxing_gibbous_moon"],"🌕️":["full_moon"],"🌖":["waning_gibbous_moon"],"🌗":["last_quarter_moon"],"🌘":["waning_crescent_moon"],"🌙":["crescent_moon"],"🌚":["new_moon_with_face"],"🌛":["first_quarter_moon_with_face"],"🌜️":["last_quarter_moon_with_face"],"🌡️":["thermometer"],"☀️":["sun"],"🌝":["full_moon_with_face"],"🌞":["sun_with_face"],"🪐":["ringed_planet","saturn"],"⭐️":["star"],"🌟":["glowing_star","star2"],"🌠":["shooting_star","stars"],"🌌":["milky_way"],"☁️":["cloud"],"⛅️":["partly_sunny","sun_behind_cloud"],"⛈️":["stormy","thunder_cloud_and_rain"],"🌤️":["sun_behind_small_cloud","sunny"],"🌥️":["cloudy","sun_behind_large_cloud"],"🌦️":["sun_and_rain","sun_behind_rain_cloud"],"🌧️":["cloud_with_rain","rainy"],"🌨️":["cloud_with_snow","snowy"],"🌩️":["cloud_with_lightning","lightning"],"🌪️":["tornado"],"🌫️":["fog"],"🌬️":["wind_blowing_face"],"🌀":["cyclone"],"🌈":["rainbow"],"🌂":["closed_umbrella"],"☂️":["umbrella"],"☔️":["umbrella_with_rain"],"⛱️":["beach_umbrella","umbrella_on_ground"],"⚡️":["high_voltage","zap"],"❄️":["snowflake"],"☃️":["snowman2"],"⛄️":["snowman"],"☄️":["comet"],"🔥":["fire"],"💧":["droplet"],"🌊":["ocean","water_wave"],"🎃":["jack_o_lantern"],"🎄":["christmas_tree"],"🎆":["fireworks"],"🎇":["sparkler"],"🧨":["firecracker"],"✨":["sparkles"],"🎈":["balloon"],"🎉":["party","party_popper","tada"],"🎊":["confetti_ball"],"🎋":["tanabata_tree"],"🎍":["bamboo"],"🎎":["dolls"],"🎏":["carp_streamer","flags"],"🎐":["wind_chime"],"🎑":["moon_ceremony","rice_scene"],"🧧":["red_envelope"],"🎀":["ribbon"],"🎁":["gift"],"🎗️":["reminder_ribbon"],"🎟️":["admission_tickets","tickets"],"🎫":["ticket"],"🎖️":["military_medal"],"🏆️":["trophy"],"🏅":["sports_medal"],"🥇":["1st","first_place_medal"],"🥈":["2nd","second_place_medal"],"🥉":["3rd","third_place_medal"],"⚽️":["soccer"],"⚾️":["baseball"],"🥎":["softball"],"🏀":["basketball"],"🏐":["volleyball"],"🏈":["football"],"🏉":["rugby_football"],"🎾":["tennis"],"🥏":["flying_disc"],"🎳":["bowling"],"🏏":["cricket_game"],"🏑":["field_hockey"],"🏒":["hockey"],"🥍":["lacrosse"],"🏓":["ping_pong"],"🏸":["badminton"],"🥊":["boxing_glove"],"🥋":["martial_arts_uniform"],"🥅":["goal_net"],"⛳️":["golf"],"⛸️":["ice_skate"],"🎣":["fishing_pole","fishing_pole_and_fish"],"🤿":["diving_mask"],"🎽":["running_shirt","running_shirt_with_sash"],"🎿":["ski"],"🛷":["sled"],"🥌":["curling_stone"],"🎯":["bullseye","dart","direct_hit"],"🪀":["yo_yo"],"🪁":["kite"],"🎱":["8ball","billiards"],"🔮":["crystal_ball"],"🪄":["magic_wand"],"🧿":["nazar_amulet"],"🪬":["hamsa"],"🎮️":["controller","video_game"],"🕹️":["joystick"],"🎰":["slot_machine"],"🎲":["game_die"],"🧩":["jigsaw","puzzle_piece"],"🧸":["teddy_bear"],"🪅":["pinata"],"🪩":["disco","disco_ball","mirror_ball"],"🪆":["nesting_dolls"],"♠️":["spades"],"♥️":["hearts"],"♦️":["diamonds"],"♣️":["clubs"],"♟️":["chess_pawn"],"🃏":["black_joker"],"🀄️":["mahjong"],"🎴":["flower_playing_cards"],"🎭️":["performing_arts"],"🖼️":["frame_with_picture","framed_picture"],"🎨":["art","palette"],"🧵":["thread"],"🪡":["sewing_needle"],"🧶":["yarn"],"🪢":["knot"],"👓️":["eyeglasses","glasses"],"🕶️":["sunglasses"],"🥽":["goggles"],"🥼":["lab_coat"],"🦺":["safety_vest"],"👔":["necktie"],"👕":["shirt"],"👖":["jeans"],"🧣":["scarf"],"🧤":["gloves"],"🧥":["coat"],"🧦":["socks"],"👗":["dress"],"👘":["kimono"],"🥻":["sari"],"🩱":["one_piece_swimsuit"],"🩲":["briefs"],"🩳":["shorts"],"👙":["bikini"],"👚":["womans_clothes"],"👛":["purse"],"👜":["handbag"],"👝":["clutch_bag","pouch"],"🛍️":["shopping_bags"],"🎒":["backpack","school_satchel"],"🩴":["thong_sandal"],"👞":["mans_shoe"],"👟":["athletic_shoe","sneaker"],"🥾":["hiking_boot"],"🥿":["flat_shoe","womans_flat_shoe"],"👠":["high_heel"],"👡":["sandal"],"🩰":["ballet_shoes"],"👢":["boot"],"👑":["crown"],"👒":["womans_hat"],"🎩":["top_hat","tophat"],"🎓️":["graduation_cap","mortar_board"],"🧢":["billed_cap"],"🪖":["military_helmet"],"⛑️":["helmet_with_cross","rescue_worker_helmet"],"📿":["prayer_beads"],"💄":["lipstick"],"💍":["ring"],"💎":["gem"],"🔇":["mute","no_sound"],"🔈️":["low_volume","quiet_sound","speaker"],"🔉":["medium_volumne","sound"],"🔊":["high_volume","loud_sound"],"📢":["loudspeaker"],"📣":["mega","megaphone"],"📯":["postal_horn"],"🔔":["bell"],"🔕":["no_bell"],"🎼":["musical_score"],"🎵":["musical_note"],"🎶":["musical_notes","notes"],"🎙️":["studio_microphone"],"🎚️":["level_slider"],"🎛️":["control_knobs"],"🎤":["microphone"],"🎧️":["headphones"],"📻️":["radio"],"🎷":["saxophone"],"🪗":["accordion"],"🎸":["guitar"],"🎹":["musical_keyboard"],"🎺":["trumpet"],"🎻":["violin"],"🪕":["banjo"],"🥁":["drum"],"🪘":["long_drum"],"📱":["android","iphone","mobile_phone"],"📲":["calling","mobile_phone_arrow"],"☎️":["telephone"],"📞":["telephone_receiver"],"📟️":["pager"],"📠":["fax","fax_machine"],"🔋":["battery"],"🪫":["low_battery"],"🔌":["electric_plug"],"💻️":["laptop"],"🖥️":["computer","desktop_computer"],"🖨️":["printer"],"⌨️":["keyboard"],"🖱️":["computer_mouse"],"🖲️":["trackball"],"💽":["computer_disk","minidisc"],"💾":["floppy_disk"],"💿️":["cd","optical_disk"],"📀":["dvd"],"🧮":["abacus"],"🎥":["movie_camera"],"🎞️":["film_frames"],"📽️":["film_projector"],"🎬️":["clapper"],"📺️":["tv"],"📷️":["camera"],"📸":["camera_with_flash"],"📹️":["video_camera"],"📼":["vhs","videocassette"],"🔍️":["mag"],"🔎":["mag_right"],"🕯️":["candle"],"💡":["bulb","light_bulb"],"🔦":["flashlight"],"🏮":["izakaya_lantern","red_paper_lantern"],"🪔":["diya_lamp"],"📔":["notebook_with_decorative_cover"],"📕":["closed_book"],"📖":["book","open_book"],"📗":["green_book"],"📘":["blue_book"],"📙":["orange_book"],"📚️":["books"],"📓":["notebook"],"📒":["ledger"],"📃":["page_with_curl"],"📜":["scroll"],"📄":["page_facing_up"],"📰":["newspaper"],"🗞️":["rolled_up_newspaper"],"📑":["bookmark_tabs"],"🔖":["bookmark"],"🏷️":["label"],"💰️":["moneybag"],"🪙":["coin"],"💴":["yen"],"💵":["dollar"],"💶":["euro"],"💷":["pound"],"💸":["money_with_wings"],"💳️":["credit_card"],"🧾":["receipt"],"💹":["chart"],"✉️":["envelope"],"📧":["e-mail","email"],"📨":["incoming_envelope"],"📩":["envelope_with_arrow"],"📤️":["outbox_tray"],"📥️":["inbox_tray"],"📦️":["package"],"📫️":["mailbox"],"📪️":["mailbox_closed"],"📬️":["mailbox_with_mail"],"📭️":["mailbox_with_no_mail"],"📮":["postbox"],"🗳️":["ballot_box"],"✏️":["pencil"],"✒️":["black_nib"],"🖋️":["fountain_pen"],"🖊️":["pen"],"🖌️":["paintbrush"],"🖍️":["crayon"],"📝":["memo"],"💼":["briefcase"],"📁":["file_folder"],"📂":["open_file_folder"],"🗂️":["card_index_dividers"],"📅":["date"],"📆":["calendar"],"🗒️":["notepad_spiral"],"🗓️":["calendar_spiral"],"📇":["card_index"],"📈":["chart_increasing","chart_with_upwards_trend"],"📉":["chart_decreasing","chart_with_downwards_trend"],"📊":["bar_chart"],"📋️":["clipboard"],"📌":["pushpin"],"📍":["round_pushpin"],"📎":["paperclip"],"🖇️":["paperclips"],"📏":["straight_ruler"],"📐":["triangular_ruler"],"✂️":["scissors"],"🗃️":["card_file_box"],"🗄️":["file_cabinet"],"🗑️":["trashcan","wastebasket"],"🔒️":["lock","locked"],"🔓️":["unlock","unlocked"],"🔏":["lock_with_ink_pen","locked_with_pen"],"🔐":["closed_lock_with_key","locked_with_key"],"🔑":["key"],"🗝️":["old_key"],"🔨":["hammer"],"🪓":["axe"],"⛏️":["pick"],"⚒️":["hammer_and_pick"],"🛠️":["hammer_and_wrench"],"🗡️":["dagger"],"⚔️":["crossed_swords"],"🔫":["gun","pistol"],"🪃":["boomerang"],"🏹":["bow_and_arrow"],"🛡️":["shield"],"🪚":["carpentry_saw"],"🔧":["wrench"],"🪛":["screwdriver"],"🔩":["nut_and_bolt"],"⚙️":["gear"],"🗜️":["clamp","compression"],"⚖️":["scales"],"🦯":["probing_cane","white_cane"],"🔗":["link"],"⛓️":["chains"],"🪝":["hook"],"🧰":["toolbox"],"🧲":["magnet"],"🪜":["ladder"],"⚗️":["alembic"],"🧪":["test_tube"],"🧫":["petri_dish"],"🧬":["dna","double_helix"],"🔬":["microscope"],"🔭":["telescope"],"📡":["satellite_antenna"],"💉":["syringe"],"🩸":["drop_of_blood"],"💊":["pill"],"🩹":["adhesive_bandage","bandaid"],"🩼":["crutch"],"🩺":["stethoscope"],"🩻":["x-ray","xray"],"🚪":["door"],"🛗":["elevator"],"🪞":["mirror"],"🪟":["window"],"🛏️":["bed"],"🛋️":["couch_and_lamp"],"🪑":["chair"],"🚽":["toilet"],"🪠":["plunger"],"🚿":["shower"],"🛁":["bathtub"],"🪤":["mouse_trap"],"🪒":["razor"],"🧴":["lotion_bottle"],"🧷":["safety_pin"],"🧹":["broom"],"🧺":["basket"],"🧻":["roll_of_paper","toilet_paper"],"🪣":["bucket"],"🧼":["soap"],"🫧":["bubbles"],"🪥":["toothbrush"],"🧽":["sponge"],"🧯":["fire_extinguisher"],"🛒":["shopping_cart"],"🚬":["cigarette","smoking"],"⚰️":["coffin"],"🪦":["headstone"],"⚱️":["funeral_urn"],"🗿":["moai","moyai"],"🪧":["placard"],"🪪":["id_card"],"🏧":["atm"],"🚮":["litter_bin","put_litter_in_its_place"],"🚰":["potable_water"],"♿️":["handicapped","wheelchair"],"🚹️":["mens"],"🚺️":["womens"],"🚻":["bathroom","restroom"],"🚼️":["baby_symbol"],"🚾":["water_closet","wc"],"🛂":["passport_control"],"🛃":["customs"],"🛄":["baggage_claim"],"🛅":["left_luggage"],"⚠️":["warning"],"🚸":["children_crossing"],"⛔️":["no_entry"],"🚫":["no_entry_sign"],"🚳":["no_bicycles"],"🚭️":["no_smoking"],"🚯":["do_not_litter","no_littering"],"🚱":["non-potable_water"],"🚷":["no_pedestrians"],"📵":["no_mobile_phones"],"🔞":["no_one_under_18","underage"],"☢️":["radioactive"],"☣️":["biohazard"],"⬆️":["arrow_up"],"↗️":["arrow_upper_right"],"➡️":["arrow_right"],"↘️":["arrow_lower_right"],"⬇️":["arrow_down"],"↙️":["arrow_lower_left"],"⬅️":["arrow_left"],"↖️":["arrow_upper_left"],"↕️":["arrow_up_down"],"↔️":["left_right_arrow"],"↩️":["arrow_left_hook","leftwards_arrow_with_hook"],"↪️":["arrow_right_hook","rightwards_arrow_with_hook"],"⤴️":["arrow_heading_up"],"⤵️":["arrow_heading_down"],"🔃":["arrows_clockwise","clockwise"],"🔄":["arrows_counterclockwise","counterclockwise"],"🔙":["back"],"🔚":["end"],"🔛":["on"],"🔜":["soon"],"🔝":["top"],"🛐":["place_of_worship"],"⚛️":["atom","atom_symbol"],"🕉️":["om"],"✡️":["star_of_david"],"☸️":["wheel_of_dharma"],"☯️":["yin_yang"],"✝️":["latin_cross"],"☦️":["orthodox_cross"],"☪️":["star_and_crescent"],"☮️":["peace","peace_symbol"],"🕎":["menorah"],"🔯":["six_pointed_star"],"♈️":["aries"],"♉️":["taurus"],"♊️":["gemini"],"♋️":["cancer"],"♌️":["leo"],"♍️":["virgo"],"♎️":["libra"],"♏️":["scorpius"],"♐️":["sagittarius"],"♑️":["capricorn"],"♒️":["aquarius"],"♓️":["pisces"],"⛎":["ophiuchus"],"🔀":["shuffle","twisted_rightwards_arrows"],"🔁":["repeat"],"🔂":["repeat_one"],"▶️":["arrow_forward","play"],"⏩️":["fast_forward"],"⏭️":["next_track"],"⏯️":["play_pause"],"◀️":["arrow_backward","reverse"],"⏪️":["fast_reverse","rewind"],"⏮️":["previous_track"],"🔼":["arrow_up_small","up"],"⏫":["arrow_double_up","fast_up"],"🔽":["arrow_down_small","down"],"⏬":["arrow_double_down","fast_down"],"⏸️":["pause"],"⏹️":["stop"],"⏺️":["record"],"⏏️":["eject"],"🎦":["cinema"],"🔅":["dim_button","low_brightness"],"🔆":["bright_button","high_brightness"],"📶":["antenna_bars","signal_strength"],"📳":["vibration_mode"],"📴":["mobile_phone_off"],"♀️":["female","female_sign"],"♂️":["male","male_sign"],"⚧️":["transgender_symbol"],"✖️":["multiplication","multiply"],"➕":["plus"],"➖":["minus"],"➗":["divide","division"],"🟰":["heavy_equals_sign"],"♾️":["infinity"],"‼️":["bangbang","double_exclamation"],"⁉️":["exclamation_question","interrobang"],"❓️":["question"],"❔":["white_question"],"❕":["white_exclamation"],"❗️":["exclamation"],"〰️":["wavy_dash"],"💱":["currency_exchange"],"💲":["heavy_dollar_sign"],"⚕️":["medical","medical_symbol"],"♻️":["recycle","recycling_symbol"],"⚜️":["fleur-de-lis"],"🔱":["trident"],"📛":["name_badge"],"🔰":["beginner"],"⭕️":["hollow_red_circle","red_o"],"✅":["check_mark_button","white_check_mark"],"☑️":["ballot_box_with_check"],"✔️":["check_mark","heavy_check_mark"],"❌":["cross_mark","x"],"❎":["cross_mark_button","negative_squared_cross_mark"],"➰":["curly_loop"],"➿":["double_curly_loop","loop"],"〽️":["part_alternation_mark"],"✳️":["eight_spoked_asterisk"],"✴️":["eight_pointed_black_star"],"❇️":["sparkle"],"©️":["copyright"],"®️":["registered"],"™️":["tm","trade_mark"],"#️⃣":["hash","number_sign"],"*️⃣":["asterisk"],"0️⃣":["zero"],"1️⃣":["one"],"2️⃣":["two"],"3️⃣":["three"],"4️⃣":["four"],"5️⃣":["five"],"6️⃣":["six"],"7️⃣":["seven"],"8️⃣":["eight"],"9️⃣":["nine"],"🔟":["ten"],"🔠":["capital_abcd"],"🔡":["abcd"],"🔢":["1234"],"🔣":["symbols"],"🔤":["abc"],"🅰️":["a","a_blood"],"🆎":["ab","ab_blood"],"🅱️":["b","b_blood"],"🆑":["cl"],"🆒":["cool"],"🆓":["free"],"ℹ️":["info","information_source"],"🆔":["id"],"Ⓜ️":["m"],"🆕":["new"],"🆖":["ng"],"🅾️":["o","o_blood"],"🆗":["ok"],"🅿️":["parking"],"🆘":["sos"],"🆙":["up2"],"🆚":["vs"],"🈁":["ja_here","koko"],"🈂️":["ja_service_charge"],"🈷️":["ja_monthly_amount"],"🈶":["ja_not_free_of_carge"],"🈯️":["ja_reserved"],"🉐":["ideograph_advantage","ja_bargain"],"🈹":["ja_discount"],"🈚️":["ja_free_of_charge"],"🈲":["ja_prohibited"],"🉑":["accept","ja_acceptable"],"🈸":["ja_application"],"🈴":["ja_passing_grade"],"🈳":["ja_vacancy"],"㊗️":["congratulations","ja_congratulations"],"㊙️":["ja_secret","secret"],"🈺":["ja_open_for_business"],"🈵":["ja_no_vacancy"],"🔴":["red_circle"],"🟠":["orange_circle"],"🟡":["yellow_circle"],"🟢":["green_circle"],"🔵":["blue_circle"],"🟣":["purple_circle"],"🟤":["brown_circle"],"⚫️":["black_circle"],"⚪️":["white_circle"],"🟥":["red_square"],"🟧":["orange_square"],"🟨":["yellow_square"],"🟩":["green_square"],"🟦":["blue_square"],"🟪":["purple_square"],"🟫":["brown_square"],"⬛️":["black_large_square"],"⬜️":["white_large_square"],"◼️":["black_medium_square"],"◻️":["white_medium_square"],"◾️":["black_medium_small_square"],"◽️":["white_medium_small_square"],"▪️":["black_small_square"],"▫️":["white_small_square"],"🔶":["large_orange_diamond"],"🔷":["large_blue_diamond"],"🔸":["small_orange_diamond"],"🔹":["small_blue_diamond"],"🔺":["small_red_triangle"],"🔻":["small_red_triangle_down"],"💠":["diamond_shape_with_a_dot_inside","diamond_with_a_dot"],"🔘":["radio_button"],"🔳":["white_square_button"],"🔲":["black_square_button"],"🏁":["checkered_flag"],"🚩":["triangular_flag","triangular_flag_on_post"],"🎌":["crossed_flags"],"🏴":["black_flag"],"🏳️":["white_flag"],"🏳️‍🌈":["rainbow_flag"],"🏳️‍⚧️":["transgender_flag"],"🏴‍☠️":["jolly_roger","pirate_flag"],"🇦🇨":["ascension_island","flag_ac"],"🇦🇩":["andorra","flag_ad"],"🇦🇪":["flag_ae","united_arab_emirates"],"🇦🇫":["afghanistan","flag_af"],"🇦🇬":["antigua_barbuda","flag_ag"],"🇦🇮":["anguilla","flag_ai"],"🇦🇱":["albania","flag_al"],"🇦🇲":["armenia","flag_am"],"🇦🇴":["angola","flag_ao"],"🇦🇶":["antarctica","flag_aq"],"🇦🇷":["argentina","flag_ar"],"🇦🇸":["american_samoa","flag_as"],"🇦🇹":["austria","flag_at"],"🇦🇺":["australia","flag_au"],"🇦🇼":["aruba","flag_aw"],"🇦🇽":["aland_islands","flag_ax"],"🇦🇿":["azerbaijan","flag_az"],"🇧🇦":["bosnia_herzegovina","flag_ba"],"🇧🇧":["barbados","flag_bb"],"🇧🇩":["bangladesh","flag_bd"],"🇧🇪":["belgium","flag_be"],"🇧🇫":["burkina_faso","flag_bf"],"🇧🇬":["bulgaria","flag_bg"],"🇧🇭":["bahrain","flag_bh"],"🇧🇮":["burundi","flag_bi"],"🇧🇯":["benin","flag_bj"],"🇧🇱":["flag_bl","st_barthelemy"],"🇧🇲":["bermuda","flag_bm"],"🇧🇳":["brunei","flag_bn"],"🇧🇴":["bolivia","flag_bo"],"🇧🇶":["caribbean_netherlands","flag_bq"],"🇧🇷":["brazil","flag_br"],"🇧🇸":["bahamas","flag_bs"],"🇧🇹":["bhutan","flag_bt"],"🇧🇻":["bouvet_island","flag_bv"],"🇧🇼":["botswana","flag_bw"],"🇧🇾":["belarus","flag_by"],"🇧🇿":["belize","flag_bz"],"🇨🇦":["canada","flag_ca"],"🇨🇨":["cocos_islands","flag_cc"],"🇨🇩":["congo_kinshasa","flag_cd"],"🇨🇫":["central_african_republic","flag_cf"],"🇨🇬":["congo_brazzaville","flag_cg"],"🇨🇭":["flag_ch","switzerland"],"🇨🇮":["cote_divoire","flag_ci"],"🇨🇰":["cook_islands","flag_ck"],"🇨🇱":["chile","flag_cl"],"🇨🇲":["cameroon","flag_cm"],"🇨🇳":["china","flag_cn"],"🇨🇴":["colombia","flag_co"],"🇨🇵":["clipperton_island","flag_cp"],"🇨🇷":["costa_rica","flag_cr"],"🇨🇺":["cuba","flag_cu"],"🇨🇻":["cape_verde","flag_cv"],"🇨🇼":["curacao","flag_cw"],"🇨🇽":["christmas_island","flag_cx"],"🇨🇾":["cyprus","flag_cy"],"🇨🇿":["czech_republic","czechia","flag_cz"],"🇩🇪":["flag_de","germany"],"🇩🇬":["diego_garcia","flag_dg"],"🇩🇯":["djibouti","flag_dj"],"🇩🇰":["denmark","flag_dk"],"🇩🇲":["dominica","flag_dm"],"🇩🇴":["dominican_republic","flag_do"],"🇩🇿":["algeria","flag_dz"],"🇪🇦":["ceuta_melilla","flag_ea"],"🇪🇨":["ecuador","flag_ec"],"🇪🇪":["estonia","flag_ee"],"🇪🇬":["egypt","flag_eg"],"🇪🇭":["flag_eh","western_sahara"],"🇪🇷":["eritrea","flag_er"],"🇪🇸":["flag_es","spain"],"🇪🇹":["ethiopia","flag_et"],"🇪🇺":["european_union","flag_eu"],"🇫🇮":["finland","flag_fi"],"🇫🇯":["fiji","flag_fj"],"🇫🇰":["falkland_islands","flag_fk"],"🇫🇲":["flag_fm","micronesia"],"🇫🇴":["faroe_islands","flag_fo"],"🇫🇷":["flag_fr","france"],"🇬🇦":["flag_ga","gabon"],"🇬🇧":["flag_gb","uk","united_kingdom"],"🇬🇩":["flag_gd","grenada"],"🇬🇪":["flag_ge","georgia"],"🇬🇫":["flag_gf","french_guiana"],"🇬🇬":["flag_gg","guernsey"],"🇬🇭":["flag_gh","ghana"],"🇬🇮":["flag_gi","gibraltar"],"🇬🇱":["flag_gl","greenland"],"🇬🇲":["flag_gm","gambia"],"🇬🇳":["flag_gn","guinea"],"🇬🇵":["flag_gp","guadeloupe"],"🇬🇶":["equatorial_guinea","flag_gq"],"🇬🇷":["flag_gr","greece"],"🇬🇸":["flag_gs","south_georgia_south_sandwich_islands"],"🇬🇹":["flag_gt","guatemala"],"🇬🇺":["flag_gu","guam"],"🇬🇼":["flag_gw","guinea_bissau"],"🇬🇾":["flag_gy","guyana"],"🇭🇰":["flag_hk","hong_kong"],"🇭🇲":["flag_hm","heard_mcdonald_islands"],"🇭🇳":["flag_hn","honduras"],"🇭🇷":["croatia","flag_hr"],"🇭🇹":["flag_ht","haiti"],"🇭🇺":["flag_hu","hungary"],"🇮🇨":["canary_islands","flag_ic"],"🇮🇩":["flag_id","indonesia"],"🇮🇪":["flag_ie","ireland"],"🇮🇱":["flag_il","israel"],"🇮🇲":["flag_im","isle_of_man"],"🇮🇳":["flag_in","india"],"🇮🇴":["british_indian_ocean_territory","flag_io"],"🇮🇶":["flag_iq","iraq"],"🇮🇷":["flag_ir","iran"],"🇮🇸":["flag_is","iceland"],"🇮🇹":["flag_it","italy"],"🇯🇪":["flag_je","jersey"],"🇯🇲":["flag_jm","jamaica"],"🇯🇴":["flag_jo","jordan"],"🇯🇵":["flag_jp","japan"],"🇰🇪":["flag_ke","kenya"],"🇰🇬":["flag_kg","kyrgyzstan"],"🇰🇭":["cambodia","flag_kh"],"🇰🇮":["flag_ki","kiribati"],"🇰🇲":["comoros","flag_km"],"🇰🇳":["flag_kn","st_kitts_nevis"],"🇰🇵":["flag_kp","north_korea"],"🇰🇷":["flag_kr","south_korea"],"🇰🇼":["flag_kw","kuwait"],"🇰🇾":["cayman_islands","flag_ky"],"🇰🇿":["flag_kz","kazakhstan"],"🇱🇦":["flag_la","laos"],"🇱🇧":["flag_lb","lebanon"],"🇱🇨":["flag_lc","st_lucia"],"🇱🇮":["flag_li","liechtenstein"],"🇱🇰":["flag_lk","sri_lanka"],"🇱🇷":["flag_lr","liberia"],"🇱🇸":["flag_ls","lesotho"],"🇱🇹":["flag_lt","lithuania"],"🇱🇺":["flag_lu","luxembourg"],"🇱🇻":["flag_lv","latvia"],"🇱🇾":["flag_ly","libya"],"🇲🇦":["flag_ma","morocco"],"🇲🇨":["flag_mc","monaco"],"🇲🇩":["flag_md","moldova"],"🇲🇪":["flag_me","montenegro"],"🇲🇫":["flag_mf","st_martin"],"🇲🇬":["flag_mg","madagascar"],"🇲🇭":["flag_mh","marshall_islands"],"🇲🇰":["flag_mk","macedonia"],"🇲🇱":["flag_ml","mali"],"🇲🇲":["burma","flag_mm","myanmar"],"🇲🇳":["flag_mn","mongolia"],"🇲🇴":["flag_mo","macao","macau"],"🇲🇵":["flag_mp","northern_mariana_islands"],"🇲🇶":["flag_mq","martinique"],"🇲🇷":["flag_mr","mauritania"],"🇲🇸":["flag_ms","montserrat"],"🇲🇹":["flag_mt","malta"],"🇲🇺":["flag_mu","mauritius"],"🇲🇻":["flag_mv","maldives"],"🇲🇼":["flag_mw","malawi"],"🇲🇽":["flag_mx","mexico"],"🇲🇾":["flag_my","malaysia"],"🇲🇿":["flag_mz","mozambique"],"🇳🇦":["flag_na","namibia"],"🇳🇨":["flag_nc","new_caledonia"],"🇳🇪":["flag_ne","niger"],"🇳🇫":["flag_nf","norfolk_island"],"🇳🇬":["flag_ng","nigeria"],"🇳🇮":["flag_ni","nicaragua"],"🇳🇱":["flag_nl","netherlands"],"🇳🇴":["flag_no","norway"],"🇳🇵":["flag_np","nepal"],"🇳🇷":["flag_nr","nauru"],"🇳🇺":["flag_nu","niue"],"🇳🇿":["flag_nz","new_zealand"],"🇴🇲":["flag_om","oman"],"🇵🇦":["flag_pa","panama"],"🇵🇪":["flag_pe","peru"],"🇵🇫":["flag_pf","french_polynesia"],"🇵🇬":["flag_pg","papua_new_guinea"],"🇵🇭":["flag_ph","philippines"],"🇵🇰":["flag_pk","pakistan"],"🇵🇱":["flag_pl","poland"],"🇵🇲":["flag_pm","st_pierre_miquelon"],"🇵🇳":["flag_pn","pitcairn_islands"],"🇵🇷":["flag_pr","puerto_rico"],"🇵🇸":["flag_ps","palestinian_territories"],"🇵🇹":["flag_pt","portugal"],"🇵🇼":["flag_pw","palau"],"🇵🇾":["flag_py","paraguay"],"🇶🇦":["flag_qa","qatar"],"🇷🇪":["flag_re","reunion"],"🇷🇴":["flag_ro","romania"],"🇷🇸":["flag_rs","serbia"],"🇷🇺":["flag_ru","russia"],"🇷🇼":["flag_rw","rwanda"],"🇸🇦":["flag_sa","saudi_arabia"],"🇸🇧":["flag_sb","solomon_islands"],"🇸🇨":["flag_sc","seychelles"],"🇸🇩":["flag_sd","sudan"],"🇸🇪":["flag_se","sweden"],"🇸🇬":["flag_sg","singapore"],"🇸🇭":["flag_sh","st_helena"],"🇸🇮":["flag_si","slovenia"],"🇸🇯":["flag_sj","svalbard_jan_mayen"],"🇸🇰":["flag_sk","slovakia"],"🇸🇱":["flag_sl","sierra_leone"],"🇸🇲":["flag_sm","san_marino"],"🇸🇳":["flag_sn","senegal"],"🇸🇴":["flag_so","somalia"],"🇸🇷":["flag_sr","suriname"],"🇸🇸":["flag_ss","south_sudan"],"🇸🇹":["flag_st","sao_tome_principe"],"🇸🇻":["el_salvador","flag_sv"],"🇸🇽":["flag_sx","sint_maarten"],"🇸🇾":["flag_sy","syria"],"🇸🇿":["eswatini","flag_sz","swaziland"],"🇹🇦":["flag_ta","tristan_da_cunha"],"🇹🇨":["flag_tc","turks_caicos_islands"],"🇹🇩":["chad","flag_td"],"🇹🇫":["flag_tf","french_southern_territories"],"🇹🇬":["flag_tg","togo"],"🇹🇭":["flag_th","thailand"],"🇹🇯":["flag_tj","tajikistan"],"🇹🇰":["flag_tk","tokelau"],"🇹🇱":["flag_tl","timor_leste"],"🇹🇲":["flag_tm","turkmenistan"],"🇹🇳":["flag_tn","tunisia"],"🇹🇴":["flag_to","tonga"],"🇹🇷":["flag_tr","turkey_tr"],"🇹🇹":["flag_tt","trinidad_tobago"],"🇹🇻":["flag_tv","tuvalu"],"🇹🇼":["flag_tw","taiwan"],"🇹🇿":["flag_tz","tanzania"],"🇺🇦":["flag_ua","ukraine"],"🇺🇬":["flag_ug","uganda"],"🇺🇲":["flag_um","us_outlying_islands"],"🇺🇳":["flag_un","un","united_nations"],"🇺🇸":["flag_us","united_states","usa"],"🇺🇾":["flag_uy","uruguay"],"🇺🇿":["flag_uz","uzbekistan"],"🇻🇦":["flag_va","vatican_city"],"🇻🇨":["flag_vc","st_vincent_grenadines"],"🇻🇪":["flag_ve","venezuela"],"🇻🇬":["british_virgin_islands","flag_vg"],"🇻🇮":["flag_vi","us_virgin_islands"],"🇻🇳":["flag_vn","vietnam"],"🇻🇺":["flag_vu","vanuatu"],"🇼🇫":["flag_wf","wallis_futuna"],"🇼🇸":["flag_ws","samoa"],"🇽🇰":["flag_xk","kosovo"],"🇾🇪":["flag_ye","yemen"],"🇾🇹":["flag_yt","mayotte"],"🇿🇦":["flag_za","south_africa"],"🇿🇲":["flag_zm","zambia"],"🇿🇼":["flag_zw","zimbabwe"],"🏴󠁧󠁢󠁥󠁮󠁧󠁿":["england","flag_gbeng"],"🏴󠁧󠁢󠁳󠁣󠁴󠁿":["flag_gbsct","scotland"],"🏴󠁧󠁢󠁷󠁬󠁳󠁿":["flag_gbwls","wales"]}')}}]); +//# sourceMappingURL=emojiMap.js.map \ No newline at end of file diff --git a/extensions/emoji/js/dist/forum/emojiMap.js.map b/extensions/emoji/js/dist/forum/emojiMap.js.map new file mode 100644 index 0000000000..978f16a2c5 --- /dev/null +++ b/extensions/emoji/js/dist/forum/emojiMap.js.map @@ -0,0 +1 @@ +{"version":3,"file":"forum/emojiMap.js","mappings":"kJACA,E","sources":["webpack://@flarum/emoji/./src/forum/emojiMap.ts"],"sourcesContent":["import emojiMap from 'simple-emoji-map';\nexport default emojiMap;"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/emoji/js/package.json b/extensions/emoji/js/package.json index e6c4a46270..8eeadf5026 100644 --- a/extensions/emoji/js/package.json +++ b/extensions/emoji/js/package.json @@ -10,7 +10,7 @@ "devDependencies": { "@flarum/prettier-config": "^1.0.0", "flarum-tsconfig": "^1.0.2", - "flarum-webpack-config": "^2.0.0", + "flarum-webpack-config": "^3.0.0", "prettier": "^2.5.1", "typescript": "^4.5.4", "typescript-coverage-report": "^0.6.1", diff --git a/extensions/emoji/js/src/admin/extend.tsx b/extensions/emoji/js/src/admin/extend.tsx new file mode 100644 index 0000000000..1cc78c77df --- /dev/null +++ b/extensions/emoji/js/src/admin/extend.tsx @@ -0,0 +1,14 @@ +import Extend from 'flarum/common/extenders'; +import app from 'flarum/admin/app'; +import { version } from '../common/cdn'; + +export default [ + new Extend.Admin().setting(() => ({ + setting: 'flarum-emoji.cdn', + type: 'text', + label: app.translator.trans('flarum-emoji.admin.settings.cdn_label'), + help: app.translator.trans('flarum-emoji.admin.settings.cdn_help', { + version: version, + }), + })), +]; diff --git a/extensions/emoji/js/src/admin/index.ts b/extensions/emoji/js/src/admin/index.ts new file mode 100644 index 0000000000..d50efdfb9b --- /dev/null +++ b/extensions/emoji/js/src/admin/index.ts @@ -0,0 +1,7 @@ +import app from 'flarum/admin/app'; + +export { default as extend } from './extend'; + +app.initializers.add('flarum-emoji', () => { + // ... +}); diff --git a/extensions/emoji/js/src/common/cdn.js b/extensions/emoji/js/src/common/cdn.js new file mode 100644 index 0000000000..e8b2ec0cf1 --- /dev/null +++ b/extensions/emoji/js/src/common/cdn.js @@ -0,0 +1,7 @@ +import twemoji from 'twemoji'; + +export const version = /([0-9]+).[0-9]+.[0-9]+/g.exec(twemoji.base)[1]; + +export default function () { + return app.forum.attribute('flarum-emoji.cdn').replace('[version]', version); +} diff --git a/extensions/emoji/js/src/forum/addComposerAutocomplete.js b/extensions/emoji/js/src/forum/addComposerAutocomplete.js index 195dc605d0..7d6df93903 100644 --- a/extensions/emoji/js/src/forum/addComposerAutocomplete.js +++ b/extensions/emoji/js/src/forum/addComposerAutocomplete.js @@ -1,44 +1,48 @@ -import emojiMap from 'simple-emoji-map'; - import { extend } from 'flarum/common/extend'; -import TextEditor from 'flarum/common/components/TextEditor'; import TextEditorButton from 'flarum/common/components/TextEditorButton'; import KeyboardNavigatable from 'flarum/common/utils/KeyboardNavigatable'; +import Tooltip from 'flarum/common/components/Tooltip'; +import AutocompleteReader from 'flarum/common/utils/AutocompleteReader'; import AutocompleteDropdown from './fragments/AutocompleteDropdown'; import getEmojiIconCode from './helpers/getEmojiIconCode'; -import cdn from './cdn'; +import cdn from '../common/cdn'; export default function addComposerAutocomplete() { - const emojiKeys = Object.keys(emojiMap); - const $container = $('
'); - const dropdown = new AutocompleteDropdown(); + let emojiMap = null; + + extend('flarum/common/components/TextEditor', 'oninit', function () { + this._loaders.push(async () => await import('./emojiMap').then((m) => (emojiMap = m.default))); + // prettier-ignore + this.commonEmoji = [ + '😀', '😁', '😂', '😃', '😄', '😅', '😆', '😇', '😈', '😉', '😊', '😋', '😌', '😍', '😎', '😏', '😐️', '😑', '😒', + '😓', '😔', '😕', '😖', '😗', '😘', '😙', '😚', '😛', '😜', '😝', '😞', '😟', '😠', '😡', '😢', '😣', '😤', '😥', + '😦', '😧', '😨', '😩', '😪', '😫', '😬', '😭', '😮', '😮‍💨', '😯', '😰', '😱', '😲', '😳', '😴', '😵', '😵‍💫', + '😶', '😶‍🌫️', '😷', '😸', '😹', '😺', '😻', '😼', '😽', '😾', '😿', '🙀', '🙁', '🙂', '🙃', '🙄', + ]; + }); - extend(TextEditor.prototype, 'oncreate', function () { + extend('flarum/common/components/TextEditor', 'onbuild', function () { + this.emojiDropdown = new AutocompleteDropdown(); const $editor = this.$('.TextEditor-editor').wrap('
'); this.navigator = new KeyboardNavigatable(); this.navigator - .when(() => dropdown.active) - .onUp(() => dropdown.navigate(-1)) - .onDown(() => dropdown.navigate(1)) - .onSelect(dropdown.complete.bind(dropdown)) - .onCancel(dropdown.hide.bind(dropdown)) + .when(() => this.emojiDropdown.active) + .onUp(() => this.emojiDropdown.navigate(-1)) + .onDown(() => this.emojiDropdown.navigate(1)) + .onSelect(this.emojiDropdown.complete.bind(this.emojiDropdown)) + .onCancel(this.emojiDropdown.hide.bind(this.emojiDropdown)) .bindTo($editor); - $editor.after($container); + $editor.after($('
')); }); - extend(TextEditor.prototype, 'buildEditorParams', function (params) { - let relEmojiStart; - let absEmojiStart; - let typed; + extend('flarum/common/components/TextEditor', 'buildEditorParams', function (params) { + const emojiKeys = Object.keys(emojiMap); + const resolvedCdn = cdn(); - const applySuggestion = (replacement) => { - this.attrs.composer.editor.replaceBeforeCursor(absEmojiStart - 1, replacement + ' '); - - dropdown.hide(); - }; + const autocompleteReader = new AutocompleteReader(':'); params.inputListeners.push(() => { const selection = this.attrs.composer.editor.getSelectionRange(); @@ -47,42 +51,34 @@ export default function addComposerAutocomplete() { if (selection[1] - cursor > 0) return; - // Search backwards from the cursor for an ':' symbol. If we find - // one and followed by a whitespace, we will want to show the - // autocomplete dropdown! const lastChunk = this.attrs.composer.editor.getLastNChars(15); - absEmojiStart = 0; - for (let i = lastChunk.length - 1; i >= 0; i--) { - const character = lastChunk.substr(i, 1); - // check what user typed, emoji names only contains alphanumeric, - // underline, '+' and '-' - if (!/[a-z0-9]|\+|\-|_|\:/.test(character)) break; - // make sure ':' preceded by a whitespace or newline - if (character === ':' && (i == 0 || /\s/.test(lastChunk.substr(i - 1, 1)))) { - relEmojiStart = i + 1; - absEmojiStart = cursor - lastChunk.length + i + 1; - break; - } - } + const autocompleting = autocompleteReader.check(lastChunk, cursor, /[a-z0-9]|\+|\-|_|\:/); - dropdown.hide(); - dropdown.active = false; + this.emojiDropdown.hide(); + this.emojiDropdown.active = false; - if (absEmojiStart) { - typed = lastChunk.substring(relEmojiStart).toLowerCase(); + if (autocompleting) { + const typed = autocompleting.typed; + const emojiDropdown = this.emojiDropdown; + + const applySuggestion = (replacement) => { + this.attrs.composer.editor.replaceBeforeCursor(autocompleting.absoluteStart - 1, replacement + ' '); + this.emojiDropdown.hide(); + }; const makeSuggestion = function ({ emoji, name, code }) { return ( - + + + ); }; @@ -96,7 +92,7 @@ export default function addComposerAutocomplete() { }; const regTyped = fuzzyRegexp(typed); - let maxSuggestions = 7; + let maxSuggestions = 40; const findMatchingEmojis = (matcher) => { for (let i = 0; i < emojiKeys.length && maxSuggestions > 0; i++) { @@ -105,7 +101,7 @@ export default function addComposerAutocomplete() { if (similarEmoji.indexOf(curEmoji) === -1) { const names = emojiMap[curEmoji]; for (let name of names) { - if (matcher(name)) { + if (matcher(name, curEmoji)) { --maxSuggestions; similarEmoji.push(curEmoji); break; @@ -116,10 +112,17 @@ export default function addComposerAutocomplete() { }; // First, try to find all emojis starting with the given string - findMatchingEmojis((emoji) => emoji.indexOf(typed) === 0); + findMatchingEmojis((emojiName, emoji) => { + // If no input is provided yet, match the most common emojis. + if (!typed) { + return this.commonEmoji?.includes(emoji); + } + + return emojiName.indexOf(typed) === 0; + }); // If there are still suggestions left, try for some fuzzy matches - findMatchingEmojis((emoji) => regTyped.test(emoji)); + findMatchingEmojis((emojiName) => regTyped.test(emojiName)); const suggestions = similarEmoji .map((emoji) => ({ @@ -130,14 +133,14 @@ export default function addComposerAutocomplete() { .map(makeSuggestion); if (suggestions.length) { - dropdown.items = suggestions; - m.render($container[0], dropdown.render()); - - dropdown.show(); - const coordinates = this.attrs.composer.editor.getCaretCoordinates(absEmojiStart); - const width = dropdown.$().outerWidth(); - const height = dropdown.$().outerHeight(); - const parent = dropdown.$().offsetParent(); + this.emojiDropdown.items = suggestions; + m.render(this.$('.ComposerBody-emojiDropdownContainer')[0], this.emojiDropdown.render()); + + this.emojiDropdown.show(); + const coordinates = this.attrs.composer.editor.getCaretCoordinates(autocompleting.absoluteStart); + const width = this.emojiDropdown.$().outerWidth(); + const height = this.emojiDropdown.$().outerHeight(); + const parent = this.emojiDropdown.$().offsetParent(); let left = coordinates.left; let top = coordinates.top + 15; @@ -153,20 +156,20 @@ export default function addComposerAutocomplete() { top = Math.max(-(parent.offset().top - $(document).scrollTop()), top); left = Math.max(-parent.offset().left, left); - dropdown.show(left, top); + this.emojiDropdown.show(left, top); } }; buildSuggestions(); - dropdown.setIndex(0); - dropdown.$().scrollTop(0); - dropdown.active = true; + this.emojiDropdown.setIndex(0); + this.emojiDropdown.$().scrollTop(0); + this.emojiDropdown.active = true; } }); }); - extend(TextEditor.prototype, 'toolbarItems', function (items) { + extend('flarum/common/components/TextEditor', 'toolbarItems', function (items) { items.add( 'emoji', this.attrs.composer.editor.insertAtCursor(' :')} icon="far fa-smile"> diff --git a/extensions/emoji/js/src/forum/cdn.js b/extensions/emoji/js/src/forum/cdn.js deleted file mode 100644 index bba87b58af..0000000000 --- a/extensions/emoji/js/src/forum/cdn.js +++ /dev/null @@ -1,5 +0,0 @@ -import twemoji from 'twemoji'; - -export const version = /([0-9]+).[0-9]+.[0-9]+/g.exec(twemoji.base)[1]; - -export default `https://cdn.jsdelivr.net/gh/twitter/twemoji@${version}/assets/`; diff --git a/extensions/emoji/js/src/forum/emojiMap.ts b/extensions/emoji/js/src/forum/emojiMap.ts new file mode 100644 index 0000000000..25d34d6cb2 --- /dev/null +++ b/extensions/emoji/js/src/forum/emojiMap.ts @@ -0,0 +1,3 @@ +import emojiMap from 'simple-emoji-map'; + +export default emojiMap; diff --git a/extensions/emoji/js/src/forum/renderEmoji.js b/extensions/emoji/js/src/forum/renderEmoji.js index 340f32f4ce..2250edeb82 100644 --- a/extensions/emoji/js/src/forum/renderEmoji.js +++ b/extensions/emoji/js/src/forum/renderEmoji.js @@ -3,14 +3,16 @@ import twemoji from 'twemoji'; import { override } from 'flarum/common/extend'; import Post from 'flarum/common/models/Post'; -import base from './cdn'; - -const options = { - base, - attributes: () => ({ - loading: 'lazy', - }), -}; +import cdn from '../common/cdn'; + +function options() { + return { + base: cdn(), + attributes: () => ({ + loading: 'lazy', + }), + }; +} /** * Parses an HTML string into a `` node containing the HTML content. @@ -40,7 +42,7 @@ export default function renderEmoji() { // element. This gets stripped below. // // See https://github.com/flarum/core/issues/2958 - const emojifiedDom = twemoji.parse(parseHTML(contentHtml), options); + const emojifiedDom = twemoji.parse(parseHTML(contentHtml), options()); // Steal the HTML string inside the emojified DOM `` tag. this.emojifiedContentHtml = emojifiedDom.innerHTML; @@ -54,6 +56,6 @@ export default function renderEmoji() { override(s9e.TextFormatter, 'preview', (original, text, element) => { original(text, element); - twemoji.parse(element, options); + twemoji.parse(element, options()); }); } diff --git a/extensions/emoji/js/tsconfig.json b/extensions/emoji/js/tsconfig.json new file mode 100644 index 0000000000..d7b48770ca --- /dev/null +++ b/extensions/emoji/js/tsconfig.json @@ -0,0 +1,15 @@ +{ + // Use Flarum's tsconfig as a starting point + "extends": "flarum-tsconfig", + // This will match all .ts, .tsx, .d.ts, .js, .jsx files in your `src` folder + // and also tells your Typescript server to read core's global typings for + // access to `dayjs` and `$` in the global namespace. + "include": ["src/**/*", "../../../*/*/js/dist-typings/@types/**/*", "@types/**/*"], + "compilerOptions": { + // This will output typings to `dist-typings` + "declarationDir": "./dist-typings", + "paths": { + "flarum/*": ["../../../framework/core/js/dist-typings/*"] + } + } +} diff --git a/extensions/emoji/less/forum.less b/extensions/emoji/less/forum.less index 8dba0dc475..a74ec1f861 100644 --- a/extensions/emoji/less/forum.less +++ b/extensions/emoji/less/forum.less @@ -7,29 +7,28 @@ img.emoji { .EmojiDropdown { max-width: 500px; max-height: 200px; - overflow: auto; + overflow: visible; position: absolute; - margin: 5px 0 !important; + padding: 8px; - > li > button { - color: @text-color; - font-weight: bold; - padding-top: 6px; - padding-bottom: 6px; - padding-left: 45px; + > li { + display: inline-block; - .emoji { - float: left; - margin-left: -30px; + > button { + color: var(--text-color); + font-weight: bold; + padding: 8px; + border-radius: var(--border-radius); } } - .Dropdown-header { - color: @muted-more-color; + > .Dropdown-header { + display: block; + color: var(--muted-more-color); text-transform: none; font-weight: normal; - padding-bottom: 5px; - font-size: 11px; + padding: 4px 8px; + margin: 0 0 4px 0; } } diff --git a/extensions/emoji/locale/en.yml b/extensions/emoji/locale/en.yml index a7d29de518..9929051e19 100644 --- a/extensions/emoji/locale/en.yml +++ b/extensions/emoji/locale/en.yml @@ -4,6 +4,14 @@ flarum-emoji: # UNIQUE KEYS - The following keys are used in only one location each. ## + # Translations in this namespace are used by the admin interface. + admin: + + # These translations are used in the Settings page of the admin interface. + settings: + cdn_label: CDN mirror address + cdn_help: "e.g. https://cdn.jsdelivr.net/gh/twitter/twemoji@[version]/assets/, The current version is: {version}" + # Translations in this namespace are used by the forum user interface. forum: diff --git a/extensions/flags/.gitignore b/extensions/flags/.gitignore index 4ebb168a05..e60e512061 100644 --- a/extensions/flags/.gitignore +++ b/extensions/flags/.gitignore @@ -4,6 +4,7 @@ composer.phar .DS_Store Thumbs.db +tests/.phpunit.cache tests/.phpunit.result.cache /tests/integration/tmp .vagrant diff --git a/extensions/flags/LICENSE b/extensions/flags/LICENSE index 54ac29ab2c..bb6e15d87e 100644 --- a/extensions/flags/LICENSE +++ b/extensions/flags/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019-2021 Stichting Flarum (Flarum Foundation) +Copyright (c) 2019-2024 Stichting Flarum (Flarum Foundation) Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/extensions/flags/extend.php b/extensions/flags/extend.php index 3bc6db108c..b9245096ff 100644 --- a/extensions/flags/extend.php +++ b/extensions/flags/extend.php @@ -7,25 +7,17 @@ * LICENSE file that was distributed with this source code. */ -use Flarum\Api\Controller\AbstractSerializeController; -use Flarum\Api\Controller\ListPostsController; -use Flarum\Api\Controller\ShowDiscussionController; -use Flarum\Api\Controller\ShowPostController; -use Flarum\Api\Serializer\CurrentUserSerializer; -use Flarum\Api\Serializer\ForumSerializer; -use Flarum\Api\Serializer\PostSerializer; +use Flarum\Api\Endpoint; +use Flarum\Api\Resource; use Flarum\Extend; use Flarum\Flags\Access\ScopeFlagVisibility; -use Flarum\Flags\AddCanFlagAttribute; -use Flarum\Flags\AddFlagsApiAttributes; -use Flarum\Flags\AddNewFlagCountAttribute; -use Flarum\Flags\Api\Controller\CreateFlagController; use Flarum\Flags\Api\Controller\DeleteFlagsController; -use Flarum\Flags\Api\Controller\ListFlagsController; -use Flarum\Flags\Api\Serializer\FlagSerializer; +use Flarum\Flags\Api\ForumResourceFields; +use Flarum\Flags\Api\PostResourceFields; +use Flarum\Flags\Api\Resource\FlagResource; +use Flarum\Flags\Api\UserResourceFields; use Flarum\Flags\Flag; use Flarum\Flags\Listener; -use Flarum\Flags\PrepareFlagsApiData; use Flarum\Forum\Content\AssertRegistered; use Flarum\Post\Event\Deleted; use Flarum\Post\Post; @@ -41,8 +33,6 @@ ->js(__DIR__.'/js/dist/admin.js'), (new Extend\Routes('api')) - ->get('/flags', 'flags.index', ListFlagsController::class) - ->post('/flags', 'flags.create', CreateFlagController::class) ->delete('/posts/{id}/flags', 'flags.delete', DeleteFlagsController::class), (new Extend\Model(User::class)) @@ -51,27 +41,21 @@ (new Extend\Model(Post::class)) ->hasMany('flags', Flag::class, 'post_id'), - (new Extend\ApiSerializer(PostSerializer::class)) - ->hasMany('flags', FlagSerializer::class) - ->attribute('canFlag', AddCanFlagAttribute::class), + new Extend\ApiResource(FlagResource::class), - (new Extend\ApiSerializer(CurrentUserSerializer::class)) - ->attribute('newFlagCount', AddNewFlagCountAttribute::class), + (new Extend\ApiResource(Resource\PostResource::class)) + ->fields(PostResourceFields::class), - (new Extend\ApiSerializer(ForumSerializer::class)) - ->attributes(AddFlagsApiAttributes::class), + (new Extend\ApiResource(Resource\UserResource::class)) + ->fields(UserResourceFields::class), - (new Extend\ApiController(ShowDiscussionController::class)) - ->addInclude(['posts.flags', 'posts.flags.user']), + (new Extend\ApiResource(Resource\ForumResource::class)) + ->fields(ForumResourceFields::class), - (new Extend\ApiController(ListPostsController::class)) - ->addInclude(['flags', 'flags.user']), - - (new Extend\ApiController(ShowPostController::class)) - ->addInclude(['flags', 'flags.user']), - - (new Extend\ApiController(AbstractSerializeController::class)) - ->prepareDataForSerialization(PrepareFlagsApiData::class), + (new Extend\ApiResource(Resource\PostResource::class)) + ->endpoint([Endpoint\Index::class, Endpoint\Show::class], function (Endpoint\Index|Endpoint\Show $endpoint) { + return $endpoint->addDefaultInclude(['flags', 'flags.user']); + }), (new Extend\Settings()) ->serializeToForum('guidelinesUrl', 'flarum-flags.guidelines_url'), diff --git a/extensions/flags/js/dist-typings/admin/extend.d.ts b/extensions/flags/js/dist-typings/admin/extend.d.ts new file mode 100644 index 0000000000..4c1b0a6159 --- /dev/null +++ b/extensions/flags/js/dist-typings/admin/extend.d.ts @@ -0,0 +1,2 @@ +declare const _default: import("flarum/common/extenders/Admin").default[]; +export default _default; diff --git a/extensions/flags/js/dist-typings/admin/index.d.ts b/extensions/flags/js/dist-typings/admin/index.d.ts index cb0ff5c3b5..6d2293da0b 100644 --- a/extensions/flags/js/dist-typings/admin/index.d.ts +++ b/extensions/flags/js/dist-typings/admin/index.d.ts @@ -1 +1 @@ -export {}; +export { default as extend } from './extend'; diff --git a/extensions/flags/js/dist-typings/forum/compat.d.ts b/extensions/flags/js/dist-typings/forum/compat.d.ts deleted file mode 100644 index f092096afe..0000000000 --- a/extensions/flags/js/dist-typings/forum/compat.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -declare const _default: { - 'flags/addFlagsToPosts': typeof addFlagsToPosts; - 'flags/addFlagControl': typeof addFlagControl; - 'flags/addFlagsDropdown': typeof addFlagsDropdown; - 'flags/models/Flag': typeof Flag; - 'flags/components/FlagList': typeof FlagList; - 'flags/components/FlagPostModal': typeof FlagPostModal; - 'flags/components/FlagsPage': typeof FlagsPage; - 'flags/components/FlagsDropdown': typeof FlagsDropdown; -}; -export default _default; -import addFlagsToPosts from "./addFlagsToPosts"; -import addFlagControl from "./addFlagControl"; -import addFlagsDropdown from "./addFlagsDropdown"; -import Flag from "./models/Flag"; -import FlagList from "./components/FlagList"; -import FlagPostModal from "./components/FlagPostModal"; -import FlagsPage from "./components/FlagsPage"; -import FlagsDropdown from "./components/FlagsDropdown"; diff --git a/extensions/flags/js/dist-typings/forum/components/FlagList.d.ts b/extensions/flags/js/dist-typings/forum/components/FlagList.d.ts index e79c0a961f..32022c0606 100644 --- a/extensions/flags/js/dist-typings/forum/components/FlagList.d.ts +++ b/extensions/flags/js/dist-typings/forum/components/FlagList.d.ts @@ -1,7 +1,14 @@ -export default class FlagList extends Component { - constructor(); - oninit(vnode: any): void; - state: any; +import Component from 'flarum/common/Component'; +import type { ComponentAttrs } from 'flarum/common/Component'; +import type Mithril from 'mithril'; +import type FlagListState from '../states/FlagListState'; +import ItemList from 'flarum/common/utils/ItemList'; +export interface IFlagListAttrs extends ComponentAttrs { + state: FlagListState; +} +export default class FlagList extends Component { + oninit(vnode: Mithril.Vnode): void; view(): JSX.Element; + controlItems(): ItemList; + content(state: FlagListState): JSX.Element[][] | null; } -import Component from "flarum/common/Component"; diff --git a/extensions/flags/js/dist-typings/forum/components/FlagPostModal.d.ts b/extensions/flags/js/dist-typings/forum/components/FlagPostModal.d.ts index 083a2ef245..023f0916c2 100644 --- a/extensions/flags/js/dist-typings/forum/components/FlagPostModal.d.ts +++ b/extensions/flags/js/dist-typings/forum/components/FlagPostModal.d.ts @@ -1,15 +1,14 @@ -/// -export default class FlagPostModal extends Modal { +export default class FlagPostModal extends FormModal { constructor(); oninit(vnode: any): void; success: boolean | undefined; reason: Stream | undefined; reasonDetail: Stream | undefined; - title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + title(): string | any[]; content(): JSX.Element; flagReasons(): ItemList; onsubmit(e: any): void; } -import Modal from "flarum/common/components/Modal"; +import FormModal from "flarum/common/components/FormModal"; import Stream from "flarum/common/utils/Stream"; import ItemList from "flarum/common/utils/ItemList"; diff --git a/extensions/flags/js/dist-typings/forum/components/FlagsDropdown.d.ts b/extensions/flags/js/dist-typings/forum/components/FlagsDropdown.d.ts index 15f614f791..dc18ba871b 100644 --- a/extensions/flags/js/dist-typings/forum/components/FlagsDropdown.d.ts +++ b/extensions/flags/js/dist-typings/forum/components/FlagsDropdown.d.ts @@ -1,7 +1,12 @@ -export default class FlagsDropdown extends NotificationsDropdown { - static initAttrs(attrs: any): void; - constructor(); - getUnreadCount(): any; - getNewCount(): unknown; +/// +import HeaderDropdown from 'flarum/forum/components/HeaderDropdown'; +import type { IHeaderDropdownAttrs } from 'flarum/forum/components/HeaderDropdown'; +export interface IFlagsDropdownAttrs extends IHeaderDropdownAttrs { +} +export default class FlagsDropdown extends HeaderDropdown { + static initAttrs(attrs: IFlagsDropdownAttrs): void; + getContent(): JSX.Element; + goToRoute(): void; + getUnreadCount(): number; + getNewCount(): number; } -import NotificationsDropdown from "flarum/forum/components/NotificationsDropdown"; diff --git a/extensions/flags/js/dist-typings/forum/components/FlagsPage.d.ts b/extensions/flags/js/dist-typings/forum/components/FlagsPage.d.ts index b9521b27e1..3415993d6c 100644 --- a/extensions/flags/js/dist-typings/forum/components/FlagsPage.d.ts +++ b/extensions/flags/js/dist-typings/forum/components/FlagsPage.d.ts @@ -2,8 +2,9 @@ * The `FlagsPage` component shows the flags list. It is only * used on mobile devices where the flags dropdown is within the drawer. */ -export default class FlagsPage { +export default class FlagsPage extends Page { + constructor(); oninit(vnode: any): void; - bodyClass: string | undefined; view(): JSX.Element; } +import Page from "flarum/common/components/Page"; diff --git a/extensions/flags/js/dist-typings/forum/extend.d.ts b/extensions/flags/js/dist-typings/forum/extend.d.ts index 28e9d3b2fe..25835b4db0 100644 --- a/extensions/flags/js/dist-typings/forum/extend.d.ts +++ b/extensions/flags/js/dist-typings/forum/extend.d.ts @@ -1,2 +1,2 @@ -declare const _default: (import("flarum/common/extenders/Model").default | import("flarum/common/extenders/Routes").default | import("flarum/common/extenders/Store").default)[]; +declare const _default: (import("flarum/common/extenders/Routes").default | import("flarum/common/extenders/Store").default | import("flarum/common/extenders/Model").default)[]; export default _default; diff --git a/extensions/flags/js/dist-typings/forum/forum.d.ts b/extensions/flags/js/dist-typings/forum/forum.d.ts new file mode 100644 index 0000000000..62959aa09e --- /dev/null +++ b/extensions/flags/js/dist-typings/forum/forum.d.ts @@ -0,0 +1,8 @@ +import './addFlagsToPosts'; +import './addFlagControl'; +import './addFlagsDropdown'; +import './models/Flag'; +import './components/FlagList'; +import './components/FlagPostModal'; +import './components/FlagsPage'; +import './components/FlagsDropdown'; diff --git a/extensions/flags/js/dist-typings/forum/index.d.ts b/extensions/flags/js/dist-typings/forum/index.d.ts index 6d2293da0b..c92498005b 100644 --- a/extensions/flags/js/dist-typings/forum/index.d.ts +++ b/extensions/flags/js/dist-typings/forum/index.d.ts @@ -1 +1,2 @@ export { default as extend } from './extend'; +import './forum'; diff --git a/extensions/flags/js/dist-typings/forum/states/FlagListState.d.ts b/extensions/flags/js/dist-typings/forum/states/FlagListState.d.ts index a15e963a75..3a22d9586c 100644 --- a/extensions/flags/js/dist-typings/forum/states/FlagListState.d.ts +++ b/extensions/flags/js/dist-typings/forum/states/FlagListState.d.ts @@ -1,16 +1,13 @@ -export default class FlagListState { - constructor(app: any); - app: any; - /** - * Whether or not the flags are loading. - * - * @type {Boolean} - */ - loading: boolean; +import type ForumApplication from 'flarum/forum/ForumApplication'; +import type Flag from '../models/Flag'; +import PaginatedListState from 'flarum/common/states/PaginatedListState'; +export default class FlagListState extends PaginatedListState { + app: ForumApplication; + constructor(app: ForumApplication); + get type(): string; /** * Load flags into the application's cache if they haven't already * been loaded. */ - load(): void; - cache: any; + load(): Promise; } diff --git a/extensions/flags/js/dist/admin.js b/extensions/flags/js/dist/admin.js index 16505153b4..6ca6314c9a 100644 --- a/extensions/flags/js/dist/admin.js +++ b/extensions/flags/js/dist/admin.js @@ -1,2 +1,2 @@ -(()=>{var e={n:a=>{var s=a&&a.__esModule?()=>a.default:()=>a;return e.d(s,{a:s}),s},d:(a,s)=>{for(var l in s)e.o(s,l)&&!e.o(a,l)&&Object.defineProperty(a,l,{enumerable:!0,get:s[l]})},o:(e,a)=>Object.prototype.hasOwnProperty.call(e,a),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},a={};(()=>{"use strict";e.r(a);const s=flarum.core.compat["admin/app"];var l=e.n(s);l().initializers.add("flarum-flags",(()=>{l().extensionData.for("flarum-flags").registerSetting({setting:"flarum-flags.guidelines_url",type:"text",label:l().translator.trans("flarum-flags.admin.settings.guidelines_url_label")},15).registerSetting({setting:"flarum-flags.can_flag_own",type:"boolean",label:l().translator.trans("flarum-flags.admin.settings.flag_own_posts_label")}).registerPermission({icon:"fas fa-flag",label:l().translator.trans("flarum-flags.admin.permissions.view_flags_label"),permission:"discussion.viewFlags"},"moderate",65).registerPermission({icon:"fas fa-flag",label:l().translator.trans("flarum-flags.admin.permissions.flag_posts_label"),permission:"discussion.flagPosts"},"reply",65)}))})(),module.exports=a})(); +(()=>{var e={n:a=>{var s=a&&a.__esModule?()=>a.default:()=>a;return e.d(s,{a:s}),s},d:(a,s)=>{for(var l in s)e.o(s,l)&&!e.o(a,l)&&Object.defineProperty(a,l,{enumerable:!0,get:s[l]})},o:(e,a)=>Object.prototype.hasOwnProperty.call(e,a),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},a={};(()=>{"use strict";e.r(a),e.d(a,{extend:()=>t});const s=flarum.reg.get("core","admin/app");var l=e.n(s);const r=flarum.reg.get("core","common/extenders"),t=[(new(e.n(r)().Admin)).setting((()=>({setting:"flarum-flags.guidelines_url",type:"text",label:l().translator.trans("flarum-flags.admin.settings.guidelines_url_label")})),15).setting((()=>({setting:"flarum-flags.can_flag_own",type:"boolean",label:l().translator.trans("flarum-flags.admin.settings.flag_own_posts_label")}))).permission((()=>({icon:"fas fa-flag",label:l().translator.trans("flarum-flags.admin.permissions.view_flags_label"),permission:"discussion.viewFlags"})),"moderate",65).permission((()=>({icon:"fas fa-flag",label:l().translator.trans("flarum-flags.admin.permissions.flag_posts_label"),permission:"discussion.flagPosts"})),"reply",65)];l().initializers.add("flarum-flags",(()=>{}))})(),module.exports=a})(); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/extensions/flags/js/dist/admin.js.map b/extensions/flags/js/dist/admin.js.map index ee521ae77e..b177395f91 100644 --- a/extensions/flags/js/dist/admin.js.map +++ b/extensions/flags/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCExDC,IAAAA,aAAAA,IAAqB,gBAAgB,KACnCA,IAAAA,cAAAA,IACO,gBACJC,gBACC,CACEC,QAAS,8BACTC,KAAM,OACNC,MAAOJ,IAAAA,WAAAA,MAAqB,qDAE9B,IAEDC,gBAAgB,CACfC,QAAS,4BACTC,KAAM,UACNC,MAAOJ,IAAAA,WAAAA,MAAqB,sDAE7BK,mBACC,CACEC,KAAM,cACNF,MAAOJ,IAAAA,WAAAA,MAAqB,mDAC5BO,WAAY,wBAEd,WACA,IAGDF,mBACC,CACEC,KAAM,cACNF,MAAOJ,IAAAA,WAAAA,MAAqB,mDAC5BO,WAAY,wBAEd,QACA,GACD,G","sources":["webpack://@flarum/flags/webpack/bootstrap","webpack://@flarum/flags/webpack/runtime/compat get default export","webpack://@flarum/flags/webpack/runtime/define property getters","webpack://@flarum/flags/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/flags/webpack/runtime/make namespace object","webpack://@flarum/flags/external root \"flarum.core.compat['admin/app']\"","webpack://@flarum/flags/./src/admin/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","import app from 'flarum/admin/app';\n\napp.initializers.add('flarum-flags', () => {\n app.extensionData\n .for('flarum-flags')\n .registerSetting(\n {\n setting: 'flarum-flags.guidelines_url',\n type: 'text',\n label: app.translator.trans('flarum-flags.admin.settings.guidelines_url_label'),\n },\n 15\n )\n .registerSetting({\n setting: 'flarum-flags.can_flag_own',\n type: 'boolean',\n label: app.translator.trans('flarum-flags.admin.settings.flag_own_posts_label'),\n })\n .registerPermission(\n {\n icon: 'fas fa-flag',\n label: app.translator.trans('flarum-flags.admin.permissions.view_flags_label'),\n permission: 'discussion.viewFlags',\n },\n 'moderate',\n 65\n )\n\n .registerPermission(\n {\n icon: 'fas fa-flag',\n label: app.translator.trans('flarum-flags.admin.permissions.flag_posts_label'),\n permission: 'discussion.flagPosts',\n },\n 'reply',\n 65\n );\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","registerSetting","setting","type","label","registerPermission","icon","permission"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,qDCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,oBCE5D,IAAgB,I,MAAI,WAAeW,SAAQ,KAAM,CAC/CA,QAAS,8BACTC,KAAM,OACNC,MAAO,eAAeC,MAAM,uDAC1B,IAAIH,SAAQ,KAAM,CACpBA,QAAS,4BACTC,KAAM,UACNC,MAAO,eAAeC,MAAM,wDAC1BC,YAAW,KAAM,CACnBC,KAAM,cACNH,MAAO,eAAeC,MAAM,mDAC5BC,WAAY,0BACV,WAAY,IAAIA,YAAW,KAAM,CACnCC,KAAM,cACNH,MAAO,eAAeC,MAAM,mDAC5BC,WAAY,0BACV,QAAS,KChBb,iBAAiBE,IAAI,gBAAgB,Q","sources":["webpack://@flarum/flags/webpack/bootstrap","webpack://@flarum/flags/webpack/runtime/compat get default export","webpack://@flarum/flags/webpack/runtime/define property getters","webpack://@flarum/flags/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/flags/webpack/runtime/make namespace object","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'admin/app')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/flags/./src/admin/extend.tsx","webpack://@flarum/flags/./src/admin/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'admin/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","import Extend from 'flarum/common/extenders';\nimport app from 'flarum/admin/app';\nexport default [new Extend.Admin().setting(() => ({\n setting: 'flarum-flags.guidelines_url',\n type: 'text',\n label: app.translator.trans('flarum-flags.admin.settings.guidelines_url_label')\n}), 15).setting(() => ({\n setting: 'flarum-flags.can_flag_own',\n type: 'boolean',\n label: app.translator.trans('flarum-flags.admin.settings.flag_own_posts_label')\n})).permission(() => ({\n icon: 'fas fa-flag',\n label: app.translator.trans('flarum-flags.admin.permissions.view_flags_label'),\n permission: 'discussion.viewFlags'\n}), 'moderate', 65).permission(() => ({\n icon: 'fas fa-flag',\n label: app.translator.trans('flarum-flags.admin.permissions.flag_posts_label'),\n permission: 'discussion.flagPosts'\n}), 'reply', 65)];","import app from 'flarum/admin/app';\nexport { default as extend } from './extend';\napp.initializers.add('flarum-flags', () => {\n // ...\n});"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","reg","setting","type","label","trans","permission","icon","add"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/flags/js/dist/forum.js b/extensions/flags/js/dist/forum.js index cc516f0f3d..ed9dcb89ef 100644 --- a/extensions/flags/js/dist/forum.js +++ b/extensions/flags/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var t={n:a=>{var s=a&&a.__esModule?()=>a.default:()=>a;return t.d(s,{a:s}),s},d:(a,s)=>{for(var o in s)t.o(s,o)&&!t.o(a,o)&&Object.defineProperty(a,o,{enumerable:!0,get:s[o]})},o:(t,a)=>Object.prototype.hasOwnProperty.call(t,a),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},a={};(()=>{"use strict";t.r(a),t.d(a,{extend:()=>ot});const s=flarum.core.compat["forum/app"];var o=t.n(s);class e{constructor(t){this.app=t,this.loading=!1}load(){this.cache&&!this.app.session.user.attribute("newFlagCount")||(this.loading=!0,m.redraw(),this.app.store.find("flags").then((t=>{this.app.session.user.pushAttributes({newFlagCount:0}),this.cache=t.sort(((t,a)=>a.createdAt()-t.createdAt()))})).catch((()=>{})).then((()=>{this.loading=!1,m.redraw()})))}}const r=flarum.core.compat["common/extend"],n=flarum.core.compat["forum/utils/PostControls"];var l=t.n(n);const i=flarum.core.compat["common/components/Button"];var c=t.n(i);const u=flarum.core.compat["common/components/Modal"];var f=t.n(u);const p=flarum.core.compat["common/utils/Stream"];var d=t.n(p);const g=flarum.core.compat["common/utils/withAttr"];var h=t.n(g);const v=flarum.core.compat["common/utils/ItemList"];var _=t.n(v);class b extends(f()){oninit(t){super.oninit(t),this.success=!1,this.reason=d()(""),this.reasonDetail=d()("")}className(){return"FlagPostModal Modal--medium"}title(){return o().translator.trans("flarum-flags.forum.flag_post.title")}content(){return this.success?m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("p",{className:"helpText"},o().translator.trans("flarum-flags.forum.flag_post.confirmation_message")),m("div",{className:"Form-group"},m(c(),{className:"Button Button--primary Button--block",onclick:this.hide.bind(this)},o().translator.trans("flarum-flags.forum.flag_post.dismiss_button"))))):m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("div",{className:"Form-group"},m("div",null,this.flagReasons().toArray())),m("div",{className:"Form-group"},m(c(),{className:"Button Button--primary Button--block",type:"submit",loading:this.loading,disabled:!this.reason()},o().translator.trans("flarum-flags.forum.flag_post.submit_button")))))}flagReasons(){const t=new(_()),a=o().forum.attribute("guidelinesUrl");return t.add("off-topic",m("label",{className:"checkbox"},m("input",{type:"radio",name:"reason",checked:"off_topic"===this.reason(),value:"off_topic",onclick:h()("value",this.reason)}),m("strong",null,o().translator.trans("flarum-flags.forum.flag_post.reason_off_topic_label")),o().translator.trans("flarum-flags.forum.flag_post.reason_off_topic_text"),"off_topic"===this.reason()&&m("textarea",{className:"FormControl",placeholder:o().translator.trans("flarum-flags.forum.flag_post.reason_details_placeholder"),value:this.reasonDetail(),oninput:h()("value",this.reasonDetail)})),70),t.add("inappropriate",m("label",{className:"checkbox"},m("input",{type:"radio",name:"reason",checked:"inappropriate"===this.reason(),value:"inappropriate",onclick:h()("value",this.reason)}),m("strong",null,o().translator.trans("flarum-flags.forum.flag_post.reason_inappropriate_label")),o().translator.trans("flarum-flags.forum.flag_post.reason_inappropriate_text",{a:a?m("a",{href:a,target:"_blank"}):void 0}),"inappropriate"===this.reason()&&m("textarea",{className:"FormControl",placeholder:o().translator.trans("flarum-flags.forum.flag_post.reason_details_placeholder"),value:this.reasonDetail(),oninput:h()("value",this.reasonDetail)})),60),t.add("spam",m("label",{className:"checkbox"},m("input",{type:"radio",name:"reason",checked:"spam"===this.reason(),value:"spam",onclick:h()("value",this.reason)}),m("strong",null,o().translator.trans("flarum-flags.forum.flag_post.reason_spam_label")),o().translator.trans("flarum-flags.forum.flag_post.reason_spam_text"),"spam"===this.reason()&&m("textarea",{className:"FormControl",placeholder:o().translator.trans("flarum-flags.forum.flag_post.reason_details_placeholder"),value:this.reasonDetail(),oninput:h()("value",this.reasonDetail)})),50),t.add("other",m("label",{className:"checkbox"},m("input",{type:"radio",name:"reason",checked:"other"===this.reason(),value:"other",onclick:h()("value",this.reason)}),m("strong",null,o().translator.trans("flarum-flags.forum.flag_post.reason_other_label")),"other"===this.reason()&&m("textarea",{className:"FormControl",value:this.reasonDetail(),oninput:h()("value",this.reasonDetail)})),10),t}onsubmit(t){t.preventDefault(),this.loading=!0,o().store.createRecord("flags").save({reason:"other"===this.reason()?null:this.reason(),reasonDetail:this.reasonDetail(),relationships:{user:o().session.user,post:this.attrs.post}},{errorHandler:this.onerror.bind(this)}).then((()=>this.success=!0)).catch((()=>{})).then(this.loaded.bind(this))}}function N(){(0,r.extend)(l(),"userControls",(function(t,a){!a.isHidden()&&"comment"===a.contentType()&&a.canFlag()&&t.add("flag",m(c(),{icon:"fas fa-flag",onclick:()=>o().modal.show(b,{post:a})},o().translator.trans("flarum-flags.forum.post_controls.flag_button")))}))}const y=flarum.core.compat["forum/components/HeaderSecondary"];var x=t.n(y);const F=flarum.core.compat["forum/components/NotificationsDropdown"];var k=t.n(F);const w=flarum.core.compat["common/Component"];var C=t.n(w);const D=flarum.core.compat["common/components/Link"];var P=t.n(D);const A=flarum.core.compat["common/components/LoadingIndicator"];var M=t.n(A);const L=flarum.core.compat["common/helpers/avatar"];var B=t.n(L);const O=flarum.core.compat["common/helpers/username"];var T=t.n(O);const S=flarum.core.compat["common/helpers/icon"];var R=t.n(S);const j=flarum.core.compat["common/helpers/humanTime"];var E=t.n(j);class I extends(C()){oninit(t){super.oninit(t),this.state=this.attrs.state}view(){const t=this.state.cache||[];return m("div",{className:"NotificationList FlagList"},m("div",{className:"NotificationList-header"},m("h4",{className:"App-titleControl App-titleControl--text"},o().translator.trans("flarum-flags.forum.flagged_posts.title"))),m("div",{className:"NotificationList-content"},m("ul",{className:"NotificationGroup-content"},t.length?t.map((t=>{const a=t.post();return m("li",null,m(P(),{href:o().route.post(a),className:"Notification Flag",onclick:t=>{o().flags.index=a,t.redraw=!1}},B()(a.user()),R()("fas fa-flag",{className:"Notification-icon"}),m("span",{className:"Notification-content"},o().translator.trans("flarum-flags.forum.flagged_posts.item_text",{username:T()(a.user()),em:m("em",null),discussion:a.discussion().title()})),E()(t.createdAt()),m("div",{className:"Notification-excerpt"},a.contentPlain())))})):this.state.loading?m(M(),{className:"LoadingIndicator--block"}):m("div",{className:"NotificationList-empty"},o().translator.trans("flarum-flags.forum.flagged_posts.empty_text")))))}}class H extends(k()){static initAttrs(t){t.label=t.label||o().translator.trans("flarum-flags.forum.flagged_posts.tooltip"),t.icon=t.icon||"fas fa-flag",super.initAttrs(t)}getMenu(){return m("div",{className:"Dropdown-menu "+this.attrs.menuClassName,onclick:this.menuClick.bind(this)},this.showing&&m(I,{state:this.attrs.state}))}goToRoute(){m.route.set(o().route("flags"))}getUnreadCount(){return o().flags.cache?o().flags.cache.length:o().forum.attribute("flagCount")}getNewCount(){return o().session.user.attribute("newFlagCount")}}function U(){(0,r.extend)(x().prototype,"items",(function(t){o().forum.attribute("canViewFlags")&&t.add("flags",m(H,{state:o().flags}),15)}))}const G=flarum.core.compat["forum/components/Post"];var q=t.n(G);const z=flarum.core.compat["common/utils/humanTime"];var V=t.n(z);function J(){(0,r.extend)(q().prototype,"elementAttrs",(function(t){this.attrs.post.flags().length&&(t.className+=" Post--flagged")})),q().prototype.dismissFlag=function(t){const a=this.attrs.post;return delete a.data.relationships.flags,this.subtree.invalidate(),o().flags.cache&&o().flags.cache.some(((t,s)=>{if(t.post()===a){if(o().flags.cache.splice(s,1),o().flags.index===a){let t=o().flags.cache[s];if(t||(t=o().flags.cache[0]),t){const a=t.post();o().flags.index=a,m.route.set(o().route.post(a))}}return!0}})),o().request({url:o().forum.attribute("apiUrl")+a.apiEndpoint()+"/flags",method:"DELETE",body:t})},q().prototype.flagActionItems=function(){const t=new(_()),a=l().destructiveControls(this.attrs.post);return Object.keys(a.items).forEach((t=>{const s=a.get(t).attrs;s.className="Button",(0,r.extend)(s,"onclick",(()=>this.dismissFlag()))})),t.add("controls",m("div",{className:"ButtonGroup"},a.toArray())),t.add("dismiss",m(c(),{className:"Button",icon:"far fa-eye-slash",onclick:this.dismissFlag.bind(this)},o().translator.trans("flarum-flags.forum.post.dismiss_flag_button")),-100),t},(0,r.extend)(q().prototype,"content",(function(t){const a=this.attrs.post,s=a.flags();s.length&&(a.isHidden()&&(this.revealContent=!0),t.unshift(m("div",{className:"Post-flagged"},m("div",{className:"Post-flagged-flags"},s.map((t=>m("div",{className:"Post-flagged-flag"},this.flagReason(t))))),m("div",{className:"Post-flagged-actions"},this.flagActionItems().toArray()))))})),q().prototype.flagReason=function(t){if("user"===t.type()){const a=t.user(),s=t.reason()?o().translator.trans("flarum-flags.forum.flag_post.reason_".concat(t.reason(),"_label")):null,e=t.reasonDetail(),r=V()(t.createdAt());return[o().translator.trans(s?"flarum-flags.forum.post.flagged_by_with_reason_text":"flarum-flags.forum.post.flagged_by_text",{time:r,user:a,reason:s}),!!e&&m("span",{className:"Post-flagged-detail"},e)]}}}const K=flarum.core.compat["common/extenders"];var Q=t.n(K);const W=flarum.core.compat["common/models/Post"];var X=t.n(W);const Y=flarum.core.compat["components/Page"];var Z=t.n(Y);class $ extends(Z()){oninit(t){super.oninit(t),o().history.push("flags"),o().flags.load(),this.bodyClass="App--flags"}view(){return m("div",{className:"FlagsPage"},m(I,{state:o().flags}))}}const tt=flarum.core.compat["common/Model"];var at=t.n(tt);class st extends(at()){type(){return at().attribute("type").call(this)}reason(){return at().attribute("reason").call(this)}reasonDetail(){return at().attribute("reasonDetail").call(this)}createdAt(){return at().attribute("createdAt",at().transformDate).call(this)}post(){return at().hasOne("post").call(this)}user(){return at().hasOne("user").call(this)}}const ot=[(new(Q().Routes)).add("flags","/flags",$),(new(Q().Store)).add("flags",st),new(Q().Model)(X()).hasMany("flags").attribute("canFlag")],et={"flags/addFlagsToPosts":J,"flags/addFlagControl":N,"flags/addFlagsDropdown":U,"flags/models/Flag":st,"flags/components/FlagList":I,"flags/components/FlagPostModal":b,"flags/components/FlagsPage":$,"flags/components/FlagsDropdown":H},rt=flarum.core;o().initializers.add("flarum-flags",(()=>{o().flags=new e(o()),N(),U(),J()})),Object.assign(rt.compat,et)})(),module.exports=a})(); +(()=>{var t={n:a=>{var e=a&&a.__esModule?()=>a.default:()=>a;return t.d(e,{a:e}),e},d:(a,e)=>{for(var s in e)t.o(e,s)&&!t.o(a,s)&&Object.defineProperty(a,s,{enumerable:!0,get:e[s]})},o:(t,a)=>Object.prototype.hasOwnProperty.call(t,a),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},a={};(()=>{"use strict";t.r(a),t.d(a,{extend:()=>st});const e=flarum.reg.get("core","forum/app");var s=t.n(e);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}const o=flarum.reg.get("core","common/states/PaginatedListState");var n=t.n(o);class l extends(n()){constructor(t){var a,e,s;super({},1,null),a=this,s=void 0,(e=function(t){var a=function(t){if("object"!=r(t)||!t)return t;var a=t[Symbol.toPrimitive];if(void 0!==a){var e=a.call(t,"string");if("object"!=r(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(a)?a:a+""}(e="app"))in a?Object.defineProperty(a,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):a[e]=s,this.app=t}get type(){return"flags"}load(){return this.app.session.user?.attribute("newFlagCount")&&(this.pages=[],this.location={page:1}),this.pages.length>0?Promise.resolve():super.loadNext()}}flarum.reg.add("flarum-flags","forum/states/FlagListState",l);const i=flarum.reg.get("core","common/extend"),u=flarum.reg.get("core","forum/utils/PostControls");var c=t.n(u);const f=flarum.reg.get("core","common/components/Button");var g=t.n(f);const d=flarum.reg.get("core","common/components/FormModal");var p=t.n(d);const h=flarum.reg.get("core","common/components/Form");var v=t.n(h);const b=flarum.reg.get("core","common/utils/Stream");var _=t.n(b);const y=flarum.reg.get("core","common/utils/withAttr");var N=t.n(y);const x=flarum.reg.get("core","common/utils/ItemList");var F=t.n(x);class P extends(p()){oninit(t){super.oninit(t),this.success=!1,this.reason=_()(""),this.reasonDetail=_()("")}className(){return"FlagPostModal Modal--medium"}title(){return s().translator.trans("flarum-flags.forum.flag_post.title")}content(){return this.success?m("div",{className:"Modal-body"},m(v(),{className:"Form--centered"},m("p",{className:"helpText"},s().translator.trans("flarum-flags.forum.flag_post.confirmation_message")),m("div",{className:"Form-group Form-controls"},m(g(),{className:"Button Button--primary Button--block",onclick:this.hide.bind(this)},s().translator.trans("flarum-flags.forum.flag_post.dismiss_button"))))):m("div",{className:"Modal-body"},m(v(),{className:"Form--centered"},m("div",{className:"Form-group"},m("div",null,this.flagReasons().toArray())),m("div",{className:"Form-group Form-controls"},m(g(),{className:"Button Button--primary Button--block",type:"submit",loading:this.loading,disabled:!this.reason()},s().translator.trans("flarum-flags.forum.flag_post.submit_button")))))}flagReasons(){const t=new(F()),a=s().forum.attribute("guidelinesUrl");return t.add("off-topic",m("label",{className:"checkbox"},m("input",{type:"radio",name:"reason",checked:"off_topic"===this.reason(),value:"off_topic",onclick:N()("value",this.reason)}),m("strong",null,s().translator.trans("flarum-flags.forum.flag_post.reason_off_topic_label")),s().translator.trans("flarum-flags.forum.flag_post.reason_off_topic_text"),"off_topic"===this.reason()&&m("textarea",{className:"FormControl",placeholder:s().translator.trans("flarum-flags.forum.flag_post.reason_details_placeholder"),value:this.reasonDetail(),oninput:N()("value",this.reasonDetail)})),70),t.add("inappropriate",m("label",{className:"checkbox"},m("input",{type:"radio",name:"reason",checked:"inappropriate"===this.reason(),value:"inappropriate",onclick:N()("value",this.reason)}),m("strong",null,s().translator.trans("flarum-flags.forum.flag_post.reason_inappropriate_label")),s().translator.trans("flarum-flags.forum.flag_post.reason_inappropriate_text",{a:a?m("a",{href:a,target:"_blank"}):void 0}),"inappropriate"===this.reason()&&m("textarea",{className:"FormControl",placeholder:s().translator.trans("flarum-flags.forum.flag_post.reason_details_placeholder"),value:this.reasonDetail(),oninput:N()("value",this.reasonDetail)})),60),t.add("spam",m("label",{className:"checkbox"},m("input",{type:"radio",name:"reason",checked:"spam"===this.reason(),value:"spam",onclick:N()("value",this.reason)}),m("strong",null,s().translator.trans("flarum-flags.forum.flag_post.reason_spam_label")),s().translator.trans("flarum-flags.forum.flag_post.reason_spam_text"),"spam"===this.reason()&&m("textarea",{className:"FormControl",placeholder:s().translator.trans("flarum-flags.forum.flag_post.reason_details_placeholder"),value:this.reasonDetail(),oninput:N()("value",this.reasonDetail)})),50),t.add("other",m("label",{className:"checkbox"},m("input",{type:"radio",name:"reason",checked:"other"===this.reason(),value:"other",onclick:N()("value",this.reason)}),m("strong",null,s().translator.trans("flarum-flags.forum.flag_post.reason_other_label")),"other"===this.reason()&&m("textarea",{className:"FormControl",value:this.reasonDetail(),oninput:N()("value",this.reasonDetail)})),10),t}onsubmit(t){t.preventDefault(),this.loading=!0,s().store.createRecord("flags").save({reason:"other"===this.reason()?null:this.reason(),reasonDetail:this.reasonDetail(),relationships:{post:this.attrs.post}},{errorHandler:this.onerror.bind(this)}).then((()=>this.success=!0)).catch((()=>{})).then(this.loaded.bind(this))}}flarum.reg.add("flarum-flags","forum/components/FlagPostModal",P);const w=flarum.reg.get("core","forum/components/HeaderSecondary");var k=t.n(w);const D=flarum.reg.get("core","forum/components/HeaderDropdown");var S=t.n(D);const C=flarum.reg.get("core","common/utils/classList");var A=t.n(C);const L=flarum.reg.get("core","common/Component");var M=t.n(L);const B=flarum.reg.get("core","common/components/Avatar");var O=t.n(B);const j=flarum.reg.get("core","common/helpers/username");var I=t.n(j);const T=flarum.reg.get("core","forum/components/HeaderList");var H=t.n(T);const R=flarum.reg.get("core","forum/components/HeaderListItem");var E=t.n(R);class U extends(M()){oninit(t){super.oninit(t)}view(){const t=this.attrs.state;return m(H(),{className:"FlagList",title:s().translator.trans("flarum-flags.forum.flagged_posts.title"),controls:this.controlItems(),hasItems:t.hasItems(),loading:t.isLoading(),emptyText:s().translator.trans("flarum-flags.forum.flagged_posts.empty_text"),loadMore:()=>t.hasNext()&&!t.isLoadingNext()&&t.loadNext()},m("ul",{className:"HeaderListGroup-content"},this.content(t)))}controlItems(){return new(F())}content(t){return!t.isLoading()&&t.hasItems()?t.getPages().map((t=>t.items.map((t=>{const a=t.post();return m("li",null,m(E(),{className:"Flag",avatar:m(O(),{user:a.user()||null}),icon:"fas fa-flag",content:s().translator.trans("flarum-flags.forum.flagged_posts.item_text",{username:I()(a.user()),em:m("em",null),discussion:a.discussion().title()}),excerpt:a.contentPlain(),datetime:t.createdAt(),href:s().route.post(a),onclick:t=>{t.redraw=!1}}))})))):null}}flarum.reg.add("flarum-flags","forum/components/FlagList",U);class G extends(S()){static initAttrs(t){t.className=A()("FlagsDropdown",t.className),t.label=t.label||s().translator.trans("flarum-flags.forum.flagged_posts.tooltip"),t.icon=t.icon||"fas fa-flag",super.initAttrs(t)}getContent(){return m(U,{state:this.attrs.state})}goToRoute(){m.route.set(s().route("flags"))}getUnreadCount(){return s().forum.attribute("flagCount")}getNewCount(){return s().session.user.attribute("newFlagCount")}}flarum.reg.add("flarum-flags","forum/components/FlagsDropdown",G);const q=flarum.reg.get("core","forum/components/Post");var z=t.n(q);const V=flarum.reg.get("core","common/utils/humanTime");var $=t.n(V);const J=flarum.reg.get("core","common/extenders");var K=t.n(J);const Q=flarum.reg.get("core","common/models/Post");var W=t.n(Q);const X=flarum.reg.get("core","common/components/Page");var Y=t.n(X);class Z extends(Y()){oninit(t){super.oninit(t),s().history.push("flags"),s().flags.load(),this.bodyClass="App--flags"}view(){return m("div",{className:"FlagsPage"},m(U,{state:s().flags}))}}flarum.reg.add("flarum-flags","forum/components/FlagsPage",Z);const tt=flarum.reg.get("core","common/Model");var at=t.n(tt);class et extends(at()){type(){return at().attribute("type").call(this)}reason(){return at().attribute("reason").call(this)}reasonDetail(){return at().attribute("reasonDetail").call(this)}createdAt(){return at().attribute("createdAt",at().transformDate).call(this)}post(){return at().hasOne("post").call(this)}user(){return at().hasOne("user").call(this)}}flarum.reg.add("flarum-flags","forum/models/Flag",et);const st=[(new(K().Routes)).add("flags","/flags",Z),(new(K().Store)).add("flags",et),new(K().Model)(W()).hasMany("flags").attribute("canFlag")];s().initializers.add("flarum-flags",(()=>{s().flags=new l(s()),(0,i.extend)(c(),"userControls",(function(t,a){!a.isHidden()&&"comment"===a.contentType()&&a.canFlag()&&t.add("flag",m(g(),{icon:"fas fa-flag",onclick:()=>s().modal.show(P,{post:a})},s().translator.trans("flarum-flags.forum.post_controls.flag_button")))})),(0,i.extend)(k().prototype,"items",(function(t){s().forum.attribute("canViewFlags")&&t.add("flags",m(G,{state:s().flags}),15)})),(0,i.extend)(z().prototype,"elementAttrs",(function(t){this.attrs.post.flags().length&&(t.className+=" Post--flagged")})),z().prototype.dismissFlag=function(t){const a=this.attrs.post;return delete a.data.relationships.flags,this.subtree.invalidate(),s().flags.cache&&s().flags.cache.some(((t,e)=>{if(t.post()===a){if(s().flags.cache.splice(e,1),s().flags.index===a){let t=s().flags.cache[e];if(t||(t=s().flags.cache[0]),t){const a=t.post();s().flags.index=a,m.route.set(s().route.post(a))}}return!0}})),s().request({url:s().forum.attribute("apiUrl")+a.apiEndpoint()+"/flags",method:"DELETE",body:t})},z().prototype.flagActionItems=function(){const t=new(F()),a=c().destructiveControls(this.attrs.post);return Object.keys(a.toObject()).forEach((t=>{const e=a.get(t).attrs;e.className="Button",(0,i.extend)(e,"onclick",(()=>this.dismissFlag()))})),t.add("controls",m("div",{className:"ButtonGroup"},a.toArray())),t.add("dismiss",m(g(),{className:"Button",icon:"far fa-eye-slash",onclick:this.dismissFlag.bind(this)},s().translator.trans("flarum-flags.forum.post.dismiss_flag_button")),-100),t},(0,i.override)(z().prototype,"header",(function(t){const a=this.attrs.post,e=a.flags();if(e.length)return a.isHidden()&&(this.revealContent=!0),m("div",{className:"Post-flagged"},m("div",{className:"Post-flagged-flags"},e.map((t=>m("div",{className:"Post-flagged-flag"},this.flagReason(t))))),m("div",{className:"Post-flagged-actions"},this.flagActionItems().toArray()))})),z().prototype.flagReason=function(t){if("user"===t.type()){const a=t.user(),e=t.reason()?s().translator.trans(`flarum-flags.forum.flag_post.reason_${t.reason()}_label`):null,r=t.reasonDetail(),o=$()(t.createdAt());return[s().translator.trans(e?"flarum-flags.forum.post.flagged_by_with_reason_text":"flarum-flags.forum.post.flagged_by_text",{time:o,user:a,reason:e}),!!r&&m("span",{className:"Post-flagged-detail"},r)]}}}))})(),module.exports=a})(); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/extensions/flags/js/dist/forum.js.map b/extensions/flags/js/dist/forum.js.map index 6efe98fbfd..54fc1c8d2d 100644 --- a/extensions/flags/js/dist/forum.js.map +++ b/extensions/flags/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,sDCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCAzC,MAAMC,EACnBC,YAAYC,GACVC,KAAKD,IAAMA,EAOXC,KAAKC,SAAU,CACjB,CAMAC,OACMF,KAAKG,QAAUH,KAAKD,IAAIK,QAAQC,KAAKC,UAAU,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AACE,MAAOtE,IAAAA,QAGvB,EC1BF,MAAM,GAA+BL,OAAOC,KAAKC,OAAO,gB,eCIzC,MAAMgI,WAAaC,MAChCxF,OACE,OAAOwF,KAAAA,UAAwB,QAAQvI,KAAKU,KAC9C,CACAyB,SACE,OAAOoG,KAAAA,UAA+B,UAAUvI,KAAKU,KACvD,CACA2B,eACE,OAAOkG,KAAAA,UAA+B,gBAAgBvI,KAAKU,KAC7D,CACAiB,YACE,OAAO4G,KAAAA,UAAgB,YAAaA,KAAAA,eAAqBvI,KAAKU,KAChE,CAEAwD,OACE,OAAOqE,KAAAA,OAAmB,QAAQvI,KAAKU,KACzC,CACAK,OACE,OAAOwH,KAAAA,OAA0B,QAAQvI,KAAKU,KAChD,EClBF,WACE,IAAI8H,IAAAA,SACDpF,IAAI,QAAS,SAAU+E,IAE1B,IAAIK,IAAAA,QACDpF,IAAI,QAASkF,IAEhB,IAAIE,IAAAA,OAAa7B,KACd8B,QAAc,SACdzH,UAAmB,YCLxB,IACE,wBAAyB0H,EACzB,uBAAwBC,EACxB,yBAA0BC,EAC1B,oBAAqBN,GACrB,4BAA6BzD,EAC7B,iCAAkChD,EAClC,6BAA8BsG,EAC9B,iCAAkCvC,GCjB9B,GAA+BxF,OAAOC,KCS5CI,IAAAA,aAAAA,IAAqB,gBAAgB,KACnCA,IAAAA,MAAY,IAAIF,EAAcE,KAE9BkI,IACAC,IACAF,GAAiB,IAOnBlJ,OAAOqJ,OAAOvI,GAAAA,OAAQwI,G","sources":["webpack://@flarum/flags/webpack/bootstrap","webpack://@flarum/flags/webpack/runtime/compat get default export","webpack://@flarum/flags/webpack/runtime/define property getters","webpack://@flarum/flags/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/flags/webpack/runtime/make namespace object","webpack://@flarum/flags/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/flags/./src/forum/states/FlagListState.js","webpack://@flarum/flags/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/flags/external root \"flarum.core.compat['forum/utils/PostControls']\"","webpack://@flarum/flags/external root \"flarum.core.compat['common/components/Button']\"","webpack://@flarum/flags/external root \"flarum.core.compat['common/components/Modal']\"","webpack://@flarum/flags/external root \"flarum.core.compat['common/utils/Stream']\"","webpack://@flarum/flags/external root \"flarum.core.compat['common/utils/withAttr']\"","webpack://@flarum/flags/external root \"flarum.core.compat['common/utils/ItemList']\"","webpack://@flarum/flags/./src/forum/components/FlagPostModal.js","webpack://@flarum/flags/./src/forum/addFlagControl.js","webpack://@flarum/flags/external root \"flarum.core.compat['forum/components/HeaderSecondary']\"","webpack://@flarum/flags/external root \"flarum.core.compat['forum/components/NotificationsDropdown']\"","webpack://@flarum/flags/external root \"flarum.core.compat['common/Component']\"","webpack://@flarum/flags/external root \"flarum.core.compat['common/components/Link']\"","webpack://@flarum/flags/external root \"flarum.core.compat['common/components/LoadingIndicator']\"","webpack://@flarum/flags/external root \"flarum.core.compat['common/helpers/avatar']\"","webpack://@flarum/flags/external root \"flarum.core.compat['common/helpers/username']\"","webpack://@flarum/flags/external root \"flarum.core.compat['common/helpers/icon']\"","webpack://@flarum/flags/external root \"flarum.core.compat['common/helpers/humanTime']\"","webpack://@flarum/flags/./src/forum/components/FlagList.js","webpack://@flarum/flags/./src/forum/components/FlagsDropdown.js","webpack://@flarum/flags/./src/forum/addFlagsDropdown.js","webpack://@flarum/flags/external root \"flarum.core.compat['forum/components/Post']\"","webpack://@flarum/flags/external root \"flarum.core.compat['common/utils/humanTime']\"","webpack://@flarum/flags/./src/forum/addFlagsToPosts.js","webpack://@flarum/flags/external root \"flarum.core.compat['common/extenders']\"","webpack://@flarum/flags/external root \"flarum.core.compat['common/models/Post']\"","webpack://@flarum/flags/external root \"flarum.core.compat['components/Page']\"","webpack://@flarum/flags/./src/forum/components/FlagsPage.js","webpack://@flarum/flags/external root \"flarum.core.compat['common/Model']\"","webpack://@flarum/flags/./src/forum/models/Flag.ts","webpack://@flarum/flags/./src/forum/extend.ts","webpack://@flarum/flags/./src/forum/compat.js","webpack://@flarum/flags/external assign \"flarum.core\"","webpack://@flarum/flags/./src/forum/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","export default class FlagListState {\n constructor(app) {\n this.app = app;\n\n /**\n * Whether or not the flags are loading.\n *\n * @type {Boolean}\n */\n this.loading = false;\n }\n\n /**\n * Load flags into the application's cache if they haven't already\n * been loaded.\n */\n load() {\n if (this.cache && !this.app.session.user.attribute('newFlagCount')) {\n return;\n }\n\n this.loading = true;\n m.redraw();\n\n this.app.store\n .find('flags')\n .then((flags) => {\n this.app.session.user.pushAttributes({ newFlagCount: 0 });\n this.cache = flags.sort((a, b) => b.createdAt() - a.createdAt());\n })\n .catch(() => {})\n .then(() => {\n this.loading = false;\n m.redraw();\n });\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/PostControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/Stream'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/withAttr'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/ItemList'];","import app from 'flarum/forum/app';\nimport Modal from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\n\nimport Stream from 'flarum/common/utils/Stream';\nimport withAttr from 'flarum/common/utils/withAttr';\nimport ItemList from 'flarum/common/utils/ItemList';\n\nexport default class FlagPostModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.success = false;\n\n this.reason = Stream('');\n this.reasonDetail = Stream('');\n }\n\n className() {\n return 'FlagPostModal Modal--medium';\n }\n\n title() {\n return app.translator.trans('flarum-flags.forum.flag_post.title');\n }\n\n content() {\n if (this.success) {\n return (\n
\n
\n

{app.translator.trans('flarum-flags.forum.flag_post.confirmation_message')}

\n
\n \n
\n
\n
\n );\n }\n\n return (\n
\n
\n
\n
{this.flagReasons().toArray()}
\n
\n\n
\n \n
\n
\n
\n );\n }\n\n flagReasons() {\n const items = new ItemList();\n const guidelinesUrl = app.forum.attribute('guidelinesUrl');\n\n items.add(\n 'off-topic',\n ,\n 70\n );\n\n items.add(\n 'inappropriate',\n ,\n 60\n );\n\n items.add(\n 'spam',\n ,\n 50\n );\n\n items.add(\n 'other',\n ,\n 10\n );\n\n return items;\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n app.store\n .createRecord('flags')\n .save(\n {\n reason: this.reason() === 'other' ? null : this.reason(),\n reasonDetail: this.reasonDetail(),\n relationships: {\n user: app.session.user,\n post: this.attrs.post,\n },\n },\n { errorHandler: this.onerror.bind(this) }\n )\n .then(() => (this.success = true))\n .catch(() => {})\n .then(this.loaded.bind(this));\n }\n}\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport PostControls from 'flarum/forum/utils/PostControls';\nimport Button from 'flarum/common/components/Button';\n\nimport FlagPostModal from './components/FlagPostModal';\n\nexport default function () {\n extend(PostControls, 'userControls', function (items, post) {\n if (post.isHidden() || post.contentType() !== 'comment' || !post.canFlag()) return;\n\n items.add(\n 'flag',\n \n );\n });\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/HeaderSecondary'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/NotificationsDropdown'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Link'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LoadingIndicator'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/avatar'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/username'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/icon'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/humanTime'];","import app from 'flarum/forum/app';\nimport Component from 'flarum/common/Component';\nimport Link from 'flarum/common/components/Link';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport avatar from 'flarum/common/helpers/avatar';\nimport username from 'flarum/common/helpers/username';\nimport icon from 'flarum/common/helpers/icon';\nimport humanTime from 'flarum/common/helpers/humanTime';\n\nexport default class FlagList extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n this.state = this.attrs.state;\n }\n\n view() {\n const flags = this.state.cache || [];\n\n return (\n
\n
\n

{app.translator.trans('flarum-flags.forum.flagged_posts.title')}

\n
\n
\n
    \n {flags.length ? (\n flags.map((flag) => {\n const post = flag.post();\n\n return (\n
  • \n {\n app.flags.index = post;\n e.redraw = false;\n }}\n >\n {avatar(post.user())}\n {icon('fas fa-flag', { className: 'Notification-icon' })}\n \n {app.translator.trans('flarum-flags.forum.flagged_posts.item_text', {\n username: username(post.user()),\n em: ,\n discussion: post.discussion().title(),\n })}\n \n {humanTime(flag.createdAt())}\n
    {post.contentPlain()}
    \n \n
  • \n );\n })\n ) : !this.state.loading ? (\n
    {app.translator.trans('flarum-flags.forum.flagged_posts.empty_text')}
    \n ) : (\n \n )}\n
\n
\n
\n );\n }\n}\n","import app from 'flarum/forum/app';\nimport NotificationsDropdown from 'flarum/forum/components/NotificationsDropdown';\n\nimport FlagList from './FlagList';\n\nexport default class FlagsDropdown extends NotificationsDropdown {\n static initAttrs(attrs) {\n attrs.label = attrs.label || app.translator.trans('flarum-flags.forum.flagged_posts.tooltip');\n attrs.icon = attrs.icon || 'fas fa-flag';\n\n super.initAttrs(attrs);\n }\n\n getMenu() {\n return (\n
\n {this.showing && }\n
\n );\n }\n\n goToRoute() {\n m.route.set(app.route('flags'));\n }\n\n getUnreadCount() {\n return app.flags.cache ? app.flags.cache.length : app.forum.attribute('flagCount');\n }\n\n getNewCount() {\n return app.session.user.attribute('newFlagCount');\n }\n}\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport HeaderSecondary from 'flarum/forum/components/HeaderSecondary';\nimport FlagsDropdown from './components/FlagsDropdown';\n\nexport default function () {\n extend(HeaderSecondary.prototype, 'items', function (items) {\n if (app.forum.attribute('canViewFlags')) {\n items.add('flags', , 15);\n }\n });\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/Post'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/humanTime'];","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport Post from 'flarum/forum/components/Post';\nimport Button from 'flarum/common/components/Button';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport PostControls from 'flarum/forum/utils/PostControls';\nimport humanTime from 'flarum/common/utils/humanTime';\n\nexport default function () {\n extend(Post.prototype, 'elementAttrs', function (attrs) {\n if (this.attrs.post.flags().length) {\n attrs.className += ' Post--flagged';\n }\n });\n\n Post.prototype.dismissFlag = function (body) {\n const post = this.attrs.post;\n\n delete post.data.relationships.flags;\n\n this.subtree.invalidate();\n\n if (app.flags.cache) {\n app.flags.cache.some((flag, i) => {\n if (flag.post() === post) {\n app.flags.cache.splice(i, 1);\n\n if (app.flags.index === post) {\n let next = app.flags.cache[i];\n\n if (!next) next = app.flags.cache[0];\n\n if (next) {\n const nextPost = next.post();\n app.flags.index = nextPost;\n m.route.set(app.route.post(nextPost));\n }\n }\n\n return true;\n }\n });\n }\n\n return app.request({\n url: app.forum.attribute('apiUrl') + post.apiEndpoint() + '/flags',\n method: 'DELETE',\n body,\n });\n };\n\n Post.prototype.flagActionItems = function () {\n const items = new ItemList();\n\n const controls = PostControls.destructiveControls(this.attrs.post);\n\n Object.keys(controls.items).forEach((k) => {\n const attrs = controls.get(k).attrs;\n\n attrs.className = 'Button';\n\n extend(attrs, 'onclick', () => this.dismissFlag());\n });\n\n items.add('controls',
{controls.toArray()}
);\n\n items.add(\n 'dismiss',\n ,\n -100\n );\n\n return items;\n };\n\n extend(Post.prototype, 'content', function (vdom) {\n const post = this.attrs.post;\n const flags = post.flags();\n\n if (!flags.length) return;\n\n if (post.isHidden()) this.revealContent = true;\n\n vdom.unshift(\n
\n
\n {flags.map((flag) => (\n
{this.flagReason(flag)}
\n ))}\n
\n
{this.flagActionItems().toArray()}
\n
\n );\n });\n\n Post.prototype.flagReason = function (flag) {\n if (flag.type() === 'user') {\n const user = flag.user();\n const reason = flag.reason() ? app.translator.trans(`flarum-flags.forum.flag_post.reason_${flag.reason()}_label`) : null;\n const detail = flag.reasonDetail();\n const time = humanTime(flag.createdAt());\n\n return [\n app.translator.trans(reason ? 'flarum-flags.forum.post.flagged_by_with_reason_text' : 'flarum-flags.forum.post.flagged_by_text', {\n time,\n user,\n reason,\n }),\n !!detail && {detail},\n ];\n }\n };\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extenders'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Post'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Page'];","import app from 'flarum/forum/app';\nimport Page from 'flarum/components/Page';\n\nimport FlagList from './FlagList';\n\n/**\n * The `FlagsPage` component shows the flags list. It is only\n * used on mobile devices where the flags dropdown is within the drawer.\n */\nexport default class FlagsPage extends Page {\n oninit(vnode) {\n super.oninit(vnode);\n\n app.history.push('flags');\n\n app.flags.load();\n\n this.bodyClass = 'App--flags';\n }\n\n view() {\n return (\n
\n \n
\n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","import Model from 'flarum/common/Model';\nimport type Post from 'flarum/common/models/Post';\nimport type User from 'flarum/common/models/User';\n\nexport default class Flag extends Model {\n type() {\n return Model.attribute('type').call(this);\n }\n reason() {\n return Model.attribute('reason').call(this);\n }\n reasonDetail() {\n return Model.attribute('reasonDetail').call(this);\n }\n createdAt() {\n return Model.attribute('createdAt', Model.transformDate).call(this);\n }\n\n post() {\n return Model.hasOne('post').call(this);\n }\n user() {\n return Model.hasOne('user').call(this);\n }\n}\n","import Extend from 'flarum/common/extenders';\nimport Post from 'flarum/common/models/Post';\nimport FlagsPage from './components/FlagsPage';\nimport Flag from './models/Flag';\n\nexport default [\n new Extend.Routes() //\n .add('flags', '/flags', FlagsPage),\n\n new Extend.Store() //\n .add('flags', Flag),\n\n new Extend.Model(Post) //\n .hasMany('flags')\n .attribute('canFlag'),\n];\n","import addFlagsToPosts from './addFlagsToPosts';\nimport addFlagControl from './addFlagControl';\nimport addFlagsDropdown from './addFlagsDropdown';\nimport Flag from './models/Flag';\nimport FlagList from './components/FlagList';\nimport FlagPostModal from './components/FlagPostModal';\nimport FlagsPage from './components/FlagsPage';\nimport FlagsDropdown from './components/FlagsDropdown';\n\nexport default {\n 'flags/addFlagsToPosts': addFlagsToPosts,\n 'flags/addFlagControl': addFlagControl,\n 'flags/addFlagsDropdown': addFlagsDropdown,\n 'flags/models/Flag': Flag,\n 'flags/components/FlagList': FlagList,\n 'flags/components/FlagPostModal': FlagPostModal,\n 'flags/components/FlagsPage': FlagsPage,\n 'flags/components/FlagsDropdown': FlagsDropdown,\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core;","import app from 'flarum/forum/app';\n\nimport FlagListState from './states/FlagListState';\nimport addFlagControl from './addFlagControl';\nimport addFlagsDropdown from './addFlagsDropdown';\nimport addFlagsToPosts from './addFlagsToPosts';\n\nexport { default as extend } from './extend';\n\napp.initializers.add('flarum-flags', () => {\n app.flags = new FlagListState(app);\n\n addFlagControl();\n addFlagsDropdown();\n addFlagsToPosts();\n});\n\n// Expose compat API\nimport flagsCompat from './compat';\nimport { compat } from '@flarum/core/forum';\n\nObject.assign(compat, flagsCompat);\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","FlagListState","constructor","app","this","loading","load","cache","session","user","attribute","m","redraw","store","find","then","flags","pushAttributes","newFlagCount","sort","b","createdAt","catch","FlagPostModal","Modal","oninit","vnode","super","success","reason","Stream","reasonDetail","className","title","content","Button","onclick","hide","bind","flagReasons","toArray","type","disabled","items","ItemList","guidelinesUrl","add","name","checked","withAttr","placeholder","oninput","href","target","undefined","onsubmit","e","preventDefault","save","relationships","post","attrs","errorHandler","onerror","loaded","extend","PostControls","isHidden","contentType","canFlag","icon","FlagList","Component","state","view","length","map","flag","Link","avatar","username","em","discussion","humanTime","contentPlain","LoadingIndicator","FlagsDropdown","NotificationsDropdown","static","label","initAttrs","getMenu","menuClassName","menuClick","showing","goToRoute","route","set","getUnreadCount","getNewCount","HeaderSecondary","Post","body","data","subtree","invalidate","i","next","nextPost","url","apiEndpoint","method","controls","keys","forEach","k","dismissFlag","vdom","revealContent","unshift","flagReason","flagActionItems","concat","detail","time","FlagsPage","Page","bodyClass","Flag","Model","Extend","hasMany","addFlagsToPosts","addFl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MnB,IAAI,UAAWW,EAAE,IAAQ,CAC7BJ,UAAW,SACXgD,KAAM,mBACN3C,QAAShC,KAAKwG,YAAYtE,KAAKlC,OAC9B,eAAe6B,MAAM,iDAAkD,KACnEU,CACT,GACA,IAAAoF,UAAS,cAAgB,UAAU,SAAUC,GAC3C,MAAMvE,EAAOrD,KAAKsD,MAAMD,KAClBkD,EAAQlD,EAAKkD,QACnB,GAAKA,EAAMvF,OAEX,OADIqC,EAAK8C,aAAYnG,KAAK6H,eAAgB,GACnC9F,EAAE,MAAO,CACdJ,UAAW,gBACVI,EAAE,MAAO,CACVJ,UAAW,sBACV4E,EAAM/B,KAAIC,GAAQ1C,EAAE,MAAO,CAC5BJ,UAAW,qBACV3B,KAAK8H,WAAWrD,OAAU1C,EAAE,MAAO,CACpCJ,UAAW,wBACV3B,KAAKsH,kBAAkBlF,WAC5B,IACA,cAAe0F,WAAa,SAAUrD,GACpC,GAAoB,SAAhBA,EAAKjE,OAAmB,CAC1B,MAAMG,EAAO8D,EAAK9D,OACZc,EAASgD,EAAKhD,SAAW,eAAeI,MAAM,uCAAuC4C,EAAKhD,kBAAoB,KAC9GsG,EAAStD,EAAK/C,eACdsG,EAAO,IAAUvD,EAAKS,aAC5B,MAAO,CAAC,eAAerD,MAAMJ,EAAS,sDAAwD,0CAA2C,CACvIuG,OACArH,OACAc,aACIsG,GAAUhG,EAAE,OAAQ,CACxBJ,UAAW,uBACVoG,GACL,CACF,CH7EiB,G","sources":["webpack://@flarum/flags/webpack/bootstrap","webpack://@flarum/flags/webpack/runtime/compat get default export","webpack://@flarum/flags/webpack/runtime/define property getters","webpack://@flarum/flags/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/flags/webpack/runtime/make namespace object","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'forum/app')\"","webpack://@flarum/flags/../../../node_modules/@babel/runtime/helpers/esm/typeof.js","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'common/states/PaginatedListState')\"","webpack://@flarum/flags/./src/forum/states/FlagListState.tsx","webpack://@flarum/flags/../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack://@flarum/flags/../../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","webpack://@flarum/flags/../../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'common/extend')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'forum/utils/PostControls')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'common/components/Button')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'common/components/FormModal')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'common/components/Form')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'common/utils/Stream')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'common/utils/withAttr')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'common/utils/ItemList')\"","webpack://@flarum/flags/./src/forum/components/FlagPostModal.js","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'forum/components/HeaderSecondary')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'forum/components/HeaderDropdown')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'common/utils/classList')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'common/Component')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'common/components/Avatar')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'common/helpers/username')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'forum/components/HeaderList')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'forum/components/HeaderListItem')\"","webpack://@flarum/flags/./src/forum/components/FlagList.tsx","webpack://@flarum/flags/./src/forum/components/FlagsDropdown.tsx","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'forum/components/Post')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'common/utils/humanTime')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'common/models/Post')\"","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'common/components/Page')\"","webpack://@flarum/flags/./src/forum/components/FlagsPage.js","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'common/Model')\"","webpack://@flarum/flags/./src/forum/models/Flag.ts","webpack://@flarum/flags/./src/forum/extend.ts","webpack://@flarum/flags/./src/forum/index.ts","webpack://@flarum/flags/./src/forum/addFlagControl.js","webpack://@flarum/flags/./src/forum/addFlagsDropdown.js","webpack://@flarum/flags/./src/forum/addFlagsToPosts.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/app');","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}\nexport { _typeof as default };","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/states/PaginatedListState');","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport PaginatedListState from 'flarum/common/states/PaginatedListState';\nexport default class FlagListState extends PaginatedListState {\n constructor(app) {\n super({}, 1, null);\n _defineProperty(this, \"app\", void 0);\n this.app = app;\n }\n get type() {\n return 'flags';\n }\n\n /**\n * Load flags into the application's cache if they haven't already\n * been loaded.\n */\n load() {\n if (this.app.session.user?.attribute('newFlagCount')) {\n this.pages = [];\n this.location = {\n page: 1\n };\n }\n if (this.pages.length > 0) {\n return Promise.resolve();\n }\n return super.loadNext();\n }\n}\nflarum.reg.add('flarum-flags', 'forum/states/FlagListState', FlagListState);","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperty(e, r, t) {\n return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\nexport { _defineProperty as default };","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}\nexport { toPropertyKey as default };","import _typeof from \"./typeof.js\";\nfunction toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nexport { toPrimitive as default };","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extend');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/utils/PostControls');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Button');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/FormModal');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Form');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/utils/Stream');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/utils/withAttr');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/utils/ItemList');","import app from 'flarum/forum/app';\nimport FormModal from 'flarum/common/components/FormModal';\nimport Form from 'flarum/common/components/Form';\nimport Button from 'flarum/common/components/Button';\nimport Stream from 'flarum/common/utils/Stream';\nimport withAttr from 'flarum/common/utils/withAttr';\nimport ItemList from 'flarum/common/utils/ItemList';\nexport default class FlagPostModal extends FormModal {\n oninit(vnode) {\n super.oninit(vnode);\n this.success = false;\n this.reason = Stream('');\n this.reasonDetail = Stream('');\n }\n className() {\n return 'FlagPostModal Modal--medium';\n }\n title() {\n return app.translator.trans('flarum-flags.forum.flag_post.title');\n }\n content() {\n if (this.success) {\n return m(\"div\", {\n className: \"Modal-body\"\n }, m(Form, {\n className: \"Form--centered\"\n }, m(\"p\", {\n className: \"helpText\"\n }, app.translator.trans('flarum-flags.forum.flag_post.confirmation_message')), m(\"div\", {\n className: \"Form-group Form-controls\"\n }, m(Button, {\n className: \"Button Button--primary Button--block\",\n onclick: this.hide.bind(this)\n }, app.translator.trans('flarum-flags.forum.flag_post.dismiss_button')))));\n }\n return m(\"div\", {\n className: \"Modal-body\"\n }, m(Form, {\n className: \"Form--centered\"\n }, m(\"div\", {\n className: \"Form-group\"\n }, m(\"div\", null, this.flagReasons().toArray())), m(\"div\", {\n className: \"Form-group Form-controls\"\n }, m(Button, {\n className: \"Button Button--primary Button--block\",\n type: \"submit\",\n loading: this.loading,\n disabled: !this.reason()\n }, app.translator.trans('flarum-flags.forum.flag_post.submit_button')))));\n }\n flagReasons() {\n const items = new ItemList();\n const guidelinesUrl = app.forum.attribute('guidelinesUrl');\n items.add('off-topic', m(\"label\", {\n className: \"checkbox\"\n }, m(\"input\", {\n type: \"radio\",\n name: \"reason\",\n checked: this.reason() === 'off_topic',\n value: \"off_topic\",\n onclick: withAttr('value', this.reason)\n }), m(\"strong\", null, app.translator.trans('flarum-flags.forum.flag_post.reason_off_topic_label')), app.translator.trans('flarum-flags.forum.flag_post.reason_off_topic_text'), this.reason() === 'off_topic' && m(\"textarea\", {\n className: \"FormControl\",\n placeholder: app.translator.trans('flarum-flags.forum.flag_post.reason_details_placeholder'),\n value: this.reasonDetail(),\n oninput: withAttr('value', this.reasonDetail)\n })), 70);\n items.add('inappropriate', m(\"label\", {\n className: \"checkbox\"\n }, m(\"input\", {\n type: \"radio\",\n name: \"reason\",\n checked: this.reason() === 'inappropriate',\n value: \"inappropriate\",\n onclick: withAttr('value', this.reason)\n }), m(\"strong\", null, app.translator.trans('flarum-flags.forum.flag_post.reason_inappropriate_label')), app.translator.trans('flarum-flags.forum.flag_post.reason_inappropriate_text', {\n a: guidelinesUrl ? m(\"a\", {\n href: guidelinesUrl,\n target: \"_blank\"\n }) : undefined\n }), this.reason() === 'inappropriate' && m(\"textarea\", {\n className: \"FormControl\",\n placeholder: app.translator.trans('flarum-flags.forum.flag_post.reason_details_placeholder'),\n value: this.reasonDetail(),\n oninput: withAttr('value', this.reasonDetail)\n })), 60);\n items.add('spam', m(\"label\", {\n className: \"checkbox\"\n }, m(\"input\", {\n type: \"radio\",\n name: \"reason\",\n checked: this.reason() === 'spam',\n value: \"spam\",\n onclick: withAttr('value', this.reason)\n }), m(\"strong\", null, app.translator.trans('flarum-flags.forum.flag_post.reason_spam_label')), app.translator.trans('flarum-flags.forum.flag_post.reason_spam_text'), this.reason() === 'spam' && m(\"textarea\", {\n className: \"FormControl\",\n placeholder: app.translator.trans('flarum-flags.forum.flag_post.reason_details_placeholder'),\n value: this.reasonDetail(),\n oninput: withAttr('value', this.reasonDetail)\n })), 50);\n items.add('other', m(\"label\", {\n className: \"checkbox\"\n }, m(\"input\", {\n type: \"radio\",\n name: \"reason\",\n checked: this.reason() === 'other',\n value: \"other\",\n onclick: withAttr('value', this.reason)\n }), m(\"strong\", null, app.translator.trans('flarum-flags.forum.flag_post.reason_other_label')), this.reason() === 'other' && m(\"textarea\", {\n className: \"FormControl\",\n value: this.reasonDetail(),\n oninput: withAttr('value', this.reasonDetail)\n })), 10);\n return items;\n }\n onsubmit(e) {\n e.preventDefault();\n this.loading = true;\n app.store.createRecord('flags').save({\n reason: this.reason() === 'other' ? null : this.reason(),\n reasonDetail: this.reasonDetail(),\n relationships: {\n post: this.attrs.post\n }\n }, {\n errorHandler: this.onerror.bind(this)\n }).then(() => this.success = true).catch(() => {}).then(this.loaded.bind(this));\n }\n}\nflarum.reg.add('flarum-flags', 'forum/components/FlagPostModal', FlagPostModal);","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/HeaderSecondary');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/HeaderDropdown');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/utils/classList');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/Component');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Avatar');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/helpers/username');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/HeaderList');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/HeaderListItem');","import app from 'flarum/forum/app';\nimport Component from 'flarum/common/Component';\nimport Avatar from 'flarum/common/components/Avatar';\nimport username from 'flarum/common/helpers/username';\nimport HeaderList from 'flarum/forum/components/HeaderList';\nimport HeaderListItem from 'flarum/forum/components/HeaderListItem';\nimport ItemList from 'flarum/common/utils/ItemList';\nexport default class FlagList extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n }\n view() {\n const state = this.attrs.state;\n return m(HeaderList, {\n className: \"FlagList\",\n title: app.translator.trans('flarum-flags.forum.flagged_posts.title'),\n controls: this.controlItems(),\n hasItems: state.hasItems(),\n loading: state.isLoading(),\n emptyText: app.translator.trans('flarum-flags.forum.flagged_posts.empty_text'),\n loadMore: () => state.hasNext() && !state.isLoadingNext() && state.loadNext()\n }, m(\"ul\", {\n className: \"HeaderListGroup-content\"\n }, this.content(state)));\n }\n controlItems() {\n const items = new ItemList();\n return items;\n }\n content(state) {\n if (!state.isLoading() && state.hasItems()) {\n return state.getPages().map(page => {\n return page.items.map(flag => {\n const post = flag.post();\n return m(\"li\", null, m(HeaderListItem, {\n className: \"Flag\",\n avatar: m(Avatar, {\n user: post.user() || null\n }),\n icon: \"fas fa-flag\",\n content: app.translator.trans('flarum-flags.forum.flagged_posts.item_text', {\n username: username(post.user()),\n em: m(\"em\", null),\n discussion: post.discussion().title()\n }),\n excerpt: post.contentPlain(),\n datetime: flag.createdAt(),\n href: app.route.post(post),\n onclick: e => {\n e.redraw = false;\n }\n }));\n });\n });\n }\n return null;\n }\n}\nflarum.reg.add('flarum-flags', 'forum/components/FlagList', FlagList);","import app from 'flarum/forum/app';\nimport HeaderDropdown from 'flarum/forum/components/HeaderDropdown';\nimport classList from 'flarum/common/utils/classList';\nimport FlagList from './FlagList';\nexport default class FlagsDropdown extends HeaderDropdown {\n static initAttrs(attrs) {\n attrs.className = classList('FlagsDropdown', attrs.className);\n attrs.label = attrs.label || app.translator.trans('flarum-flags.forum.flagged_posts.tooltip');\n attrs.icon = attrs.icon || 'fas fa-flag';\n super.initAttrs(attrs);\n }\n getContent() {\n return m(FlagList, {\n state: this.attrs.state\n });\n }\n goToRoute() {\n m.route.set(app.route('flags'));\n }\n getUnreadCount() {\n return app.forum.attribute('flagCount');\n }\n getNewCount() {\n return app.session.user.attribute('newFlagCount');\n }\n}\nflarum.reg.add('flarum-flags', 'forum/components/FlagsDropdown', FlagsDropdown);","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/Post');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/utils/humanTime');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/models/Post');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Page');","import app from 'flarum/forum/app';\nimport Page from 'flarum/common/components/Page';\nimport FlagList from './FlagList';\n\n/**\n * The `FlagsPage` component shows the flags list. It is only\n * used on mobile devices where the flags dropdown is within the drawer.\n */\nexport default class FlagsPage extends Page {\n oninit(vnode) {\n super.oninit(vnode);\n app.history.push('flags');\n app.flags.load();\n this.bodyClass = 'App--flags';\n }\n view() {\n return m(\"div\", {\n className: \"FlagsPage\"\n }, m(FlagList, {\n state: app.flags\n }));\n }\n}\nflarum.reg.add('flarum-flags', 'forum/components/FlagsPage', FlagsPage);","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/Model');","import Model from 'flarum/common/Model';\nexport default class Flag extends Model {\n type() {\n return Model.attribute('type').call(this);\n }\n reason() {\n return Model.attribute('reason').call(this);\n }\n reasonDetail() {\n return Model.attribute('reasonDetail').call(this);\n }\n createdAt() {\n return Model.attribute('createdAt', Model.transformDate).call(this);\n }\n post() {\n return Model.hasOne('post').call(this);\n }\n user() {\n return Model.hasOne('user').call(this);\n }\n}\nflarum.reg.add('flarum-flags', 'forum/models/Flag', Flag);","import Extend from 'flarum/common/extenders';\nimport Post from 'flarum/common/models/Post';\nimport FlagsPage from './components/FlagsPage';\nimport Flag from './models/Flag';\nexport default [new Extend.Routes() //\n.add('flags', '/flags', FlagsPage), new Extend.Store() //\n.add('flags', Flag), new Extend.Model(Post) //\n.hasMany('flags').attribute('canFlag')];","import app from 'flarum/forum/app';\nimport FlagListState from './states/FlagListState';\nimport addFlagControl from './addFlagControl';\nimport addFlagsDropdown from './addFlagsDropdown';\nimport addFlagsToPosts from './addFlagsToPosts';\nexport { default as extend } from './extend';\napp.initializers.add('flarum-flags', () => {\n app.flags = new FlagListState(app);\n addFlagControl();\n addFlagsDropdown();\n addFlagsToPosts();\n});\nimport './forum';","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport PostControls from 'flarum/forum/utils/PostControls';\nimport Button from 'flarum/common/components/Button';\nimport FlagPostModal from './components/FlagPostModal';\nexport default function () {\n extend(PostControls, 'userControls', function (items, post) {\n if (post.isHidden() || post.contentType() !== 'comment' || !post.canFlag()) return;\n items.add('flag', m(Button, {\n icon: \"fas fa-flag\",\n onclick: () => app.modal.show(FlagPostModal, {\n post\n })\n }, app.translator.trans('flarum-flags.forum.post_controls.flag_button')));\n });\n}","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport HeaderSecondary from 'flarum/forum/components/HeaderSecondary';\nimport FlagsDropdown from './components/FlagsDropdown';\nexport default function () {\n extend(HeaderSecondary.prototype, 'items', function (items) {\n if (app.forum.attribute('canViewFlags')) {\n items.add('flags', m(FlagsDropdown, {\n state: app.flags\n }), 15);\n }\n });\n}","import { extend, override } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport Post from 'flarum/forum/components/Post';\nimport Button from 'flarum/common/components/Button';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport PostControls from 'flarum/forum/utils/PostControls';\nimport humanTime from 'flarum/common/utils/humanTime';\nexport default function () {\n extend(Post.prototype, 'elementAttrs', function (attrs) {\n if (this.attrs.post.flags().length) {\n attrs.className += ' Post--flagged';\n }\n });\n Post.prototype.dismissFlag = function (body) {\n const post = this.attrs.post;\n delete post.data.relationships.flags;\n this.subtree.invalidate();\n if (app.flags.cache) {\n app.flags.cache.some((flag, i) => {\n if (flag.post() === post) {\n app.flags.cache.splice(i, 1);\n if (app.flags.index === post) {\n let next = app.flags.cache[i];\n if (!next) next = app.flags.cache[0];\n if (next) {\n const nextPost = next.post();\n app.flags.index = nextPost;\n m.route.set(app.route.post(nextPost));\n }\n }\n return true;\n }\n });\n }\n return app.request({\n url: app.forum.attribute('apiUrl') + post.apiEndpoint() + '/flags',\n method: 'DELETE',\n body\n });\n };\n Post.prototype.flagActionItems = function () {\n const items = new ItemList();\n const controls = PostControls.destructiveControls(this.attrs.post);\n Object.keys(controls.toObject()).forEach(k => {\n const attrs = controls.get(k).attrs;\n attrs.className = 'Button';\n extend(attrs, 'onclick', () => this.dismissFlag());\n });\n items.add('controls', m(\"div\", {\n className: \"ButtonGroup\"\n }, controls.toArray()));\n items.add('dismiss', m(Button, {\n className: \"Button\",\n icon: \"far fa-eye-slash\",\n onclick: this.dismissFlag.bind(this)\n }, app.translator.trans('flarum-flags.forum.post.dismiss_flag_button')), -100);\n return items;\n };\n override(Post.prototype, 'header', function (vdom) {\n const post = this.attrs.post;\n const flags = post.flags();\n if (!flags.length) return;\n if (post.isHidden()) this.revealContent = true;\n return m(\"div\", {\n className: \"Post-flagged\"\n }, m(\"div\", {\n className: \"Post-flagged-flags\"\n }, flags.map(flag => m(\"div\", {\n className: \"Post-flagged-flag\"\n }, this.flagReason(flag)))), m(\"div\", {\n className: \"Post-flagged-actions\"\n }, this.flagActionItems().toArray()));\n });\n Post.prototype.flagReason = function (flag) {\n if (flag.type() === 'user') {\n const user = flag.user();\n const reason = flag.reason() ? app.translator.trans(`flarum-flags.forum.flag_post.reason_${flag.reason()}_label`) : null;\n const detail = flag.reasonDetail();\n const time = humanTime(flag.createdAt());\n return [app.translator.trans(reason ? 'flarum-flags.forum.post.flagged_by_with_reason_text' : 'flarum-flags.forum.post.flagged_by_text', {\n time,\n user,\n reason\n }), !!detail && m(\"span\", {\n className: \"Post-flagged-detail\"\n }, detail)];\n }\n };\n}"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","reg","_typeof","iterator","constructor","FlagListState","app","e","r","t","super","this","i","toPrimitive","TypeError","String","toPropertyKey","configurable","writable","type","load","session","user","attribute","pages","location","page","length","Promise","resolve","loadNext","add","FlagPostModal","oninit","vnode","success","reason","reasonDetail","className","title","trans","content","m","onclick","hide","bind","flagReasons","toArray","loading","disabled","items","guidelinesUrl","name","checked","placeholder","oninput","href","target","undefined","onsubmit","preventDefault","createRecord","save","relationships","post","attrs","errorHandler","onerror","then","catch","loaded","FlagList","view","state","controls","controlItems","hasItems","isLoading","emptyText","loadMore","hasNext","isLoadingNext","getPages","map","flag","avatar","icon","username","em","discussion","excerpt","contentPlain","datetime","createdAt","redraw","FlagsDropdown","initAttrs","label","getContent","goToRoute","route","set","getUnreadCount","getNewCount","FlagsPage","push","bodyClass","Flag","hasMany","extend","isHidden","contentType","canFlag","show","flags","dismissFlag","body","data","subtree","invalidate","cache","some","splice","index","next","nextPost","url","apiEndpoint","method","flagActionItems","keys","toObject","forEach","k","override","vdom","revealContent","flagReason","detail","time"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/flags/js/package.json b/extensions/flags/js/package.json index 862742ea95..d7472275eb 100644 --- a/extensions/flags/js/package.json +++ b/extensions/flags/js/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@types/mithril": "^2.0.8", "prettier": "^2.5.1", - "flarum-webpack-config": "^2.0.0", + "flarum-webpack-config": "^3.0.0", "webpack": "^5.76.0", "webpack-cli": "^4.9.1", "@flarum/prettier-config": "^1.0.0", diff --git a/extensions/flags/js/src/admin/extend.tsx b/extensions/flags/js/src/admin/extend.tsx new file mode 100644 index 0000000000..6cd6b16dcc --- /dev/null +++ b/extensions/flags/js/src/admin/extend.tsx @@ -0,0 +1,37 @@ +import Extend from 'flarum/common/extenders'; +import app from 'flarum/admin/app'; + +export default [ + new Extend.Admin() + .setting( + () => ({ + setting: 'flarum-flags.guidelines_url', + type: 'text', + label: app.translator.trans('flarum-flags.admin.settings.guidelines_url_label'), + }), + 15 + ) + .setting(() => ({ + setting: 'flarum-flags.can_flag_own', + type: 'boolean', + label: app.translator.trans('flarum-flags.admin.settings.flag_own_posts_label'), + })) + .permission( + () => ({ + icon: 'fas fa-flag', + label: app.translator.trans('flarum-flags.admin.permissions.view_flags_label'), + permission: 'discussion.viewFlags', + }), + 'moderate', + 65 + ) + .permission( + () => ({ + icon: 'fas fa-flag', + label: app.translator.trans('flarum-flags.admin.permissions.flag_posts_label'), + permission: 'discussion.flagPosts', + }), + 'reply', + 65 + ), +]; diff --git a/extensions/flags/js/src/admin/index.ts b/extensions/flags/js/src/admin/index.ts index 7b54de998c..6c056ff7c2 100644 --- a/extensions/flags/js/src/admin/index.ts +++ b/extensions/flags/js/src/admin/index.ts @@ -1,38 +1,7 @@ import app from 'flarum/admin/app'; -app.initializers.add('flarum-flags', () => { - app.extensionData - .for('flarum-flags') - .registerSetting( - { - setting: 'flarum-flags.guidelines_url', - type: 'text', - label: app.translator.trans('flarum-flags.admin.settings.guidelines_url_label'), - }, - 15 - ) - .registerSetting({ - setting: 'flarum-flags.can_flag_own', - type: 'boolean', - label: app.translator.trans('flarum-flags.admin.settings.flag_own_posts_label'), - }) - .registerPermission( - { - icon: 'fas fa-flag', - label: app.translator.trans('flarum-flags.admin.permissions.view_flags_label'), - permission: 'discussion.viewFlags', - }, - 'moderate', - 65 - ) +export { default as extend } from './extend'; - .registerPermission( - { - icon: 'fas fa-flag', - label: app.translator.trans('flarum-flags.admin.permissions.flag_posts_label'), - permission: 'discussion.flagPosts', - }, - 'reply', - 65 - ); +app.initializers.add('flarum-flags', () => { + // ... }); diff --git a/extensions/flags/js/src/forum/addFlagsToPosts.js b/extensions/flags/js/src/forum/addFlagsToPosts.js index 67f785f2c9..9002002c5a 100644 --- a/extensions/flags/js/src/forum/addFlagsToPosts.js +++ b/extensions/flags/js/src/forum/addFlagsToPosts.js @@ -1,4 +1,4 @@ -import { extend } from 'flarum/common/extend'; +import { extend, override } from 'flarum/common/extend'; import app from 'flarum/forum/app'; import Post from 'flarum/forum/components/Post'; import Button from 'flarum/common/components/Button'; @@ -54,7 +54,7 @@ export default function () { const controls = PostControls.destructiveControls(this.attrs.post); - Object.keys(controls.items).forEach((k) => { + Object.keys(controls.toObject()).forEach((k) => { const attrs = controls.get(k).attrs; attrs.className = 'Button'; @@ -75,7 +75,7 @@ export default function () { return items; }; - extend(Post.prototype, 'content', function (vdom) { + override(Post.prototype, 'header', function (vdom) { const post = this.attrs.post; const flags = post.flags(); @@ -83,7 +83,7 @@ export default function () { if (post.isHidden()) this.revealContent = true; - vdom.unshift( + return (
{flags.map((flag) => ( diff --git a/extensions/flags/js/src/forum/compat.js b/extensions/flags/js/src/forum/compat.js deleted file mode 100644 index 5365edd445..0000000000 --- a/extensions/flags/js/src/forum/compat.js +++ /dev/null @@ -1,19 +0,0 @@ -import addFlagsToPosts from './addFlagsToPosts'; -import addFlagControl from './addFlagControl'; -import addFlagsDropdown from './addFlagsDropdown'; -import Flag from './models/Flag'; -import FlagList from './components/FlagList'; -import FlagPostModal from './components/FlagPostModal'; -import FlagsPage from './components/FlagsPage'; -import FlagsDropdown from './components/FlagsDropdown'; - -export default { - 'flags/addFlagsToPosts': addFlagsToPosts, - 'flags/addFlagControl': addFlagControl, - 'flags/addFlagsDropdown': addFlagsDropdown, - 'flags/models/Flag': Flag, - 'flags/components/FlagList': FlagList, - 'flags/components/FlagPostModal': FlagPostModal, - 'flags/components/FlagsPage': FlagsPage, - 'flags/components/FlagsDropdown': FlagsDropdown, -}; diff --git a/extensions/flags/js/src/forum/components/FlagList.js b/extensions/flags/js/src/forum/components/FlagList.js deleted file mode 100644 index dd876c8d79..0000000000 --- a/extensions/flags/js/src/forum/components/FlagList.js +++ /dev/null @@ -1,65 +0,0 @@ -import app from 'flarum/forum/app'; -import Component from 'flarum/common/Component'; -import Link from 'flarum/common/components/Link'; -import LoadingIndicator from 'flarum/common/components/LoadingIndicator'; -import avatar from 'flarum/common/helpers/avatar'; -import username from 'flarum/common/helpers/username'; -import icon from 'flarum/common/helpers/icon'; -import humanTime from 'flarum/common/helpers/humanTime'; - -export default class FlagList extends Component { - oninit(vnode) { - super.oninit(vnode); - this.state = this.attrs.state; - } - - view() { - const flags = this.state.cache || []; - - return ( -
-
-

{app.translator.trans('flarum-flags.forum.flagged_posts.title')}

-
-
-
    - {flags.length ? ( - flags.map((flag) => { - const post = flag.post(); - - return ( -
  • - { - app.flags.index = post; - e.redraw = false; - }} - > - {avatar(post.user())} - {icon('fas fa-flag', { className: 'Notification-icon' })} - - {app.translator.trans('flarum-flags.forum.flagged_posts.item_text', { - username: username(post.user()), - em: , - discussion: post.discussion().title(), - })} - - {humanTime(flag.createdAt())} -
    {post.contentPlain()}
    - -
  • - ); - }) - ) : !this.state.loading ? ( -
    {app.translator.trans('flarum-flags.forum.flagged_posts.empty_text')}
    - ) : ( - - )} -
-
-
- ); - } -} diff --git a/extensions/flags/js/src/forum/components/FlagList.tsx b/extensions/flags/js/src/forum/components/FlagList.tsx new file mode 100644 index 0000000000..4b433e3994 --- /dev/null +++ b/extensions/flags/js/src/forum/components/FlagList.tsx @@ -0,0 +1,80 @@ +import app from 'flarum/forum/app'; +import Component from 'flarum/common/Component'; +import type { ComponentAttrs } from 'flarum/common/Component'; +import Avatar from 'flarum/common/components/Avatar'; +import username from 'flarum/common/helpers/username'; +import HeaderList from 'flarum/forum/components/HeaderList'; +import HeaderListItem from 'flarum/forum/components/HeaderListItem'; +import type Mithril from 'mithril'; +import type Post from 'flarum/common/models/Post'; +import type FlagListState from '../states/FlagListState'; +import type Flag from '../models/Flag'; +import { Page } from 'flarum/common/states/PaginatedListState'; +import ItemList from 'flarum/common/utils/ItemList'; + +export interface IFlagListAttrs extends ComponentAttrs { + state: FlagListState; +} + +export default class FlagList extends Component { + oninit(vnode: Mithril.Vnode) { + super.oninit(vnode); + } + + view() { + const state = this.attrs.state; + + return ( + state.hasNext() && !state.isLoadingNext() && state.loadNext()} + > +
    {this.content(state)}
+
+ ); + } + + controlItems() { + const items = new ItemList(); + + return items; + } + + content(state: FlagListState) { + if (!state.isLoading() && state.hasItems()) { + return state.getPages().map((page: Page) => { + return page.items.map((flag: Flag) => { + const post = flag.post() as Post; + + return ( +
  • + } + icon="fas fa-flag" + content={app.translator.trans('flarum-flags.forum.flagged_posts.item_text', { + username: username(post.user()), + em: , + discussion: post.discussion().title(), + })} + excerpt={post.contentPlain()} + datetime={flag.createdAt()} + href={app.route.post(post)} + onclick={(e: MouseEvent) => { + e.redraw = false; + }} + /> +
  • + ); + }); + }); + } + + return null; + } +} diff --git a/extensions/flags/js/src/forum/components/FlagPostModal.js b/extensions/flags/js/src/forum/components/FlagPostModal.js index de68a31662..9c2e58954c 100644 --- a/extensions/flags/js/src/forum/components/FlagPostModal.js +++ b/extensions/flags/js/src/forum/components/FlagPostModal.js @@ -1,12 +1,13 @@ import app from 'flarum/forum/app'; -import Modal from 'flarum/common/components/Modal'; +import FormModal from 'flarum/common/components/FormModal'; +import Form from 'flarum/common/components/Form'; import Button from 'flarum/common/components/Button'; import Stream from 'flarum/common/utils/Stream'; import withAttr from 'flarum/common/utils/withAttr'; import ItemList from 'flarum/common/utils/ItemList'; -export default class FlagPostModal extends Modal { +export default class FlagPostModal extends FormModal { oninit(vnode) { super.oninit(vnode); @@ -28,31 +29,31 @@ export default class FlagPostModal extends Modal { if (this.success) { return (
    -
    +

    {app.translator.trans('flarum-flags.forum.flag_post.confirmation_message')}

    -
    +
    -
    +
    ); } return (
    -
    +
    {this.flagReasons().toArray()}
    -
    +
    -
    +
    ); } @@ -150,7 +151,6 @@ export default class FlagPostModal extends Modal { reason: this.reason() === 'other' ? null : this.reason(), reasonDetail: this.reasonDetail(), relationships: { - user: app.session.user, post: this.attrs.post, }, }, diff --git a/extensions/flags/js/src/forum/components/FlagsDropdown.js b/extensions/flags/js/src/forum/components/FlagsDropdown.js deleted file mode 100644 index 751d1ce83a..0000000000 --- a/extensions/flags/js/src/forum/components/FlagsDropdown.js +++ /dev/null @@ -1,33 +0,0 @@ -import app from 'flarum/forum/app'; -import NotificationsDropdown from 'flarum/forum/components/NotificationsDropdown'; - -import FlagList from './FlagList'; - -export default class FlagsDropdown extends NotificationsDropdown { - static initAttrs(attrs) { - attrs.label = attrs.label || app.translator.trans('flarum-flags.forum.flagged_posts.tooltip'); - attrs.icon = attrs.icon || 'fas fa-flag'; - - super.initAttrs(attrs); - } - - getMenu() { - return ( -
    - {this.showing && } -
    - ); - } - - goToRoute() { - m.route.set(app.route('flags')); - } - - getUnreadCount() { - return app.flags.cache ? app.flags.cache.length : app.forum.attribute('flagCount'); - } - - getNewCount() { - return app.session.user.attribute('newFlagCount'); - } -} diff --git a/extensions/flags/js/src/forum/components/FlagsDropdown.tsx b/extensions/flags/js/src/forum/components/FlagsDropdown.tsx new file mode 100644 index 0000000000..e82be705b2 --- /dev/null +++ b/extensions/flags/js/src/forum/components/FlagsDropdown.tsx @@ -0,0 +1,34 @@ +import app from 'flarum/forum/app'; +import HeaderDropdown from 'flarum/forum/components/HeaderDropdown'; +import type { IHeaderDropdownAttrs } from 'flarum/forum/components/HeaderDropdown'; +import classList from 'flarum/common/utils/classList'; + +import FlagList from './FlagList'; + +export interface IFlagsDropdownAttrs extends IHeaderDropdownAttrs {} + +export default class FlagsDropdown extends HeaderDropdown { + static initAttrs(attrs: IFlagsDropdownAttrs) { + attrs.className = classList('FlagsDropdown', attrs.className); + attrs.label = attrs.label || app.translator.trans('flarum-flags.forum.flagged_posts.tooltip'); + attrs.icon = attrs.icon || 'fas fa-flag'; + + super.initAttrs(attrs); + } + + getContent() { + return ; + } + + goToRoute() { + m.route.set(app.route('flags')); + } + + getUnreadCount() { + return app.forum.attribute('flagCount'); + } + + getNewCount() { + return app.session.user!.attribute('newFlagCount'); + } +} diff --git a/extensions/flags/js/src/forum/components/FlagsPage.js b/extensions/flags/js/src/forum/components/FlagsPage.js index 6e07ef555a..23db57a02f 100644 --- a/extensions/flags/js/src/forum/components/FlagsPage.js +++ b/extensions/flags/js/src/forum/components/FlagsPage.js @@ -1,5 +1,5 @@ import app from 'flarum/forum/app'; -import Page from 'flarum/components/Page'; +import Page from 'flarum/common/components/Page'; import FlagList from './FlagList'; diff --git a/extensions/flags/js/src/forum/forum.ts b/extensions/flags/js/src/forum/forum.ts new file mode 100644 index 0000000000..c122af15e7 --- /dev/null +++ b/extensions/flags/js/src/forum/forum.ts @@ -0,0 +1,10 @@ +import './addFlagsToPosts'; +import './addFlagControl'; +import './addFlagsDropdown'; + +import './models/Flag'; + +import './components/FlagList'; +import './components/FlagPostModal'; +import './components/FlagsPage'; +import './components/FlagsDropdown'; diff --git a/extensions/flags/js/src/forum/index.ts b/extensions/flags/js/src/forum/index.ts index f0d4a1f0ad..e9a2dde497 100644 --- a/extensions/flags/js/src/forum/index.ts +++ b/extensions/flags/js/src/forum/index.ts @@ -15,8 +15,4 @@ app.initializers.add('flarum-flags', () => { addFlagsToPosts(); }); -// Expose compat API -import flagsCompat from './compat'; -import { compat } from '@flarum/core/forum'; - -Object.assign(compat, flagsCompat); +import './forum'; diff --git a/extensions/flags/js/src/forum/states/FlagListState.js b/extensions/flags/js/src/forum/states/FlagListState.js deleted file mode 100644 index 94c011b4ee..0000000000 --- a/extensions/flags/js/src/forum/states/FlagListState.js +++ /dev/null @@ -1,37 +0,0 @@ -export default class FlagListState { - constructor(app) { - this.app = app; - - /** - * Whether or not the flags are loading. - * - * @type {Boolean} - */ - this.loading = false; - } - - /** - * Load flags into the application's cache if they haven't already - * been loaded. - */ - load() { - if (this.cache && !this.app.session.user.attribute('newFlagCount')) { - return; - } - - this.loading = true; - m.redraw(); - - this.app.store - .find('flags') - .then((flags) => { - this.app.session.user.pushAttributes({ newFlagCount: 0 }); - this.cache = flags.sort((a, b) => b.createdAt() - a.createdAt()); - }) - .catch(() => {}) - .then(() => { - this.loading = false; - m.redraw(); - }); - } -} diff --git a/extensions/flags/js/src/forum/states/FlagListState.tsx b/extensions/flags/js/src/forum/states/FlagListState.tsx new file mode 100644 index 0000000000..95708ba4c2 --- /dev/null +++ b/extensions/flags/js/src/forum/states/FlagListState.tsx @@ -0,0 +1,33 @@ +import type ForumApplication from 'flarum/forum/ForumApplication'; +import type Flag from '../models/Flag'; +import PaginatedListState from 'flarum/common/states/PaginatedListState'; + +export default class FlagListState extends PaginatedListState { + public app: ForumApplication; + + constructor(app: ForumApplication) { + super({}, 1, null); + this.app = app; + } + + get type(): string { + return 'flags'; + } + + /** + * Load flags into the application's cache if they haven't already + * been loaded. + */ + load(): Promise { + if (this.app.session.user?.attribute('newFlagCount')) { + this.pages = []; + this.location = { page: 1 }; + } + + if (this.pages.length > 0) { + return Promise.resolve(); + } + + return super.loadNext(); + } +} diff --git a/extensions/flags/js/tsconfig.json b/extensions/flags/js/tsconfig.json index 0889bd8777..d7b48770ca 100644 --- a/extensions/flags/js/tsconfig.json +++ b/extensions/flags/js/tsconfig.json @@ -9,8 +9,7 @@ // This will output typings to `dist-typings` "declarationDir": "./dist-typings", "paths": { - "flarum/*": ["../../../framework/core/js/dist-typings/*"], - "@flarum/core/*": ["../../../framework/core/js/dist-typings/*"] + "flarum/*": ["../../../framework/core/js/dist-typings/*"] } } } diff --git a/extensions/flags/less/forum.less b/extensions/flags/less/forum.less index 173c58787e..caf53d2eb6 100644 --- a/extensions/flags/less/forum.less +++ b/extensions/flags/less/forum.less @@ -1,6 +1,17 @@ +[data-theme^=light] { + .light-contents-vars(@color: @body-bg-light; @control-color: @body-bg-light; @name: 'flagged-post'); +} + +[data-theme^=dark] { + .light-contents-vars(@color: @body-bg-dark; @control-color: @body-bg-dark; @name: 'flagged-post'); +} + .Post--flagged { + --border-width: 2px; padding-top: 0 !important; - border: 2px solid @primary-color; + padding-left: var(--post-padding); + margin-left: calc(~"0px - var(--post-padding)"); + border: var(--border-width) solid var(--primary-color); } .Post-header .item-flagged { @@ -8,29 +19,22 @@ margin: 0; } .Post-flagged { - background: @primary-color; - margin-top: -2px; - margin-bottom: 20px; - margin-left: -22px; - margin-right: -22px; + background: var(--primary-color); + margin: calc(~"0px - var(--border-width)") calc(~"0px - var(--border-width) - var(--post-padding)") var(--post-padding); padding: 10px; - border-radius: @border-radius @border-radius 0 0; + border-radius: var(--border-radius) var(--border-radius) 0 0; overflow: hidden; - .light-contents(@color: @body-bg; @control-color: @body-bg); + .light-contents(@name: 'flagged-post'); - @media @tablet-up { - margin-left: -22px - 85px; - } + display: flex; + align-items: center; + justify-content: space-between; &, a { - color: @body-bg !important; + color: var(--body-bg) !important; } } .Post-flagged-flags { - @media @tablet-up { - float: left; - } - font-size: 14px; margin: 7px 10px; text-align: left; @@ -42,19 +46,10 @@ font-weight: normal; } .Post-flagged-actions { - @media @tablet-up { - float: right; - } -} -.Post-flagged-actions .Button { - margin-left: 5px; -} - -.FlagsDropdown .Dropdown-toggle { - .Button-label, - .Button-caret { - display: none; - } + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 5px; } .FlagPostModal { @@ -66,7 +61,16 @@ strong { display: block; - color: @text-color; + color: var(--text-color); } } } + +.Flag .HeaderListItem-title { + justify-content: space-between; + flex-wrap: nowrap; +} + +.Flag .HeaderListItem-time { + flex-shrink: 0; +} diff --git a/extensions/flags/migrations/2019_10_22_000000_change_reason_text_col_type.php b/extensions/flags/migrations/2019_10_22_000000_change_reason_text_col_type.php index 5b1af104a7..167a51148f 100644 --- a/extensions/flags/migrations/2019_10_22_000000_change_reason_text_col_type.php +++ b/extensions/flags/migrations/2019_10_22_000000_change_reason_text_col_type.php @@ -13,13 +13,13 @@ return [ 'up' => function (Builder $schema) { $schema->table('flags', function (Blueprint $table) { - $table->text('reason_detail')->change(); + $table->text('reason_detail')->nullable()->change(); }); }, 'down' => function (Builder $schema) { $schema->table('flags', function (Blueprint $table) { - $table->string('reason_detail')->change(); + $table->string('reason_detail')->nullable()->change(); }); } ]; diff --git a/extensions/flags/src/Access/ScopeFlagVisibility.php b/extensions/flags/src/Access/ScopeFlagVisibility.php index 8add2307f1..6b9f40e543 100644 --- a/extensions/flags/src/Access/ScopeFlagVisibility.php +++ b/extensions/flags/src/Access/ScopeFlagVisibility.php @@ -10,7 +10,6 @@ namespace Flarum\Flags\Access; use Flarum\Extension\ExtensionManager; -use Flarum\Tags\Tag; use Flarum\User\User; use Illuminate\Database\Eloquent\Builder; @@ -23,31 +22,26 @@ public function __construct( public function __invoke(User $actor, Builder $query): void { - if ($this->extensions->isEnabled('flarum-tags')) { - $query - ->select('flags.*') - ->leftJoin('posts', 'posts.id', '=', 'flags.post_id') - ->leftJoin('discussions', 'discussions.id', '=', 'posts.discussion_id') - ->whereNotExists(function ($query) use ($actor) { - return $query->selectRaw('1') - ->from('discussion_tag') - ->whereNotIn('tag_id', function ($query) use ($actor) { - Tag::query()->setQuery($query->from('tags'))->whereHasPermission($actor, 'discussion.viewFlags')->select('tags.id'); - }) - ->whereColumn('discussions.id', 'discussion_id'); - }); + $query + ->whereHas('post', function (Builder $query) use ($actor) { + $query->whereVisibleTo($actor); + }) + ->where(function (Builder $query) use ($actor) { + if ($this->extensions->isEnabled('flarum-tags')) { + $query + ->select('flags.*') + ->whereHas('post.discussion.tags', function ($query) use ($actor) { + $query->whereHasPermission($actor, 'discussion.viewFlags'); + }); - if (! $actor->hasPermission('discussion.viewFlags')) { - $query->whereExists(function ($query) { - return $query->selectRaw('1') - ->from('discussion_tag') - ->whereColumn('discussions.id', 'discussion_id'); - }); - } - } + if ($actor->hasPermission('discussion.viewFlags')) { + $query->orWhereDoesntHave('post.discussion.tags'); + } + } - if (! $actor->hasPermission('discussion.viewFlags')) { - $query->orWhere('flags.user_id', $actor->id); - } + if (! $actor->hasPermission('discussion.viewFlags')) { + $query->orWhere('flags.user_id', $actor->id); + } + }); } } diff --git a/extensions/flags/src/AddCanFlagAttribute.php b/extensions/flags/src/AddCanFlagAttribute.php deleted file mode 100644 index 83731dd374..0000000000 --- a/extensions/flags/src/AddCanFlagAttribute.php +++ /dev/null @@ -1,38 +0,0 @@ -getActor()->can('flag', $post) && $this->checkFlagOwnPostSetting($serializer->getActor(), $post); - } - - protected function checkFlagOwnPostSetting(User $actor, Post $post): bool - { - if ($actor->id === $post->user_id) { - // If $actor is the post author, check to see if the setting is enabled - return (bool) $this->settings->get('flarum-flags.can_flag_own'); - } - // $actor is not the post author - return true; - } -} diff --git a/extensions/flags/src/AddFlagsApiAttributes.php b/extensions/flags/src/AddFlagsApiAttributes.php deleted file mode 100755 index f8a2f12925..0000000000 --- a/extensions/flags/src/AddFlagsApiAttributes.php +++ /dev/null @@ -1,40 +0,0 @@ - $serializer->getActor()->hasPermissionLike('discussion.viewFlags') - ]; - - if ($attributes['canViewFlags']) { - $attributes['flagCount'] = (int) $this->getFlagCount($serializer->getActor()); - } - - return $attributes; - } - - protected function getFlagCount(User $actor): int - { - return Flag::whereVisibleTo($actor)->distinct()->count('flags.post_id'); - } -} diff --git a/extensions/flags/src/AddNewFlagCountAttribute.php b/extensions/flags/src/AddNewFlagCountAttribute.php deleted file mode 100644 index 45a1fd829e..0000000000 --- a/extensions/flags/src/AddNewFlagCountAttribute.php +++ /dev/null @@ -1,32 +0,0 @@ -getNewFlagCount($user); - } - - protected function getNewFlagCount(User $actor): int - { - $query = Flag::whereVisibleTo($actor); - - if ($time = $actor->read_flags_at) { - $query->where('flags.created_at', '>', $time); - } - - return $query->distinct()->count('flags.post_id'); - } -} diff --git a/extensions/flags/src/Api/Controller/CreateFlagController.php b/extensions/flags/src/Api/Controller/CreateFlagController.php deleted file mode 100644 index 7d5b5c3763..0000000000 --- a/extensions/flags/src/Api/Controller/CreateFlagController.php +++ /dev/null @@ -1,43 +0,0 @@ -bus->dispatch( - new CreateFlag(RequestUtil::getActor($request), Arr::get($request->getParsedBody(), 'data', [])) - ); - } -} diff --git a/extensions/flags/src/Api/Controller/ListFlagsController.php b/extensions/flags/src/Api/Controller/ListFlagsController.php deleted file mode 100644 index 216f61b05a..0000000000 --- a/extensions/flags/src/Api/Controller/ListFlagsController.php +++ /dev/null @@ -1,54 +0,0 @@ -extractInclude($request); - - $actor->assertRegistered(); - - $actor->read_flags_at = Carbon::now(); - $actor->save(); - - $flags = Flag::whereVisibleTo($actor) - ->latest('flags.created_at') - ->groupBy('post_id') - ->get(); - - if (in_array('post.user', $include)) { - $include[] = 'post.user.groups'; - } - - $this->loadRelations($flags, $include); - - return $flags; - } -} diff --git a/extensions/flags/src/Api/ForumResourceFields.php b/extensions/flags/src/Api/ForumResourceFields.php new file mode 100644 index 0000000000..9438535e3a --- /dev/null +++ b/extensions/flags/src/Api/ForumResourceFields.php @@ -0,0 +1,32 @@ +get(function (object $model, Context $context) { + return $context->getActor()->hasPermissionLike('discussion.viewFlags'); + }), + Schema\Integer::make('flagCount') + ->visible(fn (object $model, Context $context) => $context->getActor()->hasPermissionLike('discussion.viewFlags')) + ->get(function (object $model, Context $context) { + return Flag::whereVisibleTo($context->getActor())->distinct()->count('flags.post_id'); + }), + ]; + } +} diff --git a/extensions/flags/src/Api/PostResourceFields.php b/extensions/flags/src/Api/PostResourceFields.php new file mode 100644 index 0000000000..f4863e0f23 --- /dev/null +++ b/extensions/flags/src/Api/PostResourceFields.php @@ -0,0 +1,42 @@ +get(function (Post $post, Context $context) { + $actor = $context->getActor(); + + return $actor->can('flag', $post) && ( + // $actor is not the post author + $actor->id !== $post->user_id + // If $actor is the post author, check to see if the setting is enabled + || ((bool) $this->settings->get('flarum-flags.can_flag_own')) + ); + }), + Schema\Relationship\ToMany::make('flags') + ->includable(), + ]; + } +} diff --git a/extensions/flags/src/Api/Resource/FlagResource.php b/extensions/flags/src/Api/Resource/FlagResource.php new file mode 100644 index 0000000000..aec1aefd07 --- /dev/null +++ b/extensions/flags/src/Api/Resource/FlagResource.php @@ -0,0 +1,168 @@ + + */ +class FlagResource extends AbstractDatabaseResource +{ + public function __construct( + protected PostRepository $posts, + protected TranslatorInterface $translator, + protected SettingsRepositoryInterface $settings, + ) { + } + + public function type(): string + { + return 'flags'; + } + + public function model(): string + { + return Flag::class; + } + + public function query(Context $context): object + { + if ($context->listing(self::class)) { + $query = Flag::query()->whenPgSql( + fn (Builder $query) => $query->distinct('post_id')->orderBy('post_id'), + else: fn (Builder $query) => $query->groupBy('post_id') + ); + + $this->scope($query, $context); + + return $query; + } + + return parent::query($context); + } + + public function scope(Builder $query, Context $context): void + { + $query->whereVisibleTo($context->getActor()); + } + + public function newModel(Context $context): object + { + if ($context->creating(self::class)) { + Flag::unguard(); + + return Flag::query()->firstOrNew([ + 'post_id' => (int) Arr::get($context->body(), 'data.relationships.post.data.id'), + 'user_id' => $context->getActor()->id + ], [ + 'type' => 'user', + ]); + } + + return parent::newModel($context); + } + + public function endpoints(): array + { + return [ + Endpoint\Create::make() + ->authenticated() + ->defaultInclude(['post', 'post.flags', 'user']), + Endpoint\Index::make() + ->authenticated() + ->defaultInclude(['user', 'post', 'post.user', 'post.discussion']) + ->defaultSort('-createdAt') + ->paginate() + ->after(function (FlarumContext $context, $data) { + $actor = $context->getActor(); + + $actor->read_flags_at = Carbon::now(); + $actor->save(); + + return $data; + }), + ]; + } + + public function fields(): array + { + return [ + Schema\Str::make('type'), + Schema\Str::make('reason') + ->writableOnCreate() + ->nullable() + ->requiredOnCreateWithout(['reasonDetail']) + ->validationMessages([ + 'reason.required_without' => $this->translator->trans('flarum-flags.forum.flag_post.reason_missing_message'), + ]), + Schema\Str::make('reasonDetail') + ->writableOnCreate() + ->nullable() + ->requiredOnCreateWithout(['reason']) + ->validationMessages([ + 'reasonDetail.required_without' => $this->translator->trans('flarum-flags.forum.flag_post.reason_missing_message'), + ]), + Schema\DateTime::make('createdAt'), + + Schema\Relationship\ToOne::make('post') + ->includable() + ->writable(fn (Flag $flag, FlarumContext $context) => $context->creating()) + ->set(function (Flag $flag, Post $post, FlarumContext $context) { + if (! ($post instanceof CommentPost)) { + throw new InvalidParameterException; + } + + $actor = $context->getActor(); + + $actor->assertCan('flag', $post); + + if ($actor->id === $post->user_id && ! $this->settings->get('flarum-flags.can_flag_own')) { + throw new PermissionDeniedException; + } + + $flag->post_id = $post->id; + }), + Schema\Relationship\ToOne::make('user') + ->includable(), + ]; + } + + public function sorts(): array + { + return [ + SortColumn::make('createdAt'), + ]; + } + + public function created(object $model, Context $context): ?object + { + $this->events->dispatch(new Created($model, $context->getActor(), $context->body())); + + return parent::created($model, $context); + } +} diff --git a/extensions/flags/src/Api/Serializer/FlagSerializer.php b/extensions/flags/src/Api/Serializer/FlagSerializer.php deleted file mode 100644 index f68a8bfd38..0000000000 --- a/extensions/flags/src/Api/Serializer/FlagSerializer.php +++ /dev/null @@ -1,48 +0,0 @@ - $model->type, - 'reason' => $model->reason, - 'reasonDetail' => $model->reason_detail, - 'createdAt' => $this->formatDate($model->created_at), - ]; - } - - protected function post(Flag $flag): ?Relationship - { - return $this->hasOne($flag, PostSerializer::class); - } - - protected function user(Flag $flag): ?Relationship - { - return $this->hasOne($flag, BasicUserSerializer::class); - } -} diff --git a/extensions/flags/src/Api/UserResourceFields.php b/extensions/flags/src/Api/UserResourceFields.php new file mode 100644 index 0000000000..3bb50ec675 --- /dev/null +++ b/extensions/flags/src/Api/UserResourceFields.php @@ -0,0 +1,36 @@ +visible(fn (User $user, Context $context) => $context->getActor()->id === $user->id) + ->get(function (User $user, Context $context) { + $actor = $context->getActor(); + $query = Flag::whereVisibleTo($actor); + + if ($time = $actor->read_flags_at) { + $query->where('flags.created_at', '>', $time); + } + + return $query->distinct()->count('flags.post_id'); + }), + ]; + } +} diff --git a/extensions/flags/src/Command/CreateFlag.php b/extensions/flags/src/Command/CreateFlag.php deleted file mode 100644 index 2c7f234809..0000000000 --- a/extensions/flags/src/Command/CreateFlag.php +++ /dev/null @@ -1,21 +0,0 @@ -actor; - $data = $command->data; - - $postId = Arr::get($data, 'relationships.post.data.id'); - $post = $this->posts->findOrFail($postId, $actor); - - if (! ($post instanceof CommentPost)) { - throw new InvalidParameterException; - } - - $actor->assertCan('flag', $post); - - if ($actor->id === $post->user_id && ! $this->settings->get('flarum-flags.can_flag_own')) { - throw new PermissionDeniedException(); - } - - if (Arr::get($data, 'attributes.reason') === null && Arr::get($data, 'attributes.reasonDetail') === '') { - throw new ValidationException([ - 'message' => $this->translator->trans('flarum-flags.forum.flag_post.reason_missing_message') - ]); - } - - Flag::unguard(); - - $flag = Flag::firstOrNew([ - 'post_id' => $post->id, - 'user_id' => $actor->id - ]); - - $flag->post_id = $post->id; - $flag->user_id = $actor->id; - $flag->type = 'user'; - $flag->reason = Arr::get($data, 'attributes.reason'); - $flag->reason_detail = Arr::get($data, 'attributes.reasonDetail'); - $flag->created_at = Carbon::now(); - - $flag->save(); - - $this->events->dispatch(new Created($flag, $actor, $data)); - - return $flag; - } -} diff --git a/extensions/flags/src/Command/DeleteFlagsHandler.php b/extensions/flags/src/Command/DeleteFlagsHandler.php index ffb4e008e0..be90e591ab 100644 --- a/extensions/flags/src/Command/DeleteFlagsHandler.php +++ b/extensions/flags/src/Command/DeleteFlagsHandler.php @@ -10,7 +10,6 @@ namespace Flarum\Flags\Command; use Flarum\Flags\Event\Deleting; -use Flarum\Flags\Event\FlagsWillBeDeleted; use Flarum\Post\Post; use Flarum\Post\PostRepository; use Illuminate\Events\Dispatcher; @@ -31,9 +30,6 @@ public function handle(DeleteFlags $command): Post $actor->assertCan('viewFlags', $post->discussion); - // Deprecated, removed v2.0 - $this->events->dispatch(new FlagsWillBeDeleted($post, $actor, $command->data)); - foreach ($post->flags as $flag) { $this->events->dispatch(new Deleting($flag, $actor, $command->data)); } diff --git a/extensions/flags/src/Event/FlagsWillBeDeleted.php b/extensions/flags/src/Event/FlagsWillBeDeleted.php deleted file mode 100644 index d2f4265917..0000000000 --- a/extensions/flags/src/Event/FlagsWillBeDeleted.php +++ /dev/null @@ -1,27 +0,0 @@ - 'datetime']; diff --git a/extensions/flags/src/FlagFactory.php b/extensions/flags/src/FlagFactory.php new file mode 100644 index 0000000000..c73106528b --- /dev/null +++ b/extensions/flags/src/FlagFactory.php @@ -0,0 +1,30 @@ + 'user', + 'post_id' => Post::factory(), + 'user_id' => User::factory(), + 'reason' => $this->faker->sentence, + 'reason_detail' => $this->faker->sentence, + 'created_at' => Carbon::now(), + ]; + } +} diff --git a/extensions/flags/src/PrepareFlagsApiData.php b/extensions/flags/src/PrepareFlagsApiData.php deleted file mode 100755 index 4442255d26..0000000000 --- a/extensions/flags/src/PrepareFlagsApiData.php +++ /dev/null @@ -1,64 +0,0 @@ -relationLoaded('posts')) { - $posts = $data->getRelation('posts'); - } - } - - if ($controller instanceof Controller\ListPostsController) { - $posts = $data->all(); - } - - if ($controller instanceof Controller\ShowPostController) { - $posts = [$data]; - } - - if ($controller instanceof CreateFlagController) { - $posts = [$data->post]; - } - - if (isset($posts)) { - $actor = RequestUtil::getActor($request); - $postsWithPermission = []; - - foreach ($posts as $post) { - if (is_object($post)) { - $post->setRelation('flags', null); - - if ($actor->can('viewFlags', $post->discussion)) { - $postsWithPermission[] = $post; - } - } - } - - if (count($postsWithPermission)) { - (new Collection($postsWithPermission)) - ->load('flags', 'flags.user'); - } - } - } -} diff --git a/extensions/flags/tests/integration/api/flags/ListTest.php b/extensions/flags/tests/integration/api/flags/ListTest.php index 7ab74e4669..33ace7c7e7 100644 --- a/extensions/flags/tests/integration/api/flags/ListTest.php +++ b/extensions/flags/tests/integration/api/flags/ListTest.php @@ -9,10 +9,17 @@ namespace Flarum\Flags\Tests\integration\api\flags; +use Carbon\Carbon; +use Flarum\Discussion\Discussion; +use Flarum\Flags\Flag; use Flarum\Group\Group; +use Flarum\Post\Post; use Flarum\Testing\integration\RetrievesAuthorizedUsers; use Flarum\Testing\integration\TestCase; +use Flarum\User\User; +use Illuminate\Database\PostgresConnection; use Illuminate\Support\Arr; +use PHPUnit\Framework\Attributes\Test; class ListTest extends TestCase { @@ -28,7 +35,7 @@ protected function setUp(): void $this->extension('flarum-flags'); $this->prepareDatabase([ - 'users' => [ + User::class => [ $this->normalUser(), [ 'id' => 3, @@ -44,28 +51,28 @@ protected function setUp(): void 'group_permission' => [ ['group_id' => Group::MODERATOR_ID, 'permission' => 'discussion.viewFlags'], ], - 'discussions' => [ + Discussion::class => [ ['id' => 1, 'title' => '', 'user_id' => 1, 'comment_count' => 1], ], - 'posts' => [ + Post::class => [ ['id' => 1, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '

    '], ['id' => 2, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '

    '], ['id' => 3, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '

    '], + ['id' => 4, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '

    ', 'is_private' => true], ], - 'flags' => [ - ['id' => 1, 'post_id' => 1, 'user_id' => 1], - ['id' => 2, 'post_id' => 1, 'user_id' => 2], - ['id' => 3, 'post_id' => 1, 'user_id' => 3], - ['id' => 4, 'post_id' => 2, 'user_id' => 2], - ['id' => 5, 'post_id' => 3, 'user_id' => 1], + Flag::class => [ + ['id' => 1, 'post_id' => 1, 'user_id' => 1, 'created_at' => Carbon::now()->addMinutes(2)], + ['id' => 2, 'post_id' => 1, 'user_id' => 2, 'created_at' => Carbon::now()->addMinutes(3)], + ['id' => 3, 'post_id' => 1, 'user_id' => 3, 'created_at' => Carbon::now()->addMinutes(4)], + ['id' => 4, 'post_id' => 2, 'user_id' => 2, 'created_at' => Carbon::now()->addMinutes(5)], + ['id' => 5, 'post_id' => 3, 'user_id' => 1, 'created_at' => Carbon::now()->addMinutes(6)], + ['id' => 6, 'post_id' => 4, 'user_id' => 1, 'created_at' => Carbon::now()->addMinutes(7)], ] ]); } - /** - * @test - */ - public function admin_can_see_one_flag_per_post() + #[Test] + public function admin_can_see_one_flag_per_visible_post() { $response = $this->send( $this->request('GET', '/api/flags', [ @@ -73,18 +80,23 @@ public function admin_can_see_one_flag_per_post() ]) ); - $this->assertEquals(200, $response->getStatusCode()); + $body = $response->getBody()->getContents(); - $data = json_decode($response->getBody()->getContents(), true)['data']; + $this->assertEquals(200, $response->getStatusCode(), $body); + + $data = json_decode($body, true)['data']; $ids = Arr::pluck($data, 'id'); - $this->assertEqualsCanonicalizing(['1', '4', '5'], $ids); + + if ($this->database() instanceof PostgresConnection) { + $this->assertEqualsCanonicalizing(['3', '4', '5'], $ids); + } else { + $this->assertEqualsCanonicalizing(['1', '4', '5'], $ids); + } } - /** - * @test - */ - public function regular_user_sees_own_flags() + #[Test] + public function regular_user_sees_own_flags_of_visible_posts() { $response = $this->send( $this->request('GET', '/api/flags', [ @@ -100,10 +112,8 @@ public function regular_user_sees_own_flags() $this->assertEqualsCanonicalizing(['2', '4'], $ids); } - /** - * @test - */ - public function mod_can_see_one_flag_per_post() + #[Test] + public function mod_can_see_one_flag_per_visible_post() { $response = $this->send( $this->request('GET', '/api/flags', [ @@ -116,12 +126,10 @@ public function mod_can_see_one_flag_per_post() $data = json_decode($response->getBody()->getContents(), true)['data']; $ids = Arr::pluck($data, 'id'); - $this->assertEqualsCanonicalizing(['1', '4', '5'], $ids); + $this->assertCount(3, $data); } - /** - * @test - */ + #[Test] public function guest_cant_see_flags() { $response = $this->send( diff --git a/extensions/flags/tests/integration/api/flags/ListWithTagsTest.php b/extensions/flags/tests/integration/api/flags/ListWithTagsTest.php index 6a86e0f0eb..3dc8ae6b9b 100644 --- a/extensions/flags/tests/integration/api/flags/ListWithTagsTest.php +++ b/extensions/flags/tests/integration/api/flags/ListWithTagsTest.php @@ -9,10 +9,17 @@ namespace Flarum\Flags\Tests\integration\api\flags; +use Flarum\Discussion\Discussion; +use Flarum\Flags\Flag; use Flarum\Group\Group; +use Flarum\Post\Post; +use Flarum\Tags\Tag; use Flarum\Testing\integration\RetrievesAuthorizedUsers; use Flarum\Testing\integration\TestCase; +use Flarum\User\User; use Illuminate\Support\Arr; +use Illuminate\Support\Carbon; +use PHPUnit\Framework\Attributes\Test; class ListWithTagsTest extends TestCase { @@ -29,13 +36,13 @@ protected function setUp(): void $this->extension('flarum-tags'); $this->prepareDatabase([ - 'tags' => [ + Tag::class => [ ['id' => 1, 'name' => 'Unrestricted', 'slug' => '1', 'position' => 0, 'parent_id' => null], ['id' => 2, 'name' => 'Mods can view discussions', 'slug' => '2', 'position' => 0, 'parent_id' => null, 'is_restricted' => true], ['id' => 3, 'name' => 'Mods can view flags', 'slug' => '3', 'position' => 0, 'parent_id' => null, 'is_restricted' => true], ['id' => 4, 'name' => 'Mods can view discussions and flags', 'slug' => '4', 'position' => 0, 'parent_id' => null, 'is_restricted' => true], ], - 'users' => [ + User::class => [ $this->normalUser(), [ 'id' => 3, @@ -50,12 +57,12 @@ protected function setUp(): void ], 'group_permission' => [ ['group_id' => Group::MODERATOR_ID, 'permission' => 'discussion.viewFlags'], - ['group_id' => Group::MODERATOR_ID, 'permission' => 'tag2.viewDiscussions'], + ['group_id' => Group::MODERATOR_ID, 'permission' => 'tag2.viewForum'], ['group_id' => Group::MODERATOR_ID, 'permission' => 'tag3.discussion.viewFlags'], - ['group_id' => Group::MODERATOR_ID, 'permission' => 'tag4.viewDiscussions'], + ['group_id' => Group::MODERATOR_ID, 'permission' => 'tag4.viewForum'], ['group_id' => Group::MODERATOR_ID, 'permission' => 'tag4.discussion.viewFlags'], ], - 'discussions' => [ + Discussion::class => [ ['id' => 1, 'title' => 'no tags', 'user_id' => 1, 'comment_count' => 1], ['id' => 2, 'title' => 'has tags where mods can view discussions but not flags', 'user_id' => 1, 'comment_count' => 1], ['id' => 3, 'title' => 'has tags where mods can view flags but not discussions', 'user_id' => 1, 'comment_count' => 1], @@ -68,7 +75,7 @@ protected function setUp(): void ['discussion_id' => 4, 'tag_id' => 4], ['discussion_id' => 5, 'tag_id' => 1], ], - 'posts' => [ + Post::class => [ // From regular ListTest ['id' => 1, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '

    '], ['id' => 2, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '

    '], @@ -79,25 +86,23 @@ protected function setUp(): void ['id' => 6, 'discussion_id' => 4, 'user_id' => 1, 'type' => 'comment', 'content' => '

    '], ['id' => 7, 'discussion_id' => 5, 'user_id' => 1, 'type' => 'comment', 'content' => '

    '], ], - 'flags' => [ + Flag::class => [ // From regular ListTest - ['id' => 1, 'post_id' => 1, 'user_id' => 1], - ['id' => 2, 'post_id' => 1, 'user_id' => 2], - ['id' => 3, 'post_id' => 1, 'user_id' => 3], - ['id' => 4, 'post_id' => 2, 'user_id' => 2], - ['id' => 5, 'post_id' => 3, 'user_id' => 1], + ['id' => 1, 'post_id' => 1, 'user_id' => 1, 'created_at' => Carbon::now()->addMinutes(2)], + ['id' => 2, 'post_id' => 1, 'user_id' => 2, 'created_at' => Carbon::now()->addMinutes(3)], + ['id' => 3, 'post_id' => 1, 'user_id' => 3, 'created_at' => Carbon::now()->addMinutes(4)], + ['id' => 4, 'post_id' => 2, 'user_id' => 2, 'created_at' => Carbon::now()->addMinutes(5)], + ['id' => 5, 'post_id' => 3, 'user_id' => 1, 'created_at' => Carbon::now()->addMinutes(6)], // In tags - ['id' => 6, 'post_id' => 4, 'user_id' => 1], - ['id' => 7, 'post_id' => 5, 'user_id' => 1], - ['id' => 8, 'post_id' => 6, 'user_id' => 1], - ['id' => 9, 'post_id' => 7, 'user_id' => 1], + ['id' => 6, 'post_id' => 4, 'user_id' => 1, 'created_at' => Carbon::now()->addMinutes(7)], + ['id' => 7, 'post_id' => 5, 'user_id' => 1, 'created_at' => Carbon::now()->addMinutes(8)], + ['id' => 8, 'post_id' => 6, 'user_id' => 1, 'created_at' => Carbon::now()->addMinutes(9)], + ['id' => 9, 'post_id' => 7, 'user_id' => 1, 'created_at' => Carbon::now()->addMinutes(10)], ] ]); } - /** - * @test - */ + #[Test] public function admin_can_see_one_flag_per_post() { $response = $this->send( @@ -106,17 +111,17 @@ public function admin_can_see_one_flag_per_post() ]) ); - $this->assertEquals(200, $response->getStatusCode()); + $body = $response->getBody()->getContents(); - $data = json_decode($response->getBody()->getContents(), true)['data']; + $this->assertEquals(200, $response->getStatusCode(), $body); + + $data = json_decode($body, true)['data']; $ids = Arr::pluck($data, 'id'); - $this->assertEqualsCanonicalizing(['1', '4', '5', '6', '7', '8', '9'], $ids); + $this->assertCount(7, $data); } - /** - * @test - */ + #[Test] public function regular_user_sees_own_flags() { $response = $this->send( @@ -133,9 +138,7 @@ public function regular_user_sees_own_flags() $this->assertEqualsCanonicalizing(['2', '4'], $ids); } - /** - * @test - */ + #[Test] public function mod_can_see_one_flag_per_post() { $response = $this->send( @@ -151,12 +154,10 @@ public function mod_can_see_one_flag_per_post() $ids = Arr::pluck($data, 'id'); // 7 is included, even though mods can't view discussions. // This is because the UI doesnt allow discussions.viewFlags without viewDiscussions. - $this->assertEqualsCanonicalizing(['1', '4', '5', '7', '8', '9'], $ids); + $this->assertCount(5, $data); } - /** - * @test - */ + #[Test] public function guest_cant_see_flags() { $response = $this->send( diff --git a/extensions/flags/tests/integration/api/posts/IncludeFlagsVisibilityTest.php b/extensions/flags/tests/integration/api/posts/IncludeFlagsVisibilityTest.php new file mode 100644 index 0000000000..1bb0e992c4 --- /dev/null +++ b/extensions/flags/tests/integration/api/posts/IncludeFlagsVisibilityTest.php @@ -0,0 +1,150 @@ +extension('flarum-tags', 'flarum-flags'); + + $this->prepareDatabase([ + User::class => [ + $this->normalUser(), + [ + 'id' => 3, + 'username' => 'mod', + 'password' => '$2y$10$LO59tiT7uggl6Oe23o/O6.utnF6ipngYjvMvaxo1TciKqBttDNKim', // BCrypt hash for "too-obscure" + 'email' => 'normal2@machine.local', + 'is_email_confirmed' => 1, + ], + [ + 'id' => 4, + 'username' => 'tod', + 'password' => '$2y$10$LO59tiT7uggl6Oe23o/O6.utnF6ipngYjvMvaxo1TciKqBttDNKim', // BCrypt hash for "too-obscure" + 'email' => 'tod@machine.local', + 'is_email_confirmed' => 1, + ], + [ + 'id' => 5, + 'username' => 'ted', + 'password' => '$2y$10$LO59tiT7uggl6Oe23o/O6.utnF6ipngYjvMvaxo1TciKqBttDNKim', // BCrypt hash for "too-obscure" + 'email' => 'ted@machine.local', + 'is_email_confirmed' => 1, + ], + ], + 'group_user' => [ + ['group_id' => 5, 'user_id' => 2], + ['group_id' => 6, 'user_id' => 3], + ], + Group::class => [ + ['id' => 5, 'name_singular' => 'group5', 'name_plural' => 'group5', 'color' => null, 'icon' => 'fas fa-crown', 'is_hidden' => false], + ['id' => 6, 'name_singular' => 'group1', 'name_plural' => 'group1', 'color' => null, 'icon' => 'fas fa-cog', 'is_hidden' => false], + ], + 'group_permission' => [ + ['group_id' => Group::MEMBER_ID, 'permission' => 'tag1.viewForum'], + ['group_id' => 5, 'permission' => 'tag1.viewForum'], + ['group_id' => 5, 'permission' => 'discussion.viewFlags'], + ['group_id' => 6, 'permission' => 'tag1.discussion.viewFlags'], + ['group_id' => 6, 'permission' => 'tag1.viewForum'], + ], + Tag::class => [ + ['id' => 1, 'name' => 'Tag 1', 'slug' => 'tag-1', 'is_primary' => false, 'position' => null, 'parent_id' => null, 'is_restricted' => true], + ['id' => 2, 'name' => 'Tag 2', 'slug' => 'tag-2', 'is_primary' => true, 'position' => 2, 'parent_id' => null, 'is_restricted' => false], + ], + Discussion::class => [ + ['id' => 1, 'title' => 'Test1', 'user_id' => 1, 'comment_count' => 1], + ['id' => 2, 'title' => 'Test2', 'user_id' => 1, 'comment_count' => 1], + ], + 'discussion_tag' => [ + ['discussion_id' => 1, 'tag_id' => 1], + ['discussion_id' => 2, 'tag_id' => 2], + ], + Post::class => [ + ['id' => 1, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '

    '], + ['id' => 2, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '

    '], + ['id' => 3, 'discussion_id' => 1, 'user_id' => 1, 'type' => 'comment', 'content' => '

    '], + + ['id' => 4, 'discussion_id' => 2, 'user_id' => 1, 'type' => 'comment', 'content' => '

    '], + ['id' => 5, 'discussion_id' => 2, 'user_id' => 1, 'type' => 'comment', 'content' => '

    '], + ], + Flag::class => [ + ['id' => 1, 'post_id' => 1, 'user_id' => 1], + ['id' => 2, 'post_id' => 1, 'user_id' => 5], + ['id' => 3, 'post_id' => 1, 'user_id' => 3], + ['id' => 4, 'post_id' => 2, 'user_id' => 5], + ['id' => 5, 'post_id' => 3, 'user_id' => 1], + + ['id' => 6, 'post_id' => 4, 'user_id' => 1], + ['id' => 7, 'post_id' => 5, 'user_id' => 5], + ['id' => 8, 'post_id' => 5, 'user_id' => 5], + ], + ]); + } + + #[Test] + #[DataProvider('listFlagsIncludesDataProvider')] + public function user_sees_where_allowed_with_included_tags(int $actorId, array $expectedIncludes) + { + $response = $this->send( + $this->request('GET', '/api/posts', [ + 'authenticatedAs' => $actorId, + ])->withQueryParams([ + 'include' => 'flags' + ]) + ); + + $this->assertEquals(200, $response->getStatusCode()); + + $responseBody = json_decode($response->getBody()->getContents(), true); + + $data = $responseBody['data']; + + $this->assertEqualsCanonicalizing(['1', '2', '3', '4', '5'], Arr::pluck($data, 'id')); + $this->assertEqualsCanonicalizing( + $expectedIncludes, + collect($responseBody['included'] ?? []) + ->filter(fn ($include) => $include['type'] === 'flags') + ->pluck('id') + ->map(strval(...)) + ->all() + ); + } + + public static function listFlagsIncludesDataProvider(): array + { + return [ + 'admin_sees_all' => [1, [1, 2, 3, 4, 5, 6, 7, 8]], + 'user_with_general_permission_sees_where_unrestricted_tag' => [2, [6, 7, 8]], + 'user_with_tag1_permission_sees_tag1_flags' => [3, [1, 2, 3, 4, 5]], + 'normal_user_sees_none' => [4, []], + 'normal_user_sees_own' => [5, [2, 7, 4, 8]], + ]; + } +} diff --git a/extensions/flags/tests/phpunit.integration.xml b/extensions/flags/tests/phpunit.integration.xml index 7319d929ae..e3e14eab99 100644 --- a/extensions/flags/tests/phpunit.integration.xml +++ b/extensions/flags/tests/phpunit.integration.xml @@ -1,22 +1,20 @@ - + ../src/ - + ./integration diff --git a/extensions/flags/tests/phpunit.unit.xml b/extensions/flags/tests/phpunit.unit.xml index 66262dd9ff..67367a782d 100644 --- a/extensions/flags/tests/phpunit.unit.xml +++ b/extensions/flags/tests/phpunit.unit.xml @@ -1,28 +1,23 @@ - + ../src/ - + ./unit - - - diff --git a/extensions/lang-english/.gitignore b/extensions/lang-english/.gitignore index 4ebb168a05..e60e512061 100644 --- a/extensions/lang-english/.gitignore +++ b/extensions/lang-english/.gitignore @@ -4,6 +4,7 @@ composer.phar .DS_Store Thumbs.db +tests/.phpunit.cache tests/.phpunit.result.cache /tests/integration/tmp .vagrant diff --git a/extensions/lang-english/LICENSE b/extensions/lang-english/LICENSE index 54ac29ab2c..bb6e15d87e 100644 --- a/extensions/lang-english/LICENSE +++ b/extensions/lang-english/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019-2021 Stichting Flarum (Flarum Foundation) +Copyright (c) 2019-2024 Stichting Flarum (Flarum Foundation) Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/extensions/likes/.gitignore b/extensions/likes/.gitignore index 4ebb168a05..e60e512061 100644 --- a/extensions/likes/.gitignore +++ b/extensions/likes/.gitignore @@ -4,6 +4,7 @@ composer.phar .DS_Store Thumbs.db +tests/.phpunit.cache tests/.phpunit.result.cache /tests/integration/tmp .vagrant diff --git a/extensions/likes/LICENSE b/extensions/likes/LICENSE index 54ac29ab2c..bb6e15d87e 100644 --- a/extensions/likes/LICENSE +++ b/extensions/likes/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019-2021 Stichting Flarum (Flarum Foundation) +Copyright (c) 2019-2024 Stichting Flarum (Flarum Foundation) Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/extensions/likes/extend.php b/extensions/likes/extend.php index c59a497e58..eb12697c17 100644 --- a/extensions/likes/extend.php +++ b/extensions/likes/extend.php @@ -9,19 +9,20 @@ namespace Flarum\Likes; -use Flarum\Api\Controller; -use Flarum\Api\Serializer\BasicUserSerializer; -use Flarum\Api\Serializer\PostSerializer; +use Flarum\Api\Endpoint; +use Flarum\Api\Resource; use Flarum\Extend; -use Flarum\Likes\Api\LoadLikesRelationship; +use Flarum\Likes\Api\PostResourceFields; use Flarum\Likes\Event\PostWasLiked; use Flarum\Likes\Event\PostWasUnliked; use Flarum\Likes\Notification\PostLikedBlueprint; use Flarum\Likes\Query\LikedByFilter; use Flarum\Likes\Query\LikedFilter; -use Flarum\Post\Filter\PostFilterer; +use Flarum\Post\Event\Deleted; +use Flarum\Post\Filter\PostSearcher; use Flarum\Post\Post; -use Flarum\User\Filter\UserFilterer; +use Flarum\Search\Database\DatabaseSearchDriver; +use Flarum\User\Search\UserSearcher; use Flarum\User\User; return [ @@ -38,49 +39,27 @@ new Extend\Locales(__DIR__.'/locale'), (new Extend\Notification()) - ->type(PostLikedBlueprint::class, PostSerializer::class, ['alert']), + ->type(PostLikedBlueprint::class, ['alert']), - (new Extend\ApiSerializer(PostSerializer::class)) - ->hasMany('likes', BasicUserSerializer::class) - ->attribute('canLike', function (PostSerializer $serializer, $model) { - return (bool) $serializer->getActor()->can('like', $model); - }) - ->attribute('likesCount', function (PostSerializer $serializer, $model) { - return $model->getAttribute('likes_count') ?: 0; - }), - - (new Extend\ApiController(Controller\ShowDiscussionController::class)) - ->addInclude('posts.likes') - ->loadWhere('posts.likes', LoadLikesRelationship::mutateRelation(...)) - ->prepareDataForSerialization(LoadLikesRelationship::countRelation(...)), - - (new Extend\ApiController(Controller\ListPostsController::class)) - ->addInclude('likes') - ->loadWhere('likes', LoadLikesRelationship::mutateRelation(...)) - ->prepareDataForSerialization(LoadLikesRelationship::countRelation(...)), - (new Extend\ApiController(Controller\ShowPostController::class)) - ->addInclude('likes') - ->loadWhere('likes', LoadLikesRelationship::mutateRelation(...)) - ->prepareDataForSerialization(LoadLikesRelationship::countRelation(...)), - (new Extend\ApiController(Controller\CreatePostController::class)) - ->addInclude('likes') - ->loadWhere('likes', LoadLikesRelationship::mutateRelation(...)) - ->prepareDataForSerialization(LoadLikesRelationship::countRelation(...)), - (new Extend\ApiController(Controller\UpdatePostController::class)) - ->addInclude('likes') - ->loadWhere('likes', LoadLikesRelationship::mutateRelation(...)) - ->prepareDataForSerialization(LoadLikesRelationship::countRelation(...)), + (new Extend\ApiResource(Resource\PostResource::class)) + ->fields(PostResourceFields::class) + ->endpoint( + [Endpoint\Index::class, Endpoint\Show::class, Endpoint\Create::class, Endpoint\Update::class], + function (Endpoint\Index|Endpoint\Show|Endpoint\Create|Endpoint\Update $endpoint): Endpoint\Endpoint { + return $endpoint->addDefaultInclude(['likes']); + } + ), (new Extend\Event()) ->listen(PostWasLiked::class, Listener\SendNotificationWhenPostIsLiked::class) ->listen(PostWasUnliked::class, Listener\SendNotificationWhenPostIsUnliked::class) - ->subscribe(Listener\SaveLikesToDatabase::class), - - (new Extend\Filter(PostFilterer::class)) - ->addFilter(LikedByFilter::class), + ->listen(Deleted::class, function (Deleted $event) { + $event->post->likes()->detach(); + }), - (new Extend\Filter(UserFilterer::class)) - ->addFilter(LikedFilter::class), + (new Extend\SearchDriver(DatabaseSearchDriver::class)) + ->addFilter(PostSearcher::class, LikedByFilter::class) + ->addFilter(UserSearcher::class, LikedFilter::class), (new Extend\Settings()) ->default('flarum-likes.like_own_post', true), diff --git a/extensions/likes/js/dist/admin.js b/extensions/likes/js/dist/admin.js index dc7ef4fc8d..b9a05234ac 100644 --- a/extensions/likes/js/dist/admin.js +++ b/extensions/likes/js/dist/admin.js @@ -1,2 +1,2 @@ -(()=>{var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};(()=>{"use strict";e.r(t);const r=flarum.core.compat["admin/app"];var s=e.n(r);s().initializers.add("flarum-likes",(()=>{s().extensionData.for("flarum-likes").registerPermission({icon:"far fa-thumbs-up",label:s().translator.trans("flarum-likes.admin.permissions.like_posts_label"),permission:"discussion.likePosts"},"reply").registerSetting({setting:"flarum-likes.like_own_post",type:"bool",label:s().translator.trans("flarum-likes.admin.settings.like_own_posts_label"),help:s().translator.trans("flarum-likes.admin.settings.like_own_posts_help")})}))})(),module.exports=t})(); +(()=>{var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var s in t)e.o(t,s)&&!e.o(r,s)&&Object.defineProperty(r,s,{enumerable:!0,get:t[s]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};(()=>{"use strict";e.r(r),e.d(r,{extend:()=>u});const t=flarum.reg.get("core","admin/app");var s=e.n(t);const a=flarum.reg.get("core","common/extenders");var l=e.n(a);const n=flarum.reg.get("core","common/query/IGambit"),o=flarum.reg.get("core","common/app");var i=e.n(o);class m extends n.KeyValueGambit{key(){return i().translator.trans("flarum-likes.lib.gambits.posts.likedBy.key",{},!0)}hint(){return i().translator.trans("flarum-likes.lib.gambits.posts.likedBy.hint",{},!0)}filterKey(){return"likedBy"}}flarum.reg.add("flarum-likes","common/query/posts/LikedByGambit",m);const u=[(new(l().Search)).gambit("posts",m),(new(l().Admin)).permission((()=>({icon:"far fa-thumbs-up",label:s().translator.trans("flarum-likes.admin.permissions.like_posts_label"),permission:"discussion.likePosts"})),"reply").setting((()=>({setting:"flarum-likes.like_own_post",type:"bool",label:s().translator.trans("flarum-likes.admin.settings.like_own_posts_label"),help:s().translator.trans("flarum-likes.admin.settings.like_own_posts_help")})))];s().initializers.add("flarum-likes",(()=>{}))})(),module.exports=r})(); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/extensions/likes/js/dist/admin.js.map b/extensions/likes/js/dist/admin.js.map index bdcad35275..04cdb061cf 100644 --- a/extensions/likes/js/dist/admin.js.map +++ b/extensions/likes/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCExDC,IAAAA,aAAAA,IAAqB,gBAAgB,KACnCA,IAAAA,cAAAA,IACO,gBACJC,mBACC,CACEC,KAAM,mBACNC,MAAOH,IAAAA,WAAAA,MAAqB,mDAC5BI,WAAY,wBAEd,SAEDC,gBAAgB,CACfC,QAAS,6BACTC,KAAM,OACNJ,MAAOH,IAAAA,WAAAA,MAAqB,oDAC5BQ,KAAMR,IAAAA,WAAAA,MAAqB,oDAC3B,G","sources":["webpack://@flarum/likes/webpack/bootstrap","webpack://@flarum/likes/webpack/runtime/compat get default export","webpack://@flarum/likes/webpack/runtime/define property getters","webpack://@flarum/likes/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/likes/webpack/runtime/make namespace object","webpack://@flarum/likes/external root \"flarum.core.compat['admin/app']\"","webpack://@flarum/likes/./src/admin/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","import app from 'flarum/admin/app';\n\napp.initializers.add('flarum-likes', () => {\n app.extensionData\n .for('flarum-likes')\n .registerPermission(\n {\n icon: 'far fa-thumbs-up',\n label: app.translator.trans('flarum-likes.admin.permissions.like_posts_label'),\n permission: 'discussion.likePosts',\n },\n 'reply'\n )\n .registerSetting({\n setting: 'flarum-likes.like_own_post',\n type: 'bool',\n label: app.translator.trans('flarum-likes.admin.settings.like_own_posts_label'),\n help: app.translator.trans('flarum-likes.admin.settings.like_own_posts_help'),\n });\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","registerPermission","icon","label","permission","registerSetting","setting","type","help"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,qDCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,oB,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,wBCAtD,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,c,aCE7C,MAAMW,UAAsB,EAAAC,eACzC,GAAAjB,GACE,OAAO,eAAekB,MAAM,6CAA8C,CAAC,GAAG,EAChF,CACA,IAAAC,GACE,OAAO,eAAeD,MAAM,8CAA+C,CAAC,GAAG,EACjF,CACA,SAAAE,GACE,MAAO,SACT,EAEFN,OAAOC,IAAIM,IAAI,eAAgB,mCAAoCL,GCXnE,MCCA,IDDgB,IAAI,aACnBM,OAAO,QAASN,ICAgB,IAAI,YAAeO,YAAW,KAAM,CACnEC,KAAM,mBACNC,MAAO,eAAeP,MAAM,mDAC5BK,WAAY,0BACV,SAASG,SAAQ,KAAM,CACzBA,QAAS,6BACTC,KAAM,OACNF,MAAO,eAAeP,MAAM,oDAC5BU,KAAM,eAAeV,MAAM,wDCT7B,iBAAiBG,IAAI,gBAAgB,Q","sources":["webpack://@flarum/likes/webpack/bootstrap","webpack://@flarum/likes/webpack/runtime/compat get default export","webpack://@flarum/likes/webpack/runtime/define property getters","webpack://@flarum/likes/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/likes/webpack/runtime/make namespace object","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'admin/app')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/query/IGambit')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/app')\"","webpack://@flarum/likes/./src/common/query/posts/LikedByGambit.ts","webpack://@flarum/likes/./src/common/extend.ts","webpack://@flarum/likes/./src/admin/extend.tsx","webpack://@flarum/likes/./src/admin/index.tsx"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'admin/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/query/IGambit');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/app');","import { KeyValueGambit } from 'flarum/common/query/IGambit';\nimport app from 'flarum/common/app';\nexport default class LikedByGambit extends KeyValueGambit {\n key() {\n return app.translator.trans('flarum-likes.lib.gambits.posts.likedBy.key', {}, true);\n }\n hint() {\n return app.translator.trans('flarum-likes.lib.gambits.posts.likedBy.hint', {}, true);\n }\n filterKey() {\n return 'likedBy';\n }\n}\nflarum.reg.add('flarum-likes', 'common/query/posts/LikedByGambit', LikedByGambit);","import Extend from 'flarum/common/extenders';\nimport LikedByGambit from './query/posts/LikedByGambit';\nexport default [new Extend.Search() //\n.gambit('posts', LikedByGambit)];","import Extend from 'flarum/common/extenders';\nimport app from 'flarum/admin/app';\nimport commonExtend from '../common/extend';\nexport default [...commonExtend, new Extend.Admin().permission(() => ({\n icon: 'far fa-thumbs-up',\n label: app.translator.trans('flarum-likes.admin.permissions.like_posts_label'),\n permission: 'discussion.likePosts'\n}), 'reply').setting(() => ({\n setting: 'flarum-likes.like_own_post',\n type: 'bool',\n label: app.translator.trans('flarum-likes.admin.settings.like_own_posts_label'),\n help: app.translator.trans('flarum-likes.admin.settings.like_own_posts_help')\n}))];","import app from 'flarum/admin/app';\nexport { default as extend } from './extend';\napp.initializers.add('flarum-likes', () => {\n // ...\n});"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","reg","LikedByGambit","KeyValueGambit","trans","hint","filterKey","add","gambit","permission","icon","label","setting","type","help"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/likes/js/dist/forum.js b/extensions/likes/js/dist/forum.js index 6d53a91a00..dfc8c3d72a 100644 --- a/extensions/likes/js/dist/forum.js +++ b/extensions/likes/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var t={n:o=>{var e=o&&o.__esModule?()=>o.default:()=>o;return t.d(e,{a:e}),e},d:(o,e)=>{for(var s in e)t.o(e,s)&&!t.o(o,s)&&Object.defineProperty(o,s,{enumerable:!0,get:e[s]})},o:(t,o)=>Object.prototype.hasOwnProperty.call(t,o),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},o={};(()=>{"use strict";t.r(o),t.d(o,{extend:()=>J});const e=flarum.core.compat["common/extend"],s=flarum.core.compat["forum/app"];var n=t.n(s);const r=flarum.core.compat["forum/components/NotificationGrid"];var a=t.n(r);const i=flarum.core.compat["common/components/Button"];var l=t.n(i);const c=flarum.core.compat["forum/components/CommentPost"];var u=t.n(c);const f=flarum.core.compat["common/components/Link"];var p=t.n(f);const d=flarum.core.compat["common/helpers/punctuateSeries"];var k=t.n(d);const h=flarum.core.compat["common/helpers/username"];var v=t.n(h);const g=flarum.core.compat["common/helpers/icon"];var y=t.n(g);const b=flarum.core.compat["common/components/Modal"];var _=t.n(b);const x=flarum.core.compat["common/helpers/avatar"];var L=t.n(x);const N=flarum.core.compat["common/states/PaginatedListState"];var P=t.n(N);class B extends(P()){constructor(t,o){void 0===o&&(o=1),t.page={...t.page||{},limit:10},super(t,o,10)}get type(){return"users"}}const M=flarum.core.compat["common/components/LoadingIndicator"];var S=t.n(M);class j extends(_()){oninit(t){super.oninit(t),this.state=new B({filter:{liked:this.attrs.post.id()}}),this.state.refresh()}className(){return"PostLikesModal Modal--small"}title(){return n().translator.trans("flarum-likes.forum.post_likes.title")}content(){return m("[",null,m("div",{className:"Modal-body"},this.state.isInitialLoading()?m(S(),null):m("ul",{className:"PostLikesModal-list"},this.state.getPages().map((t=>t.items.map((t=>m("li",null,m(p(),{href:n().route.user(t)},L()(t)," ",v()(t))))))))),this.state.hasNext()?m("div",{className:"Modal-footer"},m("div",{className:"Form Form--centered"},m("div",{className:"Form-group"},m(l(),{className:"Button Button--block",onclick:()=>this.state.loadNext(),loading:this.state.isLoadingNext()},n().translator.trans("flarum-likes.forum.post_likes.load_more_button"))))):null)}}const w=flarum.core.compat["forum/components/Notification"];var C=t.n(w);const I=flarum.core.compat["common/utils/string"];class O extends(C()){icon(){return"far fa-thumbs-up"}href(){return n().route.post(this.attrs.notification.subject())}content(){const t=this.attrs.notification.fromUser();return n().translator.trans("flarum-likes.forum.notifications.post_liked_text",{user:t,count:1})}excerpt(){return(0,I.truncate)(this.attrs.notification.subject().contentPlain(),200)}}const U=flarum.core.compat["forum/components/UserPage"];var F=t.n(U);const T=flarum.core.compat["common/components/LinkButton"];var R=t.n(T);const z=flarum.core.compat["common/extenders"];var A=t.n(z);const D=flarum.core.compat["common/models/Post"];var G=t.n(D);const H=flarum.core.compat["forum/components/PostsUserPage"];var q=t.n(H);class E extends(q()){loadResults(t){return n().store.find("posts",{filter:{type:"comment",likedBy:this.user.id()},page:{offset:t,limit:this.loadLimit},sort:"-createdAt"})}}const J=[(new(A().Routes)).add("user.likes","/u/:username/likes",E),new(A().Model)(G()).hasMany("likes").attribute("likesCount").attribute("canLike")];n().initializers.add("flarum-likes",(()=>{n().notificationComponents.postLiked=O,(0,e.extend)(u().prototype,"actionItems",(function(t){const o=this.attrs.post;if(o.isHidden()||!o.canLike())return;const e=o.likes();let s=n().session.user&&e&&e.some((t=>t===n().session.user));t.add("like",m(l(),{className:"Button Button--link",onclick:()=>{s=!s,o.save({isLiked:s});const t=o.data.relationships.likes.data;t.some(((o,e)=>{if(o.id===n().session.user.id())return t.splice(e,1),!0})),s&&t.unshift({type:"users",id:n().session.user.id()})}},n().translator.trans(s?"flarum-likes.forum.post.unlike_link":"flarum-likes.forum.post.like_link")))})),(0,e.extend)(u().prototype,"footerItems",(function(t){const o=this.attrs.post,e=o.likes();if(e&&e.length){const s=4,r=o.likesCount()>s,a=e.sort((t=>t===n().session.user?-1:1)).slice(0,r?s-1:s).map((t=>m(p(),{href:n().route.user(t)},t===n().session.user?n().translator.trans("flarum-likes.forum.post.you_text"):v()(t))));if(r){const t=o.likesCount()-a.length,e=n().translator.trans("flarum-likes.forum.post.others_link",{count:t});n().forum.attribute("canSearchUsers")?a.push(m(l(),{className:"Button Button--ua-reset Button--text",onclick:t=>{t.preventDefault(),n().modal.show(j,{post:o})}},e)):a.push(m("span",null,e))}t.add("liked",m("div",{className:"Post-likedBy"},y()("far fa-thumbs-up"),n().translator.trans("flarum-likes.forum.post.liked_by".concat(e[0]===n().session.user?"_self":"","_text"),{count:a.length,users:k()(a)})))}})),(0,e.extend)(F().prototype,"navItems",(function(t){const o=this.user;t.add("likes",m(R(),{href:n().route("user.likes",{username:null==o?void 0:o.slug()}),icon:"far fa-thumbs-up"},n().translator.trans("flarum-likes.forum.user.likes_link")),88)})),(0,e.extend)(a().prototype,"notificationTypes",(function(t){t.add("postLiked",{name:"postLiked",icon:"far fa-thumbs-up",label:n().translator.trans("flarum-likes.forum.settings.notify_post_liked_label")})}))}))})(),module.exports=o})(); +(()=>{var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};(()=>{"use strict";e.r(t),e.d(t,{extend:()=>Q});const r=flarum.reg.get("core","common/extend"),s=flarum.reg.get("core","forum/app");var o=e.n(s);const n=flarum.reg.get("core","common/components/Button");var a=e.n(n);const i=flarum.reg.get("core","forum/components/CommentPost");var l=e.n(i);const u=flarum.reg.get("core","common/components/Link");var c=e.n(u);const f=flarum.reg.get("core","common/helpers/punctuateSeries");var d=e.n(f);const p=flarum.reg.get("core","common/helpers/username");var g=e.n(p);const k=flarum.reg.get("core","common/components/Icon");var h=e.n(k);const v=flarum.reg.get("core","common/components/Modal");var y=e.n(v);const b=flarum.reg.get("core","common/components/Avatar");var x=e.n(b);const N=flarum.reg.get("core","common/states/PaginatedListState");var _=e.n(N);class L extends(_()){constructor(e,t){void 0===t&&(t=1),e.page={...e.page||{},limit:10},super(e,t,10)}get type(){return"users"}}flarum.reg.add("flarum-likes","forum/states/PostLikesModalState",L);const P=flarum.reg.get("core","common/components/LoadingIndicator");var B=e.n(P);const M=flarum.reg.get("core","common/components/Form");var S=e.n(M);class w extends(y()){oninit(e){super.oninit(e),this.state=new L({filter:{liked:this.attrs.post.id()}}),this.state.refresh()}className(){return"PostLikesModal Modal--small"}title(){return o().translator.trans("flarum-likes.forum.post_likes.title")}content(){return m("[",null,m("div",{className:"Modal-body"},this.state.isInitialLoading()?m(B(),null):m("ul",{className:"PostLikesModal-list"},this.state.getPages().map((e=>e.items.map((e=>m("li",null,m(c(),{href:o().route.user(e)},m(x(),{user:e})," ",g()(e))))))))),this.state.hasNext()?m("div",{className:"Modal-footer"},m(S(),{className:"Form--centered"},m("div",{className:"Form-group"},m(a(),{className:"Button Button--block",onclick:()=>this.state.loadNext(),loading:this.state.isLoadingNext()},o().translator.trans("flarum-likes.forum.post_likes.load_more_button"))))):null)}}flarum.reg.add("flarum-likes","forum/components/PostLikesModal",w);const I=flarum.reg.get("core","forum/components/UserPage");var j=e.n(I);const O=flarum.reg.get("core","common/components/LinkButton");var U=e.n(O);const C=flarum.reg.get("core","common/extenders");var F=e.n(C);const G=flarum.reg.get("core","common/models/Post");var T=e.n(G);const q=flarum.reg.get("core","forum/components/PostsUserPage");var A=e.n(q);class K extends(A()){params(e){return{filter:{type:"comment",likedBy:e.id()}}}}flarum.reg.add("flarum-likes","forum/components/LikesUserPage",K);const z=flarum.reg.get("core","forum/components/Notification");var D=e.n(z);const H=flarum.reg.get("core","common/utils/string");class R extends(D()){icon(){return"far fa-thumbs-up"}href(){return o().route.post(this.attrs.notification.subject())}content(){const e=this.attrs.notification.fromUser();return o().translator.trans("flarum-likes.forum.notifications.post_liked_text",{user:e,count:1})}excerpt(){return(0,H.truncate)(this.attrs.notification.subject().contentPlain(),200)}}flarum.reg.add("flarum-likes","forum/components/PostLikedNotification",R);const V=flarum.reg.get("core","common/query/IGambit"),$=flarum.reg.get("core","common/app");var E=e.n($);class J extends V.KeyValueGambit{key(){return E().translator.trans("flarum-likes.lib.gambits.posts.likedBy.key",{},!0)}hint(){return E().translator.trans("flarum-likes.lib.gambits.posts.likedBy.hint",{},!0)}filterKey(){return"likedBy"}}flarum.reg.add("flarum-likes","common/query/posts/LikedByGambit",J);const Q=[(new(F().Search)).gambit("posts",J),(new(F().Routes)).add("user.likes","/u/:username/likes",K),(new(F().Notification)).add("postLiked",R),new(F().Model)(T()).hasMany("likes").attribute("likesCount").attribute("canLike")];o().initializers.add("flarum-likes",(()=>{(0,r.extend)(l().prototype,"actionItems",(function(e){const t=this.attrs.post;if(t.isHidden()||!t.canLike())return;const r=t.likes();let s=o().session.user&&r&&r.some((e=>e===o().session.user));e.add("like",m(a(),{className:"Button Button--link",onclick:()=>{s=!s,t.save({isLiked:s});const e=t.data.relationships.likes.data;e.some(((t,r)=>{if(t.id===o().session.user.id())return e.splice(r,1),!0})),s&&e.unshift({type:"users",id:o().session.user.id()})}},o().translator.trans(s?"flarum-likes.forum.post.unlike_link":"flarum-likes.forum.post.like_link")))})),(0,r.extend)(l().prototype,"footerItems",(function(e){const t=this.attrs.post,r=t.likes();if(r&&r.length){const s=4,n=t.likesCount()>s,i=r.sort((e=>e===o().session.user?-1:1)).slice(0,n?s-1:s).map((e=>m(c(),{href:o().route.user(e)},e===o().session.user?o().translator.trans("flarum-likes.forum.post.you_text"):g()(e))));if(n){const e=t.likesCount()-i.length,r=o().translator.trans("flarum-likes.forum.post.others_link",{count:e});o().forum.attribute("canSearchUsers")?i.push(m(a(),{className:"Button Button--ua-reset Button--text",onclick:e=>{e.preventDefault(),o().modal.show(w,{post:t})}},r)):i.push(m("span",null,r))}e.add("liked",m("div",{className:"Post-likedBy"},m(h(),{name:"far fa-thumbs-up"}),o().translator.trans(`flarum-likes.forum.post.liked_by${r[0]===o().session.user?"_self":""}_text`,{count:i.length,users:d()(i)})))}})),(0,r.extend)(j().prototype,"navItems",(function(e){const t=this.user;e.add("likes",m(U(),{href:o().route("user.likes",{username:t?.slug()}),icon:"far fa-thumbs-up"},o().translator.trans("flarum-likes.forum.user.likes_link")),88)})),(0,r.extend)("flarum/forum/components/NotificationGrid","notificationTypes",(function(e){e.add("postLiked",{name:"postLiked",icon:"far fa-thumbs-up",label:o().translator.trans("flarum-likes.forum.settings.notify_post_liked_label")})})),(0,r.override)("flarum/forum/components/SearchModal","defaultActiveSource",(function(e){const t=e();return!t&&o().current.data.routeName&&o().current.data.routeName.includes("user.likes")&&o().current.data.user?"posts":t})),(0,r.extend)("flarum/forum/components/SearchModal","defaultFilters",(function(e){o().current.data.routeName&&o().current.data.routeName.includes("user.likes")&&o().current.data.user&&(e.posts.likedBy=o().current.data.user.username())}))}))})(),module.exports=t})(); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/extensions/likes/js/dist/forum.js.map b/extensions/likes/js/dist/forum.js.map index 9b85fc49fc..7219cf41c9 100644 --- a/extensions/likes/js/dist/forum.js.map +++ b/extensions/likes/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,qDCL9D,MAAM,EAA+B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A,IAAST,IAAAA,QAAAA,KAAmBA,IAAAA,WAAAA,MAAqB,oCAAsCa,IAASJ,MAQzG,GAAIgD,EAAW,CACb,MAAM/B,EAAQ/B,EAAK+D,aAAeC,EAAMH,OAClCK,EAAQ7D,IAAAA,WAAAA,MAAqB,sCAAuC,CAAE0B,UAExE1B,IAAAA,MAAAA,UAAoB,kBACtB2D,EAAMG,KACJ5D,EAACa,IAAM,CACLjB,UAAU,uCACVkB,QAAU+C,IACRA,EAAEC,iBACFhE,IAAAA,MAAAA,KAAed,EAAgB,CAAES,QAAO,GAGzCkE,IAILF,EAAMG,KAAK5D,EAAA,YAAO2D,GAEtB,CAEArD,EAAM8B,IACJ,QACApC,EAAA,OAAKJ,UAAU,gBACZwB,IAAK,oBACLtB,IAAAA,WAAAA,MAAqB,mCAADiE,OAAoCnB,EAAM,KAAO9C,IAAAA,QAAAA,KAAmB,QAAU,GAAE,SAAS,CAC5G0B,MAAOiC,EAAMH,OACbU,MAAOC,IAAgBR,MAI/B,CACF,KC5DAjB,EAAAA,EAAAA,QAAO0B,IAAAA,UAAoB,YAAY,SAAU5D,GAC/C,MAAMC,EAAOnB,KAAKmB,KAClBD,EAAM8B,IACJ,QACApC,EAACmE,IAAU,CAAC1D,KAAMX,IAAAA,MAAU,aAAc,CAAEa,SAAc,MAAJJ,OAAI,EAAJA,EAAM6D,SAAWhD,KAAK,oBACzEtB,IAAAA,WAAAA,MAAqB,uCAExB,GAEJ,KHCA0C,EAAAA,EAAAA,QAAO6B,IAAAA,UAA4B,qBAAqB,SAAU/D,GAChEA,EAAM8B,IAAI,YAAa,CACrBkC,KAAM,YACNlD,KAAM,mBACNuC,MAAO7D,IAAAA,WAAAA,MAAqB,wDAEhC,GAAE,G","sources":["webpack://@flarum/likes/webpack/bootstrap","webpack://@flarum/likes/webpack/runtime/compat get default export","webpack://@flarum/likes/webpack/runtime/define property getters","webpack://@flarum/likes/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/likes/webpack/runtime/make namespace object","webpack://@flarum/likes/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/likes/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/likes/external root \"flarum.core.compat['forum/components/NotificationGrid']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/components/Button']\"","webpack://@flarum/likes/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/components/Link']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/helpers/punctuateSeries']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/helpers/username']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/helpers/icon']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/components/Modal']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/helpers/avatar']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/states/PaginatedListState']\"","webpack://@flarum/likes/./src/forum/states/PostLikesModalState.ts","webpack://@flarum/likes/external root \"flarum.core.compat['common/components/LoadingIndicator']\"","webpack://@flarum/likes/./src/forum/components/PostLikesModal.tsx","webpack://@flarum/likes/external root \"flarum.core.compat['forum/components/Notification']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/utils/string']\"","webpack://@flarum/likes/./src/forum/components/PostLikedNotification.js","webpack://@flarum/likes/external root \"flarum.core.compat['forum/components/UserPage']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/components/LinkButton']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/extenders']\"","webpack://@flarum/likes/external root \"flarum.core.compat['common/models/Post']\"","webpack://@flarum/likes/external root \"flarum.core.compat['forum/components/PostsUserPage']\"","webpack://@flarum/likes/./src/forum/components/LikesUserPage.tsx","webpack://@flarum/likes/./src/forum/extend.ts","webpack://@flarum/likes/./src/forum/index.js","webpack://@flarum/likes/./src/forum/addLikeAction.js","webpack://@flarum/likes/./src/forum/addLikesList.js","webpack://@flarum/likes/./src/forum/addLikesTabToUserProfile.tsx"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/NotificationGrid'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/CommentPost'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Link'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/punctuateSeries'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/username'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/icon'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/avatar'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/states/PaginatedListState'];","import PaginatedListState, { PaginatedListParams } from 'flarum/common/states/PaginatedListState';\nimport User from 'flarum/common/models/User';\n\nexport interface PostLikesModalListParams extends PaginatedListParams {\n filter: {\n liked: string;\n };\n page?: {\n offset?: number;\n limit: number;\n };\n}\n\nexport default class PostLikesModalState

    extends PaginatedListState {\n constructor(params: P, page: number = 1) {\n const limit = 10;\n\n params.page = { ...(params.page || {}), limit };\n\n super(params, page, limit);\n }\n\n get type(): string {\n return 'users';\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LoadingIndicator'];","import app from 'flarum/forum/app';\nimport Modal from 'flarum/common/components/Modal';\nimport Link from 'flarum/common/components/Link';\nimport avatar from 'flarum/common/helpers/avatar';\nimport username from 'flarum/common/helpers/username';\nimport type { IInternalModalAttrs } from 'flarum/common/components/Modal';\nimport type Post from 'flarum/common/models/Post';\nimport type Mithril from 'mithril';\nimport PostLikesModalState from '../states/PostLikesModalState';\nimport Button from 'flarum/common/components/Button';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\n\nexport interface IPostLikesModalAttrs extends IInternalModalAttrs {\n post: Post;\n}\n\nexport default class PostLikesModal extends Modal {\n oninit(vnode: Mithril.VnodeDOM) {\n super.oninit(vnode);\n\n this.state = new PostLikesModalState({\n filter: {\n liked: this.attrs.post.id()!,\n },\n });\n\n this.state.refresh();\n }\n\n className() {\n return 'PostLikesModal Modal--small';\n }\n\n title() {\n return app.translator.trans('flarum-likes.forum.post_likes.title');\n }\n\n content() {\n return (\n <>\n

    \n {this.state.isInitialLoading() ? (\n \n ) : (\n
      \n {this.state.getPages().map((page) =>\n page.items.map((user) => (\n
    • \n \n {avatar(user)} {username(user)}\n \n
    • \n ))\n )}\n
    \n )}\n
    \n {this.state.hasNext() ? (\n
    \n
    \n
    \n \n
    \n
    \n
    \n ) : null}\n \n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/Notification'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/string'];","import app from 'flarum/forum/app';\nimport Notification from 'flarum/forum/components/Notification';\nimport { truncate } from 'flarum/common/utils/string';\n\nexport default class PostLikedNotification extends Notification {\n icon() {\n return 'far fa-thumbs-up';\n }\n\n href() {\n return app.route.post(this.attrs.notification.subject());\n }\n\n content() {\n const notification = this.attrs.notification;\n const user = notification.fromUser();\n\n return app.translator.trans('flarum-likes.forum.notifications.post_liked_text', { user, count: 1 });\n }\n\n excerpt() {\n return truncate(this.attrs.notification.subject().contentPlain(), 200);\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/UserPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LinkButton'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extenders'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Post'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/PostsUserPage'];","import app from 'flarum/forum/app';\nimport PostsUserPage from 'flarum/forum/components/PostsUserPage';\n\n/**\n * The `LikesUserPage` component shows posts which user the user liked.\n */\nexport default class LikesUserPage extends PostsUserPage {\n /**\n * Load a new page of the user's activity feed.\n *\n * @param offset The position to start getting results from.\n * @protected\n */\n loadResults(offset: number) {\n return app.store.find('posts', {\n filter: {\n type: 'comment',\n likedBy: this.user.id(),\n },\n page: { offset, limit: this.loadLimit },\n sort: '-createdAt',\n });\n }\n}\n","import Extend from 'flarum/common/extenders';\nimport Post from 'flarum/common/models/Post';\nimport User from 'flarum/common/models/User';\nimport LikesUserPage from './components/LikesUserPage';\n\nexport default [\n new Extend.Routes() //\n .add('user.likes', '/u/:username/likes', LikesUserPage),\n\n new Extend.Model(Post) //\n .hasMany('likes')\n .attribute('likesCount')\n .attribute('canLike'),\n];\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport NotificationGrid from 'flarum/forum/components/NotificationGrid';\n\nimport addLikeAction from './addLikeAction';\nimport addLikesList from './addLikesList';\nimport PostLikedNotification from './components/PostLikedNotification';\nimport addLikesTabToUserProfile from './addLikesTabToUserProfile';\n\nexport { default as extend } from './extend';\n\napp.initializers.add('flarum-likes', () => {\n app.notificationComponents.postLiked = PostLikedNotification;\n\n addLikeAction();\n addLikesList();\n addLikesTabToUserProfile();\n\n extend(NotificationGrid.prototype, 'notificationTypes', function (items) {\n items.add('postLiked', {\n name: 'postLiked',\n icon: 'far fa-thumbs-up',\n label: app.translator.trans('flarum-likes.forum.settings.notify_post_liked_label'),\n });\n });\n});\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport Button from 'flarum/common/components/Button';\nimport CommentPost from 'flarum/forum/components/CommentPost';\n\nexport default function () {\n extend(CommentPost.prototype, 'actionItems', function (items) {\n const post = this.attrs.post;\n\n if (post.isHidden() || !post.canLike()) return;\n\n const likes = post.likes();\n\n let isLiked = app.session.user && likes && likes.some((user) => user === app.session.user);\n\n items.add(\n 'like',\n {\n isLiked = !isLiked;\n\n post.save({ isLiked });\n\n // We've saved the fact that we do or don't like the post, but in order\n // to provide instantaneous feedback to the user, we'll need to add or\n // remove the like from the relationship data manually.\n const data = post.data.relationships.likes.data;\n data.some((like, i) => {\n if (like.id === app.session.user.id()) {\n data.splice(i, 1);\n return true;\n }\n });\n\n if (isLiked) {\n data.unshift({ type: 'users', id: app.session.user.id() });\n }\n }}\n >\n {app.translator.trans(isLiked ? 'flarum-likes.forum.post.unlike_link' : 'flarum-likes.forum.post.like_link')}\n \n );\n });\n}\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport Link from 'flarum/common/components/Link';\nimport punctuateSeries from 'flarum/common/helpers/punctuateSeries';\nimport username from 'flarum/common/helpers/username';\nimport icon from 'flarum/common/helpers/icon';\nimport Button from 'flarum/common/components/Button';\n\nimport PostLikesModal from './components/PostLikesModal';\n\nexport default function () {\n extend(CommentPost.prototype, 'footerItems', function (items) {\n const post = this.attrs.post;\n const likes = post.likes();\n\n if (likes && likes.length) {\n const limit = 4;\n const overLimit = post.likesCount() > limit;\n\n // Construct a list of names of users who have liked this post. Make sure the\n // current user is first in the list, and cap a maximum of 4 items.\n const names = likes\n .sort((a) => (a === app.session.user ? -1 : 1))\n .slice(0, overLimit ? limit - 1 : limit)\n .map((user) => {\n return (\n \n {user === app.session.user ? app.translator.trans('flarum-likes.forum.post.you_text') : username(user)}\n \n );\n });\n\n // If there are more users that we've run out of room to display, add a \"x\n // others\" name to the end of the list. Clicking on it will display a modal\n // with a full list of names.\n if (overLimit) {\n const count = post.likesCount() - names.length;\n const label = app.translator.trans('flarum-likes.forum.post.others_link', { count });\n\n if (app.forum.attribute('canSearchUsers')) {\n names.push(\n {\n e.preventDefault();\n app.modal.show(PostLikesModal, { post });\n }}\n >\n {label}\n \n );\n } else {\n names.push({label});\n }\n }\n\n items.add(\n 'liked',\n
    \n {icon('far fa-thumbs-up')}\n {app.translator.trans(`flarum-likes.forum.post.liked_by${likes[0] === app.session.user ? '_self' : ''}_text`, {\n count: names.length,\n users: punctuateSeries(names),\n })}\n
    \n );\n }\n });\n}\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport UserPage from 'flarum/forum/components/UserPage';\nimport LinkButton from 'flarum/common/components/LinkButton';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport type Mithril from 'mithril';\n\nexport default function addLikesTabToUserProfile() {\n extend(UserPage.prototype, 'navItems', function (items: ItemList) {\n const user = this.user;\n items.add(\n 'likes',\n \n {app.translator.trans('flarum-likes.forum.user.likes_link')}\n ,\n 88\n );\n });\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","PostLikesModalState","PaginatedListState","constructor","params","page","limit","super","type","PostLikesModal","Modal","oninit","vnode","this","state","filter","liked","attrs","post","id","refresh","className","title","app","content","m","'['","isInitialLoading","LoadingIndicator","getPages","map","items","user","Link","href","avatar","username","hasNext","Button","onclick","loadNext","loading","isLoadingNext","PostLikedNotification","Notification","icon","notification","subject","fromUser","count","excerpt","truncate","contentPlain","LikesUserPage","PostsUserPage","loadResults","offset","likedBy","loadLimit","sort","Extend","add","Post","hasMany","attribute","extend","CommentPost","isHidden","canLike","likes","isLiked","some","save","data","relationships","like","i","splice","unshift","length","overLimit","likesCount","names","slice","label","push","e","preventDefault","concat","users","punctuateSeries","UserPage","LinkButton","slug","NotificationGrid","name"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,qDCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,iBCAtD,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,4B,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,gC,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,0B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D,MAAM,wDAEhC,KAGA,IAAA4D,UAAS,sCAAuC,uBAAuB,SAAUC,GAC/E,MAAMC,EAAOD,IACb,OAAKC,GAAQ,YAAYvB,KAAKwB,WAAa,YAAYxB,KAAKwB,UAAUC,SAAS,eAAiB,YAAYzB,KAAKhC,KACxG,QAEFuD,CACT,KACA,IAAA9B,QAAO,sCAAuC,kBAAkB,SAAUiC,GACpE,YAAY1B,KAAKwB,WAAa,YAAYxB,KAAKwB,UAAUC,SAAS,eAAiB,YAAYzB,KAAKhC,OACtG0D,EAAQC,MAAMnD,QAAU,YAAYwB,KAAKhC,KAAKmD,WAElD,GAAE,G","sources":["webpack://@flarum/likes/webpack/bootstrap","webpack://@flarum/likes/webpack/runtime/compat get default export","webpack://@flarum/likes/webpack/runtime/define property getters","webpack://@flarum/likes/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/likes/webpack/runtime/make namespace object","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/extend')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'forum/app')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/components/Button')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'forum/components/CommentPost')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/components/Link')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/helpers/punctuateSeries')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/helpers/username')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/components/Icon')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/components/Modal')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/components/Avatar')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/states/PaginatedListState')\"","webpack://@flarum/likes/./src/forum/states/PostLikesModalState.ts","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/components/LoadingIndicator')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/components/Form')\"","webpack://@flarum/likes/./src/forum/components/PostLikesModal.tsx","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'forum/components/UserPage')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/components/LinkButton')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/models/Post')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'forum/components/PostsUserPage')\"","webpack://@flarum/likes/./src/forum/components/LikesUserPage.ts","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'forum/components/Notification')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/utils/string')\"","webpack://@flarum/likes/./src/forum/components/PostLikedNotification.js","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/query/IGambit')\"","webpack://@flarum/likes/external root \"flarum.reg.get('core', 'common/app')\"","webpack://@flarum/likes/./src/common/query/posts/LikedByGambit.ts","webpack://@flarum/likes/./src/common/extend.ts","webpack://@flarum/likes/./src/forum/extend.ts","webpack://@flarum/likes/./src/forum/index.js","webpack://@flarum/likes/./src/forum/addLikeAction.js","webpack://@flarum/likes/./src/forum/addLikesList.js","webpack://@flarum/likes/./src/forum/addLikesTabToUserProfile.tsx"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extend');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Button');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/CommentPost');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Link');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/helpers/punctuateSeries');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/helpers/username');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Icon');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Modal');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Avatar');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/states/PaginatedListState');","import PaginatedListState from 'flarum/common/states/PaginatedListState';\nexport default class PostLikesModalState extends PaginatedListState {\n constructor(params, page) {\n if (page === void 0) {\n page = 1;\n }\n const limit = 10;\n params.page = {\n ...(params.page || {}),\n limit\n };\n super(params, page, limit);\n }\n get type() {\n return 'users';\n }\n}\nflarum.reg.add('flarum-likes', 'forum/states/PostLikesModalState', PostLikesModalState);","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/LoadingIndicator');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Form');","import app from 'flarum/forum/app';\nimport Modal from 'flarum/common/components/Modal';\nimport Link from 'flarum/common/components/Link';\nimport Avatar from 'flarum/common/components/Avatar';\nimport username from 'flarum/common/helpers/username';\nimport PostLikesModalState from '../states/PostLikesModalState';\nimport Button from 'flarum/common/components/Button';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport Form from 'flarum/common/components/Form';\nexport default class PostLikesModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n this.state = new PostLikesModalState({\n filter: {\n liked: this.attrs.post.id()\n }\n });\n this.state.refresh();\n }\n className() {\n return 'PostLikesModal Modal--small';\n }\n title() {\n return app.translator.trans('flarum-likes.forum.post_likes.title');\n }\n content() {\n return m('[', null, m(\"div\", {\n className: \"Modal-body\"\n }, this.state.isInitialLoading() ? m(LoadingIndicator, null) : m(\"ul\", {\n className: \"PostLikesModal-list\"\n }, this.state.getPages().map(page => page.items.map(user => m(\"li\", null, m(Link, {\n href: app.route.user(user)\n }, m(Avatar, {\n user: user\n }), \" \", username(user))))))), this.state.hasNext() ? m(\"div\", {\n className: \"Modal-footer\"\n }, m(Form, {\n className: \"Form--centered\"\n }, m(\"div\", {\n className: \"Form-group\"\n }, m(Button, {\n className: \"Button Button--block\",\n onclick: () => this.state.loadNext(),\n loading: this.state.isLoadingNext()\n }, app.translator.trans('flarum-likes.forum.post_likes.load_more_button'))))) : null);\n }\n}\nflarum.reg.add('flarum-likes', 'forum/components/PostLikesModal', PostLikesModal);","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/UserPage');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/LinkButton');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/models/Post');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/PostsUserPage');","import PostsUserPage from 'flarum/forum/components/PostsUserPage';\n/**\n * The `LikesUserPage` component shows posts which user the user liked.\n */\nexport default class LikesUserPage extends PostsUserPage {\n params(user) {\n return {\n filter: {\n type: 'comment',\n likedBy: user.id()\n }\n };\n }\n}\nflarum.reg.add('flarum-likes', 'forum/components/LikesUserPage', LikesUserPage);","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/Notification');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/utils/string');","import app from 'flarum/forum/app';\nimport Notification from 'flarum/forum/components/Notification';\nimport { truncate } from 'flarum/common/utils/string';\nexport default class PostLikedNotification extends Notification {\n icon() {\n return 'far fa-thumbs-up';\n }\n href() {\n return app.route.post(this.attrs.notification.subject());\n }\n content() {\n const notification = this.attrs.notification;\n const user = notification.fromUser();\n return app.translator.trans('flarum-likes.forum.notifications.post_liked_text', {\n user,\n count: 1\n });\n }\n excerpt() {\n return truncate(this.attrs.notification.subject().contentPlain(), 200);\n }\n}\nflarum.reg.add('flarum-likes', 'forum/components/PostLikedNotification', PostLikedNotification);","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/query/IGambit');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/app');","import { KeyValueGambit } from 'flarum/common/query/IGambit';\nimport app from 'flarum/common/app';\nexport default class LikedByGambit extends KeyValueGambit {\n key() {\n return app.translator.trans('flarum-likes.lib.gambits.posts.likedBy.key', {}, true);\n }\n hint() {\n return app.translator.trans('flarum-likes.lib.gambits.posts.likedBy.hint', {}, true);\n }\n filterKey() {\n return 'likedBy';\n }\n}\nflarum.reg.add('flarum-likes', 'common/query/posts/LikedByGambit', LikedByGambit);","import Extend from 'flarum/common/extenders';\nimport LikedByGambit from './query/posts/LikedByGambit';\nexport default [new Extend.Search() //\n.gambit('posts', LikedByGambit)];","import Extend from 'flarum/common/extenders';\nimport Post from 'flarum/common/models/Post';\nimport LikesUserPage from './components/LikesUserPage';\nimport PostLikedNotification from './components/PostLikedNotification';\nimport commonExtend from '../common/extend';\nexport default [...commonExtend, new Extend.Routes() //\n.add('user.likes', '/u/:username/likes', LikesUserPage), new Extend.Notification() //\n.add('postLiked', PostLikedNotification), new Extend.Model(Post) //\n.hasMany('likes').attribute('likesCount').attribute('canLike')];","import { extend, override } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport addLikeAction from './addLikeAction';\nimport addLikesList from './addLikesList';\nimport addLikesTabToUserProfile from './addLikesTabToUserProfile';\nexport { default as extend } from './extend';\napp.initializers.add('flarum-likes', () => {\n addLikeAction();\n addLikesList();\n addLikesTabToUserProfile();\n extend('flarum/forum/components/NotificationGrid', 'notificationTypes', function (items) {\n items.add('postLiked', {\n name: 'postLiked',\n icon: 'far fa-thumbs-up',\n label: app.translator.trans('flarum-likes.forum.settings.notify_post_liked_label')\n });\n });\n\n // Auto scope the search to the current user liked posts.\n override('flarum/forum/components/SearchModal', 'defaultActiveSource', function (original) {\n const orig = original();\n if (!orig && app.current.data.routeName && app.current.data.routeName.includes('user.likes') && app.current.data.user) {\n return 'posts';\n }\n return orig;\n });\n extend('flarum/forum/components/SearchModal', 'defaultFilters', function (filters) {\n if (app.current.data.routeName && app.current.data.routeName.includes('user.likes') && app.current.data.user) {\n filters.posts.likedBy = app.current.data.user.username();\n }\n });\n});","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport Button from 'flarum/common/components/Button';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nexport default function () {\n extend(CommentPost.prototype, 'actionItems', function (items) {\n const post = this.attrs.post;\n if (post.isHidden() || !post.canLike()) return;\n const likes = post.likes();\n let isLiked = app.session.user && likes && likes.some(user => user === app.session.user);\n items.add('like', m(Button, {\n className: \"Button Button--link\",\n onclick: () => {\n isLiked = !isLiked;\n post.save({\n isLiked\n });\n\n // We've saved the fact that we do or don't like the post, but in order\n // to provide instantaneous feedback to the user, we'll need to add or\n // remove the like from the relationship data manually.\n const data = post.data.relationships.likes.data;\n data.some((like, i) => {\n if (like.id === app.session.user.id()) {\n data.splice(i, 1);\n return true;\n }\n });\n if (isLiked) {\n data.unshift({\n type: 'users',\n id: app.session.user.id()\n });\n }\n }\n }, app.translator.trans(isLiked ? 'flarum-likes.forum.post.unlike_link' : 'flarum-likes.forum.post.like_link')));\n });\n}","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport Link from 'flarum/common/components/Link';\nimport punctuateSeries from 'flarum/common/helpers/punctuateSeries';\nimport username from 'flarum/common/helpers/username';\nimport Icon from 'flarum/common/components/Icon';\nimport Button from 'flarum/common/components/Button';\nimport PostLikesModal from './components/PostLikesModal';\nexport default function () {\n extend(CommentPost.prototype, 'footerItems', function (items) {\n const post = this.attrs.post;\n const likes = post.likes();\n if (likes && likes.length) {\n const limit = 4;\n const overLimit = post.likesCount() > limit;\n\n // Construct a list of names of users who have liked this post. Make sure the\n // current user is first in the list, and cap a maximum of 4 items.\n const names = likes.sort(a => a === app.session.user ? -1 : 1).slice(0, overLimit ? limit - 1 : limit).map(user => {\n return m(Link, {\n href: app.route.user(user)\n }, user === app.session.user ? app.translator.trans('flarum-likes.forum.post.you_text') : username(user));\n });\n\n // If there are more users that we've run out of room to display, add a \"x\n // others\" name to the end of the list. Clicking on it will display a modal\n // with a full list of names.\n if (overLimit) {\n const count = post.likesCount() - names.length;\n const label = app.translator.trans('flarum-likes.forum.post.others_link', {\n count\n });\n if (app.forum.attribute('canSearchUsers')) {\n names.push(m(Button, {\n className: \"Button Button--ua-reset Button--text\",\n onclick: e => {\n e.preventDefault();\n app.modal.show(PostLikesModal, {\n post\n });\n }\n }, label));\n } else {\n names.push(m(\"span\", null, label));\n }\n }\n items.add('liked', m(\"div\", {\n className: \"Post-likedBy\"\n }, m(Icon, {\n name: 'far fa-thumbs-up'\n }), app.translator.trans(`flarum-likes.forum.post.liked_by${likes[0] === app.session.user ? '_self' : ''}_text`, {\n count: names.length,\n users: punctuateSeries(names)\n })));\n }\n });\n}","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport UserPage from 'flarum/forum/components/UserPage';\nimport LinkButton from 'flarum/common/components/LinkButton';\nexport default function addLikesTabToUserProfile() {\n extend(UserPage.prototype, 'navItems', function (items) {\n const user = this.user;\n items.add('likes', m(LinkButton, {\n href: app.route('user.likes', {\n username: user?.slug()\n }),\n icon: \"far fa-thumbs-up\"\n }, app.translator.trans('flarum-likes.forum.user.likes_link')), 88);\n });\n}"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","reg","PostLikesModalState","constructor","params","page","limit","super","type","add","PostLikesModal","oninit","vnode","this","state","filter","liked","attrs","post","id","refresh","className","title","trans","content","m","isInitialLoading","getPages","map","items","user","href","hasNext","onclick","loadNext","loading","isLoadingNext","LikesUserPage","likedBy","PostLikedNotification","icon","notification","subject","fromUser","count","excerpt","truncate","contentPlain","LikedByGambit","KeyValueGambit","hint","filterKey","gambit","hasMany","attribute","extend","isHidden","canLike","likes","isLiked","some","save","data","relationships","like","i","splice","unshift","length","overLimit","likesCount","names","sort","slice","label","push","e","preventDefault","show","name","users","username","slug","override","original","orig","routeName","includes","filters","posts"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/likes/js/package.json b/extensions/likes/js/package.json index 6c7640f532..1d2e6dbbde 100644 --- a/extensions/likes/js/package.json +++ b/extensions/likes/js/package.json @@ -5,7 +5,7 @@ "prettier": "@flarum/prettier-config", "devDependencies": { "prettier": "^2.5.1", - "flarum-webpack-config": "^2.0.0", + "flarum-webpack-config": "^3.0.0", "webpack": "^5.76.0", "webpack-cli": "^4.9.1", "@flarum/prettier-config": "^1.0.0" diff --git a/extensions/likes/js/src/admin/extend.tsx b/extensions/likes/js/src/admin/extend.tsx new file mode 100644 index 0000000000..692158ab2e --- /dev/null +++ b/extensions/likes/js/src/admin/extend.tsx @@ -0,0 +1,23 @@ +import Extend from 'flarum/common/extenders'; +import app from 'flarum/admin/app'; +import commonExtend from '../common/extend'; + +export default [ + ...commonExtend, + + new Extend.Admin() + .permission( + () => ({ + icon: 'far fa-thumbs-up', + label: app.translator.trans('flarum-likes.admin.permissions.like_posts_label'), + permission: 'discussion.likePosts', + }), + 'reply' + ) + .setting(() => ({ + setting: 'flarum-likes.like_own_post', + type: 'bool', + label: app.translator.trans('flarum-likes.admin.settings.like_own_posts_label'), + help: app.translator.trans('flarum-likes.admin.settings.like_own_posts_help'), + })), +]; diff --git a/extensions/likes/js/src/admin/index.js b/extensions/likes/js/src/admin/index.js deleted file mode 100644 index 6117298cbf..0000000000 --- a/extensions/likes/js/src/admin/index.js +++ /dev/null @@ -1,20 +0,0 @@ -import app from 'flarum/admin/app'; - -app.initializers.add('flarum-likes', () => { - app.extensionData - .for('flarum-likes') - .registerPermission( - { - icon: 'far fa-thumbs-up', - label: app.translator.trans('flarum-likes.admin.permissions.like_posts_label'), - permission: 'discussion.likePosts', - }, - 'reply' - ) - .registerSetting({ - setting: 'flarum-likes.like_own_post', - type: 'bool', - label: app.translator.trans('flarum-likes.admin.settings.like_own_posts_label'), - help: app.translator.trans('flarum-likes.admin.settings.like_own_posts_help'), - }); -}); diff --git a/extensions/likes/js/src/admin/index.tsx b/extensions/likes/js/src/admin/index.tsx new file mode 100644 index 0000000000..86c45061a9 --- /dev/null +++ b/extensions/likes/js/src/admin/index.tsx @@ -0,0 +1,7 @@ +import app from 'flarum/admin/app'; + +export { default as extend } from './extend'; + +app.initializers.add('flarum-likes', () => { + // ... +}); diff --git a/extensions/likes/js/src/common/extend.ts b/extensions/likes/js/src/common/extend.ts new file mode 100644 index 0000000000..3099dc5b86 --- /dev/null +++ b/extensions/likes/js/src/common/extend.ts @@ -0,0 +1,7 @@ +import Extend from 'flarum/common/extenders'; +import LikedByGambit from './query/posts/LikedByGambit'; + +export default [ + new Extend.Search() // + .gambit('posts', LikedByGambit), +]; diff --git a/extensions/likes/js/src/common/query/posts/LikedByGambit.ts b/extensions/likes/js/src/common/query/posts/LikedByGambit.ts new file mode 100644 index 0000000000..862474ab3b --- /dev/null +++ b/extensions/likes/js/src/common/query/posts/LikedByGambit.ts @@ -0,0 +1,16 @@ +import { KeyValueGambit } from 'flarum/common/query/IGambit'; +import app from 'flarum/common/app'; + +export default class LikedByGambit extends KeyValueGambit { + key(): string { + return app.translator.trans('flarum-likes.lib.gambits.posts.likedBy.key', {}, true); + } + + hint(): string { + return app.translator.trans('flarum-likes.lib.gambits.posts.likedBy.hint', {}, true); + } + + filterKey(): string { + return 'likedBy'; + } +} diff --git a/extensions/likes/js/src/forum/addLikesList.js b/extensions/likes/js/src/forum/addLikesList.js index 8b647200a2..7770b9328c 100644 --- a/extensions/likes/js/src/forum/addLikesList.js +++ b/extensions/likes/js/src/forum/addLikesList.js @@ -4,7 +4,7 @@ import CommentPost from 'flarum/forum/components/CommentPost'; import Link from 'flarum/common/components/Link'; import punctuateSeries from 'flarum/common/helpers/punctuateSeries'; import username from 'flarum/common/helpers/username'; -import icon from 'flarum/common/helpers/icon'; +import Icon from 'flarum/common/components/Icon'; import Button from 'flarum/common/components/Button'; import PostLikesModal from './components/PostLikesModal'; @@ -58,7 +58,7 @@ export default function () { items.add( 'liked',
    - {icon('far fa-thumbs-up')} + {app.translator.trans(`flarum-likes.forum.post.liked_by${likes[0] === app.session.user ? '_self' : ''}_text`, { count: names.length, users: punctuateSeries(names), diff --git a/extensions/likes/js/src/forum/components/LikesUserPage.ts b/extensions/likes/js/src/forum/components/LikesUserPage.ts new file mode 100644 index 0000000000..d4b176ae59 --- /dev/null +++ b/extensions/likes/js/src/forum/components/LikesUserPage.ts @@ -0,0 +1,16 @@ +import PostsUserPage from 'flarum/forum/components/PostsUserPage'; +import type User from 'flarum/common/models/User'; + +/** + * The `LikesUserPage` component shows posts which user the user liked. + */ +export default class LikesUserPage extends PostsUserPage { + params(user: User) { + return { + filter: { + type: 'comment', + likedBy: user.id(), + }, + }; + } +} diff --git a/extensions/likes/js/src/forum/components/LikesUserPage.tsx b/extensions/likes/js/src/forum/components/LikesUserPage.tsx deleted file mode 100644 index 941716ac2a..0000000000 --- a/extensions/likes/js/src/forum/components/LikesUserPage.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import app from 'flarum/forum/app'; -import PostsUserPage from 'flarum/forum/components/PostsUserPage'; - -/** - * The `LikesUserPage` component shows posts which user the user liked. - */ -export default class LikesUserPage extends PostsUserPage { - /** - * Load a new page of the user's activity feed. - * - * @param offset The position to start getting results from. - * @protected - */ - loadResults(offset: number) { - return app.store.find('posts', { - filter: { - type: 'comment', - likedBy: this.user.id(), - }, - page: { offset, limit: this.loadLimit }, - sort: '-createdAt', - }); - } -} diff --git a/extensions/likes/js/src/forum/components/PostLikesModal.tsx b/extensions/likes/js/src/forum/components/PostLikesModal.tsx index 12e8fe3391..8a092ebb9e 100644 --- a/extensions/likes/js/src/forum/components/PostLikesModal.tsx +++ b/extensions/likes/js/src/forum/components/PostLikesModal.tsx @@ -1,7 +1,7 @@ import app from 'flarum/forum/app'; import Modal from 'flarum/common/components/Modal'; import Link from 'flarum/common/components/Link'; -import avatar from 'flarum/common/helpers/avatar'; +import Avatar from 'flarum/common/components/Avatar'; import username from 'flarum/common/helpers/username'; import type { IInternalModalAttrs } from 'flarum/common/components/Modal'; import type Post from 'flarum/common/models/Post'; @@ -9,6 +9,7 @@ import type Mithril from 'mithril'; import PostLikesModalState from '../states/PostLikesModalState'; import Button from 'flarum/common/components/Button'; import LoadingIndicator from 'flarum/common/components/LoadingIndicator'; +import Form from 'flarum/common/components/Form'; export interface IPostLikesModalAttrs extends IInternalModalAttrs { post: Post; @@ -47,7 +48,7 @@ export default class PostLikesModal (
  • - {avatar(user)} {username(user)} + {username(user)}
  • )) @@ -57,13 +58,13 @@ export default class PostLikesModal {this.state.hasNext() ? (
    -
    +
    -
    +
    ) : null} diff --git a/extensions/likes/js/src/forum/extend.ts b/extensions/likes/js/src/forum/extend.ts index 1a8b41bac7..9973a0d2f0 100644 --- a/extensions/likes/js/src/forum/extend.ts +++ b/extensions/likes/js/src/forum/extend.ts @@ -2,11 +2,19 @@ import Extend from 'flarum/common/extenders'; import Post from 'flarum/common/models/Post'; import User from 'flarum/common/models/User'; import LikesUserPage from './components/LikesUserPage'; +import PostLikedNotification from './components/PostLikedNotification'; + +import commonExtend from '../common/extend'; export default [ + ...commonExtend, + new Extend.Routes() // .add('user.likes', '/u/:username/likes', LikesUserPage), + new Extend.Notification() // + .add('postLiked', PostLikedNotification), + new Extend.Model(Post) // .hasMany('likes') .attribute('likesCount') diff --git a/extensions/likes/js/src/forum/index.js b/extensions/likes/js/src/forum/index.js index 29d7a1d653..5064bc853b 100644 --- a/extensions/likes/js/src/forum/index.js +++ b/extensions/likes/js/src/forum/index.js @@ -1,26 +1,38 @@ -import { extend } from 'flarum/common/extend'; +import { extend, override } from 'flarum/common/extend'; import app from 'flarum/forum/app'; -import NotificationGrid from 'flarum/forum/components/NotificationGrid'; import addLikeAction from './addLikeAction'; import addLikesList from './addLikesList'; -import PostLikedNotification from './components/PostLikedNotification'; import addLikesTabToUserProfile from './addLikesTabToUserProfile'; export { default as extend } from './extend'; app.initializers.add('flarum-likes', () => { - app.notificationComponents.postLiked = PostLikedNotification; - addLikeAction(); addLikesList(); addLikesTabToUserProfile(); - extend(NotificationGrid.prototype, 'notificationTypes', function (items) { + extend('flarum/forum/components/NotificationGrid', 'notificationTypes', function (items) { items.add('postLiked', { name: 'postLiked', icon: 'far fa-thumbs-up', label: app.translator.trans('flarum-likes.forum.settings.notify_post_liked_label'), }); }); + + // Auto scope the search to the current user liked posts. + override('flarum/forum/components/SearchModal', 'defaultActiveSource', function (original) { + const orig = original(); + + if (!orig && app.current.data.routeName && app.current.data.routeName.includes('user.likes') && app.current.data.user) { + return 'posts'; + } + + return orig; + }); + extend('flarum/forum/components/SearchModal', 'defaultFilters', function (filters) { + if (app.current.data.routeName && app.current.data.routeName.includes('user.likes') && app.current.data.user) { + filters.posts.likedBy = app.current.data.user.username(); + } + }); }); diff --git a/extensions/likes/js/tsconfig.json b/extensions/likes/js/tsconfig.json index f427c289ee..519ed73b2d 100644 --- a/extensions/likes/js/tsconfig.json +++ b/extensions/likes/js/tsconfig.json @@ -9,12 +9,7 @@ // This will output typings to `dist-typings` "declarationDir": "./dist-typings", "paths": { - "flarum/*": ["../../../framework/core/js/dist-typings/*"], - // TODO: remove after export registry system implemented - // Without this, the old-style `@flarum/core` import is resolved to - // source code in flarum/core instead of the dist typings. - // This causes an inaccurate "duplicate export" error. - "@flarum/core/*": ["../../../framework/core/js/dist-typings/*"], + "flarum/*": ["../../../framework/core/js/dist-typings/*"] } } } diff --git a/extensions/likes/less/forum.less b/extensions/likes/less/forum.less index 58a8ae3bfa..79c706511c 100644 --- a/extensions/likes/less/forum.less +++ b/extensions/likes/less/forum.less @@ -4,7 +4,7 @@ margin: 0; a { - color: @text-color; + color: var(--text-color); font-size: 15px; font-weight: bold; display: block; diff --git a/extensions/likes/locale/en.yml b/extensions/likes/locale/en.yml index f48275a585..42d3024c63 100644 --- a/extensions/likes/locale/en.yml +++ b/extensions/likes/locale/en.yml @@ -44,3 +44,13 @@ flarum-likes: # These translations are used in the User profile page. user: likes_link: Likes + + # Translations in this namespace are used by the forum and admin interfaces. + lib: + + # These translations are used by gambits. Gambit keys must be in snake_case, no spaces. + gambits: + posts: + likedBy: + key: likedBy + hint: The ID or username of the user diff --git a/extensions/likes/src/Api/LoadLikesRelationship.php b/extensions/likes/src/Api/LoadLikesRelationship.php deleted file mode 100644 index 4f9b626197..0000000000 --- a/extensions/likes/src/Api/LoadLikesRelationship.php +++ /dev/null @@ -1,65 +0,0 @@ -getQuery()->getGrammar(); - - $query - // So that we can tell if the current user has liked the post. - ->orderBy(new Expression($grammar->wrap('user_id').' = '.$actor->id), 'desc') - // Limiting a relationship results is only possible because - // the Post model uses the \Staudenmeir\EloquentEagerLimit\HasEagerLimit - // trait. - ->limit(self::$maxLikes); - } - - /** - * Called using the @see ApiController::prepareDataForSerialization extender. - */ - public static function countRelation(AbstractSerializeController $controller, mixed $data): array - { - $loadable = null; - - if ($data instanceof Discussion) { - // We do this because the ShowDiscussionController manipulates the posts - // in a way that some of them are just ids. - $loadable = $data->posts->filter(function ($post) { - return $post instanceof Post; - }); - } elseif ($data instanceof Collection) { - $loadable = $data; - } elseif ($data instanceof Post) { - $loadable = $data->newCollection([$data]); - } - - if ($loadable) { - $loadable->loadCount('likes'); - } - - return []; - } -} diff --git a/extensions/likes/src/Api/PostResourceFields.php b/extensions/likes/src/Api/PostResourceFields.php new file mode 100644 index 0000000000..ad4a3f403d --- /dev/null +++ b/extensions/likes/src/Api/PostResourceFields.php @@ -0,0 +1,66 @@ +visible(false) + ->writable(fn (Post $post, Context $context) => $context->getActor()->can('like', $post)) + ->set(function (Post $post, bool $liked, Context $context) { + $actor = $context->getActor(); + + $currentlyLiked = $post->likes()->where('user_id', $actor->id)->exists(); + + if ($liked && ! $currentlyLiked) { + $post->likes()->attach($actor->id); + + $post->raise(new PostWasLiked($post, $actor)); + } elseif ($currentlyLiked) { + $post->likes()->detach($actor->id); + + $post->raise(new PostWasUnliked($post, $actor)); + } + }), + + Schema\Boolean::make('canLike') + ->get(fn (Post $post, Context $context) => $context->getActor()->can('like', $post)), + Schema\Integer::make('likesCount') + ->countRelation('likes'), + + Schema\Relationship\ToMany::make('likes') + ->type('users') + ->includable() + ->scope(function (BelongsToMany $query, Context $context) { + $actor = $context->getActor(); + $grammar = $query->getQuery()->getGrammar(); + + // So that we can tell if the current user has liked the post. + $query + ->orderBy(new Expression($grammar->wrap('user_id').' = '.$actor->id), 'desc') + ->orderBy('created_at') + ->limit(static::$maxLikes); + }), + ]; + } +} diff --git a/extensions/likes/src/Listener/SaveLikesToDatabase.php b/extensions/likes/src/Listener/SaveLikesToDatabase.php deleted file mode 100755 index 8be625e9b9..0000000000 --- a/extensions/likes/src/Listener/SaveLikesToDatabase.php +++ /dev/null @@ -1,55 +0,0 @@ -listen(Saving::class, $this->whenPostIsSaving(...)); - $events->listen(Deleted::class, $this->whenPostIsDeleted(...)); - } - - public function whenPostIsSaving(Saving $event): void - { - $post = $event->post; - $data = $event->data; - - if ($post->exists && isset($data['attributes']['isLiked'])) { - $actor = $event->actor; - $liked = (bool) $data['attributes']['isLiked']; - - $actor->assertCan('like', $post); - - $currentlyLiked = $post->likes()->where('user_id', $actor->id)->exists(); - - if ($liked && ! $currentlyLiked) { - $post->likes()->attach($actor->id); - - $post->raise(new PostWasLiked($post, $actor)); - } elseif ($currentlyLiked) { - $post->likes()->detach($actor->id); - - $post->raise(new PostWasUnliked($post, $actor)); - } - } - } - - public function whenPostIsDeleted(Deleted $event): void - { - $event->post->likes()->detach(); - } -} diff --git a/extensions/likes/src/Notification/PostLikedBlueprint.php b/extensions/likes/src/Notification/PostLikedBlueprint.php index b5b9854ebb..bbb00c62aa 100644 --- a/extensions/likes/src/Notification/PostLikedBlueprint.php +++ b/extensions/likes/src/Notification/PostLikedBlueprint.php @@ -10,11 +10,12 @@ namespace Flarum\Likes\Notification; use Flarum\Database\AbstractModel; +use Flarum\Notification\AlertableInterface; use Flarum\Notification\Blueprint\BlueprintInterface; use Flarum\Post\Post; use Flarum\User\User; -class PostLikedBlueprint implements BlueprintInterface +class PostLikedBlueprint implements BlueprintInterface, AlertableInterface { public function __construct( public Post $post, diff --git a/extensions/likes/src/Query/LikedByFilter.php b/extensions/likes/src/Query/LikedByFilter.php index 13e09ace0c..5398f522a7 100644 --- a/extensions/likes/src/Query/LikedByFilter.php +++ b/extensions/likes/src/Query/LikedByFilter.php @@ -9,24 +9,40 @@ namespace Flarum\Likes\Query; -use Flarum\Filter\FilterInterface; -use Flarum\Filter\FilterState; -use Flarum\Filter\ValidateFilterTrait; +use Flarum\Search\Database\DatabaseSearchState; +use Flarum\Search\Filter\FilterInterface; +use Flarum\Search\SearchState; +use Flarum\Search\ValidateFilterTrait; +use Flarum\User\UserRepository; +/** + * @implements FilterInterface + */ class LikedByFilter implements FilterInterface { use ValidateFilterTrait; + public function __construct( + protected UserRepository $users + ) { + } + public function getFilterKey(): string { return 'likedBy'; } - public function filter(FilterState $filterState, string|array $filterValue, bool $negate): void + public function filter(SearchState $state, string|array $value, bool $negate): void { - $likedId = $this->asInt($filterValue); + $likedUsername = $this->asString($value); + + $likedId = $this->users->getIdForUsername($likedUsername); + + if (! $likedId) { + $likedId = intval($likedUsername); + } - $filterState + $state ->getQuery() ->whereIn('id', function ($query) use ($likedId, $negate) { $query->select('post_id') diff --git a/extensions/likes/src/Query/LikedFilter.php b/extensions/likes/src/Query/LikedFilter.php index 155b4c4441..e22cd674be 100644 --- a/extensions/likes/src/Query/LikedFilter.php +++ b/extensions/likes/src/Query/LikedFilter.php @@ -9,24 +9,34 @@ namespace Flarum\Likes\Query; -use Flarum\Filter\FilterInterface; -use Flarum\Filter\FilterState; -use Flarum\Filter\ValidateFilterTrait; +use Flarum\Search\Database\DatabaseSearchState; +use Flarum\Search\Filter\FilterInterface; +use Flarum\Search\SearchState; +use Flarum\Search\ValidateFilterTrait; +use Flarum\User\UserRepository; +/** + * @implements FilterInterface + */ class LikedFilter implements FilterInterface { use ValidateFilterTrait; + public function __construct( + protected UserRepository $users + ) { + } + public function getFilterKey(): string { return 'liked'; } - public function filter(FilterState $filterState, string|array $filterValue, bool $negate): void + public function filter(SearchState $state, string|array $value, bool $negate): void { - $likedId = $this->asString($filterValue); + $likedId = $this->asString($value); - $filterState + $state ->getQuery() ->whereIn('id', function ($query) use ($likedId) { $query->select('user_id') diff --git a/extensions/likes/tests/integration/api/LikePostTest.php b/extensions/likes/tests/integration/api/LikePostTest.php index 4bcbe49faa..d79c4f76bc 100644 --- a/extensions/likes/tests/integration/api/LikePostTest.php +++ b/extensions/likes/tests/integration/api/LikePostTest.php @@ -10,9 +10,15 @@ namespace Flarum\Likes\Tests\integration\api; use Carbon\Carbon; +use Flarum\Discussion\Discussion; +use Flarum\Group\Group; use Flarum\Post\CommentPost; +use Flarum\Post\Post; use Flarum\Testing\integration\RetrievesAuthorizedUsers; use Flarum\Testing\integration\TestCase; +use Flarum\User\User; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Psr\Http\Message\ResponseInterface; class LikePostTest extends TestCase @@ -26,21 +32,21 @@ protected function setUp(): void $this->extension('flarum-likes'); $this->prepareDatabase([ - 'users' => [ + User::class => [ ['id' => 1, 'username' => 'Muralf', 'email' => 'muralf@machine.local', 'is_email_confirmed' => 1], $this->normalUser(), ['id' => 3, 'username' => 'Acme', 'email' => 'acme@machine.local', 'is_email_confirmed' => 1], ], - 'discussions' => [ + Discussion::class => [ ['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 1, 'comment_count' => 2], ], - 'posts' => [ + Post::class => [ ['id' => 1, 'number' => 1, 'discussion_id' => 1, 'created_at' => Carbon::now(), 'user_id' => 1, 'type' => 'comment', 'content' => '

    something

    '], ['id' => 3, 'number' => 2, 'discussion_id' => 1, 'created_at' => Carbon::now(), 'user_id' => 1, 'type' => 'comment', 'content' => '

    something

    '], ['id' => 5, 'number' => 3, 'discussion_id' => 1, 'created_at' => Carbon::now(), 'user_id' => 3, 'type' => 'discussionRenamed', 'content' => '

    something

    '], ['id' => 6, 'number' => 4, 'discussion_id' => 1, 'created_at' => Carbon::now(), 'user_id' => 1, 'type' => 'comment', 'content' => '

    something

    '], ], - 'groups' => [ + Group::class => [ ['id' => 5, 'name_singular' => 'Acme', 'name_plural' => 'Acme', 'is_hidden' => 0], ['id' => 6, 'name_singular' => 'Acme1', 'name_plural' => 'Acme1', 'is_hidden' => 0] ], @@ -56,10 +62,8 @@ protected function rewriteDefaultPermissionsAfterBoot() $this->database()->table('group_permission')->insert(['permission' => 'discussion.likePosts', 'group_id' => 5]); } - /** - * @dataProvider allowedUsersToLike - * @test - */ + #[Test] + #[DataProvider('allowedUsersToLike')] public function can_like_a_post_if_allowed(int $postId, ?int $authenticatedAs, string $message, bool $canLikeOwnPost = null) { if (! is_null($canLikeOwnPost)) { @@ -72,14 +76,12 @@ public function can_like_a_post_if_allowed(int $postId, ?int $authenticatedAs, s $post = CommentPost::query()->find($postId); - $this->assertEquals(200, $response->getStatusCode()); + $this->assertEquals(200, $response->getStatusCode(), $response->getBody()->getContents()); $this->assertNotNull($post->likes->where('id', $authenticatedAs)->first(), $message); } - /** - * @dataProvider unallowedUsersToLike - * @test - */ + #[Test] + #[DataProvider('unallowedUsersToLike')] public function cannot_like_a_post_if_not_allowed(int $postId, ?int $authenticatedAs, string $message, bool $canLikeOwnPost = null) { if (! is_null($canLikeOwnPost)) { @@ -92,14 +94,12 @@ public function cannot_like_a_post_if_not_allowed(int $postId, ?int $authenticat $post = CommentPost::query()->find($postId); - $this->assertEquals(403, $response->getStatusCode(), $message); + $this->assertContainsEquals($response->getStatusCode(), [401, 403], $message); $this->assertNull($post->likes->where('id', $authenticatedAs)->first()); } - /** - * @dataProvider allowedUsersToLike - * @test - */ + #[Test] + #[DataProvider('allowedUsersToLike')] public function can_dislike_a_post_if_liked_and_allowed(int $postId, ?int $authenticatedAs, string $message, bool $canLikeOwnPost = null) { if (! is_null($canLikeOwnPost)) { @@ -117,7 +117,7 @@ public function can_dislike_a_post_if_liked_and_allowed(int $postId, ?int $authe $this->assertNull($post->likes->where('id', $authenticatedAs)->first(), $message); } - public function allowedUsersToLike(): array + public static function allowedUsersToLike(): array { return [ [1, 1, 'Admin can like any post'], @@ -126,7 +126,7 @@ public function allowedUsersToLike(): array ]; } - public function unallowedUsersToLike(): array + public static function unallowedUsersToLike(): array { return [ [1, null, 'Guest cannot like any post'], diff --git a/extensions/likes/tests/integration/api/ListPostsTest.php b/extensions/likes/tests/integration/api/ListPostsTest.php index 59a8f7a43a..6b853f2694 100644 --- a/extensions/likes/tests/integration/api/ListPostsTest.php +++ b/extensions/likes/tests/integration/api/ListPostsTest.php @@ -10,11 +10,16 @@ namespace Flarum\Likes\Tests\integration\api\discussions; use Carbon\Carbon; +use Flarum\Discussion\Discussion; use Flarum\Group\Group; -use Flarum\Likes\Api\LoadLikesRelationship; +use Flarum\Likes\Api\PostResourceFields; +use Flarum\Post\Post; use Flarum\Testing\integration\RetrievesAuthorizedUsers; use Flarum\Testing\integration\TestCase; +use Flarum\User\User; use Illuminate\Support\Arr; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; class ListPostsTest extends TestCase { @@ -30,13 +35,13 @@ protected function setUp(): void $this->extension('flarum-likes'); $this->prepareDatabase([ - 'discussions' => [ + Discussion::class => [ ['id' => 100, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 101, 'comment_count' => 1], ], - 'posts' => [ + Post::class => [ ['id' => 101, 'discussion_id' => 100, 'created_at' => Carbon::now(), 'user_id' => 1, 'type' => 'comment', 'content' => '

    text

    '], ], - 'users' => [ + User::class => [ $this->normalUser(), ['id' => 102, 'username' => 'user102', 'email' => '102@machine.local', 'is_email_confirmed' => 1], ['id' => 103, 'username' => 'user103', 'email' => '103@machine.local', 'is_email_confirmed' => 1], @@ -51,17 +56,17 @@ protected function setUp(): void ['id' => 112, 'username' => 'user112', 'email' => '112@machine.local', 'is_email_confirmed' => 1], ], 'post_likes' => [ - ['user_id' => 102, 'post_id' => 101], - ['user_id' => 104, 'post_id' => 101], - ['user_id' => 105, 'post_id' => 101], - ['user_id' => 106, 'post_id' => 101], - ['user_id' => 107, 'post_id' => 101], - ['user_id' => 108, 'post_id' => 101], - ['user_id' => 109, 'post_id' => 101], - ['user_id' => 110, 'post_id' => 101], - ['user_id' => 2, 'post_id' => 101], - ['user_id' => 111, 'post_id' => 101], - ['user_id' => 112, 'post_id' => 101], + ['user_id' => 102, 'post_id' => 101, 'created_at' => Carbon::now()->addMinutes(2)], + ['user_id' => 104, 'post_id' => 101, 'created_at' => Carbon::now()->addMinutes(3)], + ['user_id' => 105, 'post_id' => 101, 'created_at' => Carbon::now()->addMinutes(4)], + ['user_id' => 106, 'post_id' => 101, 'created_at' => Carbon::now()->addMinutes(5)], + ['user_id' => 107, 'post_id' => 101, 'created_at' => Carbon::now()->addMinutes(6)], + ['user_id' => 108, 'post_id' => 101, 'created_at' => Carbon::now()->addMinutes(7)], + ['user_id' => 109, 'post_id' => 101, 'created_at' => Carbon::now()->addMinutes(8)], + ['user_id' => 110, 'post_id' => 101, 'created_at' => Carbon::now()->addMinutes(9)], + ['user_id' => 2, 'post_id' => 101, 'created_at' => Carbon::now()->addMinutes(10)], + ['user_id' => 111, 'post_id' => 101, 'created_at' => Carbon::now()->addMinutes(11)], + ['user_id' => 112, 'post_id' => 101, 'created_at' => Carbon::now()->addMinutes(12)], ], 'group_permission' => [ ['group_id' => Group::GUEST_ID, 'permission' => 'searchUsers'], @@ -69,9 +74,7 @@ protected function setUp(): void ]); } - /** - * @test - */ + #[Test] public function liked_filter_works() { $response = $this->send( @@ -92,9 +95,7 @@ public function liked_filter_works() ], $ids, 'IDs do not match'); } - /** - * @test - */ + #[Test] public function liked_filter_works_negated() { $response = $this->send( @@ -113,7 +114,7 @@ public function liked_filter_works_negated() $this->assertEqualsCanonicalizing([1, 103], $ids, 'IDs do not match'); } - /** @test */ + #[Test] public function likes_relation_returns_limited_results_and_shows_only_visible_posts_in_show_post_endpoint() { // List posts endpoint @@ -132,14 +133,14 @@ public function likes_relation_returns_limited_results_and_shows_only_visible_po $likes = $data['relationships']['likes']['data']; // Only displays a limited amount of likes - $this->assertCount(LoadLikesRelationship::$maxLikes, $likes); + $this->assertCount(PostResourceFields::$maxLikes, $likes); // Displays the correct count of likes $this->assertEquals(11, $data['attributes']['likesCount']); // Of the limited amount of likes, the actor always appears $this->assertEquals([2, 102, 104, 105], Arr::pluck($likes, 'id')); } - /** @test */ + #[Test] public function likes_relation_returns_limited_results_and_shows_only_visible_posts_in_list_posts_endpoint() { // List posts endpoint @@ -159,52 +160,55 @@ public function likes_relation_returns_limited_results_and_shows_only_visible_po $likes = $data[0]['relationships']['likes']['data']; // Only displays a limited amount of likes - $this->assertCount(LoadLikesRelationship::$maxLikes, $likes); + $this->assertCount(PostResourceFields::$maxLikes, $likes); // Displays the correct count of likes $this->assertEquals(11, $data[0]['attributes']['likesCount']); // Of the limited amount of likes, the actor always appears $this->assertEquals([2, 102, 104, 105], Arr::pluck($likes, 'id')); } - /** - * @dataProvider likesIncludeProvider - * @test - */ - public function likes_relation_returns_limited_results_and_shows_only_visible_posts_in_show_discussion_endpoint(string $include) + #[Test] + #[DataProvider('likesIncludeProvider')] + public function likes_relation_returns_limited_results_and_shows_only_visible_posts_in_show_discussion_endpoint(?string $include) { // Show discussion endpoint $response = $this->send( - $this->request('GET', '/api/discussions/100', [ + $this->request('GET', '/api/posts', [ 'authenticatedAs' => 2, ])->withQueryParams([ + 'filter' => ['discussion' => 100], 'include' => $include, ]) ); - $included = json_decode($response->getBody()->getContents(), true)['included']; + $body = $response->getBody()->getContents(); + + $this->assertEquals(200, $response->getStatusCode(), $body); + + $included = json_decode($body, true)['data'] ?? []; $likes = collect($included) ->where('type', 'posts') ->where('id', 101) - ->first()['relationships']['likes']['data']; + ->first()['relationships']['likes']['data'] ?? null; // Only displays a limited amount of likes - $this->assertCount(LoadLikesRelationship::$maxLikes, $likes); + $this->assertNotNull($likes, $body); + $this->assertCount(PostResourceFields::$maxLikes, $likes); // Displays the correct count of likes $this->assertEquals(11, collect($included) ->where('type', 'posts') ->where('id', 101) - ->first()['attributes']['likesCount']); + ->first()['attributes']['likesCount'] ?? null, $body); // Of the limited amount of likes, the actor always appears - $this->assertEquals([2, 102, 104, 105], Arr::pluck($likes, 'id')); + $this->assertEquals([2, 102, 104, 105], Arr::pluck($likes, 'id'), $body); } - public function likesIncludeProvider(): array + public static function likesIncludeProvider(): array { return [ - ['posts,posts.likes'], - ['posts.likes'], - [''], + ['likes'], + [null], ]; } } diff --git a/extensions/likes/tests/phpunit.integration.xml b/extensions/likes/tests/phpunit.integration.xml index 7319d929ae..e3e14eab99 100644 --- a/extensions/likes/tests/phpunit.integration.xml +++ b/extensions/likes/tests/phpunit.integration.xml @@ -1,22 +1,20 @@ - + ../src/ - + ./integration diff --git a/extensions/likes/tests/phpunit.unit.xml b/extensions/likes/tests/phpunit.unit.xml index 66262dd9ff..67367a782d 100644 --- a/extensions/likes/tests/phpunit.unit.xml +++ b/extensions/likes/tests/phpunit.unit.xml @@ -1,28 +1,23 @@ - + ../src/ - + ./unit - - - diff --git a/extensions/lock/.gitignore b/extensions/lock/.gitignore index 4ebb168a05..e60e512061 100644 --- a/extensions/lock/.gitignore +++ b/extensions/lock/.gitignore @@ -4,6 +4,7 @@ composer.phar .DS_Store Thumbs.db +tests/.phpunit.cache tests/.phpunit.result.cache /tests/integration/tmp .vagrant diff --git a/extensions/lock/LICENSE b/extensions/lock/LICENSE index 54ac29ab2c..bb6e15d87e 100644 --- a/extensions/lock/LICENSE +++ b/extensions/lock/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019-2021 Stichting Flarum (Flarum Foundation) +Copyright (c) 2019-2024 Stichting Flarum (Flarum Foundation) Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/extensions/lock/extend.php b/extensions/lock/extend.php index 9cf4429c6e..ad902dcd4b 100644 --- a/extensions/lock/extend.php +++ b/extensions/lock/extend.php @@ -7,20 +7,20 @@ * LICENSE file that was distributed with this source code. */ -use Flarum\Api\Serializer\BasicDiscussionSerializer; -use Flarum\Api\Serializer\DiscussionSerializer; +use Flarum\Api\Context; +use Flarum\Api\Resource; +use Flarum\Api\Schema; use Flarum\Discussion\Discussion; -use Flarum\Discussion\Event\Saving; -use Flarum\Discussion\Filter\DiscussionFilterer; use Flarum\Discussion\Search\DiscussionSearcher; use Flarum\Extend; use Flarum\Lock\Access; use Flarum\Lock\Event\DiscussionWasLocked; use Flarum\Lock\Event\DiscussionWasUnlocked; +use Flarum\Lock\Filter\LockedFilter; use Flarum\Lock\Listener; use Flarum\Lock\Notification\DiscussionLockedBlueprint; use Flarum\Lock\Post\DiscussionLockedPost; -use Flarum\Lock\Query\LockedFilterGambit; +use Flarum\Search\Database\DatabaseSearchDriver; return [ (new Extend\Frontend('forum')) @@ -33,33 +33,44 @@ new Extend\Locales(__DIR__.'/locale'), (new Extend\Notification()) - ->type(DiscussionLockedBlueprint::class, BasicDiscussionSerializer::class, ['alert']), + ->type(DiscussionLockedBlueprint::class, ['alert']), (new Extend\Model(Discussion::class)) ->cast('is_locked', 'bool'), - (new Extend\ApiSerializer(DiscussionSerializer::class)) - ->attribute('isLocked', function (DiscussionSerializer $serializer, Discussion $discussion) { - return $discussion->is_locked; - }) - ->attribute('canLock', function (DiscussionSerializer $serializer, Discussion $discussion) { - return $serializer->getActor()->can('lock', $discussion); - }), + (new Extend\ApiResource(Resource\DiscussionResource::class)) + ->fields(fn () => [ + Schema\Boolean::make('isLocked') + ->writable(fn (Discussion $discussion, Context $context) => $context->getActor()->can('lock', $discussion)) + ->set(function (Discussion $discussion, bool $isLocked, Context $context) { + $actor = $context->getActor(); + + if ($discussion->is_locked === $isLocked) { + return; + } + + $discussion->is_locked = $isLocked; + + $discussion->raise( + $discussion->is_locked + ? new DiscussionWasLocked($discussion, $actor) + : new DiscussionWasUnlocked($discussion, $actor) + ); + }), + Schema\Boolean::make('canLock') + ->get(fn (Discussion $discussion, Context $context) => $context->getActor()->can('lock', $discussion)), + ]), (new Extend\Post()) ->type(DiscussionLockedPost::class), (new Extend\Event()) - ->listen(Saving::class, Listener\SaveLockedToDatabase::class) ->listen(DiscussionWasLocked::class, Listener\CreatePostWhenDiscussionIsLocked::class) ->listen(DiscussionWasUnlocked::class, Listener\CreatePostWhenDiscussionIsUnlocked::class), (new Extend\Policy()) ->modelPolicy(Discussion::class, Access\DiscussionPolicy::class), - (new Extend\Filter(DiscussionFilterer::class)) - ->addFilter(LockedFilterGambit::class), - - (new Extend\SimpleFlarumSearch(DiscussionSearcher::class)) - ->addGambit(LockedFilterGambit::class), + (new Extend\SearchDriver(DatabaseSearchDriver::class)) + ->addFilter(DiscussionSearcher::class, LockedFilter::class), ]; diff --git a/extensions/lock/js/dist/admin.js b/extensions/lock/js/dist/admin.js index 80267e015f..73137d9c2e 100644 --- a/extensions/lock/js/dist/admin.js +++ b/extensions/lock/js/dist/admin.js @@ -1,2 +1,2 @@ -(()=>{var e={n:o=>{var r=o&&o.__esModule?()=>o.default:()=>o;return e.d(r,{a:r}),r},d:(o,r)=>{for(var a in r)e.o(r,a)&&!e.o(o,a)&&Object.defineProperty(o,a,{enumerable:!0,get:r[a]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};(()=>{"use strict";e.r(o);const r=flarum.core.compat["admin/app"];var a=e.n(r);a().initializers.add("lock",(()=>{a().extensionData.for("flarum-lock").registerPermission({icon:"fas fa-lock",label:a().translator.trans("flarum-lock.admin.permissions.lock_discussions_label"),permission:"discussion.lock"},"moderate",95)}))})(),module.exports=o})(); +(()=>{var e={n:r=>{var o=r&&r.__esModule?()=>r.default:()=>r;return e.d(o,{a:o}),o},d:(r,o)=>{for(var a in o)e.o(o,a)&&!e.o(r,a)&&Object.defineProperty(r,a,{enumerable:!0,get:o[a]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};(()=>{"use strict";e.r(r),e.d(r,{extend:()=>m});const o=flarum.reg.get("core","admin/app");var a=e.n(o);const n=flarum.reg.get("core","common/extenders");var t=e.n(n);const s=flarum.reg.get("core","common/query/IGambit"),l=flarum.reg.get("core","common/app");var i=e.n(l);class c extends s.BooleanGambit{key(){return i().translator.trans("flarum-lock.lib.gambits.discussions.locked.key",{},!0)}filterKey(){return"locked"}}flarum.reg.add("flarum-lock","common/query/discussions/LockedGambit",c);const m=[(new(t().Search)).gambit("discussions",c),(new(t().Admin)).permission((()=>({icon:"fas fa-lock",label:a().translator.trans("flarum-lock.admin.permissions.lock_discussions_label"),permission:"discussion.lock"})),"moderate",95)];a().initializers.add("flarum-lock",(()=>{}))})(),module.exports=r})(); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/extensions/lock/js/dist/admin.js.map b/extensions/lock/js/dist/admin.js.map index 0c3c7186cf..5163784bcf 100644 --- a/extensions/lock/js/dist/admin.js.map +++ b/extensions/lock/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCExDC,IAAAA,aAAAA,IAAqB,QAAQ,KAC3BA,IAAAA,cAAAA,IAAsB,eAAeC,mBACnC,CACEC,KAAM,cACNC,MAAOH,IAAAA,WAAAA,MAAqB,wDAC5BI,WAAY,mBAEd,WACA,GACD,G","sources":["webpack://@flarum/lock/webpack/bootstrap","webpack://@flarum/lock/webpack/runtime/compat get default export","webpack://@flarum/lock/webpack/runtime/define property getters","webpack://@flarum/lock/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/lock/webpack/runtime/make namespace object","webpack://@flarum/lock/external root \"flarum.core.compat['admin/app']\"","webpack://@flarum/lock/./src/admin/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","import app from 'flarum/admin/app';\n\napp.initializers.add('lock', () => {\n app.extensionData.for('flarum-lock').registerPermission(\n {\n icon: 'fas fa-lock',\n label: app.translator.trans('flarum-lock.admin.permissions.lock_discussions_label'),\n permission: 'discussion.lock',\n },\n 'moderate',\n 95\n );\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","registerPermission","icon","label","permission"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,qDCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,oB,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,wBCAtD,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,c,aCE7C,MAAMW,UAAqB,EAAAC,cACxC,GAAAjB,GACE,OAAO,eAAekB,MAAM,iDAAkD,CAAC,GAAG,EACpF,CACA,SAAAC,GACE,MAAO,QACT,EAEFL,OAAOC,IAAIK,IAAI,cAAe,wCAAyCJ,GCRvE,MCCA,IDDgB,IAAI,aACnBK,OAAO,cAAeL,ICAU,IAAI,YAAeM,YAAW,KAAM,CACnEC,KAAM,cACNC,MAAO,eAAeN,MAAM,wDAC5BI,WAAY,qBACV,WAAY,KCLhB,iBAAiBF,IAAI,eAAe,Q","sources":["webpack://@flarum/lock/webpack/bootstrap","webpack://@flarum/lock/webpack/runtime/compat get default export","webpack://@flarum/lock/webpack/runtime/define property getters","webpack://@flarum/lock/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/lock/webpack/runtime/make namespace object","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'admin/app')\"","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'common/query/IGambit')\"","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'common/app')\"","webpack://@flarum/lock/./src/common/query/discussions/LockedGambit.ts","webpack://@flarum/lock/./src/common/extend.ts","webpack://@flarum/lock/./src/admin/extend.tsx","webpack://@flarum/lock/./src/admin/index.tsx"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'admin/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/query/IGambit');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/app');","import { BooleanGambit } from 'flarum/common/query/IGambit';\nimport app from 'flarum/common/app';\nexport default class LockedGambit extends BooleanGambit {\n key() {\n return app.translator.trans('flarum-lock.lib.gambits.discussions.locked.key', {}, true);\n }\n filterKey() {\n return 'locked';\n }\n}\nflarum.reg.add('flarum-lock', 'common/query/discussions/LockedGambit', LockedGambit);","import Extend from 'flarum/common/extenders';\nimport LockedGambit from './query/discussions/LockedGambit';\nexport default [new Extend.Search() //\n.gambit('discussions', LockedGambit)];","import Extend from 'flarum/common/extenders';\nimport app from 'flarum/admin/app';\nimport commonExtend from '../common/extend';\nexport default [...commonExtend, new Extend.Admin().permission(() => ({\n icon: 'fas fa-lock',\n label: app.translator.trans('flarum-lock.admin.permissions.lock_discussions_label'),\n permission: 'discussion.lock'\n}), 'moderate', 95)];","import app from 'flarum/admin/app';\nexport { default as extend } from './extend';\napp.initializers.add('flarum-lock', () => {\n // ...\n});"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","reg","LockedGambit","BooleanGambit","trans","filterKey","add","gambit","permission","icon","label"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/lock/js/dist/forum.js b/extensions/lock/js/dist/forum.js index 0a91106f88..ab02162035 100644 --- a/extensions/lock/js/dist/forum.js +++ b/extensions/lock/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var o={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return o.d(n,{a:n}),n},d:(t,n)=>{for(var e in n)o.o(n,e)&&!o.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},o:(o,t)=>Object.prototype.hasOwnProperty.call(o,t),r:o=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})}},t={};(()=>{"use strict";o.r(t),o.d(t,{extend:()=>O});const n=flarum.core.compat["common/extend"],e=flarum.core.compat["forum/app"];var c=o.n(e);const s=flarum.core.compat["forum/components/NotificationGrid"];var r=o.n(s);const a=flarum.core.compat["forum/components/Notification"];var i=o.n(a);class l extends(i()){icon(){return"fas fa-lock"}href(){const o=this.attrs.notification;return c().route.discussion(o.subject(),o.content().postNumber)}content(){return c().translator.trans("flarum-lock.forum.notifications.discussion_locked_text",{user:this.attrs.notification.fromUser()})}}const u=flarum.core.compat["common/models/Discussion"];var d=o.n(u);const f=flarum.core.compat["common/components/Badge"];var p=o.n(f);const k=flarum.core.compat["forum/utils/DiscussionControls"];var b=o.n(k);const _=flarum.core.compat["forum/components/DiscussionPage"];var v=o.n(_);const y=flarum.core.compat["common/components/Button"];var h=o.n(y);const x=flarum.core.compat["common/extenders"];var g=o.n(x);const L=flarum.core.compat["forum/components/EventPost"];var P=o.n(L);class j extends(P()){icon(){return this.attrs.post.content().locked?"fas fa-lock":"fas fa-unlock"}descriptionKey(){return this.attrs.post.content().locked?"flarum-lock.forum.post_stream.discussion_locked_text":"flarum-lock.forum.post_stream.discussion_unlocked_text"}}const O=[(new(g().PostTypes)).add("discussionLocked",j),new(g().Model)(d()).attribute("isLocked").attribute("canLock")];c().initializers.add("flarum-lock",(()=>{c().notificationComponents.discussionLocked=l,(0,n.extend)(d().prototype,"badges",(function(o){this.isLocked()&&o.add("locked",m(p(),{type:"locked",label:c().translator.trans("flarum-lock.forum.badge.locked_tooltip"),icon:"fas fa-lock"}))})),(0,n.extend)(b(),"moderationControls",(function(o,t){t.canLock()&&o.add("lock",m(h(),{icon:"fas fa-lock",onclick:this.lockAction.bind(t)},c().translator.trans("flarum-lock.forum.discussion_controls.".concat(t.isLocked()?"unlock":"lock","_button"))))})),b().lockAction=function(){this.save({isLocked:!this.isLocked()}).then((()=>{c().current.matches(v())&&c().current.get("stream").update(),m.redraw()}))},(0,n.extend)(r().prototype,"notificationTypes",(function(o){o.add("discussionLocked",{name:"discussionLocked",icon:"fas fa-lock",label:c().translator.trans("flarum-lock.forum.settings.notify_discussion_locked_label")})}))}))})(),module.exports=t})(); +(()=>{var o={n:e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},d:(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:(o,e)=>Object.prototype.hasOwnProperty.call(o,e),r:o=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})}},e={};(()=>{"use strict";o.r(e),o.d(e,{extend:()=>N});const t=flarum.reg.get("core","common/extend"),n=flarum.reg.get("core","forum/app");var r=o.n(n);const s=flarum.reg.get("core","common/models/Discussion");var c=o.n(s);const a=flarum.reg.get("core","common/components/Badge");var i=o.n(a);const l=flarum.reg.get("core","forum/utils/DiscussionControls");var u=o.n(l);const d=flarum.reg.get("core","forum/components/DiscussionPage");var f=o.n(d);const k=flarum.reg.get("core","common/components/Button");var g=o.n(k);const p=flarum.reg.get("core","common/extenders");var b=o.n(p);const y=flarum.reg.get("core","forum/components/EventPost");var _=o.n(y);class v extends(_()){icon(){return this.attrs.post.content().locked?"fas fa-lock":"fas fa-unlock"}descriptionKey(){return this.attrs.post.content().locked?"flarum-lock.forum.post_stream.discussion_locked_text":"flarum-lock.forum.post_stream.discussion_unlocked_text"}}flarum.reg.add("flarum-lock","forum/components/DiscussionLockedPost",v);const x=flarum.reg.get("core","common/query/IGambit"),L=flarum.reg.get("core","common/app");var h=o.n(L);class P extends x.BooleanGambit{key(){return h().translator.trans("flarum-lock.lib.gambits.discussions.locked.key",{},!0)}filterKey(){return"locked"}}flarum.reg.add("flarum-lock","common/query/discussions/LockedGambit",P);const w=[(new(b().Search)).gambit("discussions",P)],S=flarum.reg.get("core","forum/components/Notification");var j=o.n(S);class D extends(j()){icon(){return"fas fa-lock"}href(){const o=this.attrs.notification;return r().route.discussion(o.subject(),o.content().postNumber)}content(){return r().translator.trans("flarum-lock.forum.notifications.discussion_locked_text",{user:this.attrs.notification.fromUser()})}excerpt(){return null}}flarum.reg.add("flarum-lock","forum/components/DiscussionLockedNotification",D);const N=[...w,(new(b().PostTypes)).add("discussionLocked",v),(new(b().Notification)).add("discussionLocked",D),new(b().Model)(c()).attribute("isLocked").attribute("canLock")];r().initializers.add("flarum-lock",(()=>{(0,t.extend)(c().prototype,"badges",(function(o){this.isLocked()&&o.add("locked",m(i(),{type:"locked",label:r().translator.trans("flarum-lock.forum.badge.locked_tooltip"),icon:"fas fa-lock"}))})),(0,t.extend)(u(),"moderationControls",(function(o,e){e.canLock()&&o.add("lock",m(g(),{icon:"fas fa-lock",onclick:this.lockAction.bind(e)},r().translator.trans(`flarum-lock.forum.discussion_controls.${e.isLocked()?"unlock":"lock"}_button`)))})),u().lockAction=function(){this.save({isLocked:!this.isLocked()}).then((()=>{r().current.matches(f())&&r().current.get("stream").update(),m.redraw()}))},(0,t.extend)("flarum/forum/components/NotificationGrid","notificationTypes",(function(o){o.add("discussionLocked",{name:"discussionLocked",icon:"fas fa-lock",label:r().translator.trans("flarum-lock.forum.settings.notify_discussion_locked_label")})}))}))})(),module.exports=e})(); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/extensions/lock/js/dist/forum.js.map b/extensions/lock/js/dist/forum.js.map index cd2564581f..86fe4c4149 100644 --- a/extensions/lock/js/dist/forum.js.map +++ b/extensions/lock/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAA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AAKmB,YACPD,EAAOJ,IAAI,SAAUM,EAACC,IAAK,CAACC,KAAK,SAASC,MAAOrB,IAAAA,WAAAA,MAAqB,0CAA2CL,KAAK,gBAE1H,KCHAoB,EAAAA,EAAAA,QAAOO,IAAoB,sBAAsB,SAAUC,EAAOC,GAC5DA,EAAWC,WACbF,EAAMX,IACJ,OACAM,EAACQ,IAAM,CAAC/B,KAAK,cAAcgC,QAAS7B,KAAK8B,WAAWC,KAAKL,IACtDxB,IAAAA,WAAAA,MAAqB,yCAAD8B,OAA0CN,EAAWP,WAAa,SAAW,OAAM,aAIhH,IAEAK,IAAAA,WAAgC,WAC9BxB,KAAKiC,KAAK,CAAEd,UAAWnB,KAAKmB,aAAce,MAAK,KACzChC,IAAAA,QAAAA,QAAoBiC,MACtBjC,IAAAA,QAAAA,IAAgB,UAAUkC,SAG5BhB,EAAEiB,QAAQ,GAEd,GFVApB,EAAAA,EAAAA,QAAOqB,IAAAA,UAA4B,qBAAqB,SAAUb,GAChEA,EAAMX,IAAI,mBAAoB,CAC5ByB,KAAM,mBACN1C,KAAM,cACN0B,MAAOrB,IAAAA,WAAAA,MAAqB,8DAEhC,GAAE,G","sources":["webpack://@flarum/lock/webpack/bootstrap","webpack://@flarum/lock/webpack/runtime/compat get default export","webpack://@flarum/lock/webpack/runtime/define property getters","webpack://@flarum/lock/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/lock/webpack/runtime/make namespace object","webpack://@flarum/lock/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/lock/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/lock/external root \"flarum.core.compat['forum/components/NotificationGrid']\"","webpack://@flarum/lock/external root \"flarum.core.compat['forum/components/Notification']\"","webpack://@flarum/lock/./src/forum/components/DiscussionLockedNotification.js","webpack://@flarum/lock/external root \"flarum.core.compat['common/models/Discussion']\"","webpack://@flarum/lock/external root \"flarum.core.compat['common/components/Badge']\"","webpack://@flarum/lock/external root \"flarum.core.compat['forum/utils/DiscussionControls']\"","webpack://@flarum/lock/external root \"flarum.core.compat['forum/components/DiscussionPage']\"","webpack://@flarum/lock/external root \"flarum.core.compat['common/components/Button']\"","webpack://@flarum/lock/external root \"flarum.core.compat['common/extenders']\"","webpack://@flarum/lock/external root \"flarum.core.compat['forum/components/EventPost']\"","webpack://@flarum/lock/./src/forum/components/DiscussionLockedPost.js","webpack://@flarum/lock/./src/forum/extend.ts","webpack://@flarum/lock/./src/forum/index.js","webpack://@flarum/lock/./src/forum/addLockBadge.js","webpack://@flarum/lock/./src/forum/addLockControl.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/NotificationGrid'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/Notification'];","import app from 'flarum/forum/app';\nimport Notification from 'flarum/forum/components/Notification';\n\nexport default class DiscussionLockedNotification extends Notification {\n icon() {\n return 'fas fa-lock';\n }\n\n href() {\n const notification = this.attrs.notification;\n\n return app.route.discussion(notification.subject(), notification.content().postNumber);\n }\n\n content() {\n return app.translator.trans('flarum-lock.forum.notifications.discussion_locked_text', { user: this.attrs.notification.fromUser() });\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Discussion'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Badge'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/DiscussionControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extenders'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/EventPost'];","import EventPost from 'flarum/forum/components/EventPost';\n\nexport default class DiscussionLockedPost extends EventPost {\n icon() {\n return this.attrs.post.content().locked ? 'fas fa-lock' : 'fas fa-unlock';\n }\n\n descriptionKey() {\n return this.attrs.post.content().locked\n ? 'flarum-lock.forum.post_stream.discussion_locked_text'\n : 'flarum-lock.forum.post_stream.discussion_unlocked_text';\n }\n}\n","import Extend from 'flarum/common/extenders';\nimport Discussion from 'flarum/common/models/Discussion';\nimport DiscussionLockedPost from './components/DiscussionLockedPost';\n\nexport default [\n new Extend.PostTypes() //\n .add('discussionLocked', DiscussionLockedPost),\n\n new Extend.Model(Discussion) //\n .attribute('isLocked')\n .attribute('canLock'),\n];\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport NotificationGrid from 'flarum/forum/components/NotificationGrid';\n\nimport DiscussionLockedNotification from './components/DiscussionLockedNotification';\nimport addLockBadge from './addLockBadge';\nimport addLockControl from './addLockControl';\n\nexport { default as extend } from './extend';\n\napp.initializers.add('flarum-lock', () => {\n app.notificationComponents.discussionLocked = DiscussionLockedNotification;\n\n addLockBadge();\n addLockControl();\n\n extend(NotificationGrid.prototype, 'notificationTypes', function (items) {\n items.add('discussionLocked', {\n name: 'discussionLocked',\n icon: 'fas fa-lock',\n label: app.translator.trans('flarum-lock.forum.settings.notify_discussion_locked_label'),\n });\n });\n});\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport Discussion from 'flarum/common/models/Discussion';\nimport Badge from 'flarum/common/components/Badge';\n\nexport default function addLockBadge() {\n extend(Discussion.prototype, 'badges', function (badges) {\n if (this.isLocked()) {\n badges.add('locked', );\n }\n });\n}\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport DiscussionControls from 'flarum/forum/utils/DiscussionControls';\nimport DiscussionPage from 'flarum/forum/components/DiscussionPage';\nimport Button from 'flarum/common/components/Button';\n\nexport default function addLockControl() {\n extend(DiscussionControls, 'moderationControls', function (items, discussion) {\n if (discussion.canLock()) {\n items.add(\n 'lock',\n \n );\n }\n });\n\n DiscussionControls.lockAction = function () {\n this.save({ isLocked: !this.isLocked() }).then(() => {\n if (app.current.matches(DiscussionPage)) {\n app.current.get('stream').update();\n }\n\n m.redraw();\n });\n };\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","DiscussionLockedNotification","Notification","icon","href","notification","this","attrs","app","subject","content","postNumber","user","fromUser","DiscussionLockedPost","EventPost","post","locked","descriptionKey","Extend","add","Discussion","attribute","extend","badges","isLocked","m","Badge","type","label","DiscussionControls","items","discussion","canLock","Button","onclick","lockAction","bind","concat","save","then","DiscussionPage","update","redraw","NotificationGrid","name"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,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,QAAQ,GAEd,GFfA,IAAAf,QAAO,2CAA4C,qBAAqB,SAAUM,GAChFA,EAAMtB,IAAI,mBAAoB,CAC5BgC,KAAM,mBACNvC,KAAM,cACN4B,MAAO,eAAelB,MAAM,8DAEhC,GAAE,G","sources":["webpack://@flarum/lock/webpack/bootstrap","webpack://@flarum/lock/webpack/runtime/compat get default export","webpack://@flarum/lock/webpack/runtime/define property getters","webpack://@flarum/lock/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/lock/webpack/runtime/make namespace object","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'common/extend')\"","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'forum/app')\"","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'common/models/Discussion')\"","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'common/components/Badge')\"","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'forum/utils/DiscussionControls')\"","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'forum/components/DiscussionPage')\"","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'common/components/Button')\"","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'forum/components/EventPost')\"","webpack://@flarum/lock/./src/forum/components/DiscussionLockedPost.js","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'common/query/IGambit')\"","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'common/app')\"","webpack://@flarum/lock/./src/common/query/discussions/LockedGambit.ts","webpack://@flarum/lock/./src/common/extend.ts","webpack://@flarum/lock/external root \"flarum.reg.get('core', 'forum/components/Notification')\"","webpack://@flarum/lock/./src/forum/components/DiscussionLockedNotification.js","webpack://@flarum/lock/./src/forum/extend.ts","webpack://@flarum/lock/./src/forum/index.js","webpack://@flarum/lock/./src/forum/addLockBadge.js","webpack://@flarum/lock/./src/forum/addLockControl.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extend');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/models/Discussion');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Badge');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/utils/DiscussionControls');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/DiscussionPage');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Button');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/EventPost');","import EventPost from 'flarum/forum/components/EventPost';\nexport default class DiscussionLockedPost extends EventPost {\n icon() {\n return this.attrs.post.content().locked ? 'fas fa-lock' : 'fas fa-unlock';\n }\n descriptionKey() {\n return this.attrs.post.content().locked ? 'flarum-lock.forum.post_stream.discussion_locked_text' : 'flarum-lock.forum.post_stream.discussion_unlocked_text';\n }\n}\nflarum.reg.add('flarum-lock', 'forum/components/DiscussionLockedPost', DiscussionLockedPost);","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/query/IGambit');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/app');","import { BooleanGambit } from 'flarum/common/query/IGambit';\nimport app from 'flarum/common/app';\nexport default class LockedGambit extends BooleanGambit {\n key() {\n return app.translator.trans('flarum-lock.lib.gambits.discussions.locked.key', {}, true);\n }\n filterKey() {\n return 'locked';\n }\n}\nflarum.reg.add('flarum-lock', 'common/query/discussions/LockedGambit', LockedGambit);","import Extend from 'flarum/common/extenders';\nimport LockedGambit from './query/discussions/LockedGambit';\nexport default [new Extend.Search() //\n.gambit('discussions', LockedGambit)];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/Notification');","import app from 'flarum/forum/app';\nimport Notification from 'flarum/forum/components/Notification';\nexport default class DiscussionLockedNotification extends Notification {\n icon() {\n return 'fas fa-lock';\n }\n href() {\n const notification = this.attrs.notification;\n return app.route.discussion(notification.subject(), notification.content().postNumber);\n }\n content() {\n return app.translator.trans('flarum-lock.forum.notifications.discussion_locked_text', {\n user: this.attrs.notification.fromUser()\n });\n }\n excerpt() {\n return null;\n }\n}\nflarum.reg.add('flarum-lock', 'forum/components/DiscussionLockedNotification', DiscussionLockedNotification);","import Extend from 'flarum/common/extenders';\nimport Discussion from 'flarum/common/models/Discussion';\nimport DiscussionLockedPost from './components/DiscussionLockedPost';\nimport commonExtend from '../common/extend';\nimport DiscussionLockedNotification from './components/DiscussionLockedNotification';\nexport default [...commonExtend, new Extend.PostTypes() //\n.add('discussionLocked', DiscussionLockedPost), new Extend.Notification() //\n.add('discussionLocked', DiscussionLockedNotification), new Extend.Model(Discussion) //\n.attribute('isLocked').attribute('canLock')];","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport addLockBadge from './addLockBadge';\nimport addLockControl from './addLockControl';\nexport { default as extend } from './extend';\napp.initializers.add('flarum-lock', () => {\n addLockBadge();\n addLockControl();\n extend('flarum/forum/components/NotificationGrid', 'notificationTypes', function (items) {\n items.add('discussionLocked', {\n name: 'discussionLocked',\n icon: 'fas fa-lock',\n label: app.translator.trans('flarum-lock.forum.settings.notify_discussion_locked_label')\n });\n });\n});","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport Discussion from 'flarum/common/models/Discussion';\nimport Badge from 'flarum/common/components/Badge';\nexport default function addLockBadge() {\n extend(Discussion.prototype, 'badges', function (badges) {\n if (this.isLocked()) {\n badges.add('locked', m(Badge, {\n type: \"locked\",\n label: app.translator.trans('flarum-lock.forum.badge.locked_tooltip'),\n icon: \"fas fa-lock\"\n }));\n }\n });\n}","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport DiscussionControls from 'flarum/forum/utils/DiscussionControls';\nimport DiscussionPage from 'flarum/forum/components/DiscussionPage';\nimport Button from 'flarum/common/components/Button';\nexport default function addLockControl() {\n extend(DiscussionControls, 'moderationControls', function (items, discussion) {\n if (discussion.canLock()) {\n items.add('lock', m(Button, {\n icon: \"fas fa-lock\",\n onclick: this.lockAction.bind(discussion)\n }, app.translator.trans(`flarum-lock.forum.discussion_controls.${discussion.isLocked() ? 'unlock' : 'lock'}_button`)));\n }\n });\n DiscussionControls.lockAction = function () {\n this.save({\n isLocked: !this.isLocked()\n }).then(() => {\n if (app.current.matches(DiscussionPage)) {\n app.current.get('stream').update();\n }\n m.redraw();\n });\n };\n}"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","reg","DiscussionLockedPost","icon","this","attrs","post","content","locked","descriptionKey","add","LockedGambit","BooleanGambit","trans","filterKey","gambit","DiscussionLockedNotification","href","notification","discussion","subject","postNumber","user","fromUser","excerpt","attribute","extend","badges","isLocked","m","type","label","items","canLock","onclick","lockAction","bind","save","then","matches","update","redraw","name"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/lock/js/package.json b/extensions/lock/js/package.json index 029703f92d..740983e344 100644 --- a/extensions/lock/js/package.json +++ b/extensions/lock/js/package.json @@ -5,7 +5,7 @@ "prettier": "@flarum/prettier-config", "devDependencies": { "prettier": "^2.5.1", - "flarum-webpack-config": "^2.0.0", + "flarum-webpack-config": "^3.0.0", "webpack": "^5.76.0", "webpack-cli": "^4.9.1", "@flarum/prettier-config": "^1.0.0", diff --git a/extensions/lock/js/src/admin/extend.tsx b/extensions/lock/js/src/admin/extend.tsx new file mode 100644 index 0000000000..2c344730cb --- /dev/null +++ b/extensions/lock/js/src/admin/extend.tsx @@ -0,0 +1,17 @@ +import Extend from 'flarum/common/extenders'; +import app from 'flarum/admin/app'; +import commonExtend from '../common/extend'; + +export default [ + ...commonExtend, + + new Extend.Admin().permission( + () => ({ + icon: 'fas fa-lock', + label: app.translator.trans('flarum-lock.admin.permissions.lock_discussions_label'), + permission: 'discussion.lock', + }), + 'moderate', + 95 + ), +]; diff --git a/extensions/lock/js/src/admin/index.js b/extensions/lock/js/src/admin/index.js deleted file mode 100644 index 55c5a208ac..0000000000 --- a/extensions/lock/js/src/admin/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import app from 'flarum/admin/app'; - -app.initializers.add('lock', () => { - app.extensionData.for('flarum-lock').registerPermission( - { - icon: 'fas fa-lock', - label: app.translator.trans('flarum-lock.admin.permissions.lock_discussions_label'), - permission: 'discussion.lock', - }, - 'moderate', - 95 - ); -}); diff --git a/extensions/lock/js/src/admin/index.tsx b/extensions/lock/js/src/admin/index.tsx new file mode 100644 index 0000000000..b81aa14019 --- /dev/null +++ b/extensions/lock/js/src/admin/index.tsx @@ -0,0 +1,7 @@ +import app from 'flarum/admin/app'; + +export { default as extend } from './extend'; + +app.initializers.add('flarum-lock', () => { + // ... +}); diff --git a/extensions/lock/js/src/common/extend.ts b/extensions/lock/js/src/common/extend.ts new file mode 100644 index 0000000000..8f6a32cf5b --- /dev/null +++ b/extensions/lock/js/src/common/extend.ts @@ -0,0 +1,7 @@ +import Extend from 'flarum/common/extenders'; +import LockedGambit from './query/discussions/LockedGambit'; + +export default [ + new Extend.Search() // + .gambit('discussions', LockedGambit), +]; diff --git a/extensions/lock/js/src/common/query/discussions/LockedGambit.ts b/extensions/lock/js/src/common/query/discussions/LockedGambit.ts new file mode 100644 index 0000000000..6a91875086 --- /dev/null +++ b/extensions/lock/js/src/common/query/discussions/LockedGambit.ts @@ -0,0 +1,12 @@ +import { BooleanGambit } from 'flarum/common/query/IGambit'; +import app from 'flarum/common/app'; + +export default class LockedGambit extends BooleanGambit { + key(): string { + return app.translator.trans('flarum-lock.lib.gambits.discussions.locked.key', {}, true); + } + + filterKey(): string { + return 'locked'; + } +} diff --git a/extensions/lock/js/src/forum/components/DiscussionLockedNotification.js b/extensions/lock/js/src/forum/components/DiscussionLockedNotification.js index adc96149c4..1f1fb9c738 100644 --- a/extensions/lock/js/src/forum/components/DiscussionLockedNotification.js +++ b/extensions/lock/js/src/forum/components/DiscussionLockedNotification.js @@ -15,4 +15,8 @@ export default class DiscussionLockedNotification extends Notification { content() { return app.translator.trans('flarum-lock.forum.notifications.discussion_locked_text', { user: this.attrs.notification.fromUser() }); } + + excerpt() { + return null; + } } diff --git a/extensions/lock/js/src/forum/extend.ts b/extensions/lock/js/src/forum/extend.ts index 2e510e1054..3c45553a51 100644 --- a/extensions/lock/js/src/forum/extend.ts +++ b/extensions/lock/js/src/forum/extend.ts @@ -2,10 +2,18 @@ import Extend from 'flarum/common/extenders'; import Discussion from 'flarum/common/models/Discussion'; import DiscussionLockedPost from './components/DiscussionLockedPost'; +import commonExtend from '../common/extend'; +import DiscussionLockedNotification from './components/DiscussionLockedNotification'; + export default [ + ...commonExtend, + new Extend.PostTypes() // .add('discussionLocked', DiscussionLockedPost), + new Extend.Notification() // + .add('discussionLocked', DiscussionLockedNotification), + new Extend.Model(Discussion) // .attribute('isLocked') .attribute('canLock'), diff --git a/extensions/lock/js/src/forum/index.js b/extensions/lock/js/src/forum/index.js index 0ac405d3cf..86d8bafd42 100644 --- a/extensions/lock/js/src/forum/index.js +++ b/extensions/lock/js/src/forum/index.js @@ -1,20 +1,16 @@ import { extend } from 'flarum/common/extend'; import app from 'flarum/forum/app'; -import NotificationGrid from 'flarum/forum/components/NotificationGrid'; -import DiscussionLockedNotification from './components/DiscussionLockedNotification'; import addLockBadge from './addLockBadge'; import addLockControl from './addLockControl'; export { default as extend } from './extend'; app.initializers.add('flarum-lock', () => { - app.notificationComponents.discussionLocked = DiscussionLockedNotification; - addLockBadge(); addLockControl(); - extend(NotificationGrid.prototype, 'notificationTypes', function (items) { + extend('flarum/forum/components/NotificationGrid', 'notificationTypes', function (items) { items.add('discussionLocked', { name: 'discussionLocked', icon: 'fas fa-lock', diff --git a/extensions/lock/js/tsconfig.json b/extensions/lock/js/tsconfig.json index f427c289ee..519ed73b2d 100644 --- a/extensions/lock/js/tsconfig.json +++ b/extensions/lock/js/tsconfig.json @@ -9,12 +9,7 @@ // This will output typings to `dist-typings` "declarationDir": "./dist-typings", "paths": { - "flarum/*": ["../../../framework/core/js/dist-typings/*"], - // TODO: remove after export registry system implemented - // Without this, the old-style `@flarum/core` import is resolved to - // source code in flarum/core instead of the dist typings. - // This causes an inaccurate "duplicate export" error. - "@flarum/core/*": ["../../../framework/core/js/dist-typings/*"], + "flarum/*": ["../../../framework/core/js/dist-typings/*"] } } } diff --git a/extensions/lock/locale/en.yml b/extensions/lock/locale/en.yml index ed13f3bb84..5690fd0b0d 100644 --- a/extensions/lock/locale/en.yml +++ b/extensions/lock/locale/en.yml @@ -35,3 +35,12 @@ flarum-lock: # These translations are used in the Settings page. settings: notify_discussion_locked_label: Someone locks a discussion I started + + # Translations in this namespace are used by the forum and admin interfaces. + lib: + + # These translations are used by gambits. Gambit keys must be in snake_case, no spaces. + gambits: + discussions: + locked: + key: locked diff --git a/extensions/lock/src/Filter/LockedFilter.php b/extensions/lock/src/Filter/LockedFilter.php new file mode 100644 index 0000000000..6d5cb2c2d8 --- /dev/null +++ b/extensions/lock/src/Filter/LockedFilter.php @@ -0,0 +1,36 @@ + + */ +class LockedFilter implements FilterInterface +{ + public function getFilterKey(): string + { + return 'locked'; + } + + public function filter(SearchState $state, string|array $value, bool $negate): void + { + $this->constrain($state->getQuery(), $negate); + } + + protected function constrain(Builder $query, bool $negate): void + { + $query->where('is_locked', ! $negate); + } +} diff --git a/extensions/lock/src/Listener/SaveLockedToDatabase.php b/extensions/lock/src/Listener/SaveLockedToDatabase.php deleted file mode 100755 index e3c107a4fd..0000000000 --- a/extensions/lock/src/Listener/SaveLockedToDatabase.php +++ /dev/null @@ -1,40 +0,0 @@ -data['attributes']['isLocked'])) { - $isLocked = (bool) $event->data['attributes']['isLocked']; - $discussion = $event->discussion; - $actor = $event->actor; - - $actor->assertCan('lock', $discussion); - - if ((bool) $discussion->is_locked === $isLocked) { - return; - } - - $discussion->is_locked = $isLocked; - - $discussion->raise( - $discussion->is_locked - ? new DiscussionWasLocked($discussion, $actor) - : new DiscussionWasUnlocked($discussion, $actor) - ); - } - } -} diff --git a/extensions/lock/src/Notification/DiscussionLockedBlueprint.php b/extensions/lock/src/Notification/DiscussionLockedBlueprint.php index e9614cdae8..0424043bc3 100644 --- a/extensions/lock/src/Notification/DiscussionLockedBlueprint.php +++ b/extensions/lock/src/Notification/DiscussionLockedBlueprint.php @@ -12,10 +12,11 @@ use Flarum\Database\AbstractModel; use Flarum\Discussion\Discussion; use Flarum\Lock\Post\DiscussionLockedPost; +use Flarum\Notification\AlertableInterface; use Flarum\Notification\Blueprint\BlueprintInterface; use Flarum\User\User; -class DiscussionLockedBlueprint implements BlueprintInterface +class DiscussionLockedBlueprint implements BlueprintInterface, AlertableInterface { public function __construct( protected DiscussionLockedPost $post diff --git a/extensions/lock/src/Query/LockedFilterGambit.php b/extensions/lock/src/Query/LockedFilterGambit.php deleted file mode 100644 index 2c3d14ad98..0000000000 --- a/extensions/lock/src/Query/LockedFilterGambit.php +++ /dev/null @@ -1,44 +0,0 @@ -constrain($search->getQuery(), $negate); - } - - public function getFilterKey(): string - { - return 'locked'; - } - - public function filter(FilterState $filterState, string|array $filterValue, bool $negate): void - { - $this->constrain($filterState->getQuery(), $negate); - } - - protected function constrain(Builder $query, bool $negate): void - { - $query->where('is_locked', ! $negate); - } -} diff --git a/extensions/markdown/.gitignore b/extensions/markdown/.gitignore index 4ebb168a05..e60e512061 100644 --- a/extensions/markdown/.gitignore +++ b/extensions/markdown/.gitignore @@ -4,6 +4,7 @@ composer.phar .DS_Store Thumbs.db +tests/.phpunit.cache tests/.phpunit.result.cache /tests/integration/tmp .vagrant diff --git a/extensions/markdown/LICENSE b/extensions/markdown/LICENSE index 5d2e42a645..c3d3b78ada 100644 --- a/extensions/markdown/LICENSE +++ b/extensions/markdown/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019-2021 Stichting Flarum (Flarum Foundation) +Copyright (c) 2019-2024 Stichting Flarum (Flarum Foundation) Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com) Copyright (c) 2017-2018 GitHub, Inc. diff --git a/extensions/markdown/js/dist/admin.js b/extensions/markdown/js/dist/admin.js index 7fcd5761d8..d921517d32 100644 --- a/extensions/markdown/js/dist/admin.js +++ b/extensions/markdown/js/dist/admin.js @@ -1,3 +1,3 @@ /*! For license information please see admin.js.LICENSE.txt */ -(()=>{var t={n:e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},d:(e,o)=>{for(var r in o)t.o(o,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{"use strict";t.r(e);const o=flarum.core.compat["admin/app"];var r=t.n(o);const i=flarum.core.compat["common/app"];var n=t.n(i);const a=flarum.core.compat["common/extend"],c=flarum.core.compat["common/components/TextEditor"];var l=t.n(c);const s=flarum.core.compat["common/utils/BasicEditorDriver"];var d=t.n(s);const f=flarum.core.compat["common/utils/styleSelectedText"];var u=t.n(f);const p=flarum.core.compat["common/Component"];var h=t.n(p);class k extends(h()){view(t){return m("div",{className:"MarkdownToolbar"},t.children)}}const x=flarum.core.compat["common/helpers/icon"];var b=t.n(x);const y=flarum.core.compat["common/components/Tooltip"];var v=t.n(y);class g extends(h()){oncreate(t){super.oncreate(t)}view(){const t=m("button",{className:"Button Button--icon Button--link",type:"button","data-hotkey":this.attrs.hotkey,onkeydown:this.keydown.bind(this),onclick:this.attrs.onclick},b()(this.attrs.icon));return this.attrs.title?m(v(),{text:this.attrs.title},t):t}keydown(t){" "!==t.key&&"Enter"!==t.key||(t.preventDefault(),this.element.click())}}const w=flarum.core.compat["common/utils/ItemList"];var _=t.n(w);const T=navigator.userAgent.match(/Macintosh/)?"⌘":"ctrl",S={header:{prefix:"### "},bold:{prefix:"**",suffix:"**",trimFirst:!0},italic:{prefix:"_",suffix:"_",trimFirst:!0},strikethrough:{prefix:"~~",suffix:"~~",trimFirst:!0},quote:{prefix:"> ",multiline:!0,surroundWithNewlines:!0},code:{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"},link:{prefix:"[",suffix:"](https://)",replaceNext:"https://",scanFor:"https?://"},image:{prefix:"![",suffix:"](https://)",replaceNext:"https://",scanFor:"https?://"},unordered_list:{prefix:"- ",multiline:!0,surroundWithNewlines:!0},ordered_list:{prefix:"1. ",multiline:!0,orderedList:!0},spoiler:{prefix:">!",suffix:"!<",blockPrefix:">! ",multiline:!0,trimFirst:!0}},I=(t,e)=>{u()(e.el,S[t])};function F(t,e,o){return function(r){r.key===e&&(r.metaKey&&"⌘"===T||r.ctrlKey&&"ctrl"===T)&&(r.preventDefault(),I(t,o))}}function N(t){const e="function"==typeof t?t():new(_());function o(t,e){return n().translator.trans("flarum-markdown.lib.composer.".concat(t,"_tooltip"))+(e?" <".concat(T,"-").concat(e,">"):"")}const r=t=>()=>I(t,this.attrs.composer.editor);return e.add("header",m(g,{title:o("header"),icon:"fas fa-heading",onclick:r("header")}),1e3),e.add("bold",m(g,{title:o("bold","b"),icon:"fas fa-bold",onclick:r("bold")}),900),e.add("italic",m(g,{title:o("italic","i"),icon:"fas fa-italic",onclick:r("italic")}),800),e.add("strikethrough",m(g,{title:o("strikethrough"),icon:"fas fa-strikethrough",onclick:r("strikethrough")}),700),e.add("quote",m(g,{title:o("quote"),icon:"fas fa-quote-left",onclick:r("quote")}),600),e.add("spoiler",m(g,{title:o("spoiler"),icon:"fas fa-exclamation-triangle",onclick:r("spoiler")}),500),e.add("code",m(g,{title:o("code"),icon:"fas fa-code",onclick:r("code")}),400),e.add("link",m(g,{title:o("link"),icon:"fas fa-link",onclick:r("link")}),300),e.add("image",m(g,{title:o("image"),icon:"fas fa-image",onclick:r("image")}),200),e.add("unordered_list",m(g,{title:o("unordered_list"),icon:"fas fa-list-ul",onclick:r("unordered_list")}),100),e.add("ordered_list",m(g,{title:o("ordered_list"),icon:"fas fa-list-ol",onclick:r("ordered_list")}),0),e}r().initializers.add("flarum-markdown",(function(t){(0,a.extend)(d().prototype,"keyHandlers",(function(t){t.add("bold",F("bold","b",this)),t.add("italic",F("italic","i",this))})),l().prototype.markdownToolbarItems?(0,a.override)(l().prototype,"markdownToolbarItems",N):l().prototype.markdownToolbarItems=N,(0,a.extend)(l().prototype,"toolbarItems",(function(t){t.add("markdown",m(k,{for:this.textareaId,setShortcutHandler:t=>shortcutHandler=t},this.markdownToolbarItems().toArray()),100)}))}))})(),module.exports=e})(); +(()=>{var t={n:e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},d:(e,o)=>{for(var r in o)t.o(o,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};(()=>{"use strict";const e=flarum.reg.get("core","admin/app");var o=t.n(e);const r=flarum.reg.get("core","common/app");var i=t.n(r);const n=flarum.reg.get("core","common/extend"),a=flarum.reg.get("core","common/utils/BasicEditorDriver");var l=t.n(a);const c=flarum.reg.get("core","common/utils/styleSelectedText");var s=t.n(c);const d=flarum.reg.get("core","common/Component");var f=t.n(d);class u extends(f()){view(t){return m("div",{className:"MarkdownToolbar"},t.children)}}flarum.reg.add("flarum-markdown","common/components/MarkdownToolbar",u);const p=flarum.reg.get("core","common/components/Icon");var k=t.n(p);const h=flarum.reg.get("core","common/components/Tooltip");var g=t.n(h);class x extends(f()){oncreate(t){super.oncreate(t)}view(){const t=m("button",{className:"Button Button--icon Button--link",type:"button","data-hotkey":this.attrs.hotkey,onkeydown:this.keydown.bind(this),onclick:this.attrs.onclick},m(k(),{name:this.attrs.icon}));return this.attrs.title?m(g(),{text:this.attrs.title},t):t}keydown(t){" "!==t.key&&"Enter"!==t.key||(t.preventDefault(),this.element.click())}}flarum.reg.add("flarum-markdown","common/components/MarkdownButton",x);const b=flarum.reg.get("core","common/utils/ItemList");var v=t.n(b);const w=navigator.userAgent.match(/Macintosh/)?"⌘":"ctrl",y={header:{prefix:"### "},bold:{prefix:"**",suffix:"**",trimFirst:!0},italic:{prefix:"_",suffix:"_",trimFirst:!0},strikethrough:{prefix:"~~",suffix:"~~",trimFirst:!0},quote:{prefix:"> ",multiline:!0,surroundWithNewlines:!0},code:{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"},link:{prefix:"[",suffix:"](https://)",replaceNext:"https://",scanFor:"https?://"},image:{prefix:"![",suffix:"](https://)",replaceNext:"https://",scanFor:"https?://"},unordered_list:{prefix:"- ",multiline:!0,surroundWithNewlines:!0},ordered_list:{prefix:"1. ",multiline:!0,orderedList:!0},spoiler:{prefix:">!",suffix:"!<",blockPrefix:">! ",multiline:!0,trimFirst:!0}},_=(t,e)=>{s()(e.el,y[t])};function T(t,e,o){return function(r){r.key===e&&(r.metaKey&&"⌘"===w||r.ctrlKey&&"ctrl"===w)&&(r.preventDefault(),_(t,o))}}function F(t){const e="function"==typeof t?t():new(v());function o(t,e){return i().translator.trans(`flarum-markdown.lib.composer.${t}_tooltip`)+(e?` <${w}-${e}>`:"")}const r=t=>()=>_(t,this.attrs.composer.editor);return e.add("header",m(x,{title:o("header"),icon:"fas fa-heading",onclick:r("header")}),1e3),e.add("bold",m(x,{title:o("bold","b"),icon:"fas fa-bold",onclick:r("bold")}),900),e.add("italic",m(x,{title:o("italic","i"),icon:"fas fa-italic",onclick:r("italic")}),800),e.add("strikethrough",m(x,{title:o("strikethrough"),icon:"fas fa-strikethrough",onclick:r("strikethrough")}),700),e.add("quote",m(x,{title:o("quote"),icon:"fas fa-quote-left",onclick:r("quote")}),600),e.add("spoiler",m(x,{title:o("spoiler"),icon:"fas fa-exclamation-triangle",onclick:r("spoiler")}),500),e.add("code",m(x,{title:o("code"),icon:"fas fa-code",onclick:r("code")}),400),e.add("link",m(x,{title:o("link"),icon:"fas fa-link",onclick:r("link")}),300),e.add("image",m(x,{title:o("image"),icon:"fas fa-image",onclick:r("image")}),200),e.add("unordered_list",m(x,{title:o("unordered_list"),icon:"fas fa-list-ul",onclick:r("unordered_list")}),100),e.add("ordered_list",m(x,{title:o("ordered_list"),icon:"fas fa-list-ol",onclick:r("ordered_list")}),0),e}o().initializers.add("flarum-markdown",(function(t){(0,n.extend)(l().prototype,"keyHandlers",(function(t){t.add("bold",T("bold","b",this)),t.add("italic",T("italic","i",this))})),(0,n.override)("flarum/common/components/TextEditor","markdownToolbarItems",F),(0,n.extend)("flarum/common/components/TextEditor","toolbarItems",(function(t){t.add("markdown",m(u,{for:this.textareaId,setShortcutHandler:t=>shortcutHandler=t},this.markdownToolbarItems().toArray()),100)}))}))})(),module.exports={}})(); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/extensions/markdown/js/dist/admin.js.map b/extensions/markdown/js/dist/admin.js.map index 402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,QAAS/C,KAAK,cAAcD,QAASoD,EAAe,UAAa,KAClHN,EAAMS,IAAI,OAAQrE,EAACG,EAAc,CAACa,MAAO8C,EAAQ,QAAS/C,KAAK,cAAcD,QAASoD,EAAe,UAAa,KAClHN,EAAMS,IAAI,QAASrE,EAACG,EAAc,CAACa,MAAO8C,EAAQ,SAAU/C,KAAK,eAAeD,QAASoD,EAAe,WAAc,KACtHN,EAAMS,IACJ,iBACArE,EAACG,EAAc,CAACa,MAAO8C,EAAQ,kBAAmB/C,KAAK,iBAAiBD,QAASoD,EAAe,oBAChG,KAEFN,EAAMS,IAAI,eAAgBrE,EAACG,EAAc,CAACa,MAAO8C,EAAQ,gBAAiB/C,KAAK,iBAAiBD,QAASoD,EAAe,kBAAqB,GAEtIN,CACT,CChFAI,IAAAA,aAAAA,IAAqB,mBDkFd,SAAoBA,IACzBM,EAAAA,EAAAA,QAAOC,IAAAA,UAA6B,eAAe,SAAUX,GAC3DA,EAAMS,IAAI,OAAQf,EAAa,OAAQ,IAAK9C,OAC5CoD,EAAMS,IAAI,SAAUf,EAAa,SAAU,IAAK9C,MAClD,IAEIgE,IAAAA,UAAAA,sBACFC,EAAAA,EAAAA,UAASD,IAAAA,UAAsB,uBAAwBd,GAEvDc,IAAAA,UAAAA,qBAA4Cd,GAG9CY,EAAAA,EAAAA,QAAOE,IAAAA,UAAsB,gBAAgB,SAAUZ,GACrDA,EAAMS,IACJ,WACArE,EAACJ,EAAe,CAAC8E,IAAKlE,KAAKmE,WAAYC,mBAAqBC,GAAaC,gBAAkBD,GACxFrE,KAAKkD,uBAAuBqB,WAE/B,IAEJ,GACF","sources":["webpack://@flarum/markdown/webpack/bootstrap","webpack://@flarum/markdown/webpack/runtime/compat get default export","webpack://@flarum/markdown/webpack/runtime/define property getters","webpack://@flarum/markdown/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/markdown/webpack/runtime/make namespace object","webpack://@flarum/markdown/external root \"flarum.core.compat['admin/app']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/app']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/components/TextEditor']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/utils/BasicEditorDriver']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/utils/styleSelectedText']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/Component']\"","webpack://@flarum/markdown/./src/common/components/MarkdownToolbar.js","webpack://@flarum/markdown/external root \"flarum.core.compat['common/helpers/icon']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/components/Tooltip']\"","webpack://@flarum/markdown/./src/common/components/MarkdownButton.js","webpack://@flarum/markdown/external root \"flarum.core.compat['common/utils/ItemList']\"","webpack://@flarum/markdown/./src/common/index.js","webpack://@flarum/markdown/./src/admin/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/TextEditor'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/BasicEditorDriver'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/styleSelectedText'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","import Component from 'flarum/common/Component';\n\nexport default class MarkdownToolbar extends Component {\n view(vnode) {\n return
    {vnode.children}
    ;\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/icon'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Tooltip'];","import Component from 'flarum/common/Component';\nimport icon from 'flarum/common/helpers/icon';\nimport Tooltip from 'flarum/common/components/Tooltip';\n\nexport default class MarkdownButton extends Component {\n oncreate(vnode) {\n super.oncreate(vnode);\n }\n\n view() {\n const button = (\n \n {icon(this.attrs.icon)}\n \n );\n\n if (this.attrs.title) {\n return {button};\n }\n\n return button;\n }\n\n keydown(event) {\n if (event.key === ' ' || event.key === 'Enter') {\n event.preventDefault();\n this.element.click();\n }\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/ItemList'];","/*!\n * Includes modified code from GitHub Markdown Toolbar Element\n * https://github.com/github/markdown-toolbar-element/\n *\n * Original Copyright GitHub, Inc.\n * Released under the MIT license\n * https://github.com/github/markdown-toolbar-element/blob/master/LICENSE\n */\n\nimport app from 'flarum/common/app';\nimport { extend, override } from 'flarum/common/extend';\nimport TextEditor from 'flarum/common/components/TextEditor';\nimport BasicEditorDriver from 'flarum/common/utils/BasicEditorDriver';\nimport styleSelectedText from 'flarum/common/utils/styleSelectedText';\n\nimport MarkdownToolbar from './components/MarkdownToolbar';\nimport MarkdownButton from './components/MarkdownButton';\nimport ItemList from 'flarum/common/utils/ItemList';\n\nconst modifierKey = navigator.userAgent.match(/Macintosh/) ? '⌘' : 'ctrl';\n\nconst styles = {\n header: { prefix: '### ' },\n bold: { prefix: '**', suffix: '**', trimFirst: true },\n italic: { prefix: '_', suffix: '_', trimFirst: true },\n strikethrough: { prefix: '~~', suffix: '~~', trimFirst: true },\n quote: { prefix: '> ', multiline: true, surroundWithNewlines: true },\n code: { prefix: '`', suffix: '`', blockPrefix: '```', blockSuffix: '```' },\n link: { prefix: '[', suffix: '](https://)', replaceNext: 'https://', scanFor: 'https?://' },\n image: { prefix: '![', suffix: '](https://)', replaceNext: 'https://', scanFor: 'https?://' },\n unordered_list: { prefix: '- ', multiline: true, surroundWithNewlines: true },\n ordered_list: { prefix: '1. ', multiline: true, orderedList: true },\n spoiler: { prefix: '>!', suffix: '!<', blockPrefix: '>! ', multiline: true, trimFirst: true },\n};\n\nconst applyStyle = (id, editorDriver) => {\n // This is a nasty hack that breaks encapsulation of the editor.\n // In future releases, we'll need to tweak the editor driver interface\n // to support triggering events like this.\n styleSelectedText(editorDriver.el, styles[id]);\n};\n\nfunction makeShortcut(id, key, editorDriver) {\n return function (e) {\n if (e.key === key && ((e.metaKey && modifierKey === '⌘') || (e.ctrlKey && modifierKey === 'ctrl'))) {\n e.preventDefault();\n applyStyle(id, editorDriver);\n }\n };\n}\n\nfunction markdownToolbarItems(oldFunc) {\n const items = typeof oldFunc === 'function' ? oldFunc() : new ItemList();\n\n function tooltip(name, hotkey) {\n return app.translator.trans(`flarum-markdown.lib.composer.${name}_tooltip`) + (hotkey ? ` <${modifierKey}-${hotkey}>` : '');\n }\n\n const makeApplyStyle = (id) => {\n return () => applyStyle(id, this.attrs.composer.editor);\n };\n\n items.add('header', , 1000);\n items.add('bold', , 900);\n items.add('italic', , 800);\n items.add(\n 'strikethrough',\n ,\n 700\n );\n items.add('quote', , 600);\n items.add('spoiler', , 500);\n items.add('code', , 400);\n items.add('link', , 300);\n items.add('image', , 200);\n items.add(\n 'unordered_list',\n ,\n 100\n );\n items.add('ordered_list', , 0);\n\n return items;\n}\n\nexport function initialize(app) {\n extend(BasicEditorDriver.prototype, 'keyHandlers', function (items) {\n items.add('bold', makeShortcut('bold', 'b', this));\n items.add('italic', makeShortcut('italic', 'i', this));\n });\n\n if (TextEditor.prototype.markdownToolbarItems) {\n override(TextEditor.prototype, 'markdownToolbarItems', markdownToolbarItems);\n } else {\n TextEditor.prototype.markdownToolbarItems = markdownToolbarItems;\n }\n\n extend(TextEditor.prototype, 'toolbarItems', function (items) {\n items.add(\n 'markdown',\n (shortcutHandler = handler)}>\n {this.markdownToolbarItems().toArray()}\n ,\n 100\n );\n });\n}\n","import app from 'flarum/admin/app';\nimport { initialize } from '../common/index';\n\napp.initializers.add('flarum-markdown', initialize);\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","MarkdownToolbar","Component","view","vnode","m","className","children","MarkdownButton","oncreate","super","button","type","this","attrs","hotkey","onkeydown","keydown","bind","onclick","icon","title","Tooltip","text","event","preventDefault","element","click","modifierKey","navigator","userAgent","match","styles","header","prefix","bold","suffix","trimFirst","italic","strikethrough","quote","multiline","surroundWithNewlines","code","blockPrefix","blockSuffix","link","replaceNext","scanFor","image","unordered_list","ordered_list","orderedList","spoiler","applyStyle","id","editorDriver","styleSelectedText","el","makeShortcut","e","metaKey","ctrlKey","markdownToolbarItems","oldFunc","items","ItemList","tooltip","name","app","concat","makeApplyStyle","composer","editor","add","extend","BasicEditorDriver","TextEditor","override","for","textareaId","setShortcutHandler","handler","shortcutHandler","toArray"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"admin.js","mappings":";MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAO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f5C,KAAM,iBACNF,QAASgD,EAAe,kBACtB,GACGH,CACT,CCzJA,iBAAiBzD,IAAI,mBD0Jd,SAAoB+D,IACzB,IAAAC,QAAO,cAA6B,eAAe,SAAUP,GAC3DA,EAAMzD,IAAI,OAAQmD,EAAa,OAAQ,IAAK7C,OAC5CmD,EAAMzD,IAAI,SAAUmD,EAAa,SAAU,IAAK7C,MAClD,KACA,IAAA2D,UAAS,sCAAuC,uBAAwBV,IACxE,IAAAS,QAAO,sCAAuC,gBAAgB,SAAUP,GACtEA,EAAMzD,IAAI,WAAYH,EAAEH,EAAiB,CACvCwE,IAAK5D,KAAK6D,WACVC,mBAAoBC,GAAWC,gBAAkBD,GAChD/D,KAAKiD,uBAAuBgB,WAAY,IAC7C,GACF","sources":["webpack://@flarum/markdown/webpack/bootstrap","webpack://@flarum/markdown/webpack/runtime/compat get default export","webpack://@flarum/markdown/webpack/runtime/define property getters","webpack://@flarum/markdown/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/markdown/external root \"flarum.reg.get('core', 'admin/app')\"","webpack://@flarum/markdown/external root \"flarum.reg.get('core', 'common/app')\"","webpack://@flarum/markdown/external root \"flarum.reg.get('core', 'common/extend')\"","webpack://@flarum/markdown/external root \"flarum.reg.get('core', 'common/utils/BasicEditorDriver')\"","webpack://@flarum/markdown/external root \"flarum.reg.get('core', 'common/utils/styleSelectedText')\"","webpack://@flarum/markdown/external root \"flarum.reg.get('core', 'common/Component')\"","webpack://@flarum/markdown/./src/common/components/MarkdownToolbar.js","webpack://@flarum/markdown/external root \"flarum.reg.get('core', 'common/components/Icon')\"","webpack://@flarum/markdown/external root \"flarum.reg.get('core', 'common/components/Tooltip')\"","webpack://@flarum/markdown/./src/common/components/MarkdownButton.js","webpack://@flarum/markdown/external root \"flarum.reg.get('core', 'common/utils/ItemList')\"","webpack://@flarum/markdown/./src/common/index.js","webpack://@flarum/markdown/./src/admin/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'admin/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extend');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/utils/BasicEditorDriver');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/utils/styleSelectedText');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/Component');","import Component from 'flarum/common/Component';\nexport default class MarkdownToolbar extends Component {\n view(vnode) {\n return m(\"div\", {\n className: \"MarkdownToolbar\"\n }, vnode.children);\n }\n}\nflarum.reg.add('flarum-markdown', 'common/components/MarkdownToolbar', MarkdownToolbar);","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Icon');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Tooltip');","import Component from 'flarum/common/Component';\nimport Icon from 'flarum/common/components/Icon';\nimport Tooltip from 'flarum/common/components/Tooltip';\nexport default class MarkdownButton extends Component {\n oncreate(vnode) {\n super.oncreate(vnode);\n }\n view() {\n const button = m(\"button\", {\n className: \"Button Button--icon Button--link\",\n type: \"button\",\n \"data-hotkey\": this.attrs.hotkey,\n onkeydown: this.keydown.bind(this),\n onclick: this.attrs.onclick\n }, m(Icon, {\n name: this.attrs.icon\n }));\n if (this.attrs.title) {\n return m(Tooltip, {\n text: this.attrs.title\n }, button);\n }\n return button;\n }\n keydown(event) {\n if (event.key === ' ' || event.key === 'Enter') {\n event.preventDefault();\n this.element.click();\n }\n }\n}\nflarum.reg.add('flarum-markdown', 'common/components/MarkdownButton', MarkdownButton);","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/utils/ItemList');","/*!\n * Includes modified code from GitHub Markdown Toolbar Element\n * https://github.com/github/markdown-toolbar-element/\n *\n * Original Copyright GitHub, Inc.\n * Released under the MIT license\n * https://github.com/github/markdown-toolbar-element/blob/master/LICENSE\n */\n\nimport app from 'flarum/common/app';\nimport { extend, override } from 'flarum/common/extend';\nimport BasicEditorDriver from 'flarum/common/utils/BasicEditorDriver';\nimport styleSelectedText from 'flarum/common/utils/styleSelectedText';\nimport MarkdownToolbar from './components/MarkdownToolbar';\nimport MarkdownButton from './components/MarkdownButton';\nimport ItemList from 'flarum/common/utils/ItemList';\nconst modifierKey = navigator.userAgent.match(/Macintosh/) ? '⌘' : 'ctrl';\nconst styles = {\n header: {\n prefix: '### '\n },\n bold: {\n prefix: '**',\n suffix: '**',\n trimFirst: true\n },\n italic: {\n prefix: '_',\n suffix: '_',\n trimFirst: true\n },\n strikethrough: {\n prefix: '~~',\n suffix: '~~',\n trimFirst: true\n },\n quote: {\n prefix: '> ',\n multiline: true,\n surroundWithNewlines: true\n },\n code: {\n prefix: '`',\n suffix: '`',\n blockPrefix: '```',\n blockSuffix: '```'\n },\n link: {\n prefix: '[',\n suffix: '](https://)',\n replaceNext: 'https://',\n scanFor: 'https?://'\n },\n image: {\n prefix: '![',\n suffix: '](https://)',\n replaceNext: 'https://',\n scanFor: 'https?://'\n },\n unordered_list: {\n prefix: '- ',\n multiline: true,\n surroundWithNewlines: true\n },\n ordered_list: {\n prefix: '1. ',\n multiline: true,\n orderedList: true\n },\n spoiler: {\n prefix: '>!',\n suffix: '!<',\n blockPrefix: '>! ',\n multiline: true,\n trimFirst: true\n }\n};\nconst applyStyle = (id, editorDriver) => {\n // This is a nasty hack that breaks encapsulation of the editor.\n // In future releases, we'll need to tweak the editor driver interface\n // to support triggering events like this.\n styleSelectedText(editorDriver.el, styles[id]);\n};\nfunction makeShortcut(id, key, editorDriver) {\n return function (e) {\n if (e.key === key && (e.metaKey && modifierKey === '⌘' || e.ctrlKey && modifierKey === 'ctrl')) {\n e.preventDefault();\n applyStyle(id, editorDriver);\n }\n };\n}\nfunction markdownToolbarItems(oldFunc) {\n const items = typeof oldFunc === 'function' ? oldFunc() : new ItemList();\n function tooltip(name, hotkey) {\n return app.translator.trans(`flarum-markdown.lib.composer.${name}_tooltip`) + (hotkey ? ` <${modifierKey}-${hotkey}>` : '');\n }\n const makeApplyStyle = id => {\n return () => applyStyle(id, this.attrs.composer.editor);\n };\n items.add('header', m(MarkdownButton, {\n title: tooltip('header'),\n icon: \"fas fa-heading\",\n onclick: makeApplyStyle('header')\n }), 1000);\n items.add('bold', m(MarkdownButton, {\n title: tooltip('bold', 'b'),\n icon: \"fas fa-bold\",\n onclick: makeApplyStyle('bold')\n }), 900);\n items.add('italic', m(MarkdownButton, {\n title: tooltip('italic', 'i'),\n icon: \"fas fa-italic\",\n onclick: makeApplyStyle('italic')\n }), 800);\n items.add('strikethrough', m(MarkdownButton, {\n title: tooltip('strikethrough'),\n icon: \"fas fa-strikethrough\",\n onclick: makeApplyStyle('strikethrough')\n }), 700);\n items.add('quote', m(MarkdownButton, {\n title: tooltip('quote'),\n icon: \"fas fa-quote-left\",\n onclick: makeApplyStyle('quote')\n }), 600);\n items.add('spoiler', m(MarkdownButton, {\n title: tooltip('spoiler'),\n icon: \"fas fa-exclamation-triangle\",\n onclick: makeApplyStyle('spoiler')\n }), 500);\n items.add('code', m(MarkdownButton, {\n title: tooltip('code'),\n icon: \"fas fa-code\",\n onclick: makeApplyStyle('code')\n }), 400);\n items.add('link', m(MarkdownButton, {\n title: tooltip('link'),\n icon: \"fas fa-link\",\n onclick: makeApplyStyle('link')\n }), 300);\n items.add('image', m(MarkdownButton, {\n title: tooltip('image'),\n icon: \"fas fa-image\",\n onclick: makeApplyStyle('image')\n }), 200);\n items.add('unordered_list', m(MarkdownButton, {\n title: tooltip('unordered_list'),\n icon: \"fas fa-list-ul\",\n onclick: makeApplyStyle('unordered_list')\n }), 100);\n items.add('ordered_list', m(MarkdownButton, {\n title: tooltip('ordered_list'),\n icon: \"fas fa-list-ol\",\n onclick: makeApplyStyle('ordered_list')\n }), 0);\n return items;\n}\nexport function initialize(app) {\n extend(BasicEditorDriver.prototype, 'keyHandlers', function (items) {\n items.add('bold', makeShortcut('bold', 'b', this));\n items.add('italic', makeShortcut('italic', 'i', this));\n });\n override('flarum/common/components/TextEditor', 'markdownToolbarItems', markdownToolbarItems);\n extend('flarum/common/components/TextEditor', 'toolbarItems', function (items) {\n items.add('markdown', m(MarkdownToolbar, {\n for: this.textareaId,\n setShortcutHandler: handler => shortcutHandler = handler\n }, this.markdownToolbarItems().toArray()), 100);\n });\n}","import app from 'flarum/admin/app';\nimport { initialize } from '../common/index';\napp.initializers.add('flarum-markdown', initialize);"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","flarum","reg","MarkdownToolbar","view","vnode","m","className","children","add","MarkdownButton","oncreate","super","button","type","this","attrs","hotkey","onkeydown","keydown","bind","onclick","name","icon","title","text","event","preventDefault","element","click","modifierKey","navigator","userAgent","match","styles","header","prefix","bold","suffix","trimFirst","italic","strikethrough","quote","multiline","surroundWithNewlines","code","blockPrefix","blockSuffix","link","replaceNext","scanFor","image","unordered_list","ordered_list","orderedList","spoiler","applyStyle","id","editorDriver","el","makeShortcut","e","metaKey","ctrlKey","markdownToolbarItems","oldFunc","items","tooltip","trans","makeApplyStyle","composer","editor","app","extend","override","for","textareaId","setShortcutHandler","handler","shortcutHandler","toArray"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/markdown/js/dist/forum.js b/extensions/markdown/js/dist/forum.js index d8b1e04469..51d9333cc9 100644 --- a/extensions/markdown/js/dist/forum.js +++ b/extensions/markdown/js/dist/forum.js @@ -1,3 +1,3 @@ /*! For license information please see forum.js.LICENSE.txt */ -(()=>{var t={n:e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},d:(e,o)=>{for(var r in o)t.o(o,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{"use strict";t.r(e);const o=flarum.core.compat["forum/app"];var r=t.n(o);const i=flarum.core.compat["common/app"];var n=t.n(i);const a=flarum.core.compat["common/extend"],c=flarum.core.compat["common/components/TextEditor"];var l=t.n(c);const s=flarum.core.compat["common/utils/BasicEditorDriver"];var d=t.n(s);const f=flarum.core.compat["common/utils/styleSelectedText"];var u=t.n(f);const p=flarum.core.compat["common/Component"];var h=t.n(p);class k extends(h()){view(t){return m("div",{className:"MarkdownToolbar"},t.children)}}const x=flarum.core.compat["common/helpers/icon"];var b=t.n(x);const y=flarum.core.compat["common/components/Tooltip"];var v=t.n(y);class g extends(h()){oncreate(t){super.oncreate(t)}view(){const t=m("button",{className:"Button Button--icon Button--link",type:"button","data-hotkey":this.attrs.hotkey,onkeydown:this.keydown.bind(this),onclick:this.attrs.onclick},b()(this.attrs.icon));return this.attrs.title?m(v(),{text:this.attrs.title},t):t}keydown(t){" "!==t.key&&"Enter"!==t.key||(t.preventDefault(),this.element.click())}}const w=flarum.core.compat["common/utils/ItemList"];var _=t.n(w);const T=navigator.userAgent.match(/Macintosh/)?"⌘":"ctrl",S={header:{prefix:"### "},bold:{prefix:"**",suffix:"**",trimFirst:!0},italic:{prefix:"_",suffix:"_",trimFirst:!0},strikethrough:{prefix:"~~",suffix:"~~",trimFirst:!0},quote:{prefix:"> ",multiline:!0,surroundWithNewlines:!0},code:{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"},link:{prefix:"[",suffix:"](https://)",replaceNext:"https://",scanFor:"https?://"},image:{prefix:"![",suffix:"](https://)",replaceNext:"https://",scanFor:"https?://"},unordered_list:{prefix:"- ",multiline:!0,surroundWithNewlines:!0},ordered_list:{prefix:"1. ",multiline:!0,orderedList:!0},spoiler:{prefix:">!",suffix:"!<",blockPrefix:">! ",multiline:!0,trimFirst:!0}},I=(t,e)=>{u()(e.el,S[t])};function F(t,e,o){return function(r){r.key===e&&(r.metaKey&&"⌘"===T||r.ctrlKey&&"ctrl"===T)&&(r.preventDefault(),I(t,o))}}function N(t){const e="function"==typeof t?t():new(_());function o(t,e){return n().translator.trans("flarum-markdown.lib.composer.".concat(t,"_tooltip"))+(e?" <".concat(T,"-").concat(e,">"):"")}const r=t=>()=>I(t,this.attrs.composer.editor);return e.add("header",m(g,{title:o("header"),icon:"fas fa-heading",onclick:r("header")}),1e3),e.add("bold",m(g,{title:o("bold","b"),icon:"fas fa-bold",onclick:r("bold")}),900),e.add("italic",m(g,{title:o("italic","i"),icon:"fas fa-italic",onclick:r("italic")}),800),e.add("strikethrough",m(g,{title:o("strikethrough"),icon:"fas fa-strikethrough",onclick:r("strikethrough")}),700),e.add("quote",m(g,{title:o("quote"),icon:"fas fa-quote-left",onclick:r("quote")}),600),e.add("spoiler",m(g,{title:o("spoiler"),icon:"fas fa-exclamation-triangle",onclick:r("spoiler")}),500),e.add("code",m(g,{title:o("code"),icon:"fas fa-code",onclick:r("code")}),400),e.add("link",m(g,{title:o("link"),icon:"fas fa-link",onclick:r("link")}),300),e.add("image",m(g,{title:o("image"),icon:"fas fa-image",onclick:r("image")}),200),e.add("unordered_list",m(g,{title:o("unordered_list"),icon:"fas fa-list-ul",onclick:r("unordered_list")}),100),e.add("ordered_list",m(g,{title:o("ordered_list"),icon:"fas fa-list-ol",onclick:r("ordered_list")}),0),e}r().initializers.add("flarum-markdown",(function(t){(0,a.extend)(d().prototype,"keyHandlers",(function(t){t.add("bold",F("bold","b",this)),t.add("italic",F("italic","i",this))})),l().prototype.markdownToolbarItems?(0,a.override)(l().prototype,"markdownToolbarItems",N):l().prototype.markdownToolbarItems=N,(0,a.extend)(l().prototype,"toolbarItems",(function(t){t.add("markdown",m(k,{for:this.textareaId,setShortcutHandler:t=>shortcutHandler=t},this.markdownToolbarItems().toArray()),100)}))}))})(),module.exports=e})(); +(()=>{var t={n:e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},d:(e,o)=>{for(var r in o)t.o(o,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};(()=>{"use strict";const e=flarum.reg.get("core","forum/app");var o=t.n(e);const r=flarum.reg.get("core","common/app");var i=t.n(r);const n=flarum.reg.get("core","common/extend"),a=flarum.reg.get("core","common/utils/BasicEditorDriver");var l=t.n(a);const c=flarum.reg.get("core","common/utils/styleSelectedText");var s=t.n(c);const d=flarum.reg.get("core","common/Component");var f=t.n(d);class u extends(f()){view(t){return m("div",{className:"MarkdownToolbar"},t.children)}}flarum.reg.add("flarum-markdown","common/components/MarkdownToolbar",u);const p=flarum.reg.get("core","common/components/Icon");var k=t.n(p);const h=flarum.reg.get("core","common/components/Tooltip");var g=t.n(h);class x extends(f()){oncreate(t){super.oncreate(t)}view(){const t=m("button",{className:"Button Button--icon Button--link",type:"button","data-hotkey":this.attrs.hotkey,onkeydown:this.keydown.bind(this),onclick:this.attrs.onclick},m(k(),{name:this.attrs.icon}));return this.attrs.title?m(g(),{text:this.attrs.title},t):t}keydown(t){" "!==t.key&&"Enter"!==t.key||(t.preventDefault(),this.element.click())}}flarum.reg.add("flarum-markdown","common/components/MarkdownButton",x);const b=flarum.reg.get("core","common/utils/ItemList");var v=t.n(b);const w=navigator.userAgent.match(/Macintosh/)?"⌘":"ctrl",y={header:{prefix:"### "},bold:{prefix:"**",suffix:"**",trimFirst:!0},italic:{prefix:"_",suffix:"_",trimFirst:!0},strikethrough:{prefix:"~~",suffix:"~~",trimFirst:!0},quote:{prefix:"> ",multiline:!0,surroundWithNewlines:!0},code:{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"},link:{prefix:"[",suffix:"](https://)",replaceNext:"https://",scanFor:"https?://"},image:{prefix:"![",suffix:"](https://)",replaceNext:"https://",scanFor:"https?://"},unordered_list:{prefix:"- ",multiline:!0,surroundWithNewlines:!0},ordered_list:{prefix:"1. ",multiline:!0,orderedList:!0},spoiler:{prefix:">!",suffix:"!<",blockPrefix:">! ",multiline:!0,trimFirst:!0}},_=(t,e)=>{s()(e.el,y[t])};function T(t,e,o){return function(r){r.key===e&&(r.metaKey&&"⌘"===w||r.ctrlKey&&"ctrl"===w)&&(r.preventDefault(),_(t,o))}}function F(t){const e="function"==typeof t?t():new(v());function o(t,e){return i().translator.trans(`flarum-markdown.lib.composer.${t}_tooltip`)+(e?` <${w}-${e}>`:"")}const r=t=>()=>_(t,this.attrs.composer.editor);return e.add("header",m(x,{title:o("header"),icon:"fas fa-heading",onclick:r("header")}),1e3),e.add("bold",m(x,{title:o("bold","b"),icon:"fas fa-bold",onclick:r("bold")}),900),e.add("italic",m(x,{title:o("italic","i"),icon:"fas fa-italic",onclick:r("italic")}),800),e.add("strikethrough",m(x,{title:o("strikethrough"),icon:"fas fa-strikethrough",onclick:r("strikethrough")}),700),e.add("quote",m(x,{title:o("quote"),icon:"fas fa-quote-left",onclick:r("quote")}),600),e.add("spoiler",m(x,{title:o("spoiler"),icon:"fas fa-exclamation-triangle",onclick:r("spoiler")}),500),e.add("code",m(x,{title:o("code"),icon:"fas fa-code",onclick:r("code")}),400),e.add("link",m(x,{title:o("link"),icon:"fas fa-link",onclick:r("link")}),300),e.add("image",m(x,{title:o("image"),icon:"fas fa-image",onclick:r("image")}),200),e.add("unordered_list",m(x,{title:o("unordered_list"),icon:"fas fa-list-ul",onclick:r("unordered_list")}),100),e.add("ordered_list",m(x,{title:o("ordered_list"),icon:"fas fa-list-ol",onclick:r("ordered_list")}),0),e}o().initializers.add("flarum-markdown",(function(t){(0,n.extend)(l().prototype,"keyHandlers",(function(t){t.add("bold",T("bold","b",this)),t.add("italic",T("italic","i",this))})),(0,n.override)("flarum/common/components/TextEditor","markdownToolbarItems",F),(0,n.extend)("flarum/common/components/TextEditor","toolbarItems",(function(t){t.add("markdown",m(u,{for:this.textareaId,setShortcutHandler:t=>shortcutHandler=t},this.markdownToolbarItems().toArray()),100)}))}))})(),module.exports={}})(); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/extensions/markdown/js/dist/forum.js.map b/extensions/markdown/js/dist/forum.js.map index 7c48b6dc83..ec3aff3f61 100644 --- a/extensions/markdown/js/dist/forum.js.map +++ b/extensions/markdown/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"file":"forum.js","mappings":";MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,kCCL9D,MAAM,E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sBACFC,EAAAA,EAAAA,UAASD,IAAAA,UAAsB,uBAAwBd,GAEvDc,IAAAA,UAAAA,qBAA4Cd,GAG9CY,EAAAA,EAAAA,QAAOE,IAAAA,UAAsB,gBAAgB,SAAUZ,GACrDA,EAAMS,IACJ,WACArE,EAACJ,EAAe,CAAC8E,IAAKlE,KAAKmE,WAAYC,mBAAqBC,GAAaC,gBAAkBD,GACxFrE,KAAKkD,uBAAuBqB,WAE/B,IAEJ,GACF","sources":["webpack://@flarum/markdown/webpack/bootstrap","webpack://@flarum/markdown/webpack/runtime/compat get default export","webpack://@flarum/markdown/webpack/runtime/define property getters","webpack://@flarum/markdown/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/markdown/webpack/runtime/make namespace object","webpack://@flarum/markdown/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/app']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/components/TextEditor']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/utils/BasicEditorDriver']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/utils/styleSelectedText']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/Component']\"","webpack://@flarum/markdown/./src/common/components/MarkdownToolbar.js","webpack://@flarum/markdown/external root \"flarum.core.compat['common/helpers/icon']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/components/Tooltip']\"","webpack://@flarum/markdown/./src/common/components/MarkdownButton.js","webpack://@flarum/markdown/external root \"flarum.core.compat['common/utils/ItemList']\"","webpack://@flarum/markdown/./src/common/index.js","webpack://@flarum/markdown/./src/forum/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/TextEditor'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/BasicEditorDriver'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/styleSelectedText'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","import Component from 'flarum/common/Component';\n\nexport default class MarkdownToolbar extends Component {\n view(vnode) {\n return
    {vnode.children}
    ;\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/icon'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Tooltip'];","import Component from 'flarum/common/Component';\nimport icon from 'flarum/common/helpers/icon';\nimport Tooltip from 'flarum/common/components/Tooltip';\n\nexport default class MarkdownButton extends Component {\n oncreate(vnode) {\n super.oncreate(vnode);\n }\n\n view() {\n const button = (\n \n {icon(this.attrs.icon)}\n \n );\n\n if (this.attrs.title) {\n return {button};\n }\n\n return button;\n }\n\n keydown(event) {\n if (event.key === ' ' || event.key === 'Enter') {\n event.preventDefault();\n this.element.click();\n }\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/ItemList'];","/*!\n * Includes modified code from GitHub Markdown Toolbar Element\n * https://github.com/github/markdown-toolbar-element/\n *\n * Original Copyright GitHub, Inc.\n * Released under the MIT license\n * https://github.com/github/markdown-toolbar-element/blob/master/LICENSE\n */\n\nimport app from 'flarum/common/app';\nimport { extend, override } from 'flarum/common/extend';\nimport TextEditor from 'flarum/common/components/TextEditor';\nimport BasicEditorDriver from 'flarum/common/utils/BasicEditorDriver';\nimport styleSelectedText from 'flarum/common/utils/styleSelectedText';\n\nimport MarkdownToolbar from './components/MarkdownToolbar';\nimport MarkdownButton from './components/MarkdownButton';\nimport ItemList from 'flarum/common/utils/ItemList';\n\nconst modifierKey = navigator.userAgent.match(/Macintosh/) ? '⌘' : 'ctrl';\n\nconst styles = {\n header: { prefix: '### ' },\n bold: { prefix: '**', suffix: '**', trimFirst: true },\n italic: { prefix: '_', suffix: '_', trimFirst: true },\n strikethrough: { prefix: '~~', suffix: '~~', trimFirst: true },\n quote: { prefix: '> ', multiline: true, surroundWithNewlines: true },\n code: { prefix: '`', suffix: '`', blockPrefix: '```', blockSuffix: '```' },\n link: { prefix: '[', suffix: '](https://)', replaceNext: 'https://', scanFor: 'https?://' },\n image: { prefix: '![', suffix: '](https://)', replaceNext: 'https://', scanFor: 'https?://' },\n unordered_list: { prefix: '- ', multiline: true, surroundWithNewlines: true },\n ordered_list: { prefix: '1. ', multiline: true, orderedList: true },\n spoiler: { prefix: '>!', suffix: '!<', blockPrefix: '>! ', multiline: true, trimFirst: true },\n};\n\nconst applyStyle = (id, editorDriver) => {\n // This is a nasty hack that breaks encapsulation of the editor.\n // In future releases, we'll need to tweak the editor driver interface\n // to support triggering events like this.\n styleSelectedText(editorDriver.el, styles[id]);\n};\n\nfunction makeShortcut(id, key, editorDriver) {\n return function (e) {\n if (e.key === key && ((e.metaKey && modifierKey === '⌘') || (e.ctrlKey && modifierKey === 'ctrl'))) {\n e.preventDefault();\n applyStyle(id, editorDriver);\n }\n };\n}\n\nfunction markdownToolbarItems(oldFunc) {\n const items = typeof oldFunc === 'function' ? oldFunc() : new ItemList();\n\n function tooltip(name, hotkey) {\n return app.translator.trans(`flarum-markdown.lib.composer.${name}_tooltip`) + (hotkey ? ` <${modifierKey}-${hotkey}>` : '');\n }\n\n const makeApplyStyle = (id) => {\n return () => applyStyle(id, this.attrs.composer.editor);\n };\n\n items.add('header', , 1000);\n items.add('bold', , 900);\n items.add('italic', , 800);\n items.add(\n 'strikethrough',\n ,\n 700\n );\n items.add('quote', , 600);\n items.add('spoiler', , 500);\n items.add('code', , 400);\n items.add('link', , 300);\n items.add('image', , 200);\n items.add(\n 'unordered_list',\n ,\n 100\n );\n items.add('ordered_list', , 0);\n\n return items;\n}\n\nexport function initialize(app) {\n extend(BasicEditorDriver.prototype, 'keyHandlers', function (items) {\n items.add('bold', makeShortcut('bold', 'b', this));\n items.add('italic', makeShortcut('italic', 'i', this));\n });\n\n if (TextEditor.prototype.markdownToolbarItems) {\n override(TextEditor.prototype, 'markdownToolbarItems', markdownToolbarItems);\n } else {\n TextEditor.prototype.markdownToolbarItems = markdownToolbarItems;\n }\n\n extend(TextEditor.prototype, 'toolbarItems', function (items) {\n items.add(\n 'markdown',\n (shortcutHandler = handler)}>\n {this.markdownToolbarItems().toArray()}\n ,\n 100\n );\n });\n}\n","import app from 'flarum/forum/app';\nimport { initialize } from '../common/index';\n\napp.initializers.add('flarum-markdown', initialize);\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","MarkdownToolbar","Component","view","vnode","m","className","children","MarkdownButton","oncreate","super","button","type","this","attrs","hotkey","onkeydown","keydown","bind","onclick","icon","title","Tooltip","text","event","preventDefault","element","click","modifierKey","navigator","userAgent","match","styles","header","prefix","bold","suffix","trimFirst","italic","strikethrough","quote","multiline","surroundWithNewlines","code","blockPrefix","blockSuffix","link","replaceNext","scanFor","image","unordered_list","ordered_list","orderedList","spoiler","applyStyle","id","editorDriver","styleSelectedText","el","makeShortcut","e","metaKey","ctrlKey","markdownToolbarItems","oldFunc","items","ItemList","tooltip","name","app","concat","makeApplyStyle","composer","editor","add","extend","BasicEditorDriver","TextEditor","override","for","textareaId","setShortcutHandler","handler","shortcutHandler","toArray"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":";MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,uBCAlF,MAAM,EAA+BI,OAAOC,IAAIP,IAAI,OAAQ,0BCA5D,MAAM,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,2BCA5D,MAAM,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,iBCAtD,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,+CCA5D,MAAM,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,+CCA5D,MAAM,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,iCCC7C,MAAMQ,UAAwB,KAC3C,IAAAC,CAAKC,GACH,OAAOC,EAAE,MAAO,CACdC,UAAW,mBACVF,EAAMG,SACX,EAEFP,OAAOC,IAAIO,IAAI,kBAAmB,oCAAqCN,GCRvE,MAAM,EAA+BF,OAAOC,IAAIP,IAAI,OAAQ,uCCA5D,MAA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BACNF,QAASgD,EAAe,aACtB,KACJH,EAAMzD,IAAI,OAAQH,EAAEI,EAAgB,CAClCc,MAAO2C,EAAQ,QACf5C,KAAM,cACNF,QAASgD,EAAe,UACtB,KACJH,EAAMzD,IAAI,OAAQH,EAAEI,EAAgB,CAClCc,MAAO2C,EAAQ,QACf5C,KAAM,cACNF,QAASgD,EAAe,UACtB,KACJH,EAAMzD,IAAI,QAASH,EAAEI,EAAgB,CACnCc,MAAO2C,EAAQ,SACf5C,KAAM,eACNF,QAASgD,EAAe,WACtB,KACJH,EAAMzD,IAAI,iBAAkBH,EAAEI,EAAgB,CAC5Cc,MAAO2C,EAAQ,kBACf5C,KAAM,iBACNF,QAASgD,EAAe,oBACtB,KACJH,EAAMzD,IAAI,eAAgBH,EAAEI,EAAgB,CAC1Cc,MAAO2C,EAAQ,gBACf5C,KAAM,iBACNF,QAASgD,EAAe,kBACtB,GACGH,CACT,CCzJA,iBAAiBzD,IAAI,mBD0Jd,SAAoB+D,IACzB,IAAAC,QAAO,cAA6B,eAAe,SAAUP,GAC3DA,EAAMzD,IAAI,OAAQmD,EAAa,OAAQ,IAAK7C,OAC5CmD,EAAMzD,IAAI,SAAUmD,EAAa,SAAU,IAAK7C,MAClD,KACA,IAAA2D,UAAS,sCAAuC,uBAAwBV,IACxE,IAAAS,QAAO,sCAAuC,gBAAgB,SAAUP,GACtEA,EAAMzD,IAAI,WAAYH,EAAEH,EAAiB,CACvCwE,IAAK5D,KAAK6D,WACVC,mBAAoBC,GAAWC,gBAAkBD,GAChD/D,KAAKiD,uBAAuBgB,WAAY,IAC7C,GACF","sources":["webpack://@flarum/markdown/webpack/bootstrap","webpack://@flarum/markdown/webpack/runtime/compat get default export","webpack://@flarum/markdown/webpack/runtime/define property getters","webpack://@flarum/markdown/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/markdown/external root \"flarum.reg.get('core', 'forum/app')\"","webpack://@flarum/markdown/external root \"flarum.reg.get('core', 'common/app')\"","webpack://@flarum/markdown/external root \"flarum.reg.get('core', 'common/extend')\"","webpack://@flarum/markdown/external root \"flarum.reg.get('core', 'common/utils/BasicEditorDriver')\"","webpack://@flarum/markdown/external root \"flarum.reg.get('core', 'common/utils/styleSelectedText')\"","webpack://@flarum/markdown/external root \"flarum.reg.get('core', 'common/Component')\"","webpack://@flarum/markdown/./src/common/components/MarkdownToolbar.js","webpack://@flarum/markdown/external root \"flarum.reg.get('core', 'common/components/Icon')\"","webpack://@flarum/markdown/external root \"flarum.reg.get('core', 'common/components/Tooltip')\"","webpack://@flarum/markdown/./src/common/components/MarkdownButton.js","webpack://@flarum/markdown/external root \"flarum.reg.get('core', 'common/utils/ItemList')\"","webpack://@flarum/markdown/./src/common/index.js","webpack://@flarum/markdown/./src/forum/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extend');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/utils/BasicEditorDriver');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/utils/styleSelectedText');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/Component');","import Component from 'flarum/common/Component';\nexport default class MarkdownToolbar extends Component {\n view(vnode) {\n return m(\"div\", {\n className: \"MarkdownToolbar\"\n }, vnode.children);\n }\n}\nflarum.reg.add('flarum-markdown', 'common/components/MarkdownToolbar', MarkdownToolbar);","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Icon');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/components/Tooltip');","import Component from 'flarum/common/Component';\nimport Icon from 'flarum/common/components/Icon';\nimport Tooltip from 'flarum/common/components/Tooltip';\nexport default class MarkdownButton extends Component {\n oncreate(vnode) {\n super.oncreate(vnode);\n }\n view() {\n const button = m(\"button\", {\n className: \"Button Button--icon Button--link\",\n type: \"button\",\n \"data-hotkey\": this.attrs.hotkey,\n onkeydown: this.keydown.bind(this),\n onclick: this.attrs.onclick\n }, m(Icon, {\n name: this.attrs.icon\n }));\n if (this.attrs.title) {\n return m(Tooltip, {\n text: this.attrs.title\n }, button);\n }\n return button;\n }\n keydown(event) {\n if (event.key === ' ' || event.key === 'Enter') {\n event.preventDefault();\n this.element.click();\n }\n }\n}\nflarum.reg.add('flarum-markdown', 'common/components/MarkdownButton', MarkdownButton);","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/utils/ItemList');","/*!\n * Includes modified code from GitHub Markdown Toolbar Element\n * https://github.com/github/markdown-toolbar-element/\n *\n * Original Copyright GitHub, Inc.\n * Released under the MIT license\n * https://github.com/github/markdown-toolbar-element/blob/master/LICENSE\n */\n\nimport app from 'flarum/common/app';\nimport { extend, override } from 'flarum/common/extend';\nimport BasicEditorDriver from 'flarum/common/utils/BasicEditorDriver';\nimport styleSelectedText from 'flarum/common/utils/styleSelectedText';\nimport MarkdownToolbar from './components/MarkdownToolbar';\nimport MarkdownButton from './components/MarkdownButton';\nimport ItemList from 'flarum/common/utils/ItemList';\nconst modifierKey = navigator.userAgent.match(/Macintosh/) ? '⌘' : 'ctrl';\nconst styles = {\n header: {\n prefix: '### '\n },\n bold: {\n prefix: '**',\n suffix: '**',\n trimFirst: true\n },\n italic: {\n prefix: '_',\n suffix: '_',\n trimFirst: true\n },\n strikethrough: {\n prefix: '~~',\n suffix: '~~',\n trimFirst: true\n },\n quote: {\n prefix: '> ',\n multiline: true,\n surroundWithNewlines: true\n },\n code: {\n prefix: '`',\n suffix: '`',\n blockPrefix: '```',\n blockSuffix: '```'\n },\n link: {\n prefix: '[',\n suffix: '](https://)',\n replaceNext: 'https://',\n scanFor: 'https?://'\n },\n image: {\n prefix: '![',\n suffix: '](https://)',\n replaceNext: 'https://',\n scanFor: 'https?://'\n },\n unordered_list: {\n prefix: '- ',\n multiline: true,\n surroundWithNewlines: true\n },\n ordered_list: {\n prefix: '1. ',\n multiline: true,\n orderedList: true\n },\n spoiler: {\n prefix: '>!',\n suffix: '!<',\n blockPrefix: '>! ',\n multiline: true,\n trimFirst: true\n }\n};\nconst applyStyle = (id, editorDriver) => {\n // This is a nasty hack that breaks encapsulation of the editor.\n // In future releases, we'll need to tweak the editor driver interface\n // to support triggering events like this.\n styleSelectedText(editorDriver.el, styles[id]);\n};\nfunction makeShortcut(id, key, editorDriver) {\n return function (e) {\n if (e.key === key && (e.metaKey && modifierKey === '⌘' || e.ctrlKey && modifierKey === 'ctrl')) {\n e.preventDefault();\n applyStyle(id, editorDriver);\n }\n };\n}\nfunction markdownToolbarItems(oldFunc) {\n const items = typeof oldFunc === 'function' ? oldFunc() : new ItemList();\n function tooltip(name, hotkey) {\n return app.translator.trans(`flarum-markdown.lib.composer.${name}_tooltip`) + (hotkey ? ` <${modifierKey}-${hotkey}>` : '');\n }\n const makeApplyStyle = id => {\n return () => applyStyle(id, this.attrs.composer.editor);\n };\n items.add('header', m(MarkdownButton, {\n title: tooltip('header'),\n icon: \"fas fa-heading\",\n onclick: makeApplyStyle('header')\n }), 1000);\n items.add('bold', m(MarkdownButton, {\n title: tooltip('bold', 'b'),\n icon: \"fas fa-bold\",\n onclick: makeApplyStyle('bold')\n }), 900);\n items.add('italic', m(MarkdownButton, {\n title: tooltip('italic', 'i'),\n icon: \"fas fa-italic\",\n onclick: makeApplyStyle('italic')\n }), 800);\n items.add('strikethrough', m(MarkdownButton, {\n title: tooltip('strikethrough'),\n icon: \"fas fa-strikethrough\",\n onclick: makeApplyStyle('strikethrough')\n }), 700);\n items.add('quote', m(MarkdownButton, {\n title: tooltip('quote'),\n icon: \"fas fa-quote-left\",\n onclick: makeApplyStyle('quote')\n }), 600);\n items.add('spoiler', m(MarkdownButton, {\n title: tooltip('spoiler'),\n icon: \"fas fa-exclamation-triangle\",\n onclick: makeApplyStyle('spoiler')\n }), 500);\n items.add('code', m(MarkdownButton, {\n title: tooltip('code'),\n icon: \"fas fa-code\",\n onclick: makeApplyStyle('code')\n }), 400);\n items.add('link', m(MarkdownButton, {\n title: tooltip('link'),\n icon: \"fas fa-link\",\n onclick: makeApplyStyle('link')\n }), 300);\n items.add('image', m(MarkdownButton, {\n title: tooltip('image'),\n icon: \"fas fa-image\",\n onclick: makeApplyStyle('image')\n }), 200);\n items.add('unordered_list', m(MarkdownButton, {\n title: tooltip('unordered_list'),\n icon: \"fas fa-list-ul\",\n onclick: makeApplyStyle('unordered_list')\n }), 100);\n items.add('ordered_list', m(MarkdownButton, {\n title: tooltip('ordered_list'),\n icon: \"fas fa-list-ol\",\n onclick: makeApplyStyle('ordered_list')\n }), 0);\n return items;\n}\nexport function initialize(app) {\n extend(BasicEditorDriver.prototype, 'keyHandlers', function (items) {\n items.add('bold', makeShortcut('bold', 'b', this));\n items.add('italic', makeShortcut('italic', 'i', this));\n });\n override('flarum/common/components/TextEditor', 'markdownToolbarItems', markdownToolbarItems);\n extend('flarum/common/components/TextEditor', 'toolbarItems', function (items) {\n items.add('markdown', m(MarkdownToolbar, {\n for: this.textareaId,\n setShortcutHandler: handler => shortcutHandler = handler\n }, this.markdownToolbarItems().toArray()), 100);\n });\n}","import app from 'flarum/forum/app';\nimport { initialize } from '../common/index';\napp.initializers.add('flarum-markdown', initialize);"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","flarum","reg","MarkdownToolbar","view","vnode","m","className","children","add","MarkdownButton","oncreate","super","button","type","this","attrs","hotkey","onkeydown","keydown","bind","onclick","name","icon","title","text","event","preventDefault","element","click","modifierKey","navigator","userAgent","match","styles","header","prefix","bold","suffix","trimFirst","italic","strikethrough","quote","multiline","surroundWithNewlines","code","blockPrefix","blockSuffix","link","replaceNext","scanFor","image","unordered_list","ordered_list","orderedList","spoiler","applyStyle","id","editorDriver","el","makeShortcut","e","metaKey","ctrlKey","markdownToolbarItems","oldFunc","items","tooltip","trans","makeApplyStyle","composer","editor","app","extend","override","for","textareaId","setShortcutHandler","handler","shortcutHandler","toArray"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/markdown/js/package.json b/extensions/markdown/js/package.json index 92c92eec2c..c7973f5ad5 100644 --- a/extensions/markdown/js/package.json +++ b/extensions/markdown/js/package.json @@ -4,7 +4,7 @@ "version": "0.0.0", "prettier": "@flarum/prettier-config", "dependencies": { - "flarum-webpack-config": "^2.0.0", + "flarum-webpack-config": "^3.0.0", "webpack": "^5.76.0", "webpack-cli": "^4.9.1" }, @@ -19,7 +19,7 @@ "@flarum/prettier-config": "^1.0.0", "flarum-tsconfig": "^1.0.2", "prettier": "^2.5.1", - "flarum-webpack-config": "^2.0.0", + "flarum-webpack-config": "^3.0.0", "webpack": "^5.76.0", "webpack-cli": "^4.9.1" } diff --git a/extensions/markdown/js/src/common/components/MarkdownButton.js b/extensions/markdown/js/src/common/components/MarkdownButton.js index dce1378fac..44072c7402 100644 --- a/extensions/markdown/js/src/common/components/MarkdownButton.js +++ b/extensions/markdown/js/src/common/components/MarkdownButton.js @@ -1,5 +1,5 @@ import Component from 'flarum/common/Component'; -import icon from 'flarum/common/helpers/icon'; +import Icon from 'flarum/common/components/Icon'; import Tooltip from 'flarum/common/components/Tooltip'; export default class MarkdownButton extends Component { @@ -16,7 +16,7 @@ export default class MarkdownButton extends Component { onkeydown={this.keydown.bind(this)} onclick={this.attrs.onclick} > - {icon(this.attrs.icon)} + ); diff --git a/extensions/markdown/js/src/common/index.js b/extensions/markdown/js/src/common/index.js index 6e3bbdf13f..94249a88d5 100644 --- a/extensions/markdown/js/src/common/index.js +++ b/extensions/markdown/js/src/common/index.js @@ -9,7 +9,6 @@ import app from 'flarum/common/app'; import { extend, override } from 'flarum/common/extend'; -import TextEditor from 'flarum/common/components/TextEditor'; import BasicEditorDriver from 'flarum/common/utils/BasicEditorDriver'; import styleSelectedText from 'flarum/common/utils/styleSelectedText'; @@ -89,13 +88,9 @@ export function initialize(app) { items.add('italic', makeShortcut('italic', 'i', this)); }); - if (TextEditor.prototype.markdownToolbarItems) { - override(TextEditor.prototype, 'markdownToolbarItems', markdownToolbarItems); - } else { - TextEditor.prototype.markdownToolbarItems = markdownToolbarItems; - } + override('flarum/common/components/TextEditor', 'markdownToolbarItems', markdownToolbarItems); - extend(TextEditor.prototype, 'toolbarItems', function (items) { + extend('flarum/common/components/TextEditor', 'toolbarItems', function (items) { items.add( 'markdown', (shortcutHandler = handler)}> diff --git a/extensions/markdown/js/tsconfig.json b/extensions/markdown/js/tsconfig.json new file mode 100644 index 0000000000..519ed73b2d --- /dev/null +++ b/extensions/markdown/js/tsconfig.json @@ -0,0 +1,15 @@ +{ + // Use Flarum's tsconfig as a starting point + "extends": "flarum-tsconfig", + // This will match all .ts, .tsx, .d.ts, .js, .jsx files in your `src` folder + // and also tells your Typescript server to read core's global typings for + // access to `dayjs` and `$` in the global namespace. + "include": ["src/**/*", "../../../framework/core/js/dist-typings/@types/**/*", "@types/**/*"], + "compilerOptions": { + // This will output typings to `dist-typings` + "declarationDir": "./dist-typings", + "paths": { + "flarum/*": ["../../../framework/core/js/dist-typings/*"] + } + } +} diff --git a/extensions/mentions/.gitignore b/extensions/mentions/.gitignore index 4ebb168a05..e60e512061 100644 --- a/extensions/mentions/.gitignore +++ b/extensions/mentions/.gitignore @@ -4,6 +4,7 @@ composer.phar .DS_Store Thumbs.db +tests/.phpunit.cache tests/.phpunit.result.cache /tests/integration/tmp .vagrant diff --git a/extensions/mentions/LICENSE b/extensions/mentions/LICENSE index 54ac29ab2c..bb6e15d87e 100644 --- a/extensions/mentions/LICENSE +++ b/extensions/mentions/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019-2021 Stichting Flarum (Flarum Foundation) +Copyright (c) 2019-2024 Stichting Flarum (Flarum Foundation) Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/extensions/mentions/composer.json b/extensions/mentions/composer.json index 946c7c9f7b..9182a9fa5d 100644 --- a/extensions/mentions/composer.json +++ b/extensions/mentions/composer.json @@ -78,6 +78,8 @@ "require-dev": { "flarum/core": "*@dev", "flarum/tags": "*@dev", + "flarum/approval": "*@dev", + "flarum/flags": "*@dev", "flarum/testing": "^2.0" }, "repositories": [ diff --git a/extensions/mentions/extend.php b/extensions/mentions/extend.php index b659d049da..f5768bc612 100644 --- a/extensions/mentions/extend.php +++ b/extensions/mentions/extend.php @@ -9,25 +9,22 @@ namespace Flarum\Mentions; -use Flarum\Api\Controller; -use Flarum\Api\Serializer\BasicPostSerializer; -use Flarum\Api\Serializer\BasicUserSerializer; -use Flarum\Api\Serializer\CurrentUserSerializer; -use Flarum\Api\Serializer\GroupSerializer; -use Flarum\Api\Serializer\PostSerializer; +use Flarum\Api\Context; +use Flarum\Api\Endpoint; +use Flarum\Api\Resource; +use Flarum\Api\Schema; use Flarum\Approval\Event\PostWasApproved; use Flarum\Extend; use Flarum\Group\Group; -use Flarum\Mentions\Api\LoadMentionedByRelationship; +use Flarum\Mentions\Api\PostResourceFields; use Flarum\Post\Event\Deleted; use Flarum\Post\Event\Hidden; use Flarum\Post\Event\Posted; use Flarum\Post\Event\Restored; use Flarum\Post\Event\Revised; -use Flarum\Post\Filter\PostFilterer; +use Flarum\Post\Filter\PostSearcher; use Flarum\Post\Post; -use Flarum\Tags\Api\Serializer\TagSerializer; -use Flarum\Tags\Tag; +use Flarum\Search\Database\DatabaseSearchDriver; use Flarum\User\User; return [ @@ -51,8 +48,7 @@ ->belongsToMany('mentionedBy', Post::class, 'post_mentions_post', 'mentions_post_id', 'post_id') ->belongsToMany('mentionsPosts', Post::class, 'post_mentions_post', 'post_id', 'mentions_post_id') ->belongsToMany('mentionsUsers', User::class, 'post_mentions_user', 'post_id', 'mentions_user_id') - ->belongsToMany('mentionsGroups', Group::class, 'post_mentions_group', 'post_id', 'mentions_group_id') - ->belongsToMany('mentionsUsers', User::class, 'post_mentions_user', 'post_id', 'mentions_user_id'), + ->belongsToMany('mentionsGroups', Group::class, 'post_mentions_group', 'post_id', 'mentions_group_id'), new Extend\Locales(__DIR__.'/locale'), @@ -60,47 +56,39 @@ ->namespace('flarum-mentions', __DIR__.'/views'), (new Extend\Notification()) - ->type(Notification\PostMentionedBlueprint::class, PostSerializer::class, ['alert']) - ->type(Notification\UserMentionedBlueprint::class, PostSerializer::class, ['alert']) - ->type(Notification\GroupMentionedBlueprint::class, PostSerializer::class, ['alert']), - - (new Extend\ApiSerializer(BasicPostSerializer::class)) - ->hasMany('mentionedBy', BasicPostSerializer::class) - ->hasMany('mentionsPosts', BasicPostSerializer::class) - ->hasMany('mentionsUsers', BasicUserSerializer::class) - ->hasMany('mentionsGroups', GroupSerializer::class) - ->attribute('mentionedByCount', function (BasicPostSerializer $serializer, Post $post) { - // Only if it was eager loaded. - return $post->getAttribute('mentioned_by_count') ?? 0; + ->type(Notification\PostMentionedBlueprint::class, ['alert']) + ->type(Notification\UserMentionedBlueprint::class, ['alert']) + ->type(Notification\GroupMentionedBlueprint::class, ['alert']), + + (new Extend\ApiResource(Resource\PostResource::class)) + ->fields(PostResourceFields::class) + ->endpoint([Endpoint\Index::class, Endpoint\Show::class], function (Endpoint\Index|Endpoint\Show $endpoint): Endpoint\Endpoint { + return $endpoint->addDefaultInclude(['mentionedBy', 'mentionedBy.user', 'mentionedBy.discussion']); + }) + ->endpoint(Endpoint\Index::class, function (Endpoint\Index $endpoint): Endpoint\Index { + return $endpoint->eagerLoad(['mentionsUsers', 'mentionsPosts', 'mentionsPosts.user', 'mentionsPosts.discussion', 'mentionsGroups']); }), - (new Extend\ApiController(Controller\ShowDiscussionController::class)) - ->addInclude(['posts.mentionedBy', 'posts.mentionedBy.user', 'posts.mentionedBy.discussion']) - ->load([ - 'posts.mentionsUsers', 'posts.mentionsPosts', 'posts.mentionsPosts.user', - 'posts.mentionsGroups' - ]) - ->loadWhere('posts.mentionedBy', LoadMentionedByRelationship::mutateRelation(...)) - ->prepareDataForSerialization(LoadMentionedByRelationship::countRelation(...)), - - (new Extend\ApiController(Controller\ListDiscussionsController::class)) - ->load([ - 'firstPost.mentionsUsers', 'firstPost.mentionsPosts', 'firstPost.mentionsPosts.user', 'firstPost.mentionsGroups', - 'lastPost.mentionsUsers', 'lastPost.mentionsPosts', 'lastPost.mentionsPosts.user', 'lastPost.mentionsGroups', - ]), - - (new Extend\ApiController(Controller\ShowPostController::class)) - ->addInclude(['mentionedBy', 'mentionedBy.user', 'mentionedBy.discussion']) - // We wouldn't normally need to eager load on a single model, - // but we do so here for visibility scoping. - ->loadWhere('mentionedBy', LoadMentionedByRelationship::mutateRelation(...)) - ->prepareDataForSerialization(LoadMentionedByRelationship::countRelation(...)), + (new Extend\ApiResource(Resource\DiscussionResource::class)) + ->endpoint(Endpoint\Index::class, function (Endpoint\Index $endpoint): Endpoint\Index { + return $endpoint->eagerLoadWhenIncluded([ + 'firstPost' => [ + 'firstPost.mentionsUsers', 'firstPost.mentionsPosts', + 'firstPost.mentionsPosts.user', 'firstPost.mentionsPosts.discussion', 'firstPost.mentionsGroups', + ], + 'lastPost' => [ + 'lastPost.mentionsUsers', 'lastPost.mentionsPosts', + 'lastPost.mentionsPosts.user', 'lastPost.mentionsPosts.discussion', 'lastPost.mentionsGroups', + ], + ]); + }), - (new Extend\ApiController(Controller\ListPostsController::class)) - ->addInclude(['mentionedBy', 'mentionedBy.user', 'mentionedBy.discussion']) - ->load(['mentionsUsers', 'mentionsPosts', 'mentionsPosts.user', 'mentionsGroups']) - ->loadWhere('mentionedBy', LoadMentionedByRelationship::mutateRelation(...)) - ->prepareDataForSerialization(LoadMentionedByRelationship::countRelation(...)), + (new Extend\ApiResource(Resource\UserResource::class)) + ->fields(fn () => [ + Schema\Boolean::make('canMentionGroups') + ->visible(fn (User $user, Context $context) => $context->getActor()->id === $user->id) + ->get(fn (User $user) => $user->can('mentionGroups')), + ]), (new Extend\Settings) ->serializeToForum('allowUsernameMentionFormat', 'flarum-mentions.allow_username_format', 'boolval'), @@ -113,34 +101,31 @@ ->listen(Hidden::class, Listener\UpdateMentionsMetadataWhenInvisible::class) ->listen(Deleted::class, Listener\UpdateMentionsMetadataWhenInvisible::class), - (new Extend\Filter(PostFilterer::class)) - ->addFilter(Filter\MentionedFilter::class) - ->addFilter(Filter\MentionedPostFilter::class), - - (new Extend\ApiSerializer(CurrentUserSerializer::class)) - ->attribute('canMentionGroups', function (CurrentUserSerializer $serializer, User $user): bool { - return $user->can('mentionGroups'); - }), + (new Extend\SearchDriver(DatabaseSearchDriver::class)) + ->addFilter(PostSearcher::class, Filter\MentionedFilter::class) + ->addFilter(PostSearcher::class, Filter\MentionedPostFilter::class), // Tag mentions (new Extend\Conditional()) - ->whenExtensionEnabled('flarum-tags', [ + ->whenExtensionEnabled('flarum-tags', fn () => [ (new Extend\Formatter) ->render(Formatter\FormatTagMentions::class) ->unparse(Formatter\UnparseTagMentions::class), - (new Extend\ApiSerializer(BasicPostSerializer::class)) - ->hasMany('mentionsTags', TagSerializer::class), - - (new Extend\ApiController(Controller\ShowDiscussionController::class)) - ->load(['posts.mentionsTags']), - - (new Extend\ApiController(Controller\ListDiscussionsController::class)) - ->load([ - 'firstPost.mentionsTags', 'lastPost.mentionsTags', + (new Extend\ApiResource(Resource\PostResource::class)) + ->fields(fn () => [ + Schema\Relationship\ToMany::make('mentionsTags') + ->type('tags'), ]), - (new Extend\ApiController(Controller\ListPostsController::class)) - ->load(['mentionsTags']), + (new Extend\ApiResource(Resource\DiscussionResource::class)) + ->endpoint(Endpoint\Index::class, function (Endpoint\Index $endpoint): Endpoint\Index { + return $endpoint->eagerLoadWhenIncluded(['firstPost' => ['firstPost.mentionsTags'], 'lastPost' => ['lastPost.mentionsTags']]); + }), + + (new Extend\ApiResource(Resource\PostResource::class)) + ->endpoint([Endpoint\Index::class, Endpoint\Show::class], function (Endpoint\Index|Endpoint\Show $endpoint): Endpoint\Endpoint { + return $endpoint->eagerLoad(['mentionsTags']); + }), ]), ]; diff --git a/extensions/mentions/js/dist/admin.js b/extensions/mentions/js/dist/admin.js index 68d0cc1193..d82ca90341 100644 --- a/extensions/mentions/js/dist/admin.js +++ b/extensions/mentions/js/dist/admin.js @@ -1,2 +1,2 @@ -(()=>{var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var a in r)e.o(r,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:r[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};(()=>{"use strict";e.r(t);const r=flarum.core.compat["admin/app"];var a=e.n(r);a().initializers.add("flarum-mentions",(function(){a().extensionData.for("flarum-mentions").registerSetting({setting:"flarum-mentions.allow_username_format",type:"boolean",label:a().translator.trans("flarum-mentions.admin.settings.allow_username_format_label"),help:a().translator.trans("flarum-mentions.admin.settings.allow_username_format_text")}).registerPermission({permission:"mentionGroups",label:a().translator.trans("flarum-mentions.admin.permissions.mention_groups_label"),icon:"fas fa-at"},"start")}))})(),module.exports=t})(); +(()=>{var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};(()=>{"use strict";e.r(t),e.d(t,{extend:()=>u});const n=flarum.reg.get("core","admin/app");var r=e.n(n);const a=flarum.reg.get("core","common/extenders");var o=e.n(a);const s=flarum.reg.get("core","common/query/IGambit"),m=flarum.reg.get("core","common/app");var i=e.n(m);class l extends s.KeyValueGambit{key(){return i().translator.trans("flarum-mentions.lib.gambits.posts.mentioned.key",{},!0)}hint(){return i().translator.trans("flarum-mentions.lib.gambits.posts.mentioned.hint",{},!0)}filterKey(){return"mentioned"}}flarum.reg.add("flarum-mentions","common/query/posts/MentionedGambit",l);const u=[(new(o().Search)).gambit("posts",l),(new(o().Admin)).setting((()=>({setting:"flarum-mentions.allow_username_format",type:"boolean",label:r().translator.trans("flarum-mentions.admin.settings.allow_username_format_label"),help:r().translator.trans("flarum-mentions.admin.settings.allow_username_format_text")}))).permission((()=>({permission:"mentionGroups",label:r().translator.trans("flarum-mentions.admin.permissions.mention_groups_label"),icon:"fas fa-at"})),"start")];r().initializers.add("flarum-mentions",(()=>{}))})(),module.exports=t})(); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/extensions/mentions/js/dist/admin.js.map b/extensions/mentions/js/dist/admin.js.map index 74c9518329..529d6baa4a 100644 --- a/extensions/mentions/js/dist/admin.js.map +++ b/extensions/mentions/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCExDC,IAAAA,aAAAA,IAAqB,mBAAmB,WACtCA,IAAAA,cAAAA,IACO,mBACJC,gBAAgB,CACfC,QAAS,wCACTC,KAAM,UACNC,MAAOJ,IAAAA,WAAAA,MAAqB,8DAC5BK,KAAML,IAAAA,WAAAA,MAAqB,+DAE5BM,mBACC,CACEC,WAAY,gBACZH,MAAOJ,IAAAA,WAAAA,MAAqB,0DAC5BQ,KAAM,aAER,QAEN,G","sources":["webpack://@flarum/mentions/webpack/bootstrap","webpack://@flarum/mentions/webpack/runtime/compat get default export","webpack://@flarum/mentions/webpack/runtime/define property getters","webpack://@flarum/mentions/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/mentions/webpack/runtime/make namespace object","webpack://@flarum/mentions/external root \"flarum.core.compat['admin/app']\"","webpack://@flarum/mentions/./src/admin/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","import app from 'flarum/admin/app';\n\napp.initializers.add('flarum-mentions', function () {\n app.extensionData\n .for('flarum-mentions')\n .registerSetting({\n setting: 'flarum-mentions.allow_username_format',\n type: 'boolean',\n label: app.translator.trans('flarum-mentions.admin.settings.allow_username_format_label'),\n help: app.translator.trans('flarum-mentions.admin.settings.allow_username_format_text'),\n })\n .registerPermission(\n {\n permission: 'mentionGroups',\n label: app.translator.trans('flarum-mentions.admin.permissions.mention_groups_label'),\n icon: 'fas fa-at',\n },\n 'start'\n );\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","registerSetting","setting","type","label","help","registerPermission","permission","icon"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,qDCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,oB,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,wBCAtD,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,c,aCE7C,MAAMW,UAAwB,EAAAC,eAC3C,GAAAjB,GACE,OAAO,eAAekB,MAAM,kDAAmD,CAAC,GAAG,EACrF,CACA,IAAAC,GACE,OAAO,eAAeD,MAAM,mDAAoD,CAAC,GAAG,EACtF,CACA,SAAAE,GACE,MAAO,WACT,EAEFN,OAAOC,IAAIM,IAAI,kBAAmB,qCAAsCL,GCXxE,MCCA,IDDgB,IAAI,aACnBM,OAAO,QAASN,ICAgB,IAAI,YAAeO,SAAQ,KAAM,CAChEA,QAAS,wCACTC,KAAM,UACNC,MAAO,eAAeP,MAAM,8DAC5BQ,KAAM,eAAeR,MAAM,iEACzBS,YAAW,KAAM,CACnBA,WAAY,gBACZF,MAAO,eAAeP,MAAM,0DAC5BU,KAAM,eACJ,UCVJ,iBAAiBP,IAAI,mBAAmB,Q","sources":["webpack://@flarum/mentions/webpack/bootstrap","webpack://@flarum/mentions/webpack/runtime/compat get default export","webpack://@flarum/mentions/webpack/runtime/define property getters","webpack://@flarum/mentions/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/mentions/webpack/runtime/make namespace object","webpack://@flarum/mentions/external root \"flarum.reg.get('core', 'admin/app')\"","webpack://@flarum/mentions/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/mentions/external root \"flarum.reg.get('core', 'common/query/IGambit')\"","webpack://@flarum/mentions/external root \"flarum.reg.get('core', 'common/app')\"","webpack://@flarum/mentions/./src/common/query/posts/MentionedGambit.ts","webpack://@flarum/mentions/./src/common/extend.ts","webpack://@flarum/mentions/./src/admin/extend.ts","webpack://@flarum/mentions/./src/admin/index.tsx"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'admin/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/query/IGambit');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/app');","import { KeyValueGambit } from 'flarum/common/query/IGambit';\nimport app from 'flarum/common/app';\nexport default class MentionedGambit extends KeyValueGambit {\n key() {\n return app.translator.trans('flarum-mentions.lib.gambits.posts.mentioned.key', {}, true);\n }\n hint() {\n return app.translator.trans('flarum-mentions.lib.gambits.posts.mentioned.hint', {}, true);\n }\n filterKey() {\n return 'mentioned';\n }\n}\nflarum.reg.add('flarum-mentions', 'common/query/posts/MentionedGambit', MentionedGambit);","import Extend from 'flarum/common/extenders';\nimport MentionedGambit from './query/posts/MentionedGambit';\nexport default [new Extend.Search() //\n.gambit('posts', MentionedGambit)];","import Extend from 'flarum/common/extenders';\nimport app from 'flarum/admin/app';\nimport commonExtend from '../common/extend';\nexport default [...commonExtend, new Extend.Admin().setting(() => ({\n setting: 'flarum-mentions.allow_username_format',\n type: 'boolean',\n label: app.translator.trans('flarum-mentions.admin.settings.allow_username_format_label'),\n help: app.translator.trans('flarum-mentions.admin.settings.allow_username_format_text')\n})).permission(() => ({\n permission: 'mentionGroups',\n label: app.translator.trans('flarum-mentions.admin.permissions.mention_groups_label'),\n icon: 'fas fa-at'\n}), 'start')];","import app from 'flarum/admin/app';\nexport { default as extend } from './extend';\napp.initializers.add('flarum-mentions', () => {\n // ...\n});"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","reg","MentionedGambit","KeyValueGambit","trans","hint","filterKey","add","gambit","setting","type","label","help","permission","icon"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/mentions/js/dist/forum.js b/extensions/mentions/js/dist/forum.js index d697518c40..c4f68aff01 100644 --- a/extensions/mentions/js/dist/forum.js +++ b/extensions/mentions/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{"use strict";t.r(e),t.d(e,{extend:()=>Kt,filterGroupMentions:()=>ne,filterPostMentions:()=>te,filterTagMentions:()=>se,filterUserMentions:()=>Vt,postFilterGroupMentions:()=>oe,postFilterPostMentions:()=>ee,postFilterTagMentions:()=>re,postFilterUserMentions:()=>Zt});var n={};t.r(n),t.d(n,{default:()=>W,insertMention:()=>G});var o={};t.r(o),t.d(o,{filterGroupMentions:()=>ne,filterPostMentions:()=>te,filterTagMentions:()=>se,filterUserMentions:()=>Vt,postFilterGroupMentions:()=>oe,postFilterPostMentions:()=>ee,postFilterTagMentions:()=>re,postFilterUserMentions:()=>Zt});const s=flarum.core.compat["common/extend"],r=flarum.core.compat["forum/app"];var i=t.n(r);const a=flarum.core.compat["forum/components/NotificationGrid"];var c=t.n(a);const l=flarum.core.compat["common/utils/string"],u=flarum.core.compat["common/helpers/textContrastClass"];var d=t.n(u);const f=flarum.core.compat["forum/components/Post"];var p=t.n(f);const h=flarum.core.compat["forum/components/CommentPost"];var g=t.n(h);const b=flarum.core.compat["forum/components/PostPreview"];var y=t.n(b);const v=flarum.core.compat["common/components/LoadingIndicator"];var w=t.n(v);const x=flarum.core.compat["common/components/Link"];var M=t.n(x);const P=flarum.core.compat["common/helpers/punctuateSeries"];var C=t.n(P);const T=flarum.core.compat["common/helpers/username"];var A=t.n(T);const B=flarum.core.compat["common/helpers/icon"];var _=t.n(B);const N=flarum.core.compat["common/components/Button"];var S=t.n(N);const k=flarum.core.compat["common/components/Modal"];var F=t.n(k);const I=flarum.core.compat["common/states/PaginatedListState"];var L=t.n(I);class R extends(L()){constructor(t,e){void 0===e&&(e=1),t.page={...t.page||{},limit:10},super(t,e,10)}get type(){return"posts"}}class j extends(F()){oninit(t){super.oninit(t),this.state=new R({filter:{mentionedPost:this.attrs.post.id()},sort:"number"}),this.state.refresh()}className(){return"MentionedByModal"}title(){return i().translator.trans("flarum-mentions.forum.mentioned_by.title")}content(){return m("[",null,m("div",{className:"Modal-body"},this.state.isInitialLoading()?m(w(),null):m("[",null,m("ul",{className:"MentionedByModal-list Dropdown-menu Dropdown-menu--inline Post-mentionedBy-preview"},this.state.getPages().map((t=>t.items.map((t=>m("li",{"data-number":t.number()},m(y(),{post:t,onclick:()=>i().modal.close()}))))))))),this.state.hasNext()&&m("div",{className:"Modal-footer"},m("div",{className:"Form Form--centered"},m("div",{className:"Form-group"},m(S(),{className:"Button Button--block",onclick:()=>this.state.loadNext(),loading:this.state.isLoadingNext()},i().translator.trans("flarum-mentions.forum.mentioned_by.load_more_button"))))))}}const D=flarum.core.compat["forum/utils/DiscussionControls"];var U=t.n(D);const H=flarum.core.compat["forum/components/EditPostComposer"];var E=t.n(H);function G(t,e,n){return new Promise((o=>{const s=i().mentionFormats.mentionable("post").replacement(t)+" ";e.fields.content()||(e.body.attrs.originalContent=s);const r=e.editor.getSelectionRange()[0],a=e.fields.content().slice(0,r),c=0==a.length?0:3-a.match(/(\n{0,2})$/)[0].length;return e.editor.insertAtCursor(Array(c).join("\n")+(n?"> "+s+n.trim().replace(/\n/g,"\n> ")+"\n\n":s),!1),o(e)}))}function W(t,e){return i().composer.bodyMatches(E())&&i().composer.body.attrs.post.discussion()===t.discussion()?G(t,i().composer,e):U().replyAction.call(t.discussion()).then((n=>G(t,n,e)))}const O=flarum.core.compat["common/Fragment"];var q=t.n(O);class J extends(q()){constructor(t){super(),this.post=t}view(){return m("button",{className:"Button PostQuoteButton",onclick:()=>{W(this.post,this.content)}},_()("fas fa-quote-left",{className:"Button-icon"}),i().translator.trans("flarum-mentions.forum.post.quote_button"))}show(t,e){const n=this.$().show(),o=n.offsetParent().offset();n.css("left",t-o.left).css("top",e-o.top),this.hideHandler=this.hide.bind(this),$(document).on("mouseup",this.hideHandler)}showStart(t,e){const n=this.$();this.show(t,$(window).scrollTop()+e-n.outerHeight()-5)}showEnd(t,e){const n=this.$();this.show(t-n.outerWidth(),$(window).scrollTop()+e+5)}hide(){this.$().hide(),$(document).off("mouseup",this.hideHandler)}}function z(t){const e=window.getSelection();if(!e.isCollapsed){const n=e.getRangeAt(0),o=n.commonAncestorContainer;if(t[0]===o||$.contains(t[0],o)){const t=$("
    ").append(n.cloneContents());return t.find("img.emoji").replaceWith((function(){return this.alt})),t.find("img").replaceWith((function(){return"![](".concat(this.src,")")})),t.find("a").replaceWith((function(){return"[".concat(this.innerText,"](").concat(this.href,")")})),t.text()}}return""}const Q=flarum.core.compat["common/components/TextEditor"];var X=t.n(Q);const Y=flarum.core.compat["common/components/TextEditorButton"];var K=t.n(Y);const V=flarum.core.compat["common/utils/KeyboardNavigatable"];var Z=t.n(V);function tt(t){return tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tt(t)}function et(t,e,n){return(e=function(t){var e=function(t,e){if("object"!==tt(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e);if("object"!==tt(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"===tt(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class nt extends(q()){constructor(){super(...arguments),et(this,"items",[]),et(this,"active",!1),et(this,"index",0),et(this,"keyWasJustPressed",!1)}view(){return m("ul",{className:"Dropdown-menu MentionsDropdown"},this.items.map((t=>m("li",null,t))))}show(t,e){this.$().show().css({left:t+"px",top:e+"px"}),this.active=!0}hide(){this.$().hide(),this.active=!1}navigate(t){this.keyWasJustPressed=!0,this.setIndex(this.index+t,!0),clearTimeout(this.keyWasJustPressedTimeout),this.keyWasJustPressedTimeout=setTimeout((()=>this.keyWasJustPressed=!1),500)}complete(){this.$("li").eq(this.index).find("button").click()}setIndex(t,e){if(this.keyWasJustPressed&&!e)return;const n=this.$(),o=n.find("li");let s=t;s<0?s=o.length-1:s>=o.length&&(s=0),this.index=s;const r=o.removeClass("active").eq(s).addClass("active");if(e){const t=n.scrollTop(),e=n.offset().top,o=e+n.outerHeight(),s=r.offset().top,i=s+r.outerHeight();let a;so&&(a=t-o+i+parseInt(n.css("padding-bottom"),10)),void 0!==a&&n.stop(!0).animate({scrollTop:a},100)}}}class ot{constructor(){et(this,"instances",void 0),et(this,"mentionables",void 0),et(this,"extendable",void 0)}makeMentionables(){var t;return null!=(t=this.instances)?t:this.instances=this.mentionables.map((t=>new t(this)))}getMentionable(t){var e;return null!=(e=this.makeMentionables().find((e=>e.type()===t)))?e:null}extend(t){if(!this.extendable)throw new Error("This mention format does not allow extending.");this.mentionables.push(t)}}const st=flarum.core.compat["common/helpers/avatar"];var rt=t.n(st);const it=flarum.core.compat["common/helpers/highlight"];var at=t.n(it);class ct{constructor(t){et(this,"format",void 0),this.format=t}}const mt=flarum.core.compat["common/utils/extractText"];var lt=t.n(mt);const ut=()=>lt()(i().translator.trans("core.lib.username.deleted_text"));function dt(t,e){return void 0===e&&(e=!0),t?((e?t.displayName():t.username())||ut()).replace(/"#[a-z]{0,3}[0-9]+/,"_"):ut().replace(/"#[a-z]{0,3}[0-9]+/,"_")}class ft extends ct{type(){return"user"}initialResults(){return Array.from(i().store.all("users"))}replacement(t){if(i().forum.attribute("allowUsernameMentionFormat")){const e=dt(t,!1);return this.format.format(e)}const e=dt(t);return this.format.format(e,"",t.id())}suggestion(t,e){const n=A()(t,(t=>at()(t,e)));return m("[",null,rt()(t),n)}matches(t,e){return!!e&&[t.username(),t.displayName()].some((t=>t.toLowerCase().substr(0,e.length)===e))}maxStoreMatchedResults(){return null}async search(t){return await i().store.find("users",{filter:{q:t},page:{limit:5}})}enabled(){return!0}}const pt=flarum.core.compat["forum/components/ReplyComposer"];var ht=t.n(pt);class gt extends ct{type(){return"post"}initialResults(){if(!i().composer.bodyMatches(ht())&&!i().composer.bodyMatches(E()))return[];const t=i().composer.body.attrs,e=t.post;return(e&&e.discussion()||t.discussion).posts().filter((t=>t&&"comment"===t.contentType()&&(!e||t.number()e.createdAt().getTime()-t.createdAt().getTime()))}replacement(t){const e=dt(t.user());return this.format.format(e,"p",t.id())}suggestion(t,e){var n;const o=t.user()||null,s=A()(o,(t=>at()(t,e)));return m("[",null,rt()(o),s,[i().translator.trans("flarum-mentions.forum.composer.reply_to_post_text",{number:t.number()})," — ",(0,l.truncate)(null!=(n=t.contentPlain())?n:"",200)])}matches(t,e){const n=t.user(),o=i().mentionFormats.mentionable("user");return!e||n&&o.matches(n,e)}maxStoreMatchedResults(){return 5}search(t){return Promise.resolve([])}enabled(){return!0}}const bt=flarum.core.compat["common/models/Group"];var yt=t.n(bt);const vt=flarum.core.compat["common/components/Badge"];var wt=t.n(vt);class xt extends ct{type(){return"group"}initialResults(){return Array.from(i().store.all("groups").filter((t=>t.id()!==yt().GUEST_ID&&t.id()!==yt().MEMBER_ID)))}replacement(t){return this.format.format(t.namePlural(),"g",t.id())}suggestion(t,e){let n=t.namePlural();return e&&(n=at()(n,e)),m("[",null,m(wt(),{className:"Avatar Badge Badge--group--".concat(t.id()," Badge-icon"),color:t.color(),type:"group",icon:t.icon()}),m("span",{className:"username"},n))}matches(t,e){return!!e&&[t.namePlural().toLowerCase(),t.nameSingular().toLowerCase()].some((t=>t.toLowerCase().substr(0,e.length)===e))}maxStoreMatchedResults(){return null}search(t){return Promise.resolve([])}enabled(){var t,e,n;return null!=(t=null==(e=i().session)||null==(n=e.user)?void 0:n.canMentionGroups())&&t}}class Mt extends ot{constructor(){super(...arguments),et(this,"mentionables",[ft,gt,xt]),et(this,"extendable",!0)}trigger(){return"@"}queryFromTyped(t){const e=t.match(/^["“]?((?:(?!"#).)+)$/);return e?e[1]:null}format(t,e,n){return void 0===e&&(e=""),void 0===n&&(n=null),{simple:"@".concat(t),safe:'@"'.concat(t,'"#').concat(e).concat(n)}[n?"safe":"simple"]}}class Pt extends ct{type(){return"tag"}initialResults(){return Array.from(i().store.all("tags"))}replacement(t){return this.format.format(t.slug())}matches(t,e){return!!e&&[t.name().toLowerCase()].some((t=>t.toLowerCase().substr(0,e.length)===e))}maxStoreMatchedResults(){return null}async search(t){return await i().store.find("tags",{filter:{q:t},page:{limit:5}})}suggestion(t,e){let n=t.name();return e&&(n=at()(n,e)),m("[",null,m(wt(),{className:"Avatar",icon:t.icon(),color:t.color(),type:"tag"}),m("span",{className:"username"},n))}enabled(){return"flarum-tags"in flarum.extensions}}class Ct extends ot{constructor(){super(...arguments),et(this,"mentionables",[Pt]),et(this,"extendable",!1)}trigger(){return"#"}queryFromTyped(t){const e=t.match(/^[-_\p{L}\p{N}\p{M}]+$/giu);return e?e[0]:null}format(t){return"#".concat(t)}}class Tt{constructor(){et(this,"formats",[new Mt,new Ct])}get(t){var e;return null!=(e=this.formats.find((e=>e.trigger()===t)))?e:null}mentionable(t){for(const e of this.formats){const n=e.getMentionable(t);if(n)return n}return null}extend(t){this.formats.push(new t)}}const At=flarum.core.compat["common/Component"];var $t=t.n(At);const Bt=flarum.core.compat["common/utils/classList"];var _t=t.n(Bt);class Nt extends($t()){view(t){const{mentionable:e,...n}=this.attrs,o=_t()("MentionsDropdownItem","PostPreview","MentionsDropdown-".concat(e.type()));return m("button",Object.assign({className:o},n),m("span",{className:"PostPreview-content"},t.children))}}const St=flarum.core.compat["common/utils/throttleDebounce"];class kt{constructor(t){et(this,"mentionables",void 0),et(this,"results",{}),et(this,"typed",null),et(this,"searched",[]),et(this,"dropdownItemAttrs",{}),et(this,"search",(0,St.throttle)(250,(async()=>{if(!this.typed||this.typed.length<=1)return;const t=this.typed.toLowerCase();if(!this.searched.includes(t)){for(const e of this.mentionables)for(const n of await e.search(t))this.results[e.type()].has(n.id())||this.results[e.type()].set(n.id(),n);return this.searched.push(t),Promise.resolve()}}))),this.dropdownItemAttrs=t}init(t){this.typed=null,this.mentionables=t;for(const t of this.mentionables)this.results[t.type()]=new Map(t.initialResults().map((t=>[t.id(),t])))}matches(t,e){var n;return t.matches(e,(null==(n=this.typed)?void 0:n.toLowerCase())||"")}makeSuggestion(t,e){const n=t.suggestion(e,this.typed),o=t.replacement(e),{onclick:s,...r}=this.dropdownItemAttrs;return m(Nt,Object.assign({mentionable:t,onclick:()=>s(o)},r),n)}buildSuggestions(){const t=[];for(const e of this.mentionables){if(!e.enabled())continue;let n=Array.from(this.results[e.type()].values()).filter((t=>this.matches(e,t)));const o=e.maxStoreMatchedResults();o&&(n=n.splice(0,o));for(const o of n){const n=this.makeSuggestion(e,o);t.push(n)}}return t}}const Ft=flarum.core.compat["forum/components/Notification"];var It=t.n(Ft);class Lt extends(It()){icon(){return"fas fa-reply"}href(){const t=this.attrs.notification,e=t.subject(),n=t.content();return i().route.discussion(e.discussion(),n&&n.replyNumber)}content(){const t=this.attrs.notification.fromUser();return i().translator.trans("flarum-mentions.forum.notifications.post_mentioned_text",{user:t,count:1})}excerpt(){return(0,l.truncate)(this.attrs.notification.subject().contentPlain()||"",200)}}class Rt extends(It()){icon(){return"fas fa-at"}href(){const t=this.attrs.notification.subject();return i().route.discussion(t.discussion(),t.number())}content(){const t=this.attrs.notification.fromUser();return i().translator.trans("flarum-mentions.forum.notifications.user_mentioned_text",{user:t})}excerpt(){return(0,l.truncate)(this.attrs.notification.subject().contentPlain(),200)}}class jt extends(It()){icon(){return"fas fa-at"}href(){const t=this.attrs.notification.subject();return i().route.discussion(t.discussion(),t.number())}content(){const t=this.attrs.notification.fromUser();return i().translator.trans("flarum-mentions.forum.notifications.group_mentioned_text",{user:t})}excerpt(){return(0,l.truncate)(this.attrs.notification.subject().contentPlain(),200)}}const Dt=flarum.core.compat["forum/components/UserPage"];var Ut=t.n(Dt);const Ht=flarum.core.compat["common/components/LinkButton"];var Et=t.n(Ht);const Gt=flarum.core.compat["common/models/User"];var Wt=t.n(Gt);flarum.core.compat["common/Model"];const Ot=flarum.core.compat["common/extenders"];var qt=t.n(Ot);const Jt=flarum.core.compat["common/models/Post"];var zt=t.n(Jt);const Qt=flarum.core.compat["forum/components/PostsUserPage"];var Xt=t.n(Qt);class Yt extends(Xt()){loadResults(t){return i().store.find("posts",{filter:{type:"comment",mentioned:this.user.id()},page:{offset:t,limit:this.loadLimit},sort:"-createdAt"})}}const Kt=[(new(qt().Routes)).add("user.mentions","/u/:username/mentions",Yt),new(qt().Model)(zt()).hasMany("mentionedBy").attribute("mentionedByCount"),new(qt().Model)(Wt()).attribute("canMentionGroups")];function Vt(t){let e;if(i().forum.attribute("allowUsernameMentionFormat")&&t.hasAttribute("username")?e=i().store.getBy("users","username",t.getAttribute("username")):t.hasAttribute("id")&&(e=i().store.getById("users",t.getAttribute("id"))),e)return t.setAttribute("id",e.id()),t.setAttribute("slug",e.slug()),t.setAttribute("displayname",lt()(A()(e))),!0;t.invalidate()}function Zt(t){t.setAttribute("deleted",!1)}function te(t){const e=i().store.getById("posts",t.getAttribute("id"));if(e)return t.setAttribute("discussionid",e.discussion().id()),t.setAttribute("number",e.number()),t.setAttribute("displayname",lt()(A()(e.user()))),!0}function ee(t){t.setAttribute("deleted",!1)}function ne(t){var e,n;if(null!=(e=i().session)&&null!=(n=e.user)&&n.canMentionGroups()){const e=i().store.getById("groups",t.getAttribute("id"));if(e)return t.setAttribute("groupname",lt()(e.namePlural())),!0}t.invalidate()}function oe(t){var e,n;if(null!=(e=i().session)&&null!=(n=e.user)&&n.canMentionGroups()){const e=i().store.getById("groups",t.getAttribute("id"));t.setAttribute("color",e.color()),t.setAttribute("icon",e.icon()),t.setAttribute("deleted",!1)}}function se(t){if("flarum-tags"in flarum.extensions){const e=i().store.getBy("tags","slug",t.getAttribute("slug"));if(e)return t.setAttribute("id",e.id()),t.setAttribute("tagname",e.name()),!0}t.invalidate()}function re(t){if("flarum-tags"in flarum.extensions){const e=i().store.getBy("tags","slug",t.getAttribute("slug"));t.setAttribute("icon",e.icon()),t.setAttribute("color",e.color()),t.setAttribute("deleted",!1)}}const ie={"mentions/components/MentionsUserPage":Yt,"mentions/components/PostMentionedNotification":Lt,"mentions/components/UserMentionedNotification":Rt,"mentions/components/GroupMentionedNotification":jt,"mentions/fragments/AutocompleteDropdown":nt,"mentions/fragments/PostQuoteButton":J,"mentions/utils/getCleanDisplayName":dt,"mentions/utils/getMentionText":function(t,e,n){if(void 0!==t&&void 0===e)return i().mentionables.get("user").replacement(t);if(void 0!==t&&void 0!==e)return i().mentionables.get("post").replacement(i().store.getById("posts",e));if(void 0!==n)return i().mentionables.get("group").replacement(n);throw"No parameters were passed"},"mentions/utils/reply":n,"mentions/utils/selectedText":z,"mentions/utils/textFormatter":o,"mentions/mentionables/MentionableModel":ct,"mentions/mentionables/formats/MentionFormat":ot,"mentions/extenders/Mentionables":class{constructor(){et(this,"formats",[]),et(this,"mentionables",{})}format(t){return this.formats.push(t),this}mentionable(t,e){return this.mentionables[t]||(this.mentionables[t]=[]),this.mentionables[t].push(e),this}extend(t){for(const e of this.formats)t.mentionFormats.extend(e);for(const e in this.mentionables){const n=t.mentionFormats.get(e);if(n)for(const t of this.mentionables[e])n.extend(t)}}}},ae=flarum.core;i().initializers.add("flarum-mentions",(function(){!function(){function t(){const t=this.attrs.post.contentHtml();if(t===this.oldPostContentHtml||this.isEditing())return;this.oldPostContentHtml=t;const e=this.attrs.post,n=this.$();this.$().on("click",".UserMention:not(.UserMention--deleted), .PostMention:not(.PostMention--deleted), .TagMention:not(.TagMention--deleted)",(function(t){m.route.set(this.getAttribute("href")),t.preventDefault()})),this.$(".PostMention:not(.PostMention--deleted)").each((function(){const t=$(this),o=t.data("id");let s;const r=$('
    '),e=new nt;(0,s.extend)(X().prototype,"oncreate",(function(){const n=this.$(".TextEditor-editor").wrap('
    ');this.navigator=new(Z()),this.navigator.when((()=>e.active)).onUp((()=>e.navigate(-1))).onDown((()=>e.navigate(1))).onSelect(e.complete.bind(e)).onCancel(e.hide.bind(e)).bindTo(n),n.after(t)})),(0,s.extend)(X().prototype,"buildEditorParams",(function(n){let o,s,r,a=new kt({onmouseenter:function(){e.setIndex($(this).parent().index())},onclick:t=>{this.attrs.composer.editor.replaceBeforeCursor(s-1,t+" "),e.hide()}});n.inputListeners.push((()=>{const n=this.attrs.composer.editor.getSelectionRange(),c=n[0];if(n[1]-c>0)return;const l=this.attrs.composer.editor.getLastNChars(30);s=0;let u=null;for(let t=l.length-1;t>=0;t--){const e=l.substr(t,1);if(u=i().mentionFormats.get(e),u&&(0===t||/\s/.test(l.substr(t-1,1)))){o=t+1,s=c-l.length+t+1,a.init(u.makeMentionables());break}}if(e.hide(),e.active=!1,s){var d;const n=l.substring(o).toLowerCase();if(r=u.queryFromTyped(n),!r)return;a.typed=r;const i=()=>{const n=a.buildSuggestions();if(n.length){e.items=n,m.render(t[0],e.render()),e.show();const o=this.attrs.composer.editor.getCaretCoordinates(s),r=e.$().outerWidth(),i=e.$().outerHeight(),a=e.$().offsetParent();let c=o.left,l=o.top+15;l+i>a.height()&&(l=o.top-i-15),c+r>a.width()&&(c=a.width()-r),l=Math.max(-(a.offset().top-$(document).scrollTop()),l),c=Math.max(-a.offset().left,c),e.show(c,l)}else e.active=!1,e.hide()};e.active=!0,i(),e.setIndex(0),e.$().scrollTop(0),null==(d=a.search())||d.then(i)}}))})),(0,s.extend)(X().prototype,"toolbarItems",(function(t){t.add("mention",m(K(),{onclick:()=>this.attrs.composer.editor.insertAtCursor(" @"),icon:"fas fa-at"},i().translator.trans("flarum-mentions.forum.composer.mention_tooltip")))}))}(),i().notificationComponents.postMentioned=Lt,i().notificationComponents.userMentioned=Rt,i().notificationComponents.groupMentioned=jt,(0,s.extend)(c().prototype,"notificationTypes",(function(t){t.add("postMentioned",{name:"postMentioned",icon:"fas fa-reply",label:i().translator.trans("flarum-mentions.forum.settings.notify_post_mentioned_label")}),t.add("userMentioned",{name:"userMentioned",icon:"fas fa-at",label:i().translator.trans("flarum-mentions.forum.settings.notify_user_mentioned_label")}),t.add("groupMentioned",{name:"groupMentioned",icon:"fas fa-at",label:i().translator.trans("flarum-mentions.forum.settings.notify_group_mentioned_label")})})),(0,s.extend)(Ut().prototype,"navItems",(function(t){const e=this.user;t.add("mentions",m(Et(),{href:i().route("user.mentions",{username:e.slug()}),name:"mentions",icon:"fas fa-at"},i().translator.trans("flarum-mentions.forum.user.mentions_link")),80)})),l.getPlainContent.removeSelectors.push("a.PostMention"),(0,s.extend)(p().prototype,"oncreate",(function(){this.$(".GroupMention--colored, .TagMention--colored").each((function(){this.classList.add(d()(getComputedStyle(this).getPropertyValue("--color")))}))}))})),Object.assign(ae.compat,ie)})(),module.exports=e})(); +(()=>{var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{"use strict";t.r(e),t.d(e,{extend:()=>Qt,filterGroupMentions:()=>te,filterPostMentions:()=>Yt,filterTagMentions:()=>ne,filterUserMentions:()=>Vt,postFilterGroupMentions:()=>ee,postFilterPostMentions:()=>Zt,postFilterTagMentions:()=>oe,postFilterUserMentions:()=>Xt});const n=flarum.reg.get("core","common/extend"),o=flarum.reg.get("core","forum/app");var s=t.n(o);const r=flarum.reg.get("core","common/utils/string"),i=flarum.reg.get("core","common/helpers/textContrastClass");var a=t.n(i);const u=flarum.reg.get("core","forum/components/Post");var l=t.n(u);const c=flarum.reg.get("core","forum/components/CommentPost");var d=t.n(c);const f=flarum.reg.get("core","forum/components/PostPreview");var p=t.n(f);const h=flarum.reg.get("core","common/components/LoadingIndicator");var g=t.n(h);const b=flarum.reg.get("core","common/components/Link");var y=t.n(b);const w=flarum.reg.get("core","common/helpers/punctuateSeries");var v=t.n(w);const M=flarum.reg.get("core","common/helpers/username");var x=t.n(M);const P=flarum.reg.get("core","common/components/Icon");var C=t.n(P);const A=flarum.reg.get("core","common/components/Button");var T=t.n(A);const B=flarum.reg.get("core","common/components/Modal");var D=t.n(B);const N=flarum.reg.get("core","common/states/PaginatedListState");var _=t.n(N);class S extends(_()){constructor(t,e){void 0===e&&(e=1),t.page={...t.page||{},limit:10},super(t,e,10)}get type(){return"posts"}}flarum.reg.add("flarum-mentions","forum/state/MentionedByModalState",S);const k=flarum.reg.get("core","common/components/Form");var F=t.n(k);class I extends(D()){oninit(t){super.oninit(t),this.state=new S({filter:{mentionedPost:this.attrs.post.id()},sort:"number"}),this.state.refresh()}className(){return"MentionedByModal"}title(){return s().translator.trans("flarum-mentions.forum.mentioned_by.title")}content(){return m("[",null,m("div",{className:"Modal-body"},this.state.isInitialLoading()?m(g(),null):m("[",null,m("ul",{className:"MentionedByModal-list Dropdown-menu Dropdown-menu--inline Post-mentionedBy-preview"},this.state.getPages().map((t=>t.items.map((t=>m("li",{"data-number":t.number()},m(p(),{post:t,onclick:()=>s().modal.close()}))))))))),this.state.hasNext()&&m("div",{className:"Modal-footer"},m(F(),{className:"Form--centered"},m("div",{className:"Form-group"},m(T(),{className:"Button Button--block",onclick:()=>this.state.loadNext(),loading:this.state.isLoadingNext()},s().translator.trans("flarum-mentions.forum.mentioned_by.load_more_button"))))))}}flarum.reg.add("flarum-mentions","forum/components/MentionedByModal",I);const R=flarum.reg.get("core","forum/utils/DiscussionControls");var L=t.n(R);function U(t,e,n){return new Promise((o=>{const r=s().mentionFormats.mentionable("post").replacement(t)+" ";e.fields.content()||(e.body.attrs.originalContent=r);const i=e.editor.getSelectionRange()[0],a=e.fields.content().slice(0,i),m=0==a.length?0:3-a.match(/(\n{0,2})$/)[0].length;return e.editor.insertAtCursor(Array(m).join("\n")+(n?"> "+r+n.trim().replace(/\n/g,"\n> ")+"\n\n":r),!1),o(e)}))}function j(t,e){const n=flarum.reg.checkModule("core","forum/components/EditPostComposer");return n&&s().composer.bodyMatches(n)&&s().composer.body.attrs.post.discussion()===t.discussion()?U(t,s().composer,e):L().replyAction.call(t.discussion()).then((n=>U(t,n,e)))}flarum.reg.add("flarum-mentions","forum/utils/reply",j);const E=flarum.reg.get("core","common/Fragment");var G=t.n(E);class H extends(G()){constructor(t){super(),this.post=t}view(){return m("button",{className:"Button PostQuoteButton",onclick:()=>{j(this.post,this.content)}},m(C(),{name:"fas fa-quote-left",className:"Button-icon"}),s().translator.trans("flarum-mentions.forum.post.quote_button"))}show(t,e){const n=this.$().show(),o=n.offsetParent().offset();n.css("left",t-o.left).css("top",e-o.top),this.hideHandler=this.hide.bind(this),$(document).on("mouseup",this.hideHandler)}showStart(t,e){const n=this.$();this.show(t,$(window).scrollTop()+e-n.outerHeight()-5)}showEnd(t,e){const n=this.$();this.show(t-n.outerWidth(),$(window).scrollTop()+e+5)}hide(){this.$().hide(),$(document).off("mouseup",this.hideHandler)}}function q(t){const e=window.getSelection();if(!e.isCollapsed){const n=e.getRangeAt(0),o=n.commonAncestorContainer;if(t[0]===o||$.contains(t[0],o)){const t=$("
    ").append(n.cloneContents());return t.find("img.emoji").replaceWith((function(){return this.alt})),t.find("img").replaceWith((function(){return`![](${this.src})`})),t.find("a").replaceWith((function(){return`[${this.innerText}](${this.href})`})),t.text()}}return""}flarum.reg.add("flarum-mentions","forum/fragments/PostQuoteButton",H),flarum.reg.add("flarum-mentions","forum/utils/selectedText",q);const W=flarum.reg.get("core","common/components/TextEditorButton");var O=t.n(W);const J=flarum.reg.get("core","common/utils/KeyboardNavigatable");var z=t.n(J);const K=flarum.reg.get("core","common/utils/AutocompleteReader");var Q=t.n(K);const V=flarum.reg.get("core","common/utils/throttleDebounce");function X(t){return X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},X(t)}function Y(t,e,n){return(e=function(t){var e=function(t){if("object"!=X(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=X(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==X(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Z extends(G()){constructor(){super(...arguments),Y(this,"items",[]),Y(this,"active",!1),Y(this,"index",0),Y(this,"keyWasJustPressed",!1)}view(){return m("ul",{className:"Dropdown-menu MentionsDropdown"},this.items.map((t=>m("li",null,t))))}show(t,e){this.$().show().css({left:t+"px",top:e+"px"}),this.active=!0}hide(){this.$().hide(),this.active=!1}navigate(t){this.keyWasJustPressed=!0,this.setIndex(this.index+t,!0),clearTimeout(this.keyWasJustPressedTimeout),this.keyWasJustPressedTimeout=setTimeout((()=>this.keyWasJustPressed=!1),500)}complete(){this.$("li").eq(this.index).find("button").click()}setIndex(t,e){if(this.keyWasJustPressed&&!e)return;const n=this.$(),o=n.find("li");let s=t;s<0?s=o.length-1:s>=o.length&&(s=0),this.index=s;const r=o.removeClass("active").eq(s).addClass("active");if(e){const t=n.scrollTop(),e=n.offset().top,o=e+n.outerHeight(),s=r.offset().top,i=s+r.outerHeight();let a;so&&(a=t-o+i+parseInt(n.css("padding-bottom"),10)),void 0!==a&&n.stop(!0).animate({scrollTop:a},100)}}}flarum.reg.add("flarum-mentions","forum/fragments/AutocompleteDropdown",Z);const tt=flarum.reg.get("core","common/Component");var et=t.n(tt);const nt=flarum.reg.get("core","common/utils/classList");var ot=t.n(nt);class st extends(et()){view(t){const{mentionable:e,...n}=this.attrs,o=ot()("MentionsDropdownItem","PostPreview",`MentionsDropdown-${e.type()}`);return m("button",Object.assign({className:o},n),m("span",{className:"PostPreview-content"},t.children))}}flarum.reg.add("flarum-mentions","forum/components/MentionsDropdownItem",st);class rt{constructor(t){Y(this,"mentionables",void 0),Y(this,"results",{}),Y(this,"typed",null),Y(this,"searched",[]),Y(this,"dropdownItemAttrs",{}),Y(this,"search",(async()=>{if(!this.typed||this.typed.length<=1)return;const t=this.typed.toLowerCase();if(!this.searched.includes(t)){for(const e of this.mentionables)for(const n of await e.search(t))this.results[e.type()].has(n.id())||this.results[e.type()].set(n.id(),n);return this.searched.push(t),Promise.resolve()}})),this.dropdownItemAttrs=t}init(t){this.typed=null,this.mentionables=t;for(const t of this.mentionables)this.results[t.type()]=new Map(t.initialResults().map((t=>[t.id(),t])))}matches(t,e){return t.matches(e,this.typed?.toLowerCase()||"")}makeSuggestion(t,e){const n=t.suggestion(e,this.typed),o=t.replacement(e),{onclick:s,...r}=this.dropdownItemAttrs;return m(st,Object.assign({mentionable:t,onclick:()=>s(o)},r),n)}buildSuggestions(){const t=[];for(const e of this.mentionables){if(!e.enabled())continue;let n=Array.from(this.results[e.type()].values()).filter((t=>this.matches(e,t)));const o=e.maxStoreMatchedResults();o&&(n=n.splice(0,o));for(const o of n){const n=this.makeSuggestion(e,o);t.push(n)}}return t}}flarum.reg.add("flarum-mentions","forum/mentionables/MentionableModels",rt);class it{constructor(){Y(this,"instances",void 0),Y(this,"mentionables",void 0),Y(this,"extendable",void 0)}makeMentionables(){return this.instances??(this.instances=this.mentionables.map((t=>new t(this))))}getMentionable(t){return this.makeMentionables().find((e=>e.type()===t))??null}extend(t){if(!this.extendable)throw new Error("This mention format does not allow extending.");this.mentionables.push(t)}}flarum.reg.add("flarum-mentions","forum/mentionables/formats/MentionFormat",it);const at=flarum.reg.get("core","common/components/Avatar");var mt=t.n(at);const ut=flarum.reg.get("core","common/helpers/highlight");var lt=t.n(ut);class ct{constructor(t){Y(this,"format",void 0),this.format=t}}flarum.reg.add("flarum-mentions","forum/mentionables/MentionableModel",ct);const dt=flarum.reg.get("core","common/utils/extractText");var ft=t.n(dt);const pt=()=>ft()(s().translator.trans("core.lib.username.deleted_text"));function ht(t,e){return void 0===e&&(e=!0),t?((e?t.displayName():t.username())||pt()).replace(/"#[a-z]{0,3}[0-9]+/,"_"):pt().replace(/"#[a-z]{0,3}[0-9]+/,"_")}flarum.reg.add("flarum-mentions","forum/utils/getCleanDisplayName",ht);class gt extends ct{type(){return"user"}initialResults(){return Array.from(s().store.all("users"))}replacement(t){if(s().forum.attribute("allowUsernameMentionFormat")){const e=ht(t,!1);return this.format.format(e)}const e=ht(t);return this.format.format(e,"",t.id())}suggestion(t,e){const n=x()(t,(t=>lt()(t,e)));return m("[",null,m(mt(),{user:t}),n)}matches(t,e){return!!e&&[t.username(),t.displayName()].some((t=>t.toLowerCase().substr(0,e.length)===e))}maxStoreMatchedResults(){return null}async search(t){return await s().store.find("users",{filter:{q:t},page:{limit:5}})}enabled(){return!0}}flarum.reg.add("flarum-mentions","forum/mentionables/UserMention",gt);class bt extends ct{type(){return"post"}initialResults(){const t=flarum.reg.checkModule("core","forum/components/EditPostComposer"),e=flarum.reg.checkModule("core","forum/components/ReplyComposer");if(!(e&&s().composer.bodyMatches(e)||t&&s().composer.bodyMatches(t)))return[];const n=s().composer.body.attrs,o=n.post;return(o&&o.discussion()||n.discussion).posts().filter((t=>t&&"comment"===t.contentType()&&(!o||t.number()e.createdAt().getTime()-t.createdAt().getTime()))}replacement(t){const e=ht(t.user());return this.format.format(e,"p",t.id())}suggestion(t,e){const n=t.user()||null,o=x()(n,(t=>lt()(t,e)));return m("[",null,m(mt(),{user:n}),o,[s().translator.trans("flarum-mentions.forum.composer.reply_to_post_text",{number:t.number()})," — ",(0,r.truncate)(t.contentPlain()??"",200)])}matches(t,e){const n=t.user(),o=s().mentionFormats.mentionable("user");return!e||n&&o.matches(n,e)}maxStoreMatchedResults(){return 5}search(t){return Promise.resolve([])}enabled(){return!0}}flarum.reg.add("flarum-mentions","forum/mentionables/PostMention",bt);const yt=flarum.reg.get("core","common/models/Group");var wt=t.n(yt);const vt=flarum.reg.get("core","common/components/Badge");var Mt=t.n(vt);class xt extends ct{type(){return"group"}initialResults(){return Array.from(s().store.all("groups").filter((t=>t.id()!==wt().GUEST_ID&&t.id()!==wt().MEMBER_ID)))}replacement(t){return this.format.format(t.namePlural(),"g",t.id())}suggestion(t,e){let n=t.namePlural();return e&&(n=lt()(n,e)),m("[",null,m(Mt(),{className:`Avatar Badge Badge--group--${t.id()} Badge-icon`,color:t.color(),type:"group",icon:t.icon()}),m("span",{className:"username"},n))}matches(t,e){return!!e&&[t.namePlural().toLowerCase(),t.nameSingular().toLowerCase()].some((t=>t.toLowerCase().substr(0,e.length)===e))}maxStoreMatchedResults(){return null}search(t){return Promise.resolve([])}enabled(){return s().session?.user?.canMentionGroups()??!1}}flarum.reg.add("flarum-mentions","forum/mentionables/GroupMention",xt);class Pt extends it{constructor(){super(...arguments),Y(this,"mentionables",[gt,bt,xt]),Y(this,"extendable",!0)}trigger(){return"@"}queryFromTyped(t){const e=t.match(/^["“]?((?:(?!"#).)+)$/);return e?e[1]:null}format(t,e,n){return void 0===e&&(e=""),void 0===n&&(n=null),{simple:`@${t}`,safe:`@"${t}"#${e}${n}`}[n?"safe":"simple"]}}flarum.reg.add("flarum-mentions","forum/mentionables/formats/AtMentionFormat",Pt);class $t extends ct{type(){return"tag"}initialResults(){return Array.from(s().store.all("tags"))}replacement(t){return this.format.format(t.slug())}matches(t,e){return!!e&&[t.name().toLowerCase()].some((t=>t.toLowerCase().substr(0,e.length)===e))}maxStoreMatchedResults(){return null}async search(t){return await s().store.find("tags",{filter:{q:t},page:{limit:5}})}suggestion(t,e){let n=t.name();return e&&(n=lt()(n,e)),m("[",null,m(Mt(),{className:"Avatar",icon:t.icon(),color:t.color(),type:"tag"}),m("span",{className:"username"},n))}enabled(){return"flarum-tags"in flarum.extensions}}flarum.reg.add("flarum-mentions","forum/mentionables/TagMention",$t);class Ct extends it{constructor(){super(...arguments),Y(this,"mentionables",[$t]),Y(this,"extendable",!0)}trigger(){return"#"}queryFromTyped(t){const e=t.match(/^[-_\p{L}\p{N}\p{M}]+$/giu);return e?e[0]:null}format(t){return`#${t}`}}flarum.reg.add("flarum-mentions","forum/mentionables/formats/HashMentionFormat",Ct);class At{constructor(){Y(this,"formats",[new Pt,new Ct])}get(t){return this.formats.find((e=>e.trigger()===t))??null}mentionable(t){for(const e of this.formats){const n=e.getMentionable(t);if(n)return n}return null}extend(t){this.formats.push(new t)}}flarum.reg.add("flarum-mentions","forum/mentionables/formats/MentionFormats",At);const Tt=flarum.reg.get("core","forum/components/UserPage");var Bt=t.n(Tt);const Dt=flarum.reg.get("core","common/components/LinkButton");var Nt=t.n(Dt);const _t=flarum.reg.get("core","common/extenders");var St=t.n(_t);const kt=flarum.reg.get("core","common/models/Post");var Ft=t.n(kt);const It=flarum.reg.get("core","common/models/User");var Rt=t.n(It);const Lt=flarum.reg.get("core","forum/components/PostsUserPage");var Ut=t.n(Lt);class jt extends(Ut()){params(t){return{filter:{type:"comment",mentioned:t.id()}}}}flarum.reg.add("flarum-mentions","forum/components/MentionsUserPage",jt);const Et=flarum.reg.get("core","forum/components/Notification");var Gt=t.n(Et);class Ht extends(Gt()){icon(){return"fas fa-reply"}href(){const t=this.attrs.notification,e=t.subject(),n=t.content();return s().route.discussion(e.discussion(),n&&n.replyNumber)}content(){const t=this.attrs.notification.fromUser();return s().translator.trans("flarum-mentions.forum.notifications.post_mentioned_text",{user:t,count:1})}excerpt(){return(0,r.truncate)(this.attrs.notification.subject().contentPlain()||"",200)}}flarum.reg.add("flarum-mentions","forum/components/PostMentionedNotification",Ht);class qt extends(Gt()){icon(){return"fas fa-at"}href(){const t=this.attrs.notification.subject();return s().route.discussion(t.discussion(),t.number())}content(){const t=this.attrs.notification.fromUser();return s().translator.trans("flarum-mentions.forum.notifications.user_mentioned_text",{user:t})}excerpt(){return(0,r.truncate)(this.attrs.notification.subject().contentPlain(),200)}}flarum.reg.add("flarum-mentions","forum/components/UserMentionedNotification",qt);class Wt extends(Gt()){icon(){return"fas fa-at"}href(){const t=this.attrs.notification.subject();return s().route.discussion(t.discussion(),t.number())}content(){const t=this.attrs.notification.fromUser();return s().translator.trans("flarum-mentions.forum.notifications.group_mentioned_text",{user:t})}excerpt(){return(0,r.truncate)(this.attrs.notification.subject().contentPlain(),200)}}flarum.reg.add("flarum-mentions","forum/components/GroupMentionedNotification",Wt);const Ot=flarum.reg.get("core","common/query/IGambit"),Jt=flarum.reg.get("core","common/app");var zt=t.n(Jt);class Kt extends Ot.KeyValueGambit{key(){return zt().translator.trans("flarum-mentions.lib.gambits.posts.mentioned.key",{},!0)}hint(){return zt().translator.trans("flarum-mentions.lib.gambits.posts.mentioned.hint",{},!0)}filterKey(){return"mentioned"}}flarum.reg.add("flarum-mentions","common/query/posts/MentionedGambit",Kt);const Qt=[(new(St().Search)).gambit("posts",Kt),(new(St().Routes)).add("user.mentions","/u/:username/mentions",jt),new(St().Model)(Ft()).hasMany("mentionedBy").attribute("mentionedByCount"),(new(St().Notification)).add("postMentioned",Ht).add("userMentioned",qt).add("groupMentioned",Wt),new(St().Model)(Rt()).attribute("canMentionGroups")];function Vt(t){let e;if(s().forum.attribute("allowUsernameMentionFormat")&&t.hasAttribute("username")?e=s().store.getBy("users","username",t.getAttribute("username")):t.hasAttribute("id")&&(e=s().store.getById("users",t.getAttribute("id"))),e)return t.setAttribute("id",e.id()),t.setAttribute("slug",e.slug()),t.setAttribute("displayname",ft()(x()(e))),!0;t.invalidate()}function Xt(t){t.setAttribute("deleted",!1)}function Yt(t){const e=s().store.getById("posts",t.getAttribute("id"));if(e)return t.setAttribute("discussionid",e.discussion().id()),t.setAttribute("number",e.number()),t.setAttribute("displayname",ft()(x()(e.user()))),!0}function Zt(t){t.setAttribute("deleted",!1)}function te(t){if(s().session?.user?.canMentionGroups()){const e=s().store.getById("groups",t.getAttribute("id"));if(e)return t.setAttribute("groupname",ft()(e.namePlural())),!0}t.invalidate()}function ee(t){if(s().session?.user?.canMentionGroups()){const e=s().store.getById("groups",t.getAttribute("id"));t.setAttribute("color",e.color()),t.setAttribute("icon",e.icon()),t.setAttribute("deleted",!1)}}function ne(t){if("flarum-tags"in flarum.extensions){const e=s().store.getBy("tags","slug",t.getAttribute("slug"));if(e)return t.setAttribute("id",e.id()),t.setAttribute("tagname",e.name()),!0}t.invalidate()}function oe(t){if("flarum-tags"in flarum.extensions){const e=s().store.getBy("tags","slug",t.getAttribute("slug"));t.setAttribute("icon",e.icon()),t.setAttribute("color",e.color()),t.setAttribute("deleted",!1)}}flarum.reg.add("flarum-mentions","forum/utils/textFormatter",{filterUserMentions:Vt,postFilterUserMentions:Xt,filterPostMentions:Yt,postFilterPostMentions:Zt,filterGroupMentions:te,postFilterGroupMentions:ee,filterTagMentions:ne,postFilterTagMentions:oe}),flarum.reg.add("flarum-mentions","forum/extenders/Mentionables",class{constructor(){Y(this,"formats",[]),Y(this,"mentionables",{})}format(t){return this.formats.push(t),this}mentionable(t,e){return this.mentionables[t]||(this.mentionables[t]=[]),this.mentionables[t].push(e),this}extend(t){for(const e of this.formats)t.mentionFormats.extend(e);for(const e in this.mentionables){const n=t.mentionFormats.get(e);if(n)for(const t of this.mentionables[e])n.extend(t)}}}),s().mentionFormats=new At,s().initializers.add("flarum-mentions",(()=>{!function(){function t(){const t=this.attrs.post.contentHtml();if(t===this.oldPostContentHtml||this.isEditing())return;this.oldPostContentHtml=t;const e=this.attrs.post,n=this.$();this.$().on("click",".UserMention:not(.UserMention--deleted), .PostMention:not(.PostMention--deleted), .TagMention:not(.TagMention--deleted)",(function(t){m.route.set(this.getAttribute("href")),t.preventDefault()})),this.$(".PostMention:not(.PostMention--deleted)").each((function(){const t=$(this),o=t.data("id");let s;const r=$('