/* Metro module 9939; source: modules/media_viewer/native/useMediaViewerPanGesture.tsx; dependencies: [31, 4017, 9551, 9547, 4577, 8994, 5321, 2] */ import UseStableCallback from '../../../hooks/useStableCallback.tsx'; /* Metro dependency 8994 */ 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 ReanimatedRexportModule from '../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */ import * as SpringModule from '../../../design/animation/reanimated/spring/spring.tsx'; /* Metro dependency 4577 */ import * as Module05321Module from '../../../by-id/module-05321.js'; /* Metro dependency 5321 */ function _fun77785(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#77785, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10125:6, offset: 0x01e0bbfd, size: 232 bytes, params: 8, frame: 18 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_4 = {'damping': 15, 'mass': 1, 'stiffness': 250, 'overshootClamping': true, 'restSpeedThreshold': 0.001, 'restDisplacementThreshold': 0.001}; object = {code: 'function useMediaViewerPanGestureTsx1(){const{runOnJS,handleClose}=this.__closure;runOnJS(handleClose)();}'}; object = {code: 'function useMediaViewerPanGestureTsx2(){const{isInteracting,velocity,swipeVelocityThreshold,runOnJS,dismiss,translatePos,withSpring,SPRING_CONFIG}=this.__closure;isInteracting.set(false);const willClose=Math.abs(velocity.get())>swipeVelocityThreshold;if(willClose){runOnJS(dismiss)();}else if(translatePos.get()!==0){translatePos.set(withSpring(0,{velocity:velocity.get(),...SPRING_CONFIG}));}}'}; object = {code: 'function useMediaViewerPanGestureTsx3(_,manager){const{enabled}=this.__closure;if(!enabled.get()){manager.fail();}}'}; object = {code: 'function useMediaViewerPanGestureTsx4({velocityY:velocityY,translationY:translationY}){const{translatePos,start,velocity}=this.__closure;translatePos.set(translationY+start.get().y);velocity.set(velocityY);}'}; object = {code: 'function useMediaViewerPanGestureTsx5(){const{start,translatePos,isInteracting}=this.__closure;start.set({x:0,y:translatePos.get()});isInteracting.set(true);}'}; (FileImportTrackerModule).fileFinishedImporting('modules/media_viewer/native/useMediaViewerPanGesture.tsx'); exports.useMediaViewerPanGestureConfig = useMediaViewerPanGestureConfig; exports.useMediaViewerPanGesture = useMediaViewerPanGesture; function useMediaViewerPanGestureConfig(a0, a1, a2) { // fn#77786, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10125:1385, offset: 0x01e0bce5, size: 339 bytes, params: 4, frame: 25 const env0_0 = a0; const env0_1 = a1; const env0_2 = a2; const value2 = (ReanimatedRexportModule).useSharedValue(false); const env0_3 = value2; const value3 = (ReanimatedRexportModule).useSharedValue(false); const value4 = (ReanimatedRexportModule).useSharedValue(0); const value5 = (ReanimatedRexportModule).useSharedValue(0); const value6 = (ReanimatedRexportModule).useSharedValue({'y': 0, 'x': 0}); const value7 = (ReanimatedRexportModule).useSharedValue(true); const binding = env0_3; let value = binding.useCallback(function() { require(dependencyMap[2]).tryPauseCurrentVideo(); if (importDefault != null) { importDefault(); } var MediaViewerAnalytics = require(dependencyMap[3]).MediaViewerAnalytics; MediaViewerAnalytics.markSessionCompleted(); }, [a2]); value = binding.useCallback(_fun77788, [a0, value, value2, value4, value5]); return binding.useMemo(_fun77790, [value5, value2, value3, value4, a1, value, value6, value7]); function _fun77788() { // fn#77788, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10125:1757, offset: 0x01e0be96, size: 223 bytes, params: 1, frame: 25 let binding = env0_3; let set = binding.set; Reflect.apply(set, binding, [true]); const r8 = env0_6.get() < 0 ? -env0_0 : env0_0; binding = env0_5; set = binding.set; const withSpring = SpringModule.withSpring; const object = {}; object.velocity = env0_6.get(); copyDataProperties(object, env1_4, undefined); const t_777892 = t_77789; const object2 = {}; object2.runOnJS = (require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS; object2.handleClose = env0_9; t_777892.__closure = object2; t_777892.__workletHash = 7033730772994; t_777892.__initData = env1_5; Reflect.apply(set, binding, [Reflect.apply(withSpring, SpringModule, [r8, object, 'respect-motion-settings', t_777892])]); function t_77789() { // fn#77789, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10125:1876, offset: 0x01e0bf75, size: 48 bytes, params: 1, frame: 12 let value = environment.__proto__.__proto__; value = require(4017) /* metro dependency 4017: ReanimatedRexport */; value.runOnJS(env1_9)(); } } function _fun77790() { // fn#77790, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10125:2043, offset: 0x01e0bfa5, size: 78 bytes, params: 1, frame: 3 return {velocity: env0_6, isClosing: env0_3, isInteracting: env0_4, overlayEnabled: env0_8, translatePos: env0_5, swipeVelocityThreshold: require, dismiss: env0_10, start: env0_7}; } } function useMediaViewerPanGesture({swipeVelocityThreshold, velocity, isInteracting, translatePos, start, dismiss}, a1) { // fn#77791, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10125:2213, offset: 0x01e0bff3, size: 187 bytes, params: 3, frame: 21 const translatePos2 = translatePos; const env0_5 = a1; const value2 = (UseStableCallback)(dismiss); const binding = translatePos2; return binding.useMemo(_fun77797, [binding.useCallback(_fun77792, [value2, a1, isInteracting, start, swipeVelocityThreshold, translatePos, velocity])]); function _fun77792() { // fn#77792, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10125:2371, offset: 0x01e0c0ae, size: 458 bytes, params: 1, frame: 23 const Gesture = (Module05321Module).Gesture; const value5 = Gesture.Pan().maxPointers(1).activeOffsetY([-10, 10]).failOffsetX([-10, 10]); const onStart = value5.onStart; let closure = function() { var startBinding = start; var object = {x: 0}; object.y = translatePos.get(); startBinding.set(object); isInteracting.set(true); }; let startBinding = start; const translatePosBinding = translatePos; const isInteractingBinding = isInteracting; closure.__closure = {start: startBinding, translatePos: translatePosBinding, isInteracting: isInteractingBinding}; closure.__workletHash = 12024094550213; closure.__initData = env1_9; const value7 = Reflect.apply(onStart, value5, [closure]); const onUpdate = value7.onUpdate; closure = function({velocityY, translationY}) { translatePos.set(translationY + start.get().y); velocity.set(velocityY); }; const velocityBinding = velocity; closure.__closure = {translatePos: translatePosBinding, start: startBinding, velocity: velocityBinding}; closure.__workletHash = 9790035695747; closure.__initData = env1_8; const value8 = Reflect.apply(onUpdate, value7, [closure]); const onTouchesDown = value8.onTouchesDown; closure = function(a0, a1) { if (!require.get()) { a1.fail(); } }; closure.__closure = {enabled: require}; closure.__workletHash = 10675684732258; closure.__initData = env1_7; const value9 = Reflect.apply(onTouchesDown, value8, [closure]); const onEnd = value9.onEnd; closure = t_77796; object = {isInteracting: isInteractingBinding, velocity: velocityBinding}; object.swipeVelocityThreshold = swipeVelocityThreshold; object.runOnJS = (require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS; object.dismiss = env0_6; object.translatePos = translatePosBinding; object.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring; object.SPRING_CONFIG = env1_4; closure.__closure = object; closure.__workletHash = 3185523772752; closure.__initData = env1_6; return Reflect.apply(onEnd, value9, [closure]); function t_77796() { // fn#77796, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10125:2934, offset: 0x01e0c322, size: 211 bytes, params: 1, frame: 19 var translatePosBinding; var value4; var moduleValue; var withSpring; var object; var value5; var moduleValue2; isInteracting.set(false); const Math = global.Math; const abs = Math.abs; const get = velocity.get; if (Reflect.apply(abs, Math, [Reflect.apply(get, velocityBinding, [])]) > swipeVelocityThreshold) { value5 = environment.__proto__.__proto__; moduleValue2 = require(4017) /* metro dependency 4017: ReanimatedRexport */; moduleValue2.runOnJS(env1_6)(); } else if (translatePos.get() !== 0) { translatePosBinding = translatePos; set = translatePosBinding.set; value4 = environment.__proto__.__proto__; moduleValue = require(4577) /* metro dependency 4577: spring */; withSpring = moduleValue.withSpring; object = {}; velocityBinding = velocity; object.velocity = velocityBinding.get(); copyDataProperties(object, env2_4, velocityBinding); Reflect.apply(set, translatePosBinding, [Reflect.apply(withSpring, moduleValue, [0, object])]); } } } function _fun77797() { // fn#77797, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10125:3321, offset: 0x01e0c3f5, size: 76 bytes, params: 1, frame: 12 var environment; let value = environment.__proto__; const Gesture = (Module05321Module).Gesture; value = Gesture.Native(); const env0_1 = []; return {panGestureGenerator: panGestureGenerator, nativeGesture: value}; function panGestureGenerator(a0) { // fn#77798, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10125:3389, offset: 0x01e0c441, size: 72 bytes, params: 2, frame: 14 if (env0_1[a0] != null) { return env0_1[a0]; } const value3 = env1_7(); const binding = env0_1; binding[a0] = value3.blocksExternalGesture(env0_0); return binding[a0]; } } } } global.__d(_fun77785, 9939, [31, 4017, 9551, 9547, 4577, 8994, 5321, 2]) /* metro module 9939, dependencies: [31, 4017, 9551, 9547, 4577, 8994, 5321, 2] */;