gentiq 0.7.21 → 0.7.22

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,18 +1,18 @@
1
1
  import { jsx as e, jsxs as n, Fragment as Ne } from "react/jsx-runtime";
2
2
  import * as Z from "react";
3
- import { useState as C, useMemo as j, useEffect as $, useRef as ee, useCallback as J, useLayoutEffect as Ge } from "react";
4
- import { QueryClient as We, QueryClientProvider as Xe, useQueryClient as he, useQuery as Je, useInfiniteQuery as Ye } from "@tanstack/react-query";
5
- import { I18nextProvider as Ze, useTranslation as ie } from "react-i18next";
3
+ import { useState as C, useMemo as j, useEffect as $, useRef as ee, useCallback as J, useLayoutEffect as Ve } from "react";
4
+ import { QueryClient as We, QueryClientProvider as Xe, useQueryClient as pe, useQuery as Je, useInfiniteQuery as Ye } from "@tanstack/react-query";
5
+ import { I18nextProvider as Ze, useTranslation as le } from "react-i18next";
6
6
  import { Trans as Xa, Translation as Ja, useTranslation as Ya, withTranslation as Za } from "react-i18next";
7
- import { g as et, u as T, d as tt, C as ze, T as at, a as te, b as Re, j as fe, G as rt, c as oe, e as p, f as qe, h as Fe, i as Oe, k as je, B as Y, l as $e, m as me, D as Be, n as nt, o as Ue, L as Q, I as G, S as be, p as ve, q as xe, r as ye, s as ue, t as st, v as Se, w as ot, x as it, y as lt, z as ce, A as ct, E as dt, F as ut, H as mt, J as ht, K as pt } from "./checkbox-eHCIm0ql.js";
7
+ import { g as et, u as T, d as tt, C as ze, T as at, a as te, b as Re, j as fe, G as rt, c as ie, e as p, f as qe, h as Fe, i as Oe, k as je, B as Y, l as $e, m as he, D as Be, n as nt, o as Ue, L as Q, I as V, S as be, p as ve, q as xe, r as ye, s as me, t as st, v as Se, w as ot, x as it, y as lt, z as de, A as ct, E as dt, F as ut, H as mt, J as ht, K as pt } from "./checkbox-eHCIm0ql.js";
8
8
  import { M as tr, N as ar, P as rr, O as nr, R as sr, Q as or, U as ir, V as lr, W as cr, X as dr, Y as ur, Z as mr, _ as hr } from "./checkbox-eHCIm0ql.js";
9
9
  import { Loader2Icon as gt, OctagonXIcon as ft, TriangleAlertIcon as bt, InfoIcon as vt, CircleCheckIcon as xt, XIcon as yt, PanelLeftIcon as wt, Layers as Pe, User as Nt, ShieldCheck as kt, Settings as we, Smartphone as Ct, Lock as _t, Save as St, Sun as Pt, Moon as Mt, Monitor as Tt, Zap as Me, Globe as It, Coins as Dt, LogOut as Et, CirclePlus as Lt, Plus as At, Search as zt, Check as Rt, X as qt, Pin as Te, MoreVertical as Ft, PinOff as Ot, Share2 as jt, Pencil as $t, Trash as Bt } from "lucide-react";
10
10
  import { useTheme as Ut } from "next-themes";
11
11
  import { Toaster as Kt, toast as X } from "sonner";
12
12
  import { useChat as Ht } from "@ai-sdk/react";
13
13
  import { DefaultChatTransport as Qt } from "ai";
14
- import { useLocation as Ke, useNavigate as ke, Navigate as Vt, useParams as Gt } from "react-router-dom";
15
- import { nanoid as de } from "nanoid";
14
+ import { useLocation as Ke, useNavigate as ke, Navigate as Gt, useParams as Vt } from "react-router-dom";
15
+ import { nanoid as ue } from "nanoid";
16
16
  import { Slot as Wt } from "@radix-ui/react-slot";
17
17
  import { cva as Xt } from "class-variance-authority";
18
18
  import "@radix-ui/react-separator";
@@ -216,9 +216,9 @@ function Ce() {
216
216
  return [i, c];
217
217
  }
218
218
  function Zt({ onFinish: r } = {}) {
219
- const { t } = ie(["chat", "errors"]), o = he(), d = T.getConfig(), i = d.app?.cacheNamespace || "gentiq", [c, m] = Ce(), [g, u] = C(() => de()), w = ee(/* @__PURE__ */ new Set());
219
+ const { t } = le(["chat", "errors"]), o = pe(), d = T.getConfig(), i = d.app?.cacheNamespace || "gentiq", [c, m] = Ce(), [g, u] = C(() => ue()), w = ee(/* @__PURE__ */ new Set());
220
220
  $(() => {
221
- c === "/" ? u(de()) : g && c !== `/${g}` && u(de());
221
+ c === "/" ? u(ue()) : g && c !== `/${g}` && u(ue());
222
222
  }, [c]);
223
223
  const b = j(() => c === "/" ? g : c.replace(/^\//, ""), [c, g]), v = J((f) => (w.current.add(f), f), []), l = J(() => {
224
224
  w.current.forEach((f) => URL.revokeObjectURL(f)), w.current.clear();
@@ -236,7 +236,7 @@ function Zt({ onFinish: r } = {}) {
236
236
  const f = await T.getThreadMessages(b);
237
237
  return !f.items || !Array.isArray(f.items) ? [] : Promise.all(
238
238
  f.items.map(async (s) => {
239
- const x = typeof s.content == "string" ? s.content : s.content?.text || JSON.stringify(s.content), A = [...Array.isArray(s.parts) && s.parts.length > 0 ? s.parts : [{ type: "text", text: x }]].sort((N, R) => N.type === "file" && R.type !== "file" ? -1 : N.type !== "file" && R.type === "file" ? 1 : 0), V = await Promise.all(
239
+ const x = typeof s.content == "string" ? s.content : s.content?.text || JSON.stringify(s.content), A = [...Array.isArray(s.parts) && s.parts.length > 0 ? s.parts : [{ type: "text", text: x }]].sort((N, R) => N.type === "file" && R.type !== "file" ? -1 : N.type !== "file" && R.type === "file" ? 1 : 0), G = await Promise.all(
240
240
  A.map(async (N) => {
241
241
  if (N.type === "file" && N.object_name && !N.url)
242
242
  try {
@@ -249,9 +249,9 @@ function Zt({ onFinish: r } = {}) {
249
249
  })
250
250
  );
251
251
  return {
252
- id: s.id || de(),
252
+ id: s.id || ue(),
253
253
  role: s.role,
254
- parts: V,
254
+ parts: G,
255
255
  metadata: { feedback: s.feedback }
256
256
  };
257
257
  })
@@ -267,7 +267,7 @@ function Zt({ onFinish: r } = {}) {
267
267
  Object.entries(D).forEach(([R, W]) => {
268
268
  x.set(R, W);
269
269
  }), x.set("X-Thread-Id", b);
270
- const A = d.api?.basePath || "/api", V = typeof f == "string" && !f.startsWith("http") ? `${A}${f.startsWith("/") ? f : "/" + f}` : f, N = await fetch(V, { ...s, headers: x });
270
+ const A = d.api?.basePath || "/api", G = typeof f == "string" && !f.startsWith("http") ? `${A}${f.startsWith("/") ? f : "/" + f}` : f, N = await fetch(G, { ...s, headers: x });
271
271
  if (!N.ok) {
272
272
  const R = await N.json().catch(() => ({}));
273
273
  if (R.error && (R.error.code || R.error.message))
@@ -315,12 +315,12 @@ function Zt({ onFinish: r } = {}) {
315
315
  if (!(!D && (!s || s.length === 0)) && !(h === "loading-history" || h === "streaming" || h === "submitted")) {
316
316
  if (y.stop(), x) {
317
317
  m(`/${b}`);
318
- const A = D || t("attach_file"), V = A.length > 30 ? A.slice(0, 30) + "..." : A;
318
+ const A = D || t("attach_file"), G = A.length > 30 ? A.slice(0, 30) + "..." : A;
319
319
  o.setQueryData([i, "conversations"], (N) => {
320
- const R = { id: `/${b}`, firstMessage: V, timestamp: Date.now() };
320
+ const R = { id: `/${b}`, firstMessage: G, timestamp: Date.now() };
321
321
  return N && Array.isArray(N.pages) ? {
322
322
  ...N,
323
- pages: N.pages.map((W, le) => le === 0 ? {
323
+ pages: N.pages.map((W, ce) => ce === 0 ? {
324
324
  ...W,
325
325
  threads: [R, ...W.threads || []]
326
326
  } : W)
@@ -332,8 +332,8 @@ function Zt({ onFinish: r } = {}) {
332
332
  await y.sendMessage({ text: D, files: s });
333
333
  } catch (A) {
334
334
  console.error("Failed to send message:", A);
335
- const V = oe(A, t);
336
- I(new Error(V)), E("error");
335
+ const G = ie(A, t);
336
+ I(new Error(G)), E("error");
337
337
  }
338
338
  }
339
339
  }, [y, m, c, b, t, o, h, i]), U = J(() => {
@@ -341,7 +341,7 @@ function Zt({ onFinish: r } = {}) {
341
341
  }, [y.stop, o, i]), K = j(() => {
342
342
  if (z) return z;
343
343
  if (y.error) {
344
- const f = oe(y.error, t);
344
+ const f = ie(y.error, t);
345
345
  return new Error(f);
346
346
  }
347
347
  return null;
@@ -360,8 +360,8 @@ function Zt({ onFinish: r } = {}) {
360
360
  }), [y, L, U, H, K, h, q, c]);
361
361
  }
362
362
  function ea({ classNames: r = {}, disclaimer: t }) {
363
- const { t: o, i18n: d } = ie(["chat", "translation"]), i = Zt(), { messages: c, status: m, regenerate: g, error: u, clearError: w, stop: b, isLoadingHistory: v, conversationId: l, sendMessage: S } = i, { MessageList: _, PromptInput: q, disclaimer: O } = te(), P = t ?? O, y = d.exists("chat:disclaimer") ? o("chat:disclaimer") : null, h = typeof P == "string" ? o(P) : P ?? y, [E, z] = C(null), I = ee(m);
364
- Ge(() => {
363
+ const { t: o, i18n: d } = le(["chat", "translation"]), i = Zt(), { messages: c, status: m, regenerate: g, error: u, clearError: w, stop: b, isLoadingHistory: v, conversationId: l, sendMessage: S } = i, { MessageList: _, PromptInput: q, disclaimer: O } = te(), P = t ?? O, y = d.exists("chat:disclaimer") ? o("chat:disclaimer") : null, h = typeof P == "string" ? o(P) : P ?? y, [E, z] = C(null), I = ee(m);
364
+ Ve(() => {
365
365
  u && w();
366
366
  }, [l, w, u]);
367
367
  const H = c[c.length - 1], B = H?.role === "assistant" && (m === "ready" || H.parts.some((L) => L.type === "data-chat-finished"));
@@ -805,17 +805,17 @@ function Le({
805
805
  ] })) : b;
806
806
  }
807
807
  function ka({ trigger: r }) {
808
- const { t, i18n: o } = ie(["settings", "translation"]), { app: d, settings: i } = te(), { theme: c, setTheme: m, accent: g, setAccent: u, radius: w, setRadius: b } = $e(), [v, l] = C(null), [S, _] = C(!1), q = ee(null), O = j(() => [
808
+ const { t, i18n: o } = le(["settings", "translation"]), { app: d, settings: i } = te(), { theme: c, setTheme: m, accent: g, setAccent: u, radius: w, setRadius: b } = $e(), [v, l] = C(null), [S, _] = C(!1), q = ee(null), O = j(() => [
809
809
  { id: "general", label: t("sections.general", "General"), icon: Pe },
810
810
  { id: "profile", label: t("sections.profile", "Profile"), icon: Nt },
811
811
  { id: "account", label: t("sections.account", "Account"), icon: kt }
812
812
  ].filter((k) => {
813
813
  const M = i?.sections?.[k.id];
814
814
  return (M?.mode ?? (M?.enabled === !1 ? "hidden" : "editable")) !== "hidden";
815
- }), [t, i]), [P, y] = C(O[0]?.id || "general"), h = J((a, k) => {
816
- const M = i?.sections?.[a]?.fields;
817
- return M && M[k] || "editable";
818
- }, [i]), [E, z] = C(""), [I, H] = C(""), [B, F] = C(""), [L, U] = C(""), K = j(() => d?.userMetadataFields?.filter((a) => a.showInProfile) || [], [d?.userMetadataFields]), [f, s] = C({}), [x, D] = C(!1), A = o.language === "fa", V = A ? "text-right" : "text-left", N = J(async () => {
815
+ }), [t, i]), [P, y] = C(O[0]?.id || "general"), h = J((a, k, M = "editable") => {
816
+ const se = i?.sections?.[a]?.fields;
817
+ return se && se[k] || M;
818
+ }, [i]), [E, z] = C(""), [I, H] = C(""), [B, F] = C(""), [L, U] = C(""), K = j(() => d?.userMetadataFields?.filter((a) => a.showInProfile) || [], [d?.userMetadataFields]), [f, s] = C({}), [x, D] = C(!1), A = o.language === "fa", G = A ? "text-right" : "text-left", N = J(async () => {
819
819
  try {
820
820
  const a = await T.getMe();
821
821
  l(a), z(a.name || ""), H(a.surname || ""), F(a.phone || "");
@@ -824,7 +824,7 @@ function ka({ trigger: r }) {
824
824
  k[M.key] = a.metadata?.[M.key] ?? M.defaultValue ?? "";
825
825
  }), s(k);
826
826
  } catch (a) {
827
- console.error("Failed to fetch user:", a), X.error(oe(a, t));
827
+ console.error("Failed to fetch user:", a), X.error(ie(a, t));
828
828
  }
829
829
  }, [t, K]);
830
830
  $(() => {
@@ -837,7 +837,7 @@ function ka({ trigger: r }) {
837
837
  const a = { ...f };
838
838
  let k = !1;
839
839
  K.forEach((M) => {
840
- M.condition && !me(M.condition, f) && a[M.key] !== void 0 && (delete a[M.key], k = !0);
840
+ M.condition && !he(M.condition, f) && a[M.key] !== void 0 && (delete a[M.key], k = !0);
841
841
  }), k && s(a);
842
842
  }, [f, K]);
843
843
  const R = async () => {
@@ -846,13 +846,13 @@ function ka({ trigger: r }) {
846
846
  const a = { name: E, surname: I, phone: B, metadata: f };
847
847
  L && (a.password = L), await T.updateMe(a), X.success(t("profile.success", "Profile updated successfully")), U(""), N();
848
848
  } catch (a) {
849
- X.error(oe(a, t));
849
+ X.error(ie(a, t));
850
850
  } finally {
851
851
  D(!1);
852
852
  }
853
853
  }, W = () => {
854
854
  window.confirm(t("account.logout_confirm", "Are you sure you want to logout?")) && (T.clearToken(), window.location.reload());
855
- }, le = (a) => {
855
+ }, ce = (a) => {
856
856
  o.changeLanguage(a);
857
857
  }, ae = v ? Math.max(0, Math.min(100, v.balance.tokens / (v.balance.token_limit || 1) * 100)) : 0, ne = v ? Math.max(0, Math.min(100, v.balance.requests / (v.balance.request_limit || 1) * 100)) : 0;
858
858
  return /* @__PURE__ */ n(Be, { open: S, onOpenChange: _, children: [
@@ -902,26 +902,26 @@ function ka({ trigger: r }) {
902
902
  h("profile", "name") !== "hidden" && /* @__PURE__ */ n("div", { className: p("flex flex-col gap-3", h("profile", "name") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
903
903
  /* @__PURE__ */ e(Q, { htmlFor: "name", className: "px-1", children: t("profile.name", "First Name") }),
904
904
  /* @__PURE__ */ e(
905
- G,
905
+ V,
906
906
  {
907
907
  id: "name",
908
908
  value: E,
909
909
  onChange: (a) => z(a.target.value),
910
910
  disabled: h("profile", "name") === "faded",
911
- className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", V)
911
+ className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", G)
912
912
  }
913
913
  )
914
914
  ] }),
915
915
  h("profile", "surname") !== "hidden" && /* @__PURE__ */ n("div", { className: p("flex flex-col gap-3", h("profile", "surname") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
916
916
  /* @__PURE__ */ e(Q, { htmlFor: "surname", className: "px-1", children: t("profile.surname", "Last Name") }),
917
917
  /* @__PURE__ */ e(
918
- G,
918
+ V,
919
919
  {
920
920
  id: "surname",
921
921
  value: I,
922
922
  onChange: (a) => H(a.target.value),
923
923
  disabled: h("profile", "surname") === "faded",
924
- className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", V)
924
+ className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", G)
925
925
  }
926
926
  )
927
927
  ] })
@@ -931,13 +931,13 @@ function ka({ trigger: r }) {
931
931
  /* @__PURE__ */ n("div", { className: "relative", children: [
932
932
  /* @__PURE__ */ e(Ct, { className: "absolute top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground start-3" }),
933
933
  /* @__PURE__ */ e(
934
- G,
934
+ V,
935
935
  {
936
936
  id: "phone",
937
937
  value: B,
938
938
  onChange: (a) => F(a.target.value),
939
939
  disabled: h("profile", "phone") === "faded",
940
- className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary ps-10 pe-3", V),
940
+ className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary ps-10 pe-3", G),
941
941
  dir: "ltr"
942
942
  }
943
943
  )
@@ -948,7 +948,7 @@ function ka({ trigger: r }) {
948
948
  /* @__PURE__ */ n("div", { className: "relative", children: [
949
949
  /* @__PURE__ */ e(_t, { className: "absolute top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground start-3" }),
950
950
  /* @__PURE__ */ e(
951
- G,
951
+ V,
952
952
  {
953
953
  id: "pass",
954
954
  type: "password",
@@ -956,15 +956,15 @@ function ka({ trigger: r }) {
956
956
  onChange: (a) => U(a.target.value),
957
957
  disabled: h("profile", "password") === "faded",
958
958
  placeholder: t("profile.password_placeholder", "Leave empty to keep current"),
959
- className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary ps-10 pe-3", V),
959
+ className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary ps-10 pe-3", G),
960
960
  dir: "ltr"
961
961
  }
962
962
  )
963
963
  ] })
964
964
  ] }),
965
965
  K.map((a) => {
966
- const k = a.mode || h("profile", a.key);
967
- return k === "hidden" || !me(a.condition, f) ? null : /* @__PURE__ */ n("div", { className: p("flex flex-col gap-3 animate-in fade-in slide-in-from-top-1 duration-200", k === "faded" && "opacity-50 pointer-events-none select-none"), children: [
966
+ const k = h("profile", a.key, a.mode || "editable");
967
+ return k === "hidden" || !he(a.condition, f) ? null : /* @__PURE__ */ n("div", { className: p("flex flex-col gap-3 animate-in fade-in slide-in-from-top-1 duration-200", k === "faded" && "opacity-50 pointer-events-none select-none"), children: [
968
968
  /* @__PURE__ */ e(Q, { htmlFor: `profile-${a.key}`, className: "px-1", children: t(a.label) }),
969
969
  a.type === "select" ? /* @__PURE__ */ n(
970
970
  be,
@@ -975,7 +975,7 @@ function ka({ trigger: r }) {
975
975
  dir: A ? "rtl" : "ltr",
976
976
  children: [
977
977
  /* @__PURE__ */ e(ve, { className: "bg-muted/30 border-border/50 rounded-xl focus:ring-primary h-11", children: /* @__PURE__ */ e(xe, { placeholder: t(a.placeholder || "profile.select_placeholder") }) }),
978
- /* @__PURE__ */ e(ye, { className: "rounded-xl border-border/40 shadow-xl bg-background/95 backdrop-blur-md", children: a.options?.map((M) => /* @__PURE__ */ e(ue, { value: String(M.value), className: "rounded-lg focus:bg-primary/10", children: t(M.label) }, String(M.value))) })
978
+ /* @__PURE__ */ e(ye, { className: "rounded-xl border-border/40 shadow-xl bg-background/95 backdrop-blur-md", children: a.options?.map((M) => /* @__PURE__ */ e(me, { value: String(M.value), className: "rounded-lg focus:bg-primary/10", children: t(M.label) }, String(M.value))) })
979
979
  ]
980
980
  }
981
981
  ) : a.type === "checkbox" ? /* @__PURE__ */ n("div", { className: "flex items-center gap-3 px-1 py-1", children: [
@@ -992,7 +992,7 @@ function ka({ trigger: r }) {
992
992
  ),
993
993
  /* @__PURE__ */ e(Q, { htmlFor: `profile-${a.key}`, className: "text-sm font-medium text-muted-foreground cursor-pointer", children: t(a.placeholder || a.label) })
994
994
  ] }) : /* @__PURE__ */ e(
995
- G,
995
+ V,
996
996
  {
997
997
  id: `profile-${a.key}`,
998
998
  type: a.type,
@@ -1000,7 +1000,7 @@ function ka({ trigger: r }) {
1000
1000
  disabled: k === "faded",
1001
1001
  onChange: (M) => s({ ...f, [a.key]: M.target.value }),
1002
1002
  placeholder: t(a.placeholder || ""),
1003
- className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", V)
1003
+ className: p("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", G)
1004
1004
  }
1005
1005
  )
1006
1006
  ] }, a.key);
@@ -1151,17 +1151,17 @@ function ka({ trigger: r }) {
1151
1151
  be,
1152
1152
  {
1153
1153
  value: o.language,
1154
- onValueChange: le,
1154
+ onValueChange: ce,
1155
1155
  disabled: h("general", "language") === "faded",
1156
1156
  dir: A ? "rtl" : "ltr",
1157
1157
  children: [
1158
1158
  /* @__PURE__ */ e(ve, { className: "w-full bg-muted/50 rounded-2xl border-border/40 h-11 focus:ring-primary/20", children: /* @__PURE__ */ e(xe, { placeholder: t("general.language_placeholder", "Select language") }) }),
1159
1159
  /* @__PURE__ */ n(ye, { className: "rounded-2xl border-border/40 shadow-xl bg-background/95 backdrop-blur-md", children: [
1160
- /* @__PURE__ */ e(ue, { value: "en", className: "rounded-xl focus:bg-primary/10", children: /* @__PURE__ */ n("span", { className: "flex items-center gap-2", children: [
1160
+ /* @__PURE__ */ e(me, { value: "en", className: "rounded-xl focus:bg-primary/10", children: /* @__PURE__ */ n("span", { className: "flex items-center gap-2", children: [
1161
1161
  /* @__PURE__ */ e("span", { className: "text-xs font-bold text-muted-foreground mr-1", children: "EN" }),
1162
1162
  t("general.languages.en", "English")
1163
1163
  ] }) }),
1164
- /* @__PURE__ */ e(ue, { value: "fa", className: "rounded-xl focus:bg-primary/10", children: /* @__PURE__ */ n("span", { className: "flex items-center gap-2", children: [
1164
+ /* @__PURE__ */ e(me, { value: "fa", className: "rounded-xl focus:bg-primary/10", children: /* @__PURE__ */ n("span", { className: "flex items-center gap-2", children: [
1165
1165
  /* @__PURE__ */ e("span", { className: "text-xs font-bold text-muted-foreground mr-1", children: "FA" }),
1166
1166
  t("general.languages.fa", "Persian")
1167
1167
  ] }) })
@@ -1256,7 +1256,7 @@ function ka({ trigger: r }) {
1256
1256
  ] });
1257
1257
  }
1258
1258
  function Qe({ hideActions: r = !1 }) {
1259
- const [, t] = Ce(), { t: o } = ie(["sidebar", "chat"]), { history: d, app: i } = te(), { theme: c } = $e(), m = !r && (d?.enabled ?? !0), [g, u] = C("light");
1259
+ const [, t] = Ce(), { t: o } = le(["sidebar", "chat"]), { history: d, app: i } = te(), { theme: c } = $e(), m = !r && (d?.enabled ?? !0), [g, u] = C("light");
1260
1260
  $(() => {
1261
1261
  if (c === "system") {
1262
1262
  const v = window.matchMedia("(prefers-color-scheme: dark)").matches;
@@ -1342,13 +1342,13 @@ async function _a(r, t, o, d) {
1342
1342
  }
1343
1343
  }
1344
1344
  function Sa({ side: r = "left" }) {
1345
- const { t, i18n: o } = ie(["sidebar", "translation"]), {
1345
+ const { t, i18n: o } = le(["sidebar", "translation"]), {
1346
1346
  data: d,
1347
1347
  fetchNextPage: i,
1348
1348
  hasNextPage: c,
1349
1349
  isFetchingNextPage: m,
1350
1350
  isLoading: g
1351
- } = Ca(), { history: u, app: w } = te(), b = w?.basePath || "/", v = u?.enabled ?? !1, l = d?.pages.flatMap((a) => a.threads) ?? [], [S, _] = Ce(), q = he(), O = ee(null), P = J(
1351
+ } = Ca(), { history: u, app: w } = te(), b = w?.basePath || "/", v = u?.enabled ?? !1, l = d?.pages.flatMap((a) => a.threads) ?? [], [S, _] = Ce(), q = pe(), O = ee(null), P = J(
1352
1352
  (a) => {
1353
1353
  O.current && (O.current.disconnect(), O.current = null), a && c && !m && (O.current = new IntersectionObserver(
1354
1354
  (k) => {
@@ -1371,7 +1371,7 @@ function Sa({ side: r = "left" }) {
1371
1371
  } catch {
1372
1372
  X.error(t("pin_failed"));
1373
1373
  }
1374
- }, V = async (a) => {
1374
+ }, G = async (a) => {
1375
1375
  try {
1376
1376
  const k = await T.shareThread(a.id.replace(/^\//, "")), M = `${window.location.origin}${k.url}`;
1377
1377
  navigator.clipboard.writeText(M), X.success(t("share_success"), {
@@ -1391,7 +1391,7 @@ function Sa({ side: r = "left" }) {
1391
1391
  } catch {
1392
1392
  X.error(t("rename_failed"));
1393
1393
  }
1394
- }, le = (a) => {
1394
+ }, ce = (a) => {
1395
1395
  H(a), z(!0);
1396
1396
  }, ae = () => {
1397
1397
  I && (_a(I.id, q, _, S), z(!1), H(null), X.success(t("chat_deleted_success")));
@@ -1429,7 +1429,7 @@ function Sa({ side: r = "left" }) {
1429
1429
  v && /* @__PURE__ */ e(Ie, { className: "group-data-[collapsible=icon]:hidden mb-6 px-2", children: /* @__PURE__ */ n("div", { className: "relative group/search", children: [
1430
1430
  /* @__PURE__ */ e(zt, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 opacity-40 group-focus-within/search:opacity-70 transition-opacity" }),
1431
1431
  /* @__PURE__ */ e(
1432
- G,
1432
+ V,
1433
1433
  {
1434
1434
  placeholder: t("search_conversations"),
1435
1435
  value: B,
@@ -1441,16 +1441,16 @@ function Sa({ side: r = "left" }) {
1441
1441
  v && /* @__PURE__ */ n(Ie, { className: "group-data-[collapsible=icon]:hidden", children: [
1442
1442
  /* @__PURE__ */ n(De, { children: [
1443
1443
  D.map((a, k) => {
1444
- const M = L === a.id, pe = Se(a.firstMessage ?? ""), Ve = pe === "rtl";
1444
+ const M = L === a.id, se = Se(a.firstMessage ?? ""), Ge = se === "rtl";
1445
1445
  return /* @__PURE__ */ e(Ee, { className: "group/sidebar-menu-item relative", children: M ? /* @__PURE__ */ n("div", { className: "flex items-center gap-1 px-2 py-1.5 w-full", children: [
1446
1446
  /* @__PURE__ */ e(
1447
- G,
1447
+ V,
1448
1448
  {
1449
1449
  ref: s,
1450
1450
  value: K,
1451
- onChange: (se) => f(se.target.value),
1452
- onKeyDown: (se) => {
1453
- se.key === "Enter" && W(), se.key === "Escape" && R();
1451
+ onChange: (oe) => f(oe.target.value),
1452
+ onKeyDown: (oe) => {
1453
+ oe.key === "Enter" && W(), oe.key === "Escape" && R();
1454
1454
  },
1455
1455
  className: "h-8 py-0 px-2 text-sm",
1456
1456
  dir: Se(K)
@@ -1471,9 +1471,9 @@ function Sa({ side: r = "left" }) {
1471
1471
  "a",
1472
1472
  {
1473
1473
  href: fe(b, a.id),
1474
- onClick: (se) => x(se, a.id),
1475
- dir: pe,
1476
- className: p("flex flex-col gap-0.5 w-full overflow-hidden", Ve ? "items-end" : "items-start"),
1474
+ onClick: (oe) => x(oe, a.id),
1475
+ dir: se,
1476
+ className: p("flex flex-col gap-0.5 w-full overflow-hidden", Ge ? "items-end" : "items-start"),
1477
1477
  children: [
1478
1478
  /* @__PURE__ */ e("span", { className: p("truncate w-full font-medium text-[0.9375rem]", o.language === "fa" ? "pl-16 text-right" : "pr-16 text-left"), children: a.firstMessage }),
1479
1479
  /* @__PURE__ */ e("div", { className: p("text-[10px] opacity-40 w-full", o.language === "fa" ? "pl-16 text-right" : "pr-16 text-left"), children: ne(a.timestamp) })
@@ -1503,23 +1503,23 @@ function Sa({ side: r = "left" }) {
1503
1503
  align: "end",
1504
1504
  className: "min-w-[120px] p-1",
1505
1505
  children: [
1506
- u?.showPin !== !1 && /* @__PURE__ */ n(ce, { onSelect: () => A(a), className: "cursor-pointer flex items-center gap-2", children: [
1506
+ u?.showPin !== !1 && /* @__PURE__ */ n(de, { onSelect: () => A(a), className: "cursor-pointer flex items-center gap-2", children: [
1507
1507
  a.pinned ? /* @__PURE__ */ e(Ot, { className: "size-4" }) : /* @__PURE__ */ e(Te, { className: "size-4" }),
1508
1508
  /* @__PURE__ */ e("span", { children: a.pinned ? t("unpin_conversation") : t("pin_conversation") })
1509
1509
  ] }),
1510
- u?.showShare !== !1 && /* @__PURE__ */ n(ce, { onSelect: () => V(a), className: "cursor-pointer flex items-center gap-2", children: [
1510
+ u?.showShare !== !1 && /* @__PURE__ */ n(de, { onSelect: () => G(a), className: "cursor-pointer flex items-center gap-2", children: [
1511
1511
  /* @__PURE__ */ e(jt, { className: "size-4" }),
1512
1512
  /* @__PURE__ */ e("span", { children: t("share_conversation") })
1513
1513
  ] }),
1514
- (u?.showRename ?? !1) && /* @__PURE__ */ n(ce, { onSelect: () => N(a), className: "cursor-pointer flex items-center gap-2", children: [
1514
+ (u?.showRename ?? !1) && /* @__PURE__ */ n(de, { onSelect: () => N(a), className: "cursor-pointer flex items-center gap-2", children: [
1515
1515
  /* @__PURE__ */ e($t, { className: "size-4" }),
1516
1516
  /* @__PURE__ */ e("span", { children: t("rename_conversation") })
1517
1517
  ] }),
1518
1518
  (u?.showDelete ?? !1) && /* @__PURE__ */ n(
1519
- ce,
1519
+ de,
1520
1520
  {
1521
1521
  className: "text-destructive focus:text-destructive focus:bg-destructive/10 cursor-pointer flex items-center gap-2",
1522
- onSelect: () => le(a),
1522
+ onSelect: () => ce(a),
1523
1523
  children: [
1524
1524
  /* @__PURE__ */ e(Bt, { className: "size-4" }),
1525
1525
  /* @__PURE__ */ e("span", { children: t("delete_conversation") })
@@ -1600,7 +1600,7 @@ function Ka({ sidebar: r, header: t, components: o, classNames: d, disclaimer: i
1600
1600
  ] });
1601
1601
  }
1602
1602
  function Ha({ children: r }) {
1603
- const [t, o] = C(null), d = Ke(), i = ke(), c = he();
1603
+ const [t, o] = C(null), d = Ke(), i = ke(), c = pe();
1604
1604
  return $(() => {
1605
1605
  (async () => {
1606
1606
  const g = new URLSearchParams(d.search), u = g.get("token");
@@ -1624,10 +1624,10 @@ function Ha({ children: r }) {
1624
1624
  console.error("Token validation failed:", b), b.status === 401 ? (T.clearToken(), c.clear(), o(!1)) : o(!0);
1625
1625
  }
1626
1626
  })();
1627
- }, [d.search, i, d.pathname, c]), t === null ? /* @__PURE__ */ e("div", { className: "flex h-screen w-full items-center justify-center", children: /* @__PURE__ */ e("div", { className: "size-8 rounded-full border-4 border-primary border-t-transparent animate-spin" }) }) : t ? /* @__PURE__ */ e(Ne, { children: r }) : /* @__PURE__ */ e(Vt, { to: "/login", replace: !0 });
1627
+ }, [d.search, i, d.pathname, c]), t === null ? /* @__PURE__ */ e("div", { className: "flex h-screen w-full items-center justify-center", children: /* @__PURE__ */ e("div", { className: "size-8 rounded-full border-4 border-primary border-t-transparent animate-spin" }) }) : t ? /* @__PURE__ */ e(Ne, { children: r }) : /* @__PURE__ */ e(Gt, { to: "/login", replace: !0 });
1628
1628
  }
1629
1629
  function Qa() {
1630
- const { t: r, i18n: t } = ie(["login", "translation"]), { app: o } = te(), d = t.dir() === "rtl", i = d ? "text-right" : "text-left", c = ke(), m = he(), [g, u] = C("login"), [w, b] = C(""), [v, l] = C(""), [S, _] = C(""), [q, O] = C(""), [P, y] = C(""), [h, E] = C(""), z = j(() => o?.userMetadataFields?.filter((s) => s.showInSignup) || [], [o?.userMetadataFields]), [I, H] = C(() => {
1630
+ const { t: r, i18n: t } = le(["login", "translation"]), { app: o } = te(), d = t.dir() === "rtl", i = d ? "text-right" : "text-left", c = ke(), m = pe(), [g, u] = C("login"), [w, b] = C(""), [v, l] = C(""), [S, _] = C(""), [q, O] = C(""), [P, y] = C(""), [h, E] = C(""), z = j(() => o?.userMetadataFields?.filter((s) => s.showInSignup) || [], [o?.userMetadataFields]), [I, H] = C(() => {
1631
1631
  const s = {};
1632
1632
  return z.forEach((x) => {
1633
1633
  x.defaultValue !== void 0 && (s[x.key] = x.defaultValue);
@@ -1637,7 +1637,7 @@ function Qa() {
1637
1637
  const s = { ...I };
1638
1638
  let x = !1;
1639
1639
  z.forEach((D) => {
1640
- D.condition && !me(D.condition, I) && s[D.key] !== void 0 && (delete s[D.key], x = !0);
1640
+ D.condition && !he(D.condition, I) && s[D.key] !== void 0 && (delete s[D.key], x = !0);
1641
1641
  }), x && H(s);
1642
1642
  }, [I, z]);
1643
1643
  const [B, F] = C(""), [L, U] = C(!1), K = async (s) => {
@@ -1645,7 +1645,7 @@ function Qa() {
1645
1645
  try {
1646
1646
  await T.login(w, v), m.clear(), c("/");
1647
1647
  } catch (x) {
1648
- F(oe(x, r));
1648
+ F(ie(x, r));
1649
1649
  } finally {
1650
1650
  U(!1);
1651
1651
  }
@@ -1654,7 +1654,7 @@ function Qa() {
1654
1654
  try {
1655
1655
  await T.register(S, q, P, h, I), m.clear(), c("/");
1656
1656
  } catch (x) {
1657
- F(oe(x, r));
1657
+ F(ie(x, r));
1658
1658
  } finally {
1659
1659
  U(!1);
1660
1660
  }
@@ -1689,7 +1689,7 @@ function Qa() {
1689
1689
  /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1690
1690
  /* @__PURE__ */ e(Q, { htmlFor: "login-phone", children: r("phone", "Phone") }),
1691
1691
  /* @__PURE__ */ e(
1692
- G,
1692
+ V,
1693
1693
  {
1694
1694
  id: "login-phone",
1695
1695
  type: "tel",
@@ -1705,7 +1705,7 @@ function Qa() {
1705
1705
  /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1706
1706
  /* @__PURE__ */ e(Q, { htmlFor: "login-pass", children: r("password", "Password") }),
1707
1707
  /* @__PURE__ */ e(
1708
- G,
1708
+ V,
1709
1709
  {
1710
1710
  id: "login-pass",
1711
1711
  type: "password",
@@ -1733,7 +1733,7 @@ function Qa() {
1733
1733
  /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1734
1734
  /* @__PURE__ */ e(Q, { htmlFor: "reg-phone", children: r("phone", "Phone") }),
1735
1735
  /* @__PURE__ */ e(
1736
- G,
1736
+ V,
1737
1737
  {
1738
1738
  id: "reg-phone",
1739
1739
  type: "tel",
@@ -1749,7 +1749,7 @@ function Qa() {
1749
1749
  /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1750
1750
  /* @__PURE__ */ e(Q, { htmlFor: "reg-pass", children: r("password", "Password") }),
1751
1751
  /* @__PURE__ */ e(
1752
- G,
1752
+ V,
1753
1753
  {
1754
1754
  id: "reg-pass",
1755
1755
  type: "password",
@@ -1766,7 +1766,7 @@ function Qa() {
1766
1766
  /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1767
1767
  /* @__PURE__ */ e(Q, { htmlFor: "reg-name", children: r("name", "Name") }),
1768
1768
  /* @__PURE__ */ e(
1769
- G,
1769
+ V,
1770
1770
  {
1771
1771
  id: "reg-name",
1772
1772
  type: "text",
@@ -1781,7 +1781,7 @@ function Qa() {
1781
1781
  /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1782
1782
  /* @__PURE__ */ e(Q, { htmlFor: "reg-surname", children: r("surname", "Surname") }),
1783
1783
  /* @__PURE__ */ e(
1784
- G,
1784
+ V,
1785
1785
  {
1786
1786
  id: "reg-surname",
1787
1787
  type: "text",
@@ -1794,7 +1794,7 @@ function Qa() {
1794
1794
  )
1795
1795
  ] })
1796
1796
  ] }),
1797
- z.map((s) => me(s.condition, I) ? /* @__PURE__ */ n("div", { className: "space-y-3 animate-in fade-in slide-in-from-top-1 duration-200", children: [
1797
+ z.map((s) => he(s.condition, I) ? /* @__PURE__ */ n("div", { className: "space-y-3 animate-in fade-in slide-in-from-top-1 duration-200", children: [
1798
1798
  /* @__PURE__ */ e(Q, { htmlFor: `signup-${s.key}`, children: r(s.label) }),
1799
1799
  s.type === "select" ? /* @__PURE__ */ n(
1800
1800
  be,
@@ -1805,7 +1805,7 @@ function Qa() {
1805
1805
  dir: d ? "rtl" : "ltr",
1806
1806
  children: [
1807
1807
  /* @__PURE__ */ e(ve, { className: p("bg-background", i), children: /* @__PURE__ */ e(xe, { placeholder: r(s.placeholder || "select_placeholder") }) }),
1808
- /* @__PURE__ */ e(ye, { className: "rounded-xl", children: s.options?.map((x) => /* @__PURE__ */ e(ue, { value: String(x.value), children: r(x.label) }, String(x.value))) })
1808
+ /* @__PURE__ */ e(ye, { className: "rounded-xl", children: s.options?.map((x) => /* @__PURE__ */ e(me, { value: String(x.value), children: r(x.label) }, String(x.value))) })
1809
1809
  ]
1810
1810
  }
1811
1811
  ) : s.type === "checkbox" ? /* @__PURE__ */ n("div", { className: "flex items-center gap-2 py-2", children: [
@@ -1820,7 +1820,7 @@ function Qa() {
1820
1820
  ),
1821
1821
  /* @__PURE__ */ e("label", { htmlFor: `signup-${s.key}`, className: "text-sm text-muted-foreground cursor-pointer select-none", children: r(s.placeholder || s.label) })
1822
1822
  ] }) : /* @__PURE__ */ e(
1823
- G,
1823
+ V,
1824
1824
  {
1825
1825
  id: `signup-${s.key}`,
1826
1826
  type: s.type,
@@ -1846,7 +1846,7 @@ function Qa() {
1846
1846
  ] }) });
1847
1847
  }
1848
1848
  function Pa() {
1849
- const { shareId: r } = Gt(), [t, o] = C(null), [d, i] = C(!0), [c, m] = C(null), { MessageList: g } = te(), u = ee(/* @__PURE__ */ new Set());
1849
+ const { shareId: r } = Vt(), [t, o] = C(null), [d, i] = C(!0), [c, m] = C(null), { MessageList: g } = te(), u = ee(/* @__PURE__ */ new Set());
1850
1850
  return $(() => () => {
1851
1851
  u.current.forEach((w) => URL.revokeObjectURL(w)), u.current.clear();
1852
1852
  }, []), $(() => {
@@ -1902,7 +1902,7 @@ function Pa() {
1902
1902
  ) })
1903
1903
  ] });
1904
1904
  }
1905
- function Va() {
1905
+ function Ga() {
1906
1906
  return /* @__PURE__ */ e(Pa, {});
1907
1907
  }
1908
1908
  export {
@@ -1919,7 +1919,7 @@ export {
1919
1919
  be as Select,
1920
1920
  ye as SelectContent,
1921
1921
  or as SelectGroup,
1922
- ue as SelectItem,
1922
+ me as SelectItem,
1923
1923
  ir as SelectLabel,
1924
1924
  lr as SelectScrollDownButton,
1925
1925
  cr as SelectScrollUpButton,
@@ -1927,7 +1927,7 @@ export {
1927
1927
  ve as SelectTrigger,
1928
1928
  xe as SelectValue,
1929
1929
  ka as SettingsDialog,
1930
- Va as SharedChatView,
1930
+ Ga as SharedChatView,
1931
1931
  fa as SidebarProvider,
1932
1932
  ur as TextPart,
1933
1933
  mr as ToolPart,
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "provenance": true
11
11
  },
12
12
  "description": "React UI library for the Gentiq AI framework.",
13
- "version": "0.7.21",
13
+ "version": "0.7.22",
14
14
  "type": "module",
15
15
  "files": [
16
16
  "dist"