119 lines
3.0 KiB
TypeScript
119 lines
3.0 KiB
TypeScript
// Metro module 9596 (f9597).
|
|
import { GIFPickerResultTypes } from "../../Constants";
|
|
import { GIFType } from "../../_bundle/Module1341";
|
|
import { intl, t } from "../../intl/index.native";
|
|
import Module589 from "../../_bundle/Module589";
|
|
import Dispatcher from "../../Dispatcher";
|
|
let c6338_3, IMAGE, analyticsID, query, query2, c6338_8, c6338_9, items, items2;
|
|
const getFormatFromUrl = function getFormatFromUrl(src) {
|
|
let VIDEO;
|
|
L5: {
|
|
L7: {
|
|
try {
|
|
const r5 = new URL(src).pathname.toLowerCase();
|
|
if (!r5.endsWith(".mp4") && !r5.endsWith(".webm")) {
|
|
break L7;
|
|
}
|
|
VIDEO = GIFType.VIDEO;
|
|
break L5;
|
|
} catch ($e) {}
|
|
}
|
|
return GIFType.IMAGE;
|
|
}
|
|
return VIDEO;
|
|
};
|
|
c6338_3 = "tinywebp";
|
|
IMAGE = GIFType.IMAGE;
|
|
analyticsID = null;
|
|
query = "";
|
|
query2 = "";
|
|
c6338_8 = [];
|
|
c6338_9 = [];
|
|
items = [];
|
|
items2 = [];
|
|
class GIFPickerViewStore extends Module589.Store {
|
|
static displayName = "GIFPickerViewStore";
|
|
getAnalyticsID() {
|
|
return analyticsID;
|
|
}
|
|
getQuery() {
|
|
return query;
|
|
}
|
|
getResultQuery() {
|
|
return query2;
|
|
}
|
|
getResultItems() {
|
|
return c6338_8;
|
|
}
|
|
getTrendingCategories() {
|
|
return c6338_9;
|
|
}
|
|
getSelectedFormat() {
|
|
return c6338_3;
|
|
}
|
|
getSuggestions() {
|
|
return items;
|
|
}
|
|
getTrendingSearchTerms() {
|
|
return items2;
|
|
}
|
|
}
|
|
const gIFPickerViewStore = new GIFPickerViewStore(Dispatcher, {
|
|
GIF_PICKER_INITIALIZE: function handleInitialize(a0) {
|
|
analyticsID = a0.analyticsID;
|
|
},
|
|
GIF_PICKER_QUERY: function handleQuery(a0) {
|
|
query = a0.query;
|
|
if (query === "") {
|
|
query2 = "";
|
|
c6338_8 = [];
|
|
items = [];
|
|
}
|
|
},
|
|
GIF_PICKER_QUERY_SUCCESS: function handleQuerySuccess(a0) {
|
|
if (a0.query != null && query === query2) {
|
|
return false;
|
|
}
|
|
if (a0.query != null) {
|
|
query2 = a0.query;
|
|
}
|
|
c6338_8 = a0.items.map((item) => ({
|
|
width: item.width,
|
|
height: item.height,
|
|
src: item.src,
|
|
gifSrc: item.gif_src,
|
|
url: item.url,
|
|
id: item.id,
|
|
format: IMAGE
|
|
}));
|
|
},
|
|
GIF_PICKER_QUERY_FAILURE: function handleQueryFailure({ query: query3 }) {
|
|
if (query3 == null) {
|
|
return false;
|
|
}
|
|
query2 = query3;
|
|
c6338_8 = [];
|
|
},
|
|
GIF_PICKER_TRENDING_FETCH_SUCCESS: function handleTrendingFetchSuccess(a0) {
|
|
const trendingCategories = a0.trendingCategories;
|
|
c6338_9 = [...a0.trendingGIFPreview != null ? [{
|
|
type: GIFPickerResultTypes.TRENDING_GIFS,
|
|
name: intl.string(t.H6zNFz),
|
|
src: a0.trendingGIFPreview.src,
|
|
format: getFormatFromUrl(a0.trendingGIFPreview.src)
|
|
}] : [], ...trendingCategories.map((trendingCategory) => ({
|
|
...trendingCategory,
|
|
src: trendingCategory.src,
|
|
type: GIFPickerResultTypes.TRENDING_CATEGORY,
|
|
format: getFormatFromUrl(trendingCategory.src)
|
|
}))];
|
|
},
|
|
GIF_PICKER_SUGGESTIONS_SUCCESS: function handleSuggestionsSuccess(a0) {
|
|
items = a0.items;
|
|
},
|
|
GIF_PICKER_TRENDING_SEARCH_TERMS_SUCCESS: function handleTrendingSearchSuccess(a0) {
|
|
items2 = a0.items;
|
|
}
|
|
});
|
|
export default gIFPickerViewStore;
|