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