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