decord/alpha/source/utils/native/ChatInputUtils.tsx

253 lines
7.3 KiB
TypeScript
Raw Permalink Normal View History

2026-10-10 08:08:14 +00:00
// Module ID: 4985
// Function ID: 4986
// Name: ChatInputUtils
2026-10-10 08:08:14 +00:00
// Dependencies: [4986, 1894, 4987, 1629, 1501, 4988, 2]
2026-07-29 08:29:29 +00:00
// Exports: createInputRefTracker, dismissKeyboard, getBestActiveInputForChannelId, getChatInputRef, getHighestActiveScreenIndex
2026-07-20 16:05:17 +00:00
2026-10-10 08:08:14 +00:00
// Module 4985 (ChatInputUtils)
2026-10-09 10:00:15 +00:00
import KeyboardUIStore from "KeyboardUIStore" /* 1501 */;
import KeyboardTypes from "KeyboardTypes" /* 1629 */;
import KeyboardManagerUtils from "KeyboardManagerUtils" /* 1894 */;
2026-10-10 08:08:14 +00:00
import ScreenIndexFrozen from "ScreenIndexFrozen" /* 4986 */;
import useKeyboardType from "useKeyboardType" /* 4987 */;
import PortalKeyboardUIStore from "PortalKeyboardUIStore" /* 4988 */;
import size from "module_2" /* 2 */;
2026-08-24 06:08:38 +00:00
2026-10-13 12:43:34 +00:00
const f91200 = (item) => {
2026-10-03 08:58:59 +00:00
let tmp = typeof item === "number";
if (typeof item === "number") {
const obj = ScreenIndexFrozen;
tmp = !obj.isScreenIndexFrozen(item);
}
return tmp;
};
2026-07-29 08:29:29 +00:00
function getBestActiveInput() {
let str;
if (0 !== map1.size) {
str = "voice-panel";
2026-10-03 08:58:59 +00:00
if (!map1.has("voice-panel")) {
2026-07-29 08:29:29 +00:00
str = "message-request";
2026-10-03 08:58:59 +00:00
if (!map1.has("message-request")) {
2026-07-29 08:29:29 +00:00
str = "new-message";
2026-10-03 08:58:59 +00:00
if (!map1.has("new-message")) {
2026-10-05 08:00:40 +00:00
str = "conjure-preview";
if (!map1.has("conjure-preview")) {
const _Array = Array;
2026-10-03 08:58:59 +00:00
const arr = Array.from(map1.keys());
2026-10-13 12:43:34 +00:00
const found = arr.filter(f91200);
if (0 !== found.length) {
const _Math = Math;
const items = [];
2026-10-03 08:58:59 +00:00
HermesBuiltin.arraySpread(items, found, 0);
const _Math2 = Math;
2026-10-03 08:58:59 +00:00
str = HermesBuiltin.apply(max, items, Math);
2026-07-29 08:29:29 +00:00
}
}
2026-07-20 16:05:17 +00:00
}
}
}
}
2026-10-03 08:58:59 +00:00
let value;
2026-07-29 08:29:29 +00:00
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();
let result = size.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-10-03 08:58:59 +00:00
let closure_0 = screenIndex;
2026-07-20 16:05:17 +00:00
let obj = { current: id };
2026-10-03 08:58:59 +00:00
let obj2 = {
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-10-03 08:58:59 +00:00
const value = map.get(id);
2026-07-29 08:29:29 +00:00
if (null != value) {
2026-10-03 08:58:59 +00:00
value.delete(screenIndex);
2026-07-29 08:29:29 +00:00
if (0 === value.size) {
map.delete(id);
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
map1.delete(screenIndex);
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) {
obj = { current };
2026-10-03 08:58:59 +00:00
let value2 = map.get(id);
if (value2 == null) {
2026-07-29 08:29:29 +00:00
const _Map = Map;
2026-10-03 08:58:59 +00:00
const self = this;
const self2 = this;
value2 = new Map();
2026-07-29 08:29:29 +00:00
}
const result = value2.set(tmp2, obj);
const result1 = map.set(id, value2);
const result2 = map1.set(tmp2, obj);
2026-07-29 08:29:29 +00:00
const _process = process;
if ("development" === process.env.DEVELOPMENT) {
const hasItem = map1.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() {
if (null != obj) {
2026-07-29 08:29:29 +00:00
const current2 = obj.current;
2026-10-03 08:58:59 +00:00
const value = map.get(current2);
const tmp12 = obj;
2026-07-29 08:29:29 +00:00
if (null != value) {
2026-10-03 08:58:59 +00:00
value.delete(screenIndex);
2026-07-29 08:29:29 +00:00
if (0 === value.size) {
2026-10-03 08:58:59 +00:00
map.delete(current2);
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
map1.delete(screenIndex);
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
const current = tmp12.current;
let value2 = obj3.get(current);
if (value2 == null) {
2026-07-29 08:29:29 +00:00
const _Map = Map;
2026-10-03 08:58:59 +00:00
const self = this;
const self2 = this;
value2 = new Map();
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
const result = value2.set(tmp13, tmp5);
const result1 = obj3.set(current, value2);
2026-10-03 08:58:59 +00:00
const result2 = map1.set(tmp13, tmp5);
2026-07-29 08:29:29 +00:00
const _process = process;
2026-10-03 08:58:59 +00:00
const obj2 = map1;
2026-07-29 08:29:29 +00:00
if ("development" === process.env.DEVELOPMENT) {
2026-10-03 08:58:59 +00:00
const hasItem = obj2.has(tmp13);
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
}
},
unregister() {
if (null != obj) {
2026-07-29 08:29:29 +00:00
const current = obj.current;
2026-10-03 08:58:59 +00:00
const value = map.get(current);
2026-07-29 08:29:29 +00:00
if (null != value) {
2026-10-03 08:58:59 +00:00
value.delete(screenIndex);
2026-07-29 08:29:29 +00:00
if (0 === value.size) {
2026-10-03 08:58:59 +00:00
map.delete(current);
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
map1.delete(screenIndex);
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
}
}
};
2026-10-03 08:58:59 +00:00
return obj2;
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";
2026-10-05 08:00:40 +00:00
} else if (obj.has("conjure-preview")) {
return "conjure-preview";
2026-07-29 08:29:29 +00:00
} else {
const _Array = Array;
2026-10-03 08:58:59 +00:00
const arr = Array.from(obj.keys());
2026-10-13 12:43:34 +00:00
const found = arr.filter(f91200);
2026-07-29 08:29:29 +00:00
if (0 !== found.length) {
const _Math = Math;
const items = [];
2026-10-03 08:58:59 +00:00
HermesBuiltin.arraySpread(items, found, 0);
2026-07-29 08:29:29 +00:00
const _Math2 = Math;
2026-10-03 08:58:59 +00:00
return HermesBuiltin.apply(max, items, Math);
2026-07-29 08:29:29 +00:00
}
}
}
2026-07-20 16:05:17 +00:00
};
export const getChatInputRef = function getChatInputRef(id, screenIndex) {
if (null != id) {
2026-10-03 08:58:59 +00:00
const value = map.get(id);
2026-07-20 16:05:17 +00:00
let current;
2026-07-29 08:29:29 +00:00
if (value != null) {
2026-10-03 08:58:59 +00:00
const value2 = value.get(screenIndex);
if (value2 != null) {
current = value2.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 const getBestActiveInputForChannelId = function getBestActiveInputForChannelId(id) {
if (null != id) {
2026-10-03 08:58:59 +00:00
const value = map.get(id);
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")) {
2026-10-05 08:00:40 +00:00
str = "conjure-preview";
if (!obj2.has("conjure-preview")) {
const _Array = Array;
2026-10-03 08:58:59 +00:00
const arr = Array.from(obj2.keys());
2026-10-13 12:43:34 +00:00
const found = arr.filter(f91200);
if (0 !== found.length) {
const _Math = Math;
const items = [];
2026-10-03 08:58:59 +00:00
HermesBuiltin.arraySpread(items, found, 0);
const _Math2 = Math;
2026-10-03 08:58:59 +00:00
str = HermesBuiltin.apply(max, items, Math);
2026-07-29 08:29:29 +00:00
}
}
}
}
}
}
2026-10-03 08:58:59 +00:00
let value2;
2026-07-29 08:29:29 +00:00
if (null != str) {
value2 = value.get(str);
2026-07-29 08:29:29 +00:00
}
let current;
if (value2 != null) {
current = value2.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-10-03 08:58:59 +00:00
const obj = KeyboardManagerUtils;
const result = obj.dismissGlobalKeyboard();
2026-07-20 16:05:17 +00:00
const obj2 = getBestActiveInput();
if (null != obj2) {
obj2.closeCustomKeyboard();
}
2026-10-03 08:58:59 +00:00
const tmpResult = useKeyboardType;
const keyboardType = tmpResult.getKeyboardType();
2026-08-24 06:08:38 +00:00
if (keyboardType !== KeyboardTypes.KeyboardTypes.SYSTEM) {
2026-10-03 08:58:59 +00:00
const obj3 = { type: KeyboardTypes.KeyboardTypes.SYSTEM };
const setKeyboardType = KeyboardUIStore.setKeyboardType;
KeyboardUIStore;
setKeyboardType(obj3);
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const tmpResult4 = PortalKeyboardUIStore;
const result1 = tmpResult4.closePortalKeyboardRequest();
2026-07-20 16:05:17 +00:00
};