gentiq 0.7.30 → 0.7.31
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 +6 -0
- package/dist/{checkbox-DllHCh8Z.js → checkbox-CXJMAW8-.js} +921 -920
- package/dist/gentiq-admin.es.js +1385 -1321
- package/dist/gentiq-index.es.js +709 -705
- package/dist/src/components/ThemeProvider.d.ts +1 -1
- package/dist/src/locales/en.json.d.ts +8 -1
- package/dist/src/locales/fa.json.d.ts +8 -1
- package/dist/src/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/gentiq-index.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as e, jsxs as r, Fragment as ke } from "react/jsx-runtime";
|
|
2
2
|
import * as ne from "react";
|
|
3
|
-
import { useState as
|
|
3
|
+
import { useState as P, useMemo as j, useEffect as O, useRef as te, useCallback as Y, useLayoutEffect as Je } from "react";
|
|
4
4
|
import { QueryClient as Ye, QueryClientProvider as Ze, useQueryClient as pe, useQuery as et, useInfiniteQuery as tt } from "@tanstack/react-query";
|
|
5
5
|
import { I18nextProvider as at, useTranslation as ce } from "react-i18next";
|
|
6
6
|
import { Trans as Ya, Translation as Za, useTranslation as er, withTranslation as tr } from "react-i18next";
|
|
7
|
-
import { g as rt, u as
|
|
8
|
-
import { N as rr, O as nr, P as sr, Q as or, R as ir, U as lr, V as cr, W as dr, X as ur, Y as mr, Z as hr, _ as pr, $ as gr } from "./checkbox-
|
|
7
|
+
import { g as rt, u as D, d as nt, C as Fe, T as st, a as re, b as je, j as be, G as Pe, c as le, e as f, f as ot, h as Oe, i as $e, k as Be, l as Ue, B as Z, m as Ke, n as he, D as He, o as it, p as Ve, L as V, I as X, S as ve, q as xe, r as ye, s as we, t as me, v as lt, w as Te, x as ct, y as dt, z as ut, A as de, E as mt, F as ht, H as pt, J as gt, K as ft, M as bt } from "./checkbox-CXJMAW8-.js";
|
|
8
|
+
import { N as rr, O as nr, P as sr, Q as or, R as ir, U as lr, V as cr, W as dr, X as ur, Y as mr, Z as hr, _ as pr, $ as gr } from "./checkbox-CXJMAW8-.js";
|
|
9
9
|
import { Loader2Icon as vt, OctagonXIcon as xt, TriangleAlertIcon as yt, InfoIcon as wt, CircleCheckIcon as Nt, XIcon as kt, PanelLeftIcon as _t, Layers as Me, User as Ct, ShieldCheck as St, Settings as Ne, Smartphone as Pt, Lock as Tt, Save as Mt, Sun as It, Moon as Dt, Monitor as Et, Zap as Ie, Globe as At, Coins as Lt, LogOut as zt, CirclePlus as Rt, Plus as qt, Search as Ft, Check as jt, X as Ot, Pin as De, MoreVertical as $t, PinOff as Bt, Share2 as Ut, Pencil as Kt, Trash as Ht } from "lucide-react";
|
|
10
10
|
import { useTheme as Vt } from "next-themes";
|
|
11
11
|
import { Toaster as Qt, toast as J } from "sonner";
|
|
@@ -44,104 +44,108 @@ const ea = ({ ...a }) => {
|
|
|
44
44
|
function Ha({
|
|
45
45
|
children: a,
|
|
46
46
|
api: t,
|
|
47
|
-
app:
|
|
48
|
-
i18n:
|
|
49
|
-
components:
|
|
47
|
+
app: i,
|
|
48
|
+
i18n: u,
|
|
49
|
+
components: l,
|
|
50
50
|
history: d,
|
|
51
|
-
welcome:
|
|
52
|
-
threadActions:
|
|
53
|
-
composer:
|
|
54
|
-
theme:
|
|
55
|
-
disclaimer:
|
|
56
|
-
settings:
|
|
51
|
+
welcome: h,
|
|
52
|
+
threadActions: p,
|
|
53
|
+
composer: m,
|
|
54
|
+
theme: N,
|
|
55
|
+
disclaimer: v,
|
|
56
|
+
settings: k
|
|
57
57
|
}) {
|
|
58
|
-
const [
|
|
59
|
-
() =>
|
|
58
|
+
const [s, M] = P(null), T = j(
|
|
59
|
+
() => u?.instance ?? rt,
|
|
60
60
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
|
-
[
|
|
62
|
-
),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}, []),
|
|
66
|
-
|
|
67
|
-
}, [
|
|
68
|
-
const K =
|
|
69
|
-
const
|
|
61
|
+
[u?.instance]
|
|
62
|
+
), q = t || {};
|
|
63
|
+
O(() => {
|
|
64
|
+
D.getAppConfig().then((x) => M(x)).catch((x) => console.debug("Gentiq: No dynamic settings available or fetch failed", x));
|
|
65
|
+
}, []), O(() => {
|
|
66
|
+
s?.app_name && (document.title = T.t(s.app_name));
|
|
67
|
+
}, [s, T]);
|
|
68
|
+
const K = j(() => {
|
|
69
|
+
const x = {
|
|
70
70
|
basePath: "/",
|
|
71
71
|
cacheNamespace: "gentiq",
|
|
72
|
-
...
|
|
72
|
+
...i
|
|
73
73
|
};
|
|
74
|
-
return
|
|
75
|
-
...
|
|
76
|
-
name: (
|
|
77
|
-
adminTitle: (
|
|
78
|
-
version:
|
|
79
|
-
showSettings:
|
|
80
|
-
showVersionInSettings:
|
|
81
|
-
showToolDetails:
|
|
82
|
-
disableSignup:
|
|
83
|
-
disableAuthPage:
|
|
84
|
-
settingsGeneralMode:
|
|
85
|
-
settingsProfileMode:
|
|
86
|
-
settingsAccountMode:
|
|
87
|
-
} :
|
|
88
|
-
}, [
|
|
89
|
-
...p,
|
|
90
|
-
greeting: i.welcome_greeting || p?.greeting,
|
|
91
|
-
subtitle: i.welcome_subtitle || p?.subtitle
|
|
92
|
-
} : p, [p, i]), y = $(() => {
|
|
93
|
-
const u = i?.disclaimer || x;
|
|
94
|
-
return u && P.t(u);
|
|
95
|
-
}, [x, i, P]), f = $(() => i ? {
|
|
96
|
-
...d,
|
|
97
|
-
enabled: i.history_enabled ?? d?.enabled,
|
|
98
|
-
showDelete: i.history_show_delete ?? d?.showDelete,
|
|
99
|
-
showRename: i.history_show_rename ?? d?.showRename,
|
|
100
|
-
showShare: i.history_show_share ?? d?.showShare,
|
|
101
|
-
showPin: i.history_show_pin ?? d?.showPin
|
|
102
|
-
} : d, [d, i]), L = $(() => i ? {
|
|
103
|
-
...g,
|
|
104
|
-
feedback: i.thread_actions_feedback ?? g?.feedback,
|
|
105
|
-
retry: i.thread_actions_retry ?? g?.retry
|
|
106
|
-
} : g, [g, i]), B = $(() => i ? {
|
|
74
|
+
return s ? {
|
|
75
|
+
...x,
|
|
76
|
+
name: (s.app_name ? T.t(s.app_name) : null) || x.name,
|
|
77
|
+
adminTitle: (s.admin_title ? T.t(s.admin_title) : null) || x.adminTitle,
|
|
78
|
+
version: s.app_version || x.version,
|
|
79
|
+
showSettings: s.show_settings ?? x.showSettings,
|
|
80
|
+
showVersionInSettings: s.show_version_in_settings ?? x.showVersionInSettings,
|
|
81
|
+
showToolDetails: s.show_tool_details ?? x.showToolDetails,
|
|
82
|
+
disableSignup: s.disable_signup ?? x.disableSignup,
|
|
83
|
+
disableAuthPage: s.disable_auth_page ?? x.disableAuthPage,
|
|
84
|
+
settingsGeneralMode: s.settings_general_mode || x.settingsGeneralMode,
|
|
85
|
+
settingsProfileMode: s.settings_profile_mode || x.settingsProfileMode,
|
|
86
|
+
settingsAccountMode: s.settings_account_mode || x.settingsAccountMode
|
|
87
|
+
} : x;
|
|
88
|
+
}, [i, s, T]), S = j(() => s ? {
|
|
107
89
|
...h,
|
|
90
|
+
greeting: s.welcome_greeting || h?.greeting,
|
|
91
|
+
subtitle: s.welcome_subtitle || h?.subtitle
|
|
92
|
+
} : h, [h, s]), y = j(() => {
|
|
93
|
+
const x = s?.disclaimer || v;
|
|
94
|
+
return x && T.t(x);
|
|
95
|
+
}, [v, s, T]), g = j(() => s ? {
|
|
96
|
+
...d,
|
|
97
|
+
enabled: s.history_enabled ?? d?.enabled,
|
|
98
|
+
showDelete: s.history_show_delete ?? d?.showDelete,
|
|
99
|
+
showRename: s.history_show_rename ?? d?.showRename,
|
|
100
|
+
showShare: s.history_show_share ?? d?.showShare,
|
|
101
|
+
showPin: s.history_show_pin ?? d?.showPin
|
|
102
|
+
} : d, [d, s]), z = j(() => s ? {
|
|
103
|
+
...p,
|
|
104
|
+
feedback: s.thread_actions_feedback ?? p?.feedback,
|
|
105
|
+
retry: s.thread_actions_retry ?? p?.retry
|
|
106
|
+
} : p, [p, s]), B = j(() => s ? {
|
|
107
|
+
...m,
|
|
108
108
|
attachments: {
|
|
109
|
-
...
|
|
110
|
-
enabled:
|
|
109
|
+
...m?.attachments,
|
|
110
|
+
enabled: s.composer_attachments ?? m?.attachments?.enabled
|
|
111
111
|
}
|
|
112
|
-
} :
|
|
112
|
+
} : m, [m, s]), G = j(() => ({
|
|
113
113
|
...N,
|
|
114
|
+
defaultTheme: s?.default_theme ?? N?.defaultTheme,
|
|
115
|
+
accent: s?.default_accent ?? N?.accent
|
|
116
|
+
}), [N, s]), $ = j(() => s ? {
|
|
117
|
+
...k,
|
|
114
118
|
sections: {
|
|
115
|
-
...
|
|
119
|
+
...k?.sections,
|
|
116
120
|
general: {
|
|
117
|
-
...
|
|
118
|
-
mode:
|
|
119
|
-
enabled:
|
|
121
|
+
...k?.sections?.general,
|
|
122
|
+
mode: s.settings_general_mode || k?.sections?.general?.mode,
|
|
123
|
+
enabled: k?.sections?.general?.enabled ?? !0,
|
|
120
124
|
fields: {
|
|
121
|
-
...
|
|
122
|
-
...
|
|
125
|
+
...k?.sections?.general?.fields,
|
|
126
|
+
...s.settings_general_fields
|
|
123
127
|
}
|
|
124
128
|
},
|
|
125
129
|
profile: {
|
|
126
|
-
...
|
|
127
|
-
mode:
|
|
128
|
-
enabled:
|
|
130
|
+
...k?.sections?.profile,
|
|
131
|
+
mode: s.settings_profile_mode || k?.sections?.profile?.mode,
|
|
132
|
+
enabled: k?.sections?.profile?.enabled ?? !0,
|
|
129
133
|
fields: {
|
|
130
|
-
...
|
|
131
|
-
...
|
|
134
|
+
...k?.sections?.profile?.fields,
|
|
135
|
+
...s.settings_profile_fields
|
|
132
136
|
}
|
|
133
137
|
},
|
|
134
138
|
account: {
|
|
135
|
-
...
|
|
136
|
-
mode:
|
|
137
|
-
enabled:
|
|
139
|
+
...k?.sections?.account,
|
|
140
|
+
mode: s.settings_account_mode || k?.sections?.account?.mode,
|
|
141
|
+
enabled: k?.sections?.account?.enabled ?? !0,
|
|
138
142
|
fields: {
|
|
139
|
-
...
|
|
140
|
-
...
|
|
143
|
+
...k?.sections?.account?.fields,
|
|
144
|
+
...s.settings_account_fields
|
|
141
145
|
}
|
|
142
146
|
}
|
|
143
147
|
}
|
|
144
|
-
} :
|
|
148
|
+
} : k, [k, s]), A = j(() => new Ye({
|
|
145
149
|
defaultOptions: {
|
|
146
150
|
queries: {
|
|
147
151
|
staleTime: 5e3,
|
|
@@ -149,46 +153,46 @@ function Ha({
|
|
|
149
153
|
}
|
|
150
154
|
}
|
|
151
155
|
}), []);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
api:
|
|
156
|
+
O(() => {
|
|
157
|
+
D.init({
|
|
158
|
+
api: q,
|
|
155
159
|
app: K
|
|
156
160
|
});
|
|
157
161
|
}, [K]);
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
Object.entries(
|
|
161
|
-
|
|
162
|
+
const U = te(null), E = u?.resources;
|
|
163
|
+
E !== U.current && (U.current = E, E && Object.entries(E).forEach(([x, c]) => {
|
|
164
|
+
Object.entries(c).forEach(([w, L]) => {
|
|
165
|
+
T.addResourceBundle(x, w, L, !0, !0);
|
|
162
166
|
});
|
|
163
167
|
}));
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
Object.entries(
|
|
167
|
-
|
|
168
|
+
const Q = te(null), R = s?.translations;
|
|
169
|
+
R && R !== Q.current && (Q.current = R, Object.entries(R).forEach(([x, c]) => {
|
|
170
|
+
Object.entries(c).forEach(([w, L]) => {
|
|
171
|
+
T.addResourceBundle(x, w, L, !0, !0);
|
|
168
172
|
});
|
|
169
173
|
}));
|
|
170
|
-
const
|
|
171
|
-
return
|
|
172
|
-
Object.entries(
|
|
173
|
-
|
|
174
|
+
const b = te(null), _ = u?.instance;
|
|
175
|
+
return _ && _ !== b.current && (b.current = _, Object.entries(nt).forEach(([x, c]) => {
|
|
176
|
+
Object.entries(c).forEach(([w, L]) => {
|
|
177
|
+
_.hasResourceBundle(x, w) || _.addResourceBundle(x, w, L, !0, !1);
|
|
174
178
|
});
|
|
175
|
-
})), /* @__PURE__ */ e(at, { i18n:
|
|
179
|
+
})), /* @__PURE__ */ e(at, { i18n: T, children: /* @__PURE__ */ r(Ze, { client: A, children: [
|
|
176
180
|
/* @__PURE__ */ r(
|
|
177
181
|
Fe,
|
|
178
182
|
{
|
|
179
|
-
components:
|
|
180
|
-
history:
|
|
181
|
-
welcome:
|
|
182
|
-
threadActions:
|
|
183
|
+
components: l,
|
|
184
|
+
history: g,
|
|
185
|
+
welcome: S,
|
|
186
|
+
threadActions: z,
|
|
183
187
|
composer: B,
|
|
184
|
-
theme:
|
|
188
|
+
theme: G,
|
|
185
189
|
disclaimer: y,
|
|
186
190
|
app: K,
|
|
187
|
-
i18n:
|
|
188
|
-
settings:
|
|
191
|
+
i18n: u,
|
|
192
|
+
settings: $,
|
|
189
193
|
children: [
|
|
190
194
|
/* @__PURE__ */ e(ta, {}),
|
|
191
|
-
/* @__PURE__ */ e(st, { defaultTheme: "system", storageKey: "chatbot-theme", config:
|
|
195
|
+
/* @__PURE__ */ e(st, { defaultTheme: "system", storageKey: "chatbot-theme", config: G, children: a })
|
|
192
196
|
]
|
|
193
197
|
}
|
|
194
198
|
),
|
|
@@ -197,66 +201,66 @@ function Ha({
|
|
|
197
201
|
}
|
|
198
202
|
function ta() {
|
|
199
203
|
const { app: a } = re();
|
|
200
|
-
return je(),
|
|
204
|
+
return je(), O(() => {
|
|
201
205
|
a?.name && (document.title = a.name);
|
|
202
|
-
}, [a?.name]),
|
|
206
|
+
}, [a?.name]), O(() => {
|
|
203
207
|
if (!a?.favicon) return;
|
|
204
208
|
let t = document.querySelector("link[rel~='icon']");
|
|
205
209
|
t || (t = document.createElement("link"), t.rel = "icon", document.head.appendChild(t)), t.href = a.favicon;
|
|
206
210
|
}, [a?.favicon]), null;
|
|
207
211
|
}
|
|
208
212
|
function Ce() {
|
|
209
|
-
const a = Qe(), t = _e(),
|
|
210
|
-
const
|
|
211
|
-
if (
|
|
212
|
-
if (
|
|
213
|
-
let
|
|
214
|
-
return
|
|
213
|
+
const a = Qe(), t = _e(), u = D.getConfig().app?.basePath || "/", l = j(() => {
|
|
214
|
+
const h = a.pathname, p = h.endsWith("/") && h !== "/" ? h.slice(0, -1) : h, m = u.endsWith("/") && u !== "/" ? u.slice(0, -1) : u;
|
|
215
|
+
if (p === (m || "/")) return "/";
|
|
216
|
+
if (h.startsWith(m) && m !== "/") {
|
|
217
|
+
let N = h.slice(m.length);
|
|
218
|
+
return N.startsWith("/") || (N = "/" + N), N;
|
|
215
219
|
}
|
|
216
|
-
return
|
|
217
|
-
}, [a.pathname,
|
|
218
|
-
t(be(
|
|
219
|
-
}, [t,
|
|
220
|
-
return [
|
|
220
|
+
return m === "/" ? h : "/";
|
|
221
|
+
}, [a.pathname, u]), d = Y((h) => {
|
|
222
|
+
t(be(u, h || "/"), { replace: !1 });
|
|
223
|
+
}, [t, u]);
|
|
224
|
+
return [l, d];
|
|
221
225
|
}
|
|
222
226
|
function aa({ onFinish: a } = {}) {
|
|
223
|
-
const { t } = ce(["chat", "errors"]),
|
|
224
|
-
|
|
225
|
-
d === "/" ?
|
|
227
|
+
const { t } = ce(["chat", "errors"]), i = pe(), u = D.getConfig(), l = u.app?.cacheNamespace || "gentiq", [d, h] = Ce(), [p, m] = P(() => ue()), N = te(/* @__PURE__ */ new Set());
|
|
228
|
+
O(() => {
|
|
229
|
+
d === "/" ? m(ue()) : p && d !== `/${p}` && m(ue());
|
|
226
230
|
}, [d]);
|
|
227
|
-
const
|
|
228
|
-
|
|
231
|
+
const v = j(() => d === "/" ? p : d.replace(/^\//, ""), [d, p]), k = Y((b) => (N.current.add(b), b), []), s = Y(() => {
|
|
232
|
+
N.current.forEach((b) => URL.revokeObjectURL(b)), N.current.clear();
|
|
229
233
|
}, []);
|
|
230
|
-
|
|
234
|
+
O(() => () => s(), [s]);
|
|
231
235
|
const {
|
|
232
|
-
data:
|
|
233
|
-
isLoading:
|
|
234
|
-
isError:
|
|
236
|
+
data: M,
|
|
237
|
+
isLoading: T,
|
|
238
|
+
isError: q
|
|
235
239
|
} = et({
|
|
236
|
-
queryKey: [
|
|
240
|
+
queryKey: [l, "threadMessages", v],
|
|
237
241
|
queryFn: async () => {
|
|
238
242
|
if (d === "/") return [];
|
|
239
|
-
if (d === `/${
|
|
240
|
-
const b = await
|
|
243
|
+
if (d === `/${p}`) return [];
|
|
244
|
+
const b = await D.getThreadMessages(v);
|
|
241
245
|
return !b.items || !Array.isArray(b.items) ? [] : Promise.all(
|
|
242
|
-
b.items.map(async (
|
|
243
|
-
const
|
|
244
|
-
w.map(async (
|
|
245
|
-
if (
|
|
246
|
+
b.items.map(async (_) => {
|
|
247
|
+
const x = typeof _.content == "string" ? _.content : _.content?.text || JSON.stringify(_.content), w = [...Array.isArray(_.parts) && _.parts.length > 0 ? _.parts : [{ type: "text", text: x }]].sort((C, I) => C.type === "file" && I.type !== "file" ? -1 : C.type !== "file" && I.type === "file" ? 1 : 0), L = await Promise.all(
|
|
248
|
+
w.map(async (C) => {
|
|
249
|
+
if (C.type === "file" && C.object_name && !C.url)
|
|
246
250
|
try {
|
|
247
|
-
const
|
|
248
|
-
return { ...
|
|
249
|
-
} catch (
|
|
250
|
-
return console.warn("Load attachment failed:",
|
|
251
|
+
const I = await D.getAttachmentBlobUrl(C.object_name);
|
|
252
|
+
return { ...C, url: k(I), mediaType: C.mediaType || C.media_type };
|
|
253
|
+
} catch (I) {
|
|
254
|
+
return console.warn("Load attachment failed:", C.object_name, I), { ...C, mediaType: C.mediaType || C.media_type };
|
|
251
255
|
}
|
|
252
|
-
return
|
|
256
|
+
return C;
|
|
253
257
|
})
|
|
254
258
|
);
|
|
255
259
|
return {
|
|
256
|
-
id:
|
|
257
|
-
role:
|
|
258
|
-
parts:
|
|
259
|
-
metadata: { feedback:
|
|
260
|
+
id: _.id || ue(),
|
|
261
|
+
role: _.role,
|
|
262
|
+
parts: L,
|
|
263
|
+
metadata: { feedback: _.feedback }
|
|
260
264
|
};
|
|
261
265
|
})
|
|
262
266
|
);
|
|
@@ -264,91 +268,91 @@ function aa({ onFinish: a } = {}) {
|
|
|
264
268
|
enabled: d !== "/",
|
|
265
269
|
staleTime: 5e3
|
|
266
270
|
// Keep history fresh for 5 seconds
|
|
267
|
-
}), K =
|
|
268
|
-
api:
|
|
269
|
-
fetch: async (b,
|
|
270
|
-
const
|
|
271
|
-
Object.entries(
|
|
272
|
-
|
|
273
|
-
}),
|
|
274
|
-
const w =
|
|
275
|
-
if (!
|
|
276
|
-
const
|
|
277
|
-
if (
|
|
278
|
-
throw new Pe(
|
|
279
|
-
let
|
|
280
|
-
throw typeof
|
|
271
|
+
}), K = j(() => new Wt({
|
|
272
|
+
api: D.getEndpoint("chat", "/chat"),
|
|
273
|
+
fetch: async (b, _) => {
|
|
274
|
+
const x = new Headers(_?.headers), c = D.getHeaders();
|
|
275
|
+
Object.entries(c).forEach(([I, W]) => {
|
|
276
|
+
x.set(I, W);
|
|
277
|
+
}), x.set("X-Thread-Id", v);
|
|
278
|
+
const w = u.api?.basePath || "/api", L = typeof b == "string" && !b.startsWith("http") ? `${w}${b.startsWith("/") ? b : "/" + b}` : b, C = await fetch(L, { ..._, headers: x });
|
|
279
|
+
if (!C.ok) {
|
|
280
|
+
const I = await C.json().catch(() => ({}));
|
|
281
|
+
if (I.error && (typeof I.error.code == "string" || typeof I.error.message == "string"))
|
|
282
|
+
throw new Pe(I, C.status);
|
|
283
|
+
let W = C.statusText || `HTTP ${C.status}`, ae = "error", ee = null;
|
|
284
|
+
throw typeof I.detail == "string" ? W = I.detail : typeof I.message == "string" ? W = I.message : typeof I.error == "string" ? W = I.error : Array.isArray(I.detail) ? (W = "Validation failed", ee = I.detail, ae = "validation_error") : I.error && typeof I.error.message == "string" && (W = I.error.message), new Pe({
|
|
281
285
|
error: {
|
|
282
286
|
code: ae,
|
|
283
|
-
message:
|
|
287
|
+
message: W,
|
|
284
288
|
details: ee
|
|
285
289
|
}
|
|
286
|
-
},
|
|
290
|
+
}, C.status);
|
|
287
291
|
}
|
|
288
|
-
return
|
|
292
|
+
return C;
|
|
289
293
|
}
|
|
290
|
-
}), [
|
|
291
|
-
|
|
292
|
-
}, [
|
|
293
|
-
id:
|
|
294
|
-
onFinish:
|
|
294
|
+
}), [v, u.api?.basePath]), S = Y(() => {
|
|
295
|
+
z("ready"), i.invalidateQueries({ queryKey: [l, "conversations"] }), a?.();
|
|
296
|
+
}, [i, a, l]), y = Gt({
|
|
297
|
+
id: v,
|
|
298
|
+
onFinish: S,
|
|
295
299
|
transport: K
|
|
296
|
-
}), [
|
|
297
|
-
|
|
300
|
+
}), [g, z] = P("idle"), [B, G] = P(null), $ = Y(() => {
|
|
301
|
+
G(null);
|
|
298
302
|
}, []);
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}, [
|
|
302
|
-
d === "/" && (y.setMessages([]),
|
|
303
|
-
}, [d, y.setMessages]),
|
|
303
|
+
O(() => {
|
|
304
|
+
M && (d === `/${p}` || (y.setMessages(M), z("ready")));
|
|
305
|
+
}, [M, y.setMessages, d, p]), O(() => {
|
|
306
|
+
d === "/" && (y.setMessages([]), z("idle"));
|
|
307
|
+
}, [d, y.setMessages]), O(() => {
|
|
304
308
|
if (d === "/") {
|
|
305
|
-
|
|
309
|
+
z("idle");
|
|
306
310
|
return;
|
|
307
311
|
}
|
|
308
|
-
const b = d === `/${
|
|
309
|
-
|
|
310
|
-
}, [
|
|
312
|
+
const b = d === `/${p}`;
|
|
313
|
+
T && !b ? z("loading-history") : q || B || y.error ? z("error") : y.status === "streaming" || y.status === "submitted" ? z(y.status) : z("ready");
|
|
314
|
+
}, [T, q, y.status, B, y.error, d, p]), O(() => () => {
|
|
311
315
|
y.stop();
|
|
312
|
-
}, [
|
|
313
|
-
const
|
|
314
|
-
|
|
316
|
+
}, [v, y.stop]);
|
|
317
|
+
const A = te(/* @__PURE__ */ new Set()), U = j(() => y.messages.filter((b) => b.role === "assistant"), [y.messages]);
|
|
318
|
+
O(() => {
|
|
315
319
|
let b = !1;
|
|
316
|
-
for (const
|
|
317
|
-
if (
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
+
for (const _ of U) {
|
|
321
|
+
if (A.current.has(_.id)) continue;
|
|
322
|
+
const x = _.parts.find((c) => c.type === "data-title");
|
|
323
|
+
x && x.data?.[0]?.title && (A.current.add(_.id), b = !0);
|
|
320
324
|
}
|
|
321
|
-
b &&
|
|
322
|
-
}, [
|
|
323
|
-
const
|
|
324
|
-
const
|
|
325
|
-
if (!(!
|
|
326
|
-
if (y.stop(),
|
|
327
|
-
|
|
328
|
-
const w =
|
|
329
|
-
|
|
330
|
-
const
|
|
331
|
-
return
|
|
332
|
-
...
|
|
333
|
-
pages:
|
|
334
|
-
...
|
|
335
|
-
threads: [
|
|
336
|
-
} :
|
|
337
|
-
} : [
|
|
325
|
+
b && i.invalidateQueries({ queryKey: [l, "conversations"] });
|
|
326
|
+
}, [U, i, l]);
|
|
327
|
+
const E = Y(async (b, _) => {
|
|
328
|
+
const x = d === "/", c = b.trim();
|
|
329
|
+
if (!(!c && (!_ || _.length === 0)) && !(g === "loading-history" || g === "streaming" || g === "submitted")) {
|
|
330
|
+
if (y.stop(), x) {
|
|
331
|
+
h(`/${v}`);
|
|
332
|
+
const w = c || t("attach_file"), L = w.length > 30 ? w.slice(0, 30) + "..." : w;
|
|
333
|
+
i.setQueryData([l, "conversations"], (C) => {
|
|
334
|
+
const I = { id: `/${v}`, firstMessage: L, timestamp: Date.now() };
|
|
335
|
+
return C && Array.isArray(C.pages) ? {
|
|
336
|
+
...C,
|
|
337
|
+
pages: C.pages.map((W, ae) => ae === 0 ? {
|
|
338
|
+
...W,
|
|
339
|
+
threads: [I, ...W.threads || []]
|
|
340
|
+
} : W)
|
|
341
|
+
} : [I, ...Array.isArray(C) ? C : []];
|
|
338
342
|
});
|
|
339
343
|
}
|
|
340
|
-
|
|
344
|
+
z("submitted"), G(null);
|
|
341
345
|
try {
|
|
342
|
-
await y.sendMessage({ text:
|
|
346
|
+
await y.sendMessage({ text: c, files: _ });
|
|
343
347
|
} catch (w) {
|
|
344
348
|
console.error("Failed to send message:", w);
|
|
345
|
-
const
|
|
346
|
-
|
|
349
|
+
const L = le(w, t);
|
|
350
|
+
G(new Error(L)), z("error");
|
|
347
351
|
}
|
|
348
352
|
}
|
|
349
|
-
}, [y,
|
|
350
|
-
y.stop(),
|
|
351
|
-
}, [y.stop,
|
|
353
|
+
}, [y, h, d, v, t, i, g, l]), Q = Y(() => {
|
|
354
|
+
y.stop(), z("ready"), i.invalidateQueries({ queryKey: [l, "conversations"] });
|
|
355
|
+
}, [y.stop, i, l]), R = j(() => {
|
|
352
356
|
if (B) return B;
|
|
353
357
|
if (y.error) {
|
|
354
358
|
const b = le(y.error, t);
|
|
@@ -356,60 +360,60 @@ function aa({ onFinish: a } = {}) {
|
|
|
356
360
|
}
|
|
357
361
|
return null;
|
|
358
362
|
}, [B, y.error, t]);
|
|
359
|
-
return
|
|
363
|
+
return j(() => ({
|
|
360
364
|
...y,
|
|
361
|
-
sendMessage:
|
|
362
|
-
stop:
|
|
363
|
-
clearError:
|
|
364
|
-
error:
|
|
365
|
-
status:
|
|
365
|
+
sendMessage: E,
|
|
366
|
+
stop: Q,
|
|
367
|
+
clearError: $,
|
|
368
|
+
error: R,
|
|
369
|
+
status: g,
|
|
366
370
|
// Cast to any to satisfy Chat.tsx expectations of AI SDK statuses
|
|
367
|
-
isLoadingHistory:
|
|
368
|
-
isErrorHistory:
|
|
371
|
+
isLoadingHistory: g === "loading-history",
|
|
372
|
+
isErrorHistory: g === "error" || !!R || q,
|
|
369
373
|
conversationId: d
|
|
370
|
-
}), [y,
|
|
374
|
+
}), [y, E, Q, $, R, g, q, d]);
|
|
371
375
|
}
|
|
372
376
|
function ra({ classNames: a = {}, disclaimer: t }) {
|
|
373
|
-
const { t:
|
|
377
|
+
const { t: i, i18n: u } = ce(["chat", "translation"]), l = aa(), { messages: d, status: h, regenerate: p, error: m, clearError: N, stop: v, isLoadingHistory: k, conversationId: s, sendMessage: M } = l, { MessageList: T, PromptInput: q, disclaimer: K } = re(), S = t ?? K, y = u.exists("chat:disclaimer") ? i("chat:disclaimer") : null, g = typeof S == "string" ? i(S) : S ?? y, [z, B] = P(null), G = te(h);
|
|
374
378
|
Je(() => {
|
|
375
|
-
|
|
376
|
-
}, [
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
}, [
|
|
381
|
-
const
|
|
382
|
-
return /* @__PURE__ */ r("div", { className:
|
|
379
|
+
m && N();
|
|
380
|
+
}, [s, N, m]);
|
|
381
|
+
const $ = d[d.length - 1], A = $?.role === "assistant" && (h === "ready" || $.parts.some((E) => E.type === "data-chat-finished"));
|
|
382
|
+
O(() => {
|
|
383
|
+
h === "error" && G.current !== "error" && z !== s ? B(s) : h === "submitted" && z !== null && B(null), G.current = h;
|
|
384
|
+
}, [h, s]);
|
|
385
|
+
const U = h === "error" && (s === "/" || z === s);
|
|
386
|
+
return /* @__PURE__ */ r("div", { className: f("relative flex flex-col h-full overflow-hidden", a.container), children: [
|
|
383
387
|
/* @__PURE__ */ e(
|
|
384
|
-
|
|
388
|
+
T,
|
|
385
389
|
{
|
|
386
390
|
messages: d,
|
|
387
|
-
status:
|
|
388
|
-
isLoadingHistory:
|
|
389
|
-
error:
|
|
390
|
-
conversationId:
|
|
391
|
-
regen: (
|
|
392
|
-
onSuggestionClick: (
|
|
393
|
-
chat:
|
|
394
|
-
className:
|
|
391
|
+
status: h,
|
|
392
|
+
isLoadingHistory: k,
|
|
393
|
+
error: U ? m : null,
|
|
394
|
+
conversationId: s,
|
|
395
|
+
regen: (E) => p({ messageId: E }),
|
|
396
|
+
onSuggestionClick: (E) => M(E),
|
|
397
|
+
chat: l,
|
|
398
|
+
className: f("flex-1", a.messageList)
|
|
395
399
|
}
|
|
396
400
|
),
|
|
397
401
|
/* @__PURE__ */ r("div", { className: "absolute bottom-0 left-0 right-0 z-10 pointer-events-none flex flex-col items-stretch", children: [
|
|
398
402
|
/* @__PURE__ */ e(
|
|
399
|
-
|
|
403
|
+
q,
|
|
400
404
|
{
|
|
401
|
-
onSend:
|
|
402
|
-
status:
|
|
403
|
-
isLastMessageFinished:
|
|
404
|
-
stop:
|
|
405
|
-
isErrorVisible:
|
|
406
|
-
conversationId:
|
|
407
|
-
className:
|
|
405
|
+
onSend: M,
|
|
406
|
+
status: h,
|
|
407
|
+
isLastMessageFinished: A,
|
|
408
|
+
stop: v,
|
|
409
|
+
isErrorVisible: U,
|
|
410
|
+
conversationId: s,
|
|
411
|
+
className: f("pointer-events-auto", a.inputArea, g && "pb-0 md:pb-0")
|
|
408
412
|
}
|
|
409
413
|
),
|
|
410
|
-
|
|
414
|
+
g && /* @__PURE__ */ r("div", { className: "relative py-1 px-4 flex justify-center items-center pointer-events-auto", children: [
|
|
411
415
|
/* @__PURE__ */ e("div", { className: "absolute inset-x-0 bottom-0 top-[-20px] bg-background/80 backdrop-blur-sm [mask-image:linear-gradient(to_top,black_60%,transparent)] pointer-events-none -z-10" }),
|
|
412
|
-
/* @__PURE__ */ e("p", { className: "text-[10px] md:text-[11px] text-muted-foreground/60 select-none text-center leading-tight", children:
|
|
416
|
+
/* @__PURE__ */ e("p", { className: "text-[10px] md:text-[11px] text-muted-foreground/60 select-none text-center leading-tight", children: g })
|
|
413
417
|
] })
|
|
414
418
|
] })
|
|
415
419
|
] });
|
|
@@ -417,35 +421,35 @@ function ra({ classNames: a = {}, disclaimer: t }) {
|
|
|
417
421
|
const na = ({
|
|
418
422
|
components: a,
|
|
419
423
|
history: t,
|
|
420
|
-
welcome:
|
|
421
|
-
threadActions:
|
|
422
|
-
composer:
|
|
424
|
+
welcome: i,
|
|
425
|
+
threadActions: u,
|
|
426
|
+
composer: l,
|
|
423
427
|
theme: d,
|
|
424
|
-
disclaimer:
|
|
425
|
-
...
|
|
428
|
+
disclaimer: h,
|
|
429
|
+
...p
|
|
426
430
|
}) => {
|
|
427
|
-
const
|
|
428
|
-
...
|
|
431
|
+
const m = re(), N = j(() => ({
|
|
432
|
+
...m,
|
|
429
433
|
...a,
|
|
430
434
|
toolComponents: {
|
|
431
|
-
...
|
|
435
|
+
...m.toolComponents,
|
|
432
436
|
...a?.toolComponents
|
|
433
437
|
}
|
|
434
|
-
}), [
|
|
438
|
+
}), [m, a]);
|
|
435
439
|
return /* @__PURE__ */ e(
|
|
436
440
|
Fe,
|
|
437
441
|
{
|
|
438
|
-
components:
|
|
439
|
-
history: t ??
|
|
440
|
-
welcome:
|
|
441
|
-
threadActions:
|
|
442
|
-
composer:
|
|
443
|
-
theme: d ??
|
|
444
|
-
disclaimer:
|
|
445
|
-
app:
|
|
446
|
-
i18n:
|
|
447
|
-
settings:
|
|
448
|
-
children: /* @__PURE__ */ e(ra, { ...
|
|
442
|
+
components: N,
|
|
443
|
+
history: t ?? m.history,
|
|
444
|
+
welcome: i ?? m.welcome,
|
|
445
|
+
threadActions: u ?? m.threadActions,
|
|
446
|
+
composer: l ?? m.composer,
|
|
447
|
+
theme: d ?? m.theme,
|
|
448
|
+
disclaimer: h ?? m.disclaimer,
|
|
449
|
+
app: m.app,
|
|
450
|
+
i18n: m.i18n,
|
|
451
|
+
settings: m.settings,
|
|
452
|
+
children: /* @__PURE__ */ e(ra, { ...p })
|
|
449
453
|
}
|
|
450
454
|
);
|
|
451
455
|
};
|
|
@@ -460,7 +464,7 @@ function ia({ className: a, ...t }) {
|
|
|
460
464
|
se.Overlay,
|
|
461
465
|
{
|
|
462
466
|
"data-slot": "sheet-overlay",
|
|
463
|
-
className:
|
|
467
|
+
className: f(
|
|
464
468
|
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
465
469
|
a
|
|
466
470
|
),
|
|
@@ -471,8 +475,8 @@ function ia({ className: a, ...t }) {
|
|
|
471
475
|
function la({
|
|
472
476
|
className: a,
|
|
473
477
|
children: t,
|
|
474
|
-
side:
|
|
475
|
-
...
|
|
478
|
+
side: i = "right",
|
|
479
|
+
...u
|
|
476
480
|
}) {
|
|
477
481
|
return /* @__PURE__ */ r(oa, { children: [
|
|
478
482
|
/* @__PURE__ */ e(ia, {}),
|
|
@@ -480,15 +484,15 @@ function la({
|
|
|
480
484
|
se.Content,
|
|
481
485
|
{
|
|
482
486
|
"data-slot": "sheet-content",
|
|
483
|
-
className:
|
|
487
|
+
className: f(
|
|
484
488
|
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
+
i === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
|
|
490
|
+
i === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
|
|
491
|
+
i === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
|
|
492
|
+
i === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
|
|
489
493
|
a
|
|
490
494
|
),
|
|
491
|
-
...
|
|
495
|
+
...u,
|
|
492
496
|
children: [
|
|
493
497
|
t,
|
|
494
498
|
/* @__PURE__ */ r(se.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [
|
|
@@ -501,14 +505,14 @@ function la({
|
|
|
501
505
|
] });
|
|
502
506
|
}
|
|
503
507
|
function ca({ className: a, ...t }) {
|
|
504
|
-
return /* @__PURE__ */ e("div", { "data-slot": "sheet-header", className:
|
|
508
|
+
return /* @__PURE__ */ e("div", { "data-slot": "sheet-header", className: f("flex flex-col gap-1.5 p-4", a), ...t });
|
|
505
509
|
}
|
|
506
510
|
function da({ className: a, ...t }) {
|
|
507
511
|
return /* @__PURE__ */ e(
|
|
508
512
|
se.Title,
|
|
509
513
|
{
|
|
510
514
|
"data-slot": "sheet-title",
|
|
511
|
-
className:
|
|
515
|
+
className: f("text-foreground font-semibold", a),
|
|
512
516
|
...t
|
|
513
517
|
}
|
|
514
518
|
);
|
|
@@ -518,7 +522,7 @@ function ua({ className: a, ...t }) {
|
|
|
518
522
|
se.Description,
|
|
519
523
|
{
|
|
520
524
|
"data-slot": "sheet-description",
|
|
521
|
-
className:
|
|
525
|
+
className: f("text-muted-foreground text-sm", a),
|
|
522
526
|
...t
|
|
523
527
|
}
|
|
524
528
|
);
|
|
@@ -533,40 +537,40 @@ function ge() {
|
|
|
533
537
|
function va({
|
|
534
538
|
defaultOpen: a = !0,
|
|
535
539
|
open: t,
|
|
536
|
-
onOpenChange:
|
|
537
|
-
className:
|
|
538
|
-
style:
|
|
540
|
+
onOpenChange: i,
|
|
541
|
+
className: u,
|
|
542
|
+
style: l,
|
|
539
543
|
children: d,
|
|
540
|
-
...
|
|
544
|
+
...h
|
|
541
545
|
}) {
|
|
542
|
-
const
|
|
543
|
-
(
|
|
544
|
-
const y = typeof
|
|
545
|
-
|
|
546
|
+
const p = ot(), [m, N] = ne.useState(!1), [v, k] = ne.useState(a), s = t ?? v, M = ne.useCallback(
|
|
547
|
+
(S) => {
|
|
548
|
+
const y = typeof S == "function" ? S(s) : S;
|
|
549
|
+
i ? i(y) : k(y), document.cookie = `${ma}=${y}; path=/; max-age=${ha}`;
|
|
546
550
|
},
|
|
547
|
-
[
|
|
548
|
-
),
|
|
549
|
-
|
|
550
|
-
}, [
|
|
551
|
+
[i, s]
|
|
552
|
+
), T = ne.useCallback(() => {
|
|
553
|
+
p ? N((S) => !S) : M((S) => !S);
|
|
554
|
+
}, [p, M, N]);
|
|
551
555
|
ne.useEffect(() => {
|
|
552
|
-
const
|
|
553
|
-
y.key === ba && (y.metaKey || y.ctrlKey) && (y.preventDefault(),
|
|
556
|
+
const S = (y) => {
|
|
557
|
+
y.key === ba && (y.metaKey || y.ctrlKey) && (y.preventDefault(), T());
|
|
554
558
|
};
|
|
555
|
-
return window.addEventListener("keydown",
|
|
556
|
-
window.removeEventListener("keydown",
|
|
559
|
+
return window.addEventListener("keydown", S), () => {
|
|
560
|
+
window.removeEventListener("keydown", S);
|
|
557
561
|
};
|
|
558
|
-
}, [
|
|
559
|
-
const
|
|
562
|
+
}, [T]);
|
|
563
|
+
const q = s ? "expanded" : "collapsed", K = ne.useMemo(
|
|
560
564
|
() => ({
|
|
561
|
-
state:
|
|
562
|
-
open:
|
|
563
|
-
setOpen:
|
|
564
|
-
isMobile:
|
|
565
|
-
openMobile:
|
|
566
|
-
setOpenMobile:
|
|
567
|
-
toggleSidebar:
|
|
565
|
+
state: q,
|
|
566
|
+
open: s,
|
|
567
|
+
setOpen: M,
|
|
568
|
+
isMobile: p,
|
|
569
|
+
openMobile: m,
|
|
570
|
+
setOpenMobile: N,
|
|
571
|
+
toggleSidebar: T
|
|
568
572
|
}),
|
|
569
|
-
[
|
|
573
|
+
[q, s, M, p, m, N, T]
|
|
570
574
|
);
|
|
571
575
|
return /* @__PURE__ */ e(Ge.Provider, { value: K, children: /* @__PURE__ */ e(Oe, { delayDuration: 0, children: /* @__PURE__ */ e(
|
|
572
576
|
"div",
|
|
@@ -575,10 +579,10 @@ function va({
|
|
|
575
579
|
style: {
|
|
576
580
|
"--sidebar-width": pa,
|
|
577
581
|
"--sidebar-width-icon": fa,
|
|
578
|
-
...
|
|
582
|
+
...l
|
|
579
583
|
},
|
|
580
|
-
className:
|
|
581
|
-
...
|
|
584
|
+
className: f("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full", u),
|
|
585
|
+
...h,
|
|
582
586
|
children: d
|
|
583
587
|
}
|
|
584
588
|
) }) });
|
|
@@ -586,24 +590,24 @@ function va({
|
|
|
586
590
|
function xa({
|
|
587
591
|
side: a = "left",
|
|
588
592
|
variant: t = "sidebar",
|
|
589
|
-
collapsible:
|
|
590
|
-
className:
|
|
591
|
-
children:
|
|
593
|
+
collapsible: i = "offcanvas",
|
|
594
|
+
className: u,
|
|
595
|
+
children: l,
|
|
592
596
|
...d
|
|
593
597
|
}) {
|
|
594
|
-
const { isMobile:
|
|
595
|
-
return
|
|
598
|
+
const { isMobile: h, state: p, openMobile: m, setOpenMobile: N } = ge();
|
|
599
|
+
return i === "none" ? /* @__PURE__ */ e(
|
|
596
600
|
"div",
|
|
597
601
|
{
|
|
598
602
|
"data-slot": "sidebar",
|
|
599
|
-
className:
|
|
603
|
+
className: f("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col", u),
|
|
600
604
|
...d,
|
|
601
|
-
children:
|
|
605
|
+
children: l
|
|
602
606
|
}
|
|
603
|
-
) :
|
|
607
|
+
) : h ? /* @__PURE__ */ e(sa, { open: m, onOpenChange: N, ...d, children: /* @__PURE__ */ r(
|
|
604
608
|
la,
|
|
605
609
|
{
|
|
606
|
-
onOpenAutoFocus: (
|
|
610
|
+
onOpenAutoFocus: (v) => v.preventDefault(),
|
|
607
611
|
"data-sidebar": "sidebar",
|
|
608
612
|
"data-slot": "sidebar",
|
|
609
613
|
"data-mobile": "true",
|
|
@@ -617,15 +621,15 @@ function xa({
|
|
|
617
621
|
/* @__PURE__ */ e(da, { children: "Sidebar" }),
|
|
618
622
|
/* @__PURE__ */ e(ua, { children: "Displays the mobile sidebar." })
|
|
619
623
|
] }),
|
|
620
|
-
/* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col", children:
|
|
624
|
+
/* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col", children: l })
|
|
621
625
|
]
|
|
622
626
|
}
|
|
623
627
|
) }) : /* @__PURE__ */ r(
|
|
624
628
|
"div",
|
|
625
629
|
{
|
|
626
630
|
className: "group peer text-sidebar-foreground hidden md:block",
|
|
627
|
-
"data-state":
|
|
628
|
-
"data-collapsible":
|
|
631
|
+
"data-state": p,
|
|
632
|
+
"data-collapsible": p === "collapsed" ? i : "",
|
|
629
633
|
"data-variant": t,
|
|
630
634
|
"data-side": a,
|
|
631
635
|
"data-slot": "sidebar",
|
|
@@ -634,7 +638,7 @@ function xa({
|
|
|
634
638
|
"div",
|
|
635
639
|
{
|
|
636
640
|
"data-slot": "sidebar-gap",
|
|
637
|
-
className:
|
|
641
|
+
className: f(
|
|
638
642
|
"relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
|
|
639
643
|
"group-data-[collapsible=offcanvas]:w-0",
|
|
640
644
|
"group-data-[side=right]:rotate-180",
|
|
@@ -646,12 +650,12 @@ function xa({
|
|
|
646
650
|
"div",
|
|
647
651
|
{
|
|
648
652
|
"data-slot": "sidebar-container",
|
|
649
|
-
className:
|
|
653
|
+
className: f(
|
|
650
654
|
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
|
|
651
655
|
a === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
652
656
|
// Adjust the padding for floating and inset variants.
|
|
653
657
|
t === "floating" || t === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
|
|
654
|
-
|
|
658
|
+
u
|
|
655
659
|
),
|
|
656
660
|
...d,
|
|
657
661
|
children: /* @__PURE__ */ e(
|
|
@@ -660,7 +664,7 @@ function xa({
|
|
|
660
664
|
"data-sidebar": "sidebar",
|
|
661
665
|
"data-slot": "sidebar-inner",
|
|
662
666
|
className: "bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",
|
|
663
|
-
children:
|
|
667
|
+
children: l
|
|
664
668
|
}
|
|
665
669
|
)
|
|
666
670
|
}
|
|
@@ -669,8 +673,8 @@ function xa({
|
|
|
669
673
|
}
|
|
670
674
|
);
|
|
671
675
|
}
|
|
672
|
-
function ya({ className: a, onClick: t, ...
|
|
673
|
-
const { toggleSidebar:
|
|
676
|
+
function ya({ className: a, onClick: t, ...i }) {
|
|
677
|
+
const { toggleSidebar: u } = ge();
|
|
674
678
|
return /* @__PURE__ */ r(
|
|
675
679
|
Z,
|
|
676
680
|
{
|
|
@@ -678,11 +682,11 @@ function ya({ className: a, onClick: t, ...o }) {
|
|
|
678
682
|
"data-slot": "sidebar-trigger",
|
|
679
683
|
variant: "ghost",
|
|
680
684
|
size: "icon",
|
|
681
|
-
className:
|
|
682
|
-
onClick: (
|
|
683
|
-
t?.(
|
|
685
|
+
className: f("size-7", a),
|
|
686
|
+
onClick: (l) => {
|
|
687
|
+
t?.(l), u();
|
|
684
688
|
},
|
|
685
|
-
...
|
|
689
|
+
...i,
|
|
686
690
|
children: [
|
|
687
691
|
/* @__PURE__ */ e(_t, {}),
|
|
688
692
|
/* @__PURE__ */ e("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
@@ -696,7 +700,7 @@ function wa({ className: a, ...t }) {
|
|
|
696
700
|
{
|
|
697
701
|
"data-slot": "sidebar-footer",
|
|
698
702
|
"data-sidebar": "footer",
|
|
699
|
-
className:
|
|
703
|
+
className: f("flex flex-col gap-2 p-2", a),
|
|
700
704
|
...t
|
|
701
705
|
}
|
|
702
706
|
);
|
|
@@ -707,7 +711,7 @@ function Na({ className: a, ...t }) {
|
|
|
707
711
|
{
|
|
708
712
|
"data-slot": "sidebar-content",
|
|
709
713
|
"data-sidebar": "content",
|
|
710
|
-
className:
|
|
714
|
+
className: f(
|
|
711
715
|
"flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
|
|
712
716
|
a
|
|
713
717
|
),
|
|
@@ -721,7 +725,7 @@ function ka({ className: a, ...t }) {
|
|
|
721
725
|
{
|
|
722
726
|
"data-slot": "sidebar-group",
|
|
723
727
|
"data-sidebar": "group",
|
|
724
|
-
className:
|
|
728
|
+
className: f("relative flex w-full min-w-0 flex-col p-2", a),
|
|
725
729
|
...t
|
|
726
730
|
}
|
|
727
731
|
);
|
|
@@ -732,7 +736,7 @@ function Ee({ className: a, ...t }) {
|
|
|
732
736
|
{
|
|
733
737
|
"data-slot": "sidebar-group-content",
|
|
734
738
|
"data-sidebar": "group-content",
|
|
735
|
-
className:
|
|
739
|
+
className: f("w-full text-sm", a),
|
|
736
740
|
...t
|
|
737
741
|
}
|
|
738
742
|
);
|
|
@@ -743,7 +747,7 @@ function Ae({ className: a, ...t }) {
|
|
|
743
747
|
{
|
|
744
748
|
"data-slot": "sidebar-menu",
|
|
745
749
|
"data-sidebar": "menu",
|
|
746
|
-
className:
|
|
750
|
+
className: f("flex w-full min-w-0 flex-col gap-1", a),
|
|
747
751
|
...t
|
|
748
752
|
}
|
|
749
753
|
);
|
|
@@ -754,7 +758,7 @@ function Le({ className: a, ...t }) {
|
|
|
754
758
|
{
|
|
755
759
|
"data-slot": "sidebar-menu-item",
|
|
756
760
|
"data-sidebar": "menu-item",
|
|
757
|
-
className:
|
|
761
|
+
className: f("group/menu-item relative", a),
|
|
758
762
|
...t
|
|
759
763
|
}
|
|
760
764
|
);
|
|
@@ -782,88 +786,88 @@ const _a = Zt(
|
|
|
782
786
|
function ze({
|
|
783
787
|
asChild: a = !1,
|
|
784
788
|
isActive: t = !1,
|
|
785
|
-
variant:
|
|
786
|
-
size:
|
|
787
|
-
tooltip:
|
|
789
|
+
variant: i = "default",
|
|
790
|
+
size: u = "default",
|
|
791
|
+
tooltip: l,
|
|
788
792
|
className: d,
|
|
789
|
-
...
|
|
793
|
+
...h
|
|
790
794
|
}) {
|
|
791
|
-
const
|
|
792
|
-
|
|
795
|
+
const p = a ? Yt : "button", { isMobile: m, state: N } = ge(), v = /* @__PURE__ */ e(
|
|
796
|
+
p,
|
|
793
797
|
{
|
|
794
798
|
"data-slot": "sidebar-menu-button",
|
|
795
799
|
"data-sidebar": "menu-button",
|
|
796
|
-
"data-size":
|
|
800
|
+
"data-size": u,
|
|
797
801
|
"data-active": t,
|
|
798
|
-
className:
|
|
799
|
-
...
|
|
802
|
+
className: f(_a({ variant: i, size: u }), d),
|
|
803
|
+
...h
|
|
800
804
|
}
|
|
801
805
|
);
|
|
802
|
-
return
|
|
803
|
-
children:
|
|
806
|
+
return l ? (typeof l == "string" && (l = {
|
|
807
|
+
children: l
|
|
804
808
|
}), /* @__PURE__ */ r($e, { children: [
|
|
805
|
-
/* @__PURE__ */ e(Be, { asChild: !0, children:
|
|
806
|
-
/* @__PURE__ */ e(Ue, { side: "right", align: "center", hidden:
|
|
807
|
-
] })) :
|
|
809
|
+
/* @__PURE__ */ e(Be, { asChild: !0, children: v }),
|
|
810
|
+
/* @__PURE__ */ e(Ue, { side: "right", align: "center", hidden: N !== "collapsed" || m, ...l })
|
|
811
|
+
] })) : v;
|
|
808
812
|
}
|
|
809
813
|
function Ca({ trigger: a }) {
|
|
810
|
-
const { t, i18n:
|
|
814
|
+
const { t, i18n: i } = ce(["settings", "translation"]), { app: u, settings: l } = re(), { theme: d, setTheme: h, accent: p, setAccent: m, radius: N, setRadius: v } = Ke(), [k, s] = P(null), [M, T] = P(!1), q = te(null), K = j(() => [
|
|
811
815
|
{ id: "general", label: t("sections.general", "General"), icon: Me },
|
|
812
816
|
{ id: "profile", label: t("sections.profile", "Profile"), icon: Ct },
|
|
813
817
|
{ id: "account", label: t("sections.account", "Account"), icon: St }
|
|
814
818
|
].filter((F) => {
|
|
815
|
-
const n =
|
|
819
|
+
const n = l?.sections?.[F.id];
|
|
816
820
|
return (n?.mode ?? (n?.enabled === !1 ? "hidden" : "editable")) !== "hidden";
|
|
817
|
-
}), [t,
|
|
818
|
-
const
|
|
819
|
-
return
|
|
820
|
-
}, [
|
|
821
|
+
}), [t, l]), [S, y] = P(K[0]?.id || "general"), g = Y((o, F, n = "editable") => {
|
|
822
|
+
const H = l?.sections?.[o]?.fields;
|
|
823
|
+
return H && H[F] || n;
|
|
824
|
+
}, [l]), [z, B] = P(""), [G, $] = P(""), [A, U] = P(""), [E, Q] = P(""), R = j(() => u?.userMetadataFields?.filter((o) => o.showInProfile) || [], [u?.userMetadataFields]), [b, _] = P({}), [x, c] = P(!1), w = i.language === "fa", L = w ? "text-right" : "text-left", C = Y(async () => {
|
|
821
825
|
try {
|
|
822
|
-
const
|
|
823
|
-
|
|
826
|
+
const o = await D.getMe();
|
|
827
|
+
s(o), B(o.name || ""), $(o.surname || ""), U(o.phone || "");
|
|
824
828
|
const F = {};
|
|
825
|
-
|
|
826
|
-
F[n.key] =
|
|
827
|
-
}),
|
|
828
|
-
} catch (
|
|
829
|
-
console.error("Failed to fetch user:",
|
|
829
|
+
R.forEach((n) => {
|
|
830
|
+
F[n.key] = o.metadata?.[n.key] ?? n.defaultValue ?? "";
|
|
831
|
+
}), _(F);
|
|
832
|
+
} catch (o) {
|
|
833
|
+
console.error("Failed to fetch user:", o), J.error(le(o, t));
|
|
830
834
|
}
|
|
831
|
-
}, [t,
|
|
832
|
-
|
|
833
|
-
if (!
|
|
834
|
-
|
|
835
|
+
}, [t, R]);
|
|
836
|
+
O(() => {
|
|
837
|
+
if (!M) {
|
|
838
|
+
q.current = null;
|
|
835
839
|
return;
|
|
836
840
|
}
|
|
837
|
-
(
|
|
838
|
-
}, [
|
|
839
|
-
const
|
|
841
|
+
(q.current === null || S === "account") && C(), q.current = S;
|
|
842
|
+
}, [M, S, C]), O(() => {
|
|
843
|
+
const o = { ...b };
|
|
840
844
|
let F = !1;
|
|
841
|
-
|
|
842
|
-
n.condition && !he(n.condition, b) &&
|
|
843
|
-
}), F &&
|
|
844
|
-
}, [b,
|
|
845
|
-
const
|
|
846
|
-
|
|
845
|
+
R.forEach((n) => {
|
|
846
|
+
n.condition && !he(n.condition, b) && o[n.key] !== void 0 && (delete o[n.key], F = !0);
|
|
847
|
+
}), F && _(o);
|
|
848
|
+
}, [b, R]);
|
|
849
|
+
const I = async () => {
|
|
850
|
+
c(!0);
|
|
847
851
|
try {
|
|
848
|
-
const
|
|
849
|
-
|
|
850
|
-
} catch (
|
|
851
|
-
J.error(le(
|
|
852
|
+
const o = { name: z, surname: G, phone: A, metadata: b };
|
|
853
|
+
E && (o.password = E), await D.updateMe(o), J.success(t("profile.success", "Profile updated successfully")), Q(""), C();
|
|
854
|
+
} catch (o) {
|
|
855
|
+
J.error(le(o, t));
|
|
852
856
|
} finally {
|
|
853
|
-
|
|
857
|
+
c(!1);
|
|
854
858
|
}
|
|
855
|
-
},
|
|
856
|
-
window.confirm(t("account.logout_confirm", "Are you sure you want to logout?")) && (
|
|
857
|
-
}, ae = (
|
|
858
|
-
|
|
859
|
-
}, ee =
|
|
860
|
-
return /* @__PURE__ */ r(He, { open:
|
|
859
|
+
}, W = () => {
|
|
860
|
+
window.confirm(t("account.logout_confirm", "Are you sure you want to logout?")) && (D.clearToken(), window.location.reload());
|
|
861
|
+
}, ae = (o) => {
|
|
862
|
+
i.changeLanguage(o);
|
|
863
|
+
}, ee = k ? Math.max(0, Math.min(100, k.balance.tokens / (k.balance.token_limit || 1) * 100)) : 0, oe = k ? Math.max(0, Math.min(100, k.balance.requests / (k.balance.request_limit || 1) * 100)) : 0;
|
|
864
|
+
return /* @__PURE__ */ r(He, { open: M, onOpenChange: T, children: [
|
|
861
865
|
/* @__PURE__ */ e(it, { asChild: !0, children: a || /* @__PURE__ */ e(Z, { variant: "ghost", size: "icon", className: "rounded-full", children: /* @__PURE__ */ e(Ne, { className: "h-5 w-5" }) }) }),
|
|
862
866
|
/* @__PURE__ */ e(
|
|
863
867
|
Ve,
|
|
864
868
|
{
|
|
865
869
|
dir: w ? "rtl" : "ltr",
|
|
866
|
-
className:
|
|
870
|
+
className: f(
|
|
867
871
|
"w-full sm:w-[95vw] sm:max-w-[700px] p-0 gap-0 overflow-hidden rounded-t-2xl sm:rounded-3xl border-none shadow-2xl bg-background/95 backdrop-blur-md h-[90vh] sm:h-[750px]",
|
|
868
872
|
w && "rtl"
|
|
869
873
|
),
|
|
@@ -873,80 +877,80 @@ function Ca({ trigger: a }) {
|
|
|
873
877
|
/* @__PURE__ */ e("div", { className: "bg-primary/10 p-1.5 rounded-lg", children: /* @__PURE__ */ e(Ne, { className: "h-5 w-5 text-primary" }) }),
|
|
874
878
|
/* @__PURE__ */ e("span", { className: "font-bold text-lg", children: t("title", "Settings") })
|
|
875
879
|
] }) }),
|
|
876
|
-
/* @__PURE__ */ e("div", { className: "w-full overflow-x-auto no-scrollbar pt-2 px-2 sm:px-4", children: /* @__PURE__ */ e("nav", { className: "flex items-center gap-2 sm:gap-6 w-max", children: K.map((
|
|
880
|
+
/* @__PURE__ */ e("div", { className: "w-full overflow-x-auto no-scrollbar pt-2 px-2 sm:px-4", children: /* @__PURE__ */ e("nav", { className: "flex items-center gap-2 sm:gap-6 w-max", children: K.map((o) => /* @__PURE__ */ r(
|
|
877
881
|
"button",
|
|
878
882
|
{
|
|
879
|
-
onClick: () => y(
|
|
880
|
-
className:
|
|
883
|
+
onClick: () => y(o.id),
|
|
884
|
+
className: f(
|
|
881
885
|
"flex items-center gap-1.5 sm:gap-2 pb-2 sm:pb-3 pt-1 px-2 sm:px-1 text-sm sm:text-base font-medium transition-all border-b-2 whitespace-nowrap shrink-0",
|
|
882
|
-
|
|
883
|
-
|
|
886
|
+
S === o.id ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border",
|
|
887
|
+
l?.sections?.[o.id]?.mode === "faded" && "opacity-50 pointer-events-none select-none"
|
|
884
888
|
),
|
|
885
889
|
children: [
|
|
886
|
-
/* @__PURE__ */ e(
|
|
890
|
+
/* @__PURE__ */ e(o.icon, { className: f(
|
|
887
891
|
"h-3.5 w-3.5 sm:h-4 sm:w-4 transition-transform",
|
|
888
|
-
|
|
892
|
+
S === o.id && "scale-110"
|
|
889
893
|
) }),
|
|
890
|
-
|
|
894
|
+
o.label
|
|
891
895
|
]
|
|
892
896
|
},
|
|
893
|
-
|
|
897
|
+
o.id
|
|
894
898
|
)) }) })
|
|
895
899
|
] }),
|
|
896
900
|
/* @__PURE__ */ e("div", { className: "flex-1 relative min-h-0 h-full bg-background", children: /* @__PURE__ */ r("div", { className: "absolute inset-0 overflow-y-auto p-5 sm:p-8 pt-12 sm:pt-12 custom-scrollbar", children: [
|
|
897
|
-
|
|
901
|
+
S === "profile" && /* @__PURE__ */ r("div", { className: "space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
|
|
898
902
|
/* @__PURE__ */ r("div", { children: [
|
|
899
903
|
/* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: t("profile.title", "Profile Information") }),
|
|
900
904
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("profile.subtitle", "Update your personal details below.") })
|
|
901
905
|
] }),
|
|
902
906
|
/* @__PURE__ */ r("div", { className: "grid gap-6", children: [
|
|
903
907
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
904
|
-
|
|
905
|
-
/* @__PURE__ */ e(
|
|
908
|
+
g("profile", "name") !== "hidden" && /* @__PURE__ */ r("div", { className: f("flex flex-col gap-3", g("profile", "name") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
|
|
909
|
+
/* @__PURE__ */ e(V, { htmlFor: "name", className: "px-1", children: t("profile.name", "First Name") }),
|
|
906
910
|
/* @__PURE__ */ e(
|
|
907
911
|
X,
|
|
908
912
|
{
|
|
909
913
|
id: "name",
|
|
910
|
-
value:
|
|
911
|
-
onChange: (
|
|
912
|
-
disabled:
|
|
913
|
-
className:
|
|
914
|
+
value: z,
|
|
915
|
+
onChange: (o) => B(o.target.value),
|
|
916
|
+
disabled: g("profile", "name") === "faded",
|
|
917
|
+
className: f("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", L)
|
|
914
918
|
}
|
|
915
919
|
)
|
|
916
920
|
] }),
|
|
917
|
-
|
|
918
|
-
/* @__PURE__ */ e(
|
|
921
|
+
g("profile", "surname") !== "hidden" && /* @__PURE__ */ r("div", { className: f("flex flex-col gap-3", g("profile", "surname") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
|
|
922
|
+
/* @__PURE__ */ e(V, { htmlFor: "surname", className: "px-1", children: t("profile.surname", "Last Name") }),
|
|
919
923
|
/* @__PURE__ */ e(
|
|
920
924
|
X,
|
|
921
925
|
{
|
|
922
926
|
id: "surname",
|
|
923
|
-
value:
|
|
924
|
-
onChange: (
|
|
925
|
-
disabled:
|
|
926
|
-
className:
|
|
927
|
+
value: G,
|
|
928
|
+
onChange: (o) => $(o.target.value),
|
|
929
|
+
disabled: g("profile", "surname") === "faded",
|
|
930
|
+
className: f("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", L)
|
|
927
931
|
}
|
|
928
932
|
)
|
|
929
933
|
] })
|
|
930
934
|
] }),
|
|
931
|
-
|
|
932
|
-
/* @__PURE__ */ e(
|
|
935
|
+
g("profile", "phone") !== "hidden" && /* @__PURE__ */ r("div", { className: f("flex flex-col gap-3", g("profile", "phone") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
|
|
936
|
+
/* @__PURE__ */ e(V, { htmlFor: "phone", className: "px-1 text-left", children: t("profile.phone", "Phone Number") }),
|
|
933
937
|
/* @__PURE__ */ r("div", { className: "relative", children: [
|
|
934
938
|
/* @__PURE__ */ e(Pt, { className: "absolute top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground left-3" }),
|
|
935
939
|
/* @__PURE__ */ e(
|
|
936
940
|
X,
|
|
937
941
|
{
|
|
938
942
|
id: "phone",
|
|
939
|
-
value:
|
|
940
|
-
onChange: (
|
|
941
|
-
disabled:
|
|
943
|
+
value: A,
|
|
944
|
+
onChange: (o) => U(o.target.value),
|
|
945
|
+
disabled: g("profile", "phone") === "faded",
|
|
942
946
|
className: "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary pl-10 pr-3 text-left",
|
|
943
947
|
dir: "ltr"
|
|
944
948
|
}
|
|
945
949
|
)
|
|
946
950
|
] })
|
|
947
951
|
] }),
|
|
948
|
-
|
|
949
|
-
/* @__PURE__ */ e(
|
|
952
|
+
g("profile", "password") !== "hidden" && /* @__PURE__ */ r("div", { className: f("flex flex-col gap-3", g("profile", "password") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
|
|
953
|
+
/* @__PURE__ */ e(V, { htmlFor: "pass", className: "px-1 text-left", children: t("profile.password", "New Password") }),
|
|
950
954
|
/* @__PURE__ */ r("div", { className: "relative", children: [
|
|
951
955
|
/* @__PURE__ */ e(Tt, { className: "absolute top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground left-3" }),
|
|
952
956
|
/* @__PURE__ */ e(
|
|
@@ -954,9 +958,9 @@ function Ca({ trigger: a }) {
|
|
|
954
958
|
{
|
|
955
959
|
id: "pass",
|
|
956
960
|
type: "password",
|
|
957
|
-
value:
|
|
958
|
-
onChange: (
|
|
959
|
-
disabled:
|
|
961
|
+
value: E,
|
|
962
|
+
onChange: (o) => Q(o.target.value),
|
|
963
|
+
disabled: g("profile", "password") === "faded",
|
|
960
964
|
placeholder: t("profile.password_placeholder", "Leave empty to keep current"),
|
|
961
965
|
className: "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary pl-10 pr-3 text-left",
|
|
962
966
|
dir: "ltr"
|
|
@@ -964,71 +968,71 @@ function Ca({ trigger: a }) {
|
|
|
964
968
|
)
|
|
965
969
|
] })
|
|
966
970
|
] }),
|
|
967
|
-
|
|
968
|
-
const F =
|
|
969
|
-
return F === "hidden" || !he(
|
|
970
|
-
/* @__PURE__ */ e(
|
|
971
|
-
|
|
971
|
+
R.map((o) => {
|
|
972
|
+
const F = g("profile", o.key, o.mode || "editable");
|
|
973
|
+
return F === "hidden" || !he(o.condition, b) ? null : /* @__PURE__ */ r("div", { className: f("flex flex-col gap-3 animate-in fade-in slide-in-from-top-1 duration-200", F === "faded" && "opacity-50 pointer-events-none select-none"), children: [
|
|
974
|
+
/* @__PURE__ */ e(V, { htmlFor: `profile-${o.key}`, className: "px-1", children: t(o.label) }),
|
|
975
|
+
o.type === "select" ? /* @__PURE__ */ r(
|
|
972
976
|
ve,
|
|
973
977
|
{
|
|
974
|
-
value: String(b[
|
|
975
|
-
onValueChange: (n) =>
|
|
978
|
+
value: String(b[o.key] || ""),
|
|
979
|
+
onValueChange: (n) => _({ ...b, [o.key]: n }),
|
|
976
980
|
disabled: F === "faded",
|
|
977
981
|
dir: w ? "rtl" : "ltr",
|
|
978
982
|
children: [
|
|
979
|
-
/* @__PURE__ */ e(xe, { className: "bg-muted/30 border-border/50 rounded-xl focus:ring-primary h-11", children: /* @__PURE__ */ e(ye, { placeholder: t(
|
|
980
|
-
/* @__PURE__ */ e(we, { className: "rounded-xl border-border/40 shadow-xl bg-background/95 backdrop-blur-md", children:
|
|
983
|
+
/* @__PURE__ */ e(xe, { className: "bg-muted/30 border-border/50 rounded-xl focus:ring-primary h-11", children: /* @__PURE__ */ e(ye, { placeholder: t(o.placeholder || "profile.select_placeholder") }) }),
|
|
984
|
+
/* @__PURE__ */ e(we, { className: "rounded-xl border-border/40 shadow-xl bg-background/95 backdrop-blur-md", children: o.options?.map((n) => /* @__PURE__ */ e(me, { value: String(n.value), className: "rounded-lg focus:bg-primary/10", children: t(n.label) }, String(n.value))) })
|
|
981
985
|
]
|
|
982
986
|
}
|
|
983
|
-
) :
|
|
987
|
+
) : o.type === "checkbox" ? /* @__PURE__ */ r("div", { className: "flex items-center gap-3 px-1 py-1", children: [
|
|
984
988
|
/* @__PURE__ */ e(
|
|
985
989
|
"input",
|
|
986
990
|
{
|
|
987
|
-
id: `profile-${
|
|
991
|
+
id: `profile-${o.key}`,
|
|
988
992
|
type: "checkbox",
|
|
989
|
-
checked: !!b[
|
|
993
|
+
checked: !!b[o.key],
|
|
990
994
|
disabled: F === "faded",
|
|
991
|
-
onChange: (n) =>
|
|
995
|
+
onChange: (n) => _({ ...b, [o.key]: n.target.checked }),
|
|
992
996
|
className: "h-5 w-5 rounded-md border-border/50 bg-muted/30 text-primary focus:ring-primary transition-all cursor-pointer"
|
|
993
997
|
}
|
|
994
998
|
),
|
|
995
|
-
/* @__PURE__ */ e(
|
|
999
|
+
/* @__PURE__ */ e(V, { htmlFor: `profile-${o.key}`, className: "text-sm font-medium text-muted-foreground cursor-pointer", children: t(o.placeholder || o.label) })
|
|
996
1000
|
] }) : /* @__PURE__ */ e(
|
|
997
1001
|
X,
|
|
998
1002
|
{
|
|
999
|
-
id: `profile-${
|
|
1000
|
-
type:
|
|
1001
|
-
value: b[
|
|
1003
|
+
id: `profile-${o.key}`,
|
|
1004
|
+
type: o.type,
|
|
1005
|
+
value: b[o.key] || "",
|
|
1002
1006
|
disabled: F === "faded",
|
|
1003
|
-
onChange: (n) =>
|
|
1004
|
-
placeholder: t(
|
|
1005
|
-
className:
|
|
1007
|
+
onChange: (n) => _({ ...b, [o.key]: n.target.value }),
|
|
1008
|
+
placeholder: t(o.placeholder || ""),
|
|
1009
|
+
className: f("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", L)
|
|
1006
1010
|
}
|
|
1007
1011
|
)
|
|
1008
|
-
] },
|
|
1012
|
+
] }, o.key);
|
|
1009
1013
|
}),
|
|
1010
1014
|
/* @__PURE__ */ e("div", { className: "pt-4 flex justify-center", children: /* @__PURE__ */ r(
|
|
1011
1015
|
Z,
|
|
1012
1016
|
{
|
|
1013
|
-
onClick:
|
|
1014
|
-
disabled:
|
|
1017
|
+
onClick: I,
|
|
1018
|
+
disabled: x,
|
|
1015
1019
|
className: "w-full sm:w-auto px-8 rounded-xl gap-2 font-semibold shadow-lg shadow-primary/20 h-11 transition-all active:scale-[0.98]",
|
|
1016
1020
|
children: [
|
|
1017
1021
|
/* @__PURE__ */ e(Mt, { className: "h-4 w-4" }),
|
|
1018
|
-
|
|
1022
|
+
x ? t("profile.saving", "Saving...") : t("profile.save", "Save Changes")
|
|
1019
1023
|
]
|
|
1020
1024
|
}
|
|
1021
1025
|
) })
|
|
1022
1026
|
] })
|
|
1023
1027
|
] }),
|
|
1024
|
-
|
|
1028
|
+
S === "general" && /* @__PURE__ */ r("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
|
|
1025
1029
|
/* @__PURE__ */ r("div", { children: [
|
|
1026
1030
|
/* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: t("general.title", "General Settings") }),
|
|
1027
1031
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("general.subtitle", "Configure look and feel and language.") })
|
|
1028
1032
|
] }),
|
|
1029
1033
|
/* @__PURE__ */ r("div", { className: "space-y-8", children: [
|
|
1030
|
-
|
|
1031
|
-
/* @__PURE__ */ r(
|
|
1034
|
+
g("general", "theme") !== "hidden" && /* @__PURE__ */ r("div", { className: f("space-y-3", g("general", "theme") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
|
|
1035
|
+
/* @__PURE__ */ r(V, { className: "text-sm font-semibold flex items-center gap-2", children: [
|
|
1032
1036
|
/* @__PURE__ */ e(Me, { className: "h-4 w-4 text-primary" }),
|
|
1033
1037
|
t("general.theme", "Theme")
|
|
1034
1038
|
] }),
|
|
@@ -1036,9 +1040,9 @@ function Ca({ trigger: a }) {
|
|
|
1036
1040
|
/* @__PURE__ */ r(
|
|
1037
1041
|
"button",
|
|
1038
1042
|
{
|
|
1039
|
-
onClick: () =>
|
|
1040
|
-
disabled:
|
|
1041
|
-
className:
|
|
1043
|
+
onClick: () => h("light"),
|
|
1044
|
+
disabled: g("general", "theme") === "faded",
|
|
1045
|
+
className: f(
|
|
1042
1046
|
"flex-1 flex items-center justify-center gap-2 py-2.5 rounded-xl transition-all",
|
|
1043
1047
|
d === "light" ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
|
|
1044
1048
|
),
|
|
@@ -1051,9 +1055,9 @@ function Ca({ trigger: a }) {
|
|
|
1051
1055
|
/* @__PURE__ */ r(
|
|
1052
1056
|
"button",
|
|
1053
1057
|
{
|
|
1054
|
-
onClick: () =>
|
|
1055
|
-
disabled:
|
|
1056
|
-
className:
|
|
1058
|
+
onClick: () => h("dark"),
|
|
1059
|
+
disabled: g("general", "theme") === "faded",
|
|
1060
|
+
className: f(
|
|
1057
1061
|
"flex-1 flex items-center justify-center gap-2 py-2.5 rounded-xl transition-all",
|
|
1058
1062
|
d === "dark" ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
|
|
1059
1063
|
),
|
|
@@ -1066,9 +1070,9 @@ function Ca({ trigger: a }) {
|
|
|
1066
1070
|
/* @__PURE__ */ r(
|
|
1067
1071
|
"button",
|
|
1068
1072
|
{
|
|
1069
|
-
onClick: () =>
|
|
1070
|
-
disabled:
|
|
1071
|
-
className:
|
|
1073
|
+
onClick: () => h("system"),
|
|
1074
|
+
disabled: g("general", "theme") === "faded",
|
|
1075
|
+
className: f(
|
|
1072
1076
|
"flex-1 flex items-center justify-center gap-2 py-2.5 rounded-xl transition-all",
|
|
1073
1077
|
d === "system" ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
|
|
1074
1078
|
),
|
|
@@ -1080,8 +1084,8 @@ function Ca({ trigger: a }) {
|
|
|
1080
1084
|
)
|
|
1081
1085
|
] })
|
|
1082
1086
|
] }),
|
|
1083
|
-
|
|
1084
|
-
/* @__PURE__ */ r(
|
|
1087
|
+
g("general", "accent") !== "hidden" && /* @__PURE__ */ r("div", { className: f("space-y-4", g("general", "accent") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
|
|
1088
|
+
/* @__PURE__ */ r(V, { className: "text-sm font-semibold flex items-center gap-2", children: [
|
|
1085
1089
|
/* @__PURE__ */ e(Ie, { className: "h-4 w-4 text-primary" }),
|
|
1086
1090
|
t("general.accent", "Accent Color")
|
|
1087
1091
|
] }),
|
|
@@ -1102,59 +1106,59 @@ function Ca({ trigger: a }) {
|
|
|
1102
1106
|
// Teal
|
|
1103
1107
|
"oklch(0.552 0.016 285.938)"
|
|
1104
1108
|
// Slate
|
|
1105
|
-
].map((
|
|
1106
|
-
const F = (
|
|
1109
|
+
].map((o) => {
|
|
1110
|
+
const F = (p || "oklch(0.623 0.214 259.815)") === o;
|
|
1107
1111
|
return /* @__PURE__ */ e(
|
|
1108
1112
|
"button",
|
|
1109
1113
|
{
|
|
1110
|
-
onClick: () =>
|
|
1111
|
-
disabled:
|
|
1112
|
-
className:
|
|
1114
|
+
onClick: () => m(o),
|
|
1115
|
+
disabled: g("general", "accent") === "faded",
|
|
1116
|
+
className: f(
|
|
1113
1117
|
"h-8 w-8 rounded-full border-2 transition-all hover:scale-110 active:scale-95 shadow-sm",
|
|
1114
1118
|
F ? "border-foreground" : "border-transparent"
|
|
1115
1119
|
),
|
|
1116
|
-
style: { backgroundColor:
|
|
1120
|
+
style: { backgroundColor: o }
|
|
1117
1121
|
},
|
|
1118
|
-
|
|
1122
|
+
o
|
|
1119
1123
|
);
|
|
1120
1124
|
}) })
|
|
1121
1125
|
] }),
|
|
1122
|
-
|
|
1123
|
-
/* @__PURE__ */ r(
|
|
1126
|
+
g("general", "radius") !== "hidden" && /* @__PURE__ */ r("div", { className: f("space-y-4", g("general", "radius") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
|
|
1127
|
+
/* @__PURE__ */ r(V, { className: "text-sm font-semibold flex items-center gap-2", children: [
|
|
1124
1128
|
/* @__PURE__ */ e("div", { className: "h-4 w-4 rounded-md border-2 border-primary" }),
|
|
1125
1129
|
t("general.radius", "Rounded Corners")
|
|
1126
1130
|
] }),
|
|
1127
1131
|
/* @__PURE__ */ e("div", { className: "flex p-1 bg-muted/50 rounded-2xl border border-border/40 w-full", children: [
|
|
1128
1132
|
{ id: "sharp", value: "0.3rem" },
|
|
1129
1133
|
{ id: "round", value: "1.25rem" }
|
|
1130
|
-
].map((
|
|
1131
|
-
const F = (
|
|
1134
|
+
].map((o) => {
|
|
1135
|
+
const F = (N || "1.25rem") === o.value;
|
|
1132
1136
|
return /* @__PURE__ */ e(
|
|
1133
1137
|
"button",
|
|
1134
1138
|
{
|
|
1135
|
-
onClick: () =>
|
|
1136
|
-
disabled:
|
|
1137
|
-
className:
|
|
1139
|
+
onClick: () => v(o.value),
|
|
1140
|
+
disabled: g("general", "radius") === "faded",
|
|
1141
|
+
className: f(
|
|
1138
1142
|
"flex-1 py-2 rounded-xl transition-all text-sm font-medium",
|
|
1139
1143
|
F ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
|
|
1140
1144
|
),
|
|
1141
|
-
children: t(`general.radius_levels.${
|
|
1145
|
+
children: t(`general.radius_levels.${o.id}`)
|
|
1142
1146
|
},
|
|
1143
|
-
|
|
1147
|
+
o.id
|
|
1144
1148
|
);
|
|
1145
1149
|
}) })
|
|
1146
1150
|
] }),
|
|
1147
|
-
|
|
1148
|
-
/* @__PURE__ */ r(
|
|
1151
|
+
g("general", "language") !== "hidden" && /* @__PURE__ */ r("div", { className: f("space-y-3", g("general", "language") === "faded" && "opacity-50"), children: [
|
|
1152
|
+
/* @__PURE__ */ r(V, { className: "text-sm font-semibold flex items-center gap-2", children: [
|
|
1149
1153
|
/* @__PURE__ */ e(At, { className: "h-4 w-4 text-primary" }),
|
|
1150
1154
|
t("general.language", "Language")
|
|
1151
1155
|
] }),
|
|
1152
1156
|
/* @__PURE__ */ r(
|
|
1153
1157
|
ve,
|
|
1154
1158
|
{
|
|
1155
|
-
value:
|
|
1159
|
+
value: i.language,
|
|
1156
1160
|
onValueChange: ae,
|
|
1157
|
-
disabled:
|
|
1161
|
+
disabled: g("general", "language") === "faded",
|
|
1158
1162
|
dir: w ? "rtl" : "ltr",
|
|
1159
1163
|
children: [
|
|
1160
1164
|
/* @__PURE__ */ e(xe, { className: "w-full bg-muted/50 rounded-2xl border-border/40 h-11 focus:ring-primary/20", children: /* @__PURE__ */ e(ye, { placeholder: t("general.language_placeholder", "Select language") }) }),
|
|
@@ -1174,14 +1178,14 @@ function Ca({ trigger: a }) {
|
|
|
1174
1178
|
] })
|
|
1175
1179
|
] })
|
|
1176
1180
|
] }),
|
|
1177
|
-
|
|
1181
|
+
S === "account" && /* @__PURE__ */ r("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
|
|
1178
1182
|
/* @__PURE__ */ r("div", { children: [
|
|
1179
1183
|
/* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: t("account.title", "Account & Usage") }),
|
|
1180
1184
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("account.subtitle", "Monitor your quotas and manage your session.") })
|
|
1181
1185
|
] }),
|
|
1182
1186
|
/* @__PURE__ */ r("div", { className: "space-y-6", children: [
|
|
1183
|
-
|
|
1184
|
-
/* @__PURE__ */ r(
|
|
1187
|
+
g("account", "balance") !== "hidden" && /* @__PURE__ */ r("div", { className: f("p-6 bg-muted/30 rounded-3xl border border-border/40 space-y-6", g("account", "balance") === "faded" && "opacity-50"), children: [
|
|
1188
|
+
/* @__PURE__ */ r(V, { className: "text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2", children: [
|
|
1185
1189
|
/* @__PURE__ */ e(Lt, { className: "h-4 w-4" }),
|
|
1186
1190
|
t("account.balance", "Current Balance")
|
|
1187
1191
|
] }),
|
|
@@ -1190,14 +1194,14 @@ function Ca({ trigger: a }) {
|
|
|
1190
1194
|
/* @__PURE__ */ r("div", { className: "flex justify-between text-sm mb-1", children: [
|
|
1191
1195
|
/* @__PURE__ */ e("span", { className: "font-medium text-muted-foreground", children: t("account.tokens", "Tokens") }),
|
|
1192
1196
|
/* @__PURE__ */ r("span", { className: "font-bold text-primary", children: [
|
|
1193
|
-
ee.toLocaleString(
|
|
1197
|
+
ee.toLocaleString(i.language, { maximumFractionDigits: 0 }),
|
|
1194
1198
|
"%"
|
|
1195
1199
|
] })
|
|
1196
1200
|
] }),
|
|
1197
1201
|
/* @__PURE__ */ e("div", { className: "h-2.5 w-full bg-muted/50 rounded-full overflow-hidden border border-border/20 p-0.5", dir: "ltr", children: /* @__PURE__ */ e(
|
|
1198
1202
|
"div",
|
|
1199
1203
|
{
|
|
1200
|
-
className:
|
|
1204
|
+
className: f(
|
|
1201
1205
|
"h-full rounded-full transition-all duration-1000 shadow-sm",
|
|
1202
1206
|
ee > 60 ? "bg-emerald-500 shadow-emerald-500/20" : ee > 20 ? "bg-amber-500 shadow-amber-500/20" : "bg-destructive shadow-destructive/20"
|
|
1203
1207
|
),
|
|
@@ -1212,14 +1216,14 @@ function Ca({ trigger: a }) {
|
|
|
1212
1216
|
t("account.requests", "Requests")
|
|
1213
1217
|
] }),
|
|
1214
1218
|
/* @__PURE__ */ r("span", { className: "font-bold text-primary", children: [
|
|
1215
|
-
oe.toLocaleString(
|
|
1219
|
+
oe.toLocaleString(i.language, { maximumFractionDigits: 0 }),
|
|
1216
1220
|
"%"
|
|
1217
1221
|
] })
|
|
1218
1222
|
] }),
|
|
1219
1223
|
/* @__PURE__ */ e("div", { className: "h-2.5 w-full bg-muted/50 rounded-full overflow-hidden border border-border/20 p-0.5", dir: "ltr", children: /* @__PURE__ */ e(
|
|
1220
1224
|
"div",
|
|
1221
1225
|
{
|
|
1222
|
-
className:
|
|
1226
|
+
className: f(
|
|
1223
1227
|
"h-full rounded-full transition-all duration-1000 shadow-sm",
|
|
1224
1228
|
oe > 60 ? "bg-emerald-500 shadow-emerald-500/20" : oe > 20 ? "bg-amber-500 shadow-amber-500/20" : "bg-destructive shadow-destructive/20"
|
|
1225
1229
|
),
|
|
@@ -1230,18 +1234,18 @@ function Ca({ trigger: a }) {
|
|
|
1230
1234
|
] })
|
|
1231
1235
|
] }),
|
|
1232
1236
|
/* @__PURE__ */ r("div", { className: "pt-2 flex flex-col gap-3", children: [
|
|
1233
|
-
|
|
1237
|
+
k?.balance.updated_at && g("account", "balance") !== "hidden" && /* @__PURE__ */ r("p", { className: "text-xs text-muted-foreground px-1", children: [
|
|
1234
1238
|
t("account.last_recharge", "Last balance update on"),
|
|
1235
1239
|
": ",
|
|
1236
|
-
new Date(
|
|
1240
|
+
new Date(k.balance.updated_at).toLocaleDateString(i.language)
|
|
1237
1241
|
] }),
|
|
1238
|
-
|
|
1242
|
+
g("account", "logout") !== "hidden" && /* @__PURE__ */ r(
|
|
1239
1243
|
Z,
|
|
1240
1244
|
{
|
|
1241
1245
|
variant: "destructive",
|
|
1242
|
-
onClick:
|
|
1243
|
-
disabled:
|
|
1244
|
-
className:
|
|
1246
|
+
onClick: W,
|
|
1247
|
+
disabled: g("account", "logout") === "faded",
|
|
1248
|
+
className: f("rounded-2xl gap-2 font-bold h-12 shadow-lg shadow-destructive/10 transition-all active:scale-[0.98]", g("account", "logout") === "faded" && "opacity-50 pointer-events-none"),
|
|
1245
1249
|
children: [
|
|
1246
1250
|
/* @__PURE__ */ e(zt, { className: "h-4 w-4" }),
|
|
1247
1251
|
t("account.logout", "Logout from Account")
|
|
@@ -1252,9 +1256,9 @@ function Ca({ trigger: a }) {
|
|
|
1252
1256
|
] })
|
|
1253
1257
|
] })
|
|
1254
1258
|
] }) }),
|
|
1255
|
-
|
|
1259
|
+
u?.showVersionInSettings !== !1 && u?.version && g("general", "version") !== "hidden" && /* @__PURE__ */ e("div", { className: f("shrink-0 border-t border-border/30 px-5 sm:px-8 py-3 flex justify-center bg-background/80", g("general", "version", "faded") === "faded" && "opacity-70"), children: /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground text-center", dir: "ltr", children: /* @__PURE__ */ r("span", { className: "font-mono text-foreground/75", children: [
|
|
1256
1260
|
"v",
|
|
1257
|
-
|
|
1261
|
+
u.version
|
|
1258
1262
|
] }) }) })
|
|
1259
1263
|
] })
|
|
1260
1264
|
}
|
|
@@ -1262,22 +1266,22 @@ function Ca({ trigger: a }) {
|
|
|
1262
1266
|
] });
|
|
1263
1267
|
}
|
|
1264
1268
|
function We({ hideActions: a = !1 }) {
|
|
1265
|
-
const [, t] = Ce(), { t:
|
|
1266
|
-
|
|
1269
|
+
const [, t] = Ce(), { t: i } = ce(["sidebar", "chat"]), { history: u, app: l } = re(), { theme: d } = Ke(), h = !a && (u?.enabled ?? !0), [p, m] = P("light");
|
|
1270
|
+
O(() => {
|
|
1267
1271
|
if (d === "system") {
|
|
1268
|
-
const
|
|
1269
|
-
|
|
1272
|
+
const k = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
1273
|
+
m(k ? "dark" : "light");
|
|
1270
1274
|
} else
|
|
1271
|
-
|
|
1275
|
+
m(d);
|
|
1272
1276
|
}, [d]);
|
|
1273
|
-
const
|
|
1277
|
+
const N = j(() => l?.logo ? typeof l.logo == "string" ? l.logo : p === "dark" ? l.logo.dark : l.logo.light : lt, [l?.logo, p]), v = l?.name || "Gentiq";
|
|
1274
1278
|
return /* @__PURE__ */ r("header", { className: "relative flex items-center justify-between px-3 md:px-4 h-14 sticky top-0 z-40 w-full glass border-b border-border/30 transition-all duration-300", children: [
|
|
1275
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-1.5 md:gap-2 min-w-[36px] md:min-w-[80px]", children:
|
|
1279
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-1.5 md:gap-2 min-w-[36px] md:min-w-[80px]", children: h && /* @__PURE__ */ e(ya, { className: "hover:bg-accent/60 transition-all duration-200 hover:scale-105 active:scale-95 rounded-lg size-9" }) }),
|
|
1276
1280
|
/* @__PURE__ */ e("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2", children: /* @__PURE__ */ e("div", { className: "flex items-center gap-2.5 select-none animate-in fade-in zoom-in-95 duration-500", children: /* @__PURE__ */ e(
|
|
1277
1281
|
"img",
|
|
1278
1282
|
{
|
|
1279
|
-
src:
|
|
1280
|
-
alt:
|
|
1283
|
+
src: N,
|
|
1284
|
+
alt: v,
|
|
1281
1285
|
className: "size-8 object-contain"
|
|
1282
1286
|
}
|
|
1283
1287
|
) }) }),
|
|
@@ -1287,9 +1291,9 @@ function We({ hideActions: a = !1 }) {
|
|
|
1287
1291
|
"button",
|
|
1288
1292
|
{
|
|
1289
1293
|
type: "button",
|
|
1290
|
-
className:
|
|
1294
|
+
className: f(
|
|
1291
1295
|
"flex items-center justify-center size-9 rounded-lg hover:bg-accent/60 transition-all duration-200 hover:scale-105 active:scale-95 text-muted-foreground hover:text-primary",
|
|
1292
|
-
|
|
1296
|
+
h && "md:hidden"
|
|
1293
1297
|
),
|
|
1294
1298
|
onClick: () => {
|
|
1295
1299
|
t("/");
|
|
@@ -1297,9 +1301,9 @@ function We({ hideActions: a = !1 }) {
|
|
|
1297
1301
|
children: /* @__PURE__ */ e(Rt, { className: "size-5" })
|
|
1298
1302
|
}
|
|
1299
1303
|
) }),
|
|
1300
|
-
/* @__PURE__ */ e(Ue, { side: "bottom", className: "text-xs", children:
|
|
1304
|
+
/* @__PURE__ */ e(Ue, { side: "bottom", className: "text-xs", children: i("new_chat") })
|
|
1301
1305
|
] }),
|
|
1302
|
-
|
|
1306
|
+
l?.showSettings !== !1 && /* @__PURE__ */ e(
|
|
1303
1307
|
Ca,
|
|
1304
1308
|
{
|
|
1305
1309
|
trigger: /* @__PURE__ */ e(
|
|
@@ -1317,48 +1321,48 @@ function We({ hideActions: a = !1 }) {
|
|
|
1317
1321
|
}
|
|
1318
1322
|
const Re = 20;
|
|
1319
1323
|
function Sa() {
|
|
1320
|
-
const t =
|
|
1324
|
+
const t = D.getConfig().app?.cacheNamespace || "gentiq";
|
|
1321
1325
|
return tt({
|
|
1322
1326
|
queryKey: [t, "conversations"],
|
|
1323
|
-
queryFn: async ({ pageParam:
|
|
1324
|
-
const
|
|
1327
|
+
queryFn: async ({ pageParam: i = 0 }) => {
|
|
1328
|
+
const u = await D.getHistory(i, Re);
|
|
1325
1329
|
return {
|
|
1326
|
-
threads:
|
|
1327
|
-
id: `/${
|
|
1328
|
-
firstMessage:
|
|
1329
|
-
timestamp: new Date(
|
|
1330
|
-
pinned: !!
|
|
1330
|
+
threads: u.threads.map((l) => ({
|
|
1331
|
+
id: `/${l.id}`,
|
|
1332
|
+
firstMessage: l.title || l.firstMessage || "Chat",
|
|
1333
|
+
timestamp: new Date(l.created_at).getTime(),
|
|
1334
|
+
pinned: !!l.pinned
|
|
1331
1335
|
})),
|
|
1332
|
-
nextSkip:
|
|
1333
|
-
hasMore:
|
|
1336
|
+
nextSkip: i + Re,
|
|
1337
|
+
hasMore: i + u.threads.length < (u.total_count ?? 0)
|
|
1334
1338
|
};
|
|
1335
1339
|
},
|
|
1336
1340
|
initialPageParam: 0,
|
|
1337
|
-
getNextPageParam: (
|
|
1341
|
+
getNextPageParam: (i) => i.hasMore ? i.nextSkip : void 0,
|
|
1338
1342
|
staleTime: 1e3 * 60 * 5
|
|
1339
1343
|
// 5 minutes
|
|
1340
1344
|
});
|
|
1341
1345
|
}
|
|
1342
|
-
async function Pa(a, t,
|
|
1343
|
-
const d =
|
|
1346
|
+
async function Pa(a, t, i, u) {
|
|
1347
|
+
const d = D.getConfig().app?.cacheNamespace || "gentiq";
|
|
1344
1348
|
try {
|
|
1345
|
-
await
|
|
1346
|
-
} catch (
|
|
1347
|
-
console.error("Failed to delete conversation:",
|
|
1349
|
+
await D.deleteThread(a), t.invalidateQueries({ queryKey: [d, "conversations"] }), u === a && i("/");
|
|
1350
|
+
} catch (h) {
|
|
1351
|
+
console.error("Failed to delete conversation:", h), J.error("Failed to delete conversation");
|
|
1348
1352
|
}
|
|
1349
1353
|
}
|
|
1350
1354
|
function Ta({ side: a = "left" }) {
|
|
1351
|
-
const { t, i18n:
|
|
1355
|
+
const { t, i18n: i } = ce(["sidebar", "translation"]), { setOpenMobile: u, isMobile: l } = ge(), {
|
|
1352
1356
|
data: d,
|
|
1353
|
-
fetchNextPage:
|
|
1354
|
-
hasNextPage:
|
|
1355
|
-
isFetchingNextPage:
|
|
1356
|
-
isLoading:
|
|
1357
|
-
} = Sa(), { history:
|
|
1357
|
+
fetchNextPage: h,
|
|
1358
|
+
hasNextPage: p,
|
|
1359
|
+
isFetchingNextPage: m,
|
|
1360
|
+
isLoading: N
|
|
1361
|
+
} = Sa(), { history: v, app: k } = re(), s = k?.basePath || "/", M = v?.enabled ?? !1, T = d?.pages.flatMap((n) => n.threads) ?? [], [q, K] = Ce(), S = pe(), y = te(null), g = Y(
|
|
1358
1362
|
(n) => {
|
|
1359
|
-
y.current && (y.current.disconnect(), y.current = null), n &&
|
|
1360
|
-
(
|
|
1361
|
-
|
|
1363
|
+
y.current && (y.current.disconnect(), y.current = null), n && p && !m && (y.current = new IntersectionObserver(
|
|
1364
|
+
(H) => {
|
|
1365
|
+
H[0].isIntersecting && h();
|
|
1362
1366
|
},
|
|
1363
1367
|
{
|
|
1364
1368
|
threshold: 0,
|
|
@@ -1366,48 +1370,48 @@ function Ta({ side: a = "left" }) {
|
|
|
1366
1370
|
}
|
|
1367
1371
|
), y.current.observe(n));
|
|
1368
1372
|
},
|
|
1369
|
-
[
|
|
1370
|
-
), B =
|
|
1371
|
-
n.button !== 0 || n.metaKey || n.ctrlKey || (n.preventDefault(), K(
|
|
1372
|
-
}, [K,
|
|
1373
|
-
(n) => n.firstMessage?.toLowerCase().includes(
|
|
1374
|
-
).sort((n,
|
|
1373
|
+
[p, h, m]
|
|
1374
|
+
), B = D.getConfig().app?.cacheNamespace || "gentiq", [G, $] = P(!1), [A, U] = P(null), [E, Q] = P(""), [R, b] = P(null), [_, x] = P(""), c = te(null), w = Y((n, H) => {
|
|
1375
|
+
n.button !== 0 || n.metaKey || n.ctrlKey || (n.preventDefault(), K(H), l && u(!1));
|
|
1376
|
+
}, [K, l, u]), L = T.filter(
|
|
1377
|
+
(n) => n.firstMessage?.toLowerCase().includes(E.toLowerCase())
|
|
1378
|
+
).sort((n, H) => n.pinned && !H.pinned ? -1 : !n.pinned && H.pinned ? 1 : H.timestamp - n.timestamp), C = async (n) => {
|
|
1375
1379
|
try {
|
|
1376
|
-
await
|
|
1380
|
+
await D.pinThread(n.id.replace(/^\//, ""), !n.pinned), S.invalidateQueries({ queryKey: [B, "conversations"] }), J.success(n.pinned ? t("unpinned_success") : t("pinned_success"));
|
|
1377
1381
|
} catch {
|
|
1378
1382
|
J.error(t("pin_failed"));
|
|
1379
1383
|
}
|
|
1380
|
-
},
|
|
1384
|
+
}, I = async (n) => {
|
|
1381
1385
|
try {
|
|
1382
|
-
const
|
|
1386
|
+
const H = await D.shareThread(n.id.replace(/^\//, "")), fe = `${window.location.origin}${H.url}`;
|
|
1383
1387
|
navigator.clipboard.writeText(fe), J.success(t("share_success"), {
|
|
1384
1388
|
description: t("share_description")
|
|
1385
1389
|
});
|
|
1386
1390
|
} catch {
|
|
1387
1391
|
J.error(t("share_failed"));
|
|
1388
1392
|
}
|
|
1389
|
-
},
|
|
1390
|
-
b(n.id),
|
|
1393
|
+
}, W = (n) => {
|
|
1394
|
+
b(n.id), x(n.firstMessage ?? ""), setTimeout(() => c.current?.focus(), 0);
|
|
1391
1395
|
}, ae = (n) => {
|
|
1392
|
-
n?.preventDefault(), n?.stopPropagation(), b(null),
|
|
1396
|
+
n?.preventDefault(), n?.stopPropagation(), b(null), x("");
|
|
1393
1397
|
}, ee = async (n) => {
|
|
1394
|
-
if (n?.preventDefault(), n && "stopPropagation" in n && n.stopPropagation(), !(!
|
|
1398
|
+
if (n?.preventDefault(), n && "stopPropagation" in n && n.stopPropagation(), !(!R || !_.trim()))
|
|
1395
1399
|
try {
|
|
1396
|
-
await
|
|
1400
|
+
await D.updateThreadTitle(R, _), S.invalidateQueries({ queryKey: [B, "conversations"] }), b(null), J.success(t("rename_success"));
|
|
1397
1401
|
} catch {
|
|
1398
1402
|
J.error(t("rename_failed"));
|
|
1399
1403
|
}
|
|
1400
1404
|
}, oe = (n) => {
|
|
1401
|
-
|
|
1402
|
-
},
|
|
1403
|
-
|
|
1404
|
-
}, F = (n) => new Intl.DateTimeFormat(
|
|
1405
|
+
U(n), $(!0);
|
|
1406
|
+
}, o = () => {
|
|
1407
|
+
A && (Pa(A.id, S, K, q), $(!1), U(null), J.success(t("chat_deleted_success")));
|
|
1408
|
+
}, F = (n) => new Intl.DateTimeFormat(i.language, {
|
|
1405
1409
|
year: "numeric",
|
|
1406
1410
|
month: "short",
|
|
1407
1411
|
day: "numeric",
|
|
1408
1412
|
hour: "2-digit",
|
|
1409
1413
|
minute: "2-digit",
|
|
1410
|
-
calendar:
|
|
1414
|
+
calendar: i.language === "fa" ? "persian" : "gregory"
|
|
1411
1415
|
}).format(new Date(n));
|
|
1412
1416
|
return /* @__PURE__ */ e(Oe, { children: /* @__PURE__ */ r(xa, { collapsible: "icon", side: a, children: [
|
|
1413
1417
|
/* @__PURE__ */ e(Na, { className: "custom-scrollbar", children: /* @__PURE__ */ r(ka, { children: [
|
|
@@ -1420,7 +1424,7 @@ function Ta({ side: a = "left" }) {
|
|
|
1420
1424
|
children: /* @__PURE__ */ r(
|
|
1421
1425
|
"a",
|
|
1422
1426
|
{
|
|
1423
|
-
href: be(
|
|
1427
|
+
href: be(s, "/"),
|
|
1424
1428
|
onClick: (n) => w(n, "/"),
|
|
1425
1429
|
className: "px-5 group-data-[collapsible=icon]:px-0 group-data-[collapsible=icon]:justify-center flex items-center gap-3 active:scale-[0.96] w-full h-full relative",
|
|
1426
1430
|
children: [
|
|
@@ -1432,34 +1436,34 @@ function Ta({ side: a = "left" }) {
|
|
|
1432
1436
|
)
|
|
1433
1437
|
}
|
|
1434
1438
|
) }) }),
|
|
1435
|
-
|
|
1439
|
+
M && /* @__PURE__ */ e(Ee, { className: "group-data-[collapsible=icon]:hidden mb-6 px-2", children: /* @__PURE__ */ r("div", { className: "relative group/search", children: [
|
|
1436
1440
|
/* @__PURE__ */ e(Ft, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 opacity-40 group-focus-within/search:opacity-70 transition-opacity" }),
|
|
1437
1441
|
/* @__PURE__ */ e(
|
|
1438
1442
|
X,
|
|
1439
1443
|
{
|
|
1440
1444
|
placeholder: t("search_conversations"),
|
|
1441
|
-
value:
|
|
1442
|
-
onChange: (n) =>
|
|
1445
|
+
value: E,
|
|
1446
|
+
onChange: (n) => Q(n.target.value),
|
|
1443
1447
|
className: "pl-9 h-10 bg-accent/15 border border-border/40 focus-visible:ring-primary/20 rounded-xl transition-all"
|
|
1444
1448
|
}
|
|
1445
1449
|
)
|
|
1446
1450
|
] }) }),
|
|
1447
|
-
|
|
1451
|
+
M && /* @__PURE__ */ r(Ee, { className: "group-data-[collapsible=icon]:hidden", children: [
|
|
1448
1452
|
/* @__PURE__ */ r(Ae, { children: [
|
|
1449
|
-
|
|
1450
|
-
const fe =
|
|
1453
|
+
L.map((n, H) => {
|
|
1454
|
+
const fe = R === n.id, Se = Te(n.firstMessage ?? ""), Xe = Se === "rtl";
|
|
1451
1455
|
return /* @__PURE__ */ e(Le, { className: "group/sidebar-menu-item relative", children: fe ? /* @__PURE__ */ r("div", { className: "flex items-center gap-1 px-2 py-1.5 w-full", children: [
|
|
1452
1456
|
/* @__PURE__ */ e(
|
|
1453
1457
|
X,
|
|
1454
1458
|
{
|
|
1455
|
-
ref:
|
|
1456
|
-
value:
|
|
1457
|
-
onChange: (ie) =>
|
|
1459
|
+
ref: c,
|
|
1460
|
+
value: _,
|
|
1461
|
+
onChange: (ie) => x(ie.target.value),
|
|
1458
1462
|
onKeyDown: (ie) => {
|
|
1459
1463
|
ie.key === "Enter" && ee(), ie.key === "Escape" && ae();
|
|
1460
1464
|
},
|
|
1461
1465
|
className: "h-8 py-0 px-2 text-sm",
|
|
1462
|
-
dir: Te(
|
|
1466
|
+
dir: Te(_)
|
|
1463
1467
|
}
|
|
1464
1468
|
),
|
|
1465
1469
|
/* @__PURE__ */ e(Z, { size: "icon", variant: "ghost", className: "size-8 shrink-0 text-green-600 hover:text-green-700 hover:bg-green-50", onClick: ee, children: /* @__PURE__ */ e(jt, { className: "size-4" }) }),
|
|
@@ -1469,31 +1473,31 @@ function Ta({ side: a = "left" }) {
|
|
|
1469
1473
|
ze,
|
|
1470
1474
|
{
|
|
1471
1475
|
asChild: !0,
|
|
1472
|
-
className:
|
|
1473
|
-
"bg-accent opacity-100 pointer-events-none": n.id ===
|
|
1474
|
-
"opacity-70 hover:opacity-100": n.id !==
|
|
1476
|
+
className: f("h-auto py-2.5 px-3", {
|
|
1477
|
+
"bg-accent opacity-100 pointer-events-none": n.id === q,
|
|
1478
|
+
"opacity-70 hover:opacity-100": n.id !== q
|
|
1475
1479
|
}),
|
|
1476
1480
|
children: /* @__PURE__ */ r(
|
|
1477
1481
|
"a",
|
|
1478
1482
|
{
|
|
1479
|
-
href: be(
|
|
1483
|
+
href: be(s, n.id),
|
|
1480
1484
|
onClick: (ie) => w(ie, n.id),
|
|
1481
1485
|
dir: Se,
|
|
1482
|
-
className:
|
|
1486
|
+
className: f("flex flex-col gap-0.5 w-full overflow-hidden", Xe ? "items-end" : "items-start"),
|
|
1483
1487
|
children: [
|
|
1484
|
-
/* @__PURE__ */ e("span", { className:
|
|
1485
|
-
/* @__PURE__ */ e("div", { className:
|
|
1488
|
+
/* @__PURE__ */ e("span", { className: f("truncate w-full font-medium text-[0.9375rem]", i.language === "fa" ? "pl-16 text-right" : "pr-16 text-left"), children: n.firstMessage }),
|
|
1489
|
+
/* @__PURE__ */ e("div", { className: f("text-[10px] opacity-40 w-full", i.language === "fa" ? "pl-16 text-right" : "pr-16 text-left"), children: F(n.timestamp) })
|
|
1486
1490
|
]
|
|
1487
1491
|
}
|
|
1488
1492
|
)
|
|
1489
1493
|
}
|
|
1490
1494
|
),
|
|
1491
|
-
/* @__PURE__ */ r("div", { className:
|
|
1495
|
+
/* @__PURE__ */ r("div", { className: f(
|
|
1492
1496
|
"absolute top-1/2 -translate-y-1/2 flex items-center gap-1 transition-all duration-200 z-10",
|
|
1493
|
-
|
|
1497
|
+
i.language === "fa" ? "left-2" : "right-1.5"
|
|
1494
1498
|
), children: [
|
|
1495
1499
|
n.pinned && /* @__PURE__ */ e(De, { className: "size-3.5 text-primary opacity-70 md:absolute md:inset-0 md:m-auto md:group-hover/sidebar-menu-item:opacity-0 transition-opacity pointer-events-none" }),
|
|
1496
|
-
/* @__PURE__ */ r(ct, { dir:
|
|
1500
|
+
/* @__PURE__ */ r(ct, { dir: i.language === "fa" ? "rtl" : "ltr", children: [
|
|
1497
1501
|
/* @__PURE__ */ e(dt, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1498
1502
|
Z,
|
|
1499
1503
|
{
|
|
@@ -1509,19 +1513,19 @@ function Ta({ side: a = "left" }) {
|
|
|
1509
1513
|
align: "end",
|
|
1510
1514
|
className: "min-w-[120px] p-1",
|
|
1511
1515
|
children: [
|
|
1512
|
-
|
|
1516
|
+
v?.showPin !== !1 && /* @__PURE__ */ r(de, { onSelect: () => C(n), className: "cursor-pointer flex items-center gap-2", children: [
|
|
1513
1517
|
n.pinned ? /* @__PURE__ */ e(Bt, { className: "size-4" }) : /* @__PURE__ */ e(De, { className: "size-4" }),
|
|
1514
1518
|
/* @__PURE__ */ e("span", { children: n.pinned ? t("unpin_conversation") : t("pin_conversation") })
|
|
1515
1519
|
] }),
|
|
1516
|
-
|
|
1520
|
+
v?.showShare !== !1 && /* @__PURE__ */ r(de, { onSelect: () => I(n), className: "cursor-pointer flex items-center gap-2", children: [
|
|
1517
1521
|
/* @__PURE__ */ e(Ut, { className: "size-4" }),
|
|
1518
1522
|
/* @__PURE__ */ e("span", { children: t("share_conversation") })
|
|
1519
1523
|
] }),
|
|
1520
|
-
(
|
|
1524
|
+
(v?.showRename ?? !1) && /* @__PURE__ */ r(de, { onSelect: () => W(n), className: "cursor-pointer flex items-center gap-2", children: [
|
|
1521
1525
|
/* @__PURE__ */ e(Kt, { className: "size-4" }),
|
|
1522
1526
|
/* @__PURE__ */ e("span", { children: t("rename_conversation") })
|
|
1523
1527
|
] }),
|
|
1524
|
-
(
|
|
1528
|
+
(v?.showDelete ?? !1) && /* @__PURE__ */ r(
|
|
1525
1529
|
de,
|
|
1526
1530
|
{
|
|
1527
1531
|
className: "text-destructive focus:text-destructive focus:bg-destructive/10 cursor-pointer flex items-center gap-2",
|
|
@@ -1537,23 +1541,23 @@ function Ta({ side: a = "left" }) {
|
|
|
1537
1541
|
)
|
|
1538
1542
|
] })
|
|
1539
1543
|
] })
|
|
1540
|
-
] }) },
|
|
1544
|
+
] }) }, H);
|
|
1541
1545
|
}),
|
|
1542
|
-
!
|
|
1546
|
+
!N && T.length === 0 && !E && /* @__PURE__ */ e("div", { className: "px-4 py-8 text-center text-sm opacity-40", children: t("no_conversations") })
|
|
1543
1547
|
] }),
|
|
1544
|
-
/* @__PURE__ */ e("div", { ref:
|
|
1545
|
-
|
|
1548
|
+
/* @__PURE__ */ e("div", { ref: g, className: "h-4 w-full" }),
|
|
1549
|
+
m && /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-2 p-4 pt-0 opacity-60", children: [
|
|
1546
1550
|
/* @__PURE__ */ e("div", { className: "size-4 border-2 border-primary border-t-transparent rounded-full animate-spin" }),
|
|
1547
1551
|
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-wider font-medium", children: t("loading_more") })
|
|
1548
1552
|
] })
|
|
1549
1553
|
] })
|
|
1550
1554
|
] }) }),
|
|
1551
1555
|
/* @__PURE__ */ e(wa, {}),
|
|
1552
|
-
/* @__PURE__ */ e(He, { open:
|
|
1556
|
+
/* @__PURE__ */ e(He, { open: G, onOpenChange: $, children: /* @__PURE__ */ r(
|
|
1553
1557
|
Ve,
|
|
1554
1558
|
{
|
|
1555
1559
|
onKeyDown: (n) => {
|
|
1556
|
-
n.key === "Enter" && (n.preventDefault(),
|
|
1560
|
+
n.key === "Enter" && (n.preventDefault(), o());
|
|
1557
1561
|
},
|
|
1558
1562
|
children: [
|
|
1559
1563
|
/* @__PURE__ */ r(mt, { children: [
|
|
@@ -1566,37 +1570,37 @@ function Ta({ side: a = "left" }) {
|
|
|
1566
1570
|
{
|
|
1567
1571
|
variant: "outline",
|
|
1568
1572
|
onClick: () => {
|
|
1569
|
-
|
|
1573
|
+
$(!1);
|
|
1570
1574
|
},
|
|
1571
1575
|
children: t("cancel")
|
|
1572
1576
|
}
|
|
1573
1577
|
),
|
|
1574
|
-
/* @__PURE__ */ e(Z, { variant: "destructive", onClick:
|
|
1578
|
+
/* @__PURE__ */ e(Z, { variant: "destructive", onClick: o, autoFocus: !0, children: t("delete") })
|
|
1575
1579
|
] })
|
|
1576
1580
|
]
|
|
1577
1581
|
}
|
|
1578
1582
|
) })
|
|
1579
1583
|
] }) });
|
|
1580
1584
|
}
|
|
1581
|
-
function Va({ sidebar: a, header: t, components:
|
|
1582
|
-
const { config:
|
|
1583
|
-
return /* @__PURE__ */ r(va, { defaultOpen:
|
|
1584
|
-
a !== void 0 ? a :
|
|
1585
|
+
function Va({ sidebar: a, header: t, components: i, classNames: u, disclaimer: l, welcome: d }) {
|
|
1586
|
+
const { config: h } = je(), { history: p } = re(), m = h?.language === "fa" ? "right" : "left", N = p?.enabled ?? !0;
|
|
1587
|
+
return /* @__PURE__ */ r(va, { defaultOpen: N, children: [
|
|
1588
|
+
a !== void 0 ? a : N ? /* @__PURE__ */ e(Ta, { side: m }) : null,
|
|
1585
1589
|
/* @__PURE__ */ r("div", { className: "flex flex-col flex-1 h-dvh overflow-hidden relative", children: [
|
|
1586
1590
|
t !== void 0 ? t : /* @__PURE__ */ e(We, {}),
|
|
1587
1591
|
/* @__PURE__ */ e(
|
|
1588
1592
|
"div",
|
|
1589
1593
|
{
|
|
1590
|
-
className:
|
|
1594
|
+
className: f(
|
|
1591
1595
|
"flex flex-col relative w-full flex-1 min-h-0 overflow-hidden",
|
|
1592
1596
|
"has-[.stick-to-bottom:empty]:overflow-visible has-[.stick-to-bottom:empty]:flex-initial transition-[flex] duration-200"
|
|
1593
1597
|
),
|
|
1594
1598
|
children: /* @__PURE__ */ e(
|
|
1595
1599
|
na,
|
|
1596
1600
|
{
|
|
1597
|
-
components:
|
|
1598
|
-
classNames:
|
|
1599
|
-
disclaimer:
|
|
1601
|
+
components: i,
|
|
1602
|
+
classNames: u,
|
|
1603
|
+
disclaimer: l,
|
|
1600
1604
|
welcome: d
|
|
1601
1605
|
}
|
|
1602
1606
|
)
|
|
@@ -1606,110 +1610,110 @@ function Va({ sidebar: a, header: t, components: o, classNames: m, disclaimer: c
|
|
|
1606
1610
|
] });
|
|
1607
1611
|
}
|
|
1608
1612
|
function Qa({ children: a }) {
|
|
1609
|
-
const [t,
|
|
1610
|
-
return
|
|
1613
|
+
const [t, i] = P(null), u = Qe(), l = _e(), d = pe();
|
|
1614
|
+
return O(() => {
|
|
1611
1615
|
(async () => {
|
|
1612
|
-
const
|
|
1613
|
-
if (
|
|
1616
|
+
const p = new URLSearchParams(u.search), m = p.get("token");
|
|
1617
|
+
if (m)
|
|
1614
1618
|
try {
|
|
1615
|
-
|
|
1616
|
-
const
|
|
1617
|
-
|
|
1619
|
+
D.setToken(m), await D.getBalance(), p.delete("token");
|
|
1620
|
+
const v = p.toString(), k = u.pathname + (v ? `?${v}` : "");
|
|
1621
|
+
l(k, { replace: !0 }), i(!0);
|
|
1618
1622
|
return;
|
|
1619
|
-
} catch (
|
|
1620
|
-
console.error("Error validating token from URL:",
|
|
1623
|
+
} catch (v) {
|
|
1624
|
+
console.error("Error validating token from URL:", v), i(!1);
|
|
1621
1625
|
return;
|
|
1622
1626
|
}
|
|
1623
|
-
if (!
|
|
1624
|
-
|
|
1627
|
+
if (!D.getToken()) {
|
|
1628
|
+
i(!1);
|
|
1625
1629
|
return;
|
|
1626
1630
|
}
|
|
1627
1631
|
try {
|
|
1628
|
-
await
|
|
1629
|
-
} catch (
|
|
1630
|
-
console.error("Token validation failed:",
|
|
1632
|
+
await D.getBalance(), i(!0);
|
|
1633
|
+
} catch (v) {
|
|
1634
|
+
console.error("Token validation failed:", v), v.status === 401 ? (D.clearToken(), d.clear(), i(!1)) : i(!0);
|
|
1631
1635
|
}
|
|
1632
1636
|
})();
|
|
1633
|
-
}, [
|
|
1637
|
+
}, [u.search, l, u.pathname, d]), t === null ? /* @__PURE__ */ e("div", { className: "flex h-screen w-full items-center justify-center", children: /* @__PURE__ */ e("div", { className: "size-8 rounded-full border-4 border-primary border-t-transparent animate-spin" }) }) : t ? /* @__PURE__ */ e(ke, { children: a }) : /* @__PURE__ */ e(Xt, { to: "/login", replace: !0 });
|
|
1634
1638
|
}
|
|
1635
1639
|
const qe = (a) => a.replace(/[^0-9]/g, "");
|
|
1636
1640
|
function Ga() {
|
|
1637
|
-
const { t: a, i18n: t } = ce(["login", "translation"]), { app:
|
|
1638
|
-
const
|
|
1639
|
-
return
|
|
1640
|
-
w.defaultValue !== void 0 && (
|
|
1641
|
-
}),
|
|
1641
|
+
const { t: a, i18n: t } = ce(["login", "translation"]), { app: i } = re(), u = t.dir() === "rtl", l = u ? "text-right" : "text-left", d = _e(), h = pe(), [p, m] = P("login"), N = !!i?.disableSignup, v = !!i?.disableAuthPage, [k, s] = P(""), [M, T] = P(""), [q, K] = P(""), [S, y] = P(""), [g, z] = P(""), [B, G] = P(""), $ = j(() => i?.userMetadataFields?.filter((c) => c.showInSignup) || [], [i?.userMetadataFields]), [A, U] = P(() => {
|
|
1642
|
+
const c = {};
|
|
1643
|
+
return $.forEach((w) => {
|
|
1644
|
+
w.defaultValue !== void 0 && (c[w.key] = w.defaultValue);
|
|
1645
|
+
}), c;
|
|
1642
1646
|
});
|
|
1643
|
-
|
|
1644
|
-
const
|
|
1647
|
+
O(() => {
|
|
1648
|
+
const c = { ...A };
|
|
1645
1649
|
let w = !1;
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
}), w &&
|
|
1649
|
-
}, [
|
|
1650
|
-
const [
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
}, [
|
|
1654
|
-
const
|
|
1655
|
-
|
|
1650
|
+
$.forEach((L) => {
|
|
1651
|
+
L.condition && !he(L.condition, A) && c[L.key] !== void 0 && (delete c[L.key], w = !0);
|
|
1652
|
+
}), w && U(c);
|
|
1653
|
+
}, [A, $]);
|
|
1654
|
+
const [E, Q] = P(""), [R, b] = P(!1);
|
|
1655
|
+
O(() => {
|
|
1656
|
+
N && p === "register" && m("login");
|
|
1657
|
+
}, [N, p]);
|
|
1658
|
+
const _ = async (c) => {
|
|
1659
|
+
c.preventDefault(), Q(""), b(!0);
|
|
1656
1660
|
try {
|
|
1657
|
-
await
|
|
1661
|
+
await D.login(k, M), h.clear(), d("/");
|
|
1658
1662
|
} catch (w) {
|
|
1659
|
-
|
|
1663
|
+
Q(le(w, a));
|
|
1660
1664
|
} finally {
|
|
1661
1665
|
b(!1);
|
|
1662
1666
|
}
|
|
1663
|
-
},
|
|
1664
|
-
|
|
1667
|
+
}, x = async (c) => {
|
|
1668
|
+
c.preventDefault(), Q(""), b(!0);
|
|
1665
1669
|
try {
|
|
1666
|
-
await
|
|
1670
|
+
await D.register(q, S, g, B, A), h.clear(), d("/");
|
|
1667
1671
|
} catch (w) {
|
|
1668
|
-
|
|
1672
|
+
Q(le(w, a));
|
|
1669
1673
|
} finally {
|
|
1670
1674
|
b(!1);
|
|
1671
1675
|
}
|
|
1672
1676
|
};
|
|
1673
|
-
return
|
|
1674
|
-
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold", children:
|
|
1677
|
+
return v ? /* @__PURE__ */ e("div", { className: "min-h-screen bg-background flex items-center justify-center p-4", dir: t.dir(), children: /* @__PURE__ */ r("div", { className: "w-full max-w-lg bg-card border border-border rounded-xl shadow-lg p-8 text-center space-y-4", children: [
|
|
1678
|
+
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold", children: i?.name }),
|
|
1675
1679
|
/* @__PURE__ */ e("p", { className: "text-muted-foreground", children: a("auth_page_disabled_title", "The sign-in page is currently disabled.") }),
|
|
1676
1680
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground/80", children: a("auth_page_disabled_description", "Please contact the administrator for access.") })
|
|
1677
1681
|
] }) }) : /* @__PURE__ */ e("div", { className: "min-h-screen bg-background flex flex-col items-center justify-center p-4", dir: t.dir(), children: /* @__PURE__ */ r("div", { className: "w-full max-w-md bg-card border border-border rounded-xl shadow-lg p-6", children: [
|
|
1678
|
-
/* @__PURE__ */ e("div", { className: "text-center mb-6", children: /* @__PURE__ */ e("h1", { className: "text-2xl font-bold bg-gradient-to-r from-primary to-primary/60 bg-clip-text text-transparent", children:
|
|
1682
|
+
/* @__PURE__ */ e("div", { className: "text-center mb-6", children: /* @__PURE__ */ e("h1", { className: "text-2xl font-bold bg-gradient-to-r from-primary to-primary/60 bg-clip-text text-transparent", children: i?.name }) }),
|
|
1679
1683
|
/* @__PURE__ */ r("div", { className: "flex bg-muted p-1 rounded-lg mb-6", children: [
|
|
1680
1684
|
/* @__PURE__ */ e(
|
|
1681
1685
|
"button",
|
|
1682
1686
|
{
|
|
1683
1687
|
type: "button",
|
|
1684
1688
|
onClick: () => {
|
|
1685
|
-
|
|
1689
|
+
m("login"), Q("");
|
|
1686
1690
|
},
|
|
1687
|
-
className: `flex-1 py-2 text-sm font-medium rounded-md transition-all ${
|
|
1691
|
+
className: `flex-1 py-2 text-sm font-medium rounded-md transition-all ${p === "login" ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"}`,
|
|
1688
1692
|
children: a("login_tab", "Login")
|
|
1689
1693
|
}
|
|
1690
1694
|
),
|
|
1691
|
-
!
|
|
1695
|
+
!N && /* @__PURE__ */ e(
|
|
1692
1696
|
"button",
|
|
1693
1697
|
{
|
|
1694
1698
|
type: "button",
|
|
1695
1699
|
onClick: () => {
|
|
1696
|
-
|
|
1700
|
+
m("register"), Q("");
|
|
1697
1701
|
},
|
|
1698
|
-
className: `flex-1 py-2 text-sm font-medium rounded-md transition-all ${
|
|
1702
|
+
className: `flex-1 py-2 text-sm font-medium rounded-md transition-all ${p === "register" ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"}`,
|
|
1699
1703
|
children: a("signup_tab", "Sign Up")
|
|
1700
1704
|
}
|
|
1701
1705
|
)
|
|
1702
1706
|
] }),
|
|
1703
|
-
|
|
1707
|
+
p === "login" && /* @__PURE__ */ r("form", { onSubmit: _, className: "space-y-4", children: [
|
|
1704
1708
|
/* @__PURE__ */ r("div", { className: "space-y-3", children: [
|
|
1705
|
-
/* @__PURE__ */ e(
|
|
1709
|
+
/* @__PURE__ */ e(V, { htmlFor: "login-phone", children: a("phone", "Phone") }),
|
|
1706
1710
|
/* @__PURE__ */ e(
|
|
1707
1711
|
X,
|
|
1708
1712
|
{
|
|
1709
1713
|
id: "login-phone",
|
|
1710
1714
|
type: "tel",
|
|
1711
|
-
value:
|
|
1712
|
-
onChange: (
|
|
1715
|
+
value: k,
|
|
1716
|
+
onChange: (c) => s(qe(c.target.value)),
|
|
1713
1717
|
required: !0,
|
|
1714
1718
|
className: "text-left",
|
|
1715
1719
|
placeholder: a("phone_placeholder", "Phone number"),
|
|
@@ -1718,14 +1722,14 @@ function Ga() {
|
|
|
1718
1722
|
)
|
|
1719
1723
|
] }),
|
|
1720
1724
|
/* @__PURE__ */ r("div", { className: "space-y-3", children: [
|
|
1721
|
-
/* @__PURE__ */ e(
|
|
1725
|
+
/* @__PURE__ */ e(V, { htmlFor: "login-pass", children: a("password", "Password") }),
|
|
1722
1726
|
/* @__PURE__ */ e(
|
|
1723
1727
|
X,
|
|
1724
1728
|
{
|
|
1725
1729
|
id: "login-pass",
|
|
1726
1730
|
type: "password",
|
|
1727
|
-
value:
|
|
1728
|
-
onChange: (
|
|
1731
|
+
value: M,
|
|
1732
|
+
onChange: (c) => T(c.target.value),
|
|
1729
1733
|
required: !0,
|
|
1730
1734
|
className: "text-left",
|
|
1731
1735
|
placeholder: "••••••••",
|
|
@@ -1733,27 +1737,27 @@ function Ga() {
|
|
|
1733
1737
|
}
|
|
1734
1738
|
)
|
|
1735
1739
|
] }),
|
|
1736
|
-
|
|
1740
|
+
E && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: E }),
|
|
1737
1741
|
/* @__PURE__ */ e(
|
|
1738
1742
|
Z,
|
|
1739
1743
|
{
|
|
1740
1744
|
type: "submit",
|
|
1741
|
-
disabled:
|
|
1745
|
+
disabled: R,
|
|
1742
1746
|
className: "w-full font-semibold",
|
|
1743
|
-
children:
|
|
1747
|
+
children: R ? a("logging_in", "Logging in...") : a("login_button", "Login")
|
|
1744
1748
|
}
|
|
1745
1749
|
)
|
|
1746
1750
|
] }),
|
|
1747
|
-
!
|
|
1751
|
+
!N && p === "register" && /* @__PURE__ */ r("form", { onSubmit: x, className: "space-y-4", children: [
|
|
1748
1752
|
/* @__PURE__ */ r("div", { className: "space-y-3", children: [
|
|
1749
|
-
/* @__PURE__ */ e(
|
|
1753
|
+
/* @__PURE__ */ e(V, { htmlFor: "reg-phone", children: a("phone", "Phone") }),
|
|
1750
1754
|
/* @__PURE__ */ e(
|
|
1751
1755
|
X,
|
|
1752
1756
|
{
|
|
1753
1757
|
id: "reg-phone",
|
|
1754
1758
|
type: "tel",
|
|
1755
|
-
value:
|
|
1756
|
-
onChange: (
|
|
1759
|
+
value: q,
|
|
1760
|
+
onChange: (c) => K(qe(c.target.value)),
|
|
1757
1761
|
required: !0,
|
|
1758
1762
|
className: "text-left",
|
|
1759
1763
|
placeholder: a("phone_placeholder", "Phone number"),
|
|
@@ -1762,14 +1766,14 @@ function Ga() {
|
|
|
1762
1766
|
)
|
|
1763
1767
|
] }),
|
|
1764
1768
|
/* @__PURE__ */ r("div", { className: "space-y-3", children: [
|
|
1765
|
-
/* @__PURE__ */ e(
|
|
1769
|
+
/* @__PURE__ */ e(V, { htmlFor: "reg-pass", children: a("password", "Password") }),
|
|
1766
1770
|
/* @__PURE__ */ e(
|
|
1767
1771
|
X,
|
|
1768
1772
|
{
|
|
1769
1773
|
id: "reg-pass",
|
|
1770
1774
|
type: "password",
|
|
1771
|
-
value:
|
|
1772
|
-
onChange: (
|
|
1775
|
+
value: S,
|
|
1776
|
+
onChange: (c) => y(c.target.value),
|
|
1773
1777
|
required: !0,
|
|
1774
1778
|
className: "text-left",
|
|
1775
1779
|
placeholder: "••••••••",
|
|
@@ -1779,128 +1783,128 @@ function Ga() {
|
|
|
1779
1783
|
] }),
|
|
1780
1784
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
1781
1785
|
/* @__PURE__ */ r("div", { className: "space-y-3", children: [
|
|
1782
|
-
/* @__PURE__ */ e(
|
|
1786
|
+
/* @__PURE__ */ e(V, { htmlFor: "reg-name", children: a("name", "Name") }),
|
|
1783
1787
|
/* @__PURE__ */ e(
|
|
1784
1788
|
X,
|
|
1785
1789
|
{
|
|
1786
1790
|
id: "reg-name",
|
|
1787
1791
|
type: "text",
|
|
1788
|
-
value:
|
|
1789
|
-
onChange: (
|
|
1792
|
+
value: g,
|
|
1793
|
+
onChange: (c) => z(c.target.value),
|
|
1790
1794
|
required: !0,
|
|
1791
|
-
className:
|
|
1795
|
+
className: l,
|
|
1792
1796
|
placeholder: a("name_placeholder", "First Name")
|
|
1793
1797
|
}
|
|
1794
1798
|
)
|
|
1795
1799
|
] }),
|
|
1796
1800
|
/* @__PURE__ */ r("div", { className: "space-y-3", children: [
|
|
1797
|
-
/* @__PURE__ */ e(
|
|
1801
|
+
/* @__PURE__ */ e(V, { htmlFor: "reg-surname", children: a("surname", "Surname") }),
|
|
1798
1802
|
/* @__PURE__ */ e(
|
|
1799
1803
|
X,
|
|
1800
1804
|
{
|
|
1801
1805
|
id: "reg-surname",
|
|
1802
1806
|
type: "text",
|
|
1803
1807
|
value: B,
|
|
1804
|
-
onChange: (
|
|
1808
|
+
onChange: (c) => G(c.target.value),
|
|
1805
1809
|
required: !0,
|
|
1806
|
-
className:
|
|
1810
|
+
className: l,
|
|
1807
1811
|
placeholder: a("surname_placeholder", "Last Name")
|
|
1808
1812
|
}
|
|
1809
1813
|
)
|
|
1810
1814
|
] })
|
|
1811
1815
|
] }),
|
|
1812
|
-
|
|
1813
|
-
/* @__PURE__ */ e(
|
|
1814
|
-
|
|
1816
|
+
$.map((c) => he(c.condition, A) ? /* @__PURE__ */ r("div", { className: "space-y-3 animate-in fade-in slide-in-from-top-1 duration-200", children: [
|
|
1817
|
+
/* @__PURE__ */ e(V, { htmlFor: `signup-${c.key}`, children: a(c.label) }),
|
|
1818
|
+
c.type === "select" ? /* @__PURE__ */ r(
|
|
1815
1819
|
ve,
|
|
1816
1820
|
{
|
|
1817
|
-
value: String(
|
|
1818
|
-
onValueChange: (w) =>
|
|
1819
|
-
required:
|
|
1820
|
-
dir:
|
|
1821
|
+
value: String(A[c.key] || ""),
|
|
1822
|
+
onValueChange: (w) => U({ ...A, [c.key]: w }),
|
|
1823
|
+
required: c.required,
|
|
1824
|
+
dir: u ? "rtl" : "ltr",
|
|
1821
1825
|
children: [
|
|
1822
|
-
/* @__PURE__ */ e(xe, { className:
|
|
1823
|
-
/* @__PURE__ */ e(we, { className: "rounded-xl", children:
|
|
1826
|
+
/* @__PURE__ */ e(xe, { className: f("bg-background", l), children: /* @__PURE__ */ e(ye, { placeholder: a(c.placeholder || "select_placeholder") }) }),
|
|
1827
|
+
/* @__PURE__ */ e(we, { className: "rounded-xl", children: c.options?.map((w) => /* @__PURE__ */ e(me, { value: String(w.value), children: a(w.label) }, String(w.value))) })
|
|
1824
1828
|
]
|
|
1825
1829
|
}
|
|
1826
|
-
) :
|
|
1830
|
+
) : c.type === "checkbox" ? /* @__PURE__ */ r("div", { className: "flex items-center gap-2 py-2", children: [
|
|
1827
1831
|
/* @__PURE__ */ e(
|
|
1828
1832
|
ft,
|
|
1829
1833
|
{
|
|
1830
|
-
id: `signup-${
|
|
1831
|
-
checked: !!
|
|
1832
|
-
onCheckedChange: (w) =>
|
|
1833
|
-
required:
|
|
1834
|
+
id: `signup-${c.key}`,
|
|
1835
|
+
checked: !!A[c.key],
|
|
1836
|
+
onCheckedChange: (w) => U({ ...A, [c.key]: !!w }),
|
|
1837
|
+
required: c.required
|
|
1834
1838
|
}
|
|
1835
1839
|
),
|
|
1836
|
-
/* @__PURE__ */ e("label", { htmlFor: `signup-${
|
|
1840
|
+
/* @__PURE__ */ e("label", { htmlFor: `signup-${c.key}`, className: "text-sm text-muted-foreground cursor-pointer select-none", children: a(c.placeholder || c.label) })
|
|
1837
1841
|
] }) : /* @__PURE__ */ e(
|
|
1838
1842
|
X,
|
|
1839
1843
|
{
|
|
1840
|
-
id: `signup-${
|
|
1841
|
-
type:
|
|
1842
|
-
value:
|
|
1843
|
-
onChange: (w) =>
|
|
1844
|
-
required:
|
|
1845
|
-
className:
|
|
1846
|
-
placeholder: a(
|
|
1844
|
+
id: `signup-${c.key}`,
|
|
1845
|
+
type: c.type,
|
|
1846
|
+
value: A[c.key] || "",
|
|
1847
|
+
onChange: (w) => U({ ...A, [c.key]: w.target.value }),
|
|
1848
|
+
required: c.required,
|
|
1849
|
+
className: l,
|
|
1850
|
+
placeholder: a(c.placeholder || "")
|
|
1847
1851
|
}
|
|
1848
1852
|
)
|
|
1849
|
-
] },
|
|
1850
|
-
|
|
1853
|
+
] }, c.key) : null),
|
|
1854
|
+
E && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: E }),
|
|
1851
1855
|
/* @__PURE__ */ e(
|
|
1852
1856
|
Z,
|
|
1853
1857
|
{
|
|
1854
1858
|
type: "submit",
|
|
1855
|
-
disabled:
|
|
1859
|
+
disabled: R,
|
|
1856
1860
|
className: "w-full font-semibold",
|
|
1857
|
-
children:
|
|
1861
|
+
children: R ? a("signing_up", "Signing up...") : a("signup_button", "Sign Up")
|
|
1858
1862
|
}
|
|
1859
1863
|
)
|
|
1860
1864
|
] })
|
|
1861
1865
|
] }) });
|
|
1862
1866
|
}
|
|
1863
1867
|
function Ma() {
|
|
1864
|
-
const { shareId: a } = Jt(), [t,
|
|
1865
|
-
return
|
|
1866
|
-
|
|
1867
|
-
}, []),
|
|
1868
|
+
const { shareId: a } = Jt(), [t, i] = P(null), [u, l] = P(!0), [d, h] = P(null), { MessageList: p } = re(), m = te(/* @__PURE__ */ new Set());
|
|
1869
|
+
return O(() => () => {
|
|
1870
|
+
m.current.forEach((N) => URL.revokeObjectURL(N)), m.current.clear();
|
|
1871
|
+
}, []), O(() => {
|
|
1868
1872
|
if (!a) return;
|
|
1869
1873
|
(async () => {
|
|
1870
1874
|
try {
|
|
1871
|
-
|
|
1872
|
-
const
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
if (!
|
|
1876
|
-
const
|
|
1877
|
-
|
|
1878
|
-
if (
|
|
1875
|
+
l(!0);
|
|
1876
|
+
const v = await D.getSharedThread(a);
|
|
1877
|
+
v.items && (v.items = await Promise.all(
|
|
1878
|
+
v.items.map(async (k) => {
|
|
1879
|
+
if (!k.parts) return k;
|
|
1880
|
+
const s = await Promise.all(
|
|
1881
|
+
k.parts.map(async (M) => {
|
|
1882
|
+
if (M.type === "file" && M.object_name && !M.url)
|
|
1879
1883
|
try {
|
|
1880
|
-
const
|
|
1881
|
-
return
|
|
1882
|
-
} catch (
|
|
1883
|
-
console.error("Failed to resolve shared attachment:",
|
|
1884
|
+
const T = await D.getPublicAttachmentBlobUrl(M.object_name);
|
|
1885
|
+
return m.current.add(T), { ...M, url: T };
|
|
1886
|
+
} catch (T) {
|
|
1887
|
+
console.error("Failed to resolve shared attachment:", M.object_name, T);
|
|
1884
1888
|
}
|
|
1885
|
-
return
|
|
1889
|
+
return M;
|
|
1886
1890
|
})
|
|
1887
1891
|
);
|
|
1888
|
-
return { ...
|
|
1892
|
+
return { ...k, parts: s };
|
|
1889
1893
|
})
|
|
1890
|
-
)),
|
|
1891
|
-
} catch (
|
|
1892
|
-
console.error("Failed to fetch shared chat:",
|
|
1894
|
+
)), i(v);
|
|
1895
|
+
} catch (v) {
|
|
1896
|
+
console.error("Failed to fetch shared chat:", v), h(v.message || "Failed to load shared chat");
|
|
1893
1897
|
} finally {
|
|
1894
|
-
|
|
1898
|
+
l(!1);
|
|
1895
1899
|
}
|
|
1896
1900
|
})();
|
|
1897
|
-
}, [a]),
|
|
1901
|
+
}, [a]), u ? /* @__PURE__ */ e("div", { className: "flex h-dvh items-center justify-center", children: /* @__PURE__ */ e(bt, {}) }) : d || !t ? /* @__PURE__ */ r("div", { className: "flex h-dvh flex-col items-center justify-center p-4 text-center", children: [
|
|
1898
1902
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-destructive mb-2 font-display", children: "Shared Chat Not Found" }),
|
|
1899
1903
|
/* @__PURE__ */ e("p", { className: "text-muted-foreground max-w-md", children: d || "This shared conversation might have been deleted or the link is invalid." })
|
|
1900
1904
|
] }) : /* @__PURE__ */ r("div", { className: "relative flex flex-col h-dvh overflow-hidden bg-background", children: [
|
|
1901
1905
|
/* @__PURE__ */ e(We, { hideActions: !0 }),
|
|
1902
1906
|
/* @__PURE__ */ e("div", { className: "flex-1 min-h-0 overflow-hidden relative flex flex-col", children: /* @__PURE__ */ e(
|
|
1903
|
-
|
|
1907
|
+
p,
|
|
1904
1908
|
{
|
|
1905
1909
|
messages: t.items || [],
|
|
1906
1910
|
status: "ready",
|
|
@@ -1953,6 +1957,6 @@ export {
|
|
|
1953
1957
|
re as useComponents,
|
|
1954
1958
|
aa as useGentiqChat,
|
|
1955
1959
|
er as useTranslation,
|
|
1956
|
-
|
|
1960
|
+
D as userAPI,
|
|
1957
1961
|
tr as withTranslation
|
|
1958
1962
|
};
|