/* Metro module 5227; source: modules/app_database/system/AppDatabaseManager.tsx; dependencies: [57, 6, 7, 1226, 3, 1926, 1911, 694, 5228, 2] */ import Logger from '../../debug/Logger.tsx'; /* Metro dependency 3 */ 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 Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */ import Dispatcher from '../../../Dispatcher.tsx'; /* Metro dependency 694 */ import AuthenticationStore from '../../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */ import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as DispatcherModule from '../../../Dispatcher.tsx'; /* Metro dependency 694 */ import * as AppDatabaseManagerEntryModule from './AppDatabaseManager.Entry.tsx'; /* Metro dependency 5228 */ function _fun46257(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#46257, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5405:6, offset: 0x011a3d53, size: 266 bytes, params: 8, frame: 20 const env0_0 = require; const _arrayLikeToArray_46260 = 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 Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = Logger; value = new value('AppDatabaseManager'); const Set = global.Set; let set = new Set(['MESSAGE_CREATE']); set = _fun46261(); (FileImportTrackerModule).fileFinishedImporting('modules/app_database/system/AppDatabaseManager.tsx'); exports.AppDatabaseManager = set; function _createForOfIteratorHelperLoose_46258(a0, a1) { // fn#46258, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5405:140, offset: 0x011a3e5d, 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 _fun46259; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_46260(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_46260(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_46260(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun46259; } 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 _fun46259() { // fn#46259, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5405:711, 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 _fun46261() { // fn#46261, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5405:1123, offset: 0x011a3fcf, size: 208 bytes, params: 1, frame: 17 return CreateClass(AppDatabaseManager, [{key: 'handleAction', value: value_46264}, {key: 'resetModules', value: value_46265}, {key: 'executeModules', value: value_46266}, {key: 'validateInDev', value: function() { }}], [{key: 'handleException', value: value_46271}, {key: 'computeEntries', value: value_46272}, {key: 'register', value: value_46274}]); function AppDatabaseManager(a0, a1, a2) { // fn#46262, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5405:1134, offset: 0x011a409f, size: 288 bytes, params: 4, frame: 25 let binding = env1_4; binding(this, AppDatabaseManager); const value3 = env1_3(AppDatabaseManager.computeEntries(a0, a2), 2); const property = value3[0]; const property2 = value3[1]; this.name = a0; this.entries = property2; this.actions = property; this.lastDatabase = null; let register = AppDatabaseManager.register; const value4 = a0 + '_CLEAR_CACHES'; const closure = _fun46263; Reflect.apply(register, AppDatabaseManager, [value4, ['CLEAR_CACHES'], [], closure]); register = AppDatabaseManager.register; const value5 = this.actions.keys(); items2 = []; arraySpread(items2, value5, 0, closure); Reflect.apply(register, AppDatabaseManager, [a0, items2, a1, this.handleAction.bind(this)]); binding = env1_7; binding.verbose('' + a0 + ' created with ' + a2.length + ' modules, ' + this.actions.size + ' distinct actions.'); function _fun46263() { // fn#46263, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5405:1396, offset: 0x011a41bf, size: 71 bytes, params: 1, frame: 13 var r2; var value3; var value4; let value = environment.__proto__.__proto__; value = _createForOfIteratorHelperLoose_46258(env0_0.entries); const value2 = value(); let done = value2.done; if (!done) { for (r2 = value2; true; r2 = value4) { value3 = r2.value; value3.reset(); value4 = value(); done = value4.done; if (done) { break; } } } } } function value_46264(a0) { // fn#46264, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5405:1728, offset: 0x011a4206, size: 106 bytes, params: 2, frame: 15 this.validateInDev(a0.type); let value = environment.__proto__; const id = AuthenticationStore.getId(); value = importDefault(1926) /* metro dependency 1926: DatabaseManager */; value = value.database(id); this.resetModules(a0, value); this.executeModules(a0, value); return false; } function value_46265(a0, a1) { // fn#46265, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5405:1891, offset: 0x011a4270, size: 164 bytes, params: 3, frame: 25 var r3; var value; var binding; var verbose; var type; var HermesInternal; var concat; var _createForOfIteratorHelperLoose_46258Binding; var entries; var value2; var done; var value3; var reset; var value4; let lastDatabase = this.lastDatabase; reducibleJoin4: while (true) { if (a1 === lastDatabase) { break reducibleJoin4; } value = environment.__proto__; binding = env1_7; verbose = binding.verbose; lastDatabase = this.lastDatabase; type = a0.type; HermesInternal = global.HermesInternal; concat = HermesInternal.concat; Reflect.apply(verbose, binding, ['database has changed (was: ' + lastDatabase + ', now: ' + a1 + ', action: ' + type + '). resetting modules.']); _createForOfIteratorHelperLoose_46258Binding = _createForOfIteratorHelperLoose_46258; entries = this.entries; value = _createForOfIteratorHelperLoose_46258Binding(entries); value2 = value(); done = value2.done; if (!done) { r3 = value2; reducibleLoop2: while (true) { value3 = r3.value; reset = value3.reset; Reflect.apply(reset, value3, []); value4 = value(); done = value4.done; if (done) { break reducibleLoop2; } r3 = value4; continue reducibleLoop2; } } this.lastDatabase = a1; break reducibleJoin4; } } function value_46266(a0, a1) { // fn#46266, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5405:2184, offset: 0x011a4314, size: 317 bytes, params: 3, frame: 28 var environment; var binding; var transaction; var has; const env0_0 = a0; const env0_1 = a1; let type = a0.type; let value = this.actions.get(type); const value2 = null; const value3 = undefined; const r13 = value2 == a1 ? value3 : a1.state(); if (value2 != value) { if (value.length !== 0) { if (value2 == a1) { value = environment.__proto__; env1_7.verbose('no usable database; skipping action (type: ' + type + ', database: ' + a1 + ', state: ' + r13 + ')'); } else { value = environment.__proto__; if (r13 === (require(1911) /* metro dependency 1911: js */).DatabaseState.Open) { transaction = a1.transaction; binding = env1_8; has = binding.has; type = a0.type; value = Reflect.apply(transaction, a1, [_fun46267, Reflect.apply(has, binding, [type]) ? value2 : 'Dispatch ' + a0.type]); value = value.catch(_fun46269); type = a0.type; if (type === 'WRITE_CACHES') { a0.promisesToWaitOn.push(value); } } else { value = environment.__proto__; env1_7.verbose('no usable database; skipping action (type: ' + type + ', database: ' + a1 + ', state: ' + r13 + ')'); } } } } return value3; function _fun46267(a0) { // fn#46267, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5405:2351, offset: 0x011a4451, size: 33 bytes, params: 2, frame: 11 const env0_0 = a0; return env0_2.forEach(_fun46268); function _fun46268(a0) { // fn#46268, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5405:2365, offset: 0x011a4472, size: 31 bytes, params: 2, frame: 13 return a0.execute(env1_0, env0_0); } } function _fun46269(a0) { // fn#46269, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5405:2434, offset: 0x011a4491, size: 36 bytes, params: 2, frame: 15 return AppDatabaseManager.handleException(require, env0_0, a0); } } function value_46271(a0, {type}, a2) { // fn#46271, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5405:2703, offset: 0x011a44b5, size: 133 bytes, params: 4, frame: 19 const value = environment.__proto__; const binding = env1_7; binding.info('disabling database ยท error encountered during dispatch', a2, a2.stack); (Dispatcher).dispatch({type: 'RESET_SOCKET', args: {error: a2, action: 'AppDatabaseManager(' + type + ')'}}); } function value_46272(a0, a1) { // fn#46272, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5405:2919, offset: 0x011a453a, size: 256 bytes, params: 3, frame: 22 var r4; var r8; var value6; var actions; var value7; var value8; var value9; var has; var value10; var value11; var value12; const env0_0 = a0; const Map = global.Map; const map = new Map(); const value2 = a1.map(_fun46273); map.set('LOGOUT', []); map.set('LOGIN_RESET', []); const value4 = _createForOfIteratorHelperLoose_46258(value2); const value5 = value4(); let done = value5.done; if (!done) { r4 = value5; while (true) { value6 = r4.value; _createForOfIteratorHelperLoose_46258Binding = _createForOfIteratorHelperLoose_46258; actions = value6.actions; value7 = _createForOfIteratorHelperLoose_46258Binding(actions); value8 = value7(); done = value8.done; if (!done) { r8 = value8; while (true) { value9 = r8.value; has = map.has; if (!Reflect.apply(has, map, [value9])) { map.set(value9, []); } value10 = map.get(value9); value10.push(value6); value11 = value7(); done = value11.done; if (done) { break; } r8 = value11; continue; } } value12 = value4(); done = value12.done; if (done) { break; } r4 = value12; continue; } } return [map, value2]; function _fun46273(a0) { // fn#46273, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5405:2956, offset: 0x011a463a, size: 63 bytes, params: 2, frame: 13 let value = environment.__proto__.__proto__; const Entry = (AppDatabaseManagerEntryModule).Entry; const binding = env0_0; value = Object.create(Entry.prototype, {constructor: {value: Entry}}); const entry = new Entry(binding, a0); return entry instanceof Object ? entry : value; } } function value_46274(a0, a1, a2, a3) { // fn#46274, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5405:3261, offset: 0x011a4679, size: 143 bytes, params: 5, frame: 24 var environment; const env0_0 = a3; let value = environment.__proto__; const defaultImport = Dispatcher; const register = defaultImport.register; const Object = global.Object; const value2 = Object.fromEntries(a1.map(function(a0) { return [a0, importAll]; })); const DispatchBand = (DispatcherModule).DispatchBand; const Database = DispatchBand.Database; value = Reflect.apply(register, defaultImport, [a0, value2, function() { }, Database]); defaultImport.addDependencies(value, a2); return value; } } } global.__d(_fun46257, 5227, [57, 6, 7, 1226, 3, 1926, 1911, 694, 5228, 2]) /* metro module 5227, dependencies: [57, 6, 7, 1226, 3, 1926, 1911, 694, 5228, 2] */;