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