gentiq 0.9.0 → 0.10.1

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,11 +1,11 @@
1
1
  import { jsx as e, jsxs as s, Fragment as _e } from "react/jsx-runtime";
2
2
  import * as se from "react";
3
- import { useState as _, useMemo as Q, useEffect as B, useRef as re, useCallback as ee, useLayoutEffect as et } from "react";
3
+ import { useState as T, useMemo as W, useEffect as K, useRef as re, useCallback as ee, useLayoutEffect as et } from "react";
4
4
  import { QueryClient as tt, QueryClientProvider as at, useQueryClient as he, useQuery as rt, useInfiniteQuery as nt } from "@tanstack/react-query";
5
5
  import { I18nextProvider as st, useTranslation as ue } from "react-i18next";
6
6
  import { Trans as or, Translation as ir, useTranslation as lr, withTranslation as cr } from "react-i18next";
7
- import { G as be, g as ot, d as it, a as lt, C as je, T as ct, u as ne, b as Oe, c as oe, j as xe, e as ge, f as de, h as He, i as v, k as dt, l as Ue, m as Be, n as Ke, o as Qe, B as ae, p as Ve, q as ye, D as Ge, r as ut, s as We, L as X, I as Y, S as we, t as Ne, v as ke, w as Se, x as fe, y as ht, z as pt, A as Me, E as mt, F as gt, H as ft, J as pe, K as bt, M as yt, N as vt, O as xt, P as wt, Q as Nt } from "./checkbox-DyzncQpE.js";
8
- import { R as ur, U as hr, V as pr, W as mr, X as gr, Y as fr, Z as br, _ as yr, $ as vr, a0 as xr, a1 as wr, a2 as Nr, a3 as kr, a4 as Sr, a5 as Cr, a6 as _r, a7 as Tr, a8 as Pr } from "./checkbox-DyzncQpE.js";
7
+ import { G as be, g as ot, d as it, a as lt, C as je, T as ct, u as ne, b as Oe, c as oe, j as xe, e as ge, f as de, h as He, i as v, k as dt, l as Ue, m as Be, n as Ke, o as Qe, B as ae, p as Ve, q as ye, D as Ge, r as ut, s as We, L as X, I as Y, S as we, t as Ne, v as ke, w as Se, x as fe, y as ht, z as pt, A as Me, E as mt, F as gt, H as ft, J as pe, K as bt, M as yt, N as vt, O as xt, P as wt, Q as Nt } from "./checkbox-DIJkKoC9.js";
8
+ import { R as ur, U as hr, V as pr, W as mr, X as gr, Y as fr, Z as br, _ as yr, $ as vr, a0 as xr, a1 as wr, a2 as Nr, a3 as kr, a4 as Sr, a5 as Cr, a6 as _r, a7 as Tr, a8 as Pr, a9 as Er } from "./checkbox-DIJkKoC9.js";
9
9
  import { Loader2Icon as kt, OctagonXIcon as St, TriangleAlertIcon as Ct, InfoIcon as _t, CircleCheckIcon as Tt, XIcon as Pt, PanelLeftIcon as Et, Layers as Ae, User as Mt, ShieldCheck as At, Settings as Ce, Smartphone as It, Lock as Rt, Save as Dt, Sun as $t, Moon as Lt, Monitor as Ft, Zap as Ie, Globe as qt, Coins as zt, LogOut as jt, CirclePlus as Ot, Plus as Ht, Search as Ut, Check as Bt, X as Kt, Pin as Re, MoreVertical as Qt, PinOff as Vt, Share2 as Gt, Pencil as Wt, Trash as Jt } from "lucide-react";
10
10
  import { useTheme as Xt } from "next-themes";
11
11
  import { Toaster as Yt, toast as te } from "sonner";
@@ -35,7 +35,8 @@ const sa = ({ ...a }) => {
35
35
  "--normal-bg": "var(--popover)",
36
36
  "--normal-text": "var(--popover-foreground)",
37
37
  "--normal-border": "var(--border)",
38
- "--border-radius": "var(--radius)"
38
+ "--border-radius": "var(--radius)",
39
+ fontFamily: "var(--gentiq-font-family)"
39
40
  },
40
41
  ...a
41
42
  }
@@ -320,13 +321,13 @@ function Za({
320
321
  disclaimer: k,
321
322
  settings: g
322
323
  }) {
323
- const [p, A] = _(null), P = Q(() => o?.instance ?? ot, [o?.instance]), I = t || {}, [E] = _(() => la({ api: I }));
324
- B(() => {
325
- E.getAppConfig().then((w) => A(w)).catch((w) => console.debug("Gentiq: No dynamic settings available or fetch failed", w));
326
- }, [E]), B(() => {
324
+ const [p, A] = T(null), P = W(() => o?.instance ?? ot, [o?.instance]), I = t || {}, [R] = T(() => la({ api: I }));
325
+ K(() => {
326
+ R.getAppConfig().then((w) => A(w)).catch((w) => console.debug("Gentiq: No dynamic settings available or fetch failed", w));
327
+ }, [R]), K(() => {
327
328
  p?.app_name && (document.title = P.t(p.app_name));
328
329
  }, [p, P]);
329
- const R = Q(() => {
330
+ const E = W(() => {
330
331
  const w = {
331
332
  basePath: "/",
332
333
  cacheNamespace: "gentiq",
@@ -346,7 +347,7 @@ function Za({
346
347
  settingsProfileMode: p.settings_profile_mode || w.settingsProfileMode,
347
348
  settingsAccountMode: p.settings_account_mode || w.settingsAccountMode
348
349
  } : w;
349
- }, [d, p, P]), D = Q(() => {
350
+ }, [d, p, P]), L = W(() => {
350
351
  if (!p) return r;
351
352
  const w = typeof r?.greeting == "function" ? r.greeting : p.welcome_greeting || r?.greeting;
352
353
  return {
@@ -354,34 +355,34 @@ function Za({
354
355
  greeting: w,
355
356
  subtitle: p.welcome_subtitle || r?.subtitle
356
357
  };
357
- }, [r, p]), T = Q(() => {
358
+ }, [r, p]), _ = W(() => {
358
359
  const w = p?.disclaimer || k;
359
360
  return typeof w == "string" ? P.t(w) : w;
360
- }, [k, p, P]), q = Q(() => p ? {
361
+ }, [k, p, P]), Q = W(() => p ? {
361
362
  ...i,
362
363
  enabled: p.history_enabled ?? i?.enabled,
363
364
  showDelete: p.history_show_delete ?? i?.showDelete,
364
365
  showRename: p.history_show_rename ?? i?.showRename,
365
366
  showShare: p.history_show_share ?? i?.showShare,
366
367
  showPin: p.history_show_pin ?? i?.showPin
367
- } : i, [i, p]), x = Q(() => p ? {
368
+ } : i, [i, p]), x = W(() => p ? {
368
369
  ...u,
369
370
  feedback: p.thread_actions_feedback ?? u?.feedback,
370
371
  retry: p.thread_actions_retry ?? u?.retry
371
- } : u, [u, p]), V = Q(() => p ? {
372
+ } : u, [u, p]), V = W(() => p ? {
372
373
  ...c,
373
374
  attachments: {
374
375
  ...c?.attachments,
375
376
  enabled: p.composer_attachments ?? c?.attachments?.enabled
376
377
  }
377
- } : c, [c, p]), K = Q(
378
+ } : c, [c, p]), G = W(
378
379
  () => ({
379
380
  ...y,
380
381
  defaultTheme: p?.default_theme ?? y?.defaultTheme,
381
382
  accent: p?.default_accent ?? y?.accent
382
383
  }),
383
384
  [y, p]
384
- ), M = Q(() => p ? {
385
+ ), M = W(() => p ? {
385
386
  ...g,
386
387
  sections: {
387
388
  ...g?.sections,
@@ -413,7 +414,7 @@ function Za({
413
414
  }
414
415
  }
415
416
  }
416
- } : g, [g, p]), $ = Q(
417
+ } : g, [g, p]), D = W(
417
418
  () => new tt({
418
419
  defaultOptions: {
419
420
  queries: {
@@ -424,46 +425,46 @@ function Za({
424
425
  }),
425
426
  []
426
427
  );
427
- B(() => {
428
- E.configure({
428
+ K(() => {
429
+ R.configure({
429
430
  api: I,
430
- app: R
431
+ app: E
431
432
  });
432
- }, [E, R]);
433
- const G = re(null), F = o?.resources;
434
- F !== G.current && (G.current = F, F && Object.entries(F).forEach(([w, m]) => {
433
+ }, [R, E]);
434
+ const J = re(null), j = o?.resources;
435
+ j !== J.current && (J.current = j, j && Object.entries(j).forEach(([w, m]) => {
435
436
  Object.entries(m).forEach(([C, f]) => {
436
437
  P.addResourceBundle(w, C, f, !0, !0);
437
438
  });
438
439
  }));
439
- const J = re(null), W = p?.translations;
440
- W && W !== J.current && (J.current = W, Object.entries(W).forEach(([w, m]) => {
440
+ const q = re(null), F = p?.translations;
441
+ F && F !== q.current && (q.current = F, Object.entries(F).forEach(([w, m]) => {
441
442
  Object.entries(m).forEach(([C, f]) => {
442
443
  P.addResourceBundle(w, C, f, !0, !0);
443
444
  });
444
445
  }));
445
- const j = re(null), L = o?.instance;
446
- return L && L !== j.current && (j.current = L, Object.entries(it).forEach(([w, m]) => {
446
+ const O = re(null), $ = o?.instance;
447
+ return $ && $ !== O.current && (O.current = $, Object.entries(it).forEach(([w, m]) => {
447
448
  Object.entries(m).forEach(([C, f]) => {
448
- L.hasResourceBundle(w, C) || L.addResourceBundle(w, C, f, !0, !1);
449
+ $.hasResourceBundle(w, C) || $.addResourceBundle(w, C, f, !0, !1);
449
450
  });
450
- })), /* @__PURE__ */ e(st, { i18n: P, children: /* @__PURE__ */ s(at, { client: $, children: [
451
- /* @__PURE__ */ e(lt, { api: E, children: /* @__PURE__ */ s(
451
+ })), /* @__PURE__ */ e(st, { i18n: P, children: /* @__PURE__ */ s(at, { client: D, children: [
452
+ /* @__PURE__ */ e(lt, { api: R, children: /* @__PURE__ */ s(
452
453
  je,
453
454
  {
454
455
  components: n,
455
- history: q,
456
- welcome: D,
456
+ history: Q,
457
+ welcome: L,
457
458
  threadActions: x,
458
459
  composer: V,
459
- theme: K,
460
- disclaimer: T,
461
- app: R,
460
+ theme: G,
461
+ disclaimer: _,
462
+ app: E,
462
463
  i18n: o,
463
464
  settings: M,
464
465
  children: [
465
466
  /* @__PURE__ */ e(ca, {}),
466
- /* @__PURE__ */ e(ct, { defaultTheme: "system", storageKey: "chatbot-theme", config: K, children: a })
467
+ /* @__PURE__ */ e(ct, { defaultTheme: "system", storageKey: "chatbot-theme", config: G, children: a })
467
468
  ]
468
469
  }
469
470
  ) }),
@@ -472,16 +473,16 @@ function Za({
472
473
  }
473
474
  function ca() {
474
475
  const { app: a } = ne();
475
- return Oe(), B(() => {
476
+ return Oe(), K(() => {
476
477
  a?.name && (document.title = a.name);
477
- }, [a?.name]), B(() => {
478
+ }, [a?.name]), K(() => {
478
479
  if (!a?.favicon) return;
479
480
  let t = document.querySelector("link[rel~='icon']");
480
481
  t || (t = document.createElement("link"), t.rel = "icon", document.head.appendChild(t)), t.href = a.favicon;
481
482
  }, [a?.favicon]), null;
482
483
  }
483
484
  function Pe() {
484
- const a = Je(), t = Te(), n = oe().getConfig().app?.basePath || "/", i = Q(() => {
485
+ const a = Je(), t = Te(), n = oe().getConfig().app?.basePath || "/", i = W(() => {
485
486
  const u = a.pathname, c = u.endsWith("/") && u !== "/" ? u.slice(0, -1) : u, y = n.endsWith("/") && n !== "/" ? n.slice(0, -1) : n;
486
487
  if (c === (y || "/")) return "/";
487
488
  if (u.startsWith(y) && y !== "/") {
@@ -498,18 +499,18 @@ function Pe() {
498
499
  return [i, r];
499
500
  }
500
501
  function da({ onFinish: a } = {}) {
501
- const { t } = ue(["chat", "errors"]), d = he(), o = oe(), n = o.getConfig(), i = n.app?.cacheNamespace || "gentiq", [r, u] = Pe(), [c, y] = _(() => me()), k = re(/* @__PURE__ */ new Set());
502
- B(() => {
502
+ const { t } = ue(["chat", "errors"]), d = he(), o = oe(), n = o.getConfig(), i = n.app?.cacheNamespace || "gentiq", [r, u] = Pe(), [c, y] = T(() => me()), k = re(/* @__PURE__ */ new Set());
503
+ K(() => {
503
504
  y((f) => r === "/" ? me() : f && r !== `/${f}` ? me() : f);
504
505
  }, [r]);
505
- const g = Q(() => r === "/" ? c : r.replace(/^\//, ""), [r, c]), p = ee((f) => (k.current.add(f), f), []), A = ee(() => {
506
+ const g = W(() => r === "/" ? c : r.replace(/^\//, ""), [r, c]), p = ee((f) => (k.current.add(f), f), []), A = ee(() => {
506
507
  k.current.forEach((f) => URL.revokeObjectURL(f)), k.current.clear();
507
508
  }, []);
508
- B(() => () => A(), [A]);
509
+ K(() => () => A(), [A]);
509
510
  const {
510
511
  data: P,
511
512
  isLoading: I,
512
- isError: E
513
+ isError: R
513
514
  } = rt({
514
515
  queryKey: [i, "threadMessages", g],
515
516
  queryFn: async () => {
@@ -518,7 +519,7 @@ function da({ onFinish: a } = {}) {
518
519
  const f = await o.getThreadMessages(g);
519
520
  return !f.items || !Array.isArray(f.items) ? [] : await Promise.all(
520
521
  f.items.map(async (S) => {
521
- const Z = typeof S.content == "string" ? S.content : S.content?.text || JSON.stringify(S.content), z = [...Array.isArray(S.parts) && S.parts.length > 0 ? S.parts : [{ type: "text", text: Z }]].sort((b, l) => b.type === "file" && l.type !== "file" ? -1 : b.type !== "file" && l.type === "file" ? 1 : 0), U = await Promise.all(
522
+ const Z = typeof S.content == "string" ? S.content : S.content?.text || JSON.stringify(S.content), z = [...Array.isArray(S.parts) && S.parts.length > 0 ? S.parts : [{ type: "text", text: Z }]].sort((b, l) => b.type === "file" && l.type !== "file" ? -1 : b.type !== "file" && l.type === "file" ? 1 : 0), B = await Promise.all(
522
523
  z.map(async (b) => {
523
524
  if (b.type === "file" && b.object_name && !b.url)
524
525
  try {
@@ -537,7 +538,7 @@ function da({ onFinish: a } = {}) {
537
538
  return {
538
539
  id: S.id || me(),
539
540
  role: S.role,
540
- parts: U,
541
+ parts: B,
541
542
  metadata: { feedback: S.feedback }
542
543
  };
543
544
  })
@@ -546,20 +547,20 @@ function da({ onFinish: a } = {}) {
546
547
  enabled: r !== "/",
547
548
  staleTime: 5e3
548
549
  // Keep history fresh for 5 seconds
549
- }), R = Q(
550
+ }), E = W(
550
551
  () => new ea({
551
552
  api: o.getEndpoint("chat", "/chat"),
552
- fetch: async (f, O) => {
553
- const S = new Headers(O?.headers), Z = o.getHeaders();
553
+ fetch: async (f, H) => {
554
+ const S = new Headers(H?.headers), Z = o.getHeaders();
554
555
  Object.entries(Z).forEach(([b, l]) => {
555
556
  S.set(b, l);
556
557
  }), S.set("X-Thread-Id", g);
557
- const H = n.api?.basePath || "/api", z = typeof f == "string" && !f.startsWith("http") ? `${H}${f.startsWith("/") ? f : "/" + f}` : f, U = await fetch(z, { ...O, headers: S });
558
- if (!U.ok) {
559
- const b = await U.json().catch(() => ({}));
558
+ const U = n.api?.basePath || "/api", z = typeof f == "string" && !f.startsWith("http") ? `${U}${f.startsWith("/") ? f : "/" + f}` : f, B = await fetch(z, { ...H, headers: S });
559
+ if (!B.ok) {
560
+ const b = await B.json().catch(() => ({}));
560
561
  if (b.error && (typeof b.error.code == "string" || typeof b.error.message == "string"))
561
- throw new be(b, U.status);
562
- let l = U.statusText || `HTTP ${U.status}`, h = "error", N = null;
562
+ throw new be(b, B.status);
563
+ let l = B.statusText || `HTTP ${B.status}`, h = "error", N = null;
563
564
  throw typeof b.detail == "string" ? l = b.detail : typeof b.message == "string" ? l = b.message : typeof b.error == "string" ? l = b.error : Array.isArray(b.detail) ? (l = "Validation failed", N = b.detail, h = "validation_error") : b.error && typeof b.error.message == "string" && (l = b.error.message), new be(
564
565
  {
565
566
  error: {
@@ -568,65 +569,65 @@ function da({ onFinish: a } = {}) {
568
569
  details: N
569
570
  }
570
571
  },
571
- U.status
572
+ B.status
572
573
  );
573
574
  }
574
- return U;
575
+ return B;
575
576
  }
576
577
  }),
577
578
  [g, n.api?.basePath, o]
578
- ), D = ee(() => {
579
+ ), L = ee(() => {
579
580
  M("ready"), d.invalidateQueries({ queryKey: [i, "conversations"] }), a?.();
580
- }, [d, a, i]), T = Zt({
581
+ }, [d, a, i]), _ = Zt({
581
582
  id: g,
582
- onFinish: D,
583
- transport: R
584
- }), { setMessages: q, sendMessage: x, stop: V } = T, [K, M] = _("idle"), [$, G] = _(null), F = ee(() => {
585
- G(null);
583
+ onFinish: L,
584
+ transport: E
585
+ }), { setMessages: Q, sendMessage: x, stop: V } = _, [G, M] = T("idle"), [D, J] = T(null), j = ee(() => {
586
+ J(null);
586
587
  }, []);
587
- B(() => {
588
- P && (r === `/${c}` || (q(P), M("ready")));
589
- }, [P, q, r, c]), B(() => {
590
- r === "/" && (q([]), M("idle"));
591
- }, [r, q]), B(() => {
588
+ K(() => {
589
+ P && (r === `/${c}` || (Q(P), M("ready")));
590
+ }, [P, Q, r, c]), K(() => {
591
+ r === "/" && (Q([]), M("idle"));
592
+ }, [r, Q]), K(() => {
592
593
  if (r === "/") {
593
594
  M("idle");
594
595
  return;
595
596
  }
596
597
  const f = r === `/${c}`;
597
- I && !f ? M("loading-history") : E || $ || T.error ? M("error") : T.status === "streaming" || T.status === "submitted" ? M(T.status) : M("ready");
598
+ I && !f ? M("loading-history") : R || D || _.error ? M("error") : _.status === "streaming" || _.status === "submitted" ? M(_.status) : M("ready");
598
599
  }, [
599
600
  I,
600
- E,
601
- T.status,
602
- $,
603
- T.error,
601
+ R,
602
+ _.status,
603
+ D,
604
+ _.error,
604
605
  r,
605
606
  c
606
- ]), B(() => () => {
607
+ ]), K(() => () => {
607
608
  V();
608
609
  }, [g, V]);
609
- const J = re(/* @__PURE__ */ new Set()), W = Q(
610
- () => T.messages.filter((f) => f.role === "assistant"),
611
- [T.messages]
610
+ const q = re(/* @__PURE__ */ new Set()), F = W(
611
+ () => _.messages.filter((f) => f.role === "assistant"),
612
+ [_.messages]
612
613
  );
613
- B(() => {
614
+ K(() => {
614
615
  let f = !1;
615
- for (const O of W) {
616
- if (J.current.has(O.id)) continue;
617
- const S = O.parts.find((H) => H.type === "data-title");
618
- (S ? ge(S) : void 0)?.data?.[0]?.title && (J.current.add(O.id), f = !0);
616
+ for (const H of F) {
617
+ if (q.current.has(H.id)) continue;
618
+ const S = H.parts.find((U) => U.type === "data-title");
619
+ (S ? ge(S) : void 0)?.data?.[0]?.title && (q.current.add(H.id), f = !0);
619
620
  }
620
621
  f && d.invalidateQueries({ queryKey: [i, "conversations"] });
621
- }, [W, d, i]);
622
- const j = re(null), L = ee(
622
+ }, [F, d, i]);
623
+ const O = re(null), $ = ee(
623
624
  (f) => {
624
625
  if (f.length === 0) return;
625
- const O = f.map((S) => ({
626
+ const H = f.map((S) => ({
626
627
  type: "data-reference",
627
628
  data: S
628
629
  }));
629
- q((S) => {
630
+ Q((S) => {
630
631
  const Z = new Set(f.map((b) => b.id));
631
632
  if (S.some(
632
633
  (b) => b.parts.some(
@@ -637,46 +638,46 @@ function da({ onFinish: a } = {}) {
637
638
  (b) => b.role === "user" && !b.parts.some((l) => l.type === "data-reference")
638
639
  );
639
640
  if (z === -1) return S;
640
- const U = S.length - 1 - z;
641
- return S.map((b, l) => l !== U ? b : {
641
+ const B = S.length - 1 - z;
642
+ return S.map((b, l) => l !== B ? b : {
642
643
  ...b,
643
644
  metadata: {
644
645
  ...b.metadata || {},
645
646
  references: f
646
647
  },
647
- parts: [...O, ...b.parts]
648
+ parts: [...H, ...b.parts]
648
649
  });
649
650
  });
650
651
  },
651
- [q]
652
+ [Q]
652
653
  );
653
- B(() => {
654
- const f = j.current;
654
+ K(() => {
655
+ const f = O.current;
655
656
  if (!f) return;
656
- const O = new Set(f.map((H) => H.id));
657
- if (T.messages.some(
658
- (H) => H.parts.some(
659
- (z) => z.type === "data-reference" && O.has(ge(z).data?.id)
657
+ const H = new Set(f.map((U) => U.id));
658
+ if (_.messages.some(
659
+ (U) => U.parts.some(
660
+ (z) => z.type === "data-reference" && H.has(ge(z).data?.id)
660
661
  )
661
662
  )) {
662
- j.current = null;
663
+ O.current = null;
663
664
  return;
664
665
  }
665
- T.messages.some(
666
- (H) => H.role === "user" && !H.parts.some((z) => z.type === "data-reference")
667
- ) && (L(f), j.current = null);
668
- }, [T.messages, L]);
666
+ _.messages.some(
667
+ (U) => U.role === "user" && !U.parts.some((z) => z.type === "data-reference")
668
+ ) && ($(f), O.current = null);
669
+ }, [_.messages, $]);
669
670
  const w = ee(
670
- async (f, O, S = []) => {
671
- const Z = r === "/", H = f.trim();
672
- if (!(!H && (!O || O.length === 0) && S.length === 0) && !(K === "loading-history" || K === "streaming" || K === "submitted")) {
671
+ async (f, H, S = []) => {
672
+ const Z = r === "/", U = f.trim();
673
+ if (!(!U && (!H || H.length === 0) && S.length === 0) && !(G === "loading-history" || G === "streaming" || G === "submitted")) {
673
674
  if (V(), Z) {
674
675
  u(`/${g}`);
675
- const z = H || (S[0]?.excerpt ? `↳ ${S[0].excerpt}` : t("attach_file")), U = z.length > 30 ? z.slice(0, 30) + "..." : z;
676
+ const z = U || (S[0]?.excerpt ? `↳ ${S[0].excerpt}` : t("attach_file")), B = z.length > 30 ? z.slice(0, 30) + "..." : z;
676
677
  d.setQueryData([i, "conversations"], (b) => {
677
678
  const l = {
678
679
  id: `/${g}`,
679
- firstMessage: U,
680
+ firstMessage: B,
680
681
  timestamp: Date.now()
681
682
  };
682
683
  return !b || !Array.isArray(b.pages) ? {
@@ -690,13 +691,13 @@ function da({ onFinish: a } = {}) {
690
691
  };
691
692
  });
692
693
  }
693
- M("submitted"), G(null), j.current = S.length > 0 ? S : null;
694
+ M("submitted"), J(null), O.current = S.length > 0 ? S : null;
694
695
  try {
695
- S.length > 0 ? await x({ text: H, files: O }, { body: { references: S } }) : await x({ text: H, files: O });
696
+ S.length > 0 ? await x({ text: U, files: H }, { body: { references: S } }) : await x({ text: U, files: H });
696
697
  } catch (z) {
697
698
  console.error("Failed to send message:", z);
698
- const U = de(z, t);
699
- G(new Error(U)), M("error");
699
+ const B = de(z, t);
700
+ J(new Error(B)), M("error");
700
701
  }
701
702
  }
702
703
  },
@@ -708,33 +709,33 @@ function da({ onFinish: a } = {}) {
708
709
  g,
709
710
  t,
710
711
  d,
711
- K,
712
+ G,
712
713
  i
713
714
  ]
714
715
  ), m = ee(() => {
715
716
  V(), M("ready"), d.invalidateQueries({ queryKey: [i, "conversations"] });
716
- }, [V, d, i]), C = Q(() => {
717
- if ($) return $;
718
- if (T.error) {
719
- const f = de(T.error, t);
717
+ }, [V, d, i]), C = W(() => {
718
+ if (D) return D;
719
+ if (_.error) {
720
+ const f = de(_.error, t);
720
721
  return new Error(f);
721
722
  }
722
723
  return null;
723
- }, [$, T.error, t]);
724
- return Q(
724
+ }, [D, _.error, t]);
725
+ return W(
725
726
  () => ({
726
- ...T,
727
+ ..._,
727
728
  sendMessage: w,
728
729
  stop: m,
729
- clearError: F,
730
+ clearError: j,
730
731
  error: C,
731
732
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- ChatStatus is a superset of the AI SDK status union expected downstream
732
- status: K,
733
- isLoadingHistory: K === "loading-history",
734
- isErrorHistory: K === "error" || !!C || E,
733
+ status: G,
734
+ isLoadingHistory: G === "loading-history",
735
+ isErrorHistory: G === "error" || !!C || R,
735
736
  conversationId: r
736
737
  }),
737
- [T, w, m, F, C, K, E, r]
738
+ [_, w, m, j, C, G, R, r]
738
739
  );
739
740
  }
740
741
  function ua({ classNames: a = {}, disclaimer: t }) {
@@ -748,15 +749,21 @@ function ua({ classNames: a = {}, disclaimer: t }) {
748
749
  isLoadingHistory: g,
749
750
  conversationId: p,
750
751
  sendMessage: A
751
- } = n, { MessageList: P, PromptInput: I, composer: E, disclaimer: R } = ne(), D = t ?? R, T = o.exists("chat:disclaimer") ? d("chat:disclaimer") : null, q = typeof D == "string" ? d(D) : D ?? T, [x, V] = _(null), K = re(r);
752
+ } = n, {
753
+ MessageList: P,
754
+ PromptInput: I,
755
+ WelcomeScreen: R,
756
+ composer: E,
757
+ disclaimer: L
758
+ } = ne(), _ = t ?? L, Q = o.exists("chat:disclaimer") ? d("chat:disclaimer") : null, x = typeof _ == "string" ? d(_) : _ ?? Q, [V, G] = T(null), M = re(r);
752
759
  et(() => {
753
760
  c && y();
754
761
  }, [p, y, c]);
755
- const M = i[i.length - 1], $ = M?.role === "assistant" && (r === "ready" || M.parts.some((F) => F.type === "data-chat-finished"));
756
- B(() => {
757
- r === "error" && K.current !== "error" && x !== p ? V(p) : r === "submitted" && x !== null && V(null), K.current = r;
762
+ const D = i[i.length - 1], J = D?.role === "assistant" && (r === "ready" || D.parts.some((F) => F.type === "data-chat-finished"));
763
+ K(() => {
764
+ r === "error" && M.current !== "error" && V !== p ? G(p) : r === "submitted" && V !== null && G(null), M.current = r;
758
765
  }, [r, p]);
759
- const G = r === "error" && (p === "/" || x === p);
766
+ const j = r === "error" && (p === "/" || V === p), q = i.length === 0 && !g;
760
767
  return /* @__PURE__ */ e(
761
768
  He,
762
769
  {
@@ -764,13 +771,13 @@ function ua({ classNames: a = {}, disclaimer: t }) {
764
771
  maxItems: E?.references?.maxItems,
765
772
  maxExcerptLength: E?.references?.maxExcerptLength,
766
773
  children: /* @__PURE__ */ s("div", { className: v("relative flex flex-col h-full overflow-hidden", a.container), children: [
767
- /* @__PURE__ */ e(
774
+ !q && /* @__PURE__ */ e(
768
775
  P,
769
776
  {
770
777
  messages: i,
771
778
  status: r,
772
779
  isLoadingHistory: g,
773
- error: G ? c : null,
780
+ error: j ? c : null,
774
781
  conversationId: p,
775
782
  regen: (F) => u({ messageId: F }),
776
783
  onSuggestionClick: (F) => A(F),
@@ -778,27 +785,41 @@ function ua({ classNames: a = {}, disclaimer: t }) {
778
785
  className: v("flex-1", a.messageList)
779
786
  }
780
787
  ),
781
- /* @__PURE__ */ s("div", { className: "absolute bottom-0 left-0 right-0 z-10 pointer-events-none flex flex-col items-stretch", children: [
788
+ /* @__PURE__ */ s("div", { className: "absolute inset-0 z-10 pointer-events-none flex flex-col", children: [
789
+ /* @__PURE__ */ e("div", { className: "grow basis-0 shrink-0 min-h-0 flex flex-col items-center justify-end px-4 pb-6 md:pb-8", children: q && /* @__PURE__ */ e(R, { onSuggestionClick: () => {
790
+ } }) }),
791
+ /* @__PURE__ */ s("div", { className: "shrink-0 flex flex-col items-stretch", children: [
792
+ /* @__PURE__ */ e(
793
+ I,
794
+ {
795
+ onSend: A,
796
+ status: r,
797
+ isLastMessageFinished: J,
798
+ stop: k,
799
+ isErrorVisible: j,
800
+ conversationId: p,
801
+ newChat: q,
802
+ className: v(
803
+ "pointer-events-auto",
804
+ a.inputArea,
805
+ x && "pb-0 md:pb-0"
806
+ )
807
+ }
808
+ ),
809
+ x && /* @__PURE__ */ s("div", { className: "relative py-1 px-4 flex justify-center items-center pointer-events-auto", children: [
810
+ /* @__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" }),
811
+ /* @__PURE__ */ e("p", { className: "text-[10px] md:text-[11px] text-muted-foreground/60 select-none text-center leading-tight", children: x })
812
+ ] })
813
+ ] }),
782
814
  /* @__PURE__ */ e(
783
- I,
815
+ "div",
784
816
  {
785
- onSend: A,
786
- status: r,
787
- isLastMessageFinished: $,
788
- stop: k,
789
- isErrorVisible: G,
790
- conversationId: p,
791
817
  className: v(
792
- "pointer-events-auto",
793
- a.inputArea,
794
- q && "pb-0 md:pb-0"
818
+ "basis-0 shrink-0 transition-[flex-grow] duration-500 ease-in-out",
819
+ q ? "grow" : "grow-0"
795
820
  )
796
821
  }
797
- ),
798
- q && /* @__PURE__ */ s("div", { className: "relative py-1 px-4 flex justify-center items-center pointer-events-auto", children: [
799
- /* @__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" }),
800
- /* @__PURE__ */ e("p", { className: "text-[10px] md:text-[11px] text-muted-foreground/60 select-none text-center leading-tight", children: q })
801
- ] })
822
+ )
802
823
  ] })
803
824
  ] })
804
825
  }
@@ -814,7 +835,7 @@ const ha = ({
814
835
  disclaimer: r,
815
836
  ...u
816
837
  }) => {
817
- const c = ne(), y = Q(
838
+ const c = ne(), y = W(
818
839
  () => ({
819
840
  ...c,
820
841
  ...a,
@@ -937,23 +958,23 @@ function _a({
937
958
  ...r
938
959
  }) {
939
960
  const u = dt(), [c, y] = se.useState(!1), [k, g] = se.useState(a), p = t ?? k, A = se.useCallback(
940
- (R) => {
941
- const D = typeof R == "function" ? R(p) : R;
942
- d ? d(D) : g(D), document.cookie = `${xa}=${D}; path=/; max-age=${wa}`;
961
+ (E) => {
962
+ const L = typeof E == "function" ? E(p) : E;
963
+ d ? d(L) : g(L), document.cookie = `${xa}=${L}; path=/; max-age=${wa}`;
943
964
  },
944
965
  [d, p]
945
966
  ), P = se.useCallback(() => {
946
- u ? y((R) => !R) : A((R) => !R);
967
+ u ? y((E) => !E) : A((E) => !E);
947
968
  }, [u, A, y]);
948
969
  se.useEffect(() => {
949
- const R = (D) => {
950
- D.key === Ca && (D.metaKey || D.ctrlKey) && (D.preventDefault(), P());
970
+ const E = (L) => {
971
+ L.key === Ca && (L.metaKey || L.ctrlKey) && (L.preventDefault(), P());
951
972
  };
952
- return window.addEventListener("keydown", R), () => {
953
- window.removeEventListener("keydown", R);
973
+ return window.addEventListener("keydown", E), () => {
974
+ window.removeEventListener("keydown", E);
954
975
  };
955
976
  }, [P]);
956
- const I = p ? "expanded" : "collapsed", E = se.useMemo(
977
+ const I = p ? "expanded" : "collapsed", R = se.useMemo(
957
978
  () => ({
958
979
  state: I,
959
980
  open: p,
@@ -965,7 +986,7 @@ function _a({
965
986
  }),
966
987
  [I, p, A, u, c, y, P]
967
988
  );
968
- return /* @__PURE__ */ e(Xe.Provider, { value: E, children: /* @__PURE__ */ e(Ue, { delayDuration: 0, children: /* @__PURE__ */ e(
989
+ return /* @__PURE__ */ e(Xe.Provider, { value: R, children: /* @__PURE__ */ e(Ue, { delayDuration: 0, children: /* @__PURE__ */ e(
969
990
  "div",
970
991
  {
971
992
  "data-slot": "sidebar-wrapper",
@@ -1204,65 +1225,65 @@ function Fe({
1204
1225
  ] })) : k;
1205
1226
  }
1206
1227
  function Ra({ trigger: a }) {
1207
- const { t, i18n: d } = ue(["settings", "translation"]), { app: o, settings: n } = ne(), i = oe(), r = he(), { theme: u, setTheme: c, accent: y, setAccent: k, radius: g, setRadius: p } = Ve(), [A, P] = _(null), [I, E] = _(!1), R = re(null), D = Q(() => [
1228
+ const { t, i18n: d } = ue(["settings", "translation"]), { app: o, settings: n } = ne(), i = oe(), r = he(), { theme: u, setTheme: c, accent: y, setAccent: k, radius: g, setRadius: p } = Ve(), [A, P] = T(null), [I, R] = T(!1), E = re(null), L = W(() => [
1208
1229
  { id: "general", label: t("sections.general", "General"), icon: Ae },
1209
1230
  { id: "profile", label: t("sections.profile", "Profile"), icon: Mt },
1210
1231
  { id: "account", label: t("sections.account", "Account"), icon: At }
1211
1232
  ].filter((h) => {
1212
1233
  const N = n?.sections?.[h.id];
1213
1234
  return (N?.mode ?? (N?.enabled === !1 ? "hidden" : "editable")) !== "hidden";
1214
- }), [t, n]), [T, q] = _(D[0]?.id || "general"), x = ee(
1235
+ }), [t, n]), [_, Q] = T(L[0]?.id || "general"), x = ee(
1215
1236
  (l, h, N = "editable") => {
1216
1237
  const ie = n?.sections?.[l]?.fields;
1217
1238
  return ie && ie[h] || N;
1218
1239
  },
1219
1240
  [n]
1220
- ), [V, K] = _(""), [M, $] = _(""), [G, F] = _(""), [J, W] = _(""), j = Q(
1241
+ ), [V, G] = T(""), [M, D] = T(""), [J, j] = T(""), [q, F] = T(""), O = W(
1221
1242
  () => o?.userMetadataFields?.filter((l) => l.showInProfile) || [],
1222
1243
  [o?.userMetadataFields]
1223
- ), [L, w] = _({}), [m, C] = _(!1), f = d.language === "fa", O = f ? "text-right" : "text-left", S = ee(async () => {
1244
+ ), [$, w] = T({}), [m, C] = T(!1), f = d.language === "fa", H = f ? "text-right" : "text-left", S = ee(async () => {
1224
1245
  try {
1225
1246
  const l = await i.getMe();
1226
- P(l), K(l.name || ""), $(l.surname || ""), F(l.phone || "");
1247
+ P(l), G(l.name || ""), D(l.surname || ""), j(l.phone || "");
1227
1248
  const h = {};
1228
- j.forEach((N) => {
1249
+ O.forEach((N) => {
1229
1250
  h[N.key] = l.metadata?.[N.key] ?? N.defaultValue ?? "";
1230
1251
  }), w(h);
1231
1252
  } catch (l) {
1232
1253
  console.error("Failed to fetch user:", l), te.error(de(l, t));
1233
1254
  }
1234
- }, [t, j, i]);
1235
- B(() => {
1255
+ }, [t, O, i]);
1256
+ K(() => {
1236
1257
  if (!I) {
1237
- R.current = null;
1258
+ E.current = null;
1238
1259
  return;
1239
1260
  }
1240
- (R.current === null || T === "account") && S(), R.current = T;
1241
- }, [I, T, S]), B(() => {
1242
- const l = { ...L };
1261
+ (E.current === null || _ === "account") && S(), E.current = _;
1262
+ }, [I, _, S]), K(() => {
1263
+ const l = { ...$ };
1243
1264
  let h = !1;
1244
- j.forEach((N) => {
1245
- N.condition && !ye(N.condition, L) && l[N.key] !== void 0 && (delete l[N.key], h = !0);
1265
+ O.forEach((N) => {
1266
+ N.condition && !ye(N.condition, $) && l[N.key] !== void 0 && (delete l[N.key], h = !0);
1246
1267
  }), h && w(l);
1247
- }, [L, j]);
1268
+ }, [$, O]);
1248
1269
  const Z = async () => {
1249
1270
  C(!0);
1250
1271
  try {
1251
- const l = { name: V, surname: M, phone: G, metadata: L };
1252
- J && (l.password = J);
1272
+ const l = { name: V, surname: M, phone: J, metadata: $ };
1273
+ q && (l.password = q);
1253
1274
  const h = await i.updateMe(l);
1254
- r.setQueryData(ht(o?.cacheNamespace || "gentiq"), h), te.success(t("profile.success", "Profile updated successfully")), W(""), S();
1275
+ r.setQueryData(ht(o?.cacheNamespace || "gentiq"), h), te.success(t("profile.success", "Profile updated successfully")), F(""), S();
1255
1276
  } catch (l) {
1256
1277
  te.error(de(l, t));
1257
1278
  } finally {
1258
1279
  C(!1);
1259
1280
  }
1260
- }, H = () => {
1281
+ }, U = () => {
1261
1282
  window.confirm(t("account.logout_confirm", "Are you sure you want to logout?")) && (i.clearToken(), window.location.reload());
1262
1283
  }, z = (l) => {
1263
1284
  d.changeLanguage(l);
1264
- }, U = A?.balance ? Math.max(0, Math.min(100, A.balance.tokens / (A.balance.token_limit || 1) * 100)) : 0, b = A?.balance ? Math.max(0, Math.min(100, A.balance.requests / (A.balance.request_limit || 1) * 100)) : 0;
1265
- return /* @__PURE__ */ s(Ge, { open: I, onOpenChange: E, children: [
1285
+ }, B = A?.balance ? Math.max(0, Math.min(100, A.balance.tokens / (A.balance.token_limit || 1) * 100)) : 0, b = A?.balance ? Math.max(0, Math.min(100, A.balance.requests / (A.balance.request_limit || 1) * 100)) : 0;
1286
+ return /* @__PURE__ */ s(Ge, { open: I, onOpenChange: R, children: [
1266
1287
  /* @__PURE__ */ e(ut, { asChild: !0, children: a || /* @__PURE__ */ e(ae, { variant: "ghost", size: "icon", className: "rounded-full", children: /* @__PURE__ */ e(Ce, { className: "h-5 w-5" }) }) }),
1267
1288
  /* @__PURE__ */ e(
1268
1289
  We,
@@ -1278,13 +1299,13 @@ function Ra({ trigger: a }) {
1278
1299
  /* @__PURE__ */ e("div", { className: "bg-primary/10 p-1.5 rounded-lg", children: /* @__PURE__ */ e(Ce, { className: "h-5 w-5 text-primary" }) }),
1279
1300
  /* @__PURE__ */ e("span", { className: "font-bold text-lg", children: t("title", "Settings") })
1280
1301
  ] }) }),
1281
- /* @__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: D.map((l) => /* @__PURE__ */ s(
1302
+ /* @__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: L.map((l) => /* @__PURE__ */ s(
1282
1303
  "button",
1283
1304
  {
1284
- onClick: () => q(l.id),
1305
+ onClick: () => Q(l.id),
1285
1306
  className: v(
1286
1307
  "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",
1287
- T === l.id ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border",
1308
+ _ === l.id ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border",
1288
1309
  n?.sections?.[l.id]?.mode === "faded" && "opacity-50 pointer-events-none select-none"
1289
1310
  ),
1290
1311
  children: [
@@ -1293,7 +1314,7 @@ function Ra({ trigger: a }) {
1293
1314
  {
1294
1315
  className: v(
1295
1316
  "h-3.5 w-3.5 sm:h-4 sm:w-4 transition-transform",
1296
- T === l.id && "scale-110"
1317
+ _ === l.id && "scale-110"
1297
1318
  )
1298
1319
  }
1299
1320
  ),
@@ -1304,7 +1325,7 @@ function Ra({ trigger: a }) {
1304
1325
  )) }) })
1305
1326
  ] }),
1306
1327
  /* @__PURE__ */ e("div", { className: "flex-1 relative min-h-0 h-full bg-background", children: /* @__PURE__ */ s("div", { className: "absolute inset-0 overflow-y-auto p-5 sm:p-8 pt-12 sm:pt-12 custom-scrollbar", children: [
1307
- T === "profile" && /* @__PURE__ */ s("div", { className: "space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
1328
+ _ === "profile" && /* @__PURE__ */ s("div", { className: "space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
1308
1329
  /* @__PURE__ */ s("div", { children: [
1309
1330
  /* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: t("profile.title", "Profile Information") }),
1310
1331
  /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("profile.subtitle", "Update your personal details below.") })
@@ -1325,11 +1346,11 @@ function Ra({ trigger: a }) {
1325
1346
  {
1326
1347
  id: "name",
1327
1348
  value: V,
1328
- onChange: (l) => K(l.target.value),
1349
+ onChange: (l) => G(l.target.value),
1329
1350
  disabled: x("profile", "name") === "faded",
1330
1351
  className: v(
1331
1352
  "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11",
1332
- O
1353
+ H
1333
1354
  )
1334
1355
  }
1335
1356
  )
@@ -1350,11 +1371,11 @@ function Ra({ trigger: a }) {
1350
1371
  {
1351
1372
  id: "surname",
1352
1373
  value: M,
1353
- onChange: (l) => $(l.target.value),
1374
+ onChange: (l) => D(l.target.value),
1354
1375
  disabled: x("profile", "surname") === "faded",
1355
1376
  className: v(
1356
1377
  "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11",
1357
- O
1378
+ H
1358
1379
  )
1359
1380
  }
1360
1381
  )
@@ -1377,8 +1398,8 @@ function Ra({ trigger: a }) {
1377
1398
  Y,
1378
1399
  {
1379
1400
  id: "phone",
1380
- value: G,
1381
- onChange: (l) => F(l.target.value),
1401
+ value: J,
1402
+ onChange: (l) => j(l.target.value),
1382
1403
  disabled: x("profile", "phone") === "faded",
1383
1404
  className: "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary pl-10 pr-3 text-left",
1384
1405
  dir: "ltr"
@@ -1404,8 +1425,8 @@ function Ra({ trigger: a }) {
1404
1425
  {
1405
1426
  id: "pass",
1406
1427
  type: "password",
1407
- value: J,
1408
- onChange: (l) => W(l.target.value),
1428
+ value: q,
1429
+ onChange: (l) => F(l.target.value),
1409
1430
  disabled: x("profile", "password") === "faded",
1410
1431
  placeholder: t(
1411
1432
  "profile.password_placeholder",
@@ -1419,9 +1440,9 @@ function Ra({ trigger: a }) {
1419
1440
  ]
1420
1441
  }
1421
1442
  ),
1422
- j.map((l) => {
1443
+ O.map((l) => {
1423
1444
  const h = x("profile", l.key, l.mode || "editable");
1424
- return h === "hidden" || !ye(l.condition, L) ? null : /* @__PURE__ */ s(
1445
+ return h === "hidden" || !ye(l.condition, $) ? null : /* @__PURE__ */ s(
1425
1446
  "div",
1426
1447
  {
1427
1448
  className: v(
@@ -1433,8 +1454,8 @@ function Ra({ trigger: a }) {
1433
1454
  l.type === "select" ? /* @__PURE__ */ s(
1434
1455
  we,
1435
1456
  {
1436
- value: String(L[l.key] || ""),
1437
- onValueChange: (N) => w({ ...L, [l.key]: N }),
1457
+ value: String($[l.key] || ""),
1458
+ onValueChange: (N) => w({ ...$, [l.key]: N }),
1438
1459
  disabled: h === "faded",
1439
1460
  dir: f ? "rtl" : "ltr",
1440
1461
  children: [
@@ -1461,9 +1482,9 @@ function Ra({ trigger: a }) {
1461
1482
  {
1462
1483
  id: `profile-${l.key}`,
1463
1484
  type: "checkbox",
1464
- checked: !!L[l.key],
1485
+ checked: !!$[l.key],
1465
1486
  disabled: h === "faded",
1466
- onChange: (N) => w({ ...L, [l.key]: N.target.checked }),
1487
+ onChange: (N) => w({ ...$, [l.key]: N.target.checked }),
1467
1488
  className: "h-5 w-5 rounded-md border-border/50 bg-muted/30 text-primary focus:ring-primary transition-all cursor-pointer"
1468
1489
  }
1469
1490
  ),
@@ -1480,13 +1501,13 @@ function Ra({ trigger: a }) {
1480
1501
  {
1481
1502
  id: `profile-${l.key}`,
1482
1503
  type: l.type,
1483
- value: L[l.key] || "",
1504
+ value: $[l.key] || "",
1484
1505
  disabled: h === "faded",
1485
- onChange: (N) => w({ ...L, [l.key]: N.target.value }),
1506
+ onChange: (N) => w({ ...$, [l.key]: N.target.value }),
1486
1507
  placeholder: t(l.placeholder || ""),
1487
1508
  className: v(
1488
1509
  "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11",
1489
- O
1510
+ H
1490
1511
  )
1491
1512
  }
1492
1513
  )
@@ -1509,7 +1530,7 @@ function Ra({ trigger: a }) {
1509
1530
  ) })
1510
1531
  ] })
1511
1532
  ] }),
1512
- T === "general" && /* @__PURE__ */ s("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
1533
+ _ === "general" && /* @__PURE__ */ s("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
1513
1534
  /* @__PURE__ */ s("div", { children: [
1514
1535
  /* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: t("general.title", "General Settings") }),
1515
1536
  /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("general.subtitle", "Configure look and feel and language.") })
@@ -1703,7 +1724,7 @@ function Ra({ trigger: a }) {
1703
1724
  )
1704
1725
  ] })
1705
1726
  ] }),
1706
- T === "account" && /* @__PURE__ */ s("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
1727
+ _ === "account" && /* @__PURE__ */ s("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
1707
1728
  /* @__PURE__ */ s("div", { children: [
1708
1729
  /* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: t("account.title", "Account & Usage") }),
1709
1730
  /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("account.subtitle", "Monitor your quotas and manage your session.") })
@@ -1726,7 +1747,7 @@ function Ra({ trigger: a }) {
1726
1747
  /* @__PURE__ */ s("div", { className: "flex justify-between text-sm mb-1", children: [
1727
1748
  /* @__PURE__ */ e("span", { className: "font-medium text-muted-foreground", children: t("account.tokens", "Tokens") }),
1728
1749
  /* @__PURE__ */ s("span", { className: "font-bold text-primary", children: [
1729
- U.toLocaleString(d.language, {
1750
+ B.toLocaleString(d.language, {
1730
1751
  maximumFractionDigits: 0
1731
1752
  }),
1732
1753
  "%"
@@ -1742,9 +1763,9 @@ function Ra({ trigger: a }) {
1742
1763
  {
1743
1764
  className: v(
1744
1765
  "h-full rounded-full transition-all duration-1000 shadow-sm",
1745
- U > 60 ? "bg-emerald-500 shadow-emerald-500/20" : U > 20 ? "bg-amber-500 shadow-amber-500/20" : "bg-destructive shadow-destructive/20"
1766
+ B > 60 ? "bg-emerald-500 shadow-emerald-500/20" : B > 20 ? "bg-amber-500 shadow-amber-500/20" : "bg-destructive shadow-destructive/20"
1746
1767
  ),
1747
- style: { width: `${U}%` }
1768
+ style: { width: `${B}%` }
1748
1769
  }
1749
1770
  )
1750
1771
  }
@@ -1798,7 +1819,7 @@ function Ra({ trigger: a }) {
1798
1819
  ae,
1799
1820
  {
1800
1821
  variant: "destructive",
1801
- onClick: H,
1822
+ onClick: U,
1802
1823
  disabled: x("account", "logout") === "faded",
1803
1824
  className: v(
1804
1825
  "rounded-2xl gap-2 font-bold h-12 shadow-lg shadow-destructive/10 transition-all active:scale-[0.98]",
@@ -1833,15 +1854,15 @@ function Ra({ trigger: a }) {
1833
1854
  ] });
1834
1855
  }
1835
1856
  function Ye({ hideActions: a = !1 }) {
1836
- const [, t] = Pe(), { t: d } = ue(["sidebar", "chat"]), { history: o, app: n } = ne(), { theme: i } = Ve(), r = !a && (o?.enabled ?? !0), [u, c] = _("light");
1837
- B(() => {
1857
+ const [, t] = Pe(), { t: d } = ue(["sidebar", "chat"]), { history: o, app: n } = ne(), { theme: i } = Ve(), r = !a && (o?.enabled ?? !0), [u, c] = T("light");
1858
+ K(() => {
1838
1859
  if (i === "system") {
1839
1860
  const g = window.matchMedia("(prefers-color-scheme: dark)").matches;
1840
1861
  c(g ? "dark" : "light");
1841
1862
  } else
1842
1863
  c(i);
1843
1864
  }, [i]);
1844
- const y = Q(() => n?.logo ? typeof n.logo == "string" ? n.logo : u === "dark" ? n.logo.dark : n.logo.light : pt, [n?.logo, u]), k = n?.name || "Gentiq";
1865
+ const y = W(() => n?.logo ? typeof n.logo == "string" ? n.logo : u === "dark" ? n.logo.dark : n.logo.light : pt, [n?.logo, u]), k = n?.name || "Gentiq";
1845
1866
  return /* @__PURE__ */ s("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: [
1846
1867
  /* @__PURE__ */ e("div", { className: "flex items-center gap-1.5 md:gap-2 min-w-[36px] md:min-w-[80px]", children: r && /* @__PURE__ */ e(Pa, { className: "hover:bg-accent/60 transition-all duration-200 hover:scale-105 active:scale-95 rounded-lg size-9" }) }),
1847
1868
  /* @__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("img", { src: y, alt: k, className: "size-8 object-contain" }) }) }),
@@ -1912,9 +1933,9 @@ async function $a(a, t, d, o, n) {
1912
1933
  }
1913
1934
  }
1914
1935
  function La({ side: a = "left" }) {
1915
- const { t, i18n: d } = ue(["sidebar", "translation"]), { setOpenMobile: o, isMobile: n } = ve(), { data: i, fetchNextPage: r, hasNextPage: u, isFetchingNextPage: c, isLoading: y } = Da(), { history: k, app: g } = ne(), p = g?.basePath || "/", A = k?.enabled ?? !1, P = i?.pages.flatMap((h) => h.threads) ?? [], [I, E] = Pe(), R = he(), D = re(null), T = ee(
1936
+ const { t, i18n: d } = ue(["sidebar", "translation"]), { setOpenMobile: o, isMobile: n } = ve(), { data: i, fetchNextPage: r, hasNextPage: u, isFetchingNextPage: c, isLoading: y } = Da(), { history: k, app: g } = ne(), p = g?.basePath || "/", A = k?.enabled ?? !1, P = i?.pages.flatMap((h) => h.threads) ?? [], [I, R] = Pe(), E = he(), L = re(null), _ = ee(
1916
1937
  (h) => {
1917
- D.current && (D.current.disconnect(), D.current = null), h && u && !c && (D.current = new IntersectionObserver(
1938
+ L.current && (L.current.disconnect(), L.current = null), h && u && !c && (L.current = new IntersectionObserver(
1918
1939
  (N) => {
1919
1940
  N[0].isIntersecting && r();
1920
1941
  },
@@ -1922,23 +1943,23 @@ function La({ side: a = "left" }) {
1922
1943
  threshold: 0,
1923
1944
  rootMargin: "100px"
1924
1945
  }
1925
- ), D.current.observe(h));
1946
+ ), L.current.observe(h));
1926
1947
  },
1927
1948
  [u, r, c]
1928
- ), q = oe(), V = q.getConfig().app?.cacheNamespace || "gentiq", [K, M] = _(!1), [$, G] = _(null), [F, J] = _(""), [W, j] = _(null), [L, w] = _(""), m = re(null), C = ee(
1949
+ ), Q = oe(), V = Q.getConfig().app?.cacheNamespace || "gentiq", [G, M] = T(!1), [D, J] = T(null), [j, q] = T(""), [F, O] = T(null), [$, w] = T(""), m = re(null), C = ee(
1929
1950
  (h, N) => {
1930
- h.button !== 0 || h.metaKey || h.ctrlKey || (h.preventDefault(), E(N), n && o(!1));
1951
+ h.button !== 0 || h.metaKey || h.ctrlKey || (h.preventDefault(), R(N), n && o(!1));
1931
1952
  },
1932
- [E, n, o]
1933
- ), f = P.filter((h) => h.firstMessage?.toLowerCase().includes(F.toLowerCase())).sort((h, N) => h.pinned && !N.pinned ? -1 : !h.pinned && N.pinned ? 1 : N.timestamp - h.timestamp), O = async (h) => {
1953
+ [R, n, o]
1954
+ ), f = P.filter((h) => h.firstMessage?.toLowerCase().includes(j.toLowerCase())).sort((h, N) => h.pinned && !N.pinned ? -1 : !h.pinned && N.pinned ? 1 : N.timestamp - h.timestamp), H = async (h) => {
1934
1955
  try {
1935
- await q.pinThread(h.id.replace(/^\//, ""), !h.pinned), R.invalidateQueries({ queryKey: [V, "conversations"] }), te.success(h.pinned ? t("unpinned_success") : t("pinned_success"));
1956
+ await Q.pinThread(h.id.replace(/^\//, ""), !h.pinned), E.invalidateQueries({ queryKey: [V, "conversations"] }), te.success(h.pinned ? t("unpinned_success") : t("pinned_success"));
1936
1957
  } catch {
1937
1958
  te.error(t("pin_failed"));
1938
1959
  }
1939
1960
  }, S = async (h) => {
1940
1961
  try {
1941
- const N = await q.shareThread(h.id.replace(/^\//, "")), ie = `${window.location.origin}${N.url}`;
1962
+ const N = await Q.shareThread(h.id.replace(/^\//, "")), ie = `${window.location.origin}${N.url}`;
1942
1963
  navigator.clipboard.writeText(ie), te.success(t("share_success"), {
1943
1964
  description: t("share_description")
1944
1965
  });
@@ -1946,26 +1967,26 @@ function La({ side: a = "left" }) {
1946
1967
  te.error(t("share_failed"));
1947
1968
  }
1948
1969
  }, Z = (h) => {
1949
- j(h.id), w(h.firstMessage ?? ""), setTimeout(() => m.current?.focus(), 0);
1950
- }, H = (h) => {
1951
- h?.preventDefault(), h?.stopPropagation(), j(null), w("");
1970
+ O(h.id), w(h.firstMessage ?? ""), setTimeout(() => m.current?.focus(), 0);
1971
+ }, U = (h) => {
1972
+ h?.preventDefault(), h?.stopPropagation(), O(null), w("");
1952
1973
  }, z = async (h) => {
1953
- if (h?.preventDefault(), h && "stopPropagation" in h && h.stopPropagation(), !(!W || !L.trim()))
1974
+ if (h?.preventDefault(), h && "stopPropagation" in h && h.stopPropagation(), !(!F || !$.trim()))
1954
1975
  try {
1955
- await q.updateThreadTitle(W, L), R.invalidateQueries({ queryKey: [V, "conversations"] }), j(null), te.success(t("rename_success"));
1976
+ await Q.updateThreadTitle(F, $), E.invalidateQueries({ queryKey: [V, "conversations"] }), O(null), te.success(t("rename_success"));
1956
1977
  } catch {
1957
1978
  te.error(t("rename_failed"));
1958
1979
  }
1959
- }, U = (h) => {
1960
- G(h), M(!0);
1980
+ }, B = (h) => {
1981
+ J(h), M(!0);
1961
1982
  }, b = () => {
1962
- $ && ($a(
1963
- q,
1964
- $.id,
1965
- R,
1983
+ D && ($a(
1984
+ Q,
1985
+ D.id,
1966
1986
  E,
1987
+ R,
1967
1988
  I
1968
- ), M(!1), G(null), te.success(t("chat_deleted_success")));
1989
+ ), M(!1), J(null), te.success(t("chat_deleted_success")));
1969
1990
  }, l = (h) => new Intl.DateTimeFormat(d.language, {
1970
1991
  year: "numeric",
1971
1992
  month: "short",
@@ -2003,8 +2024,8 @@ function La({ side: a = "left" }) {
2003
2024
  Y,
2004
2025
  {
2005
2026
  placeholder: t("search_conversations"),
2006
- value: F,
2007
- onChange: (h) => J(h.target.value),
2027
+ value: j,
2028
+ onChange: (h) => q(h.target.value),
2008
2029
  className: "pl-9 h-10 bg-accent/15 border border-border/40 focus-visible:ring-primary/20 rounded-xl transition-all"
2009
2030
  }
2010
2031
  )
@@ -2012,19 +2033,19 @@ function La({ side: a = "left" }) {
2012
2033
  A && /* @__PURE__ */ s(De, { className: "group-data-[collapsible=icon]:hidden", children: [
2013
2034
  /* @__PURE__ */ s($e, { children: [
2014
2035
  f.map((h, N) => {
2015
- const ie = W === h.id, Ee = Me(h.firstMessage ?? ""), Ze = Ee === "rtl";
2036
+ const ie = F === h.id, Ee = Me(h.firstMessage ?? ""), Ze = Ee === "rtl";
2016
2037
  return /* @__PURE__ */ e(Le, { className: "group/sidebar-menu-item relative", children: ie ? /* @__PURE__ */ s("div", { className: "flex items-center gap-1 px-2 py-1.5 w-full", children: [
2017
2038
  /* @__PURE__ */ e(
2018
2039
  Y,
2019
2040
  {
2020
2041
  ref: m,
2021
- value: L,
2042
+ value: $,
2022
2043
  onChange: (ce) => w(ce.target.value),
2023
2044
  onKeyDown: (ce) => {
2024
- ce.key === "Enter" && z(), ce.key === "Escape" && H();
2045
+ ce.key === "Enter" && z(), ce.key === "Escape" && U();
2025
2046
  },
2026
2047
  className: "h-8 py-0 px-2 text-sm",
2027
- dir: Me(L)
2048
+ dir: Me($)
2028
2049
  }
2029
2050
  ),
2030
2051
  /* @__PURE__ */ e(
@@ -2043,7 +2064,7 @@ function La({ side: a = "left" }) {
2043
2064
  size: "icon",
2044
2065
  variant: "ghost",
2045
2066
  className: "size-8 shrink-0 text-destructive hover:bg-destructive/10",
2046
- onClick: H,
2067
+ onClick: U,
2047
2068
  children: /* @__PURE__ */ e(Kt, { className: "size-4" })
2048
2069
  }
2049
2070
  )
@@ -2115,7 +2136,7 @@ function La({ side: a = "left" }) {
2115
2136
  k?.showPin !== !1 && /* @__PURE__ */ s(
2116
2137
  pe,
2117
2138
  {
2118
- onSelect: () => O(h),
2139
+ onSelect: () => H(h),
2119
2140
  className: "cursor-pointer flex items-center gap-2",
2120
2141
  children: [
2121
2142
  h.pinned ? /* @__PURE__ */ e(Vt, { className: "size-4" }) : /* @__PURE__ */ e(Re, { className: "size-4" }),
@@ -2149,7 +2170,7 @@ function La({ side: a = "left" }) {
2149
2170
  pe,
2150
2171
  {
2151
2172
  className: "text-destructive focus:text-destructive focus:bg-destructive/10 cursor-pointer flex items-center gap-2",
2152
- onSelect: () => U(h),
2173
+ onSelect: () => B(h),
2153
2174
  children: [
2154
2175
  /* @__PURE__ */ e(Jt, { className: "size-4" }),
2155
2176
  /* @__PURE__ */ e("span", { children: t("delete_conversation") })
@@ -2163,9 +2184,9 @@ function La({ side: a = "left" }) {
2163
2184
  )
2164
2185
  ] }) }, N);
2165
2186
  }),
2166
- !y && P.length === 0 && !F && /* @__PURE__ */ e("div", { className: "px-4 py-8 text-center text-sm opacity-40", children: t("no_conversations") })
2187
+ !y && P.length === 0 && !j && /* @__PURE__ */ e("div", { className: "px-4 py-8 text-center text-sm opacity-40", children: t("no_conversations") })
2167
2188
  ] }),
2168
- /* @__PURE__ */ e("div", { ref: T, className: "h-4 w-full" }),
2189
+ /* @__PURE__ */ e("div", { ref: _, className: "h-4 w-full" }),
2169
2190
  c && /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-2 p-4 pt-0 opacity-60", children: [
2170
2191
  /* @__PURE__ */ e("div", { className: "size-4 border-2 border-primary border-t-transparent rounded-full animate-spin" }),
2171
2192
  /* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-wider font-medium", children: t("loading_more") })
@@ -2173,7 +2194,7 @@ function La({ side: a = "left" }) {
2173
2194
  ] })
2174
2195
  ] }) }),
2175
2196
  /* @__PURE__ */ e(Ea, {}),
2176
- /* @__PURE__ */ e(Ge, { open: K, onOpenChange: M, children: /* @__PURE__ */ s(
2197
+ /* @__PURE__ */ e(Ge, { open: G, onOpenChange: M, children: /* @__PURE__ */ s(
2177
2198
  We,
2178
2199
  {
2179
2200
  onKeyDown: (h) => {
@@ -2237,8 +2258,8 @@ function er({
2237
2258
  ] });
2238
2259
  }
2239
2260
  function tr({ children: a }) {
2240
- const [t, d] = _(null), o = Je(), n = Te(), i = he(), r = oe();
2241
- return B(() => {
2261
+ const [t, d] = T(null), o = Je(), n = Te(), i = he(), r = oe();
2262
+ return K(() => {
2242
2263
  (async () => {
2243
2264
  const c = new URLSearchParams(o.search), y = c.get("token");
2244
2265
  if (y)
@@ -2265,43 +2286,43 @@ function tr({ children: a }) {
2265
2286
  }
2266
2287
  const ze = (a) => a.replace(/[^0-9]/g, "");
2267
2288
  function ar() {
2268
- const { t: a, i18n: t } = ue(["login", "translation"]), { app: d } = ne(), o = oe(), n = t.dir() === "rtl", i = n ? "text-right" : "text-left", r = Te(), u = he(), [c, y] = _("login"), k = !!d?.disableSignup, g = !!d?.disableAuthPage, [p, A] = _(""), [P, I] = _(""), [E, R] = _(""), [D, T] = _(""), [q, x] = _(""), [V, K] = _(""), M = Q(
2289
+ const { t: a, i18n: t } = ue(["login", "translation"]), { app: d } = ne(), o = oe(), n = t.dir() === "rtl", i = n ? "text-right" : "text-left", r = Te(), u = he(), [c, y] = T("login"), k = !!d?.disableSignup, g = !!d?.disableAuthPage, [p, A] = T(""), [P, I] = T(""), [R, E] = T(""), [L, _] = T(""), [Q, x] = T(""), [V, G] = T(""), M = W(
2269
2290
  () => d?.userMetadataFields?.filter((m) => m.showInSignup) || [],
2270
2291
  [d?.userMetadataFields]
2271
- ), [$, G] = _(() => {
2292
+ ), [D, J] = T(() => {
2272
2293
  const m = {};
2273
2294
  return M.forEach((C) => {
2274
2295
  C.defaultValue !== void 0 && (m[C.key] = C.defaultValue);
2275
2296
  }), m;
2276
2297
  });
2277
- B(() => {
2278
- const m = { ...$ };
2298
+ K(() => {
2299
+ const m = { ...D };
2279
2300
  let C = !1;
2280
2301
  M.forEach((f) => {
2281
- f.condition && !ye(f.condition, $) && m[f.key] !== void 0 && (delete m[f.key], C = !0);
2282
- }), C && G(m);
2283
- }, [$, M]);
2284
- const [F, J] = _(""), [W, j] = _(!1);
2285
- B(() => {
2302
+ f.condition && !ye(f.condition, D) && m[f.key] !== void 0 && (delete m[f.key], C = !0);
2303
+ }), C && J(m);
2304
+ }, [D, M]);
2305
+ const [j, q] = T(""), [F, O] = T(!1);
2306
+ K(() => {
2286
2307
  k && c === "register" && y("login");
2287
2308
  }, [k, c]);
2288
- const L = async (m) => {
2289
- m.preventDefault(), J(""), j(!0);
2309
+ const $ = async (m) => {
2310
+ m.preventDefault(), q(""), O(!0);
2290
2311
  try {
2291
2312
  await o.login(p, P), u.clear(), r("/");
2292
2313
  } catch (C) {
2293
- J(de(C, a));
2314
+ q(de(C, a));
2294
2315
  } finally {
2295
- j(!1);
2316
+ O(!1);
2296
2317
  }
2297
2318
  }, w = async (m) => {
2298
- m.preventDefault(), J(""), j(!0);
2319
+ m.preventDefault(), q(""), O(!0);
2299
2320
  try {
2300
- await o.register(E, D, q, V, $), u.clear(), r("/");
2321
+ await o.register(R, L, Q, V, D), u.clear(), r("/");
2301
2322
  } catch (C) {
2302
- J(de(C, a));
2323
+ q(de(C, a));
2303
2324
  } finally {
2304
- j(!1);
2325
+ O(!1);
2305
2326
  }
2306
2327
  };
2307
2328
  return g ? /* @__PURE__ */ e(
@@ -2328,7 +2349,7 @@ function ar() {
2328
2349
  {
2329
2350
  type: "button",
2330
2351
  onClick: () => {
2331
- y("login"), J("");
2352
+ y("login"), q("");
2332
2353
  },
2333
2354
  className: `flex-1 py-2 text-sm font-medium rounded-md transition-all ${c === "login" ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"}`,
2334
2355
  children: a("login_tab", "Login")
@@ -2339,14 +2360,14 @@ function ar() {
2339
2360
  {
2340
2361
  type: "button",
2341
2362
  onClick: () => {
2342
- y("register"), J("");
2363
+ y("register"), q("");
2343
2364
  },
2344
2365
  className: `flex-1 py-2 text-sm font-medium rounded-md transition-all ${c === "register" ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"}`,
2345
2366
  children: a("signup_tab", "Sign Up")
2346
2367
  }
2347
2368
  )
2348
2369
  ] }),
2349
- c === "login" && /* @__PURE__ */ s("form", { onSubmit: L, className: "space-y-4", children: [
2370
+ c === "login" && /* @__PURE__ */ s("form", { onSubmit: $, className: "space-y-4", children: [
2350
2371
  /* @__PURE__ */ s("div", { className: "space-y-3", children: [
2351
2372
  /* @__PURE__ */ e(X, { htmlFor: "login-phone", children: a("phone", "Phone") }),
2352
2373
  /* @__PURE__ */ e(
@@ -2379,8 +2400,8 @@ function ar() {
2379
2400
  }
2380
2401
  )
2381
2402
  ] }),
2382
- F && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: F }),
2383
- /* @__PURE__ */ e(ae, { type: "submit", disabled: W, className: "w-full font-semibold", children: W ? a("logging_in", "Logging in...") : a("login_button", "Login") })
2403
+ j && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: j }),
2404
+ /* @__PURE__ */ e(ae, { type: "submit", disabled: F, className: "w-full font-semibold", children: F ? a("logging_in", "Logging in...") : a("login_button", "Login") })
2384
2405
  ] }),
2385
2406
  !k && c === "register" && /* @__PURE__ */ s("form", { onSubmit: w, className: "space-y-4", children: [
2386
2407
  /* @__PURE__ */ s("div", { className: "space-y-3", children: [
@@ -2390,8 +2411,8 @@ function ar() {
2390
2411
  {
2391
2412
  id: "reg-phone",
2392
2413
  type: "tel",
2393
- value: E,
2394
- onChange: (m) => R(ze(m.target.value)),
2414
+ value: R,
2415
+ onChange: (m) => E(ze(m.target.value)),
2395
2416
  required: !0,
2396
2417
  className: "text-left",
2397
2418
  placeholder: a("phone_placeholder", "Phone number"),
@@ -2406,8 +2427,8 @@ function ar() {
2406
2427
  {
2407
2428
  id: "reg-pass",
2408
2429
  type: "password",
2409
- value: D,
2410
- onChange: (m) => T(m.target.value),
2430
+ value: L,
2431
+ onChange: (m) => _(m.target.value),
2411
2432
  required: !0,
2412
2433
  className: "text-left",
2413
2434
  placeholder: "••••••••",
@@ -2423,7 +2444,7 @@ function ar() {
2423
2444
  {
2424
2445
  id: "reg-name",
2425
2446
  type: "text",
2426
- value: q,
2447
+ value: Q,
2427
2448
  onChange: (m) => x(m.target.value),
2428
2449
  required: !0,
2429
2450
  className: i,
@@ -2439,7 +2460,7 @@ function ar() {
2439
2460
  id: "reg-surname",
2440
2461
  type: "text",
2441
2462
  value: V,
2442
- onChange: (m) => K(m.target.value),
2463
+ onChange: (m) => G(m.target.value),
2443
2464
  required: !0,
2444
2465
  className: i,
2445
2466
  placeholder: a("surname_placeholder", "Last Name")
@@ -2447,7 +2468,7 @@ function ar() {
2447
2468
  )
2448
2469
  ] })
2449
2470
  ] }),
2450
- M.map((m) => ye(m.condition, $) ? /* @__PURE__ */ s(
2471
+ M.map((m) => ye(m.condition, D) ? /* @__PURE__ */ s(
2451
2472
  "div",
2452
2473
  {
2453
2474
  className: "space-y-3 animate-in fade-in slide-in-from-top-1 duration-200",
@@ -2456,8 +2477,8 @@ function ar() {
2456
2477
  m.type === "select" ? /* @__PURE__ */ s(
2457
2478
  we,
2458
2479
  {
2459
- value: String($[m.key] || ""),
2460
- onValueChange: (C) => G({ ...$, [m.key]: C }),
2480
+ value: String(D[m.key] || ""),
2481
+ onValueChange: (C) => J({ ...D, [m.key]: C }),
2461
2482
  required: m.required,
2462
2483
  dir: n ? "rtl" : "ltr",
2463
2484
  children: [
@@ -2470,8 +2491,8 @@ function ar() {
2470
2491
  wt,
2471
2492
  {
2472
2493
  id: `signup-${m.key}`,
2473
- checked: !!$[m.key],
2474
- onCheckedChange: (C) => G({ ...$, [m.key]: !!C }),
2494
+ checked: !!D[m.key],
2495
+ onCheckedChange: (C) => J({ ...D, [m.key]: !!C }),
2475
2496
  required: m.required
2476
2497
  }
2477
2498
  ),
@@ -2488,8 +2509,8 @@ function ar() {
2488
2509
  {
2489
2510
  id: `signup-${m.key}`,
2490
2511
  type: m.type,
2491
- value: $[m.key] || "",
2492
- onChange: (C) => G({ ...$, [m.key]: C.target.value }),
2512
+ value: D[m.key] || "",
2513
+ onChange: (C) => J({ ...D, [m.key]: C.target.value }),
2493
2514
  required: m.required,
2494
2515
  className: i,
2495
2516
  placeholder: a(m.placeholder || "")
@@ -2499,18 +2520,18 @@ function ar() {
2499
2520
  },
2500
2521
  m.key
2501
2522
  ) : null),
2502
- F && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: F }),
2503
- /* @__PURE__ */ e(ae, { type: "submit", disabled: W, className: "w-full font-semibold", children: W ? a("signing_up", "Signing up...") : a("signup_button", "Sign Up") })
2523
+ j && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: j }),
2524
+ /* @__PURE__ */ e(ae, { type: "submit", disabled: F, className: "w-full font-semibold", children: F ? a("signing_up", "Signing up...") : a("signup_button", "Sign Up") })
2504
2525
  ] })
2505
2526
  ] })
2506
2527
  }
2507
2528
  );
2508
2529
  }
2509
2530
  function Fa() {
2510
- const { shareId: a } = aa(), [t, d] = _(null), [o, n] = _(!0), [i, r] = _(null), { MessageList: u } = ne(), c = oe(), y = re(/* @__PURE__ */ new Set());
2511
- return B(() => () => {
2531
+ const { shareId: a } = aa(), [t, d] = T(null), [o, n] = T(!0), [i, r] = T(null), { MessageList: u } = ne(), c = oe(), y = re(/* @__PURE__ */ new Set());
2532
+ return K(() => () => {
2512
2533
  y.current.forEach((k) => URL.revokeObjectURL(k)), y.current.clear();
2513
- }, []), B(() => {
2534
+ }, []), K(() => {
2514
2535
  if (!a) return;
2515
2536
  (async () => {
2516
2537
  try {
@@ -2524,10 +2545,10 @@ function Fa() {
2524
2545
  const I = ge(P);
2525
2546
  if (I.type === "file" && I.object_name && !I.url)
2526
2547
  try {
2527
- const E = await c.getPublicAttachmentBlobUrl(I.object_name);
2528
- return y.current.add(E), { ...I, url: E };
2529
- } catch (E) {
2530
- console.error("Failed to resolve shared attachment:", I.object_name, E);
2548
+ const R = await c.getPublicAttachmentBlobUrl(I.object_name);
2549
+ return y.current.add(R), { ...I, url: R };
2550
+ } catch (R) {
2551
+ console.error("Failed to resolve shared attachment:", I.object_name, R);
2531
2552
  }
2532
2553
  return I;
2533
2554
  })
@@ -2607,5 +2628,6 @@ export {
2607
2628
  da as useGentiqChat,
2608
2629
  Pr as useGentiqUser,
2609
2630
  lr as useTranslation,
2631
+ Er as useTypewriter,
2610
2632
  cr as withTranslation
2611
2633
  };