// Metro module 9600 (f9601). import { useMemo } from "react"; import { GIFPickerResultTypes } from "../../../Constants"; import URLUtils from "../../../utils/URLUtils"; import { isExternalProxiedAttachmentUrl, isAttachmentUrl } from "../../messages/SignedAttachmentLinkUtils"; import { useSortedFavoriteGIFs } from "../FavoriteGIFHooks"; import { intl, t } from "../../../intl/index.native"; let c6342_5, c6342_6, c6342_7; const transformFavoriteGifUrl = function transformFavoriteGifUrl(a0, a1) { let r8; L6: { r8 = a0; const r15 = URLUtils.toURLSafe(a0); if (r15 != null) { if (!isExternalProxiedAttachmentUrl(r15) && !isAttachmentUrl(r15)) { break L6; } const r28 = r15.pathname.toLowerCase().endsWith(".webp"); let r34 = r15.pathname.toLowerCase().endsWith(".avif"); const r39 = r15.pathname.toLowerCase().endsWith(".gif"); if (!r28 && !r34 && !r39) { break L6; } if (!r34) { r34 = r39; } if (r34) { r15.searchParams.set("format", "webp"); } r15.searchParams.set("animated", "true"); return r15.toString(); } } if (c6342_5.test(a1)) { const r53 = c6342_7.exec(a1); const r3 = r53 == null; let r54 = void 0; if (!r3) { const r55 = r53[0]; r54 = r55 == null ? void 0 : r55.slice(1); } return `https://media.giphy.com/media/${r54}/giphy.gif`; } if (c6342_6.test(a1)) { r8 = `${a1}.gif`; } return r8; }; c6342_5 = /(https?:\/\/)(?!media(?:\d+)?\.)(?:[^.]+\.)*giphy\.com/; c6342_6 = /(tenor\.com)/; c6342_7 = /-(?:.(?!-))+$/; export const GIF_HEADER_HEIGHT = 56; export function useFavoriteGIFsMobile() { const sortedFavoriteGIFs = useSortedFavoriteGIFs(transformFavoriteGifUrl); return { favorites: sortedFavoriteGIFs, favoritesCategory: useMemo(() => sortedFavoriteGIFs.length > 0 ? { type: GIFPickerResultTypes.FAVORITES, name: intl.string(t.k8fFjp), src: sortedFavoriteGIFs[0].src, format: sortedFavoriteGIFs[0].format } : void 0, [sortedFavoriteGIFs]) }; } export const GIF_PICKER_ITEM_ESIMTATED_HEIGHT = 180; export const GIF_PICKER_GUTTER_SPACING = 8; export const DEFAULT_CATEGORY_ROWS = 20;