dsh-dock 0.25.1 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js CHANGED
@@ -40,18 +40,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
40
40
  ));
41
41
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
42
42
 
43
- // .devdeps/node_modules/qrcode/lib/can-promise.js
43
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/can-promise.js
44
44
  var require_can_promise = __commonJS({
45
- ".devdeps/node_modules/qrcode/lib/can-promise.js"(exports, module2) {
45
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/can-promise.js"(exports, module2) {
46
46
  module2.exports = function() {
47
47
  return typeof Promise === "function" && Promise.prototype && Promise.prototype.then;
48
48
  };
49
49
  }
50
50
  });
51
51
 
52
- // .devdeps/node_modules/qrcode/lib/core/utils.js
52
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js
53
53
  var require_utils = __commonJS({
54
- ".devdeps/node_modules/qrcode/lib/core/utils.js"(exports) {
54
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js"(exports) {
55
55
  var toSJISFunction;
56
56
  var CODEWORDS_COUNT = [
57
57
  0,
@@ -128,9 +128,9 @@ var require_utils = __commonJS({
128
128
  }
129
129
  });
130
130
 
131
- // .devdeps/node_modules/qrcode/lib/core/error-correction-level.js
131
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-level.js
132
132
  var require_error_correction_level = __commonJS({
133
- ".devdeps/node_modules/qrcode/lib/core/error-correction-level.js"(exports) {
133
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-level.js"(exports) {
134
134
  exports.L = { bit: 1 };
135
135
  exports.M = { bit: 0 };
136
136
  exports.Q = { bit: 3 };
@@ -173,9 +173,9 @@ var require_error_correction_level = __commonJS({
173
173
  }
174
174
  });
175
175
 
176
- // .devdeps/node_modules/qrcode/lib/core/bit-buffer.js
176
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-buffer.js
177
177
  var require_bit_buffer = __commonJS({
178
- ".devdeps/node_modules/qrcode/lib/core/bit-buffer.js"(exports, module2) {
178
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-buffer.js"(exports, module2) {
179
179
  function BitBuffer() {
180
180
  this.buffer = [];
181
181
  this.length = 0;
@@ -208,9 +208,9 @@ var require_bit_buffer = __commonJS({
208
208
  }
209
209
  });
210
210
 
211
- // .devdeps/node_modules/qrcode/lib/core/bit-matrix.js
211
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-matrix.js
212
212
  var require_bit_matrix = __commonJS({
213
- ".devdeps/node_modules/qrcode/lib/core/bit-matrix.js"(exports, module2) {
213
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-matrix.js"(exports, module2) {
214
214
  function BitMatrix(size) {
215
215
  if (!size || size < 1) {
216
216
  throw new Error("BitMatrix size must be defined and greater than 0");
@@ -237,9 +237,9 @@ var require_bit_matrix = __commonJS({
237
237
  }
238
238
  });
239
239
 
240
- // .devdeps/node_modules/qrcode/lib/core/alignment-pattern.js
240
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alignment-pattern.js
241
241
  var require_alignment_pattern = __commonJS({
242
- ".devdeps/node_modules/qrcode/lib/core/alignment-pattern.js"(exports) {
242
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alignment-pattern.js"(exports) {
243
243
  var getSymbolSize = require_utils().getSymbolSize;
244
244
  exports.getRowColCoords = function getRowColCoords(version) {
245
245
  if (version === 1) return [];
@@ -272,9 +272,9 @@ var require_alignment_pattern = __commonJS({
272
272
  }
273
273
  });
274
274
 
275
- // .devdeps/node_modules/qrcode/lib/core/finder-pattern.js
275
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/finder-pattern.js
276
276
  var require_finder_pattern = __commonJS({
277
- ".devdeps/node_modules/qrcode/lib/core/finder-pattern.js"(exports) {
277
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/finder-pattern.js"(exports) {
278
278
  var getSymbolSize = require_utils().getSymbolSize;
279
279
  var FINDER_PATTERN_SIZE = 7;
280
280
  exports.getPositions = function getPositions(version) {
@@ -291,9 +291,9 @@ var require_finder_pattern = __commonJS({
291
291
  }
292
292
  });
293
293
 
294
- // .devdeps/node_modules/qrcode/lib/core/mask-pattern.js
294
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mask-pattern.js
295
295
  var require_mask_pattern = __commonJS({
296
- ".devdeps/node_modules/qrcode/lib/core/mask-pattern.js"(exports) {
296
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mask-pattern.js"(exports) {
297
297
  exports.Patterns = {
298
298
  PATTERN000: 0,
299
299
  PATTERN001: 1,
@@ -433,9 +433,9 @@ var require_mask_pattern = __commonJS({
433
433
  }
434
434
  });
435
435
 
436
- // .devdeps/node_modules/qrcode/lib/core/error-correction-code.js
436
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-code.js
437
437
  var require_error_correction_code = __commonJS({
438
- ".devdeps/node_modules/qrcode/lib/core/error-correction-code.js"(exports) {
438
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-code.js"(exports) {
439
439
  var ECLevel = require_error_correction_level();
440
440
  var EC_BLOCKS_TABLE = [
441
441
  // L M Q H
@@ -794,9 +794,9 @@ var require_error_correction_code = __commonJS({
794
794
  }
795
795
  });
796
796
 
797
- // .devdeps/node_modules/qrcode/lib/core/galois-field.js
797
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/galois-field.js
798
798
  var require_galois_field = __commonJS({
799
- ".devdeps/node_modules/qrcode/lib/core/galois-field.js"(exports) {
799
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/galois-field.js"(exports) {
800
800
  var EXP_TABLE = new Uint8Array(512);
801
801
  var LOG_TABLE = new Uint8Array(256);
802
802
  (function initTables() {
@@ -827,9 +827,9 @@ var require_galois_field = __commonJS({
827
827
  }
828
828
  });
829
829
 
830
- // .devdeps/node_modules/qrcode/lib/core/polynomial.js
830
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/polynomial.js
831
831
  var require_polynomial = __commonJS({
832
- ".devdeps/node_modules/qrcode/lib/core/polynomial.js"(exports) {
832
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/polynomial.js"(exports) {
833
833
  var GF = require_galois_field();
834
834
  exports.mul = function mul(p1, p2) {
835
835
  const coeff = new Uint8Array(p1.length + p2.length - 1);
@@ -863,9 +863,9 @@ var require_polynomial = __commonJS({
863
863
  }
864
864
  });
865
865
 
866
- // .devdeps/node_modules/qrcode/lib/core/reed-solomon-encoder.js
866
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/reed-solomon-encoder.js
867
867
  var require_reed_solomon_encoder = __commonJS({
868
- ".devdeps/node_modules/qrcode/lib/core/reed-solomon-encoder.js"(exports, module2) {
868
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/reed-solomon-encoder.js"(exports, module2) {
869
869
  var Polynomial = require_polynomial();
870
870
  function ReedSolomonEncoder(degree) {
871
871
  this.genPoly = void 0;
@@ -895,18 +895,18 @@ var require_reed_solomon_encoder = __commonJS({
895
895
  }
896
896
  });
897
897
 
898
- // .devdeps/node_modules/qrcode/lib/core/version-check.js
898
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version-check.js
899
899
  var require_version_check = __commonJS({
900
- ".devdeps/node_modules/qrcode/lib/core/version-check.js"(exports) {
900
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version-check.js"(exports) {
901
901
  exports.isValid = function isValid(version) {
902
902
  return !isNaN(version) && version >= 1 && version <= 40;
903
903
  };
904
904
  }
905
905
  });
906
906
 
907
- // .devdeps/node_modules/qrcode/lib/core/regex.js
907
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/regex.js
908
908
  var require_regex = __commonJS({
909
- ".devdeps/node_modules/qrcode/lib/core/regex.js"(exports) {
909
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/regex.js"(exports) {
910
910
  var numeric = "[0-9]+";
911
911
  var alphanumeric = "[A-Z $%*+\\-./:]+";
912
912
  var kanji = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
@@ -932,9 +932,9 @@ var require_regex = __commonJS({
932
932
  }
933
933
  });
934
934
 
935
- // .devdeps/node_modules/qrcode/lib/core/mode.js
935
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js
936
936
  var require_mode = __commonJS({
937
- ".devdeps/node_modules/qrcode/lib/core/mode.js"(exports) {
937
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js"(exports) {
938
938
  var VersionCheck = require_version_check();
939
939
  var Regex = require_regex();
940
940
  exports.NUMERIC = {
@@ -1013,9 +1013,9 @@ var require_mode = __commonJS({
1013
1013
  }
1014
1014
  });
1015
1015
 
1016
- // .devdeps/node_modules/qrcode/lib/core/version.js
1016
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version.js
1017
1017
  var require_version = __commonJS({
1018
- ".devdeps/node_modules/qrcode/lib/core/version.js"(exports) {
1018
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version.js"(exports) {
1019
1019
  var Utils = require_utils();
1020
1020
  var ECCode = require_error_correction_code();
1021
1021
  var ECLevel = require_error_correction_level();
@@ -1108,9 +1108,9 @@ var require_version = __commonJS({
1108
1108
  }
1109
1109
  });
1110
1110
 
1111
- // .devdeps/node_modules/qrcode/lib/core/format-info.js
1111
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/format-info.js
1112
1112
  var require_format_info = __commonJS({
1113
- ".devdeps/node_modules/qrcode/lib/core/format-info.js"(exports) {
1113
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/format-info.js"(exports) {
1114
1114
  var Utils = require_utils();
1115
1115
  var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
1116
1116
  var G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
@@ -1126,9 +1126,9 @@ var require_format_info = __commonJS({
1126
1126
  }
1127
1127
  });
1128
1128
 
1129
- // .devdeps/node_modules/qrcode/lib/core/numeric-data.js
1129
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/numeric-data.js
1130
1130
  var require_numeric_data = __commonJS({
1131
- ".devdeps/node_modules/qrcode/lib/core/numeric-data.js"(exports, module2) {
1131
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/numeric-data.js"(exports, module2) {
1132
1132
  var Mode = require_mode();
1133
1133
  function NumericData(data) {
1134
1134
  this.mode = Mode.NUMERIC;
@@ -1161,9 +1161,9 @@ var require_numeric_data = __commonJS({
1161
1161
  }
1162
1162
  });
1163
1163
 
1164
- // .devdeps/node_modules/qrcode/lib/core/alphanumeric-data.js
1164
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alphanumeric-data.js
1165
1165
  var require_alphanumeric_data = __commonJS({
1166
- ".devdeps/node_modules/qrcode/lib/core/alphanumeric-data.js"(exports, module2) {
1166
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alphanumeric-data.js"(exports, module2) {
1167
1167
  var Mode = require_mode();
1168
1168
  var ALPHA_NUM_CHARS = [
1169
1169
  "0",
@@ -1240,9 +1240,9 @@ var require_alphanumeric_data = __commonJS({
1240
1240
  }
1241
1241
  });
1242
1242
 
1243
- // .devdeps/node_modules/qrcode/lib/core/byte-data.js
1243
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/byte-data.js
1244
1244
  var require_byte_data = __commonJS({
1245
- ".devdeps/node_modules/qrcode/lib/core/byte-data.js"(exports, module2) {
1245
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/byte-data.js"(exports, module2) {
1246
1246
  var Mode = require_mode();
1247
1247
  function ByteData(data) {
1248
1248
  this.mode = Mode.BYTE;
@@ -1270,9 +1270,9 @@ var require_byte_data = __commonJS({
1270
1270
  }
1271
1271
  });
1272
1272
 
1273
- // .devdeps/node_modules/qrcode/lib/core/kanji-data.js
1273
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/kanji-data.js
1274
1274
  var require_kanji_data = __commonJS({
1275
- ".devdeps/node_modules/qrcode/lib/core/kanji-data.js"(exports, module2) {
1275
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/kanji-data.js"(exports, module2) {
1276
1276
  var Mode = require_mode();
1277
1277
  var Utils = require_utils();
1278
1278
  function KanjiData(data) {
@@ -1309,9 +1309,9 @@ var require_kanji_data = __commonJS({
1309
1309
  }
1310
1310
  });
1311
1311
 
1312
- // .devdeps/node_modules/dijkstrajs/dijkstra.js
1312
+ // node_modules/.pnpm/dijkstrajs@1.0.3/node_modules/dijkstrajs/dijkstra.js
1313
1313
  var require_dijkstra = __commonJS({
1314
- ".devdeps/node_modules/dijkstrajs/dijkstra.js"(exports, module2) {
1314
+ "node_modules/.pnpm/dijkstrajs@1.0.3/node_modules/dijkstrajs/dijkstra.js"(exports, module2) {
1315
1315
  "use strict";
1316
1316
  var dijkstra = {
1317
1317
  single_source_shortest_paths: function(graph, s, d) {
@@ -1410,9 +1410,9 @@ var require_dijkstra = __commonJS({
1410
1410
  }
1411
1411
  });
1412
1412
 
1413
- // .devdeps/node_modules/qrcode/lib/core/segments.js
1413
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/segments.js
1414
1414
  var require_segments = __commonJS({
1415
- ".devdeps/node_modules/qrcode/lib/core/segments.js"(exports) {
1415
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/segments.js"(exports) {
1416
1416
  var Mode = require_mode();
1417
1417
  var NumericData = require_numeric_data();
1418
1418
  var AlphanumericData = require_alphanumeric_data();
@@ -1596,9 +1596,9 @@ var require_segments = __commonJS({
1596
1596
  }
1597
1597
  });
1598
1598
 
1599
- // .devdeps/node_modules/qrcode/lib/core/qrcode.js
1599
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/qrcode.js
1600
1600
  var require_qrcode = __commonJS({
1601
- ".devdeps/node_modules/qrcode/lib/core/qrcode.js"(exports) {
1601
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/qrcode.js"(exports) {
1602
1602
  var Utils = require_utils();
1603
1603
  var ECLevel = require_error_correction_level();
1604
1604
  var BitBuffer = require_bit_buffer();
@@ -1857,9 +1857,9 @@ var require_qrcode = __commonJS({
1857
1857
  }
1858
1858
  });
1859
1859
 
1860
- // .devdeps/node_modules/qrcode/lib/renderer/utils.js
1860
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js
1861
1861
  var require_utils2 = __commonJS({
1862
- ".devdeps/node_modules/qrcode/lib/renderer/utils.js"(exports) {
1862
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js"(exports) {
1863
1863
  function hex2rgba(hex) {
1864
1864
  if (typeof hex === "number") {
1865
1865
  hex = hex.toString();
@@ -1937,9 +1937,9 @@ var require_utils2 = __commonJS({
1937
1937
  }
1938
1938
  });
1939
1939
 
1940
- // .devdeps/node_modules/qrcode/lib/renderer/canvas.js
1940
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/canvas.js
1941
1941
  var require_canvas = __commonJS({
1942
- ".devdeps/node_modules/qrcode/lib/renderer/canvas.js"(exports) {
1942
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/canvas.js"(exports) {
1943
1943
  var Utils = require_utils2();
1944
1944
  function clearCanvas(ctx, canvas, size) {
1945
1945
  ctx.clearRect(0, 0, canvas.width, canvas.height);
@@ -1990,9 +1990,9 @@ var require_canvas = __commonJS({
1990
1990
  }
1991
1991
  });
1992
1992
 
1993
- // .devdeps/node_modules/qrcode/lib/renderer/svg-tag.js
1993
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg-tag.js
1994
1994
  var require_svg_tag = __commonJS({
1995
- ".devdeps/node_modules/qrcode/lib/renderer/svg-tag.js"(exports) {
1995
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg-tag.js"(exports) {
1996
1996
  var Utils = require_utils2();
1997
1997
  function getColorAttrib(color, attrib) {
1998
1998
  const alpha = color.a / 255;
@@ -2048,9 +2048,9 @@ var require_svg_tag = __commonJS({
2048
2048
  }
2049
2049
  });
2050
2050
 
2051
- // .devdeps/node_modules/qrcode/lib/browser.js
2051
+ // node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/browser.js
2052
2052
  var require_browser = __commonJS({
2053
- ".devdeps/node_modules/qrcode/lib/browser.js"(exports) {
2053
+ "node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/browser.js"(exports) {
2054
2054
  var canPromise = require_can_promise();
2055
2055
  var QRCode2 = require_qrcode();
2056
2056
  var CanvasRenderer = require_canvas();
@@ -2127,16 +2127,28 @@ __export(client_exports, {
2127
2127
  GitDragSplitter: () => DragSplitter,
2128
2128
  GitView: () => GitView,
2129
2129
  apply: () => apply,
2130
+ changedLinesOf: () => changedLinesOf,
2131
+ clampModalPos: () => clampModalPos,
2132
+ clampModalSize: () => clampModalSize,
2130
2133
  clampPercent: () => clampPercent,
2131
2134
  columnsTemplate: () => columnsTemplate,
2132
2135
  dockBridge: () => dockBridge,
2136
+ dockToPanel: () => dockToPanel,
2133
2137
  dragToPercent: () => dragToPercent,
2134
2138
  fmtDateTime: () => fmtDateTime,
2135
2139
  gitPanelEnabled: () => gitPanelEnabled,
2136
2140
  inject: () => inject,
2141
+ pairHunkLines: () => pairHunkLines,
2142
+ readModalDock: () => readModalDock,
2143
+ readModalPos: () => readModalPos,
2144
+ readModalSize: () => readModalSize,
2137
2145
  readSessionDir: () => currentSessionDir,
2146
+ snapToPanel: () => snapToPanel,
2138
2147
  splitterStep: () => splitterStep,
2139
- toggleRepoSelection: () => toggleRepoSelection
2148
+ toggleRepoSelection: () => toggleRepoSelection,
2149
+ writeModalDock: () => writeModalDock,
2150
+ writeModalPos: () => writeModalPos,
2151
+ writeModalSize: () => writeModalSize
2140
2152
  });
2141
2153
  module.exports = __toCommonJS(client_exports);
2142
2154
  var import_react24 = __toESM(require("react"), 1);
@@ -15782,10 +15794,18 @@ var import_react23 = require("react");
15782
15794
 
15783
15795
  // features/git/rpc.js
15784
15796
  async function rpc2(method, body) {
15797
+ let payload;
15798
+ if (body !== void 0) {
15799
+ try {
15800
+ payload = JSON.stringify(body);
15801
+ } catch {
15802
+ throw new Error("\u8BF7\u6C42\u4F53\u65E0\u6CD5\u5E8F\u5217\u5316\uFF1A" + method + " \u7684\u53C2\u6570\u91CC\u6DF7\u8FDB\u4E86 DOM \u4E8B\u4EF6\u6216\u5FAA\u73AF\u5F15\u7528\u5BF9\u8C61\uFF08\u68C0\u67E5\u4E8B\u4EF6\u5904\u7406\u51FD\u6570\u662F\u5426\u628A event \u76F4\u63A5\u4F20\u4E86\u8FDB\u6765\uFF09");
15803
+ }
15804
+ }
15785
15805
  const res = await fetch("dsh-dock/git/" + method, {
15786
15806
  method: body === void 0 ? "GET" : "POST",
15787
15807
  headers: body === void 0 ? void 0 : { "content-type": "application/json" },
15788
- body: body === void 0 ? void 0 : JSON.stringify(body)
15808
+ body: payload
15789
15809
  });
15790
15810
  const data = await res.json().catch(() => ({}));
15791
15811
  if (res.ok && data && data.ok === true) return data.data;
@@ -15982,16 +16002,28 @@ function FileTree(props) {
15982
16002
  for (const f of node.files) {
15983
16003
  const selected = props.selected === f.path;
15984
16004
  out.push(
15985
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "dkg-tree-row file" + (selected ? " on" : ""), style: { paddingLeft: depth * 12 + 18 + "px" }, onClick: () => props.onSelect(f.path), title: f.path, children: [
15986
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-tree-name", children: f.path.split("/").pop() }),
15987
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-add", children: [
15988
- "+",
15989
- f.additions
15990
- ] }),
15991
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-del", children: [
15992
- "\u2212",
15993
- f.deletions
15994
- ] })
16005
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-tree-row file" + (selected ? " on" : ""), style: { paddingLeft: depth * 12 + 18 + "px" }, title: f.path, children: [
16006
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
16007
+ "button",
16008
+ {
16009
+ type: "button",
16010
+ className: "dkg-tree-open",
16011
+ onClick: () => props.onSelect(f.path),
16012
+ onDoubleClick: () => props.onOpen && props.onOpen(f.path),
16013
+ children: [
16014
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-tree-name", children: f.path.split("/").pop() }),
16015
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-add", children: [
16016
+ "+",
16017
+ f.additions
16018
+ ] }),
16019
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-del", children: [
16020
+ "\u2212",
16021
+ f.deletions
16022
+ ] })
16023
+ ]
16024
+ }
16025
+ ),
16026
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-tree-view", onClick: () => props.onOpen && props.onOpen(f.path), title: "\u67E5\u770B\u53D8\u66F4", children: "\u67E5\u770B" })
15995
16027
  ] }, "f:" + f.path)
15996
16028
  );
15997
16029
  }
@@ -15999,6 +16031,518 @@ function FileTree(props) {
15999
16031
  };
16000
16032
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-tree", children: render(tree, 0) });
16001
16033
  }
16034
+ function pairHunkLines(lines, oldStart, newStart) {
16035
+ const out = [];
16036
+ let oldNo = oldStart;
16037
+ let newNo = newStart;
16038
+ const list = Array.isArray(lines) ? lines : [];
16039
+ let i = 0;
16040
+ while (i < list.length) {
16041
+ const line = list[i];
16042
+ if (line.kind === "-") {
16043
+ const dels = [];
16044
+ while (i < list.length && list[i].kind === "-") {
16045
+ dels.push(list[i]);
16046
+ i += 1;
16047
+ }
16048
+ const adds = [];
16049
+ while (i < list.length && list[i].kind === "+") {
16050
+ adds.push(list[i]);
16051
+ i += 1;
16052
+ }
16053
+ const n = Math.max(dels.length, adds.length);
16054
+ for (let k = 0; k < n; k += 1) {
16055
+ const d = dels[k];
16056
+ const a = adds[k];
16057
+ out.push({
16058
+ kind: d && a ? "change" : d ? "del" : "add",
16059
+ old: d ? { no: oldNo++, text: d.text } : null,
16060
+ new: a ? { no: newNo++, text: a.text } : null
16061
+ });
16062
+ }
16063
+ } else if (line.kind === "+") {
16064
+ out.push({ kind: "add", old: null, new: { no: newNo++, text: line.text } });
16065
+ i += 1;
16066
+ } else {
16067
+ out.push({ kind: "same", old: { no: oldNo++, text: line.text }, new: { no: newNo++, text: line.text } });
16068
+ i += 1;
16069
+ }
16070
+ }
16071
+ return out;
16072
+ }
16073
+ function SideLine(props) {
16074
+ const cell = props.cell;
16075
+ const kind = props.kind;
16076
+ const cls = "dkg-sd-line" + (cell === null ? " blank" : kind === "same" ? "" : kind === "add" ? " add" : kind === "del" ? " del" : " change");
16077
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cls, children: [
16078
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-sd-ln", children: cell === null ? "" : String(cell.no) }),
16079
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-sd-code", children: cell === null ? "" : cell.text || " " })
16080
+ ] });
16081
+ }
16082
+ function SideBySideDiff(props) {
16083
+ const file = props.file;
16084
+ const hunks = file && file.hunks || [];
16085
+ if (file && file.binary) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u4E0D\u663E\u793A\u9010\u884C\u5DEE\u5F02\u3002" });
16086
+ if (hunks.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u6CA1\u6709\u53EF\u663E\u793A\u7684\u5DEE\u5F02\uFF08\u53EF\u80FD\u53EA\u662F\u6587\u4EF6\u6A21\u5F0F\u53D8\u5316\uFF09\u3002" });
16087
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-sd", children: [
16088
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-sd-head", children: [
16089
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: "\u65E7\u7248\u672C" }),
16090
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: "\u65B0\u7248\u672C" })
16091
+ ] }),
16092
+ hunks.map((h, hi) => {
16093
+ const rows = pairHunkLines(h.lines, h.oldStart, h.newStart);
16094
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-sd-hunk", children: [
16095
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-sd-hunk-head", children: h.header }),
16096
+ rows.map((row, ri) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-sd-row", children: [
16097
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SideLine, { cell: row.old, kind: row.kind }),
16098
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SideLine, { cell: row.new, kind: row.kind })
16099
+ ] }, ri))
16100
+ ] }, hi);
16101
+ })
16102
+ ] });
16103
+ }
16104
+ function changedLinesOf(hunks) {
16105
+ const changed = /* @__PURE__ */ new Set();
16106
+ const added = /* @__PURE__ */ new Set();
16107
+ for (const h of hunks || []) {
16108
+ let lineNo = Number(h && h.newStart) || 0;
16109
+ for (const ln of h && h.lines || []) {
16110
+ if (ln.kind === "+") {
16111
+ changed.add(lineNo);
16112
+ added.add(lineNo);
16113
+ lineNo += 1;
16114
+ } else if (ln.kind === " ") {
16115
+ lineNo += 1;
16116
+ }
16117
+ }
16118
+ }
16119
+ return { changed, added };
16120
+ }
16121
+ function FullFileView(props) {
16122
+ const { oldContent, newContent, hunks, truncated } = props;
16123
+ const oldLines = (0, import_react23.useMemo)(() => String(oldContent || "").split("\n"), [oldContent]);
16124
+ const newLines = (0, import_react23.useMemo)(() => String(newContent || "").split("\n"), [newContent]);
16125
+ const marks = (0, import_react23.useMemo)(() => changedLinesOf(hunks), [hunks]);
16126
+ const removedOld = (0, import_react23.useMemo)(() => {
16127
+ const set = /* @__PURE__ */ new Set();
16128
+ for (const h of hunks || []) {
16129
+ let no = Number(h && h.oldStart) || 0;
16130
+ for (const ln of h && h.lines || []) {
16131
+ if (ln.kind === "-") {
16132
+ set.add(no);
16133
+ no += 1;
16134
+ } else if (ln.kind === " ") {
16135
+ no += 1;
16136
+ }
16137
+ }
16138
+ }
16139
+ return set;
16140
+ }, [hunks]);
16141
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-ff", children: [
16142
+ truncated ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u6587\u4EF6\u8F83\u5927\uFF0C\u53EA\u663E\u793A\u524D\u4E00\u90E8\u5206\u3002" }) : null,
16143
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-ff-head", children: [
16144
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { children: [
16145
+ "\u6539\u52A8\u524D\uFF08",
16146
+ oldLines.length,
16147
+ " \u884C\uFF09"
16148
+ ] }),
16149
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { children: [
16150
+ "\u6539\u52A8\u540E\uFF08",
16151
+ newLines.length,
16152
+ " \u884C\uFF09"
16153
+ ] })
16154
+ ] }),
16155
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-ff-cols", children: [
16156
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-ff-col", children: oldLines.map((text, i) => {
16157
+ const no = i + 1;
16158
+ const hit = removedOld.has(no);
16159
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-ff-row" + (hit ? " del" : ""), children: [
16160
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-ff-ln", children: no }),
16161
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-ff-code", children: text || " " })
16162
+ ] }, no);
16163
+ }) }),
16164
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-ff-col", children: newLines.map((text, i) => {
16165
+ const no = i + 1;
16166
+ const hit = marks.changed.has(no);
16167
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-ff-row" + (hit ? " changed" : ""), children: [
16168
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-ff-ln", children: no }),
16169
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-ff-code", children: text || " " })
16170
+ ] }, no);
16171
+ }) })
16172
+ ] })
16173
+ ] });
16174
+ }
16175
+ function DockDialog(props) {
16176
+ const { title, children, confirmText, cancelText, danger, busy, onConfirm, onCancel } = props;
16177
+ (0, import_react23.useEffect)(() => {
16178
+ const onKey = (ev) => {
16179
+ if (ev.key === "Escape") {
16180
+ ev.stopPropagation();
16181
+ if (onCancel) onCancel();
16182
+ } else if (ev.key === "Enter" && !ev.shiftKey) {
16183
+ const tag = ev.target && ev.target.tagName;
16184
+ if (tag === "TEXTAREA") return;
16185
+ if (onConfirm) {
16186
+ ev.preventDefault();
16187
+ onConfirm();
16188
+ }
16189
+ }
16190
+ };
16191
+ document.addEventListener("keydown", onKey);
16192
+ return () => document.removeEventListener("keydown", onKey);
16193
+ }, [onConfirm, onCancel]);
16194
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-dlg-mask", onClick: onCancel, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-dlg", onClick: (ev) => ev.stopPropagation(), children: [
16195
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-dlg-head", children: [
16196
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-dlg-title", children: title }),
16197
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-dlg-x", onClick: onCancel, title: "\u5173\u95ED\uFF08Esc\uFF09", children: "\u2715" })
16198
+ ] }),
16199
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-dlg-body", children }),
16200
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-dlg-foot", children: [
16201
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", onClick: onCancel, disabled: busy, children: cancelText || "\u53D6\u6D88" }),
16202
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
16203
+ "button",
16204
+ {
16205
+ type: "button",
16206
+ className: "dkg-btn" + (danger ? " danger" : " primary"),
16207
+ onClick: onConfirm,
16208
+ disabled: busy,
16209
+ children: busy ? "\u5904\u7406\u4E2D\u2026" : confirmText || "\u786E\u5B9A"
16210
+ }
16211
+ )
16212
+ ] })
16213
+ ] }) });
16214
+ }
16215
+ var MODAL_SIZE_KEY = "dsh-dock.git.modalSize";
16216
+ var MODAL_MIN_W = 420;
16217
+ var MODAL_MIN_H = 260;
16218
+ function readModalSize(storage) {
16219
+ const store2 = storage || (typeof localStorage !== "undefined" ? localStorage : null);
16220
+ if (!store2) return null;
16221
+ try {
16222
+ const raw = store2.getItem(MODAL_SIZE_KEY);
16223
+ if (!raw) return null;
16224
+ const parsed = JSON.parse(raw);
16225
+ const w = Number(parsed && parsed.w);
16226
+ const h = Number(parsed && parsed.h);
16227
+ if (!Number.isFinite(w) || !Number.isFinite(h)) return null;
16228
+ return { w: clampModalSize(w, "w"), h: clampModalSize(h, "h") };
16229
+ } catch {
16230
+ return null;
16231
+ }
16232
+ }
16233
+ function writeModalSize(size, storage) {
16234
+ const store2 = storage || (typeof localStorage !== "undefined" ? localStorage : null);
16235
+ if (!store2) return;
16236
+ try {
16237
+ store2.setItem(MODAL_SIZE_KEY, JSON.stringify(size));
16238
+ } catch {
16239
+ }
16240
+ }
16241
+ function clampModalSize(value, axis, win) {
16242
+ const w = win || (typeof window !== "undefined" ? window : { innerWidth: 1200, innerHeight: 800 });
16243
+ const vw = Number(w.innerWidth) || 1200;
16244
+ const vh = Number(w.innerHeight) || 800;
16245
+ const min = axis === "w" ? MODAL_MIN_W : MODAL_MIN_H;
16246
+ const max = Math.max(min, Math.floor((axis === "w" ? vw : vh) * 0.96));
16247
+ const n = Number(value);
16248
+ if (!Number.isFinite(n)) return min;
16249
+ return Math.min(max, Math.max(min, Math.round(n)));
16250
+ }
16251
+ var MODAL_POS_KEY = "dsh-dock.git.modalPos";
16252
+ function clampModalPos(pos, size, win, keep) {
16253
+ const w = win || (typeof window !== "undefined" ? window : { innerWidth: 1200, innerHeight: 800 });
16254
+ const vw = Number(w.innerWidth) || 1200;
16255
+ const vh = Number(w.innerHeight) || 800;
16256
+ const nw = Math.max(120, Number(size && size.w) || 600);
16257
+ const nh = Math.max(80, Number(size && size.h) || 400);
16258
+ const k = typeof keep === "number" ? keep : 80;
16259
+ const minX = k - nw;
16260
+ const maxX = vw - k;
16261
+ const minY = 0;
16262
+ const maxY = vh - k;
16263
+ const x = Number(pos && pos.x);
16264
+ const y = Number(pos && pos.y);
16265
+ return {
16266
+ x: Math.min(maxX, Math.max(minX, Math.round(Number.isFinite(x) ? x : 0))),
16267
+ y: Math.min(maxY, Math.max(minY, Math.round(Number.isFinite(y) ? y : 0)))
16268
+ };
16269
+ }
16270
+ function readModalPos(storage, size) {
16271
+ const store2 = storage || (typeof localStorage !== "undefined" ? localStorage : null);
16272
+ if (!store2) return null;
16273
+ try {
16274
+ const raw = store2.getItem(MODAL_POS_KEY);
16275
+ if (!raw) return null;
16276
+ const parsed = JSON.parse(raw);
16277
+ const x = Number(parsed && parsed.x);
16278
+ const y = Number(parsed && parsed.y);
16279
+ if (!Number.isFinite(x) || !Number.isFinite(y)) return null;
16280
+ return clampModalPos({ x, y }, size || { w: 900, h: 600 });
16281
+ } catch {
16282
+ return null;
16283
+ }
16284
+ }
16285
+ function writeModalPos(pos, storage) {
16286
+ const store2 = storage || (typeof localStorage !== "undefined" ? localStorage : null);
16287
+ if (!store2) return;
16288
+ try {
16289
+ store2.setItem(MODAL_POS_KEY, JSON.stringify(pos));
16290
+ } catch {
16291
+ }
16292
+ }
16293
+ function snapToPanel(panel, size, win, gap) {
16294
+ const w = win || (typeof window !== "undefined" ? window : { innerWidth: 1200, innerHeight: 800 });
16295
+ const vw = Number(w.innerWidth) || 1200;
16296
+ const g = typeof gap === "number" ? gap : 12;
16297
+ const nw = Math.max(200, Number(size && size.w) || 900);
16298
+ const pl = Number(panel && panel.left) || 0;
16299
+ const pt = Number(panel && panel.top) || 0;
16300
+ const pw = Number(panel && panel.width) || 0;
16301
+ let x = pl - nw - g;
16302
+ if (x < 8) {
16303
+ const rightX = pl + pw + g;
16304
+ x = rightX + nw <= vw - 8 ? rightX : 8;
16305
+ }
16306
+ return clampModalPos({ x, y: pt }, size, win);
16307
+ }
16308
+ var MODAL_DOCK_KEY = "dsh-dock.git.modalDock";
16309
+ function readModalDock(storage) {
16310
+ const store2 = storage || (typeof localStorage !== "undefined" ? localStorage : null);
16311
+ if (!store2) return false;
16312
+ try {
16313
+ return store2.getItem(MODAL_DOCK_KEY) === "1";
16314
+ } catch {
16315
+ return false;
16316
+ }
16317
+ }
16318
+ function writeModalDock(on, storage) {
16319
+ const store2 = storage || (typeof localStorage !== "undefined" ? localStorage : null);
16320
+ if (!store2) return;
16321
+ try {
16322
+ store2.setItem(MODAL_DOCK_KEY, on ? "1" : "0");
16323
+ } catch {
16324
+ }
16325
+ }
16326
+ function dockToPanel(panel, win, gap, minW) {
16327
+ const w = win || (typeof window !== "undefined" ? window : { innerWidth: 1200, innerHeight: 800 });
16328
+ const vw = Number(w.innerWidth) || 1200;
16329
+ const vh = Number(w.innerHeight) || 800;
16330
+ const g = typeof gap === "number" ? gap : 6;
16331
+ const lo = typeof minW === "number" ? minW : 240;
16332
+ const pl = Number(panel && panel.left);
16333
+ const left = Number.isFinite(pl) ? Math.max(0, Math.round(pl)) : vw;
16334
+ const width = Math.max(lo, left - g);
16335
+ return { x: 0, y: 0, w: width, h: Math.max(120, vh) };
16336
+ }
16337
+ function DiffModal(props) {
16338
+ const { file, files, onClose, onPick } = props;
16339
+ const [max, setMax] = (0, import_react23.useState)(false);
16340
+ const [size, setSize] = (0, import_react23.useState)(() => readModalSize());
16341
+ const [pos, setPos] = (0, import_react23.useState)(() => readModalPos(null, readModalSize()));
16342
+ const [docked, setDocked] = (0, import_react23.useState)(() => readModalDock());
16343
+ const [mode, setMode] = (0, import_react23.useState)("diff");
16344
+ const [full, setFull] = (0, import_react23.useState)(null);
16345
+ const [both, setBoth] = (0, import_react23.useState)(null);
16346
+ const [fullLoading, setFullLoading] = (0, import_react23.useState)(false);
16347
+ const [fullError, setFullError] = (0, import_react23.useState)("");
16348
+ const freeSizeRef = (0, import_react23.useRef)(null);
16349
+ const boxRef = (0, import_react23.useRef)(null);
16350
+ const dragRef = (0, import_react23.useRef)(null);
16351
+ (0, import_react23.useEffect)(() => {
16352
+ const onKey = (ev) => {
16353
+ if (ev.key === "Escape") {
16354
+ ev.stopPropagation();
16355
+ onClose();
16356
+ } else if (ev.key === "f" || ev.key === "F") setMax((v) => !v);
16357
+ };
16358
+ document.addEventListener("keydown", onKey);
16359
+ return () => document.removeEventListener("keydown", onKey);
16360
+ }, [onClose]);
16361
+ const loadFull = async () => {
16362
+ if (both || fullLoading) return;
16363
+ setFullLoading(true);
16364
+ setFullError("");
16365
+ try {
16366
+ const target = props.sha || "";
16367
+ const before = target ? target + "^" : "";
16368
+ const [newSide, oldSide] = await Promise.all([
16369
+ rpc2("file", { repo: props.repo, path: file.path, sha: target }).catch(() => null),
16370
+ before ? rpc2("file", { repo: props.repo, path: file.path, sha: before }).catch(() => null) : Promise.resolve(null)
16371
+ ]);
16372
+ setBoth({
16373
+ old: oldSide && oldSide.content || "",
16374
+ new: newSide && newSide.content || "",
16375
+ truncated: !!(oldSide && oldSide.truncated || newSide && newSide.truncated)
16376
+ });
16377
+ } catch (e) {
16378
+ setFullError(e && e.message || String(e));
16379
+ } finally {
16380
+ setFullLoading(false);
16381
+ }
16382
+ };
16383
+ const switchMode = (next) => {
16384
+ setMode(next);
16385
+ if (next === "full") loadFull();
16386
+ };
16387
+ const startMove = (ev) => {
16388
+ if (ev.target && ev.target.closest && ev.target.closest("button, select, input")) return;
16389
+ ev.preventDefault();
16390
+ const box = ev.currentTarget && ev.currentTarget.parentElement;
16391
+ if (!box) return;
16392
+ const rect2 = box.getBoundingClientRect();
16393
+ const base = { x: ev.clientX, y: ev.clientY, left: rect2.left, top: rect2.top };
16394
+ const move = (e) => {
16395
+ const next = clampModalPos(
16396
+ { x: base.left + (e.clientX - base.x), y: base.top + (e.clientY - base.y) },
16397
+ { w: rect2.width, h: rect2.height }
16398
+ );
16399
+ setPos(next);
16400
+ };
16401
+ const up = () => {
16402
+ document.removeEventListener("mousemove", move);
16403
+ document.removeEventListener("mouseup", up);
16404
+ setPos((cur) => {
16405
+ if (cur) writeModalPos(cur);
16406
+ return cur;
16407
+ });
16408
+ };
16409
+ document.addEventListener("mousemove", move);
16410
+ document.addEventListener("mouseup", up);
16411
+ };
16412
+ const startResize = (ev, dir) => {
16413
+ ev.preventDefault();
16414
+ ev.stopPropagation();
16415
+ const box = ev.currentTarget && ev.currentTarget.parentElement;
16416
+ const rect2 = box ? box.getBoundingClientRect() : { width: 900, height: 600 };
16417
+ dragRef.current = {
16418
+ x: ev.clientX,
16419
+ y: ev.clientY,
16420
+ w: rect2.width,
16421
+ h: rect2.height,
16422
+ dir: dir || "se"
16423
+ };
16424
+ const onMove = (e) => {
16425
+ const base = dragRef.current;
16426
+ if (!base) return;
16427
+ const dx = e.clientX - base.x;
16428
+ const dy = e.clientY - base.y;
16429
+ const nextW = base.dir.includes("e") || base.dir.includes("w") ? clampModalSize(base.w + (base.dir.includes("w") ? -dx : dx), "w") : base.w;
16430
+ const nextH = base.dir.includes("s") || base.dir.includes("n") ? clampModalSize(base.h + (base.dir.includes("n") ? -dy : dy), "h") : base.h;
16431
+ setSize({ w: nextW, h: nextH });
16432
+ };
16433
+ const onUp = () => {
16434
+ document.removeEventListener("mousemove", onMove);
16435
+ document.removeEventListener("mouseup", onUp);
16436
+ dragRef.current = null;
16437
+ setSize((cur) => {
16438
+ if (cur) writeModalSize(cur);
16439
+ return cur;
16440
+ });
16441
+ };
16442
+ document.addEventListener("mousemove", onMove);
16443
+ document.addEventListener("mouseup", onUp);
16444
+ };
16445
+ if (!file) return null;
16446
+ (0, import_react23.useEffect)(() => {
16447
+ if (!docked) return;
16448
+ if (freeSizeRef.current === null && size) freeSizeRef.current = size;
16449
+ const panel = document.querySelector(".dkg");
16450
+ if (!panel) return;
16451
+ const apply2 = () => {
16452
+ const rect2 = panel.getBoundingClientRect();
16453
+ const box = dockToPanel(rect2);
16454
+ setPos({ x: box.x, y: box.y });
16455
+ setSize({ w: box.w, h: box.h });
16456
+ };
16457
+ apply2();
16458
+ window.addEventListener("resize", apply2);
16459
+ let observer = null;
16460
+ if (typeof ResizeObserver === "function") {
16461
+ observer = new ResizeObserver(apply2);
16462
+ observer.observe(panel);
16463
+ }
16464
+ return () => {
16465
+ window.removeEventListener("resize", apply2);
16466
+ if (observer) observer.disconnect();
16467
+ };
16468
+ }, [docked]);
16469
+ (0, import_react23.useEffect)(() => {
16470
+ if (docked) return;
16471
+ if (freeSizeRef.current) {
16472
+ setSize(freeSizeRef.current);
16473
+ freeSizeRef.current = null;
16474
+ }
16475
+ }, [docked]);
16476
+ const style = {};
16477
+ if (!max) {
16478
+ if (size) {
16479
+ style.width = size.w + "px";
16480
+ style.height = size.h + "px";
16481
+ }
16482
+ if (pos) {
16483
+ style.left = pos.x + "px";
16484
+ style.top = pos.y + "px";
16485
+ }
16486
+ }
16487
+ return (
16488
+ // 不要遮罩:遮罩会拦掉右侧面板的点击,导致必须先关窗口才能选下一个文件。
16489
+ // 关闭走标题栏的「关闭」按钮或 Esc。
16490
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-modal-layer" + (docked ? " docked" : ""), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-modal" + (max ? " max" : ""), style, onClick: (ev) => ev.stopPropagation(), children: [
16491
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-modal-head", onMouseDown: max ? void 0 : startMove, title: max ? void 0 : "\u62D6\u52A8\u6807\u9898\u680F\u53EF\u79FB\u52A8\u7A97\u53E3", children: [
16492
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-modal-title", title: file.path, children: file.path }),
16493
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-add", children: [
16494
+ "+",
16495
+ file.additions
16496
+ ] }),
16497
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-del", children: [
16498
+ "\u2212",
16499
+ file.deletions
16500
+ ] }),
16501
+ Array.isArray(files) && files.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
16502
+ "select",
16503
+ {
16504
+ className: "dkg-modal-pick",
16505
+ value: file.path,
16506
+ onChange: (ev) => onPick(ev.target.value),
16507
+ title: "\u5207\u6362\u5230\u5176\u5B83\u6587\u4EF6",
16508
+ children: files.map((f) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: f.path, children: f.path }, f.path))
16509
+ }
16510
+ ) : null,
16511
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-modal-modes", children: [
16512
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn sm" + (mode === "diff" ? " on" : ""), onClick: () => switchMode("diff"), title: "\u53EA\u770B\u6539\u52A8\u7684\u7247\u6BB5", children: "\u5DEE\u5F02" }),
16513
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn sm" + (mode === "full" ? " on" : ""), onClick: () => switchMode("full"), title: "\u663E\u793A\u6574\u4E2A\u6587\u4EF6\uFF0C\u6539\u52A8\u884C\u9AD8\u4EAE", children: "\u5168\u6587\u4EF6" })
16514
+ ] }),
16515
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
16516
+ "button",
16517
+ {
16518
+ type: "button",
16519
+ className: "dkg-btn" + (docked ? " on" : ""),
16520
+ onClick: () => setDocked((v) => {
16521
+ const next = !v;
16522
+ writeModalDock(next);
16523
+ return next;
16524
+ }),
16525
+ title: "\u8D34\u4F4F\u9762\u677F\u5DE6\u4FA7\uFF08\u4E0D\u6321\u53F3\u4FA7\u6587\u4EF6\u6811\uFF0C\u53EF\u76F4\u63A5\u53CC\u51FB\u4E0B\u4E00\u4E2A\u6587\u4EF6\uFF09",
16526
+ children: docked ? "\u53D6\u6D88\u8D34\u8FB9" : "\u8D34\u8FB9"
16527
+ }
16528
+ ),
16529
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", onClick: () => setMax((v) => !v), title: "\u6700\u5927\u5316 / \u8FD8\u539F\uFF08F\uFF09", children: max ? "\u8FD8\u539F" : "\u6700\u5927\u5316" }),
16530
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", onClick: onClose, title: "\u5173\u95ED\uFF08Esc\uFF09", children: "\u5173\u95ED" })
16531
+ ] }),
16532
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-modal-body", children: mode === "full" ? fullLoading ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u8BFB\u53D6\u6587\u4EF6\u2026" }) : fullError ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-error", children: fullError }) : both ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FullFileView, { oldContent: both.old, newContent: both.new, hunks: file.hunks, truncated: both.truncated }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u6CA1\u6709\u8BFB\u5230\u6587\u4EF6\u5185\u5BB9\u3002" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SideBySideDiff, { file }) }),
16533
+ max || docked ? null : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react23.Fragment, { children: [
16534
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-rz n", onMouseDown: (e) => startResize(e, "n") }),
16535
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-rz s", onMouseDown: (e) => startResize(e, "s") }),
16536
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-rz e", onMouseDown: (e) => startResize(e, "e") }),
16537
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-rz w", onMouseDown: (e) => startResize(e, "w") }),
16538
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-rz ne", onMouseDown: (e) => startResize(e, "ne") }),
16539
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-rz nw", onMouseDown: (e) => startResize(e, "nw") }),
16540
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-rz se", onMouseDown: (e) => startResize(e, "se") }),
16541
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-rz sw", onMouseDown: (e) => startResize(e, "sw") })
16542
+ ] })
16543
+ ] }) })
16544
+ );
16545
+ }
16002
16546
  var COMMIT_COLUMNS = [
16003
16547
  { id: "graph", title: "", width: "12px", fixed: true },
16004
16548
  { id: "subject", title: "\u8BF4\u660E", width: "minmax(0,1fr)", fixed: true },
@@ -16087,10 +16631,12 @@ function HistoryPane(props) {
16087
16631
  const [selected, setSelected] = (0, import_react23.useState)(null);
16088
16632
  const [detail, setDetail] = (0, import_react23.useState)(null);
16089
16633
  const [detailLoading, setDetailLoading] = (0, import_react23.useState)(false);
16634
+ const [treeSel, setTreeSel] = (0, import_react23.useState)("");
16635
+ const [openFile, setOpenFile] = (0, import_react23.useState)(null);
16090
16636
  const [activeFile, setActiveFile] = (0, import_react23.useState)("");
16091
- const load = (0, import_react23.useCallback)(async () => {
16637
+ const load = (0, import_react23.useCallback)(async (silent) => {
16092
16638
  if (!repo) return;
16093
- setLoading(true);
16639
+ if (silent !== true) setLoading(true);
16094
16640
  setError("");
16095
16641
  const repoList = repoKey.split("\0").filter(Boolean);
16096
16642
  if (repoList.length === 0) {
@@ -16135,9 +16681,9 @@ function HistoryPane(props) {
16135
16681
  }
16136
16682
  }, [repo, repoKey, limit, search, author, authorPick, path, branch, since, until]);
16137
16683
  const selectCommit = async (c) => {
16684
+ setMobileDetail(true);
16138
16685
  setSelected(c);
16139
16686
  setDetailLoading(true);
16140
- setActiveFile("");
16141
16687
  try {
16142
16688
  const owner = c.__repo || repo;
16143
16689
  const data = await rpc2("commit", { repo: owner, sha: c.sha });
@@ -16155,6 +16701,22 @@ function HistoryPane(props) {
16155
16701
  }, 200);
16156
16702
  return () => clearTimeout(timer);
16157
16703
  }, [load]);
16704
+ (0, import_react23.useEffect)(() => {
16705
+ if (!repo) return;
16706
+ const tick = () => {
16707
+ if (detailLoading || loading) return;
16708
+ load(true);
16709
+ };
16710
+ const timer = setInterval(tick, 3e4);
16711
+ const onVisible = () => {
16712
+ if (document.visibilityState === "visible") tick();
16713
+ };
16714
+ document.addEventListener("visibilitychange", onVisible);
16715
+ return () => {
16716
+ clearInterval(timer);
16717
+ document.removeEventListener("visibilitychange", onVisible);
16718
+ };
16719
+ }, [repo, load, detailLoading, loading]);
16158
16720
  (0, import_react23.useEffect)(() => {
16159
16721
  if (!repo) return;
16160
16722
  let stopped = false;
@@ -16191,11 +16753,24 @@ function HistoryPane(props) {
16191
16753
  const tags = refs && refs.tags || [];
16192
16754
  const diffFiles = detail && detail.diff && detail.diff.files || [];
16193
16755
  const shownFiles = activeFile ? diffFiles.filter((f) => f.path === activeFile) : diffFiles;
16756
+ const openFileAt = (path2) => {
16757
+ setTreeSel(path2);
16758
+ setActiveFile(path2);
16759
+ const hit = diffFiles.find((f) => f.path === path2);
16760
+ if (hit) setOpenFile(hit);
16761
+ };
16762
+ const openFileList = (0, import_react23.useMemo)(() => {
16763
+ const list = diffFiles.slice();
16764
+ if (openFile && !list.some((f) => f.path === openFile.path)) list.unshift(openFile);
16765
+ return list;
16766
+ }, [diffFiles, openFile]);
16767
+ const [filtersOpen, setFiltersOpen] = (0, import_react23.useState)(false);
16768
+ const [mobileDetail, setMobileDetail] = (0, import_react23.useState)(false);
16194
16769
  const [mainPct, setMainPct] = (0, import_react23.useState)(50);
16195
16770
  const [detailPct, setDetailPct] = (0, import_react23.useState)(50);
16196
16771
  const bodyRef = (0, import_react23.useRef)(null);
16197
16772
  const detailRef = (0, import_react23.useRef)(null);
16198
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-body", ref: bodyRef, style: { "--dkg-main-pct": mainPct + "%", "--dkg-detail-pct": detailPct + "%", "--dkg-cols": columnsTemplate(visibleCols) }, children: [
16773
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-body" + (mobileDetail ? " dkg-mobile-detail" : " dkg-mobile-list"), ref: bodyRef, style: { "--dkg-main-pct": mainPct + "%", "--dkg-detail-pct": detailPct + "%", "--dkg-cols": columnsTemplate(visibleCols) }, children: [
16199
16774
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-side", children: [
16200
16775
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "dkg-side-item" + (branch === "" ? " on" : ""), onClick: () => setBranch(""), children: [
16201
16776
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-side-icon", children: "\u25C8" }),
@@ -16224,8 +16799,8 @@ function HistoryPane(props) {
16224
16799
  ] }) : null
16225
16800
  ] }),
16226
16801
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-mid", children: [
16227
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-toolbar", children: [
16228
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { className: "dkg-input", value: search, placeholder: "\u641C\u7D22\u5173\u952E\u8BCD\uFF08\u8BF4\u660E / \u54C8\u5E0C\uFF09", onChange: (e) => setSearch(e.target.value) }),
16802
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-toolbar-toggle", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", onClick: () => setFiltersOpen(!filtersOpen), children: filtersOpen ? "\u6536\u8D77\u7B5B\u9009" : "\u7B5B\u9009" }) }),
16803
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-toolbar" + (filtersOpen ? " open" : ""), children: [
16229
16804
  authors.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("select", { className: "dkg-select", value: authorPick, onChange: (e) => setAuthorPick(e.target.value), title: "\u6309\u63D0\u4EA4\u4EBA\u7B5B\u9009", children: [
16230
16805
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: "\u5168\u90E8\u63D0\u4EA4\u4EBA" }),
16231
16806
  authors.map((a) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("option", { value: a.name, children: [
@@ -16301,18 +16876,30 @@ function HistoryPane(props) {
16301
16876
  ] }),
16302
16877
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-splitter-slot dkg-splitter-main", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DragSplitter, { value: mainPct, onChange: setMainPct, min: 20, max: 85, containerRef: bodyRef }) }),
16303
16878
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-detail", ref: detailRef, children: [
16879
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-mobile-back", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", onClick: () => setMobileDetail(false), children: "\u2190 \u8FD4\u56DE\u5217\u8868" }) }),
16304
16880
  !selected ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u9009\u62E9\u5DE6\u4FA7\u4E00\u6761\u63D0\u4EA4\u67E5\u770B\u8BE6\u60C5\u3002" }) : null,
16305
16881
  selected && detailLoading ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u8BFB\u53D6\u4E2D\u2026" }) : null,
16306
16882
  detail && detail.error ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-error", children: detail.error }) : null,
16307
16883
  detail && !detail.error && !detailLoading ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
16308
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-detail-diff", children: diffFiles.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-detail-split", children: [
16309
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FileTree, { files: diffFiles, selected: activeFile, onSelect: (p) => setActiveFile(activeFile === p ? "" : p) }),
16310
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-diffs", children: [
16311
- activeFile ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-link", onClick: () => setActiveFile(""), children: "\u663E\u793A\u5168\u90E8\u6587\u4EF6" }) : null,
16312
- shownFiles.map((f) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DiffFile, { file: f, defaultOpen: !!activeFile || diffFiles.length <= 3 }, f.path)),
16313
- detail.diff && detail.diff.truncated ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u5DEE\u5F02\u8FC7\u5927\uFF0C\u5DF2\u622A\u65AD\u663E\u793A\u3002" }) : null
16314
- ] })
16315
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u8FD9\u6761\u63D0\u4EA4\u6CA1\u6709\u53EF\u663E\u793A\u7684\u5DEE\u5F02\u3002" }) }),
16884
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-detail-diff", children: [
16885
+ diffFiles.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-tree-only", children: [
16886
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-tree-hint", children: [
16887
+ "\u5171 ",
16888
+ diffFiles.length,
16889
+ " \u4E2A\u6587\u4EF6\uFF0C\u53CC\u51FB\u6587\u4EF6\u540D\u6216\u70B9\u300C\u67E5\u770B\u300D\u6253\u5F00\u53D8\u66F4"
16890
+ ] }),
16891
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
16892
+ FileTree,
16893
+ {
16894
+ files: diffFiles,
16895
+ selected: treeSel,
16896
+ onSelect: (p) => setTreeSel(treeSel === p ? "" : p),
16897
+ onOpen: (p) => openFileAt(p)
16898
+ }
16899
+ )
16900
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u8FD9\u6761\u63D0\u4EA4\u6CA1\u6709\u53EF\u663E\u793A\u7684\u5DEE\u5F02\u3002" }),
16901
+ detail.diff && detail.diff.truncated ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u5DEE\u5F02\u8FC7\u5927\uFF0C\u5DF2\u622A\u65AD\u663E\u793A\u3002" }) : null
16902
+ ] }),
16316
16903
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-splitter-slot", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DragSplitter, { value: detailPct, onChange: setDetailPct, min: 15, max: 85, containerRef: detailRef }) }),
16317
16904
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-detail-msgbox", children: [
16318
16905
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-detail-subject", children: detail.subject }),
@@ -16337,29 +16924,58 @@ function HistoryPane(props) {
16337
16924
  ] }),
16338
16925
  detail.body ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("pre", { className: "dkg-detail-msg", children: detail.body }) : null
16339
16926
  ] })
16340
- ] }) : null
16927
+ ] }) : null,
16928
+ openFile ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
16929
+ DiffModal,
16930
+ {
16931
+ file: openFile,
16932
+ files: openFileList,
16933
+ repo: selected && (selected.__repo || repo),
16934
+ sha: selected && selected.sha,
16935
+ onPick: (p) => openFileAt(p),
16936
+ onClose: () => {
16937
+ setOpenFile(null);
16938
+ setActiveFile("");
16939
+ }
16940
+ }
16941
+ ) : null
16341
16942
  ] })
16342
16943
  ] });
16343
16944
  }
16344
16945
  function WorktreePane(props) {
16345
- const { repo, status, onRefresh } = props;
16946
+ const { repo, status, onRefresh, groups, repos, selectedRepos, onToggleRepo, onOnlyCurrent, onSelectAll } = props;
16346
16947
  const [checked, setChecked] = (0, import_react23.useState)({});
16347
16948
  const [message, setMessage] = (0, import_react23.useState)("");
16348
16949
  const [busy, setBusy] = (0, import_react23.useState)("");
16349
16950
  const [error, setError] = (0, import_react23.useState)("");
16350
16951
  const [preview, setPreview] = (0, import_react23.useState)(null);
16351
16952
  const [previewLoading, setPreviewLoading] = (0, import_react23.useState)(false);
16953
+ const [hunkPick, setHunkPick] = (0, import_react23.useState)({});
16352
16954
  const [result, setResult] = (0, import_react23.useState)(null);
16353
16955
  const [activeFile, setActiveFile] = (0, import_react23.useState)("");
16354
- const entries = status && status.entries || [];
16956
+ const [peek, setPeek] = (0, import_react23.useState)(null);
16957
+ const [peekLoading, setPeekLoading] = (0, import_react23.useState)(false);
16958
+ const [peekPath, setPeekPath] = (0, import_react23.useState)("");
16959
+ const [compare, setCompare] = (0, import_react23.useState)(null);
16960
+ const repoGroups = Array.isArray(groups) && groups.length > 0 ? groups : [{ repo, ok: true, status }];
16961
+ const multi = repoGroups.length > 1;
16962
+ const entries = [];
16963
+ for (const g of repoGroups) {
16964
+ const list = g && g.status && g.status.entries || [];
16965
+ for (const e of list) entries.push(Object.assign({ __repo: g.repo, __failed: g.ok === false, __error: g.error }, e));
16966
+ }
16967
+ const failedRepos = repoGroups.filter((g) => g && g.ok === false);
16355
16968
  const staged = entries.filter((e) => e.staged);
16356
- const unstaged = entries.filter((e) => !e.staged && !e.untracked);
16357
16969
  const untracked = entries.filter((e) => e.untracked);
16358
- const toggle = (path) => setChecked((prev) => Object.assign({}, prev, { [path]: !prev[path] }));
16970
+ const keyOf = (e) => multi ? e.__repo + "\0" + e.path : e.path;
16971
+ const pickedUnstaged = entries.filter((e) => !e.staged && checked[keyOf(e)]);
16972
+ const commitCount = staged.length + pickedUnstaged.length;
16973
+ const unstaged = entries.filter((e) => !e.staged && !e.untracked);
16974
+ const toggle = (e) => setChecked((prev) => Object.assign({}, prev, { [keyOf(e)]: !prev[keyOf(e)] }));
16359
16975
  const toggleAll = (list) => {
16360
- const allOn = list.length > 0 && list.every((e) => checked[e.path]);
16976
+ const allOn = list.length > 0 && list.every((e) => checked[keyOf(e)]);
16361
16977
  const next = Object.assign({}, checked);
16362
- for (const e of list) next[e.path] = !allOn;
16978
+ for (const e of list) next[keyOf(e)] = !allOn;
16363
16979
  setChecked(next);
16364
16980
  };
16365
16981
  const doStage = async (paths, unstage) => {
@@ -16367,8 +16983,18 @@ function WorktreePane(props) {
16367
16983
  setBusy(unstage ? "\u53D6\u6D88\u6682\u5B58\u2026" : "\u6682\u5B58\u4E2D\u2026");
16368
16984
  setError("");
16369
16985
  try {
16370
- await rpc2("stage", { repo, paths, unstage: unstage === true, confirm: true });
16986
+ const byRepo = /* @__PURE__ */ new Map();
16987
+ for (const p of paths) {
16988
+ const hit = entries.find((e) => e.path === p);
16989
+ const owner = hit && hit.__repo || repo;
16990
+ if (!byRepo.has(owner)) byRepo.set(owner, []);
16991
+ byRepo.get(owner).push(p);
16992
+ }
16993
+ for (const [owner, list] of byRepo) {
16994
+ await rpc2("stage", { repo: owner, paths: list, unstage: unstage === true, confirm: true });
16995
+ }
16371
16996
  setChecked({});
16997
+ setHunkPick({});
16372
16998
  await onRefresh();
16373
16999
  } catch (e) {
16374
17000
  setError(e && e.message || String(e));
@@ -16390,20 +17016,176 @@ function WorktreePane(props) {
16390
17016
  setPreviewLoading(false);
16391
17017
  }
16392
17018
  };
17019
+ const groupPickedHunks = () => {
17020
+ const byFile = /* @__PURE__ */ new Map();
17021
+ for (const key of Object.keys(hunkPick)) {
17022
+ if (!hunkPick[key]) continue;
17023
+ const sep = key.lastIndexOf("#");
17024
+ const path = key.slice(0, sep);
17025
+ const idx = Number(key.slice(sep + 1));
17026
+ if (!byFile.has(path)) byFile.set(path, []);
17027
+ byFile.get(path).push(idx);
17028
+ }
17029
+ return byFile;
17030
+ };
17031
+ const restorePickedHunks = async () => {
17032
+ const byFile = groupPickedHunks();
17033
+ if (byFile.size === 0) {
17034
+ setError("\u5148\u52FE\u9009\u8981\u8FD8\u539F\u7684\u7247\u6BB5");
17035
+ return;
17036
+ }
17037
+ setBusy("\u8FD8\u539F\u4E2D\u2026");
17038
+ setError("");
17039
+ try {
17040
+ for (const [path, idxs] of byFile) {
17041
+ await rpc2("restore-hunks", { repo, path, hunks: idxs, confirm: true });
17042
+ }
17043
+ setHunkPick({});
17044
+ await onRefresh();
17045
+ await loadPreview();
17046
+ setResult({ ok: true, message: "\u5DF2\u8FD8\u539F " + byFile.size + " \u4E2A\u6587\u4EF6\u7684\u9009\u4E2D\u7247\u6BB5" });
17047
+ } catch (e) {
17048
+ setError(e && e.message || String(e));
17049
+ } finally {
17050
+ setBusy("");
17051
+ }
17052
+ };
17053
+ const stagePickedHunks = async () => {
17054
+ const byFile = /* @__PURE__ */ new Map();
17055
+ for (const key of Object.keys(hunkPick)) {
17056
+ if (!hunkPick[key]) continue;
17057
+ const sep = key.lastIndexOf("#");
17058
+ const path = key.slice(0, sep);
17059
+ const idx = Number(key.slice(sep + 1));
17060
+ if (!byFile.has(path)) byFile.set(path, []);
17061
+ byFile.get(path).push(idx);
17062
+ }
17063
+ if (byFile.size === 0) {
17064
+ setError("\u5148\u52FE\u9009\u8981\u63D0\u4EA4\u7684\u7247\u6BB5");
17065
+ return;
17066
+ }
17067
+ setBusy("\u6682\u5B58\u4E2D\u2026");
17068
+ setError("");
17069
+ try {
17070
+ for (const [path, idxs] of byFile) {
17071
+ await rpc2("stage-hunks", { repo, path, hunks: idxs, confirm: true });
17072
+ }
17073
+ setHunkPick({});
17074
+ await onRefresh();
17075
+ await loadPreview();
17076
+ setResult({ ok: true, message: "\u5DF2\u628A " + byFile.size + " \u4E2A\u6587\u4EF6\u7684\u9009\u4E2D\u7247\u6BB5\u52A0\u5165\u6682\u5B58\u533A" });
17077
+ } catch (e) {
17078
+ setError(e && e.message || String(e));
17079
+ } finally {
17080
+ setBusy("");
17081
+ }
17082
+ };
17083
+ (0, import_react23.useEffect)(() => {
17084
+ if (!props.autoPreview) return;
17085
+ if (typeof props.onAutoPreviewDone === "function") props.onAutoPreviewDone();
17086
+ loadPreview();
17087
+ }, [props.autoPreview]);
17088
+ const loadOne = async (entry) => {
17089
+ if (!entry || !entry.path) return null;
17090
+ const body = { repo: entry.__repo || repo, path: entry.path };
17091
+ if (entry.untracked) body.untracked = true;
17092
+ else if (entry.staged) body.staged = true;
17093
+ const data = await rpc2("diff", body);
17094
+ return data && data.files && data.files[0] ? data.files[0] : null;
17095
+ };
17096
+ const peekFile = async (entry) => {
17097
+ if (!entry || !entry.path) return;
17098
+ if (peekPath === entry.path && peek) {
17099
+ setPeek(null);
17100
+ setPeekPath("");
17101
+ return;
17102
+ }
17103
+ setPeekPath(entry.path);
17104
+ setPeekLoading(true);
17105
+ setError("");
17106
+ try {
17107
+ const file = await loadOne(entry);
17108
+ setPeek(file);
17109
+ } catch (e) {
17110
+ setError(e && e.message || String(e));
17111
+ setPeek(null);
17112
+ } finally {
17113
+ setPeekLoading(false);
17114
+ }
17115
+ };
17116
+ const compareFile = async (entry) => {
17117
+ if (!entry || !entry.path) return;
17118
+ setPeekPath(entry.path);
17119
+ setPeekLoading(true);
17120
+ setError("");
17121
+ try {
17122
+ const file = await loadOne(entry);
17123
+ setCompare({ path: entry.path, file });
17124
+ } catch (e) {
17125
+ setError(e && e.message || String(e));
17126
+ } finally {
17127
+ setPeekLoading(false);
17128
+ }
17129
+ };
17130
+ const compareList = (0, import_react23.useMemo)(() => {
17131
+ const seen = /* @__PURE__ */ new Set();
17132
+ const list = [];
17133
+ for (const e of entries) {
17134
+ if (!e || !e.path || seen.has(e.path)) continue;
17135
+ seen.add(e.path);
17136
+ list.push({ path: e.path, additions: 0, deletions: 0 });
17137
+ }
17138
+ if (compare && compare.file) {
17139
+ const idx = list.findIndex((f) => f.path === compare.file.path);
17140
+ if (idx >= 0) list[idx] = compare.file;
17141
+ else list.unshift(compare.file);
17142
+ }
17143
+ return list;
17144
+ }, [entries, compare]);
16393
17145
  const doCommit = async () => {
16394
17146
  if (!message.trim()) {
16395
17147
  setError("\u8BF7\u5148\u586B\u5199\u63D0\u4EA4\u8BF4\u660E");
16396
17148
  return;
16397
17149
  }
16398
- if (staged.length === 0) {
16399
- setError("\u6682\u5B58\u533A\u4E3A\u7A7A\uFF0C\u5148\u52FE\u9009\u8981\u63D0\u4EA4\u7684\u6587\u4EF6");
17150
+ const pickedHunks = groupPickedHunks();
17151
+ if (commitCount === 0 && pickedHunks.size === 0) {
17152
+ setError("\u6CA1\u6709\u53EF\u63D0\u4EA4\u7684\u5185\u5BB9\uFF1A\u52FE\u9009\u8981\u63D0\u4EA4\u7684\u6587\u4EF6\uFF0C\u6216\u5728\u4E0B\u9762\u6309\u7247\u6BB5\u52FE\u9009");
16400
17153
  return;
16401
17154
  }
16402
17155
  setBusy("\u63D0\u4EA4\u4E2D\u2026");
16403
17156
  setError("");
16404
17157
  try {
16405
- const data = await rpc2("create-commit", { repo, message: message.trim(), confirm: true });
16406
- setResult(data && data.commit);
17158
+ if (pickedUnstaged.length > 0) {
17159
+ const byRepo = /* @__PURE__ */ new Map();
17160
+ for (const e of pickedUnstaged) {
17161
+ const owner = e.__repo || repo;
17162
+ if (!byRepo.has(owner)) byRepo.set(owner, []);
17163
+ byRepo.get(owner).push(e.path);
17164
+ }
17165
+ for (const [owner, list] of byRepo) {
17166
+ await rpc2("stage", { repo: owner, paths: list, confirm: true });
17167
+ }
17168
+ }
17169
+ for (const [path, idxs] of pickedHunks) {
17170
+ await rpc2("stage-hunks", { repo, path, hunks: idxs, confirm: true });
17171
+ }
17172
+ const freshStatus = pickedHunks.size > 0 ? await rpc2("status", { repo }) : null;
17173
+ const toCommit = freshStatus ? (freshStatus.entries || []).filter((e) => e.staged).map((e) => Object.assign({}, e, { __repo: repo })) : staged;
17174
+ if (toCommit.length === 0) {
17175
+ setError("\u6CA1\u6709\u53EF\u63D0\u4EA4\u7684\u5185\u5BB9");
17176
+ return;
17177
+ }
17178
+ const owners = [];
17179
+ for (const e of toCommit) {
17180
+ const owner = e.__repo || repo;
17181
+ if (!owners.includes(owner)) owners.push(owner);
17182
+ }
17183
+ const done = [];
17184
+ for (const owner of owners) {
17185
+ const data = await rpc2("create-commit", { repo: owner, message: message.trim(), confirm: true });
17186
+ if (data && data.commit) done.push(data.commit);
17187
+ }
17188
+ setResult(done.length === 1 ? done[0] : { multi: true, count: done.length, subjects: done.map((c) => c.shortSha + " " + c.subject) });
16407
17189
  setMessage("");
16408
17190
  setPreview(null);
16409
17191
  setChecked({});
@@ -16418,8 +17200,14 @@ function WorktreePane(props) {
16418
17200
  setBusy("\u63A8\u9001\u4E2D\u2026");
16419
17201
  setError("");
16420
17202
  try {
16421
- const data = await rpc2("push", { repo, confirm: true });
16422
- setResult({ pushed: true, output: data && data.output });
17203
+ const targets = repoGroups.filter((g) => g && g.ok !== false && g.status && g.status.ahead > 0).map((g) => g.repo);
17204
+ if (targets.length === 0) targets.push(repo);
17205
+ const outputs = [];
17206
+ for (const owner of targets) {
17207
+ const data = await rpc2("push", { repo: owner, confirm: true });
17208
+ if (data && data.output) outputs.push(data.output);
17209
+ }
17210
+ setResult({ pushed: true, output: outputs.join("\uFF1B") });
16423
17211
  await onRefresh();
16424
17212
  } catch (e) {
16425
17213
  setError(e && e.message || String(e));
@@ -16432,33 +17220,77 @@ function WorktreePane(props) {
16432
17220
  const group = (title, list, stagedGroup) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-wt-group", children: [
16433
17221
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-wt-head", children: [
16434
17222
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "dkg-check", children: [
16435
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "checkbox", checked: list.length > 0 && list.every((e) => checked[e.path]), onChange: () => toggleAll(list) }),
17223
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "checkbox", checked: list.length > 0 && list.every((e) => checked[keyOf(e)]), onChange: () => toggleAll(list) }),
16436
17224
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: title }),
16437
17225
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-hint", children: list.length })
16438
17226
  ] }),
16439
17227
  list.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-link", disabled: !!busy, onClick: () => {
16440
- const paths = list.filter((e) => checked[e.path]).map((e) => e.path);
17228
+ const paths = list.filter((e) => checked[keyOf(e)]).map((e) => e.path);
16441
17229
  doStage(paths.length > 0 ? paths : list.map((e) => e.path), stagedGroup);
16442
17230
  }, children: stagedGroup ? "\u5168\u90E8\u53D6\u6D88\u6682\u5B58" : "\u5168\u90E8\u6682\u5B58" }) : null
16443
17231
  ] }),
16444
- list.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note dkg-wt-empty", children: "\u65E0" }) : list.map((e) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "dkg-wt-item" + (checked[e.path] ? " on" : ""), children: [
16445
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "checkbox", checked: !!checked[e.path], onChange: () => toggle(e.path) }),
16446
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-wt-code", children: [
16447
- e.index,
16448
- e.worktree
16449
- ] }),
16450
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-ellipsis", title: e.origPath ? e.origPath + " \u2192 " + e.path : e.path, children: e.path }),
16451
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-wt-actions", children: stagedGroup ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-link", disabled: !!busy, onClick: (ev) => {
16452
- ev.preventDefault();
16453
- doStage([e.path], true);
16454
- }, children: "\u53D6\u6D88\u6682\u5B58" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-link", disabled: !!busy, onClick: (ev) => {
16455
- ev.preventDefault();
16456
- doStage([e.path], false);
16457
- }, children: "\u6682\u5B58" }) })
16458
- ] }, e.path))
17232
+ list.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note dkg-wt-empty", children: "\u65E0" }) : list.map((e) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
17233
+ "label",
17234
+ {
17235
+ className: "dkg-wt-item" + (checked[keyOf(e)] ? " on" : "") + (peekPath === e.path ? " peek" : ""),
17236
+ onClick: (ev) => {
17237
+ ev.preventDefault();
17238
+ peekFile(e);
17239
+ },
17240
+ onDoubleClick: (ev) => {
17241
+ ev.preventDefault();
17242
+ compareFile(e);
17243
+ },
17244
+ title: e.path + "\uFF08\u5355\u51FB\u9884\u89C8\uFF0C\u53CC\u51FB\u524D\u540E\u5BF9\u6BD4\uFF09",
17245
+ children: [
17246
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
17247
+ "input",
17248
+ {
17249
+ type: "checkbox",
17250
+ checked: !!checked[keyOf(e)],
17251
+ onChange: () => toggle(e),
17252
+ onClick: (ev) => ev.stopPropagation(),
17253
+ onDoubleClick: (ev) => ev.stopPropagation()
17254
+ }
17255
+ ),
17256
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-wt-code", children: [
17257
+ e.index,
17258
+ e.worktree
17259
+ ] }),
17260
+ multi ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-wt-repo", title: e.__repo, children: String(e.__repo).split("/").pop() }) : null,
17261
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-ellipsis", title: e.origPath ? e.origPath + " \u2192 " + e.path : e.path, children: e.path }),
17262
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-wt-actions", children: stagedGroup ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-link", disabled: !!busy, onClick: (ev) => {
17263
+ ev.preventDefault();
17264
+ ev.stopPropagation();
17265
+ doStage([e.path], true);
17266
+ }, onDoubleClick: (ev) => ev.stopPropagation(), children: "\u53D6\u6D88\u6682\u5B58" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-link", disabled: !!busy, onClick: (ev) => {
17267
+ ev.preventDefault();
17268
+ ev.stopPropagation();
17269
+ doStage([e.path], false);
17270
+ }, onDoubleClick: (ev) => ev.stopPropagation(), children: "\u6682\u5B58" }) })
17271
+ ]
17272
+ },
17273
+ e.path
17274
+ ))
16459
17275
  ] });
16460
17276
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-wt", children: [
16461
17277
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-wt-files", children: [
17278
+ Array.isArray(repos) && repos.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-wt-pick", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
17279
+ RepoPicker,
17280
+ {
17281
+ repos,
17282
+ selected: selectedRepos,
17283
+ current: repo,
17284
+ onToggle: onToggleRepo,
17285
+ onOnlyCurrent,
17286
+ onSelectAll
17287
+ }
17288
+ ) }) : null,
17289
+ failedRepos.map((g) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-error", children: [
17290
+ String(g.repo).split("/").pop(),
17291
+ "\uFF1A",
17292
+ g.error || "\u8BFB\u53D6\u5931\u8D25"
17293
+ ] }, g.repo)),
16462
17294
  group("\u5DF2\u6682\u5B58", staged, true),
16463
17295
  group("\u672A\u6682\u5B58", unstaged, false),
16464
17296
  group("\u672A\u8DDF\u8E2A", untracked, false),
@@ -16476,8 +17308,8 @@ function WorktreePane(props) {
16476
17308
  }
16477
17309
  ),
16478
17310
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-wt-actions", children: [
16479
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", onClick: loadPreview, disabled: !!busy || staged.length === 0, children: previewLoading ? "\u8BFB\u53D6\u4E2D\u2026" : "\u9884\u89C8\u53D8\u66F4" }),
16480
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn primary", onClick: doCommit, disabled: !!busy || staged.length === 0 || !message.trim(), children: "\u63D0\u4EA4" }),
17311
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", onClick: loadPreview, disabled: !!busy || commitCount === 0, children: previewLoading ? "\u8BFB\u53D6\u4E2D\u2026" : "\u9884\u89C8\u53D8\u66F4" }),
17312
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn primary", onClick: doCommit, disabled: !!busy || commitCount === 0 || !message.trim(), children: "\u63D0\u4EA4" }),
16481
17313
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", onClick: doPush, disabled: !!busy || status && status.ahead === 0, title: status && status.ahead === 0 ? "\u6CA1\u6709\u5F85\u63A8\u9001\u7684\u63D0\u4EA4" : "\u63A8\u9001\u5230\u8FDC\u7AEF", children: status && status.ahead > 0 ? "\u63A8\u9001 " + status.ahead + " \u4E2A\u63D0\u4EA4" : "\u63A8\u9001" })
16482
17314
  ] }),
16483
17315
  busy ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-hint", children: busy }) : null,
@@ -16486,12 +17318,36 @@ function WorktreePane(props) {
16486
17318
  "\u63A8\u9001\u5B8C\u6210",
16487
17319
  result.output ? "\uFF1A" + truncate4(result.output, 200) : ""
16488
17320
  ] }) : null,
16489
- result && result.subject ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-ok", children: [
17321
+ result && result.multi ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-ok", children: [
17322
+ "\u5DF2\u5728 ",
17323
+ result.count,
17324
+ " \u4E2A\u4ED3\u5E93\u5206\u522B\u63D0\u4EA4\uFF1A",
17325
+ result.subjects.join("\uFF1B")
17326
+ ] }) : result && result.subject ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-ok", children: [
16490
17327
  "\u5DF2\u63D0\u4EA4 ",
16491
17328
  result.shortSha,
16492
17329
  "\uFF1A",
16493
17330
  truncate4(result.subject, 80)
16494
17331
  ] }) : null,
17332
+ peekLoading && !peek ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-hint", children: "\u8BFB\u53D6\u5DEE\u5F02\u2026" }) : null,
17333
+ peek ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-peek", children: [
17334
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-peek-head", children: [
17335
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-ellipsis", title: peek.path, children: peek.path }),
17336
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-add", children: [
17337
+ "+",
17338
+ peek.additions
17339
+ ] }),
17340
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "dkg-del", children: [
17341
+ "\u2212",
17342
+ peek.deletions
17343
+ ] }),
17344
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-link", onClick: () => {
17345
+ setPeek(null);
17346
+ setPeekPath("");
17347
+ }, children: "\u5173\u95ED" })
17348
+ ] }),
17349
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-diff", children: peek.binary ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u4E0D\u663E\u793A\u9010\u884C\u5DEE\u5F02\u3002" }) : peek.hunks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u6CA1\u6709\u53EF\u663E\u793A\u7684\u5DEE\u5F02\u3002" }) : peek.hunks.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DiffHunk, { hunk: h }, i)) })
17350
+ ] }) : null,
16495
17351
  preview ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-preview", children: [
16496
17352
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-preview-head", children: [
16497
17353
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { children: [
@@ -16504,12 +17360,49 @@ function WorktreePane(props) {
16504
17360
  setActiveFile("");
16505
17361
  }, children: "\u6536\u8D77" })
16506
17362
  ] }),
17363
+ previewFiles.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-hunk-pick", children: [
17364
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-hunk-head", children: [
17365
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: "\u6309\u7247\u6BB5\u63D0\u4EA4\uFF08\u52FE\u9009\u7684\u624D\u63D0\u4EA4\uFF0C\u4E0D\u52FE\u9009\u7684\u4E0D\u63D0\u4EA4\uFF09" }),
17366
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn danger", disabled: !!busy, onClick: restorePickedHunks, title: "\u4E22\u5F03\u9009\u4E2D\u7247\u6BB5\u91CC\u7684\u6539\u52A8\uFF08\u5176\u4F59\u6539\u52A8\u4E0D\u53D7\u5F71\u54CD\uFF09", children: "\u8FD8\u539F\u9009\u4E2D" }),
17367
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", disabled: !!busy, onClick: stagePickedHunks, children: "\u6682\u5B58\u9009\u4E2D\u7247\u6BB5" })
17368
+ ] }),
17369
+ previewFiles.map((f, fi) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-hunk-file", children: [
17370
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-hunk-filehead", children: f.path }),
17371
+ (f.hunks || []).map((h, hi) => {
17372
+ const key = f.path + "#" + hi;
17373
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "dkg-hunk-item", children: [
17374
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
17375
+ "input",
17376
+ {
17377
+ type: "checkbox",
17378
+ checked: !!hunkPick[key],
17379
+ onChange: (ev) => setHunkPick({ ...hunkPick, [key]: ev.target.checked })
17380
+ }
17381
+ ),
17382
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-hunk-header", title: h.header, children: h.header })
17383
+ ] }, key);
17384
+ })
17385
+ ] }, f.path))
17386
+ ] }) : null,
16507
17387
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-detail-split", children: [
16508
17388
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FileTree, { files: previewFiles, selected: activeFile, onSelect: (p) => setActiveFile(activeFile === p ? "" : p) }),
16509
17389
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-diffs", children: shownPreview.map((f) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DiffFile, { file: f, defaultOpen: !!activeFile || previewFiles.length <= 3 }, f.path)) })
16510
17390
  ] })
16511
17391
  ] }) : null
16512
- ] })
17392
+ ] }),
17393
+ compare && compare.file ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
17394
+ DiffModal,
17395
+ {
17396
+ file: compare.file,
17397
+ files: compareList,
17398
+ repo,
17399
+ onPick: (p) => {
17400
+ const hit = entries.find((e) => e.path === p);
17401
+ if (hit) compareFile(hit);
17402
+ },
17403
+ onClose: () => setCompare(null)
17404
+ }
17405
+ ) : null
16513
17406
  ] });
16514
17407
  }
16515
17408
  function clampPercent(value, min, max) {
@@ -16861,6 +17754,17 @@ function GitView(props) {
16861
17754
  const [repo, setRepo] = (0, import_react23.useState)(props && props.repo ? props.repo : "");
16862
17755
  const [refs, setRefs] = (0, import_react23.useState)(null);
16863
17756
  const [status, setStatus] = (0, import_react23.useState)(null);
17757
+ const [statusGroups, setStatusGroups] = (0, import_react23.useState)([]);
17758
+ const [opBusy, setOpBusy] = (0, import_react23.useState)("");
17759
+ const [opMsg, setOpMsg] = (0, import_react23.useState)("");
17760
+ const [opError, setOpError] = (0, import_react23.useState)("");
17761
+ const [pushDlg, setPushDlg] = (0, import_react23.useState)(null);
17762
+ const [pullDlg, setPullDlg] = (0, import_react23.useState)(null);
17763
+ const [dlgBusy, setDlgBusy] = (0, import_react23.useState)(false);
17764
+ const [diag, setDiag] = (0, import_react23.useState)(null);
17765
+ const [diagBusy, setDiagBusy] = (0, import_react23.useState)(false);
17766
+ const [autoPreview, setAutoPreview] = (0, import_react23.useState)(false);
17767
+ const activeRepoKey = (selectedRepos.length > 0 ? selectedRepos : repo ? [repo] : []).join("\0");
16864
17768
  const [tab, setTab] = (0, import_react23.useState)("history");
16865
17769
  const [loading, setLoading] = (0, import_react23.useState)(false);
16866
17770
  const [error, setError] = (0, import_react23.useState)("");
@@ -16948,21 +17852,143 @@ function GitView(props) {
16948
17852
  if (!repo) {
16949
17853
  setRefs(null);
16950
17854
  setStatus(null);
17855
+ setStatusGroups([]);
16951
17856
  return;
16952
17857
  }
17858
+ const list = activeRepoKey ? activeRepoKey.split("\0").filter(Boolean) : [repo];
16953
17859
  try {
16954
- const [r, s] = await Promise.all([rpc2("refs", { repo }), rpc2("status", { repo })]);
16955
- setRefs(r);
16956
- setStatus(s);
17860
+ if (list.length <= 1) {
17861
+ const only = list[0] || repo;
17862
+ const [r, s] = await Promise.all([rpc2("refs", { repo: only }), rpc2("status", { repo: only })]);
17863
+ setRefs(r);
17864
+ setStatus(s);
17865
+ setStatusGroups([{ repo: only, ok: true, status: s }]);
17866
+ } else {
17867
+ const data = await rpc2("status", { repos: list });
17868
+ const results = data && data.results || [];
17869
+ setStatusGroups(results);
17870
+ try {
17871
+ setRefs(await rpc2("refs", { repo }));
17872
+ } catch {
17873
+ setRefs(null);
17874
+ }
17875
+ const first = results.find((x) => x && x.ok);
17876
+ setStatus(first ? first.status : null);
17877
+ }
16957
17878
  } catch (e) {
16958
17879
  setError(e && e.message || String(e));
16959
17880
  setRefs(null);
16960
17881
  setStatus(null);
17882
+ setStatusGroups([]);
16961
17883
  }
16962
- }, [repo]);
17884
+ }, [repo, activeRepoKey]);
16963
17885
  (0, import_react23.useEffect)(() => {
16964
17886
  refreshRepo();
16965
17887
  }, [refreshRepo]);
17888
+ const runOp = async (label, fn) => {
17889
+ if (opBusy) return;
17890
+ setOpBusy(label);
17891
+ setOpMsg("");
17892
+ setOpError("");
17893
+ try {
17894
+ const text = await fn();
17895
+ setOpMsg(text || label + "\u5B8C\u6210");
17896
+ await refreshRepo();
17897
+ } catch (e) {
17898
+ setOpError(e && e.message || String(e));
17899
+ } finally {
17900
+ setOpBusy("");
17901
+ }
17902
+ };
17903
+ const runDiagnose = async () => {
17904
+ if (diagBusy) return;
17905
+ setDiagBusy(true);
17906
+ setOpError("");
17907
+ try {
17908
+ const data = await rpc2("diagnose", { repo });
17909
+ setDiag(data);
17910
+ } catch (e) {
17911
+ setOpError(e && e.message || String(e));
17912
+ } finally {
17913
+ setDiagBusy(false);
17914
+ }
17915
+ };
17916
+ const doPull = (strategy) => runOp("\u66F4\u65B0", async () => {
17917
+ const safe = strategy === "ours" || strategy === "theirs" ? strategy : "";
17918
+ const data = await rpc2("pull", { repo, strategy: safe, confirm: true });
17919
+ if (data && data.conflict) {
17920
+ setPullDlg({ conflictFiles: data.conflictFiles || [], behind: data.behind || 0 });
17921
+ return "\u66F4\u65B0\u9047\u5230\u51B2\u7A81\uFF0C\u8BF7\u9009\u62E9\u5904\u7406\u65B9\u5F0F";
17922
+ }
17923
+ if (!data || data.pulled === false) return "\u5DF2\u662F\u6700\u65B0\u7248\u672C";
17924
+ return "\u5DF2\u66F4\u65B0\uFF1A\u843D\u540E " + data.behind + " \u4E2A\u63D0\u4EA4";
17925
+ });
17926
+ const resolveConflict = async (strategy) => {
17927
+ setDlgBusy(true);
17928
+ try {
17929
+ await rpc2("abort-merge", { repo, confirm: true });
17930
+ setPullDlg(null);
17931
+ setDlgBusy(false);
17932
+ await doPull(strategy);
17933
+ } catch (e) {
17934
+ setOpError(e && e.message || String(e));
17935
+ setDlgBusy(false);
17936
+ }
17937
+ };
17938
+ const doCommitAll = () => {
17939
+ setTab("worktree");
17940
+ setAutoPreview(true);
17941
+ setOpMsg("\u5DF2\u5207\u5230\u5DE5\u4F5C\u533A\uFF0C\u52FE\u9009\u8981\u63D0\u4EA4\u7684\u6539\u52A8\u540E\u70B9\u300C\u63D0\u4EA4\u300D");
17942
+ setOpError("");
17943
+ };
17944
+ const doPushAll = async () => {
17945
+ if (opBusy) return;
17946
+ setOpMsg("");
17947
+ setOpError("");
17948
+ setDlgBusy(true);
17949
+ try {
17950
+ const data = await rpc2("unpushed", { repo });
17951
+ setPushDlg({
17952
+ upstream: data && data.upstream || "",
17953
+ branch: data && data.branch || "",
17954
+ commits: data && data.commits || [],
17955
+ reason: data && data.reason || "",
17956
+ picked: (data && data.commits || []).map((c) => c.sha)
17957
+ });
17958
+ } catch (e) {
17959
+ setOpError(e && e.message || String(e));
17960
+ } finally {
17961
+ setDlgBusy(false);
17962
+ }
17963
+ };
17964
+ const confirmPush = async () => {
17965
+ if (!pushDlg) return;
17966
+ const all = pushDlg.commits.map((c) => c.sha);
17967
+ const picked = pushDlg.picked.filter((sha) => all.includes(sha));
17968
+ if (picked.length === 0) {
17969
+ setOpError("\u81F3\u5C11\u9009\u62E9\u4E00\u6761\u8981\u63A8\u9001\u7684\u8BB0\u5F55");
17970
+ return;
17971
+ }
17972
+ setDlgBusy(true);
17973
+ setOpError("");
17974
+ try {
17975
+ if (picked.length === all.length) {
17976
+ const data = await rpc2("push", { repo, confirm: true });
17977
+ setOpMsg("\u5DF2\u63A8\u9001 " + picked.length + " \u6761" + (data && data.output ? "\uFF1A" + String(data.output).slice(0, 120) : ""));
17978
+ } else {
17979
+ const ordered = pushDlg.commits.slice().reverse();
17980
+ const oldest = ordered.find((c) => picked.includes(c.sha));
17981
+ const data = await rpc2("push", { repo, branch: pushDlg.branch + ":" + pushDlg.branch, confirm: true, remote: oldest ? void 0 : void 0 });
17982
+ setOpMsg("\u5DF2\u63A8\u9001\uFF08\u542B " + picked.length + " \u6761\u9009\u4E2D\u7684\u8BB0\u5F55\uFF09" + (data && data.output ? "\uFF1A" + String(data.output).slice(0, 120) : ""));
17983
+ }
17984
+ setPushDlg(null);
17985
+ await refreshRepo();
17986
+ } catch (e) {
17987
+ setOpError(e && e.message || String(e));
17988
+ } finally {
17989
+ setDlgBusy(false);
17990
+ }
17991
+ };
16966
17992
  const [picking, setPicking] = (0, import_react23.useState)(false);
16967
17993
  const canBrowse = (() => {
16968
17994
  try {
@@ -17035,8 +18061,145 @@ function GitView(props) {
17035
18061
  dirty > 0 ? " (" + dirty + ")" : ""
17036
18062
  ] })
17037
18063
  ] }),
17038
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", onClick: refreshRepo, children: "\u5237\u65B0" })
18064
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", onClick: refreshRepo, children: "\u5237\u65B0" }),
18065
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn" + (opBusy === "\u66F4\u65B0" ? " busy" : ""), disabled: !repo || !!opBusy, "data-busy": opBusy === "\u66F4\u65B0" ? "1" : void 0, onClick: () => doPull(), title: "\u62C9\u53D6\u8FDC\u7AEF\u66F4\u65B0\uFF08\u5FEB\u8FDB\u5408\u5E76\uFF09", children: opBusy === "\u66F4\u65B0" ? "\u66F4\u65B0\u4E2D\u2026" : "\u66F4\u65B0" }),
18066
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn" + (opBusy === "\u63D0\u4EA4" ? " busy" : ""), disabled: !repo || !!opBusy, "data-busy": opBusy === "\u63D0\u4EA4" ? "1" : void 0, onClick: doCommitAll, title: "\u63D0\u4EA4\u6682\u5B58\u533A\u7684\u6539\u52A8", children: opBusy === "\u63D0\u4EA4" ? "\u63D0\u4EA4\u4E2D\u2026" : "\u63D0\u4EA4" }),
18067
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn" + (opBusy === "\u63A8\u9001" ? " busy" : ""), disabled: !repo || !!opBusy, "data-busy": opBusy === "\u63A8\u9001" ? "1" : void 0, onClick: doPushAll, title: "\u63A8\u9001\u5230\u8FDC\u7AEF", children: opBusy === "\u63A8\u9001" ? "\u63A8\u9001\u4E2D\u2026" : "\u63A8\u9001" }),
18068
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", disabled: !repo || diagBusy, onClick: runDiagnose, title: "\u68C0\u67E5\u63A8\u9001\u73AF\u5883\uFF08SSH \u5BC6\u94A5\u3001known_hosts\u3001\u8FDE\u901A\u6027\uFF09", children: diagBusy ? "\u68C0\u67E5\u4E2D\u2026" : "\u8BCA\u65AD" })
17039
18069
  ] }),
18070
+ opMsg || opError ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: opError ? "dkg-error" : "dkg-ok", onClick: () => {
18071
+ setOpMsg("");
18072
+ setOpError("");
18073
+ }, style: { cursor: "pointer" }, children: opError || opMsg }) : null,
18074
+ pushDlg ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
18075
+ DockDialog,
18076
+ {
18077
+ title: "\u63A8\u9001\u5230 " + (pushDlg.upstream || "\u8FDC\u7AEF"),
18078
+ confirmText: "\u63A8\u9001\uFF08" + pushDlg.picked.length + " \u6761\uFF09",
18079
+ busy: dlgBusy,
18080
+ onConfirm: confirmPush,
18081
+ onCancel: () => {
18082
+ if (!dlgBusy) setPushDlg(null);
18083
+ },
18084
+ children: [
18085
+ opError ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-error", children: opError }) : null,
18086
+ pushDlg.reason ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: pushDlg.reason }) : null,
18087
+ pushDlg.commits.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u6CA1\u6709\u672A\u63A8\u9001\u7684\u63D0\u4EA4\u3002" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
18088
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-dlg-row", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "dkg-check", children: [
18089
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
18090
+ "input",
18091
+ {
18092
+ type: "checkbox",
18093
+ checked: pushDlg.picked.length === pushDlg.commits.length,
18094
+ onChange: (ev) => setPushDlg({ ...pushDlg, picked: ev.target.checked ? pushDlg.commits.map((c) => c.sha) : [] })
18095
+ }
18096
+ ),
18097
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { children: [
18098
+ "\u5168\u9009\uFF08",
18099
+ pushDlg.commits.length,
18100
+ " \u6761\uFF09"
18101
+ ] })
18102
+ ] }) }),
18103
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-dlg-list", children: pushDlg.commits.map((c) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "dkg-dlg-item", children: [
18104
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
18105
+ "input",
18106
+ {
18107
+ type: "checkbox",
18108
+ checked: pushDlg.picked.includes(c.sha),
18109
+ onChange: (ev) => {
18110
+ const next = ev.target.checked ? pushDlg.picked.concat([c.sha]) : pushDlg.picked.filter((s) => s !== c.sha);
18111
+ setPushDlg({ ...pushDlg, picked: next });
18112
+ }
18113
+ }
18114
+ ),
18115
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-sha", children: c.shortSha }),
18116
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-dlg-subject", title: c.subject, children: c.subject }),
18117
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-dlg-meta", children: c.author })
18118
+ ] }, c.sha)) }),
18119
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u8BF4\u660E\uFF1AGit \u53EA\u80FD\u63A8\u5230\u67D0\u4E00\u6761\u4E3A\u6B62\uFF0C\u4E0D\u80FD\u8DF3\u8FC7\u4E2D\u95F4\u63D0\u4EA4\u3002\u52FE\u9009\u7684\u8BB0\u5F55\u4F1A\u4E0E\u5B83\u4E4B\u524D\u7684\u6240\u6709\u63D0\u4EA4\u4E00\u8D77\u63A8\u9001\u3002" })
18120
+ ] })
18121
+ ]
18122
+ }
18123
+ ) : null,
18124
+ diag ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
18125
+ DockDialog,
18126
+ {
18127
+ title: "\u63A8\u9001\u73AF\u5883\u8BCA\u65AD",
18128
+ confirmText: "\u5173\u95ED",
18129
+ cancelText: "\u91CD\u65B0\u68C0\u67E5",
18130
+ onConfirm: () => setDiag(null),
18131
+ onCancel: runDiagnose,
18132
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-diag", children: [
18133
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-diag-sec", children: "\u68C0\u67E5\u9879" }),
18134
+ (diag.checks || []).map((c) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-diag-row", children: [
18135
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: c.ok ? "dkg-diag-ok" : "dkg-diag-bad", children: c.ok ? "\u2713" : "\u2717" }),
18136
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-diag-name", children: c.name }),
18137
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-diag-detail", children: c.detail })
18138
+ ] }, c.name)),
18139
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-diag-sec", children: "\u5BBF\u4E3B\u8FDB\u7A0B\u73AF\u5883" }),
18140
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-diag-row", children: [
18141
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-diag-name", children: "\u751F\u6548 HOME" }),
18142
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-diag-detail", children: diag.env && diag.env.HOME })
18143
+ ] }),
18144
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-diag-row", children: [
18145
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-diag-name", children: "\u539F\u59CB HOME" }),
18146
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-diag-detail", children: diag.env && diag.env.HOME_\u539F\u59CB })
18147
+ ] }),
18148
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-diag-row", children: [
18149
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-diag-name", children: "USERPROFILE" }),
18150
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-diag-detail", children: diag.env && diag.env.USERPROFILE })
18151
+ ] }),
18152
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-diag-row", children: [
18153
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-diag-name", children: "SSH_AUTH_SOCK" }),
18154
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-diag-detail", children: diag.env && diag.env.SSH_AUTH_SOCK })
18155
+ ] }),
18156
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-diag-row", children: [
18157
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-diag-name", children: "\u8FDC\u7AEF\u5730\u5740" }),
18158
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-diag-detail", children: diag.remote })
18159
+ ] }),
18160
+ Object.keys(diag.files || {}).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
18161
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-diag-sec", children: "\u627E\u5230\u7684 .ssh \u76EE\u5F55" }),
18162
+ Object.entries(diag.files).map(([dir2, files]) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-diag-row", children: [
18163
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-diag-name", children: dir2 }),
18164
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-diag-detail", children: (files || []).join(", ") || "(\u7A7A)" })
18165
+ ] }, dir2))
18166
+ ] }) : null,
18167
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u300Cgit \u8BFB\u53D6\u8FDC\u7AEF\u300D\u7528\u7684\u662F\u548C\u63A8\u9001\u5B8C\u5168\u76F8\u540C\u7684 git / ssh / known_hosts \u8DEF\u5F84\uFF1A\u5B83\u901A\u8FC7\u800C\u63A8\u9001\u4ECD\u5931\u8D25\u65F6\uFF0C\u95EE\u9898\u5728\u8FDC\u7AEF\u6743\u9650\u6216\u5206\u652F\u4FDD\u62A4\uFF0C\u4E0D\u5728 SSH \u73AF\u5883\u3002" })
18168
+ ] })
18169
+ }
18170
+ ) : null,
18171
+ pullDlg ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
18172
+ DockDialog,
18173
+ {
18174
+ title: "\u66F4\u65B0\u9047\u5230\u51B2\u7A81",
18175
+ confirmText: "\u5408\u5E76\uFF08\u4FDD\u7559\u51B2\u7A81\u6807\u8BB0\uFF09",
18176
+ busy: dlgBusy,
18177
+ onConfirm: () => resolveConflict(""),
18178
+ onCancel: async () => {
18179
+ if (dlgBusy) return;
18180
+ setDlgBusy(true);
18181
+ try {
18182
+ await rpc2("abort-merge", { repo, confirm: true });
18183
+ } catch {
18184
+ }
18185
+ setPullDlg(null);
18186
+ setDlgBusy(false);
18187
+ },
18188
+ children: [
18189
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-note", children: [
18190
+ "\u8FDC\u7AEF\u6709 ",
18191
+ pullDlg.behind,
18192
+ " \u4E2A\u63D0\u4EA4\uFF0C\u4E0E\u672C\u5730\u6539\u52A8\u51B2\u7A81\u3002\u8BF7\u9009\u62E9\u5904\u7406\u65B9\u5F0F\uFF1A"
18193
+ ] }),
18194
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "dkg-dlg-actions", children: [
18195
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", disabled: dlgBusy, onClick: () => resolveConflict(""), children: "\u5408\u5E76\uFF08\u4FDD\u7559\u51B2\u7A81\u6807\u8BB0\uFF0C\u624B\u52A8\u89E3\u51B3\uFF09" }),
18196
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", disabled: dlgBusy, onClick: () => resolveConflict("ours"), children: "\u63A5\u53D7\u672C\u5730\uFF08\u4FDD\u7559\u6211\u7684\u6539\u52A8\uFF09" }),
18197
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "dkg-btn", disabled: dlgBusy, onClick: () => resolveConflict("theirs"), children: "\u63A5\u53D7\u8FDC\u7AEF\uFF08\u91C7\u7528\u8FDC\u7AEF\u7248\u672C\uFF09" })
18198
+ ] }),
18199
+ pullDlg.conflictFiles.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-dlg-list", children: pullDlg.conflictFiles.map((f) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-dlg-item", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dkg-dlg-subject", children: f }) }, f)) }) : null
18200
+ ]
18201
+ }
18202
+ ) : null,
17040
18203
  tab === "history" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
17041
18204
  HistoryPane,
17042
18205
  {
@@ -17050,7 +18213,22 @@ function GitView(props) {
17050
18213
  refs,
17051
18214
  initialPath: props && props.initialPath
17052
18215
  }
17053
- ) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(WorktreePane, { repo, status, onRefresh: refreshRepo })
18216
+ ) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
18217
+ WorktreePane,
18218
+ {
18219
+ repo,
18220
+ status,
18221
+ groups: statusGroups,
18222
+ repos,
18223
+ selectedRepos: selectedRepos.length > 0 ? selectedRepos : [repo],
18224
+ onToggleRepo: toggleRepo,
18225
+ onOnlyCurrent: () => setSelectedRepos([repo]),
18226
+ onSelectAll: setAllRepos,
18227
+ onRefresh: refreshRepo,
18228
+ autoPreview,
18229
+ onAutoPreviewDone: () => setAutoPreview(false)
18230
+ }
18231
+ )
17054
18232
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "dkg-note", children: "\u6B63\u5728\u89E3\u6790\u76EE\u5F55\u6240\u5728\u7684\u4ED3\u5E93\u2026\uFF08\u4E5F\u53EF\u4EE5\u5728\u4E0A\u9762\u586B\u4E00\u4E2A\u7EDD\u5BF9\u8DEF\u5F84\u540E\u70B9\u300C\u6253\u5F00\u300D\uFF09" })
17055
18233
  ] });
17056
18234
  }
@@ -17088,6 +18266,15 @@ var css6 = [
17088
18266
  ".dkg-select{flex:none;font-family:inherit;font-size:12px;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:4px 6px;}",
17089
18267
  ".dkg-btn{flex:none;cursor:pointer;font-family:inherit;font-size:12px;color:var(--dsw-alias-label-primary);background:transparent;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:3px 9px;}",
17090
18268
  ".dkg-btn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);}",
18269
+ // 按下与键盘聚焦:只有 hover 的话,点下去没有反馈,键盘用户也不知道焦点在哪
18270
+ // 主题里没有 pressed 变量,用 hover 底色 + 内阴影表达「按下去」
18271
+ ".dkg-btn:active:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);box-shadow:inset 0 1px 3px rgba(0,0,0,.28);transform:translateY(1px);}",
18272
+ ".dkg-btn:focus-visible{outline:2px solid var(--dk-accent);outline-offset:1px;}",
18273
+ // 处理中的按钮:显示进度感而不是死灰
18274
+ // 处理中:保留强调色并显示进度光标,与「不可用」区分开
18275
+ ".dkg-btn.busy{opacity:.85;cursor:progress;border-color:var(--dk-accent);color:var(--dk-accent);background:var(--dk-accent-soft);}",
18276
+ ".dkg-btn.busy::after{content:'';display:inline-block;width:8px;height:8px;margin-left:6px;border:2px solid currentColor;border-top-color:transparent;border-radius:50%;animation:dkg-spin .7s linear infinite;vertical-align:-1px;}",
18277
+ "@keyframes dkg-spin{to{transform:rotate(360deg);}}",
17091
18278
  ".dkg-btn:disabled{opacity:.45;cursor:default;}",
17092
18279
  ".dkg-btn.primary{border-color:var(--dk-accent);color:var(--dk-accent);}",
17093
18280
  ".dkg-btn.primary:hover:not(:disabled){background:var(--dk-accent-soft);}",
@@ -17223,6 +18410,104 @@ var css6 = [
17223
18410
  ".dkg-detail-meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:11px;color:var(--dsw-alias-label-tertiary);word-break:break-all;}",
17224
18411
  ".dkg-sha{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--dk-accent);}",
17225
18412
  ".dkg-detail-msg{margin:0;font-size:11px;line-height:1.55;color:var(--dsw-alias-label-secondary);white-space:pre-wrap;word-break:break-word;max-height:120px;overflow:auto;background:var(--dsw-alias-bg-layer-2);border-radius:6px;padding:6px 8px;}",
18413
+ // 只显示文件树时的提示与布局
18414
+ ".dkg-tree-only{display:flex;flex-direction:column;gap:4px;min-height:0;flex:1;overflow:auto;}",
18415
+ ".dkg-tree-hint{font-size:11px;color:var(--dsw-alias-label-tertiary);padding:2px 4px;}",
18416
+ // 文件树行:文件名区 + 后面的「查看」按钮
18417
+ ".dkg-tree-row.file{display:flex;align-items:center;gap:4px;padding-right:4px;}",
18418
+ ".dkg-tree-open{flex:1;min-width:0;display:flex;align-items:center;gap:6px;background:none;border:none;padding:0;cursor:pointer;color:inherit;font:inherit;text-align:left;}",
18419
+ ".dkg-tree-view{flex:none;font-size:10px;padding:0 6px;border-radius:999px;border:1px solid var(--dsw-alias-border-l2);background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;}",
18420
+ ".dkg-tree-view:hover{border-color:var(--dk-accent);color:var(--dk-accent);}",
18421
+ // 差异浮窗(可最大化)
18422
+ // 遮罩只负责盖住和拦截点击;定位交给浮窗自己(要能拖动到任意位置)
18423
+ // 浮窗层:不拦截点击(pointer-events:none),只有浮窗自身接收事件。
18424
+ // 这样浮窗开着时右侧的文件树、提交列表都照常可点。
18425
+ // 面板内弹窗(替代浏览器原生 prompt/confirm)
18426
+ ".dkg-dlg-mask{position:fixed;inset:0;z-index:80;background:rgba(0,0,0,.45);display:flex;align-items:center;justify-content:center;padding:24px;}",
18427
+ ".dkg-dlg{display:flex;flex-direction:column;width:min(560px,92vw);max-height:min(80vh,640px);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);border-radius:10px;box-shadow:0 16px 48px rgba(0,0,0,.45);overflow:hidden;}",
18428
+ ".dkg-dlg-head{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);flex:none;}",
18429
+ ".dkg-dlg-title{flex:1;min-width:0;font-size:13px;font-weight:600;}",
18430
+ ".dkg-dlg-x{flex:none;background:none;border:none;color:var(--dsw-alias-label-tertiary);cursor:pointer;font-size:13px;padding:0 4px;}",
18431
+ ".dkg-dlg-x:hover{color:var(--dsw-alias-label-primary);}",
18432
+ ".dkg-dlg-body{flex:1;min-height:0;overflow:auto;padding:12px;display:flex;flex-direction:column;gap:8px;}",
18433
+ ".dkg-dlg-foot{display:flex;justify-content:flex-end;gap:8px;padding:10px 12px;border-top:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);flex:none;}",
18434
+ ".dkg-textarea{width:100%;min-height:96px;resize:vertical;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);border:1px solid var(--dsw-alias-border-l2);border-radius:6px;padding:8px;font:inherit;font-size:12px;box-sizing:border-box;}",
18435
+ ".dkg-btn.danger{border-color:#c0392b;color:#c0392b;}",
18436
+ ".dkg-btn.danger:hover{background:rgba(192,57,43,.12);}",
18437
+ ".dkg-dlg-row{display:flex;align-items:center;gap:8px;padding-bottom:6px;border-bottom:1px solid var(--dsw-alias-border-l1);}",
18438
+ ".dkg-dlg-list{display:flex;flex-direction:column;gap:2px;max-height:260px;overflow:auto;border:1px solid var(--dsw-alias-border-l1);border-radius:6px;padding:4px;}",
18439
+ ".dkg-dlg-item{display:flex;align-items:center;gap:8px;padding:4px 6px;border-radius:4px;cursor:pointer;font-size:12px;}",
18440
+ ".dkg-dlg-item:hover{background:var(--dsw-alias-bg-layer-2);}",
18441
+ ".dkg-dlg-subject{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
18442
+ ".dkg-dlg-meta{flex:none;color:var(--dsw-alias-label-tertiary);font-size:11px;}",
18443
+ ".dkg-dlg-actions{display:flex;flex-direction:column;gap:6px;}",
18444
+ ".dkg-dlg-actions .dkg-btn{justify-content:flex-start;text-align:left;}",
18445
+ // 错误提示可能是多行(含排查步骤),保留换行与缩进
18446
+ ".dkg-error{white-space:pre-wrap;word-break:break-word;line-height:1.5;font-family:inherit;}",
18447
+ // 诊断面板
18448
+ ".dkg-diag{display:flex;flex-direction:column;gap:4px;font-size:12px;}",
18449
+ ".dkg-diag-sec{margin-top:8px;font-size:11px;font-weight:600;color:var(--dsw-alias-label-secondary);}",
18450
+ ".dkg-diag-sec:first-child{margin-top:0;}",
18451
+ ".dkg-diag-row{display:flex;gap:6px;align-items:flex-start;padding:2px 0;line-height:1.5;}",
18452
+ ".dkg-diag-ok{flex:none;color:#2ea043;}",
18453
+ ".dkg-diag-bad{flex:none;color:#c0392b;}",
18454
+ ".dkg-diag-name{flex:none;min-width:160px;color:var(--dsw-alias-label-primary);}",
18455
+ ".dkg-diag-detail{flex:1;min-width:0;color:var(--dsw-alias-label-tertiary);word-break:break-all;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;}",
18456
+ // 片段级勾选
18457
+ ".dkg-hunk-pick{display:flex;flex-direction:column;gap:6px;padding:6px 8px;border-bottom:1px solid var(--dsw-alias-border-l1);max-height:180px;overflow:auto;flex:none;}",
18458
+ ".dkg-hunk-head{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:11px;color:var(--dsw-alias-label-secondary);}",
18459
+ ".dkg-hunk-file{display:flex;flex-direction:column;gap:2px;}",
18460
+ ".dkg-hunk-filehead{font-size:11px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--dsw-alias-label-secondary);padding:2px 0;}",
18461
+ ".dkg-hunk-item{display:flex;align-items:center;gap:6px;font-size:11px;padding:1px 0 1px 10px;cursor:pointer;}",
18462
+ ".dkg-hunk-header{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--dsw-alias-label-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
18463
+ // 视图模式切换(差异 / 全文件)
18464
+ ".dkg-modal-modes{display:flex;gap:2px;flex:none;border:1px solid var(--dsw-alias-border-l2);border-radius:6px;overflow:hidden;}",
18465
+ ".dkg-btn.sm{font-size:11px;padding:2px 8px;border:none;border-radius:0;background:transparent;}",
18466
+ ".dkg-btn.sm.on{background:var(--dk-accent-soft);color:var(--dk-accent);}",
18467
+ // 全文件视图
18468
+ // 双栏全文件:左右都是完整文件,改动行高亮
18469
+ ".dkg-ff{display:flex;flex-direction:column;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.5;min-height:0;flex:1;}",
18470
+ ".dkg-ff-head{display:flex;gap:0;border-bottom:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);flex:none;position:sticky;top:0;z-index:1;}",
18471
+ ".dkg-ff-head>span{flex:1;padding:4px 8px;font-size:11px;color:var(--dsw-alias-label-secondary);border-right:1px solid var(--dsw-alias-border-l1);}",
18472
+ ".dkg-ff-cols{display:flex;gap:0;min-height:0;flex:1;overflow:auto;}",
18473
+ ".dkg-ff-col{flex:1;min-width:0;border-right:1px solid var(--dsw-alias-border-l1);}",
18474
+ ".dkg-ff-col:last-child{border-right:none;}",
18475
+ ".dkg-ff-row{display:flex;gap:8px;padding:0 8px;white-space:pre;}",
18476
+ ".dkg-ff-row.changed{background:rgba(46,160,67,.14);}",
18477
+ ".dkg-ff-row.del{background:rgba(200,60,60,.14);}",
18478
+ ".dkg-ff-ln{flex:none;width:44px;text-align:right;color:var(--dsw-alias-label-tertiary);user-select:none;}",
18479
+ ".dkg-ff-code{flex:1;min-width:0;overflow-x:auto;}",
18480
+ ".dkg-modal-layer{position:fixed;inset:0;z-index:60;pointer-events:none;}",
18481
+ ".dkg-modal{pointer-events:auto;}",
18482
+ // 贴边时给个明显的左侧强调,表明它是吸附状态
18483
+ ".dkg-modal-layer.docked .dkg-modal{box-shadow:0 16px 48px rgba(0,0,0,.4),0 0 0 1px var(--dk-accent);}",
18484
+ ".dkg-btn.on{background:var(--dk-accent-soft);color:var(--dk-accent);border-color:var(--dk-accent);}",
18485
+ // 默认居中:用 left/top 50% + translate;一旦有记住的位置就改成绝对像素
18486
+ ".dkg-modal{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:flex;flex-direction:column;width:min(1100px,92vw);height:min(80vh,760px);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);border-radius:10px;box-shadow:0 16px 48px rgba(0,0,0,.4);overflow:hidden;}",
18487
+ ".dkg-modal.max{left:50%;top:50%;transform:translate(-50%,-50%);width:96vw;height:92vh;}",
18488
+ // 有明确坐标时不再居中:内联 left/top 会覆盖上面的 50%,但 translate 还在,
18489
+ // 所以这里用属性选择器把它清掉。
18490
+ ".dkg-modal[style*='left:']{transform:none;}",
18491
+ ".dkg-modal-head{display:flex;align-items:center;gap:8px;padding:6px 10px;border-bottom:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);flex:none;cursor:grab;user-select:none;}",
18492
+ ".dkg-modal-head:active{cursor:grabbing;}",
18493
+ // 标题栏里的按钮/下拉要保留正常光标,别让人以为整条都能拖
18494
+ ".dkg-modal-head button,.dkg-modal-head select{cursor:pointer;}",
18495
+ ".dkg-modal-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;}",
18496
+ ".dkg-modal-pick{flex:none;max-width:280px;font-size:11px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border:1px solid var(--dsw-alias-border-l2);border-radius:6px;padding:2px 4px;}",
18497
+ ".dkg-modal-body{flex:1;min-height:0;overflow:auto;padding:0;}",
18498
+ // 浮窗拖拽调整大小:四边 + 四角
18499
+ ".dkg-modal{position:relative;}",
18500
+ ".dkg-rz{position:absolute;z-index:2;}",
18501
+ ".dkg-rz.n{top:-3px;left:8px;right:8px;height:6px;cursor:ns-resize;}",
18502
+ ".dkg-rz.s{bottom:-3px;left:8px;right:8px;height:6px;cursor:ns-resize;}",
18503
+ ".dkg-rz.e{top:8px;bottom:8px;right:-3px;width:6px;cursor:ew-resize;}",
18504
+ ".dkg-rz.w{top:8px;bottom:8px;left:-3px;width:6px;cursor:ew-resize;}",
18505
+ ".dkg-rz.ne{top:-3px;right:-3px;width:14px;height:14px;cursor:nesw-resize;}",
18506
+ ".dkg-rz.nw{top:-3px;left:-3px;width:14px;height:14px;cursor:nwse-resize;}",
18507
+ ".dkg-rz.se{bottom:-3px;right:-3px;width:14px;height:14px;cursor:nwse-resize;}",
18508
+ ".dkg-rz.sw{bottom:-3px;left:-3px;width:14px;height:14px;cursor:nesw-resize;}",
18509
+ // 右下角给个视觉提示:告诉用户这里能拖
18510
+ '.dkg-rz.se::after{content:"";position:absolute;right:4px;bottom:4px;width:7px;height:7px;border-right:2px solid var(--dsw-alias-label-tertiary);border-bottom:2px solid var(--dsw-alias-label-tertiary);opacity:.7;}',
17226
18511
  ".dkg-detail-split{display:flex;gap:6px;min-height:0;}",
17227
18512
  ".dkg-compact .dkg-detail-split{flex-direction:column;}",
17228
18513
  ".dkg-diffs{flex:1;min-width:0;display:flex;flex-direction:column;gap:5px;}",
@@ -17264,10 +18549,40 @@ var css6 = [
17264
18549
  ".dkg-wt-item.on{background:var(--dk-accent-soft);}",
17265
18550
  ".dkg-wt-code{flex:none;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px;color:var(--dk-warn);width:20px;}",
17266
18551
  ".dkg-wt-actions{flex:none;}",
17267
- ".dkg-wt-commit{flex:1 1 52%;min-width:0;display:flex;flex-direction:column;gap:6px;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-1);padding:6px;overflow:auto;}",
18552
+ ".dkg-wt-pick{display:flex;align-items:center;gap:6px;padding-bottom:4px;border-bottom:1px solid var(--dsw-alias-border-l1);margin-bottom:4px;}",
18553
+ ".dkg-wt-repo{flex:none;font-size:10px;color:var(--dk-accent);border:1px solid currentColor;border-radius:999px;padding:0 5px;max-width:90px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
18554
+ ".dkg-wt-commit{flex:1 1 52%;min-width:0;display:flex;flex-direction:column;gap:6px;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-1);padding:6px;overflow:hidden;}",
18555
+ // 说明框与按钮区固定高度,不被预览挤压
18556
+ ".dkg-wt-commit>.dkg-textarea,.dkg-wt-commit>.dkg-wt-actions,.dkg-wt-commit>.dkg-hint,.dkg-wt-commit>.dkg-error,.dkg-wt-commit>.dkg-ok{flex:none;}",
17268
18557
  ".dkg-textarea{width:100%;box-sizing:border-box;font-family:inherit;font-size:12px;line-height:1.55;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:6px;padding:6px 8px;resize:vertical;}",
17269
18558
  ".dkg-textarea:focus{outline:none;border-color:var(--dk-accent);}",
17270
18559
  ".dkg-wt-actions{display:flex;gap:5px;flex-wrap:wrap;}",
18560
+ // 并排对比(双击文件打开)
18561
+ ".dkg-cmp{display:flex;flex-direction:column;gap:6px;flex:1;min-height:0;overflow:hidden;}",
18562
+ ".dkg-cmp-head{display:flex;align-items:center;gap:8px;padding:4px 6px;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-1);}",
18563
+ ".dkg-cmp-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;color:var(--dsw-alias-label-primary);}",
18564
+ ".dkg-cmp-body{flex:1;min-height:0;overflow:auto;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-1);}",
18565
+ // 并排对比的两栏
18566
+ ".dkg-sd{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;line-height:1.55;min-width:0;}",
18567
+ ".dkg-sd-head{display:flex;position:sticky;top:0;z-index:1;background:var(--dsw-alias-bg-layer-2);border-bottom:1px solid var(--dsw-alias-border-l1);}",
18568
+ ".dkg-sd-head>span{flex:1 1 50%;min-width:0;padding:3px 8px;font-size:10px;color:var(--dsw-alias-label-tertiary);border-right:1px solid var(--dsw-alias-border-l1);}",
18569
+ ".dkg-sd-head>span:last-child{border-right:none;}",
18570
+ ".dkg-sd-hunk-head{color:var(--dk-accent);background:color-mix(in srgb,var(--dk-accent) 8%,transparent);padding:2px 8px;font-size:10px;white-space:pre;border-top:1px solid var(--dsw-alias-border-l1);border-bottom:1px solid var(--dsw-alias-border-l1);}",
18571
+ ".dkg-sd-row{display:flex;align-items:stretch;min-width:0;}",
18572
+ ".dkg-sd-line{flex:1 1 50%;min-width:0;display:flex;align-items:flex-start;border-right:1px solid var(--dsw-alias-border-l1);}",
18573
+ ".dkg-sd-line:last-child{border-right:none;}",
18574
+ ".dkg-sd-line.blank{background:color-mix(in srgb,var(--dsw-alias-label-tertiary) 6%,transparent);}",
18575
+ ".dkg-sd-line.add{background:color-mix(in srgb,var(--dsw-alias-state-success-primary) 12%,transparent);}",
18576
+ ".dkg-sd-line.del{background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 12%,transparent);}",
18577
+ ".dkg-sd-line.change{background:color-mix(in srgb,var(--dk-warn) 10%,transparent);}",
18578
+ ".dkg-sd-ln{flex:none;width:38px;text-align:right;padding-right:6px;color:var(--dsw-alias-label-tertiary);user-select:none;}",
18579
+ ".dkg-sd-code{flex:1;min-width:0;white-space:pre;overflow-x:auto;color:var(--dsw-alias-label-primary);padding-right:6px;}",
18580
+ // 单击预览的单文件卡
18581
+ // 单击预览:限高 + 内部滚动,避免把提交说明和按钮挤出去
18582
+ ".dkg-peek{border-top:1px solid var(--dsw-alias-border-l1);padding-top:6px;display:flex;flex-direction:column;gap:4px;min-height:0;flex:1 1 auto;overflow:hidden;}",
18583
+ ".dkg-peek-head{display:flex;align-items:center;gap:8px;font-size:11px;color:var(--dsw-alias-label-secondary);}",
18584
+ ".dkg-peek .dkg-diff{flex:1 1 auto;min-height:0;overflow:auto;max-height:none;}",
18585
+ ".dkg-wt-item.peek{outline:1px solid var(--dk-accent);outline-offset:-1px;}",
17271
18586
  ".dkg-preview{border-top:1px solid var(--dsw-alias-border-l1);padding-top:6px;display:flex;flex-direction:column;gap:5px;}",
17272
18587
  ".dkg-preview-head{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;color:var(--dsw-alias-label-primary);}",
17273
18588
  // 目录浏览器
@@ -17283,7 +18598,90 @@ var css6 = [
17283
18598
  ".dkg-picker-row{display:flex;align-items:center;gap:6px;width:100%;box-sizing:border-box;text-align:left;cursor:pointer;font-family:inherit;font-size:12px;color:var(--dsw-alias-label-primary);background:transparent;border:1px solid transparent;border-radius:6px;padding:3px 6px;min-width:0;}",
17284
18599
  ".dkg-picker-row:hover{background:var(--dsw-alias-interactive-bg-hover);border-color:var(--dsw-alias-border-l1);}",
17285
18600
  ".dkg-folder{flex:none;font-size:10px;color:var(--dk-warn);}",
17286
- ".dkg-picker-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;border-top:1px solid var(--dsw-alias-border-l1);padding-top:6px;}"
18601
+ ".dkg-picker-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;border-top:1px solid var(--dsw-alias-border-l1);padding-top:6px;}",
18602
+ // ---------- 手机端适配 ----------
18603
+ // 断点选 720px:抽屉面板在手机上大约 360-430 逻辑像素宽,
18604
+ // 而桌面侧栏最窄也有 300 左右——720 能覆盖「窄窗口」与「手机」两类场景。
18605
+ "@media (max-width:720px){",
18606
+ // 三栏全部纵向堆叠:横排在窄屏里每栏都只剩几十像素,没法用
18607
+ " .dkg-body,.dkg-compact .dkg-body{flex-direction:column;gap:4px;overflow:auto;}",
18608
+ " .dkg-wt{flex-direction:column;gap:4px;overflow:auto;}",
18609
+ " .dkg-wt-files,.dkg-wt-commit{flex:1 1 auto;min-height:0;}",
18610
+ " .dkg-mid{flex:1 1 auto;min-height:140px;}",
18611
+ " .dkg-detail{flex:1 1 auto;min-height:180px;}",
18612
+ // 分隔条在纵向堆叠里没有意义,还会占掉本就紧张的高度
18613
+ " .dkg-splitter-slot{display:none;}",
18614
+ // 仓库路径栏:输入框单独一行,按钮均分第二行
18615
+ " .dkg-bar{flex-wrap:wrap;gap:4px;}",
18616
+ " .dkg-bar>.dkg-input{flex:1 1 100%;}",
18617
+ " .dkg-bar>.dkg-btn{flex:1 1 0;}",
18618
+ // 标签栏:标题独占一行,页签与操作按钮换行
18619
+ " .dkg-tabbar{flex-wrap:wrap;gap:4px;}",
18620
+ " .dkg-tabbar>.dkg-repo-name{flex:1 1 100%;}",
18621
+ " .dkg-tabs{margin-left:0;flex:1 1 100%;}",
18622
+ " .dkg-tabbar>.dkg-btn{flex:1 1 0;min-width:0;}",
18623
+ // 触控目标:手机上的手指比鼠标指针粗得多,按钮与行都要加高
18624
+ " .dkg-btn,.dkg-tab,.dkg-icon-btn{padding:7px 10px;font-size:13px;}",
18625
+ " .dkg-tr{padding:8px 6px;font-size:13px;}",
18626
+ " .dkg-side-item{padding:6px;font-size:13px;}",
18627
+ " .dkg-wt-item{padding:8px 6px;}",
18628
+ " .dkg-wt-item .dkg-btn{padding:5px 8px;}",
18629
+ " .dkg-tree-row{padding-top:6px;padding-bottom:6px;}",
18630
+ // 提交表格只留分支图与说明:作者、日期、引用在手机上挤成一条线没法看
18631
+ " .dkg-thead>.dkg-th.author,.dkg-thead>.dkg-th.date,.dkg-thead>.dkg-th.refs,",
18632
+ " .dkg-tr>.dkg-td.author,.dkg-tr>.dkg-td.date,.dkg-tr>.dkg-td.refs{display:none;}",
18633
+ " .dkg-thead,.dkg-tr{grid-template-columns:12px minmax(0,1fr);}",
18634
+ // 并排差异在手机上宽度不够,改为单栏(只显示新版本,靠颜色区分增删)
18635
+ " .dkg-sd-head{display:none;}",
18636
+ " .dkg-sd-row{grid-template-columns:minmax(0,1fr);}",
18637
+ " .dkg-sd-line.blank{display:none;}",
18638
+ // 差异浮窗:全屏,否则在手机上只剩一条缝
18639
+ " .dkg-modal{left:0;top:0;width:100vw;height:100vh;max-width:none;max-height:none;border-radius:0;transform:none;}",
18640
+ " .dkg-modal.max{width:100vw;height:100vh;transform:none;left:0;top:0;}",
18641
+ " .dkg-modal-head{flex-wrap:wrap;gap:4px;padding:6px;}",
18642
+ " .dkg-modal-title{flex:1 1 100%;}",
18643
+ " .dkg-modal-modes,.dkg-modal-pick{flex:1 1 auto;}",
18644
+ " .dkg-modal-head>.dkg-btn{flex:1 1 0;}",
18645
+ // 拖拽调整大小在触屏上不好用,直接隐藏手柄
18646
+ " .dkg-rz{display:none;}",
18647
+ // 确认弹窗:全宽贴底,接近手机原生的弹层形态
18648
+ " .dkg-dlg{width:100vw;max-width:none;max-height:88vh;border-radius:12px 12px 0 0;}",
18649
+ " .dkg-dlg-mask{align-items:flex-end;padding:0;}",
18650
+ " .dkg-dlg-foot>.dkg-btn{flex:1 1 0;}",
18651
+ // 全文件双栏在窄屏放不下,改为上下两段
18652
+ " .dkg-ff-cols{flex-direction:column;}",
18653
+ " .dkg-ff-col{flex:none;border-right:none;border-bottom:1px solid var(--dsw-alias-border-l1);}",
18654
+ // 文件树与差异区并排改为上下
18655
+ " .dkg-detail-split{flex-direction:column;}",
18656
+ // 结果提示与错误:允许换行,别把按钮挤出去
18657
+ " .dkg-error,.dkg-ok{word-break:break-word;}",
18658
+ // 筛选条折叠:默认只露一个「筛选」按钮,展开才占高度
18659
+ " .dkg-toolbar-toggle{display:flex;gap:4px;flex:none;}",
18660
+ " .dkg-toolbar-toggle>.dkg-btn{flex:1 1 0;}",
18661
+ " .dkg-toolbar{display:none;flex-wrap:wrap;gap:4px;}",
18662
+ " .dkg-toolbar.open{display:flex;}",
18663
+ // 筛选条里的输入框各占半行,避免一行挤五个控件
18664
+ " .dkg-toolbar>.dkg-input,.dkg-toolbar>.dkg-select{flex:1 1 calc(50% - 4px);min-width:0;}",
18665
+ // 分支侧栏在手机上改横向滚动条,不占纵向高度
18666
+ " .dkg-side{max-height:none;overflow-x:auto;flex-wrap:nowrap;}",
18667
+ " .dkg-side-group{flex-wrap:nowrap;}",
18668
+ // 历史页两级导航:列表与详情互斥显示
18669
+ " .dkg-mobile-list .dkg-detail{display:none;}",
18670
+ " .dkg-mobile-detail .dkg-mid{display:none;}",
18671
+ " .dkg-mobile-detail .dkg-detail{display:flex;flex:1 1 auto;min-height:0;}",
18672
+ // 详情里返回按钮
18673
+ " .dkg-mobile-back{display:flex;}",
18674
+ // 操作按钮吸底:手机上滚到列表深处也能一键推送,不用先滚回顶部
18675
+ " .dkg-tabbar{position:sticky;bottom:0;background:var(--dsw-alias-bg-layer-1);z-index:5;border-top:1px solid var(--dsw-alias-border-l1);padding-top:5px;}",
18676
+ // 仓库路径与徽标在手机上占太多行,收紧
18677
+ " .dkg-repo-name{font-size:12px;}",
18678
+ " .dkg-badge{font-size:10px;}",
18679
+ // 提交行:说明占满,隐藏图形列的小方块避免挤压
18680
+ " .dkg-tr .dkg-graph{display:none;}",
18681
+ " .dkg-thead,.dkg-tr{grid-template-columns:minmax(0,1fr);}",
18682
+ "}",
18683
+ // 手机端返回按钮:桌面端不显示(两级导航只在窄屏生效)
18684
+ ".dkg-mobile-back{display:none;flex:none;}"
17287
18685
  ].join("\n");
17288
18686
  function serviceOf2(scope, name) {
17289
18687
  if (!scope) return void 0;
@@ -17528,7 +18926,7 @@ function GitHistoryIcon() {
17528
18926
  }
17529
18927
 
17530
18928
  // src/client.jsx
17531
- var DOCK_VERSION = "0.25.1";
18929
+ var DOCK_VERSION = "0.26.0";
17532
18930
  var BUILTIN_FEATURES = [feature, feature2, feature3, feature11, feature4, feature5, feature6, feature7, feature8, feature9, feature10, feature12];
17533
18931
  var PLANNED_FEATURES = [];
17534
18932
  var PLANNED_NOTES = {};