// Metro module 6149 (f6150). import MessageStore from "./MessageStore"; import Module589 from "../_bundle/Module589"; import Dispatcher from "../Dispatcher"; function $mk77809($env) { return (a0) => { const item = a0.item; const r2 = $env.$parent; if (!r2[1].test(item.originalUri) && !r2[2].test(item.originalUri)) { return void 0; } let width = item.width; if (width == null) { width = 0; } let height = item.height; if (height == null) { height = 0; } let originalUri = item.originalUri; if (originalUri == null) { originalUri = ""; } const r18 = $env; let id = a0.id; if (id == null) { id = ""; } return { width, height, localUri: originalUri, uploaderId: r18[0].id, uploaderItemId: id }; }; } function $mk77810($env) { return (a0) => a0.id !== $env[0]; } function $mk77811($env) { return (a0) => { const id = a0.id; const r2 = $env[0]; return id === r2.id ? { ...a0, ...r2 } : a0; }; } let c3891_9; let env3891 = {}; const c3891_1 = /^(assets-library|ph|file):\/\//; const c3891_2 = /^content:\/\//; const c3891_3 = Object.freeze([]); const c3891_4 = {}; const c3891_5 = {}; const c3891_6 = {}; const c3891_7 = {}; env3891[8] = {}; class UploadStore extends Module589.Store { static displayName = "UploadStore"; constructor() { super(...arguments); } initialize() { this.waitFor(MessageStore); } getFiles(a0) { let r4 = c3891_4[a0]; if (r4 == null) { r4 = c3891_3; } return r4; } getMessageForFile(a0) { return c3891_6[a0]; } getUploaderFileForMessageId(a0) { return c3891_7[a0]; } getUploadAttachments(a0) { if (a0 != null) { return env3891[8][a0]; } } } c3891_9 = UploadStore; const r58 = new UploadStore(Dispatcher, { CONNECTION_OPEN: function handleConnectionOpen() { env3891[8] = {}; }, LOGOUT: function handleLogout() { env3891[8] = {}; }, UPLOAD_START: function handleUploadStart({ channelId, file, uploader, message }) { if (!uploader._aborted && !uploader._errored) { let r9 = c3891_4[channelId]; if (r9 == null) { r9 = c3891_3; } c3891_5[file.id] = uploader; c3891_4[channelId] = [...r9, file]; if (message != null) { c3891_6[file.id] = message; const items = file.items; if (items != null) { c3891_7[message.id] = { ...file, items }; } let nonce = message.nonce; if (nonce == null) { nonce = message.id; } let env15510; const r29 = env15510 = { $parent: env3891 }; env15510[0] = file; const r30 = env3891[8]; const items2 = file.items; let r32 = items2 == null ? void 0 : items2.map($mk77809(r29)); if (r32 == null) { r32 = []; } r30[nonce] = r32; } } }, UPLOAD_COMPRESSION_PROGRESS: function handleUploadCompressionProgress({ channelId, file }) { let env15511; const r11 = env15511 = {}; env15511[0] = file; const r8 = c3891_4[channelId]; if (r8 != null) { c3891_4[channelId] = r8.map($mk77811(r11)); const r16 = c3891_6[file.id]; if (r16 != null && c3891_7[r16.id] != null) { c3891_7[r16.id] = { ...c3891_7[r16.id], ...file }; } } }, UPLOAD_PROGRESS: function handleUploadProgress({ channelId, file }) { let env15512; const r11 = env15512 = {}; env15512[0] = file; const r8 = c3891_4[channelId]; if (r8 != null) { c3891_4[channelId] = r8.map($mk77811(r11)); const r16 = c3891_6[file.id]; if (r16 != null && c3891_7[r16.id] != null) { c3891_7[r16.id] = { ...c3891_7[r16.id], ...file }; } } }, UPLOAD_COMPLETE: function handleUploadComplete(a0) { let env15513; const channelId = a0.channelId; const id = a0.file.id; const r7 = env15513 = {}; env15513[0] = id; const r3 = c3891_4[channelId]; let r11 = r3 != null; if (r11) { c3891_4[channelId] = r3.filter($mk77810(r7)); delete c3891_5[id]; delete c3891_6[id]; r11 = r3.length !== c3891_4[channelId].length; } return r11; }, UPLOAD_FAIL: function handleUploadFail(a0) { let env15514; const channelId = a0.channelId; const id = a0.file.id; const r7 = env15514 = {}; env15514[0] = id; const r3 = c3891_4[channelId]; let r11 = r3 != null; if (r11) { c3891_4[channelId] = r3.filter($mk77810(r7)); delete c3891_5[id]; delete c3891_6[id]; r11 = r3.length !== c3891_4[channelId].length; } return r11; }, UPLOAD_CANCEL_REQUEST: function handleUploadCancel({ file }) { const r8 = c3891_5[file.id]; let c15515_0 = r8; if (r8 == null) { return false; } setImmediate(() => { const cancel = c15515_0.cancel; return cancel == null ? void 0 : cancel.call(c15515_0); }); }, UPLOAD_ITEM_CANCEL_REQUEST: function handleUploadItemCancel({ file, itemId }) { const r9 = c3891_5[file.id]; let c15516_1 = r9; if (r9 == null) { return false; } setImmediate(() => c15516_1.cancelItem(itemId)); }, UPLOAD_FILE_UPDATE: function handleUploadFileUpdate({ channelId, file }) { const r15 = c3891_6[file.id]; if (r15 != null) { let nonce = r15.nonce; if (nonce == null) { nonce = r15.id; } let env15517; const r9 = env15517 = { $parent: env3891 }; env15517[0] = file; const r6 = env3891[8]; const items = file.items; let r16 = items == null ? void 0 : items.map($mk77809(r9)); if (r16 == null) { r16 = []; } r6[nonce] = r16; } let env15518; const r18 = env15518 = {}; env15518[0] = file; const r20 = c3891_4[channelId]; if (r20 != null) { c3891_4[channelId] = r20.map($mk77811(r18)); const r25 = c3891_6[file.id]; if (r25 != null && c3891_7[r25.id] != null) { c3891_7[r25.id] = { ...c3891_7[r25.id], ...file }; } } }, UPLOAD_RESTORE_FAILED_UPLOAD: function restoreFailedUpload(a0) { c3891_7[a0.messageId] = a0.file; } }); export default r58;