/* Metro module 11332; source: modules/chat/native/ChatUpdatesQueue.tsx; dependencies: [6, 7, 27, 2] */ function _fun86537(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#86537, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11518:6, offset: 0x01f971ec, size: 166 bytes, params: 8, frame: 19 const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_0 = importDefault(6) /* metro dependency 6 */; const env0_1 = importDefault(7) /* metro dependency 7 */; let value = require(27) /* metro dependency 27 */; const env0_2 = value.NativeEventEmitter; const NativeModules = value.NativeModules; const env0_3 = NativeModules.DCDChatBlockerManager; value = _fun86538(); (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/chat/native/ChatUpdatesQueue.tsx'); exports.default = value; } function _fun86538() { // fn#86538, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11518:191, offset: 0x01f97292, size: 265 bytes, params: 1, frame: 15 return env0_1(ChatUpdatesQueue, [{key: 'hasUpdates', value: function() { return this.queue.length > 0; }}, {key: 'isBlocking', get: function() { return this.hasUpdates() || this.blockers.size > 0; }}, {key: 'addBlocker', value: function(a0) { if (a0 != null) { this.blockers.add(a0); } }}, {key: 'removeBlocker', value: function(a0) { if (a0 != null) { this.blockers.delete(a0); if (this.blockers.size === 0) { this.flush(); } } }}, {key: 'add', value: value_86547}, {key: 'tryFlush', value: function() { if (this.blockers.size === 0) { this.flush(); } }}, {key: 'clear', value: function() { this.queue = []; this.queueStartTimestamp = null; }}, {key: 'flush', value: function() { var env0_0 = this; this.queueStartTimestamp = null; this.queue.forEach(_fun86551); this.queue = []; }}, {key: 'cleanup', value: function() { this.addBlockerSubscription.remove(); this.removeBlockerSubscription.remove(); }}]); } function ChatUpdatesQueue(a0, a1) { // fn#86539, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11518:212, offset: 0x01f9739b, size: 226 bytes, params: 3, frame: 16 var environment; const value = environment.__proto__; env1_0(this, ChatUpdatesQueue); const Set = global.Set; const value3 = Object.create(Set.prototype, {constructor: {value: Set}}); const set = new Set(); this.blockers = set instanceof Object ? set : value3; this.queue = []; this.queueStartTimestamp = null; this.setOnFlushItem = setOnFlushItem; this.getReactTag = a0; this.onFlushItem = a1; this.eventEmitter = new NativeEventEmitter(DCDChatBlockerManager); let eventEmitter = this.eventEmitter; this.addBlockerSubscription = eventEmitter.addListener('AddBlocker', _fun86541); eventEmitter = this.eventEmitter; this.removeBlockerSubscription = eventEmitter.addListener('RemoveBlocker', _fun86542); } function value_86547(a0) { // fn#86547, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11518:1127, offset: 0x01f975af, size: 164 bytes, params: 2, frame: 13 var Date; if (this.queueStartTimestamp == null) { Date = global.Date; this.queueStartTimestamp = Date.now(); } this.queue.push(a0); if (this.queue.length > 100 || this.queueStartTimestamp != null && global.Date.now() - this.queueStartTimestamp > 30000) { this.blockers.clear(); this.flush(); } } function value_86550() { // fn#86550, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11518:1544, offset: 0x01f9768e, size: 54 bytes, params: 1, frame: 12 this.queueStartTimestamp = null; this.queue.forEach(_fun86551); this.queue = []; } function setOnFlushItem(a0) { // fn#86540, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11518:354, owner: ChatUpdatesQueue.setOnFlushItem, offset: 0x01f9747d, size: 20 bytes, params: 2, frame: 2 env0_0.onFlushItem = a0; } function _fun86541({blockerId, reactTag}) { // fn#86541, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11518:515, offset: 0x01f97491, size: 69 bytes, params: 2, frame: 14 if (reactTag != null && reactTag === env0_0.getReactTag()) { env0_0.addBlocker(blockerId); } } function _fun86542({blockerId, reactTag}) { // fn#86542, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11518:685, offset: 0x01f974d6, size: 69 bytes, params: 2, frame: 14 if (reactTag != null && reactTag === env0_0.getReactTag()) { env0_0.removeBlocker(blockerId); } } function _fun86551(a0) { // fn#86551, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11518:1605, offset: 0x01f976c4, size: 45 bytes, params: 2, frame: 13 var onFlushItem; if (a0 != null) { onFlushItem = env0_0.onFlushItem; if (onFlushItem != null) { onFlushItem.call(env0_0, a0); } } }