Files
discord-decomp/sources/modules/gif_picker/native/GIFPicker.tsx
T
2026-07-27 16:20:00 +03:00

240 lines
13 KiB
TypeScript

/* 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] */
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});
const env0_4 = importDefault(57) /* metro dependency 57 */;
let value = importAll(31) /* metro dependency 31 */;
const env0_6 = (require(27) /* metro dependency 27 */).View;
const gifPickerViewStore = importDefault(9815) /* metro dependency 9815: GIFPickerViewStore */;
const constantsModule = require(661) /* metro dependency 661: Constants */;
const env0_8 = constantsModule.AnalyticEvents;
const env0_9 = constantsModule.ChatInputComponentViewedTypes;
const env0_10 = constantsModule.GIF_FETCH_LIMIT_IOS;
const env0_11 = constantsModule.GIFPickerResultTypes;
const env0_12 = constantsModule.TooltipNames;
const value3 = require(33) /* metro dependency 33 */;
const env0_13 = value3.jsx;
const env0_14 = value3.jsxs;
const env0_15 = (require(4501) /* metro dependency 4501: createStyles */).createStyles({container: {flex: 1}});
value = value.memo(GIFPicker);
(require(2) /* metro dependency 2 */).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 env0_4 = onPressGIF;
var value;
const styles = useStyles();
const binding = env0_5;
binding.useEffect(_fun84474, [channelId, guildId]);
const {columns, columnWidth} = binding.useMemo(_fun84475,
[(importDefault(7556) /* metro dependency 7556: useIsWindowLarge */)(),
(importDefault(1478) /* metro dependency 1478: useWindowDimensionsNative */)()]);
const value6 = binding.useRef(null);
let useState = binding.useState;
const value7 = Reflect.apply(useState, binding, [false]);
const binding2 = env0_4;
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 = (require(11035) /* metro dependency 11035: GIFPickerUtils */).useFavoriteGIFsMobile();
const env0_15 = value13.favorites;
const favoritesCategory = value13.favoritesCategory;
const {resultItems,
resultQuery} = (require(566) /* metro dependency 566: flux */).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) => <Component categoryType={property3} onQueryClear={value11} onQueryChange={value15} searchInputRef={value6} />)(importDefault(11037) /* metro dependency 11037: GIFPickerHeader */);
if (resultItems.length > 0) {
value = importDefault(11041) /* metro dependency 11041: GIFPickerResultsList */;
value = ((Component) => <Component columns={columns} columnWidth={columnWidth} loading={property2} inActionSheet resultItems={resultItems} onPressGIF={value17} ListFooterComponent={value16} />)(value);
r5 = value;
} else if (property) {
value = importDefault(11041) /* metro dependency 11041: GIFPickerResultsList */;
value = ((Component) => <Component columns={columns} columnWidth={columnWidth} loading={property2} inActionSheet resultItems={resultItems} onPressGIF={value17} ListFooterComponent={value16} />)(value);
r5 = value;
} else {
value = importDefault(11044) /* metro dependency 11044: GIFPickerCategoriesPage */;
value = ((Component) => <Component columns={columns} onSelectCategory={value18} favoritesCategory={hideFavorites === true ? undefined : favoritesCategory} inActionSheet />)(value);
r5 = value;
}
return (
<View style={styles.container}>
{value19}
{r5}
</View>
);
}
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;
(importAll(9814) /* metro dependency 9814: GIFPickerActionCreators */).initializeSearch();
(importAll(9814) /* metro dependency 9814: GIFPickerActionCreators */).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 object2 = {columns: r4};
const value = env0_6.width / r4;
const GIF_PICKER_GUTTER_SPACING = (require(11035) /* metro dependency 11035: GIFPickerUtils */).GIF_PICKER_GUTTER_SPACING;
object2.columnWidth = value - GIF_PICKER_GUTTER_SPACING / value2 * (r4 - 1);
return object2;
}
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);
(importAll(9814) /* metro dependency 9814: GIFPickerActionCreators */).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 object2 = {};
const binding = env0_12;
const FAVORITES = GIFPickerResultTypes.FAVORITES;
object2.resultItems = binding !== FAVORITES ? GIFPickerViewStore.getResultItems() : favorites;
object2.resultQuery = GIFPickerViewStore.getResultQuery();
return object2;
}
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 ? env0_14 : (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 = importDefault(10748) /* metro dependency 10748: TooltipActionCreators */;
const acknowledgeTooltip = defaultImport.acknowledgeTooltip;
const GIF_PICKER_TOOLTIP = TooltipNames.GIF_PICKER_TOOLTIP;
Reflect.apply(acknowledgeTooltip, defaultImport, [GIF_PICKER_TOOLTIP]);
(importAll(9814) /* metro dependency 9814: GIFPickerActionCreators */).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) => <Component onClickSuggestion={onClickSuggestion} />)(importDefault(11036) /* metro dependency 11036: GIFPickerSearchSuggestions */);
}
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 gifPickerActionCreatorsModule = importAll(9814) /* metro dependency 9814: GIFPickerActionCreators */;
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();
}
}
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);
}