208 lines
9.1 KiB
TypeScript
208 lines
9.1 KiB
TypeScript
/* Metro module 4015; source: utils/native/ChatInputUtils.tsx; dependencies: [4016, 1848, 4022, 1583, 1482, 4023, 2] */
|
|
function _fun33058(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#33058, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4173:6, offset: 0x01026bbc, size: 226 bytes, params: 8, frame: 21
|
|
let env0_0 = require;
|
|
const closure = getHighestActiveScreenIndex;
|
|
const closure2 = getBestActiveInput;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let Map = global.Map;
|
|
let map = new Map();
|
|
Map = global.Map;
|
|
map = new Map();
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('utils/native/ChatInputUtils.tsx');
|
|
exports.createInputRefTracker = function(a0, a1) {
|
|
var env0_0 = a1;
|
|
var env0_3 = _fun33064;
|
|
var env0_4 = _fun33065;
|
|
var env0_1 = null;
|
|
var env0_2 = {current: a0};
|
|
return {handleRef: _fun33066, register: _fun33067, unregister: _fun33068};
|
|
};
|
|
exports.getHighestActiveScreenIndex = closure;
|
|
exports.getChatInputRef = getChatInputRef;
|
|
exports.getBestActiveInputForChannelId = getBestActiveInputForChannelId;
|
|
exports.getBestActiveInput = closure2;
|
|
exports.dismissKeyboard = dismissKeyboard_33071;
|
|
}
|
|
|
|
function getHighestActiveScreenIndex() { // fn#33059, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4173:116, offset: 0x01026c9e, size: 190 bytes, params: 1, frame: 20
|
|
var Math;
|
|
var max;
|
|
var items2;
|
|
let value = a0;
|
|
const r9 = value !== undefined ? value : env0_3;
|
|
if (r9.size !== 0) {
|
|
var has = r9.has;
|
|
if (Reflect.apply(has, r9, ['voice-panel'])) {
|
|
return 'voice-panel';
|
|
}
|
|
has = r9.has;
|
|
if (Reflect.apply(has, r9, ['message-request'])) {
|
|
return 'message-request';
|
|
}
|
|
has = r9.has;
|
|
if (Reflect.apply(has, r9, ['new-message'])) {
|
|
return 'new-message';
|
|
}
|
|
var Array = global.Array;
|
|
value = Array.from(r9.keys());
|
|
value = value.filter(_fun33060);
|
|
if (value.length !== 0) {
|
|
Math = global.Math;
|
|
max = Math.max;
|
|
items2 = [];
|
|
arraySpread(items2, value, 0, r9);
|
|
return apply(max, items2, Math, r9);
|
|
}
|
|
}
|
|
}
|
|
|
|
function getHighestIndexForScreenIndexMap(a0) { // fn#33061, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4173:444, offset: 0x01026d95, size: 37 bytes, params: 2, frame: 12
|
|
const highestActiveScreenIndex = getHighestActiveScreenIndex(a0);
|
|
if (highestActiveScreenIndex != null) {
|
|
return a0.get(highestActiveScreenIndex);
|
|
}
|
|
}
|
|
|
|
function getBestActiveInput() { // fn#33062, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4173:553, offset: 0x01026dba, size: 48 bytes, params: 1, frame: 13
|
|
const getHighestIndexForScreenIndexMapBinding = getHighestIndexForScreenIndexMap;
|
|
const value = undefined;
|
|
const highestIndexForScreenIndexMapBinding = getHighestIndexForScreenIndexMapBinding(env0_3);
|
|
return (highestIndexForScreenIndexMapBinding == null ? value : highestIndexForScreenIndexMapBinding.current) ?? value;
|
|
}
|
|
|
|
function createInputRefTracker(a0, a1) { // fn#33063, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4173:769, offset: 0x01026dea, size: 80 bytes, params: 3, frame: 3
|
|
const env0_0 = a1;
|
|
const object = {current: a0};
|
|
return {handleRef: handleRef, register: register_33067, unregister: unregister_33068};
|
|
}
|
|
|
|
function getChatInputRef(a0, a1) { // fn#33069, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4173:1426, offset: 0x01026ffa, size: 80 bytes, params: 3, frame: 14
|
|
var current;
|
|
var value;
|
|
var value2;
|
|
if (a0 != null) {
|
|
value = env0_2.get(a0);
|
|
value2 = undefined;
|
|
if (value == null) {
|
|
current = value2;
|
|
} else {
|
|
value = value.get(a1);
|
|
current = value == null ? value2 : value.current;
|
|
}
|
|
return current ?? value2;
|
|
}
|
|
}
|
|
|
|
function getBestActiveInputForChannelId(a0) { // fn#33070, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4173:1591, offset: 0x0102704a, size: 73 bytes, params: 2, frame: 13
|
|
var getHighestIndexForScreenIndexMapBinding;
|
|
var highestIndexForScreenIndexMapBinding;
|
|
if (a0 != null) {
|
|
var value;
|
|
var value2 = env0_2.get(a0);
|
|
if (value2 != null) {
|
|
getHighestIndexForScreenIndexMapBinding = getHighestIndexForScreenIndexMap;
|
|
value = undefined;
|
|
highestIndexForScreenIndexMapBinding = getHighestIndexForScreenIndexMapBinding(value2);
|
|
return (highestIndexForScreenIndexMapBinding == null ? value : highestIndexForScreenIndexMapBinding.current) ?? value;
|
|
}
|
|
}
|
|
}
|
|
|
|
function dismissKeyboard_33071() { // fn#33071, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4173:1829, offset: 0x01027093, size: 207 bytes, params: 1, frame: 16
|
|
(require(1848) /* metro dependency 1848: KeyboardManagerUtils */).dismissGlobalKeyboard();
|
|
const bestActiveInput = getBestActiveInput();
|
|
if (bestActiveInput != null) {
|
|
bestActiveInput.closeCustomKeyboard();
|
|
}
|
|
const keyboardType = (require(4022) /* metro dependency 4022: useKeyboardType */).getKeyboardType();
|
|
const KeyboardTypes = (require(1583) /* metro dependency 1583: KeyboardTypes */).KeyboardTypes;
|
|
const SYSTEM = KeyboardTypes.SYSTEM;
|
|
if (keyboardType !== SYSTEM) {
|
|
(require(1482) /* metro dependency 1482: KeyboardUIStoreNative */).setKeyboardType({type: KeyboardTypes.SYSTEM});
|
|
}
|
|
(require(4023) /* metro dependency 4023: PortalKeyboardUIStoreNative */).closePortalKeyboardRequest();
|
|
}
|
|
|
|
function _fun33060(a0) { // fn#33060, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4173:348, offset: 0x01026d5c, size: 57 bytes, params: 2, frame: 13
|
|
var r0;
|
|
let value = typeof a0 === 'number';
|
|
if (value) {
|
|
value = environment.__proto__;
|
|
value = require(4016) /* metro dependency 4016: ScreenIndexFrozen */;
|
|
value = !value.isScreenIndexFrozen(a0);
|
|
r0 = value;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function addRef(a0, a1, a2) { // fn#33064, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4173:830, owner: createInputRefTracker.addRef, offset: 0x01026e3a, size: 149 bytes, params: 4, frame: 16
|
|
var r5;
|
|
var map;
|
|
const value2 = env1_2.get(a1);
|
|
if (value2 != null) {
|
|
r5 = value2;
|
|
} else {
|
|
map = new global.Map();
|
|
}
|
|
r5.set(a2, a0);
|
|
env1_2.set(a1, r5);
|
|
env1_3.set(a2, a0);
|
|
const DEVELOPMENT = global.process.env.DEVELOPMENT;
|
|
if (DEVELOPMENT === 'development') {
|
|
env1_3.has(a2);
|
|
}
|
|
}
|
|
|
|
function removeRef(a0, a1, a2) { // fn#33065, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4173:973, owner: createInputRefTracker.removeRef, offset: 0x01026ecf, size: 82 bytes, params: 4, frame: 13
|
|
const value2 = env1_2.get(a1);
|
|
if (value2 != null) {
|
|
value2.delete(a2);
|
|
if (value2.size === 0) {
|
|
env1_2.delete(a1);
|
|
}
|
|
env1_3.delete(a2);
|
|
}
|
|
}
|
|
|
|
function handleRef(a0, a1) { // fn#33066, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4173:1090, owner: createInputRefTracker.handleRef, offset: 0x01026f21, size: 111 bytes, params: 3, frame: 17
|
|
env0_2.current = a1;
|
|
if (a0 == null) {
|
|
if (env0_1 == null) {
|
|
return undefined;
|
|
}
|
|
removeRef(undefined, a1, require);
|
|
} else if (env0_1 == null) {
|
|
addRef({current: a0}, a1, require);
|
|
} else {
|
|
env0_1.current = a0;
|
|
}
|
|
}
|
|
|
|
function createInputRefTrackerRegister() { // fn#33067, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4173:1233, owner: createInputRefTracker.register, offset: 0x01026f90, size: 63 bytes, params: 1, frame: 16
|
|
var removeRefBinding;
|
|
var binding;
|
|
var current;
|
|
var addRefBinding;
|
|
var binding2;
|
|
if (env0_1 != null) {
|
|
removeRefBinding = removeRef;
|
|
binding = env0_2;
|
|
current = binding.current;
|
|
removeRefBinding(undefined, current, require);
|
|
addRefBinding = addRef;
|
|
binding2 = env0_1;
|
|
current = binding.current;
|
|
addRefBinding(binding2, current, require);
|
|
}
|
|
}
|
|
|
|
function createInputRefTrackerUnregister() { // fn#33068, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4173:1308, owner: createInputRefTracker.unregister, offset: 0x01026fcf, size: 43 bytes, params: 1, frame: 14
|
|
if (env0_1 != null) {
|
|
removeRef(undefined, env0_2.current, require);
|
|
}
|
|
}
|
|
|