@elia-assistant/chatui 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chat-store.js +10 -0
- package/dist/chatui.css +1 -1
- package/dist/chatui.iife.css +1 -1
- package/dist/chatui.iife.js +9 -9
- package/dist/chunks/{i18n-B0xhVAye.js → i18n-CGlsSoQa.js} +3 -3
- package/dist/chunks/i18n-CgST8dWz.js +2 -0
- package/dist/chunks/settingsStore-Bqlj_GzJ.js +134 -0
- package/dist/chunks/{translation-CsXAAc6O.js → translation-BHOB8oBB.js} +8 -2
- package/dist/chunks/{translation-D0S7F5mA.js → translation-KDPjplc7.js} +8 -2
- package/dist/components/InputArea.d.ts +2 -1
- package/dist/hooks/useChat.d.ts +2 -1
- package/dist/hooks/useCta.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +423 -206
- package/dist/lib/n8nClient.d.ts +2 -2
- package/dist/store/chatStore.d.ts +5 -0
- package/dist/store.js +1 -1
- package/dist/types/index.d.ts +10 -16
- package/package.json +1 -1
- package/dist/chunks/i18n-23dPrR-0.js +0 -2
- package/dist/chunks/settingsStore-CpRkCJCy.js +0 -254
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as e, i as t, n, r } from "./chunks/i18n-
|
|
2
|
-
import { n as i, r as a, t as o } from "./chunks/settingsStore-
|
|
1
|
+
import { a as e, i as t, n, r } from "./chunks/i18n-CGlsSoQa.js";
|
|
2
|
+
import { n as i, r as a, t as o } from "./chunks/settingsStore-Bqlj_GzJ.js";
|
|
3
3
|
import { useChatStore as s } from "./chat-store.js";
|
|
4
4
|
import { Children as c, Fragment as l, cloneElement as u, createContext as d, createElement as f, isValidElement as p, useCallback as m, useContext as h, useEffect as g, useMemo as _, useRef as v, useState as y, useSyncExternalStore as b } from "react";
|
|
5
5
|
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
@@ -532,25 +532,25 @@ function Re(e, t, n) {
|
|
|
532
532
|
//#endregion
|
|
533
533
|
//#region src/hooks/useAgentStream.ts
|
|
534
534
|
function ze() {
|
|
535
|
-
let e = o((e) => e.config), t = s((e) => e.activeSessionId), n = s((e) => e.addMessage), r = s((e) => e.setAwaitingAgentReply);
|
|
535
|
+
let e = o((e) => e.config), t = s((e) => e.activeSessionId), n = s((e) => e.addMessage), r = s((e) => e.setAwaitingAgentReply), i = s((e) => e.setToken);
|
|
536
536
|
g(() => {
|
|
537
|
-
let
|
|
538
|
-
if (!
|
|
539
|
-
let
|
|
537
|
+
let a = e.agentStream;
|
|
538
|
+
if (!a || !a.apiBaseUrl || !a.tenantId || !t) return;
|
|
539
|
+
let o = !1, s = null;
|
|
540
540
|
return (async () => {
|
|
541
541
|
try {
|
|
542
|
-
let e = await fetch(`${
|
|
542
|
+
let e = await fetch(`${a.apiBaseUrl.replace(/\/$/, "")}/api/public/chat-stream/init`, {
|
|
543
543
|
method: "POST",
|
|
544
544
|
headers: { "Content-Type": "application/json" },
|
|
545
545
|
body: JSON.stringify({
|
|
546
|
-
tenantId:
|
|
546
|
+
tenantId: a.tenantId,
|
|
547
547
|
sessionId: t
|
|
548
548
|
})
|
|
549
549
|
});
|
|
550
550
|
if (!e.ok) return;
|
|
551
|
-
let
|
|
552
|
-
if (
|
|
553
|
-
|
|
551
|
+
let c = await e.json();
|
|
552
|
+
if (o) return;
|
|
553
|
+
i(t, c.token, Date.parse(c.expiresAt) || Date.now() + 36e5), s = new EventSource(c.streamUrl), s.addEventListener("agentReply", (e) => {
|
|
554
554
|
let i;
|
|
555
555
|
try {
|
|
556
556
|
i = JSON.parse(e.data);
|
|
@@ -563,10 +563,10 @@ function ze() {
|
|
|
563
563
|
content: i.body,
|
|
564
564
|
ts: Date.parse(i.createdAt) || Date.now()
|
|
565
565
|
}), r(t, !1);
|
|
566
|
-
}),
|
|
566
|
+
}), s.onerror = () => {};
|
|
567
567
|
} catch {}
|
|
568
568
|
})(), () => {
|
|
569
|
-
|
|
569
|
+
o = !0, s?.close();
|
|
570
570
|
};
|
|
571
571
|
}, [
|
|
572
572
|
e.agentStream,
|
|
@@ -691,27 +691,28 @@ var Ve = class extends Error {
|
|
|
691
691
|
super(e), this.name = "N8nApiError", this.status = t, this.retryable = n;
|
|
692
692
|
}
|
|
693
693
|
}, He = 2, Ue = [500, 1500];
|
|
694
|
-
async function We(e, t, n, r, i) {
|
|
695
|
-
let
|
|
694
|
+
async function We(e, t, n, r, i, a) {
|
|
695
|
+
let o = e.chatInputKey ?? "chatInput", s = e.chatSessionKey ?? "sessionId", c = e.webhookConfig?.method ?? "POST", l = {
|
|
696
696
|
"Content-Type": "application/json",
|
|
697
697
|
...e.webhookConfig?.headers
|
|
698
|
-
},
|
|
699
|
-
[
|
|
700
|
-
[
|
|
698
|
+
}, u = {
|
|
699
|
+
[o]: n,
|
|
700
|
+
[s]: t,
|
|
701
701
|
...r ? { language: r } : {},
|
|
702
|
+
...i && i.length > 0 ? { attachments: i } : {},
|
|
702
703
|
...e.metadata
|
|
703
|
-
},
|
|
704
|
-
|
|
705
|
-
let
|
|
704
|
+
}, d = e.streaming && a !== void 0;
|
|
705
|
+
d && (l.Accept = "text/event-stream");
|
|
706
|
+
let f;
|
|
706
707
|
for (let t = 0; t <= He; t++) {
|
|
707
|
-
t > 0 && await qe((
|
|
708
|
+
t > 0 && await qe((f instanceof Ve && f.status === 429 ? Ke(f) : null) ?? Ue[t - 1] ?? 4e3);
|
|
708
709
|
try {
|
|
709
710
|
let t;
|
|
710
711
|
try {
|
|
711
712
|
t = await fetch(e.webhookUrl, {
|
|
712
|
-
method:
|
|
713
|
-
headers:
|
|
714
|
-
body:
|
|
713
|
+
method: c,
|
|
714
|
+
headers: l,
|
|
715
|
+
body: c === "GET" ? void 0 : JSON.stringify(u)
|
|
715
716
|
});
|
|
716
717
|
} catch (e) {
|
|
717
718
|
throw new Ve(`Network error: ${e instanceof Error ? e.message : String(e)}`, void 0, !0);
|
|
@@ -720,7 +721,7 @@ async function We(e, t, n, r, i) {
|
|
|
720
721
|
let e = Ge(t.status), n = t.headers.get("Retry-After"), r = new Ve(`Webhook returned ${t.status}`, t.status, e);
|
|
721
722
|
throw n && (r.retryAfter = n), r;
|
|
722
723
|
}
|
|
723
|
-
if (
|
|
724
|
+
if (d && t.body) return await Je(t.body, a);
|
|
724
725
|
let n = await t.text();
|
|
725
726
|
if (!n) return "";
|
|
726
727
|
try {
|
|
@@ -730,10 +731,10 @@ async function We(e, t, n, r, i) {
|
|
|
730
731
|
return "";
|
|
731
732
|
}
|
|
732
733
|
} catch (e) {
|
|
733
|
-
if (
|
|
734
|
+
if (f = e, !(e instanceof Ve && e.retryable) || t === He) throw e;
|
|
734
735
|
}
|
|
735
736
|
}
|
|
736
|
-
throw
|
|
737
|
+
throw f;
|
|
737
738
|
}
|
|
738
739
|
function Ge(e) {
|
|
739
740
|
return e === 408 || e === 429 || e === 502 || e === 503 || e === 504;
|
|
@@ -774,7 +775,7 @@ function Ye() {
|
|
|
774
775
|
return Math.random().toString(36).slice(2) + Date.now().toString(36);
|
|
775
776
|
}
|
|
776
777
|
function Xe() {
|
|
777
|
-
let { activeSessionId: e, addMessage: t, appendToLastBot: n, removeLastBotIfEmpty: r, setStreaming: i, setAwaitingAgentReply: a, updateMessageStatus: c, createSession: l } = s(), u = o((e) => e.config), d = o((e) => e.language), f = s((e) => e.isStreaming), p = m(async (e, o, l) => {
|
|
778
|
+
let { activeSessionId: e, addMessage: t, appendToLastBot: n, removeLastBotIfEmpty: r, setStreaming: i, setAwaitingAgentReply: a, updateMessageStatus: c, createSession: l } = s(), u = o((e) => e.config), d = o((e) => e.language), f = s((e) => e.isStreaming), p = m(async (e, o, l, f) => {
|
|
778
779
|
c(l, o, "sending"), i(!0), t(l, {
|
|
779
780
|
id: Ye(),
|
|
780
781
|
role: "bot",
|
|
@@ -782,11 +783,11 @@ function Xe() {
|
|
|
782
783
|
ts: Date.now()
|
|
783
784
|
});
|
|
784
785
|
try {
|
|
785
|
-
if (u.streaming) await We(u, l, e, d, (e) => {
|
|
786
|
+
if (u.streaming) await We(u, l, e, d, f, (e) => {
|
|
786
787
|
n(l, e);
|
|
787
788
|
});
|
|
788
789
|
else {
|
|
789
|
-
let t = await We(u, l, e, d);
|
|
790
|
+
let t = await We(u, l, e, d, f);
|
|
790
791
|
t && n(l, t);
|
|
791
792
|
}
|
|
792
793
|
let t = s.getState().messages[l]?.slice(-1)[0];
|
|
@@ -807,16 +808,18 @@ function Xe() {
|
|
|
807
808
|
c
|
|
808
809
|
]);
|
|
809
810
|
return {
|
|
810
|
-
send: m(async (n) => {
|
|
811
|
-
|
|
812
|
-
|
|
811
|
+
send: m(async (n, r) => {
|
|
812
|
+
let i = r && r.length > 0;
|
|
813
|
+
if (!u.webhookUrl || !n.trim() && !i) return;
|
|
814
|
+
let a = e ?? l(), o = n.trim(), s = {
|
|
813
815
|
id: Ye(),
|
|
814
816
|
role: "user",
|
|
815
|
-
content:
|
|
817
|
+
content: o,
|
|
816
818
|
ts: Date.now(),
|
|
817
|
-
status: "sending"
|
|
819
|
+
status: "sending",
|
|
820
|
+
attachments: r
|
|
818
821
|
};
|
|
819
|
-
t(
|
|
822
|
+
t(a, s), await p(o, s.id, a, r);
|
|
820
823
|
}, [
|
|
821
824
|
u.webhookUrl,
|
|
822
825
|
e,
|
|
@@ -828,7 +831,7 @@ function Xe() {
|
|
|
828
831
|
let t = s.getState(), n = t.activeSessionId;
|
|
829
832
|
if (!n) return;
|
|
830
833
|
let r = t.messages[n]?.find((t) => t.id === e);
|
|
831
|
-
!r || r.role !== "user" || r.status !== "failed" || u.webhookUrl && await p(r.content, e, n);
|
|
834
|
+
!r || r.role !== "user" || r.status !== "failed" || u.webhookUrl && await p(r.content, e, n, r.attachments);
|
|
832
835
|
}, [u.webhookUrl, p]),
|
|
833
836
|
isStreaming: f
|
|
834
837
|
};
|
|
@@ -8409,7 +8412,8 @@ var wu = {
|
|
|
8409
8412
|
samuel: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2096%2096'%20width='96'%20height='96'%3e%3cdefs%3e%3cclipPath%20id='c'%3e%3ccircle%20cx='48'%20cy='48'%20r='48'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23c)'%3e%3crect%20width='96'%20height='96'%20fill='%23DCE4D1'/%3e%3ccircle%20cx='68'%20cy='24'%20r='42'%20fill='%23fff'%20opacity='0.08'/%3e%3ccircle%20cx='24'%20cy='82'%20r='36'%20fill='%23000'%20opacity='0.045'/%3e%3c/g%3e%3cg%20clip-path='url(%23c)'%3e%3cpath%20d='M38%2072%20Q38%2080%2048%2080%20Q58%2080%2058%2072%20L58%2068%20L38%2068%20Z'%20fill='%233D2413'/%3e%3cpath%20d='M8%2096%20C%208%2076,%2024%2068,%2034%2068%20L%2062%2068%20C%2072%2068,%2088%2076,%2088%2096%20Z'%20fill='%238A6A2C'/%3e%3cpath%20d='M40%2068%20L48%2074%20L56%2068%20Z'%20fill='rgba(0,0,0,0.12)'/%3e%3cpath%20d='M48%2017%20C%2032%2017,%2025%2029,%2025%2044%20C%2025%2059,%2033%2073,%2048%2073%20C%2063%2073,%2071%2059,%2071%2044%20C%2071%2029,%2064%2017,%2048%2017%20Z'%20fill='%2355341E'/%3e%3cpath%20d='M48%2017%20C%2063%2017,%2071%2029,%2071%2044%20C%2071%2059,%2063%2073,%2048%2073%20Z'%20fill='%233D2413'%20opacity='0.55'/%3e%3cellipse%20cx='26'%20cy='46'%20rx='3'%20ry='5'%20fill='%233D2413'/%3e%3cellipse%20cx='70'%20cy='46'%20rx='3'%20ry='5'%20fill='%233D2413'/%3e%3cpath%20d='M28%2040%20C%2028%2024,%2036%2016,%2048%2016%20C%2060%2016,%2068%2024,%2068%2040%20C%2066%2034,%2058%2030,%2048%2030%20C%2038%2030,%2030%2034,%2028%2040%20Z'%20fill='%236A6259'/%3e%3cpath%20d='M30%2028%20C%2040%2034,%2056%2034,%2066%2028%20C%2062%2022,%2055%2020,%2048%2020%20C%2041%2020,%2034%2022,%2030%2028%20Z'%20fill='%234F4841'%20opacity='0.45'/%3e%3cpath%20d='M36%2041%20q4%20-2%208%200'%20stroke='%234F4841'%20stroke-width='1.6'%20stroke-linecap='round'%20fill='none'/%3e%3cpath%20d='M52%2041%20q4%20-2%208%200'%20stroke='%234F4841'%20stroke-width='1.6'%20stroke-linecap='round'%20fill='none'/%3e%3cpath%20d='M37%2046%20q3%20-3%206%200%20q-3%203%20-6%200%20Z'%20fill='%232A1F18'/%3e%3cpath%20d='M53%2046%20q3%20-3%206%200%20q-3%203%20-6%200%20Z'%20fill='%232A1F18'/%3e%3ccircle%20cx='41.4'%20cy='45.4'%20r='0.6'%20fill='%23fff'/%3e%3ccircle%20cx='57.4'%20cy='45.4'%20r='0.6'%20fill='%23fff'/%3e%3cpath%20d='M46.5%2051%20q1.5%201.5%203%200'%20stroke='%233D2413'%20stroke-width='1.2'%20stroke-linecap='round'%20fill='none'%20opacity='0.8'/%3e%3cellipse%20cx='34'%20cy='54'%20rx='4'%20ry='2.2'%20fill='rgba(210,120,110,0.22)'/%3e%3cellipse%20cx='62'%20cy='54'%20rx='4'%20ry='2.2'%20fill='rgba(210,120,110,0.22)'/%3e%3cpath%20d='M44%2058%20q4%202%208%200'%20stroke='%23B56A5A'%20stroke-width='1.6'%20stroke-linecap='round'%20fill='none'/%3e%3cpath%20d='M34%2050%20q1%201%202%200'%20stroke='%233D2413'%20stroke-width='0.8'%20stroke-linecap='round'%20fill='none'%20opacity='0.8'/%3e%3cpath%20d='M60%2050%20q1%201%202%200'%20stroke='%233D2413'%20stroke-width='0.8'%20stroke-linecap='round'%20fill='none'%20opacity='0.8'/%3e%3cpath%20d='M41%2062%20q3%201%206%200'%20stroke='%233D2413'%20stroke-width='0.8'%20stroke-linecap='round'%20fill='none'%20opacity='0.5'/%3e%3c/g%3e%3c/svg%3e",
|
|
8410
8413
|
sofia: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2096%2096'%20width='96'%20height='96'%3e%3cdefs%3e%3cclipPath%20id='c'%3e%3ccircle%20cx='48'%20cy='48'%20r='48'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23c)'%3e%3crect%20width='96'%20height='96'%20fill='%23D4E3EC'/%3e%3ccircle%20cx='68'%20cy='24'%20r='42'%20fill='%23fff'%20opacity='0.08'/%3e%3ccircle%20cx='24'%20cy='82'%20r='36'%20fill='%23000'%20opacity='0.045'/%3e%3c/g%3e%3cg%20clip-path='url(%23c)'%3e%3cpath%20d='M38%2072%20Q38%2080%2048%2080%20Q58%2080%2058%2072%20L58%2068%20L38%2068%20Z'%20fill='%23C6976C'/%3e%3cpath%20d='M8%2096%20C%208%2076,%2024%2068,%2034%2068%20L%2062%2068%20C%2072%2068,%2088%2076,%2088%2096%20Z'%20fill='%237E3E2A'/%3e%3cpath%20d='M40%2068%20L48%2074%20L56%2068%20Z'%20fill='rgba(0,0,0,0.12)'/%3e%3cpath%20d='M24%2038%20C%2024%2022,%2034%2012,%2048%2012%20C%2062%2012,%2072%2022,%2072%2038%20L%2072%2062%20C%2068%2058,%2064%2058,%2060%2060%20L%2036%2060%20C%2032%2058,%2028%2058,%2024%2062%20Z'%20fill='%2355392A'/%3e%3cpath%20d='M48%2017%20C%2032%2017,%2025%2029,%2025%2044%20C%2025%2059,%2033%2073,%2048%2073%20C%2063%2073,%2071%2059,%2071%2044%20C%2071%2029,%2064%2017,%2048%2017%20Z'%20fill='%23DDAE85'/%3e%3cpath%20d='M48%2017%20C%2063%2017,%2071%2029,%2071%2044%20C%2071%2059,%2063%2073,%2048%2073%20Z'%20fill='%23C6976C'%20opacity='0.55'/%3e%3cellipse%20cx='26'%20cy='46'%20rx='3'%20ry='5'%20fill='%23C6976C'/%3e%3cellipse%20cx='70'%20cy='46'%20rx='3'%20ry='5'%20fill='%23C6976C'/%3e%3cpath%20d='M26%2038%20C%2030%2024,%2040%2018,%2048%2018%20C%2058%2018,%2066%2024,%2070%2038%20C%2064%2032,%2054%2030,%2048%2030%20C%2040%2030,%2032%2032,%2026%2038%20Z'%20fill='%2355392A'/%3e%3cpath%20d='M30%2024%20C%2038%2032,%2058%2032,%2066%2024%20C%2060%2018,%2054%2016,%2048%2016%20C%2040%2016,%2034%2018,%2030%2024%20Z'%20fill='%233D2718'%20opacity='0.4'/%3e%3cpath%20d='M36%2041%20q4%20-2%208%200'%20stroke='%233D2718'%20stroke-width='1.6'%20stroke-linecap='round'%20fill='none'/%3e%3cpath%20d='M52%2041%20q4%20-2%208%200'%20stroke='%233D2718'%20stroke-width='1.6'%20stroke-linecap='round'%20fill='none'/%3e%3cpath%20d='M37%2046%20q3%20-3%206%200%20q-3%203%20-6%200%20Z'%20fill='%232A1F18'/%3e%3cpath%20d='M53%2046%20q3%20-3%206%200%20q-3%203%20-6%200%20Z'%20fill='%232A1F18'/%3e%3ccircle%20cx='41.4'%20cy='45.4'%20r='0.6'%20fill='%23fff'/%3e%3ccircle%20cx='57.4'%20cy='45.4'%20r='0.6'%20fill='%23fff'/%3e%3cpath%20d='M46.5%2051%20q1.5%201.5%203%200'%20stroke='%23C6976C'%20stroke-width='1.2'%20stroke-linecap='round'%20fill='none'%20opacity='0.8'/%3e%3cellipse%20cx='34'%20cy='54'%20rx='4'%20ry='2.2'%20fill='rgba(210,120,110,0.22)'/%3e%3cellipse%20cx='62'%20cy='54'%20rx='4'%20ry='2.2'%20fill='rgba(210,120,110,0.22)'/%3e%3cpath%20d='M43%2057%20q5%204%2010%200%20q-5%201%20-10%200%20Z'%20fill='%23B56A5A'%20opacity='0.85'/%3e%3c/g%3e%3c/svg%3e",
|
|
8411
8414
|
bean: "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%2096%2096'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;'%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3cpath%20d='M64,30C64,24.667%2066,22%2070,22C74,22%2076,20%2076,16'%20style='fill:none;fill-rule:nonzero;stroke:rgb(58,31,16);stroke-width:3px;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3ccircle%20cx='76'%20cy='14'%20r='3.5'%20style='fill:rgb(255,111,177);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3cpath%20d='M38,50C38,38%2046.667,32%2064,32C81.333,32%2090,38%2090,50L90,92C90,101.333%2081.333,106%2064,106C46.667,106%2038,101.333%2038,92L38,50Z'%20style='fill:url(%23_Linear1);fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3cellipse%20cx='64'%20cy='84'%20rx='20'%20ry='14'%20style='fill:rgb(255,226,194);fill-opacity:0.85;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3cellipse%20cx='54'%20cy='62'%20rx='5.525'%20ry='6.5'%20style='fill:rgb(58,31,16);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3cellipse%20cx='74'%20cy='62'%20rx='5.525'%20ry='6.5'%20style='fill:rgb(58,31,16);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3ccircle%20cx='52.375'%20cy='59.4'%20r='2.275'%20style='fill:white;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3ccircle%20cx='72.375'%20cy='59.4'%20r='2.275'%20style='fill:white;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3ccircle%20cx='56.6'%20cy='63.95'%20r='1.17'%20style='fill:white;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3ccircle%20cx='76.6'%20cy='63.95'%20r='1.17'%20style='fill:white;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3cpath%20d='M58,74C62,78%2066,78%2070,74'%20style='fill:none;fill-rule:nonzero;stroke:rgb(58,31,16);stroke-width:3px;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3cellipse%20cx='50'%20cy='106'%20rx='6'%20ry='3'%20style='fill:rgb(210,106,45);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3cellipse%20cx='78'%20cy='106'%20rx='6'%20ry='3'%20style='fill:rgb(210,106,45);'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='_Linear1'%20x1='0'%20y1='0'%20x2='1'%20y2='0'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(4.53119e-15,74,-74,4.53119e-15,38,32)'%3e%3cstop%20offset='0'%20style='stop-color:rgb(255,197,138);stop-opacity:1'/%3e%3cstop%20offset='1'%20style='stop-color:rgb(240,138,75);stop-opacity:1'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",
|
|
8412
|
-
owl: "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%2096%2096'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;'%3e%3cg%20transform='matrix(2,0,0,2,-116.592,-107.388)'%3e%3cellipse%20cx='86'%20cy='92'%20rx='3'%20ry='1.5'%20style='fill:rgb(122,74,14);'/%3e%3c/g%3e%3cg%20transform='matrix(2,0,0,2,-132.065,-107.388)'%3e%3cellipse%20cx='86'%20cy='92'%20rx='3'%20ry='1.5'%20style='fill:rgb(122,74,14);'/%3e%3c/g%3e%3cg%20transform='matrix(1.02083,0,0,1.02083,-28.4825,-8.00437)'%3e%3cpath%20d='M90,34L96,22L80,30L90,34Z'%20style='fill:url(%23_Linear1);fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(-1.02083,0,0,1.02083,124.21,-8.00437)'%3e%3cpath%20d='M90,34L96,22L80,30L90,34Z'%20style='fill:url(%23_Linear2);fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3cellipse%20cx='64'%20cy='72'%20rx='34'%20ry='38'%20style='fill:url(%23_Linear3);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3cellipse%20cx='64'%20cy='86'%20rx='22'%20ry='20'%20style='fill:rgb(248,232,200);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3ccircle%20cx='52'%20cy='58'%20r='11'%20style='fill:white;stroke:rgb(90,58,26);stroke-width:2px;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3ccircle%20cx='76'%20cy='58'%20r='11'%20style='fill:white;stroke:rgb(90,58,26);stroke-width:2px;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3ccircle%20cx='52'%20cy='58'%20r='5'%20style='fill:rgb(26,15,10);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3ccircle%20cx='76'%20cy='58'%20r='5'%20style='fill:rgb(26,15,10);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3ccircle%20cx='50'%20cy='56'%20r='2'%20style='fill:white;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3ccircle%20cx='74'%20cy='56'%20r='2'%20style='fill:white;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3cpath%20d='M60,70L64,78L68,70L60,70Z'%20style='fill:rgb(255,179,106);fill-rule:nonzero;stroke:rgb(122,74,14);stroke-width:1px;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3cpath%20d='M30,60C24.667,73.333%2025.333,86.667%2032,100L38,90C36.667,80.667%2036.667,72%2038,64L30,60Z'%20style='fill:url(%23_Linear4);fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3cpath%20d='M98,60C103.333,73.333%20102.667,86.667%2096,100L90,90C91.333,80.667%2091.333,72%2090,64L98,60Z'%20style='fill:url(%23_Linear5);fill-rule:nonzero;'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='_Linear1'%20x1='0'%20y1='0'%20x2='1'%20y2='0'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(7.34788e-16,12,-12,7.34788e-16,80,22)'%3e%3cstop%20offset='0'%20style='stop-color:rgb(232,200,168);stop-opacity:1'/%3e%3cstop%20offset='1'%20style='stop-color:rgb(168,120,74);stop-opacity:1'/%3e%3c/linearGradient%3e%3clinearGradient%20id='_Linear2'%20x1='0'%20y1='0'%20x2='1'%20y2='0'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(7.34788e-16,12,-12,7.34788e-16,80,22)'%3e%3cstop%20offset='0'%20style='stop-color:rgb(232,200,168);stop-opacity:1'/%3e%3cstop%20offset='1'%20style='stop-color:rgb(168,120,74);stop-opacity:1'/%3e%3c/linearGradient%3e%3clinearGradient%20id='_Linear3'%20x1='0'%20y1='0'%20x2='1'%20y2='0'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(4.65366e-15,76,-76,4.65366e-15,30,34)'%3e%3cstop%20offset='0'%20style='stop-color:rgb(232,200,168);stop-opacity:1'/%3e%3cstop%20offset='1'%20style='stop-color:rgb(168,120,74);stop-opacity:1'/%3e%3c/linearGradient%3e%3clinearGradient%20id='_Linear4'%20x1='0'%20y1='0'%20x2='1'%20y2='0'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(-9.30994,-1.27833,1.27833,-9.30994,35.7544,81.2783)'%3e%3cstop%20offset='0'%20style='stop-color:rgb(232,200,168);stop-opacity:1'/%3e%3cstop%20offset='1'%20style='stop-color:rgb(168,120,74);stop-opacity:1'/%3e%3c/linearGradient%3e%3clinearGradient%20id='_Linear5'%20x1='0'%20y1='0'%20x2='1'%20y2='0'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(11.5556,3.71929,-3.71929,11.5556,90,74.9474)'%3e%3cstop%20offset='0'%20style='stop-color:rgb(232,200,168);stop-opacity:1'/%3e%3cstop%20offset='1'%20style='stop-color:rgb(168,120,74);stop-opacity:1'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e"
|
|
8415
|
+
owl: "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%2096%2096'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;'%3e%3cg%20transform='matrix(2,0,0,2,-116.592,-107.388)'%3e%3cellipse%20cx='86'%20cy='92'%20rx='3'%20ry='1.5'%20style='fill:rgb(122,74,14);'/%3e%3c/g%3e%3cg%20transform='matrix(2,0,0,2,-132.065,-107.388)'%3e%3cellipse%20cx='86'%20cy='92'%20rx='3'%20ry='1.5'%20style='fill:rgb(122,74,14);'/%3e%3c/g%3e%3cg%20transform='matrix(1.02083,0,0,1.02083,-28.4825,-8.00437)'%3e%3cpath%20d='M90,34L96,22L80,30L90,34Z'%20style='fill:url(%23_Linear1);fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(-1.02083,0,0,1.02083,124.21,-8.00437)'%3e%3cpath%20d='M90,34L96,22L80,30L90,34Z'%20style='fill:url(%23_Linear2);fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3cellipse%20cx='64'%20cy='72'%20rx='34'%20ry='38'%20style='fill:url(%23_Linear3);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3cellipse%20cx='64'%20cy='86'%20rx='22'%20ry='20'%20style='fill:rgb(248,232,200);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3ccircle%20cx='52'%20cy='58'%20r='11'%20style='fill:white;stroke:rgb(90,58,26);stroke-width:2px;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3ccircle%20cx='76'%20cy='58'%20r='11'%20style='fill:white;stroke:rgb(90,58,26);stroke-width:2px;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3ccircle%20cx='52'%20cy='58'%20r='5'%20style='fill:rgb(26,15,10);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3ccircle%20cx='76'%20cy='58'%20r='5'%20style='fill:rgb(26,15,10);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3ccircle%20cx='50'%20cy='56'%20r='2'%20style='fill:white;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3ccircle%20cx='74'%20cy='56'%20r='2'%20style='fill:white;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3cpath%20d='M60,70L64,78L68,70L60,70Z'%20style='fill:rgb(255,179,106);fill-rule:nonzero;stroke:rgb(122,74,14);stroke-width:1px;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3cpath%20d='M30,60C24.667,73.333%2025.333,86.667%2032,100L38,90C36.667,80.667%2036.667,72%2038,64L30,60Z'%20style='fill:url(%23_Linear4);fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3cpath%20d='M98,60C103.333,73.333%20102.667,86.667%2096,100L90,90C91.333,80.667%2091.333,72%2090,64L98,60Z'%20style='fill:url(%23_Linear5);fill-rule:nonzero;'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='_Linear1'%20x1='0'%20y1='0'%20x2='1'%20y2='0'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(7.34788e-16,12,-12,7.34788e-16,80,22)'%3e%3cstop%20offset='0'%20style='stop-color:rgb(232,200,168);stop-opacity:1'/%3e%3cstop%20offset='1'%20style='stop-color:rgb(168,120,74);stop-opacity:1'/%3e%3c/linearGradient%3e%3clinearGradient%20id='_Linear2'%20x1='0'%20y1='0'%20x2='1'%20y2='0'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(7.34788e-16,12,-12,7.34788e-16,80,22)'%3e%3cstop%20offset='0'%20style='stop-color:rgb(232,200,168);stop-opacity:1'/%3e%3cstop%20offset='1'%20style='stop-color:rgb(168,120,74);stop-opacity:1'/%3e%3c/linearGradient%3e%3clinearGradient%20id='_Linear3'%20x1='0'%20y1='0'%20x2='1'%20y2='0'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(4.65366e-15,76,-76,4.65366e-15,30,34)'%3e%3cstop%20offset='0'%20style='stop-color:rgb(232,200,168);stop-opacity:1'/%3e%3cstop%20offset='1'%20style='stop-color:rgb(168,120,74);stop-opacity:1'/%3e%3c/linearGradient%3e%3clinearGradient%20id='_Linear4'%20x1='0'%20y1='0'%20x2='1'%20y2='0'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(-9.30994,-1.27833,1.27833,-9.30994,35.7544,81.2783)'%3e%3cstop%20offset='0'%20style='stop-color:rgb(232,200,168);stop-opacity:1'/%3e%3cstop%20offset='1'%20style='stop-color:rgb(168,120,74);stop-opacity:1'/%3e%3c/linearGradient%3e%3clinearGradient%20id='_Linear5'%20x1='0'%20y1='0'%20x2='1'%20y2='0'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(11.5556,3.71929,-3.71929,11.5556,90,74.9474)'%3e%3cstop%20offset='0'%20style='stop-color:rgb(232,200,168);stop-opacity:1'/%3e%3cstop%20offset='1'%20style='stop-color:rgb(168,120,74);stop-opacity:1'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",
|
|
8416
|
+
bubble: "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%2096%2096'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;'%3e%3cg%3e%3cclipPath%20id='_clip1'%3e%3ccircle%20cx='48'%20cy='48'%20r='48'/%3e%3c/clipPath%3e%3cg%20clip-path='url(%23_clip1)'%3e%3cg%20transform='matrix(1.98284,0,0,1.98284,24.2059,24.2059)'%3e%3cpath%20d='M12,3C17.5,3%2022,6.58%2022,11C22,15.42%2017.5,19%2012,19C10.76,19%209.57,18.82%208.47,18.5C5.55,21%202,21%202,21C4.33,18.67%204.7,17.1%204.75,16.5C3.05,15.07%202,13.13%202,11C2,6.58%206.5,3%2012,3'%20style='fill:white;fill-rule:nonzero;'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e"
|
|
8413
8417
|
}, Tu = Object.keys(wu);
|
|
8414
8418
|
function Eu(e) {
|
|
8415
8419
|
if (e) return e in wu ? wu[e] : e;
|
|
@@ -8420,7 +8424,7 @@ function Du() {
|
|
|
8420
8424
|
let e = Eu(o((e) => e.config.botAvatar));
|
|
8421
8425
|
return e ? /* @__PURE__ */ S("div", {
|
|
8422
8426
|
className: "w-7 h-7 rounded-full flex-shrink-0 overflow-hidden",
|
|
8423
|
-
style: { background: "var(--t-bg
|
|
8427
|
+
style: { background: "var(--t-avatar-bg)" },
|
|
8424
8428
|
children: /* @__PURE__ */ S("img", {
|
|
8425
8429
|
src: e,
|
|
8426
8430
|
alt: "",
|
|
@@ -8468,7 +8472,7 @@ function ku({ message: e, onRetry: t }) {
|
|
|
8468
8472
|
})
|
|
8469
8473
|
}) : /* @__PURE__ */ S(Du, {}), /* @__PURE__ */ C("div", {
|
|
8470
8474
|
className: `flex flex-col gap-1 max-w-[88%] ${r ? "items-end" : "items-start"}`,
|
|
8471
|
-
children: [/* @__PURE__ */
|
|
8475
|
+
children: [/* @__PURE__ */ C("div", {
|
|
8472
8476
|
className: "px-4 py-2.5 rounded-2xl text-sm leading-relaxed break-words",
|
|
8473
8477
|
style: r ? {
|
|
8474
8478
|
background: "var(--t-user-bubble)",
|
|
@@ -8482,7 +8486,7 @@ function ku({ message: e, onRetry: t }) {
|
|
|
8482
8486
|
border: "1px solid var(--t-bg-border)",
|
|
8483
8487
|
borderBottomLeftRadius: "4px"
|
|
8484
8488
|
},
|
|
8485
|
-
children: r ? /* @__PURE__ */ S("span", { children: e.content }) : /* @__PURE__ */ S(ys, {
|
|
8489
|
+
children: [r ? /* @__PURE__ */ S("span", { children: e.content }) : /* @__PURE__ */ S(ys, {
|
|
8486
8490
|
remarkPlugins: [Cu],
|
|
8487
8491
|
components: {
|
|
8488
8492
|
p: ({ children: e }) => /* @__PURE__ */ S("p", {
|
|
@@ -8514,7 +8518,66 @@ function ku({ message: e, onRetry: t }) {
|
|
|
8514
8518
|
})
|
|
8515
8519
|
},
|
|
8516
8520
|
children: e.content
|
|
8517
|
-
})
|
|
8521
|
+
}), e.attachments && e.attachments.length > 0 && /* @__PURE__ */ S("div", {
|
|
8522
|
+
className: "flex flex-col gap-2 mt-2 min-w-[200px]",
|
|
8523
|
+
children: e.attachments.map((e, t) => /* @__PURE__ */ C("a", {
|
|
8524
|
+
href: e.url,
|
|
8525
|
+
target: "_blank",
|
|
8526
|
+
rel: "noopener noreferrer",
|
|
8527
|
+
className: "flex items-center gap-3 p-2.5 rounded-xl border transition-all text-xs font-medium no-underline hover:opacity-90",
|
|
8528
|
+
style: r ? {
|
|
8529
|
+
background: "rgba(255, 255, 255, 0.15)",
|
|
8530
|
+
color: "var(--t-user-fg)",
|
|
8531
|
+
borderColor: "rgba(255, 255, 255, 0.25)"
|
|
8532
|
+
} : {
|
|
8533
|
+
background: "var(--t-bg-surface2, var(--t-bg-surface))",
|
|
8534
|
+
color: "var(--t-fg-primary)",
|
|
8535
|
+
borderColor: "var(--t-bg-border)"
|
|
8536
|
+
},
|
|
8537
|
+
title: `Download ${e.name}`,
|
|
8538
|
+
children: [
|
|
8539
|
+
/* @__PURE__ */ C("svg", {
|
|
8540
|
+
width: "16",
|
|
8541
|
+
height: "16",
|
|
8542
|
+
viewBox: "0 0 24 24",
|
|
8543
|
+
fill: "none",
|
|
8544
|
+
stroke: "currentColor",
|
|
8545
|
+
strokeWidth: "2",
|
|
8546
|
+
className: "flex-shrink-0",
|
|
8547
|
+
children: [/* @__PURE__ */ S("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }), /* @__PURE__ */ S("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" })]
|
|
8548
|
+
}),
|
|
8549
|
+
/* @__PURE__ */ C("div", {
|
|
8550
|
+
className: "flex-1 min-w-0",
|
|
8551
|
+
children: [/* @__PURE__ */ S("div", {
|
|
8552
|
+
className: "truncate font-semibold",
|
|
8553
|
+
children: e.name
|
|
8554
|
+
}), e.size && /* @__PURE__ */ C("div", {
|
|
8555
|
+
className: "opacity-75 text-[10px]",
|
|
8556
|
+
children: [(e.size / 1024).toFixed(0), " KB"]
|
|
8557
|
+
})]
|
|
8558
|
+
}),
|
|
8559
|
+
/* @__PURE__ */ C("svg", {
|
|
8560
|
+
width: "14",
|
|
8561
|
+
height: "14",
|
|
8562
|
+
viewBox: "0 0 24 24",
|
|
8563
|
+
fill: "none",
|
|
8564
|
+
stroke: "currentColor",
|
|
8565
|
+
strokeWidth: "2.5",
|
|
8566
|
+
className: "flex-shrink-0",
|
|
8567
|
+
children: [
|
|
8568
|
+
/* @__PURE__ */ S("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
8569
|
+
/* @__PURE__ */ S("polyline", { points: "7 10 12 15 17 10" }),
|
|
8570
|
+
/* @__PURE__ */ S("line", {
|
|
8571
|
+
x1: "12",
|
|
8572
|
+
x2: "12",
|
|
8573
|
+
y1: "15",
|
|
8574
|
+
y2: "3"
|
|
8575
|
+
})
|
|
8576
|
+
]
|
|
8577
|
+
})
|
|
8578
|
+
]
|
|
8579
|
+
}, t))
|
|
8580
|
+
})]
|
|
8518
8581
|
}), /* @__PURE__ */ S("div", {
|
|
8519
8582
|
className: "flex items-center gap-2 px-1",
|
|
8520
8583
|
children: i ? /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S("span", {
|
|
@@ -8559,17 +8622,40 @@ function Au() {
|
|
|
8559
8622
|
//#endregion
|
|
8560
8623
|
//#region src/components/InputArea.tsx
|
|
8561
8624
|
var ju = "ELIA AI Assistant", Mu = "https://www.elia-asistent.com";
|
|
8562
|
-
function Nu(
|
|
8563
|
-
let
|
|
8564
|
-
|
|
8565
|
-
|
|
8625
|
+
async function Nu(e, t) {
|
|
8626
|
+
let n = e.agentStream;
|
|
8627
|
+
if (!n || !n.apiBaseUrl || !n.tenantId) return null;
|
|
8628
|
+
let r = s.getState().tokens?.[t];
|
|
8629
|
+
if (r && r.expiresAt > Date.now() + 6e4) return r.token;
|
|
8630
|
+
try {
|
|
8631
|
+
let e = await fetch(`${n.apiBaseUrl.replace(/\/$/, "")}/api/public/chat-stream/init`, {
|
|
8632
|
+
method: "POST",
|
|
8633
|
+
headers: { "Content-Type": "application/json" },
|
|
8634
|
+
body: JSON.stringify({
|
|
8635
|
+
tenantId: n.tenantId,
|
|
8636
|
+
sessionId: t
|
|
8637
|
+
})
|
|
8638
|
+
});
|
|
8639
|
+
if (!e.ok) return null;
|
|
8640
|
+
let r = await e.json();
|
|
8641
|
+
return s.getState().setToken(t, r.token, Date.parse(r.expiresAt)), r.token;
|
|
8642
|
+
} catch {
|
|
8643
|
+
return null;
|
|
8644
|
+
}
|
|
8645
|
+
}
|
|
8646
|
+
function Pu({ onSend: e, disabled: t, placeholder: n, allowFileUploads: r }) {
|
|
8647
|
+
let [i, a] = y(""), [c, l] = y([]), [u, d] = y(!1), [f, p] = y(null), h = v(null), g = o((e) => e.config), _ = s((e) => e.activeSessionId), b = g.poweredByLabel ?? ju, x = g.poweredByUrl ?? Mu, w = g.poweredByHide ?? !1, T = m(() => {
|
|
8648
|
+
let n = i.trim(), r = c.length > 0;
|
|
8649
|
+
!n && !r || t || u || (e(n, c), a(""), l([]), p(null), h.current && (h.current.style.height = "auto"));
|
|
8566
8650
|
}, [
|
|
8567
8651
|
i,
|
|
8568
8652
|
t,
|
|
8653
|
+
u,
|
|
8654
|
+
c,
|
|
8569
8655
|
e
|
|
8570
|
-
]),
|
|
8571
|
-
e.key === "Enter" && !e.shiftKey && (e.preventDefault(),
|
|
8572
|
-
}, [
|
|
8656
|
+
]), E = m((e) => {
|
|
8657
|
+
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), T());
|
|
8658
|
+
}, [T]), D = m((e) => {
|
|
8573
8659
|
a(e.target.value);
|
|
8574
8660
|
let t = e.target;
|
|
8575
8661
|
t.style.height = "auto", t.style.height = `${Math.min(t.scrollHeight, 180)}px`;
|
|
@@ -8580,77 +8666,201 @@ function Nu({ onSend: e, disabled: t, placeholder: n, allowFileUploads: r }) {
|
|
|
8580
8666
|
borderColor: "var(--t-bg-border)",
|
|
8581
8667
|
background: "var(--t-bg-base)"
|
|
8582
8668
|
},
|
|
8583
|
-
children: [
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
className: "
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
|
|
8669
|
+
children: [
|
|
8670
|
+
u && /* @__PURE__ */ C("div", {
|
|
8671
|
+
className: "flex items-center gap-2 px-3 pt-2 text-xs text-fg-secondary",
|
|
8672
|
+
children: [/* @__PURE__ */ C("svg", {
|
|
8673
|
+
className: "animate-spin h-3.5 w-3.5",
|
|
8674
|
+
viewBox: "0 0 24 24",
|
|
8675
|
+
fill: "none",
|
|
8676
|
+
stroke: "currentColor",
|
|
8677
|
+
strokeWidth: "3",
|
|
8678
|
+
children: [/* @__PURE__ */ S("circle", {
|
|
8679
|
+
className: "opacity-25",
|
|
8680
|
+
cx: "12",
|
|
8681
|
+
cy: "12",
|
|
8682
|
+
r: "10",
|
|
8595
8683
|
stroke: "currentColor",
|
|
8596
|
-
strokeWidth: "
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
className: "
|
|
8684
|
+
strokeWidth: "4"
|
|
8685
|
+
}), /* @__PURE__ */ S("path", {
|
|
8686
|
+
className: "opacity-75",
|
|
8687
|
+
fill: "currentColor",
|
|
8688
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
8689
|
+
})]
|
|
8690
|
+
}), /* @__PURE__ */ S("span", { children: "Uploading file..." })]
|
|
8691
|
+
}),
|
|
8692
|
+
f && /* @__PURE__ */ C("div", {
|
|
8693
|
+
className: "flex items-center justify-between gap-2 px-3 pt-2 text-xs text-red-500 font-medium",
|
|
8694
|
+
children: [/* @__PURE__ */ S("span", { children: f }), /* @__PURE__ */ S("button", {
|
|
8695
|
+
onClick: () => p(null),
|
|
8696
|
+
className: "opacity-80 hover:opacity-100 focus:outline-none",
|
|
8697
|
+
children: "Dismiss"
|
|
8698
|
+
})]
|
|
8699
|
+
}),
|
|
8700
|
+
c.length > 0 && /* @__PURE__ */ S("div", {
|
|
8701
|
+
className: "flex flex-wrap gap-2 px-3 pt-2 pb-1 border-b",
|
|
8702
|
+
style: { borderColor: "var(--t-bg-border)" },
|
|
8703
|
+
children: c.map((e, t) => /* @__PURE__ */ C("div", {
|
|
8704
|
+
className: "flex items-center gap-2 px-2.5 py-1.5 rounded-lg text-xs font-medium",
|
|
8609
8705
|
style: {
|
|
8610
|
-
background: "var(--t-bg-surface)",
|
|
8706
|
+
background: "var(--t-bg-surface2, var(--t-bg-surface))",
|
|
8611
8707
|
color: "var(--t-fg-primary)",
|
|
8612
|
-
border: "1px solid var(--t-bg-border)"
|
|
8613
|
-
resize: "none"
|
|
8614
|
-
}
|
|
8615
|
-
}),
|
|
8616
|
-
/* @__PURE__ */ S("button", {
|
|
8617
|
-
onClick: f,
|
|
8618
|
-
disabled: t || !i.trim(),
|
|
8619
|
-
className: "flex-shrink-0 w-[42px] h-[42px] rounded-xl flex items-center justify-center transition-colors disabled:opacity-40 disabled:cursor-not-allowed",
|
|
8620
|
-
style: {
|
|
8621
|
-
background: "var(--t-accent)",
|
|
8622
|
-
color: "var(--t-accent-fg)"
|
|
8708
|
+
border: "1px solid var(--t-bg-border)"
|
|
8623
8709
|
},
|
|
8624
|
-
children:
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8710
|
+
children: [
|
|
8711
|
+
/* @__PURE__ */ C("svg", {
|
|
8712
|
+
width: "14",
|
|
8713
|
+
height: "14",
|
|
8714
|
+
viewBox: "0 0 24 24",
|
|
8715
|
+
fill: "none",
|
|
8716
|
+
stroke: "currentColor",
|
|
8717
|
+
strokeWidth: "2",
|
|
8718
|
+
children: [/* @__PURE__ */ S("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }), /* @__PURE__ */ S("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" })]
|
|
8719
|
+
}),
|
|
8720
|
+
/* @__PURE__ */ S("span", {
|
|
8721
|
+
className: "truncate max-w-[120px]",
|
|
8722
|
+
children: e.name
|
|
8723
|
+
}),
|
|
8724
|
+
e.size && /* @__PURE__ */ C("span", {
|
|
8725
|
+
className: "opacity-60",
|
|
8726
|
+
children: [
|
|
8727
|
+
"(",
|
|
8728
|
+
(e.size / 1024).toFixed(0),
|
|
8729
|
+
" KB)"
|
|
8730
|
+
]
|
|
8731
|
+
}),
|
|
8732
|
+
/* @__PURE__ */ S("button", {
|
|
8733
|
+
type: "button",
|
|
8734
|
+
onClick: () => l((e) => e.filter((e, n) => n !== t)),
|
|
8735
|
+
className: "text-fg-secondary hover:text-fg-primary transition-colors focus:outline-none",
|
|
8736
|
+
title: "Remove attachment",
|
|
8737
|
+
children: /* @__PURE__ */ S("svg", {
|
|
8738
|
+
width: "14",
|
|
8739
|
+
height: "14",
|
|
8740
|
+
viewBox: "0 0 24 24",
|
|
8741
|
+
fill: "none",
|
|
8742
|
+
stroke: "currentColor",
|
|
8743
|
+
strokeWidth: "2.5",
|
|
8744
|
+
children: /* @__PURE__ */ S("path", { d: "M18 6 6 18M6 6l12 12" })
|
|
8745
|
+
})
|
|
8746
|
+
})
|
|
8747
|
+
]
|
|
8748
|
+
}, t))
|
|
8749
|
+
}),
|
|
8750
|
+
/* @__PURE__ */ C("div", {
|
|
8751
|
+
className: "flex items-end gap-2 p-3",
|
|
8752
|
+
children: [
|
|
8753
|
+
r && /* @__PURE__ */ C("label", {
|
|
8754
|
+
className: `flex-shrink-0 w-[42px] h-[42px] rounded-xl flex items-center justify-center text-fg-secondary hover:text-fg-primary hover:bg-bg-surface transition-colors cursor-pointer ${t || u ? "opacity-40 cursor-not-allowed pointer-events-none" : ""}`,
|
|
8755
|
+
title: "Attach file",
|
|
8756
|
+
children: [/* @__PURE__ */ S("input", {
|
|
8757
|
+
type: "file",
|
|
8758
|
+
accept: g.allowedFileExtensions ?? ".pdf,.docx,.png,.jpg,.jpeg",
|
|
8759
|
+
onChange: async (e) => {
|
|
8760
|
+
let t = e.target.files?.[0];
|
|
8761
|
+
if (!t) return;
|
|
8762
|
+
if (p(null), t.size > 5 * 1024 * 1024) {
|
|
8763
|
+
p("File size exceeds the maximum limit of 5MB."), e.target.value = "";
|
|
8764
|
+
return;
|
|
8765
|
+
}
|
|
8766
|
+
let n = "." + t.name.split(".").pop()?.toLowerCase(), r = g.allowedFileExtensions ?? ".pdf,.docx,.png,.jpg,.jpeg";
|
|
8767
|
+
if (!r.split(",").map((e) => e.trim().toLowerCase()).includes(n)) {
|
|
8768
|
+
p(`File type not allowed. Allowed types: ${r}`), e.target.value = "";
|
|
8769
|
+
return;
|
|
8770
|
+
}
|
|
8771
|
+
let i = await Nu(g, _ ?? s.getState().createSession());
|
|
8772
|
+
if (!i) {
|
|
8773
|
+
p("Unable to authenticate file upload."), e.target.value = "";
|
|
8774
|
+
return;
|
|
8775
|
+
}
|
|
8776
|
+
d(!0);
|
|
8777
|
+
try {
|
|
8778
|
+
let e = new FormData();
|
|
8779
|
+
e.append("file", t);
|
|
8780
|
+
let n = `${g.agentStream?.apiBaseUrl?.replace(/\/$/, "") ?? ""}/api/public/files/upload?t=${encodeURIComponent(i)}`, r = await fetch(n, {
|
|
8781
|
+
method: "POST",
|
|
8782
|
+
body: e
|
|
8783
|
+
});
|
|
8784
|
+
if (!r.ok) {
|
|
8785
|
+
let e = await r.json().catch(() => ({}));
|
|
8786
|
+
throw Error(e.error || `Upload failed with status ${r.status}`);
|
|
8787
|
+
}
|
|
8788
|
+
let a = await r.json();
|
|
8789
|
+
l((e) => [...e, a]);
|
|
8790
|
+
} catch (e) {
|
|
8791
|
+
p(e.message || "Failed to upload file.");
|
|
8792
|
+
} finally {
|
|
8793
|
+
d(!1), e.target.value = "";
|
|
8794
|
+
}
|
|
8795
|
+
},
|
|
8796
|
+
style: { display: "none" },
|
|
8797
|
+
disabled: t || u
|
|
8798
|
+
}), /* @__PURE__ */ S("svg", {
|
|
8799
|
+
width: "18",
|
|
8800
|
+
height: "18",
|
|
8801
|
+
viewBox: "0 0 24 24",
|
|
8802
|
+
fill: "none",
|
|
8803
|
+
stroke: "currentColor",
|
|
8804
|
+
strokeWidth: "2",
|
|
8805
|
+
children: /* @__PURE__ */ S("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.57a2 2 0 0 1-2.83-2.83l8.49-8.48" })
|
|
8806
|
+
})]
|
|
8807
|
+
}),
|
|
8808
|
+
/* @__PURE__ */ S("textarea", {
|
|
8809
|
+
ref: h,
|
|
8810
|
+
value: i,
|
|
8811
|
+
onChange: D,
|
|
8812
|
+
onKeyDown: E,
|
|
8813
|
+
placeholder: n ?? "Type a message… (Enter to send, Shift+Enter for newline)",
|
|
8814
|
+
disabled: t,
|
|
8815
|
+
rows: 1,
|
|
8816
|
+
className: "flex-1 rounded-xl px-4 py-2.5 text-base md:text-sm leading-relaxed focus:outline-none disabled:opacity-50 min-h-[42px]",
|
|
8817
|
+
style: {
|
|
8818
|
+
background: "var(--t-bg-surface)",
|
|
8819
|
+
color: "var(--t-fg-primary)",
|
|
8820
|
+
border: "1px solid var(--t-bg-border)",
|
|
8821
|
+
resize: "none"
|
|
8822
|
+
}
|
|
8823
|
+
}),
|
|
8824
|
+
/* @__PURE__ */ S("button", {
|
|
8825
|
+
onClick: T,
|
|
8826
|
+
disabled: t || u || !i.trim() && c.length === 0,
|
|
8827
|
+
className: "flex-shrink-0 w-[42px] h-[42px] rounded-xl flex items-center justify-center transition-colors disabled:opacity-40 disabled:cursor-not-allowed",
|
|
8828
|
+
style: {
|
|
8829
|
+
background: "var(--t-accent)",
|
|
8830
|
+
color: "var(--t-accent-fg)"
|
|
8831
|
+
},
|
|
8832
|
+
children: /* @__PURE__ */ C("svg", {
|
|
8833
|
+
width: "18",
|
|
8834
|
+
height: "18",
|
|
8835
|
+
viewBox: "0 0 24 24",
|
|
8836
|
+
fill: "none",
|
|
8837
|
+
stroke: "currentColor",
|
|
8838
|
+
strokeWidth: "2.5",
|
|
8839
|
+
children: [/* @__PURE__ */ S("path", { d: "M22 2 11 13" }), /* @__PURE__ */ S("path", { d: "m22 2-7 20-4-9-9-4 20-7z" })]
|
|
8840
|
+
})
|
|
8632
8841
|
})
|
|
8842
|
+
]
|
|
8843
|
+
}),
|
|
8844
|
+
!w && /* @__PURE__ */ S("div", {
|
|
8845
|
+
className: "text-center text-[11px] pb-2 px-3 text-fg-muted",
|
|
8846
|
+
children: /* @__PURE__ */ S(Me, {
|
|
8847
|
+
i18nKey: "footer.poweredBy",
|
|
8848
|
+
values: { label: b },
|
|
8849
|
+
components: { a: /* @__PURE__ */ S("a", {
|
|
8850
|
+
href: x,
|
|
8851
|
+
target: "_blank",
|
|
8852
|
+
rel: "noopener noreferrer",
|
|
8853
|
+
className: "hover:underline",
|
|
8854
|
+
style: { color: "inherit" }
|
|
8855
|
+
}) }
|
|
8633
8856
|
})
|
|
8634
|
-
]
|
|
8635
|
-
}), !d && /* @__PURE__ */ S("div", {
|
|
8636
|
-
className: "text-center text-[11px] pb-2 px-3 text-fg-muted",
|
|
8637
|
-
children: /* @__PURE__ */ S(Me, {
|
|
8638
|
-
i18nKey: "footer.poweredBy",
|
|
8639
|
-
values: { label: l },
|
|
8640
|
-
components: { a: /* @__PURE__ */ S("a", {
|
|
8641
|
-
href: u,
|
|
8642
|
-
target: "_blank",
|
|
8643
|
-
rel: "noopener noreferrer",
|
|
8644
|
-
className: "hover:underline",
|
|
8645
|
-
style: { color: "inherit" }
|
|
8646
|
-
}) }
|
|
8647
8857
|
})
|
|
8648
|
-
|
|
8858
|
+
]
|
|
8649
8859
|
});
|
|
8650
8860
|
}
|
|
8651
8861
|
//#endregion
|
|
8652
8862
|
//#region src/components/Tabs.tsx
|
|
8653
|
-
function
|
|
8863
|
+
function Fu({ tabs: e, activeId: t, onChange: n }) {
|
|
8654
8864
|
return /* @__PURE__ */ S("div", {
|
|
8655
8865
|
className: "flex gap-1 px-3 pt-3 pb-2 flex-shrink-0 border-b",
|
|
8656
8866
|
style: {
|
|
@@ -8669,11 +8879,11 @@ function Pu({ tabs: e, activeId: t, onChange: n }) {
|
|
|
8669
8879
|
color: "var(--t-fg-secondary)",
|
|
8670
8880
|
border: "1px solid transparent"
|
|
8671
8881
|
},
|
|
8672
|
-
children: [e.icon && /* @__PURE__ */ S(
|
|
8882
|
+
children: [e.icon && /* @__PURE__ */ S(Iu, { name: e.icon }), /* @__PURE__ */ S("span", { children: e.label })]
|
|
8673
8883
|
}, e.id))
|
|
8674
8884
|
});
|
|
8675
8885
|
}
|
|
8676
|
-
function
|
|
8886
|
+
function Iu({ name: e }) {
|
|
8677
8887
|
let t = {
|
|
8678
8888
|
width: 14,
|
|
8679
8889
|
height: 14,
|
|
@@ -8701,7 +8911,7 @@ function Fu({ name: e }) {
|
|
|
8701
8911
|
}
|
|
8702
8912
|
//#endregion
|
|
8703
8913
|
//#region src/hooks/useFeedJson.ts
|
|
8704
|
-
function
|
|
8914
|
+
function Lu(e, t) {
|
|
8705
8915
|
let [n, r] = y(() => e ? {
|
|
8706
8916
|
data: [],
|
|
8707
8917
|
loading: !0,
|
|
@@ -8747,20 +8957,20 @@ function Iu(e, t) {
|
|
|
8747
8957
|
}
|
|
8748
8958
|
//#endregion
|
|
8749
8959
|
//#region src/components/NotificationsTab.tsx
|
|
8750
|
-
function
|
|
8751
|
-
let { t: n } = Fe(), { data: r, loading: i, error: a } =
|
|
8752
|
-
return i ? /* @__PURE__ */ S(
|
|
8960
|
+
function Ru({ feedUrl: e, inlineItems: t }) {
|
|
8961
|
+
let { t: n } = Fe(), { data: r, loading: i, error: a } = Lu(e, t);
|
|
8962
|
+
return i ? /* @__PURE__ */ S(Hu, {
|
|
8753
8963
|
text: n("tabs.loading"),
|
|
8754
8964
|
muted: !0
|
|
8755
|
-
}) : a ? /* @__PURE__ */ S(
|
|
8965
|
+
}) : a ? /* @__PURE__ */ S(Hu, { text: `${n("tabs.error")} (${a})` }) : r.length === 0 ? /* @__PURE__ */ S(Hu, {
|
|
8756
8966
|
text: n("tabs.empty.notifications"),
|
|
8757
8967
|
muted: !0
|
|
8758
8968
|
}) : /* @__PURE__ */ S("div", {
|
|
8759
8969
|
className: "flex-1 overflow-y-auto px-4 py-3 space-y-3",
|
|
8760
|
-
children: r.map((e, t) => /* @__PURE__ */ S(
|
|
8970
|
+
children: r.map((e, t) => /* @__PURE__ */ S(zu, { item: e }, e.id ?? t))
|
|
8761
8971
|
});
|
|
8762
8972
|
}
|
|
8763
|
-
function
|
|
8973
|
+
function zu({ item: e }) {
|
|
8764
8974
|
return /* @__PURE__ */ C("div", {
|
|
8765
8975
|
className: "rounded-xl px-4 py-3",
|
|
8766
8976
|
style: {
|
|
@@ -8773,7 +8983,7 @@ function Ru({ item: e }) {
|
|
|
8773
8983
|
children: [/* @__PURE__ */ S("h3", {
|
|
8774
8984
|
className: "flex-1 text-sm font-semibold text-fg-primary",
|
|
8775
8985
|
children: e.title
|
|
8776
|
-
}), e.tags?.map((e, t) => /* @__PURE__ */ S(
|
|
8986
|
+
}), e.tags?.map((e, t) => /* @__PURE__ */ S(Bu, { tag: e }, t))]
|
|
8777
8987
|
}),
|
|
8778
8988
|
/* @__PURE__ */ S("p", {
|
|
8779
8989
|
className: "text-sm text-fg-secondary leading-relaxed whitespace-pre-line",
|
|
@@ -8803,15 +9013,15 @@ function Ru({ item: e }) {
|
|
|
8803
9013
|
]
|
|
8804
9014
|
});
|
|
8805
9015
|
}
|
|
8806
|
-
function
|
|
9016
|
+
function Bu({ tag: e }) {
|
|
8807
9017
|
let t = typeof e == "string" ? e : e.label;
|
|
8808
9018
|
return /* @__PURE__ */ S("span", {
|
|
8809
9019
|
className: "inline-block px-2 py-0.5 rounded-md text-[11px] font-medium flex-shrink-0",
|
|
8810
|
-
style:
|
|
9020
|
+
style: Vu(typeof e == "string" ? "neutral" : e.variant ?? "neutral"),
|
|
8811
9021
|
children: t
|
|
8812
9022
|
});
|
|
8813
9023
|
}
|
|
8814
|
-
function
|
|
9024
|
+
function Vu(e) {
|
|
8815
9025
|
switch (e) {
|
|
8816
9026
|
case "success": return {
|
|
8817
9027
|
background: "rgba(34, 197, 94, 0.15)",
|
|
@@ -8831,7 +9041,7 @@ function Bu(e) {
|
|
|
8831
9041
|
};
|
|
8832
9042
|
}
|
|
8833
9043
|
}
|
|
8834
|
-
function
|
|
9044
|
+
function Hu({ text: e, muted: t }) {
|
|
8835
9045
|
return /* @__PURE__ */ S("div", {
|
|
8836
9046
|
className: "flex-1 flex items-center justify-center px-4 py-12 text-sm text-center",
|
|
8837
9047
|
style: { color: t ? "var(--t-fg-muted)" : "var(--t-fg-secondary)" },
|
|
@@ -8840,37 +9050,37 @@ function Vu({ text: e, muted: t }) {
|
|
|
8840
9050
|
}
|
|
8841
9051
|
//#endregion
|
|
8842
9052
|
//#region src/components/FaqTab.tsx
|
|
8843
|
-
function
|
|
8844
|
-
let { t: n } = Fe(), { data: r, loading: i, error: a } =
|
|
9053
|
+
function Uu({ feedUrl: e, inlineItems: t }) {
|
|
9054
|
+
let { t: n } = Fe(), { data: r, loading: i, error: a } = Lu(e, t), [o, s] = y(""), [c, l] = y(null), u = _(() => {
|
|
8845
9055
|
let e = o.trim().toLowerCase();
|
|
8846
9056
|
return e ? r.filter((t) => `${t.question} ${t.answer} ${t.category ?? ""}`.toLowerCase().includes(e)) : r;
|
|
8847
9057
|
}, [r, o]);
|
|
8848
9058
|
return i ? /* @__PURE__ */ C("div", {
|
|
8849
9059
|
className: "flex-1 flex flex-col",
|
|
8850
|
-
children: [/* @__PURE__ */ S(
|
|
9060
|
+
children: [/* @__PURE__ */ S(Wu, {
|
|
8851
9061
|
value: o,
|
|
8852
9062
|
onChange: s,
|
|
8853
9063
|
placeholder: n("tabs.faqSearch")
|
|
8854
|
-
}), /* @__PURE__ */ S(
|
|
9064
|
+
}), /* @__PURE__ */ S(Ku, {
|
|
8855
9065
|
text: n("tabs.loading"),
|
|
8856
9066
|
muted: !0
|
|
8857
9067
|
})]
|
|
8858
9068
|
}) : a ? /* @__PURE__ */ C("div", {
|
|
8859
9069
|
className: "flex-1 flex flex-col",
|
|
8860
|
-
children: [/* @__PURE__ */ S(
|
|
9070
|
+
children: [/* @__PURE__ */ S(Wu, {
|
|
8861
9071
|
value: o,
|
|
8862
9072
|
onChange: s,
|
|
8863
9073
|
placeholder: n("tabs.faqSearch")
|
|
8864
|
-
}), /* @__PURE__ */ S(
|
|
9074
|
+
}), /* @__PURE__ */ S(Ku, { text: `${n("tabs.error")} (${a})` })]
|
|
8865
9075
|
}) : /* @__PURE__ */ C("div", {
|
|
8866
9076
|
className: "flex-1 flex flex-col min-h-0",
|
|
8867
|
-
children: [/* @__PURE__ */ S(
|
|
9077
|
+
children: [/* @__PURE__ */ S(Wu, {
|
|
8868
9078
|
value: o,
|
|
8869
9079
|
onChange: s,
|
|
8870
9080
|
placeholder: n("tabs.faqSearch")
|
|
8871
9081
|
}), /* @__PURE__ */ S("div", {
|
|
8872
9082
|
className: "flex-1 overflow-y-auto px-4 py-3 space-y-2",
|
|
8873
|
-
children: u.length === 0 ? /* @__PURE__ */ S(
|
|
9083
|
+
children: u.length === 0 ? /* @__PURE__ */ S(Ku, {
|
|
8874
9084
|
text: n("tabs.empty.faq"),
|
|
8875
9085
|
muted: !0
|
|
8876
9086
|
}) : u.map((e, t) => {
|
|
@@ -8887,7 +9097,7 @@ function Hu({ feedUrl: e, inlineItems: t }) {
|
|
|
8887
9097
|
children: [/* @__PURE__ */ S("span", {
|
|
8888
9098
|
className: "flex-1 text-sm font-semibold text-fg-primary",
|
|
8889
9099
|
children: e.question
|
|
8890
|
-
}), /* @__PURE__ */ S(
|
|
9100
|
+
}), /* @__PURE__ */ S(Gu, { open: r })]
|
|
8891
9101
|
}), r && /* @__PURE__ */ C("div", {
|
|
8892
9102
|
className: "px-4 pb-3 text-sm text-fg-secondary leading-relaxed whitespace-pre-line",
|
|
8893
9103
|
style: {
|
|
@@ -8911,7 +9121,7 @@ function Hu({ feedUrl: e, inlineItems: t }) {
|
|
|
8911
9121
|
})]
|
|
8912
9122
|
});
|
|
8913
9123
|
}
|
|
8914
|
-
function
|
|
9124
|
+
function Wu({ value: e, onChange: t, placeholder: n }) {
|
|
8915
9125
|
return /* @__PURE__ */ S("div", {
|
|
8916
9126
|
className: "px-4 pt-3 pb-2 flex-shrink-0",
|
|
8917
9127
|
style: { background: "var(--t-bg-base)" },
|
|
@@ -8947,7 +9157,7 @@ function Uu({ value: e, onChange: t, placeholder: n }) {
|
|
|
8947
9157
|
})
|
|
8948
9158
|
});
|
|
8949
9159
|
}
|
|
8950
|
-
function
|
|
9160
|
+
function Gu({ open: e }) {
|
|
8951
9161
|
return /* @__PURE__ */ S("svg", {
|
|
8952
9162
|
width: "16",
|
|
8953
9163
|
height: "16",
|
|
@@ -8967,7 +9177,7 @@ function Wu({ open: e }) {
|
|
|
8967
9177
|
children: /* @__PURE__ */ S("path", { d: "m6 9 6 6 6-6" })
|
|
8968
9178
|
});
|
|
8969
9179
|
}
|
|
8970
|
-
function
|
|
9180
|
+
function Ku({ text: e, muted: t }) {
|
|
8971
9181
|
return /* @__PURE__ */ S("div", {
|
|
8972
9182
|
className: "flex-1 flex items-center justify-center px-4 py-12 text-sm text-center",
|
|
8973
9183
|
style: { color: t ? "var(--t-fg-muted)" : "var(--t-fg-secondary)" },
|
|
@@ -8976,7 +9186,7 @@ function Gu({ text: e, muted: t }) {
|
|
|
8976
9186
|
}
|
|
8977
9187
|
//#endregion
|
|
8978
9188
|
//#region src/components/ChatView.tsx
|
|
8979
|
-
function
|
|
9189
|
+
function qu({ onOpenSettings: e, onClose: t }) {
|
|
8980
9190
|
let { t: n } = Fe(), r = s((e) => e.activeSessionId), i = s((e) => r ? e.messages[r] ?? [] : []), a = s((e) => e.createSession), c = s((e) => e.isStreaming), l = s((e) => r ? !!e.awaitingAgentReply[r] : !1), u = o((e) => e.config), d = o((e) => e.language), f = u.hideSettings ?? !1, { send: p, retry: m } = Xe(), h = v(null), _ = u.i18n?.[d] ?? u.i18n?.en ?? {}, b = _.initialMessages ?? u.initialMessages ?? [], w = _.botName ?? u.botName ?? n("header.assistant"), T = u.tabs, E = T?.notifications, D = T?.help, O = !!(E?.feedUrl || E?.items?.length || D?.feedUrl || D?.items?.length), k = O ? [
|
|
8981
9191
|
E?.feedUrl || E?.items?.length ? {
|
|
8982
9192
|
id: "notifications",
|
|
@@ -9016,7 +9226,10 @@ function Ku({ onOpenSettings: e, onClose: t }) {
|
|
|
9016
9226
|
src: Eu(u.botAvatar),
|
|
9017
9227
|
alt: "",
|
|
9018
9228
|
className: "w-7 h-7 rounded-full object-cover flex-shrink-0",
|
|
9019
|
-
style: {
|
|
9229
|
+
style: {
|
|
9230
|
+
border: "1px solid var(--t-bg-border)",
|
|
9231
|
+
background: "var(--t-avatar-bg)"
|
|
9232
|
+
}
|
|
9020
9233
|
}) : /* @__PURE__ */ S("div", {
|
|
9021
9234
|
className: "w-2 h-2 rounded-full",
|
|
9022
9235
|
style: { background: "var(--t-accent)" }
|
|
@@ -9039,31 +9252,31 @@ function Ku({ onOpenSettings: e, onClose: t }) {
|
|
|
9039
9252
|
onClick: e,
|
|
9040
9253
|
className: "w-8 h-8 rounded-lg flex items-center justify-center text-fg-secondary hover:text-fg-primary hover:bg-bg-surface transition-colors",
|
|
9041
9254
|
title: n("sidebar.settings"),
|
|
9042
|
-
children: /* @__PURE__ */ S(
|
|
9255
|
+
children: /* @__PURE__ */ S(Yu, {})
|
|
9043
9256
|
}), t && /* @__PURE__ */ S("button", {
|
|
9044
9257
|
onClick: t,
|
|
9045
9258
|
className: "w-8 h-8 rounded-lg flex items-center justify-center text-fg-secondary hover:text-fg-primary hover:bg-bg-surface transition-colors",
|
|
9046
9259
|
"aria-label": "Close chat",
|
|
9047
|
-
children: /* @__PURE__ */ S(
|
|
9260
|
+
children: /* @__PURE__ */ S(Xu, {})
|
|
9048
9261
|
})]
|
|
9049
9262
|
})]
|
|
9050
9263
|
}),
|
|
9051
|
-
O && /* @__PURE__ */ S(
|
|
9264
|
+
O && /* @__PURE__ */ S(Fu, {
|
|
9052
9265
|
tabs: k,
|
|
9053
9266
|
activeId: A,
|
|
9054
9267
|
onChange: (e) => j(e)
|
|
9055
9268
|
}),
|
|
9056
|
-
O && A === "notifications" && /* @__PURE__ */ S(
|
|
9269
|
+
O && A === "notifications" && /* @__PURE__ */ S(Ru, {
|
|
9057
9270
|
feedUrl: E?.feedUrl,
|
|
9058
9271
|
inlineItems: E?.items
|
|
9059
9272
|
}),
|
|
9060
|
-
O && A === "help" && /* @__PURE__ */ S(
|
|
9273
|
+
O && A === "help" && /* @__PURE__ */ S(Uu, {
|
|
9061
9274
|
feedUrl: D?.feedUrl,
|
|
9062
9275
|
inlineItems: D?.items
|
|
9063
9276
|
}),
|
|
9064
9277
|
P && /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ C("div", {
|
|
9065
9278
|
className: "flex-1 overflow-y-auto px-4 py-4",
|
|
9066
|
-
children: [M ? /* @__PURE__ */ S(
|
|
9279
|
+
children: [M ? /* @__PURE__ */ S(Ju, {
|
|
9067
9280
|
botName: w,
|
|
9068
9281
|
subtitle: N
|
|
9069
9282
|
}) : /* @__PURE__ */ C(x, { children: [
|
|
@@ -9079,7 +9292,7 @@ function Ku({ onOpenSettings: e, onClose: t }) {
|
|
|
9079
9292
|
}, e.id)),
|
|
9080
9293
|
(c && i[i.length - 1]?.role === "bot" && i[i.length - 1]?.content === "" || l) && /* @__PURE__ */ S(Au, {})
|
|
9081
9294
|
] }), /* @__PURE__ */ S("div", { ref: h })]
|
|
9082
|
-
}), /* @__PURE__ */ S(
|
|
9295
|
+
}), /* @__PURE__ */ S(Pu, {
|
|
9083
9296
|
onSend: p,
|
|
9084
9297
|
disabled: c || !u.webhookUrl,
|
|
9085
9298
|
placeholder: u.webhookUrl ? n("input.placeholder") : n("input.placeholderUnconfigured"),
|
|
@@ -9088,7 +9301,7 @@ function Ku({ onOpenSettings: e, onClose: t }) {
|
|
|
9088
9301
|
]
|
|
9089
9302
|
});
|
|
9090
9303
|
}
|
|
9091
|
-
function
|
|
9304
|
+
function Ju({ botName: e, subtitle: t }) {
|
|
9092
9305
|
return /* @__PURE__ */ C("div", {
|
|
9093
9306
|
className: "flex flex-col items-center justify-center h-full gap-4 text-center px-8",
|
|
9094
9307
|
children: [/* @__PURE__ */ S("div", {
|
|
@@ -9107,7 +9320,7 @@ function qu({ botName: e, subtitle: t }) {
|
|
|
9107
9320
|
})] })]
|
|
9108
9321
|
});
|
|
9109
9322
|
}
|
|
9110
|
-
function
|
|
9323
|
+
function Yu() {
|
|
9111
9324
|
return /* @__PURE__ */ C("svg", {
|
|
9112
9325
|
width: "16",
|
|
9113
9326
|
height: "16",
|
|
@@ -9122,7 +9335,7 @@ function Ju() {
|
|
|
9122
9335
|
}), /* @__PURE__ */ S("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" })]
|
|
9123
9336
|
});
|
|
9124
9337
|
}
|
|
9125
|
-
function
|
|
9338
|
+
function Xu() {
|
|
9126
9339
|
return /* @__PURE__ */ S("svg", {
|
|
9127
9340
|
width: "16",
|
|
9128
9341
|
height: "16",
|
|
@@ -9135,7 +9348,7 @@ function Yu() {
|
|
|
9135
9348
|
}
|
|
9136
9349
|
//#endregion
|
|
9137
9350
|
//#region src/components/ThemePicker.tsx
|
|
9138
|
-
function
|
|
9351
|
+
function Zu() {
|
|
9139
9352
|
let { activeTheme: e, setTheme: t } = Ie();
|
|
9140
9353
|
return /* @__PURE__ */ S("div", {
|
|
9141
9354
|
className: "flex flex-wrap gap-2 p-3",
|
|
@@ -9143,17 +9356,17 @@ function Xu() {
|
|
|
9143
9356
|
title: n.label,
|
|
9144
9357
|
onClick: () => t(n.id),
|
|
9145
9358
|
className: "relative w-7 h-7 rounded-full transition-transform hover:scale-110 focus:outline-none",
|
|
9146
|
-
style: { background: n.
|
|
9359
|
+
style: { background: n.accentColor },
|
|
9147
9360
|
children: e === n.id && /* @__PURE__ */ S("span", {
|
|
9148
9361
|
className: "absolute inset-0 rounded-full",
|
|
9149
|
-
style: { boxShadow: `0 0 0 2px ${n.
|
|
9362
|
+
style: { boxShadow: `0 0 0 2px ${n.baseColor}, 0 0 0 4px ${n.baseColor}` }
|
|
9150
9363
|
})
|
|
9151
9364
|
}, n.id))
|
|
9152
9365
|
});
|
|
9153
9366
|
}
|
|
9154
9367
|
//#endregion
|
|
9155
9368
|
//#region src/components/SettingsModal.tsx
|
|
9156
|
-
var
|
|
9369
|
+
var Qu = 500 * 1024, $u = [
|
|
9157
9370
|
{
|
|
9158
9371
|
code: "en",
|
|
9159
9372
|
label: "EN - English"
|
|
@@ -9187,7 +9400,7 @@ var Zu = 500 * 1024, Qu = [
|
|
|
9187
9400
|
label: "ES - Spanish"
|
|
9188
9401
|
}
|
|
9189
9402
|
];
|
|
9190
|
-
function
|
|
9403
|
+
function ed({ onClose: e }) {
|
|
9191
9404
|
let { t } = Fe(), { config: n, setConfig: r, language: i, setLanguage: a, activeTheme: s } = o(), [c, l] = y({ ...n }), [u, d] = y(""), [f, p] = y(() => {
|
|
9192
9405
|
try {
|
|
9193
9406
|
return JSON.stringify(c.metadata ?? {}, null, 2);
|
|
@@ -9294,15 +9507,12 @@ useSettingsStore.getState().setLanguage(${JSON.stringify(i)})
|
|
|
9294
9507
|
}),
|
|
9295
9508
|
h ? /* @__PURE__ */ C("div", {
|
|
9296
9509
|
className: "px-6 py-5 space-y-3 overflow-y-auto flex-1",
|
|
9297
|
-
children: [/* @__PURE__ */
|
|
9510
|
+
children: [/* @__PURE__ */ S("p", {
|
|
9298
9511
|
className: "text-xs text-fg-secondary leading-relaxed",
|
|
9299
|
-
children:
|
|
9300
|
-
"
|
|
9301
|
-
/* @__PURE__ */ S("code", {
|
|
9302
|
-
|
|
9303
|
-
/* @__PURE__ */ S("code", { children: "example.html" }),
|
|
9304
|
-
" for the full integration guide."
|
|
9305
|
-
]
|
|
9512
|
+
children: /* @__PURE__ */ S(Me, {
|
|
9513
|
+
i18nKey: "settings.exportHint",
|
|
9514
|
+
components: { code: /* @__PURE__ */ S("code", {}) }
|
|
9515
|
+
})
|
|
9306
9516
|
}), /* @__PURE__ */ S("textarea", {
|
|
9307
9517
|
readOnly: !0,
|
|
9308
9518
|
value: b,
|
|
@@ -9345,7 +9555,7 @@ useSettingsStore.getState().setLanguage(${JSON.stringify(i)})
|
|
|
9345
9555
|
}),
|
|
9346
9556
|
/* @__PURE__ */ S($, {
|
|
9347
9557
|
label: t("settings.theme") ?? "Theme",
|
|
9348
|
-
children: /* @__PURE__ */ S(
|
|
9558
|
+
children: /* @__PURE__ */ S(Zu, {})
|
|
9349
9559
|
}),
|
|
9350
9560
|
/* @__PURE__ */ S("hr", { style: { borderColor: "var(--t-bg-border)" } }),
|
|
9351
9561
|
/* @__PURE__ */ S($, {
|
|
@@ -9400,7 +9610,7 @@ useSettingsStore.getState().setLanguage(${JSON.stringify(i)})
|
|
|
9400
9610
|
}),
|
|
9401
9611
|
/* @__PURE__ */ S($, {
|
|
9402
9612
|
label: t("settings.botAvatar"),
|
|
9403
|
-
children: /* @__PURE__ */ S(
|
|
9613
|
+
children: /* @__PURE__ */ S(nd, {
|
|
9404
9614
|
value: c.botAvatar,
|
|
9405
9615
|
onChange: (e) => l((t) => ({
|
|
9406
9616
|
...t,
|
|
@@ -9474,7 +9684,7 @@ useSettingsStore.getState().setLanguage(${JSON.stringify(i)})
|
|
|
9474
9684
|
/* @__PURE__ */ C("div", {
|
|
9475
9685
|
className: "space-y-2",
|
|
9476
9686
|
children: [
|
|
9477
|
-
/* @__PURE__ */ S(
|
|
9687
|
+
/* @__PURE__ */ S(td, {
|
|
9478
9688
|
label: t("settings.streaming"),
|
|
9479
9689
|
checked: c.streaming ?? !1,
|
|
9480
9690
|
onChange: (e) => l((t) => ({
|
|
@@ -9482,7 +9692,7 @@ useSettingsStore.getState().setLanguage(${JSON.stringify(i)})
|
|
|
9482
9692
|
streaming: e
|
|
9483
9693
|
}))
|
|
9484
9694
|
}),
|
|
9485
|
-
/* @__PURE__ */ S(
|
|
9695
|
+
/* @__PURE__ */ S(td, {
|
|
9486
9696
|
label: t("settings.welcomeScreen"),
|
|
9487
9697
|
checked: c.showWelcomeScreen ?? !0,
|
|
9488
9698
|
onChange: (e) => l((t) => ({
|
|
@@ -9490,7 +9700,7 @@ useSettingsStore.getState().setLanguage(${JSON.stringify(i)})
|
|
|
9490
9700
|
showWelcomeScreen: e
|
|
9491
9701
|
}))
|
|
9492
9702
|
}),
|
|
9493
|
-
/* @__PURE__ */ S(
|
|
9703
|
+
/* @__PURE__ */ S(td, {
|
|
9494
9704
|
label: t("settings.sidebar"),
|
|
9495
9705
|
checked: c.showSidebar ?? !1,
|
|
9496
9706
|
onChange: (e) => l((t) => ({
|
|
@@ -9498,7 +9708,7 @@ useSettingsStore.getState().setLanguage(${JSON.stringify(i)})
|
|
|
9498
9708
|
showSidebar: e
|
|
9499
9709
|
}))
|
|
9500
9710
|
}),
|
|
9501
|
-
/* @__PURE__ */ S(
|
|
9711
|
+
/* @__PURE__ */ S(td, {
|
|
9502
9712
|
label: t("settings.fileUploads"),
|
|
9503
9713
|
checked: c.allowFileUploads ?? !1,
|
|
9504
9714
|
onChange: (e) => l((t) => ({
|
|
@@ -9536,7 +9746,7 @@ useSettingsStore.getState().setLanguage(${JSON.stringify(i)})
|
|
|
9536
9746
|
(c.mode === "fullscreen" || c.mode === "mixed") && /* @__PURE__ */ C("div", {
|
|
9537
9747
|
className: "space-y-3 pl-3 border-l-2",
|
|
9538
9748
|
style: { borderColor: "var(--t-accent)" },
|
|
9539
|
-
children: [/* @__PURE__ */ S(
|
|
9749
|
+
children: [/* @__PURE__ */ S(td, {
|
|
9540
9750
|
label: t("settings.fullscreenSheet"),
|
|
9541
9751
|
checked: c.fullscreenSheet ?? !1,
|
|
9542
9752
|
onChange: (e) => l((t) => ({
|
|
@@ -9665,7 +9875,7 @@ useSettingsStore.getState().setLanguage(${JSON.stringify(i)})
|
|
|
9665
9875
|
className: "space-y-3 pl-3 border-l-2",
|
|
9666
9876
|
style: { borderColor: "var(--t-accent)" },
|
|
9667
9877
|
children: [
|
|
9668
|
-
/* @__PURE__ */ S(
|
|
9878
|
+
/* @__PURE__ */ S(td, {
|
|
9669
9879
|
label: t("settings.cta"),
|
|
9670
9880
|
checked: c.showCta ?? !0,
|
|
9671
9881
|
onChange: (e) => l((t) => ({
|
|
@@ -9673,7 +9883,7 @@ useSettingsStore.getState().setLanguage(${JSON.stringify(i)})
|
|
|
9673
9883
|
showCta: e
|
|
9674
9884
|
}))
|
|
9675
9885
|
}),
|
|
9676
|
-
/* @__PURE__ */ S(
|
|
9886
|
+
/* @__PURE__ */ S(td, {
|
|
9677
9887
|
label: t("settings.ctaSound"),
|
|
9678
9888
|
checked: c.ctaSound ?? !0,
|
|
9679
9889
|
onChange: (e) => l((t) => ({
|
|
@@ -9697,7 +9907,7 @@ useSettingsStore.getState().setLanguage(${JSON.stringify(i)})
|
|
|
9697
9907
|
}),
|
|
9698
9908
|
/* @__PURE__ */ S($, {
|
|
9699
9909
|
label: t("settings.toggleButtonIcon"),
|
|
9700
|
-
children: /* @__PURE__ */ S(
|
|
9910
|
+
children: /* @__PURE__ */ S(nd, {
|
|
9701
9911
|
value: c.toggleButtonIcon,
|
|
9702
9912
|
onChange: (e) => l((t) => ({
|
|
9703
9913
|
...t,
|
|
@@ -9709,7 +9919,7 @@ useSettingsStore.getState().setLanguage(${JSON.stringify(i)})
|
|
|
9709
9919
|
]
|
|
9710
9920
|
}),
|
|
9711
9921
|
/* @__PURE__ */ S("hr", { style: { borderColor: "var(--t-bg-border)" } }),
|
|
9712
|
-
/* @__PURE__ */ S(
|
|
9922
|
+
/* @__PURE__ */ S(td, {
|
|
9713
9923
|
label: t("settings.poweredByHide"),
|
|
9714
9924
|
checked: c.poweredByHide ?? !1,
|
|
9715
9925
|
onChange: (e) => l((t) => ({
|
|
@@ -9776,7 +9986,7 @@ useSettingsStore.getState().setLanguage(${JSON.stringify(i)})
|
|
|
9776
9986
|
value: "",
|
|
9777
9987
|
children: "Pick…"
|
|
9778
9988
|
}),
|
|
9779
|
-
|
|
9989
|
+
$u.filter((e) => !E.includes(e.code)).map((e) => /* @__PURE__ */ S("option", {
|
|
9780
9990
|
value: e.code,
|
|
9781
9991
|
children: e.label
|
|
9782
9992
|
}, e.code)),
|
|
@@ -9861,10 +10071,10 @@ useSettingsStore.getState().setLanguage(${JSON.stringify(i)})
|
|
|
9861
10071
|
/* @__PURE__ */ S("div", {
|
|
9862
10072
|
className: "flex justify-between gap-2 px-6 py-4 border-t flex-shrink-0",
|
|
9863
10073
|
style: { borderColor: "var(--t-bg-border)" },
|
|
9864
|
-
children: h ? /* @__PURE__ */ C(x, { children: [/* @__PURE__ */
|
|
10074
|
+
children: h ? /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ C("button", {
|
|
9865
10075
|
onClick: () => g(!1),
|
|
9866
10076
|
className: "px-4 py-2 rounded-lg text-sm text-fg-secondary hover:text-fg-primary hover:bg-bg-surface2 transition-colors",
|
|
9867
|
-
children: "←
|
|
10077
|
+
children: ["← ", t("settings.back")]
|
|
9868
10078
|
}), /* @__PURE__ */ S("button", {
|
|
9869
10079
|
onClick: w,
|
|
9870
10080
|
className: "px-4 py-2 rounded-lg text-sm font-medium transition-colors",
|
|
@@ -9872,11 +10082,11 @@ useSettingsStore.getState().setLanguage(${JSON.stringify(i)})
|
|
|
9872
10082
|
background: "var(--t-accent)",
|
|
9873
10083
|
color: "var(--t-accent-fg)"
|
|
9874
10084
|
},
|
|
9875
|
-
children: _ ?
|
|
10085
|
+
children: _ ? `✓ ${t("settings.copied")}` : t("settings.copyToClipboard")
|
|
9876
10086
|
})] }) : /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S("button", {
|
|
9877
10087
|
onClick: () => g(!0),
|
|
9878
10088
|
className: "px-4 py-2 rounded-lg text-sm text-fg-secondary hover:text-fg-primary hover:bg-bg-surface2 transition-colors",
|
|
9879
|
-
children: "
|
|
10089
|
+
children: t("settings.exportConfig")
|
|
9880
10090
|
}), /* @__PURE__ */ C("div", {
|
|
9881
10091
|
className: "flex gap-2",
|
|
9882
10092
|
children: [/* @__PURE__ */ S("button", {
|
|
@@ -9917,7 +10127,7 @@ function $({ label: e, required: t, error: n, children: r }) {
|
|
|
9917
10127
|
]
|
|
9918
10128
|
});
|
|
9919
10129
|
}
|
|
9920
|
-
function
|
|
10130
|
+
function td({ label: e, checked: t, onChange: n }) {
|
|
9921
10131
|
return /* @__PURE__ */ C("label", {
|
|
9922
10132
|
className: "flex items-center gap-3 cursor-pointer select-none",
|
|
9923
10133
|
children: [/* @__PURE__ */ S("div", {
|
|
@@ -9934,13 +10144,13 @@ function ed({ label: e, checked: t, onChange: n }) {
|
|
|
9934
10144
|
})]
|
|
9935
10145
|
});
|
|
9936
10146
|
}
|
|
9937
|
-
function
|
|
10147
|
+
function nd({ value: e, onChange: t, shape: n }) {
|
|
9938
10148
|
let { t: r } = Fe(), i = v(null), [a, o] = y(""), s = Eu(e), c = n === "circle" ? "rounded-full" : "rounded-lg", l = (e) => {
|
|
9939
10149
|
if (!e.type.startsWith("image/")) {
|
|
9940
10150
|
o(r("settings.avatarErrorType"));
|
|
9941
10151
|
return;
|
|
9942
10152
|
}
|
|
9943
|
-
if (e.size >
|
|
10153
|
+
if (e.size > Qu) {
|
|
9944
10154
|
o(r("settings.avatarErrorSize"));
|
|
9945
10155
|
return;
|
|
9946
10156
|
}
|
|
@@ -10042,7 +10252,7 @@ function td({ value: e, onChange: t, shape: n }) {
|
|
|
10042
10252
|
}
|
|
10043
10253
|
//#endregion
|
|
10044
10254
|
//#region src/components/CtaPopup.tsx
|
|
10045
|
-
function
|
|
10255
|
+
function rd({ text: e, onDismiss: t }) {
|
|
10046
10256
|
return /* @__PURE__ */ C("div", {
|
|
10047
10257
|
className: "absolute bottom-2 right-0 mb-2 w-64 cta-bubble rounded-2xl px-4 py-3 shadow-xl text-sm",
|
|
10048
10258
|
style: {
|
|
@@ -10052,7 +10262,7 @@ function nd({ text: e, onDismiss: t }) {
|
|
|
10052
10262
|
},
|
|
10053
10263
|
children: [/* @__PURE__ */ S("button", {
|
|
10054
10264
|
onClick: t,
|
|
10055
|
-
className: "absolute top-2 right-2 w-5 h-5 rounded-full flex items-center justify-center text-fg-muted hover:text-fg-primary transition-colors text-base leading-none",
|
|
10265
|
+
className: "absolute top-1/2 -translate-y-1/2 right-2 w-5 h-5 rounded-full flex items-center justify-center text-fg-muted hover:text-fg-primary transition-colors text-base leading-none",
|
|
10056
10266
|
"aria-label": "Dismiss",
|
|
10057
10267
|
children: "×"
|
|
10058
10268
|
}), /* @__PURE__ */ S("p", {
|
|
@@ -10063,16 +10273,16 @@ function nd({ text: e, onDismiss: t }) {
|
|
|
10063
10273
|
}
|
|
10064
10274
|
//#endregion
|
|
10065
10275
|
//#region src/App.tsx
|
|
10066
|
-
function
|
|
10067
|
-
let
|
|
10276
|
+
function id() {
|
|
10277
|
+
let e = "(min-width: 768px) and (min-height: 600px)", [t, n] = y(() => window.matchMedia(e).matches);
|
|
10068
10278
|
return g(() => {
|
|
10069
|
-
let
|
|
10070
|
-
return
|
|
10071
|
-
}, []),
|
|
10279
|
+
let t = window.matchMedia(e), r = () => n(t.matches);
|
|
10280
|
+
return t.addEventListener("change", r), () => t.removeEventListener("change", r);
|
|
10281
|
+
}, []), t;
|
|
10072
10282
|
}
|
|
10073
|
-
function
|
|
10283
|
+
function ad() {
|
|
10074
10284
|
Ie(), ze();
|
|
10075
|
-
let e = o((e) => e.config), t = s((e) => e.activeSessionId), n = s((e) => e.createSession), [r, i] = y(!1), [a, c] = y(!1), l = o((e) => e.language), u =
|
|
10285
|
+
let e = o((e) => e.config), t = s((e) => e.activeSessionId), n = s((e) => e.createSession), [r, i] = y(!1), [a, c] = y(!1), l = o((e) => e.language), u = id(), d = e.mode === "window" || e.mode === "mixed" && u, f = e.mode === "fullscreen" && !e.fullscreenSheet, [p, m] = y(f), h = !d && (e.showSidebar ?? !1), _ = e.hideSettings ?? !1, { showCta: v, ctaText: b, dismiss: w } = Re(e, l, !f), T = () => {
|
|
10076
10286
|
_ || i(!0);
|
|
10077
10287
|
};
|
|
10078
10288
|
g(() => {
|
|
@@ -10110,7 +10320,7 @@ function id() {
|
|
|
10110
10320
|
strokeWidth: "2",
|
|
10111
10321
|
children: /* @__PURE__ */ S("path", { d: "M3 12h18M3 6h18M3 18h18" })
|
|
10112
10322
|
})
|
|
10113
|
-
}), /* @__PURE__ */ S(
|
|
10323
|
+
}), /* @__PURE__ */ S(qu, {
|
|
10114
10324
|
onOpenSettings: T,
|
|
10115
10325
|
onClose: f ? void 0 : E
|
|
10116
10326
|
})]
|
|
@@ -10119,34 +10329,35 @@ function id() {
|
|
|
10119
10329
|
});
|
|
10120
10330
|
if (d) return /* @__PURE__ */ C(x, { children: [
|
|
10121
10331
|
p && /* @__PURE__ */ S("div", {
|
|
10122
|
-
className: "fixed bottom-
|
|
10332
|
+
className: "fixed bottom-4 right-4 z-50 w-[380px] rounded-2xl shadow-2xl overflow-hidden flex flex-col",
|
|
10123
10333
|
style: {
|
|
10124
10334
|
border: "1px solid var(--t-bg-border)",
|
|
10125
|
-
background: "var(--t-bg-base)"
|
|
10335
|
+
background: "var(--t-bg-base)",
|
|
10336
|
+
height: "min(560px, calc(100vh - 32px))"
|
|
10126
10337
|
},
|
|
10127
|
-
children: /* @__PURE__ */ S(
|
|
10338
|
+
children: /* @__PURE__ */ S(qu, {
|
|
10128
10339
|
onOpenSettings: T,
|
|
10129
10340
|
onClose: E
|
|
10130
10341
|
})
|
|
10131
10342
|
}),
|
|
10132
10343
|
v && !p && /* @__PURE__ */ S("div", {
|
|
10133
10344
|
className: "fixed bottom-20 right-4 z-50",
|
|
10134
|
-
children: /* @__PURE__ */ S(
|
|
10345
|
+
children: /* @__PURE__ */ S(rd, {
|
|
10135
10346
|
text: b,
|
|
10136
10347
|
onDismiss: w
|
|
10137
10348
|
})
|
|
10138
10349
|
}),
|
|
10139
|
-
/* @__PURE__ */ S(
|
|
10140
|
-
open:
|
|
10350
|
+
!p && /* @__PURE__ */ S(od, {
|
|
10351
|
+
open: !1,
|
|
10141
10352
|
iconSrc: Eu(e.toggleButtonIcon),
|
|
10142
|
-
onClick:
|
|
10353
|
+
onClick: D
|
|
10143
10354
|
}),
|
|
10144
|
-
!_ && r && /* @__PURE__ */ S(
|
|
10355
|
+
!_ && r && /* @__PURE__ */ S(ed, { onClose: () => i(!1) })
|
|
10145
10356
|
] });
|
|
10146
10357
|
if (f) return /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S("div", {
|
|
10147
10358
|
className: "fixed inset-0 z-30",
|
|
10148
10359
|
children: O
|
|
10149
|
-
}), !_ && r && /* @__PURE__ */ S(
|
|
10360
|
+
}), !_ && r && /* @__PURE__ */ S(ed, { onClose: () => i(!1) })] });
|
|
10150
10361
|
let k = e.fullscreenSheetHeight ?? "75vh", A = e.fullscreenSheet === !0;
|
|
10151
10362
|
return /* @__PURE__ */ C(x, { children: [p ? A ? /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S("div", {
|
|
10152
10363
|
className: "fixed inset-0 z-40 pointer-events-none",
|
|
@@ -10173,17 +10384,23 @@ function id() {
|
|
|
10173
10384
|
})] }) : /* @__PURE__ */ S("div", {
|
|
10174
10385
|
className: "fixed inset-0 z-50",
|
|
10175
10386
|
children: O
|
|
10176
|
-
}) : /* @__PURE__ */ S(
|
|
10387
|
+
}) : /* @__PURE__ */ C(x, { children: [v && /* @__PURE__ */ S("div", {
|
|
10388
|
+
className: "fixed bottom-20 right-4 z-50",
|
|
10389
|
+
children: /* @__PURE__ */ S(rd, {
|
|
10390
|
+
text: b,
|
|
10391
|
+
onDismiss: w
|
|
10392
|
+
})
|
|
10393
|
+
}), /* @__PURE__ */ S(od, {
|
|
10177
10394
|
open: !1,
|
|
10178
10395
|
iconSrc: Eu(e.toggleButtonIcon),
|
|
10179
10396
|
onClick: D
|
|
10180
|
-
}), !_ && r && /* @__PURE__ */ S(
|
|
10397
|
+
})] }), !_ && r && /* @__PURE__ */ S(ed, { onClose: () => i(!1) })] });
|
|
10181
10398
|
}
|
|
10182
|
-
function
|
|
10399
|
+
function od({ open: e, iconSrc: t, onClick: n }) {
|
|
10183
10400
|
return /* @__PURE__ */ S("button", {
|
|
10184
10401
|
className: "fixed bottom-4 right-4 z-50 w-14 h-14 rounded-full shadow-lg flex items-center justify-center transition-transform hover:scale-105 overflow-hidden",
|
|
10185
10402
|
style: {
|
|
10186
|
-
background: "var(--t-
|
|
10403
|
+
background: "var(--t-chatbutton-bg)",
|
|
10187
10404
|
color: "var(--t-accent-fg)"
|
|
10188
10405
|
},
|
|
10189
10406
|
onClick: n,
|
|
@@ -10213,17 +10430,17 @@ function ad({ open: e, iconSrc: t, onClick: n }) {
|
|
|
10213
10430
|
}
|
|
10214
10431
|
//#endregion
|
|
10215
10432
|
//#region src/createChat.ts
|
|
10216
|
-
function
|
|
10433
|
+
function sd(e) {
|
|
10217
10434
|
let { target: t, language: n, ...r } = e, i = typeof t == "string" ? document.querySelector(t) : t;
|
|
10218
10435
|
if (!i) throw Error(`[chatui] createChat: target "${String(t)}" not found`);
|
|
10219
10436
|
let a = o.getState();
|
|
10220
10437
|
a.setConfig(r), r.theme && a.setTheme(r.theme), n && a.setLanguage(n);
|
|
10221
10438
|
let s = w(i);
|
|
10222
|
-
return s.render(f(
|
|
10439
|
+
return s.render(f(ad)), { unmount() {
|
|
10223
10440
|
s.unmount();
|
|
10224
10441
|
} };
|
|
10225
10442
|
}
|
|
10226
10443
|
//#endregion
|
|
10227
|
-
export {
|
|
10444
|
+
export { ad as App, sd as createChat };
|
|
10228
10445
|
|
|
10229
10446
|
//# sourceMappingURL=index.js.map
|