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