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