@imam-inter/wasm-client-sdk 3.8.3-10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +166 -0
  3. package/assets/openIM.wasm +0 -0
  4. package/assets/sql-wasm.wasm +0 -0
  5. package/assets/version +1 -0
  6. package/assets/wasm_exec.js +561 -0
  7. package/lib/api/database/alter.d.ts +2 -0
  8. package/lib/api/database/black.d.ts +7 -0
  9. package/lib/api/database/conversation.d.ts +32 -0
  10. package/lib/api/database/friend.d.ts +12 -0
  11. package/lib/api/database/friendRequest.d.ts +7 -0
  12. package/lib/api/database/groupMember.d.ts +22 -0
  13. package/lib/api/database/groupRequest.d.ts +8 -0
  14. package/lib/api/database/groups.d.ts +14 -0
  15. package/lib/api/database/index.d.ts +20 -0
  16. package/lib/api/database/init.d.ts +6 -0
  17. package/lib/api/database/instance.d.ts +3 -0
  18. package/lib/api/database/localAppSdkVersion.d.ts +2 -0
  19. package/lib/api/database/message.d.ts +32 -0
  20. package/lib/api/database/notification.d.ts +3 -0
  21. package/lib/api/database/sendingMessages.d.ts +3 -0
  22. package/lib/api/database/stranger.d.ts +4 -0
  23. package/lib/api/database/superGroup.d.ts +6 -0
  24. package/lib/api/database/tableMaster.d.ts +1 -0
  25. package/lib/api/database/tempCacheChatLogs.d.ts +2 -0
  26. package/lib/api/database/unreadMessage.d.ts +2 -0
  27. package/lib/api/database/upload.d.ts +4 -0
  28. package/lib/api/database/users.d.ts +3 -0
  29. package/lib/api/database/versionSync.d.ts +3 -0
  30. package/lib/api/index.d.ts +2 -0
  31. package/lib/api/upload.d.ts +5 -0
  32. package/lib/api/worker.d.ts +1 -0
  33. package/lib/constant/index.d.ts +71 -0
  34. package/lib/index.d.ts +6 -0
  35. package/lib/index.es.js +2226 -0
  36. package/lib/index.js +2230 -0
  37. package/lib/index.umd.js +2236 -0
  38. package/lib/sdk/index.d.ts +232 -0
  39. package/lib/sdk/initialize.d.ts +5 -0
  40. package/lib/sqls/index.d.ts +20 -0
  41. package/lib/sqls/localAdminGroupRequests.d.ts +9 -0
  42. package/lib/sqls/localAppSdkVersion.d.ts +8 -0
  43. package/lib/sqls/localBlack.d.ts +12 -0
  44. package/lib/sqls/localChatLogsConversationID.d.ts +37 -0
  45. package/lib/sqls/localConversationUnreadMessages.d.ts +7 -0
  46. package/lib/sqls/localConversations.d.ts +35 -0
  47. package/lib/sqls/localFriend.d.ts +16 -0
  48. package/lib/sqls/localFriendRequest.d.ts +12 -0
  49. package/lib/sqls/localGroupMembers.d.ts +27 -0
  50. package/lib/sqls/localGroupRequests.d.ts +9 -0
  51. package/lib/sqls/localGroups.d.ts +16 -0
  52. package/lib/sqls/localNotification.d.ts +8 -0
  53. package/lib/sqls/localSendingMessages.d.ts +8 -0
  54. package/lib/sqls/localStranger.d.ts +8 -0
  55. package/lib/sqls/localSuperGroups.d.ts +10 -0
  56. package/lib/sqls/localTableMaster.d.ts +5 -0
  57. package/lib/sqls/localUpload.d.ts +10 -0
  58. package/lib/sqls/localUsers.d.ts +8 -0
  59. package/lib/sqls/localVersionSync.d.ts +9 -0
  60. package/lib/sqls/tempCacheLocalChatLogs.d.ts +6 -0
  61. package/lib/types/entity.d.ts +456 -0
  62. package/lib/types/enum.d.ts +138 -0
  63. package/lib/types/eventData.d.ts +51 -0
  64. package/lib/types/params.d.ts +407 -0
  65. package/lib/utils/emitter.d.ts +12 -0
  66. package/lib/utils/escape.d.ts +23 -0
  67. package/lib/utils/index.d.ts +7 -0
  68. package/lib/utils/is.d.ts +6 -0
  69. package/lib/utils/key.d.ts +3 -0
  70. package/lib/utils/logFormat.d.ts +1 -0
  71. package/lib/utils/response.d.ts +1 -0
  72. package/lib/utils/timer.d.ts +1 -0
  73. package/lib/utils/value.d.ts +6 -0
  74. package/lib/worker-legacy.js +1 -0
  75. package/lib/worker.js +1 -0
  76. package/package.json +94 -0
package/lib/index.js ADDED
@@ -0,0 +1,2230 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ // The reason for this strange abstraction is because we can't rely on
6
+ // nested worker support (Safari doesn't support it). We need to proxy
7
+ // creating a child worker through the main thread, and this requires
8
+ // a bit of glue code. We don't want to duplicate this code in each
9
+ // backend that needs it, so this module abstracts it out. It has to
10
+ // have a strange shape because we don't want to eagerly bundle the
11
+ // backend code, so users of this code need to pass an `() =>
12
+ // import('./worker.js')` expression to get the worker module to run.
13
+
14
+ function isWorker() {
15
+ return (
16
+ typeof WorkerGlobalScope !== 'undefined' &&
17
+ self instanceof WorkerGlobalScope
18
+ );
19
+ }
20
+
21
+ function makeStartWorkerFromMain(getModule) {
22
+ return (argBuffer, resultBuffer, parentWorker) => {
23
+ if (isWorker()) {
24
+ throw new Error(
25
+ '`startWorkerFromMain` should only be called from the main thread'
26
+ );
27
+ }
28
+
29
+ if (typeof Worker === 'undefined') {
30
+ // We're on the main thread? Weird: it doesn't have workers
31
+ throw new Error(
32
+ 'Web workers not available. sqlite3 requires web workers to work.'
33
+ );
34
+ }
35
+
36
+ getModule().then(({ default: BackendWorker }) => {
37
+ let worker = new BackendWorker();
38
+
39
+ worker.postMessage({ type: 'init', buffers: [argBuffer, resultBuffer] });
40
+
41
+ worker.addEventListener('message', msg => {
42
+ // Forward any messages to the worker that's supposed
43
+ // to be the parent
44
+ parentWorker.postMessage(msg.data);
45
+ });
46
+ });
47
+ };
48
+ }
49
+
50
+ function makeInitBackend(spawnEventName, getModule) {
51
+ const startWorkerFromMain = makeStartWorkerFromMain(getModule);
52
+
53
+ return worker => {
54
+ worker.addEventListener('message', e => {
55
+ switch (e.data.type) {
56
+ case spawnEventName:
57
+ startWorkerFromMain(e.data.argBuffer, e.data.resultBuffer, worker);
58
+ break;
59
+ }
60
+ });
61
+ };
62
+ }
63
+
64
+ // Use the generic main thread module to create our indexeddb worker
65
+ // proxy
66
+ const initBackend = makeInitBackend('__absurd:spawn-idb-worker', () =>
67
+ Promise.resolve().then(function () { return indexeddbMainThreadWorkerB24e7a21; })
68
+ );
69
+
70
+ var __defProp = Object.defineProperty;
71
+ var __defProps = Object.defineProperties;
72
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
73
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
74
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
75
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
76
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
77
+ var __spreadValues = (a, b) => {
78
+ for (var prop in b || (b = {}))
79
+ if (__hasOwnProp.call(b, prop))
80
+ __defNormalProp(a, prop, b[prop]);
81
+ if (__getOwnPropSymbols)
82
+ for (var prop of __getOwnPropSymbols(b)) {
83
+ if (__propIsEnum.call(b, prop))
84
+ __defNormalProp(a, prop, b[prop]);
85
+ }
86
+ return a;
87
+ };
88
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
89
+ var __publicField = (obj, key, value) => {
90
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
91
+ return value;
92
+ };
93
+ const RPCCodes = {
94
+ CONNECT_TIMEOUT: {
95
+ code: -32300,
96
+ message: "Connect timeout"
97
+ },
98
+ APPLICATION_ERROR: {
99
+ code: -32500,
100
+ message: "Application error"
101
+ },
102
+ METHOD_NOT_FOUND: {
103
+ code: -32601,
104
+ message: `Method not found`
105
+ }
106
+ };
107
+ class RPCMessageEvent {
108
+ constructor(options) {
109
+ __publicField(this, "_currentEndpoint");
110
+ __publicField(this, "_targetEndpoint");
111
+ __publicField(this, "_events");
112
+ __publicField(this, "_originOnmessage");
113
+ __publicField(this, "_receiveMessage");
114
+ __publicField(this, "onerror", null);
115
+ __publicField(this, "config");
116
+ __publicField(this, "sendAdapter");
117
+ __publicField(this, "receiveAdapter");
118
+ this._events = {};
119
+ this._currentEndpoint = options.currentEndpoint;
120
+ this._targetEndpoint = options.targetEndpoint;
121
+ this._originOnmessage = null;
122
+ this.config = options.config;
123
+ this.receiveAdapter = options.receiveAdapter;
124
+ this.sendAdapter = options.sendAdapter;
125
+ const receiveMessage = (event) => {
126
+ const receiveData = this.receiveAdapter ? this.receiveAdapter(event) : event.data;
127
+ if (receiveData && typeof receiveData.event === "string") {
128
+ const eventHandlers = this._events[receiveData.event] || [];
129
+ if (eventHandlers.length) {
130
+ eventHandlers.forEach((handler) => {
131
+ handler(...receiveData.args || []);
132
+ });
133
+ return;
134
+ }
135
+ if (this.onerror) {
136
+ this.onerror(__spreadProps(__spreadValues({}, RPCCodes.METHOD_NOT_FOUND), {
137
+ data: receiveData
138
+ }));
139
+ }
140
+ }
141
+ };
142
+ if (this._currentEndpoint.addEventListener) {
143
+ if ("start" in this._currentEndpoint && this._currentEndpoint.start) {
144
+ this._currentEndpoint.start();
145
+ }
146
+ this._currentEndpoint.addEventListener("message", receiveMessage, false);
147
+ this._receiveMessage = receiveMessage;
148
+ return;
149
+ }
150
+ this._originOnmessage = this._currentEndpoint.onmessage;
151
+ this._currentEndpoint.onmessage = (event) => {
152
+ if (this._originOnmessage) {
153
+ this._originOnmessage(event);
154
+ }
155
+ receiveMessage(event);
156
+ };
157
+ this._receiveMessage = this._currentEndpoint.onmessage;
158
+ }
159
+ emit(event, ...args) {
160
+ const data = {
161
+ event,
162
+ args
163
+ };
164
+ const result = this.sendAdapter ? this.sendAdapter(data, this._targetEndpoint) : { data };
165
+ const sendData = result.data || data;
166
+ const postMessageConfig = this.config ? typeof this.config === "function" ? this.config(sendData, this._targetEndpoint) || {} : this.config || {} : {};
167
+ if (Array.isArray(result.transfer) && result.transfer.length) {
168
+ postMessageConfig.transfer = result.transfer;
169
+ }
170
+ this._targetEndpoint.postMessage(sendData, postMessageConfig);
171
+ }
172
+ on(event, fn) {
173
+ if (!this._events[event]) {
174
+ this._events[event] = [];
175
+ }
176
+ this._events[event].push(fn);
177
+ }
178
+ off(event, fn) {
179
+ if (!this._events[event])
180
+ return;
181
+ if (!fn) {
182
+ this._events[event] = [];
183
+ return;
184
+ }
185
+ const handlers = this._events[event] || [];
186
+ this._events[event] = handlers.filter((handler) => handler !== fn);
187
+ }
188
+ destroy() {
189
+ if (this._currentEndpoint.removeEventListener) {
190
+ this._currentEndpoint.removeEventListener("message", this._receiveMessage, false);
191
+ return;
192
+ }
193
+ try {
194
+ this._currentEndpoint.onmessage = this._originOnmessage;
195
+ } catch (error) {
196
+ console.warn(error);
197
+ }
198
+ }
199
+ }
200
+ const _RPC = class {
201
+ constructor(options) {
202
+ __publicField(this, "_event");
203
+ __publicField(this, "_methods", {});
204
+ __publicField(this, "_timeout", 0);
205
+ __publicField(this, "_$connect", null);
206
+ this._event = options.event;
207
+ this._timeout = options.timeout || 0;
208
+ if (options.methods) {
209
+ Object.entries(options.methods).forEach(([method, handler]) => {
210
+ this.registerMethod(method, handler);
211
+ });
212
+ }
213
+ this._event.onerror = (error) => {
214
+ const { code, message, data } = error;
215
+ if (data.event && Array.isArray(data.args) && data.args.length) {
216
+ const synEventData = data.args[0];
217
+ const ackEventName = this._getAckEventName(synEventData.method);
218
+ const ackEventData = {
219
+ jsonrpc: "2.0",
220
+ id: synEventData == null ? void 0 : synEventData.id,
221
+ error: {
222
+ code,
223
+ message,
224
+ data: synEventData
225
+ }
226
+ };
227
+ this._event.emit(ackEventName, ackEventData);
228
+ } else {
229
+ console.error(error);
230
+ }
231
+ };
232
+ this.connect();
233
+ }
234
+ static uuid() {
235
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
236
+ const r = Math.random() * 16 | 0;
237
+ const v = c == "x" ? r : r & 3 | 8;
238
+ return v.toString(16);
239
+ });
240
+ }
241
+ _getSynEventName(method) {
242
+ return `${_RPC.EVENT.SYN_SIGN}${method}`;
243
+ }
244
+ _getAckEventName(method) {
245
+ return `${_RPC.EVENT.ACK_SIGN}${method}`;
246
+ }
247
+ connect(timeout) {
248
+ if (this._$connect) {
249
+ return this._$connect;
250
+ }
251
+ this._$connect = new Promise((resolve, reject) => {
252
+ const connectTimeout = timeout || this._timeout;
253
+ let connectTimer;
254
+ if (connectTimeout) {
255
+ connectTimer = setTimeout(() => {
256
+ const error = __spreadProps(__spreadValues({}, RPCCodes.TIMEOUT), {
257
+ data: { timeout: connectTimeout }
258
+ });
259
+ reject(error);
260
+ }, connectTimeout);
261
+ }
262
+ const connectEventName = _RPC.EVENT.CONNECT;
263
+ const connectAckEventName = this._getAckEventName(connectEventName);
264
+ const connectSynEventName = this._getSynEventName(connectEventName);
265
+ const resolveConnectEvent = () => {
266
+ clearTimeout(connectTimer);
267
+ resolve();
268
+ };
269
+ this._event.on(connectAckEventName, resolveConnectEvent);
270
+ const connectSynEventHandler = () => {
271
+ this._event.emit(connectAckEventName);
272
+ resolveConnectEvent();
273
+ };
274
+ this._event.on(connectSynEventName, connectSynEventHandler);
275
+ this._event.emit(connectSynEventName);
276
+ });
277
+ return this._$connect;
278
+ }
279
+ registerMethod(method, handler) {
280
+ if (this._methods[method]) {
281
+ throw new Error(`${method} already registered`);
282
+ }
283
+ this._methods[method] = handler;
284
+ const synEventName = this._getSynEventName(method);
285
+ const synEventHandler = (synEventData) => {
286
+ const ackEventName = this._getAckEventName(method);
287
+ if (!synEventData.id) {
288
+ handler(...synEventData.params);
289
+ return;
290
+ }
291
+ Promise.resolve(handler(...synEventData.params)).then((result) => {
292
+ const ackEventData = {
293
+ jsonrpc: "2.0",
294
+ result,
295
+ id: synEventData.id
296
+ };
297
+ this._event.emit(ackEventName, ackEventData);
298
+ }).catch((error) => {
299
+ const ackEventData = {
300
+ jsonrpc: "2.0",
301
+ id: synEventData.id,
302
+ error: {
303
+ code: (error == null ? void 0 : error.code) || RPCCodes.APPLICATION_ERROR.code,
304
+ message: (error == null ? void 0 : error.message) || RPCCodes.APPLICATION_ERROR.message,
305
+ data: null
306
+ }
307
+ };
308
+ this._event.emit(ackEventName, ackEventData);
309
+ });
310
+ };
311
+ this._event.on(synEventName, synEventHandler);
312
+ }
313
+ removeMethod(method) {
314
+ if (!this._methods[method]) {
315
+ delete this._methods[method];
316
+ }
317
+ const synEventName = this._getSynEventName(method);
318
+ this._event.off(synEventName);
319
+ }
320
+ invoke(method, ...args) {
321
+ return new Promise((resolve, reject) => {
322
+ const lastArg = args[args.length - 1];
323
+ const hasInvokeOptions = lastArg && typeof lastArg === "object" && (Reflect.has(lastArg, "isNotify") || Reflect.has(lastArg, "timeout"));
324
+ const options = hasInvokeOptions ? lastArg : { isNotify: false, timeout: 0 };
325
+ const params = hasInvokeOptions ? args.slice(0, -1) : args;
326
+ const synEventName = this._getSynEventName(method);
327
+ const synEventId = _RPC.uuid();
328
+ const synEventData = {
329
+ jsonrpc: "2.0",
330
+ method,
331
+ params,
332
+ id: synEventId
333
+ };
334
+ this._event.emit(synEventName, synEventData);
335
+ if (!options.isNotify) {
336
+ const ackEventName = this._getAckEventName(method);
337
+ const timeout = options.timeout || this._timeout;
338
+ let timer;
339
+ if (timeout) {
340
+ timer = setTimeout(() => {
341
+ const error = __spreadProps(__spreadValues({}, RPCCodes.CONNECT_TIMEOUT), {
342
+ data: { timeout }
343
+ });
344
+ reject(error);
345
+ }, timeout);
346
+ }
347
+ const ackEventHandler = (ackEventData) => {
348
+ if (ackEventData.id === synEventId) {
349
+ clearTimeout(timer);
350
+ this._event.off(ackEventName, ackEventHandler);
351
+ if (!ackEventData.error) {
352
+ resolve(ackEventData.result);
353
+ } else {
354
+ reject(ackEventData.error);
355
+ }
356
+ }
357
+ };
358
+ this._event.on(ackEventName, ackEventHandler);
359
+ } else {
360
+ resolve(void 0);
361
+ }
362
+ });
363
+ }
364
+ destroy() {
365
+ Object.entries(this._methods).forEach(([method]) => {
366
+ const synEventName = this._getSynEventName(method);
367
+ this._event.off(synEventName);
368
+ });
369
+ const connectAckEventName = this._getAckEventName(_RPC.EVENT.CONNECT);
370
+ const connectSynEventName = this._getSynEventName(_RPC.EVENT.CONNECT);
371
+ this._event.off(connectSynEventName);
372
+ this._event.off(connectAckEventName);
373
+ if (this._event.destroy) {
374
+ this._event.destroy();
375
+ }
376
+ }
377
+ };
378
+ let RPC = _RPC;
379
+ __publicField(RPC, "CODES", RPCCodes);
380
+ __publicField(RPC, "EVENT", {
381
+ SYN_SIGN: "syn:",
382
+ ACK_SIGN: "ack:",
383
+ CONNECT: "__rpc_connect_event",
384
+ SYNC_METHODS: "__rpc_sync_methods_event"
385
+ });
386
+
387
+ const DatabaseErrorCode = {
388
+ ErrorInit: 10001,
389
+ ErrorNoRecord: 10002,
390
+ ErrorDBTimeout: 10003,
391
+ };
392
+ exports.CbEvents = void 0;
393
+ (function (CbEvents) {
394
+ CbEvents["Login"] = "Login";
395
+ CbEvents["OnConnectFailed"] = "OnConnectFailed";
396
+ CbEvents["OnConnectSuccess"] = "OnConnectSuccess";
397
+ CbEvents["OnConnecting"] = "OnConnecting";
398
+ CbEvents["OnKickedOffline"] = "OnKickedOffline";
399
+ CbEvents["OnSelfInfoUpdated"] = "OnSelfInfoUpdated";
400
+ CbEvents["OnUserTokenExpired"] = "OnUserTokenExpired";
401
+ CbEvents["OnUserTokenInvalid"] = "OnUserTokenInvalid";
402
+ CbEvents["OnProgress"] = "OnProgress";
403
+ CbEvents["OnRecvNewMessage"] = "OnRecvNewMessage";
404
+ CbEvents["OnRecvNewMessages"] = "OnRecvNewMessages";
405
+ CbEvents["OnRecvOnlineOnlyMessage"] = "OnRecvOnlineOnlyMessage";
406
+ CbEvents["OnRecvOfflineNewMessage"] = "onRecvOfflineNewMessage";
407
+ CbEvents["OnRecvOnlineOnlyMessages"] = "OnRecvOnlineOnlyMessages";
408
+ CbEvents["OnRecvOfflineNewMessages"] = "onRecvOfflineNewMessages";
409
+ CbEvents["OnRecvMessageRevoked"] = "OnRecvMessageRevoked";
410
+ CbEvents["OnNewRecvMessageRevoked"] = "OnNewRecvMessageRevoked";
411
+ CbEvents["OnRecvC2CReadReceipt"] = "OnRecvC2CReadReceipt";
412
+ CbEvents["OnRecvGroupReadReceipt"] = "OnRecvGroupReadReceipt";
413
+ CbEvents["OnConversationChanged"] = "OnConversationChanged";
414
+ CbEvents["OnNewConversation"] = "OnNewConversation";
415
+ CbEvents["OnConversationUserInputStatusChanged"] = "OnConversationUserInputStatusChanged";
416
+ CbEvents["OnSyncServerFailed"] = "OnSyncServerFailed";
417
+ CbEvents["OnSyncServerFinish"] = "OnSyncServerFinish";
418
+ CbEvents["OnSyncServerProgress"] = "OnSyncServerProgress";
419
+ CbEvents["OnSyncServerStart"] = "OnSyncServerStart";
420
+ CbEvents["OnTotalUnreadMessageCountChanged"] = "OnTotalUnreadMessageCountChanged";
421
+ CbEvents["OnBlackAdded"] = "OnBlackAdded";
422
+ CbEvents["OnBlackDeleted"] = "OnBlackDeleted";
423
+ CbEvents["OnFriendApplicationAccepted"] = "OnFriendApplicationAccepted";
424
+ CbEvents["OnFriendApplicationAdded"] = "OnFriendApplicationAdded";
425
+ CbEvents["OnFriendApplicationDeleted"] = "OnFriendApplicationDeleted";
426
+ CbEvents["OnFriendApplicationRejected"] = "OnFriendApplicationRejected";
427
+ CbEvents["OnFriendInfoChanged"] = "OnFriendInfoChanged";
428
+ CbEvents["OnFriendAdded"] = "OnFriendAdded";
429
+ CbEvents["OnFriendDeleted"] = "OnFriendDeleted";
430
+ CbEvents["OnJoinedGroupAdded"] = "OnJoinedGroupAdded";
431
+ CbEvents["OnJoinedGroupDeleted"] = "OnJoinedGroupDeleted";
432
+ CbEvents["OnGroupDismissed"] = "OnGroupDismissed";
433
+ CbEvents["OnGroupMemberAdded"] = "OnGroupMemberAdded";
434
+ CbEvents["OnGroupMemberDeleted"] = "OnGroupMemberDeleted";
435
+ CbEvents["OnGroupApplicationAdded"] = "OnGroupApplicationAdded";
436
+ CbEvents["OnGroupApplicationDeleted"] = "OnGroupApplicationDeleted";
437
+ CbEvents["OnGroupInfoChanged"] = "OnGroupInfoChanged";
438
+ CbEvents["OnGroupMemberInfoChanged"] = "OnGroupMemberInfoChanged";
439
+ CbEvents["OnGroupApplicationAccepted"] = "OnGroupApplicationAccepted";
440
+ CbEvents["OnGroupApplicationRejected"] = "OnGroupApplicationRejected";
441
+ CbEvents["UploadComplete"] = "UploadComplete";
442
+ CbEvents["OnRecvCustomBusinessMessage"] = "OnRecvCustomBusinessMessage";
443
+ CbEvents["OnUserStatusChanged"] = "OnUserStatusChanged";
444
+ CbEvents["OnUploadLogsProgress"] = "OnUploadLogsProgress";
445
+ // rtc
446
+ CbEvents["OnReceiveNewInvitation"] = "OnReceiveNewInvitation";
447
+ CbEvents["OnInviteeAccepted"] = "OnInviteeAccepted";
448
+ CbEvents["OnInviteeRejected"] = "OnInviteeRejected";
449
+ CbEvents["OnInvitationCancelled"] = "OnInvitationCancelled";
450
+ CbEvents["OnHangUp"] = "OnHangUp";
451
+ CbEvents["OnInvitationTimeout"] = "OnInvitationTimeout";
452
+ CbEvents["OnInviteeAcceptedByOtherDevice"] = "OnInviteeAcceptedByOtherDevice";
453
+ CbEvents["OnInviteeRejectedByOtherDevice"] = "OnInviteeRejectedByOtherDevice";
454
+ // meeting
455
+ CbEvents["OnStreamChange"] = "OnStreamChange";
456
+ CbEvents["OnRoomParticipantConnected"] = "OnRoomParticipantConnected";
457
+ CbEvents["OnRoomParticipantDisconnected"] = "OnRoomParticipantDisconnected";
458
+ CbEvents["OnReceiveCustomSignal"] = "OnReceiveCustomSignal";
459
+ // unuse
460
+ CbEvents["UnUsedEvent"] = "UnUsedEvent";
461
+ })(exports.CbEvents || (exports.CbEvents = {}));
462
+
463
+ let rpc;
464
+ let worker;
465
+ let debug = false;
466
+ function supportsModuleWorkers() {
467
+ if (typeof Worker !== 'undefined' && 'type' in Worker.prototype) {
468
+ return true;
469
+ }
470
+ try {
471
+ const blob = new Blob([''], { type: 'text/javascript' });
472
+ const url = URL.createObjectURL(blob);
473
+ new Worker(url, { type: 'module' });
474
+ URL.revokeObjectURL(url);
475
+ return true;
476
+ }
477
+ catch (e) {
478
+ return false;
479
+ }
480
+ }
481
+ function initWorker() {
482
+ if (typeof window === 'undefined') {
483
+ return;
484
+ }
485
+ // use for webpack 4
486
+ // const IMWorker = require('worker-loader!./worker.js');
487
+ // worker = new IMWorker.default();
488
+ // use for webpack5+ or vite
489
+ const isViteEnvironment = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href)).includes('.vite/deps');
490
+ const isNuxtEnvironment = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href)).includes('_nuxt/node_modules');
491
+ const isQuasarEnvironment = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href)).includes('.q-cache');
492
+ const isSupportModuleWorker = supportsModuleWorkers();
493
+ let workerUrl = isSupportModuleWorker
494
+ ? new URL('worker.js', (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href)))
495
+ : new URL('worker-legacy.js', (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href)));
496
+ if (isViteEnvironment) {
497
+ workerUrl = workerUrl.href.replace('.vite/deps', '@inter-digital/wasm-client-sdk/lib');
498
+ }
499
+ if (isNuxtEnvironment) {
500
+ workerUrl = workerUrl.href.replace('.cache/vite/client/deps', '@inter-digital/wasm-client-sdk/lib');
501
+ }
502
+ if (isQuasarEnvironment) {
503
+ workerUrl = workerUrl.href.replace(/\.q-cache\/dev-spa\/[^/]+\/deps/, '@inter-digital/wasm-client-sdk/lib');
504
+ }
505
+ worker = new Worker(workerUrl, {
506
+ type: isSupportModuleWorker ? 'module' : 'classic',
507
+ });
508
+ // This is only required because Safari doesn't support nested
509
+ // workers. This installs a handler that will proxy creating web
510
+ // workers through the main thread
511
+ initBackend(worker);
512
+ rpc = new RPC({
513
+ event: new RPCMessageEvent({
514
+ currentEndpoint: worker,
515
+ targetEndpoint: worker,
516
+ }),
517
+ });
518
+ }
519
+ function resetWorker() {
520
+ if (rpc) {
521
+ rpc.destroy();
522
+ rpc = undefined;
523
+ }
524
+ if (worker) {
525
+ worker.terminate();
526
+ worker = undefined;
527
+ }
528
+ }
529
+ initWorker();
530
+ function catchErrorHandle(error) {
531
+ // defined in rpc-shooter
532
+ if (error.code === -32300) {
533
+ resetWorker();
534
+ return JSON.stringify({
535
+ data: '',
536
+ errCode: DatabaseErrorCode.ErrorDBTimeout,
537
+ errMsg: 'database maybe damaged',
538
+ });
539
+ }
540
+ throw error;
541
+ }
542
+ function _logWrap(...args) {
543
+ if (debug) {
544
+ console.info(...args);
545
+ }
546
+ }
547
+ function registeMethodOnWindow(name, realName, needStringify = true) {
548
+ _logWrap(`=> (database api) registe ${realName !== null && realName !== void 0 ? realName : name}`);
549
+ return async (...args) => {
550
+ if (!rpc || !worker) {
551
+ initWorker();
552
+ }
553
+ if (!rpc) {
554
+ return;
555
+ }
556
+ try {
557
+ _logWrap(`=> (invoked by go wasm) run ${realName !== null && realName !== void 0 ? realName : name} method with args ${JSON.stringify(args)}`);
558
+ const response = await rpc.invoke(name, ...args, { timeout: 5000000 });
559
+ _logWrap(`=> (invoked by go wasm) run ${realName !== null && realName !== void 0 ? realName : name} method with response `, JSON.stringify(response));
560
+ if (!needStringify) {
561
+ return response;
562
+ }
563
+ return JSON.stringify(response);
564
+ }
565
+ catch (error) {
566
+ // defined in rpc-shooter
567
+ catchErrorHandle(error);
568
+ }
569
+ };
570
+ }
571
+ // register method on window for go wasm invoke
572
+ function initDatabaseAPI(isLogStandardOutput = true) {
573
+ if (!rpc) {
574
+ return;
575
+ }
576
+ debug = isLogStandardOutput;
577
+ // upload
578
+ window.wasmOpen = registeMethodOnWindow('wasmOpen');
579
+ window.wasmClose = registeMethodOnWindow('wasmClose');
580
+ window.wasmRead = registeMethodOnWindow('wasmRead', 'wasmRead', false);
581
+ window.getUpload = registeMethodOnWindow('getUpload');
582
+ window.insertUpload = registeMethodOnWindow('insertUpload');
583
+ window.updateUpload = registeMethodOnWindow('updateUpload');
584
+ window.deleteUpload = registeMethodOnWindow('deleteUpload');
585
+ window.fileMapSet = registeMethodOnWindow('fileMapSet');
586
+ window.fileMapClear = registeMethodOnWindow('fileMapClear');
587
+ window.setSqlWasmPath = registeMethodOnWindow('setSqlWasmPath');
588
+ window.initDB = registeMethodOnWindow('initDB');
589
+ window.close = registeMethodOnWindow('close');
590
+ // message
591
+ window.getMessage = registeMethodOnWindow('getMessage');
592
+ window.getMultipleMessage = registeMethodOnWindow('getMultipleMessage');
593
+ window.getSendingMessageList = registeMethodOnWindow('getSendingMessageList');
594
+ window.getNormalMsgSeq = registeMethodOnWindow('getNormalMsgSeq');
595
+ window.updateMessageTimeAndStatus = registeMethodOnWindow('updateMessageTimeAndStatus');
596
+ window.updateMessage = registeMethodOnWindow('updateMessage');
597
+ window.updateMessageBySeq = registeMethodOnWindow('updateMessageBySeq');
598
+ window.updateColumnsMessage = registeMethodOnWindow('updateColumnsMessage');
599
+ window.insertMessage = registeMethodOnWindow('insertMessage');
600
+ window.batchInsertMessageList = registeMethodOnWindow('batchInsertMessageList');
601
+ window.getMessageList = registeMethodOnWindow('getMessageList');
602
+ window.getMessageListNoTime = registeMethodOnWindow('getMessageListNoTime');
603
+ window.messageIfExists = registeMethodOnWindow('messageIfExists');
604
+ window.messageIfExistsBySeq = registeMethodOnWindow('messageIfExistsBySeq');
605
+ window.getAbnormalMsgSeq = registeMethodOnWindow('getAbnormalMsgSeq');
606
+ window.getAbnormalMsgSeqList = registeMethodOnWindow('getAbnormalMsgSeqList');
607
+ window.batchInsertExceptionMsg = registeMethodOnWindow('batchInsertExceptionMsg');
608
+ window.searchMessageByKeyword = registeMethodOnWindow('searchMessageByKeyword');
609
+ window.searchMessageByContentType = registeMethodOnWindow('searchMessageByContentType');
610
+ window.searchMessageByContentTypeAndKeyword = registeMethodOnWindow('searchMessageByContentTypeAndKeyword');
611
+ window.updateMsgSenderNickname = registeMethodOnWindow('updateMsgSenderNickname');
612
+ window.updateMsgSenderFaceURL = registeMethodOnWindow('updateMsgSenderFaceURL');
613
+ window.updateMsgSenderFaceURLAndSenderNickname = registeMethodOnWindow('updateMsgSenderFaceURLAndSenderNickname');
614
+ window.getMsgSeqByClientMsgID = registeMethodOnWindow('getMsgSeqByClientMsgID');
615
+ window.getMsgSeqListByGroupID = registeMethodOnWindow('getMsgSeqListByGroupID');
616
+ window.getMsgSeqListByPeerUserID = registeMethodOnWindow('getMsgSeqListByPeerUserID');
617
+ window.getMsgSeqListBySelfUserID = registeMethodOnWindow('getMsgSeqListBySelfUserID');
618
+ window.deleteAllMessage = registeMethodOnWindow('deleteAllMessage');
619
+ window.getAllUnDeleteMessageSeqList = registeMethodOnWindow('getAllUnDeleteMessageSeqList');
620
+ window.updateSingleMessageHasRead = registeMethodOnWindow('updateSingleMessageHasRead');
621
+ window.updateGroupMessageHasRead = registeMethodOnWindow('updateGroupMessageHasRead');
622
+ window.updateMessageStatusBySourceID = registeMethodOnWindow('updateMessageStatusBySourceID');
623
+ window.getAlreadyExistSeqList = registeMethodOnWindow('getAlreadyExistSeqList');
624
+ window.getLatestValidServerMessage = registeMethodOnWindow('getLatestValidServerMessage');
625
+ window.getMessageBySeq = registeMethodOnWindow('getMessageBySeq');
626
+ window.getMessagesByClientMsgIDs = registeMethodOnWindow('getMessagesByClientMsgIDs');
627
+ window.getMessagesBySeqs = registeMethodOnWindow('getMessagesBySeqs');
628
+ window.getConversationNormalMsgSeq = registeMethodOnWindow('getConversationNormalMsgSeq');
629
+ window.checkConversationNormalMsgSeq = registeMethodOnWindow('getConversationNormalMsgSeq');
630
+ window.getConversationPeerNormalMsgSeq = registeMethodOnWindow('getConversationPeerNormalMsgSeq');
631
+ window.deleteConversationAllMessages = registeMethodOnWindow('deleteConversationAllMessages');
632
+ window.markDeleteConversationAllMessages = registeMethodOnWindow('markDeleteConversationAllMessages');
633
+ window.getUnreadMessage = registeMethodOnWindow('getUnreadMessage');
634
+ window.markConversationMessageAsReadBySeqs = registeMethodOnWindow('markConversationMessageAsReadBySeqs');
635
+ window.markConversationMessageAsReadDB = registeMethodOnWindow('markConversationMessageAsRead');
636
+ window.deleteConversationMsgs = registeMethodOnWindow('deleteConversationMsgs');
637
+ window.markConversationAllMessageAsRead = registeMethodOnWindow('markConversationAllMessageAsRead');
638
+ window.searchAllMessageByContentType = registeMethodOnWindow('searchAllMessageByContentType');
639
+ window.insertSendingMessage = registeMethodOnWindow('insertSendingMessage');
640
+ window.deleteSendingMessage = registeMethodOnWindow('deleteSendingMessage');
641
+ window.getAllSendingMessages = registeMethodOnWindow('getAllSendingMessages');
642
+ // conversation
643
+ window.getAllConversationListDB = registeMethodOnWindow('getAllConversationList');
644
+ window.getAllConversationListToSync = registeMethodOnWindow('getAllConversationListToSync');
645
+ window.getHiddenConversationList = registeMethodOnWindow('getHiddenConversationList');
646
+ window.getConversation = registeMethodOnWindow('getConversation');
647
+ window.getMultipleConversationDB = registeMethodOnWindow('getMultipleConversation');
648
+ window.updateColumnsConversation = registeMethodOnWindow('updateColumnsConversation');
649
+ window.updateConversation = registeMethodOnWindow('updateColumnsConversation', 'updateConversation');
650
+ window.updateConversationForSync = registeMethodOnWindow('updateColumnsConversation', 'updateConversationForSync');
651
+ window.decrConversationUnreadCount = registeMethodOnWindow('decrConversationUnreadCount');
652
+ window.batchInsertConversationList = registeMethodOnWindow('batchInsertConversationList');
653
+ window.insertConversation = registeMethodOnWindow('insertConversation');
654
+ window.getTotalUnreadMsgCountDB = registeMethodOnWindow('getTotalUnreadMsgCount');
655
+ window.getConversationByUserID = registeMethodOnWindow('getConversationByUserID');
656
+ window.getConversationListSplitDB = registeMethodOnWindow('getConversationListSplit');
657
+ window.deleteConversation = registeMethodOnWindow('deleteConversation');
658
+ window.deleteAllConversation = registeMethodOnWindow('deleteAllConversation');
659
+ window.batchUpdateConversationList = registeMethodOnWindow('batchUpdateConversationList');
660
+ window.conversationIfExists = registeMethodOnWindow('conversationIfExists');
661
+ window.resetConversation = registeMethodOnWindow('resetConversation');
662
+ window.resetAllConversation = registeMethodOnWindow('resetAllConversation');
663
+ window.clearConversation = registeMethodOnWindow('clearConversation');
664
+ window.clearAllConversation = registeMethodOnWindow('clearAllConversation');
665
+ window.setConversationDraftDB = registeMethodOnWindow('setConversationDraft');
666
+ window.removeConversationDraft = registeMethodOnWindow('removeConversationDraft');
667
+ window.unPinConversation = registeMethodOnWindow('unPinConversation');
668
+ // window.updateAllConversation = registeMethodOnWindow('updateAllConversation');
669
+ window.incrConversationUnreadCount = registeMethodOnWindow('incrConversationUnreadCount');
670
+ window.setMultipleConversationRecvMsgOpt = registeMethodOnWindow('setMultipleConversationRecvMsgOpt');
671
+ window.getAllSingleConversationIDList = registeMethodOnWindow('getAllSingleConversationIDList');
672
+ window.findAllUnreadConversationConversationID = registeMethodOnWindow('findAllUnreadConversationConversationID');
673
+ window.getAllConversationIDList = registeMethodOnWindow('getAllConversationIDList');
674
+ window.getAllConversations = registeMethodOnWindow('getAllConversations');
675
+ window.searchConversations = registeMethodOnWindow('searchConversations');
676
+ window.getLatestActiveMessage = registeMethodOnWindow('getLatestActiveMessage');
677
+ // users
678
+ window.getLoginUser = registeMethodOnWindow('getLoginUser');
679
+ window.insertLoginUser = registeMethodOnWindow('insertLoginUser');
680
+ window.updateLoginUser = registeMethodOnWindow('updateLoginUser');
681
+ window.getStrangerInfo = registeMethodOnWindow('getStrangerInfo');
682
+ window.setStrangerInfo = registeMethodOnWindow('setStrangerInfo');
683
+ // app sdk versions
684
+ window.getAppSDKVersion = registeMethodOnWindow('getAppSDKVersion');
685
+ window.setAppSDKVersion = registeMethodOnWindow('setAppSDKVersion');
686
+ // versions sync
687
+ window.getVersionSync = registeMethodOnWindow('getVersionSync');
688
+ window.setVersionSync = registeMethodOnWindow('setVersionSync');
689
+ window.deleteVersionSync = registeMethodOnWindow('deleteVersionSync');
690
+ // super groups
691
+ window.getJoinedSuperGroupList = registeMethodOnWindow('getJoinedSuperGroupList');
692
+ window.getJoinedSuperGroupIDList = registeMethodOnWindow('getJoinedSuperGroupIDList');
693
+ window.getSuperGroupInfoByGroupID = registeMethodOnWindow('getSuperGroupInfoByGroupID');
694
+ window.deleteSuperGroup = registeMethodOnWindow('deleteSuperGroup');
695
+ window.insertSuperGroup = registeMethodOnWindow('insertSuperGroup');
696
+ window.updateSuperGroup = registeMethodOnWindow('updateSuperGroup');
697
+ // unread messages
698
+ window.deleteConversationUnreadMessageList = registeMethodOnWindow('deleteConversationUnreadMessageList');
699
+ window.batchInsertConversationUnreadMessageList = registeMethodOnWindow('batchInsertConversationUnreadMessageList');
700
+ // super group messages
701
+ window.superGroupGetMessage = registeMethodOnWindow('superGroupGetMessage');
702
+ window.superGroupGetMultipleMessage = registeMethodOnWindow('superGroupGetMultipleMessage');
703
+ window.superGroupGetNormalMinSeq = registeMethodOnWindow('superGroupGetNormalMinSeq');
704
+ window.getSuperGroupNormalMsgSeq = registeMethodOnWindow('getSuperGroupNormalMsgSeq');
705
+ window.superGroupUpdateMessageTimeAndStatus = registeMethodOnWindow('superGroupUpdateMessageTimeAndStatus');
706
+ window.superGroupUpdateMessage = registeMethodOnWindow('superGroupUpdateMessage');
707
+ window.superGroupInsertMessage = registeMethodOnWindow('superGroupInsertMessage');
708
+ window.superGroupBatchInsertMessageList = registeMethodOnWindow('superGroupBatchInsertMessageList');
709
+ window.superGroupGetMessageListNoTime = registeMethodOnWindow('superGroupGetMessageListNoTime');
710
+ window.superGroupGetMessageList = registeMethodOnWindow('superGroupGetMessageList');
711
+ window.superGroupUpdateColumnsMessage = registeMethodOnWindow('superGroupUpdateColumnsMessage');
712
+ window.superGroupDeleteAllMessage = registeMethodOnWindow('superGroupDeleteAllMessage');
713
+ window.superGroupSearchMessageByKeyword = registeMethodOnWindow('superGroupSearchMessageByKeyword');
714
+ window.superGroupSearchMessageByContentType = registeMethodOnWindow('superGroupSearchMessageByContentType');
715
+ window.superGroupSearchMessageByContentTypeAndKeyword = registeMethodOnWindow('superGroupSearchMessageByContentTypeAndKeyword');
716
+ window.superGroupUpdateMessageStatusBySourceID = registeMethodOnWindow('superGroupUpdateMessageStatusBySourceID');
717
+ window.superGroupGetSendingMessageList = registeMethodOnWindow('superGroupGetSendingMessageList');
718
+ window.superGroupUpdateGroupMessageHasRead = registeMethodOnWindow('superGroupUpdateGroupMessageHasRead');
719
+ window.superGroupGetMsgSeqByClientMsgID = registeMethodOnWindow('superGroupGetMsgSeqByClientMsgID');
720
+ window.superGroupUpdateMsgSenderFaceURLAndSenderNickname =
721
+ registeMethodOnWindow('superGroupUpdateMsgSenderFaceURLAndSenderNickname');
722
+ window.superGroupSearchAllMessageByContentType = registeMethodOnWindow('superGroupSearchAllMessageByContentType');
723
+ // debug
724
+ window.exec = registeMethodOnWindow('exec');
725
+ window.getRowsModified = registeMethodOnWindow('getRowsModified');
726
+ window.exportDB = async () => {
727
+ if (!rpc || !worker) {
728
+ initWorker();
729
+ }
730
+ if (!rpc) {
731
+ return;
732
+ }
733
+ try {
734
+ _logWrap('=> (invoked by go wasm) run exportDB method ');
735
+ const result = await rpc.invoke('exportDB', undefined, { timeout: 5000 });
736
+ _logWrap('=> (invoked by go wasm) run exportDB method with response ', JSON.stringify(result));
737
+ return result;
738
+ }
739
+ catch (error) {
740
+ catchErrorHandle(error);
741
+ }
742
+ };
743
+ // black
744
+ window.getBlackListDB = registeMethodOnWindow('getBlackList');
745
+ window.getBlackListUserID = registeMethodOnWindow('getBlackListUserID');
746
+ window.getBlackInfoByBlockUserID = registeMethodOnWindow('getBlackInfoByBlockUserID');
747
+ window.getBlackInfoList = registeMethodOnWindow('getBlackInfoList');
748
+ window.insertBlack = registeMethodOnWindow('insertBlack');
749
+ window.deleteBlack = registeMethodOnWindow('deleteBlack');
750
+ window.updateBlack = registeMethodOnWindow('updateBlack');
751
+ // friendRequest
752
+ window.insertFriendRequest = registeMethodOnWindow('insertFriendRequest');
753
+ window.deleteFriendRequestBothUserID = registeMethodOnWindow('deleteFriendRequestBothUserID');
754
+ window.updateFriendRequest = registeMethodOnWindow('updateFriendRequest');
755
+ window.getRecvFriendApplication = registeMethodOnWindow('getRecvFriendApplication');
756
+ window.getSendFriendApplication = registeMethodOnWindow('getSendFriendApplication');
757
+ window.getFriendApplicationByBothID = registeMethodOnWindow('getFriendApplicationByBothID');
758
+ window.getBothFriendReq = registeMethodOnWindow('getBothFriendReq');
759
+ // friend
760
+ window.insertFriend = registeMethodOnWindow('insertFriend');
761
+ window.deleteFriendDB = registeMethodOnWindow('deleteFriend');
762
+ window.updateFriend = registeMethodOnWindow('updateFriend');
763
+ window.getAllFriendList = registeMethodOnWindow('getAllFriendList');
764
+ window.searchFriendList = registeMethodOnWindow('searchFriendList');
765
+ window.getFriendInfoByFriendUserID = registeMethodOnWindow('getFriendInfoByFriendUserID');
766
+ window.getFriendInfoList = registeMethodOnWindow('getFriendInfoList');
767
+ window.getPageFriendList = registeMethodOnWindow('getPageFriendList');
768
+ window.updateColumnsFriend = registeMethodOnWindow('updateColumnsFriend');
769
+ window.getFriendListCount = registeMethodOnWindow('getFriendListCount');
770
+ window.batchInsertFriend = registeMethodOnWindow('batchInsertFriend');
771
+ window.deleteAllFriend = registeMethodOnWindow('deleteAllFriend');
772
+ // groups
773
+ window.insertGroup = registeMethodOnWindow('insertGroup');
774
+ window.deleteGroup = registeMethodOnWindow('deleteGroup');
775
+ window.updateGroup = registeMethodOnWindow('updateGroup');
776
+ window.getJoinedGroupListDB = registeMethodOnWindow('getJoinedGroupList');
777
+ window.getGroupInfoByGroupID = registeMethodOnWindow('getGroupInfoByGroupID');
778
+ window.getAllGroupInfoByGroupIDOrGroupName = registeMethodOnWindow('getAllGroupInfoByGroupIDOrGroupName');
779
+ window.subtractMemberCount = registeMethodOnWindow('subtractMemberCount');
780
+ window.addMemberCount = registeMethodOnWindow('addMemberCount');
781
+ window.getJoinedWorkingGroupIDList = registeMethodOnWindow('getJoinedWorkingGroupIDList');
782
+ window.getJoinedWorkingGroupList = registeMethodOnWindow('getJoinedWorkingGroupList');
783
+ window.getGroupMemberAllGroupIDs = registeMethodOnWindow('getGroupMemberAllGroupIDs');
784
+ window.getUserJoinedGroupIDs = registeMethodOnWindow('getUserJoinedGroupIDs');
785
+ window.getGroups = registeMethodOnWindow('getGroups');
786
+ window.getGroupMemberListByUserIDs = registeMethodOnWindow('getGroupMemberListByUserIDs');
787
+ window.batchInsertGroup = registeMethodOnWindow('batchInsertGroup');
788
+ window.deleteAllGroup = registeMethodOnWindow('deleteAllGroup');
789
+ // groupRequest
790
+ window.insertGroupRequest = registeMethodOnWindow('insertGroupRequest');
791
+ window.deleteGroupRequest = registeMethodOnWindow('deleteGroupRequest');
792
+ window.updateGroupRequest = registeMethodOnWindow('updateGroupRequest');
793
+ window.getSendGroupApplication = registeMethodOnWindow('getSendGroupApplication');
794
+ window.insertAdminGroupRequest = registeMethodOnWindow('insertAdminGroupRequest');
795
+ window.deleteAdminGroupRequest = registeMethodOnWindow('deleteAdminGroupRequest');
796
+ window.updateAdminGroupRequest = registeMethodOnWindow('updateAdminGroupRequest');
797
+ window.getAdminGroupApplication = registeMethodOnWindow('getAdminGroupApplication');
798
+ // groupMember
799
+ window.getGroupMemberInfoByGroupIDUserID = registeMethodOnWindow('getGroupMemberInfoByGroupIDUserID');
800
+ window.getAllGroupMemberList = registeMethodOnWindow('getAllGroupMemberList');
801
+ window.getAllGroupMemberUserIDList = registeMethodOnWindow('getAllGroupMemberUserIDList');
802
+ window.getGroupMemberCount = registeMethodOnWindow('getGroupMemberCount');
803
+ window.getGroupSomeMemberInfo = registeMethodOnWindow('getGroupSomeMemberInfo');
804
+ window.getGroupAdminID = registeMethodOnWindow('getGroupAdminID');
805
+ window.getGroupMemberListByGroupID = registeMethodOnWindow('getGroupMemberListByGroupID');
806
+ window.getGroupMemberListSplit = registeMethodOnWindow('getGroupMemberListSplit');
807
+ window.getGroupMemberOwnerAndAdminDB = registeMethodOnWindow('getGroupMemberOwnerAndAdmin');
808
+ window.getGroupMemberOwner = registeMethodOnWindow('getGroupMemberOwner');
809
+ window.getGroupMemberListSplitByJoinTimeFilter = registeMethodOnWindow('getGroupMemberListSplitByJoinTimeFilter');
810
+ window.getGroupOwnerAndAdminByGroupID = registeMethodOnWindow('getGroupOwnerAndAdminByGroupID');
811
+ window.getGroupMemberUIDListByGroupID = registeMethodOnWindow('getGroupMemberUIDListByGroupID');
812
+ window.insertGroupMember = registeMethodOnWindow('insertGroupMember');
813
+ window.batchInsertGroupMember = registeMethodOnWindow('batchInsertGroupMember');
814
+ window.deleteGroupMember = registeMethodOnWindow('deleteGroupMember');
815
+ window.deleteGroupAllMembers = registeMethodOnWindow('deleteGroupAllMembers');
816
+ window.updateGroupMember = registeMethodOnWindow('updateGroupMember');
817
+ window.updateGroupMemberField = registeMethodOnWindow('updateGroupMemberField');
818
+ window.searchGroupMembersDB = registeMethodOnWindow('searchGroupMembers', 'searchGroupMembersDB');
819
+ // temp cache chat logs
820
+ window.batchInsertTempCacheMessageList = registeMethodOnWindow('batchInsertTempCacheMessageList');
821
+ window.InsertTempCacheMessage = registeMethodOnWindow('InsertTempCacheMessage');
822
+ // notification
823
+ window.getNotificationAllSeqs = registeMethodOnWindow('getNotificationAllSeqs');
824
+ window.setNotificationSeq = registeMethodOnWindow('setNotificationSeq');
825
+ window.batchInsertNotificationSeq = registeMethodOnWindow('batchInsertNotificationSeq');
826
+ window.getExistedTables = registeMethodOnWindow('getExistedTables');
827
+ }
828
+ const workerPromise = rpc === null || rpc === void 0 ? void 0 : rpc.connect(5000);
829
+
830
+ class Emitter {
831
+ constructor() {
832
+ this.events = {};
833
+ }
834
+ emit(event, data) {
835
+ if (this.events[event]) {
836
+ this.events[event].forEach(fn => {
837
+ return fn(data);
838
+ });
839
+ }
840
+ return this;
841
+ }
842
+ on(event, fn) {
843
+ if (this.events[event]) {
844
+ this.events[event].push(fn);
845
+ }
846
+ else {
847
+ this.events[event] = [fn];
848
+ }
849
+ return this;
850
+ }
851
+ off(event, fn) {
852
+ if (event && typeof fn === 'function' && this.events[event]) {
853
+ const listeners = this.events[event];
854
+ if (!listeners || listeners.length === 0) {
855
+ return;
856
+ }
857
+ const index = listeners.findIndex(_fn => {
858
+ return _fn === fn;
859
+ });
860
+ if (index !== -1) {
861
+ listeners.splice(index, 1);
862
+ }
863
+ }
864
+ return this;
865
+ }
866
+ }
867
+
868
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
869
+ // require the crypto API and do not support built-in fallback to lower quality random number
870
+ // generators (like Math.random()).
871
+ let getRandomValues;
872
+ const rnds8 = new Uint8Array(16);
873
+ function rng() {
874
+ // lazy load so that environments that need to polyfill have a chance to do so
875
+ if (!getRandomValues) {
876
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
877
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
878
+
879
+ if (!getRandomValues) {
880
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
881
+ }
882
+ }
883
+
884
+ return getRandomValues(rnds8);
885
+ }
886
+
887
+ /**
888
+ * Convert array of 16 byte values to UUID string format of the form:
889
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
890
+ */
891
+
892
+ const byteToHex = [];
893
+
894
+ for (let i = 0; i < 256; ++i) {
895
+ byteToHex.push((i + 0x100).toString(16).slice(1));
896
+ }
897
+
898
+ function unsafeStringify(arr, offset = 0) {
899
+ // Note: Be careful editing this code! It's been tuned for performance
900
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
901
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
902
+ }
903
+
904
+ const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
905
+ var native = {
906
+ randomUUID
907
+ };
908
+
909
+ function v4(options, buf, offset) {
910
+ if (native.randomUUID && !buf && !options) {
911
+ return native.randomUUID();
912
+ }
913
+
914
+ options = options || {};
915
+ const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
916
+
917
+ rnds[6] = rnds[6] & 0x0f | 0x40;
918
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
919
+
920
+ if (buf) {
921
+ offset = offset || 0;
922
+
923
+ for (let i = 0; i < 16; ++i) {
924
+ buf[offset + i] = rnds[i];
925
+ }
926
+
927
+ return buf;
928
+ }
929
+
930
+ return unsafeStringify(rnds);
931
+ }
932
+
933
+ async function wait(duration) {
934
+ return new Promise(resolve => {
935
+ const timer = setTimeout(() => {
936
+ clearTimeout(timer);
937
+ resolve(null);
938
+ }, duration);
939
+ });
940
+ }
941
+
942
+ function logBoxStyleValue(backgroundColor, color) {
943
+ return `font-size:14px; background:${backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : '#ffffff'}; color:${color !== null && color !== void 0 ? color : '#000000'}; border-radius:4px; padding-inline:4px;`;
944
+ }
945
+
946
+ let initialized = false;
947
+ let go;
948
+ let goExitPromise;
949
+ const CACHE_KEY = 'openim-wasm-cache';
950
+ if (typeof window !== 'undefined') {
951
+ const cleanup = () => {
952
+ reset();
953
+ };
954
+ window.addEventListener('beforeunload', cleanup);
955
+ window.addEventListener('unload', cleanup);
956
+ if ('__TAURI__' in window) {
957
+ window.addEventListener('tauri://close-requested', cleanup);
958
+ window.addEventListener('tauri://destroyed', cleanup);
959
+ window.addEventListener('tauri://window-close-requested', cleanup);
960
+ }
961
+ }
962
+ async function initializeWasm(url) {
963
+ if (initialized) {
964
+ return null;
965
+ }
966
+ if (typeof window === 'undefined') {
967
+ return Promise.resolve(null);
968
+ }
969
+ go = new Go();
970
+ let wasm;
971
+ try {
972
+ if ('instantiateStreaming' in WebAssembly) {
973
+ wasm = await WebAssembly.instantiateStreaming(fetchWithCache(url), go.importObject);
974
+ }
975
+ else {
976
+ const bytes = await fetchWithCache(url).then(resp => resp.arrayBuffer());
977
+ wasm = await WebAssembly.instantiate(bytes, go.importObject);
978
+ }
979
+ go.run(wasm.instance);
980
+ }
981
+ catch (error) {
982
+ console.error('Failed to initialize WASM:', error);
983
+ return null;
984
+ }
985
+ await wait(100);
986
+ initialized = true;
987
+ return go;
988
+ }
989
+ function reset() {
990
+ initialized = false;
991
+ if (go) {
992
+ go = undefined;
993
+ }
994
+ }
995
+ function getGO() {
996
+ return go;
997
+ }
998
+ function getGoExitPromise() {
999
+ return goExitPromise;
1000
+ }
1001
+ async function fetchWithCache(url) {
1002
+ if (!('caches' in window)) {
1003
+ return fetch(url);
1004
+ }
1005
+ const isResourceUpdated = async () => {
1006
+ const serverResponse = await fetch(url, { method: 'HEAD' });
1007
+ const etag = serverResponse.headers.get('ETag');
1008
+ const lastModified = serverResponse.headers.get('Last-Modified');
1009
+ return (serverResponse.ok &&
1010
+ (etag !== (cachedResponse === null || cachedResponse === void 0 ? void 0 : cachedResponse.headers.get('ETag')) ||
1011
+ lastModified !== (cachedResponse === null || cachedResponse === void 0 ? void 0 : cachedResponse.headers.get('Last-Modified'))));
1012
+ };
1013
+ const cache = await caches.open(CACHE_KEY);
1014
+ const cachedResponse = await cache.match(url);
1015
+ if (cachedResponse && !(await isResourceUpdated())) {
1016
+ return cachedResponse;
1017
+ }
1018
+ return fetchAndUpdateCache(url, cache);
1019
+ }
1020
+ async function fetchAndUpdateCache(url, cache) {
1021
+ const response = await fetch(url, { cache: 'no-cache' });
1022
+ try {
1023
+ await cache.put(url, response.clone());
1024
+ }
1025
+ catch (error) {
1026
+ console.warn('Failed to put cache');
1027
+ }
1028
+ return response;
1029
+ }
1030
+
1031
+ exports.MessageReceiveOptType = void 0;
1032
+ (function (MessageReceiveOptType) {
1033
+ MessageReceiveOptType[MessageReceiveOptType["Normal"] = 0] = "Normal";
1034
+ MessageReceiveOptType[MessageReceiveOptType["NotReceive"] = 1] = "NotReceive";
1035
+ MessageReceiveOptType[MessageReceiveOptType["NotNotify"] = 2] = "NotNotify";
1036
+ })(exports.MessageReceiveOptType || (exports.MessageReceiveOptType = {}));
1037
+ exports.AllowType = void 0;
1038
+ (function (AllowType) {
1039
+ AllowType[AllowType["Allowed"] = 0] = "Allowed";
1040
+ AllowType[AllowType["NotAllowed"] = 1] = "NotAllowed";
1041
+ })(exports.AllowType || (exports.AllowType = {}));
1042
+ exports.GroupType = void 0;
1043
+ (function (GroupType) {
1044
+ GroupType[GroupType["Group"] = 2] = "Group";
1045
+ GroupType[GroupType["WorkingGroup"] = 2] = "WorkingGroup";
1046
+ })(exports.GroupType || (exports.GroupType = {}));
1047
+ exports.GroupJoinSource = void 0;
1048
+ (function (GroupJoinSource) {
1049
+ GroupJoinSource[GroupJoinSource["Invitation"] = 2] = "Invitation";
1050
+ GroupJoinSource[GroupJoinSource["Search"] = 3] = "Search";
1051
+ GroupJoinSource[GroupJoinSource["QrCode"] = 4] = "QrCode";
1052
+ })(exports.GroupJoinSource || (exports.GroupJoinSource = {}));
1053
+ exports.GroupMemberRole = void 0;
1054
+ (function (GroupMemberRole) {
1055
+ GroupMemberRole[GroupMemberRole["Normal"] = 20] = "Normal";
1056
+ GroupMemberRole[GroupMemberRole["Admin"] = 60] = "Admin";
1057
+ GroupMemberRole[GroupMemberRole["Owner"] = 100] = "Owner";
1058
+ })(exports.GroupMemberRole || (exports.GroupMemberRole = {}));
1059
+ exports.GroupVerificationType = void 0;
1060
+ (function (GroupVerificationType) {
1061
+ GroupVerificationType[GroupVerificationType["ApplyNeedInviteNot"] = 0] = "ApplyNeedInviteNot";
1062
+ GroupVerificationType[GroupVerificationType["AllNeed"] = 1] = "AllNeed";
1063
+ GroupVerificationType[GroupVerificationType["AllNot"] = 2] = "AllNot";
1064
+ })(exports.GroupVerificationType || (exports.GroupVerificationType = {}));
1065
+ exports.MessageStatus = void 0;
1066
+ (function (MessageStatus) {
1067
+ MessageStatus[MessageStatus["Sending"] = 1] = "Sending";
1068
+ MessageStatus[MessageStatus["Succeed"] = 2] = "Succeed";
1069
+ MessageStatus[MessageStatus["Failed"] = 3] = "Failed";
1070
+ })(exports.MessageStatus || (exports.MessageStatus = {}));
1071
+ exports.Platform = void 0;
1072
+ (function (Platform) {
1073
+ Platform[Platform["iOS"] = 1] = "iOS";
1074
+ Platform[Platform["Android"] = 2] = "Android";
1075
+ Platform[Platform["Windows"] = 3] = "Windows";
1076
+ Platform[Platform["MacOSX"] = 4] = "MacOSX";
1077
+ Platform[Platform["Web"] = 5] = "Web";
1078
+ Platform[Platform["Linux"] = 7] = "Linux";
1079
+ Platform[Platform["AndroidPad"] = 8] = "AndroidPad";
1080
+ Platform[Platform["iPad"] = 9] = "iPad";
1081
+ })(exports.Platform || (exports.Platform = {}));
1082
+ exports.LogLevel = void 0;
1083
+ (function (LogLevel) {
1084
+ LogLevel[LogLevel["Verbose"] = 6] = "Verbose";
1085
+ LogLevel[LogLevel["Debug"] = 5] = "Debug";
1086
+ LogLevel[LogLevel["Info"] = 4] = "Info";
1087
+ LogLevel[LogLevel["Warn"] = 3] = "Warn";
1088
+ LogLevel[LogLevel["Error"] = 2] = "Error";
1089
+ LogLevel[LogLevel["Fatal"] = 1] = "Fatal";
1090
+ LogLevel[LogLevel["Panic"] = 0] = "Panic";
1091
+ })(exports.LogLevel || (exports.LogLevel = {}));
1092
+ exports.ApplicationHandleResult = void 0;
1093
+ (function (ApplicationHandleResult) {
1094
+ ApplicationHandleResult[ApplicationHandleResult["Unprocessed"] = 0] = "Unprocessed";
1095
+ ApplicationHandleResult[ApplicationHandleResult["Agree"] = 1] = "Agree";
1096
+ ApplicationHandleResult[ApplicationHandleResult["Reject"] = -1] = "Reject";
1097
+ })(exports.ApplicationHandleResult || (exports.ApplicationHandleResult = {}));
1098
+ exports.MessageType = void 0;
1099
+ (function (MessageType) {
1100
+ MessageType[MessageType["TextMessage"] = 101] = "TextMessage";
1101
+ MessageType[MessageType["PictureMessage"] = 102] = "PictureMessage";
1102
+ MessageType[MessageType["VoiceMessage"] = 103] = "VoiceMessage";
1103
+ MessageType[MessageType["VideoMessage"] = 104] = "VideoMessage";
1104
+ MessageType[MessageType["FileMessage"] = 105] = "FileMessage";
1105
+ MessageType[MessageType["AtTextMessage"] = 106] = "AtTextMessage";
1106
+ MessageType[MessageType["MergeMessage"] = 107] = "MergeMessage";
1107
+ MessageType[MessageType["CardMessage"] = 108] = "CardMessage";
1108
+ MessageType[MessageType["LocationMessage"] = 109] = "LocationMessage";
1109
+ MessageType[MessageType["CustomMessage"] = 110] = "CustomMessage";
1110
+ MessageType[MessageType["TypingMessage"] = 113] = "TypingMessage";
1111
+ MessageType[MessageType["QuoteMessage"] = 114] = "QuoteMessage";
1112
+ MessageType[MessageType["FaceMessage"] = 115] = "FaceMessage";
1113
+ MessageType[MessageType["FriendAdded"] = 1201] = "FriendAdded";
1114
+ MessageType[MessageType["OANotification"] = 1400] = "OANotification";
1115
+ MessageType[MessageType["GroupCreated"] = 1501] = "GroupCreated";
1116
+ MessageType[MessageType["GroupInfoUpdated"] = 1502] = "GroupInfoUpdated";
1117
+ MessageType[MessageType["MemberQuit"] = 1504] = "MemberQuit";
1118
+ MessageType[MessageType["GroupOwnerTransferred"] = 1507] = "GroupOwnerTransferred";
1119
+ MessageType[MessageType["MemberKicked"] = 1508] = "MemberKicked";
1120
+ MessageType[MessageType["MemberInvited"] = 1509] = "MemberInvited";
1121
+ MessageType[MessageType["MemberEnter"] = 1510] = "MemberEnter";
1122
+ MessageType[MessageType["GroupDismissed"] = 1511] = "GroupDismissed";
1123
+ MessageType[MessageType["GroupMemberMuted"] = 1512] = "GroupMemberMuted";
1124
+ MessageType[MessageType["GroupMemberCancelMuted"] = 1513] = "GroupMemberCancelMuted";
1125
+ MessageType[MessageType["GroupMuted"] = 1514] = "GroupMuted";
1126
+ MessageType[MessageType["GroupCancelMuted"] = 1515] = "GroupCancelMuted";
1127
+ MessageType[MessageType["GroupAnnouncementUpdated"] = 1519] = "GroupAnnouncementUpdated";
1128
+ MessageType[MessageType["GroupNameUpdated"] = 1520] = "GroupNameUpdated";
1129
+ MessageType[MessageType["BurnMessageChange"] = 1701] = "BurnMessageChange";
1130
+ MessageType[MessageType["RevokeMessage"] = 2101] = "RevokeMessage";
1131
+ })(exports.MessageType || (exports.MessageType = {}));
1132
+ exports.SessionType = void 0;
1133
+ (function (SessionType) {
1134
+ SessionType[SessionType["Single"] = 1] = "Single";
1135
+ SessionType[SessionType["Group"] = 3] = "Group";
1136
+ SessionType[SessionType["WorkingGroup"] = 3] = "WorkingGroup";
1137
+ SessionType[SessionType["Notification"] = 4] = "Notification";
1138
+ })(exports.SessionType || (exports.SessionType = {}));
1139
+ exports.GroupStatus = void 0;
1140
+ (function (GroupStatus) {
1141
+ GroupStatus[GroupStatus["Normal"] = 0] = "Normal";
1142
+ GroupStatus[GroupStatus["Banned"] = 1] = "Banned";
1143
+ GroupStatus[GroupStatus["Dismissed"] = 2] = "Dismissed";
1144
+ GroupStatus[GroupStatus["Muted"] = 3] = "Muted";
1145
+ })(exports.GroupStatus || (exports.GroupStatus = {}));
1146
+ exports.GroupAtType = void 0;
1147
+ (function (GroupAtType) {
1148
+ GroupAtType[GroupAtType["AtNormal"] = 0] = "AtNormal";
1149
+ GroupAtType[GroupAtType["AtMe"] = 1] = "AtMe";
1150
+ GroupAtType[GroupAtType["AtAll"] = 2] = "AtAll";
1151
+ GroupAtType[GroupAtType["AtAllAtMe"] = 3] = "AtAllAtMe";
1152
+ GroupAtType[GroupAtType["AtGroupNotice"] = 4] = "AtGroupNotice";
1153
+ })(exports.GroupAtType || (exports.GroupAtType = {}));
1154
+ exports.GroupMemberFilter = void 0;
1155
+ (function (GroupMemberFilter) {
1156
+ GroupMemberFilter[GroupMemberFilter["All"] = 0] = "All";
1157
+ GroupMemberFilter[GroupMemberFilter["Owner"] = 1] = "Owner";
1158
+ GroupMemberFilter[GroupMemberFilter["Admin"] = 2] = "Admin";
1159
+ GroupMemberFilter[GroupMemberFilter["Normal"] = 3] = "Normal";
1160
+ GroupMemberFilter[GroupMemberFilter["AdminAndNormal"] = 4] = "AdminAndNormal";
1161
+ GroupMemberFilter[GroupMemberFilter["AdminAndOwner"] = 5] = "AdminAndOwner";
1162
+ })(exports.GroupMemberFilter || (exports.GroupMemberFilter = {}));
1163
+ exports.Relationship = void 0;
1164
+ (function (Relationship) {
1165
+ Relationship[Relationship["isBlack"] = 0] = "isBlack";
1166
+ Relationship[Relationship["isFriend"] = 1] = "isFriend";
1167
+ })(exports.Relationship || (exports.Relationship = {}));
1168
+ exports.LoginStatus = void 0;
1169
+ (function (LoginStatus) {
1170
+ LoginStatus[LoginStatus["Logout"] = 1] = "Logout";
1171
+ LoginStatus[LoginStatus["Logging"] = 2] = "Logging";
1172
+ LoginStatus[LoginStatus["Logged"] = 3] = "Logged";
1173
+ })(exports.LoginStatus || (exports.LoginStatus = {}));
1174
+ exports.OnlineState = void 0;
1175
+ (function (OnlineState) {
1176
+ OnlineState[OnlineState["Online"] = 1] = "Online";
1177
+ OnlineState[OnlineState["Offline"] = 0] = "Offline";
1178
+ })(exports.OnlineState || (exports.OnlineState = {}));
1179
+ exports.GroupMessageReaderFilter = void 0;
1180
+ (function (GroupMessageReaderFilter) {
1181
+ GroupMessageReaderFilter[GroupMessageReaderFilter["Read"] = 0] = "Read";
1182
+ GroupMessageReaderFilter[GroupMessageReaderFilter["UnRead"] = 1] = "UnRead";
1183
+ })(exports.GroupMessageReaderFilter || (exports.GroupMessageReaderFilter = {}));
1184
+ exports.ViewType = void 0;
1185
+ (function (ViewType) {
1186
+ ViewType[ViewType["History"] = 0] = "History";
1187
+ ViewType[ViewType["Search"] = 1] = "Search";
1188
+ })(exports.ViewType || (exports.ViewType = {}));
1189
+
1190
+ class SDK extends Emitter {
1191
+ constructor(url = '/openIM.wasm', debug = true) {
1192
+ super();
1193
+ this.goExisted = false;
1194
+ this.tryParse = true;
1195
+ this.isLogStandardOutput = true;
1196
+ this.isInitialized = false;
1197
+ this.init = async (params, operationID = v4()) => {
1198
+ var _a, _b;
1199
+ this._logWrap(`SDK => (invoked by js) run init with args ${JSON.stringify({
1200
+ params,
1201
+ operationID,
1202
+ })}`);
1203
+ // Prevent multiple initialization calls
1204
+ if (this.isInitialized) {
1205
+ this._logWrap('SDK => init already called, skipping duplicate initialization');
1206
+ return Promise.resolve();
1207
+ }
1208
+ await workerPromise;
1209
+ await this.wasmInitializedPromise;
1210
+ window.commonEventFunc(event => {
1211
+ try {
1212
+ this._logWrap(`%cSDK =>%c received event %c${event}%c `, logBoxStyleValue('#282828', '#ffffff'), '', 'color: #4f2398;', '');
1213
+ const parsed = JSON.parse(event);
1214
+ if (this.tryParse) {
1215
+ try {
1216
+ parsed.data = JSON.parse(parsed.data);
1217
+ }
1218
+ catch (error) {
1219
+ // parse error
1220
+ }
1221
+ }
1222
+ this.emit(parsed.event, parsed);
1223
+ }
1224
+ catch (error) {
1225
+ console.error(error);
1226
+ }
1227
+ });
1228
+ const config = {
1229
+ platformID: params.platformID,
1230
+ apiAddr: params.apiAddr,
1231
+ wsAddr: params.wsAddr,
1232
+ dataDir: './',
1233
+ logLevel: params.logLevel || 5,
1234
+ isLogStandardOutput: (_a = params.isLogStandardOutput) !== null && _a !== void 0 ? _a : this.isLogStandardOutput,
1235
+ logFilePath: './',
1236
+ isExternalExtensions: params.isExternalExtensions || false,
1237
+ };
1238
+ this.tryParse = (_b = params.tryParse) !== null && _b !== void 0 ? _b : true;
1239
+ const result = window.initSDK(operationID, JSON.stringify(config));
1240
+ this.isInitialized = true;
1241
+ return result;
1242
+ };
1243
+ this.login = async (params, operationID = v4()) => {
1244
+ this._logWrap(`SDK => (invoked by js) run login with args ${JSON.stringify({
1245
+ params,
1246
+ operationID,
1247
+ })}`);
1248
+ // If initialization config is provided, run init first
1249
+ if ('platformID' in params) {
1250
+ await this.init(params, operationID);
1251
+ }
1252
+ return await window.login(operationID, params.userID, params.token);
1253
+ };
1254
+ this.logout = (operationID = v4()) => {
1255
+ window.fileMapClear();
1256
+ return this._invoker('logout', window.logout, [operationID]);
1257
+ };
1258
+ this.getAllConversationList = (operationID = v4()) => {
1259
+ return this._invoker('getAllConversationList', window.getAllConversationList, [operationID]);
1260
+ };
1261
+ this.getOneConversation = (params, operationID = v4()) => {
1262
+ return this._invoker('getOneConversation', window.getOneConversation, [operationID, params.sessionType, params.sourceID]);
1263
+ };
1264
+ this.getAdvancedHistoryMessageList = (params, operationID = v4()) => {
1265
+ return this._invoker('getAdvancedHistoryMessageList', window.getAdvancedHistoryMessageList, [operationID, JSON.stringify(params)]);
1266
+ };
1267
+ this.getAdvancedHistoryMessageListReverse = (params, operationID = v4()) => {
1268
+ return this._invoker('getAdvancedHistoryMessageListReverse', window.getAdvancedHistoryMessageListReverse, [operationID, JSON.stringify(params)]);
1269
+ };
1270
+ this.fetchSurroundingMessages = (params, operationID = v4()) => {
1271
+ return this._invoker('fetchSurroundingMessages', window.fetchSurroundingMessages, [operationID, JSON.stringify(params)]);
1272
+ };
1273
+ this.getSpecifiedGroupsInfo = (params, operationID = v4()) => {
1274
+ return this._invoker('getSpecifiedGroupsInfo', window.getSpecifiedGroupsInfo, [operationID, JSON.stringify(params)]);
1275
+ };
1276
+ this.deleteConversationAndDeleteAllMsg = (conversationID, operationID = v4()) => {
1277
+ return this._invoker('deleteConversationAndDeleteAllMsg', window.deleteConversationAndDeleteAllMsg, [operationID, conversationID]);
1278
+ };
1279
+ this.markConversationMessageAsRead = (data, operationID = v4()) => {
1280
+ return this._invoker('markConversationMessageAsRead', window.markConversationMessageAsRead, [operationID, data]);
1281
+ };
1282
+ this.sendGroupMessageReadReceipt = (params, operationID = v4()) => {
1283
+ return this._invoker('sendGroupMessageReadReceipt', window.sendGroupMessageReadReceipt, [
1284
+ operationID,
1285
+ params.conversationID,
1286
+ JSON.stringify(params.clientMsgIDList),
1287
+ ]);
1288
+ };
1289
+ this.getGroupMessageReaderList = (params, operationID = v4()) => {
1290
+ return this._invoker('getGroupMessageReaderList', window.getGroupMessageReaderList, [
1291
+ operationID,
1292
+ params.conversationID,
1293
+ params.clientMsgID,
1294
+ params.filter,
1295
+ params.offset,
1296
+ params.count,
1297
+ ]);
1298
+ };
1299
+ this.getGroupMemberList = (params, operationID = v4()) => {
1300
+ return this._invoker('getGroupMemberList', window.getGroupMemberList, [operationID, params.groupID, params.filter, params.offset, params.count]);
1301
+ };
1302
+ this.createTextMessage = (text, operationID = v4()) => {
1303
+ return this._invoker('createTextMessage', window.createTextMessage, [operationID, text], data => {
1304
+ // compitable with old version sdk
1305
+ return data[0];
1306
+ });
1307
+ };
1308
+ this.createImageMessageByURL = (params, operationID = v4()) => {
1309
+ return this._invoker('createImageMessageByURL', window.createImageMessageByURL, [
1310
+ operationID,
1311
+ params.sourcePath,
1312
+ JSON.stringify(params.sourcePicture),
1313
+ JSON.stringify(params.bigPicture),
1314
+ JSON.stringify(params.snapshotPicture),
1315
+ ], data => {
1316
+ // compitable with old version sdk
1317
+ return data[0];
1318
+ });
1319
+ };
1320
+ this.createImageMessageByFile = (params, operationID = v4()) => {
1321
+ params.sourcePicture.uuid = `${params.sourcePicture.uuid}/${params.file.name}`;
1322
+ window.fileMapSet(params.sourcePicture.uuid, params.file);
1323
+ return this._invoker('createImageMessageByFile', window.createImageMessageByURL, [
1324
+ operationID,
1325
+ params.sourcePath,
1326
+ JSON.stringify(params.sourcePicture),
1327
+ JSON.stringify(params.bigPicture),
1328
+ JSON.stringify(params.snapshotPicture),
1329
+ ], data => {
1330
+ // compitable with old version sdk
1331
+ return data[0];
1332
+ });
1333
+ };
1334
+ this.createCustomMessage = (params, operationID = v4()) => {
1335
+ return this._invoker('createCustomMessage', window.createCustomMessage, [operationID, params.data, params.extension, params.description], data => {
1336
+ // compitable with old version sdk
1337
+ return data[0];
1338
+ });
1339
+ };
1340
+ this.createQuoteMessage = (params, operationID = v4()) => {
1341
+ return this._invoker('createQuoteMessage', window.createQuoteMessage, [operationID, params.text, params.message], data => {
1342
+ // compitable with old version sdk
1343
+ return data[0];
1344
+ });
1345
+ };
1346
+ this.createAdvancedQuoteMessage = (params, operationID = v4()) => {
1347
+ return this._invoker('createAdvancedQuoteMessage', window.createAdvancedQuoteMessage, [
1348
+ operationID,
1349
+ params.text,
1350
+ JSON.stringify(params.message),
1351
+ JSON.stringify(params.messageEntityList),
1352
+ ], data => {
1353
+ // compitable with old version sdk
1354
+ return data[0];
1355
+ });
1356
+ };
1357
+ this.createAdvancedTextMessage = (params, operationID = v4()) => {
1358
+ return this._invoker('createAdvancedTextMessage', window.createAdvancedTextMessage, [operationID, params.text, JSON.stringify(params.messageEntityList)], data => {
1359
+ // compitable with old version sdk
1360
+ return data[0];
1361
+ });
1362
+ };
1363
+ this.sendMessage = (params, operationID = v4()) => {
1364
+ var _a, _b;
1365
+ const offlinePushInfo = (_a = params.offlinePushInfo) !== null && _a !== void 0 ? _a : {
1366
+ title: 'You have a new message.',
1367
+ desc: '',
1368
+ ex: '',
1369
+ iOSPushSound: '+1',
1370
+ iOSBadgeCount: true,
1371
+ };
1372
+ return this._invoker('sendMessage', window.sendMessage, [
1373
+ operationID,
1374
+ JSON.stringify(params.message),
1375
+ params.recvID,
1376
+ params.groupID,
1377
+ JSON.stringify(offlinePushInfo),
1378
+ (_b = params.isOnlineOnly) !== null && _b !== void 0 ? _b : false,
1379
+ ]);
1380
+ };
1381
+ this.sendMessageNotOss = (params, operationID = v4()) => {
1382
+ var _a, _b;
1383
+ const offlinePushInfo = (_a = params.offlinePushInfo) !== null && _a !== void 0 ? _a : {
1384
+ title: 'You have a new message.',
1385
+ desc: '',
1386
+ ex: '',
1387
+ iOSPushSound: '+1',
1388
+ iOSBadgeCount: true,
1389
+ };
1390
+ return this._invoker('sendMessageNotOss', window.sendMessageNotOss, [
1391
+ operationID,
1392
+ JSON.stringify(params.message),
1393
+ params.recvID,
1394
+ params.groupID,
1395
+ JSON.stringify(offlinePushInfo),
1396
+ (_b = params.isOnlineOnly) !== null && _b !== void 0 ? _b : false,
1397
+ ]);
1398
+ };
1399
+ this.setMessageLocalEx = (params, operationID = v4()) => {
1400
+ return this._invoker('setMessageLocalEx', window.setMessageLocalEx, [
1401
+ operationID,
1402
+ params.conversationID,
1403
+ params.clientMsgID,
1404
+ params.localEx,
1405
+ ]);
1406
+ };
1407
+ this.getHistoryMessageListReverse = (params, operationID = v4()) => {
1408
+ return this._invoker('getHistoryMessageListReverse', window.getHistoryMessageListReverse, [operationID, JSON.stringify(params)]);
1409
+ };
1410
+ this.revokeMessage = (data, operationID = v4()) => {
1411
+ return this._invoker('revokeMessage', window.revokeMessage, [
1412
+ operationID,
1413
+ data.conversationID,
1414
+ data.clientMsgID,
1415
+ ]);
1416
+ };
1417
+ this.setConversation = (params, operationID = v4()) => {
1418
+ return this._invoker('setConversation', window.setConversation, [
1419
+ operationID,
1420
+ params.conversationID,
1421
+ JSON.stringify(params),
1422
+ ]);
1423
+ };
1424
+ /**
1425
+ * @deprecated Use setConversation instead.
1426
+ */
1427
+ this.setConversationPrivateChat = (params, operationID = v4()) => {
1428
+ return this._invoker('setConversationPrivateChat', window.setConversation, [
1429
+ operationID,
1430
+ params.conversationID,
1431
+ JSON.stringify({
1432
+ isPrivateChat: params.isPrivate,
1433
+ }),
1434
+ ]);
1435
+ };
1436
+ /**
1437
+ * @deprecated Use setConversation instead.
1438
+ */
1439
+ this.setConversationBurnDuration = (params, operationID = v4()) => {
1440
+ return this._invoker('setConversationBurnDuration', window.setConversation, [
1441
+ operationID,
1442
+ params.conversationID,
1443
+ JSON.stringify({
1444
+ burnDuration: params.burnDuration,
1445
+ }),
1446
+ ]);
1447
+ };
1448
+ this.getLoginStatus = (operationID = v4()) => {
1449
+ return this._invoker('getLoginStatus', window.getLoginStatus, [operationID], data => {
1450
+ // compitable with old version sdk
1451
+ return data[0];
1452
+ });
1453
+ };
1454
+ this.setAppBackgroundStatus = (data, operationID = v4()) => {
1455
+ return this._invoker('setAppBackgroundStatus', window.setAppBackgroundStatus, [operationID, data]);
1456
+ };
1457
+ this.networkStatusChanged = (operationID = v4()) => {
1458
+ return this._invoker('networkStatusChanged ', window.networkStatusChanged, [operationID]);
1459
+ };
1460
+ this.getLoginUserID = (operationID = v4()) => {
1461
+ return this._invoker('getLoginUserID', window.getLoginUserID, [
1462
+ operationID,
1463
+ ]);
1464
+ };
1465
+ this.getSelfUserInfo = (operationID = v4()) => {
1466
+ return this._invoker('getSelfUserInfo', window.getSelfUserInfo, [operationID]);
1467
+ };
1468
+ this.getUsersInfo = (data, operationID = v4()) => {
1469
+ return this._invoker('getUsersInfo', window.getUsersInfo, [operationID, JSON.stringify(data)]);
1470
+ };
1471
+ /**
1472
+ * @deprecated Use setSelfInfo instead.
1473
+ */
1474
+ this.SetSelfInfoEx = (data, operationID = v4()) => {
1475
+ return this._invoker('SetSelfInfoEx', window.setSelfInfo, [
1476
+ operationID,
1477
+ JSON.stringify(data),
1478
+ ]);
1479
+ };
1480
+ this.setSelfInfo = (data, operationID = v4()) => {
1481
+ return this._invoker('setSelfInfo', window.setSelfInfo, [
1482
+ operationID,
1483
+ JSON.stringify(data),
1484
+ ]);
1485
+ };
1486
+ this.createTextAtMessage = (data, operationID = v4()) => {
1487
+ var _a;
1488
+ return this._invoker('createTextAtMessage', window.createTextAtMessage, [
1489
+ operationID,
1490
+ data.text,
1491
+ JSON.stringify(data.atUserIDList),
1492
+ JSON.stringify(data.atUsersInfo),
1493
+ (_a = JSON.stringify(data.message)) !== null && _a !== void 0 ? _a : '',
1494
+ ], data => {
1495
+ // compitable with old version sdk
1496
+ return data[0];
1497
+ });
1498
+ };
1499
+ this.createSoundMessageByURL = (data, operationID = v4()) => {
1500
+ return this._invoker('createSoundMessageByURL', window.createSoundMessageByURL, [operationID, JSON.stringify(data)], data => {
1501
+ // compitable with old version sdk
1502
+ return data[0];
1503
+ });
1504
+ };
1505
+ this.createSoundMessageByFile = (data, operationID = v4()) => {
1506
+ data.uuid = `${data.uuid}/${data.file.name}`;
1507
+ window.fileMapSet(data.uuid, data.file);
1508
+ return this._invoker('createSoundMessageByFile', window.createSoundMessageByURL, [operationID, JSON.stringify(data)], data => {
1509
+ // compitable with old version sdk
1510
+ return data[0];
1511
+ });
1512
+ };
1513
+ this.createVideoMessageByURL = (data, operationID = v4()) => {
1514
+ return this._invoker('createVideoMessageByURL', window.createVideoMessageByURL, [operationID, JSON.stringify(data)], data => {
1515
+ // compitable with old version sdk
1516
+ return data[0];
1517
+ });
1518
+ };
1519
+ this.createVideoMessageByFile = (data, operationID = v4()) => {
1520
+ data.videoUUID = `${data.videoUUID}/${data.videoFile.name}`;
1521
+ data.snapshotUUID = `${data.snapshotUUID}/${data.snapshotFile.name}`;
1522
+ window.fileMapSet(data.videoUUID, data.videoFile);
1523
+ window.fileMapSet(data.snapshotUUID, data.snapshotFile);
1524
+ return this._invoker('createVideoMessageByFile', window.createVideoMessageByURL, [operationID, JSON.stringify(data)], data => {
1525
+ // compitable with old version sdk
1526
+ return data[0];
1527
+ });
1528
+ };
1529
+ this.createFileMessageByURL = (data, operationID = v4()) => {
1530
+ return this._invoker('createFileMessageByURL', window.createFileMessageByURL, [operationID, JSON.stringify(data)], data => {
1531
+ // compitable with old version sdk
1532
+ return data[0];
1533
+ });
1534
+ };
1535
+ this.createFileMessageByFile = (data, operationID = v4()) => {
1536
+ data.uuid = `${data.uuid}/${data.file.name}`;
1537
+ window.fileMapSet(data.uuid, data.file);
1538
+ return this._invoker('createFileMessageByFile', window.createFileMessageByURL, [operationID, JSON.stringify(data)], data => {
1539
+ // compitable with old version sdk
1540
+ return data[0];
1541
+ });
1542
+ };
1543
+ this.createMergerMessage = (data, operationID = v4()) => {
1544
+ return this._invoker('createMergerMessage ', window.createMergerMessage, [
1545
+ operationID,
1546
+ JSON.stringify(data.messageList),
1547
+ data.title,
1548
+ JSON.stringify(data.summaryList),
1549
+ ], data => {
1550
+ // compitable with old version sdk
1551
+ return data[0];
1552
+ });
1553
+ };
1554
+ this.createForwardMessage = (data, operationID = v4()) => {
1555
+ return this._invoker('createForwardMessage ', window.createForwardMessage, [operationID, JSON.stringify(data)], data => {
1556
+ // compitable with old version sdk
1557
+ return data[0];
1558
+ });
1559
+ };
1560
+ this.createFaceMessage = (data, operationID = v4()) => {
1561
+ return this._invoker('createFaceMessage ', window.createFaceMessage, [operationID, data.index, data.data], data => {
1562
+ // compitable with old version sdk
1563
+ return data[0];
1564
+ });
1565
+ };
1566
+ this.createLocationMessage = (data, operationID = v4()) => {
1567
+ return this._invoker('createLocationMessage ', window.createLocationMessage, [operationID, data.description, data.longitude, data.latitude], data => {
1568
+ // compitable with old version sdk
1569
+ return data[0];
1570
+ });
1571
+ };
1572
+ this.createCardMessage = (data, operationID = v4()) => {
1573
+ return this._invoker('createCardMessage ', window.createCardMessage, [operationID, JSON.stringify(data)], data => {
1574
+ // compitable with old version sdk
1575
+ return data[0];
1576
+ });
1577
+ };
1578
+ this.deleteMessageFromLocalStorage = (data, operationID = v4()) => {
1579
+ return this._invoker('deleteMessageFromLocalStorage ', window.deleteMessageFromLocalStorage, [operationID, data.conversationID, data.clientMsgID]);
1580
+ };
1581
+ this.deleteMessage = (data, operationID = v4()) => {
1582
+ return this._invoker('deleteMessage ', window.deleteMessage, [
1583
+ operationID,
1584
+ data.conversationID,
1585
+ data.clientMsgID,
1586
+ ]);
1587
+ };
1588
+ this.deleteAllConversationFromLocal = (operationID = v4()) => {
1589
+ return this._invoker('deleteAllConversationFromLocal ', window.deleteAllConversationFromLocal, [operationID]);
1590
+ };
1591
+ this.deleteAllMsgFromLocal = (operationID = v4()) => {
1592
+ return this._invoker('deleteAllMsgFromLocal ', window.deleteAllMsgFromLocal, [operationID]);
1593
+ };
1594
+ this.deleteAllMsgFromLocalAndSvr = (operationID = v4()) => {
1595
+ return this._invoker('deleteAllMsgFromLocalAndSvr ', window.deleteAllMsgFromLocalAndSvr, [operationID]);
1596
+ };
1597
+ this.insertSingleMessageToLocalStorage = (data, operationID = v4()) => {
1598
+ return this._invoker('insertSingleMessageToLocalStorage ', window.insertSingleMessageToLocalStorage, [operationID, JSON.stringify(data.message), data.recvID, data.sendID]);
1599
+ };
1600
+ this.insertGroupMessageToLocalStorage = (data, operationID = v4()) => {
1601
+ return this._invoker('insertGroupMessageToLocalStorage ', window.insertGroupMessageToLocalStorage, [operationID, JSON.stringify(data.message), data.groupID, data.sendID]);
1602
+ };
1603
+ /**
1604
+ * @deprecated Use changeInputStates instead.
1605
+ */
1606
+ this.typingStatusUpdate = (data, operationID = v4()) => {
1607
+ return this._invoker('typingStatusUpdate ', window.typingStatusUpdate, [
1608
+ operationID,
1609
+ data.recvID,
1610
+ data.msgTip,
1611
+ ]);
1612
+ };
1613
+ this.changeInputStates = (data, operationID = v4()) => {
1614
+ return this._invoker('changeInputStates ', window.changeInputStates, [
1615
+ operationID,
1616
+ data.conversationID,
1617
+ data.focus,
1618
+ ]);
1619
+ };
1620
+ this.getInputstates = (data, operationID = v4()) => {
1621
+ return this._invoker('getInputstates ', window.getInputstates, [
1622
+ operationID,
1623
+ data.conversationID,
1624
+ data.userID,
1625
+ ]);
1626
+ };
1627
+ this.clearConversationAndDeleteAllMsg = (data, operationID = v4()) => {
1628
+ return this._invoker('clearConversationAndDeleteAllMsg ', window.clearConversationAndDeleteAllMsg, [operationID, data]);
1629
+ };
1630
+ this.hideConversation = (data, operationID = v4()) => {
1631
+ return this._invoker('hideConversation ', window.hideConversation, [
1632
+ operationID,
1633
+ data,
1634
+ ]);
1635
+ };
1636
+ this.getConversationListSplit = (data, operationID = v4()) => {
1637
+ return this._invoker('getConversationListSplit ', window.getConversationListSplit, [operationID, data.offset, data.count]);
1638
+ };
1639
+ // searchConversation = (data: SplitConversationParams, operationID = uuidv4()) => {
1640
+ // return this._invoker<ConversationItem[]>(
1641
+ // 'searchConversation ',
1642
+ // window.searchConversation,
1643
+ // [operationID, data.offset, data.count]
1644
+ // );
1645
+ // };
1646
+ /**
1647
+ * @deprecated Use setConversation instead.
1648
+ */
1649
+ this.setConversationEx = (data, operationID = v4()) => {
1650
+ return this._invoker('setConversationEx ', window.setConversation, [
1651
+ operationID,
1652
+ data.conversationID,
1653
+ JSON.stringify({
1654
+ ex: data.ex,
1655
+ }),
1656
+ ]);
1657
+ };
1658
+ this.getConversationIDBySessionType = (data, operationID = v4()) => {
1659
+ return this._invoker('getConversationIDBySessionType ', window.getConversationIDBySessionType, [operationID, data.sourceID, data.sessionType]);
1660
+ };
1661
+ this.getMultipleConversation = (data, operationID = v4()) => {
1662
+ return this._invoker('getMultipleConversation ', window.getMultipleConversation, [operationID, JSON.stringify(data)]);
1663
+ };
1664
+ this.deleteConversation = (data, operationID = v4()) => {
1665
+ return this._invoker('deleteConversation ', window.deleteConversation, [
1666
+ operationID,
1667
+ data,
1668
+ ]);
1669
+ };
1670
+ /**
1671
+ * @deprecated Use setConversation instead.
1672
+ */
1673
+ this.setConversationDraft = (data, operationID = v4()) => {
1674
+ return this._invoker('setConversationDraft ', window.setConversationDraft, [operationID, data.conversationID, data.draftText]);
1675
+ };
1676
+ /**
1677
+ * @deprecated Use setConversation instead.
1678
+ */
1679
+ this.pinConversation = (data, operationID = v4()) => {
1680
+ return this._invoker('pinConversation ', window.setConversation, [
1681
+ operationID,
1682
+ data.conversationID,
1683
+ JSON.stringify({
1684
+ isPinned: data.isPinned,
1685
+ }),
1686
+ ]);
1687
+ };
1688
+ this.getTotalUnreadMsgCount = (operationID = v4()) => {
1689
+ return this._invoker('getTotalUnreadMsgCount ', window.getTotalUnreadMsgCount, [operationID]);
1690
+ };
1691
+ this.getConversationRecvMessageOpt = (data, operationID = v4()) => {
1692
+ return this._invoker('getConversationRecvMessageOpt ', window.getConversationRecvMessageOpt, [operationID, JSON.stringify(data)]);
1693
+ };
1694
+ /**
1695
+ * @deprecated Use setConversation instead.
1696
+ */
1697
+ this.setConversationRecvMessageOpt = (data, operationID = v4()) => {
1698
+ return this._invoker('setConversationRecvMessageOpt ', window.setConversation, [
1699
+ operationID,
1700
+ data.conversationID,
1701
+ JSON.stringify({
1702
+ recvMsgOpt: data.opt,
1703
+ }),
1704
+ ]);
1705
+ };
1706
+ this.searchLocalMessages = (data, operationID = v4()) => {
1707
+ return this._invoker('searchLocalMessages ', window.searchLocalMessages, [operationID, JSON.stringify(data)]);
1708
+ };
1709
+ this.addFriend = (data, operationID = v4()) => {
1710
+ return this._invoker('addFriend ', window.addFriend, [
1711
+ operationID,
1712
+ JSON.stringify(data),
1713
+ ]);
1714
+ };
1715
+ this.searchFriends = (data, operationID = v4()) => {
1716
+ return this._invoker('searchFriends ', window.searchFriends, [operationID, JSON.stringify(data)]);
1717
+ };
1718
+ this.getSpecifiedFriendsInfo = (data, operationID = v4()) => {
1719
+ return this._invoker('getSpecifiedFriendsInfo', window.getSpecifiedFriendsInfo, [operationID, JSON.stringify(data.friendUserIDList), data.filterBlack]);
1720
+ };
1721
+ this.getFriendApplicationListAsRecipient = (operationID = v4()) => {
1722
+ return this._invoker('getFriendApplicationListAsRecipient ', window.getFriendApplicationListAsRecipient, [operationID]);
1723
+ };
1724
+ this.getFriendApplicationListAsApplicant = (operationID = v4()) => {
1725
+ return this._invoker('getFriendApplicationListAsApplicant ', window.getFriendApplicationListAsApplicant, [operationID]);
1726
+ };
1727
+ this.getFriendList = (filterBlack = false, operationID = v4()) => {
1728
+ return this._invoker('getFriendList ', window.getFriendList, [operationID, filterBlack]);
1729
+ };
1730
+ this.getFriendListPage = (data, operationID = v4()) => {
1731
+ var _a;
1732
+ return this._invoker('getFriendListPage ', window.getFriendListPage, [operationID, data.offset, data.count, (_a = data.filterBlack) !== null && _a !== void 0 ? _a : false]);
1733
+ };
1734
+ this.updateFriends = (data, operationID = v4()) => {
1735
+ return this._invoker('updateFriends ', window.updateFriends, [
1736
+ operationID,
1737
+ JSON.stringify(data),
1738
+ ]);
1739
+ };
1740
+ /**
1741
+ * @deprecated Use updateFriends instead.
1742
+ */
1743
+ this.setFriendRemark = (data, operationID = v4()) => {
1744
+ return this._invoker('setFriendRemark ', window.updateFriends, [
1745
+ operationID,
1746
+ JSON.stringify({
1747
+ friendUserIDs: [data.toUserID],
1748
+ remark: data.remark,
1749
+ }),
1750
+ ]);
1751
+ };
1752
+ /**
1753
+ * @deprecated Use updateFriends instead.
1754
+ */
1755
+ this.pinFriends = (data, operationID = v4()) => {
1756
+ return this._invoker('pinFriends ', window.updateFriends, [
1757
+ operationID,
1758
+ JSON.stringify({
1759
+ friendUserIDs: data.toUserIDs,
1760
+ isPinned: data.isPinned,
1761
+ }),
1762
+ ]);
1763
+ };
1764
+ /**
1765
+ * @deprecated Use updateFriends instead.
1766
+ */
1767
+ this.setFriendsEx = (data, operationID = v4()) => {
1768
+ return this._invoker('setFriendsEx ', window.updateFriends, [
1769
+ operationID,
1770
+ JSON.stringify({
1771
+ friendUserIDs: data.toUserIDs,
1772
+ ex: data.ex,
1773
+ }),
1774
+ data.ex,
1775
+ ]);
1776
+ };
1777
+ this.checkFriend = (data, operationID = v4()) => {
1778
+ return this._invoker('checkFriend', window.checkFriend, [
1779
+ operationID,
1780
+ JSON.stringify(data),
1781
+ ]);
1782
+ };
1783
+ this.acceptFriendApplication = (data, operationID = v4()) => {
1784
+ return this._invoker('acceptFriendApplication', window.acceptFriendApplication, [operationID, JSON.stringify(data)]);
1785
+ };
1786
+ this.refuseFriendApplication = (data, operationID = v4()) => {
1787
+ return this._invoker('refuseFriendApplication ', window.refuseFriendApplication, [operationID, JSON.stringify(data)]);
1788
+ };
1789
+ this.deleteFriend = (data, operationID = v4()) => {
1790
+ return this._invoker('deleteFriend ', window.deleteFriend, [
1791
+ operationID,
1792
+ data,
1793
+ ]);
1794
+ };
1795
+ this.addBlack = (data, operationID = v4()) => {
1796
+ var _a;
1797
+ return this._invoker('addBlack ', window.addBlack, [
1798
+ operationID,
1799
+ data.toUserID,
1800
+ (_a = data.ex) !== null && _a !== void 0 ? _a : '',
1801
+ ]);
1802
+ };
1803
+ this.removeBlack = (data, operationID = v4()) => {
1804
+ return this._invoker('removeBlack ', window.removeBlack, [
1805
+ operationID,
1806
+ data,
1807
+ ]);
1808
+ };
1809
+ this.getBlackList = (operationID = v4()) => {
1810
+ return this._invoker('getBlackList ', window.getBlackList, [operationID]);
1811
+ };
1812
+ this.inviteUserToGroup = (data, operationID = v4()) => {
1813
+ return this._invoker('inviteUserToGroup ', window.inviteUserToGroup, [
1814
+ operationID,
1815
+ data.groupID,
1816
+ data.reason,
1817
+ JSON.stringify(data.userIDList),
1818
+ ]);
1819
+ };
1820
+ this.kickGroupMember = (data, operationID = v4()) => {
1821
+ return this._invoker('kickGroupMember ', window.kickGroupMember, [
1822
+ operationID,
1823
+ data.groupID,
1824
+ data.reason,
1825
+ JSON.stringify(data.userIDList),
1826
+ ]);
1827
+ };
1828
+ this.isJoinGroup = (data, operationID = v4()) => {
1829
+ return this._invoker('isJoinGroup ', window.isJoinGroup, [
1830
+ operationID,
1831
+ data,
1832
+ ]);
1833
+ };
1834
+ this.getSpecifiedGroupMembersInfo = (data, operationID = v4()) => {
1835
+ return this._invoker('getSpecifiedGroupMembersInfo ', window.getSpecifiedGroupMembersInfo, [operationID, data.groupID, JSON.stringify(data.userIDList)]);
1836
+ };
1837
+ this.getUsersInGroup = (data, operationID = v4()) => {
1838
+ return this._invoker('getUsersInGroup ', window.getUsersInGroup, [
1839
+ operationID,
1840
+ data.groupID,
1841
+ JSON.stringify(data.userIDList),
1842
+ ]);
1843
+ };
1844
+ this.getGroupMemberListByJoinTimeFilter = (data, operationID = v4()) => {
1845
+ return this._invoker('getGroupMemberListByJoinTimeFilter ', window.getGroupMemberListByJoinTimeFilter, [
1846
+ operationID,
1847
+ data.groupID,
1848
+ data.offset,
1849
+ data.count,
1850
+ data.joinTimeBegin,
1851
+ data.joinTimeEnd,
1852
+ JSON.stringify(data.filterUserIDList),
1853
+ ]);
1854
+ };
1855
+ this.searchGroupMembers = (data, operationID = v4()) => {
1856
+ return this._invoker('searchGroupMembers ', window.searchGroupMembers, [operationID, JSON.stringify(data)]);
1857
+ };
1858
+ /**
1859
+ * @deprecated Use setGroupInfo instead.
1860
+ */
1861
+ this.setGroupApplyMemberFriend = (data, operationID = v4()) => {
1862
+ return this._invoker('setGroupApplyMemberFriend ', window.setGroupInfo, [
1863
+ operationID,
1864
+ JSON.stringify({
1865
+ groupID: data.groupID,
1866
+ applyMemberFriend: data.rule,
1867
+ }),
1868
+ ]);
1869
+ };
1870
+ /**
1871
+ * @deprecated Use setGroupInfo instead.
1872
+ */
1873
+ this.setGroupLookMemberInfo = (data, operationID = v4()) => {
1874
+ return this._invoker('setGroupLookMemberInfo ', window.setGroupInfo, [
1875
+ operationID,
1876
+ JSON.stringify({
1877
+ groupID: data.groupID,
1878
+ lookMemberInfo: data.rule,
1879
+ }),
1880
+ ]);
1881
+ };
1882
+ this.getJoinedGroupList = (operationID = v4()) => {
1883
+ return this._invoker('getJoinedGroupList ', window.getJoinedGroupList, [operationID]);
1884
+ };
1885
+ this.getJoinedGroupListPage = (data, operationID = v4()) => {
1886
+ return this._invoker('getJoinedGroupListPage ', window.getJoinedGroupListPage, [operationID, data.offset, data.count]);
1887
+ };
1888
+ this.createGroup = (data, operationID = v4()) => {
1889
+ return this._invoker('createGroup ', window.createGroup, [
1890
+ operationID,
1891
+ JSON.stringify(data),
1892
+ ]);
1893
+ };
1894
+ this.setGroupInfo = (data, operationID = v4()) => {
1895
+ return this._invoker('setGroupInfo ', window.setGroupInfo, [
1896
+ operationID,
1897
+ JSON.stringify(data),
1898
+ ]);
1899
+ };
1900
+ /**
1901
+ * @deprecated Use setGroupMemberInfo instead.
1902
+ */
1903
+ this.setGroupMemberNickname = (data, operationID = v4()) => {
1904
+ return this._invoker('setGroupMemberNickname ', window.setGroupMemberInfo, [
1905
+ operationID,
1906
+ JSON.stringify({
1907
+ groupID: data.groupID,
1908
+ userID: data.userID,
1909
+ nickname: data.groupMemberNickname,
1910
+ }),
1911
+ ]);
1912
+ };
1913
+ this.setGroupMemberInfo = (data, operationID = v4()) => {
1914
+ return this._invoker('setGroupMemberInfo ', window.setGroupMemberInfo, [
1915
+ operationID,
1916
+ JSON.stringify(data),
1917
+ ]);
1918
+ };
1919
+ this.joinGroup = (data, operationID = v4()) => {
1920
+ var _a;
1921
+ return this._invoker('joinGroup ', window.joinGroup, [
1922
+ operationID,
1923
+ data.groupID,
1924
+ data.reqMsg,
1925
+ data.joinSource,
1926
+ (_a = data.ex) !== null && _a !== void 0 ? _a : '',
1927
+ ]);
1928
+ };
1929
+ this.searchGroups = (data, operationID = v4()) => {
1930
+ return this._invoker('searchGroups ', window.searchGroups, [
1931
+ operationID,
1932
+ JSON.stringify(data),
1933
+ ]);
1934
+ };
1935
+ this.quitGroup = (data, operationID = v4()) => {
1936
+ return this._invoker('quitGroup ', window.quitGroup, [
1937
+ operationID,
1938
+ data,
1939
+ ]);
1940
+ };
1941
+ this.dismissGroup = (data, operationID = v4()) => {
1942
+ return this._invoker('dismissGroup ', window.dismissGroup, [
1943
+ operationID,
1944
+ data,
1945
+ ]);
1946
+ };
1947
+ this.changeGroupMute = (data, operationID = v4()) => {
1948
+ return this._invoker('changeGroupMute ', window.changeGroupMute, [
1949
+ operationID,
1950
+ data.groupID,
1951
+ data.isMute,
1952
+ ]);
1953
+ };
1954
+ this.changeGroupMemberMute = (data, operationID = v4()) => {
1955
+ return this._invoker('changeGroupMemberMute ', window.changeGroupMemberMute, [operationID, data.groupID, data.userID, data.mutedSeconds]);
1956
+ };
1957
+ this.transferGroupOwner = (data, operationID = v4()) => {
1958
+ return this._invoker('transferGroupOwner ', window.transferGroupOwner, [
1959
+ operationID,
1960
+ data.groupID,
1961
+ data.newOwnerUserID,
1962
+ ]);
1963
+ };
1964
+ this.getGroupApplicationListAsApplicant = (operationID = v4()) => {
1965
+ return this._invoker('getGroupApplicationListAsApplicant ', window.getGroupApplicationListAsApplicant, [operationID]);
1966
+ };
1967
+ this.getGroupApplicationListAsRecipient = (operationID = v4()) => {
1968
+ return this._invoker('getGroupApplicationListAsRecipient ', window.getGroupApplicationListAsRecipient, [operationID]);
1969
+ };
1970
+ this.acceptGroupApplication = (data, operationID = v4()) => {
1971
+ return this._invoker('acceptGroupApplication ', window.acceptGroupApplication, [operationID, data.groupID, data.fromUserID, data.handleMsg]);
1972
+ };
1973
+ this.refuseGroupApplication = (data, operationID = v4()) => {
1974
+ return this._invoker('refuseGroupApplication ', window.refuseGroupApplication, [operationID, data.groupID, data.fromUserID, data.handleMsg]);
1975
+ };
1976
+ /**
1977
+ * @deprecated Use setConversation instead.
1978
+ */
1979
+ this.resetConversationGroupAtType = (data, operationID = v4()) => {
1980
+ return this._invoker('resetConversationGroupAtType ', window.setConversation, [
1981
+ operationID,
1982
+ data,
1983
+ JSON.stringify({
1984
+ groupAtType: exports.GroupAtType.AtNormal,
1985
+ }),
1986
+ ]);
1987
+ };
1988
+ /**
1989
+ * @deprecated Use setGroupMemberInfo instead.
1990
+ */
1991
+ this.setGroupMemberRoleLevel = (data, operationID = v4()) => {
1992
+ return this._invoker('setGroupMemberRoleLevel ', window.setGroupMemberInfo, [
1993
+ operationID,
1994
+ JSON.stringify({
1995
+ groupID: data.groupID,
1996
+ userID: data.userID,
1997
+ roleLevel: data.roleLevel,
1998
+ }),
1999
+ ]);
2000
+ };
2001
+ /**
2002
+ * @deprecated Use setGroupInfo instead.
2003
+ */
2004
+ this.setGroupVerification = (data, operationID = v4()) => {
2005
+ return this._invoker('setGroupVerification ', window.setGroupInfo, [
2006
+ operationID,
2007
+ JSON.stringify({
2008
+ groupID: data.groupID,
2009
+ needVerification: data.verification,
2010
+ }),
2011
+ ]);
2012
+ };
2013
+ this.getGroupMemberOwnerAndAdmin = (data, operationID = v4()) => {
2014
+ return this._invoker('getGroupMemberOwnerAndAdmin ', window.getGroupMemberOwnerAndAdmin, [operationID, data]);
2015
+ };
2016
+ /**
2017
+ * @deprecated Use setSelfInfo instead.
2018
+ */
2019
+ this.setGlobalRecvMessageOpt = (opt, operationID = v4()) => {
2020
+ return this._invoker('setGlobalRecvMessageOpt ', window.setSelfInfo, [
2021
+ operationID,
2022
+ JSON.stringify({ globalRecvMsgOpt: opt }),
2023
+ ]);
2024
+ };
2025
+ this.findMessageList = (data, operationID = v4()) => {
2026
+ return this._invoker('findMessageList ', window.findMessageList, [operationID, JSON.stringify(data)]);
2027
+ };
2028
+ this.uploadFile = (data, operationID = v4()) => {
2029
+ var _a;
2030
+ data.uuid = `${data.uuid}/${(_a = data.file) === null || _a === void 0 ? void 0 : _a.name}`;
2031
+ window.fileMapSet(data.uuid, data.file);
2032
+ return this._invoker('uploadFile ', window.uploadFile, [
2033
+ operationID,
2034
+ JSON.stringify({
2035
+ ...data,
2036
+ filepath: '',
2037
+ cause: '',
2038
+ }),
2039
+ ]);
2040
+ };
2041
+ this.subscribeUsersStatus = (data, operationID = v4()) => {
2042
+ return this._invoker('subscribeUsersStatus ', window.subscribeUsersStatus, [operationID, JSON.stringify(data)]);
2043
+ };
2044
+ this.unsubscribeUsersStatus = (data, operationID = v4()) => {
2045
+ return this._invoker('unsubscribeUsersStatus ', window.unsubscribeUsersStatus, [operationID, JSON.stringify(data)]);
2046
+ };
2047
+ this.getUserStatus = (operationID = v4()) => {
2048
+ return this._invoker('getUserStatus ', window.getUserStatus, [operationID]);
2049
+ };
2050
+ this.getSubscribeUsersStatus = (operationID = v4()) => {
2051
+ return this._invoker('getSubscribeUsersStatus ', window.getSubscribeUsersStatus, [operationID]);
2052
+ };
2053
+ this.signalingInvite = (data, operationID = v4()) => {
2054
+ return this._invoker('signalingInvite ', window.signalingInvite, [operationID, JSON.stringify(data)]);
2055
+ };
2056
+ this.signalingInviteInGroup = (data, operationID = v4()) => {
2057
+ return this._invoker('signalingInviteInGroup ', window.signalingInviteInGroup, [operationID, JSON.stringify(data)]);
2058
+ };
2059
+ this.signalingAccept = (data, operationID = v4()) => {
2060
+ return this._invoker('signalingAccept ', window.signalingAccept, [operationID, JSON.stringify(data)]);
2061
+ };
2062
+ this.signalingReject = (data, operationID = v4()) => {
2063
+ return this._invoker('signalingReject ', window.signalingReject, [
2064
+ operationID,
2065
+ JSON.stringify(data),
2066
+ ]);
2067
+ };
2068
+ this.signalingCancel = (data, operationID = v4()) => {
2069
+ return this._invoker('signalingCancel ', window.signalingCancel, [
2070
+ operationID,
2071
+ JSON.stringify(data),
2072
+ ]);
2073
+ };
2074
+ this.signalingHungUp = (data, operationID = v4()) => {
2075
+ return this._invoker('signalingHungUp ', window.signalingHungUp, [
2076
+ operationID,
2077
+ JSON.stringify(data),
2078
+ ]);
2079
+ };
2080
+ this.signalingGetRoomByGroupID = (groupID, operationID = v4()) => {
2081
+ return this._invoker('signalingGetRoomByGroupID ', window.signalingGetRoomByGroupID, [operationID, groupID]);
2082
+ };
2083
+ this.signalingGetTokenByRoomID = (roomID, operationID = v4()) => {
2084
+ return this._invoker('signalingGetTokenByRoomID ', window.signalingGetTokenByRoomID, [operationID, roomID]);
2085
+ };
2086
+ this.getSignalingInvitationInfoStartApp = (operationID = v4()) => {
2087
+ return this._invoker('getSignalingInvitationInfoStartApp ', window.getSignalingInvitationInfoStartApp, [operationID]);
2088
+ };
2089
+ this.signalingSendCustomSignal = (data, operationID = v4()) => {
2090
+ return this._invoker('signalingSendCustomSignal ', window.signalingSendCustomSignal, [operationID, data.customInfo, data.roomID]);
2091
+ };
2092
+ this.setConversationIsMsgDestruct = (data, operationID = v4()) => {
2093
+ return this._invoker('setConversationIsMsgDestruct ', window.setConversation, [
2094
+ operationID,
2095
+ data.conversationID,
2096
+ JSON.stringify({ isMsgDestruct: data.isMsgDestruct }),
2097
+ ]);
2098
+ };
2099
+ this.setConversationMsgDestructTime = (data, operationID = v4()) => {
2100
+ return this._invoker('setConversationMsgDestructTime ', window.setConversation, [
2101
+ operationID,
2102
+ data.conversationID,
2103
+ JSON.stringify({
2104
+ msgDestructTime: data.msgDestructTime,
2105
+ }),
2106
+ ]);
2107
+ };
2108
+ this.fileMapSet = (uuid, file) => window.fileMapSet(uuid, file);
2109
+ // Reset any previous state before initializing
2110
+ reset();
2111
+ initDatabaseAPI(debug);
2112
+ this.isLogStandardOutput = debug;
2113
+ this.isInitialized = false; // Reset initialization flag
2114
+ this.wasmInitializedPromise = initializeWasm(url);
2115
+ this.goExitPromise = getGoExitPromise();
2116
+ if (this.goExitPromise) {
2117
+ this.goExitPromise
2118
+ .then(() => {
2119
+ this._logWrap('SDK => wasm exist');
2120
+ })
2121
+ .catch(err => {
2122
+ this._logWrap('SDK => wasm with error ', err);
2123
+ })
2124
+ .finally(() => {
2125
+ this.goExisted = true;
2126
+ this.isInitialized = false; // Reset when WASM exits
2127
+ });
2128
+ }
2129
+ }
2130
+ _logWrap(...args) {
2131
+ if (this.isLogStandardOutput) {
2132
+ console.info(...args);
2133
+ }
2134
+ }
2135
+ _invoker(functionName, func, args, processor) {
2136
+ return new Promise(async (resolve, reject) => {
2137
+ this._logWrap(`%cSDK =>%c [OperationID:${args[0]}] (invoked by js) run ${functionName} with args ${JSON.stringify(args)}`, 'font-size:14px; background:#7CAEFF; border-radius:4px; padding-inline:4px;', '');
2138
+ let response = {
2139
+ operationID: args[0],
2140
+ event: (functionName.slice(0, 1).toUpperCase() +
2141
+ functionName.slice(1).toLowerCase()),
2142
+ };
2143
+ try {
2144
+ if (!getGO() || getGO().exited || this.goExisted) {
2145
+ throw 'wasm exist already, fail to run';
2146
+ }
2147
+ let data = await func(...args);
2148
+ if (processor) {
2149
+ this._logWrap(`%cSDK =>%c [OperationID:${args[0]}] (invoked by js) run ${functionName} with response before processor ${JSON.stringify(data)}`, logBoxStyleValue('#FFDC19'), '');
2150
+ data = processor(data);
2151
+ }
2152
+ if (this.tryParse) {
2153
+ try {
2154
+ data = JSON.parse(data);
2155
+ }
2156
+ catch (error) {
2157
+ // parse error
2158
+ }
2159
+ }
2160
+ response.data = data;
2161
+ resolve(response);
2162
+ }
2163
+ catch (error) {
2164
+ this._logWrap(`%cSDK =>%c [OperationID:${args[0]}] (invoked by js) run ${functionName} with error ${JSON.stringify(error)}`, logBoxStyleValue('#EE4245'), '');
2165
+ response = {
2166
+ ...response,
2167
+ ...error,
2168
+ };
2169
+ reject(response);
2170
+ }
2171
+ });
2172
+ }
2173
+ exportDB(operationID = v4()) {
2174
+ return this._invoker('exportDB', window.exportDB, [operationID]);
2175
+ }
2176
+ }
2177
+ let instance;
2178
+ function getSDK(config) {
2179
+ const { sqlWasmPath, coreWasmPath = '/openIM.wasm', debug = true, } = config || {};
2180
+ if (typeof window === 'undefined') {
2181
+ return {};
2182
+ }
2183
+ if (instance) {
2184
+ return instance;
2185
+ }
2186
+ instance = new SDK(coreWasmPath, debug);
2187
+ if (sqlWasmPath) {
2188
+ window.setSqlWasmPath(sqlWasmPath);
2189
+ }
2190
+ return instance;
2191
+ }
2192
+
2193
+ function decodeBase64(base64, enableUnicode) {
2194
+ var binaryString = atob(base64);
2195
+ if (enableUnicode) {
2196
+ var binaryView = new Uint8Array(binaryString.length);
2197
+ for (var i = 0, n = binaryString.length; i < n; ++i) {
2198
+ binaryView[i] = binaryString.charCodeAt(i);
2199
+ }
2200
+ return String.fromCharCode.apply(null, new Uint16Array(binaryView.buffer));
2201
+ }
2202
+ return binaryString;
2203
+ }
2204
+
2205
+ function createURL(base64, sourcemapArg, enableUnicodeArg) {
2206
+ var sourcemap = sourcemapArg === undefined ? null : sourcemapArg;
2207
+ var enableUnicode = enableUnicodeArg === undefined ? false : enableUnicodeArg;
2208
+ var source = decodeBase64(base64, enableUnicode);
2209
+ var start = source.indexOf('\n', 10) + 1;
2210
+ var body = source.substring(start) + (sourcemap ? '\/\/# sourceMappingURL=' + sourcemap : '');
2211
+ var blob = new Blob([body], { type: 'application/javascript' });
2212
+ return URL.createObjectURL(blob);
2213
+ }
2214
+
2215
+ function createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg) {
2216
+ var url;
2217
+ return function WorkerFactory(options) {
2218
+ url = url || createURL(base64, sourcemapArg, enableUnicodeArg);
2219
+ return new Worker(url, options);
2220
+ };
2221
+ }
2222
+
2223
+ var WorkerFactory = createBase64WorkerFactory('Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7bGV0IHQ9MzczNTkyODU1OTtjbGFzcyBle2NvbnN0cnVjdG9yKHQse2luaXRpYWxPZmZzZXQ6ZT00LHVzZUF0b21pY3M6aT0hMCxzdHJlYW06cz0hMCxkZWJ1ZzpyLG5hbWU6bn09e30pe3RoaXMuYnVmZmVyPXQsdGhpcy5hdG9taWNWaWV3PW5ldyBJbnQzMkFycmF5KHQpLHRoaXMub2Zmc2V0PWUsdGhpcy51c2VBdG9taWNzPWksdGhpcy5zdHJlYW09cyx0aGlzLmRlYnVnPXIsdGhpcy5uYW1lPW59bG9nKC4uLnQpe3RoaXMuZGVidWcmJmNvbnNvbGUubG9nKGBbcmVhZGVyOiAke3RoaXMubmFtZX1dYCwuLi50KX13YWl0V3JpdGUodCxlPW51bGwpe2lmKHRoaXMudXNlQXRvbWljcyl7Zm9yKHRoaXMubG9nKGB3YWl0aW5nIGZvciAke3R9YCk7MD09PUF0b21pY3MubG9hZCh0aGlzLmF0b21pY1ZpZXcsMCk7KXtpZihudWxsIT1lJiYidGltZWQtb3V0Ij09PUF0b21pY3Mud2FpdCh0aGlzLmF0b21pY1ZpZXcsMCwwLGUpKXRocm93IG5ldyBFcnJvcigidGltZW91dCIpO0F0b21pY3Mud2FpdCh0aGlzLmF0b21pY1ZpZXcsMCwwLDUwMCl9dGhpcy5sb2coYHJlc3VtZWQgZm9yICR7dH1gKX1lbHNlIGlmKDEhPT10aGlzLmF0b21pY1ZpZXdbMF0pdGhyb3cgb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Gk9PT1vLGBVcGdyYWRpbmcgbG9jayB0eXBlIHRvICR7aX0gaXMgaW52YWxpZGApO2xldCBlPWF3YWl0IHMudXBncmFkZUV4Y2x1c2l2ZSgpO3QuaW50MzIoZT8wOi0xKSx0LmZpbmFsaXplKCl9ZWxzZSBoKHMubG9ja1R5cGU9PT1pLGBEb3duZ3JhZGluZyBsb2NrIHRvICR7aX0gaXMgaW52YWxpZGApLHQuaW50MzIoMCksdC5maW5hbGl6ZSgpO2Vsc2V7aChpPT09cixgTmV3IGxvY2tzIG11c3Qgc3RhcnQgYXMgU0hBUkVEIGluc3RlYWQgb2YgJHtpfWApO2xldCBzPW5ldyBmKGF3YWl0IHUoZSkpO2F3YWl0IHMucHJlZmV0Y2hGaXJzdEJsb2NrKDUwMCksYy5zZXQoZSxzKSx0LmludDMyKDApLHQuZmluYWxpemUoKX19KGUsaSxzKSxnKHQsZSk7YnJlYWt9Y2FzZSJ1bmxvY2tGaWxlIjp7bGV0IGk9dC5zdHJpbmcoKSxzPXQuaW50MzIoKTt0LmRvbmUoKSxhd2FpdCBkKGUsaSxzKSxnKHQsZSk7YnJlYWt9ZGVmYXVsdDp0aHJvdyBuZXcgRXJyb3IoIlVua25vd24gbWV0aG9kOiAiK2kpfX1zZWxmLm9ubWVzc2FnZT10PT57c3dpdGNoKHQuZGF0YS50eXBlKXtjYXNlImluaXQiOntsZXRbcyxyXT10LmRhdGEuYnVmZmVycztnKG5ldyBlKHMse25hbWU6ImFyZ3MiLGRlYnVnOiExfSksbmV3IGkocix7bmFtZToicmVzdWx0cyIsZGVidWc6ITF9KSk7YnJlYWt9fX19KCk7Cgo=', null, false);
2224
+
2225
+ var indexeddbMainThreadWorkerB24e7a21 = /*#__PURE__*/Object.freeze({
2226
+ __proto__: null,
2227
+ 'default': WorkerFactory
2228
+ });
2229
+
2230
+ exports.getSDK = getSDK;