Files
discord-decomp/sources/modules/media_viewer/native/useMediaViewerSyncer.tsx
T
2026-07-28 01:06:53 +03:00

897 lines
64 KiB
TypeScript

/* Metro module 9560; source: modules/media_viewer/native/useMediaViewerSyncer.tsx; dependencies: [57, 31, 9561, 477, 4017, 9562, 1585, 9547, 9563, 9546, 4577, 2] */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import UseSafeAreaInsetsNative from '../../safe_area/useSafeAreaInsets.native.tsx'; /* Metro dependency 1585 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as PlatformUtilsModule from '../../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */
import * as ReanimatedRexportModule from '../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
import * as SpringModule from '../../../design/animation/reanimated/spring/spring.tsx'; /* Metro dependency 4577 */
import * as MediaSourceUtilModule from './MediaSourceUtil.tsx'; /* Metro dependency 9546 */
import * as MediaViewerAnalyticsManagerModule from '../MediaViewerAnalyticsManager.tsx'; /* Metro dependency 9547 */
import * as ConstantsModule from './Constants.tsx'; /* Metro dependency 9561 */
import * as MediaViewerDimensionsContextModule from './MediaViewerDimensionsContext.tsx'; /* Metro dependency 9562 */
function _fun74641(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#74641, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:6, offset: 0x01d949db, size: 609 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_10 = (PlatformUtilsModule).isAndroid();
object = {code: "function useMediaViewerSyncerTsx1(){const{thumbnailsScrolling,SCROLLING_DRAG,swipeSource}=this.__closure;thumbnailsScrolling.set(thumbnailsScrolling.get()|SCROLLING_DRAG);swipeSource.set('thumbnails');}"};
object = {code: 'function useMediaViewerSyncerTsx2(){const{thumbnailsScrolling,SCROLLING_DRAG}=this.__closure;thumbnailsScrolling.set(thumbnailsScrolling.get()&~SCROLLING_DRAG);}'};
object = {code: "function useMediaViewerSyncerTsx3(event){const{variableWidthThumbnailsEnabled,thumbnailScrollPositions,thumbnailSize,swipeSource,maxIndex,thumbnailsIndex,thumbnailsAnimateTo,selectedIndex,viewerScrolling,thumbnailsScrolling,runOnJS,onSelectedIndexChange}=this.__closure;let thumbnails=0;if(variableWidthThumbnailsEnabled){if(event.contentOffset.x<0){thumbnails=0;}else if(event.contentOffset.x>=thumbnailScrollPositions[thumbnailScrollPositions.length-1].end){thumbnails=thumbnailScrollPositions.length-1;}else{for(let i=0;i<thumbnailScrollPositions.length;i++){const startPos=thumbnailScrollPositions[i].scrollStart;let endPos=i<thumbnailScrollPositions.length-1?thumbnailScrollPositions[i+1].scrollStart:startPos;if(i===thumbnailScrollPositions.length-1){endPos=thumbnailScrollPositions[i].end;}if(event.contentOffset.x>=startPos&&event.contentOffset.x<endPos){thumbnails=i+(event.contentOffset.x-startPos)/(endPos-startPos);break;}}}}else{thumbnails=event.contentOffset.x/thumbnailSize;}if(swipeSource.get()==='thumbnails'||Math.abs(Math.round(thumbnails)-thumbnails)<0.01){const index=Math.max(0,Math.min(Math.round(thumbnails),maxIndex));thumbnailsIndex.set(index);}if(thumbnailsAnimateTo.get()>=0){if(thumbnailsIndex.get()===thumbnailsAnimateTo.get()){thumbnailsAnimateTo.set(-1);selectedIndex.set(thumbnailsIndex.get());}return;}const wasTouched=viewerScrolling.get()!==0||thumbnailsScrolling.get()!==0;if(wasTouched&&thumbnailsIndex.get()!==selectedIndex.get()){selectedIndex.set(thumbnailsIndex.get());runOnJS(onSelectedIndexChange)();}}"};
object = {code: "function useMediaViewerSyncerTsx4(){const{thumbnailsScrolling,SCROLLING_MOMENTUM,swipeSource}=this.__closure;thumbnailsScrolling.set(thumbnailsScrolling.get()|SCROLLING_MOMENTUM);swipeSource.set('thumbnails');}"};
object = {code: 'function useMediaViewerSyncerTsx5(){const{thumbnailsScrolling,SCROLLING_MOMENTUM}=this.__closure;thumbnailsScrolling.set(thumbnailsScrolling.get()&~SCROLLING_MOMENTUM);}'};
object = {code: 'function useMediaViewerSyncerTsx6(){const{thumbnailsAnimateTo,variableWidthThumbnailsEnabled,runOnJS,scrollVarWidthThumbnails,scrollTo,ref,thumbnailSize}=this.__closure;if(thumbnailsAnimateTo.get()<0)return;if(variableWidthThumbnailsEnabled){runOnJS(scrollVarWidthThumbnails)(thumbnailsAnimateTo.get());}else{scrollTo(ref,thumbnailsAnimateTo.get()*thumbnailSize,0,true);}}'};
object = {code: 'function useMediaViewerSyncerTsx7(){const{viewerScrolling,thumbnailsIndex,viewerPos,variableWidthThumbnailsEnabled,runOnJS,lerpScrollVarWidthThumbnails,scrollTo,ref,thumbnailSize}=this.__closure;if(viewerScrolling.get()===0)return;else if(thumbnailsIndex.get()!==viewerPos.get()){if(variableWidthThumbnailsEnabled){runOnJS(lerpScrollVarWidthThumbnails)(viewerPos.get());}else{scrollTo(ref,viewerPos.get()*thumbnailSize,0,false);}}}'};
object = {code: "function useMediaViewerSyncerTsx8(){const{thumbnailsScrolling,interpolate,viewerPos,interpolateInput,interpolateOutput}=this.__closure;return thumbnailsScrolling.get()>0?0:-interpolate(viewerPos.get(),interpolateInput,interpolateOutput,'clamp');}"};
object = {code: 'function useMediaViewerSyncerTsx9(){const{viewerScrolling,headerBufferSize,margin,withSpring}=this.__closure;return{width:viewerScrolling.get()>0?headerBufferSize+margin.get():withSpring(headerBufferSize+margin.get(),{overshootClamping:true})};}'};
object = {code: 'function useMediaViewerSyncerTsx10(){const{viewerScrolling,footerBufferSize,margin,withSpring}=this.__closure;return{width:viewerScrolling.get()>0?footerBufferSize+margin.get():withSpring(footerBufferSize+margin.get(),{overshootClamping:true})};}'};
object = {code: "function useMediaViewerSyncerTsx11(){const{interpolate,viewerPos,index}=this.__closure;return interpolate(viewerPos.get(),[index-1,index,index+1],[0.4,1,0.4],'clamp');}"};
object = {code: "function useMediaViewerSyncerTsx13(){const{thumbnailsScrolling,THUMBNAIL_MIN_WIDTH,interpolate,viewerPos,index,sourceWidth}=this.__closure;return thumbnailsScrolling.get()>0?THUMBNAIL_MIN_WIDTH:interpolate(viewerPos.get(),[index-1,index,index+1],[THUMBNAIL_MIN_WIDTH,sourceWidth,THUMBNAIL_MIN_WIDTH],'clamp');}"};
object = {code: 'function useMediaViewerSyncerTsx14(){const{viewerScrolling,_width,withSpring,THUMBNAIL_HEIGHT,opacity}=this.__closure;return{width:viewerScrolling.get()>0?_width.get():withSpring(_width.get(),{overshootClamping:true}),height:THUMBNAIL_HEIGHT,opacity:opacity.get()};}'};
object = {code: 'function useMediaViewerSyncerTsx15(){const{zoomed}=this.__closure;return!zoomed.get();}'};
object = {code: 'function useMediaViewerSyncerTsx16(){const{thumbnailsAnimateTo,scrollTo,ref,screenWidth}=this.__closure;if(thumbnailsAnimateTo.get()===-1)return;scrollTo(ref,thumbnailsAnimateTo.get()*screenWidth,0,false);}'};
object = {code: 'function useMediaViewerSyncerTsx17(){const{thumbnailsScrolling,viewerScrolling,thumbnailsAnimateTo,scrollTo,ref,thumbnailsIndex,screenWidth}=this.__closure;if(thumbnailsScrolling.get()===0||viewerScrolling.get()>0||thumbnailsAnimateTo.get()!==-1)return;scrollTo(ref,thumbnailsIndex.get()*screenWidth,0,false);}'};
object = {code: "function useMediaViewerSyncerTsx18(){const{viewerScrolling,SCROLLING_DRAG,swipeSource}=this.__closure;viewerScrolling.set(viewerScrolling.get()|SCROLLING_DRAG);swipeSource.set('viewer');}"};
object = {code: 'function useMediaViewerSyncerTsx19(){const{viewerScrolling,SCROLLING_DRAG}=this.__closure;viewerScrolling.set(viewerScrolling.get()&~SCROLLING_DRAG);}'};
object = {code: 'function useMediaViewerSyncerTsx20(pos){const{viewerPos}=this.__closure;viewerPos.set(pos);}'};
object = {code: "function useMediaViewerSyncerTsx21(){const{viewerScrolling,SCROLLING_MOMENTUM,swipeSource}=this.__closure;viewerScrolling.set(viewerScrolling.get()|SCROLLING_MOMENTUM);swipeSource.set('viewer');}"};
object = {code: 'function useMediaViewerSyncerTsx22(){const{viewerScrolling,SCROLLING_MOMENTUM}=this.__closure;viewerScrolling.set(viewerScrolling.get()&~SCROLLING_MOMENTUM);}'};
object = {code: 'function useMediaViewerSyncerTsx23(event){const{contentSizeLastChangedAt,IS_ANDROID,selectedIndex,scrollTo,ref,screenWidth,viewerScrolling,thumbnailsScrolling,thumbnailsAnimateTo,onScrollWorklets}=this.__closure;const contentSizeChangedRecently=Date.now()-contentSizeLastChangedAt.get()<500;if(IS_ANDROID&&contentSizeChangedRecently&&event.contentOffset.x===0&&selectedIndex.get()!==0){scrollTo(ref,selectedIndex.get()*screenWidth,event.contentOffset.y,false);return;}if(viewerScrolling.get()===0&&thumbnailsScrolling.get()===0&&thumbnailsAnimateTo.get()===-1)return;onScrollWorklets.onScroll(event.contentOffset.x/screenWidth);}'};
object = {code: 'function useMediaViewerSyncerTsx24(){const{index,selectedIndex}=this.__closure;return index===selectedIndex.get();}'};
object = {code: 'function useMediaViewerSyncerTsx25(result,previous){const{runOnJS,setVisible}=this.__closure;if(previous==null||previous===result)return;runOnJS(setVisible)(result);}'};
(FileImportTrackerModule).fileFinishedImporting('modules/media_viewer/native/useMediaViewerSyncer.tsx');
exports.useMediaViewerSyncer = useMediaViewerSyncer;
function useMediaViewerSyncer({sources, initialIndex, onEndReached, onEndReachedThreshold}) { // fn#74642, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:7532, offset: 0x01d94c3c, size: 122 bytes, params: 2, frame: 17
return ReactModule.useMemo(_fun74644, [sources, ReactModule.useMemo(_fun74643, [initialIndex]), onEndReached,
onEndReachedThreshold]);
function _fun74643() { // fn#74643, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:7646, offset: 0x01d94cb6, size: 237 bytes, params: 1, frame: 18
const initialIndexBinding = initialIndex;
const object = {};
const value = environment.__proto__;
object.selectedIndex = (require(4017) /* metro dependency 4017: ReanimatedRexport */).makeMutable(initialIndexBinding);
object.thumbnailsIndex = (require(4017) /* metro dependency 4017: ReanimatedRexport */).makeMutable(initialIndexBinding);
object.thumbnailsScrolling = (require(4017) /* metro dependency 4017: ReanimatedRexport */).makeMutable(0);
object.thumbnailsAnimateTo = (require(4017) /* metro dependency 4017: ReanimatedRexport */).makeMutable(-1);
object.viewerPos = (require(4017) /* metro dependency 4017: ReanimatedRexport */).makeMutable(initialIndexBinding);
object.viewerScrolling = (require(4017) /* metro dependency 4017: ReanimatedRexport */).makeMutable(0);
object.zoomed = (require(4017) /* metro dependency 4017: ReanimatedRexport */).makeMutable(false);
object.swipeSource = (require(4017) /* metro dependency 4017: ReanimatedRexport */).makeMutable(undefined);
return object;
}
function _fun74644() { // fn#74644, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:8019, offset: 0x01d94da3, size: 378 bytes, params: 1, frame: 34
var r9;
var r10;
var r22;
var r17;
var moduleValue;
var value4;
var Math;
var max;
var Math2;
var min;
var width;
var height;
var value5;
var value6;
var value7;
var value8;
var value9;
var floor;
var end;
var start;
var value10;
var value11;
const sourcesBinding = sources;
const items2 = [];
let length = sourcesBinding.length;
const value2 = 0;
if (value2 < length) {
r9 = value2;
r10 = value2;
while (true) {
moduleValue = require(9546) /* metro dependency 9546: MediaSourceUtil */;
value4 = moduleValue.flattenSource(sourcesBinding[r9]);
if (value4 != null) {
Math = global.Math;
max = Math.max;
Math2 = global.Math;
min = Math2.min;
width = value4.width;
height = value4.height;
value5 = width * (THUMBNAIL_HEIGHT / height);
value6 = Reflect.apply(min, Math2, [value5, THUMBNAIL_MAX_WIDTH]);
value7 = Reflect.apply(max, Math, [value6, THUMBNAIL_MIN_WIDTH]);
value8 = r10 + (value7 + 2 * THUMBNAIL_MARGIN);
value9 = value8 - r10;
if (value2 === r9) {
r22 = value2;
continue;
}
Math = global.Math;
floor = Math.floor;
end = items2[value2].end;
start = items2[value2].start;
value10 = Reflect.apply(floor, Math, [r10 + (value9 - (end - start)) / 2]);
r22 = value10;
items2.push({start: r10, end: value8, scrollStart: r22});
r17 = value8;
} else {
items2.push({start: r10, end: r10, scrollStart: r10});
r17 = r10;
}
value11 = typeof r9 === 'bigint' ? r9 + 1n : +r9 + 1;
length = sourcesBinding.length;
if (value11 < length) {
r9 = value11;
r10 = r17;
continue;
}
break;
}
}
return makeMediaViewerSyncer({sources: sourcesBinding, animProps: ReactModule, thumbnailScrollPositions: items2,
onEndReached: onEndReached, onEndReachedThreshold: onEndReachedThreshold});
function makeMediaViewerSyncer({sources, animProps, thumbnailScrollPositions, onEndReached, onEndReachedThreshold}) { // fn#74645, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:8384, offset: 0x01d94f1d, size: 216 bytes, params: 2, frame: 9
const selectedIndex = animProps.selectedIndex;
const env0_3 = animProps.thumbnailsIndex;
const env0_4 = animProps.thumbnailsScrolling;
const env0_5 = animProps.thumbnailsAnimateTo;
const env0_6 = animProps.viewerPos;
const env0_7 = animProps.viewerScrolling;
const zoomed = animProps.zoomed;
const env0_9 = animProps.swipeSource;
if (thumbnailScrollPositions.length > 0) {
thumbnailScrollPositions[0].end;
thumbnailScrollPositions[0].start;
}
return {index: selectedIndex, sources: sources, zoomed: zoomed, thumbnailScrollPositions: thumbnailScrollPositions,
variableWidthThumbnailsEnabled: false, useThumbnailsProps: useThumbnailsProps, useViewerProps: useViewerProps,
onEndReached: onEndReached, onEndReachedThreshold: onEndReachedThreshold};
function useThumbnailsProps(a0, a1) { // fn#74646, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:8810, owner: makeMediaViewerSyncer.useThumbnailsProps, offset: 0x01d94ff5, size: 1441 bytes, params: 3, frame: 36
var environment;
const env0_0 = a0;
const env0_1 = a1;
const value = environment.__proto__.__proto__.__proto__;
const value2 = (ReanimatedRexportModule).useAnimatedRef();
const {width,
height} = (MediaViewerDimensionsContextModule).useMediaViewerDimensions();
const value4 = (UseSafeAreaInsetsNative)();
let closure = onSelectedIndexChange;
const useAnimatedScrollHandler = ReanimatedRexportModule.useAnimatedScrollHandler;
let object = {};
const closure2 = function() {
var thumbnailsScrollingBinding = thumbnailsScrolling;
thumbnailsScrollingBinding.set(2 | thumbnailsScrollingBinding.get());
swipeSource.set('thumbnails');
};
let thumbnailsScrollingBinding = thumbnailsScrolling;
const swipeSourceBinding = swipeSource;
closure2.__closure = {thumbnailsScrolling: thumbnailsScrollingBinding, SCROLLING_DRAG: 2,
swipeSource: swipeSourceBinding};
closure2.__workletHash = 16224520186325;
closure2.__initData = env3_11;
object.onBeginDrag = closure2;
const onEndDrag_746492 = onEndDrag_74649;
onEndDrag_746492.__closure = {thumbnailsScrolling: thumbnailsScrollingBinding, SCROLLING_DRAG: 2};
onEndDrag_746492.__workletHash = 5779899826871;
onEndDrag_746492.__initData = env3_12;
object.onEndDrag = onEndDrag_746492;
const onScroll_746502 = onScroll_74650;
const object4 = {variableWidthThumbnailsEnabled: false};
const thumbnailScrollPositionsBinding = thumbnailScrollPositions;
object4.thumbnailScrollPositions = thumbnailScrollPositionsBinding;
object4.thumbnailSize = a0;
object4.swipeSource = swipeSourceBinding;
object4.maxIndex = a1;
const thumbnailsIndexBinding = thumbnailsIndex;
object4.thumbnailsIndex = thumbnailsIndexBinding;
const thumbnailsAnimateToBinding = thumbnailsAnimateTo;
object4.thumbnailsAnimateTo = thumbnailsAnimateToBinding;
object4.selectedIndex = selectedIndex;
const viewerScrollingBinding = viewerScrolling;
object4.viewerScrolling = viewerScrollingBinding;
object4.thumbnailsScrolling = thumbnailsScrollingBinding;
const runOnJS = ReanimatedRexportModule.runOnJS;
object4.runOnJS = runOnJS;
object4.onSelectedIndexChange = closure;
onScroll_746502.__closure = object4;
onScroll_746502.__workletHash = 10605529664479;
onScroll_746502.__initData = env3_13;
object.onScroll = onScroll_746502;
closure = function() {
var thumbnailsScrollingBinding = thumbnailsScrolling;
thumbnailsScrollingBinding.set(4 | thumbnailsScrollingBinding.get());
swipeSource.set('thumbnails');
};
closure.__closure = {thumbnailsScrolling: thumbnailsScrollingBinding, SCROLLING_MOMENTUM: 4,
swipeSource: swipeSourceBinding};
closure.__workletHash = 4138169755088;
closure.__initData = env3_14;
object.onMomentumBegin = closure;
closure = onMomentumEnd_74652;
closure.__closure = {thumbnailsScrolling: thumbnailsScrollingBinding, SCROLLING_MOMENTUM: 4};
closure.__workletHash = 1471443652144;
closure.__initData = env3_15;
object.onMomentumEnd = closure;
const value6 = Reflect.apply(useAnimatedScrollHandler, ReanimatedRexportModule, [object]);
const binding = env3_4;
const value7 = binding.useCallback(function(a0) {
if (!zoomed.get()) {
thumbnailsAnimateTo.set(a0);
swipeSource.set('thumbnails');
}
}, []);
const value8 = binding.useCallback(_fun74654, [value2]);
let useDerivedValue = ReanimatedRexportModule.useDerivedValue;
closure = useThumbnailsPropsR;
object = {thumbnailsAnimateTo: thumbnailsAnimateToBinding, variableWidthThumbnailsEnabled: false};
object.runOnJS = runOnJS;
object.scrollVarWidthThumbnails = value8;
const scrollTo = ReanimatedRexportModule.scrollTo;
object.scrollTo = scrollTo;
object.ref = value2;
object.thumbnailSize = a0;
closure.__closure = object;
closure.__workletHash = 1697086875584;
closure.__initData = env3_16;
Reflect.apply(useDerivedValue, ReanimatedRexportModule, [closure]);
const value9 = binding.useCallback(_fun74656, [value2]);
useDerivedValue = ReanimatedRexportModule.useDerivedValue;
closure = useThumbnailsPropsZ;
const viewerPosBinding = viewerPos;
closure.__closure = {viewerScrolling: viewerScrollingBinding, thumbnailsIndex: thumbnailsIndexBinding,
viewerPos: viewerPosBinding, variableWidthThumbnailsEnabled: false, runOnJS: runOnJS,
lerpScrollVarWidthThumbnails: value9, scrollTo: scrollTo, ref: value2, thumbnailSize: a0};
closure.__workletHash = 10477949154269;
closure.__initData = env3_17;
Reflect.apply(useDerivedValue, ReanimatedRexportModule, [closure]);
const sourcesBinding = sources;
const value10 = sourcesBinding.map(function(a0, a1) {
return a1;
});
const value11 = sourcesBinding.map(_fun74659);
useDerivedValue = ReanimatedRexportModule.useDerivedValue;
closure = ee;
object = {thumbnailsScrolling: thumbnailsScrollingBinding};
object.interpolate = ReanimatedRexportModule.interpolate;
object.viewerPos = viewerPosBinding;
object.interpolateInput = value10;
object.interpolateOutput = value11;
closure.__closure = object;
closure.__workletHash = 10097839523885;
closure.__initData = env3_18;
const value12 = Reflect.apply(useDerivedValue, ReanimatedRexportModule, [closure]);
const value14 = (width - a0) / 2 - value4.left;
let useAnimatedStyle = ReanimatedRexportModule.useAnimatedStyle;
closure = useThumbnailsPropsTe;
object = {viewerScrolling: viewerScrollingBinding, headerBufferSize: value14, margin: value12};
const withSpring = (SpringModule).withSpring;
object.withSpring = withSpring;
closure.__closure = object;
closure.__workletHash = 11328769587377;
closure.__initData = env3_19;
const value15 = Reflect.apply(useAnimatedStyle, ReanimatedRexportModule, [closure]);
thumbnailScrollPositionsBinding[thumbnailScrollPositionsBinding.length - 1];
const value17 = (width - a0) / 2 - value4.right;
useAnimatedStyle = ReanimatedRexportModule.useAnimatedStyle;
closure = useThumbnailsPropsNe;
closure.__closure = {viewerScrolling: viewerScrollingBinding, footerBufferSize: value17, margin: value12,
withSpring: withSpring};
closure.__workletHash = 10532164558483;
closure.__initData = env3_20;
const value18 = Reflect.apply(useAnimatedStyle, ReanimatedRexportModule, [closure]);
const value19 = binding.useCallback(_fun74663, []);
useDerivedValue = ReanimatedRexportModule.useDerivedValue;
closure = function() {
return !zoomed.get();
};
closure.__closure = {zoomed: zoomed};
closure.__workletHash = 7667674289153;
closure.__initData = env3_24;
return {ref: value2, headerBufferStyle: value15, headerBufferSize: value14, footerBufferStyle: value18,
footerBufferSize: value17, scrollEnabled: Reflect.apply(useDerivedValue, ReanimatedRexportModule, [closure]),
onScroll: value6, onSelect: value7, useThumbnailStyle: value19, screenWidth: width, screenHeight: height,
itemSize: function(a0, a1) {
return THUMBNAIL_WIDTH_MARGIN;
}};
function onSelectedIndexChange() { // fn#74647, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:8960, owner: makeMediaViewerSyncer.useThumbnailsProps.onSelectedIndexChange, offset: 0x01d95596, size: 245 bytes, params: 1, frame: 14
const MediaViewerAnalytics = (MediaViewerAnalyticsManagerModule).MediaViewerAnalytics;
const IncrementableMediaViewerActions = (MediaViewerAnalyticsManagerModule).IncrementableMediaViewerActions;
let value = environment.__proto__;
if (swipeSource.get() === 'thumbnails') {
value = environment.__proto__.__proto__.__proto__.__proto__;
MediaViewerAnalytics.markActionPerformed(IncrementableMediaViewerActions.THUMBNAIL_SWIPE);
} else {
value = swipeSource.get();
if (value === 'viewer') {
value = environment.__proto__.__proto__.__proto__.__proto__;
MediaViewerAnalytics.markActionPerformed(IncrementableMediaViewerActions.VIEWER_SWIPE);
}
}
value = environment.__proto__.__proto__.__proto__.__proto__;
const markActionPerformed = MediaViewerAnalytics.markActionPerformed;
const SELECTED_ITEM_CHANGE = IncrementableMediaViewerActions.SELECTED_ITEM_CHANGE;
Reflect.apply(markActionPerformed, MediaViewerAnalytics, [SELECTED_ITEM_CHANGE]);
}
function useThumbnailsPropsOnEndDrag() { // fn#74649, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:9557, owner: makeMediaViewerSyncer.useThumbnailsProps.onEndDrag, offset: 0x01d956c4, size: 40 bytes, params: 1, frame: 12
const value = environment.__proto__;
const thumbnailsScrollingBinding = thumbnailsScrolling;
thumbnailsScrollingBinding.set(-3 & thumbnailsScrollingBinding.get());
}
function useThumbnailsPropsOnScroll({contentOffset}) { // fn#74650, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:9700, owner: makeMediaViewerSyncer.useThumbnailsProps.onScroll, offset: 0x01d956ec, size: 427 bytes, params: 2, frame: 18
var r2;
var Math;
var abs;
var Math2;
var max;
var Math3;
var thumbnailsIndexBinding;
var set;
var viewerScrollingBinding;
var value12;
var selectedIndexBinding;
var value14;
var moduleValue;
const x = contentOffset.x;
var value;
const value2 = x / env0_0;
if (swipeSource.get() === 'thumbnails') {
Math = global.Math;
max = Math.max;
Math3 = global.Math;
thumbnailsIndex.set(Reflect.apply(max, Math, [0, Math3.min(global.Math.round(value2), require)]));
} else {
Math = global.Math;
abs = Math.abs;
Math2 = global.Math;
if (Reflect.apply(abs, Math, [Math2.round(value2) - value2]) < 0.01) {
Math = global.Math;
max = Math.max;
Math3 = global.Math;
thumbnailsIndex.set(Reflect.apply(max, Math, [0, Math3.min(global.Math.round(value2), require)]));
}
}
if (thumbnailsAnimateTo.get() >= 0) {
value = thumbnailsIndex.get();
thumbnailsAnimateToBinding = thumbnailsAnimateTo;
if (value === thumbnailsAnimateToBinding.get()) {
thumbnailsAnimateTo.set(-1);
selectedIndexBinding = selectedIndex;
set = selectedIndexBinding.set;
thumbnailsIndexBinding = thumbnailsIndex;
Reflect.apply(set, selectedIndexBinding, [thumbnailsIndexBinding.get()]);
}
} else {
viewerScrollingBinding = viewerScrolling;
r2 = viewerScrollingBinding.get() !== 0 || thumbnailsScrolling.get() !== 0;
if (r2) {
value12 = thumbnailsIndex.get();
selectedIndexBinding = selectedIndex;
r2 = value12 !== selectedIndexBinding.get();
}
if (r2) {
selectedIndexBinding = selectedIndex;
set = selectedIndexBinding.set;
thumbnailsIndexBinding = thumbnailsIndex;
Reflect.apply(set, selectedIndexBinding, [thumbnailsIndexBinding.get()]);
value14 = environment.__proto__.__proto__.__proto__.__proto__;
moduleValue = require(4017) /* metro dependency 4017: ReanimatedRexport */;
moduleValue.runOnJS(onSelectedIndexChange)();
}
}
}
function useThumbnailsPropsOnMomentumEnd() { // fn#74652, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:10545, owner: makeMediaViewerSyncer.useThumbnailsProps.onMomentumEnd, offset: 0x01d958d0, size: 40 bytes, params: 1, frame: 12
const value = environment.__proto__;
const thumbnailsScrollingBinding = thumbnailsScrolling;
thumbnailsScrollingBinding.set(-5 & thumbnailsScrollingBinding.get());
}
function _fun74654(a0) { // fn#74654, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:10766, offset: 0x01d95934, size: 71 bytes, params: 2, frame: 18
let value = environment.__proto__;
const scrollStart = thumbnailScrollPositions[a0].scrollStart;
value = environment.__proto__.__proto__.__proto__.__proto__;
(ReanimatedRexportModule).scrollTo(env0_2, scrollStart, 0, true);
}
function useThumbnailsPropsR() { // fn#74655, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:10855, owner: makeMediaViewerSyncer.useThumbnailsProps.R, offset: 0x01d9597b, size: 96 bytes, params: 1, frame: 18
var value3;
var moduleValue;
const value = environment.__proto__;
if (!(thumbnailsAnimateTo.get() < 0)) {
value3 = environment.__proto__.__proto__.__proto__.__proto__;
moduleValue = require(4017) /* metro dependency 4017: ReanimatedRexport */;
moduleValue.scrollTo(env0_2, thumbnailsAnimateTo.get() * env0_0, 0, true);
}
}
function _fun74656(a0) { // fn#74656, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:11152, offset: 0x01d959db, size: 85 bytes, params: 2, frame: 18
let value = environment.__proto__.__proto__.__proto__.__proto__;
value = Reflect.apply((require(9563) /* metro dependency 9563: portraitThumbnailHelpers */).lerpVarWidthThumbnailScrollBounds,
value, [thumbnailScrollPositions, a0]);
(ReanimatedRexportModule).scrollTo(env0_2, value, 0, false);
}
function useThumbnailsPropsZ() { // fn#74657, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:11271, owner: makeMediaViewerSyncer.useThumbnailsProps.Z, offset: 0x01d95a30, size: 132 bytes, params: 1, frame: 18
var r0;
var value4;
var viewerPosBinding;
var value6;
var moduleValue;
const value = environment.__proto__;
const value3 = viewerScrolling.get() !== 0;
if (value3) {
value4 = thumbnailsIndex.get();
viewerPosBinding = viewerPos;
r0 = value4 !== viewerPosBinding.get();
} else {
r0 = value3;
}
if (r0) {
value6 = environment.__proto__.__proto__.__proto__.__proto__;
moduleValue = require(4017) /* metro dependency 4017: ReanimatedRexport */;
moduleValue.scrollTo(env0_2, viewerPos.get() * env0_0, 0, false);
}
}
function _fun74659(a0) { // fn#74659, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:11643, offset: 0x01d95ab4, size: 129 bytes, params: 2, frame: 18
var r0;
var Math;
var max;
var Math2;
let value = environment.__proto__.__proto__.__proto__.__proto__;
const value2 = (MediaSourceUtilModule).flattenSource(a0);
if (value2 == null) {
r0 = 0;
} else {
Math = global.Math;
max = Math.max;
Math2 = global.Math;
value = Reflect.apply(max, Math,
[Math2.min(value2.width * (THUMBNAIL_HEIGHT / value2.height), THUMBNAIL_MAX_WIDTH), THUMBNAIL_MIN_WIDTH]) - THUMBNAIL_MIN_WIDTH;
value /= 2;
r0 = value;
}
return r0;
}
function ee() { // fn#74660, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:11781, owner: makeMediaViewerSyncer.useThumbnailsProps.ee, offset: 0x01d95b35, size: 96 bytes, params: 1, frame: 18
var r0;
var value4;
var moduleValue;
var interpolate;
let value = environment.__proto__;
const value2 = thumbnailsScrolling.get();
const value3 = 0;
if (value2 > value3) {
r0 = value3;
} else {
value4 = environment.__proto__.__proto__.__proto__.__proto__;
moduleValue = require(4017) /* metro dependency 4017: ReanimatedRexport */;
interpolate = moduleValue.interpolate;
value = viewerPos.get();
value = -Reflect.apply(interpolate, moduleValue, [value, env0_4, env0_5, 'clamp']);
r0 = value;
}
return r0;
}
function useThumbnailsPropsTe() { // fn#74661, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:12064, owner: makeMediaViewerSyncer.useThumbnailsProps.te, offset: 0x01d95b95, size: 125 bytes, params: 1, frame: 15
var r1;
var withSpring;
var binding;
var binding2;
var binding3;
let value = environment.__proto__;
value = viewerScrolling.get();
if (value > 0) {
binding = env0_7;
binding3 = env0_6;
r1 = binding + binding3.get();
} else {
value = environment.__proto__.__proto__.__proto__.__proto__;
value = require(4577) /* metro dependency 4577: spring */;
withSpring = value.withSpring;
binding = env0_7;
binding2 = env0_6;
value = Reflect.apply(withSpring, value, [binding + binding2.get(), {overshootClamping: true}]);
r1 = value;
}
return {width: r1};
}
function useThumbnailsPropsNe() { // fn#74662, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:12368, owner: makeMediaViewerSyncer.useThumbnailsProps.ne, offset: 0x01d95c12, size: 125 bytes, params: 1, frame: 15
var r1;
var withSpring;
var binding;
var binding2;
var binding3;
let value = environment.__proto__;
value = viewerScrolling.get();
if (value > 0) {
binding = ConstantsModule.THUMBNAIL_MIN_WIDTH;
binding3 = env0_6;
r1 = binding + binding3.get();
} else {
value = environment.__proto__.__proto__.__proto__.__proto__;
value = require(4577) /* metro dependency 4577: spring */;
withSpring = value.withSpring;
binding = ConstantsModule.THUMBNAIL_MIN_WIDTH;
binding2 = env0_6;
value = Reflect.apply(withSpring, value, [binding + binding2.get(), {overshootClamping: true}]);
r1 = value;
}
return {width: r1};
}
function _fun74663({width, height}, a1) { // fn#74663, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:12622, offset: 0x01d95c8f, size: 419 bytes, params: 3, frame: 27
const env0_0 = a1;
let useDerivedValue = ReanimatedRexportModule.useDerivedValue;
let closure = i_74664;
const interpolate = ReanimatedRexportModule.interpolate;
const viewerPosBinding = viewerPos;
closure.__closure = {interpolate: interpolate, viewerPos: viewerPosBinding, index: a1};
closure.__workletHash = 5784737783661;
closure.__initData = env4_21;
const value3 = Reflect.apply(useDerivedValue, ReanimatedRexportModule, [closure]);
const Math = global.Math;
const max = Math.max;
const Math2 = global.Math;
const value6 = Reflect.apply(max, Math,
[Math2.min(width * (THUMBNAIL_HEIGHT / height), THUMBNAIL_MAX_WIDTH), THUMBNAIL_MIN_WIDTH]);
useDerivedValue = ReanimatedRexportModule.useDerivedValue;
closure = l_74665;
closure.__closure = {thumbnailsScrolling: thumbnailsScrolling, THUMBNAIL_MIN_WIDTH: THUMBNAIL_MIN_WIDTH,
interpolate: interpolate, viewerPos: viewerPosBinding, index: a1, sourceWidth: value6};
closure.__workletHash = 12440745987072;
closure.__initData = env4_22;
const value7 = Reflect.apply(useDerivedValue, ReanimatedRexportModule, [closure]);
const useAnimatedStyle = ReanimatedRexportModule.useAnimatedStyle;
closure = u_74666;
object = {};
object.viewerScrolling = viewerScrolling;
object._width = value7;
object.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring;
object.THUMBNAIL_HEIGHT = THUMBNAIL_HEIGHT;
object.opacity = value3;
closure.__closure = object;
closure.__workletHash = 513826663139;
closure.__initData = env4_23;
return Reflect.apply(useAnimatedStyle, ReanimatedRexportModule, [closure]);
function i_74664() { // fn#74664, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:12670, offset: 0x01d95e32, size: 107 bytes, params: 1, frame: 18
let value = environment.__proto__.__proto__.__proto__.__proto__.__proto__;
value = require(4017) /* metro dependency 4017: ReanimatedRexport */;
return value.interpolate(viewerPos.get(), [require - 1, require, require + 1], [0.4, 1, 0.4], 'clamp');
}
function l_74665() { // fn#74665, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:12924, offset: 0x01d95e9d, size: 155 bytes, params: 1, frame: 20
var r0;
var value3;
var moduleValue;
var interpolate;
let value = environment.__proto__.__proto__;
if (thumbnailsScrolling.get() > 0) {
value = environment.__proto__.__proto__.__proto__.__proto__.__proto__;
r0 = THUMBNAIL_MIN_WIDTH;
} else {
value3 = environment.__proto__.__proto__.__proto__.__proto__.__proto__;
moduleValue = require(4017) /* metro dependency 4017: ReanimatedRexport */;
interpolate = moduleValue.interpolate;
value = viewerPos.get();
value = Reflect.apply(interpolate, moduleValue, [value, [require - 1, require, require + 1],
[THUMBNAIL_MIN_WIDTH,
env0_2, THUMBNAIL_MIN_WIDTH], 'clamp']);
r0 = value;
}
return r0;
}
function u_74666() { // fn#74666, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:13205, offset: 0x01d95f38, size: 140 bytes, params: 1, frame: 15
var r1;
const object = {};
let value = environment.__proto__.__proto__;
value = viewerScrolling.get();
if (value > 0) {
r1 = env0_3.get();
} else {
value = environment.__proto__.__proto__.__proto__.__proto__.__proto__;
value = require(4577) /* metro dependency 4577: spring */;
value = value.withSpring(env0_3.get(), {overshootClamping: true});
r1 = value;
}
object.width = r1;
value = environment.__proto__.__proto__.__proto__.__proto__.__proto__;
object.height = THUMBNAIL_HEIGHT;
object.opacity = env0_1.get();
return object;
}
}
}
function useViewerProps() { // fn#74669, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:13806, owner: makeMediaViewerSyncer.useViewerProps, offset: 0x01d95fe2, size: 658 bytes, params: 1, frame: 31
var environment;
let value = environment.__proto__.__proto__.__proto__;
const value2 = (ReanimatedRexportModule).useAnimatedRef();
const {width,
height} = (MediaViewerDimensionsContextModule).useMediaViewerDimensions();
let useDerivedValue = ReanimatedRexportModule.useDerivedValue;
let closure = useViewerPropsI;
let object = {};
const thumbnailsAnimateToBinding = thumbnailsAnimateTo;
object.thumbnailsAnimateTo = thumbnailsAnimateToBinding;
const scrollTo = ReanimatedRexportModule.scrollTo;
object.scrollTo = scrollTo;
object.ref = value2;
object.screenWidth = width;
closure.__closure = object;
closure.__workletHash = 11860326453239;
closure.__initData = env3_25;
Reflect.apply(useDerivedValue, ReanimatedRexportModule, [closure]);
useDerivedValue = ReanimatedRexportModule.useDerivedValue;
closure = useViewerPropsL;
const thumbnailsScrollingBinding = thumbnailsScrolling;
const viewerScrollingBinding = viewerScrolling;
closure.__closure = {thumbnailsScrolling: thumbnailsScrollingBinding, viewerScrolling: viewerScrollingBinding,
thumbnailsAnimateTo: thumbnailsAnimateToBinding, scrollTo: scrollTo, ref: value2,
thumbnailsIndex: thumbnailsIndex, screenWidth: width};
closure.__workletHash = 16855593341498;
closure.__initData = env3_26;
Reflect.apply(useDerivedValue, ReanimatedRexportModule, [closure]);
const binding = env3_4;
const value5 = binding.useMemo(_fun74672, []);
const value6 = ReanimatedRexportModule.useSharedValue(0);
const useAnimatedScrollHandler = ReanimatedRexportModule.useAnimatedScrollHandler;
object = {};
object.onBeginDrag = value5.onBeginDrag;
object.onEndDrag = value5.onEndDrag;
closure = onScroll_74678;
closure.__closure = {contentSizeLastChangedAt: value6, IS_ANDROID: env3_10, selectedIndex: selectedIndex,
scrollTo: scrollTo, ref: value2, screenWidth: width, viewerScrolling: viewerScrollingBinding,
thumbnailsScrolling: thumbnailsScrollingBinding, thumbnailsAnimateTo: thumbnailsAnimateToBinding,
onScrollWorklets: value5};
closure.__workletHash = 7511342747846;
closure.__initData = env3_32;
object.onScroll = closure;
object.onMomentumBegin = value5.onMomentumBegin;
object.onMomentumEnd = value5.onMomentumEnd;
value = Reflect.apply(useAnimatedScrollHandler, ReanimatedRexportModule, [object]);
const value7 = binding.useCallback(_fun74679, [value2, width, value6]);
binding.useEffect(_fun74680, [width, height, value2]);
return {ref: value2, onScroll: value, onContentSizeChange: value7, useItemVisible: binding.useCallback(_fun74681,
[])};
function useViewerPropsI() { // fn#74670, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:13938, owner: makeMediaViewerSyncer.useViewerProps.i, offset: 0x01d96274, size: 100 bytes, params: 1, frame: 17
var value3;
var moduleValue;
const value = environment.__proto__;
if (thumbnailsAnimateTo.get() !== -1) {
value3 = environment.__proto__.__proto__.__proto__.__proto__;
moduleValue = require(4017) /* metro dependency 4017: ReanimatedRexport */;
moduleValue.scrollTo(env0_0, thumbnailsAnimateTo.get() * width, 0, false);
}
}
function useViewerPropsL() { // fn#74671, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:14157, owner: makeMediaViewerSyncer.useViewerProps.l, offset: 0x01d962d8, size: 145 bytes, params: 1, frame: 18
var value7;
var moduleValue;
const value = environment.__proto__;
let r0 = thumbnailsScrolling.get() === 0 || viewerScrolling.get() > 0;
r0 = !r0 ? thumbnailsAnimateTo.get() !== -1 : r0;
if (!r0) {
value7 = environment.__proto__.__proto__.__proto__.__proto__;
moduleValue = require(4017) /* metro dependency 4017: ReanimatedRexport */;
moduleValue.scrollTo(env0_0, thumbnailsIndex.get() * width, 0, false);
}
}
function _fun74672() { // fn#74672, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:14449, offset: 0x01d96369, size: 315 bytes, params: 1, frame: 10
const object = {};
let closure = function() {
var viewerScrollingBinding = viewerScrolling;
viewerScrollingBinding.set(2 | viewerScrollingBinding.get());
swipeSource.set('viewer');
};
let viewerScrollingBinding = viewerScrolling;
const swipeSourceBinding = swipeSource;
closure.__closure = {viewerScrolling: viewerScrollingBinding, SCROLLING_DRAG: 2, swipeSource: swipeSourceBinding};
closure.__workletHash = 1082965969005;
closure.__initData = env4_27;
object.onBeginDrag = closure;
closure = onEndDrag_74674;
closure.__closure = {viewerScrolling: viewerScrollingBinding, SCROLLING_DRAG: 2};
closure.__workletHash = 1722948238280;
closure.__initData = env4_28;
object.onEndDrag = closure;
closure = function(a0) {
viewerPos.set(a0);
};
closure.__closure = {viewerPos: viewerPos};
closure.__workletHash = 3817181878424;
closure.__initData = env4_29;
object.onScroll = closure;
closure = function() {
var viewerScrollingBinding = viewerScrolling;
viewerScrollingBinding.set(4 | viewerScrollingBinding.get());
swipeSource.set('viewer');
};
closure.__closure = {viewerScrolling: viewerScrollingBinding, SCROLLING_MOMENTUM: 4,
swipeSource: swipeSourceBinding};
closure.__workletHash = 16635271467463;
closure.__initData = env4_30;
object.onMomentumBegin = closure;
closure = onMomentumEnd_74677;
closure.__closure = {viewerScrolling: viewerScrollingBinding, SCROLLING_MOMENTUM: 4};
closure.__workletHash = 8806989101472;
closure.__initData = env4_31;
object.onMomentumEnd = closure;
return object;
function onEndDrag_74674() { // fn#74674, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:14644, offset: 0x01d964dd, size: 40 bytes, params: 1, frame: 12
const value = environment.__proto__.__proto__;
const viewerScrollingBinding = viewerScrolling;
viewerScrollingBinding.set(-3 & viewerScrollingBinding.get());
}
function onMomentumEnd_74677() { // fn#74677, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:15075, offset: 0x01d96556, size: 40 bytes, params: 1, frame: 12
const value = environment.__proto__.__proto__;
const viewerScrollingBinding = viewerScrolling;
viewerScrollingBinding.set(-5 & viewerScrollingBinding.get());
}
}
function useViewerPropsOnScroll(a0) { // fn#74678, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:15351, owner: makeMediaViewerSyncer.useViewerProps.onScroll, offset: 0x01d9657e, size: 281 bytes, params: 2, frame: 20
var r4;
var selectedIndexBinding;
var moduleValue;
var scrollTo;
const Date = global.Date;
let value = Date.now();
let binding = env0_3;
const get = binding.get;
value -= Reflect.apply(get, binding, []);
if (env4_10) {
if (value < 500) {
if (a0.contentOffset.x !== 0) {
value = environment.__proto__;
r4 = viewerScrolling.get() === 0 && thumbnailsScrolling.get() === 0;
if (r4) {
value = thumbnailsAnimateTo.get();
value = value === -1;
r4 = value;
}
if (!r4) {
binding = env0_2;
binding.onScroll(a0.contentOffset.x / width);
}
} else {
value = environment.__proto__;
selectedIndexBinding = selectedIndex;
if (selectedIndexBinding.get() !== 0) {
moduleValue = require(4017) /* metro dependency 4017: ReanimatedRexport */;
scrollTo = moduleValue.scrollTo;
binding = env0_0;
value = selectedIndex.get();
value *= width;
Reflect.apply(scrollTo, moduleValue, [binding, value, a0.contentOffset.y, false]);
} else {
value = environment.__proto__;
r4 = viewerScrolling.get() === 0 && thumbnailsScrolling.get() === 0;
if (r4) {
value = thumbnailsAnimateTo.get();
value = value === -1;
r4 = value;
}
if (!r4) {
binding = env0_2;
binding.onScroll(a0.contentOffset.x / width);
}
}
}
} else {
value = environment.__proto__;
r4 = viewerScrolling.get() === 0 && thumbnailsScrolling.get() === 0;
if (r4) {
value = thumbnailsAnimateTo.get();
value = value === -1;
r4 = value;
}
if (!r4) {
binding = env0_2;
binding.onScroll(a0.contentOffset.x / width);
}
}
} else {
value = environment.__proto__;
r4 = viewerScrolling.get() === 0 && thumbnailsScrolling.get() === 0;
if (r4) {
value = thumbnailsAnimateTo.get();
value = value === -1;
r4 = value;
}
if (!r4) {
binding = env0_2;
binding.onScroll(a0.contentOffset.x / width);
}
}
}
function _fun74679() { // fn#74679, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:15885, offset: 0x01d96697, size: 91 bytes, params: 1, frame: 14
let value = environment.__proto__;
value = selectedIndex.get();
value *= width;
const current = env0_0.current;
if (current != null) {
current.scrollTo(value, false);
}
const binding = env0_3;
const set = binding.set;
const Date = global.Date;
Reflect.apply(set, binding, [Date.now()]);
}
function _fun74680() { // fn#74680, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:15988, offset: 0x01d966f2, size: 32 bytes, params: 1, frame: 9
const current = env0_0.current;
if (current != null) {
current.reset();
}
}
function _fun74681(a0) { // fn#74681, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:16062, offset: 0x01d96712, size: 228 bytes, params: 2, frame: 23
const env0_0 = a0;
const binding = env4_4;
const useState = binding.useState;
const selectedIndexBinding = selectedIndex;
const get = selectedIndexBinding.get;
const value4 = env4_3(Reflect.apply(useState, binding, [a0 === Reflect.apply(get, selectedIndexBinding, [])]), 2);
const property = value4[0];
const property2 = value4[1];
const useAnimatedReaction = ReanimatedRexportModule.useAnimatedReaction;
const o_746822 = o_74682;
o_746822.__closure = {index: a0, selectedIndex: selectedIndexBinding};
o_746822.__workletHash = 16337538404179;
o_746822.__initData = env4_33;
const l_746832 = l_74683;
object = {};
object.runOnJS = ReanimatedRexportModule.runOnJS;
object.setVisible = property2;
l_746832.__closure = object;
l_746832.__workletHash = 17035713313425;
l_746832.__initData = env4_34;
Reflect.apply(useAnimatedReaction, ReanimatedRexportModule, [o_746822, l_746832]);
return property;
function o_74682() { // fn#74682, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:16162, offset: 0x01d967f6, size: 29 bytes, params: 1, frame: 10
const binding = env0_0;
const selectedIndexBinding = selectedIndex;
const get = selectedIndexBinding.get;
return binding === Reflect.apply(get, selectedIndexBinding, []);
}
function l_74683(a0, a1) { // fn#74683, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9746:16267, offset: 0x01d96813, size: 73 bytes, params: 3, frame: 13
let value = a1 != null;
if (value && a1 !== a0) {
value = environment.__proto__.__proto__.__proto__.__proto__.__proto__;
value = require(4017) /* metro dependency 4017: ReanimatedRexport */;
value.runOnJS(env0_1)(a0);
}
}
}
}
}
}
}
}
global.__d(_fun74641, 9560, [57, 31, 9561, 477, 4017, 9562, 1585, 9547, 9563, 9546, 4577,
2]) /* metro module 9560, dependencies: [57, 31, 9561, 477, 4017, 9562, 1585, 9547, 9563, 9546, 4577, 2] */;