decord/source/stores/UploadStore.tsx

290 lines
8.1 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 7441
// Function ID: 7442
2026-07-29 08:29:29 +00:00
// Name: initialize
2026-08-25 06:04:03 +00:00
// Dependencies: [4623, 589, 709, 2]
2026-07-23 10:11:24 +00:00
2026-08-25 06:04:03 +00:00
// Module 7441 (initialize)
2026-08-24 06:08:38 +00:00
import initializeDefault from "initialize" /* 589 */;
import dispatcherDefault from "dispatcher" /* 709 */;
2026-08-25 06:04:03 +00:00
import closure_0 from "reinjectEphemerals" /* 4623 */;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
const re1 = /^(assets-library|ph|file):\/\//;
const re2 = /^content:\/\//;
let closure_3 = Object.freeze([]);
let closure_4 = {};
let closure_5 = {};
let closure_6 = {};
let closure_7 = {};
let closure_8 = {};
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class UploadStore extends Store {
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const prototype = UploadStore.prototype;
prototype["initialize"] = function initialize() {
2026-08-24 06:08:38 +00:00
this.waitFor(closure_0);
2026-07-29 08:29:29 +00:00
};
prototype["getFiles"] = function getFiles(arg0) {
let tmp = dependencyMap[arg0];
if (tmp == null) {
tmp = closure_3;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp;
};
prototype["getMessageForFile"] = function getMessageForFile(id) {
return dependencyMap3[id];
};
prototype["getUploaderFileForMessageId"] = function getUploaderFileForMessageId(id) {
return dependencyMap4[id];
};
prototype["getUploadAttachments"] = function getUploadAttachments(nonce) {
if (null != nonce) {
return table[nonce];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
};
UploadStore.displayName = "UploadStore";
2026-08-24 06:08:38 +00:00
const uploadStore = new UploadStore(dispatcherDefault, {
2026-07-20 16:05:17 +00:00
CONNECTION_OPEN: function handleConnectionOpen() {
2026-08-24 06:08:38 +00:00
closure_8 = {};
2026-07-20 16:05:17 +00:00
},
LOGOUT: function handleLogout() {
2026-08-24 06:08:38 +00:00
closure_8 = {};
2026-07-20 16:05:17 +00:00
},
UPLOAD_START: function handleUploadStart(arg0) {
({ channelId, file, uploader, message } = arg0);
if (!uploader._aborted) {
if (!uploader._errored) {
2026-07-23 10:11:24 +00:00
let tmp2 = dependencyMap[channelId];
2026-07-29 08:29:29 +00:00
if (tmp2 == null) {
tmp2 = closure_3;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
closure_5[file.id] = uploader;
2026-07-20 16:05:17 +00:00
let items = [];
2026-07-29 08:29:29 +00:00
items[HermesBuiltin.arraySpread(tmp2, 0)] = file;
2026-07-23 10:11:24 +00:00
dependencyMap[channelId] = items;
2026-07-20 16:05:17 +00:00
if (null != message) {
2026-07-29 08:29:29 +00:00
closure_6[file.id] = message;
2026-07-20 16:05:17 +00:00
items = file.items;
if (null != items) {
const obj = {};
const merged = Object.assign(file);
2026-07-29 08:29:29 +00:00
obj.items = items;
closure_7[message.id] = obj;
2026-07-20 16:05:17 +00:00
}
let id = message.nonce;
2026-07-29 08:29:29 +00:00
if (id == null) {
2026-07-20 16:05:17 +00:00
id = message.id;
}
2026-07-29 08:29:29 +00:00
const items1 = file.items;
let mapped;
if (items1 != null) {
mapped = items1.map((item) => {
item = item.item;
let num = item.width;
if (num == null) {
num = 0;
}
const obj = { width: num, height: null, localUri: null, uploaderId: null, uploaderItemId: null };
let num2 = item.height;
if (num2 == null) {
num2 = 0;
}
obj[1] = num2;
let str = item.originalUri;
if (str == null) {
str = "";
}
obj[2] = str;
obj[3] = file.id;
let str2 = item.id;
if (str2 == null) {
str2 = "";
}
obj[4] = str2;
return obj;
});
}
if (mapped == null) {
mapped = [];
}
closure_8[id] = mapped;
const tmp11 = closure_8;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const tmp = dependencyMap;
2026-07-20 16:05:17 +00:00
}
}
},
2026-07-29 08:29:29 +00:00
UPLOAD_COMPRESSION_PROGRESS: function handleUploadCompressionProgress(arg0) {
({ channelId, file } = arg0);
if (null != dependencyMap[channelId]) {
tmp[channelId] = arr.map((id) => {
let tmp2 = id;
if (id.id === file.id) {
const obj = {};
const merged = Object.assign(id);
const merged1 = Object.assign(tmp);
tmp2 = obj;
}
return tmp2;
});
let tmp4 = null != tmp3;
if (tmp4) {
tmp4 = null != dependencyMap4[tmp3.id];
}
if (tmp4) {
const obj = {};
const merged = Object.assign(dependencyMap4[tmp3.id]);
const merged1 = Object.assign(file);
dependencyMap4[tmp3.id] = obj;
}
}
2026-07-20 16:05:17 +00:00
},
2026-07-29 08:29:29 +00:00
UPLOAD_PROGRESS: function handleUploadProgress(arg0) {
({ channelId, file } = arg0);
if (null != dependencyMap[channelId]) {
tmp[channelId] = arr.map((id) => {
let tmp2 = id;
if (id.id === file.id) {
const obj = {};
const merged = Object.assign(id);
const merged1 = Object.assign(tmp);
tmp2 = obj;
}
return tmp2;
});
let tmp4 = null != tmp3;
if (tmp4) {
tmp4 = null != dependencyMap4[tmp3.id];
}
if (tmp4) {
const obj = {};
const merged = Object.assign(dependencyMap4[tmp3.id]);
const merged1 = Object.assign(file);
dependencyMap4[tmp3.id] = obj;
}
}
2026-07-20 16:05:17 +00:00
},
UPLOAD_COMPLETE: function handleUploadComplete(channelId) {
2026-07-29 08:29:29 +00:00
channelId = channelId.channelId;
const id = channelId.file.id;
let tmp5 = null != arr;
if (tmp5) {
tmp4[channelId] = arr.filter((id) => id.id !== id);
delete tmp3[tmp2];
delete tmp[tmp2];
tmp5 = arr.length !== tmp4[channelId].length;
}
return tmp5;
2026-07-20 16:05:17 +00:00
},
UPLOAD_FAIL: function handleUploadFail(channelId) {
2026-07-29 08:29:29 +00:00
channelId = channelId.channelId;
const id = channelId.file.id;
let tmp5 = null != arr;
if (tmp5) {
tmp4[channelId] = arr.filter((id) => id.id !== id);
delete tmp3[tmp2];
delete tmp[tmp2];
tmp5 = arr.length !== tmp4[channelId].length;
}
return tmp5;
2026-07-20 16:05:17 +00:00
},
UPLOAD_CANCEL_REQUEST: function handleUploadCancel(arg0) {
2026-08-24 06:08:38 +00:00
closure_0 = undefined;
closure_0 = tmp;
2026-07-23 10:11:24 +00:00
if (null == dependencyMap2[arg0.file.id]) {
2026-07-20 16:05:17 +00:00
return false;
} else {
const _setImmediate = setImmediate;
setImmediate(() => {
2026-08-24 06:08:38 +00:00
cancel = cancel.cancel;
2026-07-20 16:05:17 +00:00
let cancelResult;
2026-07-29 08:29:29 +00:00
if (cancel != null) {
cancelResult = cancel();
2026-07-20 16:05:17 +00:00
}
return cancelResult;
});
}
},
UPLOAD_ITEM_CANCEL_REQUEST: function handleUploadItemCancel(itemId) {
itemId = itemId.itemId;
2026-08-24 06:08:38 +00:00
closure_1 = undefined;
closure_1 = tmp;
2026-07-23 10:11:24 +00:00
if (null == dependencyMap2[itemId.file.id]) {
2026-07-20 16:05:17 +00:00
return false;
} else {
const _setImmediate = setImmediate;
2026-08-24 06:08:38 +00:00
setImmediate(() => closure_1.cancelItem(itemId));
2026-07-20 16:05:17 +00:00
}
},
2026-07-29 08:29:29 +00:00
UPLOAD_FILE_UPDATE: function handleUploadFileUpdate(arg0) {
({ channelId, file } = arg0);
2026-07-23 10:11:24 +00:00
if (null != dependencyMap3[file.id]) {
2026-07-29 08:29:29 +00:00
let id = tmp2.nonce;
if (id == null) {
id = tmp2.id;
}
const items = file.items;
let mapped;
if (items != null) {
mapped = items.map((item) => {
item = item.item;
let num = item.width;
if (num == null) {
num = 0;
}
const obj = { width: num, height: null, localUri: null, uploaderId: null, uploaderItemId: null };
let num2 = item.height;
if (num2 == null) {
num2 = 0;
}
obj[1] = num2;
let str = item.originalUri;
if (str == null) {
str = "";
}
obj[2] = str;
obj[3] = file.id;
let str2 = item.id;
if (str2 == null) {
str2 = "";
}
obj[4] = str2;
return obj;
});
}
if (mapped == null) {
mapped = [];
}
closure_8[id] = mapped;
const tmp3 = closure_8;
}
if (null != dependencyMap[channelId]) {
tmp4[channelId] = arr3.map((id) => {
let tmp2 = id;
if (id.id === file.id) {
const obj = {};
const merged = Object.assign(id);
const merged1 = Object.assign(tmp);
tmp2 = obj;
}
return tmp2;
});
let tmp6 = null != tmp5;
if (tmp6) {
tmp6 = null != dependencyMap4[tmp5.id];
}
if (tmp6) {
let obj = {};
let merged = Object.assign(dependencyMap4[tmp5.id]);
let merged1 = Object.assign(file);
dependencyMap4[tmp5.id] = obj;
2026-07-20 16:05:17 +00:00
}
}
},
UPLOAD_RESTORE_FAILED_UPLOAD: function restoreFailedUpload(messageId) {
2026-07-29 08:29:29 +00:00
closure_7[messageId.messageId] = messageId.file;
2026-07-20 16:05:17 +00:00
}
});
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("stores/UploadStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default uploadStore;