@orderly.network/trading-points 1.0.0

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.
Files changed (81) hide show
  1. package/README.md +98 -0
  2. package/dist/chunk-QKQ47GQZ.js +11 -0
  3. package/dist/chunk-QKQ47GQZ.js.map +1 -0
  4. package/dist/chunk-XNMUIY72.mjs +9 -0
  5. package/dist/chunk-XNMUIY72.mjs.map +1 -0
  6. package/dist/de-K5HENMOT.mjs +48 -0
  7. package/dist/de-K5HENMOT.mjs.map +1 -0
  8. package/dist/de-M4RLZ65B.js +50 -0
  9. package/dist/de-M4RLZ65B.js.map +1 -0
  10. package/dist/en-LJLDUQVE.mjs +48 -0
  11. package/dist/en-LJLDUQVE.mjs.map +1 -0
  12. package/dist/en-V7OJRAEG.js +50 -0
  13. package/dist/en-V7OJRAEG.js.map +1 -0
  14. package/dist/es-GC6OLMOU.js +50 -0
  15. package/dist/es-GC6OLMOU.js.map +1 -0
  16. package/dist/es-WKVHRKSR.mjs +48 -0
  17. package/dist/es-WKVHRKSR.mjs.map +1 -0
  18. package/dist/fr-XMT3HUWZ.js +50 -0
  19. package/dist/fr-XMT3HUWZ.js.map +1 -0
  20. package/dist/fr-YXNQ5BX2.mjs +48 -0
  21. package/dist/fr-YXNQ5BX2.mjs.map +1 -0
  22. package/dist/id-5OI6YOIW.mjs +48 -0
  23. package/dist/id-5OI6YOIW.mjs.map +1 -0
  24. package/dist/id-RMBTTLNO.js +50 -0
  25. package/dist/id-RMBTTLNO.js.map +1 -0
  26. package/dist/index.d.mts +14 -0
  27. package/dist/index.d.ts +14 -0
  28. package/dist/index.js +1950 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/index.mjs +1948 -0
  31. package/dist/index.mjs.map +1 -0
  32. package/dist/it-5HUE25IQ.js +50 -0
  33. package/dist/it-5HUE25IQ.js.map +1 -0
  34. package/dist/it-FU4DAFK5.mjs +48 -0
  35. package/dist/it-FU4DAFK5.mjs.map +1 -0
  36. package/dist/ja-KNZVN3N7.mjs +48 -0
  37. package/dist/ja-KNZVN3N7.mjs.map +1 -0
  38. package/dist/ja-X3VXUMBA.js +50 -0
  39. package/dist/ja-X3VXUMBA.js.map +1 -0
  40. package/dist/ko-KG32EYC7.js +50 -0
  41. package/dist/ko-KG32EYC7.js.map +1 -0
  42. package/dist/ko-SUWRSMGZ.mjs +48 -0
  43. package/dist/ko-SUWRSMGZ.mjs.map +1 -0
  44. package/dist/nl-4U5KKRP6.mjs +48 -0
  45. package/dist/nl-4U5KKRP6.mjs.map +1 -0
  46. package/dist/nl-CQ5PEOAO.js +50 -0
  47. package/dist/nl-CQ5PEOAO.js.map +1 -0
  48. package/dist/pl-CVHBNRM4.mjs +48 -0
  49. package/dist/pl-CVHBNRM4.mjs.map +1 -0
  50. package/dist/pl-M7ZCG667.js +50 -0
  51. package/dist/pl-M7ZCG667.js.map +1 -0
  52. package/dist/pt-NQRWOJW2.mjs +48 -0
  53. package/dist/pt-NQRWOJW2.mjs.map +1 -0
  54. package/dist/pt-RXSAJZP6.js +50 -0
  55. package/dist/pt-RXSAJZP6.js.map +1 -0
  56. package/dist/ru-5LNO3PAB.js +50 -0
  57. package/dist/ru-5LNO3PAB.js.map +1 -0
  58. package/dist/ru-MRDWLFFN.mjs +48 -0
  59. package/dist/ru-MRDWLFFN.mjs.map +1 -0
  60. package/dist/styles.css +1 -0
  61. package/dist/tc-AWNFS2UX.js +50 -0
  62. package/dist/tc-AWNFS2UX.js.map +1 -0
  63. package/dist/tc-E5EMOQRW.mjs +48 -0
  64. package/dist/tc-E5EMOQRW.mjs.map +1 -0
  65. package/dist/tr-PKGFWNLE.js +50 -0
  66. package/dist/tr-PKGFWNLE.js.map +1 -0
  67. package/dist/tr-XQG34EBR.mjs +48 -0
  68. package/dist/tr-XQG34EBR.mjs.map +1 -0
  69. package/dist/uk-J6HX5IAD.mjs +48 -0
  70. package/dist/uk-J6HX5IAD.mjs.map +1 -0
  71. package/dist/uk-QA44TYO4.js +50 -0
  72. package/dist/uk-QA44TYO4.js.map +1 -0
  73. package/dist/vi-EJDUONJ6.mjs +48 -0
  74. package/dist/vi-EJDUONJ6.mjs.map +1 -0
  75. package/dist/vi-EK2GO4RO.js +50 -0
  76. package/dist/vi-EK2GO4RO.js.map +1 -0
  77. package/dist/zh-EAO7UXG4.mjs +48 -0
  78. package/dist/zh-EAO7UXG4.mjs.map +1 -0
  79. package/dist/zh-SXH3BWY7.js +50 -0
  80. package/dist/zh-SXH3BWY7.js.map +1 -0
  81. package/package.json +48 -0
package/dist/index.js ADDED
@@ -0,0 +1,1950 @@
1
+ 'use strict';
2
+
3
+ var chunkQKQ47GQZ_js = require('./chunk-QKQ47GQZ.js');
4
+ require('./styles.css');
5
+ var react = require('react');
6
+ var hooks = require('@orderly.network/hooks');
7
+ var utils = require('@orderly.network/utils');
8
+ var jsxRuntime = require('react/jsx-runtime');
9
+ var ui = require('@orderly.network/ui');
10
+ var dateFns = require('date-fns');
11
+ var i18n = require('@orderly.network/i18n');
12
+
13
+ function usePointsData() {
14
+ const brokerId = hooks.useConfig("brokerId");
15
+ const [currentStage, setCurrentStage] = react.useState(
16
+ void 0
17
+ );
18
+ const [selectedTimeRange, setSelectedTimeRange] = react.useState("this_week");
19
+ const { data: stages, isLoading: isStagesLoading } = hooks.useQuery(
20
+ brokerId ? `/v1/public/points/stages?broker_id=${brokerId}` : null,
21
+ {
22
+ formatter: (res) => {
23
+ if (res?.rows) {
24
+ res.rows.sort(
25
+ (a, b) => b.epoch_period - a.epoch_period
26
+ );
27
+ }
28
+ return res;
29
+ },
30
+ revalidateOnFocus: false
31
+ }
32
+ );
33
+ react.useEffect(() => {
34
+ if (!stages?.rows || stages.rows.length === 0 || currentStage !== void 0) {
35
+ return;
36
+ }
37
+ let selectedStage = stages.rows[0];
38
+ const activeStage = stages.rows.find((stage) => stage.status === "active");
39
+ if (activeStage) {
40
+ selectedStage = activeStage;
41
+ } else {
42
+ const pendingStage = [...stages.rows].reverse().find((stage) => stage.status === "pending");
43
+ if (pendingStage) {
44
+ selectedStage = pendingStage;
45
+ } else {
46
+ const completedStage = stages.rows.find(
47
+ (stage) => stage.status === "completed"
48
+ );
49
+ if (completedStage) {
50
+ selectedStage = completedStage;
51
+ }
52
+ }
53
+ }
54
+ setCurrentStage(selectedStage);
55
+ }, [stages, currentStage]);
56
+ const { data: userStatistics, isLoading: isUserStatisticsLoading } = hooks.usePrivateQuery(
57
+ currentStage !== void 0 ? `/v1/client/points/user_statistics?stage=${currentStage.stage_id}` : null,
58
+ {
59
+ formatter: (res) => res,
60
+ revalidateOnFocus: false
61
+ }
62
+ );
63
+ const { data: referralInfo } = hooks.usePrivateQuery(
64
+ "/v1/referral/info",
65
+ {
66
+ revalidateOnFocus: true,
67
+ errorRetryCount: 3,
68
+ ...hooks.noCacheConfig
69
+ }
70
+ );
71
+ const firstCode = react.useMemo(() => {
72
+ const codes = referralInfo?.referrer_info?.referral_codes;
73
+ if (!codes || codes.length === 0) {
74
+ return void 0;
75
+ }
76
+ return codes[0];
77
+ }, [referralInfo?.referrer_info?.referral_codes]);
78
+ const refCode = react.useMemo(() => {
79
+ return firstCode?.code || "--";
80
+ }, [firstCode]);
81
+ const refLink = react.useMemo(() => {
82
+ if (!firstCode || !firstCode.code) {
83
+ return "--";
84
+ }
85
+ const referralLinkUrl = window.location.origin;
86
+ return `${referralLinkUrl}?ref=${firstCode.code}`;
87
+ }, [firstCode]);
88
+ const getRankingUrl = react.useCallback(
89
+ (args) => {
90
+ if (!currentStage || !brokerId) return null;
91
+ const searchParams = new URLSearchParams();
92
+ searchParams.set("page", args.page.toString());
93
+ searchParams.set("size", args.pageSize.toString());
94
+ searchParams.set("stage", String(currentStage.stage_id));
95
+ searchParams.set("period", args.timeRange || selectedTimeRange);
96
+ searchParams.set("broker_id", String(brokerId));
97
+ return `/v1/public/points/rankings?${searchParams.toString()}`;
98
+ },
99
+ [brokerId, currentStage, selectedTimeRange]
100
+ );
101
+ const isLoading = isStagesLoading || isUserStatisticsLoading;
102
+ const isNoCampaign = !isStagesLoading && (!stages?.rows || stages.rows.length === 0);
103
+ const formatPoints = (value) => {
104
+ if (value === void 0 || value === null) {
105
+ return "--";
106
+ }
107
+ return utils.numberToHumanStyle(value, 2);
108
+ };
109
+ const calculateTotalPoints = react.useCallback(
110
+ (breakdown) => {
111
+ if (!breakdown) return void 0;
112
+ return breakdown.trading_point + breakdown.pnl_point + breakdown.referral_point;
113
+ },
114
+ []
115
+ );
116
+ const pointsDisplay = react.useMemo(() => {
117
+ if (!userStatistics) {
118
+ return {
119
+ currentPointsDisplay: "--",
120
+ tradingPointsDisplay: "--",
121
+ pnlPointsDisplay: "--",
122
+ referralPointsDisplay: "--",
123
+ rankingDisplay: "--"
124
+ };
125
+ }
126
+ const breakdownThisWeek = userStatistics.weekly_breakdown?.this_week;
127
+ const breakdownLastWeek = userStatistics.weekly_breakdown?.last_week;
128
+ let selectedBreakdown;
129
+ let ranking;
130
+ if (selectedTimeRange === "all_time") {
131
+ selectedBreakdown = {
132
+ trading_point: userStatistics.trading_point,
133
+ pnl_point: userStatistics.pnl_point,
134
+ referral_point: userStatistics.referral_point
135
+ };
136
+ ranking = userStatistics.stage_rank;
137
+ } else if (selectedTimeRange === "this_week") {
138
+ selectedBreakdown = breakdownThisWeek;
139
+ ranking = breakdownThisWeek?.rank;
140
+ } else {
141
+ selectedBreakdown = breakdownLastWeek;
142
+ ranking = breakdownLastWeek?.rank;
143
+ }
144
+ const currentPoints = calculateTotalPoints(selectedBreakdown) ?? 0;
145
+ return {
146
+ currentPointsDisplay: formatPoints(currentPoints),
147
+ tradingPointsDisplay: formatPoints(selectedBreakdown?.trading_point),
148
+ pnlPointsDisplay: formatPoints(selectedBreakdown?.pnl_point),
149
+ referralPointsDisplay: formatPoints(selectedBreakdown?.referral_point),
150
+ rankingDisplay: ranking === null || ranking === void 0 ? "--" : utils.commify(ranking)
151
+ };
152
+ }, [userStatistics, selectedTimeRange, calculateTotalPoints]);
153
+ const allTimePointsDisplay = react.useMemo(() => {
154
+ if (!userStatistics) {
155
+ return {
156
+ currentPointsDisplay: "--",
157
+ tradingPointsDisplay: "--",
158
+ pnlPointsDisplay: "--",
159
+ referralPointsDisplay: "--",
160
+ rankingDisplay: "--"
161
+ };
162
+ }
163
+ const currentPoints = calculateTotalPoints({
164
+ trading_point: userStatistics.trading_point,
165
+ pnl_point: userStatistics.pnl_point,
166
+ referral_point: userStatistics.referral_point
167
+ }) ?? 0;
168
+ return {
169
+ currentPointsDisplay: formatPoints(currentPoints),
170
+ tradingPointsDisplay: formatPoints(userStatistics.trading_point),
171
+ pnlPointsDisplay: formatPoints(userStatistics.pnl_point),
172
+ referralPointsDisplay: formatPoints(userStatistics.referral_point),
173
+ rankingDisplay: userStatistics.stage_rank === null || userStatistics.stage_rank === void 0 ? "--" : utils.commify(userStatistics.stage_rank)
174
+ };
175
+ }, [userStatistics, calculateTotalPoints]);
176
+ return {
177
+ stages,
178
+ userStatistics,
179
+ currentStage,
180
+ setCurrentStage,
181
+ isLoading,
182
+ isStagesLoading,
183
+ isUserStatisticsLoading,
184
+ isNoCampaign,
185
+ refLink,
186
+ refCode,
187
+ selectedTimeRange,
188
+ setSelectedTimeRange,
189
+ getRankingUrl,
190
+ brokerId,
191
+ pointsDisplay,
192
+ allTimePointsDisplay,
193
+ isCurrentStagePending: currentStage?.status === "pending",
194
+ isCurrentStageCompleted: currentStage?.status === "completed"
195
+ };
196
+ }
197
+ var PointsContext = react.createContext(void 0);
198
+ var PointsProvider = ({ children }) => {
199
+ const value = usePointsData();
200
+ return /* @__PURE__ */ jsxRuntime.jsx(PointsContext.Provider, { value, children });
201
+ };
202
+ function usePoints() {
203
+ const context = react.useContext(PointsContext);
204
+ if (context === void 0) {
205
+ throw new Error("usePoints must be used within a PointsProvider");
206
+ }
207
+ return context;
208
+ }
209
+ var getDateRange = (offsetDay) => {
210
+ return {
211
+ from: dateFns.subDays(/* @__PURE__ */ new Date(), offsetDay - 1),
212
+ to: /* @__PURE__ */ new Date()
213
+ };
214
+ };
215
+ var formatDateRange = (date) => {
216
+ return dateFns.format(date, "yyyy-MM-dd");
217
+ };
218
+ function splitCampaignByWeeks(campaignDateRange) {
219
+ const startDate = typeof campaignDateRange.start_time === "string" ? new Date(campaignDateRange.start_time) : campaignDateRange.start_time;
220
+ const endDate = typeof campaignDateRange.end_time === "string" ? new Date(campaignDateRange.end_time) : campaignDateRange.end_time;
221
+ const result = [];
222
+ let currentWeekStart = new Date(startDate);
223
+ let weekNumber = 1;
224
+ while (dateFns.isBefore(currentWeekStart, endDate)) {
225
+ const currentWeekEnd = dateFns.addDays(currentWeekStart, 6);
226
+ const actualWeekEnd = dateFns.isAfter(currentWeekEnd, endDate) ? new Date(endDate.getTime() - 1) : currentWeekEnd;
227
+ result.push({
228
+ from: new Date(currentWeekStart),
229
+ to: actualWeekEnd,
230
+ label: `Week ${weekNumber}`
231
+ });
232
+ if (!dateFns.isBefore(actualWeekEnd, endDate)) {
233
+ break;
234
+ }
235
+ if (weekNumber === 1) {
236
+ const nextDayStart = dateFns.addDays(currentWeekEnd, 1);
237
+ const year = nextDayStart.getUTCFullYear();
238
+ const month = nextDayStart.getUTCMonth();
239
+ const date = nextDayStart.getUTCDate();
240
+ currentWeekStart = new Date(Date.UTC(year, month, date, 0, 0, 0, 0));
241
+ } else {
242
+ const nextDayStart = dateFns.addDays(currentWeekEnd, 1);
243
+ const year = nextDayStart.getUTCFullYear();
244
+ const month = nextDayStart.getUTCMonth();
245
+ const date = nextDayStart.getUTCDate();
246
+ currentWeekStart = new Date(Date.UTC(year, month, date, 0, 0, 0, 0));
247
+ }
248
+ weekNumber++;
249
+ if (weekNumber > 100) {
250
+ break;
251
+ }
252
+ }
253
+ return result;
254
+ }
255
+ function getCurrentWeeklyRange(weeklyRanges, targetDate = /* @__PURE__ */ new Date()) {
256
+ const weeklyOnlyRanges = weeklyRanges.filter(
257
+ (range) => range.label !== "All time"
258
+ );
259
+ for (const range of weeklyOnlyRanges) {
260
+ const rangeFrom = new Date(range.from);
261
+ const rangeTo = new Date(range.to);
262
+ if (dateFns.isWithinInterval(targetDate, { start: rangeFrom, end: rangeTo })) {
263
+ return range;
264
+ }
265
+ }
266
+ const targetTime = targetDate.getTime();
267
+ let closestFutureRange = null;
268
+ let smallestGap = Infinity;
269
+ for (const range of weeklyOnlyRanges) {
270
+ const rangeFrom = new Date(range.from);
271
+ const rangeFromTime = rangeFrom.getTime();
272
+ if (rangeFromTime > targetTime) {
273
+ const gap = rangeFromTime - targetTime;
274
+ if (gap < smallestGap) {
275
+ smallestGap = gap;
276
+ closestFutureRange = range;
277
+ }
278
+ }
279
+ }
280
+ const ONE_DAY_MS = 24 * 60 * 60 * 1e3;
281
+ if (closestFutureRange && smallestGap <= ONE_DAY_MS) {
282
+ return closestFutureRange;
283
+ }
284
+ return null;
285
+ }
286
+ function getCurrentOrAllTimeRange(weeklyRanges, targetDate = /* @__PURE__ */ new Date()) {
287
+ const currentWeekly = getCurrentWeeklyRange(weeklyRanges, targetDate);
288
+ if (currentWeekly) {
289
+ return currentWeekly;
290
+ }
291
+ return weeklyRanges.find((range) => range.label === "All time") || weeklyRanges[weeklyRanges.length - 1];
292
+ }
293
+
294
+ // src/components/leaderboard/generalLeaderboard/generalLeaderboard.script.ts
295
+ function useGeneralLeaderboardScript(options) {
296
+ const { campaignDateRange } = options || {};
297
+ const weeklyRanges = react.useMemo(() => {
298
+ if (!campaignDateRange) return [];
299
+ return splitCampaignByWeeks(campaignDateRange);
300
+ }, [campaignDateRange]);
301
+ const currentOrAllTimeRange = react.useMemo(() => {
302
+ return getCurrentOrAllTimeRange(weeklyRanges);
303
+ }, [weeklyRanges]);
304
+ const [activeTab, setActiveTab] = react.useState(
305
+ "volume" /* Volume */
306
+ );
307
+ const filterState = useFilter({ defaultRange: currentOrAllTimeRange });
308
+ const searchState = useSearch();
309
+ const useCampaignDateRange = react.useMemo(() => {
310
+ return !!campaignDateRange;
311
+ }, [campaignDateRange]);
312
+ return {
313
+ ...filterState,
314
+ ...searchState,
315
+ activeTab,
316
+ onTabChange: setActiveTab,
317
+ useCampaignDateRange,
318
+ weeklyRanges,
319
+ currentOrAllTimeRange
320
+ };
321
+ }
322
+ function useFilter({ defaultRange }) {
323
+ const [filterDay, setFilterDay] = react.useState(90);
324
+ const [dateRange, setDateRange] = react.useState(getDateRange(90));
325
+ const updateFilterDay = (day) => {
326
+ setFilterDay(day);
327
+ setDateRange(getDateRange(day));
328
+ };
329
+ react.useEffect(() => {
330
+ setDateRange(defaultRange ?? getDateRange(90));
331
+ }, [defaultRange]);
332
+ const onFilter = (filter) => {
333
+ if (filter.name === "dateRange") {
334
+ const newDateRange = filter.value;
335
+ setDateRange(newDateRange);
336
+ if (newDateRange.from && newDateRange.to) {
337
+ const offsetDay = Math.abs(dateFns.differenceInDays(newDateRange.from, newDateRange.to)) + 1;
338
+ const dateRange2 = getDateRange(offsetDay);
339
+ if (formatDateRange(dateRange2.from) === formatDateRange(newDateRange.from) && formatDateRange(dateRange2.to) === formatDateRange(newDateRange.to)) {
340
+ setFilterDay(offsetDay);
341
+ } else {
342
+ setFilterDay(null);
343
+ }
344
+ }
345
+ }
346
+ };
347
+ const filterItems = react.useMemo(() => {
348
+ const dateRangeFilter = {
349
+ type: "range",
350
+ name: "dateRange",
351
+ value: dateRange,
352
+ max: 90
353
+ };
354
+ return [dateRangeFilter];
355
+ }, [dateRange]);
356
+ return {
357
+ filterItems,
358
+ onFilter,
359
+ dateRange,
360
+ filterDay,
361
+ updateFilterDay,
362
+ setDateRange
363
+ };
364
+ }
365
+ function useSearch() {
366
+ const [searchValue, setSearchValue] = react.useState("");
367
+ const onSearchValueChange = react.useCallback((value) => {
368
+ setSearchValue(value);
369
+ }, []);
370
+ const clearSearchValue = react.useCallback(() => {
371
+ setSearchValue("");
372
+ }, []);
373
+ return {
374
+ searchValue,
375
+ onSearchValueChange,
376
+ clearSearchValue
377
+ };
378
+ }
379
+
380
+ // src/components/ranking/shared/util.ts
381
+ function isSameAddress(address1, address2) {
382
+ return address1.toLowerCase() === address2.toLowerCase();
383
+ }
384
+ function getCurrentAddressRowKey(address) {
385
+ return `current-address-${address?.toLowerCase()}`;
386
+ }
387
+ var useRankingColumns = (fields, address, enableSort, type) => {
388
+ const { t } = i18n.useTranslation();
389
+ const { isMobile } = ui.useScreen();
390
+ return react.useMemo(() => {
391
+ const columns = [
392
+ {
393
+ title: t("tradingLeaderboard.rank"),
394
+ dataIndex: "rank",
395
+ width: 50,
396
+ render: (value, record) => {
397
+ const isYou = record.key === getCurrentAddressRowKey(address);
398
+ let rankIcon;
399
+ let badgeImg = null;
400
+ if (!isYou) {
401
+ if (value === 1) {
402
+ rankIcon = /* @__PURE__ */ jsxRuntime.jsx(FirstRankIcon, {});
403
+ badgeImg = "https://oss.orderly.network/static/sdk/leaderboard/first_badge.png";
404
+ } else if (value === 2) {
405
+ rankIcon = /* @__PURE__ */ jsxRuntime.jsx(SecondRankIcon, {});
406
+ badgeImg = "https://oss.orderly.network/static/sdk/leaderboard/second_badge.png";
407
+ } else if (value === 3) {
408
+ rankIcon = /* @__PURE__ */ jsxRuntime.jsx(ThirdRankIcon, {});
409
+ badgeImg = "https://oss.orderly.network/static/sdk/leaderboard/third_badge.png";
410
+ }
411
+ }
412
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
413
+ badgeImg && /* @__PURE__ */ jsxRuntime.jsx(
414
+ "img",
415
+ {
416
+ src: badgeImg,
417
+ alt: `${value}th badge`,
418
+ className: ui.cn(
419
+ "oui-z-0 oui-h-[38px] oui-opacity-30 md:oui-h-[46px]",
420
+ "oui-absolute oui-left-0 oui-top-0",
421
+ "oui-mix-blend-luminosity",
422
+ // force create a separate layer in order to fix mix-blend-luminosity not working on ios
423
+ "oui-transform-gpu"
424
+ )
425
+ }
426
+ ),
427
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-relative", children: rankIcon || /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { width: 20, pl: 2, className: "oui-text-center", children: value }) })
428
+ ] });
429
+ }
430
+ },
431
+ {
432
+ title: t("common.address"),
433
+ dataIndex: "address",
434
+ render: (value, record) => {
435
+ const isYou = record.key === getCurrentAddressRowKey(address);
436
+ if (isMobile && isYou) {
437
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "You" });
438
+ }
439
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
440
+ "a",
441
+ {
442
+ className: "oui-flex oui-items-start oui-gap-1",
443
+ href: `https://orderly-dashboard.orderly.network/address/${value}?broker_id=${record.broker_id}`,
444
+ target: "_blank",
445
+ rel: "noreferrer",
446
+ children: [
447
+ /* @__PURE__ */ jsxRuntime.jsx(
448
+ ui.Text.formatted,
449
+ {
450
+ rule: "address",
451
+ onCopy: (e) => {
452
+ e.preventDefault();
453
+ e.stopPropagation();
454
+ navigator.clipboard.writeText(value);
455
+ ui.toast.success(t("common.copy.copied"));
456
+ },
457
+ className: "oui-cursor-pointer",
458
+ children: value
459
+ },
460
+ record.rank
461
+ ),
462
+ isYou && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: " (You)" })
463
+ ]
464
+ }
465
+ ) });
466
+ },
467
+ width: 90
468
+ },
469
+ {
470
+ title: "Points",
471
+ dataIndex: "points",
472
+ align: isMobile ? "right" : "left",
473
+ render: (value) => {
474
+ if (value === void 0 || value === null || value === "") {
475
+ return "-";
476
+ }
477
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: utils.commify(value, 2) });
478
+ }
479
+ }
480
+ ];
481
+ return columns.filter(
482
+ (column) => fields?.includes(column.dataIndex)
483
+ );
484
+ }, [t, isMobile, address, fields, enableSort, type]);
485
+ };
486
+ var FirstRankIcon = () => {
487
+ return /* @__PURE__ */ jsxRuntime.jsxs(
488
+ "svg",
489
+ {
490
+ width: "25",
491
+ height: "25",
492
+ viewBox: "0 0 25 25",
493
+ fill: "none",
494
+ xmlns: "http://www.w3.org/2000/svg",
495
+ children: [
496
+ /* @__PURE__ */ jsxRuntime.jsx(
497
+ "path",
498
+ {
499
+ d: "M3.88281 2.5L7.78711 10.3105C6.38111 11.5855 5.5 13.427 5.5 15.5C5.5 19.4 8.6 22.5 12.5 22.5C16.4 22.5 19.5 19.4 19.5 15.5C19.5 13.427 18.6189 11.5855 17.2129 10.3105L21.1172 2.5H15.5L12.5 8.5L9.5 2.5H3.88281ZM12.5 10.5C15.3 10.5 17.5 12.7 17.5 15.5C17.5 18.3 15.3 20.5 12.5 20.5C9.7 20.5 7.5 18.3 7.5 15.5C7.5 12.7 9.7 10.5 12.5 10.5ZM12.5 12.5C12.4 12.8 11.9 13.6992 11 13.6992V14.6992H12.0996V18.5H13.4004H13.5V12.5H12.5Z",
500
+ fill: "url(#paint0_linear_21940_39199)"
501
+ }
502
+ ),
503
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs(
504
+ "linearGradient",
505
+ {
506
+ id: "paint0_linear_21940_39199",
507
+ x1: "6.18073",
508
+ y1: "6",
509
+ x2: "20.1338",
510
+ y2: "18.1659",
511
+ gradientUnits: "userSpaceOnUse",
512
+ children: [
513
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "#8C421D" }),
514
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0.325272", stopColor: "#FBE67B" }),
515
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0.535488", stopColor: "#FCFBE7" }),
516
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0.769917", stopColor: "#F7D14E" }),
517
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "#D4A041" })
518
+ ]
519
+ }
520
+ ) })
521
+ ]
522
+ }
523
+ );
524
+ };
525
+ var SecondRankIcon = () => {
526
+ return /* @__PURE__ */ jsxRuntime.jsxs(
527
+ "svg",
528
+ {
529
+ width: "25",
530
+ height: "25",
531
+ viewBox: "0 0 25 25",
532
+ fill: "none",
533
+ xmlns: "http://www.w3.org/2000/svg",
534
+ children: [
535
+ /* @__PURE__ */ jsxRuntime.jsx(
536
+ "path",
537
+ {
538
+ d: "M3.88281 2.5L7.78711 10.3105C6.38111 11.5855 5.5 13.427 5.5 15.5C5.5 19.4 8.6 22.5 12.5 22.5C16.4 22.5 19.5 19.4 19.5 15.5C19.5 13.427 18.6189 11.5855 17.2129 10.3105L21.1172 2.5H15.5L12.5 8.5L9.5 2.5H3.88281ZM12.5 10.5C15.3 10.5 17.5 12.7 17.5 15.5C17.5 18.3 15.3 20.5 12.5 20.5C9.7 20.5 7.5 18.3 7.5 15.5C7.5 12.7 9.7 10.5 12.5 10.5ZM12.5469 12.5C10.7729 12.5 10.481 13.901 10.5 14.5H11.6738C11.6738 14.357 11.809 13.5 12.5 13.5C13.163 13.5 13.291 14.0232 13.291 14.2852C13.291 15.0512 12.245 15.7623 10.5 17.6973V18.5L14.4883 18.4766L14.4863 17.5332H12.2285C13.8425 15.8792 14.5 15.1309 14.5 14.1719C14.5 13.4869 14.1149 12.5 12.5469 12.5Z",
539
+ fill: "url(#paint0_linear_21940_39214)"
540
+ }
541
+ ),
542
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs(
543
+ "linearGradient",
544
+ {
545
+ id: "paint0_linear_21940_39214",
546
+ x1: "6.18073",
547
+ y1: "6",
548
+ x2: "20.1338",
549
+ y2: "18.1659",
550
+ gradientUnits: "userSpaceOnUse",
551
+ children: [
552
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "#7F7F7F" }),
553
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0.325272", stopColor: "#D9D9D9" }),
554
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0.535488", stopColor: "#F7F6F4" }),
555
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0.769917", stopColor: "#D9D9D9" }),
556
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "#7F7F7F" })
557
+ ]
558
+ }
559
+ ) })
560
+ ]
561
+ }
562
+ );
563
+ };
564
+ var ThirdRankIcon = () => {
565
+ return /* @__PURE__ */ jsxRuntime.jsxs(
566
+ "svg",
567
+ {
568
+ width: "29",
569
+ height: "25",
570
+ viewBox: "0 0 29 25",
571
+ fill: "none",
572
+ xmlns: "http://www.w3.org/2000/svg",
573
+ children: [
574
+ /* @__PURE__ */ jsxRuntime.jsx(
575
+ "path",
576
+ {
577
+ d: "M5.88281 2.5L9.78711 10.3105C8.38111 11.5855 7.5 13.427 7.5 15.5C7.5 19.4 10.6 22.5 14.5 22.5C18.4 22.5 21.5 19.4 21.5 15.5C21.5 13.427 20.6189 11.5855 19.2129 10.3105L23.1172 2.5H17.5L14.5 8.5L11.5 2.5H5.88281ZM14.5 10.5C17.3 10.5 19.5 12.7 19.5 15.5C19.5 18.3 17.3 20.5 14.5 20.5C11.7 20.5 9.5 18.3 9.5 15.5C9.5 12.7 11.7 10.5 14.5 10.5ZM14.4688 12.5C13.6927 12.5 12.5898 12.9348 12.5898 14.0918H13.7266C13.7266 13.9118 13.8461 13.4336 14.4941 13.4336C14.6251 13.4336 15.2715 13.4767 15.2715 14.1797C15.2715 14.8967 14.7109 14.9844 14.4219 14.9844H13.8145V15.8906H14.4219C14.5659 15.8906 15.3613 15.8537 15.3613 16.7637C15.3613 16.8837 15.3111 17.5625 14.4961 17.5625C13.8081 17.5625 13.6233 17.0284 13.6562 16.8164H12.5195C12.4615 17.4334 12.9757 18.4961 14.4688 18.4961C15.3018 18.4961 16.5 18.0942 16.5 16.7812C16.5 15.8643 15.8621 15.536 15.5391 15.418C15.6781 15.354 16.4082 14.9771 16.4082 14.1641C16.4082 13.7131 16.2127 12.5 14.4688 12.5Z",
578
+ fill: "url(#paint0_linear_21940_39224)"
579
+ }
580
+ ),
581
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs(
582
+ "linearGradient",
583
+ {
584
+ id: "paint0_linear_21940_39224",
585
+ x1: "8.61159",
586
+ y1: "5.33333",
587
+ x2: "22.7368",
588
+ y2: "20.4383",
589
+ gradientUnits: "userSpaceOnUse",
590
+ children: [
591
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "#B6947E" }),
592
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0.2", stopColor: "#8F6959" }),
593
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0.475", stopColor: "#F8DAC8" }),
594
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0.67", stopColor: "#AC836E" }),
595
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0.83", stopColor: "#B6947E" }),
596
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "#F8DCCB" })
597
+ ]
598
+ }
599
+ ) })
600
+ ]
601
+ }
602
+ );
603
+ };
604
+ var Ranking = (props) => {
605
+ const column = useRankingColumns(
606
+ props.fields,
607
+ props.address,
608
+ false,
609
+ props.type
610
+ );
611
+ const { isMobile } = ui.useScreen();
612
+ const onRow = react.useCallback(
613
+ (record, index) => {
614
+ const isYou = record.key === getCurrentAddressRowKey(props.address);
615
+ const isFirst = record.rank === 1;
616
+ const isSecond = record.rank === 2;
617
+ const isThird = record.rank === 3;
618
+ const showBg = isFirst || isSecond || isThird;
619
+ return {
620
+ className: ui.cn(
621
+ "oui-h-[40px] md:oui-h-[48px]",
622
+ // use oui-relative to let the background image position based on row
623
+ "oui-relative",
624
+ isYou ? (
625
+ // add 4px extra height to make row has 2px space
626
+ "oui-h-[44px] md:oui-h-[52px]"
627
+ ) : ui.cn(
628
+ showBg && "oui-border-b-2 oui-border-b-transparent",
629
+ isFirst && "oui-bg-[linear-gradient(270deg,rgba(241,215,121,0.0225)_-2.05%,rgba(255,203,70,0.45)_100%)]",
630
+ isSecond && "oui-bg-[linear-gradient(270deg,rgba(255,255,255,0.0225)_-2.05%,rgba(199,199,199,0.45)_100%)]",
631
+ isThird && "oui-bg-[linear-gradient(270deg,rgba(255,233,157,0.0225)_-1.3%,rgba(160,101,46,0.45)_100%)]"
632
+ )
633
+ )
634
+ };
635
+ },
636
+ [props.address]
637
+ );
638
+ const onCell = react.useCallback(
639
+ (column2, record) => {
640
+ const isFirstColumn = column2.getIsFirstColumn();
641
+ const isLastColumn = column2.getIsLastColumn();
642
+ const isRank = [1, 2, 3].includes(record.rank);
643
+ return {
644
+ className: ui.cn(
645
+ isFirstColumn && isRank && "oui-rounded-l-lg oui-mix-blend-luminosity",
646
+ isLastColumn && isRank && "oui-rounded-r-lg oui-mix-blend-luminosity"
647
+ )
648
+ };
649
+ },
650
+ [props.address]
651
+ );
652
+ if (isMobile) {
653
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
654
+ /* @__PURE__ */ jsxRuntime.jsx(
655
+ ui.DataTable,
656
+ {
657
+ classNames: {
658
+ root: "oui-trading-leaderboard-ranking-table oui-bg-transparent",
659
+ body: "oui-text-2xs",
660
+ scroll: "oui-overflow-y-hidden oui-h-full"
661
+ },
662
+ loading: props.isLoading,
663
+ columns: column,
664
+ bordered: true,
665
+ dataSource: props.dataList,
666
+ generatedRowKey: (record) => record.key || record.address,
667
+ manualPagination: true,
668
+ manualSorting: true,
669
+ onRow,
670
+ onCell
671
+ }
672
+ ),
673
+ /* @__PURE__ */ jsxRuntime.jsx(
674
+ "div",
675
+ {
676
+ ref: props.sentinelRef,
677
+ className: "oui-invisible oui-relative oui-top-[-300px] oui-h-px"
678
+ }
679
+ ),
680
+ props.isLoading && props.dataList.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { itemAlign: "center", justify: "center", width: "100%", height: 40, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, { size: "sm" }) })
681
+ ] });
682
+ }
683
+ return /* @__PURE__ */ jsxRuntime.jsx(
684
+ ui.DataTable,
685
+ {
686
+ loading: props.isLoading,
687
+ columns: column,
688
+ bordered: true,
689
+ dataSource: props.dataSource,
690
+ generatedRowKey: (record) => record.key || record.address,
691
+ manualPagination: true,
692
+ manualSorting: true,
693
+ pagination: props.pagination,
694
+ classNames: {
695
+ root: ui.cn(
696
+ "oui-trading-leaderboard-ranking-table",
697
+ "oui-bg-transparent",
698
+ "oui-rounded-md",
699
+ "oui-overflow-hidden",
700
+ "!oui-h-[calc(100%_-_53px_-_8px)]"
701
+ ),
702
+ scroll: "oui-min-h-[600px] oui-max-h-[1250px]",
703
+ header: "oui-bg-base-9"
704
+ },
705
+ onRow,
706
+ onCell
707
+ }
708
+ );
709
+ };
710
+ function useEndReached(sentinelRef, onEndReached) {
711
+ const observer = react.useRef();
712
+ const cb = react.useRef(onEndReached);
713
+ cb.current = onEndReached;
714
+ react.useEffect(() => {
715
+ const options = {
716
+ root: null,
717
+ rootMargin: "0px",
718
+ threshold: 0
719
+ };
720
+ const handleObserver = (entries) => {
721
+ entries.forEach((entry) => {
722
+ if (entry.isIntersecting) {
723
+ cb.current?.();
724
+ }
725
+ });
726
+ };
727
+ observer.current = new IntersectionObserver(handleObserver, options);
728
+ return () => {
729
+ observer.current?.disconnect();
730
+ };
731
+ }, []);
732
+ react.useEffect(() => {
733
+ if (sentinelRef.current) {
734
+ observer.current?.observe(sentinelRef.current);
735
+ }
736
+ }, [sentinelRef.current]);
737
+ }
738
+
739
+ // src/components/ranking/generalRanking/generalRanking.script.ts
740
+ function useGeneralRankingScript(options) {
741
+ const { address: searchValue } = options || {};
742
+ const brokerId = hooks.useConfig("brokerId");
743
+ const { currentStage, userStatistics, getRankingUrl, selectedTimeRange } = usePoints();
744
+ const { isMobile } = ui.useScreen();
745
+ const { page, pageSize, setPage, parsePagination } = ui.usePagination({
746
+ pageSize: 10
747
+ });
748
+ const { data, isLoading } = hooks.useQuery(
749
+ currentStage && brokerId ? getRankingUrl({ page, pageSize, timeRange: selectedTimeRange }) : null,
750
+ {
751
+ formatter: (res) => res,
752
+ revalidateOnFocus: false
753
+ }
754
+ );
755
+ const {
756
+ data: infiniteData,
757
+ size,
758
+ setSize,
759
+ isValidating
760
+ } = hooks.useInfiniteQuery(
761
+ (pageIndex, previousPageData) => {
762
+ if (previousPageData && !previousPageData.rows?.length) return null;
763
+ if (!isMobile || !currentStage) return null;
764
+ return getRankingUrl({
765
+ page: pageIndex + 1,
766
+ pageSize,
767
+ timeRange: selectedTimeRange
768
+ });
769
+ },
770
+ {
771
+ initialSize: 1,
772
+ formatter: (res) => res,
773
+ revalidateOnFocus: false
774
+ }
775
+ );
776
+ const userDataList = react.useMemo(() => {
777
+ if (!userStatistics?.address) return [];
778
+ let rank = "-";
779
+ let points;
780
+ if (selectedTimeRange === "all_time") {
781
+ rank = userStatistics.stage_rank ?? "-";
782
+ points = userStatistics.stage_points;
783
+ } else if (selectedTimeRange === "this_week") {
784
+ rank = userStatistics.weekly_breakdown?.this_week?.rank ?? "-";
785
+ const breakdown = userStatistics.weekly_breakdown?.this_week;
786
+ points = breakdown ? breakdown.trading_point + breakdown.pnl_point + breakdown.referral_point : void 0;
787
+ } else if (selectedTimeRange === "last_week") {
788
+ rank = userStatistics.weekly_breakdown?.last_week?.rank ?? "-";
789
+ const breakdown = userStatistics.weekly_breakdown?.last_week;
790
+ points = breakdown ? breakdown.trading_point + breakdown.pnl_point + breakdown.referral_point : void 0;
791
+ }
792
+ return [
793
+ {
794
+ key: getCurrentAddressRowKey(userStatistics.address),
795
+ address: userStatistics.address,
796
+ rank,
797
+ points,
798
+ broker_id: brokerId ?? null
799
+ }
800
+ ];
801
+ }, [userStatistics, brokerId, selectedTimeRange]);
802
+ const addRankForList = react.useCallback(
803
+ (list) => {
804
+ return list?.map((item, index) => ({
805
+ ...item,
806
+ rank: index + 1 + (page - 1) * pageSize
807
+ }));
808
+ },
809
+ [page, pageSize]
810
+ );
811
+ const dataSource = react.useMemo(() => {
812
+ const mapped = (data?.rows || []).map((row) => ({
813
+ address: row.address,
814
+ points: row.total_points,
815
+ rank: row.rank,
816
+ broker_id: brokerId ?? null
817
+ }));
818
+ const filtered = searchValue ? mapped.filter((item) => isSameAddress(item.address, searchValue || "")) : mapped;
819
+ const finalList = addRankForList(filtered);
820
+ if (page === 1 && !searchValue && userDataList.length) {
821
+ return [...userDataList, ...finalList];
822
+ }
823
+ return finalList;
824
+ }, [data, brokerId, searchValue, addRankForList, page, userDataList]);
825
+ const dataList = react.useMemo(() => {
826
+ if (!infiniteData?.length) return [];
827
+ const flat = infiniteData.map((p) => p.rows).flat();
828
+ const mapped = flat.map((row) => ({
829
+ address: row.address,
830
+ points: row.total_points,
831
+ broker_id: brokerId ?? null
832
+ }));
833
+ const filtered = searchValue ? mapped.filter((item) => isSameAddress(item.address, searchValue)) : mapped;
834
+ const rankList = addRankForList(filtered);
835
+ if (!searchValue && userDataList.length) {
836
+ return [...userDataList, ...rankList];
837
+ }
838
+ return rankList;
839
+ }, [infiniteData, brokerId, searchValue, addRankForList, userDataList]);
840
+ const sentinelRef = react.useRef(null);
841
+ const pagination = react.useMemo(
842
+ () => parsePagination({
843
+ total: data?.meta?.total || 0,
844
+ current_page: data?.meta?.current_page || 1,
845
+ records_per_page: pageSize
846
+ }),
847
+ [data?.meta?.total, data?.meta?.current_page, pageSize]
848
+ );
849
+ useEndReached(sentinelRef, () => {
850
+ if (!isValidating && isMobile) {
851
+ setSize(size + 1);
852
+ }
853
+ });
854
+ react.useEffect(() => {
855
+ if (searchValue) setPage(1);
856
+ }, [searchValue, setPage]);
857
+ react.useEffect(() => {
858
+ setPage(1);
859
+ }, [currentStage?.stage_id, setPage]);
860
+ react.useEffect(() => {
861
+ setPage(1);
862
+ setSize(1);
863
+ }, [selectedTimeRange, setPage, setSize]);
864
+ return {
865
+ pagination,
866
+ dataSource,
867
+ isLoading: isLoading || isValidating,
868
+ isMobile,
869
+ sentinelRef,
870
+ dataList,
871
+ address: userStatistics?.address
872
+ };
873
+ }
874
+ var GeneralRankingWidget = (props) => {
875
+ const { address, fields, ...rest } = props;
876
+ const state = useGeneralRankingScript({ address });
877
+ return /* @__PURE__ */ jsxRuntime.jsx(Ranking, { ...state, ...rest, fields, type: "general" });
878
+ };
879
+ var GeneralLeaderboard = (props) => {
880
+ const { isMobile } = ui.useScreen();
881
+ const fields = ["rank", "address", "points"];
882
+ if (isMobile) {
883
+ return /* @__PURE__ */ jsxRuntime.jsx(
884
+ ui.Box,
885
+ {
886
+ pt: 2,
887
+ px: 3,
888
+ r: "2xl",
889
+ intensity: 900,
890
+ width: "100%",
891
+ className: ui.cn(
892
+ "oui-trading-leaderboard-general-leaderboard oui-relative",
893
+ props.className
894
+ ),
895
+ style: props.style,
896
+ children: /* @__PURE__ */ jsxRuntime.jsx(GeneralRankingWidget, { address: props.searchValue, fields })
897
+ }
898
+ );
899
+ }
900
+ return /* @__PURE__ */ jsxRuntime.jsx(
901
+ ui.Box,
902
+ {
903
+ pt: 2,
904
+ px: 6,
905
+ r: "2xl",
906
+ className: ui.cn(
907
+ "oui-trading-leaderboard-general-leaderboard oui-relative",
908
+ "oui-mx-auto oui-max-w-[992px]",
909
+ props.className
910
+ ),
911
+ style: props.style,
912
+ children: /* @__PURE__ */ jsxRuntime.jsx(GeneralRankingWidget, { address: props.searchValue, fields })
913
+ }
914
+ );
915
+ };
916
+ var GeneralLeaderboardWidget = (props) => {
917
+ const state = useGeneralLeaderboardScript({
918
+ campaignDateRange: props.campaignDateRange
919
+ });
920
+ return /* @__PURE__ */ jsxRuntime.jsx(
921
+ GeneralLeaderboard,
922
+ {
923
+ ...state,
924
+ className: props.className,
925
+ style: props.style
926
+ }
927
+ );
928
+ };
929
+ var Countdown = ({ className }) => {
930
+ const { isMobile } = ui.useScreen();
931
+ const { currentStage } = usePoints();
932
+ const { t } = i18n.useTranslation();
933
+ const [timeLeft, setTimeLeft] = react.useState({
934
+ days: 0,
935
+ hours: 0,
936
+ minutes: 0,
937
+ seconds: 0
938
+ });
939
+ react.useEffect(() => {
940
+ if (currentStage?.status !== "pending" || !currentStage?.start_time) {
941
+ return;
942
+ }
943
+ const calculateTimeLeft = () => {
944
+ const targetDate2 = currentStage.start_time * 1e3;
945
+ const now2 = (/* @__PURE__ */ new Date()).getTime();
946
+ const difference = targetDate2 - now2;
947
+ if (difference > 0) {
948
+ return {
949
+ days: Math.floor(difference / (1e3 * 60 * 60 * 24)),
950
+ hours: Math.floor(difference / (1e3 * 60 * 60) % 24),
951
+ minutes: Math.floor(difference / 1e3 / 60 % 60),
952
+ seconds: Math.floor(difference / 1e3 % 60)
953
+ };
954
+ }
955
+ return { days: 0, hours: 0, minutes: 0, seconds: 0 };
956
+ };
957
+ setTimeLeft(calculateTimeLeft());
958
+ const timer = setInterval(() => {
959
+ setTimeLeft(calculateTimeLeft());
960
+ }, 1e3);
961
+ return () => clearInterval(timer);
962
+ }, [currentStage]);
963
+ const formatNumber = (num) => {
964
+ return num.toString().padStart(2, "0");
965
+ };
966
+ if (currentStage?.status !== "pending" || !currentStage?.start_time) {
967
+ return null;
968
+ }
969
+ const targetDate = currentStage.start_time * 1e3;
970
+ const now = (/* @__PURE__ */ new Date()).getTime();
971
+ if (targetDate <= now) {
972
+ return null;
973
+ }
974
+ return /* @__PURE__ */ jsxRuntime.jsxs(
975
+ ui.Flex,
976
+ {
977
+ gap: 4,
978
+ itemAlign: "center",
979
+ justify: "center",
980
+ px: 9,
981
+ className,
982
+ children: [
983
+ !isMobile && /* @__PURE__ */ jsxRuntime.jsx(
984
+ ui.Box,
985
+ {
986
+ className: "oui-w-[200px] oui-h-[1px]",
987
+ style: {
988
+ background: `linear-gradient(123deg, rgba(176, 132, 233, 0.00) 0%, #DEC4FF 123.91%)`
989
+ }
990
+ }
991
+ ),
992
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { className: "oui-rounded-2xl", p: 5, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", gap: 2, itemAlign: "center", children: [
993
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast-36 oui-text-lg", children: t("tradingPoints.startsIn") }),
994
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, itemAlign: "center", justify: "center", children: [
995
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", gap: 1, itemAlign: "center", children: [
996
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast oui-text-4xl oui-font-bold oui-w-16 oui-text-center", children: formatNumber(timeLeft.days) }),
997
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast-80 oui-text-xs oui-w-16 oui-text-center", children: t("tradingPoints.days") })
998
+ ] }),
999
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { className: "oui-w-1 oui-h-1 oui-rounded-full oui-bg-base-4" }),
1000
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", gap: 1, itemAlign: "center", children: [
1001
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast oui-text-4xl oui-font-bold oui-w-16 oui-text-center", children: formatNumber(timeLeft.hours) }),
1002
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast-80 oui-text-xs oui-w-16 oui-text-center", children: t("tradingPoints.hours") })
1003
+ ] }),
1004
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { className: "oui-w-1 oui-h-1 oui-rounded-full oui-bg-base-4" }),
1005
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", gap: 1, itemAlign: "center", children: [
1006
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast oui-text-4xl oui-font-bold oui-w-16 oui-text-center", children: formatNumber(timeLeft.minutes) }),
1007
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast-80 oui-text-xs oui-w-16 oui-text-center", children: t("tradingPoints.minutes") })
1008
+ ] }),
1009
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { className: "oui-w-1 oui-h-1 oui-rounded-full oui-bg-base-4" }),
1010
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", gap: 1, itemAlign: "center", children: [
1011
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast oui-text-4xl oui-font-bold oui-w-16 oui-text-center", children: formatNumber(timeLeft.seconds) }),
1012
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast-80 oui-text-xs oui-w-16 oui-text-center", children: t("tradingPoints.seconds") })
1013
+ ] })
1014
+ ] })
1015
+ ] }) }),
1016
+ !isMobile && /* @__PURE__ */ jsxRuntime.jsx(
1017
+ ui.Box,
1018
+ {
1019
+ className: "oui-w-[200px] oui-h-[1px]",
1020
+ style: {
1021
+ background: `linear-gradient(270deg, rgba(176, 132, 233, 0.00) 0%, #DEC4FF 123.91%)`
1022
+ }
1023
+ }
1024
+ )
1025
+ ]
1026
+ }
1027
+ );
1028
+ };
1029
+ var FAQItem = ({ question, answer }) => {
1030
+ const { isMobile } = ui.useScreen();
1031
+ const [isOpen, setIsOpen] = react.useState(false);
1032
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1033
+ ui.Flex,
1034
+ {
1035
+ onClick: () => setIsOpen(!isOpen),
1036
+ direction: "column",
1037
+ className: "oui-w-full",
1038
+ itemAlign: "start",
1039
+ children: [
1040
+ /* @__PURE__ */ jsxRuntime.jsxs(
1041
+ ui.Flex,
1042
+ {
1043
+ gap: 4,
1044
+ className: "oui-w-full oui-cursor-pointer hover:oui-opacity-80 oui-transition-opacity",
1045
+ children: [
1046
+ /* @__PURE__ */ jsxRuntime.jsx(
1047
+ ui.Text,
1048
+ {
1049
+ className: ui.cn(
1050
+ "oui-flex-1 oui-text-base-contrast oui-font-semibold oui-tracking-[0.03em]",
1051
+ isMobile ? "oui-text-lg oui-leading-[26px]" : "oui-text-xl oui-leading-8"
1052
+ ),
1053
+ children: question
1054
+ }
1055
+ ),
1056
+ /* @__PURE__ */ jsxRuntime.jsx(
1057
+ ui.ChevronDownIcon,
1058
+ {
1059
+ size: 24,
1060
+ className: ui.cn(
1061
+ "oui-text-base-contrast oui-transition-transform oui-duration-300 oui-flex-shrink-0",
1062
+ isOpen && "oui-rotate-180"
1063
+ )
1064
+ }
1065
+ )
1066
+ ]
1067
+ }
1068
+ ),
1069
+ /* @__PURE__ */ jsxRuntime.jsx(
1070
+ ui.Box,
1071
+ {
1072
+ className: ui.cn(
1073
+ "oui-overflow-hidden oui-transition-all oui-duration-300",
1074
+ isOpen && "oui-mt-4"
1075
+ ),
1076
+ style: {
1077
+ maxHeight: isOpen ? "500px" : "0px",
1078
+ opacity: isOpen ? 1 : 0
1079
+ },
1080
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1081
+ ui.Text,
1082
+ {
1083
+ className: "oui-text-base-contrast-54 oui-text-sm oui-leading-relaxed",
1084
+ style: { whiteSpace: "pre-line" },
1085
+ children: answer
1086
+ }
1087
+ )
1088
+ }
1089
+ )
1090
+ ]
1091
+ }
1092
+ );
1093
+ };
1094
+ var FAQSection = ({ className }) => {
1095
+ const brokerName = hooks.useConfig("brokerName");
1096
+ const { isMobile } = ui.useScreen();
1097
+ const { t } = i18n.useTranslation();
1098
+ const faqData = [
1099
+ {
1100
+ question: t("tradingPoints.faq.whatArePoints.question"),
1101
+ answer: t("tradingPoints.faq.whatArePoints.answer", { brokerName })
1102
+ },
1103
+ {
1104
+ question: t("tradingPoints.faq.allocation.question"),
1105
+ answer: t("tradingPoints.faq.allocation.answer")
1106
+ },
1107
+ {
1108
+ question: t("tradingPoints.faq.distribution.question"),
1109
+ answer: t("tradingPoints.faq.distribution.answer")
1110
+ },
1111
+ {
1112
+ question: t("tradingPoints.faq.pnl.question"),
1113
+ answer: t("tradingPoints.faq.pnl.answer")
1114
+ },
1115
+ {
1116
+ question: t("tradingPoints.faq.referral.question"),
1117
+ answer: t("tradingPoints.faq.referral.answer")
1118
+ }
1119
+ ];
1120
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1121
+ ui.Flex,
1122
+ {
1123
+ direction: "column",
1124
+ gap: 6,
1125
+ className,
1126
+ itemAlign: "start",
1127
+ id: "points-faq",
1128
+ children: [
1129
+ /* @__PURE__ */ jsxRuntime.jsx(
1130
+ ui.Text,
1131
+ {
1132
+ className: ui.cn(
1133
+ "oui-text-base-contrast oui-font-normal oui-tracking-[0.03em]",
1134
+ isMobile ? "oui-text-2xl oui-leading-8" : "oui-text-3xl oui-leading-10"
1135
+ ),
1136
+ children: t("tradingPoints.faq.title")
1137
+ }
1138
+ ),
1139
+ /* @__PURE__ */ jsxRuntime.jsx(
1140
+ ui.Flex,
1141
+ {
1142
+ direction: "column",
1143
+ gap: 8,
1144
+ className: "oui-w-full",
1145
+ itemAlign: "start",
1146
+ children: faqData.map((faq, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-w-full", children: [
1147
+ /* @__PURE__ */ jsxRuntime.jsx(FAQItem, { question: faq.question, answer: faq.answer }),
1148
+ index < faqData.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { className: "oui-mt-8", intensity: 8 })
1149
+ ] }, index))
1150
+ }
1151
+ )
1152
+ ]
1153
+ }
1154
+ );
1155
+ };
1156
+ var Intro = () => {
1157
+ const { isMobile } = ui.useScreen();
1158
+ const {
1159
+ currentStage,
1160
+ stages,
1161
+ setCurrentStage,
1162
+ refLink,
1163
+ refCode,
1164
+ allTimePointsDisplay,
1165
+ isNoCampaign
1166
+ } = usePoints();
1167
+ const [isStageDropdownOpen, setIsStageDropdownOpen] = react.useState(false);
1168
+ const { t } = i18n.useTranslation();
1169
+ const onCopyCode = async () => {
1170
+ try {
1171
+ await navigator.clipboard.writeText(refCode);
1172
+ ui.toast.success(t("common.copy.copied"));
1173
+ } catch (error) {
1174
+ }
1175
+ };
1176
+ const onCopyLink = async () => {
1177
+ try {
1178
+ await navigator.clipboard.writeText(refLink);
1179
+ ui.toast.success(t("common.copy.copied"));
1180
+ } catch (error) {
1181
+ }
1182
+ };
1183
+ const handleLearnMore = () => {
1184
+ const faqElement = document.getElementById("points-faq");
1185
+ if (faqElement) {
1186
+ faqElement.scrollIntoView({ behavior: "smooth", block: "start" });
1187
+ }
1188
+ };
1189
+ const formatStageDate = (startTime, endTime) => {
1190
+ const formatDate = (timestamp) => {
1191
+ const date = new Date(timestamp * 1e3);
1192
+ const month = String(date.getUTCMonth() + 1).padStart(2, "0");
1193
+ const day = String(date.getUTCDate()).padStart(2, "0");
1194
+ const year = date.getUTCFullYear();
1195
+ return `${month}/${day}/${year}`;
1196
+ };
1197
+ const startDate = formatDate(startTime);
1198
+ const endDate = endTime ? formatDate(endTime) : "Recurring";
1199
+ return `${startDate} - ${endDate}`;
1200
+ };
1201
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", gap: 8, className: "oui-w-full", children: [
1202
+ isNoCampaign ? /* @__PURE__ */ jsxRuntime.jsxs(
1203
+ ui.Flex,
1204
+ {
1205
+ direction: "column",
1206
+ gap: 6,
1207
+ itemAlign: "start",
1208
+ className: "oui-w-full",
1209
+ children: [
1210
+ /* @__PURE__ */ jsxRuntime.jsx(
1211
+ ui.Flex,
1212
+ {
1213
+ direction: isMobile ? "column" : "row",
1214
+ gap: 4,
1215
+ itemAlign: isMobile ? "start" : "center",
1216
+ justify: "between",
1217
+ className: "oui-w-full",
1218
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1219
+ ui.Flex,
1220
+ {
1221
+ direction: isMobile ? "column" : "row",
1222
+ itemAlign: isMobile ? "start" : "center",
1223
+ className: isMobile ? "oui-w-full" : "",
1224
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1225
+ ui.Text,
1226
+ {
1227
+ className: ui.cn(
1228
+ "oui-text-base-contrast",
1229
+ isMobile ? "oui-text-xl" : "oui-text-4xl",
1230
+ "oui-font-600 oui-leading-tight oui-tracking-[0.03em]"
1231
+ ),
1232
+ children: t("tradingPoints.noActiveCampaigns")
1233
+ }
1234
+ )
1235
+ }
1236
+ )
1237
+ }
1238
+ ),
1239
+ /* @__PURE__ */ jsxRuntime.jsx(
1240
+ ui.Text,
1241
+ {
1242
+ className: ui.cn(
1243
+ "oui-text-[14px]",
1244
+ "oui-leading-[20px]",
1245
+ "oui-font-semibold",
1246
+ "oui-text-base-contrast-54"
1247
+ ),
1248
+ children: t("tradingPoints.noActiveCampaignsDescription")
1249
+ }
1250
+ )
1251
+ ]
1252
+ }
1253
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
1254
+ ui.Flex,
1255
+ {
1256
+ direction: "column",
1257
+ gap: 6,
1258
+ itemAlign: "start",
1259
+ className: "oui-w-full",
1260
+ children: [
1261
+ /* @__PURE__ */ jsxRuntime.jsxs(
1262
+ ui.Flex,
1263
+ {
1264
+ direction: isMobile ? "column" : "row",
1265
+ gap: 4,
1266
+ itemAlign: isMobile ? "start" : "center",
1267
+ justify: "between",
1268
+ className: "oui-w-full",
1269
+ children: [
1270
+ /* @__PURE__ */ jsxRuntime.jsxs(
1271
+ ui.Flex,
1272
+ {
1273
+ direction: isMobile ? "column" : "row",
1274
+ itemAlign: isMobile ? "start" : "center",
1275
+ className: isMobile ? "oui-w-full" : "",
1276
+ children: [
1277
+ /* @__PURE__ */ jsxRuntime.jsxs(
1278
+ ui.Text,
1279
+ {
1280
+ className: ui.cn(
1281
+ "oui-text-base-contrast",
1282
+ isMobile ? "oui-text-xl" : "oui-text-4xl",
1283
+ "oui-font-600 oui-leading-tight oui-tracking-[0.03em]"
1284
+ ),
1285
+ children: [
1286
+ t("tradingPoints.stage"),
1287
+ " ",
1288
+ currentStage?.epoch_period,
1289
+ " \xB7"
1290
+ ]
1291
+ }
1292
+ ),
1293
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 3, itemAlign: "center", children: [
1294
+ /* @__PURE__ */ jsxRuntime.jsx(
1295
+ ui.Text,
1296
+ {
1297
+ className: ui.cn(
1298
+ isMobile ? "oui-text-xl" : "oui-text-4xl",
1299
+ "oui-text-primary",
1300
+ "oui-text-center",
1301
+ "oui-pl-2"
1302
+ ),
1303
+ children: currentStage?.stage_name
1304
+ }
1305
+ ),
1306
+ /* @__PURE__ */ jsxRuntime.jsx(
1307
+ "img",
1308
+ {
1309
+ src: "https://oss.woo.org/static/images/sdk/pt-hot.png",
1310
+ alt: "Hot",
1311
+ className: isMobile ? "oui-h-8 oui-w-8" : "oui-h-[48px] oui-w-[48px]"
1312
+ }
1313
+ )
1314
+ ] })
1315
+ ]
1316
+ }
1317
+ ),
1318
+ /* @__PURE__ */ jsxRuntime.jsxs(
1319
+ ui.DropdownMenuRoot,
1320
+ {
1321
+ open: isStageDropdownOpen,
1322
+ onOpenChange: setIsStageDropdownOpen,
1323
+ children: [
1324
+ /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
1325
+ ui.Flex,
1326
+ {
1327
+ gap: 2,
1328
+ itemAlign: "center",
1329
+ px: 3,
1330
+ py: 2,
1331
+ className: "oui-w-[230px] oui-bg-base-contrast-6 oui-border oui-border-line-12 oui-rounded-md hover:oui-cursor-pointer hover:oui-opacity-80 oui-transition-opacity",
1332
+ children: [
1333
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-flex-1 oui-text-[11px] oui-tracking-[0.03em] oui-whitespace-nowrap oui-text-base-contrast-36", children: currentStage ? `Stage ${currentStage.epoch_period}: ${formatStageDate(
1334
+ currentStage.start_time,
1335
+ currentStage.end_time
1336
+ )}` : "" }),
1337
+ /* @__PURE__ */ jsxRuntime.jsx(
1338
+ ui.ChevronDownIcon,
1339
+ {
1340
+ size: 12,
1341
+ className: ui.cn(
1342
+ "oui-text-base-contrast-36",
1343
+ "oui-transition-transform",
1344
+ isStageDropdownOpen && "oui-rotate-180"
1345
+ )
1346
+ }
1347
+ )
1348
+ ]
1349
+ }
1350
+ ) }),
1351
+ /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenuPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
1352
+ ui.DropdownMenuContent,
1353
+ {
1354
+ onCloseAutoFocus: (e) => e.preventDefault(),
1355
+ onClick: (e) => e.stopPropagation(),
1356
+ sideOffset: 4,
1357
+ collisionPadding: { right: 16 },
1358
+ className: ui.cn(
1359
+ "oui-bg-base-8 oui-w-[230px] oui-p-1 oui-rounded-lg",
1360
+ "oui-border oui-border-line-6",
1361
+ "oui-font-semibold",
1362
+ "oui-shadow-[0px_3px_6px_0px_rgba(0,0,0,0.2)]"
1363
+ ),
1364
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1365
+ ui.Flex,
1366
+ {
1367
+ direction: "column",
1368
+ itemAlign: "start",
1369
+ gap: 0,
1370
+ className: "oui-w-full",
1371
+ children: stages?.rows?.map((stage) => {
1372
+ const isSelected = currentStage?.stage_id === stage.stage_id;
1373
+ stage.status !== "active";
1374
+ const isActive = stage.status === "active";
1375
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1376
+ ui.Flex,
1377
+ {
1378
+ gap: 2,
1379
+ itemAlign: "center",
1380
+ px: 2,
1381
+ py: 2,
1382
+ r: "sm",
1383
+ onClick: () => {
1384
+ setCurrentStage(stage);
1385
+ setIsStageDropdownOpen(false);
1386
+ },
1387
+ className: ui.cn(
1388
+ "oui-rounded oui-relative oui-w-full",
1389
+ "hover:oui-cursor-pointer hover:oui-opacity-80",
1390
+ isSelected ? "oui-bg-base-5" : "hover:oui-bg-base-5/50"
1391
+ ),
1392
+ children: [
1393
+ /* @__PURE__ */ jsxRuntime.jsx(
1394
+ ui.Text,
1395
+ {
1396
+ className: ui.cn(
1397
+ "oui-text-[11px] oui-tracking-[0.03em] oui-whitespace-nowrap",
1398
+ isSelected ? "oui-text-base-contrast-54 oui-font-semibold" : "oui-text-base-contrast-36"
1399
+ ),
1400
+ children: `Stage ${stage.epoch_period}: ${formatStageDate(
1401
+ stage.start_time,
1402
+ stage.end_time
1403
+ )}`
1404
+ }
1405
+ ),
1406
+ isActive && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { className: "oui-w-1 oui-h-1 oui-rounded-full oui-bg-primary oui-flex-shrink-0" })
1407
+ ]
1408
+ },
1409
+ stage.stage_id
1410
+ );
1411
+ })
1412
+ }
1413
+ )
1414
+ }
1415
+ ) })
1416
+ ]
1417
+ }
1418
+ )
1419
+ ]
1420
+ }
1421
+ ),
1422
+ /* @__PURE__ */ jsxRuntime.jsxs(
1423
+ ui.Text,
1424
+ {
1425
+ className: ui.cn(
1426
+ "oui-text-[14px]",
1427
+ "oui-leading-[20px]",
1428
+ "oui-font-semibold",
1429
+ "oui-text-base-contrast-54"
1430
+ ),
1431
+ children: [
1432
+ currentStage?.stage_description,
1433
+ /* @__PURE__ */ jsxRuntime.jsxs(
1434
+ "span",
1435
+ {
1436
+ className: "oui-text-primary hover:oui-underline oui-cursor-pointer",
1437
+ onClick: handleLearnMore,
1438
+ children: [
1439
+ " ",
1440
+ t("tradingPoints.learnMore")
1441
+ ]
1442
+ }
1443
+ )
1444
+ ]
1445
+ }
1446
+ )
1447
+ ]
1448
+ }
1449
+ ),
1450
+ /* @__PURE__ */ jsxRuntime.jsxs(
1451
+ ui.Flex,
1452
+ {
1453
+ direction: isMobile ? "column" : "row",
1454
+ gap: 6,
1455
+ className: "oui-w-full",
1456
+ children: [
1457
+ /* @__PURE__ */ jsxRuntime.jsxs(
1458
+ ui.Flex,
1459
+ {
1460
+ direction: isMobile ? "column" : "row",
1461
+ gap: 6,
1462
+ itemAlign: isMobile ? "stretch" : "center",
1463
+ p: 5,
1464
+ r: "2xl",
1465
+ style: { height: isMobile ? "" : 104 },
1466
+ className: ui.cn(
1467
+ "oui-border oui-border-line",
1468
+ !isMobile && "oui-gap-12",
1469
+ isMobile ? "oui-w-full" : "oui-flex-1"
1470
+ ),
1471
+ children: [
1472
+ /* @__PURE__ */ jsxRuntime.jsxs(
1473
+ ui.Flex,
1474
+ {
1475
+ direction: "column",
1476
+ gap: 2,
1477
+ className: "oui-flex-1",
1478
+ itemAlign: "start",
1479
+ children: [
1480
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast-54 oui-text-sm oui-tracking-[0.03em]", children: t("tradingPoints.stagePoints") }),
1481
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast oui-text-[28px] oui-tracking-[0.03em] oui-leading-9", children: allTimePointsDisplay.currentPointsDisplay })
1482
+ ]
1483
+ }
1484
+ ),
1485
+ !isMobile && /* @__PURE__ */ jsxRuntime.jsx(
1486
+ ui.Box,
1487
+ {
1488
+ className: ui.cn(
1489
+ "oui-w-[1px]",
1490
+ "oui-h-full",
1491
+ "oui-bg-base-contrast-10"
1492
+ )
1493
+ }
1494
+ ),
1495
+ isMobile && /* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { intensity: 8 }),
1496
+ /* @__PURE__ */ jsxRuntime.jsxs(
1497
+ ui.Flex,
1498
+ {
1499
+ direction: "column",
1500
+ gap: 2,
1501
+ className: "oui-flex-1",
1502
+ itemAlign: "start",
1503
+ children: [
1504
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast-54 oui-text-sm oui-tracking-[0.03em]", children: t("tradingPoints.stageRanking") }),
1505
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast oui-text-[28px] oui-tracking-[0.03em] oui-leading-9", children: allTimePointsDisplay.rankingDisplay })
1506
+ ]
1507
+ }
1508
+ )
1509
+ ]
1510
+ }
1511
+ ),
1512
+ /* @__PURE__ */ jsxRuntime.jsx(
1513
+ ui.Flex,
1514
+ {
1515
+ p: 5,
1516
+ r: "2xl",
1517
+ style: { height: 104 },
1518
+ className: ui.cn(
1519
+ "oui-border oui-border-line",
1520
+ isMobile ? "oui-w-full" : "oui-flex-1",
1521
+ "oui-h-[128px]"
1522
+ ),
1523
+ children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", gap: 4, className: "oui-w-full", children: [
1524
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, itemAlign: "center", className: "oui-w-full", children: [
1525
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast-54 oui-text-sm oui-tracking-[0.03em]", children: t("tradingPoints.referralCode") }),
1526
+ /* @__PURE__ */ jsxRuntime.jsxs(
1527
+ ui.Flex,
1528
+ {
1529
+ gap: 2,
1530
+ itemAlign: "center",
1531
+ justify: "end",
1532
+ className: "oui-flex-1",
1533
+ children: [
1534
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast oui-text-sm oui-tracking-[0.03em]", children: refCode }),
1535
+ /* @__PURE__ */ jsxRuntime.jsx(
1536
+ ui.CopyIcon,
1537
+ {
1538
+ size: 16,
1539
+ className: "oui-text-base-contrast hover:oui-cursor-pointer hover:oui-opacity-80 oui-transition-opacity",
1540
+ onClick: onCopyCode
1541
+ }
1542
+ )
1543
+ ]
1544
+ }
1545
+ )
1546
+ ] }),
1547
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, itemAlign: "start", className: "oui-w-full", children: [
1548
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast-54 oui-text-sm oui-tracking-[0.03em] oui-flex-shrink-0", children: t("tradingPoints.referralLink") }),
1549
+ /* @__PURE__ */ jsxRuntime.jsxs(
1550
+ ui.Flex,
1551
+ {
1552
+ gap: 2,
1553
+ itemAlign: "start",
1554
+ className: "oui-flex-1 oui-min-w-0",
1555
+ children: [
1556
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast oui-text-sm oui-tracking-[0.03em] oui-flex-1 oui-truncate oui-text-right", children: refLink }),
1557
+ /* @__PURE__ */ jsxRuntime.jsx(
1558
+ ui.CopyIcon,
1559
+ {
1560
+ size: 16,
1561
+ className: "oui-text-base-contrast hover:oui-cursor-pointer hover:oui-opacity-80 oui-transition-opacity",
1562
+ onClick: onCopyLink
1563
+ }
1564
+ )
1565
+ ]
1566
+ }
1567
+ )
1568
+ ] })
1569
+ ] })
1570
+ }
1571
+ )
1572
+ ]
1573
+ }
1574
+ )
1575
+ ] });
1576
+ };
1577
+ var User = ({ onRouteChange }) => {
1578
+ const { t } = i18n.useTranslation();
1579
+ const { isMobile } = ui.useScreen();
1580
+ const {
1581
+ refLink,
1582
+ selectedTimeRange,
1583
+ setSelectedTimeRange,
1584
+ pointsDisplay,
1585
+ userStatistics,
1586
+ isCurrentStageCompleted
1587
+ } = usePoints();
1588
+ const timeRangeOptions = [
1589
+ { value: "this_week", label: t("tradingPoints.thisWeek") },
1590
+ { value: "last_week", label: t("tradingPoints.lastWeek") },
1591
+ { value: "all_time", label: t("tradingPoints.all") }
1592
+ ];
1593
+ if (isCurrentStageCompleted) {
1594
+ if (selectedTimeRange !== "all_time") {
1595
+ setSelectedTimeRange("all_time");
1596
+ }
1597
+ timeRangeOptions.splice(0, 2);
1598
+ }
1599
+ const timeRangeButtonClass = ui.cn(
1600
+ "oui-inline-flex oui-items-center oui-justify-center oui-whitespace-nowrap",
1601
+ "oui-box-content oui-rounded oui-px-3 oui-h-7",
1602
+ "oui-font-medium oui-text-2xs oui-text-base-contrast-36",
1603
+ "hover:oui-text-base-contrast-54 hover:oui-bg-base-5",
1604
+ "oui-bg-base-7",
1605
+ "data-[state=active]:oui-bg-base-5 data-[state=active]:oui-text-base-contrast",
1606
+ "oui-transition-all focus-visible:oui-outline-none",
1607
+ "focus-visible:oui-ring-2 focus-visible:oui-ring-ring focus-visible:oui-ring-offset-2",
1608
+ "disabled:oui-pointer-events-none disabled:oui-opacity-50"
1609
+ );
1610
+ const currentPointsDisplay = pointsDisplay.currentPointsDisplay;
1611
+ const rankingDisplay = pointsDisplay.rankingDisplay;
1612
+ const tradingPointsDisplay = pointsDisplay.tradingPointsDisplay;
1613
+ const pnlPointsDisplay = pointsDisplay.pnlPointsDisplay;
1614
+ const referralPointsDisplay = pointsDisplay.referralPointsDisplay;
1615
+ const formatReferralBoost = (value) => {
1616
+ return value !== null && value !== void 0 ? value : "--";
1617
+ };
1618
+ const goToPerp = react.useCallback(() => {
1619
+ onRouteChange({
1620
+ href: "/perp",
1621
+ name: "Perp"
1622
+ });
1623
+ }, [onRouteChange]);
1624
+ const onCopy = async () => {
1625
+ try {
1626
+ await navigator.clipboard.writeText(refLink);
1627
+ ui.toast.success(t("common.copy.copied"));
1628
+ } catch (error) {
1629
+ }
1630
+ };
1631
+ const userStats = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
1632
+ ui.Flex,
1633
+ {
1634
+ direction: isMobile ? "column" : "row",
1635
+ gap: 4,
1636
+ itemAlign: "stretch",
1637
+ className: "oui-w-full",
1638
+ children: [
1639
+ /* @__PURE__ */ jsxRuntime.jsxs(
1640
+ ui.Flex,
1641
+ {
1642
+ direction: "column",
1643
+ gap: 2,
1644
+ className: isMobile ? "oui-w-full" : "oui-w-[200px]",
1645
+ children: [
1646
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", gap: 3, p: 4, r: "2xl", children: [
1647
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast-54 oui-text-sm oui-tracking-[0.03em] oui-decoration-dotted oui-text-center oui-w-full", children: t("tradingPoints.currentPoints") }),
1648
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-transparent oui-bg-clip-text oui-gradient-brand oui-text-3xl oui-tracking-[0.03em] oui-text-center oui-w-full oui-h-10 oui-leading-10", children: currentPointsDisplay })
1649
+ ] }),
1650
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { className: "oui-w-full", intensity: 8 }),
1651
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", gap: 3, p: 4, r: "2xl", children: [
1652
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast-54 oui-text-sm oui-tracking-[0.03em] oui-text-center oui-w-full", children: t("tradingPoints.ranking") }),
1653
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-transparent oui-bg-clip-text oui-gradient-brand oui-text-3xl oui-tracking-[0.03em] oui-text-center oui-w-full oui-h-10 oui-leading-10", children: rankingDisplay })
1654
+ ] })
1655
+ ]
1656
+ }
1657
+ ),
1658
+ !isMobile && /* @__PURE__ */ jsxRuntime.jsx(
1659
+ ui.Divider,
1660
+ {
1661
+ className: "oui-self-stretch",
1662
+ intensity: 8,
1663
+ direction: "vertical"
1664
+ }
1665
+ ),
1666
+ isMobile && /* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { intensity: 8 }),
1667
+ /* @__PURE__ */ jsxRuntime.jsx(
1668
+ ui.Flex,
1669
+ {
1670
+ direction: "column",
1671
+ className: isMobile ? "oui-w-full" : "oui-flex-1",
1672
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
1673
+ ui.Flex,
1674
+ {
1675
+ direction: isMobile ? "column" : "row",
1676
+ gap: 6,
1677
+ className: "oui-w-full oui-h-full",
1678
+ children: [
1679
+ /* @__PURE__ */ jsxRuntime.jsxs(
1680
+ ui.Flex,
1681
+ {
1682
+ direction: "column",
1683
+ gap: 3,
1684
+ itemAlign: "center",
1685
+ justify: "center",
1686
+ p: 4,
1687
+ r: "xl",
1688
+ intensity: 800,
1689
+ className: ui.cn(
1690
+ "oui-backdrop-blur-sm",
1691
+ isMobile ? "oui-w-full" : "oui-flex-1 oui-h-full"
1692
+ ),
1693
+ children: [
1694
+ /* @__PURE__ */ jsxRuntime.jsx(
1695
+ ui.Tooltip,
1696
+ {
1697
+ content: t("tradingPoints.tradePointsTooltip"),
1698
+ className: "oui-max-w-[300px] oui-bg-primary-darken",
1699
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1700
+ ui.Text,
1701
+ {
1702
+ className: "oui-text-base-contrast-54 oui-text-sm oui-tracking-[0.03em] oui-text-center oui-w-full\n ",
1703
+ style: {
1704
+ textDecorationLine: "underline",
1705
+ textDecorationStyle: "dotted",
1706
+ textUnderlineOffset: "30%"
1707
+ },
1708
+ children: t("tradingPoints.tradePoints")
1709
+ }
1710
+ )
1711
+ }
1712
+ ),
1713
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast oui-text-[28px] oui-tracking-[0.03em] oui-text-center oui-w-full oui-leading-9", children: tradingPointsDisplay }),
1714
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "md", onClick: goToPerp, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: t("tradingPoints.tradeNow") }) })
1715
+ ]
1716
+ }
1717
+ ),
1718
+ /* @__PURE__ */ jsxRuntime.jsxs(
1719
+ ui.Flex,
1720
+ {
1721
+ direction: "column",
1722
+ gap: 3,
1723
+ itemAlign: "center",
1724
+ justify: "center",
1725
+ p: 4,
1726
+ r: "xl",
1727
+ intensity: 800,
1728
+ className: ui.cn(
1729
+ "oui-backdrop-blur-sm",
1730
+ isMobile ? "oui-w-full" : "oui-flex-1 oui-h-full"
1731
+ ),
1732
+ children: [
1733
+ /* @__PURE__ */ jsxRuntime.jsx(
1734
+ ui.Tooltip,
1735
+ {
1736
+ content: t("tradingPoints.pnlPointsTooltip"),
1737
+ className: "oui-max-w-[300px] oui-bg-primary-darken",
1738
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1739
+ ui.Text,
1740
+ {
1741
+ className: "oui-text-base-contrast-54 oui-text-sm oui-tracking-[0.03em] oui-text-center oui-w-full",
1742
+ style: {
1743
+ textDecorationLine: "underline",
1744
+ textDecorationStyle: "dotted",
1745
+ textUnderlineOffset: "30%"
1746
+ },
1747
+ children: t("tradingPoints.pnlPoints")
1748
+ }
1749
+ )
1750
+ }
1751
+ ),
1752
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast oui-text-[28px] oui-tracking-[0.03em] oui-text-center oui-w-full oui-leading-9", children: pnlPointsDisplay }),
1753
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "md", onClick: goToPerp, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: t("tradingPoints.tradeNow") }) })
1754
+ ]
1755
+ }
1756
+ ),
1757
+ /* @__PURE__ */ jsxRuntime.jsxs(
1758
+ ui.Flex,
1759
+ {
1760
+ direction: "column",
1761
+ gap: 3,
1762
+ itemAlign: "center",
1763
+ justify: "center",
1764
+ p: 4,
1765
+ r: "xl",
1766
+ intensity: 800,
1767
+ className: ui.cn(
1768
+ "oui-backdrop-blur-sm",
1769
+ isMobile ? "oui-w-full" : "oui-flex-1 oui-h-full"
1770
+ ),
1771
+ children: [
1772
+ /* @__PURE__ */ jsxRuntime.jsx(
1773
+ ui.Tooltip,
1774
+ {
1775
+ content: t("tradingPoints.referralPointsTooltip", {
1776
+ l1: formatReferralBoost(userStatistics?.l1_referral_boost),
1777
+ l2: formatReferralBoost(userStatistics?.l2_referral_boost)
1778
+ }),
1779
+ className: "oui-max-w-[300px] oui-bg-primary-darken",
1780
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1781
+ ui.Text,
1782
+ {
1783
+ className: "oui-text-base-contrast-54 oui-text-sm oui-tracking-[0.03em] oui-text-center oui-w-full",
1784
+ style: {
1785
+ textDecorationLine: "underline",
1786
+ textDecorationStyle: "dotted",
1787
+ textUnderlineOffset: "30%"
1788
+ },
1789
+ children: t("tradingPoints.referralPoints")
1790
+ }
1791
+ )
1792
+ }
1793
+ ),
1794
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast oui-text-[28px] oui-tracking-[0.03em] oui-text-center oui-w-full oui-leading-9", children: referralPointsDisplay }),
1795
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "outlined", size: "md", onClick: onCopy, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast-54", children: t("tradingPoints.copyLink") }) })
1796
+ ]
1797
+ }
1798
+ )
1799
+ ]
1800
+ }
1801
+ )
1802
+ }
1803
+ )
1804
+ ]
1805
+ }
1806
+ ) });
1807
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", gap: 6, className: "oui-w-full", children: [
1808
+ /* @__PURE__ */ jsxRuntime.jsxs(
1809
+ ui.Flex,
1810
+ {
1811
+ direction: isMobile ? "column" : "row",
1812
+ gap: isMobile ? 4 : 0,
1813
+ itemAlign: isMobile ? "start" : "center",
1814
+ justify: "between",
1815
+ className: "oui-w-full",
1816
+ children: [
1817
+ /* @__PURE__ */ jsxRuntime.jsx(
1818
+ ui.Text,
1819
+ {
1820
+ className: ui.cn(
1821
+ "oui-text-base-contrast",
1822
+ isMobile ? "oui-text-2xl" : "oui-text-3xl",
1823
+ "oui-tracking-[0.03em]"
1824
+ ),
1825
+ children: t("tradingPoints.myPoints")
1826
+ }
1827
+ ),
1828
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { gap: 2, itemAlign: "center", children: timeRangeOptions.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
1829
+ "button",
1830
+ {
1831
+ onClick: () => setSelectedTimeRange(option.value),
1832
+ "data-state": selectedTimeRange === option.value ? "active" : "inactive",
1833
+ className: timeRangeButtonClass,
1834
+ children: option.label
1835
+ },
1836
+ option.value
1837
+ )) })
1838
+ ]
1839
+ }
1840
+ ),
1841
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { p: 6, r: "2xl", className: "oui-border oui-border-line oui-w-full", children: userStats })
1842
+ ] });
1843
+ };
1844
+ var Main = ({ onRouteChange }) => {
1845
+ const { isMobile } = ui.useScreen();
1846
+ const { isNoCampaign, isCurrentStagePending } = usePoints();
1847
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1848
+ ui.Flex,
1849
+ {
1850
+ direction: "column",
1851
+ gap: isMobile ? 6 : 10,
1852
+ className: ui.cn(
1853
+ "oui-w-full",
1854
+ isMobile ? "oui-px-5 oui-py-6" : "oui-max-w-[1200px] oui-mx-auto oui-py-[64px] oui-py-12"
1855
+ ),
1856
+ children: [
1857
+ /* @__PURE__ */ jsxRuntime.jsx(Countdown, {}),
1858
+ /* @__PURE__ */ jsxRuntime.jsx(Intro, {}),
1859
+ !isNoCampaign && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1860
+ /* @__PURE__ */ jsxRuntime.jsx(User, { onRouteChange }),
1861
+ !isCurrentStagePending && /* @__PURE__ */ jsxRuntime.jsx(GeneralLeaderboardWidget, {})
1862
+ ] }),
1863
+ /* @__PURE__ */ jsxRuntime.jsx(FAQSection, { className: "oui-w-full" })
1864
+ ]
1865
+ }
1866
+ );
1867
+ };
1868
+ var main_default = Main;
1869
+
1870
+ // src/i18n/module.ts
1871
+ var LocaleMessages = {
1872
+ "tradingPoints.points": "Points",
1873
+ "tradingPoints.stage": "Stage",
1874
+ "tradingPoints.startsIn": "Starts in",
1875
+ "tradingPoints.days": "Days",
1876
+ "tradingPoints.hours": "Hours",
1877
+ "tradingPoints.minutes": "Minutes",
1878
+ "tradingPoints.seconds": "Seconds",
1879
+ "tradingPoints.learnMore": "Learn more",
1880
+ "tradingPoints.stagePoints": "Stage points",
1881
+ "tradingPoints.stageRanking": "Stage ranking",
1882
+ "tradingPoints.referralCode": "Referral code",
1883
+ "tradingPoints.referralLink": "Referral link",
1884
+ "tradingPoints.currentPoints": "Current points",
1885
+ "tradingPoints.ranking": "Ranking",
1886
+ "tradingPoints.myPoints": "My points",
1887
+ "tradingPoints.thisWeek": "This week",
1888
+ "tradingPoints.lastWeek": "Last week",
1889
+ "tradingPoints.all": "All",
1890
+ "tradingPoints.tradePoints": "Trade points",
1891
+ "tradingPoints.tradePointsTooltip": "Trade Points are calculated based on your perps trading volume.Updated daily.",
1892
+ "tradingPoints.tradeNow": "Trade now",
1893
+ "tradingPoints.pnlPoints": "PNL points",
1894
+ "tradingPoints.pnlPointsTooltip": "Both profit or loss of each trade will be recorded. Updated daily.",
1895
+ "tradingPoints.referralPoints": "Referral points",
1896
+ "tradingPoints.referralPointsTooltip": "First-level invitee's rebates: {{l1}}%, Second-level invitee's rebates: {{l2}}%, Update daily.",
1897
+ "tradingPoints.copyLink": "Copy Link",
1898
+ "tradingPoints.faq.title": "FAQ",
1899
+ "tradingPoints.faq.whatArePoints.question": "What are Points?",
1900
+ "tradingPoints.faq.whatArePoints.answer": "The Points program is designed to encourage genuine user engagement with products and to reward loyal users who actively contribute to the growth of the {{brokerName}} ecosystem. Rewards will be airdropped in the future based on users' point accumulation.",
1901
+ "tradingPoints.faq.allocation.question": "What is the points allocation criteria?",
1902
+ "tradingPoints.faq.allocation.answer": "Points = Trade points + PNL points + Referral points.\n\nThe page will update your points daily, calculating the points you are expected to receive based on your contribution.\n\nNote: Wash trading (e.g., self-trades) will not receive any points",
1903
+ "tradingPoints.faq.distribution.question": "When will points be distributed?",
1904
+ "tradingPoints.faq.distribution.answer": "Points are distributed at 08:00 UTC everyday.",
1905
+ "tradingPoints.faq.pnl.question": "How are PNL points calculated?",
1906
+ "tradingPoints.faq.pnl.answer": "Points are based on your net profit or loss each trading.",
1907
+ "tradingPoints.faq.referral.question": "How does the referral work?",
1908
+ "tradingPoints.faq.referral.answer": "Based on the total points of your invitees and their invitees. Points earned from first-level invitees are higher than those from second-level invitees. Updated daily.",
1909
+ "tradingPoints.noActiveCampaigns": "No Active Campaigns",
1910
+ "tradingPoints.noActiveCampaignsDescription": "There are currently no active point events. Please wait for the next update."
1911
+ };
1912
+
1913
+ // import("./locales/**/*.json") in src/i18n/provider.tsx
1914
+ var globImport_locales_json = chunkQKQ47GQZ_js.__glob({
1915
+ "./locales/de.json": () => import('./de-M4RLZ65B.js'),
1916
+ "./locales/en.json": () => import('./en-V7OJRAEG.js'),
1917
+ "./locales/es.json": () => import('./es-GC6OLMOU.js'),
1918
+ "./locales/fr.json": () => import('./fr-XMT3HUWZ.js'),
1919
+ "./locales/id.json": () => import('./id-RMBTTLNO.js'),
1920
+ "./locales/it.json": () => import('./it-5HUE25IQ.js'),
1921
+ "./locales/ja.json": () => import('./ja-X3VXUMBA.js'),
1922
+ "./locales/ko.json": () => import('./ko-KG32EYC7.js'),
1923
+ "./locales/nl.json": () => import('./nl-CQ5PEOAO.js'),
1924
+ "./locales/pl.json": () => import('./pl-M7ZCG667.js'),
1925
+ "./locales/pt.json": () => import('./pt-RXSAJZP6.js'),
1926
+ "./locales/ru.json": () => import('./ru-5LNO3PAB.js'),
1927
+ "./locales/tc.json": () => import('./tc-AWNFS2UX.js'),
1928
+ "./locales/tr.json": () => import('./tr-PKGFWNLE.js'),
1929
+ "./locales/uk.json": () => import('./uk-QA44TYO4.js'),
1930
+ "./locales/vi.json": () => import('./vi-EK2GO4RO.js'),
1931
+ "./locales/zh.json": () => import('./zh-SXH3BWY7.js')
1932
+ });
1933
+
1934
+ // src/i18n/provider.tsx
1935
+ var resources = async (lang) => {
1936
+ if (lang === i18n.LocaleEnum.en) {
1937
+ return LocaleMessages;
1938
+ }
1939
+ return globImport_locales_json(`./locales/${lang}.json`).then((res) => res.default);
1940
+ };
1941
+ var LocaleProvider = (props) => {
1942
+ return /* @__PURE__ */ jsxRuntime.jsx(i18n.ExternalLocaleProvider, { resources, children: props.children });
1943
+ };
1944
+ var PointSystemPage = (props) => {
1945
+ return /* @__PURE__ */ jsxRuntime.jsx(LocaleProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(PointsProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(main_default, { onRouteChange: props.onRouteChange }) }) });
1946
+ };
1947
+
1948
+ exports.PointSystemPage = PointSystemPage;
1949
+ //# sourceMappingURL=index.js.map
1950
+ //# sourceMappingURL=index.js.map