@easemob-community/uikit-sdk-websdk5 1.6.0 → 1.6.2

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.
@@ -1,7 +1,7 @@
1
- import { ChatClient as it, isSDKError as Ve, ChatManager as je, ChatRoomManager as at, UserInfoManager as qe, ContactManager as ct, GroupManager as ut, PresenceManager as dt, PushManager as lt } from "easemob-websdk";
2
- import { log as we, customEventPreviewMap as gt, mergeMessagePreviewLabels as We, MESSAGE_TYPE as b, resolveMultiBodyPreview as Je, isTextBody as mt, isImageBody as ft, MESSAGE_EXT_KEY as $e, isVoiceBody as Qe, isVideoBody as pt, isFileBody as ht, isLocationBody as vt, isCustomBody as It, isCmdBody as Mt, isCombineBody as ze, CONVERSATION_TYPE as I, normalizeUserId as E, MESSAGE_STATUS as O, isMultiBody as yt, createLogger as T, toMessageRecord as Ce, formatConversationPreview as Ye, GROUP_MEMBER_ROLE as k, PRESENCE_STATUS as X, isKickErrorCode as bt, resolveLastMessageText as wt, isStreamActive as Ct, toConversationRecord as De, NOTICE_EVENT_TYPE as A, SDK_CONTRACT_VERSION as St, normalizeLoginUserId as At } from "@easemob-community/uikit-sdk-contract";
1
+ import { ChatClient as it, isSDKError as Ve, ChatManager as qe, ChatRoomManager as at, UserInfoManager as We, ContactManager as ct, GroupManager as ut, PresenceManager as dt, PushManager as lt } from "easemob-websdk";
2
+ import { log as Ce, GROUP_MEMBER_ROLE as L, customEventPreviewMap as gt, mergeMessagePreviewLabels as Je, MESSAGE_TYPE as C, resolveMultiBodyPreview as $e, isTextBody as ft, isImageBody as mt, MESSAGE_EXT_KEY as Qe, isVoiceBody as ze, isVideoBody as pt, isFileBody as ht, isLocationBody as vt, isCustomBody as It, isCmdBody as Mt, isCombineBody as Ye, CONVERSATION_TYPE as M, normalizeUserId as E, MESSAGE_STATUS as O, isMultiBody as yt, createLogger as T, toMessageRecord as we, formatConversationPreview as Xe, PRESENCE_STATUS as X, isKickErrorCode as bt, resolveLastMessageText as Ct, isStreamActive as wt, toConversationRecord as _e, NOTICE_EVENT_TYPE as A, SDK_CONTRACT_VERSION as St, normalizeLoginUserId as At } from "@easemob-community/uikit-sdk-contract";
3
3
  import { normalizeUserId as rs } from "@easemob-community/uikit-sdk-contract";
4
- import { markRaw as _e, computed as fe, reactive as Gt } from "vue";
4
+ import { markRaw as Ne, computed as me, reactive as Gt } from "vue";
5
5
  let ce = null;
6
6
  function qn(s) {
7
7
  ce = s;
@@ -9,25 +9,25 @@ function qn(s) {
9
9
  function Et(s) {
10
10
  ce == null || ce(s);
11
11
  }
12
- const Xe = "uikit-sdk-log-capture", Tt = /^%c\[Chat\]\[(DEBUG|WARN|ERROR)\]\[[^\]]*\]/, Ze = {
12
+ const Ze = "uikit-sdk-log-capture", Tt = /^%c\[Chat\]\[(DEBUG|WARN|ERROR)\]\[[^\]]*\]/, et = {
13
13
  DEBUG: "debug",
14
14
  WARN: "warn",
15
15
  ERROR: "error"
16
16
  };
17
- let Q = !1, K = null, j = null, ue = null, Se = !1, H = null, de = null;
17
+ let Q = !1, K = null, V = null, ue = null, Se = !1, H = null, de = null;
18
18
  function Rt(s) {
19
19
  de = s;
20
20
  }
21
21
  function ee(s, e, t) {
22
22
  Q && Et({
23
- level: Ze[s],
23
+ level: et[s],
24
24
  source: "sdk",
25
25
  message: typeof e == "string" ? e : String(e),
26
26
  args: t
27
27
  });
28
28
  }
29
29
  function pe(s, e, t) {
30
- const n = j ?? console.log, o = (/* @__PURE__ */ new Date()).toISOString().slice(11, 23);
30
+ const n = V ?? console.log, o = (/* @__PURE__ */ new Date()).toISOString().slice(11, 23);
31
31
  n.call(
32
32
  console,
33
33
  `%c[Chat][${s}][${o}]`,
@@ -37,7 +37,7 @@ function pe(s, e, t) {
37
37
  );
38
38
  }
39
39
  function Ut() {
40
- j || (j = console.log, console.log = (...s) => {
40
+ V || (V = console.log, console.log = (...s) => {
41
41
  try {
42
42
  const e = s[0];
43
43
  if (typeof e == "string") {
@@ -46,11 +46,11 @@ function Ut() {
46
46
  }
47
47
  } catch {
48
48
  }
49
- j.apply(console, s);
49
+ V.apply(console, s);
50
50
  });
51
51
  }
52
52
  function Lt() {
53
- j && (console.log = j, j = null);
53
+ V && (console.log = V, V = null);
54
54
  }
55
55
  async function Wn() {
56
56
  var s;
@@ -60,10 +60,10 @@ async function Wn() {
60
60
  const e = await import("easemob-websdk");
61
61
  typeof e.setLogLevel == "function" && (e.setLogLevel("DEBUG"), Se = !0);
62
62
  const t = e.LogEventName ? (s = e.ChatClient) == null ? void 0 : s.instance : null;
63
- t && typeof t.addEventHandler == "function" ? (t.addEventHandler(Xe, {
63
+ t && typeof t.addEventHandler == "function" ? (t.addEventHandler(Ze, {
64
64
  onLog: (n) => {
65
65
  const o = n;
66
- o && typeof o.level == "string" && o.level in Ze && ee(o.level, o.message, [...o.args ?? []]);
66
+ o && typeof o.level == "string" && o.level in et && ee(o.level, o.message, [...o.args ?? []]);
67
67
  }
68
68
  }), H = t, K = "onlog") : typeof e.setLogger == "function" ? (ue = typeof e.getLogger == "function" ? e.getLogger() : null, e.setLogger({
69
69
  debug: (n, ...o) => {
@@ -86,7 +86,7 @@ async function Jn() {
86
86
  if (Q) {
87
87
  Q = !1;
88
88
  try {
89
- K === "console" && Lt(), K === "onlog" && ((s = H == null ? void 0 : H.removeEventHandler) == null || s.call(H, Xe));
89
+ K === "console" && Lt(), K === "onlog" && ((s = H == null ? void 0 : H.removeEventHandler) == null || s.call(H, Ze));
90
90
  const e = await import("easemob-websdk");
91
91
  K === "inject" && typeof e.setLogger == "function" && ue && e.setLogger(ue), Se && !(de != null && de()) && typeof e.setLogLevel == "function" && e.setLogLevel("WARN");
92
92
  } catch {
@@ -99,9 +99,9 @@ let Re = !1;
99
99
  function $n() {
100
100
  return Re;
101
101
  }
102
- let et = null;
102
+ let tt = null;
103
103
  function Dt(s) {
104
- const e = et;
104
+ const e = tt;
105
105
  if (!e)
106
106
  return s;
107
107
  if (s.appKey !== e.appKey || s.appId !== e.appId)
@@ -111,7 +111,7 @@ function Dt(s) {
111
111
  const { managers: t, ...n } = s, o = [];
112
112
  for (const a of Object.keys(n))
113
113
  JSON.stringify(n[a]) !== JSON.stringify(e[a]) && o.push(a);
114
- return o.length > 0 && we(
114
+ return o.length > 0 && Ce(
115
115
  "[UIKit] SDK 已初始化,本次 init 配置以首次初始化为准(忽略字段:%s)。",
116
116
  o.join(", ")
117
117
  ), { ...e, managers: t };
@@ -130,20 +130,20 @@ class _t {
130
130
  enableUserInfoSync: a.enableUserInfoSync ?? !0,
131
131
  managers: a.managers
132
132
  });
133
- this._deleteConversationOnGroupDestroyed = r.deleteConversationOnGroupDestroyed ?? !0, this._client = it.init(r), et = r, t && (Re = !0, import("easemob-websdk").then(({ setLogLevel: c }) => {
133
+ this._deleteConversationOnGroupDestroyed = r.deleteConversationOnGroupDestroyed ?? !0, this._client = it.init(r), tt = r, t && (Re = !0, import("easemob-websdk").then(({ setLogLevel: c }) => {
134
134
  c("DEBUG");
135
- })), o ? we(
135
+ })), o ? Ce(
136
136
  "%c[Easemob] SDK version: %s, %s version: %s, Adapter version: %s",
137
137
  "color: green; font-weight: bold;",
138
138
  "5.2.0",
139
139
  n,
140
140
  o,
141
- "1.6.0"
142
- ) : we(
141
+ "1.6.2"
142
+ ) : Ce(
143
143
  "%c[Easemob] SDK version: %s, Adapter version: %s",
144
144
  "color: green; font-weight: bold;",
145
145
  "5.2.0",
146
- "1.6.0"
146
+ "1.6.2"
147
147
  );
148
148
  }
149
149
  get chatManager() {
@@ -246,19 +246,19 @@ function Ot(s) {
246
246
  e = r, o();
247
247
  },
248
248
  addContact(r) {
249
- var c, u;
250
- const i = e.findIndex((m) => m.userId === r.userId);
251
- i >= 0 ? e[i] = { ...e[i], ...r } : e.push(r), o(), (u = (c = s()) == null ? void 0 : c.onContactUpdated) == null || u.call(c, r);
249
+ var c, d;
250
+ const i = e.findIndex((g) => g.userId === r.userId);
251
+ i >= 0 ? e[i] = { ...e[i], ...r } : e.push(r), o(), (d = (c = s()) == null ? void 0 : c.onContactUpdated) == null || d.call(c, r);
252
252
  },
253
253
  removeContact(r) {
254
- var c, u;
255
- const i = e.find((m) => m.userId === r);
256
- e = e.filter((m) => m.userId !== r), i && (o(), (u = (c = s()) == null ? void 0 : c.onContactUpdated) == null || u.call(c, i));
254
+ var c, d;
255
+ const i = e.find((g) => g.userId === r);
256
+ e = e.filter((g) => g.userId !== r), i && (o(), (d = (c = s()) == null ? void 0 : c.onContactUpdated) == null || d.call(c, i));
257
257
  },
258
258
  updateRemark(r, i) {
259
- var u, m;
260
- const c = e.findIndex((f) => f.userId === r);
261
- c < 0 || (e[c] = { ...e[c], remark: i, name: i || e[c].name }, o(), (m = (u = s()) == null ? void 0 : u.onContactUpdated) == null || m.call(u, e[c]));
259
+ var d, g;
260
+ const c = e.findIndex((m) => m.userId === r);
261
+ c < 0 || (e[c] = { ...e[c], remark: i, name: i || e[c].name }, o(), (g = (d = s()) == null ? void 0 : d.onContactUpdated) == null || g.call(d, e[c]));
262
262
  },
263
263
  setBlocklist(r) {
264
264
  },
@@ -270,7 +270,7 @@ function Ot(s) {
270
270
  t = t.filter((i) => i.id !== r), a();
271
271
  },
272
272
  updateInviteStatus(r, i) {
273
- const c = t.findIndex((u) => u.id === r);
273
+ const c = t.findIndex((d) => d.id === r);
274
274
  c < 0 || (t[c] = { ...t[c], status: i }, a());
275
275
  },
276
276
  getContact(r) {
@@ -316,9 +316,9 @@ function xt(s) {
316
316
  e = e.filter((c) => c.id !== a), (i = (r = s()) == null ? void 0 : r.onConversationDeleted) == null || i.call(r, a);
317
317
  },
318
318
  update(a, r) {
319
- var c, u;
320
- const i = e.findIndex((m) => m.id === a);
321
- i < 0 || (e[i] = { ...e[i], ...r }, o(), (u = (c = s()) == null ? void 0 : c.onConversationUpdated) == null || u.call(c, { id: a, conversation: r }));
319
+ var c, d;
320
+ const i = e.findIndex((g) => g.id === a);
321
+ i < 0 || (e[i] = { ...e[i], ...r }, o(), (d = (c = s()) == null ? void 0 : c.onConversationUpdated) == null || d.call(c, { id: a, conversation: r }));
322
322
  },
323
323
  setConversationList(a) {
324
324
  this.setList(a);
@@ -351,142 +351,153 @@ function xt(s) {
351
351
  }
352
352
  function Pt(s) {
353
353
  let e = [];
354
- const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Set(), m = !1;
355
- function f() {
356
- var g, d;
357
- (d = (g = s()) == null ? void 0 : g.onGroupChange) == null || d.call(g, e);
354
+ const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Set(), g = !1;
355
+ function m() {
356
+ var u, l;
357
+ (l = (u = s()) == null ? void 0 : u.onGroupChange) == null || l.call(u, e);
358
+ }
359
+ function p(u, l) {
360
+ const f = new Map(u.map((h) => [h.userId, h.role]));
361
+ return l.map((h) => {
362
+ const v = f.get(h.userId);
363
+ return v === L.ADMIN && h.role === L.MEMBER ? { ...h, role: v } : h;
364
+ });
358
365
  }
359
366
  return {
360
367
  get groupList() {
361
368
  return e;
362
369
  },
363
370
  get loaded() {
364
- return m;
365
- },
366
- setList(g) {
367
- e = g, f();
368
- },
369
- addGroup(g) {
370
- var l, p;
371
- const d = e.findIndex((h) => h.groupId === g.groupId);
372
- d >= 0 ? e[d] = { ...e[d], ...g } : e.push(g), f(), (p = (l = s()) == null ? void 0 : l.onGroupUpdated) == null || p.call(l, g);
373
- },
374
- removeGroup(g) {
375
- var l, p;
376
- const d = e.find((h) => h.groupId === g);
377
- e = e.filter((h) => h.groupId !== g), d && (f(), (p = (l = s()) == null ? void 0 : l.onGroupUpdated) == null || p.call(l, d));
378
- },
379
- updateGroup(g, d) {
380
- var p, h;
381
- const l = e.findIndex((v) => v.groupId === g);
382
- l < 0 || (e[l] = { ...e[l], ...d }, f(), (h = (p = s()) == null ? void 0 : p.onGroupUpdated) == null || h.call(p, e[l]));
383
- },
384
- setGroupMembers(g, d) {
385
- var l, p;
386
- t.set(g, d), (p = (l = s()) == null ? void 0 : l.onGroupMembersChanged) == null || p.call(l, { groupId: g, members: d });
387
- },
388
- appendGroupMembers(g, d) {
389
- var v, S;
390
- const l = t.get(g) ?? [], p = new Map(l.map((w) => [w.userId, w]));
391
- for (const w of d)
392
- p.set(w.userId, w);
393
- const h = Array.from(p.values());
394
- t.set(g, h), (S = (v = s()) == null ? void 0 : v.onGroupMembersChanged) == null || S.call(v, { groupId: g, members: h });
395
- },
396
- removeGroupMembers(g, d) {
397
- var h, v;
398
- const l = new Set(d), p = (t.get(g) ?? []).filter((S) => !l.has(S.userId));
399
- t.set(g, p), (v = (h = s()) == null ? void 0 : h.onGroupMembersChanged) == null || v.call(h, { groupId: g, members: p });
400
- },
401
- updateGroupMemberRole(g, d, l) {
402
- var v, S;
403
- const p = t.get(g) ?? [], h = p.findIndex((w) => w.userId === d);
404
- h < 0 || (p[h] = { ...p[h], role: l }, t.set(g, p), (S = (v = s()) == null ? void 0 : v.onGroupMembersChanged) == null || S.call(v, { groupId: g, members: p }));
405
- },
406
- setGroupAnnouncement(g, d) {
407
- var l, p;
408
- n.set(g, d), (p = (l = s()) == null ? void 0 : l.onGroupAnnouncementChanged) == null || p.call(l, { groupId: g, announcement: d });
409
- },
410
- isGroupAdminSynced(g) {
411
- return u.has(g);
412
- },
413
- markGroupAdminSynced(g) {
414
- u.add(g);
415
- },
416
- setGroupMuteList(g, d) {
417
- o.set(g, d);
418
- },
419
- addGroupMuteMembers(g, d) {
420
- const l = o.get(g) ?? [], p = Array.isArray(d) && d.length > 0 && typeof d[0] == "string" ? d : d.map((h) => h.userId);
421
- for (const h of p)
422
- l.some((v) => v.userId === h) || l.push({ userId: h });
423
- o.set(g, l);
424
- },
425
- removeGroupMuteMembers(g, d) {
426
- const l = new Set(d);
427
- o.set(g, (o.get(g) ?? []).filter((p) => !l.has(p.userId)));
428
- },
429
- setGroupBlocklist(g, d) {
430
- a.set(g, d);
431
- },
432
- addGroupBlocklistMembers(g, d) {
433
- const l = a.get(g) ?? [];
434
- for (const p of d)
435
- l.some((h) => h.userId === p) || l.push({ userId: p });
436
- a.set(g, l);
437
- },
438
- removeGroupBlocklistMembers(g, d) {
439
- const l = new Set(d);
440
- a.set(g, (a.get(g) ?? []).filter((p) => !l.has(p.userId)));
441
- },
442
- setGroupAllowlist(g, d) {
443
- r.set(g, d);
444
- },
445
- addGroupAllowlistMembers(g, d) {
446
- const l = r.get(g) ?? [];
447
- for (const p of d)
448
- l.some((h) => h.userId === p) || l.push({ userId: p });
449
- r.set(g, l);
450
- },
451
- removeGroupAllowlistMembers(g, d) {
452
- const l = new Set(d);
453
- r.set(g, (r.get(g) ?? []).filter((p) => !l.has(p.userId)));
371
+ return g;
454
372
  },
455
- setGroupList(g) {
456
- this.setList(g);
373
+ setList(u) {
374
+ e = u, m();
457
375
  },
458
- getGroupById(g) {
459
- return e.find((d) => d.groupId === g);
376
+ addGroup(u) {
377
+ var f, h;
378
+ const l = e.findIndex((v) => v.groupId === u.groupId);
379
+ l >= 0 ? e[l] = { ...e[l], ...u } : e.push(u), m(), (h = (f = s()) == null ? void 0 : f.onGroupUpdated) == null || h.call(f, u);
460
380
  },
461
- incrementMemberCount(g, d) {
462
- const l = this.getGroupById(g);
463
- l && this.updateGroup(g, { memberCount: (l.memberCount ?? 0) + d });
381
+ removeGroup(u) {
382
+ var f, h;
383
+ const l = e.find((v) => v.groupId === u);
384
+ e = e.filter((v) => v.groupId !== u), l && (m(), (h = (f = s()) == null ? void 0 : f.onGroupUpdated) == null || h.call(f, l));
464
385
  },
465
- decrementMemberCount(g, d) {
466
- const l = this.getGroupById(g);
467
- l && this.updateGroup(g, { memberCount: Math.max(0, (l.memberCount ?? 0) - d) });
468
- },
469
- addGroupSharedFile(g, d) {
470
- const l = i.get(g) ?? [];
471
- l.push(d), i.set(g, l);
472
- },
473
- removeGroupSharedFile(g, d) {
474
- i.set(g, (i.get(g) ?? []).filter((l) => l.fileId !== d));
475
- },
476
- getGroupJoinRequests(g) {
477
- return c.get(g) ?? [];
386
+ updateGroup(u, l) {
387
+ var h, v;
388
+ const f = e.findIndex((b) => b.groupId === u);
389
+ f < 0 || (e[f] = { ...e[f], ...l }, m(), (v = (h = s()) == null ? void 0 : h.onGroupUpdated) == null || v.call(h, e[f]));
478
390
  },
479
- setGroupJoinRequests(g, d) {
480
- c.set(g, d);
391
+ setGroupMembers(u, l) {
392
+ var h, v;
393
+ const f = p(t.get(u) ?? [], l);
394
+ t.set(u, f), (v = (h = s()) == null ? void 0 : h.onGroupMembersChanged) == null || v.call(h, { groupId: u, members: f });
481
395
  },
482
- updateGroupJoinRequest(g, d, l) {
483
- const h = (c.get(g) ?? []).find(
484
- (v) => {
485
- var S;
486
- return v.applicantId === d || ((S = v.applicant) == null ? void 0 : S.userId) === d;
396
+ getGroupMembers(u) {
397
+ return t.get(u) ?? [];
398
+ },
399
+ appendGroupMembers(u, l) {
400
+ var b, w;
401
+ const f = t.get(u) ?? [], h = new Map(f.map((I) => [I.userId, I]));
402
+ for (const I of p(f, l))
403
+ h.set(I.userId, I);
404
+ const v = Array.from(h.values());
405
+ t.set(u, v), (w = (b = s()) == null ? void 0 : b.onGroupMembersChanged) == null || w.call(b, { groupId: u, members: v });
406
+ },
407
+ removeGroupMembers(u, l) {
408
+ var v, b;
409
+ const f = new Set(l), h = (t.get(u) ?? []).filter((w) => !f.has(w.userId));
410
+ t.set(u, h), (b = (v = s()) == null ? void 0 : v.onGroupMembersChanged) == null || b.call(v, { groupId: u, members: h });
411
+ },
412
+ updateGroupMemberRole(u, l, f) {
413
+ var b, w;
414
+ const h = t.get(u) ?? [], v = h.findIndex((I) => I.userId === l);
415
+ v < 0 || (h[v] = { ...h[v], role: f }, t.set(u, h), (w = (b = s()) == null ? void 0 : b.onGroupMembersChanged) == null || w.call(b, { groupId: u, members: h }));
416
+ },
417
+ setGroupAnnouncement(u, l) {
418
+ var f, h;
419
+ n.set(u, l), (h = (f = s()) == null ? void 0 : f.onGroupAnnouncementChanged) == null || h.call(f, { groupId: u, announcement: l });
420
+ },
421
+ isGroupAdminSynced(u) {
422
+ return d.has(u);
423
+ },
424
+ markGroupAdminSynced(u) {
425
+ d.add(u);
426
+ },
427
+ setGroupMuteList(u, l) {
428
+ o.set(u, l);
429
+ },
430
+ addGroupMuteMembers(u, l) {
431
+ const f = o.get(u) ?? [], h = Array.isArray(l) && l.length > 0 && typeof l[0] == "string" ? l : l.map((v) => v.userId);
432
+ for (const v of h)
433
+ f.some((b) => b.userId === v) || f.push({ userId: v });
434
+ o.set(u, f);
435
+ },
436
+ removeGroupMuteMembers(u, l) {
437
+ const f = new Set(l);
438
+ o.set(u, (o.get(u) ?? []).filter((h) => !f.has(h.userId)));
439
+ },
440
+ setGroupBlocklist(u, l) {
441
+ a.set(u, l);
442
+ },
443
+ addGroupBlocklistMembers(u, l) {
444
+ const f = a.get(u) ?? [];
445
+ for (const h of l)
446
+ f.some((v) => v.userId === h) || f.push({ userId: h });
447
+ a.set(u, f);
448
+ },
449
+ removeGroupBlocklistMembers(u, l) {
450
+ const f = new Set(l);
451
+ a.set(u, (a.get(u) ?? []).filter((h) => !f.has(h.userId)));
452
+ },
453
+ setGroupAllowlist(u, l) {
454
+ r.set(u, l);
455
+ },
456
+ addGroupAllowlistMembers(u, l) {
457
+ const f = r.get(u) ?? [];
458
+ for (const h of l)
459
+ f.some((v) => v.userId === h) || f.push({ userId: h });
460
+ r.set(u, f);
461
+ },
462
+ removeGroupAllowlistMembers(u, l) {
463
+ const f = new Set(l);
464
+ r.set(u, (r.get(u) ?? []).filter((h) => !f.has(h.userId)));
465
+ },
466
+ setGroupList(u) {
467
+ this.setList(u);
468
+ },
469
+ getGroupById(u) {
470
+ return e.find((l) => l.groupId === u);
471
+ },
472
+ incrementMemberCount(u, l) {
473
+ const f = this.getGroupById(u);
474
+ f && this.updateGroup(u, { memberCount: (f.memberCount ?? 0) + l });
475
+ },
476
+ decrementMemberCount(u, l) {
477
+ const f = this.getGroupById(u);
478
+ f && this.updateGroup(u, { memberCount: Math.max(0, (f.memberCount ?? 0) - l) });
479
+ },
480
+ addGroupSharedFile(u, l) {
481
+ const f = i.get(u) ?? [];
482
+ f.push(l), i.set(u, f);
483
+ },
484
+ removeGroupSharedFile(u, l) {
485
+ i.set(u, (i.get(u) ?? []).filter((f) => f.fileId !== l));
486
+ },
487
+ getGroupJoinRequests(u) {
488
+ return c.get(u) ?? [];
489
+ },
490
+ setGroupJoinRequests(u, l) {
491
+ c.set(u, l);
492
+ },
493
+ updateGroupJoinRequest(u, l, f) {
494
+ const v = (c.get(u) ?? []).find(
495
+ (b) => {
496
+ var w;
497
+ return b.applicantId === l || ((w = b.applicant) == null ? void 0 : w.userId) === l;
487
498
  }
488
499
  );
489
- h && (h.status = l);
500
+ v && (v.status = f);
490
501
  }
491
502
  };
492
503
  }
@@ -497,183 +508,183 @@ function Bt(s) {
497
508
  return e.get(i) ?? [];
498
509
  }
499
510
  function a(i) {
500
- for (const [c, u] of e) {
501
- const m = u.findIndex((f) => f.msgServerId === i || f.msgLocalId === i);
502
- if (m >= 0)
503
- return { list: u, index: m, conversationId: c };
511
+ for (const [c, d] of e) {
512
+ const g = d.findIndex((m) => m.msgServerId === i || m.msgLocalId === i);
513
+ if (g >= 0)
514
+ return { list: d, index: g, conversationId: c };
504
515
  }
505
516
  return null;
506
517
  }
507
518
  function r(i) {
508
- const c = i, u = e.get(c.conversationId) ?? [], m = u.findIndex(
509
- (f) => f.msgServerId && f.msgServerId === c.msgServerId
519
+ const c = i, d = e.get(c.conversationId) ?? [], g = d.findIndex(
520
+ (m) => m.msgServerId && m.msgServerId === c.msgServerId
510
521
  );
511
- m >= 0 ? u[m] = c : u.push(c), u.sort((f, g) => (f.timestamp ?? 0) - (g.timestamp ?? 0)), e.set(c.conversationId, u);
522
+ g >= 0 ? d[g] = c : d.push(c), d.sort((m, p) => (m.timestamp ?? 0) - (p.timestamp ?? 0)), e.set(c.conversationId, d);
512
523
  }
513
524
  return {
514
525
  getMessages: o,
515
526
  addMessage(i) {
516
- var c, u;
517
- r(i), (u = (c = s()) == null ? void 0 : c.onMessage) == null || u.call(c, i);
527
+ var c, d;
528
+ r(i), (d = (c = s()) == null ? void 0 : c.onMessage) == null || d.call(c, i);
518
529
  },
519
530
  addSendingMessage(i, c) {
520
531
  t.set(i, c);
521
532
  },
522
533
  replaceWithSent(i, c) {
523
- var u, m;
524
- t.delete(i), r(c), (m = (u = s()) == null ? void 0 : u.onMessage) == null || m.call(u, c);
534
+ var d, g;
535
+ t.delete(i), r(c), (g = (d = s()) == null ? void 0 : d.onMessage) == null || g.call(d, c);
525
536
  },
526
537
  updateUploadProgress(i, c) {
527
- const u = t.get(i);
528
- if (!u)
538
+ const d = t.get(i);
539
+ if (!d)
529
540
  return;
530
- const m = a(u.msgLocalId || u.msgServerId || "");
531
- if (m) {
532
- const f = { ...m.list[m.index], progress: c };
533
- m.list[m.index] = f;
541
+ const g = a(d.msgLocalId || d.msgServerId || "");
542
+ if (g) {
543
+ const m = { ...g.list[g.index], progress: c };
544
+ g.list[g.index] = m;
534
545
  }
535
546
  },
536
547
  markFailed(i, c) {
537
- const u = t.get(i);
548
+ const d = t.get(i);
538
549
  t.delete(i);
539
- const m = (u == null ? void 0 : u.msgLocalId) || (u == null ? void 0 : u.msgServerId);
540
- if (!m)
550
+ const g = (d == null ? void 0 : d.msgLocalId) || (d == null ? void 0 : d.msgServerId);
551
+ if (!g)
541
552
  return;
542
- const f = a(m);
543
- if (f) {
544
- const g = { ...f.list[f.index], status: "failed", failReason: c };
545
- f.list[f.index] = g;
553
+ const m = a(g);
554
+ if (m) {
555
+ const p = { ...m.list[m.index], status: "failed", failReason: c };
556
+ m.list[m.index] = p;
546
557
  }
547
558
  },
548
559
  prependMessages(i, c) {
549
- const u = e.get(i) ?? [], m = /* @__PURE__ */ new Map();
550
- for (const g of c) {
551
- const d = g;
552
- d.msgServerId && m.set(d.msgServerId, d);
560
+ const d = e.get(i) ?? [], g = /* @__PURE__ */ new Map();
561
+ for (const p of c) {
562
+ const u = p;
563
+ u.msgServerId && g.set(u.msgServerId, u);
553
564
  }
554
- for (const g of u)
555
- g.msgServerId && !m.has(g.msgServerId) && m.set(g.msgServerId, g);
556
- const f = Array.from(m.values()).sort(
557
- (g, d) => (g.timestamp ?? 0) - (d.timestamp ?? 0)
565
+ for (const p of d)
566
+ p.msgServerId && !g.has(p.msgServerId) && g.set(p.msgServerId, p);
567
+ const m = Array.from(g.values()).sort(
568
+ (p, u) => (p.timestamp ?? 0) - (u.timestamp ?? 0)
558
569
  );
559
- e.set(i, f);
570
+ e.set(i, m);
560
571
  },
561
572
  updateStatusByServerId(i, c) {
562
- var m, f;
563
- const u = a(i);
564
- u && (u.list[u.index] = { ...u.list[u.index], status: c }, (f = (m = s()) == null ? void 0 : m.onMessageStatusChanged) == null || f.call(m, { messageId: i, status: c }));
573
+ var g, m;
574
+ const d = a(i);
575
+ d && (d.list[d.index] = { ...d.list[d.index], status: c }, (m = (g = s()) == null ? void 0 : g.onMessageStatusChanged) == null || m.call(g, { messageId: i, status: c }));
565
576
  },
566
577
  recallMessage(i, c) {
567
- var f, g;
568
- const u = a(i);
569
- if (!u)
578
+ var m, p;
579
+ const d = a(i);
580
+ if (!d)
570
581
  return;
571
- const m = u.list[u.index];
572
- m.recalled = !0, m.recalledBy = c, (g = (f = s()) == null ? void 0 : f.onMessagesRecalled) == null || g.call(f, {
582
+ const g = d.list[d.index];
583
+ g.recalled = !0, g.recalledBy = c, (p = (m = s()) == null ? void 0 : m.onMessagesRecalled) == null || p.call(m, {
573
584
  messageId: i,
574
- conversationId: u.conversationId,
575
- conversationType: m.conversationType,
585
+ conversationId: d.conversationId,
586
+ conversationType: g.conversationType,
576
587
  operatorId: c
577
588
  });
578
589
  },
579
590
  updateMessage(i, c) {
580
- var f, g;
581
- const u = a(i);
582
- if (!u)
591
+ var m, p;
592
+ const d = a(i);
593
+ if (!d)
583
594
  return;
584
- const m = c;
585
- u.list[u.index] = m, m.modified && ((g = (f = s()) == null ? void 0 : f.onMessageUpdated) == null || g.call(f, m));
595
+ const g = c;
596
+ d.list[d.index] = g, g.modified && ((p = (m = s()) == null ? void 0 : m.onMessageUpdated) == null || p.call(m, g));
586
597
  },
587
598
  setPinnedMessages(i, c) {
588
599
  },
589
600
  setTranslation(i, c) {
590
- const u = a(i);
591
- if (!u)
601
+ const d = a(i);
602
+ if (!d)
592
603
  return;
593
- const m = u.list[u.index];
594
- m.translation = c, m.showTranslation = !0;
604
+ const g = d.list[d.index];
605
+ g.translation = c, g.showTranslation = !0;
595
606
  },
596
607
  setTranslating(i, c) {
597
- const u = a(i);
598
- u && (u.list[u.index] = { ...u.list[u.index], translating: c });
608
+ const d = a(i);
609
+ d && (d.list[d.index] = { ...d.list[d.index], translating: c });
599
610
  },
600
611
  setVoiceText(i, c) {
601
- const u = a(i);
602
- if (!u)
612
+ const d = a(i);
613
+ if (!d)
603
614
  return;
604
- const m = u.list[u.index];
605
- m.voiceText = c, m.showVoiceText = !0;
615
+ const g = d.list[d.index];
616
+ g.voiceText = c, g.showVoiceText = !0;
606
617
  },
607
618
  setVoiceTranscribing(i, c) {
608
- const u = a(i);
609
- u && (u.list[u.index] = { ...u.list[u.index], voiceTranscribing: c });
619
+ const d = a(i);
620
+ d && (d.list[d.index] = { ...d.list[d.index], voiceTranscribing: c });
610
621
  },
611
622
  clearConversationMessages(i) {
612
623
  e.delete(i);
613
624
  },
614
625
  updateMessageById(i, c) {
615
- var g, d, l, p;
616
- const u = a(i);
617
- if (!u)
626
+ var p, u, l, f;
627
+ const d = a(i);
628
+ if (!d)
618
629
  return;
619
- const m = u.list[u.index], f = { ...m, ...c };
620
- u.list[u.index] = f, (c.modified || c.modifiedInfo) && ((d = (g = s()) == null ? void 0 : g.onMessageUpdated) == null || d.call(g, f)), c.status && c.status !== m.status && ((p = (l = s()) == null ? void 0 : l.onMessageStatusChanged) == null || p.call(l, {
630
+ const g = d.list[d.index], m = { ...g, ...c };
631
+ d.list[d.index] = m, (c.modified || c.modifiedInfo) && ((u = (p = s()) == null ? void 0 : p.onMessageUpdated) == null || u.call(p, m)), c.status && c.status !== g.status && ((f = (l = s()) == null ? void 0 : l.onMessageStatusChanged) == null || f.call(l, {
621
632
  messageId: i,
622
633
  status: c.status
623
634
  }));
624
635
  },
625
636
  replaceMessageById(i, c) {
626
- var f, g;
627
- const u = a(i);
628
- if (!u)
637
+ var m, p;
638
+ const d = a(i);
639
+ if (!d)
629
640
  return;
630
- const m = c;
631
- u.list[u.index] = m, (g = (f = s()) == null ? void 0 : f.onMessageUpdated) == null || g.call(f, m);
641
+ const g = c;
642
+ d.list[d.index] = g, (p = (m = s()) == null ? void 0 : m.onMessageUpdated) == null || p.call(m, g);
632
643
  },
633
644
  addAtMeMessage(i, c) {
634
- var u, m;
635
- (m = (u = s()) == null ? void 0 : u.onAtMe) == null || m.call(u, { conversationId: i, messageId: c });
645
+ var d, g;
646
+ (g = (d = s()) == null ? void 0 : d.onAtMe) == null || g.call(d, { conversationId: i, messageId: c });
636
647
  },
637
648
  updateMessageStatus(i, c) {
638
- var m, f;
639
- const u = a(i);
640
- u && (u.list[u.index] = { ...u.list[u.index], status: c }, (f = (m = s()) == null ? void 0 : m.onMessageStatusChanged) == null || f.call(m, { messageId: i, status: c }));
649
+ var g, m;
650
+ const d = a(i);
651
+ d && (d.list[d.index] = { ...d.list[d.index], status: c }, (m = (g = s()) == null ? void 0 : g.onMessageStatusChanged) == null || m.call(g, { messageId: i, status: c }));
641
652
  },
642
653
  setMessagePinned(i, c) {
643
- const u = a(i);
644
- if (!u)
654
+ const d = a(i);
655
+ if (!d)
645
656
  return;
646
- const m = u.list[u.index];
647
- m.pinned = !0, m.pinTime = c.pinTime, m.pinOperatorId = c.operatorId;
657
+ const g = d.list[d.index];
658
+ g.pinned = !0, g.pinTime = c.pinTime, g.pinOperatorId = c.operatorId;
648
659
  },
649
660
  setMessageUnpinned(i) {
650
661
  const c = a(i);
651
662
  if (!c)
652
663
  return;
653
- const u = c.list[c.index];
654
- u.pinned = !1;
664
+ const d = c.list[c.index];
665
+ d.pinned = !1;
655
666
  },
656
667
  deleteMessages(i) {
657
- var m, f;
658
- const c = new Set(i), u = /* @__PURE__ */ new Map();
659
- for (const [g, d] of e) {
668
+ var g, m;
669
+ const c = new Set(i), d = /* @__PURE__ */ new Map();
670
+ for (const [p, u] of e) {
660
671
  const l = [];
661
- for (const p of d) {
662
- const h = p.msgServerId || p.msgLocalId;
672
+ for (const f of u) {
673
+ const h = f.msgServerId || f.msgLocalId;
663
674
  if (h && c.has(h)) {
664
- const v = u.get(g) ?? [];
665
- v.push(h), u.set(g, v);
675
+ const v = d.get(p) ?? [];
676
+ v.push(h), d.set(p, v);
666
677
  } else
667
- l.push(p);
678
+ l.push(f);
668
679
  }
669
- e.set(g, l);
680
+ e.set(p, l);
670
681
  }
671
- for (const [g, d] of u)
672
- (f = (m = s()) == null ? void 0 : m.onMessagesDeleted) == null || f.call(m, { messageIds: d, conversationId: g });
682
+ for (const [p, u] of d)
683
+ (m = (g = s()) == null ? void 0 : g.onMessagesDeleted) == null || m.call(g, { messageIds: u, conversationId: p });
673
684
  },
674
685
  setSyncingMessages(i) {
675
- var c, u;
676
- n !== i && (n = i, (u = (c = s()) == null ? void 0 : c.onSyncStatus) == null || u.call(c, {
686
+ var c, d;
687
+ n !== i && (n = i, (d = (c = s()) == null ? void 0 : c.onSyncStatus) == null || d.call(c, {
677
688
  type: "message",
678
689
  status: i ? "syncing" : "success"
679
690
  }));
@@ -702,8 +713,8 @@ function Ht(s) {
702
713
  let a = !1;
703
714
  const r = /* @__PURE__ */ new Map();
704
715
  function i() {
705
- var c, u;
706
- (u = (c = s()) == null ? void 0 : c.onUserInfoChanged) == null || u.call(c, Array.from(e.values()));
716
+ var c, d;
717
+ (d = (c = s()) == null ? void 0 : c.onUserInfoChanged) == null || d.call(c, Array.from(e.values()));
707
718
  }
708
719
  return {
709
720
  getUserInfo(c) {
@@ -713,48 +724,48 @@ function Ht(s) {
713
724
  e.set(c.userId, c), i();
714
725
  },
715
726
  setUserInfos(c) {
716
- for (const u of c)
717
- e.set(u.userId, u);
727
+ for (const d of c)
728
+ e.set(d.userId, d);
718
729
  i();
719
730
  },
720
- areAttributesFetched(c, u) {
721
- const m = r.get(c);
722
- return m ? u.every((f) => m.has(f)) : !1;
731
+ areAttributesFetched(c, d) {
732
+ const g = r.get(c);
733
+ return g ? d.every((m) => g.has(m)) : !1;
723
734
  },
724
- markFetchedAttributes(c, u) {
725
- for (const m of c) {
726
- const f = r.get(m) ?? /* @__PURE__ */ new Set();
727
- for (const g of u)
728
- f.add(g);
729
- r.set(m, f);
735
+ markFetchedAttributes(c, d) {
736
+ for (const g of c) {
737
+ const m = r.get(g) ?? /* @__PURE__ */ new Set();
738
+ for (const p of d)
739
+ m.add(p);
740
+ r.set(g, m);
730
741
  }
731
742
  },
732
743
  markLoading(c) {
733
- for (const u of c)
734
- t.add(u);
744
+ for (const d of c)
745
+ t.add(d);
735
746
  },
736
747
  markLoaded(c) {
737
- for (const u of c)
738
- t.delete(u);
748
+ for (const d of c)
749
+ t.delete(d);
739
750
  },
740
751
  markFetchFailed(c) {
741
- for (const u of c)
742
- n.add(u);
752
+ for (const d of c)
753
+ n.add(d);
743
754
  },
744
755
  isFetchFailed(c) {
745
756
  return n.has(c);
746
757
  },
747
758
  markSubscribed(c) {
748
- for (const u of c)
749
- o.add(u);
759
+ for (const d of c)
760
+ o.add(d);
750
761
  },
751
762
  markUnsubscribed(c) {
752
- for (const u of c)
753
- o.delete(u);
763
+ for (const d of c)
764
+ o.delete(d);
754
765
  },
755
766
  markSubscribeFailed(c) {
756
- for (const u of c)
757
- n.add(u);
767
+ for (const d of c)
768
+ n.add(d);
758
769
  },
759
770
  isSubscribeFailed(c) {
760
771
  return n.has(c);
@@ -784,7 +795,7 @@ function Kt(s, e) {
784
795
  userInfo: Ht(e)
785
796
  };
786
797
  }
787
- function Vt() {
798
+ function jt() {
788
799
  return {
789
800
  enableContact: !0,
790
801
  enableBlocklist: !0,
@@ -803,7 +814,7 @@ function Vt() {
803
814
  filterBlockedContacts: !0
804
815
  };
805
816
  }
806
- function jt(s) {
817
+ function Vt(s) {
807
818
  if (s != null && s.fetchUserInfos)
808
819
  return { fetchUserInfos: s.fetchUserInfos };
809
820
  }
@@ -922,7 +933,7 @@ function $t(s) {
922
933
  // 契约的 needReadReceipt 未透传:domain sendLocation 无此参数(SDK 不支持位置消息回执)
923
934
  sendLocation: (n, o, a, r, i, c) => e.sendLocation(n, o, a, r, i, c),
924
935
  sendCustom: (n, o, a, r, i) => {
925
- const c = r ? Object.fromEntries(Object.entries(r).map(([u, m]) => [u, String(m)])) : void 0;
936
+ const c = r ? Object.fromEntries(Object.entries(r).map(([d, g]) => [d, String(g)])) : void 0;
926
937
  return e.sendCustom(n, o, a, c, i);
927
938
  },
928
939
  sendCmd: (n, o, a, r) => e.sendCmd(n, o, a, r),
@@ -989,7 +1000,7 @@ const Yt = T("UIKit:MessageAdapter"), Ue = {
989
1000
  customFallback: "[自定义]",
990
1001
  unknown: ""
991
1002
  };
992
- function Ne(s) {
1003
+ function ke(s) {
993
1004
  if (s.event && typeof s.event == "string")
994
1005
  return s.event;
995
1006
  const e = s.params;
@@ -1012,15 +1023,15 @@ function P(s, e) {
1012
1023
  localId: s.msgLocalId,
1013
1024
  status: t && s.isPeerRead === !0 ? O.READ : s.sendStatus ?? O.SENT
1014
1025
  };
1015
- return ze(n.body) && n.body.messageList ? n.body = {
1026
+ return Ye(n.body) && n.body.messageList ? n.body = {
1016
1027
  ...n.body,
1017
- messageList: _e([...n.body.messageList])
1018
- } : yt(n.body) && (n.body = _e([...n.body])), n;
1028
+ messageList: Ne([...n.body.messageList])
1029
+ } : yt(n.body) && (n.body = Ne([...n.body])), n;
1019
1030
  }
1020
1031
  function Qn(s, e) {
1021
1032
  return s.map((t) => P(t, e));
1022
1033
  }
1023
- function ke(s) {
1034
+ function Oe(s) {
1024
1035
  return {
1025
1036
  ...s,
1026
1037
  isSelf: !1,
@@ -1028,7 +1039,7 @@ function ke(s) {
1028
1039
  status: s.sendStatus ?? O.SENT
1029
1040
  };
1030
1041
  }
1031
- function Oe(s, e) {
1042
+ function xe(s, e) {
1032
1043
  const t = s.from || "";
1033
1044
  return {
1034
1045
  ...s,
@@ -1038,7 +1049,7 @@ function Oe(s, e) {
1038
1049
  to: s.to || "",
1039
1050
  sender: s.sender || { userId: t },
1040
1051
  conversationId: s.conversationId || (e == null ? void 0 : e.conversationId) || "",
1041
- conversationType: s.conversationType || (e == null ? void 0 : e.conversationType) || I.SINGLECHAT,
1052
+ conversationType: s.conversationType || (e == null ? void 0 : e.conversationType) || M.SINGLECHAT,
1042
1053
  type: s.type || "unknown",
1043
1054
  sendStatus: s.sendStatus ?? O.SENT,
1044
1055
  ext: s.ext ?? {},
@@ -1053,45 +1064,45 @@ function zn(s, e, t) {
1053
1064
  var r;
1054
1065
  if (!s)
1055
1066
  return "";
1056
- const n = t == null ? void 0 : t(ke(s));
1067
+ const n = t == null ? void 0 : t(Oe(s));
1057
1068
  if (n !== void 0)
1058
1069
  return n;
1059
- const o = We({ ...Ue, ...e }), { body: a } = s;
1060
- return s.type === b.MULTI_BODY ? Je(ke(s), o) : mt(a) ? a.content || "" : ft(a) ? ((r = s.ext) == null ? void 0 : r[$e.IS_STICKER]) === !0 ? o.sticker : o.image : Qe(a) ? o.voice : pt(a) ? o.video : ht(a) ? a.filename || o.file : vt(a) ? o.location : It(a) ? o.custom[a.event || ""] || o.customFallback : Mt(a) ? "[命令]" : ze(a) ? a.summary || o.combine : "";
1070
+ const o = Je({ ...Ue, ...e }), { body: a } = s;
1071
+ return s.type === C.MULTI_BODY ? $e(Oe(s), o) : ft(a) ? a.content || "" : mt(a) ? ((r = s.ext) == null ? void 0 : r[Qe.IS_STICKER]) === !0 ? o.sticker : o.image : ze(a) ? o.voice : pt(a) ? o.video : ht(a) ? a.filename || o.file : vt(a) ? o.location : It(a) ? o.custom[a.event || ""] || o.customFallback : Mt(a) ? "[命令]" : Ye(a) ? a.summary || o.combine : "";
1061
1072
  }
1062
1073
  function Xt(s, e, t, n) {
1063
1074
  var i;
1064
1075
  if (!s)
1065
1076
  return "";
1066
- const o = t == null ? void 0 : t(Oe(s, n));
1077
+ const o = t == null ? void 0 : t(xe(s, n));
1067
1078
  if (o !== void 0)
1068
1079
  return o;
1069
- const a = We({ ...Ue, ...e }), r = Array.isArray(s.body) ? {} : s.body || {};
1080
+ const a = Je({ ...Ue, ...e }), r = Array.isArray(s.body) ? {} : s.body || {};
1070
1081
  switch (s.type) {
1071
- case b.MULTI_BODY:
1072
- return Je(Oe(s, n), a);
1073
- case b.TEXT:
1082
+ case C.MULTI_BODY:
1083
+ return $e(xe(s, n), a);
1084
+ case C.TEXT:
1074
1085
  return r.content || r.summary || "";
1075
- case b.IMAGE:
1076
- return ((i = s.ext) == null ? void 0 : i[$e.IS_STICKER]) === !0 ? a.sticker : a.image;
1077
- case b.VOICE:
1086
+ case C.IMAGE:
1087
+ return ((i = s.ext) == null ? void 0 : i[Qe.IS_STICKER]) === !0 ? a.sticker : a.image;
1088
+ case C.VOICE:
1078
1089
  return a.voice;
1079
- case b.VIDEO:
1090
+ case C.VIDEO:
1080
1091
  return a.video;
1081
- case b.FILE:
1092
+ case C.FILE:
1082
1093
  return r.filename || a.file;
1083
- case b.LOCATION:
1094
+ case C.LOCATION:
1084
1095
  return a.location;
1085
- case b.CUSTOM: {
1086
- const c = Ne(r);
1096
+ case C.CUSTOM: {
1097
+ const c = ke(r);
1087
1098
  return a.custom[c] || a.customFallback;
1088
1099
  }
1089
- case b.CMD:
1100
+ case C.CMD:
1090
1101
  return "[命令]";
1091
- case b.COMBINE:
1102
+ case C.COMBINE:
1092
1103
  return r.summary || a.combine;
1093
1104
  default: {
1094
- const c = Ne(r);
1105
+ const c = ke(r);
1095
1106
  return c ? a.custom[c] || a.customFallback : r.content || r.summary || r.msg || "";
1096
1107
  }
1097
1108
  }
@@ -1100,7 +1111,7 @@ function Yn(s, e, t) {
1100
1111
  return s.conversationId === e && s.conversationType === t;
1101
1112
  }
1102
1113
  function Xn(s, e) {
1103
- return s.conversationType === I.GROUPCHAT || E(s.from) === E(e) ? s.to : s.from;
1114
+ return s.conversationType === M.GROUPCHAT || E(s.from) === E(e) ? s.to : s.from;
1104
1115
  }
1105
1116
  function U(s) {
1106
1117
  return Ve(s) ? s.toJSON() : s;
@@ -1212,7 +1223,7 @@ function Zn(s, e, t) {
1212
1223
  const o = tn(s), a = nn(o);
1213
1224
  return a !== "error.unknown" ? t(a) || t(e) || o : t(n || e) || o || "";
1214
1225
  }
1215
- const he = T("Combine"), ve = T("History"), N = T("MessageDomain"), sn = 150;
1226
+ const he = T("Combine"), ve = T("History"), k = T("MessageDomain"), sn = 150;
1216
1227
  function rn(s) {
1217
1228
  return new Promise((e) => {
1218
1229
  if (typeof document > "u" || typeof URL.createObjectURL != "function") {
@@ -1231,16 +1242,16 @@ function rn(s) {
1231
1242
  }), n.addEventListener("error", () => a(void 0)), setTimeout(() => a(void 0), 5e3);
1232
1243
  });
1233
1244
  }
1234
- const V = /* @__PURE__ */ new Set(), on = 5e3;
1245
+ const j = /* @__PURE__ */ new Set(), on = 5e3;
1235
1246
  function an(s) {
1236
1247
  for (const e of s)
1237
- if (V.add(e), V.size > on) {
1238
- const t = V.values().next().value;
1239
- t !== void 0 && V.delete(t);
1248
+ if (j.add(e), j.size > on) {
1249
+ const t = j.values().next().value;
1250
+ t !== void 0 && j.delete(t);
1240
1251
  }
1241
1252
  }
1242
1253
  function se(s) {
1243
- Promise.resolve().then(s).catch((e) => N.warn("persistence 钩子执行失败(已忽略):", e));
1254
+ Promise.resolve().then(s).catch((e) => k.warn("persistence 钩子执行失败(已忽略):", e));
1244
1255
  }
1245
1256
  function cn(s, e) {
1246
1257
  const t = E(s.from) === E(e);
@@ -1253,31 +1264,31 @@ function cn(s, e) {
1253
1264
  }
1254
1265
  function un(s, e) {
1255
1266
  switch (e.type) {
1256
- case b.TEXT: {
1267
+ case C.TEXT: {
1257
1268
  const { type: t, ...n } = e;
1258
1269
  return s.createTextMessageBody(n);
1259
1270
  }
1260
- case b.IMAGE: {
1271
+ case C.IMAGE: {
1261
1272
  const { type: t, ...n } = e;
1262
1273
  return s.createImageMessageBody(n);
1263
1274
  }
1264
- case b.FILE: {
1275
+ case C.FILE: {
1265
1276
  const { type: t, ...n } = e;
1266
1277
  return s.createFileMessageBody(n);
1267
1278
  }
1268
- case b.VOICE: {
1279
+ case C.VOICE: {
1269
1280
  const { type: t, ...n } = e;
1270
1281
  return s.createVoiceMessageBody(n);
1271
1282
  }
1272
- case b.VIDEO: {
1283
+ case C.VIDEO: {
1273
1284
  const { type: t, ...n } = e;
1274
1285
  return s.createVideoMessageBody(n);
1275
1286
  }
1276
- case b.LOCATION: {
1287
+ case C.LOCATION: {
1277
1288
  const { type: t, ...n } = e;
1278
1289
  return s.createLocationMessageBody(n);
1279
1290
  }
1280
- case b.CUSTOM: {
1291
+ case C.CUSTOM: {
1281
1292
  const { type: t, ...n } = e;
1282
1293
  return s.createCustomMessageBody(n);
1283
1294
  }
@@ -1375,7 +1386,7 @@ class dn {
1375
1386
  return this._send(a);
1376
1387
  }
1377
1388
  async sendCombine(e, t, n, o, a, r, i) {
1378
- const c = performance.now(), u = this.client.chatManager.createCombineMessage({
1389
+ const c = performance.now(), d = this.client.chatManager.createCombineMessage({
1379
1390
  conversationId: e,
1380
1391
  conversationType: t,
1381
1392
  title: n,
@@ -1387,7 +1398,7 @@ class dn {
1387
1398
  return he.info("createCombineMessage done", {
1388
1399
  items: r.length,
1389
1400
  elapsedMs: Math.round(performance.now() - c)
1390
- }), this._send(u);
1401
+ }), this._send(d);
1391
1402
  }
1392
1403
  async sendMultiBody(e, t, n, o, a) {
1393
1404
  const r = n.map((c) => un(this.client.chatManager, c)), i = this.client.chatManager.createMultiBodyMessage({
@@ -1415,7 +1426,7 @@ class dn {
1415
1426
  this.failedMultiBodyMessages.clear();
1416
1427
  }
1417
1428
  async downloadMultiBodyAttachments(e) {
1418
- if (e.type !== b.MULTI_BODY)
1429
+ if (e.type !== C.MULTI_BODY)
1419
1430
  throw new Error("MULTI_BODY_ATTACHMENT_UNSUPPORTED");
1420
1431
  const t = await this.client.chatManager.downloadAttachment({ message: e });
1421
1432
  return Array.isArray(t) ? t : [t];
@@ -1423,10 +1434,10 @@ class dn {
1423
1434
  /** 通用发送流程 */
1424
1435
  async _send(e) {
1425
1436
  var i;
1426
- const t = e.msgLocalId, n = e.type === b.COMBINE;
1427
- if (e.type === b.CMD)
1437
+ const t = e.msgLocalId, n = e.type === C.COMBINE;
1438
+ if (e.type === C.CMD)
1428
1439
  return this.client.chatManager.sendMessage(e);
1429
- e.requireGroupAck && N.info("[GroupAck] 发送消息携带 needReadReceipt", {
1440
+ e.requireGroupAck && k.info("[GroupAck] 发送消息携带 needReadReceipt", {
1430
1441
  conversationId: e.conversationId,
1431
1442
  conversationType: e.conversationType,
1432
1443
  msgLocalId: e.msgLocalId
@@ -1435,40 +1446,40 @@ class dn {
1435
1446
  const r = performance.now();
1436
1447
  try {
1437
1448
  const c = await this.client.chatManager.sendMessage(e, {
1438
- onFileUploadProgress: (f) => {
1449
+ onFileUploadProgress: (m) => {
1439
1450
  o += 1;
1440
- const g = f.percent ?? 0, d = performance.now();
1441
- g < 100 && d - a < sn || (a = d, this.store.updateUploadProgress(t, g));
1451
+ const p = m.percent ?? 0, u = performance.now();
1452
+ p < 100 && u - a < sn || (a = u, this.store.updateUploadProgress(t, p));
1442
1453
  }
1443
1454
  });
1444
1455
  n && he.info("sendMessage done", {
1445
1456
  elapsedMs: Math.round(performance.now() - r),
1446
1457
  progressEvents: o
1447
1458
  });
1448
- const u = P(c, this.currentUserId);
1449
- this.store.replaceWithSent(t, u);
1450
- const m = (i = this.options.persistence) == null ? void 0 : i.saveMessage;
1451
- return m && se(() => m(Ce(c))), c;
1459
+ const d = P(c, this.currentUserId);
1460
+ this.store.replaceWithSent(t, d);
1461
+ const g = (i = this.options.persistence) == null ? void 0 : i.saveMessage;
1462
+ return g && se(() => g(we(c))), c;
1452
1463
  } catch (c) {
1453
1464
  n && he.warn("sendMessage failed", {
1454
1465
  elapsedMs: Math.round(performance.now() - r),
1455
1466
  progressEvents: o,
1456
1467
  error: c instanceof Error ? c.message : String(c)
1457
1468
  });
1458
- const u = c instanceof Error ? c.message : String(c);
1459
- throw this.store.markFailed(t, u), c;
1469
+ const d = c instanceof Error ? c.message : String(c);
1470
+ throw this.store.markFailed(t, d), c;
1460
1471
  }
1461
1472
  }
1462
1473
  // ===== 历史消息 =====
1463
1474
  async fetchHistory(e, t, n, o = 20) {
1464
- var m, f;
1465
- const a = (m = this.options.messageRepository) == null ? void 0 : m.loadMessages;
1475
+ var g, m;
1476
+ const a = (g = this.options.messageRepository) == null ? void 0 : g.loadMessages;
1466
1477
  if (a) {
1467
- const g = await a(e, t, n, o), d = g.list.filter((l) => l.type !== b.CMD).map((l) => cn(l, this.currentUserId));
1468
- return this.store.prependMessages(e, d), t === I.GROUPCHAT && this.fillGroupReadCounts(d, e), {
1469
- list: d,
1470
- cursor: g.cursor,
1471
- hasMore: g.hasMore
1478
+ const p = await a(e, t, n, o), u = p.list.filter((l) => l.type !== C.CMD).map((l) => cn(l, this.currentUserId));
1479
+ return this.store.prependMessages(e, u), t === M.GROUPCHAT && this.fillGroupReadCounts(u, e), {
1480
+ list: u,
1481
+ cursor: p.cursor,
1482
+ hasMore: p.hasMore
1472
1483
  };
1473
1484
  }
1474
1485
  const r = await this.client.chatManager.getHistoryMessages({
@@ -1486,12 +1497,12 @@ class dn {
1486
1497
  count: r.items.length,
1487
1498
  cursorReturned: r.cursor,
1488
1499
  hasMore: r.hasMore,
1489
- items: r.items.map((g) => `${g.msgServerId || g.msgLocalId}|${g.type}|${g.from}->${g.to}|${g.timestamp}`)
1500
+ items: r.items.map((p) => `${p.msgServerId || p.msgLocalId}|${p.type}|${p.from}->${p.to}|${p.timestamp}`)
1490
1501
  });
1491
- const i = r.items.filter((g) => g.type !== b.CMD), c = i.map((g) => P(g, this.currentUserId));
1502
+ const i = r.items.filter((p) => p.type !== C.CMD), c = i.map((p) => P(p, this.currentUserId));
1492
1503
  this.store.prependMessages(e, c);
1493
- const u = (f = this.options.persistence) == null ? void 0 : f.saveMessages;
1494
- return u && i.length > 0 && se(() => u(i.map((g) => Ce(g)))), t === I.GROUPCHAT && this.fillGroupReadCounts(c, e), {
1504
+ const d = (m = this.options.persistence) == null ? void 0 : m.saveMessages;
1505
+ return d && i.length > 0 && se(() => d(i.map((p) => we(p)))), t === M.GROUPCHAT && this.fillGroupReadCounts(c, e), {
1495
1506
  list: c,
1496
1507
  cursor: r.cursor,
1497
1508
  hasMore: r.hasMore
@@ -1524,10 +1535,10 @@ class dn {
1524
1535
  messageIds: i
1525
1536
  });
1526
1537
  ve.info("fillGroupReadCounts result", { groupId: t, batch: i, receipts: c });
1527
- for (const u of c)
1528
- u.count > 0 && this.store.updateMessageById(u.messageId, { groupReadCount: u.count });
1538
+ for (const d of c)
1539
+ d.count > 0 && this.store.updateMessageById(d.messageId, { groupReadCount: d.count });
1529
1540
  } catch (c) {
1530
- N.warn("[MessageDomain.fillGroupReadCounts] failed:", i, U(c));
1541
+ k.warn("[MessageDomain.fillGroupReadCounts] failed:", i, U(c));
1531
1542
  }
1532
1543
  }
1533
1544
  }
@@ -1583,17 +1594,17 @@ class dn {
1583
1594
  * 失败仅 warn 不阻塞进入会话(先标记后发送,失败回滚以便下次重试)。
1584
1595
  */
1585
1596
  async sendPendingReadReceipts(e, t) {
1586
- const o = this.store.getMessages(e).filter((a) => !a.isSelf && !V.has(a.msgServerId)).map((a) => a.msgServerId).filter((a) => !!a);
1597
+ const o = this.store.getMessages(e).filter((a) => !a.isSelf && !j.has(a.msgServerId)).map((a) => a.msgServerId).filter((a) => !!a);
1587
1598
  if (o.length !== 0) {
1588
- N.info("[MessageDomain.sendPendingReadReceipts] 补发已读回执", { conversationId: e, conversationType: t, pendingCount: o.length, messageIds: o.slice(0, 5) });
1599
+ k.info("[MessageDomain.sendPendingReadReceipts] 补发已读回执", { conversationId: e, conversationType: t, pendingCount: o.length, messageIds: o.slice(0, 5) });
1589
1600
  for (const a of o)
1590
- V.add(a);
1601
+ j.add(a);
1591
1602
  try {
1592
1603
  await this.markMessagesRead(e, t, o);
1593
1604
  } catch (a) {
1594
1605
  for (const r of o)
1595
- V.delete(r);
1596
- N.warn("[MessageDomain.sendPendingReadReceipts] failed:", e, U(a));
1606
+ j.delete(r);
1607
+ k.warn("[MessageDomain.sendPendingReadReceipts] failed:", e, U(a));
1597
1608
  }
1598
1609
  }
1599
1610
  }
@@ -1621,18 +1632,18 @@ class dn {
1621
1632
  targetLanguages: t
1622
1633
  });
1623
1634
  } catch (n) {
1624
- throw N.error("[MessageDomain.translateMessage] raw SDK error:", U(n)), n;
1635
+ throw k.error("[MessageDomain.translateMessage] raw SDK error:", U(n)), n;
1625
1636
  }
1626
1637
  }
1627
1638
  /** 语音消息转文字 */
1628
1639
  async transcribeVoiceMessage(e, t) {
1629
- if (!Qe(e.body))
1630
- throw N.warn("[MessageDomain.transcribeVoiceMessage] not a voice message:", e), new Error("not a voice message");
1640
+ if (!ze(e.body))
1641
+ throw k.warn("[MessageDomain.transcribeVoiceMessage] not a voice message:", e), new Error("not a voice message");
1631
1642
  const n = {
1632
1643
  ...e.body,
1633
- type: b.VOICE
1644
+ type: C.VOICE
1634
1645
  };
1635
- return N.info("voiceMessageToText raw input:", { message: e, body: n, voiceParams: t }), await this.client.chatManager.voiceMessageToText(n, t);
1646
+ return k.info("voiceMessageToText raw input:", { message: e, body: n, voiceParams: t }), await this.client.chatManager.voiceMessageToText(n, t);
1636
1647
  }
1637
1648
  /** 下载并解析合并消息 */
1638
1649
  async downloadAndParseCombineMessage(e) {
@@ -1656,15 +1667,15 @@ class dn {
1656
1667
  }
1657
1668
  /** 发送单条消息已读回执 */
1658
1669
  async markRead(e, t, n) {
1659
- N.info("[MessageDomain.markRead] 发送单条已读回执", { conversationId: e, conversationType: t, messageId: n });
1670
+ k.info("[MessageDomain.markRead] 发送单条已读回执", { conversationId: e, conversationType: t, messageId: n });
1660
1671
  try {
1661
1672
  await this.client.chatManager.sendMessageReadReceipts({
1662
1673
  conversationId: e,
1663
1674
  conversationType: t,
1664
1675
  messageIds: [n]
1665
- }), N.info("[MessageDomain.markRead] 已读回执发送成功", { conversationId: e, conversationType: t, messageId: n });
1676
+ }), k.info("[MessageDomain.markRead] 已读回执发送成功", { conversationId: e, conversationType: t, messageId: n });
1666
1677
  } catch (o) {
1667
- throw N.warn("[MessageDomain.markRead] 已读回执发送失败", { conversationId: e, conversationType: t, messageId: n, error: U(o) }), o;
1678
+ throw k.warn("[MessageDomain.markRead] 已读回执发送失败", { conversationId: e, conversationType: t, messageId: n, error: U(o) }), o;
1668
1679
  }
1669
1680
  }
1670
1681
  /** 获取群消息已读详情(自动翻页聚合全部已读成员) */
@@ -1695,7 +1706,7 @@ class dn {
1695
1706
  conversationType: t,
1696
1707
  messageId: n,
1697
1708
  message: {
1698
- type: b.TEXT,
1709
+ type: C.TEXT,
1699
1710
  body: { content: o },
1700
1711
  ext: {}
1701
1712
  }
@@ -1703,16 +1714,16 @@ class dn {
1703
1714
  }
1704
1715
  }
1705
1716
  function ln(s, e) {
1706
- var u, m, f, g, d, l;
1717
+ var d, g, m, p, u, l;
1707
1718
  const t = Xt(s.lastMessage, void 0, e == null ? void 0 : e.lastMessageTextResolver, {
1708
1719
  conversationId: s.conversationId,
1709
1720
  conversationType: s.conversationType
1710
- }), n = E(((u = s.lastMessage) == null ? void 0 : u.from) || ""), o = E(((f = (m = s.lastMessage) == null ? void 0 : m.sender) == null ? void 0 : f.userId) || ""), a = o || n, r = a ? (g = e == null ? void 0 : e.resolveSenderName) == null ? void 0 : g.call(e, a) : void 0, i = ((l = (d = s.lastMessage) == null ? void 0 : d.sender) == null ? void 0 : l.nickname) || r || o || n || "", c = Ye(s.conversationType, i, t);
1721
+ }), n = E(((d = s.lastMessage) == null ? void 0 : d.from) || ""), o = E(((m = (g = s.lastMessage) == null ? void 0 : g.sender) == null ? void 0 : m.userId) || ""), a = o || n, r = a ? (p = e == null ? void 0 : e.resolveSenderName) == null ? void 0 : p.call(e, a) : void 0, i = ((l = (u = s.lastMessage) == null ? void 0 : u.sender) == null ? void 0 : l.nickname) || r || o || n || "", c = Xe(s.conversationType, i, t);
1711
1722
  return {
1712
1723
  id: s.conversationId,
1713
1724
  name: s.conversationName || s.conversationId,
1714
1725
  avatar: s.conversationAvatar,
1715
- type: s.conversationType === I.GROUPCHAT ? I.GROUPCHAT : I.SINGLECHAT,
1726
+ type: s.conversationType === M.GROUPCHAT ? M.GROUPCHAT : M.SINGLECHAT,
1716
1727
  unreadCount: s.unreadCount || 0,
1717
1728
  lastMessageText: c,
1718
1729
  // 保留群聊最后一条消息发送者 userId,供会话列表项在资料异步就绪后重新解析昵称
@@ -1732,19 +1743,19 @@ const Ae = T("Conversation");
1732
1743
  function gn(s) {
1733
1744
  return [...s].sort((e, t) => e.isPinned !== t.isPinned ? e.isPinned ? -1 : 1 : e.isPinned ? (t.pinnedTime ?? 0) - (e.pinnedTime ?? 0) : (t.lastMessageTime ?? 0) - (e.lastMessageTime ?? 0));
1734
1745
  }
1735
- function mn(s, e) {
1746
+ function fn(s, e) {
1736
1747
  var o;
1737
1748
  const t = {}, n = [];
1738
1749
  for (const a of s) {
1739
1750
  const r = String(((o = a.lastMessage) == null ? void 0 : o.type) ?? "(null)");
1740
- t[r] = (t[r] ?? 0) + 1, (r === b.COMBINE || r === "unknown") && n.push({
1751
+ t[r] = (t[r] ?? 0) + 1, (r === C.COMBINE || r === "unknown") && n.push({
1741
1752
  conversationId: a.conversationId,
1742
1753
  lastMessage: a.lastMessage
1743
1754
  });
1744
1755
  }
1745
1756
  n.length > 0 && Ae.info(`raw snippets (${e})`, { typeCount: t, suspects: n });
1746
1757
  }
1747
- const fn = 1e3;
1758
+ const mn = 1e3;
1748
1759
  class pn {
1749
1760
  constructor(e, t, n = {}) {
1750
1761
  this.client = e, this.store = t, this.hooks = n, this.channelAckSentAt = /* @__PURE__ */ new Map();
@@ -1761,7 +1772,7 @@ class pn {
1761
1772
  /** 从本地缓存读取会话列表 */
1762
1773
  syncLocal() {
1763
1774
  const e = this.client.chatManager.getConversationList();
1764
- Ae.info("getConversationList raw (syncLocal)", e), mn(e, "syncLocal");
1775
+ Ae.info("getConversationList raw (syncLocal)", e), fn(e, "syncLocal");
1765
1776
  const t = te(e, {
1766
1777
  resolveSenderName: this.hooks.resolveSenderName,
1767
1778
  lastMessageTextResolver: this.hooks.lastMessageTextResolver
@@ -1794,17 +1805,17 @@ class pn {
1794
1805
  const o = [];
1795
1806
  let a;
1796
1807
  do {
1797
- const u = await t(a, 50);
1798
- o.push(...u.list), a = u.hasMore ? u.cursor : void 0;
1808
+ const d = await t(a, 50);
1809
+ o.push(...d.list), a = d.hasMore ? d.cursor : void 0;
1799
1810
  } while (a);
1800
- const r = this.store.conversationList ?? [], i = new Map(r.map((u) => [u.id, u])), c = /* @__PURE__ */ new Map();
1801
- for (const u of o) {
1802
- const m = i.get(u.id);
1803
- c.set(u.id, m ? {
1804
- ...u,
1805
- name: (!u.name || u.name === u.id) && m.name && m.name !== m.id ? m.name : u.name,
1806
- avatar: u.avatar || m.avatar
1807
- } : u);
1811
+ const r = this.store.conversationList ?? [], i = new Map(r.map((d) => [d.id, d])), c = /* @__PURE__ */ new Map();
1812
+ for (const d of o) {
1813
+ const g = i.get(d.id);
1814
+ c.set(d.id, g ? {
1815
+ ...d,
1816
+ name: (!d.name || d.name === d.id) && g.name && g.name !== g.id ? g.name : d.name,
1817
+ avatar: d.avatar || g.avatar
1818
+ } : d);
1808
1819
  }
1809
1820
  this.store.setList(gn(Array.from(c.values())));
1810
1821
  return;
@@ -1897,7 +1908,7 @@ class pn {
1897
1908
  if (n !== void 0 && n <= 0)
1898
1909
  return;
1899
1910
  const o = Date.now(), a = this.channelAckSentAt.get(e) || 0;
1900
- o - a < fn || (this.channelAckSentAt.set(e, o), await this.markRead(e, t));
1911
+ o - a < mn || (this.channelAckSentAt.set(e, o), await this.markRead(e, t));
1901
1912
  }
1902
1913
  /** 加载更多会话:SDK5 当前无分页游标,直接返回本地列表 */
1903
1914
  async loadMore(e) {
@@ -2019,7 +2030,7 @@ class In {
2019
2030
  await this.client.contactManager.removeUserFromBlocklist({ userIds: e });
2020
2031
  }
2021
2032
  }
2022
- function tt(s) {
2033
+ function Le(s) {
2023
2034
  const e = {
2024
2035
  groupId: s.groupId,
2025
2036
  groupName: s.name,
@@ -2031,10 +2042,10 @@ function tt(s) {
2031
2042
  disabled: s.disabled,
2032
2043
  maxUsers: s.maxMembers
2033
2044
  };
2034
- return s.role && (e.role = s.role), "avatarUrl" in s && (e.avatar = s.avatarUrl), "muteAllMembers" in s && (e.mute = s.muteAllMembers), "ownerId" in s && (e.owner = s.ownerId), "owner" in s && s.owner && (e.owner = s.owner.userId), "createdAt" in s && (e.created = s.createdAt), "messageBlocked" in s && (e.shieldgroup = s.messageBlocked), e;
2045
+ return s.role && (e.role = s.role), "avatarUrl" in s && (e.avatar = s.avatarUrl), "muteAllMembers" in s && (e.mute = s.muteAllMembers), "ownerId" in s && (e.owner = s.ownerId), "owner" in s && s.owner && (e.owner = s.owner.userId), "createdAt" in s && (e.created = s.createdAt), "messageBlocked" in s && (e.shieldgroup = s.messageBlocked), "ext" in s && (e.ext = s.ext), "inviteNeedConfirm" in s && (e.inviteNeedConfirm = s.inviteNeedConfirm), "joinedAt" in s && (e.joinedAt = s.joinedAt), e;
2035
2046
  }
2036
- function me(s) {
2037
- return s.map((e) => tt(e));
2047
+ function fe(s) {
2048
+ return s.map((e) => Le(e));
2038
2049
  }
2039
2050
  function Mn(s) {
2040
2051
  const e = s.user, t = {
@@ -2055,7 +2066,7 @@ class yn {
2055
2066
  }
2056
2067
  /** 获取已加入群组本地列表 */
2057
2068
  syncLocal() {
2058
- const e = this.client.groupManager.getJoinedGroupList(), t = me(e);
2069
+ const e = this.client.groupManager.getJoinedGroupList(), t = fe(e);
2059
2070
  return this.store.setList(t), t;
2060
2071
  }
2061
2072
  /**
@@ -2082,7 +2093,7 @@ class yn {
2082
2093
  if (t)
2083
2094
  return t;
2084
2095
  const n = (async () => {
2085
- const o = await this.client.groupManager.getGroupInfo({ groupId: e }), a = tt(o);
2096
+ const o = await this.client.groupManager.getGroupInfo({ groupId: e }), a = Le(o);
2086
2097
  return this.store.updateGroup(e, a), a;
2087
2098
  })();
2088
2099
  Ie.set(e, n);
@@ -2094,7 +2105,7 @@ class yn {
2094
2105
  }
2095
2106
  /** 批量获取群详情 */
2096
2107
  async fetchGroupInfoList(e) {
2097
- const t = await this.client.groupManager.getGroupInfoList({ groupIds: e }), n = me(t);
2108
+ const t = await this.client.groupManager.getGroupInfoList({ groupIds: e }), n = fe(t);
2098
2109
  return n.forEach((o) => this.store.updateGroup(o.groupId, o)), n;
2099
2110
  }
2100
2111
  /** 创建群组(注入 createGroup 时整体委托业务接管:不调 SDK、不写本地缓存,权威数据由业务源负责) */
@@ -2117,12 +2128,13 @@ class yn {
2117
2128
  groupId: n.groupId,
2118
2129
  groupName: e.name,
2119
2130
  description: e.description,
2120
- role: k.OWNER,
2131
+ role: L.OWNER,
2121
2132
  memberCount: (((a = e.memberIds) == null ? void 0 : a.length) ?? 0) + 1,
2122
2133
  maxUsers: e.maxMembers,
2123
2134
  public: e.public ?? !1,
2124
2135
  allowInvites: e.allowInvites ?? !1,
2125
- approval: e.joinApprovalRequired ?? !1
2136
+ approval: e.joinApprovalRequired ?? !1,
2137
+ inviteNeedConfirm: e.inviteNeedConfirm ?? !1
2126
2138
  });
2127
2139
  try {
2128
2140
  await this.fetchGroupInfo(n.groupId);
@@ -2156,7 +2168,8 @@ class yn {
2156
2168
  } catch {
2157
2169
  }
2158
2170
  }
2159
- return { list: a, cursor: o.cursor, hasMore: o.hasMore ?? !1 };
2171
+ const r = new Map(this.store.getGroupMembers(e).map((c) => [c.userId, c]));
2172
+ return { list: a.map((c) => r.get(c.userId) ?? c), cursor: o.cursor, hasMore: o.hasMore ?? !1 };
2160
2173
  }
2161
2174
  /** 拉取并合并群管理员到成员缓存 */
2162
2175
  async syncGroupAdmins(e) {
@@ -2167,14 +2180,14 @@ class yn {
2167
2180
  if ((a = (o = this.store).isGroupAdminSynced) != null && a.call(o, e))
2168
2181
  return;
2169
2182
  const n = (async () => {
2170
- var c, u;
2183
+ var c, d;
2171
2184
  const r = await this.client.groupManager.getGroup(e).getAdmins(), i = Z(
2172
- (r || []).map((m) => ({ user: m, role: k.ADMIN }))
2185
+ (r || []).map((g) => ({ user: g, role: L.ADMIN }))
2173
2186
  );
2174
2187
  this.store.appendGroupMembers(e, i);
2175
- for (const m of i)
2176
- this.store.updateGroupMemberRole(e, m.userId, k.ADMIN);
2177
- (u = (c = this.store).markGroupAdminSynced) == null || u.call(c, e);
2188
+ for (const g of i)
2189
+ this.store.updateGroupMemberRole(e, g.userId, L.ADMIN);
2190
+ (d = (c = this.store).markGroupAdminSynced) == null || d.call(c, e);
2178
2191
  })();
2179
2192
  Me.set(e, n);
2180
2193
  try {
@@ -2217,11 +2230,11 @@ class yn {
2217
2230
  }
2218
2231
  /** 设置群管理员 */
2219
2232
  async addGroupAdmin(e, t) {
2220
- await this.client.groupManager.addGroupAdmin({ groupId: e, userId: t }), this.store.updateGroupMemberRole(e, t, k.ADMIN);
2233
+ await this.client.groupManager.addGroupAdmin({ groupId: e, userId: t }), this.store.updateGroupMemberRole(e, t, L.ADMIN);
2221
2234
  }
2222
2235
  /** 取消群管理员 */
2223
2236
  async removeGroupAdmin(e, t) {
2224
- await this.client.groupManager.removeGroupAdmin({ groupId: e, userId: t }), this.store.updateGroupMemberRole(e, t, k.MEMBER);
2237
+ await this.client.groupManager.removeGroupAdmin({ groupId: e, userId: t }), this.store.updateGroupMemberRole(e, t, L.MEMBER);
2225
2238
  }
2226
2239
  /** 接受群邀请 */
2227
2240
  async acceptGroupInvitation(e) {
@@ -2231,13 +2244,13 @@ class yn {
2231
2244
  async updateGroupInfo(e, t) {
2232
2245
  await this.client.groupManager.getGroup(e).updateInfo(t);
2233
2246
  const n = {};
2234
- t.name !== void 0 && (n.groupName = t.name), t.description !== void 0 && (n.description = t.description), t.avatar !== void 0 && (n.avatar = t.avatar), this.store.updateGroup(e, n);
2247
+ t.name !== void 0 && (n.groupName = t.name), t.description !== void 0 && (n.description = t.description), t.avatar !== void 0 && (n.avatar = t.avatar), t.ext !== void 0 && (n.ext = t.ext), this.store.updateGroup(e, n);
2235
2248
  }
2236
2249
  /** 更新群配置(公开/审批/邀请/最大人数等) */
2237
2250
  async updateGroupConfigs(e, t) {
2238
2251
  await this.client.groupManager.getGroup(e).updateConfigs(t);
2239
2252
  const n = {};
2240
- t.public !== void 0 && (n.public = t.public), t.joinApprovalRequired !== void 0 && (n.approval = t.joinApprovalRequired), t.allowInvites !== void 0 && (n.allowInvites = t.allowInvites), t.maxMembers !== void 0 && (n.maxUsers = t.maxMembers), this.store.updateGroup(e, n);
2253
+ t.public !== void 0 && (n.public = t.public), t.joinApprovalRequired !== void 0 && (n.approval = t.joinApprovalRequired), t.allowInvites !== void 0 && (n.allowInvites = t.allowInvites), t.inviteNeedConfirm !== void 0 && (n.inviteNeedConfirm = t.inviteNeedConfirm), t.maxMembers !== void 0 && (n.maxUsers = t.maxMembers), this.store.updateGroup(e, n);
2241
2254
  }
2242
2255
  /** 开启全员禁言 */
2243
2256
  async muteAllGroupMembers(e) {
@@ -2356,7 +2369,7 @@ function nt(s, e) {
2356
2369
  const t = e.toLowerCase(), n = X.ONLINE.toLowerCase(), o = X.AWAY.toLowerCase(), a = X.BUSY.toLowerCase(), r = X.DO_NOT_DISTURB.toLowerCase(), i = X.OFFLINE.toLowerCase();
2357
2370
  return t === n ? "online" : t === o ? "away" : t === a ? "busy" : t === r ? "doNotDisturb" : t === i ? "offline" : "custom";
2358
2371
  }
2359
- function xe(s) {
2372
+ function Pe(s) {
2360
2373
  const e = s.publisher || "";
2361
2374
  if (!e)
2362
2375
  return null;
@@ -2385,7 +2398,7 @@ class bn {
2385
2398
  expiry: t
2386
2399
  });
2387
2400
  this.store.setSubscribed(e);
2388
- const a = o.map(xe).filter((i) => i !== null);
2401
+ const a = o.map(Pe).filter((i) => i !== null);
2389
2402
  return this.store.updateBatch(a), a;
2390
2403
  }
2391
2404
  /** 取消订阅 */
@@ -2408,7 +2421,7 @@ class bn {
2408
2421
  }
2409
2422
  if (!this.client.isConnected)
2410
2423
  return [];
2411
- const o = (await this.client.presenceManager.getPresenceStatus({ userIds: e })).map(xe).filter((r) => r !== null);
2424
+ const o = (await this.client.presenceManager.getPresenceStatus({ userIds: e })).map(Pe).filter((r) => r !== null);
2412
2425
  return this.store.updateBatch(o), o;
2413
2426
  }
2414
2427
  /** 发布自定义在线状态 */
@@ -2416,7 +2429,7 @@ class bn {
2416
2429
  this.client.isConnected && await this.client.presenceManager.publishPresence({ customStatus: e });
2417
2430
  }
2418
2431
  }
2419
- const F = T("UIKit:UserInfoDomain"), Pe = [
2432
+ const F = T("UIKit:UserInfoDomain"), Be = [
2420
2433
  "nickname",
2421
2434
  "avatarUrl",
2422
2435
  "mail",
@@ -2426,7 +2439,7 @@ const F = T("UIKit:UserInfoDomain"), Pe = [
2426
2439
  "birth",
2427
2440
  "ext"
2428
2441
  ];
2429
- class wn {
2442
+ class Cn {
2430
2443
  constructor(e, t, n = {}, o) {
2431
2444
  this.client = e, this.store = t, this.userInfoRepository = n, this.onSubscriptionPermissionError = o, this.handlerId = "uikit-user-info", this.subscribeQueue = [], this.subscribeFlushPromise = null, this.fetchQueue = [], this.fetchFlushPromise = null, this.hasLoggedPermissionError = !1;
2432
2445
  }
@@ -2444,7 +2457,7 @@ class wn {
2444
2457
  * @param userIds 目标用户 ID 列表
2445
2458
  * @param attributes 需要查询的属性,默认全量 8 个属性
2446
2459
  */
2447
- async fetchUserInfos(e, t = Pe) {
2460
+ async fetchUserInfos(e, t = Be) {
2448
2461
  if (!this.client.isConnected)
2449
2462
  return [];
2450
2463
  const n = Array.from(new Set(e.filter(Boolean)));
@@ -2550,7 +2563,7 @@ class wn {
2550
2563
  /**
2551
2564
  * 获取当前登录用户自己的资料(默认全量属性,保证签名等登录后回显)。
2552
2565
  */
2553
- async fetchOwnInfo(e = Pe) {
2566
+ async fetchOwnInfo(e = Be) {
2554
2567
  const t = this.client.currentUserId;
2555
2568
  if (!t)
2556
2569
  return;
@@ -2633,34 +2646,34 @@ class wn {
2633
2646
  });
2634
2647
  }
2635
2648
  }
2636
- const _ = T("UIKit:ConnEvents");
2637
- function Cn(s, e = {}) {
2649
+ const N = T("UIKit:ConnEvents");
2650
+ function wn(s, e = {}) {
2638
2651
  return {
2639
2652
  onConnecting: () => {
2640
- _.info("onConnecting"), s.client.setConnecting(!0);
2653
+ N.info("onConnecting"), s.client.setConnecting(!0);
2641
2654
  },
2642
2655
  onConnected: () => {
2643
- _.info("onConnected"), s.client.setConnected(!0), s.client.setConnecting(!1), s.client.setHasConnectedOnce(!0);
2656
+ N.info("onConnected"), s.client.setConnected(!0), s.client.setConnecting(!1), s.client.setHasConnectedOnce(!0);
2644
2657
  },
2645
2658
  onDisconnected: (t) => {
2646
- _.info("onDisconnected", t ? { reason: t.reason, errorCode: t.errorCode } : void 0), s.client.setConnected(!1), s.client.setConnecting(!1), bt(t == null ? void 0 : t.errorCode) && s.client.setKicked(t.errorCode);
2659
+ N.info("onDisconnected", t ? { reason: t.reason, errorCode: t.errorCode } : void 0), s.client.setConnected(!1), s.client.setConnecting(!1), bt(t == null ? void 0 : t.errorCode) && s.client.setKicked(t.errorCode);
2647
2660
  },
2648
2661
  onReconnectFailed: () => {
2649
- _.info("onReconnectFailed"), s.client.setConnecting(!1), _.error("Auto-reconnect failed after max retries");
2662
+ N.info("onReconnectFailed"), s.client.setConnecting(!1), N.error("Auto-reconnect failed after max retries");
2650
2663
  },
2651
2664
  onTokenWillExpire: () => {
2652
2665
  var t;
2653
- _.info("onTokenWillExpire"), _.warn("Token will expire"), (t = e.onTokenWillExpire) == null || t.call(e);
2666
+ N.info("onTokenWillExpire"), N.warn("Token will expire"), (t = e.onTokenWillExpire) == null || t.call(e);
2654
2667
  },
2655
2668
  onTokenExpired: () => {
2656
2669
  var t;
2657
- _.info("onTokenExpired"), _.error("Token expired"), (t = e.onTokenExpired) == null || t.call(e);
2670
+ N.info("onTokenExpired"), N.error("Token expired"), (t = e.onTokenExpired) == null || t.call(e);
2658
2671
  },
2659
2672
  onOfflineMessageSyncStart: () => {
2660
- _.info("onOfflineMessageSyncStart"), s.conversation.conversationsLoaded || s.message.setSyncingMessages(!0);
2673
+ N.info("onOfflineMessageSyncStart"), s.conversation.conversationsLoaded || s.message.setSyncingMessages(!0);
2661
2674
  },
2662
2675
  onOfflineMessageSyncFinish: () => {
2663
- _.info("onOfflineMessageSyncFinish"), s.message.setSyncingMessages(!1);
2676
+ N.info("onOfflineMessageSyncFinish"), s.message.setSyncingMessages(!1);
2664
2677
  }
2665
2678
  };
2666
2679
  }
@@ -2690,9 +2703,9 @@ function An() {
2690
2703
  st.info("sync status reset(事件反注册/登出)");
2691
2704
  }
2692
2705
  function es() {
2693
- const s = fe(() => ({ ...z })), e = fe(
2706
+ const s = me(() => ({ ...z })), e = me(
2694
2707
  () => Object.values(z).some((n) => n.status === "syncing")
2695
- ), t = fe(
2708
+ ), t = me(
2696
2709
  () => Object.values(z).every((n) => n.status === "success" || n.status === "failed")
2697
2710
  );
2698
2711
  return { status: s, isSyncing: e, allFinished: t };
@@ -2757,7 +2770,7 @@ function ot(s, e) {
2757
2770
  return a != null && a.nickname ? a.nickname : a != null && a.remark ? a.remark : t;
2758
2771
  }
2759
2772
  function Rn(s, e) {
2760
- var d;
2773
+ var u;
2761
2774
  const { useNotification: t, emitNotificationDelivered: n } = B(), { state: o, notify: a, notifyBrowser: r } = t();
2762
2775
  if (!o.value.enabled || E(e.from) === E(s.client.currentUser) || e.conversationId === s.conversation.currentConversationId)
2763
2776
  return;
@@ -2767,37 +2780,37 @@ function Rn(s, e) {
2767
2780
  const c = typeof document > "u" || document.visibilityState === "hidden";
2768
2781
  if (o.value.triggerMode === "background" && !c)
2769
2782
  return;
2770
- const u = P(e, s.client.currentUser), m = ot(s, u), f = u.conversationType === I.GROUPCHAT, g = {
2783
+ const d = P(e, s.client.currentUser), g = ot(s, d), m = d.conversationType === M.GROUPCHAT, p = {
2771
2784
  // 群聊标题为群名(正文含 "发送者: 内容" 前缀),单聊标题为发送者名
2772
- title: f && (i == null ? void 0 : i.name) || m,
2773
- body: wt(u, void 0, m, void 0, Ue),
2785
+ title: m && (i == null ? void 0 : i.name) || g,
2786
+ body: Ct(d, void 0, g, void 0, Ue),
2774
2787
  // 群聊用群头像,单聊用发送者头像
2775
- avatar: f ? i == null ? void 0 : i.avatar : (d = s.userInfo.getUserInfo(e.from)) == null ? void 0 : d.avatarUrl,
2776
- timestamp: u.timestamp || Date.now(),
2788
+ avatar: m ? i == null ? void 0 : i.avatar : (u = s.userInfo.getUserInfo(e.from)) == null ? void 0 : u.avatarUrl,
2789
+ timestamp: d.timestamp || Date.now(),
2777
2790
  conversationId: e.conversationId,
2778
- conversationType: u.conversationType
2791
+ conversationType: d.conversationType
2779
2792
  };
2780
- c && o.value.browserEnabled ? r(g).then((l) => {
2781
- l ? n(g, "browser") : o.value.inAppEnabled && (a(g), n(g, "in-app"));
2782
- }) : o.value.inAppEnabled && (a(g), n(g, "in-app"));
2793
+ c && o.value.browserEnabled ? r(p).then((l) => {
2794
+ l ? n(p, "browser") : o.value.inAppEnabled && (a(p), n(p, "in-app"));
2795
+ }) : o.value.inAppEnabled && (a(p), n(p, "in-app"));
2783
2796
  }
2784
- function Be(s, e, t) {
2785
- const { t: n, useNotification: o, emitNotificationDelivered: a, resolveNoticeUserName: r } = B(), { state: i, notify: c, notifyBrowser: u } = o();
2797
+ function Fe(s, e, t) {
2798
+ const { t: n, useNotification: o, emitNotificationDelivered: a, resolveNoticeUserName: r } = B(), { state: i, notify: c, notifyBrowser: d } = o();
2786
2799
  if (!i.value.enabled)
2787
2800
  return;
2788
- const m = s.userInfo.getUserInfo(e), f = {
2789
- title: r(m) || e,
2801
+ const g = s.userInfo.getUserInfo(e), m = {
2802
+ title: r(g) || e,
2790
2803
  body: n(t === "declined" ? "contact.inviteDeclinedByPeer" : "chat.notice.contactDeleted"),
2791
- avatar: m == null ? void 0 : m.avatarUrl,
2804
+ avatar: g == null ? void 0 : g.avatarUrl,
2792
2805
  timestamp: Date.now(),
2793
2806
  conversationId: e,
2794
- conversationType: I.SINGLECHAT
2807
+ conversationType: M.SINGLECHAT
2795
2808
  };
2796
- (typeof document > "u" || document.visibilityState === "hidden") && i.value.browserEnabled ? u(f).then((d) => {
2797
- d ? a(f, "browser") : i.value.inAppEnabled && (c(f), a(f, "in-app"));
2798
- }) : i.value.inAppEnabled && (c(f), a(f, "in-app"));
2809
+ (typeof document > "u" || document.visibilityState === "hidden") && i.value.browserEnabled ? d(m).then((u) => {
2810
+ u ? a(m, "browser") : i.value.inAppEnabled && (c(m), a(m, "in-app"));
2811
+ }) : i.value.inAppEnabled && (c(m), a(m, "in-app"));
2799
2812
  }
2800
- const M = T("UIKit:ChatEvents"), le = /* @__PURE__ */ new Set(), Te = /* @__PURE__ */ new Set(), $ = /* @__PURE__ */ new Map();
2813
+ const y = T("UIKit:ChatEvents"), le = /* @__PURE__ */ new Set(), Te = /* @__PURE__ */ new Set(), $ = /* @__PURE__ */ new Map();
2801
2814
  let ge = !1;
2802
2815
  function Un() {
2803
2816
  le.clear(), Te.clear(), $.clear(), ge = !1;
@@ -2811,18 +2824,18 @@ function Ln(s, e, t, n) {
2811
2824
  const r = Array.from($.entries());
2812
2825
  $.clear();
2813
2826
  for (const [i, c] of r) {
2814
- const [u, m] = i.split(":");
2815
- for (let f = 0; f < c.length; f += 50) {
2816
- const g = c.slice(f, f + 50);
2817
- M.info("[queueMessageReadReceipt] 批量发送已读回执", { conversationType: u, conversationId: m, batchSize: g.length, messageIds: g });
2827
+ const [d, g] = i.split(":");
2828
+ for (let m = 0; m < c.length; m += 50) {
2829
+ const p = c.slice(m, m + 50);
2830
+ y.info("[queueMessageReadReceipt] 批量发送已读回执", { conversationType: d, conversationId: g, batchSize: p.length, messageIds: p });
2818
2831
  try {
2819
2832
  await s.chatManager.sendMessageReadReceipts({
2820
- conversationId: m,
2821
- conversationType: u,
2822
- messageIds: g
2823
- }), an(g), M.info("[queueMessageReadReceipt] 已读回执发送成功", { conversationType: u, conversationId: m, messageIds: g });
2824
- } catch (d) {
2825
- M.warn("[queueMessageReadReceipt] sendMessageReadReceipts failed:", { conversationType: u, conversationId: m, messageIds: g, err: d });
2833
+ conversationId: g,
2834
+ conversationType: d,
2835
+ messageIds: p
2836
+ }), an(p), y.info("[queueMessageReadReceipt] 已读回执发送成功", { conversationType: d, conversationId: g, messageIds: p });
2837
+ } catch (u) {
2838
+ y.warn("[queueMessageReadReceipt] sendMessageReadReceipts failed:", { conversationType: d, conversationId: g, messageIds: p, err: u });
2826
2839
  }
2827
2840
  }
2828
2841
  }
@@ -2848,17 +2861,17 @@ async function Dn(s, e) {
2848
2861
  });
2849
2862
  }
2850
2863
  } catch (o) {
2851
- M.warn("patch conversation mute states failed:", o);
2864
+ y.warn("patch conversation mute states failed:", o);
2852
2865
  }
2853
2866
  }
2854
2867
  async function oe(s, e) {
2855
2868
  const t = new Map(s.group.groupList.map((o) => [o.groupId, o.groupName])), n = [];
2856
2869
  for (const o of s.conversation.conversationList)
2857
2870
  if ((!o.name || o.name === o.id) && !Te.has(o.id)) {
2858
- if (o.type === I.GROUPCHAT) {
2871
+ if (o.type === M.GROUPCHAT) {
2859
2872
  const r = t.get(o.id);
2860
2873
  r && r !== o.id ? s.conversation.updateConversation(o.id, { name: r }) : le.has(o.id) || n.push(o.id);
2861
- } else if (o.type === I.SINGLECHAT) {
2874
+ } else if (o.type === M.SINGLECHAT) {
2862
2875
  const r = s.contact.getContact(o.id), i = s.userInfo.getUserInfo(o.id), c = (r == null ? void 0 : r.remark) || (r == null ? void 0 : r.name) || (i == null ? void 0 : i.nickname);
2863
2876
  c && s.conversation.updateConversation(o.id, { name: c });
2864
2877
  }
@@ -2867,11 +2880,11 @@ async function oe(s, e) {
2867
2880
  for (const o of n)
2868
2881
  le.add(o), Te.add(o);
2869
2882
  try {
2870
- const o = await e.groupManager.getGroupInfoList({ groupIds: n }), a = me(o);
2883
+ const o = await e.groupManager.getGroupInfoList({ groupIds: n }), a = fe(o);
2871
2884
  for (const r of a)
2872
2885
  s.group.updateGroup(r.groupId, r), r.groupName && r.groupName !== r.groupId && s.conversation.updateConversation(r.groupId, { name: r.groupName });
2873
2886
  } catch (o) {
2874
- M.warn("fetch missing group names failed:", o);
2887
+ y.warn("fetch missing group names failed:", o);
2875
2888
  } finally {
2876
2889
  for (const o of n) le.delete(o);
2877
2890
  }
@@ -2879,35 +2892,35 @@ async function oe(s, e) {
2879
2892
  }
2880
2893
  function _n(s, e, t, n) {
2881
2894
  const o = s.message.getMessages(e), a = o.findIndex(
2882
- (f) => f.msgServerId === n || f.msgLocalId === n
2895
+ (m) => m.msgServerId === n || m.msgLocalId === n
2883
2896
  );
2884
2897
  if (a === -1 || a !== o.length - 1)
2885
2898
  return;
2886
- const r = o[a], i = s.conversation.conversationList.find((f) => f.id === e);
2899
+ const r = o[a], i = s.conversation.conversationList.find((m) => m.id === e);
2887
2900
  if (!i || i.lastMessageTime && r.timestamp < i.lastMessageTime - 1e3)
2888
2901
  return;
2889
- const u = t === I.GROUPCHAT ? ot(s, r) : void 0, { t: m } = B();
2902
+ const d = t === M.GROUPCHAT ? ot(s, r) : void 0, { t: g } = B();
2890
2903
  s.conversation.updateConversation(e, {
2891
- lastMessageText: Ye(
2904
+ lastMessageText: Xe(
2892
2905
  t,
2893
- u,
2894
- m("message.recalledPreview")
2906
+ d,
2907
+ g("message.recalledPreview")
2895
2908
  )
2896
2909
  });
2897
2910
  }
2898
2911
  function x(s) {
2899
- Promise.resolve().then(s).catch((e) => M.warn("persistence 钩子执行失败(已忽略):", e));
2912
+ Promise.resolve().then(s).catch((e) => y.warn("persistence 钩子执行失败(已忽略):", e));
2900
2913
  }
2901
- function Fe(s, e) {
2914
+ function He(s, e) {
2902
2915
  const t = s.conversation.conversationList, n = new Set(e.map((r) => r.id)), o = e.map((r) => {
2903
- const i = t.find((m) => m.id === r.id);
2916
+ const i = t.find((g) => g.id === r.id);
2904
2917
  if (!i)
2905
2918
  return r;
2906
- const c = (!r.name || r.name === r.id) && i.name && i.name !== i.id, u = !r.avatar && i.avatar;
2919
+ const c = (!r.name || r.name === r.id) && i.name && i.name !== i.id, d = !r.avatar && i.avatar;
2907
2920
  return {
2908
2921
  ...r,
2909
2922
  name: c ? i.name : r.name,
2910
- avatar: u ? i.avatar : r.avatar,
2923
+ avatar: d ? i.avatar : r.avatar,
2911
2924
  // SDK 快照不携带的本地字段保留(草稿)
2912
2925
  draft: r.draft ?? i.draft,
2913
2926
  draftTime: r.draftTime ?? i.draftTime,
@@ -2920,22 +2933,22 @@ function Fe(s, e) {
2920
2933
  return [...o, ...a];
2921
2934
  }
2922
2935
  function Nn(s, e, t, n, o) {
2923
- var g;
2924
- const a = (d) => Tn(e, d), {
2936
+ var p;
2937
+ const a = (u) => Tn(e, u), {
2925
2938
  saveMessage: r,
2926
2939
  updateMessageStatus: i,
2927
2940
  markMessageRecalled: c,
2928
- updateMessageContent: u,
2929
- deleteMessages: m
2930
- } = (n == null ? void 0 : n.message) ?? {}, f = (g = n == null ? void 0 : n.conversation) == null ? void 0 : g.saveConversations;
2941
+ updateMessageContent: d,
2942
+ deleteMessages: g
2943
+ } = (n == null ? void 0 : n.message) ?? {}, m = (p = n == null ? void 0 : n.conversation) == null ? void 0 : p.saveConversations;
2931
2944
  return {
2932
- onSyncDataStart: (d) => {
2933
- M.info("onSyncDataStart", { dataType: d.dataType }), be(d.dataType, { status: "syncing" }), d.dataType === "conversation" && e.conversation.setSyncingConversations(!0);
2945
+ onSyncDataStart: (u) => {
2946
+ y.info("onSyncDataStart", { dataType: u.dataType }), be(u.dataType, { status: "syncing" }), u.dataType === "conversation" && e.conversation.setSyncingConversations(!0);
2934
2947
  },
2935
- onSyncDataFinished: (d) => {
2936
- if (M.info("onSyncDataFinished", { dataType: d.dataType, status: d.status }), d.status === "failed") {
2937
- const l = d.error;
2938
- be(d.dataType, {
2948
+ onSyncDataFinished: (u) => {
2949
+ if (y.info("onSyncDataFinished", { dataType: u.dataType, status: u.status }), u.status === "failed") {
2950
+ const l = u.error;
2951
+ be(u.dataType, {
2939
2952
  status: "failed",
2940
2953
  finishedAt: Date.now(),
2941
2954
  error: {
@@ -2943,95 +2956,95 @@ function Nn(s, e, t, n, o) {
2943
2956
  retryable: l == null ? void 0 : l.retryable,
2944
2957
  message: l == null ? void 0 : l.message
2945
2958
  }
2946
- }), M.warn("[ChatEvents] 数据同步失败", {
2947
- dataType: d.dataType,
2959
+ }), y.warn("[ChatEvents] 数据同步失败", {
2960
+ dataType: u.dataType,
2948
2961
  stage: l == null ? void 0 : l.stage,
2949
2962
  retryable: l == null ? void 0 : l.retryable,
2950
2963
  message: l == null ? void 0 : l.message
2951
- }), d.dataType === "conversation" && (e.conversation.setSyncingConversations(!1), l != null && l.retryable && s.chatManager.refreshSessionList().catch((p) => {
2952
- M.warn("[ChatEvents] conversation 同步失败重试未成功:", U(p));
2964
+ }), u.dataType === "conversation" && (e.conversation.setSyncingConversations(!1), l != null && l.retryable && s.chatManager.refreshSessionList().catch((f) => {
2965
+ y.warn("[ChatEvents] conversation 同步失败重试未成功:", U(f));
2953
2966
  }));
2954
2967
  return;
2955
2968
  }
2956
- switch (be(d.dataType, { status: "success", finishedAt: Date.now() }), d.dataType) {
2969
+ switch (be(u.dataType, { status: "success", finishedAt: Date.now() }), u.dataType) {
2957
2970
  case "conversation":
2958
2971
  e.conversation.setSyncingConversations(!1);
2959
2972
  {
2960
2973
  const l = s.chatManager.getConversationList().filter((v) => v.conversationType !== "chatRoom");
2961
- M.info("getConversationList raw (onSyncDataFinished)", l);
2962
- const p = te(l, { resolveSenderName: a, lastMessageTextResolver: o }), h = Fe(e, p);
2963
- e.conversation.setConversationList(h), M.info("conversation 同步回填", { count: h.length }), f && x(() => f(h.map(De)));
2974
+ y.info("getConversationList raw (onSyncDataFinished)", l);
2975
+ const f = te(l, { resolveSenderName: a, lastMessageTextResolver: o }), h = He(e, f);
2976
+ e.conversation.setConversationList(h), y.info("conversation 同步回填", { count: h.length }), m && x(() => m(h.map(_e)));
2964
2977
  }
2965
2978
  e.conversation.setConversationsLoaded(!0), oe(e, s), Dn(e, s);
2966
2979
  break;
2967
2980
  case "contact":
2968
2981
  if (!e.contact.loaded || e.contact.contactList.length === 0) {
2969
2982
  const l = s.contactManager.getContacts();
2970
- e.contact.setContactList(Ge(l)), M.info("contact 同步回填", { count: l.length });
2983
+ e.contact.setContactList(Ge(l)), y.info("contact 同步回填", { count: l.length });
2971
2984
  } else
2972
- M.info("contact 同步回填跳过(列表已由业务方填充)", { count: e.contact.contactList.length });
2985
+ y.info("contact 同步回填跳过(列表已由业务方填充)", { count: e.contact.contactList.length });
2973
2986
  oe(e, s);
2974
2987
  break;
2975
2988
  case "group":
2976
2989
  if (!e.group.loaded || e.group.groupList.length === 0) {
2977
2990
  const l = s.groupManager.getJoinedGroupList();
2978
- e.group.setGroupList(me(l)), M.info("group 同步回填", { count: l.length });
2991
+ e.group.setGroupList(fe(l)), y.info("group 同步回填", { count: l.length });
2979
2992
  } else
2980
- M.info("group 同步回填跳过(列表已由业务方填充)", { count: e.group.groupList.length });
2993
+ y.info("group 同步回填跳过(列表已由业务方填充)", { count: e.group.groupList.length });
2981
2994
  oe(e, s);
2982
2995
  break;
2983
2996
  }
2984
2997
  },
2985
- onConversationListUpdate: (d) => {
2998
+ onConversationListUpdate: (u) => {
2986
2999
  var w;
2987
- const l = d.items.filter((y) => y.conversationType !== "chatRoom");
2988
- M.info("onConversationListUpdate", { count: l.length, reset: d.patch.reset, removed: d.patch.removed.length }), M.info("getConversationList raw (onConversationListUpdate)", l);
3000
+ const l = u.items.filter((I) => I.conversationType !== "chatRoom");
3001
+ y.info("onConversationListUpdate", { count: l.length, reset: u.patch.reset, removed: u.patch.removed.length }), y.info("getConversationList raw (onConversationListUpdate)", l);
2989
3002
  {
2990
- const y = {}, G = [];
3003
+ const I = {}, G = [];
2991
3004
  for (const q of l) {
2992
3005
  const R = String(((w = q.lastMessage) == null ? void 0 : w.type) ?? "(null)");
2993
- y[R] = (y[R] ?? 0) + 1, (R === b.COMBINE || R === "unknown") && G.push({ conversationId: q.conversationId, lastMessage: q.lastMessage });
3006
+ I[R] = (I[R] ?? 0) + 1, (R === C.COMBINE || R === "unknown") && G.push({ conversationId: q.conversationId, lastMessage: q.lastMessage });
2994
3007
  }
2995
- G.length > 0 && M.info("raw snippets (onConversationListUpdate)", { typeCount: y, suspects: G });
3008
+ G.length > 0 && y.info("raw snippets (onConversationListUpdate)", { typeCount: I, suspects: G });
2996
3009
  }
2997
- const p = te(l, { resolveSenderName: a, lastMessageTextResolver: o }), h = Fe(e, p), v = new Set(d.patch.removed.map((y) => y.conversationId)), S = v.size > 0 ? h.filter((y) => !v.has(y.id)) : h;
2998
- if (d.patch.reset || d.patch.removed.length > 0)
2999
- e.conversation.setConversationList(S);
3010
+ const f = te(l, { resolveSenderName: a, lastMessageTextResolver: o }), h = He(e, f), v = new Set(u.patch.removed.map((I) => I.conversationId)), b = v.size > 0 ? h.filter((I) => !v.has(I.id)) : h;
3011
+ if (u.patch.reset || u.patch.removed.length > 0)
3012
+ e.conversation.setConversationList(b);
3000
3013
  else
3001
- for (const y of S) {
3002
- const G = e.conversation.conversationList.find((q) => q.id === y.id);
3003
- G ? G !== y && e.conversation.updateConversation(y.id, y) : e.conversation.addConversation(y);
3014
+ for (const I of b) {
3015
+ const G = e.conversation.conversationList.find((q) => q.id === I.id);
3016
+ G ? G !== I && e.conversation.updateConversation(I.id, I) : e.conversation.addConversation(I);
3004
3017
  }
3005
- f && x(() => f(S.map(De))), oe(e, s);
3018
+ m && x(() => m(b.map(_e))), oe(e, s);
3006
3019
  },
3007
- onMessage: (d) => {
3008
- var S, w, y;
3009
- if (d.conversationType === "chatRoom")
3020
+ onMessage: (u) => {
3021
+ var b, w, I;
3022
+ if (u.conversationType === "chatRoom")
3010
3023
  return;
3011
- if (d.type === b.CMD) {
3012
- const G = d.body.action;
3013
- M.info("[CMD received]", {
3014
- conversationId: d.conversationId,
3015
- from: d.from,
3024
+ if (u.type === C.CMD) {
3025
+ const G = u.body.action;
3026
+ y.info("[CMD received]", {
3027
+ conversationId: u.conversationId,
3028
+ from: u.from,
3016
3029
  action: G,
3017
- ext: d.ext
3018
- }), G === "TypingBegin" && (t == null ? void 0 : t.enableTyping) !== !1 && d.conversationType === I.SINGLECHAT && E(d.from) !== E(e.client.currentUser) && e.conversation.setTyping(d.conversationId, d.from);
3030
+ ext: u.ext
3031
+ }), G === "TypingBegin" && (t == null ? void 0 : t.enableTyping) !== !1 && u.conversationType === M.SINGLECHAT && E(u.from) !== E(e.client.currentUser) && e.conversation.setTyping(u.conversationId, u.from);
3019
3032
  return;
3020
3033
  }
3021
- M.info("onMessage", { conversationId: d.conversationId, from: d.from, type: d.type });
3022
- const l = P(d, e.client.currentUser), p = e.message.getMessages(d.conversationId).find((G) => G.msgServerId === d.msgServerId);
3023
- p != null && p.stream && Ct(p.stream.status) ? e.message.replaceMessageById(d.msgServerId, l) : e.message.addMessage(l), l.type === b.VOICE && !l.isSelf && ((w = (S = e.message).markVoiceUnplayed) == null || w.call(S, l.msgServerId || l.msgLocalId)), r && x(() => r(Ce(d)));
3034
+ y.info("onMessage", { conversationId: u.conversationId, from: u.from, type: u.type });
3035
+ const l = P(u, e.client.currentUser), f = e.message.getMessages(u.conversationId).find((G) => G.msgServerId === u.msgServerId);
3036
+ f != null && f.stream && wt(f.stream.status) ? e.message.replaceMessageById(u.msgServerId, l) : e.message.addMessage(l), l.type === C.VOICE && !l.isSelf && ((w = (b = e.message).markVoiceUnplayed) == null || w.call(b, l.msgServerId || l.msgLocalId)), r && x(() => r(we(u)));
3024
3037
  const h = e.conversation.currentConversationId, v = typeof document > "u" || document.visibilityState === "visible";
3025
- if (h && d.conversationId === h && E(d.from) !== E(e.client.currentUser) && v && (s.chatManager.clearConversationUnreadMessageCount({
3026
- conversationId: d.conversationId,
3027
- conversationType: d.conversationType
3038
+ if (h && u.conversationId === h && E(u.from) !== E(e.client.currentUser) && v && (s.chatManager.clearConversationUnreadMessageCount({
3039
+ conversationId: u.conversationId,
3040
+ conversationType: u.conversationType
3028
3041
  }).catch((G) => {
3029
- M.warn("[UIKit] auto clearConversationUnreadMessageCount failed:", U(G));
3030
- }), (t == null ? void 0 : t.enableReadReceipt) !== !1 && (d.conversationType === I.SINGLECHAT || d.conversationType === I.GROUPCHAT) && Ln(s, d.conversationType, d.conversationId, d.msgServerId)), (t == null ? void 0 : t.enableAtMe) !== !1 && d.conversationType === I.GROUPCHAT && E(d.from) !== E(e.client.currentUser)) {
3031
- const G = (y = d.ext) == null ? void 0 : y.em_at_list;
3032
- Array.isArray(G) && G.includes(e.client.currentUser) && (e.conversation.setAtMe(d.conversationId, !0), e.message.addAtMeMessage(d.conversationId, l.msgServerId || l.msgLocalId));
3042
+ y.warn("[UIKit] auto clearConversationUnreadMessageCount failed:", U(G));
3043
+ }), (t == null ? void 0 : t.enableReadReceipt) !== !1 && (u.conversationType === M.SINGLECHAT || u.conversationType === M.GROUPCHAT) && Ln(s, u.conversationType, u.conversationId, u.msgServerId)), (t == null ? void 0 : t.enableAtMe) !== !1 && u.conversationType === M.GROUPCHAT && E(u.from) !== E(e.client.currentUser)) {
3044
+ const G = (I = u.ext) == null ? void 0 : I.em_at_list;
3045
+ Array.isArray(G) && G.includes(e.client.currentUser) && (e.conversation.setAtMe(u.conversationId, !0), e.message.addAtMeMessage(u.conversationId, l.msgServerId || l.msgLocalId));
3033
3046
  }
3034
- Rn(e, d);
3047
+ Rn(e, u);
3035
3048
  },
3036
3049
  /**
3037
3050
  * 流式消息(边生成边下发,典型 AI 对话)分片合并。
@@ -3041,141 +3054,141 @@ function Nn(s, e, t, n, o) {
3041
3054
  * - `stream` 状态整体挂载到消息上,供渲染层展示传输中光标 / 终态收敛 / 异常提示,
3042
3055
  * 也供插件插槽按 `customType` 接管(markdown 等富类型)。
3043
3056
  */
3044
- onStreamMessage: (d) => {
3045
- if (d.conversationType === "chatRoom")
3057
+ onStreamMessage: (u) => {
3058
+ if (u.conversationType === "chatRoom")
3046
3059
  return;
3047
- const l = d.stream;
3060
+ const l = u.stream;
3048
3061
  if (!l)
3049
3062
  return;
3050
- M.info("onStreamMessage", {
3051
- conversationId: d.conversationId,
3052
- from: d.from,
3053
- msgServerId: d.msgServerId,
3063
+ y.info("onStreamMessage", {
3064
+ conversationId: u.conversationId,
3065
+ from: u.from,
3066
+ msgServerId: u.msgServerId,
3054
3067
  seq: l.seq,
3055
3068
  status: l.status,
3056
3069
  customType: l.customType
3057
3070
  });
3058
- const p = d.msgServerId || d.msgLocalId;
3059
- if (!p)
3071
+ const f = u.msgServerId || u.msgLocalId;
3072
+ if (!f)
3060
3073
  return;
3061
- if (!e.message.getMessages(d.conversationId).some(
3062
- (v) => v.msgServerId === d.msgServerId || d.msgLocalId !== void 0 && v.msgLocalId === d.msgLocalId
3074
+ if (!e.message.getMessages(u.conversationId).some(
3075
+ (v) => v.msgServerId === u.msgServerId || u.msgLocalId !== void 0 && v.msgLocalId === u.msgLocalId
3063
3076
  )) {
3064
- e.message.addMessage(P(d, e.client.currentUser));
3077
+ e.message.addMessage(P(u, e.client.currentUser));
3065
3078
  return;
3066
3079
  }
3067
- e.message.updateMessageById(p, {
3068
- body: { ...d.body, content: l.fullText },
3080
+ e.message.updateMessageById(f, {
3081
+ body: { ...u.body, content: l.fullText },
3069
3082
  stream: { ...l }
3070
3083
  });
3071
3084
  },
3072
- onMessageRecalled: (d) => {
3073
- d.conversationType !== "chatRoom" && (M.info("onMessageRecalled", { messageId: d.messageId }), e.message.recallMessage(d.messageId, e.client.currentUser), c && x(() => c(d.messageId, e.client.currentUser)), _n(
3085
+ onMessageRecalled: (u) => {
3086
+ u.conversationType !== "chatRoom" && (y.info("onMessageRecalled", { messageId: u.messageId }), e.message.recallMessage(u.messageId, e.client.currentUser), c && x(() => c(u.messageId, e.client.currentUser)), _n(
3074
3087
  e,
3075
- d.conversationId,
3076
- d.conversationType,
3077
- d.messageId
3088
+ u.conversationId,
3089
+ u.conversationType,
3090
+ u.messageId
3078
3091
  ));
3079
3092
  },
3080
- onMessageDelivered: (d) => {
3081
- M.info("onMessageDelivered", { messageId: d.messageId }), e.message.updateMessageStatus(d.messageId, O.DELIVERED), i && x(() => i(d.messageId, O.DELIVERED));
3093
+ onMessageDelivered: (u) => {
3094
+ y.info("onMessageDelivered", { messageId: u.messageId }), e.message.updateMessageStatus(u.messageId, O.DELIVERED), i && x(() => i(u.messageId, O.DELIVERED));
3082
3095
  },
3083
- onMessageReadReceipts: (d) => {
3084
- for (const l of d)
3085
- if (l.conversationType === I.GROUPCHAT) {
3086
- M.info("onMessageReadReceipts(group)", {
3096
+ onMessageReadReceipts: (u) => {
3097
+ for (const l of u)
3098
+ if (l.conversationType === M.GROUPCHAT) {
3099
+ y.info("onMessageReadReceipts(group)", {
3087
3100
  conversationId: l.conversationId,
3088
- details: l.receiptDetails.map((p) => ({ messageId: p.messageId, count: p.count }))
3101
+ details: l.receiptDetails.map((f) => ({ messageId: f.messageId, count: f.count }))
3089
3102
  });
3090
- for (const p of l.receiptDetails)
3091
- e.message.updateMessageById(p.messageId, { groupReadCount: p.count });
3103
+ for (const f of l.receiptDetails)
3104
+ e.message.updateMessageById(f.messageId, { groupReadCount: f.count });
3092
3105
  } else {
3093
- M.info("onMessageReadReceipts(single)", {
3106
+ y.info("onMessageReadReceipts(single)", {
3094
3107
  conversationId: l.conversationId,
3095
3108
  total: l.messageIds.length,
3096
3109
  messageIds: l.messageIds.slice(0, 5)
3097
3110
  });
3098
- for (const p of l.messageIds)
3099
- e.message.updateMessageStatus(p, O.READ), i && x(() => i(p, O.READ));
3111
+ for (const f of l.messageIds)
3112
+ e.message.updateMessageStatus(f, O.READ), i && x(() => i(f, O.READ));
3100
3113
  }
3101
3114
  },
3102
- onMessageUpdated: (d) => {
3103
- d.conversationType !== "chatRoom" && (M.info("onMessageUpdated", { messageId: d.messageId }), e.message.updateMessageById(d.messageId, {
3104
- body: d.message.body,
3105
- ext: d.message.ext,
3106
- modifiedInfo: d.message.modifiedInfo,
3115
+ onMessageUpdated: (u) => {
3116
+ u.conversationType !== "chatRoom" && (y.info("onMessageUpdated", { messageId: u.messageId }), e.message.updateMessageById(u.messageId, {
3117
+ body: u.message.body,
3118
+ ext: u.message.ext,
3119
+ modifiedInfo: u.message.modifiedInfo,
3107
3120
  modified: !0
3108
- }), u && x(() => u(
3109
- d.messageId,
3110
- d.message.body,
3111
- d.message.ext,
3112
- d.message.modifiedInfo
3121
+ }), d && x(() => d(
3122
+ u.messageId,
3123
+ u.message.body,
3124
+ u.message.ext,
3125
+ u.message.modifiedInfo
3113
3126
  )));
3114
3127
  },
3115
- onPinnedMessageChanged: async (d) => {
3116
- if (d.conversationType !== "chatRoom" && (M.info("onPinnedMessageChanged", { conversationId: d.conversationId, operation: d.operation }), !!d.messageId && (d.operation === "pin" ? e.message.setMessagePinned(d.messageId, {
3117
- operatorId: d.operatorId || "",
3118
- pinTime: d.pinTime || Date.now()
3119
- }) : d.operation === "unpin" && e.message.setMessageUnpinned(d.messageId), d.conversationId && d.conversationType)))
3128
+ onPinnedMessageChanged: async (u) => {
3129
+ if (u.conversationType !== "chatRoom" && (y.info("onPinnedMessageChanged", { conversationId: u.conversationId, operation: u.operation }), !!u.messageId && (u.operation === "pin" ? e.message.setMessagePinned(u.messageId, {
3130
+ operatorId: u.operatorId || "",
3131
+ pinTime: u.pinTime || Date.now()
3132
+ }) : u.operation === "unpin" && e.message.setMessageUnpinned(u.messageId), u.conversationId && u.conversationType)))
3120
3133
  try {
3121
- const p = (await s.chatManager.getPinnedMessageList({
3122
- conversationId: d.conversationId,
3123
- conversationType: d.conversationType
3134
+ const f = (await s.chatManager.getPinnedMessageList({
3135
+ conversationId: u.conversationId,
3136
+ conversationType: u.conversationType
3124
3137
  })).items.map((h) => P(h.message, e.client.currentUser));
3125
- e.message.setPinnedMessages(d.conversationId, p);
3138
+ e.message.setPinnedMessages(u.conversationId, f);
3126
3139
  } catch (l) {
3127
- M.warn("refresh pinned messages failed:", l);
3140
+ y.warn("refresh pinned messages failed:", l);
3128
3141
  }
3129
3142
  },
3130
- onMultiDeviceConversation: (d) => {
3131
- if (M.info("onMultiDeviceConversation", { operation: d.operation }), d.operation === "ALL_CONVERSATIONS_UNREAD_MESSAGE_COUNT_CLEARED") {
3143
+ onMultiDeviceConversation: (u) => {
3144
+ if (y.info("onMultiDeviceConversation", { operation: u.operation }), u.operation === "ALL_CONVERSATIONS_UNREAD_MESSAGE_COUNT_CLEARED") {
3132
3145
  for (const h of e.conversation.conversationList)
3133
3146
  e.conversation.updateUnreadCount(h.id, 0);
3134
3147
  return;
3135
3148
  }
3136
- const { operation: l, conversationId: p } = d;
3149
+ const { operation: l, conversationId: f } = u;
3137
3150
  switch (l) {
3138
3151
  case "CONVERSATION_DELETED":
3139
- e.conversation.deleteConversation(p);
3152
+ e.conversation.deleteConversation(f);
3140
3153
  break;
3141
3154
  case "CONVERSATION_PINNED":
3142
- e.conversation.updateConversation(p, { isPinned: !0 });
3155
+ e.conversation.updateConversation(f, { isPinned: !0 });
3143
3156
  break;
3144
3157
  case "CONVERSATION_UNPINNED":
3145
- e.conversation.updateConversation(p, { isPinned: !1 });
3158
+ e.conversation.updateConversation(f, { isPinned: !1 });
3146
3159
  break;
3147
3160
  case "CONVERSATION_UNREAD_MESSAGE_COUNT_CLEARED":
3148
- e.conversation.updateUnreadCount(p, 0);
3161
+ e.conversation.updateUnreadCount(f, 0);
3149
3162
  break;
3150
3163
  case "CONVERSATION_MARK":
3151
- d.mark !== void 0 && e.conversation.updateConversation(p, { marks: [d.mark] });
3164
+ u.mark !== void 0 && e.conversation.updateConversation(f, { marks: [u.mark] });
3152
3165
  break;
3153
3166
  case "CONVERSATION_MUTE_INFO_CHANGED":
3154
- d.remindType && e.conversation.updateConversation(p, {
3155
- isMuted: d.remindType === "NONE",
3156
- remindType: d.remindType
3167
+ u.remindType && e.conversation.updateConversation(f, {
3168
+ isMuted: u.remindType === "NONE",
3169
+ remindType: u.remindType
3157
3170
  });
3158
3171
  break;
3159
3172
  default:
3160
- M.warn("onMultiDeviceConversation unhandled:", d);
3173
+ y.warn("onMultiDeviceConversation unhandled:", u);
3161
3174
  }
3162
3175
  },
3163
- onMultiDeviceMessageRemoved: (d) => {
3164
- M.info("onMultiDeviceMessageRemoved", { conversationId: d.conversationId, operation: d.operation, messageIds: d.messageIds });
3165
- const { operation: l, conversationId: p, messageIds: h, beforeTimestamp: v } = d;
3166
- if (!(!p || l !== "MESSAGE_REMOVED")) {
3176
+ onMultiDeviceMessageRemoved: (u) => {
3177
+ y.info("onMultiDeviceMessageRemoved", { conversationId: u.conversationId, operation: u.operation, messageIds: u.messageIds });
3178
+ const { operation: l, conversationId: f, messageIds: h, beforeTimestamp: v } = u;
3179
+ if (!(!f || l !== "MESSAGE_REMOVED")) {
3167
3180
  if (h && h.length > 0)
3168
- e.message.deleteMessages([...h]), m && x(() => m([...h]));
3181
+ e.message.deleteMessages([...h]), g && x(() => g([...h]));
3169
3182
  else if (v) {
3170
- const w = e.message.getMessages(p).filter((y) => y.timestamp && y.timestamp < v).map((y) => y.msgServerId || y.msgLocalId).filter((y) => !!y);
3171
- w.length > 0 && (e.message.deleteMessages(w), m && x(() => m(w)));
3183
+ const w = e.message.getMessages(f).filter((I) => I.timestamp && I.timestamp < v).map((I) => I.msgServerId || I.msgLocalId).filter((I) => !!I);
3184
+ w.length > 0 && (e.message.deleteMessages(w), g && x(() => g(w)));
3172
3185
  }
3173
3186
  }
3174
3187
  }
3175
3188
  };
3176
3189
  }
3177
3190
  const J = T("UIKit:ContactEvents");
3178
- function He(s, e = "pending") {
3191
+ function Ke(s, e = "pending") {
3179
3192
  const t = s.userInfo, n = s.from;
3180
3193
  return {
3181
3194
  id: n,
@@ -3195,7 +3208,7 @@ function kn(s) {
3195
3208
  onContactInvited: (n) => {
3196
3209
  J.info("onContactInvited", { from: n.from });
3197
3210
  const o = n.from, a = o ? s.contact.getContact(o) : void 0;
3198
- s.contact.addInvite(He(n, a ? "accepted" : "pending"));
3211
+ s.contact.addInvite(Ke(n, a ? "accepted" : "pending"));
3199
3212
  },
3200
3213
  onContactAgreed: (n) => {
3201
3214
  J.info("onContactAgreed", { from: n.from });
@@ -3207,21 +3220,21 @@ function kn(s) {
3207
3220
  onContactRefuse: (n) => {
3208
3221
  J.info("onContactRefuse", { from: n.from });
3209
3222
  const o = n.from;
3210
- o && (s.contact.getInvite(o) ? s.contact.updateInviteStatus(o, "declined") : s.contact.addInvite({ ...He(n, "declined"), outgoing: !0, unread: !0 }), Be(s, o, "declined"));
3223
+ o && (s.contact.getInvite(o) ? s.contact.updateInviteStatus(o, "declined") : s.contact.addInvite({ ...Ke(n, "declined"), outgoing: !0, unread: !0 }), Fe(s, o, "declined"));
3211
3224
  },
3212
3225
  onContactDeleted: (n) => {
3213
3226
  J.info("onContactDeleted", { from: n.from });
3214
3227
  const o = n.from;
3215
- o && (s.contact.removeContact(o), s.contact.removeInvite(o), t(s, o, I.SINGLECHAT, {
3228
+ o && (s.contact.removeContact(o), s.contact.removeInvite(o), t(s, o, M.SINGLECHAT, {
3216
3229
  eventType: A.CONTACT_DELETED,
3217
3230
  params: {},
3218
3231
  defaultText: e("chat.notice.contactDeleted")
3219
- }), Be(s, o, "deleted"));
3232
+ }), Fe(s, o, "deleted"));
3220
3233
  },
3221
3234
  onContactAdded: (n) => {
3222
3235
  J.info("onContactAdded", { from: n.from });
3223
3236
  const o = n.from;
3224
- o && (s.contact.addContact({ userId: o, name: o }), s.contact.removeInvite(o), t(s, o, I.SINGLECHAT, {
3237
+ o && (s.contact.addContact({ userId: o, name: o }), s.contact.removeInvite(o), t(s, o, M.SINGLECHAT, {
3225
3238
  eventType: A.CONTACT_ADDED,
3226
3239
  params: {},
3227
3240
  defaultText: e("chat.notice.contactAdded")
@@ -3239,8 +3252,8 @@ function kn(s) {
3239
3252
  }
3240
3253
  };
3241
3254
  }
3242
- const C = T("UIKit:GroupEvents");
3243
- function Ke(s, e = "pending") {
3255
+ const S = T("UIKit:GroupEvents");
3256
+ function je(s, e = "pending") {
3244
3257
  const t = s.groupId, n = "inviter" in s ? s.inviter : void 0, o = "groupName" in s ? s.groupName : void 0;
3245
3258
  return {
3246
3259
  id: t,
@@ -3260,10 +3273,10 @@ function ie(s, e, t, n) {
3260
3273
  return "";
3261
3274
  const r = s[0];
3262
3275
  if (s.length === 1) {
3263
- const u = r.userId === e ? o("chat.notice.you") : a(r);
3264
- return o(t).replace("{name}", u);
3276
+ const d = r.userId === e ? o("chat.notice.you") : a(r);
3277
+ return o(t).replace("{name}", d);
3265
3278
  }
3266
- const i = s.find((u) => u.userId !== e), c = a(i || r);
3279
+ const i = s.find((d) => d.userId !== e), c = a(i || r);
3267
3280
  return o(n).replace("{name}", c).replace("{count}", String(s.length));
3268
3281
  }
3269
3282
  function ae(s, e) {
@@ -3281,105 +3294,106 @@ function On(s) {
3281
3294
  }
3282
3295
  return {
3283
3296
  onInvitationReceived: (r) => {
3284
- C.info("onInvitationReceived raw payload", r);
3285
- const i = Ke(r, a(r.groupId) ? "accepted" : "pending");
3297
+ S.info("onInvitationReceived raw payload", r);
3298
+ const i = je(r, a(r.groupId) ? "accepted" : "pending");
3286
3299
  s.contact.addInvite(i);
3287
3300
  },
3288
3301
  onInvitationAccepted: (r) => {
3289
- C.info("onInvitationAccepted raw payload", r), s.contact.updateInviteStatus(r.groupId, "accepted");
3302
+ S.info("onInvitationAccepted raw payload", r), s.contact.updateInviteStatus(r.groupId, "accepted");
3290
3303
  },
3291
3304
  onInvitationDeclined: (r) => {
3292
- C.info("onInvitationDeclined raw payload", r), s.contact.updateInviteStatus(r.groupId, "declined");
3305
+ S.info("onInvitationDeclined raw payload", r), s.contact.updateInviteStatus(r.groupId, "declined");
3293
3306
  },
3294
3307
  onAutoAcceptInvitationFromGroup: (r) => {
3295
- C.info("onAutoAcceptInvitationFromGroup raw payload", r), s.contact.addInvite(Ke(r, "accepted"));
3308
+ S.info("onAutoAcceptInvitationFromGroup raw payload", r), s.contact.addInvite(je(r, "accepted"));
3296
3309
  },
3297
3310
  onMembersJoined: (r) => {
3298
- C.info("onMembersJoined raw payload", r);
3311
+ S.info("onMembersJoined raw payload", r);
3299
3312
  const i = r.members || [], c = s.client.currentUser;
3300
- i.some((f) => f.userId === c) && (s.contact.getInvite(r.groupId) && s.contact.updateInviteStatus(r.groupId, "accepted"), s.group.getGroupById(r.groupId) || s.group.addGroup({ groupId: r.groupId, groupName: r.groupName })), s.group.incrementMemberCount(r.groupId, i.length);
3301
- const m = ie(
3313
+ i.some((m) => m.userId === c) && (s.contact.getInvite(r.groupId) && s.contact.updateInviteStatus(r.groupId, "accepted"), s.group.getGroupById(r.groupId) || s.group.addGroup({ groupId: r.groupId, groupName: r.groupName })), s.group.incrementMemberCount(r.groupId, i.length);
3314
+ const g = ie(
3302
3315
  i,
3303
3316
  c || "",
3304
3317
  "chat.notice.memberJoined",
3305
3318
  "chat.notice.memberJoinedMultiple"
3306
3319
  );
3307
- t(s, r.groupId, I.GROUPCHAT, {
3320
+ t(s, r.groupId, M.GROUPCHAT, {
3308
3321
  eventType: A.MEMBER_JOINED,
3309
3322
  params: ae(i, c || ""),
3310
- defaultText: m
3323
+ defaultText: g
3311
3324
  });
3312
3325
  },
3313
3326
  onMembersExited: (r) => {
3314
3327
  const i = r.members || [];
3315
- C.info("onMembersExited raw payload", r), s.group.decrementMemberCount(r.groupId, i.length);
3328
+ S.info("onMembersExited raw payload", r), s.group.decrementMemberCount(r.groupId, i.length);
3316
3329
  const c = ie(
3317
3330
  i,
3318
3331
  s.client.currentUser || "",
3319
3332
  "chat.notice.memberExited",
3320
3333
  "chat.notice.memberExitedMultiple"
3321
3334
  );
3322
- t(s, r.groupId, I.GROUPCHAT, {
3335
+ t(s, r.groupId, M.GROUPCHAT, {
3323
3336
  eventType: A.MEMBER_EXITED,
3324
3337
  params: ae(i, s.client.currentUser || ""),
3325
3338
  defaultText: c
3326
3339
  });
3327
3340
  },
3328
3341
  onGroupInfoChanged: (r) => {
3329
- C.info("onGroupInfoChanged raw payload", r);
3330
- const i = r.groupInfo ?? r, c = i.name ?? i.groupName, u = s.group.getGroupById(r.groupId);
3331
- s.group.updateGroup(r.groupId, {
3332
- groupName: c,
3333
- description: i.description,
3334
- avatar: i.avatarUrl ?? i.avatar
3335
- }), c && (u != null && u.groupName) && c !== u.groupName && (t(s, r.groupId, I.GROUPCHAT, {
3342
+ S.info("onGroupInfoChanged raw payload", r);
3343
+ const i = r.groupInfo ?? r, c = i.name ?? i.groupName, d = s.group.getGroupById(r.groupId), g = Le({
3344
+ ...i,
3345
+ groupId: r.groupId,
3346
+ name: c,
3347
+ avatarUrl: i.avatarUrl ?? i.avatar
3348
+ }), p = !!r.groupInfo ? g : Object.fromEntries(Object.entries(g).filter(([, u]) => u !== void 0));
3349
+ s.group.updateGroup(r.groupId, p), c && (d != null && d.groupName) && c !== d.groupName && (t(s, r.groupId, M.GROUPCHAT, {
3336
3350
  eventType: A.GROUP_NAME_CHANGED,
3337
3351
  params: { name: c },
3338
3352
  defaultText: e("chat.notice.groupNameChanged").replace("{name}", c)
3339
3353
  }), s.conversation.updateConversation(r.groupId, { name: c }));
3340
3354
  },
3341
3355
  onOwnerChanged: (r) => {
3342
- var l, p, h, v, S, w;
3343
- C.info("onOwnerChanged raw payload", r);
3344
- const i = (l = s.group.getGroupById(r.groupId)) == null ? void 0 : l.owner, c = (h = (p = s.group).getPendingOwnerTransfer) == null ? void 0 : h.call(p, r.groupId), u = c || ((v = r.newOwner) == null ? void 0 : v.userId) || "", m = { owner: u }, f = s.client.currentUser || "";
3345
- f && (f === u ? m.role = k.OWNER : f === i && (m.role = k.MEMBER)), s.group.updateGroup(r.groupId, m), u && s.group.updateGroupMemberRole(r.groupId, u, k.OWNER), i && i !== u && s.group.updateGroupMemberRole(r.groupId, i, k.MEMBER), c && ((w = (S = s.group).clearPendingOwnerTransfer) == null || w.call(S, r.groupId));
3346
- const g = u === f ? e("chat.notice.you") : o(r.newOwner), d = e("chat.notice.ownerChanged").replace("{name}", g);
3347
- t(s, r.groupId, I.GROUPCHAT, {
3356
+ var l, f, h, v, b, w;
3357
+ S.info("onOwnerChanged raw payload", r);
3358
+ const i = (l = s.group.getGroupById(r.groupId)) == null ? void 0 : l.owner, c = (h = (f = s.group).getPendingOwnerTransfer) == null ? void 0 : h.call(f, r.groupId), d = c || ((v = r.newOwner) == null ? void 0 : v.userId) || "", g = { owner: d }, m = s.client.currentUser || "";
3359
+ m && (m === d ? g.role = L.OWNER : m === i && (g.role = L.MEMBER)), s.group.updateGroup(r.groupId, g), d && s.group.updateGroupMemberRole(r.groupId, d, L.OWNER), i && i !== d && s.group.updateGroupMemberRole(r.groupId, i, L.MEMBER), c && ((w = (b = s.group).clearPendingOwnerTransfer) == null || w.call(b, r.groupId));
3360
+ const p = d === m ? e("chat.notice.you") : o(r.newOwner), u = e("chat.notice.ownerChanged").replace("{name}", p);
3361
+ t(s, r.groupId, M.GROUPCHAT, {
3348
3362
  eventType: A.OWNER_CHANGED,
3349
- params: { name: g, ownerId: u },
3350
- defaultText: d
3363
+ params: { name: p, ownerId: d },
3364
+ defaultText: u
3351
3365
  });
3352
3366
  },
3353
3367
  onAdminAdded: (r) => {
3354
- var f;
3355
- C.info("onAdminAdded raw payload", r);
3356
- const i = (f = r.administrator) == null ? void 0 : f.userId;
3357
- i && s.group.updateGroupMemberRole(r.groupId, i, k.ADMIN);
3358
- const c = s.client.currentUser || "", u = i === c ? e("chat.notice.you") : o(r.administrator), m = e("chat.notice.adminAdded").replace("{name}", u);
3359
- t(s, r.groupId, I.GROUPCHAT, {
3368
+ var m;
3369
+ S.info("onAdminAdded raw payload", r);
3370
+ const i = (m = r.administrator) == null ? void 0 : m.userId;
3371
+ i && s.group.updateGroupMemberRole(r.groupId, i, L.ADMIN);
3372
+ const c = s.client.currentUser || "", d = i === c ? e("chat.notice.you") : o(r.administrator), g = e("chat.notice.adminAdded").replace("{name}", d);
3373
+ t(s, r.groupId, M.GROUPCHAT, {
3360
3374
  eventType: A.ADMIN_ADDED,
3361
- params: { name: u, userId: i || "" },
3362
- defaultText: m
3375
+ params: { name: d, userId: i || "" },
3376
+ defaultText: g
3363
3377
  });
3364
3378
  },
3365
3379
  onAdminRemoved: (r) => {
3366
- var f;
3367
- C.info("onAdminRemoved raw payload", r);
3368
- const i = (f = r.administrator) == null ? void 0 : f.userId;
3369
- i && s.group.updateGroupMemberRole(r.groupId, i, k.MEMBER);
3370
- const c = s.client.currentUser || "", u = i === c ? e("chat.notice.you") : o(r.administrator), m = e("chat.notice.adminRemoved").replace("{name}", u);
3371
- t(s, r.groupId, I.GROUPCHAT, {
3380
+ var m;
3381
+ S.info("onAdminRemoved raw payload", r);
3382
+ const i = (m = r.administrator) == null ? void 0 : m.userId;
3383
+ i && s.group.updateGroupMemberRole(r.groupId, i, L.MEMBER);
3384
+ const c = s.client.currentUser || "", d = i === c ? e("chat.notice.you") : o(r.administrator), g = e("chat.notice.adminRemoved").replace("{name}", d);
3385
+ t(s, r.groupId, M.GROUPCHAT, {
3372
3386
  eventType: A.ADMIN_REMOVED,
3373
- params: { name: u, userId: i || "" },
3374
- defaultText: m
3387
+ params: { name: d, userId: i || "" },
3388
+ defaultText: g
3375
3389
  });
3376
3390
  },
3377
3391
  onUserRemoved: (r) => {
3378
- C.info("onUserRemoved raw payload", r);
3392
+ S.info("onUserRemoved raw payload", r);
3379
3393
  const i = e("chat.notice.you");
3380
3394
  s.group.removeGroup(r.groupId), s.conversation.deleteConversation(r.groupId), s.message.clearConversationMessages(r.groupId);
3381
3395
  const c = e("chat.notice.userRemoved").replace("{name}", i);
3382
- t(s, r.groupId, I.GROUPCHAT, {
3396
+ t(s, r.groupId, M.GROUPCHAT, {
3383
3397
  eventType: A.USER_REMOVED,
3384
3398
  params: { name: i },
3385
3399
  defaultText: c
@@ -3387,56 +3401,56 @@ function On(s) {
3387
3401
  },
3388
3402
  onGroupDestroyed: (r) => {
3389
3403
  var i;
3390
- C.info("onGroupDestroyed raw payload", r), s.group.removeGroup(r.groupId), (((i = s.client.client) == null ? void 0 : i.deleteConversationOnGroupDestroyed) ?? !0) && (s.conversation.deleteConversation(r.groupId), s.message.clearConversationMessages(r.groupId)), t(s, r.groupId, I.GROUPCHAT, {
3404
+ S.info("onGroupDestroyed raw payload", r), s.group.removeGroup(r.groupId), (((i = s.client.client) == null ? void 0 : i.deleteConversationOnGroupDestroyed) ?? !0) && (s.conversation.deleteConversation(r.groupId), s.message.clearConversationMessages(r.groupId)), t(s, r.groupId, M.GROUPCHAT, {
3391
3405
  eventType: A.GROUP_DESTROYED,
3392
3406
  params: {},
3393
3407
  defaultText: e("chat.notice.groupDestroyed")
3394
3408
  });
3395
3409
  },
3396
3410
  onAnnouncementChanged: (r) => {
3397
- C.info("onAnnouncementChanged raw payload", r), s.group.updateGroup(r.groupId, { announcement: r.announcement }), s.group.setGroupAnnouncement(r.groupId, r.announcement), t(s, r.groupId, I.GROUPCHAT, {
3411
+ S.info("onAnnouncementChanged raw payload", r), s.group.updateGroup(r.groupId, { announcement: r.announcement }), s.group.setGroupAnnouncement(r.groupId, r.announcement), t(s, r.groupId, M.GROUPCHAT, {
3398
3412
  eventType: A.ANNOUNCEMENT_CHANGED,
3399
3413
  params: { announcement: r.announcement || "" },
3400
3414
  defaultText: n(r.announcement)
3401
3415
  });
3402
3416
  },
3403
3417
  onMuteListAdded: (r) => {
3404
- C.info("onMuteListAdded raw payload", r);
3405
- const i = (r.mutes || []).map((m) => ({
3406
- userId: m.userId,
3418
+ S.info("onMuteListAdded raw payload", r);
3419
+ const i = (r.mutes || []).map((g) => ({
3420
+ userId: g.userId,
3407
3421
  muteExpire: r.muteExpire
3408
3422
  }));
3409
3423
  s.group.addGroupMuteMembers(r.groupId, i);
3410
- const c = (r.mutes || []).map((m) => m.nickname || m.userId || ""), u = c.map((m) => e("group.mutelist.muteNotice").replace("{name}", m)).join("、");
3411
- t(s, r.groupId, I.GROUPCHAT, {
3424
+ const c = (r.mutes || []).map((g) => g.nickname || g.userId || ""), d = c.map((g) => e("group.mutelist.muteNotice").replace("{name}", g)).join("、");
3425
+ t(s, r.groupId, M.GROUPCHAT, {
3412
3426
  eventType: A.MUTE_ADDED,
3413
3427
  params: { names: c.join("、"), count: c.length },
3414
- defaultText: u
3428
+ defaultText: d
3415
3429
  });
3416
3430
  },
3417
3431
  onMuteListRemoved: (r) => {
3418
- C.info("onMuteListRemoved raw payload", r);
3419
- const i = (r.mutes || []).map((m) => m.userId);
3432
+ S.info("onMuteListRemoved raw payload", r);
3433
+ const i = (r.mutes || []).map((g) => g.userId);
3420
3434
  s.group.removeGroupMuteMembers(r.groupId, i);
3421
- const c = (r.mutes || []).map((m) => m.nickname || m.userId || ""), u = c.map((m) => e("group.mutelist.unmuteNotice").replace("{name}", m)).join("、");
3422
- t(s, r.groupId, I.GROUPCHAT, {
3435
+ const c = (r.mutes || []).map((g) => g.nickname || g.userId || ""), d = c.map((g) => e("group.mutelist.unmuteNotice").replace("{name}", g)).join("、");
3436
+ t(s, r.groupId, M.GROUPCHAT, {
3423
3437
  eventType: A.MUTE_REMOVED,
3424
3438
  params: { names: c.join("、"), count: c.length },
3425
- defaultText: u
3439
+ defaultText: d
3426
3440
  });
3427
3441
  },
3428
3442
  onAllMemberMuteStateChanged: (r) => {
3429
- C.info("onAllMemberMuteStateChanged raw payload", r), s.group.updateGroup(r.groupId, { mute: r.isMuted });
3443
+ S.info("onAllMemberMuteStateChanged raw payload", r), s.group.updateGroup(r.groupId, { mute: r.isMuted });
3430
3444
  const i = e(r.isMuted ? "group.mutelist.muteAllNotice" : "group.mutelist.unmuteAllNotice");
3431
- t(s, r.groupId, I.GROUPCHAT, {
3445
+ t(s, r.groupId, M.GROUPCHAT, {
3432
3446
  eventType: A.ALL_MEMBER_MUTE_CHANGED,
3433
3447
  params: { muted: r.isMuted },
3434
3448
  defaultText: i
3435
3449
  });
3436
3450
  },
3437
3451
  onAllowListAdded: (r) => {
3438
- C.info("onAllowListAdded raw payload", r);
3439
- const i = (r.allowlist || []).map((u) => u.userId);
3452
+ S.info("onAllowListAdded raw payload", r);
3453
+ const i = (r.allowlist || []).map((d) => d.userId);
3440
3454
  s.group.addGroupAllowlistMembers(r.groupId, i);
3441
3455
  const c = ie(
3442
3456
  r.allowlist || [],
@@ -3444,15 +3458,15 @@ function On(s) {
3444
3458
  "chat.notice.allowlistAdded",
3445
3459
  "chat.notice.allowlistAddedMultiple"
3446
3460
  );
3447
- t(s, r.groupId, I.GROUPCHAT, {
3461
+ t(s, r.groupId, M.GROUPCHAT, {
3448
3462
  eventType: A.ALLOWLIST_ADDED,
3449
3463
  params: ae(r.allowlist || [], s.client.currentUser || ""),
3450
3464
  defaultText: c
3451
3465
  });
3452
3466
  },
3453
3467
  onAllowListRemoved: (r) => {
3454
- C.info("onAllowListRemoved raw payload", r);
3455
- const i = (r.allowlist || []).map((u) => u.userId);
3468
+ S.info("onAllowListRemoved raw payload", r);
3469
+ const i = (r.allowlist || []).map((d) => d.userId);
3456
3470
  s.group.removeGroupAllowlistMembers(r.groupId, i);
3457
3471
  const c = ie(
3458
3472
  r.allowlist || [],
@@ -3460,36 +3474,36 @@ function On(s) {
3460
3474
  "chat.notice.allowlistRemoved",
3461
3475
  "chat.notice.allowlistRemovedMultiple"
3462
3476
  );
3463
- t(s, r.groupId, I.GROUPCHAT, {
3477
+ t(s, r.groupId, M.GROUPCHAT, {
3464
3478
  eventType: A.ALLOWLIST_REMOVED,
3465
3479
  params: ae(r.allowlist || [], s.client.currentUser || ""),
3466
3480
  defaultText: c
3467
3481
  });
3468
3482
  },
3469
3483
  onGroupDisabledChanged: (r) => {
3470
- C.info("onGroupDisabledChanged raw payload", r), s.group.updateGroup(r.groupId, { disabled: r.disabled }), t(s, r.groupId, I.GROUPCHAT, {
3484
+ S.info("onGroupDisabledChanged raw payload", r), s.group.updateGroup(r.groupId, { disabled: r.disabled }), t(s, r.groupId, M.GROUPCHAT, {
3471
3485
  eventType: A.GROUP_DISABLED_CHANGED,
3472
3486
  params: { disabled: r.disabled },
3473
3487
  defaultText: e(r.disabled ? "chat.notice.groupDisabled" : "chat.notice.groupEnabled")
3474
3488
  });
3475
3489
  },
3476
3490
  onSharedFileAdded: (r) => {
3477
- if (C.info("onSharedFileAdded raw payload", r), r.sharedFile) {
3491
+ if (S.info("onSharedFileAdded raw payload", r), r.sharedFile) {
3478
3492
  s.group.addGroupSharedFile(r.groupId, r.sharedFile);
3479
- const i = r.sharedFile.fileOwner, c = (i == null ? void 0 : i.userId) === s.client.currentUser ? e("chat.notice.you") : o(i), u = e("chat.notice.sharedFileAdded").replace("{name}", c || (i == null ? void 0 : i.userId) || "").replace("{fileName}", r.sharedFile.fileName);
3480
- t(s, r.groupId, I.GROUPCHAT, {
3493
+ const i = r.sharedFile.fileOwner, c = (i == null ? void 0 : i.userId) === s.client.currentUser ? e("chat.notice.you") : o(i), d = e("chat.notice.sharedFileAdded").replace("{name}", c || (i == null ? void 0 : i.userId) || "").replace("{fileName}", r.sharedFile.fileName);
3494
+ t(s, r.groupId, M.GROUPCHAT, {
3481
3495
  eventType: A.SHARED_FILE_ADDED,
3482
3496
  params: { name: c || (i == null ? void 0 : i.userId) || "", fileName: r.sharedFile.fileName },
3483
- defaultText: u
3497
+ defaultText: d
3484
3498
  });
3485
3499
  }
3486
3500
  },
3487
3501
  onSharedFileDeleted: (r) => {
3488
- C.info("onSharedFileDeleted raw payload", r), s.group.removeGroupSharedFile(r.groupId, r.fileId);
3502
+ S.info("onSharedFileDeleted raw payload", r), s.group.removeGroupSharedFile(r.groupId, r.fileId);
3489
3503
  },
3490
3504
  onRequestToJoinReceived: (r) => {
3491
3505
  var c;
3492
- C.info("onRequestToJoinReceived raw payload", r);
3506
+ S.info("onRequestToJoinReceived raw payload", r);
3493
3507
  const i = s.group.getGroupJoinRequests(r.groupId);
3494
3508
  s.group.setGroupJoinRequests(r.groupId, [
3495
3509
  ...i,
@@ -3506,16 +3520,16 @@ function On(s) {
3506
3520
  ]);
3507
3521
  },
3508
3522
  onRequestToJoinAccepted: (r) => {
3509
- C.info("onRequestToJoinAccepted raw payload", r);
3510
- const i = s.client.currentUser, c = s.group.getGroupJoinRequests(r.groupId).filter((u) => {
3511
- var m;
3512
- return !(u.status === "pending" && (u.applicantId === i || ((m = u.applicant) == null ? void 0 : m.userId) === i));
3523
+ S.info("onRequestToJoinAccepted raw payload", r);
3524
+ const i = s.client.currentUser, c = s.group.getGroupJoinRequests(r.groupId).filter((d) => {
3525
+ var g;
3526
+ return !(d.status === "pending" && (d.applicantId === i || ((g = d.applicant) == null ? void 0 : g.userId) === i));
3513
3527
  });
3514
3528
  s.group.setGroupJoinRequests(r.groupId, c);
3515
3529
  },
3516
3530
  onRequestToJoinDeclined: (r) => {
3517
3531
  var i;
3518
- C.info("onRequestToJoinDeclined raw payload", r), s.group.updateGroupJoinRequest(
3532
+ S.info("onRequestToJoinDeclined raw payload", r), s.group.updateGroupJoinRequest(
3519
3533
  r.groupId,
3520
3534
  ((i = r.applicant) == null ? void 0 : i.userId) || "",
3521
3535
  "declined"
@@ -3543,22 +3557,22 @@ function Pn(s) {
3543
3557
  };
3544
3558
  }
3545
3559
  function Bn(s, e, t = {}, n, o, a) {
3546
- const r = Cn(e, t), i = Nn(s, e, n, o, a), c = kn(e), u = On(e), m = Pn(e);
3547
- return s.addEventHandler("uikit-conn", r), s.chatManager.addEventHandler("uikit-chat", i), s.contactManager.addEventHandler("uikit-contact", c), s.groupManager.addEventHandler("uikit-group", u), s.presenceManager.addEventHandler("uikit-presence", m), () => {
3560
+ const r = wn(e, t), i = Nn(s, e, n, o, a), c = kn(e), d = On(e), g = Pn(e);
3561
+ return s.addEventHandler("uikit-conn", r), s.chatManager.addEventHandler("uikit-chat", i), s.contactManager.addEventHandler("uikit-contact", c), s.groupManager.addEventHandler("uikit-group", d), s.presenceManager.addEventHandler("uikit-presence", g), () => {
3548
3562
  s.removeEventHandler("uikit-conn"), s.chatManager.removeEventHandler("uikit-chat"), s.contactManager.removeEventHandler("uikit-contact"), s.groupManager.removeEventHandler("uikit-group"), s.presenceManager.removeEventHandler("uikit-presence"), Un(), An();
3549
3563
  };
3550
3564
  }
3551
- const D = T("UIKit:Websdk5Adapter"), Fn = [
3552
- je,
3565
+ const _ = T("UIKit:Websdk5Adapter"), Fn = [
3566
+ qe,
3553
3567
  ct,
3554
3568
  ut,
3555
3569
  dt,
3556
3570
  lt,
3557
- qe
3571
+ We
3558
3572
  ], Hn = [
3559
- je,
3573
+ qe,
3560
3574
  at,
3561
- qe
3575
+ We
3562
3576
  ];
3563
3577
  class ts {
3564
3578
  constructor(e) {
@@ -3600,14 +3614,14 @@ class ts {
3600
3614
  eventDeps: r,
3601
3615
  onUserInfoSubscriptionPermissionError: i,
3602
3616
  registerImEvents: c,
3603
- managerPreset: u,
3604
- repositories: m,
3605
- persistence: f,
3606
- lastMessageTextResolver: g,
3607
- ...d
3608
- } = t, l = e.repositories ?? m, p = e.persistence ?? f;
3609
- this._persistence = p, this._lastMessageTextResolver = g, this._loginTimeoutMs = e.loginTimeoutMs;
3610
- const { appKey: h, appId: v, ...S } = d;
3617
+ managerPreset: d,
3618
+ repositories: g,
3619
+ persistence: m,
3620
+ lastMessageTextResolver: p,
3621
+ ...u
3622
+ } = t, l = e.repositories ?? g, f = e.persistence ?? m;
3623
+ this._persistence = f, this._lastMessageTextResolver = p, this._loginTimeoutMs = e.loginTimeoutMs;
3624
+ const { appKey: h, appId: v, ...b } = u;
3611
3625
  let w;
3612
3626
  if (e.appKey)
3613
3627
  w = { appKey: e.appKey };
@@ -3619,42 +3633,42 @@ class ts {
3619
3633
  throw new Error("[Websdk5Adapter] 缺少应用身份:SdkConfig.appKey 与 SdkConfig.appId 必须提供其一");
3620
3634
  this._client = this.injectedClient ?? Nt({
3621
3635
  debug: e.debug,
3622
- managers: d.managers ?? (u === "chatroom" ? Hn : Fn),
3623
- ...S,
3636
+ managers: u.managers ?? (d === "chatroom" ? Hn : Fn),
3637
+ ...b,
3624
3638
  ...w
3625
- }), r && rt(r), this._features = n ?? Vt(), this._registerImEvents = c !== !1;
3626
- const y = a ? Object.keys(a) : [];
3627
- if (D.info("[Websdk5Adapter] init 开始", {
3639
+ }), r && rt(r), this._features = n ?? jt(), this._registerImEvents = c !== !1;
3640
+ const I = a ? Object.keys(a) : [];
3641
+ if (_.info("[Websdk5Adapter] init 开始", {
3628
3642
  mode: this.injectedClient ? "injected-client" : "builtin",
3629
- managerPreset: u ?? "im",
3643
+ managerPreset: d ?? "im",
3630
3644
  registerImEvents: this._registerImEvents,
3631
- injectedStores: y
3632
- }), y.length < 7) {
3645
+ injectedStores: I
3646
+ }), I.length < 7) {
3633
3647
  const W = ["client", "message", "conversation", "contact", "group", "presence", "userInfo"];
3634
- D.debug(
3648
+ _.debug(
3635
3649
  "[Websdk5Adapter] 以下 store 域未注入,回落 adapter 内置 store:",
3636
- W.filter((L) => !y.includes(L))
3650
+ W.filter((D) => !I.includes(D))
3637
3651
  );
3638
3652
  }
3639
3653
  const R = { ...Kt(this, () => this._getFanout()), ...a };
3640
3654
  this._stores = R, this._domains = {
3641
3655
  message: new dn(this._client, R.message, {
3642
3656
  messageRepository: l == null ? void 0 : l.message,
3643
- persistence: p == null ? void 0 : p.message
3657
+ persistence: f == null ? void 0 : f.message
3644
3658
  }),
3645
3659
  conversation: new pn(this._client, R.conversation, {
3646
- sendPendingReadReceipts: (W, L) => {
3647
- var Y, Le;
3648
- ((Y = this._features) == null ? void 0 : Y.enableReadReceipt) !== !1 && ((Le = this._domains) == null || Le.message.sendPendingReadReceipts(W, L));
3660
+ sendPendingReadReceipts: (W, D) => {
3661
+ var Y, De;
3662
+ ((Y = this._features) == null ? void 0 : Y.enableReadReceipt) !== !1 && ((De = this._domains) == null || De.message.sendPendingReadReceipts(W, D));
3649
3663
  },
3650
3664
  resolveSenderName: (W) => {
3651
3665
  var Y;
3652
- const L = R.contact.getContact(W);
3653
- return L != null && L.remark || L != null && L.name ? L.remark || L.name : (Y = R.userInfo.getUserInfo(W)) == null ? void 0 : Y.nickname;
3666
+ const D = R.contact.getContact(W);
3667
+ return D != null && D.remark || D != null && D.name ? D.remark || D.name : (Y = R.userInfo.getUserInfo(W)) == null ? void 0 : Y.nickname;
3654
3668
  },
3655
3669
  lastMessageTextResolver: this._lastMessageTextResolver,
3656
3670
  conversationRepository: l == null ? void 0 : l.conversation,
3657
- persistence: p == null ? void 0 : p.conversation
3671
+ persistence: f == null ? void 0 : f.conversation
3658
3672
  }),
3659
3673
  contact: new In(this._client, R.contact, {
3660
3674
  contactRepository: l == null ? void 0 : l.contact
@@ -3665,33 +3679,33 @@ class ts {
3665
3679
  presence: new bn(this._client, R.presence, {
3666
3680
  presenceRepository: l == null ? void 0 : l.presence
3667
3681
  })
3668
- }, this._userInfoDomain = new wn(
3682
+ }, this._userInfoDomain = new Cn(
3669
3683
  this._client,
3670
3684
  R.userInfo,
3671
- (l == null ? void 0 : l.userInfo) ?? jt(o) ?? {},
3672
- i ?? (() => D.warn("[Websdk5Adapter] 用户资料订阅无权限,已自动熔断"))
3673
- ), this._userInfoDomain.listen(), this._setupEventHandlers(), D.info("[Websdk5Adapter] init 完成");
3685
+ (l == null ? void 0 : l.userInfo) ?? Vt(o) ?? {},
3686
+ i ?? (() => _.warn("[Websdk5Adapter] 用户资料订阅无权限,已自动熔断"))
3687
+ ), this._userInfoDomain.listen(), this._setupEventHandlers(), _.info("[Websdk5Adapter] init 完成");
3674
3688
  }
3675
3689
  async login(e, t) {
3676
- var o, a, r, i, c, u, m;
3690
+ var o, a, r, i, c, d, g;
3677
3691
  if (!this._client)
3678
3692
  throw new Error("[Websdk5Adapter] 尚未初始化,请先调用 init()");
3679
- this._eventsRegistered || (D.debug("[Websdk5Adapter] 登出后重新登录,恢复事件处理器与用户资料监听"), (o = this._userInfoDomain) == null || o.listen(), this._setupEventHandlers());
3693
+ this._eventsRegistered || (_.debug("[Websdk5Adapter] 登出后重新登录,恢复事件处理器与用户资料监听"), (o = this._userInfoDomain) == null || o.listen(), this._setupEventHandlers());
3680
3694
  const n = At(e);
3681
- n !== e && D.warn("[Websdk5Adapter] 检测到登录 userId 包含大写字母,已强制转换为纯小写后继续登录", {
3695
+ n !== e && _.warn("[Websdk5Adapter] 检测到登录 userId 包含大写字母,已强制转换为纯小写后继续登录", {
3682
3696
  originalUserId: e,
3683
3697
  normalizedUserId: n
3684
- }), D.info("[Websdk5Adapter] login 开始", { user: n }), (i = (a = this._stores) == null ? void 0 : (r = a.client).setCurrentUser) == null || i.call(r, n);
3698
+ }), _.info("[Websdk5Adapter] login 开始", { user: n }), (i = (a = this._stores) == null ? void 0 : (r = a.client).setCurrentUser) == null || i.call(r, n);
3685
3699
  try {
3686
3700
  await this._client.login(n, t, this._loginTimeoutMs);
3687
- } catch (f) {
3688
- throw (m = (c = this._stores) == null ? void 0 : (u = c.client).setCurrentUser) == null || m.call(u, ""), D.error("[Websdk5Adapter] login 失败:", U(f)), f;
3701
+ } catch (m) {
3702
+ throw (g = (c = this._stores) == null ? void 0 : (d = c.client).setCurrentUser) == null || g.call(d, ""), _.error("[Websdk5Adapter] login 失败:", U(m)), m;
3689
3703
  }
3690
- D.info("[Websdk5Adapter] login 成功", { user: n });
3704
+ _.info("[Websdk5Adapter] login 成功", { user: n });
3691
3705
  }
3692
3706
  async logout() {
3693
3707
  var e, t, n, o, a;
3694
- D.info("[Websdk5Adapter] logout"), await ((e = this._client) == null ? void 0 : e.logout()), (t = this._domains) == null || t.message.clearMultiBodyRetryCache(), (n = this._disposeEventHandlers) == null || n.call(this), this._disposeEventHandlers = void 0, (o = this._disposeSyncListener) == null || o.call(this), this._disposeSyncListener = void 0, (a = this._userInfoDomain) == null || a.dispose(), this._eventsRegistered = !1;
3708
+ _.info("[Websdk5Adapter] logout"), await ((e = this._client) == null ? void 0 : e.logout()), (t = this._domains) == null || t.message.clearMultiBodyRetryCache(), (n = this._disposeEventHandlers) == null || n.call(this), this._disposeEventHandlers = void 0, (o = this._disposeSyncListener) == null || o.call(this), this._disposeSyncListener = void 0, (a = this._userInfoDomain) == null || a.dispose(), this._eventsRegistered = !1;
3695
3709
  }
3696
3710
  /** 订阅中立事件,返回取消订阅函数(支持多方订阅,内部扇出派发) */
3697
3711
  subscribe(e) {
@@ -3718,7 +3732,7 @@ class ts {
3718
3732
  var e, t;
3719
3733
  if (!(!this._client || !this._stores)) {
3720
3734
  if (!this._registerImEvents) {
3721
- D.debug("[Websdk5Adapter] IM 事件套件已关闭(registerImEvents=false),场景事件由业务经 onAdapterReady 自行注册");
3735
+ _.debug("[Websdk5Adapter] IM 事件套件已关闭(registerImEvents=false),场景事件由业务经 onAdapterReady 自行注册");
3722
3736
  return;
3723
3737
  }
3724
3738
  En(), (e = this._disposeSyncListener) == null || e.call(this), this._disposeSyncListener = Sn((n) => {
@@ -3740,7 +3754,7 @@ class ts {
3740
3754
  this._features,
3741
3755
  this._persistence,
3742
3756
  this._lastMessageTextResolver
3743
- ), this._eventsRegistered = !0, D.debug("[Websdk5Adapter] SDK 事件处理器已注册");
3757
+ ), this._eventsRegistered = !0, _.debug("[Websdk5Adapter] SDK 事件处理器已注册");
3744
3758
  }
3745
3759
  }
3746
3760
  get message() {
@@ -3775,20 +3789,20 @@ class ts {
3775
3789
  }
3776
3790
  }
3777
3791
  export {
3778
- Pe as ALL_USER_INFO_ATTRIBUTES,
3792
+ Be as ALL_USER_INFO_ATTRIBUTES,
3779
3793
  In as ContactDomain,
3780
3794
  pn as ConversationDomain,
3781
3795
  yn as GroupDomain,
3782
3796
  dn as MessageDomain,
3783
3797
  bn as PresenceDomain,
3784
3798
  _t as UIKitClient,
3785
- wn as UserInfoDomain,
3799
+ Cn as UserInfoDomain,
3786
3800
  Hn as WEBSDK5_CHATROOM_MANAGERS,
3787
3801
  Fn as WEBSDK5_MANAGERS,
3788
3802
  ts as Websdk5Adapter,
3789
3803
  Nn as createChatHandlers,
3790
3804
  Nt as createClient,
3791
- Cn as createConnectionHandlers,
3805
+ wn as createConnectionHandlers,
3792
3806
  kn as createContactHandlers,
3793
3807
  On as createGroupHandlers,
3794
3808
  Pn as createPresenceHandlers,
@@ -3803,7 +3817,7 @@ export {
3803
3817
  $n as isSdkDebugEnabled,
3804
3818
  an as markReadReceiptSent,
3805
3819
  rs as normalizeUserId,
3806
- Be as notifyContactEvent,
3820
+ Fe as notifyContactEvent,
3807
3821
  Rn as notifyOnNewMessage,
3808
3822
  nt as parsePresenceStatus,
3809
3823
  Bn as registerEventHandlers,
@@ -3824,10 +3838,10 @@ export {
3824
3838
  Ge as toUiContacts,
3825
3839
  ln as toUiConversation,
3826
3840
  te as toUiConversations,
3827
- tt as toUiGroup,
3841
+ Le as toUiGroup,
3828
3842
  Mn as toUiGroupMember,
3829
3843
  Z as toUiGroupMembers,
3830
- me as toUiGroups,
3844
+ fe as toUiGroups,
3831
3845
  P as toUiMessage,
3832
3846
  Qn as toUiMessages,
3833
3847
  es as useSyncStatus