/* Metro module 9849; source: modules/chat/native/computeScrollData.tsx; dependencies: [4502, 8178, 9850, 4044, 2] */ import AccessibilityStore from '../../a11y/AccessibilityStore.tsx'; /* Metro dependency 4502 */ import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ClientModule from '../../../flow/Client.tsx'; /* Metro dependency 4044 */ import * as RowGeneratorConstantsModule from '../../messages/native/renderer/RowGeneratorConstants.tsx'; /* Metro dependency 8178 */ import * as NativeChatUtilsModule from './NativeChatUtils.tsx'; /* Metro dependency 9850 */ function _fun77195(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#77195, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10035:6, offset: 0x01df46cd, size: 163 bytes, params: 8, frame: 19 let env0_0 = require; const closure = function(a0, a1) { var env0_0 = a1; var index = a0.findIndex(_fun77197); if (index !== -1) { return index; } }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('modules/chat/native/computeScrollData.tsx'); exports.default = computeScrollData; exports.findMessageRowIndex = closure; function findMessageRowIndex(a0, a1) { // fn#77196, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10035:146, offset: 0x01df4770, size: 46 bytes, params: 3, frame: 11 const env0_0 = a1; const index = a0.findIndex(_fun77197); if (index !== -1) { return index; } function _fun77197(a0) { // fn#77197, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10035:199, offset: 0x01df479e, size: 40 bytes, params: 2, frame: 3 return a0.message != null && a0.message.id === require; } } function computeScrollData({rows, scrollToMessageId, jumpTargetId, jumpType, shouldInitialScroll, animated, scrollPosition, focusTargetId}) { // fn#77198, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10035:342, offset: 0x01df47c6, size: 465 bytes, params: 2, frame: 28 var r0; var r1; var value; var messageRowIndex; const ChatScrollType = (NativeChatUtilsModule).ChatScrollType; const JumpTypes = (ClientModule).JumpTypes; const ChatScrollPosition = (NativeChatUtilsModule).ChatScrollPosition; var messageRowIndex2; if (shouldInitialScroll) { if (jumpTargetId != null) { value = undefined; if (scrollToMessageId != null) { messageRowIndex = findMessageRowIndex(rows, scrollToMessageId); r0 = messageRowIndex != null ? {type: ChatScrollType.SCROLL, index: messageRowIndex, animate: !AccessibilityStore.useReducedMotion && jumpType !== JumpTypes.INSTANT, highlight: scrollToMessageId === jumpTargetId, position: scrollPosition ?? ChatScrollPosition.TOP} : value; } else { r0 = value; } if (r0 == null) { if (focusTargetId != null) { messageRowIndex2 = findMessageRowIndex(rows, focusTargetId); r1 = messageRowIndex2 != null ? {type: ChatScrollType.FOCUS_ONLY, index: messageRowIndex2} : value; } else { r1 = value; } r0 = r1; } return r0; } value = ((a0) => { var index = a0.findIndex(_fun77200); if (index !== -1) { return index; } })(rows); if (value != null) { return {type: ChatScrollType.SCROLL, index: value, animate: animated && !AccessibilityStore.useReducedMotion, highlight: false, position: ChatScrollPosition.TOP}; } } value = undefined; if (scrollToMessageId != null) { messageRowIndex = findMessageRowIndex(rows, scrollToMessageId); r0 = messageRowIndex != null ? {type: ChatScrollType.SCROLL, index: messageRowIndex, animate: !AccessibilityStore.useReducedMotion && jumpType !== JumpTypes.INSTANT, highlight: scrollToMessageId === jumpTargetId, position: scrollPosition ?? ChatScrollPosition.TOP} : value; } else { r0 = value; } if (r0 == null) { if (focusTargetId != null) { messageRowIndex2 = findMessageRowIndex(rows, focusTargetId); r1 = messageRowIndex2 != null ? {type: ChatScrollType.FOCUS_ONLY, index: messageRowIndex2} : value; } else { r1 = value; } r0 = r1; } return r0; function findUnreadSeperatorRowIndex(a0) { // fn#77199, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10035:512, owner: computeScrollData.findUnreadSeperatorRowIndex, offset: 0x01df4997, size: 39 bytes, params: 2, frame: 11 const index = a0.findIndex(_fun77200); if (index !== -1) { return index; } function _fun77200(a0) { // fn#77200, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10035:571, offset: 0x01df49be, size: 49 bytes, params: 2, frame: 4 const type = a0.type; const value = environment.__proto__.__proto__; const SEPARATOR = RowType.SEPARATOR; return type === SEPARATOR && a0.id === SeparatorType.UNREAD; } } } } global.__d(_fun77195, 9849, [4502, 8178, 9850, 4044, 2]) /* metro module 9849, dependencies: [4502, 8178, 9850, 4044, 2] */;