Files
2026-07-28 01:06:53 +03:00

168 lines
8.1 KiB
TypeScript

/* Metro module 11035; source: modules/gif_picker/native/GIFPickerUtils.tsx; dependencies: [31, 661, 1471, 9598, 9813, 1244, 2] */
import URLUtils from '../../../utils/URLUtils.tsx'; /* Metro dependency 1471 */
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 ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as FavoriteGIFHooksModule from '../FavoriteGIFHooks.tsx'; /* Metro dependency 9813 */
function _fun84487(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#84487, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11221:6, offset: 0x01f4c728, size: 246 bytes, params: 8, frame: 18
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_5 = RegExp('(https?:\\/\\/)(?!media(?:\\d+)?\\.)(?:[^.]+\\.)*giphy\\.com', '');
const env0_6 = RegExp('(tenor\\.com)', '');
const env0_7 = RegExp('-(?:.(?!-))+$', '');
(FileImportTrackerModule).fileFinishedImporting('modules/gif_picker/native/GIFPickerUtils.tsx');
exports.GIF_HEADER_HEIGHT = 56;
exports.useFavoriteGIFsMobile = useFavoriteGIFsMobile;
exports.GIF_PICKER_ITEM_ESIMTATED_HEIGHT = 180;
exports.GIF_PICKER_GUTTER_SPACING = 8;
exports.DEFAULT_CATEGORY_ROWS = 20;
function transformFavoriteGifUrl(a0, a1) { // fn#84488, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11221:255, offset: 0x01f4c81e, size: 455 bytes, params: 3, frame: 20
var r3;
var pathname;
var value6;
var value8;
var value10;
var binding;
let value = a0;
const value3 = undefined;
const value4 = (URLUtils).toURLSafe(value);
if (value4 == null) {
binding = env0_5;
if (binding.test(a1)) {
value = env0_7.exec(a1);
value = 'https://media.giphy.com/media/' + (value == null || value[0] == null ? value3 : value[0].slice(1)) + '/giphy.gif';
r3 = value;
} else {
binding = env0_6;
r3 = binding.test(a1) ? '' + a1 + '.gif' : value;
}
} else {
var moduleValue = require(9598) /* metro dependency 9598: SignedAttachmentLinkUtils */;
if (moduleValue.isExternalProxiedAttachmentUrl(value4)) {
pathname = value4.pathname;
value6 = pathname.toLowerCase().endsWith('.webp');
pathname = value4.pathname;
value8 = pathname.toLowerCase().endsWith('.avif');
pathname = value4.pathname;
value10 = pathname.toLowerCase().endsWith('.gif');
if (value6) {
if (value8 || value10) {
value4.searchParams.set('format', 'webp');
}
value4.searchParams.set('animated', 'true');
return value4.toString();
}
if (value8) {
if (value8 || value10) {
value4.searchParams.set('format', 'webp');
}
value4.searchParams.set('animated', 'true');
return value4.toString();
}
if (value10) {
if (value8 || value10) {
value4.searchParams.set('format', 'webp');
}
value4.searchParams.set('animated', 'true');
return value4.toString();
}
binding = env0_5;
if (binding.test(a1)) {
value = env0_7.exec(a1);
value = 'https://media.giphy.com/media/' + (value == null || value[0] == null ? value3 : value[0].slice(1)) + '/giphy.gif';
r3 = value;
} else {
binding = env0_6;
r3 = binding.test(a1) ? '' + a1 + '.gif' : value;
}
return r3;
}
var moduleValue2 = require(9598) /* metro dependency 9598: SignedAttachmentLinkUtils */;
if (moduleValue2.isAttachmentUrl(value4)) {
pathname = value4.pathname;
value6 = pathname.toLowerCase().endsWith('.webp');
pathname = value4.pathname;
value8 = pathname.toLowerCase().endsWith('.avif');
pathname = value4.pathname;
value10 = pathname.toLowerCase().endsWith('.gif');
if (value6) {
if (value8 || value10) {
value4.searchParams.set('format', 'webp');
}
value4.searchParams.set('animated', 'true');
return value4.toString();
}
if (value8) {
if (value8 || value10) {
value4.searchParams.set('format', 'webp');
}
value4.searchParams.set('animated', 'true');
return value4.toString();
}
if (value10) {
if (value8 || value10) {
value4.searchParams.set('format', 'webp');
}
value4.searchParams.set('animated', 'true');
return value4.toString();
}
binding = env0_5;
if (binding.test(a1)) {
value = env0_7.exec(a1);
value = 'https://media.giphy.com/media/' + (value == null || value[0] == null ? value3 : value[0].slice(1)) + '/giphy.gif';
r3 = value;
} else {
binding = env0_6;
r3 = binding.test(a1) ? '' + a1 + '.gif' : value;
}
return r3;
}
if (Reflect.apply(env0_5.test, binding, [a1])) {
value = env0_7.exec(a1);
value = 'https://media.giphy.com/media/' + (value == null || value[0] == null ? value3 : value[0].slice(1)) + '/giphy.gif';
r3 = value;
} else {
binding = env0_6;
r3 = binding.test(a1) ? '' + a1 + '.gif' : value;
}
}
return r3;
}
function useFavoriteGIFsMobile() { // fn#84489, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11221:892, offset: 0x01f4c9e5, size: 90 bytes, params: 1, frame: 15
const value2 = (FavoriteGIFHooksModule).useSortedFavoriteGIFs(transformFavoriteGifUrl);
const useMemo = ReactModule.useMemo;
let object = [value2];
object = {favorites: value2, favoritesCategory: Reflect.apply(useMemo, ReactModule, [_fun84490, object])};
return object;
function _fun84490() { // fn#84490, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11221:999, offset: 0x01f4ca3f, size: 140 bytes, params: 1, frame: 18
var r0;
var object;
var value3;
var intl;
var binding;
if (env0_0.length > 0) {
object = {};
value3 = environment.__proto__;
object.type = GIFPickerResultTypes.FAVORITES;
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
object.name = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.k8fFjp);
binding = env0_0;
object.src = binding[0].src;
object.format = binding[0].format;
r0 = object;
} else {
r0 = undefined;
}
return r0;
}
}
}
global.__d(_fun84487, 11035, [31, 661, 1471, 9598, 9813, 1244,
2]) /* metro module 11035, dependencies: [31, 661, 1471, 9598, 9813, 1244, 2] */;