/* Metro module 14457; source: modules/guilds_bar/native/GuildsBarDragPreview.tsx; dependencies: [31, 4896, 14384, 33, 4501, 4017, 4577, 8141, 4508, 14394, 14415, 3769, 2] */ function _fun109403(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#109403, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14654:6, offset: 0x023499c1, size: 406 bytes, params: 8, frame: 21 const env0_0 = require; const getItemPreviewKey = function({id}) { return '' + id; }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = importAll(31) /* metro dependency 31 */; const env0_4 = (require(4896) /* metro dependency 4896: SortedGuildStore */).GuildsNodeType; const guildsBarDnDStore = importDefault(14384) /* metro dependency 14384: GuildsBarDnDStore */; const env0_6 = (require(33) /* metro dependency 33 */).jsx; const env0_7 = (require(4501) /* metro dependency 4501: createStyles */).createStyles({dragPreview: {'position': 'absolute', 'left': 0}, animatedPreviewStyle: {position: 'absolute'}}); const env0_8 = {'mass': 0.5, 'damping': 80, 'stiffness': 320}; object = {code: 'function GuildsBarDragPreviewTsx1(){const{scrollPosition,dragRegion,listInsets}=this.__closure;return Math.max(scrollPosition.get()dragRegion.get().max?dragRegion.get().max-draggedHeight-scrollPosition.get():windowSize-listInsets.get().end-draggedHeight,windowSize-listInsets.get().end-draggedHeight);}'}; object = {code: "function GuildsBarDragPreviewTsx3(){const{dropPosition,scrollPosition,gestureState,draggedHeight,minY,maxY,windowSize,withSpring,DRAG_SPRING_PHYSICS,runOnJS,dropComplete}=this.__closure;let translateY=function(){if(dropPosition!=null){return dropPosition-scrollPosition.get();}return gestureState.get().absoluteY-draggedHeight/2;}();if(gestureState.get().mode!=null&&dropPosition==null){translateY=Math.min(Math.max(translateY,minY.get()),maxY.get());}else{translateY=Math.max(-draggedHeight,Math.min(translateY,windowSize));}return{top:withSpring(translateY,DRAG_SPRING_PHYSICS,'animate-always',function(finished){if(finished&&dropPosition!=null){runOnJS(dropComplete)();}})};}"}; object = {code: 'function GuildsBarDragPreviewTsx4(finished){const{dropPosition,runOnJS,dropComplete}=this.__closure;if(finished&&dropPosition!=null){runOnJS(dropComplete)();}}'}; object = {code: "function GuildsBarDragPreviewTsx5(){const{isFolder,visible,withSpring,DRAG_SPRING_PHYSICS,transitionState,TransitionStates,runOnJS,cleanUp}=this.__closure;const targetScale=function(){if(isFolder){return visible.get()===1?1:0.3;}return visible.get()===1?1:0.33;}();const{translateX:translateX,translateY:translateY}=function(){if(isFolder){return{translateX:0,translateY:0};}if(visible.get()===1){return{translateX:0,translateY:0};}return{translateX:10,translateY:-10};}();return{zIndex:isFolder?0:1,transform:[{translateY:withSpring(translateY,DRAG_SPRING_PHYSICS,'animate-always')},{translateX:withSpring(translateX,DRAG_SPRING_PHYSICS,'animate-always')},{scale:withSpring(targetScale,DRAG_SPRING_PHYSICS,'animate-always',function(finished){if(finished&&transitionState===TransitionStates.YEETED&&isFolder){runOnJS(cleanUp)();}})}],opacity:withSpring(isFolder?visible.get():1,DRAG_SPRING_PHYSICS,'animate-always')};}"}; object = {code: 'function GuildsBarDragPreviewTsx6(finished){const{transitionState,TransitionStates,isFolder,runOnJS,cleanUp}=this.__closure;if(finished&&transitionState===TransitionStates.YEETED&&isFolder){runOnJS(cleanUp)();}}'}; value = value.memo(GuildsBarDragPreview); (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guilds_bar/native/GuildsBarDragPreview.tsx'); exports.default = value; } function PreviewItem({dragRegion, draggedHeight, draggedNode, dropComplete, gestureState, listInsets, overNode, overState, scrollPosition, windowSize, dropPosition}) { // fn#109404, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14654:1771, offset: 0x02349b57, size: 627 bytes, params: 2, frame: 33 var object2; const env0_3 = gestureState; const env0_8 = windowSize; const env0_9 = dropPosition; const styles = useStyles(); const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */; let useDerivedValue = reanimatedRexportModule.useDerivedValue; let closure = function() { var Math = global.Math; return Math.max(scrollPosition.get() < dragRegion.get().min ? dragRegion.get().min - scrollPosition.get() : 0, listInsets.get().start); }; closure.__closure = {scrollPosition: scrollPosition, dragRegion: dragRegion, listInsets: listInsets}; closure.__workletHash = 17436881889698; closure.__initData = env0_9; const value2 = Reflect.apply(useDerivedValue, reanimatedRexportModule, [closure]); const env0_10 = value2; const moduleValue2 = reanimatedRexportModule; useDerivedValue = moduleValue2.useDerivedValue; closure = PreviewItemY; closure.__closure = {scrollPosition: scrollPosition, windowSize: windowSize, listInsets: listInsets, dragRegion: dragRegion, draggedHeight: draggedHeight}; closure.__workletHash = 4371355784; closure.__initData = env0_10; const value3 = Reflect.apply(useDerivedValue, moduleValue2, [closure]); const env0_11 = value3; const moduleValue3 = reanimatedRexportModule; const useAnimatedStyle = moduleValue3.useAnimatedStyle; closure = PreviewItemH; object2 = {dropPosition: dropPosition, scrollPosition: scrollPosition, gestureState: gestureState, draggedHeight: draggedHeight, minY: value2, maxY: value3, windowSize: windowSize}; object2.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring; object2.DRAG_SPRING_PHYSICS = env0_8; object2.runOnJS = reanimatedRexportModule.runOnJS; object2.dropComplete = dropComplete; closure.__closure = object2; closure.__workletHash = 5676492640532; closure.__initData = env0_11; const value4 = Reflect.apply(useAnimatedStyle, moduleValue3, [closure]); const value5 = env0_3.useMemo(_fun109409, [overState, overNode]); const ReanimatedNativeView = importDefault(8141) /* metro dependency 8141: ReanimatedNativeView */; const items2 = [styles.dragPreview, value4]; const TransitionGroup = (require(4508) /* metro dependency 4508: TransitionGroup */).TransitionGroup; return ( ); } function renderAnimatedItemPreview(a0, a1, a2, a3) { // fn#109411, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14654:3509, offset: 0x0234a145, size: 51 bytes, params: 5, frame: 15 return ( ); } function AnimatedItemPreview({node, transitionState, cleanUp}) { // fn#109412, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14654:4779, offset: 0x0234a178, size: 533 bytes, params: 2, frame: 26 var r4; var value; const styles = useStyles(); const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */; const useSharedValue = reanimatedRexportModule.useSharedValue; const TransitionStates = (require(4508) /* metro dependency 4508: TransitionGroup */).TransitionStates; const ENTERED = TransitionStates.ENTERED; const value4 = Reflect.apply(useSharedValue, reanimatedRexportModule, [transitionState !== ENTERED ? 1 : 0]); let type = node.type; let FOLDER = GuildsNodeType.FOLDER; const value5 = type === FOLDER; const env0_3 = value5; const moduleValue2 = reanimatedRexportModule; const useAnimatedStyle = moduleValue2.useAnimatedStyle; const closure = AnimatedItemPreviewP; const object2 = {isFolder: value5, visible: value4}; object2.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring; object2.DRAG_SPRING_PHYSICS = env0_8; object2.transitionState = transitionState; object2.TransitionStates = TransitionStates; object2.runOnJS = reanimatedRexportModule.runOnJS; object2.cleanUp = cleanUp; closure.__closure = object2; closure.__workletHash = 13465198693221; closure.__initData = env0_13; const value6 = Reflect.apply(useAnimatedStyle, moduleValue2, [closure]); env0_3.useEffect(_fun109415); const ReanimatedNativeView = importDefault(8141) /* metro dependency 8141: ReanimatedNativeView */; const items2 = [styles.animatedPreviewStyle, value6]; type = node.type; FOLDER = GuildsNodeType.FOLDER; if (type === FOLDER) { value = importDefault(14394) /* metro dependency 14394: GuildsBarGuildFolder */; value = ((Component) => )(value); r4 = value; } else { value = importDefault(14415) /* metro dependency 14415: GuildsBarGuild */; value = ((Component) => )(value); r4 = value; } return ( {r4} ); } function GuildsBarDragPreview() { // fn#109416, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14654:6176, offset: 0x0234a615, size: 87 bytes, params: 1, frame: 15 const value2 = GuildsBarDnDStore(_fun109417, (require(3769) /* metro dependency 3769 */).shallow); const value3 = null; return value3 != value2 ? : value3; } function PreviewItemY() { // fn#109406, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14654:2200, owner: PreviewItem.y, offset: 0x02349e3f, size: 202 bytes, params: 1, frame: 16 var r1; var value6; const Math = global.Math; const min = Math.min; let scrollPositionBinding = scrollPosition; let get = scrollPositionBinding.get; const value2 = Reflect.apply(get, scrollPositionBinding, []); let windowSizeBinding = windowSize; let listInsetsBinding = listInsets; get = listInsetsBinding.get; const value3 = value2 + (windowSizeBinding - Reflect.apply(get, listInsetsBinding, []).end); get = dragRegion.get; if (value3 > Reflect.apply(get, dragRegionBinding, []).max) { dragRegionBinding = dragRegion; get = dragRegionBinding.get; value6 = Reflect.apply(get, dragRegionBinding, []).max - draggedHeight; scrollPositionBinding = scrollPosition; get = scrollPositionBinding.get; r1 = value6 - Reflect.apply(get, scrollPositionBinding, []); } else { windowSizeBinding = windowSize; listInsetsBinding = listInsets; r1 = windowSizeBinding - listInsetsBinding.get().end - draggedHeight; } windowSizeBinding = windowSize; listInsetsBinding = listInsets; get = listInsetsBinding.get; return Reflect.apply(min, Math, [r1, windowSizeBinding - Reflect.apply(get, listInsetsBinding, []).end - draggedHeight]); } function PreviewItemH() { // fn#109407, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14654:2466, owner: PreviewItem.H, offset: 0x02349f09, size: 354 bytes, params: 1, frame: 24 var r6; var Math; var max; var value4; var Math2; var min; var Math3; var binding; var value6; const r5 = dropPosition != null ? dropPosition - scrollPosition.get() : gestureState.get().absoluteY - draggedHeight / 2; const gestureStateBinding = gestureState; let get = gestureStateBinding.get; if (Reflect.apply(get, gestureStateBinding, []).mode == null) { Math = global.Math; max = Math.max; value4 = -draggedHeight; Math2 = global.Math; r6 = Reflect.apply(max, Math, [value4, Math2.min(r5, windowSize)]); } else if (dropPosition == null) { Math = global.Math; min = Math.min; Math3 = global.Math; max = Math3.max; binding = env0_10; get = binding.get; value6 = Reflect.apply(max, Math3, [r5, Reflect.apply(get, binding, [])]); binding = env0_11; get = binding.get; r6 = Reflect.apply(min, Math, [value6, Reflect.apply(get, binding, [])]); } else { Math = global.Math; max = Math.max; value4 = -draggedHeight; Math2 = global.Math; r6 = Reflect.apply(max, Math, [value4, Math2.min(r5, windowSize)]); } const springModule = require(4577) /* metro dependency 4577: spring */; const withSpring = springModule.withSpring; binding = env1_8; const closure = HT_109408; const object = {}; object.dropPosition = dropPosition; object.runOnJS = (require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS; object.dropComplete = dropComplete; closure.__closure = object; closure.__workletHash = 12640145939434; closure.__initData = env1_12; return {top: Reflect.apply(withSpring, springModule, [r6, binding, 'animate-always', closure])}; } function _fun109409() { // fn#109409, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14654:3096, offset: 0x0234a0b3, size: 114 bytes, params: 1, frame: 4 var value2; if (overState !== 'convert-after') { if (overState !== 'convert-before') { return undefined; } } if (overNode != null) { value2 = environment.__proto__; return {type: GuildsNodeType.FOLDER, id: -1, parentId: undefined, name: undefined, color: undefined, expanded: false, children: [overNode]}; } } function AnimatedItemPreviewP() { // fn#109413, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14654:4976, owner: AnimatedItemPreview.p, offset: 0x0234a38d, size: 462 bytes, params: 1, frame: 29 let binding = env0_3; const value2 = env0_2.get(); const value3 = 1; const r15 = binding ? value3 !== value2 ? 0.3 : value3 : value3 !== value2 ? 0.33 : value3; const {translateX, translateY} = env0_3 || value3 === env0_2.get() ? {'translateX': 0, 'translateY': 0} : {'translateX': 10, 'translateY': -10}; const object2 = {}; object2.zIndex = env0_3 ? 0 : value3; const springModule = require(4577) /* metro dependency 4577: spring */; let withSpring = springModule.withSpring; const items2 = [{translateY: Reflect.apply(withSpring, springModule, [translateY, env1_8, 'animate-always'])}]; const object4 = {}; object4.translateX = springModule.withSpring(translateX, env1_8, 'animate-always'); items2[1] = object4; const moduleValue3 = springModule; withSpring = moduleValue3.withSpring; binding = env1_8; const closure = pT; const object6 = {}; object6.transitionState = transitionState; const TransitionStates = (require(4508) /* metro dependency 4508: TransitionGroup */).TransitionStates; object6.TransitionStates = TransitionStates; object6.isFolder = env0_3; object6.runOnJS = (require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS; object6.cleanUp = cleanUp; closure.__closure = object6; closure.__workletHash = 9409925192880; closure.__initData = env1_14; items2[2] = {scale: Reflect.apply(withSpring, moduleValue3, [r15, binding, 'animate-always', closure])}; object2.transform = items2; const moduleValue4 = springModule; object2.opacity = moduleValue4.withSpring(env0_3 ? env0_2.get() : value3, env1_8, 'animate-always'); return object2; } function _fun109415() { // fn#109415, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14654:5884, offset: 0x0234a5d0, size: 69 bytes, params: 1, frame: 14 const binding = env0_2; const set = binding.set; const transitionStateBinding = transitionState; const value = environment.__proto__; const TransitionStates = (require(4508) /* metro dependency 4508: TransitionGroup */).TransitionStates; const YEETED = TransitionStates.YEETED; Reflect.apply(set, binding, [transitionStateBinding !== YEETED ? 1 : 0]); } function _fun109417({dragSpecs, overSpecs, gestureState, scrollPosition, dragRegion, windowSize, dropComplete, listInsets, dropSpecs}) { // fn#109417, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14654:6217, offset: 0x0234a66c, size: 286 bytes, params: 2, frame: 20 var node; var state; var object2; var value; var value2; var overState; if (dropSpecs != null) { overState = dropSpecs.overState; object2 = {}; object2.draggedNode = dropSpecs.dragNode; object2.draggedHeight = dropSpecs.itemSize; object2.overState = overState; object2.overNode = overState.startsWith('convert') ? dropSpecs.overNode : undefined; object2.dropPosition = dropSpecs.dropPosition; object2.gestureState = gestureState; object2.scrollPosition = scrollPosition; object2.dragRegion = dragRegion; object2.windowSize = windowSize; object2.dropComplete = dropComplete; object2.listInsets = listInsets; return object2; } if (dragSpecs != null) { if (overSpecs != null) { state = overSpecs.state; object2 = {}; node = dragSpecs.node; object2.draggedNode = node; object2.draggedHeight = dragSpecs.itemSize; object2.overState = state; value = state.startsWith('convert'); value2 = undefined; node = value ? overSpecs.node : value2; object2.overNode = node; object2.dropPosition = value2; object2.gestureState = gestureState; object2.scrollPosition = scrollPosition; object2.dragRegion = dragRegion; object2.windowSize = windowSize; object2.dropComplete = dropComplete; object2.listInsets = listInsets; return object2; } } return null; } function HT_109408(a0) { // fn#109408, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14654:2675, owner: PreviewItem.H.t, offset: 0x0234a06b, size: 72 bytes, params: 2, frame: 12 var r0; var runOnJS; var value2; let value = a0; if (value) { value = environment.__proto__; value = dropPosition != null; r0 = value; } else { r0 = value; } if (r0) { value = environment.__proto__.__proto__; value = require(4017) /* metro dependency 4017: ReanimatedRexport */; runOnJS = value.runOnJS; value2 = environment.__proto__; Reflect.apply(runOnJS, value, [dropComplete])(); } } function pT(a0) { // fn#109414, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14654:5327, owner: AnimatedItemPreview.p.t, offset: 0x0234a55b, size: 117 bytes, params: 2, frame: 13 var r0; var transitionStateBinding; var runOnJS; var value2; let value = a0; if (value) { value = environment.__proto__; transitionStateBinding = transitionState; value = environment.__proto__.__proto__; value = transitionStateBinding === (require(4508) /* metro dependency 4508: TransitionGroup */).TransitionStates.YEETED; r0 = value; } else { r0 = value; } if (r0) { value = environment.__proto__; r0 = env1_3; } if (r0) { value = environment.__proto__.__proto__; value = require(4017) /* metro dependency 4017: ReanimatedRexport */; runOnJS = value.runOnJS; value2 = environment.__proto__; Reflect.apply(runOnJS, value, [cleanUp])(); } }