@minato-aqukin/autodl-cli 0.1.1 → 0.2.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.
- package/README.md +72 -6
- package/README.zh-CN.md +64 -5
- package/dist/{app-4PY7NE53.js → app-V5GCG3MC.js} +2081 -412
- package/dist/chunk-2E2Y5GFH.js +1704 -0
- package/dist/{chunk-6QR4ZYQR.js → chunk-GHJVQKKC.js} +78 -32
- package/dist/{chunk-LHDSN4DL.js → chunk-JOOIUQLJ.js} +10 -4
- package/dist/{chunk-5RZ4Q7T4.js → chunk-MWYYK755.js} +4 -4
- package/dist/{chunk-NBWWTYSL.js → chunk-VEDMEYCW.js} +2 -2
- package/dist/{chunk-CWCG3MOC.js → chunk-WN2CXPD2.js} +7 -2
- package/dist/cli.js +319 -25
- package/dist/index.d.ts +11 -2
- package/dist/index.js +6 -4
- package/dist/{tui-LEZV34YH.js → tui-ZT5ZBVSQ.js} +4 -4
- package/package.json +1 -1
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __nodeCreateRequire } from "node:module";
|
|
3
3
|
const require = __nodeCreateRequire(import.meta.url);
|
|
4
|
+
import {
|
|
5
|
+
FileWorkspace,
|
|
6
|
+
TransferQueue,
|
|
7
|
+
connectTerminal,
|
|
8
|
+
identityFromToken,
|
|
9
|
+
tokenOverrideNote
|
|
10
|
+
} from "./chunk-2E2Y5GFH.js";
|
|
4
11
|
import {
|
|
5
12
|
BASE_IMAGES,
|
|
6
13
|
DEFAULT_BASE_IMAGE,
|
|
@@ -11,9 +18,10 @@ import {
|
|
|
11
18
|
getBalance,
|
|
12
19
|
getStockByRegion,
|
|
13
20
|
parseCudaVersion
|
|
14
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-WN2CXPD2.js";
|
|
15
22
|
import {
|
|
16
23
|
AutoDLClient,
|
|
24
|
+
DEFAULT_BASE_URL,
|
|
17
25
|
__commonJS,
|
|
18
26
|
__export,
|
|
19
27
|
__require,
|
|
@@ -29,6 +37,7 @@ import {
|
|
|
29
37
|
formatRate,
|
|
30
38
|
formatTime,
|
|
31
39
|
formatYuan,
|
|
40
|
+
getCredentials,
|
|
32
41
|
getInstanceSnapshot,
|
|
33
42
|
getInstanceStatus,
|
|
34
43
|
isAuthError,
|
|
@@ -42,15 +51,16 @@ import {
|
|
|
42
51
|
recordTTL,
|
|
43
52
|
releaseInstance,
|
|
44
53
|
resolveBaseUrl,
|
|
54
|
+
resolveToken,
|
|
45
55
|
stringWidth,
|
|
46
56
|
tryResolveToken,
|
|
47
57
|
updateConfig,
|
|
48
58
|
waitForShutdown
|
|
49
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-GHJVQKKC.js";
|
|
50
60
|
|
|
51
|
-
//
|
|
61
|
+
// node_modules/react/cjs/react.production.js
|
|
52
62
|
var require_react_production = __commonJS({
|
|
53
|
-
"
|
|
63
|
+
"node_modules/react/cjs/react.production.js"(exports) {
|
|
54
64
|
"use strict";
|
|
55
65
|
var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element");
|
|
56
66
|
var REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal");
|
|
@@ -489,9 +499,9 @@ var require_react_production = __commonJS({
|
|
|
489
499
|
}
|
|
490
500
|
});
|
|
491
501
|
|
|
492
|
-
//
|
|
502
|
+
// node_modules/react/cjs/react.development.js
|
|
493
503
|
var require_react_development = __commonJS({
|
|
494
|
-
"
|
|
504
|
+
"node_modules/react/cjs/react.development.js"(exports, module) {
|
|
495
505
|
"use strict";
|
|
496
506
|
"production" !== process.env.NODE_ENV && (function() {
|
|
497
507
|
function defineDeprecationWarning(methodName, info) {
|
|
@@ -913,21 +923,21 @@ var require_react_development = __commonJS({
|
|
|
913
923
|
);
|
|
914
924
|
actScopeDepth = prevActScopeDepth;
|
|
915
925
|
}
|
|
916
|
-
function recursivelyFlushAsyncActWork(returnValue,
|
|
926
|
+
function recursivelyFlushAsyncActWork(returnValue, resolve2, reject) {
|
|
917
927
|
var queue = ReactSharedInternals.actQueue;
|
|
918
928
|
if (null !== queue)
|
|
919
929
|
if (0 !== queue.length)
|
|
920
930
|
try {
|
|
921
931
|
flushActQueue(queue);
|
|
922
932
|
enqueueTask(function() {
|
|
923
|
-
return recursivelyFlushAsyncActWork(returnValue,
|
|
933
|
+
return recursivelyFlushAsyncActWork(returnValue, resolve2, reject);
|
|
924
934
|
});
|
|
925
935
|
return;
|
|
926
936
|
} catch (error) {
|
|
927
937
|
ReactSharedInternals.thrownErrors.push(error);
|
|
928
938
|
}
|
|
929
939
|
else ReactSharedInternals.actQueue = null;
|
|
930
|
-
0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) :
|
|
940
|
+
0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve2(returnValue);
|
|
931
941
|
}
|
|
932
942
|
function flushActQueue(queue) {
|
|
933
943
|
if (!isFlushing) {
|
|
@@ -1114,7 +1124,7 @@ var require_react_development = __commonJS({
|
|
|
1114
1124
|
));
|
|
1115
1125
|
});
|
|
1116
1126
|
return {
|
|
1117
|
-
then: function(
|
|
1127
|
+
then: function(resolve2, reject) {
|
|
1118
1128
|
didAwaitActCall = true;
|
|
1119
1129
|
thenable.then(
|
|
1120
1130
|
function(returnValue) {
|
|
@@ -1124,7 +1134,7 @@ var require_react_development = __commonJS({
|
|
|
1124
1134
|
flushActQueue(queue), enqueueTask(function() {
|
|
1125
1135
|
return recursivelyFlushAsyncActWork(
|
|
1126
1136
|
returnValue,
|
|
1127
|
-
|
|
1137
|
+
resolve2,
|
|
1128
1138
|
reject
|
|
1129
1139
|
);
|
|
1130
1140
|
});
|
|
@@ -1138,7 +1148,7 @@ var require_react_development = __commonJS({
|
|
|
1138
1148
|
ReactSharedInternals.thrownErrors.length = 0;
|
|
1139
1149
|
reject(_thrownError);
|
|
1140
1150
|
}
|
|
1141
|
-
} else
|
|
1151
|
+
} else resolve2(returnValue);
|
|
1142
1152
|
},
|
|
1143
1153
|
function(error) {
|
|
1144
1154
|
popActScope(prevActQueue, prevActScopeDepth);
|
|
@@ -1160,15 +1170,15 @@ var require_react_development = __commonJS({
|
|
|
1160
1170
|
if (0 < ReactSharedInternals.thrownErrors.length)
|
|
1161
1171
|
throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
|
|
1162
1172
|
return {
|
|
1163
|
-
then: function(
|
|
1173
|
+
then: function(resolve2, reject) {
|
|
1164
1174
|
didAwaitActCall = true;
|
|
1165
1175
|
0 === prevActScopeDepth ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
|
|
1166
1176
|
return recursivelyFlushAsyncActWork(
|
|
1167
1177
|
returnValue$jscomp$0,
|
|
1168
|
-
|
|
1178
|
+
resolve2,
|
|
1169
1179
|
reject
|
|
1170
1180
|
);
|
|
1171
|
-
})) :
|
|
1181
|
+
})) : resolve2(returnValue$jscomp$0);
|
|
1172
1182
|
}
|
|
1173
1183
|
};
|
|
1174
1184
|
};
|
|
@@ -1461,9 +1471,9 @@ var require_react_development = __commonJS({
|
|
|
1461
1471
|
}
|
|
1462
1472
|
});
|
|
1463
1473
|
|
|
1464
|
-
//
|
|
1474
|
+
// node_modules/react/index.js
|
|
1465
1475
|
var require_react = __commonJS({
|
|
1466
|
-
"
|
|
1476
|
+
"node_modules/react/index.js"(exports, module) {
|
|
1467
1477
|
"use strict";
|
|
1468
1478
|
if (process.env.NODE_ENV === "production") {
|
|
1469
1479
|
module.exports = require_react_production();
|
|
@@ -1473,9 +1483,9 @@ var require_react = __commonJS({
|
|
|
1473
1483
|
}
|
|
1474
1484
|
});
|
|
1475
1485
|
|
|
1476
|
-
//
|
|
1486
|
+
// node_modules/ink/node_modules/signal-exit/signals.js
|
|
1477
1487
|
var require_signals = __commonJS({
|
|
1478
|
-
"
|
|
1488
|
+
"node_modules/ink/node_modules/signal-exit/signals.js"(exports, module) {
|
|
1479
1489
|
"use strict";
|
|
1480
1490
|
module.exports = [
|
|
1481
1491
|
"SIGABRT",
|
|
@@ -1511,9 +1521,9 @@ var require_signals = __commonJS({
|
|
|
1511
1521
|
}
|
|
1512
1522
|
});
|
|
1513
1523
|
|
|
1514
|
-
//
|
|
1524
|
+
// node_modules/ink/node_modules/signal-exit/index.js
|
|
1515
1525
|
var require_signal_exit = __commonJS({
|
|
1516
|
-
"
|
|
1526
|
+
"node_modules/ink/node_modules/signal-exit/index.js"(exports, module) {
|
|
1517
1527
|
"use strict";
|
|
1518
1528
|
var process14 = global.process;
|
|
1519
1529
|
var processOk = function(process15) {
|
|
@@ -1671,9 +1681,9 @@ var require_signal_exit = __commonJS({
|
|
|
1671
1681
|
}
|
|
1672
1682
|
});
|
|
1673
1683
|
|
|
1674
|
-
//
|
|
1684
|
+
// node_modules/react-reconciler/cjs/react-reconciler-constants.production.js
|
|
1675
1685
|
var require_react_reconciler_constants_production = __commonJS({
|
|
1676
|
-
"
|
|
1686
|
+
"node_modules/react-reconciler/cjs/react-reconciler-constants.production.js"(exports) {
|
|
1677
1687
|
"use strict";
|
|
1678
1688
|
exports.ConcurrentRoot = 1;
|
|
1679
1689
|
exports.ContinuousEventPriority = 8;
|
|
@@ -1685,17 +1695,17 @@ var require_react_reconciler_constants_production = __commonJS({
|
|
|
1685
1695
|
}
|
|
1686
1696
|
});
|
|
1687
1697
|
|
|
1688
|
-
//
|
|
1698
|
+
// node_modules/react-reconciler/cjs/react-reconciler-constants.development.js
|
|
1689
1699
|
var require_react_reconciler_constants_development = __commonJS({
|
|
1690
|
-
"
|
|
1700
|
+
"node_modules/react-reconciler/cjs/react-reconciler-constants.development.js"(exports) {
|
|
1691
1701
|
"use strict";
|
|
1692
1702
|
"production" !== process.env.NODE_ENV && (exports.ConcurrentRoot = 1, exports.ContinuousEventPriority = 8, exports.DefaultEventPriority = 32, exports.DiscreteEventPriority = 2, exports.IdleEventPriority = 268435456, exports.LegacyRoot = 0, exports.NoEventPriority = 0);
|
|
1693
1703
|
}
|
|
1694
1704
|
});
|
|
1695
1705
|
|
|
1696
|
-
//
|
|
1706
|
+
// node_modules/react-reconciler/constants.js
|
|
1697
1707
|
var require_constants = __commonJS({
|
|
1698
|
-
"
|
|
1708
|
+
"node_modules/react-reconciler/constants.js"(exports, module) {
|
|
1699
1709
|
"use strict";
|
|
1700
1710
|
if (process.env.NODE_ENV === "production") {
|
|
1701
1711
|
module.exports = require_react_reconciler_constants_production();
|
|
@@ -1705,9 +1715,9 @@ var require_constants = __commonJS({
|
|
|
1705
1715
|
}
|
|
1706
1716
|
});
|
|
1707
1717
|
|
|
1708
|
-
//
|
|
1718
|
+
// node_modules/scheduler/cjs/scheduler.production.js
|
|
1709
1719
|
var require_scheduler_production = __commonJS({
|
|
1710
|
-
"
|
|
1720
|
+
"node_modules/scheduler/cjs/scheduler.production.js"(exports) {
|
|
1711
1721
|
"use strict";
|
|
1712
1722
|
function push(heap, node) {
|
|
1713
1723
|
var index = heap.length;
|
|
@@ -1978,9 +1988,9 @@ var require_scheduler_production = __commonJS({
|
|
|
1978
1988
|
}
|
|
1979
1989
|
});
|
|
1980
1990
|
|
|
1981
|
-
//
|
|
1991
|
+
// node_modules/scheduler/cjs/scheduler.development.js
|
|
1982
1992
|
var require_scheduler_development = __commonJS({
|
|
1983
|
-
"
|
|
1993
|
+
"node_modules/scheduler/cjs/scheduler.development.js"(exports) {
|
|
1984
1994
|
"use strict";
|
|
1985
1995
|
"production" !== process.env.NODE_ENV && (function() {
|
|
1986
1996
|
function performWorkUntilDeadline() {
|
|
@@ -2237,9 +2247,9 @@ var require_scheduler_development = __commonJS({
|
|
|
2237
2247
|
}
|
|
2238
2248
|
});
|
|
2239
2249
|
|
|
2240
|
-
//
|
|
2250
|
+
// node_modules/scheduler/index.js
|
|
2241
2251
|
var require_scheduler = __commonJS({
|
|
2242
|
-
"
|
|
2252
|
+
"node_modules/scheduler/index.js"(exports, module) {
|
|
2243
2253
|
"use strict";
|
|
2244
2254
|
if (process.env.NODE_ENV === "production") {
|
|
2245
2255
|
module.exports = require_scheduler_production();
|
|
@@ -2249,9 +2259,9 @@ var require_scheduler = __commonJS({
|
|
|
2249
2259
|
}
|
|
2250
2260
|
});
|
|
2251
2261
|
|
|
2252
|
-
//
|
|
2262
|
+
// node_modules/react-reconciler/cjs/react-reconciler.production.js
|
|
2253
2263
|
var require_react_reconciler_production = __commonJS({
|
|
2254
|
-
"
|
|
2264
|
+
"node_modules/react-reconciler/cjs/react-reconciler.production.js"(exports, module) {
|
|
2255
2265
|
"use strict";
|
|
2256
2266
|
module.exports = function($$$config) {
|
|
2257
2267
|
function createFiber(tag, pendingProps, key, mode) {
|
|
@@ -3252,8 +3262,8 @@ var require_react_reconciler_production = __commonJS({
|
|
|
3252
3262
|
currentEntangledActionThenable = {
|
|
3253
3263
|
status: "pending",
|
|
3254
3264
|
value: void 0,
|
|
3255
|
-
then: function(
|
|
3256
|
-
entangledListeners.push(
|
|
3265
|
+
then: function(resolve2) {
|
|
3266
|
+
entangledListeners.push(resolve2);
|
|
3257
3267
|
}
|
|
3258
3268
|
};
|
|
3259
3269
|
}
|
|
@@ -3276,8 +3286,8 @@ var require_react_reconciler_production = __commonJS({
|
|
|
3276
3286
|
status: "pending",
|
|
3277
3287
|
value: null,
|
|
3278
3288
|
reason: null,
|
|
3279
|
-
then: function(
|
|
3280
|
-
listeners.push(
|
|
3289
|
+
then: function(resolve2) {
|
|
3290
|
+
listeners.push(resolve2);
|
|
3281
3291
|
}
|
|
3282
3292
|
};
|
|
3283
3293
|
thenable.then(
|
|
@@ -10428,9 +10438,9 @@ var require_react_reconciler_production = __commonJS({
|
|
|
10428
10438
|
}
|
|
10429
10439
|
});
|
|
10430
10440
|
|
|
10431
|
-
//
|
|
10441
|
+
// node_modules/react-reconciler/cjs/react-reconciler.development.js
|
|
10432
10442
|
var require_react_reconciler_development = __commonJS({
|
|
10433
|
-
"
|
|
10443
|
+
"node_modules/react-reconciler/cjs/react-reconciler.development.js"(exports, module) {
|
|
10434
10444
|
"use strict";
|
|
10435
10445
|
"production" !== process.env.NODE_ENV && (module.exports = function($$$config) {
|
|
10436
10446
|
function findHook(fiber, id) {
|
|
@@ -12876,8 +12886,8 @@ var require_react_reconciler_development = __commonJS({
|
|
|
12876
12886
|
currentEntangledActionThenable = {
|
|
12877
12887
|
status: "pending",
|
|
12878
12888
|
value: void 0,
|
|
12879
|
-
then: function(
|
|
12880
|
-
entangledListeners.push(
|
|
12889
|
+
then: function(resolve2) {
|
|
12890
|
+
entangledListeners.push(resolve2);
|
|
12881
12891
|
}
|
|
12882
12892
|
};
|
|
12883
12893
|
}
|
|
@@ -12900,8 +12910,8 @@ var require_react_reconciler_development = __commonJS({
|
|
|
12900
12910
|
status: "pending",
|
|
12901
12911
|
value: null,
|
|
12902
12912
|
reason: null,
|
|
12903
|
-
then: function(
|
|
12904
|
-
listeners.push(
|
|
12913
|
+
then: function(resolve2) {
|
|
12914
|
+
listeners.push(resolve2);
|
|
12905
12915
|
}
|
|
12906
12916
|
};
|
|
12907
12917
|
thenable.then(
|
|
@@ -24201,9 +24211,9 @@ var require_react_reconciler_development = __commonJS({
|
|
|
24201
24211
|
}
|
|
24202
24212
|
});
|
|
24203
24213
|
|
|
24204
|
-
//
|
|
24214
|
+
// node_modules/react-reconciler/index.js
|
|
24205
24215
|
var require_react_reconciler = __commonJS({
|
|
24206
|
-
"
|
|
24216
|
+
"node_modules/react-reconciler/index.js"(exports, module) {
|
|
24207
24217
|
"use strict";
|
|
24208
24218
|
if (process.env.NODE_ENV === "production") {
|
|
24209
24219
|
module.exports = require_react_reconciler_production();
|
|
@@ -24213,9 +24223,9 @@ var require_react_reconciler = __commonJS({
|
|
|
24213
24223
|
}
|
|
24214
24224
|
});
|
|
24215
24225
|
|
|
24216
|
-
//
|
|
24226
|
+
// node_modules/mimic-fn/index.js
|
|
24217
24227
|
var require_mimic_fn = __commonJS({
|
|
24218
|
-
"
|
|
24228
|
+
"node_modules/mimic-fn/index.js"(exports, module) {
|
|
24219
24229
|
"use strict";
|
|
24220
24230
|
var mimicFn = (to, from) => {
|
|
24221
24231
|
for (const prop of Reflect.ownKeys(from)) {
|
|
@@ -24228,9 +24238,9 @@ var require_mimic_fn = __commonJS({
|
|
|
24228
24238
|
}
|
|
24229
24239
|
});
|
|
24230
24240
|
|
|
24231
|
-
//
|
|
24241
|
+
// node_modules/onetime/index.js
|
|
24232
24242
|
var require_onetime = __commonJS({
|
|
24233
|
-
"
|
|
24243
|
+
"node_modules/onetime/index.js"(exports, module) {
|
|
24234
24244
|
"use strict";
|
|
24235
24245
|
var mimicFn = require_mimic_fn();
|
|
24236
24246
|
var calledFunctions = /* @__PURE__ */ new WeakMap();
|
|
@@ -24266,9 +24276,207 @@ var require_onetime = __commonJS({
|
|
|
24266
24276
|
}
|
|
24267
24277
|
});
|
|
24268
24278
|
|
|
24269
|
-
//
|
|
24279
|
+
// node_modules/restore-cursor/node_modules/signal-exit/signals.js
|
|
24280
|
+
var require_signals2 = __commonJS({
|
|
24281
|
+
"node_modules/restore-cursor/node_modules/signal-exit/signals.js"(exports, module) {
|
|
24282
|
+
"use strict";
|
|
24283
|
+
module.exports = [
|
|
24284
|
+
"SIGABRT",
|
|
24285
|
+
"SIGALRM",
|
|
24286
|
+
"SIGHUP",
|
|
24287
|
+
"SIGINT",
|
|
24288
|
+
"SIGTERM"
|
|
24289
|
+
];
|
|
24290
|
+
if (process.platform !== "win32") {
|
|
24291
|
+
module.exports.push(
|
|
24292
|
+
"SIGVTALRM",
|
|
24293
|
+
"SIGXCPU",
|
|
24294
|
+
"SIGXFSZ",
|
|
24295
|
+
"SIGUSR2",
|
|
24296
|
+
"SIGTRAP",
|
|
24297
|
+
"SIGSYS",
|
|
24298
|
+
"SIGQUIT",
|
|
24299
|
+
"SIGIOT"
|
|
24300
|
+
// should detect profiler and enable/disable accordingly.
|
|
24301
|
+
// see #21
|
|
24302
|
+
// 'SIGPROF'
|
|
24303
|
+
);
|
|
24304
|
+
}
|
|
24305
|
+
if (process.platform === "linux") {
|
|
24306
|
+
module.exports.push(
|
|
24307
|
+
"SIGIO",
|
|
24308
|
+
"SIGPOLL",
|
|
24309
|
+
"SIGPWR",
|
|
24310
|
+
"SIGSTKFLT",
|
|
24311
|
+
"SIGUNUSED"
|
|
24312
|
+
);
|
|
24313
|
+
}
|
|
24314
|
+
}
|
|
24315
|
+
});
|
|
24316
|
+
|
|
24317
|
+
// node_modules/restore-cursor/node_modules/signal-exit/index.js
|
|
24318
|
+
var require_signal_exit2 = __commonJS({
|
|
24319
|
+
"node_modules/restore-cursor/node_modules/signal-exit/index.js"(exports, module) {
|
|
24320
|
+
"use strict";
|
|
24321
|
+
var process14 = global.process;
|
|
24322
|
+
var processOk = function(process15) {
|
|
24323
|
+
return process15 && typeof process15 === "object" && typeof process15.removeListener === "function" && typeof process15.emit === "function" && typeof process15.reallyExit === "function" && typeof process15.listeners === "function" && typeof process15.kill === "function" && typeof process15.pid === "number" && typeof process15.on === "function";
|
|
24324
|
+
};
|
|
24325
|
+
if (!processOk(process14)) {
|
|
24326
|
+
module.exports = function() {
|
|
24327
|
+
return function() {
|
|
24328
|
+
};
|
|
24329
|
+
};
|
|
24330
|
+
} else {
|
|
24331
|
+
assert = __require("assert");
|
|
24332
|
+
signals = require_signals2();
|
|
24333
|
+
isWin = /^win/i.test(process14.platform);
|
|
24334
|
+
EE = __require("events");
|
|
24335
|
+
if (typeof EE !== "function") {
|
|
24336
|
+
EE = EE.EventEmitter;
|
|
24337
|
+
}
|
|
24338
|
+
if (process14.__signal_exit_emitter__) {
|
|
24339
|
+
emitter = process14.__signal_exit_emitter__;
|
|
24340
|
+
} else {
|
|
24341
|
+
emitter = process14.__signal_exit_emitter__ = new EE();
|
|
24342
|
+
emitter.count = 0;
|
|
24343
|
+
emitter.emitted = {};
|
|
24344
|
+
}
|
|
24345
|
+
if (!emitter.infinite) {
|
|
24346
|
+
emitter.setMaxListeners(Infinity);
|
|
24347
|
+
emitter.infinite = true;
|
|
24348
|
+
}
|
|
24349
|
+
module.exports = function(cb, opts) {
|
|
24350
|
+
if (!processOk(global.process)) {
|
|
24351
|
+
return function() {
|
|
24352
|
+
};
|
|
24353
|
+
}
|
|
24354
|
+
assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
|
|
24355
|
+
if (loaded === false) {
|
|
24356
|
+
load();
|
|
24357
|
+
}
|
|
24358
|
+
var ev = "exit";
|
|
24359
|
+
if (opts && opts.alwaysLast) {
|
|
24360
|
+
ev = "afterexit";
|
|
24361
|
+
}
|
|
24362
|
+
var remove = function() {
|
|
24363
|
+
emitter.removeListener(ev, cb);
|
|
24364
|
+
if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
|
|
24365
|
+
unload();
|
|
24366
|
+
}
|
|
24367
|
+
};
|
|
24368
|
+
emitter.on(ev, cb);
|
|
24369
|
+
return remove;
|
|
24370
|
+
};
|
|
24371
|
+
unload = function unload2() {
|
|
24372
|
+
if (!loaded || !processOk(global.process)) {
|
|
24373
|
+
return;
|
|
24374
|
+
}
|
|
24375
|
+
loaded = false;
|
|
24376
|
+
signals.forEach(function(sig) {
|
|
24377
|
+
try {
|
|
24378
|
+
process14.removeListener(sig, sigListeners[sig]);
|
|
24379
|
+
} catch (er) {
|
|
24380
|
+
}
|
|
24381
|
+
});
|
|
24382
|
+
process14.emit = originalProcessEmit;
|
|
24383
|
+
process14.reallyExit = originalProcessReallyExit;
|
|
24384
|
+
emitter.count -= 1;
|
|
24385
|
+
};
|
|
24386
|
+
module.exports.unload = unload;
|
|
24387
|
+
emit = function emit2(event, code, signal) {
|
|
24388
|
+
if (emitter.emitted[event]) {
|
|
24389
|
+
return;
|
|
24390
|
+
}
|
|
24391
|
+
emitter.emitted[event] = true;
|
|
24392
|
+
emitter.emit(event, code, signal);
|
|
24393
|
+
};
|
|
24394
|
+
sigListeners = {};
|
|
24395
|
+
signals.forEach(function(sig) {
|
|
24396
|
+
sigListeners[sig] = function listener() {
|
|
24397
|
+
if (!processOk(global.process)) {
|
|
24398
|
+
return;
|
|
24399
|
+
}
|
|
24400
|
+
var listeners = process14.listeners(sig);
|
|
24401
|
+
if (listeners.length === emitter.count) {
|
|
24402
|
+
unload();
|
|
24403
|
+
emit("exit", null, sig);
|
|
24404
|
+
emit("afterexit", null, sig);
|
|
24405
|
+
if (isWin && sig === "SIGHUP") {
|
|
24406
|
+
sig = "SIGINT";
|
|
24407
|
+
}
|
|
24408
|
+
process14.kill(process14.pid, sig);
|
|
24409
|
+
}
|
|
24410
|
+
};
|
|
24411
|
+
});
|
|
24412
|
+
module.exports.signals = function() {
|
|
24413
|
+
return signals;
|
|
24414
|
+
};
|
|
24415
|
+
loaded = false;
|
|
24416
|
+
load = function load2() {
|
|
24417
|
+
if (loaded || !processOk(global.process)) {
|
|
24418
|
+
return;
|
|
24419
|
+
}
|
|
24420
|
+
loaded = true;
|
|
24421
|
+
emitter.count += 1;
|
|
24422
|
+
signals = signals.filter(function(sig) {
|
|
24423
|
+
try {
|
|
24424
|
+
process14.on(sig, sigListeners[sig]);
|
|
24425
|
+
return true;
|
|
24426
|
+
} catch (er) {
|
|
24427
|
+
return false;
|
|
24428
|
+
}
|
|
24429
|
+
});
|
|
24430
|
+
process14.emit = processEmit;
|
|
24431
|
+
process14.reallyExit = processReallyExit;
|
|
24432
|
+
};
|
|
24433
|
+
module.exports.load = load;
|
|
24434
|
+
originalProcessReallyExit = process14.reallyExit;
|
|
24435
|
+
processReallyExit = function processReallyExit2(code) {
|
|
24436
|
+
if (!processOk(global.process)) {
|
|
24437
|
+
return;
|
|
24438
|
+
}
|
|
24439
|
+
process14.exitCode = code || /* istanbul ignore next */
|
|
24440
|
+
0;
|
|
24441
|
+
emit("exit", process14.exitCode, null);
|
|
24442
|
+
emit("afterexit", process14.exitCode, null);
|
|
24443
|
+
originalProcessReallyExit.call(process14, process14.exitCode);
|
|
24444
|
+
};
|
|
24445
|
+
originalProcessEmit = process14.emit;
|
|
24446
|
+
processEmit = function processEmit2(ev, arg) {
|
|
24447
|
+
if (ev === "exit" && processOk(global.process)) {
|
|
24448
|
+
if (arg !== void 0) {
|
|
24449
|
+
process14.exitCode = arg;
|
|
24450
|
+
}
|
|
24451
|
+
var ret = originalProcessEmit.apply(this, arguments);
|
|
24452
|
+
emit("exit", process14.exitCode, null);
|
|
24453
|
+
emit("afterexit", process14.exitCode, null);
|
|
24454
|
+
return ret;
|
|
24455
|
+
} else {
|
|
24456
|
+
return originalProcessEmit.apply(this, arguments);
|
|
24457
|
+
}
|
|
24458
|
+
};
|
|
24459
|
+
}
|
|
24460
|
+
var assert;
|
|
24461
|
+
var signals;
|
|
24462
|
+
var isWin;
|
|
24463
|
+
var EE;
|
|
24464
|
+
var emitter;
|
|
24465
|
+
var unload;
|
|
24466
|
+
var emit;
|
|
24467
|
+
var sigListeners;
|
|
24468
|
+
var loaded;
|
|
24469
|
+
var load;
|
|
24470
|
+
var originalProcessReallyExit;
|
|
24471
|
+
var processReallyExit;
|
|
24472
|
+
var originalProcessEmit;
|
|
24473
|
+
var processEmit;
|
|
24474
|
+
}
|
|
24475
|
+
});
|
|
24476
|
+
|
|
24477
|
+
// node_modules/escape-string-regexp/index.js
|
|
24270
24478
|
var require_escape_string_regexp = __commonJS({
|
|
24271
|
-
"
|
|
24479
|
+
"node_modules/escape-string-regexp/index.js"(exports, module) {
|
|
24272
24480
|
"use strict";
|
|
24273
24481
|
var matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g;
|
|
24274
24482
|
module.exports = (string) => {
|
|
@@ -24280,9 +24488,9 @@ var require_escape_string_regexp = __commonJS({
|
|
|
24280
24488
|
}
|
|
24281
24489
|
});
|
|
24282
24490
|
|
|
24283
|
-
//
|
|
24491
|
+
// node_modules/stack-utils/index.js
|
|
24284
24492
|
var require_stack_utils = __commonJS({
|
|
24285
|
-
"
|
|
24493
|
+
"node_modules/stack-utils/index.js"(exports, module) {
|
|
24286
24494
|
"use strict";
|
|
24287
24495
|
var escapeStringRegexp = require_escape_string_regexp();
|
|
24288
24496
|
var cwd2 = typeof process === "object" && process && typeof process.cwd === "function" ? process.cwd() : ".";
|
|
@@ -24533,9 +24741,9 @@ var require_stack_utils = __commonJS({
|
|
|
24533
24741
|
}
|
|
24534
24742
|
});
|
|
24535
24743
|
|
|
24536
|
-
//
|
|
24744
|
+
// node_modules/react/cjs/react-jsx-runtime.production.js
|
|
24537
24745
|
var require_react_jsx_runtime_production = __commonJS({
|
|
24538
|
-
"
|
|
24746
|
+
"node_modules/react/cjs/react-jsx-runtime.production.js"(exports) {
|
|
24539
24747
|
"use strict";
|
|
24540
24748
|
var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element");
|
|
24541
24749
|
var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
@@ -24563,9 +24771,9 @@ var require_react_jsx_runtime_production = __commonJS({
|
|
|
24563
24771
|
}
|
|
24564
24772
|
});
|
|
24565
24773
|
|
|
24566
|
-
//
|
|
24774
|
+
// node_modules/react/cjs/react-jsx-runtime.development.js
|
|
24567
24775
|
var require_react_jsx_runtime_development = __commonJS({
|
|
24568
|
-
"
|
|
24776
|
+
"node_modules/react/cjs/react-jsx-runtime.development.js"(exports) {
|
|
24569
24777
|
"use strict";
|
|
24570
24778
|
"production" !== process.env.NODE_ENV && (function() {
|
|
24571
24779
|
function getComponentNameFromType(type) {
|
|
@@ -24820,9 +25028,9 @@ var require_react_jsx_runtime_development = __commonJS({
|
|
|
24820
25028
|
}
|
|
24821
25029
|
});
|
|
24822
25030
|
|
|
24823
|
-
//
|
|
25031
|
+
// node_modules/react/jsx-runtime.js
|
|
24824
25032
|
var require_jsx_runtime = __commonJS({
|
|
24825
|
-
"
|
|
25033
|
+
"node_modules/react/jsx-runtime.js"(exports, module) {
|
|
24826
25034
|
"use strict";
|
|
24827
25035
|
if (process.env.NODE_ENV === "production") {
|
|
24828
25036
|
module.exports = require_react_jsx_runtime_production();
|
|
@@ -24832,15 +25040,18 @@ var require_jsx_runtime = __commonJS({
|
|
|
24832
25040
|
}
|
|
24833
25041
|
});
|
|
24834
25042
|
|
|
24835
|
-
//
|
|
25043
|
+
// src/tui/app.tsx
|
|
25044
|
+
import { createHash } from "crypto";
|
|
25045
|
+
|
|
25046
|
+
// node_modules/ink/build/render.js
|
|
24836
25047
|
import { Stream } from "stream";
|
|
24837
25048
|
import process13 from "process";
|
|
24838
25049
|
|
|
24839
|
-
//
|
|
25050
|
+
// node_modules/ink/build/ink.js
|
|
24840
25051
|
var import_react16 = __toESM(require_react(), 1);
|
|
24841
25052
|
import process12 from "process";
|
|
24842
25053
|
|
|
24843
|
-
//
|
|
25054
|
+
// node_modules/es-toolkit/dist/function/debounce.mjs
|
|
24844
25055
|
function debounce(func, debounceMs, { signal, edges } = {}) {
|
|
24845
25056
|
let pendingThis = void 0;
|
|
24846
25057
|
let pendingArgs = null;
|
|
@@ -24894,7 +25105,7 @@ function debounce(func, debounceMs, { signal, edges } = {}) {
|
|
|
24894
25105
|
return debounced;
|
|
24895
25106
|
}
|
|
24896
25107
|
|
|
24897
|
-
//
|
|
25108
|
+
// node_modules/es-toolkit/dist/compat/function/debounce.mjs
|
|
24898
25109
|
function debounce2(func, debounceMs = 0, options = {}) {
|
|
24899
25110
|
if (typeof options !== "object") options = {};
|
|
24900
25111
|
const { leading = false, trailing = true, maxWait } = options;
|
|
@@ -24911,7 +25122,7 @@ function debounce2(func, debounceMs = 0, options = {}) {
|
|
|
24911
25122
|
if (maxWait != null) {
|
|
24912
25123
|
if (pendingAt === null) pendingAt = Date.now();
|
|
24913
25124
|
if (Date.now() - pendingAt >= maxWait) {
|
|
24914
|
-
|
|
25125
|
+
result = func.apply(this, args);
|
|
24915
25126
|
pendingAt = Date.now();
|
|
24916
25127
|
_debounced.cancel();
|
|
24917
25128
|
_debounced.schedule();
|
|
@@ -24930,7 +25141,7 @@ function debounce2(func, debounceMs = 0, options = {}) {
|
|
|
24930
25141
|
return debounced;
|
|
24931
25142
|
}
|
|
24932
25143
|
|
|
24933
|
-
//
|
|
25144
|
+
// node_modules/es-toolkit/dist/compat/function/throttle.mjs
|
|
24934
25145
|
function throttle(func, throttleMs = 0, options = {}) {
|
|
24935
25146
|
const { leading = true, trailing = true } = options;
|
|
24936
25147
|
return debounce2(func, throttleMs, {
|
|
@@ -24940,7 +25151,7 @@ function throttle(func, throttleMs = 0, options = {}) {
|
|
|
24940
25151
|
});
|
|
24941
25152
|
}
|
|
24942
25153
|
|
|
24943
|
-
//
|
|
25154
|
+
// node_modules/ansi-escapes/base.js
|
|
24944
25155
|
var base_exports = {};
|
|
24945
25156
|
__export(base_exports, {
|
|
24946
25157
|
ConEmu: () => ConEmu,
|
|
@@ -24984,7 +25195,7 @@ __export(base_exports, {
|
|
|
24984
25195
|
import process2 from "process";
|
|
24985
25196
|
import os from "os";
|
|
24986
25197
|
|
|
24987
|
-
//
|
|
25198
|
+
// node_modules/environment/index.js
|
|
24988
25199
|
var isBrowser = globalThis.window?.document !== void 0;
|
|
24989
25200
|
var isNode = globalThis.process?.versions?.node !== void 0;
|
|
24990
25201
|
var isBun = globalThis.process?.versions?.bun !== void 0;
|
|
@@ -25002,7 +25213,7 @@ var isLinux = platform === "Linux" || globalThis.navigator?.platform?.startsWith
|
|
|
25002
25213
|
var isIos = platform === "iOS" || globalThis.navigator?.platform === "MacIntel" && globalThis.navigator?.maxTouchPoints > 1 || /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);
|
|
25003
25214
|
var isAndroid = platform === "Android" || globalThis.navigator?.platform === "Android" || globalThis.navigator?.userAgent?.includes(" Android ") === true || globalThis.process?.platform === "android";
|
|
25004
25215
|
|
|
25005
|
-
//
|
|
25216
|
+
// node_modules/ansi-escapes/base.js
|
|
25006
25217
|
var ESC = "\x1B[";
|
|
25007
25218
|
var OSC = "\x1B]";
|
|
25008
25219
|
var BEL = "\x07";
|
|
@@ -25142,13 +25353,13 @@ var ConEmu = {
|
|
|
25142
25353
|
};
|
|
25143
25354
|
var setCwd = (cwd2 = cwdFunction()) => iTerm.setCwd(cwd2) + ConEmu.setCwd(cwd2);
|
|
25144
25355
|
|
|
25145
|
-
//
|
|
25356
|
+
// node_modules/is-in-ci/index.js
|
|
25146
25357
|
import { env } from "process";
|
|
25147
25358
|
var check = (key) => key in env && env[key] !== "0" && env[key] !== "false";
|
|
25148
25359
|
var isInCi = check("CI") || check("CONTINUOUS_INTEGRATION");
|
|
25149
25360
|
var is_in_ci_default = isInCi;
|
|
25150
25361
|
|
|
25151
|
-
//
|
|
25362
|
+
// node_modules/auto-bind/index.js
|
|
25152
25363
|
var getAllProperties = (object) => {
|
|
25153
25364
|
const properties = /* @__PURE__ */ new Set();
|
|
25154
25365
|
do {
|
|
@@ -25181,10 +25392,10 @@ function autoBind(self, { include, exclude } = {}) {
|
|
|
25181
25392
|
return self;
|
|
25182
25393
|
}
|
|
25183
25394
|
|
|
25184
|
-
//
|
|
25395
|
+
// node_modules/ink/build/ink.js
|
|
25185
25396
|
var import_signal_exit2 = __toESM(require_signal_exit(), 1);
|
|
25186
25397
|
|
|
25187
|
-
//
|
|
25398
|
+
// node_modules/patch-console/dist/index.js
|
|
25188
25399
|
import { PassThrough } from "stream";
|
|
25189
25400
|
var consoleMethods = [
|
|
25190
25401
|
"assert",
|
|
@@ -25230,10 +25441,10 @@ var patchConsole = (callback) => {
|
|
|
25230
25441
|
};
|
|
25231
25442
|
var dist_default = patchConsole;
|
|
25232
25443
|
|
|
25233
|
-
//
|
|
25444
|
+
// node_modules/ink/build/ink.js
|
|
25234
25445
|
var import_constants2 = __toESM(require_constants(), 1);
|
|
25235
25446
|
|
|
25236
|
-
//
|
|
25447
|
+
// node_modules/yoga-layout/dist/binaries/yoga-wasm-base64-esm.js
|
|
25237
25448
|
var loadYoga = (() => {
|
|
25238
25449
|
var _scriptDir = import.meta.url;
|
|
25239
25450
|
return (function(loadYoga2) {
|
|
@@ -26464,7 +26675,7 @@ var loadYoga = (() => {
|
|
|
26464
26675
|
})();
|
|
26465
26676
|
var yoga_wasm_base64_esm_default = loadYoga;
|
|
26466
26677
|
|
|
26467
|
-
//
|
|
26678
|
+
// node_modules/yoga-layout/dist/src/generated/YGEnums.js
|
|
26468
26679
|
var Align = /* @__PURE__ */ (function(Align2) {
|
|
26469
26680
|
Align2[Align2["Auto"] = 0] = "Auto";
|
|
26470
26681
|
Align2[Align2["FlexStart"] = 1] = "FlexStart";
|
|
@@ -26667,7 +26878,7 @@ var constants = {
|
|
|
26667
26878
|
};
|
|
26668
26879
|
var YGEnums_default = constants;
|
|
26669
26880
|
|
|
26670
|
-
//
|
|
26881
|
+
// node_modules/yoga-layout/dist/src/wrapAssembly.js
|
|
26671
26882
|
function wrapAssembly(lib) {
|
|
26672
26883
|
function patch(prototype, name, fn) {
|
|
26673
26884
|
const original = prototype[name];
|
|
@@ -26768,11 +26979,11 @@ function wrapAssembly(lib) {
|
|
|
26768
26979
|
};
|
|
26769
26980
|
}
|
|
26770
26981
|
|
|
26771
|
-
//
|
|
26982
|
+
// node_modules/yoga-layout/dist/src/index.js
|
|
26772
26983
|
var Yoga = wrapAssembly(await yoga_wasm_base64_esm_default());
|
|
26773
26984
|
var src_default = Yoga;
|
|
26774
26985
|
|
|
26775
|
-
//
|
|
26986
|
+
// node_modules/wrap-ansi/node_modules/ansi-regex/index.js
|
|
26776
26987
|
function ansiRegex({ onlyFirst = false } = {}) {
|
|
26777
26988
|
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
26778
26989
|
const osc = `(?:\\u001B\\][^\\u0007\\u001B\\u009C]*${ST})`;
|
|
@@ -26781,7 +26992,7 @@ function ansiRegex({ onlyFirst = false } = {}) {
|
|
|
26781
26992
|
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
26782
26993
|
}
|
|
26783
26994
|
|
|
26784
|
-
//
|
|
26995
|
+
// node_modules/wrap-ansi/node_modules/strip-ansi/index.js
|
|
26785
26996
|
var regex = ansiRegex();
|
|
26786
26997
|
function stripAnsi(string) {
|
|
26787
26998
|
if (typeof string !== "string") {
|
|
@@ -26793,7 +27004,7 @@ function stripAnsi(string) {
|
|
|
26793
27004
|
return string.replace(regex, "");
|
|
26794
27005
|
}
|
|
26795
27006
|
|
|
26796
|
-
//
|
|
27007
|
+
// node_modules/get-east-asian-width/lookup-data.js
|
|
26797
27008
|
var ambiguousMinimalCodePoint = 161;
|
|
26798
27009
|
var ambiguousMaximumCodePoint = 1114109;
|
|
26799
27010
|
var ambiguousRanges = [161, 161, 164, 164, 167, 168, 170, 170, 173, 174, 176, 180, 182, 186, 188, 191, 198, 198, 208, 208, 215, 216, 222, 225, 230, 230, 232, 234, 236, 237, 240, 240, 242, 243, 247, 250, 252, 252, 254, 254, 257, 257, 273, 273, 275, 275, 283, 283, 294, 295, 299, 299, 305, 307, 312, 312, 319, 322, 324, 324, 328, 331, 333, 333, 338, 339, 358, 359, 363, 363, 462, 462, 464, 464, 466, 466, 468, 468, 470, 470, 472, 472, 474, 474, 476, 476, 593, 593, 609, 609, 708, 708, 711, 711, 713, 715, 717, 717, 720, 720, 728, 731, 733, 733, 735, 735, 768, 879, 913, 929, 931, 937, 945, 961, 963, 969, 1025, 1025, 1040, 1103, 1105, 1105, 8208, 8208, 8211, 8214, 8216, 8217, 8220, 8221, 8224, 8226, 8228, 8231, 8240, 8240, 8242, 8243, 8245, 8245, 8251, 8251, 8254, 8254, 8308, 8308, 8319, 8319, 8321, 8324, 8364, 8364, 8451, 8451, 8453, 8453, 8457, 8457, 8467, 8467, 8470, 8470, 8481, 8482, 8486, 8486, 8491, 8491, 8531, 8532, 8539, 8542, 8544, 8555, 8560, 8569, 8585, 8585, 8592, 8601, 8632, 8633, 8658, 8658, 8660, 8660, 8679, 8679, 8704, 8704, 8706, 8707, 8711, 8712, 8715, 8715, 8719, 8719, 8721, 8721, 8725, 8725, 8730, 8730, 8733, 8736, 8739, 8739, 8741, 8741, 8743, 8748, 8750, 8750, 8756, 8759, 8764, 8765, 8776, 8776, 8780, 8780, 8786, 8786, 8800, 8801, 8804, 8807, 8810, 8811, 8814, 8815, 8834, 8835, 8838, 8839, 8853, 8853, 8857, 8857, 8869, 8869, 8895, 8895, 8978, 8978, 9312, 9449, 9451, 9547, 9552, 9587, 9600, 9615, 9618, 9621, 9632, 9633, 9635, 9641, 9650, 9651, 9654, 9655, 9660, 9661, 9664, 9665, 9670, 9672, 9675, 9675, 9678, 9681, 9698, 9701, 9711, 9711, 9733, 9734, 9737, 9737, 9742, 9743, 9756, 9756, 9758, 9758, 9792, 9792, 9794, 9794, 9824, 9825, 9827, 9829, 9831, 9834, 9836, 9837, 9839, 9839, 9886, 9887, 9919, 9919, 9926, 9933, 9935, 9939, 9941, 9953, 9955, 9955, 9960, 9961, 9963, 9969, 9972, 9972, 9974, 9977, 9979, 9980, 9982, 9983, 10045, 10045, 10102, 10111, 11094, 11097, 12872, 12879, 57344, 63743, 65024, 65039, 65533, 65533, 127232, 127242, 127248, 127277, 127280, 127337, 127344, 127373, 127375, 127376, 127387, 127404, 917760, 917999, 983040, 1048573, 1048576, 1114109];
|
|
@@ -26804,7 +27015,7 @@ var wideMinimalCodePoint = 4352;
|
|
|
26804
27015
|
var wideMaximumCodePoint = 262141;
|
|
26805
27016
|
var wideRanges = [4352, 4447, 8986, 8987, 9001, 9002, 9193, 9196, 9200, 9200, 9203, 9203, 9725, 9726, 9748, 9749, 9776, 9783, 9800, 9811, 9855, 9855, 9866, 9871, 9875, 9875, 9889, 9889, 9898, 9899, 9917, 9918, 9924, 9925, 9934, 9934, 9940, 9940, 9962, 9962, 9970, 9971, 9973, 9973, 9978, 9978, 9981, 9981, 9989, 9989, 9994, 9995, 10024, 10024, 10060, 10060, 10062, 10062, 10067, 10069, 10071, 10071, 10133, 10135, 10160, 10160, 10175, 10175, 11035, 11036, 11088, 11088, 11093, 11093, 11904, 11929, 11931, 12019, 12032, 12245, 12272, 12287, 12289, 12350, 12353, 12438, 12441, 12543, 12549, 12591, 12593, 12686, 12688, 12773, 12783, 12830, 12832, 12871, 12880, 42124, 42128, 42182, 43360, 43388, 44032, 55203, 63744, 64255, 65040, 65049, 65072, 65106, 65108, 65126, 65128, 65131, 94176, 94180, 94192, 94198, 94208, 101589, 101631, 101662, 101760, 101874, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127488, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 127776, 127789, 127797, 127799, 127868, 127870, 127891, 127904, 127946, 127951, 127955, 127968, 127984, 127988, 127988, 127992, 128062, 128064, 128064, 128066, 128252, 128255, 128317, 128331, 128334, 128336, 128359, 128378, 128378, 128405, 128406, 128420, 128420, 128507, 128591, 128640, 128709, 128716, 128716, 128720, 128722, 128725, 128728, 128732, 128735, 128747, 128748, 128756, 128764, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129674, 129678, 129734, 129736, 129736, 129741, 129756, 129759, 129770, 129775, 129784, 131072, 196605, 196608, 262141];
|
|
26806
27017
|
|
|
26807
|
-
//
|
|
27018
|
+
// node_modules/get-east-asian-width/utilities.js
|
|
26808
27019
|
var isInRange = (ranges, codePoint) => {
|
|
26809
27020
|
let low = 0;
|
|
26810
27021
|
let high = Math.floor(ranges.length / 2) - 1;
|
|
@@ -26822,7 +27033,7 @@ var isInRange = (ranges, codePoint) => {
|
|
|
26822
27033
|
return false;
|
|
26823
27034
|
};
|
|
26824
27035
|
|
|
26825
|
-
//
|
|
27036
|
+
// node_modules/get-east-asian-width/lookup.js
|
|
26826
27037
|
var commonCjkCodePoint = 19968;
|
|
26827
27038
|
var [wideFastPathStart, wideFastPathEnd] = /* @__PURE__ */ findWideFastPathRange(wideRanges);
|
|
26828
27039
|
function findWideFastPathRange(ranges) {
|
|
@@ -26863,7 +27074,7 @@ var isWide = (codePoint) => {
|
|
|
26863
27074
|
return isInRange(wideRanges, codePoint);
|
|
26864
27075
|
};
|
|
26865
27076
|
|
|
26866
|
-
//
|
|
27077
|
+
// node_modules/get-east-asian-width/index.js
|
|
26867
27078
|
function validate(codePoint) {
|
|
26868
27079
|
if (!Number.isSafeInteger(codePoint)) {
|
|
26869
27080
|
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
@@ -26877,7 +27088,7 @@ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
|
26877
27088
|
return 1;
|
|
26878
27089
|
}
|
|
26879
27090
|
|
|
26880
|
-
//
|
|
27091
|
+
// node_modules/wrap-ansi/node_modules/string-width/index.js
|
|
26881
27092
|
var segmenter = new Intl.Segmenter();
|
|
26882
27093
|
var zeroWidthClusterRegex = new RegExp("^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Format}|\\p{Nonspacing_Mark}|\\p{Enclosing_Mark}|\\p{Surrogate})+$", "v");
|
|
26883
27094
|
var leadingNonPrintingRegex = new RegExp("^[\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Nonspacing_Mark}\\p{Enclosing_Mark}\\p{Surrogate}]+", "v");
|
|
@@ -27003,7 +27214,7 @@ function stringWidth2(input, options = {}) {
|
|
|
27003
27214
|
return width;
|
|
27004
27215
|
}
|
|
27005
27216
|
|
|
27006
|
-
//
|
|
27217
|
+
// node_modules/ansi-styles/index.js
|
|
27007
27218
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
27008
27219
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
27009
27220
|
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
@@ -27189,7 +27400,7 @@ function assembleStyles() {
|
|
|
27189
27400
|
var ansiStyles = assembleStyles();
|
|
27190
27401
|
var ansi_styles_default = ansiStyles;
|
|
27191
27402
|
|
|
27192
|
-
//
|
|
27403
|
+
// node_modules/wrap-ansi/index.js
|
|
27193
27404
|
var ANSI_ESCAPE = "\x1B";
|
|
27194
27405
|
var ANSI_ESCAPE_BELL = "\x07";
|
|
27195
27406
|
var C1_CSI = "\x9B";
|
|
@@ -27479,21 +27690,21 @@ var getClosingSgrSequence = (activeStyles) => [...activeStyles].reverse().map((a
|
|
|
27479
27690
|
var getOpeningSgrSequence = (activeStyles) => activeStyles.map((activeStyle) => wrapAnsiCode(activeStyle.open)).join("");
|
|
27480
27691
|
var wrapWord = (rows, word, columns2, rowWidth2) => {
|
|
27481
27692
|
const tokens = getTokens(word);
|
|
27482
|
-
let
|
|
27693
|
+
let visible2 = rowWidth2;
|
|
27483
27694
|
for (let index = 0; index < tokens.length; index++) {
|
|
27484
27695
|
const token = tokens[index];
|
|
27485
|
-
if (token.width > 0 &&
|
|
27696
|
+
if (token.width > 0 && visible2 > 0 && visible2 + token.width > columns2) {
|
|
27486
27697
|
rows.push("");
|
|
27487
|
-
|
|
27698
|
+
visible2 = 0;
|
|
27488
27699
|
}
|
|
27489
27700
|
rows[rows.length - 1] += token.value;
|
|
27490
|
-
|
|
27491
|
-
if (
|
|
27701
|
+
visible2 += token.width;
|
|
27702
|
+
if (visible2 === columns2 && index < tokens.length - 1) {
|
|
27492
27703
|
rows.push("");
|
|
27493
|
-
|
|
27704
|
+
visible2 = 0;
|
|
27494
27705
|
}
|
|
27495
27706
|
}
|
|
27496
|
-
if (!
|
|
27707
|
+
if (!visible2 && rows.at(-1).length > 0 && rows.length > 1) {
|
|
27497
27708
|
rows[rows.length - 2] += rows.pop();
|
|
27498
27709
|
}
|
|
27499
27710
|
return getWidth(rows.at(-1));
|
|
@@ -27528,7 +27739,7 @@ var expandTabs = (line) => {
|
|
|
27528
27739
|
if (!line.includes(" ")) {
|
|
27529
27740
|
return line;
|
|
27530
27741
|
}
|
|
27531
|
-
let
|
|
27742
|
+
let visible2 = 0;
|
|
27532
27743
|
let expandedLine = "";
|
|
27533
27744
|
let plainTextSinceTab = "";
|
|
27534
27745
|
const expandPlainText = (plainText) => {
|
|
@@ -27537,11 +27748,11 @@ var expandTabs = (line) => {
|
|
|
27537
27748
|
expandedLine += segment;
|
|
27538
27749
|
plainTextSinceTab += segment;
|
|
27539
27750
|
if (index < segments.length - 1) {
|
|
27540
|
-
|
|
27751
|
+
visible2 += getStringWidth(plainTextSinceTab);
|
|
27541
27752
|
plainTextSinceTab = "";
|
|
27542
|
-
const spaces = TAB_SIZE -
|
|
27753
|
+
const spaces = TAB_SIZE - visible2 % TAB_SIZE;
|
|
27543
27754
|
expandedLine += " ".repeat(spaces);
|
|
27544
|
-
|
|
27755
|
+
visible2 += spaces;
|
|
27545
27756
|
}
|
|
27546
27757
|
}
|
|
27547
27758
|
};
|
|
@@ -27668,7 +27879,7 @@ function wrapAnsi(string, columns2, options) {
|
|
|
27668
27879
|
return String(string).normalize().replaceAll("\r\n", "\n").split("\n").map((line) => exec(expandTabs(line), columns2, options)).join("\n");
|
|
27669
27880
|
}
|
|
27670
27881
|
|
|
27671
|
-
//
|
|
27882
|
+
// node_modules/terminal-size/index.js
|
|
27672
27883
|
import process3 from "process";
|
|
27673
27884
|
import { execFileSync } from "child_process";
|
|
27674
27885
|
import fs from "fs";
|
|
@@ -27774,7 +27985,7 @@ var resize = () => {
|
|
|
27774
27985
|
}
|
|
27775
27986
|
};
|
|
27776
27987
|
|
|
27777
|
-
//
|
|
27988
|
+
// node_modules/ink/build/utils.js
|
|
27778
27989
|
var getWindowSize = (stdout) => {
|
|
27779
27990
|
const { columns: columns2, rows } = stdout;
|
|
27780
27991
|
if (columns2 && rows) {
|
|
@@ -27787,14 +27998,14 @@ var getWindowSize = (stdout) => {
|
|
|
27787
27998
|
};
|
|
27788
27999
|
};
|
|
27789
28000
|
|
|
27790
|
-
//
|
|
28001
|
+
// node_modules/ink/build/reconciler.js
|
|
27791
28002
|
var import_react_reconciler = __toESM(require_react_reconciler(), 1);
|
|
27792
28003
|
var import_constants = __toESM(require_constants(), 1);
|
|
27793
28004
|
var Scheduler = __toESM(require_scheduler(), 1);
|
|
27794
28005
|
import process4 from "process";
|
|
27795
28006
|
var import_react = __toESM(require_react(), 1);
|
|
27796
28007
|
|
|
27797
|
-
//
|
|
28008
|
+
// node_modules/widest-line/node_modules/ansi-regex/index.js
|
|
27798
28009
|
function ansiRegex2({ onlyFirst = false } = {}) {
|
|
27799
28010
|
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
27800
28011
|
const osc = `(?:\\u001B\\][^\\u0007\\u001B\\u009C]*${ST})`;
|
|
@@ -27803,7 +28014,7 @@ function ansiRegex2({ onlyFirst = false } = {}) {
|
|
|
27803
28014
|
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
27804
28015
|
}
|
|
27805
28016
|
|
|
27806
|
-
//
|
|
28017
|
+
// node_modules/widest-line/node_modules/strip-ansi/index.js
|
|
27807
28018
|
var regex2 = ansiRegex2();
|
|
27808
28019
|
function stripAnsi2(string) {
|
|
27809
28020
|
if (typeof string !== "string") {
|
|
@@ -27815,7 +28026,7 @@ function stripAnsi2(string) {
|
|
|
27815
28026
|
return string.replace(regex2, "");
|
|
27816
28027
|
}
|
|
27817
28028
|
|
|
27818
|
-
//
|
|
28029
|
+
// node_modules/widest-line/node_modules/string-width/index.js
|
|
27819
28030
|
var segmenter3 = new Intl.Segmenter();
|
|
27820
28031
|
var zeroWidthClusterRegex2 = new RegExp("^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Format}|\\p{Nonspacing_Mark}|\\p{Enclosing_Mark}|\\p{Surrogate})+$", "v");
|
|
27821
28032
|
var leadingNonPrintingRegex2 = new RegExp("^[\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Nonspacing_Mark}\\p{Enclosing_Mark}\\p{Surrogate}]+", "v");
|
|
@@ -27941,7 +28152,7 @@ function stringWidth3(input, options = {}) {
|
|
|
27941
28152
|
return width;
|
|
27942
28153
|
}
|
|
27943
28154
|
|
|
27944
|
-
//
|
|
28155
|
+
// node_modules/widest-line/index.js
|
|
27945
28156
|
function widestLine(string) {
|
|
27946
28157
|
let lineWidth = 0;
|
|
27947
28158
|
for (const line of string.split("\n")) {
|
|
@@ -27950,7 +28161,7 @@ function widestLine(string) {
|
|
|
27950
28161
|
return lineWidth;
|
|
27951
28162
|
}
|
|
27952
28163
|
|
|
27953
|
-
//
|
|
28164
|
+
// node_modules/ink/build/measure-text.js
|
|
27954
28165
|
var cache = /* @__PURE__ */ new Map();
|
|
27955
28166
|
var measureText = (text) => {
|
|
27956
28167
|
if (text.length === 0) {
|
|
@@ -27971,7 +28182,7 @@ var measureText = (text) => {
|
|
|
27971
28182
|
};
|
|
27972
28183
|
var measure_text_default = measureText;
|
|
27973
28184
|
|
|
27974
|
-
//
|
|
28185
|
+
// node_modules/slice-ansi/node_modules/is-fullwidth-code-point/index.js
|
|
27975
28186
|
function isFullwidthCodePoint(codePoint) {
|
|
27976
28187
|
if (!Number.isInteger(codePoint)) {
|
|
27977
28188
|
return false;
|
|
@@ -27979,7 +28190,7 @@ function isFullwidthCodePoint(codePoint) {
|
|
|
27979
28190
|
return isFullWidth(codePoint) || isWide(codePoint);
|
|
27980
28191
|
}
|
|
27981
28192
|
|
|
27982
|
-
//
|
|
28193
|
+
// node_modules/slice-ansi/tokenize-ansi.js
|
|
27983
28194
|
var ESCAPE_CODE_POINT = 27;
|
|
27984
28195
|
var C1_DCS_CODE_POINT = 144;
|
|
27985
28196
|
var C1_SOS_CODE_POINT = 152;
|
|
@@ -28585,7 +28796,7 @@ function tokenizeAnsi(string, { endCharacter = Number.POSITIVE_INFINITY } = {})
|
|
|
28585
28796
|
return tokens;
|
|
28586
28797
|
}
|
|
28587
28798
|
|
|
28588
|
-
//
|
|
28799
|
+
// node_modules/slice-ansi/index.js
|
|
28589
28800
|
function applySgrFragments(activeStyles, fragments) {
|
|
28590
28801
|
for (const fragment of fragments) {
|
|
28591
28802
|
switch (fragment.type) {
|
|
@@ -28815,7 +29026,7 @@ function sliceAnsi(string, start, end) {
|
|
|
28815
29026
|
return returnValue;
|
|
28816
29027
|
}
|
|
28817
29028
|
|
|
28818
|
-
//
|
|
29029
|
+
// node_modules/cli-truncate/node_modules/ansi-regex/index.js
|
|
28819
29030
|
function ansiRegex3({ onlyFirst = false } = {}) {
|
|
28820
29031
|
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
28821
29032
|
const osc = `(?:\\u001B\\][^\\u0007\\u001B\\u009C]*${ST})`;
|
|
@@ -28824,7 +29035,7 @@ function ansiRegex3({ onlyFirst = false } = {}) {
|
|
|
28824
29035
|
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
28825
29036
|
}
|
|
28826
29037
|
|
|
28827
|
-
//
|
|
29038
|
+
// node_modules/cli-truncate/node_modules/strip-ansi/index.js
|
|
28828
29039
|
var regex3 = ansiRegex3();
|
|
28829
29040
|
function stripAnsi3(string) {
|
|
28830
29041
|
if (typeof string !== "string") {
|
|
@@ -28836,7 +29047,7 @@ function stripAnsi3(string) {
|
|
|
28836
29047
|
return string.replace(regex3, "");
|
|
28837
29048
|
}
|
|
28838
29049
|
|
|
28839
|
-
//
|
|
29050
|
+
// node_modules/cli-truncate/node_modules/string-width/index.js
|
|
28840
29051
|
var segmenter4 = new Intl.Segmenter();
|
|
28841
29052
|
var zeroWidthClusterRegex3 = new RegExp("^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Format}|\\p{Nonspacing_Mark}|\\p{Enclosing_Mark}|\\p{Surrogate})+$", "v");
|
|
28842
29053
|
var leadingNonPrintingRegex3 = new RegExp("^[\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Nonspacing_Mark}\\p{Enclosing_Mark}\\p{Surrogate}]+", "v");
|
|
@@ -28962,7 +29173,7 @@ function stringWidth4(input, options = {}) {
|
|
|
28962
29173
|
return width;
|
|
28963
29174
|
}
|
|
28964
29175
|
|
|
28965
|
-
//
|
|
29176
|
+
// node_modules/cli-truncate/index.js
|
|
28966
29177
|
var validPositions = /* @__PURE__ */ new Set(["start", "middle", "end"]);
|
|
28967
29178
|
function getIndexOfNearestSpace(string, wantedIndex, shouldSearchRight) {
|
|
28968
29179
|
if (string.charAt(wantedIndex) === " ") {
|
|
@@ -29048,19 +29259,19 @@ function cliTruncate(text, columns2, options = {}) {
|
|
|
29048
29259
|
}
|
|
29049
29260
|
return start;
|
|
29050
29261
|
}
|
|
29051
|
-
function appendWithInheritedStyleFromEnd(
|
|
29052
|
-
const start = trailingSgrSpanStartIndex(
|
|
29053
|
-
if (start ===
|
|
29054
|
-
return
|
|
29262
|
+
function appendWithInheritedStyleFromEnd(visible2, suffix) {
|
|
29263
|
+
const start = trailingSgrSpanStartIndex(visible2);
|
|
29264
|
+
if (start === visible2.length) {
|
|
29265
|
+
return visible2 + suffix;
|
|
29055
29266
|
}
|
|
29056
|
-
return
|
|
29267
|
+
return visible2.slice(0, start) + suffix + visible2.slice(start);
|
|
29057
29268
|
}
|
|
29058
|
-
function prependWithInheritedStyleFromStart(prefix,
|
|
29059
|
-
const end = leadingSgrSpanEndIndex(
|
|
29269
|
+
function prependWithInheritedStyleFromStart(prefix, visible2) {
|
|
29270
|
+
const end = leadingSgrSpanEndIndex(visible2);
|
|
29060
29271
|
if (end === 0) {
|
|
29061
|
-
return prefix +
|
|
29272
|
+
return prefix + visible2;
|
|
29062
29273
|
}
|
|
29063
|
-
return
|
|
29274
|
+
return visible2.slice(0, end) + prefix + visible2.slice(end);
|
|
29064
29275
|
}
|
|
29065
29276
|
if (position === "start") {
|
|
29066
29277
|
if (preferTruncationOnSpace) {
|
|
@@ -29104,7 +29315,7 @@ function cliTruncate(text, columns2, options = {}) {
|
|
|
29104
29315
|
}
|
|
29105
29316
|
}
|
|
29106
29317
|
|
|
29107
|
-
//
|
|
29318
|
+
// node_modules/ink/build/wrap-text.js
|
|
29108
29319
|
var cache2 = {};
|
|
29109
29320
|
var wrapText = (text, maxWidth, wrapType) => {
|
|
29110
29321
|
const cacheKey = text + String(maxWidth) + String(wrapType);
|
|
@@ -29141,7 +29352,7 @@ var wrapText = (text, maxWidth, wrapType) => {
|
|
|
29141
29352
|
};
|
|
29142
29353
|
var wrap_text_default = wrapText;
|
|
29143
29354
|
|
|
29144
|
-
//
|
|
29355
|
+
// node_modules/ink/build/ansi-tokenizer.js
|
|
29145
29356
|
var bellCharacter = "\x07";
|
|
29146
29357
|
var escapeCharacter = "\x1B";
|
|
29147
29358
|
var stringTerminatorCharacter = "\x9C";
|
|
@@ -29448,7 +29659,7 @@ var tokenizeAnsi2 = (text) => {
|
|
|
29448
29659
|
return tokens;
|
|
29449
29660
|
};
|
|
29450
29661
|
|
|
29451
|
-
//
|
|
29662
|
+
// node_modules/ink/build/sanitize-ansi.js
|
|
29452
29663
|
var sgrParametersRegex = /^[\d:;]*$/;
|
|
29453
29664
|
var sanitizeAnsi = (text) => {
|
|
29454
29665
|
if (!hasAnsiControlCharacters(text)) {
|
|
@@ -29468,7 +29679,7 @@ var sanitizeAnsi = (text) => {
|
|
|
29468
29679
|
};
|
|
29469
29680
|
var sanitize_ansi_default = sanitizeAnsi;
|
|
29470
29681
|
|
|
29471
|
-
//
|
|
29682
|
+
// node_modules/ink/build/squash-text-nodes.js
|
|
29472
29683
|
var squashTextNodes = (node) => {
|
|
29473
29684
|
let text = "";
|
|
29474
29685
|
for (let index = 0; index < node.childNodes.length; index++) {
|
|
@@ -29493,7 +29704,7 @@ var squashTextNodes = (node) => {
|
|
|
29493
29704
|
};
|
|
29494
29705
|
var squash_text_nodes_default = squashTextNodes;
|
|
29495
29706
|
|
|
29496
|
-
//
|
|
29707
|
+
// node_modules/ink/build/dom.js
|
|
29497
29708
|
var createNode = (nodeName) => {
|
|
29498
29709
|
const node = {
|
|
29499
29710
|
nodeName,
|
|
@@ -29617,7 +29828,7 @@ var emitLayoutListeners = (rootNode) => {
|
|
|
29617
29828
|
}
|
|
29618
29829
|
};
|
|
29619
29830
|
|
|
29620
|
-
//
|
|
29831
|
+
// node_modules/ink/build/styles.js
|
|
29621
29832
|
var positionEdges = [
|
|
29622
29833
|
["top", src_default.EDGE_TOP],
|
|
29623
29834
|
["right", src_default.EDGE_RIGHT],
|
|
@@ -29904,7 +30115,7 @@ var styles2 = (node, style = {}, currentStyle = style) => {
|
|
|
29904
30115
|
};
|
|
29905
30116
|
var styles_default = styles2;
|
|
29906
30117
|
|
|
29907
|
-
//
|
|
30118
|
+
// node_modules/ink/build/reconciler.js
|
|
29908
30119
|
if (process4.env["DEV"] === "true") {
|
|
29909
30120
|
let isDevtoolsInstalled = false;
|
|
29910
30121
|
try {
|
|
@@ -30191,7 +30402,7 @@ var reconciler_default = (0, import_react_reconciler.default)({
|
|
|
30191
30402
|
rendererVersion: packageInfo.version
|
|
30192
30403
|
});
|
|
30193
30404
|
|
|
30194
|
-
//
|
|
30405
|
+
// node_modules/indent-string/index.js
|
|
30195
30406
|
function indentString(string, count = 1, options = {}) {
|
|
30196
30407
|
const {
|
|
30197
30408
|
indent = " ",
|
|
@@ -30224,13 +30435,13 @@ function indentString(string, count = 1, options = {}) {
|
|
|
30224
30435
|
return string.replace(regex5, indent.repeat(count));
|
|
30225
30436
|
}
|
|
30226
30437
|
|
|
30227
|
-
//
|
|
30438
|
+
// node_modules/ink/build/get-max-width.js
|
|
30228
30439
|
var getMaxWidth = (yogaNode) => {
|
|
30229
30440
|
return yogaNode.getComputedWidth() - yogaNode.getComputedPadding(src_default.EDGE_LEFT) - yogaNode.getComputedPadding(src_default.EDGE_RIGHT) - yogaNode.getComputedBorder(src_default.EDGE_LEFT) - yogaNode.getComputedBorder(src_default.EDGE_RIGHT);
|
|
30230
30441
|
};
|
|
30231
30442
|
var get_max_width_default = getMaxWidth;
|
|
30232
30443
|
|
|
30233
|
-
//
|
|
30444
|
+
// node_modules/cli-boxes/boxes.json
|
|
30234
30445
|
var boxes_default = {
|
|
30235
30446
|
single: {
|
|
30236
30447
|
topLeft: "\u250C",
|
|
@@ -30314,10 +30525,10 @@ var boxes_default = {
|
|
|
30314
30525
|
}
|
|
30315
30526
|
};
|
|
30316
30527
|
|
|
30317
|
-
//
|
|
30528
|
+
// node_modules/cli-boxes/index.js
|
|
30318
30529
|
var cli_boxes_default = boxes_default;
|
|
30319
30530
|
|
|
30320
|
-
//
|
|
30531
|
+
// node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
30321
30532
|
var ANSI_BACKGROUND_OFFSET2 = 10;
|
|
30322
30533
|
var wrapAnsi162 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
30323
30534
|
var wrapAnsi2562 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
@@ -30503,7 +30714,7 @@ function assembleStyles2() {
|
|
|
30503
30714
|
var ansiStyles2 = assembleStyles2();
|
|
30504
30715
|
var ansi_styles_default2 = ansiStyles2;
|
|
30505
30716
|
|
|
30506
|
-
//
|
|
30717
|
+
// node_modules/chalk/source/vendor/supports-color/index.js
|
|
30507
30718
|
import process5 from "process";
|
|
30508
30719
|
import os2 from "os";
|
|
30509
30720
|
import tty2 from "tty";
|
|
@@ -30635,7 +30846,7 @@ var supportsColor = {
|
|
|
30635
30846
|
};
|
|
30636
30847
|
var supports_color_default = supportsColor;
|
|
30637
30848
|
|
|
30638
|
-
//
|
|
30849
|
+
// node_modules/chalk/source/utilities.js
|
|
30639
30850
|
function stringReplaceAll(string, substring, replacer) {
|
|
30640
30851
|
let index = string.indexOf(substring);
|
|
30641
30852
|
if (index === -1) {
|
|
@@ -30665,7 +30876,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
|
30665
30876
|
return returnValue;
|
|
30666
30877
|
}
|
|
30667
30878
|
|
|
30668
|
-
//
|
|
30879
|
+
// node_modules/chalk/source/index.js
|
|
30669
30880
|
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
30670
30881
|
var GENERATOR = /* @__PURE__ */ Symbol("GENERATOR");
|
|
30671
30882
|
var STYLER = /* @__PURE__ */ Symbol("STYLER");
|
|
@@ -30812,7 +31023,7 @@ var chalk = createChalk();
|
|
|
30812
31023
|
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
30813
31024
|
var source_default = chalk;
|
|
30814
31025
|
|
|
30815
|
-
//
|
|
31026
|
+
// node_modules/ink/build/colorize.js
|
|
30816
31027
|
var rgbRegex = /^rgb\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)$/;
|
|
30817
31028
|
var ansiRegex4 = /^ansi256\(\s?(\d+)\s?\)$/;
|
|
30818
31029
|
var isNamedColor = (color) => {
|
|
@@ -30854,7 +31065,7 @@ var colorize = (str, color, type) => {
|
|
|
30854
31065
|
};
|
|
30855
31066
|
var colorize_default = colorize;
|
|
30856
31067
|
|
|
30857
|
-
//
|
|
31068
|
+
// node_modules/ink/build/render-border.js
|
|
30858
31069
|
var stylePiece = (segment, fg, bg, dim) => {
|
|
30859
31070
|
let styled = colorize_default(segment, fg, "foreground");
|
|
30860
31071
|
styled = colorize_default(styled, bg, "background");
|
|
@@ -30925,7 +31136,7 @@ var renderBorder = (x, y, node, output) => {
|
|
|
30925
31136
|
};
|
|
30926
31137
|
var render_border_default = renderBorder;
|
|
30927
31138
|
|
|
30928
|
-
//
|
|
31139
|
+
// node_modules/ink/build/render-background.js
|
|
30929
31140
|
var renderBackground = (x, y, node, output) => {
|
|
30930
31141
|
if (!node.style.backgroundColor) {
|
|
30931
31142
|
return;
|
|
@@ -30948,7 +31159,7 @@ var renderBackground = (x, y, node, output) => {
|
|
|
30948
31159
|
};
|
|
30949
31160
|
var render_background_default = renderBackground;
|
|
30950
31161
|
|
|
30951
|
-
//
|
|
31162
|
+
// node_modules/ink/build/render-node-to-output.js
|
|
30952
31163
|
var applyPaddingToText = (node, text) => {
|
|
30953
31164
|
const yogaNode = node.childNodes[0]?.yogaNode;
|
|
30954
31165
|
if (yogaNode) {
|
|
@@ -31056,7 +31267,7 @@ var renderNodeToOutput = (node, output, options) => {
|
|
|
31056
31267
|
};
|
|
31057
31268
|
var render_node_to_output_default = renderNodeToOutput;
|
|
31058
31269
|
|
|
31059
|
-
//
|
|
31270
|
+
// node_modules/ink/node_modules/ansi-regex/index.js
|
|
31060
31271
|
function ansiRegex5({ onlyFirst = false } = {}) {
|
|
31061
31272
|
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
31062
31273
|
const osc = `(?:\\u001B\\][^\\u0007\\u001B\\u009C]*${ST})`;
|
|
@@ -31065,7 +31276,7 @@ function ansiRegex5({ onlyFirst = false } = {}) {
|
|
|
31065
31276
|
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
31066
31277
|
}
|
|
31067
31278
|
|
|
31068
|
-
//
|
|
31279
|
+
// node_modules/ink/node_modules/strip-ansi/index.js
|
|
31069
31280
|
var regex4 = ansiRegex5();
|
|
31070
31281
|
function stripAnsi4(string) {
|
|
31071
31282
|
if (typeof string !== "string") {
|
|
@@ -31077,7 +31288,7 @@ function stripAnsi4(string) {
|
|
|
31077
31288
|
return string.replace(regex4, "");
|
|
31078
31289
|
}
|
|
31079
31290
|
|
|
31080
|
-
//
|
|
31291
|
+
// node_modules/ink/node_modules/string-width/index.js
|
|
31081
31292
|
var segmenter5 = new Intl.Segmenter();
|
|
31082
31293
|
var zeroWidthClusterRegex4 = new RegExp("^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Format}|\\p{Nonspacing_Mark}|\\p{Enclosing_Mark}|\\p{Surrogate})+$", "v");
|
|
31083
31294
|
var leadingNonPrintingRegex4 = new RegExp("^[\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Nonspacing_Mark}\\p{Enclosing_Mark}\\p{Surrogate}]+", "v");
|
|
@@ -31203,7 +31414,7 @@ function stringWidth5(input, options = {}) {
|
|
|
31203
31414
|
return width;
|
|
31204
31415
|
}
|
|
31205
31416
|
|
|
31206
|
-
//
|
|
31417
|
+
// node_modules/@alcalzone/ansi-tokenize/build/consts.js
|
|
31207
31418
|
var BEL2 = "\x07";
|
|
31208
31419
|
var ESC2 = "\x1B";
|
|
31209
31420
|
var BACKSLASH = "\\";
|
|
@@ -31227,7 +31438,7 @@ var linkEndCode = `${ESC2}${OSC2}8;;${BEL2}`;
|
|
|
31227
31438
|
var linkEndCodeST = `${ESC2}${OSC2}8;;${ESC2}${BACKSLASH}`;
|
|
31228
31439
|
var linkEndCodeC1ST = `${ESC2}${OSC2}8;;${C1_ST}`;
|
|
31229
31440
|
|
|
31230
|
-
//
|
|
31441
|
+
// node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.js
|
|
31231
31442
|
var endCodesSet = /* @__PURE__ */ new Set();
|
|
31232
31443
|
var endCodesMap = /* @__PURE__ */ new Map();
|
|
31233
31444
|
for (const [start, end] of ansi_styles_default.codes) {
|
|
@@ -31267,7 +31478,7 @@ function isIntensityCode(code) {
|
|
|
31267
31478
|
return code.code === ansi_styles_default.bold.open || code.code === ansi_styles_default.dim.open;
|
|
31268
31479
|
}
|
|
31269
31480
|
|
|
31270
|
-
//
|
|
31481
|
+
// node_modules/@alcalzone/ansi-tokenize/build/reduce.js
|
|
31271
31482
|
function reduceAnsiCodes(codes) {
|
|
31272
31483
|
return reduceAnsiCodesIncremental([], codes);
|
|
31273
31484
|
}
|
|
@@ -31292,7 +31503,7 @@ function reduceAnsiCodesIncremental(codes, newCodes) {
|
|
|
31292
31503
|
return ret;
|
|
31293
31504
|
}
|
|
31294
31505
|
|
|
31295
|
-
//
|
|
31506
|
+
// node_modules/@alcalzone/ansi-tokenize/build/undo.js
|
|
31296
31507
|
function undoAnsiCodes2(codes) {
|
|
31297
31508
|
return reduceAnsiCodes(codes).reverse().map((code) => ({
|
|
31298
31509
|
...code,
|
|
@@ -31300,7 +31511,7 @@ function undoAnsiCodes2(codes) {
|
|
|
31300
31511
|
}));
|
|
31301
31512
|
}
|
|
31302
31513
|
|
|
31303
|
-
//
|
|
31514
|
+
// node_modules/@alcalzone/ansi-tokenize/build/diff.js
|
|
31304
31515
|
function diffAnsiCodes(from, to) {
|
|
31305
31516
|
const endCodesInTo = new Set(to.map((code) => code.endCode));
|
|
31306
31517
|
const startCodesInTo = new Set(to.map((code) => code.code));
|
|
@@ -31319,7 +31530,7 @@ function diffAnsiCodes(from, to) {
|
|
|
31319
31530
|
];
|
|
31320
31531
|
}
|
|
31321
31532
|
|
|
31322
|
-
//
|
|
31533
|
+
// node_modules/@alcalzone/ansi-tokenize/build/styledChars.js
|
|
31323
31534
|
function styledCharsFromTokens(tokens) {
|
|
31324
31535
|
let codes = [];
|
|
31325
31536
|
const ret = [];
|
|
@@ -31352,10 +31563,18 @@ function styledCharsToString(chars) {
|
|
|
31352
31563
|
return ret;
|
|
31353
31564
|
}
|
|
31354
31565
|
|
|
31355
|
-
//
|
|
31566
|
+
// node_modules/@alcalzone/ansi-tokenize/node_modules/is-fullwidth-code-point/index.js
|
|
31567
|
+
function isFullwidthCodePoint2(codePoint) {
|
|
31568
|
+
if (!Number.isInteger(codePoint)) {
|
|
31569
|
+
return false;
|
|
31570
|
+
}
|
|
31571
|
+
return isFullWidth(codePoint) || isWide(codePoint);
|
|
31572
|
+
}
|
|
31573
|
+
|
|
31574
|
+
// node_modules/@alcalzone/ansi-tokenize/build/tokenize.js
|
|
31356
31575
|
var segmenter6 = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
31357
31576
|
function isFullwidthGrapheme(grapheme, baseCodePoint) {
|
|
31358
|
-
if (
|
|
31577
|
+
if (isFullwidthCodePoint2(baseCodePoint))
|
|
31359
31578
|
return true;
|
|
31360
31579
|
if (grapheme.includes("\uFE0F"))
|
|
31361
31580
|
return true;
|
|
@@ -31443,7 +31662,7 @@ function splitCompoundSGRSequences(code) {
|
|
|
31443
31662
|
}
|
|
31444
31663
|
function tokenize(str, endChar = Number.POSITIVE_INFINITY) {
|
|
31445
31664
|
const ret = [];
|
|
31446
|
-
let
|
|
31665
|
+
let visible2 = 0;
|
|
31447
31666
|
let codeEndIndex = 0;
|
|
31448
31667
|
for (const { segment, index } of segmenter6.segment(str)) {
|
|
31449
31668
|
if (index < codeEndIndex)
|
|
@@ -31493,15 +31712,15 @@ function tokenize(str, endChar = Number.POSITIVE_INFINITY) {
|
|
|
31493
31712
|
value: segment,
|
|
31494
31713
|
fullWidth
|
|
31495
31714
|
});
|
|
31496
|
-
|
|
31497
|
-
if (
|
|
31715
|
+
visible2 += fullWidth ? 2 : 1;
|
|
31716
|
+
if (visible2 >= endChar) {
|
|
31498
31717
|
break;
|
|
31499
31718
|
}
|
|
31500
31719
|
}
|
|
31501
31720
|
return ret;
|
|
31502
31721
|
}
|
|
31503
31722
|
|
|
31504
|
-
//
|
|
31723
|
+
// node_modules/ink/build/output.js
|
|
31505
31724
|
var OutputCaches = class {
|
|
31506
31725
|
widths = /* @__PURE__ */ new Map();
|
|
31507
31726
|
blockWidths = /* @__PURE__ */ new Map();
|
|
@@ -31689,7 +31908,7 @@ var Output = class {
|
|
|
31689
31908
|
}
|
|
31690
31909
|
};
|
|
31691
31910
|
|
|
31692
|
-
//
|
|
31911
|
+
// node_modules/ink/build/renderer.js
|
|
31693
31912
|
var renderer = (node, isScreenReaderEnabled) => {
|
|
31694
31913
|
if (node.yogaNode) {
|
|
31695
31914
|
if (isScreenReaderEnabled) {
|
|
@@ -31745,7 +31964,7 @@ var renderer = (node, isScreenReaderEnabled) => {
|
|
|
31745
31964
|
};
|
|
31746
31965
|
var renderer_default = renderer;
|
|
31747
31966
|
|
|
31748
|
-
//
|
|
31967
|
+
// node_modules/ink/build/cursor-helpers.js
|
|
31749
31968
|
var showCursorEscape = "\x1B[?25h";
|
|
31750
31969
|
var hideCursorEscape = "\x1B[?25l";
|
|
31751
31970
|
var cursorPositionChanged = (a, b) => a?.x !== b?.x || a?.y !== b?.y;
|
|
@@ -31776,12 +31995,12 @@ var buildReturnToBottomPrefix = (cursorWasShown, previousLineCount, previousCurs
|
|
|
31776
31995
|
return hideCursorEscape + buildReturnToBottom(previousLineCount, previousCursorPosition);
|
|
31777
31996
|
};
|
|
31778
31997
|
|
|
31779
|
-
//
|
|
31998
|
+
// node_modules/cli-cursor/index.js
|
|
31780
31999
|
import process7 from "process";
|
|
31781
32000
|
|
|
31782
|
-
//
|
|
32001
|
+
// node_modules/restore-cursor/index.js
|
|
31783
32002
|
var import_onetime = __toESM(require_onetime(), 1);
|
|
31784
|
-
var import_signal_exit = __toESM(
|
|
32003
|
+
var import_signal_exit = __toESM(require_signal_exit2(), 1);
|
|
31785
32004
|
import process6 from "process";
|
|
31786
32005
|
var restoreCursor = (0, import_onetime.default)(() => {
|
|
31787
32006
|
(0, import_signal_exit.default)(() => {
|
|
@@ -31790,7 +32009,7 @@ var restoreCursor = (0, import_onetime.default)(() => {
|
|
|
31790
32009
|
});
|
|
31791
32010
|
var restore_cursor_default = restoreCursor;
|
|
31792
32011
|
|
|
31793
|
-
//
|
|
32012
|
+
// node_modules/cli-cursor/index.js
|
|
31794
32013
|
var isHidden = false;
|
|
31795
32014
|
var cliCursor = {};
|
|
31796
32015
|
cliCursor.show = (writableStream = process7.stderr) => {
|
|
@@ -31820,7 +32039,7 @@ cliCursor.toggle = (force, writableStream) => {
|
|
|
31820
32039
|
};
|
|
31821
32040
|
var cli_cursor_default = cliCursor;
|
|
31822
32041
|
|
|
31823
|
-
//
|
|
32042
|
+
// node_modules/ink/build/log-update.js
|
|
31824
32043
|
var visibleLineCount = (lines, str) => str.endsWith("\n") ? lines.length - 1 : lines.length;
|
|
31825
32044
|
var createStandard = (stream, { showCursor = false } = {}) => {
|
|
31826
32045
|
let previousLineCount = 0;
|
|
@@ -32050,23 +32269,23 @@ var create2 = (stream, { showCursor = false, incremental = false } = {}) => {
|
|
|
32050
32269
|
var logUpdate = { create: create2 };
|
|
32051
32270
|
var log_update_default = logUpdate;
|
|
32052
32271
|
|
|
32053
|
-
//
|
|
32272
|
+
// node_modules/ink/build/write-synchronized.js
|
|
32054
32273
|
var bsu = "\x1B[?2026h";
|
|
32055
32274
|
var esu = "\x1B[?2026l";
|
|
32056
32275
|
function shouldSynchronize(stream, interactive) {
|
|
32057
32276
|
return "isTTY" in stream && stream.isTTY && (interactive ?? !is_in_ci_default);
|
|
32058
32277
|
}
|
|
32059
32278
|
|
|
32060
|
-
//
|
|
32279
|
+
// node_modules/ink/build/instances.js
|
|
32061
32280
|
var instances = /* @__PURE__ */ new WeakMap();
|
|
32062
32281
|
var instances_default = instances;
|
|
32063
32282
|
|
|
32064
|
-
//
|
|
32283
|
+
// node_modules/ink/build/components/App.js
|
|
32065
32284
|
var import_react15 = __toESM(require_react(), 1);
|
|
32066
32285
|
import { EventEmitter as EventEmitter2 } from "events";
|
|
32067
32286
|
import process11 from "process";
|
|
32068
32287
|
|
|
32069
|
-
//
|
|
32288
|
+
// node_modules/ink/build/input-parser.js
|
|
32070
32289
|
var escape = "\x1B";
|
|
32071
32290
|
var pasteStart = "\x1B[200~";
|
|
32072
32291
|
var pasteEnd = "\x1B[201~";
|
|
@@ -32251,7 +32470,7 @@ var createInputParser = () => {
|
|
|
32251
32470
|
};
|
|
32252
32471
|
};
|
|
32253
32472
|
|
|
32254
|
-
//
|
|
32473
|
+
// node_modules/ink/build/components/AppContext.js
|
|
32255
32474
|
var import_react2 = __toESM(require_react(), 1);
|
|
32256
32475
|
var noopSuspension = {
|
|
32257
32476
|
async resume() {
|
|
@@ -32276,7 +32495,7 @@ var AppContext = (0, import_react2.createContext)(defaultValue);
|
|
|
32276
32495
|
AppContext.displayName = "InternalAppContext";
|
|
32277
32496
|
var AppContext_default = AppContext;
|
|
32278
32497
|
|
|
32279
|
-
//
|
|
32498
|
+
// node_modules/ink/build/components/StdinContext.js
|
|
32280
32499
|
var import_react3 = __toESM(require_react(), 1);
|
|
32281
32500
|
import { EventEmitter } from "events";
|
|
32282
32501
|
import process8 from "process";
|
|
@@ -32295,7 +32514,7 @@ var StdinContext = (0, import_react3.createContext)({
|
|
|
32295
32514
|
StdinContext.displayName = "InternalStdinContext";
|
|
32296
32515
|
var StdinContext_default = StdinContext;
|
|
32297
32516
|
|
|
32298
|
-
//
|
|
32517
|
+
// node_modules/ink/build/components/StdoutContext.js
|
|
32299
32518
|
var import_react4 = __toESM(require_react(), 1);
|
|
32300
32519
|
import process9 from "process";
|
|
32301
32520
|
var StdoutContext = (0, import_react4.createContext)({
|
|
@@ -32306,7 +32525,7 @@ var StdoutContext = (0, import_react4.createContext)({
|
|
|
32306
32525
|
StdoutContext.displayName = "InternalStdoutContext";
|
|
32307
32526
|
var StdoutContext_default = StdoutContext;
|
|
32308
32527
|
|
|
32309
|
-
//
|
|
32528
|
+
// node_modules/ink/build/components/StderrContext.js
|
|
32310
32529
|
var import_react5 = __toESM(require_react(), 1);
|
|
32311
32530
|
import process10 from "process";
|
|
32312
32531
|
var StderrContext = (0, import_react5.createContext)({
|
|
@@ -32317,7 +32536,7 @@ var StderrContext = (0, import_react5.createContext)({
|
|
|
32317
32536
|
StderrContext.displayName = "InternalStderrContext";
|
|
32318
32537
|
var StderrContext_default = StderrContext;
|
|
32319
32538
|
|
|
32320
|
-
//
|
|
32539
|
+
// node_modules/ink/build/components/FocusContext.js
|
|
32321
32540
|
var import_react6 = __toESM(require_react(), 1);
|
|
32322
32541
|
var FocusContext = (0, import_react6.createContext)({
|
|
32323
32542
|
activeId: void 0,
|
|
@@ -32343,7 +32562,7 @@ var FocusContext = (0, import_react6.createContext)({
|
|
|
32343
32562
|
FocusContext.displayName = "InternalFocusContext";
|
|
32344
32563
|
var FocusContext_default = FocusContext;
|
|
32345
32564
|
|
|
32346
|
-
//
|
|
32565
|
+
// node_modules/ink/build/components/AnimationContext.js
|
|
32347
32566
|
var import_react7 = __toESM(require_react(), 1);
|
|
32348
32567
|
var animationContext = (0, import_react7.createContext)({
|
|
32349
32568
|
renderThrottleMs: 0,
|
|
@@ -32358,7 +32577,7 @@ var animationContext = (0, import_react7.createContext)({
|
|
|
32358
32577
|
animationContext.displayName = "InternalAnimationContext";
|
|
32359
32578
|
var AnimationContext_default = animationContext;
|
|
32360
32579
|
|
|
32361
|
-
//
|
|
32580
|
+
// node_modules/ink/build/components/CursorContext.js
|
|
32362
32581
|
var import_react8 = __toESM(require_react(), 1);
|
|
32363
32582
|
var CursorContext = (0, import_react8.createContext)({
|
|
32364
32583
|
setCursorPosition() {
|
|
@@ -32367,22 +32586,22 @@ var CursorContext = (0, import_react8.createContext)({
|
|
|
32367
32586
|
CursorContext.displayName = "InternalCursorContext";
|
|
32368
32587
|
var CursorContext_default = CursorContext;
|
|
32369
32588
|
|
|
32370
|
-
//
|
|
32589
|
+
// node_modules/ink/build/components/ErrorBoundary.js
|
|
32371
32590
|
var import_react14 = __toESM(require_react(), 1);
|
|
32372
32591
|
|
|
32373
|
-
//
|
|
32592
|
+
// node_modules/ink/build/components/ErrorOverview.js
|
|
32374
32593
|
var import_react13 = __toESM(require_react(), 1);
|
|
32375
32594
|
var import_stack_utils = __toESM(require_stack_utils(), 1);
|
|
32376
32595
|
import * as fs2 from "fs";
|
|
32377
32596
|
import { cwd } from "process";
|
|
32378
32597
|
|
|
32379
|
-
//
|
|
32598
|
+
// node_modules/convert-to-spaces/dist/index.js
|
|
32380
32599
|
var convertToSpaces = (input, spaces = 2) => {
|
|
32381
32600
|
return input.replace(/^\t+/gm, ($1) => " ".repeat($1.length * spaces));
|
|
32382
32601
|
};
|
|
32383
32602
|
var dist_default2 = convertToSpaces;
|
|
32384
32603
|
|
|
32385
|
-
//
|
|
32604
|
+
// node_modules/code-excerpt/dist/index.js
|
|
32386
32605
|
var generateLineNumbers = (line, around) => {
|
|
32387
32606
|
const lineNumbers = [];
|
|
32388
32607
|
const min = line - around;
|
|
@@ -32408,20 +32627,20 @@ var codeExcerpt = (source, line, options = {}) => {
|
|
|
32408
32627
|
};
|
|
32409
32628
|
var dist_default3 = codeExcerpt;
|
|
32410
32629
|
|
|
32411
|
-
//
|
|
32630
|
+
// node_modules/ink/build/components/Box.js
|
|
32412
32631
|
var import_react11 = __toESM(require_react(), 1);
|
|
32413
32632
|
|
|
32414
|
-
//
|
|
32633
|
+
// node_modules/ink/build/components/AccessibilityContext.js
|
|
32415
32634
|
var import_react9 = __toESM(require_react(), 1);
|
|
32416
32635
|
var accessibilityContext = (0, import_react9.createContext)({
|
|
32417
32636
|
isScreenReaderEnabled: false
|
|
32418
32637
|
});
|
|
32419
32638
|
|
|
32420
|
-
//
|
|
32639
|
+
// node_modules/ink/build/components/BackgroundContext.js
|
|
32421
32640
|
var import_react10 = __toESM(require_react(), 1);
|
|
32422
32641
|
var backgroundContext = (0, import_react10.createContext)(void 0);
|
|
32423
32642
|
|
|
32424
|
-
//
|
|
32643
|
+
// node_modules/ink/build/components/Box.js
|
|
32425
32644
|
var Box = (0, import_react11.forwardRef)(({ children, backgroundColor, "aria-label": ariaLabel, "aria-hidden": ariaHidden, "aria-role": role, "aria-state": ariaState, ...style }, ref) => {
|
|
32426
32645
|
const { isScreenReaderEnabled } = (0, import_react11.useContext)(accessibilityContext);
|
|
32427
32646
|
const label = ariaLabel ? import_react11.default.createElement("ink-text", null, ariaLabel) : void 0;
|
|
@@ -32449,7 +32668,7 @@ var Box = (0, import_react11.forwardRef)(({ children, backgroundColor, "aria-lab
|
|
|
32449
32668
|
Box.displayName = "Box";
|
|
32450
32669
|
var Box_default = Box;
|
|
32451
32670
|
|
|
32452
|
-
//
|
|
32671
|
+
// node_modules/ink/build/components/Text.js
|
|
32453
32672
|
var import_react12 = __toESM(require_react(), 1);
|
|
32454
32673
|
function Text({ color, backgroundColor, dimColor = false, bold = false, italic = false, underline = false, strikethrough = false, inverse = false, wrap = "wrap", children, "aria-label": ariaLabel, "aria-hidden": ariaHidden = false }) {
|
|
32455
32674
|
const { isScreenReaderEnabled } = (0, import_react12.useContext)(accessibilityContext);
|
|
@@ -32492,7 +32711,7 @@ function Text({ color, backgroundColor, dimColor = false, bold = false, italic =
|
|
|
32492
32711
|
return import_react12.default.createElement("ink-text", { style: { flexGrow: 0, flexShrink: 1, flexDirection: "row", textWrap: wrap }, internal_transform: transform }, childrenOrAriaLabel);
|
|
32493
32712
|
}
|
|
32494
32713
|
|
|
32495
|
-
//
|
|
32714
|
+
// node_modules/ink/build/components/ErrorOverview.js
|
|
32496
32715
|
var cleanupPath = (path) => {
|
|
32497
32716
|
return path?.replace(`file://${cwd()}/`, "");
|
|
32498
32717
|
};
|
|
@@ -32605,7 +32824,7 @@ function ErrorOverview({ error }) {
|
|
|
32605
32824
|
);
|
|
32606
32825
|
}
|
|
32607
32826
|
|
|
32608
|
-
//
|
|
32827
|
+
// node_modules/ink/build/components/ErrorBoundary.js
|
|
32609
32828
|
var ErrorBoundary = class extends import_react14.PureComponent {
|
|
32610
32829
|
static displayName = "InternalErrorBoundary";
|
|
32611
32830
|
static getDerivedStateFromError(error) {
|
|
@@ -32625,7 +32844,7 @@ var ErrorBoundary = class extends import_react14.PureComponent {
|
|
|
32625
32844
|
}
|
|
32626
32845
|
};
|
|
32627
32846
|
|
|
32628
|
-
//
|
|
32847
|
+
// node_modules/ink/build/components/App.js
|
|
32629
32848
|
var tab = " ";
|
|
32630
32849
|
var shiftTab = "\x1B[Z";
|
|
32631
32850
|
var escape2 = "\x1B";
|
|
@@ -33137,7 +33356,7 @@ function App({ children, stdin, stdout, stderr, writeToStdout, writeToStderr, ex
|
|
|
33137
33356
|
App.displayName = "InternalApp";
|
|
33138
33357
|
var App_default = App;
|
|
33139
33358
|
|
|
33140
|
-
//
|
|
33359
|
+
// node_modules/ink/build/kitty-keyboard.js
|
|
33141
33360
|
var kittyFlags = {
|
|
33142
33361
|
disambiguateEscapeCodes: 1,
|
|
33143
33362
|
reportEventTypes: 2,
|
|
@@ -33163,12 +33382,12 @@ var kittyModifiers = {
|
|
|
33163
33382
|
numLock: 128
|
|
33164
33383
|
};
|
|
33165
33384
|
|
|
33166
|
-
//
|
|
33385
|
+
// node_modules/ink/build/ink.js
|
|
33167
33386
|
var noop = () => {
|
|
33168
33387
|
};
|
|
33169
33388
|
var textEncoder = new TextEncoder();
|
|
33170
|
-
var yieldImmediate = async () => new Promise((
|
|
33171
|
-
setImmediate(
|
|
33389
|
+
var yieldImmediate = async () => new Promise((resolve2) => {
|
|
33390
|
+
setImmediate(resolve2);
|
|
33172
33391
|
});
|
|
33173
33392
|
var kittyQueryEscapeByte = 27;
|
|
33174
33393
|
var kittyQueryOpenBracketByte = 91;
|
|
@@ -33385,8 +33604,8 @@ var Ink = class {
|
|
|
33385
33604
|
};
|
|
33386
33605
|
}
|
|
33387
33606
|
this.initKittyKeyboard();
|
|
33388
|
-
this.exitPromise = new Promise((
|
|
33389
|
-
this.resolveExitPromise =
|
|
33607
|
+
this.exitPromise = new Promise((resolve2, reject) => {
|
|
33608
|
+
this.resolveExitPromise = resolve2;
|
|
33390
33609
|
this.rejectExitPromise = reject;
|
|
33391
33610
|
});
|
|
33392
33611
|
void this.exitPromise.catch(noop);
|
|
@@ -33697,9 +33916,9 @@ var Ink = class {
|
|
|
33697
33916
|
settleThrottle(this.throttledOnRender, canWriteToStdout);
|
|
33698
33917
|
settleThrottle(this.throttledLog, canWriteToStdout);
|
|
33699
33918
|
if (canWriteToStdout && hasWritableState) {
|
|
33700
|
-
await new Promise((
|
|
33919
|
+
await new Promise((resolve2) => {
|
|
33701
33920
|
this.options.stdout.write("", () => {
|
|
33702
|
-
|
|
33921
|
+
resolve2();
|
|
33703
33922
|
});
|
|
33704
33923
|
});
|
|
33705
33924
|
return;
|
|
@@ -33785,8 +34004,8 @@ var Ink = class {
|
|
|
33785
34004
|
async awaitNextRender() {
|
|
33786
34005
|
if (!this.nextRenderCommit) {
|
|
33787
34006
|
let resolveRender;
|
|
33788
|
-
const promise = new Promise((
|
|
33789
|
-
resolveRender =
|
|
34007
|
+
const promise = new Promise((resolve2) => {
|
|
34008
|
+
resolveRender = resolve2;
|
|
33790
34009
|
});
|
|
33791
34010
|
this.nextRenderCommit = { promise, resolve: resolveRender };
|
|
33792
34011
|
}
|
|
@@ -33959,7 +34178,7 @@ var Ink = class {
|
|
|
33959
34178
|
}
|
|
33960
34179
|
};
|
|
33961
34180
|
|
|
33962
|
-
//
|
|
34181
|
+
// node_modules/ink/build/render.js
|
|
33963
34182
|
var render = (node, options) => {
|
|
33964
34183
|
const inkOptions = {
|
|
33965
34184
|
stdout: process13.stdout,
|
|
@@ -34010,25 +34229,25 @@ var getInstance = (stdout, createInstance2) => {
|
|
|
34010
34229
|
return instance;
|
|
34011
34230
|
};
|
|
34012
34231
|
|
|
34013
|
-
//
|
|
34232
|
+
// node_modules/ink/build/render-to-string.js
|
|
34014
34233
|
var import_constants3 = __toESM(require_constants(), 1);
|
|
34015
34234
|
|
|
34016
|
-
//
|
|
34235
|
+
// node_modules/ink/build/components/Static.js
|
|
34017
34236
|
var import_react17 = __toESM(require_react(), 1);
|
|
34018
34237
|
|
|
34019
|
-
//
|
|
34238
|
+
// node_modules/ink/build/components/Transform.js
|
|
34020
34239
|
var import_react18 = __toESM(require_react(), 1);
|
|
34021
34240
|
|
|
34022
|
-
//
|
|
34241
|
+
// node_modules/ink/build/components/Newline.js
|
|
34023
34242
|
var import_react19 = __toESM(require_react(), 1);
|
|
34024
34243
|
|
|
34025
|
-
//
|
|
34244
|
+
// node_modules/ink/build/components/Spacer.js
|
|
34026
34245
|
var import_react20 = __toESM(require_react(), 1);
|
|
34027
34246
|
|
|
34028
|
-
//
|
|
34247
|
+
// node_modules/ink/build/hooks/use-input.js
|
|
34029
34248
|
var import_react22 = __toESM(require_react(), 1);
|
|
34030
34249
|
|
|
34031
|
-
//
|
|
34250
|
+
// node_modules/ink/build/parse-keypress.js
|
|
34032
34251
|
var textDecoder = new TextDecoder();
|
|
34033
34252
|
var metaKeyCodeRe = /^(?:\x1b)([a-zA-Z0-9])$/;
|
|
34034
34253
|
var fnKeyRe = /^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/;
|
|
@@ -34460,11 +34679,11 @@ var parseKeypress = (s = "") => {
|
|
|
34460
34679
|
};
|
|
34461
34680
|
var parse_keypress_default = parseKeypress;
|
|
34462
34681
|
|
|
34463
|
-
//
|
|
34682
|
+
// node_modules/ink/build/hooks/use-stdin.js
|
|
34464
34683
|
var import_react21 = __toESM(require_react(), 1);
|
|
34465
34684
|
var useStdinContext = () => (0, import_react21.useContext)(StdinContext_default);
|
|
34466
34685
|
|
|
34467
|
-
//
|
|
34686
|
+
// node_modules/ink/build/hooks/use-input.js
|
|
34468
34687
|
var useInput = (inputHandler, options = {}) => {
|
|
34469
34688
|
const { setRawMode, internal_exitOnCtrlC, internal_eventEmitter } = useStdinContext();
|
|
34470
34689
|
(0, import_react22.useEffect)(() => {
|
|
@@ -34544,74 +34763,48 @@ var useInput = (inputHandler, options = {}) => {
|
|
|
34544
34763
|
};
|
|
34545
34764
|
var use_input_default = useInput;
|
|
34546
34765
|
|
|
34547
|
-
//
|
|
34766
|
+
// node_modules/ink/build/hooks/use-paste.js
|
|
34548
34767
|
var import_react23 = __toESM(require_react(), 1);
|
|
34549
34768
|
|
|
34550
|
-
//
|
|
34769
|
+
// node_modules/ink/build/hooks/use-app.js
|
|
34551
34770
|
var import_react24 = __toESM(require_react(), 1);
|
|
34552
34771
|
var useApp = () => (0, import_react24.useContext)(AppContext_default);
|
|
34553
34772
|
var use_app_default = useApp;
|
|
34554
34773
|
|
|
34555
|
-
//
|
|
34774
|
+
// node_modules/ink/build/hooks/use-stdout.js
|
|
34556
34775
|
var import_react25 = __toESM(require_react(), 1);
|
|
34557
34776
|
var useStdout = () => (0, import_react25.useContext)(StdoutContext_default);
|
|
34558
34777
|
var use_stdout_default = useStdout;
|
|
34559
34778
|
|
|
34560
|
-
//
|
|
34779
|
+
// node_modules/ink/build/hooks/use-stderr.js
|
|
34561
34780
|
var import_react26 = __toESM(require_react(), 1);
|
|
34562
34781
|
|
|
34563
|
-
//
|
|
34782
|
+
// node_modules/ink/build/hooks/use-focus.js
|
|
34564
34783
|
var import_react27 = __toESM(require_react(), 1);
|
|
34565
34784
|
|
|
34566
|
-
//
|
|
34785
|
+
// node_modules/ink/build/hooks/use-focus-manager.js
|
|
34567
34786
|
var import_react28 = __toESM(require_react(), 1);
|
|
34568
34787
|
|
|
34569
|
-
//
|
|
34788
|
+
// node_modules/ink/build/hooks/use-is-screen-reader-enabled.js
|
|
34570
34789
|
var import_react29 = __toESM(require_react(), 1);
|
|
34571
34790
|
|
|
34572
|
-
//
|
|
34791
|
+
// node_modules/ink/build/hooks/use-cursor.js
|
|
34573
34792
|
var import_react30 = __toESM(require_react(), 1);
|
|
34574
34793
|
|
|
34575
|
-
//
|
|
34794
|
+
// node_modules/ink/build/hooks/use-animation.js
|
|
34576
34795
|
var import_react31 = __toESM(require_react(), 1);
|
|
34577
34796
|
|
|
34578
|
-
//
|
|
34797
|
+
// node_modules/ink/build/hooks/use-window-size.js
|
|
34579
34798
|
var import_react32 = __toESM(require_react(), 1);
|
|
34580
34799
|
|
|
34581
|
-
//
|
|
34800
|
+
// node_modules/ink/build/hooks/use-box-metrics.js
|
|
34582
34801
|
var import_react33 = __toESM(require_react(), 1);
|
|
34583
34802
|
|
|
34584
34803
|
// src/tui/app.tsx
|
|
34585
|
-
var
|
|
34586
|
-
|
|
34587
|
-
// src/tui/account.ts
|
|
34588
|
-
import { Buffer as Buffer2 } from "buffer";
|
|
34589
|
-
function identityFromToken(token) {
|
|
34590
|
-
const empty = { uid: null, uuid: null, tenant: null };
|
|
34591
|
-
const parts = token.split(".");
|
|
34592
|
-
if (parts.length < 2) return empty;
|
|
34593
|
-
try {
|
|
34594
|
-
const segment = parts[1];
|
|
34595
|
-
const padded = segment + "=".repeat((4 - segment.length % 4) % 4);
|
|
34596
|
-
const payload = JSON.parse(Buffer2.from(padded, "base64url").toString("utf8"));
|
|
34597
|
-
return {
|
|
34598
|
-
uid: typeof payload.uid === "number" ? payload.uid : null,
|
|
34599
|
-
uuid: typeof payload.uuid === "string" ? payload.uuid : null,
|
|
34600
|
-
tenant: typeof payload.tenant === "string" ? payload.tenant : null
|
|
34601
|
-
};
|
|
34602
|
-
} catch {
|
|
34603
|
-
return empty;
|
|
34604
|
-
}
|
|
34605
|
-
}
|
|
34606
|
-
function tokenOverrideNote(source) {
|
|
34607
|
-
if (source === "env")
|
|
34608
|
-
return "\u6CE8\u610F\uFF1A\u73AF\u5883\u53D8\u91CF AUTODL_TOKEN \u4ECD\u7136\u751F\u6548\uFF0C\u5176\u4F18\u5148\u7EA7\u9AD8\u4E8E\u8FD9\u91CC\u4FDD\u5B58\u7684 Token\u3002";
|
|
34609
|
-
if (source === "flag") return "\u6CE8\u610F\uFF1A\u672C\u6B21\u542F\u52A8\u5E26\u4E86 --token \u53C2\u6570\uFF0C\u5176\u4F18\u5148\u7EA7\u9AD8\u4E8E\u8FD9\u91CC\u4FDD\u5B58\u7684 Token\u3002";
|
|
34610
|
-
return null;
|
|
34611
|
-
}
|
|
34804
|
+
var import_react40 = __toESM(require_react(), 1);
|
|
34612
34805
|
|
|
34613
34806
|
// src/tui/clipboard.ts
|
|
34614
|
-
import { Buffer as
|
|
34807
|
+
import { Buffer as Buffer2 } from "buffer";
|
|
34615
34808
|
import { spawn } from "child_process";
|
|
34616
34809
|
import { platform as platform2 } from "os";
|
|
34617
34810
|
function candidates() {
|
|
@@ -34630,22 +34823,22 @@ function candidates() {
|
|
|
34630
34823
|
}
|
|
34631
34824
|
}
|
|
34632
34825
|
function runCopy(command, args, text) {
|
|
34633
|
-
return new Promise((
|
|
34826
|
+
return new Promise((resolve2) => {
|
|
34634
34827
|
let child;
|
|
34635
34828
|
try {
|
|
34636
34829
|
child = spawn(command, args, { stdio: ["pipe", "ignore", "ignore"] });
|
|
34637
34830
|
} catch {
|
|
34638
|
-
|
|
34831
|
+
resolve2(false);
|
|
34639
34832
|
return;
|
|
34640
34833
|
}
|
|
34641
|
-
child.on("error", () =>
|
|
34642
|
-
child.on("close", (code) =>
|
|
34643
|
-
child.stdin?.on("error", () =>
|
|
34834
|
+
child.on("error", () => resolve2(false));
|
|
34835
|
+
child.on("close", (code) => resolve2(code === 0));
|
|
34836
|
+
child.stdin?.on("error", () => resolve2(false));
|
|
34644
34837
|
child.stdin?.end(text);
|
|
34645
34838
|
});
|
|
34646
34839
|
}
|
|
34647
34840
|
function writeOsc52(text) {
|
|
34648
|
-
const payload =
|
|
34841
|
+
const payload = Buffer2.from(text, "utf8").toString("base64");
|
|
34649
34842
|
const ESC3 = String.fromCharCode(27);
|
|
34650
34843
|
const BEL3 = String.fromCharCode(7);
|
|
34651
34844
|
process.stdout.write(`${ESC3}]52;c;${payload}${BEL3}`);
|
|
@@ -34942,9 +35135,8 @@ function useInstances(client, { intervalMs = 1e4, paused = false, watch } = {})
|
|
|
34942
35135
|
void load();
|
|
34943
35136
|
}, [load]);
|
|
34944
35137
|
(0, import_react35.useEffect)(() => {
|
|
34945
|
-
if (authError) return;
|
|
35138
|
+
if (authError || paused) return;
|
|
34946
35139
|
void load();
|
|
34947
|
-
if (paused) return;
|
|
34948
35140
|
const timer = setInterval(() => void load(), intervalMs);
|
|
34949
35141
|
return () => clearInterval(timer);
|
|
34950
35142
|
}, [load, intervalMs, paused, authError]);
|
|
@@ -35224,12 +35416,12 @@ function Table({
|
|
|
35224
35416
|
if (rows.length === 0) {
|
|
35225
35417
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { dimColor: true, children: emptyMessage }) });
|
|
35226
35418
|
}
|
|
35227
|
-
const
|
|
35419
|
+
const visible2 = maxRows && maxRows > 0 ? Math.min(maxRows, rows.length) : rows.length;
|
|
35228
35420
|
const start = Math.max(
|
|
35229
35421
|
0,
|
|
35230
|
-
Math.min(selectedIndex - Math.floor((
|
|
35422
|
+
Math.min(selectedIndex - Math.floor((visible2 - 1) / 2), rows.length - visible2)
|
|
35231
35423
|
);
|
|
35232
|
-
const window2 = rows.slice(start, start +
|
|
35424
|
+
const window2 = rows.slice(start, start + visible2);
|
|
35233
35425
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
35234
35426
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { paddingX: 1, children: [
|
|
35235
35427
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: CURSOR.blank }),
|
|
@@ -35336,11 +35528,16 @@ var METRIC_ROWS = 6;
|
|
|
35336
35528
|
var PANEL_PADDING = 4;
|
|
35337
35529
|
var SPARK_GAP = 2;
|
|
35338
35530
|
var NOTE_WIDTH = 24;
|
|
35339
|
-
var MIN_HEIGHT_FOR_METRICS = 22;
|
|
35340
35531
|
var MIN_WIDTH_FOR_COLUMNS = 88;
|
|
35532
|
+
var ESTIMATE_NOTE_TEXT = "\u8D39\u7528\u4E3A\u4F30\u7B97\u503C\uFF1AAutoDL \u6309\u79D2\u8BA1\u8D39\u4E14\u6709 \xA50.01 \u4E0B\u9650\uFF0C\u5355\u4EF7\u9700\u9009\u4E2D\u8FD0\u884C\u4E2D\u7684\u5B9E\u4F8B\u540E\u624D\u4F1A\u62C9\u53D6\u3002";
|
|
35341
35533
|
var percentOf = (used, total) => used === null || total === null || total <= 0 ? null : used / total * 100;
|
|
35342
35534
|
var sizeOf = (used, total) => used === null || total === null || total <= 0 ? void 0 : `${formatBytes(used)} / ${formatBytes(total)}`;
|
|
35343
|
-
function runwayText(balance, ratePerHour) {
|
|
35535
|
+
function runwayText(balance, ratePerHour, partial) {
|
|
35536
|
+
if (partial) {
|
|
35537
|
+
if (balance && balance.balanceYuan <= 0) return "\u4F59\u989D\u5DF2\u8017\u5C3D";
|
|
35538
|
+
if (ratePerHour <= 0) return "\u5355\u4EF7\u83B7\u53D6\u4E2D\u2026";
|
|
35539
|
+
return "\u90E8\u5206\u5B9E\u4F8B\u5355\u4EF7\u672A\u53D6\u5230\uFF0C\u7EED\u822A\u5F85\u5B9A";
|
|
35540
|
+
}
|
|
35344
35541
|
if (ratePerHour <= 0) return "\u5F53\u524D\u4E0D\u4EA7\u751F\u8D39\u7528";
|
|
35345
35542
|
if (!balance) return "\u4F59\u989D\u52A0\u8F7D\u4E2D\u2026";
|
|
35346
35543
|
if (balance.balanceYuan <= 0) return "\u4F59\u989D\u5DF2\u8017\u5C3D";
|
|
@@ -35406,6 +35603,7 @@ function Billing({
|
|
|
35406
35603
|
}) {
|
|
35407
35604
|
const running = rows.filter((entry) => entry.instance.status === "running");
|
|
35408
35605
|
const fleetRate = running.reduce((sum, entry) => sum + (entry.priceYuanPerHour ?? 0), 0);
|
|
35606
|
+
const partial = running.some((entry) => entry.priceYuanPerHour === null);
|
|
35409
35607
|
const own = !row ? "\u2014" : row.instance.status !== "running" ? "\u672A\u8FD0\u884C\uFF0C\u4E0D\u8BA1\u8D39" : row.priceYuanPerHour === null ? "\u5355\u4EF7\u83B7\u53D6\u4E2D\u2026" : `${formatRate(row.priceYuanPerHour)}\u3000\u672C\u6B21\u5DF2\u4EA7\u751F ${formatYuan(row.estimatedCostYuan ?? 0)}`;
|
|
35410
35608
|
const ttl = !row ? "\u2014" : row.ttlRemainingMs === null ? "\u672A\u8BBE\u7F6E\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u5173\u673A" : row.ttlRemainingMs <= 0 ? "\u5DF2\u8D85\u65F6\uFF0C\u4ECD\u5728\u8BA1\u8D39" : `${formatDuration(Math.round(row.ttlRemainingMs / 1e3))} \u540E\u81EA\u52A8\u5173\u673A`;
|
|
35411
35609
|
const ttlColor = row && (row.ttlRemainingMs === null || row.ttlRemainingMs <= 0) ? row.instance.status === "running" ? "red" : "yellow" : void 0;
|
|
@@ -35424,7 +35622,7 @@ function Billing({
|
|
|
35424
35622
|
] }),
|
|
35425
35623
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { children: [
|
|
35426
35624
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { dimColor: true, children: "\u7EED\u822A " }),
|
|
35427
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: runwayText(balance, fleetRate) })
|
|
35625
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: runwayText(balance, fleetRate, partial) })
|
|
35428
35626
|
] })
|
|
35429
35627
|
] });
|
|
35430
35628
|
}
|
|
@@ -35439,15 +35637,19 @@ function Dashboard({
|
|
|
35439
35637
|
height = 30
|
|
35440
35638
|
}) {
|
|
35441
35639
|
const row = rows[selectedIndex];
|
|
35442
|
-
const showMetrics = height >= MIN_HEIGHT_FOR_METRICS;
|
|
35443
35640
|
const sideBySide = width >= MIN_WIDTH_FOR_COLUMNS;
|
|
35444
|
-
const metricRows =
|
|
35641
|
+
const metricRows = sideBySide ? METRIC_ROWS : METRIC_ROWS * 2;
|
|
35445
35642
|
const estimateNote = rows.some(
|
|
35446
35643
|
(entry) => entry.instance.status === "running" && entry.estimatedCostYuan === null
|
|
35447
35644
|
);
|
|
35645
|
+
const estimateNoteLines = estimateNote ? Math.max(
|
|
35646
|
+
1,
|
|
35647
|
+
Math.ceil(stringWidth(ESTIMATE_NOTE_TEXT) / Math.max(1, width - PANEL_PADDING - 2))
|
|
35648
|
+
) : 0;
|
|
35649
|
+
const showMetrics = headerRows(width) + STATUS_ROWS + PANEL_CHROME + 1 + estimateNoteLines + metricRows <= height;
|
|
35448
35650
|
const rowBudget = Math.max(
|
|
35449
35651
|
1,
|
|
35450
|
-
height - headerRows(width) - STATUS_ROWS -
|
|
35652
|
+
height - headerRows(width) - STATUS_ROWS - (showMetrics ? metricRows : 0) - PANEL_CHROME - estimateNoteLines
|
|
35451
35653
|
);
|
|
35452
35654
|
const rules = rows.length > 1 && rows.length * 2 - 1 <= rowBudget;
|
|
35453
35655
|
const maxRows = rules ? rows.length : rowBudget;
|
|
@@ -35477,33 +35679,42 @@ function Dashboard({
|
|
|
35477
35679
|
rules
|
|
35478
35680
|
}
|
|
35479
35681
|
),
|
|
35480
|
-
estimateNote ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { dimColor: true, children:
|
|
35682
|
+
estimateNote ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { dimColor: true, children: ESTIMATE_NOTE_TEXT }) }) : null
|
|
35481
35683
|
]
|
|
35482
35684
|
}
|
|
35483
35685
|
),
|
|
35484
|
-
showMetrics ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
35485
|
-
|
|
35486
|
-
|
|
35487
|
-
|
|
35488
|
-
|
|
35489
|
-
|
|
35490
|
-
|
|
35491
|
-
|
|
35492
|
-
|
|
35493
|
-
|
|
35494
|
-
Resources,
|
|
35686
|
+
showMetrics ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
35687
|
+
Box_default,
|
|
35688
|
+
{
|
|
35689
|
+
flexDirection: sideBySide ? "row" : "column",
|
|
35690
|
+
gap: sideBySide ? 1 : 0,
|
|
35691
|
+
height: metricRows,
|
|
35692
|
+
flexShrink: 0,
|
|
35693
|
+
children: [
|
|
35694
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
35695
|
+
Panel,
|
|
35495
35696
|
{
|
|
35496
|
-
|
|
35497
|
-
|
|
35498
|
-
|
|
35499
|
-
|
|
35500
|
-
|
|
35697
|
+
title: "\u8D44\u6E90",
|
|
35698
|
+
note: row ? clip(row.instance.name || row.instance.uuid, NOTE_WIDTH) : "",
|
|
35699
|
+
flexGrow: 1,
|
|
35700
|
+
flexBasis: 0,
|
|
35701
|
+
minHeight: METRIC_ROWS,
|
|
35702
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
35703
|
+
Resources,
|
|
35704
|
+
{
|
|
35705
|
+
row,
|
|
35706
|
+
snapshot,
|
|
35707
|
+
history,
|
|
35708
|
+
barWidth,
|
|
35709
|
+
trailWidth
|
|
35710
|
+
}
|
|
35711
|
+
)
|
|
35501
35712
|
}
|
|
35502
|
-
)
|
|
35503
|
-
|
|
35504
|
-
|
|
35505
|
-
|
|
35506
|
-
|
|
35713
|
+
),
|
|
35714
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Panel, { title: "\u8BA1\u8D39", flexGrow: 1, flexBasis: 0, minHeight: METRIC_ROWS, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Billing, { row, rows, balance }) })
|
|
35715
|
+
]
|
|
35716
|
+
}
|
|
35717
|
+
) : null
|
|
35507
35718
|
] });
|
|
35508
35719
|
}
|
|
35509
35720
|
|
|
@@ -35584,19 +35795,1213 @@ function SessionExpired({
|
|
|
35584
35795
|
] });
|
|
35585
35796
|
}
|
|
35586
35797
|
|
|
35798
|
+
// src/tui/screens/files.tsx
|
|
35799
|
+
import { basename, dirname, join, posix, resolve } from "path";
|
|
35800
|
+
var import_react37 = __toESM(require_react(), 1);
|
|
35801
|
+
var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
|
|
35802
|
+
var REMOTE_HOME = "/root/autodl-tmp";
|
|
35803
|
+
function isVisibleCode(code) {
|
|
35804
|
+
if (code < 32 || code === 127) return false;
|
|
35805
|
+
if (code >= 128 && code <= 159) return false;
|
|
35806
|
+
return true;
|
|
35807
|
+
}
|
|
35808
|
+
function visible(input) {
|
|
35809
|
+
let out = "";
|
|
35810
|
+
for (const char of input) {
|
|
35811
|
+
if (isVisibleCode(char.codePointAt(0) ?? 0)) out += char;
|
|
35812
|
+
}
|
|
35813
|
+
return out || "?";
|
|
35814
|
+
}
|
|
35815
|
+
function sanitizeInput(input) {
|
|
35816
|
+
let out = "";
|
|
35817
|
+
for (const char of input) {
|
|
35818
|
+
if (isVisibleCode(char.codePointAt(0) ?? 0)) out += char;
|
|
35819
|
+
}
|
|
35820
|
+
return out;
|
|
35821
|
+
}
|
|
35822
|
+
var joinSide = (side, dir, name) => side === "remote" ? posix.join(dir, name) : join(dir, name);
|
|
35823
|
+
function resolveSide(side, base, value) {
|
|
35824
|
+
return side === "remote" ? posix.resolve(base, value) : resolve(base, value);
|
|
35825
|
+
}
|
|
35826
|
+
var parentSide = (side, p) => side === "remote" ? posix.dirname(p) : dirname(p);
|
|
35827
|
+
var baseSide = (side, p) => side === "remote" ? posix.basename(p) : basename(p);
|
|
35828
|
+
function kindMark(kind) {
|
|
35829
|
+
if (kind === "directory") return "/";
|
|
35830
|
+
if (kind === "symlink") return "@";
|
|
35831
|
+
if (kind === "other") return "?";
|
|
35832
|
+
return "";
|
|
35833
|
+
}
|
|
35834
|
+
var directionText = (direction) => direction === "upload" ? "\u4E0A\u4F20" : "\u4E0B\u8F7D";
|
|
35835
|
+
function jobStateText(state) {
|
|
35836
|
+
switch (state) {
|
|
35837
|
+
case "queued":
|
|
35838
|
+
return "\u6392\u961F";
|
|
35839
|
+
case "running":
|
|
35840
|
+
return "\u4F20\u8F93\u4E2D";
|
|
35841
|
+
case "conflict":
|
|
35842
|
+
return "\u5F85\u786E\u8BA4";
|
|
35843
|
+
case "paused":
|
|
35844
|
+
return "\u5DF2\u6682\u505C";
|
|
35845
|
+
case "completed":
|
|
35846
|
+
return "\u5B8C\u6210";
|
|
35847
|
+
case "cancelled":
|
|
35848
|
+
return "\u5DF2\u53D6\u6D88";
|
|
35849
|
+
}
|
|
35850
|
+
}
|
|
35851
|
+
function useQueueJobs(queue) {
|
|
35852
|
+
const subscribe = (0, import_react37.useCallback)((listener) => queue.subscribe(listener), [queue]);
|
|
35853
|
+
const snapshot = (0, import_react37.useCallback)(() => queue.snapshot(), [queue]);
|
|
35854
|
+
return (0, import_react37.useSyncExternalStore)(subscribe, snapshot);
|
|
35855
|
+
}
|
|
35856
|
+
var emptyPane = (p) => ({
|
|
35857
|
+
path: p,
|
|
35858
|
+
entries: [],
|
|
35859
|
+
loading: true,
|
|
35860
|
+
error: null,
|
|
35861
|
+
cursor: 0,
|
|
35862
|
+
checked: []
|
|
35863
|
+
});
|
|
35864
|
+
function dialogRows(mode, selectionCount) {
|
|
35865
|
+
switch (mode.name) {
|
|
35866
|
+
case "none":
|
|
35867
|
+
return 0;
|
|
35868
|
+
case "pathNav":
|
|
35869
|
+
case "mkdir":
|
|
35870
|
+
case "rename":
|
|
35871
|
+
return 4;
|
|
35872
|
+
case "delete":
|
|
35873
|
+
return 5 + Math.min(selectionCount, 3) + (selectionCount > 3 ? 1 : 0);
|
|
35874
|
+
case "transfer":
|
|
35875
|
+
return 6 + Math.min(selectionCount, 2);
|
|
35876
|
+
case "pathTransfer":
|
|
35877
|
+
return 7;
|
|
35878
|
+
}
|
|
35879
|
+
}
|
|
35880
|
+
function useFlash() {
|
|
35881
|
+
const [notice, setNotice] = (0, import_react37.useState)(null);
|
|
35882
|
+
const timer = (0, import_react37.useRef)(void 0);
|
|
35883
|
+
const mounted = (0, import_react37.useRef)(true);
|
|
35884
|
+
(0, import_react37.useEffect)(() => {
|
|
35885
|
+
mounted.current = true;
|
|
35886
|
+
return () => {
|
|
35887
|
+
mounted.current = false;
|
|
35888
|
+
clearTimeout(timer.current);
|
|
35889
|
+
};
|
|
35890
|
+
}, []);
|
|
35891
|
+
const flash = (0, import_react37.useCallback)((message) => {
|
|
35892
|
+
if (!mounted.current) return;
|
|
35893
|
+
setNotice(message);
|
|
35894
|
+
clearTimeout(timer.current);
|
|
35895
|
+
timer.current = setTimeout(() => {
|
|
35896
|
+
if (mounted.current) setNotice(null);
|
|
35897
|
+
}, 6e3);
|
|
35898
|
+
}, []);
|
|
35899
|
+
return { notice, flash };
|
|
35900
|
+
}
|
|
35901
|
+
function fitLine(text, width) {
|
|
35902
|
+
return clip(visible(text), Math.max(1, width));
|
|
35903
|
+
}
|
|
35904
|
+
function skippedPageStart(index) {
|
|
35905
|
+
return Math.floor(Math.max(0, index) / 3) * 3;
|
|
35906
|
+
}
|
|
35907
|
+
function detailRows(job, show, skippedOpen, skippedIndex) {
|
|
35908
|
+
if (!job || !show) return 0;
|
|
35909
|
+
let n = 2;
|
|
35910
|
+
n += Math.min(job.request.sources.length, 2) + (job.request.sources.length > 2 ? 1 : 0);
|
|
35911
|
+
if (job.progress) n += 2;
|
|
35912
|
+
if (job.state === "conflict" && job.conflict) n += 2;
|
|
35913
|
+
if (job.result) {
|
|
35914
|
+
n += 1;
|
|
35915
|
+
const total = job.result.skipped.length;
|
|
35916
|
+
if (total > 0) {
|
|
35917
|
+
if (!skippedOpen) {
|
|
35918
|
+
n += 1;
|
|
35919
|
+
} else {
|
|
35920
|
+
const clamped = Math.min(Math.max(0, skippedIndex), total - 1);
|
|
35921
|
+
n += Math.min(3, total - skippedPageStart(clamped)) + 2;
|
|
35922
|
+
}
|
|
35923
|
+
}
|
|
35924
|
+
}
|
|
35925
|
+
if (job.error) n += 1;
|
|
35926
|
+
return n;
|
|
35927
|
+
}
|
|
35928
|
+
function renderQueueBody(ui) {
|
|
35929
|
+
const { jobs, cursor, listRows } = ui;
|
|
35930
|
+
const width = Math.max(20, ui.width);
|
|
35931
|
+
const rowWidth2 = Math.max(1, width - 2);
|
|
35932
|
+
const start = Math.max(0, Math.min(cursor, Math.max(0, jobs.length - listRows)));
|
|
35933
|
+
const shown = jobs.slice(start, start + listRows);
|
|
35934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
35935
|
+
jobs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, wrap: "truncate", children: fitLine("\u961F\u5217\u4E3A\u7A7A\u3002\u5728\u6D4F\u89C8\u5668\u6309 u \u5C06\u9009\u4E2D\u6587\u4EF6\u52A0\u5165\u4F20\u8F93\u961F\u5217\u3002", rowWidth2) }) }) : shown.map((job, i) => {
|
|
35936
|
+
const index = start + i;
|
|
35937
|
+
const active = index === cursor;
|
|
35938
|
+
const req = job.request;
|
|
35939
|
+
const label = `${req.direction === "upload" ? "\u2191" : "\u2193"} ${req.sources.length}\u9879 \u2192 ${req.destination}`;
|
|
35940
|
+
const pct = job.progress && job.progress.total > 0 ? job.progress.transferred / job.progress.total * 100 : job.state === "completed" ? 100 : 0;
|
|
35941
|
+
const speed = job.state === "running" && job.progress ? ` ${formatBytes(job.progress.bytesPerSecond)}/s` : "";
|
|
35942
|
+
const row = `${active ? "\u203A" : " "} ${label} ${jobStateText(job.state)} ${Math.round(pct)}%${speed}${job.state === "conflict" ? " \u5F85\u786E\u8BA4" : ""}${job.error ? " \u2716" : ""}`;
|
|
35943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: active ? "green" : void 0, inverse: active, wrap: "truncate", children: fitLine(row, rowWidth2) }) }, job.request.id);
|
|
35944
|
+
}),
|
|
35945
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(QueueDetail, { ui })
|
|
35946
|
+
] });
|
|
35947
|
+
}
|
|
35948
|
+
function SkippedBrowser({
|
|
35949
|
+
ui,
|
|
35950
|
+
job,
|
|
35951
|
+
width
|
|
35952
|
+
}) {
|
|
35953
|
+
const skipped = job.result?.skipped;
|
|
35954
|
+
if (!skipped || skipped.length === 0) return null;
|
|
35955
|
+
if (!ui.skippedOpen) {
|
|
35956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, wrap: "truncate", children: fitLine(`\u8DF3\u8FC7 ${skipped.length} \u9879 \xB7 v \u67E5\u770B\u5168\u90E8`, width) });
|
|
35957
|
+
}
|
|
35958
|
+
const total = skipped.length;
|
|
35959
|
+
const clamped = Math.min(ui.skippedIndex, Math.max(0, total - 1));
|
|
35960
|
+
const start = skippedPageStart(clamped);
|
|
35961
|
+
const shown = skipped.slice(start, start + 3);
|
|
35962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
35963
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { bold: true, wrap: "truncate", children: fitLine(`\u8DF3\u8FC7 ${total} \u9879\uFF08${clamped + 1}/${total}\uFF09\xB7 \u2191\u2193 \u9009\u62E9 \xB7 Esc \u6536\u8D77`, width) }),
|
|
35964
|
+
shown.map((entry, i) => {
|
|
35965
|
+
const absolute = start + i;
|
|
35966
|
+
const active = absolute === clamped;
|
|
35967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: !active, inverse: active, wrap: "truncate", children: fitLine(`${active ? "\u203A" : "\xB7"} ${entry}`, width) }, `${absolute}`);
|
|
35968
|
+
}),
|
|
35969
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, wrap: "truncate", children: fitLine(
|
|
35970
|
+
total > 3 ? `\u7B2C ${Math.floor(start / 3) + 1}/${Math.ceil(total / 3)} \u9875 \xB7 Esc \u6536\u8D77\u8DF3\u8FC7\u5217\u8868` : "Esc \u6536\u8D77\u8DF3\u8FC7\u5217\u8868",
|
|
35971
|
+
width
|
|
35972
|
+
) })
|
|
35973
|
+
] });
|
|
35974
|
+
}
|
|
35975
|
+
function QueueDetail({ ui }) {
|
|
35976
|
+
const job = ui.jobs[Math.min(ui.cursor, Math.max(0, ui.jobs.length - 1))];
|
|
35977
|
+
if (!job || !ui.showDetail) return null;
|
|
35978
|
+
const req = job.request;
|
|
35979
|
+
const width = Math.max(20, ui.width - 4);
|
|
35980
|
+
const lines = [
|
|
35981
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { bold: true, wrap: "truncate", children: fitLine(
|
|
35982
|
+
`${directionText(req.direction)} \xB7 ${req.sources.length} \u4E2A\u6765\u6E90${req.sync ? " \xB7 \u540C\u6B65" : ""}${req.checksum ? " \xB7 \u54C8\u5E0C\u6821\u9A8C" : ""}`,
|
|
35983
|
+
width
|
|
35984
|
+
) }, "h"),
|
|
35985
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, wrap: "truncate", children: fitLine(`\u2192 ${req.destination}`, width) }, "d")
|
|
35986
|
+
];
|
|
35987
|
+
for (const [i, source] of req.sources.slice(0, 2).entries()) {
|
|
35988
|
+
lines.push(
|
|
35989
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, wrap: "truncate", children: fitLine(`\xB7 ${source}`, width) }, `s-${i}`)
|
|
35990
|
+
);
|
|
35991
|
+
}
|
|
35992
|
+
if (req.sources.length > 2) {
|
|
35993
|
+
lines.push(
|
|
35994
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, wrap: "truncate", children: fitLine(`\xB7 \u2026\u53E6 ${req.sources.length - 2} \u4E2A`, width) }, "more")
|
|
35995
|
+
);
|
|
35996
|
+
}
|
|
35997
|
+
if (job.progress) {
|
|
35998
|
+
const p = job.progress;
|
|
35999
|
+
lines.push(
|
|
36000
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { wrap: "truncate", children: fitLine(
|
|
36001
|
+
`${p.file} ${formatBytes(p.transferred)}/${formatBytes(p.total)} \xB7 ${p.filesDone}/${p.filesTotal} \u6587\u4EF6 \xB7 ${formatBytes(p.bytesPerSecond)}/s`,
|
|
36002
|
+
width
|
|
36003
|
+
) }, "p")
|
|
36004
|
+
);
|
|
36005
|
+
lines.push(
|
|
36006
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { wrap: "truncate", children: fitLine(
|
|
36007
|
+
bar(p.total > 0 ? p.transferred / p.total * 100 : 0, Math.min(30, width)),
|
|
36008
|
+
width
|
|
36009
|
+
) }, "b")
|
|
36010
|
+
);
|
|
36011
|
+
}
|
|
36012
|
+
if (job.state === "conflict" && job.conflict) {
|
|
36013
|
+
lines.push(
|
|
36014
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: "yellow", wrap: "truncate", children: fitLine(
|
|
36015
|
+
`\u51B2\u7A81\uFF1A${job.conflict.source} \u2192 ${job.conflict.destination} (${formatBytes(job.conflict.sourceSize)}/${formatBytes(job.conflict.destinationSize)})`,
|
|
36016
|
+
width
|
|
36017
|
+
) }, "c")
|
|
36018
|
+
);
|
|
36019
|
+
lines.push(
|
|
36020
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: "yellow", wrap: "truncate", children: fitLine(
|
|
36021
|
+
`o \u8986\u76D6 \xB7 s \u8DF3\u8FC7 \xB7 b \u4FDD\u7559\u4E24\u8005 \xB7 a \u5E94\u7528\u4E8E\u5168\u90E8[${ui.applyAll ? "\u2713" : " "}] \xB7 \u76EE\u6807\u4E3A\u9009\u4E2D\u4EFB\u52A1`,
|
|
36022
|
+
width
|
|
36023
|
+
) }, "ck")
|
|
36024
|
+
);
|
|
36025
|
+
}
|
|
36026
|
+
if (job.result) {
|
|
36027
|
+
lines.push(
|
|
36028
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: "green", wrap: "truncate", children: fitLine(
|
|
36029
|
+
`\u5B8C\u6210\uFF1A${job.result.files} \u6587\u4EF6 \xB7 ${formatBytes(job.result.bytes)}${job.result.skipped.length > 0 ? ` \xB7 \u8DF3\u8FC7 ${job.result.skipped.length} \u9879` : ""}`,
|
|
36030
|
+
width
|
|
36031
|
+
) }, "r")
|
|
36032
|
+
);
|
|
36033
|
+
lines.push(/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkippedBrowser, { ui, job, width }, "skipped"));
|
|
36034
|
+
}
|
|
36035
|
+
if (job.error) {
|
|
36036
|
+
lines.push(
|
|
36037
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: "red", wrap: "truncate", children: fitLine(`\u2716 ${job.error}`, width) }, "e")
|
|
36038
|
+
);
|
|
36039
|
+
}
|
|
36040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { flexDirection: "column", paddingX: 1, children: lines });
|
|
36041
|
+
}
|
|
36042
|
+
function handleQueueInput(input, key, ui, queue, onExit) {
|
|
36043
|
+
const job = ui.jobs[Math.min(ui.cursor, Math.max(0, ui.jobs.length - 1))];
|
|
36044
|
+
const skippedTotal = ui.showDetail && !ui.skippedOpen ? job?.result?.skipped.length ?? 0 : 0;
|
|
36045
|
+
if (ui.showDetail && ui.skippedOpen && job?.result) {
|
|
36046
|
+
const total = job.result.skipped.length;
|
|
36047
|
+
if (key.upArrow || input === "k") {
|
|
36048
|
+
ui.setSkippedIndex((v) => Math.max(0, v - 1));
|
|
36049
|
+
return true;
|
|
36050
|
+
}
|
|
36051
|
+
if (key.downArrow || input === "j") {
|
|
36052
|
+
ui.setSkippedIndex((v) => Math.max(0, Math.min(total - 1, v + 1)));
|
|
36053
|
+
return true;
|
|
36054
|
+
}
|
|
36055
|
+
if (input === "q" || key.escape || key.return || input === "v") {
|
|
36056
|
+
ui.setSkippedOpen(() => false);
|
|
36057
|
+
return true;
|
|
36058
|
+
}
|
|
36059
|
+
return false;
|
|
36060
|
+
}
|
|
36061
|
+
if (key.upArrow || input === "k") {
|
|
36062
|
+
ui.setCursor((v) => Math.max(0, v - 1));
|
|
36063
|
+
return true;
|
|
36064
|
+
}
|
|
36065
|
+
if (key.downArrow || input === "j") {
|
|
36066
|
+
ui.setCursor((v) => Math.max(0, Math.min(ui.jobs.length - 1, v + 1)));
|
|
36067
|
+
return true;
|
|
36068
|
+
}
|
|
36069
|
+
if (key.return) {
|
|
36070
|
+
if (ui.showDetail) {
|
|
36071
|
+
ui.setShowDetail(() => false);
|
|
36072
|
+
ui.setSkippedOpen(() => false);
|
|
36073
|
+
} else {
|
|
36074
|
+
ui.setShowDetail(() => true);
|
|
36075
|
+
}
|
|
36076
|
+
return true;
|
|
36077
|
+
}
|
|
36078
|
+
if (input === "v" && ui.showDetail && skippedTotal > 0) {
|
|
36079
|
+
ui.setSkippedIndex(() => 0);
|
|
36080
|
+
ui.setSkippedOpen(() => true);
|
|
36081
|
+
return true;
|
|
36082
|
+
}
|
|
36083
|
+
if (input === "q" || key.escape) {
|
|
36084
|
+
if (ui.showDetail) {
|
|
36085
|
+
ui.setShowDetail(() => false);
|
|
36086
|
+
ui.setSkippedOpen(() => false);
|
|
36087
|
+
} else onExit();
|
|
36088
|
+
return true;
|
|
36089
|
+
}
|
|
36090
|
+
if (input === "r") {
|
|
36091
|
+
if (!job) {
|
|
36092
|
+
ui.flash("\u961F\u5217\u4E3A\u7A7A");
|
|
36093
|
+
return true;
|
|
36094
|
+
}
|
|
36095
|
+
if (job.state === "paused" || job.state === "cancelled") ui.resume(job.request.id);
|
|
36096
|
+
else ui.flash("\u53EA\u6709\u5DF2\u6682\u505C/\u5DF2\u53D6\u6D88\u7684\u4EFB\u52A1\u53EF\u4EE5\u6062\u590D");
|
|
36097
|
+
return true;
|
|
36098
|
+
}
|
|
36099
|
+
if (input === "c") {
|
|
36100
|
+
if (!job) {
|
|
36101
|
+
ui.flash("\u961F\u5217\u4E3A\u7A7A");
|
|
36102
|
+
return true;
|
|
36103
|
+
}
|
|
36104
|
+
if (job.state === "queued" || job.state === "running" || job.state === "paused" || job.state === "conflict") {
|
|
36105
|
+
queue.cancel(job.request.id);
|
|
36106
|
+
} else ui.flash("\u5DF2\u5B8C\u6210/\u5DF2\u53D6\u6D88\u7684\u4EFB\u52A1\u65E0\u9700\u53D6\u6D88");
|
|
36107
|
+
return true;
|
|
36108
|
+
}
|
|
36109
|
+
if (input === "a" && job && job.state === "conflict") {
|
|
36110
|
+
ui.setApplyAll((v) => !v);
|
|
36111
|
+
return true;
|
|
36112
|
+
}
|
|
36113
|
+
if ((input === "o" || input === "s" || input === "b") && job && job.state === "conflict") {
|
|
36114
|
+
queue.resolveConflict(job.request.id, {
|
|
36115
|
+
choice: input === "o" ? "overwrite" : input === "s" ? "skip" : "keep-both",
|
|
36116
|
+
applyToAll: ui.applyAll
|
|
36117
|
+
});
|
|
36118
|
+
return true;
|
|
36119
|
+
}
|
|
36120
|
+
return false;
|
|
36121
|
+
}
|
|
36122
|
+
function queueHints(job, skippedOpen) {
|
|
36123
|
+
const base = "\u2191\u2193/jk \u9009\u62E9 \xB7 Enter \u8BE6\u60C5 \xB7 r \u6062\u590D\u6682\u505C/\u53D6\u6D88 \xB7 c \u53D6\u6D88\u6392\u961F/\u4F20\u8F93";
|
|
36124
|
+
const skipped = job?.result && job.result.skipped.length > 0 ? " \xB7 \u8BE6\u60C5\u4E2D\u6309 v \u67E5\u770B\u8DF3\u8FC7" : "";
|
|
36125
|
+
if (skippedOpen) {
|
|
36126
|
+
return [base, "\u8DF3\u8FC7\u5217\u8868\uFF1A\u2191\u2193 \u9009\u62E9 \xB7 Enter/Esc/q/v \u6536\u8D77"];
|
|
36127
|
+
}
|
|
36128
|
+
const second = job?.state === "conflict" ? "o \u8986\u76D6 \xB7 s \u8DF3\u8FC7 \xB7 b \u4FDD\u7559\u4E24\u8005 \xB7 a \u5E94\u7528\u4E8E\u5168\u90E8 \xB7 Esc/q \u6536\u8D77\u8BE6\u60C5\u6216\u8FD4\u56DE" : "Esc/q \u6536\u8D77\u8BE6\u60C5\u6216\u8FD4\u56DE \xB7 \u8DF3\u8FC7\u5217\u8868\u4E2D \u2191\u2193 \u7FFB\u770B Esc \u6536\u8D77";
|
|
36129
|
+
return [`${base}${skipped}`, second];
|
|
36130
|
+
}
|
|
36131
|
+
function TransferJobs({
|
|
36132
|
+
queue,
|
|
36133
|
+
width,
|
|
36134
|
+
height,
|
|
36135
|
+
onBack,
|
|
36136
|
+
onResume
|
|
36137
|
+
}) {
|
|
36138
|
+
const jobs = useQueueJobs(queue);
|
|
36139
|
+
const [cursor, setCursor] = (0, import_react37.useState)(0);
|
|
36140
|
+
const [showDetail, setShowDetail] = (0, import_react37.useState)(false);
|
|
36141
|
+
const [skippedOpen, setSkippedOpen] = (0, import_react37.useState)(false);
|
|
36142
|
+
const [skippedIndex, setSkippedIndex] = (0, import_react37.useState)(0);
|
|
36143
|
+
const [applyAll, setApplyAll] = (0, import_react37.useState)(false);
|
|
36144
|
+
const { notice, flash } = useFlash();
|
|
36145
|
+
const resume = (0, import_react37.useCallback)(
|
|
36146
|
+
(id) => onResume ? onResume(id) : queue.resume(id),
|
|
36147
|
+
[onResume, queue]
|
|
36148
|
+
);
|
|
36149
|
+
const clamped = Math.min(cursor, Math.max(0, jobs.length - 1));
|
|
36150
|
+
const selected = jobs[clamped];
|
|
36151
|
+
const selectedId = selected?.request.id;
|
|
36152
|
+
const previousSelectedId = (0, import_react37.useRef)(selectedId);
|
|
36153
|
+
(0, import_react37.useEffect)(() => {
|
|
36154
|
+
if (previousSelectedId.current === selectedId) return;
|
|
36155
|
+
previousSelectedId.current = selectedId;
|
|
36156
|
+
setSkippedOpen(false);
|
|
36157
|
+
setSkippedIndex(0);
|
|
36158
|
+
}, [selectedId]);
|
|
36159
|
+
const listRows = Math.max(
|
|
36160
|
+
1,
|
|
36161
|
+
height - 3 - detailRows(selected, showDetail, skippedOpen, skippedIndex) - (notice ? 1 : 0)
|
|
36162
|
+
);
|
|
36163
|
+
const ui = {
|
|
36164
|
+
jobs,
|
|
36165
|
+
cursor: clamped,
|
|
36166
|
+
setCursor,
|
|
36167
|
+
showDetail,
|
|
36168
|
+
setShowDetail,
|
|
36169
|
+
skippedOpen,
|
|
36170
|
+
setSkippedOpen,
|
|
36171
|
+
skippedIndex,
|
|
36172
|
+
setSkippedIndex,
|
|
36173
|
+
applyAll,
|
|
36174
|
+
setApplyAll,
|
|
36175
|
+
resume,
|
|
36176
|
+
flash,
|
|
36177
|
+
width,
|
|
36178
|
+
listRows
|
|
36179
|
+
};
|
|
36180
|
+
use_input_default((input, key) => {
|
|
36181
|
+
if (key.ctrl) return;
|
|
36182
|
+
handleQueueInput(input, key, ui, queue, onBack);
|
|
36183
|
+
});
|
|
36184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", width, height, overflow: "hidden", children: [
|
|
36185
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { paddingX: 1, children: [
|
|
36186
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { bold: true, children: "\u4F20\u8F93\u961F\u5217" }),
|
|
36187
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { dimColor: true, children: [
|
|
36188
|
+
jobs.length,
|
|
36189
|
+
" \u4E2A\u4EFB\u52A1\uFF08\u4E32\u884C\uFF09",
|
|
36190
|
+
jobs.length > 0 ? ` \xB7 ${clamped + 1}/${jobs.length}` : ""
|
|
36191
|
+
] })
|
|
36192
|
+
] }),
|
|
36193
|
+
renderQueueBody(ui),
|
|
36194
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { flexGrow: 1 }),
|
|
36195
|
+
notice ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: "cyan", children: clip(visible(notice), Math.max(10, width - 2)) }) }) : null,
|
|
36196
|
+
queueHints(selected, skippedOpen).map((hint) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, wrap: "truncate", children: fitLine(hint, Math.max(10, width - 2)) }) }, hint))
|
|
36197
|
+
] });
|
|
36198
|
+
}
|
|
36199
|
+
function FilesScreen({
|
|
36200
|
+
workspace,
|
|
36201
|
+
queue,
|
|
36202
|
+
uuid,
|
|
36203
|
+
width,
|
|
36204
|
+
height,
|
|
36205
|
+
onBack,
|
|
36206
|
+
onResume,
|
|
36207
|
+
whenRunning
|
|
36208
|
+
}) {
|
|
36209
|
+
const [tab2, setTab] = (0, import_react37.useState)("browser");
|
|
36210
|
+
const [panes, setPanes] = (0, import_react37.useState)(() => ({
|
|
36211
|
+
local: emptyPane(process.cwd()),
|
|
36212
|
+
remote: emptyPane(REMOTE_HOME)
|
|
36213
|
+
}));
|
|
36214
|
+
const [activeSide, setActiveSide] = (0, import_react37.useState)("local");
|
|
36215
|
+
const [mode, setMode] = (0, import_react37.useState)({ name: "none" });
|
|
36216
|
+
const [field, setField] = (0, import_react37.useState)("");
|
|
36217
|
+
const [confirmYes, setConfirmYes] = (0, import_react37.useState)(false);
|
|
36218
|
+
const [syncDefault, setSyncDefault] = (0, import_react37.useState)(false);
|
|
36219
|
+
const [checksumDefault, setChecksumDefault] = (0, import_react37.useState)(false);
|
|
36220
|
+
const [pending, setPending] = (0, import_react37.useState)(null);
|
|
36221
|
+
const [pathForm, setPathForm] = (0, import_react37.useState)({
|
|
36222
|
+
direction: "upload",
|
|
36223
|
+
source: "",
|
|
36224
|
+
dest: "",
|
|
36225
|
+
sync: false,
|
|
36226
|
+
checksum: false
|
|
36227
|
+
});
|
|
36228
|
+
const [busy, setBusy] = (0, import_react37.useState)(false);
|
|
36229
|
+
const { notice, flash } = useFlash();
|
|
36230
|
+
const jobs = useQueueJobs(queue);
|
|
36231
|
+
const [queueCursor, setQueueCursor] = (0, import_react37.useState)(0);
|
|
36232
|
+
const [queueDetail, setQueueDetail] = (0, import_react37.useState)(false);
|
|
36233
|
+
const [skippedOpen, setSkippedOpen] = (0, import_react37.useState)(false);
|
|
36234
|
+
const [skippedIndex, setSkippedIndex] = (0, import_react37.useState)(0);
|
|
36235
|
+
const [applyAll, setApplyAll] = (0, import_react37.useState)(false);
|
|
36236
|
+
const resume = (0, import_react37.useCallback)(
|
|
36237
|
+
(id) => onResume ? onResume(id) : queue.resume(id),
|
|
36238
|
+
[onResume, queue]
|
|
36239
|
+
);
|
|
36240
|
+
const mounted = (0, import_react37.useRef)(true);
|
|
36241
|
+
(0, import_react37.useEffect)(
|
|
36242
|
+
() => () => {
|
|
36243
|
+
mounted.current = false;
|
|
36244
|
+
workspace.dispose();
|
|
36245
|
+
},
|
|
36246
|
+
[workspace]
|
|
36247
|
+
);
|
|
36248
|
+
const gen = (0, import_react37.useRef)({ local: 0, remote: 0 });
|
|
36249
|
+
const queueJobId = jobs[Math.min(queueCursor, Math.max(0, jobs.length - 1))]?.request.id;
|
|
36250
|
+
const previousQueueJobId = (0, import_react37.useRef)(queueJobId);
|
|
36251
|
+
(0, import_react37.useEffect)(() => {
|
|
36252
|
+
if (previousQueueJobId.current === queueJobId) return;
|
|
36253
|
+
previousQueueJobId.current = queueJobId;
|
|
36254
|
+
setSkippedOpen(false);
|
|
36255
|
+
setSkippedIndex(0);
|
|
36256
|
+
}, [queueJobId]);
|
|
36257
|
+
const pathRef = (0, import_react37.useRef)({
|
|
36258
|
+
local: process.cwd(),
|
|
36259
|
+
remote: REMOTE_HOME
|
|
36260
|
+
});
|
|
36261
|
+
(0, import_react37.useEffect)(() => {
|
|
36262
|
+
pathRef.current = { local: panes.local.path, remote: panes.remote.path };
|
|
36263
|
+
});
|
|
36264
|
+
const loadPane = (0, import_react37.useCallback)(
|
|
36265
|
+
(side, nextPath) => {
|
|
36266
|
+
gen.current[side] += 1;
|
|
36267
|
+
const g = gen.current[side];
|
|
36268
|
+
if (side === "local") {
|
|
36269
|
+
setPanes((prev) => ({ ...prev, local: { ...emptyPane(nextPath), cursor: 0 } }));
|
|
36270
|
+
} else {
|
|
36271
|
+
setPanes((prev) => ({ ...prev, remote: { ...emptyPane(nextPath), cursor: 0 } }));
|
|
36272
|
+
}
|
|
36273
|
+
const run = () => {
|
|
36274
|
+
if (!mounted.current || gen.current[side] !== g) return;
|
|
36275
|
+
workspace.list(side, nextPath).then((entries) => {
|
|
36276
|
+
if (!mounted.current || gen.current[side] !== g) return;
|
|
36277
|
+
const sorted = [...entries].sort((a, b) => {
|
|
36278
|
+
if (a.kind === "directory" && b.kind !== "directory") return -1;
|
|
36279
|
+
if (a.kind !== "directory" && b.kind === "directory") return 1;
|
|
36280
|
+
return a.name.localeCompare(b.name);
|
|
36281
|
+
});
|
|
36282
|
+
setPanes(
|
|
36283
|
+
(prev) => side === "local" ? { ...prev, local: { ...prev.local, entries: sorted, loading: false } } : { ...prev, remote: { ...prev.remote, entries: sorted, loading: false } }
|
|
36284
|
+
);
|
|
36285
|
+
}).catch((err) => {
|
|
36286
|
+
if (!mounted.current || gen.current[side] !== g) return;
|
|
36287
|
+
const message = err.message;
|
|
36288
|
+
setPanes(
|
|
36289
|
+
(prev) => side === "local" ? { ...prev, local: { ...prev.local, entries: [], loading: false, error: message } } : {
|
|
36290
|
+
...prev,
|
|
36291
|
+
remote: { ...prev.remote, entries: [], loading: false, error: message }
|
|
36292
|
+
}
|
|
36293
|
+
);
|
|
36294
|
+
});
|
|
36295
|
+
};
|
|
36296
|
+
if (side === "remote" && whenRunning) {
|
|
36297
|
+
void whenRunning.then(
|
|
36298
|
+
() => run(),
|
|
36299
|
+
(err) => {
|
|
36300
|
+
if (!mounted.current || gen.current[side] !== g) return;
|
|
36301
|
+
const message = err.message;
|
|
36302
|
+
setPanes((prev) => ({
|
|
36303
|
+
...prev,
|
|
36304
|
+
remote: { ...prev.remote, entries: [], loading: false, error: message }
|
|
36305
|
+
}));
|
|
36306
|
+
}
|
|
36307
|
+
);
|
|
36308
|
+
return;
|
|
36309
|
+
}
|
|
36310
|
+
run();
|
|
36311
|
+
},
|
|
36312
|
+
[workspace, whenRunning]
|
|
36313
|
+
);
|
|
36314
|
+
(0, import_react37.useEffect)(() => {
|
|
36315
|
+
loadPane("local", process.cwd());
|
|
36316
|
+
loadPane("remote", REMOTE_HOME);
|
|
36317
|
+
}, [loadPane]);
|
|
36318
|
+
const completedJobs = (0, import_react37.useRef)(
|
|
36319
|
+
new Set(jobs.filter((job) => job.state === "completed").map((job) => job.request.id))
|
|
36320
|
+
);
|
|
36321
|
+
(0, import_react37.useEffect)(() => {
|
|
36322
|
+
for (const job of jobs) {
|
|
36323
|
+
if (job.state !== "completed" || completedJobs.current.has(job.request.id)) continue;
|
|
36324
|
+
completedJobs.current.add(job.request.id);
|
|
36325
|
+
if (job.request.uuid !== uuid) continue;
|
|
36326
|
+
const side = job.request.direction === "upload" ? "remote" : "local";
|
|
36327
|
+
loadPane(side, pathRef.current[side]);
|
|
36328
|
+
}
|
|
36329
|
+
}, [jobs, loadPane, uuid]);
|
|
36330
|
+
const pane = panes[activeSide];
|
|
36331
|
+
const otherSide = activeSide === "local" ? "remote" : "local";
|
|
36332
|
+
const cursorIndex = Math.min(pane.cursor, Math.max(0, pane.entries.length - 1));
|
|
36333
|
+
const cursorEntry = pane.entries[cursorIndex];
|
|
36334
|
+
const selection = (0, import_react37.useMemo)(() => {
|
|
36335
|
+
if (pane.checked.length > 0) return pane.entries.filter((e) => pane.checked.includes(e.path));
|
|
36336
|
+
return cursorEntry ? [cursorEntry] : [];
|
|
36337
|
+
}, [pane.checked, pane.entries, cursorEntry]);
|
|
36338
|
+
const setPaneCursor = (0, import_react37.useCallback)((side, fn) => {
|
|
36339
|
+
setPanes((prev) => {
|
|
36340
|
+
const current = prev[side];
|
|
36341
|
+
const next = fn(current.cursor);
|
|
36342
|
+
return side === "local" ? { ...prev, local: { ...current, cursor: next } } : { ...prev, remote: { ...current, cursor: next } };
|
|
36343
|
+
});
|
|
36344
|
+
}, []);
|
|
36345
|
+
const runOp = (0, import_react37.useCallback)(
|
|
36346
|
+
async (label, fn, side) => {
|
|
36347
|
+
setBusy(true);
|
|
36348
|
+
try {
|
|
36349
|
+
await fn();
|
|
36350
|
+
if (!mounted.current) return;
|
|
36351
|
+
flash(`\u2714 ${label}`);
|
|
36352
|
+
loadPane(side, pathRef.current[side]);
|
|
36353
|
+
} catch (err) {
|
|
36354
|
+
if (!mounted.current) return;
|
|
36355
|
+
flash(`\u2716 ${label}\u5931\u8D25\uFF1A${err.message}`);
|
|
36356
|
+
} finally {
|
|
36357
|
+
if (mounted.current) setBusy(false);
|
|
36358
|
+
}
|
|
36359
|
+
},
|
|
36360
|
+
[flash, loadPane]
|
|
36361
|
+
);
|
|
36362
|
+
const doDelete = (0, import_react37.useCallback)(() => {
|
|
36363
|
+
const targets = selection.map((e) => e.path);
|
|
36364
|
+
const side = activeSide;
|
|
36365
|
+
const count = targets.length;
|
|
36366
|
+
setMode({ name: "none" });
|
|
36367
|
+
setConfirmYes(false);
|
|
36368
|
+
void runOp(
|
|
36369
|
+
`\u5DF2\u5220\u9664 ${count} \u9879`,
|
|
36370
|
+
async () => {
|
|
36371
|
+
const results = await Promise.allSettled(targets.map((t) => workspace.remove(side, t)));
|
|
36372
|
+
const failed = results.filter((r) => r.status === "rejected");
|
|
36373
|
+
if (failed.length > 0) throw new Error(`${failed.length}/${count} \u9879\u5220\u9664\u5931\u8D25`);
|
|
36374
|
+
},
|
|
36375
|
+
side
|
|
36376
|
+
);
|
|
36377
|
+
}, [selection, activeSide, runOp, workspace]);
|
|
36378
|
+
const openTransferConfirm = (0, import_react37.useCallback)(() => {
|
|
36379
|
+
if (selection.length === 0) {
|
|
36380
|
+
flash("\u6CA1\u6709\u53EF\u4F20\u8F93\u7684\u9009\u4E2D\u9879");
|
|
36381
|
+
return;
|
|
36382
|
+
}
|
|
36383
|
+
setPending({
|
|
36384
|
+
sources: selection.map((e) => e.path),
|
|
36385
|
+
kinds: selection.map((e) => e.kind),
|
|
36386
|
+
direction: activeSide === "local" ? "upload" : "download",
|
|
36387
|
+
destDir: panes[otherSide].path
|
|
36388
|
+
});
|
|
36389
|
+
setMode({ name: "transfer" });
|
|
36390
|
+
}, [selection, activeSide, panes, otherSide, flash]);
|
|
36391
|
+
const submitTransfer = (0, import_react37.useCallback)(
|
|
36392
|
+
(sync, checksum) => {
|
|
36393
|
+
if (!pending) return;
|
|
36394
|
+
queue.enqueue({
|
|
36395
|
+
uuid,
|
|
36396
|
+
direction: pending.direction,
|
|
36397
|
+
sources: pending.sources,
|
|
36398
|
+
destination: pending.destDir,
|
|
36399
|
+
sync,
|
|
36400
|
+
checksum
|
|
36401
|
+
});
|
|
36402
|
+
flash(`\u2714 \u5DF2\u52A0\u5165\u961F\u5217\uFF1A${pending.sources.length} \u9879\uFF0C\u6309 Q \u67E5\u770B`);
|
|
36403
|
+
setPending(null);
|
|
36404
|
+
setMode({ name: "none" });
|
|
36405
|
+
},
|
|
36406
|
+
[pending, queue, uuid, flash]
|
|
36407
|
+
);
|
|
36408
|
+
const submitPathForm = (0, import_react37.useCallback)(() => {
|
|
36409
|
+
const rawSource = pathForm.source.trim();
|
|
36410
|
+
const rawDest = pathForm.dest.trim();
|
|
36411
|
+
if (!rawSource || !rawDest) {
|
|
36412
|
+
flash("\u6765\u6E90\u548C\u76EE\u6807\u8DEF\u5F84\u90FD\u4E0D\u80FD\u4E3A\u7A7A");
|
|
36413
|
+
return;
|
|
36414
|
+
}
|
|
36415
|
+
const direction = pathForm.direction;
|
|
36416
|
+
const fromSide = direction === "upload" ? "local" : "remote";
|
|
36417
|
+
const toSide = direction === "upload" ? "remote" : "local";
|
|
36418
|
+
const source = resolveSide(fromSide, panes[fromSide].path, rawSource);
|
|
36419
|
+
const dest = resolveSide(toSide, panes[toSide].path, rawDest);
|
|
36420
|
+
queue.enqueue({
|
|
36421
|
+
uuid,
|
|
36422
|
+
direction,
|
|
36423
|
+
sources: [source],
|
|
36424
|
+
destination: dest,
|
|
36425
|
+
sync: pathForm.sync,
|
|
36426
|
+
checksum: pathForm.checksum
|
|
36427
|
+
});
|
|
36428
|
+
flash("\u2714 \u5DF2\u52A0\u5165\u961F\u5217\uFF0C\u6309 Q \u67E5\u770B");
|
|
36429
|
+
setMode({ name: "none" });
|
|
36430
|
+
}, [pathForm, panes, queue, uuid, flash]);
|
|
36431
|
+
const updatePaneChecked = (0, import_react37.useCallback)((side, fn) => {
|
|
36432
|
+
setPanes((prev) => {
|
|
36433
|
+
const current = prev[side];
|
|
36434
|
+
const next = fn(current.checked);
|
|
36435
|
+
return side === "local" ? { ...prev, local: { ...current, checked: next } } : { ...prev, remote: { ...current, checked: next } };
|
|
36436
|
+
});
|
|
36437
|
+
}, []);
|
|
36438
|
+
use_input_default((input, key) => {
|
|
36439
|
+
if (key.ctrl) return;
|
|
36440
|
+
if (busy) {
|
|
36441
|
+
if (key.escape || input === "q") {
|
|
36442
|
+
if (tab2 === "queue") {
|
|
36443
|
+
if (queueDetail) {
|
|
36444
|
+
setQueueDetail(false);
|
|
36445
|
+
setSkippedOpen(false);
|
|
36446
|
+
} else setTab("browser");
|
|
36447
|
+
} else if (mode.name !== "none") {
|
|
36448
|
+
setMode({ name: "none" });
|
|
36449
|
+
setPending(null);
|
|
36450
|
+
setConfirmYes(false);
|
|
36451
|
+
} else onBack();
|
|
36452
|
+
}
|
|
36453
|
+
return;
|
|
36454
|
+
}
|
|
36455
|
+
if (tab2 === "queue") {
|
|
36456
|
+
const ui = {
|
|
36457
|
+
jobs,
|
|
36458
|
+
cursor: Math.min(queueCursor, Math.max(0, jobs.length - 1)),
|
|
36459
|
+
setCursor: setQueueCursor,
|
|
36460
|
+
showDetail: queueDetail,
|
|
36461
|
+
setShowDetail: setQueueDetail,
|
|
36462
|
+
skippedOpen,
|
|
36463
|
+
setSkippedOpen,
|
|
36464
|
+
skippedIndex,
|
|
36465
|
+
setSkippedIndex,
|
|
36466
|
+
applyAll,
|
|
36467
|
+
setApplyAll,
|
|
36468
|
+
resume,
|
|
36469
|
+
flash,
|
|
36470
|
+
width,
|
|
36471
|
+
listRows: 1
|
|
36472
|
+
};
|
|
36473
|
+
if (handleQueueInput(input, key, ui, queue, () => setTab("browser"))) return;
|
|
36474
|
+
if (input === "Q") {
|
|
36475
|
+
setTab("browser");
|
|
36476
|
+
return;
|
|
36477
|
+
}
|
|
36478
|
+
return;
|
|
36479
|
+
}
|
|
36480
|
+
if (mode.name === "pathNav" || mode.name === "mkdir" || mode.name === "rename") {
|
|
36481
|
+
if (key.escape) {
|
|
36482
|
+
setMode({ name: "none" });
|
|
36483
|
+
return;
|
|
36484
|
+
}
|
|
36485
|
+
if (key.return) {
|
|
36486
|
+
const value = field.trim();
|
|
36487
|
+
if (mode.name === "pathNav") {
|
|
36488
|
+
if (value) loadPane(activeSide, resolveSide(activeSide, pane.path, value));
|
|
36489
|
+
setMode({ name: "none" });
|
|
36490
|
+
} else if (mode.name === "mkdir") {
|
|
36491
|
+
if (!value) {
|
|
36492
|
+
flash("\u76EE\u5F55\u540D\u4E0D\u80FD\u4E3A\u7A7A");
|
|
36493
|
+
return;
|
|
36494
|
+
}
|
|
36495
|
+
const target = resolveSide(activeSide, pane.path, value);
|
|
36496
|
+
setMode({ name: "none" });
|
|
36497
|
+
void runOp("\u5DF2\u521B\u5EFA\u76EE\u5F55", () => workspace.mkdir(activeSide, target), activeSide);
|
|
36498
|
+
} else if (mode.name === "rename") {
|
|
36499
|
+
if (!value) {
|
|
36500
|
+
flash("\u76EE\u6807\u8DEF\u5F84\u4E0D\u80FD\u4E3A\u7A7A");
|
|
36501
|
+
return;
|
|
36502
|
+
}
|
|
36503
|
+
const targets = selection;
|
|
36504
|
+
setMode({ name: "none" });
|
|
36505
|
+
if (mode.multi) {
|
|
36506
|
+
const destDir = resolveSide(activeSide, pane.path, value);
|
|
36507
|
+
void runOp(
|
|
36508
|
+
`\u5DF2\u79FB\u52A8 ${targets.length} \u9879`,
|
|
36509
|
+
async () => {
|
|
36510
|
+
const failures = [];
|
|
36511
|
+
for (const t of targets) {
|
|
36512
|
+
try {
|
|
36513
|
+
await workspace.rename(
|
|
36514
|
+
activeSide,
|
|
36515
|
+
t.path,
|
|
36516
|
+
joinSide(activeSide, destDir, baseSide(activeSide, t.path))
|
|
36517
|
+
);
|
|
36518
|
+
} catch {
|
|
36519
|
+
failures.push(t.path);
|
|
36520
|
+
}
|
|
36521
|
+
}
|
|
36522
|
+
if (failures.length > 0) {
|
|
36523
|
+
throw new Error(
|
|
36524
|
+
`${failures.length}/${targets.length} \u9879\u79FB\u52A8\u5931\u8D25\uFF1A${failures[0]}`
|
|
36525
|
+
);
|
|
36526
|
+
}
|
|
36527
|
+
},
|
|
36528
|
+
activeSide
|
|
36529
|
+
);
|
|
36530
|
+
} else {
|
|
36531
|
+
const first = targets[0];
|
|
36532
|
+
if (targets.length === 1 && first) {
|
|
36533
|
+
const from = first.path;
|
|
36534
|
+
void runOp(
|
|
36535
|
+
"\u5DF2\u6539\u540D/\u79FB\u52A8",
|
|
36536
|
+
() => workspace.rename(activeSide, from, resolveSide(activeSide, pane.path, value)),
|
|
36537
|
+
activeSide
|
|
36538
|
+
);
|
|
36539
|
+
}
|
|
36540
|
+
}
|
|
36541
|
+
}
|
|
36542
|
+
return;
|
|
36543
|
+
}
|
|
36544
|
+
if (key.backspace || key.delete) {
|
|
36545
|
+
setField((v) => v.slice(0, -1));
|
|
36546
|
+
return;
|
|
36547
|
+
}
|
|
36548
|
+
if (key.tab) return;
|
|
36549
|
+
const clean = sanitizeInput(input);
|
|
36550
|
+
if (clean) setField((v) => v + clean);
|
|
36551
|
+
return;
|
|
36552
|
+
}
|
|
36553
|
+
if (mode.name === "pathTransfer") {
|
|
36554
|
+
if (key.escape) {
|
|
36555
|
+
setMode({ name: "none" });
|
|
36556
|
+
return;
|
|
36557
|
+
}
|
|
36558
|
+
if (key.tab || key.upArrow || key.downArrow) {
|
|
36559
|
+
const delta = key.upArrow ? -1 : 1;
|
|
36560
|
+
setMode({ name: "pathTransfer", field: (mode.field + delta + 3) % 3 });
|
|
36561
|
+
return;
|
|
36562
|
+
}
|
|
36563
|
+
if (mode.field === 0) {
|
|
36564
|
+
if (key.return) {
|
|
36565
|
+
submitPathForm();
|
|
36566
|
+
return;
|
|
36567
|
+
}
|
|
36568
|
+
if (key.leftArrow || key.rightArrow) {
|
|
36569
|
+
setPathForm((v) => ({
|
|
36570
|
+
...v,
|
|
36571
|
+
direction: v.direction === "upload" ? "download" : "upload"
|
|
36572
|
+
}));
|
|
36573
|
+
return;
|
|
36574
|
+
}
|
|
36575
|
+
if (input === "u" || input === "d") {
|
|
36576
|
+
setPathForm((v) => ({ ...v, direction: input === "u" ? "upload" : "download" }));
|
|
36577
|
+
return;
|
|
36578
|
+
}
|
|
36579
|
+
if (input === "s") {
|
|
36580
|
+
setPathForm((v) => ({ ...v, sync: !v.sync }));
|
|
36581
|
+
return;
|
|
36582
|
+
}
|
|
36583
|
+
if (input === "c") {
|
|
36584
|
+
setPathForm((v) => ({ ...v, checksum: !v.checksum }));
|
|
36585
|
+
return;
|
|
36586
|
+
}
|
|
36587
|
+
return;
|
|
36588
|
+
}
|
|
36589
|
+
if (key.return) {
|
|
36590
|
+
submitPathForm();
|
|
36591
|
+
return;
|
|
36592
|
+
}
|
|
36593
|
+
if (key.backspace || key.delete) {
|
|
36594
|
+
const f = mode.field;
|
|
36595
|
+
setPathForm(
|
|
36596
|
+
(v) => f === 1 ? { ...v, source: v.source.slice(0, -1) } : { ...v, dest: v.dest.slice(0, -1) }
|
|
36597
|
+
);
|
|
36598
|
+
return;
|
|
36599
|
+
}
|
|
36600
|
+
if (key.leftArrow || key.rightArrow) return;
|
|
36601
|
+
const clean = sanitizeInput(input);
|
|
36602
|
+
if (clean) {
|
|
36603
|
+
const f = mode.field;
|
|
36604
|
+
if (f === 1) setPathForm((v) => ({ ...v, source: v.source + clean }));
|
|
36605
|
+
else setPathForm((v) => ({ ...v, dest: v.dest + clean }));
|
|
36606
|
+
}
|
|
36607
|
+
return;
|
|
36608
|
+
}
|
|
36609
|
+
if (mode.name === "delete") {
|
|
36610
|
+
if (key.leftArrow || key.rightArrow || key.tab || input === "h" || input === "l") {
|
|
36611
|
+
setConfirmYes((v) => !v);
|
|
36612
|
+
return;
|
|
36613
|
+
}
|
|
36614
|
+
if (key.return) {
|
|
36615
|
+
if (!confirmYes) {
|
|
36616
|
+
setMode({ name: "none" });
|
|
36617
|
+
return;
|
|
36618
|
+
}
|
|
36619
|
+
doDelete();
|
|
36620
|
+
return;
|
|
36621
|
+
}
|
|
36622
|
+
if (key.escape || input === "q" || input === "n") {
|
|
36623
|
+
setMode({ name: "none" });
|
|
36624
|
+
setConfirmYes(false);
|
|
36625
|
+
return;
|
|
36626
|
+
}
|
|
36627
|
+
if (input === "y") {
|
|
36628
|
+
doDelete();
|
|
36629
|
+
return;
|
|
36630
|
+
}
|
|
36631
|
+
return;
|
|
36632
|
+
}
|
|
36633
|
+
if (mode.name === "transfer") {
|
|
36634
|
+
if (key.escape || input === "q") {
|
|
36635
|
+
setMode({ name: "none" });
|
|
36636
|
+
setPending(null);
|
|
36637
|
+
return;
|
|
36638
|
+
}
|
|
36639
|
+
if (key.return || input === "y") {
|
|
36640
|
+
submitTransfer(syncDefault, checksumDefault);
|
|
36641
|
+
return;
|
|
36642
|
+
}
|
|
36643
|
+
if (input === "s") {
|
|
36644
|
+
setSyncDefault((v) => !v);
|
|
36645
|
+
return;
|
|
36646
|
+
}
|
|
36647
|
+
if (input === "c") {
|
|
36648
|
+
setChecksumDefault((v) => !v);
|
|
36649
|
+
return;
|
|
36650
|
+
}
|
|
36651
|
+
return;
|
|
36652
|
+
}
|
|
36653
|
+
if (key.tab) {
|
|
36654
|
+
setActiveSide((v) => v === "local" ? "remote" : "local");
|
|
36655
|
+
return;
|
|
36656
|
+
}
|
|
36657
|
+
if (key.upArrow || input === "k") {
|
|
36658
|
+
setPaneCursor(activeSide, (v) => Math.max(0, v - 1));
|
|
36659
|
+
return;
|
|
36660
|
+
}
|
|
36661
|
+
if (key.downArrow || input === "j") {
|
|
36662
|
+
setPaneCursor(activeSide, (v) => Math.max(0, Math.min(pane.entries.length - 1, v + 1)));
|
|
36663
|
+
return;
|
|
36664
|
+
}
|
|
36665
|
+
if (key.return || key.rightArrow || input === "l") {
|
|
36666
|
+
if (cursorEntry?.kind === "directory") loadPane(activeSide, cursorEntry.path);
|
|
36667
|
+
else if (cursorEntry) flash("\u6587\u4EF6\u4E0D\u80FD\u8FDB\u5165\uFF1Au \u4F20\u8F93 \xB7 r \u6539\u540D \xB7 x \u5220\u9664");
|
|
36668
|
+
return;
|
|
36669
|
+
}
|
|
36670
|
+
if (key.leftArrow || key.backspace || key.delete || input === "h") {
|
|
36671
|
+
const parent = parentSide(activeSide, pane.path);
|
|
36672
|
+
if (parent !== pane.path) loadPane(activeSide, parent);
|
|
36673
|
+
return;
|
|
36674
|
+
}
|
|
36675
|
+
if (input === " ") {
|
|
36676
|
+
if (!cursorEntry) return;
|
|
36677
|
+
const p = cursorEntry.path;
|
|
36678
|
+
updatePaneChecked(
|
|
36679
|
+
activeSide,
|
|
36680
|
+
(checked) => checked.includes(p) ? checked.filter((x) => x !== p) : [...checked, p]
|
|
36681
|
+
);
|
|
36682
|
+
setPaneCursor(activeSide, (v) => Math.min(pane.entries.length - 1, v + 1));
|
|
36683
|
+
return;
|
|
36684
|
+
}
|
|
36685
|
+
if (key.escape || input === "q" || input === "Q") {
|
|
36686
|
+
if (input === "Q") {
|
|
36687
|
+
setTab("queue");
|
|
36688
|
+
return;
|
|
36689
|
+
}
|
|
36690
|
+
onBack();
|
|
36691
|
+
return;
|
|
36692
|
+
}
|
|
36693
|
+
if (input === "a") {
|
|
36694
|
+
updatePaneChecked(
|
|
36695
|
+
activeSide,
|
|
36696
|
+
(checked) => checked.length === pane.entries.length && pane.entries.length > 0 ? [] : pane.entries.map((e) => e.path)
|
|
36697
|
+
);
|
|
36698
|
+
return;
|
|
36699
|
+
}
|
|
36700
|
+
if (input === "r" && cursorEntry) {
|
|
36701
|
+
const multi = selection.length > 1;
|
|
36702
|
+
setField(multi ? pane.path : cursorEntry.path);
|
|
36703
|
+
setMode({ name: "rename", multi });
|
|
36704
|
+
return;
|
|
36705
|
+
}
|
|
36706
|
+
if (input === "g") {
|
|
36707
|
+
setField(pane.path);
|
|
36708
|
+
setMode({ name: "pathNav" });
|
|
36709
|
+
return;
|
|
36710
|
+
}
|
|
36711
|
+
if (input === "m") {
|
|
36712
|
+
setField("");
|
|
36713
|
+
setMode({ name: "mkdir" });
|
|
36714
|
+
return;
|
|
36715
|
+
}
|
|
36716
|
+
if (input === "x") {
|
|
36717
|
+
if (selection.length === 0) {
|
|
36718
|
+
flash("\u6CA1\u6709\u53EF\u5220\u9664\u7684\u9009\u4E2D\u9879");
|
|
36719
|
+
return;
|
|
36720
|
+
}
|
|
36721
|
+
setConfirmYes(false);
|
|
36722
|
+
setMode({ name: "delete" });
|
|
36723
|
+
return;
|
|
36724
|
+
}
|
|
36725
|
+
if (input === "u") {
|
|
36726
|
+
openTransferConfirm();
|
|
36727
|
+
return;
|
|
36728
|
+
}
|
|
36729
|
+
if (input === "p") {
|
|
36730
|
+
setPathForm({
|
|
36731
|
+
direction: activeSide === "local" ? "upload" : "download",
|
|
36732
|
+
source: "",
|
|
36733
|
+
dest: panes[otherSide].path,
|
|
36734
|
+
sync: syncDefault,
|
|
36735
|
+
checksum: checksumDefault
|
|
36736
|
+
});
|
|
36737
|
+
setMode({ name: "pathTransfer", field: 1 });
|
|
36738
|
+
return;
|
|
36739
|
+
}
|
|
36740
|
+
if (input === "s") {
|
|
36741
|
+
setSyncDefault((v) => !v);
|
|
36742
|
+
flash(`\u540C\u6B65\u6A21\u5F0F\uFF1A${!syncDefault ? "\u5F00\uFF08\u76EE\u5F55\u6309\u5927\u5C0F+\u65F6\u95F4\u8DF3\u8FC7\u672A\u53D8\u6587\u4EF6\uFF09" : "\u5173\uFF08\u5168\u90E8\u4F20\u8F93\uFF09"}`);
|
|
36743
|
+
return;
|
|
36744
|
+
}
|
|
36745
|
+
if (input === "c") {
|
|
36746
|
+
setChecksumDefault((v) => !v);
|
|
36747
|
+
flash(`\u5185\u5BB9\u54C8\u5E0C\u6821\u9A8C\uFF1A${!checksumDefault ? "\u5F00" : "\u5173"}`);
|
|
36748
|
+
return;
|
|
36749
|
+
}
|
|
36750
|
+
});
|
|
36751
|
+
const narrow = width < 64;
|
|
36752
|
+
const hintLines = mode.name === "none" ? narrow ? [
|
|
36753
|
+
"Tab \u5207\u4FA7 \xB7 \u2191\u2193 \u79FB\u52A8 \xB7 Enter \u8FDB\u5165",
|
|
36754
|
+
"\u2190 \u8FD4\u56DE \xB7 Space \u591A\u9009 \xB7 a \u5168\u9009",
|
|
36755
|
+
"u \u4F20\u8F93 \xB7 p \u8DEF\u5F84\u76F4\u4F20 \xB7 g \u8DF3\u8F6C",
|
|
36756
|
+
"m \u65B0\u5EFA \xB7 r \u79FB\u52A8 \xB7 x \u5220\u9664",
|
|
36757
|
+
`s \u540C\u6B65[${syncDefault ? "\u5F00" : "\u5173"}] c \u6821\u9A8C[${checksumDefault ? "\u5F00" : "\u5173"}] \xB7 Q \u961F\u5217`,
|
|
36758
|
+
"Esc/q \u8FD4\u56DE"
|
|
36759
|
+
] : [
|
|
36760
|
+
"Tab \u5207\u4FA7 \xB7 \u2191\u2193 \u79FB\u52A8 \xB7 Enter \u8FDB\u5165 \xB7 \u2190 \u8FD4\u56DE \xB7 Space \u591A\u9009 \xB7 a \u5168\u9009",
|
|
36761
|
+
"u \u4F20\u8F93 \xB7 p \u8DEF\u5F84\u76F4\u4F20 \xB7 g \u8DF3\u8F6C \xB7 Q \u961F\u5217 \xB7 Esc/q \u8FD4\u56DE",
|
|
36762
|
+
`m \u65B0\u5EFA \xB7 r \u6539\u540D/\u79FB\u52A8 \xB7 x \u5220\u9664 \xB7 s \u540C\u6B65[${syncDefault ? "\u5F00" : "\u5173"}] c \u6821\u9A8C[${checksumDefault ? "\u5F00" : "\u5173"}]`
|
|
36763
|
+
] : mode.name === "delete" ? ["\u2190\u2192 \u9009\u62E9 \xB7 Enter \u786E\u5B9A \xB7 y \u5220\u9664 \xB7 Esc/q/n \u53D6\u6D88"] : mode.name === "transfer" ? ["Enter/y \u52A0\u5165\u961F\u5217 \xB7 s \u540C\u6B65 \xB7 c \u6821\u9A8C \xB7 Esc/q \u53D6\u6D88"] : ["\u8F93\u5165\u8DEF\u5F84 \xB7 \u232B \u5220\u9664 \xB7 Enter \u786E\u5B9A \xB7 Esc \u53D6\u6D88"];
|
|
36764
|
+
const dialogH = dialogRows(mode, selection.length);
|
|
36765
|
+
const hintCount = hintLines.length;
|
|
36766
|
+
const listRows = Math.max(1, height - 3 - dialogH - (notice ? 1 : 0) - hintCount);
|
|
36767
|
+
const renderPane = (side, paneWidth) => {
|
|
36768
|
+
const p = panes[side];
|
|
36769
|
+
const activePane = side === activeSide && !(narrow && side !== activeSide);
|
|
36770
|
+
const idx = side === activeSide ? cursorIndex : Math.min(p.cursor, Math.max(0, p.entries.length - 1));
|
|
36771
|
+
const nameWidth = Math.max(8, paneWidth - 14);
|
|
36772
|
+
const start = Math.max(0, Math.min(idx, Math.max(0, p.entries.length - listRows)));
|
|
36773
|
+
const shown = p.entries.slice(start, start + listRows);
|
|
36774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", width: paneWidth, flexShrink: 0, children: [
|
|
36775
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { paddingX: 1, children: [
|
|
36776
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { bold: activePane, color: activePane ? "green" : void 0, children: side === "local" ? "\u25B8\u672C\u5730" : "\u25B8\u8FDC\u7A0B" }),
|
|
36777
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { dimColor: true, children: [
|
|
36778
|
+
" ",
|
|
36779
|
+
clip(visible(p.path), Math.max(8, paneWidth - 10))
|
|
36780
|
+
] })
|
|
36781
|
+
] }),
|
|
36782
|
+
p.loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: "\u8BFB\u53D6\u4E2D\u2026" }) }) : p.error ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { color: "red", children: [
|
|
36783
|
+
"\u2716 ",
|
|
36784
|
+
clip(visible(p.error), Math.max(8, paneWidth - 4))
|
|
36785
|
+
] }) }) : p.entries.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: "\u7A7A\u76EE\u5F55" }) }) : shown.map((entry, i) => {
|
|
36786
|
+
const absolute = start + i;
|
|
36787
|
+
const isCursor = side === activeSide && absolute === idx;
|
|
36788
|
+
const checked = p.checked.includes(entry.path);
|
|
36789
|
+
const label = `${checked ? "[\u2713]" : "[ ]"}${isCursor ? "\u203A" : " "}${visible(entry.name)}${kindMark(entry.kind)}`;
|
|
36790
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { children: [
|
|
36791
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { inverse: isCursor, children: clip(label, nameWidth) }),
|
|
36792
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { dimColor: true, children: [
|
|
36793
|
+
" ",
|
|
36794
|
+
entry.kind === "directory" ? "-" : formatBytes(entry.size)
|
|
36795
|
+
] }),
|
|
36796
|
+
entry.kind === "symlink" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: "yellow", children: " \u8DF3\u8FC7" }) : null
|
|
36797
|
+
] }) }, entry.path);
|
|
36798
|
+
}),
|
|
36799
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { dimColor: true, children: [
|
|
36800
|
+
p.entries.length > listRows ? `${idx + 1}/` : "",
|
|
36801
|
+
p.entries.length,
|
|
36802
|
+
" \u9879",
|
|
36803
|
+
p.checked.length > 0 ? ` \xB7 \u5DF2\u9009 ${p.checked.length}` : "",
|
|
36804
|
+
p.entries.some((e) => e.kind === "symlink") ? " \xB7 @\u7B26\u53F7\u94FE\u63A5\u5C06\u8DF3\u8FC7" : ""
|
|
36805
|
+
] }) })
|
|
36806
|
+
] });
|
|
36807
|
+
};
|
|
36808
|
+
const renderDialog = () => {
|
|
36809
|
+
const inner = Math.max(10, width - 4);
|
|
36810
|
+
if (mode.name === "pathNav") {
|
|
36811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, borderStyle: "round", borderColor: "cyan", children: [
|
|
36812
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { children: [
|
|
36813
|
+
"\u8DF3\u8F6C\uFF08",
|
|
36814
|
+
activeSide === "local" ? "\u672C\u5730" : "\u8FDC\u7A0B",
|
|
36815
|
+
"\uFF09\uFF1A",
|
|
36816
|
+
clip(visible(field), inner - 8),
|
|
36817
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: "\u2588" })
|
|
36818
|
+
] }),
|
|
36819
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: "\u76F8\u5BF9\u8DEF\u5F84\u4EE5\u672C\u4FA7\u5F53\u524D\u76EE\u5F55\u4E3A\u57FA\u51C6 \xB7 Enter \u8DF3\u8F6C \xB7 Esc \u53D6\u6D88" })
|
|
36820
|
+
] });
|
|
36821
|
+
}
|
|
36822
|
+
if (mode.name === "mkdir") {
|
|
36823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, borderStyle: "round", borderColor: "cyan", children: [
|
|
36824
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { children: [
|
|
36825
|
+
"\u5728 ",
|
|
36826
|
+
clip(visible(pane.path), Math.max(8, inner - 24)),
|
|
36827
|
+
" \u4E0B\u65B0\u5EFA\u76EE\u5F55\uFF1A",
|
|
36828
|
+
clip(visible(field), Math.max(8, inner - 24)),
|
|
36829
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: "\u2588" })
|
|
36830
|
+
] }),
|
|
36831
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: "\u76F8\u5BF9\u540D\u5EFA\u4E8E\u5F53\u524D\u76EE\u5F55\uFF0C\u7EDD\u5BF9\u8DEF\u5F84\u4EA6\u53EF \xB7 Enter \u521B\u5EFA \xB7 Esc \u53D6\u6D88" })
|
|
36832
|
+
] });
|
|
36833
|
+
}
|
|
36834
|
+
if (mode.name === "rename") {
|
|
36835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, borderStyle: "round", borderColor: "cyan", children: [
|
|
36836
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { children: [
|
|
36837
|
+
mode.multi ? `\u79FB\u52A8 ${selection.length} \u9879\u5230\u76EE\u5F55\uFF1A` : "\u6539\u540D/\u79FB\u52A8\u4E3A\uFF1A",
|
|
36838
|
+
clip(visible(field), inner - 8),
|
|
36839
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: "\u2588" })
|
|
36840
|
+
] }),
|
|
36841
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: "\u76F8\u5BF9\u8DEF\u5F84\u4EE5\u5F53\u524D\u76EE\u5F55\u4E3A\u57FA\u51C6 \xB7 Enter \u786E\u5B9A \xB7 Esc \u53D6\u6D88" })
|
|
36842
|
+
] });
|
|
36843
|
+
}
|
|
36844
|
+
if (mode.name === "delete") {
|
|
36845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, borderStyle: "round", borderColor: "red", children: [
|
|
36846
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { bold: true, color: "red", children: [
|
|
36847
|
+
"\u6C38\u4E45\u5220\u9664 ",
|
|
36848
|
+
selection.length,
|
|
36849
|
+
" \u9879\uFF08\u9012\u5F52\uFF0C\u4E0D\u53EF\u6062\u590D\uFF09\uFF1A"
|
|
36850
|
+
] }),
|
|
36851
|
+
selection.slice(0, 3).map((e) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { dimColor: true, children: [
|
|
36852
|
+
"\xB7 ",
|
|
36853
|
+
clip(visible(e.path), inner - 4)
|
|
36854
|
+
] }, e.path)),
|
|
36855
|
+
selection.length > 3 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { dimColor: true, children: [
|
|
36856
|
+
"\xB7 \u2026\u53E6 ",
|
|
36857
|
+
selection.length - 3,
|
|
36858
|
+
" \u9879"
|
|
36859
|
+
] }) : null,
|
|
36860
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { children: [
|
|
36861
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { inverse: !confirmYes, children: " \u53D6\u6D88 " }),
|
|
36862
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { children: " " }),
|
|
36863
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { inverse: confirmYes, color: confirmYes ? "red" : void 0, children: " \u5220\u9664 " })
|
|
36864
|
+
] }),
|
|
36865
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: "\u2190\u2192 \u5207\u6362 \xB7 Enter \u786E\u5B9A \xB7 y \u76F4\u63A5\u5220 \xB7 Esc/q/n \u53D6\u6D88" })
|
|
36866
|
+
] });
|
|
36867
|
+
}
|
|
36868
|
+
if (mode.name === "transfer" && pending) {
|
|
36869
|
+
const hasSymlink = pending.kinds.some((k) => k === "symlink");
|
|
36870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, borderStyle: "round", borderColor: "cyan", children: [
|
|
36871
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { bold: true, children: [
|
|
36872
|
+
directionText(pending.direction),
|
|
36873
|
+
" ",
|
|
36874
|
+
pending.sources.length,
|
|
36875
|
+
" \u9879 \u2192",
|
|
36876
|
+
" ",
|
|
36877
|
+
clip(visible(pending.destDir), inner - 16)
|
|
36878
|
+
] }),
|
|
36879
|
+
pending.sources.slice(0, 2).map((s) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { dimColor: true, children: [
|
|
36880
|
+
"\xB7 ",
|
|
36881
|
+
clip(visible(s), inner - 4)
|
|
36882
|
+
] }, s)),
|
|
36883
|
+
pending.sources.length > 2 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { dimColor: true, children: [
|
|
36884
|
+
"\xB7 \u2026\u53E6 ",
|
|
36885
|
+
pending.sources.length - 2,
|
|
36886
|
+
" \u9879"
|
|
36887
|
+
] }) : null,
|
|
36888
|
+
hasSymlink ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: "yellow", children: "\u7B26\u53F7\u94FE\u63A5\u5C06\u88AB\u8DF3\u8FC7\u5E76\u8BA1\u5165\u7ED3\u679C\u3002" }) : null,
|
|
36889
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { dimColor: true, children: [
|
|
36890
|
+
"s \u540C\u6B65[",
|
|
36891
|
+
syncDefault ? "\u2713" : " ",
|
|
36892
|
+
"] c \u54C8\u5E0C\u6821\u9A8C[",
|
|
36893
|
+
checksumDefault ? "\u2713" : " ",
|
|
36894
|
+
"] \xB7 Enter \u52A0\u5165\u961F\u5217 \xB7 Esc \u53D6\u6D88"
|
|
36895
|
+
] })
|
|
36896
|
+
] });
|
|
36897
|
+
}
|
|
36898
|
+
if (mode.name === "pathTransfer") {
|
|
36899
|
+
const f = mode.field;
|
|
36900
|
+
const marker = (i) => f === i ? "\u203A" : " ";
|
|
36901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, borderStyle: "round", borderColor: "cyan", children: [
|
|
36902
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { bold: true, children: "\u6309\u8DEF\u5F84\u76F4\u63A5\u4F20\u8F93" }),
|
|
36903
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { children: [
|
|
36904
|
+
marker(0),
|
|
36905
|
+
"\u65B9\u5411\uFF1A",
|
|
36906
|
+
directionText(pathForm.direction),
|
|
36907
|
+
"\uFF08\u2190\u2192/u/d \u5207\u6362\uFF09"
|
|
36908
|
+
] }),
|
|
36909
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { children: [
|
|
36910
|
+
marker(1),
|
|
36911
|
+
"\u6765\u6E90\uFF1A",
|
|
36912
|
+
clip(visible(pathForm.source), inner - 8),
|
|
36913
|
+
f === 1 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: "\u2588" }) : null
|
|
36914
|
+
] }),
|
|
36915
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { children: [
|
|
36916
|
+
marker(2),
|
|
36917
|
+
"\u76EE\u6807\uFF1A",
|
|
36918
|
+
clip(visible(pathForm.dest), inner - 8),
|
|
36919
|
+
f === 2 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: "\u2588" }) : null
|
|
36920
|
+
] }),
|
|
36921
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { dimColor: true, children: [
|
|
36922
|
+
"\u6765\u6E90\u76F8\u5BF9\u53D1\u8D77\u4FA7\u5F53\u524D\u76EE\u5F55\uFF0C\u76EE\u6807\u76F8\u5BF9\u63A5\u6536\u4FA7\u5F53\u524D\u76EE\u5F55 \xB7 Tab/\u2191\u2193 \u6362\u884C \xB7",
|
|
36923
|
+
" ",
|
|
36924
|
+
f === 0 ? "s \u540C\u6B65 c \u6821\u9A8C \xB7 " : "",
|
|
36925
|
+
"Enter \u63D0\u4EA4 \xB7 Esc \u53D6\u6D88"
|
|
36926
|
+
] })
|
|
36927
|
+
] });
|
|
36928
|
+
}
|
|
36929
|
+
return null;
|
|
36930
|
+
};
|
|
36931
|
+
if (tab2 === "queue") {
|
|
36932
|
+
const clamped = Math.min(queueCursor, Math.max(0, jobs.length - 1));
|
|
36933
|
+
const selected = jobs[clamped];
|
|
36934
|
+
const detail = detailRows(selected, queueDetail, skippedOpen, skippedIndex);
|
|
36935
|
+
const queueListRows = Math.max(1, height - 4 - detail - (notice ? 1 : 0));
|
|
36936
|
+
const ui = {
|
|
36937
|
+
jobs,
|
|
36938
|
+
cursor: clamped,
|
|
36939
|
+
setCursor: setQueueCursor,
|
|
36940
|
+
showDetail: queueDetail,
|
|
36941
|
+
setShowDetail: setQueueDetail,
|
|
36942
|
+
skippedOpen,
|
|
36943
|
+
setSkippedOpen,
|
|
36944
|
+
skippedIndex,
|
|
36945
|
+
setSkippedIndex,
|
|
36946
|
+
applyAll,
|
|
36947
|
+
setApplyAll,
|
|
36948
|
+
resume,
|
|
36949
|
+
flash,
|
|
36950
|
+
width,
|
|
36951
|
+
listRows: queueListRows
|
|
36952
|
+
};
|
|
36953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", width, height, overflow: "hidden", children: [
|
|
36954
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { paddingX: 1, children: [
|
|
36955
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { bold: true, children: "\u6587\u4EF6" }),
|
|
36956
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { dimColor: true, children: [
|
|
36957
|
+
clip(visible(uuid), 12),
|
|
36958
|
+
" \xB7 \u6D4F\u89C8\u5668 | \u961F\u5217(",
|
|
36959
|
+
jobs.length,
|
|
36960
|
+
")",
|
|
36961
|
+
jobs.length > 0 ? ` \xB7 ${clamped + 1}/${jobs.length}` : ""
|
|
36962
|
+
] })
|
|
36963
|
+
] }),
|
|
36964
|
+
renderQueueBody(ui),
|
|
36965
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { flexGrow: 1 }),
|
|
36966
|
+
notice ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: "cyan", children: clip(visible(notice), Math.max(10, width - 2)) }) }) : null,
|
|
36967
|
+
queueHints(selected, skippedOpen).map((hint) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, wrap: "truncate", children: fitLine(hint, Math.max(10, width - 2)) }) }, hint)),
|
|
36968
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: clip("Q/Esc \u8FD4\u56DE\u6D4F\u89C8\u5668", Math.max(10, width - 2)) }) })
|
|
36969
|
+
] });
|
|
36970
|
+
}
|
|
36971
|
+
const half = Math.max(20, Math.floor((width - 1) / 2));
|
|
36972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", width, height, overflow: "hidden", children: [
|
|
36973
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { bold: true, wrap: "truncate", children: [
|
|
36974
|
+
"\u6587\u4EF6 \xB7 ",
|
|
36975
|
+
narrow ? activeSide === "local" ? "\u672C\u5730" : "\u8FDC\u7A0B" : "\u672C\u5730 / \u8FDC\u7A0B",
|
|
36976
|
+
" \xB7 Q \u961F\u5217(",
|
|
36977
|
+
jobs.length,
|
|
36978
|
+
")",
|
|
36979
|
+
busy ? " \xB7 \u5904\u7406\u4E2D\u2026" : ""
|
|
36980
|
+
] }) }),
|
|
36981
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { flexDirection: "row", children: narrow ? renderPane(activeSide, Math.max(20, width - 2)) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
36982
|
+
renderPane("local", half),
|
|
36983
|
+
renderPane("remote", width - 1 - half)
|
|
36984
|
+
] }) }),
|
|
36985
|
+
renderDialog(),
|
|
36986
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { flexGrow: 1 }),
|
|
36987
|
+
notice ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: "cyan", children: clip(visible(notice), Math.max(10, width - 2)) }) }) : null,
|
|
36988
|
+
hintLines.map((hint) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: clip(hint, Math.max(10, width - 2)) }) }, hint))
|
|
36989
|
+
] });
|
|
36990
|
+
}
|
|
36991
|
+
|
|
35587
36992
|
// src/tui/screens/login.tsx
|
|
35588
|
-
var
|
|
36993
|
+
var import_react39 = __toESM(require_react(), 1);
|
|
35589
36994
|
|
|
35590
36995
|
// src/tui/useTerminalSize.ts
|
|
35591
|
-
var
|
|
36996
|
+
var import_react38 = __toESM(require_react(), 1);
|
|
35592
36997
|
function useTerminalSize() {
|
|
35593
36998
|
const { stdout } = use_stdout_default();
|
|
35594
36999
|
const read = () => ({
|
|
35595
37000
|
columns: stdout?.columns || 80,
|
|
35596
37001
|
rows: stdout?.rows || 24
|
|
35597
37002
|
});
|
|
35598
|
-
const [size, setSize] = (0,
|
|
35599
|
-
(0,
|
|
37003
|
+
const [size, setSize] = (0, import_react38.useState)(read);
|
|
37004
|
+
(0, import_react38.useEffect)(() => {
|
|
35600
37005
|
if (!stdout) return;
|
|
35601
37006
|
const onResize = () => setSize({ columns: stdout.columns || 80, rows: stdout.rows || 24 });
|
|
35602
37007
|
stdout.on("resize", onResize);
|
|
@@ -35609,7 +37014,7 @@ function useTerminalSize() {
|
|
|
35609
37014
|
}
|
|
35610
37015
|
|
|
35611
37016
|
// src/tui/screens/login.tsx
|
|
35612
|
-
var
|
|
37017
|
+
var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
|
|
35613
37018
|
function sanitize(input) {
|
|
35614
37019
|
let out = "";
|
|
35615
37020
|
for (const char of input) {
|
|
@@ -35626,10 +37031,11 @@ function Login({
|
|
|
35626
37031
|
notice
|
|
35627
37032
|
}) {
|
|
35628
37033
|
const { columns: columns2, rows } = useTerminalSize();
|
|
35629
|
-
const [stage, setStage] = (0,
|
|
35630
|
-
const [choice, setChoice] = (0,
|
|
35631
|
-
const [token, setToken] = (0,
|
|
37034
|
+
const [stage, setStage] = (0, import_react39.useState)("menu");
|
|
37035
|
+
const [choice, setChoice] = (0, import_react39.useState)(0);
|
|
37036
|
+
const [token, setToken] = (0, import_react39.useState)("");
|
|
35632
37037
|
use_input_default((input, key) => {
|
|
37038
|
+
if (key.ctrl && input.toLowerCase() === "c") return onQuit();
|
|
35633
37039
|
if (verifying) return;
|
|
35634
37040
|
if (stage === "menu") {
|
|
35635
37041
|
if (key.upArrow || key.downArrow || input === "j" || input === "k") {
|
|
@@ -35660,37 +37066,37 @@ function Login({
|
|
|
35660
37066
|
const clean = sanitize(input);
|
|
35661
37067
|
if (clean) setToken((v) => v + clean);
|
|
35662
37068
|
});
|
|
35663
|
-
return /* @__PURE__ */ (0,
|
|
35664
|
-
/* @__PURE__ */ (0,
|
|
35665
|
-
/* @__PURE__ */ (0,
|
|
35666
|
-
stage === "menu" ? /* @__PURE__ */ (0,
|
|
35667
|
-
notice ? /* @__PURE__ */ (0,
|
|
35668
|
-
/* @__PURE__ */ (0,
|
|
35669
|
-
/* @__PURE__ */ (0,
|
|
37069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", height: rows, width: columns2, children: [
|
|
37070
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BrandMark, { subtitle: "\u767B\u5165", columns: columns2 }),
|
|
37071
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [
|
|
37072
|
+
stage === "menu" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
37073
|
+
notice ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { color: "yellow", children: notice }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { dimColor: true, children: "\u5C1A\u672A\u914D\u7F6E\u5F00\u53D1\u8005 Token\uFF0C\u8BF7\u5148\u767B\u5165\u3002" }),
|
|
37074
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
37075
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { inverse: choice === 0, children: [
|
|
35670
37076
|
choice === 0 ? "\u203A " : " ",
|
|
35671
37077
|
"\u914D\u7F6E Token \u767B\u5165"
|
|
35672
37078
|
] }),
|
|
35673
|
-
/* @__PURE__ */ (0,
|
|
37079
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { inverse: choice === 1, children: [
|
|
35674
37080
|
choice === 1 ? "\u203A " : " ",
|
|
35675
37081
|
"\u9000\u51FA"
|
|
35676
37082
|
] })
|
|
35677
37083
|
] }),
|
|
35678
|
-
/* @__PURE__ */ (0,
|
|
35679
|
-
] }) : /* @__PURE__ */ (0,
|
|
35680
|
-
/* @__PURE__ */ (0,
|
|
35681
|
-
/* @__PURE__ */ (0,
|
|
35682
|
-
/* @__PURE__ */ (0,
|
|
35683
|
-
/* @__PURE__ */ (0,
|
|
35684
|
-
/* @__PURE__ */ (0,
|
|
35685
|
-
/* @__PURE__ */ (0,
|
|
37084
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { dimColor: true, children: "\u2191\u2193 \u9009\u62E9 \xB7 Enter \u786E\u5B9A \xB7 q \u9000\u51FA" }) })
|
|
37085
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
37086
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { dimColor: true, children: "\u7C98\u8D34\u4F60\u7684\u5F00\u53D1\u8005 Token\uFF1A" }),
|
|
37087
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { dimColor: true, children: "AutoDL \u63A7\u5236\u53F0 \u2192 \u8BBE\u7F6E \u2192 \u5F00\u53D1\u8005 Token\uFF08\u9700\u5148\u5B8C\u6210\u5B9E\u540D\u8BA4\u8BC1\uFF09" }),
|
|
37088
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { marginTop: 1, children: [
|
|
37089
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { children: "\u203A " }),
|
|
37090
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { color: "green", children: token ? "\u2022".repeat(Math.min(token.length, 48)) : "" }),
|
|
37091
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { dimColor: true, children: token ? ` (${token.length} \u5B57\u7B26)` : "\u7B49\u5F85\u8F93\u5165\u2026" })
|
|
35686
37092
|
] }),
|
|
35687
|
-
/* @__PURE__ */ (0,
|
|
37093
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { dimColor: true, children: verifying ? "\u6B63\u5728\u9A8C\u8BC1\u2026" : "Enter \u9A8C\u8BC1\u5E76\u4FDD\u5B58 \xB7 Esc \u8FD4\u56DE \xB7 \u652F\u6301\u76F4\u63A5\u7C98\u8D34" }) })
|
|
35688
37094
|
] }),
|
|
35689
|
-
error ? /* @__PURE__ */ (0,
|
|
37095
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { color: "red", children: [
|
|
35690
37096
|
"\u2716 ",
|
|
35691
37097
|
error
|
|
35692
37098
|
] }) }) : null,
|
|
35693
|
-
/* @__PURE__ */ (0,
|
|
37099
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { dimColor: true, children: [
|
|
35694
37100
|
"\u9A8C\u8BC1\u901A\u8FC7\u540E\u4F1A\u4FDD\u5B58\u5230 ",
|
|
35695
37101
|
configPath(),
|
|
35696
37102
|
"\uFF08\u6743\u9650 0600\uFF09"
|
|
@@ -35700,7 +37106,7 @@ function Login({
|
|
|
35700
37106
|
}
|
|
35701
37107
|
|
|
35702
37108
|
// src/tui/screens/stock.tsx
|
|
35703
|
-
var
|
|
37109
|
+
var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
|
|
35704
37110
|
function toStockRows(snapshots, showEmpty) {
|
|
35705
37111
|
const rentable = new Map(GPU_SPECS.map((spec) => [spec.stockName, spec.id]));
|
|
35706
37112
|
const proRegions = new Set(PRO_CREATE_REGIONS.map((region) => region.id));
|
|
@@ -35726,7 +37132,7 @@ var columns = [
|
|
|
35726
37132
|
header: "\u53EF\u5EFAPro",
|
|
35727
37133
|
width: 8,
|
|
35728
37134
|
text: (row) => row.proCreate ? "\u662F" : "\u5426",
|
|
35729
|
-
render: (row) => row.proCreate ? /* @__PURE__ */ (0,
|
|
37135
|
+
render: (row) => row.proCreate ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { color: "green", children: "\u662F" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { dimColor: true, children: "\u5426" })
|
|
35730
37136
|
},
|
|
35731
37137
|
{
|
|
35732
37138
|
header: "GPU",
|
|
@@ -35737,19 +37143,19 @@ var columns = [
|
|
|
35737
37143
|
header: "\u53EF\u79DF\u89C4\u683C",
|
|
35738
37144
|
width: 12,
|
|
35739
37145
|
text: (row) => row.gpuSpec ?? "\u2014",
|
|
35740
|
-
render: (row, clipped) => row.gpuSpec ? /* @__PURE__ */ (0,
|
|
37146
|
+
render: (row, clipped) => row.gpuSpec ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { color: "green", children: clipped }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { dimColor: true, children: clipped })
|
|
35741
37147
|
},
|
|
35742
37148
|
{
|
|
35743
37149
|
header: "\u7A7A\u95F2",
|
|
35744
37150
|
width: 7,
|
|
35745
37151
|
text: (row) => String(row.idle),
|
|
35746
|
-
render: (row, clipped) => /* @__PURE__ */ (0,
|
|
37152
|
+
render: (row, clipped) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { bold: row.idle > 0, children: clipped })
|
|
35747
37153
|
},
|
|
35748
37154
|
{
|
|
35749
37155
|
header: "\u603B\u6570",
|
|
35750
37156
|
width: 7,
|
|
35751
37157
|
text: (row) => String(row.total),
|
|
35752
|
-
render: (_row, clipped) => /* @__PURE__ */ (0,
|
|
37158
|
+
render: (_row, clipped) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { dimColor: true, children: clipped })
|
|
35753
37159
|
}
|
|
35754
37160
|
];
|
|
35755
37161
|
function StockScreen({
|
|
@@ -35757,8 +37163,8 @@ function StockScreen({
|
|
|
35757
37163
|
selectedIndex,
|
|
35758
37164
|
loading
|
|
35759
37165
|
}) {
|
|
35760
|
-
return /* @__PURE__ */ (0,
|
|
35761
|
-
/* @__PURE__ */ (0,
|
|
37166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
37167
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
35762
37168
|
Table,
|
|
35763
37169
|
{
|
|
35764
37170
|
columns,
|
|
@@ -35768,27 +37174,29 @@ function StockScreen({
|
|
|
35768
37174
|
emptyMessage: loading ? "\u6B63\u5728\u67E5\u8BE2\u5E93\u5B58\u2026" : "\u67E5\u8BE2\u8303\u56F4\u5185\u6CA1\u6709\u7A7A\u95F2 GPU"
|
|
35769
37175
|
}
|
|
35770
37176
|
),
|
|
35771
|
-
/* @__PURE__ */ (0,
|
|
35772
|
-
/* @__PURE__ */ (0,
|
|
37177
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
|
|
37178
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Text, { dimColor: true, children: [
|
|
35773
37179
|
"\u300C\u53EF\u5EFAPro\u300D\u53EA\u6709 ",
|
|
35774
37180
|
PRO_CREATE_REGIONS.map((r) => r.displayName).join(" / "),
|
|
35775
37181
|
" \u4E3A\u662F\uFF0C \u5176\u4F59\u5730\u533A\u4EC5\u7528\u4E8E\u5F39\u6027\u90E8\u7F72\u3002"
|
|
35776
37182
|
] }),
|
|
35777
|
-
/* @__PURE__ */ (0,
|
|
37183
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { color: "yellow", children: "\u6570\u5B57\u6765\u81EA\u300C\u5F39\u6027\u90E8\u7F72 GPU \u5E93\u5B58\u300D\uFF0C\u4E0D\u4EE3\u8868 Pro \u5B9E\u4F8B\u53EF\u7528\u91CF\u2014\u2014\u5B9E\u6D4B\u51FA\u73B0\u8FC7\u663E\u793A 140 \u5F20\u7A7A\u95F2\u3001\u521B\u5EFA\u5374\u63D0\u793A\u6682\u65E0\u5E93\u5B58\u7684\u60C5\u51B5\u3002" })
|
|
35778
37184
|
] })
|
|
35779
37185
|
] });
|
|
35780
37186
|
}
|
|
35781
37187
|
|
|
35782
37188
|
// src/tui/app.tsx
|
|
35783
|
-
var
|
|
37189
|
+
var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
|
|
35784
37190
|
var SCREEN_TITLES = {
|
|
35785
37191
|
dashboard: "\u5B9E\u4F8B\u770B\u677F",
|
|
35786
37192
|
detail: "\u5B9E\u4F8B\u8BE6\u60C5",
|
|
35787
37193
|
stock: "GPU \u5E93\u5B58",
|
|
35788
37194
|
create: "\u65B0\u5EFA\u5B9E\u4F8B",
|
|
35789
|
-
help: "\u5FEB\u6377\u952E"
|
|
37195
|
+
help: "\u5FEB\u6377\u952E",
|
|
37196
|
+
files: "\u6587\u4EF6\u7BA1\u7406",
|
|
37197
|
+
transfers: "\u4F20\u8F93\u961F\u5217"
|
|
35790
37198
|
};
|
|
35791
|
-
var DASHBOARD_KEYS = "\u2191\u2193 \u79FB\u52A8 \xB7 Enter \u8BE6\u60C5 \xB7 s \u5F00\u673A \xB7 x \u5173\u673A \xB7
|
|
37199
|
+
var DASHBOARD_KEYS = "\u2191\u2193 \u79FB\u52A8 \xB7 Enter \u8BE6\u60C5 \xB7 s \u5F00\u673A \xB7 x \u5173\u673A \xB7 ctrl+d \u91CA\u653E \xB7 g \u5E93\u5B58 \xB7 r \u5237\u65B0 \xB7 ctrl+l \u9000\u51FA\u767B\u5F55 \xB7 ? \u5E2E\u52A9 \xB7 q \u9000\u51FA";
|
|
35792
37200
|
var isCtrl = (input, key, letter) => key.ctrl && input.toLowerCase() === letter;
|
|
35793
37201
|
var HELP_COLUMNS = ((items) => {
|
|
35794
37202
|
const half = Math.ceil(items.length / 2);
|
|
@@ -35798,25 +37206,35 @@ function App2({
|
|
|
35798
37206
|
client,
|
|
35799
37207
|
token,
|
|
35800
37208
|
tokenSource,
|
|
35801
|
-
onLogout
|
|
37209
|
+
onLogout,
|
|
37210
|
+
baseUrl
|
|
35802
37211
|
}) {
|
|
35803
|
-
const { exit } = use_app_default();
|
|
35804
|
-
const [view, setView] = (0,
|
|
35805
|
-
const [selected, setSelected] = (0,
|
|
35806
|
-
const [notice, setNotice] = (0,
|
|
35807
|
-
const [pending, setPending] = (0,
|
|
35808
|
-
const [busy, setBusy] = (0,
|
|
35809
|
-
const [reveal, setReveal] = (0,
|
|
35810
|
-
const [stock, setStock] = (0,
|
|
35811
|
-
const [stockLoading, setStockLoading] = (0,
|
|
35812
|
-
const [stockIndex, setStockIndex] = (0,
|
|
35813
|
-
const [balance, setBalance] = (0,
|
|
35814
|
-
const [balanceError, setBalanceError] = (0,
|
|
35815
|
-
const [expired, setExpired] = (0,
|
|
35816
|
-
const [
|
|
37212
|
+
const { exit, suspendTerminal } = use_app_default();
|
|
37213
|
+
const [view, setView] = (0, import_react40.useState)("dashboard");
|
|
37214
|
+
const [selected, setSelected] = (0, import_react40.useState)(0);
|
|
37215
|
+
const [notice, setNotice] = (0, import_react40.useState)(null);
|
|
37216
|
+
const [pending, setPending] = (0, import_react40.useState)(null);
|
|
37217
|
+
const [busy, setBusy] = (0, import_react40.useState)(false);
|
|
37218
|
+
const [reveal, setReveal] = (0, import_react40.useState)(false);
|
|
37219
|
+
const [stock, setStock] = (0, import_react40.useState)([]);
|
|
37220
|
+
const [stockLoading, setStockLoading] = (0, import_react40.useState)(false);
|
|
37221
|
+
const [stockIndex, setStockIndex] = (0, import_react40.useState)(0);
|
|
37222
|
+
const [balance, setBalance] = (0, import_react40.useState)(null);
|
|
37223
|
+
const [balanceError, setBalanceError] = (0, import_react40.useState)(null);
|
|
37224
|
+
const [expired, setExpired] = (0, import_react40.useState)(null);
|
|
37225
|
+
const [terminalActive, setTerminalActive] = (0, import_react40.useState)(false);
|
|
37226
|
+
const [workspace, setWorkspace] = (0, import_react40.useState)(null);
|
|
37227
|
+
const [fileUuid, setFileUuid] = (0, import_react40.useState)("");
|
|
37228
|
+
const [fileGate, setFileGate] = (0, import_react40.useState)(void 0);
|
|
37229
|
+
const queueRef = (0, import_react40.useRef)(null);
|
|
37230
|
+
const accessController = (0, import_react40.useRef)(null);
|
|
37231
|
+
const fileUuidRef = (0, import_react40.useRef)("");
|
|
37232
|
+
const queueUnsubscribe = (0, import_react40.useRef)(null);
|
|
37233
|
+
const [queueNotice, setQueueNotice] = (0, import_react40.useState)(null);
|
|
37234
|
+
const [watched, setWatched] = (0, import_react40.useState)(void 0);
|
|
35817
37235
|
const { columns: columns2, rows: terminalRows } = useTerminalSize();
|
|
35818
|
-
const identity = (0,
|
|
35819
|
-
const paused = view === "create" || pending !== null || expired !== null;
|
|
37236
|
+
const identity = (0, import_react40.useMemo)(() => identityFromToken(token), [token]);
|
|
37237
|
+
const paused = view === "create" || pending !== null || expired !== null || terminalActive;
|
|
35820
37238
|
const {
|
|
35821
37239
|
rows,
|
|
35822
37240
|
loading,
|
|
@@ -35828,24 +37246,24 @@ function App2({
|
|
|
35828
37246
|
historyFor,
|
|
35829
37247
|
loadSnapshot
|
|
35830
37248
|
} = useInstances(client, { paused, watch: watched });
|
|
35831
|
-
const noteAuthFailure = (0,
|
|
37249
|
+
const noteAuthFailure = (0, import_react40.useCallback)((err) => {
|
|
35832
37250
|
if (isAuthError(err)) setExpired((current) => current ?? err.message);
|
|
35833
37251
|
}, []);
|
|
35834
|
-
(0,
|
|
37252
|
+
(0, import_react40.useEffect)(() => {
|
|
35835
37253
|
if (authError) setExpired((current) => current ?? authError);
|
|
35836
37254
|
}, [authError]);
|
|
35837
37255
|
const selectedIndex = Math.min(selected, Math.max(0, rows.length - 1));
|
|
35838
37256
|
const row = rows[selectedIndex];
|
|
35839
|
-
(0,
|
|
37257
|
+
(0, import_react40.useEffect)(() => {
|
|
35840
37258
|
if (view === "detail" && !row) setView("dashboard");
|
|
35841
37259
|
}, [view, row]);
|
|
35842
37260
|
const selectedUuid = row?.instance.uuid;
|
|
35843
37261
|
const selectedRunning = row?.instance.status === "running";
|
|
35844
|
-
(0,
|
|
37262
|
+
(0, import_react40.useEffect)(() => {
|
|
35845
37263
|
setWatched(selectedRunning ? selectedUuid : void 0);
|
|
35846
37264
|
if (selectedUuid && selectedRunning) loadSnapshot(selectedUuid);
|
|
35847
37265
|
}, [selectedUuid, selectedRunning, loadSnapshot]);
|
|
35848
|
-
(0,
|
|
37266
|
+
(0, import_react40.useEffect)(() => {
|
|
35849
37267
|
if (expired) return;
|
|
35850
37268
|
let cancelled = false;
|
|
35851
37269
|
const load = () => {
|
|
@@ -35867,19 +37285,87 @@ function App2({
|
|
|
35867
37285
|
clearInterval(timer);
|
|
35868
37286
|
};
|
|
35869
37287
|
}, [client, expired, noteAuthFailure]);
|
|
35870
|
-
const noticeTimer = (0,
|
|
35871
|
-
const flash = (0,
|
|
37288
|
+
const noticeTimer = (0, import_react40.useRef)(null);
|
|
37289
|
+
const flash = (0, import_react40.useCallback)((message) => {
|
|
35872
37290
|
setNotice(message);
|
|
35873
37291
|
if (noticeTimer.current) clearTimeout(noticeTimer.current);
|
|
35874
37292
|
noticeTimer.current = setTimeout(() => setNotice(null), 6e3);
|
|
35875
37293
|
}, []);
|
|
35876
|
-
(0,
|
|
37294
|
+
(0, import_react40.useEffect)(
|
|
35877
37295
|
() => () => {
|
|
35878
37296
|
if (noticeTimer.current) clearTimeout(noticeTimer.current);
|
|
35879
37297
|
},
|
|
35880
37298
|
[]
|
|
35881
37299
|
);
|
|
35882
|
-
const
|
|
37300
|
+
const getQueue = (0, import_react40.useCallback)(() => {
|
|
37301
|
+
if (!queueRef.current) {
|
|
37302
|
+
const account = [identity.tenant, identity.uid ?? identity.uuid ?? token];
|
|
37303
|
+
const namespace = createHash("sha256").update(
|
|
37304
|
+
JSON.stringify([
|
|
37305
|
+
(baseUrl ?? resolveBaseUrl() ?? DEFAULT_BASE_URL).replace(/\/+$/, ""),
|
|
37306
|
+
account
|
|
37307
|
+
])
|
|
37308
|
+
).digest("hex");
|
|
37309
|
+
queueRef.current = new TransferQueue(client, namespace);
|
|
37310
|
+
const queue = queueRef.current;
|
|
37311
|
+
const updateNotice = () => {
|
|
37312
|
+
const jobs = queue.snapshot();
|
|
37313
|
+
const unfinished = jobs.filter(
|
|
37314
|
+
(job) => job.state !== "completed" && job.state !== "cancelled"
|
|
37315
|
+
);
|
|
37316
|
+
setQueueNotice(
|
|
37317
|
+
unfinished.length ? `\u4F20\u8F93 ${unfinished.length} \u9879\u672A\u5B8C\u6210${jobs.some((job) => job.state === "conflict") ? " \xB7 \u7B49\u5F85\u51B2\u7A81\u5904\u7406" : ""} \xB7 t \u67E5\u770B\u961F\u5217` : null
|
|
37318
|
+
);
|
|
37319
|
+
};
|
|
37320
|
+
queueUnsubscribe.current = queue.subscribe(updateNotice);
|
|
37321
|
+
updateNotice();
|
|
37322
|
+
}
|
|
37323
|
+
return queueRef.current;
|
|
37324
|
+
}, [client, baseUrl, identity, token]);
|
|
37325
|
+
(0, import_react40.useEffect)(
|
|
37326
|
+
() => () => {
|
|
37327
|
+
accessController.current?.abort();
|
|
37328
|
+
queueUnsubscribe.current?.();
|
|
37329
|
+
void queueRef.current?.dispose().catch((err) => {
|
|
37330
|
+
process.stderr.write(`\u4F20\u8F93\u961F\u5217\u5173\u95ED\u5931\u8D25\uFF1A${err.message}
|
|
37331
|
+
`);
|
|
37332
|
+
});
|
|
37333
|
+
},
|
|
37334
|
+
[]
|
|
37335
|
+
);
|
|
37336
|
+
(0, import_react40.useEffect)(() => {
|
|
37337
|
+
if (expired) {
|
|
37338
|
+
void queueRef.current?.pauseAll().catch((err) => flash(err.message));
|
|
37339
|
+
}
|
|
37340
|
+
}, [expired, flash]);
|
|
37341
|
+
const requestExit = (0, import_react40.useCallback)(() => {
|
|
37342
|
+
accessController.current?.abort();
|
|
37343
|
+
if (queueRef.current?.hasPending()) setPending({ kind: "exit" });
|
|
37344
|
+
else exit();
|
|
37345
|
+
}, [exit]);
|
|
37346
|
+
const finishLogout = async (reason) => {
|
|
37347
|
+
if (busy) return;
|
|
37348
|
+
setBusy(true);
|
|
37349
|
+
try {
|
|
37350
|
+
if (queueRef.current) await queueRef.current.pauseAll();
|
|
37351
|
+
onLogout(reason);
|
|
37352
|
+
} catch (err) {
|
|
37353
|
+
flash(err.message);
|
|
37354
|
+
setBusy(false);
|
|
37355
|
+
}
|
|
37356
|
+
};
|
|
37357
|
+
const finishExit = async () => {
|
|
37358
|
+
if (busy) return;
|
|
37359
|
+
setBusy(true);
|
|
37360
|
+
try {
|
|
37361
|
+
if (queueRef.current) await queueRef.current.pauseAll();
|
|
37362
|
+
exit();
|
|
37363
|
+
} catch (err) {
|
|
37364
|
+
flash(err.message);
|
|
37365
|
+
setBusy(false);
|
|
37366
|
+
}
|
|
37367
|
+
};
|
|
37368
|
+
const act = (0, import_react40.useCallback)(
|
|
35883
37369
|
async (label, fn) => {
|
|
35884
37370
|
setBusy(true);
|
|
35885
37371
|
setNotice(`${label}\u2026`);
|
|
@@ -35895,7 +37381,7 @@ function App2({
|
|
|
35895
37381
|
},
|
|
35896
37382
|
[flash, refresh, noteAuthFailure]
|
|
35897
37383
|
);
|
|
35898
|
-
const loadStock = (0,
|
|
37384
|
+
const loadStock = (0, import_react40.useCallback)(async () => {
|
|
35899
37385
|
setStockLoading(true);
|
|
35900
37386
|
try {
|
|
35901
37387
|
const { snapshots } = await getStockByRegion(client);
|
|
@@ -35907,7 +37393,106 @@ function App2({
|
|
|
35907
37393
|
setStockLoading(false);
|
|
35908
37394
|
}
|
|
35909
37395
|
}, [client, flash, noteAuthFailure]);
|
|
35910
|
-
const
|
|
37396
|
+
const copySSH = (0, import_react40.useCallback)(
|
|
37397
|
+
(uuid) => {
|
|
37398
|
+
const snapshot = snapshotFor(uuid);
|
|
37399
|
+
if (!snapshot?.ssh.host || !snapshot.ssh.port) {
|
|
37400
|
+
flash("\u5B9E\u4F8B\u672A\u8FD0\u884C\u6216 SSH \u4FE1\u606F\u5C1A\u672A\u5C31\u7EEA");
|
|
37401
|
+
return;
|
|
37402
|
+
}
|
|
37403
|
+
const command = snapshot.ssh.command ?? `ssh -p ${snapshot.ssh.port} root@${snapshot.ssh.host}`;
|
|
37404
|
+
void copyToClipboard(command).then((result) => {
|
|
37405
|
+
flash(
|
|
37406
|
+
result.method === "native" ? `\u2714 \u5DF2\u590D\u5236\uFF1A${command}\u3000\u5BC6\u7801 ${snapshot.ssh.password}` : `${command}\u3000\u5BC6\u7801 ${snapshot.ssh.password}\u3000\uFF08${result.note}\uFF09`
|
|
37407
|
+
);
|
|
37408
|
+
});
|
|
37409
|
+
},
|
|
37410
|
+
[flash, snapshotFor]
|
|
37411
|
+
);
|
|
37412
|
+
const performAccess = (0, import_react40.useCallback)(
|
|
37413
|
+
async (action, signal) => {
|
|
37414
|
+
if (signal?.aborted) return;
|
|
37415
|
+
if (action.kind === "files") {
|
|
37416
|
+
setWorkspace(
|
|
37417
|
+
(prev) => prev && fileUuidRef.current === action.uuid ? prev : new FileWorkspace(client, action.uuid)
|
|
37418
|
+
);
|
|
37419
|
+
fileUuidRef.current = action.uuid;
|
|
37420
|
+
setFileUuid(action.uuid);
|
|
37421
|
+
getQueue();
|
|
37422
|
+
setView("files");
|
|
37423
|
+
if (signal) return;
|
|
37424
|
+
const gate = (async () => {
|
|
37425
|
+
const status = await getInstanceStatus(client, action.uuid);
|
|
37426
|
+
if (status !== "running") {
|
|
37427
|
+
setPending({ kind: "power", action });
|
|
37428
|
+
throw new Error(`\u5B9E\u4F8B ${action.uuid} \u5F53\u524D\u672A\u8FD0\u884C\uFF0C\u8FDC\u7A0B\u76EE\u5F55\u9700\u5F00\u673A\u540E\u67E5\u770B`);
|
|
37429
|
+
}
|
|
37430
|
+
})();
|
|
37431
|
+
gate.catch((err) => {
|
|
37432
|
+
flash(err.message);
|
|
37433
|
+
noteAuthFailure(err);
|
|
37434
|
+
});
|
|
37435
|
+
setFileGate(gate.then(() => void 0));
|
|
37436
|
+
return;
|
|
37437
|
+
}
|
|
37438
|
+
if (action.kind === "resume") {
|
|
37439
|
+
getQueue().resume(action.jobId);
|
|
37440
|
+
return;
|
|
37441
|
+
}
|
|
37442
|
+
setTerminalActive(true);
|
|
37443
|
+
try {
|
|
37444
|
+
let code = 0;
|
|
37445
|
+
await suspendTerminal(async () => {
|
|
37446
|
+
process.stdout.write(LEAVE_ALT_SCREEN);
|
|
37447
|
+
try {
|
|
37448
|
+
code = await connectTerminal(client, action.uuid, signal ? { signal } : {});
|
|
37449
|
+
} finally {
|
|
37450
|
+
process.stdout.write(signal?.aborted ? LEAVE_ALT_SCREEN : ENTER_ALT_SCREEN + CLEAR);
|
|
37451
|
+
}
|
|
37452
|
+
});
|
|
37453
|
+
flash(`SSH \u4F1A\u8BDD\u5DF2\u7ED3\u675F\uFF08\u9000\u51FA\u7801 ${code}\uFF09`);
|
|
37454
|
+
} finally {
|
|
37455
|
+
setTerminalActive(false);
|
|
37456
|
+
}
|
|
37457
|
+
},
|
|
37458
|
+
[client, flash, getQueue, noteAuthFailure, suspendTerminal]
|
|
37459
|
+
);
|
|
37460
|
+
const requestAccess = (0, import_react40.useCallback)(
|
|
37461
|
+
async (action) => {
|
|
37462
|
+
if (action.kind === "files") {
|
|
37463
|
+
if (busy) return;
|
|
37464
|
+
await performAccess(action);
|
|
37465
|
+
return;
|
|
37466
|
+
}
|
|
37467
|
+
if (busy) return;
|
|
37468
|
+
setBusy(true);
|
|
37469
|
+
const controller = new AbortController();
|
|
37470
|
+
accessController.current = controller;
|
|
37471
|
+
try {
|
|
37472
|
+
const status = await getInstanceStatus(client, action.uuid);
|
|
37473
|
+
if (controller.signal.aborted) return;
|
|
37474
|
+
if (status !== "running") {
|
|
37475
|
+
setPending({ kind: "power", action });
|
|
37476
|
+
return;
|
|
37477
|
+
}
|
|
37478
|
+
await performAccess(action, controller.signal);
|
|
37479
|
+
} catch (err) {
|
|
37480
|
+
flash(err.message);
|
|
37481
|
+
noteAuthFailure(err);
|
|
37482
|
+
} finally {
|
|
37483
|
+
setBusy(false);
|
|
37484
|
+
}
|
|
37485
|
+
},
|
|
37486
|
+
[busy, client, flash, noteAuthFailure, performAccess]
|
|
37487
|
+
);
|
|
37488
|
+
const resumeTransfer = (0, import_react40.useCallback)(
|
|
37489
|
+
(jobId) => {
|
|
37490
|
+
const job = queueRef.current?.snapshot().find((entry) => entry.request.id === jobId);
|
|
37491
|
+
if (job) void requestAccess({ kind: "resume", uuid: job.request.uuid, jobId });
|
|
37492
|
+
},
|
|
37493
|
+
[requestAccess]
|
|
37494
|
+
);
|
|
37495
|
+
const submitCreate = (0, import_react40.useCallback)(
|
|
35911
37496
|
async (draft) => {
|
|
35912
37497
|
setBusy(true);
|
|
35913
37498
|
try {
|
|
@@ -35937,6 +37522,8 @@ function App2({
|
|
|
35937
37522
|
);
|
|
35938
37523
|
use_input_default(
|
|
35939
37524
|
(input, key) => {
|
|
37525
|
+
if (isCtrl(input, key, "c")) return requestExit();
|
|
37526
|
+
if (view === "files" || view === "transfers" || view === "create" || expired) return;
|
|
35940
37527
|
if (view === "help") {
|
|
35941
37528
|
setView("dashboard");
|
|
35942
37529
|
return;
|
|
@@ -35954,15 +37541,30 @@ function App2({
|
|
|
35954
37541
|
}
|
|
35955
37542
|
if (view === "detail") {
|
|
35956
37543
|
if (input === "p") return setReveal((v) => !v);
|
|
37544
|
+
if (input === "r") return refresh();
|
|
37545
|
+
if (!row) return;
|
|
37546
|
+
if (input === "h") return void requestAccess({ kind: "ssh", uuid: row.instance.uuid });
|
|
37547
|
+
if (input === "f") return void requestAccess({ kind: "files", uuid: row.instance.uuid });
|
|
37548
|
+
if (input === "c") return copySSH(row.instance.uuid);
|
|
37549
|
+
if (input === "t") {
|
|
37550
|
+
try {
|
|
37551
|
+
getQueue();
|
|
37552
|
+
setView("transfers");
|
|
37553
|
+
} catch (err) {
|
|
37554
|
+
flash(err.message);
|
|
37555
|
+
}
|
|
37556
|
+
return;
|
|
37557
|
+
}
|
|
37558
|
+
if (input === "n") return setView("create");
|
|
35957
37559
|
return;
|
|
35958
37560
|
}
|
|
35959
|
-
if (input === "q"
|
|
37561
|
+
if (input === "q") return requestExit();
|
|
37562
|
+
if (isCtrl(input, key, "c")) return;
|
|
35960
37563
|
if (input === "?") return setView("help");
|
|
35961
37564
|
if (key.upArrow || input === "k") return setSelected((v) => Math.max(0, v - 1));
|
|
35962
37565
|
if (key.downArrow || input === "j")
|
|
35963
37566
|
return setSelected((v) => Math.max(0, Math.min(rows.length - 1, v + 1)));
|
|
35964
37567
|
if (input === "r") return refresh();
|
|
35965
|
-
if (input === "n") return setView("create");
|
|
35966
37568
|
if (isCtrl(input, key, "l")) return setPending({ kind: "logout" });
|
|
35967
37569
|
if (input === "g") {
|
|
35968
37570
|
setView("stock");
|
|
@@ -35988,37 +37590,31 @@ function App2({
|
|
|
35988
37590
|
return stopped ? `\u2714 ${row.instance.uuid} \u5DF2\u5173\u673A\uFF0C\u8BA1\u8D39\u5DF2\u505C\u6B62` : `\u26A0 \u5173\u673A\u672A\u751F\u6548\uFF0C\u72B6\u6001\u4ECD\u4E3A ${status}\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5`;
|
|
35989
37591
|
});
|
|
35990
37592
|
}
|
|
35991
|
-
if (input === "c") {
|
|
35992
|
-
const snapshot = snapshotFor(row.instance.uuid);
|
|
35993
|
-
if (!snapshot?.ssh.host || !snapshot.ssh.port) {
|
|
35994
|
-
return flash("\u5B9E\u4F8B\u672A\u8FD0\u884C\u6216 SSH \u4FE1\u606F\u5C1A\u672A\u5C31\u7EEA");
|
|
35995
|
-
}
|
|
35996
|
-
const command = snapshot.ssh.command ?? `ssh -p ${snapshot.ssh.port} root@${snapshot.ssh.host}`;
|
|
35997
|
-
void copyToClipboard(command).then((result) => {
|
|
35998
|
-
flash(
|
|
35999
|
-
result.method === "native" ? `\u2714 \u5DF2\u590D\u5236\uFF1A${command}\u3000\u5BC6\u7801 ${snapshot.ssh.password}` : `${command}\u3000\u5BC6\u7801 ${snapshot.ssh.password}\u3000\uFF08${result.note}\uFF09`
|
|
36000
|
-
);
|
|
36001
|
-
});
|
|
36002
|
-
return;
|
|
36003
|
-
}
|
|
36004
37593
|
if (isCtrl(input, key, "d")) {
|
|
36005
37594
|
if (busy) return;
|
|
36006
37595
|
return setPending({ kind: "release", row });
|
|
36007
37596
|
}
|
|
36008
37597
|
},
|
|
36009
|
-
{
|
|
37598
|
+
{
|
|
37599
|
+
isActive: pending === null && !terminalActive
|
|
37600
|
+
}
|
|
36010
37601
|
);
|
|
36011
|
-
const hints = expired ? "Enter \u91CD\u65B0\u767B\u5165 \xB7 q \u9000\u51FA" : pending ? CONFIRM_KEYS : view === "create" ? (
|
|
37602
|
+
const hints = expired && !pending ? "Enter \u91CD\u65B0\u767B\u5165 \xB7 q \u9000\u51FA" : pending ? CONFIRM_KEYS : view === "files" || view === "transfers" ? "Esc \u8FD4\u56DE \xB7 ctrl+c \u9000\u51FA\uFF08\u672A\u5B8C\u6210\u4EFB\u52A1\u5148\u786E\u8BA4\uFF09" : view === "create" ? (
|
|
36012
37603
|
// Step-agnostic on purpose: the wizard's own line says what Enter does at this
|
|
36013
37604
|
// step, and only Esc is true at every one of them.
|
|
36014
37605
|
"Esc \u53D6\u6D88"
|
|
36015
|
-
) : view === "help" ? "\u6309\u4EFB\u610F\u952E\u8FD4\u56DE" : view === "detail" ? "p \u663E\u793A/\u9690\u85CF\u5BC6\u7801 \xB7 Esc \u8FD4\u56DE" : view === "stock" ? "\u2191\u2193 \u79FB\u52A8 \xB7 r \u5237\u65B0 \xB7 Esc \u8FD4\u56DE" : DASHBOARD_KEYS;
|
|
37606
|
+
) : view === "help" ? "\u6309\u4EFB\u610F\u952E\u8FD4\u56DE" : view === "detail" ? "h SSH\u767B\u5F55 \xB7 f \u6587\u4EF6 \xB7 t \u4F20\u8F93 \xB7 c \u590D\u5236SSH \xB7 n \u65B0\u5EFA \xB7 p \u663E\u793A/\u9690\u85CF\u5BC6\u7801 \xB7 Esc \u8FD4\u56DE" : view === "stock" ? "\u2191\u2193 \u79FB\u52A8 \xB7 r \u5237\u65B0 \xB7 Esc \u8FD4\u56DE" : DASHBOARD_KEYS;
|
|
36016
37607
|
const showsDashboard = !expired && !pending && view === "dashboard";
|
|
37608
|
+
const showsFiles = !expired && !pending && (view === "files" || view === "transfers");
|
|
36017
37609
|
return (
|
|
36018
37610
|
// Claim the entire terminal so the dashboard is a fixed full-screen surface rather
|
|
36019
37611
|
// than a block that grows and shrinks with its content.
|
|
36020
|
-
/* @__PURE__ */ (0,
|
|
36021
|
-
/* @__PURE__ */ (0,
|
|
37612
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Box_default, { flexDirection: "column", height: terminalRows, width: columns2, children: [
|
|
37613
|
+
showsFiles ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Box_default, { height: 1, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Text, { bold: true, wrap: "truncate", children: [
|
|
37614
|
+
"AutoDL \xB7 ",
|
|
37615
|
+
SCREEN_TITLES[view],
|
|
37616
|
+
view === "files" ? ` \xB7 ${fileUuid}` : ""
|
|
37617
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
36022
37618
|
Header,
|
|
36023
37619
|
{
|
|
36024
37620
|
subtitle: SCREEN_TITLES[view],
|
|
@@ -36028,27 +37624,56 @@ function App2({
|
|
|
36028
37624
|
columns: columns2
|
|
36029
37625
|
}
|
|
36030
37626
|
),
|
|
36031
|
-
expired ? /* @__PURE__ */ (0,
|
|
37627
|
+
expired && !pending ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
36032
37628
|
SessionExpired,
|
|
36033
37629
|
{
|
|
36034
37630
|
message: expired,
|
|
36035
|
-
onRelogin: () =>
|
|
36036
|
-
onQuit:
|
|
37631
|
+
onRelogin: () => void finishLogout("\u4E0A\u4E00\u6B21\u4F1A\u8BDD\u7684 Token \u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0\u767B\u5165\u3002"),
|
|
37632
|
+
onQuit: requestExit
|
|
36037
37633
|
}
|
|
36038
|
-
) : pending?.kind === "logout" ? /* @__PURE__ */ (0,
|
|
37634
|
+
) : pending?.kind === "logout" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
36039
37635
|
Confirm,
|
|
36040
37636
|
{
|
|
36041
37637
|
title: "\u9000\u51FA\u767B\u5F55\uFF1F",
|
|
36042
|
-
detail: `\u4F1A\u6E05\u9664\u4FDD\u5B58\u5728 ${configPath()} \u7684 Token\uFF0C\u5E76\u8FD4\u56DE\u767B\u5165\u754C\u9762\u3002\u5B9E\u4F8B\
|
|
37638
|
+
detail: `\u4F1A\u5148\u6682\u505C\u672A\u5B8C\u6210\u4F20\u8F93\uFF0C\u6E05\u9664\u4FDD\u5B58\u5728 ${configPath()} \u7684 Token\uFF0C\u5E76\u8FD4\u56DE\u767B\u5165\u754C\u9762\u3002\u5B9E\u4F8B\u7EE7\u7EED\u8BA1\u8D39\uFF1B\u4F20\u8F93\u8BB0\u5F55\u4FDD\u7559\uFF0C\u91CD\u65B0\u767B\u5F55\u540E\u53EF\u624B\u52A8\u6062\u590D\u3002`,
|
|
36043
37639
|
danger: tokenOverrideNote(tokenSource) ?? void 0,
|
|
36044
37640
|
confirmLabel: "\u9000\u51FA\u767B\u5F55",
|
|
37641
|
+
onConfirm: () => void finishLogout(),
|
|
37642
|
+
onCancel: () => setPending(null)
|
|
37643
|
+
}
|
|
37644
|
+
) : pending?.kind === "exit" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
37645
|
+
Confirm,
|
|
37646
|
+
{
|
|
37647
|
+
title: "\u6682\u505C\u4F20\u8F93\u5E76\u9000\u51FA\uFF1F",
|
|
37648
|
+
detail: "\u5F53\u524D\u548C\u6392\u961F\u4EFB\u52A1\u5C06\u6682\u505C\uFF0C\u4FDD\u7559\u7EED\u4F20\u6570\u636E\u3002\u4E0B\u6B21\u6253\u5F00\u4F20\u8F93\u961F\u5217\u540E\u53EF\u624B\u52A8\u6062\u590D\uFF1B\u9000\u51FA\u540E\u4E0D\u4F1A\u540E\u53F0\u4F20\u8F93\u3002",
|
|
37649
|
+
confirmLabel: "\u6682\u505C\u5E76\u9000\u51FA",
|
|
37650
|
+
onConfirm: () => void finishExit(),
|
|
37651
|
+
onCancel: () => setPending(null)
|
|
37652
|
+
}
|
|
37653
|
+
) : pending?.kind === "power" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
37654
|
+
Confirm,
|
|
37655
|
+
{
|
|
37656
|
+
title: `\u542F\u52A8\u5B9E\u4F8B ${pending.action.uuid}\uFF1F`,
|
|
37657
|
+
detail: "\u5B9E\u4F8B\u5C1A\u672A\u8FD0\u884C\u3002\u786E\u8BA4\u540E\u7B49\u5F85\u5F00\u673A\u548C SSH \u5C31\u7EEA\uFF0C\u518D\u7EE7\u7EED\u521A\u624D\u7684\u64CD\u4F5C\u3002",
|
|
37658
|
+
danger: "\u5F00\u673A\u4F1A\u4EA7\u751F\u5B9E\u4F8B\u8D39\u7528\u3002\u81EA\u52A8\u91CD\u8FDE\u4E0D\u4F1A\u81EA\u52A8\u5F00\u673A\u3002",
|
|
37659
|
+
confirmLabel: "\u5F00\u673A\u5E76\u7EE7\u7EED",
|
|
36045
37660
|
onConfirm: () => {
|
|
37661
|
+
const action = pending.action;
|
|
36046
37662
|
setPending(null);
|
|
36047
|
-
|
|
37663
|
+
void act("\u5F00\u673A\u5E76\u8FDE\u63A5", async () => {
|
|
37664
|
+
const controller = new AbortController();
|
|
37665
|
+
accessController.current = controller;
|
|
37666
|
+
await getCredentials(client, action.uuid, {
|
|
37667
|
+
autoStart: true,
|
|
37668
|
+
signal: controller.signal
|
|
37669
|
+
});
|
|
37670
|
+
await performAccess(action, controller.signal);
|
|
37671
|
+
return "\u64CD\u4F5C\u5DF2\u7EE7\u7EED";
|
|
37672
|
+
});
|
|
36048
37673
|
},
|
|
36049
37674
|
onCancel: () => setPending(null)
|
|
36050
37675
|
}
|
|
36051
|
-
) : pending ? /* @__PURE__ */ (0,
|
|
37676
|
+
) : pending?.kind === "release" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
36052
37677
|
Confirm,
|
|
36053
37678
|
{
|
|
36054
37679
|
title: `\u91CA\u653E\u5B9E\u4F8B ${pending.row.instance.name || pending.row.instance.uuid}\uFF1F`,
|
|
@@ -36065,18 +37690,39 @@ function App2({
|
|
|
36065
37690
|
},
|
|
36066
37691
|
onCancel: () => setPending(null)
|
|
36067
37692
|
}
|
|
36068
|
-
) : view === "
|
|
37693
|
+
) : view === "files" && workspace && queueRef.current ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
37694
|
+
FilesScreen,
|
|
37695
|
+
{
|
|
37696
|
+
workspace,
|
|
37697
|
+
queue: queueRef.current,
|
|
37698
|
+
uuid: fileUuid,
|
|
37699
|
+
width: columns2,
|
|
37700
|
+
height: Math.max(6, terminalRows - 2),
|
|
37701
|
+
onBack: () => setView("dashboard"),
|
|
37702
|
+
onResume: resumeTransfer,
|
|
37703
|
+
...fileGate ? { whenRunning: fileGate } : {}
|
|
37704
|
+
}
|
|
37705
|
+
) : view === "transfers" && queueRef.current ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
37706
|
+
TransferJobs,
|
|
37707
|
+
{
|
|
37708
|
+
queue: queueRef.current,
|
|
37709
|
+
width: columns2,
|
|
37710
|
+
height: Math.max(6, terminalRows - 2),
|
|
37711
|
+
onBack: () => setView("dashboard"),
|
|
37712
|
+
onResume: resumeTransfer
|
|
37713
|
+
}
|
|
37714
|
+
) : view === "create" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CreateWizard, { busy, onSubmit: submitCreate, onCancel: () => setView("dashboard") }) : view === "detail" && row ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Detail, { row, snapshot: snapshotFor(row.instance.uuid), revealSecrets: reveal }) : view === "stock" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
36069
37715
|
StockScreen,
|
|
36070
37716
|
{
|
|
36071
37717
|
rows: toStockRows(stock, false),
|
|
36072
37718
|
selectedIndex: stockIndex,
|
|
36073
37719
|
loading: stockLoading
|
|
36074
37720
|
}
|
|
36075
|
-
) : view === "help" ? /* @__PURE__ */ (0,
|
|
36076
|
-
/* @__PURE__ */ (0,
|
|
36077
|
-
/* @__PURE__ */ (0,
|
|
36078
|
-
/* @__PURE__ */ (0,
|
|
36079
|
-
] }) : /* @__PURE__ */ (0,
|
|
37721
|
+
) : view === "help" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", paddingX: 1, children: [
|
|
37722
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { bold: true, children: "\u5FEB\u6377\u952E" }),
|
|
37723
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Box_default, { children: HELP_COLUMNS.map((column) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Box_default, { flexDirection: "column", width: 22, children: column.map((item) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { children: item }, item)) }, column[0])) }),
|
|
37724
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { dimColor: true, children: "\u6309\u4EFB\u610F\u952E\u8FD4\u56DE" })
|
|
37725
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
36080
37726
|
Dashboard,
|
|
36081
37727
|
{
|
|
36082
37728
|
rows,
|
|
@@ -36089,13 +37735,13 @@ function App2({
|
|
|
36089
37735
|
height: terminalRows
|
|
36090
37736
|
}
|
|
36091
37737
|
),
|
|
36092
|
-
showsDashboard ? null : /* @__PURE__ */ (0,
|
|
36093
|
-
/* @__PURE__ */ (0,
|
|
37738
|
+
showsDashboard || showsFiles ? null : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Box_default, { flexGrow: 1 }),
|
|
37739
|
+
showsFiles ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Box_default, { height: 1, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { color: "cyan", wrap: "truncate", children: notice ?? "ctrl+c \u9000\u51FA\uFF08\u672A\u5B8C\u6210\u4F20\u8F93\u5148\u786E\u8BA4\uFF09" }) }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
36094
37740
|
StatusBar,
|
|
36095
37741
|
{
|
|
36096
37742
|
rows,
|
|
36097
37743
|
error: expired ? null : error,
|
|
36098
|
-
notice,
|
|
37744
|
+
notice: notice ?? queueNotice,
|
|
36099
37745
|
lastUpdated,
|
|
36100
37746
|
hints
|
|
36101
37747
|
}
|
|
@@ -36105,34 +37751,51 @@ function App2({
|
|
|
36105
37751
|
}
|
|
36106
37752
|
function Root({ globals }) {
|
|
36107
37753
|
const { exit } = use_app_default();
|
|
36108
|
-
const [session, setSession] = (0,
|
|
37754
|
+
const [session, setSession] = (0, import_react40.useState)(() => {
|
|
36109
37755
|
const resolved = tryResolveToken(globals.token);
|
|
36110
37756
|
if (!resolved) return null;
|
|
36111
37757
|
const baseUrl = resolveBaseUrl(globals.baseUrl);
|
|
36112
37758
|
return {
|
|
36113
37759
|
client: new AutoDLClient({ token: resolved.token, ...baseUrl ? { baseUrl } : {} }),
|
|
36114
37760
|
token: resolved.token,
|
|
36115
|
-
source: resolved.source
|
|
37761
|
+
source: resolved.source,
|
|
37762
|
+
baseUrl: baseUrl ?? DEFAULT_BASE_URL
|
|
36116
37763
|
};
|
|
36117
37764
|
});
|
|
36118
|
-
const [error, setError] = (0,
|
|
36119
|
-
const [notice, setNotice] = (0,
|
|
36120
|
-
const [verifying, setVerifying] = (0,
|
|
36121
|
-
const submit = (0,
|
|
36122
|
-
(token) => {
|
|
37765
|
+
const [error, setError] = (0, import_react40.useState)(null);
|
|
37766
|
+
const [notice, setNotice] = (0, import_react40.useState)(null);
|
|
37767
|
+
const [verifying, setVerifying] = (0, import_react40.useState)(false);
|
|
37768
|
+
const submit = (0, import_react40.useCallback)(
|
|
37769
|
+
async (token) => {
|
|
36123
37770
|
setVerifying(true);
|
|
36124
37771
|
setError(null);
|
|
36125
|
-
|
|
36126
|
-
|
|
36127
|
-
|
|
37772
|
+
try {
|
|
37773
|
+
const baseUrl = resolveBaseUrl(globals.baseUrl);
|
|
37774
|
+
const candidate = new AutoDLClient({ token, ...baseUrl ? { baseUrl } : {} });
|
|
37775
|
+
await getBalance(candidate);
|
|
36128
37776
|
updateConfig({ token });
|
|
37777
|
+
const resolved = resolveToken(globals.token);
|
|
37778
|
+
const client = resolved.token === token ? candidate : new AutoDLClient({
|
|
37779
|
+
token: resolved.token,
|
|
37780
|
+
...baseUrl ? { baseUrl } : {}
|
|
37781
|
+
});
|
|
37782
|
+
if (client !== candidate) await getBalance(client);
|
|
36129
37783
|
setNotice(null);
|
|
36130
|
-
setSession({
|
|
36131
|
-
|
|
37784
|
+
setSession({
|
|
37785
|
+
client,
|
|
37786
|
+
token: resolved.token,
|
|
37787
|
+
source: resolved.source,
|
|
37788
|
+
baseUrl: baseUrl ?? DEFAULT_BASE_URL
|
|
37789
|
+
});
|
|
37790
|
+
} catch (err) {
|
|
37791
|
+
setError(err.message);
|
|
37792
|
+
} finally {
|
|
37793
|
+
setVerifying(false);
|
|
37794
|
+
}
|
|
36132
37795
|
},
|
|
36133
|
-
[globals.baseUrl]
|
|
37796
|
+
[globals.baseUrl, globals.token]
|
|
36134
37797
|
);
|
|
36135
|
-
const logout = (0,
|
|
37798
|
+
const logout = (0, import_react40.useCallback)(
|
|
36136
37799
|
(reason) => {
|
|
36137
37800
|
clearToken();
|
|
36138
37801
|
const override = session ? tokenOverrideNote(session.source) : null;
|
|
@@ -36143,18 +37806,19 @@ function Root({ globals }) {
|
|
|
36143
37806
|
[session]
|
|
36144
37807
|
);
|
|
36145
37808
|
if (!session) {
|
|
36146
|
-
return /* @__PURE__ */ (0,
|
|
37809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Login, { onSubmit: submit, onQuit: exit, error, verifying, notice });
|
|
36147
37810
|
}
|
|
36148
37811
|
return (
|
|
36149
37812
|
// Keyed on the token so a re-login remounts: the previous session's instances,
|
|
36150
37813
|
// balance and error state must not bleed into the new account's dashboard.
|
|
36151
|
-
/* @__PURE__ */ (0,
|
|
37814
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
36152
37815
|
App2,
|
|
36153
37816
|
{
|
|
36154
37817
|
client: session.client,
|
|
36155
37818
|
token: session.token,
|
|
36156
37819
|
tokenSource: session.source,
|
|
36157
|
-
onLogout: logout
|
|
37820
|
+
onLogout: logout,
|
|
37821
|
+
baseUrl: session.baseUrl
|
|
36158
37822
|
},
|
|
36159
37823
|
session.token
|
|
36160
37824
|
)
|
|
@@ -36167,24 +37831,29 @@ async function runTui(globals = {}) {
|
|
|
36167
37831
|
const previous = { json: isJson(), verbose: isVerbose() };
|
|
36168
37832
|
configureOutput({ quiet: true });
|
|
36169
37833
|
let restored = false;
|
|
37834
|
+
let app;
|
|
36170
37835
|
const restore = () => {
|
|
36171
37836
|
if (restored) return;
|
|
36172
37837
|
restored = true;
|
|
36173
37838
|
process.stdout.write(LEAVE_ALT_SCREEN);
|
|
36174
37839
|
configureOutput({ quiet: false, json: previous.json, verbose: previous.verbose });
|
|
36175
37840
|
};
|
|
37841
|
+
const stop = () => {
|
|
37842
|
+
app?.unmount();
|
|
37843
|
+
restore();
|
|
37844
|
+
};
|
|
36176
37845
|
process.once("exit", restore);
|
|
36177
|
-
process.once("SIGINT",
|
|
36178
|
-
process.once("SIGTERM",
|
|
37846
|
+
process.once("SIGINT", stop);
|
|
37847
|
+
process.once("SIGTERM", stop);
|
|
36179
37848
|
process.stdout.write(ENTER_ALT_SCREEN + CLEAR);
|
|
36180
37849
|
try {
|
|
36181
|
-
|
|
37850
|
+
app = render_default(/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Root, { globals }), { exitOnCtrlC: false });
|
|
36182
37851
|
await app.waitUntilExit();
|
|
36183
37852
|
} finally {
|
|
36184
37853
|
restore();
|
|
36185
37854
|
process.off("exit", restore);
|
|
36186
|
-
process.off("SIGINT",
|
|
36187
|
-
process.off("SIGTERM",
|
|
37855
|
+
process.off("SIGINT", stop);
|
|
37856
|
+
process.off("SIGTERM", stop);
|
|
36188
37857
|
}
|
|
36189
37858
|
}
|
|
36190
37859
|
export {
|
|
@@ -36304,4 +37973,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
36304
37973
|
* LICENSE file in the root directory of this source tree.
|
|
36305
37974
|
*)
|
|
36306
37975
|
*/
|
|
36307
|
-
//# sourceMappingURL=app-
|
|
37976
|
+
//# sourceMappingURL=app-V5GCG3MC.js.map
|