pixivflow 2.33.0 → 2.35.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 (59) hide show
  1. package/dist/package.json +1 -1
  2. package/dist/version.js +1 -1
  3. package/dist/webui/package.json +1 -1
  4. package/dist/webui/routes/handlers/scheduler-handlers.d.ts +8 -0
  5. package/dist/webui/routes/handlers/scheduler-handlers.js +64 -0
  6. package/dist/webui/routes/scheduler.d.ts +3 -0
  7. package/dist/webui/routes/scheduler.js +8 -0
  8. package/dist/webui/server/server-routes.js +3 -0
  9. package/dist/webui/utils/error-codes.d.ts +1 -0
  10. package/dist/webui/utils/error-codes.js +2 -0
  11. package/package.json +1 -1
  12. package/webui-frontend/dist/assets/{CheckCircleOutlined-H3DnUyMO.js → CheckCircleOutlined-BS_TxY3k.js} +2 -2
  13. package/webui-frontend/dist/assets/{ClearOutlined-BpODq7I7.js → ClearOutlined-uIvWLBII.js} +2 -2
  14. package/webui-frontend/dist/assets/{CloseCircleOutlined-BFfS5iXd.js → CloseCircleOutlined-B45wvGw1.js} +2 -2
  15. package/webui-frontend/dist/assets/{Config-DRElCeDC.js → Config-UjgCA3Jq.js} +3 -3
  16. package/webui-frontend/dist/assets/Dashboard-hIW1nAN9.js +2 -0
  17. package/webui-frontend/dist/assets/{DeleteOutlined-BFmW1oWe.js → DeleteOutlined-ByQuZQbZ.js} +2 -2
  18. package/webui-frontend/dist/assets/Download-DdswOGH7.js +2 -0
  19. package/webui-frontend/dist/assets/{Files-nNoRY5tl.js → Files-DCMyqujj.js} +3 -3
  20. package/webui-frontend/dist/assets/{PictureOutlined-U51jGr2U.js → PictureOutlined-CSEKKDH9.js} +2 -2
  21. package/webui-frontend/dist/assets/{SortDescendingOutlined-CckVuL_b.js → SortDescendingOutlined-BS5Vnvjg.js} +2 -2
  22. package/webui-frontend/dist/assets/{useErrorHandler-BOvHue1w.js → Table-CvqrzZX2.js} +31 -31
  23. package/webui-frontend/dist/assets/ThunderboltOutlined-DhgtXoNM.js +2 -0
  24. package/webui-frontend/dist/assets/UrlDownload-BHF2qmgI.js +3 -0
  25. package/webui-frontend/dist/assets/{dateUtils-gQt2uAjS.js → dateUtils-CEt5gAeU.js} +2 -2
  26. package/webui-frontend/dist/assets/errorCodeTranslator-Xn_Z9qOh.js +2 -0
  27. package/webui-frontend/dist/assets/{index-CJln3zA7.js → index-6mtxs9yc.js} +3 -3
  28. package/webui-frontend/dist/assets/index-B4zZ11c-.js +20 -0
  29. package/webui-frontend/dist/assets/{index-CfHs6AUn.js → index-BlXTpFS3.js} +2 -2
  30. package/webui-frontend/dist/assets/index-BvgYmQcZ.js +2 -0
  31. package/webui-frontend/dist/assets/{index-B7yYDv10.js → index-C66Xw4Fs.js} +2 -2
  32. package/webui-frontend/dist/assets/index-Cg2Wi2pt.js +3 -0
  33. package/webui-frontend/dist/assets/{index-B2ns27ii.js → index-D4mbR-Vx.js} +2 -2
  34. package/webui-frontend/dist/assets/index-DV4iHo-9.js +19 -0
  35. package/webui-frontend/dist/assets/index-D_qUS2GR.js +2 -0
  36. package/webui-frontend/dist/assets/{index-DPigBPWX.js → index-DiwSYMD5.js} +2 -2
  37. package/webui-frontend/dist/assets/index-DpfbKoAX.js +2 -0
  38. package/webui-frontend/dist/assets/{index-DG6kGbYq.js → index-HJggy9SZ.js} +37 -37
  39. package/webui-frontend/dist/assets/{index-CDrp3NIf.js → index-NSEOZ6G5.js} +3 -3
  40. package/webui-frontend/dist/assets/index-ZRYuscJf.js +2 -0
  41. package/webui-frontend/dist/assets/index-eiyXJZci.js +22 -0
  42. package/webui-frontend/dist/assets/{index-_EG4kaKN.js → index-mHLzQpzS.js} +2 -2
  43. package/webui-frontend/dist/assets/row-CQQO4x82.js +2 -0
  44. package/webui-frontend/dist/assets/{useAuth-wCjAOx6S.js → useAuth-4erTEEjT.js} +4 -4
  45. package/webui-frontend/dist/assets/{useConfig-Ds7RpIL1.js → useConfig-BmhXnAiM.js} +2 -2
  46. package/webui-frontend/dist/assets/{useDownload-BlxvZNEm.js → useDownload-DhuPPKqw.js} +2 -2
  47. package/webui-frontend/dist/assets/useErrorHandler-Bcb3l7ju.js +2 -0
  48. package/webui-frontend/dist/index.html +1 -1
  49. package/webui-frontend/dist/assets/Dashboard-aqPMquSO.js +0 -2
  50. package/webui-frontend/dist/assets/Download-DCKDU51K.js +0 -2
  51. package/webui-frontend/dist/assets/ThunderboltOutlined-ulcCd7ui.js +0 -2
  52. package/webui-frontend/dist/assets/UrlDownload-Bzs0AZN0.js +0 -3
  53. package/webui-frontend/dist/assets/errorCodeTranslator-BqIackMm.js +0 -3
  54. package/webui-frontend/dist/assets/index-Bbsa44oT.js +0 -2
  55. package/webui-frontend/dist/assets/index-C2ANILg9.js +0 -19
  56. package/webui-frontend/dist/assets/index-CFtP5lqo.js +0 -22
  57. package/webui-frontend/dist/assets/index-CZhfhXvc.js +0 -2
  58. package/webui-frontend/dist/assets/index-DarObP-C.js +0 -2
  59. package/webui-frontend/dist/assets/row-_c51T55h.js +0 -20
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "type": "commonjs",
3
3
  "name": "pixivflow",
4
- "version": "2.33.0",
4
+ "version": "2.35.0",
5
5
  "private": true
6
6
  }
package/dist/version.js CHANGED
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BUILD = void 0;
4
4
  // GENERATED by scripts/write-version.js — do not edit manually.
5
- exports.BUILD = { version: '2.33.0', commit: 'ceb9c345fa1b' };
5
+ exports.BUILD = { version: '2.35.0', commit: '209644ebd185' };
6
6
  //# sourceMappingURL=version.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "type": "commonjs",
3
3
  "name": "pixivflow-webui-backend",
4
- "version": "2.33.0",
4
+ "version": "2.35.0",
5
5
  "description": "PixivFlow WebUI Backend - CommonJS module"
6
6
  }
@@ -0,0 +1,8 @@
1
+ import { Request, Response } from 'express';
2
+ /**
3
+ * GET /api/scheduler — read-only recent slot occurrences (WebUI Control Center
4
+ * Phase 1: Scheduler panel). Deliberately no writes and no secrets: this is a
5
+ * projection of the existing Slot Ledger, not a second state system.
6
+ */
7
+ export declare function listRecentSlots(req: Request, res: Response): Promise<void>;
8
+ //# sourceMappingURL=scheduler-handlers.d.ts.map
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listRecentSlots = listRecentSlots;
4
+ const Database_1 = require("../../../storage/Database");
5
+ const config_1 = require("../../../config");
6
+ const logger_1 = require("../../../logger");
7
+ const error_codes_1 = require("../../utils/error-codes");
8
+ /**
9
+ * GET /api/scheduler — read-only recent slot occurrences (WebUI Control Center
10
+ * Phase 1: Scheduler panel). Deliberately no writes and no secrets: this is a
11
+ * projection of the existing Slot Ledger, not a second state system.
12
+ */
13
+ async function listRecentSlots(req, res) {
14
+ let database = null;
15
+ try {
16
+ const limit = Math.min(Math.max(Number(req.query.limit ?? 14) || 14, 1), 50);
17
+ const configPath = (0, config_1.getConfigPath)();
18
+ const config = (0, config_1.loadConfig)(configPath);
19
+ if (!config.storage?.databasePath) {
20
+ res.status(400).json({ errorCode: error_codes_1.ErrorCode.SCHEDULER_LIST_FAILED, message: 'database not configured' });
21
+ return;
22
+ }
23
+ database = new Database_1.Database(config.storage.databasePath);
24
+ database.migrate();
25
+ const slots = database.slots.getRecentSlots(limit).map((slot) => ({
26
+ slotId: slot.id,
27
+ scheduleId: slot.scheduleId,
28
+ status: slot.status,
29
+ occurrenceAt: slot.occurrenceAt,
30
+ occurrenceDate: slot.occurrenceDate,
31
+ occurrenceLabel: slot.occurrenceLabel,
32
+ timezone: slot.timezone,
33
+ triggerSource: slot.triggerSource,
34
+ recoveryRequestId: slot.recoveryRequestId ?? null,
35
+ startedAt: slot.startedAt,
36
+ completedAt: slot.completedAt,
37
+ targets: database.slots.getCells(slot.id).map((cell) => ({
38
+ targetId: cell.targetId,
39
+ workType: cell.workType,
40
+ status: cell.status,
41
+ workId: cell.workId,
42
+ terminalReasonCode: cell.terminalReasonCode,
43
+ reason: cell.terminalReasonMessage ?? null,
44
+ })),
45
+ }));
46
+ database.close();
47
+ database = null;
48
+ res.json({ data: { slots } });
49
+ }
50
+ catch (error) {
51
+ if (database) {
52
+ try {
53
+ database.close();
54
+ }
55
+ catch {
56
+ // ignore
57
+ }
58
+ }
59
+ const message = error instanceof Error ? error.message : String(error);
60
+ logger_1.logger.error('Failed to list scheduler slots', { error: { message } });
61
+ res.status(500).json({ errorCode: error_codes_1.ErrorCode.SCHEDULER_LIST_FAILED });
62
+ }
63
+ }
64
+ //# sourceMappingURL=scheduler-handlers.js.map
@@ -0,0 +1,3 @@
1
+ declare const router: import("express-serve-static-core").Router;
2
+ export default router;
3
+ //# sourceMappingURL=scheduler.d.ts.map
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const express_1 = require("express");
4
+ const scheduler_handlers_1 = require("./handlers/scheduler-handlers");
5
+ const router = (0, express_1.Router)();
6
+ router.get('/', scheduler_handlers_1.listRecentSlots);
7
+ exports.default = router;
8
+ //# sourceMappingURL=scheduler.js.map
@@ -13,6 +13,7 @@ const logs_1 = __importDefault(require("../routes/logs"));
13
13
  const admin_logs_1 = __importDefault(require("../routes/admin-logs"));
14
14
  const system_errors_1 = __importDefault(require("../routes/system-errors"));
15
15
  const files_1 = __importDefault(require("../routes/files"));
16
+ const scheduler_1 = __importDefault(require("../routes/scheduler"));
16
17
  /**
17
18
  * Setup API routes for Express app
18
19
  */
@@ -35,5 +36,7 @@ function setupRoutes(app) {
35
36
  app.use('/admin/logs', admin_logs_1.default);
36
37
  app.use('/admin/system-errors', system_errors_1.default);
37
38
  app.use('/api/files', files_1.default);
39
+ // WebUI Control Center Phase 1: read-only scheduler projection.
40
+ app.use('/api/scheduler', scheduler_1.default);
38
41
  }
39
42
  //# sourceMappingURL=server-routes.js.map
@@ -62,6 +62,7 @@ export declare enum ErrorCode {
62
62
  FILE_DELETE_SUCCESS = "FILE_DELETE_SUCCESS",
63
63
  FILE_DELETE_FAILED = "FILE_DELETE_FAILED",
64
64
  FILE_NORMALIZE_FAILED = "FILE_NORMALIZE_FAILED",
65
+ SCHEDULER_LIST_FAILED = "SCHEDULER_LIST_FAILED",
65
66
  AUTH_STATUS_FAILED = "AUTH_STATUS_FAILED",
66
67
  AUTH_USERNAME_PASSWORD_REQUIRED = "AUTH_USERNAME_PASSWORD_REQUIRED",
67
68
  AUTH_LOGIN_SUCCESS = "AUTH_LOGIN_SUCCESS",
@@ -70,6 +70,8 @@ var ErrorCode;
70
70
  ErrorCode["FILE_DELETE_SUCCESS"] = "FILE_DELETE_SUCCESS";
71
71
  ErrorCode["FILE_DELETE_FAILED"] = "FILE_DELETE_FAILED";
72
72
  ErrorCode["FILE_NORMALIZE_FAILED"] = "FILE_NORMALIZE_FAILED";
73
+ // Scheduler errors
74
+ ErrorCode["SCHEDULER_LIST_FAILED"] = "SCHEDULER_LIST_FAILED";
73
75
  // Auth errors
74
76
  ErrorCode["AUTH_STATUS_FAILED"] = "AUTH_STATUS_FAILED";
75
77
  ErrorCode["AUTH_USERNAME_PASSWORD_REQUIRED"] = "AUTH_USERNAME_PASSWORD_REQUIRED";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixivflow",
3
- "version": "2.33.0",
3
+ "version": "2.35.0",
4
4
  "description": "🎨 Pixiv 下载、筛选与自动收集工具 - 批量下载插画和小说、按标签/热度/日期筛选、定时任务与可靠 HTTP 交付 | Pixiv downloader and automation toolkit with filtering, scheduling and reliable HTTP delivery",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,2 +1,2 @@
1
- import{r as e,I as a,_ as r}from"./index-DG6kGbYq.js";var l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"},n=function(t,c){return e.createElement(a,r({},t,{ref:c,icon:l}))},o=e.forwardRef(n);export{o as R};
2
- //# sourceMappingURL=CheckCircleOutlined-H3DnUyMO.js.map
1
+ import{r as e,I as a,_ as r}from"./index-HJggy9SZ.js";var l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"},n=function(t,c){return e.createElement(a,r({},t,{ref:c,icon:l}))},o=e.forwardRef(n);export{o as R};
2
+ //# sourceMappingURL=CheckCircleOutlined-BS_TxY3k.js.map
@@ -1,2 +1,2 @@
1
- import{r as e,I as r,_ as c}from"./index-DG6kGbYq.js";var l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6a25.95 25.95 0 0025.6 30.4h723c1.5 0 3-.1 4.4-.4a25.88 25.88 0 0021.2-30zM204 390h272V182h72v208h272v104H204V390zm468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z"}}]},name:"clear",theme:"outlined"},n=function(a,t){return e.createElement(r,c({},a,{ref:t,icon:l}))},h=e.forwardRef(n);export{h as R};
2
- //# sourceMappingURL=ClearOutlined-BpODq7I7.js.map
1
+ import{r as e,I as r,_ as c}from"./index-HJggy9SZ.js";var l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6a25.95 25.95 0 0025.6 30.4h723c1.5 0 3-.1 4.4-.4a25.88 25.88 0 0021.2-30zM204 390h272V182h72v208h272v104H204V390zm468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z"}}]},name:"clear",theme:"outlined"},n=function(a,t){return e.createElement(r,c({},a,{ref:t,icon:l}))},h=e.forwardRef(n);export{h as R};
2
+ //# sourceMappingURL=ClearOutlined-uIvWLBII.js.map
@@ -1,2 +1,2 @@
1
- import{r as e,I as l,_ as r}from"./index-DG6kGbYq.js";var t={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z"}}]},name:"close-circle",theme:"outlined"},o=function(a,c){return e.createElement(l,r({},a,{ref:c,icon:t}))},i=e.forwardRef(o);export{i as R};
2
- //# sourceMappingURL=CloseCircleOutlined-BFfS5iXd.js.map
1
+ import{r as e,I as l,_ as r}from"./index-HJggy9SZ.js";var t={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z"}}]},name:"close-circle",theme:"outlined"},o=function(a,c){return e.createElement(l,r({},a,{ref:c,icon:t}))},i=e.forwardRef(o);export{i as R};
2
+ //# sourceMappingURL=CloseCircleOutlined-B45wvGw1.js.map
@@ -1,4 +1,4 @@
1
- import{r as o,I as rn,_ as de,f as Rn,g as An,h as G,w as st,i as Se,k as lt,l as ct,m as Me,n as ie,o as _n,p as dt,q as Xe,t as ut,F as ft,v as gt,x as ht,y as mt,z as Ye,A as X,C as pt,D as xt,E as yt,G as vt,H as jt,J as bt,K as wt,L as St,M as Sn,N as Cn,O as Ct,P as It,T as kt,b as H,U as Be,Q as ue,V as In,s as V,j as e,W as T,X as U,a as _e,B as R,c as on,e as On,d as Et,Y as W,Z as Ce,$ as Nt,S as Dt,a0 as Tt,a1 as $t}from"./index-DG6kGbYq.js";import{u as Ft,a as Ve,c as Ze,C as Pe,R as Mn,b as Rt}from"./useConfig-Ds7RpIL1.js";import{t as ye,e as ze}from"./errorCodeTranslator-BqIackMm.js";import{u as ke,F as sn}from"./useErrorHandler-BOvHue1w.js";import{F as w,u as At,R as q}from"./useAuth-wCjAOx6S.js";import{B as _t,t as Ot,i as Mt,a as zt,g as zn,b as Bt,c as Vt,d as Pt,e as Lt,f as Ht,h as Wt,j as Gt,k as qt,T as oe,R as ln,l as Bn}from"./index-_EG4kaKN.js";import{T as Ie}from"./index-CJln3zA7.js";import{R as Ut}from"./CheckCircleOutlined-H3DnUyMO.js";import{a as Ee,T as Kt}from"./row-_c51T55h.js";import{D as Jt}from"./index-B2ns27ii.js";import{S as Vn}from"./index-B7yYDv10.js";import{I as Q}from"./index-DPigBPWX.js";import{M as cn}from"./index-CDrp3NIf.js";import{S as Pn,R as Ln}from"./ThunderboltOutlined-ulcCd7ui.js";import{P as dn}from"./index-CfHs6AUn.js";import{R as un}from"./DeleteOutlined-BFmW1oWe.js";var Qt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"}}]},name:"up",theme:"outlined"},Xt=function(t,a){return o.createElement(rn,de({},t,{ref:a,icon:Qt}))},Yt=o.forwardRef(Xt);function an(){return typeof BigInt=="function"}function Hn(n){return!n&&n!==0&&!Number.isNaN(n)||!String(n).trim()}function ce(n){var t=n.trim(),a=t.startsWith("-");a&&(t=t.slice(1)),t=t.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,""),t.startsWith(".")&&(t="0".concat(t));var r=t||"0",i=r.split("."),s=i[0]||"0",c=i[1]||"0";s==="0"&&c==="0"&&(a=!1);var l=a?"-":"";return{negative:a,negativeStr:l,trimStr:r,integerStr:s,decimalStr:c,fullStr:"".concat(l).concat(r)}}function fn(n){var t=String(n);return!Number.isNaN(Number(t))&&t.includes("e")}function le(n){var t=String(n);if(fn(n)){var a=Number(t.slice(t.indexOf("e-")+2)),r=t.match(/\.(\d+)/);return r!=null&&r[1]&&(a+=r[1].length),a}return t.includes(".")&&gn(t)?t.length-t.indexOf(".")-1:0}function Le(n){var t=String(n);if(fn(n)){if(n>Number.MAX_SAFE_INTEGER)return String(an()?BigInt(n).toString():Number.MAX_SAFE_INTEGER);if(n<Number.MIN_SAFE_INTEGER)return String(an()?BigInt(n).toString():Number.MIN_SAFE_INTEGER);t=n.toFixed(le(t))}return ce(t).fullStr}function gn(n){return typeof n=="number"?!Number.isNaN(n):n?/^\s*-?\d+(\.\d+)?\s*$/.test(n)||/^\s*-?\d+\.\s*$/.test(n)||/^\s*-?\.\d+\s*$/.test(n):!1}var Zt=(function(){function n(t){if(An(this,n),G(this,"origin",""),G(this,"negative",void 0),G(this,"integer",void 0),G(this,"decimal",void 0),G(this,"decimalLen",void 0),G(this,"empty",void 0),G(this,"nan",void 0),Hn(t)){this.empty=!0;return}if(this.origin=String(t),t==="-"||Number.isNaN(t)){this.nan=!0;return}var a=t;if(fn(a)&&(a=Number(a)),a=typeof a=="string"?a:Le(a),gn(a)){var r=ce(a);this.negative=r.negative;var i=r.trimStr.split(".");this.integer=BigInt(i[0]);var s=i[1]||"0";this.decimal=BigInt(s),this.decimalLen=s.length}else this.nan=!0}return Rn(n,[{key:"getMark",value:function(){return this.negative?"-":""}},{key:"getIntegerStr",value:function(){return this.integer.toString()}},{key:"getDecimalStr",value:function(){return this.decimal.toString().padStart(this.decimalLen,"0")}},{key:"alignDecimal",value:function(a){var r="".concat(this.getMark()).concat(this.getIntegerStr()).concat(this.getDecimalStr().padEnd(a,"0"));return BigInt(r)}},{key:"negate",value:function(){var a=new n(this.toString());return a.negative=!a.negative,a}},{key:"cal",value:function(a,r,i){var s=Math.max(this.getDecimalStr().length,a.getDecimalStr().length),c=this.alignDecimal(s),l=a.alignDecimal(s),u=r(c,l).toString(),m=i(s),d=ce(u),g=d.negativeStr,f=d.trimStr,v="".concat(g).concat(f.padStart(m+1,"0"));return new n("".concat(v.slice(0,-m),".").concat(v.slice(-m)))}},{key:"add",value:function(a){if(this.isInvalidate())return new n(a);var r=new n(a);return r.isInvalidate()?this:this.cal(r,function(i,s){return i+s},function(i){return i})}},{key:"multi",value:function(a){var r=new n(a);return this.isInvalidate()||r.isInvalidate()?new n(NaN):this.cal(r,function(i,s){return i*s},function(i){return i*2})}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return this.nan}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(a){return this.toString()===a?.toString()}},{key:"lessEquals",value:function(a){return this.add(a.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.isNaN()?NaN:Number(this.toString())}},{key:"toString",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return a?this.isInvalidate()?"":ce("".concat(this.getMark()).concat(this.getIntegerStr(),".").concat(this.getDecimalStr())).fullStr:this.origin}}]),n})(),ei=(function(){function n(t){if(An(this,n),G(this,"origin",""),G(this,"number",void 0),G(this,"empty",void 0),Hn(t)){this.empty=!0;return}this.origin=String(t),this.number=Number(t)}return Rn(n,[{key:"negate",value:function(){return new n(-this.toNumber())}},{key:"add",value:function(a){if(this.isInvalidate())return new n(a);var r=Number(a);if(Number.isNaN(r))return this;var i=this.number+r;if(i>Number.MAX_SAFE_INTEGER)return new n(Number.MAX_SAFE_INTEGER);if(i<Number.MIN_SAFE_INTEGER)return new n(Number.MIN_SAFE_INTEGER);var s=Math.max(le(this.number),le(r));return new n(i.toFixed(s))}},{key:"multi",value:function(a){var r=Number(a);if(this.isInvalidate()||Number.isNaN(r))return new n(NaN);var i=this.number*r;if(i>Number.MAX_SAFE_INTEGER)return new n(Number.MAX_SAFE_INTEGER);if(i<Number.MIN_SAFE_INTEGER)return new n(Number.MIN_SAFE_INTEGER);var s=Math.max(le(this.number),le(r));return new n(i.toFixed(s))}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return Number.isNaN(this.number)}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(a){return this.toNumber()===a?.toNumber()}},{key:"lessEquals",value:function(a){return this.add(a.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.number}},{key:"toString",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return a?this.isInvalidate()?"":Le(this.number):this.origin}}]),n})();function ee(n){return an()?new Zt(n):new ei(n)}function Oe(n,t,a){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(n==="")return"";var i=ce(n),s=i.negativeStr,c=i.integerStr,l=i.decimalStr,u="".concat(t).concat(l),m="".concat(s).concat(c);if(a>=0){var d=Number(l[a]);if(d>=5&&!r){var g=ee(n).add("".concat(s,"0.").concat("0".repeat(a)).concat(10-d));return Oe(g.toString(),t,a,r)}return a===0?m:"".concat(m).concat(t).concat(l.padEnd(a,"0").slice(0,a))}return u===".0"?m:"".concat(m).concat(u)}function ni(n,t){return typeof Proxy<"u"&&n?new Proxy(n,{get:function(r,i){if(t[i])return t[i];var s=r[i];return typeof s=="function"?s.bind(r):s}}):n}function ti(n,t){var a=o.useRef(null);function r(){try{var s=n.selectionStart,c=n.selectionEnd,l=n.value,u=l.substring(0,s),m=l.substring(c);a.current={start:s,end:c,value:l,beforeTxt:u,afterTxt:m}}catch{}}function i(){if(n&&a.current&&t)try{var s=n.value,c=a.current,l=c.beforeTxt,u=c.afterTxt,m=c.start,d=s.length;if(s.startsWith(l))d=l.length;else if(s.endsWith(u))d=s.length-a.current.afterTxt.length;else{var g=l[m-1],f=s.indexOf(g,m-1);f!==-1&&(d=f+1)}n.setSelectionRange(d,d)}catch(v){st(!1,"Something warning of cursor restore. Please fire issue about this: ".concat(v.message))}}return[r,i]}var ii=function(){var t=o.useState(!1),a=Se(t,2),r=a[0],i=a[1];return lt(function(){i(ct())},[]),r},ai=200,ri=600;function oi(n){var t=n.prefixCls,a=n.upNode,r=n.downNode,i=n.upDisabled,s=n.downDisabled,c=n.onStep,l=o.useRef(),u=o.useRef([]),m=o.useRef();m.current=c;var d=function(){clearTimeout(l.current)},g=function(E,p){E.preventDefault(),d(),m.current(p);function _(){m.current(p),l.current=setTimeout(_,ai)}l.current=setTimeout(_,ri)};o.useEffect(function(){return function(){d(),u.current.forEach(function(y){return Me.cancel(y)})}},[]);var f=ii();if(f)return null;var v="".concat(t,"-handler"),j=ie(v,"".concat(v,"-up"),G({},"".concat(v,"-up-disabled"),i)),x=ie(v,"".concat(v,"-down"),G({},"".concat(v,"-down-disabled"),s)),S=function(){return u.current.push(Me(d))},h={unselectable:"on",role:"button",onMouseUp:S,onMouseLeave:S};return o.createElement("div",{className:"".concat(v,"-wrap")},o.createElement("span",de({},h,{onMouseDown:function(E){g(E,!0)},"aria-label":"Increase Value","aria-disabled":i,className:j}),a||o.createElement("span",{unselectable:"on",className:"".concat(t,"-handler-up-inner")})),o.createElement("span",de({},h,{onMouseDown:function(E){g(E,!1)},"aria-label":"Decrease Value","aria-disabled":s,className:x}),r||o.createElement("span",{unselectable:"on",className:"".concat(t,"-handler-down-inner")})))}function kn(n){var t=typeof n=="number"?Le(n):ce(n).fullStr,a=t.includes(".");return a?ce(t.replace(/(\d)\.(\d)/g,"$1$2.")).fullStr:n+"0"}const si=(function(){var n=o.useRef(0),t=function(){Me.cancel(n.current)};return o.useEffect(function(){return t},[]),function(a){t(),n.current=Me(function(){a()})}});var li=["prefixCls","className","style","min","max","step","defaultValue","value","disabled","readOnly","upHandler","downHandler","keyboard","changeOnWheel","controls","classNames","stringMode","parser","formatter","precision","decimalSeparator","onChange","onInput","onPressEnter","onStep","changeOnBlur","domRef"],ci=["disabled","style","prefixCls","value","prefix","suffix","addonBefore","addonAfter","className","classNames"],En=function(t,a){return t||a.isEmpty()?a.toString():a.toNumber()},Nn=function(t){var a=ee(t);return a.isInvalidate()?null:a},di=o.forwardRef(function(n,t){var a=n.prefixCls,r=n.className,i=n.style,s=n.min,c=n.max,l=n.step,u=l===void 0?1:l,m=n.defaultValue,d=n.value,g=n.disabled,f=n.readOnly,v=n.upHandler,j=n.downHandler,x=n.keyboard,S=n.changeOnWheel,h=S===void 0?!1:S,y=n.controls,E=y===void 0?!0:y;n.classNames;var p=n.stringMode,_=n.parser,O=n.formatter,$=n.precision,P=n.decimalSeparator,C=n.onChange,k=n.onInput,D=n.onPressEnter,A=n.onStep,B=n.changeOnBlur,J=B===void 0?!0:B,te=n.domRef,He=_n(n,li),De="".concat(a,"-input"),ae=o.useRef(null),re=o.useState(!1),Te=Se(re,2),fe=Te[0],ve=Te[1],Y=o.useRef(!1),se=o.useRef(!1),ge=o.useRef(!1),We=o.useState(function(){return ee(d??m)}),$e=Se(We,2),M=$e[0],he=$e[1];function Kn(I){d===void 0&&he(I)}var Ge=o.useCallback(function(I,b){if(!b)return $>=0?$:Math.max(le(I),le(u))},[$,u]),qe=o.useCallback(function(I){var b=String(I);if(_)return _(b);var F=b;return P&&(F=F.replace(P,".")),F.replace(/[^\w.-]+/g,"")},[_,P]),Ue=o.useRef(""),hn=o.useCallback(function(I,b){if(O)return O(I,{userTyping:b,input:String(Ue.current)});var F=typeof I=="number"?Le(I):I;if(!b){var N=Ge(F,b);if(gn(F)&&(P||N>=0)){var ne=P||".";F=Oe(F,ne,N)}}return F},[O,Ge,P]),Jn=o.useState(function(){var I=m??d;return M.isInvalidate()&&["string","number"].includes(dt(I))?Number.isNaN(I)?"":I:hn(M.toString(),!1)}),mn=Se(Jn,2),je=mn[0],pn=mn[1];Ue.current=je;function be(I,b){pn(hn(I.isInvalidate()?I.toString(!1):I.toString(!b),b))}var me=o.useMemo(function(){return Nn(c)},[c,$]),pe=o.useMemo(function(){return Nn(s)},[s,$]),xn=o.useMemo(function(){return!me||!M||M.isInvalidate()?!1:me.lessEquals(M)},[me,M]),yn=o.useMemo(function(){return!pe||!M||M.isInvalidate()?!1:M.lessEquals(pe)},[pe,M]),Qn=ti(ae.current,fe),vn=Se(Qn,2),Xn=vn[0],Yn=vn[1],jn=function(b){return me&&!b.lessEquals(me)?me:pe&&!pe.lessEquals(b)?pe:null},Ke=function(b){return!jn(b)},Fe=function(b,F){var N=b,ne=Ke(N)||N.isEmpty();if(!N.isEmpty()&&!F&&(N=jn(N)||N,ne=!0),!f&&!g&&ne){var we=N.toString(),Qe=Ge(we,F);return Qe>=0&&(N=ee(Oe(we,".",Qe)),Ke(N)||(N=ee(Oe(we,".",Qe,!0)))),N.equals(M)||(Kn(N),C?.(N.isEmpty()?null:En(p,N)),d===void 0&&be(N,F)),N}return M},Zn=si(),bn=function I(b){if(Xn(),Ue.current=b,pn(b),!se.current){var F=qe(b),N=ee(F);N.isNaN()||Fe(N,!0)}k?.(b),Zn(function(){var ne=b;_||(ne=b.replace(/。/g,".")),ne!==b&&I(ne)})},et=function(){se.current=!0},nt=function(){se.current=!1,bn(ae.current.value)},tt=function(b){bn(b.target.value)},Je=function(b){var F;if(!(b&&xn||!b&&yn)){Y.current=!1;var N=ee(ge.current?kn(u):u);b||(N=N.negate());var ne=(M||ee(0)).add(N.toString()),we=Fe(ne,!1);A?.(En(p,we),{offset:ge.current?kn(u):u,type:b?"up":"down"}),(F=ae.current)===null||F===void 0||F.focus()}},wn=function(b){var F=ee(qe(je)),N;F.isNaN()?N=Fe(M,b):N=Fe(F,b),d!==void 0?be(M,!1):N.isNaN()||be(N,!1)},it=function(){Y.current=!0},at=function(b){var F=b.key,N=b["shiftKey"];Y.current=!0,ge.current=N,F==="Enter"&&(se.current||(Y.current=!1),wn(!1),D?.(b)),x!==!1&&!se.current&&["Up","ArrowUp","Down","ArrowDown"].includes(F)&&(Je(F==="Up"||F==="ArrowUp"),b.preventDefault())},rt=function(){Y.current=!1,ge.current=!1};o.useEffect(function(){if(h&&fe){var I=function(N){Je(N.deltaY<0),N.preventDefault()},b=ae.current;if(b)return b.addEventListener("wheel",I,{passive:!1}),function(){return b.removeEventListener("wheel",I)}}});var ot=function(){J&&wn(!1),ve(!1),Y.current=!1};return Xe(function(){M.isInvalidate()||be(M,!1)},[$,O]),Xe(function(){var I=ee(d);he(I);var b=ee(qe(je));(!I.equals(b)||!Y.current||O)&&be(I,Y.current)},[d]),Xe(function(){O&&Yn()},[je]),o.createElement("div",{ref:te,className:ie(a,r,G(G(G(G(G({},"".concat(a,"-focused"),fe),"".concat(a,"-disabled"),g),"".concat(a,"-readonly"),f),"".concat(a,"-not-a-number"),M.isNaN()),"".concat(a,"-out-of-range"),!M.isInvalidate()&&!Ke(M))),style:i,onFocus:function(){ve(!0)},onBlur:ot,onKeyDown:at,onKeyUp:rt,onCompositionStart:et,onCompositionEnd:nt,onBeforeInput:it},E&&o.createElement(oi,{prefixCls:a,upNode:v,downNode:j,upDisabled:xn,downDisabled:yn,onStep:Je}),o.createElement("div",{className:"".concat(De,"-wrap")},o.createElement("input",de({autoComplete:"off",role:"spinbutton","aria-valuemin":s,"aria-valuemax":c,"aria-valuenow":M.isInvalidate()?null:M.toString(),step:u},He,{ref:ut(ae,t),className:De,value:je,onChange:tt,disabled:g,readOnly:f}))))}),ui=o.forwardRef(function(n,t){var a=n.disabled,r=n.style,i=n.prefixCls,s=i===void 0?"rc-input-number":i,c=n.value,l=n.prefix,u=n.suffix,m=n.addonBefore,d=n.addonAfter,g=n.className,f=n.classNames,v=_n(n,ci),j=o.useRef(null),x=o.useRef(null),S=o.useRef(null),h=function(E){S.current&&Ot(S.current,E)};return o.useImperativeHandle(t,function(){return ni(S.current,{focus:h,nativeElement:j.current.nativeElement||x.current})}),o.createElement(_t,{className:g,triggerFocus:h,prefixCls:s,value:c,disabled:a,style:r,prefix:l,suffix:u,addonAfter:d,addonBefore:m,classNames:f,components:{affixWrapper:"div",groupWrapper:"div",wrapper:"div",groupAddon:"div"},ref:j},o.createElement(di,de({prefixCls:s,disabled:a,ref:S,domRef:x,className:f?.input},v)))});const fi=n=>{var t;const a=(t=n.handleVisible)!==null&&t!==void 0?t:"auto",r=n.controlHeightSM-n.lineWidth*2;return Object.assign(Object.assign({},Mt(n)),{controlWidth:90,handleWidth:r,handleFontSize:n.fontSize/2,handleVisible:a,handleActiveBg:n.colorFillAlter,handleBg:n.colorBgContainer,filledHandleBg:new ft(n.colorFillSecondary).onBackground(n.colorBgContainer).toHexString(),handleHoverColor:n.colorPrimary,handleBorderColor:n.colorBorder,handleOpacity:a===!0?1:0,handleVisibleWidth:a===!0?r:0})},Dn=({componentCls:n,borderRadiusSM:t,borderRadiusLG:a},r)=>{const i=r==="lg"?a:t;return{[`&-${r}`]:{[`${n}-handler-wrap`]:{borderStartEndRadius:i,borderEndEndRadius:i},[`${n}-handler-up`]:{borderStartEndRadius:i},[`${n}-handler-down`]:{borderEndEndRadius:i}}}},gi=n=>{const{componentCls:t,lineWidth:a,lineType:r,borderRadius:i,inputFontSizeSM:s,inputFontSizeLG:c,controlHeightLG:l,controlHeightSM:u,colorError:m,paddingInlineSM:d,paddingBlockSM:g,paddingBlockLG:f,paddingInlineLG:v,colorIcon:j,motionDurationMid:x,handleHoverColor:S,handleOpacity:h,paddingInline:y,paddingBlock:E,handleBg:p,handleActiveBg:_,colorTextDisabled:O,borderRadiusSM:$,borderRadiusLG:P,controlWidth:C,handleBorderColor:k,filledHandleBg:D,lineHeightLG:A,calc:B}=n;return[{[t]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Ye(n)),zn(n)),{display:"inline-block",width:C,margin:0,padding:0,borderRadius:i}),Bt(n,{[`${t}-handler-wrap`]:{background:p,[`${t}-handler-down`]:{borderBlockStart:`${X(a)} ${r} ${k}`}}})),Vt(n,{[`${t}-handler-wrap`]:{background:D,[`${t}-handler-down`]:{borderBlockStart:`${X(a)} ${r} ${k}`}},"&:focus-within":{[`${t}-handler-wrap`]:{background:p}}})),Pt(n,{[`${t}-handler-wrap`]:{background:p,[`${t}-handler-down`]:{borderBlockStart:`${X(a)} ${r} ${k}`}}})),Lt(n)),{"&-rtl":{direction:"rtl",[`${t}-input`]:{direction:"rtl"}},"&-lg":{padding:0,fontSize:c,lineHeight:A,borderRadius:P,[`input${t}-input`]:{height:B(l).sub(B(a).mul(2)).equal(),padding:`${X(f)} ${X(v)}`}},"&-sm":{padding:0,fontSize:s,borderRadius:$,[`input${t}-input`]:{height:B(u).sub(B(a).mul(2)).equal(),padding:`${X(g)} ${X(d)}`}},"&-out-of-range":{[`${t}-input-wrap`]:{input:{color:m}}},"&-group":Object.assign(Object.assign(Object.assign({},Ye(n)),Wt(n)),{"&-wrapper":Object.assign(Object.assign(Object.assign({display:"inline-block",textAlign:"start",verticalAlign:"top",[`${t}-affix-wrapper`]:{width:"100%"},"&-lg":{[`${t}-group-addon`]:{borderRadius:P,fontSize:n.fontSizeLG}},"&-sm":{[`${t}-group-addon`]:{borderRadius:$}}},Gt(n)),qt(n)),{[`&:not(${t}-compact-first-item):not(${t}-compact-last-item)${t}-compact-item`]:{[`${t}, ${t}-group-addon`]:{borderRadius:0}},[`&:not(${t}-compact-last-item)${t}-compact-first-item`]:{[`${t}, ${t}-group-addon`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&:not(${t}-compact-first-item)${t}-compact-last-item`]:{[`${t}, ${t}-group-addon`]:{borderStartStartRadius:0,borderEndStartRadius:0}}})}),[`&-disabled ${t}-input`]:{cursor:"not-allowed"},[t]:{"&-input":Object.assign(Object.assign(Object.assign(Object.assign({},Ye(n)),{width:"100%",padding:`${X(E)} ${X(y)}`,textAlign:"start",backgroundColor:"transparent",border:0,borderRadius:i,outline:0,transition:`all ${x} linear`,appearance:"textfield",fontSize:"inherit"}),Ht(n.colorTextPlaceholder)),{'&[type="number"]::-webkit-inner-spin-button, &[type="number"]::-webkit-outer-spin-button':{margin:0,appearance:"none"}})},[`&:hover ${t}-handler-wrap, &-focused ${t}-handler-wrap`]:{width:n.handleWidth,opacity:1}})},{[t]:Object.assign(Object.assign(Object.assign({[`${t}-handler-wrap`]:{position:"absolute",insetBlockStart:0,insetInlineEnd:0,width:n.handleVisibleWidth,opacity:h,height:"100%",borderStartStartRadius:0,borderStartEndRadius:i,borderEndEndRadius:i,borderEndStartRadius:0,display:"flex",flexDirection:"column",alignItems:"stretch",transition:`all ${x}`,overflow:"hidden",[`${t}-handler`]:{display:"flex",alignItems:"center",justifyContent:"center",flex:"auto",height:"40%",[`
1
+ import{r as o,I as rn,_ as de,f as Rn,g as An,h as G,w as st,i as Se,k as lt,l as ct,m as Me,n as ie,o as _n,p as dt,q as Xe,t as ut,F as ft,v as gt,x as ht,y as mt,z as Ye,A as X,C as pt,D as xt,E as yt,G as vt,H as jt,J as bt,K as wt,L as St,M as Sn,N as Cn,O as Ct,P as It,T as kt,b as H,U as Be,Q as ue,V as In,s as V,j as e,W as T,X as U,a as _e,B as R,c as on,e as On,d as Et,Y as W,Z as Ce,$ as Nt,S as Dt,a0 as Tt,a1 as $t}from"./index-HJggy9SZ.js";import{u as Ft,a as Ve,c as Ze,C as Pe,R as Mn,b as Rt}from"./useConfig-BmhXnAiM.js";import{t as ye,e as ze}from"./errorCodeTranslator-Xn_Z9qOh.js";import{u as ke}from"./useErrorHandler-Bcb3l7ju.js";import{F as w,u as At,R as q}from"./useAuth-4erTEEjT.js";import{B as _t,t as Ot,i as Mt,a as zt,g as zn,b as Bt,c as Vt,d as Pt,e as Lt,f as Ht,h as Wt,j as Gt,k as qt,T as oe,R as sn,l as Bn}from"./index-mHLzQpzS.js";import{T as Ie}from"./index-6mtxs9yc.js";import{R as Ut}from"./CheckCircleOutlined-BS_TxY3k.js";import{C as Ee,T as Kt}from"./index-B4zZ11c-.js";import{D as Jt}from"./index-D4mbR-Vx.js";import{S as Vn}from"./index-C66Xw4Fs.js";import{I as Q}from"./index-DiwSYMD5.js";import{M as ln}from"./index-NSEOZ6G5.js";import{S as Pn,R as Ln}from"./ThunderboltOutlined-DhgtXoNM.js";import{P as cn}from"./index-BlXTpFS3.js";import{R as dn}from"./DeleteOutlined-ByQuZQbZ.js";import{F as un}from"./Table-CvqrzZX2.js";import"./index-Cg2Wi2pt.js";import"./row-CQQO4x82.js";var Qt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"}}]},name:"up",theme:"outlined"},Xt=function(t,a){return o.createElement(rn,de({},t,{ref:a,icon:Qt}))},Yt=o.forwardRef(Xt);function an(){return typeof BigInt=="function"}function Hn(n){return!n&&n!==0&&!Number.isNaN(n)||!String(n).trim()}function ce(n){var t=n.trim(),a=t.startsWith("-");a&&(t=t.slice(1)),t=t.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,""),t.startsWith(".")&&(t="0".concat(t));var r=t||"0",i=r.split("."),s=i[0]||"0",c=i[1]||"0";s==="0"&&c==="0"&&(a=!1);var l=a?"-":"";return{negative:a,negativeStr:l,trimStr:r,integerStr:s,decimalStr:c,fullStr:"".concat(l).concat(r)}}function fn(n){var t=String(n);return!Number.isNaN(Number(t))&&t.includes("e")}function le(n){var t=String(n);if(fn(n)){var a=Number(t.slice(t.indexOf("e-")+2)),r=t.match(/\.(\d+)/);return r!=null&&r[1]&&(a+=r[1].length),a}return t.includes(".")&&gn(t)?t.length-t.indexOf(".")-1:0}function Le(n){var t=String(n);if(fn(n)){if(n>Number.MAX_SAFE_INTEGER)return String(an()?BigInt(n).toString():Number.MAX_SAFE_INTEGER);if(n<Number.MIN_SAFE_INTEGER)return String(an()?BigInt(n).toString():Number.MIN_SAFE_INTEGER);t=n.toFixed(le(t))}return ce(t).fullStr}function gn(n){return typeof n=="number"?!Number.isNaN(n):n?/^\s*-?\d+(\.\d+)?\s*$/.test(n)||/^\s*-?\d+\.\s*$/.test(n)||/^\s*-?\.\d+\s*$/.test(n):!1}var Zt=(function(){function n(t){if(An(this,n),G(this,"origin",""),G(this,"negative",void 0),G(this,"integer",void 0),G(this,"decimal",void 0),G(this,"decimalLen",void 0),G(this,"empty",void 0),G(this,"nan",void 0),Hn(t)){this.empty=!0;return}if(this.origin=String(t),t==="-"||Number.isNaN(t)){this.nan=!0;return}var a=t;if(fn(a)&&(a=Number(a)),a=typeof a=="string"?a:Le(a),gn(a)){var r=ce(a);this.negative=r.negative;var i=r.trimStr.split(".");this.integer=BigInt(i[0]);var s=i[1]||"0";this.decimal=BigInt(s),this.decimalLen=s.length}else this.nan=!0}return Rn(n,[{key:"getMark",value:function(){return this.negative?"-":""}},{key:"getIntegerStr",value:function(){return this.integer.toString()}},{key:"getDecimalStr",value:function(){return this.decimal.toString().padStart(this.decimalLen,"0")}},{key:"alignDecimal",value:function(a){var r="".concat(this.getMark()).concat(this.getIntegerStr()).concat(this.getDecimalStr().padEnd(a,"0"));return BigInt(r)}},{key:"negate",value:function(){var a=new n(this.toString());return a.negative=!a.negative,a}},{key:"cal",value:function(a,r,i){var s=Math.max(this.getDecimalStr().length,a.getDecimalStr().length),c=this.alignDecimal(s),l=a.alignDecimal(s),u=r(c,l).toString(),m=i(s),d=ce(u),g=d.negativeStr,f=d.trimStr,v="".concat(g).concat(f.padStart(m+1,"0"));return new n("".concat(v.slice(0,-m),".").concat(v.slice(-m)))}},{key:"add",value:function(a){if(this.isInvalidate())return new n(a);var r=new n(a);return r.isInvalidate()?this:this.cal(r,function(i,s){return i+s},function(i){return i})}},{key:"multi",value:function(a){var r=new n(a);return this.isInvalidate()||r.isInvalidate()?new n(NaN):this.cal(r,function(i,s){return i*s},function(i){return i*2})}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return this.nan}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(a){return this.toString()===a?.toString()}},{key:"lessEquals",value:function(a){return this.add(a.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.isNaN()?NaN:Number(this.toString())}},{key:"toString",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return a?this.isInvalidate()?"":ce("".concat(this.getMark()).concat(this.getIntegerStr(),".").concat(this.getDecimalStr())).fullStr:this.origin}}]),n})(),ei=(function(){function n(t){if(An(this,n),G(this,"origin",""),G(this,"number",void 0),G(this,"empty",void 0),Hn(t)){this.empty=!0;return}this.origin=String(t),this.number=Number(t)}return Rn(n,[{key:"negate",value:function(){return new n(-this.toNumber())}},{key:"add",value:function(a){if(this.isInvalidate())return new n(a);var r=Number(a);if(Number.isNaN(r))return this;var i=this.number+r;if(i>Number.MAX_SAFE_INTEGER)return new n(Number.MAX_SAFE_INTEGER);if(i<Number.MIN_SAFE_INTEGER)return new n(Number.MIN_SAFE_INTEGER);var s=Math.max(le(this.number),le(r));return new n(i.toFixed(s))}},{key:"multi",value:function(a){var r=Number(a);if(this.isInvalidate()||Number.isNaN(r))return new n(NaN);var i=this.number*r;if(i>Number.MAX_SAFE_INTEGER)return new n(Number.MAX_SAFE_INTEGER);if(i<Number.MIN_SAFE_INTEGER)return new n(Number.MIN_SAFE_INTEGER);var s=Math.max(le(this.number),le(r));return new n(i.toFixed(s))}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return Number.isNaN(this.number)}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(a){return this.toNumber()===a?.toNumber()}},{key:"lessEquals",value:function(a){return this.add(a.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.number}},{key:"toString",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return a?this.isInvalidate()?"":Le(this.number):this.origin}}]),n})();function ee(n){return an()?new Zt(n):new ei(n)}function Oe(n,t,a){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(n==="")return"";var i=ce(n),s=i.negativeStr,c=i.integerStr,l=i.decimalStr,u="".concat(t).concat(l),m="".concat(s).concat(c);if(a>=0){var d=Number(l[a]);if(d>=5&&!r){var g=ee(n).add("".concat(s,"0.").concat("0".repeat(a)).concat(10-d));return Oe(g.toString(),t,a,r)}return a===0?m:"".concat(m).concat(t).concat(l.padEnd(a,"0").slice(0,a))}return u===".0"?m:"".concat(m).concat(u)}function ni(n,t){return typeof Proxy<"u"&&n?new Proxy(n,{get:function(r,i){if(t[i])return t[i];var s=r[i];return typeof s=="function"?s.bind(r):s}}):n}function ti(n,t){var a=o.useRef(null);function r(){try{var s=n.selectionStart,c=n.selectionEnd,l=n.value,u=l.substring(0,s),m=l.substring(c);a.current={start:s,end:c,value:l,beforeTxt:u,afterTxt:m}}catch{}}function i(){if(n&&a.current&&t)try{var s=n.value,c=a.current,l=c.beforeTxt,u=c.afterTxt,m=c.start,d=s.length;if(s.startsWith(l))d=l.length;else if(s.endsWith(u))d=s.length-a.current.afterTxt.length;else{var g=l[m-1],f=s.indexOf(g,m-1);f!==-1&&(d=f+1)}n.setSelectionRange(d,d)}catch(v){st(!1,"Something warning of cursor restore. Please fire issue about this: ".concat(v.message))}}return[r,i]}var ii=function(){var t=o.useState(!1),a=Se(t,2),r=a[0],i=a[1];return lt(function(){i(ct())},[]),r},ai=200,ri=600;function oi(n){var t=n.prefixCls,a=n.upNode,r=n.downNode,i=n.upDisabled,s=n.downDisabled,c=n.onStep,l=o.useRef(),u=o.useRef([]),m=o.useRef();m.current=c;var d=function(){clearTimeout(l.current)},g=function(E,p){E.preventDefault(),d(),m.current(p);function _(){m.current(p),l.current=setTimeout(_,ai)}l.current=setTimeout(_,ri)};o.useEffect(function(){return function(){d(),u.current.forEach(function(y){return Me.cancel(y)})}},[]);var f=ii();if(f)return null;var v="".concat(t,"-handler"),j=ie(v,"".concat(v,"-up"),G({},"".concat(v,"-up-disabled"),i)),x=ie(v,"".concat(v,"-down"),G({},"".concat(v,"-down-disabled"),s)),S=function(){return u.current.push(Me(d))},h={unselectable:"on",role:"button",onMouseUp:S,onMouseLeave:S};return o.createElement("div",{className:"".concat(v,"-wrap")},o.createElement("span",de({},h,{onMouseDown:function(E){g(E,!0)},"aria-label":"Increase Value","aria-disabled":i,className:j}),a||o.createElement("span",{unselectable:"on",className:"".concat(t,"-handler-up-inner")})),o.createElement("span",de({},h,{onMouseDown:function(E){g(E,!1)},"aria-label":"Decrease Value","aria-disabled":s,className:x}),r||o.createElement("span",{unselectable:"on",className:"".concat(t,"-handler-down-inner")})))}function kn(n){var t=typeof n=="number"?Le(n):ce(n).fullStr,a=t.includes(".");return a?ce(t.replace(/(\d)\.(\d)/g,"$1$2.")).fullStr:n+"0"}const si=(function(){var n=o.useRef(0),t=function(){Me.cancel(n.current)};return o.useEffect(function(){return t},[]),function(a){t(),n.current=Me(function(){a()})}});var li=["prefixCls","className","style","min","max","step","defaultValue","value","disabled","readOnly","upHandler","downHandler","keyboard","changeOnWheel","controls","classNames","stringMode","parser","formatter","precision","decimalSeparator","onChange","onInput","onPressEnter","onStep","changeOnBlur","domRef"],ci=["disabled","style","prefixCls","value","prefix","suffix","addonBefore","addonAfter","className","classNames"],En=function(t,a){return t||a.isEmpty()?a.toString():a.toNumber()},Nn=function(t){var a=ee(t);return a.isInvalidate()?null:a},di=o.forwardRef(function(n,t){var a=n.prefixCls,r=n.className,i=n.style,s=n.min,c=n.max,l=n.step,u=l===void 0?1:l,m=n.defaultValue,d=n.value,g=n.disabled,f=n.readOnly,v=n.upHandler,j=n.downHandler,x=n.keyboard,S=n.changeOnWheel,h=S===void 0?!1:S,y=n.controls,E=y===void 0?!0:y;n.classNames;var p=n.stringMode,_=n.parser,O=n.formatter,$=n.precision,P=n.decimalSeparator,C=n.onChange,k=n.onInput,D=n.onPressEnter,A=n.onStep,B=n.changeOnBlur,J=B===void 0?!0:B,te=n.domRef,He=_n(n,li),De="".concat(a,"-input"),ae=o.useRef(null),re=o.useState(!1),Te=Se(re,2),fe=Te[0],ve=Te[1],Y=o.useRef(!1),se=o.useRef(!1),ge=o.useRef(!1),We=o.useState(function(){return ee(d??m)}),$e=Se(We,2),M=$e[0],he=$e[1];function Kn(I){d===void 0&&he(I)}var Ge=o.useCallback(function(I,b){if(!b)return $>=0?$:Math.max(le(I),le(u))},[$,u]),qe=o.useCallback(function(I){var b=String(I);if(_)return _(b);var F=b;return P&&(F=F.replace(P,".")),F.replace(/[^\w.-]+/g,"")},[_,P]),Ue=o.useRef(""),hn=o.useCallback(function(I,b){if(O)return O(I,{userTyping:b,input:String(Ue.current)});var F=typeof I=="number"?Le(I):I;if(!b){var N=Ge(F,b);if(gn(F)&&(P||N>=0)){var ne=P||".";F=Oe(F,ne,N)}}return F},[O,Ge,P]),Jn=o.useState(function(){var I=m??d;return M.isInvalidate()&&["string","number"].includes(dt(I))?Number.isNaN(I)?"":I:hn(M.toString(),!1)}),mn=Se(Jn,2),je=mn[0],pn=mn[1];Ue.current=je;function be(I,b){pn(hn(I.isInvalidate()?I.toString(!1):I.toString(!b),b))}var me=o.useMemo(function(){return Nn(c)},[c,$]),pe=o.useMemo(function(){return Nn(s)},[s,$]),xn=o.useMemo(function(){return!me||!M||M.isInvalidate()?!1:me.lessEquals(M)},[me,M]),yn=o.useMemo(function(){return!pe||!M||M.isInvalidate()?!1:M.lessEquals(pe)},[pe,M]),Qn=ti(ae.current,fe),vn=Se(Qn,2),Xn=vn[0],Yn=vn[1],jn=function(b){return me&&!b.lessEquals(me)?me:pe&&!pe.lessEquals(b)?pe:null},Ke=function(b){return!jn(b)},Fe=function(b,F){var N=b,ne=Ke(N)||N.isEmpty();if(!N.isEmpty()&&!F&&(N=jn(N)||N,ne=!0),!f&&!g&&ne){var we=N.toString(),Qe=Ge(we,F);return Qe>=0&&(N=ee(Oe(we,".",Qe)),Ke(N)||(N=ee(Oe(we,".",Qe,!0)))),N.equals(M)||(Kn(N),C?.(N.isEmpty()?null:En(p,N)),d===void 0&&be(N,F)),N}return M},Zn=si(),bn=function I(b){if(Xn(),Ue.current=b,pn(b),!se.current){var F=qe(b),N=ee(F);N.isNaN()||Fe(N,!0)}k?.(b),Zn(function(){var ne=b;_||(ne=b.replace(/。/g,".")),ne!==b&&I(ne)})},et=function(){se.current=!0},nt=function(){se.current=!1,bn(ae.current.value)},tt=function(b){bn(b.target.value)},Je=function(b){var F;if(!(b&&xn||!b&&yn)){Y.current=!1;var N=ee(ge.current?kn(u):u);b||(N=N.negate());var ne=(M||ee(0)).add(N.toString()),we=Fe(ne,!1);A?.(En(p,we),{offset:ge.current?kn(u):u,type:b?"up":"down"}),(F=ae.current)===null||F===void 0||F.focus()}},wn=function(b){var F=ee(qe(je)),N;F.isNaN()?N=Fe(M,b):N=Fe(F,b),d!==void 0?be(M,!1):N.isNaN()||be(N,!1)},it=function(){Y.current=!0},at=function(b){var F=b.key,N=b.shiftKey;Y.current=!0,ge.current=N,F==="Enter"&&(se.current||(Y.current=!1),wn(!1),D?.(b)),x!==!1&&!se.current&&["Up","ArrowUp","Down","ArrowDown"].includes(F)&&(Je(F==="Up"||F==="ArrowUp"),b.preventDefault())},rt=function(){Y.current=!1,ge.current=!1};o.useEffect(function(){if(h&&fe){var I=function(N){Je(N.deltaY<0),N.preventDefault()},b=ae.current;if(b)return b.addEventListener("wheel",I,{passive:!1}),function(){return b.removeEventListener("wheel",I)}}});var ot=function(){J&&wn(!1),ve(!1),Y.current=!1};return Xe(function(){M.isInvalidate()||be(M,!1)},[$,O]),Xe(function(){var I=ee(d);he(I);var b=ee(qe(je));(!I.equals(b)||!Y.current||O)&&be(I,Y.current)},[d]),Xe(function(){O&&Yn()},[je]),o.createElement("div",{ref:te,className:ie(a,r,G(G(G(G(G({},"".concat(a,"-focused"),fe),"".concat(a,"-disabled"),g),"".concat(a,"-readonly"),f),"".concat(a,"-not-a-number"),M.isNaN()),"".concat(a,"-out-of-range"),!M.isInvalidate()&&!Ke(M))),style:i,onFocus:function(){ve(!0)},onBlur:ot,onKeyDown:at,onKeyUp:rt,onCompositionStart:et,onCompositionEnd:nt,onBeforeInput:it},E&&o.createElement(oi,{prefixCls:a,upNode:v,downNode:j,upDisabled:xn,downDisabled:yn,onStep:Je}),o.createElement("div",{className:"".concat(De,"-wrap")},o.createElement("input",de({autoComplete:"off",role:"spinbutton","aria-valuemin":s,"aria-valuemax":c,"aria-valuenow":M.isInvalidate()?null:M.toString(),step:u},He,{ref:ut(ae,t),className:De,value:je,onChange:tt,disabled:g,readOnly:f}))))}),ui=o.forwardRef(function(n,t){var a=n.disabled,r=n.style,i=n.prefixCls,s=i===void 0?"rc-input-number":i,c=n.value,l=n.prefix,u=n.suffix,m=n.addonBefore,d=n.addonAfter,g=n.className,f=n.classNames,v=_n(n,ci),j=o.useRef(null),x=o.useRef(null),S=o.useRef(null),h=function(E){S.current&&Ot(S.current,E)};return o.useImperativeHandle(t,function(){return ni(S.current,{focus:h,nativeElement:j.current.nativeElement||x.current})}),o.createElement(_t,{className:g,triggerFocus:h,prefixCls:s,value:c,disabled:a,style:r,prefix:l,suffix:u,addonAfter:d,addonBefore:m,classNames:f,components:{affixWrapper:"div",groupWrapper:"div",wrapper:"div",groupAddon:"div"},ref:j},o.createElement(di,de({prefixCls:s,disabled:a,ref:S,domRef:x,className:f?.input},v)))});const fi=n=>{var t;const a=(t=n.handleVisible)!==null&&t!==void 0?t:"auto",r=n.controlHeightSM-n.lineWidth*2;return Object.assign(Object.assign({},Mt(n)),{controlWidth:90,handleWidth:r,handleFontSize:n.fontSize/2,handleVisible:a,handleActiveBg:n.colorFillAlter,handleBg:n.colorBgContainer,filledHandleBg:new ft(n.colorFillSecondary).onBackground(n.colorBgContainer).toHexString(),handleHoverColor:n.colorPrimary,handleBorderColor:n.colorBorder,handleOpacity:a===!0?1:0,handleVisibleWidth:a===!0?r:0})},Dn=({componentCls:n,borderRadiusSM:t,borderRadiusLG:a},r)=>{const i=r==="lg"?a:t;return{[`&-${r}`]:{[`${n}-handler-wrap`]:{borderStartEndRadius:i,borderEndEndRadius:i},[`${n}-handler-up`]:{borderStartEndRadius:i},[`${n}-handler-down`]:{borderEndEndRadius:i}}}},gi=n=>{const{componentCls:t,lineWidth:a,lineType:r,borderRadius:i,inputFontSizeSM:s,inputFontSizeLG:c,controlHeightLG:l,controlHeightSM:u,colorError:m,paddingInlineSM:d,paddingBlockSM:g,paddingBlockLG:f,paddingInlineLG:v,colorIcon:j,motionDurationMid:x,handleHoverColor:S,handleOpacity:h,paddingInline:y,paddingBlock:E,handleBg:p,handleActiveBg:_,colorTextDisabled:O,borderRadiusSM:$,borderRadiusLG:P,controlWidth:C,handleBorderColor:k,filledHandleBg:D,lineHeightLG:A,calc:B}=n;return[{[t]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Ye(n)),zn(n)),{display:"inline-block",width:C,margin:0,padding:0,borderRadius:i}),Bt(n,{[`${t}-handler-wrap`]:{background:p,[`${t}-handler-down`]:{borderBlockStart:`${X(a)} ${r} ${k}`}}})),Vt(n,{[`${t}-handler-wrap`]:{background:D,[`${t}-handler-down`]:{borderBlockStart:`${X(a)} ${r} ${k}`}},"&:focus-within":{[`${t}-handler-wrap`]:{background:p}}})),Pt(n,{[`${t}-handler-wrap`]:{background:p,[`${t}-handler-down`]:{borderBlockStart:`${X(a)} ${r} ${k}`}}})),Lt(n)),{"&-rtl":{direction:"rtl",[`${t}-input`]:{direction:"rtl"}},"&-lg":{padding:0,fontSize:c,lineHeight:A,borderRadius:P,[`input${t}-input`]:{height:B(l).sub(B(a).mul(2)).equal(),padding:`${X(f)} ${X(v)}`}},"&-sm":{padding:0,fontSize:s,borderRadius:$,[`input${t}-input`]:{height:B(u).sub(B(a).mul(2)).equal(),padding:`${X(g)} ${X(d)}`}},"&-out-of-range":{[`${t}-input-wrap`]:{input:{color:m}}},"&-group":Object.assign(Object.assign(Object.assign({},Ye(n)),Wt(n)),{"&-wrapper":Object.assign(Object.assign(Object.assign({display:"inline-block",textAlign:"start",verticalAlign:"top",[`${t}-affix-wrapper`]:{width:"100%"},"&-lg":{[`${t}-group-addon`]:{borderRadius:P,fontSize:n.fontSizeLG}},"&-sm":{[`${t}-group-addon`]:{borderRadius:$}}},Gt(n)),qt(n)),{[`&:not(${t}-compact-first-item):not(${t}-compact-last-item)${t}-compact-item`]:{[`${t}, ${t}-group-addon`]:{borderRadius:0}},[`&:not(${t}-compact-last-item)${t}-compact-first-item`]:{[`${t}, ${t}-group-addon`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&:not(${t}-compact-first-item)${t}-compact-last-item`]:{[`${t}, ${t}-group-addon`]:{borderStartStartRadius:0,borderEndStartRadius:0}}})}),[`&-disabled ${t}-input`]:{cursor:"not-allowed"},[t]:{"&-input":Object.assign(Object.assign(Object.assign(Object.assign({},Ye(n)),{width:"100%",padding:`${X(E)} ${X(y)}`,textAlign:"start",backgroundColor:"transparent",border:0,borderRadius:i,outline:0,transition:`all ${x} linear`,appearance:"textfield",fontSize:"inherit"}),Ht(n.colorTextPlaceholder)),{'&[type="number"]::-webkit-inner-spin-button, &[type="number"]::-webkit-outer-spin-button':{margin:0,appearance:"none"}})},[`&:hover ${t}-handler-wrap, &-focused ${t}-handler-wrap`]:{width:n.handleWidth,opacity:1}})},{[t]:Object.assign(Object.assign(Object.assign({[`${t}-handler-wrap`]:{position:"absolute",insetBlockStart:0,insetInlineEnd:0,width:n.handleVisibleWidth,opacity:h,height:"100%",borderStartStartRadius:0,borderStartEndRadius:i,borderEndEndRadius:i,borderEndStartRadius:0,display:"flex",flexDirection:"column",alignItems:"stretch",transition:`all ${x}`,overflow:"hidden",[`${t}-handler`]:{display:"flex",alignItems:"center",justifyContent:"center",flex:"auto",height:"40%",[`
2
2
  ${t}-handler-up-inner,
3
3
  ${t}-handler-down-inner
4
4
  `]:{marginInlineEnd:0,fontSize:n.handleFontSize}}},[`${t}-handler`]:{height:"50%",overflow:"hidden",color:j,fontWeight:"bold",lineHeight:0,textAlign:"center",cursor:"pointer",borderInlineStart:`${X(a)} ${r} ${k}`,transition:`all ${x} linear`,"&:active":{background:_},"&:hover":{height:"60%",[`
@@ -12,5 +12,5 @@ import{r as o,I as rn,_ as de,f as Rn,g as An,h as G,w as st,i as Se,k as lt,l a
12
12
  ${t}-handler-down-disabled:hover &-handler-down-inner
13
13
  `]:{color:O}})}]},hi=n=>{const{componentCls:t,paddingBlock:a,paddingInline:r,inputAffixPadding:i,controlWidth:s,borderRadiusLG:c,borderRadiusSM:l,paddingInlineLG:u,paddingInlineSM:m,paddingBlockLG:d,paddingBlockSM:g,motionDurationMid:f}=n;return{[`${t}-affix-wrapper`]:Object.assign(Object.assign({[`input${t}-input`]:{padding:`${X(a)} 0`}},zn(n)),{position:"relative",display:"inline-flex",alignItems:"center",width:s,padding:0,paddingInlineStart:r,"&-lg":{borderRadius:c,paddingInlineStart:u,[`input${t}-input`]:{padding:`${X(d)} 0`}},"&-sm":{borderRadius:l,paddingInlineStart:m,[`input${t}-input`]:{padding:`${X(g)} 0`}},[`&:not(${t}-disabled):hover`]:{zIndex:1},"&-focused, &:focus":{zIndex:1},[`&-disabled > ${t}-disabled`]:{background:"transparent"},[`> div${t}`]:{width:"100%",border:"none",outline:"none",[`&${t}-focused`]:{boxShadow:"none !important"}},"&::before":{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'},[`${t}-handler-wrap`]:{zIndex:2},[t]:{position:"static",color:"inherit","&-prefix, &-suffix":{display:"flex",flex:"none",alignItems:"center",pointerEvents:"none"},"&-prefix":{marginInlineEnd:i},"&-suffix":{insetBlockStart:0,insetInlineEnd:0,height:"100%",marginInlineEnd:r,marginInlineStart:i,transition:`margin ${f}`}},[`&:hover ${t}-handler-wrap, &-focused ${t}-handler-wrap`]:{width:n.handleWidth,opacity:1},[`&:not(${t}-affix-wrapper-without-controls):hover ${t}-suffix`]:{marginInlineEnd:n.calc(n.handleWidth).add(r).equal()}}),[`${t}-underlined`]:{borderRadius:0}}},mi=gt("InputNumber",n=>{const t=ht(n,zt(n));return[gi(t),hi(t),mt(t)]},fi,{unitless:{handleOpacity:!0},resetFont:!1});var pi=function(n,t){var a={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&t.indexOf(r)<0&&(a[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(a[r[i]]=n[r[i]]);return a};const Wn=o.forwardRef((n,t)=>{const{getPrefixCls:a,direction:r}=o.useContext(xt),i=o.useRef(null);o.useImperativeHandle(t,()=>i.current);const{className:s,rootClassName:c,size:l,disabled:u,prefixCls:m,addonBefore:d,addonAfter:g,prefix:f,suffix:v,bordered:j,readOnly:x,status:S,controls:h,variant:y}=n,E=pi(n,["className","rootClassName","size","disabled","prefixCls","addonBefore","addonAfter","prefix","suffix","bordered","readOnly","status","controls","variant"]),p=a("input-number",m),_=yt(p),[O,$,P]=mi(p,_),{compactSize:C,compactItemClassnames:k}=vt(p,r);let D=o.createElement(Yt,{className:`${p}-handler-up-inner`}),A=o.createElement(Ct,{className:`${p}-handler-down-inner`});const B=typeof h=="boolean"?h:void 0;typeof h=="object"&&(D=typeof h.upIcon>"u"?D:o.createElement("span",{className:`${p}-handler-up-inner`},h.upIcon),A=typeof h.downIcon>"u"?A:o.createElement("span",{className:`${p}-handler-down-inner`},h.downIcon));const{hasFeedback:J,status:te,isFormItemInput:He,feedbackIcon:De}=o.useContext(jt),ae=It(te,S),re=bt(M=>{var he;return(he=l??C)!==null&&he!==void 0?he:M}),Te=o.useContext(wt),fe=u??Te,[ve,Y]=St("inputNumber",y,j),se=J&&o.createElement(o.Fragment,null,De),ge=ie({[`${p}-lg`]:re==="large",[`${p}-sm`]:re==="small",[`${p}-rtl`]:r==="rtl",[`${p}-in-form-item`]:He},$),We=`${p}-group`,$e=o.createElement(ui,Object.assign({ref:i,disabled:fe,className:ie(P,_,s,c,k),upHandler:D,downHandler:A,prefixCls:p,readOnly:x,controls:B,prefix:f,suffix:se||v,addonBefore:d&&o.createElement(Cn,{form:!0,space:!0},d),addonAfter:g&&o.createElement(Cn,{form:!0,space:!0},g),classNames:{input:ge,variant:ie({[`${p}-${ve}`]:Y},Sn(p,ae,J)),affixWrapper:ie({[`${p}-affix-wrapper-sm`]:re==="small",[`${p}-affix-wrapper-lg`]:re==="large",[`${p}-affix-wrapper-rtl`]:r==="rtl",[`${p}-affix-wrapper-without-controls`]:h===!1||fe||x},$),wrapper:ie({[`${We}-rtl`]:r==="rtl"},$),groupWrapper:ie({[`${p}-group-wrapper-sm`]:re==="small",[`${p}-group-wrapper-lg`]:re==="large",[`${p}-group-wrapper-rtl`]:r==="rtl",[`${p}-group-wrapper-${ve}`]:Y},Sn(`${p}-group-wrapper`,ae,J),$)}},E));return O($e)}),K=Wn,xi=n=>o.createElement(kt,{theme:{components:{InputNumber:{handleVisible:!0}}}},o.createElement(Wn,Object.assign({},n)));K._InternalPanelDoNotUseOrYouWillBeFired=xi;var yi={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"},vi=function(t,a){return o.createElement(rn,de({},t,{ref:a,icon:yi}))},Gn=o.forwardRef(vi),ji={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},bi=function(t,a){return o.createElement(rn,de({},t,{ref:a,icon:ji}))},wi=o.forwardRef(bi);function Si(){const{t:n}=H(),t=Be(),[a]=w.useForm(),{config:r,isLoading:i,updateAsync:s,validate:c,isUpdating:l,isValidating:u}=Ft(),{handleError:m,handleSuccess:d}=ke();return o.useEffect(()=>{if(r){const x=Ci(r);a.setFieldsValue(x)}},[r,a]),{form:a,config:r,isLoading:i,isUpdating:l,isValidating:u,handleSave:async()=>{try{const x=a.getFieldsValue();await s(x),d(n("config.saveSuccess"))}catch(x){const S=In(x),h=ki(S,n);m(S,h)}},handleValidate:()=>{a.validateFields().then(x=>{c(x)})},handleTargetChange:async()=>{try{const x=a.getFieldsValue(),S={...Ii(r),...x,targets:x.targets};await s(S)}catch(x){const S=In(x),h=ye(S.code,n,S.params,n("config.saveFailed"))??n("config.saveFailed");m(S,h)}},getConfigPreview:()=>JSON.stringify(a.getFieldsValue(),null,2),refreshConfig:()=>t.invalidateQueries({queryKey:ue.CONFIG})}}const Ci=n=>{const{_meta:t,_validation:a,...r}=n;return{...r,targets:Array.isArray(r.targets)?r.targets:[]}},Ii=n=>{if(!n)return{};const{_meta:t,_validation:a,...r}=n;return r},ki=(n,t)=>{if(n.code==="CONFIG_INVALID"&&Array.isArray(n.details)){const a=n.details.map(r=>{if(typeof r=="object"&&r&&"code"in r){const{code:i,params:s}=r;return ye(i,t,s)}return String(r)});return`${ye(n.code,t)}: ${a.join(", ")}`}return ye(n.code,t,n.params,n.message)||n.message||t("config.saveFailed")};function Ei(n=!1){const[t,a]=o.useState(n),[r,i]=o.useState(void 0),[s,c]=o.useState(void 0),[l,u]=o.useState(void 0),m=o.useCallback((j,x)=>{a(!0),j&&(i(j),x&&(u(x),V.loading({content:j,key:x,duration:0})))},[]),d=o.useCallback(j=>{a(!1),i(void 0),c(void 0),l&&(V.destroy(l),j&&V.success({content:j,key:l,duration:2}),u(void 0))},[l]),g=o.useCallback(j=>{c(Math.max(0,Math.min(100,j)))},[]),f=o.useCallback(j=>{i(j),l&&V.loading({content:j,key:l,duration:0})},[l]);return{...o.useMemo(()=>({loading:t,message:r,progress:s}),[t,r,s]),startLoading:m,stopLoading:d,updateProgress:g,updateMessage:f,setLoading:a}}const Ni="config-import";function Di(n){const{t}=H(),a=Be(),{refetch:r}=Ve(),{handleWarning:i,handleSuccess:s,handleError:c}=ke(),{loading:l,startLoading:u,stopLoading:m}=Ei(),d=o.useMemo(()=>{if(!n)return null;const{_meta:h,_validation:y,...E}=n;return E},[n]),g=o.useCallback(()=>{if(!d){i(t("config.configNotLoaded"));return}const h=JSON.stringify(d,null,2),y=new Blob([h],{type:"application/json"}),E=URL.createObjectURL(y),p=document.createElement("a");p.href=E,p.download=`config-${new Date().toISOString().split("T")[0]}.json`,p.click(),URL.revokeObjectURL(E),s(t("config.configExported"))},[d,s,i,t]),f=o.useCallback(async h=>{const y=await new Promise(($,P)=>{const C=new FileReader;C.onload=k=>$(k.target?.result??""),C.onerror=()=>P(new Error(t("config.configReadFailed",{defaultValue:"Failed to read config file"}))),C.readAsText(h)}),E=JSON.parse(y);if(typeof E!="object"||E===null)throw new Error(t("config.configFormatError"));const{_meta:p,_validation:_,...O}=E;return O},[t]),v=o.useCallback(()=>{const h=document.createElement("input");h.type="file",h.accept=".json",h.multiple=!0,h.onchange=async y=>{const E=y.target,p=Array.from(E.files??[]);if(p.length===0)return;u(void 0,Ni);let _=0,O=0;const $=[];let P=null;try{for(const C of p){let k;try{k=await f(C)}catch(D){O++,$.push(`${C.name}: ${D instanceof Error?D.message:t("config.configFormatError")}`);continue}try{const D=await Ze.validateConfig(k);if(!D.valid){const A=Array.isArray(D.errors)&&D.errors.length>0?D.errors.join(", "):t("config.validationFailed");O++,$.push(`${C.name}: ${A}`);continue}}catch(D){console.warn("[Config Import] Validation error:",D)}try{const D=C.name.replace(/\.json$/i,"").replace(/^standalone\.config\./i,""),A=new Date().toISOString().split("T")[0],B=D?`${D}-${A}`:`imported-${A}`;P=(await Ze.importConfigFile(k,B)).path,_++}catch(D){const{message:A}=ze(D);O++,$.push(`${C.name}: ${A||(D instanceof Error?D.message:t("config.unknownError"))}`)}}if(P)try{await Ze.switchConfigFile(P)}catch(C){c(C)}if(await a.invalidateQueries({queryKey:ue.CONFIG}),await a.invalidateQueries({queryKey:ue.CONFIG_FILES}),r(),_>0&&O===0)s(p.length===1?t("config.configImportedAndSaved"):t("config.configBatchImportedSuccess",{count:_}));else if(_>0&&O>0)V.warning(t("config.configBatchImportedPartial",{success:_,total:p.length,failed:O})),console.warn(`[Config Import] Failed files:
14
14
  `,$.join(`
15
- `));else{const C=p.length===1?`${t("config.configImportFailed")}: ${$[0]||t("config.unknownError")}`:t("config.configBatchImportedFailed",{count:O});V.error(C)}}finally{m()}},h.click()},[c,s,f,a,r,u,m,t]),j=o.useCallback(async h=>{try{await navigator.clipboard.writeText(h),s(t("config.configCopied"))}catch(y){c(y,t("config.clipboardCopyFailed",{defaultValue:"Failed to copy config to clipboard"}))}},[c,s,t]),x=o.useCallback(()=>{setTimeout(()=>{window.location.reload()},1e3)},[]),S=o.useCallback(()=>{setTimeout(()=>{window.location.reload()},1e3)},[]);return{handleExportConfig:g,handleImportConfig:v,handleCopyConfig:j,handleConfigFileSwitch:x,handleConfigApplied:S,isImporting:l}}function Ti(){const[n,t]=o.useState(!1),[a,r]=o.useState(!1),[i,s]=o.useState(null),c=o.useCallback(()=>{t(!0)},[]),l=o.useCallback(()=>{t(!1)},[]),u=o.useCallback(d=>{s(d),r(!0)},[]),m=o.useCallback(()=>{r(!1),s(null)},[]);return{previewVisible:n,jsonEditorVisible:a,editingConfigFile:i,openPreview:c,closePreview:l,openJsonEditor:u,closeJsonEditor:m}}function $i(){const[n,t]=o.useState("files"),a=o.useCallback(r=>{t(r)},[]);return{activeTab:n,setActiveTab:a}}const{Title:Fi,Text:Ri}=oe,{Option:Ai}=U;function _i({currentConfigPath:n,configFiles:t,onConfigFileSwitch:a,refetchConfigFiles:r}){const{t:i}=H(),s=Be(),{handleError:c,handleSuccess:l}=ke(),u=t?.find(d=>d.isActive),m=async d=>{const g=t.find(f=>f.filename===d);if(g&&!g.isActive)try{await _e.switchConfigFile(g.path),l(i("config.configSwitched")),await s.invalidateQueries({queryKey:ue.CONFIG}),await s.invalidateQueries({queryKey:ue.CONFIG_FILES}),await Promise.resolve(r()),await Promise.resolve(a())}catch(f){c(f,i("config.configSwitchFailed"))}};return e.jsxs("div",{style:{flex:"1 1 auto",minWidth:200},children:[e.jsx(Fi,{level:2,style:{margin:0,whiteSpace:"normal",wordBreak:"normal"},children:i("config.title")}),e.jsxs(T,{direction:"vertical",size:"small",style:{marginTop:8},children:[e.jsxs(Ri,{type:"secondary",style:{fontSize:12},children:[i("config.currentConfigFile"),": ",n]}),t&&t.length>0&&e.jsx(U,{value:u?.filename||void 0,onChange:m,style:{width:300,fontSize:12},placeholder:i("config.selectConfigFile"),size:"small",children:t.map(d=>e.jsxs(Ai,{value:d.filename,children:[d.isActive&&e.jsx(Ie,{color:"green",style:{marginRight:8},children:i("config.activeConfig")}),d.filename]},d.filename))})]})]})}function Oi({onRefresh:n,onPreview:t,onExport:a,onImport:r,onCopy:i,onValidate:s,onSave:c,isValidating:l,isUpdating:u,isImporting:m=!1}){const{t:d}=H(),{authenticated:g}=At(),f=!g,v=d("common.loginRequired");return e.jsxs(T,{wrap:!0,children:[e.jsx(R,{icon:e.jsx(on,{}),onClick:n,children:d("common.refresh")}),e.jsx(R,{icon:e.jsx(On,{}),onClick:t,children:d("config.previewConfig")}),e.jsx(R,{icon:e.jsx(Et,{}),onClick:a,children:d("config.exportConfig")}),e.jsx(W,{title:f?v:void 0,children:e.jsx(R,{icon:e.jsx(wi,{}),onClick:r,loading:m,disabled:m||f,children:d("config.importConfig")})}),e.jsx(R,{icon:e.jsx(ln,{}),onClick:i,children:d("config.copyConfig")}),e.jsx(R,{icon:e.jsx(Ut,{}),onClick:s,loading:l,children:d("config.validateConfig")}),e.jsx(W,{title:f?v:void 0,children:e.jsx(R,{type:"primary",icon:e.jsx(Gn,{}),onClick:c,loading:u,disabled:f,children:d("config.saveConfig")})})]})}const{Panel:Mi}=Pe,{Title:en,Text:nn}=oe,Ne=({title:n,description:t,children:a,collapsible:r=!1,defaultCollapsed:i=!1,card:s=!0,extra:c,style:l,className:u})=>r?e.jsx(Pe,{defaultActiveKey:i?[]:["1"],style:l,className:u,children:e.jsx(Mi,{header:e.jsxs(T,{direction:"vertical",size:0,children:[e.jsx(en,{level:5,style:{margin:0},children:n}),t&&e.jsx(nn,{type:"secondary",style:{fontSize:12},children:t})]}),extra:c,children:a},"1")}):s?e.jsx(Ee,{title:e.jsxs(T,{direction:"vertical",size:0,children:[e.jsx(en,{level:5,style:{margin:0},children:n}),t&&e.jsx(nn,{type:"secondary",style:{fontSize:12},children:t})]}),extra:c,style:l,className:u,children:a}):e.jsx("div",{style:l,className:u,children:e.jsxs(T,{direction:"vertical",size:8,style:{width:"100%"},children:[e.jsx(en,{level:5,style:{margin:0},children:n}),t&&e.jsx(nn,{type:"secondary",style:{fontSize:12},children:t}),a]})}),{Option:Re}=U,zi=()=>{const{t:n}=H();return e.jsxs(Ne,{title:n("config.tabBasic"),children:[e.jsx(w.Item,{label:e.jsxs(T,{children:[n("config.logLevel"),e.jsx(W,{title:n("config.logLevelTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"logLevel",children:e.jsxs(U,{children:[e.jsx(Re,{value:"debug",children:n("config.logLevelDebug")}),e.jsx(Re,{value:"info",children:n("config.logLevelInfo")}),e.jsx(Re,{value:"warn",children:n("config.logLevelWarn")}),e.jsx(Re,{value:"error",children:n("config.logLevelError")})]})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[n("config.initialDelay"),e.jsx(W,{title:n("config.initialDelayTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"initialDelay",children:e.jsx(K,{min:0,style:{width:"100%"},placeholder:n("config.initialDelayPlaceholder")})})]})},{Option:Ae}=U,Bi=()=>{const{t:n}=H();return e.jsxs(Ne,{title:n("config.tabNetwork"),children:[e.jsx(w.Item,{label:n("config.networkTimeout"),name:["network","timeoutMs"],children:e.jsx(K,{min:1e3,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.networkRetries"),name:["network","retries"],children:e.jsx(K,{min:0,max:10,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.networkRetryDelay"),name:["network","retryDelay"],children:e.jsx(K,{min:0,style:{width:"100%"}})}),e.jsx(Jt,{children:n("config.proxySettings")}),e.jsx(w.Item,{label:n("config.proxyEnabled"),name:["network","proxy","enabled"],valuePropName:"checked",children:e.jsx(Vn,{})}),e.jsx(w.Item,{noStyle:!0,shouldUpdate:(t,a)=>t.network?.proxy?.enabled!==a.network?.proxy?.enabled,children:({getFieldValue:t})=>t(["network","proxy","enabled"])?e.jsxs(e.Fragment,{children:[e.jsx(w.Item,{label:n("config.proxyHost"),name:["network","proxy","host"],children:e.jsx(Q,{})}),e.jsx(w.Item,{label:n("config.proxyPort"),name:["network","proxy","port"],children:e.jsx(K,{min:1,max:65535,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.proxyProtocol"),name:["network","proxy","protocol"],children:e.jsxs(U,{children:[e.jsx(Ae,{value:"http",children:"HTTP"}),e.jsx(Ae,{value:"https",children:"HTTPS"}),e.jsx(Ae,{value:"socks4",children:"SOCKS4"}),e.jsx(Ae,{value:"socks5",children:"SOCKS5"})]})}),e.jsx(w.Item,{label:n("config.proxyUsername"),name:["network","proxy","username"],children:e.jsx(Q,{})}),e.jsx(w.Item,{label:n("config.proxyPassword"),name:["network","proxy","password"],children:e.jsx(Q.Password,{})})]}):null})]})},{Option:z,OptGroup:xe}=U,Vi=()=>{const{t:n}=H();return e.jsxs(Ne,{title:n("config.tabStorage"),children:[e.jsx(w.Item,{label:n("config.storageDatabasePath"),name:["storage","databasePath"],children:e.jsx(Q,{})}),e.jsx(w.Item,{label:n("config.storageDownloadDirectory"),name:["storage","downloadDirectory"],children:e.jsx(Q,{})}),e.jsx(w.Item,{label:n("config.storageIllustrationDirectory"),name:["storage","illustrationDirectory"],children:e.jsx(Q,{})}),e.jsx(w.Item,{label:n("config.storageNovelDirectory"),name:["storage","novelDirectory"],children:e.jsx(Q,{})}),e.jsx(w.Item,{label:n("config.storageIllustrationOrganization"),name:["storage","illustrationOrganization"],tooltip:n("config.storageIllustrationOrganizationTooltip"),children:e.jsxs(U,{children:[e.jsxs(xe,{label:n("config.organizationGroupSimple"),children:[e.jsx(z,{value:"flat",children:n("config.organizationFlat")}),e.jsx(z,{value:"byAuthor",children:n("config.organizationByAuthor")}),e.jsx(z,{value:"byTag",children:n("config.organizationByTag")})]}),e.jsxs(xe,{label:n("config.organizationGroupDate"),children:[e.jsx(z,{value:"byDate",children:n("config.organizationByDate")}),e.jsx(z,{value:"byDay",children:n("config.organizationByDay")}),e.jsx(z,{value:"byDownloadDate",children:n("config.organizationByDownloadDate")}),e.jsx(z,{value:"byDownloadDay",children:n("config.organizationByDownloadDay")})]}),e.jsxs(xe,{label:n("config.organizationGroupCombined"),children:[e.jsx(z,{value:"byAuthorAndTag",children:n("config.organizationByAuthorAndTag")}),e.jsx(z,{value:"byDateAndAuthor",children:n("config.organizationByDateAndAuthor")}),e.jsx(z,{value:"byDayAndAuthor",children:n("config.organizationByDayAndAuthor")}),e.jsx(z,{value:"byDownloadDateAndAuthor",children:n("config.organizationByDownloadDateAndAuthor")}),e.jsx(z,{value:"byDownloadDayAndAuthor",children:n("config.organizationByDownloadDayAndAuthor")})]})]})}),e.jsx(w.Item,{label:n("config.storageNovelOrganization"),name:["storage","novelOrganization"],tooltip:n("config.storageNovelOrganizationTooltip"),children:e.jsxs(U,{children:[e.jsxs(xe,{label:n("config.organizationGroupSimple"),children:[e.jsx(z,{value:"flat",children:n("config.organizationFlat")}),e.jsx(z,{value:"byAuthor",children:n("config.organizationByAuthor")}),e.jsx(z,{value:"byTag",children:n("config.organizationByTag")})]}),e.jsxs(xe,{label:n("config.organizationGroupDate"),children:[e.jsx(z,{value:"byDate",children:n("config.organizationByDate")}),e.jsx(z,{value:"byDay",children:n("config.organizationByDay")}),e.jsx(z,{value:"byDownloadDate",children:n("config.organizationByDownloadDate")}),e.jsx(z,{value:"byDownloadDay",children:n("config.organizationByDownloadDay")})]}),e.jsxs(xe,{label:n("config.organizationGroupCombined"),children:[e.jsx(z,{value:"byAuthorAndTag",children:n("config.organizationByAuthorAndTag")}),e.jsx(z,{value:"byDateAndAuthor",children:n("config.organizationByDateAndAuthor")}),e.jsx(z,{value:"byDayAndAuthor",children:n("config.organizationByDayAndAuthor")}),e.jsx(z,{value:"byDownloadDateAndAuthor",children:n("config.organizationByDownloadDateAndAuthor")}),e.jsx(z,{value:"byDownloadDayAndAuthor",children:n("config.organizationByDownloadDayAndAuthor")})]})]})})]})},Pi=()=>{const{t:n}=H();return e.jsxs(Ne,{title:n("config.tabScheduler"),children:[e.jsx(w.Item,{label:n("config.schedulerEnabled"),name:["scheduler","enabled"],valuePropName:"checked",children:e.jsx(Vn,{})}),e.jsx(w.Item,{label:n("config.schedulerCron"),name:["scheduler","cron"],children:e.jsx(Q,{placeholder:n("config.schedulerCronPlaceholder")})}),e.jsx(w.Item,{label:n("config.schedulerTimezone"),name:["scheduler","timezone"],children:e.jsx(Q,{placeholder:n("config.schedulerTimezonePlaceholder")})}),e.jsx(w.Item,{label:n("config.schedulerMaxExecutions"),name:["scheduler","maxExecutions"],children:e.jsx(K,{min:1,style:{width:"100%"},placeholder:n("config.schedulerMaxExecutionsPlaceholder")})}),e.jsx(w.Item,{label:n("config.schedulerMinInterval"),name:["scheduler","minInterval"],children:e.jsx(K,{min:0,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.schedulerTimeout"),name:["scheduler","timeout"],children:e.jsx(K,{min:1e3,style:{width:"100%"},placeholder:n("config.schedulerTimeoutPlaceholder")})})]})},Li=()=>{const{t:n}=H();return e.jsxs(Ne,{title:n("config.tabDownload"),children:[e.jsx(w.Item,{label:n("config.downloadConcurrency"),name:["download","concurrency"],children:e.jsx(K,{min:1,max:10,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.downloadMaxRetries"),name:["download","maxRetries"],children:e.jsx(K,{min:0,max:10,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.downloadRetryDelay"),name:["download","retryDelay"],children:e.jsx(K,{min:0,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.downloadTimeout"),name:["download","timeout"],children:e.jsx(K,{min:1e3,style:{width:"100%"}})})]})},{Option:L}=U,{Panel:tn}=Pe,{Step:Tn}=Pn,{Text:Hi,Paragraph:Wi}=oe,Gi=({visible:n,editingTarget:t,onSave:a,onCancel:r})=>{const{t:i}=H(),[s]=w.useForm(),[c,l]=o.useState(0),u={tagSearch:{name:i("config.templateTagSearch"),description:i("config.templateTagSearchDesc"),config:{type:"illustration",mode:"search",tag:"",limit:20,searchTarget:"partial_match_for_tags",sort:"date_desc"}},ranking:{name:i("config.templateRanking"),description:i("config.templateRankingDesc"),config:{type:"illustration",mode:"ranking",rankingMode:"day",limit:30}},multiTag:{name:i("config.templateMultiTag"),description:i("config.templateMultiTagDesc"),config:{type:"illustration",mode:"search",tag:"",limit:30,searchTarget:"partial_match_for_tags"}},highQuality:{name:i("config.templateHighQuality"),description:i("config.templateHighQualityDesc"),config:{type:"illustration",mode:"search",tag:"",limit:20,minBookmarks:1e3,sort:"popular_desc"}},novel:{name:i("config.templateNovel"),description:i("config.templateNovelDesc"),config:{type:"novel",mode:"search",tag:"",limit:10}}};o.useEffect(()=>{n&&(t?(s.setFieldsValue(t),l(1)):(s.resetFields(),l(0)))},[n,t,s]);const m=f=>{s.setFieldsValue(f.config),l(1)},d=async()=>{try{const f=await s.validateFields();a(f),s.resetFields(),l(0)}catch{}},g=()=>{s.resetFields(),l(0),r()};return e.jsxs(cn,{title:e.jsxs(T,{children:[i(t?"config.editTarget":"config.addTarget"),!t&&e.jsx(W,{title:i("config.templateTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),open:n,onOk:d,onCancel:g,width:800,okText:i("common.save"),cancelText:i("common.cancel"),children:[e.jsxs(Pn,{current:c,style:{marginBottom:24},children:[e.jsx(Tn,{title:i("config.stepSelectTemplate"),description:i("config.stepSelectTemplateDesc")}),e.jsx(Tn,{title:i("config.stepConfigure"),description:i("config.stepConfigureDesc")})]}),c===0&&!t&&e.jsxs("div",{children:[e.jsx(Wi,{type:"secondary",style:{marginBottom:16},children:i("config.templateSelectDescription")}),e.jsxs(T,{direction:"vertical",style:{width:"100%"},size:"middle",children:[Object.entries(u).map(([f,v])=>e.jsx(Ee,{hoverable:!0,style:{cursor:"pointer"},onClick:()=>m(v),children:e.jsxs(T,{style:{width:"100%",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsx(oe.Title,{level:5,style:{margin:0},children:v.name}),e.jsx(Hi,{type:"secondary",children:v.description})]}),e.jsx(R,{type:"primary",icon:e.jsx(Ln,{}),children:i("config.useTemplate")})]})},f)),e.jsx(R,{block:!0,type:"dashed",onClick:()=>l(1),style:{marginTop:8},children:i("config.skipTemplate")})]})]}),c===1&&e.jsx(w,{form:s,layout:"vertical",children:e.jsxs(Pe,{defaultActiveKey:["basic"],ghost:!0,children:[e.jsxs(tn,{header:i("config.targetBasicSettings"),children:[e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.targetType"),e.jsx(W,{title:i("config.targetTypeTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"type",rules:[{required:!0,message:i("config.targetTypeRequired")}],children:e.jsxs(U,{children:[e.jsx(L,{value:"illustration",children:i("config.typeIllustration")}),e.jsx(L,{value:"novel",children:i("config.typeNovel")})]})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.targetMode"),e.jsx(W,{title:i("config.targetModeTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"mode",initialValue:"search",children:e.jsxs(U,{children:[e.jsx(L,{value:"search",children:i("config.modeSearch")}),e.jsx(L,{value:"ranking",children:i("config.modeRanking")})]})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.targetLimit"),e.jsx(W,{title:i("config.targetLimitTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"limit",rules:[{type:"number",min:1,max:1e3,message:i("config.targetLimitRange")}],children:e.jsx(K,{min:1,max:1e3,style:{width:"100%"},placeholder:i("config.targetLimitPlaceholder")})})]},"basic"),e.jsx(tn,{header:i("config.targetModeSettings"),children:e.jsx(w.Item,{noStyle:!0,shouldUpdate:(f,v)=>f.mode!==v.mode,children:({getFieldValue:f})=>(f("mode")||"search")==="search"?e.jsxs(e.Fragment,{children:[e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.targetTag"),e.jsx(W,{title:i("config.targetTagTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"tag",rules:[{validator:(j,x)=>!x||x.trim()===""?Promise.reject(new Error(i("config.targetTagRequired"))):Promise.resolve()}],children:e.jsx(Q,{placeholder:i("config.targetTagPlaceholder")})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.searchTarget"),e.jsx(W,{title:i("config.searchTargetTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"searchTarget",initialValue:"partial_match_for_tags",children:e.jsxs(U,{children:[e.jsxs(L,{value:"partial_match_for_tags",children:[i("config.searchTargetPartial")," (",i("common.recommended"),")"]}),e.jsx(L,{value:"exact_match_for_tags",children:i("config.searchTargetExact")}),e.jsx(L,{value:"title_and_caption",children:i("config.searchTargetTitle")})]})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.sort"),e.jsx(W,{title:i("config.sortTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"sort",initialValue:"date_desc",children:e.jsxs(U,{children:[e.jsx(L,{value:"date_desc",children:i("config.sortDateDesc")}),e.jsx(L,{value:"date_asc",children:i("config.sortDateAsc")}),e.jsx(L,{value:"popular_desc",children:i("config.sortPopularDesc")})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.rankingMode"),e.jsx(W,{title:i("config.rankingModeTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"rankingMode",initialValue:"day",children:e.jsxs(U,{children:[e.jsx(L,{value:"day",children:i("config.rankingDay")}),e.jsx(L,{value:"week",children:i("config.rankingWeek")}),e.jsx(L,{value:"month",children:i("config.rankingMonth")}),e.jsx(L,{value:"day_male",children:i("config.rankingDayMale")}),e.jsx(L,{value:"day_female",children:i("config.rankingDayFemale")}),e.jsx(L,{value:"day_ai",children:i("config.rankingDayAI")}),e.jsx(L,{value:"week_original",children:i("config.rankingWeekOriginal")}),e.jsx(L,{value:"week_rookie",children:i("config.rankingWeekRookie")})]})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.rankingDate"),e.jsx(W,{title:i("config.rankingDateTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"rankingDate",children:e.jsx(Q,{placeholder:i("config.rankingDatePlaceholder")})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.filterTag"),e.jsx(W,{title:i("config.filterTagTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"filterTag",children:e.jsx(Q,{placeholder:i("config.filterTagPlaceholder")})})]})})},"mode"),e.jsxs(tn,{header:i("config.targetAdvancedFilters"),children:[e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.minBookmarks"),e.jsx(W,{title:i("config.minBookmarksTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"minBookmarks",children:e.jsx(K,{min:0,style:{width:"100%"},placeholder:i("config.minBookmarksPlaceholder")})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.startDate"),e.jsx(W,{title:i("config.startDateTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"startDate",children:e.jsx(Q,{placeholder:i("config.startDatePlaceholder")})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.endDate"),e.jsx(W,{title:i("config.endDateTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"endDate",children:e.jsx(Q,{placeholder:i("config.endDatePlaceholder")})})]},"advanced")]})})]})};function qi(){const{t:n}=H();return e.jsx(Ce,{message:n("config.targetsTitle"),description:n("config.targetsDescription"),type:"info",showIcon:!0})}const{Text:Z}=oe;function Ui({targets:n,onAdd:t,onEdit:a,onDelete:r}){const{t:i}=H(),s=o.useMemo(()=>[{title:i("config.targetType"),dataIndex:"type",key:"type",width:100,render:c=>e.jsx(Ie,{color:c==="illustration"?"blue":"green",children:i(c==="illustration"?"config.typeIllustration":"config.typeNovel")})},{title:i("config.targetMode"),dataIndex:"mode",key:"mode",width:100,render:c=>c?e.jsx(Ie,{color:c==="ranking"?"purple":"cyan",children:i(c==="ranking"?"config.modeRanking":"config.modeSearch")}):"-"},{title:i("config.targetConfig"),key:"config",render:(c,l)=>{if(l.mode==="ranking"){const u={day:i("config.rankingDay"),week:i("config.rankingWeek"),month:i("config.rankingMonth"),day_male:i("config.rankingDayMale"),day_female:i("config.rankingDayFemale"),day_ai:i("config.rankingDayAI"),week_original:i("config.rankingWeekOriginal"),week_rookie:i("config.rankingWeekRookie")};return e.jsxs(T,{direction:"vertical",size:"small",style:{fontSize:12},children:[e.jsx(Z,{strong:!0,children:u[l.rankingMode||"day"]||l.rankingMode}),l.filterTag&&e.jsxs(Z,{type:"secondary",children:[i("config.filterTag"),": ",l.filterTag]}),l.rankingDate&&e.jsxs(Z,{type:"secondary",children:[i("config.rankingDate"),": ",l.rankingDate]})]})}return l.seriesId?e.jsxs(Z,{children:[i("config.seriesId"),": ",l.seriesId]}):l.novelId?e.jsxs(Z,{children:[i("config.novelId"),": ",l.novelId]}):e.jsxs(T,{direction:"vertical",size:"small",style:{fontSize:12},children:[e.jsx(Z,{strong:!0,children:l.tag||"-"}),l.searchTarget&&e.jsx(Z,{type:"secondary",children:l.searchTarget==="partial_match_for_tags"?i("config.searchTargetPartial"):l.searchTarget==="exact_match_for_tags"?i("config.searchTargetExact"):i("config.searchTargetTitle")}),l.sort&&e.jsx(Z,{type:"secondary",children:l.sort==="date_desc"?i("config.sortDateDesc"):l.sort==="date_asc"?i("config.sortDateAsc"):i("config.sortPopularDesc")})]})}},{title:i("config.targetFilters"),key:"filters",width:150,render:(c,l)=>e.jsxs(T,{direction:"vertical",size:"small",style:{fontSize:12},children:[l.limit&&e.jsxs(Z,{children:[i("config.limit"),": ",l.limit]}),l.minBookmarks&&e.jsxs(Z,{type:"secondary",children:[i("config.minBookmarks")," ≥ ",l.minBookmarks]}),(l.startDate||l.endDate)&&e.jsxs(Z,{type:"secondary",children:[l.startDate&&`${i("config.from")} ${l.startDate}`,l.endDate&&` ${i("config.to")} ${l.endDate}`]})]})},{title:i("common.actions"),key:"action",width:150,render:(c,l,u)=>e.jsxs(T,{children:[e.jsx(R,{type:"link",icon:e.jsx(Bn,{}),onClick:()=>a(l,u),size:"small",children:i("common.edit")}),e.jsx(dn,{title:i("config.deleteTargetConfirm"),onConfirm:()=>r(u),okText:i("common.ok"),cancelText:i("common.cancel"),children:e.jsx(R,{type:"link",danger:!0,icon:e.jsx(un,{}),size:"small",children:i("common.delete")})})]})}],[r,a,i]);return e.jsx(Ee,{title:i("config.targetsList"),extra:e.jsx(R,{icon:e.jsx(Ln,{}),onClick:t,children:i("config.addTarget")}),children:e.jsx(sn,{columns:s,dataSource:n,rowKey:c=>c._rowKey?c._rowKey:String(c._index??c.tag??c.mode??"target"),pagination:!1,locale:{emptyText:i("config.targetsEmpty")}})})}const Ki=({form:n,onTargetChange:t})=>{const[a,r]=o.useState(!1),[i,s]=o.useState(null);o.useEffect(()=>{const j=n.getFieldValue("targets");Array.isArray(j)||n.setFieldsValue({targets:[]})},[n]);const c=w.useWatch("targets",n)||n.getFieldValue("targets")||[],l=o.useCallback(()=>{t&&t()},[t]),u=o.useCallback(()=>{s(null),r(!0)},[]),m=o.useCallback((j,x)=>{s({...j,_index:x}),r(!0)},[]),d=o.useCallback(j=>{const S=(n.getFieldValue("targets")||[]).filter((h,y)=>y!==j);n.setFieldsValue({targets:S}),l()},[n,l]),g=o.useCallback(j=>{const S=[...n.getFieldValue("targets")||[]];i&&typeof i._index=="number"?S[i._index]=j:S.push(j),n.setFieldsValue({targets:S}),r(!1),s(null),l()},[i,n,l]),f=o.useCallback(()=>{r(!1),s(null)},[]),v=o.useMemo(()=>c.map((j,x)=>({...j,_index:x,_rowKey:`${j.type||"target"}-${x}`})),[c]);return e.jsxs(e.Fragment,{children:[e.jsx(w.Item,{name:"targets",hidden:!0,children:e.jsx("input",{type:"hidden"})}),e.jsxs(T,{direction:"vertical",style:{width:"100%"},size:"large",children:[e.jsx(qi,{}),e.jsx(Ui,{targets:v,onAdd:u,onEdit:m,onDelete:d})]}),e.jsx(Gi,{visible:a,editingTarget:i,onSave:g,onCancel:f})]})},qn=({value:n,onChange:t,language:a="text",readOnly:r=!1,placeholder:i="Enter code...",minHeight:s=200,maxHeight:c=600,showCopyButton:l=!0,style:u,className:m})=>{const d=o.useRef(null),[g,f]=o.useState(!1),v=h=>{t&&t(h.target.value)},j=async()=>{try{await navigator.clipboard.writeText(n),f(!0),V.success("Copied to clipboard"),setTimeout(()=>f(!1),2e3)}catch{V.error("Failed to copy")}},x=h=>{if(a==="json"&&!r){const y=h.clipboardData.getData("text");try{const E=JSON.parse(y),p=JSON.stringify(E,null,2);h.preventDefault(),t&&t(p)}catch{}}},S={fontFamily:'Monaco, Menlo, "Ubuntu Mono", Consolas, "source-code-pro", monospace',fontSize:"14px",lineHeight:"1.6",padding:"12px",border:"1px solid #d9d9d9",borderRadius:"4px",backgroundColor:a==="json"?"#1f1f1f":"#fff",color:a==="json"?"#fff":"#000",minHeight:`${s}px`,maxHeight:`${c}px`,overflow:"auto",resize:"vertical",width:"100%",...u};return e.jsxs("div",{className:m,children:[l&&e.jsx(T,{style:{marginBottom:8,justifyContent:"flex-end",width:"100%"},children:e.jsx(R,{size:"small",icon:g?e.jsx(Nt,{}):e.jsx(ln,{}),onClick:j,disabled:!n,children:g?"Copied":"Copy"})}),e.jsx("textarea",{ref:d,value:n,onChange:v,onPaste:x,readOnly:r,placeholder:i,style:S,spellCheck:!1})]})},Un=({visible:n,filename:t,onClose:a,onConfigFileSwitch:r})=>{const{t:i}=H(),s=Be(),{configFiles:c,refetch:l}=Ve(),[u,m]=o.useState(""),[d,g]=o.useState(!1),[f,v]=o.useState(""),[j,x]=o.useState(!1),[S,h]=o.useState(!1),y=o.useRef(""),E=o.useRef(""),p=o.useRef(!1);o.useEffect(()=>{n&&t?_():(m(""),v(""),x(!1),y.current="",E.current="")},[n,t]),o.useEffect(()=>{if(!n||!t||p.current)return;let C,k=!0;const D=async()=>{if(!(!k||!t||p.current))try{const B=(await _e.getConfigFileContent(t)).data.data.content,J=y.current,te=E.current;B!==J&&B!==te&&!p.current?(x(!0),v(B),y.current=B):B===te?(x(!1),v(B),y.current=B):p.current||(v(B),y.current=B)}catch(A){console.warn("Failed to poll config file content:",A)}};return D(),C=setInterval(()=>{p.current||D()},5e3),()=>{k=!1,C&&clearInterval(C)}},[n,t,S]),o.useEffect(()=>{y.current=f},[f]),o.useEffect(()=>{E.current=u},[u]),o.useEffect(()=>{p.current=S},[S]);const _=async()=>{try{g(!0);const k=(await _e.getConfigFileContent(t)).data.data.content;m(k),v(k),y.current=k,E.current=k,x(!1)}catch(C){const{message:k}=ze(C),D=C instanceof Error?C.message:void 0;V.error(`${i("config.configFileReadFailed")}: ${k||D||i("config.unknownError")}`)}finally{g(!1)}},O=async()=>{await _(),V.success(i("config.jsonEditorRefreshed"))},$=async()=>{if(t)try{g(!0);try{JSON.parse(u)}catch{V.error(i("config.jsonFormatError"));return}await _e.updateConfigFileContent(t,u),V.success(i("config.configSaved")),v(u),y.current=u,E.current=u,x(!1),h(!1),p.current=!1,await s.invalidateQueries({queryKey:ue.CONFIG}),await s.invalidateQueries({queryKey:ue.CONFIG_FILES}),l(),c?.find(k=>k.filename===t&&k.isActive)?r?r():setTimeout(()=>{window.location.reload()},1e3):a()}catch(C){const{errorCode:k,message:D,details:A}=ze(C);if(k==="CONFIG_INVALID"&&A&&Array.isArray(A)){const B=A.map(J=>{if(typeof J=="object"&&J!==null&&"code"in J){const te=J;return ye(te.code,i,te.params)}return String(J)});V.error(`${ye(k,i)}: ${B.join(", ")}`)}else V.error(D||i("config.configSaveFailed"))}finally{g(!1)}},P=()=>{try{const C=JSON.parse(u),k=JSON.stringify(C,null,2);m(k),V.success(i("config.jsonFormatted"))}catch{V.error(i("config.jsonFormatError"))}};return e.jsx(cn,{title:e.jsxs(T,{children:[i("config.editJson"),e.jsxs("span",{style:{color:"#999",fontSize:14},children:["(",t,")"]})]}),open:n,onCancel:a,width:900,footer:[e.jsx(R,{onClick:P,children:i("config.formatJson")},"format"),e.jsx(R,{onClick:a,children:i("common.cancel")},"cancel"),e.jsx(R,{type:"primary",icon:e.jsx(Gn,{}),loading:d,onClick:$,children:i("config.saveConfig")},"save")],children:e.jsxs(Dt,{spinning:d&&!u,children:[j&&e.jsx(Ce,{message:i("config.jsonEditorExternalChanges"),description:i("config.jsonEditorExternalChangesDesc"),type:"warning",showIcon:!0,style:{marginBottom:16},action:e.jsx(R,{size:"small",onClick:O,children:i("config.refresh")})}),e.jsx(qn,{value:u,onChange:C=>{m(C),h(!0),p.current=!0,j&&C!==f&&x(!1)},language:"json",minHeight:400,maxHeight:600,placeholder:i("config.jsonEditorPlaceholder")}),e.jsx(Ce,{message:i("config.jsonEditorWarning"),type:"warning",showIcon:!0,style:{marginTop:16}})]})})},{Text:$n}=oe,Ji=({onConfigFileSwitch:n,onJsonEditorOpen:t})=>{const{t:a}=H(),{configFiles:r,isLoading:i,refetch:s,switchFileAsync:c,deleteFileAsync:l}=Ve(),{handleError:u}=ke(),[m,d]=o.useState(!1),[g,f]=o.useState(null),v=async h=>{if(t){t(h);return}try{f(h),d(!0)}catch(y){const{message:E}=ze(y),p=y instanceof Error?y:null;V.error(`${a("config.configFileReadFailed")}: ${E||p?.message||a("config.unknownError")}`)}},j=async h=>{if(!h.isActive)try{await c(h.path),V.success(a("config.configSwitched")),n&&n()}catch(y){u(y)}},x=async h=>{try{await l(h),V.success(a("config.configFileDeleted")),s()}catch(y){u(y)}},S=[{title:a("config.fileName"),dataIndex:"filename",key:"filename",render:(h,y)=>e.jsxs(T,{children:[e.jsx($n,{strong:y.isActive,children:h}),y.isActive&&e.jsx(Ie,{color:"green",children:a("config.activeConfig")})]})},{title:a("config.filePath"),dataIndex:"pathRelative",key:"pathRelative",render:h=>e.jsx($n,{type:"secondary",style:{fontSize:12},children:h})},{title:a("config.fileModified"),dataIndex:"modifiedTime",key:"modifiedTime",render:h=>new Date(h).toLocaleString()},{title:a("config.fileSize"),dataIndex:"size",key:"size",render:h=>`${(h/1024).toFixed(2)} KB`},{title:a("common.actions"),key:"action",width:250,render:(h,y)=>e.jsxs(T,{children:[e.jsx(R,{type:"link",icon:e.jsx(Bn,{}),onClick:()=>v(y.filename),size:"small",children:a("config.editJson")}),!y.isActive&&e.jsx(R,{type:"link",icon:e.jsx(Mn,{}),onClick:()=>j(y),size:"small",children:a("config.switch")}),e.jsx(dn,{title:a("config.deleteConfigFileConfirm"),onConfirm:()=>x(y.filename),okText:a("common.ok"),cancelText:a("common.cancel"),children:e.jsx(R,{type:"link",danger:!0,icon:e.jsx(un,{}),size:"small",children:a("common.delete")})})]})}];return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{title:a("config.configFiles"),extra:e.jsx(R,{icon:e.jsx(on,{}),onClick:()=>s(),children:a("common.refresh")}),children:r&&r.length>0?e.jsx(sn,{columns:S,dataSource:r,rowKey:"filename",loading:i,pagination:{pageSize:10},locale:{emptyText:a("config.configFilesEmpty")}}):e.jsx(Ce,{message:a("config.configFilesEmpty"),description:a("config.configFilesEmptyDesc"),type:"info",showIcon:!0})}),m&&g&&e.jsx(Un,{visible:m,filename:g,onClose:()=>{d(!1),f(null)},onConfigFileSwitch:n})]})},{Text:Fn}=oe,Qi=({onConfigApplied:n})=>{const{t}=H(),{history:a,isLoading:r,refetch:i,applyAsync:s,deleteAsync:c}=Rt(),{handleError:l}=ke(),u=async g=>{try{await s(g),V.success(t("config.configApplied")),n&&n()}catch(f){l(f)}},m=async g=>{try{await c(g),V.success(t("config.historyDeleted")),i()}catch(f){l(f)}},d=[{title:t("config.historyName"),dataIndex:"name",key:"name",render:(g,f)=>e.jsxs(T,{children:[e.jsx(Fn,{strong:f.is_active===1,children:g}),f.is_active===1&&e.jsx(Ie,{color:"green",children:t("config.activeConfig")})]})},{title:t("config.historyDescription"),dataIndex:"description",key:"description",render:g=>g||e.jsx(Fn,{type:"secondary",children:"-"})},{title:t("config.historyCreatedAt"),dataIndex:"created_at",key:"created_at",render:g=>new Date(g).toLocaleString()},{title:t("config.historyUpdatedAt"),dataIndex:"updated_at",key:"updated_at",render:g=>new Date(g).toLocaleString()},{title:t("common.actions"),key:"action",width:200,render:(g,f)=>e.jsxs(T,{children:[e.jsx(R,{type:"link",icon:e.jsx(Mn,{}),onClick:()=>u(f.id),size:"small",children:t("config.apply")}),e.jsx(dn,{title:t("config.deleteHistoryConfirm"),onConfirm:()=>m(f.id),okText:t("common.ok"),cancelText:t("common.cancel"),children:e.jsx(R,{type:"link",danger:!0,icon:e.jsx(un,{}),size:"small",children:t("common.delete")})})]})}];return e.jsx(Ee,{title:t("config.configHistory"),extra:e.jsx(R,{icon:e.jsx(on,{}),onClick:()=>i(),children:t("common.refresh")}),children:a&&a.length>0?e.jsx(sn,{columns:d,dataSource:a,rowKey:"id",loading:r,pagination:{pageSize:10},locale:{emptyText:t("config.historyEmpty")}}):e.jsx(Ce,{message:t("config.historyEmpty"),description:t("config.historyEmptyDesc"),type:"info",showIcon:!0})})},{Text:Xi}=oe;function Yi({form:n,onConfigFileSwitch:t,onJsonEditorOpen:a,onConfigApplied:r,onTargetChange:i}){const{t:s}=H(),c=o.useMemo(()=>[{key:"files",label:e.jsxs(e.Fragment,{children:[e.jsx(On,{})," ",s("config.tabConfigFiles")]}),children:e.jsx(Ji,{onConfigFileSwitch:t,onJsonEditorOpen:a})},{key:"history",label:e.jsxs(e.Fragment,{children:[e.jsx(Tt,{})," ",s("config.tabHistory")]}),children:e.jsx(Qi,{onConfigApplied:r})}],[r,t,a,s]),l=o.useMemo(()=>[{key:"basic",label:s("config.tabBasic"),children:e.jsx(zi,{})},{key:"pixiv",label:s("config.tabPixiv"),children:e.jsx("div",{children:e.jsx(Xi,{type:"secondary",children:s("config.pixivCredentialsHidden")})})},{key:"network",label:s("config.tabNetwork"),children:e.jsx(Bi,{})},{key:"storage",label:s("config.tabStorage"),children:e.jsx(Vi,{})},{key:"scheduler",label:s("config.tabScheduler"),children:e.jsx(Pi,{})},{key:"download",label:s("config.tabDownload"),children:e.jsx(Li,{})},{key:"targets",label:s("config.tabTargets"),children:e.jsx(Ki,{form:n,onTargetChange:i})}],[n,i,s]),u=o.useMemo(()=>[...c||[],...l||[]],[l,c]);return{managementTabItems:c,formTabItems:l,tabItems:u}}function Zi({form:n,activeTab:t,onTabChange:a,onConfigFileSwitch:r,onJsonEditorOpen:i,onConfigApplied:s,onTargetChange:c}){const{tabItems:l}=Yi({form:n,onConfigFileSwitch:r,onJsonEditorOpen:i,onConfigApplied:s,onTargetChange:c});return e.jsx(w,{form:n,layout:"vertical",children:e.jsx(Kt,{activeKey:t,onChange:a,items:l})})}function ea({visible:n,configPreview:t,onClose:a}){const{t:r}=H(),i=()=>{navigator.clipboard.writeText(t),V.success(r("config.configCopied"))};return e.jsx(cn,{title:r("config.previewConfig"),open:n,onCancel:a,footer:[e.jsx(R,{icon:e.jsx(ln,{}),onClick:i,children:r("common.copy")},"copy"),e.jsx(R,{onClick:a,children:r("common.close")},"close")],width:800,children:e.jsx(qn,{value:t,readOnly:!0,language:"json",minHeight:400,maxHeight:600})})}function xa(){const{t:n}=H(),{activeTab:t,setActiveTab:a}=$i(),{previewVisible:r,jsonEditorVisible:i,editingConfigFile:s,openPreview:c,closePreview:l,openJsonEditor:u,closeJsonEditor:m}=Ti(),{form:d,config:g,isLoading:f,isUpdating:v,isValidating:j,handleSave:x,handleValidate:S,handleTargetChange:h,getConfigPreview:y,refreshConfig:E}=Si(),{handleExportConfig:p,handleImportConfig:_,handleCopyConfig:O,handleConfigFileSwitch:$,handleConfigApplied:P,isImporting:C}=Di(g),{configFiles:k,refetch:D}=Ve();if(f)return e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"48px 0"},children:e.jsx($t,{})});const A=g?._meta?.configPathRelative??g?._meta?.configPath??n("config.unknown");return e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:16,width:"100%",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:16,flexWrap:"wrap"},children:[e.jsx(_i,{currentConfigPath:A,configFiles:k,onConfigFileSwitch:$,refetchConfigFiles:D}),e.jsx(Oi,{onRefresh:E,onPreview:c,onExport:p,onImport:_,onCopy:()=>O(y()),onValidate:S,onSave:x,isValidating:j,isUpdating:v,isImporting:C})]}),e.jsx(Zi,{form:d,activeTab:t,onTabChange:a,onConfigFileSwitch:$,onJsonEditorOpen:u,onConfigApplied:P,onTargetChange:h}),e.jsx(ea,{visible:r,configPreview:y(),onClose:l}),i&&s&&e.jsx(Un,{visible:i,filename:s,onClose:m,onConfigFileSwitch:$})]})}export{xa as default};
16
- //# sourceMappingURL=Config-DRElCeDC.js.map
15
+ `));else{const C=p.length===1?`${t("config.configImportFailed")}: ${$[0]||t("config.unknownError")}`:t("config.configBatchImportedFailed",{count:O});V.error(C)}}finally{m()}},h.click()},[c,s,f,a,r,u,m,t]),j=o.useCallback(async h=>{try{await navigator.clipboard.writeText(h),s(t("config.configCopied"))}catch(y){c(y,t("config.clipboardCopyFailed",{defaultValue:"Failed to copy config to clipboard"}))}},[c,s,t]),x=o.useCallback(()=>{setTimeout(()=>{window.location.reload()},1e3)},[]),S=o.useCallback(()=>{setTimeout(()=>{window.location.reload()},1e3)},[]);return{handleExportConfig:g,handleImportConfig:v,handleCopyConfig:j,handleConfigFileSwitch:x,handleConfigApplied:S,isImporting:l}}function Ti(){const[n,t]=o.useState(!1),[a,r]=o.useState(!1),[i,s]=o.useState(null),c=o.useCallback(()=>{t(!0)},[]),l=o.useCallback(()=>{t(!1)},[]),u=o.useCallback(d=>{s(d),r(!0)},[]),m=o.useCallback(()=>{r(!1),s(null)},[]);return{previewVisible:n,jsonEditorVisible:a,editingConfigFile:i,openPreview:c,closePreview:l,openJsonEditor:u,closeJsonEditor:m}}function $i(){const[n,t]=o.useState("files"),a=o.useCallback(r=>{t(r)},[]);return{activeTab:n,setActiveTab:a}}const{Title:Fi,Text:Ri}=oe,{Option:Ai}=U;function _i({currentConfigPath:n,configFiles:t,onConfigFileSwitch:a,refetchConfigFiles:r}){const{t:i}=H(),s=Be(),{handleError:c,handleSuccess:l}=ke(),u=t?.find(d=>d.isActive),m=async d=>{const g=t.find(f=>f.filename===d);if(g&&!g.isActive)try{await _e.switchConfigFile(g.path),l(i("config.configSwitched")),await s.invalidateQueries({queryKey:ue.CONFIG}),await s.invalidateQueries({queryKey:ue.CONFIG_FILES}),await Promise.resolve(r()),await Promise.resolve(a())}catch(f){c(f,i("config.configSwitchFailed"))}};return e.jsxs("div",{style:{flex:"1 1 auto",minWidth:200},children:[e.jsx(Fi,{level:2,style:{margin:0,whiteSpace:"normal",wordBreak:"normal"},children:i("config.title")}),e.jsxs(T,{direction:"vertical",size:"small",style:{marginTop:8},children:[e.jsxs(Ri,{type:"secondary",style:{fontSize:12},children:[i("config.currentConfigFile"),": ",n]}),t&&t.length>0&&e.jsx(U,{value:u?.filename||void 0,onChange:m,style:{width:300,fontSize:12},placeholder:i("config.selectConfigFile"),size:"small",children:t.map(d=>e.jsxs(Ai,{value:d.filename,children:[d.isActive&&e.jsx(Ie,{color:"green",style:{marginRight:8},children:i("config.activeConfig")}),d.filename]},d.filename))})]})]})}function Oi({onRefresh:n,onPreview:t,onExport:a,onImport:r,onCopy:i,onValidate:s,onSave:c,isValidating:l,isUpdating:u,isImporting:m=!1}){const{t:d}=H(),{authenticated:g}=At(),f=!g,v=d("common.loginRequired");return e.jsxs(T,{wrap:!0,children:[e.jsx(R,{icon:e.jsx(on,{}),onClick:n,children:d("common.refresh")}),e.jsx(R,{icon:e.jsx(On,{}),onClick:t,children:d("config.previewConfig")}),e.jsx(R,{icon:e.jsx(Et,{}),onClick:a,children:d("config.exportConfig")}),e.jsx(W,{title:f?v:void 0,children:e.jsx(R,{icon:e.jsx(wi,{}),onClick:r,loading:m,disabled:m||f,children:d("config.importConfig")})}),e.jsx(R,{icon:e.jsx(sn,{}),onClick:i,children:d("config.copyConfig")}),e.jsx(R,{icon:e.jsx(Ut,{}),onClick:s,loading:l,children:d("config.validateConfig")}),e.jsx(W,{title:f?v:void 0,children:e.jsx(R,{type:"primary",icon:e.jsx(Gn,{}),onClick:c,loading:u,disabled:f,children:d("config.saveConfig")})})]})}const{Panel:Mi}=Pe,{Title:en,Text:nn}=oe,Ne=({title:n,description:t,children:a,collapsible:r=!1,defaultCollapsed:i=!1,card:s=!0,extra:c,style:l,className:u})=>r?e.jsx(Pe,{defaultActiveKey:i?[]:["1"],style:l,className:u,children:e.jsx(Mi,{header:e.jsxs(T,{direction:"vertical",size:0,children:[e.jsx(en,{level:5,style:{margin:0},children:n}),t&&e.jsx(nn,{type:"secondary",style:{fontSize:12},children:t})]}),extra:c,children:a},"1")}):s?e.jsx(Ee,{title:e.jsxs(T,{direction:"vertical",size:0,children:[e.jsx(en,{level:5,style:{margin:0},children:n}),t&&e.jsx(nn,{type:"secondary",style:{fontSize:12},children:t})]}),extra:c,style:l,className:u,children:a}):e.jsx("div",{style:l,className:u,children:e.jsxs(T,{direction:"vertical",size:8,style:{width:"100%"},children:[e.jsx(en,{level:5,style:{margin:0},children:n}),t&&e.jsx(nn,{type:"secondary",style:{fontSize:12},children:t}),a]})}),{Option:Re}=U,zi=()=>{const{t:n}=H();return e.jsxs(Ne,{title:n("config.tabBasic"),children:[e.jsx(w.Item,{label:e.jsxs(T,{children:[n("config.logLevel"),e.jsx(W,{title:n("config.logLevelTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"logLevel",children:e.jsxs(U,{children:[e.jsx(Re,{value:"debug",children:n("config.logLevelDebug")}),e.jsx(Re,{value:"info",children:n("config.logLevelInfo")}),e.jsx(Re,{value:"warn",children:n("config.logLevelWarn")}),e.jsx(Re,{value:"error",children:n("config.logLevelError")})]})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[n("config.initialDelay"),e.jsx(W,{title:n("config.initialDelayTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"initialDelay",children:e.jsx(K,{min:0,style:{width:"100%"},placeholder:n("config.initialDelayPlaceholder")})})]})},{Option:Ae}=U,Bi=()=>{const{t:n}=H();return e.jsxs(Ne,{title:n("config.tabNetwork"),children:[e.jsx(w.Item,{label:n("config.networkTimeout"),name:["network","timeoutMs"],children:e.jsx(K,{min:1e3,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.networkRetries"),name:["network","retries"],children:e.jsx(K,{min:0,max:10,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.networkRetryDelay"),name:["network","retryDelay"],children:e.jsx(K,{min:0,style:{width:"100%"}})}),e.jsx(Jt,{children:n("config.proxySettings")}),e.jsx(w.Item,{label:n("config.proxyEnabled"),name:["network","proxy","enabled"],valuePropName:"checked",children:e.jsx(Vn,{})}),e.jsx(w.Item,{noStyle:!0,shouldUpdate:(t,a)=>t.network?.proxy?.enabled!==a.network?.proxy?.enabled,children:({getFieldValue:t})=>t(["network","proxy","enabled"])?e.jsxs(e.Fragment,{children:[e.jsx(w.Item,{label:n("config.proxyHost"),name:["network","proxy","host"],children:e.jsx(Q,{})}),e.jsx(w.Item,{label:n("config.proxyPort"),name:["network","proxy","port"],children:e.jsx(K,{min:1,max:65535,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.proxyProtocol"),name:["network","proxy","protocol"],children:e.jsxs(U,{children:[e.jsx(Ae,{value:"http",children:"HTTP"}),e.jsx(Ae,{value:"https",children:"HTTPS"}),e.jsx(Ae,{value:"socks4",children:"SOCKS4"}),e.jsx(Ae,{value:"socks5",children:"SOCKS5"})]})}),e.jsx(w.Item,{label:n("config.proxyUsername"),name:["network","proxy","username"],children:e.jsx(Q,{})}),e.jsx(w.Item,{label:n("config.proxyPassword"),name:["network","proxy","password"],children:e.jsx(Q.Password,{})})]}):null})]})},{Option:z,OptGroup:xe}=U,Vi=()=>{const{t:n}=H();return e.jsxs(Ne,{title:n("config.tabStorage"),children:[e.jsx(w.Item,{label:n("config.storageDatabasePath"),name:["storage","databasePath"],children:e.jsx(Q,{})}),e.jsx(w.Item,{label:n("config.storageDownloadDirectory"),name:["storage","downloadDirectory"],children:e.jsx(Q,{})}),e.jsx(w.Item,{label:n("config.storageIllustrationDirectory"),name:["storage","illustrationDirectory"],children:e.jsx(Q,{})}),e.jsx(w.Item,{label:n("config.storageNovelDirectory"),name:["storage","novelDirectory"],children:e.jsx(Q,{})}),e.jsx(w.Item,{label:n("config.storageIllustrationOrganization"),name:["storage","illustrationOrganization"],tooltip:n("config.storageIllustrationOrganizationTooltip"),children:e.jsxs(U,{children:[e.jsxs(xe,{label:n("config.organizationGroupSimple"),children:[e.jsx(z,{value:"flat",children:n("config.organizationFlat")}),e.jsx(z,{value:"byAuthor",children:n("config.organizationByAuthor")}),e.jsx(z,{value:"byTag",children:n("config.organizationByTag")})]}),e.jsxs(xe,{label:n("config.organizationGroupDate"),children:[e.jsx(z,{value:"byDate",children:n("config.organizationByDate")}),e.jsx(z,{value:"byDay",children:n("config.organizationByDay")}),e.jsx(z,{value:"byDownloadDate",children:n("config.organizationByDownloadDate")}),e.jsx(z,{value:"byDownloadDay",children:n("config.organizationByDownloadDay")})]}),e.jsxs(xe,{label:n("config.organizationGroupCombined"),children:[e.jsx(z,{value:"byAuthorAndTag",children:n("config.organizationByAuthorAndTag")}),e.jsx(z,{value:"byDateAndAuthor",children:n("config.organizationByDateAndAuthor")}),e.jsx(z,{value:"byDayAndAuthor",children:n("config.organizationByDayAndAuthor")}),e.jsx(z,{value:"byDownloadDateAndAuthor",children:n("config.organizationByDownloadDateAndAuthor")}),e.jsx(z,{value:"byDownloadDayAndAuthor",children:n("config.organizationByDownloadDayAndAuthor")})]})]})}),e.jsx(w.Item,{label:n("config.storageNovelOrganization"),name:["storage","novelOrganization"],tooltip:n("config.storageNovelOrganizationTooltip"),children:e.jsxs(U,{children:[e.jsxs(xe,{label:n("config.organizationGroupSimple"),children:[e.jsx(z,{value:"flat",children:n("config.organizationFlat")}),e.jsx(z,{value:"byAuthor",children:n("config.organizationByAuthor")}),e.jsx(z,{value:"byTag",children:n("config.organizationByTag")})]}),e.jsxs(xe,{label:n("config.organizationGroupDate"),children:[e.jsx(z,{value:"byDate",children:n("config.organizationByDate")}),e.jsx(z,{value:"byDay",children:n("config.organizationByDay")}),e.jsx(z,{value:"byDownloadDate",children:n("config.organizationByDownloadDate")}),e.jsx(z,{value:"byDownloadDay",children:n("config.organizationByDownloadDay")})]}),e.jsxs(xe,{label:n("config.organizationGroupCombined"),children:[e.jsx(z,{value:"byAuthorAndTag",children:n("config.organizationByAuthorAndTag")}),e.jsx(z,{value:"byDateAndAuthor",children:n("config.organizationByDateAndAuthor")}),e.jsx(z,{value:"byDayAndAuthor",children:n("config.organizationByDayAndAuthor")}),e.jsx(z,{value:"byDownloadDateAndAuthor",children:n("config.organizationByDownloadDateAndAuthor")}),e.jsx(z,{value:"byDownloadDayAndAuthor",children:n("config.organizationByDownloadDayAndAuthor")})]})]})})]})},Pi=()=>{const{t:n}=H();return e.jsxs(Ne,{title:n("config.tabScheduler"),children:[e.jsx(w.Item,{label:n("config.schedulerEnabled"),name:["scheduler","enabled"],valuePropName:"checked",children:e.jsx(Vn,{})}),e.jsx(w.Item,{label:n("config.schedulerCron"),name:["scheduler","cron"],children:e.jsx(Q,{placeholder:n("config.schedulerCronPlaceholder")})}),e.jsx(w.Item,{label:n("config.schedulerTimezone"),name:["scheduler","timezone"],children:e.jsx(Q,{placeholder:n("config.schedulerTimezonePlaceholder")})}),e.jsx(w.Item,{label:n("config.schedulerMaxExecutions"),name:["scheduler","maxExecutions"],children:e.jsx(K,{min:1,style:{width:"100%"},placeholder:n("config.schedulerMaxExecutionsPlaceholder")})}),e.jsx(w.Item,{label:n("config.schedulerMinInterval"),name:["scheduler","minInterval"],children:e.jsx(K,{min:0,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.schedulerTimeout"),name:["scheduler","timeout"],children:e.jsx(K,{min:1e3,style:{width:"100%"},placeholder:n("config.schedulerTimeoutPlaceholder")})})]})},Li=()=>{const{t:n}=H();return e.jsxs(Ne,{title:n("config.tabDownload"),children:[e.jsx(w.Item,{label:n("config.downloadConcurrency"),name:["download","concurrency"],children:e.jsx(K,{min:1,max:10,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.downloadMaxRetries"),name:["download","maxRetries"],children:e.jsx(K,{min:0,max:10,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.downloadRetryDelay"),name:["download","retryDelay"],children:e.jsx(K,{min:0,style:{width:"100%"}})}),e.jsx(w.Item,{label:n("config.downloadTimeout"),name:["download","timeout"],children:e.jsx(K,{min:1e3,style:{width:"100%"}})})]})},{Option:L}=U,{Panel:tn}=Pe,{Step:Tn}=Pn,{Text:Hi,Paragraph:Wi}=oe,Gi=({visible:n,editingTarget:t,onSave:a,onCancel:r})=>{const{t:i}=H(),[s]=w.useForm(),[c,l]=o.useState(0),u={tagSearch:{name:i("config.templateTagSearch"),description:i("config.templateTagSearchDesc"),config:{type:"illustration",mode:"search",tag:"",limit:20,searchTarget:"partial_match_for_tags",sort:"date_desc"}},ranking:{name:i("config.templateRanking"),description:i("config.templateRankingDesc"),config:{type:"illustration",mode:"ranking",rankingMode:"day",limit:30}},multiTag:{name:i("config.templateMultiTag"),description:i("config.templateMultiTagDesc"),config:{type:"illustration",mode:"search",tag:"",limit:30,searchTarget:"partial_match_for_tags"}},highQuality:{name:i("config.templateHighQuality"),description:i("config.templateHighQualityDesc"),config:{type:"illustration",mode:"search",tag:"",limit:20,minBookmarks:1e3,sort:"popular_desc"}},novel:{name:i("config.templateNovel"),description:i("config.templateNovelDesc"),config:{type:"novel",mode:"search",tag:"",limit:10}}};o.useEffect(()=>{n&&(t?(s.setFieldsValue(t),l(1)):(s.resetFields(),l(0)))},[n,t,s]);const m=f=>{s.setFieldsValue(f.config),l(1)},d=async()=>{try{const f=await s.validateFields();a(f),s.resetFields(),l(0)}catch{}},g=()=>{s.resetFields(),l(0),r()};return e.jsxs(ln,{title:e.jsxs(T,{children:[i(t?"config.editTarget":"config.addTarget"),!t&&e.jsx(W,{title:i("config.templateTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),open:n,onOk:d,onCancel:g,width:800,okText:i("common.save"),cancelText:i("common.cancel"),children:[e.jsxs(Pn,{current:c,style:{marginBottom:24},children:[e.jsx(Tn,{title:i("config.stepSelectTemplate"),description:i("config.stepSelectTemplateDesc")}),e.jsx(Tn,{title:i("config.stepConfigure"),description:i("config.stepConfigureDesc")})]}),c===0&&!t&&e.jsxs("div",{children:[e.jsx(Wi,{type:"secondary",style:{marginBottom:16},children:i("config.templateSelectDescription")}),e.jsxs(T,{direction:"vertical",style:{width:"100%"},size:"middle",children:[Object.entries(u).map(([f,v])=>e.jsx(Ee,{hoverable:!0,style:{cursor:"pointer"},onClick:()=>m(v),children:e.jsxs(T,{style:{width:"100%",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsx(oe.Title,{level:5,style:{margin:0},children:v.name}),e.jsx(Hi,{type:"secondary",children:v.description})]}),e.jsx(R,{type:"primary",icon:e.jsx(Ln,{}),children:i("config.useTemplate")})]})},f)),e.jsx(R,{block:!0,type:"dashed",onClick:()=>l(1),style:{marginTop:8},children:i("config.skipTemplate")})]})]}),c===1&&e.jsx(w,{form:s,layout:"vertical",children:e.jsxs(Pe,{defaultActiveKey:["basic"],ghost:!0,children:[e.jsxs(tn,{header:i("config.targetBasicSettings"),children:[e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.targetType"),e.jsx(W,{title:i("config.targetTypeTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"type",rules:[{required:!0,message:i("config.targetTypeRequired")}],children:e.jsxs(U,{children:[e.jsx(L,{value:"illustration",children:i("config.typeIllustration")}),e.jsx(L,{value:"novel",children:i("config.typeNovel")})]})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.targetMode"),e.jsx(W,{title:i("config.targetModeTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"mode",initialValue:"search",children:e.jsxs(U,{children:[e.jsx(L,{value:"search",children:i("config.modeSearch")}),e.jsx(L,{value:"ranking",children:i("config.modeRanking")})]})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.targetLimit"),e.jsx(W,{title:i("config.targetLimitTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"limit",rules:[{type:"number",min:1,max:1e3,message:i("config.targetLimitRange")}],children:e.jsx(K,{min:1,max:1e3,style:{width:"100%"},placeholder:i("config.targetLimitPlaceholder")})})]},"basic"),e.jsx(tn,{header:i("config.targetModeSettings"),children:e.jsx(w.Item,{noStyle:!0,shouldUpdate:(f,v)=>f.mode!==v.mode,children:({getFieldValue:f})=>(f("mode")||"search")==="search"?e.jsxs(e.Fragment,{children:[e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.targetTag"),e.jsx(W,{title:i("config.targetTagTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"tag",rules:[{validator:(j,x)=>!x||x.trim()===""?Promise.reject(new Error(i("config.targetTagRequired"))):Promise.resolve()}],children:e.jsx(Q,{placeholder:i("config.targetTagPlaceholder")})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.searchTarget"),e.jsx(W,{title:i("config.searchTargetTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"searchTarget",initialValue:"partial_match_for_tags",children:e.jsxs(U,{children:[e.jsxs(L,{value:"partial_match_for_tags",children:[i("config.searchTargetPartial")," (",i("common.recommended"),")"]}),e.jsx(L,{value:"exact_match_for_tags",children:i("config.searchTargetExact")}),e.jsx(L,{value:"title_and_caption",children:i("config.searchTargetTitle")})]})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.sort"),e.jsx(W,{title:i("config.sortTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"sort",initialValue:"date_desc",children:e.jsxs(U,{children:[e.jsx(L,{value:"date_desc",children:i("config.sortDateDesc")}),e.jsx(L,{value:"date_asc",children:i("config.sortDateAsc")}),e.jsx(L,{value:"popular_desc",children:i("config.sortPopularDesc")})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.rankingMode"),e.jsx(W,{title:i("config.rankingModeTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"rankingMode",initialValue:"day",children:e.jsxs(U,{children:[e.jsx(L,{value:"day",children:i("config.rankingDay")}),e.jsx(L,{value:"week",children:i("config.rankingWeek")}),e.jsx(L,{value:"month",children:i("config.rankingMonth")}),e.jsx(L,{value:"day_male",children:i("config.rankingDayMale")}),e.jsx(L,{value:"day_female",children:i("config.rankingDayFemale")}),e.jsx(L,{value:"day_ai",children:i("config.rankingDayAI")}),e.jsx(L,{value:"week_original",children:i("config.rankingWeekOriginal")}),e.jsx(L,{value:"week_rookie",children:i("config.rankingWeekRookie")})]})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.rankingDate"),e.jsx(W,{title:i("config.rankingDateTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"rankingDate",children:e.jsx(Q,{placeholder:i("config.rankingDatePlaceholder")})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.filterTag"),e.jsx(W,{title:i("config.filterTagTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"filterTag",children:e.jsx(Q,{placeholder:i("config.filterTagPlaceholder")})})]})})},"mode"),e.jsxs(tn,{header:i("config.targetAdvancedFilters"),children:[e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.minBookmarks"),e.jsx(W,{title:i("config.minBookmarksTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"minBookmarks",children:e.jsx(K,{min:0,style:{width:"100%"},placeholder:i("config.minBookmarksPlaceholder")})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.startDate"),e.jsx(W,{title:i("config.startDateTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"startDate",children:e.jsx(Q,{placeholder:i("config.startDatePlaceholder")})}),e.jsx(w.Item,{label:e.jsxs(T,{children:[i("config.endDate"),e.jsx(W,{title:i("config.endDateTooltip"),children:e.jsx(q,{style:{color:"#999"}})})]}),name:"endDate",children:e.jsx(Q,{placeholder:i("config.endDatePlaceholder")})})]},"advanced")]})})]})};function qi(){const{t:n}=H();return e.jsx(Ce,{message:n("config.targetsTitle"),description:n("config.targetsDescription"),type:"info",showIcon:!0})}const{Text:Z}=oe;function Ui({targets:n,onAdd:t,onEdit:a,onDelete:r}){const{t:i}=H(),s=o.useMemo(()=>[{title:i("config.targetType"),dataIndex:"type",key:"type",width:100,render:c=>e.jsx(Ie,{color:c==="illustration"?"blue":"green",children:i(c==="illustration"?"config.typeIllustration":"config.typeNovel")})},{title:i("config.targetMode"),dataIndex:"mode",key:"mode",width:100,render:c=>c?e.jsx(Ie,{color:c==="ranking"?"purple":"cyan",children:i(c==="ranking"?"config.modeRanking":"config.modeSearch")}):"-"},{title:i("config.targetConfig"),key:"config",render:(c,l)=>{if(l.mode==="ranking"){const u={day:i("config.rankingDay"),week:i("config.rankingWeek"),month:i("config.rankingMonth"),day_male:i("config.rankingDayMale"),day_female:i("config.rankingDayFemale"),day_ai:i("config.rankingDayAI"),week_original:i("config.rankingWeekOriginal"),week_rookie:i("config.rankingWeekRookie")};return e.jsxs(T,{direction:"vertical",size:"small",style:{fontSize:12},children:[e.jsx(Z,{strong:!0,children:u[l.rankingMode||"day"]||l.rankingMode}),l.filterTag&&e.jsxs(Z,{type:"secondary",children:[i("config.filterTag"),": ",l.filterTag]}),l.rankingDate&&e.jsxs(Z,{type:"secondary",children:[i("config.rankingDate"),": ",l.rankingDate]})]})}return l.seriesId?e.jsxs(Z,{children:[i("config.seriesId"),": ",l.seriesId]}):l.novelId?e.jsxs(Z,{children:[i("config.novelId"),": ",l.novelId]}):e.jsxs(T,{direction:"vertical",size:"small",style:{fontSize:12},children:[e.jsx(Z,{strong:!0,children:l.tag||"-"}),l.searchTarget&&e.jsx(Z,{type:"secondary",children:l.searchTarget==="partial_match_for_tags"?i("config.searchTargetPartial"):l.searchTarget==="exact_match_for_tags"?i("config.searchTargetExact"):i("config.searchTargetTitle")}),l.sort&&e.jsx(Z,{type:"secondary",children:l.sort==="date_desc"?i("config.sortDateDesc"):l.sort==="date_asc"?i("config.sortDateAsc"):i("config.sortPopularDesc")})]})}},{title:i("config.targetFilters"),key:"filters",width:150,render:(c,l)=>e.jsxs(T,{direction:"vertical",size:"small",style:{fontSize:12},children:[l.limit&&e.jsxs(Z,{children:[i("config.limit"),": ",l.limit]}),l.minBookmarks&&e.jsxs(Z,{type:"secondary",children:[i("config.minBookmarks")," ≥ ",l.minBookmarks]}),(l.startDate||l.endDate)&&e.jsxs(Z,{type:"secondary",children:[l.startDate&&`${i("config.from")} ${l.startDate}`,l.endDate&&` ${i("config.to")} ${l.endDate}`]})]})},{title:i("common.actions"),key:"action",width:150,render:(c,l,u)=>e.jsxs(T,{children:[e.jsx(R,{type:"link",icon:e.jsx(Bn,{}),onClick:()=>a(l,u),size:"small",children:i("common.edit")}),e.jsx(cn,{title:i("config.deleteTargetConfirm"),onConfirm:()=>r(u),okText:i("common.ok"),cancelText:i("common.cancel"),children:e.jsx(R,{type:"link",danger:!0,icon:e.jsx(dn,{}),size:"small",children:i("common.delete")})})]})}],[r,a,i]);return e.jsx(Ee,{title:i("config.targetsList"),extra:e.jsx(R,{icon:e.jsx(Ln,{}),onClick:t,children:i("config.addTarget")}),children:e.jsx(un,{columns:s,dataSource:n,rowKey:c=>c._rowKey?c._rowKey:String(c._index??c.tag??c.mode??"target"),pagination:!1,locale:{emptyText:i("config.targetsEmpty")}})})}const Ki=({form:n,onTargetChange:t})=>{const[a,r]=o.useState(!1),[i,s]=o.useState(null);o.useEffect(()=>{const j=n.getFieldValue("targets");Array.isArray(j)||n.setFieldsValue({targets:[]})},[n]);const c=w.useWatch("targets",n)||n.getFieldValue("targets")||[],l=o.useCallback(()=>{t&&t()},[t]),u=o.useCallback(()=>{s(null),r(!0)},[]),m=o.useCallback((j,x)=>{s({...j,_index:x}),r(!0)},[]),d=o.useCallback(j=>{const S=(n.getFieldValue("targets")||[]).filter((h,y)=>y!==j);n.setFieldsValue({targets:S}),l()},[n,l]),g=o.useCallback(j=>{const S=[...n.getFieldValue("targets")||[]];i&&typeof i._index=="number"?S[i._index]=j:S.push(j),n.setFieldsValue({targets:S}),r(!1),s(null),l()},[i,n,l]),f=o.useCallback(()=>{r(!1),s(null)},[]),v=o.useMemo(()=>c.map((j,x)=>({...j,_index:x,_rowKey:`${j.type||"target"}-${x}`})),[c]);return e.jsxs(e.Fragment,{children:[e.jsx(w.Item,{name:"targets",hidden:!0,children:e.jsx("input",{type:"hidden"})}),e.jsxs(T,{direction:"vertical",style:{width:"100%"},size:"large",children:[e.jsx(qi,{}),e.jsx(Ui,{targets:v,onAdd:u,onEdit:m,onDelete:d})]}),e.jsx(Gi,{visible:a,editingTarget:i,onSave:g,onCancel:f})]})},qn=({value:n,onChange:t,language:a="text",readOnly:r=!1,placeholder:i="Enter code...",minHeight:s=200,maxHeight:c=600,showCopyButton:l=!0,style:u,className:m})=>{const d=o.useRef(null),[g,f]=o.useState(!1),v=h=>{t&&t(h.target.value)},j=async()=>{try{await navigator.clipboard.writeText(n),f(!0),V.success("Copied to clipboard"),setTimeout(()=>f(!1),2e3)}catch{V.error("Failed to copy")}},x=h=>{if(a==="json"&&!r){const y=h.clipboardData.getData("text");try{const E=JSON.parse(y),p=JSON.stringify(E,null,2);h.preventDefault(),t&&t(p)}catch{}}},S={fontFamily:'Monaco, Menlo, "Ubuntu Mono", Consolas, "source-code-pro", monospace',fontSize:"14px",lineHeight:"1.6",padding:"12px",border:"1px solid #d9d9d9",borderRadius:"4px",backgroundColor:a==="json"?"#1f1f1f":"#fff",color:a==="json"?"#fff":"#000",minHeight:`${s}px`,maxHeight:`${c}px`,overflow:"auto",resize:"vertical",width:"100%",...u};return e.jsxs("div",{className:m,children:[l&&e.jsx(T,{style:{marginBottom:8,justifyContent:"flex-end",width:"100%"},children:e.jsx(R,{size:"small",icon:g?e.jsx(Nt,{}):e.jsx(sn,{}),onClick:j,disabled:!n,children:g?"Copied":"Copy"})}),e.jsx("textarea",{ref:d,value:n,onChange:v,onPaste:x,readOnly:r,placeholder:i,style:S,spellCheck:!1})]})},Un=({visible:n,filename:t,onClose:a,onConfigFileSwitch:r})=>{const{t:i}=H(),s=Be(),{configFiles:c,refetch:l}=Ve(),[u,m]=o.useState(""),[d,g]=o.useState(!1),[f,v]=o.useState(""),[j,x]=o.useState(!1),[S,h]=o.useState(!1),y=o.useRef(""),E=o.useRef(""),p=o.useRef(!1);o.useEffect(()=>{n&&t?_():(m(""),v(""),x(!1),y.current="",E.current="")},[n,t]),o.useEffect(()=>{if(!n||!t||p.current)return;let C,k=!0;const D=async()=>{if(!(!k||!t||p.current))try{const B=(await _e.getConfigFileContent(t)).data.data.content,J=y.current,te=E.current;B!==J&&B!==te&&!p.current?(x(!0),v(B),y.current=B):B===te?(x(!1),v(B),y.current=B):p.current||(v(B),y.current=B)}catch(A){console.warn("Failed to poll config file content:",A)}};return D(),C=setInterval(()=>{p.current||D()},5e3),()=>{k=!1,C&&clearInterval(C)}},[n,t,S]),o.useEffect(()=>{y.current=f},[f]),o.useEffect(()=>{E.current=u},[u]),o.useEffect(()=>{p.current=S},[S]);const _=async()=>{try{g(!0);const k=(await _e.getConfigFileContent(t)).data.data.content;m(k),v(k),y.current=k,E.current=k,x(!1)}catch(C){const{message:k}=ze(C),D=C instanceof Error?C.message:void 0;V.error(`${i("config.configFileReadFailed")}: ${k||D||i("config.unknownError")}`)}finally{g(!1)}},O=async()=>{await _(),V.success(i("config.jsonEditorRefreshed"))},$=async()=>{if(t)try{g(!0);try{JSON.parse(u)}catch{V.error(i("config.jsonFormatError"));return}await _e.updateConfigFileContent(t,u),V.success(i("config.configSaved")),v(u),y.current=u,E.current=u,x(!1),h(!1),p.current=!1,await s.invalidateQueries({queryKey:ue.CONFIG}),await s.invalidateQueries({queryKey:ue.CONFIG_FILES}),l(),c?.find(k=>k.filename===t&&k.isActive)?r?r():setTimeout(()=>{window.location.reload()},1e3):a()}catch(C){const{errorCode:k,message:D,details:A}=ze(C);if(k==="CONFIG_INVALID"&&A&&Array.isArray(A)){const B=A.map(J=>{if(typeof J=="object"&&J!==null&&"code"in J){const te=J;return ye(te.code,i,te.params)}return String(J)});V.error(`${ye(k,i)}: ${B.join(", ")}`)}else V.error(D||i("config.configSaveFailed"))}finally{g(!1)}},P=()=>{try{const C=JSON.parse(u),k=JSON.stringify(C,null,2);m(k),V.success(i("config.jsonFormatted"))}catch{V.error(i("config.jsonFormatError"))}};return e.jsx(ln,{title:e.jsxs(T,{children:[i("config.editJson"),e.jsxs("span",{style:{color:"#999",fontSize:14},children:["(",t,")"]})]}),open:n,onCancel:a,width:900,footer:[e.jsx(R,{onClick:P,children:i("config.formatJson")},"format"),e.jsx(R,{onClick:a,children:i("common.cancel")},"cancel"),e.jsx(R,{type:"primary",icon:e.jsx(Gn,{}),loading:d,onClick:$,children:i("config.saveConfig")},"save")],children:e.jsxs(Dt,{spinning:d&&!u,children:[j&&e.jsx(Ce,{message:i("config.jsonEditorExternalChanges"),description:i("config.jsonEditorExternalChangesDesc"),type:"warning",showIcon:!0,style:{marginBottom:16},action:e.jsx(R,{size:"small",onClick:O,children:i("config.refresh")})}),e.jsx(qn,{value:u,onChange:C=>{m(C),h(!0),p.current=!0,j&&C!==f&&x(!1)},language:"json",minHeight:400,maxHeight:600,placeholder:i("config.jsonEditorPlaceholder")}),e.jsx(Ce,{message:i("config.jsonEditorWarning"),type:"warning",showIcon:!0,style:{marginTop:16}})]})})},{Text:$n}=oe,Ji=({onConfigFileSwitch:n,onJsonEditorOpen:t})=>{const{t:a}=H(),{configFiles:r,isLoading:i,refetch:s,switchFileAsync:c,deleteFileAsync:l}=Ve(),{handleError:u}=ke(),[m,d]=o.useState(!1),[g,f]=o.useState(null),v=async h=>{if(t){t(h);return}try{f(h),d(!0)}catch(y){const{message:E}=ze(y),p=y instanceof Error?y:null;V.error(`${a("config.configFileReadFailed")}: ${E||p?.message||a("config.unknownError")}`)}},j=async h=>{if(!h.isActive)try{await c(h.path),V.success(a("config.configSwitched")),n&&n()}catch(y){u(y)}},x=async h=>{try{await l(h),V.success(a("config.configFileDeleted")),s()}catch(y){u(y)}},S=[{title:a("config.fileName"),dataIndex:"filename",key:"filename",render:(h,y)=>e.jsxs(T,{children:[e.jsx($n,{strong:y.isActive,children:h}),y.isActive&&e.jsx(Ie,{color:"green",children:a("config.activeConfig")})]})},{title:a("config.filePath"),dataIndex:"pathRelative",key:"pathRelative",render:h=>e.jsx($n,{type:"secondary",style:{fontSize:12},children:h})},{title:a("config.fileModified"),dataIndex:"modifiedTime",key:"modifiedTime",render:h=>new Date(h).toLocaleString()},{title:a("config.fileSize"),dataIndex:"size",key:"size",render:h=>`${(h/1024).toFixed(2)} KB`},{title:a("common.actions"),key:"action",width:250,render:(h,y)=>e.jsxs(T,{children:[e.jsx(R,{type:"link",icon:e.jsx(Bn,{}),onClick:()=>v(y.filename),size:"small",children:a("config.editJson")}),!y.isActive&&e.jsx(R,{type:"link",icon:e.jsx(Mn,{}),onClick:()=>j(y),size:"small",children:a("config.switch")}),e.jsx(cn,{title:a("config.deleteConfigFileConfirm"),onConfirm:()=>x(y.filename),okText:a("common.ok"),cancelText:a("common.cancel"),children:e.jsx(R,{type:"link",danger:!0,icon:e.jsx(dn,{}),size:"small",children:a("common.delete")})})]})}];return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{title:a("config.configFiles"),extra:e.jsx(R,{icon:e.jsx(on,{}),onClick:()=>s(),children:a("common.refresh")}),children:r&&r.length>0?e.jsx(un,{columns:S,dataSource:r,rowKey:"filename",loading:i,pagination:{pageSize:10},locale:{emptyText:a("config.configFilesEmpty")}}):e.jsx(Ce,{message:a("config.configFilesEmpty"),description:a("config.configFilesEmptyDesc"),type:"info",showIcon:!0})}),m&&g&&e.jsx(Un,{visible:m,filename:g,onClose:()=>{d(!1),f(null)},onConfigFileSwitch:n})]})},{Text:Fn}=oe,Qi=({onConfigApplied:n})=>{const{t}=H(),{history:a,isLoading:r,refetch:i,applyAsync:s,deleteAsync:c}=Rt(),{handleError:l}=ke(),u=async g=>{try{await s(g),V.success(t("config.configApplied")),n&&n()}catch(f){l(f)}},m=async g=>{try{await c(g),V.success(t("config.historyDeleted")),i()}catch(f){l(f)}},d=[{title:t("config.historyName"),dataIndex:"name",key:"name",render:(g,f)=>e.jsxs(T,{children:[e.jsx(Fn,{strong:f.is_active===1,children:g}),f.is_active===1&&e.jsx(Ie,{color:"green",children:t("config.activeConfig")})]})},{title:t("config.historyDescription"),dataIndex:"description",key:"description",render:g=>g||e.jsx(Fn,{type:"secondary",children:"-"})},{title:t("config.historyCreatedAt"),dataIndex:"created_at",key:"created_at",render:g=>new Date(g).toLocaleString()},{title:t("config.historyUpdatedAt"),dataIndex:"updated_at",key:"updated_at",render:g=>new Date(g).toLocaleString()},{title:t("common.actions"),key:"action",width:200,render:(g,f)=>e.jsxs(T,{children:[e.jsx(R,{type:"link",icon:e.jsx(Mn,{}),onClick:()=>u(f.id),size:"small",children:t("config.apply")}),e.jsx(cn,{title:t("config.deleteHistoryConfirm"),onConfirm:()=>m(f.id),okText:t("common.ok"),cancelText:t("common.cancel"),children:e.jsx(R,{type:"link",danger:!0,icon:e.jsx(dn,{}),size:"small",children:t("common.delete")})})]})}];return e.jsx(Ee,{title:t("config.configHistory"),extra:e.jsx(R,{icon:e.jsx(on,{}),onClick:()=>i(),children:t("common.refresh")}),children:a&&a.length>0?e.jsx(un,{columns:d,dataSource:a,rowKey:"id",loading:r,pagination:{pageSize:10},locale:{emptyText:t("config.historyEmpty")}}):e.jsx(Ce,{message:t("config.historyEmpty"),description:t("config.historyEmptyDesc"),type:"info",showIcon:!0})})},{Text:Xi}=oe;function Yi({form:n,onConfigFileSwitch:t,onJsonEditorOpen:a,onConfigApplied:r,onTargetChange:i}){const{t:s}=H(),c=o.useMemo(()=>[{key:"files",label:e.jsxs(e.Fragment,{children:[e.jsx(On,{})," ",s("config.tabConfigFiles")]}),children:e.jsx(Ji,{onConfigFileSwitch:t,onJsonEditorOpen:a})},{key:"history",label:e.jsxs(e.Fragment,{children:[e.jsx(Tt,{})," ",s("config.tabHistory")]}),children:e.jsx(Qi,{onConfigApplied:r})}],[r,t,a,s]),l=o.useMemo(()=>[{key:"basic",label:s("config.tabBasic"),children:e.jsx(zi,{})},{key:"pixiv",label:s("config.tabPixiv"),children:e.jsx("div",{children:e.jsx(Xi,{type:"secondary",children:s("config.pixivCredentialsHidden")})})},{key:"network",label:s("config.tabNetwork"),children:e.jsx(Bi,{})},{key:"storage",label:s("config.tabStorage"),children:e.jsx(Vi,{})},{key:"scheduler",label:s("config.tabScheduler"),children:e.jsx(Pi,{})},{key:"download",label:s("config.tabDownload"),children:e.jsx(Li,{})},{key:"targets",label:s("config.tabTargets"),children:e.jsx(Ki,{form:n,onTargetChange:i})}],[n,i,s]),u=o.useMemo(()=>[...c||[],...l||[]],[l,c]);return{managementTabItems:c,formTabItems:l,tabItems:u}}function Zi({form:n,activeTab:t,onTabChange:a,onConfigFileSwitch:r,onJsonEditorOpen:i,onConfigApplied:s,onTargetChange:c}){const{tabItems:l}=Yi({form:n,onConfigFileSwitch:r,onJsonEditorOpen:i,onConfigApplied:s,onTargetChange:c});return e.jsx(w,{form:n,layout:"vertical",children:e.jsx(Kt,{activeKey:t,onChange:a,items:l})})}function ea({visible:n,configPreview:t,onClose:a}){const{t:r}=H(),i=()=>{navigator.clipboard.writeText(t),V.success(r("config.configCopied"))};return e.jsx(ln,{title:r("config.previewConfig"),open:n,onCancel:a,footer:[e.jsx(R,{icon:e.jsx(sn,{}),onClick:i,children:r("common.copy")},"copy"),e.jsx(R,{onClick:a,children:r("common.close")},"close")],width:800,children:e.jsx(qn,{value:t,readOnly:!0,language:"json",minHeight:400,maxHeight:600})})}function ja(){const{t:n}=H(),{activeTab:t,setActiveTab:a}=$i(),{previewVisible:r,jsonEditorVisible:i,editingConfigFile:s,openPreview:c,closePreview:l,openJsonEditor:u,closeJsonEditor:m}=Ti(),{form:d,config:g,isLoading:f,isUpdating:v,isValidating:j,handleSave:x,handleValidate:S,handleTargetChange:h,getConfigPreview:y,refreshConfig:E}=Si(),{handleExportConfig:p,handleImportConfig:_,handleCopyConfig:O,handleConfigFileSwitch:$,handleConfigApplied:P,isImporting:C}=Di(g),{configFiles:k,refetch:D}=Ve();if(f)return e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"48px 0"},children:e.jsx($t,{})});const A=g?._meta?.configPathRelative??g?._meta?.configPath??n("config.unknown");return e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:16,width:"100%",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:16,flexWrap:"wrap"},children:[e.jsx(_i,{currentConfigPath:A,configFiles:k,onConfigFileSwitch:$,refetchConfigFiles:D}),e.jsx(Oi,{onRefresh:E,onPreview:c,onExport:p,onImport:_,onCopy:()=>O(y()),onValidate:S,onSave:x,isValidating:j,isUpdating:v,isImporting:C})]}),e.jsx(Zi,{form:d,activeTab:t,onTabChange:a,onConfigFileSwitch:$,onJsonEditorOpen:u,onConfigApplied:P,onTargetChange:h}),e.jsx(ea,{visible:r,configPreview:y(),onClose:l}),i&&s&&e.jsx(Un,{visible:i,filename:s,onClose:m,onConfigFileSwitch:$})]})}export{ja as default};
16
+ //# sourceMappingURL=Config-UjgCA3Jq.js.map
@@ -0,0 +1,2 @@
1
+ import{a as o,R as p,u as x,Q as f,b as S,r as g,s as c,j as s,S as j,B as y,c as w,d as m,e as v}from"./index-HJggy9SZ.js";import{R as u,C as i}from"./row-CQQO4x82.js";import{C as d}from"./index-B4zZ11c-.js";import{S as h}from"./index-D_qUS2GR.js";import{R}from"./PictureOutlined-CSEKKDH9.js";const b={async getStatsOverview(){return(await o.getStatsOverview()).data.data},async getDownloadStats(t){return(await o.getDownloadStats(t)).data.data},async getTagStats(t){return(await o.getTagStats(t)).data.data},async getAuthorStats(t){return(await o.getAuthorStats(t)).data.data}};function D(t=p.STATS_OVERVIEW){const{data:e,isLoading:a,error:r,refetch:l}=x({queryKey:f.STATS_OVERVIEW,queryFn:()=>b.getStatsOverview(),refetchInterval:t});return{stats:e,isLoading:a,error:r,refetch:l}}function O(){const{t}=S(),{stats:e,isLoading:a,refetch:r}=D(),l=g.useCallback(async()=>{c.loading({content:t("dashboard.refreshingStats"),key:"refresh-stats"});try{await r(),c.success({content:t("dashboard.statsRefreshed"),key:"refresh-stats",duration:2})}catch{c.error({content:t("dashboard.refreshStatsFailed"),key:"refresh-stats",duration:2})}},[r,t]);if(a)return s.jsx(j,{size:"large",style:{display:"block",textAlign:"center",marginTop:50}});const n=e||{totalDownloads:0,illustrations:0,novels:0,recentDownloads:0};return s.jsxs("div",{children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[s.jsx("h2",{style:{margin:0},children:t("dashboard.title")}),s.jsx(y,{icon:s.jsx(w,{}),onClick:l,loading:a,children:t("dashboard.refreshStats")})]}),s.jsxs(u,{gutter:16,style:{marginTop:24},children:[s.jsx(i,{span:8,children:s.jsx(d,{children:s.jsx(h,{title:t("dashboard.totalDownloads"),value:n.totalDownloads,prefix:s.jsx(m,{})})})}),s.jsx(i,{span:8,children:s.jsx(d,{children:s.jsx(h,{title:t("dashboard.illustrations"),value:n.illustrations,prefix:s.jsx(R,{})})})}),s.jsx(i,{span:8,children:s.jsx(d,{children:s.jsx(h,{title:t("dashboard.novels"),value:n.novels,prefix:s.jsx(v,{})})})})]}),s.jsx(u,{gutter:16,style:{marginTop:16},children:s.jsx(i,{span:24,children:s.jsx(d,{title:t("dashboard.recentDownloads"),children:s.jsx("p",{children:t("dashboard.recentDownloadsDesc",{count:n.recentDownloads})})})})})]})}export{O as default};
2
+ //# sourceMappingURL=Dashboard-hIW1nAN9.js.map
@@ -1,2 +1,2 @@
1
- import{r as e,I as a,_ as r}from"./index-DG6kGbYq.js";var l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"},n=function(t,c){return e.createElement(a,r({},t,{ref:c,icon:l}))},h=e.forwardRef(n);export{h as R};
2
- //# sourceMappingURL=DeleteOutlined-BFmW1oWe.js.map
1
+ import{r as e,I as a,_ as r}from"./index-HJggy9SZ.js";var l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"},n=function(t,c){return e.createElement(a,r({},t,{ref:c,icon:l}))},h=e.forwardRef(n);export{h as R};
2
+ //# sourceMappingURL=DeleteOutlined-ByQuZQbZ.js.map