/* Metro module 8853; source: design/components/SegmentedControl/native/SegmentedControlState.native.tsx; dependencies: [31, 697, 3875, 4017, 4081, 2] */ 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 AccessibilityPreferencesContextModule from '../../../../external/discord_common/js/packages/design/components/AccessibilityPreferencesContext/AccessibilityPreferencesContext.tsx'; /* Metro dependency 3875 */ import * as ReanimatedRexportModule from '../../../../modules/reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */ function _fun69033(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#69033, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9038:6, offset: 0x01c65d4a, size: 137 bytes, params: 8, frame: 18 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); object = {code: 'function SegmentedControlStateNativeTsx1(index,dimensions){const{itemDimensions,itemCount}=this.__closure;itemDimensions.get()[index]=dimensions;itemDimensions.set([...itemDimensions.get()].slice(0,itemCount));}'}; (FileImportTrackerModule).fileFinishedImporting('design/components/SegmentedControl/native/SegmentedControlState.native.tsx'); exports.useSegmentedControlState = useSegmentedControlState; function useSegmentedControlState({items, pageWidth, defaultIndex, itemSpacing, onPageChange, onPageChangeStart, onSetActiveIndex}) { // fn#69034, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9038:464, offset: 0x01c65dd3, size: 708 bytes, params: 2, frame: 34 defaultIndex = defaultIndex === undefined ? 0 : defaultIndex; const r9 = itemSpacing !== undefined ? itemSpacing : (importDefault(697) /* metro dependency 697: native */).space.PX_24; const onPageChange2 = onPageChange; const onPageChangeStart2 = onPageChangeStart; const binding = onPageChange2; const useContext = binding.useContext; const AccessibilityPreferencesContext = (AccessibilityPreferencesContextModule).AccessibilityPreferencesContext; const enabled = Reflect.apply(useContext, binding, [AccessibilityPreferencesContext]).reducedMotion.enabled; const value2 = (ReanimatedRexportModule).useSharedValue([]); const value3 = (ReanimatedRexportModule).useSharedValue(-1); const value4 = (ReanimatedRexportModule).useSharedValue(0); const value5 = (ReanimatedRexportModule).useSharedValue(0); const value6 = (ReanimatedRexportModule).useSharedValue(defaultIndex); const value7 = (ReanimatedRexportModule).useSharedValue([defaultIndex, defaultIndex]); const value8 = (ReanimatedRexportModule).useAnimatedRef(); const value9 = (ReanimatedRexportModule).useSharedValue(-1); const env0_15 = binding.useRef(onPageChange); binding.useLayoutEffect(_fun69035, [onPageChange]); let useCallback = binding.useCallback; const value10 = Reflect.apply(useCallback, binding, [_fun69036, [value6, onPageChangeStart, pageWidth, value3, value8, enabled, onSetActiveIndex]]); const length = items.length; useCallback = binding.useCallback; const useSegmentedControlStateM2 = useSegmentedControlStateM; useSegmentedControlStateM2.__closure = {itemDimensions: value2, itemCount: length}; useSegmentedControlStateM2.__workletHash = 9501406272062; useSegmentedControlStateM2.__initData = onPageChangeStart2; return binding.useMemo(_fun69040, [value6, value7, value8, value3, value4, value5, items, value2, r9, pageWidth, value9, value10, Reflect.apply(useCallback, binding, [useSegmentedControlStateM2, [value2, length]]), enabled]); function _fun69035() { // fn#69035, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9038:971, offset: 0x01c66097, size: 21 bytes, params: 1, frame: 2 env0_15.current = onPageChange; } function _fun69036(a0) { // fn#69036, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9038:1018, offset: 0x01c660ac, size: 181 bytes, params: 2, frame: 18 var environment; let value = a1; const value2 = a2; const env0_0 = a0; let r2 = !(value !== undefined) || value; if (value2 !== undefined) { } const updateIndex_690372 = updateIndex_69037; r2 = r2 && env0_11.get() !== a0; if (r2) { value = environment.__proto__; value = require(4081) /* metro dependency 4081: HapticUtilsNative */; value.triggerHapticFeedback((require(4081) /* metro dependency 4081: HapticUtilsNative */).HapticFeedbackTypes.IMPACT_MEDIUM); } const binding = env0_11; const get = binding.get; if (a0 !== Reflect.apply(get, binding, [])) { if (onPageChangeStart != null) { onPageChangeStart(a0, _fun69038); } else { updateIndex_690372(a0); } } function updateIndex_69037(a0) { // fn#69037, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9038:1034, offset: 0x01c66161, size: 139 bytes, params: 2, frame: 17 var r3; var r6; var current; env1_11.set(a0); const value2 = a0 * pageWidth; env1_8.set(value2); const value3 = env1_13 == null; const value4 = undefined; if (value3) { r3 = value3; r6 = value4; } else { current = env1_13.current; r3 = current == null; r6 = current; } if (!r3) { r6.scrollTo({x: value2, animated: !env0_1 && !enabled}); } if (onSetActiveIndex != null) { onSetActiveIndex(a0); } return value4; } function _fun69038() { // fn#69038, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9038:1286, offset: 0x00d6a3a0, size: 20 bytes, params: 1, frame: 11 updateIndex_69037(env0_0); } } function useSegmentedControlStateM(a0, a1) { // fn#69039, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9038:1373, owner: useSegmentedControlState.M, offset: 0x01c661ec, size: 87 bytes, params: 3, frame: 16 let binding = env0_7; binding.get()[a0] = a1; binding = env0_7; const set = binding.set; const value3 = env0_7.get(); const items2 = []; arraySpread(items2, value3, 0, items2); Reflect.apply(set, binding, [items2.slice(0, length)]); } function _fun69040() { // fn#69040, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9038:1547, offset: 0x01c66243, size: 142 bytes, params: 1, frame: 3 return {activeIndex: env0_11, visiblePageRange: env0_12, pagerRef: env0_13, scrollTarget: env0_8, scrollOverflow: env0_9, scrollOffset: env0_10, items: items, itemDimensions: env0_7, itemSpacing: env0_2, pageWidth: pageWidth, pressedIndex: env0_14, onPageChangeRef: env0_15, setActiveIndex: env0_16, setItemDimensions: env0_18, useReducedMotion: enabled}; } } } global.__d(_fun69033, 8853, [31, 697, 3875, 4017, 4081, 2]) /* metro module 8853, dependencies: [31, 697, 3875, 4017, 4081, 2] */;