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