/* Metro module 11034; source: modules/gif_picker/native/GIFPicker.tsx; dependencies: [57, 31, 27, 9815, 661, 33, 4501, 9814, 683, 7556, 1478, 11035, 22, 566, 10748, 11036, 11037, 11041, 11044, 2] */ import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */ import UseWindowDimensionsNative from '../../screen/useWindowDimensions.native.tsx'; /* Metro dependency 1478 */ import UseIsWindowLarge from '../../screen/native/useIsWindowLarge.tsx'; /* Metro dependency 7556 */ import GIFPickerViewStore from '../../../stores/views/GIFPickerViewStore.tsx'; /* Metro dependency 9815 */ import TooltipActionCreators from '../../tooltip/TooltipActionCreators.tsx'; /* Metro dependency 10748 */ import GIFPickerSearchSuggestions from './GIFPickerSearchSuggestions.tsx'; /* Metro dependency 11036 */ import GIFPickerHeader from './GIFPickerHeader.tsx'; /* Metro dependency 11037 */ import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */ import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */ import * as JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */ import * as FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */ import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */ import * as GIFPickerActionCreatorsModule from '../../../actions/GIFPickerActionCreators.tsx'; /* Metro dependency 9814 */ import * as GIFPickerUtilsModule from './GIFPickerUtils.tsx'; /* Metro dependency 11035 */ function _fun84472(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#84472, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11220:6, offset: 0x01f4bcdd, size: 318 bytes, params: 8, frame: 21 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = ReactModule; const env0_15 = (CreateStylesModule).createStyles({container: {flex: 1}}); value = value.memo(GIFPicker); (FileImportTrackerModule).fileFinishedImporting('modules/gif_picker/native/GIFPicker.tsx'); exports.default = value; function GIFPicker({bottomSheetRef, channelId, guildId, hideFavorites, initialQuery, onPressGIF}) { // fn#84473, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11220:356, offset: 0x01f4be1b, size: 961 bytes, params: 2, frame: 35 var r5; const onPressGIF2 = onPressGIF; var value; const styles = useStyles(); const binding = env0_5; binding.useEffect(_fun84474, [channelId, guildId]); const {columns, columnWidth} = binding.useMemo(_fun84475, [(UseIsWindowLarge)(), (UseWindowDimensionsNative)()]); const value6 = binding.useRef(null); let useState = binding.useState; const value7 = Reflect.apply(useState, binding, [false]); const binding2 = onPressGIF2; const value8 = binding2(value7, 2); const property = value8[0]; const env0_8 = value8[1]; const env0_9 = binding.useRef(''); const env0_10 = binding.useRef(false); useState = binding.useState; const value9 = binding2(Reflect.apply(useState, binding, [false]), 2); const property2 = value9[0]; const env0_11 = value9[1]; useState = binding.useState; const SEARCH = GIFPickerResultTypes.SEARCH; const value10 = binding2(Reflect.apply(useState, binding, [SEARCH]), 2); const property3 = value10[0]; const env0_13 = value10[1]; const value11 = binding.useCallback(_fun84476, [value6]); const value12 = binding.useMemo(function() { return require(dependencyMap[12]).debounce(importAll(dependencyMap[7]).search, 200); }, []); const value13 = (GIFPickerUtilsModule).useFavoriteGIFsMobile(); const env0_15 = value13.favorites; const favoritesCategory = value13.favoritesCategory; const {resultItems, resultQuery} = (FluxModule).useStateFromStoresObject([GIFPickerViewStore], _fun84478); const value15 = binding.useCallback(_fun84479, [value12, value6, resultQuery]); binding.useEffect(_fun84480, [value15, initialQuery]); binding.useEffect(_fun84481, []); binding.useEffect(_fun84482, [resultQuery, value6]); const value16 = binding.useMemo(_fun84483, [value15]); const value17 = binding.useCallback(_fun84485, [onPressGIF, resultItems.length, resultQuery]); const value18 = binding.useCallback(_fun84486, [bottomSheetRef, value15]); const value19 = ((Component) => )(GIFPickerHeader); if (resultItems.length > 0) { value = importDefault(11041) /* metro dependency 11041: GIFPickerResultsList */; value = ((Component) => )(value); r5 = value; } else if (property) { value = importDefault(11041) /* metro dependency 11041: GIFPickerResultsList */; value = ((Component) => )(value); r5 = value; } else { value = importDefault(11044) /* metro dependency 11044: GIFPickerCategoriesPage */; value = ((Component) => )(value); r5 = value; } return ( {value19} {r5} ); function _fun84474() { // fn#84474, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11220:484, offset: 0x01f4c1dc, size: 142 bytes, params: 1, frame: 16 var defaultImport; (GIFPickerActionCreatorsModule).initializeSearch(); (GIFPickerActionCreatorsModule).resetSearch(); if (channelId != null) { defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */; defaultImport.track(AnalyticEvents.CHAT_INPUT_COMPONENT_VIEWED, {type: ChatInputComponentViewedTypes.GIF, channel_id: channelId, guild_id: guildId}); } } function _fun84475() { // fn#84475, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11220:680, offset: 0x01f4c26a, size: 96 bytes, params: 1, frame: 15 const value2 = 2; const r4 = env0_5 ? 3 : value2; const object = {columns: r4}; const value = ReactNativeModule.View.width / r4; const GIF_PICKER_GUTTER_SPACING = (GIFPickerUtilsModule).GIF_PICKER_GUTTER_SPACING; object.columnWidth = value - GIF_PICKER_GUTTER_SPACING / value2 * (r4 - 1); return object; } function _fun84476() { // fn#84476, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11220:1007, offset: 0x01f4c2ca, size: 95 bytes, params: 1, frame: 13 env0_8(false); const binding = env0_13; const SEARCH = GIFPickerResultTypes.SEARCH; binding(SEARCH); (GIFPickerActionCreatorsModule).resetSearch(); const current = env0_7.current; if (current != null) { current.blur(); } } function _fun84478() { // fn#84478, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11220:1267, offset: 0x01f4c369, size: 76 bytes, params: 1, frame: 12 const object = {}; const FAVORITES = GIFPickerResultTypes.FAVORITES; object.resultItems = ConstantsModule.TooltipNames !== FAVORITES ? GIFPickerViewStore.getResultItems() : favorites; object.resultQuery = GIFPickerViewStore.getResultQuery(); return object; } function _fun84479(a0) { // fn#84479, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11220:1407, offset: 0x01f4c3b5, size: 229 bytes, params: 2, frame: 21 var r7; var SEARCH; var binding; var value2; var value3; var value6; const value = a1; const r4 = !(value !== undefined) || value; let current = env0_9.current; if (current !== a0) { env0_9.current = a0; binding = env0_13; value2 = environment.__proto__; SEARCH = GIFPickerResultTypes.SEARCH; binding(SEARCH); value3 = a0.trim().length > 0; binding = env0_11; binding(value3 ? resultQuery !== a0 : !!value3); env0_8(value3); r7 = r4 ? JsxRuntimeModule.jsxs : (importAll(9814) /* metro dependency 9814: GIFPickerActionCreators */).search; value6 = null; SEARCH = a0 === '' ? value6 : GIFPickerResultTypes.SEARCH; r7(a0, SEARCH, !r4, GIF_FETCH_LIMIT_IOS); if (!r4) { current = env0_7.current; if (value6 != current) { current.setText(a0); } } } } function _fun84480() { // fn#84480, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11220:1628, offset: 0x01f4c49a, size: 90 bytes, params: 1, frame: 13 if (!env0_10.current) { if (initialQuery != null && initialQuery.trim().length > 0) { env0_10.current = true; env0_18(initialQuery, false); } } } function _fun84481() { // fn#84481, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11220:1719, offset: 0x01f4c4f4, size: 74 bytes, params: 1, frame: 14 const value = environment.__proto__; const defaultImport = TooltipActionCreators; const acknowledgeTooltip = defaultImport.acknowledgeTooltip; const GIF_PICKER_TOOLTIP = TooltipNames.GIF_PICKER_TOOLTIP; Reflect.apply(acknowledgeTooltip, defaultImport, [GIF_PICKER_TOOLTIP]); (GIFPickerActionCreatorsModule).fetchTrendingSearchTerms(); } function _fun84482() { // fn#84482, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11220:1828, offset: 0x01f4c53e, size: 106 bytes, params: 1, frame: 14 var value2; var moduleValue; if (resultQuery !== '') { value2 = environment.__proto__; moduleValue = importAll(9814) /* metro dependency 9814: GIFPickerActionCreators */; moduleValue.fetchSuggestions(resultQuery); } const binding = env0_11; resultQueryBinding = resultQuery; const current = env0_7.current; const value = undefined; binding(resultQueryBinding !== (current == null ? value : current.getText())); return value; } function _fun84483() { // fn#84483, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11220:1950, offset: 0x01f4c5a8, size: 53 bytes, params: 1, frame: 14 var environment; const value = environment.__proto__; return ((Component) => )(GIFPickerSearchSuggestions); function onClickSuggestion(a0) { // fn#84484, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11220:1984, offset: 0x01f4c5dd, size: 22 bytes, params: 2, frame: 13 return env1_18(a0, false); } } function _fun84485(a0, a1) { // fn#84485, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11220:2023, offset: 0x01f4c5f3, size: 134 bytes, params: 3, frame: 16 const trackSelectGIF = GIFPickerActionCreatorsModule.trackSelectGIF; const SEARCH = GIFPickerResultTypes.SEARCH; const resultItemsBinding = resultItems; Reflect.apply(trackSelectGIF, GIFPickerActionCreatorsModule, [{type: SEARCH, index: a1, offset: 0, limit: GIF_FETCH_LIMIT_IOS, results: resultItemsBinding.length, totalResults: resultItemsBinding.length, query: resultQuery, gifId: a0.id}]); onPressGIF(a0); } function _fun84486(a0, a1) { // fn#84486, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11220:2195, offset: 0x01f4c679, size: 175 bytes, params: 3, frame: 15 const TRENDING_GIFS = GIFPickerResultTypes.TRENDING_GIFS; if (a0 === TRENDING_GIFS) { env0_8(false); env0_13(a0); (importAll(9814) /* metro dependency 9814: GIFPickerActionCreators */).fetchTrendingGIFs(GIF_FETCH_LIMIT_IOS); } else if (a0 === GIFPickerResultTypes.FAVORITES) { env0_8(false); env0_13(a0); } else { env0_18(a1, false); } const current = bottomSheetRef.current; if (current != null) { current.expandActionSheet(); } } } } global.__d(_fun84472, 11034, [57, 31, 27, 9815, 661, 33, 4501, 9814, 683, 7556, 1478, 11035, 22, 566, 10748, 11036, 11037, 11041, 11044, 2]) /* metro module 11034, dependencies: [57, 31, 27, 9815, 661, 33, 4501, 9814, 683, 7556, 1478, 11035, 22, 566, 10748, 11036, 11037, 11041, 11044, 2] */;