601 lines
20 KiB
TypeScript
601 lines
20 KiB
TypeScript
/* Metro module 9684; source: modules/search/SearchFetcher.tsx; dependencies: [15, 17, 18, 5, 6, 7, 1379, 661, 672, 3, 507, 1468, 2] */
|
|
function _fun76099(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#76099, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9870:6, offset: 0x01dc4100, size: 310 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_4 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_5 = importDefault(18) /* metro dependency 18 */;
|
|
const env0_6 = importDefault(5) /* metro dependency 5 */;
|
|
const env0_7 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_8 = importDefault(7) /* metro dependency 7 */;
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
let value = require(661) /* metro dependency 661: Constants */;
|
|
const env0_10 = value.SearchTypes;
|
|
const env0_11 = value.Endpoints;
|
|
value = _fun76104();
|
|
const value2 = _fun76111(value);
|
|
const value3 = _fun76115(value);
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/search/SearchFetcher.tsx');
|
|
exports.SearchFetcher = value;
|
|
exports.SearchFetcherImpl = value2;
|
|
exports.SearchTabFetcherImpl = value3;
|
|
}
|
|
|
|
function _callSuper_76100(a0, a1, a2) { // fn#76100, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9870:208, offset: 0x01dc4236, size: 100 bytes, params: 4, frame: 20
|
|
var r0;
|
|
var Reflect;
|
|
let value = a2;
|
|
const value3 = env0_4(a1);
|
|
const binding = env0_3;
|
|
if (_isNativeReflectConstruct_76101()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value3, value || [], env0_4(a0).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value3.apply(a0, value);
|
|
r0 = value;
|
|
}
|
|
return binding(a0, r0);
|
|
}
|
|
|
|
function _isNativeReflectConstruct_76101() { // fn#76101, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9870:339, offset: 0x01dc429a, size: 98 bytes, params: 1, frame: 18
|
|
var Boolean;
|
|
var prototype;
|
|
var valueOf;
|
|
var call;
|
|
var Reflect;
|
|
var construct;
|
|
var closure;
|
|
var value;
|
|
var error;
|
|
try {
|
|
Boolean = global.Boolean;
|
|
prototype = Boolean.prototype;
|
|
valueOf = prototype.valueOf;
|
|
call = valueOf.call;
|
|
Reflect = global.Reflect;
|
|
construct = Reflect.construct;
|
|
Boolean = global.Boolean;
|
|
closure = function() {
|
|
};
|
|
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
|
|
value = Reflect.apply(call, valueOf, [value]);
|
|
var result = !value;
|
|
} catch (error) {
|
|
}
|
|
return (_isNativeReflectConstruct_76101_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _fun76104() { // fn#76104, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9870:538, offset: 0x01dc42fc, size: 131 bytes, params: 1, frame: 16
|
|
const binding = env0_8;
|
|
const closure = SearchFetcher;
|
|
const env0_0 = env0_6(_fun76107);
|
|
return binding(closure, [{key: 'fetch', value: value_76108}, {key: 'cancel', value: function() {
|
|
this.isCanceled = true;
|
|
if (this.indexingPollId != null) {
|
|
global.clearTimeout(this.indexingPollId);
|
|
}
|
|
}}, {key: 'retryLater', value: function(a0, a1, a2) {
|
|
if (this.indexingPollId != null) {
|
|
global.clearTimeout(this.indexingPollId);
|
|
}
|
|
this.indexingPollId = global.setTimeout(this.fetch.bind(this, a0, a1, a2), this.retryDelay);
|
|
}}]);
|
|
}
|
|
|
|
function _fun76111(a0) { // fn#76111, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9870:1527, offset: 0x01dc4613, size: 99 bytes, params: 2, frame: 16
|
|
const closure = SearchFetcherImpl;
|
|
env0_5(closure, a0);
|
|
return env0_8(closure, [{key: 'getEndpoint', value: value_76113}, {key: 'makeRequest', value: value_76114}]);
|
|
}
|
|
|
|
function _fun76115(a0) { // fn#76115, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9870:2438, offset: 0x01dc485d, size: 99 bytes, params: 2, frame: 16
|
|
const closure = SearchTabFetcherImpl;
|
|
env0_5(closure, a0);
|
|
return env0_8(closure, [{key: 'getEndpoint', value: value_76117}, {key: 'makeRequest', value: value_76118}]);
|
|
}
|
|
|
|
function SearchFetcher(a0, a1, a2) { // fn#76105, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9870:559, offset: 0x01dc437f, size: 62 bytes, params: 4, frame: 13
|
|
env1_7(this, SearchFetcher);
|
|
this.isCanceled = false;
|
|
this.searchId = a0;
|
|
this.searchType = a1;
|
|
this.query = a2;
|
|
}
|
|
|
|
function* _fun76107(a0, a1, a2) { // fn#76107, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9870:705, offset: 0x01dc43c8, size: 443 bytes, params: 4, frame: 24
|
|
var r12;
|
|
var r7;
|
|
var isCanceled;
|
|
var makeRequest;
|
|
var object2;
|
|
var value3;
|
|
var value4;
|
|
var status;
|
|
var value5;
|
|
var value6;
|
|
var query;
|
|
var query2;
|
|
var attempts;
|
|
var value7;
|
|
var value8;
|
|
var value9;
|
|
var value10;
|
|
var parseInt;
|
|
var headers;
|
|
var property;
|
|
var int;
|
|
var isNaN;
|
|
var isNaN2;
|
|
var value11;
|
|
var value12;
|
|
var value13;
|
|
var binding;
|
|
var binding2;
|
|
var value14;
|
|
var Millis;
|
|
var SECOND;
|
|
var value15;
|
|
var retryLater;
|
|
var error;
|
|
var prototype;
|
|
var value16;
|
|
var error2;
|
|
let value = undefined;
|
|
if (false) {
|
|
return value;
|
|
}
|
|
reduciblePort70: while (true) {
|
|
exceptionLanding69: while (true) {
|
|
isCanceled = this.isCanceled;
|
|
if (isCanceled) {
|
|
break reduciblePort70;
|
|
}
|
|
try {
|
|
makeRequest = this.makeRequest;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
object2 = {};
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
object2.rejectWithError = false;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
value = Reflect.apply(makeRequest, this, [object2]);
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
yield value;
|
|
try {
|
|
value = undefined;
|
|
value3 = false;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
if (value3) {
|
|
return value;
|
|
}
|
|
try {
|
|
value4 = value == null;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
if (value4) {
|
|
return undefined;
|
|
}
|
|
try {
|
|
isCanceled = this.isCanceled;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
if (isCanceled) {
|
|
return undefined;
|
|
}
|
|
try {
|
|
status = value.status;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
value5 = status === 200;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
if (value5) {
|
|
try {
|
|
a0(value);
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
break reduciblePort70;
|
|
}
|
|
try {
|
|
status = value.status;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
value6 = status !== 202;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
if (value6) {
|
|
break reduciblePort70;
|
|
}
|
|
try {
|
|
query = this.query;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
query2 = this.query;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
attempts = query2.attempts;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
value7 = attempts != null;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
value8 = 0;
|
|
reducibleJoin29: while (true) {
|
|
if (value7) {
|
|
r12 = attempts;
|
|
break reducibleJoin29;
|
|
}
|
|
r12 = value8;
|
|
break reducibleJoin29;
|
|
}
|
|
try {
|
|
value9 = r12 + 1;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
query.attempts = value9;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
query = this.query;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
attempts = query.attempts;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
value10 = attempts > 5;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
if (value10) {
|
|
return undefined;
|
|
}
|
|
try {
|
|
parseInt = global.parseInt;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
headers = value.headers;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
property = headers['retry-after'];
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
int = parseInt(property);
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
isNaN = global.isNaN;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
isNaN2 = isNaN(int);
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
value11 = 5000;
|
|
reducibleJoin57: while (true) {
|
|
if (isNaN2) {
|
|
r7 = value11;
|
|
break reducibleJoin57;
|
|
}
|
|
try {
|
|
value12 = value8 === int;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
if (value12) {
|
|
r7 = value11;
|
|
break reducibleJoin57;
|
|
}
|
|
value13 = environment.__proto__.__proto__;
|
|
try {
|
|
binding = env2_1;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
binding2 = env2_2;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
property = binding2[8];
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
value14 = binding(property);
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
Millis = value14.Millis;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
SECOND = Millis.SECOND;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
value15 = int * SECOND;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
r7 = value15;
|
|
break reducibleJoin57;
|
|
}
|
|
try {
|
|
this.retryDelay = r7;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
retryLater = this.retryLater;
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
Reflect.apply(retryLater, this, [a0, a1, a2]);
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
try {
|
|
a1(value);
|
|
} catch (error) {
|
|
break exceptionLanding69;
|
|
}
|
|
break reduciblePort70;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_1;
|
|
value = binding(env2_2[9]);
|
|
prototype = value.prototype;
|
|
value16 = Object.create(prototype, {constructor: {value: value}});
|
|
value = new value('SearchFetcher');
|
|
value = value instanceof Object ? value : value16;
|
|
error2 = value.error;
|
|
Reflect.apply(error2, value, [error]);
|
|
a2(error);
|
|
break reduciblePort70;
|
|
}
|
|
}
|
|
|
|
function SearchFetcherImpl() { // fn#76112, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9870:1539, offset: 0x01dc4676, size: 42 bytes, params: 1, frame: 16
|
|
env1_7(this, SearchFetcherImpl);
|
|
return _callSuper_76100(this, SearchFetcherImpl, arguments);
|
|
}
|
|
|
|
function value_76113() { // fn#76113, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9870:1722, offset: 0x01dc46a0, size: 318 bytes, params: 1, frame: 15
|
|
var r5;
|
|
var searchId;
|
|
var SEARCH_CHANNEL;
|
|
var getChannel;
|
|
var value3;
|
|
var value4;
|
|
var SEARCH_GUILD;
|
|
const searchType = this.searchType;
|
|
let value = environment.__proto__;
|
|
const GUILD = SearchTypes.GUILD;
|
|
if (GUILD === searchType) {
|
|
searchId = this.searchId;
|
|
if (searchId == null) {
|
|
return undefined;
|
|
}
|
|
searchId = this.searchId;
|
|
if (searchId === '') {
|
|
return undefined;
|
|
}
|
|
SEARCH_GUILD = Endpoints.SEARCH_GUILD;
|
|
searchId = this.searchId;
|
|
return Reflect.apply(SEARCH_GUILD, Endpoints, [searchId]);
|
|
}
|
|
const GUILD_CHANNEL = SearchTypes.GUILD_CHANNEL;
|
|
if (GUILD_CHANNEL === searchType) {
|
|
searchId = this.searchId;
|
|
if (searchId == null) {
|
|
return undefined;
|
|
}
|
|
searchId = this.searchId;
|
|
if (searchId === '') {
|
|
return undefined;
|
|
}
|
|
getChannel = ChannelStore.getChannel;
|
|
searchId = this.searchId;
|
|
value3 = Reflect.apply(getChannel, ChannelStore, [searchId]);
|
|
value4 = undefined;
|
|
r5 = value3 == null ? value4 : value3.getGuildId();
|
|
if (r5 == null) {
|
|
return value4;
|
|
}
|
|
return Endpoints.SEARCH_GUILD(r5);
|
|
}
|
|
const CHANNEL = SearchTypes.CHANNEL;
|
|
if (CHANNEL === searchType) {
|
|
searchId = this.searchId;
|
|
if (searchId == null) {
|
|
return undefined;
|
|
}
|
|
searchId = this.searchId;
|
|
if (searchId === '') {
|
|
return undefined;
|
|
}
|
|
SEARCH_CHANNEL = Endpoints.SEARCH_CHANNEL;
|
|
searchId = this.searchId;
|
|
return Reflect.apply(SEARCH_CHANNEL, Endpoints, [searchId]);
|
|
}
|
|
const Error = global.Error;
|
|
value = '[SearchFetcher] Unhandled search type: ' + this.searchType;
|
|
const value2 = Object.create(Error.prototype, {constructor: {value: Error}});
|
|
const error = new Error(value);
|
|
throw error instanceof Object ? error : value2;
|
|
}
|
|
|
|
function value_76114({rejectWithError}) { // fn#76114, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9870:2254, offset: 0x01dc47de, size: 127 bytes, params: 2, frame: 18
|
|
var r0;
|
|
var value3;
|
|
var HTTP;
|
|
var get;
|
|
var object2;
|
|
let value = this.getEndpoint();
|
|
if (value == null) {
|
|
r0 = null;
|
|
} else {
|
|
value3 = environment.__proto__;
|
|
HTTP = (require(507) /* metro dependency 507: HTTPUtils */).HTTP;
|
|
get = HTTP.get;
|
|
object2 = {url: value};
|
|
value = importDefault(1468) /* metro dependency 1468 */;
|
|
object2.query = value.stringify(this.query);
|
|
object2.oldFormErrors = true;
|
|
object2.rejectWithError = rejectWithError;
|
|
value = Reflect.apply(get, HTTP, [object2]);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function SearchTabFetcherImpl(a0, a1, a2, a3) { // fn#76116, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9870:2450, offset: 0x01dc48c0, size: 72 bytes, params: 5, frame: 16
|
|
let value = environment.__proto__;
|
|
env1_7(this, SearchTabFetcherImpl);
|
|
value = _callSuper_76100(this, SearchTabFetcherImpl, [a0, a1, a2]);
|
|
value.payload = a3;
|
|
return value;
|
|
}
|
|
|
|
function value_76117() { // fn#76117, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9870:2675, offset: 0x01dc4908, size: 270 bytes, params: 1, frame: 14
|
|
var searchId;
|
|
var SEARCH_TABS_CHANNEL;
|
|
var SEARCH_TABS_GUILD;
|
|
const searchType = this.searchType;
|
|
let value = environment.__proto__;
|
|
const DMS = SearchTypes.DMS;
|
|
if (DMS === searchType) {
|
|
return Endpoints.SEARCH_TABS_DMS;
|
|
}
|
|
const GUILD_CHANNEL = SearchTypes.GUILD_CHANNEL;
|
|
if (GUILD_CHANNEL === searchType) {
|
|
searchId = this.searchId;
|
|
if (searchId == null) {
|
|
return undefined;
|
|
}
|
|
searchId = this.searchId;
|
|
if (searchId === '') {
|
|
return undefined;
|
|
}
|
|
SEARCH_TABS_GUILD = Endpoints.SEARCH_TABS_GUILD;
|
|
searchId = this.searchId;
|
|
return Reflect.apply(SEARCH_TABS_GUILD, Endpoints, [searchId]);
|
|
}
|
|
const GUILD = SearchTypes.GUILD;
|
|
if (GUILD === searchType) {
|
|
searchId = this.searchId;
|
|
if (searchId == null) {
|
|
return undefined;
|
|
}
|
|
searchId = this.searchId;
|
|
if (searchId === '') {
|
|
return undefined;
|
|
}
|
|
SEARCH_TABS_GUILD = Endpoints.SEARCH_TABS_GUILD;
|
|
searchId = this.searchId;
|
|
return Reflect.apply(SEARCH_TABS_GUILD, Endpoints, [searchId]);
|
|
}
|
|
const THREAD = SearchTypes.THREAD;
|
|
if (THREAD === searchType) {
|
|
searchId = this.searchId;
|
|
if (searchId == null) {
|
|
return undefined;
|
|
}
|
|
searchId = this.searchId;
|
|
if (searchId === '') {
|
|
return undefined;
|
|
}
|
|
SEARCH_TABS_GUILD = Endpoints.SEARCH_TABS_GUILD;
|
|
searchId = this.searchId;
|
|
return Reflect.apply(SEARCH_TABS_GUILD, Endpoints, [searchId]);
|
|
}
|
|
const CHANNEL = SearchTypes.CHANNEL;
|
|
if (CHANNEL === searchType) {
|
|
searchId = this.searchId;
|
|
if (searchId == null) {
|
|
return undefined;
|
|
}
|
|
searchId = this.searchId;
|
|
if (searchId === '') {
|
|
return undefined;
|
|
}
|
|
SEARCH_TABS_CHANNEL = Endpoints.SEARCH_TABS_CHANNEL;
|
|
searchId = this.searchId;
|
|
return Reflect.apply(SEARCH_TABS_CHANNEL, Endpoints, [searchId]);
|
|
}
|
|
const Error = global.Error;
|
|
value = '[SearchFetcher] Unhandled search type: ' + this.searchType;
|
|
const value2 = Object.create(Error.prototype, {constructor: {value: Error}});
|
|
const error = new Error(value);
|
|
throw error instanceof Object ? error : value2;
|
|
}
|
|
|
|
function value_76118({rejectWithError}) { // fn#76118, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9870:3108, offset: 0x01dc4a16, size: 100 bytes, params: 2, frame: 15
|
|
var r0;
|
|
var value3;
|
|
let value = this.getEndpoint();
|
|
if (value == null) {
|
|
r0 = null;
|
|
} else {
|
|
value3 = environment.__proto__;
|
|
value = (require(507) /* metro dependency 507: HTTPUtils */).HTTP.post({url: value, body: this.payload,
|
|
oldFormErrors: true, rejectWithError: rejectWithError});
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|