gentiq 0.7.20 → 0.7.21

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,21 +1,21 @@
1
- import { jsx as e, jsxs as t, Fragment as De } from "react/jsx-runtime";
2
- import { useState as f, useEffect as W, useMemo as ie, useRef as Ae } from "react";
1
+ import { jsx as e, jsxs as r, Fragment as De } from "react/jsx-runtime";
2
+ import { useState as x, useEffect as G, useMemo as ue, useRef as Me } from "react";
3
3
  import $e from "i18next";
4
- import { useTranslation as Q, initReactI18next as Oe, I18nextProvider as Ee } from "react-i18next";
5
- import { a as le, l as we, t as Me, m as ke, S as ce, p as me, q as ue, e as xe, r as he, s as ne, 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 We, B as oe, L as Z, I as de, a0 as _e, h as be, i as ve, k as ye, w as Ve, x as Ke, y as Ze, z as Ge, a1 as Qe, d as Xe, T as Ye } from "./checkbox-Bur5BJ4z.js";
6
- import { useNavigate as et, useLocation as tt, Routes as rt, Route as te, Navigate as Se } from "react-router-dom";
7
- import { Share2 as st, RefreshCcw as Ce, Globe as fe, Keyboard as at, Languages as nt, Plus as ot, Hash as it, ShieldAlert as lt, Monitor as Le, Moon as dt, Sun as ct, LogOut as mt } from "lucide-react";
8
- import { toast as Te } from "sonner";
9
- import * as qe from "@radix-ui/react-switch";
10
- import { useQuery as se, useQueryClient as Ne, useMutation as X } from "@tanstack/react-query";
11
- const je = "/api";
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";
6
+ import { useNavigate as et, useLocation as tt, Routes as rt, Route as se, Navigate as Ce } from "react-router-dom";
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
+ import { toast as qe } from "sonner";
9
+ import * as je from "@radix-ui/react-switch";
10
+ import { useQuery as de, useQueryClient as _e, useMutation as ee } from "@tanstack/react-query";
11
+ const Ae = "/api";
12
12
  class ut {
13
13
  token = null;
14
14
  constructor() {
15
15
  this.token = localStorage.getItem("admin_token");
16
16
  }
17
- setToken(n) {
18
- this.token = n, localStorage.setItem("admin_token", n);
17
+ setToken(a) {
18
+ this.token = a, localStorage.setItem("admin_token", a);
19
19
  }
20
20
  clearToken() {
21
21
  this.token = null, localStorage.removeItem("admin_token"), localStorage.removeItem("admin_info");
@@ -23,12 +23,12 @@ class ut {
23
23
  getToken() {
24
24
  return this.token;
25
25
  }
26
- async request(n, i = {}) {
27
- const c = new Headers(i.headers);
28
- c.has("Content-Type") || c.set("Content-Type", "application/json"), this.token && c.set("Authorization", `Bearer ${this.token}`);
29
- const g = await fetch(`${je}${n}`, {
30
- ...i,
31
- headers: c
26
+ async request(a, o = {}) {
27
+ const u = new Headers(o.headers);
28
+ u.has("Content-Type") || u.set("Content-Type", "application/json"), this.token && u.set("Authorization", `Bearer ${this.token}`);
29
+ const g = await fetch(`${Ae}${a}`, {
30
+ ...o,
31
+ headers: u
32
32
  });
33
33
  if (!g.ok) {
34
34
  const p = await g.json().catch(() => ({ error: "Request failed" }));
@@ -36,115 +36,115 @@ class ut {
36
36
  }
37
37
  return g.json();
38
38
  }
39
- async login(n, i) {
40
- const c = await this.request("/admin/login", {
39
+ async login(a, o) {
40
+ const u = await this.request("/admin/login", {
41
41
  method: "POST",
42
- body: JSON.stringify({ username: n, password: i })
42
+ body: JSON.stringify({ username: a, password: o })
43
43
  });
44
- this.setToken(c.token);
44
+ this.setToken(u.token);
45
45
  const g = {
46
- admin_id: c.admin_id,
47
- username: c.username,
48
- name: c.name,
49
- permissions: c.permissions
46
+ admin_id: u.admin_id,
47
+ username: u.username,
48
+ name: u.name,
49
+ permissions: u.permissions
50
50
  };
51
- return localStorage.setItem("admin_info", JSON.stringify(g)), c;
51
+ return localStorage.setItem("admin_info", JSON.stringify(g)), u;
52
52
  }
53
53
  async checkSetupStatus() {
54
54
  return this.request("/admin/setup-status");
55
55
  }
56
- async register(n, i, c, g) {
56
+ async register(a, o, u, g) {
57
57
  return this.request("/admin/admins", {
58
58
  method: "POST",
59
- body: JSON.stringify({ username: n, password: i, name: c, permissions: g })
59
+ body: JSON.stringify({ username: a, password: o, name: u, permissions: g })
60
60
  });
61
61
  }
62
62
  async listAdmins() {
63
63
  return this.request("/admin/admins");
64
64
  }
65
- async updateAdmin(n, i) {
66
- return this.request(`/admin/admins/${n}`, {
65
+ async updateAdmin(a, o) {
66
+ return this.request(`/admin/admins/${a}`, {
67
67
  method: "PATCH",
68
- body: JSON.stringify(i)
68
+ body: JSON.stringify(o)
69
69
  });
70
70
  }
71
- async deleteAdmin(n) {
72
- return this.request(`/admin/admins/${n}`, {
71
+ async deleteAdmin(a) {
72
+ return this.request(`/admin/admins/${a}`, {
73
73
  method: "DELETE"
74
74
  });
75
75
  }
76
76
  async listPermissions() {
77
77
  return this.request("/admin/permissions");
78
78
  }
79
- async listThreads(n = 0, i = 50, c, g) {
80
- const p = new URLSearchParams({ skip: n.toString(), limit: i.toString() });
81
- return c && p.append("query", c), g && p.append("feedback", g), this.request(`/admin/chat-history/threads?${p}`);
79
+ async listThreads(a = 0, o = 50, u, g) {
80
+ const p = new URLSearchParams({ skip: a.toString(), limit: o.toString() });
81
+ return u && p.append("query", u), g && p.append("feedback", g), this.request(`/admin/chat-history/threads?${p}`);
82
82
  }
83
- async getThreadItems(n) {
84
- return this.request(`/admin/chat-history/threads/${n}/items`);
83
+ async getThreadItems(a) {
84
+ return this.request(`/admin/chat-history/threads/${a}/items`);
85
85
  }
86
- async shareThread(n) {
87
- return this.request(`/admin/chat-history/threads/${n}/share`, {
86
+ async shareThread(a) {
87
+ return this.request(`/admin/chat-history/threads/${a}/share`, {
88
88
  method: "POST"
89
89
  });
90
90
  }
91
- async listUsers(n = 0, i = 100, c = "") {
92
- const g = new URLSearchParams({ skip: n.toString(), limit: i.toString() });
93
- return c && g.append("query", c), this.request(`/admin/users?${g.toString()}`);
91
+ async listUsers(a = 0, o = 100, u = "") {
92
+ const g = new URLSearchParams({ skip: a.toString(), limit: o.toString() });
93
+ return u && g.append("query", u), this.request(`/admin/users?${g.toString()}`);
94
94
  }
95
- async createUser(n, i, c, g, p, w, b, v) {
96
- const D = g !== void 0 || p !== void 0 || w !== void 0 || b !== void 0 ? {
95
+ async createUser(a, o, u, g, p, _, N, v) {
96
+ const O = g !== void 0 || p !== void 0 || _ !== void 0 || N !== void 0 ? {
97
97
  tokens: g || 0,
98
98
  requests: p || 0,
99
- token_limit: w || g || 0,
100
- request_limit: b || p || 0
99
+ token_limit: _ || g || 0,
100
+ request_limit: N || p || 0
101
101
  } : void 0;
102
102
  return this.request("/admin/users", {
103
103
  method: "POST",
104
- body: JSON.stringify({ phone: n, name: i, surname: c, balance: D, metadata: v })
104
+ body: JSON.stringify({ phone: a, name: o, surname: u, balance: O, metadata: v })
105
105
  });
106
106
  }
107
- async updateUser(n, i) {
108
- return this.request(`/admin/users/${n}`, {
107
+ async updateUser(a, o) {
108
+ return this.request(`/admin/users/${a}`, {
109
109
  method: "PATCH",
110
- body: JSON.stringify(i)
110
+ body: JSON.stringify(o)
111
111
  });
112
112
  }
113
- async deleteUser(n) {
114
- return this.request(`/admin/users/${n}`, {
113
+ async deleteUser(a) {
114
+ return this.request(`/admin/users/${a}`, {
115
115
  method: "DELETE"
116
116
  });
117
117
  }
118
- async updateUserBalance(n, i, c, g, p) {
119
- return this.request(`/admin/users/${n}/balance`, {
118
+ async updateUserBalance(a, o, u, g, p) {
119
+ return this.request(`/admin/users/${a}/balance`, {
120
120
  method: "POST",
121
- body: JSON.stringify({ tokens: i, requests: c, token_limit: g, request_limit: p })
121
+ body: JSON.stringify({ tokens: o, requests: u, token_limit: g, request_limit: p })
122
122
  });
123
123
  }
124
- async refreshUserToken(n) {
125
- return this.request(`/admin/users/${n}/refresh-token`, {
124
+ async refreshUserToken(a) {
125
+ return this.request(`/admin/users/${a}/refresh-token`, {
126
126
  method: "POST"
127
127
  });
128
128
  }
129
- async getAnalytics(n = 30) {
130
- return this.request(`/admin/analytics?days=${n}`);
129
+ async getAnalytics(a = 30) {
130
+ return this.request(`/admin/analytics?days=${a}`);
131
131
  }
132
- async listJobs(n = 20, i) {
133
- const c = new URLSearchParams({ limit: n.toString() });
134
- return i && c.append("type", i), this.request(`/admin/jobs?${c}`);
132
+ async listJobs(a = 20, o) {
133
+ const u = new URLSearchParams({ limit: a.toString() });
134
+ return o && u.append("type", o), this.request(`/admin/jobs?${u}`);
135
135
  }
136
- async cancelJob(n) {
137
- return this.request(`/admin/jobs/${n}/cancel`, {
136
+ async cancelJob(a) {
137
+ return this.request(`/admin/jobs/${a}/cancel`, {
138
138
  method: "POST"
139
139
  });
140
140
  }
141
141
  async getSettings() {
142
142
  return this.request("/admin/settings");
143
143
  }
144
- async updateSettings(n) {
144
+ async updateSettings(a) {
145
145
  return this.request("/admin/settings", {
146
146
  method: "PATCH",
147
- body: JSON.stringify(n)
147
+ body: JSON.stringify(a)
148
148
  });
149
149
  }
150
150
  async resetSettings() {
@@ -152,83 +152,83 @@ class ut {
152
152
  method: "DELETE"
153
153
  });
154
154
  }
155
- async getAttachmentBlob(n) {
156
- const i = {};
157
- this.token && (i.Authorization = `Bearer ${this.token}`);
158
- const c = await fetch(`${je}/admin/chat-history/attachments/${n}`, {
155
+ async getAttachmentBlob(a) {
156
+ const o = {};
157
+ this.token && (o.Authorization = `Bearer ${this.token}`);
158
+ const u = await fetch(`${Ae}/admin/chat-history/attachments/${a}`, {
159
159
  method: "GET",
160
- headers: i
160
+ headers: o
161
161
  });
162
- if (!c.ok) {
163
- const g = await c.json().catch(() => ({ error: "Request failed" }));
164
- throw new Error(g.error || `HTTP ${c.status}`);
162
+ if (!u.ok) {
163
+ const g = await u.json().catch(() => ({ error: "Request failed" }));
164
+ throw new Error(g.error || `HTTP ${u.status}`);
165
165
  }
166
- return c.blob();
166
+ return u.blob();
167
167
  }
168
168
  }
169
- const y = new ut();
170
- function ht({ onLoginSuccess: r }) {
171
- const { t: n, i18n: i } = Q(["admin", "translation"]), { app: c } = le(), { theme: g } = we(), [p, w] = f(""), [b, v] = f(""), [D, T] = f(""), [$, q] = f(""), [C, _] = f(!1), [R, A] = f(null), [N, I] = f("light");
172
- W(() => {
169
+ const w = new ut();
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");
172
+ G(() => {
173
173
  if (g === "system") {
174
174
  const h = window.matchMedia("(prefers-color-scheme: dark)").matches;
175
- I(h ? "dark" : "light");
175
+ D(h ? "dark" : "light");
176
176
  } else
177
- I(g);
177
+ D(g);
178
178
  }, [g]);
179
- const E = ie(() => c?.logo ? typeof c.logo == "string" ? c.logo : N === "dark" ? c.logo.dark : c.logo.light : Me, [c?.logo, N]), H = c?.adminTitle || c?.name, B = i.language === "fa";
180
- W(() => {
181
- y.checkSetupStatus().then((h) => A(h.needs_setup)).catch(() => A(!1));
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";
180
+ G(() => {
181
+ w.checkSetupStatus().then((h) => E(h.needs_setup)).catch(() => E(!1));
182
182
  }, []);
183
- const J = async (h) => {
184
- h.preventDefault(), q(""), _(!0);
183
+ const B = async (h) => {
184
+ h.preventDefault(), A(""), k(!0);
185
185
  try {
186
- await y.login(p, b), r();
186
+ await w.login(p, N), t();
187
187
  } catch (F) {
188
- q(F instanceof Error ? F.message : n("login.error"));
188
+ A(F instanceof Error ? F.message : a("login.error"));
189
189
  } finally {
190
- _(!1);
190
+ k(!1);
191
191
  }
192
- }, z = async (h) => {
193
- if (h.preventDefault(), q(""), b !== D) {
194
- q(n("login.passwords_mismatch"));
192
+ }, J = async (h) => {
193
+ if (h.preventDefault(), A(""), N !== O) {
194
+ A(a("login.passwords_mismatch"));
195
195
  return;
196
196
  }
197
- if (b.length < 4) {
198
- q(n("login.password_too_short"));
197
+ if (N.length < 4) {
198
+ A(a("login.password_too_short"));
199
199
  return;
200
200
  }
201
- _(!0);
201
+ k(!0);
202
202
  try {
203
- await y.register(
203
+ await w.register(
204
204
  "admin",
205
- b,
205
+ N,
206
206
  "Admin",
207
207
  ["chat_history", "admin_management", "user_management", "analytics"]
208
- ), await y.login("admin", b), r();
208
+ ), await w.login("admin", N), t();
209
209
  } catch (F) {
210
- q(F instanceof Error ? F.message : n("login.error"));
210
+ A(F instanceof Error ? F.message : a("login.error"));
211
211
  } finally {
212
- _(!1);
212
+ k(!1);
213
213
  }
214
214
  };
215
- return R === null ? /* @__PURE__ */ e("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "w-6 h-6 border-2 border-border border-t-primary rounded-full animate-spin" }) }) : /* @__PURE__ */ t("div", { className: "min-h-screen bg-background flex items-center justify-center p-4 relative overflow-hidden", dir: B ? "rtl" : "ltr", children: [
215
+ return U === null ? /* @__PURE__ */ e("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "w-6 h-6 border-2 border-border border-t-primary rounded-full animate-spin" }) }) : /* @__PURE__ */ r("div", { className: "min-h-screen bg-background flex items-center justify-center p-4 relative overflow-hidden", dir: K ? "rtl" : "ltr", children: [
216
216
  /* @__PURE__ */ e("div", { className: "absolute top-[-10%] right-[-10%] w-[50%] h-[50%] bg-primary/10 rounded-full blur-3xl animate-pulse" }),
217
217
  /* @__PURE__ */ e("div", { className: "absolute bottom-[-10%] left-[-10%] w-[40%] h-[40%] bg-primary/5 dark:bg-primary/10 rounded-full blur-3xl" }),
218
- /* @__PURE__ */ t("div", { className: "w-full max-w-md z-10", children: [
219
- /* @__PURE__ */ t("div", { className: "glass rounded-3xl p-10 shadow-2xl", children: [
220
- /* @__PURE__ */ t("div", { className: "text-center mb-10", children: [
221
- /* @__PURE__ */ t("div", { className: "flex flex-col items-center gap-4 mb-6", children: [
222
- /* @__PURE__ */ e("img", { src: E, alt: H, 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: R ? n("login.setup_title") : H })
218
+ /* @__PURE__ */ r("div", { className: "w-full max-w-md z-10", children: [
219
+ /* @__PURE__ */ r("div", { className: "glass rounded-3xl p-10 shadow-2xl", children: [
220
+ /* @__PURE__ */ r("div", { className: "text-center mb-10", children: [
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 })
224
224
  ] }),
225
- R && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mt-3", children: n("login.setup_description") })
225
+ U && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mt-3", children: a("login.setup_description") })
226
226
  ] }),
227
- R ? (
227
+ U ? (
228
228
  /* ---- SETUP FORM ---- */
229
- /* @__PURE__ */ t("form", { onSubmit: z, className: "space-y-7", children: [
230
- /* @__PURE__ */ t("div", { children: [
231
- /* @__PURE__ */ e("label", { className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: n("login.username") }),
229
+ /* @__PURE__ */ r("form", { onSubmit: J, className: "space-y-7", children: [
230
+ /* @__PURE__ */ r("div", { children: [
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(
233
233
  "input",
234
234
  {
@@ -239,160 +239,160 @@ function ht({ onLoginSuccess: r }) {
239
239
  }
240
240
  )
241
241
  ] }),
242
- /* @__PURE__ */ t("div", { children: [
243
- /* @__PURE__ */ e("label", { htmlFor: "setup-password", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: n("login.set_password") }),
242
+ /* @__PURE__ */ r("div", { children: [
243
+ /* @__PURE__ */ e("label", { htmlFor: "setup-password", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: a("login.set_password") }),
244
244
  /* @__PURE__ */ e(
245
245
  "input",
246
246
  {
247
247
  id: "setup-password",
248
248
  type: "password",
249
- value: b,
249
+ value: N,
250
250
  onChange: (h) => v(h.target.value),
251
251
  required: !0,
252
252
  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",
253
- placeholder: n("login.set_password_placeholder"),
253
+ placeholder: a("login.set_password_placeholder"),
254
254
  dir: "ltr"
255
255
  }
256
256
  )
257
257
  ] }),
258
- /* @__PURE__ */ t("div", { children: [
259
- /* @__PURE__ */ e("label", { htmlFor: "setup-confirm", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: n("login.confirm_password") }),
258
+ /* @__PURE__ */ r("div", { children: [
259
+ /* @__PURE__ */ e("label", { htmlFor: "setup-confirm", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: a("login.confirm_password") }),
260
260
  /* @__PURE__ */ e(
261
261
  "input",
262
262
  {
263
263
  id: "setup-confirm",
264
264
  type: "password",
265
- value: D,
265
+ value: O,
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",
269
- placeholder: n("login.confirm_password_placeholder"),
269
+ placeholder: a("login.confirm_password_placeholder"),
270
270
  dir: "ltr"
271
271
  }
272
272
  )
273
273
  ] }),
274
- $ && /* @__PURE__ */ e("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3.5 rounded-2xl text-xs backdrop-blur-sm", children: $ }),
274
+ I && /* @__PURE__ */ e("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3.5 rounded-2xl text-xs backdrop-blur-sm", children: I }),
275
275
  /* @__PURE__ */ e(
276
276
  "button",
277
277
  {
278
278
  type: "submit",
279
- disabled: C,
279
+ disabled: q,
280
280
  className: "w-full bg-primary text-primary-foreground font-bold py-4 px-6 rounded-2xl hover:opacity-90 transition-all text-sm shadow-lg hover:shadow-xl disabled:opacity-50 active:scale-[0.98]",
281
- children: C ? /* @__PURE__ */ t("div", { className: "flex items-center justify-center gap-2", children: [
281
+ children: q ? /* @__PURE__ */ r("div", { className: "flex items-center justify-center gap-2", children: [
282
282
  /* @__PURE__ */ e("div", { className: "w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin" }),
283
- /* @__PURE__ */ e("span", { children: n("login.setting_up") })
284
- ] }) : n("login.create_admin")
283
+ /* @__PURE__ */ e("span", { children: a("login.setting_up") })
284
+ ] }) : a("login.create_admin")
285
285
  }
286
286
  )
287
287
  ] })
288
288
  ) : (
289
289
  /* ---- LOGIN FORM ---- */
290
- /* @__PURE__ */ t("form", { onSubmit: J, className: "space-y-7", children: [
291
- /* @__PURE__ */ t("div", { children: [
292
- /* @__PURE__ */ e("label", { htmlFor: "username", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: n("login.username") }),
290
+ /* @__PURE__ */ r("form", { onSubmit: B, className: "space-y-7", children: [
291
+ /* @__PURE__ */ r("div", { children: [
292
+ /* @__PURE__ */ e("label", { htmlFor: "username", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: a("login.username") }),
293
293
  /* @__PURE__ */ e(
294
294
  "input",
295
295
  {
296
296
  id: "username",
297
297
  type: "text",
298
298
  value: p,
299
- onChange: (h) => w(h.target.value),
299
+ onChange: (h) => _(h.target.value),
300
300
  required: !0,
301
301
  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",
302
- placeholder: n("login.username_placeholder"),
302
+ placeholder: a("login.username_placeholder"),
303
303
  dir: "ltr"
304
304
  }
305
305
  )
306
306
  ] }),
307
- /* @__PURE__ */ t("div", { children: [
308
- /* @__PURE__ */ e("label", { htmlFor: "password", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: n("login.password") }),
307
+ /* @__PURE__ */ r("div", { children: [
308
+ /* @__PURE__ */ e("label", { htmlFor: "password", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: a("login.password") }),
309
309
  /* @__PURE__ */ e(
310
310
  "input",
311
311
  {
312
312
  id: "password",
313
313
  type: "password",
314
- value: b,
314
+ value: N,
315
315
  onChange: (h) => v(h.target.value),
316
316
  required: !0,
317
317
  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",
318
- placeholder: n("login.password_placeholder"),
318
+ placeholder: a("login.password_placeholder"),
319
319
  dir: "ltr"
320
320
  }
321
321
  )
322
322
  ] }),
323
- $ && /* @__PURE__ */ e("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3.5 rounded-2xl text-xs backdrop-blur-sm", children: $ }),
323
+ I && /* @__PURE__ */ e("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3.5 rounded-2xl text-xs backdrop-blur-sm", children: I }),
324
324
  /* @__PURE__ */ e(
325
325
  "button",
326
326
  {
327
327
  type: "submit",
328
- disabled: C,
328
+ disabled: q,
329
329
  className: "w-full bg-primary text-primary-foreground font-bold py-4 px-6 rounded-2xl hover:opacity-90 transition-all text-sm shadow-lg hover:shadow-xl disabled:opacity-50 active:scale-[0.98]",
330
- children: C ? /* @__PURE__ */ t("div", { className: "flex items-center justify-center gap-2", children: [
330
+ children: q ? /* @__PURE__ */ r("div", { className: "flex items-center justify-center gap-2", children: [
331
331
  /* @__PURE__ */ e("div", { className: "w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin" }),
332
- /* @__PURE__ */ e("span", { children: n("login.logging_in") })
333
- ] }) : n("login.submit")
332
+ /* @__PURE__ */ e("span", { children: a("login.logging_in") })
333
+ ] }) : a("login.submit")
334
334
  }
335
335
  )
336
336
  ] })
337
337
  )
338
338
  ] }),
339
- /* @__PURE__ */ e("div", { className: "mt-10 text-center text-[10px] text-muted-foreground uppercase tracking-widest font-bold", children: /* @__PURE__ */ e("p", { children: n("login.copyright") }) })
339
+ /* @__PURE__ */ e("div", { className: "mt-10 text-center text-[10px] text-muted-foreground uppercase tracking-widest font-bold", children: /* @__PURE__ */ e("p", { children: a("login.copyright") }) })
340
340
  ] })
341
341
  ] });
342
342
  }
343
343
  function pt() {
344
- const { t: r, i18n: n } = Q(["admin", "translation"]), [i, c] = f([]), [g, p] = f(null), [w, b] = f([]), [v, D] = f(!1), [T, $] = f(!1), [q, C] = f(""), [_, R] = f(""), [A, N] = f(""), [I, E] = f(0), [H, B] = f(!0), J = n.language === "fa", z = J ? "fa-IR" : "en-US", h = async (s = !1) => {
345
- s ? $(!0) : (D(!0), E(0)), C("");
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("");
346
346
  try {
347
- const x = s ? I + 50 : 0, L = await y.listThreads(
348
- x,
347
+ const b = s ? D + 50 : 0, S = await w.listThreads(
348
+ b,
349
349
  50,
350
- _ || void 0,
351
- A || void 0
350
+ k || void 0,
351
+ E || void 0
352
352
  );
353
- s ? (c((P) => [...P, ...L.threads]), E(x)) : (c(L.threads), E(0)), B(L.threads.length === 50);
354
- } catch (x) {
355
- C(x instanceof Error ? x.message : r("error_loading"));
353
+ s ? (u((H) => [...H, ...S.threads]), $(b)) : (u(S.threads), $(0)), K(S.threads.length === 50);
354
+ } catch (b) {
355
+ q(b instanceof Error ? b.message : t("error_loading"));
356
356
  } finally {
357
- D(!1), $(!1);
357
+ O(!1), I(!1);
358
358
  }
359
359
  }, F = async (s) => {
360
- p(s), D(!0), C("");
360
+ p(s), O(!0), q("");
361
361
  try {
362
- const x = await y.getThreadItems(s.id);
363
- b(x.items);
364
- } catch (x) {
365
- C(x instanceof Error ? x.message : r("error_loading"));
362
+ const b = await w.getThreadItems(s.id);
363
+ N(b.items);
364
+ } catch (b) {
365
+ q(b instanceof Error ? b.message : t("error_loading"));
366
366
  } finally {
367
- D(!1);
367
+ O(!1);
368
368
  }
369
- }, l = async (s, x) => {
369
+ }, l = async (s, b) => {
370
370
  s.stopPropagation();
371
371
  try {
372
- const L = await y.shareThread(x.id), P = `${window.location.origin}${L.url}`;
373
- navigator.clipboard.writeText(P), Te.success(r("sidebar.share_success"), {
374
- description: r("sidebar.share_description")
372
+ const S = await w.shareThread(b.id), H = `${window.location.origin}${S.url}`;
373
+ navigator.clipboard.writeText(H), qe.success(t("sidebar.share_success"), {
374
+ description: t("sidebar.share_description")
375
375
  });
376
376
  } catch {
377
- Te.error(r("sidebar.share_failed"));
377
+ qe.error(t("sidebar.share_failed"));
378
378
  }
379
379
  };
380
- W(() => {
380
+ G(() => {
381
381
  const s = setTimeout(() => {
382
382
  h();
383
383
  }, 500);
384
384
  return () => clearTimeout(s);
385
- }, [_, A]);
386
- const a = (s) => {
387
- const x = new Date(s);
388
- return new Intl.DateTimeFormat(J ? "fa-IR" : "en-US", {
385
+ }, [k, E]);
386
+ const d = (s) => {
387
+ const b = new Date(s);
388
+ return new Intl.DateTimeFormat(B ? "fa-IR" : "en-US", {
389
389
  year: "numeric",
390
390
  month: "long",
391
391
  day: "numeric",
392
392
  hour: "2-digit",
393
393
  minute: "2-digit"
394
- }).format(x);
395
- }, u = (s) => {
394
+ }).format(b);
395
+ }, i = (s) => {
396
396
  if (typeof s == "string")
397
397
  try {
398
398
  return JSON.stringify(JSON.parse(s), null, 2);
@@ -400,20 +400,20 @@ function pt() {
400
400
  return s;
401
401
  }
402
402
  return JSON.stringify(s, null, 2);
403
- }, k = ({ part: s, idx: x }) => {
404
- const [L, P] = f(!1), d = s.tool_name || (s.type && s.type.startsWith("tool-") ? s.type.slice(5) : "tool");
405
- return /* @__PURE__ */ t("div", { dir: "ltr", className: "my-2 border border-border/50 rounded-xl overflow-hidden bg-muted/20 text-left", children: [
406
- /* @__PURE__ */ t(
403
+ }, f = ({ part: s, idx: b }) => {
404
+ const [S, H] = x(!1), V = s.tool_name || (s.type && s.type.startsWith("tool-") ? s.type.slice(5) : "tool");
405
+ return /* @__PURE__ */ r("div", { dir: "ltr", className: "my-2 border border-border/50 rounded-xl overflow-hidden bg-muted/20 text-left", children: [
406
+ /* @__PURE__ */ r(
407
407
  "div",
408
408
  {
409
- onClick: () => P(!L),
409
+ onClick: () => H(!S),
410
410
  className: "px-2.5 py-1.5 bg-muted/50 border-b border-border/50 flex items-center justify-between cursor-pointer hover:bg-accent transition-colors",
411
411
  children: [
412
- /* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
412
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
413
413
  /* @__PURE__ */ e(
414
414
  "svg",
415
415
  {
416
- className: `w-3 h-3 text-gray-400 transition-transform ${L ? "rotate-180" : ""}`,
416
+ className: `w-3 h-3 text-gray-400 transition-transform ${S ? "rotate-180" : ""}`,
417
417
  fill: "none",
418
418
  viewBox: "0 0 24 24",
419
419
  stroke: "currentColor",
@@ -421,38 +421,38 @@ function pt() {
421
421
  }
422
422
  ),
423
423
  /* @__PURE__ */ e("span", { className: "text-[10px] font-bold uppercase tracking-widest text-muted-foreground", children: "Tool" }),
424
- /* @__PURE__ */ e("span", { className: "text-xs font-semibold", children: d })
424
+ /* @__PURE__ */ e("span", { className: "text-xs font-semibold", children: V })
425
425
  ] }),
426
- /* @__PURE__ */ e("span", { className: `text-[10px] px-2 py-0.5 rounded-full ${s.state === "output-available" ? "bg-primary/10 text-primary" : "bg-muted text-muted-foreground"}`, children: s.state === "output-available" ? r("chat_history.output_available") : r("chat_history.running") })
426
+ /* @__PURE__ */ e("span", { className: `text-[10px] px-2 py-0.5 rounded-full ${s.state === "output-available" ? "bg-primary/10 text-primary" : "bg-muted text-muted-foreground"}`, children: s.state === "output-available" ? t("chat_history.output_available") : t("chat_history.running") })
427
427
  ]
428
428
  }
429
429
  ),
430
- L && /* @__PURE__ */ t("div", { className: "p-2.5 space-y-2.5 animate-in fade-in slide-in-from-top-1 duration-200", children: [
431
- /* @__PURE__ */ t("div", { children: [
430
+ S && /* @__PURE__ */ r("div", { className: "p-2.5 space-y-2.5 animate-in fade-in slide-in-from-top-1 duration-200", children: [
431
+ /* @__PURE__ */ r("div", { children: [
432
432
  /* @__PURE__ */ e("div", { className: "text-[10px] uppercase font-bold text-muted-foreground mb-1", children: "Input" }),
433
- /* @__PURE__ */ e("pre", { className: "text-xs bg-black/5 dark:bg-black/20 p-2 rounded-lg overflow-x-auto", children: u(s.input) })
433
+ /* @__PURE__ */ e("pre", { className: "text-xs bg-black/5 dark:bg-black/20 p-2 rounded-lg overflow-x-auto", children: i(s.input) })
434
434
  ] }),
435
- (s.output || s.error_text || s.errorText) && /* @__PURE__ */ t("div", { children: [
435
+ (s.output || s.error_text || s.errorText) && /* @__PURE__ */ r("div", { children: [
436
436
  /* @__PURE__ */ e("div", { className: "text-[10px] uppercase font-bold text-muted-foreground mb-1", children: s.error_text || s.errorText ? "Error" : "Output" }),
437
- /* @__PURE__ */ e("pre", { className: `text-xs p-2 rounded-lg overflow-x-auto ${s.error_text || s.errorText ? "bg-destructive/10 text-destructive" : "bg-primary/5 text-foreground/80"}`, children: u(s.output || s.error_text || s.errorText) })
437
+ /* @__PURE__ */ e("pre", { className: `text-xs p-2 rounded-lg overflow-x-auto ${s.error_text || s.errorText ? "bg-destructive/10 text-destructive" : "bg-primary/5 text-foreground/80"}`, children: i(s.output || s.error_text || s.errorText) })
438
438
  ] })
439
439
  ] })
440
- ] }, x);
441
- }, m = async (s, x) => {
440
+ ] }, b);
441
+ }, m = async (s, b) => {
442
442
  try {
443
- const L = await y.getAttachmentBlob(s), P = window.URL.createObjectURL(L), d = document.createElement("a");
444
- d.href = P, d.download = x || s.split("/").pop() || "download", document.body.appendChild(d), d.click(), window.URL.revokeObjectURL(P), document.body.removeChild(d);
445
- } catch (L) {
446
- console.error("Download failed:", L), C(L instanceof Error ? L.message : "Download failed");
443
+ const S = await w.getAttachmentBlob(s), H = window.URL.createObjectURL(S), V = document.createElement("a");
444
+ V.href = H, V.download = b || s.split("/").pop() || "download", document.body.appendChild(V), V.click(), window.URL.revokeObjectURL(H), document.body.removeChild(V);
445
+ } catch (S) {
446
+ console.error("Download failed:", S), q(S instanceof Error ? S.message : "Download failed");
447
447
  }
448
- }, j = (s, x) => typeof s == "string" ? /* @__PURE__ */ e("div", { children: s }, x) : s.type === "text" ? /* @__PURE__ */ e("div", { className: "whitespace-pre-wrap", dir: "auto", children: s.text }, x) : s.type === "reasoning" ? /* @__PURE__ */ t("div", { className: "my-2 p-2.5 bg-muted/40 rounded-lg border border-border text-xs italic text-muted-foreground", dir: "auto", children: [
448
+ }, j = (s, b) => typeof s == "string" ? /* @__PURE__ */ e("div", { children: s }, b) : s.type === "text" ? /* @__PURE__ */ e("div", { className: "whitespace-pre-wrap", dir: "auto", children: s.text }, b) : s.type === "reasoning" ? /* @__PURE__ */ r("div", { className: "my-2 p-2.5 bg-muted/40 rounded-lg border border-border text-xs italic text-muted-foreground", dir: "auto", children: [
449
449
  /* @__PURE__ */ e("div", { className: "font-bold mb-1 uppercase tracking-tighter opacity-70", children: "Reasoning" }),
450
450
  s.text
451
- ] }, x) : s.type === "dynamic-tool" || s.type && s.type.startsWith("tool-") || s.tool_call_id ? /* @__PURE__ */ e(k, { part: s, idx: x }, x) : s.type === "file" ? /* @__PURE__ */ t("div", { className: "my-2 flex items-center justify-between p-2.5 bg-muted/40 rounded-xl border border-border group hover:border-primary/30 transition-all", children: [
452
- /* @__PURE__ */ t("div", { className: "flex items-center gap-3 overflow-hidden", children: [
451
+ ] }, b) : s.type === "dynamic-tool" || s.type && s.type.startsWith("tool-") || s.tool_call_id ? /* @__PURE__ */ e(f, { part: s, idx: b }, b) : s.type === "file" ? /* @__PURE__ */ r("div", { className: "my-2 flex items-center justify-between p-2.5 bg-muted/40 rounded-xl border border-border group hover:border-primary/30 transition-all", children: [
452
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-3 overflow-hidden", children: [
453
453
  /* @__PURE__ */ e("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center bg-primary/10 rounded-lg text-primary", children: /* @__PURE__ */ e("span", { className: "text-xl", children: "📎" }) }),
454
- /* @__PURE__ */ t("div", { className: "flex flex-col min-w-0", children: [
455
- /* @__PURE__ */ e("span", { className: "text-sm text-foreground font-medium truncate", title: s.filename || "File", children: s.filename || r("chat_history.unnamed_file") }),
454
+ /* @__PURE__ */ r("div", { className: "flex flex-col min-w-0", children: [
455
+ /* @__PURE__ */ e("span", { className: "text-sm text-foreground font-medium truncate", title: s.filename || "File", children: s.filename || t("chat_history.unnamed_file") }),
456
456
  /* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground uppercase tracking-wider font-bold", children: s.media_type || s.mime_type || s.mediaType || "file" })
457
457
  ] })
458
458
  ] }),
@@ -461,20 +461,20 @@ function pt() {
461
461
  {
462
462
  onClick: () => m(s.object_name, s.filename),
463
463
  className: "flex-shrink-0 p-2 hover:bg-card rounded-lg border border-transparent hover:border-border transition-all text-muted-foreground hover:text-primary",
464
- title: r("chat_history.download_file", "Download File"),
464
+ title: t("chat_history.download_file", "Download File"),
465
465
  children: /* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" }) })
466
466
  }
467
467
  )
468
- ] }, x) : /* @__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) }, x), M = (s) => {
469
- const { scrollTop: x, scrollHeight: L, clientHeight: P } = s.currentTarget;
470
- L - x <= P + 50 && !T && H && h(!0);
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
+ const { scrollTop: b, scrollHeight: S, clientHeight: H } = s.currentTarget;
470
+ S - b <= H + 50 && !T && P && h(!0);
471
471
  };
472
- return /* @__PURE__ */ t("div", { className: "p-5 h-full flex flex-col gap-4 overflow-hidden", dir: J ? "rtl" : "ltr", children: [
473
- /* @__PURE__ */ t("div", { className: "flex flex-col gap-3", children: [
474
- /* @__PURE__ */ t("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-4", children: [
475
- /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: r("chat_history.title") }),
476
- /* @__PURE__ */ t("div", { className: "flex flex-col md:flex-row gap-3 flex-1 max-w-3xl justify-end", children: [
477
- /* @__PURE__ */ t(
472
+ return /* @__PURE__ */ r("div", { className: "p-5 h-full flex flex-col gap-4 overflow-hidden", dir: B ? "rtl" : "ltr", children: [
473
+ /* @__PURE__ */ r("div", { className: "flex flex-col gap-3", children: [
474
+ /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-4", children: [
475
+ /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: t("chat_history.title") }),
476
+ /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row gap-3 flex-1 max-w-3xl justify-end", children: [
477
+ /* @__PURE__ */ r(
478
478
  "form",
479
479
  {
480
480
  onSubmit: (s) => {
@@ -486,9 +486,9 @@ function pt() {
486
486
  "input",
487
487
  {
488
488
  type: "text",
489
- value: _,
490
- onChange: (s) => R(s.target.value),
491
- placeholder: r("chat_history.search_placeholder"),
489
+ value: k,
490
+ onChange: (s) => U(s.target.value),
491
+ placeholder: t("chat_history.search_placeholder"),
492
492
  className: "flex-1 px-4 py-2.5 border-0 rounded-xl glass-surface text-foreground placeholder-muted-foreground focus:ring-2 focus:ring-primary/20 transition-all text-sm shadow-sm"
493
493
  }
494
494
  ),
@@ -497,36 +497,36 @@ function pt() {
497
497
  {
498
498
  type: "submit",
499
499
  className: "px-5 py-2.5 bg-primary text-primary-foreground rounded-xl hover:opacity-90 transition-all font-semibold text-sm shadow-sm hover:shadow-md",
500
- children: r("chat_history.search_button")
500
+ children: t("chat_history.search_button")
501
501
  }
502
502
  )
503
503
  ]
504
504
  }
505
505
  ),
506
- /* @__PURE__ */ t(
506
+ /* @__PURE__ */ r(
507
507
  "select",
508
508
  {
509
- value: A,
510
- onChange: (s) => N(s.target.value),
509
+ value: E,
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: [
513
- /* @__PURE__ */ e("option", { value: "", children: r("chat_history.all_feedbacks", "All Feedbacks") }),
514
- /* @__PURE__ */ e("option", { value: "liked", children: r("chat_history.liked_feedbacks", "Liked 👍") }),
515
- /* @__PURE__ */ e("option", { value: "disliked", children: r("chat_history.disliked_feedbacks", "Disliked 👎") }),
516
- /* @__PURE__ */ e("option", { value: "any", children: r("chat_history.any_feedback", "With Feedback") })
513
+ /* @__PURE__ */ e("option", { value: "", children: t("chat_history.all_feedbacks", "All Feedbacks") }),
514
+ /* @__PURE__ */ e("option", { value: "liked", children: t("chat_history.liked_feedbacks", "Liked 👍") }),
515
+ /* @__PURE__ */ e("option", { value: "disliked", children: t("chat_history.disliked_feedbacks", "Disliked 👎") }),
516
+ /* @__PURE__ */ e("option", { value: "any", children: t("chat_history.any_feedback", "With Feedback") })
517
517
  ]
518
518
  }
519
519
  )
520
520
  ] })
521
521
  ] }),
522
- q && /* @__PURE__ */ e("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3 rounded-xl text-sm backdrop-blur-sm", children: q })
522
+ A && /* @__PURE__ */ e("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3 rounded-xl text-sm backdrop-blur-sm", children: A })
523
523
  ] }),
524
- /* @__PURE__ */ t("div", { className: "grid grid-cols-1 lg:grid-cols-[380px_1fr] gap-4 flex-1 min-h-0", children: [
525
- /* @__PURE__ */ t("div", { className: "glass-surface rounded-2xl shadow-sm overflow-hidden flex flex-col min-w-0", children: [
526
- /* @__PURE__ */ e("div", { className: "px-5 py-2.5 border-b border-border/30", children: /* @__PURE__ */ t("h2", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wide", children: [
527
- r("chat_history.threads_list"),
524
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-1 lg:grid-cols-[380px_1fr] gap-4 flex-1 min-h-0", children: [
525
+ /* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm overflow-hidden flex flex-col min-w-0", children: [
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
+ t("chat_history.threads_list"),
528
528
  " (",
529
- (i.length || 0).toLocaleString(z),
529
+ (o.length || 0).toLocaleString(J),
530
530
  ")"
531
531
  ] }) }),
532
532
  /* @__PURE__ */ e(
@@ -534,278 +534,278 @@ function pt() {
534
534
  {
535
535
  className: "flex-1 overflow-y-auto p-2 custom-scrollbar",
536
536
  onScroll: M,
537
- children: v && i.length === 0 ? /* @__PURE__ */ e("div", { className: "p-8 text-center text-muted-foreground text-sm", children: r("chat_history.no_threads") }) : /* @__PURE__ */ t("div", { className: "space-y-1", children: [
538
- i.map((s) => /* @__PURE__ */ t(
537
+ children: v && o.length === 0 ? /* @__PURE__ */ e("div", { className: "p-8 text-center text-muted-foreground text-sm", children: t("chat_history.no_threads") }) : /* @__PURE__ */ r("div", { className: "space-y-1", children: [
538
+ o.map((s) => /* @__PURE__ */ r(
539
539
  "div",
540
540
  {
541
541
  onClick: () => F(s),
542
542
  className: `p-2.5 cursor-pointer transition-all rounded-xl border ${g?.id === s.id ? "bg-card border-border shadow-sm" : "border-transparent hover:bg-muted/50"}`,
543
543
  children: [
544
- /* @__PURE__ */ t("div", { className: "flex justify-between items-start mb-1.5 gap-4", children: [
544
+ /* @__PURE__ */ r("div", { className: "flex justify-between items-start mb-1.5 gap-4", children: [
545
545
  /* @__PURE__ */ e(
546
546
  "h3",
547
547
  {
548
548
  className: `font-medium text-sm truncate flex-1 ${g?.id === s.id ? "text-primary" : "text-foreground"}`,
549
- title: s.title || r("chat_history.no_thread_title"),
550
- children: s.title || r("chat_history.no_thread_title")
549
+ title: s.title || t("chat_history.no_thread_title"),
550
+ children: s.title || t("chat_history.no_thread_title")
551
551
  }
552
552
  ),
553
- /* @__PURE__ */ t("div", { className: "flex gap-1", children: [
553
+ /* @__PURE__ */ r("div", { className: "flex gap-1", children: [
554
554
  s.feedback_info && s.feedback_info.like > 0 && /* @__PURE__ */ e("span", { className: "text-xs", children: "👍" }),
555
555
  s.feedback_info && s.feedback_info.dislike > 0 && /* @__PURE__ */ e("span", { className: "text-xs", children: "👎" })
556
556
  ] })
557
557
  ] }),
558
- /* @__PURE__ */ t("div", { className: "text-xs space-y-1.5 text-muted-foreground", children: [
559
- s.user_info && /* @__PURE__ */ t("div", { className: "font-medium text-foreground truncate", title: `${s.user_info.name} ${s.user_info.surname} ${s.user_info.phone ? ` • ${s.user_info.phone}` : ""}`, children: [
558
+ /* @__PURE__ */ r("div", { className: "text-xs space-y-1.5 text-muted-foreground", children: [
559
+ s.user_info && /* @__PURE__ */ r("div", { className: "font-medium text-foreground truncate", title: `${s.user_info.name} ${s.user_info.surname} ${s.user_info.phone ? ` • ${s.user_info.phone}` : ""}`, children: [
560
560
  s.user_info.name,
561
561
  " ",
562
562
  s.user_info.surname,
563
563
  s.user_info.phone && ` • ${s.user_info.phone}`
564
564
  ] }),
565
- s.metadata?.usage && /* @__PURE__ */ t("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: r("chat_history.input_tokens", { value: (s.metadata.usage.input_tokens || 0).toLocaleString(z) }) }),
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: r("chat_history.output_tokens", { value: (s.metadata.usage.output_tokens || 0).toLocaleString(z) }) })
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) }) })
568
568
  ] }),
569
- /* @__PURE__ */ e("div", { className: "text-[10px] text-muted-foreground mt-1", children: a(s.created_at) })
569
+ /* @__PURE__ */ e("div", { className: "text-[10px] text-muted-foreground mt-1", children: d(s.created_at) })
570
570
  ] })
571
571
  ]
572
572
  },
573
573
  s.id
574
574
  )),
575
- T && /* @__PURE__ */ e("div", { className: "p-4 text-center text-muted-foreground text-xs", children: r("loading_more") })
575
+ T && /* @__PURE__ */ e("div", { className: "p-4 text-center text-muted-foreground text-xs", children: t("loading_more") })
576
576
  ] })
577
577
  }
578
578
  )
579
579
  ] }),
580
- /* @__PURE__ */ t("div", { className: "glass-surface rounded-2xl shadow-sm overflow-hidden flex flex-col", children: [
581
- /* @__PURE__ */ t("div", { className: "px-5 py-2.5 border-b border-border/30 flex items-center justify-between gap-4", children: [
582
- /* @__PURE__ */ e("h2", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wide truncate", children: g ? r("chat_history.messages_for", { title: g.title || r("chat_history.no_thread_title") }) : r("chat_history.messages") }),
580
+ /* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm overflow-hidden flex flex-col", children: [
581
+ /* @__PURE__ */ r("div", { className: "px-5 py-2.5 border-b border-border/30 flex items-center justify-between gap-4", children: [
582
+ /* @__PURE__ */ e("h2", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wide truncate", children: g ? t("chat_history.messages_for", { title: g.title || t("chat_history.no_thread_title") }) : t("chat_history.messages") }),
583
583
  g && /* @__PURE__ */ e(
584
584
  "button",
585
585
  {
586
586
  onClick: (s) => l(s, g),
587
587
  className: "flex-shrink-0 w-8 h-8 rounded-full bg-primary/10 text-primary flex items-center justify-center hover:bg-primary/20 transition-all shadow-sm",
588
- title: r("sidebar.share_conversation"),
588
+ title: t("sidebar.share_conversation"),
589
589
  children: /* @__PURE__ */ e(st, { className: "w-4 h-4" })
590
590
  }
591
591
  )
592
592
  ] }),
593
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4 custom-scrollbar", children: g ? v ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground text-sm", children: r("chat_history.loading_messages") }) : w.length === 0 ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground text-sm", children: r("chat_history.empty_thread") }) : /* @__PURE__ */ e("div", { className: "space-y-6", children: w.map((s) => {
594
- const x = s.role === "user", L = s.role === "assistant";
595
- return /* @__PURE__ */ t(
593
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4 custom-scrollbar", children: g ? v ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground text-sm", children: t("chat_history.loading_messages") }) : _.length === 0 ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground text-sm", children: t("chat_history.empty_thread") }) : /* @__PURE__ */ e("div", { className: "space-y-6", children: _.map((s) => {
594
+ const b = s.role === "user", S = s.role === "assistant";
595
+ return /* @__PURE__ */ r(
596
596
  "div",
597
597
  {
598
- className: `p-3.5 rounded-2xl transition-all relative ${x ? "bg-primary/10 ms-12 rounded-te-sm" : L ? "glass shadow-sm me-12 rounded-ts-sm" : "bg-muted/30 border border-border/50"}`,
598
+ className: `p-3.5 rounded-2xl transition-all relative ${b ? "bg-primary/10 ms-12 rounded-te-sm" : S ? "glass shadow-sm me-12 rounded-ts-sm" : "bg-muted/30 border border-border/50"}`,
599
599
  children: [
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
- /* @__PURE__ */ t("div", { className: "flex justify-between items-center mb-1.5", children: [
602
- /* @__PURE__ */ e("span", { className: `text-[10px] font-bold uppercase tracking-wider ${x || L ? "text-primary" : "text-muted-foreground"}`, children: x ? r("chat_history.user_label") : L ? r("chat_history.assistant_label") : `${s.role}` }),
603
- /* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground", children: a(s.created_at) })
601
+ /* @__PURE__ */ r("div", { className: "flex justify-between items-center mb-1.5", children: [
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) })
604
604
  ] }),
605
- /* @__PURE__ */ e("div", { className: "text-sm text-foreground leading-relaxed", dir: "auto", children: s.parts && s.parts.length > 0 ? s.parts.map((P, d) => j(P, d)) : 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 })
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
  ]
607
607
  },
608
608
  s.id
609
609
  );
610
- }) }) : /* @__PURE__ */ t("div", { className: "h-full flex flex-col items-center justify-center text-muted-foreground", children: [
610
+ }) }) : /* @__PURE__ */ r("div", { className: "h-full flex flex-col items-center justify-center text-muted-foreground", children: [
611
611
  /* @__PURE__ */ e("svg", { className: "w-12 h-12 mb-4 opacity-50", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }),
612
- /* @__PURE__ */ e("p", { className: "text-sm", children: r("chat_history.select_thread") })
612
+ /* @__PURE__ */ e("p", { className: "text-sm", children: t("chat_history.select_thread") })
613
613
  ] }) })
614
614
  ] })
615
615
  ] })
616
616
  ] });
617
617
  }
618
618
  function gt() {
619
- const { t: r, i18n: n } = Q(["admin", "translation"]), [i, c] = f([]), [g, p] = f(!1), [w, b] = f(""), [v, D] = f(!1), [T, $] = f(null), [q, C] = f([]), [_, R] = f(null), A = n.language === "fa", [N, I] = f({
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({
620
620
  username: "",
621
621
  password: "",
622
622
  name: "",
623
623
  permissions: []
624
- }), E = async () => {
625
- p(!0), b("");
624
+ }), $ = async () => {
625
+ p(!0), N("");
626
626
  try {
627
- const a = await y.listAdmins();
628
- c(a.admins || []);
629
- const u = localStorage.getItem("admin_info");
630
- u && R(JSON.parse(u).admin_id);
631
- } catch (a) {
632
- b(a instanceof Error ? a.message : r("error_loading"));
627
+ const d = await w.listAdmins();
628
+ u(d.admins || []);
629
+ const i = localStorage.getItem("admin_info");
630
+ i && U(JSON.parse(i).admin_id);
631
+ } catch (d) {
632
+ N(d instanceof Error ? d.message : t("error_loading"));
633
633
  } finally {
634
634
  p(!1);
635
635
  }
636
- }, H = async () => {
636
+ }, P = async () => {
637
637
  try {
638
- const a = await y.listPermissions();
639
- C(a.permissions);
640
- } catch (a) {
641
- console.error("Failed to load permissions", a);
638
+ const d = await w.listPermissions();
639
+ q(d.permissions);
640
+ } catch (d) {
641
+ console.error("Failed to load permissions", d);
642
642
  }
643
643
  };
644
- W(() => {
645
- E(), H();
644
+ G(() => {
645
+ $(), P();
646
646
  }, []);
647
- const B = async (a) => {
648
- a.preventDefault(), p(!0);
647
+ const K = async (d) => {
648
+ d.preventDefault(), p(!0);
649
649
  try {
650
- await y.register(
651
- N.username,
652
- N.password,
653
- N.name,
654
- N.permissions
655
- ), D(!1), I({ username: "", password: "", name: "", permissions: [] }), E();
656
- } catch (u) {
657
- b(u instanceof Error ? u.message : r("error_loading"));
650
+ await w.register(
651
+ y.username,
652
+ y.password,
653
+ y.name,
654
+ y.permissions
655
+ ), O(!1), D({ username: "", password: "", name: "", permissions: [] }), $();
656
+ } catch (i) {
657
+ N(i instanceof Error ? i.message : t("error_loading"));
658
658
  } finally {
659
659
  p(!1);
660
660
  }
661
- }, J = async (a) => {
662
- if (a.preventDefault(), !!T) {
661
+ }, B = async (d) => {
662
+ if (d.preventDefault(), !!T) {
663
663
  p(!0);
664
664
  try {
665
- const u = {
666
- name: N.name,
667
- permissions: N.permissions
665
+ const i = {
666
+ name: y.name,
667
+ permissions: y.permissions
668
668
  };
669
- if (N.password && (u.password = N.password), await y.updateAdmin(T.id, u), T.id === _) {
670
- const k = localStorage.getItem("admin_info");
671
- if (k) {
672
- const m = JSON.parse(k);
673
- m.name = N.name, m.permissions = N.permissions, localStorage.setItem("admin_info", JSON.stringify(m)), window.location.reload();
669
+ if (y.password && (i.password = y.password), await w.updateAdmin(T.id, i), T.id === k) {
670
+ const f = localStorage.getItem("admin_info");
671
+ if (f) {
672
+ const m = JSON.parse(f);
673
+ m.name = y.name, m.permissions = y.permissions, localStorage.setItem("admin_info", JSON.stringify(m)), window.location.reload();
674
674
  return;
675
675
  }
676
676
  }
677
- $(null), I({ username: "", password: "", name: "", permissions: [] }), E();
678
- } catch (u) {
679
- b(u instanceof Error ? u.message : r("error_loading"));
677
+ I(null), D({ username: "", password: "", name: "", permissions: [] }), $();
678
+ } catch (i) {
679
+ N(i instanceof Error ? i.message : t("error_loading"));
680
680
  } finally {
681
681
  p(!1);
682
682
  }
683
683
  }
684
- }, z = async (a) => {
685
- if (confirm(r("admins.confirm_delete_admin")))
684
+ }, J = async (d) => {
685
+ if (confirm(t("admins.confirm_delete_admin")))
686
686
  try {
687
- await y.deleteAdmin(a), E();
688
- } catch (u) {
689
- b(u instanceof Error ? u.message : r("error_loading"));
687
+ await w.deleteAdmin(d), $();
688
+ } catch (i) {
689
+ N(i instanceof Error ? i.message : t("error_loading"));
690
690
  }
691
- }, h = (a) => {
692
- $(a), I({
693
- username: a.username,
691
+ }, h = (d) => {
692
+ I(d), D({
693
+ username: d.username,
694
694
  password: "",
695
- name: a.name,
696
- permissions: a.permissions
697
- }), D(!0);
698
- }, F = (a) => {
699
- I((u) => ({
700
- ...u,
701
- permissions: u.permissions.includes(a) ? u.permissions.filter((k) => k !== a) : [...u.permissions, a]
695
+ name: d.name,
696
+ permissions: d.permissions
697
+ }), O(!0);
698
+ }, F = (d) => {
699
+ D((i) => ({
700
+ ...i,
701
+ permissions: i.permissions.includes(d) ? i.permissions.filter((f) => f !== d) : [...i.permissions, d]
702
702
  }));
703
- }, l = (a) => {
704
- const u = `admins.perm_${a}`, k = r(u);
705
- if (k !== u)
706
- return k;
707
- switch (a) {
703
+ }, l = (d) => {
704
+ const i = `admins.perm_${d}`, f = t(i);
705
+ if (f !== i)
706
+ return f;
707
+ switch (d) {
708
708
  case "chat_history":
709
- return r("admins.perm_chat_history");
709
+ return t("admins.perm_chat_history");
710
710
  case "admin_management":
711
- return r("admins.perm_admin_management");
711
+ return t("admins.perm_admin_management");
712
712
  case "user_management":
713
- return r("admins.perm_user_management");
713
+ return t("admins.perm_user_management");
714
714
  case "analytics":
715
- return r("admins.perm_analytics");
715
+ return t("admins.perm_analytics");
716
716
  case "settings":
717
- return r("admins.perm_settings");
717
+ return t("admins.perm_settings");
718
718
  default:
719
- return a;
719
+ return d;
720
720
  }
721
721
  };
722
- return /* @__PURE__ */ t("div", { className: "h-full flex flex-col p-5 overflow-hidden gap-4", dir: A ? "rtl" : "ltr", children: [
723
- /* @__PURE__ */ t("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3 flex-shrink-0", children: [
724
- /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: r("admins.title") }),
725
- /* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
726
- /* @__PURE__ */ e("div", { className: "glass-surface px-4 py-2.5 rounded-xl text-xs font-medium text-muted-foreground border border-border shadow-sm", children: r("admins.admin_count", { count: i.length }) }),
722
+ return /* @__PURE__ */ r("div", { className: "h-full flex flex-col p-5 overflow-hidden gap-4", dir: E ? "rtl" : "ltr", children: [
723
+ /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3 flex-shrink-0", children: [
724
+ /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: t("admins.title") }),
725
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
726
+ /* @__PURE__ */ e("div", { className: "glass-surface px-4 py-2.5 rounded-xl text-xs font-medium text-muted-foreground border border-border shadow-sm", children: t("admins.admin_count", { count: o.length }) }),
727
727
  /* @__PURE__ */ e(
728
728
  "button",
729
729
  {
730
730
  onClick: () => {
731
- $(null), I({ username: "", password: "", name: "", permissions: [] }), D(!0);
731
+ I(null), D({ username: "", password: "", name: "", permissions: [] }), O(!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
- children: r("admins.add_admin")
734
+ children: t("admins.add_admin")
735
735
  }
736
736
  )
737
737
  ] })
738
738
  ] }),
739
- w && /* @__PURE__ */ e("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3 rounded-xl text-sm backdrop-blur-sm flex-shrink-0", children: w }),
740
- v && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-background/20 backdrop-blur-md flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ t("div", { className: "bg-card rounded-2xl border border-border w-full max-w-md shadow-2xl overflow-hidden", children: [
741
- /* @__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: r(T ? "admins.edit_admin" : "admins.add_admin") }) }),
742
- /* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ t("form", { onSubmit: T ? J : B, className: "space-y-5", children: [
743
- /* @__PURE__ */ t("div", { children: [
744
- /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("admins.username") }),
739
+ _ && /* @__PURE__ */ e("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3 rounded-xl text-sm backdrop-blur-sm flex-shrink-0", children: _ }),
740
+ v && /* @__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-md shadow-2xl overflow-hidden", children: [
741
+ /* @__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(T ? "admins.edit_admin" : "admins.add_admin") }) }),
742
+ /* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit: T ? B : K, className: "space-y-5", children: [
743
+ /* @__PURE__ */ r("div", { children: [
744
+ /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("admins.username") }),
745
745
  /* @__PURE__ */ e(
746
746
  "input",
747
747
  {
748
748
  type: "text",
749
749
  disabled: !!T,
750
- value: N.username,
751
- onChange: (a) => I({ ...N, username: a.target.value }),
750
+ value: y.username,
751
+ onChange: (d) => D({ ...y, username: d.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"
755
755
  }
756
756
  )
757
757
  ] }),
758
- /* @__PURE__ */ t("div", { children: [
759
- /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("admins.name") }),
758
+ /* @__PURE__ */ r("div", { children: [
759
+ /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("admins.name") }),
760
760
  /* @__PURE__ */ e(
761
761
  "input",
762
762
  {
763
763
  type: "text",
764
- value: N.name,
765
- onChange: (a) => I({ ...N, name: a.target.value }),
764
+ value: y.name,
765
+ onChange: (d) => D({ ...y, name: d.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
  }
769
769
  )
770
770
  ] }),
771
- /* @__PURE__ */ t("div", { children: [
772
- /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r(T ? "admins.password_edit" : "admins.password") }),
771
+ /* @__PURE__ */ r("div", { children: [
772
+ /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t(T ? "admins.password_edit" : "admins.password") }),
773
773
  /* @__PURE__ */ e(
774
774
  "input",
775
775
  {
776
776
  type: "password",
777
- value: N.password,
778
- onChange: (a) => I({ ...N, password: a.target.value }),
777
+ value: y.password,
778
+ onChange: (d) => D({ ...y, password: d.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"
782
782
  }
783
783
  )
784
784
  ] }),
785
- /* @__PURE__ */ t("div", { children: [
786
- /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("admins.permissions") }),
787
- /* @__PURE__ */ e("div", { className: "space-y-3 p-4 bg-muted/30 rounded-xl border border-border", children: q.map((a) => /* @__PURE__ */ t("label", { className: "flex items-center gap-3 cursor-pointer group", children: [
785
+ /* @__PURE__ */ r("div", { children: [
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: [
788
788
  /* @__PURE__ */ e("div", { className: "relative flex items-center", children: /* @__PURE__ */ e(
789
789
  "input",
790
790
  {
791
791
  type: "checkbox",
792
- checked: N.permissions.includes(a),
793
- onChange: () => F(a),
794
- disabled: N.username === "admin" && a === "admin_management",
792
+ checked: y.permissions.includes(d),
793
+ onChange: () => F(d),
794
+ disabled: y.username === "admin" && d === "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(a) })
799
- ] }, a)) })
798
+ /* @__PURE__ */ e("span", { className: "text-sm text-foreground/70 group-hover:text-foreground transition-colors select-none", children: l(d) })
799
+ ] }, d)) })
800
800
  ] }),
801
- /* @__PURE__ */ t("div", { className: "flex gap-3 pt-4", children: [
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: () => D(!1),
806
+ onClick: () => O(!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
- children: r("cancel")
808
+ children: t("cancel")
809
809
  }
810
810
  ),
811
811
  /* @__PURE__ */ e(
@@ -814,59 +814,59 @@ function gt() {
814
814
  type: "submit",
815
815
  disabled: g,
816
816
  className: "flex-1 px-4 py-3 bg-primary text-primary-foreground rounded-xl text-sm font-bold hover:opacity-90 transition-all shadow-md hover:shadow-lg disabled:opacity-50",
817
- children: r(g ? "saving" : "save")
817
+ children: t(g ? "saving" : "save")
818
818
  }
819
819
  )
820
820
  ] })
821
821
  ] }) })
822
822
  ] }) }),
823
- /* @__PURE__ */ e("div", { className: "glass-surface border border-border rounded-2xl overflow-hidden shadow-sm flex-1 flex flex-col", children: /* @__PURE__ */ t("div", { className: "overflow-x-auto flex-1", children: [
824
- /* @__PURE__ */ t("table", { className: `w-full ${A ? "text-right" : "text-left"} border-collapse`, children: [
825
- /* @__PURE__ */ e("thead", { className: "bg-muted/30 sticky top-0 z-10 backdrop-blur-md", children: /* @__PURE__ */ t("tr", { children: [
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: r("admins.name") }),
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: r("admins.username") }),
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: r("admins.permissions") }),
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: r("users.actions") })
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: [
825
+ /* @__PURE__ */ e("thead", { className: "bg-muted/30 sticky top-0 z-10 backdrop-blur-md", children: /* @__PURE__ */ r("tr", { children: [
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
+ /* @__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
+ /* @__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
+ /* @__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: i.map((a) => /* @__PURE__ */ t("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: a.name }),
833
- /* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground font-mono", dir: "ltr", children: a.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: a.permissions.map((u) => /* @__PURE__ */ e("span", { className: "px-2 py-0.5 bg-muted/50 text-foreground/80 rounded text-[10px] border border-border/50", children: l(u) }, u)) }) }),
835
- /* @__PURE__ */ e("td", { className: "px-4 py-3", children: /* @__PURE__ */ t("div", { className: "flex items-center gap-1.5", children: [
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)) }) }),
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(a),
839
+ onClick: () => h(d),
840
840
  className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
841
- title: r("edit"),
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
- a.id !== _ && /* @__PURE__ */ e(
845
+ d.id !== k && /* @__PURE__ */ e(
846
846
  "button",
847
847
  {
848
- onClick: () => z(a.id),
848
+ onClick: () => J(d.id),
849
849
  className: "p-2 text-destructive hover:text-destructive/80 hover:bg-destructive/10 rounded-xl transition-all",
850
- title: r("delete"),
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
- ] }, a.id)) })
855
+ ] }, d.id)) })
856
856
  ] }),
857
- i.length === 0 && !g && /* @__PURE__ */ t("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-2", children: [
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" }) }),
859
- r("admins.no_admins")
859
+ t("admins.no_admins")
860
860
  ] }),
861
- g && /* @__PURE__ */ t("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-3", children: [
861
+ g && /* @__PURE__ */ r("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-3", children: [
862
862
  /* @__PURE__ */ e("div", { className: "w-8 h-8 border-2 border-primary/20 border-t-primary rounded-full animate-spin" }),
863
- /* @__PURE__ */ e("span", { children: r("loading") })
863
+ /* @__PURE__ */ e("span", { children: t("loading") })
864
864
  ] })
865
865
  ] }) })
866
866
  ] });
867
867
  }
868
868
  function ft() {
869
- const { t: r, i18n: n } = Q(["admin", "translation"]), { app: i } = le(), [c, g] = f([]), [p, w] = f(!1), [b, v] = f(""), [D, T] = f(!1), [$, q] = f(null), [C, _] = f(""), [R, A] = f(0), N = ie(() => i?.userMetadataFields || [], [i?.userMetadataFields]), [I, E] = f(null), [H, B] = f(""), [J, z] = f(""), [h, F] = f(""), [l, a] = f(""), u = n.language === "fa", k = u ? "text-right" : "text-left", [m, j] = f({
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({
870
870
  phone: "",
871
871
  name: "",
872
872
  surname: "",
@@ -876,57 +876,57 @@ function ft() {
876
876
  requestsLimit: "",
877
877
  metadata: ""
878
878
  // Keep raw JSON for advanced users
879
- }), [M, s] = f({}), x = async () => {
880
- w(!0), v("");
879
+ }), [M, s] = x({}), b = async () => {
880
+ _(!0), v("");
881
881
  try {
882
- const o = await y.listUsers(0, 100, C);
883
- g(o.users || []), A(o.count || 0);
884
- } catch (o) {
885
- v(o instanceof Error ? o.message : r("error_loading"));
882
+ const n = await w.listUsers(0, 100, q);
883
+ g(n.users || []), E(n.count || 0);
884
+ } catch (n) {
885
+ v(n instanceof Error ? n.message : t("error_loading"));
886
886
  } finally {
887
- w(!1);
887
+ _(!1);
888
888
  }
889
889
  };
890
- W(() => {
891
- const o = setTimeout(() => {
892
- x();
890
+ G(() => {
891
+ const n = setTimeout(() => {
892
+ b();
893
893
  }, 500);
894
- return () => clearTimeout(o);
895
- }, [C]), W(() => {
894
+ return () => clearTimeout(n);
895
+ }, [q]), G(() => {
896
896
  try {
897
- const S = { ...m.metadata ? JSON.parse(m.metadata) : {}, ...M }, U = JSON.stringify(S, null, 2);
898
- U !== m.metadata && j((K) => ({ ...K, metadata: U }));
897
+ const L = { ...m.metadata ? JSON.parse(m.metadata) : {}, ...M }, R = JSON.stringify(L, null, 2);
898
+ R !== m.metadata && j((Q) => ({ ...Q, metadata: R }));
899
899
  } catch {
900
900
  }
901
- }, [M]), W(() => {
902
- const o = { ...M };
903
- let S = !1;
904
- N.forEach((U) => {
905
- U.condition && !ke(U.condition, M) && o[U.key] !== void 0 && (delete o[U.key], S = !0);
906
- }), S && s(o);
907
- }, [M, N]);
908
- const L = async (o) => {
909
- o.preventDefault();
910
- const S = m.tokens ? parseInt(m.tokens) : 0, U = m.requests ? parseInt(m.requests) : 0, K = m.tokensLimit ? parseInt(m.tokensLimit) : S, pe = m.requestsLimit ? parseInt(m.requestsLimit) : U;
911
- if (S > K) {
912
- v(r("users.tokens_exceed_limit", "Tokens cannot exceed limit"));
901
+ }, [M]), G(() => {
902
+ const n = { ...M };
903
+ let L = !1;
904
+ y.forEach((R) => {
905
+ R.condition && !ke(R.condition, M) && n[R.key] !== void 0 && (delete n[R.key], L = !0);
906
+ }), L && s(n);
907
+ }, [M, y]);
908
+ const S = async (n) => {
909
+ n.preventDefault();
910
+ const L = m.tokens ? parseInt(m.tokens) : 0, R = m.requests ? parseInt(m.requests) : 0, Q = m.tokensLimit ? parseInt(m.tokensLimit) : L, ge = m.requestsLimit ? parseInt(m.requestsLimit) : R;
911
+ if (L > Q) {
912
+ v(t("users.tokens_exceed_limit", "Tokens cannot exceed limit"));
913
913
  return;
914
914
  }
915
- if (U > pe) {
916
- v(r("users.requests_exceed_limit", "Requests cannot exceed limit"));
915
+ if (R > ge) {
916
+ v(t("users.requests_exceed_limit", "Requests cannot exceed limit"));
917
917
  return;
918
918
  }
919
- let ae = {};
919
+ let ce = {};
920
920
  if (m.metadata)
921
921
  try {
922
- ae = JSON.parse(m.metadata);
922
+ ce = JSON.parse(m.metadata);
923
923
  } catch {
924
- v(r("users.invalid_json", "Invalid JSON format"));
924
+ v(t("users.invalid_json", "Invalid JSON format"));
925
925
  return;
926
926
  }
927
- w(!0);
927
+ _(!0);
928
928
  try {
929
- await y.createUser(
929
+ await w.createUser(
930
930
  m.phone,
931
931
  m.name,
932
932
  m.surname,
@@ -934,208 +934,208 @@ function ft() {
934
934
  m.requests ? parseInt(m.requests) : void 0,
935
935
  m.tokensLimit ? parseInt(m.tokensLimit) : void 0,
936
936
  m.requestsLimit ? parseInt(m.requestsLimit) : void 0,
937
- ae
938
- ), T(!1), d(), x();
939
- } catch (ge) {
940
- v(ge instanceof Error ? ge.message : r("error_loading"));
937
+ ce
938
+ ), T(!1), V(), b();
939
+ } catch (fe) {
940
+ v(fe instanceof Error ? fe.message : t("error_loading"));
941
941
  } finally {
942
- w(!1);
942
+ _(!1);
943
943
  }
944
- }, P = async (o) => {
945
- if (o.preventDefault(), !$) return;
946
- let S = {};
944
+ }, H = async (n) => {
945
+ if (n.preventDefault(), !I) return;
946
+ let L = {};
947
947
  if (m.metadata)
948
948
  try {
949
- S = JSON.parse(m.metadata);
949
+ L = JSON.parse(m.metadata);
950
950
  } catch {
951
- v(r("users.invalid_json", "Invalid JSON format"));
951
+ v(t("users.invalid_json", "Invalid JSON format"));
952
952
  return;
953
953
  }
954
- w(!0);
954
+ _(!0);
955
955
  try {
956
- await y.updateUser($.id, {
956
+ await w.updateUser(I.id, {
957
957
  phone: m.phone,
958
958
  name: m.name,
959
959
  surname: m.surname,
960
- metadata: S
961
- }), q(null), T(!1), d(), x();
962
- } catch (U) {
963
- v(U instanceof Error ? U.message : r("error_loading"));
960
+ metadata: L
961
+ }), A(null), T(!1), V(), b();
962
+ } catch (R) {
963
+ v(R instanceof Error ? R.message : t("error_loading"));
964
964
  } finally {
965
- w(!1);
965
+ _(!1);
966
966
  }
967
- }, d = () => {
967
+ }, V = () => {
968
968
  j({ phone: "", name: "", surname: "", tokens: "", requests: "", tokensLimit: "", requestsLimit: "", metadata: "" }), s({});
969
- }, O = async (o) => {
970
- if (confirm(r("users.confirm_delete_user")))
969
+ }, c = async (n) => {
970
+ if (confirm(t("users.confirm_delete_user")))
971
971
  try {
972
- await y.deleteUser(o), x();
973
- } catch (S) {
974
- v(S instanceof Error ? S.message : r("error_loading"));
972
+ await w.deleteUser(n), b();
973
+ } catch (L) {
974
+ v(L instanceof Error ? L.message : t("error_loading"));
975
975
  }
976
- }, V = async (o) => {
976
+ }, C = async (n) => {
977
977
  try {
978
- const U = (await y.refreshUserToken(o.id))?.user?.token;
979
- if (!U) {
980
- v(r("users.no_token"));
978
+ const R = (await w.refreshUserToken(n.id))?.user?.token;
979
+ if (!R) {
980
+ v(t("users.no_token"));
981
981
  return;
982
982
  }
983
- await navigator.clipboard.writeText(U), alert(r("users.token_copied"));
984
- } catch (S) {
985
- v(S instanceof Error ? S.message : r("error_loading"));
983
+ await navigator.clipboard.writeText(R), alert(t("users.token_copied"));
984
+ } catch (L) {
985
+ v(L instanceof Error ? L.message : t("error_loading"));
986
986
  }
987
- }, ee = async (o) => {
988
- if (o.preventDefault(), !I) return;
989
- const S = parseInt(H) || 0, U = parseInt(J) || 0, K = h ? parseInt(h) : I.balance?.token_limit || 0, pe = l ? parseInt(l) : I.balance?.request_limit || 0;
990
- if (S > K) {
991
- v(r("users.tokens_exceed_limit", "Tokens cannot exceed limit"));
987
+ }, z = async (n) => {
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;
990
+ if (L > Q) {
991
+ v(t("users.tokens_exceed_limit", "Tokens cannot exceed limit"));
992
992
  return;
993
993
  }
994
- if (U > pe) {
995
- v(r("users.requests_exceed_limit", "Requests cannot exceed limit"));
994
+ if (R > ge) {
995
+ v(t("users.requests_exceed_limit", "Requests cannot exceed limit"));
996
996
  return;
997
997
  }
998
- w(!0);
998
+ _(!0);
999
999
  try {
1000
- await y.updateUserBalance(
1001
- I.id,
1002
- S,
1003
- U,
1000
+ await w.updateUserBalance(
1001
+ D.id,
1002
+ L,
1003
+ R,
1004
1004
  h ? parseInt(h) : void 0,
1005
1005
  l ? parseInt(l) : void 0
1006
- ), E(null), B(""), z(""), F(""), a(""), x();
1007
- } catch (ae) {
1008
- v(ae instanceof Error ? ae.message : r("error_loading"));
1006
+ ), $(null), K(""), J(""), F(""), d(""), b();
1007
+ } catch (ce) {
1008
+ v(ce instanceof Error ? ce.message : t("error_loading"));
1009
1009
  } finally {
1010
- w(!1);
1010
+ _(!1);
1011
1011
  }
1012
- }, Ie = (o) => {
1013
- q(o);
1014
- const S = o.metadata ? JSON.stringify(o.metadata, null, 2) : "";
1012
+ }, re = (n) => {
1013
+ A(n);
1014
+ const L = n.metadata ? JSON.stringify(n.metadata, null, 2) : "";
1015
1015
  if (j({
1016
- phone: o.phone,
1017
- name: o.name,
1018
- surname: o.surname,
1016
+ phone: n.phone,
1017
+ name: n.name,
1018
+ surname: n.surname,
1019
1019
  tokens: "",
1020
1020
  requests: "",
1021
1021
  tokensLimit: "",
1022
1022
  requestsLimit: "",
1023
- metadata: S
1024
- }), o.metadata) {
1025
- const U = {};
1026
- N.forEach((K) => {
1027
- o.metadata?.[K.key] !== void 0 ? U[K.key] = o.metadata[K.key] : K.defaultValue !== void 0 && (U[K.key] = K.defaultValue);
1028
- }), s(U);
1023
+ metadata: L
1024
+ }), n.metadata) {
1025
+ const R = {};
1026
+ y.forEach((Q) => {
1027
+ n.metadata?.[Q.key] !== void 0 ? R[Q.key] = n.metadata[Q.key] : Q.defaultValue !== void 0 && (R[Q.key] = Q.defaultValue);
1028
+ }), s(R);
1029
1029
  }
1030
1030
  T(!0);
1031
1031
  };
1032
- return /* @__PURE__ */ t("div", { className: "h-full flex flex-col p-5 overflow-hidden gap-4", dir: u ? "rtl" : "ltr", children: [
1033
- /* @__PURE__ */ t("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3 flex-shrink-0", children: [
1034
- /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: r("users.title") }),
1035
- /* @__PURE__ */ t("div", { className: "flex flex-col md:flex-row items-center gap-2 flex-1 max-w-4xl justify-end", children: [
1032
+ return /* @__PURE__ */ r("div", { className: "h-full flex flex-col p-5 overflow-hidden gap-4", dir: i ? "rtl" : "ltr", children: [
1033
+ /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3 flex-shrink-0", children: [
1034
+ /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: t("users.title") }),
1035
+ /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row items-center gap-2 flex-1 max-w-4xl justify-end", children: [
1036
1036
  /* @__PURE__ */ e("div", { className: "flex-1 w-full md:w-auto", children: /* @__PURE__ */ e(
1037
1037
  "input",
1038
1038
  {
1039
1039
  type: "text",
1040
- value: C,
1041
- onChange: (o) => _(o.target.value),
1042
- placeholder: r("chat_history.search_placeholder"),
1040
+ value: q,
1041
+ onChange: (n) => k(n.target.value),
1042
+ placeholder: t("chat_history.search_placeholder"),
1043
1043
  className: "w-full px-4 py-2.5 border-0 rounded-xl glass-surface text-foreground placeholder-muted-foreground focus:ring-2 focus:ring-primary/20 transition-all text-sm shadow-sm"
1044
1044
  }
1045
1045
  ) }),
1046
- /* @__PURE__ */ t("div", { className: "flex items-center gap-2 shrink-0", children: [
1047
- /* @__PURE__ */ e("div", { className: "glass-surface px-4 py-2.5 rounded-xl text-xs font-medium text-muted-foreground border border-border shadow-sm", children: r("users.user_count", { count: R }) }),
1046
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2 shrink-0", children: [
1047
+ /* @__PURE__ */ e("div", { className: "glass-surface px-4 py-2.5 rounded-xl text-xs font-medium text-muted-foreground border border-border shadow-sm", children: t("users.user_count", { count: U }) }),
1048
1048
  /* @__PURE__ */ e(
1049
1049
  "button",
1050
1050
  {
1051
1051
  onClick: () => {
1052
- q(null), d(), T(!0);
1052
+ A(null), V(), T(!0);
1053
1053
  },
1054
1054
  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",
1055
- children: r("users.add_user")
1055
+ children: t("users.add_user")
1056
1056
  }
1057
1057
  )
1058
1058
  ] })
1059
1059
  ] })
1060
1060
  ] }),
1061
- b && /* @__PURE__ */ t("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3 rounded-xl text-sm backdrop-blur-sm flex-shrink-0 flex justify-between items-center group", children: [
1062
- /* @__PURE__ */ e("span", { children: b }),
1061
+ N && /* @__PURE__ */ r("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3 rounded-xl text-sm backdrop-blur-sm flex-shrink-0 flex justify-between items-center group", children: [
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
- D && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-background/20 backdrop-blur-md flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ t("div", { className: "bg-card rounded-2xl border border-border w-full max-w-xl shadow-2xl overflow-hidden", children: [
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: r($ ? "users.edit_user" : "users.add_user") }) }),
1067
- /* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ t("form", { onSubmit: $ ? P : L, children: [
1068
- /* @__PURE__ */ t("div", { className: "space-y-6 max-h-[60vh] overflow-y-auto px-1 custom-scrollbar", children: [
1069
- /* @__PURE__ */ t("div", { className: "space-y-4", children: [
1070
- /* @__PURE__ */ t("div", { children: [
1071
- /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.phone") }),
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: [
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
+ /* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit: I ? H : S, children: [
1068
+ /* @__PURE__ */ r("div", { className: "space-y-6 max-h-[60vh] overflow-y-auto px-1 custom-scrollbar", children: [
1069
+ /* @__PURE__ */ r("div", { className: "space-y-4", children: [
1070
+ /* @__PURE__ */ r("div", { children: [
1071
+ /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("users.phone") }),
1072
1072
  /* @__PURE__ */ e(
1073
1073
  "input",
1074
1074
  {
1075
1075
  type: "text",
1076
1076
  value: m.phone,
1077
- onChange: (o) => j({ ...m, phone: o.target.value }),
1077
+ onChange: (n) => j({ ...m, phone: n.target.value }),
1078
1078
  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",
1079
- placeholder: r("users.phone_placeholder"),
1079
+ placeholder: t("users.phone_placeholder"),
1080
1080
  required: !0,
1081
1081
  dir: "ltr"
1082
1082
  }
1083
1083
  )
1084
1084
  ] }),
1085
- /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-4", children: [
1086
- /* @__PURE__ */ t("div", { children: [
1087
- /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.name") }),
1085
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: [
1086
+ /* @__PURE__ */ r("div", { children: [
1087
+ /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("users.name") }),
1088
1088
  /* @__PURE__ */ e(
1089
1089
  "input",
1090
1090
  {
1091
1091
  type: "text",
1092
1092
  value: m.name,
1093
- onChange: (o) => j({ ...m, name: o.target.value }),
1094
- 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 ${k}`,
1093
+ onChange: (n) => j({ ...m, name: n.target.value }),
1094
+ 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 ${f}`,
1095
1095
  required: !0
1096
1096
  }
1097
1097
  )
1098
1098
  ] }),
1099
- /* @__PURE__ */ t("div", { children: [
1100
- /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.surname") }),
1099
+ /* @__PURE__ */ r("div", { children: [
1100
+ /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("users.surname") }),
1101
1101
  /* @__PURE__ */ e(
1102
1102
  "input",
1103
1103
  {
1104
1104
  type: "text",
1105
1105
  value: m.surname,
1106
- onChange: (o) => j({ ...m, surname: o.target.value }),
1107
- 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 ${k}`,
1106
+ onChange: (n) => j({ ...m, surname: n.target.value }),
1107
+ 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 ${f}`,
1108
1108
  required: !0
1109
1109
  }
1110
1110
  )
1111
1111
  ] })
1112
1112
  ] })
1113
1113
  ] }),
1114
- !$ && /* @__PURE__ */ t("div", { className: "border-t border-border/50 pt-4 mt-4 space-y-4", children: [
1115
- /* @__PURE__ */ e("h4", { className: "text-sm font-bold text-foreground/70", children: r("users.initial_balance", "Initial Balance") }),
1116
- /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-4", children: [
1117
- /* @__PURE__ */ t("div", { children: [
1118
- /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.initial_tokens") }),
1114
+ !I && /* @__PURE__ */ r("div", { className: "border-t border-border/50 pt-4 mt-4 space-y-4", children: [
1115
+ /* @__PURE__ */ e("h4", { className: "text-sm font-bold text-foreground/70", children: t("users.initial_balance", "Initial Balance") }),
1116
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: [
1117
+ /* @__PURE__ */ r("div", { children: [
1118
+ /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("users.initial_tokens") }),
1119
1119
  /* @__PURE__ */ e(
1120
1120
  "input",
1121
1121
  {
1122
1122
  type: "number",
1123
1123
  value: m.tokens,
1124
- onChange: (o) => j({ ...m, tokens: o.target.value }),
1124
+ onChange: (n) => j({ ...m, tokens: n.target.value }),
1125
1125
  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",
1126
1126
  dir: "ltr",
1127
1127
  placeholder: "0"
1128
1128
  }
1129
1129
  )
1130
1130
  ] }),
1131
- /* @__PURE__ */ t("div", { children: [
1132
- /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.token_limit") }),
1131
+ /* @__PURE__ */ r("div", { children: [
1132
+ /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("users.token_limit") }),
1133
1133
  /* @__PURE__ */ e(
1134
1134
  "input",
1135
1135
  {
1136
1136
  type: "number",
1137
1137
  value: m.tokensLimit,
1138
- onChange: (o) => j({ ...m, tokensLimit: o.target.value }),
1138
+ onChange: (n) => j({ ...m, tokensLimit: n.target.value }),
1139
1139
  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",
1140
1140
  dir: "ltr",
1141
1141
  placeholder: m.tokens || "250000"
@@ -1143,29 +1143,29 @@ function ft() {
1143
1143
  )
1144
1144
  ] })
1145
1145
  ] }),
1146
- /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-4", children: [
1147
- /* @__PURE__ */ t("div", { children: [
1148
- /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.initial_requests") }),
1146
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: [
1147
+ /* @__PURE__ */ r("div", { children: [
1148
+ /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("users.initial_requests") }),
1149
1149
  /* @__PURE__ */ e(
1150
1150
  "input",
1151
1151
  {
1152
1152
  type: "number",
1153
1153
  value: m.requests,
1154
- onChange: (o) => j({ ...m, requests: o.target.value }),
1154
+ onChange: (n) => j({ ...m, requests: n.target.value }),
1155
1155
  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",
1156
1156
  dir: "ltr",
1157
1157
  placeholder: "0"
1158
1158
  }
1159
1159
  )
1160
1160
  ] }),
1161
- /* @__PURE__ */ t("div", { children: [
1162
- /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.request_limit") }),
1161
+ /* @__PURE__ */ r("div", { children: [
1162
+ /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("users.request_limit") }),
1163
1163
  /* @__PURE__ */ e(
1164
1164
  "input",
1165
1165
  {
1166
1166
  type: "number",
1167
1167
  value: m.requestsLimit,
1168
- onChange: (o) => j({ ...m, requestsLimit: o.target.value }),
1168
+ onChange: (n) => j({ ...m, requestsLimit: n.target.value }),
1169
1169
  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",
1170
1170
  dir: "ltr",
1171
1171
  placeholder: m.requests || "100"
@@ -1174,60 +1174,60 @@ function ft() {
1174
1174
  ] })
1175
1175
  ] })
1176
1176
  ] }),
1177
- N.length > 0 && /* @__PURE__ */ t("div", { className: "border-t border-border/50 pt-4 mt-4 space-y-4", children: [
1178
- /* @__PURE__ */ e("h4", { className: "text-sm font-bold text-foreground/70", children: r("users.custom_fields", "Custom Metadata Fields") }),
1179
- /* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: N.map((o) => ke(o.condition, M) ? /* @__PURE__ */ t("div", { className: "animate-in fade-in slide-in-from-top-1 duration-200", children: [
1180
- /* @__PURE__ */ t("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: [
1181
- r(o.label),
1177
+ y.length > 0 && /* @__PURE__ */ r("div", { className: "border-t border-border/50 pt-4 mt-4 space-y-4", children: [
1178
+ /* @__PURE__ */ e("h4", { className: "text-sm font-bold text-foreground/70", children: t("users.custom_fields", "Custom Metadata Fields") }),
1179
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: y.map((n) => ke(n.condition, M) ? /* @__PURE__ */ r("div", { className: "animate-in fade-in slide-in-from-top-1 duration-200", children: [
1180
+ /* @__PURE__ */ r("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: [
1181
+ t(n.label),
1182
1182
  " ",
1183
- o.required && /* @__PURE__ */ e("span", { className: "text-destructive", children: "*" })
1183
+ n.required && /* @__PURE__ */ e("span", { className: "text-destructive", children: "*" })
1184
1184
  ] }),
1185
- o.type === "select" ? /* @__PURE__ */ t(
1186
- ce,
1185
+ n.type === "select" ? /* @__PURE__ */ r(
1186
+ ae,
1187
1187
  {
1188
- value: String(M[o.key] || ""),
1189
- onValueChange: (S) => s({ ...M, [o.key]: S }),
1190
- required: o.required,
1191
- dir: u ? "rtl" : "ltr",
1188
+ value: String(M[n.key] || ""),
1189
+ onValueChange: (L) => s({ ...M, [n.key]: L }),
1190
+ required: n.required,
1191
+ dir: i ? "rtl" : "ltr",
1192
1192
  children: [
1193
- /* @__PURE__ */ e(me, { className: xe("w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground transition-all text-sm h-[46px]", k), children: /* @__PURE__ */ e(ue, { placeholder: r(o.placeholder || "select_placeholder") }) }),
1194
- /* @__PURE__ */ e(he, { className: "rounded-xl border-border bg-card", children: o.options?.map((S) => /* @__PURE__ */ e(ne, { value: String(S.value), children: r(S.label) }, String(S.value))) })
1193
+ /* @__PURE__ */ e(ne, { className: be("w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground transition-all text-sm h-[46px]", f), children: /* @__PURE__ */ e(oe, { placeholder: t(n.placeholder || "select_placeholder") }) }),
1194
+ /* @__PURE__ */ e(ie, { className: "rounded-xl border-border bg-card", children: n.options?.map((L) => /* @__PURE__ */ e(W, { value: String(L.value), children: t(L.label) }, String(L.value))) })
1195
1195
  ]
1196
1196
  }
1197
- ) : o.type === "checkbox" ? /* @__PURE__ */ t("div", { className: "flex items-center gap-3 h-[46px] px-1", children: [
1197
+ ) : n.type === "checkbox" ? /* @__PURE__ */ r("div", { className: "flex items-center gap-3 h-[46px] px-1", children: [
1198
1198
  /* @__PURE__ */ e(
1199
1199
  Re,
1200
1200
  {
1201
- id: `admin-md-${o.key}`,
1202
- checked: !!M[o.key],
1203
- onCheckedChange: (S) => s({ ...M, [o.key]: !!S }),
1204
- required: o.required
1201
+ id: `admin-md-${n.key}`,
1202
+ checked: !!M[n.key],
1203
+ onCheckedChange: (L) => s({ ...M, [n.key]: !!L }),
1204
+ required: n.required
1205
1205
  }
1206
1206
  ),
1207
- /* @__PURE__ */ e("label", { htmlFor: `admin-md-${o.key}`, className: "text-sm text-foreground/80 cursor-pointer select-none", children: r(o.placeholder || o.label) })
1207
+ /* @__PURE__ */ e("label", { htmlFor: `admin-md-${n.key}`, className: "text-sm text-foreground/80 cursor-pointer select-none", children: t(n.placeholder || n.label) })
1208
1208
  ] }) : /* @__PURE__ */ e(
1209
1209
  "input",
1210
1210
  {
1211
- type: o.type,
1212
- value: M[o.key] || "",
1213
- onChange: (S) => s({ ...M, [o.key]: S.target.value }),
1214
- 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 ${k}`,
1215
- placeholder: r(o.placeholder || ""),
1216
- required: o.required
1211
+ type: n.type,
1212
+ value: M[n.key] || "",
1213
+ onChange: (L) => s({ ...M, [n.key]: L.target.value }),
1214
+ 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 ${f}`,
1215
+ placeholder: t(n.placeholder || ""),
1216
+ required: n.required
1217
1217
  }
1218
1218
  )
1219
- ] }, o.key) : null) })
1219
+ ] }, n.key) : null) })
1220
1220
  ] }),
1221
- /* @__PURE__ */ t("div", { className: "border-t border-border/50 pt-4 mt-4", children: [
1222
- /* @__PURE__ */ t("div", { className: "flex items-center justify-between mb-2", children: [
1223
- /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider", children: r("users.metadata_raw", "Metadata (Raw JSON)") }),
1221
+ /* @__PURE__ */ r("div", { className: "border-t border-border/50 pt-4 mt-4", children: [
1222
+ /* @__PURE__ */ r("div", { className: "flex items-center justify-between mb-2", children: [
1223
+ /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider", children: t("users.metadata_raw", "Metadata (Raw JSON)") }),
1224
1224
  /* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground opacity-60", children: "Advanced usage" })
1225
1225
  ] }),
1226
1226
  /* @__PURE__ */ e(
1227
1227
  "textarea",
1228
1228
  {
1229
1229
  value: m.metadata,
1230
- onChange: (o) => j({ ...m, metadata: o.target.value }),
1230
+ onChange: (n) => j({ ...m, metadata: n.target.value }),
1231
1231
  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-xs font-mono min-h-[100px] custom-scrollbar",
1232
1232
  placeholder: '{ "key": "value" }',
1233
1233
  dir: "ltr"
@@ -1235,16 +1235,16 @@ function ft() {
1235
1235
  )
1236
1236
  ] })
1237
1237
  ] }),
1238
- /* @__PURE__ */ t("div", { className: "flex gap-3 pt-6", children: [
1238
+ /* @__PURE__ */ r("div", { className: "flex gap-3 pt-6", children: [
1239
1239
  /* @__PURE__ */ e(
1240
1240
  "button",
1241
1241
  {
1242
1242
  type: "button",
1243
1243
  onClick: () => {
1244
- T(!1), q(null);
1244
+ T(!1), A(null);
1245
1245
  },
1246
1246
  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",
1247
- children: r("cancel")
1247
+ children: t("cancel")
1248
1248
  }
1249
1249
  ),
1250
1250
  /* @__PURE__ */ e(
@@ -1253,91 +1253,91 @@ function ft() {
1253
1253
  type: "submit",
1254
1254
  disabled: p,
1255
1255
  className: "flex-1 px-4 py-3 bg-primary text-primary-foreground rounded-xl text-sm font-bold hover:opacity-90 transition-all shadow-md hover:shadow-lg disabled:opacity-50",
1256
- children: r(p ? "saving" : "save")
1256
+ children: t(p ? "saving" : "save")
1257
1257
  }
1258
1258
  )
1259
1259
  ] })
1260
1260
  ] }) })
1261
1261
  ] }) }),
1262
- I && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-background/20 backdrop-blur-md flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ t("div", { className: "bg-card rounded-2xl border border-border w-full max-w-sm shadow-2xl overflow-hidden", children: [
1263
- /* @__PURE__ */ e("div", { className: "px-6 py-5 border-b border-border bg-muted/20", children: /* @__PURE__ */ t("h3", { className: "text-lg font-bold text-foreground", children: [
1264
- r("users.update_balance_for"),
1262
+ D && /* @__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-sm shadow-2xl overflow-hidden", children: [
1263
+ /* @__PURE__ */ e("div", { className: "px-6 py-5 border-b border-border bg-muted/20", children: /* @__PURE__ */ r("h3", { className: "text-lg font-bold text-foreground", children: [
1264
+ t("users.update_balance_for"),
1265
1265
  " ",
1266
- I.name
1266
+ D.name
1267
1267
  ] }) }),
1268
- /* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ t("form", { onSubmit: ee, children: [
1269
- /* @__PURE__ */ t("div", { className: "space-y-4", children: [
1270
- /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-4", children: [
1271
- /* @__PURE__ */ t("div", { children: [
1272
- /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.token_count") }),
1268
+ /* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit: z, children: [
1269
+ /* @__PURE__ */ r("div", { className: "space-y-4", children: [
1270
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: [
1271
+ /* @__PURE__ */ r("div", { children: [
1272
+ /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("users.token_count") }),
1273
1273
  /* @__PURE__ */ e(
1274
1274
  "input",
1275
1275
  {
1276
1276
  type: "number",
1277
- value: H,
1278
- onChange: (o) => B(o.target.value),
1277
+ value: P,
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,
1281
1281
  dir: "ltr"
1282
1282
  }
1283
1283
  )
1284
1284
  ] }),
1285
- /* @__PURE__ */ t("div", { children: [
1286
- /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.token_limit") }),
1285
+ /* @__PURE__ */ r("div", { children: [
1286
+ /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("users.token_limit") }),
1287
1287
  /* @__PURE__ */ e(
1288
1288
  "input",
1289
1289
  {
1290
1290
  type: "number",
1291
1291
  value: h,
1292
- onChange: (o) => F(o.target.value),
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: H
1295
+ placeholder: P
1296
1296
  }
1297
1297
  )
1298
1298
  ] })
1299
1299
  ] }),
1300
- /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-4", children: [
1301
- /* @__PURE__ */ t("div", { children: [
1302
- /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.request_count") }),
1300
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: [
1301
+ /* @__PURE__ */ r("div", { children: [
1302
+ /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("users.request_count") }),
1303
1303
  /* @__PURE__ */ e(
1304
1304
  "input",
1305
1305
  {
1306
1306
  type: "number",
1307
- value: J,
1308
- onChange: (o) => z(o.target.value),
1307
+ value: B,
1308
+ onChange: (n) => J(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"
1312
1312
  }
1313
1313
  )
1314
1314
  ] }),
1315
- /* @__PURE__ */ t("div", { children: [
1316
- /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.request_limit") }),
1315
+ /* @__PURE__ */ r("div", { children: [
1316
+ /* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("users.request_limit") }),
1317
1317
  /* @__PURE__ */ e(
1318
1318
  "input",
1319
1319
  {
1320
1320
  type: "number",
1321
1321
  value: l,
1322
- onChange: (o) => a(o.target.value),
1322
+ onChange: (n) => d(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
- placeholder: J
1325
+ placeholder: B
1326
1326
  }
1327
1327
  )
1328
1328
  ] })
1329
1329
  ] })
1330
1330
  ] }),
1331
- /* @__PURE__ */ t("div", { className: "flex gap-3 pt-6", children: [
1331
+ /* @__PURE__ */ r("div", { className: "flex gap-3 pt-6", children: [
1332
1332
  /* @__PURE__ */ e(
1333
1333
  "button",
1334
1334
  {
1335
1335
  type: "button",
1336
1336
  onClick: () => {
1337
- E(null), v("");
1337
+ $(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
- children: r("cancel")
1340
+ children: t("cancel")
1341
1341
  }
1342
1342
  ),
1343
1343
  /* @__PURE__ */ e(
@@ -1346,68 +1346,68 @@ function ft() {
1346
1346
  type: "submit",
1347
1347
  disabled: p,
1348
1348
  className: "flex-1 px-4 py-3 bg-gray-900 dark:bg-gray-100 text-white dark:text-gray-900 rounded-xl text-sm font-bold hover:bg-gray-800 dark:hover:bg-gray-200 transition-all shadow-md hover:shadow-lg disabled:opacity-50",
1349
- children: r(p ? "users.updating" : "users.update_balance")
1349
+ children: t(p ? "users.updating" : "users.update_balance")
1350
1350
  }
1351
1351
  )
1352
1352
  ] })
1353
1353
  ] }) })
1354
1354
  ] }) }),
1355
- /* @__PURE__ */ e("div", { className: "glass-surface border border-border rounded-2xl overflow-hidden shadow-sm flex-1 flex flex-col", children: /* @__PURE__ */ t("div", { className: "overflow-x-auto flex-1 custom-scrollbar", children: [
1356
- /* @__PURE__ */ t("table", { className: `w-full ${u ? "text-right" : "text-left"} border-collapse`, children: [
1357
- /* @__PURE__ */ e("thead", { className: "bg-muted/30 sticky top-0 z-10 backdrop-blur-md", children: /* @__PURE__ */ t("tr", { children: [
1358
- /* @__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: r("users.phone") }),
1359
- /* @__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: r("users.name") }),
1360
- /* @__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: r("users.surname") }),
1361
- N.map((o) => /* @__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: r(o.label) }, o.key)),
1362
- /* @__PURE__ */ e("th", { className: "px-4 py-3.5 text-[11px] font-bold text-muted-foreground uppercase tracking-widest border-b border-border/50 w-[120px]", children: r("users.balance") }),
1363
- /* @__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: r("users.actions") })
1355
+ /* @__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 custom-scrollbar", children: [
1356
+ /* @__PURE__ */ r("table", { className: `w-full ${i ? "text-right" : "text-left"} border-collapse`, children: [
1357
+ /* @__PURE__ */ e("thead", { className: "bg-muted/30 sticky top-0 z-10 backdrop-blur-md", children: /* @__PURE__ */ r("tr", { children: [
1358
+ /* @__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.phone") }),
1359
+ /* @__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.name") }),
1360
+ /* @__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.surname") }),
1361
+ y.map((n) => /* @__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(n.label) }, n.key)),
1362
+ /* @__PURE__ */ e("th", { className: "px-4 py-3.5 text-[11px] font-bold text-muted-foreground uppercase tracking-widest border-b border-border/50 w-[120px]", children: t("users.balance") }),
1363
+ /* @__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") })
1364
1364
  ] }) }),
1365
- /* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children: c.map((o) => /* @__PURE__ */ t("tr", { className: "hover:bg-muted/30 transition-colors text-xs border-b border-border/50", children: [
1366
- /* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground font-mono", dir: "ltr", children: o.phone }),
1367
- /* @__PURE__ */ e("td", { className: "px-4 py-3 font-medium text-foreground", children: o.name }),
1368
- /* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground/80", children: o.surname }),
1369
- N.map((S) => /* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground/80", children: S.type === "checkbox" ? o.metadata?.[S.key] ? /* @__PURE__ */ e("span", { className: "text-emerald-500 font-bold", children: "✓" }) : /* @__PURE__ */ e("span", { className: "text-muted-foreground opacity-30", children: "✗" }) : String(o.metadata?.[S.key] ?? "") }, S.key)),
1370
- /* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground w-[120px]", children: o.balance ? /* @__PURE__ */ t("div", { className: "flex flex-col gap-3 min-w-0 py-1", children: [
1371
- /* @__PURE__ */ t("div", { className: "space-y-1", children: [
1372
- /* @__PURE__ */ t("div", { className: "flex justify-between text-[10px] font-semibold", children: [
1373
- /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: r("users.tokens_label") }),
1374
- /* @__PURE__ */ t("span", { className: "text-foreground", children: [
1375
- (o.balance.token_limit > 0 ? Math.round(o.balance.tokens / o.balance.token_limit * 100) : 0).toLocaleString(n.language),
1365
+ /* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children: u.map((n) => /* @__PURE__ */ r("tr", { className: "hover:bg-muted/30 transition-colors text-xs border-b border-border/50", children: [
1366
+ /* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground font-mono", dir: "ltr", children: n.phone }),
1367
+ /* @__PURE__ */ e("td", { className: "px-4 py-3 font-medium text-foreground", children: n.name }),
1368
+ /* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground/80", children: n.surname }),
1369
+ y.map((L) => /* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground/80", children: L.type === "checkbox" ? n.metadata?.[L.key] ? /* @__PURE__ */ e("span", { className: "text-emerald-500 font-bold", children: "✓" }) : /* @__PURE__ */ e("span", { className: "text-muted-foreground opacity-30", children: "✗" }) : String(n.metadata?.[L.key] ?? "") }, L.key)),
1370
+ /* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground w-[120px]", children: n.balance ? /* @__PURE__ */ r("div", { className: "flex flex-col gap-3 min-w-0 py-1", children: [
1371
+ /* @__PURE__ */ r("div", { className: "space-y-1", children: [
1372
+ /* @__PURE__ */ r("div", { className: "flex justify-between text-[10px] font-semibold", children: [
1373
+ /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: t("users.tokens_label") }),
1374
+ /* @__PURE__ */ r("span", { className: "text-foreground", children: [
1375
+ (n.balance.token_limit > 0 ? Math.round(n.balance.tokens / n.balance.token_limit * 100) : 0).toLocaleString(a.language),
1376
1376
  "%"
1377
1377
  ] })
1378
1378
  ] }),
1379
1379
  /* @__PURE__ */ e("div", { className: "h-1 w-full bg-muted rounded-full overflow-hidden", dir: "ltr", children: /* @__PURE__ */ e(
1380
1380
  "div",
1381
1381
  {
1382
- className: `h-full rounded-full transition-all duration-500 ${o.balance.tokens / (o.balance.token_limit || 1) > 0.6 ? "bg-emerald-500" : o.balance.tokens / (o.balance.token_limit || 1) > 0.2 ? "bg-amber-500" : "bg-destructive"}`,
1383
- style: { width: `${Math.min(100, Math.max(0, o.balance.tokens / (o.balance.token_limit || 1) * 100))}%` }
1382
+ className: `h-full rounded-full transition-all duration-500 ${n.balance.tokens / (n.balance.token_limit || 1) > 0.6 ? "bg-emerald-500" : n.balance.tokens / (n.balance.token_limit || 1) > 0.2 ? "bg-amber-500" : "bg-destructive"}`,
1383
+ style: { width: `${Math.min(100, Math.max(0, n.balance.tokens / (n.balance.token_limit || 1) * 100))}%` }
1384
1384
  }
1385
1385
  ) })
1386
1386
  ] }),
1387
- /* @__PURE__ */ t("div", { className: "space-y-1", children: [
1388
- /* @__PURE__ */ t("div", { className: "flex justify-between text-[10px] font-semibold", children: [
1389
- /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: r("users.requests_label") }),
1390
- /* @__PURE__ */ t("span", { className: "text-foreground", children: [
1391
- (o.balance.request_limit > 0 ? Math.round(o.balance.requests / o.balance.request_limit * 100) : 0).toLocaleString(n.language),
1387
+ /* @__PURE__ */ r("div", { className: "space-y-1", children: [
1388
+ /* @__PURE__ */ r("div", { className: "flex justify-between text-[10px] font-semibold", children: [
1389
+ /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: t("users.requests_label") }),
1390
+ /* @__PURE__ */ r("span", { className: "text-foreground", children: [
1391
+ (n.balance.request_limit > 0 ? Math.round(n.balance.requests / n.balance.request_limit * 100) : 0).toLocaleString(a.language),
1392
1392
  "%"
1393
1393
  ] })
1394
1394
  ] }),
1395
1395
  /* @__PURE__ */ e("div", { className: "h-1 w-full bg-muted rounded-full overflow-hidden", dir: "ltr", children: /* @__PURE__ */ e(
1396
1396
  "div",
1397
1397
  {
1398
- className: `h-full rounded-full transition-all duration-500 ${o.balance.requests / (o.balance.request_limit || 1) > 0.6 ? "bg-emerald-500" : o.balance.requests / (o.balance.request_limit || 1) > 0.2 ? "bg-amber-500" : "bg-destructive"}`,
1399
- style: { width: `${Math.min(100, Math.max(0, o.balance.requests / (o.balance.request_limit || 1) * 100))}%` }
1398
+ className: `h-full rounded-full transition-all duration-500 ${n.balance.requests / (n.balance.request_limit || 1) > 0.6 ? "bg-emerald-500" : n.balance.requests / (n.balance.request_limit || 1) > 0.2 ? "bg-amber-500" : "bg-destructive"}`,
1399
+ style: { width: `${Math.min(100, Math.max(0, n.balance.requests / (n.balance.request_limit || 1) * 100))}%` }
1400
1400
  }
1401
1401
  ) })
1402
1402
  ] })
1403
1403
  ] }) : /* @__PURE__ */ e("span", { className: "text-muted-foreground/40 text-[10px]", children: "—" }) }),
1404
- /* @__PURE__ */ e("td", { className: "px-4 py-3", children: /* @__PURE__ */ t("div", { className: "flex items-center gap-1.5", children: [
1404
+ /* @__PURE__ */ e("td", { className: "px-4 py-3", children: /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
1405
1405
  /* @__PURE__ */ e(
1406
1406
  "button",
1407
1407
  {
1408
- onClick: () => Ie(o),
1408
+ onClick: () => re(n),
1409
1409
  className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
1410
- title: r("edit"),
1410
+ title: t("edit"),
1411
1411
  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" }) })
1412
1412
  }
1413
1413
  ),
@@ -1415,102 +1415,102 @@ function ft() {
1415
1415
  "button",
1416
1416
  {
1417
1417
  onClick: () => {
1418
- E(o), B(String(o.balance?.tokens || 0)), z(String(o.balance?.requests || 0)), F(String(o.balance?.token_limit || 0)), a(String(o.balance?.request_limit || 0)), v("");
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("");
1419
1419
  },
1420
1420
  className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
1421
- title: r("users.recharge"),
1421
+ title: t("users.recharge"),
1422
1422
  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: "M2.25 18.75a60.07 60.07 0 0 1 15.797 2.101c.727.198 1.453-.342 1.453-1.096V18.75M3.75 4.5v.75A.75.75 0 0 1 3 6h-.75m0 0v-.375c0-.621.504-1.125 1.125-1.125H20.25M2.25 6v9m18-10.5v.75c0 .414.336.75.75.75h.75m-1.5-1.5h.375c.621 0 1.125.504 1.125 1.125v9.75c0 .621-.504 1.125-1.125 1.125h-.375m1.5-1.5H21a.75.75 0 0 0-.75.75v.75m0 0H3.75m0 0h-.375a1.125 1.125 0 0 1-1.125-1.125V15m1.5 1.5v-.75A.75.75 0 0 0 3 15h-.75M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm3 0h.008v.008H18V10.5Zm-12 0h.008v.008H6V10.5Z" }) })
1423
1423
  }
1424
1424
  ),
1425
1425
  /* @__PURE__ */ e(
1426
1426
  "button",
1427
1427
  {
1428
- onClick: () => V(o),
1428
+ onClick: () => C(n),
1429
1429
  className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
1430
- title: r("users.copy_token"),
1430
+ title: t("users.copy_token"),
1431
1431
  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: "M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z" }) })
1432
1432
  }
1433
1433
  ),
1434
1434
  /* @__PURE__ */ e(
1435
1435
  "button",
1436
1436
  {
1437
- onClick: () => O(o.id),
1437
+ onClick: () => c(n.id),
1438
1438
  className: "p-2 text-destructive hover:text-destructive/80 hover:bg-destructive/10 rounded-xl transition-all",
1439
- title: r("delete"),
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" }) })
1441
1441
  }
1442
1442
  )
1443
1443
  ] }) })
1444
- ] }, o.id)) })
1444
+ ] }, n.id)) })
1445
1445
  ] }),
1446
- c.length === 0 && !p && /* @__PURE__ */ t("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-2", children: [
1446
+ u.length === 0 && !p && /* @__PURE__ */ r("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-2", children: [
1447
1447
  /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/xl", 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" }) }),
1448
- r("users.no_users")
1448
+ t("users.no_users")
1449
1449
  ] }),
1450
- p && /* @__PURE__ */ t("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-3", children: [
1450
+ p && /* @__PURE__ */ r("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-3", children: [
1451
1451
  /* @__PURE__ */ e("div", { className: "w-8 h-8 border-2 border-primary/20 border-t-primary rounded-full animate-spin" }),
1452
- /* @__PURE__ */ e("span", { children: r("loading") })
1452
+ /* @__PURE__ */ e("span", { children: t("loading") })
1453
1453
  ] })
1454
1454
  ] }) })
1455
1455
  ] });
1456
1456
  }
1457
1457
  function xt() {
1458
- const { t: r, i18n: n } = Q(["admin", "translation"]), [i, c] = f(null), [g, p] = f(!0), [w, b] = f(""), [v, D] = f(30), [T, $] = f(0), q = Ae(null), C = n.language === "fa", _ = C ? "fa-IR" : "en-US", R = C ? "fa-IR-u-ca-persian" : "en-US";
1459
- W(() => {
1460
- I();
1461
- }, [v]), W(() => {
1462
- if (!q.current) return;
1463
- const l = new ResizeObserver((a) => {
1464
- for (const u of a)
1465
- $(u.contentRect.width);
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";
1459
+ G(() => {
1460
+ D();
1461
+ }, [v]), G(() => {
1462
+ if (!A.current) return;
1463
+ const l = new ResizeObserver((d) => {
1464
+ for (const i of d)
1465
+ I(i.contentRect.width);
1466
1466
  });
1467
- return l.observe(q.current), () => l.disconnect();
1467
+ return l.observe(A.current), () => l.disconnect();
1468
1468
  }, []);
1469
- const A = (l, a, u) => {
1470
- const k = [], m = /* @__PURE__ */ new Date(), j = l || [], M = new Map(j.map((s) => [s.date, s]));
1471
- for (let s = a - 1; s >= 0; s--) {
1472
- const L = new Date(m.getTime() - s * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
1473
- if (M.has(L))
1474
- k.push(M.get(L));
1469
+ const E = (l, d, i) => {
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--) {
1472
+ const S = new Date(m.getTime() - s * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
1473
+ if (M.has(S))
1474
+ f.push(M.get(S));
1475
1475
  else {
1476
- const P = { date: L };
1477
- u.forEach((d) => P[d] = 0), k.push(P);
1476
+ const H = { date: S };
1477
+ i.forEach((V) => H[V] = 0), f.push(H);
1478
1478
  }
1479
1479
  }
1480
- return k;
1481
- }, N = (l) => {
1480
+ return f;
1481
+ }, y = (l) => {
1482
1482
  if (!l || l.length === 0) return null;
1483
- const a = l.length, u = new Intl.DateTimeFormat(R, { month: "short" });
1484
- let k = [];
1483
+ const d = l.length, i = new Intl.DateTimeFormat(U, { month: "short" });
1484
+ let f = [];
1485
1485
  if (v <= 14)
1486
- k = Array.from({ length: a }, (m, j) => j);
1486
+ f = Array.from({ length: d }, (m, j) => j);
1487
1487
  else {
1488
- const m = C ? 45 : 35, j = T > 0 ? Math.floor(T / m) : 6, M = Math.max(1, Math.ceil(a / Math.max(1, j)));
1489
- for (let s = 0; s < a; s += M)
1490
- k.push(s);
1491
- k.length > 0 && k[k.length - 1] !== a - 1 && (a - 1 - k[k.length - 1] > M / 2 ? k.push(a - 1) : k[k.length - 1] = a - 1);
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)
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);
1492
1492
  }
1493
- return /* @__PURE__ */ e("div", { className: "relative w-full h-8 mt-2", dir: C ? "rtl" : "ltr", children: k.map((m) => {
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(R, { day: "numeric" }), x = u.format(M), L = a > 1 ? m / (a - 1) * 100 : 50;
1497
- return /* @__PURE__ */ t(
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;
1497
+ return /* @__PURE__ */ r(
1498
1498
  "div",
1499
1499
  {
1500
1500
  className: "absolute top-0 transform -translate-x-1/2 flex flex-col items-center",
1501
- style: { left: `${L}%` },
1501
+ style: { left: `${S}%` },
1502
1502
  children: [
1503
1503
  /* @__PURE__ */ e("span", { className: "text-[10px] text-gray-600 dark:text-gray-400 font-medium leading-none", children: s }),
1504
- /* @__PURE__ */ e("span", { className: "text-[9px] text-gray-400 dark:text-gray-500 mt-1 leading-none whitespace-nowrap", children: x })
1504
+ /* @__PURE__ */ e("span", { className: "text-[9px] text-gray-400 dark:text-gray-500 mt-1 leading-none whitespace-nowrap", children: b })
1505
1505
  ]
1506
1506
  },
1507
1507
  m
1508
1508
  );
1509
1509
  }) });
1510
- }, I = async () => {
1511
- p(!0), b("");
1510
+ }, D = async () => {
1511
+ p(!0), N("");
1512
1512
  try {
1513
- const l = await y.getAnalytics(v), a = {
1513
+ const l = await w.getAnalytics(v), d = {
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: A(l.trends?.users, v, ["count"]),
1524
- threads: A(l.trends?.threads, v, ["count"]),
1525
- messages: A(l.trends?.messages, v, ["count"]),
1526
- token_usage: A(l.trends?.token_usage, v, ["tokens", "requests"])
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"])
1527
1527
  },
1528
1528
  distributions: {
1529
1529
  ...l.distributions || {},
@@ -1531,188 +1531,188 @@ function xt() {
1531
1531
  },
1532
1532
  active_users: l.active_users || []
1533
1533
  };
1534
- c(a);
1534
+ u(d);
1535
1535
  } catch (l) {
1536
- b(l instanceof Error ? l.message : r("analytics.error_loading"));
1536
+ N(l instanceof Error ? l.message : t("analytics.error_loading"));
1537
1537
  } finally {
1538
1538
  p(!1);
1539
1539
  }
1540
1540
  };
1541
1541
  if (g)
1542
- return /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground", children: r("analytics.loading_analytics") });
1543
- if (w)
1544
- return /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center", children: /* @__PURE__ */ t("div", { className: "text-center", children: [
1545
- /* @__PURE__ */ e("div", { className: "text-destructive mb-4", children: w }),
1542
+ return /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground", children: t("analytics.loading_analytics") });
1543
+ if (_)
1544
+ return /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center", children: /* @__PURE__ */ r("div", { className: "text-center", children: [
1545
+ /* @__PURE__ */ e("div", { className: "text-destructive mb-4", children: _ }),
1546
1546
  /* @__PURE__ */ e(
1547
1547
  "button",
1548
1548
  {
1549
- onClick: I,
1549
+ onClick: D,
1550
1550
  className: "px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 transition-colors",
1551
- children: r("retry")
1551
+ children: t("retry")
1552
1552
  }
1553
1553
  )
1554
1554
  ] }) });
1555
- if (!i) return null;
1556
- const E = (l) => {
1555
+ if (!o) return null;
1556
+ const $ = (l) => {
1557
1557
  if (l <= 0) return 10;
1558
- const a = l * 1.15, u = Math.pow(10, Math.floor(Math.log10(a))), k = a / u;
1558
+ const d = l * 1.15, i = Math.pow(10, Math.floor(Math.log10(d))), f = d / i;
1559
1559
  let m;
1560
- return k <= 1.2 ? m = 0.2 : k <= 2.5 ? m = 0.5 : k <= 5 ? m = 1 : m = 2, Math.ceil(a / (m * u)) * (m * u);
1561
- }, H = Math.max(...i.trends.threads.map((l) => l.count) || [1]), B = Math.max(...i.trends.messages.map((l) => l.count) || [1]), J = Math.max(...i.trends.token_usage.map((l) => l.tokens) || [1]), z = E(H), h = E(B), F = E(J);
1562
- return /* @__PURE__ */ t("div", { className: "h-full overflow-auto p-5 flex flex-col gap-5", dir: C ? "rtl" : "ltr", children: [
1563
- /* @__PURE__ */ t("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3", children: [
1564
- /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: r("analytics.title") }),
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);
1562
+ return /* @__PURE__ */ r("div", { className: "h-full overflow-auto p-5 flex flex-col gap-5", dir: q ? "rtl" : "ltr", children: [
1563
+ /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3", children: [
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: () => D(l),
1568
+ onClick: () => O(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
- children: r("analytics.days", { count: l })
1570
+ children: t("analytics.days", { count: l })
1571
1571
  },
1572
1572
  l
1573
1573
  )) })
1574
1574
  ] }),
1575
- /* @__PURE__ */ t("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4", children: [
1576
- /* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
1577
- /* @__PURE__ */ t("div", { children: [
1578
- /* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: r("analytics.total_users") }),
1579
- /* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (i.overview.total_users || 0).toLocaleString(_) })
1575
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4", children: [
1576
+ /* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
1577
+ /* @__PURE__ */ r("div", { children: [
1578
+ /* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: t("analytics.total_users") }),
1579
+ /* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (o.overview.total_users || 0).toLocaleString(k) })
1580
1580
  ] }),
1581
1581
  /* @__PURE__ */ e("div", { className: "w-10 h-10 bg-primary/10 rounded-xl flex items-center justify-center", children: /* @__PURE__ */ e("svg", { className: "w-5 h-5 text-primary", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z" }) }) })
1582
1582
  ] }) }),
1583
- /* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
1584
- /* @__PURE__ */ t("div", { children: [
1585
- /* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: r("analytics.total_threads") }),
1586
- /* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (i.overview.total_threads || 0).toLocaleString(_) })
1583
+ /* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
1584
+ /* @__PURE__ */ r("div", { children: [
1585
+ /* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: t("analytics.total_threads") }),
1586
+ /* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (o.overview.total_threads || 0).toLocaleString(k) })
1587
1587
  ] }),
1588
1588
  /* @__PURE__ */ e("div", { className: "w-10 h-10 bg-primary/10 rounded-xl flex items-center justify-center", children: /* @__PURE__ */ e("svg", { className: "w-5 h-5 text-primary", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }) })
1589
1589
  ] }) }),
1590
- /* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
1591
- /* @__PURE__ */ t("div", { children: [
1592
- /* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: r("analytics.total_messages") }),
1593
- /* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (i.overview.total_messages || 0).toLocaleString(_) })
1590
+ /* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
1591
+ /* @__PURE__ */ r("div", { children: [
1592
+ /* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: t("analytics.total_messages") }),
1593
+ /* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (o.overview.total_messages || 0).toLocaleString(k) })
1594
1594
  ] }),
1595
1595
  /* @__PURE__ */ e("div", { className: "w-10 h-10 bg-primary/10 rounded-xl flex items-center justify-center", children: /* @__PURE__ */ e("svg", { className: "w-5 h-5 text-primary", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z" }) }) })
1596
1596
  ] }) }),
1597
- /* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
1598
- /* @__PURE__ */ t("div", { children: [
1599
- /* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: r("analytics.total_token_usage") }),
1600
- /* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (i.overview.total_token_usage || 0).toLocaleString(_) })
1597
+ /* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
1598
+ /* @__PURE__ */ r("div", { children: [
1599
+ /* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: t("analytics.total_token_usage") }),
1600
+ /* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (o.overview.total_token_usage || 0).toLocaleString(k) })
1601
1601
  ] }),
1602
1602
  /* @__PURE__ */ e("div", { className: "w-10 h-10 bg-primary/10 rounded-xl flex items-center justify-center", children: /* @__PURE__ */ e("svg", { className: "w-5 h-5 text-primary", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }) })
1603
1603
  ] }) })
1604
1604
  ] }),
1605
- /* @__PURE__ */ t("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-5", children: [
1606
- /* @__PURE__ */ t("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
1607
- /* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: r("analytics.threads_chart") }),
1608
- /* @__PURE__ */ t("div", { className: "h-64 flex flex-col", ref: q, children: [
1609
- /* @__PURE__ */ t("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
1610
- /* @__PURE__ */ t("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: (z || 0).toLocaleString(_) }),
1612
- /* @__PURE__ */ e("span", { children: Math.floor((z || 0) / 2).toLocaleString(_) }),
1605
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-5", children: [
1606
+ /* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
1607
+ /* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: t("analytics.threads_chart") }),
1608
+ /* @__PURE__ */ r("div", { className: "h-64 flex flex-col", ref: A, children: [
1609
+ /* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
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) }),
1613
1613
  /* @__PURE__ */ e("span", { children: "0" })
1614
1614
  ] }),
1615
- /* @__PURE__ */ t("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
1616
- /* @__PURE__ */ t("div", { className: "absolute inset-0 pt-6 pointer-events-none", children: [
1615
+ /* @__PURE__ */ r("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
1616
+ /* @__PURE__ */ r("div", { className: "absolute inset-0 pt-6 pointer-events-none", children: [
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
- i.trends.threads.length > 0 ? i.trends.threads.map((l, a) => /* @__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, d) => /* @__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 / z * 100}%` },
1625
- children: /* @__PURE__ */ t("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
- /* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: l.count.toLocaleString(_) }),
1627
- /* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(l.date).toLocaleDateString(R, { month: "short", day: "numeric" }) })
1624
+ style: { height: `${l.count / J * 100}%` },
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
+ /* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: l.count.toLocaleString(k) }),
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
- ) }, a)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: r("no_data") })
1630
+ ) }, d)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
1631
1631
  ] })
1632
1632
  ] }),
1633
- /* @__PURE__ */ t("div", { className: "flex gap-2", dir: "ltr", children: [
1633
+ /* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
1634
1634
  /* @__PURE__ */ e("div", { className: "min-w-[24px] invisible" }),
1635
- N(i.trends.threads)
1635
+ y(o.trends.threads)
1636
1636
  ] })
1637
1637
  ] })
1638
1638
  ] }),
1639
- /* @__PURE__ */ t("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
1640
- /* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: r("analytics.messages_chart") }),
1641
- /* @__PURE__ */ t("div", { className: "h-64 flex flex-col", ref: q, children: [
1642
- /* @__PURE__ */ t("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
1643
- /* @__PURE__ */ t("div", { className: "flex flex-col justify-between text-[10px] text-muted-foreground pt-6 text-right min-w-[24px]", children: [
1644
- /* @__PURE__ */ e("span", { children: (h || 0).toLocaleString(_) }),
1645
- /* @__PURE__ */ e("span", { children: Math.floor((h || 0) / 2).toLocaleString(_) }),
1639
+ /* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
1640
+ /* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: t("analytics.messages_chart") }),
1641
+ /* @__PURE__ */ r("div", { className: "h-64 flex flex-col", ref: A, children: [
1642
+ /* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
1643
+ /* @__PURE__ */ r("div", { className: "flex flex-col justify-between text-[10px] text-muted-foreground pt-6 text-right min-w-[24px]", children: [
1644
+ /* @__PURE__ */ e("span", { children: (h || 0).toLocaleString(k) }),
1645
+ /* @__PURE__ */ e("span", { children: Math.floor((h || 0) / 2).toLocaleString(k) }),
1646
1646
  /* @__PURE__ */ e("span", { children: "0" })
1647
1647
  ] }),
1648
- /* @__PURE__ */ t("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
1649
- /* @__PURE__ */ t("div", { className: "absolute inset-0 pt-6 pointer-events-none", children: [
1648
+ /* @__PURE__ */ r("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
1649
+ /* @__PURE__ */ r("div", { className: "absolute inset-0 pt-6 pointer-events-none", children: [
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
- i.trends.messages.length > 0 ? i.trends.messages.map((l, a) => /* @__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, d) => /* @__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",
1657
1657
  style: { height: `${l.count / h * 100}%` },
1658
- children: /* @__PURE__ */ t("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: [
1659
- /* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: l.count.toLocaleString(_) }),
1660
- /* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(l.date).toLocaleDateString(R, { month: "short", day: "numeric" }) })
1658
+ 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: [
1659
+ /* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: l.count.toLocaleString(k) }),
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
- ) }, a)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: r("no_data") })
1663
+ ) }, d)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
1664
1664
  ] })
1665
1665
  ] }),
1666
- /* @__PURE__ */ t("div", { className: "flex gap-2", dir: "ltr", children: [
1666
+ /* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
1667
1667
  /* @__PURE__ */ e("div", { className: "min-w-[24px] invisible" }),
1668
- N(i.trends.messages)
1668
+ y(o.trends.messages)
1669
1669
  ] })
1670
1670
  ] })
1671
1671
  ] }),
1672
- /* @__PURE__ */ t("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
1673
- /* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: r("analytics.token_usage_chart") }),
1674
- /* @__PURE__ */ t("div", { className: "h-64 flex flex-col", ref: q, children: [
1675
- /* @__PURE__ */ t("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
1676
- /* @__PURE__ */ t("div", { className: "flex flex-col justify-between text-[10px] text-muted-foreground pt-6 text-right min-w-[24px]", children: [
1677
- /* @__PURE__ */ e("span", { children: (F || 0).toLocaleString(_) }),
1678
- /* @__PURE__ */ e("span", { children: Math.floor((F || 0) / 2).toLocaleString(_) }),
1672
+ /* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
1673
+ /* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: t("analytics.token_usage_chart") }),
1674
+ /* @__PURE__ */ r("div", { className: "h-64 flex flex-col", ref: A, children: [
1675
+ /* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
1676
+ /* @__PURE__ */ r("div", { className: "flex flex-col justify-between text-[10px] text-muted-foreground pt-6 text-right min-w-[24px]", children: [
1677
+ /* @__PURE__ */ e("span", { children: (F || 0).toLocaleString(k) }),
1678
+ /* @__PURE__ */ e("span", { children: Math.floor((F || 0) / 2).toLocaleString(k) }),
1679
1679
  /* @__PURE__ */ e("span", { children: "0" })
1680
1680
  ] }),
1681
- /* @__PURE__ */ t("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
1682
- /* @__PURE__ */ t("div", { className: "absolute inset-0 pt-6 pointer-events-none", children: [
1681
+ /* @__PURE__ */ r("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
1682
+ /* @__PURE__ */ r("div", { className: "absolute inset-0 pt-6 pointer-events-none", children: [
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
- i.trends.token_usage.length > 0 ? i.trends.token_usage.map((l, a) => /* @__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, d) => /* @__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",
1690
1690
  style: { height: `${l.tokens / F * 100}%` },
1691
- children: /* @__PURE__ */ t("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: [
1692
- /* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: (l.tokens || 0).toLocaleString(_) }),
1693
- /* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(l.date).toLocaleDateString(R, { month: "short", day: "numeric" }) })
1691
+ 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: [
1692
+ /* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: (l.tokens || 0).toLocaleString(k) }),
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
- ) }, a)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: r("no_data") })
1696
+ ) }, d)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
1697
1697
  ] })
1698
1698
  ] }),
1699
- /* @__PURE__ */ t("div", { className: "flex gap-2", dir: "ltr", children: [
1699
+ /* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
1700
1700
  /* @__PURE__ */ e("div", { className: "min-w-[24px] invisible" }),
1701
- N(i.trends.token_usage)
1701
+ y(o.trends.token_usage)
1702
1702
  ] })
1703
1703
  ] })
1704
1704
  ] }),
1705
- /* @__PURE__ */ t("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
1706
- /* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: r("analytics.feedback") }),
1707
- /* @__PURE__ */ e("div", { className: "h-64 flex flex-col justify-center", children: i.distributions.feedback_sentiment.length > 0 ? /* @__PURE__ */ t("div", { className: "flex flex-col md:flex-row items-center justify-center gap-8 lg:gap-12", children: [
1708
- /* @__PURE__ */ t("div", { className: "relative w-56 h-56 lg:w-60 lg:h-60", children: [
1705
+ /* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
1706
+ /* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: t("analytics.feedback") }),
1707
+ /* @__PURE__ */ e("div", { className: "h-64 flex flex-col justify-center", children: o.distributions.feedback_sentiment.length > 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row items-center justify-center gap-8 lg:gap-12", children: [
1708
+ /* @__PURE__ */ r("div", { className: "relative w-56 h-56 lg:w-60 lg:h-60", children: [
1709
1709
  /* @__PURE__ */ e("svg", { viewBox: "0 0 100 100", className: "w-full h-full -rotate-90 drop-shadow-md", children: (() => {
1710
- const l = i.distributions.feedback_sentiment.filter(
1711
- (x) => x.sentiment === "positive" || x.sentiment === "negative"
1712
- ), a = l.reduce((x, L) => x + L.count, 0);
1713
- if (a === 0) return null;
1714
- const u = l.find((x) => x.sentiment === "positive")?.count || 0, k = l.find((x) => x.sentiment === "negative")?.count || 0, m = 40, j = 2 * Math.PI * m, M = u / a * 100, s = k / a * 100;
1715
- return /* @__PURE__ */ t(De, { children: [
1710
+ const l = o.distributions.feedback_sentiment.filter(
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;
1715
+ return /* @__PURE__ */ r(De, { children: [
1716
1716
  /* @__PURE__ */ e(
1717
1717
  "circle",
1718
1718
  {
@@ -1725,12 +1725,12 @@ function xt() {
1725
1725
  className: "text-muted"
1726
1726
  }
1727
1727
  ),
1728
- /* @__PURE__ */ t("defs", { children: [
1729
- /* @__PURE__ */ t("linearGradient", { id: "posGradient", x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
1728
+ /* @__PURE__ */ r("defs", { children: [
1729
+ /* @__PURE__ */ r("linearGradient", { id: "posGradient", x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
1730
1730
  /* @__PURE__ */ e("stop", { offset: "0%", stopColor: "var(--primary)", stopOpacity: "0.8" }),
1731
1731
  /* @__PURE__ */ e("stop", { offset: "100%", stopColor: "var(--primary)" })
1732
1732
  ] }),
1733
- /* @__PURE__ */ t("linearGradient", { id: "negGradient", x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
1733
+ /* @__PURE__ */ r("linearGradient", { id: "negGradient", x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
1734
1734
  /* @__PURE__ */ e("stop", { offset: "0%", stopColor: "var(--destructive)", stopOpacity: "0.8" }),
1735
1735
  /* @__PURE__ */ e("stop", { offset: "100%", stopColor: "var(--destructive)" })
1736
1736
  ] })
@@ -1766,78 +1766,78 @@ function xt() {
1766
1766
  )
1767
1767
  ] });
1768
1768
  })() }),
1769
- /* @__PURE__ */ t("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: i.distributions.feedback_sentiment.filter((l) => l.sentiment === "positive" || l.sentiment === "negative").reduce((l, a) => l + (a.count || 0), 0).toLocaleString(_) }),
1771
- /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground uppercase tracking-widest mt-1", children: r("analytics.total_feedback") })
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) }),
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: [...i.distributions.feedback_sentiment].filter((l) => l.sentiment === "positive" || l.sentiment === "negative").sort((l, a) => l.sentiment === "positive" ? -1 : 1).map((l) => {
1775
- const u = i.distributions.feedback_sentiment.filter(
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) => {
1775
+ const i = o.distributions.feedback_sentiment.filter(
1776
1776
  (s) => s.sentiment === "positive" || s.sentiment === "negative"
1777
- ).reduce((s, x) => s + x.count, 0), k = u > 0 ? l.count / u * 100 : 0, m = l.sentiment === "positive" ? r("analytics.positive") : r("analytics.negative"), j = l.sentiment === "positive" ? "bg-primary" : "bg-destructive", M = l.sentiment === "positive" ? "👍" : "👎";
1778
- return /* @__PURE__ */ t("div", { className: "flex items-center justify-between gap-6 group", children: [
1779
- /* @__PURE__ */ t("div", { className: "flex items-center gap-3", children: [
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" ? "👍" : "👎";
1778
+ return /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-6 group", children: [
1779
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
1780
1780
  /* @__PURE__ */ e("div", { className: `w-3 h-3 rounded-full ${j} shadow-sm group-hover:scale-110 transition-transform` }),
1781
- /* @__PURE__ */ t("span", { className: "text-sm text-muted-foreground font-medium", children: [
1781
+ /* @__PURE__ */ r("span", { className: "text-sm text-muted-foreground font-medium", children: [
1782
1782
  m,
1783
1783
  " ",
1784
1784
  M
1785
1785
  ] })
1786
1786
  ] }),
1787
- /* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
1788
- /* @__PURE__ */ t("span", { className: "text-sm font-semibold text-foreground bg-muted/50 px-2.5 py-1 rounded-lg min-w-[50px] text-center", children: [
1789
- (k || 0).toLocaleString(_, { maximumFractionDigits: 0 }),
1787
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
1788
+ /* @__PURE__ */ r("span", { className: "text-sm font-semibold text-foreground bg-muted/50 px-2.5 py-1 rounded-lg min-w-[50px] text-center", children: [
1789
+ (f || 0).toLocaleString(k, { maximumFractionDigits: 0 }),
1790
1790
  "%"
1791
1791
  ] }),
1792
- /* @__PURE__ */ t("span", { className: "text-[13px] font-normal text-muted-foreground w-12 text-right", children: [
1792
+ /* @__PURE__ */ r("span", { className: "text-[13px] font-normal text-muted-foreground w-12 text-right", children: [
1793
1793
  "(",
1794
- (l.count || 0).toLocaleString(_),
1794
+ (l.count || 0).toLocaleString(k),
1795
1795
  ")"
1796
1796
  ] })
1797
1797
  ] })
1798
1798
  ] }, l.sentiment);
1799
1799
  }) })
1800
- ] }) : /* @__PURE__ */ e("p", { className: "text-center text-muted-foreground py-8", children: r("no_data") }) })
1800
+ ] }) : /* @__PURE__ */ e("p", { className: "text-center text-muted-foreground py-8", children: t("no_data") }) })
1801
1801
  ] })
1802
1802
  ] }),
1803
- /* @__PURE__ */ e("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-5", children: /* @__PURE__ */ t("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
1804
- /* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: r("analytics.active_users") }),
1805
- /* @__PURE__ */ e("div", { className: "space-y-2.5", children: i.active_users.length > 0 ? i.active_users.map((l) => /* @__PURE__ */ t(
1803
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-5", children: /* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
1804
+ /* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: t("analytics.active_users") }),
1805
+ /* @__PURE__ */ e("div", { className: "space-y-2.5", children: o.active_users.length > 0 ? o.active_users.map((l) => /* @__PURE__ */ r(
1806
1806
  "div",
1807
1807
  {
1808
1808
  className: "flex items-center justify-between p-3 bg-muted/30 rounded-xl hover:bg-muted/50 transition-colors",
1809
1809
  children: [
1810
- /* @__PURE__ */ t("div", { className: "flex items-center gap-3", children: [
1810
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
1811
1811
  /* @__PURE__ */ e("div", { className: "w-9 h-9 rounded-full bg-primary/10 flex items-center justify-center text-primary text-sm font-medium", children: l.name.charAt(0) }),
1812
1812
  /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("p", { className: "text-sm font-medium text-foreground", children: l.name }) })
1813
1813
  ] }),
1814
- /* @__PURE__ */ t("div", { className: "text-sm font-semibold text-primary", children: [
1815
- (l.thread_count || 0).toLocaleString(_),
1814
+ /* @__PURE__ */ r("div", { className: "text-sm font-semibold text-primary", children: [
1815
+ (l.thread_count || 0).toLocaleString(k),
1816
1816
  " ",
1817
- r("analytics.threads")
1817
+ t("analytics.threads")
1818
1818
  ] })
1819
1819
  ]
1820
1820
  },
1821
1821
  l.user_id
1822
- )) : /* @__PURE__ */ e("p", { className: "text-center text-muted-foreground py-8", children: r("no_data") }) })
1822
+ )) : /* @__PURE__ */ e("p", { className: "text-center text-muted-foreground py-8", children: t("no_data") }) })
1823
1823
  ] }) })
1824
1824
  ] });
1825
1825
  }
1826
- function G({ className: r, ...n }) {
1826
+ function X({ className: t, ...a }) {
1827
1827
  return /* @__PURE__ */ e(
1828
- qe.Root,
1828
+ je.Root,
1829
1829
  {
1830
1830
  "data-slot": "switch",
1831
- className: xe(
1831
+ className: be(
1832
1832
  "peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
1833
- r
1833
+ t
1834
1834
  ),
1835
- ...n,
1835
+ ...a,
1836
1836
  children: /* @__PURE__ */ e(
1837
- qe.Thumb,
1837
+ je.Thumb,
1838
1838
  {
1839
1839
  "data-slot": "switch-thumb",
1840
- className: xe(
1840
+ className: be(
1841
1841
  "bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] rtl:data-[state=checked]:-translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
1842
1842
  )
1843
1843
  }
@@ -1846,452 +1846,592 @@ function G({ className: r, ...n }) {
1846
1846
  );
1847
1847
  }
1848
1848
  function bt() {
1849
- const { t: r, i18n: n } = Q(["admin", "translation"]), { app: i, welcome: c, disclaimer: g, history: p, threadActions: w, composer: b } = le(), [v, D] = f(!1), [T, $] = f(!1), [q, C] = f(""), [_, R] = f(""), [A, N] = f("fa"), [I, E] = f("translation"), [H, B] = f("{}"), [J, z] = f(""), [h, F] = f(!1), l = ie(() => ({
1850
- app_name: i?.name || "Gentiq",
1851
- admin_title: i?.adminTitle || "",
1852
- welcome_greeting: c?.greeting || "",
1853
- welcome_subtitle: c?.subtitle || "",
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(() => ({
1850
+ app_name: o?.name || "Gentiq",
1851
+ admin_title: o?.adminTitle || "",
1852
+ welcome_greeting: u?.greeting || "",
1853
+ welcome_subtitle: u?.subtitle || "",
1854
1854
  disclaimer: typeof g == "string" ? g : "",
1855
- show_tool_details: i?.showToolDetails ?? !0,
1856
- show_settings: i?.showSettings ?? !0,
1857
- composer_attachments: b?.attachments?.enabled ?? !0,
1858
- thread_actions_feedback: w?.feedback ?? !0,
1859
- thread_actions_retry: w?.retry ?? !0,
1855
+ show_tool_details: o?.showToolDetails ?? !0,
1856
+ show_settings: o?.showSettings ?? !0,
1857
+ composer_attachments: N?.attachments?.enabled ?? !0,
1858
+ thread_actions_feedback: _?.feedback ?? !0,
1859
+ thread_actions_retry: _?.retry ?? !0,
1860
1860
  history_enabled: p?.enabled ?? !0,
1861
1861
  history_show_delete: p?.showDelete ?? !0,
1862
1862
  history_show_rename: p?.showRename ?? !0,
1863
1863
  history_show_share: p?.showShare ?? !0,
1864
1864
  history_show_pin: p?.showPin ?? !0,
1865
- language: n.language || "fa",
1865
+ settings_general_mode: o?.settingsGeneralMode || "editable",
1866
+ settings_profile_mode: o?.settingsProfileMode || "editable",
1867
+ settings_account_mode: o?.settingsAccountMode || "editable",
1868
+ settings_general_fields: v?.sections?.general?.fields || {},
1869
+ settings_profile_fields: v?.sections?.profile?.fields || {},
1870
+ settings_account_fields: v?.sections?.account?.fields || {},
1871
+ language: a.language || "fa",
1866
1872
  translations: {}
1867
- }), [i, c, g, p, w, b, n.language]), [a, u] = f(l), k = n.language === "fa";
1868
- W(() => {
1873
+ }), [o, u, g, p, _, N, a.language, v]), [i, f] = x(d), m = a.language === "fa";
1874
+ G(() => {
1869
1875
  (async () => {
1870
- D(!0);
1876
+ T(!0);
1871
1877
  try {
1872
- const O = await y.getSettings();
1873
- if (O && Object.keys(O).length > 0) {
1874
- const V = JSON.parse(JSON.stringify(n.store.data));
1875
- O.translations && Object.keys(O.translations).forEach((ee) => {
1876
- V[ee] || (V[ee] = {}), Object.assign(V[ee], O.translations[ee]);
1877
- }), u((ee) => ({
1878
- ...ee,
1879
- ...O,
1880
- translations: V
1878
+ const C = await w.getSettings();
1879
+ if (C && Object.keys(C).length > 0) {
1880
+ const z = JSON.parse(JSON.stringify(a.store.data));
1881
+ C.translations && Object.keys(C.translations).forEach((re) => {
1882
+ z[re] || (z[re] = {}), Object.assign(z[re], C.translations[re]);
1883
+ }), f((re) => ({
1884
+ ...re,
1885
+ ...C,
1886
+ translations: z
1881
1887
  }));
1882
1888
  } else {
1883
- const V = { ...l, translations: n.store.data };
1884
- u(V), O || y.updateSettings(V).catch(console.error);
1889
+ const z = { ...d, translations: a.store.data };
1890
+ f(z), C || w.updateSettings(z).catch(console.error);
1885
1891
  }
1886
- } catch (O) {
1887
- console.error("Failed to fetch settings", O), C(r("app_settings.save_error"));
1892
+ } catch (C) {
1893
+ console.error("Failed to fetch settings", C), k(t("app_settings.save_error"));
1888
1894
  } finally {
1889
- D(!1);
1895
+ T(!1);
1890
1896
  }
1891
1897
  })();
1892
- }, [r, l, n.store.data]);
1893
- const m = async (d) => {
1894
- d && d.preventDefault(), $(!0), R(""), C("");
1898
+ }, [t, d, a.store.data]);
1899
+ const j = async (c) => {
1900
+ c && c.preventDefault(), A(!0), E(""), k("");
1895
1901
  try {
1896
- await y.updateSettings(a), R(r("app_settings.save_success")), setTimeout(() => R(""), 3e3);
1897
- } catch (O) {
1898
- C(O instanceof Error ? O.message : r("app_settings.save_error"));
1902
+ await w.updateSettings(i), E(t("app_settings.save_success")), setTimeout(() => E(""), 3e3);
1903
+ } catch (C) {
1904
+ k(C instanceof Error ? C.message : t("app_settings.save_error"));
1899
1905
  } finally {
1900
- $(!1);
1906
+ A(!1);
1901
1907
  }
1902
- }, j = async () => {
1903
- D(!0), C("");
1908
+ }, M = async () => {
1909
+ T(!0), k("");
1904
1910
  try {
1905
- await y.resetSettings(), F(!1), window.location.reload();
1906
- } catch (d) {
1907
- C(d instanceof Error ? d.message : r("app_settings.save_error"));
1911
+ await w.resetSettings(), l(!1), window.location.reload();
1912
+ } catch (c) {
1913
+ k(c instanceof Error ? c.message : t("app_settings.save_error"));
1908
1914
  } finally {
1909
- D(!1);
1915
+ T(!1);
1910
1916
  }
1911
1917
  };
1912
- W(() => {
1913
- const d = a.translations?.[A]?.[I] || {};
1914
- B(JSON.stringify(d, null, 2)), z("");
1915
- }, [A, I, a.translations]);
1916
- const M = (d) => {
1917
- B(d);
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);
1918
1924
  try {
1919
- const O = JSON.parse(d);
1920
- u((V) => ({
1921
- ...V,
1925
+ const C = JSON.parse(c);
1926
+ f((z) => ({
1927
+ ...z,
1922
1928
  translations: {
1923
- ...V.translations,
1924
- [A]: {
1925
- ...V.translations?.[A],
1926
- [I]: O
1929
+ ...z.translations,
1930
+ [y]: {
1931
+ ...z.translations?.[y],
1932
+ [$]: C
1927
1933
  }
1928
1934
  }
1929
- })), z("");
1935
+ })), h("");
1930
1936
  } catch {
1931
- z("Invalid JSON format");
1937
+ h("Invalid JSON format");
1932
1938
  }
1933
- }, s = ({ title: d, icon: O }) => /* @__PURE__ */ t("div", { className: "relative py-12", children: [
1939
+ }, b = ({ title: c, icon: C }) => /* @__PURE__ */ r("div", { className: "relative py-12", children: [
1934
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" }) }),
1935
- /* @__PURE__ */ e("div", { className: "relative flex justify-center", children: /* @__PURE__ */ t("span", { className: "bg-background px-6 text-sm font-bold text-muted-foreground uppercase tracking-[0.2em] flex items-center gap-3", children: [
1936
- /* @__PURE__ */ e(O, { className: "size-4 text-primary/60" }),
1937
- d
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
+ /* @__PURE__ */ e(C, { className: "size-4 text-primary/60" }),
1943
+ c
1938
1944
  ] }) })
1939
- ] }), x = ({ value: d }) => {
1940
- if (!d || !d.includes(":") && !d.includes(".")) return null;
1941
- const O = r(d);
1942
- return O === d ? null : /* @__PURE__ */ t("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: [
1943
- /* @__PURE__ */ t("span", { className: "text-[10px] font-bold text-primary/60 uppercase tracking-tighter", children: [
1944
- r("app_settings.preview", { defaultValue: "Preview" }),
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: [
1949
+ /* @__PURE__ */ r("span", { className: "text-[10px] font-bold text-primary/60 uppercase tracking-tighter", children: [
1950
+ t("app_settings.preview", { defaultValue: "Preview" }),
1945
1951
  ":"
1946
1952
  ] }),
1947
- /* @__PURE__ */ e("span", { className: "text-[11px] font-medium text-foreground/70", children: O })
1953
+ /* @__PURE__ */ e("span", { className: "text-[11px] font-medium text-foreground/70", children: C })
1948
1954
  ] });
1949
- }, L = () => {
1950
- const d = prompt("Enter language code (e.g. en, fa, fr):");
1951
- d && !a.translations?.[d] && (u((O) => ({
1952
- ...O,
1955
+ }, H = () => {
1956
+ const c = prompt("Enter language code (e.g. en, fa, fr):");
1957
+ c && !i.translations?.[c] && (f((C) => ({
1958
+ ...C,
1953
1959
  translations: {
1954
- ...O.translations,
1955
- [d]: {}
1960
+ ...C.translations,
1961
+ [c]: {}
1956
1962
  }
1957
- })), N(d));
1958
- }, P = () => {
1959
- const d = prompt("Enter namespace (e.g. chat, admin):");
1960
- d && !a.translations?.[A]?.[d] && (u((O) => ({
1961
- ...O,
1963
+ })), D(c));
1964
+ }, V = () => {
1965
+ const c = prompt("Enter namespace (e.g. chat, admin):");
1966
+ c && !i.translations?.[y]?.[c] && (f((C) => ({
1967
+ ...C,
1962
1968
  translations: {
1963
- ...O.translations,
1964
- [A]: {
1965
- ...O.translations?.[A],
1966
- [d]: {}
1969
+ ...C.translations,
1970
+ [y]: {
1971
+ ...C.translations?.[y],
1972
+ [c]: {}
1967
1973
  }
1968
1974
  }
1969
- })), E(d));
1975
+ })), P(c));
1970
1976
  };
1971
- return v ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center", children: /* @__PURE__ */ t("div", { className: "flex flex-col items-center gap-3", children: [
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: [
1972
1978
  /* @__PURE__ */ e("div", { className: "w-10 h-10 border-3 border-primary/20 border-t-primary rounded-full animate-spin" }),
1973
- /* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground font-medium", children: r("loading") })
1974
- ] }) }) : /* @__PURE__ */ t("div", { className: "h-full flex flex-col overflow-hidden", dir: k ? "rtl" : "ltr", children: [
1975
- /* @__PURE__ */ t("div", { className: "px-8 py-6 border-b border-border bg-background/50 backdrop-blur-md z-20 flex items-center justify-between flex-shrink-0", children: [
1976
- /* @__PURE__ */ t("div", { className: "flex flex-col gap-1", children: [
1977
- /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight", children: r("app_settings.title") }),
1978
- /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: r("app_settings.subtitle") })
1979
+ /* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground font-medium", children: t("loading") })
1980
+ ] }) }) : /* @__PURE__ */ r("div", { className: "h-full flex flex-col overflow-hidden", dir: m ? "rtl" : "ltr", children: [
1981
+ /* @__PURE__ */ r("div", { className: "px-8 py-6 border-b border-border bg-background/50 backdrop-blur-md z-20 flex items-center justify-between flex-shrink-0", children: [
1982
+ /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
1983
+ /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight", children: t("app_settings.title") }),
1984
+ /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("app_settings.subtitle") })
1979
1985
  ] }),
1980
- /* @__PURE__ */ t("div", { className: "flex items-center gap-4", children: [
1981
- /* @__PURE__ */ t(Ue, { open: h, onOpenChange: F, children: [
1982
- /* @__PURE__ */ e(Fe, { asChild: !0, children: /* @__PURE__ */ t(
1986
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-4", children: [
1987
+ /* @__PURE__ */ r(Ue, { open: F, onOpenChange: l, children: [
1988
+ /* @__PURE__ */ e(Fe, { asChild: !0, children: /* @__PURE__ */ r(
1983
1989
  "button",
1984
1990
  {
1985
1991
  type: "button",
1986
1992
  className: "px-4 py-2 bg-muted/20 text-muted-foreground hover:bg-muted/40 rounded-xl text-xs font-bold transition-all flex items-center gap-2 border border-border/50",
1987
1993
  children: [
1988
- /* @__PURE__ */ e(Ce, { className: "size-3.5" }),
1989
- r("app_settings.reset_button", { defaultValue: "Reset to Defaults" })
1994
+ /* @__PURE__ */ e(Le, { className: "size-3.5" }),
1995
+ t("app_settings.reset_button", { defaultValue: "Reset to Defaults" })
1990
1996
  ]
1991
1997
  }
1992
1998
  ) }),
1993
- /* @__PURE__ */ t(ze, { children: [
1994
- /* @__PURE__ */ t(Je, { children: [
1995
- /* @__PURE__ */ e(Pe, { children: r("app_settings.reset_confirm_title") }),
1996
- /* @__PURE__ */ e(He, { children: r("app_settings.reset_confirm_description") })
1999
+ /* @__PURE__ */ r(ze, { children: [
2000
+ /* @__PURE__ */ r(Je, { children: [
2001
+ /* @__PURE__ */ e(Pe, { children: t("app_settings.reset_confirm_title") }),
2002
+ /* @__PURE__ */ e(He, { children: t("app_settings.reset_confirm_description") })
1997
2003
  ] }),
1998
- /* @__PURE__ */ t(Be, { children: [
1999
- /* @__PURE__ */ e(We, { asChild: !0, children: /* @__PURE__ */ e(oe, { variant: "ghost", children: r("cancel") }) }),
2000
- /* @__PURE__ */ e(oe, { variant: "destructive", onClick: j, children: r("app_settings.reset_button") })
2004
+ /* @__PURE__ */ r(Be, { children: [
2005
+ /* @__PURE__ */ e(Ve, { asChild: !0, children: /* @__PURE__ */ e(me, { variant: "ghost", children: t("cancel") }) }),
2006
+ /* @__PURE__ */ e(me, { variant: "destructive", onClick: M, children: t("app_settings.reset_button") })
2001
2007
  ] })
2002
2008
  ] })
2003
2009
  ] }),
2004
- /* @__PURE__ */ t(
2010
+ /* @__PURE__ */ r(
2005
2011
  "button",
2006
2012
  {
2007
2013
  type: "submit",
2008
2014
  form: "settings-form",
2009
- disabled: T,
2015
+ disabled: I,
2010
2016
  className: "px-8 py-2.5 bg-primary text-primary-foreground rounded-xl text-sm font-bold hover:opacity-90 transition-all shadow-md hover:shadow-lg disabled:opacity-50 flex items-center gap-2",
2011
2017
  children: [
2012
- T && /* @__PURE__ */ e("div", { className: "w-4 h-4 border-2 border-primary-foreground/20 border-t-primary-foreground rounded-full animate-spin" }),
2013
- r(T ? "saving" : "app_settings.save")
2018
+ I && /* @__PURE__ */ e("div", { className: "w-4 h-4 border-2 border-primary-foreground/20 border-t-primary-foreground rounded-full animate-spin" }),
2019
+ t(I ? "saving" : "app_settings.save")
2014
2020
  ]
2015
2021
  }
2016
2022
  )
2017
2023
  ] })
2018
2024
  ] }),
2019
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto custom-scrollbar", children: /* @__PURE__ */ t("div", { className: "max-w-4xl mx-auto py-10 px-8", children: [
2020
- (q || _) && /* @__PURE__ */ e("div", { className: `mb-12 px-4 py-3 rounded-xl text-sm border animate-in fade-in slide-in-from-top-1 duration-300 ${q ? "bg-destructive/10 border-destructive/20 text-destructive" : "bg-green-500/10 border-green-500/20 text-green-600 dark:text-green-400"}`, children: q || _ }),
2021
- /* @__PURE__ */ t("form", { id: "settings-form", onSubmit: m, className: "space-y-16 animate-in fade-in slide-in-from-bottom-2 duration-500", children: [
2022
- /* @__PURE__ */ t("section", { children: [
2023
- /* @__PURE__ */ e(s, { title: r("app_settings.sections.general"), icon: fe }),
2024
- /* @__PURE__ */ t("div", { className: "p-2 space-y-10", children: [
2025
- /* @__PURE__ */ t("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
2026
- /* @__PURE__ */ t("div", { className: "space-y-2", children: [
2027
- /* @__PURE__ */ e(Z, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: r("app_settings.general.app_name") }),
2025
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto custom-scrollbar", children: /* @__PURE__ */ r("div", { className: "max-w-4xl mx-auto py-10 px-8", children: [
2026
+ (q || U) && /* @__PURE__ */ e("div", { className: `mb-12 px-4 py-3 rounded-xl text-sm border animate-in fade-in slide-in-from-top-1 duration-300 ${q ? "bg-destructive/10 border-destructive/20 text-destructive" : "bg-green-500/10 border-green-500/20 text-green-600 dark:text-green-400"}`, children: q || U }),
2027
+ /* @__PURE__ */ r("form", { id: "settings-form", onSubmit: j, className: "space-y-16 animate-in fade-in slide-in-from-bottom-2 duration-500", children: [
2028
+ /* @__PURE__ */ r("section", { children: [
2029
+ /* @__PURE__ */ e(b, { title: t("app_settings.sections.general"), icon: xe }),
2030
+ /* @__PURE__ */ r("div", { className: "p-2 space-y-10", children: [
2031
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
2032
+ /* @__PURE__ */ r("div", { className: "space-y-2", children: [
2033
+ /* @__PURE__ */ e(Z, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.general.app_name") }),
2028
2034
  /* @__PURE__ */ e(
2029
- de,
2035
+ pe,
2030
2036
  {
2031
2037
  type: "text",
2032
- value: a.app_name,
2033
- onChange: (d) => u({ ...a, app_name: d.target.value }),
2038
+ value: i.app_name,
2039
+ onChange: (c) => f({ ...i, app_name: c.target.value }),
2034
2040
  className: "bg-muted/20 border-transparent focus:bg-background h-11",
2035
2041
  placeholder: "Gentiq AI",
2036
2042
  dir: "auto"
2037
2043
  }
2038
2044
  ),
2039
- /* @__PURE__ */ e(x, { value: a.app_name })
2045
+ /* @__PURE__ */ e(S, { value: i.app_name })
2040
2046
  ] }),
2041
- /* @__PURE__ */ t("div", { className: "space-y-2", children: [
2042
- /* @__PURE__ */ e(Z, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: r("app_settings.general.admin_title") }),
2047
+ /* @__PURE__ */ r("div", { className: "space-y-2", children: [
2048
+ /* @__PURE__ */ e(Z, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.general.admin_title") }),
2043
2049
  /* @__PURE__ */ e(
2044
- de,
2050
+ pe,
2045
2051
  {
2046
2052
  type: "text",
2047
- value: a.admin_title || "",
2048
- onChange: (d) => u({ ...a, admin_title: d.target.value }),
2053
+ value: i.admin_title || "",
2054
+ onChange: (c) => f({ ...i, admin_title: c.target.value }),
2049
2055
  className: "bg-muted/20 border-transparent focus:bg-background h-11",
2050
2056
  placeholder: "Gentiq Admin",
2051
2057
  dir: "auto"
2052
2058
  }
2053
2059
  ),
2054
- /* @__PURE__ */ e(x, { value: a.admin_title || "" })
2060
+ /* @__PURE__ */ e(S, { value: i.admin_title || "" })
2055
2061
  ] })
2056
2062
  ] }),
2057
- /* @__PURE__ */ t("div", { className: "space-y-2", children: [
2058
- /* @__PURE__ */ e(Z, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: r("app_settings.general.language") }),
2059
- /* @__PURE__ */ t(
2060
- ce,
2063
+ /* @__PURE__ */ r("div", { className: "space-y-2", children: [
2064
+ /* @__PURE__ */ e(Z, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.general.language") }),
2065
+ /* @__PURE__ */ r(
2066
+ ae,
2061
2067
  {
2062
- value: a.language,
2063
- onValueChange: (d) => u({ ...a, language: d }),
2068
+ value: i.language,
2069
+ onValueChange: (c) => f({ ...i, language: c }),
2064
2070
  children: [
2065
- /* @__PURE__ */ e(me, { className: "bg-muted/20 border-transparent focus:bg-background h-11 w-full flex-row-reverse justify-end gap-3", children: /* @__PURE__ */ e(ue, {}) }),
2066
- /* @__PURE__ */ t(he, { children: [
2067
- /* @__PURE__ */ e(ne, { value: "fa", children: "فارسی (Persian)" }),
2068
- /* @__PURE__ */ e(ne, { value: "en", children: "English" })
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
+ /* @__PURE__ */ r(ie, { children: [
2073
+ /* @__PURE__ */ e(W, { value: "fa", children: "فارسی (Persian)" }),
2074
+ /* @__PURE__ */ e(W, { value: "en", children: "English" })
2069
2075
  ] })
2070
2076
  ]
2071
2077
  }
2072
2078
  ),
2073
- /* @__PURE__ */ t("p", { className: "mt-3 text-[10px] text-muted-foreground/50 italic flex items-center gap-1.5 ml-1", children: [
2074
- /* @__PURE__ */ e(Ce, { className: "size-3" }),
2075
- r("app_settings.general.language_help")
2079
+ /* @__PURE__ */ r("p", { className: "mt-3 text-[10px] text-muted-foreground/50 italic flex items-center gap-1.5 ml-1", children: [
2080
+ /* @__PURE__ */ e(Le, { className: "size-3" }),
2081
+ t("app_settings.general.language_help")
2076
2082
  ] })
2077
2083
  ] })
2078
2084
  ] })
2079
2085
  ] }),
2080
- /* @__PURE__ */ t("section", { children: [
2081
- /* @__PURE__ */ e(s, { title: r("app_settings.sections.chat"), icon: at }),
2082
- /* @__PURE__ */ t("div", { className: "p-2 space-y-10", children: [
2083
- /* @__PURE__ */ t("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
2084
- /* @__PURE__ */ t("div", { className: "space-y-2", children: [
2085
- /* @__PURE__ */ e(Z, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: r("app_settings.chat.welcome_greeting") }),
2086
+ /* @__PURE__ */ r("section", { children: [
2087
+ /* @__PURE__ */ e(b, { title: t("app_settings.sections.chat"), icon: at }),
2088
+ /* @__PURE__ */ r("div", { className: "p-2 space-y-10", children: [
2089
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
2090
+ /* @__PURE__ */ r("div", { className: "space-y-2", children: [
2091
+ /* @__PURE__ */ e(Z, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.chat.welcome_greeting") }),
2086
2092
  /* @__PURE__ */ e(
2087
- de,
2093
+ pe,
2088
2094
  {
2089
2095
  type: "text",
2090
- value: a.welcome_greeting || "",
2091
- onChange: (d) => u({ ...a, welcome_greeting: d.target.value }),
2096
+ value: i.welcome_greeting || "",
2097
+ onChange: (c) => f({ ...i, welcome_greeting: c.target.value }),
2092
2098
  className: "bg-muted/20 border-transparent focus:bg-background h-11",
2093
2099
  placeholder: "e.g. chat:welcome",
2094
2100
  dir: "auto"
2095
2101
  }
2096
2102
  ),
2097
- /* @__PURE__ */ e(x, { value: a.welcome_greeting || "" })
2103
+ /* @__PURE__ */ e(S, { value: i.welcome_greeting || "" })
2098
2104
  ] }),
2099
- /* @__PURE__ */ t("div", { className: "space-y-2", children: [
2100
- /* @__PURE__ */ e(Z, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: r("app_settings.chat.welcome_subtitle") }),
2105
+ /* @__PURE__ */ r("div", { className: "space-y-2", children: [
2106
+ /* @__PURE__ */ e(Z, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.chat.welcome_subtitle") }),
2101
2107
  /* @__PURE__ */ e(
2102
- de,
2108
+ pe,
2103
2109
  {
2104
2110
  type: "text",
2105
- value: a.welcome_subtitle || "",
2106
- onChange: (d) => u({ ...a, welcome_subtitle: d.target.value }),
2111
+ value: i.welcome_subtitle || "",
2112
+ onChange: (c) => f({ ...i, welcome_subtitle: c.target.value }),
2107
2113
  className: "bg-muted/20 border-transparent focus:bg-background h-11",
2108
2114
  dir: "auto"
2109
2115
  }
2110
2116
  ),
2111
- /* @__PURE__ */ e(x, { value: a.welcome_subtitle || "" })
2117
+ /* @__PURE__ */ e(S, { value: i.welcome_subtitle || "" })
2112
2118
  ] })
2113
2119
  ] }),
2114
- /* @__PURE__ */ t("div", { className: "space-y-2", children: [
2115
- /* @__PURE__ */ e(Z, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: r("app_settings.chat.disclaimer") }),
2120
+ /* @__PURE__ */ r("div", { className: "space-y-2", children: [
2121
+ /* @__PURE__ */ e(Z, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.chat.disclaimer") }),
2116
2122
  /* @__PURE__ */ e(
2117
- _e,
2123
+ Se,
2118
2124
  {
2119
- value: a.disclaimer || "",
2120
- onChange: (d) => u({ ...a, disclaimer: d.target.value }),
2125
+ value: i.disclaimer || "",
2126
+ onChange: (c) => f({ ...i, disclaimer: c.target.value }),
2121
2127
  className: "bg-muted/20 border-transparent focus:bg-background min-h-[120px] py-4 resize-none leading-relaxed",
2122
2128
  dir: "auto"
2123
2129
  }
2124
2130
  ),
2125
- /* @__PURE__ */ e(x, { value: a.disclaimer || "" })
2131
+ /* @__PURE__ */ e(S, { value: i.disclaimer || "" })
2126
2132
  ] }),
2127
- /* @__PURE__ */ t("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-6 pt-2", children: [
2128
- /* @__PURE__ */ t("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors", children: [
2129
- /* @__PURE__ */ t("div", { className: "flex-1", children: [
2130
- /* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: r("app_settings.chat.show_tool_details") }),
2131
- /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: r("app_settings.chat.show_tool_details_help") })
2133
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-6 pt-2", children: [
2134
+ /* @__PURE__ */ r("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors", children: [
2135
+ /* @__PURE__ */ r("div", { className: "flex-1", children: [
2136
+ /* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: t("app_settings.chat.show_tool_details") }),
2137
+ /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.show_tool_details_help") })
2132
2138
  ] }),
2133
2139
  /* @__PURE__ */ e(
2134
- G,
2140
+ X,
2135
2141
  {
2136
- checked: a.show_tool_details,
2137
- onCheckedChange: (d) => u({ ...a, show_tool_details: d })
2142
+ checked: i.show_tool_details,
2143
+ onCheckedChange: (c) => f({ ...i, show_tool_details: c })
2138
2144
  }
2139
2145
  )
2140
2146
  ] }),
2141
- /* @__PURE__ */ t("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors", children: [
2142
- /* @__PURE__ */ t("div", { className: "flex-1", children: [
2143
- /* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: r("app_settings.chat.show_settings") }),
2144
- /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: r("app_settings.chat.show_settings_help") })
2147
+ /* @__PURE__ */ r("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors", children: [
2148
+ /* @__PURE__ */ r("div", { className: "flex-1", children: [
2149
+ /* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: t("app_settings.chat.show_settings") }),
2150
+ /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.show_settings_help") })
2145
2151
  ] }),
2146
2152
  /* @__PURE__ */ e(
2147
- G,
2153
+ X,
2148
2154
  {
2149
- checked: a.show_settings,
2150
- onCheckedChange: (d) => u({ ...a, show_settings: d })
2155
+ checked: i.show_settings,
2156
+ onCheckedChange: (c) => f({ ...i, show_settings: c })
2151
2157
  }
2152
2158
  )
2153
2159
  ] }),
2154
- /* @__PURE__ */ t("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors", children: [
2155
- /* @__PURE__ */ t("div", { className: "flex-1", children: [
2156
- /* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: r("app_settings.chat.composer_attachments") }),
2157
- /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: r("app_settings.chat.composer_attachments_help") })
2160
+ /* @__PURE__ */ r("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors", children: [
2161
+ /* @__PURE__ */ r("div", { className: "flex-1", children: [
2162
+ /* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: t("app_settings.chat.composer_attachments") }),
2163
+ /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.composer_attachments_help") })
2158
2164
  ] }),
2159
2165
  /* @__PURE__ */ e(
2160
- G,
2166
+ X,
2161
2167
  {
2162
- checked: a.composer_attachments,
2163
- onCheckedChange: (d) => u({ ...a, composer_attachments: d })
2168
+ checked: i.composer_attachments,
2169
+ onCheckedChange: (c) => f({ ...i, composer_attachments: c })
2164
2170
  }
2165
2171
  )
2166
2172
  ] }),
2167
- /* @__PURE__ */ t("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors", children: [
2168
- /* @__PURE__ */ t("div", { className: "flex-1", children: [
2169
- /* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: r("app_settings.chat.thread_actions_feedback") }),
2170
- /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: r("app_settings.chat.thread_actions_feedback_help") })
2173
+ /* @__PURE__ */ r("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors", children: [
2174
+ /* @__PURE__ */ r("div", { className: "flex-1", children: [
2175
+ /* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: t("app_settings.chat.thread_actions_feedback") }),
2176
+ /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.thread_actions_feedback_help") })
2171
2177
  ] }),
2172
2178
  /* @__PURE__ */ e(
2173
- G,
2179
+ X,
2174
2180
  {
2175
- checked: a.thread_actions_feedback,
2176
- onCheckedChange: (d) => u({ ...a, thread_actions_feedback: d })
2181
+ checked: i.thread_actions_feedback,
2182
+ onCheckedChange: (c) => f({ ...i, thread_actions_feedback: c })
2177
2183
  }
2178
2184
  )
2179
2185
  ] }),
2180
- /* @__PURE__ */ t("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors", children: [
2181
- /* @__PURE__ */ t("div", { className: "flex-1", children: [
2182
- /* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: r("app_settings.chat.thread_actions_retry") }),
2183
- /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: r("app_settings.chat.thread_actions_retry_help") })
2186
+ /* @__PURE__ */ r("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors", children: [
2187
+ /* @__PURE__ */ r("div", { className: "flex-1", children: [
2188
+ /* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: t("app_settings.chat.thread_actions_retry") }),
2189
+ /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.thread_actions_retry_help") })
2184
2190
  ] }),
2185
2191
  /* @__PURE__ */ e(
2186
- G,
2192
+ X,
2187
2193
  {
2188
- checked: a.thread_actions_retry,
2189
- onCheckedChange: (d) => u({ ...a, thread_actions_retry: d })
2194
+ checked: i.thread_actions_retry,
2195
+ onCheckedChange: (c) => f({ ...i, thread_actions_retry: c })
2190
2196
  }
2191
2197
  )
2192
2198
  ] }),
2193
- /* @__PURE__ */ t("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors sm:col-span-2", children: [
2194
- /* @__PURE__ */ t("div", { className: "flex-1", children: [
2195
- /* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: r("app_settings.chat.history_enabled") }),
2196
- /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: r("app_settings.chat.history_enabled_help") })
2199
+ /* @__PURE__ */ r("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors sm:col-span-2", children: [
2200
+ /* @__PURE__ */ r("div", { className: "flex-1", children: [
2201
+ /* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: t("app_settings.chat.history_enabled") }),
2202
+ /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.history_enabled_help") })
2197
2203
  ] }),
2198
2204
  /* @__PURE__ */ e(
2199
- G,
2205
+ X,
2200
2206
  {
2201
- checked: a.history_enabled,
2202
- onCheckedChange: (d) => u({ ...a, history_enabled: d })
2207
+ checked: i.history_enabled,
2208
+ onCheckedChange: (c) => f({ ...i, history_enabled: c })
2203
2209
  }
2204
2210
  )
2205
2211
  ] }),
2206
- a.history_enabled && /* @__PURE__ */ t("div", { className: "sm:col-span-2 grid grid-cols-1 sm:grid-cols-2 gap-4 p-6 bg-muted/10 rounded-2xl border border-border/40 animate-in fade-in slide-in-from-top-2 duration-300", children: [
2207
- /* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
2208
- /* @__PURE__ */ e(Z, { className: "text-xs font-medium text-foreground/70", children: r("app_settings.chat.history_show_delete") }),
2212
+ i.history_enabled && /* @__PURE__ */ r("div", { className: "sm:col-span-2 grid grid-cols-1 sm:grid-cols-2 gap-4 p-6 bg-muted/10 rounded-2xl border border-border/40 animate-in fade-in slide-in-from-top-2 duration-300", children: [
2213
+ /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
2214
+ /* @__PURE__ */ e(Z, { className: "text-xs font-medium text-foreground/70", children: t("app_settings.chat.history_show_delete") }),
2209
2215
  /* @__PURE__ */ e(
2210
- G,
2216
+ X,
2211
2217
  {
2212
- checked: a.history_show_delete,
2213
- onCheckedChange: (d) => u({ ...a, history_show_delete: d })
2218
+ checked: i.history_show_delete,
2219
+ onCheckedChange: (c) => f({ ...i, history_show_delete: c })
2214
2220
  }
2215
2221
  )
2216
2222
  ] }),
2217
- /* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
2218
- /* @__PURE__ */ e(Z, { className: "text-xs font-medium text-foreground/70", children: r("app_settings.chat.history_show_rename") }),
2223
+ /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
2224
+ /* @__PURE__ */ e(Z, { className: "text-xs font-medium text-foreground/70", children: t("app_settings.chat.history_show_rename") }),
2219
2225
  /* @__PURE__ */ e(
2220
- G,
2226
+ X,
2221
2227
  {
2222
- checked: a.history_show_rename,
2223
- onCheckedChange: (d) => u({ ...a, history_show_rename: d })
2228
+ checked: i.history_show_rename,
2229
+ onCheckedChange: (c) => f({ ...i, history_show_rename: c })
2224
2230
  }
2225
2231
  )
2226
2232
  ] }),
2227
- /* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
2228
- /* @__PURE__ */ e(Z, { className: "text-xs font-medium text-foreground/70", children: r("app_settings.chat.history_show_share") }),
2233
+ /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
2234
+ /* @__PURE__ */ e(Z, { className: "text-xs font-medium text-foreground/70", children: t("app_settings.chat.history_show_share") }),
2229
2235
  /* @__PURE__ */ e(
2230
- G,
2236
+ X,
2231
2237
  {
2232
- checked: a.history_show_share,
2233
- onCheckedChange: (d) => u({ ...a, history_show_share: d })
2238
+ checked: i.history_show_share,
2239
+ onCheckedChange: (c) => f({ ...i, history_show_share: c })
2234
2240
  }
2235
2241
  )
2236
2242
  ] }),
2237
- /* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
2238
- /* @__PURE__ */ e(Z, { className: "text-xs font-medium text-foreground/70", children: r("app_settings.chat.history_show_pin") }),
2243
+ /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
2244
+ /* @__PURE__ */ e(Z, { className: "text-xs font-medium text-foreground/70", children: t("app_settings.chat.history_show_pin") }),
2239
2245
  /* @__PURE__ */ e(
2240
- G,
2246
+ X,
2241
2247
  {
2242
- checked: a.history_show_pin,
2243
- onCheckedChange: (d) => u({ ...a, history_show_pin: d })
2248
+ checked: i.history_show_pin,
2249
+ onCheckedChange: (c) => f({ ...i, history_show_pin: c })
2244
2250
  }
2245
2251
  )
2246
2252
  ] })
2247
2253
  ] })
2254
+ ] }),
2255
+ /* @__PURE__ */ r("div", { className: "pt-10 space-y-6", children: [
2256
+ /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
2257
+ /* @__PURE__ */ e("h3", { className: "text-sm font-bold text-foreground/80", children: t("app_settings.chat.sections_modes") }),
2258
+ /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed", children: t("app_settings.chat.sections_modes_help") })
2259
+ ] }),
2260
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-1 sm:grid-cols-3 gap-4", children: [
2261
+ { id: "settings_general_mode", label: "app_settings.chat.general_tab" },
2262
+ { id: "settings_profile_mode", label: "app_settings.chat.profile_tab" },
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) }),
2266
+ /* @__PURE__ */ r(
2267
+ ae,
2268
+ {
2269
+ value: i[c.id],
2270
+ onValueChange: (C) => f({ ...i, [c.id]: C }),
2271
+ dir: m ? "rtl" : "ltr",
2272
+ children: [
2273
+ /* @__PURE__ */ e(ne, { className: "bg-background border-transparent h-9 text-xs", children: /* @__PURE__ */ e(oe, {}) }),
2274
+ /* @__PURE__ */ r(ie, { children: [
2275
+ /* @__PURE__ */ e(W, { value: "editable", children: t("app_settings.chat.mode_editable") }),
2276
+ /* @__PURE__ */ e(W, { value: "faded", children: t("app_settings.chat.mode_faded") }),
2277
+ /* @__PURE__ */ e(W, { value: "hidden", children: t("app_settings.chat.mode_hidden") })
2278
+ ] })
2279
+ ]
2280
+ }
2281
+ )
2282
+ ] }, c.id)) })
2283
+ ] }),
2284
+ /* @__PURE__ */ r("div", { className: "pt-10 space-y-8", children: [
2285
+ /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
2286
+ /* @__PURE__ */ e("h3", { className: "text-sm font-bold text-foreground/80", children: t("app_settings.chat.inner_fields_modes") }),
2287
+ /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed", children: t("app_settings.chat.inner_fields_modes_help") })
2288
+ ] }),
2289
+ /* @__PURE__ */ r("div", { className: "space-y-10", children: [
2290
+ /* @__PURE__ */ r("div", { className: "space-y-4", children: [
2291
+ /* @__PURE__ */ r("h4", { className: "text-xs font-bold uppercase tracking-wider text-muted-foreground/50 flex items-center gap-2", children: [
2292
+ /* @__PURE__ */ e("div", { className: "w-1 h-1 rounded-full bg-primary/40" }),
2293
+ t("app_settings.chat.general_tab")
2294
+ ] }),
2295
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-1 sm:grid-cols-4 gap-4", children: [
2296
+ { id: "theme", label: t("settings:general.theme") },
2297
+ { id: "accent", label: t("settings:general.accent") },
2298
+ { id: "radius", label: t("settings:general.radius") },
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 }),
2302
+ /* @__PURE__ */ r(
2303
+ ae,
2304
+ {
2305
+ value: i.settings_general_fields?.[c.id] || "editable",
2306
+ onValueChange: (C) => f((z) => ({
2307
+ ...z,
2308
+ settings_general_fields: { ...z.settings_general_fields, [c.id]: C }
2309
+ })),
2310
+ dir: m ? "rtl" : "ltr",
2311
+ children: [
2312
+ /* @__PURE__ */ e(ne, { className: "bg-background border-transparent h-8 text-[10px]", children: /* @__PURE__ */ e(oe, {}) }),
2313
+ /* @__PURE__ */ r(ie, { children: [
2314
+ /* @__PURE__ */ e(W, { value: "editable", className: "text-[10px]", children: t("app_settings.chat.mode_editable") }),
2315
+ /* @__PURE__ */ e(W, { value: "faded", className: "text-[10px]", children: t("app_settings.chat.mode_faded") }),
2316
+ /* @__PURE__ */ e(W, { value: "hidden", className: "text-[10px]", children: t("app_settings.chat.mode_hidden") })
2317
+ ] })
2318
+ ]
2319
+ }
2320
+ )
2321
+ ] }, c.id)) })
2322
+ ] }),
2323
+ /* @__PURE__ */ r("div", { className: "space-y-4", children: [
2324
+ /* @__PURE__ */ r("h4", { className: "text-xs font-bold uppercase tracking-wider text-muted-foreground/50 flex items-center gap-2", children: [
2325
+ /* @__PURE__ */ e("div", { className: "w-1 h-1 rounded-full bg-primary/40" }),
2326
+ t("app_settings.chat.profile_tab")
2327
+ ] }),
2328
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-1 sm:grid-cols-4 gap-4", children: [
2329
+ { id: "name", label: t("settings:profile.name") },
2330
+ { id: "surname", label: t("settings:profile.surname") },
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 }),
2335
+ /* @__PURE__ */ r(
2336
+ ae,
2337
+ {
2338
+ value: i.settings_profile_fields?.[c.id] || "editable",
2339
+ onValueChange: (C) => f((z) => ({
2340
+ ...z,
2341
+ settings_profile_fields: { ...z.settings_profile_fields, [c.id]: C }
2342
+ })),
2343
+ dir: m ? "rtl" : "ltr",
2344
+ children: [
2345
+ /* @__PURE__ */ e(ne, { className: "bg-background border-transparent h-8 text-[10px]", children: /* @__PURE__ */ e(oe, {}) }),
2346
+ /* @__PURE__ */ r(ie, { children: [
2347
+ /* @__PURE__ */ e(W, { value: "editable", className: "text-[10px]", children: t("app_settings.chat.mode_editable") }),
2348
+ /* @__PURE__ */ e(W, { value: "faded", className: "text-[10px]", children: t("app_settings.chat.mode_faded") }),
2349
+ /* @__PURE__ */ e(W, { value: "hidden", className: "text-[10px]", children: t("app_settings.chat.mode_hidden") })
2350
+ ] })
2351
+ ]
2352
+ }
2353
+ )
2354
+ ] }, c.id)) })
2355
+ ] }),
2356
+ /* @__PURE__ */ r("div", { className: "space-y-4", children: [
2357
+ /* @__PURE__ */ r("h4", { className: "text-xs font-bold uppercase tracking-wider text-muted-foreground/50 flex items-center gap-2", children: [
2358
+ /* @__PURE__ */ e("div", { className: "w-1 h-1 rounded-full bg-primary/40" }),
2359
+ t("app_settings.chat.account_tab")
2360
+ ] }),
2361
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
2362
+ { id: "balance", label: t("settings:account.balance") },
2363
+ { 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 }),
2366
+ /* @__PURE__ */ r(
2367
+ ae,
2368
+ {
2369
+ value: i.settings_account_fields?.[c.id] || "editable",
2370
+ onValueChange: (C) => f((z) => ({
2371
+ ...z,
2372
+ settings_account_fields: { ...z.settings_account_fields, [c.id]: C }
2373
+ })),
2374
+ dir: m ? "rtl" : "ltr",
2375
+ children: [
2376
+ /* @__PURE__ */ e(ne, { className: "bg-background border-transparent h-8 text-[10px]", children: /* @__PURE__ */ e(oe, {}) }),
2377
+ /* @__PURE__ */ r(ie, { children: [
2378
+ /* @__PURE__ */ e(W, { value: "editable", className: "text-[10px]", children: t("app_settings.chat.mode_editable") }),
2379
+ /* @__PURE__ */ e(W, { value: "faded", className: "text-[10px]", children: t("app_settings.chat.mode_faded") }),
2380
+ /* @__PURE__ */ e(W, { value: "hidden", className: "text-[10px]", children: t("app_settings.chat.mode_hidden") })
2381
+ ] })
2382
+ ]
2383
+ }
2384
+ )
2385
+ ] }, c.id)) })
2386
+ ] })
2387
+ ] })
2248
2388
  ] })
2249
2389
  ] })
2250
2390
  ] }),
2251
- /* @__PURE__ */ t("section", { children: [
2252
- /* @__PURE__ */ e(s, { title: r("app_settings.translations_management"), icon: nt }),
2253
- /* @__PURE__ */ t("div", { className: "border border-border/60 rounded-2xl overflow-hidden bg-background", children: [
2254
- /* @__PURE__ */ t("div", { className: "p-6 border-b border-border/50 bg-muted/5 flex flex-col sm:flex-row items-center gap-4", children: [
2255
- /* @__PURE__ */ t("div", { className: "flex-1 flex items-center gap-4 p-1.5 bg-background border border-border/60 rounded-xl w-full", children: [
2256
- /* @__PURE__ */ e("div", { className: "p-2 px-3 bg-muted/20 rounded-lg border border-border/40 ml-1", children: /* @__PURE__ */ e(fe, { className: "size-4 text-muted-foreground" }) }),
2257
- /* @__PURE__ */ t(ce, { value: A, onValueChange: N, children: [
2258
- /* @__PURE__ */ e(me, { size: "sm", className: "border-none shadow-none bg-transparent h-8 font-black uppercase tracking-wider", children: /* @__PURE__ */ e(ue, {}) }),
2259
- /* @__PURE__ */ e(he, { children: Object.keys(a.translations || {}).sort().map((d) => /* @__PURE__ */ e(ne, { value: d, children: d.toUpperCase() }, d)) })
2391
+ /* @__PURE__ */ r("section", { children: [
2392
+ /* @__PURE__ */ e(b, { title: t("app_settings.translations_management"), icon: nt }),
2393
+ /* @__PURE__ */ r("div", { className: "border border-border/60 rounded-2xl overflow-hidden bg-background", children: [
2394
+ /* @__PURE__ */ r("div", { className: "p-6 border-b border-border/50 bg-muted/5 flex flex-col sm:flex-row items-center gap-4", children: [
2395
+ /* @__PURE__ */ r("div", { className: "flex-1 flex items-center gap-4 p-1.5 bg-background border border-border/60 rounded-xl w-full", children: [
2396
+ /* @__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
+ /* @__PURE__ */ r(ae, { value: y, onValueChange: D, children: [
2398
+ /* @__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)) })
2260
2400
  ] }),
2261
2401
  /* @__PURE__ */ e("div", { className: "w-px h-6 bg-border/60" }),
2262
- /* @__PURE__ */ t(ce, { value: I, onValueChange: E, children: [
2263
- /* @__PURE__ */ e(me, { size: "sm", className: "border-none shadow-none bg-transparent h-8 flex-1 font-bold", children: /* @__PURE__ */ e(ue, {}) }),
2264
- /* @__PURE__ */ e(he, { children: Object.keys(a.translations?.[A] || {}).sort().map((d) => /* @__PURE__ */ e(ne, { value: d, children: d }, d)) })
2402
+ /* @__PURE__ */ r(ae, { value: $, onValueChange: P, children: [
2403
+ /* @__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)) })
2265
2405
  ] })
2266
2406
  ] }),
2267
- /* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
2268
- /* @__PURE__ */ e("button", { type: "button", onClick: L, title: "Add Language", className: "p-2.5 hover:bg-muted/30 rounded-xl transition-all border border-border/40", children: /* @__PURE__ */ e(ot, { className: "size-4" }) }),
2269
- /* @__PURE__ */ e("button", { type: "button", onClick: P, title: "Add Namespace", className: "p-2.5 hover:bg-muted/30 rounded-xl transition-all border border-border/40", children: /* @__PURE__ */ e(fe, { className: "size-4" }) })
2407
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
2408
+ /* @__PURE__ */ e("button", { type: "button", onClick: H, title: "Add Language", className: "p-2.5 hover:bg-muted/30 rounded-xl transition-all border border-border/40", children: /* @__PURE__ */ e(ot, { className: "size-4" }) }),
2409
+ /* @__PURE__ */ e("button", { type: "button", onClick: V, title: "Add Namespace", className: "p-2.5 hover:bg-muted/30 rounded-xl transition-all border border-border/40", children: /* @__PURE__ */ e(xe, { className: "size-4" }) })
2270
2410
  ] })
2271
2411
  ] }),
2272
- /* @__PURE__ */ t("div", { className: "relative p-6", children: [
2273
- /* @__PURE__ */ t("div", { className: "absolute top-8 right-10 flex items-center gap-2", children: [
2412
+ /* @__PURE__ */ r("div", { className: "relative p-6", children: [
2413
+ /* @__PURE__ */ r("div", { className: "absolute top-8 right-10 flex items-center gap-2", children: [
2274
2414
  /* @__PURE__ */ e("span", { className: "text-[10px] font-bold text-muted-foreground/40 uppercase tracking-widest", children: "JSON EDITOR" }),
2275
2415
  /* @__PURE__ */ e(it, { className: "size-3 text-muted-foreground/30" })
2276
2416
  ] }),
2277
2417
  /* @__PURE__ */ e(
2278
- _e,
2418
+ Se,
2279
2419
  {
2280
- value: H,
2281
- onChange: (d) => M(d.target.value),
2420
+ value: K,
2421
+ onChange: (c) => s(c.target.value),
2282
2422
  dir: "ltr",
2283
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"}`,
2284
2424
  spellCheck: !1
2285
2425
  }
2286
2426
  ),
2287
- J && /* @__PURE__ */ t("div", { className: "mt-2 text-[11px] text-destructive font-bold flex items-center gap-2 px-2", children: [
2427
+ J && /* @__PURE__ */ r("div", { className: "mt-2 text-[11px] text-destructive font-bold flex items-center gap-2 px-2", children: [
2288
2428
  /* @__PURE__ */ e("div", { className: "size-1.5 rounded-full bg-destructive animate-pulse" }),
2289
2429
  J
2290
2430
  ] })
2291
2431
  ] }),
2292
- /* @__PURE__ */ e("div", { className: "p-6 bg-muted/5 border-t border-border/40 flex items-center justify-between", children: /* @__PURE__ */ t("div", { className: "flex items-center gap-3", children: [
2293
- /* @__PURE__ */ e("div", { className: "p-1 px-2 bg-primary/5 rounded border border-primary/10", children: /* @__PURE__ */ e("span", { className: "text-[10px] font-black text-primary uppercase", children: r("app_settings.tips_label", { defaultValue: "TIPS" }) }) }),
2294
- /* @__PURE__ */ e("span", { className: "text-[11px] text-muted-foreground/60 font-medium", children: r("app_settings.editor_tips") })
2432
+ /* @__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: [
2433
+ /* @__PURE__ */ e("div", { className: "p-1 px-2 bg-primary/5 rounded border border-primary/10", children: /* @__PURE__ */ e("span", { className: "text-[10px] font-black text-primary uppercase", children: t("app_settings.tips_label", { defaultValue: "TIPS" }) }) }),
2434
+ /* @__PURE__ */ e("span", { className: "text-[11px] text-muted-foreground/60 font-medium", children: t("app_settings.editor_tips") })
2295
2435
  ] }) })
2296
2436
  ] })
2297
2437
  ] })
@@ -2299,180 +2439,180 @@ function bt() {
2299
2439
  ] }) })
2300
2440
  ] });
2301
2441
  }
2302
- function re() {
2303
- const { t: r, i18n: n } = Q(["admin"]), i = n.language === "fa";
2304
- return /* @__PURE__ */ t("div", { className: "h-full flex flex-col items-center justify-center p-6 text-center gap-4 animate-in fade-in duration-500", dir: i ? "rtl" : "ltr", children: [
2442
+ function le() {
2443
+ const { t, i18n: a } = Y(["admin"]), o = a.language === "fa";
2444
+ return /* @__PURE__ */ r("div", { className: "h-full flex flex-col items-center justify-center p-6 text-center gap-4 animate-in fade-in duration-500", dir: o ? "rtl" : "ltr", children: [
2305
2445
  /* @__PURE__ */ e("div", { className: "bg-destructive/10 p-4 rounded-2xl border border-destructive/20 relative", children: /* @__PURE__ */ e(lt, { className: "size-10 text-destructive/70" }) }),
2306
- /* @__PURE__ */ t("div", { className: "space-y-1 max-w-sm", children: [
2307
- /* @__PURE__ */ e("h3", { className: "text-lg font-bold text-foreground tracking-tight", children: r("errors.access_denied_title", "Access Denied") }),
2308
- /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground leading-relaxed", children: r("errors.access_denied_message", "You don't have permission to access this page.") })
2446
+ /* @__PURE__ */ r("div", { className: "space-y-1 max-w-sm", children: [
2447
+ /* @__PURE__ */ e("h3", { className: "text-lg font-bold text-foreground tracking-tight", children: t("errors.access_denied_title", "Access Denied") }),
2448
+ /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground leading-relaxed", children: t("errors.access_denied_message", "You don't have permission to access this page.") })
2309
2449
  ] })
2310
2450
  ] });
2311
2451
  }
2312
- const vt = ({ className: r }) => {
2313
- const { t: n } = Q(["theme"]), { theme: i, setTheme: c } = we(), g = () => {
2314
- c(i === "system" ? "light" : i === "light" ? "dark" : "system");
2452
+ const vt = ({ className: t }) => {
2453
+ const { t: a } = Y(["theme"]), { theme: o, setTheme: u } = we(), g = () => {
2454
+ u(o === "system" ? "light" : o === "light" ? "dark" : "system");
2315
2455
  }, p = () => {
2316
- switch (i) {
2456
+ switch (o) {
2317
2457
  case "light":
2318
2458
  return /* @__PURE__ */ e(ct, { className: "h-[1.2rem] w-[1.2rem]" });
2319
2459
  case "dark":
2320
2460
  return /* @__PURE__ */ e(dt, { className: "h-[1.2rem] w-[1.2rem]" });
2321
2461
  case "system":
2322
- return /* @__PURE__ */ e(Le, { className: "h-[1.2rem] w-[1.2rem]" });
2462
+ return /* @__PURE__ */ e(Te, { className: "h-[1.2rem] w-[1.2rem]" });
2323
2463
  default:
2324
- return /* @__PURE__ */ e(Le, { className: "h-[1.2rem] w-[1.2rem]" });
2464
+ return /* @__PURE__ */ e(Te, { className: "h-[1.2rem] w-[1.2rem]" });
2325
2465
  }
2326
- }, w = () => {
2327
- switch (i) {
2466
+ }, _ = () => {
2467
+ switch (o) {
2328
2468
  case "light":
2329
- return n("dark");
2469
+ return a("dark");
2330
2470
  case "dark":
2331
- return n("system");
2471
+ return a("system");
2332
2472
  case "system":
2333
- return n("light");
2473
+ return a("light");
2334
2474
  default:
2335
- return n("toggle");
2475
+ return a("toggle");
2336
2476
  }
2337
2477
  };
2338
- return /* @__PURE__ */ t(be, { children: [
2339
- /* @__PURE__ */ e(ve, { asChild: !0, children: /* @__PURE__ */ t(oe, { variant: "ghost", size: "icon", onClick: g, className: r, children: [
2478
+ return /* @__PURE__ */ r(ve, { children: [
2479
+ /* @__PURE__ */ e(ye, { asChild: !0, children: /* @__PURE__ */ r(me, { variant: "ghost", size: "icon", onClick: g, className: t, children: [
2340
2480
  p(),
2341
- /* @__PURE__ */ e("span", { className: "sr-only", children: n("toggle") })
2481
+ /* @__PURE__ */ e("span", { className: "sr-only", children: a("toggle") })
2342
2482
  ] }) }),
2343
- /* @__PURE__ */ e(ye, { children: w() })
2483
+ /* @__PURE__ */ e(Ne, { children: _() })
2344
2484
  ] });
2345
2485
  };
2346
- function yt({ extraPages: r = [], disabledPages: n = [] }) {
2347
- const i = et(), c = tt(), { t: g, i18n: p } = Q(["admin", "settings", "translation"]), { app: w } = le(), { theme: b } = we(), [v, D] = f([]), [T, $] = f(!1), q = Ae(!1), [C, _] = f("light");
2348
- W(() => {
2349
- if (b === "system") {
2486
+ 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
+ G(() => {
2489
+ if (N === "system") {
2350
2490
  const h = window.matchMedia("(prefers-color-scheme: dark)").matches;
2351
- _(h ? "dark" : "light");
2491
+ k(h ? "dark" : "light");
2352
2492
  } else
2353
- _(b);
2354
- }, [b]);
2355
- const R = ie(() => w?.logo ? typeof w.logo == "string" ? w.logo : C === "dark" ? w.logo.dark : w.logo.light : Me, [w?.logo, C]), A = w?.adminTitle || w?.name, N = p.language === "fa";
2356
- W(() => {
2493
+ k(N);
2494
+ }, [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
+ G(() => {
2357
2497
  const h = localStorage.getItem("admin_info");
2358
2498
  if (h)
2359
2499
  try {
2360
2500
  const l = JSON.parse(h).permissions || [];
2361
- if (D(l), c.pathname === "/admin" || c.pathname === "/admin/")
2362
- if (l.includes("analytics") && !n.includes("analytics"))
2363
- i("/admin/analytics", { replace: !0 });
2364
- else if (l.includes("chat_history") && !n.includes("chat_history"))
2365
- i("/admin/chat-history", { replace: !0 });
2366
- else if (l.includes("user_management") && !n.includes("user_management"))
2367
- i("/admin/users", { replace: !0 });
2368
- else if (l.includes("admin_management") && !n.includes("admin_management"))
2369
- i("/admin/admins", { replace: !0 });
2501
+ if (O(l), u.pathname === "/admin" || u.pathname === "/admin/")
2502
+ if (l.includes("analytics") && !a.includes("analytics"))
2503
+ o("/admin/analytics", { replace: !0 });
2504
+ else if (l.includes("chat_history") && !a.includes("chat_history"))
2505
+ o("/admin/chat-history", { replace: !0 });
2506
+ else if (l.includes("user_management") && !a.includes("user_management"))
2507
+ o("/admin/users", { replace: !0 });
2508
+ else if (l.includes("admin_management") && !a.includes("admin_management"))
2509
+ o("/admin/admins", { replace: !0 });
2370
2510
  else {
2371
- const a = r.find((u) => !u.permission || l.includes(u.permission));
2372
- a && i(`/admin/${a.path}`, { replace: !0 });
2511
+ const d = t.find((i) => !i.permission || l.includes(i.permission));
2512
+ d && o(`/admin/${d.path}`, { replace: !0 });
2373
2513
  }
2374
2514
  } catch (F) {
2375
2515
  console.error("Failed to parse admin_info", F);
2376
2516
  }
2377
2517
  else
2378
2518
  console.warn("DashboardPage: No adminInfo found in localStorage");
2379
- }, [i, c.pathname]);
2380
- const I = () => {
2381
- y.clearToken(), window.location.reload();
2382
- }, E = (h) => v.includes(h), H = (h) => v.includes(h) && !n.includes(h), B = Object.keys(p.services?.resourceStore?.data || {}).filter((h) => h !== "dev"), J = B.length > 0 ? B : ["en", "fa"], z = (h) => {
2383
- localStorage.setItem("gentiq-admin-language", h), p.changeLanguage(h), $(!1), document.activeElement instanceof HTMLElement && document.activeElement.blur();
2519
+ }, [o, u.pathname]);
2520
+ const D = () => {
2521
+ 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) => {
2523
+ localStorage.setItem("gentiq-admin-language", h), p.changeLanguage(h), I(!1), document.activeElement instanceof HTMLElement && document.activeElement.blur();
2384
2524
  };
2385
- return /* @__PURE__ */ t("div", { className: "min-h-screen bg-background overflow-hidden flex flex-col", dir: N ? "rtl" : "ltr", children: [
2386
- /* @__PURE__ */ e("header", { className: "glass border-b border-border sticky top-0 z-50", children: /* @__PURE__ */ e("div", { className: "px-8", children: /* @__PURE__ */ t("div", { className: "flex flex-col md:flex-row md:items-stretch justify-between min-h-[72px] gap-y-4", children: [
2387
- /* @__PURE__ */ t("div", { className: "flex flex-col md:flex-row md:items-stretch gap-x-12", children: [
2388
- /* @__PURE__ */ t("div", { className: "flex items-center gap-3 py-4 md:py-0", children: [
2389
- /* @__PURE__ */ e("img", { src: R, alt: A, className: "size-8 object-contain" }),
2390
- /* @__PURE__ */ e("h1", { className: "text-2xl font-black bg-gradient-to-l from-primary to-primary/60 bg-clip-text text-transparent", children: A })
2525
+ return /* @__PURE__ */ r("div", { className: "min-h-screen bg-background overflow-hidden flex flex-col", dir: y ? "rtl" : "ltr", children: [
2526
+ /* @__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
+ /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-stretch gap-x-12", children: [
2528
+ /* @__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 })
2391
2531
  ] }),
2392
- /* @__PURE__ */ t("nav", { className: "flex items-stretch gap-8", children: [
2393
- !n.includes("analytics") && /* @__PURE__ */ e(
2532
+ /* @__PURE__ */ r("nav", { className: "flex items-stretch gap-8", children: [
2533
+ !a.includes("analytics") && /* @__PURE__ */ e(
2394
2534
  "button",
2395
2535
  {
2396
- onClick: () => i("/admin/analytics"),
2397
- className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${c.pathname === "/admin/analytics" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
2536
+ onClick: () => o("/admin/analytics"),
2537
+ className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${u.pathname === "/admin/analytics" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
2398
2538
  children: g("dashboard.tabs.analytics")
2399
2539
  }
2400
2540
  ),
2401
- !n.includes("chat_history") && /* @__PURE__ */ e(
2541
+ !a.includes("chat_history") && /* @__PURE__ */ e(
2402
2542
  "button",
2403
2543
  {
2404
- onClick: () => i("/admin/chat-history"),
2405
- className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${c.pathname === "/admin/chat-history" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
2544
+ onClick: () => o("/admin/chat-history"),
2545
+ className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${u.pathname === "/admin/chat-history" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
2406
2546
  children: g("dashboard.tabs.chat_history")
2407
2547
  }
2408
2548
  ),
2409
- !n.includes("user_management") && /* @__PURE__ */ e(
2549
+ !a.includes("user_management") && /* @__PURE__ */ e(
2410
2550
  "button",
2411
2551
  {
2412
- onClick: () => i("/admin/users"),
2413
- className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${c.pathname === "/admin/users" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
2552
+ onClick: () => o("/admin/users"),
2553
+ className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${u.pathname === "/admin/users" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
2414
2554
  children: g("dashboard.tabs.users")
2415
2555
  }
2416
2556
  ),
2417
- !n.includes("admin_management") && /* @__PURE__ */ e(
2557
+ !a.includes("admin_management") && /* @__PURE__ */ e(
2418
2558
  "button",
2419
2559
  {
2420
- onClick: () => i("/admin/admins"),
2421
- className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${c.pathname === "/admin/admins" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
2560
+ onClick: () => o("/admin/admins"),
2561
+ className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${u.pathname === "/admin/admins" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
2422
2562
  children: g("dashboard.tabs.admins")
2423
2563
  }
2424
2564
  ),
2425
- E("settings") && !n.includes("settings") && /* @__PURE__ */ e(
2565
+ $("settings") && !a.includes("settings") && /* @__PURE__ */ e(
2426
2566
  "button",
2427
2567
  {
2428
- onClick: () => i("/admin/settings"),
2429
- className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${c.pathname === "/admin/settings" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
2568
+ onClick: () => o("/admin/settings"),
2569
+ className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${u.pathname === "/admin/settings" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
2430
2570
  children: g("dashboard.tabs.settings")
2431
2571
  }
2432
2572
  ),
2433
- r.map((h) => /* @__PURE__ */ e(
2573
+ t.map((h) => /* @__PURE__ */ e(
2434
2574
  "button",
2435
2575
  {
2436
- onClick: () => i(`/admin/${h.path}`),
2437
- className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${c.pathname === `/admin/${h.path}` ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
2576
+ onClick: () => o(`/admin/${h.path}`),
2577
+ className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${u.pathname === `/admin/${h.path}` ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
2438
2578
  children: typeof h.label == "string" ? g(h.label) : h.label
2439
2579
  },
2440
2580
  `tab-${h.path}`
2441
2581
  ))
2442
2582
  ] })
2443
2583
  ] }),
2444
- /* @__PURE__ */ t("div", { className: "flex items-center gap-1.5 py-4 md:py-0", children: [
2445
- /* @__PURE__ */ t(Ve, { onOpenChange: (h) => {
2446
- h ? $(!1) : (q.current = !0, setTimeout(() => {
2447
- q.current = !1;
2584
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5 py-4 md:py-0", children: [
2585
+ /* @__PURE__ */ r(We, { onOpenChange: (h) => {
2586
+ h ? I(!1) : (A.current = !0, setTimeout(() => {
2587
+ A.current = !1;
2448
2588
  }, 200));
2449
2589
  }, children: [
2450
- /* @__PURE__ */ t(
2451
- be,
2590
+ /* @__PURE__ */ r(
2591
+ ve,
2452
2592
  {
2453
2593
  open: T,
2454
2594
  onOpenChange: (h) => {
2455
- h && q.current || $(h);
2595
+ h && A.current || I(h);
2456
2596
  },
2457
2597
  children: [
2458
- /* @__PURE__ */ e(ve, { asChild: !0, children: /* @__PURE__ */ e(Ke, { asChild: !0, children: /* @__PURE__ */ e(
2459
- oe,
2598
+ /* @__PURE__ */ e(ye, { asChild: !0, children: /* @__PURE__ */ e(Ke, { asChild: !0, children: /* @__PURE__ */ e(
2599
+ me,
2460
2600
  {
2461
2601
  variant: "ghost",
2462
2602
  size: "icon",
2463
2603
  className: "font-bold text-xs text-muted-foreground hover:bg-muted",
2464
- onPointerDown: () => $(!1),
2604
+ onPointerDown: () => I(!1),
2465
2605
  children: (p.language?.split("-")[0] || "").toUpperCase()
2466
2606
  }
2467
2607
  ) }) }),
2468
- /* @__PURE__ */ e(ye, { side: "bottom", className: "text-xs", children: g("dashboard.language", "Change Language") })
2608
+ /* @__PURE__ */ e(Ne, { side: "bottom", className: "text-xs", children: g("dashboard.language", "Change Language") })
2469
2609
  ]
2470
2610
  }
2471
2611
  ),
2472
- /* @__PURE__ */ e(Ze, { align: "center", className: "min-w-[8rem]", children: J.map((h) => /* @__PURE__ */ e(
2473
- Ge,
2612
+ /* @__PURE__ */ e(Ge, { align: "center", className: "min-w-[8rem]", children: B.map((h) => /* @__PURE__ */ e(
2613
+ Ze,
2474
2614
  {
2475
- onClick: () => z(h),
2615
+ onClick: () => J(h),
2476
2616
  className: h === p.language ? "bg-primary/10" : "",
2477
2617
  children: g(`general.languages.${h}`, h.toUpperCase())
2478
2618
  },
@@ -2481,56 +2621,56 @@ function yt({ extraPages: r = [], disabledPages: n = [] }) {
2481
2621
  ] }),
2482
2622
  /* @__PURE__ */ e(vt, { className: "size-9 !bg-transparent hover:bg-muted text-muted-foreground" }),
2483
2623
  /* @__PURE__ */ e("div", { className: "w-px h-5 bg-border mx-1" }),
2484
- /* @__PURE__ */ t(be, { children: [
2485
- /* @__PURE__ */ e(ve, { asChild: !0, children: /* @__PURE__ */ e(
2486
- oe,
2624
+ /* @__PURE__ */ r(ve, { children: [
2625
+ /* @__PURE__ */ e(ye, { asChild: !0, children: /* @__PURE__ */ e(
2626
+ me,
2487
2627
  {
2488
2628
  variant: "ghost",
2489
2629
  size: "icon",
2490
2630
  className: "hover:bg-destructive/10 hover:scale-105 active:scale-95 text-muted-foreground hover:text-destructive",
2491
- onClick: I,
2631
+ onClick: D,
2492
2632
  children: /* @__PURE__ */ e(mt, { className: "size-5" })
2493
2633
  }
2494
2634
  ) }),
2495
- /* @__PURE__ */ e(ye, { side: "bottom", className: "text-xs", children: g("dashboard.logout") })
2635
+ /* @__PURE__ */ e(Ne, { side: "bottom", className: "text-xs", children: g("dashboard.logout") })
2496
2636
  ] })
2497
2637
  ] })
2498
2638
  ] }) }) }),
2499
- /* @__PURE__ */ e("main", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e("div", { className: "absolute inset-0 overflow-hidden", children: /* @__PURE__ */ t(rt, { children: [
2500
- /* @__PURE__ */ e(te, { path: "/", element: /* @__PURE__ */ e(Se, { to: "/admin/analytics", replace: !0 }) }),
2501
- /* @__PURE__ */ e(te, { path: "/analytics", element: H("analytics") ? /* @__PURE__ */ e(xt, {}) : /* @__PURE__ */ e(re, {}) }),
2502
- /* @__PURE__ */ e(te, { path: "/chat-history", element: H("chat_history") ? /* @__PURE__ */ e(pt, {}) : /* @__PURE__ */ e(re, {}) }),
2639
+ /* @__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
+ /* @__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, {}) }),
2503
2643
  /* @__PURE__ */ e(
2504
- te,
2644
+ se,
2505
2645
  {
2506
2646
  path: "/admins",
2507
- element: E("admin_management") && !n.includes("admin_management") ? /* @__PURE__ */ e(gt, {}) : /* @__PURE__ */ e(re, {})
2647
+ element: $("admin_management") && !a.includes("admin_management") ? /* @__PURE__ */ e(gt, {}) : /* @__PURE__ */ e(le, {})
2508
2648
  }
2509
2649
  ),
2510
2650
  /* @__PURE__ */ e(
2511
- te,
2651
+ se,
2512
2652
  {
2513
2653
  path: "/settings",
2514
- element: E("settings") && !n.includes("admin_management") ? /* @__PURE__ */ e(bt, {}) : /* @__PURE__ */ e(re, {})
2654
+ element: $("settings") && !a.includes("admin_management") ? /* @__PURE__ */ e(bt, {}) : /* @__PURE__ */ e(le, {})
2515
2655
  }
2516
2656
  ),
2517
- /* @__PURE__ */ e(te, { path: "/users", element: H("user_management") ? /* @__PURE__ */ e(ft, {}) : /* @__PURE__ */ e(re, {}) }),
2518
- r.map((h) => /* @__PURE__ */ e(
2519
- te,
2657
+ /* @__PURE__ */ e(se, { path: "/users", element: P("user_management") ? /* @__PURE__ */ e(ft, {}) : /* @__PURE__ */ e(le, {}) }),
2658
+ t.map((h) => /* @__PURE__ */ e(
2659
+ se,
2520
2660
  {
2521
2661
  path: `/${h.path}`,
2522
- element: h.permission && !E(h.permission) ? /* @__PURE__ */ e(re, {}) : h.element
2662
+ element: h.permission && !$(h.permission) ? /* @__PURE__ */ e(le, {}) : h.element
2523
2663
  },
2524
2664
  `route-${h.path}`
2525
2665
  )),
2526
- /* @__PURE__ */ e(te, { path: "*", element: /* @__PURE__ */ e(Se, { to: "/admin/analytics", replace: !0 }) })
2666
+ /* @__PURE__ */ e(se, { path: "*", element: /* @__PURE__ */ e(Ce, { to: "/admin/analytics", replace: !0 }) })
2527
2667
  ] }) }) })
2528
2668
  ] });
2529
2669
  }
2530
- function At(r) {
2531
- const n = ie(() => {
2532
- const i = $e.createInstance();
2533
- return i.use(Qe).use(Oe).init({
2670
+ function At(t) {
2671
+ const a = ue(() => {
2672
+ const o = $e.createInstance();
2673
+ return o.use(Qe).use(Oe).init({
2534
2674
  resources: Xe,
2535
2675
  fallbackLng: "en",
2536
2676
  interpolation: { escapeValue: !1 },
@@ -2539,121 +2679,121 @@ function At(r) {
2539
2679
  lookupLocalStorage: "gentiq-admin-language",
2540
2680
  caches: ["localStorage"]
2541
2681
  }
2542
- }), i;
2682
+ }), o;
2543
2683
  }, []);
2544
- return /* @__PURE__ */ e(Ee, { i18n: n, children: /* @__PURE__ */ e(wt, { ...r }) });
2684
+ return /* @__PURE__ */ e(Ee, { i18n: a, children: /* @__PURE__ */ e(Nt, { ...t }) });
2545
2685
  }
2546
- function wt({ extraPages: r, disabledPages: n = [] }) {
2547
- const { app: i, i18n: c } = le(), { t: g, i18n: p } = Q(["admin", "translation"]), [w, b] = f(!1), [v, D] = f(!0), [T, $] = f(!1);
2548
- W(() => {
2549
- c?.resources && Object.entries(c.resources).forEach(([_, R]) => {
2550
- Object.entries(R).forEach(([A, N]) => {
2551
- p.addResourceBundle(_, A, N, !0, !0);
2686
+ 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);
2688
+ G(() => {
2689
+ u?.resources && Object.entries(u.resources).forEach(([k, U]) => {
2690
+ Object.entries(U).forEach(([E, y]) => {
2691
+ p.addResourceBundle(k, E, y, !0, !0);
2552
2692
  });
2553
- }), !localStorage.getItem("gentiq-admin-language") && i?.language && p.language !== i.language && p.changeLanguage(i.language), $(!0);
2554
- }, [c?.resources, p, i?.language]), W(() => {
2555
- const C = y.getToken();
2556
- return b(!!C), D(!1), document.body.classList.add("admin-theme-root"), () => {
2693
+ }), !localStorage.getItem("gentiq-admin-language") && o?.language && p.language !== o.language && p.changeLanguage(o.language), I(!0);
2694
+ }, [u?.resources, p, o?.language]), G(() => {
2695
+ const q = w.getToken();
2696
+ return N(!!q), O(!1), document.body.classList.add("admin-theme-root"), () => {
2557
2697
  document.body.classList.remove("admin-theme-root");
2558
2698
  };
2559
- }, []), W(() => {
2699
+ }, []), G(() => {
2560
2700
  T && (document.documentElement.dir = p.language === "fa" ? "rtl" : "ltr", document.documentElement.lang = p.language);
2561
2701
  }, [T, p.language]);
2562
- const q = () => {
2563
- b(!0);
2702
+ const A = () => {
2703
+ N(!0);
2564
2704
  };
2565
- return v || !T ? /* @__PURE__ */ e("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "text-muted-foreground", children: g("loading") }) }) : /* @__PURE__ */ e(Ye, { storageKey: "gentiq-admin-theme", children: w ? /* @__PURE__ */ e(yt, { extraPages: r, disabledPages: n }) : /* @__PURE__ */ e(ht, { onLoginSuccess: q }) });
2705
+ return v || !T ? /* @__PURE__ */ e("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "text-muted-foreground", children: g("loading") }) }) : /* @__PURE__ */ e(Ye, { storageKey: "gentiq-admin-theme", children: _ ? /* @__PURE__ */ e(yt, { extraPages: t, disabledPages: a }) : /* @__PURE__ */ e(ht, { onLoginSuccess: A }) });
2566
2706
  }
2567
- const Y = "gentiq_admin";
2568
- function Mt(r = 0, n = 100, i = "") {
2569
- return se({
2570
- queryKey: [Y, "users", r, n, i],
2571
- queryFn: () => y.listUsers(r, n, i)
2707
+ const te = "gentiq_admin";
2708
+ function Mt(t = 0, a = 100, o = "") {
2709
+ return de({
2710
+ queryKey: [te, "users", t, a, o],
2711
+ queryFn: () => w.listUsers(t, a, o)
2572
2712
  });
2573
2713
  }
2574
2714
  function It() {
2575
- const r = Ne(), n = () => {
2576
- r.invalidateQueries({ queryKey: [Y, "users"] });
2577
- }, i = X({
2578
- mutationFn: (b) => y.createUser(b.phone, b.name, b.surname, b.tokens, b.requests),
2579
- onSuccess: n
2580
- }), c = X({
2581
- mutationFn: ({ userId: b, data: v }) => y.updateUser(b, v),
2582
- onSuccess: n
2583
- }), g = X({
2584
- mutationFn: (b) => y.deleteUser(b),
2585
- onSuccess: n
2586
- }), p = X({
2587
- mutationFn: ({ userId: b, tokens: v, requests: D }) => y.updateUserBalance(b, v, D),
2588
- onSuccess: n
2589
- }), w = X({
2590
- mutationFn: (b) => y.refreshUserToken(b)
2715
+ const t = _e(), a = () => {
2716
+ t.invalidateQueries({ queryKey: [te, "users"] });
2717
+ }, o = ee({
2718
+ mutationFn: (N) => w.createUser(N.phone, N.name, N.surname, N.tokens, N.requests),
2719
+ onSuccess: a
2720
+ }), u = ee({
2721
+ mutationFn: ({ userId: N, data: v }) => w.updateUser(N, v),
2722
+ onSuccess: a
2723
+ }), g = ee({
2724
+ mutationFn: (N) => w.deleteUser(N),
2725
+ onSuccess: a
2726
+ }), p = ee({
2727
+ mutationFn: ({ userId: N, tokens: v, requests: O }) => w.updateUserBalance(N, v, O),
2728
+ onSuccess: a
2729
+ }), _ = ee({
2730
+ mutationFn: (N) => w.refreshUserToken(N)
2591
2731
  });
2592
- return { createUser: i, updateUser: c, deleteUser: g, updateBalance: p, refreshToken: w };
2732
+ return { createUser: o, updateUser: u, deleteUser: g, updateBalance: p, refreshToken: _ };
2593
2733
  }
2594
- function Dt(r = 30) {
2595
- return se({
2596
- queryKey: [Y, "analytics", r],
2597
- queryFn: () => y.getAnalytics(r)
2734
+ function Dt(t = 30) {
2735
+ return de({
2736
+ queryKey: [te, "analytics", t],
2737
+ queryFn: () => w.getAnalytics(t)
2598
2738
  });
2599
2739
  }
2600
2740
  function $t() {
2601
- return se({
2602
- queryKey: [Y, "admins"],
2603
- queryFn: () => y.listAdmins()
2741
+ return de({
2742
+ queryKey: [te, "admins"],
2743
+ queryFn: () => w.listAdmins()
2604
2744
  });
2605
2745
  }
2606
2746
  function Ot() {
2607
- const r = Ne(), n = () => {
2608
- r.invalidateQueries({ queryKey: [Y, "admins"] });
2609
- }, i = X({
2610
- mutationFn: (p) => y.register(p.username, p.password, p.name, p.permissions),
2611
- onSuccess: n
2612
- }), c = X({
2613
- mutationFn: ({ adminId: p, data: w }) => y.updateAdmin(p, w),
2614
- onSuccess: n
2615
- }), g = X({
2616
- mutationFn: (p) => y.deleteAdmin(p),
2617
- onSuccess: n
2747
+ const t = _e(), a = () => {
2748
+ t.invalidateQueries({ queryKey: [te, "admins"] });
2749
+ }, o = ee({
2750
+ mutationFn: (p) => w.register(p.username, p.password, p.name, p.permissions),
2751
+ onSuccess: a
2752
+ }), u = ee({
2753
+ mutationFn: ({ adminId: p, data: _ }) => w.updateAdmin(p, _),
2754
+ onSuccess: a
2755
+ }), g = ee({
2756
+ mutationFn: (p) => w.deleteAdmin(p),
2757
+ onSuccess: a
2618
2758
  });
2619
- return { createAdmin: i, updateAdmin: c, deleteAdmin: g };
2759
+ return { createAdmin: o, updateAdmin: u, deleteAdmin: g };
2620
2760
  }
2621
- function Et(r = 0, n = 50, i, c) {
2622
- return se({
2623
- queryKey: [Y, "threads", r, n, i, c],
2624
- queryFn: () => y.listThreads(r, n, i, c)
2761
+ function Et(t = 0, a = 50, o, u) {
2762
+ return de({
2763
+ queryKey: [te, "threads", t, a, o, u],
2764
+ queryFn: () => w.listThreads(t, a, o, u)
2625
2765
  });
2626
2766
  }
2627
- function Rt(r) {
2628
- return se({
2629
- queryKey: [Y, "threadItems", r],
2630
- queryFn: () => y.getThreadItems(r),
2631
- enabled: !!r
2767
+ function Rt(t) {
2768
+ return de({
2769
+ queryKey: [te, "threadItems", t],
2770
+ queryFn: () => w.getThreadItems(t),
2771
+ enabled: !!t
2632
2772
  });
2633
2773
  }
2634
- function Ut(r = 20, n) {
2635
- return se({
2636
- queryKey: [Y, "jobs", r, n],
2637
- queryFn: () => y.listJobs(r, n),
2774
+ function Ut(t = 20, a) {
2775
+ return de({
2776
+ queryKey: [te, "jobs", t, a],
2777
+ queryFn: () => w.listJobs(t, a),
2638
2778
  refetchInterval: 5e3
2639
2779
  // Auto-refresh jobs every 5 seconds
2640
2780
  });
2641
2781
  }
2642
2782
  function Ft() {
2643
- const r = Ne();
2644
- return { cancelJob: X({
2645
- mutationFn: (c) => y.cancelJob(c),
2783
+ const t = _e();
2784
+ return { cancelJob: ee({
2785
+ mutationFn: (u) => w.cancelJob(u),
2646
2786
  onSuccess: () => {
2647
- r.invalidateQueries({ queryKey: [Y, "jobs"] });
2787
+ t.invalidateQueries({ queryKey: [te, "jobs"] });
2648
2788
  }
2649
2789
  }) };
2650
2790
  }
2651
2791
  function zt() {
2652
2792
  return {
2653
- login: async (r, n) => y.login(r, n),
2654
- logout: () => y.clearToken(),
2655
- getToken: () => y.getToken(),
2656
- isAuthenticated: !!y.getToken()
2793
+ login: async (t, a) => w.login(t, a),
2794
+ logout: () => w.clearToken(),
2795
+ getToken: () => w.getToken(),
2796
+ isAuthenticated: !!w.getToken()
2657
2797
  };
2658
2798
  }
2659
2799
  export {