Files
discord-decomp/sources/utils/SpellcheckUtils.tsx
T
2026-07-28 01:06:53 +03:00

224 lines
10 KiB
TypeScript

/* Metro module 6726; source: utils/SpellcheckUtils.tsx; dependencies: [5, 3767, 477, 6727, 2] */
import Module00005 from '../by-id/module-00005.js'; /* Metro dependency 5 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
function _fun52801(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#52801, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6904:6, offset: 0x01337af8, size: 315 bytes, params: 8, frame: 20
const env0_0 = require;
const isElectronBuiltInSpellcheckerSupported = function() {
return importDefault(dependencyMap[1])?.spellCheck != null;
};
const isSupported_528032 = isSupported_52803;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = isSupported_528032();
if (value) {
value = require(6727) /* metro dependency 6727: Spellchecker */;
value = value.install();
}
(FileImportTrackerModule).fileFinishedImporting('utils/SpellcheckUtils.tsx');
exports.isSupported = isSupported_528032;
exports.setEnabled = function() {
return _setEnabled.apply(this, arguments);
};
exports.setLearnedWords = function() {
return _setLearnedWords.apply(this, arguments);
};
exports.isMisspelled = function() {
return _isMisspelled.apply(this, arguments);
};
exports.getCorrections = function() {
return _getCorrections.apply(this, arguments);
};
exports.getCachedMisspelling = function() {
return _getCachedMisspelling.apply(this, arguments);
};
exports.replaceWithCorrection = function() {
return _replaceWithCorrection.apply(this, arguments);
};
exports.setAppLocale = function() {
return _setAppLocale_52822.apply(this, arguments);
};
exports.addResultListener = addResultListener;
function isSupported_52803() { // fn#52803, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6904:211, offset: 0x01337c74, size: 48 bytes, params: 1, frame: 12
return (require(477) /* metro dependency 477: PlatformUtils */).isDesktop() && isElectronBuiltInSpellcheckerSupported();
}
function _setEnabled() { // fn#52804, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6904:346, offset: 0x01337ca4, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun52806).apply(this, arguments);
function* _fun52806(a0) { // fn#52806, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6904:391, offset: 0x01337cdd, size: 50 bytes, params: 2, frame: 3
if (true) {
value = environment.__proto__.__proto__;
yield env2_4;
value = undefined;
if (false) {
return value;
}
if (value != null) {
value.enabled = a0;
}
}
}
}
function _setLearnedWords() { // fn#52807, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6904:467, offset: 0x01337d0f, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun52809).apply(this, arguments);
function* _fun52809(a0) { // fn#52809, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6904:522, offset: 0x01337d48, size: 55 bytes, params: 2, frame: 12
if (true) {
value = environment.__proto__.__proto__;
yield env2_4;
value = undefined;
if (false) {
return value;
}
if (value != null) {
value.setLearnedWords(a0);
}
}
}
}
function _isMisspelled() { // fn#52810, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6904:605, offset: 0x01337d7f, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun52812).apply(this, arguments);
async function _fun52812(a0) { // fn#52812, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6904:654, offset: 0x01337dc1, size: 81 bytes, params: 2, frame: 16
var r3;
let value = a1;
if (false) {
return undefined;
}
const r6 = value !== undefined ? value : false;
await undefined;
if (false) {
return undefined;
}
value = environment.__proto__.__proto__;
await env2_4;
value = undefined;
if (false) {
return value;
}
const value6 = value != null;
if (value6) {
value = value.isMisspelled(a0, r6);
r3 = value;
} else {
r3 = value6;
}
return r3;
}
}
function _getCorrections() { // fn#52813, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6904:748, offset: 0x01337e12, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun52815).apply(this, arguments);
async function _fun52815(a0) { // fn#52815, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6904:801, offset: 0x01337e54, size: 109 bytes, params: 2, frame: 16
var r3;
let value = a1;
const value2 = a2;
if (false) {
return undefined;
}
const r5 = value !== undefined ? value : false;
const r6 = value2 !== undefined ? value2 : 5;
await undefined;
if (false) {
return undefined;
}
value = environment.__proto__.__proto__;
await env2_4;
if (false) {
return undefined;
}
if (value == null) {
r3 = [];
} else {
value = value.getCorrectionsForMisspelling(a0, r5);
value = value.slice(0, r6);
r3 = value;
}
return r3;
}
}
function _getCachedMisspelling() { // fn#52816, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6904:928, offset: 0x01337ec1, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun52818).apply(this, arguments);
async function _fun52818() { // fn#52818, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6904:993, offset: 0x01337f03, size: 134 bytes, params: 1, frame: 17
let value = a0;
if (false) {
return undefined;
}
const r7 = value !== undefined ? value : 5;
await undefined;
if (false) {
return undefined;
}
value = environment.__proto__.__proto__;
await env2_4;
value = undefined;
if (false) {
return value;
}
if (value == null) {
return {misspelledWord: '', corrections: []};
}
value = value.getCachedMisspelling();
const object = {};
object.misspelledWord = value.misspelledWord;
object.corrections = value.corrections.slice(0, r7);
return object;
}
}
function _replaceWithCorrection() { // fn#52819, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6904:1208, offset: 0x01337f89, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun52821).apply(this, arguments);
function* _fun52821(a0) { // fn#52821, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6904:1275, offset: 0x01337fc2, size: 55 bytes, params: 2, frame: 12
if (true) {
value = environment.__proto__.__proto__;
yield env2_4;
value = undefined;
if (false) {
return value;
}
if (value != null) {
value.replaceMisspelling(a0);
}
}
}
}
function _setAppLocale_52822() { // fn#52822, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6904:1361, offset: 0x01337ff9, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun52824).apply(this, arguments);
function* _fun52824(a0) { // fn#52824, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6904:1410, offset: 0x01338032, size: 55 bytes, params: 2, frame: 12
if (true) {
value = environment.__proto__.__proto__;
yield env2_4;
value = undefined;
if (false) {
return value;
}
if (value != null) {
value.setAppLocale(a0);
}
}
}
}
function addResultListener(a0) { // fn#52832, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6904:2236, offset: 0x01338069, size: 85 bytes, params: 2, frame: 14
if (isElectronBuiltInSpellcheckerSupported()) {
return (importDefault(3767) /* metro dependency 3767: DiscordNative */).spellCheck.on('spellcheck-result',
a0) ?? (function() {
});
}
return function() {
};
}
}
global.__d(_fun52801, 6726, [5, 3767, 477, 6727, 2]) /* metro module 6726, dependencies: [5, 3767, 477, 6727, 2] */;