/* Metro module 6772; source: modules/applications/ApplicationActionCreators.tsx; dependencies: [5, 6773, 4235, 4234, 661, 694, 507, 566, 2] */ import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */ import ApplicationStore from './ApplicationStore.tsx'; /* Metro dependency 4234 */ import ApplicationRecord from '../../records/ApplicationRecord.tsx'; /* Metro dependency 4235 */ import ApplicationDirectoryApplicationsStore from '../global_discovery_apps/stores/ApplicationDirectoryApplicationsStore.tsx'; /* Metro dependency 6773 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */ function _fun53334(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#53334, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6950:6, offset: 0x0134639b, size: 361 bytes, params: 8, frame: 22 const env0_0 = require; const closure = function() { return _fetchApplication.apply(this, arguments); }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = ApplicationStore; const QueryIds = ConstantsModule.QueryIds; object = {createApplication: function({name, guildId, type, teamId}) { return teamId(_fun53340)(); }, getApplicationsForGuild: getApplicationsForGuild, transferApplication: transferApplication, fetchApplications: fetchApplications_53348, fetchApplication: closure}; const createFetchStore = FluxModule.createFetchStore; const APPLICATIONS = QueryIds.APPLICATIONS; value = Reflect.apply(createFetchStore, FluxModule, [value, {getQueryId: APPLICATIONS, get: get_53355, load: load_53356, getIsLoading: getIsLoading_53357}]); (FileImportTrackerModule).fileFinishedImporting('modules/applications/ApplicationActionCreators.tsx'); exports.default = object; exports.fetchApplication = closure; exports.useApplication = value; exports.useApplicationWithLoggedOutContext = useApplicationWithLoggedOutContext; function _fetchApplication() { // fn#53336, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6950:259, offset: 0x01346504, size: 48 bytes, params: 1, frame: 14 return Module00005(_fun53338).apply(this, arguments); async function _fun53338(a0) { // fn#53338, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6950:316, offset: 0x01346546, size: 306 bytes, params: 2, frame: 22 var object2; var binding2; var property; var value6; var HTTP; var get; var APPLICATION_PUBLIC; var value7; var object; var value8; var value9; var value10; var binding3; var value11; var body; var error; let value = a1; if (false) { return undefined; } const r1 = value !== undefined ? value : false; await undefined; if (false) { return undefined; } value = environment.__proto__.__proto__; let binding = env2_1; binding(env2_2[5]).dispatch({type: 'APPLICATION_FETCH', applicationId: a0}); try { binding = env2_0; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { binding2 = env2_2; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { property = binding2[6]; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { value6 = binding(property); } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { HTTP = value6.HTTP; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { get = HTTP.get; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { object2 = {}; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { binding = env2_7; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { APPLICATION_PUBLIC = binding.APPLICATION_PUBLIC; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { value7 = Reflect.apply(APPLICATION_PUBLIC, binding, [a0]); } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { object2.url = value7; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { object = {}; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { object.with_guild = r1; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { object2.query = object; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { object2.oldFormErrors = true; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { object2.signal = a2; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { object2.rejectWithError = false; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { value8 = Reflect.apply(get, HTTP, [object2]); } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } await value8; try { value9 = undefined; value10 = false; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } if (value10) { return value9; } try { binding = env2_1; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { binding3 = env2_2; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { property = binding3[5]; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { value11 = binding(property); } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { dispatch = value11.dispatch; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { object2 = {'type': 'APPLICATION_FETCH_SUCCESS', 'application': null, 'isHydrated': true}; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { body = value9.body; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { object2.application = body; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { Reflect.apply(dispatch, value11, [object2]); } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { body = value9.body; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } return body; } } function createApplication({name, guildId, type, teamId}) { // fn#53339, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6950:762, offset: 0x01346678, size: 67 bytes, params: 2, frame: 11 return teamId(_fun53341)(); function _fun53340() { // fn#53340, offset: 0x013466bb, size: 9 bytes, params: 1, frame: 1 return _fun53341; } function* _fun53341() { // fn#53341, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6950:803, offset: 0x013466c4, size: 207 bytes, params: 1, frame: 17 if (false) { return undefined; } value = environment.__proto__.__proto__; const HTTP = env2_0(env2_2[6]).HTTP; const post = HTTP.post; const APPLICATIONS = env2_7.APPLICATIONS; yield Reflect.apply(post, HTTP, [{url: APPLICATIONS, body: {name: env1_0, type: env1_2, guild_id: env1_1, team_id: env1_3}, rejectWithError: false}]); const value4 = undefined; if (false) { return value4; } const body = value4.body; if (env1_1 != null && env1_2 != null) { value = env2_1(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_SUCCESS', application: body}); } return body; } } function getApplicationsForGuild(a0) { // fn#53342, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6950:1058, offset: 0x01346793, size: 81 bytes, params: 2, frame: 15 let value = a1; const env0_0 = a0; const r4 = value !== undefined ? value : {}; const env0_1 = r4.includeTeam; value = Object.create(null); value.includeTeam = 0; const env0_2 = copyDataProperties({}, r4, value, r4); return Module00005(_fun53344)(); function* _fun53344() { // fn#53344, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6950:1090, offset: 0x013467ed, size: 186 bytes, params: 1, frame: 19 if (false) { return undefined; } value = environment.__proto__.__proto__; let binding = env2_0; const HTTP = binding(env2_2[6]).HTTP; const get = HTTP.get; const object = {}; binding = env2_7; object.url = binding.GUILD_APPLICATIONS(require); const object2 = {}; copyDataProperties(object2, dependencyMap, binding); object2['include_team'] = importDefault; object.query = object2; object.rejectWithError = false; yield Reflect.apply(get, HTTP, [object]); const value4 = undefined; if (false) { return value4; } const body = value4.body; value = env2_1(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_SUCCESS', applications: body}); return body; } } function transferApplication({applicationId, teamId}) { // fn#53345, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6950:1319, offset: 0x013468a7, size: 49 bytes, params: 2, frame: 11 return Module00005(_fun53347)(); function* _fun53347() { // fn#53347, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6950:1352, offset: 0x013468e1, size: 168 bytes, params: 1, frame: 18 if (false) { return undefined; } value = environment.__proto__.__proto__; const HTTP = env2_0(env2_2[6]).HTTP; const post = HTTP.post; const object = {}; object.url = env2_7.APPLICATION_OWNER_TRANSFER(require); object.body = {team_id: importDefault}; object.rejectWithError = false; yield Reflect.apply(post, HTTP, [object]); const value4 = undefined; if (false) { return value4; } const body = value4.body; value = env2_1(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_SUCCESS', application: body}); return body; } } function fetchApplications_53348(a0) { // fn#53348, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6950:1575, offset: 0x01346989, size: 47 bytes, params: 2, frame: 12 const value = a1; const env0_0 = a0; const env0_1 = !(value !== undefined) || value; return Module00005(_fun53350)(); function* _fun53350() { // fn#53350, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6950:1588, offset: 0x013469c1, size: 462 bytes, params: 1, frame: 24 var environment; var r5; var binding2; var property; var value4; var HTTP; var get; var APPLICATIONS_PUBLIC; var URLSearchParams; var map; var closure; var value5; var prototype; var uRLSearchParams; var value7; var toString; var value8; var value9; var value10; var value11; var error; var status; if (true) { var env0_0; value = environment.__proto__; r5 = importDefault ? require : require.filter(_fun53351); if (r5.length > 0) { value = environment.__proto__.__proto__; var binding = env2_1; var value3 = binding(env2_2[5]); var dispatch = value3.dispatch; Reflect.apply(dispatch, value3, [{type: 'APPLICATIONS_FETCH', applicationIds: r5}]); try { binding = env2_0; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { binding2 = env2_2; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { property = binding2[6]; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { value4 = binding(property); } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { HTTP = value4.HTTP; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { get = HTTP.get; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { object = {}; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { binding = env2_7; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { APPLICATIONS_PUBLIC = binding.APPLICATIONS_PUBLIC; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { object.url = APPLICATIONS_PUBLIC; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { URLSearchParams = global.URLSearchParams; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { map = r5.map; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { closure = function(a0) { return ['application_ids', a0]; }; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { value5 = Reflect.apply(map, r5, [closure]); } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { prototype = URLSearchParams.prototype; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { uRLSearchParams = new URLSearchParams(); } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { value7 = uRLSearchParams instanceof Object ? uRLSearchParams : undefined; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { toString = value7.toString; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { value8 = Reflect.apply(toString, value7, []); } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { object.query = value8; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { object.oldFormErrors = true; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { object.rejectWithError = false; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } try { value9 = Reflect.apply(get, HTTP, [object]); } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } yield value9; try { value10 = undefined; value11 = false; } catch (error) { status = error.status; if (status === 429) { throw error; } binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATIONS_FETCH_FAIL', applicationIds: r5}); throw error; } if (value11) { return value10; } var body = value10.body; var Set = global.Set; var value12 = body.map(function(a0) { return a0.id; }); prototype = Set.prototype; var value13 = Object.create(prototype, {constructor: {value: Set}}); var set = new Set(value12); env0_0 = set instanceof Object ? set : value13; var value15 = r5.filter(_fun53354); binding = env2_1; value = binding(env2_2[5]); dispatch = value.dispatch; body = value10.body; Reflect.apply(dispatch, value, [{type: 'APPLICATIONS_FETCH_SUCCESS', applications: body, unknownApplicationIds: value15, isHydrated: true}]); } } function _fun53351(a0) { // fn#53351, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6950:1627, offset: 0x01346b8f, size: 106 bytes, params: 2, frame: 13 const value = environment.__proto__.__proto__.__proto__; let r0 = env3_6.getApplication(a0) != null && env3_6.isHydrated(a0); r0 = !r0 && !env3_6.isFetchingApplication(a0) && !env3_6.didFetchingApplicationFail(a0) && a0.length > 0; return r0; } function _fun53354(a0) { // fn#53354, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6950:2157, offset: 0x00ec2076, size: 25 bytes, params: 2, frame: 11 const binding = env0_0; return !binding.has(a0); } } } function get_53355(a0) { // fn#53355, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6950:2385, offset: 0x01346c0c, size: 66 bytes, params: 2, frame: 14 var r0; var applicationStoreBinding; var application; const value = null; if (value != a0) { applicationStoreBinding = applicationStore; if (applicationStoreBinding.isHydrated(a0)) { application = applicationStore.getApplication(a0); r0 = value != application ? application : value; } else { r0 = value; } } else { r0 = value; } return r0; } function load_53356(a0) { // fn#53356, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6950:2471, offset: 0x01346c4e, size: 61 bytes, params: 2, frame: 15 return a0 != null ? fetchApplication(a0, false).then(NOOP) : global.Promise.resolve(); } function getIsLoading_53357(a0) { // fn#53357, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6950:2544, offset: 0x01346c8b, size: 32 bytes, params: 2, frame: 12 return a0 != null && applicationStore.isFetchingApplication(a0); } function useApplicationWithLoggedOutContext(a0) { // fn#53358, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6950:2777, offset: 0x01346cab, size: 134 bytes, params: 2, frame: 21 const env0_0 = a0; const value2 = undefined; const {data, isLoading, error} = env0_9(a0); const useStateFromStores = FluxModule.useStateFromStores; return {app: Reflect.apply(useStateFromStores, FluxModule, [[ApplicationDirectoryApplicationsStore], _fun53359, [a0, data]]), isLoading: isLoading, error: error ?? value2}; function _fun53359() { // fn#53359, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6950:2911, offset: 0x01346d31, size: 62 bytes, params: 1, frame: 14 if (data == null) { var application = ApplicationDirectoryApplicationsStore.getApplication(env0_0); if (application != null) { return ApplicationRecord.createFromServer(application); } } return data; } } } global.__d(_fun53334, 6772, [5, 6773, 4235, 4234, 661, 694, 507, 566, 2]) /* metro module 6772, dependencies: [5, 6773, 4235, 4234, 661, 694, 507, 566, 2] */;