gentiq 0.7.30 → 0.7.32

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