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