decord/source/modules/gif_picker/native/GIFPickerUtils.tsx
github-actions f0f877e8ce chore: update source for alpha 347.1
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4824.js (118.4 MB)
2026-09-15 14:23:42 +00:00

89 lines
2.9 KiB
TypeScript

// Module ID: 10501
// Function ID: 10502
// Name: gif_picker/GIFPickerUtils
// Dependencies: [19, 1074, 1366, 10074, 10502, 1115, 2]
// Exports: useFavoriteGIFsMobile
// Module 10501 (gif_picker/GIFPickerUtils)
import util from "util" /* 1115 */;
import URLUtilsDefault from "URLUtils" /* 1366 */;
import AttachmentUrlUtilsAll from "AttachmentUrlUtils" /* 10074 */;
import noop from "module_19" /* 19 */;
require = fn;
function transformFavoriteGifUrl(url, arg1) {
let combined = url;
const str = URLUtilsDefault.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(10074);
}
obj6 = AttachmentUrlUtilsAll;
tmp14 = importAll;
}
if (re6.test(arg1)) {
const match = re8.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 (re7.test(arg1)) {
const _HermesInternal = HermesInternal;
combined = "" + arg1 + ".gif";
}
return combined;
}
}
fn(1074).GIFPickerResultTypes;
const re6 = /(https?:\/\/)(?!media(?:\d+)?\.)(?:[^.]+\.)*giphy\.com/;
const re7 = /(tenor\.com)/;
const re8 = /-(?:.(?!-))+$/;
const size = fn(2);
let result = size.fileFinishedImporting("modules/gif_picker/native/GIFPickerUtils.tsx");
export const GIF_HEADER_HEIGHT = 56;
export const useFavoriteGIFsMobile = function useFavoriteGIFsMobile() {
sortedFavoriteGIFs = sortedFavoriteGIFs(10502).useSortedFavoriteGIFs(transformFavoriteGifUrl);
const items = [sortedFavoriteGIFs];
let obj = sortedFavoriteGIFs(10502);
return {
favorites: sortedFavoriteGIFs,
favoritesCategory: noop.useMemo(() => {
let tmp2;
if (sortedFavoriteGIFs.length > 0) {
const obj = { type: GIFPickerResultTypes.FAVORITES, name: null, src: null, format: null };
const intl = util.intl;
obj.name = intl.string(util.t.k8fFjp);
obj.src = tmp[0].src;
obj.format = tmp[0].format;
tmp2 = obj;
}
return tmp2;
}, items)
};
};
export const GIF_PICKER_ITEM_ESIMTATED_HEIGHT = 180;
export const GIF_PICKER_GUTTER_SPACING = 8;
export const DEFAULT_CATEGORY_ROWS = 20;