Files
discord-decomp/sources/modules/a11y/native/AccessibilityFocusLockManager.tsx
T
2026-07-27 16:20:00 +03:00

388 lines
15 KiB
TypeScript

/* Metro module 4558; source: modules/a11y/native/AccessibilityFocusLockManager.tsx; dependencies: [6, 7, 15, 17, 18, 27, 3, 4559, 477, 4560, 4561, 2] */
function _fun38752(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#38752, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4736:6, offset: 0x010c96de, size: 308 bytes, params: 8, frame: 19
const env0_0 = require;
const _arrayLikeToArray_38755 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(6) /* metro dependency 6 */;
const env0_4 = importDefault(7) /* metro dependency 7 */;
const env0_5 = importDefault(15) /* metro dependency 15 */;
const env0_6 = importDefault(17) /* metro dependency 17 */;
const env0_7 = importDefault(18) /* metro dependency 18 */;
const env0_8 = (require(27) /* metro dependency 27 */).NativeModules;
let value = importDefault(3) /* metro dependency 3: Logger */;
value = new value('AccessibilityFocusLockManager');
value = importDefault(4561) /* metro dependency 4561: LifecycleManager */;
value = _fun38759(value);
value = new value();
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/a11y/native/AccessibilityFocusLockManager.tsx');
exports.default = value;
}
function _createForOfIteratorHelperLoose_38753(a0, a1) { // fn#38753, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4736:175, offset: 0x010c9812, size: 370 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun38754;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_38755(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_38755(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_38755(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun38754;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
}
function _isNativeReflectConstruct_38756() { // fn#38756, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4736:1085, offset: 0x010c9984, size: 94 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_38756_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun38759(a0) { // fn#38759, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4736:1336, offset: 0x010c99e2, size: 164 bytes, params: 2, frame: 16
const closure = AccessibilityFocusLockManager;
env0_7(closure, a0);
return env0_4(closure, [{key: '_updateAccessibilityFocusLock', value: value_38761}, {key: '_initialize',
value: value_38763}, {key: '_terminate', value: function() {
var property = this._screenReaderEnabledListener;
if (property != null) {
property.call(this);
}
this._focusLockedNativeIDGroups.clear();
this._updateAccessibilityFocusLock();
}}, {key: 'enableAccessibilityFocusLock', value: value_38766}, {key: 'disableAccessibilityFocusLock',
value: value_38767}]);
}
function AccessibilityFocusLockManager(a0) { // fn#38760, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4736:1348, offset: 0x010c9a86, size: 225 bytes, params: 2, frame: 20
var r0;
var Reflect;
let value = copyRestArgs(0, undefined);
let binding = env1_3;
binding(this, AccessibilityFocusLockManager);
const items2 = [];
arraySpread(items2, value, 0, items2);
value = env1_6(AccessibilityFocusLockManager);
binding = env1_5;
if (_isNativeReflectConstruct_38756()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items2, env1_6(this).constructor);
r0 = value;
} else {
value = value.apply(this, items2);
r0 = value;
}
value = binding(this, r0);
value._screenReaderEnabled = (require(4559) /* metro dependency 4559: useIsScreenReaderEnabledNative */).getIsScreenReaderEnabled();
const Map = global.Map;
const value4 = Object.create(Map.prototype, {constructor: {value: Map}});
const map = new Map();
value._focusLockedNativeIDGroups = map instanceof Object ? map : value4;
value._focusLockEnabled = false;
value._focusLockEnabledDelayTimeoutId = -1;
value._focusLockEnabledDelayTimeout = 250;
return value;
}
function value_38761() { // fn#38761, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4736:1933, offset: 0x010c9b67, size: 279 bytes, params: 1, frame: 20
var environment;
var r3;
var r7;
var r6;
var value5;
var value6;
var _screenReaderEnabled;
var _focusLockEnabled;
var moduleValue;
var isAndroid;
var DCDAccessibilityManager;
var disableFocusLock;
var setTimeout;
var _focusLockEnabledDelayTimeout;
let value = a0;
const value2 = undefined;
reducibleJoin2: while (true) {
if (value !== value2) {
r3 = value;
break reducibleJoin2;
}
value = false;
r3 = value;
break reducibleJoin2;
}
var env0_1;
global.clearTimeout(this._focusLockEnabledDelayTimeoutId);
value = environment.__proto__;
const _createForOfIteratorHelperLoose_38753Binding = _createForOfIteratorHelperLoose_38753;
const _focusLockedNativeIDGroups = this._focusLockedNativeIDGroups;
const value3 = _createForOfIteratorHelperLoose_38753Binding(_focusLockedNativeIDGroups.values());
const value4 = value3();
let done = value4.done;
if (done) {
r6 = value2;
} else {
r7 = value4;
reducibleLoop3: while (true) {
value5 = r7.value;
env0_1 = value5;
value6 = value3();
done = value6.done;
if (done) {
r6 = value5;
break reducibleLoop3;
}
r7 = value6;
continue reducibleLoop3;
}
}
reducibleJoin12: while (true) {
reducibleJoin6: while (true) {
if (r6 == null) {
break reducibleJoin6;
}
_screenReaderEnabled = this._screenReaderEnabled;
if (_screenReaderEnabled) {
setTimeout = global.setTimeout;
_focusLockEnabledDelayTimeout = this._focusLockEnabledDelayTimeout;
this._focusLockEnabledDelayTimeoutId = setTimeout(_fun38762, _focusLockEnabledDelayTimeout);
this._focusLockEnabled = true;
break reducibleJoin12;
}
break reducibleJoin6;
}
_focusLockEnabled = this._focusLockEnabled;
if (_focusLockEnabled) {
moduleValue = require(477) /* metro dependency 477: PlatformUtils */;
isAndroid = moduleValue.isAndroid;
if (Reflect.apply(isAndroid, moduleValue, [])) {
value = importDefault(4560) /* metro dependency 4560: NativeDeviceAccessibilityModule */;
disableFocusLock = value.disableFocusLock;
Reflect.apply(disableFocusLock, value, []);
} else {
DCDAccessibilityManager = NativeModules.DCDAccessibilityManager;
disableFocusLock = DCDAccessibilityManager.disableFocusLock;
Reflect.apply(disableFocusLock, DCDAccessibilityManager, []);
}
this._focusLockEnabled = false;
break reducibleJoin12;
}
break reducibleJoin12;
}
return value2;
}
function value_38763() { // fn#38763, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4736:2543, offset: 0x010c9cf4, size: 58 bytes, params: 1, frame: 13
var environment;
let value = environment.__proto__;
value = require(4559) /* metro dependency 4559: useIsScreenReaderEnabledNative */;
this._screenReaderEnabledListener = value.addScreenReaderEnabledListener(_fun38764);
}
function value_38766(a0) { // fn#38766, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4736:2923, offset: 0x010c9d83, size: 244 bytes, params: 2, frame: 26
var r6;
var r12;
var value;
var binding;
var value5;
var value6;
var value7;
var value8;
var includes;
var value9;
var value10;
if (a0.length === 0) {
value = environment.__proto__;
binding = env1_9;
binding.error('No target view nativeIDs to add.');
}
const value3 = _createForOfIteratorHelperLoose_38753(this._focusLockedNativeIDGroups.values());
const value4 = value3();
let done = value4.done;
if (!done) {
r6 = value4;
while (true) {
_createForOfIteratorHelperLoose_38753Binding = _createForOfIteratorHelperLoose_38753;
value5 = r6.value;
value6 = _createForOfIteratorHelperLoose_38753Binding(value5);
value7 = value6();
done = value7.done;
if (!done) {
r12 = value7;
while (true) {
value8 = r12.value;
includes = a0.includes;
if (Reflect.apply(includes, a0, [value8])) {
binding = env1_9;
binding.error('Duplicate target view nativeID ' + value8 + ' already accessibility focus locked.');
}
value9 = value6();
done = value9.done;
if (done) {
break;
}
r12 = value9;
continue;
}
}
value10 = value3();
done = value10.done;
if (done) {
break;
}
r6 = value10;
continue;
}
}
this._focusLockedNativeIDGroups.set(a0[0], a0);
this._updateAccessibilityFocusLock(true);
}
function value_38767(a0) { // fn#38767, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4736:3403, offset: 0x010c9e77, size: 149 bytes, params: 2, frame: 18
var value;
var binding;
if (a0.length === 0) {
value = environment.__proto__;
env1_9.error('No target view nativeIDs to remove.');
}
const _focusLockedNativeIDGroups = this._focusLockedNativeIDGroups;
if (!_focusLockedNativeIDGroups.has(a0[0])) {
value = environment.__proto__;
binding = env1_9;
binding.error('No target view nativeID ' + a0[0] + ' accessibility focus locked.');
}
this._focusLockedNativeIDGroups.delete(a0[0]);
this._updateAccessibilityFocusLock();
}
function _fun38762() { // fn#38762, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4736:2204, offset: 0x010c9c7e, size: 118 bytes, params: 1, frame: 15
var DCDAccessibilityManager;
var defaultImport;
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
if (platformUtilsModule.isAndroid()) {
defaultImport = importDefault(4560) /* metro dependency 4560: NativeDeviceAccessibilityModule */;
defaultImport.enableFocusLock(value, env0_0);
} else {
DCDAccessibilityManager = NativeModules.DCDAccessibilityManager;
DCDAccessibilityManager.enableFocusLock(value, env0_0);
}
}
function _fun38764(a0) { // fn#38764, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4736:2629, offset: 0x010c9d2e, size: 30 bytes, params: 2, frame: 9
const binding = env0_0;
binding._screenReaderEnabled = a0;
binding._updateAccessibilityFocusLock();
}