gentiq 0.7.20 → 0.7.21

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