Files
discord-decomp/sources/actions/AuthorizedAppsActionCreators.tsx
2026-07-28 01:06:53 +03:00

297 lines
12 KiB
TypeScript

/* Metro module 6779; source: actions/AuthorizedAppsActionCreators.tsx; dependencies: [5, 5109, 661, 4041, 694, 507, 2] */
import Module00005 from '../by-id/module-00005.js'; /* Metro dependency 5 */
import AuthorizedAppsStore from '../stores/AuthorizedAppsStore.tsx'; /* Metro dependency 5109 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as HTTPUtilsModule from '../external/discord_common/js/packages/http-utils/HTTPUtils.tsx'; /* Metro dependency 507 */
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
import * as TimersModule from '../external/discord_common/js/packages/timers/Timers.tsx'; /* Metro dependency 4041 */
import * as AuthorizedAppsStoreModule from '../stores/AuthorizedAppsStore.tsx'; /* Metro dependency 5109 */
function _fun53407(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#53407, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6957:6, offset: 0x01347e61, size: 284 bytes, params: 8, frame: 20
const env0_0 = require;
const _arrayLikeToArray_53410 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const tokensToAppTokensMap = function(a0, a1) {
var r0;
var r2;
var value2;
var value7;
var property = global.Object;
var fromEntries = property.fromEntries;
reducibleJoin2: while (true) {
if (a1 == null) {
r0 = undefined;
break reducibleJoin2;
}
value2 = a1.map(_fun53412);
r0 = value2;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0 != null) {
break reducibleJoin4;
}
r0 = [];
break reducibleJoin4;
}
var value3 = Reflect.apply(fromEntries, property, [r0]);
var value5 = _createForOfIteratorHelperLoose_53408(a0);
var value6 = value5();
if (!value6.done) {
r2 = value6;
reducibleLoop5: while (true) {
property = r2.value;
value3[property.application.id] = property;
value7 = value5();
if (value7.done) {
break reducibleLoop5;
}
r2 = value7;
continue reducibleLoop5;
}
}
return value3;
};
const closure = function() {
return _fetchAuthorizedApps.apply(this, arguments);
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const BatchInvocationManager = (TimersModule).BatchInvocationManager;
const batchInvocationManager = new BatchInvocationManager(closure, function(a0) {
return AuthorizedAppsStore.getFetchStateForApplication(a0) !== FetchState.FETCHING;
});
object = {fetch: fetch_53420, delete: _fun53421};
(FileImportTrackerModule).fileFinishedImporting('actions/AuthorizedAppsActionCreators.tsx');
exports.default = object;
function _createForOfIteratorHelperLoose_53408(a0, a1) { // fn#53408, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6957:163, offset: 0x01347f7d, size: 370 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun53409;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_53410(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_53410(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_53410(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun53409;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
function _fun53409() { // fn#53409, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6957:734, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return env0_1 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
}
}
function tokensToAppTokensMap(a0, a1) { // fn#53411, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6957:1188, offset: 0x013480ef, size: 123 bytes, params: 3, frame: 16
var r0;
var r2;
var map;
var value2;
var value7;
var application;
var id;
var value8;
const Object = global.Object;
const fromEntries = Object.fromEntries;
reducibleJoin2: while (true) {
if (a1 == null) {
r0 = undefined;
break reducibleJoin2;
}
map = a1.map;
value2 = Reflect.apply(map, a1, [function(a0) {
return [a0, null];
}]);
r0 = value2;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0 != null) {
break reducibleJoin4;
}
r0 = [];
break reducibleJoin4;
}
const value3 = Reflect.apply(fromEntries, Object, [r0]);
const value5 = _createForOfIteratorHelperLoose_53408(a0);
const value6 = value5();
let done = value6.done;
if (!done) {
r2 = value6;
reducibleLoop5: while (true) {
value7 = r2.value;
application = value7.application;
id = application.id;
value3[id] = value7;
value8 = value5();
done = value8.done;
if (done) {
break reducibleLoop5;
}
r2 = value8;
continue reducibleLoop5;
}
}
return value3;
}
function _fetchAuthorizedApps() { // fn#53414, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6957:1487, offset: 0x0134817d, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun53416).apply(this, arguments);
function* _fun53416(a0) { // fn#53416, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6957:1550, offset: 0x013481b6, size: 220 bytes, params: 2, frame: 20
var environment;
if (true) {
var env0_0 = a0;
value = environment.__proto__.__proto__;
env2_1(env2_2[4]).dispatch({type: 'USER_AUTHORIZED_APPS_REQUEST',
request: a0 == null ? {type: 'full'} : {type: 'partial', applicationIds: a0}});
var HTTP = env2_0(env2_2[5]).HTTP;
var get = HTTP.get;
var OAUTH2_TOKENS = env2_6.OAUTH2_TOKENS;
value = Reflect.apply(get, HTTP, [{'url': null, 'oldFormErrors': true, 'rejectWithError': true,
url: OAUTH2_TOKENS,
query: {application_ids: a0}}]);
yield value.then(_fun53417, _fun53418);
}
function _fun53417({body}) { // fn#53417, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6957:1798, offset: 0x01348292, size: 88 bytes, params: 2, frame: 16
let binding = env3_1;
const value2 = binding(env3_2[4]);
const dispatch = value2.dispatch;
const object = {type: 'USER_AUTHORIZED_APPS_UPDATE'};
binding = env0_0;
object.isFullFetch = binding == null;
object.tokens = env3_10(body, binding);
return Reflect.apply(dispatch, value2, [object]);
}
function _fun53418() { // fn#53418, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6957:1916, offset: 0x013482ea, size: 101 bytes, params: 1, frame: 14
const value = environment.__proto__.__proto__.__proto__;
return env3_1(env3_2[4]).dispatch({type: 'USER_AUTHORIZED_APPS_REQUEST_FAILED',
request: env0_0 == null ? {type: 'full'} : {type: 'partial', applicationIds: env0_0}});
}
}
}
function fetch_53420(a0) { // fn#53420, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6957:2082, offset: 0x01348374, size: 85 bytes, params: 2, frame: 12
const fetchState = AuthorizedAppsStore.getFetchState();
const FETCHING = FetchState.FETCHING;
if (fetchState !== FETCHING) {
if (a0 != null) {
env0_7.queue(a0);
} else {
env0_7.reset();
fetchAuthorizedApps();
}
}
}
function _fun53421(a0) { // fn#53421, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6957:2179, offset: 0x013483c9, size: 101 bytes, params: 2, frame: 16
const HTTP = (HTTPUtilsModule).HTTP;
const del = HTTP.del;
const object = {'url': null, 'oldFormErrors': true, 'rejectWithError': true};
object.url = Endpoints.OAUTH2_TOKEN(a0);
Reflect.apply(del, HTTP, [object]).then(_fun53422);
function _fun53422() { // fn#53422, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6957:2274, offset: 0x0134842e, size: 21 bytes, params: 1, frame: 9
env0_0.fetch();
}
}
}
function _fun53412(a0) { // fn#53412, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6957:1287, offset: 0x0134816a, size: 19 bytes, params: 2, frame: 2
return [a0, null];
}
global.__d(_fun53407, 6779, [5, 5109, 661, 4041, 694, 507,
2]) /* metro module 6779, dependencies: [5, 5109, 661, 4041, 694, 507, 2] */;