decord/source/utils/native/ChatInputUtils.tsx

252 lines
7.2 KiB
TypeScript
Raw Normal View History

2026-09-01 10:26:29 +00:00
// Module ID: 4340
// Function ID: 4341
2026-07-29 08:29:29 +00:00
// Name: getBestActiveInput
2026-09-01 10:26:29 +00:00
// Dependencies: [4341, 1891, 4342, 1626, 1497, 4343, 2]
2026-07-29 08:29:29 +00:00
// Exports: createInputRefTracker, dismissKeyboard, getBestActiveInputForChannelId, getChatInputRef, getHighestActiveScreenIndex
2026-07-20 16:05:17 +00:00
2026-09-01 10:26:29 +00:00
// Module 4340 (getBestActiveInput)
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
2026-08-31 15:47:37 +00:00
import KeyboardTypes from "KeyboardTypes" /* 1626 */;
import dismissGlobalKeyboard from "dismissGlobalKeyboard" /* 1891 */;
2026-09-01 10:26:29 +00:00
import zustandStore from "zustandStore" /* 4343 */;
2026-08-24 06:08:38 +00:00
2026-07-29 08:29:29 +00:00
function getBestActiveInput() {
let str;
if (0 !== map1.size) {
str = "voice-panel";
if (!obj.has("voice-panel")) {
str = "message-request";
if (!obj.has("message-request")) {
str = "new-message";
if (!obj.has("new-message")) {
const _Array = Array;
2026-08-04 21:03:28 +00:00
const found = Array.from(obj.keys()).filter((num) => {
let tmp = typeof num === "number";
if (typeof num === "number") {
tmp = !callback(table[0]).isScreenIndexFrozen(num);
2026-07-29 08:29:29 +00:00
const obj = callback(table[0]);
}
return tmp;
});
if (0 !== found.length) {
const _Math = Math;
const items = [];
HermesBuiltin.arraySpread(found, 0);
const _Math2 = Math;
str = HermesBuiltin.apply(items, Math);
}
const arr = Array.from(obj.keys());
2026-07-20 16:05:17 +00:00
}
}
}
}
2026-07-29 08:29:29 +00:00
let value;
if (null != str) {
value = obj.get(str);
2026-07-20 16:05:17 +00:00
}
let current;
2026-07-29 08:29:29 +00:00
if (value != null) {
current = value.current;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return current;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const map = new Map();
2026-07-20 16:05:17 +00:00
const map1 = new Map();
2026-08-24 06:08:38 +00:00
let result = set.fileFinishedImporting("utils/native/ChatInputUtils.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export function createInputRefTracker(id, screenIndex) {
2026-08-24 06:08:38 +00:00
closure_0 = screenIndex;
c1 = null;
2026-07-20 16:05:17 +00:00
let obj = { current: id };
obj = {
2026-07-29 08:29:29 +00:00
handleRef(current, id) {
obj.current = id;
2026-07-20 16:05:17 +00:00
if (null == current) {
2026-07-23 10:11:24 +00:00
if (null != obj) {
2026-07-29 08:29:29 +00:00
let value = obj.get(id);
if (null != value) {
value.delete(tmp16);
if (0 === value.size) {
obj.delete(id);
}
2026-08-24 06:08:38 +00:00
closure_1_3.delete(tmp16);
2026-07-29 08:29:29 +00:00
}
2026-07-23 10:11:24 +00:00
obj = null;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
} else if (null == obj) {
2026-07-29 08:29:29 +00:00
obj = { current: null };
obj[0] = current;
value = obj.get(id);
if (value == null) {
const _Map = Map;
value = new Map();
}
const result = value.set(tmp2, obj);
const result1 = obj.set(id, value);
2026-08-24 06:08:38 +00:00
const result2 = closure_1_3.set(tmp2, obj);
2026-07-29 08:29:29 +00:00
const _process = process;
if ("development" === process.env.DEVELOPMENT) {
2026-08-24 06:08:38 +00:00
const hasItem = closure_1_3.has(tmp2);
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
obj.current = current;
2026-07-20 16:05:17 +00:00
}
},
register() {
2026-07-23 10:11:24 +00:00
if (null != c1) {
2026-07-29 08:29:29 +00:00
const current2 = obj.current;
let value = obj.get(current2);
if (null != value) {
value.delete(tmp15);
if (0 === value.size) {
obj3.delete(current2);
}
2026-08-24 06:08:38 +00:00
closure_1_3.delete(tmp15);
2026-07-29 08:29:29 +00:00
}
const current = obj.current;
value = obj3.get(current);
if (value == null) {
const _Map = Map;
value = new Map();
}
const result = value.set(tmp15, tmp5);
const result1 = obj3.set(current, value);
2026-08-24 06:08:38 +00:00
const result2 = closure_1_3.set(tmp15, tmp5);
2026-07-29 08:29:29 +00:00
const _process = process;
if ("development" === process.env.DEVELOPMENT) {
const hasItem = obj2.has(tmp15);
}
2026-08-24 06:08:38 +00:00
obj2 = closure_1_3;
2026-07-29 08:29:29 +00:00
const tmp14 = obj;
2026-07-20 16:05:17 +00:00
}
},
unregister() {
2026-07-23 10:11:24 +00:00
if (null != c1) {
2026-07-29 08:29:29 +00:00
const current = obj.current;
const value = obj.get(current);
if (null != value) {
value.delete(tmp2);
if (0 === value.size) {
obj.delete(current);
}
2026-08-24 06:08:38 +00:00
closure_1_3.delete(tmp2);
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
}
}
};
return obj;
2026-07-29 08:29:29 +00:00
}
export const getHighestActiveScreenIndex = function getHighestActiveScreenIndex() {
let obj = arg0;
if (arg0 === undefined) {
obj = map1;
}
if (0 !== obj.size) {
if (obj.has("voice-panel")) {
return "voice-panel";
} else if (obj.has("message-request")) {
return "message-request";
} else if (obj.has("new-message")) {
return "new-message";
} else {
const _Array = Array;
2026-08-04 21:03:28 +00:00
const found = Array.from(obj.keys()).filter((num) => {
let tmp = typeof num === "number";
if (typeof num === "number") {
tmp = !callback(table[0]).isScreenIndexFrozen(num);
2026-07-29 08:29:29 +00:00
const obj = callback(table[0]);
}
return tmp;
});
if (0 !== found.length) {
const _Math = Math;
const items = [];
HermesBuiltin.arraySpread(found, 0);
const _Math2 = Math;
return HermesBuiltin.apply(items, Math);
}
const arr = Array.from(obj.keys());
}
}
2026-07-20 16:05:17 +00:00
};
export const getChatInputRef = function getChatInputRef(id, screenIndex) {
if (null != id) {
let value = map.get(id);
let current;
2026-07-29 08:29:29 +00:00
if (value != null) {
2026-07-20 16:05:17 +00:00
value = value.get(screenIndex);
2026-07-29 08:29:29 +00:00
if (value != null) {
2026-07-20 16:05:17 +00:00
current = value.current;
}
}
2026-07-29 08:29:29 +00:00
return current;
2026-07-20 16:05:17 +00:00
}
};
export const getBestActiveInputForChannelId = function getBestActiveInputForChannelId(channelId) {
if (null != channelId) {
2026-07-29 08:29:29 +00:00
let value = map.get(channelId);
2026-07-20 16:05:17 +00:00
if (null != value) {
2026-07-29 08:29:29 +00:00
let obj2 = value;
if (value === undefined) {
obj2 = map1;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let str;
if (0 !== obj2.size) {
str = "voice-panel";
if (!obj2.has("voice-panel")) {
str = "message-request";
if (!obj2.has("message-request")) {
str = "new-message";
if (!obj2.has("new-message")) {
const _Array = Array;
2026-08-04 21:03:28 +00:00
const found = Array.from(obj2.keys()).filter((num) => {
let tmp = typeof num === "number";
if (typeof num === "number") {
tmp = !callback(table[0]).isScreenIndexFrozen(num);
2026-07-29 08:29:29 +00:00
const obj = callback(table[0]);
}
return tmp;
});
if (0 !== found.length) {
const _Math = Math;
const items = [];
HermesBuiltin.arraySpread(found, 0);
const _Math2 = Math;
str = HermesBuiltin.apply(items, Math);
}
const arr = Array.from(obj2.keys());
}
}
}
}
value = undefined;
if (null != str) {
value = value.get(str);
}
let current;
if (value != null) {
current = value.current;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return current;
2026-07-20 16:05:17 +00:00
}
}
};
export { getBestActiveInput };
export const dismissKeyboard = function dismissKeyboard() {
2026-08-24 06:08:38 +00:00
let obj = dismissGlobalKeyboard;
2026-07-20 16:05:17 +00:00
const result = obj.dismissGlobalKeyboard();
const obj2 = getBestActiveInput();
if (null != obj2) {
obj2.closeCustomKeyboard();
}
2026-09-01 10:26:29 +00:00
let tmpResult = tmp(4342);
2026-07-29 08:29:29 +00:00
const keyboardType = tmpResult.getKeyboardType();
2026-08-24 06:08:38 +00:00
if (keyboardType !== KeyboardTypes.KeyboardTypes.SYSTEM) {
2026-08-31 15:47:37 +00:00
tmpResult = tmp(1497);
2026-07-29 08:29:29 +00:00
obj = { type: null };
2026-08-31 15:47:37 +00:00
obj[0] = tmp(1626).KeyboardTypes.SYSTEM;
2026-07-29 08:29:29 +00:00
tmpResult.setKeyboardType(obj);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
const result1 = zustandStore.closePortalKeyboardRequest();
2026-07-20 16:05:17 +00:00
};