decord/source/modules/gif_picker/native/GIFPickerUtils.tsx
2026-09-02 09:53:35 +00:00

90 lines
3.1 KiB
TypeScript

// Module ID: 10383
// Function ID: 10384
// Name: transformFavoriteGifUrl
// Dependencies: [19, 673, 1485, 10055, 10384, 1233, 2]
// Exports: useFavoriteGIFsMobile
// Module 10383 (transformFavoriteGifUrl)
import isDiscordProxiedAssetUrlDefault from "isDiscordProxiedAssetUrl" /* 1485 */;
import isRefreshableAttachmentUrlAll from "isRefreshableAttachmentUrl" /* 10055 */;
import closure_4 from "noop" /* 19 */;
const require = arg1;
function transformFavoriteGifUrl(url) {
let combined = url;
const str = isDiscordProxiedAssetUrlDefault.toURLSafe(url);
if (null != str) {
if (obj6.isExternalProxiedAttachmentUrl(str)) {
const formatted = str.pathname.toLowerCase();
const formatted1 = str.pathname.toLowerCase();
let endsWithResult1 = formatted1.endsWith(".avif");
const formatted2 = str.pathname.toLowerCase();
const endsWithResult2 = formatted2.endsWith(".gif");
if (!endsWithResult1) {
endsWithResult1 = endsWithResult2;
}
if (endsWithResult1) {
const searchParams = str.searchParams;
const result = searchParams.set("format", "webp");
}
const searchParams2 = str.searchParams;
const result1 = searchParams2.set("animated", "true");
return str.toString();
} else {
const tmp14Result = tmp14(10055);
}
obj6 = isRefreshableAttachmentUrlAll;
tmp14 = importAll;
}
if (regex.test(arg1)) {
const match = regex3.exec(arg1);
let substr;
if (match != null) {
const first = match[0];
if (first != null) {
substr = first.slice(1);
}
}
const _HermesInternal2 = HermesInternal;
return "https://media.giphy.com/media/" + substr + "/giphy.gif";
} else {
if (regex2.test(arg1)) {
const _HermesInternal = HermesInternal;
combined = "" + arg1 + ".gif";
}
return combined;
}
const obj = isDiscordProxiedAssetUrlDefault;
}
require("ME").GIFPickerResultTypes;
const re6 = /(https?:\/\/)(?!media(?:\d+)?\.)(?:[^.]+\.)*giphy\.com/;
const re7 = /(tenor\.com)/;
const re8 = /-(?:.(?!-))+$/;
let result = require("set").fileFinishedImporting("modules/gif_picker/native/GIFPickerUtils.tsx");
export const GIF_HEADER_HEIGHT = 56;
export const useFavoriteGIFsMobile = function useFavoriteGIFsMobile() {
let obj = sortedFavoriteGIFs(10384);
sortedFavoriteGIFs = obj.useSortedFavoriteGIFs(transformFavoriteGifUrl);
const items = [sortedFavoriteGIFs];
obj = {
favorites: sortedFavoriteGIFs,
favoritesCategory: React.useMemo(() => {
let tmp2;
if (sortedFavoriteGIFs.length > 0) {
const obj = { type: null, name: null, src: null, format: null };
obj[0] = closure_1_5.FAVORITES;
const intl = sortedFavoriteGIFs(closure_1_3[5]).intl;
obj[1] = intl.string(sortedFavoriteGIFs(closure_1_3[5]).t.k8fFjp);
obj[2] = tmp[0].src;
obj[3] = tmp[0].format;
tmp2 = obj;
}
return tmp2;
}, items)
};
return obj;
};
export const GIF_PICKER_ITEM_ESIMTATED_HEIGHT = 180;
export const GIF_PICKER_GUTTER_SPACING = 8;
export const DEFAULT_CATEGORY_ROWS = 20;