gentiq 0.7.21 → 0.7.23

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.
@@ -2,7 +2,7 @@ import { jsx as e, jsxs as r, Fragment as De } from "react/jsx-runtime";
2
2
  import { useState as x, useEffect as G, useMemo as ue, useRef as Me } from "react";
3
3
  import $e from "i18next";
4
4
  import { useTranslation as Y, initReactI18next as Oe, I18nextProvider as Ee } from "react-i18next";
5
- import { a as he, l as we, t as Ie, m as ke, S as ae, p as ne, q as oe, e as be, r as ie, s as W, J as Re, D as Ue, n as Fe, o as ze, A as Je, E as Pe, F as He, H as Be, $ as Ve, B as me, L as Z, I as pe, a0 as Se, h as ve, i as ye, k as Ne, w as We, x as Ke, y as Ge, z as Ze, a1 as Qe, d as Xe, T as Ye } from "./checkbox-eHCIm0ql.js";
5
+ import { a as he, l as we, t as Ie, m as ke, S as ae, p as ne, q as oe, e as be, r as ie, s as W, J as Re, D as Ue, n as Fe, o as ze, A as Je, E as Pe, F as He, H as Be, $ as Ve, B as me, L as Z, I as pe, a0 as Se, h as ve, i as ye, k as Ne, w as We, x as Ke, y as Ge, z as Ze, a1 as Qe, d as Xe, T as Ye } from "./checkbox-iAFtpOFJ.js";
6
6
  import { useNavigate as et, useLocation as tt, Routes as rt, Route as se, Navigate as Ce } from "react-router-dom";
7
7
  import { Share2 as st, RefreshCcw as Le, Globe as xe, Keyboard as at, Languages as nt, Plus as ot, Hash as it, ShieldAlert as lt, Monitor as Te, Moon as dt, Sun as ct, LogOut as mt } from "lucide-react";
8
8
  import { toast as qe } from "sonner";
@@ -93,7 +93,7 @@ class ut {
93
93
  return u && g.append("query", u), this.request(`/admin/users?${g.toString()}`);
94
94
  }
95
95
  async createUser(a, o, u, g, p, _, N, v) {
96
- const O = g !== void 0 || p !== void 0 || _ !== void 0 || N !== void 0 ? {
96
+ const $ = g !== void 0 || p !== void 0 || _ !== void 0 || N !== void 0 ? {
97
97
  tokens: g || 0,
98
98
  requests: p || 0,
99
99
  token_limit: _ || g || 0,
@@ -101,7 +101,7 @@ class ut {
101
101
  } : void 0;
102
102
  return this.request("/admin/users", {
103
103
  method: "POST",
104
- body: JSON.stringify({ phone: a, name: o, surname: u, balance: O, metadata: v })
104
+ body: JSON.stringify({ phone: a, name: o, surname: u, balance: $, metadata: v })
105
105
  });
106
106
  }
107
107
  async updateUser(a, o) {
@@ -168,7 +168,7 @@ class ut {
168
168
  }
169
169
  const w = new ut();
170
170
  function ht({ onLoginSuccess: t }) {
171
- const { t: a, i18n: o } = Y(["admin", "translation"]), { app: u } = he(), { theme: g } = we(), [p, _] = x(""), [N, v] = x(""), [O, T] = x(""), [I, A] = x(""), [q, k] = x(!1), [U, E] = x(null), [y, D] = x("light");
171
+ const { t: a, i18n: o } = Y(["admin", "translation"]), { app: u } = he(), { theme: g } = we(), [p, _] = x(""), [N, v] = x(""), [$, T] = x(""), [I, A] = x(""), [q, k] = x(!1), [U, O] = x(null), [y, D] = x("light");
172
172
  G(() => {
173
173
  if (g === "system") {
174
174
  const h = window.matchMedia("(prefers-color-scheme: dark)").matches;
@@ -176,9 +176,9 @@ function ht({ onLoginSuccess: t }) {
176
176
  } else
177
177
  D(g);
178
178
  }, [g]);
179
- const $ = ue(() => u?.logo ? typeof u.logo == "string" ? u.logo : y === "dark" ? u.logo.dark : u.logo.light : Ie, [u?.logo, y]), P = u?.adminTitle || u?.name, K = o.language === "fa";
179
+ const E = ue(() => u?.logo ? typeof u.logo == "string" ? u.logo : y === "dark" ? u.logo.dark : u.logo.light : Ie, [u?.logo, y]), J = u?.adminTitle || u?.name, K = o.language === "fa";
180
180
  G(() => {
181
- w.checkSetupStatus().then((h) => E(h.needs_setup)).catch(() => E(!1));
181
+ w.checkSetupStatus().then((h) => O(h.needs_setup)).catch(() => O(!1));
182
182
  }, []);
183
183
  const B = async (h) => {
184
184
  h.preventDefault(), A(""), k(!0);
@@ -189,8 +189,8 @@ function ht({ onLoginSuccess: t }) {
189
189
  } finally {
190
190
  k(!1);
191
191
  }
192
- }, J = async (h) => {
193
- if (h.preventDefault(), A(""), N !== O) {
192
+ }, P = async (h) => {
193
+ if (h.preventDefault(), A(""), N !== $) {
194
194
  A(a("login.passwords_mismatch"));
195
195
  return;
196
196
  }
@@ -219,14 +219,14 @@ function ht({ onLoginSuccess: t }) {
219
219
  /* @__PURE__ */ r("div", { className: "glass rounded-3xl p-10 shadow-2xl", children: [
220
220
  /* @__PURE__ */ r("div", { className: "text-center mb-10", children: [
221
221
  /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-4 mb-6", children: [
222
- /* @__PURE__ */ e("img", { src: $, alt: P, className: "size-16 object-contain" }),
223
- /* @__PURE__ */ e("h1", { className: "text-3xl font-black bg-gradient-to-l from-primary to-primary/60 bg-clip-text text-transparent", children: U ? a("login.setup_title") : P })
222
+ /* @__PURE__ */ e("img", { src: E, alt: J, className: "size-16 object-contain" }),
223
+ /* @__PURE__ */ e("h1", { className: "text-3xl font-black bg-gradient-to-l from-primary to-primary/60 bg-clip-text text-transparent", children: U ? a("login.setup_title") : J })
224
224
  ] }),
225
225
  U && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mt-3", children: a("login.setup_description") })
226
226
  ] }),
227
227
  U ? (
228
228
  /* ---- SETUP FORM ---- */
229
- /* @__PURE__ */ r("form", { onSubmit: J, className: "space-y-7", children: [
229
+ /* @__PURE__ */ r("form", { onSubmit: P, className: "space-y-7", children: [
230
230
  /* @__PURE__ */ r("div", { children: [
231
231
  /* @__PURE__ */ e("label", { className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: a("login.username") }),
232
232
  /* @__PURE__ */ e(
@@ -262,7 +262,7 @@ function ht({ onLoginSuccess: t }) {
262
262
  {
263
263
  id: "setup-confirm",
264
264
  type: "password",
265
- value: O,
265
+ value: $,
266
266
  onChange: (h) => T(h.target.value),
267
267
  required: !0,
268
268
  className: "w-full px-5 py-3.5 rounded-2xl border-0 bg-card text-foreground placeholder-muted-foreground focus:ring-2 focus:ring-primary/20 transition-all text-sm shadow-sm text-left",
@@ -341,30 +341,30 @@ function ht({ onLoginSuccess: t }) {
341
341
  ] });
342
342
  }
343
343
  function pt() {
344
- const { t, i18n: a } = Y(["admin", "translation"]), [o, u] = x([]), [g, p] = x(null), [_, N] = x([]), [v, O] = x(!1), [T, I] = x(!1), [A, q] = x(""), [k, U] = x(""), [E, y] = x(""), [D, $] = x(0), [P, K] = x(!0), B = a.language === "fa", J = B ? "fa-IR" : "en-US", h = async (s = !1) => {
345
- s ? I(!0) : (O(!0), $(0)), q("");
344
+ const { t, i18n: a } = Y(["admin", "translation"]), [o, u] = x([]), [g, p] = x(null), [_, N] = x([]), [v, $] = x(!1), [T, I] = x(!1), [A, q] = x(""), [k, U] = x(""), [O, y] = x(""), [D, E] = x(0), [J, K] = x(!0), B = a.language === "fa", P = B ? "fa-IR" : "en-US", h = async (s = !1) => {
345
+ s ? I(!0) : ($(!0), E(0)), q("");
346
346
  try {
347
347
  const b = s ? D + 50 : 0, S = await w.listThreads(
348
348
  b,
349
349
  50,
350
350
  k || void 0,
351
- E || void 0
351
+ O || void 0
352
352
  );
353
- s ? (u((H) => [...H, ...S.threads]), $(b)) : (u(S.threads), $(0)), K(S.threads.length === 50);
353
+ s ? (u((H) => [...H, ...S.threads]), E(b)) : (u(S.threads), E(0)), K(S.threads.length === 50);
354
354
  } catch (b) {
355
355
  q(b instanceof Error ? b.message : t("error_loading"));
356
356
  } finally {
357
- O(!1), I(!1);
357
+ $(!1), I(!1);
358
358
  }
359
359
  }, F = async (s) => {
360
- p(s), O(!0), q("");
360
+ p(s), $(!0), q("");
361
361
  try {
362
362
  const b = await w.getThreadItems(s.id);
363
363
  N(b.items);
364
364
  } catch (b) {
365
365
  q(b instanceof Error ? b.message : t("error_loading"));
366
366
  } finally {
367
- O(!1);
367
+ $(!1);
368
368
  }
369
369
  }, l = async (s, b) => {
370
370
  s.stopPropagation();
@@ -382,8 +382,8 @@ function pt() {
382
382
  h();
383
383
  }, 500);
384
384
  return () => clearTimeout(s);
385
- }, [k, E]);
386
- const d = (s) => {
385
+ }, [k, O]);
386
+ const c = (s) => {
387
387
  const b = new Date(s);
388
388
  return new Intl.DateTimeFormat(B ? "fa-IR" : "en-US", {
389
389
  year: "numeric",
@@ -467,7 +467,7 @@ function pt() {
467
467
  )
468
468
  ] }, b) : /* @__PURE__ */ e("div", { className: "my-2 p-2 bg-muted/40 rounded-lg border border-border text-xs font-mono opacity-60", children: JSON.stringify(s) }, b), M = (s) => {
469
469
  const { scrollTop: b, scrollHeight: S, clientHeight: H } = s.currentTarget;
470
- S - b <= H + 50 && !T && P && h(!0);
470
+ S - b <= H + 50 && !T && J && h(!0);
471
471
  };
472
472
  return /* @__PURE__ */ r("div", { className: "p-5 h-full flex flex-col gap-4 overflow-hidden", dir: B ? "rtl" : "ltr", children: [
473
473
  /* @__PURE__ */ r("div", { className: "flex flex-col gap-3", children: [
@@ -506,7 +506,7 @@ function pt() {
506
506
  /* @__PURE__ */ r(
507
507
  "select",
508
508
  {
509
- value: E,
509
+ value: O,
510
510
  onChange: (s) => y(s.target.value),
511
511
  className: "px-4 py-2.5 border-0 rounded-xl glass-surface text-foreground focus:ring-2 focus:ring-primary/20 transition-all text-sm shadow-sm min-w-[180px]",
512
512
  children: [
@@ -526,7 +526,7 @@ function pt() {
526
526
  /* @__PURE__ */ e("div", { className: "px-5 py-2.5 border-b border-border/30", children: /* @__PURE__ */ r("h2", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wide", children: [
527
527
  t("chat_history.threads_list"),
528
528
  " (",
529
- (o.length || 0).toLocaleString(J),
529
+ (o.length || 0).toLocaleString(P),
530
530
  ")"
531
531
  ] }) }),
532
532
  /* @__PURE__ */ e(
@@ -563,10 +563,10 @@ function pt() {
563
563
  s.user_info.phone && ` • ${s.user_info.phone}`
564
564
  ] }),
565
565
  s.metadata?.usage && /* @__PURE__ */ r("div", { className: "flex gap-2 mt-2 pt-2 border-border/30", children: [
566
- /* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1 bg-muted/30 px-2 py-0.5 rounded-md text-[9px] text-muted-foreground", children: t("chat_history.input_tokens", { value: (s.metadata.usage.input_tokens || 0).toLocaleString(J) }) }),
567
- /* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1 bg-muted/30 px-2 py-0.5 rounded-md text-[9px] text-muted-foreground", children: t("chat_history.output_tokens", { value: (s.metadata.usage.output_tokens || 0).toLocaleString(J) }) })
566
+ /* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1 bg-muted/30 px-2 py-0.5 rounded-md text-[9px] text-muted-foreground", children: t("chat_history.input_tokens", { value: (s.metadata.usage.input_tokens || 0).toLocaleString(P) }) }),
567
+ /* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1 bg-muted/30 px-2 py-0.5 rounded-md text-[9px] text-muted-foreground", children: t("chat_history.output_tokens", { value: (s.metadata.usage.output_tokens || 0).toLocaleString(P) }) })
568
568
  ] }),
569
- /* @__PURE__ */ e("div", { className: "text-[10px] text-muted-foreground mt-1", children: d(s.created_at) })
569
+ /* @__PURE__ */ e("div", { className: "text-[10px] text-muted-foreground mt-1", children: c(s.created_at) })
570
570
  ] })
571
571
  ]
572
572
  },
@@ -600,7 +600,7 @@ function pt() {
600
600
  s.feedback && /* @__PURE__ */ e("div", { className: "absolute -bottom-2 -left-2 flex items-center justify-center w-8 h-8 rounded-full shadow-md bg-card border border-border animate-in fade-in zoom-in duration-300 z-10", children: /* @__PURE__ */ e("span", { className: "text-base", children: s.feedback === "like" ? "👍" : "👎" }) }),
601
601
  /* @__PURE__ */ r("div", { className: "flex justify-between items-center mb-1.5", children: [
602
602
  /* @__PURE__ */ e("span", { className: `text-[10px] font-bold uppercase tracking-wider ${b || S ? "text-primary" : "text-muted-foreground"}`, children: b ? t("chat_history.user_label") : S ? t("chat_history.assistant_label") : `${s.role}` }),
603
- /* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground", children: d(s.created_at) })
603
+ /* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground", children: c(s.created_at) })
604
604
  ] }),
605
605
  /* @__PURE__ */ e("div", { className: "text-sm text-foreground leading-relaxed", dir: "auto", children: s.parts && s.parts.length > 0 ? s.parts.map((H, V) => j(H, V)) : typeof s.content == "object" ? /* @__PURE__ */ e("pre", { className: "text-xs font-mono bg-muted/40 p-2.5 rounded-xl", dir: "ltr", children: JSON.stringify(s.content, null, 2) }) : s.content })
606
606
  ]
@@ -616,50 +616,50 @@ function pt() {
616
616
  ] });
617
617
  }
618
618
  function gt() {
619
- const { t, i18n: a } = Y(["admin", "translation"]), [o, u] = x([]), [g, p] = x(!1), [_, N] = x(""), [v, O] = x(!1), [T, I] = x(null), [A, q] = x([]), [k, U] = x(null), E = a.language === "fa", [y, D] = x({
619
+ const { t, i18n: a } = Y(["admin", "translation"]), [o, u] = x([]), [g, p] = x(!1), [_, N] = x(""), [v, $] = x(!1), [T, I] = x(null), [A, q] = x([]), [k, U] = x(null), O = a.language === "fa", [y, D] = x({
620
620
  username: "",
621
621
  password: "",
622
622
  name: "",
623
623
  permissions: []
624
- }), $ = async () => {
624
+ }), E = async () => {
625
625
  p(!0), N("");
626
626
  try {
627
- const d = await w.listAdmins();
628
- u(d.admins || []);
627
+ const c = await w.listAdmins();
628
+ u(c.admins || []);
629
629
  const i = localStorage.getItem("admin_info");
630
630
  i && U(JSON.parse(i).admin_id);
631
- } catch (d) {
632
- N(d instanceof Error ? d.message : t("error_loading"));
631
+ } catch (c) {
632
+ N(c instanceof Error ? c.message : t("error_loading"));
633
633
  } finally {
634
634
  p(!1);
635
635
  }
636
- }, P = async () => {
636
+ }, J = async () => {
637
637
  try {
638
- const d = await w.listPermissions();
639
- q(d.permissions);
640
- } catch (d) {
641
- console.error("Failed to load permissions", d);
638
+ const c = await w.listPermissions();
639
+ q(c.permissions);
640
+ } catch (c) {
641
+ console.error("Failed to load permissions", c);
642
642
  }
643
643
  };
644
644
  G(() => {
645
- $(), P();
645
+ E(), J();
646
646
  }, []);
647
- const K = async (d) => {
648
- d.preventDefault(), p(!0);
647
+ const K = async (c) => {
648
+ c.preventDefault(), p(!0);
649
649
  try {
650
650
  await w.register(
651
651
  y.username,
652
652
  y.password,
653
653
  y.name,
654
654
  y.permissions
655
- ), O(!1), D({ username: "", password: "", name: "", permissions: [] }), $();
655
+ ), $(!1), D({ username: "", password: "", name: "", permissions: [] }), E();
656
656
  } catch (i) {
657
657
  N(i instanceof Error ? i.message : t("error_loading"));
658
658
  } finally {
659
659
  p(!1);
660
660
  }
661
- }, B = async (d) => {
662
- if (d.preventDefault(), !!T) {
661
+ }, B = async (c) => {
662
+ if (c.preventDefault(), !!T) {
663
663
  p(!0);
664
664
  try {
665
665
  const i = {
@@ -674,37 +674,37 @@ function gt() {
674
674
  return;
675
675
  }
676
676
  }
677
- I(null), D({ username: "", password: "", name: "", permissions: [] }), $();
677
+ I(null), D({ username: "", password: "", name: "", permissions: [] }), E();
678
678
  } catch (i) {
679
679
  N(i instanceof Error ? i.message : t("error_loading"));
680
680
  } finally {
681
681
  p(!1);
682
682
  }
683
683
  }
684
- }, J = async (d) => {
684
+ }, P = async (c) => {
685
685
  if (confirm(t("admins.confirm_delete_admin")))
686
686
  try {
687
- await w.deleteAdmin(d), $();
687
+ await w.deleteAdmin(c), E();
688
688
  } catch (i) {
689
689
  N(i instanceof Error ? i.message : t("error_loading"));
690
690
  }
691
- }, h = (d) => {
692
- I(d), D({
693
- username: d.username,
691
+ }, h = (c) => {
692
+ I(c), D({
693
+ username: c.username,
694
694
  password: "",
695
- name: d.name,
696
- permissions: d.permissions
697
- }), O(!0);
698
- }, F = (d) => {
695
+ name: c.name,
696
+ permissions: c.permissions
697
+ }), $(!0);
698
+ }, F = (c) => {
699
699
  D((i) => ({
700
700
  ...i,
701
- permissions: i.permissions.includes(d) ? i.permissions.filter((f) => f !== d) : [...i.permissions, d]
701
+ permissions: i.permissions.includes(c) ? i.permissions.filter((f) => f !== c) : [...i.permissions, c]
702
702
  }));
703
- }, l = (d) => {
704
- const i = `admins.perm_${d}`, f = t(i);
703
+ }, l = (c) => {
704
+ const i = `admins.perm_${c}`, f = t(i);
705
705
  if (f !== i)
706
706
  return f;
707
- switch (d) {
707
+ switch (c) {
708
708
  case "chat_history":
709
709
  return t("admins.perm_chat_history");
710
710
  case "admin_management":
@@ -716,10 +716,10 @@ function gt() {
716
716
  case "settings":
717
717
  return t("admins.perm_settings");
718
718
  default:
719
- return d;
719
+ return c;
720
720
  }
721
721
  };
722
- return /* @__PURE__ */ r("div", { className: "h-full flex flex-col p-5 overflow-hidden gap-4", dir: E ? "rtl" : "ltr", children: [
722
+ return /* @__PURE__ */ r("div", { className: "h-full flex flex-col p-5 overflow-hidden gap-4", dir: O ? "rtl" : "ltr", children: [
723
723
  /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3 flex-shrink-0", children: [
724
724
  /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: t("admins.title") }),
725
725
  /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
@@ -728,7 +728,7 @@ function gt() {
728
728
  "button",
729
729
  {
730
730
  onClick: () => {
731
- I(null), D({ username: "", password: "", name: "", permissions: [] }), O(!0);
731
+ I(null), D({ username: "", password: "", name: "", permissions: [] }), $(!0);
732
732
  },
733
733
  className: "px-4 py-2.5 bg-primary text-primary-foreground rounded-xl text-sm font-semibold hover:opacity-90 transition-all shadow-sm hover:shadow-md whitespace-nowrap",
734
734
  children: t("admins.add_admin")
@@ -748,7 +748,7 @@ function gt() {
748
748
  type: "text",
749
749
  disabled: !!T,
750
750
  value: y.username,
751
- onChange: (d) => D({ ...y, username: d.target.value }),
751
+ onChange: (c) => D({ ...y, username: c.target.value }),
752
752
  className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground disabled:opacity-50 focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm font-mono dir-ltr",
753
753
  required: !0,
754
754
  dir: "ltr"
@@ -762,7 +762,7 @@ function gt() {
762
762
  {
763
763
  type: "text",
764
764
  value: y.name,
765
- onChange: (d) => D({ ...y, name: d.target.value }),
765
+ onChange: (c) => D({ ...y, name: c.target.value }),
766
766
  className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm",
767
767
  required: !0
768
768
  }
@@ -775,7 +775,7 @@ function gt() {
775
775
  {
776
776
  type: "password",
777
777
  value: y.password,
778
- onChange: (d) => D({ ...y, password: d.target.value }),
778
+ onChange: (c) => D({ ...y, password: c.target.value }),
779
779
  className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm font-mono dir-ltr",
780
780
  required: !T,
781
781
  dir: "ltr"
@@ -784,26 +784,26 @@ function gt() {
784
784
  ] }),
785
785
  /* @__PURE__ */ r("div", { children: [
786
786
  /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("admins.permissions") }),
787
- /* @__PURE__ */ e("div", { className: "space-y-3 p-4 bg-muted/30 rounded-xl border border-border", children: A.map((d) => /* @__PURE__ */ r("label", { className: "flex items-center gap-3 cursor-pointer group", children: [
787
+ /* @__PURE__ */ e("div", { className: "space-y-3 p-4 bg-muted/30 rounded-xl border border-border", children: A.map((c) => /* @__PURE__ */ r("label", { className: "flex items-center gap-3 cursor-pointer group", children: [
788
788
  /* @__PURE__ */ e("div", { className: "relative flex items-center", children: /* @__PURE__ */ e(
789
789
  "input",
790
790
  {
791
791
  type: "checkbox",
792
- checked: y.permissions.includes(d),
793
- onChange: () => F(d),
794
- disabled: y.username === "admin" && d === "admin_management",
792
+ checked: y.permissions.includes(c),
793
+ onChange: () => F(c),
794
+ disabled: y.username === "admin" && c === "admin_management",
795
795
  className: "peer h-4 w-4 rounded border-input text-primary focus:ring-ring transition-all disabled:opacity-50"
796
796
  }
797
797
  ) }),
798
- /* @__PURE__ */ e("span", { className: "text-sm text-foreground/70 group-hover:text-foreground transition-colors select-none", children: l(d) })
799
- ] }, d)) })
798
+ /* @__PURE__ */ e("span", { className: "text-sm text-foreground/70 group-hover:text-foreground transition-colors select-none", children: l(c) })
799
+ ] }, c)) })
800
800
  ] }),
801
801
  /* @__PURE__ */ r("div", { className: "flex gap-3 pt-4", children: [
802
802
  /* @__PURE__ */ e(
803
803
  "button",
804
804
  {
805
805
  type: "button",
806
- onClick: () => O(!1),
806
+ onClick: () => $(!1),
807
807
  className: "flex-1 px-4 py-3 bg-secondary text-secondary-foreground border border-border rounded-xl text-sm font-medium hover:bg-secondary/80 transition-colors",
808
808
  children: t("cancel")
809
809
  }
@@ -821,38 +821,38 @@ function gt() {
821
821
  ] }) })
822
822
  ] }) }),
823
823
  /* @__PURE__ */ e("div", { className: "glass-surface border border-border rounded-2xl overflow-hidden shadow-sm flex-1 flex flex-col", children: /* @__PURE__ */ r("div", { className: "overflow-x-auto flex-1", children: [
824
- /* @__PURE__ */ r("table", { className: `w-full ${E ? "text-right" : "text-left"} border-collapse`, children: [
824
+ /* @__PURE__ */ r("table", { className: `w-full ${O ? "text-right" : "text-left"} border-collapse`, children: [
825
825
  /* @__PURE__ */ e("thead", { className: "bg-muted/30 sticky top-0 z-10 backdrop-blur-md", children: /* @__PURE__ */ r("tr", { children: [
826
826
  /* @__PURE__ */ e("th", { className: "px-4 py-3.5 text-[11px] font-bold text-muted-foreground uppercase tracking-widest border-b border-border/50", children: t("admins.name") }),
827
827
  /* @__PURE__ */ e("th", { className: "px-4 py-3.5 text-[11px] font-bold text-muted-foreground uppercase tracking-widest border-b border-border/50", children: t("admins.username") }),
828
828
  /* @__PURE__ */ e("th", { className: "px-4 py-3.5 text-[11px] font-bold text-muted-foreground uppercase tracking-widest border-b border-border/50", children: t("admins.permissions") }),
829
829
  /* @__PURE__ */ e("th", { className: "px-4 py-3.5 text-[11px] font-bold text-muted-foreground uppercase tracking-widest border-b border-border/50", children: t("users.actions") })
830
830
  ] }) }),
831
- /* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children: o.map((d) => /* @__PURE__ */ r("tr", { className: "hover:bg-muted/30 transition-colors text-xs border-b border-border/50", children: [
832
- /* @__PURE__ */ e("td", { className: "px-4 py-3 font-medium text-foreground", children: d.name }),
833
- /* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground font-mono", dir: "ltr", children: d.username }),
834
- /* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground", children: /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: d.permissions.map((i) => /* @__PURE__ */ e("span", { className: "px-2 py-0.5 bg-muted/50 text-foreground/80 rounded text-[10px] border border-border/50", children: l(i) }, i)) }) }),
831
+ /* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children: o.map((c) => /* @__PURE__ */ r("tr", { className: "hover:bg-muted/30 transition-colors text-xs border-b border-border/50", children: [
832
+ /* @__PURE__ */ e("td", { className: "px-4 py-3 font-medium text-foreground", children: c.name }),
833
+ /* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground font-mono", dir: "ltr", children: c.username }),
834
+ /* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground", children: /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: c.permissions.map((i) => /* @__PURE__ */ e("span", { className: "px-2 py-0.5 bg-muted/50 text-foreground/80 rounded text-[10px] border border-border/50", children: l(i) }, i)) }) }),
835
835
  /* @__PURE__ */ e("td", { className: "px-4 py-3", children: /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
836
836
  /* @__PURE__ */ e(
837
837
  "button",
838
838
  {
839
- onClick: () => h(d),
839
+ onClick: () => h(c),
840
840
  className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
841
841
  title: t("edit"),
842
842
  children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-4 h-4", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" }) })
843
843
  }
844
844
  ),
845
- d.id !== k && /* @__PURE__ */ e(
845
+ c.id !== k && /* @__PURE__ */ e(
846
846
  "button",
847
847
  {
848
- onClick: () => J(d.id),
848
+ onClick: () => P(c.id),
849
849
  className: "p-2 text-destructive hover:text-destructive/80 hover:bg-destructive/10 rounded-xl transition-all",
850
850
  title: t("delete"),
851
851
  children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-4 h-4", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" }) })
852
852
  }
853
853
  )
854
854
  ] }) })
855
- ] }, d.id)) })
855
+ ] }, c.id)) })
856
856
  ] }),
857
857
  o.length === 0 && !g && /* @__PURE__ */ r("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-2", children: [
858
858
  /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1, stroke: "currentColor", className: "w-12 h-12 opacity-20", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M18 18.72a9.094 9.094 0 0 0 3.741-.479 3 3 0 0 0-4.682-2.72m.94 3.198.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0 1 12 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 0 1 6 18.719m12 0a5.971 5.971 0 0 0-.941-3.197m0 0A5.995 5.995 0 0 0 12 12.75a5.995 5.995 0 0 0-5.058 2.772m0 0a3 3 0 0 0-4.681 2.72 8.986 8.986 0 0 0 3.74.477m.94-3.197a5.971 5.971 0 0 0-.94 3.197M15 6.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm6 3a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Zm-13.5 0a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Z" }) }),
@@ -866,7 +866,7 @@ function gt() {
866
866
  ] });
867
867
  }
868
868
  function ft() {
869
- const { t, i18n: a } = Y(["admin", "translation"]), { app: o } = he(), [u, g] = x([]), [p, _] = x(!1), [N, v] = x(""), [O, T] = x(!1), [I, A] = x(null), [q, k] = x(""), [U, E] = x(0), y = ue(() => o?.userMetadataFields || [], [o?.userMetadataFields]), [D, $] = x(null), [P, K] = x(""), [B, J] = x(""), [h, F] = x(""), [l, d] = x(""), i = a.language === "fa", f = i ? "text-right" : "text-left", [m, j] = x({
869
+ const { t, i18n: a } = Y(["admin", "translation"]), { app: o } = he(), [u, g] = x([]), [p, _] = x(!1), [N, v] = x(""), [$, T] = x(!1), [I, A] = x(null), [q, k] = x(""), [U, O] = x(0), y = ue(() => o?.userMetadataFields || [], [o?.userMetadataFields]), [D, E] = x(null), [J, K] = x(""), [B, P] = x(""), [h, F] = x(""), [l, c] = x(""), i = a.language === "fa", f = i ? "text-right" : "text-left", [m, j] = x({
870
870
  phone: "",
871
871
  name: "",
872
872
  surname: "",
@@ -880,7 +880,7 @@ function ft() {
880
880
  _(!0), v("");
881
881
  try {
882
882
  const n = await w.listUsers(0, 100, q);
883
- g(n.users || []), E(n.count || 0);
883
+ g(n.users || []), O(n.count || 0);
884
884
  } catch (n) {
885
885
  v(n instanceof Error ? n.message : t("error_loading"));
886
886
  } finally {
@@ -966,7 +966,7 @@ function ft() {
966
966
  }
967
967
  }, V = () => {
968
968
  j({ phone: "", name: "", surname: "", tokens: "", requests: "", tokensLimit: "", requestsLimit: "", metadata: "" }), s({});
969
- }, c = async (n) => {
969
+ }, d = async (n) => {
970
970
  if (confirm(t("users.confirm_delete_user")))
971
971
  try {
972
972
  await w.deleteUser(n), b();
@@ -986,7 +986,7 @@ function ft() {
986
986
  }
987
987
  }, z = async (n) => {
988
988
  if (n.preventDefault(), !D) return;
989
- const L = parseInt(P) || 0, R = parseInt(B) || 0, Q = h ? parseInt(h) : D.balance?.token_limit || 0, ge = l ? parseInt(l) : D.balance?.request_limit || 0;
989
+ const L = parseInt(J) || 0, R = parseInt(B) || 0, Q = h ? parseInt(h) : D.balance?.token_limit || 0, ge = l ? parseInt(l) : D.balance?.request_limit || 0;
990
990
  if (L > Q) {
991
991
  v(t("users.tokens_exceed_limit", "Tokens cannot exceed limit"));
992
992
  return;
@@ -1003,7 +1003,7 @@ function ft() {
1003
1003
  R,
1004
1004
  h ? parseInt(h) : void 0,
1005
1005
  l ? parseInt(l) : void 0
1006
- ), $(null), K(""), J(""), F(""), d(""), b();
1006
+ ), E(null), K(""), P(""), F(""), c(""), b();
1007
1007
  } catch (ce) {
1008
1008
  v(ce instanceof Error ? ce.message : t("error_loading"));
1009
1009
  } finally {
@@ -1062,7 +1062,7 @@ function ft() {
1062
1062
  /* @__PURE__ */ e("span", { children: N }),
1063
1063
  /* @__PURE__ */ e("button", { onClick: () => v(""), className: "opacity-50 hover:opacity-100 transition-opacity p-1", children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", className: "w-4 h-4", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) }) })
1064
1064
  ] }),
1065
- O && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-background/20 backdrop-blur-md flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ r("div", { className: "bg-card rounded-2xl border border-border w-full max-w-xl shadow-2xl overflow-hidden", children: [
1065
+ $ && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-background/20 backdrop-blur-md flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ r("div", { className: "bg-card rounded-2xl border border-border w-full max-w-xl shadow-2xl overflow-hidden", children: [
1066
1066
  /* @__PURE__ */ e("div", { className: "px-6 py-5 border-b border-border bg-muted/20", children: /* @__PURE__ */ e("h3", { className: "text-lg font-bold text-foreground", children: t(I ? "users.edit_user" : "users.add_user") }) }),
1067
1067
  /* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit: I ? H : S, children: [
1068
1068
  /* @__PURE__ */ r("div", { className: "space-y-6 max-h-[60vh] overflow-y-auto px-1 custom-scrollbar", children: [
@@ -1274,7 +1274,7 @@ function ft() {
1274
1274
  "input",
1275
1275
  {
1276
1276
  type: "number",
1277
- value: P,
1277
+ value: J,
1278
1278
  onChange: (n) => K(n.target.value),
1279
1279
  className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm font-mono text-left",
1280
1280
  required: !0,
@@ -1292,7 +1292,7 @@ function ft() {
1292
1292
  onChange: (n) => F(n.target.value),
1293
1293
  className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm font-mono text-left",
1294
1294
  dir: "ltr",
1295
- placeholder: P
1295
+ placeholder: J
1296
1296
  }
1297
1297
  )
1298
1298
  ] })
@@ -1305,7 +1305,7 @@ function ft() {
1305
1305
  {
1306
1306
  type: "number",
1307
1307
  value: B,
1308
- onChange: (n) => J(n.target.value),
1308
+ onChange: (n) => P(n.target.value),
1309
1309
  className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm font-mono text-left",
1310
1310
  required: !0,
1311
1311
  dir: "ltr"
@@ -1319,7 +1319,7 @@ function ft() {
1319
1319
  {
1320
1320
  type: "number",
1321
1321
  value: l,
1322
- onChange: (n) => d(n.target.value),
1322
+ onChange: (n) => c(n.target.value),
1323
1323
  className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm font-mono text-left",
1324
1324
  dir: "ltr",
1325
1325
  placeholder: B
@@ -1334,7 +1334,7 @@ function ft() {
1334
1334
  {
1335
1335
  type: "button",
1336
1336
  onClick: () => {
1337
- $(null), v("");
1337
+ E(null), v("");
1338
1338
  },
1339
1339
  className: "flex-1 px-4 py-3 bg-secondary text-secondary-foreground border border-border rounded-xl text-sm font-medium hover:bg-secondary/80 transition-colors",
1340
1340
  children: t("cancel")
@@ -1415,7 +1415,7 @@ function ft() {
1415
1415
  "button",
1416
1416
  {
1417
1417
  onClick: () => {
1418
- $(n), K(String(n.balance?.tokens || 0)), J(String(n.balance?.requests || 0)), F(String(n.balance?.token_limit || 0)), d(String(n.balance?.request_limit || 0)), v("");
1418
+ E(n), K(String(n.balance?.tokens || 0)), P(String(n.balance?.requests || 0)), F(String(n.balance?.token_limit || 0)), c(String(n.balance?.request_limit || 0)), v("");
1419
1419
  },
1420
1420
  className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
1421
1421
  title: t("users.recharge"),
@@ -1434,7 +1434,7 @@ function ft() {
1434
1434
  /* @__PURE__ */ e(
1435
1435
  "button",
1436
1436
  {
1437
- onClick: () => c(n.id),
1437
+ onClick: () => d(n.id),
1438
1438
  className: "p-2 text-destructive hover:text-destructive/80 hover:bg-destructive/10 rounded-xl transition-all",
1439
1439
  title: t("delete"),
1440
1440
  children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-4 h-4", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" }) })
@@ -1455,20 +1455,20 @@ function ft() {
1455
1455
  ] });
1456
1456
  }
1457
1457
  function xt() {
1458
- const { t, i18n: a } = Y(["admin", "translation"]), [o, u] = x(null), [g, p] = x(!0), [_, N] = x(""), [v, O] = x(30), [T, I] = x(0), A = Me(null), q = a.language === "fa", k = q ? "fa-IR" : "en-US", U = q ? "fa-IR-u-ca-persian" : "en-US";
1458
+ const { t, i18n: a } = Y(["admin", "translation"]), [o, u] = x(null), [g, p] = x(!0), [_, N] = x(""), [v, $] = x(30), [T, I] = x(0), A = Me(null), q = a.language === "fa", k = q ? "fa-IR" : "en-US", U = q ? "fa-IR-u-ca-persian" : "en-US";
1459
1459
  G(() => {
1460
1460
  D();
1461
1461
  }, [v]), G(() => {
1462
1462
  if (!A.current) return;
1463
- const l = new ResizeObserver((d) => {
1464
- for (const i of d)
1463
+ const l = new ResizeObserver((c) => {
1464
+ for (const i of c)
1465
1465
  I(i.contentRect.width);
1466
1466
  });
1467
1467
  return l.observe(A.current), () => l.disconnect();
1468
1468
  }, []);
1469
- const E = (l, d, i) => {
1469
+ const O = (l, c, i) => {
1470
1470
  const f = [], m = /* @__PURE__ */ new Date(), j = l || [], M = new Map(j.map((s) => [s.date, s]));
1471
- for (let s = d - 1; s >= 0; s--) {
1471
+ for (let s = c - 1; s >= 0; s--) {
1472
1472
  const S = new Date(m.getTime() - s * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
1473
1473
  if (M.has(S))
1474
1474
  f.push(M.get(S));
@@ -1480,20 +1480,20 @@ function xt() {
1480
1480
  return f;
1481
1481
  }, y = (l) => {
1482
1482
  if (!l || l.length === 0) return null;
1483
- const d = l.length, i = new Intl.DateTimeFormat(U, { month: "short" });
1483
+ const c = l.length, i = new Intl.DateTimeFormat(U, { month: "short" });
1484
1484
  let f = [];
1485
1485
  if (v <= 14)
1486
- f = Array.from({ length: d }, (m, j) => j);
1486
+ f = Array.from({ length: c }, (m, j) => j);
1487
1487
  else {
1488
- const m = q ? 45 : 35, j = T > 0 ? Math.floor(T / m) : 6, M = Math.max(1, Math.ceil(d / Math.max(1, j)));
1489
- for (let s = 0; s < d; s += M)
1488
+ const m = q ? 45 : 35, j = T > 0 ? Math.floor(T / m) : 6, M = Math.max(1, Math.ceil(c / Math.max(1, j)));
1489
+ for (let s = 0; s < c; s += M)
1490
1490
  f.push(s);
1491
- f.length > 0 && f[f.length - 1] !== d - 1 && (d - 1 - f[f.length - 1] > M / 2 ? f.push(d - 1) : f[f.length - 1] = d - 1);
1491
+ f.length > 0 && f[f.length - 1] !== c - 1 && (c - 1 - f[f.length - 1] > M / 2 ? f.push(c - 1) : f[f.length - 1] = c - 1);
1492
1492
  }
1493
1493
  return /* @__PURE__ */ e("div", { className: "relative w-full h-8 mt-2", dir: q ? "rtl" : "ltr", children: f.map((m) => {
1494
1494
  const j = l[m];
1495
1495
  if (!j) return null;
1496
- const M = new Date(j.date), s = M.toLocaleDateString(U, { day: "numeric" }), b = i.format(M), S = d > 1 ? m / (d - 1) * 100 : 50;
1496
+ const M = new Date(j.date), s = M.toLocaleDateString(U, { day: "numeric" }), b = i.format(M), S = c > 1 ? m / (c - 1) * 100 : 50;
1497
1497
  return /* @__PURE__ */ r(
1498
1498
  "div",
1499
1499
  {
@@ -1510,7 +1510,7 @@ function xt() {
1510
1510
  }, D = async () => {
1511
1511
  p(!0), N("");
1512
1512
  try {
1513
- const l = await w.getAnalytics(v), d = {
1513
+ const l = await w.getAnalytics(v), c = {
1514
1514
  ...l,
1515
1515
  overview: l.overview || {
1516
1516
  total_users: 0,
@@ -1520,10 +1520,10 @@ function xt() {
1520
1520
  },
1521
1521
  trends: {
1522
1522
  ...l.trends || {},
1523
- users: E(l.trends?.users, v, ["count"]),
1524
- threads: E(l.trends?.threads, v, ["count"]),
1525
- messages: E(l.trends?.messages, v, ["count"]),
1526
- token_usage: E(l.trends?.token_usage, v, ["tokens", "requests"])
1523
+ users: O(l.trends?.users, v, ["count"]),
1524
+ threads: O(l.trends?.threads, v, ["count"]),
1525
+ messages: O(l.trends?.messages, v, ["count"]),
1526
+ token_usage: O(l.trends?.token_usage, v, ["tokens", "requests"])
1527
1527
  },
1528
1528
  distributions: {
1529
1529
  ...l.distributions || {},
@@ -1531,7 +1531,7 @@ function xt() {
1531
1531
  },
1532
1532
  active_users: l.active_users || []
1533
1533
  };
1534
- u(d);
1534
+ u(c);
1535
1535
  } catch (l) {
1536
1536
  N(l instanceof Error ? l.message : t("analytics.error_loading"));
1537
1537
  } finally {
@@ -1553,19 +1553,19 @@ function xt() {
1553
1553
  )
1554
1554
  ] }) });
1555
1555
  if (!o) return null;
1556
- const $ = (l) => {
1556
+ const E = (l) => {
1557
1557
  if (l <= 0) return 10;
1558
- const d = l * 1.15, i = Math.pow(10, Math.floor(Math.log10(d))), f = d / i;
1558
+ const c = l * 1.15, i = Math.pow(10, Math.floor(Math.log10(c))), f = c / i;
1559
1559
  let m;
1560
- return f <= 1.2 ? m = 0.2 : f <= 2.5 ? m = 0.5 : f <= 5 ? m = 1 : m = 2, Math.ceil(d / (m * i)) * (m * i);
1561
- }, P = Math.max(...o.trends.threads.map((l) => l.count) || [1]), K = Math.max(...o.trends.messages.map((l) => l.count) || [1]), B = Math.max(...o.trends.token_usage.map((l) => l.tokens) || [1]), J = $(P), h = $(K), F = $(B);
1560
+ return f <= 1.2 ? m = 0.2 : f <= 2.5 ? m = 0.5 : f <= 5 ? m = 1 : m = 2, Math.ceil(c / (m * i)) * (m * i);
1561
+ }, J = Math.max(...o.trends.threads.map((l) => l.count) || [1]), K = Math.max(...o.trends.messages.map((l) => l.count) || [1]), B = Math.max(...o.trends.token_usage.map((l) => l.tokens) || [1]), P = E(J), h = E(K), F = E(B);
1562
1562
  return /* @__PURE__ */ r("div", { className: "h-full overflow-auto p-5 flex flex-col gap-5", dir: q ? "rtl" : "ltr", children: [
1563
1563
  /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3", children: [
1564
1564
  /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: t("analytics.title") }),
1565
1565
  /* @__PURE__ */ e("div", { className: "flex gap-2", children: [7, 14, 30, 90].map((l) => /* @__PURE__ */ e(
1566
1566
  "button",
1567
1567
  {
1568
- onClick: () => O(l),
1568
+ onClick: () => $(l),
1569
1569
  className: `px-4 py-2 text-sm font-medium rounded-xl transition-all shadow-sm ${v === l ? "bg-primary text-primary-foreground shadow-md" : "bg-muted/50 text-muted-foreground hover:bg-muted hover:text-foreground border border-border/50"}`,
1570
1570
  children: t("analytics.days", { count: l })
1571
1571
  },
@@ -1608,8 +1608,8 @@ function xt() {
1608
1608
  /* @__PURE__ */ r("div", { className: "h-64 flex flex-col", ref: A, children: [
1609
1609
  /* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
1610
1610
  /* @__PURE__ */ r("div", { className: "flex flex-col justify-between text-[10px] text-muted-foreground pt-6 text-right min-w-[24px]", children: [
1611
- /* @__PURE__ */ e("span", { children: (J || 0).toLocaleString(k) }),
1612
- /* @__PURE__ */ e("span", { children: Math.floor((J || 0) / 2).toLocaleString(k) }),
1611
+ /* @__PURE__ */ e("span", { children: (P || 0).toLocaleString(k) }),
1612
+ /* @__PURE__ */ e("span", { children: Math.floor((P || 0) / 2).toLocaleString(k) }),
1613
1613
  /* @__PURE__ */ e("span", { children: "0" })
1614
1614
  ] }),
1615
1615
  /* @__PURE__ */ r("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
@@ -1617,17 +1617,17 @@ function xt() {
1617
1617
  /* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
1618
1618
  /* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
1619
1619
  ] }),
1620
- o.trends.threads.length > 0 ? o.trends.threads.map((l, d) => /* @__PURE__ */ e("div", { className: "w-1.5 group relative flex flex-col justify-end h-full", children: /* @__PURE__ */ e(
1620
+ o.trends.threads.length > 0 ? o.trends.threads.map((l, c) => /* @__PURE__ */ e("div", { className: "w-1.5 group relative flex flex-col justify-end h-full", children: /* @__PURE__ */ e(
1621
1621
  "div",
1622
1622
  {
1623
1623
  className: "bg-primary/80 w-full rounded-t-lg transition-all group-hover:bg-primary relative",
1624
- style: { height: `${l.count / J * 100}%` },
1624
+ style: { height: `${l.count / P * 100}%` },
1625
1625
  children: /* @__PURE__ */ r("div", { className: "absolute bottom-full mb-1 left-1/2 -translate-x-1/2 opacity-0 group-hover:opacity-100 transition-opacity bg-card px-2 py-1 rounded border border-border shadow-sm z-20 pointer-events-none flex flex-col items-center", children: [
1626
1626
  /* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: l.count.toLocaleString(k) }),
1627
1627
  /* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(l.date).toLocaleDateString(U, { month: "short", day: "numeric" }) })
1628
1628
  ] })
1629
1629
  }
1630
- ) }, d)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
1630
+ ) }, c)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
1631
1631
  ] })
1632
1632
  ] }),
1633
1633
  /* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
@@ -1650,7 +1650,7 @@ function xt() {
1650
1650
  /* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
1651
1651
  /* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
1652
1652
  ] }),
1653
- o.trends.messages.length > 0 ? o.trends.messages.map((l, d) => /* @__PURE__ */ e("div", { className: "w-1.5 group relative flex flex-col justify-end h-full", children: /* @__PURE__ */ e(
1653
+ o.trends.messages.length > 0 ? o.trends.messages.map((l, c) => /* @__PURE__ */ e("div", { className: "w-1.5 group relative flex flex-col justify-end h-full", children: /* @__PURE__ */ e(
1654
1654
  "div",
1655
1655
  {
1656
1656
  className: "bg-primary/80 w-full rounded-t-lg transition-all group-hover:bg-primary relative",
@@ -1660,7 +1660,7 @@ function xt() {
1660
1660
  /* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(l.date).toLocaleDateString(U, { month: "short", day: "numeric" }) })
1661
1661
  ] })
1662
1662
  }
1663
- ) }, d)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
1663
+ ) }, c)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
1664
1664
  ] })
1665
1665
  ] }),
1666
1666
  /* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
@@ -1683,7 +1683,7 @@ function xt() {
1683
1683
  /* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
1684
1684
  /* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
1685
1685
  ] }),
1686
- o.trends.token_usage.length > 0 ? o.trends.token_usage.map((l, d) => /* @__PURE__ */ e("div", { className: "w-1.5 group relative flex flex-col justify-end h-full", children: /* @__PURE__ */ e(
1686
+ o.trends.token_usage.length > 0 ? o.trends.token_usage.map((l, c) => /* @__PURE__ */ e("div", { className: "w-1.5 group relative flex flex-col justify-end h-full", children: /* @__PURE__ */ e(
1687
1687
  "div",
1688
1688
  {
1689
1689
  className: "bg-primary/80 w-full rounded-t-lg transition-all group-hover:bg-primary relative",
@@ -1693,7 +1693,7 @@ function xt() {
1693
1693
  /* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(l.date).toLocaleDateString(U, { month: "short", day: "numeric" }) })
1694
1694
  ] })
1695
1695
  }
1696
- ) }, d)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
1696
+ ) }, c)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
1697
1697
  ] })
1698
1698
  ] }),
1699
1699
  /* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
@@ -1709,9 +1709,9 @@ function xt() {
1709
1709
  /* @__PURE__ */ e("svg", { viewBox: "0 0 100 100", className: "w-full h-full -rotate-90 drop-shadow-md", children: (() => {
1710
1710
  const l = o.distributions.feedback_sentiment.filter(
1711
1711
  (b) => b.sentiment === "positive" || b.sentiment === "negative"
1712
- ), d = l.reduce((b, S) => b + S.count, 0);
1713
- if (d === 0) return null;
1714
- const i = l.find((b) => b.sentiment === "positive")?.count || 0, f = l.find((b) => b.sentiment === "negative")?.count || 0, m = 40, j = 2 * Math.PI * m, M = i / d * 100, s = f / d * 100;
1712
+ ), c = l.reduce((b, S) => b + S.count, 0);
1713
+ if (c === 0) return null;
1714
+ const i = l.find((b) => b.sentiment === "positive")?.count || 0, f = l.find((b) => b.sentiment === "negative")?.count || 0, m = 40, j = 2 * Math.PI * m, M = i / c * 100, s = f / c * 100;
1715
1715
  return /* @__PURE__ */ r(De, { children: [
1716
1716
  /* @__PURE__ */ e(
1717
1717
  "circle",
@@ -1767,11 +1767,11 @@ function xt() {
1767
1767
  ] });
1768
1768
  })() }),
1769
1769
  /* @__PURE__ */ r("div", { className: "absolute inset-0 flex flex-col items-center justify-center pointer-events-none", children: [
1770
- /* @__PURE__ */ e("span", { className: "text-3xl lg:text-4xl font-light text-foreground", children: o.distributions.feedback_sentiment.filter((l) => l.sentiment === "positive" || l.sentiment === "negative").reduce((l, d) => l + (d.count || 0), 0).toLocaleString(k) }),
1770
+ /* @__PURE__ */ e("span", { className: "text-3xl lg:text-4xl font-light text-foreground", children: o.distributions.feedback_sentiment.filter((l) => l.sentiment === "positive" || l.sentiment === "negative").reduce((l, c) => l + (c.count || 0), 0).toLocaleString(k) }),
1771
1771
  /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground uppercase tracking-widest mt-1", children: t("analytics.total_feedback") })
1772
1772
  ] })
1773
1773
  ] }),
1774
- /* @__PURE__ */ e("div", { className: "flex flex-col gap-4 min-w-[140px]", children: [...o.distributions.feedback_sentiment].filter((l) => l.sentiment === "positive" || l.sentiment === "negative").sort((l, d) => l.sentiment === "positive" ? -1 : 1).map((l) => {
1774
+ /* @__PURE__ */ e("div", { className: "flex flex-col gap-4 min-w-[140px]", children: [...o.distributions.feedback_sentiment].filter((l) => l.sentiment === "positive" || l.sentiment === "negative").sort((l, c) => l.sentiment === "positive" ? -1 : 1).map((l) => {
1775
1775
  const i = o.distributions.feedback_sentiment.filter(
1776
1776
  (s) => s.sentiment === "positive" || s.sentiment === "negative"
1777
1777
  ).reduce((s, b) => s + b.count, 0), f = i > 0 ? l.count / i * 100 : 0, m = l.sentiment === "positive" ? t("analytics.positive") : t("analytics.negative"), j = l.sentiment === "positive" ? "bg-primary" : "bg-destructive", M = l.sentiment === "positive" ? "👍" : "👎";
@@ -1846,7 +1846,7 @@ function X({ className: t, ...a }) {
1846
1846
  );
1847
1847
  }
1848
1848
  function bt() {
1849
- const { t, i18n: a } = Y(["admin", "translation", "settings"]), { app: o, welcome: u, disclaimer: g, history: p, threadActions: _, composer: N, settings: v } = he(), [O, T] = x(!1), [I, A] = x(!1), [q, k] = x(""), [U, E] = x(""), [y, D] = x("fa"), [$, P] = x("translation"), [K, B] = x("{}"), [J, h] = x(""), [F, l] = x(!1), d = ue(() => ({
1849
+ const { t, i18n: a } = Y(["admin", "translation", "settings"]), { app: o, welcome: u, disclaimer: g, history: p, threadActions: _, composer: N, settings: v } = he(), [$, T] = x(!1), [I, A] = x(!1), [q, k] = x(""), [U, O] = x(""), [y, D] = x("fa"), [E, J] = x("translation"), [K, B] = x("{}"), [P, h] = x(""), [F, l] = x(!1), c = ue(() => ({
1850
1850
  app_name: o?.name || "Gentiq",
1851
1851
  admin_title: o?.adminTitle || "",
1852
1852
  welcome_greeting: u?.greeting || "",
@@ -1870,7 +1870,7 @@ function bt() {
1870
1870
  settings_account_fields: v?.sections?.account?.fields || {},
1871
1871
  language: a.language || "fa",
1872
1872
  translations: {}
1873
- }), [o, u, g, p, _, N, a.language, v]), [i, f] = x(d), m = a.language === "fa";
1873
+ }), [o, u, g, p, _, N, a.language, v]), [i, f] = x(c), m = a.language === "fa";
1874
1874
  G(() => {
1875
1875
  (async () => {
1876
1876
  T(!0);
@@ -1886,7 +1886,7 @@ function bt() {
1886
1886
  translations: z
1887
1887
  }));
1888
1888
  } else {
1889
- const z = { ...d, translations: a.store.data };
1889
+ const z = { ...c, translations: a.store.data };
1890
1890
  f(z), C || w.updateSettings(z).catch(console.error);
1891
1891
  }
1892
1892
  } catch (C) {
@@ -1895,11 +1895,11 @@ function bt() {
1895
1895
  T(!1);
1896
1896
  }
1897
1897
  })();
1898
- }, [t, d, a.store.data]);
1899
- const j = async (c) => {
1900
- c && c.preventDefault(), A(!0), E(""), k("");
1898
+ }, [t, c, a.store.data]);
1899
+ const j = async (d) => {
1900
+ d && d.preventDefault(), A(!0), O(""), k("");
1901
1901
  try {
1902
- await w.updateSettings(i), E(t("app_settings.save_success")), setTimeout(() => E(""), 3e3);
1902
+ await w.updateSettings(i), O(t("app_settings.save_success")), setTimeout(() => O(""), 3e3);
1903
1903
  } catch (C) {
1904
1904
  k(C instanceof Error ? C.message : t("app_settings.save_error"));
1905
1905
  } finally {
@@ -1909,43 +1909,43 @@ function bt() {
1909
1909
  T(!0), k("");
1910
1910
  try {
1911
1911
  await w.resetSettings(), l(!1), window.location.reload();
1912
- } catch (c) {
1913
- k(c instanceof Error ? c.message : t("app_settings.save_error"));
1912
+ } catch (d) {
1913
+ k(d instanceof Error ? d.message : t("app_settings.save_error"));
1914
1914
  } finally {
1915
1915
  T(!1);
1916
1916
  }
1917
1917
  };
1918
1918
  G(() => {
1919
- const c = i.translations?.[y]?.[$] || {};
1920
- B(JSON.stringify(c, null, 2)), h("");
1921
- }, [y, $, i.translations]);
1922
- const s = (c) => {
1923
- B(c);
1919
+ const d = i.translations?.[y]?.[E] || {};
1920
+ B(JSON.stringify(d, null, 2)), h("");
1921
+ }, [y, E, i.translations]);
1922
+ const s = (d) => {
1923
+ B(d);
1924
1924
  try {
1925
- const C = JSON.parse(c);
1925
+ const C = JSON.parse(d);
1926
1926
  f((z) => ({
1927
1927
  ...z,
1928
1928
  translations: {
1929
1929
  ...z.translations,
1930
1930
  [y]: {
1931
1931
  ...z.translations?.[y],
1932
- [$]: C
1932
+ [E]: C
1933
1933
  }
1934
1934
  }
1935
1935
  })), h("");
1936
1936
  } catch {
1937
1937
  h("Invalid JSON format");
1938
1938
  }
1939
- }, b = ({ title: c, icon: C }) => /* @__PURE__ */ r("div", { className: "relative py-12", children: [
1939
+ }, b = ({ title: d, icon: C }) => /* @__PURE__ */ r("div", { className: "relative py-12", children: [
1940
1940
  /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center", "aria-hidden": "true", children: /* @__PURE__ */ e("div", { className: "w-full border-t border-border/60" }) }),
1941
1941
  /* @__PURE__ */ e("div", { className: "relative flex justify-center", children: /* @__PURE__ */ r("span", { className: "bg-background px-6 text-sm font-bold text-muted-foreground uppercase tracking-[0.2em] flex items-center gap-3", children: [
1942
1942
  /* @__PURE__ */ e(C, { className: "size-4 text-primary/60" }),
1943
- c
1943
+ d
1944
1944
  ] }) })
1945
- ] }), S = ({ value: c }) => {
1946
- if (!c || !c.includes(":") && !c.includes(".")) return null;
1947
- const C = t(c);
1948
- return C === c ? null : /* @__PURE__ */ r("div", { className: "mt-1.5 px-3 py-1 bg-primary/5 rounded-lg border border-primary/10 inline-flex items-center gap-2", children: [
1945
+ ] }), S = ({ value: d }) => {
1946
+ if (!d || !d.includes(":") && !d.includes(".")) return null;
1947
+ const C = t(d);
1948
+ return C === d ? null : /* @__PURE__ */ r("div", { className: "mt-1.5 px-3 py-1 bg-primary/5 rounded-lg border border-primary/10 inline-flex items-center gap-2", children: [
1949
1949
  /* @__PURE__ */ r("span", { className: "text-[10px] font-bold text-primary/60 uppercase tracking-tighter", children: [
1950
1950
  t("app_settings.preview", { defaultValue: "Preview" }),
1951
1951
  ":"
@@ -1953,28 +1953,28 @@ function bt() {
1953
1953
  /* @__PURE__ */ e("span", { className: "text-[11px] font-medium text-foreground/70", children: C })
1954
1954
  ] });
1955
1955
  }, H = () => {
1956
- const c = prompt("Enter language code (e.g. en, fa, fr):");
1957
- c && !i.translations?.[c] && (f((C) => ({
1956
+ const d = prompt("Enter language code (e.g. en, fa, fr):");
1957
+ d && !i.translations?.[d] && (f((C) => ({
1958
1958
  ...C,
1959
1959
  translations: {
1960
1960
  ...C.translations,
1961
- [c]: {}
1961
+ [d]: {}
1962
1962
  }
1963
- })), D(c));
1963
+ })), D(d));
1964
1964
  }, V = () => {
1965
- const c = prompt("Enter namespace (e.g. chat, admin):");
1966
- c && !i.translations?.[y]?.[c] && (f((C) => ({
1965
+ const d = prompt("Enter namespace (e.g. chat, admin):");
1966
+ d && !i.translations?.[y]?.[d] && (f((C) => ({
1967
1967
  ...C,
1968
1968
  translations: {
1969
1969
  ...C.translations,
1970
1970
  [y]: {
1971
1971
  ...C.translations?.[y],
1972
- [c]: {}
1972
+ [d]: {}
1973
1973
  }
1974
1974
  }
1975
- })), P(c));
1975
+ })), J(d));
1976
1976
  };
1977
- return O ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center", children: /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-3", children: [
1977
+ return $ ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center", children: /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-3", children: [
1978
1978
  /* @__PURE__ */ e("div", { className: "w-10 h-10 border-3 border-primary/20 border-t-primary rounded-full animate-spin" }),
1979
1979
  /* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground font-medium", children: t("loading") })
1980
1980
  ] }) }) : /* @__PURE__ */ r("div", { className: "h-full flex flex-col overflow-hidden", dir: m ? "rtl" : "ltr", children: [
@@ -2036,7 +2036,7 @@ function bt() {
2036
2036
  {
2037
2037
  type: "text",
2038
2038
  value: i.app_name,
2039
- onChange: (c) => f({ ...i, app_name: c.target.value }),
2039
+ onChange: (d) => f({ ...i, app_name: d.target.value }),
2040
2040
  className: "bg-muted/20 border-transparent focus:bg-background h-11",
2041
2041
  placeholder: "Gentiq AI",
2042
2042
  dir: "auto"
@@ -2051,7 +2051,7 @@ function bt() {
2051
2051
  {
2052
2052
  type: "text",
2053
2053
  value: i.admin_title || "",
2054
- onChange: (c) => f({ ...i, admin_title: c.target.value }),
2054
+ onChange: (d) => f({ ...i, admin_title: d.target.value }),
2055
2055
  className: "bg-muted/20 border-transparent focus:bg-background h-11",
2056
2056
  placeholder: "Gentiq Admin",
2057
2057
  dir: "auto"
@@ -2066,7 +2066,7 @@ function bt() {
2066
2066
  ae,
2067
2067
  {
2068
2068
  value: i.language,
2069
- onValueChange: (c) => f({ ...i, language: c }),
2069
+ onValueChange: (d) => f({ ...i, language: d }),
2070
2070
  children: [
2071
2071
  /* @__PURE__ */ e(ne, { className: "bg-muted/20 border-transparent focus:bg-background h-11 w-full flex-row-reverse justify-end gap-3", children: /* @__PURE__ */ e(oe, {}) }),
2072
2072
  /* @__PURE__ */ r(ie, { children: [
@@ -2094,7 +2094,7 @@ function bt() {
2094
2094
  {
2095
2095
  type: "text",
2096
2096
  value: i.welcome_greeting || "",
2097
- onChange: (c) => f({ ...i, welcome_greeting: c.target.value }),
2097
+ onChange: (d) => f({ ...i, welcome_greeting: d.target.value }),
2098
2098
  className: "bg-muted/20 border-transparent focus:bg-background h-11",
2099
2099
  placeholder: "e.g. chat:welcome",
2100
2100
  dir: "auto"
@@ -2109,7 +2109,7 @@ function bt() {
2109
2109
  {
2110
2110
  type: "text",
2111
2111
  value: i.welcome_subtitle || "",
2112
- onChange: (c) => f({ ...i, welcome_subtitle: c.target.value }),
2112
+ onChange: (d) => f({ ...i, welcome_subtitle: d.target.value }),
2113
2113
  className: "bg-muted/20 border-transparent focus:bg-background h-11",
2114
2114
  dir: "auto"
2115
2115
  }
@@ -2123,7 +2123,7 @@ function bt() {
2123
2123
  Se,
2124
2124
  {
2125
2125
  value: i.disclaimer || "",
2126
- onChange: (c) => f({ ...i, disclaimer: c.target.value }),
2126
+ onChange: (d) => f({ ...i, disclaimer: d.target.value }),
2127
2127
  className: "bg-muted/20 border-transparent focus:bg-background min-h-[120px] py-4 resize-none leading-relaxed",
2128
2128
  dir: "auto"
2129
2129
  }
@@ -2140,7 +2140,7 @@ function bt() {
2140
2140
  X,
2141
2141
  {
2142
2142
  checked: i.show_tool_details,
2143
- onCheckedChange: (c) => f({ ...i, show_tool_details: c })
2143
+ onCheckedChange: (d) => f({ ...i, show_tool_details: d })
2144
2144
  }
2145
2145
  )
2146
2146
  ] }),
@@ -2153,7 +2153,7 @@ function bt() {
2153
2153
  X,
2154
2154
  {
2155
2155
  checked: i.show_settings,
2156
- onCheckedChange: (c) => f({ ...i, show_settings: c })
2156
+ onCheckedChange: (d) => f({ ...i, show_settings: d })
2157
2157
  }
2158
2158
  )
2159
2159
  ] }),
@@ -2166,7 +2166,7 @@ function bt() {
2166
2166
  X,
2167
2167
  {
2168
2168
  checked: i.composer_attachments,
2169
- onCheckedChange: (c) => f({ ...i, composer_attachments: c })
2169
+ onCheckedChange: (d) => f({ ...i, composer_attachments: d })
2170
2170
  }
2171
2171
  )
2172
2172
  ] }),
@@ -2179,7 +2179,7 @@ function bt() {
2179
2179
  X,
2180
2180
  {
2181
2181
  checked: i.thread_actions_feedback,
2182
- onCheckedChange: (c) => f({ ...i, thread_actions_feedback: c })
2182
+ onCheckedChange: (d) => f({ ...i, thread_actions_feedback: d })
2183
2183
  }
2184
2184
  )
2185
2185
  ] }),
@@ -2192,7 +2192,7 @@ function bt() {
2192
2192
  X,
2193
2193
  {
2194
2194
  checked: i.thread_actions_retry,
2195
- onCheckedChange: (c) => f({ ...i, thread_actions_retry: c })
2195
+ onCheckedChange: (d) => f({ ...i, thread_actions_retry: d })
2196
2196
  }
2197
2197
  )
2198
2198
  ] }),
@@ -2205,7 +2205,7 @@ function bt() {
2205
2205
  X,
2206
2206
  {
2207
2207
  checked: i.history_enabled,
2208
- onCheckedChange: (c) => f({ ...i, history_enabled: c })
2208
+ onCheckedChange: (d) => f({ ...i, history_enabled: d })
2209
2209
  }
2210
2210
  )
2211
2211
  ] }),
@@ -2216,7 +2216,7 @@ function bt() {
2216
2216
  X,
2217
2217
  {
2218
2218
  checked: i.history_show_delete,
2219
- onCheckedChange: (c) => f({ ...i, history_show_delete: c })
2219
+ onCheckedChange: (d) => f({ ...i, history_show_delete: d })
2220
2220
  }
2221
2221
  )
2222
2222
  ] }),
@@ -2226,7 +2226,7 @@ function bt() {
2226
2226
  X,
2227
2227
  {
2228
2228
  checked: i.history_show_rename,
2229
- onCheckedChange: (c) => f({ ...i, history_show_rename: c })
2229
+ onCheckedChange: (d) => f({ ...i, history_show_rename: d })
2230
2230
  }
2231
2231
  )
2232
2232
  ] }),
@@ -2236,7 +2236,7 @@ function bt() {
2236
2236
  X,
2237
2237
  {
2238
2238
  checked: i.history_show_share,
2239
- onCheckedChange: (c) => f({ ...i, history_show_share: c })
2239
+ onCheckedChange: (d) => f({ ...i, history_show_share: d })
2240
2240
  }
2241
2241
  )
2242
2242
  ] }),
@@ -2246,7 +2246,7 @@ function bt() {
2246
2246
  X,
2247
2247
  {
2248
2248
  checked: i.history_show_pin,
2249
- onCheckedChange: (c) => f({ ...i, history_show_pin: c })
2249
+ onCheckedChange: (d) => f({ ...i, history_show_pin: d })
2250
2250
  }
2251
2251
  )
2252
2252
  ] })
@@ -2261,13 +2261,13 @@ function bt() {
2261
2261
  { id: "settings_general_mode", label: "app_settings.chat.general_tab" },
2262
2262
  { id: "settings_profile_mode", label: "app_settings.chat.profile_tab" },
2263
2263
  { id: "settings_account_mode", label: "app_settings.chat.account_tab" }
2264
- ].map((c) => /* @__PURE__ */ r("div", { className: "p-4 border border-border/40 rounded-2xl space-y-3 bg-muted/5", children: [
2265
- /* @__PURE__ */ e(Z, { className: "text-[10px] font-bold uppercase tracking-wider text-muted-foreground/70", children: t(c.label) }),
2264
+ ].map((d) => /* @__PURE__ */ r("div", { className: "p-4 border border-border/40 rounded-2xl space-y-3 bg-muted/5", children: [
2265
+ /* @__PURE__ */ e(Z, { className: "text-[10px] font-bold uppercase tracking-wider text-muted-foreground/70", children: t(d.label) }),
2266
2266
  /* @__PURE__ */ r(
2267
2267
  ae,
2268
2268
  {
2269
- value: i[c.id],
2270
- onValueChange: (C) => f({ ...i, [c.id]: C }),
2269
+ value: i[d.id],
2270
+ onValueChange: (C) => f({ ...i, [d.id]: C }),
2271
2271
  dir: m ? "rtl" : "ltr",
2272
2272
  children: [
2273
2273
  /* @__PURE__ */ e(ne, { className: "bg-background border-transparent h-9 text-xs", children: /* @__PURE__ */ e(oe, {}) }),
@@ -2279,7 +2279,7 @@ function bt() {
2279
2279
  ]
2280
2280
  }
2281
2281
  )
2282
- ] }, c.id)) })
2282
+ ] }, d.id)) })
2283
2283
  ] }),
2284
2284
  /* @__PURE__ */ r("div", { className: "pt-10 space-y-8", children: [
2285
2285
  /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
@@ -2297,15 +2297,15 @@ function bt() {
2297
2297
  { id: "accent", label: t("settings:general.accent") },
2298
2298
  { id: "radius", label: t("settings:general.radius") },
2299
2299
  { id: "language", label: t("settings:general.language") }
2300
- ].map((c) => /* @__PURE__ */ r("div", { className: "p-3 border border-border/40 rounded-xl space-y-2 bg-muted/5", children: [
2301
- /* @__PURE__ */ e(Z, { className: "text-[10px] font-medium text-muted-foreground/70", children: c.label }),
2300
+ ].map((d) => /* @__PURE__ */ r("div", { className: "p-3 border border-border/40 rounded-xl space-y-2 bg-muted/5", children: [
2301
+ /* @__PURE__ */ e(Z, { className: "text-[10px] font-medium text-muted-foreground/70", children: d.label }),
2302
2302
  /* @__PURE__ */ r(
2303
2303
  ae,
2304
2304
  {
2305
- value: i.settings_general_fields?.[c.id] || "editable",
2305
+ value: i.settings_general_fields?.[d.id] || "editable",
2306
2306
  onValueChange: (C) => f((z) => ({
2307
2307
  ...z,
2308
- settings_general_fields: { ...z.settings_general_fields, [c.id]: C }
2308
+ settings_general_fields: { ...z.settings_general_fields, [d.id]: C }
2309
2309
  })),
2310
2310
  dir: m ? "rtl" : "ltr",
2311
2311
  children: [
@@ -2318,7 +2318,7 @@ function bt() {
2318
2318
  ]
2319
2319
  }
2320
2320
  )
2321
- ] }, c.id)) })
2321
+ ] }, d.id)) })
2322
2322
  ] }),
2323
2323
  /* @__PURE__ */ r("div", { className: "space-y-4", children: [
2324
2324
  /* @__PURE__ */ r("h4", { className: "text-xs font-bold uppercase tracking-wider text-muted-foreground/50 flex items-center gap-2", children: [
@@ -2329,16 +2329,17 @@ function bt() {
2329
2329
  { id: "name", label: t("settings:profile.name") },
2330
2330
  { id: "surname", label: t("settings:profile.surname") },
2331
2331
  { id: "phone", label: t("settings:profile.phone") },
2332
- { id: "password", label: t("settings:profile.password") }
2333
- ].map((c) => /* @__PURE__ */ r("div", { className: "p-3 border border-border/40 rounded-xl space-y-2 bg-muted/5", children: [
2334
- /* @__PURE__ */ e(Z, { className: "text-[10px] font-medium text-muted-foreground/70", children: c.label }),
2332
+ { id: "password", label: t("settings:profile.password") },
2333
+ ...(o?.userMetadataFields || []).map((d) => ({ id: d.key, label: t(d.label) }))
2334
+ ].map((d) => /* @__PURE__ */ r("div", { className: "p-3 border border-border/40 rounded-xl space-y-2 bg-muted/5", children: [
2335
+ /* @__PURE__ */ e(Z, { className: "text-[10px] font-medium text-muted-foreground/70", children: d.label }),
2335
2336
  /* @__PURE__ */ r(
2336
2337
  ae,
2337
2338
  {
2338
- value: i.settings_profile_fields?.[c.id] || "editable",
2339
+ value: i.settings_profile_fields?.[d.id] || "editable",
2339
2340
  onValueChange: (C) => f((z) => ({
2340
2341
  ...z,
2341
- settings_profile_fields: { ...z.settings_profile_fields, [c.id]: C }
2342
+ settings_profile_fields: { ...z.settings_profile_fields, [d.id]: C }
2342
2343
  })),
2343
2344
  dir: m ? "rtl" : "ltr",
2344
2345
  children: [
@@ -2351,7 +2352,7 @@ function bt() {
2351
2352
  ]
2352
2353
  }
2353
2354
  )
2354
- ] }, c.id)) })
2355
+ ] }, d.id)) })
2355
2356
  ] }),
2356
2357
  /* @__PURE__ */ r("div", { className: "space-y-4", children: [
2357
2358
  /* @__PURE__ */ r("h4", { className: "text-xs font-bold uppercase tracking-wider text-muted-foreground/50 flex items-center gap-2", children: [
@@ -2361,15 +2362,15 @@ function bt() {
2361
2362
  /* @__PURE__ */ e("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
2362
2363
  { id: "balance", label: t("settings:account.balance") },
2363
2364
  { id: "logout", label: t("settings:account.logout") }
2364
- ].map((c) => /* @__PURE__ */ r("div", { className: "p-3 border border-border/40 rounded-xl space-y-2 bg-muted/5", children: [
2365
- /* @__PURE__ */ e(Z, { className: "text-[10px] font-medium text-muted-foreground/70", children: c.label }),
2365
+ ].map((d) => /* @__PURE__ */ r("div", { className: "p-3 border border-border/40 rounded-xl space-y-2 bg-muted/5", children: [
2366
+ /* @__PURE__ */ e(Z, { className: "text-[10px] font-medium text-muted-foreground/70", children: d.label }),
2366
2367
  /* @__PURE__ */ r(
2367
2368
  ae,
2368
2369
  {
2369
- value: i.settings_account_fields?.[c.id] || "editable",
2370
+ value: i.settings_account_fields?.[d.id] || "editable",
2370
2371
  onValueChange: (C) => f((z) => ({
2371
2372
  ...z,
2372
- settings_account_fields: { ...z.settings_account_fields, [c.id]: C }
2373
+ settings_account_fields: { ...z.settings_account_fields, [d.id]: C }
2373
2374
  })),
2374
2375
  dir: m ? "rtl" : "ltr",
2375
2376
  children: [
@@ -2382,7 +2383,7 @@ function bt() {
2382
2383
  ]
2383
2384
  }
2384
2385
  )
2385
- ] }, c.id)) })
2386
+ ] }, d.id)) })
2386
2387
  ] })
2387
2388
  ] })
2388
2389
  ] })
@@ -2396,12 +2397,12 @@ function bt() {
2396
2397
  /* @__PURE__ */ e("div", { className: "p-2 px-3 bg-muted/20 rounded-lg border border-border/40 ml-1", children: /* @__PURE__ */ e(xe, { className: "size-4 text-muted-foreground" }) }),
2397
2398
  /* @__PURE__ */ r(ae, { value: y, onValueChange: D, children: [
2398
2399
  /* @__PURE__ */ e(ne, { size: "sm", className: "border-none shadow-none bg-transparent h-8 font-black uppercase tracking-wider", children: /* @__PURE__ */ e(oe, {}) }),
2399
- /* @__PURE__ */ e(ie, { children: Object.keys(i.translations || {}).sort().map((c) => /* @__PURE__ */ e(W, { value: c, children: c.toUpperCase() }, c)) })
2400
+ /* @__PURE__ */ e(ie, { children: Object.keys(i.translations || {}).sort().map((d) => /* @__PURE__ */ e(W, { value: d, children: d.toUpperCase() }, d)) })
2400
2401
  ] }),
2401
2402
  /* @__PURE__ */ e("div", { className: "w-px h-6 bg-border/60" }),
2402
- /* @__PURE__ */ r(ae, { value: $, onValueChange: P, children: [
2403
+ /* @__PURE__ */ r(ae, { value: E, onValueChange: J, children: [
2403
2404
  /* @__PURE__ */ e(ne, { size: "sm", className: "border-none shadow-none bg-transparent h-8 flex-1 font-bold", children: /* @__PURE__ */ e(oe, {}) }),
2404
- /* @__PURE__ */ e(ie, { children: Object.keys(i.translations?.[y] || {}).sort().map((c) => /* @__PURE__ */ e(W, { value: c, children: c }, c)) })
2405
+ /* @__PURE__ */ e(ie, { children: Object.keys(i.translations?.[y] || {}).sort().map((d) => /* @__PURE__ */ e(W, { value: d, children: d }, d)) })
2405
2406
  ] })
2406
2407
  ] }),
2407
2408
  /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
@@ -2418,15 +2419,15 @@ function bt() {
2418
2419
  Se,
2419
2420
  {
2420
2421
  value: K,
2421
- onChange: (c) => s(c.target.value),
2422
+ onChange: (d) => s(d.target.value),
2422
2423
  dir: "ltr",
2423
- className: `w-full min-h-[500px] bg-muted/5 font-mono text-[13px] p-8 rounded-xl border focus:ring-1 focus:outline-none leading-relaxed resize-y text-left ${J ? "border-destructive/40 focus:ring-destructive/20" : "border-border/40 focus:ring-primary/20"}`,
2424
+ className: `w-full min-h-[500px] bg-muted/5 font-mono text-[13px] p-8 rounded-xl border focus:ring-1 focus:outline-none leading-relaxed resize-y text-left ${P ? "border-destructive/40 focus:ring-destructive/20" : "border-border/40 focus:ring-primary/20"}`,
2424
2425
  spellCheck: !1
2425
2426
  }
2426
2427
  ),
2427
- J && /* @__PURE__ */ r("div", { className: "mt-2 text-[11px] text-destructive font-bold flex items-center gap-2 px-2", children: [
2428
+ P && /* @__PURE__ */ r("div", { className: "mt-2 text-[11px] text-destructive font-bold flex items-center gap-2 px-2", children: [
2428
2429
  /* @__PURE__ */ e("div", { className: "size-1.5 rounded-full bg-destructive animate-pulse" }),
2429
- J
2430
+ P
2430
2431
  ] })
2431
2432
  ] }),
2432
2433
  /* @__PURE__ */ e("div", { className: "p-6 bg-muted/5 border-t border-border/40 flex items-center justify-between", children: /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
@@ -2484,7 +2485,7 @@ const vt = ({ className: t }) => {
2484
2485
  ] });
2485
2486
  };
2486
2487
  function yt({ extraPages: t = [], disabledPages: a = [] }) {
2487
- const o = et(), u = tt(), { t: g, i18n: p } = Y(["admin", "settings", "translation"]), { app: _ } = he(), { theme: N } = we(), [v, O] = x([]), [T, I] = x(!1), A = Me(!1), [q, k] = x("light");
2488
+ const o = et(), u = tt(), { t: g, i18n: p } = Y(["admin", "settings", "translation"]), { app: _ } = he(), { theme: N } = we(), [v, $] = x([]), [T, I] = x(!1), A = Me(!1), [q, k] = x("light");
2488
2489
  G(() => {
2489
2490
  if (N === "system") {
2490
2491
  const h = window.matchMedia("(prefers-color-scheme: dark)").matches;
@@ -2492,13 +2493,13 @@ function yt({ extraPages: t = [], disabledPages: a = [] }) {
2492
2493
  } else
2493
2494
  k(N);
2494
2495
  }, [N]);
2495
- const U = ue(() => _?.logo ? typeof _.logo == "string" ? _.logo : q === "dark" ? _.logo.dark : _.logo.light : Ie, [_?.logo, q]), E = _?.adminTitle || _?.name, y = p.language === "fa";
2496
+ const U = ue(() => _?.logo ? typeof _.logo == "string" ? _.logo : q === "dark" ? _.logo.dark : _.logo.light : Ie, [_?.logo, q]), O = _?.adminTitle || _?.name, y = p.language === "fa";
2496
2497
  G(() => {
2497
2498
  const h = localStorage.getItem("admin_info");
2498
2499
  if (h)
2499
2500
  try {
2500
2501
  const l = JSON.parse(h).permissions || [];
2501
- if (O(l), u.pathname === "/admin" || u.pathname === "/admin/")
2502
+ if ($(l), u.pathname === "/admin" || u.pathname === "/admin/")
2502
2503
  if (l.includes("analytics") && !a.includes("analytics"))
2503
2504
  o("/admin/analytics", { replace: !0 });
2504
2505
  else if (l.includes("chat_history") && !a.includes("chat_history"))
@@ -2507,9 +2508,11 @@ function yt({ extraPages: t = [], disabledPages: a = [] }) {
2507
2508
  o("/admin/users", { replace: !0 });
2508
2509
  else if (l.includes("admin_management") && !a.includes("admin_management"))
2509
2510
  o("/admin/admins", { replace: !0 });
2511
+ else if (l.includes("settings") && !a.includes("settings"))
2512
+ o("/admin/settings", { replace: !0 });
2510
2513
  else {
2511
- const d = t.find((i) => !i.permission || l.includes(i.permission));
2512
- d && o(`/admin/${d.path}`, { replace: !0 });
2514
+ const c = t.find((i) => !i.permission || l.includes(i.permission));
2515
+ c && o(`/admin/${c.path}`, { replace: !0 });
2513
2516
  }
2514
2517
  } catch (F) {
2515
2518
  console.error("Failed to parse admin_info", F);
@@ -2519,15 +2522,15 @@ function yt({ extraPages: t = [], disabledPages: a = [] }) {
2519
2522
  }, [o, u.pathname]);
2520
2523
  const D = () => {
2521
2524
  w.clearToken(), window.location.reload();
2522
- }, $ = (h) => v.includes(h), P = (h) => v.includes(h) && !a.includes(h), K = Object.keys(p.services?.resourceStore?.data || {}).filter((h) => h !== "dev"), B = K.length > 0 ? K : ["en", "fa"], J = (h) => {
2525
+ }, E = (h) => v.includes(h), J = (h) => v.includes(h) && !a.includes(h), K = Object.keys(p.services?.resourceStore?.data || {}).filter((h) => h !== "dev"), B = K.length > 0 ? K : ["en", "fa"], P = (h) => {
2523
2526
  localStorage.setItem("gentiq-admin-language", h), p.changeLanguage(h), I(!1), document.activeElement instanceof HTMLElement && document.activeElement.blur();
2524
2527
  };
2525
2528
  return /* @__PURE__ */ r("div", { className: "min-h-screen bg-background overflow-hidden flex flex-col", dir: y ? "rtl" : "ltr", children: [
2526
2529
  /* @__PURE__ */ e("header", { className: "glass border-b border-border sticky top-0 z-50", children: /* @__PURE__ */ e("div", { className: "px-8", children: /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-stretch justify-between min-h-[72px] gap-y-4", children: [
2527
2530
  /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-stretch gap-x-12", children: [
2528
2531
  /* @__PURE__ */ r("div", { className: "flex items-center gap-3 py-4 md:py-0", children: [
2529
- /* @__PURE__ */ e("img", { src: U, alt: E, className: "size-8 object-contain" }),
2530
- /* @__PURE__ */ e("h1", { className: "text-2xl font-black bg-gradient-to-l from-primary to-primary/60 bg-clip-text text-transparent", children: E })
2532
+ /* @__PURE__ */ e("img", { src: U, alt: O, className: "size-8 object-contain" }),
2533
+ /* @__PURE__ */ e("h1", { className: "text-2xl font-black bg-gradient-to-l from-primary to-primary/60 bg-clip-text text-transparent", children: O })
2531
2534
  ] }),
2532
2535
  /* @__PURE__ */ r("nav", { className: "flex items-stretch gap-8", children: [
2533
2536
  !a.includes("analytics") && /* @__PURE__ */ e(
@@ -2562,7 +2565,7 @@ function yt({ extraPages: t = [], disabledPages: a = [] }) {
2562
2565
  children: g("dashboard.tabs.admins")
2563
2566
  }
2564
2567
  ),
2565
- $("settings") && !a.includes("settings") && /* @__PURE__ */ e(
2568
+ !a.includes("settings") && /* @__PURE__ */ e(
2566
2569
  "button",
2567
2570
  {
2568
2571
  onClick: () => o("/admin/settings"),
@@ -2612,7 +2615,7 @@ function yt({ extraPages: t = [], disabledPages: a = [] }) {
2612
2615
  /* @__PURE__ */ e(Ge, { align: "center", className: "min-w-[8rem]", children: B.map((h) => /* @__PURE__ */ e(
2613
2616
  Ze,
2614
2617
  {
2615
- onClick: () => J(h),
2618
+ onClick: () => P(h),
2616
2619
  className: h === p.language ? "bg-primary/10" : "",
2617
2620
  children: g(`general.languages.${h}`, h.toUpperCase())
2618
2621
  },
@@ -2638,28 +2641,16 @@ function yt({ extraPages: t = [], disabledPages: a = [] }) {
2638
2641
  ] }) }) }),
2639
2642
  /* @__PURE__ */ e("main", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e("div", { className: "absolute inset-0 overflow-hidden", children: /* @__PURE__ */ r(rt, { children: [
2640
2643
  /* @__PURE__ */ e(se, { path: "/", element: /* @__PURE__ */ e(Ce, { to: "/admin/analytics", replace: !0 }) }),
2641
- /* @__PURE__ */ e(se, { path: "/analytics", element: P("analytics") ? /* @__PURE__ */ e(xt, {}) : /* @__PURE__ */ e(le, {}) }),
2642
- /* @__PURE__ */ e(se, { path: "/chat-history", element: P("chat_history") ? /* @__PURE__ */ e(pt, {}) : /* @__PURE__ */ e(le, {}) }),
2643
- /* @__PURE__ */ e(
2644
- se,
2645
- {
2646
- path: "/admins",
2647
- element: $("admin_management") && !a.includes("admin_management") ? /* @__PURE__ */ e(gt, {}) : /* @__PURE__ */ e(le, {})
2648
- }
2649
- ),
2650
- /* @__PURE__ */ e(
2651
- se,
2652
- {
2653
- path: "/settings",
2654
- element: $("settings") && !a.includes("admin_management") ? /* @__PURE__ */ e(bt, {}) : /* @__PURE__ */ e(le, {})
2655
- }
2656
- ),
2657
- /* @__PURE__ */ e(se, { path: "/users", element: P("user_management") ? /* @__PURE__ */ e(ft, {}) : /* @__PURE__ */ e(le, {}) }),
2644
+ /* @__PURE__ */ e(se, { path: "/analytics", element: J("analytics") ? /* @__PURE__ */ e(xt, {}) : /* @__PURE__ */ e(le, {}) }),
2645
+ /* @__PURE__ */ e(se, { path: "/chat-history", element: J("chat_history") ? /* @__PURE__ */ e(pt, {}) : /* @__PURE__ */ e(le, {}) }),
2646
+ /* @__PURE__ */ e(se, { path: "/admins", element: J("admin_management") ? /* @__PURE__ */ e(gt, {}) : /* @__PURE__ */ e(le, {}) }),
2647
+ /* @__PURE__ */ e(se, { path: "/settings", element: J("settings") ? /* @__PURE__ */ e(bt, {}) : /* @__PURE__ */ e(le, {}) }),
2648
+ /* @__PURE__ */ e(se, { path: "/users", element: J("user_management") ? /* @__PURE__ */ e(ft, {}) : /* @__PURE__ */ e(le, {}) }),
2658
2649
  t.map((h) => /* @__PURE__ */ e(
2659
2650
  se,
2660
2651
  {
2661
2652
  path: `/${h.path}`,
2662
- element: h.permission && !$(h.permission) ? /* @__PURE__ */ e(le, {}) : h.element
2653
+ element: h.permission && !E(h.permission) ? /* @__PURE__ */ e(le, {}) : h.element
2663
2654
  },
2664
2655
  `route-${h.path}`
2665
2656
  )),
@@ -2684,16 +2675,16 @@ function At(t) {
2684
2675
  return /* @__PURE__ */ e(Ee, { i18n: a, children: /* @__PURE__ */ e(Nt, { ...t }) });
2685
2676
  }
2686
2677
  function Nt({ extraPages: t, disabledPages: a = [] }) {
2687
- const { app: o, i18n: u } = he(), { t: g, i18n: p } = Y(["admin", "translation"]), [_, N] = x(!1), [v, O] = x(!0), [T, I] = x(!1);
2678
+ const { app: o, i18n: u } = he(), { t: g, i18n: p } = Y(["admin", "translation"]), [_, N] = x(!1), [v, $] = x(!0), [T, I] = x(!1);
2688
2679
  G(() => {
2689
2680
  u?.resources && Object.entries(u.resources).forEach(([k, U]) => {
2690
- Object.entries(U).forEach(([E, y]) => {
2691
- p.addResourceBundle(k, E, y, !0, !0);
2681
+ Object.entries(U).forEach(([O, y]) => {
2682
+ p.addResourceBundle(k, O, y, !0, !0);
2692
2683
  });
2693
2684
  }), !localStorage.getItem("gentiq-admin-language") && o?.language && p.language !== o.language && p.changeLanguage(o.language), I(!0);
2694
2685
  }, [u?.resources, p, o?.language]), G(() => {
2695
2686
  const q = w.getToken();
2696
- return N(!!q), O(!1), document.body.classList.add("admin-theme-root"), () => {
2687
+ return N(!!q), $(!1), document.body.classList.add("admin-theme-root"), () => {
2697
2688
  document.body.classList.remove("admin-theme-root");
2698
2689
  };
2699
2690
  }, []), G(() => {
@@ -2724,7 +2715,7 @@ function It() {
2724
2715
  mutationFn: (N) => w.deleteUser(N),
2725
2716
  onSuccess: a
2726
2717
  }), p = ee({
2727
- mutationFn: ({ userId: N, tokens: v, requests: O }) => w.updateUserBalance(N, v, O),
2718
+ mutationFn: ({ userId: N, tokens: v, requests: $ }) => w.updateUserBalance(N, v, $),
2728
2719
  onSuccess: a
2729
2720
  }), _ = ee({
2730
2721
  mutationFn: (N) => w.refreshUserToken(N)