mantur-components 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -193,21 +193,17 @@ formatDateByLang("2026-05-19T12:00:00Z", "datetime", "en-US");
193
193
 
194
194
  未传语言时会读取组件库当前语言;中文输出 `YYYY-MM-DD` / `YYYY-MM-DD HH:mm:ss`,英文输出 `MM/DD/YYYY` / `MM/DD/YYYY HH:mm:ss`。
195
195
 
196
- ## 导出的工具方法
196
+ ## 公共导出
197
197
 
198
198
  ```ts
199
- import {
200
- formatDateByLang,
201
- getManturCurrentTenant,
202
- getManturTenantContextSnapshot,
203
- getManturTenants,
204
- getManturUserPoints,
205
- MANTUR_POINTS_REFRESH_EVENT,
206
- MANTUR_TENANT_CONTEXT_CHANGE_EVENT,
207
- refreshManturTenantContext,
208
- refreshManturUserPoints,
209
- switchAndRefreshManturTenant,
210
- switchManturTenant,
199
+ import { ManturHeader, formatDateByLang } from "mantur-components";
200
+ import type {
201
+ ManturDateFormatType,
202
+ ManturDateInput,
203
+ ManturHeaderProps,
204
+ ManturHeaderUser,
205
+ ManturTenant,
206
+ ManturTenantContextDetail,
211
207
  } from "mantur-components";
212
208
  ```
213
209
 
package/dist/index.d.ts CHANGED
@@ -1,9 +1,4 @@
1
1
  export { ManturHeader } from "./header";
2
- export { getManturCurrentTenant, getManturTenantContextSnapshot, getManturTenants, getManturUserPoints, MANTUR_POINTS_REFRESH_EVENT, MANTUR_TENANT_CONTEXT_CHANGE_EVENT, refreshManturUserPoints, refreshManturTenantContext, switchAndRefreshManturTenant, switchManturTenant, } from "./api";
3
- export { getManturMessages, getStoredManturLocale, MANTUR_LANGUAGE_CHANGE_EVENT, MANTUR_LANGUAGE_SOURCE_STORAGE_KEY, MANTUR_LANGUAGE_STORAGE_KEY, MANTUR_MESSAGES, normalizeManturLocale, } from "./i18n";
4
- export { LangSwitch, LANGUAGE_SOURCE_STORAGE_KEY, LANGUAGE_STORAGE_KEY } from "./lang-switch";
5
- export { ThemeSwitch } from "./theme-switch";
6
2
  export { formatDateByLang } from "./utils/date";
7
- export type { ManturLocale, ManturMessages } from "./i18n";
8
3
  export type { ManturDateFormatType, ManturDateInput } from "./utils/date";
9
4
  export type { ManturHeaderLabels, ManturHeaderProps, ManturHeaderUser, ManturProfileValues, ManturRole, ManturTenant, ManturTenantAuthContext, ManturTenantContextDetail, ManturUserPoints, } from "./types";
@@ -5,49 +5,49 @@ import { useTranslation as P } from "react-i18next";
5
5
  import { jsx as F, jsxs as I } from "react/jsx-runtime";
6
6
  import { useTheme as L } from "next-themes";
7
7
  //#region \0rolldown/runtime.js
8
- var R = Object.create, z = Object.defineProperty, B = Object.getOwnPropertyDescriptor, ee = Object.getOwnPropertyNames, te = Object.getPrototypeOf, V = Object.prototype.hasOwnProperty, ne = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), re = (e, t, n, r) => {
9
- if (t && typeof t == "object" || typeof t == "function") for (var i = ee(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !V.call(e, s) && s !== n && z(e, s, {
8
+ var R = Object.create, z = Object.defineProperty, B = Object.getOwnPropertyDescriptor, V = Object.getOwnPropertyNames, H = Object.getPrototypeOf, U = Object.prototype.hasOwnProperty, W = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), G = (e, t, n, r) => {
9
+ if (t && typeof t == "object" || typeof t == "function") for (var i = V(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !U.call(e, s) && s !== n && z(e, s, {
10
10
  get: ((e) => t[e]).bind(null, s),
11
11
  enumerable: !(r = B(t, s)) || r.enumerable
12
12
  });
13
13
  return e;
14
- }, ie = (e, t, n) => (n = e == null ? {} : R(te(e)), re(t || !e || !e.__esModule ? z(n, "default", {
14
+ }, K = (e, t, n) => (n = e == null ? {} : R(H(e)), G(t || !e || !e.__esModule ? z(n, "default", {
15
15
  value: e,
16
16
  enumerable: !0
17
- }) : n, e)), ae = "/api", oe = "/users/me/points", H = "mantur-points-refresh", se = "mantur-tenant-context-change";
18
- function ce() {
19
- return typeof window < "u" && window.__MANTUR_COMPONENTS_API_BASE__ ? window.__MANTUR_COMPONENTS_API_BASE__ : ae;
17
+ }) : n, e)), ee = "/api", te = "/users/me/points", q = "mantur-points-refresh", ne = "mantur-tenant-context-change";
18
+ function re() {
19
+ return typeof window < "u" && window.__MANTUR_COMPONENTS_API_BASE__ ? window.__MANTUR_COMPONENTS_API_BASE__ : ee;
20
20
  }
21
- function le() {
22
- return typeof window < "u" && window.__MANTUR_COMPONENTS_POINTS_ENDPOINT__ ? window.__MANTUR_COMPONENTS_POINTS_ENDPOINT__ : oe;
21
+ function ie() {
22
+ return typeof window < "u" && window.__MANTUR_COMPONENTS_POINTS_ENDPOINT__ ? window.__MANTUR_COMPONENTS_POINTS_ENDPOINT__ : te;
23
23
  }
24
- function ue(e) {
24
+ function ae(e) {
25
25
  if (typeof document > "u") return;
26
26
  let t = `${encodeURIComponent(e)}=`;
27
27
  return document.cookie.split("; ").find((e) => e.startsWith(t))?.slice(t.length);
28
28
  }
29
- function de(e) {
29
+ function oe(e) {
30
30
  if (typeof document > "u") return;
31
31
  let t = encodeURIComponent(e), n = window.location.hostname, r = [void 0, n], i = n.split(".");
32
32
  i.length >= 2 && r.push(`.${i.slice(-2).join(".")}`), r.forEach((e) => {
33
33
  document.cookie = `${t}=; path=/; max-age=0${e ? `; domain=${e}` : ""}`;
34
34
  });
35
35
  }
36
- function fe(e) {
36
+ function se(e) {
37
37
  let t = JSON.parse(e || "null");
38
38
  if (!t) throw Error("Request failed");
39
39
  if (t.code !== 0) throw Error(t.message || "Request failed");
40
40
  return t;
41
41
  }
42
- async function U(e, t = {}) {
43
- let n = ue("front-token"), r = ue("Accept-Language"), i = t.headers || {};
42
+ async function J(e, t = {}) {
43
+ let n = ae("front-token"), r = ae("Accept-Language"), i = t.headers || {};
44
44
  return n && (i.Authorization = decodeURIComponent(n)), r && (i["Accept-Language"] = decodeURIComponent(r)), new Promise((n, r) => {
45
45
  let a = new XMLHttpRequest();
46
- a.open(t.method || "GET", `${ce()}${e}`, !0), a.timeout = t.timeout || 1e4, Object.entries(i).forEach(([e, t]) => {
46
+ a.open(t.method || "GET", `${re()}${e}`, !0), a.timeout = t.timeout || 1e4, Object.entries(i).forEach(([e, t]) => {
47
47
  a.setRequestHeader(e, t);
48
48
  }), a.onload = () => {
49
49
  try {
50
- let e = fe(a.responseText);
50
+ let e = se(a.responseText);
51
51
  if (a.status < 200 || a.status >= 300) {
52
52
  r(Error(e.message || a.statusText));
53
53
  return;
@@ -59,31 +59,31 @@ async function U(e, t = {}) {
59
59
  }, a.onerror = () => r(/* @__PURE__ */ Error("Network request failed")), a.ontimeout = () => r(/* @__PURE__ */ Error("Network request timed out")), a.send(t.body ?? null);
60
60
  });
61
61
  }
62
- async function pe() {
62
+ async function ce() {
63
63
  try {
64
- await U("/auth/front-logout", { method: "DELETE" });
64
+ await J("/auth/front-logout", { method: "DELETE" });
65
65
  } catch (e) {
66
66
  console.warn("Logout request failed, continuing local logout.", e);
67
67
  } finally {
68
- de("front-token"), de("refreshToken"), typeof window < "u" && window.location.reload();
68
+ oe("front-token"), oe("refreshToken"), typeof window < "u" && window.location.reload();
69
69
  }
70
70
  }
71
- async function me(e) {
71
+ async function le(e) {
72
72
  let t;
73
73
  if (e.avatarFile) {
74
74
  let n = new FormData();
75
- n.append("file", e.avatarFile), t = (await U("/users/me/avatar", {
75
+ n.append("file", e.avatarFile), t = (await J("/users/me/avatar", {
76
76
  method: "POST",
77
77
  body: n
78
78
  })).data;
79
79
  }
80
- return (await U("/users/me", {
80
+ return (await J("/users/me", {
81
81
  method: "PUT",
82
82
  headers: { "Content-Type": "application/json;charset=utf-8" },
83
83
  body: JSON.stringify({ nickname: e.nickname })
84
84
  })).data || t;
85
85
  }
86
- function he(e) {
86
+ function ue(e) {
87
87
  let t = (...t) => {
88
88
  let n = t.map((t) => e?.[t]).find((e) => e !== void 0);
89
89
  return typeof n == "number" ? n : Number(n || 0);
@@ -94,14 +94,14 @@ function he(e) {
94
94
  gifted: t("gifted", "giftedPoints", "bonusPoints")
95
95
  };
96
96
  }
97
- async function W() {
98
- return he((await U(le())).data);
97
+ async function de() {
98
+ return ue((await J(ie())).data);
99
99
  }
100
- async function G() {
101
- let e = await W();
102
- return typeof window < "u" && window.dispatchEvent(new CustomEvent(H, { detail: e })), e;
100
+ async function fe() {
101
+ let e = await de();
102
+ return typeof window < "u" && window.dispatchEvent(new CustomEvent(q, { detail: e })), e;
103
103
  }
104
- function ge(e, t) {
104
+ function pe(e, t) {
105
105
  return t?.tenantId ? e.find((e) => e.tenantId === t.tenantId) || {
106
106
  tenantId: t.tenantId,
107
107
  tenantName: t.tenantName || t.tenantId,
@@ -111,40 +111,37 @@ function ge(e, t) {
111
111
  }))
112
112
  } : e.find((e) => e.isOwner) || e[0];
113
113
  }
114
- function _e(e) {
115
- typeof window < "u" && (window.__MANTUR_COMPONENTS_TENANT_CONTEXT__ = e, window.dispatchEvent(new CustomEvent(se, { detail: e })));
116
- }
117
- function ve() {
118
- if (!(typeof window > "u")) return window.__MANTUR_COMPONENTS_TENANT_CONTEXT__;
114
+ function me(e) {
115
+ typeof window < "u" && (window.__MANTUR_COMPONENTS_TENANT_CONTEXT__ = e, window.dispatchEvent(new CustomEvent(ne, { detail: e })));
119
116
  }
120
- async function K() {
121
- return (await U("/users/me/tenants")).data || [];
117
+ async function he() {
118
+ return (await J("/users/me/tenants")).data || [];
122
119
  }
123
- async function ye() {
124
- return (await U("/auth/current-tenant")).data;
120
+ async function ge() {
121
+ return (await J("/auth/current-tenant")).data;
125
122
  }
126
- async function be(e) {
127
- return (await U(`/auth/current-tenant/${e}`, { method: "PUT" })).data;
123
+ async function _e(e) {
124
+ return (await J(`/auth/current-tenant/${e}`, { method: "PUT" })).data;
128
125
  }
129
- async function xe(e = "refresh") {
130
- let [t, n] = await Promise.all([K(), ye()]), r = {
126
+ async function ve(e = "refresh") {
127
+ let [t, n] = await Promise.all([he(), ge()]), r = {
131
128
  tenants: t,
132
- currentTenant: ge(t, n),
129
+ currentTenant: pe(t, n),
133
130
  auth: n,
134
131
  reason: e
135
132
  };
136
- return _e(r), r;
133
+ return me(r), r;
137
134
  }
138
- async function Se(e) {
139
- let t = await be(e), n = await K(), r = {
135
+ async function ye(e) {
136
+ let t = await _e(e), n = await he(), r = {
140
137
  tenants: n,
141
- currentTenant: ge(n, t),
138
+ currentTenant: pe(n, t),
142
139
  auth: t,
143
140
  reason: "switch"
144
141
  };
145
- return _e(r), r;
142
+ return me(r), r;
146
143
  }
147
- var Ce = {
144
+ var be = {
148
145
  title: "Mantur",
149
146
  switchTeam: "Switch Team",
150
147
  personalSettings: "Personal Settings",
@@ -197,10 +194,10 @@ var Ce = {
197
194
  pointsDeductionTip: "Points expiring soon are deducted first.",
198
195
  pointsNoteTitle: "Note",
199
196
  pointsAccountNote: "Points are attached to your personal account. You recharge, consume, and manage them yourself. Others cannot recharge or use them for you. Recharge points are valid for 2 years; gifted points follow the validity set by operations."
200
- }, we = {
197
+ }, xe = {
201
198
  languageZh: "中文",
202
199
  languageEn: "English"
203
- }, Te = {
200
+ }, Se = {
204
201
  title: "漫途",
205
202
  switchTeam: "切换团队",
206
203
  personalSettings: "个人设置",
@@ -253,44 +250,44 @@ var Ce = {
253
250
  pointsDeductionTip: "优先扣减即将到期的积分",
254
251
  pointsNoteTitle: "说明",
255
252
  pointsAccountNote: "积分账户挂在你的个人账号上,自己充值、自己消耗、自己负责;他人不能代充、不能代用。充值积分有效期固定 2 年;赠送积分有效期由后台运营发放时设置。"
256
- }, Ee = {
253
+ }, Ce = {
257
254
  languageZh: "中文",
258
255
  languageEn: "English"
259
- }, De = "i18nextLng", Oe = "manturLanguageSource", q = "mantur-language-change", ke = {
256
+ }, we = "i18nextLng", Te = "manturLanguageSource", Y = "mantur-language-change", Ee = {
260
257
  "zh-CN": {
261
- ...Te,
262
- ...Ee
258
+ ...Se,
259
+ ...Ce
263
260
  },
264
261
  "en-US": {
265
- ...Ce,
266
- ...we
262
+ ...be,
263
+ ...xe
267
264
  }
268
265
  };
269
- function J(e) {
266
+ function X(e) {
270
267
  return e?.toLowerCase().startsWith("en") ? "en-US" : "zh-CN";
271
268
  }
272
- function Y() {
273
- return typeof window > "u" ? "zh-CN" : J(window.localStorage.getItem("i18nextLng") || document.documentElement.lang || navigator.language);
269
+ function Z() {
270
+ return typeof window > "u" ? "zh-CN" : X(window.localStorage.getItem("i18nextLng") || document.documentElement.lang || navigator.language);
274
271
  }
275
- function X(e) {
276
- return ke[J(e)];
272
+ function De(e) {
273
+ return Ee[X(e)];
277
274
  }
278
275
  //#endregion
279
276
  //#region src/lang-switch/LangSwitch.tsx
280
- var Ae = De, je = Oe;
281
- function Me(e, t) {
277
+ var Oe = we, ke = Te;
278
+ function Ae(e, t) {
282
279
  document.cookie = `${encodeURIComponent(e)}=${encodeURIComponent(t)}; path=/`;
283
280
  }
284
- function Ne() {
285
- let { i18n: e } = P(), [n, r] = i(() => Y()), a = X(n);
281
+ function je() {
282
+ let { i18n: e } = P(), [n, r] = i(() => Z()), a = De(n);
286
283
  return t(() => {
287
- r(J(e.language));
284
+ r(X(e.language));
288
285
  }, [e.language]), /* @__PURE__ */ F(u, {
289
286
  droplist: /* @__PURE__ */ I(m, {
290
287
  selectedKeys: [n],
291
288
  onClickMenuItem: (t) => {
292
- let n = J(t);
293
- localStorage.setItem(Ae, t), localStorage.setItem(je, "manual"), r(n), e.changeLanguage(t), Me("Accept-Language", t), window.dispatchEvent(new CustomEvent(q, { detail: n })), window.location.reload();
289
+ let n = X(t);
290
+ localStorage.setItem(Oe, t), localStorage.setItem(ke, "manual"), r(n), e.changeLanguage(t), Ae("Accept-Language", t), window.dispatchEvent(new CustomEvent(Y, { detail: n })), window.location.reload();
294
291
  },
295
292
  children: [/* @__PURE__ */ F(m.Item, { children: a.languageZh }, "zh-CN"), /* @__PURE__ */ F(m.Item, { children: a.languageEn }, "en-US")]
296
293
  }),
@@ -304,7 +301,7 @@ function Ne() {
304
301
  }
305
302
  //#endregion
306
303
  //#region src/theme-switch/ThemeSwitch.tsx
307
- function Pe() {
304
+ function Me() {
308
305
  let { resolvedTheme: e, setTheme: t } = L();
309
306
  return /* @__PURE__ */ F(o, {
310
307
  shape: "circle",
@@ -316,7 +313,7 @@ function Pe() {
316
313
  }
317
314
  //#endregion
318
315
  //#region src/header/mock.ts
319
- var Z = [
316
+ var Q = [
320
317
  {
321
318
  id: "points-500",
322
319
  points: 500,
@@ -338,7 +335,7 @@ var Z = [
338
335
  points: 24e3,
339
336
  price: 200
340
337
  }
341
- ], Fe = [
338
+ ], Ne = [
342
339
  {
343
340
  id: "recharge-1",
344
341
  type: "income",
@@ -411,14 +408,14 @@ var Z = [
411
408
  badgeKind: "deducted",
412
409
  badgeText: "已扣除"
413
410
  }
414
- ], { RangePicker: Ie } = c, Le = 21, Re = 7;
415
- function ze(e) {
411
+ ], { RangePicker: Pe } = c, Fe = 21, Ie = 7;
412
+ function Le(e) {
416
413
  return e === "recharge" ? "arcoblue" : e === "gift" ? "cyan" : e === "expired" ? "gray" : "orange";
417
414
  }
418
- function Be({ visible: e, points: t, text: r, onCancel: a, onRecharge: c }) {
415
+ function Re({ visible: e, points: t, text: r, onCancel: a, onRecharge: c }) {
419
416
  let [l, u] = i("all"), [d, p] = i("all"), [m, C] = i(["2026-04-15", "2026-05-15"]), [w, T] = i(1), E = (e) => new Intl.NumberFormat().format(e), D = n(() => {
420
417
  let [e, t] = m;
421
- return Fe.filter((n) => {
418
+ return Ne.filter((n) => {
422
419
  let r = l === "all" || n.type === l, i = d === "all" || n.source === d, a = !e || n.date >= e, o = !t || n.date <= t;
423
420
  return r && i && a && o;
424
421
  });
@@ -458,7 +455,7 @@ function Be({ visible: e, points: t, text: r, onCancel: a, onRecharge: c }) {
458
455
  width: 110,
459
456
  align: "right",
460
457
  render: (e, t) => /* @__PURE__ */ F(x, {
461
- color: ze(t.badgeKind),
458
+ color: Le(t.badgeKind),
462
459
  children: t.badgeText
463
460
  })
464
461
  }
@@ -591,7 +588,7 @@ function Be({ visible: e, points: t, text: r, onCancel: a, onRecharge: c }) {
591
588
  })
592
589
  ]
593
590
  }),
594
- /* @__PURE__ */ F(Ie, {
591
+ /* @__PURE__ */ F(Pe, {
595
592
  value: m,
596
593
  onChange: (e) => C(e),
597
594
  style: { width: 260 }
@@ -612,8 +609,8 @@ function Be({ visible: e, points: t, text: r, onCancel: a, onRecharge: c }) {
612
609
  /* @__PURE__ */ F(_, {
613
610
  className: "mt-3 flex justify-center!",
614
611
  current: w,
615
- pageSize: Re,
616
- total: Le,
612
+ pageSize: Ie,
613
+ total: Fe,
617
614
  onChange: T
618
615
  })
619
616
  ]
@@ -633,17 +630,17 @@ function Be({ visible: e, points: t, text: r, onCancel: a, onRecharge: c }) {
633
630
  }
634
631
  //#endregion
635
632
  //#region src/labels.ts
636
- var Ve = Ce;
637
- function He(e) {
633
+ var ze = be;
634
+ function Be(e) {
638
635
  return {
639
- ...Ve,
636
+ ...ze,
640
637
  ...e
641
638
  };
642
639
  }
643
640
  //#endregion
644
641
  //#region src/header/components/ProfileModal.tsx
645
- var Q = 2048, Ue = 2 * 1024 * 1024;
646
- function We(e) {
642
+ var Ve = 2048, He = 2 * 1024 * 1024;
643
+ function Ue(e) {
647
644
  return new Promise((t, n) => {
648
645
  let r = URL.createObjectURL(e), i = new Image();
649
646
  i.onload = () => {
@@ -656,8 +653,8 @@ function We(e) {
656
653
  }, i.src = r;
657
654
  });
658
655
  }
659
- function Ge({ visible: e, user: n, labels: s, onCancel: c, onSubmit: l }) {
660
- let u = He(s), [f] = d.useForm(), [m, _] = i(!1), [v, y] = i(null), [b, x] = i(null), S = r(null);
656
+ function We({ visible: e, user: n, labels: s, onCancel: c, onSubmit: l }) {
657
+ let u = Be(s), [f] = d.useForm(), [m, _] = i(!1), [v, y] = i(null), [b, x] = i(null), S = r(null);
661
658
  t(() => () => {
662
659
  S.current &&= (URL.revokeObjectURL(S.current), null);
663
660
  }, []), t(() => {
@@ -724,10 +721,10 @@ function Ge({ visible: e, user: n, labels: s, onCancel: c, onSubmit: l }) {
724
721
  accept: "image/*",
725
722
  showUploadList: !1,
726
723
  beforeUpload: async (e) => {
727
- if (e.size > Ue) return w(u.profileAvatarTooLarge), !1;
724
+ if (e.size > He) return w(u.profileAvatarTooLarge), !1;
728
725
  try {
729
- let { width: t, height: n } = await We(e);
730
- if (t > Q || n > Q) return w(u.profileAvatarDimensionExceeded), !1;
726
+ let { width: t, height: n } = await Ue(e);
727
+ if (t > Ve || n > Ve) return w(u.profileAvatarDimensionExceeded), !1;
731
728
  } catch (e) {
732
729
  return w(u.profileAvatarInvalidImage, e), !1;
733
730
  }
@@ -755,7 +752,7 @@ function Ge({ visible: e, user: n, labels: s, onCancel: c, onSubmit: l }) {
755
752
  }
756
753
  //#endregion
757
754
  //#region src/header/components/UserAvatar.tsx
758
- function Ke(e) {
755
+ function Ge(e) {
759
756
  return e?.nickname?.[0] || e?.username?.[0] || "U";
760
757
  }
761
758
  function $({ user: e, size: t, className: n = "" }) {
@@ -766,13 +763,13 @@ function $({ user: e, size: t, className: n = "" }) {
766
763
  src: e.avatar,
767
764
  alt: "avatar",
768
765
  className: "h-full w-full object-cover"
769
- }) : Ke(e)
766
+ }) : Ge(e)
770
767
  });
771
768
  }
772
769
  //#endregion
773
770
  //#region src/header/components/RechargeModal.tsx
774
- function qe({ visible: e, user: t, points: n, text: r, onCancel: a, onPay: c }) {
775
- let [l, u] = i(Z[2].id), d = (e) => new Intl.NumberFormat().format(e), p = Z.find((e) => e.id === l) || Z[0];
771
+ function Ke({ visible: e, user: t, points: n, text: r, onCancel: a, onPay: c }) {
772
+ let [l, u] = i(Q[2].id), d = (e) => new Intl.NumberFormat().format(e), p = Q.find((e) => e.id === l) || Q[0];
776
773
  return /* @__PURE__ */ F(g, {
777
774
  title: r.rechargeTitle,
778
775
  visible: e,
@@ -827,7 +824,7 @@ function qe({ visible: e, user: t, points: n, text: r, onCancel: a, onPay: c })
827
824
  className: "mt-6 w-full",
828
825
  children: /* @__PURE__ */ F(f.Row, {
829
826
  gutter: [16, 16],
830
- children: Z.map((e) => /* @__PURE__ */ F(f.Col, {
827
+ children: Q.map((e) => /* @__PURE__ */ F(f.Col, {
831
828
  xs: 24,
832
829
  sm: 12,
833
830
  lg: 6,
@@ -884,7 +881,7 @@ function qe({ visible: e, user: t, points: n, text: r, onCancel: a, onPay: c })
884
881
  }
885
882
  //#endregion
886
883
  //#region src/header/components/UserMenu.tsx
887
- function Je({ user: e, points: t, text: n, onEditProfile: r, onRecharge: i, onPointsDetail: a, onLogout: s }) {
884
+ function qe({ user: e, points: t, text: n, onEditProfile: r, onRecharge: i, onPointsDetail: a, onLogout: s }) {
888
885
  let c = (e) => new Intl.NumberFormat().format(e);
889
886
  return /* @__PURE__ */ I("div", {
890
887
  className: "w-80 overflow-hidden rounded-xl border border-arco-border-2 bg-arco-bg-popup shadow-[0_10px_28px_rgb(0_0_0/12%)]",
@@ -978,24 +975,24 @@ function Je({ user: e, points: t, text: n, onEditProfile: r, onRecharge: i, onPo
978
975
  }
979
976
  //#endregion
980
977
  //#region src/header/ManturHeader.tsx
981
- var Ye = "https://mantur.ai/images/logo.png", Xe = [
978
+ var Je = "https://mantur.ai/images/logo.png", Ye = [
982
979
  "from-arco-primary-light-1 to-arco-primary-light-2 text-arco-primary-6",
983
980
  "from-arco-success-light-1 to-arco-success-light-2 text-arco-success-6",
984
981
  "from-arco-warning-light-1 to-arco-warning-light-2 text-arco-warning-6",
985
982
  "from-arco-danger-light-1 to-arco-danger-light-2 text-arco-danger-6"
986
983
  ];
987
- function Ze(e, t = !1) {
988
- return `flex h-8 min-h-8 w-8 min-w-8 flex-none items-center justify-center rounded-lg bg-linear-to-br font-bold leading-none ${Xe[e % Xe.length]} ${t ? "shadow-[inset_0_1px_3px_rgb(0_0_0/8%)]" : ""}`;
984
+ function Xe(e, t = !1) {
985
+ return `flex h-8 min-h-8 w-8 min-w-8 flex-none items-center justify-center rounded-lg bg-linear-to-br font-bold leading-none ${Ye[e % Ye.length]} ${t ? "shadow-[inset_0_1px_3px_rgb(0_0_0/8%)]" : ""}`;
989
986
  }
990
- function Qe(e) {
987
+ function Ze(e) {
991
988
  return e?.tenantName?.[0]?.toUpperCase() || "T";
992
989
  }
993
- function $e(e, t, n) {
990
+ function Qe(e, t, n) {
994
991
  let r = e?.roles?.map((e) => e.roleName).filter(Boolean);
995
992
  return r?.length ? r.join(", ") : e?.isOwner ? t : n;
996
993
  }
997
- function et({ user: a, disabled: o = !1, brandSlot: s, children: c, onTenantContextChange: l }) {
998
- let [d, f] = i(() => Y()), p = X(d), [g, _] = i(!1), [v, y] = i(!1), [b, x] = i(!1), [S, C] = i(a), [w, E] = i([]), [D, O] = i(), [k, A] = i(!1), j = r(l), [M, N] = i({
994
+ function $e({ user: a, disabled: o = !1, brandSlot: s, children: c, onTenantContextChange: l }) {
995
+ let [d, f] = i(() => Z()), p = De(d), [g, _] = i(!1), [v, y] = i(!1), [b, x] = i(!1), [S, C] = i(a), [w, E] = i([]), [D, O] = i(), [k, A] = i(!1), j = r(l), [M, N] = i({
999
996
  total: 0,
1000
997
  recharge: 0,
1001
998
  gifted: 0
@@ -1004,7 +1001,7 @@ function et({ user: a, disabled: o = !1, brandSlot: s, children: c, onTenantCont
1004
1001
  recharge: M.recharge ?? 0,
1005
1002
  gifted: M.gifted ?? 0
1006
1003
  }, z = async (e) => {
1007
- let t = await me(e);
1004
+ let t = await le(e);
1008
1005
  return t && C(t), t;
1009
1006
  };
1010
1007
  t(() => {
@@ -1016,35 +1013,35 @@ function et({ user: a, disabled: o = !1, brandSlot: s, children: c, onTenantCont
1016
1013
  E(e.tenants), O(e.currentTenant), j.current?.(e);
1017
1014
  }, []);
1018
1015
  t(() => {
1019
- A(!0), xe().then(B).catch((e) => {
1016
+ A(!0), ve().then(B).catch((e) => {
1020
1017
  console.warn("Failed to refresh Mantur tenant context.", e), h.error(p.error);
1021
1018
  }).finally(() => A(!1));
1022
1019
  }, [B, p.error]), t(() => {
1023
1020
  let e = (e) => {
1024
1021
  e instanceof CustomEvent && N(e.detail);
1025
1022
  };
1026
- return window.addEventListener(H, e), G().catch((e) => {
1023
+ return window.addEventListener(q, e), fe().catch((e) => {
1027
1024
  console.warn("Failed to refresh Mantur user points.", e);
1028
1025
  }), () => {
1029
- window.removeEventListener(H, e);
1026
+ window.removeEventListener(q, e);
1030
1027
  };
1031
1028
  }, []), t(() => {
1032
1029
  let e = (e) => {
1033
- f(e instanceof CustomEvent ? J(e.detail) : Y());
1030
+ f(e instanceof CustomEvent ? X(e.detail) : Z());
1034
1031
  };
1035
- return window.addEventListener(q, e), window.addEventListener("storage", e), () => {
1036
- window.removeEventListener(q, e), window.removeEventListener("storage", e);
1032
+ return window.addEventListener(Y, e), window.addEventListener("storage", e), () => {
1033
+ window.removeEventListener(Y, e), window.removeEventListener("storage", e);
1037
1034
  };
1038
1035
  }, []);
1039
- let ee = (e) => {
1036
+ let V = (e) => {
1040
1037
  h.success(e);
1041
- }, te = (e, t) => {
1038
+ }, H = (e, t) => {
1042
1039
  console.error(t), h.error(e);
1043
- }, V = e(async (e) => {
1040
+ }, U = e(async (e) => {
1044
1041
  if (!L && e !== P) try {
1045
- A(!0), B(await Se(e)), ee(p.switchedToTeam);
1042
+ A(!0), B(await ye(e)), V(p.switchedToTeam);
1046
1043
  } catch (e) {
1047
- te(p.error, e);
1044
+ H(p.error, e);
1048
1045
  } finally {
1049
1046
  A(!1);
1050
1047
  }
@@ -1054,17 +1051,17 @@ function et({ user: a, disabled: o = !1, brandSlot: s, children: c, onTenantCont
1054
1051
  L,
1055
1052
  p.error,
1056
1053
  p.switchedToTeam
1057
- ]), ne = (e) => {
1054
+ ]), W = (e) => {
1058
1055
  let t = {
1059
1056
  total: R.total + e.points,
1060
1057
  recharge: R.recharge + e.points,
1061
1058
  gifted: R.gifted
1062
1059
  };
1063
- N(t), window.dispatchEvent(new CustomEvent(H, { detail: t })), h.success(p.rechargeSuccess), y(!1);
1064
- }, re = n(() => /* @__PURE__ */ I(m, {
1060
+ N(t), window.dispatchEvent(new CustomEvent(q, { detail: t })), h.success(p.rechargeSuccess), y(!1);
1061
+ }, G = n(() => /* @__PURE__ */ I(m, {
1065
1062
  className: "w-56 rounded-xl bg-arco-bg-popup shadow-[0_10px_28px_rgb(0_0_0/12%)] [&_.arco-menu-inner]:px-2 [&_.arco-menu-inner]:py-1",
1066
1063
  selectedKeys: P ? [P] : [],
1067
- onClickMenuItem: V,
1064
+ onClickMenuItem: U,
1068
1065
  children: [/* @__PURE__ */ F("div", {
1069
1066
  className: "px-3 py-2 text-xs font-semibold tracking-[0.04em] text-arco-text-4 uppercase",
1070
1067
  children: p.switchTeam
@@ -1073,8 +1070,8 @@ function et({ user: a, disabled: o = !1, brandSlot: s, children: c, onTenantCont
1073
1070
  children: /* @__PURE__ */ I("div", {
1074
1071
  className: "flex w-full items-center gap-3 leading-normal",
1075
1072
  children: [/* @__PURE__ */ F("div", {
1076
- className: Ze(t),
1077
- children: Qe(e)
1073
+ className: Xe(t),
1074
+ children: Ze(e)
1078
1075
  }), /* @__PURE__ */ I("div", {
1079
1076
  className: "flex min-w-0 flex-col justify-center gap-0.75",
1080
1077
  children: [/* @__PURE__ */ F("span", {
@@ -1082,25 +1079,25 @@ function et({ user: a, disabled: o = !1, brandSlot: s, children: c, onTenantCont
1082
1079
  children: e.tenantName
1083
1080
  }), /* @__PURE__ */ F("span", {
1084
1081
  className: "text-xs leading-4 text-arco-text-3",
1085
- children: $e(e, p.owner, p.member)
1082
+ children: Qe(e, p.owner, p.member)
1086
1083
  })]
1087
1084
  })]
1088
1085
  })
1089
1086
  }, e.tenantId))]
1090
1087
  }), [
1091
- V,
1088
+ U,
1092
1089
  P,
1093
1090
  w,
1094
1091
  p
1095
- ]), ie = /* @__PURE__ */ F(Je, {
1092
+ ]), K = /* @__PURE__ */ F(qe, {
1096
1093
  user: S,
1097
1094
  points: R,
1098
1095
  text: p,
1099
1096
  onEditProfile: () => _(!0),
1100
1097
  onRecharge: () => y(!0),
1101
1098
  onPointsDetail: () => x(!0),
1102
- onLogout: pe
1103
- }), ae = Math.max(0, w.findIndex((e) => e.tenantId === D?.tenantId));
1099
+ onLogout: ce
1100
+ }), ee = Math.max(0, w.findIndex((e) => e.tenantId === D?.tenantId));
1104
1101
  return /* @__PURE__ */ I("div", {
1105
1102
  className: "flex h-20 items-center justify-between bg-transparent pr-8 shadow-[0_2px_10px_rgb(0_0_0/2%)] backdrop-blur-md max-md:pr-4",
1106
1103
  children: [
@@ -1111,7 +1108,7 @@ function et({ user: a, disabled: o = !1, brandSlot: s, children: c, onTenantCont
1111
1108
  children: [/* @__PURE__ */ F("div", {
1112
1109
  className: "relative flex w-12 items-center justify-center overflow-hidden ",
1113
1110
  children: /* @__PURE__ */ F("img", {
1114
- src: Ye,
1111
+ src: Je,
1115
1112
  alt: "logo",
1116
1113
  className: "w-full object-contain",
1117
1114
  onError: (e) => {
@@ -1123,7 +1120,7 @@ function et({ user: a, disabled: o = !1, brandSlot: s, children: c, onTenantCont
1123
1120
  children: p.title
1124
1121
  })]
1125
1122
  }), /* @__PURE__ */ F(u, {
1126
- droplist: re,
1123
+ droplist: G,
1127
1124
  trigger: "click",
1128
1125
  position: "bl",
1129
1126
  disabled: L,
@@ -1132,8 +1129,8 @@ function et({ user: a, disabled: o = !1, brandSlot: s, children: c, onTenantCont
1132
1129
  className: `flex items-center gap-3 rounded-full border border-arco-border-1 bg-arco-bg-1 px-2 py-1.5 transition-all ${L ? "cursor-not-allowed opacity-60" : "cursor-pointer hover:bg-arco-fill-2 hover:shadow-[0_4px_12px_rgb(0_0_0/8%)]"}`,
1133
1130
  children: [
1134
1131
  /* @__PURE__ */ F("div", {
1135
- className: Ze(ae, !0),
1136
- children: Qe(D)
1132
+ className: Xe(ee, !0),
1133
+ children: Ze(D)
1137
1134
  }),
1138
1135
  /* @__PURE__ */ I("div", {
1139
1136
  className: "flex min-w-0 flex-col",
@@ -1142,7 +1139,7 @@ function et({ user: a, disabled: o = !1, brandSlot: s, children: c, onTenantCont
1142
1139
  children: k ? p.loading : D?.tenantName || p.loading
1143
1140
  }), /* @__PURE__ */ F("span", {
1144
1141
  className: "mt-1 text-[10px] leading-none text-arco-text-3",
1145
- children: $e(D, p.owner, p.member)
1142
+ children: Qe(D, p.owner, p.member)
1146
1143
  })]
1147
1144
  }),
1148
1145
  /* @__PURE__ */ F(T, { className: "ml-1 text-arco-text-3" })
@@ -1158,13 +1155,13 @@ function et({ user: a, disabled: o = !1, brandSlot: s, children: c, onTenantCont
1158
1155
  className: "flex items-center gap-4",
1159
1156
  children: [/* @__PURE__ */ I("div", {
1160
1157
  className: "flex items-center gap-4",
1161
- children: [/* @__PURE__ */ F(Pe, {}), /* @__PURE__ */ F(Ne, {})]
1158
+ children: [/* @__PURE__ */ F(Me, {}), /* @__PURE__ */ F(je, {})]
1162
1159
  }), /* @__PURE__ */ F(u, {
1163
- droplist: ie,
1160
+ droplist: K,
1164
1161
  trigger: "click",
1165
1162
  position: "br",
1166
1163
  onVisibleChange: (e) => {
1167
- e && G().catch((e) => {
1164
+ e && fe().catch((e) => {
1168
1165
  console.warn("Failed to refresh Mantur user points.", e);
1169
1166
  });
1170
1167
  },
@@ -1190,22 +1187,22 @@ function et({ user: a, disabled: o = !1, brandSlot: s, children: c, onTenantCont
1190
1187
  })
1191
1188
  })]
1192
1189
  }),
1193
- /* @__PURE__ */ F(Ge, {
1190
+ /* @__PURE__ */ F(We, {
1194
1191
  visible: g,
1195
1192
  user: S,
1196
1193
  labels: p,
1197
1194
  onCancel: () => _(!1),
1198
1195
  onSubmit: z
1199
1196
  }),
1200
- /* @__PURE__ */ F(qe, {
1197
+ /* @__PURE__ */ F(Ke, {
1201
1198
  visible: v,
1202
1199
  user: S,
1203
1200
  points: R,
1204
1201
  text: p,
1205
1202
  onCancel: () => y(!1),
1206
- onPay: ne
1203
+ onPay: W
1207
1204
  }),
1208
- /* @__PURE__ */ F(Be, {
1205
+ /* @__PURE__ */ F(Re, {
1209
1206
  visible: b,
1210
1207
  points: R,
1211
1208
  text: p,
@@ -1217,7 +1214,7 @@ function et({ user: a, disabled: o = !1, brandSlot: s, children: c, onTenantCont
1217
1214
  }
1218
1215
  //#endregion
1219
1216
  //#region src/utils/date.ts
1220
- var tt = /* @__PURE__ */ ie((/* @__PURE__ */ ne(((e, t) => {
1217
+ var et = /* @__PURE__ */ K((/* @__PURE__ */ W(((e, t) => {
1221
1218
  (function(n, r) {
1222
1219
  typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs = r();
1223
1220
  })(e, (function() {
@@ -1512,10 +1509,10 @@ var tt = /* @__PURE__ */ ie((/* @__PURE__ */ ne(((e, t) => {
1512
1509
  }, w.en = b[y], w.Ls = b, w.p = {}, w;
1513
1510
  }));
1514
1511
  })))(), 1);
1515
- function nt(e, t = "datetime", n) {
1512
+ function tt(e, t = "datetime", n) {
1516
1513
  if (!e) return "-";
1517
- let r = (n ? J(n) : Y()).startsWith("en"), i = t === "date" ? r ? "MM/DD/YYYY" : "YYYY-MM-DD" : r ? "MM/DD/YYYY HH:mm:ss" : "YYYY-MM-DD HH:mm:ss";
1518
- return (0, tt.default)(e).format(i);
1514
+ let r = (n ? X(n) : Z()).startsWith("en"), i = t === "date" ? r ? "MM/DD/YYYY" : "YYYY-MM-DD" : r ? "MM/DD/YYYY HH:mm:ss" : "YYYY-MM-DD HH:mm:ss";
1515
+ return (0, et.default)(e).format(i);
1519
1516
  }
1520
1517
  //#endregion
1521
- export { je as LANGUAGE_SOURCE_STORAGE_KEY, Ae as LANGUAGE_STORAGE_KEY, Ne as LangSwitch, q as MANTUR_LANGUAGE_CHANGE_EVENT, Oe as MANTUR_LANGUAGE_SOURCE_STORAGE_KEY, De as MANTUR_LANGUAGE_STORAGE_KEY, ke as MANTUR_MESSAGES, H as MANTUR_POINTS_REFRESH_EVENT, se as MANTUR_TENANT_CONTEXT_CHANGE_EVENT, et as ManturHeader, Pe as ThemeSwitch, nt as formatDateByLang, ye as getManturCurrentTenant, X as getManturMessages, ve as getManturTenantContextSnapshot, K as getManturTenants, W as getManturUserPoints, Y as getStoredManturLocale, J as normalizeManturLocale, xe as refreshManturTenantContext, G as refreshManturUserPoints, Se as switchAndRefreshManturTenant, be as switchManturTenant };
1518
+ export { $e as ManturHeader, tt as formatDateByLang };
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`react`),require(`@arco-design/web-react`),require(`@arco-design/web-react/icon`),require(`react-i18next`),require(`react/jsx-runtime`),require(`next-themes`)):typeof define==`function`&&define.amd?define([`exports`,`react`,`@arco-design/web-react`,`@arco-design/web-react/icon`,`react-i18next`,`react/jsx-runtime`,`next-themes`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ManturComponents={},e.React,e.ArcoDesign,e.ArcoDesignIcon,e.ReactI18next,e.jsxRuntime,e.nextThemes))})(this,function(e,t,n,r,i,a,o){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var s=Object.create,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,d=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty,p=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),m=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=u(t),a=0,o=i.length,s;a<o;a++)s=i[a],!f.call(e,s)&&s!==n&&c(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=l(t,s))||r.enumerable});return e},h=(e,t,n)=>(n=e==null?{}:s(d(e)),m(t||!e||!e.__esModule?c(n,`default`,{value:e,enumerable:!0}):n,e)),g=`/api`,_=`/users/me/points`,v=`mantur-points-refresh`,y=`mantur-tenant-context-change`;function b(){return typeof window<`u`&&window.__MANTUR_COMPONENTS_API_BASE__?window.__MANTUR_COMPONENTS_API_BASE__:g}function x(){return typeof window<`u`&&window.__MANTUR_COMPONENTS_POINTS_ENDPOINT__?window.__MANTUR_COMPONENTS_POINTS_ENDPOINT__:_}function S(e){if(typeof document>`u`)return;let t=`${encodeURIComponent(e)}=`;return document.cookie.split(`; `).find(e=>e.startsWith(t))?.slice(t.length)}function C(e){if(typeof document>`u`)return;let t=encodeURIComponent(e),n=window.location.hostname,r=[void 0,n],i=n.split(`.`);i.length>=2&&r.push(`.${i.slice(-2).join(`.`)}`),r.forEach(e=>{document.cookie=`${t}=; path=/; max-age=0${e?`; domain=${e}`:``}`})}function w(e){let t=JSON.parse(e||`null`);if(!t)throw Error(`Request failed`);if(t.code!==0)throw Error(t.message||`Request failed`);return t}async function T(e,t={}){let n=S(`front-token`),r=S(`Accept-Language`),i=t.headers||{};return n&&(i.Authorization=decodeURIComponent(n)),r&&(i[`Accept-Language`]=decodeURIComponent(r)),new Promise((n,r)=>{let a=new XMLHttpRequest;a.open(t.method||`GET`,`${b()}${e}`,!0),a.timeout=t.timeout||1e4,Object.entries(i).forEach(([e,t])=>{a.setRequestHeader(e,t)}),a.onload=()=>{try{let e=w(a.responseText);if(a.status<200||a.status>=300){r(Error(e.message||a.statusText));return}n(e)}catch(e){r(e)}},a.onerror=()=>r(Error(`Network request failed`)),a.ontimeout=()=>r(Error(`Network request timed out`)),a.send(t.body??null)})}async function E(){try{await T(`/auth/front-logout`,{method:`DELETE`})}catch(e){console.warn(`Logout request failed, continuing local logout.`,e)}finally{C(`front-token`),C(`refreshToken`),typeof window<`u`&&window.location.reload()}}async function D(e){let t;if(e.avatarFile){let n=new FormData;n.append(`file`,e.avatarFile),t=(await T(`/users/me/avatar`,{method:`POST`,body:n})).data}return(await T(`/users/me`,{method:`PUT`,headers:{"Content-Type":`application/json;charset=utf-8`},body:JSON.stringify({nickname:e.nickname})})).data||t}function O(e){let t=(...t)=>{let n=t.map(t=>e?.[t]).find(e=>e!==void 0);return typeof n==`number`?n:Number(n||0)};return{total:t(`total`,`totalPoints`,`balance`,`points`),recharge:t(`recharge`,`rechargePoints`,`paidPoints`),gifted:t(`gifted`,`giftedPoints`,`bonusPoints`)}}async function k(){return O((await T(x())).data)}async function A(){let e=await k();return typeof window<`u`&&window.dispatchEvent(new CustomEvent(v,{detail:e})),e}function j(e,t){return t?.tenantId?e.find(e=>e.tenantId===t.tenantId)||{tenantId:t.tenantId,tenantName:t.tenantName||t.tenantId,roles:t.roles?.map(e=>({roleCode:e,roleName:e}))}:e.find(e=>e.isOwner)||e[0]}function M(e){typeof window<`u`&&(window.__MANTUR_COMPONENTS_TENANT_CONTEXT__=e,window.dispatchEvent(new CustomEvent(y,{detail:e})))}function N(){if(!(typeof window>`u`))return window.__MANTUR_COMPONENTS_TENANT_CONTEXT__}async function P(){return(await T(`/users/me/tenants`)).data||[]}async function F(){return(await T(`/auth/current-tenant`)).data}async function I(e){return(await T(`/auth/current-tenant/${e}`,{method:`PUT`})).data}async function ee(e=`refresh`){let[t,n]=await Promise.all([P(),F()]),r={tenants:t,currentTenant:j(t,n),auth:n,reason:e};return M(r),r}async function te(e){let t=await I(e),n=await P(),r={tenants:n,currentTenant:j(n,t),auth:t,reason:`switch`};return M(r),r}var L={title:`Mantur`,switchTeam:`Switch Team`,personalSettings:`Personal Settings`,logout:`Logout`,loading:`Loading...`,owner:`Owner`,member:`Member`,createTeam:`Create Team`,createTeamComingSoon:`Create team is coming soon`,switchedToTeam:`Switched team`,error:`Request failed`,profileTitle:`Profile`,profileNickname:`Nickname`,profileNicknamePlaceholder:`Please enter nickname`,profileAvatar:`Avatar`,profileUploadAvatar:`Upload Avatar`,profileAvatarHint:`JPG/PNG/WebP, max 2MB, max 2048px.`,profileAvatarTooLarge:`Avatar must be less than 2MB`,profileAvatarDimensionExceeded:`Avatar dimensions must be within 2048px`,profileAvatarInvalidImage:`Invalid image`,profileUpdateSuccess:`Profile updated`,profileSave:`Save`,profileCancel:`Cancel`,myPoints:`My Points`,totalBalance:`Total Balance`,rechargePoints:`Recharge Points`,giftedPoints:`Gifted Points`,recharge:`Recharge`,rechargeTitle:`Recharge Points`,pointsDetail:`Points Detail`,close:`Close`,currentBalance:`Current Balance`,pointsUnit:`points`,rechargeHint:`Recharge points are valid for 2 years after arrival.`,payNow:`Pay Now`,rechargeSuccess:`Recharge successful`,all:`All`,income:`Income`,expense:`Expense`,source:`Source`,sourceAll:`All Sources`,sourceRecharge:`Recharge`,sourceGifted:`Gifted`,dateRange:`Date Range`,startDate:`Start Date`,endDate:`End Date`,dateTo:`to`,query:`Query`,refreshed:`Refreshed`,pointsDeductionTip:`Points expiring soon are deducted first.`,pointsNoteTitle:`Note`,pointsAccountNote:`Points are attached to your personal account. You recharge, consume, and manage them yourself. Others cannot recharge or use them for you. Recharge points are valid for 2 years; gifted points follow the validity set by operations.`},R={languageZh:`中文`,languageEn:`English`},z={title:`漫途`,switchTeam:`切换团队`,personalSettings:`个人设置`,logout:`退出登录`,loading:`加载中...`,owner:`管理员`,member:`成员`,createTeam:`创建团队`,createTeamComingSoon:`创建团队功能即将上线`,switchedToTeam:`已切换团队`,error:`请求失败`,profileTitle:`个人资料`,profileNickname:`昵称`,profileNicknamePlaceholder:`请输入昵称`,profileAvatar:`头像`,profileUploadAvatar:`上传头像`,profileAvatarHint:`支持 JPG/PNG/WebP,最大 2MB,尺寸不超过 2048px。`,profileAvatarTooLarge:`头像不能超过 2MB`,profileAvatarDimensionExceeded:`头像尺寸不能超过 2048px`,profileAvatarInvalidImage:`图片无效`,profileUpdateSuccess:`个人资料已更新`,profileSave:`保存`,profileCancel:`取消`,myPoints:`我的积分`,totalBalance:`总余额`,rechargePoints:`充值积分`,giftedPoints:`赠送积分`,recharge:`去充值`,rechargeTitle:`充值积分`,pointsDetail:`积分明细`,close:`关闭`,currentBalance:`当前余额`,pointsUnit:`积分`,rechargeHint:`充值积分有效期 2 年(自到账日起算),支付后不可退换。`,payNow:`立即支付`,rechargeSuccess:`充值成功`,all:`全部`,income:`获得`,expense:`消耗`,source:`来源`,sourceAll:`全部来源`,sourceRecharge:`充值`,sourceGifted:`赠送`,dateRange:`日期查询`,startDate:`开始日期`,endDate:`结束日期`,dateTo:`至`,query:`查询`,refreshed:`已刷新`,pointsDeductionTip:`优先扣减即将到期的积分`,pointsNoteTitle:`说明`,pointsAccountNote:`积分账户挂在你的个人账号上,自己充值、自己消耗、自己负责;他人不能代充、不能代用。充值积分有效期固定 2 年;赠送积分有效期由后台运营发放时设置。`},B={languageZh:`中文`,languageEn:`English`},V=`i18nextLng`,H=`manturLanguageSource`,U=`mantur-language-change`,W={"zh-CN":{...z,...B},"en-US":{...L,...R}};function G(e){return e?.toLowerCase().startsWith(`en`)?`en-US`:`zh-CN`}function K(){return typeof window>`u`?`zh-CN`:G(window.localStorage.getItem(`i18nextLng`)||document.documentElement.lang||navigator.language)}function q(e){return W[G(e)]}var J=V,Y=H;function ne(e,t){document.cookie=`${encodeURIComponent(e)}=${encodeURIComponent(t)}; path=/`}function X(){let{i18n:e}=(0,i.useTranslation)(),[o,s]=(0,t.useState)(()=>K()),c=q(o);return(0,t.useEffect)(()=>{s(G(e.language))},[e.language]),(0,a.jsx)(n.Dropdown,{droplist:(0,a.jsxs)(n.Menu,{selectedKeys:[o],onClickMenuItem:t=>{let n=G(t);localStorage.setItem(J,t),localStorage.setItem(Y,`manual`),s(n),e.changeLanguage(t),ne(`Accept-Language`,t),window.dispatchEvent(new CustomEvent(U,{detail:n})),window.location.reload()},children:[(0,a.jsx)(n.Menu.Item,{children:c.languageZh},`zh-CN`),(0,a.jsx)(n.Menu.Item,{children:c.languageEn},`en-US`)]}),trigger:`click`,position:`br`,children:(0,a.jsx)(n.Button,{shape:`circle`,icon:(0,a.jsx)(r.IconLanguage,{})})})}function Z(){let{resolvedTheme:e,setTheme:t}=(0,o.useTheme)();return(0,a.jsx)(n.Button,{shape:`circle`,icon:e===`light`?(0,a.jsx)(r.IconMoonFill,{}):(0,a.jsx)(r.IconSunFill,{}),onClick:()=>{t(e===`light`?`dark`:`light`)}})}var Q=[{id:`points-500`,points:500,price:5},{id:`points-1000`,points:1e3,price:10},{id:`points-5500`,points:5500,price:50,recommended:!0},{id:`points-24000`,points:24e3,price:200}],re=[{id:`recharge-1`,type:`income`,source:`recharge`,name:`积分充值`,meta:`2026-05-10 14:00:00 · 订单号 R20260510140000 · 套餐 $50`,date:`2026-05-10`,amount:5500,badgeKind:`recharge`,badgeText:`充值`},{id:`gift-1`,type:`income`,source:`gift`,name:`系统赠送 · 新人礼包`,meta:`2026-05-08 09:00:00 · 有效期 30 天`,date:`2026-05-08`,amount:1e3,badgeKind:`gift`,badgeText:`赠送`},{id:`expense-1`,type:`expense`,name:`视频生成 — Sora 40秒 4K`,meta:`2026-05-10 16:45:22 · 制作中心`,date:`2026-05-10`,amount:-400,badgeKind:`deducted`,badgeText:`已扣除`},{id:`expense-2`,type:`expense`,name:`视频生成 — Sora 25秒 1080p`,meta:`2026-05-11 09:15:42 · 制作中心`,date:`2026-05-11`,amount:-250,badgeKind:`deducted`,badgeText:`已扣除`},{id:`expire-1`,type:`expense`,name:`积分过期`,meta:`2026-05-01 00:00:00 · 2026-04 批次到期未使用`,date:`2026-05-01`,amount:-100,badgeKind:`expired`,badgeText:`自然过期`},{id:`expense-3`,type:`expense`,name:`AI 对话 — GPT-4o 5轮`,meta:`2026-05-07 10:08:55 · 剧本中心`,date:`2026-05-07`,amount:-10,badgeKind:`deducted`,badgeText:`已扣除`},{id:`expense-4`,type:`expense`,name:`图片生成 — DALL-E 5张`,meta:`2026-05-04 14:20:11 · 制作中心`,date:`2026-05-04`,amount:-75,badgeKind:`deducted`,badgeText:`已扣除`}],{RangePicker:ie}=n.DatePicker,ae=21,oe=7;function se(e){return e===`recharge`?`arcoblue`:e===`gift`?`cyan`:e===`expired`?`gray`:`orange`}function ce({visible:e,points:i,text:o,onCancel:s,onRecharge:c}){let[l,u]=(0,t.useState)(`all`),[d,f]=(0,t.useState)(`all`),[p,m]=(0,t.useState)([`2026-04-15`,`2026-05-15`]),[h,g]=(0,t.useState)(1),_=e=>new Intl.NumberFormat().format(e),v=(0,t.useMemo)(()=>{let[e,t]=p;return re.filter(n=>{let r=l===`all`||n.type===l,i=d===`all`||n.source===d,a=!e||n.date>=e,o=!t||n.date<=t;return r&&i&&a&&o})},[p,d,l]),y=[{title:o.pointsDetail,dataIndex:`name`,render:(e,t)=>(0,a.jsxs)(`div`,{className:`min-w-0`,children:[(0,a.jsx)(n.Typography.Text,{className:`font-medium!`,children:t.name}),(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`mt-1 block! text-xs!`,children:t.meta})]})},{title:o.pointsUnit,dataIndex:`amount`,width:120,align:`right`,render:(e,t)=>(0,a.jsxs)(n.Typography.Text,{className:`font-semibold! ${t.amount>0?`text-arco-success-6!`:`text-arco-danger-6!`}`,children:[t.amount>0?`+`:``,_(t.amount)]})},{title:o.source,dataIndex:`badgeText`,width:110,align:`right`,render:(e,t)=>(0,a.jsx)(n.Tag,{color:se(t.badgeKind),children:t.badgeText})}];return(0,a.jsx)(n.Modal,{title:o.pointsDetail,visible:e,footer:(0,a.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,a.jsx)(n.Button,{onClick:s,children:o.close}),(0,a.jsx)(n.Button,{type:`primary`,icon:(0,a.jsx)(r.IconPlus,{}),onClick:()=>{s(),c()},children:o.recharge})]}),onCancel:s,style:{width:780,maxWidth:`calc(100vw - 48px)`},children:(0,a.jsxs)(`div`,{className:`max-h-[70vh] overflow-y-auto`,children:[(0,a.jsxs)(n.Card,{bordered:!1,className:`from-arco-primary-light-1/40 to-cyan-400/5 rounded-none! bg-linear-to-br!`,children:[(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`text-xs!`,children:o.totalBalance}),(0,a.jsxs)(`div`,{className:`mt-1.5 mb-3.5 `,children:[(0,a.jsx)(n.Typography.Text,{className:`text-3xl! font-bold!`,children:_(i.total)}),(0,a.jsxs)(n.Typography.Text,{type:`secondary`,className:`ml-2 text-sm! `,children:[`🪙 `,o.pointsUnit]})]}),(0,a.jsxs)(n.Grid.Row,{gutter:12,children:[(0,a.jsx)(n.Grid.Col,{span:12,children:(0,a.jsxs)(n.Card,{size:`small`,children:[(0,a.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`text-xs!`,children:o.rechargePoints}),(0,a.jsx)(n.Tag,{color:`arcoblue`,children:o.sourceRecharge})]}),(0,a.jsx)(n.Typography.Text,{className:`text-lg! font-semibold!`,children:_(i.recharge)})]})}),(0,a.jsx)(n.Grid.Col,{span:12,children:(0,a.jsxs)(n.Card,{size:`small`,children:[(0,a.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`text-xs!`,children:o.giftedPoints}),(0,a.jsx)(n.Tag,{color:`success`,children:o.sourceGifted})]}),(0,a.jsx)(n.Typography.Text,{className:`text-lg! font-semibold!`,children:_(i.gifted)})]})})]}),(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`mt-2.5 block! text-xs!`,children:o.pointsDeductionTip})]}),(0,a.jsxs)(`div`,{className:`px-6 py-4`,children:[(0,a.jsxs)(n.Tabs,{activeTab:l,onChange:e=>u(e),children:[(0,a.jsx)(n.Tabs.TabPane,{title:o.all},`all`),(0,a.jsx)(n.Tabs.TabPane,{title:o.income},`income`),(0,a.jsx)(n.Tabs.TabPane,{title:o.expense},`expense`)]}),(0,a.jsxs)(`div`,{className:`mt-2 mb-3.5 flex flex-wrap items-center gap-2.5`,children:[(0,a.jsxs)(n.Select,{value:d,style:{width:140},onChange:e=>f(e),children:[(0,a.jsx)(n.Select.Option,{value:`all`,children:o.sourceAll}),(0,a.jsx)(n.Select.Option,{value:`recharge`,children:o.sourceRecharge}),(0,a.jsx)(n.Select.Option,{value:`gift`,children:o.sourceGifted})]}),(0,a.jsx)(ie,{value:p,onChange:e=>m(e),style:{width:260}}),(0,a.jsx)(n.Button,{onClick:()=>n.Message.success(o.refreshed),children:o.query})]}),(0,a.jsx)(n.Table,{rowKey:`id`,columns:y,data:v,pagination:!1,border:!1}),(0,a.jsx)(n.Pagination,{className:`mt-3 flex justify-center!`,current:h,pageSize:oe,total:ae,onChange:g})]}),(0,a.jsx)(n.Card,{bordered:!1,className:`bg-arco-primary-light-1/30 rounded-none!`,children:(0,a.jsxs)(n.Typography.Text,{type:`secondary`,className:`text-xs! leading-6!`,children:[(0,a.jsxs)(`strong`,{children:[o.pointsNoteTitle,`:`]}),o.pointsAccountNote]})})]})})}var le=L;function ue(e){return{...le,...e}}var de=2048,fe=2*1024*1024;function pe(e){return new Promise((t,n)=>{let r=URL.createObjectURL(e),i=new Image;i.onload=()=>{URL.revokeObjectURL(r),t({width:i.naturalWidth,height:i.naturalHeight})},i.onerror=()=>{URL.revokeObjectURL(r),n(Error(`invalid image`))},i.src=r})}function me({visible:e,user:i,labels:o,onCancel:s,onSubmit:c}){let l=ue(o),[u]=n.Form.useForm(),[d,f]=(0,t.useState)(!1),[p,m]=(0,t.useState)(null),[h,g]=(0,t.useState)(null),_=(0,t.useRef)(null);(0,t.useEffect)(()=>()=>{_.current&&=(URL.revokeObjectURL(_.current),null)},[]),(0,t.useEffect)(()=>{e&&(u.setFieldsValue({nickname:i?.nickname||i?.username||``}),m(null),g(e=>(e&&URL.revokeObjectURL(e),_.current=null,null)))},[e,i,u]);let v=(e,t)=>{console.error(t),n.Message.error(e)},y=e=>{n.Message.success(e)};return(0,a.jsx)(n.Modal,{title:l.profileTitle,visible:e,onOk:async()=>{try{let e=await u.validate();f(!0),await c({nickname:e.nickname,avatarFile:p}),y(l.profileUpdateSuccess),s()}catch(e){e instanceof Error&&v(e.message||l.error,e)}finally{f(!1)}},onCancel:s,confirmLoading:d,okText:l.profileSave,cancelText:l.profileCancel,children:(0,a.jsxs)(n.Form,{form:u,layout:`vertical`,children:[(0,a.jsx)(n.Form.Item,{label:l.profileNickname,field:`nickname`,rules:[{required:!0,message:l.profileNicknamePlaceholder}],children:(0,a.jsx)(n.Input,{placeholder:l.profileNicknamePlaceholder,allowClear:!0})}),(0,a.jsx)(n.Form.Item,{label:l.profileAvatar,children:(0,a.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,a.jsx)(n.Avatar,{size:64,className:`shrink-0 bg-arco-primary-light-1!`,children:h||i?.avatar?(0,a.jsx)(`img`,{src:h||i?.avatar,alt:``,className:`block h-full w-full object-cover`}):i?.nickname?.[0]||i?.username?.[0]||`U`}),(0,a.jsx)(n.Upload,{accept:`image/*`,showUploadList:!1,beforeUpload:async e=>{if(e.size>fe)return v(l.profileAvatarTooLarge),!1;try{let{width:t,height:n}=await pe(e);if(t>de||n>de)return v(l.profileAvatarDimensionExceeded),!1}catch(e){return v(l.profileAvatarInvalidImage,e),!1}return g(t=>{t&&URL.revokeObjectURL(t);let n=URL.createObjectURL(e);return _.current=n,n}),m(e),!1},children:(0,a.jsx)(n.Button,{type:`outline`,size:`small`,icon:(0,a.jsx)(r.IconUpload,{}),children:l.profileUploadAvatar})})]}),(0,a.jsx)(`span`,{className:`text-xs text-arco-text-3`,children:l.profileAvatarHint})]})})]})})}function he(e){return e?.nickname?.[0]||e?.username?.[0]||`U`}function $({user:e,size:t,className:r=``}){return(0,a.jsx)(n.Avatar,{size:t,className:`bg-arco-primary/20! text-arco-primary-6 border-2 font-bold ${r}`,children:e?.avatar?(0,a.jsx)(`img`,{src:e.avatar,alt:`avatar`,className:`h-full w-full object-cover`}):he(e)})}function ge({visible:e,user:i,points:o,text:s,onCancel:c,onPay:l}){let[u,d]=(0,t.useState)(Q[2].id),f=e=>new Intl.NumberFormat().format(e),p=Q.find(e=>e.id===u)||Q[0];return(0,a.jsx)(n.Modal,{title:s.rechargeTitle,visible:e,footer:(0,a.jsxs)(`div`,{className:`mx-auto flex max-w-7xl items-center justify-between gap-5`,children:[(0,a.jsx)(`span`,{className:`text-arco-text-2 text-sm leading-6`,children:s.rechargeHint}),(0,a.jsxs)(n.Button,{type:`primary`,size:`large`,className:`min-w-48! font-bold!`,onClick:()=>l(p),children:[s.payNow,` · $`,p.price]})]}),onCancel:c,alignCenter:!1,wrapClassName:`overflow-hidden!`,style:{width:`100vw`,maxWidth:`100vw`,top:0,paddingBottom:0},className:`top-0! m-0! flex! h-screen! w-screen! max-w-none! flex-col! [&_.arco-modal-body]:min-h-0! [&_.arco-modal-body]:flex-1! [&_.arco-modal-body]:overflow-hidden! [&_.arco-modal-body]:p-0! [&_.arco-modal-close-icon]:top-1.5! [&_.arco-modal-close-icon]:right-4! [&_.arco-modal-close-icon]:inline-flex! [&_.arco-modal-close-icon]:h-9! [&_.arco-modal-close-icon]:w-9! [&_.arco-modal-close-icon]:items-center! [&_.arco-modal-close-icon]:justify-center! [&_.arco-modal-close-icon]:rounded-lg! [&_.arco-modal-close-icon]:text-lg! [&_.arco-modal-close-icon]:leading-9! [&_.arco-modal-close-icon]:transition-colors [&_.arco-modal-close-icon:hover]:bg-arco-fill-2 [&_.arco-modal-close-icon:hover]:text-arco-primary-6 [&_.arco-modal-close-icon_svg]:h-[18px]! [&_.arco-modal-close-icon_svg]:w-[18px]! [&_.arco-modal-content]:flex! [&_.arco-modal-content]:h-auto! [&_.arco-modal-content]:min-h-0! [&_.arco-modal-content]:flex-1! [&_.arco-modal-content]:flex-col! [&_.arco-modal-content]:overflow-hidden! [&_.arco-modal-content]:rounded-none! [&_.arco-modal-footer]:shrink-0! [&_.arco-modal-header]:shrink-0!`,children:(0,a.jsxs)(`div`,{className:`mx-auto flex h-full w-full max-w-7xl flex-col items-center `,children:[(0,a.jsxs)(`div`,{className:`w-full border-arco-border-1 bg-arco-fill-1 text-arco-text-2 flex items-center gap-2.5 rounded-lg border px-3.5 py-3 text-sm`,children:[(0,a.jsx)($,{user:i,size:32,className:`shrink-0`}),(0,a.jsxs)(`span`,{children:[i?.nickname||i?.username,` · `,s.currentBalance,` `,(0,a.jsx)(`strong`,{className:`text-arco-text-1`,children:f(o.total)}),` `,s.pointsUnit]})]}),(0,a.jsx)(`div`,{className:`mt-6 w-full`,children:(0,a.jsx)(n.Grid.Row,{gutter:[16,16],children:Q.map(e=>(0,a.jsx)(n.Grid.Col,{xs:24,sm:12,lg:6,children:(0,a.jsxs)(n.Card,{hoverable:!0,role:`button`,tabIndex:0,onClick:()=>d(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&d(e.id)},bodyStyle:{minHeight:192,display:`flex`,flexDirection:`column`,justifyContent:`space-between`},className:`border-arco-border-2! bg-arco-bg-2! relative cursor-pointer overflow-hidden rounded-lg! shadow-sm! transition-all duration-200 before:absolute before:inset-x-0 before:top-0 before:h-1 before:bg-linear-to-r before:from-arco-primary before:to-transparent hover:shadow-md! ${u===e.id?`border-arco-primary-6! bg-arco-primary-light-1/40! ring-arco-primary-6/20 ring-2! shadow-[0_18px_38px_rgb(var(--primary-6)/22%)]!`:`hover:border-arco-primary-6!`}`,children:[u===e.id?(0,a.jsx)(r.IconCheckCircleFill,{className:`text-arco-primary-6! absolute bottom-4 left-4 text-xl`}):null,`recommended`in e&&e.recommended?(0,a.jsx)(n.Tag,{color:`arcoblue`,className:`absolute top-4 right-4 text-xs! font-bold!`,children:`HOT`}):null,(0,a.jsxs)(`div`,{className:`min-w-0 pr-16`,children:[(0,a.jsxs)(n.Typography.Text,{className:`flex items-center text-3xl! leading-tight! font-bold!`,children:[f(e.points),(0,a.jsx)(`span`,{className:`ml-1 text-2xl`,children:`🪙`})]}),(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`mt-1 block! text-sm!`,children:s.pointsUnit})]}),(0,a.jsx)(`div`,{className:`mt-7 flex w-full justify-end`,children:(0,a.jsxs)(n.Typography.Text,{className:`text-arco-primary-6! text-right text-2xl! leading-tight! font-bold!`,children:[`$`,e.price]})})]})},e.id))})})]})})}function _e({user:e,points:t,text:i,onEditProfile:o,onRecharge:s,onPointsDetail:c,onLogout:l}){let u=e=>new Intl.NumberFormat().format(e);return(0,a.jsxs)(`div`,{className:`w-80 overflow-hidden rounded-xl border border-arco-border-2 bg-arco-bg-popup shadow-[0_10px_28px_rgb(0_0_0/12%)]`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-3 px-6 pt-5 pb-4`,children:[(0,a.jsx)($,{user:e,size:48,className:`shrink-0`}),(0,a.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,a.jsx)(`span`,{className:`text-arco-text-1 truncate text-base leading-6 font-bold`,children:e?.nickname||e?.username}),(0,a.jsx)(n.Button,{type:`text`,size:`mini`,icon:(0,a.jsx)(r.IconEdit,{}),className:`text-arco-text-3 h-6! min-w-6! px-0!`,onClick:o})]}),e?.email?(0,a.jsx)(`span`,{className:`text-arco-text-3 truncate text-xs leading-5`,children:e.email}):null]})]}),(0,a.jsx)(n.Divider,{className:`m-0!`}),(0,a.jsxs)(`ul`,{className:`flex flex-col gap-3.5 px-6 py-4`,children:[(0,a.jsxs)(`li`,{className:`text-arco-text-2 flex items-center justify-between gap-4 text-sm`,children:[(0,a.jsx)(`span`,{children:i.myPoints}),(0,a.jsx)(`strong`,{className:`text-arco-primary-6 text-base font-bold`,children:u(t.total)})]}),(0,a.jsxs)(`li`,{className:`text-arco-text-2 flex items-center justify-between gap-4 text-sm`,children:[(0,a.jsx)(`span`,{children:i.rechargePoints}),(0,a.jsx)(`strong`,{className:`text-arco-text-1 text-base font-bold`,children:u(t.recharge)})]}),(0,a.jsxs)(`li`,{className:`text-arco-text-2 flex items-center justify-between gap-4 text-sm`,children:[(0,a.jsx)(`span`,{children:i.giftedPoints}),(0,a.jsx)(`strong`,{className:`text-arco-text-1 text-base font-bold`,children:u(t.gifted)})]})]}),(0,a.jsx)(n.Divider,{className:`m-0!`}),(0,a.jsxs)(`div`,{className:`flex flex-col gap-2 px-6 py-4`,children:[(0,a.jsx)(n.Button,{type:`primary`,long:!0,icon:(0,a.jsx)(r.IconPlus,{}),className:`h-10! rounded-md! font-semibold!`,onClick:s,children:i.recharge}),(0,a.jsx)(n.Button,{long:!0,icon:(0,a.jsx)(r.IconFile,{}),className:`border-arco-border-2! bg-arco-fill-1! text-arco-text-1! h-10! rounded-md! font-semibold!`,onClick:c,children:i.pointsDetail})]}),(0,a.jsx)(n.Divider,{className:`m-0!`}),(0,a.jsx)(`div`,{className:`px-6 py-4`,children:(0,a.jsx)(n.Button,{icon:(0,a.jsx)(r.IconPoweroff,{}),type:`text`,status:`danger`,long:!0,className:`flex! items-center justify-start gap-2 text-sm text-arco-text-2`,onClick:()=>void l?.(),children:i.logout})})]})}var ve=`https://mantur.ai/images/logo.png`,ye=[`from-arco-primary-light-1 to-arco-primary-light-2 text-arco-primary-6`,`from-arco-success-light-1 to-arco-success-light-2 text-arco-success-6`,`from-arco-warning-light-1 to-arco-warning-light-2 text-arco-warning-6`,`from-arco-danger-light-1 to-arco-danger-light-2 text-arco-danger-6`];function be(e,t=!1){return`flex h-8 min-h-8 w-8 min-w-8 flex-none items-center justify-center rounded-lg bg-linear-to-br font-bold leading-none ${ye[e%ye.length]} ${t?`shadow-[inset_0_1px_3px_rgb(0_0_0/8%)]`:``}`}function xe(e){return e?.tenantName?.[0]?.toUpperCase()||`T`}function Se(e,t,n){let r=e?.roles?.map(e=>e.roleName).filter(Boolean);return r?.length?r.join(`, `):e?.isOwner?t:n}function Ce({user:e,disabled:i=!1,brandSlot:o,children:s,onTenantContextChange:c}){let[l,u]=(0,t.useState)(()=>K()),d=q(l),[f,p]=(0,t.useState)(!1),[m,h]=(0,t.useState)(!1),[g,_]=(0,t.useState)(!1),[y,b]=(0,t.useState)(e),[x,S]=(0,t.useState)([]),[C,w]=(0,t.useState)(),[T,O]=(0,t.useState)(!1),k=(0,t.useRef)(c),[j,M]=(0,t.useState)({total:0,recharge:0,gifted:0}),N=C?.tenantId||``,P=i,F={total:j.total??0,recharge:j.recharge??0,gifted:j.gifted??0},I=async e=>{let t=await D(e);return t&&b(t),t};(0,t.useEffect)(()=>{b(e)},[e]),(0,t.useEffect)(()=>{k.current=c},[c]);let L=(0,t.useCallback)(e=>{S(e.tenants),w(e.currentTenant),k.current?.(e)},[]);(0,t.useEffect)(()=>{O(!0),ee().then(L).catch(e=>{console.warn(`Failed to refresh Mantur tenant context.`,e),n.Message.error(d.error)}).finally(()=>O(!1))},[L,d.error]),(0,t.useEffect)(()=>{let e=e=>{e instanceof CustomEvent&&M(e.detail)};return window.addEventListener(v,e),A().catch(e=>{console.warn(`Failed to refresh Mantur user points.`,e)}),()=>{window.removeEventListener(v,e)}},[]),(0,t.useEffect)(()=>{let e=e=>{u(e instanceof CustomEvent?G(e.detail):K())};return window.addEventListener(U,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(U,e),window.removeEventListener(`storage`,e)}},[]);let R=e=>{n.Message.success(e)},z=(e,t)=>{console.error(t),n.Message.error(e)},B=(0,t.useCallback)(async e=>{if(!P&&e!==N)try{O(!0),L(await te(e)),R(d.switchedToTeam)}catch(e){z(d.error,e)}finally{O(!1)}},[L,N,P,d.error,d.switchedToTeam]),V=e=>{let t={total:F.total+e.points,recharge:F.recharge+e.points,gifted:F.gifted};M(t),window.dispatchEvent(new CustomEvent(v,{detail:t})),n.Message.success(d.rechargeSuccess),h(!1)},H=(0,t.useMemo)(()=>(0,a.jsxs)(n.Menu,{className:`w-56 rounded-xl bg-arco-bg-popup shadow-[0_10px_28px_rgb(0_0_0/12%)] [&_.arco-menu-inner]:px-2 [&_.arco-menu-inner]:py-1`,selectedKeys:N?[N]:[],onClickMenuItem:B,children:[(0,a.jsx)(`div`,{className:`px-3 py-2 text-xs font-semibold tracking-[0.04em] text-arco-text-4 uppercase`,children:d.switchTeam}),x.map((e,t)=>(0,a.jsx)(n.Menu.Item,{className:`mb-1 h-auto! min-h-10! overflow-visible! rounded-lg! px-2! py-1! leading-normal!`,children:(0,a.jsxs)(`div`,{className:`flex w-full items-center gap-3 leading-normal`,children:[(0,a.jsx)(`div`,{className:be(t),children:xe(e)}),(0,a.jsxs)(`div`,{className:`flex min-w-0 flex-col justify-center gap-0.75`,children:[(0,a.jsx)(`span`,{className:`text-sm leading-5 font-medium text-arco-text-1`,children:e.tenantName}),(0,a.jsx)(`span`,{className:`text-xs leading-4 text-arco-text-3`,children:Se(e,d.owner,d.member)})]})]})},e.tenantId))]}),[B,N,x,d]),W=(0,a.jsx)(_e,{user:y,points:F,text:d,onEditProfile:()=>p(!0),onRecharge:()=>h(!0),onPointsDetail:()=>_(!0),onLogout:E}),J=Math.max(0,x.findIndex(e=>e.tenantId===C?.tenantId));return(0,a.jsxs)(`div`,{className:`flex h-20 items-center justify-between bg-transparent pr-8 shadow-[0_2px_10px_rgb(0_0_0/2%)] backdrop-blur-md max-md:pr-4`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,a.jsxs)(`div`,{className:`flex w-65 items-center gap-3 px-8 max-md:w-auto max-md:px-4`,children:[(0,a.jsx)(`div`,{className:`relative flex w-12 items-center justify-center overflow-hidden `,children:(0,a.jsx)(`img`,{src:ve,alt:`logo`,className:`w-full object-contain`,onError:e=>{e.currentTarget.style.display=`none`}})}),o??(0,a.jsx)(`span`,{className:`text-lg font-bold tracking-normal text-arco-text-1`,children:d.title})]}),(0,a.jsx)(n.Dropdown,{droplist:H,trigger:`click`,position:`bl`,disabled:P,children:(0,a.jsxs)(`div`,{"aria-disabled":P,className:`flex items-center gap-3 rounded-full border border-arco-border-1 bg-arco-bg-1 px-2 py-1.5 transition-all ${P?`cursor-not-allowed opacity-60`:`cursor-pointer hover:bg-arco-fill-2 hover:shadow-[0_4px_12px_rgb(0_0_0/8%)]`}`,children:[(0,a.jsx)(`div`,{className:be(J,!0),children:xe(C)}),(0,a.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,a.jsx)(`span`,{className:`text-xs leading-none font-bold text-arco-text-1`,children:T?d.loading:C?.tenantName||d.loading}),(0,a.jsx)(`span`,{className:`mt-1 text-[10px] leading-none text-arco-text-3`,children:Se(C,d.owner,d.member)})]}),(0,a.jsx)(r.IconDown,{className:`ml-1 text-arco-text-3`})]})})]}),(0,a.jsx)(`div`,{className:`flex-1`,children:s}),(0,a.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,a.jsx)(Z,{}),(0,a.jsx)(X,{})]}),(0,a.jsx)(n.Dropdown,{droplist:W,trigger:`click`,position:`br`,onVisibleChange:e=>{e&&A().catch(e=>{console.warn(`Failed to refresh Mantur user points.`,e)})},children:(0,a.jsxs)(`div`,{className:`hover:bg-arco-fill-2 flex cursor-pointer items-center gap-2.5 rounded-full border border-transparent p-1 pr-2 transition-all`,children:[(0,a.jsxs)(`div`,{className:`from-arco-primary to-transparent relative rounded-full bg-linear-to-br p-0.5 shadow-sm`,children:[(0,a.jsx)($,{user:y,size:36}),(0,a.jsx)(`div`,{className:`bg-arco-success border-arco-bg-white absolute right-0 bottom-0 h-3 w-3 rounded-full border-2 shadow-sm`})]}),(0,a.jsx)(`div`,{className:`hidden flex-col md:flex`,children:(0,a.jsx)(`span`,{className:`text-arco-text-1 text-sm font-medium`,children:y?.nickname||y?.username})}),(0,a.jsx)(r.IconDown,{className:`text-arco-text-3 ml-1`})]})})]}),(0,a.jsx)(me,{visible:f,user:y,labels:d,onCancel:()=>p(!1),onSubmit:I}),(0,a.jsx)(ge,{visible:m,user:y,points:F,text:d,onCancel:()=>h(!1),onPay:V}),(0,a.jsx)(ce,{visible:g,points:F,text:d,onCancel:()=>_(!1),onRecharge:()=>h(!0)})]})}var we=h(p(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){"use strict";var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,E,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))}))(),1);function Te(e,t=`datetime`,n){if(!e)return`-`;let r=(n?G(n):K()).startsWith(`en`),i=t===`date`?r?`MM/DD/YYYY`:`YYYY-MM-DD`:r?`MM/DD/YYYY HH:mm:ss`:`YYYY-MM-DD HH:mm:ss`;return(0,we.default)(e).format(i)}e.LANGUAGE_SOURCE_STORAGE_KEY=Y,e.LANGUAGE_STORAGE_KEY=J,e.LangSwitch=X,e.MANTUR_LANGUAGE_CHANGE_EVENT=U,e.MANTUR_LANGUAGE_SOURCE_STORAGE_KEY=H,e.MANTUR_LANGUAGE_STORAGE_KEY=V,e.MANTUR_MESSAGES=W,e.MANTUR_POINTS_REFRESH_EVENT=v,e.MANTUR_TENANT_CONTEXT_CHANGE_EVENT=y,e.ManturHeader=Ce,e.ThemeSwitch=Z,e.formatDateByLang=Te,e.getManturCurrentTenant=F,e.getManturMessages=q,e.getManturTenantContextSnapshot=N,e.getManturTenants=P,e.getManturUserPoints=k,e.getStoredManturLocale=K,e.normalizeManturLocale=G,e.refreshManturTenantContext=ee,e.refreshManturUserPoints=A,e.switchAndRefreshManturTenant=te,e.switchManturTenant=I});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`react`),require(`@arco-design/web-react`),require(`@arco-design/web-react/icon`),require(`react-i18next`),require(`react/jsx-runtime`),require(`next-themes`)):typeof define==`function`&&define.amd?define([`exports`,`react`,`@arco-design/web-react`,`@arco-design/web-react/icon`,`react-i18next`,`react/jsx-runtime`,`next-themes`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ManturComponents={},e.React,e.ArcoDesign,e.ArcoDesignIcon,e.ReactI18next,e.jsxRuntime,e.nextThemes))})(this,function(e,t,n,r,i,a,o){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var s=Object.create,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,d=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty,p=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),m=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=u(t),a=0,o=i.length,s;a<o;a++)s=i[a],!f.call(e,s)&&s!==n&&c(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=l(t,s))||r.enumerable});return e},h=(e,t,n)=>(n=e==null?{}:s(d(e)),m(t||!e||!e.__esModule?c(n,`default`,{value:e,enumerable:!0}):n,e)),g=`/api`,_=`/users/me/points`,v=`mantur-points-refresh`,y=`mantur-tenant-context-change`;function b(){return typeof window<`u`&&window.__MANTUR_COMPONENTS_API_BASE__?window.__MANTUR_COMPONENTS_API_BASE__:g}function x(){return typeof window<`u`&&window.__MANTUR_COMPONENTS_POINTS_ENDPOINT__?window.__MANTUR_COMPONENTS_POINTS_ENDPOINT__:_}function S(e){if(typeof document>`u`)return;let t=`${encodeURIComponent(e)}=`;return document.cookie.split(`; `).find(e=>e.startsWith(t))?.slice(t.length)}function C(e){if(typeof document>`u`)return;let t=encodeURIComponent(e),n=window.location.hostname,r=[void 0,n],i=n.split(`.`);i.length>=2&&r.push(`.${i.slice(-2).join(`.`)}`),r.forEach(e=>{document.cookie=`${t}=; path=/; max-age=0${e?`; domain=${e}`:``}`})}function w(e){let t=JSON.parse(e||`null`);if(!t)throw Error(`Request failed`);if(t.code!==0)throw Error(t.message||`Request failed`);return t}async function T(e,t={}){let n=S(`front-token`),r=S(`Accept-Language`),i=t.headers||{};return n&&(i.Authorization=decodeURIComponent(n)),r&&(i[`Accept-Language`]=decodeURIComponent(r)),new Promise((n,r)=>{let a=new XMLHttpRequest;a.open(t.method||`GET`,`${b()}${e}`,!0),a.timeout=t.timeout||1e4,Object.entries(i).forEach(([e,t])=>{a.setRequestHeader(e,t)}),a.onload=()=>{try{let e=w(a.responseText);if(a.status<200||a.status>=300){r(Error(e.message||a.statusText));return}n(e)}catch(e){r(e)}},a.onerror=()=>r(Error(`Network request failed`)),a.ontimeout=()=>r(Error(`Network request timed out`)),a.send(t.body??null)})}async function E(){try{await T(`/auth/front-logout`,{method:`DELETE`})}catch(e){console.warn(`Logout request failed, continuing local logout.`,e)}finally{C(`front-token`),C(`refreshToken`),typeof window<`u`&&window.location.reload()}}async function D(e){let t;if(e.avatarFile){let n=new FormData;n.append(`file`,e.avatarFile),t=(await T(`/users/me/avatar`,{method:`POST`,body:n})).data}return(await T(`/users/me`,{method:`PUT`,headers:{"Content-Type":`application/json;charset=utf-8`},body:JSON.stringify({nickname:e.nickname})})).data||t}function O(e){let t=(...t)=>{let n=t.map(t=>e?.[t]).find(e=>e!==void 0);return typeof n==`number`?n:Number(n||0)};return{total:t(`total`,`totalPoints`,`balance`,`points`),recharge:t(`recharge`,`rechargePoints`,`paidPoints`),gifted:t(`gifted`,`giftedPoints`,`bonusPoints`)}}async function k(){return O((await T(x())).data)}async function A(){let e=await k();return typeof window<`u`&&window.dispatchEvent(new CustomEvent(v,{detail:e})),e}function j(e,t){return t?.tenantId?e.find(e=>e.tenantId===t.tenantId)||{tenantId:t.tenantId,tenantName:t.tenantName||t.tenantId,roles:t.roles?.map(e=>({roleCode:e,roleName:e}))}:e.find(e=>e.isOwner)||e[0]}function M(e){typeof window<`u`&&(window.__MANTUR_COMPONENTS_TENANT_CONTEXT__=e,window.dispatchEvent(new CustomEvent(y,{detail:e})))}async function N(){return(await T(`/users/me/tenants`)).data||[]}async function P(){return(await T(`/auth/current-tenant`)).data}async function F(e){return(await T(`/auth/current-tenant/${e}`,{method:`PUT`})).data}async function ee(e=`refresh`){let[t,n]=await Promise.all([N(),P()]),r={tenants:t,currentTenant:j(t,n),auth:n,reason:e};return M(r),r}async function te(e){let t=await F(e),n=await N(),r={tenants:n,currentTenant:j(n,t),auth:t,reason:`switch`};return M(r),r}var I={title:`Mantur`,switchTeam:`Switch Team`,personalSettings:`Personal Settings`,logout:`Logout`,loading:`Loading...`,owner:`Owner`,member:`Member`,createTeam:`Create Team`,createTeamComingSoon:`Create team is coming soon`,switchedToTeam:`Switched team`,error:`Request failed`,profileTitle:`Profile`,profileNickname:`Nickname`,profileNicknamePlaceholder:`Please enter nickname`,profileAvatar:`Avatar`,profileUploadAvatar:`Upload Avatar`,profileAvatarHint:`JPG/PNG/WebP, max 2MB, max 2048px.`,profileAvatarTooLarge:`Avatar must be less than 2MB`,profileAvatarDimensionExceeded:`Avatar dimensions must be within 2048px`,profileAvatarInvalidImage:`Invalid image`,profileUpdateSuccess:`Profile updated`,profileSave:`Save`,profileCancel:`Cancel`,myPoints:`My Points`,totalBalance:`Total Balance`,rechargePoints:`Recharge Points`,giftedPoints:`Gifted Points`,recharge:`Recharge`,rechargeTitle:`Recharge Points`,pointsDetail:`Points Detail`,close:`Close`,currentBalance:`Current Balance`,pointsUnit:`points`,rechargeHint:`Recharge points are valid for 2 years after arrival.`,payNow:`Pay Now`,rechargeSuccess:`Recharge successful`,all:`All`,income:`Income`,expense:`Expense`,source:`Source`,sourceAll:`All Sources`,sourceRecharge:`Recharge`,sourceGifted:`Gifted`,dateRange:`Date Range`,startDate:`Start Date`,endDate:`End Date`,dateTo:`to`,query:`Query`,refreshed:`Refreshed`,pointsDeductionTip:`Points expiring soon are deducted first.`,pointsNoteTitle:`Note`,pointsAccountNote:`Points are attached to your personal account. You recharge, consume, and manage them yourself. Others cannot recharge or use them for you. Recharge points are valid for 2 years; gifted points follow the validity set by operations.`},L={languageZh:`中文`,languageEn:`English`},R={title:`漫途`,switchTeam:`切换团队`,personalSettings:`个人设置`,logout:`退出登录`,loading:`加载中...`,owner:`管理员`,member:`成员`,createTeam:`创建团队`,createTeamComingSoon:`创建团队功能即将上线`,switchedToTeam:`已切换团队`,error:`请求失败`,profileTitle:`个人资料`,profileNickname:`昵称`,profileNicknamePlaceholder:`请输入昵称`,profileAvatar:`头像`,profileUploadAvatar:`上传头像`,profileAvatarHint:`支持 JPG/PNG/WebP,最大 2MB,尺寸不超过 2048px。`,profileAvatarTooLarge:`头像不能超过 2MB`,profileAvatarDimensionExceeded:`头像尺寸不能超过 2048px`,profileAvatarInvalidImage:`图片无效`,profileUpdateSuccess:`个人资料已更新`,profileSave:`保存`,profileCancel:`取消`,myPoints:`我的积分`,totalBalance:`总余额`,rechargePoints:`充值积分`,giftedPoints:`赠送积分`,recharge:`去充值`,rechargeTitle:`充值积分`,pointsDetail:`积分明细`,close:`关闭`,currentBalance:`当前余额`,pointsUnit:`积分`,rechargeHint:`充值积分有效期 2 年(自到账日起算),支付后不可退换。`,payNow:`立即支付`,rechargeSuccess:`充值成功`,all:`全部`,income:`获得`,expense:`消耗`,source:`来源`,sourceAll:`全部来源`,sourceRecharge:`充值`,sourceGifted:`赠送`,dateRange:`日期查询`,startDate:`开始日期`,endDate:`结束日期`,dateTo:`至`,query:`查询`,refreshed:`已刷新`,pointsDeductionTip:`优先扣减即将到期的积分`,pointsNoteTitle:`说明`,pointsAccountNote:`积分账户挂在你的个人账号上,自己充值、自己消耗、自己负责;他人不能代充、不能代用。充值积分有效期固定 2 年;赠送积分有效期由后台运营发放时设置。`},z={languageZh:`中文`,languageEn:`English`},B=`i18nextLng`,V=`manturLanguageSource`,H=`mantur-language-change`,U={"zh-CN":{...R,...z},"en-US":{...I,...L}};function W(e){return e?.toLowerCase().startsWith(`en`)?`en-US`:`zh-CN`}function G(){return typeof window>`u`?`zh-CN`:W(window.localStorage.getItem(`i18nextLng`)||document.documentElement.lang||navigator.language)}function K(e){return U[W(e)]}var q=B,J=V;function ne(e,t){document.cookie=`${encodeURIComponent(e)}=${encodeURIComponent(t)}; path=/`}function re(){let{i18n:e}=(0,i.useTranslation)(),[o,s]=(0,t.useState)(()=>G()),c=K(o);return(0,t.useEffect)(()=>{s(W(e.language))},[e.language]),(0,a.jsx)(n.Dropdown,{droplist:(0,a.jsxs)(n.Menu,{selectedKeys:[o],onClickMenuItem:t=>{let n=W(t);localStorage.setItem(q,t),localStorage.setItem(J,`manual`),s(n),e.changeLanguage(t),ne(`Accept-Language`,t),window.dispatchEvent(new CustomEvent(H,{detail:n})),window.location.reload()},children:[(0,a.jsx)(n.Menu.Item,{children:c.languageZh},`zh-CN`),(0,a.jsx)(n.Menu.Item,{children:c.languageEn},`en-US`)]}),trigger:`click`,position:`br`,children:(0,a.jsx)(n.Button,{shape:`circle`,icon:(0,a.jsx)(r.IconLanguage,{})})})}function ie(){let{resolvedTheme:e,setTheme:t}=(0,o.useTheme)();return(0,a.jsx)(n.Button,{shape:`circle`,icon:e===`light`?(0,a.jsx)(r.IconMoonFill,{}):(0,a.jsx)(r.IconSunFill,{}),onClick:()=>{t(e===`light`?`dark`:`light`)}})}var Y=[{id:`points-500`,points:500,price:5},{id:`points-1000`,points:1e3,price:10},{id:`points-5500`,points:5500,price:50,recommended:!0},{id:`points-24000`,points:24e3,price:200}],ae=[{id:`recharge-1`,type:`income`,source:`recharge`,name:`积分充值`,meta:`2026-05-10 14:00:00 · 订单号 R20260510140000 · 套餐 $50`,date:`2026-05-10`,amount:5500,badgeKind:`recharge`,badgeText:`充值`},{id:`gift-1`,type:`income`,source:`gift`,name:`系统赠送 · 新人礼包`,meta:`2026-05-08 09:00:00 · 有效期 30 天`,date:`2026-05-08`,amount:1e3,badgeKind:`gift`,badgeText:`赠送`},{id:`expense-1`,type:`expense`,name:`视频生成 — Sora 40秒 4K`,meta:`2026-05-10 16:45:22 · 制作中心`,date:`2026-05-10`,amount:-400,badgeKind:`deducted`,badgeText:`已扣除`},{id:`expense-2`,type:`expense`,name:`视频生成 — Sora 25秒 1080p`,meta:`2026-05-11 09:15:42 · 制作中心`,date:`2026-05-11`,amount:-250,badgeKind:`deducted`,badgeText:`已扣除`},{id:`expire-1`,type:`expense`,name:`积分过期`,meta:`2026-05-01 00:00:00 · 2026-04 批次到期未使用`,date:`2026-05-01`,amount:-100,badgeKind:`expired`,badgeText:`自然过期`},{id:`expense-3`,type:`expense`,name:`AI 对话 — GPT-4o 5轮`,meta:`2026-05-07 10:08:55 · 剧本中心`,date:`2026-05-07`,amount:-10,badgeKind:`deducted`,badgeText:`已扣除`},{id:`expense-4`,type:`expense`,name:`图片生成 — DALL-E 5张`,meta:`2026-05-04 14:20:11 · 制作中心`,date:`2026-05-04`,amount:-75,badgeKind:`deducted`,badgeText:`已扣除`}],{RangePicker:oe}=n.DatePicker,se=21,ce=7;function le(e){return e===`recharge`?`arcoblue`:e===`gift`?`cyan`:e===`expired`?`gray`:`orange`}function ue({visible:e,points:i,text:o,onCancel:s,onRecharge:c}){let[l,u]=(0,t.useState)(`all`),[d,f]=(0,t.useState)(`all`),[p,m]=(0,t.useState)([`2026-04-15`,`2026-05-15`]),[h,g]=(0,t.useState)(1),_=e=>new Intl.NumberFormat().format(e),v=(0,t.useMemo)(()=>{let[e,t]=p;return ae.filter(n=>{let r=l===`all`||n.type===l,i=d===`all`||n.source===d,a=!e||n.date>=e,o=!t||n.date<=t;return r&&i&&a&&o})},[p,d,l]),y=[{title:o.pointsDetail,dataIndex:`name`,render:(e,t)=>(0,a.jsxs)(`div`,{className:`min-w-0`,children:[(0,a.jsx)(n.Typography.Text,{className:`font-medium!`,children:t.name}),(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`mt-1 block! text-xs!`,children:t.meta})]})},{title:o.pointsUnit,dataIndex:`amount`,width:120,align:`right`,render:(e,t)=>(0,a.jsxs)(n.Typography.Text,{className:`font-semibold! ${t.amount>0?`text-arco-success-6!`:`text-arco-danger-6!`}`,children:[t.amount>0?`+`:``,_(t.amount)]})},{title:o.source,dataIndex:`badgeText`,width:110,align:`right`,render:(e,t)=>(0,a.jsx)(n.Tag,{color:le(t.badgeKind),children:t.badgeText})}];return(0,a.jsx)(n.Modal,{title:o.pointsDetail,visible:e,footer:(0,a.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,a.jsx)(n.Button,{onClick:s,children:o.close}),(0,a.jsx)(n.Button,{type:`primary`,icon:(0,a.jsx)(r.IconPlus,{}),onClick:()=>{s(),c()},children:o.recharge})]}),onCancel:s,style:{width:780,maxWidth:`calc(100vw - 48px)`},children:(0,a.jsxs)(`div`,{className:`max-h-[70vh] overflow-y-auto`,children:[(0,a.jsxs)(n.Card,{bordered:!1,className:`from-arco-primary-light-1/40 to-cyan-400/5 rounded-none! bg-linear-to-br!`,children:[(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`text-xs!`,children:o.totalBalance}),(0,a.jsxs)(`div`,{className:`mt-1.5 mb-3.5 `,children:[(0,a.jsx)(n.Typography.Text,{className:`text-3xl! font-bold!`,children:_(i.total)}),(0,a.jsxs)(n.Typography.Text,{type:`secondary`,className:`ml-2 text-sm! `,children:[`🪙 `,o.pointsUnit]})]}),(0,a.jsxs)(n.Grid.Row,{gutter:12,children:[(0,a.jsx)(n.Grid.Col,{span:12,children:(0,a.jsxs)(n.Card,{size:`small`,children:[(0,a.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`text-xs!`,children:o.rechargePoints}),(0,a.jsx)(n.Tag,{color:`arcoblue`,children:o.sourceRecharge})]}),(0,a.jsx)(n.Typography.Text,{className:`text-lg! font-semibold!`,children:_(i.recharge)})]})}),(0,a.jsx)(n.Grid.Col,{span:12,children:(0,a.jsxs)(n.Card,{size:`small`,children:[(0,a.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`text-xs!`,children:o.giftedPoints}),(0,a.jsx)(n.Tag,{color:`success`,children:o.sourceGifted})]}),(0,a.jsx)(n.Typography.Text,{className:`text-lg! font-semibold!`,children:_(i.gifted)})]})})]}),(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`mt-2.5 block! text-xs!`,children:o.pointsDeductionTip})]}),(0,a.jsxs)(`div`,{className:`px-6 py-4`,children:[(0,a.jsxs)(n.Tabs,{activeTab:l,onChange:e=>u(e),children:[(0,a.jsx)(n.Tabs.TabPane,{title:o.all},`all`),(0,a.jsx)(n.Tabs.TabPane,{title:o.income},`income`),(0,a.jsx)(n.Tabs.TabPane,{title:o.expense},`expense`)]}),(0,a.jsxs)(`div`,{className:`mt-2 mb-3.5 flex flex-wrap items-center gap-2.5`,children:[(0,a.jsxs)(n.Select,{value:d,style:{width:140},onChange:e=>f(e),children:[(0,a.jsx)(n.Select.Option,{value:`all`,children:o.sourceAll}),(0,a.jsx)(n.Select.Option,{value:`recharge`,children:o.sourceRecharge}),(0,a.jsx)(n.Select.Option,{value:`gift`,children:o.sourceGifted})]}),(0,a.jsx)(oe,{value:p,onChange:e=>m(e),style:{width:260}}),(0,a.jsx)(n.Button,{onClick:()=>n.Message.success(o.refreshed),children:o.query})]}),(0,a.jsx)(n.Table,{rowKey:`id`,columns:y,data:v,pagination:!1,border:!1}),(0,a.jsx)(n.Pagination,{className:`mt-3 flex justify-center!`,current:h,pageSize:ce,total:se,onChange:g})]}),(0,a.jsx)(n.Card,{bordered:!1,className:`bg-arco-primary-light-1/30 rounded-none!`,children:(0,a.jsxs)(n.Typography.Text,{type:`secondary`,className:`text-xs! leading-6!`,children:[(0,a.jsxs)(`strong`,{children:[o.pointsNoteTitle,`:`]}),o.pointsAccountNote]})})]})})}var de=I;function fe(e){return{...de,...e}}var X=2048,pe=2*1024*1024;function me(e){return new Promise((t,n)=>{let r=URL.createObjectURL(e),i=new Image;i.onload=()=>{URL.revokeObjectURL(r),t({width:i.naturalWidth,height:i.naturalHeight})},i.onerror=()=>{URL.revokeObjectURL(r),n(Error(`invalid image`))},i.src=r})}function he({visible:e,user:i,labels:o,onCancel:s,onSubmit:c}){let l=fe(o),[u]=n.Form.useForm(),[d,f]=(0,t.useState)(!1),[p,m]=(0,t.useState)(null),[h,g]=(0,t.useState)(null),_=(0,t.useRef)(null);(0,t.useEffect)(()=>()=>{_.current&&=(URL.revokeObjectURL(_.current),null)},[]),(0,t.useEffect)(()=>{e&&(u.setFieldsValue({nickname:i?.nickname||i?.username||``}),m(null),g(e=>(e&&URL.revokeObjectURL(e),_.current=null,null)))},[e,i,u]);let v=(e,t)=>{console.error(t),n.Message.error(e)},y=e=>{n.Message.success(e)};return(0,a.jsx)(n.Modal,{title:l.profileTitle,visible:e,onOk:async()=>{try{let e=await u.validate();f(!0),await c({nickname:e.nickname,avatarFile:p}),y(l.profileUpdateSuccess),s()}catch(e){e instanceof Error&&v(e.message||l.error,e)}finally{f(!1)}},onCancel:s,confirmLoading:d,okText:l.profileSave,cancelText:l.profileCancel,children:(0,a.jsxs)(n.Form,{form:u,layout:`vertical`,children:[(0,a.jsx)(n.Form.Item,{label:l.profileNickname,field:`nickname`,rules:[{required:!0,message:l.profileNicknamePlaceholder}],children:(0,a.jsx)(n.Input,{placeholder:l.profileNicknamePlaceholder,allowClear:!0})}),(0,a.jsx)(n.Form.Item,{label:l.profileAvatar,children:(0,a.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,a.jsx)(n.Avatar,{size:64,className:`shrink-0 bg-arco-primary-light-1!`,children:h||i?.avatar?(0,a.jsx)(`img`,{src:h||i?.avatar,alt:``,className:`block h-full w-full object-cover`}):i?.nickname?.[0]||i?.username?.[0]||`U`}),(0,a.jsx)(n.Upload,{accept:`image/*`,showUploadList:!1,beforeUpload:async e=>{if(e.size>pe)return v(l.profileAvatarTooLarge),!1;try{let{width:t,height:n}=await me(e);if(t>X||n>X)return v(l.profileAvatarDimensionExceeded),!1}catch(e){return v(l.profileAvatarInvalidImage,e),!1}return g(t=>{t&&URL.revokeObjectURL(t);let n=URL.createObjectURL(e);return _.current=n,n}),m(e),!1},children:(0,a.jsx)(n.Button,{type:`outline`,size:`small`,icon:(0,a.jsx)(r.IconUpload,{}),children:l.profileUploadAvatar})})]}),(0,a.jsx)(`span`,{className:`text-xs text-arco-text-3`,children:l.profileAvatarHint})]})})]})})}function ge(e){return e?.nickname?.[0]||e?.username?.[0]||`U`}function Z({user:e,size:t,className:r=``}){return(0,a.jsx)(n.Avatar,{size:t,className:`bg-arco-primary/20! text-arco-primary-6 border-2 font-bold ${r}`,children:e?.avatar?(0,a.jsx)(`img`,{src:e.avatar,alt:`avatar`,className:`h-full w-full object-cover`}):ge(e)})}function _e({visible:e,user:i,points:o,text:s,onCancel:c,onPay:l}){let[u,d]=(0,t.useState)(Y[2].id),f=e=>new Intl.NumberFormat().format(e),p=Y.find(e=>e.id===u)||Y[0];return(0,a.jsx)(n.Modal,{title:s.rechargeTitle,visible:e,footer:(0,a.jsxs)(`div`,{className:`mx-auto flex max-w-7xl items-center justify-between gap-5`,children:[(0,a.jsx)(`span`,{className:`text-arco-text-2 text-sm leading-6`,children:s.rechargeHint}),(0,a.jsxs)(n.Button,{type:`primary`,size:`large`,className:`min-w-48! font-bold!`,onClick:()=>l(p),children:[s.payNow,` · $`,p.price]})]}),onCancel:c,alignCenter:!1,wrapClassName:`overflow-hidden!`,style:{width:`100vw`,maxWidth:`100vw`,top:0,paddingBottom:0},className:`top-0! m-0! flex! h-screen! w-screen! max-w-none! flex-col! [&_.arco-modal-body]:min-h-0! [&_.arco-modal-body]:flex-1! [&_.arco-modal-body]:overflow-hidden! [&_.arco-modal-body]:p-0! [&_.arco-modal-close-icon]:top-1.5! [&_.arco-modal-close-icon]:right-4! [&_.arco-modal-close-icon]:inline-flex! [&_.arco-modal-close-icon]:h-9! [&_.arco-modal-close-icon]:w-9! [&_.arco-modal-close-icon]:items-center! [&_.arco-modal-close-icon]:justify-center! [&_.arco-modal-close-icon]:rounded-lg! [&_.arco-modal-close-icon]:text-lg! [&_.arco-modal-close-icon]:leading-9! [&_.arco-modal-close-icon]:transition-colors [&_.arco-modal-close-icon:hover]:bg-arco-fill-2 [&_.arco-modal-close-icon:hover]:text-arco-primary-6 [&_.arco-modal-close-icon_svg]:h-[18px]! [&_.arco-modal-close-icon_svg]:w-[18px]! [&_.arco-modal-content]:flex! [&_.arco-modal-content]:h-auto! [&_.arco-modal-content]:min-h-0! [&_.arco-modal-content]:flex-1! [&_.arco-modal-content]:flex-col! [&_.arco-modal-content]:overflow-hidden! [&_.arco-modal-content]:rounded-none! [&_.arco-modal-footer]:shrink-0! [&_.arco-modal-header]:shrink-0!`,children:(0,a.jsxs)(`div`,{className:`mx-auto flex h-full w-full max-w-7xl flex-col items-center `,children:[(0,a.jsxs)(`div`,{className:`w-full border-arco-border-1 bg-arco-fill-1 text-arco-text-2 flex items-center gap-2.5 rounded-lg border px-3.5 py-3 text-sm`,children:[(0,a.jsx)(Z,{user:i,size:32,className:`shrink-0`}),(0,a.jsxs)(`span`,{children:[i?.nickname||i?.username,` · `,s.currentBalance,` `,(0,a.jsx)(`strong`,{className:`text-arco-text-1`,children:f(o.total)}),` `,s.pointsUnit]})]}),(0,a.jsx)(`div`,{className:`mt-6 w-full`,children:(0,a.jsx)(n.Grid.Row,{gutter:[16,16],children:Y.map(e=>(0,a.jsx)(n.Grid.Col,{xs:24,sm:12,lg:6,children:(0,a.jsxs)(n.Card,{hoverable:!0,role:`button`,tabIndex:0,onClick:()=>d(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&d(e.id)},bodyStyle:{minHeight:192,display:`flex`,flexDirection:`column`,justifyContent:`space-between`},className:`border-arco-border-2! bg-arco-bg-2! relative cursor-pointer overflow-hidden rounded-lg! shadow-sm! transition-all duration-200 before:absolute before:inset-x-0 before:top-0 before:h-1 before:bg-linear-to-r before:from-arco-primary before:to-transparent hover:shadow-md! ${u===e.id?`border-arco-primary-6! bg-arco-primary-light-1/40! ring-arco-primary-6/20 ring-2! shadow-[0_18px_38px_rgb(var(--primary-6)/22%)]!`:`hover:border-arco-primary-6!`}`,children:[u===e.id?(0,a.jsx)(r.IconCheckCircleFill,{className:`text-arco-primary-6! absolute bottom-4 left-4 text-xl`}):null,`recommended`in e&&e.recommended?(0,a.jsx)(n.Tag,{color:`arcoblue`,className:`absolute top-4 right-4 text-xs! font-bold!`,children:`HOT`}):null,(0,a.jsxs)(`div`,{className:`min-w-0 pr-16`,children:[(0,a.jsxs)(n.Typography.Text,{className:`flex items-center text-3xl! leading-tight! font-bold!`,children:[f(e.points),(0,a.jsx)(`span`,{className:`ml-1 text-2xl`,children:`🪙`})]}),(0,a.jsx)(n.Typography.Text,{type:`secondary`,className:`mt-1 block! text-sm!`,children:s.pointsUnit})]}),(0,a.jsx)(`div`,{className:`mt-7 flex w-full justify-end`,children:(0,a.jsxs)(n.Typography.Text,{className:`text-arco-primary-6! text-right text-2xl! leading-tight! font-bold!`,children:[`$`,e.price]})})]})},e.id))})})]})})}function ve({user:e,points:t,text:i,onEditProfile:o,onRecharge:s,onPointsDetail:c,onLogout:l}){let u=e=>new Intl.NumberFormat().format(e);return(0,a.jsxs)(`div`,{className:`w-80 overflow-hidden rounded-xl border border-arco-border-2 bg-arco-bg-popup shadow-[0_10px_28px_rgb(0_0_0/12%)]`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-3 px-6 pt-5 pb-4`,children:[(0,a.jsx)(Z,{user:e,size:48,className:`shrink-0`}),(0,a.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,a.jsx)(`span`,{className:`text-arco-text-1 truncate text-base leading-6 font-bold`,children:e?.nickname||e?.username}),(0,a.jsx)(n.Button,{type:`text`,size:`mini`,icon:(0,a.jsx)(r.IconEdit,{}),className:`text-arco-text-3 h-6! min-w-6! px-0!`,onClick:o})]}),e?.email?(0,a.jsx)(`span`,{className:`text-arco-text-3 truncate text-xs leading-5`,children:e.email}):null]})]}),(0,a.jsx)(n.Divider,{className:`m-0!`}),(0,a.jsxs)(`ul`,{className:`flex flex-col gap-3.5 px-6 py-4`,children:[(0,a.jsxs)(`li`,{className:`text-arco-text-2 flex items-center justify-between gap-4 text-sm`,children:[(0,a.jsx)(`span`,{children:i.myPoints}),(0,a.jsx)(`strong`,{className:`text-arco-primary-6 text-base font-bold`,children:u(t.total)})]}),(0,a.jsxs)(`li`,{className:`text-arco-text-2 flex items-center justify-between gap-4 text-sm`,children:[(0,a.jsx)(`span`,{children:i.rechargePoints}),(0,a.jsx)(`strong`,{className:`text-arco-text-1 text-base font-bold`,children:u(t.recharge)})]}),(0,a.jsxs)(`li`,{className:`text-arco-text-2 flex items-center justify-between gap-4 text-sm`,children:[(0,a.jsx)(`span`,{children:i.giftedPoints}),(0,a.jsx)(`strong`,{className:`text-arco-text-1 text-base font-bold`,children:u(t.gifted)})]})]}),(0,a.jsx)(n.Divider,{className:`m-0!`}),(0,a.jsxs)(`div`,{className:`flex flex-col gap-2 px-6 py-4`,children:[(0,a.jsx)(n.Button,{type:`primary`,long:!0,icon:(0,a.jsx)(r.IconPlus,{}),className:`h-10! rounded-md! font-semibold!`,onClick:s,children:i.recharge}),(0,a.jsx)(n.Button,{long:!0,icon:(0,a.jsx)(r.IconFile,{}),className:`border-arco-border-2! bg-arco-fill-1! text-arco-text-1! h-10! rounded-md! font-semibold!`,onClick:c,children:i.pointsDetail})]}),(0,a.jsx)(n.Divider,{className:`m-0!`}),(0,a.jsx)(`div`,{className:`px-6 py-4`,children:(0,a.jsx)(n.Button,{icon:(0,a.jsx)(r.IconPoweroff,{}),type:`text`,status:`danger`,long:!0,className:`flex! items-center justify-start gap-2 text-sm text-arco-text-2`,onClick:()=>void l?.(),children:i.logout})})]})}var ye=`https://mantur.ai/images/logo.png`,Q=[`from-arco-primary-light-1 to-arco-primary-light-2 text-arco-primary-6`,`from-arco-success-light-1 to-arco-success-light-2 text-arco-success-6`,`from-arco-warning-light-1 to-arco-warning-light-2 text-arco-warning-6`,`from-arco-danger-light-1 to-arco-danger-light-2 text-arco-danger-6`];function $(e,t=!1){return`flex h-8 min-h-8 w-8 min-w-8 flex-none items-center justify-center rounded-lg bg-linear-to-br font-bold leading-none ${Q[e%Q.length]} ${t?`shadow-[inset_0_1px_3px_rgb(0_0_0/8%)]`:``}`}function be(e){return e?.tenantName?.[0]?.toUpperCase()||`T`}function xe(e,t,n){let r=e?.roles?.map(e=>e.roleName).filter(Boolean);return r?.length?r.join(`, `):e?.isOwner?t:n}function Se({user:e,disabled:i=!1,brandSlot:o,children:s,onTenantContextChange:c}){let[l,u]=(0,t.useState)(()=>G()),d=K(l),[f,p]=(0,t.useState)(!1),[m,h]=(0,t.useState)(!1),[g,_]=(0,t.useState)(!1),[y,b]=(0,t.useState)(e),[x,S]=(0,t.useState)([]),[C,w]=(0,t.useState)(),[T,O]=(0,t.useState)(!1),k=(0,t.useRef)(c),[j,M]=(0,t.useState)({total:0,recharge:0,gifted:0}),N=C?.tenantId||``,P=i,F={total:j.total??0,recharge:j.recharge??0,gifted:j.gifted??0},I=async e=>{let t=await D(e);return t&&b(t),t};(0,t.useEffect)(()=>{b(e)},[e]),(0,t.useEffect)(()=>{k.current=c},[c]);let L=(0,t.useCallback)(e=>{S(e.tenants),w(e.currentTenant),k.current?.(e)},[]);(0,t.useEffect)(()=>{O(!0),ee().then(L).catch(e=>{console.warn(`Failed to refresh Mantur tenant context.`,e),n.Message.error(d.error)}).finally(()=>O(!1))},[L,d.error]),(0,t.useEffect)(()=>{let e=e=>{e instanceof CustomEvent&&M(e.detail)};return window.addEventListener(v,e),A().catch(e=>{console.warn(`Failed to refresh Mantur user points.`,e)}),()=>{window.removeEventListener(v,e)}},[]),(0,t.useEffect)(()=>{let e=e=>{u(e instanceof CustomEvent?W(e.detail):G())};return window.addEventListener(H,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(H,e),window.removeEventListener(`storage`,e)}},[]);let R=e=>{n.Message.success(e)},z=(e,t)=>{console.error(t),n.Message.error(e)},B=(0,t.useCallback)(async e=>{if(!P&&e!==N)try{O(!0),L(await te(e)),R(d.switchedToTeam)}catch(e){z(d.error,e)}finally{O(!1)}},[L,N,P,d.error,d.switchedToTeam]),V=e=>{let t={total:F.total+e.points,recharge:F.recharge+e.points,gifted:F.gifted};M(t),window.dispatchEvent(new CustomEvent(v,{detail:t})),n.Message.success(d.rechargeSuccess),h(!1)},U=(0,t.useMemo)(()=>(0,a.jsxs)(n.Menu,{className:`w-56 rounded-xl bg-arco-bg-popup shadow-[0_10px_28px_rgb(0_0_0/12%)] [&_.arco-menu-inner]:px-2 [&_.arco-menu-inner]:py-1`,selectedKeys:N?[N]:[],onClickMenuItem:B,children:[(0,a.jsx)(`div`,{className:`px-3 py-2 text-xs font-semibold tracking-[0.04em] text-arco-text-4 uppercase`,children:d.switchTeam}),x.map((e,t)=>(0,a.jsx)(n.Menu.Item,{className:`mb-1 h-auto! min-h-10! overflow-visible! rounded-lg! px-2! py-1! leading-normal!`,children:(0,a.jsxs)(`div`,{className:`flex w-full items-center gap-3 leading-normal`,children:[(0,a.jsx)(`div`,{className:$(t),children:be(e)}),(0,a.jsxs)(`div`,{className:`flex min-w-0 flex-col justify-center gap-0.75`,children:[(0,a.jsx)(`span`,{className:`text-sm leading-5 font-medium text-arco-text-1`,children:e.tenantName}),(0,a.jsx)(`span`,{className:`text-xs leading-4 text-arco-text-3`,children:xe(e,d.owner,d.member)})]})]})},e.tenantId))]}),[B,N,x,d]),q=(0,a.jsx)(ve,{user:y,points:F,text:d,onEditProfile:()=>p(!0),onRecharge:()=>h(!0),onPointsDetail:()=>_(!0),onLogout:E}),J=Math.max(0,x.findIndex(e=>e.tenantId===C?.tenantId));return(0,a.jsxs)(`div`,{className:`flex h-20 items-center justify-between bg-transparent pr-8 shadow-[0_2px_10px_rgb(0_0_0/2%)] backdrop-blur-md max-md:pr-4`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,a.jsxs)(`div`,{className:`flex w-65 items-center gap-3 px-8 max-md:w-auto max-md:px-4`,children:[(0,a.jsx)(`div`,{className:`relative flex w-12 items-center justify-center overflow-hidden `,children:(0,a.jsx)(`img`,{src:ye,alt:`logo`,className:`w-full object-contain`,onError:e=>{e.currentTarget.style.display=`none`}})}),o??(0,a.jsx)(`span`,{className:`text-lg font-bold tracking-normal text-arco-text-1`,children:d.title})]}),(0,a.jsx)(n.Dropdown,{droplist:U,trigger:`click`,position:`bl`,disabled:P,children:(0,a.jsxs)(`div`,{"aria-disabled":P,className:`flex items-center gap-3 rounded-full border border-arco-border-1 bg-arco-bg-1 px-2 py-1.5 transition-all ${P?`cursor-not-allowed opacity-60`:`cursor-pointer hover:bg-arco-fill-2 hover:shadow-[0_4px_12px_rgb(0_0_0/8%)]`}`,children:[(0,a.jsx)(`div`,{className:$(J,!0),children:be(C)}),(0,a.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,a.jsx)(`span`,{className:`text-xs leading-none font-bold text-arco-text-1`,children:T?d.loading:C?.tenantName||d.loading}),(0,a.jsx)(`span`,{className:`mt-1 text-[10px] leading-none text-arco-text-3`,children:xe(C,d.owner,d.member)})]}),(0,a.jsx)(r.IconDown,{className:`ml-1 text-arco-text-3`})]})})]}),(0,a.jsx)(`div`,{className:`flex-1`,children:s}),(0,a.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,a.jsx)(ie,{}),(0,a.jsx)(re,{})]}),(0,a.jsx)(n.Dropdown,{droplist:q,trigger:`click`,position:`br`,onVisibleChange:e=>{e&&A().catch(e=>{console.warn(`Failed to refresh Mantur user points.`,e)})},children:(0,a.jsxs)(`div`,{className:`hover:bg-arco-fill-2 flex cursor-pointer items-center gap-2.5 rounded-full border border-transparent p-1 pr-2 transition-all`,children:[(0,a.jsxs)(`div`,{className:`from-arco-primary to-transparent relative rounded-full bg-linear-to-br p-0.5 shadow-sm`,children:[(0,a.jsx)(Z,{user:y,size:36}),(0,a.jsx)(`div`,{className:`bg-arco-success border-arco-bg-white absolute right-0 bottom-0 h-3 w-3 rounded-full border-2 shadow-sm`})]}),(0,a.jsx)(`div`,{className:`hidden flex-col md:flex`,children:(0,a.jsx)(`span`,{className:`text-arco-text-1 text-sm font-medium`,children:y?.nickname||y?.username})}),(0,a.jsx)(r.IconDown,{className:`text-arco-text-3 ml-1`})]})})]}),(0,a.jsx)(he,{visible:f,user:y,labels:d,onCancel:()=>p(!1),onSubmit:I}),(0,a.jsx)(_e,{visible:m,user:y,points:F,text:d,onCancel:()=>h(!1),onPay:V}),(0,a.jsx)(ue,{visible:g,points:F,text:d,onCancel:()=>_(!1),onRecharge:()=>h(!0)})]})}var Ce=h(p(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){"use strict";var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,E,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))}))(),1);function we(e,t=`datetime`,n){if(!e)return`-`;let r=(n?W(n):G()).startsWith(`en`),i=t===`date`?r?`MM/DD/YYYY`:`YYYY-MM-DD`:r?`MM/DD/YYYY HH:mm:ss`:`YYYY-MM-DD HH:mm:ss`;return(0,Ce.default)(e).format(i)}e.ManturHeader=Se,e.formatDateByLang=we});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mantur-components",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Reusable Mantur React component library.",
5
5
  "type": "module",
6
6
  "main": "./dist/mantur-components.umd.cjs",