/* Metro module 6772; source: modules/applications/ApplicationActionCreators.tsx; dependencies: [5, 6773, 4235, 4234, 661, 694, 507, 566, 2] */ 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 var object2; const env0_0 = require; const closure = function() { return _fetchApplication.apply(this, arguments); }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importDefault(5) /* metro dependency 5 */; const applicationDirectoryApplicationsStore = importDefault(6773) /* metro dependency 6773: ApplicationDirectoryApplicationsStore */; const applicationRecord = importDefault(4235) /* metro dependency 4235: ApplicationRecord */; let value = importDefault(4234) /* metro dependency 4234: ApplicationStore */; const constantsModule = require(661) /* metro dependency 661: Constants */; const env0_7 = constantsModule.Endpoints; const env0_8 = constantsModule.NOOP; const QueryIds = constantsModule.QueryIds; object2 = {createApplication: function({name, guildId, type, teamId}) { return teamId(_fun53340)(); }, getApplicationsForGuild: getApplicationsForGuild, transferApplication: transferApplication, fetchApplications: fetchApplications_53348, fetchApplication: closure}; const fluxModule = require(566) /* metro dependency 566: flux */; 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}]); (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/applications/ApplicationActionCreators.tsx'); exports.default = object2; 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 env0_3(_fun53338).apply(this, arguments); } 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 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 env0_3(_fun53344)(); } 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 env0_3(_fun53347)(); } 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 env0_3(_fun53350)(); } 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 application; const value = null; if (value != a0) { if (ApplicationStore.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 fluxModule = require(566) /* metro dependency 566: flux */; const useStateFromStores = fluxModule.useStateFromStores; return {app: Reflect.apply(useStateFromStores, fluxModule, [[ApplicationDirectoryApplicationsStore], _fun53359, [a0, data]]), isLoading: isLoading, error: error ?? value2}; } 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 object4; var binding2; var property; var value6; var HTTP; var get; var APPLICATION_PUBLIC; var value7; var object3; 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 { object4 = {}; } 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 { object4.url = value7; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { object3 = {}; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { object3.with_guild = r1; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { object4.query = object3; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { object4.oldFormErrors = true; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { object4.signal = a2; } catch (error) { binding = env2_1; value = binding(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_FAIL', applicationId: a0}); throw error; } try { object4.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, [object4]); } 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 { object4 = {'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 { object4.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, [object4]); } 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* _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: require, type: dependencyMap, guild_id: importDefault, team_id: env1_3}, rejectWithError: false}]); const value4 = undefined; if (false) { return value4; } const body = value4.body; if (importDefault != null && dependencyMap != null) { value = env2_1(env2_2[5]); value.dispatch({type: 'APPLICATION_FETCH_SUCCESS', application: body}); } return body; } 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 object3 = {}; binding = env2_7; object3.url = binding.GUILD_APPLICATIONS(require); const object4 = {}; copyDataProperties(object4, dependencyMap, binding); object4['include_team'] = importDefault; object3.query = object4; object3.rejectWithError = false; yield Reflect.apply(get, HTTP, [object3]); 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* _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 object2 = {}; object2.url = env2_7.APPLICATION_OWNER_TRANSFER(require); object2.body = {team_id: importDefault}; object2.rejectWithError = false; yield Reflect.apply(post, HTTP, [object2]); 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* _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 object2; 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 { object2 = {}; } 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 { object2.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 { object2.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 { object2.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 { object2.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, [object2]); } 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 _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; } 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; }