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

224 lines
8.9 KiB
TypeScript

/* Metro module 13115; source: modules/keyboard/native/KeyCommandsView.tsx; dependencies: [57, 31, 33, 4501, 13116, 2] */
function _fun100223(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#100223, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:6, offset: 0x021e1b0b, size: 278 bytes, params: 8, frame: 21
const _arrayLikeToArray_100226 = 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_2 = importDefault(57) /* metro dependency 57 */;
let value = importAll(31) /* metro dependency 31 */;
const env0_4 = (require(33) /* metro dependency 33 */).jsx;
const env0_5 = (require(4501) /* metro dependency 4501: createStyles */).createStyles({viewDefaults: {flex: 1}});
const env0_6 = value.createContext({keyCommands: [], addKeyCommand: function() {
}, removeKeyCommand: function() {
}});
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/keyboard/native/KeyCommandsView.tsx');
exports.default = KeyCommandsView;
exports.useKeyCommands = useKeyCommands;
}
function _createForOfIteratorHelperLoose_100224(a0, a1) { // fn#100224, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:136, offset: 0x021e1c21, size: 372 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 _fun100225;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_100226(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_100226(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_100226(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun100225;
}
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 KeyCommandsView(a0) { // fn#100229, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1263, offset: 0x021e1d95, size: 304 bytes, params: 2, frame: 23
const style = a0.style;
const value = Object.create(null);
value.style = 0;
const value2 = copyDataProperties({}, a0, value, undefined);
const styles = useStyles();
const binding = env0_3;
const [property, env0_1] = env0_2(binding.useState([]), 2);
const value8 = binding.useMemo(_fun100235, [property, binding.useCallback(_fun100230, []),
binding.useCallback(_fun100232, [])]);
const Provider = env0_6.Provider;
return (
<Provider value={value8}>
{((Component) => <Component {...value2} {...{['style']: [styles.viewDefaults,
style]}} {...{['keyCommands']: property}} {...{['onKeyCommand']: KeyCommandsViewOnKeyCommand}} />)(importDefault(13116) /* metro dependency 13116: KeyCommandsNativeComponent */)}
</Provider>
);
}
function useKeyCommands(a0) { // fn#100238, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1768, offset: 0x021e1fae, size: 89 bytes, params: 2, frame: 16
const env0_0 = a0;
const binding = env0_3;
const value = binding.useContext(env0_6);
binding.useEffect(_fun100239, [value.addKeyCommand, value.removeKeyCommand, a0]);
}
function _fun100230(a0) { // fn#100230, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1371, offset: 0x021e1ec5, size: 32 bytes, params: 2, frame: 11
const env0_0 = a0;
env0_1(_fun100231);
}
function _fun100232(a0) { // fn#100232, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1415, offset: 0x021e1ee5, size: 32 bytes, params: 2, frame: 11
const env0_0 = a0;
env0_1(function(a0) {
return a0.filter(_fun100234);
});
}
function _fun100235() { // fn#100235, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1477, offset: 0x021e1f33, size: 34 bytes, params: 1, frame: 3
return {keyCommands: env0_0, addKeyCommand: env0_2, removeKeyCommand: env0_3};
}
function KeyCommandsViewOnKeyCommand({nativeEvent}) { // fn#100236, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1650, owner: KeyCommandsView.onKeyCommand, offset: 0x021e1f55, size: 61 bytes, params: 2, frame: 12
const value = nativeEvent.find(function({eventName}) {
return eventName === nativeEvent.eventName;
});
if (value != null) {
value.onKeyCommand(nativeEvent);
}
}
function _fun100239() { // fn#100239, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1869, offset: 0x021e2007, size: 73 bytes, params: 1, frame: 14
var r1;
var value4;
var value5;
const value2 = _createForOfIteratorHelperLoose_100224(env0_0);
const value3 = value2();
let done = value3.done;
if (!done) {
for (r1 = value3; true; r1 = value5) {
value4 = r1.value;
addKeyCommand(value4);
value5 = value2();
done = value5.done;
if (done) {
break;
}
}
}
return _fun100240;
}
function _fun100233(a0) { // fn#100233, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1422, offset: 0x021e1f05, size: 24 bytes, params: 2, frame: 11
return a0.filter(_fun100234);
}
function _fun100240() { // fn#100240, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1962, offset: 0x021e2050, size: 70 bytes, params: 1, frame: 14
var r2;
var value4;
var removeKeyCommandBinding;
var eventName;
var value5;
const value2 = _createForOfIteratorHelperLoose_100224(env1_0);
const value3 = value2();
let done = value3.done;
if (!done) {
for (r2 = value3; true; r2 = value5) {
value4 = r2.value;
removeKeyCommandBinding = removeKeyCommand;
eventName = value4.eventName;
removeKeyCommandBinding(eventName);
value5 = value2();
done = value5.done;
if (done) {
break;
}
}
}
}
function _fun100234({eventName}) { // fn#100234, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1435, offset: 0x021e1f1d, size: 22 bytes, params: 2, frame: 2
return eventName !== env1_0;
}