tmex-cli 0.12.2 → 0.12.3-beta1
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/CHANGELOG.md +9 -13
- package/dist/cli-node.js +287 -98
- package/dist/runtime/{cpufeatures-dxrn1j88.node → cpufeatures-nvqtn6ne.node} +0 -0
- package/dist/runtime/server.js +25 -16
- package/dist/runtime/{sshcrypto-fjcj736m.node → sshcrypto-rfw667cw.node} +0 -0
- package/package.json +1 -1
- package/resources/fe-dist/assets/{DevicePage-B0fQ6yWB.js → DevicePage-Cc6BDsCB.js} +2 -2
- package/resources/fe-dist/assets/{DevicesPage-C7THDzTX.js → DevicesPage-BXVj9MYn.js} +2 -2
- package/resources/fe-dist/assets/{FilePage-D8V8P2IA.js → FilePage-DFvyeBg8.js} +2 -2
- package/resources/fe-dist/assets/{SettingsPage-BOTyBhHH.js → SettingsPage-B8daCB8Y.js} +2 -2
- package/resources/fe-dist/assets/{arc-DcujnLz7.js → arc-B20iCBM1.js} +2 -2
- package/resources/fe-dist/assets/{architectureDiagram-3BPJPVTR-i8499Wfc.js → architectureDiagram-3BPJPVTR-DkJzy--B.js} +2 -2
- package/resources/fe-dist/assets/{blockDiagram-GPEHLZMM-BFh4xZY2.js → blockDiagram-GPEHLZMM-BqP9dRVx.js} +2 -2
- package/resources/fe-dist/assets/{c4Diagram-AAUBKEIU-nUyGK7Ke.js → c4Diagram-AAUBKEIU-DbqKeZkc.js} +2 -2
- package/resources/fe-dist/assets/{card-BkRqR9zz.js → card-DnWixV3q.js} +2 -2
- package/resources/fe-dist/assets/channel-B9gGKu0d.js +2 -0
- package/resources/fe-dist/assets/{chunk-2J33WTMH-z2oMKYMn.js → chunk-2J33WTMH-BHZUy1d7.js} +2 -2
- package/resources/fe-dist/assets/{chunk-4BX2VUAB-CCD_pyAh.js → chunk-4BX2VUAB-QKjwiFAV.js} +2 -2
- package/resources/fe-dist/assets/{chunk-55IACEB6-Dx2_9d-z.js → chunk-55IACEB6-aUtPslwp.js} +2 -2
- package/resources/fe-dist/assets/{chunk-727SXJPM-DA36poir.js → chunk-727SXJPM-DetOPTEw.js} +2 -2
- package/resources/fe-dist/assets/{chunk-AQP2D5EJ-CQoXkVd4.js → chunk-AQP2D5EJ-Cj4pjkf1.js} +2 -2
- package/resources/fe-dist/assets/{chunk-FMBD7UC4-A6Yn7A44.js → chunk-FMBD7UC4-DuMfjqmS.js} +2 -2
- package/resources/fe-dist/assets/{chunk-ND2GUHAM-BsNl2EMT.js → chunk-ND2GUHAM-De6BOrhf.js} +2 -2
- package/resources/fe-dist/assets/{chunk-QZHKN3VN-BM_QNxf6.js → chunk-QZHKN3VN-C6UKMTXf.js} +2 -2
- package/resources/fe-dist/assets/classDiagram-4FO5ZUOK-C5AFJpT6.js +2 -0
- package/resources/fe-dist/assets/classDiagram-v2-Q7XG4LA2-C5AFJpT6.js +2 -0
- package/resources/fe-dist/assets/{cose-bilkent-S5V4N54A-1lMO_Dod.js → cose-bilkent-S5V4N54A-giRkzps1.js} +2 -2
- package/resources/fe-dist/assets/{dagre-BM42HDAG-C9Up3ckQ.js → dagre-BM42HDAG-DLE28RsS.js} +2 -2
- package/resources/fe-dist/assets/{diagram-2AECGRRQ-CtuDndmY.js → diagram-2AECGRRQ-CrloCw3m.js} +2 -2
- package/resources/fe-dist/assets/{diagram-5GNKFQAL-BQfskK8S.js → diagram-5GNKFQAL-BGEyXIkF.js} +2 -2
- package/resources/fe-dist/assets/{diagram-KO2AKTUF-CGJi8q81.js → diagram-KO2AKTUF-CZa19ANY.js} +2 -2
- package/resources/fe-dist/assets/{diagram-LMA3HP47-DAMQIoLQ.js → diagram-LMA3HP47-DC7BsuGl.js} +2 -2
- package/resources/fe-dist/assets/{diagram-OG6HWLK6-D2s__dFc.js → diagram-OG6HWLK6-BH4wPrwj.js} +2 -2
- package/resources/fe-dist/assets/{erDiagram-TEJ5UH35-_UJYLIQN.js → erDiagram-TEJ5UH35-CsQIlfSm.js} +2 -2
- package/resources/fe-dist/assets/{flowDiagram-I6XJVG4X-DN-qktDh.js → flowDiagram-I6XJVG4X-CkjuxggR.js} +2 -2
- package/resources/fe-dist/assets/{ganttDiagram-6RSMTGT7-CNuuuhXX.js → ganttDiagram-6RSMTGT7-eEGLUumD.js} +2 -2
- package/resources/fe-dist/assets/{gitGraphDiagram-PVQCEYII-Qar2sVRo.js → gitGraphDiagram-PVQCEYII-0Ni5AA_m.js} +2 -2
- package/resources/fe-dist/assets/{index-Ra6pj0rt.js → index-96GlCNDm.js} +3 -3
- package/resources/fe-dist/assets/{infoDiagram-5YYISTIA-2e6tU_v9.js → infoDiagram-5YYISTIA-tIpZWSDh.js} +2 -2
- package/resources/fe-dist/assets/{ishikawaDiagram-YF4QCWOH-BghKvoM4.js → ishikawaDiagram-YF4QCWOH-BLnWokk9.js} +2 -2
- package/resources/fe-dist/assets/{journeyDiagram-JHISSGLW-D-cHSGb_.js → journeyDiagram-JHISSGLW-NBzojNKg.js} +2 -2
- package/resources/fe-dist/assets/{kanban-definition-UN3LZRKU-BE6Cb-OK.js → kanban-definition-UN3LZRKU-BFDAtm6I.js} +2 -2
- package/resources/fe-dist/assets/{linear-CwDBnUH0.js → linear-B5DOEe_O.js} +2 -2
- package/resources/fe-dist/assets/{markdown-preview-BlQiC8ND.js → markdown-preview-DD3cdI4r.js} +4 -4
- package/resources/fe-dist/assets/{mermaid.core-DDMkLXrp.js → mermaid.core-BWq4oZoC.js} +6 -6
- package/resources/fe-dist/assets/{mindmap-definition-RKZ34NQL-C9xVR7Ut.js → mindmap-definition-RKZ34NQL-Bi2fp38o.js} +2 -2
- package/resources/fe-dist/assets/{pieDiagram-4H26LBE5-DW_4RcBv.js → pieDiagram-4H26LBE5-CKK8p15L.js} +2 -2
- package/resources/fe-dist/assets/{quadrantDiagram-W4KKPZXB-DoIrZmk2.js → quadrantDiagram-W4KKPZXB-QslRPIFi.js} +2 -2
- package/resources/fe-dist/assets/{requirementDiagram-4Y6WPE33-CYcJSuPe.js → requirementDiagram-4Y6WPE33-BRo6E1BH.js} +2 -2
- package/resources/fe-dist/assets/{sankeyDiagram-5OEKKPKP-CrIkKM6h.js → sankeyDiagram-5OEKKPKP-B16TNk4Z.js} +2 -2
- package/resources/fe-dist/assets/{sequenceDiagram-3UESZ5HK-DgzGHhGk.js → sequenceDiagram-3UESZ5HK-DiZuSmvo.js} +2 -2
- package/resources/fe-dist/assets/{stateDiagram-AJRCARHV-C6Dhr3fY.js → stateDiagram-AJRCARHV-BOn6CbQ6.js} +2 -2
- package/resources/fe-dist/assets/stateDiagram-v2-BHNVJYJU-DA0F4iLh.js +2 -0
- package/resources/fe-dist/assets/{terminal-settings-panel-CpnmWQtf.js → terminal-settings-panel-DVSfGH3m.js} +2 -2
- package/resources/fe-dist/assets/{timeline-definition-PNZ67QCA-jJ1iauQ0.js → timeline-definition-PNZ67QCA-B74c_y_8.js} +2 -2
- package/resources/fe-dist/assets/{vennDiagram-CIIHVFJN-DLRoaoJ9.js → vennDiagram-CIIHVFJN-BZvPBIfU.js} +2 -2
- package/resources/fe-dist/assets/{wardley-L42UT6IY-CykeHWp8.js → wardley-L42UT6IY-CgvxGMxD.js} +2 -2
- package/resources/fe-dist/assets/{wardleyDiagram-YWT4CUSO-U22jzD8a.js → wardleyDiagram-YWT4CUSO-BI54Re1E.js} +2 -2
- package/resources/fe-dist/assets/{xychartDiagram-2RQKCTM6-CiXS9PJ2.js → xychartDiagram-2RQKCTM6-C9AmQfwS.js} +2 -2
- package/resources/fe-dist/index.html +1 -1
- package/resources/fe-dist/assets/channel-DqmfsuLY.js +0 -2
- package/resources/fe-dist/assets/classDiagram-4FO5ZUOK-D3Z9BeOE.js +0 -2
- package/resources/fe-dist/assets/classDiagram-v2-Q7XG4LA2-D3Z9BeOE.js +0 -2
- package/resources/fe-dist/assets/stateDiagram-v2-BHNVJYJU-BiSh2azE.js +0 -2
package/dist/runtime/server.js
CHANGED
|
@@ -7721,7 +7721,7 @@ var require_bcrypt_pbkdf = __commonJS((exports, module) => {
|
|
|
7721
7721
|
|
|
7722
7722
|
// ../../node_modules/.bun/cpu-features@0.0.10/node_modules/cpu-features/build/Release/cpufeatures.node
|
|
7723
7723
|
var require_cpufeatures = __commonJS((exports, module) => {
|
|
7724
|
-
module.exports = __require("./cpufeatures-
|
|
7724
|
+
module.exports = __require("./cpufeatures-nvqtn6ne.node");
|
|
7725
7725
|
});
|
|
7726
7726
|
|
|
7727
7727
|
// ../../node_modules/.bun/cpu-features@0.0.10/node_modules/cpu-features/lib/index.js
|
|
@@ -8334,12 +8334,12 @@ var require_utils3 = __commonJS((exports, module) => {
|
|
|
8334
8334
|
|
|
8335
8335
|
// ../../node_modules/.bun/ssh2@1.17.0/node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node
|
|
8336
8336
|
var require_sshcrypto = __commonJS((exports, module) => {
|
|
8337
|
-
module.exports = __require("./sshcrypto-
|
|
8337
|
+
module.exports = __require("./sshcrypto-rfw667cw.node");
|
|
8338
8338
|
});
|
|
8339
8339
|
|
|
8340
8340
|
// ../../node_modules/.bun/ssh2@1.17.0/node_modules/ssh2/lib/protocol/crypto/poly1305.js
|
|
8341
8341
|
var require_poly1305 = __commonJS((exports, module) => {
|
|
8342
|
-
var __dirname = "/Users/krhougs/LocalCodes/tmex/node_modules/.bun/ssh2@1.17.0/node_modules/ssh2/lib/protocol/crypto", __filename = "/Users/krhougs/LocalCodes/tmex/node_modules/.bun/ssh2@1.17.0/node_modules/ssh2/lib/protocol/crypto/poly1305.js";
|
|
8342
|
+
var __dirname = "/Users/krhougs/LocalCodes/tmex/.claude/worktrees/issue-28-bun-detection/node_modules/.bun/ssh2@1.17.0/node_modules/ssh2/lib/protocol/crypto", __filename = "/Users/krhougs/LocalCodes/tmex/.claude/worktrees/issue-28-bun-detection/node_modules/.bun/ssh2@1.17.0/node_modules/ssh2/lib/protocol/crypto/poly1305.js";
|
|
8343
8343
|
var createPoly1305 = function() {
|
|
8344
8344
|
var _scriptDir = typeof document !== "undefined" && document.currentScript ? document.currentScript.src : undefined;
|
|
8345
8345
|
if (typeof __filename !== "undefined")
|
|
@@ -11112,7 +11112,7 @@ ${formatted}-----END ${type} KEY-----`;
|
|
|
11112
11112
|
|
|
11113
11113
|
// ../../node_modules/.bun/ssh2@1.17.0/node_modules/ssh2/lib/agent.js
|
|
11114
11114
|
var require_agent = __commonJS((exports, module) => {
|
|
11115
|
-
var __dirname = "/Users/krhougs/LocalCodes/tmex/node_modules/.bun/ssh2@1.17.0/node_modules/ssh2/lib";
|
|
11115
|
+
var __dirname = "/Users/krhougs/LocalCodes/tmex/.claude/worktrees/issue-28-bun-detection/node_modules/.bun/ssh2@1.17.0/node_modules/ssh2/lib";
|
|
11116
11116
|
var { Socket } = __require("net");
|
|
11117
11117
|
var { Duplex } = __require("stream");
|
|
11118
11118
|
var { resolve: resolve3 } = __require("path");
|
|
@@ -104866,7 +104866,8 @@ function getInstallInfo() {
|
|
|
104866
104866
|
deployment: "none",
|
|
104867
104867
|
installDir: null,
|
|
104868
104868
|
serviceName: null,
|
|
104869
|
-
cliVersion: null
|
|
104869
|
+
cliVersion: null,
|
|
104870
|
+
bunPath: null
|
|
104870
104871
|
};
|
|
104871
104872
|
}
|
|
104872
104873
|
const meta3 = readInstallMeta();
|
|
@@ -104876,7 +104877,8 @@ function getInstallInfo() {
|
|
|
104876
104877
|
deployment: "none",
|
|
104877
104878
|
installDir: resolveInstallDir(),
|
|
104878
104879
|
serviceName: null,
|
|
104879
|
-
cliVersion: null
|
|
104880
|
+
cliVersion: null,
|
|
104881
|
+
bunPath: null
|
|
104880
104882
|
};
|
|
104881
104883
|
}
|
|
104882
104884
|
return {
|
|
@@ -104884,7 +104886,8 @@ function getInstallInfo() {
|
|
|
104884
104886
|
deployment: deploymentFromPlatform(meta3.platform ?? process.platform),
|
|
104885
104887
|
installDir: meta3.installDir ?? resolveInstallDir(),
|
|
104886
104888
|
serviceName: meta3.serviceName ?? null,
|
|
104887
|
-
cliVersion: meta3.cliVersion ?? null
|
|
104889
|
+
cliVersion: meta3.cliVersion ?? null,
|
|
104890
|
+
bunPath: meta3.bunPath ?? null
|
|
104888
104891
|
};
|
|
104889
104892
|
}
|
|
104890
104893
|
|
|
@@ -104910,8 +104913,8 @@ function getBaseVersion() {
|
|
|
104910
104913
|
if (cachedBase !== undefined)
|
|
104911
104914
|
return cachedBase;
|
|
104912
104915
|
let base = null;
|
|
104913
|
-
if ("0.12.
|
|
104914
|
-
base = "0.12.
|
|
104916
|
+
if ("0.12.3-beta1") {
|
|
104917
|
+
base = "0.12.3-beta1";
|
|
104915
104918
|
}
|
|
104916
104919
|
if (!base && config.isProd) {
|
|
104917
104920
|
base = readInstallMeta()?.cliVersion ?? null;
|
|
@@ -105090,7 +105093,9 @@ class UpgradeController {
|
|
|
105090
105093
|
"--install-dir",
|
|
105091
105094
|
installDir,
|
|
105092
105095
|
"--version",
|
|
105093
|
-
version3
|
|
105096
|
+
version3,
|
|
105097
|
+
"--bun-path",
|
|
105098
|
+
process.execPath
|
|
105094
105099
|
], {
|
|
105095
105100
|
cwd: installDir,
|
|
105096
105101
|
env: process.env,
|
|
@@ -108718,9 +108723,9 @@ var MESSAGES = {
|
|
|
108718
108723
|
"cli.help": `tmex CLI
|
|
108719
108724
|
|
|
108720
108725
|
Usage:
|
|
108721
|
-
tmex init [--no-interactive --install-dir <path> --host <host> --port <port> --db-path <path> --autostart <true|false>]
|
|
108722
|
-
tmex doctor [--install-dir <path>] [--json]
|
|
108723
|
-
tmex upgrade [--version <version>] [--install-dir <path>]
|
|
108726
|
+
tmex init [--no-interactive --install-dir <path> --host <host> --port <port> --db-path <path> --autostart <true|false> --bun-path <path>]
|
|
108727
|
+
tmex doctor [--install-dir <path>] [--json] [--bun-path <path>]
|
|
108728
|
+
tmex upgrade [--version <version>] [--install-dir <path>] [--bun-path <path>]
|
|
108724
108729
|
tmex uninstall [--install-dir <path>] [--yes] [--purge]
|
|
108725
108730
|
|
|
108726
108731
|
Global flags:
|
|
@@ -108741,6 +108746,8 @@ Global flags:
|
|
|
108741
108746
|
"bun.versionExecFailed": "Failed to execute bun --version. Please verify Bun installation.",
|
|
108742
108747
|
"bun.versionTooLow": "Bun version too low: current {{version}}, required >= {{minVersion}}",
|
|
108743
108748
|
"bun.checkFailed": "Bun check failed.",
|
|
108749
|
+
"bun.explicitInvalid": "Specified bun path is invalid or not executable: {{path}}",
|
|
108750
|
+
"bun.unsafePath": "Unsafe bun path (contains shell metacharacters): {{path}}",
|
|
108744
108751
|
"service.install.unsupportedPlatform": "Automatic service installation is not supported on this platform: {{platform}}",
|
|
108745
108752
|
"service.systemd.daemonReloadFailed": "systemctl daemon-reload failed: {{detail}}",
|
|
108746
108753
|
"service.systemd.enableFailed": "systemctl enable failed: {{detail}}",
|
|
@@ -108817,9 +108824,9 @@ Global flags:
|
|
|
108817
108824
|
"cli.help": `tmex CLI
|
|
108818
108825
|
|
|
108819
108826
|
\u7528\u6CD5\uFF1A
|
|
108820
|
-
tmex init [--no-interactive --install-dir <path> --host <host> --port <port> --db-path <path> --autostart <true|false>]
|
|
108821
|
-
tmex doctor [--install-dir <path>] [--json]
|
|
108822
|
-
tmex upgrade [--version <version>] [--install-dir <path>]
|
|
108827
|
+
tmex init [--no-interactive --install-dir <path> --host <host> --port <port> --db-path <path> --autostart <true|false> --bun-path <path>]
|
|
108828
|
+
tmex doctor [--install-dir <path>] [--json] [--bun-path <path>]
|
|
108829
|
+
tmex upgrade [--version <version>] [--install-dir <path>] [--bun-path <path>]
|
|
108823
108830
|
tmex uninstall [--install-dir <path>] [--yes] [--purge]
|
|
108824
108831
|
|
|
108825
108832
|
\u5168\u5C40\u53C2\u6570\uFF1A
|
|
@@ -108840,6 +108847,8 @@ Global flags:
|
|
|
108840
108847
|
"bun.versionExecFailed": "\u65E0\u6CD5\u6267\u884C bun --version\uFF0C\u8BF7\u68C0\u67E5 Bun \u5B89\u88C5\u662F\u5426\u5B8C\u6574\u3002",
|
|
108841
108848
|
"bun.versionTooLow": "Bun \u7248\u672C\u8FC7\u4F4E\uFF1A\u5F53\u524D {{version}}\uFF0C\u8981\u6C42 >= {{minVersion}}",
|
|
108842
108849
|
"bun.checkFailed": "Bun \u68C0\u67E5\u5931\u8D25\u3002",
|
|
108850
|
+
"bun.explicitInvalid": "\u6307\u5B9A\u7684 bun \u8DEF\u5F84\u65E0\u6548\u6216\u4E0D\u53EF\u6267\u884C\uFF1A{{path}}",
|
|
108851
|
+
"bun.unsafePath": "bun \u8DEF\u5F84\u5305\u542B shell \u7279\u6B8A\u5B57\u7B26\uFF0C\u4E0D\u5B89\u5168\uFF1A{{path}}",
|
|
108843
108852
|
"service.install.unsupportedPlatform": "\u5F53\u524D\u5E73\u53F0\u4E0D\u652F\u6301\u81EA\u52A8\u5B89\u88C5\u670D\u52A1\uFF1A{{platform}}",
|
|
108844
108853
|
"service.systemd.daemonReloadFailed": "systemctl daemon-reload \u5931\u8D25\uFF1A{{detail}}",
|
|
108845
108854
|
"service.systemd.enableFailed": "systemctl enable \u5931\u8D25\uFF1A{{detail}}",
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Y as je,u as Ee,j as o,ag as Ge,ah as Ke,ai as Ve,aj as Je,ak as Qe,al as Ze,am as et,r,d as V,a7 as te,aa as Fe,a9 as We,a8 as tt,ab as nt,an as rt,ao as _e,ap as st,o as xe,aq as ot,ar as Pe,as as it,b as He,at as Le,au as ct,c as $e,av as Oe,aw as pe,ax as at,ay as Me,az as lt,B as le,T as ut,aA as De,aB as dt,aC as ft,aD as mt,A as ht,f as wt,g as pt,i as xt,k as vt,l as gt,m as bt,n as St,aE as yt,aF as Et}from"./index-
|
|
1
|
+
import{Y as je,u as Ee,j as o,ag as Ge,ah as Ke,ai as Ve,aj as Je,ak as Qe,al as Ze,am as et,r,d as V,a7 as te,aa as Fe,a9 as We,a8 as tt,ab as nt,an as rt,ao as _e,ap as st,o as xe,aq as ot,ar as Pe,as as it,b as He,at as Le,au as ct,c as $e,av as Oe,aw as pe,ax as at,ay as Me,az as lt,B as le,T as ut,aA as De,aB as dt,aC as ft,aD as mt,A as ht,f as wt,g as pt,i as xt,k as vt,l as gt,m as bt,n as St,aE as yt,aF as Et}from"./index-96GlCNDm.js";import{T as Tt,c as Rt,F as kt,a as qe,R as Ct}from"./terminal-settings-panel-DVSfGH3m.js";/**
|
|
2
2
|
* @license lucide-react v0.564.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -22,4 +22,4 @@ import{Y as je,u as Ee,j as o,ag as Ge,ah as Ke,ai as Ve,aj as Je,ak as Qe,al as
|
|
|
22
22
|
`);return(e.endsWith(`
|
|
23
23
|
`)?e.slice(0,-1):e).replace(/\n/g,`\r
|
|
24
24
|
`)}const Bt="\x1B[?1049h\x1B[H\x1B[2J";function Ft(n){return Bt+Ue(n)}function ze(n,e){let i=e,c=0;for(const x of n)x===10&&!i&&(c+=1),i=x===13;const p=i;if(c===0)return{normalized:n,endedWithCR:p};const E=new Uint8Array(n.length+c);let S=0;i=e;for(const x of n)x===10&&!i&&(E[S]=13,S+=1),E[S]=x,S+=1,i=x===13;return{normalized:E,endedWithCR:p}}const Wt=1.3,Ht=36,$t=500,Ot=12;function qt(n,e){const i=r.useRef(!1);return r.useEffect(()=>{const c=n.current;if(!c||!(window.innerWidth<768||navigator.maxTouchPoints>0||"ontouchstart"in window))return;i.current=!0;let E=0,S=null,x=!1,R=0,G=0,s=0,I=null,F=!1;const K=()=>{I!==null&&(clearTimeout(I),I=null)},q=w=>w?!!(w.closest(".scrollbar")||w.closest(".slider")||w.closest(".xterm-scroll-area")):!1,g=(w,m,y)=>{const N=y instanceof Element?y:null;if(q(N))return!0;const O=document.elementFromPoint(w,m);if(q(O))return!0;const h=c.querySelector(".xterm");if(!(h instanceof HTMLElement))return!1;const v=h.getBoundingClientRect(),_=w>=v.left&&w<=v.right,D=m>=v.top&&m<=v.bottom;return!_||!D?!1:w>=v.right-Ht},J=()=>[c.querySelector(".xterm-viewport"),c.querySelector(".xterm-scrollable-element")].filter(m=>m instanceof HTMLElement),f=w=>{if(S===null)return null;for(let m=0;m<w.length;m+=1){const y=w.item(m);if(y&&y.identifier===S)return y}return null},P=w=>{if(K(),w.touches.length!==1)return;const m=w.touches.item(0);m&&(S=m.identifier,E=m.clientY,R=0,x=g(m.clientX,m.clientY,w.target),G=m.clientX,s=m.clientY,F=!1,x||(I=setTimeout(()=>{var N;I=null;const y=(e==null?void 0:e())??null;(N=y==null?void 0:y.startTouchSelection)!=null&&N.call(y,G,s,"word")&&(F=!0)},$t)))},L=w=>{var _,D,T,U,Y,X,se,k,ne;const m=f(w.touches)??w.touches.item(0);if(!m)return;if(F){const A=(e==null?void 0:e())??null;(_=A==null?void 0:A.updateTouchSelection)==null||_.call(A,m.clientX,m.clientY),w.cancelable&&w.preventDefault();return}if(I!==null&&Math.hypot(m.clientX-G,m.clientY-s)>Ot&&K(),x||(x=g(m.clientX,m.clientY,w.target),x&&(R=0)),x)return;const y=m.clientY,N=E-y;if(E=y,N===0)return;let O=!1,h=!1;const v=(e==null?void 0:e())??null;if(v){const A=v==null?void 0:v._core,M=((Y=(U=(T=(D=A==null?void 0:A._renderService)==null?void 0:D.dimensions)==null?void 0:T.css)==null?void 0:U.cell)==null?void 0:Y.height)??18;R+=N*Wt;const j=R>0?Math.floor(R/M):Math.ceil(R/M);if(typeof v.handleViewportGesture=="function")j!==0&&(O=v.handleViewportGesture({source:"touch",deltaY:j*M,clientX:m.clientX,clientY:m.clientY}),R-=j*M);else if(j!==0){const B=((se=(X=v.buffer)==null?void 0:X.active)==null?void 0:se.viewportY)??0;v.scrollLines(j);const re=((ne=(k=v.buffer)==null?void 0:k.active)==null?void 0:ne.viewportY)??0;O=B!==re,h=j<0&&B<=0&&re<=0,R-=j*M}}else{const A=J();if(A.length===0)return;for(const M of A){const j=M.scrollTop;M.scrollTop+=N;const B=M.scrollTop;Math.abs(B-j)>0&&(O=!0),N<0&&B<=0&&(h=!0)}if(!O){const M=c.querySelector(".xterm");if(M instanceof HTMLElement){const j=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,deltaMode:WheelEvent.DOM_DELTA_PIXEL,deltaY:N}),B=M.dispatchEvent(j);O=j.defaultPrevented||!B}}}w.cancelable&&(O||h)&&w.preventDefault()},z=w=>{var y;if(K(),!(S===null||!f(w.changedTouches))&&(S=null,R=0,x=!1,F)){F=!1;const N=(e==null?void 0:e())??null;(y=N==null?void 0:N.endTouchSelection)==null||y.call(N)}},H=w=>{F&&w.preventDefault()};return c.addEventListener("touchstart",P,{passive:!0}),c.addEventListener("touchmove",L,{passive:!1}),c.addEventListener("touchend",z,{passive:!0}),c.addEventListener("touchcancel",z,{passive:!0}),c.addEventListener("contextmenu",H),()=>{i.current=!1,K(),c.removeEventListener("touchstart",P),c.removeEventListener("touchmove",L),c.removeEventListener("touchend",z),c.removeEventListener("touchcancel",z),c.removeEventListener("contextmenu",H)}},[n,e]),i}function Ut({now:n,remoteSize:e,pendingLocalSize:i,ttlMs:c=2e3}){return!i||n-i.at>c?!0:i.cols===e.cols&&i.rows===e.rows}function Yt({currentSize:n,containerSize:e,force:i=!1}){return i?!0:n.cols!==e.cols||n.rows!==e.rows}function Xt({deviceId:n,paneId:e,deviceConnected:i,isSelectionInvalid:c,onResize:p,onSync:E,getContainerRect:S}){const x=r.useRef(null),R=r.useRef(null),G=r.useRef(null),s=r.useRef(null),I=r.useRef(0),F=r.useRef([]),K=r.useRef(null),q=r.useRef(null),g=r.useRef(S),J=r.useRef(!1),f=r.useRef(p),P=r.useRef(E);r.useEffect(()=>{f.current=p},[p]),r.useEffect(()=>{P.current=E},[E]),r.useEffect(()=>{g.current=S},[S]);const L=r.useCallback(()=>{var X,se,k,ne,A,M,j,B,re,ve;const h=q.current,v=K.current;if(!h||!v||!h.element)return null;let _;try{const ae=v.proposeDimensions();if(!ae)throw new Error("fitAddon.proposeDimensions() returned null");_=Math.max(2,ae.cols)}catch{const ae=h._core,Te=((ne=(k=(se=(X=ae==null?void 0:ae._renderService)==null?void 0:X.dimensions)==null?void 0:se.css)==null?void 0:k.cell)==null?void 0:ne.width)??9,a=(A=g.current)==null?void 0:A.call(g);if(!a||a.width===0)return null;_=Math.max(2,Math.floor(a.width/Te))}const D=(M=g.current)==null?void 0:M.call(g);if(!D||D.height===0)return null;const T=h._core,U=((ve=(re=(B=(j=T==null?void 0:T._renderService)==null?void 0:j.dimensions)==null?void 0:B.css)==null?void 0:re.cell)==null?void 0:ve.height)??17,Y=Math.max(2,Math.floor(D.height/U));return{cols:_,rows:Y}},[]),z=r.useCallback((h,v)=>{const _=q.current;_&&(_.cols===h&&_.rows===v||_.resize(h,v))},[]),H=r.useCallback((h,v=!1)=>{if(!n||!e||!i||c&&h!=="sync"||!v&&Date.now()<I.current||!q.current)return!1;const D=L();if(!D)return!1;const{cols:T,rows:U}=D,Y=G.current;return!v&&Y&&Y.cols===T&&Y.rows===U?(z(T,U),!0):(z(T,U),h==="sync"?P.current(T,U):f.current(T,U),G.current={cols:T,rows:U},s.current={cols:T,rows:U,at:Date.now()},!0)},[z,i,n,c,L,e]),w=r.useCallback((h="resize",v={})=>{const{immediate:_=!1,force:D=!1}=v;R.current!==null&&(window.clearTimeout(R.current),R.current=null),x.current!==null&&(cancelAnimationFrame(x.current),x.current=null);const T=()=>{x.current=requestAnimationFrame(()=>{x.current=null,H(h,D)})};if(_){T();return}R.current=window.setTimeout(()=>{R.current=null,T()},150)},[H]),m=r.useCallback(()=>{for(const h of F.current)window.clearTimeout(h);F.current=[]},[]),y=r.useCallback(()=>{var v;m(),w("sync",{immediate:!0,force:!0});const h=window.setTimeout(()=>{w("sync",{immediate:!0,force:!0})},60);F.current.push(h),typeof document<"u"&&"fonts"in document&&((v=document.fonts)!=null&&v.ready)&&document.fonts.ready.then(()=>{w("sync",{immediate:!0,force:!0})}).catch(()=>{})},[m,w]);r.useEffect(()=>{let h=null;const v=()=>{h!==null&&cancelAnimationFrame(h),h=requestAnimationFrame(()=>{h=null,w("resize")})};return window.addEventListener("resize",v),()=>{window.removeEventListener("resize",v),h!==null&&cancelAnimationFrame(h)}},[w]),r.useEffect(()=>{const h=()=>{var X;const T=q.current,U=L();if(!T||!U)return;if(!Yt({currentSize:{cols:Math.max(2,T.cols),rows:Math.max(2,T.rows)},containerSize:U})){(X=T.refresh)==null||X.call(T);return}w("sync",{force:!0})},v=()=>{if(document.visibilityState!=="visible"){J.current=!0;return}J.current&&(J.current=!1,h())},_=()=>{J.current=!0},D=()=>{J.current&&(J.current=!1,h())};return document.addEventListener("visibilitychange",v),window.addEventListener("blur",_),window.addEventListener("focus",D),()=>{document.removeEventListener("visibilitychange",v),window.removeEventListener("blur",_),window.removeEventListener("focus",D)}},[L,w]),r.useEffect(()=>()=>{m(),R.current!==null&&window.clearTimeout(R.current),x.current!==null&&cancelAnimationFrame(x.current)},[m]);const N=r.useCallback(h=>{K.current=h},[]),O=r.useCallback(h=>{q.current=h},[]);return{scheduleResize:w,runPostSelectResize:y,clearPostSelectResizeTimers:m,setFitAddon:N,setTerminal:O,lastReportedSize:G,pendingLocalSize:s,suppressLocalResizeUntil:I}}const Gt=1e4,Ae="tmex:terminal-mode-cache";function Kt(n,e){try{const i=sessionStorage.getItem(Ae);return i?JSON.parse(i)[`${n}:${e}`]??null:null}catch{return null}}function Vt(n,e,i){try{const c=sessionStorage.getItem(Ae),p=c?JSON.parse(c):{},E=`${n}:${e}`;i?p[E]=i:delete p[E],sessionStorage.setItem(Ae,JSON.stringify(p))}catch{}}function Jt(){return{mouseX10:!1,mouseNormal:!0,mouseButton:!1,mouseAny:!1,mouseUtf8:!1,mouseSgr:!0,mouseSgrPixels:!1,mouseUrxvt:!1,altScroll:!0,altScreen1047:!1,altScreen1049:!1}}function Qt(n,e){if(!e)return n?{...n,mouseX10:!1,mouseNormal:!1,mouseButton:!1,mouseAny:!1,mouseUtf8:!1,mouseSgrPixels:!1,mouseUrxvt:!1,altScreen1047:!1,altScreen1049:!1}:null;const i=Jt();if(!n)return i;const c=n.mouseNormal||n.mouseButton||n.mouseAny;return{...n,mouseX10:!1,mouseUtf8:!1,mouseSgr:!0,mouseSgrPixels:!1,mouseUrxvt:!1,altScroll:!0,altScreen1047:!1,altScreen1049:!1,mouseNormal:c?n.mouseNormal:i.mouseNormal}}function Zt(n){var i;const e=globalThis;e.__tmexE2eXterm=n,e.__tmexE2eTerminal=n,e.__tmexE2eTerminalEngine=qe,e.__tmexE2eTerminalRenderer=((i=n.getRendererKind)==null?void 0:i.call(n))??null}function en(n){if(!n)return;const e=globalThis;e.__tmexE2eTerminal!==n&&e.__tmexE2eXterm!==n||(e.__tmexE2eXterm=null,e.__tmexE2eTerminal=null,e.__tmexE2eTerminalEngine=null,e.__tmexE2eTerminalRenderer=null,e.__tmexE2eTerminalSelectionText=null)}const Ye=r.forwardRef(({deviceId:n,paneId:e,theme:i,inputMode:c,deviceConnected:p,isSelectionInvalid:E,onResize:S,onSync:x,children:R},G)=>{const[s,I]=r.useState(null),[F,K]=r.useState(!1),q=V(a=>a.sendInput),g=te(a=>a.terminalFontId),J=te(a=>a.terminalFontSize),f=te(a=>a.terminalLineHeight),{t:P}=Ee(),L=r.useMemo(()=>{switch(i){case"light":return We;default:return Fe}},[i]),z=r.useRef(null),H=r.useRef(null),w=r.useRef(null),m=r.useRef(n),y=r.useRef(e),N=r.useRef(n),O=r.useRef(e),h=r.useRef(p&&!E),v=r.useRef(c),_=r.useRef(L),D=r.useRef(!1),T=r.useRef(!1),U=r.useRef(null),Y=r.useRef(!1),X=r.useCallback((a,l,C)=>{!(a!=null&&a.exportModeSnapshot)||!l||!C||Vt(l,C,a.exportModeSnapshot())},[]),se=r.useCallback(()=>s,[s]);qt(z,se),r.useEffect(()=>{m.current=n,y.current=e,T.current=!1},[n,e]),r.useEffect(()=>{h.current=p&&!E},[p,E]),r.useEffect(()=>{v.current=c},[c]),r.useEffect(()=>{_.current=L},[L]);const k=r.useCallback(a=>{if(!a||c!=="direct"||!h.current)return;const l=m.current,C=y.current;!l||!C||q(l,C,a,!1)},[c,q]),{pendingLocalSize:ne,scheduleResize:A,runPostSelectResize:M,setFitAddon:j,setTerminal:B}=Xt({deviceId:n,paneId:e,deviceConnected:p,isSelectionInvalid:E,onResize:S,onSync:x,getContainerRect:()=>{const a=z.current;if(!a)return null;const l=a.getBoundingClientRect();return{width:l.width,height:l.height}}});r.useEffect(()=>{let a=!1,l=null;return(async()=>{if(await tt(g,J),a)return;const C=await Rt({fontFamily:nt(g),fontSize:J,lineHeight:f,scrollback:Gt,theme:_.current,disableStdin:v.current==="editor"});if(a){C.dispose();return}l=C,H.current&&C.open(H.current),Zt(C),I(C)})(),()=>{a=!0,I(null),en(l),l==null||l.dispose()}},[g,J,f]),r.useEffect(()=>{!s||!("setTheme"in s)||s.setTheme(L)},[s,L]),r.useEffect(()=>{!s||!("setDisableStdin"in s)||s.setDisableStdin(c==="editor")},[s,c]),r.useEffect(()=>{if(!(s!=null&&s.getCursorViewportRect))return;const a=()=>{var l;return((l=s.getCursorViewportRect)==null?void 0:l.call(s))??null};return ot(a),()=>rt(a)},[s]),r.useEffect(()=>{!s||c!=="direct"||window.innerWidth<768||"ontouchstart"in window||s.focus()},[s,c]);const re=r.useMemo(()=>s?{onResetTerminal:a=>{m.current===a&&(X(s,N.current,O.current),Y.current=!0,s.reset(),D.current=!1,M())},onApplyHistory:(a,l,C)=>{var oe;if(m.current!==a)return;const W=Qt(Kt(m.current,y.current),C);W&&((oe=s.restoreModeSnapshot)==null||oe.call(s,W));const Z=C?Ft(l):Ue(l);T.current=!0,s.write(Z),Y.current=!1,N.current=m.current,O.current=y.current,X(s,m.current,y.current)},onFlushBuffer:(a,l)=>{if(m.current===a){for(const C of l){const W=ze(C,D.current);D.current=W.endedWithCR,s.write(W.normalized)}T.current&&(s.buffer.active.baseY<=1&&s.scrollToTop(),T.current=!1),N.current=m.current,O.current=y.current,X(s,m.current,y.current)}},onOutput:(a,l,C)=>{if(m.current!==a||y.current!==l)return;const W=ze(C,D.current);D.current=W.endedWithCR,s.write(W.normalized),T.current&&(s.buffer.active.baseY<=1&&s.scrollToTop(),T.current=!1),N.current=m.current,O.current=y.current,X(s,m.current,y.current)}}:{},[s,X,M]);r.useEffect(()=>{s?U.current!==s&&(D.current=!1,N.current=m.current,O.current=y.current,U.current=s):U.current=null},[s]),r.useEffect(()=>{if(!(!s||!n||!e))return()=>{if(Y.current){Y.current=!1;return}X(s,N.current,O.current)}},[n,s,e,X]),r.useEffect(()=>{_e(re)},[re]),r.useEffect(()=>()=>{_e({})},[]),r.useEffect(()=>{if(!s){w.current=null,j(null),B(null);return}const a=new kt;return s.loadAddon(a),w.current=a,j(a),B(s),M(),()=>{try{a.dispose()}finally{w.current=null,j(null),B(null)}}},[s,M,j,B]),r.useEffect(()=>{const a=z.current;if(!a)return;let l=null;const C=new ResizeObserver(()=>{l!==null&&cancelAnimationFrame(l),l=requestAnimationFrame(()=>{l=null,A("resize")})});return C.observe(a),()=>{C.disconnect(),l!==null&&cancelAnimationFrame(l)}},[A]),r.useEffect(()=>{if(!s||!n||!e)return;const a=s.onData(l=>{!p||E||k(l)});return s.attachCustomKeyEventHandler(l=>!p||E||l.type!=="keydown"||c!=="direct"?!0:l.shiftKey&&l.key==="Enter"?(l.preventDefault(),k("\x1B[13;2u"),!1):!0),()=>{a.dispose(),s.attachCustomKeyEventHandler(()=>!0)}},[s,p,E,c,k,n,e]),r.useEffect(()=>{if(!(s!=null&&s.onLinkActivated))return;const a=s.onLinkActivated(l=>{window.open(l,"_blank","noopener,noreferrer")});return()=>a.dispose()},[s]),r.useEffect(()=>{if(!(s!=null&&s.onSelectionChange)){K(!1);return}const a=s.onSelectionChange(l=>{K(!!l)});return()=>{a.dispose(),K(!1)}},[s]);const ve=r.useCallback(()=>{var l;if(!s)return;const a=((l=s.getSelection)==null?void 0:l.call(s))??"";a&&st(a).then(()=>{xe.success(P("terminal.copied"))}).catch(()=>{xe.error(P("terminal.copyFailed"))}).finally(()=>{var C;(C=s.clearSelection)==null||C.call(s),s.focus()})},[s,P]),ae=r.useCallback(()=>{var l;if(!s)return;((l=navigator.clipboard)!=null&&l.readText?navigator.clipboard.readText():Promise.reject(new Error("clipboard unavailable"))).then(C=>{var W;C&&s.paste(C),(W=s.clearSelection)==null||W.call(s),s.focus()}).catch(()=>{xe.error(P("terminal.pasteFailed"))})},[s,P]),Te=r.useCallback(()=>{var a;(a=s==null?void 0:s.clearSelection)==null||a.call(s),s==null||s.focus()},[s]);return r.useImperativeHandle(G,()=>({write:a=>s==null?void 0:s.write(a),reset:()=>{s==null||s.reset(),D.current=!1},scrollToBottom:()=>s==null?void 0:s.scrollToBottom(),resize:(a,l)=>s==null?void 0:s.resize(a,l),getTerminal:()=>s??null,getSize:()=>s?{cols:Math.max(2,s.cols),rows:Math.max(2,s.rows)}:null,runPostSelectResize:()=>M(),scheduleResize:(a,l)=>A(a,l),calculateSizeFromContainer:()=>{var ue,ce,Q,he,de,we,be,Re,ke,Ce,Ie,Se,t,d,u,b;const a=z.current,l=s,C=w.current;if(!a||!l)return null;const W=a.getBoundingClientRect();if(W.width===0||W.height===0)return null;const Z=l._core;let oe;if(C)try{const $=C.proposeDimensions();if($)oe=Math.max(2,$.cols);else{const ee=((he=(Q=(ce=(ue=Z==null?void 0:Z._renderService)==null?void 0:ue.dimensions)==null?void 0:ce.css)==null?void 0:Q.cell)==null?void 0:he.width)??9;oe=Math.max(2,Math.floor(W.width/ee))}}catch{const $=((Re=(be=(we=(de=Z==null?void 0:Z._renderService)==null?void 0:de.dimensions)==null?void 0:we.css)==null?void 0:be.cell)==null?void 0:Re.width)??9;oe=Math.max(2,Math.floor(W.width/$))}else{const $=((Se=(Ie=(Ce=(ke=Z==null?void 0:Z._renderService)==null?void 0:ke.dimensions)==null?void 0:Ce.css)==null?void 0:Ie.cell)==null?void 0:Se.width)??9;oe=Math.max(2,Math.floor(W.width/$))}const ie=((b=(u=(d=(t=Z==null?void 0:Z._renderService)==null?void 0:t.dimensions)==null?void 0:d.css)==null?void 0:u.cell)==null?void 0:b.height)??17,ge=Math.max(2,Math.floor(W.height/ie));return{cols:oe,rows:ge}},getPendingLocalSize:()=>ne.current}),[s,ne,M,A]),o.jsxs("div",{className:"flex h-full w-full flex-col",style:{backgroundColor:L.background},"data-terminal-engine":qe,children:[o.jsxs("div",{ref:z,className:"relative min-h-0 w-full flex-1",children:[o.jsx("div",{ref:H,className:"absolute inset-0"}),o.jsx(zt,{visible:F,canPaste:c==="direct"&&p&&!E,onCopy:ve,onPaste:ae,onDismiss:Te})]}),R]})});Ye.displayName="Terminal";const tn=1200,nn=2e3;function fe(n,e){return!n||!e?!1:n.windowId===e.windowId&&n.paneId===e.paneId}function Xe(n,e){const i=n.filter(c=>e-c.at<tn);return i.length===0?null:i.reduce((c,p)=>p.at>c.at?p:c)}function ye(n,e=Date.now()){return!n||e-n.at>nn?null:n}function rn(n){const e=n.now??Date.now(),i=Xe(n.recentSelectRequests,e);if(i&&!fe(i,n.activePaneFromEvent)||fe(n.currentRoute,n.activePaneFromEvent)||fe(n.lastHandledActive,n.activePaneFromEvent))return!0;const c=ye(n.pendingUserSelection,e);return!!(c&&!fe(c,n.activePaneFromEvent))}function sn(n){const e=n.now??Date.now(),i=Xe(n.recentSelectRequests,e),c=ye(n.pendingUserSelection,e);return!!(c&&!fe(c,n.snapshotActive)||i&&!fe(i,n.snapshotActive))}function on(n){const e=n.now??Date.now(),i=ye(n.pendingUserSelection,e);return!(i&&fe(i,n.routeTarget)||n.snapshotActive&&fe(n.snapshotActive,n.routeTarget))}const cn=[{key:"enter",label:"ENTER",payload:"\r"},{key:"ctrl-c",label:"CTRL-C",payload:""},{key:"ctrl-d",label:"CTRL-D",payload:""},{key:"up",label:"↑",payload:"\x1B[A"},{key:"down",label:"↓",payload:"\x1B[B"},{key:"left",label:"←",payload:"\x1B[D"},{key:"right",label:"→",payload:"\x1B[C"},{key:"shift-enter",label:"SHIFT+ENTER",payload:"\x1B[13;2u"},{key:"tab",label:"TAB",payload:" "},{key:"backspace",label:"BACKSPACE",payload:"\b"},{key:"esc",label:"ESC",payload:"\x1B"},{key:"delete",label:"DELETE",payload:""},{key:":",label:":",payload:":"},{key:"/",label:"/",payload:"/"},{key:"'",label:"'",payload:"'"},{key:'"',label:'"',payload:'"'},{key:"`",label:"`",payload:"`"}],Be=r.memo(function({onSend:e,onFocusEditor:i,disabled:c,isMobile:p,inputMode:E}){return o.jsx("div",{className:"terminal-shortcuts-strip","data-testid":"terminal-shortcuts-strip",children:o.jsx("div",{className:"shortcut-row flex items-center gap-1.5 py-2 overflow-x-auto scrollbar-thin","data-testid":"editor-shortcuts-row",children:cn.map(S=>o.jsx(le,{variant:"ghost",size:"sm",className:"terminal-shortcut-btn h-7 min-w-9 px-2.5 rounded-full text-[11px] font-medium tracking-wide shrink-0 [@media(any-pointer:coarse)]:h-9 [@media(any-pointer:coarse)]:min-w-10 [@media(any-pointer:coarse)]:px-3",title:S.label,"aria-label":S.label,"data-testid":`editor-shortcut-${S.key}`,onMouseDown:x=>x.preventDefault(),onClick:()=>{e(S.payload),p&&E==="editor"&&(i==null||i())},disabled:c,children:S.label},S.key))})})});function un(){var Se;const{t:n}=Ee(),{deviceId:e,windowId:i,paneId:c}=Pe(),p=it(),E=r.useRef(null),S=r.useRef(null),x=r.useRef(null),R=r.useRef(null),G=r.useRef(!1),s=r.useRef(!1),I=r.useRef(null),F=V(t=>t.selectPane),K=V(t=>e?t.snapshots[e]:void 0),q=V(t=>{var d;return e?(d=t.deviceErrors)==null?void 0:d[e]:void 0}),g=V(t=>{var d;return e?((d=t.deviceConnected)==null?void 0:d[e])??!1:!1}),J=He(t=>{var d;return((d=t.settings)==null?void 0:d.siteName)??"tmex"}),f=r.useMemo(()=>Le(c),[c]),P=r.useMemo(()=>e&&f?`${e}:${f}`:null,[e,f]),[L,z]=r.useState(!1),[H,w]=r.useState(""),m=r.useRef(!1),y=!g||!f,[N,O]=r.useState(!1),h=te(t=>t.inputMode),v=te(t=>t.theme),_=te(t=>t.editorSendWithEnter),D=te(t=>t.setEditorSendWithEnter),T=te(t=>t.addEditorHistory),U=te(t=>t.setEditorDraft),Y=te(t=>t.removeEditorDraft),X=te(t=>P?t.editorDrafts[P]??"":""),se=r.useMemo(()=>ct(),[]),k=(Se=K==null?void 0:K.session)==null?void 0:Se.windows,ne=v==="light"?We:Fe,{data:A}=$e({queryKey:["devices"],queryFn:async()=>{const t=await fetch("/api/devices");if(!t.ok)throw new Error("Failed to fetch devices");return t.json()},throwOnError:!1}),M=r.useMemo(()=>{if(e)return A==null?void 0:A.devices.find(t=>t.id===e)},[e,A==null?void 0:A.devices]),j=r.useMemo(()=>{if(!(!i||!k))return k.find(t=>t.id===i)},[i,k]),B=r.useMemo(()=>{if(!(!f||!j))return j.panes.find(t=>t.id===f)},[f,j]),re=!!k,a=!!(re&&!!i&&!j||re&&!!i&&!!f&&!!j&&!B?n("wsError.checkGateway"):null),l=!!(g&&f&&!a),C=r.useMemo(()=>{if(!j||!B)return null;const t=(M==null?void 0:M.name)??e;return Oe({paneIdx:B.index,windowIdx:j.index,paneTitle:B.title,windowName:j.name,windowCustomName:j.customName,deviceName:t})},[M==null?void 0:M.name,e,B,j]),W=r.useMemo(()=>{if(!k||k.length===0)return null;const t=k.find(u=>u.active),d=t==null?void 0:t.panes.find(u=>u.active);return!t||!d?null:{windowId:t.id,paneId:d.id}},[k]),Z=r.useCallback((t,d)=>{!e||!f||V.getState().resizePane(e,f,t,d)},[e,f]),oe=r.useCallback((t,d)=>{!e||!f||V.getState().syncPaneSize(e,f,t,d)},[e,f]),ie=r.useCallback((t,d)=>{const u=R.current,b=(u==null?void 0:u.calculateSizeFromContainer())??(u==null?void 0:u.getSize())??void 0;if(b)return b;if(!t||!d||!k)return;const $=k.find(me=>me.id===t),ee=$==null?void 0:$.panes.find(me=>me.id===d);if(!(!ee||ee.width<=1||ee.height<=1))return{cols:ee.width,rows:ee.height}},[k]);r.useEffect(()=>{const t=()=>{z(window.innerWidth<768||"ontouchstart"in window)};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]),r.useEffect(()=>{if(!L||!se||s.current)return;s.current=!0;const t=()=>{window.scrollTo(0,1)},d=window.requestAnimationFrame(t),u=window.setTimeout(t,120),b=window.setTimeout(t,420);return()=>{window.cancelAnimationFrame(d),window.clearTimeout(u),window.clearTimeout(b)}},[se,L]),r.useEffect(()=>{e&&(G.current=!1,he.current=null,de.current=null,I.current=null,ue.current=[])},[e]),r.useEffect(()=>{g||(G.current=!1)},[g]),r.useEffect(()=>{if(!e||!g||!i||!k)return;if(k.length===0){p("/devices",{replace:!0});return}const t=k.find(u=>u.id===i);if(!t)return;if(!f){const u=t.panes.find(b=>b.active)??t.panes[0];u&&p(`/devices/${e}/windows/${i}/panes/${pe(u.id)}`,{replace:!0});return}if(!t.panes.find(u=>u.id===f)){const u=t.panes.find(b=>b.active)??t.panes[0];u&&p(`/devices/${e}/windows/${i}/panes/${pe(u.id)}`,{replace:!0});return}},[e,g,k,i,f,p]),r.useEffect(()=>{if(!e||!g||!k||k.length===0||i&&f||G.current)return;const t=k.find(u=>u.active)??k[0],d=t.panes.find(u=>u.active)??t.panes[0];d&&(G.current=!0,p(`/devices/${e}/windows/${t.id}/panes/${pe(d.id)}`,{replace:!0}))},[g,e,p,f,i,k]);const ge=r.useRef(null);r.useEffect(()=>{ge.current=null},[e,f]),r.useEffect(()=>{if(!e||!i||!f||y||!g)return;const t=`${e}:${i}:${f}`;if(ge.current===t)return;ge.current=t;const d=ie(i,f);ce(i,f),F(e,i,f,d)},[g,e,ie,y,f,F,i]),r.useEffect(()=>{if(!e||!g||!i||!f)return;const t={windowId:i,paneId:f};on({routeTarget:t,snapshotActive:W,pendingUserSelection:I.current})&&(I.current={windowId:t.windowId,paneId:t.paneId,at:Date.now()})},[g,e,f,W,i]);const ue=r.useRef([]),ce=r.useCallback((t,d)=>{const u=Date.now(),b=[...ue.current.filter($=>u-$.at<2e3),{windowId:t,paneId:d,at:u}];ue.current=b.slice(-8)},[]),Q=V(t=>e?t.activePaneFromEvent[e]:void 0),he=r.useRef(null);r.useEffect(()=>{if(!e||!g||!i||!f||!Q)return;const t=Date.now(),d=ye(I.current,t);if(I.current=d,rn({now:t,pendingUserSelection:d,activePaneFromEvent:Q,currentRoute:{windowId:i,paneId:f},recentSelectRequests:ue.current,lastHandledActive:he.current}))return;he.current={...Q},d&&d.windowId===Q.windowId&&d.paneId===Q.paneId&&(I.current=null);const u=ie(Q.windowId,Q.paneId);ce(Q.windowId,Q.paneId),F(e,Q.windowId,Q.paneId,u),p(`/devices/${e}/windows/${Q.windowId}/panes/${pe(Q.paneId)}`,{replace:!0})},[e,g,i,f,Q,ce,ie,F,p]);const de=r.useRef(null);r.useEffect(()=>{if(!e||!g||!k||k.length===0)return;const t=ue.current,d=k.find(Ne=>Ne.active);if(!d)return;const u=d.panes.find(Ne=>Ne.active);if(!u)return;const b={windowId:d.id,paneId:u.id},$=Date.now(),ee=ye(I.current,$);if(I.current=ee,sn({now:$,pendingUserSelection:ee,snapshotActive:b,recentSelectRequests:t})||de.current&&de.current.windowId===b.windowId&&de.current.paneId===b.paneId||(de.current={...b},ee&&ee.windowId===b.windowId&&ee.paneId===b.paneId&&(I.current=null),i===b.windowId&&f===b.paneId))return;const me=ie(b.windowId,b.paneId);ce(b.windowId,b.paneId),F(e,b.windowId,b.paneId,me),p(`/devices/${e}/windows/${b.windowId}/panes/${pe(b.paneId)}`,{replace:!0})},[e,g,k,i,f,ce,ie,F,p]);const we=V(t=>e?t.pendingCreateWindowAt[e]:void 0);r.useEffect(()=>{if(!e||!g||!we)return;const t=5e3,d=Date.now()-we;if(d>t){V.getState().clearPendingCreateWindow(e);return}if(!W){const $=window.setTimeout(()=>{V.getState().clearPendingCreateWindow(e)},t-d);return()=>window.clearTimeout($)}const u=W;if(i===u.windowId&&f===u.paneId){const $=window.setTimeout(()=>{V.getState().clearPendingCreateWindow(e)},t-d);return()=>window.clearTimeout($)}I.current={windowId:u.windowId,paneId:u.paneId,at:Date.now()};const b=ie(u.windowId,u.paneId);ce(u.windowId,u.paneId),F(e,u.windowId,u.paneId,b),p(`/devices/${e}/windows/${u.windowId}/panes/${pe(u.paneId)}`,{replace:!0}),V.getState().clearPendingCreateWindow(e)},[e,g,we,W,i,f,ce,ie,F,p]),r.useEffect(()=>{if(!l||!B||y)return;const t=R.current,d=t==null?void 0:t.getTerminal();if(!d)return;const u=Math.max(2,Math.floor(B.width||0)),b=Math.max(2,Math.floor(B.height||0));if(!u||!b)return;const $=Date.now(),ee={cols:u,rows:b},me=(t==null?void 0:t.getPendingLocalSize())??null;Ut({now:$,remoteSize:ee,pendingLocalSize:me})&&(d.cols===u&&d.rows===b||d.resize(u,b))},[l,y,B]),r.useEffect(()=>{const t=window.requestAnimationFrame(()=>{var u;(u=R.current)==null||u.scrollToBottom()}),d=window.setTimeout(()=>{var u;(u=R.current)==null||u.scrollToBottom()},120);return()=>{window.cancelAnimationFrame(t),window.clearTimeout(d)}},[h]),r.useEffect(()=>{q!=null&&q.message&&xe.error(q.message)},[q==null?void 0:q.message]),r.useEffect(()=>(document.title=at(C),()=>{document.title=J}),[J,C]),r.useEffect(()=>{const t=()=>{var d;(d=R.current)==null||d.scrollToBottom()};return window.addEventListener("tmex:jump-to-latest",t),()=>{window.removeEventListener("tmex:jump-to-latest",t)}},[]),r.useEffect(()=>{const t=d=>{const{deviceId:u,windowId:b,paneId:$}=d.detail;u===e&&(I.current={windowId:b,paneId:$,at:Date.now()})};return window.addEventListener("tmex:user-initiated-selection",t),()=>{window.removeEventListener("tmex:user-initiated-selection",t)}},[e]),r.useEffect(()=>{w(X)},[X]);const be=r.useCallback(t=>{if(!e||!f||!l)return;V.getState().sendInput(e,f,t,!1)},[l,e,f]),Re=r.useCallback(()=>{if(!l){xe.error(n("wsError.checkGateway"));return}if(!e||!f||!H.trim())return;O(!0),window.setTimeout(()=>O(!1),150);const t=_?`${H}\r`:H;V.getState().sendInput(e,f,t,!1),T(H),P&&Y(P),w("")},[T,l,e,P,_,H,Y,f,n]),ke=r.useCallback(()=>{if(!l){xe.error(n("wsError.checkGateway"));return}if(!e||!f||!H.trim())return;O(!0),window.setTimeout(()=>O(!1),150);const t=H.split(/\r?\n/),d=V.getState();for(const u of t)u.trim()&&d.sendInput(e,f,`${u}\r`,!1);T(H),P&&Y(P),w("")},[T,l,e,P,H,Y,f,n]),Ce=r.useCallback(()=>{var t;(t=x.current)==null||t.focus({preventScroll:!0})},[]);if(!e)return o.jsx("div",{className:"flex h-full items-center justify-center p-4",children:o.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground",children:n("device.noDevices")})});const Ie=!g&&!q;return o.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background","data-testid":"device-page",children:[o.jsxs("div",{className:`flex-1 relative overflow-hidden min-h-0 min-w-0 ${L&&h==="editor"?"pb-1":""}`,children:[o.jsx("div",{className:"h-full px-3 py-1 min-h-0 min-w-0 w-full relative flex rounded-xl",style:{backgroundColor:ne.background},children:g&&f?o.jsx("div",{ref:E,className:"flex-1 h-full min-h-0 w-full","data-virtual-keyboard-avoid":!0,children:o.jsx(Ye,{ref:R,deviceId:e,paneId:f,theme:v,inputMode:h,deviceConnected:g,isSelectionInvalid:a,onResize:Z,onSync:oe,children:h==="direct"&&o.jsx("div",{className:"kb-floating-shortcuts",style:{backgroundColor:ne.background},children:o.jsx(Be,{onSend:be,disabled:!l,isMobile:L,inputMode:h})})},`${e}:${f}`)}):o.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center p-8 text-center",children:o.jsx("div",{className:"max-w-sm space-y-4",children:g?i?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center mx-auto",children:o.jsx(Me,{className:"h-6 w-6 text-muted-foreground animate-spin"})}),o.jsx("h3",{className:"text-lg font-medium",children:n("terminal.connecting")})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center mx-auto",children:o.jsx("span",{className:"text-2xl text-muted-foreground",children:"📋"})}),o.jsx("h3",{className:"text-lg font-medium",children:n("window.noWindowSelected")}),o.jsx("p",{className:"text-sm text-muted-foreground",children:n("window.selectWindowToStart")})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center mx-auto",children:o.jsx("span",{className:"text-2xl text-muted-foreground",children:"🔌"})}),o.jsx("h3",{className:"text-lg font-medium",children:n("device.disconnected")}),o.jsx("p",{className:"text-sm text-muted-foreground",children:n("device.connectToStart")})]})})})}),Ie&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/85 backdrop-blur-sm","data-testid":"terminal-status-overlay",children:o.jsxs("div",{className:"flex flex-col items-center gap-2 rounded-lg border border-border bg-card/90 px-4 py-3 shadow-sm",children:[o.jsx("div",{className:"h-7 w-7 rounded-full border-2 border-primary border-t-transparent animate-spin"}),o.jsx("span",{className:"text-xs text-muted-foreground","data-testid":"terminal-status-text",children:n("terminal.connecting")})]})})]}),h==="editor"&&o.jsxs("div",{ref:S,"data-virtual-keyboard-avoid":!0,className:"editor-mode-input bg-card/85 backdrop-blur-sm",children:[L&&o.jsx(Be,{onSend:be,onFocusEditor:Ce,disabled:!l,isMobile:L,inputMode:h}),o.jsx("textarea",{ref:x,"data-testid":"editor-input",className:"min-h-[88px] max-h-[28vh] w-full resize-y rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground shadow-xs outline-none transition-colors focus:border-ring",value:H,onChange:t=>{const d=t.target.value;if(w(d),!!P){if(d){U(P,d);return}Y(P)}},placeholder:n("terminal.inputPlaceholder"),onCompositionStart:()=>{m.current=!0},onCompositionEnd:()=>{m.current=!1}}),o.jsx("div",{className:"actions mt-2",children:o.jsxs("div",{className:"send-row flex flex-wrap items-center justify-end gap-2","data-testid":"editor-send-row",children:[o.jsxs("div",{className:"send-with-enter-toggle mr-auto flex items-center gap-2 text-xs text-muted-foreground","data-testid":"editor-send-with-enter-toggle",children:[o.jsx(lt,{size:"sm",checked:_,onCheckedChange:t=>D(!!t)}),o.jsx("span",{children:n("terminal.editorSendWithEnter")})]}),o.jsxs(le,{variant:"outline",size:"sm","data-testid":"editor-clear",onMouseDown:t=>t.preventDefault(),onClick:()=>{var t;w(""),P&&Y(P),L&&h==="editor"&&((t=x.current)==null||t.focus({preventScroll:!0}))},title:n("terminal.clear"),children:[o.jsx(ut,{className:"h-4 w-4"}),n("terminal.clear")]}),o.jsxs(le,{variant:"secondary",size:"sm","data-testid":"editor-send-line-by-line",onMouseDown:t=>t.preventDefault(),onClick:()=>{var t;ke(),L&&h==="editor"&&((t=x.current)==null||t.focus({preventScroll:!0}))},disabled:!l||N,children:[N?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):o.jsx(De,{className:"h-4 w-4"}),n("terminal.editorSendLineByLine")]}),o.jsxs(le,{variant:"default",size:"sm","data-testid":"editor-send",onMouseDown:t=>t.preventDefault(),onClick:()=>{var t;Re(),L&&h==="editor"&&((t=x.current)==null||t.focus({preventScroll:!0}))},disabled:!l||N,children:[N?o.jsx(Me,{className:"h-4 w-4 animate-spin"}):o.jsx(De,{className:"h-4 w-4"}),n("common.send")]})]})})]})]})}function dn(){const{deviceId:n,windowId:e,paneId:i}=Pe(),c=i?Le(i):void 0,p=V(s=>s.snapshots),E=He(s=>{var I;return((I=s.settings)==null?void 0:I.siteName)??"tmex"}),S=n?p[n]:void 0,x=r.useMemo(()=>{var s;if(!(!e||!((s=S==null?void 0:S.session)!=null&&s.windows)))return S.session.windows.find(I=>I.id===e)},[e,S]),R=r.useMemo(()=>{if(!(!c||!x))return x.panes.find(s=>s.id===c)},[c,x]),G=r.useMemo(()=>x&&R?Oe({paneIdx:R.index,windowIdx:x.index,paneTitle:R.title,windowName:x.name,windowCustomName:x.customName,deviceName:E}):n??"",[x,R,E,n]);return o.jsx(o.Fragment,{children:G})}function fn(){const{t:n}=Ee(),{deviceId:e,paneId:i}=Pe(),c=i?Le(i):void 0,p=te(z=>z.inputMode),E=te(z=>z.setInputMode),S=V(z=>{var H;return e?((H=z.deviceConnected)==null?void 0:H[e])??!1:!1}),[x,R]=r.useState(!1),[G,s]=r.useState(!1),[I,F]=r.useState(!1),K=!!(c&&S),g=($e({queryKey:Et(e??"",c??""),queryFn:()=>yt(e??"",c??""),enabled:!!(e&&c),throwOnError:!1}).data??[]).some(z=>z.enabled),J=()=>{E(p==="direct"?"editor":"direct")},f=()=>{window.dispatchEvent(new CustomEvent("tmex:jump-to-latest"))},P=()=>{R(!0)},L=()=>{window.location.reload()};return o.jsxs(o.Fragment,{children:[o.jsx(le,{variant:"ghost",size:"icon-sm",onClick:P,"aria-label":n("nav.refreshPage"),title:n("nav.refreshPage"),children:o.jsx(Ct,{className:"h-4 w-4"})}),o.jsx(le,{variant:"ghost",size:"icon-sm",onClick:J,disabled:!K,"data-testid":"terminal-input-mode-toggle","aria-label":n(p==="direct"?"nav.switchToEditor":"nav.switchToDirect"),title:n(p==="direct"?"nav.switchToEditor":"nav.switchToDirect"),children:p==="direct"?o.jsx(dt,{className:"h-4 w-4"}):o.jsx(_t,{className:"h-4 w-4"})}),o.jsx(le,{variant:"ghost",size:"icon-sm",onClick:f,disabled:!K,"aria-label":n("nav.jumpToLatest"),title:n("nav.jumpToLatest"),children:o.jsx(jt,{className:"h-4 w-4"})}),o.jsxs(le,{variant:"ghost",size:"icon-sm",className:"relative",onClick:()=>s(!0),disabled:!c,"data-testid":"watch-open-button","aria-label":n("watch.title"),title:n("watch.title"),children:[o.jsx(ft,{className:"h-4 w-4"}),g&&o.jsx("span",{className:"absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-primary","data-testid":"watch-active-indicator"})]}),o.jsx(le,{variant:"ghost",size:"icon-sm",onClick:()=>F(!0),"data-testid":"keyboard-behavior-open-button","aria-label":n("settings.terminal.title"),title:n("settings.terminal.title"),children:o.jsx(Pt,{className:"h-4 w-4"})}),o.jsx(Dt,{open:I,onOpenChange:F}),e&&c&&o.jsx(mt,{open:G,onOpenChange:s,deviceId:e,paneId:c}),o.jsx(ht,{open:x,onOpenChange:R,children:o.jsxs(wt,{children:[o.jsxs(pt,{children:[o.jsx(xt,{children:n("nav.refreshPage")}),o.jsx(vt,{children:n("nav.refreshPageConfirm")})]}),o.jsxs(gt,{children:[o.jsx(bt,{onClick:()=>R(!1),children:n("common.cancel")}),o.jsx(St,{onClick:L,children:n("common.confirm")})]})]})})]})}export{fn as PageActions,dn as PageTitle,un as default};
|
|
25
|
-
//# sourceMappingURL=DevicePage-
|
|
25
|
+
//# sourceMappingURL=DevicePage-Cc6BDsCB.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as D,r as x,a as W,b as ae,c as ie,d as re,e as K,t as ne,j as e,M as _,B as C,P as X,A as oe,f as ce,g as de,h as le,T as Y,i as me,k as he,l as ue,m as pe,n as xe,G as ve,o as v,D as fe,p as ye,E as ge,q as je,s as A,v as we,Z as Ne,w as Ce,x as Q,y as De,S as be,L as Se,z as Ee,C as Me,F as Pe,H as Ke,I as Re,J as Ie,K as f,N as z,O as V,Q as U,R as J,U as j,V as ke,W as Ae}from"./index-Ra6pj0rt.js";import{C as M,a as P,b as $e,c as Te,d as Fe}from"./card-BkRqR9zz.js";function R(s){const o=s.trim();return o||void 0}function qe(s){return s?{name:s.name,type:s.type,host:s.host??"",port:s.port??22,username:s.username??"",sshConfigRef:s.sshConfigRef??"",session:s.session??"tmex",authMode:s.type==="local"?"auto":s.authMode,password:"",privateKey:"",privateKeyPassphrase:""}:{name:"",type:"local",host:"",port:22,username:"root",sshConfigRef:"",session:"tmex",authMode:"auto",password:"",privateKey:"",privateKeyPassphrase:""}}function Le(s){if(s.type==="local")return{name:s.name.trim(),type:"local",session:R(s.session)??"tmex",authMode:"auto"};const o={name:s.name.trim(),type:"ssh",host:s.host.trim(),port:s.port,username:s.username.trim(),session:R(s.session)??"tmex",authMode:s.authMode};return s.authMode==="configRef"&&(o.sshConfigRef=s.sshConfigRef.trim()),s.authMode==="password"&&(o.password=s.password),s.authMode==="key"&&(o.privateKey=s.privateKey,o.privateKeyPassphrase=s.privateKeyPassphrase||void 0),o}function He(s){if(s.type==="local")return{name:s.name.trim(),session:R(s.session)??"tmex",authMode:"auto"};const o={name:s.name.trim(),host:s.host.trim(),port:s.port,username:s.username.trim(),sshConfigRef:s.authMode==="configRef"?s.sshConfigRef.trim():"",session:R(s.session)??"tmex",authMode:s.authMode};return s.authMode==="password"&&s.password&&(o.password=s.password),s.authMode==="key"&&s.privateKey&&(o.privateKey=s.privateKey,o.privateKeyPassphrase=s.privateKeyPassphrase||void 0),o}function ee(s){return Number.isInteger(s)&&s>=1&&s<=65535}function Oe(s){return s.type!=="ssh"?null:s.host.trim()?ee(s.port)?s.username.trim()?s.authMode==="configRef"&&!s.sshConfigRef.trim()?"validation.sshConfigRequired":null:"validation.usernameRequired":"validation.portRequired":"validation.hostRequired"}async function G(s,o){try{return(await s.json()).error??o}catch{return o}}function Ve(){const{t:s}=D(),[o,m]=x.useState(!1),[t,y]=x.useState(null),[r,d]=x.useState(null),l=W(),u=ae(n=>{var p;return((p=n.settings)==null?void 0:p.language)??"en_US"});x.useEffect(()=>{const n=()=>m(!0);return window.addEventListener("tmex:open-add-device",n),()=>window.removeEventListener("tmex:open-add-device",n)},[]);const{data:c,isLoading:I,isError:w}=ie({queryKey:["devices"],queryFn:async()=>{const n=await fetch("/api/devices");if(!n.ok)throw new Error(s("device.loadFailed"));return n.json()},throwOnError:!1}),b=re(n=>n.hydrateDeviceErrors);x.useEffect(()=>{c!=null&&c.devices&&b(c.devices.map(n=>({deviceId:n.id,lastError:n.lastError??null,lastErrorType:n.lastErrorType??null})))},[c,b]);const S=K({mutationFn:async n=>{if(!(await fetch(`/api/devices/${n}`,{method:"DELETE"})).ok)throw new Error(s("device.deleteFailed"))},onSuccess:()=>{l.invalidateQueries({queryKey:["devices"]}),v.success(s("common.success"))},onError:n=>{v.error(n instanceof Error?n.message:s("common.error"))}}),E=x.useMemo(()=>[...(c==null?void 0:c.devices)??[]].sort((p,N)=>p.sortOrder-N.sortOrder||p.name.localeCompare(N.name,ne(u),{numeric:!0,sensitivity:"base"})),[c==null?void 0:c.devices,u]);return e.jsxs("div",{className:"mx-auto flex w-full max-w-6xl flex-col gap-3 p-3 pb-[calc(1rem+env(safe-area-inset-bottom))] sm:gap-4 sm:p-5","data-testid":"devices-page",children:[I?e.jsx(M,{children:e.jsx(P,{className:"py-16 text-center text-sm text-muted-foreground",children:s("common.loading")})}):w?e.jsx(M,{children:e.jsx(P,{className:"py-16 text-center text-sm text-destructive",children:s("device.loadFailed")})}):E.length===0?e.jsx(M,{children:e.jsxs(P,{className:"space-y-4 py-14 text-center",children:[e.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-xl border border-border bg-muted",children:e.jsx(_,{className:"h-6 w-6 text-muted-foreground"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{className:"text-lg font-medium",children:s("device.noDevices")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("device.addDevice")})]}),e.jsxs(C,{variant:"default","data-testid":"devices-add-empty",onClick:()=>m(!0),children:[e.jsx(X,{className:"h-4 w-4"}),s("device.addDevice")]})]})}):e.jsx("div",{className:"grid gap-3 lg:grid-cols-2",children:E.map(n=>e.jsx(Be,{device:n,onEdit:()=>y(n),onDelete:()=>d(n)},n.id))}),o&&e.jsx(Z,{mode:"create",onClose:()=>m(!1)}),t&&e.jsx(Z,{mode:"edit",device:t,onClose:()=>y(null)}),e.jsx(oe,{open:r!==null,onOpenChange:n=>!n&&d(null),children:e.jsxs(ce,{children:[e.jsxs(de,{children:[e.jsx(le,{className:"bg-destructive/10",children:e.jsx(Y,{className:"h-5 w-5 text-destructive"})}),e.jsx(me,{children:s("device.deleteConfirm")}),e.jsx(he,{children:s("device.deleteDescription",{name:(r==null?void 0:r.name)??""})})]}),e.jsxs(ue,{children:[e.jsx(pe,{children:s("common.cancel")}),e.jsx(xe,{variant:"destructive",disabled:!r||S.isPending,onClick:()=>{r&&(S.mutate(r.id),d(null))},children:s("common.delete")})]})]})})]})}function Be({device:s,onEdit:o,onDelete:m}){const{t}=D(),y=s.type==="local"?e.jsx(_,{className:"h-4 w-4"}):e.jsx(ve,{className:"h-4 w-4"}),r=s.type==="local"?t("device.typeLocal"):`${s.username??"-"}@${s.host??"-"}:${s.port??22}`,d=K({mutationFn:async()=>{const l=await fetch(`/api/devices/${s.id}/test-connection`,{method:"POST"});let u=null;try{u=await l.json()}catch{u=null}if(!l.ok){const c=u;throw new Error((c==null?void 0:c.error)??t("common.error"))}return u},onSuccess:l=>{v.success(l.message??t("common.success"))},onError:l=>{v.error(l instanceof Error?l.message:t("common.error"))}});return e.jsxs(M,{"data-testid":"device-card","data-device-id":s.id,"data-device-name":s.name,className:"overflow-hidden border-border/50",children:[e.jsxs($e,{className:"space-y-2 pb-2",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-border bg-muted text-muted-foreground",children:y}),e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx(Te,{className:"line-clamp-1 text-sm",title:s.name,children:s.name}),e.jsx(Fe,{className:"line-clamp-1 text-xs",children:r})]})]}),e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:e.jsxs(fe,{children:[e.jsx(ye,{render:e.jsx(C,{variant:"ghost",size:"icon-sm","data-testid":`device-card-actions-${s.id}`,"aria-label":t("common.edit"),title:t("common.edit")}),children:e.jsx(ge,{className:"h-4 w-4"})}),e.jsxs(je,{align:"end",children:[e.jsxs(A,{"data-testid":`device-card-edit-${s.id}`,onClick:o,children:[e.jsx(we,{className:"h-4 w-4"}),t("common.edit")]}),s.type==="ssh"&&e.jsxs(A,{"data-testid":`device-card-test-${s.id}`,onClick:()=>d.mutate(),disabled:d.isPending,children:[e.jsx(Ne,{className:"h-4 w-4"}),t("common.test")]}),e.jsx(Ce,{}),e.jsxs(A,{"data-testid":`device-card-delete-${s.id}`,variant:"destructive",onClick:m,children:[e.jsx(Y,{className:"h-4 w-4"}),t("common.delete")]})]})]})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx(Q,{variant:"outline",className:"text-[11px] font-normal",children:s.type==="local"?t("device.typeLocal"):t("device.typeSSHBadge")}),s.session&&e.jsx(Q,{variant:"outline",className:"text-[11px] font-normal",children:s.session}),e.jsx(De,{deviceId:s.id})]})]}),e.jsxs(P,{className:"pt-0",children:[e.jsx(be,{className:"mb-2"}),e.jsx("div",{className:"flex items-center justify-end",children:e.jsx(Se,{to:`/devices/${s.id}`,"data-testid":`device-card-connect-${s.id}`,className:Ee({variant:"outline",size:"sm"}),children:t("device.connect")})})]})]})}function Z({mode:s,device:o,onClose:m}){const{t}=D(),y=W(),[r,d]=x.useState(qe(o)),[l,u]=x.useState(!1),[c,I]=x.useState(!1),w=s==="edit",b=r.type==="ssh",S=K({mutationFn:async a=>{const i=await fetch("/api/devices",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!i.ok)throw new Error(await G(i,t("device.createFailed")));return i.json()},onSuccess:()=>{y.invalidateQueries({queryKey:["devices"]}),v.success(t("common.success")),m()},onError:a=>{v.error(a instanceof Error?a.message:t("common.error"))}}),E=K({mutationFn:async a=>{if(!o)throw new Error(t("apiError.deviceNotFound"));const i=await fetch(`/api/devices/${o.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!i.ok)throw new Error(await G(i,t("device.updateFailed")));return i.json()},onSuccess:()=>{y.invalidateQueries({queryKey:["devices"]}),v.success(t("common.success")),m()},onError:a=>{v.error(a instanceof Error?a.message:t("common.error"))}}),n=async a=>{a.preventDefault(),I(!0);const i=Oe(r);if(i){v.error(t(i));return}u(!0);try{s==="create"?await S.mutateAsync(Le(r)):await E.mutateAsync(He(r))}catch{}finally{u(!1)}},p=`${s}-device-name`,N=`${s}-device-type`,$=`${s}-device-host`,T=`${s}-device-port`,F=`${s}-device-username`,q=`${s}-device-session`,L=`${s}-device-auth-mode`,H=`${s}-device-password`,O=`${s}-device-private-key`,B=`${s}-device-private-key-passphrase`,se={local:t("device.typeLocal"),ssh:t("device.typeSSH")},te={password:t("device.authPassword"),key:t("device.authKey"),agent:t("device.authAgent"),configRef:t("device.authConfigRef")},k=a=>e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:a}),h=(a,i,g)=>e.jsxs("label",{className:"block text-xs font-medium text-foreground",htmlFor:a,children:[i,g&&e.jsx("span",{className:"ml-0.5 text-destructive",children:"*"})]});return e.jsx(Me,{open:!0,onOpenChange:a=>!a&&m(),children:e.jsxs(Pe,{"data-testid":"device-dialog",className:"w-full max-w-2xl",children:[e.jsxs(Ke,{children:[e.jsx(Re,{children:t(w?"device.editDevice":"device.addDevice")}),e.jsx(Ie,{children:t(w?"device.editDeviceDescription":"device.addDeviceDescription")})]}),e.jsxs("form",{onSubmit:n,className:"space-y-4",children:[e.jsxs("div",{className:"-mr-2 max-h-[min(70dvh,720px)] space-y-5 overflow-y-auto pr-2",children:[e.jsxs("section",{className:"space-y-2.5",children:[k(t("device.sectionBasic")),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[h(p,t("device.name"),!0),e.jsx(f,{id:p,"data-testid":"device-name-input",type:"text",value:r.name,onChange:a=>d(i=>({...i,name:a.target.value})),placeholder:t("device.namePlaceholder"),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[h(N,t("device.type")),e.jsxs(z,{value:r.type,onValueChange:a=>{if(!a)return;const i=a;d(g=>({...g,type:i,authMode:i==="local"?"auto":g.authMode==="auto"?"agent":g.authMode}))},disabled:w,children:[e.jsx(V,{id:N,"data-testid":"device-type-select",className:"w-full",children:e.jsx(U,{placeholder:t("device.type"),children:a=>se[a]??""})}),e.jsxs(J,{children:[e.jsx(j,{value:"local",children:t("device.typeLocal")}),e.jsx(j,{value:"ssh",children:t("device.typeSSH")})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[h(q,t("device.session")),e.jsx(f,{id:q,"data-testid":"device-session-input",type:"text",value:r.session,onChange:a=>d(i=>({...i,session:a.target.value})),placeholder:t("device.sessionPlaceholder")})]})]})]}),b&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"space-y-2.5",children:[k(t("device.sectionConnection")),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[h($,t("device.host"),!0),e.jsx(f,{id:$,type:"text",value:r.host,onChange:a=>d(i=>({...i,host:a.target.value})),placeholder:t("device.hostPlaceholder"),"aria-invalid":c&&!r.host.trim()})]}),e.jsxs("div",{className:"space-y-1.5",children:[h(T,t("device.port"),!0),e.jsx(f,{id:T,type:"number",value:Number.isNaN(r.port)?"":r.port,onChange:a=>{const i=a.target.value;d(g=>({...g,port:i===""?Number.NaN:Number.parseInt(i,10)}))},min:1,max:65535,"aria-invalid":c&&!ee(r.port)})]}),e.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[h(F,t("device.username"),!0),e.jsx(f,{id:F,type:"text",value:r.username,onChange:a=>d(i=>({...i,username:a.target.value})),placeholder:t("device.usernamePlaceholder"),"aria-invalid":c&&!r.username.trim()})]})]})]}),e.jsxs("section",{className:"space-y-2.5",children:[k(t("device.sectionAuth")),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[h(L,t("device.authMode")),e.jsxs(z,{value:r.authMode,onValueChange:a=>{a&&d(i=>({...i,authMode:a}))},children:[e.jsx(V,{id:L,"data-testid":"device-auth-mode-select",className:"w-full",children:e.jsx(U,{placeholder:t("device.authMode"),children:a=>te[a]??""})}),e.jsxs(J,{children:[e.jsx(j,{value:"password",children:t("device.authPassword")}),e.jsx(j,{value:"key",children:t("device.authKey")}),e.jsx(j,{value:"agent",children:t("device.authAgent")}),e.jsx(j,{value:"configRef",children:t("device.authConfigRef")})]})]})]}),r.authMode==="password"&&e.jsxs("div",{className:"space-y-1.5",children:[h(H,t("device.password")),e.jsx(f,{id:H,type:"password",value:r.password,onChange:a=>d(i=>({...i,password:a.target.value}))})]}),r.authMode==="key"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[h(O,t("device.privateKey")),e.jsx(ke,{id:O,value:r.privateKey,onChange:a=>d(i=>({...i,privateKey:a.target.value})),className:"h-28 font-mono text-xs",placeholder:t("device.privateKeyPlaceholder")})]}),e.jsxs("div",{className:"space-y-1.5",children:[h(B,t("device.passphrase")),e.jsx(f,{id:B,type:"password",value:r.privateKeyPassphrase,onChange:a=>d(i=>({...i,privateKeyPassphrase:a.target.value}))})]})]}),r.authMode==="configRef"&&e.jsxs("div",{className:"space-y-1.5",children:[h(`${s}-device-ssh-config-ref`,t("device.authConfigRef"),!0),e.jsx(f,{id:`${s}-device-ssh-config-ref`,"data-testid":"device-ssh-config-ref-input",type:"text",value:r.sshConfigRef,onChange:a=>d(i=>({...i,sshConfigRef:a.target.value})),placeholder:t("device.sshConfigRefPlaceholder"),"aria-invalid":c&&!r.sshConfigRef.trim()}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t("device.sshConfigRefHint")})]})]})]})]})]}),e.jsxs(Ae,{children:[e.jsx(C,{type:"button",variant:"outline",onClick:m,children:t("common.cancel")}),e.jsx(C,{type:"submit",variant:"default","data-testid":"device-dialog-save",disabled:l,children:t(l?"common.saving":"common.save")})]})]})]})})}function Ue(){const{t:s}=D();return e.jsx(e.Fragment,{children:s("sidebar.manageDevices")})}function Je(){const{t:s}=D(),o=()=>{window.dispatchEvent(new CustomEvent("tmex:open-add-device"))};return e.jsx(C,{variant:"ghost",size:"icon-sm","data-testid":"devices-add",onClick:o,"aria-label":s("sidebar.addDevice"),title:s("sidebar.addDevice"),children:e.jsx(X,{className:"h-4 w-4"})})}export{Je as PageActions,Ue as PageTitle,Ve as default};
|
|
2
|
-
//# sourceMappingURL=DevicesPage-
|
|
1
|
+
import{u as D,r as x,a as W,b as ae,c as ie,d as re,e as K,t as ne,j as e,M as _,B as C,P as X,A as oe,f as ce,g as de,h as le,T as Y,i as me,k as he,l as ue,m as pe,n as xe,G as ve,o as v,D as fe,p as ye,E as ge,q as je,s as A,v as we,Z as Ne,w as Ce,x as Q,y as De,S as be,L as Se,z as Ee,C as Me,F as Pe,H as Ke,I as Re,J as Ie,K as f,N as z,O as V,Q as U,R as J,U as j,V as ke,W as Ae}from"./index-96GlCNDm.js";import{C as M,a as P,b as $e,c as Te,d as Fe}from"./card-DnWixV3q.js";function R(s){const o=s.trim();return o||void 0}function qe(s){return s?{name:s.name,type:s.type,host:s.host??"",port:s.port??22,username:s.username??"",sshConfigRef:s.sshConfigRef??"",session:s.session??"tmex",authMode:s.type==="local"?"auto":s.authMode,password:"",privateKey:"",privateKeyPassphrase:""}:{name:"",type:"local",host:"",port:22,username:"root",sshConfigRef:"",session:"tmex",authMode:"auto",password:"",privateKey:"",privateKeyPassphrase:""}}function Le(s){if(s.type==="local")return{name:s.name.trim(),type:"local",session:R(s.session)??"tmex",authMode:"auto"};const o={name:s.name.trim(),type:"ssh",host:s.host.trim(),port:s.port,username:s.username.trim(),session:R(s.session)??"tmex",authMode:s.authMode};return s.authMode==="configRef"&&(o.sshConfigRef=s.sshConfigRef.trim()),s.authMode==="password"&&(o.password=s.password),s.authMode==="key"&&(o.privateKey=s.privateKey,o.privateKeyPassphrase=s.privateKeyPassphrase||void 0),o}function He(s){if(s.type==="local")return{name:s.name.trim(),session:R(s.session)??"tmex",authMode:"auto"};const o={name:s.name.trim(),host:s.host.trim(),port:s.port,username:s.username.trim(),sshConfigRef:s.authMode==="configRef"?s.sshConfigRef.trim():"",session:R(s.session)??"tmex",authMode:s.authMode};return s.authMode==="password"&&s.password&&(o.password=s.password),s.authMode==="key"&&s.privateKey&&(o.privateKey=s.privateKey,o.privateKeyPassphrase=s.privateKeyPassphrase||void 0),o}function ee(s){return Number.isInteger(s)&&s>=1&&s<=65535}function Oe(s){return s.type!=="ssh"?null:s.host.trim()?ee(s.port)?s.username.trim()?s.authMode==="configRef"&&!s.sshConfigRef.trim()?"validation.sshConfigRequired":null:"validation.usernameRequired":"validation.portRequired":"validation.hostRequired"}async function G(s,o){try{return(await s.json()).error??o}catch{return o}}function Ve(){const{t:s}=D(),[o,m]=x.useState(!1),[t,y]=x.useState(null),[r,d]=x.useState(null),l=W(),u=ae(n=>{var p;return((p=n.settings)==null?void 0:p.language)??"en_US"});x.useEffect(()=>{const n=()=>m(!0);return window.addEventListener("tmex:open-add-device",n),()=>window.removeEventListener("tmex:open-add-device",n)},[]);const{data:c,isLoading:I,isError:w}=ie({queryKey:["devices"],queryFn:async()=>{const n=await fetch("/api/devices");if(!n.ok)throw new Error(s("device.loadFailed"));return n.json()},throwOnError:!1}),b=re(n=>n.hydrateDeviceErrors);x.useEffect(()=>{c!=null&&c.devices&&b(c.devices.map(n=>({deviceId:n.id,lastError:n.lastError??null,lastErrorType:n.lastErrorType??null})))},[c,b]);const S=K({mutationFn:async n=>{if(!(await fetch(`/api/devices/${n}`,{method:"DELETE"})).ok)throw new Error(s("device.deleteFailed"))},onSuccess:()=>{l.invalidateQueries({queryKey:["devices"]}),v.success(s("common.success"))},onError:n=>{v.error(n instanceof Error?n.message:s("common.error"))}}),E=x.useMemo(()=>[...(c==null?void 0:c.devices)??[]].sort((p,N)=>p.sortOrder-N.sortOrder||p.name.localeCompare(N.name,ne(u),{numeric:!0,sensitivity:"base"})),[c==null?void 0:c.devices,u]);return e.jsxs("div",{className:"mx-auto flex w-full max-w-6xl flex-col gap-3 p-3 pb-[calc(1rem+env(safe-area-inset-bottom))] sm:gap-4 sm:p-5","data-testid":"devices-page",children:[I?e.jsx(M,{children:e.jsx(P,{className:"py-16 text-center text-sm text-muted-foreground",children:s("common.loading")})}):w?e.jsx(M,{children:e.jsx(P,{className:"py-16 text-center text-sm text-destructive",children:s("device.loadFailed")})}):E.length===0?e.jsx(M,{children:e.jsxs(P,{className:"space-y-4 py-14 text-center",children:[e.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-xl border border-border bg-muted",children:e.jsx(_,{className:"h-6 w-6 text-muted-foreground"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{className:"text-lg font-medium",children:s("device.noDevices")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("device.addDevice")})]}),e.jsxs(C,{variant:"default","data-testid":"devices-add-empty",onClick:()=>m(!0),children:[e.jsx(X,{className:"h-4 w-4"}),s("device.addDevice")]})]})}):e.jsx("div",{className:"grid gap-3 lg:grid-cols-2",children:E.map(n=>e.jsx(Be,{device:n,onEdit:()=>y(n),onDelete:()=>d(n)},n.id))}),o&&e.jsx(Z,{mode:"create",onClose:()=>m(!1)}),t&&e.jsx(Z,{mode:"edit",device:t,onClose:()=>y(null)}),e.jsx(oe,{open:r!==null,onOpenChange:n=>!n&&d(null),children:e.jsxs(ce,{children:[e.jsxs(de,{children:[e.jsx(le,{className:"bg-destructive/10",children:e.jsx(Y,{className:"h-5 w-5 text-destructive"})}),e.jsx(me,{children:s("device.deleteConfirm")}),e.jsx(he,{children:s("device.deleteDescription",{name:(r==null?void 0:r.name)??""})})]}),e.jsxs(ue,{children:[e.jsx(pe,{children:s("common.cancel")}),e.jsx(xe,{variant:"destructive",disabled:!r||S.isPending,onClick:()=>{r&&(S.mutate(r.id),d(null))},children:s("common.delete")})]})]})})]})}function Be({device:s,onEdit:o,onDelete:m}){const{t}=D(),y=s.type==="local"?e.jsx(_,{className:"h-4 w-4"}):e.jsx(ve,{className:"h-4 w-4"}),r=s.type==="local"?t("device.typeLocal"):`${s.username??"-"}@${s.host??"-"}:${s.port??22}`,d=K({mutationFn:async()=>{const l=await fetch(`/api/devices/${s.id}/test-connection`,{method:"POST"});let u=null;try{u=await l.json()}catch{u=null}if(!l.ok){const c=u;throw new Error((c==null?void 0:c.error)??t("common.error"))}return u},onSuccess:l=>{v.success(l.message??t("common.success"))},onError:l=>{v.error(l instanceof Error?l.message:t("common.error"))}});return e.jsxs(M,{"data-testid":"device-card","data-device-id":s.id,"data-device-name":s.name,className:"overflow-hidden border-border/50",children:[e.jsxs($e,{className:"space-y-2 pb-2",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-border bg-muted text-muted-foreground",children:y}),e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx(Te,{className:"line-clamp-1 text-sm",title:s.name,children:s.name}),e.jsx(Fe,{className:"line-clamp-1 text-xs",children:r})]})]}),e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:e.jsxs(fe,{children:[e.jsx(ye,{render:e.jsx(C,{variant:"ghost",size:"icon-sm","data-testid":`device-card-actions-${s.id}`,"aria-label":t("common.edit"),title:t("common.edit")}),children:e.jsx(ge,{className:"h-4 w-4"})}),e.jsxs(je,{align:"end",children:[e.jsxs(A,{"data-testid":`device-card-edit-${s.id}`,onClick:o,children:[e.jsx(we,{className:"h-4 w-4"}),t("common.edit")]}),s.type==="ssh"&&e.jsxs(A,{"data-testid":`device-card-test-${s.id}`,onClick:()=>d.mutate(),disabled:d.isPending,children:[e.jsx(Ne,{className:"h-4 w-4"}),t("common.test")]}),e.jsx(Ce,{}),e.jsxs(A,{"data-testid":`device-card-delete-${s.id}`,variant:"destructive",onClick:m,children:[e.jsx(Y,{className:"h-4 w-4"}),t("common.delete")]})]})]})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx(Q,{variant:"outline",className:"text-[11px] font-normal",children:s.type==="local"?t("device.typeLocal"):t("device.typeSSHBadge")}),s.session&&e.jsx(Q,{variant:"outline",className:"text-[11px] font-normal",children:s.session}),e.jsx(De,{deviceId:s.id})]})]}),e.jsxs(P,{className:"pt-0",children:[e.jsx(be,{className:"mb-2"}),e.jsx("div",{className:"flex items-center justify-end",children:e.jsx(Se,{to:`/devices/${s.id}`,"data-testid":`device-card-connect-${s.id}`,className:Ee({variant:"outline",size:"sm"}),children:t("device.connect")})})]})]})}function Z({mode:s,device:o,onClose:m}){const{t}=D(),y=W(),[r,d]=x.useState(qe(o)),[l,u]=x.useState(!1),[c,I]=x.useState(!1),w=s==="edit",b=r.type==="ssh",S=K({mutationFn:async a=>{const i=await fetch("/api/devices",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!i.ok)throw new Error(await G(i,t("device.createFailed")));return i.json()},onSuccess:()=>{y.invalidateQueries({queryKey:["devices"]}),v.success(t("common.success")),m()},onError:a=>{v.error(a instanceof Error?a.message:t("common.error"))}}),E=K({mutationFn:async a=>{if(!o)throw new Error(t("apiError.deviceNotFound"));const i=await fetch(`/api/devices/${o.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!i.ok)throw new Error(await G(i,t("device.updateFailed")));return i.json()},onSuccess:()=>{y.invalidateQueries({queryKey:["devices"]}),v.success(t("common.success")),m()},onError:a=>{v.error(a instanceof Error?a.message:t("common.error"))}}),n=async a=>{a.preventDefault(),I(!0);const i=Oe(r);if(i){v.error(t(i));return}u(!0);try{s==="create"?await S.mutateAsync(Le(r)):await E.mutateAsync(He(r))}catch{}finally{u(!1)}},p=`${s}-device-name`,N=`${s}-device-type`,$=`${s}-device-host`,T=`${s}-device-port`,F=`${s}-device-username`,q=`${s}-device-session`,L=`${s}-device-auth-mode`,H=`${s}-device-password`,O=`${s}-device-private-key`,B=`${s}-device-private-key-passphrase`,se={local:t("device.typeLocal"),ssh:t("device.typeSSH")},te={password:t("device.authPassword"),key:t("device.authKey"),agent:t("device.authAgent"),configRef:t("device.authConfigRef")},k=a=>e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:a}),h=(a,i,g)=>e.jsxs("label",{className:"block text-xs font-medium text-foreground",htmlFor:a,children:[i,g&&e.jsx("span",{className:"ml-0.5 text-destructive",children:"*"})]});return e.jsx(Me,{open:!0,onOpenChange:a=>!a&&m(),children:e.jsxs(Pe,{"data-testid":"device-dialog",className:"w-full max-w-2xl",children:[e.jsxs(Ke,{children:[e.jsx(Re,{children:t(w?"device.editDevice":"device.addDevice")}),e.jsx(Ie,{children:t(w?"device.editDeviceDescription":"device.addDeviceDescription")})]}),e.jsxs("form",{onSubmit:n,className:"space-y-4",children:[e.jsxs("div",{className:"-mr-2 max-h-[min(70dvh,720px)] space-y-5 overflow-y-auto pr-2",children:[e.jsxs("section",{className:"space-y-2.5",children:[k(t("device.sectionBasic")),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[h(p,t("device.name"),!0),e.jsx(f,{id:p,"data-testid":"device-name-input",type:"text",value:r.name,onChange:a=>d(i=>({...i,name:a.target.value})),placeholder:t("device.namePlaceholder"),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[h(N,t("device.type")),e.jsxs(z,{value:r.type,onValueChange:a=>{if(!a)return;const i=a;d(g=>({...g,type:i,authMode:i==="local"?"auto":g.authMode==="auto"?"agent":g.authMode}))},disabled:w,children:[e.jsx(V,{id:N,"data-testid":"device-type-select",className:"w-full",children:e.jsx(U,{placeholder:t("device.type"),children:a=>se[a]??""})}),e.jsxs(J,{children:[e.jsx(j,{value:"local",children:t("device.typeLocal")}),e.jsx(j,{value:"ssh",children:t("device.typeSSH")})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[h(q,t("device.session")),e.jsx(f,{id:q,"data-testid":"device-session-input",type:"text",value:r.session,onChange:a=>d(i=>({...i,session:a.target.value})),placeholder:t("device.sessionPlaceholder")})]})]})]}),b&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"space-y-2.5",children:[k(t("device.sectionConnection")),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[h($,t("device.host"),!0),e.jsx(f,{id:$,type:"text",value:r.host,onChange:a=>d(i=>({...i,host:a.target.value})),placeholder:t("device.hostPlaceholder"),"aria-invalid":c&&!r.host.trim()})]}),e.jsxs("div",{className:"space-y-1.5",children:[h(T,t("device.port"),!0),e.jsx(f,{id:T,type:"number",value:Number.isNaN(r.port)?"":r.port,onChange:a=>{const i=a.target.value;d(g=>({...g,port:i===""?Number.NaN:Number.parseInt(i,10)}))},min:1,max:65535,"aria-invalid":c&&!ee(r.port)})]}),e.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[h(F,t("device.username"),!0),e.jsx(f,{id:F,type:"text",value:r.username,onChange:a=>d(i=>({...i,username:a.target.value})),placeholder:t("device.usernamePlaceholder"),"aria-invalid":c&&!r.username.trim()})]})]})]}),e.jsxs("section",{className:"space-y-2.5",children:[k(t("device.sectionAuth")),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[h(L,t("device.authMode")),e.jsxs(z,{value:r.authMode,onValueChange:a=>{a&&d(i=>({...i,authMode:a}))},children:[e.jsx(V,{id:L,"data-testid":"device-auth-mode-select",className:"w-full",children:e.jsx(U,{placeholder:t("device.authMode"),children:a=>te[a]??""})}),e.jsxs(J,{children:[e.jsx(j,{value:"password",children:t("device.authPassword")}),e.jsx(j,{value:"key",children:t("device.authKey")}),e.jsx(j,{value:"agent",children:t("device.authAgent")}),e.jsx(j,{value:"configRef",children:t("device.authConfigRef")})]})]})]}),r.authMode==="password"&&e.jsxs("div",{className:"space-y-1.5",children:[h(H,t("device.password")),e.jsx(f,{id:H,type:"password",value:r.password,onChange:a=>d(i=>({...i,password:a.target.value}))})]}),r.authMode==="key"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[h(O,t("device.privateKey")),e.jsx(ke,{id:O,value:r.privateKey,onChange:a=>d(i=>({...i,privateKey:a.target.value})),className:"h-28 font-mono text-xs",placeholder:t("device.privateKeyPlaceholder")})]}),e.jsxs("div",{className:"space-y-1.5",children:[h(B,t("device.passphrase")),e.jsx(f,{id:B,type:"password",value:r.privateKeyPassphrase,onChange:a=>d(i=>({...i,privateKeyPassphrase:a.target.value}))})]})]}),r.authMode==="configRef"&&e.jsxs("div",{className:"space-y-1.5",children:[h(`${s}-device-ssh-config-ref`,t("device.authConfigRef"),!0),e.jsx(f,{id:`${s}-device-ssh-config-ref`,"data-testid":"device-ssh-config-ref-input",type:"text",value:r.sshConfigRef,onChange:a=>d(i=>({...i,sshConfigRef:a.target.value})),placeholder:t("device.sshConfigRefPlaceholder"),"aria-invalid":c&&!r.sshConfigRef.trim()}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t("device.sshConfigRefHint")})]})]})]})]})]}),e.jsxs(Ae,{children:[e.jsx(C,{type:"button",variant:"outline",onClick:m,children:t("common.cancel")}),e.jsx(C,{type:"submit",variant:"default","data-testid":"device-dialog-save",disabled:l,children:t(l?"common.saving":"common.save")})]})]})]})})}function Ue(){const{t:s}=D();return e.jsx(e.Fragment,{children:s("sidebar.manageDevices")})}function Je(){const{t:s}=D(),o=()=>{window.dispatchEvent(new CustomEvent("tmex:open-add-device"))};return e.jsx(C,{variant:"ghost",size:"icon-sm","data-testid":"devices-add",onClick:o,"aria-label":s("sidebar.addDevice"),title:s("sidebar.addDevice"),children:e.jsx(X,{className:"h-4 w-4"})})}export{Je as PageActions,Ue as PageTitle,Ve as default};
|
|
2
|
+
//# sourceMappingURL=DevicesPage-BXVj9MYn.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Y as zn,af as ut,r as oe,j as h,X as gt,ar as bt,u as ae,c as $n,ay as qn,a as mt,aW as Ve,B as se,aX as pt,aY as te,aL as Kn,aZ as _t,a_ as ft,a$ as Et,aV as nn,b0 as ht,b1 as Nt}from"./index-
|
|
1
|
+
import{Y as zn,af as ut,r as oe,j as h,X as gt,ar as bt,u as ae,c as $n,ay as qn,a as mt,aW as Ve,B as se,aX as pt,aY as te,aL as Kn,aZ as _t,a_ as ft,a$ as Et,aV as nn,b0 as ht,b1 as Nt}from"./index-96GlCNDm.js";import{r as yt,M as vt}from"./markdown-preview-DD3cdI4r.js";/**
|
|
2
2
|
* @license lucide-react v0.564.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -13,4 +13,4 @@ import{Y as zn,af as ut,r as oe,j as h,X as gt,ar as bt,u as ae,c as $n,ay as qn
|
|
|
13
13
|
]`,_={scope:"string",variants:[c,r,u,b]},p={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},f=["false","null","true"],E=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],N=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],v={keyword:E,literal:(x=>{const M=[];return x.forEach(L=>{M.push(L),L.toLowerCase()===L?M.push(L.toUpperCase()):M.push(L.toLowerCase())}),M})(f),built_in:N},T=x=>x.map(M=>M.replace(/\|\d+$/,"")),w={variants:[{match:[/new/,n.concat(m,"+"),n.concat("(?!",T(N).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},y=n.concat(a,"\\b(?!\\()"),S={variants:[{match:[n.concat(/::/,n.lookahead(/(?!class\b)/)),y],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,n.concat(/::/,n.lookahead(/(?!class\b)/)),y],scope:{1:"title.class",3:"variable.constant"}},{match:[i,n.concat("::",n.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},R={scope:"attr",match:n.concat(a,n.lookahead(":"),n.lookahead(/(?!::)/))},k={relevance:0,begin:/\(/,end:/\)/,keywords:v,contains:[R,g,S,e.C_BLOCK_COMMENT_MODE,_,p,w]},B={relevance:0,match:[/\b/,n.concat("(?!fn\\b|function\\b|",T(E).join("\\b|"),"|",T(N).join("\\b|"),"\\b)"),a,n.concat(m,"*"),n.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[k]};k.contains.push(B);const D=[R,S,e.C_BLOCK_COMMENT_MODE,_,p,w],P={begin:n.concat(/#\[\s*\\?/,n.either(i,l)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:f,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:f,keyword:["new","array"]},contains:["self",...D]},...D,{scope:"meta",variants:[{match:i},{match:l}]}]};return{case_insensitive:!1,keywords:v,contains:[P,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},d,{scope:"variable.language",match:/\$this\b/},g,B,S,{match:[/const/,/\s/,a],scope:{1:"keyword",3:"variable.constant"}},w,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:v,contains:["self",P,g,S,e.C_BLOCK_COMMENT_MODE,_,p]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},_,p]}}return Me=t,Me}var Ie,Sn;function Zt(){if(Sn)return Ie;Sn=1;function t(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}return Ie=t,Ie}var Le,An;function Vt(){if(An)return Le;An=1;function t(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}return Le=t,Le}var De,On;function Xt(){if(On)return De;On=1;function t(e){const n=e.regex,o=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),a=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],d={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:a,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},s={className:"meta",begin:/^(>>>|\.\.\.) /},r={className:"subst",begin:/\{/,end:/\}/,keywords:d,illegal:/#/},c={begin:/\{\{/,relevance:0},u={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,s],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,s],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,s,c,r]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,s,c,r]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,c,r]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,c,r]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},b="[0-9](_?[0-9])*",m=`(\\b(${b}))?\\.(${b})|\\b(${b})\\.`,_=`\\b|${a.join("|")}`,p={className:"number",relevance:0,variants:[{begin:`(\\b(${b})|(${m}))[eE][+-]?(${b})[jJ]?(?=${_})`},{begin:`(${m})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${_})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${_})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${_})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${_})`},{begin:`\\b(${b})[jJ](?=${_})`}]},f={className:"comment",begin:n.lookahead(/# type:/),end:/$/,keywords:d,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},E={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:["self",s,p,u,e.HASH_COMMENT_MODE]}]};return r.contains=[u,p,s],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:d,illegal:/(<\/|\?)|=>/,contains:[s,p,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},u,f,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,o],scope:{1:"keyword",3:"title.function"},contains:[E]},{variants:[{match:[/\bclass/,/\s+/,o,/\s*/,/\(\s*/,o,/\s*\)/]},{match:[/\bclass/,/\s+/,o]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[p,E,u]}]}}return De=t,De}var Be,Rn;function Qt(){if(Rn)return Be;Rn=1;function t(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}return Be=t,Be}var Ue,kn;function Jt(){if(kn)return Ue;kn=1;function t(e){const n=e.regex,o=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,a=n.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,l=n.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:o,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:n.lookahead(n.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:o},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,a]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,a]},{scope:{1:"punctuation",2:"number"},match:[l,a]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,a]}]},{scope:{3:"operator"},match:[o,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:l},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}return Ue=t,Ue}var Pe,xn;function jt(){if(xn)return Pe;xn=1;function t(e){const n=e.regex,o=/(r#)?/,a=n.concat(o,e.UNDERSCORE_IDENT_RE),i=n.concat(o,e.IDENT_RE),l={className:"title.function.invoke",relevance:0,begin:n.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,n.lookahead(/\s*\(/))},g="([ui](8|16|32|64|128|size)|f(32|64))?",d=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],s=["true","false","Some","None","Ok","Err"],r=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],c=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:c,keyword:d,literal:s,built_in:r},illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+g},{begin:"\\b0o([0-7_]+)"+g},{begin:"\\b0x([A-Fa-f0-9_]+)"+g},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+g}],relevance:0},{begin:[/fn/,/\s+/,a],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,a],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,a,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:r,type:c}},{className:"punctuation",begin:"->"},l]}}return Pe=t,Pe}var Fe,Cn;function ea(){if(Cn)return Fe;Cn=1;const t=s=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:s.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[s.APOS_STRING_MODE,s.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:s.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),e=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],n=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],o=[...e,...n],a=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),i=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),l=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),g=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function d(s){const r=t(s),c=l,u=i,b="@[a-z-]+",m="and or not only",p={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[s.C_LINE_COMMENT_MODE,s.C_BLOCK_COMMENT_MODE,r.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},r.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+o.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+u.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+c.join("|")+")"},p,{begin:/\(/,end:/\)/,contains:[r.CSS_NUMBER_MODE]},r.CSS_VARIABLE,{className:"attribute",begin:"\\b("+g.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[r.BLOCK_COMMENT,p,r.HEXCOLOR,r.CSS_NUMBER_MODE,s.QUOTE_STRING_MODE,s.APOS_STRING_MODE,r.IMPORTANT,r.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:b,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:m,attribute:a.join(" ")},contains:[{begin:b,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},p,s.QUOTE_STRING_MODE,s.APOS_STRING_MODE,r.HEXCOLOR,r.CSS_NUMBER_MODE]},r.FUNCTION_DISPATCH]}}return Fe=d,Fe}var ze,Mn;function na(){if(Mn)return ze;Mn=1;function t(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}return ze=t,ze}var $e,In;function ta(){if(In)return $e;In=1;function t(e){const n=e.regex,o=e.COMMENT("--","$"),a={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},l=["true","false","unknown"],g=["double precision","large object","with timezone","without timezone"],d=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],s=["add","asc","collation","desc","final","first","last","view"],r=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],c=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],u=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],b=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],m=c,_=[...r,...s].filter(T=>!c.includes(T)),p={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},f={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},E={match:n.concat(/\b/,n.either(...m),/\s*\(/),relevance:0,keywords:{built_in:m}};function N(T){return n.concat(/\b/,n.either(...T.map(w=>w.replace(/\s+/,"\\s+"))),/\b/)}const A={scope:"keyword",match:N(b),relevance:0};function v(T,{exceptions:w,when:y}={}){const S=y;return w=w||[],T.map(R=>R.match(/\|\d+$/)||w.includes(R)?R:S(R)?`${R}|0`:R)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:v(_,{when:T=>T.length<3}),literal:l,type:d,built_in:u},contains:[{scope:"type",match:N(g)},A,E,p,a,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,o,f]}}return $e=t,$e}var qe,Ln;function aa(){if(Ln)return qe;Ln=1;function t(y){return y?typeof y=="string"?y:y.source:null}function e(y){return n("(?=",y,")")}function n(...y){return y.map(R=>t(R)).join("")}function o(y){const S=y[y.length-1];return typeof S=="object"&&S.constructor===Object?(y.splice(y.length-1,1),S):{}}function a(...y){return"("+(o(y).capture?"":"?:")+y.map(k=>t(k)).join("|")+")"}const i=y=>n(/\b/,y,/\w$/.test(y)?/\b/:/\B/),l=["Protocol","Type"].map(i),g=["init","self"].map(i),d=["Any","Self"],s=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],r=["false","nil","true"],c=["assignment","associativity","higherThan","left","lowerThan","none","right"],u=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],b=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],m=a(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),_=a(m,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),p=n(m,_,"*"),f=a(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),E=a(f,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),N=n(f,E,"*"),A=n(/[A-Z]/,E,"*"),v=["attached","autoclosure",n(/convention\(/,a("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",n(/objc\(/,N,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],T=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function w(y){const S={match:/\s+/,relevance:0},R=y.COMMENT("/\\*","\\*/",{contains:["self"]}),k=[y.C_LINE_COMMENT_MODE,R],B={match:[/\./,a(...l,...g)],className:{2:"keyword"}},D={match:n(/\./,a(...s)),relevance:0},P=s.filter(O=>typeof O=="string").concat(["_|0"]),x=s.filter(O=>typeof O!="string").concat(d).map(i),M={variants:[{className:"keyword",match:a(...x,...g)}]},L={$pattern:a(/\b\w+/,/#\w+/),keyword:P.concat(u),literal:r},$=[B,D,M],Q={match:n(/\./,a(...b)),relevance:0},J={className:"built_in",match:n(/\b/,a(...b),/(?=\()/)},W=[Q,J],X={match:/->/,relevance:0},j={className:"operator",relevance:0,variants:[{match:p},{match:`\\.(\\.|${_})+`}]},K=[X,j],G="([0-9]_*)+",Y="([0-9a-fA-F]_*)+",I={className:"number",relevance:0,variants:[{match:`\\b(${G})(\\.(${G}))?([eE][+-]?(${G}))?\\b`},{match:`\\b0x(${Y})(\\.(${Y}))?([pP][+-]?(${G}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},C=(O="")=>({className:"subst",variants:[{match:n(/\\/,O,/[0\\tnr"']/)},{match:n(/\\/,O,/u\{[0-9a-fA-F]{1,8}\}/)}]}),U=(O="")=>({className:"subst",match:n(/\\/,O,/[\t ]*(?:[\r\n]|\r\n)/)}),F=(O="")=>({className:"subst",label:"interpol",begin:n(/\\/,O,/\(/),end:/\)/}),z=(O="")=>({begin:n(O,/"""/),end:n(/"""/,O),contains:[C(O),U(O),F(O)]}),q=(O="")=>({begin:n(O,/"/),end:n(/"/,O),contains:[C(O),F(O)]}),H={className:"string",variants:[z(),z("#"),z("##"),z("###"),q(),q("#"),q("##"),q("###")]},Xe=[y.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[y.BACKSLASH_ESCAPE]}],Zn={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:Xe},ce=O=>{const ie=n(O,/\//),ee=n(/\//,O);return{begin:ie,end:ee,contains:[...Xe,{scope:"comment",begin:`#(?!.*${ee})`,end:/$/}]}},Qe={scope:"regexp",variants:[ce("###"),ce("##"),ce("#"),Zn]},Je={match:n(/`/,N,/`/)},Vn={className:"variable",match:/\$\d+/},Xn={className:"variable",match:`\\$${E}+`},le=[Je,Vn,Xn],Qn={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:T,contains:[...K,I,H]}]}},Jn={scope:"keyword",match:n(/@/,a(...v),e(a(/\(/,/\s+/)))},jn={scope:"meta",match:n(/@/,N)},re=[Qn,Jn,jn],Z={match:e(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:n(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,E,"+")},{className:"type",match:A,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:n(/\s+&\s+/,e(A)),relevance:0}]},et={begin:/</,end:/>/,keywords:L,contains:[...k,...$,...re,X,Z]};Z.contains.push(et);const nt={match:n(N,/\s*:/),keywords:"_|0",relevance:0},je={begin:/\(/,end:/\)/,relevance:0,keywords:L,contains:["self",nt,...k,Qe,...$,...W,...K,I,H,...le,...re,Z]},de={begin:/</,end:/>/,keywords:"repeat each",contains:[...k,Z]},tt={begin:a(e(n(N,/\s*:/)),e(n(N,/\s+/,N,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:N}]},en={begin:/\(/,end:/\)/,keywords:L,contains:[tt,...k,...$,...K,I,H,...re,Z,je],endsParent:!0,illegal:/["']/},at={match:[/(func|macro)/,/\s+/,a(Je.match,N,p)],className:{1:"keyword",3:"title.function"},contains:[de,en,S],illegal:[/\[/,/%/]},rt={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[de,en,S],illegal:/\[|%/},it={match:[/operator/,/\s+/,p],className:{1:"keyword",3:"title"}},ot={begin:[/precedencegroup/,/\s+/,A],className:{1:"keyword",3:"title"},contains:[Z],keywords:[...c,...r],end:/}/},st={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},ct={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},lt={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,N,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:L,contains:[de,...$,{begin:/:/,end:/\{/,keywords:L,contains:[{scope:"title.class.inherited",match:A},...$],relevance:0}]};for(const O of H.variants){const ie=O.contains.find(dt=>dt.label==="interpol");ie.keywords=L;const ee=[...$,...W,...K,I,H,...le];ie.contains=[...ee,{begin:/\(/,end:/\)/,contains:["self",...ee]}]}return{name:"Swift",keywords:L,contains:[...k,at,rt,st,ct,lt,it,ot,{beginKeywords:"import",end:/$/,contains:[...k],relevance:0},Qe,...$,...W,...K,I,H,...le,...re,Z,je]}}return qe=w,qe}var Ke,Dn;function ra(){if(Dn)return Ke;Dn=1;function t(e){const n="true false yes no null",o="[\\w#;/?:@&=+$,.~*'()[\\]]+",a={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},l={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},g={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},d=e.inherit(g,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),b={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},m={end:",",endsWithParent:!0,excludeEnd:!0,keywords:n,relevance:0},_={begin:/\{/,end:/\}/,contains:[m],illegal:"\\n",relevance:0},p={begin:"\\[",end:"\\]",contains:[m],illegal:"\\n",relevance:0},f=[a,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+o},{className:"type",begin:"!<"+o+">"},{className:"type",begin:"!"+o},{className:"type",begin:"!!"+o},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:n,keywords:{literal:n}},b,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},_,p,l,g],E=[...f];return E.pop(),E.push(d),m.contains=E,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:f}}return Ke=t,Ke}var Ge,Bn;function ia(){if(Bn)return Ge;Bn=1;const t="[A-Za-z$_][0-9A-Za-z$_]*",e=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],n=["true","false","null","undefined","NaN","Infinity"],o=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],a=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],i=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],l=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],g=[].concat(i,o,a);function d(r){const c=r.regex,u=(C,{after:U})=>{const F="</"+C[0].slice(1);return C.input.indexOf(F,U)!==-1},b=t,m={begin:"<>",end:"</>"},_=/<[A-Za-z0-9\\._:-]+\s*\/>/,p={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(C,U)=>{const F=C[0].length+C.index,z=C.input[F];if(z==="<"||z===","){U.ignoreMatch();return}z===">"&&(u(C,{after:F})||U.ignoreMatch());let q;const H=C.input.substring(F);if(q=H.match(/^\s*=/)){U.ignoreMatch();return}if((q=H.match(/^\s+extends\s+/))&&q.index===0){U.ignoreMatch();return}}},f={$pattern:t,keyword:e,literal:n,built_in:g,"variable.language":l},E="[0-9](_?[0-9])*",N=`\\.(${E})`,A="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",v={className:"number",variants:[{begin:`(\\b(${A})((${N})|\\.)?|(${N}))[eE][+-]?(${E})\\b`},{begin:`\\b(${A})\\b((${N})\\b|\\.)?|(${N})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},T={className:"subst",begin:"\\$\\{",end:"\\}",keywords:f,contains:[]},w={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,T],subLanguage:"xml"}},y={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,T],subLanguage:"css"}},S={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,T],subLanguage:"graphql"}},R={className:"string",begin:"`",end:"`",contains:[r.BACKSLASH_ESCAPE,T]},B={className:"comment",variants:[r.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:b+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),r.C_BLOCK_COMMENT_MODE,r.C_LINE_COMMENT_MODE]},D=[r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,w,y,S,R,{match:/\$\d+/},v];T.contains=D.concat({begin:/\{/,end:/\}/,keywords:f,contains:["self"].concat(D)});const P=[].concat(B,T.contains),x=P.concat([{begin:/(\s*)\(/,end:/\)/,keywords:f,contains:["self"].concat(P)}]),M={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:f,contains:x},L={variants:[{match:[/class/,/\s+/,b,/\s+/,/extends/,/\s+/,c.concat(b,"(",c.concat(/\./,b),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,b],scope:{1:"keyword",3:"title.class"}}]},$={relevance:0,match:c.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...o,...a]}},Q={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},J={variants:[{match:[/function/,/\s+/,b,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[M],illegal:/%/},W={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function X(C){return c.concat("(?!",C.join("|"),")")}const j={match:c.concat(/\b/,X([...i,"super","import"].map(C=>`${C}\\s*\\(`)),b,c.lookahead(/\s*\(/)),className:"title.function",relevance:0},K={begin:c.concat(/\./,c.lookahead(c.concat(b,/(?![0-9A-Za-z$_(])/))),end:b,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},G={match:[/get|set/,/\s+/,b,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},M]},Y="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+r.UNDERSCORE_IDENT_RE+")\\s*=>",I={match:[/const|var|let/,/\s+/,b,/\s*/,/=\s*/,/(async\s*)?/,c.lookahead(Y)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[M]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:f,exports:{PARAMS_CONTAINS:x,CLASS_REFERENCE:$},illegal:/#(?![$_A-z])/,contains:[r.SHEBANG({label:"shebang",binary:"node",relevance:5}),Q,r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,w,y,S,R,B,{match:/\$\d+/},v,$,{scope:"attr",match:b+c.lookahead(":"),relevance:0},I,{begin:"("+r.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[B,r.REGEXP_MODE,{className:"function",begin:Y,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:r.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:f,contains:x}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:m.begin,end:m.end},{match:_},{begin:p.begin,"on:begin":p.isTrulyOpeningTag,end:p.end}],subLanguage:"xml",contains:[{begin:p.begin,end:p.end,skip:!0,contains:["self"]}]}]},J,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+r.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[M,r.inherit(r.TITLE_MODE,{begin:b,className:"title.function"})]},{match:/\.\.\./,relevance:0},K,{match:"\\$"+b,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[M]},j,W,L,G,{match:/\$[(.]/}]}}function s(r){const c=r.regex,u=d(r),b=t,m=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],_={begin:[/namespace/,/\s+/,r.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},p={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:m},contains:[u.exports.CLASS_REFERENCE]},f={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},E=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],N={$pattern:t,keyword:e.concat(E),literal:n,built_in:g.concat(m),"variable.language":l},A={className:"meta",begin:"@"+b},v=(S,R,k)=>{const B=S.contains.findIndex(D=>D.label===R);if(B===-1)throw new Error("can not find mode to replace");S.contains.splice(B,1,k)};Object.assign(u.keywords,N),u.exports.PARAMS_CONTAINS.push(A);const T=u.contains.find(S=>S.scope==="attr"),w=Object.assign({},T,{match:c.concat(b,c.lookahead(/\s*\?:/))});u.exports.PARAMS_CONTAINS.push([u.exports.CLASS_REFERENCE,T,w]),u.contains=u.contains.concat([A,_,p,w]),v(u,"shebang",r.SHEBANG()),v(u,"use_strict",f);const y=u.contains.find(S=>S.label==="func.def");return y.relevance=0,Object.assign(u,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),u}return Ge=s,Ge}var He,Un;function oa(){if(Un)return He;Un=1;function t(e){const n=e.regex,o={className:"string",begin:/"(""|[^/n])"C\b/},a={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,l=/\d{4}-\d{1,2}-\d{1,2}/,g=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,d=/\d{1,2}(:\d{1,2}){1,2}/,s={className:"literal",variants:[{begin:n.concat(/# */,n.either(l,i),/ *#/)},{begin:n.concat(/# */,d,/ *#/)},{begin:n.concat(/# */,g,/ *#/)},{begin:n.concat(/# */,n.either(l,i),/ +/,n.either(g,d),/ *#/)}]},r={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},c={className:"label",begin:/^\w+:/},u=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),b=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[o,a,s,r,c,u,b,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[b]}]}}return He=t,He}var We,Pn;function sa(){if(Pn)return We;Pn=1;function t(e){e.regex;const n=e.COMMENT(/\(;/,/;\)/);n.contains.push("self");const o=e.COMMENT(/;;/,/$/),a=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},l={className:"variable",begin:/\$[\w_]+/},g={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},d={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},s={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},r={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:a},contains:[o,n,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},l,g,i,e.QUOTE_STRING_MODE,s,r,d]}}return We=t,We}var Ye,Fn;function ca(){if(Fn)return Ye;Fn=1;var t=yt();return t.registerLanguage("xml",At()),t.registerLanguage("bash",Ot()),t.registerLanguage("c",Rt()),t.registerLanguage("cpp",kt()),t.registerLanguage("csharp",xt()),t.registerLanguage("css",Ct()),t.registerLanguage("markdown",Mt()),t.registerLanguage("diff",It()),t.registerLanguage("ruby",Lt()),t.registerLanguage("go",Dt()),t.registerLanguage("graphql",Bt()),t.registerLanguage("ini",Ut()),t.registerLanguage("java",Pt()),t.registerLanguage("javascript",Ft()),t.registerLanguage("json",zt()),t.registerLanguage("kotlin",$t()),t.registerLanguage("less",qt()),t.registerLanguage("lua",Kt()),t.registerLanguage("makefile",Gt()),t.registerLanguage("perl",Ht()),t.registerLanguage("objectivec",Wt()),t.registerLanguage("php",Yt()),t.registerLanguage("php-template",Zt()),t.registerLanguage("plaintext",Vt()),t.registerLanguage("python",Xt()),t.registerLanguage("python-repl",Qt()),t.registerLanguage("r",Jt()),t.registerLanguage("rust",jt()),t.registerLanguage("scss",ea()),t.registerLanguage("shell",na()),t.registerLanguage("sql",ta()),t.registerLanguage("swift",aa()),t.registerLanguage("yaml",ra()),t.registerLanguage("typescript",ia()),t.registerLanguage("vbnet",oa()),t.registerLanguage("wasm",sa()),t.HighlightJS=t,t.default=t,Ye=t,Ye}var la=ca();const Ze=ut(la),da={ts:"typescript",tsx:"typescript",cts:"typescript",mts:"typescript",js:"javascript",jsx:"javascript",cjs:"javascript",mjs:"javascript",py:"python",pyi:"python",rs:"rust",go:"go",java:"java",kt:"kotlin",c:"c",h:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",hxx:"cpp",cs:"csharp",rb:"ruby",php:"php",swift:"swift",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",ps1:"powershell",yaml:"yaml",yml:"yaml",json:"json",jsonc:"json",toml:"toml",ini:"ini",sql:"sql",css:"css",scss:"scss",sass:"scss",less:"less",html:"xml",htm:"xml",xml:"xml",svg:"xml",vue:"xml",md:"markdown",markdown:"markdown",mdx:"markdown",dockerfile:"dockerfile",makefile:"makefile",lua:"lua",pl:"perl",r:"r",dart:"dart",diff:"diff",patch:"diff",graphql:"graphql",gql:"graphql"};function ua(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ga(t){const e=t.toLowerCase();if(e==="dockerfile"||e.endsWith(".dockerfile"))return"dockerfile";if(e==="makefile")return"makefile";const n=e.lastIndexOf(".");if(!(n<0))return da[e.slice(n+1)]}function ba(t,e){const n=ga(e);try{return n&&Ze.getLanguage(n)?Ze.highlight(t,{language:n}).value:Ze.highlightAuto(t).value}catch{return ua(t)}}function ma({code:t,fileName:e,className:n}){const o=oe.useMemo(()=>ba(t,e),[t,e]),a=oe.useMemo(()=>t.split(`
|
|
14
14
|
`).length,[t]),i=oe.useMemo(()=>Array.from({length:a},(l,g)=>g+1).join(`
|
|
15
15
|
`),[a]);return h.jsxs("div",{className:gt("hljs flex w-full overflow-x-auto font-mono text-[13px] leading-[1.5] [-webkit-overflow-scrolling:touch]",n),children:[h.jsx("pre",{"aria-hidden":"true",className:"m-0 shrink-0 select-none border-r border-current/10 px-3 py-2 text-right opacity-40",style:{whiteSpace:"pre"},children:i}),h.jsx("pre",{className:"m-0 min-w-0 flex-1 px-3 py-2",style:{whiteSpace:"pre"},children:h.jsx("code",{className:"hljs bg-transparent",dangerouslySetInnerHTML:{__html:o}})})]})}function pa(t){return oe.useMemo(()=>t?Ve(t):null,[t])}function Gn(t,e,n){const o=new AbortController,a=ft(n,"download",()=>o.abort());Et(t,e,n,{onLeg:a.leg,signal:o.signal}).then(()=>a.success(nn.t("files.transfer.downloaded",{name:n}))).catch(()=>{o.signal.aborted?a.cancel():a.fail(nn.t("files.transfer.downloadFailed",{name:n}))})}function Hn(t){const e=t.lastIndexOf("/");return e>=0?t.slice(e+1):t}function _a(t){const e=t.lastIndexOf("/");return e>0?t.slice(0,e):"/"}const fa=new Set(["code","markdown","text"]);function V({icon:t,text:e}){return h.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center text-muted-foreground",children:[t,h.jsx("span",{className:"text-sm",children:e})]})}function Wn(t,e){return t?t.code?e(`files.error.${t.code}`):t.message||e("file.loadFailed"):e("file.loadFailed")}function Yn({rootId:t,path:e,name:n,text:o}){const{t:a}=ae();return h.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4 px-6 text-center",children:[h.jsx(ne,{className:"size-10 text-muted-foreground/60"}),h.jsx("span",{className:"text-sm text-muted-foreground break-all",children:o}),h.jsxs(se,{variant:"default",size:"sm",onClick:()=>Gn(t,e,n),children:[h.jsx(Kn,{className:"h-4 w-4"}),a("file.download")]})]})}function Ea({rootId:t,stat:e}){const{t:n}=ae(),o=e.size>0?_t(e.size):"";return h.jsx(Yn,{rootId:t,path:e.path,name:e.name,text:`${n("file.notPreviewable")}${o?` · ${o}`:""}`})}function ha({rootId:t,path:e,name:n}){return h.jsx("div",{className:"flex h-full w-full items-center justify-center overflow-auto p-4",children:h.jsx("img",{src:te(t,e),alt:n,className:"max-h-full max-w-full object-contain","data-testid":"file-image"})})}function Na({rootId:t,path:e,category:n}){return n==="audio"?h.jsx("div",{className:"flex h-full items-center justify-center p-6",children:h.jsx("audio",{controls:!0,src:te(t,e),className:"w-full max-w-xl"})}):h.jsx("div",{className:"flex h-full items-center justify-center p-4",children:h.jsx("video",{controls:!0,src:te(t,e),className:"max-h-full max-w-full"})})}function ya({rootId:t,path:e,name:n}){return h.jsx("iframe",{title:n,src:te(t,e),className:"h-full w-full border-0"})}function va({rootId:t,path:e,category:n,name:o}){var g;const{t:a}=ae(),i=$n({queryKey:["files","content",t,e],queryFn:()=>ht(t,e),retry:!1,refetchOnWindowFocus:!1});if(i.isLoading)return h.jsx(V,{icon:h.jsx(qn,{className:"size-6 animate-spin"}),text:a("common.loading")});if(i.isError){const d=i.error;return d.code==="too_large"||d.code==="binary"?h.jsx(Yn,{rootId:t,path:e,name:o,text:a(`files.error.${d.code}`)}):h.jsx(V,{icon:h.jsx(ne,{className:"size-8"}),text:Wn(d,a)})}const l=((g=i.data)==null?void 0:g.content)??"";return n==="markdown"?h.jsx("div",{className:"h-full overflow-auto px-4 py-4 md:px-6",children:h.jsx(vt,{source:l,basePath:_a(e),className:"mx-auto max-w-3xl"})}):h.jsx(ma,{code:l,fileName:o,className:"h-full"})}function Sa(){const{ref:t}=bt(),e=pa(t),{t:n}=ae(),o=$n({queryKey:["files","stat",e==null?void 0:e.rootId,e==null?void 0:e.path],queryFn:()=>Nt(e==null?void 0:e.rootId,e==null?void 0:e.path),enabled:!!e,retry:!1,refetchOnWindowFocus:!1});if(!e)return h.jsx(V,{icon:h.jsx(ne,{className:"size-8"}),text:n("file.invalidRef")});if(o.isLoading)return h.jsx(V,{icon:h.jsx(qn,{className:"size-6 animate-spin"}),text:n("common.loading")});if(o.isError)return h.jsx(V,{icon:h.jsx(ne,{className:"size-8"}),text:Wn(o.error,n)});const a=o.data;if(!a)return h.jsx(V,{icon:h.jsx(ne,{className:"size-8"}),text:n("file.loadFailed")});if(a.type==="dir"||a.category==="directory")return h.jsx(V,{text:n("file.isDirectory")});const{rootId:i,path:l}=e;switch(a.category){case"image":return h.jsx(ha,{rootId:i,path:l,name:a.name});case"pdf":return h.jsx(ya,{rootId:i,path:l,name:a.name});case"audio":case"video":return h.jsx(Na,{rootId:i,path:l,category:a.category});default:return fa.has(a.category)?h.jsx(va,{rootId:i,path:l,category:a.category,name:a.name}):h.jsx(Ea,{rootId:i,stat:a})}}function Aa({ref:t}){const e=t?Ve(t):null;return h.jsx("span",{className:"truncate font-mono",children:e?Hn(e.path):""})}function Oa({ref:t}){const{t:e}=ae(),n=mt(),o=t?Ve(t):null;if(!o)return null;const{rootId:a,path:i}=o,l=()=>{n.invalidateQueries({queryKey:["files","stat",a,i]}),n.invalidateQueries({queryKey:["files","content",a,i]})};return h.jsxs(h.Fragment,{children:[h.jsx(se,{variant:"ghost",size:"icon-sm",onClick:l,title:e("common.refresh"),"data-testid":"file-refresh",children:h.jsx(pt,{className:"h-4 w-4"})}),h.jsx("a",{href:te(a,i),target:"_blank",rel:"noopener noreferrer",title:e("file.openRaw"),children:h.jsx(se,{variant:"ghost",size:"icon-sm",children:h.jsx(wt,{className:"h-4 w-4"})})}),h.jsx(se,{variant:"ghost",size:"icon-sm","data-testid":"file-download-action",title:e("file.download"),onClick:()=>Gn(a,i,Hn(i)),children:h.jsx(Kn,{className:"h-4 w-4"})})]})}export{Oa as PageActions,Aa as PageTitle,Sa as default};
|
|
16
|
-
//# sourceMappingURL=FilePage-
|
|
16
|
+
//# sourceMappingURL=FilePage-DFvyeBg8.js.map
|