Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5014.js (118.4 MB)
201 lines
7.4 KiB
TypeScript
201 lines
7.4 KiB
TypeScript
// Module ID: 9010
|
|
// Function ID: 9011
|
|
// Name: ChatItem
|
|
// Dependencies: [32, 19, 17, 4821, 1074, 8281, 21, 576, 9011, 1090, 9012, 7600, 9013, 4829, 1364, 8485, 4526, 672, 5285, 2]
|
|
// Exports: default
|
|
|
|
// Module 9010 (ChatItem)
|
|
import nativeDefault from "native" /* 576 */;
|
|
import _modDef672 from "module_672" /* 672 */;
|
|
import MessageTypes2 from "MessageTypes" /* 1090 */;
|
|
import isSystemMessageDefault from "isSystemMessage" /* 7600 */;
|
|
import RowGeneratorTypes from "RowGeneratorTypes" /* 8485 */;
|
|
import AutoModerationSystemMessageViewNativeComponent from "AutoModerationSystemMessageViewNativeComponent" /* 9011 */;
|
|
import _slicedToArray from "module_32" /* 32 */;
|
|
import noop from "module_19" /* 19 */;
|
|
import AccessibilityStore from "AccessibilityStore" /* 4821 */;
|
|
|
|
require = fn;
|
|
function DCDChatItem(message) {
|
|
message = message.message;
|
|
const merged = Object.assign(message, Object.assign({ message: 0 }));
|
|
if (message.type === MessageTypes.AUTO_MODERATION_ACTION) {
|
|
const obj2 = {};
|
|
const merged1 = Object.assign(merged);
|
|
let tmp3Result = closure_1_10(AutoModerationSystemMessageViewNativeComponent.default, obj2);
|
|
} else {
|
|
const AUTOMOD_INCIDENT_ACTIONS = MessageTypes2.MessageTypesSets.AUTOMOD_INCIDENT_ACTIONS;
|
|
if (AUTOMOD_INCIDENT_ACTIONS.has(message.type)) {
|
|
const obj3 = {};
|
|
const merged2 = Object.assign(merged);
|
|
tmp3Result = closure_1_10(tmp21(9012).default, obj3);
|
|
} else if (isSystemMessageDefault(message)) {
|
|
const obj4 = {};
|
|
const merged3 = Object.assign(merged);
|
|
tmp3Result = tmp3(tmp21(9013).default, obj4);
|
|
} else {
|
|
const obj = {};
|
|
const merged4 = Object.assign(merged);
|
|
tmp3Result = tmp3(tmp21(9012).default, obj);
|
|
}
|
|
}
|
|
return tmp3Result;
|
|
}
|
|
const View = fn(17).View;
|
|
const MessageTypes = fn(1074).MessageTypes;
|
|
const RowGeneratorConstants = fn(8281);
|
|
({ RowType: closure_8, Changeset: closure_9 } = RowGeneratorConstants);
|
|
const jsxProd = fn(21);
|
|
({ jsx: c10, jsxs: closure_11 } = jsxProd);
|
|
const PX_4 = nativeDefault.space.PX_4;
|
|
const createStyles = fn(4829);
|
|
let closure_14 = createStyles.createStyles((marginLeft, marginTop, paddingTop) => {
|
|
const obj = { container: { position: "relative", overflow: "hidden", paddingTop }, offset: { marginTop: -marginTop, marginLeft: -marginLeft }, gradient: { position: "absolute", bottom: 0, height: 24, width: "100%" }, itemRow: { backgroundColor: "transparent" } };
|
|
return obj;
|
|
});
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("components_native/chat/ChatItem.tsx");
|
|
|
|
export default function _default(rowGenerator) {
|
|
rowGenerator = rowGenerator.rowGenerator;
|
|
const message = rowGenerator.message;
|
|
let num = rowGenerator.horizontalOffset;
|
|
if (num === undefined) {
|
|
num = 8;
|
|
}
|
|
({ maxHeight, modifyRow } = rowGenerator);
|
|
const onLayout = rowGenerator.onLayout;
|
|
const messageSizeCacheRef = rowGenerator.messageSizeCacheRef;
|
|
({ backgroundColor, pointerEvents } = rowGenerator);
|
|
if (backgroundColor === undefined) {
|
|
backgroundColor = message(modifyRow[7]).colors.BACKGROUND_BASE_LOWER;
|
|
}
|
|
const gradientColors = rowGenerator.gradientColors;
|
|
AccessibilityStore = undefined;
|
|
let token;
|
|
[tmp4, c6] = onLayout(messageSizeCacheRef.useState(0), 2);
|
|
const tmp5 = onLayout(messageSizeCacheRef.useState(undefined), 2);
|
|
const constrainedWidth = tmp5[0];
|
|
closure_8 = tmp5[1];
|
|
const roleStyle = AccessibilityStore.roleStyle;
|
|
let items = [constrainedWidth, roleStyle, message, modifyRow, rowGenerator];
|
|
const memo = messageSizeCacheRef.useMemo(() => {
|
|
rowGenerator.setOptions({ constrainedWidth });
|
|
const generateResult = rowGenerator.generate({ roleStyle, rowType: constants.MESSAGE, changeType: constants2.NOOP, message, isFirst: true, canShowImages: true, canAddNewReactions: false });
|
|
if (null != modifyRow) {
|
|
tmp3(generateResult);
|
|
}
|
|
const obj3 = { rawRow: generateResult, row: null };
|
|
const merged = Object.assign(generateResult);
|
|
obj3.row = JSON.stringify({ index: 0 });
|
|
return obj3;
|
|
}, items);
|
|
const rawRow = memo.rawRow;
|
|
const items1 = [rawRow.contextType];
|
|
const memo1 = messageSizeCacheRef.useMemo(() => {
|
|
let num = 0;
|
|
if (!obj.isAndroid()) {
|
|
let num2 = 16;
|
|
if (rawRow.contextType === RowGeneratorTypes.MessageContextType.SEARCH) {
|
|
num2 = 12;
|
|
}
|
|
num = num2;
|
|
}
|
|
return num;
|
|
}, items1);
|
|
let tmp11 = rawRow.contextType !== rowGenerator(modifyRow[15]).MessageContextType.SEARCH;
|
|
if (tmp11) {
|
|
tmp11 = null != rawRow.message;
|
|
}
|
|
if (tmp11) {
|
|
tmp11 = "avatarDecorationURL" in rawRow.message;
|
|
}
|
|
if (tmp11) {
|
|
tmp11 = null != rawRow.message.avatarDecorationURL;
|
|
}
|
|
if (!tmp11) {
|
|
const tmp17 = closure_14(num, memo1, 0);
|
|
const items2 = [onLayout];
|
|
const items3 = [messageSizeCacheRef, message.id];
|
|
const callback = obj.useCallback((nativeEvent) => {
|
|
closure_8(nativeEvent.nativeEvent.layout.width);
|
|
if (onLayout != null) {
|
|
onLayout(nativeEvent);
|
|
}
|
|
}, items2);
|
|
let tmp24Result = null != maxHeight;
|
|
const callback1 = obj.useCallback((nativeEvent) => {
|
|
const height = nativeEvent.nativeEvent.layout.height;
|
|
if (height > 0) {
|
|
if (null != messageSizeCacheRef) {
|
|
if (tmp.current[message.id] !== height) {
|
|
tmp.current[tmp3.id] = height;
|
|
}
|
|
}
|
|
_undefined(height);
|
|
}
|
|
}, items3);
|
|
if (tmp24Result) {
|
|
tmp24Result = tmp4 - memo1 >= maxHeight;
|
|
}
|
|
let tmp22;
|
|
if (messageSizeCacheRef != null) {
|
|
const current = messageSizeCacheRef.current;
|
|
if (current != null) {
|
|
tmp22 = current[message.id];
|
|
}
|
|
}
|
|
let tmp23 = tmp22;
|
|
if (tmp24Result) {
|
|
tmp23 = tmp22;
|
|
if (null != maxHeight) {
|
|
tmp23 = maxHeight;
|
|
}
|
|
}
|
|
const obj2 = { style: tmp17.offset, onLayout: callback1, children: null };
|
|
let obj3 = { message, row: memo.row, style: tmp17.itemRow };
|
|
obj2.children = rawRow(DCDChatItem, obj3);
|
|
const tmp24 = rawRow;
|
|
const tmp25 = gradientColors;
|
|
const tmp27 = rawRow(gradientColors, obj2);
|
|
token = tmp9(tmp10[16]).useToken(backgroundColor);
|
|
const items4 = [gradientColors, token];
|
|
const obj4 = { style: null, onLayout: null, pointerEvents: null, children: null };
|
|
const items5 = [tmp17.container, rowGenerator.style, ];
|
|
const obj5 = { height: tmp23 };
|
|
items5[2] = obj5;
|
|
obj4.style = items5;
|
|
obj4.onLayout = callback;
|
|
obj4.pointerEvents = pointerEvents;
|
|
let tmp31 = null != constrainedWidth;
|
|
const memo2 = obj.useMemo(() => {
|
|
let tmp = gradientColors;
|
|
if (gradientColors == null) {
|
|
const obj = _modDef672(token);
|
|
const items = [_modDef672(token).alpha(0).hex(), token];
|
|
tmp = items;
|
|
const alphaResult = _modDef672(token).alpha(0);
|
|
}
|
|
return tmp;
|
|
}, items4);
|
|
if (tmp31) {
|
|
tmp31 = tmp27;
|
|
}
|
|
const items6 = [tmp31, ];
|
|
if (tmp24Result) {
|
|
const obj6 = { colors: memo2, style: null };
|
|
const items7 = [tmp17.gradient, rowGenerator.gradientStyles];
|
|
obj6.style = items7;
|
|
tmp24Result = tmp24(message(tmp10[18]), obj6);
|
|
}
|
|
items6[1] = tmp24Result;
|
|
obj4.children = items6;
|
|
return token(tmp25, obj4);
|
|
} else {
|
|
tmp9(tmp10[14]).isAndroid() ? PX_4 - 2 : PX_4;
|
|
const tmp9Result2 = tmp9(tmp10[14]);
|
|
}
|
|
};
|
|
export const DCDMessageView = fn(9012).default;
|
|
export const DCDSystemMessageView = fn(9013).default;
|
|
export const DCDAutoModerationSystemMessageView = fn(9011).default;
|