@medipha/chat 1.0.62 → 1.0.64

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.
package/dist/index.js CHANGED
@@ -61151,13 +61151,19 @@ function NL(e) {
61151
61151
  n
61152
61152
  ]), r && a ? r.asset : null;
61153
61153
  }
61154
- function PL({ stickerId: e }) {
61155
- let t = NL(e);
61156
- return /* @__PURE__ */ A(ML, {
61154
+ function PL({ stickerId: e, onOpenPack: t }) {
61155
+ let n = NL(e), r = /* @__PURE__ */ A(ML, {
61157
61156
  className: "message-sticker",
61158
- asset: t,
61157
+ asset: n,
61159
61158
  size: 130
61160
61159
  });
61160
+ return !n || !t ? r : /* @__PURE__ */ A("button", {
61161
+ type: "button",
61162
+ className: "message-sticker-button",
61163
+ "aria-label": `Xem bộ sticker ${n.pack.name}`,
61164
+ onClick: () => t(n.pack.slug),
61165
+ children: r
61166
+ });
61161
61167
  }
61162
61168
  //#endregion
61163
61169
  //#region src/features/message-list/bubble/message-content-body.tsx
@@ -61225,18 +61231,18 @@ var UL = (e) => e.map((e) => ({
61225
61231
  kind: null,
61226
61232
  thumbnailUrl: null
61227
61233
  }];
61228
- function GL({ message: e, isLatestMessage: t, onOpenImageLightbox: n, onImageSettled: r, onOpenMentionCard: i }) {
61229
- let a = co(e.attachmentUrl, e.attachmentId), o = e.type === "IMAGE", s = rl(e).length > BL, [c, l] = b(/* @__PURE__ */ new Set()), u = (e) => {
61230
- l((t) => t.has(e) ? t : new Set(t).add(e));
61231
- }, d = () => {
61234
+ function GL({ message: e, isLatestMessage: t, onOpenImageLightbox: n, onImageSettled: r, onOpenMentionCard: i, onOpenStickerPack: a }) {
61235
+ let o = co(e.attachmentUrl, e.attachmentId), s = e.type === "IMAGE", c = rl(e).length > BL, [l, u] = b(/* @__PURE__ */ new Set()), d = (e) => {
61236
+ u((t) => t.has(e) ? t : new Set(t).add(e));
61237
+ }, f = () => {
61232
61238
  t && r();
61233
61239
  };
61234
61240
  return /* @__PURE__ */ j(k, { children: [
61235
- o ? (() => {
61236
- let t = e.attachments && e.attachments.length > 0 ? e.attachments.map((e) => co(e.url, e.id)).filter((e) => !!e) : e.previewUrls?.length ? e.previewUrls : a || e.previewUrl ? [a || e.previewUrl] : [];
61241
+ s ? (() => {
61242
+ let t = e.attachments && e.attachments.length > 0 ? e.attachments.map((e) => co(e.url, e.id)).filter((e) => !!e) : e.previewUrls?.length ? e.previewUrls : o || e.previewUrl ? [o || e.previewUrl] : [];
61237
61243
  if (t.length === 0) return null;
61238
61244
  if (t.length === 1) {
61239
- let r = c.has(t[0]), i = e.attachments?.[0] ? yte(e.attachments[0]) : null;
61245
+ let r = l.has(t[0]), i = e.attachments?.[0] ? yte(e.attachments[0]) : null;
61240
61246
  return /* @__PURE__ */ A("button", {
61241
61247
  type: "button",
61242
61248
  className: `message-image-button${r ? "" : " is-loading"}`,
@@ -61247,10 +61253,10 @@ function GL({ message: e, isLatestMessage: t, onOpenImageLightbox: n, onImageSet
61247
61253
  src: t[0],
61248
61254
  alt: e.attachmentName ?? "Ảnh đính kèm",
61249
61255
  onLoad: () => {
61250
- u(t[0]), d();
61256
+ d(t[0]), f();
61251
61257
  },
61252
61258
  onError: () => {
61253
- u(t[0]), d();
61259
+ d(t[0]), f();
61254
61260
  }
61255
61261
  })
61256
61262
  });
@@ -61258,7 +61264,7 @@ function GL({ message: e, isLatestMessage: t, onOpenImageLightbox: n, onImageSet
61258
61264
  return /* @__PURE__ */ A("div", {
61259
61265
  className: `message-image-grid message-image-grid--${Math.min(t.length, 4)}`,
61260
61266
  children: t.map((e, r) => {
61261
- let i = c.has(e);
61267
+ let i = l.has(e);
61262
61268
  return /* @__PURE__ */ A("button", {
61263
61269
  type: "button",
61264
61270
  className: `message-image-grid-item${i ? "" : " is-loading"}`,
@@ -61267,17 +61273,20 @@ function GL({ message: e, isLatestMessage: t, onOpenImageLightbox: n, onImageSet
61267
61273
  src: e,
61268
61274
  alt: `Ảnh ${r + 1}`,
61269
61275
  onLoad: () => {
61270
- u(e), r === t.length - 1 && d();
61276
+ d(e), r === t.length - 1 && f();
61271
61277
  },
61272
61278
  onError: () => {
61273
- u(e), r === t.length - 1 && d();
61279
+ d(e), r === t.length - 1 && f();
61274
61280
  }
61275
61281
  })
61276
61282
  }, e + r);
61277
61283
  })
61278
61284
  });
61279
61285
  })() : null,
61280
- e.type === "STICKER" ? /* @__PURE__ */ A(PL, { stickerId: e.stickerId }) : null,
61286
+ e.type === "STICKER" ? /* @__PURE__ */ A(PL, {
61287
+ stickerId: e.stickerId,
61288
+ onOpenPack: a
61289
+ }) : null,
61281
61290
  e.type === "DOCUMENT" ? /* @__PURE__ */ A("div", {
61282
61291
  className: "message-document-list",
61283
61292
  children: WL(e).map((e) => {
@@ -61285,11 +61294,11 @@ function GL({ message: e, isLatestMessage: t, onOpenImageLightbox: n, onImageSet
61285
61294
  return pc(e) ? /* @__PURE__ */ A(DL, {
61286
61295
  attachment: e,
61287
61296
  onOpen: (e) => n([e], 0),
61288
- onPosterSettled: d
61297
+ onPosterSettled: f
61289
61298
  }, t) : bte(e) ? /* @__PURE__ */ A(SL, { attachment: e }, t) : /* @__PURE__ */ A(vL, { attachment: e }, t);
61290
61299
  })
61291
61300
  }) : null,
61292
- HL(s, Array.isArray(e.content) ? /* @__PURE__ */ A("p", { children: $c(e).map((e) => e.kind === "text" ? zL(e.value, e.marks, e.key) : e.kind === "line_break" ? /* @__PURE__ */ A("br", {}, e.key) : e.kind === "mention_user" && e.userId ? /* @__PURE__ */ A("span", {
61301
+ HL(c, Array.isArray(e.content) ? /* @__PURE__ */ A("p", { children: $c(e).map((e) => e.kind === "text" ? zL(e.value, e.marks, e.key) : e.kind === "line_break" ? /* @__PURE__ */ A("br", {}, e.key) : e.kind === "mention_user" && e.userId ? /* @__PURE__ */ A("span", {
61293
61302
  className: "message-mention message-mention--user",
61294
61303
  role: "button",
61295
61304
  tabIndex: 0,
@@ -61505,14 +61514,14 @@ function rR(e, t, n) {
61505
61514
  children: e.value.replace(/^@/, "")
61506
61515
  }, e.key) : /* @__PURE__ */ A("span", { children: e.value }, e.key));
61507
61516
  }
61508
- function iR({ message: e, isMine: t, currentUserId: n, resolveUserName: r, isGroup: i, isFocused: a, isLatestMessage: o, showDayDivider: s, isReactionPickerOpen: c, myReactionType: l, onOpenReactionPicker: u, onCloseReactionPickerIfSelf: d, onApplyReaction: f, onRemoveReaction: p, onOpenReactionModal: m, canManagePins: h, isPinned: g, onTogglePin: _, isMenuOpen: v, menuPosition: y, onOpenMenu: b, onCloseMenu: x, onCopyMessage: S, onViewDetails: C, canRemove: w, removeLabel: T, isRemoving: E, onRemove: D, onReply: O, onForward: M, onJumpToReply: N, onOpenMentionCard: P, onOpenSystemMembers: F, onOpenImageLightbox: I, onImageSettled: L, onRetry: R, onDeleteFailed: ee, isSenderGroupOwner: te, resolveUserAvatar: ne, onOpenUserProfile: re }) {
61509
- let z = ol(e), ie = s ? om(e.createdAt) : null, B = ie ? /* @__PURE__ */ A("div", {
61517
+ function iR({ message: e, isMine: t, currentUserId: n, resolveUserName: r, isGroup: i, isFocused: a, isLatestMessage: o, showDayDivider: s, isReactionPickerOpen: c, myReactionType: l, onOpenReactionPicker: u, onCloseReactionPickerIfSelf: d, onApplyReaction: f, onRemoveReaction: p, onOpenReactionModal: m, canManagePins: h, isPinned: g, onTogglePin: _, isMenuOpen: v, menuPosition: y, onOpenMenu: b, onCloseMenu: x, onCopyMessage: S, onViewDetails: C, canRemove: w, removeLabel: T, isRemoving: E, onRemove: D, onReply: O, onForward: M, onJumpToReply: N, onOpenMentionCard: P, onOpenSystemMembers: F, onOpenImageLightbox: I, onOpenStickerPack: L, onImageSettled: R, onRetry: ee, onDeleteFailed: te, isSenderGroupOwner: ne, resolveUserAvatar: re, onOpenUserProfile: z }) {
61518
+ let ie = ol(e), B = s ? om(e.createdAt) : null, ae = B ? /* @__PURE__ */ A("div", {
61510
61519
  className: "message-day-divider",
61511
- children: /* @__PURE__ */ j("span", { children: [ie === "Hôm nay" ? "" : `${im(e.createdAt)} · `, ie] })
61520
+ children: /* @__PURE__ */ j("span", { children: [B === "Hôm nay" ? "" : `${im(e.createdAt)} · `, B] })
61512
61521
  }) : null;
61513
61522
  if (e.type === "SYSTEM") {
61514
61523
  let t = rl(e).includes("bỏ ghim");
61515
- return /* @__PURE__ */ j(k, { children: [B, /* @__PURE__ */ A("div", {
61524
+ return /* @__PURE__ */ j(k, { children: [ae, /* @__PURE__ */ A("div", {
61516
61525
  className: "message-date",
61517
61526
  children: e.replyTo ? /* @__PURE__ */ j("div", {
61518
61527
  className: "message-date-pin",
@@ -61547,28 +61556,28 @@ function iR({ message: e, isMine: t, currentUserId: n, resolveUserName: r, isGro
61547
61556
  })
61548
61557
  })] });
61549
61558
  }
61550
- let ae = e.type === "DOCUMENT" && !!e.attachments?.length && e.attachments.every(pc), oe = Qc(e.content), se = e.type === "IMAGE" || ae, ce = se && !oe && !z, le = ce && ae, ue = se && oe && !z, de = se && !z, fe = !z && Pte(e), pe = !z && e.type === "STICKER", me = `message-sender ${de ? "message-sender--above" : "message-sender--in-bubble"}`, he = i && !t ? re ? /* @__PURE__ */ A("button", {
61559
+ let oe = e.type === "DOCUMENT" && !!e.attachments?.length && e.attachments.every(pc), se = Qc(e.content), ce = e.type === "IMAGE" || oe, le = ce && !se && !ie, ue = le && oe, de = ce && se && !ie, fe = ce && !ie, pe = !ie && Pte(e), me = !ie && e.type === "STICKER", he = `message-sender ${fe ? "message-sender--above" : "message-sender--in-bubble"}`, ge = i && !t ? z ? /* @__PURE__ */ A("button", {
61551
61560
  type: "button",
61552
- className: me,
61553
- onClick: () => re(e.senderId ?? ""),
61561
+ className: he,
61562
+ onClick: () => z(e.senderId ?? ""),
61554
61563
  children: e.senderName
61555
61564
  }) : /* @__PURE__ */ A("span", {
61556
- className: me,
61565
+ className: he,
61557
61566
  children: e.senderName
61558
- }) : null, ge = t ? e.status === "pending" ? "Đang gửi" : e.status === "failed" ? "Gửi thất bại" : "Đã gửi" : null;
61559
- return /* @__PURE__ */ j(k, { children: [B, /* @__PURE__ */ j("article", {
61567
+ }) : null, _e = t ? e.status === "pending" ? "Đang gửi" : e.status === "failed" ? "Gửi thất bại" : "Đã gửi" : null;
61568
+ return /* @__PURE__ */ j(k, { children: [ae, /* @__PURE__ */ j("article", {
61560
61569
  className: `message message--${t ? "mine" : "incoming"}${a ? " message--focused" : ""}`,
61561
61570
  "data-message-id": e.id ?? void 0,
61562
- children: [t ? null : re ? /* @__PURE__ */ j("button", {
61571
+ children: [t ? null : z ? /* @__PURE__ */ j("button", {
61563
61572
  type: "button",
61564
61573
  className: "message-avatar-button",
61565
61574
  "aria-label": "Xem thông tin tài khoản",
61566
- onClick: () => re(e.senderId ?? ""),
61575
+ onClick: () => z(e.senderId ?? ""),
61567
61576
  children: [/* @__PURE__ */ A(Wm, {
61568
- avatarUrl: ne?.(e.senderId),
61577
+ avatarUrl: re?.(e.senderId),
61569
61578
  name: e.senderName || e.senderId || "",
61570
61579
  className: "message-avatar"
61571
- }), te ? /* @__PURE__ */ A("img", {
61580
+ }), ne ? /* @__PURE__ */ A("img", {
61572
61581
  src: Dl,
61573
61582
  className: "message-avatar-owner-icon",
61574
61583
  alt: "Trưởng nhóm",
@@ -61577,10 +61586,10 @@ function iR({ message: e, isMine: t, currentUserId: n, resolveUserName: r, isGro
61577
61586
  }) : /* @__PURE__ */ j("span", {
61578
61587
  className: "message-avatar-button",
61579
61588
  children: [/* @__PURE__ */ A(Wm, {
61580
- avatarUrl: ne?.(e.senderId),
61589
+ avatarUrl: re?.(e.senderId),
61581
61590
  name: e.senderName || e.senderId || "",
61582
61591
  className: "message-avatar"
61583
- }), te ? /* @__PURE__ */ A("img", {
61592
+ }), ne ? /* @__PURE__ */ A("img", {
61584
61593
  src: Dl,
61585
61594
  className: "message-avatar-owner-icon",
61586
61595
  alt: "Trưởng nhóm",
@@ -61589,14 +61598,14 @@ function iR({ message: e, isMine: t, currentUserId: n, resolveUserName: r, isGro
61589
61598
  }), /* @__PURE__ */ j("div", {
61590
61599
  className: "message-content",
61591
61600
  children: [
61592
- de ? he : null,
61601
+ fe ? ge : null,
61593
61602
  /* @__PURE__ */ j("div", {
61594
61603
  className: "message-bubble-row",
61595
61604
  children: [/* @__PURE__ */ j("div", {
61596
- className: `message-bubble${te && !t ? " message-bubble--owner" : ""}${fe ? " message-bubble--emoji-only" : ""}${ue ? " message-bubble--media-card" : ""}${le ? " message-bubble--bare-video" : ""}${pe ? " message-bubble--sticker" : ""}`,
61605
+ className: `message-bubble${ne && !t ? " message-bubble--owner" : ""}${pe ? " message-bubble--emoji-only" : ""}${de ? " message-bubble--media-card" : ""}${ue ? " message-bubble--bare-video" : ""}${me ? " message-bubble--sticker" : ""}`,
61597
61606
  children: [
61598
- de ? null : he,
61599
- e.replyTo && !z ? /* @__PURE__ */ j("button", {
61607
+ fe ? null : ge,
61608
+ e.replyTo && !ie ? /* @__PURE__ */ j("button", {
61600
61609
  type: "button",
61601
61610
  className: "message-reply-context",
61602
61611
  onClick: () => N(e.replyTo.id, e.replyTo),
@@ -61605,7 +61614,7 @@ function iR({ message: e, isMine: t, currentUserId: n, resolveUserName: r, isGro
61605
61614
  src: co(bm(e.replyTo)) ?? void 0,
61606
61615
  alt: ""
61607
61616
  }) : /* @__PURE__ */ A(Wm, {
61608
- avatarUrl: ne?.(e.replyTo.senderId),
61617
+ avatarUrl: re?.(e.replyTo.senderId),
61609
61618
  name: e.replyTo.senderName,
61610
61619
  className: "message-reply-avatar"
61611
61620
  }), /* @__PURE__ */ j("div", {
@@ -61613,21 +61622,22 @@ function iR({ message: e, isMine: t, currentUserId: n, resolveUserName: r, isGro
61613
61622
  children: [/* @__PURE__ */ A("strong", { children: e.replyTo.senderName }), /* @__PURE__ */ A("small", { children: Cm(e.replyTo) })]
61614
61623
  })]
61615
61624
  }) : null,
61616
- z ? /* @__PURE__ */ A("p", {
61625
+ ie ? /* @__PURE__ */ A("p", {
61617
61626
  className: "message-tombstone",
61618
61627
  children: mm(e, n, r)
61619
61628
  }) : /* @__PURE__ */ A(GL, {
61620
61629
  message: e,
61621
61630
  isLatestMessage: o,
61622
61631
  onOpenImageLightbox: I,
61623
- onImageSettled: L,
61632
+ onOpenStickerPack: L,
61633
+ onImageSettled: R,
61624
61634
  onOpenMentionCard: P
61625
61635
  }),
61626
- ce ? null : /* @__PURE__ */ j("time", {
61636
+ le ? null : /* @__PURE__ */ j("time", {
61627
61637
  className: "message-time",
61628
- children: [im(e.createdAt), ge ? ` · ${ge}` : ""]
61638
+ children: [im(e.createdAt), _e ? ` · ${_e}` : ""]
61629
61639
  }),
61630
- z ? null : /* @__PURE__ */ A(tR, {
61640
+ ie ? null : /* @__PURE__ */ A(tR, {
61631
61641
  message: e,
61632
61642
  isPickerOpen: c,
61633
61643
  myReactionType: l,
@@ -61638,7 +61648,7 @@ function iR({ message: e, isMine: t, currentUserId: n, resolveUserName: r, isGro
61638
61648
  onOpenModal: m
61639
61649
  })
61640
61650
  ]
61641
- }), e.id && e.status !== "failed" && !z ? /* @__PURE__ */ A(dL, {
61651
+ }), e.id && e.status !== "failed" && !ie ? /* @__PURE__ */ A(dL, {
61642
61652
  canRemove: w,
61643
61653
  removeLabel: T,
61644
61654
  isRemoving: E,
@@ -61660,17 +61670,17 @@ function iR({ message: e, isMine: t, currentUserId: n, resolveUserName: r, isGro
61660
61670
  onRemove: D
61661
61671
  }) : null]
61662
61672
  }),
61663
- e.status === "failed" && t && !z ? /* @__PURE__ */ j("div", {
61673
+ e.status === "failed" && t && !ie ? /* @__PURE__ */ j("div", {
61664
61674
  className: "message-retry-actions",
61665
61675
  children: [/* @__PURE__ */ A("button", {
61666
61676
  className: "message-retry",
61667
61677
  type: "button",
61668
- onClick: R,
61678
+ onClick: ee,
61669
61679
  children: "Thử lại"
61670
61680
  }), /* @__PURE__ */ A("button", {
61671
61681
  className: "message-delete-failed",
61672
61682
  type: "button",
61673
- onClick: ee,
61683
+ onClick: te,
61674
61684
  children: "Xóa"
61675
61685
  })]
61676
61686
  }) : null
@@ -61687,58 +61697,58 @@ var aR = vi((e) => ({
61687
61697
  messageId: String(n),
61688
61698
  token: (e.lastRemoval?.token ?? 0) + 1
61689
61699
  } }))
61690
- })), oR = /* @__PURE__ */ new Map(), sR = /* @__PURE__ */ new Set(), cR = 200, lR = 2, uR = 2, dR = (e) => e.id ?? e.clientMessageId ?? String(e.sequence), fR = c(function({ conversationId: e, timelineRef: t, isLoading: n, chatError: r, isTimelineReady: i, isFollowingLatest: a, messageWindow: o, isRemovedMessageId: s, virtuosoRef: c, setScrollerRef: l, handleTimelineScrolling: u, handleVisibleRangeChanged: f, visibleDayLabel: p, isNearBottomOfList: h, onCatchUp: _, members: x, isGroup: S, groupMemberCount: C, currentUserId: w, authUser: T, composerError: E, pendingAttachments: D, isPreparingAttachments: O, onRemovePendingAttachment: M, canModerateMessages: N, canManagePins: P, onDropFiles: F, dayDividerKeys: I, replyTargetState: L, onForward: R, onJumpToReply: ee, onOpenMentionCard: te, onOpenUserProfile: re, onOpenImageLightbox: z, onRetry: ie, onDeleteFailed: B, stickToLatestRef: ae, readIsFollowingLatest: oe, scrollToLatest: se, loadAround: ce, onMessageRemoved: le }, ue) {
61691
- let [de, fe] = b(null), [pe, me] = b(!1), he = (e) => !!F && Array.from(e.dataTransfer.types ?? []).includes("Files"), ge = (e) => {
61692
- he(e) && (e.preventDefault(), me(!0));
61693
- }, _e = (e) => {
61694
- he(e) && (e.preventDefault(), pe || me(!0));
61700
+ })), oR = /* @__PURE__ */ new Map(), sR = /* @__PURE__ */ new Set(), cR = 200, lR = 2, uR = 2, dR = (e) => e.id ?? e.clientMessageId ?? String(e.sequence), fR = c(function({ conversationId: e, timelineRef: t, isLoading: n, chatError: r, isTimelineReady: i, isFollowingLatest: a, messageWindow: o, isRemovedMessageId: s, virtuosoRef: c, setScrollerRef: l, handleTimelineScrolling: u, handleVisibleRangeChanged: f, visibleDayLabel: p, isNearBottomOfList: h, onCatchUp: _, members: x, isGroup: S, groupMemberCount: C, currentUserId: w, authUser: T, composerError: E, pendingAttachments: D, isPreparingAttachments: O, onRemovePendingAttachment: M, canModerateMessages: N, canManagePins: P, onDropFiles: F, dayDividerKeys: I, replyTargetState: L, onForward: R, onJumpToReply: ee, onOpenMentionCard: te, onOpenUserProfile: re, onOpenImageLightbox: z, onOpenStickerPack: ie, onRetry: B, onDeleteFailed: ae, stickToLatestRef: oe, readIsFollowingLatest: se, scrollToLatest: ce, loadAround: le, onMessageRemoved: ue }, de) {
61701
+ let [fe, pe] = b(null), [me, he] = b(!1), ge = (e) => !!F && Array.from(e.dataTransfer.types ?? []).includes("Files"), _e = (e) => {
61702
+ ge(e) && (e.preventDefault(), he(!0));
61695
61703
  }, ve = (e) => {
61696
- e.currentTarget.contains(e.relatedTarget) || me(!1);
61704
+ ge(e) && (e.preventDefault(), me || he(!0));
61697
61705
  }, ye = (e) => {
61698
- if (!he(e)) return;
61699
- e.preventDefault(), me(!1);
61706
+ e.currentTarget.contains(e.relatedTarget) || he(!1);
61707
+ }, be = (e) => {
61708
+ if (!ge(e)) return;
61709
+ e.preventDefault(), he(!1);
61700
61710
  let t = Array.from(e.dataTransfer.files ?? []);
61701
61711
  t.length && F?.(t);
61702
- }, be = o.isLoadingOlder || o.isLoadingNewer || o.isLoadingAround, xe = n || be || o.messages.length > 0 && !i, [Se, Ce] = b(!1);
61712
+ }, xe = o.isLoadingOlder || o.isLoadingNewer || o.isLoadingAround, Se = n || xe || o.messages.length > 0 && !i, [Ce, we] = b(!1);
61703
61713
  m(() => {
61704
- if (!xe) {
61705
- Ce(!1);
61714
+ if (!Se) {
61715
+ we(!1);
61706
61716
  return;
61707
61717
  }
61708
- let e = setTimeout(() => Ce(!0), cR);
61718
+ let e = setTimeout(() => we(!0), cR);
61709
61719
  return () => clearTimeout(e);
61710
- }, [xe]);
61711
- let we = D.filter((e) => e.previewUrl), Te = UI(), Ee = LI(e, () => Te.closePicker()), De = GI(), Oe = QI(), ke = iL(t), Ae = aL(x, S, C), je = BI((e) => e.conversationId), Me = BI((e) => e.close);
61712
- g(ue, () => ({ closeMessageMenu: ke.closeMenu }), [ke.closeMenu]);
61713
- let Ne = d((t) => {
61720
+ }, [Se]);
61721
+ let Te = D.filter((e) => e.previewUrl), Ee = UI(), De = LI(e, () => Ee.closePicker()), Oe = GI(), ke = QI(), Ae = iL(t), je = aL(x, S, C), Me = BI((e) => e.conversationId), Ne = BI((e) => e.close);
61722
+ g(de, () => ({ closeMessageMenu: Ae.closeMenu }), [Ae.closeMenu]);
61723
+ let Pe = d((t) => {
61714
61724
  if (!V(t.conversationId, e)) return;
61715
61725
  let n = String(t.messageId);
61716
- aR.getState().noteRemoval(String(t.conversationId), n), ke.clearIfTarget(n), Te.clearIfTarget(n), De.clearIfTarget(n), Ae.clearIfTarget(n), Ee.clearIfTarget(n), le(t);
61726
+ aR.getState().noteRemoval(String(t.conversationId), n), Ae.clearIfTarget(n), Ee.clearIfTarget(n), Oe.clearIfTarget(n), je.clearIfTarget(n), De.clearIfTarget(n), ue(t);
61717
61727
  }, [
61718
61728
  e,
61719
- Ae.clearIfTarget,
61720
- le,
61721
- Ee.clearIfTarget,
61722
- De.clearIfTarget
61723
- ]), Pe = sL(e, w, N, Ne, (e) => ke.setOpenId(e.id ?? null));
61729
+ je.clearIfTarget,
61730
+ ue,
61731
+ De.clearIfTarget,
61732
+ Oe.clearIfTarget
61733
+ ]), Fe = sL(e, w, N, Pe, (e) => Ae.setOpenId(e.id ?? null));
61724
61734
  m(() => {
61725
- Ee.reset(), Promise.resolve().then(Ee.refreshPinned);
61726
- }, [e, Ee.refreshPinned]), m(() => e ? As({
61735
+ De.reset(), Promise.resolve().then(De.refreshPinned);
61736
+ }, [e, De.refreshPinned]), m(() => e ? As({
61727
61737
  onMessagePinned: (t) => {
61728
61738
  let n = fl(t?.data ?? t, e);
61729
- V(n.conversationId, e) && !ol(n) && !s(String(n.id)) && Ee.applyPinnedUpdate(n);
61739
+ V(n.conversationId, e) && !ol(n) && !s(String(n.id)) && De.applyPinnedUpdate(n);
61730
61740
  },
61731
61741
  onMessageRemoved: (e) => {
61732
61742
  let t = e?.data ?? e;
61733
- !t?.conversationId || !t.messageId || !t.removedAt || !t.removedById || Ne(t);
61743
+ !t?.conversationId || !t.messageId || !t.removedAt || !t.removedById || Pe(t);
61734
61744
  }
61735
61745
  }) : void 0, [
61736
61746
  e,
61737
61747
  s,
61738
- Ee.applyPinnedUpdate,
61739
- Ne
61748
+ De.applyPinnedUpdate,
61749
+ Pe
61740
61750
  ]);
61741
- let Fe = d((t, n) => {
61751
+ let Ie = d((t, n) => {
61742
61752
  if (!(!e || !t)) try {
61743
61753
  Mm(Bs({
61744
61754
  conversationId: e,
@@ -61748,7 +61758,7 @@ var aR = vi((e) => ({
61748
61758
  } catch (e) {
61749
61759
  console.warn("Unable to apply reaction", e);
61750
61760
  }
61751
- }, [e]), Ie = d((t) => {
61761
+ }, [e]), Le = d((t) => {
61752
61762
  if (!(!e || !t)) try {
61753
61763
  Mm(Vs({
61754
61764
  conversationId: e,
@@ -61757,16 +61767,16 @@ var aR = vi((e) => ({
61757
61767
  } catch (e) {
61758
61768
  console.warn("Unable to remove reaction", e);
61759
61769
  }
61760
- }, [e]), Le = o.messages.find((e) => V(e.id, De.messageId)) ?? null, Re = (e) => jN(e, x), ze = (e) => kN(e, x, w, T), Be = (e) => {
61770
+ }, [e]), Re = o.messages.find((e) => V(e.id, Oe.messageId)) ?? null, ze = (e) => jN(e, x), Be = (e) => kN(e, x, w, T), Ve = (e) => {
61761
61771
  let t = document.querySelector(`.message[data-message-id="${CSS.escape(e)}"] .message-bubble`);
61762
61772
  if (!t) return "";
61763
61773
  let n = t.cloneNode(!0);
61764
61774
  return n.querySelectorAll(".message-sender, .message-reply-context, .message-time, .message-reaction-anchor").forEach((e) => e.remove()), n.innerHTML.trim();
61765
- }, Ve = async (e) => {
61766
- ke.closeMenu();
61775
+ }, He = async (e) => {
61776
+ Ae.closeMenu();
61767
61777
  let t = rl(e);
61768
61778
  if (!t) return;
61769
- let n = e.id ? Be(String(e.id)) : "";
61779
+ let n = e.id ? Ve(String(e.id)) : "";
61770
61780
  try {
61771
61781
  n && typeof ClipboardItem < "u" && navigator.clipboard.write ? await navigator.clipboard.write([new ClipboardItem({
61772
61782
  "text/html": new Blob([n], { type: "text/html" }),
@@ -61775,9 +61785,9 @@ var aR = vi((e) => ({
61775
61785
  } catch {
61776
61786
  jm.error("Không sao chép được tin nhắn");
61777
61787
  }
61778
- }, He = o.focusedMessageId ? o.messages.findIndex((e) => V(e.id, o.focusedMessageId)) : -1, [, We] = b(0), Ge = oR.get(e ?? "") ?? sR, Ke = (t) => {
61788
+ }, We = o.focusedMessageId ? o.messages.findIndex((e) => V(e.id, o.focusedMessageId)) : -1, [, Ge] = b(0), Ke = oR.get(e ?? "") ?? sR, qe = (t) => {
61779
61789
  let n = e ?? "", r = oR.get(n) ?? /* @__PURE__ */ new Set();
61780
- r.add(t), oR.set(n, r), We((e) => e + 1);
61790
+ r.add(t), oR.set(n, r), Ge((e) => e + 1);
61781
61791
  };
61782
61792
  m(() => {
61783
61793
  let t = e ?? "";
@@ -61785,20 +61795,20 @@ var aR = vi((e) => ({
61785
61795
  oR.delete(t);
61786
61796
  };
61787
61797
  }, [e]);
61788
- let qe = y(!1);
61798
+ let Je = y(!1);
61789
61799
  m(() => {
61790
61800
  if (!o.focusedMessageId) return;
61791
- qe.current = !0;
61801
+ Je.current = !0;
61792
61802
  let e = t.current;
61793
61803
  if (!e) return;
61794
61804
  let n = () => {
61795
- qe.current = !1;
61805
+ Je.current = !1;
61796
61806
  };
61797
61807
  return e.addEventListener("wheel", n, { passive: !0 }), e.addEventListener("touchstart", n, { passive: !0 }), e.addEventListener("mousedown", n), e.addEventListener("keydown", n), () => {
61798
61808
  e.removeEventListener("wheel", n), e.removeEventListener("touchstart", n), e.removeEventListener("mousedown", n), e.removeEventListener("keydown", n);
61799
61809
  };
61800
61810
  }, [o.focusedMessageId, t]);
61801
- let Je = S ? nm(x) : null, Ye = v(() => {
61811
+ let Ye = S ? nm(x) : null, Xe = v(() => {
61802
61812
  let e = /* @__PURE__ */ new Map(), t = o.messages, n = 0;
61803
61813
  for (; n < t.length;) {
61804
61814
  if (t[n].type !== "SYSTEM") {
@@ -61822,15 +61832,15 @@ var aR = vi((e) => ({
61822
61832
  }, [o.messages]);
61823
61833
  return /* @__PURE__ */ j(k, { children: [
61824
61834
  /* @__PURE__ */ j("section", {
61825
- className: `message-timeline${pe ? " is-dropping-files" : ""}`,
61835
+ className: `message-timeline${me ? " is-dropping-files" : ""}`,
61826
61836
  "aria-label": "Nội dung cuộc trò chuyện",
61827
61837
  ref: t,
61828
- onDragEnter: ge,
61829
- onDragOver: _e,
61830
- onDragLeave: ve,
61831
- onDrop: ye,
61838
+ onDragEnter: _e,
61839
+ onDragOver: ve,
61840
+ onDragLeave: ye,
61841
+ onDrop: be,
61832
61842
  children: [
61833
- pe ? /* @__PURE__ */ A("div", {
61843
+ me ? /* @__PURE__ */ A("div", {
61834
61844
  className: "message-timeline-dropzone",
61835
61845
  "aria-hidden": "true",
61836
61846
  children: /* @__PURE__ */ A("span", { children: "Thả file để gửi ngay" })
@@ -61840,19 +61850,19 @@ var aR = vi((e) => ({
61840
61850
  currentUserId: w,
61841
61851
  isOwner: N,
61842
61852
  isGroup: S,
61843
- onJump: (e) => ce(e),
61853
+ onJump: (e) => le(e),
61844
61854
  timelineRef: t
61845
61855
  }),
61846
- V(je, e) ? /* @__PURE__ */ A(zI, {
61856
+ V(Me, e) ? /* @__PURE__ */ A(zI, {
61847
61857
  conversationId: e,
61848
61858
  currentUserId: w,
61849
61859
  isOwner: N,
61850
- onClose: Me,
61851
- onJumpToMessage: (e) => ce(String(e.id)),
61852
- resolveUserAvatar: Re
61860
+ onClose: Ne,
61861
+ onJumpToMessage: (e) => le(String(e.id)),
61862
+ resolveUserAvatar: ze
61853
61863
  }) : null,
61854
- xe && Se ? /* @__PURE__ */ A("div", {
61855
- className: `conversation-loading-overlay${be && !n ? " is-deferred" : ""}`,
61864
+ Se && Ce ? /* @__PURE__ */ A("div", {
61865
+ className: `conversation-loading-overlay${xe && !n ? " is-deferred" : ""}`,
61856
61866
  children: /* @__PURE__ */ A(Iu, {
61857
61867
  src: Lu,
61858
61868
  className: "conversation-loading-animation"
@@ -61887,14 +61897,14 @@ var aR = vi((e) => ({
61887
61897
  isScrolling: u,
61888
61898
  data: o.messages,
61889
61899
  firstItemIndex: o.firstItemIndex,
61890
- initialTopMostItemIndex: He >= 0 ? {
61891
- index: He,
61900
+ initialTopMostItemIndex: We >= 0 ? {
61901
+ index: We,
61892
61902
  align: "center"
61893
61903
  } : void 0,
61894
61904
  totalListHeightChanged: () => {
61895
- He < 0 || !qe.current || requestAnimationFrame(() => {
61905
+ We < 0 || !Je.current || requestAnimationFrame(() => {
61896
61906
  c.current?.scrollToIndex({
61897
- index: He,
61907
+ index: We,
61898
61908
  align: "center"
61899
61909
  });
61900
61910
  });
@@ -61910,8 +61920,8 @@ var aR = vi((e) => ({
61910
61920
  rangeChanged: f,
61911
61921
  computeItemKey: (e, t) => t.id ?? t.clientMessageId ?? String(t.sequence),
61912
61922
  itemContent: (e, t) => {
61913
- let n = t.id ?? t.clientMessageId ?? String(t.sequence), r = Ye.get(n);
61914
- if (r && !Ge.has(r.leadKey)) {
61923
+ let n = t.id ?? t.clientMessageId ?? String(t.sequence), r = Xe.get(n);
61924
+ if (r && !Ke.has(r.leadKey)) {
61915
61925
  let e = r.size - uR, t = r.position >= e;
61916
61926
  if (r.position > 0 && !t) return /* @__PURE__ */ A("div", {
61917
61927
  className: "message-collapsed-spacer",
@@ -61922,59 +61932,60 @@ var aR = vi((e) => ({
61922
61932
  children: /* @__PURE__ */ A("button", {
61923
61933
  type: "button",
61924
61934
  className: "system-run-toggle-button",
61925
- onClick: () => Ke(r.leadKey),
61935
+ onClick: () => qe(r.leadKey),
61926
61936
  children: "Xem thêm"
61927
61937
  })
61928
61938
  });
61929
61939
  }
61930
- let i = V(t.senderId, w), a = Ee.pinnedMessages.find((e) => V(e.id, t.id)), s = a ? PI(a, w, N) : !1, c = i || N, l = i ? "Thu hồi tin nhắn" : "Gỡ tin nhắn", u = V(t.id, o.focusedMessageId), d = o.messages.at(-1)?.clientMessageId === t.clientMessageId;
61940
+ let i = V(t.senderId, w), a = De.pinnedMessages.find((e) => V(e.id, t.id)), s = a ? PI(a, w, N) : !1, c = i || N, l = i ? "Thu hồi tin nhắn" : "Gỡ tin nhắn", u = V(t.id, o.focusedMessageId), d = o.messages.at(-1)?.clientMessageId === t.clientMessageId;
61931
61941
  return /* @__PURE__ */ A(iR, {
61932
61942
  message: t,
61933
61943
  isMine: i,
61934
61944
  currentUserId: w,
61935
- resolveUserName: ze,
61945
+ resolveUserName: Be,
61936
61946
  isGroup: S,
61937
61947
  isFocused: u,
61938
61948
  isLatestMessage: d,
61939
61949
  showDayDivider: I.has(n),
61940
- isReactionPickerOpen: Te.reactionPickerMessageId === t.id,
61950
+ isReactionPickerOpen: Ee.reactionPickerMessageId === t.id,
61941
61951
  myReactionType: t.reactionSummary.mine?.type ?? null,
61942
- onOpenReactionPicker: () => Te.openPicker(t.id ?? null),
61943
- onCloseReactionPickerIfSelf: () => t.id && Te.clearIfTarget(t.id),
61944
- onApplyReaction: (e) => Fe(t.id, e),
61945
- onRemoveReaction: () => Ie(t.id),
61946
- onOpenReactionModal: () => De.open(t.id, null),
61947
- onOpenSystemMembers: Oe.open,
61948
- resolveUserAvatar: Re,
61952
+ onOpenReactionPicker: () => Ee.openPicker(t.id ?? null),
61953
+ onCloseReactionPickerIfSelf: () => t.id && Ee.clearIfTarget(t.id),
61954
+ onApplyReaction: (e) => Ie(t.id, e),
61955
+ onRemoveReaction: () => Le(t.id),
61956
+ onOpenReactionModal: () => Oe.open(t.id, null),
61957
+ onOpenSystemMembers: ke.open,
61958
+ resolveUserAvatar: ze,
61949
61959
  canManagePins: P,
61950
61960
  isPinned: s,
61951
61961
  onTogglePin: () => {
61952
- ke.closeMenu(), Ee.togglePin(t, !s);
61962
+ Ae.closeMenu(), De.togglePin(t, !s);
61953
61963
  },
61954
- isMenuOpen: ke.openMessageMenuId === t.id,
61955
- menuPosition: ke.messageMenuPosition,
61956
- onOpenMenu: (e) => ke.openMenu(t.id ?? "", e),
61957
- onCloseMenu: () => ke.closeMenu(),
61958
- onCopyMessage: () => Ve(t),
61964
+ isMenuOpen: Ae.openMessageMenuId === t.id,
61965
+ menuPosition: Ae.messageMenuPosition,
61966
+ onOpenMenu: (e) => Ae.openMenu(t.id ?? "", e),
61967
+ onCloseMenu: () => Ae.closeMenu(),
61968
+ onCopyMessage: () => He(t),
61959
61969
  onViewDetails: () => {
61960
- ke.closeMenu(), Ae.openDetails(t);
61970
+ Ae.closeMenu(), je.openDetails(t);
61961
61971
  },
61962
61972
  canRemove: c,
61963
61973
  removeLabel: l,
61964
- isRemoving: t.id ? Pe.removalInFlightIds.has(t.id) : !1,
61965
- onRemove: () => Pe.requestRemoval(t),
61974
+ isRemoving: t.id ? Fe.removalInFlightIds.has(t.id) : !1,
61975
+ onRemove: () => Fe.requestRemoval(t),
61966
61976
  onReply: () => L.startReply(t),
61967
61977
  onForward: () => R(t),
61968
61978
  onJumpToReply: ee,
61969
61979
  onOpenMentionCard: te,
61970
61980
  onOpenUserProfile: re,
61971
61981
  onOpenImageLightbox: (e, n) => z(t, e, n),
61982
+ onOpenStickerPack: ie,
61972
61983
  onImageSettled: () => {
61973
- (ae.current || oe()) && requestAnimationFrame(() => requestAnimationFrame(() => se("auto")));
61984
+ (oe.current || se()) && requestAnimationFrame(() => requestAnimationFrame(() => ce("auto")));
61974
61985
  },
61975
- onRetry: () => ie(t),
61976
- onDeleteFailed: () => B(t),
61977
- isSenderGroupOwner: Je != null && V(t.senderId ?? "", Je)
61986
+ onRetry: () => B(t),
61987
+ onDeleteFailed: () => ae(t),
61988
+ isSenderGroupOwner: Ye != null && V(t.senderId ?? "", Ye)
61978
61989
  });
61979
61990
  }
61980
61991
  }, o.timelineRevision)
@@ -62032,14 +62043,14 @@ var aR = vi((e) => ({
62032
62043
  D.length > 0 ? /* @__PURE__ */ A("div", {
62033
62044
  className: "composer-attachments-preview",
62034
62045
  children: D.map((e, t) => {
62035
- let n = e.previewUrl ? null : kp(e.file.name), r = we.indexOf(e);
62046
+ let n = e.previewUrl ? null : kp(e.file.name), r = Te.indexOf(e);
62036
62047
  return /* @__PURE__ */ j("div", {
62037
62048
  className: "composer-attachment-thumb",
62038
62049
  children: [e.previewUrl ? /* @__PURE__ */ j("button", {
62039
62050
  type: "button",
62040
62051
  className: "composer-attachment-thumb-preview",
62041
62052
  "aria-label": `Xem trước ${e.file.name}`,
62042
- onClick: () => fe(r),
62053
+ onClick: () => pe(r),
62043
62054
  children: [/* @__PURE__ */ A("img", {
62044
62055
  src: e.previewUrl,
62045
62056
  alt: e.file.name
@@ -62070,9 +62081,9 @@ var aR = vi((e) => ({
62070
62081
  }, `${e.file.name}-${t}`);
62071
62082
  })
62072
62083
  }) : null,
62073
- de === null ? null : /* @__PURE__ */ A(Lp, {
62084
+ fe === null ? null : /* @__PURE__ */ A(Lp, {
62074
62085
  state: {
62075
- items: we.map((e, t) => ({
62086
+ items: Te.map((e, t) => ({
62076
62087
  id: `${e.file.name}-${t}`,
62077
62088
  url: e.kind === "VIDEO" ? e.videoUrl ?? e.previewUrl : e.previewUrl,
62078
62089
  kind: e.kind,
@@ -62081,54 +62092,54 @@ var aR = vi((e) => ({
62081
62092
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
62082
62093
  name: e.file.name
62083
62094
  })),
62084
- index: de
62095
+ index: fe
62085
62096
  },
62086
- onClose: () => fe(null),
62087
- onIndexChange: fe
62097
+ onClose: () => pe(null),
62098
+ onIndexChange: pe
62088
62099
  }),
62089
- Oe.messageId ? /* @__PURE__ */ A($I, {
62090
- totalCount: Oe.totalCount,
62091
- actionLabel: Oe.actionLabel,
62100
+ ke.messageId ? /* @__PURE__ */ A($I, {
62101
+ totalCount: ke.totalCount,
62102
+ actionLabel: ke.actionLabel,
62103
+ items: ke.items,
62104
+ isLoading: ke.isLoading,
62105
+ error: ke.error,
62106
+ hasMore: ke.hasMore,
62107
+ onLoadMore: ke.loadMore,
62108
+ onRetry: ke.retry,
62109
+ onClose: ke.close,
62110
+ members: x,
62111
+ onOpenProfile: re
62112
+ }) : null,
62113
+ Re ? /* @__PURE__ */ A(XI, {
62114
+ message: Re,
62115
+ filter: Oe.filter,
62092
62116
  items: Oe.items,
62093
62117
  isLoading: Oe.isLoading,
62094
62118
  error: Oe.error,
62095
62119
  hasMore: Oe.hasMore,
62120
+ onFilterChange: Oe.changeFilter,
62096
62121
  onLoadMore: Oe.loadMore,
62097
62122
  onRetry: Oe.retry,
62098
62123
  onClose: Oe.close,
62099
62124
  members: x,
62100
62125
  onOpenProfile: re
62101
62126
  }) : null,
62102
- Le ? /* @__PURE__ */ A(XI, {
62103
- message: Le,
62104
- filter: De.filter,
62105
- items: De.items,
62106
- isLoading: De.isLoading,
62107
- error: De.error,
62108
- hasMore: De.hasMore,
62109
- onFilterChange: De.changeFilter,
62110
- onLoadMore: De.loadMore,
62111
- onRetry: De.retry,
62112
- onClose: De.close,
62113
- members: x,
62114
- onOpenProfile: re
62115
- }) : null,
62116
- Ae.detailsMessage ? /* @__PURE__ */ A(oL, {
62117
- message: Ae.detailsMessage,
62127
+ je.detailsMessage ? /* @__PURE__ */ A(oL, {
62128
+ message: je.detailsMessage,
62118
62129
  isGroup: S,
62119
62130
  members: x,
62120
62131
  otherMember: S ? void 0 : x?.find((e) => !V(e.userId, w)),
62121
62132
  currentUserId: w,
62122
62133
  authUser: T,
62123
- seenBy: Ae.detailsSeenBy,
62124
- onClose: () => Ae.closeDetails(),
62134
+ seenBy: je.detailsSeenBy,
62135
+ onClose: () => je.closeDetails(),
62125
62136
  onOpenProfile: re
62126
62137
  }) : null,
62127
- Pe.pendingRemoval ? /* @__PURE__ */ A($m, {
62128
- title: Pe.pendingRemoval.isMine ? "Thu hồi tin nhắn" : "Gỡ tin nhắn",
62129
- confirmLabel: Pe.pendingRemoval.isMine ? "Thu hồi" : "Gỡ",
62130
- onCancel: Pe.cancelRemoval,
62131
- onConfirm: Pe.confirmRemoval,
62138
+ Fe.pendingRemoval ? /* @__PURE__ */ A($m, {
62139
+ title: Fe.pendingRemoval.isMine ? "Thu hồi tin nhắn" : "Gỡ tin nhắn",
62140
+ confirmLabel: Fe.pendingRemoval.isMine ? "Thu hồi" : "Gỡ",
62141
+ onCancel: Fe.cancelRemoval,
62142
+ onConfirm: Fe.confirmRemoval,
62132
62143
  children: /* @__PURE__ */ A("p", { children: "Tin nhắn sẽ không thể khôi phục sau khi thu hồi." })
62133
62144
  }) : null
62134
62145
  ] });
@@ -66068,28 +66079,36 @@ function gU() {
66068
66079
  //#endregion
66069
66080
  //#region src/features/stickers/sticker-picker/sticker-picker-panel.tsx
66070
66081
  var _U = 150;
66071
- function vU({ onSelectSticker: e, onClose: t }) {
66082
+ function vU({ onSelectSticker: e, onClose: t, initialPackSlug: n }) {
66072
66083
  kl(t);
66073
- let n = bg((e) => e.manifest), r = bg((e) => e.loadedPacksBySlug), i = gU(), [a, o] = b(""), s = hi(a, _U), c = y(null), l = s.trim().length > 0, u = !l && i.length > 0, d = v(() => n ? _te(n, r, s) : [], [
66074
- n,
66084
+ let r = bg((e) => e.manifest), i = bg((e) => e.loadedPacksBySlug), a = gU(), [o, s] = b(""), c = hi(o, _U), l = y(null), u = c.trim().length > 0, d = !u && a.length > 0, f = v(() => r ? _te(r, i, c) : [], [
66075
66085
  r,
66076
- s
66077
- ]), f = v(() => [...u ? [fU] : [], ...d.map((e) => e.pack.slug)], [u, d]), { activeSectionId: p, scrollToSection: h } = uU(c, f), g = y(null);
66086
+ i,
66087
+ c
66088
+ ]), p = v(() => [...d ? [fU] : [], ...f.map((e) => e.pack.slug)], [d, f]), { activeSectionId: h, scrollToSection: g } = uU(l, p), _ = y(!1);
66078
66089
  m(() => {
66079
- let e = g.current;
66080
- l || !e || (g.current = null, h(e));
66090
+ _.current || !n || p.includes(n) && (_.current = !0, g(n));
66081
66091
  }, [
66082
- l,
66083
- f,
66084
- h
66092
+ n,
66093
+ p,
66094
+ g
66085
66095
  ]);
66086
- let _ = (e) => {
66087
- if (o(""), !l) {
66088
- h(e);
66096
+ let x = y(null);
66097
+ m(() => {
66098
+ let e = x.current;
66099
+ u || !e || (x.current = null, g(e));
66100
+ }, [
66101
+ u,
66102
+ p,
66103
+ g
66104
+ ]);
66105
+ let S = (e) => {
66106
+ if (s(""), !u) {
66107
+ g(e);
66089
66108
  return;
66090
66109
  }
66091
- g.current = e;
66092
- }, x = !!n?.packs.every((e) => r[e.slug]), S = !n || l && d.length === 0 && !x, C = l && d.length === 0 && x;
66110
+ x.current = e;
66111
+ }, C = !!r?.packs.every((e) => i[e.slug]), w = !r || u && f.length === 0 && !C, T = u && f.length === 0 && C;
66093
66112
  return /* @__PURE__ */ j("div", {
66094
66113
  className: "sticker-picker",
66095
66114
  children: [
@@ -66097,34 +66116,34 @@ function vU({ onSelectSticker: e, onClose: t }) {
66097
66116
  className: "sticker-picker__search",
66098
66117
  children: [/* @__PURE__ */ A(Er, {}), /* @__PURE__ */ A("input", {
66099
66118
  type: "search",
66100
- value: a,
66119
+ value: o,
66101
66120
  placeholder: "Tìm kiếm sticker",
66102
66121
  "aria-label": "Tìm kiếm sticker",
66103
66122
  onChange: (e) => {
66104
- g.current = null, o(e.target.value);
66123
+ x.current = null, s(e.target.value);
66105
66124
  }
66106
66125
  })]
66107
66126
  }),
66108
66127
  /* @__PURE__ */ j("div", {
66109
- ref: c,
66128
+ ref: l,
66110
66129
  className: "sticker-picker__scroll",
66111
66130
  children: [
66112
- S ? /* @__PURE__ */ A("div", {
66131
+ w ? /* @__PURE__ */ A("div", {
66113
66132
  className: "sticker-picker__status",
66114
66133
  children: /* @__PURE__ */ A(ne, { size: "small" })
66115
66134
  }) : null,
66116
- C ? /* @__PURE__ */ A("div", {
66135
+ T ? /* @__PURE__ */ A("div", {
66117
66136
  className: "sticker-picker__status",
66118
66137
  children: "Không tìm thấy sticker"
66119
66138
  }) : null,
66120
- u ? /* @__PURE__ */ A(dU, {
66139
+ d ? /* @__PURE__ */ A(dU, {
66121
66140
  sectionId: fU,
66122
66141
  title: "Gần đây",
66123
- stickers: i,
66142
+ stickers: a,
66124
66143
  placeholderCount: 0,
66125
66144
  onSelectSticker: e
66126
66145
  }) : null,
66127
- d.map((t) => /* @__PURE__ */ A(dU, {
66146
+ f.map((t) => /* @__PURE__ */ A(dU, {
66128
66147
  sectionId: t.pack.slug,
66129
66148
  title: t.pack.name,
66130
66149
  stickers: t.stickers,
@@ -66134,9 +66153,9 @@ function vU({ onSelectSticker: e, onClose: t }) {
66134
66153
  ]
66135
66154
  }),
66136
66155
  /* @__PURE__ */ A(mU, {
66137
- packs: n?.packs ?? [],
66138
- activeSectionId: p,
66139
- onSelectSection: _
66156
+ packs: r?.packs ?? [],
66157
+ activeSectionId: h,
66158
+ onSelectSection: S
66140
66159
  })
66141
66160
  ]
66142
66161
  });
@@ -66165,41 +66184,51 @@ function yU() {
66165
66184
  }
66166
66185
  //#endregion
66167
66186
  //#region src/features/composer/sticker/sticker-picker-button.tsx
66168
- function bU({ onSelectSticker: e, isCompact: t }) {
66169
- let [n, r] = b(!1), i = y(null), a = y(null), o = d(() => r(!1), []);
66187
+ var bU = c(function({ onSelectSticker: e, isCompact: t }, n) {
66188
+ let [r, i] = b(!1), [a, o] = b(null), s = y(0), c = y(null), l = y(null), u = d(() => {
66189
+ i(!1), o(null);
66190
+ }, []);
66170
66191
  return IH({
66171
- isOpen: n,
66172
- containerRef: i,
66173
- triggerRef: a,
66174
- onDismiss: o
66175
- }), /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(B, {
66192
+ isOpen: r,
66193
+ containerRef: c,
66194
+ triggerRef: l,
66195
+ onDismiss: u
66196
+ }), g(n, () => ({ openPack: (e) => {
66197
+ s.current += 1, o({
66198
+ packSlug: e,
66199
+ requestId: s.current
66200
+ }), i(!0);
66201
+ } }), []), /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(B, {
66176
66202
  title: "Sticker",
66177
66203
  children: /* @__PURE__ */ A("button", {
66178
- ref: a,
66204
+ ref: l,
66179
66205
  type: "button",
66180
66206
  "aria-label": "Sticker",
66181
- "aria-pressed": n,
66182
- className: `composer-sticker-button${n ? " is-active" : ""}`,
66183
- onClick: () => r((e) => !e),
66207
+ "aria-pressed": r,
66208
+ className: `composer-sticker-button${r ? " is-active" : ""}`,
66209
+ onClick: () => {
66210
+ o(null), i((e) => !e);
66211
+ },
66184
66212
  children: /* @__PURE__ */ A(yU, {})
66185
66213
  })
66186
- }), n ? /* @__PURE__ */ A("div", {
66214
+ }), r ? /* @__PURE__ */ A("div", {
66187
66215
  className: `composer-popover-anchor${t ? " composer-popover-anchor--compact" : ""}`,
66188
- ref: i,
66216
+ ref: c,
66189
66217
  children: /* @__PURE__ */ A("div", {
66190
66218
  className: "composer-popover",
66191
66219
  children: /* @__PURE__ */ A(vU, {
66192
66220
  onSelectSticker: (t) => {
66193
- e(t) && o();
66221
+ e(t) && u();
66194
66222
  },
66195
- onClose: o
66196
- })
66223
+ onClose: u,
66224
+ initialPackSlug: a?.packSlug
66225
+ }, a?.requestId ?? "manual")
66197
66226
  })
66198
66227
  }) : null] });
66199
- }
66228
+ });
66200
66229
  //#endregion
66201
66230
  //#region src/features/composer/toolbar/composer-toolbar.tsx
66202
- function xU({ editor: e, onAttach: t, onAttachImages: n, isFormatOpen: r, onToggleFormat: i, isEnlarged: a, onToggleEnlarged: o, sendButton: s, isCollapsed: c = !1, onExpand: l, showEmojiButton: u = !0, onSelectSticker: d, showStickerButton: f = !0 }) {
66231
+ function xU({ editor: e, onAttach: t, onAttachImages: n, isFormatOpen: r, onToggleFormat: i, isEnlarged: a, onToggleEnlarged: o, sendButton: s, isCollapsed: c = !1, onExpand: l, showEmojiButton: u = !0, onSelectSticker: d, showStickerButton: f = !0, stickerPickerRef: p, stickerPickerKey: m }) {
66203
66232
  return c && !r ? /* @__PURE__ */ A("div", {
66204
66233
  className: "message-toolbar",
66205
66234
  "aria-label": "Công cụ soạn tin",
@@ -66233,7 +66262,10 @@ function xU({ editor: e, onAttach: t, onAttachImages: n, isFormatOpen: r, onTogg
66233
66262
  })
66234
66263
  }),
66235
66264
  u ? /* @__PURE__ */ A(LH, { editor: e }) : null,
66236
- f && d ? /* @__PURE__ */ A(bU, { onSelectSticker: d }) : null
66265
+ f && d ? /* @__PURE__ */ A(bU, {
66266
+ ref: p,
66267
+ onSelectSticker: d
66268
+ }, m) : null
66237
66269
  ]
66238
66270
  }), r ? /* @__PURE__ */ A(oU, {
66239
66271
  editor: e,
@@ -66454,7 +66486,7 @@ var VU = c(function({ draftKey: e, conversationName: t, members: n, canMentionAl
66454
66486
  }), re = Zh((e) => e.setDraft), z = y({
66455
66487
  key: e,
66456
66488
  doc: null
66457
- }), ie = y(e), B = y(re), ae = y(!1);
66489
+ }), ie = y(e), B = y(re), ae = y(!1), oe = y(null);
66458
66490
  m(() => {
66459
66491
  E.current = l, O.current = u, k.current = h, D.current = c ?? !1, ie.current = e, B.current = re;
66460
66492
  }, [
@@ -66465,7 +66497,7 @@ var VU = c(function({ draftKey: e, conversationName: t, members: n, canMentionAl
66465
66497
  l,
66466
66498
  re
66467
66499
  ]);
66468
- let oe = v(() => [...r ? [{
66500
+ let se = v(() => [...r ? [{
66469
66501
  id: FU,
66470
66502
  label: "all",
66471
66503
  isAll: !0
@@ -66474,7 +66506,7 @@ var VU = c(function({ draftKey: e, conversationName: t, members: n, canMentionAl
66474
66506
  label: xc(e),
66475
66507
  fallbackName: xc(e),
66476
66508
  avatarUrl: co(e.avatarUrl ?? e.avatar ?? null)
66477
- }))], [r, n]), se = WA({
66509
+ }))], [r, n]), ce = WA({
66478
66510
  immediatelyRender: !1,
66479
66511
  extensions: [
66480
66512
  dN.configure({
@@ -66507,7 +66539,7 @@ var VU = c(function({ draftKey: e, conversationName: t, members: n, canMentionAl
66507
66539
  suggestion: {
66508
66540
  items: ({ query: e }) => {
66509
66541
  let t = bl(e.trim());
66510
- return oe.filter((e) => bl(e.label).includes(t));
66542
+ return se.filter((e) => bl(e.label).includes(t));
66511
66543
  },
66512
66544
  floatingUi: { strategy: "fixed" },
66513
66545
  render: () => RU(M),
@@ -66571,65 +66603,66 @@ var VU = c(function({ draftKey: e, conversationName: t, members: n, canMentionAl
66571
66603
  onTransaction: () => ee((e) => e + 1),
66572
66604
  autofocus: !0
66573
66605
  }, [
66574
- oe,
66606
+ se,
66575
66607
  i,
66576
66608
  a
66577
66609
  ]);
66578
66610
  m(() => {
66579
- if (!se) return;
66611
+ if (!ce) return;
66580
66612
  let t = () => {
66581
- if (se.isDestroyed) return;
66613
+ if (ce.isDestroyed) return;
66582
66614
  let t = e ? Zh.getState().draftByConversation[e] : null;
66583
66615
  z.current = {
66584
66616
  key: e,
66585
66617
  doc: t ?? null
66586
66618
  };
66587
66619
  try {
66588
- se.commands.setContent(t ?? "", {
66620
+ ce.commands.setContent(t ?? "", {
66589
66621
  emitUpdate: !1,
66590
66622
  errorOnInvalidContent: !1
66591
66623
  });
66592
66624
  } catch {
66593
- eU(se);
66625
+ eU(ce);
66594
66626
  }
66595
66627
  }, n = () => {
66596
66628
  if (!e) return;
66597
66629
  let t = z.current;
66598
66630
  t.key === e && re(e, t.doc && Yh(t.doc) ? t.doc : null);
66599
66631
  };
66600
- return se.isInitialized ? (t(), n) : (se.on("create", t), () => {
66601
- se.off("create", t), n();
66632
+ return ce.isInitialized ? (t(), n) : (ce.on("create", t), () => {
66633
+ ce.off("create", t), n();
66602
66634
  });
66603
66635
  }, [
66604
- se,
66636
+ ce,
66605
66637
  e,
66606
66638
  re
66607
- ]), m(() => () => se?.destroy(), [se]);
66608
- let ce = PU({
66609
- editor: se,
66639
+ ]), m(() => () => ce?.destroy(), [ce]);
66640
+ let le = PU({
66641
+ editor: ce,
66610
66642
  isDisabled: w,
66611
66643
  isMentionMenuOpen: d(() => M.current, [M])
66612
66644
  });
66613
- function le() {
66614
- eU(se), z.current = {
66645
+ function ue() {
66646
+ eU(ce), z.current = {
66615
66647
  key: e,
66616
66648
  doc: null
66617
66649
  }, e && re(e, null), ne();
66618
66650
  }
66619
- function ue(e) {
66620
- C?.(e) && (le(), zU(se, (e) => e.commands.focus()));
66621
- }
66622
66651
  function de(e) {
66623
- return C?.(e) ? (zU(se, (e) => e.commands.focus()), !0) : !1;
66652
+ C?.(e) && (ue(), zU(ce, (e) => e.commands.focus()));
66653
+ }
66654
+ function fe(e) {
66655
+ return C?.(e) ? (zU(ce, (e) => e.commands.focus()), !0) : !1;
66624
66656
  }
66625
66657
  m(() => {
66626
- !se || !ae.current || (ae.current = !1, zU(se, (e) => e.commands.focus()));
66627
- }, [se]), g(T, () => ({
66658
+ !ce || !ae.current || (ae.current = !1, zU(ce, (e) => e.commands.focus()));
66659
+ }, [ce]), g(T, () => ({
66660
+ openStickerPack: (e) => oe.current?.openPack(e),
66628
66661
  focus: () => {
66629
- se ? zU(se, (e) => e.commands.focus()) : ae.current = !0;
66662
+ ce ? zU(ce, (e) => e.commands.focus()) : ae.current = !0;
66630
66663
  },
66631
66664
  insertMentionAtStart: (e, t) => {
66632
- zU(se, (n) => {
66665
+ zU(ce, (n) => {
66633
66666
  if (BU(n, e)) {
66634
66667
  n.commands.focus("end");
66635
66668
  return;
@@ -66648,7 +66681,7 @@ var VU = c(function({ draftKey: e, conversationName: t, members: n, canMentionAl
66648
66681
  });
66649
66682
  },
66650
66683
  removeMentionAtStart: (e) => {
66651
- zU(se, (t) => {
66684
+ zU(ce, (t) => {
66652
66685
  if (!BU(t, e)) return;
66653
66686
  let n = t.state.doc.firstChild, r = n?.firstChild;
66654
66687
  if (!n || !r) return;
@@ -66659,32 +66692,32 @@ var VU = c(function({ draftKey: e, conversationName: t, members: n, canMentionAl
66659
66692
  }).run();
66660
66693
  });
66661
66694
  }
66662
- }), [se]);
66663
- function fe(e) {
66695
+ }), [ce]);
66696
+ function pe(e) {
66664
66697
  e.preventDefault();
66665
- let t = Kc(se?.getJSON());
66666
- !t && !c || (u?.(""), l(t ?? []) !== !1 && le());
66698
+ let t = Kc(ce?.getJSON());
66699
+ !t && !c || (u?.(""), l(t ?? []) !== !1 && ue());
66667
66700
  }
66668
- let pe = se?.storage.characterCount.characters() ?? 0, me = /* @__PURE__ */ A("button", {
66701
+ let me = ce?.storage.characterCount.characters() ?? 0, he = /* @__PURE__ */ A("button", {
66669
66702
  className: "message-send-button",
66670
66703
  type: "submit",
66671
66704
  "aria-label": "Gửi tin nhắn",
66672
66705
  disabled: s,
66673
66706
  children: /* @__PURE__ */ A(kr, {})
66674
- }), he = pe > 0;
66675
- !he && L && R(!1);
66676
- let ge = !!o && he && !L;
66707
+ }), ge = me > 0;
66708
+ !ge && L && R(!1);
66709
+ let _e = !!o && ge && !L;
66677
66710
  return /* @__PURE__ */ j("form", {
66678
66711
  className: "message-composer",
66679
- onSubmit: fe,
66712
+ onSubmit: pe,
66680
66713
  children: [
66681
- ce.suggestions.length > 0 ? /* @__PURE__ */ A(EU, {
66682
- suggestions: ce.suggestions,
66683
- onSelectSticker: ue,
66684
- onDismiss: ce.dismiss
66714
+ le.suggestions.length > 0 ? /* @__PURE__ */ A(EU, {
66715
+ suggestions: le.suggestions,
66716
+ onSelectSticker: de,
66717
+ onDismiss: le.dismiss
66685
66718
  }) : null,
66686
66719
  /* @__PURE__ */ A(xU, {
66687
- editor: se,
66720
+ editor: ce,
66688
66721
  onAttach: f,
66689
66722
  onAttachImages: p,
66690
66723
  isFormatOpen: N,
@@ -66692,16 +66725,18 @@ var VU = c(function({ draftKey: e, conversationName: t, members: n, canMentionAl
66692
66725
  P((e) => {
66693
66726
  let t = !e;
66694
66727
  return I(t), t;
66695
- }), se?.commands.focus();
66728
+ }), ce?.commands.focus();
66696
66729
  },
66697
66730
  isEnlarged: F,
66698
66731
  onToggleEnlarged: () => I((e) => !e),
66699
- sendButton: me,
66700
- isCollapsed: ge,
66732
+ sendButton: he,
66733
+ isCollapsed: _e,
66701
66734
  onExpand: () => R(!0),
66702
66735
  showEmojiButton: !o,
66703
- onSelectSticker: C ? de : void 0,
66704
- showStickerButton: !o
66736
+ onSelectSticker: C ? fe : void 0,
66737
+ showStickerButton: !o,
66738
+ stickerPickerRef: oe,
66739
+ stickerPickerKey: e
66705
66740
  }),
66706
66741
  _,
66707
66742
  /* @__PURE__ */ j("div", {
@@ -66709,31 +66744,32 @@ var VU = c(function({ draftKey: e, conversationName: t, members: n, canMentionAl
66709
66744
  children: [
66710
66745
  /* @__PURE__ */ A("div", {
66711
66746
  className: `message-editor${N && F ? " is-expanded" : ""}`,
66712
- children: /* @__PURE__ */ A(IA, { editor: se })
66747
+ children: /* @__PURE__ */ A(IA, { editor: ce })
66713
66748
  }),
66714
66749
  o ? /* @__PURE__ */ A(LH, {
66715
- editor: se,
66750
+ editor: ce,
66716
66751
  isCompact: !0
66717
66752
  }) : null,
66718
66753
  o && C ? /* @__PURE__ */ A(bU, {
66719
- onSelectSticker: de,
66754
+ ref: oe,
66755
+ onSelectSticker: fe,
66720
66756
  isCompact: !0
66721
- }) : null,
66722
- !o && pe > 0 ? /* @__PURE__ */ j("div", {
66723
- className: `composer-char-count${pe > 3e3 ? " is-over" : ""}`,
66757
+ }, e) : null,
66758
+ !o && me > 0 ? /* @__PURE__ */ j("div", {
66759
+ className: `composer-char-count${me > 3e3 ? " is-over" : ""}`,
66724
66760
  children: [
66725
66761
  /* @__PURE__ */ A("span", {
66726
66762
  className: "composer-char-count-typed",
66727
- children: pe
66763
+ children: me
66728
66764
  }),
66729
66765
  "/",
66730
66766
  nl
66731
66767
  ]
66732
66768
  }) : null,
66733
- !N && !o ? me : null
66769
+ !N && !o ? he : null
66734
66770
  ]
66735
66771
  }),
66736
- !N && o ? me : null
66772
+ !N && o ? he : null
66737
66773
  ]
66738
66774
  });
66739
66775
  });
@@ -66851,6 +66887,7 @@ var UU = c(function({ conversationId: e, currentUserId: t, conversationTitle: n,
66851
66887
  };
66852
66888
  g(M, () => ({
66853
66889
  focusComposer: () => N.current?.focus(),
66890
+ openStickerPack: (e) => N.current?.openStickerPack(e),
66854
66891
  sendFiles: (e) => re(e)
66855
66892
  }), [
66856
66893
  e,
@@ -67287,6 +67324,7 @@ var KU = c(function({ conversationId: e, conversation: t, isLoadingConversation:
67287
67324
  onOpenMentionCard: f,
67288
67325
  onOpenUserProfile: f,
67289
67326
  onOpenImageLightbox: (e, t, n) => oe.openFromBubble(e, t, n),
67327
+ onOpenStickerPack: e && !Ze ? (e) => de.current?.openStickerPack(e) : void 0,
67290
67328
  onRetry: lt,
67291
67329
  onDeleteFailed: ut,
67292
67330
  stickToLatestRef: be,