gentiq 0.7.28 → 0.7.29

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