// Metro module 12319 (f12320). import { useState, useRef, useCallback, useEffect, memo } from "react"; import { StyleSheet, View } from "react-native"; import * as _PlatformUtils from "../../../../utils/PlatformUtils"; import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport"; import ReanimatedRexport, { useSharedValue, useAnimatedRef, useAnimatedStyle, useDerivedValue, useAnimatedProps } from "../../../reanimated/ReanimatedRexport"; import { useMediaViewerPanGestureConfig, useMediaViewerPanGesture } from "../useMediaViewerPanGesture"; import { MediaViewerItem } from "./MediaViewerItem"; import useStateFromSharedValue from "../../../reanimated/native/useStateFromSharedValue"; import { GestureDetector } from "../../../../_bundle/Module5273"; import { AnimatedFastList } from "../../../../lib/native/FastList"; import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../../app_analytics/useAnalyticsLocations"; import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation"; import { useMediaViewerDimensions, MediaViewerDimensionsProvider } from "../MediaViewerDimensionsContext"; import useMediaViewerClosePosition from "../useMediaViewerClosePosition"; import * as _timing from "../../../../design/animation/reanimated/timing/timing"; import { unpauseCurrentVideoIfNeeded } from "../useVideoControls"; import { useOrientationListener } from "../../../device/native/DeviceOrientation"; import StatusBar_android from "../../../status_bar/native/components/StatusBar.android"; import REAWorkaroundView from "../../../reanimated/native/REAWorkaroundView"; import HomeIndicator from "../../../voice_panel/native/HomeIndicator"; let isAndroid, __initData, __initData2, Component, __initData3, __initData4, __initData5, __initData6, __initData7; const MediaViewer = function MediaViewer(props) { let ref, callback, ref2; const { onClose, onLongPress: onLongPress2, originLayout: originLayout2, renderMedia: renderMedia2, renderOverlay, swipeVelocityThreshold, syncer } = props; const { index, sources: sources2, useViewerProps, zoomed: zoomed2 } = syncer; ref = void 0; callback = void 0; ref2 = void 0; const analyticsLocations = useAnalyticsLocations([AnalyticsLocation.MEDIA_VIEWER]).analyticsLocations; const [state, setState] = useState(true); const mediaViewerDimensions = useMediaViewerDimensions(); const { width, height } = mediaViewerDimensions; const mediaViewerClosePosition = useMediaViewerClosePosition({ index, onClose, sources: sources2, windowHeight: height, windowWidth: width }); let c19791_2 = mediaViewerClosePosition; const sharedValue = useSharedValue(0); const sharedValue2 = useSharedValue(false); const animatedRef = useAnimatedRef(); const r5 = sources2.length > 1; let c19791_6 = r5; const r79 = useViewerProps(); const { ref: ref3, onScroll, onContentSizeChange, useItemVisible: useItemVisible2 } = r79; const mediaViewerPanGestureConfig = useMediaViewerPanGestureConfig(mediaViewerClosePosition, swipeVelocityThreshold, onClose); const { dismiss, translatePos, isClosing, isInteracting, overlayEnabled } = mediaViewerPanGestureConfig; const absoluteFillObject = StyleSheet.absoluteFillObject; const M = () => { const r6 = Math; const r19 = sharedValue.get(); const r25 = translatePos.get(); return { ...absoluteFillObject, height, backgroundColor: "black", opacity: r6.min(r19, _ReanimatedRexport.interpolate(r25, [-c19791_2, 0, c19791_2], [0, 1, 0])) }; }; M.__closure = { absoluteFillObject, windowHeight: height, entranceAnimationDriver: sharedValue, interpolate: _ReanimatedRexport.interpolate, translatePos, closePosition: mediaViewerClosePosition }; M.__workletHash = 10332062530694; M.__initData = __initData3; const animatedStyle = useAnimatedStyle(M); const [r99] = useState({ ...StyleSheet.absoluteFillObject, backgroundColor: "transparent" }); const P = () => { let r39; const r19 = isClosing.get(); let opacity = 0; if (!r19) { const r22 = sharedValue2.get(); opacity = 0; if (!r22) { if (overlayEnabled.get() && !isInteracting.get()) { r39 = _timing.withTiming(1, { easing: _ReanimatedRexport.Easing.linear, duration: 150 }); } else { const r51 = { easing: _ReanimatedRexport.Easing.linear, duration: 75 }; const n = function n() { _ReanimatedRexport.runOnJS(setState)(false); }; n.__closure = { runOnJS: _ReanimatedRexport.runOnJS, setShowHeader: setState }; n.__workletHash = 11572173694016; n.__initData = __initData5; r39 = _timing.withTiming(0, r51, "respect-motion-settings", n); } opacity = r39; } } return { opacity }; }; P.__closure = { isClosing, hideRelayoutSharedValue: sharedValue2, overlayEnabled, isInteracting, withTiming: _timing.withTiming, Easing: _ReanimatedRexport.Easing, runOnJS: _ReanimatedRexport.runOnJS, setShowHeader: setState }; P.__workletHash = 14874736878670; P.__initData = __initData4; const animatedStyle2 = useAnimatedStyle(P); const x = function x() { if (overlayEnabled.get() && !isInteracting.get()) { _ReanimatedRexport.runOnJS(setState)(true); } }; x.__closure = { overlayEnabled, isInteracting, runOnJS: _ReanimatedRexport.runOnJS, setShowHeader: setState }; x.__workletHash = 2199049578465; x.__initData = __initData6; useDerivedValue(x); const le = () => ({ ...absoluteFillObject, alignItems: "center", justifyContent: "center", transform: [{ translateY: translatePos.get() }], opacity: sharedValue2.get() ? 0 : _timing.withTiming(1, { easing: _ReanimatedRexport.Easing.linear, duration: 75 }) }); le.__closure = { absoluteFillObject, translatePos, hideRelayoutSharedValue: sharedValue2, withTiming: _timing.withTiming, Easing: _ReanimatedRexport.Easing }; le.__workletHash = 8244409104374; le.__initData = __initData7; const animatedStyle3 = useAnimatedStyle(le); ref = useRef(null); callback = useCallback(() => { if (c19791_6 && animatedRef.current != null) { sharedValue2.set(true); clearTimeout(ref.current); ref.current = setTimeout(() => { sharedValue2.set(false); }, 250); } }, [r5, animatedRef, sharedValue2]); const callback2 = useCallback(() => { sharedValue2.set(false); }, [sharedValue2]); ref2 = useRef(false); useEffect(() => { if (ref2.current) { callback(); } else { ref2.current = true; } }, [width, height, callback]); useOrientationListener(useCallback((a0, a1) => { if (a0.orientation !== a1.orientation) { callback(); } if (isAndroid) { unpauseCurrentVideoIfNeeded(); } }, [callback])); return ; }; isAndroid = _PlatformUtils.isAndroid(); __initData = { code: "function MediaViewerTsx1(){const{zoomed,pinching}=this.__closure;return!zoomed.get()&&!pinching.get();}" }; __initData2 = { code: "function MediaViewerTsx2(){const{scrollEnabled}=this.__closure;return{scrollEnabled:scrollEnabled.get()};}" }; Component = memo(function({ entranceAnimationDriver, onContentSizeChange, onLongPress, onScroll, originLayout, panGestureConfig, renderMedia, sources, useItemVisible, windowWidth, windowHeight, ref: ref3, index, zoomed }) { let derivedValue, panGestureGenerator; derivedValue = void 0; panGestureGenerator = void 0; const sharedValue3 = useSharedValue(false); const T = () => { const r5 = zoomed.get(); return r5 ? !r5 : !sharedValue3.get(); }; T.__closure = { zoomed, pinching: sharedValue3 }; T.__workletHash = 9157951736691; T.__initData = __initData; derivedValue = useDerivedValue(T); const callback2 = useCallback((a0) => sharedValue3.set(a0.nativeEvent.touches.length === 2), [sharedValue3]); const callback3 = useCallback(() => sharedValue3.set(false), [sharedValue3]); const mediaViewerPanGesture = useMediaViewerPanGesture(panGestureConfig, derivedValue); panGestureGenerator = mediaViewerPanGesture.panGestureGenerator; const nativeGesture = mediaViewerPanGesture.nativeGesture; const callback4 = useCallback((a0, a1) => , [entranceAnimationDriver, onLongPress, originLayout, panGestureConfig, panGestureGenerator, renderMedia, sources, useItemVisible, windowHeight, windowWidth, zoomed]); const H = () => ({ scrollEnabled: derivedValue.get() }); H.__closure = { scrollEnabled: derivedValue }; H.__workletHash = 13550782123441; H.__initData = __initData2; const animatedProps = useAnimatedProps(H); return ; }); __initData3 = { code: "function MediaViewerTsx3(){const{absoluteFillObject,windowHeight,entranceAnimationDriver,interpolate,translatePos,closePosition}=this.__closure;return{...absoluteFillObject,height:windowHeight,backgroundColor:'black',opacity:Math.min(entranceAnimationDriver.get(),interpolate(translatePos.get(),[-closePosition,0,closePosition],[0,1,0]))};}" }; __initData4 = { code: "function MediaViewerTsx4(){const{isClosing,hideRelayoutSharedValue,overlayEnabled,isInteracting,withTiming,Easing,runOnJS,setShowHeader}=this.__closure;return{opacity:isClosing.get()||hideRelayoutSharedValue.get()?0:overlayEnabled.get()&&!isInteracting.get()?withTiming(1,{easing:Easing.linear,duration:150}):withTiming(0,{easing:Easing.linear,duration:75},'respect-motion-settings',function(){runOnJS(setShowHeader)(false);})};}" }; __initData5 = { code: "function MediaViewerTsx5(){const{runOnJS,setShowHeader}=this.__closure;runOnJS(setShowHeader)(false);}" }; __initData6 = { code: "function MediaViewerTsx6(){const{overlayEnabled,isInteracting,runOnJS,setShowHeader}=this.__closure;if(overlayEnabled.get()&&!isInteracting.get()){runOnJS(setShowHeader)(true);}}" }; __initData7 = { code: "function MediaViewerTsx7(){const{absoluteFillObject,translatePos,hideRelayoutSharedValue,withTiming,Easing}=this.__closure;return{...absoluteFillObject,alignItems:'center',justifyContent:'center',transform:[{translateY:translatePos.get()}],opacity:hideRelayoutSharedValue.get()?0:withTiming(1,{easing:Easing.linear,duration:75})};}" }; const r42 = memo(function(a0) { return ; }); export default r42;