tmex-cli 0.15.0 → 0.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/CHANGELOG.md +8 -18
  2. package/dist/runtime/server.js +29 -19
  3. package/package.json +1 -1
  4. package/resources/fe-dist/assets/{DevicePage-kndrXVHE.js → DevicePage-BvwXdfhK.js} +1 -1
  5. package/resources/fe-dist/assets/{DevicesPage-CZLzOS04.js → DevicesPage-DVAiqqAb.js} +1 -1
  6. package/resources/fe-dist/assets/{FilePage-CxVqdlbt.js → FilePage-DzKIB_pN.js} +1 -1
  7. package/resources/fe-dist/assets/{SettingsPage-C50JRe91.js → SettingsPage-BTLab-Z3.js} +1 -1
  8. package/resources/fe-dist/assets/{agent-tab-BVWxou-d.js → agent-tab-DRxXq67W.js} +1 -1
  9. package/resources/fe-dist/assets/{api-CrHrQflz.js → api-B_pG5Lrn.js} +1 -1
  10. package/resources/fe-dist/assets/{arc-fsY_kDTa.js → arc-Bct5uFHQ.js} +1 -1
  11. package/resources/fe-dist/assets/{architectureDiagram-3BPJPVTR-Vsg8Cd3e.js → architectureDiagram-3BPJPVTR-BRDZ_iL7.js} +1 -1
  12. package/resources/fe-dist/assets/{blockDiagram-GPEHLZMM-G7sC3DZO.js → blockDiagram-GPEHLZMM-COe9KyYv.js} +1 -1
  13. package/resources/fe-dist/assets/{c4Diagram-AAUBKEIU-C1AfLOva.js → c4Diagram-AAUBKEIU-DtQTgbwo.js} +1 -1
  14. package/resources/fe-dist/assets/{card-CXa-2u8i.js → card-DAJtOO99.js} +1 -1
  15. package/resources/fe-dist/assets/channel-CIG-CxyN.js +1 -0
  16. package/resources/fe-dist/assets/{chunk-2J33WTMH-C1p02eGI.js → chunk-2J33WTMH-D4_zLlF4.js} +1 -1
  17. package/resources/fe-dist/assets/{chunk-4BX2VUAB-C8n2FURp.js → chunk-4BX2VUAB-C3M9MnUk.js} +1 -1
  18. package/resources/fe-dist/assets/{chunk-55IACEB6-Da0nuNCD.js → chunk-55IACEB6-D5BgUYDW.js} +1 -1
  19. package/resources/fe-dist/assets/{chunk-727SXJPM-C1TXyDEt.js → chunk-727SXJPM-C03K3kUu.js} +1 -1
  20. package/resources/fe-dist/assets/{chunk-AQP2D5EJ-CnRKlbXo.js → chunk-AQP2D5EJ-DLv4_X-p.js} +1 -1
  21. package/resources/fe-dist/assets/{chunk-FMBD7UC4-B8HGrJ3t.js → chunk-FMBD7UC4-CXm-3D35.js} +1 -1
  22. package/resources/fe-dist/assets/{chunk-ND2GUHAM-CcN2Ou-o.js → chunk-ND2GUHAM-DH_J0yjP.js} +1 -1
  23. package/resources/fe-dist/assets/{chunk-QZHKN3VN-DfWJ_tl5.js → chunk-QZHKN3VN-D5HtoYCj.js} +1 -1
  24. package/resources/fe-dist/assets/classDiagram-4FO5ZUOK-CNRZMNkk.js +1 -0
  25. package/resources/fe-dist/assets/classDiagram-v2-Q7XG4LA2-CNRZMNkk.js +1 -0
  26. package/resources/fe-dist/assets/{copy-BveLgJe5.js → copy-BfLwocwm.js} +1 -1
  27. package/resources/fe-dist/assets/{cose-bilkent-S5V4N54A-BkmsTzwU.js → cose-bilkent-S5V4N54A-be9ShD_r.js} +1 -1
  28. package/resources/fe-dist/assets/{dagre-BM42HDAG-pGgtc4EE.js → dagre-BM42HDAG-CC-KfeHH.js} +1 -1
  29. package/resources/fe-dist/assets/{diagram-2AECGRRQ-DJxixZvm.js → diagram-2AECGRRQ-BwKHXV4n.js} +1 -1
  30. package/resources/fe-dist/assets/{diagram-5GNKFQAL-2ITViev7.js → diagram-5GNKFQAL-Bqwpz1fr.js} +1 -1
  31. package/resources/fe-dist/assets/{diagram-KO2AKTUF-EMcadaeo.js → diagram-KO2AKTUF-CeMGb0yy.js} +1 -1
  32. package/resources/fe-dist/assets/{diagram-LMA3HP47-w3sLU7zY.js → diagram-LMA3HP47-Bsi1wTvw.js} +1 -1
  33. package/resources/fe-dist/assets/{diagram-OG6HWLK6-B4KGMQr7.js → diagram-OG6HWLK6-B4t3XGFO.js} +1 -1
  34. package/resources/fe-dist/assets/{en_US-Chxeay8F.js → en_US-Cf2EOKiI.js} +1 -1
  35. package/resources/fe-dist/assets/{erDiagram-TEJ5UH35-CB0P-Wz7.js → erDiagram-TEJ5UH35-3Mvka2ky.js} +1 -1
  36. package/resources/fe-dist/assets/{files-tab-lNenDPFy.js → files-tab-CozXv_f8.js} +16 -21
  37. package/resources/fe-dist/assets/{flowDiagram-I6XJVG4X-CmBc7GAX.js → flowDiagram-I6XJVG4X-DkGA4Ke1.js} +1 -1
  38. package/resources/fe-dist/assets/{ganttDiagram-6RSMTGT7-CHNf7S_K.js → ganttDiagram-6RSMTGT7-3vhFpRP7.js} +1 -1
  39. package/resources/fe-dist/assets/{gitGraphDiagram-PVQCEYII-CabspIF1.js → gitGraphDiagram-PVQCEYII-CQV7XGpo.js} +1 -1
  40. package/resources/fe-dist/assets/{index-DOaZjm8K.js → index-CEPc0i5O.js} +64 -59
  41. package/resources/fe-dist/assets/index-CHeveVji.css +1 -0
  42. package/resources/fe-dist/assets/{index-BQbq6q_-.js → index-CxrkvaQh.js} +1 -1
  43. package/resources/fe-dist/assets/{infoDiagram-5YYISTIA-ny6wqvHH.js → infoDiagram-5YYISTIA-Do4YMzZB.js} +1 -1
  44. package/resources/fe-dist/assets/{ishikawaDiagram-YF4QCWOH-EFCdGVsV.js → ishikawaDiagram-YF4QCWOH-D0s__l6a.js} +1 -1
  45. package/resources/fe-dist/assets/{ja_JP-BI-C8I9X.js → ja_JP-s3e_OwvM.js} +1 -1
  46. package/resources/fe-dist/assets/{journeyDiagram-JHISSGLW-Cvi8jO9a.js → journeyDiagram-JHISSGLW-DZWnugOc.js} +1 -1
  47. package/resources/fe-dist/assets/{kanban-definition-UN3LZRKU-nKej8tSo.js → kanban-definition-UN3LZRKU-BgRtdsFS.js} +1 -1
  48. package/resources/fe-dist/assets/{linear-leOPyu29.js → linear-yx1vNDZX.js} +1 -1
  49. package/resources/fe-dist/assets/{markdown-preview-rqUSs5w8.js → markdown-preview-BE4zuZfN.js} +3 -3
  50. package/resources/fe-dist/assets/{mermaid.core-QvhJBi8f.js → mermaid.core-DE3GlZm2.js} +5 -5
  51. package/resources/fe-dist/assets/{mindmap-definition-RKZ34NQL-xWje0B_-.js → mindmap-definition-RKZ34NQL-25O7ch2Y.js} +1 -1
  52. package/resources/fe-dist/assets/{pieDiagram-4H26LBE5-DT1i53ec.js → pieDiagram-4H26LBE5-Nsg0nJjf.js} +1 -1
  53. package/resources/fe-dist/assets/{quadrantDiagram-W4KKPZXB-C1zbS4Tx.js → quadrantDiagram-W4KKPZXB-vf_qGk-r.js} +1 -1
  54. package/resources/fe-dist/assets/{requirementDiagram-4Y6WPE33-By_eNRll.js → requirementDiagram-4Y6WPE33-BFfrHVO7.js} +1 -1
  55. package/resources/fe-dist/assets/{sankeyDiagram-5OEKKPKP-CG7jC05N.js → sankeyDiagram-5OEKKPKP-Ce_HayCK.js} +1 -1
  56. package/resources/fe-dist/assets/{send-CcFyyX2G.js → send-CKtMOmLP.js} +1 -1
  57. package/resources/fe-dist/assets/{sequenceDiagram-3UESZ5HK-C9yK_EKN.js → sequenceDiagram-3UESZ5HK-C2vovJ8X.js} +1 -1
  58. package/resources/fe-dist/assets/{stateDiagram-AJRCARHV-B-ROUwGP.js → stateDiagram-AJRCARHV-CLu4laAA.js} +1 -1
  59. package/resources/fe-dist/assets/stateDiagram-v2-BHNVJYJU-CIfUS4rj.js +1 -0
  60. package/resources/fe-dist/assets/{terminal-settings-panel-CNwWqOMV.js → terminal-settings-panel-DAWL48fe.js} +1 -1
  61. package/resources/fe-dist/assets/{timeline-definition-PNZ67QCA-yMM8VB4U.js → timeline-definition-PNZ67QCA-DkWMKmAT.js} +1 -1
  62. package/resources/fe-dist/assets/{transfer-toast-mQs0hgyg.js → transfer-toast-CHZr1a7O.js} +1 -1
  63. package/resources/fe-dist/assets/{triangle-alert-DMp7kMmJ.js → triangle-alert-03d4TB5d.js} +1 -1
  64. package/resources/fe-dist/assets/{vennDiagram-CIIHVFJN-CE08llZ3.js → vennDiagram-CIIHVFJN-BBlcBoH2.js} +1 -1
  65. package/resources/fe-dist/assets/{wardley-L42UT6IY-BKLGCmLJ.js → wardley-L42UT6IY-BnzmzjjA.js} +1 -1
  66. package/resources/fe-dist/assets/{wardleyDiagram-YWT4CUSO-BsjwfO3P.js → wardleyDiagram-YWT4CUSO-B3u1V3qc.js} +1 -1
  67. package/resources/fe-dist/assets/{xychartDiagram-2RQKCTM6-Bhz6AI7w.js → xychartDiagram-2RQKCTM6-BTm5HZXX.js} +1 -1
  68. package/resources/fe-dist/assets/{zap-DPwn8lbv.js → zap-CBeeCQFr.js} +1 -1
  69. package/resources/fe-dist/assets/{zh_CN-DE-BaQ3P.js → zh_CN-6UyMkvZM.js} +1 -1
  70. package/resources/fe-dist/index.html +2 -2
  71. package/resources/fe-dist/assets/channel-DS4kWkSb.js +0 -1
  72. package/resources/fe-dist/assets/classDiagram-4FO5ZUOK-BfsrnUi9.js +0 -1
  73. package/resources/fe-dist/assets/classDiagram-v2-Q7XG4LA2-BfsrnUi9.js +0 -1
  74. package/resources/fe-dist/assets/index-DaOR3c0u.css +0 -1
  75. package/resources/fe-dist/assets/stateDiagram-v2-BHNVJYJU-iopOcale.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,29 +1,19 @@
1
- # 0.15.0
1
+ # 0.15.2
2
2
 
3
- _2026-06-29_
3
+ _2026-06-30_
4
4
 
5
5
  ## English
6
6
 
7
- ### Bug Fixes
7
+ ### Features
8
8
 
9
- - Fix iOS PWA losing WebSocket connection permanently after backgrounding. The client now detects zombie connections via pong timeout and automatically reconnects when the page returns to foreground. (`42c8249`)
10
- - Fix stdin heartbeat and `%pause` handling in control mode; improve pump recovery on unexpected disconnects. (`a208371`)
11
-
12
- ### Improvements
13
-
14
- - Add a floating connection status indicator (bottom-right corner) that shows reconnecting state and provides a manual reconnect button when all retries are exhausted. Replaces the previous unhelpful error toast.
15
- - Display WebSocket latency next to the dark mode toggle in the sidebar. Values >= 150 ms are highlighted in red.
9
+ - Show the current working directory of the active pane in the sidebar (e.g. `zsh@~/projects/myapp`)
10
+ - Add "New window here" context menu item on windows and panes to open a new window in the same directory
16
11
 
17
12
  ---
18
13
 
19
14
  ## 中文
20
15
 
21
- ### 问题修复
22
-
23
- - 修复 iOS PWA 后台化后 WebSocket 永久断连的问题。客户端现在通过 pong 超时检测僵尸连接,页面回到前台时自动恢复连接。(`42c8249`)
24
- - 修复控制模式下 stdin 心跳和 `%pause` 处理问题,改善意外断连时的 pump 恢复。(`a208371`)
25
-
26
- ### 体验优化
16
+ ### 新功能
27
17
 
28
- - 新增浮动连接状态指示器(右下角),显示重连状态,重试耗尽后提供手动重连按钮。替换了之前不友好的错误 toast。
29
- - 在侧边栏深色模式开关旁显示 WebSocket 延迟,延迟 >= 150 ms 时标红。
18
+ - 侧边栏显示当前活动面板的工作目录(如 `zsh@~/projects/myapp`)
19
+ - 窗口和面板右键菜单新增「在此目录新建窗口」,可在当前目录打开新窗口
@@ -23363,6 +23363,7 @@ Time: {{time}}`,
23363
23363
  window: {
23364
23364
  noWindows: "No windows",
23365
23365
  new: "New Window",
23366
+ newInCwd: "New window here",
23366
23367
  close: "Close window",
23367
23368
  closePane: "Close pane",
23368
23369
  closeConfirmTitle: "Close this window?",
@@ -24361,6 +24362,7 @@ Bot\uFF1A{{botName}}
24361
24362
  window: {
24362
24363
  noWindows: "\u6682\u65E0\u7A97\u53E3",
24363
24364
  new: "\u65B0\u5EFA\u7A97\u53E3",
24365
+ newInCwd: "\u5728\u6B64\u76EE\u5F55\u65B0\u5EFA\u7A97\u53E3",
24364
24366
  close: "\u5173\u95ED\u7A97\u53E3",
24365
24367
  closePane: "\u5173\u95ED\u9762\u677F",
24366
24368
  closeConfirmTitle: "\u5173\u95ED\u6B64\u7A97\u53E3\uFF1F",
@@ -25359,6 +25361,7 @@ Bot\uFF1A{{botName}}
25359
25361
  window: {
25360
25362
  noWindows: "\u30A6\u30A3\u30F3\u30C9\u30A6\u304C\u3042\u308A\u307E\u305B\u3093",
25361
25363
  new: "\u65B0\u898F\u30A6\u30A3\u30F3\u30C9\u30A6",
25364
+ newInCwd: "\u3053\u306E\u5834\u6240\u3067\u65B0\u898F\u30A6\u30A3\u30F3\u30C9\u30A6",
25362
25365
  close: "\u30A6\u30A3\u30F3\u30C9\u30A6\u3092\u9589\u3058\u308B",
25363
25366
  closePane: "\u30DA\u30A4\u30F3\u3092\u9589\u3058\u308B",
25364
25367
  closeConfirmTitle: "\u3053\u306E\u30A6\u30A3\u30F3\u30C9\u30A6\u3092\u9589\u3058\u307E\u3059\u304B\uFF1F",
@@ -25995,7 +25998,8 @@ var TmuxSelectWindowSchema = import_zorsh.b.struct({
25995
25998
  });
25996
25999
  var TmuxCreateWindowSchema = import_zorsh.b.struct({
25997
26000
  deviceId: import_zorsh.b.string(),
25998
- name: OptionStringSchema
26001
+ name: OptionStringSchema,
26002
+ cwd: OptionStringSchema
25999
26003
  });
26000
26004
  var TmuxCloseWindowSchema = import_zorsh.b.struct({
26001
26005
  deviceId: import_zorsh.b.string(),
@@ -26094,7 +26098,8 @@ var PaneWireSchema = import_zorsh.b.struct({
26094
26098
  title: OptionStringSchema,
26095
26099
  active: import_zorsh.b.bool(),
26096
26100
  width: import_zorsh.b.u16(),
26097
- height: import_zorsh.b.u16()
26101
+ height: import_zorsh.b.u16(),
26102
+ currentPath: OptionStringSchema
26098
26103
  });
26099
26104
  var WindowWireSchema = import_zorsh.b.struct({
26100
26105
  id: import_zorsh.b.string(),
@@ -26561,7 +26566,8 @@ function encodePaneWire(pane) {
26561
26566
  title: pane.title ?? null,
26562
26567
  active: pane.active,
26563
26568
  width: pane.width,
26564
- height: pane.height
26569
+ height: pane.height,
26570
+ currentPath: pane.currentPath ?? null
26565
26571
  };
26566
26572
  }
26567
26573
  function decodeDeviceEventPayload(data) {
@@ -26692,7 +26698,8 @@ function decodePaneWire(wire) {
26692
26698
  title: wire.title ?? undefined,
26693
26699
  active: wire.active,
26694
26700
  width: wire.width,
26695
- height: wire.height
26701
+ height: wire.height,
26702
+ currentPath: wire.currentPath ?? undefined
26696
26703
  };
26697
26704
  }
26698
26705
  // ../shared/src/index.ts
@@ -99102,11 +99109,11 @@ class LocalExternalTmuxConnection {
99102
99109
  this.callbacks.onError(error51);
99103
99110
  });
99104
99111
  }
99105
- createWindow(name24) {
99112
+ createWindow(name24, cwd) {
99106
99113
  if (!this.connected) {
99107
99114
  return;
99108
99115
  }
99109
- const argv = ["new-window", "-t", this.sessionName, "-c", this.resolveDefaultWorkingDir()];
99116
+ const argv = ["new-window", "-t", this.sessionName, "-c", cwd ?? this.resolveDefaultWorkingDir()];
99110
99117
  if (name24) {
99111
99118
  argv.push("-n", name24);
99112
99119
  }
@@ -99643,7 +99650,8 @@ class LocalExternalTmuxConnection {
99643
99650
  "#{pane_width}",
99644
99651
  "#{pane_height}",
99645
99652
  "#{window_active}",
99646
- "#{pane_current_command}"
99653
+ "#{pane_current_command}",
99654
+ "#{pane_current_path}"
99647
99655
  ].join(SNAPSHOT_FIELD_SEPARATOR)
99648
99656
  ])
99649
99657
  ]);
@@ -99726,7 +99734,7 @@ ${panesRes.stderr}`;
99726
99734
  if (!line.trim()) {
99727
99735
  continue;
99728
99736
  }
99729
- const [paneId, windowId, indexRaw, titleRaw, activeRaw, widthRaw, heightRaw, windowActiveRaw, currentCommandRaw] = splitSnapshotFields(line, 9);
99737
+ const [paneId, windowId, indexRaw, titleRaw, activeRaw, widthRaw, heightRaw, windowActiveRaw, currentCommandRaw, currentPathRaw] = splitSnapshotFields(line, 10);
99730
99738
  const index = parseSnapshotInteger(indexRaw);
99731
99739
  const width = parseSnapshotInteger(widthRaw);
99732
99740
  const height = parseSnapshotInteger(heightRaw);
@@ -99740,6 +99748,7 @@ ${panesRes.stderr}`;
99740
99748
  index,
99741
99749
  title: this.pendingPaneTitles.get(paneId) ?? (titleRaw?.trim() ? titleRaw : undefined),
99742
99750
  currentCommand: currentCommandRaw?.trim() ? currentCommandRaw.trim() : undefined,
99751
+ currentPath: currentPathRaw?.trim() ? currentPathRaw.trim() : undefined,
99743
99752
  active: activeRaw === "1",
99744
99753
  width,
99745
99754
  height
@@ -100395,11 +100404,11 @@ class SshExternalTmuxConnection {
100395
100404
  this.callbacks.onError(error51);
100396
100405
  });
100397
100406
  }
100398
- createWindow(name24) {
100407
+ createWindow(name24, cwd) {
100399
100408
  if (!this.connected) {
100400
100409
  return;
100401
100410
  }
100402
- const argv = ["new-window", "-t", this.sessionName, "-c", this.resolveDefaultWorkingDir()];
100411
+ const argv = ["new-window", "-t", this.sessionName, "-c", cwd ?? this.resolveDefaultWorkingDir()];
100403
100412
  if (name24) {
100404
100413
  argv.push("-n", name24);
100405
100414
  }
@@ -100992,7 +101001,7 @@ class SshExternalTmuxConnection {
100992
101001
  "-t",
100993
101002
  this.sessionName,
100994
101003
  "-F",
100995
- "#{pane_id}|#{window_id}|#{pane_index}|#{pane_title}|#{pane_active}|#{pane_width}|#{pane_height}|#{window_active}|#{pane_current_command}"
101004
+ "#{pane_id}|#{window_id}|#{pane_index}|#{pane_title}|#{pane_active}|#{pane_width}|#{pane_height}|#{window_active}|#{pane_current_command}|#{pane_current_path}"
100996
101005
  ])
100997
101006
  ]);
100998
101007
  if (sessionRes.exitCode !== 0 || windowsRes.exitCode !== 0 || panesRes.exitCode !== 0) {
@@ -101068,7 +101077,7 @@ ${panesRes.stderr}`;
101068
101077
  if (!line.trim()) {
101069
101078
  continue;
101070
101079
  }
101071
- const [paneId, windowId, indexRaw, titleRaw, activeRaw, widthRaw, heightRaw, windowActiveRaw, currentCommandRaw] = splitSnapshotFields(line, 9);
101080
+ const [paneId, windowId, indexRaw, titleRaw, activeRaw, widthRaw, heightRaw, windowActiveRaw, currentCommandRaw, currentPathRaw] = splitSnapshotFields(line, 10);
101072
101081
  const index = parseSnapshotInteger(indexRaw);
101073
101082
  const width = parseSnapshotInteger(widthRaw);
101074
101083
  const height = parseSnapshotInteger(heightRaw);
@@ -101082,6 +101091,7 @@ ${panesRes.stderr}`;
101082
101091
  index,
101083
101092
  title: this.pendingPaneTitles.get(paneId) ?? (titleRaw?.trim() ? titleRaw : undefined),
101084
101093
  currentCommand: currentCommandRaw?.trim() ? currentCommandRaw.trim() : undefined,
101094
+ currentPath: currentPathRaw?.trim() ? currentPathRaw.trim() : undefined,
101085
101095
  active: activeRaw === "1",
101086
101096
  width,
101087
101097
  height
@@ -101481,8 +101491,8 @@ class DeviceSessionRuntime {
101481
101491
  updateDefaultWorkingDir(dir2) {
101482
101492
  this.connection.updateDefaultWorkingDir(dir2);
101483
101493
  }
101484
- createWindow(name24) {
101485
- this.connection.createWindow(name24);
101494
+ createWindow(name24, cwd) {
101495
+ this.connection.createWindow(name24, cwd);
101486
101496
  }
101487
101497
  closeWindow(windowId) {
101488
101498
  this.connection.closeWindow(windowId);
@@ -106745,8 +106755,8 @@ function getBaseVersion() {
106745
106755
  if (cachedBase !== undefined)
106746
106756
  return cachedBase;
106747
106757
  let base = null;
106748
- if ("0.15.0") {
106749
- base = "0.15.0";
106758
+ if ("0.15.2") {
106759
+ base = "0.15.2";
106750
106760
  }
106751
106761
  if (!base && config.isProd) {
106752
106762
  base = readInstallMeta()?.cliVersion ?? null;
@@ -110120,7 +110130,7 @@ class WebSocketServer {
110120
110130
  }
110121
110131
  case exports_ws_borsh.KIND_TMUX_CREATE_WINDOW: {
110122
110132
  const decoded = exports_ws_borsh.decodePayload(exports_ws_borsh.schema.TmuxCreateWindowSchema, payload);
110123
- this.handleCreateWindow(decoded.deviceId, decoded.name ?? undefined);
110133
+ this.handleCreateWindow(decoded.deviceId, decoded.name ?? undefined, decoded.cwd ?? undefined);
110124
110134
  return;
110125
110135
  }
110126
110136
  case exports_ws_borsh.KIND_TMUX_CLOSE_WINDOW: {
@@ -110409,11 +110419,11 @@ class WebSocketServer {
110409
110419
  entry.runtime.sendInput(paneId, chunk2);
110410
110420
  }
110411
110421
  }
110412
- handleCreateWindow(deviceId, name24) {
110422
+ handleCreateWindow(deviceId, name24, cwd) {
110413
110423
  const entry = this.connections.get(deviceId);
110414
110424
  if (!entry)
110415
110425
  return;
110416
- entry.runtime.createWindow(name24);
110426
+ entry.runtime.createWindow(name24, cwd);
110417
110427
  }
110418
110428
  handleCloseWindow(deviceId, windowId) {
110419
110429
  const entry = this.connections.get(deviceId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tmex-cli",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "tmex": "./bin/tmex.js",
@@ -1,4 +1,4 @@
1
- import{Y as Fe,u as je,j as o,$ as tt,a0 as nt,a1 as rt,a2 as st,a3 as ot,a4 as it,r,d as H,a5 as J,a6 as Xe,a7 as Ke,a8 as ct,a9 as at,aa as lt,ab as Oe,o as xe,ac as ut,ad as Be,ae as dt,b as Ge,af as We,ag as ft,c as $e,ah as Ve,ai as Ee,aj as mt,ak as ht,al as ze,y as wt,am as pt,B as me,T as xt,an as vt,ao as gt,ap as St,aq as bt,A as Et,f as Rt,g as Tt,i as yt,k as jt,l as It,m as Ct,n as Nt}from"./index-DOaZjm8K.js";import{T as kt,C as Mt,c as Pt,F as At,a as Qe,R as Lt,A as _t,f as zt,t as Dt,S as Ft}from"./terminal-settings-panel-CNwWqOMV.js";import{w as Bt}from"./selection-clipboard-Dq6Zemfd.js";import{C as Wt}from"./copy-BveLgJe5.js";import{S as qe,K as $t}from"./send-CcFyyX2G.js";/**
1
+ import{Y as Fe,u as je,j as o,$ as tt,a0 as nt,a1 as rt,a2 as st,a3 as ot,a4 as it,r,d as H,a5 as J,a6 as Xe,a7 as Ke,a8 as ct,a9 as at,aa as lt,ab as Oe,o as xe,ac as ut,ad as Be,ae as dt,b as Ge,af as We,ag as ft,c as $e,ah as Ve,ai as Ee,aj as mt,ak as ht,al as ze,y as wt,am as pt,B as me,T as xt,an as vt,ao as gt,ap as St,aq as bt,A as Et,f as Rt,g as Tt,i as yt,k as jt,l as It,m as Ct,n as Nt}from"./index-CEPc0i5O.js";import{T as kt,C as Mt,c as Pt,F as At,a as Qe,R as Lt,A as _t,f as zt,t as Dt,S as Ft}from"./terminal-settings-panel-DAWL48fe.js";import{w as Bt}from"./selection-clipboard-Dq6Zemfd.js";import{C as Wt}from"./copy-BfLwocwm.js";import{S as qe,K as $t}from"./send-CKtMOmLP.js";/**
2
2
  * @license lucide-react v0.564.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{u as b,r as v,a as _,b as ie,c as re,d as ne,e as I,t as oe,j as s,M as X,B as C,P as Y,A as ce,f as de,g as le,h as ue,T as ee,i as me,k as he,l as pe,m as xe,n as ve,G as fe,o as f,D as ge,p as ye,E as je,q as we,s as $,v as Ne,w as De,x as Q,y as Ce,S as be,L as Se,z as ke,C as Ee,F as Me,H as Pe,I as Ie,J as Ke,K as x,N as z,O as V,Q as U,R as J,U as w,V as Re,W as $e}from"./index-DOaZjm8K.js";import{C as M,a as P,b as Ae,c as Te,d as Fe}from"./card-CXa-2u8i.js";import{Z as We}from"./zap-DPwn8lbv.js";function g(e){const o=e.trim();return o||void 0}function qe(e){return e?{name:e.name,type:e.type,host:e.host??"",port:e.port??22,username:e.username??"",sshConfigRef:e.sshConfigRef??"",session:e.session??"tmex",defaultWorkingDir:e.defaultWorkingDir??"",authMode:e.type==="local"?"auto":e.authMode,password:"",privateKey:"",privateKeyPassphrase:""}:{name:"",type:"local",host:"",port:22,username:"root",sshConfigRef:"",session:"tmex",defaultWorkingDir:"",authMode:"auto",password:"",privateKey:"",privateKeyPassphrase:""}}function Le(e){if(e.type==="local")return{name:e.name.trim(),type:"local",session:g(e.session)??"tmex",defaultWorkingDir:g(e.defaultWorkingDir),authMode:"auto"};const o={name:e.name.trim(),type:"ssh",host:e.host.trim(),port:e.port,username:e.username.trim(),session:g(e.session)??"tmex",defaultWorkingDir:g(e.defaultWorkingDir),authMode:e.authMode};return e.authMode==="configRef"&&(o.sshConfigRef=e.sshConfigRef.trim()),e.authMode==="password"&&(o.password=e.password),e.authMode==="key"&&(o.privateKey=e.privateKey,o.privateKeyPassphrase=e.privateKeyPassphrase||void 0),o}function He(e){if(e.type==="local")return{name:e.name.trim(),session:g(e.session)??"tmex",defaultWorkingDir:g(e.defaultWorkingDir)??"",authMode:"auto"};const o={name:e.name.trim(),host:e.host.trim(),port:e.port,username:e.username.trim(),sshConfigRef:e.authMode==="configRef"?e.sshConfigRef.trim():"",session:g(e.session)??"tmex",defaultWorkingDir:g(e.defaultWorkingDir)??"",authMode:e.authMode};return e.authMode==="password"&&e.password&&(o.password=e.password),e.authMode==="key"&&e.privateKey&&(o.privateKey=e.privateKey,o.privateKeyPassphrase=e.privateKeyPassphrase||void 0),o}function se(e){return Number.isInteger(e)&&e>=1&&e<=65535}function Oe(e){return e.type!=="ssh"?null:e.host.trim()?se(e.port)?e.username.trim()?e.authMode==="configRef"&&!e.sshConfigRef.trim()?"validation.sshConfigRequired":null:"validation.usernameRequired":"validation.portRequired":"validation.hostRequired"}async function G(e,o){try{return(await e.json()).error??o}catch{return o}}function Ue(){const{t:e}=b(),[o,m]=v.useState(!1),[t,y]=v.useState(null),[r,d]=v.useState(null),l=_(),h=ie(n=>{var p;return((p=n.settings)==null?void 0:p.language)??"en_US"});v.useEffect(()=>{const n=()=>m(!0);return window.addEventListener("tmex:open-add-device",n),()=>window.removeEventListener("tmex:open-add-device",n)},[]);const{data:c,isLoading:K,isError:N}=re({queryKey:["devices"],queryFn:async()=>{const n=await fetch("/api/devices");if(!n.ok)throw new Error(e("device.loadFailed"));return n.json()},throwOnError:!1}),S=ne(n=>n.hydrateDeviceErrors);v.useEffect(()=>{c!=null&&c.devices&&S(c.devices.map(n=>({deviceId:n.id,lastError:n.lastError??null,lastErrorType:n.lastErrorType??null})))},[c,S]);const k=I({mutationFn:async n=>{if(!(await fetch(`/api/devices/${n}`,{method:"DELETE"})).ok)throw new Error(e("device.deleteFailed"))},onSuccess:()=>{l.invalidateQueries({queryKey:["devices"]}),f.success(e("common.success"))},onError:n=>{f.error(n instanceof Error?n.message:e("common.error"))}}),E=v.useMemo(()=>[...(c==null?void 0:c.devices)??[]].sort((p,D)=>p.sortOrder-D.sortOrder||p.name.localeCompare(D.name,oe(h),{numeric:!0,sensitivity:"base"})),[c==null?void 0:c.devices,h]);return s.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:[K?s.jsx(M,{children:s.jsx(P,{className:"py-16 text-center text-sm text-muted-foreground",children:e("common.loading")})}):N?s.jsx(M,{children:s.jsx(P,{className:"py-16 text-center text-sm text-destructive",children:e("device.loadFailed")})}):E.length===0?s.jsx(M,{children:s.jsxs(P,{className:"space-y-4 py-14 text-center",children:[s.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-xl border border-border bg-muted",children:s.jsx(X,{className:"h-6 w-6 text-muted-foreground"})}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("h2",{className:"text-lg font-medium",children:e("device.noDevices")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:e("device.addDevice")})]}),s.jsxs(C,{variant:"default","data-testid":"devices-add-empty",onClick:()=>m(!0),children:[s.jsx(Y,{className:"h-4 w-4"}),e("device.addDevice")]})]})}):s.jsx("div",{className:"grid gap-3 lg:grid-cols-2",children:E.map(n=>s.jsx(Be,{device:n,onEdit:()=>y(n),onDelete:()=>d(n)},n.id))}),o&&s.jsx(Z,{mode:"create",onClose:()=>m(!1)}),t&&s.jsx(Z,{mode:"edit",device:t,onClose:()=>y(null)}),s.jsx(ce,{open:r!==null,onOpenChange:n=>!n&&d(null),children:s.jsxs(de,{children:[s.jsxs(le,{children:[s.jsx(ue,{className:"bg-destructive/10",children:s.jsx(ee,{className:"h-5 w-5 text-destructive"})}),s.jsx(me,{children:e("device.deleteConfirm")}),s.jsx(he,{children:e("device.deleteDescription",{name:(r==null?void 0:r.name)??""})})]}),s.jsxs(pe,{children:[s.jsx(xe,{children:e("common.cancel")}),s.jsx(ve,{variant:"destructive",disabled:!r||k.isPending,onClick:()=>{r&&(k.mutate(r.id),d(null))},children:e("common.delete")})]})]})})]})}function Be({device:e,onEdit:o,onDelete:m}){const{t}=b(),y=e.type==="local"?s.jsx(X,{className:"h-4 w-4"}):s.jsx(fe,{className:"h-4 w-4"}),r=e.type==="local"?t("device.typeLocal"):`${e.username??"-"}@${e.host??"-"}:${e.port??22}`,d=I({mutationFn:async()=>{const l=await fetch(`/api/devices/${e.id}/test-connection`,{method:"POST"});let h=null;try{h=await l.json()}catch{h=null}if(!l.ok){const c=h;throw new Error((c==null?void 0:c.error)??t("common.error"))}return h},onSuccess:l=>{f.success(l.message??t("common.success"))},onError:l=>{f.error(l instanceof Error?l.message:t("common.error"))}});return s.jsxs(M,{"data-testid":"device-card","data-device-id":e.id,"data-device-name":e.name,className:"overflow-hidden border-border/50",children:[s.jsxs(Ae,{className:"space-y-2 pb-2",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[s.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}),s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[s.jsx(Te,{className:"line-clamp-1 text-sm",title:e.name,children:e.name}),s.jsx(Fe,{className:"line-clamp-1 text-xs",children:r})]})]}),s.jsx("div",{className:"flex shrink-0 items-center gap-1",children:s.jsxs(ge,{children:[s.jsx(ye,{render:s.jsx(C,{variant:"ghost",size:"icon-sm","data-testid":`device-card-actions-${e.id}`,"aria-label":t("common.edit"),title:t("common.edit")}),children:s.jsx(je,{className:"h-4 w-4"})}),s.jsxs(we,{align:"end",children:[s.jsxs($,{"data-testid":`device-card-edit-${e.id}`,onClick:o,children:[s.jsx(Ne,{className:"h-4 w-4"}),t("common.edit")]}),e.type==="ssh"&&s.jsxs($,{"data-testid":`device-card-test-${e.id}`,onClick:()=>d.mutate(),disabled:d.isPending,children:[s.jsx(We,{className:"h-4 w-4"}),t("common.test")]}),s.jsx(De,{}),s.jsxs($,{"data-testid":`device-card-delete-${e.id}`,variant:"destructive",onClick:m,children:[s.jsx(ee,{className:"h-4 w-4"}),t("common.delete")]})]})]})})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[s.jsx(Q,{variant:"outline",className:"text-[11px] font-normal",children:e.type==="local"?t("device.typeLocal"):t("device.typeSSHBadge")}),e.session&&s.jsx(Q,{variant:"outline",className:"text-[11px] font-normal",children:e.session}),s.jsx(Ce,{deviceId:e.id})]})]}),s.jsxs(P,{className:"pt-0",children:[s.jsx(be,{className:"mb-2"}),s.jsx("div",{className:"flex items-center justify-end",children:s.jsx(Se,{to:`/devices/${e.id}`,"data-testid":`device-card-connect-${e.id}`,className:ke({variant:"outline",size:"sm"}),children:t("device.connect")})})]})]})}function Z({mode:e,device:o,onClose:m}){const{t}=b(),y=_(),[r,d]=v.useState(qe(o)),[l,h]=v.useState(!1),[c,K]=v.useState(!1),N=e==="edit",S=r.type==="ssh",k=I({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"]}),f.success(t("common.success")),m()},onError:a=>{f.error(a instanceof Error?a.message:t("common.error"))}}),E=I({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"]}),f.success(t("common.success")),m()},onError:a=>{f.error(a instanceof Error?a.message:t("common.error"))}}),n=async a=>{a.preventDefault(),K(!0);const i=Oe(r);if(i){f.error(t(i));return}h(!0);try{e==="create"?await k.mutateAsync(Le(r)):await E.mutateAsync(He(r))}catch{}finally{h(!1)}},p=`${e}-device-name`,D=`${e}-device-type`,A=`${e}-device-host`,T=`${e}-device-port`,F=`${e}-device-username`,W=`${e}-device-session`,q=`${e}-device-default-working-dir`,L=`${e}-device-auth-mode`,H=`${e}-device-password`,O=`${e}-device-private-key`,B=`${e}-device-private-key-passphrase`,te={local:t("device.typeLocal"),ssh:t("device.typeSSH")},ae={password:t("device.authPassword"),key:t("device.authKey"),agent:t("device.authAgent"),configRef:t("device.authConfigRef")},R=a=>s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:a}),u=(a,i,j)=>s.jsxs("label",{className:"block text-xs font-medium text-foreground",htmlFor:a,children:[i,j&&s.jsx("span",{className:"ml-0.5 text-destructive",children:"*"})]});return s.jsx(Ee,{open:!0,onOpenChange:a=>!a&&m(),children:s.jsxs(Me,{"data-testid":"device-dialog",className:"w-full max-w-2xl",children:[s.jsxs(Pe,{children:[s.jsx(Ie,{children:t(N?"device.editDevice":"device.addDevice")}),s.jsx(Ke,{children:t(N?"device.editDeviceDescription":"device.addDeviceDescription")})]}),s.jsxs("form",{onSubmit:n,className:"space-y-4",children:[s.jsxs("div",{className:"-mr-2 max-h-[min(70dvh,720px)] space-y-5 overflow-y-auto pr-2",children:[s.jsxs("section",{className:"space-y-2.5",children:[R(t("device.sectionBasic")),s.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[u(p,t("device.name"),!0),s.jsx(x,{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})]}),s.jsxs("div",{className:"space-y-1.5",children:[u(D,t("device.type")),s.jsxs(z,{value:r.type,onValueChange:a=>{if(!a)return;const i=a;d(j=>({...j,type:i,authMode:i==="local"?"auto":j.authMode==="auto"?"agent":j.authMode}))},disabled:N,children:[s.jsx(V,{id:D,"data-testid":"device-type-select",className:"w-full",children:s.jsx(U,{placeholder:t("device.type"),children:a=>te[a]??""})}),s.jsxs(J,{children:[s.jsx(w,{value:"local",children:t("device.typeLocal")}),s.jsx(w,{value:"ssh",children:t("device.typeSSH")})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[u(W,t("device.session")),s.jsx(x,{id:W,"data-testid":"device-session-input",type:"text",value:r.session,onChange:a=>d(i=>({...i,session:a.target.value})),placeholder:t("device.sessionPlaceholder")})]}),s.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[u(q,t("device.defaultWorkingDir")),s.jsx(x,{id:q,"data-testid":"device-default-working-dir-input",type:"text",value:r.defaultWorkingDir,onChange:a=>d(i=>({...i,defaultWorkingDir:a.target.value})),placeholder:t("device.defaultWorkingDirPlaceholder")})]})]})]}),S&&s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"space-y-2.5",children:[R(t("device.sectionConnection")),s.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[s.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[u(A,t("device.host"),!0),s.jsx(x,{id:A,type:"text",value:r.host,onChange:a=>d(i=>({...i,host:a.target.value})),placeholder:t("device.hostPlaceholder"),"aria-invalid":c&&!r.host.trim()})]}),s.jsxs("div",{className:"space-y-1.5",children:[u(T,t("device.port"),!0),s.jsx(x,{id:T,type:"number",value:Number.isNaN(r.port)?"":r.port,onChange:a=>{const i=a.target.value;d(j=>({...j,port:i===""?Number.NaN:Number.parseInt(i,10)}))},min:1,max:65535,"aria-invalid":c&&!se(r.port)})]}),s.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[u(F,t("device.username"),!0),s.jsx(x,{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()})]})]})]}),s.jsxs("section",{className:"space-y-2.5",children:[R(t("device.sectionAuth")),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[u(L,t("device.authMode")),s.jsxs(z,{value:r.authMode,onValueChange:a=>{a&&d(i=>({...i,authMode:a}))},children:[s.jsx(V,{id:L,"data-testid":"device-auth-mode-select",className:"w-full",children:s.jsx(U,{placeholder:t("device.authMode"),children:a=>ae[a]??""})}),s.jsxs(J,{children:[s.jsx(w,{value:"password",children:t("device.authPassword")}),s.jsx(w,{value:"key",children:t("device.authKey")}),s.jsx(w,{value:"agent",children:t("device.authAgent")}),s.jsx(w,{value:"configRef",children:t("device.authConfigRef")})]})]})]}),r.authMode==="password"&&s.jsxs("div",{className:"space-y-1.5",children:[u(H,t("device.password")),s.jsx(x,{id:H,type:"password",value:r.password,onChange:a=>d(i=>({...i,password:a.target.value}))})]}),r.authMode==="key"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-1.5",children:[u(O,t("device.privateKey")),s.jsx(Re,{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")})]}),s.jsxs("div",{className:"space-y-1.5",children:[u(B,t("device.passphrase")),s.jsx(x,{id:B,type:"password",value:r.privateKeyPassphrase,onChange:a=>d(i=>({...i,privateKeyPassphrase:a.target.value}))})]})]}),r.authMode==="configRef"&&s.jsxs("div",{className:"space-y-1.5",children:[u(`${e}-device-ssh-config-ref`,t("device.authConfigRef"),!0),s.jsx(x,{id:`${e}-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()}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:t("device.sshConfigRefHint")})]})]})]})]})]}),s.jsxs($e,{children:[s.jsx(C,{type:"button",variant:"outline",onClick:m,children:t("common.cancel")}),s.jsx(C,{type:"submit",variant:"default","data-testid":"device-dialog-save",disabled:l,children:t(l?"common.saving":"common.save")})]})]})]})})}function Je(){const{t:e}=b();return s.jsx(s.Fragment,{children:e("sidebar.manageDevices")})}function Ge(){const{t:e}=b(),o=()=>{window.dispatchEvent(new CustomEvent("tmex:open-add-device"))};return s.jsx(C,{variant:"ghost",size:"icon-sm","data-testid":"devices-add",onClick:o,"aria-label":e("sidebar.addDevice"),title:e("sidebar.addDevice"),children:s.jsx(Y,{className:"h-4 w-4"})})}export{Ge as PageActions,Je as PageTitle,Ue as default};
1
+ import{u as b,r as v,a as _,b as ie,c as re,d as ne,e as I,t as oe,j as s,M as X,B as C,P as Y,A as ce,f as de,g as le,h as ue,T as ee,i as me,k as he,l as pe,m as xe,n as ve,G as fe,o as f,D as ge,p as ye,E as je,q as we,s as $,v as Ne,w as De,x as Q,y as Ce,S as be,L as Se,z as ke,C as Ee,F as Me,H as Pe,I as Ie,J as Ke,K as x,N as z,O as V,Q as U,R as J,U as w,V as Re,W as $e}from"./index-CEPc0i5O.js";import{C as M,a as P,b as Ae,c as Te,d as Fe}from"./card-DAJtOO99.js";import{Z as We}from"./zap-CBeeCQFr.js";function g(e){const o=e.trim();return o||void 0}function qe(e){return e?{name:e.name,type:e.type,host:e.host??"",port:e.port??22,username:e.username??"",sshConfigRef:e.sshConfigRef??"",session:e.session??"tmex",defaultWorkingDir:e.defaultWorkingDir??"",authMode:e.type==="local"?"auto":e.authMode,password:"",privateKey:"",privateKeyPassphrase:""}:{name:"",type:"local",host:"",port:22,username:"root",sshConfigRef:"",session:"tmex",defaultWorkingDir:"",authMode:"auto",password:"",privateKey:"",privateKeyPassphrase:""}}function Le(e){if(e.type==="local")return{name:e.name.trim(),type:"local",session:g(e.session)??"tmex",defaultWorkingDir:g(e.defaultWorkingDir),authMode:"auto"};const o={name:e.name.trim(),type:"ssh",host:e.host.trim(),port:e.port,username:e.username.trim(),session:g(e.session)??"tmex",defaultWorkingDir:g(e.defaultWorkingDir),authMode:e.authMode};return e.authMode==="configRef"&&(o.sshConfigRef=e.sshConfigRef.trim()),e.authMode==="password"&&(o.password=e.password),e.authMode==="key"&&(o.privateKey=e.privateKey,o.privateKeyPassphrase=e.privateKeyPassphrase||void 0),o}function He(e){if(e.type==="local")return{name:e.name.trim(),session:g(e.session)??"tmex",defaultWorkingDir:g(e.defaultWorkingDir)??"",authMode:"auto"};const o={name:e.name.trim(),host:e.host.trim(),port:e.port,username:e.username.trim(),sshConfigRef:e.authMode==="configRef"?e.sshConfigRef.trim():"",session:g(e.session)??"tmex",defaultWorkingDir:g(e.defaultWorkingDir)??"",authMode:e.authMode};return e.authMode==="password"&&e.password&&(o.password=e.password),e.authMode==="key"&&e.privateKey&&(o.privateKey=e.privateKey,o.privateKeyPassphrase=e.privateKeyPassphrase||void 0),o}function se(e){return Number.isInteger(e)&&e>=1&&e<=65535}function Oe(e){return e.type!=="ssh"?null:e.host.trim()?se(e.port)?e.username.trim()?e.authMode==="configRef"&&!e.sshConfigRef.trim()?"validation.sshConfigRequired":null:"validation.usernameRequired":"validation.portRequired":"validation.hostRequired"}async function G(e,o){try{return(await e.json()).error??o}catch{return o}}function Ue(){const{t:e}=b(),[o,m]=v.useState(!1),[t,y]=v.useState(null),[r,d]=v.useState(null),l=_(),h=ie(n=>{var p;return((p=n.settings)==null?void 0:p.language)??"en_US"});v.useEffect(()=>{const n=()=>m(!0);return window.addEventListener("tmex:open-add-device",n),()=>window.removeEventListener("tmex:open-add-device",n)},[]);const{data:c,isLoading:K,isError:N}=re({queryKey:["devices"],queryFn:async()=>{const n=await fetch("/api/devices");if(!n.ok)throw new Error(e("device.loadFailed"));return n.json()},throwOnError:!1}),S=ne(n=>n.hydrateDeviceErrors);v.useEffect(()=>{c!=null&&c.devices&&S(c.devices.map(n=>({deviceId:n.id,lastError:n.lastError??null,lastErrorType:n.lastErrorType??null})))},[c,S]);const k=I({mutationFn:async n=>{if(!(await fetch(`/api/devices/${n}`,{method:"DELETE"})).ok)throw new Error(e("device.deleteFailed"))},onSuccess:()=>{l.invalidateQueries({queryKey:["devices"]}),f.success(e("common.success"))},onError:n=>{f.error(n instanceof Error?n.message:e("common.error"))}}),E=v.useMemo(()=>[...(c==null?void 0:c.devices)??[]].sort((p,D)=>p.sortOrder-D.sortOrder||p.name.localeCompare(D.name,oe(h),{numeric:!0,sensitivity:"base"})),[c==null?void 0:c.devices,h]);return s.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:[K?s.jsx(M,{children:s.jsx(P,{className:"py-16 text-center text-sm text-muted-foreground",children:e("common.loading")})}):N?s.jsx(M,{children:s.jsx(P,{className:"py-16 text-center text-sm text-destructive",children:e("device.loadFailed")})}):E.length===0?s.jsx(M,{children:s.jsxs(P,{className:"space-y-4 py-14 text-center",children:[s.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-xl border border-border bg-muted",children:s.jsx(X,{className:"h-6 w-6 text-muted-foreground"})}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("h2",{className:"text-lg font-medium",children:e("device.noDevices")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:e("device.addDevice")})]}),s.jsxs(C,{variant:"default","data-testid":"devices-add-empty",onClick:()=>m(!0),children:[s.jsx(Y,{className:"h-4 w-4"}),e("device.addDevice")]})]})}):s.jsx("div",{className:"grid gap-3 lg:grid-cols-2",children:E.map(n=>s.jsx(Be,{device:n,onEdit:()=>y(n),onDelete:()=>d(n)},n.id))}),o&&s.jsx(Z,{mode:"create",onClose:()=>m(!1)}),t&&s.jsx(Z,{mode:"edit",device:t,onClose:()=>y(null)}),s.jsx(ce,{open:r!==null,onOpenChange:n=>!n&&d(null),children:s.jsxs(de,{children:[s.jsxs(le,{children:[s.jsx(ue,{className:"bg-destructive/10",children:s.jsx(ee,{className:"h-5 w-5 text-destructive"})}),s.jsx(me,{children:e("device.deleteConfirm")}),s.jsx(he,{children:e("device.deleteDescription",{name:(r==null?void 0:r.name)??""})})]}),s.jsxs(pe,{children:[s.jsx(xe,{children:e("common.cancel")}),s.jsx(ve,{variant:"destructive",disabled:!r||k.isPending,onClick:()=>{r&&(k.mutate(r.id),d(null))},children:e("common.delete")})]})]})})]})}function Be({device:e,onEdit:o,onDelete:m}){const{t}=b(),y=e.type==="local"?s.jsx(X,{className:"h-4 w-4"}):s.jsx(fe,{className:"h-4 w-4"}),r=e.type==="local"?t("device.typeLocal"):`${e.username??"-"}@${e.host??"-"}:${e.port??22}`,d=I({mutationFn:async()=>{const l=await fetch(`/api/devices/${e.id}/test-connection`,{method:"POST"});let h=null;try{h=await l.json()}catch{h=null}if(!l.ok){const c=h;throw new Error((c==null?void 0:c.error)??t("common.error"))}return h},onSuccess:l=>{f.success(l.message??t("common.success"))},onError:l=>{f.error(l instanceof Error?l.message:t("common.error"))}});return s.jsxs(M,{"data-testid":"device-card","data-device-id":e.id,"data-device-name":e.name,className:"overflow-hidden border-border/50",children:[s.jsxs(Ae,{className:"space-y-2 pb-2",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[s.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}),s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[s.jsx(Te,{className:"line-clamp-1 text-sm",title:e.name,children:e.name}),s.jsx(Fe,{className:"line-clamp-1 text-xs",children:r})]})]}),s.jsx("div",{className:"flex shrink-0 items-center gap-1",children:s.jsxs(ge,{children:[s.jsx(ye,{render:s.jsx(C,{variant:"ghost",size:"icon-sm","data-testid":`device-card-actions-${e.id}`,"aria-label":t("common.edit"),title:t("common.edit")}),children:s.jsx(je,{className:"h-4 w-4"})}),s.jsxs(we,{align:"end",children:[s.jsxs($,{"data-testid":`device-card-edit-${e.id}`,onClick:o,children:[s.jsx(Ne,{className:"h-4 w-4"}),t("common.edit")]}),e.type==="ssh"&&s.jsxs($,{"data-testid":`device-card-test-${e.id}`,onClick:()=>d.mutate(),disabled:d.isPending,children:[s.jsx(We,{className:"h-4 w-4"}),t("common.test")]}),s.jsx(De,{}),s.jsxs($,{"data-testid":`device-card-delete-${e.id}`,variant:"destructive",onClick:m,children:[s.jsx(ee,{className:"h-4 w-4"}),t("common.delete")]})]})]})})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[s.jsx(Q,{variant:"outline",className:"text-[11px] font-normal",children:e.type==="local"?t("device.typeLocal"):t("device.typeSSHBadge")}),e.session&&s.jsx(Q,{variant:"outline",className:"text-[11px] font-normal",children:e.session}),s.jsx(Ce,{deviceId:e.id})]})]}),s.jsxs(P,{className:"pt-0",children:[s.jsx(be,{className:"mb-2"}),s.jsx("div",{className:"flex items-center justify-end",children:s.jsx(Se,{to:`/devices/${e.id}`,"data-testid":`device-card-connect-${e.id}`,className:ke({variant:"outline",size:"sm"}),children:t("device.connect")})})]})]})}function Z({mode:e,device:o,onClose:m}){const{t}=b(),y=_(),[r,d]=v.useState(qe(o)),[l,h]=v.useState(!1),[c,K]=v.useState(!1),N=e==="edit",S=r.type==="ssh",k=I({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"]}),f.success(t("common.success")),m()},onError:a=>{f.error(a instanceof Error?a.message:t("common.error"))}}),E=I({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"]}),f.success(t("common.success")),m()},onError:a=>{f.error(a instanceof Error?a.message:t("common.error"))}}),n=async a=>{a.preventDefault(),K(!0);const i=Oe(r);if(i){f.error(t(i));return}h(!0);try{e==="create"?await k.mutateAsync(Le(r)):await E.mutateAsync(He(r))}catch{}finally{h(!1)}},p=`${e}-device-name`,D=`${e}-device-type`,A=`${e}-device-host`,T=`${e}-device-port`,F=`${e}-device-username`,W=`${e}-device-session`,q=`${e}-device-default-working-dir`,L=`${e}-device-auth-mode`,H=`${e}-device-password`,O=`${e}-device-private-key`,B=`${e}-device-private-key-passphrase`,te={local:t("device.typeLocal"),ssh:t("device.typeSSH")},ae={password:t("device.authPassword"),key:t("device.authKey"),agent:t("device.authAgent"),configRef:t("device.authConfigRef")},R=a=>s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:a}),u=(a,i,j)=>s.jsxs("label",{className:"block text-xs font-medium text-foreground",htmlFor:a,children:[i,j&&s.jsx("span",{className:"ml-0.5 text-destructive",children:"*"})]});return s.jsx(Ee,{open:!0,onOpenChange:a=>!a&&m(),children:s.jsxs(Me,{"data-testid":"device-dialog",className:"w-full max-w-2xl",children:[s.jsxs(Pe,{children:[s.jsx(Ie,{children:t(N?"device.editDevice":"device.addDevice")}),s.jsx(Ke,{children:t(N?"device.editDeviceDescription":"device.addDeviceDescription")})]}),s.jsxs("form",{onSubmit:n,className:"space-y-4",children:[s.jsxs("div",{className:"-mr-2 max-h-[min(70dvh,720px)] space-y-5 overflow-y-auto pr-2",children:[s.jsxs("section",{className:"space-y-2.5",children:[R(t("device.sectionBasic")),s.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[u(p,t("device.name"),!0),s.jsx(x,{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})]}),s.jsxs("div",{className:"space-y-1.5",children:[u(D,t("device.type")),s.jsxs(z,{value:r.type,onValueChange:a=>{if(!a)return;const i=a;d(j=>({...j,type:i,authMode:i==="local"?"auto":j.authMode==="auto"?"agent":j.authMode}))},disabled:N,children:[s.jsx(V,{id:D,"data-testid":"device-type-select",className:"w-full",children:s.jsx(U,{placeholder:t("device.type"),children:a=>te[a]??""})}),s.jsxs(J,{children:[s.jsx(w,{value:"local",children:t("device.typeLocal")}),s.jsx(w,{value:"ssh",children:t("device.typeSSH")})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[u(W,t("device.session")),s.jsx(x,{id:W,"data-testid":"device-session-input",type:"text",value:r.session,onChange:a=>d(i=>({...i,session:a.target.value})),placeholder:t("device.sessionPlaceholder")})]}),s.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[u(q,t("device.defaultWorkingDir")),s.jsx(x,{id:q,"data-testid":"device-default-working-dir-input",type:"text",value:r.defaultWorkingDir,onChange:a=>d(i=>({...i,defaultWorkingDir:a.target.value})),placeholder:t("device.defaultWorkingDirPlaceholder")})]})]})]}),S&&s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"space-y-2.5",children:[R(t("device.sectionConnection")),s.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[s.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[u(A,t("device.host"),!0),s.jsx(x,{id:A,type:"text",value:r.host,onChange:a=>d(i=>({...i,host:a.target.value})),placeholder:t("device.hostPlaceholder"),"aria-invalid":c&&!r.host.trim()})]}),s.jsxs("div",{className:"space-y-1.5",children:[u(T,t("device.port"),!0),s.jsx(x,{id:T,type:"number",value:Number.isNaN(r.port)?"":r.port,onChange:a=>{const i=a.target.value;d(j=>({...j,port:i===""?Number.NaN:Number.parseInt(i,10)}))},min:1,max:65535,"aria-invalid":c&&!se(r.port)})]}),s.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[u(F,t("device.username"),!0),s.jsx(x,{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()})]})]})]}),s.jsxs("section",{className:"space-y-2.5",children:[R(t("device.sectionAuth")),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[u(L,t("device.authMode")),s.jsxs(z,{value:r.authMode,onValueChange:a=>{a&&d(i=>({...i,authMode:a}))},children:[s.jsx(V,{id:L,"data-testid":"device-auth-mode-select",className:"w-full",children:s.jsx(U,{placeholder:t("device.authMode"),children:a=>ae[a]??""})}),s.jsxs(J,{children:[s.jsx(w,{value:"password",children:t("device.authPassword")}),s.jsx(w,{value:"key",children:t("device.authKey")}),s.jsx(w,{value:"agent",children:t("device.authAgent")}),s.jsx(w,{value:"configRef",children:t("device.authConfigRef")})]})]})]}),r.authMode==="password"&&s.jsxs("div",{className:"space-y-1.5",children:[u(H,t("device.password")),s.jsx(x,{id:H,type:"password",value:r.password,onChange:a=>d(i=>({...i,password:a.target.value}))})]}),r.authMode==="key"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-1.5",children:[u(O,t("device.privateKey")),s.jsx(Re,{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")})]}),s.jsxs("div",{className:"space-y-1.5",children:[u(B,t("device.passphrase")),s.jsx(x,{id:B,type:"password",value:r.privateKeyPassphrase,onChange:a=>d(i=>({...i,privateKeyPassphrase:a.target.value}))})]})]}),r.authMode==="configRef"&&s.jsxs("div",{className:"space-y-1.5",children:[u(`${e}-device-ssh-config-ref`,t("device.authConfigRef"),!0),s.jsx(x,{id:`${e}-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()}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:t("device.sshConfigRefHint")})]})]})]})]})]}),s.jsxs($e,{children:[s.jsx(C,{type:"button",variant:"outline",onClick:m,children:t("common.cancel")}),s.jsx(C,{type:"submit",variant:"default","data-testid":"device-dialog-save",disabled:l,children:t(l?"common.saving":"common.save")})]})]})]})})}function Je(){const{t:e}=b();return s.jsx(s.Fragment,{children:e("sidebar.manageDevices")})}function Ge(){const{t:e}=b(),o=()=>{window.dispatchEvent(new CustomEvent("tmex:open-add-device"))};return s.jsx(C,{variant:"ghost",size:"icon-sm","data-testid":"devices-add",onClick:o,"aria-label":e("sidebar.addDevice"),title:e("sidebar.addDevice"),children:s.jsx(Y,{className:"h-4 w-4"})})}export{Ge as PageActions,Je as PageTitle,Ue as default};
@@ -1,4 +1,4 @@
1
- import{Y as zn,_ as ut,r as oe,j as h,X as gt,ad as bt,u as ae,c as $n,al as qn,a as mt,B as se,Z as nn}from"./index-DOaZjm8K.js";import{r as pt,M as _t}from"./markdown-preview-rqUSs5w8.js";import{k as ft,d as Ve,l as te,D as Kn,m as Et,f as ht,c as Nt}from"./api-CrHrQflz.js";import{R as yt,s as vt}from"./transfer-toast-mQs0hgyg.js";import"./index-BQbq6q_-.js";/**
1
+ import{Y as zn,_ as ut,r as oe,j as h,X as gt,ad as bt,u as ae,c as $n,al as qn,a as mt,B as se,Z as nn}from"./index-CEPc0i5O.js";import{r as pt,M as _t}from"./markdown-preview-BE4zuZfN.js";import{k as ft,d as Ve,l as te,D as Kn,m as Et,f as ht,c as Nt}from"./api-B_pG5Lrn.js";import{R as yt,s as vt}from"./transfer-toast-CHZr1a7O.js";import"./index-CxrkvaQh.js";/**
2
2
  * @license lucide-react v0.564.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{Y as ce,u as F,j as e,L as It,M as Ze,z as Lt,r as w,c as Q,B as k,P as ge,a as O,e as M,o as b,am as D,v as De,T as te,A as xe,f as fe,g as pe,h as $t,i as we,k as ye,l as je,m as ve,n as be,C as ae,F as ne,H as ie,I as re,J as Ne,N as Ce,O as Ee,Q as ke,R as Se,U as le,K as B,W as de,al as U,G as Bt,x as xt,a4 as Dt,b as Oe,t as et,bo as $,X as ft,a5 as nt,bp as Ot,bq as _t,aS as zt,br as qt,bs as Kt,bt as Qt,bu as Ut,bv as it,Z as Ht}from"./index-DOaZjm8K.js";import{C as H,b as G,c as J,d as pt,a as V}from"./card-CXa-2u8i.js";import{e as Vt,h as wt,F as We,i as Wt,j as Gt,D as Jt}from"./api-CrHrQflz.js";import{R as tt,T as Yt,b as Xt,d as Zt}from"./terminal-settings-panel-CNwWqOMV.js";import{S as yt}from"./send-CcFyyX2G.js";import{M as es}from"./markdown-preview-rqUSs5w8.js";import{T as jt}from"./triangle-alert-DMp7kMmJ.js";import"./selection-clipboard-Dq6Zemfd.js";import"./index-BQbq6q_-.js";/**
1
+ import{Y as ce,u as F,j as e,L as It,M as Ze,z as Lt,r as w,c as Q,B as k,P as ge,a as O,e as M,o as b,am as D,v as De,T as te,A as xe,f as fe,g as pe,h as $t,i as we,k as ye,l as je,m as ve,n as be,C as ae,F as ne,H as ie,I as re,J as Ne,N as Ce,O as Ee,Q as ke,R as Se,U as le,K as B,W as de,al as U,G as Bt,x as xt,a4 as Dt,b as Oe,t as et,bp as $,X as ft,a5 as nt,bq as Ot,br as _t,aS as zt,bs as qt,bt as Kt,bu as Qt,bv as Ut,bw as it,Z as Ht}from"./index-CEPc0i5O.js";import{C as H,b as G,c as J,d as pt,a as V}from"./card-DAJtOO99.js";import{e as Vt,h as wt,F as We,i as Wt,j as Gt,D as Jt}from"./api-B_pG5Lrn.js";import{R as tt,T as Yt,b as Xt,d as Zt}from"./terminal-settings-panel-DAWL48fe.js";import{S as yt}from"./send-CKtMOmLP.js";import{M as es}from"./markdown-preview-BE4zuZfN.js";import{T as jt}from"./triangle-alert-03d4TB5d.js";import"./selection-clipboard-Dq6Zemfd.js";import"./index-CxrkvaQh.js";/**
2
2
  * @license lucide-react v0.564.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{Y as _,r as N,j as e,X as C,u as k,aI as Y,aJ as ee,aK as te,al as se,aL as ne,aH as F,aM as B,a4 as H,B as y,G as be,M as ve,x as Ne,c as K,N as ye,O as ke,R as Ie,U as X,aN as Ce,aO as Se,V as re,v as Me,ae as _e,a5 as ze,aP as Te,ak as g,d as Ee,aQ as Be,aR as qe,P as $e,aS as Pe,am as Re,ah as Ae}from"./index-DOaZjm8K.js";import{M as Fe,r as He}from"./index-BQbq6q_-.js";import{K as Ke,S as Z}from"./send-CcFyyX2G.js";import{Z as ae}from"./zap-DPwn8lbv.js";/**
1
+ import{Y as _,r as N,j as e,X as C,u as k,aI as Y,aJ as ee,aK as te,al as se,aL as ne,aH as F,aM as B,a4 as H,B as y,G as be,M as ve,x as Ne,c as K,N as ye,O as ke,R as Ie,U as X,aN as Ce,aO as Se,V as re,v as Me,ae as _e,a5 as ze,aP as Te,ak as g,d as Ee,aQ as Be,aR as qe,P as $e,aS as Pe,am as Re,ah as Ae}from"./index-CEPc0i5O.js";import{M as Fe,r as He}from"./index-CxrkvaQh.js";import{K as Ke,S as Z}from"./send-CKtMOmLP.js";import{Z as ae}from"./zap-CBeeCQFr.js";/**
2
2
  * @license lucide-react v0.564.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- var N=Object.defineProperty;var P=(t,e,o)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var O=(t,e,o)=>P(t,typeof e!="symbol"?e+"":e,o);import{Y as x}from"./index-DOaZjm8K.js";/**
1
+ var N=Object.defineProperty;var P=(t,e,o)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var O=(t,e,o)=>P(t,typeof e!="symbol"?e+"":e,o);import{Y as x}from"./index-CEPc0i5O.js";/**
2
2
  * @license lucide-react v0.564.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{a0 as ln,a1 as an,a2 as H,a3 as q,a4 as B,a5 as un,a6 as y,a7 as tn,a8 as L,a9 as _,aa as rn,ab as o,ac as on,ad as sn,ae as fn}from"./mermaid.core-QvhJBi8f.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,C,a){var O=I-l,i=D-h,n=C-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function W(l,h,I,D,v,A,C){var a=l-I,O=h-D,i=(C?A:-A)/L(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,F=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*L(on(0,T*T*R-P*P)),j=(P*g-m*S)/R,z=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=j-F,e=z-t,r=w-F,G=p-t;return x*x+e*e>r*r+G*G&&(j=w,z=p),{cx:j,cy:z,x01:-n,y01:-d,x11:j*(v/T-1),y11:z*(v/T-1)}}function hn(){var l=cn,h=yn,I=B(0),D=null,v=gn,A=dn,C=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,F=rn(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(F>tn-y)a.moveTo(s*H(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*H(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=F,S=F,j=C.apply(this,arguments)/2,z=j>y&&(D?+D.apply(this,arguments):L(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(z>y){var G=sn(z/u*q(j)),M=sn(z/s*q(j));(P-=G*2)>y?(G*=t?1:-1,R+=G,T-=G):(P=0,R=T=(f+c)/2),(S-=M*2)>y?(M*=t?1:-1,m+=M,g-=M):(S=0,m=g=(f+c)/2)}var J=s*H(m),K=s*q(m),N=u*H(T),Q=u*q(T);if(w>y){var U=s*H(g),V=s*q(g),X=u*H(R),Y=u*q(R),E;if(F<an)if(E=pn(J,K,X,Y,U,V,N,Q)){var Z=J-E[0],$=K-E[1],b=U-E[0],k=V-E[1],nn=1/q(fn((Z*b+$*k)/(L(Z*Z+$*$)*L(b*b+k*k)))/2),en=L(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=W(X,Y,J,K,s,x,t),r=W(U,V,N,Q,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(J,K),a.arc(0,0,s,m,g,!t)):a.moveTo(J,K),!(u>y)||!(P>y)?a.lineTo(N,Q):p>y?(e=W(N,Q,U,V,u,-p,t),r=W(J,K,X,Y,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[H(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:B(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:B(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:B(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:B(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:B(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:B(+n),i):A},i.padAngle=function(n){return arguments.length?(C=typeof n=="function"?n:B(+n),i):C},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
1
+ import{a0 as ln,a1 as an,a2 as H,a3 as q,a4 as B,a5 as un,a6 as y,a7 as tn,a8 as L,a9 as _,aa as rn,ab as o,ac as on,ad as sn,ae as fn}from"./mermaid.core-DE3GlZm2.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,C,a){var O=I-l,i=D-h,n=C-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function W(l,h,I,D,v,A,C){var a=l-I,O=h-D,i=(C?A:-A)/L(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,F=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*L(on(0,T*T*R-P*P)),j=(P*g-m*S)/R,z=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=j-F,e=z-t,r=w-F,G=p-t;return x*x+e*e>r*r+G*G&&(j=w,z=p),{cx:j,cy:z,x01:-n,y01:-d,x11:j*(v/T-1),y11:z*(v/T-1)}}function hn(){var l=cn,h=yn,I=B(0),D=null,v=gn,A=dn,C=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,F=rn(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(F>tn-y)a.moveTo(s*H(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*H(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=F,S=F,j=C.apply(this,arguments)/2,z=j>y&&(D?+D.apply(this,arguments):L(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(z>y){var G=sn(z/u*q(j)),M=sn(z/s*q(j));(P-=G*2)>y?(G*=t?1:-1,R+=G,T-=G):(P=0,R=T=(f+c)/2),(S-=M*2)>y?(M*=t?1:-1,m+=M,g-=M):(S=0,m=g=(f+c)/2)}var J=s*H(m),K=s*q(m),N=u*H(T),Q=u*q(T);if(w>y){var U=s*H(g),V=s*q(g),X=u*H(R),Y=u*q(R),E;if(F<an)if(E=pn(J,K,X,Y,U,V,N,Q)){var Z=J-E[0],$=K-E[1],b=U-E[0],k=V-E[1],nn=1/q(fn((Z*b+$*k)/(L(Z*Z+$*$)*L(b*b+k*k)))/2),en=L(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=W(X,Y,J,K,s,x,t),r=W(U,V,N,Q,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(J,K),a.arc(0,0,s,m,g,!t)):a.moveTo(J,K),!(u>y)||!(P>y)?a.lineTo(N,Q):p>y?(e=W(N,Q,U,V,u,-p,t),r=W(J,K,X,Y,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[H(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:B(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:B(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:B(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:B(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:B(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:B(+n),i):A},i.padAngle=function(n){return arguments.length?(C=typeof n=="function"?n:B(+n),i):C},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};