@satek-team-intern/chatbot-widget 0.10.1 → 0.10.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.
|
@@ -67,7 +67,7 @@ var D = "\n #chat-internal-root{z-index:99999;pointer-events:none;font-family
|
|
|
67
67
|
}, ne = (e) => {
|
|
68
68
|
let t = Math.floor(e / 1e3);
|
|
69
69
|
return `${Math.floor(t / 60)}:${(t % 60).toString().padStart(2, "0")}`;
|
|
70
|
-
}, P = null,
|
|
70
|
+
}, P = null, re = async (e) => {
|
|
71
71
|
P || (P = await C(), P.configure({
|
|
72
72
|
sampleRate: 44100,
|
|
73
73
|
channels: 1,
|
|
@@ -83,7 +83,7 @@ var D = "\n #chat-internal-root{z-index:99999;pointer-events:none;font-family
|
|
|
83
83
|
let a = n.reduce((e, t) => e + t.length, 0), o = new Uint8Array(a), s = 0;
|
|
84
84
|
for (let e of n) o.set(e, s), s += e.length;
|
|
85
85
|
return new Blob([o], { type: "audio/mp3" });
|
|
86
|
-
},
|
|
86
|
+
}, ie = 25 * 1024 * 1024, ae = [
|
|
87
87
|
"🙂",
|
|
88
88
|
"😀",
|
|
89
89
|
"😂",
|
|
@@ -102,7 +102,7 @@ var D = "\n #chat-internal-root{z-index:99999;pointer-events:none;font-family
|
|
|
102
102
|
"💯",
|
|
103
103
|
"✅",
|
|
104
104
|
"❌"
|
|
105
|
-
],
|
|
105
|
+
], oe = {
|
|
106
106
|
pdf: "📄",
|
|
107
107
|
doc: "📄",
|
|
108
108
|
docx: "📄",
|
|
@@ -125,13 +125,13 @@ var D = "\n #chat-internal-root{z-index:99999;pointer-events:none;font-family
|
|
|
125
125
|
mov: "🎬",
|
|
126
126
|
mkv: "🎬",
|
|
127
127
|
default: "📎"
|
|
128
|
-
},
|
|
129
|
-
if (!
|
|
128
|
+
}, F = (e) => e && oe[e.includes(".") ? e.split(".").pop()?.toLowerCase() ?? "" : e.toLowerCase()] || "📎", se = /* @__PURE__ */ new WeakMap(), I = (e) => {
|
|
129
|
+
if (!se.has(e)) {
|
|
130
130
|
let t = Math.random().toString(36).substring(2, 9);
|
|
131
|
-
|
|
131
|
+
se.set(e, `${e.name}-${e.size}-${t}`);
|
|
132
132
|
}
|
|
133
|
-
return
|
|
134
|
-
},
|
|
133
|
+
return se.get(e);
|
|
134
|
+
}, L = (e) => {
|
|
135
135
|
if (e === 0) return "0 B";
|
|
136
136
|
let t = 1024, n = [
|
|
137
137
|
"B",
|
|
@@ -140,7 +140,7 @@ var D = "\n #chat-internal-root{z-index:99999;pointer-events:none;font-family
|
|
|
140
140
|
"GB"
|
|
141
141
|
], r = Math.floor(Math.log(e) / Math.log(t));
|
|
142
142
|
return Math.round(e / t ** +r * 100) / 100 + " " + n[r];
|
|
143
|
-
},
|
|
143
|
+
}, ce = (e) => {
|
|
144
144
|
let t = e.split(".").pop()?.toLowerCase() ?? "";
|
|
145
145
|
return [
|
|
146
146
|
"jpg",
|
|
@@ -163,13 +163,13 @@ var D = "\n #chat-internal-root{z-index:99999;pointer-events:none;font-family
|
|
|
163
163
|
"ogg",
|
|
164
164
|
"wma"
|
|
165
165
|
].includes(t) ? "audio" : "other";
|
|
166
|
-
},
|
|
166
|
+
}, le = (e) => URL.createObjectURL(e), ue = (e) => e.type.startsWith("image/"), de = (e) => {
|
|
167
167
|
let t = (e) => {
|
|
168
168
|
let t = e.name.toLowerCase().split(".").pop() ?? "";
|
|
169
169
|
return e.type.startsWith("image/") ? 0 : t === "mp4" ? 1 : t === "mp3" ? 2 : 3;
|
|
170
170
|
};
|
|
171
171
|
return [...e].sort((e, n) => t(e) - t(n));
|
|
172
|
-
},
|
|
172
|
+
}, fe = (e) => new Promise((t) => {
|
|
173
173
|
if (!e.type.startsWith("image/")) {
|
|
174
174
|
t(e);
|
|
175
175
|
return;
|
|
@@ -197,19 +197,19 @@ var D = "\n #chat-internal-root{z-index:99999;pointer-events:none;font-family
|
|
|
197
197
|
}, a, s);
|
|
198
198
|
}, r.onerror = () => t(e), r.src = n.target?.result;
|
|
199
199
|
}, n.onerror = () => t(e), n.readAsDataURL(e);
|
|
200
|
-
}),
|
|
200
|
+
}), pe = (e, t, n) => e.length === 0 ? null : !t && e.length > 1 ? {
|
|
201
201
|
message: "Chỉ cho phép đính kèm tối đa 1 file.",
|
|
202
202
|
type: "warning"
|
|
203
203
|
} : e.length > 20 ? {
|
|
204
204
|
message: "Chỉ cho phép tối đa 20 file.",
|
|
205
205
|
type: "warning"
|
|
206
206
|
} : e.some((e) => e.isError) ? {
|
|
207
|
-
message: `Vui lòng loại bỏ các file bị lỗi (vượt quá ${
|
|
207
|
+
message: `Vui lòng loại bỏ các file bị lỗi (vượt quá ${ie / (1024 * 1024)} MB).`,
|
|
208
208
|
type: "warning"
|
|
209
209
|
} : e.every(n) ? null : {
|
|
210
210
|
message: "Vui lòng chỉ chọn các loại file được phép.",
|
|
211
211
|
type: "warning"
|
|
212
|
-
},
|
|
212
|
+
}, R = S({
|
|
213
213
|
name: "widget-chatslice",
|
|
214
214
|
initialState: {
|
|
215
215
|
currentUser: null,
|
|
@@ -223,6 +223,9 @@ var D = "\n #chat-internal-root{z-index:99999;pointer-events:none;font-family
|
|
|
223
223
|
replyingMessage: null
|
|
224
224
|
},
|
|
225
225
|
reducers: {
|
|
226
|
+
clearAll: (e) => {
|
|
227
|
+
e.currentUser = null, e.chats = [], e.currentChat = null, e.currentChatMessages = [], e.currentChatMembers = [], e.members = [], e.totalMessagesUnread = 0, e.messagesPagination = null, e.replyingMessage = null;
|
|
228
|
+
},
|
|
226
229
|
setCurrentUser: (e, t) => {
|
|
227
230
|
e.currentUser = t.payload;
|
|
228
231
|
},
|
|
@@ -363,7 +366,7 @@ var D = "\n #chat-internal-root{z-index:99999;pointer-events:none;font-family
|
|
|
363
366
|
i && (i[r] = !i[r]), e.currentChat?.id === n && (e.currentChat[r] = !e.currentChat[r]);
|
|
364
367
|
}
|
|
365
368
|
}
|
|
366
|
-
}), { setCurrentUser:
|
|
369
|
+
}), { clearAll: me, setCurrentUser: z, setChats: he, setCurrentChat: B, setCurrentChatMessages: ge, setCurrentChatMembers: _e, setMembers: ve, setMember: ye, setMemberDisconnect: V, setMessagesPagination: be, prependMessages: H, addNewMessage: xe, removeChat: Se, addChat: Ce, updateChat: we, updateChatAvatar: Te, removeMessage: Ee, updateMessage: De, setReplyingMessage: Oe, setTotalMessagesUnread: ke, updateMemberReadStatus: Ae, toggleChatSetting: je } = R.actions, Me = R.reducer, U = class e {
|
|
367
370
|
static instance;
|
|
368
371
|
chatSDK = null;
|
|
369
372
|
constructor() {
|
|
@@ -517,7 +520,7 @@ var D = "\n #chat-internal-root{z-index:99999;pointer-events:none;font-family
|
|
|
517
520
|
setConfig(e) {
|
|
518
521
|
this.chatSDK && this.chatSDK.setConfig(e);
|
|
519
522
|
}
|
|
520
|
-
}.getInstance(),
|
|
523
|
+
}.getInstance(), W = {
|
|
521
524
|
common: {
|
|
522
525
|
buttons: {
|
|
523
526
|
save: "Save",
|
|
@@ -791,7 +794,7 @@ var D = "\n #chat-internal-root{z-index:99999;pointer-events:none;font-family
|
|
|
791
794
|
constructor() {
|
|
792
795
|
this.currentLocale = "vietnamese", this.translations = {
|
|
793
796
|
vietnamese: G,
|
|
794
|
-
english:
|
|
797
|
+
english: W
|
|
795
798
|
};
|
|
796
799
|
}
|
|
797
800
|
static getInstance() {
|
|
@@ -806,13 +809,13 @@ var D = "\n #chat-internal-root{z-index:99999;pointer-events:none;font-family
|
|
|
806
809
|
t(e, t) {
|
|
807
810
|
let n = e.split("."), r = (e) => n.reduce((e, t) => {
|
|
808
811
|
if (e && typeof e == "object") return e[t];
|
|
809
|
-
}, e), i = r(this.translations[this.currentLocale]) ?? r(
|
|
812
|
+
}, e), i = r(this.translations[this.currentLocale]) ?? r(W);
|
|
810
813
|
if (typeof i != "string") return e;
|
|
811
814
|
let a = i;
|
|
812
815
|
if (t) for (let [e, n] of Object.entries(t)) a = a.replace(RegExp(`{${e}}`, "g"), n);
|
|
813
816
|
return a;
|
|
814
817
|
}
|
|
815
|
-
}.getInstance(),
|
|
818
|
+
}.getInstance(), Ne = S({
|
|
816
819
|
name: "widget-settingslice",
|
|
817
820
|
initialState: {
|
|
818
821
|
theme: localStorage.getItem("chat-theme") || "light",
|
|
@@ -841,14 +844,14 @@ var D = "\n #chat-internal-root{z-index:99999;pointer-events:none;font-family
|
|
|
841
844
|
e.currentLanguage = t.payload, K.locale = t.payload, localStorage.setItem("chat-widget:language", e.currentLanguage);
|
|
842
845
|
}
|
|
843
846
|
}
|
|
844
|
-
}), { setConfig:
|
|
845
|
-
chat:
|
|
846
|
-
setting:
|
|
847
|
-
}),
|
|
848
|
-
reducer: (e, t) => (t.type === "chatSlice/logout" && (e = void 0),
|
|
847
|
+
}), { setConfig: q, toggleTheme: Pe, setFeatures: Fe, setPrimaryColor: J, setLanguage: Y } = Ne.actions, X = Ne.reducer, Ie = y({
|
|
848
|
+
chat: Me,
|
|
849
|
+
setting: X
|
|
850
|
+
}), Le = b({
|
|
851
|
+
reducer: (e, t) => (t.type === "chatSlice/logout" && (e = void 0), Ie(e, t)),
|
|
849
852
|
middleware: (e) => e({ serializableCheck: { ignoredPaths: ["chat.instance"] } }),
|
|
850
853
|
devTools: { name: "ChatbotWidget" }
|
|
851
|
-
}),
|
|
854
|
+
}), Re = (e) => e.setting.features, ze = (e, t) => {
|
|
852
855
|
let n = {
|
|
853
856
|
minutes: 1e3 * 60,
|
|
854
857
|
hours: 1e3 * 60 * 60,
|
|
@@ -856,35 +859,35 @@ var D = "\n #chat-internal-root{z-index:99999;pointer-events:none;font-family
|
|
|
856
859
|
};
|
|
857
860
|
return e * (n[t] || n.hours);
|
|
858
861
|
};
|
|
859
|
-
function
|
|
862
|
+
function Be(e) {
|
|
860
863
|
return (t) => {
|
|
861
|
-
let { allow_delete_message: n, delete_duration: r } =
|
|
864
|
+
let { allow_delete_message: n, delete_duration: r } = U.setting || {};
|
|
862
865
|
if (!n) return !1;
|
|
863
866
|
if (r <= 0) return !0;
|
|
864
867
|
let i = new Date(t).getTime();
|
|
865
868
|
return Date.now() - i <= e;
|
|
866
869
|
};
|
|
867
870
|
}
|
|
868
|
-
function
|
|
871
|
+
function Ve(e) {
|
|
869
872
|
return (t) => {
|
|
870
|
-
let { allow_revoke_message: n, revoke_duration: r } =
|
|
873
|
+
let { allow_revoke_message: n, revoke_duration: r } = U.setting || {};
|
|
871
874
|
if (!n) return !1;
|
|
872
875
|
if (r <= 0) return !0;
|
|
873
876
|
let i = new Date(t).getTime();
|
|
874
877
|
return Date.now() - i <= e;
|
|
875
878
|
};
|
|
876
879
|
}
|
|
877
|
-
var
|
|
878
|
-
let t = A(e), n =
|
|
880
|
+
var He = x([Re], (e) => {
|
|
881
|
+
let t = A(e), n = ze(U.setting?.delete_duration ?? 0, U.setting?.delete_duration_unit ?? "hours"), r = ze(U.setting?.revoke_duration ?? 0, U.setting?.revoke_duration_unit ?? "hours");
|
|
879
882
|
return {
|
|
880
883
|
...t,
|
|
881
884
|
acceptFilter: j(t.featureSet),
|
|
882
885
|
isFileTypeAllowed: te(t.featureSet),
|
|
883
|
-
allowDeleteChat:
|
|
884
|
-
allowDeleteMessage:
|
|
885
|
-
allowRevokeMessage:
|
|
886
|
+
allowDeleteChat: U.setting?.allow_delete_chat ?? !1,
|
|
887
|
+
allowDeleteMessage: Be(n),
|
|
888
|
+
allowRevokeMessage: Ve(r)
|
|
886
889
|
};
|
|
887
|
-
}),
|
|
890
|
+
}), Ue = (e, t, n) => {
|
|
888
891
|
let r = g(), i = f(!1), { currentUser: a, chats: o, currentChat: s } = _((e) => e.chat), l = f({
|
|
889
892
|
chats: null,
|
|
890
893
|
currentUser: null,
|
|
@@ -903,9 +906,9 @@ var Ve = x([Le], (e) => {
|
|
|
903
906
|
]), c(() => {
|
|
904
907
|
(async () => {
|
|
905
908
|
let { code: a, name: o, avatar: s, email: c, phone: l } = t || {};
|
|
906
|
-
if (!(!a || !o || !s || !c || i.current)) try {
|
|
907
|
-
i.current = !0, await
|
|
908
|
-
let t = await
|
|
909
|
+
if (!(!a || !o || !s || !c || !n || i.current)) try {
|
|
910
|
+
i.current = !0, await U.init(e, n);
|
|
911
|
+
let t = await U.setAuth({
|
|
909
912
|
code: a,
|
|
910
913
|
name: o,
|
|
911
914
|
avatar: s,
|
|
@@ -916,11 +919,11 @@ var Ve = x([Le], (e) => {
|
|
|
916
919
|
i.current = !1, console.error("Authentication failed: No user data returned");
|
|
917
920
|
return;
|
|
918
921
|
}
|
|
919
|
-
r(
|
|
920
|
-
let [{ data: u }, { data: d }] = await Promise.all([
|
|
921
|
-
r(
|
|
922
|
+
r(z(t)), console.warn("Authenticated as:", t);
|
|
923
|
+
let [{ data: u }, { data: d }] = await Promise.all([U.getMembers(), U.getChats()]);
|
|
924
|
+
r(he(d)), r(ve(u));
|
|
922
925
|
let f = d?.reduce((e, n) => e + (n.new[t.id] ?? 0), 0) ?? 0;
|
|
923
|
-
r(
|
|
926
|
+
r(ke(f)), console.warn("Total unread messages:", f);
|
|
924
927
|
} catch (e) {
|
|
925
928
|
i.current = !1, console.error("Failed to init chat or authenticate:", e);
|
|
926
929
|
}
|
|
@@ -936,32 +939,32 @@ var Ve = x([Le], (e) => {
|
|
|
936
939
|
"chats.message": (e) => {
|
|
937
940
|
console.warn("Message Event:", e);
|
|
938
941
|
let { chat: t, message: n, type: i, chat_id: a, message_id: o } = e;
|
|
939
|
-
i === "add" ? r(
|
|
942
|
+
i === "add" ? r(xe({
|
|
940
943
|
chat: t,
|
|
941
944
|
message: n
|
|
942
|
-
})) : i === "remove" || i === "revoke" ? r(
|
|
945
|
+
})) : i === "remove" || i === "revoke" ? r(Ee({
|
|
943
946
|
chat_id: a,
|
|
944
947
|
message_id: o,
|
|
945
948
|
type: i
|
|
946
|
-
})) : (i === "love" || i === "like") && r(
|
|
949
|
+
})) : (i === "love" || i === "like") && r(De({
|
|
947
950
|
chat_id: a,
|
|
948
951
|
message: n
|
|
949
952
|
}));
|
|
950
953
|
},
|
|
951
954
|
"chats.created": (e) => {
|
|
952
|
-
console.warn("Chat Event:", e), r(
|
|
955
|
+
console.warn("Chat Event:", e), r(Ce(e.chat));
|
|
953
956
|
},
|
|
954
957
|
"chats.updated": (e) => {
|
|
955
|
-
console.warn("Chat Event:", e), r(
|
|
958
|
+
console.warn("Chat Event:", e), r(we(e.chat));
|
|
956
959
|
},
|
|
957
960
|
"chats.deleted": (e) => {
|
|
958
|
-
l.current.chats && (console.warn("Chat Event:", e), l.current.chats.find((t) => t.id === e.chat_id)?.type === "group" && r(
|
|
961
|
+
l.current.chats && (console.warn("Chat Event:", e), l.current.chats.find((t) => t.id === e.chat_id)?.type === "group" && r(Se(e.chat_id)));
|
|
959
962
|
},
|
|
960
963
|
"chats.action": (e) => {
|
|
961
964
|
if (console.warn("Chat Event:", e), e.type === "read") {
|
|
962
|
-
e.chat && r(
|
|
965
|
+
e.chat && r(we(e.chat));
|
|
963
966
|
let t = e.chat?.id ?? e.chat_id, n = e.member_id ?? e.user_id, i = e.message_id ?? e.chat?.message?.id;
|
|
964
|
-
t && n && i && r(
|
|
967
|
+
t && n && i && r(Ae({
|
|
965
968
|
chatId: Number(t),
|
|
966
969
|
memberId: Number(n),
|
|
967
970
|
lastReadId: Number(i)
|
|
@@ -974,7 +977,7 @@ var Ve = x([Le], (e) => {
|
|
|
974
977
|
"members.connect"(e) {
|
|
975
978
|
console.warn("Member Connected:", e);
|
|
976
979
|
let { member: t, timestamp: n, socketId: i } = e;
|
|
977
|
-
r(
|
|
980
|
+
r(ye({
|
|
978
981
|
member: t,
|
|
979
982
|
timestamp: n,
|
|
980
983
|
socketId: i
|
|
@@ -984,19 +987,19 @@ var Ve = x([Le], (e) => {
|
|
|
984
987
|
console.warn("Member Disconnected:", e);
|
|
985
988
|
let { socketId: t } = e;
|
|
986
989
|
setTimeout(() => {
|
|
987
|
-
r(
|
|
990
|
+
r(V(t));
|
|
988
991
|
}, 3e3);
|
|
989
992
|
}
|
|
990
993
|
};
|
|
991
994
|
return Object.entries(e).forEach(([e, t]) => {
|
|
992
|
-
|
|
995
|
+
U.addEventListener(e, t);
|
|
993
996
|
}), console.warn("Chat event listeners registered"), () => {
|
|
994
997
|
Object.entries(e).forEach(([e, t]) => {
|
|
995
|
-
|
|
996
|
-
}), console.warn("Chat event listeners removed"),
|
|
998
|
+
U.removeEventListener(e, t);
|
|
999
|
+
}), console.warn("Chat event listeners removed"), r(me()), U.clearAuth(), console.warn("Clear auth");
|
|
997
1000
|
};
|
|
998
1001
|
}, [a?.id, r]);
|
|
999
|
-
},
|
|
1002
|
+
}, We = t(void 0), Ge = ({ children: e }) => {
|
|
1000
1003
|
let [t, n] = p(!1), [r, i] = p([]), [o, s] = p(0), c = {
|
|
1001
1004
|
isOpen: t,
|
|
1002
1005
|
files: r,
|
|
@@ -1008,11 +1011,11 @@ var Ve = x([Le], (e) => {
|
|
|
1008
1011
|
n(!1);
|
|
1009
1012
|
}, [])
|
|
1010
1013
|
};
|
|
1011
|
-
return /* @__PURE__ */ T(
|
|
1014
|
+
return /* @__PURE__ */ T(We.Provider, {
|
|
1012
1015
|
value: c,
|
|
1013
1016
|
children: e
|
|
1014
1017
|
});
|
|
1015
|
-
},
|
|
1018
|
+
}, Ke = ({ children: e }) => {
|
|
1016
1019
|
let [t, n] = p([]), r = a((e) => {
|
|
1017
1020
|
n((t) => t.filter((t) => t.id !== e));
|
|
1018
1021
|
}, []), i = a((e, t = "info") => {
|
|
@@ -1037,7 +1040,7 @@ var Ve = x([Le], (e) => {
|
|
|
1037
1040
|
}
|
|
1038
1041
|
}]);
|
|
1039
1042
|
}), [r]);
|
|
1040
|
-
return /* @__PURE__ */ T(
|
|
1043
|
+
return /* @__PURE__ */ T(qe.Provider, {
|
|
1041
1044
|
value: {
|
|
1042
1045
|
showToast: i,
|
|
1043
1046
|
removeToast: r,
|
|
@@ -1046,11 +1049,11 @@ var Ve = x([Le], (e) => {
|
|
|
1046
1049
|
},
|
|
1047
1050
|
children: e
|
|
1048
1051
|
});
|
|
1049
|
-
},
|
|
1050
|
-
let e = o(
|
|
1052
|
+
}, qe = t(void 0), Je = () => {
|
|
1053
|
+
let e = o(We);
|
|
1051
1054
|
if (!e) throw Error("useFileViewer must be used within FileViewerProvider");
|
|
1052
1055
|
return e;
|
|
1053
|
-
},
|
|
1056
|
+
}, Ye = ({ onFilesAdded: e }) => {
|
|
1054
1057
|
let [t, n] = p(!1), r = f(0);
|
|
1055
1058
|
return {
|
|
1056
1059
|
isDragOver: t,
|
|
@@ -1069,7 +1072,7 @@ var Ve = x([Le], (e) => {
|
|
|
1069
1072
|
i && i.length > 0 && e(i);
|
|
1070
1073
|
}, [e])
|
|
1071
1074
|
};
|
|
1072
|
-
},
|
|
1075
|
+
}, Xe = () => {
|
|
1073
1076
|
let [e, t] = p({
|
|
1074
1077
|
isRecording: !1,
|
|
1075
1078
|
duration: 0,
|
|
@@ -1120,7 +1123,7 @@ var Ve = x([Le], (e) => {
|
|
|
1120
1123
|
o.current &&= (clearInterval(o.current), null), r.current?.getTracks().forEach((e) => e.stop());
|
|
1121
1124
|
let a = new Blob(i.current, { type: "audio/webm;codecs=opus" }), s;
|
|
1122
1125
|
try {
|
|
1123
|
-
s = await
|
|
1126
|
+
s = await re(a);
|
|
1124
1127
|
} catch (e) {
|
|
1125
1128
|
console.error("MP3 convert failed, fallback to webm", e), s = a;
|
|
1126
1129
|
}
|
|
@@ -1164,39 +1167,39 @@ var Ve = x([Le], (e) => {
|
|
|
1164
1167
|
return {
|
|
1165
1168
|
t: K.t.bind(K),
|
|
1166
1169
|
toggleChangeLanguage: () => {
|
|
1167
|
-
K.locale === "english" ? (K.locale = "vietnamese", e(
|
|
1170
|
+
K.locale === "english" ? (K.locale = "vietnamese", e(Y("vietnamese"))) : (K.locale = "english", e(Y("english")));
|
|
1168
1171
|
}
|
|
1169
1172
|
};
|
|
1170
|
-
},
|
|
1171
|
-
let e = o(
|
|
1173
|
+
}, Ze = () => {
|
|
1174
|
+
let e = o(qe);
|
|
1172
1175
|
if (!e) throw Error("useToast must be used within ToastProvider");
|
|
1173
1176
|
return e;
|
|
1174
|
-
},
|
|
1177
|
+
}, Qe = (e) => {
|
|
1175
1178
|
let t = g(), n = f(!1);
|
|
1176
1179
|
c(() => {
|
|
1177
1180
|
(() => {
|
|
1178
1181
|
if (!(!e || n.current)) try {
|
|
1179
|
-
n.current = !0, e && t(
|
|
1182
|
+
n.current = !0, e && t(q(e));
|
|
1180
1183
|
} catch (e) {
|
|
1181
1184
|
n.current = !1, console.error("Failed to init chat or authenticate:", e);
|
|
1182
1185
|
}
|
|
1183
1186
|
})();
|
|
1184
1187
|
}, [e, t]);
|
|
1185
|
-
},
|
|
1186
|
-
|
|
1188
|
+
}, $e = ({ chatKey: e, auth: t, features: n, logoUrl: r, workspace: i, ...a }) => {
|
|
1189
|
+
Qe(n), Ue(e, t, i);
|
|
1187
1190
|
let [o, s] = p("closed"), [c, l] = p(null), [u, d] = p(null), [f, m] = p({
|
|
1188
1191
|
width: 1e3,
|
|
1189
1192
|
height: 750
|
|
1190
1193
|
});
|
|
1191
1194
|
return /* @__PURE__ */ E("div", {
|
|
1192
1195
|
className: `chatbot-container ${o}`,
|
|
1193
|
-
children: [o === "closed" && /* @__PURE__ */ T(
|
|
1196
|
+
children: [o === "closed" && /* @__PURE__ */ T(nt, {
|
|
1194
1197
|
mode: o,
|
|
1195
1198
|
setMode: s,
|
|
1196
1199
|
dragPosition: c,
|
|
1197
1200
|
setDragPosition: l,
|
|
1198
1201
|
primaryColor: a.primaryColor
|
|
1199
|
-
}), o !== "closed" && /* @__PURE__ */ T(
|
|
1202
|
+
}), o !== "closed" && /* @__PURE__ */ T(Ut, {
|
|
1200
1203
|
logoUrl: r,
|
|
1201
1204
|
mode: o,
|
|
1202
1205
|
setMode: s,
|
|
@@ -1211,15 +1214,15 @@ var Ve = x([Le], (e) => {
|
|
|
1211
1214
|
...a
|
|
1212
1215
|
})]
|
|
1213
1216
|
});
|
|
1214
|
-
},
|
|
1215
|
-
let { isOpen: e, files: t, initialIndex: n, closeViewer: r } =
|
|
1216
|
-
return e ? /* @__PURE__ */ T(
|
|
1217
|
+
}, et = () => {
|
|
1218
|
+
let { isOpen: e, files: t, initialIndex: n, closeViewer: r } = Je();
|
|
1219
|
+
return e ? /* @__PURE__ */ T(en, {
|
|
1217
1220
|
isOpen: e,
|
|
1218
1221
|
files: t,
|
|
1219
1222
|
initialIndex: n,
|
|
1220
1223
|
onClose: r
|
|
1221
1224
|
}) : null;
|
|
1222
|
-
},
|
|
1225
|
+
}, tt = (e) => {
|
|
1223
1226
|
let t = f(null), [n, r] = p(null);
|
|
1224
1227
|
return u(() => {
|
|
1225
1228
|
let e = t.current;
|
|
@@ -1236,13 +1239,13 @@ var Ve = x([Le], (e) => {
|
|
|
1236
1239
|
}
|
|
1237
1240
|
r(i);
|
|
1238
1241
|
}, []), /* @__PURE__ */ T(h, {
|
|
1239
|
-
store:
|
|
1240
|
-
children: /* @__PURE__ */ T(
|
|
1242
|
+
store: Le,
|
|
1243
|
+
children: /* @__PURE__ */ T(Ge, { children: /* @__PURE__ */ T(Ke, { children: /* @__PURE__ */ E("div", {
|
|
1241
1244
|
ref: t,
|
|
1242
|
-
children: [n && v(/* @__PURE__ */ T(
|
|
1245
|
+
children: [n && v(/* @__PURE__ */ T($e, { ...e }), n), n && v(/* @__PURE__ */ T(et, {}), n)]
|
|
1243
1246
|
}) }) })
|
|
1244
1247
|
});
|
|
1245
|
-
},
|
|
1248
|
+
}, nt = ({ mode: e, setMode: t, dragPosition: n, setDragPosition: r }) => {
|
|
1246
1249
|
let [i, a] = p(!1), [o, s] = p({
|
|
1247
1250
|
x: 0,
|
|
1248
1251
|
y: 0
|
|
@@ -1329,7 +1332,7 @@ var Ve = x([Le], (e) => {
|
|
|
1329
1332
|
children: t
|
|
1330
1333
|
}));
|
|
1331
1334
|
return u.displayName = e, u;
|
|
1332
|
-
},
|
|
1335
|
+
}, rt = Q("Online", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("g", {
|
|
1333
1336
|
filter: "url(#filter0_d_4_4932)",
|
|
1334
1337
|
children: /* @__PURE__ */ T("path", {
|
|
1335
1338
|
d: "M2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8Z",
|
|
@@ -1381,7 +1384,7 @@ var Ve = x([Le], (e) => {
|
|
|
1381
1384
|
result: "shape"
|
|
1382
1385
|
})
|
|
1383
1386
|
]
|
|
1384
|
-
}) })] })),
|
|
1387
|
+
}) })] })), it = Q("Owner", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ E("g", {
|
|
1385
1388
|
clipPath: "url(#clip0_4_9682)",
|
|
1386
1389
|
children: [/* @__PURE__ */ T("path", {
|
|
1387
1390
|
d: "M6.74458 1.90514C6.76976 1.85941 6.80675 1.82128 6.85169 1.79472C6.89664 1.76816 6.94788 1.75415 7.00008 1.75415C7.05229 1.75415 7.10353 1.76816 7.14848 1.79472C7.19342 1.82128 7.23041 1.85941 7.25558 1.90514L8.97758 5.17414C9.01865 5.24984 9.07596 5.3155 9.14541 5.36642C9.21486 5.41734 9.29473 5.45225 9.37927 5.46864C9.46381 5.48504 9.55093 5.48251 9.63438 5.46125C9.71783 5.43998 9.79554 5.4005 9.86192 5.34564L12.3568 3.20831C12.4047 3.16936 12.4637 3.1466 12.5254 3.14333C12.587 3.14005 12.6481 3.15642 12.6999 3.19008C12.7516 3.22374 12.7914 3.27295 12.8134 3.33063C12.8354 3.38831 12.8385 3.45148 12.8223 3.51106L11.1692 9.48789C11.1354 9.6102 11.0627 9.71817 10.9621 9.79543C10.8615 9.8727 10.7384 9.91505 10.6115 9.91606H3.38925C3.26228 9.91517 3.13907 9.87288 3.03831 9.79561C2.93756 9.71833 2.86477 9.61029 2.831 9.48789L1.17842 3.51164C1.16223 3.45207 1.16536 3.38889 1.18737 3.33121C1.20937 3.27353 1.24911 3.22432 1.30086 3.19066C1.35261 3.157 1.41371 3.14063 1.47536 3.14391C1.53701 3.14719 1.59602 3.16994 1.64392 3.20889L4.13825 5.34623C4.20463 5.40108 4.28234 5.44056 4.36579 5.46183C4.44924 5.4831 4.53636 5.48562 4.6209 5.46923C4.70544 5.45283 4.7853 5.41792 4.85475 5.367C4.92421 5.31608 4.98152 5.25042 5.02258 5.17473L6.74458 1.90514Z",
|
|
@@ -1406,7 +1409,7 @@ var Ve = x([Le], (e) => {
|
|
|
1406
1409
|
}) })] }), {
|
|
1407
1410
|
viewBox: "0 0 14 14",
|
|
1408
1411
|
sizeDefault: 14
|
|
1409
|
-
}),
|
|
1412
|
+
}), at = Q("SaOneLogo", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("rect", {
|
|
1410
1413
|
width: "22.4671",
|
|
1411
1414
|
height: "22.4671",
|
|
1412
1415
|
fill: "url(#pattern0_22_372)"
|
|
@@ -1428,7 +1431,7 @@ var Ve = x([Le], (e) => {
|
|
|
1428
1431
|
})] })] }), {
|
|
1429
1432
|
viewBox: "0 0 23 23",
|
|
1430
1433
|
sizeDefault: 23
|
|
1431
|
-
}),
|
|
1434
|
+
}), ot = Q("MemberList", /* @__PURE__ */ E(w, { children: [
|
|
1432
1435
|
/* @__PURE__ */ T("path", {
|
|
1433
1436
|
d: "M10.6667 14V12.6667C10.6667 11.9594 10.3857 11.2811 9.88562 10.781C9.38552 10.281 8.70724 10 8 10H4C3.29276 10 2.61448 10.281 2.11438 10.781C1.61428 11.2811 1.33333 11.9594 1.33333 12.6667V14",
|
|
1434
1437
|
stroke: "currentColor",
|
|
@@ -1450,7 +1453,7 @@ var Ve = x([Le], (e) => {
|
|
|
1450
1453
|
strokeLinecap: "round",
|
|
1451
1454
|
strokeLinejoin: "round"
|
|
1452
1455
|
})
|
|
1453
|
-
] }), { sizeDefault: 16 }),
|
|
1456
|
+
] }), { sizeDefault: 16 }), st = Q("GroupList", /* @__PURE__ */ E(w, { children: [
|
|
1454
1457
|
/* @__PURE__ */ T("path", { d: "M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" }),
|
|
1455
1458
|
/* @__PURE__ */ T("circle", {
|
|
1456
1459
|
cx: "9",
|
|
@@ -1464,12 +1467,12 @@ var Ve = x([Le], (e) => {
|
|
|
1464
1467
|
viewBox: "0 0 24 24",
|
|
1465
1468
|
strokeColorDefault: "currentColor",
|
|
1466
1469
|
strokeWidthDefault: 2
|
|
1467
|
-
}),
|
|
1470
|
+
}), ct = Q("Back", /* @__PURE__ */ T(w, { children: /* @__PURE__ */ T("path", { d: "M15 18l-6-6 6-6" }) }), {
|
|
1468
1471
|
sizeDefault: 20,
|
|
1469
1472
|
viewBox: "0 0 24 24",
|
|
1470
1473
|
strokeColorDefault: "currentColor",
|
|
1471
1474
|
strokeWidthDefault: 2
|
|
1472
|
-
}),
|
|
1475
|
+
}), lt = Q("Mute", /* @__PURE__ */ E(w, { children: [
|
|
1473
1476
|
/* @__PURE__ */ T("path", { d: "M10.268 21a2 2 0 0 0 3.464 0" }),
|
|
1474
1477
|
/* @__PURE__ */ T("path", { d: "M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742" }),
|
|
1475
1478
|
/* @__PURE__ */ T("path", { d: "m2 2 20 20" }),
|
|
@@ -1498,7 +1501,7 @@ Q("Call", /* @__PURE__ */ T(w, { children: /* @__PURE__ */ T("path", { d: "M22 1
|
|
|
1498
1501
|
strokeColorDefault: "currentColor",
|
|
1499
1502
|
strokeWidthDefault: 2
|
|
1500
1503
|
});
|
|
1501
|
-
var
|
|
1504
|
+
var ut = Q("OpenSidebar", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("rect", {
|
|
1502
1505
|
x: "3",
|
|
1503
1506
|
y: "3",
|
|
1504
1507
|
width: "18",
|
|
@@ -1530,22 +1533,22 @@ var lt = Q("OpenSidebar", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("r
|
|
|
1530
1533
|
viewBox: "0 0 24 24",
|
|
1531
1534
|
strokeColorDefault: "currentColor",
|
|
1532
1535
|
strokeWidthDefault: 1.7
|
|
1533
|
-
}),
|
|
1536
|
+
}), dt = Q("Previous", /* @__PURE__ */ T(w, { children: /* @__PURE__ */ T("polyline", { points: "15 18 9 12 15 6" }) }), {
|
|
1534
1537
|
sizeDefault: 24,
|
|
1535
1538
|
viewBox: "0 0 24 24",
|
|
1536
1539
|
strokeColorDefault: "currentColor",
|
|
1537
1540
|
strokeWidthDefault: 2
|
|
1538
|
-
}),
|
|
1541
|
+
}), ft = Q("Next", /* @__PURE__ */ T(w, { children: /* @__PURE__ */ T("polyline", { points: "9 18 15 12 9 6" }) }), {
|
|
1539
1542
|
sizeDefault: 24,
|
|
1540
1543
|
viewBox: "0 0 24 24",
|
|
1541
1544
|
strokeColorDefault: "currentColor",
|
|
1542
1545
|
strokeWidthDefault: 2
|
|
1543
|
-
}),
|
|
1546
|
+
}), pt = Q("Conversation", /* @__PURE__ */ T(w, { children: /* @__PURE__ */ T("path", { d: "M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z" }) }), {
|
|
1544
1547
|
sizeDefault: 20,
|
|
1545
1548
|
viewBox: "0 0 24 24",
|
|
1546
1549
|
strokeColorDefault: "currentColor",
|
|
1547
1550
|
strokeWidthDefault: 2
|
|
1548
|
-
}),
|
|
1551
|
+
}), mt = Q("ConversationList", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ E("g", {
|
|
1549
1552
|
clipPath: "url(#clip0_22_6147)",
|
|
1550
1553
|
fill: "none",
|
|
1551
1554
|
children: [/* @__PURE__ */ T("path", {
|
|
@@ -1571,7 +1574,7 @@ var lt = Q("OpenSidebar", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("r
|
|
|
1571
1574
|
sizeDefault: 20,
|
|
1572
1575
|
viewBox: "0 0 20 20",
|
|
1573
1576
|
strokeColorDefault: "currentColor"
|
|
1574
|
-
}),
|
|
1577
|
+
}), ht = Q("Add", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("path", {
|
|
1575
1578
|
d: "M4.16675 10H15.8334",
|
|
1576
1579
|
stroke: "currentColor",
|
|
1577
1580
|
strokeWidth: "1.67",
|
|
@@ -1587,7 +1590,7 @@ var lt = Q("OpenSidebar", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("r
|
|
|
1587
1590
|
sizeDefault: 20,
|
|
1588
1591
|
viewBox: "0 0 20 20",
|
|
1589
1592
|
strokeColorDefault: "currentColor"
|
|
1590
|
-
}),
|
|
1593
|
+
}), gt = Q("Search", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("path", {
|
|
1591
1594
|
d: "M9.16667 15.8333C12.8486 15.8333 15.8333 12.8486 15.8333 9.16667C15.8333 5.48477 12.8486 2.5 9.16667 2.5C5.48477 2.5 2.5 5.48477 2.5 9.16667C2.5 12.8486 5.48477 15.8333 9.16667 15.8333Z",
|
|
1592
1595
|
stroke: "currentColor",
|
|
1593
1596
|
strokeWidth: "1.67",
|
|
@@ -1603,7 +1606,7 @@ var lt = Q("OpenSidebar", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("r
|
|
|
1603
1606
|
sizeDefault: 20,
|
|
1604
1607
|
viewBox: "0 0 20 20",
|
|
1605
1608
|
strokeColorDefault: "currentColor"
|
|
1606
|
-
}),
|
|
1609
|
+
}), _t = Q("Setting", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("path", {
|
|
1607
1610
|
d: "M10.1833 1.66699H9.81667C9.37464 1.66699 8.95072 1.84259 8.63816 2.15515C8.3256 2.46771 8.15 2.89163 8.15 3.33366V3.48366C8.1497 3.77593 8.07255 4.06298 7.92628 4.31602C7.78002 4.56906 7.56978 4.77919 7.31667 4.92533L6.95834 5.13366C6.70497 5.27994 6.41756 5.35695 6.125 5.35695C5.83244 5.35695 5.54503 5.27994 5.29167 5.13366L5.16667 5.06699C4.78422 4.84638 4.32987 4.78653 3.90334 4.90058C3.47681 5.01464 3.11296 5.29327 2.89167 5.67533L2.70833 5.99199C2.48772 6.37444 2.42787 6.82879 2.54192 7.25532C2.65598 7.68185 2.93461 8.0457 3.31667 8.26699L3.44167 8.35033C3.69356 8.49575 3.90302 8.70457 4.04921 8.95602C4.1954 9.20747 4.27325 9.4928 4.275 9.78366V10.2087C4.27617 10.5023 4.19971 10.7911 4.05337 11.0457C3.90703 11.3004 3.69601 11.5118 3.44167 11.6587L3.31667 11.7337C2.93461 11.955 2.65598 12.3188 2.54192 12.7453C2.42787 13.1719 2.48772 13.6262 2.70833 14.0087L2.89167 14.3253C3.11296 14.7074 3.47681 14.986 3.90334 15.1001C4.32987 15.2141 4.78422 15.1543 5.16667 14.9337L5.29167 14.867C5.54503 14.7207 5.83244 14.6437 6.125 14.6437C6.41756 14.6437 6.70497 14.7207 6.95834 14.867L7.31667 15.0753C7.56978 15.2215 7.78002 15.4316 7.92628 15.6846C8.07255 15.9377 8.1497 16.2247 8.15 16.517V16.667C8.15 17.109 8.3256 17.5329 8.63816 17.8455C8.95072 18.1581 9.37464 18.3337 9.81667 18.3337H10.1833C10.6254 18.3337 11.0493 18.1581 11.3618 17.8455C11.6744 17.5329 11.85 17.109 11.85 16.667V16.517C11.8503 16.2247 11.9275 15.9377 12.0737 15.6846C12.22 15.4316 12.4302 15.2215 12.6833 15.0753L13.0417 14.867C13.295 14.7207 13.5824 14.6437 13.875 14.6437C14.1676 14.6437 14.455 14.7207 14.7083 14.867L14.8333 14.9337C15.2158 15.1543 15.6701 15.2141 16.0967 15.1001C16.5232 14.986 16.887 14.7074 17.1083 14.3253L17.2917 14.0003C17.5123 13.6179 17.5721 13.1635 17.4581 12.737C17.344 12.3105 17.0654 11.9466 16.6833 11.7253L16.5583 11.6587C16.304 11.5118 16.093 11.3004 15.9466 11.0457C15.8003 10.7911 15.7238 10.5023 15.725 10.2087V9.79199C15.7238 9.49831 15.8003 9.20953 15.9466 8.9549C16.093 8.70027 16.304 8.48883 16.5583 8.34199L16.6833 8.26699C17.0654 8.0457 17.344 7.68185 17.4581 7.25532C17.5721 6.82879 17.5123 6.37444 17.2917 5.99199L17.1083 5.67533C16.887 5.29327 16.5232 5.01464 16.0967 4.90058C15.6701 4.78653 15.2158 4.84638 14.8333 5.06699L14.7083 5.13366C14.455 5.27994 14.1676 5.35695 13.875 5.35695C13.5824 5.35695 13.295 5.27994 13.0417 5.13366L12.6833 4.92533C12.4302 4.77919 12.22 4.56906 12.0737 4.31602C11.9275 4.06298 11.8503 3.77593 11.85 3.48366V3.33366C11.85 2.89163 11.6744 2.46771 11.3618 2.15515C11.0493 1.84259 10.6254 1.66699 10.1833 1.66699Z",
|
|
1608
1611
|
stroke: "currentColor",
|
|
1609
1612
|
strokeWidth: "1.66667",
|
|
@@ -1626,7 +1629,7 @@ Q("Pin", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("path", { d: "M12 1
|
|
|
1626
1629
|
strokeColorDefault: "currentColor",
|
|
1627
1630
|
strokeWidthDefault: 2
|
|
1628
1631
|
});
|
|
1629
|
-
var
|
|
1632
|
+
var vt = Q("Help", /* @__PURE__ */ E(w, { children: [
|
|
1630
1633
|
/* @__PURE__ */ T("circle", {
|
|
1631
1634
|
cx: "12",
|
|
1632
1635
|
cy: "12",
|
|
@@ -1644,7 +1647,7 @@ var _t = Q("Help", /* @__PURE__ */ E(w, { children: [
|
|
|
1644
1647
|
viewBox: "0 0 24 24",
|
|
1645
1648
|
strokeColorDefault: "currentColor",
|
|
1646
1649
|
strokeWidthDefault: 2
|
|
1647
|
-
}),
|
|
1650
|
+
}), yt = Q("RemoveMember", /* @__PURE__ */ E(w, { children: [
|
|
1648
1651
|
/* @__PURE__ */ T("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
|
|
1649
1652
|
/* @__PURE__ */ T("circle", {
|
|
1650
1653
|
cx: "9",
|
|
@@ -1668,7 +1671,7 @@ var _t = Q("Help", /* @__PURE__ */ E(w, { children: [
|
|
|
1668
1671
|
viewBox: "0 0 24 24",
|
|
1669
1672
|
strokeColorDefault: "currentColor",
|
|
1670
1673
|
strokeWidthDefault: 2
|
|
1671
|
-
}),
|
|
1674
|
+
}), bt = Q("Key", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("path", { d: "M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z" }), /* @__PURE__ */ T("circle", {
|
|
1672
1675
|
cx: "16.5",
|
|
1673
1676
|
cy: "7.5",
|
|
1674
1677
|
r: ".5",
|
|
@@ -1678,7 +1681,7 @@ var _t = Q("Help", /* @__PURE__ */ E(w, { children: [
|
|
|
1678
1681
|
viewBox: "0 0 24 24",
|
|
1679
1682
|
strokeColorDefault: "currentColor",
|
|
1680
1683
|
strokeWidthDefault: 2
|
|
1681
|
-
}),
|
|
1684
|
+
}), xt = Q("Edit", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("path", { d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }), /* @__PURE__ */ T("path", { d: "m15 5 4 4" })] }), {
|
|
1682
1685
|
sizeDefault: 14,
|
|
1683
1686
|
viewBox: "0 0 24 24",
|
|
1684
1687
|
strokeColorDefault: "currentColor",
|
|
@@ -1690,7 +1693,7 @@ Q("Bell", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("path", { d: "M10.
|
|
|
1690
1693
|
strokeColorDefault: "currentColor",
|
|
1691
1694
|
strokeWidthDefault: 2
|
|
1692
1695
|
});
|
|
1693
|
-
var
|
|
1696
|
+
var St = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
1694
1697
|
/* @__PURE__ */ T("path", { d: "M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" }),
|
|
1695
1698
|
/* @__PURE__ */ T("circle", {
|
|
1696
1699
|
cx: "9",
|
|
@@ -1714,12 +1717,12 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
1714
1717
|
viewBox: "0 0 24 24",
|
|
1715
1718
|
strokeColorDefault: "currentColor",
|
|
1716
1719
|
strokeWidthDefault: 2
|
|
1717
|
-
}),
|
|
1720
|
+
}), Ct = Q("ArrowDown", /* @__PURE__ */ T(w, { children: /* @__PURE__ */ T("path", { d: "M6 9l6 6 6-6" }) }), {
|
|
1718
1721
|
sizeDefault: 16,
|
|
1719
1722
|
viewBox: "0 0 24 24",
|
|
1720
1723
|
strokeColorDefault: "currentColor",
|
|
1721
1724
|
strokeWidthDefault: 2
|
|
1722
|
-
}),
|
|
1725
|
+
}), wt = Q("More", /* @__PURE__ */ E(w, { children: [
|
|
1723
1726
|
/* @__PURE__ */ T("circle", {
|
|
1724
1727
|
cx: "12",
|
|
1725
1728
|
cy: "12",
|
|
@@ -1741,12 +1744,12 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
1741
1744
|
strokeColorDefault: "currentColor",
|
|
1742
1745
|
strokeWidthDefault: 2,
|
|
1743
1746
|
strokeLinecapDefault: "round"
|
|
1744
|
-
}),
|
|
1747
|
+
}), Tt = Q("Minimize", /* @__PURE__ */ T(w, { children: /* @__PURE__ */ T("path", { d: "M5 12h14" }) }), {
|
|
1745
1748
|
sizeDefault: 14,
|
|
1746
1749
|
viewBox: "0 0 24 24",
|
|
1747
1750
|
strokeColorDefault: "currentColor",
|
|
1748
1751
|
strokeWidthDefault: 2
|
|
1749
|
-
}),
|
|
1752
|
+
}), Et = Q("OpenFullPage", /* @__PURE__ */ E(w, { children: [
|
|
1750
1753
|
/* @__PURE__ */ T("path", { d: "M15 3h6v6" }),
|
|
1751
1754
|
/* @__PURE__ */ T("path", { d: "m21 3-7 7" }),
|
|
1752
1755
|
/* @__PURE__ */ T("path", { d: "m3 21 7-7" }),
|
|
@@ -1756,7 +1759,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
1756
1759
|
viewBox: "0 0 24 24",
|
|
1757
1760
|
strokeColorDefault: "currentColor",
|
|
1758
1761
|
strokeWidthDefault: 2
|
|
1759
|
-
}),
|
|
1762
|
+
}), Dt = Q("MinimizeFullPage", /* @__PURE__ */ E(w, { children: [
|
|
1760
1763
|
/* @__PURE__ */ T("path", { d: "m14 10 7-7" }),
|
|
1761
1764
|
/* @__PURE__ */ T("path", { d: "M20 10h-6V4" }),
|
|
1762
1765
|
/* @__PURE__ */ T("path", { d: "m3 21 7-7" }),
|
|
@@ -1766,19 +1769,19 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
1766
1769
|
viewBox: "0 0 24 24",
|
|
1767
1770
|
strokeColorDefault: "currentColor",
|
|
1768
1771
|
strokeWidthDefault: 2
|
|
1769
|
-
}),
|
|
1772
|
+
}), Ot = Q("Reply", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("path", { d: "M20 18v-2a4 4 0 0 0-4-4H4" }), /* @__PURE__ */ T("path", { d: "m9 17-5-5 5-5" })] }), {
|
|
1770
1773
|
sizeDefault: 20,
|
|
1771
1774
|
viewBox: "0 0 24 24",
|
|
1772
1775
|
strokeColorDefault: "currentColor",
|
|
1773
1776
|
strokeWidthDefault: 2
|
|
1774
|
-
}),
|
|
1777
|
+
}), kt = Q("Attachment", /* @__PURE__ */ T(w, { children: /* @__PURE__ */ T("path", { d: "m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.51a2 2 0 0 1-2.83-2.83l8.49-8.48" }) }), {
|
|
1775
1778
|
sizeDefault: 20,
|
|
1776
1779
|
viewBox: "0 0 24 24",
|
|
1777
1780
|
strokeColorDefault: "currentColor",
|
|
1778
1781
|
strokeWidthDefault: 2,
|
|
1779
1782
|
strokeLinecapDefault: "round",
|
|
1780
1783
|
strokeLinejoinDefault: "round"
|
|
1781
|
-
}),
|
|
1784
|
+
}), At = Q("Image", /* @__PURE__ */ E(w, { children: [
|
|
1782
1785
|
/* @__PURE__ */ T("rect", {
|
|
1783
1786
|
width: "18",
|
|
1784
1787
|
height: "18",
|
|
@@ -1800,7 +1803,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
1800
1803
|
strokeWidthDefault: 2,
|
|
1801
1804
|
strokeLinecapDefault: "round",
|
|
1802
1805
|
strokeLinejoinDefault: "round"
|
|
1803
|
-
}),
|
|
1806
|
+
}), jt = Q("Voice", /* @__PURE__ */ E(w, { children: [
|
|
1804
1807
|
/* @__PURE__ */ T("path", { d: "M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z" }),
|
|
1805
1808
|
/* @__PURE__ */ T("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
|
|
1806
1809
|
/* @__PURE__ */ T("line", {
|
|
@@ -1816,7 +1819,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
1816
1819
|
strokeWidthDefault: 2,
|
|
1817
1820
|
strokeLinecapDefault: "round",
|
|
1818
1821
|
strokeLinejoinDefault: "round"
|
|
1819
|
-
}),
|
|
1822
|
+
}), Mt = Q("Emoji", /* @__PURE__ */ E(w, { children: [
|
|
1820
1823
|
/* @__PURE__ */ T("circle", {
|
|
1821
1824
|
cx: "12",
|
|
1822
1825
|
cy: "12",
|
|
@@ -1842,7 +1845,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
1842
1845
|
strokeWidthDefault: 2,
|
|
1843
1846
|
strokeLinecapDefault: "round",
|
|
1844
1847
|
strokeLinejoinDefault: "round"
|
|
1845
|
-
}),
|
|
1848
|
+
}), Nt = Q("SendMessage", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("line", {
|
|
1846
1849
|
x1: "22",
|
|
1847
1850
|
y1: "2",
|
|
1848
1851
|
x2: "11",
|
|
@@ -1854,27 +1857,27 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
1854
1857
|
strokeWidthDefault: 2,
|
|
1855
1858
|
strokeLinecapDefault: "round",
|
|
1856
1859
|
strokeLinejoinDefault: "round"
|
|
1857
|
-
}),
|
|
1860
|
+
}), Pt = Q("SortASC", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("path", { d: "M12 5v14" }), /* @__PURE__ */ T("path", { d: "M5 12l7-7 7 7" })] }), {
|
|
1858
1861
|
sizeDefault: 16,
|
|
1859
1862
|
viewBox: "0 0 24 24",
|
|
1860
1863
|
strokeColorDefault: "currentColor",
|
|
1861
1864
|
strokeWidthDefault: 2
|
|
1862
|
-
}),
|
|
1865
|
+
}), Ft = Q("SortDESC", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("path", { d: "M12 5v14" }), /* @__PURE__ */ T("path", { d: "M5 12l7 7 7-7" })] }), {
|
|
1863
1866
|
sizeDefault: 16,
|
|
1864
1867
|
viewBox: "0 0 24 24",
|
|
1865
1868
|
strokeColorDefault: "currentColor",
|
|
1866
1869
|
strokeWidthDefault: 2
|
|
1867
|
-
}),
|
|
1870
|
+
}), It = Q("Like", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("path", { d: "M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z" }), /* @__PURE__ */ T("path", { d: "M7 10v12" })] }), {
|
|
1868
1871
|
sizeDefault: 24,
|
|
1869
1872
|
viewBox: "0 0 24 24",
|
|
1870
1873
|
strokeColorDefault: "currentColor",
|
|
1871
1874
|
strokeWidthDefault: 2
|
|
1872
|
-
}),
|
|
1875
|
+
}), Lt = Q("Love", /* @__PURE__ */ T(w, { children: /* @__PURE__ */ T("path", { d: "M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5" }) }), {
|
|
1873
1876
|
sizeDefault: 24,
|
|
1874
1877
|
viewBox: "0 0 24 24",
|
|
1875
1878
|
strokeColorDefault: "currentColor",
|
|
1876
1879
|
strokeWidthDefault: 2
|
|
1877
|
-
}),
|
|
1880
|
+
}), Rt = Q("DeleteMessage", /* @__PURE__ */ E(w, { children: [
|
|
1878
1881
|
/* @__PURE__ */ T("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" }),
|
|
1879
1882
|
/* @__PURE__ */ T("path", { d: "M3 6h18" }),
|
|
1880
1883
|
/* @__PURE__ */ T("path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
|
|
@@ -1883,25 +1886,25 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
1883
1886
|
viewBox: "0 0 24 24",
|
|
1884
1887
|
strokeColorDefault: "currentColor",
|
|
1885
1888
|
strokeWidthDefault: 2
|
|
1886
|
-
}),
|
|
1889
|
+
}), zt = Q("RevokeMessage", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }), /* @__PURE__ */ T("path", { d: "M3 3v5h5" })] }), {
|
|
1887
1890
|
sizeDefault: 24,
|
|
1888
1891
|
viewBox: "0 0 24 24",
|
|
1889
1892
|
strokeColorDefault: "currentColor",
|
|
1890
1893
|
strokeWidthDefault: 2
|
|
1891
|
-
}),
|
|
1894
|
+
}), Bt = Q("Seen", /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("path", {
|
|
1892
1895
|
d: "M9 3L3.5 8.5L1 6",
|
|
1893
1896
|
stroke: "#2B7FFF",
|
|
1894
|
-
|
|
1895
|
-
|
|
1897
|
+
strokeLinecap: "round",
|
|
1898
|
+
strokeLinejoin: "round"
|
|
1896
1899
|
}), /* @__PURE__ */ T("path", {
|
|
1897
1900
|
d: "M11 5L7.25 8.75L6.5 8",
|
|
1898
1901
|
stroke: "#2B7FFF",
|
|
1899
|
-
|
|
1900
|
-
|
|
1902
|
+
strokeLinecap: "round",
|
|
1903
|
+
strokeLinejoin: "round"
|
|
1901
1904
|
})] }), {
|
|
1902
1905
|
sizeDefault: 12,
|
|
1903
1906
|
viewBox: "0 0 12 12"
|
|
1904
|
-
}),
|
|
1907
|
+
}), Vt = Q("language", /* @__PURE__ */ E(w, { children: [
|
|
1905
1908
|
/* @__PURE__ */ T("circle", {
|
|
1906
1909
|
cx: "12",
|
|
1907
1910
|
cy: "12",
|
|
@@ -1916,7 +1919,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
1916
1919
|
strokeWidthDefault: 2,
|
|
1917
1920
|
strokeLinecapDefault: "round",
|
|
1918
1921
|
strokeLinejoinDefault: "round"
|
|
1919
|
-
}),
|
|
1922
|
+
}), Ht = Q("ImagePlaceholder", /* @__PURE__ */ E(w, { children: [
|
|
1920
1923
|
/* @__PURE__ */ T("path", { d: "M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21" }),
|
|
1921
1924
|
/* @__PURE__ */ T("path", { d: "m14 19.5 3-3 3 3" }),
|
|
1922
1925
|
/* @__PURE__ */ T("path", { d: "M17 22v-5.5" }),
|
|
@@ -1929,23 +1932,23 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
1929
1932
|
sizeDefault: 20,
|
|
1930
1933
|
viewBox: "0 0 24 24",
|
|
1931
1934
|
strokeColorDefault: "currentColor"
|
|
1932
|
-
}),
|
|
1935
|
+
}), Ut = ({ title: e = "Live Chat", logoUrl: t, mode: n, setMode: r, primaryColor: i, dragPosition: o, setDragPosition: l, fullpagePosition: u, setFullpagePosition: m, fullpageSize: h = {
|
|
1933
1936
|
width: 1e3,
|
|
1934
1937
|
height: 750
|
|
1935
1938
|
}, setFullpageSize: v }) => {
|
|
1936
|
-
let { t: y } = Z(), [b, x] = p(!1), [S, C] = p(!1), [D, k] = p(null), [ee, A] = p(!1), [j, te] = p(null), [M, N] = p(!1), [ne, P] = p(!1), [
|
|
1939
|
+
let { t: y } = Z(), [b, x] = p(!1), [S, C] = p(!1), [D, k] = p(null), [ee, A] = p(!1), [j, te] = p(null), [M, N] = p(!1), [ne, P] = p(!1), [re, ie] = p("chats"), [ae, oe] = p("members"), { showToast: F, confirm: se } = Ze(), [I, L] = p("all"), [ce, le] = p(!1), [ue, de] = p(!1), [fe, pe] = p(null), [R, me] = p({
|
|
1937
1940
|
mouseX: 0,
|
|
1938
1941
|
mouseY: 0,
|
|
1939
1942
|
baseW: 0,
|
|
1940
1943
|
baseH: 0,
|
|
1941
1944
|
baseX: 0,
|
|
1942
1945
|
baseY: 0
|
|
1943
|
-
}), [
|
|
1946
|
+
}), [z, ge] = p({
|
|
1944
1947
|
x: 0,
|
|
1945
1948
|
y: 0
|
|
1946
|
-
}),
|
|
1947
|
-
e && e.length > 0 &&
|
|
1948
|
-
} }), { currentChat:
|
|
1949
|
+
}), ve = f(null), ye = f(null), [V, be] = p(""), H = s(V), [xe, Se] = p(!1), [Ce, we] = p(!1), [Te, Ee] = p(!1), { hasGroupChat: De } = _(He), { isDragOver: Oe, handleDragEnter: ke, handleDragOver: Ae, handleDragLeave: je, handleDrop: Me } = Ye({ onFilesAdded: (e) => {
|
|
1950
|
+
e && e.length > 0 && ye.current?.processPastedFiles(e);
|
|
1951
|
+
} }), { currentChat: W, currentUser: G, members: K, currentChatMembers: Ne, chats: q, totalMessagesUnread: Pe } = _((e) => e.chat);
|
|
1949
1952
|
c(() => {
|
|
1950
1953
|
if (n === "fullpage" && !u && m && v) {
|
|
1951
1954
|
let e = 1e3;
|
|
@@ -1963,12 +1966,12 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
1963
1966
|
m,
|
|
1964
1967
|
v
|
|
1965
1968
|
]);
|
|
1966
|
-
let { theme:
|
|
1967
|
-
let e =
|
|
1969
|
+
let { theme: Fe, primaryColor: J } = _((e) => e.setting), Y = g(), X = d(() => {
|
|
1970
|
+
let e = H.toLowerCase().trim();
|
|
1968
1971
|
if (!e) return {
|
|
1969
|
-
filteredChat:
|
|
1970
|
-
if (
|
|
1971
|
-
let t =
|
|
1972
|
+
filteredChat: q.filter((e) => {
|
|
1973
|
+
if (I === "unread") {
|
|
1974
|
+
let t = G?.id && e.new ? e.new[G.id] ?? 0 : 0;
|
|
1972
1975
|
return Number(t) > 0;
|
|
1973
1976
|
}
|
|
1974
1977
|
return !0;
|
|
@@ -1978,7 +1981,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
1978
1981
|
matchedFiles: [],
|
|
1979
1982
|
totalMatchedFiles: 0
|
|
1980
1983
|
};
|
|
1981
|
-
let t =
|
|
1984
|
+
let t = q.filter((t) => {
|
|
1982
1985
|
let n = t.name?.toLowerCase().includes(e), r = t.members?.some((t) => t.name.toLowerCase().includes(e));
|
|
1983
1986
|
return (n ?? !1) || (r ?? !1);
|
|
1984
1987
|
}).map((t) => {
|
|
@@ -1987,10 +1990,10 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
1987
1990
|
...t,
|
|
1988
1991
|
matchedMemberNames: n.map((e) => e.name)
|
|
1989
1992
|
};
|
|
1990
|
-
}), n =
|
|
1993
|
+
}), n = K.filter((t) => t.code === G?.code || ![t.name, t.code].some((t) => t.toLowerCase().includes(e)) ? !1 : !q.some((e) => e.type === "single" && e.members?.some((e) => e.code === t.code))), r = q.filter((t) => t.message?.content?.toLowerCase().includes(e)).map((e) => ({
|
|
1991
1994
|
chat: e,
|
|
1992
1995
|
message: e.message
|
|
1993
|
-
})), i =
|
|
1996
|
+
})), i = q.filter((t) => t.message?.files?.some((t) => t.name.toLowerCase().includes(e))).map((t) => ({
|
|
1994
1997
|
chat: t,
|
|
1995
1998
|
files: t.message?.files?.filter((t) => t.name.toLowerCase().includes(e)) ?? []
|
|
1996
1999
|
}));
|
|
@@ -2002,11 +2005,11 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2002
2005
|
totalMatchedFiles: i.reduce((e, t) => e + (t.files?.length ?? 0), 0)
|
|
2003
2006
|
};
|
|
2004
2007
|
}, [
|
|
2005
|
-
J,
|
|
2006
2008
|
q,
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2009
|
+
K,
|
|
2010
|
+
H,
|
|
2011
|
+
I,
|
|
2012
|
+
G
|
|
2010
2013
|
]), Ie = (e, t) => t.trim() ? /* @__PURE__ */ T(w, { children: e.split(RegExp(`(${t})`, "gi")).map((e, n) => e.toLowerCase() === t.toLowerCase() ? /* @__PURE__ */ T("span", {
|
|
2011
2014
|
className: "highlight-match",
|
|
2012
2015
|
children: e
|
|
@@ -2016,57 +2019,57 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2016
2019
|
if (t.length === 3 && (t = t.split("").map((e) => e + e).join("")), t.length !== 6) return "#ffffff";
|
|
2017
2020
|
let n = parseInt(t.slice(0, 2), 16), r = parseInt(t.slice(2, 4), 16), i = parseInt(t.slice(4, 6), 16);
|
|
2018
2021
|
return (n * 299 + r * 587 + i * 114) / 1e3 > 180 ? "#1e293b" : "#ffffff";
|
|
2019
|
-
}, Re = d(() => Le(
|
|
2020
|
-
|
|
2021
|
-
}, [
|
|
2022
|
-
if (t.stopPropagation(), await
|
|
2023
|
-
await
|
|
2022
|
+
}, Re = d(() => Le(J), [J]), ze = a((e) => {
|
|
2023
|
+
be(e), L("all"), Se(!1), we(!1), Ee(!1);
|
|
2024
|
+
}, [L]), Be = async (e, t) => {
|
|
2025
|
+
if (t.stopPropagation(), await se("Bạn có chắc chắn muốn xóa cuộc trò chuyện này?")) try {
|
|
2026
|
+
await U.removeChat(Number(e)), Y(he(q.filter((t) => t.id !== e))), W?.id === e && Y(B(null)), F("Đã xóa cuộc trò chuyện", "success");
|
|
2024
2027
|
} catch (e) {
|
|
2025
|
-
console.error("Lỗi khi xóa chat:", e),
|
|
2028
|
+
console.error("Lỗi khi xóa chat:", e), F("Không thể xóa cuộc trò chuyện. Vui lòng thử lại!", "error");
|
|
2026
2029
|
}
|
|
2027
|
-
},
|
|
2030
|
+
}, Ve = (e) => {
|
|
2028
2031
|
k(e), C(!0);
|
|
2029
2032
|
}, Ue = async (e, t, n) => {
|
|
2030
2033
|
try {
|
|
2031
|
-
let r = await
|
|
2032
|
-
r?.data && (Y(
|
|
2034
|
+
let r = await U.updateGroup(e, t, n);
|
|
2035
|
+
r?.data && (Y(he(q.map((t) => t.id === e ? {
|
|
2033
2036
|
...t,
|
|
2034
2037
|
...r.data
|
|
2035
|
-
} : t))),
|
|
2036
|
-
...
|
|
2038
|
+
} : t))), W?.id === e && Y(B({
|
|
2039
|
+
...W,
|
|
2037
2040
|
...r.data
|
|
2038
|
-
})), C(!1), k(null),
|
|
2041
|
+
})), C(!1), k(null), F("Cập nhật thông tin nhóm thành công!", "success"));
|
|
2039
2042
|
} catch (e) {
|
|
2040
|
-
console.error("Lỗi khi cập nhật thông tin nhóm:", e),
|
|
2043
|
+
console.error("Lỗi khi cập nhật thông tin nhóm:", e), F("Không thể cập nhật thông tin nhóm. Vui lòng thử lại!", "error");
|
|
2041
2044
|
}
|
|
2042
2045
|
}, We = (e) => {
|
|
2043
2046
|
te(e), A(!0);
|
|
2044
2047
|
}, Ge = async (e, t) => {
|
|
2045
2048
|
try {
|
|
2046
|
-
await
|
|
2047
|
-
let n = await
|
|
2048
|
-
n?.data && Y(
|
|
2049
|
+
await U.addMember(e, t), F("Đã thêm thành viên vào nhóm thành công!", "success");
|
|
2050
|
+
let n = await U.getMembers(e);
|
|
2051
|
+
n?.data && Y(_e(n.data));
|
|
2049
2052
|
} catch (e) {
|
|
2050
|
-
console.error("Lỗi khi thêm thành viên:", e),
|
|
2053
|
+
console.error("Lỗi khi thêm thành viên:", e), F("Không thể thêm thành viên. Vui lòng thử lại!", "error");
|
|
2051
2054
|
}
|
|
2052
2055
|
}, Ke = async (e, t) => {
|
|
2053
|
-
if (await
|
|
2054
|
-
await
|
|
2056
|
+
if (await se("Bạn có chắc chắn muốn xóa thành viên này ra khỏi nhóm?")) try {
|
|
2057
|
+
await U.removeMember(e, t), Y(_e(Ne.filter((e) => String(e.id) !== String(t)))), String(t) === String(G?.id) ? (F("Bạn đã rời khỏi nhóm này", "success"), C(!1), k(null), Y(B(null)), Y(he((await U.getChats()).data ?? []))) : F("Đã xóa thành viên khỏi nhóm", "success");
|
|
2055
2058
|
} catch (e) {
|
|
2056
|
-
console.error("Lỗi khi xóa thành viên:", e),
|
|
2059
|
+
console.error("Lỗi khi xóa thành viên:", e), F("Không thể xóa thành viên. Vui lòng thử lại!", "error");
|
|
2057
2060
|
}
|
|
2058
2061
|
}, qe = (e) => {
|
|
2059
2062
|
if (n !== "fullpage" || e.target.closest(".action-btn, .back-btn")) return;
|
|
2060
2063
|
let t = e.currentTarget.parentElement?.getBoundingClientRect();
|
|
2061
|
-
t && (
|
|
2064
|
+
t && (le(!0), ge({
|
|
2062
2065
|
x: e.clientX - t.left,
|
|
2063
2066
|
y: e.clientY - t.top
|
|
2064
2067
|
}), e.stopPropagation(), e.preventDefault());
|
|
2065
|
-
},
|
|
2068
|
+
}, Je = (e, t) => {
|
|
2066
2069
|
if (n !== "fullpage") return;
|
|
2067
2070
|
e.stopPropagation(), e.preventDefault();
|
|
2068
|
-
let r =
|
|
2069
|
-
r && (
|
|
2071
|
+
let r = ve.current?.getBoundingClientRect();
|
|
2072
|
+
r && (de(!0), pe(t), me({
|
|
2070
2073
|
mouseX: e.clientX,
|
|
2071
2074
|
mouseY: e.clientY,
|
|
2072
2075
|
baseW: r.width,
|
|
@@ -2077,20 +2080,20 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2077
2080
|
};
|
|
2078
2081
|
c(() => {
|
|
2079
2082
|
let e = (e) => {
|
|
2080
|
-
if (
|
|
2081
|
-
let t = e.clientX -
|
|
2082
|
-
switch (
|
|
2083
|
+
if (ue && fe) {
|
|
2084
|
+
let t = e.clientX - R.mouseX, n = e.clientY - R.mouseY, r = R.baseW, i = R.baseH, a = R.baseX, o = R.baseY, s = 1e3, c = document.documentElement.clientWidth, l = document.documentElement.clientHeight;
|
|
2085
|
+
switch (fe) {
|
|
2083
2086
|
case "ne":
|
|
2084
|
-
r = Math.min(c -
|
|
2087
|
+
r = Math.min(c - R.baseX, Math.max(s, R.baseW + t)), i = Math.min(R.baseY + R.baseH, Math.max(700, R.baseH - n)), o = R.baseY + (R.baseH - i);
|
|
2085
2088
|
break;
|
|
2086
2089
|
case "nw":
|
|
2087
|
-
r = Math.min(
|
|
2090
|
+
r = Math.min(R.baseX + R.baseW, Math.max(s, R.baseW - t)), i = Math.min(R.baseY + R.baseH, Math.max(700, R.baseH - n)), a = R.baseX + (R.baseW - r), o = R.baseY + (R.baseH - i);
|
|
2088
2091
|
break;
|
|
2089
2092
|
case "se":
|
|
2090
|
-
r = Math.min(c -
|
|
2093
|
+
r = Math.min(c - R.baseX, Math.max(s, R.baseW + t)), i = Math.min(l - R.baseY, Math.max(700, R.baseH + n));
|
|
2091
2094
|
break;
|
|
2092
2095
|
case "sw":
|
|
2093
|
-
r = Math.min(
|
|
2096
|
+
r = Math.min(R.baseX + R.baseW, Math.max(s, R.baseW - t)), i = Math.min(l - R.baseY, Math.max(700, R.baseH + n)), a = R.baseX + (R.baseW - r);
|
|
2094
2097
|
break;
|
|
2095
2098
|
}
|
|
2096
2099
|
v?.({
|
|
@@ -2102,12 +2105,12 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2102
2105
|
});
|
|
2103
2106
|
return;
|
|
2104
2107
|
}
|
|
2105
|
-
if (!
|
|
2106
|
-
let t =
|
|
2108
|
+
if (!ce || !z) return;
|
|
2109
|
+
let t = ve.current;
|
|
2107
2110
|
if (!t) return;
|
|
2108
|
-
let r = t.getBoundingClientRect(), i = r.width, a = r.height, o = document.documentElement.clientWidth, s = document.documentElement.clientHeight, c = e.clientX -
|
|
2111
|
+
let r = t.getBoundingClientRect(), i = r.width, a = r.height, o = document.documentElement.clientWidth, s = document.documentElement.clientHeight, c = e.clientX - z.x;
|
|
2109
2112
|
c < 0 && (c = 0), c + i > o && (c = o - i);
|
|
2110
|
-
let u = e.clientY -
|
|
2113
|
+
let u = e.clientY - z.y;
|
|
2111
2114
|
u < 0 && (u = 0), u + a > s && (u = s - a), n === "fullpage" ? m?.({
|
|
2112
2115
|
x: c,
|
|
2113
2116
|
y: u
|
|
@@ -2116,23 +2119,23 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2116
2119
|
y: u
|
|
2117
2120
|
});
|
|
2118
2121
|
}, t = () => {
|
|
2119
|
-
|
|
2122
|
+
le(!1), de(!1), pe(null);
|
|
2120
2123
|
};
|
|
2121
|
-
return (
|
|
2124
|
+
return (ce || ue) && (document.addEventListener("mousemove", e), document.addEventListener("mouseup", t)), () => {
|
|
2122
2125
|
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", t);
|
|
2123
2126
|
};
|
|
2124
2127
|
}, [
|
|
2125
|
-
oe,
|
|
2126
2128
|
ce,
|
|
2127
2129
|
ue,
|
|
2128
|
-
|
|
2130
|
+
fe,
|
|
2131
|
+
z,
|
|
2129
2132
|
n,
|
|
2130
2133
|
l,
|
|
2131
2134
|
m,
|
|
2132
2135
|
v,
|
|
2133
|
-
|
|
2136
|
+
R
|
|
2134
2137
|
]);
|
|
2135
|
-
let
|
|
2138
|
+
let Xe = (() => {
|
|
2136
2139
|
if (!o || typeof document > "u") return null;
|
|
2137
2140
|
let e = document.documentElement.clientWidth, t = document.documentElement.clientHeight, n = o.x, r = o.y;
|
|
2138
2141
|
return n + 400 > e && (n = e - 400 - 20), n < 20 && (n = 20), r + 640 > t && (r = t - 640 - 20), r < 20 && (r = 20), {
|
|
@@ -2165,18 +2168,18 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2165
2168
|
});
|
|
2166
2169
|
}, $e = a(async (e) => {
|
|
2167
2170
|
if (e) try {
|
|
2168
|
-
let t =
|
|
2171
|
+
let t = K.find((t) => String(t.id) === e);
|
|
2169
2172
|
if (t) {
|
|
2170
|
-
let n =
|
|
2171
|
-
if (n) Y(
|
|
2173
|
+
let n = q.find((t) => t.type === "single" && t.members?.some((t) => String(t.id) === e));
|
|
2174
|
+
if (n) Y(B(n));
|
|
2172
2175
|
else {
|
|
2173
|
-
await
|
|
2176
|
+
await U.setReceiver({
|
|
2174
2177
|
id: t.id,
|
|
2175
2178
|
code: t.code,
|
|
2176
2179
|
name: t.name
|
|
2177
2180
|
});
|
|
2178
|
-
let e = (await
|
|
2179
|
-
e && Y(
|
|
2181
|
+
let e = (await U.addChat(Number(t.id))).data;
|
|
2182
|
+
e && Y(B(e));
|
|
2180
2183
|
}
|
|
2181
2184
|
}
|
|
2182
2185
|
x(!1);
|
|
@@ -2184,13 +2187,13 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2184
2187
|
console.error("Lỗi khi tạo cuộc trò chuyện:", e), alert("Không thể tạo cuộc trò chuyện. Vui lòng thử lại sau.");
|
|
2185
2188
|
}
|
|
2186
2189
|
}, [
|
|
2187
|
-
J,
|
|
2188
2190
|
q,
|
|
2191
|
+
K,
|
|
2189
2192
|
Y
|
|
2190
2193
|
]);
|
|
2191
2194
|
return /* @__PURE__ */ E("div", {
|
|
2192
|
-
ref:
|
|
2193
|
-
className: `chat-window ${n === "fullpage" ? "fullpage" : ""} ${
|
|
2195
|
+
ref: ve,
|
|
2196
|
+
className: `chat-window ${n === "fullpage" ? "fullpage" : ""} ${Fe === "dark" ? "dark-theme" : ""}`,
|
|
2194
2197
|
style: n === "fullpage" ? {
|
|
2195
2198
|
position: "fixed",
|
|
2196
2199
|
left: u ? `${u.x}px` : `${(window.innerWidth - h.width) / 2}px`,
|
|
@@ -2198,34 +2201,34 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2198
2201
|
width: `${h.width}px`,
|
|
2199
2202
|
height: `${h.height}px`,
|
|
2200
2203
|
borderRadius: h.width >= window.innerWidth && u?.x === 0 && u?.y === 0 ? 0 : "14px",
|
|
2201
|
-
"--primary":
|
|
2204
|
+
"--primary": J,
|
|
2202
2205
|
"--primary-contrast": Re
|
|
2203
|
-
} : n === "popup" &&
|
|
2206
|
+
} : n === "popup" && Xe ? {
|
|
2204
2207
|
position: "fixed",
|
|
2205
|
-
left: `${
|
|
2206
|
-
top: `${
|
|
2207
|
-
"--primary":
|
|
2208
|
+
left: `${Xe.x}px`,
|
|
2209
|
+
top: `${Xe.y}px`,
|
|
2210
|
+
"--primary": J,
|
|
2208
2211
|
"--primary-contrast": Re
|
|
2209
2212
|
} : {
|
|
2210
|
-
"--primary":
|
|
2213
|
+
"--primary": J,
|
|
2211
2214
|
"--primary-contrast": Re
|
|
2212
2215
|
},
|
|
2213
2216
|
children: [
|
|
2214
2217
|
n === "fullpage" && /* @__PURE__ */ E(w, { children: [
|
|
2215
2218
|
/* @__PURE__ */ T("div", {
|
|
2216
|
-
onMouseDown: (e) =>
|
|
2219
|
+
onMouseDown: (e) => Je(e, "ne"),
|
|
2217
2220
|
className: "resize-handle ne"
|
|
2218
2221
|
}),
|
|
2219
2222
|
/* @__PURE__ */ T("div", {
|
|
2220
|
-
onMouseDown: (e) =>
|
|
2223
|
+
onMouseDown: (e) => Je(e, "nw"),
|
|
2221
2224
|
className: "resize-handle nw"
|
|
2222
2225
|
}),
|
|
2223
2226
|
/* @__PURE__ */ T("div", {
|
|
2224
|
-
onMouseDown: (e) =>
|
|
2227
|
+
onMouseDown: (e) => Je(e, "se"),
|
|
2225
2228
|
className: "resize-handle se"
|
|
2226
2229
|
}),
|
|
2227
2230
|
/* @__PURE__ */ T("div", {
|
|
2228
|
-
onMouseDown: (e) =>
|
|
2231
|
+
onMouseDown: (e) => Je(e, "sw"),
|
|
2229
2232
|
className: "resize-handle sw"
|
|
2230
2233
|
})
|
|
2231
2234
|
] }),
|
|
@@ -2233,11 +2236,11 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2233
2236
|
onMouseDown: qe,
|
|
2234
2237
|
onDoubleClick: Qe,
|
|
2235
2238
|
style: { cursor: n === "fullpage" ? "move" : "default" },
|
|
2236
|
-
children: /* @__PURE__ */ T(
|
|
2239
|
+
children: /* @__PURE__ */ T(un, {
|
|
2237
2240
|
mode: n,
|
|
2238
2241
|
title: e,
|
|
2239
2242
|
logoUrl: t,
|
|
2240
|
-
onBack: () => Y(
|
|
2243
|
+
onBack: () => Y(B(null)),
|
|
2241
2244
|
onToggleMode: () => {
|
|
2242
2245
|
if (n === "popup" && !u) {
|
|
2243
2246
|
let e = 1e3;
|
|
@@ -2252,74 +2255,74 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2252
2255
|
r(n === "popup" ? "fullpage" : "popup");
|
|
2253
2256
|
},
|
|
2254
2257
|
onClose: () => r("closed"),
|
|
2255
|
-
onAddMemberClick: () =>
|
|
2258
|
+
onAddMemberClick: () => W && We(W),
|
|
2256
2259
|
onOpenSettings: () => P(!0)
|
|
2257
2260
|
})
|
|
2258
2261
|
}),
|
|
2259
2262
|
/* @__PURE__ */ E("div", {
|
|
2260
2263
|
className: "chat-main-layout",
|
|
2261
|
-
children: [n === "fullpage" &&
|
|
2264
|
+
children: [n === "fullpage" && G && /* @__PURE__ */ T(cn, {
|
|
2262
2265
|
setIsThemeModalOpen: P,
|
|
2263
|
-
currentUser:
|
|
2264
|
-
activeTab:
|
|
2265
|
-
setActiveTab:
|
|
2266
|
+
currentUser: G,
|
|
2267
|
+
activeTab: re,
|
|
2268
|
+
setActiveTab: ie
|
|
2266
2269
|
}), /* @__PURE__ */ E("div", {
|
|
2267
2270
|
className: "chat-body-container",
|
|
2268
2271
|
children: [
|
|
2269
|
-
(n === "fullpage" || !
|
|
2272
|
+
(n === "fullpage" || !W) && /* @__PURE__ */ T("div", {
|
|
2270
2273
|
className: `chat-sidebar ${n === "fullpage" ? "is-full" : ""}`,
|
|
2271
|
-
children:
|
|
2272
|
-
/* @__PURE__ */ T(
|
|
2273
|
-
value:
|
|
2274
|
+
children: re === "chats" ? /* @__PURE__ */ E(w, { children: [
|
|
2275
|
+
/* @__PURE__ */ T(sn, {
|
|
2276
|
+
value: V,
|
|
2274
2277
|
onChange: ze,
|
|
2275
2278
|
onAddClick: () => x(!0),
|
|
2276
2279
|
placeholder: y("chatWindow.searchPlaceholder")
|
|
2277
2280
|
}),
|
|
2278
2281
|
/* @__PURE__ */ T("div", {
|
|
2279
2282
|
className: "chat-filter-tabs",
|
|
2280
|
-
children:
|
|
2283
|
+
children: V ? /* @__PURE__ */ E(w, { children: [
|
|
2281
2284
|
/* @__PURE__ */ T("button", {
|
|
2282
|
-
className:
|
|
2283
|
-
onClick: () =>
|
|
2285
|
+
className: I === "all" ? "active" : "",
|
|
2286
|
+
onClick: () => L("all"),
|
|
2284
2287
|
children: "Tất cả"
|
|
2285
2288
|
}),
|
|
2286
2289
|
/* @__PURE__ */ T("button", {
|
|
2287
|
-
className:
|
|
2288
|
-
onClick: () =>
|
|
2290
|
+
className: I === "member" ? "active" : "",
|
|
2291
|
+
onClick: () => L("member"),
|
|
2289
2292
|
children: "Thành viên"
|
|
2290
2293
|
}),
|
|
2291
2294
|
/* @__PURE__ */ T("button", {
|
|
2292
|
-
className:
|
|
2293
|
-
onClick: () =>
|
|
2295
|
+
className: I === "message" ? "active" : "",
|
|
2296
|
+
onClick: () => L("message"),
|
|
2294
2297
|
children: "Tin nhắn"
|
|
2295
2298
|
}),
|
|
2296
2299
|
/* @__PURE__ */ T("button", {
|
|
2297
|
-
className:
|
|
2298
|
-
onClick: () =>
|
|
2300
|
+
className: I === "file" ? "active" : "",
|
|
2301
|
+
onClick: () => L("file"),
|
|
2299
2302
|
children: "File"
|
|
2300
2303
|
})
|
|
2301
2304
|
] }) : /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("button", {
|
|
2302
|
-
className:
|
|
2303
|
-
onClick: () =>
|
|
2305
|
+
className: I === "all" ? "active" : "",
|
|
2306
|
+
onClick: () => L("all"),
|
|
2304
2307
|
children: y("chatWindow.filterAll") || "Tất cả"
|
|
2305
2308
|
}), /* @__PURE__ */ T("button", {
|
|
2306
|
-
className:
|
|
2307
|
-
onClick: () =>
|
|
2309
|
+
className: I === "unread" ? "active" : "",
|
|
2310
|
+
onClick: () => L("unread"),
|
|
2308
2311
|
children: /* @__PURE__ */ E("div", {
|
|
2309
2312
|
className: "filter-unread-badge-container",
|
|
2310
|
-
children: [/* @__PURE__ */ T("span", { children: "Chưa đọc" }),
|
|
2313
|
+
children: [/* @__PURE__ */ T("span", { children: "Chưa đọc" }), Pe > 0 && /* @__PURE__ */ T("span", {
|
|
2311
2314
|
className: "filter-unread-badge",
|
|
2312
|
-
children:
|
|
2315
|
+
children: Pe
|
|
2313
2316
|
})]
|
|
2314
2317
|
})
|
|
2315
2318
|
})] })
|
|
2316
2319
|
}),
|
|
2317
2320
|
/* @__PURE__ */ T("div", {
|
|
2318
2321
|
className: "sidebar-scroll",
|
|
2319
|
-
children:
|
|
2322
|
+
children: V ? /* @__PURE__ */ E("div", {
|
|
2320
2323
|
className: "chat-search-results",
|
|
2321
2324
|
children: [
|
|
2322
|
-
(
|
|
2325
|
+
(I === "all" || I === "member") && /* @__PURE__ */ E("div", {
|
|
2323
2326
|
className: "search-section",
|
|
2324
2327
|
children: [
|
|
2325
2328
|
/* @__PURE__ */ T("h3", {
|
|
@@ -2328,30 +2331,30 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2328
2331
|
}),
|
|
2329
2332
|
/* @__PURE__ */ E("div", {
|
|
2330
2333
|
className: "search-section-content",
|
|
2331
|
-
children: [X.filteredChat.slice(0,
|
|
2334
|
+
children: [X.filteredChat.slice(0, xe ? void 0 : 4).map((e) => /* @__PURE__ */ E("div", {
|
|
2332
2335
|
className: "search-result-item",
|
|
2333
|
-
onClick: () => Y(
|
|
2336
|
+
onClick: () => Y(B(e)),
|
|
2334
2337
|
children: [/* @__PURE__ */ T("div", {
|
|
2335
2338
|
className: "search-result-avatar",
|
|
2336
|
-
children: /* @__PURE__ */ T(
|
|
2339
|
+
children: /* @__PURE__ */ T(Wt, {
|
|
2337
2340
|
chat: e,
|
|
2338
|
-
currentUserId:
|
|
2341
|
+
currentUserId: G?.id
|
|
2339
2342
|
})
|
|
2340
2343
|
}), /* @__PURE__ */ E("div", {
|
|
2341
2344
|
className: "search-result-info",
|
|
2342
2345
|
children: [/* @__PURE__ */ T("div", {
|
|
2343
2346
|
className: "search-result-name",
|
|
2344
|
-
children: Ie(O(e,
|
|
2347
|
+
children: Ie(O(e, G?.id), H)
|
|
2345
2348
|
}), e.type === "group" && /* @__PURE__ */ E("div", {
|
|
2346
2349
|
className: "search-result-sub",
|
|
2347
2350
|
children: [
|
|
2348
2351
|
"Thành viên:",
|
|
2349
2352
|
" ",
|
|
2350
|
-
e.matchedMemberNames && e.matchedMemberNames.length > 0 ? Ie(e.matchedMemberNames.join(", "),
|
|
2353
|
+
e.matchedMemberNames && e.matchedMemberNames.length > 0 ? Ie(e.matchedMemberNames.join(", "), H) : Ie(H, H)
|
|
2351
2354
|
]
|
|
2352
2355
|
})]
|
|
2353
2356
|
})]
|
|
2354
|
-
}, `chat-${e.id}`)), X.matchedMembers.slice(0,
|
|
2357
|
+
}, `chat-${e.id}`)), X.matchedMembers.slice(0, xe ? void 0 : Math.max(0, 4 - X.filteredChat.length)).map((e) => /* @__PURE__ */ E("div", {
|
|
2355
2358
|
className: "search-result-item",
|
|
2356
2359
|
onClick: () => {
|
|
2357
2360
|
$e(String(e.id));
|
|
@@ -2369,19 +2372,19 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2369
2372
|
className: "search-result-info",
|
|
2370
2373
|
children: /* @__PURE__ */ T("div", {
|
|
2371
2374
|
className: "search-result-name",
|
|
2372
|
-
children: Ie(e.name,
|
|
2375
|
+
children: Ie(e.name, H)
|
|
2373
2376
|
})
|
|
2374
2377
|
})]
|
|
2375
2378
|
}, `member-${e.code}`))]
|
|
2376
2379
|
}),
|
|
2377
|
-
!
|
|
2380
|
+
!xe && X.filteredChat.length + X.matchedMembers.length > 4 && /* @__PURE__ */ T("button", {
|
|
2378
2381
|
className: "search-view-all",
|
|
2379
|
-
onClick: () =>
|
|
2382
|
+
onClick: () => Se(!0),
|
|
2380
2383
|
children: "Xem tất cả thành viên"
|
|
2381
2384
|
})
|
|
2382
2385
|
]
|
|
2383
2386
|
}),
|
|
2384
|
-
(
|
|
2387
|
+
(I === "all" || I === "message") && X.matchedMessages.length > 0 && /* @__PURE__ */ E("div", {
|
|
2385
2388
|
className: "search-section",
|
|
2386
2389
|
children: [
|
|
2387
2390
|
/* @__PURE__ */ E("h3", {
|
|
@@ -2397,14 +2400,14 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2397
2400
|
}),
|
|
2398
2401
|
/* @__PURE__ */ T("div", {
|
|
2399
2402
|
className: "search-section-content",
|
|
2400
|
-
children: X.matchedMessages.slice(0,
|
|
2403
|
+
children: X.matchedMessages.slice(0, Ce ? void 0 : 3).map((e, t) => /* @__PURE__ */ E("div", {
|
|
2401
2404
|
className: "search-result-item message-result",
|
|
2402
|
-
onClick: () => Y(
|
|
2405
|
+
onClick: () => Y(B(e.chat)),
|
|
2403
2406
|
children: [/* @__PURE__ */ T("div", {
|
|
2404
2407
|
className: "search-result-avatar",
|
|
2405
|
-
children: /* @__PURE__ */ T(
|
|
2408
|
+
children: /* @__PURE__ */ T(Wt, {
|
|
2406
2409
|
chat: e.chat,
|
|
2407
|
-
currentUserId:
|
|
2410
|
+
currentUserId: G?.id
|
|
2408
2411
|
})
|
|
2409
2412
|
}), /* @__PURE__ */ E("div", {
|
|
2410
2413
|
className: "search-result-info",
|
|
@@ -2412,26 +2415,26 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2412
2415
|
className: "search-result-top",
|
|
2413
2416
|
children: [/* @__PURE__ */ T("span", {
|
|
2414
2417
|
className: "search-result-name",
|
|
2415
|
-
children: O(e.chat,
|
|
2418
|
+
children: O(e.chat, G?.id)
|
|
2416
2419
|
}), /* @__PURE__ */ T("span", {
|
|
2417
2420
|
className: "search-result-date",
|
|
2418
2421
|
children: e.message?.date
|
|
2419
2422
|
})]
|
|
2420
2423
|
}), /* @__PURE__ */ T("div", {
|
|
2421
2424
|
className: "search-result-text",
|
|
2422
|
-
children: Ie(e.message?.content ?? "",
|
|
2425
|
+
children: Ie(e.message?.content ?? "", H)
|
|
2423
2426
|
})]
|
|
2424
2427
|
})]
|
|
2425
2428
|
}, `msg-${t}`))
|
|
2426
2429
|
}),
|
|
2427
|
-
!
|
|
2430
|
+
!Ce && X.matchedMessages.length > 3 && /* @__PURE__ */ T("button", {
|
|
2428
2431
|
className: "search-view-all",
|
|
2429
|
-
onClick: () =>
|
|
2432
|
+
onClick: () => we(!0),
|
|
2430
2433
|
children: "Xem tất cả tin nhắn"
|
|
2431
2434
|
})
|
|
2432
2435
|
]
|
|
2433
2436
|
}),
|
|
2434
|
-
(
|
|
2437
|
+
(I === "all" || I === "file") && X.matchedFiles.length > 0 && /* @__PURE__ */ E("div", {
|
|
2435
2438
|
className: "search-section",
|
|
2436
2439
|
children: [
|
|
2437
2440
|
/* @__PURE__ */ E("h3", {
|
|
@@ -2447,9 +2450,9 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2447
2450
|
}),
|
|
2448
2451
|
/* @__PURE__ */ T("div", {
|
|
2449
2452
|
className: "search-section-content",
|
|
2450
|
-
children: X.matchedFiles.slice(0,
|
|
2453
|
+
children: X.matchedFiles.slice(0, Te ? void 0 : 3).map((e, t) => e.files.map((n, r) => /* @__PURE__ */ E("div", {
|
|
2451
2454
|
className: "search-result-item file-result",
|
|
2452
|
-
onClick: () => Y(
|
|
2455
|
+
onClick: () => Y(B(e.chat)),
|
|
2453
2456
|
children: [/* @__PURE__ */ T("div", {
|
|
2454
2457
|
className: "file-icon-wrapper",
|
|
2455
2458
|
children: /* @__PURE__ */ T("i", { className: "fas fa-file-alt" })
|
|
@@ -2469,59 +2472,59 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2469
2472
|
})]
|
|
2470
2473
|
}, `file-${t}-${r}`)))
|
|
2471
2474
|
}),
|
|
2472
|
-
!
|
|
2475
|
+
!Te && X.totalMatchedFiles > 3 && /* @__PURE__ */ T("button", {
|
|
2473
2476
|
className: "search-view-all",
|
|
2474
|
-
onClick: () =>
|
|
2477
|
+
onClick: () => Ee(!0),
|
|
2475
2478
|
children: "Xem tất cả file"
|
|
2476
2479
|
})
|
|
2477
2480
|
]
|
|
2478
2481
|
})
|
|
2479
2482
|
]
|
|
2480
|
-
}) : /* @__PURE__ */ T(
|
|
2483
|
+
}) : /* @__PURE__ */ T(on, {
|
|
2481
2484
|
chats: X.filteredChat,
|
|
2482
|
-
selectedChat:
|
|
2485
|
+
selectedChat: W ?? null,
|
|
2483
2486
|
onSelectChat: (e) => {
|
|
2484
|
-
Y(
|
|
2487
|
+
Y(B(e)), G?.id && e.new?.[G.id] > 0 && U.readChat(e.id);
|
|
2485
2488
|
},
|
|
2486
2489
|
onRemoveChat: (e, t) => void Be(e, t),
|
|
2487
|
-
onUpdateGroup:
|
|
2490
|
+
onUpdateGroup: Ve,
|
|
2488
2491
|
onAddMemberClick: We
|
|
2489
2492
|
})
|
|
2490
2493
|
})
|
|
2491
2494
|
] }) : /* @__PURE__ */ E("div", {
|
|
2492
2495
|
className: "contact-categories",
|
|
2493
2496
|
children: [/* @__PURE__ */ E("div", {
|
|
2494
|
-
className: `category-item ${
|
|
2495
|
-
onClick: () =>
|
|
2497
|
+
className: `category-item ${ae === "members" ? "active" : ""}`,
|
|
2498
|
+
onClick: () => oe("members"),
|
|
2496
2499
|
children: [
|
|
2497
|
-
/* @__PURE__ */ T(
|
|
2500
|
+
/* @__PURE__ */ T(ot, {}),
|
|
2498
2501
|
/* @__PURE__ */ T("span", { children: "Danh sách thành viên" }),
|
|
2499
2502
|
/* @__PURE__ */ T("span", {
|
|
2500
2503
|
className: "count",
|
|
2501
|
-
children:
|
|
2504
|
+
children: K.length
|
|
2502
2505
|
})
|
|
2503
2506
|
]
|
|
2504
|
-
}),
|
|
2505
|
-
className: `category-item ${
|
|
2506
|
-
onClick: () =>
|
|
2507
|
+
}), De && /* @__PURE__ */ E("div", {
|
|
2508
|
+
className: `category-item ${ae === "groups" ? "active" : ""}`,
|
|
2509
|
+
onClick: () => oe("groups"),
|
|
2507
2510
|
children: [
|
|
2508
|
-
/* @__PURE__ */ T(
|
|
2511
|
+
/* @__PURE__ */ T(st, {}),
|
|
2509
2512
|
/* @__PURE__ */ T("span", { children: "Danh sách nhóm" }),
|
|
2510
2513
|
/* @__PURE__ */ T("span", {
|
|
2511
2514
|
className: "count",
|
|
2512
|
-
children:
|
|
2515
|
+
children: q.filter((e) => e.type === "group").length
|
|
2513
2516
|
})
|
|
2514
2517
|
]
|
|
2515
2518
|
})]
|
|
2516
2519
|
})
|
|
2517
2520
|
}),
|
|
2518
|
-
(n === "fullpage" ||
|
|
2521
|
+
(n === "fullpage" || W) && /* @__PURE__ */ E("div", {
|
|
2519
2522
|
className: "chat-main",
|
|
2520
|
-
onDragEnter:
|
|
2521
|
-
onDragOver:
|
|
2522
|
-
onDragLeave:
|
|
2523
|
-
onDrop:
|
|
2524
|
-
children: [
|
|
2523
|
+
onDragEnter: ke,
|
|
2524
|
+
onDragOver: Ae,
|
|
2525
|
+
onDragLeave: je,
|
|
2526
|
+
onDrop: Me,
|
|
2527
|
+
children: [Oe && /* @__PURE__ */ T("div", {
|
|
2525
2528
|
className: "drag-overlay-full",
|
|
2526
2529
|
children: /* @__PURE__ */ E("div", {
|
|
2527
2530
|
className: "drag-content",
|
|
@@ -2533,7 +2536,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2533
2536
|
children: y("chatWindow.dragFile")
|
|
2534
2537
|
})]
|
|
2535
2538
|
})
|
|
2536
|
-
}),
|
|
2539
|
+
}), re === "chats" ? W ? /* @__PURE__ */ E(w, { children: [
|
|
2537
2540
|
/* @__PURE__ */ E("div", {
|
|
2538
2541
|
className: "chat-main-header",
|
|
2539
2542
|
children: [/* @__PURE__ */ E("div", {
|
|
@@ -2541,14 +2544,14 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2541
2544
|
children: [
|
|
2542
2545
|
n === "popup" && /* @__PURE__ */ T("button", {
|
|
2543
2546
|
className: "back-btn",
|
|
2544
|
-
onClick: () => Y(
|
|
2545
|
-
children: /* @__PURE__ */ T(
|
|
2547
|
+
onClick: () => Y(B(null)),
|
|
2548
|
+
children: /* @__PURE__ */ T(ct, {})
|
|
2546
2549
|
}),
|
|
2547
2550
|
/* @__PURE__ */ T("div", {
|
|
2548
2551
|
className: "chat-main-avatar",
|
|
2549
|
-
children: /* @__PURE__ */ T(
|
|
2550
|
-
chat:
|
|
2551
|
-
currentUserId:
|
|
2552
|
+
children: /* @__PURE__ */ T(Wt, {
|
|
2553
|
+
chat: W,
|
|
2554
|
+
currentUserId: G?.id
|
|
2552
2555
|
})
|
|
2553
2556
|
}),
|
|
2554
2557
|
/* @__PURE__ */ E("div", {
|
|
@@ -2557,11 +2560,11 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2557
2560
|
className: "chat-main-text-container",
|
|
2558
2561
|
children: [/* @__PURE__ */ T("span", {
|
|
2559
2562
|
className: "chat-main-name",
|
|
2560
|
-
children: O(
|
|
2561
|
-
}),
|
|
2563
|
+
children: O(W, G?.id)
|
|
2564
|
+
}), W.is_muted && /* @__PURE__ */ T(lt, {})]
|
|
2562
2565
|
}), /* @__PURE__ */ T("span", {
|
|
2563
2566
|
className: "chat-main-status",
|
|
2564
|
-
children:
|
|
2567
|
+
children: W.type === "single" ? (Ne.find((e) => e.id !== G?.id)?.socket_ids?.length ?? 0) > 0 ? "Đang hoạt động" : "Không hoạt động" : `${Ne.length ?? 0} thành viên`
|
|
2565
2568
|
})]
|
|
2566
2569
|
})
|
|
2567
2570
|
]
|
|
@@ -2570,13 +2573,13 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2570
2573
|
children: /* @__PURE__ */ T("button", {
|
|
2571
2574
|
className: `main-action-btn ${M ? "active" : ""}`,
|
|
2572
2575
|
onClick: () => N(!M),
|
|
2573
|
-
children: /* @__PURE__ */ T(
|
|
2576
|
+
children: /* @__PURE__ */ T(ut, {})
|
|
2574
2577
|
})
|
|
2575
2578
|
})]
|
|
2576
2579
|
}),
|
|
2577
|
-
/* @__PURE__ */ T(
|
|
2578
|
-
/* @__PURE__ */ T("div", { children: /* @__PURE__ */ T(
|
|
2579
|
-
ref:
|
|
2580
|
+
/* @__PURE__ */ T(bn, {}),
|
|
2581
|
+
/* @__PURE__ */ T("div", { children: /* @__PURE__ */ T(dn, {
|
|
2582
|
+
ref: ye,
|
|
2580
2583
|
primaryColor: i
|
|
2581
2584
|
}) })
|
|
2582
2585
|
] }) : /* @__PURE__ */ E("div", {
|
|
@@ -2589,24 +2592,24 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2589
2592
|
/* @__PURE__ */ T("h3", { children: y("chatWindow.selectChat") }),
|
|
2590
2593
|
/* @__PURE__ */ T("p", { children: y("chatWindow.startConversation") })
|
|
2591
2594
|
]
|
|
2592
|
-
}) : /* @__PURE__ */ T(w, { children:
|
|
2593
|
-
members:
|
|
2595
|
+
}) : /* @__PURE__ */ T(w, { children: ae === "members" ? /* @__PURE__ */ T(mn, {
|
|
2596
|
+
members: K,
|
|
2594
2597
|
onMessageClick: (e) => {
|
|
2595
|
-
$e(e),
|
|
2598
|
+
$e(e), ie("chats");
|
|
2596
2599
|
}
|
|
2597
|
-
}) : /* @__PURE__ */ T(
|
|
2598
|
-
groups:
|
|
2599
|
-
currentUserId:
|
|
2600
|
+
}) : /* @__PURE__ */ T(hn, {
|
|
2601
|
+
groups: q.filter((e) => e.type === "group"),
|
|
2602
|
+
currentUserId: G?.id,
|
|
2600
2603
|
onGroupClick: (e) => {
|
|
2601
|
-
Y(
|
|
2604
|
+
Y(B(e)), ie("chats");
|
|
2602
2605
|
}
|
|
2603
2606
|
}) })]
|
|
2604
2607
|
}),
|
|
2605
|
-
n === "fullpage" &&
|
|
2606
|
-
currentUser:
|
|
2608
|
+
n === "fullpage" && re === "chats" && W && M && /* @__PURE__ */ T(ln, {
|
|
2609
|
+
currentUser: G,
|
|
2607
2610
|
onClose: () => N(!1),
|
|
2608
|
-
onAddMember: () => We(
|
|
2609
|
-
onUpdateGroup:
|
|
2611
|
+
onAddMember: () => We(W),
|
|
2612
|
+
onUpdateGroup: Ve,
|
|
2610
2613
|
onRemoveMember: (e, t) => {
|
|
2611
2614
|
Ke(e, t);
|
|
2612
2615
|
}
|
|
@@ -2614,10 +2617,10 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2614
2617
|
]
|
|
2615
2618
|
})]
|
|
2616
2619
|
}),
|
|
2617
|
-
b && /* @__PURE__ */ T(
|
|
2620
|
+
b && /* @__PURE__ */ T(rn, { onClose: () => {
|
|
2618
2621
|
x(!1);
|
|
2619
2622
|
} }),
|
|
2620
|
-
/* @__PURE__ */ T(
|
|
2623
|
+
/* @__PURE__ */ T(qt, {
|
|
2621
2624
|
isOpen: S,
|
|
2622
2625
|
onClose: () => {
|
|
2623
2626
|
C(!1), k(null);
|
|
@@ -2627,26 +2630,26 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2627
2630
|
removeMember: Ke,
|
|
2628
2631
|
primaryColor: i
|
|
2629
2632
|
}),
|
|
2630
|
-
/* @__PURE__ */ T(
|
|
2633
|
+
/* @__PURE__ */ T(Jt, {
|
|
2631
2634
|
isOpen: ee,
|
|
2632
2635
|
onClose: () => {
|
|
2633
2636
|
A(!1), te(null);
|
|
2634
2637
|
},
|
|
2635
2638
|
group: j,
|
|
2636
|
-
members:
|
|
2637
|
-
currentChatMembers:
|
|
2639
|
+
members: K,
|
|
2640
|
+
currentChatMembers: Ne,
|
|
2638
2641
|
onAddMember: Ge,
|
|
2639
2642
|
primaryColor: i
|
|
2640
2643
|
}),
|
|
2641
|
-
/* @__PURE__ */ T(
|
|
2644
|
+
/* @__PURE__ */ T(nn, {
|
|
2642
2645
|
isOpen: ne,
|
|
2643
2646
|
onClose: () => P(!1),
|
|
2644
2647
|
defaultColor: "#ffffff"
|
|
2645
2648
|
}),
|
|
2646
|
-
/* @__PURE__ */ T(
|
|
2649
|
+
/* @__PURE__ */ T(Gt, {})
|
|
2647
2650
|
]
|
|
2648
2651
|
});
|
|
2649
|
-
},
|
|
2652
|
+
}, Wt = i(({ chat: e, currentUserId: t }) => {
|
|
2650
2653
|
let n = d(() => e ? e.avatar ? e.avatar : e.type === "group" ? "👥" : e.members?.find((e) => e.id !== t)?.avatar ?? "👤" : "👤", [e, t]);
|
|
2651
2654
|
return n === "👥" || n === "👤" ? /* @__PURE__ */ T("div", {
|
|
2652
2655
|
style: {
|
|
@@ -2670,8 +2673,8 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2670
2673
|
borderRadius: "100%"
|
|
2671
2674
|
}
|
|
2672
2675
|
});
|
|
2673
|
-
}),
|
|
2674
|
-
let { toasts: e, removeToast: t } =
|
|
2676
|
+
}), Gt = () => {
|
|
2677
|
+
let { toasts: e, removeToast: t } = Ze(), { theme: n } = _((e) => e.setting);
|
|
2675
2678
|
return /* @__PURE__ */ T("div", {
|
|
2676
2679
|
className: `toast-container ${n === "dark" ? "dark-theme" : ""}`,
|
|
2677
2680
|
children: e.map((e) => /* @__PURE__ */ E("div", {
|
|
@@ -2728,7 +2731,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2728
2731
|
]
|
|
2729
2732
|
}, e.id))
|
|
2730
2733
|
});
|
|
2731
|
-
},
|
|
2734
|
+
}, Kt = ({ member: e }) => {
|
|
2732
2735
|
let [t, n] = p(!1), r = e.name?.charAt(0).toUpperCase() || "?";
|
|
2733
2736
|
if (e.avatar && !t) return /* @__PURE__ */ T("img", {
|
|
2734
2737
|
src: e.avatar,
|
|
@@ -2749,7 +2752,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2749
2752
|
style: { backgroundColor: i[(String(e.id)?.charCodeAt(0) || 0) % i.length] },
|
|
2750
2753
|
children: r
|
|
2751
2754
|
});
|
|
2752
|
-
},
|
|
2755
|
+
}, qt = ({ isOpen: e, onClose: t, group: n, onUpdate: r, removeMember: i, primaryColor: a }) => {
|
|
2753
2756
|
let [o, s] = p(""), [c, l] = p(""), [u, d] = p(""), [f, m] = p(!1), [h, g] = p(null), [v, y] = p(!1), { currentChatMembers: b, currentUser: x } = _((e) => e.chat);
|
|
2754
2757
|
(e !== v || e && n && n.id !== h) && (y(e), n ? (g(n.id), s(n.name ?? ""), l(n.avatar ?? ""), d(n.avatar ?? "")) : g(null));
|
|
2755
2758
|
let { t: S } = Z();
|
|
@@ -2875,7 +2878,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2875
2878
|
children: [
|
|
2876
2879
|
/* @__PURE__ */ E("div", {
|
|
2877
2880
|
className: "member-avatar-wrapper",
|
|
2878
|
-
children: [/* @__PURE__ */ T(
|
|
2881
|
+
children: [/* @__PURE__ */ T(Kt, { member: e }), (e.socket_ids?.length ?? 0) > 0 || e.socket_id || e.status === "online" ? /* @__PURE__ */ T(rt, {
|
|
2879
2882
|
size: 12,
|
|
2880
2883
|
className: "status-dot"
|
|
2881
2884
|
}) : null]
|
|
@@ -2902,7 +2905,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2902
2905
|
color: "#1e293b"
|
|
2903
2906
|
},
|
|
2904
2907
|
children: r ? "Bạn" : e.name
|
|
2905
|
-
}), t && /* @__PURE__ */ T(
|
|
2908
|
+
}), t && /* @__PURE__ */ T(it, {
|
|
2906
2909
|
size: 14,
|
|
2907
2910
|
style: { color: "#64748b" }
|
|
2908
2911
|
})]
|
|
@@ -2959,7 +2962,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
2959
2962
|
]
|
|
2960
2963
|
})
|
|
2961
2964
|
});
|
|
2962
|
-
},
|
|
2965
|
+
}, Jt = ({ isOpen: e, onClose: t, group: n, members: r, currentChatMembers: i, onAddMember: a, primaryColor: o }) => {
|
|
2963
2966
|
let [s, c] = p(""), [l, u] = p(!1), { t: d } = Z();
|
|
2964
2967
|
if (!e || !n) return null;
|
|
2965
2968
|
let f = new Set((i || []).map((e) => e.id)), m = (r || []).filter((e) => !f.has(e.id) && e.name.toLowerCase().includes(s.toLowerCase())), h = async (e) => {
|
|
@@ -3016,7 +3019,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3016
3019
|
className: "modal-body",
|
|
3017
3020
|
children: [/* @__PURE__ */ T("div", {
|
|
3018
3021
|
className: "search-section",
|
|
3019
|
-
children: /* @__PURE__ */ T(
|
|
3022
|
+
children: /* @__PURE__ */ T(sn, {
|
|
3020
3023
|
value: s,
|
|
3021
3024
|
onChange: c,
|
|
3022
3025
|
placeholder: d("addMember.memberSearchPlaceholder")
|
|
@@ -3034,7 +3037,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3034
3037
|
children: [
|
|
3035
3038
|
/* @__PURE__ */ E("div", {
|
|
3036
3039
|
className: "member-avatar-wrapper",
|
|
3037
|
-
children: [/* @__PURE__ */ T(
|
|
3040
|
+
children: [/* @__PURE__ */ T(Kt, { member: e }), (e.socket_ids?.length ?? 0) > 0 || e.socket_id || e.status === "online" ? /* @__PURE__ */ T(rt, {
|
|
3038
3041
|
size: 12,
|
|
3039
3042
|
className: "status-dot"
|
|
3040
3043
|
}) : null]
|
|
@@ -3071,12 +3074,12 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3071
3074
|
]
|
|
3072
3075
|
})
|
|
3073
3076
|
});
|
|
3074
|
-
},
|
|
3077
|
+
}, Yt = ({ file: e }) => /* @__PURE__ */ T("img", {
|
|
3075
3078
|
src: e.link,
|
|
3076
3079
|
alt: e.name,
|
|
3077
3080
|
className: "file-viewer-image",
|
|
3078
3081
|
title: e.name
|
|
3079
|
-
}),
|
|
3082
|
+
}), Xt = ({ file: e }) => /* @__PURE__ */ T("div", {
|
|
3080
3083
|
className: "video-container",
|
|
3081
3084
|
children: /* @__PURE__ */ T("video", {
|
|
3082
3085
|
src: e.link,
|
|
@@ -3085,7 +3088,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3085
3088
|
className: "file-viewer-video",
|
|
3086
3089
|
title: e.name
|
|
3087
3090
|
})
|
|
3088
|
-
}),
|
|
3091
|
+
}), Zt = ({ file: e }) => /* @__PURE__ */ T("div", {
|
|
3089
3092
|
className: "audio-container",
|
|
3090
3093
|
children: /* @__PURE__ */ E("div", {
|
|
3091
3094
|
className: "audio-player-wrapper",
|
|
@@ -3100,7 +3103,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3100
3103
|
children: e.name
|
|
3101
3104
|
})]
|
|
3102
3105
|
})
|
|
3103
|
-
}),
|
|
3106
|
+
}), Qt = ({ file: e }) => /* @__PURE__ */ T("div", {
|
|
3104
3107
|
className: "pdf-container",
|
|
3105
3108
|
children: /* @__PURE__ */ T("iframe", {
|
|
3106
3109
|
src: `${e.link}#toolbar=1&navpanes=0`,
|
|
@@ -3113,7 +3116,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3113
3116
|
borderRadius: "8px"
|
|
3114
3117
|
}
|
|
3115
3118
|
})
|
|
3116
|
-
}),
|
|
3119
|
+
}), $t = ({ file: e, openDownloadButtonText: t }) => /* @__PURE__ */ E("div", {
|
|
3117
3120
|
className: "file-viewer-generic",
|
|
3118
3121
|
children: [
|
|
3119
3122
|
/* @__PURE__ */ T("div", {
|
|
@@ -3132,7 +3135,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3132
3135
|
children: t
|
|
3133
3136
|
})
|
|
3134
3137
|
]
|
|
3135
|
-
}),
|
|
3138
|
+
}), en = ({ isOpen: e, files: t, initialIndex: n = 0, onClose: r }) => {
|
|
3136
3139
|
let [i, a] = p(n), o = f(null), { t: s } = Z();
|
|
3137
3140
|
if (!e || t.length === 0) return null;
|
|
3138
3141
|
let c = () => {
|
|
@@ -3197,11 +3200,11 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3197
3200
|
/* @__PURE__ */ E("div", {
|
|
3198
3201
|
className: "file-viewer-main",
|
|
3199
3202
|
children: [
|
|
3200
|
-
_ === "image" && /* @__PURE__ */ T(
|
|
3201
|
-
_ === "video" && /* @__PURE__ */ T(
|
|
3202
|
-
_ === "audio" && /* @__PURE__ */ T(
|
|
3203
|
-
_ === "pdf" && /* @__PURE__ */ T(
|
|
3204
|
-
_ === "other" && /* @__PURE__ */ T(
|
|
3203
|
+
_ === "image" && /* @__PURE__ */ T(Yt, { file: h }),
|
|
3204
|
+
_ === "video" && /* @__PURE__ */ T(Xt, { file: h }),
|
|
3205
|
+
_ === "audio" && /* @__PURE__ */ T(Zt, { file: h }),
|
|
3206
|
+
_ === "pdf" && /* @__PURE__ */ T(Qt, { file: h }),
|
|
3207
|
+
_ === "other" && /* @__PURE__ */ T($t, {
|
|
3205
3208
|
file: h,
|
|
3206
3209
|
openDownloadButtonText: s("fileViewer.openDownloadButton")
|
|
3207
3210
|
})
|
|
@@ -3212,13 +3215,13 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3212
3215
|
onClick: c,
|
|
3213
3216
|
"aria-label": s("fileViewer.previousAriaLabel"),
|
|
3214
3217
|
title: s("fileViewer.previousButtonTitle"),
|
|
3215
|
-
children: /* @__PURE__ */ T(
|
|
3218
|
+
children: /* @__PURE__ */ T(dt, {})
|
|
3216
3219
|
}), /* @__PURE__ */ T("button", {
|
|
3217
3220
|
className: "file-viewer-nav file-viewer-next",
|
|
3218
3221
|
onClick: l,
|
|
3219
3222
|
"aria-label": s("fileViewer.nextAriaLabel"),
|
|
3220
3223
|
title: s("fileViewer.nextButtonTitle"),
|
|
3221
|
-
children: /* @__PURE__ */ T(
|
|
3224
|
+
children: /* @__PURE__ */ T(ft, {})
|
|
3222
3225
|
})] }),
|
|
3223
3226
|
/* @__PURE__ */ E("div", {
|
|
3224
3227
|
className: "file-viewer-counter",
|
|
@@ -3236,7 +3239,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3236
3239
|
onClick: u,
|
|
3237
3240
|
"aria-label": s("fileViewer.scrollLeftAriaLabel"),
|
|
3238
3241
|
title: s("fileViewer.scrollLeftTitle"),
|
|
3239
|
-
children: /* @__PURE__ */ T(
|
|
3242
|
+
children: /* @__PURE__ */ T(dt, {})
|
|
3240
3243
|
}),
|
|
3241
3244
|
/* @__PURE__ */ T("div", {
|
|
3242
3245
|
className: "file-viewer-thumbnails",
|
|
@@ -3290,14 +3293,14 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3290
3293
|
onClick: d,
|
|
3291
3294
|
"aria-label": s("fileViewer.scrollRightAriaLabel"),
|
|
3292
3295
|
title: s("fileViewer.scrollRightTitle"),
|
|
3293
|
-
children: /* @__PURE__ */ T(
|
|
3296
|
+
children: /* @__PURE__ */ T(ft, {})
|
|
3294
3297
|
})
|
|
3295
3298
|
]
|
|
3296
3299
|
})
|
|
3297
3300
|
]
|
|
3298
3301
|
})
|
|
3299
3302
|
});
|
|
3300
|
-
},
|
|
3303
|
+
}, tn = [
|
|
3301
3304
|
"#fff",
|
|
3302
3305
|
"#a855f7",
|
|
3303
3306
|
"#3b82f6",
|
|
@@ -3307,7 +3310,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3307
3310
|
"#ec4899",
|
|
3308
3311
|
"#6366f1",
|
|
3309
3312
|
"#14b8a6"
|
|
3310
|
-
],
|
|
3313
|
+
], nn = ({ isOpen: e, onClose: t, defaultColor: n = "#ffffff" }) => {
|
|
3311
3314
|
let r = g(), { t: i } = Z(), { primaryColor: a } = _((e) => e.setting);
|
|
3312
3315
|
return e ? /* @__PURE__ */ T("div", {
|
|
3313
3316
|
className: "modal-overlay",
|
|
@@ -3340,10 +3343,10 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3340
3343
|
}),
|
|
3341
3344
|
/* @__PURE__ */ T("div", {
|
|
3342
3345
|
className: "color-presets",
|
|
3343
|
-
children:
|
|
3346
|
+
children: tn.map((e) => /* @__PURE__ */ T("button", {
|
|
3344
3347
|
className: `color-preset-btn ${a === e ? "active" : ""}`,
|
|
3345
3348
|
style: { backgroundColor: e },
|
|
3346
|
-
onClick: () => r(
|
|
3349
|
+
onClick: () => r(J(e)),
|
|
3347
3350
|
children: a === e && /* @__PURE__ */ T("span", {
|
|
3348
3351
|
className: "check-icon",
|
|
3349
3352
|
children: "✓"
|
|
@@ -3360,7 +3363,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3360
3363
|
children: [/* @__PURE__ */ T("input", {
|
|
3361
3364
|
type: "color",
|
|
3362
3365
|
value: a,
|
|
3363
|
-
onChange: (e) => r(
|
|
3366
|
+
onChange: (e) => r(J(e.target.value)),
|
|
3364
3367
|
className: "color-input"
|
|
3365
3368
|
}), /* @__PURE__ */ T("span", {
|
|
3366
3369
|
className: "color-hex-code",
|
|
@@ -3378,14 +3381,14 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3378
3381
|
children: i("themeModal.doneButton")
|
|
3379
3382
|
}), /* @__PURE__ */ T("button", {
|
|
3380
3383
|
className: "modal-btn cancel",
|
|
3381
|
-
onClick: () => r(
|
|
3384
|
+
onClick: () => r(J(n)),
|
|
3382
3385
|
children: i("themeModal.resetButton")
|
|
3383
3386
|
})]
|
|
3384
3387
|
})
|
|
3385
3388
|
]
|
|
3386
3389
|
})
|
|
3387
3390
|
}) : null;
|
|
3388
|
-
},
|
|
3391
|
+
}, rn = ({ onClose: e }) => {
|
|
3389
3392
|
let { t } = Z(), n = g(), { members: r, chats: i } = _((e) => e.chat), [o, s] = p([]), [c, l] = p(""), [u, d] = p(""), [m, h] = p(""), [v, y] = p(""), b = f(null), x = (e) => {
|
|
3390
3393
|
s((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
|
|
3391
3394
|
}, S = (e) => {
|
|
@@ -3402,8 +3405,8 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3402
3405
|
}, w = a(async () => {
|
|
3403
3406
|
if (!(o.length < 2)) try {
|
|
3404
3407
|
if (!c.trim()) return;
|
|
3405
|
-
let t = o.map((e) => Number(e)), r = typeof m == "string" ? m.trim() || void 0 : m || void 0, a = (await
|
|
3406
|
-
a && n(
|
|
3408
|
+
let t = o.map((e) => Number(e)), r = typeof m == "string" ? m.trim() || void 0 : m || void 0, a = (await U.addGroup(t, c, r)).data;
|
|
3409
|
+
a && n(B(i.find((e) => e.id === a.id) || a)), e();
|
|
3407
3410
|
} catch (e) {
|
|
3408
3411
|
console.error("Lỗi khi tạo cuộc trò chuyện:", e), alert("Không thể tạo cuộc trò chuyện. Vui lòng thử lại sau.");
|
|
3409
3412
|
}
|
|
@@ -3454,7 +3457,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3454
3457
|
src: v,
|
|
3455
3458
|
alt: "Group avatar",
|
|
3456
3459
|
className: "preview-avatar"
|
|
3457
|
-
}) : /* @__PURE__ */ T(
|
|
3460
|
+
}) : /* @__PURE__ */ T(Ht, {})
|
|
3458
3461
|
})]
|
|
3459
3462
|
}), /* @__PURE__ */ T("input", {
|
|
3460
3463
|
type: "text",
|
|
@@ -3466,7 +3469,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3466
3469
|
}),
|
|
3467
3470
|
/* @__PURE__ */ T("div", {
|
|
3468
3471
|
className: "search-section",
|
|
3469
|
-
children: /* @__PURE__ */ T(
|
|
3472
|
+
children: /* @__PURE__ */ T(sn, {
|
|
3470
3473
|
value: u,
|
|
3471
3474
|
onChange: d,
|
|
3472
3475
|
placeholder: t("addChat.memberSearchPlaceholder")
|
|
@@ -3524,7 +3527,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3524
3527
|
className: "avatar-letter",
|
|
3525
3528
|
children: e.name.charAt(0).toUpperCase()
|
|
3526
3529
|
})
|
|
3527
|
-
}), (e.socket_ids?.length ?? 0) > 0 || e.socket_id || e.status === "online" ? /* @__PURE__ */ T(
|
|
3530
|
+
}), (e.socket_ids?.length ?? 0) > 0 || e.socket_id || e.status === "online" ? /* @__PURE__ */ T(rt, {
|
|
3528
3531
|
size: 12,
|
|
3529
3532
|
className: "status-dot"
|
|
3530
3533
|
}) : null]
|
|
@@ -3555,7 +3558,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3555
3558
|
]
|
|
3556
3559
|
})
|
|
3557
3560
|
});
|
|
3558
|
-
},
|
|
3561
|
+
}, an = ({ user: e, onClose: t, isOnline: n, onMessage: r }) => e ? /* @__PURE__ */ T("div", {
|
|
3559
3562
|
className: "modal-overlay",
|
|
3560
3563
|
onClick: t,
|
|
3561
3564
|
children: /* @__PURE__ */ E("div", {
|
|
@@ -3572,7 +3575,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3572
3575
|
children: [
|
|
3573
3576
|
/* @__PURE__ */ E("div", {
|
|
3574
3577
|
className: "profile-avatar-wrapper",
|
|
3575
|
-
children: [/* @__PURE__ */ T(
|
|
3578
|
+
children: [/* @__PURE__ */ T(Kt, { member: e }), n && /* @__PURE__ */ T("span", { className: "profile-online-status" })]
|
|
3576
3579
|
}),
|
|
3577
3580
|
/* @__PURE__ */ T("h3", {
|
|
3578
3581
|
className: "profile-name",
|
|
@@ -3589,7 +3592,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3589
3592
|
children: /* @__PURE__ */ E("button", {
|
|
3590
3593
|
className: "profile-action-btn",
|
|
3591
3594
|
onClick: r,
|
|
3592
|
-
children: [/* @__PURE__ */ T(
|
|
3595
|
+
children: [/* @__PURE__ */ T(pt, {}), /* @__PURE__ */ T("span", { children: "Nhắn tin" })]
|
|
3593
3596
|
})
|
|
3594
3597
|
}),
|
|
3595
3598
|
/* @__PURE__ */ E("div", {
|
|
@@ -3649,8 +3652,8 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3649
3652
|
})
|
|
3650
3653
|
]
|
|
3651
3654
|
})
|
|
3652
|
-
}) : null,
|
|
3653
|
-
let { currentUser: r, members: i } = _((e) => e.chat), [a, o] = p(null), [s, l] = p(null), { t: u } = Z(), { hasGroupChat: d } = _(
|
|
3655
|
+
}) : null, on = ({ chats: e, selectedChat: t, onSelectChat: n }) => {
|
|
3656
|
+
let { currentUser: r, members: i } = _((e) => e.chat), [a, o] = p(null), [s, l] = p(null), { t: u } = Z(), { hasGroupChat: d } = _(He), f = e.filter((e) => !(e.type === "group" && !d)), m = f.filter((e) => e.is_pined), h = f.filter((e) => !e.is_pined), g = (e) => e ? new Date(e).toLocaleTimeString([], {
|
|
3654
3657
|
hour: "2-digit",
|
|
3655
3658
|
minute: "2-digit"
|
|
3656
3659
|
}) : "";
|
|
@@ -3684,10 +3687,10 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3684
3687
|
isOnline: d
|
|
3685
3688
|
});
|
|
3686
3689
|
},
|
|
3687
|
-
children: [/* @__PURE__ */ T(
|
|
3690
|
+
children: [/* @__PURE__ */ T(Wt, {
|
|
3688
3691
|
chat: e,
|
|
3689
3692
|
currentUserId: r?.id
|
|
3690
|
-
}), e.type === "single" && d && /* @__PURE__ */ T(
|
|
3693
|
+
}), e.type === "single" && d && /* @__PURE__ */ T(rt, {
|
|
3691
3694
|
size: 12,
|
|
3692
3695
|
className: "online-indicator"
|
|
3693
3696
|
})]
|
|
@@ -3715,7 +3718,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3715
3718
|
})
|
|
3716
3719
|
}), /* @__PURE__ */ E("div", {
|
|
3717
3720
|
className: "info-bottom-right",
|
|
3718
|
-
children: [e.is_muted && /* @__PURE__ */ T(
|
|
3721
|
+
children: [e.is_muted && /* @__PURE__ */ T(lt, {
|
|
3719
3722
|
size: 14,
|
|
3720
3723
|
className: "mute-icon-list"
|
|
3721
3724
|
}), s > 0 && /* @__PURE__ */ T("div", {
|
|
@@ -3731,7 +3734,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3731
3734
|
children: "Không có tin nhắn nào"
|
|
3732
3735
|
}) : null]
|
|
3733
3736
|
}),
|
|
3734
|
-
s && /* @__PURE__ */ T(
|
|
3737
|
+
s && /* @__PURE__ */ T(an, {
|
|
3735
3738
|
user: s.user,
|
|
3736
3739
|
isOnline: s.isOnline,
|
|
3737
3740
|
onClose: () => l(null),
|
|
@@ -3743,14 +3746,14 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3743
3746
|
})
|
|
3744
3747
|
]
|
|
3745
3748
|
});
|
|
3746
|
-
},
|
|
3747
|
-
let { hasGroupChat: a } = _(
|
|
3749
|
+
}, sn = ({ value: e, onChange: t, onAddClick: n, placeholder: r, activeTab: i }) => {
|
|
3750
|
+
let { hasGroupChat: a } = _(He), { t: o } = Z(), s = o("chatSearchBar.searchPlaceholder");
|
|
3748
3751
|
return /* @__PURE__ */ E("div", {
|
|
3749
3752
|
className: "chat-search-bar",
|
|
3750
3753
|
children: [/* @__PURE__ */ E("div", {
|
|
3751
3754
|
className: "search-input-wrapper",
|
|
3752
3755
|
children: [
|
|
3753
|
-
/* @__PURE__ */ T(
|
|
3756
|
+
/* @__PURE__ */ T(gt, { className: "search-icon" }),
|
|
3754
3757
|
/* @__PURE__ */ T("input", {
|
|
3755
3758
|
type: "text",
|
|
3756
3759
|
className: "search-input",
|
|
@@ -3768,10 +3771,10 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3768
3771
|
className: "action-btn add-group-btn",
|
|
3769
3772
|
onClick: n,
|
|
3770
3773
|
title: o("chatSearchBar.createGroup"),
|
|
3771
|
-
children: /* @__PURE__ */ T(
|
|
3774
|
+
children: /* @__PURE__ */ T(st, {})
|
|
3772
3775
|
})]
|
|
3773
3776
|
});
|
|
3774
|
-
},
|
|
3777
|
+
}, cn = ({ setIsThemeModalOpen: e, currentUser: t, activeTab: n, setActiveTab: r }) => /* @__PURE__ */ E("div", {
|
|
3775
3778
|
className: "app-sidebar",
|
|
3776
3779
|
children: [/* @__PURE__ */ E("div", {
|
|
3777
3780
|
className: "app-nav",
|
|
@@ -3779,21 +3782,21 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3779
3782
|
/* @__PURE__ */ T("div", {
|
|
3780
3783
|
className: `nav-item ${n === "chats" ? "active" : ""}`,
|
|
3781
3784
|
onClick: () => r("chats"),
|
|
3782
|
-
children: /* @__PURE__ */ T(
|
|
3785
|
+
children: /* @__PURE__ */ T(mt, {})
|
|
3783
3786
|
}),
|
|
3784
3787
|
/* @__PURE__ */ T("div", {
|
|
3785
3788
|
className: `nav-item ${n === "contacts" ? "active" : ""}`,
|
|
3786
3789
|
onClick: () => r("contacts"),
|
|
3787
|
-
children: /* @__PURE__ */ T(
|
|
3790
|
+
children: /* @__PURE__ */ T(st, {})
|
|
3788
3791
|
}),
|
|
3789
3792
|
/* @__PURE__ */ T("div", { className: "nav-separator" }),
|
|
3790
3793
|
/* @__PURE__ */ T("div", {
|
|
3791
3794
|
className: "nav-item",
|
|
3792
|
-
children: /* @__PURE__ */ T(
|
|
3795
|
+
children: /* @__PURE__ */ T(ht, {})
|
|
3793
3796
|
}),
|
|
3794
3797
|
/* @__PURE__ */ T("div", {
|
|
3795
3798
|
className: "nav-item",
|
|
3796
|
-
children: /* @__PURE__ */ T(
|
|
3799
|
+
children: /* @__PURE__ */ T(gt, {})
|
|
3797
3800
|
})
|
|
3798
3801
|
]
|
|
3799
3802
|
}), /* @__PURE__ */ E("div", {
|
|
@@ -3801,7 +3804,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3801
3804
|
children: [/* @__PURE__ */ T("div", {
|
|
3802
3805
|
className: "nav-item",
|
|
3803
3806
|
onClick: () => e(!0),
|
|
3804
|
-
children: /* @__PURE__ */ T(
|
|
3807
|
+
children: /* @__PURE__ */ T(_t, {})
|
|
3805
3808
|
}), /* @__PURE__ */ T("div", {
|
|
3806
3809
|
className: "app-avatar",
|
|
3807
3810
|
children: t?.avatar ? /* @__PURE__ */ T("img", {
|
|
@@ -3828,7 +3831,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3828
3831
|
})
|
|
3829
3832
|
})]
|
|
3830
3833
|
})]
|
|
3831
|
-
}),
|
|
3834
|
+
}), ln = ({ currentUser: e, onClose: t, onAddMember: n, onUpdateGroup: r, onRemoveMember: i }) => {
|
|
3832
3835
|
let a = g(), { currentChatMembers: o, currentChat: s } = _((e) => e.chat), [l, u] = p("info"), [d, f] = p(null), [m, h] = p(!1), [v, y] = p(null), [b, x] = p({
|
|
3833
3836
|
canChangeInfo: !0,
|
|
3834
3837
|
canPinMessage: !0,
|
|
@@ -3855,10 +3858,10 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3855
3858
|
let C = o.length ?? 0, D = O(s, e?.id, ""), k = o ?? [], ee = async () => {
|
|
3856
3859
|
if (!v) return;
|
|
3857
3860
|
let e = s;
|
|
3858
|
-
if (e) a(
|
|
3861
|
+
if (e) a(B(e));
|
|
3859
3862
|
else try {
|
|
3860
|
-
let e = await
|
|
3861
|
-
e?.data && (a(
|
|
3863
|
+
let e = await U.addChat(v.user.id);
|
|
3864
|
+
e?.data && (a(Ce(e.data)), a(B(e.data)));
|
|
3862
3865
|
} catch (e) {
|
|
3863
3866
|
console.error("Lỗi khi tạo phòng chat mới:", e);
|
|
3864
3867
|
}
|
|
@@ -3873,7 +3876,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3873
3876
|
children: [/* @__PURE__ */ T("button", {
|
|
3874
3877
|
className: "back-info-btn",
|
|
3875
3878
|
onClick: () => u("info"),
|
|
3876
|
-
children: /* @__PURE__ */ T(
|
|
3879
|
+
children: /* @__PURE__ */ T(ct, {})
|
|
3877
3880
|
}), /* @__PURE__ */ T("h3", {
|
|
3878
3881
|
className: "header-title",
|
|
3879
3882
|
children: "Quản lý nhóm"
|
|
@@ -3951,7 +3954,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3951
3954
|
className: "setting-item-switch",
|
|
3952
3955
|
children: [/* @__PURE__ */ E("div", {
|
|
3953
3956
|
className: "setting-info",
|
|
3954
|
-
children: [/* @__PURE__ */ T("span", { children: "Chế độ phê duyệt thành viên mới" }), /* @__PURE__ */ T(
|
|
3957
|
+
children: [/* @__PURE__ */ T("span", { children: "Chế độ phê duyệt thành viên mới" }), /* @__PURE__ */ T(vt, { className: "help-icon" })]
|
|
3955
3958
|
}), /* @__PURE__ */ E("label", {
|
|
3956
3959
|
className: "switch",
|
|
3957
3960
|
children: [/* @__PURE__ */ T("input", {
|
|
@@ -3965,7 +3968,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3965
3968
|
className: "setting-item-switch",
|
|
3966
3969
|
children: [/* @__PURE__ */ E("div", {
|
|
3967
3970
|
className: "setting-info",
|
|
3968
|
-
children: [/* @__PURE__ */ T("span", { children: "Đánh dấu tin nhắn từ trưởng/phó nhóm" }), /* @__PURE__ */ T(
|
|
3971
|
+
children: [/* @__PURE__ */ T("span", { children: "Đánh dấu tin nhắn từ trưởng/phó nhóm" }), /* @__PURE__ */ T(vt, { className: "help-icon" })]
|
|
3969
3972
|
}), /* @__PURE__ */ E("label", {
|
|
3970
3973
|
className: "switch",
|
|
3971
3974
|
children: [/* @__PURE__ */ T("input", {
|
|
@@ -3979,7 +3982,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
3979
3982
|
className: "setting-item-switch",
|
|
3980
3983
|
children: [/* @__PURE__ */ E("div", {
|
|
3981
3984
|
className: "setting-info",
|
|
3982
|
-
children: [/* @__PURE__ */ T("span", { children: "Cho phép thành viên mới đọc tin nhắn gần nhất" }), /* @__PURE__ */ T(
|
|
3985
|
+
children: [/* @__PURE__ */ T("span", { children: "Cho phép thành viên mới đọc tin nhắn gần nhất" }), /* @__PURE__ */ T(vt, { className: "help-icon" })]
|
|
3983
3986
|
}), /* @__PURE__ */ E("label", {
|
|
3984
3987
|
className: "switch",
|
|
3985
3988
|
children: [/* @__PURE__ */ T("input", {
|
|
@@ -4000,13 +4003,13 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4000
4003
|
className: "menu-item",
|
|
4001
4004
|
children: /* @__PURE__ */ E("div", {
|
|
4002
4005
|
className: "menu-left",
|
|
4003
|
-
children: [/* @__PURE__ */ T(
|
|
4006
|
+
children: [/* @__PURE__ */ T(yt, {}), /* @__PURE__ */ T("span", { children: "Chặn khỏi nhóm" })]
|
|
4004
4007
|
})
|
|
4005
4008
|
}), /* @__PURE__ */ T("div", {
|
|
4006
4009
|
className: "menu-item",
|
|
4007
4010
|
children: /* @__PURE__ */ E("div", {
|
|
4008
4011
|
className: "menu-left",
|
|
4009
|
-
children: [/* @__PURE__ */ T(
|
|
4012
|
+
children: [/* @__PURE__ */ T(bt, {}), /* @__PURE__ */ T("span", { children: "Trưởng & phó nhóm" })]
|
|
4010
4013
|
})
|
|
4011
4014
|
})]
|
|
4012
4015
|
})
|
|
@@ -4031,7 +4034,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4031
4034
|
className: "info-basic-section",
|
|
4032
4035
|
children: [/* @__PURE__ */ T("div", {
|
|
4033
4036
|
className: "info-avatar-large",
|
|
4034
|
-
children: /* @__PURE__ */ T(
|
|
4037
|
+
children: /* @__PURE__ */ T(Wt, {
|
|
4035
4038
|
chat: s,
|
|
4036
4039
|
currentUserId: e?.id
|
|
4037
4040
|
})
|
|
@@ -4041,7 +4044,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4041
4044
|
className: "info-chat-name",
|
|
4042
4045
|
children: [D, /* @__PURE__ */ T("span", {
|
|
4043
4046
|
className: "info-status-icons",
|
|
4044
|
-
children: s.type === "group" && /* @__PURE__ */ T(
|
|
4047
|
+
children: s.type === "group" && /* @__PURE__ */ T(xt, { onClick: (e) => {
|
|
4045
4048
|
e.stopPropagation(), r && r(s);
|
|
4046
4049
|
} })
|
|
4047
4050
|
})]
|
|
@@ -4100,11 +4103,11 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4100
4103
|
")"
|
|
4101
4104
|
] }), /* @__PURE__ */ E("div", {
|
|
4102
4105
|
className: "title-actions",
|
|
4103
|
-
children: [/* @__PURE__ */ T(
|
|
4106
|
+
children: [/* @__PURE__ */ T(St, {
|
|
4104
4107
|
size: 16,
|
|
4105
4108
|
onClick: n,
|
|
4106
4109
|
style: { cursor: "pointer" }
|
|
4107
|
-
}), /* @__PURE__ */ T(
|
|
4110
|
+
}), /* @__PURE__ */ T(Ct, {
|
|
4108
4111
|
onClick: () => h(!m),
|
|
4109
4112
|
style: {
|
|
4110
4113
|
cursor: "pointer",
|
|
@@ -4117,7 +4120,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4117
4120
|
className: "members-facepile",
|
|
4118
4121
|
children: [k.slice(0, 8).map((t) => /* @__PURE__ */ E("div", {
|
|
4119
4122
|
className: "facepile-item",
|
|
4120
|
-
children: [/* @__PURE__ */ T(
|
|
4123
|
+
children: [/* @__PURE__ */ T(Kt, { member: t }), (t.id === e?.id || (t.socket_ids?.length ?? 0) > 0) && /* @__PURE__ */ T("div", { className: "online-status" })]
|
|
4121
4124
|
}, t.id)), k.length > 8 && /* @__PURE__ */ E("div", {
|
|
4122
4125
|
className: "facepile-more",
|
|
4123
4126
|
children: ["+", k.length - 8]
|
|
@@ -4137,7 +4140,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4137
4140
|
style: { cursor: "pointer" },
|
|
4138
4141
|
children: [/* @__PURE__ */ E("div", {
|
|
4139
4142
|
className: "member-avatar-small",
|
|
4140
|
-
children: [/* @__PURE__ */ T(
|
|
4143
|
+
children: [/* @__PURE__ */ T(Kt, { member: t }), r && /* @__PURE__ */ T("div", { className: "online-status" })]
|
|
4141
4144
|
}), /* @__PURE__ */ E("div", {
|
|
4142
4145
|
className: "member-info",
|
|
4143
4146
|
children: [/* @__PURE__ */ E("div", {
|
|
@@ -4145,7 +4148,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4145
4148
|
children: [/* @__PURE__ */ T("span", {
|
|
4146
4149
|
className: "member-name",
|
|
4147
4150
|
children: t.id === e?.id ? "Bạn" : t.name
|
|
4148
|
-
}), n && /* @__PURE__ */ T(
|
|
4151
|
+
}), n && /* @__PURE__ */ T(it, {})]
|
|
4149
4152
|
}), /* @__PURE__ */ T("span", {
|
|
4150
4153
|
className: "member-role",
|
|
4151
4154
|
children: n ? "Trưởng nhóm" : "Thành viên"
|
|
@@ -4160,7 +4163,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4160
4163
|
onClick: (e) => {
|
|
4161
4164
|
e.stopPropagation(), f(d === t.id ? null : t.id);
|
|
4162
4165
|
},
|
|
4163
|
-
children: /* @__PURE__ */ T(
|
|
4166
|
+
children: /* @__PURE__ */ T(wt, {})
|
|
4164
4167
|
}), d === t.id && /* @__PURE__ */ T("div", {
|
|
4165
4168
|
className: "member-dropdown-menu",
|
|
4166
4169
|
children: !n && /* @__PURE__ */ E("button", {
|
|
@@ -4168,7 +4171,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4168
4171
|
onClick: (e) => {
|
|
4169
4172
|
e.stopPropagation(), i && i(s.id, t.id), f(null);
|
|
4170
4173
|
},
|
|
4171
|
-
children: [/* @__PURE__ */ T(
|
|
4174
|
+
children: [/* @__PURE__ */ T(yt, { size: 16 }), /* @__PURE__ */ T("span", { children: "Xoá khỏi nhóm" })]
|
|
4172
4175
|
})
|
|
4173
4176
|
})]
|
|
4174
4177
|
})
|
|
@@ -4179,7 +4182,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4179
4182
|
})
|
|
4180
4183
|
]
|
|
4181
4184
|
}),
|
|
4182
|
-
v && /* @__PURE__ */ T(
|
|
4185
|
+
v && /* @__PURE__ */ T(an, {
|
|
4183
4186
|
user: v.user,
|
|
4184
4187
|
isOnline: v.isOnline,
|
|
4185
4188
|
onClose: () => y(null),
|
|
@@ -4187,8 +4190,8 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4187
4190
|
})
|
|
4188
4191
|
]
|
|
4189
4192
|
});
|
|
4190
|
-
},
|
|
4191
|
-
let { t: a, toggleChangeLanguage: o } = Z(), { hasMultipleLanguages: s } = _(
|
|
4193
|
+
}, un = ({ mode: e, title: t, logoUrl: n, onToggleMode: r, onClose: i }) => {
|
|
4194
|
+
let { t: a, toggleChangeLanguage: o } = Z(), { hasMultipleLanguages: s } = _(He), c = t ?? a("chatHeader.defaultTitle");
|
|
4192
4195
|
return /* @__PURE__ */ E("div", {
|
|
4193
4196
|
className: `chat-header ${e}`,
|
|
4194
4197
|
children: [/* @__PURE__ */ E("div", {
|
|
@@ -4203,7 +4206,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4203
4206
|
height: "22px",
|
|
4204
4207
|
objectFit: "contain"
|
|
4205
4208
|
}
|
|
4206
|
-
}) : /* @__PURE__ */ T(
|
|
4209
|
+
}) : /* @__PURE__ */ T(at, {
|
|
4207
4210
|
size: 22,
|
|
4208
4211
|
style: {
|
|
4209
4212
|
width: "22px",
|
|
@@ -4235,19 +4238,19 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4235
4238
|
className: "action-btn",
|
|
4236
4239
|
onClick: o,
|
|
4237
4240
|
title: a("chatHeader.language"),
|
|
4238
|
-
children: /* @__PURE__ */ T(
|
|
4241
|
+
children: /* @__PURE__ */ T(Vt, { size: 16 })
|
|
4239
4242
|
}),
|
|
4240
4243
|
/* @__PURE__ */ T("button", {
|
|
4241
4244
|
className: "action-btn",
|
|
4242
4245
|
onClick: i,
|
|
4243
4246
|
title: a("chatHeader.minimize"),
|
|
4244
|
-
children: /* @__PURE__ */ T(
|
|
4247
|
+
children: /* @__PURE__ */ T(Tt, { size: 16 })
|
|
4245
4248
|
}),
|
|
4246
4249
|
/* @__PURE__ */ T("button", {
|
|
4247
4250
|
className: "action-btn",
|
|
4248
4251
|
onClick: r,
|
|
4249
4252
|
title: a(e === "fullpage" ? "chatHeader.minimize" : "chatHeader.maximize"),
|
|
4250
|
-
children: T(e === "fullpage" ?
|
|
4253
|
+
children: T(e === "fullpage" ? Dt : Et, {})
|
|
4251
4254
|
}),
|
|
4252
4255
|
/* @__PURE__ */ T("button", {
|
|
4253
4256
|
className: "action-btn close-btn",
|
|
@@ -4258,28 +4261,28 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4258
4261
|
]
|
|
4259
4262
|
})]
|
|
4260
4263
|
});
|
|
4261
|
-
},
|
|
4262
|
-
let { t: n } = Z(), r = g(), { currentChat: i, replyingMessage: o } = _((e) => e.chat), { hasVoice: s, hasAttachment: u, hasMultipleAttachments: d, acceptFilter: m, isFileTypeAllowed: h } = _(
|
|
4264
|
+
}, dn = r(({ primaryColor: e }, t) => {
|
|
4265
|
+
let { t: n } = Z(), r = g(), { currentChat: i, replyingMessage: o } = _((e) => e.chat), { hasVoice: s, hasAttachment: u, hasMultipleAttachments: d, acceptFilter: m, isFileTypeAllowed: h } = _(He), [v, y] = p(""), [b, x] = p(!1), [S, C] = p(!1), [D, O] = p([]), [k, ee] = p(!1), [A, j] = Xe(), [te, M] = p(!1), { showToast: N } = Ze(), P = f(null), re = f(null), ie = f(null), oe = f(/* @__PURE__ */ new Map()), se = (e) => {
|
|
4263
4266
|
y((t) => t + e), x(!1);
|
|
4264
|
-
},
|
|
4267
|
+
}, ce = async () => {
|
|
4265
4268
|
await j.startRecording();
|
|
4266
|
-
},
|
|
4269
|
+
}, R = async () => {
|
|
4267
4270
|
M(!0);
|
|
4268
4271
|
try {
|
|
4269
4272
|
await j.stopRecording();
|
|
4270
4273
|
} finally {
|
|
4271
4274
|
M(!1);
|
|
4272
4275
|
}
|
|
4273
|
-
},
|
|
4276
|
+
}, me = () => {
|
|
4274
4277
|
A.recordedFile && (O((e) => [...e, A.recordedFile]), j.clearRecording());
|
|
4275
|
-
},
|
|
4278
|
+
}, z = (e) => {
|
|
4276
4279
|
let t = `${e.name}-${e.size}`;
|
|
4277
|
-
|
|
4280
|
+
oe.current.has(t) && clearTimeout(oe.current.get(t));
|
|
4278
4281
|
let n = setTimeout(() => {
|
|
4279
|
-
O((e) => e.filter((e) => e.errorId !== t)),
|
|
4282
|
+
O((e) => e.filter((e) => e.errorId !== t)), oe.current.delete(t);
|
|
4280
4283
|
}, 5e3);
|
|
4281
|
-
return
|
|
4282
|
-
},
|
|
4284
|
+
return oe.current.set(t, n), t;
|
|
4285
|
+
}, he = (e) => {
|
|
4283
4286
|
if (!e?.length) return;
|
|
4284
4287
|
if (!u) {
|
|
4285
4288
|
N("Tính năng đính kèm file chưa được kích hoạt.", "warning");
|
|
@@ -4290,14 +4293,14 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4290
4293
|
N("Loại file không được phép.", "error");
|
|
4291
4294
|
return;
|
|
4292
4295
|
}
|
|
4293
|
-
let n =
|
|
4296
|
+
let n = pe([...D, ...t], d, h);
|
|
4294
4297
|
if (n) {
|
|
4295
4298
|
N(n.message, n.type);
|
|
4296
4299
|
return;
|
|
4297
4300
|
}
|
|
4298
4301
|
let r = t.map((e) => {
|
|
4299
4302
|
if (e.size <= 26214400) return e;
|
|
4300
|
-
let t =
|
|
4303
|
+
let t = z(e);
|
|
4301
4304
|
return Object.assign(e, {
|
|
4302
4305
|
isError: !0,
|
|
4303
4306
|
errorId: t
|
|
@@ -4305,17 +4308,17 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4305
4308
|
});
|
|
4306
4309
|
O((e) => [...e, ...r]);
|
|
4307
4310
|
};
|
|
4308
|
-
l(t, () => ({ processPastedFiles:
|
|
4309
|
-
let
|
|
4311
|
+
l(t, () => ({ processPastedFiles: he }));
|
|
4312
|
+
let B = (e) => {
|
|
4310
4313
|
let t = e.clipboardData;
|
|
4311
4314
|
if (!t) return;
|
|
4312
4315
|
if (t.files && t.files.length > 0) {
|
|
4313
|
-
e.preventDefault(),
|
|
4316
|
+
e.preventDefault(), he(t.files);
|
|
4314
4317
|
return;
|
|
4315
4318
|
}
|
|
4316
4319
|
let n = t.getData("text/plain");
|
|
4317
4320
|
n && y((e) => e + n);
|
|
4318
|
-
},
|
|
4321
|
+
}, ge = (e) => {
|
|
4319
4322
|
let t = e.currentTarget.files;
|
|
4320
4323
|
if (!t?.length) return;
|
|
4321
4324
|
let n = () => {
|
|
@@ -4330,64 +4333,64 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4330
4333
|
N("Loại file được chọn không được phép.", "error"), n();
|
|
4331
4334
|
return;
|
|
4332
4335
|
}
|
|
4333
|
-
let i =
|
|
4336
|
+
let i = pe([...D, ...r], d, h);
|
|
4334
4337
|
if (i) {
|
|
4335
4338
|
N(i.message, i.type), n();
|
|
4336
4339
|
return;
|
|
4337
4340
|
}
|
|
4338
4341
|
let a = r.map((e) => {
|
|
4339
4342
|
if (e.size <= 26214400) return e;
|
|
4340
|
-
let t =
|
|
4343
|
+
let t = z(e);
|
|
4341
4344
|
return Object.assign(e, {
|
|
4342
4345
|
isError: !0,
|
|
4343
4346
|
errorId: t
|
|
4344
4347
|
});
|
|
4345
4348
|
});
|
|
4346
4349
|
O((e) => [...e, ...a]), n();
|
|
4347
|
-
},
|
|
4350
|
+
}, _e = a((e) => {
|
|
4348
4351
|
O((t) => t.filter((t, n) => n !== e));
|
|
4349
|
-
}, []),
|
|
4352
|
+
}, []), ve = a(() => {
|
|
4350
4353
|
P.current?.click();
|
|
4351
4354
|
}, []);
|
|
4352
4355
|
c(() => {
|
|
4353
4356
|
if (!S) return;
|
|
4354
4357
|
let e = (e) => {
|
|
4355
|
-
|
|
4358
|
+
re.current && !re.current.contains(e.target) && C(!1);
|
|
4356
4359
|
};
|
|
4357
4360
|
return document.addEventListener("click", e), () => {
|
|
4358
4361
|
document.removeEventListener("click", e);
|
|
4359
4362
|
};
|
|
4360
4363
|
}, [S]), c(() => {
|
|
4361
|
-
k ||
|
|
4364
|
+
k || ie.current?.focus();
|
|
4362
4365
|
}, [k]);
|
|
4363
|
-
let
|
|
4366
|
+
let ye = async (e, t) => {
|
|
4364
4367
|
if (i && !(!e && (!t || t.length === 0))) {
|
|
4365
4368
|
ee(!0);
|
|
4366
4369
|
try {
|
|
4367
|
-
let n =
|
|
4368
|
-
r(
|
|
4370
|
+
let n = de(t ?? []), a = await Promise.all(n.map(async (e) => await fe(e))), { data: s } = await U.addMessage(i.id, e, a, o?.id);
|
|
4371
|
+
r(xe({
|
|
4369
4372
|
chat: i,
|
|
4370
4373
|
message: s
|
|
4371
|
-
})), y(""), O([]), x(!1), r(
|
|
4374
|
+
})), y(""), O([]), x(!1), r(Oe(null));
|
|
4372
4375
|
} catch (e) {
|
|
4373
4376
|
console.error("Error sending message:", e);
|
|
4374
4377
|
} finally {
|
|
4375
4378
|
ee(!1);
|
|
4376
4379
|
}
|
|
4377
4380
|
}
|
|
4378
|
-
},
|
|
4381
|
+
}, V = () => {
|
|
4379
4382
|
let e = v.trim();
|
|
4380
4383
|
if (!e && D.length === 0) return;
|
|
4381
|
-
let t =
|
|
4384
|
+
let t = pe(D, d, h);
|
|
4382
4385
|
if (t) {
|
|
4383
4386
|
N(t.message, t.type);
|
|
4384
4387
|
return;
|
|
4385
4388
|
}
|
|
4386
|
-
|
|
4387
|
-
}, ye = (e) => {
|
|
4388
|
-
e.key === "Enter" && H();
|
|
4389
|
+
ye(e, D);
|
|
4389
4390
|
}, be = (e) => {
|
|
4390
|
-
|
|
4391
|
+
e.key === "Enter" && V();
|
|
4392
|
+
}, H = (e) => {
|
|
4393
|
+
let t = ie.current?.getRootNode(), n = t?.getElementById ? t.getElementById(`chat-message-${e}`) : document.getElementById(`chat-message-${e}`);
|
|
4391
4394
|
n ? (n.scrollIntoView({
|
|
4392
4395
|
behavior: "smooth",
|
|
4393
4396
|
block: "center"
|
|
@@ -4399,18 +4402,18 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4399
4402
|
D.length > 0 && /* @__PURE__ */ T("div", {
|
|
4400
4403
|
className: "selected-files-list",
|
|
4401
4404
|
children: D.map((e, t) => {
|
|
4402
|
-
let r = e.isError, i =
|
|
4405
|
+
let r = e.isError, i = ue(e);
|
|
4403
4406
|
return /* @__PURE__ */ E("div", {
|
|
4404
4407
|
className: `selected-file-item ${i ? "image-file" : "other-file"} ${r ? "error-file-item" : ""}`,
|
|
4405
4408
|
children: [i ? /* @__PURE__ */ T("img", {
|
|
4406
|
-
src:
|
|
4409
|
+
src: le(e),
|
|
4407
4410
|
alt: e.name,
|
|
4408
4411
|
className: "file-preview-image"
|
|
4409
4412
|
}) : /* @__PURE__ */ E("div", {
|
|
4410
4413
|
className: "file-content-wrapper",
|
|
4411
4414
|
children: [/* @__PURE__ */ T("span", {
|
|
4412
4415
|
className: "file-icon",
|
|
4413
|
-
children:
|
|
4416
|
+
children: F(e.name)
|
|
4414
4417
|
}), /* @__PURE__ */ E("div", {
|
|
4415
4418
|
className: "file-info",
|
|
4416
4419
|
children: [/* @__PURE__ */ T("span", {
|
|
@@ -4418,12 +4421,12 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4418
4421
|
children: e.name
|
|
4419
4422
|
}), /* @__PURE__ */ T("span", {
|
|
4420
4423
|
className: `file-size ${r ? "error-size" : ""}`,
|
|
4421
|
-
children: r ? `Vượt quá ${26214400 / (1024 * 1024)} MB` :
|
|
4424
|
+
children: r ? `Vượt quá ${26214400 / (1024 * 1024)} MB` : L(e.size)
|
|
4422
4425
|
})]
|
|
4423
4426
|
})]
|
|
4424
4427
|
}), /* @__PURE__ */ T("button", {
|
|
4425
4428
|
className: "remove-file-btn",
|
|
4426
|
-
onClick: () =>
|
|
4429
|
+
onClick: () => _e(t),
|
|
4427
4430
|
title: n("chatInput.removeFile"),
|
|
4428
4431
|
disabled: k,
|
|
4429
4432
|
style: {
|
|
@@ -4432,12 +4435,12 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4432
4435
|
},
|
|
4433
4436
|
children: "✕"
|
|
4434
4437
|
})]
|
|
4435
|
-
},
|
|
4438
|
+
}, I(e));
|
|
4436
4439
|
})
|
|
4437
4440
|
}),
|
|
4438
4441
|
o && /* @__PURE__ */ E("div", {
|
|
4439
4442
|
className: "reply-input-preview",
|
|
4440
|
-
onClick: () =>
|
|
4443
|
+
onClick: () => H(o.id),
|
|
4441
4444
|
style: { cursor: "pointer" },
|
|
4442
4445
|
children: [
|
|
4443
4446
|
/* @__PURE__ */ E("div", {
|
|
@@ -4457,13 +4460,13 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4457
4460
|
/* @__PURE__ */ T("button", {
|
|
4458
4461
|
className: "close-reply",
|
|
4459
4462
|
onClick: (e) => {
|
|
4460
|
-
e.stopPropagation(), r(
|
|
4463
|
+
e.stopPropagation(), r(Oe(null));
|
|
4461
4464
|
},
|
|
4462
4465
|
children: "✕"
|
|
4463
4466
|
}),
|
|
4464
4467
|
/* @__PURE__ */ T("div", {
|
|
4465
4468
|
className: "reply-icon",
|
|
4466
|
-
children: /* @__PURE__ */ T(
|
|
4469
|
+
children: /* @__PURE__ */ T(Ot, {})
|
|
4467
4470
|
})
|
|
4468
4471
|
]
|
|
4469
4472
|
}),
|
|
@@ -4492,7 +4495,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4492
4495
|
}), /* @__PURE__ */ T("button", {
|
|
4493
4496
|
className: "voice-control-btn stop-btn",
|
|
4494
4497
|
onClick: () => {
|
|
4495
|
-
|
|
4498
|
+
R();
|
|
4496
4499
|
},
|
|
4497
4500
|
title: n("chatInput.stopRecording"),
|
|
4498
4501
|
disabled: te,
|
|
@@ -4534,7 +4537,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4534
4537
|
}),
|
|
4535
4538
|
/* @__PURE__ */ T("button", {
|
|
4536
4539
|
className: "voice-control-btn add-btn",
|
|
4537
|
-
onClick:
|
|
4540
|
+
onClick: me,
|
|
4538
4541
|
title: n("chatInput.addToMessage"),
|
|
4539
4542
|
children: "✓"
|
|
4540
4543
|
})
|
|
@@ -4546,9 +4549,9 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4546
4549
|
children: [
|
|
4547
4550
|
b && /* @__PURE__ */ T("div", {
|
|
4548
4551
|
className: "emoji-picker",
|
|
4549
|
-
children:
|
|
4552
|
+
children: ae.map((e) => /* @__PURE__ */ T("button", {
|
|
4550
4553
|
className: "emoji-btn",
|
|
4551
|
-
onClick: () =>
|
|
4554
|
+
onClick: () => se(e),
|
|
4552
4555
|
children: e
|
|
4553
4556
|
}, e))
|
|
4554
4557
|
}),
|
|
@@ -4556,7 +4559,7 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4556
4559
|
ref: P,
|
|
4557
4560
|
type: "file",
|
|
4558
4561
|
multiple: !0,
|
|
4559
|
-
onChange:
|
|
4562
|
+
onChange: ge,
|
|
4560
4563
|
accept: m,
|
|
4561
4564
|
className: "display-none"
|
|
4562
4565
|
}),
|
|
@@ -4565,45 +4568,45 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4565
4568
|
children: [
|
|
4566
4569
|
u && /* @__PURE__ */ T("button", {
|
|
4567
4570
|
className: "action-btn",
|
|
4568
|
-
onClick: () =>
|
|
4571
|
+
onClick: () => ve(),
|
|
4569
4572
|
title: n("chatInput.selectFiles"),
|
|
4570
4573
|
disabled: k,
|
|
4571
|
-
children: /* @__PURE__ */ T(
|
|
4574
|
+
children: /* @__PURE__ */ T(kt, {})
|
|
4572
4575
|
}),
|
|
4573
4576
|
u && /* @__PURE__ */ T("button", {
|
|
4574
4577
|
className: "action-btn",
|
|
4575
|
-
onClick: () =>
|
|
4578
|
+
onClick: () => ve(),
|
|
4576
4579
|
title: n("chatInput.selectFiles"),
|
|
4577
4580
|
disabled: k,
|
|
4578
|
-
children: /* @__PURE__ */ T(
|
|
4581
|
+
children: /* @__PURE__ */ T(At, {})
|
|
4579
4582
|
}),
|
|
4580
4583
|
s && /* @__PURE__ */ T("button", {
|
|
4581
4584
|
className: "action-btn",
|
|
4582
|
-
onClick: () => void
|
|
4585
|
+
onClick: () => void ce(),
|
|
4583
4586
|
title: n("chatInput.recordVoice"),
|
|
4584
4587
|
disabled: k,
|
|
4585
|
-
children: /* @__PURE__ */ T(
|
|
4588
|
+
children: /* @__PURE__ */ T(jt, {})
|
|
4586
4589
|
}),
|
|
4587
4590
|
/* @__PURE__ */ T("button", {
|
|
4588
4591
|
className: `action-btn ${b ? "active" : ""}`,
|
|
4589
4592
|
onClick: () => x(!b),
|
|
4590
4593
|
title: "emoji",
|
|
4591
4594
|
disabled: k,
|
|
4592
|
-
children: /* @__PURE__ */ T(
|
|
4595
|
+
children: /* @__PURE__ */ T(Mt, {})
|
|
4593
4596
|
})
|
|
4594
4597
|
]
|
|
4595
4598
|
}),
|
|
4596
4599
|
/* @__PURE__ */ T("div", {
|
|
4597
4600
|
className: "chat-input-container",
|
|
4598
4601
|
children: /* @__PURE__ */ T("input", {
|
|
4599
|
-
ref:
|
|
4602
|
+
ref: ie,
|
|
4600
4603
|
type: "text",
|
|
4601
4604
|
className: "chat-input",
|
|
4602
4605
|
placeholder: n("chatInput.placeholder"),
|
|
4603
4606
|
value: v,
|
|
4604
4607
|
onChange: (e) => y(e.target.value),
|
|
4605
|
-
onKeyPress:
|
|
4606
|
-
onPaste:
|
|
4608
|
+
onKeyPress: be,
|
|
4609
|
+
onPaste: B,
|
|
4607
4610
|
disabled: k,
|
|
4608
4611
|
style: {
|
|
4609
4612
|
opacity: k ? .6 : 1,
|
|
@@ -4613,31 +4616,31 @@ var xt = Q("AddMember", /* @__PURE__ */ E(w, { children: [
|
|
|
4613
4616
|
}),
|
|
4614
4617
|
/* @__PURE__ */ T("button", {
|
|
4615
4618
|
className: "send-btn",
|
|
4616
|
-
onClick:
|
|
4619
|
+
onClick: V,
|
|
4617
4620
|
disabled: k || !v.trim() && D.length === 0,
|
|
4618
4621
|
style: {
|
|
4619
4622
|
background: k || !v.trim() && D.length === 0 ? "#d1d5db" : e ?? "#8aaeff",
|
|
4620
4623
|
opacity: k || !v.trim() && D.length === 0 ? .6 : 1,
|
|
4621
4624
|
cursor: k || !v.trim() && D.length === 0 ? "not-allowed" : "pointer"
|
|
4622
4625
|
},
|
|
4623
|
-
children: k ? "⏳" : /* @__PURE__ */ T(
|
|
4626
|
+
children: k ? "⏳" : /* @__PURE__ */ T(Nt, {})
|
|
4624
4627
|
})
|
|
4625
4628
|
]
|
|
4626
4629
|
})
|
|
4627
4630
|
] });
|
|
4628
4631
|
});
|
|
4629
|
-
|
|
4632
|
+
dn.displayName = "ChatInput";
|
|
4630
4633
|
//#endregion
|
|
4631
4634
|
//#region src/components/view/ContactList.tsx
|
|
4632
|
-
var
|
|
4635
|
+
var fn = [{
|
|
4633
4636
|
label: "A-Z",
|
|
4634
4637
|
value: "asc",
|
|
4635
|
-
icon: /* @__PURE__ */ T(
|
|
4638
|
+
icon: /* @__PURE__ */ T(Pt, {})
|
|
4636
4639
|
}, {
|
|
4637
4640
|
label: "Z-A",
|
|
4638
4641
|
value: "desc",
|
|
4639
|
-
icon: /* @__PURE__ */ T(
|
|
4640
|
-
}],
|
|
4642
|
+
icon: /* @__PURE__ */ T(Ft, {})
|
|
4643
|
+
}], pn = [
|
|
4641
4644
|
{
|
|
4642
4645
|
label: "Tất cả",
|
|
4643
4646
|
value: "all"
|
|
@@ -4650,7 +4653,7 @@ var dn = [{
|
|
|
4650
4653
|
label: "Offline",
|
|
4651
4654
|
value: "offline"
|
|
4652
4655
|
}
|
|
4653
|
-
],
|
|
4656
|
+
], mn = ({ members: e, onMessageClick: t }) => {
|
|
4654
4657
|
let [n, r] = p(""), [i, a] = p("asc"), [o, s] = p(!1), [c, l] = p("all"), [u, f] = p(!1), m = d(() => {
|
|
4655
4658
|
let t = e.filter((e) => e.name.toLowerCase().includes(n.toLowerCase()));
|
|
4656
4659
|
return c === "online" ? t = t.filter((e) => (e.socket_ids?.length ?? 0) > 0) : c === "offline" && (t = t.filter((e) => (e.socket_ids?.length ?? 0) === 0)), [...t].sort((e, t) => {
|
|
@@ -4681,7 +4684,7 @@ var dn = [{
|
|
|
4681
4684
|
alignItems: "center",
|
|
4682
4685
|
gap: "8px"
|
|
4683
4686
|
},
|
|
4684
|
-
children: [/* @__PURE__ */ T(
|
|
4687
|
+
children: [/* @__PURE__ */ T(st, {}), /* @__PURE__ */ T("div", { children: "Danh sách thành viên" })]
|
|
4685
4688
|
})
|
|
4686
4689
|
}),
|
|
4687
4690
|
/* @__PURE__ */ E("div", {
|
|
@@ -4690,7 +4693,7 @@ var dn = [{
|
|
|
4690
4693
|
children: [/* @__PURE__ */ E("div", {
|
|
4691
4694
|
className: "toolbar-search",
|
|
4692
4695
|
style: { flex: 1 },
|
|
4693
|
-
children: [/* @__PURE__ */ T(
|
|
4696
|
+
children: [/* @__PURE__ */ T(gt, { strokeColor: "#94a3b8" }), /* @__PURE__ */ T("input", {
|
|
4694
4697
|
type: "text",
|
|
4695
4698
|
placeholder: "Tìm bạn",
|
|
4696
4699
|
value: n,
|
|
@@ -4706,10 +4709,10 @@ var dn = [{
|
|
|
4706
4709
|
style: { position: "relative" },
|
|
4707
4710
|
children: [
|
|
4708
4711
|
/* @__PURE__ */ T("span", { children: i === "asc" ? "Tên (A-Z)" : "Tên (Z-A)" }),
|
|
4709
|
-
/* @__PURE__ */ T(
|
|
4712
|
+
/* @__PURE__ */ T(Ct, {}),
|
|
4710
4713
|
o && /* @__PURE__ */ T("div", {
|
|
4711
4714
|
className: "dropdown-select",
|
|
4712
|
-
children:
|
|
4715
|
+
children: fn.map((e) => /* @__PURE__ */ E("div", {
|
|
4713
4716
|
onClick: () => {
|
|
4714
4717
|
a(e.value), s(!1);
|
|
4715
4718
|
},
|
|
@@ -4725,11 +4728,11 @@ var dn = [{
|
|
|
4725
4728
|
},
|
|
4726
4729
|
style: { position: "relative" },
|
|
4727
4730
|
children: [
|
|
4728
|
-
/* @__PURE__ */ T("span", { children:
|
|
4729
|
-
/* @__PURE__ */ T(
|
|
4731
|
+
/* @__PURE__ */ T("span", { children: pn.find((e) => e.value === c)?.label }),
|
|
4732
|
+
/* @__PURE__ */ T(Ct, {}),
|
|
4730
4733
|
u && /* @__PURE__ */ T("div", {
|
|
4731
4734
|
className: "dropdown-select",
|
|
4732
|
-
children:
|
|
4735
|
+
children: pn.map((e) => /* @__PURE__ */ T("div", {
|
|
4733
4736
|
onClick: () => {
|
|
4734
4737
|
l(e.value), f(!1);
|
|
4735
4738
|
},
|
|
@@ -4796,7 +4799,7 @@ var dn = [{
|
|
|
4796
4799
|
border: "none",
|
|
4797
4800
|
background: "transparent"
|
|
4798
4801
|
},
|
|
4799
|
-
children: /* @__PURE__ */ T(
|
|
4802
|
+
children: /* @__PURE__ */ T(ot, { size: 16 })
|
|
4800
4803
|
}), /* @__PURE__ */ T("button", {
|
|
4801
4804
|
className: "contact-action-btn",
|
|
4802
4805
|
style: {
|
|
@@ -4804,7 +4807,7 @@ var dn = [{
|
|
|
4804
4807
|
background: "transparent"
|
|
4805
4808
|
},
|
|
4806
4809
|
onClick: () => t(String(e.id)),
|
|
4807
|
-
children: /* @__PURE__ */ T(
|
|
4810
|
+
children: /* @__PURE__ */ T(pt, { size: 16 })
|
|
4808
4811
|
})]
|
|
4809
4812
|
})]
|
|
4810
4813
|
}, e.id))]
|
|
@@ -4813,7 +4816,7 @@ var dn = [{
|
|
|
4813
4816
|
})
|
|
4814
4817
|
]
|
|
4815
4818
|
});
|
|
4816
|
-
},
|
|
4819
|
+
}, hn = ({ groups: e, onGroupClick: t, currentUserId: n }) => {
|
|
4817
4820
|
let [r, i] = p(""), a = d(() => e.filter((e) => e.name?.toLowerCase().includes(r.toLowerCase())), [e, r]);
|
|
4818
4821
|
return /* @__PURE__ */ E("div", {
|
|
4819
4822
|
className: "contact-list-view",
|
|
@@ -4826,7 +4829,7 @@ var dn = [{
|
|
|
4826
4829
|
alignItems: "center",
|
|
4827
4830
|
gap: "8px"
|
|
4828
4831
|
},
|
|
4829
|
-
children: [/* @__PURE__ */ T(
|
|
4832
|
+
children: [/* @__PURE__ */ T(st, {}), /* @__PURE__ */ T("div", { children: "Danh sách nhóm và cộng đồng" })]
|
|
4830
4833
|
})
|
|
4831
4834
|
}),
|
|
4832
4835
|
/* @__PURE__ */ T("div", {
|
|
@@ -4835,7 +4838,7 @@ var dn = [{
|
|
|
4835
4838
|
children: /* @__PURE__ */ E("div", {
|
|
4836
4839
|
className: "toolbar-search",
|
|
4837
4840
|
style: { flex: 1 },
|
|
4838
|
-
children: [/* @__PURE__ */ T(
|
|
4841
|
+
children: [/* @__PURE__ */ T(gt, { strokeColor: "#94a3b8" }), /* @__PURE__ */ T("input", {
|
|
4839
4842
|
type: "text",
|
|
4840
4843
|
placeholder: "Tìm nhóm",
|
|
4841
4844
|
value: r,
|
|
@@ -4856,7 +4859,7 @@ var dn = [{
|
|
|
4856
4859
|
className: "contact-item-left",
|
|
4857
4860
|
children: [/* @__PURE__ */ T("div", {
|
|
4858
4861
|
className: "contact-avatar",
|
|
4859
|
-
children: /* @__PURE__ */ T(
|
|
4862
|
+
children: /* @__PURE__ */ T(Wt, {
|
|
4860
4863
|
chat: e,
|
|
4861
4864
|
currentUserId: n
|
|
4862
4865
|
})
|
|
@@ -4876,7 +4879,7 @@ var dn = [{
|
|
|
4876
4879
|
})
|
|
4877
4880
|
]
|
|
4878
4881
|
});
|
|
4879
|
-
},
|
|
4882
|
+
}, gn = ({ file: e, children: t, className: n = "file-item", isLink: r = !1, handleImageClick: i }) => {
|
|
4880
4883
|
let a = {
|
|
4881
4884
|
className: n,
|
|
4882
4885
|
role: "button",
|
|
@@ -4896,9 +4899,9 @@ var dn = [{
|
|
|
4896
4899
|
...a,
|
|
4897
4900
|
children: t
|
|
4898
4901
|
});
|
|
4899
|
-
},
|
|
4902
|
+
}, _n = ({ file: e }) => /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("span", {
|
|
4900
4903
|
className: "file-icon",
|
|
4901
|
-
children:
|
|
4904
|
+
children: F(e.ext)
|
|
4902
4905
|
}), /* @__PURE__ */ E("div", {
|
|
4903
4906
|
className: "file-info",
|
|
4904
4907
|
children: [/* @__PURE__ */ T("div", {
|
|
@@ -4906,13 +4909,13 @@ var dn = [{
|
|
|
4906
4909
|
children: e.name
|
|
4907
4910
|
}), /* @__PURE__ */ T("div", {
|
|
4908
4911
|
className: "file-size",
|
|
4909
|
-
children:
|
|
4912
|
+
children: L(e.size)
|
|
4910
4913
|
})]
|
|
4911
|
-
})] }),
|
|
4912
|
-
let { openViewer: t } =
|
|
4914
|
+
})] }), vn = ({ files: e }) => {
|
|
4915
|
+
let { openViewer: t } = Je();
|
|
4913
4916
|
if (!e || e.length === 0) return null;
|
|
4914
4917
|
let n = e.filter((e) => {
|
|
4915
|
-
let t =
|
|
4918
|
+
let t = ce(e.name);
|
|
4916
4919
|
return [
|
|
4917
4920
|
"image",
|
|
4918
4921
|
"video",
|
|
@@ -4923,8 +4926,8 @@ var dn = [{
|
|
|
4923
4926
|
let r = e.findIndex((e) => e.id === n);
|
|
4924
4927
|
r !== -1 && t(e, r);
|
|
4925
4928
|
}, s = (e) => {
|
|
4926
|
-
switch (
|
|
4927
|
-
case "image": return r.includes(e) ? /* @__PURE__ */ E(
|
|
4929
|
+
switch (ce(e.name)) {
|
|
4930
|
+
case "image": return r.includes(e) ? /* @__PURE__ */ E(gn, {
|
|
4928
4931
|
file: e,
|
|
4929
4932
|
className: "file-image-wrapper",
|
|
4930
4933
|
handleImageClick: o,
|
|
@@ -4940,7 +4943,7 @@ var dn = [{
|
|
|
4940
4943
|
})
|
|
4941
4944
|
})]
|
|
4942
4945
|
}, e.id) : null;
|
|
4943
|
-
case "video": return /* @__PURE__ */ E(
|
|
4946
|
+
case "video": return /* @__PURE__ */ E(gn, {
|
|
4944
4947
|
file: e,
|
|
4945
4948
|
className: "file-image-wrapper",
|
|
4946
4949
|
handleImageClick: o,
|
|
@@ -4958,16 +4961,16 @@ var dn = [{
|
|
|
4958
4961
|
})]
|
|
4959
4962
|
}, e.id);
|
|
4960
4963
|
case "pdf":
|
|
4961
|
-
case "audio": return /* @__PURE__ */ T(
|
|
4964
|
+
case "audio": return /* @__PURE__ */ T(gn, {
|
|
4962
4965
|
file: e,
|
|
4963
4966
|
handleImageClick: o,
|
|
4964
|
-
children: /* @__PURE__ */ T(
|
|
4967
|
+
children: /* @__PURE__ */ T(_n, { file: e })
|
|
4965
4968
|
}, e.id);
|
|
4966
|
-
default: return /* @__PURE__ */ T(
|
|
4969
|
+
default: return /* @__PURE__ */ T(gn, {
|
|
4967
4970
|
file: e,
|
|
4968
4971
|
isLink: !0,
|
|
4969
4972
|
handleImageClick: o,
|
|
4970
|
-
children: /* @__PURE__ */ T(
|
|
4973
|
+
children: /* @__PURE__ */ T(_n, { file: e })
|
|
4971
4974
|
}, e.id);
|
|
4972
4975
|
}
|
|
4973
4976
|
};
|
|
@@ -4975,13 +4978,13 @@ var dn = [{
|
|
|
4975
4978
|
className: "message-files",
|
|
4976
4979
|
children: e.map((e) => s(e))
|
|
4977
4980
|
});
|
|
4978
|
-
},
|
|
4979
|
-
let { currentUser: t, currentChat: n, currentChatMessages: r } = _((e) => e.chat), { allowDeleteMessage: i, allowRevokeMessage: a } = _(
|
|
4981
|
+
}, yn = ({ message: e }) => {
|
|
4982
|
+
let { currentUser: t, currentChat: n, currentChatMessages: r } = _((e) => e.chat), { allowDeleteMessage: i, allowRevokeMessage: a } = _(He), o = g(), { t: s } = Z(), c = e.member.code === t?.code, [l, u] = p(!1), f = new Date(e.created_at).toLocaleTimeString([], {
|
|
4980
4983
|
hour: "2-digit",
|
|
4981
4984
|
minute: "2-digit"
|
|
4982
4985
|
}), m = async (t) => {
|
|
4983
4986
|
if (n) try {
|
|
4984
|
-
await
|
|
4987
|
+
await U.actionMessage(n.id, e.id, t);
|
|
4985
4988
|
} catch (e) {
|
|
4986
4989
|
console.error("Lỗi khi tương tác tin nhắn:", e), alert("Thao tác không thành công, vui lòng thử lại!");
|
|
4987
4990
|
}
|
|
@@ -5043,50 +5046,50 @@ var dn = [{
|
|
|
5043
5046
|
className: "action-icon",
|
|
5044
5047
|
title: s("chatMessage.actions.like"),
|
|
5045
5048
|
onClick: () => void m("like"),
|
|
5046
|
-
children: /* @__PURE__ */ T(
|
|
5049
|
+
children: /* @__PURE__ */ T(It, {})
|
|
5047
5050
|
}),
|
|
5048
5051
|
/* @__PURE__ */ T("button", {
|
|
5049
5052
|
className: "action-icon",
|
|
5050
5053
|
title: s("chatMessage.actions.love"),
|
|
5051
5054
|
onClick: () => void m("love"),
|
|
5052
|
-
children: /* @__PURE__ */ T(
|
|
5055
|
+
children: /* @__PURE__ */ T(Lt, {})
|
|
5053
5056
|
}),
|
|
5054
5057
|
/* @__PURE__ */ T("button", {
|
|
5055
5058
|
className: "action-icon",
|
|
5056
5059
|
title: s("chatMessage.actions.reply"),
|
|
5057
|
-
onClick: () => o(
|
|
5058
|
-
children: /* @__PURE__ */ T(
|
|
5060
|
+
onClick: () => o(Oe(e)),
|
|
5061
|
+
children: /* @__PURE__ */ T(Ot, {})
|
|
5059
5062
|
}),
|
|
5060
5063
|
i(e.created_at) && /* @__PURE__ */ T("button", {
|
|
5061
5064
|
className: "action-icon",
|
|
5062
5065
|
title: s("chatMessage.actions.delete"),
|
|
5063
5066
|
onClick: () => void m("remove"),
|
|
5064
|
-
children: /* @__PURE__ */ T(
|
|
5067
|
+
children: /* @__PURE__ */ T(Rt, {})
|
|
5065
5068
|
}),
|
|
5066
5069
|
a(e.created_at) && /* @__PURE__ */ T("button", {
|
|
5067
5070
|
className: "action-icon",
|
|
5068
5071
|
title: s("chatMessage.actions.revoke"),
|
|
5069
5072
|
onClick: () => void m("revoke"),
|
|
5070
|
-
children: /* @__PURE__ */ T(
|
|
5073
|
+
children: /* @__PURE__ */ T(zt, {})
|
|
5071
5074
|
})
|
|
5072
5075
|
] }) : /* @__PURE__ */ E(w, { children: [
|
|
5073
5076
|
/* @__PURE__ */ T("button", {
|
|
5074
5077
|
className: "action-icon",
|
|
5075
5078
|
title: s("chatMessage.actions.reply"),
|
|
5076
|
-
onClick: () => o(
|
|
5077
|
-
children: /* @__PURE__ */ T(
|
|
5079
|
+
onClick: () => o(Oe(e)),
|
|
5080
|
+
children: /* @__PURE__ */ T(Ot, {})
|
|
5078
5081
|
}),
|
|
5079
5082
|
/* @__PURE__ */ T("button", {
|
|
5080
5083
|
className: "action-icon",
|
|
5081
5084
|
title: s("chatMessage.actions.like"),
|
|
5082
5085
|
onClick: () => void m("like"),
|
|
5083
|
-
children: /* @__PURE__ */ T(
|
|
5086
|
+
children: /* @__PURE__ */ T(It, {})
|
|
5084
5087
|
}),
|
|
5085
5088
|
/* @__PURE__ */ T("button", {
|
|
5086
5089
|
className: "action-icon",
|
|
5087
5090
|
title: s("chatMessage.actions.love"),
|
|
5088
5091
|
onClick: () => void m("love"),
|
|
5089
|
-
children: /* @__PURE__ */ T(
|
|
5092
|
+
children: /* @__PURE__ */ T(Lt, {})
|
|
5090
5093
|
})
|
|
5091
5094
|
] })
|
|
5092
5095
|
}),
|
|
@@ -5120,7 +5123,7 @@ var dn = [{
|
|
|
5120
5123
|
})] })
|
|
5121
5124
|
})]
|
|
5122
5125
|
}) : null,
|
|
5123
|
-
/* @__PURE__ */ T(
|
|
5126
|
+
/* @__PURE__ */ T(vn, { files: e.files }),
|
|
5124
5127
|
e.action && (e.action.like > 0 || e.action.love > 0) && /* @__PURE__ */ E("div", {
|
|
5125
5128
|
className: "message-reactions-badge",
|
|
5126
5129
|
children: [e.action.like > 0 && /* @__PURE__ */ T("span", { children: "👍" }), e.action.love > 0 && /* @__PURE__ */ T("span", { children: "♥️" })]
|
|
@@ -5131,21 +5134,21 @@ var dn = [{
|
|
|
5131
5134
|
className: "message-time",
|
|
5132
5135
|
children: [f, c && (b || x) && /* @__PURE__ */ T("span", {
|
|
5133
5136
|
className: `message-item-status ${b ? "seen" : ""}`,
|
|
5134
|
-
children: b ? /* @__PURE__ */ T(
|
|
5137
|
+
children: b ? /* @__PURE__ */ T(Bt, { style: { marginBottom: "-2px" } }) : `• ${s("chatMessage.status.sent")}`
|
|
5135
5138
|
})]
|
|
5136
5139
|
})
|
|
5137
5140
|
]
|
|
5138
5141
|
})]
|
|
5139
5142
|
});
|
|
5140
|
-
},
|
|
5143
|
+
}, bn = () => {
|
|
5141
5144
|
let { currentChat: t, currentChatMessages: n, messagesPagination: r, currentUser: i } = _((e) => e.chat), o = g(), s = f(null), l = f(null), u = f(null), [d, m] = p(!1), [h, v] = p(!1), [y, b] = p(!1), x = f(null), S = f(!1);
|
|
5142
5145
|
c(() => {
|
|
5143
5146
|
(async () => {
|
|
5144
5147
|
if (t && x.current !== Number(t.id)) {
|
|
5145
5148
|
x.current = Number(t.id);
|
|
5146
5149
|
try {
|
|
5147
|
-
let e =
|
|
5148
|
-
r?.data && (o(
|
|
5150
|
+
let e = U.getMessages(t.id, 20, 1), n = t.type === "group" ? U.getMembers(t.id).then((e) => e.data ?? []) : Promise.resolve(t.members ?? []), [r, i] = await Promise.all([e, n]);
|
|
5151
|
+
r?.data && (o(ge(r.data)), o(be(r.pagination)), o(_e(i)));
|
|
5149
5152
|
} catch (e) {
|
|
5150
5153
|
console.error("Lỗi khi tải tin nhắn:", e), x.current = null;
|
|
5151
5154
|
}
|
|
@@ -5158,7 +5161,7 @@ var dn = [{
|
|
|
5158
5161
|
]), c(() => {
|
|
5159
5162
|
if (t && n.length > 0) {
|
|
5160
5163
|
let e = n[0], r = t.new?.[i?.id ?? 0] > 0;
|
|
5161
|
-
e.member.code !== i?.code && r &&
|
|
5164
|
+
e.member.code !== i?.code && r && U.readChat(t.id);
|
|
5162
5165
|
}
|
|
5163
5166
|
}, [
|
|
5164
5167
|
t,
|
|
@@ -5171,8 +5174,8 @@ var dn = [{
|
|
|
5171
5174
|
if (v(i > 300), i < 10 && b(!1), Math.abs(n.scrollTop) + n.clientHeight >= n.scrollHeight - 1 && !d && !S.current && r && r.current_page < r.total_pages) {
|
|
5172
5175
|
S.current = !0, m(!0);
|
|
5173
5176
|
try {
|
|
5174
|
-
let e = r.current_page + 1, n = await
|
|
5175
|
-
n.data && (o(
|
|
5177
|
+
let e = r.current_page + 1, n = await U.getMessages(Number(t?.id), 20, e);
|
|
5178
|
+
n.data && (o(H(n.data)), o(be(n.pagination)));
|
|
5176
5179
|
} catch (e) {
|
|
5177
5180
|
console.error("Load more error", e);
|
|
5178
5181
|
} finally {
|
|
@@ -5221,7 +5224,7 @@ var dn = [{
|
|
|
5221
5224
|
},
|
|
5222
5225
|
children: n.map((t, r) => {
|
|
5223
5226
|
let i = new Date(t.created_at).toDateString(), a = n[r + 1], o = i !== (a ? new Date(a.created_at).toDateString() : null);
|
|
5224
|
-
return /* @__PURE__ */ E(e, { children: [/* @__PURE__ */ T(
|
|
5227
|
+
return /* @__PURE__ */ E(e, { children: [/* @__PURE__ */ T(yn, { message: t }), o && /* @__PURE__ */ T("div", {
|
|
5225
5228
|
className: "chat-date-divider",
|
|
5226
5229
|
children: /* @__PURE__ */ T("span", { children: N(t.created_at) })
|
|
5227
5230
|
})] }, t.id);
|
|
@@ -5235,9 +5238,9 @@ var dn = [{
|
|
|
5235
5238
|
};
|
|
5236
5239
|
//#endregion
|
|
5237
5240
|
//#region src/index.ts
|
|
5238
|
-
function
|
|
5241
|
+
function xn(e) {
|
|
5239
5242
|
let t = document.createElement("div");
|
|
5240
|
-
t.id = "chatbot-widget-umd-root", document.body.appendChild(t), m(t).render(n(
|
|
5243
|
+
t.id = "chatbot-widget-umd-root", document.body.appendChild(t), m(t).render(n(tt, e));
|
|
5241
5244
|
}
|
|
5242
5245
|
//#endregion
|
|
5243
|
-
export {
|
|
5246
|
+
export { tt as ChatWidget, xn as init };
|