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