/* Metro module 11364; source: modules/applications/useGetOrFetchApplicationBatched.tsx; dependencies: [6, 7, 31, 4234, 4041, 22, 6772, 566, 2] */ import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */ import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */ import ApplicationStore from './ApplicationStore.tsx'; /* Metro dependency 4234 */ import ApplicationActionCreators from './ApplicationActionCreators.tsx'; /* Metro dependency 6772 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */ import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import * as TimersModule from '../../external/discord_common/js/packages/timers/Timers.tsx'; /* Metro dependency 4041 */ function _fun87131(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#87131, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11550:6, offset: 0x01fb0c8f, size: 223 bytes, params: 8, frame: 20 let env0_0 = require; const useRequestApplication2 = useRequestApplication; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = _fun87134(); value = new value(); (FileImportTrackerModule).fileFinishedImporting('modules/applications/useGetOrFetchApplicationBatched.tsx'); exports.useRequestApplication = useRequestApplication2; exports.useGetOrFetchApplicationBatched = function(a0) { var env0_0 = a0; useRequestApplication(a0); return require(dependencyMap[7]).useStateFromStores([ApplicationStore], _fun87144, [a0]); }; function useRequestApplication(a0) { // fn#87132, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11550:938, offset: 0x01fb0d6e, size: 46 bytes, params: 2, frame: 14 const env0_0 = a0; ReactModule.useEffect(_fun87133, [a0]); function _fun87133() { // fn#87133, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11550:985, offset: 0x01fb0d9c, size: 57 bytes, params: 1, frame: 12 var value4; if (env0_0 != null && env0_0 !== '') { value4 = environment.__proto__; env1_7.request(env0_0); } } } function _fun87134() { // fn#87134, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11550:142, offset: 0x01fb0dd5, size: 84 bytes, params: 1, frame: 15 return CreateClass(ApplicationFetchManager, [{key: 'request', value: function(a0) { var r1; var value; var value2; var property = this._pending; if (!property.has(a0)) { property = this._lastFetchedAttempted; value = property.get(a0); value2 = value != null; if (value2) { value = global.Date.now() - value; value = value < 60000; r1 = value; } else { r1 = value2; } if (!r1) { property = this._pending; property.add(a0); property = this._flushHandler; property.delay(false); } } }}, {key: '_flush', value: value_87138}]); function ApplicationFetchManager() { // fn#87135, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11550:163, offset: 0x01fb0e29, size: 161 bytes, params: 1, frame: 16 var environment; const value = environment.__proto__; env1_3(this, ApplicationFetchManager); const Map = global.Map; const value3 = Object.create(Map.prototype, {constructor: {value: Map}}); const map = new Map(); this._lastFetchedAttempted = map instanceof Object ? map : value3; const Set = global.Set; const value5 = Object.create(Set.prototype, {constructor: {value: Set}}); const set = new Set(); this._pending = set instanceof Object ? set : value5; const DelayedCall = (TimersModule).DelayedCall; this._flushHandler = new DelayedCall(32, _fun87136); function _fun87136() { // fn#87136, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11550:335, offset: 0x00dbfa8a, size: 19 bytes, params: 1, frame: 9 return env0_0._flush(); } } function value_87138() { // fn#87138, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11550:559, offset: 0x01fb0f45, size: 227 bytes, params: 1, frame: 16 var environment; var value; this._pending.forEach(_fun87139); this._pending.clear(); const items2 = []; const items3 = []; [].forEach(_fun87140); if (items2.length > 0) { value = environment.__proto__; value = importDefault(22) /* metro dependency 22 */; value = value.chunk(items2, 20); value.forEach(_fun87141); } if (items3.length > 0) { value = environment.__proto__; value = importDefault(22) /* metro dependency 22 */; value = value.chunk(items3, 20); value.forEach(_fun87142); } function _fun87139(a0) { // fn#87139, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11550:602, offset: 0x01fb1028, size: 62 bytes, params: 2, frame: 15 const _lastFetchedAttempted = env0_0._lastFetchedAttempted; const set = _lastFetchedAttempted.set; const Date = global.Date; Reflect.apply(set, _lastFetchedAttempted, [a0, Date.now()]); env0_1.push(a0); } function _fun87140(a0) { // fn#87140, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11550:711, offset: 0x01fb1066, size: 61 bytes, params: 2, frame: 12 const value = environment.__proto__.__proto__; if (ApplicationStore.didFetchingApplicationFail(a0)) { ClassCallCheck.push(a0); } else { env0_2.push(a0); } } function _fun87141(a0) { // fn#87141, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11550:811, offset: 0x01fb10a3, size: 44 bytes, params: 2, frame: 14 const value = environment.__proto__.__proto__; (ApplicationActionCreators).fetchApplications(a0, false); } function _fun87142(a0) { // fn#87142, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11550:891, offset: 0x01fb10cf, size: 44 bytes, params: 2, frame: 14 const value = environment.__proto__.__proto__; (ApplicationActionCreators).fetchApplications(a0, true); } } } function useGetOrFetchApplicationBatched(a0) { // fn#87143, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11550:1197, offset: 0x01fb10fb, size: 84 bytes, params: 2, frame: 17 const env0_0 = a0; useRequestApplication(a0); return (FluxModule).useStateFromStores([ApplicationStore], _fun87144, [a0]); function _fun87144() { // fn#87144, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11550:1305, offset: 0x01fb114f, size: 56 bytes, params: 1, frame: 13 const value2 = null; return value2 != env0_0 ? env0_0 === '' ? value2 : ApplicationStore.getApplication(env0_0) : value2; } } } global.__d(_fun87131, 11364, [6, 7, 31, 4234, 4041, 22, 6772, 566, 2]) /* metro module 11364, dependencies: [6, 7, 31, 4234, 4041, 22, 6772, 566, 2] */;