@chatcode/chatcode-cli 3.0.4-rc.1 → 3.0.4-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +2 -0
  3. package/README.zh.md +2 -0
  4. package/lib/{command-errors-BkCHTQHj.js → command-errors-BJ_ZWzUU.js} +12 -12
  5. package/lib/{command-trees-5HFyC5sI.js → command-trees-C9b7-bci.js} +2 -2
  6. package/lib/{component-identity-De91VHwW.js → component-identity-Jb1DYjke.js} +3 -3
  7. package/lib/{dist-CsDWUvQ4.js → dist-w_sIm4VD.js} +231 -231
  8. package/lib/{extension-events-CdYCRP0o.js → extension-events-DKX4LXOd.js} +26 -26
  9. package/lib/{frames-DOX-Jgk8.js → frames-B89znn_0.js} +4 -4
  10. package/lib/{host-access-Bk4xps5E.js → host-access-CMg6rsWt.js} +1 -1
  11. package/lib/{keymap-CJ1kvLR2.js → keymap-CrC4pSNH.js} +2 -2
  12. package/lib/{plugin-XR7ncbnW.js → plugin-CmyMCGfb.js} +1651 -1365
  13. package/lib/{scenes-CAmWncZD.js → scenes-Cil9RnwU.js} +3 -3
  14. package/lib/{settings-sections-CakcvBv9.js → settings-sections-jVCqXwdH.js} +3 -3
  15. package/lib/{statusBarSettings-BPPS_Usm.js → statusBarSettings-DNoBH3Cq.js} +3 -3
  16. package/lib/{supports-color-DyChQwlI.js → supports-color-CcW-FGjr.js} +2 -2
  17. package/lib/{themes-OjcUpZzw.js → themes-BdgeY3It.js} +12 -12
  18. package/lib/tui-compat-command-trees.js +1 -1
  19. package/lib/tui-compat-extensions.js +3 -3
  20. package/lib/tui-compat-plugin-host.js +5 -5
  21. package/lib/tui-compat-scenes.js +1 -1
  22. package/lib/tui-compat-settings-sections.js +1 -1
  23. package/lib/tui-compat-working-activity.js +4 -4
  24. package/lib/tui-compat-workspaces.js +1 -1
  25. package/lib/tui-compat.js +5 -5
  26. package/lib/{workspaces-XY7UdfXp.js → workspaces-DOatJRYr.js} +2 -2
  27. package/package.json +30 -29
  28. package/runtime/manifest.json +2 -2
  29. package/runtime/node_modules/@deepseek-ai/dsh-agent-default-model/lib/index.js +118 -22
  30. package/runtime/node_modules/@deepseek-ai/dsh-agent-default-model/lib/types/index.d.ts +20 -3
  31. package/runtime/node_modules/@deepseek-ai/dsh-api-remotes/lib/client.js +113 -39
  32. package/runtime/node_modules/@deepseek-ai/dsh-api-remotes/lib/index.js +4 -0
  33. package/runtime/node_modules/@deepseek-ai/dsh-api-remotes/lib/types/remote-events.d.ts +3 -0
  34. package/runtime/node_modules/@deepseek-ai/dsh-api-remotes/lib/types/remote-events.js +1 -0
  35. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/index.js +173 -34
  36. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/typert.host.js +48 -28
  37. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/typert.remote-client.js +24 -19
  38. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/agent.d.ts +9 -1
  39. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/agent.js +36 -6
  40. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/archived-session-gate.js +1 -1
  41. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/catalog.js +4 -1
  42. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/client/sessions/service.d.ts +1 -1
  43. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/commands.d.ts +2 -2
  44. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/commands.js +24 -8
  45. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/index.d.ts +4 -3
  46. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/index.js +31 -14
  47. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/list.d.ts +6 -0
  48. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/list.js +89 -4
  49. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/remote-events.d.ts +1 -1
  50. package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/types.d.ts +18 -1
  51. package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/client.js +30 -0
  52. package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/index.js +83 -2
  53. package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/typert.host.js +104 -11
  54. package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/typert.remote-client.d.ts +5 -1
  55. package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/typert.remote-client.js +78 -11
  56. package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/client/model.d.ts +14 -1
  57. package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/client/model.js +17 -0
  58. package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/client/service.d.ts +15 -0
  59. package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/client/service.js +12 -0
  60. package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/commands.d.ts +13 -1
  61. package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/commands.js +44 -2
  62. package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/index.d.ts +13 -1
  63. package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/index.js +22 -0
  64. package/runtime/node_modules/@deepseek-ai/dsh-api-workspace-controller/lib/types/types.d.ts +17 -0
  65. package/runtime/node_modules/@deepseek-ai/dsh-app-boot/lib/index.js +2 -1
  66. package/runtime/node_modules/@deepseek-ai/dsh-atomic-write/lib/index.js +167 -44
  67. package/runtime/node_modules/@deepseek-ai/dsh-atomic-write/lib/types/index.d.ts +14 -6
  68. package/runtime/node_modules/@deepseek-ai/dsh-atomic-write/lib/types/linux-lock.d.ts +18 -0
  69. package/runtime/node_modules/@deepseek-ai/dsh-atomic-write/lib/types/windows-lock.d.ts +7 -0
  70. package/runtime/node_modules/@deepseek-ai/dsh-client-hmr/lib/client.js +931 -7
  71. package/runtime/node_modules/@deepseek-ai/dsh-client-hmr/lib/index.js +57 -19
  72. package/runtime/node_modules/@deepseek-ai/dsh-client-hmr/lib/types/client/index.d.ts +5 -2
  73. package/runtime/node_modules/@deepseek-ai/dsh-client-hmr/lib/types/config.d.ts +12 -0
  74. package/runtime/node_modules/@deepseek-ai/dsh-client-hmr/lib/types/events.d.ts +4 -4
  75. package/runtime/node_modules/@deepseek-ai/dsh-client-hmr/lib/types/index.d.ts +3 -8
  76. package/runtime/node_modules/@deepseek-ai/dsh-client-hmr/package.json +6 -2
  77. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-commands/lib/client.js +10 -0
  78. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-deliverables/lib/types/client/present-open.d.ts +1 -1
  79. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/client.js +8 -4
  80. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-account/lib/client.js +2 -2
  81. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/client.js +1 -1
  82. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
  83. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/client.js +1917 -206
  84. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/ArchivedSessions.d.ts +13 -0
  85. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/contract/slots.d.ts +4 -0
  86. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/locales.d.ts +40 -0
  87. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/recent.d.ts +11 -0
  88. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/rows/RecentList.d.ts +15 -0
  89. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/rows/Rows.d.ts +6 -1
  90. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/session-actions/DeleteSession.d.ts +24 -0
  91. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/stores.d.ts +2 -2
  92. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/tree.d.ts +15 -13
  93. package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/package.json +3 -1
  94. package/runtime/node_modules/@deepseek-ai/dsh-commands/lib/index.js +16 -0
  95. package/runtime/node_modules/@deepseek-ai/dsh-commands/lib/typert.host.js +7 -3
  96. package/runtime/node_modules/@deepseek-ai/dsh-commands/lib/typert.remote-client.js +6 -2
  97. package/runtime/node_modules/@deepseek-ai/dsh-commands/lib/types/index.js +20 -0
  98. package/runtime/node_modules/@deepseek-ai/dsh-commands/lib/types/types.d.ts +5 -0
  99. package/runtime/node_modules/@deepseek-ai/dsh-cordis-client-runner/lib/client.js +5 -2
  100. package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/adapter.d.ts +1 -1
  101. package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/config.d.ts +3 -3
  102. package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek-account/lib/types/config.d.ts +2 -2
  103. package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek-api-key/lib/types/config.d.ts +2 -2
  104. package/runtime/node_modules/@deepseek-ai/dsh-schedule/lib/index.js +4 -0
  105. package/runtime/node_modules/@deepseek-ai/dsh-schedule/lib/typert.host.js +5 -5
  106. package/runtime/node_modules/@deepseek-ai/dsh-schedule/lib/typert.remote-client.js +5 -5
  107. package/runtime/node_modules/@deepseek-ai/dsh-schedule/lib/types/index.js +5 -0
  108. package/runtime/node_modules/@deepseek-ai/dsh-session/lib/types/index.d.ts +21 -0
  109. package/runtime/node_modules/@deepseek-ai/dsh-session-persistence/lib/index.js +12 -0
  110. package/runtime/node_modules/@deepseek-ai/dsh-session-persistence/lib/types/index.d.ts +15 -0
  111. package/runtime/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/lib/index.js +95 -2
  112. package/runtime/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/lib/types/index.d.ts +3 -1
  113. package/runtime/node_modules/@deepseek-ai/dsh-session-projection-cache/lib/index.js +25 -1
  114. package/runtime/node_modules/@deepseek-ai/dsh-session-projection-cache/lib/types/index.d.ts +1 -0
  115. package/runtime/node_modules/@deepseek-ai/dsh-session-projection-cache/package.json +2 -1
  116. package/runtime/node_modules/@deepseek-ai/dsh-session-query/lib/index.js +13 -0
  117. package/runtime/node_modules/@deepseek-ai/dsh-session-query/lib/types/observation.d.ts +5 -0
  118. package/runtime/node_modules/@deepseek-ai/dsh-session-query-sqlite/lib/index.js +26 -0
  119. package/runtime/node_modules/@deepseek-ai/dsh-session-query-sqlite/package.json +2 -1
  120. package/runtime/node_modules/@deepseek-ai/dsh-storage-domain/lib/index.js +5 -1
  121. package/runtime/node_modules/@deepseek-ai/dsh-storage-domain/lib/types/domain.d.ts +2 -2
  122. package/runtime/node_modules/@deepseek-ai/dsh-subagent/lib/types/control.d.ts +1 -1
  123. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/index.js +106 -56
  124. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/config.d.ts +2 -2
  125. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/index.d.ts +2 -1
  126. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/services/tianti/config.d.ts +4 -2
  127. package/runtime/node_modules/@deepseek-ai/dsh-tianti/lib/types/tools.d.ts +2 -2
  128. package/runtime/node_modules/@deepseek-ai/dsh-tianti/package.json +2 -0
  129. package/runtime/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/api-catalog.js +104 -13
  130. package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/index.js +215 -4
  131. package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/invariant.js +6 -1
  132. package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/types/index.d.ts +31 -0
  133. package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/types/index.js +219 -2
  134. package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/types/spec.d.ts +4 -0
  135. package/runtime/node_modules/@deepseek-ai/dsh-workspace/lib/types/spec.js +4 -0
  136. package/scripts/launch.mjs +8 -0
@@ -4,11 +4,35 @@ window.__ModuleLoader__.load({
4
4
  var module = { exports: {} };
5
5
  var exports = module.exports;
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
+ //#region \0rolldown/runtime.js
8
+ var __create = Object.create;
9
+ var __defProp = Object.defineProperty;
10
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11
+ var __getOwnPropNames = Object.getOwnPropertyNames;
12
+ var __getProtoOf = Object.getPrototypeOf;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
16
+ key = keys[i];
17
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
+ get: ((k) => from[k]).bind(null, key),
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
25
+ value: mod,
26
+ enumerable: true
27
+ }) : target, mod));
28
+ //#endregion
7
29
  let _deepseek_ai_dsh_client_store = require("@deepseek-ai/dsh-client-store");
8
30
  let _deepseek_ai_cordis = require("@deepseek-ai/cordis");
9
31
  let react_jsx_runtime = require("react/jsx-runtime");
10
32
  let react = require("react");
33
+ react = __toESM(react, 1);
11
34
  let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
35
+ let react_dom = require("react-dom");
12
36
  //#region lib/types/client/contract/slots.js
13
37
  /**
14
38
  * Bind the row's render occurrence into the entries' `useMenuOpenState` hook:
@@ -338,24 +362,14 @@ window.__ModuleLoader__.load({
338
362
  return result;
339
363
  }
340
364
  /**
341
- * Keep the selected provisional New Session ahead of either base order.
342
- * @param order - recency or reconciled manual order.
343
- * @param currentBlank - selected blank Session in this account, when present.
344
- * @returns a copy with the selected blank first and no duplicate slot.
345
- */
346
- function pinCurrentBlank(order, currentBlank) {
347
- if (currentBlank === void 0) return [...order];
348
- return [currentBlank, ...order.filter((id) => id !== currentBlank)];
349
- }
350
- /**
351
- * Ordinary sessions are visible; among blank sessions, only the current one
352
- * is visible. Subagent children use their parent header catalog; archived
365
+ * Sessions with user input are visible. Subagent children use their parent
366
+ * header catalog; archived
353
367
  * sessions follow the archived filter, while their accounting slots remain
354
368
  * either way so unarchiving restores position.
355
369
  */
356
- function sessionVisible(session, current, archived, archivedFilter) {
370
+ function sessionVisible(session, archived, archivedFilter) {
357
371
  if (session.origin === "subagent") return false;
358
- if (session.blank && session.id !== current) return false;
372
+ if (!hasConversation(session)) return false;
359
373
  switch (archivedFilter) {
360
374
  case "default": return !archived.has(session.id);
361
375
  case "show": return true;
@@ -364,6 +378,10 @@ window.__ModuleLoader__.load({
364
378
  default: return assertNever$1(archivedFilter);
365
379
  }
366
380
  }
381
+ /** Unknown historical summaries stay visible until the Host can classify them. */
382
+ function hasConversation(session) {
383
+ return session.projectionValues?.sessionListMetadata?.hasUserPrompt ?? !session.blank;
384
+ }
367
385
  /**
368
386
  * Keep the visible New Session placeholder first, then partition pinned and
369
387
  * ordinary rows without changing either partition's caller order.
@@ -382,12 +400,11 @@ window.__ModuleLoader__.load({
382
400
  ];
383
401
  }
384
402
  /**
385
- * A blank session is the selected Workspace's provisional New Session row;
386
- * its canonical title never enters search (blank rows are query-excluded)
387
- * and the renderer localizes its display label.
403
+ * Hidden empty Sessions contribute no title to search; queued human input
404
+ * uses its ordinary display title even before the first turn starts.
388
405
  */
389
406
  function sessionTitle(session) {
390
- return session.blank ? "" : session.displayTitle;
407
+ return hasConversation(session) ? session.displayTitle : "";
391
408
  }
392
409
  /** Build one group without projecting session lineage into presentation. */
393
410
  function buildGroup(key, workspaceId, cwd, createdAt, label, members) {
@@ -416,7 +433,6 @@ window.__ModuleLoader__.load({
416
433
  * recency before that order is initialized.
417
434
  */
418
435
  function groupByWorkspace(list, workspaces, archived, archivedFilter, ungroupedOrder) {
419
- const current = mainSessionId(list);
420
436
  const groups = [];
421
437
  const accounted = /* @__PURE__ */ new Set();
422
438
  for (const workspace of workspaces) {
@@ -425,13 +441,13 @@ window.__ModuleLoader__.load({
425
441
  const summary = list.byId[id];
426
442
  if (summary === void 0) continue;
427
443
  accounted.add(id);
428
- if (!sessionVisible(summary, current, archived, archivedFilter)) continue;
444
+ if (!sessionVisible(summary, archived, archivedFilter)) continue;
429
445
  members.push(summary);
430
446
  }
431
447
  if (archivedFilter === "only" && members.length === 0) continue;
432
448
  groups.push(buildGroup(workspace.workspaceId, workspace.workspaceId, workspace.path, Date.parse(workspace.createdAt), workspace.title, members));
433
449
  }
434
- const stray = list.ids.map((id) => list.byId[id]).filter((s) => s !== void 0 && !accounted.has(s.id) && sessionVisible(s, current, archived, archivedFilter));
450
+ const stray = list.ids.map((id) => list.byId[id]).filter((s) => s !== void 0 && !accounted.has(s.id) && sessionVisible(s, archived, archivedFilter));
435
451
  if (stray.length > 0) groups.push(buildGroup("", void 0, void 0, void 0, "", orderedUngrouped(stray, ungroupedOrder, list.byId)));
436
452
  return groups;
437
453
  }
@@ -453,7 +469,7 @@ window.__ModuleLoader__.load({
453
469
  return {
454
470
  id: s.id,
455
471
  title: sessionTitle(s),
456
- blank: s.blank,
472
+ blank: s.blank && !hasConversation(s),
457
473
  running: status?.running ?? s.running,
458
474
  runningSubagentCount: runningChildCount(list, s.id, statuses),
459
475
  completed: status?.completionUnread === true,
@@ -468,8 +484,8 @@ window.__ModuleLoader__.load({
468
484
  *
469
485
  * Every group shows, except that the archived-only filter drops groups
470
486
  * without visible members; sessions populate under expanded groups with
471
- * pinned rows leading in the selected local order. Blank sessions are
472
- * excluded except for the selected provisional New Session row; archived
487
+ * pinned rows leading in the selected local order. Sessions without user
488
+ * input are excluded, including the selected empty Session; archived
473
489
  * sessions keep their slots and appear per the archived filter. Content
474
490
  * search lives outside this derivation (see {@link deriveSearchResults}).
475
491
  * @param list - sessions list snapshot (`mainView` retention feeds containsCurrent).
@@ -505,7 +521,7 @@ window.__ModuleLoader__.load({
505
521
  /**
506
522
  * Select complete flat-list membership, independently of archive visibility.
507
523
  * @param list - sessions list snapshot.
508
- * @returns known ordinary Session ids, including archives and only the current blank.
524
+ * @returns known ordinary conversations, including archives but excluding empty Sessions.
509
525
  */
510
526
  function sessionMemberIds(list) {
511
527
  return visibleSessionIds(list, [], "show");
@@ -515,14 +531,13 @@ window.__ModuleLoader__.load({
515
531
  * @param list - sessions list snapshot.
516
532
  * @param archivedSessionIds - registry-global archive set.
517
533
  * @param archivedFilter - archived-row visibility choice.
518
- * @returns known visible Session ids in list order, including ordinary forks and only the current blank.
534
+ * @returns visible conversation ids in list order, including ordinary forks.
519
535
  */
520
536
  function visibleSessionIds(list, archivedSessionIds, archivedFilter) {
521
537
  const archived = new Set(archivedSessionIds);
522
- const current = mainSessionId(list);
523
538
  return list.ids.filter((id) => {
524
539
  const s = list.byId[id];
525
- return s !== void 0 && sessionVisible(s, current, archived, archivedFilter);
540
+ return s !== void 0 && sessionVisible(s, archived, archivedFilter);
526
541
  });
527
542
  }
528
543
  /**
@@ -537,13 +552,28 @@ window.__ModuleLoader__.load({
537
552
  function deriveFlat(list, sessionIds, rowState, statuses) {
538
553
  const archived = new Set(rowState.archivedSessionIds);
539
554
  const pinned = new Set(rowState.pinnedSessionIds);
540
- const current = mainSessionId(list);
541
555
  return sectionMembers(sessionIds.flatMap((id) => {
542
556
  const session = list.byId[id];
543
- return session !== void 0 && sessionVisible(session, current, archived, rowState.archivedFilter) ? [session] : [];
557
+ return session !== void 0 && sessionVisible(session, archived, rowState.archivedFilter) ? [session] : [];
544
558
  }), pinned, archived).map((session) => sessionNode(session, list, statuses, pinned, archived));
545
559
  }
546
560
  /**
561
+ * Project only mounted recent rows, preserving the supplied chronological order.
562
+ * @param list - metadata snapshot; no Session history is opened.
563
+ * @param sessionIds - the visible window of the recency projection.
564
+ * @param rowState - pin decoration and archive visibility.
565
+ * @param statuses - unified UI status by Session.
566
+ * @returns rows without moving pinned or archived members ahead of newer Sessions.
567
+ */
568
+ function deriveRecentRows(list, sessionIds, rowState, statuses) {
569
+ const archived = new Set(rowState.archivedSessionIds);
570
+ const pinned = new Set(rowState.pinnedSessionIds);
571
+ return sessionIds.flatMap((id) => {
572
+ const session = list.byId[id];
573
+ return session !== void 0 && sessionVisible(session, archived, rowState.archivedFilter) ? [sessionNode(session, list, statuses, pinned, archived)] : [];
574
+ });
575
+ }
576
+ /**
547
577
  * Merge immediate title/Workspace substring matches with ranked Host content
548
578
  * matches. Local rows lead newest-first, content-only rows retain backend
549
579
  * order, and duplicate sessions receive the backend snippet in place.
@@ -564,7 +594,6 @@ window.__ModuleLoader__.load({
564
594
  hasMore: false
565
595
  };
566
596
  const archived = new Set(archivedSessionIds);
567
- const current = mainSessionId(list);
568
597
  const workspaceBySession = /* @__PURE__ */ new Map();
569
598
  for (const workspace of workspaces) for (const sessionId of workspace.sessionIds) if (!workspaceBySession.has(sessionId)) workspaceBySession.set(sessionId, workspace.title);
570
599
  const labelOf = (summary) => workspaceBySession.get(summary.id) ?? workspaceLabel(summary.cwd);
@@ -573,7 +602,7 @@ window.__ModuleLoader__.load({
573
602
  const local = [];
574
603
  for (const id of list.ids) {
575
604
  const summary = list.byId[id];
576
- if (summary === void 0 || summary.blank || !sessionVisible(summary, current, archived, archivedFilter)) continue;
605
+ if (summary === void 0 || !sessionVisible(summary, archived, archivedFilter)) continue;
577
606
  if (sessionTitle(summary).toLowerCase().includes(q) || labelOf(summary).toLowerCase().includes(q)) local.push(summary);
578
607
  }
579
608
  const localById = new Map(local.map((summary) => [summary.id, summary]));
@@ -588,7 +617,7 @@ window.__ModuleLoader__.load({
588
617
  for (const summary of orderedLocal) include(summary);
589
618
  for (const item of content.items) {
590
619
  const summary = list.byId[item.sessionId];
591
- if (summary !== void 0 && !summary.blank && sessionVisible(summary, current, archived, archivedFilter)) include(summary);
620
+ if (summary !== void 0 && sessionVisible(summary, archived, archivedFilter)) include(summary);
592
621
  }
593
622
  return {
594
623
  items: ordered.slice(0, limit).map((summary) => {
@@ -1055,13 +1084,13 @@ window.__ModuleLoader__.load({
1055
1084
  }
1056
1085
  //#endregion
1057
1086
  //#region \0dsh-css:/Users/shiguifeng/IdeaProjects/chonggou/deepseek-harness/packages/client/ui-workspace/src/client/rows/Rows.module.css.mjs
1058
- const css$3 = ".JQKBIa_projectRow,.JQKBIa_sessionRow{border-radius:var(--dsw-radius-md);padding:0 8px;cursor:pointer;user-select:none;color:var(--dsw-alias-label-primary);align-items:center;gap:6px;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px));display:flex}.JQKBIa_projectRow:hover,.JQKBIa_sessionRow:hover,.JQKBIa_sessionRow.JQKBIa_selected{background:var(--dsw-alias-interactive-bg-hover)}.JQKBIa_searchResultRow{box-sizing:border-box;border-radius:var(--dsw-radius-lg);cursor:pointer;text-align:left;width:100%;min-height:48px;color:var(--dsw-alias-label-primary);background:0 0;border:none;flex-direction:column;align-items:stretch;padding:4px 8px;display:flex}.JQKBIa_searchResultRow:hover,.JQKBIa_searchResultRow.JQKBIa_selected{background:var(--dsw-alias-interactive-bg-hover)}.JQKBIa_searchResultHeading{align-items:center;min-width:0;display:flex}.JQKBIa_searchResultTitle{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;margin-left:4px;font-size:14px;line-height:20px;overflow:hidden}.JQKBIa_searchResultMeta{align-items:center;gap:6px;min-width:0;margin-left:20px;display:flex}.JQKBIa_searchResultWorkspace,.JQKBIa_searchResultSnippet{text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px;overflow:hidden}.JQKBIa_searchResultWorkspace{max-width:40%;color:var(--dsw-alias-label-tertiary);flex:none}.JQKBIa_searchResultWorkspace:only-child{max-width:100%}.JQKBIa_searchResultSnippet{min-width:0;color:var(--dsw-alias-label-secondary);flex:1}.JQKBIa_projectRow{box-sizing:border-box;align-items:center;height:34px}.JQKBIa_projectRow .JQKBIa_rowActions{height:20px}.JQKBIa_sessionRow{gap:0;height:32px}.JQKBIa_sessionRow .JQKBIa_title{margin:0 6px 0 4px}.JQKBIa_slot{width:16px;height:20px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;display:inline-flex}.JQKBIa_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.JQKBIa_folderActive{color:var(--dsw-alias-state-business-primary)}.JQKBIa_projectRow .JQKBIa_chevron{display:none}.JQKBIa_projectRow:hover .JQKBIa_chevron{display:inline-flex}.JQKBIa_projectRow:hover .JQKBIa_folder{display:none}.JQKBIa_arrow{transition:transform .15s var(--ds-ease-in-out)}.JQKBIa_arrowOpen{transform:rotate(90deg)}.JQKBIa_projectText{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.JQKBIa_title{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:14px;line-height:20px;overflow:hidden}.JQKBIa_renameInput{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-button-elevated-fill);min-width:0;color:inherit;outline:none;padding:0 2px;font-size:14px;line-height:20px}.JQKBIa_sessionRow .JQKBIa_title{flex:1}.JQKBIa_sessionRow .JQKBIa_title[data-scrolled]{mask-image:linear-gradient(90deg,#0000,#000 12px)}.JQKBIa_sessionRow .JQKBIa_title[data-clipped]{mask-image:linear-gradient(270deg,#0000,#000 12px)}.JQKBIa_sessionRow .JQKBIa_title[data-scrolled][data-clipped]{mask-image:linear-gradient(90deg,#0000,#000 12px calc(100% - 12px),#0000)}.JQKBIa_meta{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:20px;overflow:hidden}.JQKBIa_time{color:var(--dsw-alias-label-tertiary);flex:none;font-size:10px;line-height:16px}.JQKBIa_pinIndicator{width:16px;height:20px;color:var(--dsw-alias-label-caption);flex:none;justify-content:center;align-items:center;margin-left:6px;display:inline-flex}.JQKBIa_sessionRow.JQKBIa_archived .JQKBIa_title,.JQKBIa_searchResultRow.JQKBIa_archived .JQKBIa_searchResultTitle,.JQKBIa_searchResultRow.JQKBIa_archived .JQKBIa_searchResultWorkspace,.JQKBIa_searchResultRow.JQKBIa_archived .JQKBIa_searchResultSnippet{color:var(--dsw-alias-label-caption)}.JQKBIa_dot{flex:none}.JQKBIa_rowActions{flex:none;align-items:center;gap:10px;display:none}.JQKBIa_projectRow:hover .JQKBIa_rowActions,.JQKBIa_sessionRow:hover .JQKBIa_rowActions,.JQKBIa_searchResultRow:hover .JQKBIa_rowActions,.JQKBIa_projectRow.JQKBIa_menuOpen .JQKBIa_rowActions,.JQKBIa_sessionRow.JQKBIa_menuOpen .JQKBIa_rowActions{display:inline-flex}.JQKBIa_searchResultHeading .JQKBIa_rowActions{margin-left:auto}.JQKBIa_sessionRow:hover .JQKBIa_time,.JQKBIa_sessionRow.JQKBIa_menuOpen .JQKBIa_time,.JQKBIa_sessionRow:hover .JQKBIa_pinIndicator,.JQKBIa_sessionRow.JQKBIa_menuOpen .JQKBIa_pinIndicator{display:none}@media (hover:hover){.JQKBIa_sessionRow:hover .JQKBIa_title,.JQKBIa_sessionRow.JQKBIa_menuOpen .JQKBIa_title{text-overflow:clip}}.JQKBIa_projectRow.JQKBIa_menuOpen,.JQKBIa_sessionRow.JQKBIa_menuOpen{background:var(--dsw-alias-interactive-bg-hover)}.JQKBIa_sessionRow.JQKBIa_dropBefore,.JQKBIa_sessionRow.JQKBIa_dropAfter{position:relative}.JQKBIa_sessionRow.JQKBIa_dropBefore:before,.JQKBIa_sessionRow.JQKBIa_dropAfter:after{content:\"\";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:4px}.JQKBIa_sessionRow.JQKBIa_dropBefore:before{top:-7px}.JQKBIa_sessionRow.JQKBIa_dropAfter:after{bottom:-7px}.JQKBIa_hoverContent{flex-direction:column;gap:8px;display:flex}.JQKBIa_hoverTitle{color:#fff;overflow-wrap:break-word;font-size:14px;line-height:20px}.JQKBIa_hoverPath{color:#cfd3d6;word-break:break-all;font-size:12px;line-height:16px}.JQKBIa_hoverTime{color:#cfd3d6;font-size:12px;line-height:16px}.JQKBIa_hoverStatus{color:#adb2b8;align-items:center;gap:8px;font-size:12px;line-height:20px;display:flex}.JQKBIa_hoverArchived svg{flex-shrink:0;margin:0 -4px}.JQKBIa_iconButton{border-radius:var(--dsw-radius-xs);cursor:pointer;width:16px;height:16px;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.JQKBIa_iconButton:hover{color:var(--dsw-alias-label-primary)}.JQKBIa_chevron{color:var(--dsw-alias-label-caption)}@media (prefers-reduced-motion:reduce){.JQKBIa_arrow{transition:none;animation:none}}";
1059
- const tagId$3 = "@deepseek-ai/dsh-client-ui-workspace/Rows.module.css";
1060
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
1087
+ const css$4 = ".JQKBIa_projectRow,.JQKBIa_sessionRow{border-radius:var(--dsw-radius-md);padding:0 8px;cursor:pointer;user-select:none;color:var(--dsw-alias-label-primary);align-items:center;gap:6px;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px));display:flex}.JQKBIa_projectRow:hover,.JQKBIa_sessionRow:hover,.JQKBIa_sessionRow.JQKBIa_selected{background:var(--dsw-alias-interactive-bg-hover)}.JQKBIa_searchResultRow{box-sizing:border-box;border-radius:var(--dsw-radius-lg);cursor:pointer;text-align:left;width:100%;min-height:48px;color:var(--dsw-alias-label-primary);background:0 0;border:none;flex-direction:column;align-items:stretch;padding:4px 8px;display:flex}.JQKBIa_searchResultRow:hover,.JQKBIa_searchResultRow.JQKBIa_selected{background:var(--dsw-alias-interactive-bg-hover)}.JQKBIa_searchResultHeading{align-items:center;min-width:0;display:flex}.JQKBIa_searchResultTitle{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;margin-left:4px;font-size:14px;line-height:20px;overflow:hidden}.JQKBIa_searchResultMeta{align-items:center;gap:6px;min-width:0;margin-left:20px;display:flex}.JQKBIa_searchResultWorkspace,.JQKBIa_searchResultSnippet{text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px;overflow:hidden}.JQKBIa_searchResultWorkspace{max-width:40%;color:var(--dsw-alias-label-tertiary);flex:none}.JQKBIa_searchResultWorkspace:only-child{max-width:100%}.JQKBIa_searchResultSnippet{min-width:0;color:var(--dsw-alias-label-secondary);flex:1}.JQKBIa_projectRow{box-sizing:border-box;align-items:center;height:34px}.JQKBIa_projectRow .JQKBIa_rowActions{height:20px}.JQKBIa_sessionRow{gap:0;height:32px}.JQKBIa_sessionRow .JQKBIa_title{margin:0 6px 0 4px}.JQKBIa_slot{width:16px;height:20px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;display:inline-flex}.JQKBIa_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.JQKBIa_folderActive{color:var(--dsw-alias-state-business-primary)}.JQKBIa_projectRow .JQKBIa_chevron{display:none}.JQKBIa_projectRow:hover .JQKBIa_chevron{display:inline-flex}.JQKBIa_projectRow:hover .JQKBIa_folder{display:none}.JQKBIa_arrow{transition:transform .15s var(--ds-ease-in-out)}.JQKBIa_arrowOpen{transform:rotate(90deg)}.JQKBIa_projectText{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.JQKBIa_title{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:14px;line-height:20px;overflow:hidden}.JQKBIa_renameInput{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-button-elevated-fill);min-width:0;color:inherit;outline:none;padding:0 2px;font-size:14px;line-height:20px}.JQKBIa_sessionRow .JQKBIa_title{flex:1}.JQKBIa_sessionRow .JQKBIa_title[data-scrolled]{mask-image:linear-gradient(90deg,#0000,#000 12px)}.JQKBIa_sessionRow .JQKBIa_title[data-clipped]{mask-image:linear-gradient(270deg,#0000,#000 12px)}.JQKBIa_sessionRow .JQKBIa_title[data-scrolled][data-clipped]{mask-image:linear-gradient(90deg,#0000,#000 12px calc(100% - 12px),#0000)}.JQKBIa_meta{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:20px;overflow:hidden}.JQKBIa_time{color:var(--dsw-alias-label-tertiary);flex:none;font-size:10px;line-height:16px}.JQKBIa_pinIndicator{width:16px;height:20px;color:var(--dsw-alias-label-caption);flex:none;justify-content:center;align-items:center;margin-left:6px;display:inline-flex}.JQKBIa_sessionRow.JQKBIa_archived .JQKBIa_title,.JQKBIa_searchResultRow.JQKBIa_archived .JQKBIa_searchResultTitle,.JQKBIa_searchResultRow.JQKBIa_archived .JQKBIa_searchResultWorkspace,.JQKBIa_searchResultRow.JQKBIa_archived .JQKBIa_searchResultSnippet{color:var(--dsw-alias-label-caption)}.JQKBIa_dot{flex:none}.JQKBIa_rowActions{flex:none;align-items:center;gap:10px;display:none}.JQKBIa_projectRow:hover .JQKBIa_rowActions,.JQKBIa_sessionRow:hover .JQKBIa_rowActions,.JQKBIa_searchResultRow:hover .JQKBIa_rowActions,.JQKBIa_projectRow.JQKBIa_menuOpen .JQKBIa_rowActions,.JQKBIa_sessionRow.JQKBIa_menuOpen .JQKBIa_rowActions{display:inline-flex}.JQKBIa_searchResultHeading .JQKBIa_rowActions{margin-left:auto}.JQKBIa_sessionRow:hover .JQKBIa_time,.JQKBIa_sessionRow.JQKBIa_menuOpen .JQKBIa_time,.JQKBIa_sessionRow:hover .JQKBIa_pinIndicator,.JQKBIa_sessionRow.JQKBIa_menuOpen .JQKBIa_pinIndicator{display:none}@media (hover:hover){.JQKBIa_sessionRow:hover .JQKBIa_title,.JQKBIa_sessionRow.JQKBIa_menuOpen .JQKBIa_title{text-overflow:clip}}.JQKBIa_projectRow.JQKBIa_menuOpen,.JQKBIa_sessionRow.JQKBIa_menuOpen{background:var(--dsw-alias-interactive-bg-hover)}.JQKBIa_sessionRow.JQKBIa_dropBefore,.JQKBIa_sessionRow.JQKBIa_dropAfter{position:relative}.JQKBIa_sessionRow.JQKBIa_dropBefore:before,.JQKBIa_sessionRow.JQKBIa_dropAfter:after{content:\"\";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:4px}.JQKBIa_sessionRow.JQKBIa_dropBefore:before{top:-7px}.JQKBIa_sessionRow.JQKBIa_dropAfter:after{bottom:-7px}.JQKBIa_hoverContent{flex-direction:column;gap:8px;display:flex}.JQKBIa_hoverTitle{color:#fff;overflow-wrap:break-word;font-size:14px;line-height:20px}.JQKBIa_hoverPath{color:#cfd3d6;word-break:break-all;font-size:12px;line-height:16px}.JQKBIa_hoverTime{color:#cfd3d6;font-size:12px;line-height:16px}.JQKBIa_hoverStatus{color:#adb2b8;align-items:center;gap:8px;font-size:12px;line-height:20px;display:flex}.JQKBIa_hoverArchived svg{flex-shrink:0;margin:0 -4px}.JQKBIa_iconButton{border-radius:var(--dsw-radius-xs);cursor:pointer;width:16px;height:16px;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.JQKBIa_iconButton:hover{color:var(--dsw-alias-label-primary)}.JQKBIa_chevron{color:var(--dsw-alias-label-caption)}@media (prefers-reduced-motion:reduce){.JQKBIa_arrow{transition:none;animation:none}}";
1088
+ const tagId$4 = "@deepseek-ai/dsh-client-ui-workspace/Rows.module.css";
1089
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$4) + "]") === null) {
1061
1090
  const tag = document.createElement("style");
1062
1091
  tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-workspace";
1063
- tag.dataset.pluginCss = tagId$3;
1064
- tag.textContent = css$3;
1092
+ tag.dataset.pluginCss = tagId$4;
1093
+ tag.textContent = css$4;
1065
1094
  document.head.appendChild(tag);
1066
1095
  }
1067
1096
  var Rows_module_css_default = {
@@ -1565,7 +1594,7 @@ window.__ModuleLoader__.load({
1565
1594
  * @param props.t - the browser root's locale seat.
1566
1595
  * @returns the session row.
1567
1596
  */
1568
- function SessionNodeItem({ node, currentId, now, onOpen, onRenameRequest, renderSlot, onReveal, drag, t }) {
1597
+ function SessionNodeItem({ node, currentId, now, onOpen, onRenameRequest, renderSlot, onReveal, drag, position, t }) {
1569
1598
  const row = node;
1570
1599
  const title = displayTitle(node, t);
1571
1600
  const selected = node.id === currentId;
@@ -1591,6 +1620,14 @@ window.__ModuleLoader__.load({
1591
1620
  role: "treeitem",
1592
1621
  "aria-selected": selected,
1593
1622
  "aria-description": row.archived ? t("toast.archivedNotOpenable") : void 0,
1623
+ "aria-posinset": position === void 0 ? void 0 : position.index + 1,
1624
+ "aria-setsize": position?.total,
1625
+ tabIndex: position === void 0 ? void 0 : 0,
1626
+ onKeyDown: position === void 0 ? void 0 : (event) => {
1627
+ if (event.target !== event.currentTarget || event.key !== "Enter" && event.key !== " ") return;
1628
+ event.preventDefault();
1629
+ onOpen(node.id);
1630
+ },
1594
1631
  onClick: () => {
1595
1632
  onOpen(node.id);
1596
1633
  },
@@ -1681,13 +1718,13 @@ window.__ModuleLoader__.load({
1681
1718
  }
1682
1719
  //#endregion
1683
1720
  //#region \0dsh-css:/Users/shiguifeng/IdeaProjects/chonggou/deepseek-harness/packages/client/ui-workspace/src/client/rows/AnimatedRows.module.css.mjs
1684
- const css$2 = ".rducLq_exits{contain:strict;pointer-events:none;position:absolute;inset:0;overflow:clip}";
1685
- const tagId$2 = "@deepseek-ai/dsh-client-ui-workspace/AnimatedRows.module.css";
1686
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
1721
+ const css$3 = ".rducLq_exits{contain:strict;pointer-events:none;position:absolute;inset:0;overflow:clip}";
1722
+ const tagId$3 = "@deepseek-ai/dsh-client-ui-workspace/AnimatedRows.module.css";
1723
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
1687
1724
  const tag = document.createElement("style");
1688
1725
  tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-workspace";
1689
- tag.dataset.pluginCss = tagId$2;
1690
- tag.textContent = css$2;
1726
+ tag.dataset.pluginCss = tagId$3;
1727
+ tag.textContent = css$3;
1691
1728
  document.head.appendChild(tag);
1692
1729
  }
1693
1730
  var AnimatedRows_module_css_default = { "exits": "rducLq_exits" };
@@ -1840,21 +1877,1397 @@ window.__ModuleLoader__.load({
1840
1877
  ref: this.list,
1841
1878
  className: this.props.className,
1842
1879
  role: "tree",
1843
- "aria-label": this.props.label,
1844
- onPointerDownCapture: () => {
1845
- this.armed = true;
1846
- },
1847
- onKeyDownCapture: () => {
1848
- this.armed = true;
1880
+ "aria-label": this.props.label,
1881
+ onPointerDownCapture: () => {
1882
+ this.armed = true;
1883
+ },
1884
+ onKeyDownCapture: () => {
1885
+ this.armed = true;
1886
+ },
1887
+ children: this.props.children
1888
+ }), (0, react_jsx_runtime.jsx)("div", {
1889
+ ref: this.overlay,
1890
+ className: AnimatedRows_module_css_default.exits,
1891
+ "aria-hidden": "true"
1892
+ })] });
1893
+ }
1894
+ };
1895
+ //#endregion
1896
+ //#region ../../../node_modules/.pnpm/@tanstack+virtual-core@3.17.7/node_modules/@tanstack/virtual-core/dist/esm/lazy-measurements.js
1897
+ function createLazyMeasurementsView(count, flat, getItemKey) {
1898
+ const cache = new Array(count);
1899
+ return new Proxy(cache, { get(target, prop, receiver) {
1900
+ if (typeof prop === "string") {
1901
+ const c = prop.charCodeAt(0);
1902
+ if (c >= 48 && c <= 57) {
1903
+ const i = +prop;
1904
+ if (Number.isInteger(i) && i >= 0 && i < count) {
1905
+ let v = target[i];
1906
+ if (!v) {
1907
+ const s = flat[i * 2];
1908
+ v = target[i] = {
1909
+ index: i,
1910
+ key: getItemKey(i),
1911
+ start: s,
1912
+ size: flat[i * 2 + 1],
1913
+ end: s + flat[i * 2 + 1],
1914
+ lane: 0
1915
+ };
1916
+ }
1917
+ return v;
1918
+ }
1919
+ }
1920
+ if (prop === "length") return count;
1921
+ }
1922
+ return Reflect.get(target, prop, receiver);
1923
+ } });
1924
+ }
1925
+ //#endregion
1926
+ //#region ../../../node_modules/.pnpm/@tanstack+virtual-core@3.17.7/node_modules/@tanstack/virtual-core/dist/esm/utils.js
1927
+ function memo(getDeps, fn, opts) {
1928
+ let deps = opts.initialDeps ?? [];
1929
+ let result;
1930
+ let isInitial = true;
1931
+ function memoizedFunction() {
1932
+ const newDeps = getDeps();
1933
+ if (!(newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep))) return result;
1934
+ deps = newDeps;
1935
+ result = fn(...newDeps);
1936
+ if ((opts == null ? void 0 : opts.onChange) && !(isInitial && opts.skipInitialOnChange)) opts.onChange(result);
1937
+ isInitial = false;
1938
+ return result;
1939
+ }
1940
+ memoizedFunction.updateDeps = (newDeps) => {
1941
+ deps = newDeps;
1942
+ };
1943
+ return memoizedFunction;
1944
+ }
1945
+ function notUndefined(value, msg) {
1946
+ if (value === void 0) throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ""}`);
1947
+ else return value;
1948
+ }
1949
+ const approxEqual = (a, b) => Math.abs(a - b) < 1.01;
1950
+ const debounce = (targetWindow, fn, ms) => {
1951
+ let timeoutId;
1952
+ return function(...args) {
1953
+ targetWindow.clearTimeout(timeoutId);
1954
+ timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
1955
+ };
1956
+ };
1957
+ //#endregion
1958
+ //#region ../../../node_modules/.pnpm/@tanstack+virtual-core@3.17.7/node_modules/@tanstack/virtual-core/dist/esm/index.js
1959
+ let _isIOSResult;
1960
+ const isIOSWebKit = () => {
1961
+ if (_isIOSResult !== void 0) return _isIOSResult;
1962
+ if (typeof navigator === "undefined") return _isIOSResult = false;
1963
+ if (/iP(hone|od|ad)/.test(navigator.userAgent)) return _isIOSResult = true;
1964
+ const mtp = navigator.maxTouchPoints;
1965
+ return _isIOSResult = navigator.platform === "MacIntel" && mtp !== void 0 && mtp > 0;
1966
+ };
1967
+ const getRect = (element) => {
1968
+ const { offsetWidth, offsetHeight } = element;
1969
+ return {
1970
+ width: offsetWidth,
1971
+ height: offsetHeight
1972
+ };
1973
+ };
1974
+ const defaultKeyExtractor = (index) => index;
1975
+ const defaultRangeExtractor = (range) => {
1976
+ const start = Math.max(range.startIndex - range.overscan, 0);
1977
+ const len = Math.min(range.endIndex + range.overscan, range.count - 1) - start + 1;
1978
+ const arr = new Array(len);
1979
+ for (let i = 0; i < len; i++) arr[i] = start + i;
1980
+ return arr;
1981
+ };
1982
+ const observeElementRect = (instance, cb) => {
1983
+ const element = instance.scrollElement;
1984
+ if (!element) return;
1985
+ const targetWindow = instance.targetWindow;
1986
+ if (!targetWindow) return;
1987
+ const handler = (rect) => {
1988
+ const { width, height } = rect;
1989
+ cb({
1990
+ width: Math.round(width),
1991
+ height: Math.round(height)
1992
+ });
1993
+ };
1994
+ handler(getRect(element));
1995
+ if (!targetWindow.ResizeObserver) return () => {};
1996
+ const observer = new targetWindow.ResizeObserver((entries) => {
1997
+ const run = () => {
1998
+ const entry = entries[0];
1999
+ if (entry == null ? void 0 : entry.borderBoxSize) {
2000
+ const box = entry.borderBoxSize[0];
2001
+ if (box) {
2002
+ handler({
2003
+ width: box.inlineSize,
2004
+ height: box.blockSize
2005
+ });
2006
+ return;
2007
+ }
2008
+ }
2009
+ handler(getRect(element));
2010
+ };
2011
+ instance.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
2012
+ });
2013
+ observer.observe(element, { box: "border-box" });
2014
+ return () => {
2015
+ observer.unobserve(element);
2016
+ };
2017
+ };
2018
+ const addEventListenerOptions = { passive: true };
2019
+ const supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
2020
+ const observeOffset = (instance, cb, readOffset) => {
2021
+ const element = instance.scrollElement;
2022
+ if (!element) return;
2023
+ const targetWindow = instance.targetWindow;
2024
+ if (!targetWindow) return;
2025
+ const registerScrollendEvent = instance.options.useScrollendEvent && supportsScrollend;
2026
+ let offset = 0;
2027
+ const fallback = registerScrollendEvent ? null : debounce(targetWindow, () => cb(offset, false), instance.options.isScrollingResetDelay);
2028
+ const createHandler = (isScrolling) => () => {
2029
+ offset = readOffset(element);
2030
+ fallback?.();
2031
+ cb(offset, isScrolling);
2032
+ };
2033
+ const handler = createHandler(true);
2034
+ const endHandler = createHandler(false);
2035
+ element.addEventListener("scroll", handler, addEventListenerOptions);
2036
+ if (registerScrollendEvent) element.addEventListener("scrollend", endHandler, addEventListenerOptions);
2037
+ return () => {
2038
+ element.removeEventListener("scroll", handler);
2039
+ if (registerScrollendEvent) element.removeEventListener("scrollend", endHandler);
2040
+ };
2041
+ };
2042
+ const observeElementOffset = (instance, cb) => observeOffset(instance, cb, (el) => {
2043
+ const { horizontal, isRtl } = instance.options;
2044
+ return horizontal ? el.scrollLeft * (isRtl && -1 || 1) : el.scrollTop;
2045
+ });
2046
+ const measureElement = (element, entry, instance) => {
2047
+ if (instance.options.useCachedMeasurements) {
2048
+ const index = instance.indexFromElement(element);
2049
+ const key = instance.options.getItemKey(index);
2050
+ return instance.itemSizeCache.get(key) ?? instance.options.estimateSize(index);
2051
+ }
2052
+ if (entry == null ? void 0 : entry.borderBoxSize) {
2053
+ const box = entry.borderBoxSize[0];
2054
+ if (box) return Math.round(box[instance.options.horizontal ? "inlineSize" : "blockSize"]);
2055
+ }
2056
+ if (!entry) {
2057
+ const index = instance.indexFromElement(element);
2058
+ const key = instance.options.getItemKey(index);
2059
+ const cachedSize = instance.itemSizeCache.get(key);
2060
+ if (cachedSize !== void 0) return cachedSize;
2061
+ }
2062
+ return element[instance.options.horizontal ? "offsetWidth" : "offsetHeight"];
2063
+ };
2064
+ const scrollWithAdjustments = (offset, { adjustments = 0, behavior }, instance) => {
2065
+ var _a, _b;
2066
+ (_b = (_a = instance.scrollElement) == null ? void 0 : _a.scrollTo) == null || _b.call(_a, {
2067
+ [instance.options.horizontal ? "left" : "top"]: offset + adjustments,
2068
+ behavior
2069
+ });
2070
+ };
2071
+ const elementScroll = scrollWithAdjustments;
2072
+ var Virtualizer = class {
2073
+ constructor(opts) {
2074
+ this.unsubs = [];
2075
+ this.scrollElement = null;
2076
+ this.targetWindow = null;
2077
+ this.isScrolling = false;
2078
+ this.scrollState = null;
2079
+ this.measurementsCache = [];
2080
+ this._flatMeasurements = null;
2081
+ this.itemSizeCache = /* @__PURE__ */ new Map();
2082
+ this.itemSizeCacheVersion = 0;
2083
+ this.laneAssignments = /* @__PURE__ */ new Map();
2084
+ this.pendingMin = null;
2085
+ this.prevLanes = void 0;
2086
+ this.lanesChangedFlag = false;
2087
+ this.lanesSettling = false;
2088
+ this.pendingScrollAnchor = null;
2089
+ this.scrollRect = null;
2090
+ this.scrollOffset = null;
2091
+ this.scrollDirection = null;
2092
+ this.scrollAdjustments = 0;
2093
+ this._iosDeferredAdjustment = 0;
2094
+ this._iosTouching = false;
2095
+ this._iosJustTouchEnded = false;
2096
+ this._iosTouchEndTimerId = null;
2097
+ this._intendedScrollOffset = null;
2098
+ this.elementsCache = /* @__PURE__ */ new Map();
2099
+ this.now = () => {
2100
+ var _a, _b, _c;
2101
+ return ((_c = (_b = (_a = this.targetWindow) == null ? void 0 : _a.performance) == null ? void 0 : _b.now) == null ? void 0 : _c.call(_b)) ?? Date.now();
2102
+ };
2103
+ this.observer = /* @__PURE__ */ (() => {
2104
+ let _ro = null;
2105
+ const get = () => {
2106
+ if (_ro) return _ro;
2107
+ if (!this.targetWindow || !this.targetWindow.ResizeObserver) return null;
2108
+ return _ro = new this.targetWindow.ResizeObserver((entries) => {
2109
+ entries.forEach((entry) => {
2110
+ const run = () => {
2111
+ const node = entry.target;
2112
+ const index = this.indexFromElement(node);
2113
+ if (!node.isConnected) {
2114
+ this.observer.unobserve(node);
2115
+ for (const [cacheKey, cachedNode] of this.elementsCache) if (cachedNode === node) {
2116
+ this.elementsCache.delete(cacheKey);
2117
+ break;
2118
+ }
2119
+ return;
2120
+ }
2121
+ if (this.shouldMeasureDuringScroll(index)) this.resizeItem(index, this.options.measureElement(node, entry, this));
2122
+ };
2123
+ this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
2124
+ });
2125
+ });
2126
+ };
2127
+ return {
2128
+ disconnect: () => {
2129
+ var _a;
2130
+ (_a = get()) == null || _a.disconnect();
2131
+ _ro = null;
2132
+ },
2133
+ observe: (target) => {
2134
+ var _a;
2135
+ return (_a = get()) == null ? void 0 : _a.observe(target, { box: "border-box" });
2136
+ },
2137
+ unobserve: (target) => {
2138
+ var _a;
2139
+ return (_a = get()) == null ? void 0 : _a.unobserve(target);
2140
+ }
2141
+ };
2142
+ })();
2143
+ this.range = null;
2144
+ this.setOptions = (opts2) => {
2145
+ var _a, _b;
2146
+ const merged = {
2147
+ debug: false,
2148
+ initialOffset: 0,
2149
+ overscan: 1,
2150
+ paddingStart: 0,
2151
+ paddingEnd: 0,
2152
+ scrollPaddingStart: 0,
2153
+ scrollPaddingEnd: 0,
2154
+ horizontal: false,
2155
+ getItemKey: defaultKeyExtractor,
2156
+ rangeExtractor: defaultRangeExtractor,
2157
+ onChange: () => {},
2158
+ measureElement,
2159
+ initialRect: {
2160
+ width: 0,
2161
+ height: 0
2162
+ },
2163
+ scrollMargin: 0,
2164
+ gap: 0,
2165
+ indexAttribute: "data-index",
2166
+ initialMeasurementsCache: [],
2167
+ lanes: 1,
2168
+ anchorTo: "start",
2169
+ followOnAppend: false,
2170
+ scrollEndThreshold: 1,
2171
+ isScrollingResetDelay: 150,
2172
+ enabled: true,
2173
+ isRtl: false,
2174
+ useScrollendEvent: false,
2175
+ useAnimationFrameWithResizeObserver: false,
2176
+ laneAssignmentMode: "estimate",
2177
+ useCachedMeasurements: false
2178
+ };
2179
+ for (const key in opts2) {
2180
+ const v = opts2[key];
2181
+ if (v !== void 0) merged[key] = v;
2182
+ }
2183
+ const prevOptions = this.options;
2184
+ let anchor = null;
2185
+ let followOnAppend = null;
2186
+ let edgeKeysChanged = false;
2187
+ if (prevOptions !== void 0 && prevOptions.enabled && merged.enabled && merged.anchorTo === "end" && this.scrollElement !== null) {
2188
+ const prevCount = prevOptions.count;
2189
+ const nextCount = merged.count;
2190
+ const measurements = this.getMeasurements();
2191
+ const prevFirstKey = prevCount > 0 ? ((_a = measurements[0]) == null ? void 0 : _a.key) ?? prevOptions.getItemKey(0) : null;
2192
+ const prevLastKey = prevCount > 0 ? ((_b = measurements[prevCount - 1]) == null ? void 0 : _b.key) ?? prevOptions.getItemKey(prevCount - 1) : null;
2193
+ if (nextCount !== prevCount || prevCount > 0 && nextCount > 0 && (merged.getItemKey(0) !== prevFirstKey || merged.getItemKey(nextCount - 1) !== prevLastKey)) {
2194
+ edgeKeysChanged = true;
2195
+ const item = prevCount > 0 ? this.getVirtualItemForOffset(this.getScrollOffset()) ?? measurements[0] : null;
2196
+ if (item) anchor = [item.key, this.getScrollOffset() - item.start];
2197
+ const behavior = merged.followOnAppend === true ? "auto" : merged.followOnAppend || null;
2198
+ if (behavior && nextCount > prevCount && this.isAtEnd(prevOptions.scrollEndThreshold) && (prevCount === 0 || merged.getItemKey(nextCount - 1) !== prevLastKey)) followOnAppend = behavior;
2199
+ }
2200
+ }
2201
+ this.options = merged;
2202
+ if (edgeKeysChanged) {
2203
+ this.pendingMin = 0;
2204
+ this.itemSizeCacheVersion++;
2205
+ }
2206
+ let anchorResolved = false;
2207
+ let anchorDelta = 0;
2208
+ if (anchor && this.scrollOffset !== null) {
2209
+ const [anchorKey, anchorOffset] = anchor;
2210
+ const newMeasurements = this.getMeasurements();
2211
+ const { count, getItemKey } = this.options;
2212
+ let idx = 0;
2213
+ while (idx < count && getItemKey(idx) !== anchorKey) idx++;
2214
+ if (idx < count) {
2215
+ const anchorItem = newMeasurements[idx];
2216
+ if (anchorItem) {
2217
+ const newOffset = Math.max(0, anchorItem.start + anchorOffset);
2218
+ if (newOffset !== this.scrollOffset) {
2219
+ anchorDelta = newOffset - this.scrollOffset;
2220
+ this.scrollOffset = newOffset;
2221
+ anchorResolved = true;
2222
+ }
2223
+ }
2224
+ }
2225
+ }
2226
+ if (anchorResolved || followOnAppend) this.pendingScrollAnchor = [
2227
+ anchorResolved ? anchor[0] : null,
2228
+ anchorResolved ? anchor[1] : 0,
2229
+ followOnAppend,
2230
+ anchorDelta
2231
+ ];
2232
+ };
2233
+ this.notify = (sync) => {
2234
+ var _a, _b;
2235
+ (_b = (_a = this.options).onChange) == null || _b.call(_a, this, sync);
2236
+ };
2237
+ this.maybeNotify = memo(() => {
2238
+ this.calculateRange();
2239
+ return [
2240
+ this.isScrolling,
2241
+ this.range ? this.range.startIndex : null,
2242
+ this.range ? this.range.endIndex : null
2243
+ ];
2244
+ }, (isScrolling) => {
2245
+ this.notify(isScrolling);
2246
+ }, {
2247
+ key: false,
2248
+ debug: () => this.options.debug,
2249
+ initialDeps: [
2250
+ this.isScrolling,
2251
+ this.range ? this.range.startIndex : null,
2252
+ this.range ? this.range.endIndex : null
2253
+ ]
2254
+ });
2255
+ this.cleanup = () => {
2256
+ this.unsubs.filter(Boolean).forEach((d) => d());
2257
+ this.unsubs = [];
2258
+ this.observer.disconnect();
2259
+ if (this.rafId != null && this.targetWindow) {
2260
+ this.targetWindow.cancelAnimationFrame(this.rafId);
2261
+ this.rafId = null;
2262
+ }
2263
+ this.scrollState = null;
2264
+ this._iosDeferredAdjustment = 0;
2265
+ this._iosTouching = false;
2266
+ this._iosJustTouchEnded = false;
2267
+ this.scrollElement = null;
2268
+ this.targetWindow = null;
2269
+ };
2270
+ this._didMount = () => {
2271
+ return () => {
2272
+ this.cleanup();
2273
+ };
2274
+ };
2275
+ this._willUpdate = () => {
2276
+ var _a;
2277
+ const scrollElement = this.options.enabled ? this.options.getScrollElement() : null;
2278
+ if (this.scrollElement !== scrollElement) {
2279
+ this.cleanup();
2280
+ if (!scrollElement) {
2281
+ this.maybeNotify();
2282
+ return;
2283
+ }
2284
+ this.scrollElement = scrollElement;
2285
+ if (this.scrollElement && "ownerDocument" in this.scrollElement) this.targetWindow = this.scrollElement.ownerDocument.defaultView;
2286
+ else this.targetWindow = ((_a = this.scrollElement) == null ? void 0 : _a.window) ?? null;
2287
+ this.elementsCache.forEach((cached) => {
2288
+ this.observer.observe(cached);
2289
+ });
2290
+ this.unsubs.push(this.options.observeElementRect(this, (rect) => {
2291
+ this.scrollRect = rect;
2292
+ this.maybeNotify();
2293
+ }));
2294
+ this.unsubs.push(this.options.observeElementOffset(this, (offset, isScrolling) => {
2295
+ if (isScrolling && this._intendedScrollOffset === null && offset === this.scrollOffset) return;
2296
+ if (this._intendedScrollOffset !== null && Math.abs(offset - this._intendedScrollOffset) < 1.5) offset = this._intendedScrollOffset;
2297
+ this._intendedScrollOffset = null;
2298
+ this.scrollAdjustments = 0;
2299
+ const prevOffset = this.getScrollOffset();
2300
+ this.scrollDirection = isScrolling ? prevOffset === offset ? this.scrollDirection : prevOffset < offset ? "forward" : "backward" : null;
2301
+ this.scrollOffset = offset;
2302
+ this.isScrolling = isScrolling;
2303
+ this._flushIosDeferredIfReady();
2304
+ if (this.scrollState) this.scheduleScrollReconcile();
2305
+ this.maybeNotify();
2306
+ }));
2307
+ if ("addEventListener" in this.scrollElement) {
2308
+ const scrollEl = this.scrollElement;
2309
+ const onTouchStart = () => {
2310
+ this._iosTouching = true;
2311
+ this._iosJustTouchEnded = false;
2312
+ if (this._iosTouchEndTimerId !== null && this.targetWindow != null) {
2313
+ this.targetWindow.clearTimeout(this._iosTouchEndTimerId);
2314
+ this._iosTouchEndTimerId = null;
2315
+ }
2316
+ };
2317
+ const onTouchEnd = () => {
2318
+ this._iosTouching = false;
2319
+ if (!isIOSWebKit() || this.targetWindow == null) return;
2320
+ this._iosJustTouchEnded = true;
2321
+ this._iosTouchEndTimerId = this.targetWindow.setTimeout(() => {
2322
+ this._iosJustTouchEnded = false;
2323
+ this._iosTouchEndTimerId = null;
2324
+ this._flushIosDeferredIfReady();
2325
+ }, 150);
2326
+ };
2327
+ scrollEl.addEventListener("touchstart", onTouchStart, addEventListenerOptions);
2328
+ scrollEl.addEventListener("touchend", onTouchEnd, addEventListenerOptions);
2329
+ this.unsubs.push(() => {
2330
+ scrollEl.removeEventListener("touchstart", onTouchStart);
2331
+ scrollEl.removeEventListener("touchend", onTouchEnd);
2332
+ if (this._iosTouchEndTimerId !== null && this.targetWindow != null) {
2333
+ this.targetWindow.clearTimeout(this._iosTouchEndTimerId);
2334
+ this._iosTouchEndTimerId = null;
2335
+ }
2336
+ });
2337
+ }
2338
+ this._scrollToOffset(this.getScrollOffset(), {
2339
+ adjustments: void 0,
2340
+ behavior: void 0
2341
+ });
2342
+ }
2343
+ const anchor = this.pendingScrollAnchor;
2344
+ this.pendingScrollAnchor = null;
2345
+ if (anchor && this.scrollElement && this.options.enabled) {
2346
+ const [key, _offset, followOnAppend, anchorDelta] = anchor;
2347
+ if (key !== null && !followOnAppend) if (isIOSWebKit() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded)) {
2348
+ if (anchorDelta !== 0) this._iosDeferredAdjustment += anchorDelta;
2349
+ } else this._scrollToOffset(this.getScrollOffset(), {
2350
+ adjustments: void 0,
2351
+ behavior: void 0
2352
+ });
2353
+ if (followOnAppend) this.scrollToEnd({ behavior: followOnAppend });
2354
+ }
2355
+ };
2356
+ this._flushIosDeferredIfReady = () => {
2357
+ if (this._iosDeferredAdjustment === 0) return;
2358
+ if (this.isScrolling) return;
2359
+ if (this._iosTouching) return;
2360
+ if (this._iosJustTouchEnded) return;
2361
+ const cur = this.getScrollOffset();
2362
+ const max = this.getMaxScrollOffset();
2363
+ if (cur < 0 || cur > max) return;
2364
+ if (this._iosDeferredAdjustment < 0 && cur >= max - 1) {
2365
+ this._iosDeferredAdjustment = 0;
2366
+ return;
2367
+ }
2368
+ const delta = this._iosDeferredAdjustment;
2369
+ this._iosDeferredAdjustment = 0;
2370
+ this._scrollToOffset(cur, {
2371
+ adjustments: this.scrollAdjustments += delta,
2372
+ behavior: void 0
2373
+ });
2374
+ };
2375
+ this.rafId = null;
2376
+ this.getSize = () => {
2377
+ if (!this.options.enabled) {
2378
+ this.scrollRect = null;
2379
+ return 0;
2380
+ }
2381
+ this.scrollRect = this.scrollRect ?? this.options.initialRect;
2382
+ return this.scrollRect[this.options.horizontal ? "width" : "height"];
2383
+ };
2384
+ this.getScrollOffset = () => {
2385
+ if (!this.options.enabled) {
2386
+ this.scrollOffset = null;
2387
+ return 0;
2388
+ }
2389
+ this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset);
2390
+ return this.scrollOffset;
2391
+ };
2392
+ this.getMeasurementOptions = memo(() => [
2393
+ this.options.count,
2394
+ this.options.paddingStart,
2395
+ this.options.scrollMargin,
2396
+ this.options.getItemKey,
2397
+ this.options.enabled,
2398
+ this.options.lanes,
2399
+ this.options.laneAssignmentMode,
2400
+ this.options.gap
2401
+ ], (count, paddingStart, scrollMargin, getItemKey, enabled, lanes, laneAssignmentMode, gap) => {
2402
+ if (this.prevLanes !== void 0 && this.prevLanes !== lanes) this.lanesChangedFlag = true;
2403
+ this.prevLanes = lanes;
2404
+ this.pendingMin = null;
2405
+ return {
2406
+ count,
2407
+ paddingStart,
2408
+ scrollMargin,
2409
+ getItemKey,
2410
+ enabled,
2411
+ lanes,
2412
+ laneAssignmentMode,
2413
+ gap
2414
+ };
2415
+ }, { key: false });
2416
+ this.getMeasurements = memo(() => [this.getMeasurementOptions(), this.itemSizeCacheVersion], ({ count, paddingStart, scrollMargin, getItemKey, enabled, lanes, laneAssignmentMode, gap }, _itemSizeCacheVersion) => {
2417
+ const itemSizeCache = this.itemSizeCache;
2418
+ if (!enabled) {
2419
+ this.measurementsCache = [];
2420
+ this.itemSizeCache.clear();
2421
+ this.laneAssignments.clear();
2422
+ return [];
2423
+ }
2424
+ if (this.laneAssignments.size > count) {
2425
+ for (const index of this.laneAssignments.keys()) if (index >= count) this.laneAssignments.delete(index);
2426
+ }
2427
+ if (this.lanesChangedFlag) {
2428
+ this.lanesChangedFlag = false;
2429
+ this.lanesSettling = true;
2430
+ this.measurementsCache = [];
2431
+ this.itemSizeCache.clear();
2432
+ this.laneAssignments.clear();
2433
+ this.pendingMin = null;
2434
+ }
2435
+ if (this.measurementsCache.length === 0 && !this.lanesSettling) {
2436
+ this.measurementsCache = this.options.initialMeasurementsCache;
2437
+ this.measurementsCache.forEach((item) => {
2438
+ this.itemSizeCache.set(item.key, item.size);
2439
+ });
2440
+ }
2441
+ const min = this.lanesSettling ? 0 : this.pendingMin ?? 0;
2442
+ this.pendingMin = null;
2443
+ if (this.lanesSettling && this.measurementsCache.length === count) this.lanesSettling = false;
2444
+ if (lanes === 1) {
2445
+ const need = count * 2;
2446
+ let flat = this._flatMeasurements;
2447
+ if (!flat || flat.length < need) {
2448
+ const next = new Float64Array(need);
2449
+ if (flat && min > 0) next.set(flat.subarray(0, min * 2));
2450
+ flat = next;
2451
+ this._flatMeasurements = flat;
2452
+ }
2453
+ let runningStart;
2454
+ if (min === 0) runningStart = paddingStart + scrollMargin;
2455
+ else {
2456
+ const prevIdx = min - 1;
2457
+ runningStart = flat[prevIdx * 2] + flat[prevIdx * 2 + 1] + gap;
2458
+ }
2459
+ for (let i = min; i < count; i++) {
2460
+ const key = getItemKey(i);
2461
+ const measuredSize = itemSizeCache.get(key);
2462
+ const size = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
2463
+ flat[i * 2] = runningStart;
2464
+ flat[i * 2 + 1] = size;
2465
+ runningStart += size + gap;
2466
+ }
2467
+ const view = createLazyMeasurementsView(count, flat, getItemKey);
2468
+ this.measurementsCache = view;
2469
+ return view;
2470
+ }
2471
+ const measurements = this.measurementsCache.slice(0, min);
2472
+ const laneLastIndex = new Array(lanes).fill(void 0);
2473
+ const laneEnds = new Float64Array(lanes);
2474
+ let filledLanes = 0;
2475
+ for (let m = 0; m < min; m++) {
2476
+ const item = measurements[m];
2477
+ if (item) {
2478
+ if (laneLastIndex[item.lane] === void 0) filledLanes++;
2479
+ laneLastIndex[item.lane] = m;
2480
+ laneEnds[item.lane] = item.end;
2481
+ }
2482
+ }
2483
+ for (let i = min; i < count; i++) {
2484
+ const key = getItemKey(i);
2485
+ const cachedLane = this.laneAssignments.get(i);
2486
+ let lane;
2487
+ let start;
2488
+ const shouldCacheLane = laneAssignmentMode === "estimate" || itemSizeCache.has(key);
2489
+ if (cachedLane !== void 0 && this.options.lanes > 1) {
2490
+ lane = cachedLane;
2491
+ const prevIndex = laneLastIndex[lane];
2492
+ const prevInLane = prevIndex !== void 0 ? measurements[prevIndex] : void 0;
2493
+ start = prevInLane ? prevInLane.end + gap : paddingStart + scrollMargin;
2494
+ } else if (filledLanes === lanes) {
2495
+ let bestLane = 0;
2496
+ let bestEnd = laneEnds[0];
2497
+ let bestIdx = laneLastIndex[0];
2498
+ for (let l = 1; l < lanes; l++) {
2499
+ const e = laneEnds[l];
2500
+ if (e < bestEnd || e === bestEnd && laneLastIndex[l] < bestIdx) {
2501
+ bestLane = l;
2502
+ bestEnd = e;
2503
+ bestIdx = laneLastIndex[l];
2504
+ }
2505
+ }
2506
+ lane = bestLane;
2507
+ start = bestEnd + gap;
2508
+ if (shouldCacheLane) this.laneAssignments.set(i, lane);
2509
+ } else {
2510
+ lane = i % this.options.lanes;
2511
+ start = paddingStart + scrollMargin;
2512
+ if (shouldCacheLane) this.laneAssignments.set(i, lane);
2513
+ }
2514
+ const measuredSize = itemSizeCache.get(key);
2515
+ const size = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
2516
+ const end = start + size;
2517
+ measurements[i] = {
2518
+ index: i,
2519
+ start,
2520
+ size,
2521
+ end,
2522
+ key,
2523
+ lane
2524
+ };
2525
+ if (laneLastIndex[lane] === void 0) filledLanes++;
2526
+ laneLastIndex[lane] = i;
2527
+ laneEnds[lane] = end;
2528
+ }
2529
+ this.measurementsCache = measurements;
2530
+ return measurements;
2531
+ }, {
2532
+ key: false,
2533
+ debug: () => this.options.debug
2534
+ });
2535
+ this.calculateRange = memo(() => [
2536
+ this.getMeasurements(),
2537
+ this.getSize(),
2538
+ this.getScrollOffset(),
2539
+ this.options.lanes
2540
+ ], (measurements, outerSize, scrollOffset, lanes) => {
2541
+ if (measurements.length === 0 || outerSize === 0) {
2542
+ this.range = null;
2543
+ return null;
2544
+ }
2545
+ this.range = calculateRangeImpl(measurements, outerSize, scrollOffset, lanes, lanes === 1 && this._flatMeasurements != null ? this._flatMeasurements : null);
2546
+ return this.range;
2547
+ }, {
2548
+ key: false,
2549
+ debug: () => this.options.debug
2550
+ });
2551
+ this.getVirtualIndexes = memo(() => {
2552
+ let startIndex = null;
2553
+ let endIndex = null;
2554
+ const range = this.calculateRange();
2555
+ if (range) {
2556
+ startIndex = range.startIndex;
2557
+ endIndex = range.endIndex;
2558
+ }
2559
+ this.maybeNotify.updateDeps([
2560
+ this.isScrolling,
2561
+ startIndex,
2562
+ endIndex
2563
+ ]);
2564
+ return [
2565
+ this.options.rangeExtractor,
2566
+ this.options.overscan,
2567
+ this.options.count,
2568
+ startIndex,
2569
+ endIndex
2570
+ ];
2571
+ }, (rangeExtractor, overscan, count, startIndex, endIndex) => {
2572
+ return startIndex === null || endIndex === null ? [] : rangeExtractor({
2573
+ startIndex,
2574
+ endIndex,
2575
+ overscan,
2576
+ count
2577
+ });
2578
+ }, {
2579
+ key: false,
2580
+ debug: () => this.options.debug
2581
+ });
2582
+ this.indexFromElement = (node) => {
2583
+ const attributeName = this.options.indexAttribute;
2584
+ const indexStr = node.getAttribute(attributeName);
2585
+ if (!indexStr) {
2586
+ console.warn(`Missing attribute name '${attributeName}={index}' on measured element.`);
2587
+ return -1;
2588
+ }
2589
+ return parseInt(indexStr, 10);
2590
+ };
2591
+ this.shouldMeasureDuringScroll = (index) => {
2592
+ var _a;
2593
+ if (!this.scrollState || this.scrollState.behavior !== "smooth") return true;
2594
+ const scrollIndex = this.scrollState.index ?? ((_a = this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)) == null ? void 0 : _a.index);
2595
+ if (scrollIndex !== void 0 && this.range) {
2596
+ const bufferSize = Math.max(this.options.overscan, Math.ceil((this.range.endIndex - this.range.startIndex) / 2));
2597
+ const minIndex = Math.max(0, scrollIndex - bufferSize);
2598
+ const maxIndex = Math.min(this.options.count - 1, scrollIndex + bufferSize);
2599
+ return index >= minIndex && index <= maxIndex;
2600
+ }
2601
+ return true;
2602
+ };
2603
+ this.measureElement = (node) => {
2604
+ if (!node) {
2605
+ this.elementsCache.forEach((cached, key2) => {
2606
+ if (!cached.isConnected) {
2607
+ this.observer.unobserve(cached);
2608
+ this.elementsCache.delete(key2);
2609
+ }
2610
+ });
2611
+ return;
2612
+ }
2613
+ const index = this.indexFromElement(node);
2614
+ const key = this.options.getItemKey(index);
2615
+ const prevNode = this.elementsCache.get(key);
2616
+ if (prevNode !== node) {
2617
+ if (prevNode) this.observer.unobserve(prevNode);
2618
+ this.observer.observe(node);
2619
+ this.elementsCache.set(key, node);
2620
+ }
2621
+ if ((!this.isScrolling || this.scrollState) && this.shouldMeasureDuringScroll(index)) this.resizeItem(index, this.options.measureElement(node, void 0, this));
2622
+ };
2623
+ this.resizeItem = (index, size) => {
2624
+ var _a, _b;
2625
+ if (index < 0 || index >= this.options.count) return;
2626
+ let cachedSize;
2627
+ let itemStart;
2628
+ let key;
2629
+ const flat = this._flatMeasurements;
2630
+ if (this.options.lanes === 1 && flat !== null) {
2631
+ key = this.options.getItemKey(index);
2632
+ itemStart = flat[index * 2];
2633
+ cachedSize = flat[index * 2 + 1];
2634
+ } else {
2635
+ const item = this.measurementsCache[index];
2636
+ if (!item) return;
2637
+ key = item.key;
2638
+ itemStart = item.start;
2639
+ cachedSize = item.size;
2640
+ }
2641
+ const itemSize = this.itemSizeCache.get(key) ?? cachedSize;
2642
+ const delta = size - itemSize;
2643
+ if (delta !== 0) {
2644
+ const wasAtEnd = this.options.anchorTo === "end" && ((_a = this.scrollState) == null ? void 0 : _a.behavior) !== "smooth" && this.getVirtualDistanceFromEnd() <= this.options.scrollEndThreshold;
2645
+ const prevTotalSize = wasAtEnd ? this.getTotalSize() : 0;
2646
+ const scrollOffsetWithAdj = this.getScrollOffset() + this.scrollAdjustments;
2647
+ const defaultShouldAdjust = !this.itemSizeCache.has(key) ? itemStart < scrollOffsetWithAdj : itemStart + itemSize <= scrollOffsetWithAdj && this.scrollDirection !== "backward";
2648
+ const shouldAdjustScroll = ((_b = this.scrollState) == null ? void 0 : _b.behavior) !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[index] ?? {
2649
+ index,
2650
+ key,
2651
+ start: itemStart,
2652
+ size: cachedSize,
2653
+ end: itemStart + cachedSize,
2654
+ lane: 0
2655
+ }, delta, this) : defaultShouldAdjust);
2656
+ if (this.pendingMin === null || index < this.pendingMin) this.pendingMin = index;
2657
+ this.itemSizeCache.set(key, size);
2658
+ this.itemSizeCacheVersion++;
2659
+ let adjustedSync = false;
2660
+ if (wasAtEnd) adjustedSync = this.applyScrollAdjustment(this.getTotalSize() - prevTotalSize);
2661
+ else if (shouldAdjustScroll) adjustedSync = this.applyScrollAdjustment(delta);
2662
+ this.notify(adjustedSync);
2663
+ }
2664
+ };
2665
+ this.getVirtualItems = memo(() => [this.getVirtualIndexes(), this.getMeasurements()], (indexes, measurements) => {
2666
+ const virtualItems = [];
2667
+ for (let k = 0, len = indexes.length; k < len; k++) {
2668
+ const measurement = measurements[indexes[k]];
2669
+ virtualItems.push(measurement);
2670
+ }
2671
+ return virtualItems;
2672
+ }, {
2673
+ key: false,
2674
+ debug: () => this.options.debug
2675
+ });
2676
+ this.getVirtualItemForOffset = (offset) => {
2677
+ const measurements = this.getMeasurements();
2678
+ if (measurements.length === 0) return;
2679
+ const flat = this._flatMeasurements;
2680
+ const useFlat = this.options.lanes === 1 && flat != null;
2681
+ return notUndefined(measurements[findNearestBinarySearch(0, measurements.length - 1, useFlat ? (i) => flat[i * 2] : (i) => notUndefined(measurements[i]).start, offset)]);
2682
+ };
2683
+ this.getMaxScrollOffset = () => {
2684
+ if (!this.scrollElement) return 0;
2685
+ if ("scrollHeight" in this.scrollElement) return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
2686
+ else {
2687
+ const doc = this.scrollElement.document.documentElement;
2688
+ return this.options.horizontal ? doc.scrollWidth - this.scrollElement.innerWidth : doc.scrollHeight - this.scrollElement.innerHeight;
2689
+ }
2690
+ };
2691
+ this.getVirtualDistanceFromEnd = () => {
2692
+ return Math.max(this.getTotalSize() - this.getSize() - this.getScrollOffset(), 0);
2693
+ };
2694
+ this.getDistanceFromEnd = () => {
2695
+ return Math.max(this.getMaxScrollOffset() - this.getScrollOffset(), 0);
2696
+ };
2697
+ this.isAtEnd = (threshold = this.options.scrollEndThreshold) => {
2698
+ return this.getDistanceFromEnd() <= threshold;
2699
+ };
2700
+ this.getOffsetForAlignment = (toOffset, align, itemSize = 0) => {
2701
+ if (!this.scrollElement) return 0;
2702
+ const size = this.getSize();
2703
+ const scrollOffset = this.getScrollOffset();
2704
+ if (align === "auto") align = toOffset >= scrollOffset + size ? "end" : "start";
2705
+ if (align === "center") toOffset += (itemSize - size) / 2;
2706
+ else if (align === "end") toOffset -= size;
2707
+ const maxOffset = this.getMaxScrollOffset();
2708
+ return Math.max(Math.min(maxOffset, toOffset), 0);
2709
+ };
2710
+ this.getOffsetForIndex = (index, align = "auto") => {
2711
+ index = Math.max(0, Math.min(index, this.options.count - 1));
2712
+ const size = this.getSize();
2713
+ const scrollOffset = this.getScrollOffset();
2714
+ const item = this.measurementsCache[index];
2715
+ if (!item) return;
2716
+ if (align === "auto") if (item.end >= scrollOffset + size - this.options.scrollPaddingEnd) align = "end";
2717
+ else if (item.start <= scrollOffset + this.options.scrollPaddingStart) align = "start";
2718
+ else return [scrollOffset, align];
2719
+ if (align === "end" && index === this.options.count - 1) return [this.getMaxScrollOffset(), align];
2720
+ const toOffset = align === "end" ? item.end + this.options.scrollPaddingEnd : item.start - this.options.scrollPaddingStart;
2721
+ return [this.getOffsetForAlignment(toOffset, align, item.size), align];
2722
+ };
2723
+ this.scrollToOffset = (toOffset, { align = "start", behavior = "auto" } = {}) => {
2724
+ this._iosDeferredAdjustment = 0;
2725
+ const offset = this.getOffsetForAlignment(toOffset, align);
2726
+ const now = this.now();
2727
+ this.scrollState = {
2728
+ index: null,
2729
+ align,
2730
+ behavior,
2731
+ startedAt: now,
2732
+ lastTargetOffset: offset,
2733
+ stableFrames: 0
2734
+ };
2735
+ this._scrollToOffset(offset, {
2736
+ adjustments: void 0,
2737
+ behavior
2738
+ });
2739
+ this.scheduleScrollReconcile();
2740
+ };
2741
+ this.scrollToIndex = (index, { align: initialAlign = "auto", behavior = "auto" } = {}) => {
2742
+ this._iosDeferredAdjustment = 0;
2743
+ index = Math.max(0, Math.min(index, this.options.count - 1));
2744
+ const offsetInfo = this.getOffsetForIndex(index, initialAlign);
2745
+ if (!offsetInfo) return;
2746
+ const [offset, align] = offsetInfo;
2747
+ const now = this.now();
2748
+ this.scrollState = {
2749
+ index,
2750
+ align,
2751
+ behavior,
2752
+ startedAt: now,
2753
+ lastTargetOffset: offset,
2754
+ stableFrames: 0
2755
+ };
2756
+ this._scrollToOffset(offset, {
2757
+ adjustments: void 0,
2758
+ behavior
2759
+ });
2760
+ this.scheduleScrollReconcile();
2761
+ };
2762
+ this.scrollBy = (delta, { behavior = "auto" } = {}) => {
2763
+ const offset = this.getScrollOffset() + delta;
2764
+ const now = this.now();
2765
+ this.scrollState = {
2766
+ index: null,
2767
+ align: "start",
2768
+ behavior,
2769
+ startedAt: now,
2770
+ lastTargetOffset: offset,
2771
+ stableFrames: 0
2772
+ };
2773
+ this._scrollToOffset(offset, {
2774
+ adjustments: void 0,
2775
+ behavior
2776
+ });
2777
+ this.scheduleScrollReconcile();
2778
+ };
2779
+ this.scrollToEnd = ({ behavior = "auto" } = {}) => {
2780
+ if (this.options.count > 0) {
2781
+ this.scrollToIndex(this.options.count - 1, {
2782
+ align: "end",
2783
+ behavior
2784
+ });
2785
+ return;
2786
+ }
2787
+ this.scrollToOffset(Math.max(this.getTotalSize() - this.getSize(), 0), { behavior });
2788
+ };
2789
+ this.getTotalSize = () => {
2790
+ var _a;
2791
+ const measurements = this.getMeasurements();
2792
+ let end;
2793
+ if (measurements.length === 0) end = this.options.paddingStart;
2794
+ else if (this.options.lanes === 1) {
2795
+ const lastIdx = measurements.length - 1;
2796
+ const flat = this._flatMeasurements;
2797
+ if (flat != null) end = flat[lastIdx * 2] + flat[lastIdx * 2 + 1];
2798
+ else end = ((_a = measurements[lastIdx]) == null ? void 0 : _a.end) ?? 0;
2799
+ } else {
2800
+ const endByLane = Array(this.options.lanes).fill(null);
2801
+ let endIndex = measurements.length - 1;
2802
+ while (endIndex >= 0 && endByLane.some((val) => val === null)) {
2803
+ const item = measurements[endIndex];
2804
+ if (endByLane[item.lane] === null) endByLane[item.lane] = item.end;
2805
+ endIndex--;
2806
+ }
2807
+ end = Math.max(...endByLane.filter((val) => val !== null));
2808
+ }
2809
+ return Math.max(end - this.options.scrollMargin + this.options.paddingEnd, 0);
2810
+ };
2811
+ this.takeSnapshot = () => {
2812
+ const snapshot = [];
2813
+ if (this.itemSizeCache.size === 0) return snapshot;
2814
+ const m = this.getMeasurements();
2815
+ for (const item of m) if (item && this.itemSizeCache.has(item.key)) snapshot.push({
2816
+ index: item.index,
2817
+ key: item.key,
2818
+ start: item.start,
2819
+ size: item.size,
2820
+ end: item.end,
2821
+ lane: item.lane
2822
+ });
2823
+ return snapshot;
2824
+ };
2825
+ this._scrollToOffset = (offset, { adjustments, behavior }) => {
2826
+ this._intendedScrollOffset = offset + (adjustments ?? 0);
2827
+ this.options.scrollToFn(offset, {
2828
+ behavior,
2829
+ adjustments
2830
+ }, this);
2831
+ };
2832
+ this.measure = () => {
2833
+ this.pendingMin = null;
2834
+ this.itemSizeCache.clear();
2835
+ this.laneAssignments.clear();
2836
+ this.itemSizeCacheVersion++;
2837
+ this.notify(false);
2838
+ };
2839
+ this.setOptions(opts);
2840
+ }
2841
+ applyScrollAdjustment(delta, behavior) {
2842
+ if (delta === 0) return false;
2843
+ if (isIOSWebKit() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded)) {
2844
+ this._iosDeferredAdjustment += delta;
2845
+ return false;
2846
+ } else {
2847
+ this._scrollToOffset(this.getScrollOffset(), {
2848
+ adjustments: this.scrollAdjustments += delta,
2849
+ behavior
2850
+ });
2851
+ if (this.scrollOffset !== null) {
2852
+ this.scrollOffset += this.scrollAdjustments;
2853
+ if (this.scrollOffset < 0) this.scrollOffset = 0;
2854
+ this.scrollAdjustments = 0;
2855
+ }
2856
+ return true;
2857
+ }
2858
+ }
2859
+ scheduleScrollReconcile() {
2860
+ if (!this.targetWindow) {
2861
+ this.scrollState = null;
2862
+ return;
2863
+ }
2864
+ if (this.rafId != null) return;
2865
+ this.rafId = this.targetWindow.requestAnimationFrame(() => {
2866
+ this.rafId = null;
2867
+ this.reconcileScroll();
2868
+ });
2869
+ }
2870
+ reconcileScroll() {
2871
+ if (!this.scrollState) return;
2872
+ if (!this.scrollElement) return;
2873
+ if (this.now() - this.scrollState.startedAt > 5e3) {
2874
+ this.scrollState = null;
2875
+ return;
2876
+ }
2877
+ const offsetInfo = this.scrollState.index != null ? this.getOffsetForIndex(this.scrollState.index, this.scrollState.align) : void 0;
2878
+ const targetOffset = offsetInfo ? offsetInfo[0] : this.scrollState.lastTargetOffset;
2879
+ const STABLE_FRAMES = 1;
2880
+ const targetChanged = targetOffset !== this.scrollState.lastTargetOffset;
2881
+ if (!targetChanged && approxEqual(targetOffset, this.getScrollOffset())) {
2882
+ this.scrollState.stableFrames++;
2883
+ if (this.scrollState.stableFrames >= STABLE_FRAMES) {
2884
+ if (this.getScrollOffset() !== targetOffset) this._scrollToOffset(targetOffset, {
2885
+ adjustments: void 0,
2886
+ behavior: "auto"
2887
+ });
2888
+ this.scrollState = null;
2889
+ return;
2890
+ }
2891
+ } else {
2892
+ this.scrollState.stableFrames = 0;
2893
+ if (targetChanged) {
2894
+ const viewport = this.getSize() || 600;
2895
+ const distance = Math.abs(targetOffset - this.getScrollOffset());
2896
+ const keepSmooth = this.scrollState.behavior === "smooth" && distance > viewport;
2897
+ this.scrollState.lastTargetOffset = targetOffset;
2898
+ if (!keepSmooth) this.scrollState.behavior = "auto";
2899
+ this._scrollToOffset(targetOffset, {
2900
+ adjustments: void 0,
2901
+ behavior: keepSmooth ? "smooth" : "auto"
2902
+ });
2903
+ }
2904
+ }
2905
+ this.scheduleScrollReconcile();
2906
+ }
2907
+ };
2908
+ const findNearestBinarySearch = (low, high, getCurrentValue, value) => {
2909
+ while (low <= high) {
2910
+ const middle = (low + high) / 2 | 0;
2911
+ const currentValue = getCurrentValue(middle);
2912
+ if (currentValue < value) low = middle + 1;
2913
+ else if (currentValue > value) high = middle - 1;
2914
+ else return middle;
2915
+ }
2916
+ if (low > 0) return low - 1;
2917
+ else return 0;
2918
+ };
2919
+ function findNearestBinarySearchFlat(flat, high, value) {
2920
+ let low = 0;
2921
+ while (low <= high) {
2922
+ const middle = (low + high) / 2 | 0;
2923
+ const currentValue = flat[middle * 2];
2924
+ if (currentValue < value) low = middle + 1;
2925
+ else if (currentValue > value) high = middle - 1;
2926
+ else return middle;
2927
+ }
2928
+ return low > 0 ? low - 1 : 0;
2929
+ }
2930
+ function calculateRangeImpl(measurements, outerSize, scrollOffset, lanes, flat) {
2931
+ const lastIndex = measurements.length - 1;
2932
+ if (measurements.length <= lanes) return {
2933
+ startIndex: 0,
2934
+ endIndex: lastIndex
2935
+ };
2936
+ if (lanes === 1 && flat !== null) {
2937
+ const startIndex2 = findNearestBinarySearchFlat(flat, lastIndex, scrollOffset);
2938
+ let endIndex2 = startIndex2;
2939
+ const limit = scrollOffset + outerSize;
2940
+ while (endIndex2 < lastIndex && flat[endIndex2 * 2] + flat[endIndex2 * 2 + 1] < limit) endIndex2++;
2941
+ return {
2942
+ startIndex: startIndex2,
2943
+ endIndex: endIndex2
2944
+ };
2945
+ }
2946
+ const getStart = (index) => measurements[index].start;
2947
+ let startIndex = findNearestBinarySearch(0, lastIndex, getStart, scrollOffset);
2948
+ let endIndex = startIndex;
2949
+ if (lanes === 1) while (endIndex < lastIndex && measurements[endIndex].end < scrollOffset + outerSize) endIndex++;
2950
+ else if (lanes > 1) {
2951
+ const endPerLane = Array(lanes).fill(0);
2952
+ while (endIndex < lastIndex && endPerLane.some((pos) => pos < scrollOffset + outerSize)) {
2953
+ const item = measurements[endIndex];
2954
+ endPerLane[item.lane] = item.end;
2955
+ endIndex++;
2956
+ }
2957
+ const startPerLane = Array(lanes).fill(scrollOffset + outerSize);
2958
+ while (startIndex >= 0 && startPerLane.some((pos) => pos >= scrollOffset)) {
2959
+ const item = measurements[startIndex];
2960
+ startPerLane[item.lane] = item.start;
2961
+ startIndex--;
2962
+ }
2963
+ startIndex = Math.max(0, startIndex - startIndex % lanes);
2964
+ endIndex = Math.min(lastIndex, endIndex + (lanes - 1 - endIndex % lanes));
2965
+ }
2966
+ return {
2967
+ startIndex,
2968
+ endIndex
2969
+ };
2970
+ }
2971
+ //#endregion
2972
+ //#region ../../../node_modules/.pnpm/@tanstack+react-virtual@3.14.9_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tanstack/react-virtual/dist/esm/index.js
2973
+ const useIsomorphicLayoutEffect = typeof document !== "undefined" ? react.useLayoutEffect : react.useEffect;
2974
+ function useVirtualizerBase({ useFlushSync = true, directDomUpdates = false, directDomUpdatesMode = "transform", ...options }) {
2975
+ const rerender = react.useReducer((x) => x + 1, 0)[1];
2976
+ const directRef = react.useRef({
2977
+ enabled: directDomUpdates,
2978
+ mode: directDomUpdatesMode,
2979
+ container: null,
2980
+ lastSize: null,
2981
+ lastPositions: /* @__PURE__ */ new WeakMap(),
2982
+ prevRange: null
2983
+ });
2984
+ directRef.current.enabled = directDomUpdates;
2985
+ directRef.current.mode = directDomUpdatesMode;
2986
+ const applyContainerSize = (instance2) => {
2987
+ const state = directRef.current;
2988
+ if (!state.enabled || !state.container) return;
2989
+ const totalSize = instance2.getTotalSize();
2990
+ if (totalSize !== state.lastSize) {
2991
+ state.lastSize = totalSize;
2992
+ const sizeAxis = instance2.options.horizontal ? "width" : "height";
2993
+ state.container.style[sizeAxis] = `${totalSize}px`;
2994
+ }
2995
+ };
2996
+ const applyDirectStyles = (instance2) => {
2997
+ const state = directRef.current;
2998
+ if (!state.enabled || !state.container) return;
2999
+ applyContainerSize(instance2);
3000
+ const horizontal = !!instance2.options.horizontal;
3001
+ const useTransform = state.mode === "transform";
3002
+ const posAxis = horizontal ? "left" : "top";
3003
+ const scrollMargin = instance2.options.scrollMargin;
3004
+ const items = instance2.getVirtualItems();
3005
+ for (const item of items) {
3006
+ const next = item.start - scrollMargin;
3007
+ const el = instance2.elementsCache.get(item.key);
3008
+ if (!el) continue;
3009
+ if (state.lastPositions.get(el) === next) continue;
3010
+ state.lastPositions.set(el, next);
3011
+ if (useTransform) el.style.transform = horizontal ? `translate3d(${next}px, 0, 0)` : `translate3d(0, ${next}px, 0)`;
3012
+ else el.style[posAxis] = `${next}px`;
3013
+ }
3014
+ };
3015
+ const resolvedOptions = {
3016
+ ...options,
3017
+ onChange: (instance2, sync) => {
3018
+ var _a;
3019
+ const state = directRef.current;
3020
+ let shouldRerender = true;
3021
+ if (state.enabled) {
3022
+ applyDirectStyles(instance2);
3023
+ const range = instance2.range;
3024
+ const prev = state.prevRange;
3025
+ shouldRerender = !prev || prev.isScrolling !== instance2.isScrolling || prev.startIndex !== (range == null ? void 0 : range.startIndex) || prev.endIndex !== (range == null ? void 0 : range.endIndex);
3026
+ if (shouldRerender) state.prevRange = range ? {
3027
+ startIndex: range.startIndex,
3028
+ endIndex: range.endIndex,
3029
+ isScrolling: instance2.isScrolling
3030
+ } : null;
3031
+ }
3032
+ if (shouldRerender) if (useFlushSync && sync) (0, react_dom.flushSync)(rerender);
3033
+ else rerender();
3034
+ (_a = options.onChange) == null || _a.call(options, instance2, sync);
3035
+ }
3036
+ };
3037
+ const [instance] = react.useState(() => {
3038
+ const v = new Virtualizer(resolvedOptions);
3039
+ return Object.assign(v, { containerRef: (node) => {
3040
+ const state = directRef.current;
3041
+ state.container = node;
3042
+ state.lastSize = null;
3043
+ if (node && state.enabled) {
3044
+ const total = v.getTotalSize();
3045
+ state.lastSize = total;
3046
+ const axis = v.options.horizontal ? "width" : "height";
3047
+ node.style[axis] = `${total}px`;
3048
+ }
3049
+ } });
3050
+ });
3051
+ instance.setOptions(resolvedOptions);
3052
+ useIsomorphicLayoutEffect(() => {
3053
+ return instance._didMount();
3054
+ }, []);
3055
+ useIsomorphicLayoutEffect(() => {
3056
+ applyContainerSize(instance);
3057
+ return instance._willUpdate();
3058
+ });
3059
+ useIsomorphicLayoutEffect(() => {
3060
+ applyDirectStyles(instance);
3061
+ });
3062
+ return instance;
3063
+ }
3064
+ function useVirtualizer(options) {
3065
+ return useVirtualizerBase({
3066
+ observeElementRect,
3067
+ observeElementOffset,
3068
+ scrollToFn: elementScroll,
3069
+ ...options
3070
+ });
3071
+ }
3072
+ //#endregion
3073
+ //#region lib/types/client/recent.js
3074
+ /**
3075
+ * Cache chronological membership across status, title, selection, and projection updates.
3076
+ * @param rowState - archive visibility for this selector's lifetime.
3077
+ * @returns a selector that sorts only when membership or activity timestamps change.
3078
+ */
3079
+ function createRecentSessionSelector(rowState) {
3080
+ let times = /* @__PURE__ */ new Map();
3081
+ let ordered = [];
3082
+ return (list) => {
3083
+ const members = visibleSessionIds(list, rowState.archivedSessionIds, rowState.archivedFilter);
3084
+ if (members.length === times.size && members.every((id) => times.get(id) === list.byId[id]?.updatedAt)) return ordered;
3085
+ times = new Map(members.map((id) => [id, list.byId[id]?.updatedAt ?? 0]));
3086
+ ordered = orderByRecency(members, list.byId);
3087
+ return ordered;
3088
+ };
3089
+ }
3090
+ //#endregion
3091
+ //#region \0dsh-css:/Users/shiguifeng/IdeaProjects/chonggou/deepseek-harness/packages/client/ui-workspace/src/client/rows/WorkspaceBrowser.module.css.mjs
3092
+ const css$2 = ".YaTVHW_root{--dsh-session-list-edge-inset:var(--dsh-sidebar-inline-padding);--dsh-session-list-scrollbar-width:5px;--dsh-session-list-scrollbar-offset:2px;box-sizing:border-box;min-height:0;padding-right:var(--dsh-session-list-edge-inset);flex-direction:column;flex:1;display:flex}.YaTVHW_root.YaTVHW_rail{padding-right:0}.YaTVHW_iconButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:28px;height:28px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.YaTVHW_iconButton:focus-visible,.YaTVHW_searchButton:focus-visible,.YaTVHW_clearButton:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.YaTVHW_iconButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.YaTVHW_iconButton[aria-pressed=true]{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.YaTVHW_viewOptionsMenu{min-width:200px}.YaTVHW_sectionHeader{box-sizing:border-box;border-radius:var(--dsw-radius-md);height:36px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:flex-end;align-items:center;gap:4px;margin-bottom:4px;padding-left:4px;display:flex;overflow:hidden}.YaTVHW_root:not(.YaTVHW_rail) .YaTVHW_sectionHeader{margin-top:2px;margin-right:-4px}.YaTVHW_sectionLabel{white-space:nowrap;opacity:1;visibility:visible;min-width:0;max-width:45%;transition:max-width .18s var(--ds-ease-in-out), margin-right .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;line-height:20px;overflow:hidden}.YaTVHW_sectionLabelHidden{opacity:0;visibility:hidden;max-width:0;margin-right:-4px;transition-delay:0s,0s,0s,0s,.18s;transform:translate(-4px)}.YaTVHW_searchSlot{box-sizing:border-box;min-width:0;max-width:28px;transition:max-width .18s var(--ds-ease-in-out), padding-left .18s var(--ds-ease-in-out);flex:1;align-items:center;margin-left:auto;padding-left:0;display:flex}.YaTVHW_searchSlotExpanded{max-width:100%;padding-left:0}.YaTVHW_headerActions{opacity:1;visibility:visible;max-width:60px;transition:max-width .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;align-items:center;gap:4px;display:flex;overflow:hidden}.YaTVHW_headerActionsHidden{opacity:0;visibility:hidden;pointer-events:none;max-width:0;transition-delay:0s,0s,0s,.18s;transform:translate(4px)}.YaTVHW_search{box-sizing:border-box;border-radius:var(--dsw-radius-sm);cursor:text;width:100%;height:28px;color:var(--dsw-alias-label-secondary);transition:width .18s var(--ds-ease-in-out), padding .18s var(--ds-ease-in-out), border-color .18s var(--ds-ease-in-out), background-color .18s var(--ds-ease-in-out);background:0 0;border:none;flex:none;align-items:center;gap:0;margin:0;padding:0;display:flex;overflow:hidden}.YaTVHW_searchExpanded{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);width:calc(100% + 4px);height:30px;color:var(--dsw-alias-label-caption);background:0 0;margin-inline:-2px;padding:0 4px 0 0}.YaTVHW_searchButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:28px;height:28px;color:inherit;background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.YaTVHW_searchExpanded .YaTVHW_searchButton{width:28px;height:30px}.YaTVHW_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.YaTVHW_searchExpanded .YaTVHW_searchButton:hover{background:0 0}.YaTVHW_searchInput{opacity:0;pointer-events:none;width:0;min-width:0;color:var(--dsw-alias-label-primary);transition:opacity .12s var(--ds-ease-in-out);background:0 0;border:none;outline:none;flex:1;font-size:13px;line-height:18px}.YaTVHW_searchExpanded .YaTVHW_searchInput{opacity:1;pointer-events:auto;margin-left:-2px}.YaTVHW_searchInput::placeholder{color:var(--dsw-alias-label-tertiary)}.YaTVHW_clearButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:24px;height:24px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.YaTVHW_clearButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.YaTVHW_rail .YaTVHW_sectionHeader{justify-content:flex-start;gap:0;margin-bottom:12px;padding-left:0}.YaTVHW_rail .YaTVHW_headerActions{max-width:none}.YaTVHW_rail .YaTVHW_iconButton{border-radius:var(--dsw-radius-md);width:36px;height:36px;color:var(--dsw-alias-label-primary)}.YaTVHW_rail .YaTVHW_search{border-radius:var(--dsw-radius-md);background:0 0;border-color:#0000;gap:0;width:36px;height:36px;margin:0 0 12px;padding:0}.YaTVHW_rail .YaTVHW_searchButton{border-radius:var(--dsw-radius-md);width:36px;height:36px;color:var(--dsw-alias-label-primary)}.YaTVHW_rail .YaTVHW_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.YaTVHW_listArea{min-height:0;margin-left:-4px;margin-right:calc(-1 * var(--dsh-session-list-edge-inset));flex-direction:column;flex:1;padding-left:4px;display:flex;overflow:visible}.YaTVHW_rail .YaTVHW_listArea{margin-left:0;margin-right:0;padding-left:0}.YaTVHW_treeBody{flex-direction:column;flex:1;min-height:0;display:flex;position:relative}.YaTVHW_fade{left:0;right:var(--dsh-session-list-edge-inset);background:linear-gradient(to bottom, transparent, var(--dsw-specific-sidebar-fill));pointer-events:none;height:24px;position:absolute;bottom:0}[data-platform=darwin] .YaTVHW_fade{display:none}.YaTVHW_wide{animation:YaTVHW_wide-in .2s var(--ds-ease-in-out)}@keyframes YaTVHW_wide-in{0%{opacity:0}}.YaTVHW_list{min-height:0;margin-left:-4px;margin-right:var(--dsh-session-list-scrollbar-offset);padding-left:4px;padding-right:calc(var(--dsh-session-list-edge-inset) - var(--dsh-session-list-scrollbar-width) - var(--dsh-session-list-scrollbar-offset));scrollbar-gutter:stable;flex:1;padding-bottom:16px;overflow-y:auto}.YaTVHW_flatList>*+*,.YaTVHW_searchTree>[role=treeitem]+[role=treeitem],.YaTVHW_groupSection>*+*{margin-top:2px}.YaTVHW_recentCanvas{overflow-anchor:none;position:relative}.YaTVHW_recentRow{width:100%;height:34px;position:absolute;top:0;left:0}.YaTVHW_searchStatus{color:var(--dsw-alias-label-tertiary);padding:10px 12px;font-size:12px;line-height:18px}.YaTVHW_skeletonRow{box-sizing:border-box;align-items:flex-start;gap:8px;min-height:48px;padding:6px 8px 7px;display:flex}.YaTVHW_skeletonDot{corner-shape:round;border-radius:50%;flex:none;width:16px;height:16px}.YaTVHW_skeletonBars{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}.YaTVHW_skeletonDot,.YaTVHW_skeletonBar{background:var(--dsw-alias-bg-skeleton);animation:2s cubic-bezier(.36,0,.64,1) infinite YaTVHW_search-skeleton}.YaTVHW_skeletonBar{border-radius:var(--dsw-radius-xs);width:65%;height:16px}.YaTVHW_skeletonBarWide{width:90%;height:13px}@keyframes YaTVHW_search-skeleton{0%{opacity:1}40%{opacity:.6}80%,to{opacity:1}}.YaTVHW_groupSection{position:relative}.YaTVHW_groupSection+.YaTVHW_groupSection{margin-top:4px}.YaTVHW_listTopDropIndicator,.YaTVHW_workspaceDropBefore:before,.YaTVHW_workspaceDropAfter:after{content:\"\";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:0}.YaTVHW_listTopDropIndicator{top:-8px;left:0;right:var(--dsh-session-list-edge-inset)}.YaTVHW_listTopDropActive>.YaTVHW_workspaceDropBefore:first-child:before{display:none}.YaTVHW_workspaceDropBefore:before{top:-8px}.YaTVHW_workspaceDropAfter:after{bottom:-8px}.YaTVHW_sessionOverflowButton{border-radius:var(--dsw-radius-sm);width:100%;height:28px;padding:0 12px 0 calc(28px + var(--dsh-workspace-indent,0px));cursor:pointer;text-align:left;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;font-size:12px}.YaTVHW_groupSection>.YaTVHW_sessionOverflowButton{margin-top:0}.YaTVHW_sessionOverflowButton:hover{color:var(--dsw-alias-label-secondary);background:0 0}.YaTVHW_empty{color:var(--dsw-alias-label-tertiary);padding:16px 12px;font-size:13px}.YaTVHW_emptyState{color:var(--dsw-alias-label-tertiary);flex-direction:column;align-items:center;gap:8px;margin-top:80px;padding:0 12px;font-size:13px;line-height:20px;display:flex}.YaTVHW_emptyState>svg{color:var(--dsw-alias-label-caption);margin-bottom:4px}.YaTVHW_emptyAction{cursor:pointer;color:var(--dsw-alias-link);background:0 0;border:none;padding:0;font-size:13px;line-height:20px}.YaTVHW_renameInput{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);width:100%;height:44px;color:var(--dsw-alias-label-primary);background:0 0;outline:none;padding:7px 14px;font-size:14px;font-weight:400;line-height:22px}.YaTVHW_renameInput:disabled{color:var(--dsw-alias-label-dimmed)}.YaTVHW_renameError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}.YaTVHW_deleteAction:not(:disabled){color:var(--dsw-alias-state-error-primary)}.YaTVHW_deleteStatus{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.YaTVHW_archiveActivity{color:var(--dsw-alias-label-primary);margin:0 0 8px;padding-left:18px;font-size:13px;line-height:20px}.YaTVHW_archiveActivity li{overflow-wrap:anywhere}@media (prefers-reduced-motion:reduce){.YaTVHW_wide,.YaTVHW_skeletonDot,.YaTVHW_skeletonBar{animation:none}.YaTVHW_search,.YaTVHW_sectionLabel,.YaTVHW_searchSlot,.YaTVHW_searchInput,.YaTVHW_headerActions{transition:none}}";
3093
+ const tagId$2 = "@deepseek-ai/dsh-client-ui-workspace/WorkspaceBrowser.module.css";
3094
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
3095
+ const tag = document.createElement("style");
3096
+ tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-workspace";
3097
+ tag.dataset.pluginCss = tagId$2;
3098
+ tag.textContent = css$2;
3099
+ document.head.appendChild(tag);
3100
+ }
3101
+ var WorkspaceBrowser_module_css_default = {
3102
+ "archiveActivity": "YaTVHW_archiveActivity",
3103
+ "clearButton": "YaTVHW_clearButton",
3104
+ "deleteAction": "YaTVHW_deleteAction",
3105
+ "deleteStatus": "YaTVHW_deleteStatus",
3106
+ "empty": "YaTVHW_empty",
3107
+ "emptyAction": "YaTVHW_emptyAction",
3108
+ "emptyState": "YaTVHW_emptyState",
3109
+ "fade": "YaTVHW_fade",
3110
+ "flatList": "YaTVHW_flatList",
3111
+ "groupSection": "YaTVHW_groupSection",
3112
+ "headerActions": "YaTVHW_headerActions",
3113
+ "headerActionsHidden": "YaTVHW_headerActionsHidden",
3114
+ "iconButton": "YaTVHW_iconButton",
3115
+ "list": "YaTVHW_list",
3116
+ "listArea": "YaTVHW_listArea",
3117
+ "listTopDropActive": "YaTVHW_listTopDropActive",
3118
+ "listTopDropIndicator": "YaTVHW_listTopDropIndicator",
3119
+ "rail": "YaTVHW_rail",
3120
+ "recentCanvas": "YaTVHW_recentCanvas",
3121
+ "recentRow": "YaTVHW_recentRow",
3122
+ "renameError": "YaTVHW_renameError",
3123
+ "renameInput": "YaTVHW_renameInput",
3124
+ "root": "YaTVHW_root",
3125
+ "search": "YaTVHW_search",
3126
+ "search-skeleton": "YaTVHW_search-skeleton",
3127
+ "searchButton": "YaTVHW_searchButton",
3128
+ "searchExpanded": "YaTVHW_searchExpanded",
3129
+ "searchInput": "YaTVHW_searchInput",
3130
+ "searchSlot": "YaTVHW_searchSlot",
3131
+ "searchSlotExpanded": "YaTVHW_searchSlotExpanded",
3132
+ "searchStatus": "YaTVHW_searchStatus",
3133
+ "searchTree": "YaTVHW_searchTree",
3134
+ "sectionHeader": "YaTVHW_sectionHeader",
3135
+ "sectionLabel": "YaTVHW_sectionLabel",
3136
+ "sectionLabelHidden": "YaTVHW_sectionLabelHidden",
3137
+ "sessionOverflowButton": "YaTVHW_sessionOverflowButton",
3138
+ "skeletonBar": "YaTVHW_skeletonBar",
3139
+ "skeletonBarWide": "YaTVHW_skeletonBarWide",
3140
+ "skeletonBars": "YaTVHW_skeletonBars",
3141
+ "skeletonDot": "YaTVHW_skeletonDot",
3142
+ "skeletonRow": "YaTVHW_skeletonRow",
3143
+ "treeBody": "YaTVHW_treeBody",
3144
+ "viewOptionsMenu": "YaTVHW_viewOptionsMenu",
3145
+ "wide": "YaTVHW_wide",
3146
+ "wide-in": "YaTVHW_wide-in",
3147
+ "workspaceDropAfter": "YaTVHW_workspaceDropAfter",
3148
+ "workspaceDropBefore": "YaTVHW_workspaceDropBefore"
3149
+ };
3150
+ //#endregion
3151
+ //#region lib/types/client/rows/RecentList.js
3152
+ /** A metadata-only, virtualized timeline across every Workspace. */
3153
+ /** Existing 32px Session cell plus the flat list's 2px inter-row gap. */
3154
+ const ROW_PITCH = 34;
3155
+ /** Project status and mount row extensions only for the viewport and a small overscan. */
3156
+ function RecentList({ list, rowState, useSessionStatus, usePanelInfo, open, requestSessionRename, renderSlot, t, revealSessionId, onSessionRevealed, onLeaveArchivedOnly }) {
3157
+ const { archivedSessionIds, archivedFilter } = rowState;
3158
+ const selectIds = (0, react.useMemo)(() => createRecentSessionSelector({
3159
+ archivedSessionIds,
3160
+ archivedFilter
3161
+ }), [archivedSessionIds, archivedFilter]);
3162
+ const ids = (0, react.useMemo)(() => selectIds(list), [list, selectIds]);
3163
+ const statuses = useSessionStatus((s) => s);
3164
+ const panelActive = usePanelInfo((info) => info.activePanelId !== null);
3165
+ const currentId = (0, react.useMemo)(() => panelActive ? void 0 : list.ids.find((id) => (list.byId[id]?.retainedBy.mainView ?? 0) > 0), [list, panelActive]);
3166
+ const scroller = (0, react.useRef)(null);
3167
+ const [focusedId, setFocusedId] = (0, react.useState)();
3168
+ const pendingFocus = (0, react.useRef)();
3169
+ const focusedIndex = (0, react.useMemo)(() => focusedId === void 0 ? -1 : ids.indexOf(focusedId), [focusedId, ids]);
3170
+ const virtualizer = useVirtualizer({
3171
+ count: ids.length,
3172
+ getScrollElement: (0, react.useCallback)(() => scroller.current, []),
3173
+ getItemKey: (0, react.useCallback)((index) => ids[index] ?? index, [ids]),
3174
+ estimateSize: () => ROW_PITCH,
3175
+ overscan: 6,
3176
+ paddingEnd: 16,
3177
+ rangeExtractor: (0, react.useCallback)((range) => {
3178
+ const indexes = defaultRangeExtractor(range);
3179
+ if (focusedIndex >= 0 && !indexes.includes(focusedIndex)) indexes.push(focusedIndex);
3180
+ return indexes.sort((a, b) => a - b);
3181
+ }, [focusedIndex])
3182
+ });
3183
+ (0, react.useEffect)(() => {
3184
+ if (revealSessionId === void 0) return;
3185
+ const index = ids.indexOf(revealSessionId);
3186
+ if (index === -1) return;
3187
+ virtualizer.scrollToIndex(index, { align: "auto" });
3188
+ onSessionRevealed(revealSessionId);
3189
+ }, [
3190
+ ids,
3191
+ onSessionRevealed,
3192
+ revealSessionId,
3193
+ virtualizer
3194
+ ]);
3195
+ const window = virtualizer.getVirtualItems();
3196
+ (0, react.useLayoutEffect)(() => {
3197
+ if (pendingFocus.current === void 0) return;
3198
+ const row = scroller.current?.querySelector(`[aria-posinset="${pendingFocus.current + 1}"]`);
3199
+ if (row === void 0 || row === null) return;
3200
+ row.focus({ preventScroll: true });
3201
+ pendingFocus.current = void 0;
3202
+ });
3203
+ const rows = (0, react.useMemo)(() => deriveRecentRows(list, window.flatMap((item) => ids[item.index] ?? []), rowState, statuses), [
3204
+ ids,
3205
+ list,
3206
+ rowState,
3207
+ statuses,
3208
+ window
3209
+ ]);
3210
+ const now = Date.now();
3211
+ return (0, react_jsx_runtime.jsxs)("div", {
3212
+ className: clsx(WorkspaceBrowser_module_css_default.treeBody, WorkspaceBrowser_module_css_default.wide),
3213
+ children: [(0, react_jsx_runtime.jsx)("div", {
3214
+ ref: scroller,
3215
+ className: WorkspaceBrowser_module_css_default.list,
3216
+ role: "tree",
3217
+ "aria-label": t("section.recent"),
3218
+ onKeyDown: (event) => {
3219
+ if (!(event.target instanceof HTMLElement) || event.target.getAttribute("role") !== "treeitem") return;
3220
+ const index = Number(event.target.getAttribute("aria-posinset")) - 1;
3221
+ const next = event.key === "ArrowDown" ? index + 1 : event.key === "ArrowUp" ? index - 1 : event.key === "Home" ? 0 : event.key === "End" ? ids.length - 1 : void 0;
3222
+ if (next === void 0) return;
3223
+ event.preventDefault();
3224
+ const target = Math.max(0, Math.min(ids.length - 1, next));
3225
+ pendingFocus.current = target;
3226
+ setFocusedId(ids[target]);
3227
+ virtualizer.scrollToIndex(target, { align: "auto" });
1849
3228
  },
1850
- children: this.props.children
1851
- }), (0, react_jsx_runtime.jsx)("div", {
1852
- ref: this.overlay,
1853
- className: AnimatedRows_module_css_default.exits,
1854
- "aria-hidden": "true"
1855
- })] });
1856
- }
1857
- };
3229
+ children: ids.length === 0 ? (0, react_jsx_runtime.jsxs)("div", {
3230
+ className: WorkspaceBrowser_module_css_default.emptyState,
3231
+ children: [(0, react_jsx_runtime.jsx)("div", { children: archivedFilter === "only" ? t("empty.noneArchived") : t("empty.none") }), archivedFilter === "only" && (0, react_jsx_runtime.jsx)("button", {
3232
+ type: "button",
3233
+ className: WorkspaceBrowser_module_css_default.emptyAction,
3234
+ onClick: onLeaveArchivedOnly,
3235
+ children: t("empty.viewOthers")
3236
+ })]
3237
+ }) : (0, react_jsx_runtime.jsx)("div", {
3238
+ className: WorkspaceBrowser_module_css_default.recentCanvas,
3239
+ style: { height: virtualizer.getTotalSize() },
3240
+ children: rows.map((node, index) => {
3241
+ const item = window[index];
3242
+ if (item === void 0) return null;
3243
+ return (0, react_jsx_runtime.jsx)("div", {
3244
+ className: WorkspaceBrowser_module_css_default.recentRow,
3245
+ style: { transform: `translateY(${item.start}px)` },
3246
+ onFocusCapture: () => {
3247
+ setFocusedId(node.id);
3248
+ },
3249
+ onPointerDownCapture: () => {
3250
+ setFocusedId(node.id);
3251
+ },
3252
+ children: (0, react_jsx_runtime.jsx)(SessionNodeItem, {
3253
+ node,
3254
+ currentId,
3255
+ now,
3256
+ onOpen: open,
3257
+ onRenameRequest: requestSessionRename,
3258
+ renderSlot,
3259
+ position: {
3260
+ index: item.index,
3261
+ total: ids.length
3262
+ },
3263
+ t
3264
+ })
3265
+ }, node.id);
3266
+ })
3267
+ })
3268
+ }), (0, react_jsx_runtime.jsx)("span", { className: WorkspaceBrowser_module_css_default.fade })]
3269
+ });
3270
+ }
1858
3271
  //#endregion
1859
3272
  //#region \0dsh-css:/Users/shiguifeng/IdeaProjects/chonggou/deepseek-harness/packages/client/ui-workspace/src/client/WorkspacePicker.module.css.mjs
1860
3273
  const css$1 = ".w-0k1a_modalAction{min-width:72px}.w-0k1a_modalError,.w-0k1a_menuStatus{margin-top:8px;font-size:12px;line-height:18px}.w-0k1a_modalError{color:var(--dsw-alias-state-error-primary)}.w-0k1a_menuStatus{color:var(--dsw-alias-label-secondary)}";
@@ -2034,64 +3447,6 @@ window.__ModuleLoader__.load({
2034
3447
  });
2035
3448
  }
2036
3449
  //#endregion
2037
- //#region \0dsh-css:/Users/shiguifeng/IdeaProjects/chonggou/deepseek-harness/packages/client/ui-workspace/src/client/rows/WorkspaceBrowser.module.css.mjs
2038
- const css = ".YaTVHW_root{--dsh-session-list-edge-inset:var(--dsh-sidebar-inline-padding);--dsh-session-list-scrollbar-width:5px;--dsh-session-list-scrollbar-offset:2px;box-sizing:border-box;min-height:0;padding-right:var(--dsh-session-list-edge-inset);flex-direction:column;flex:1;display:flex}.YaTVHW_root.YaTVHW_rail{padding-right:0}.YaTVHW_iconButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:28px;height:28px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.YaTVHW_iconButton:focus-visible,.YaTVHW_searchButton:focus-visible,.YaTVHW_clearButton:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.YaTVHW_iconButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.YaTVHW_viewOptionsMenu{min-width:200px}.YaTVHW_sectionHeader{box-sizing:border-box;border-radius:var(--dsw-radius-md);height:36px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:flex-end;align-items:center;gap:4px;margin-bottom:4px;padding-left:4px;display:flex;overflow:hidden}.YaTVHW_root:not(.YaTVHW_rail) .YaTVHW_sectionHeader{margin-top:2px;margin-right:-4px}.YaTVHW_sectionLabel{white-space:nowrap;opacity:1;visibility:visible;min-width:0;max-width:45%;transition:max-width .18s var(--ds-ease-in-out), margin-right .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;line-height:20px;overflow:hidden}.YaTVHW_sectionLabelHidden{opacity:0;visibility:hidden;max-width:0;margin-right:-4px;transition-delay:0s,0s,0s,0s,.18s;transform:translate(-4px)}.YaTVHW_searchSlot{box-sizing:border-box;min-width:0;max-width:28px;transition:max-width .18s var(--ds-ease-in-out), padding-left .18s var(--ds-ease-in-out);flex:1;align-items:center;margin-left:auto;padding-left:0;display:flex}.YaTVHW_searchSlotExpanded{max-width:100%;padding-left:0}.YaTVHW_headerActions{opacity:1;visibility:visible;max-width:60px;transition:max-width .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;align-items:center;gap:4px;display:flex;overflow:hidden}.YaTVHW_headerActionsHidden{opacity:0;visibility:hidden;pointer-events:none;max-width:0;transition-delay:0s,0s,0s,.18s;transform:translate(4px)}.YaTVHW_search{box-sizing:border-box;border-radius:var(--dsw-radius-sm);cursor:text;width:100%;height:28px;color:var(--dsw-alias-label-secondary);transition:width .18s var(--ds-ease-in-out), padding .18s var(--ds-ease-in-out), border-color .18s var(--ds-ease-in-out), background-color .18s var(--ds-ease-in-out);background:0 0;border:none;flex:none;align-items:center;gap:0;margin:0;padding:0;display:flex;overflow:hidden}.YaTVHW_searchExpanded{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);width:calc(100% + 4px);height:30px;color:var(--dsw-alias-label-caption);background:0 0;margin-inline:-2px;padding:0 4px 0 0}.YaTVHW_searchButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:28px;height:28px;color:inherit;background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.YaTVHW_searchExpanded .YaTVHW_searchButton{width:28px;height:30px}.YaTVHW_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.YaTVHW_searchExpanded .YaTVHW_searchButton:hover{background:0 0}.YaTVHW_searchInput{opacity:0;pointer-events:none;width:0;min-width:0;color:var(--dsw-alias-label-primary);transition:opacity .12s var(--ds-ease-in-out);background:0 0;border:none;outline:none;flex:1;font-size:13px;line-height:18px}.YaTVHW_searchExpanded .YaTVHW_searchInput{opacity:1;pointer-events:auto;margin-left:-2px}.YaTVHW_searchInput::placeholder{color:var(--dsw-alias-label-tertiary)}.YaTVHW_clearButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:24px;height:24px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.YaTVHW_clearButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.YaTVHW_rail .YaTVHW_sectionHeader{justify-content:flex-start;gap:0;margin-bottom:12px;padding-left:0}.YaTVHW_rail .YaTVHW_headerActions{max-width:none}.YaTVHW_rail .YaTVHW_iconButton{border-radius:var(--dsw-radius-md);width:36px;height:36px;color:var(--dsw-alias-label-primary)}.YaTVHW_rail .YaTVHW_search{border-radius:var(--dsw-radius-md);background:0 0;border-color:#0000;gap:0;width:36px;height:36px;margin:0 0 12px;padding:0}.YaTVHW_rail .YaTVHW_searchButton{border-radius:var(--dsw-radius-md);width:36px;height:36px;color:var(--dsw-alias-label-primary)}.YaTVHW_rail .YaTVHW_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.YaTVHW_listArea{min-height:0;margin-left:-4px;margin-right:calc(-1 * var(--dsh-session-list-edge-inset));flex-direction:column;flex:1;padding-left:4px;display:flex;overflow:visible}.YaTVHW_rail .YaTVHW_listArea{margin-left:0;margin-right:0;padding-left:0}.YaTVHW_treeBody{flex-direction:column;flex:1;min-height:0;display:flex;position:relative}.YaTVHW_fade{left:0;right:var(--dsh-session-list-edge-inset);background:linear-gradient(to bottom, transparent, var(--dsw-specific-sidebar-fill));pointer-events:none;height:24px;position:absolute;bottom:0}[data-platform=darwin] .YaTVHW_fade{display:none}.YaTVHW_wide{animation:YaTVHW_wide-in .2s var(--ds-ease-in-out)}@keyframes YaTVHW_wide-in{0%{opacity:0}}.YaTVHW_list{min-height:0;margin-left:-4px;margin-right:var(--dsh-session-list-scrollbar-offset);padding-left:4px;padding-right:calc(var(--dsh-session-list-edge-inset) - var(--dsh-session-list-scrollbar-width) - var(--dsh-session-list-scrollbar-offset));scrollbar-gutter:stable;flex:1;padding-bottom:16px;overflow-y:auto}.YaTVHW_flatList>*+*,.YaTVHW_searchTree>[role=treeitem]+[role=treeitem],.YaTVHW_groupSection>*+*{margin-top:2px}.YaTVHW_searchStatus{color:var(--dsw-alias-label-tertiary);padding:10px 12px;font-size:12px;line-height:18px}.YaTVHW_skeletonRow{box-sizing:border-box;align-items:flex-start;gap:8px;min-height:48px;padding:6px 8px 7px;display:flex}.YaTVHW_skeletonDot{corner-shape:round;border-radius:50%;flex:none;width:16px;height:16px}.YaTVHW_skeletonBars{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}.YaTVHW_skeletonDot,.YaTVHW_skeletonBar{background:var(--dsw-alias-bg-skeleton);animation:2s cubic-bezier(.36,0,.64,1) infinite YaTVHW_search-skeleton}.YaTVHW_skeletonBar{border-radius:var(--dsw-radius-xs);width:65%;height:16px}.YaTVHW_skeletonBarWide{width:90%;height:13px}@keyframes YaTVHW_search-skeleton{0%{opacity:1}40%{opacity:.6}80%,to{opacity:1}}.YaTVHW_groupSection{position:relative}.YaTVHW_groupSection+.YaTVHW_groupSection{margin-top:4px}.YaTVHW_listTopDropIndicator,.YaTVHW_workspaceDropBefore:before,.YaTVHW_workspaceDropAfter:after{content:\"\";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:0}.YaTVHW_listTopDropIndicator{top:-8px;left:0;right:var(--dsh-session-list-edge-inset)}.YaTVHW_listTopDropActive>.YaTVHW_workspaceDropBefore:first-child:before{display:none}.YaTVHW_workspaceDropBefore:before{top:-8px}.YaTVHW_workspaceDropAfter:after{bottom:-8px}.YaTVHW_sessionOverflowButton{border-radius:var(--dsw-radius-sm);width:100%;height:28px;padding:0 12px 0 calc(28px + var(--dsh-workspace-indent,0px));cursor:pointer;text-align:left;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;font-size:12px}.YaTVHW_groupSection>.YaTVHW_sessionOverflowButton{margin-top:0}.YaTVHW_sessionOverflowButton:hover{color:var(--dsw-alias-label-secondary);background:0 0}.YaTVHW_empty{color:var(--dsw-alias-label-tertiary);padding:16px 12px;font-size:13px}.YaTVHW_emptyState{color:var(--dsw-alias-label-tertiary);flex-direction:column;align-items:center;gap:8px;margin-top:80px;padding:0 12px;font-size:13px;line-height:20px;display:flex}.YaTVHW_emptyState>svg{color:var(--dsw-alias-label-caption);margin-bottom:4px}.YaTVHW_emptyAction{cursor:pointer;color:var(--dsw-alias-link);background:0 0;border:none;padding:0;font-size:13px;line-height:20px}.YaTVHW_renameInput{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);width:100%;height:44px;color:var(--dsw-alias-label-primary);background:0 0;outline:none;padding:7px 14px;font-size:14px;font-weight:400;line-height:22px}.YaTVHW_renameInput:disabled{color:var(--dsw-alias-label-dimmed)}.YaTVHW_renameError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}.YaTVHW_deleteAction:not(:disabled){color:var(--dsw-alias-state-error-primary)}.YaTVHW_deleteStatus{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.YaTVHW_archiveActivity{color:var(--dsw-alias-label-primary);margin:0 0 8px;padding-left:18px;font-size:13px;line-height:20px}.YaTVHW_archiveActivity li{overflow-wrap:anywhere}@media (prefers-reduced-motion:reduce){.YaTVHW_wide,.YaTVHW_skeletonDot,.YaTVHW_skeletonBar{animation:none}.YaTVHW_search,.YaTVHW_sectionLabel,.YaTVHW_searchSlot,.YaTVHW_searchInput,.YaTVHW_headerActions{transition:none}}";
2039
- const tagId = "@deepseek-ai/dsh-client-ui-workspace/WorkspaceBrowser.module.css";
2040
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
2041
- const tag = document.createElement("style");
2042
- tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-workspace";
2043
- tag.dataset.pluginCss = tagId;
2044
- tag.textContent = css;
2045
- document.head.appendChild(tag);
2046
- }
2047
- var WorkspaceBrowser_module_css_default = {
2048
- "archiveActivity": "YaTVHW_archiveActivity",
2049
- "clearButton": "YaTVHW_clearButton",
2050
- "deleteAction": "YaTVHW_deleteAction",
2051
- "deleteStatus": "YaTVHW_deleteStatus",
2052
- "empty": "YaTVHW_empty",
2053
- "emptyAction": "YaTVHW_emptyAction",
2054
- "emptyState": "YaTVHW_emptyState",
2055
- "fade": "YaTVHW_fade",
2056
- "flatList": "YaTVHW_flatList",
2057
- "groupSection": "YaTVHW_groupSection",
2058
- "headerActions": "YaTVHW_headerActions",
2059
- "headerActionsHidden": "YaTVHW_headerActionsHidden",
2060
- "iconButton": "YaTVHW_iconButton",
2061
- "list": "YaTVHW_list",
2062
- "listArea": "YaTVHW_listArea",
2063
- "listTopDropActive": "YaTVHW_listTopDropActive",
2064
- "listTopDropIndicator": "YaTVHW_listTopDropIndicator",
2065
- "rail": "YaTVHW_rail",
2066
- "renameError": "YaTVHW_renameError",
2067
- "renameInput": "YaTVHW_renameInput",
2068
- "root": "YaTVHW_root",
2069
- "search": "YaTVHW_search",
2070
- "search-skeleton": "YaTVHW_search-skeleton",
2071
- "searchButton": "YaTVHW_searchButton",
2072
- "searchExpanded": "YaTVHW_searchExpanded",
2073
- "searchInput": "YaTVHW_searchInput",
2074
- "searchSlot": "YaTVHW_searchSlot",
2075
- "searchSlotExpanded": "YaTVHW_searchSlotExpanded",
2076
- "searchStatus": "YaTVHW_searchStatus",
2077
- "searchTree": "YaTVHW_searchTree",
2078
- "sectionHeader": "YaTVHW_sectionHeader",
2079
- "sectionLabel": "YaTVHW_sectionLabel",
2080
- "sectionLabelHidden": "YaTVHW_sectionLabelHidden",
2081
- "sessionOverflowButton": "YaTVHW_sessionOverflowButton",
2082
- "skeletonBar": "YaTVHW_skeletonBar",
2083
- "skeletonBarWide": "YaTVHW_skeletonBarWide",
2084
- "skeletonBars": "YaTVHW_skeletonBars",
2085
- "skeletonDot": "YaTVHW_skeletonDot",
2086
- "skeletonRow": "YaTVHW_skeletonRow",
2087
- "treeBody": "YaTVHW_treeBody",
2088
- "viewOptionsMenu": "YaTVHW_viewOptionsMenu",
2089
- "wide": "YaTVHW_wide",
2090
- "wide-in": "YaTVHW_wide-in",
2091
- "workspaceDropAfter": "YaTVHW_workspaceDropAfter",
2092
- "workspaceDropBefore": "YaTVHW_workspaceDropBefore"
2093
- };
2094
- //#endregion
2095
3450
  //#region lib/types/client/rows/WorkspaceBrowser.js
2096
3451
  /**
2097
3452
  * The workspace/session browsing region filling the sidebar shell's
@@ -2181,6 +3536,11 @@ window.__ModuleLoader__.load({
2181
3536
  id: "group-by",
2182
3537
  text: t("groupBy.label")
2183
3538
  },
3539
+ {
3540
+ id: "recent",
3541
+ label: t("section.recent"),
3542
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconClockOutlineRegular, {})
3543
+ },
2184
3544
  {
2185
3545
  id: "workspace",
2186
3546
  label: t("groupBy.workspace"),
@@ -2196,25 +3556,27 @@ window.__ModuleLoader__.load({
2196
3556
  label: t("groupBy.flat"),
2197
3557
  icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFlatListOutlineRegular, {})
2198
3558
  },
2199
- {
2200
- type: "separator",
2201
- id: "order-by-separator"
2202
- },
2203
- {
2204
- type: "label",
2205
- id: "order-by",
2206
- text: t("orderBy.label")
2207
- },
2208
- {
2209
- id: "manual",
2210
- label: t("orderBy.manual"),
2211
- icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronsUpDownOutlineRegular, {})
2212
- },
2213
- {
2214
- id: "updated",
2215
- label: t("orderBy.updated"),
2216
- icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconClockOutlineRegular, {})
2217
- },
3559
+ ...groupBy === "recent" ? [] : [
3560
+ {
3561
+ type: "separator",
3562
+ id: "order-by-separator"
3563
+ },
3564
+ {
3565
+ type: "label",
3566
+ id: "order-by",
3567
+ text: t("orderBy.label")
3568
+ },
3569
+ {
3570
+ id: "manual",
3571
+ label: t("orderBy.manual"),
3572
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronsUpDownOutlineRegular, {})
3573
+ },
3574
+ {
3575
+ id: "updated",
3576
+ label: t("orderBy.updated"),
3577
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconClockOutlineRegular, {})
3578
+ }
3579
+ ],
2218
3580
  {
2219
3581
  type: "separator",
2220
3582
  id: "archived-filter-separator"
@@ -2242,7 +3604,7 @@ window.__ModuleLoader__.load({
2242
3604
  ],
2243
3605
  selectedIds: [
2244
3606
  groupBy,
2245
- orderBy,
3607
+ ...groupBy === "recent" ? [] : [orderBy],
2246
3608
  {
2247
3609
  default: "hide-archived",
2248
3610
  show: "show-archived",
@@ -2250,7 +3612,7 @@ window.__ModuleLoader__.load({
2250
3612
  }[archivedFilter]
2251
3613
  ],
2252
3614
  onSelect: (id) => {
2253
- if (id === "workspace" || id === "workspace-tree" || id === "flat") onGroupPick(id);
3615
+ if (id === "workspace" || id === "workspace-tree" || id === "flat" || id === "recent") onGroupPick(id);
2254
3616
  else if (id === "manual" || id === "updated") onOrderPick(id);
2255
3617
  else if (id === "hide-archived") onArchivedFilterPick("default");
2256
3618
  else if (id === "show-archived") onArchivedFilterPick("show");
@@ -2289,7 +3651,7 @@ window.__ModuleLoader__.load({
2289
3651
  const targetIndex = next.indexOf(target.id);
2290
3652
  if (targetIndex === -1) return;
2291
3653
  next.splice(targetIndex + (over.half === "after" ? 1 : 0), 0, source.id);
2292
- return pinCurrentBlank(next, rows.find((row) => row.blank)?.id);
3654
+ return next;
2293
3655
  }
2294
3656
  /** Resolve an insertion side across the Workspace header, descendants, and Sessions. */
2295
3657
  function workspaceGroupHalf(e) {
@@ -2826,8 +4188,6 @@ window.__ModuleLoader__.load({
2826
4188
  actions.setArchivedFilter("default");
2827
4189
  };
2828
4190
  const workspaceReady = workspacePhase === "ready" && workspaceStreamState !== "loading";
2829
- const mainSessionId = Object.values(list.byId).find((session) => (session.retainedBy.mainView ?? 0) > 0)?.id;
2830
- const currentBlank = mainSessionId !== void 0 && list.byId[mainSessionId]?.blank === true ? mainSessionId : void 0;
2831
4191
  const ungroupedMemberIds = (0, react.useMemo)(() => {
2832
4192
  const accounted = new Set(workspaces.flatMap((workspace) => workspace.sessionIds));
2833
4193
  return list.ids.filter((id) => list.byId[id] !== void 0 && !accounted.has(id));
@@ -2843,13 +4203,13 @@ window.__ModuleLoader__.load({
2843
4203
  const flatMemberIds = (0, react.useMemo)(() => sessionMemberIds(list), [list]);
2844
4204
  const orderedWorkspaces = (0, react.useMemo)(() => workspaces.map((workspace) => {
2845
4205
  const memberIds = workspace.sessionIds;
2846
- const baseOrder = orderBy === "updated" ? orderByRecency(memberIds, list.byId) : reconcileManualOrder(memberIds, sessionOrderByAccount[workspace.workspaceId], list.byId, orderState);
4206
+ const baseOrder = groupBy === "recent" ? memberIds : orderBy === "updated" ? orderByRecency(memberIds, list.byId) : reconcileManualOrder(memberIds, sessionOrderByAccount[workspace.workspaceId], list.byId, orderState);
2847
4207
  return {
2848
4208
  ...workspace,
2849
- sessionIds: pinCurrentBlank(baseOrder, currentBlank !== void 0 && memberIds.includes(currentBlank) ? currentBlank : void 0)
4209
+ sessionIds: baseOrder
2850
4210
  };
2851
4211
  }), [
2852
- currentBlank,
4212
+ groupBy,
2853
4213
  list.byId,
2854
4214
  orderBy,
2855
4215
  orderState,
@@ -2857,9 +4217,9 @@ window.__ModuleLoader__.load({
2857
4217
  workspaces
2858
4218
  ]);
2859
4219
  const orderedUngroupedSessionIds = (0, react.useMemo)(() => {
2860
- return pinCurrentBlank(orderBy === "updated" ? orderByRecency(ungroupedMemberIds, list.byId) : reconcileManualOrder(ungroupedMemberIds, sessionOrderByAccount[""], list.byId, orderState), currentBlank !== void 0 && ungroupedMemberIds.includes(currentBlank) ? currentBlank : void 0);
4220
+ return groupBy === "recent" ? ungroupedMemberIds : orderBy === "updated" ? orderByRecency(ungroupedMemberIds, list.byId) : reconcileManualOrder(ungroupedMemberIds, sessionOrderByAccount[""], list.byId, orderState);
2861
4221
  }, [
2862
- currentBlank,
4222
+ groupBy,
2863
4223
  list.byId,
2864
4224
  orderBy,
2865
4225
  orderState,
@@ -2867,10 +4227,10 @@ window.__ModuleLoader__.load({
2867
4227
  ungroupedMemberIds
2868
4228
  ]);
2869
4229
  const orderedFlatSessionIds = (0, react.useMemo)(() => {
2870
- return pinCurrentBlank(orderBy === "updated" ? orderByRecency(flatMemberIds, list.byId) : reconcileManualOrder(flatMemberIds, sessionOrderByAccount[FLAT_SESSION_ORDER_KEY], list.byId, orderState), currentBlank !== void 0 && flatMemberIds.includes(currentBlank) ? currentBlank : void 0);
4230
+ return groupBy === "recent" ? flatMemberIds : orderBy === "updated" ? orderByRecency(flatMemberIds, list.byId) : reconcileManualOrder(flatMemberIds, sessionOrderByAccount[FLAT_SESSION_ORDER_KEY], list.byId, orderState);
2871
4231
  }, [
2872
- currentBlank,
2873
4232
  flatMemberIds,
4233
+ groupBy,
2874
4234
  list.byId,
2875
4235
  orderBy,
2876
4236
  orderState,
@@ -2897,38 +4257,6 @@ window.__ModuleLoader__.load({
2897
4257
  workspacePhase,
2898
4258
  workspaces
2899
4259
  ]);
2900
- (0, react.useEffect)(() => {
2901
- if (list.phase !== "ready" || workspaceReady || orderBy !== "manual" || currentBlank === void 0) return;
2902
- const changed = {};
2903
- for (const [key, ids] of Object.entries(activeSessionOrders)) {
2904
- if (key !== "__flat_session_order__" && workspacePhase !== "ready") continue;
2905
- const saved = sessionOrderByAccount[key] ?? [];
2906
- if (ids[0] !== currentBlank || saved[0] === currentBlank) continue;
2907
- changed[key] = [currentBlank, ...saved.filter((id) => id !== currentBlank)];
2908
- }
2909
- if (Object.keys(changed).length > 0) actions.syncSessionOrders(changed);
2910
- }, [
2911
- actions.syncSessionOrders,
2912
- activeSessionOrders,
2913
- currentBlank,
2914
- list.phase,
2915
- orderBy,
2916
- sessionOrderByAccount,
2917
- workspacePhase,
2918
- workspaceReady
2919
- ]);
2920
- (0, react.useEffect)(() => {
2921
- if (list.phase !== "ready" || !workspaceReady || orderBy !== "manual" || currentBlank === void 0) return;
2922
- if (Object.entries(activeSessionOrders).some(([key, ids]) => ids[0] === currentBlank && sessionOrderByAccount[key]?.[0] !== currentBlank)) actions.syncSessionOrders(activeSessionOrders);
2923
- }, [
2924
- actions.syncSessionOrders,
2925
- activeSessionOrders,
2926
- currentBlank,
2927
- list.phase,
2928
- orderBy,
2929
- sessionOrderByAccount,
2930
- workspaceReady
2931
- ]);
2932
4260
  const saveSessionOrder = (accountKey, order) => {
2933
4261
  actions.setSessionOrder(accountKey, order, activeSessionOrders);
2934
4262
  };
@@ -3116,7 +4444,7 @@ window.__ModuleLoader__.load({
3116
4444
  children: [
3117
4445
  wide && (0, react_jsx_runtime.jsx)("span", {
3118
4446
  className: clsx(WorkspaceBrowser_module_css_default.sectionLabel, WorkspaceBrowser_module_css_default.wide, searchExpanded && WorkspaceBrowser_module_css_default.sectionLabelHidden),
3119
- children: groupBy === "flat" ? t("section.sessions") : t("section.workspaces")
4447
+ children: groupBy === "recent" ? t("section.recent") : groupBy === "flat" ? t("section.sessions") : t("section.workspaces")
3120
4448
  }),
3121
4449
  wide && (0, react_jsx_runtime.jsx)("div", {
3122
4450
  className: clsx(WorkspaceBrowser_module_css_default.searchSlot, searchExpanded && WorkspaceBrowser_module_css_default.searchSlotExpanded),
@@ -3180,33 +4508,51 @@ window.__ModuleLoader__.load({
3180
4508
  }),
3181
4509
  (0, react_jsx_runtime.jsxs)("div", {
3182
4510
  className: clsx(WorkspaceBrowser_module_css_default.headerActions, wide && searchExpanded && WorkspaceBrowser_module_css_default.headerActionsHidden),
3183
- children: [wide && (0, react_jsx_runtime.jsx)(ViewOptionsMenu, {
3184
- groupBy,
3185
- orderBy,
3186
- archivedFilter,
3187
- onGroupPick: actions.setGroupBy,
3188
- onOrderPick: (mode) => {
3189
- actions.setOrderBy(mode, activeSessionOrders);
3190
- },
3191
- onArchivedFilterPick: actions.setArchivedFilter,
3192
- t
3193
- }), directoryFlowAvailable && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
3194
- label: t("workspace.add"),
3195
- shortcutKeys: addShortcut?.keys,
3196
- side: "bottom",
3197
- delayMs: 500,
3198
- children: (0, react_jsx_runtime.jsx)("button", {
3199
- ref: wsPlusRef,
3200
- type: "button",
3201
- className: WorkspaceBrowser_module_css_default.iconButton,
3202
- "aria-label": t("workspace.add"),
3203
- "aria-keyshortcuts": addShortcut?.aria,
3204
- onClick: () => {
3205
- requestAddWorkspace();
4511
+ children: [
4512
+ wide && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
4513
+ label: t("section.recent"),
4514
+ side: "bottom",
4515
+ delayMs: 500,
4516
+ children: (0, react_jsx_runtime.jsx)("button", {
4517
+ type: "button",
4518
+ className: clsx(WorkspaceBrowser_module_css_default.iconButton, WorkspaceBrowser_module_css_default.wide),
4519
+ "aria-label": t("section.recent"),
4520
+ "aria-pressed": groupBy === "recent",
4521
+ onClick: () => {
4522
+ actions.setGroupBy("recent");
4523
+ },
4524
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconClockOutlineRegular, {})
4525
+ })
4526
+ }),
4527
+ wide && (0, react_jsx_runtime.jsx)(ViewOptionsMenu, {
4528
+ groupBy,
4529
+ orderBy,
4530
+ archivedFilter,
4531
+ onGroupPick: actions.setGroupBy,
4532
+ onOrderPick: (mode) => {
4533
+ actions.setOrderBy(mode, activeSessionOrders);
3206
4534
  },
3207
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconProjectAddOutlineRegular, { size: wide ? 16 : 18 })
4535
+ onArchivedFilterPick: actions.setArchivedFilter,
4536
+ t
4537
+ }),
4538
+ directoryFlowAvailable && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
4539
+ label: t("workspace.add"),
4540
+ shortcutKeys: addShortcut?.keys,
4541
+ side: "bottom",
4542
+ delayMs: 500,
4543
+ children: (0, react_jsx_runtime.jsx)("button", {
4544
+ ref: wsPlusRef,
4545
+ type: "button",
4546
+ className: WorkspaceBrowser_module_css_default.iconButton,
4547
+ "aria-label": t("workspace.add"),
4548
+ "aria-keyshortcuts": addShortcut?.aria,
4549
+ onClick: () => {
4550
+ requestAddWorkspace();
4551
+ },
4552
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconProjectAddOutlineRegular, { size: wide ? 16 : 18 })
4553
+ })
3208
4554
  })
3209
- })]
4555
+ ]
3210
4556
  }),
3211
4557
  (0, react_jsx_runtime.jsx)(WorkspacePickFlow, {
3212
4558
  t,
@@ -3261,7 +4607,19 @@ window.__ModuleLoader__.load({
3261
4607
  remote: remoteSearch,
3262
4608
  resultLimit: searchResultLimit,
3263
4609
  t
3264
- }) : groupBy === "flat" ? (0, react_jsx_runtime.jsx)(FlatList, {
4610
+ }) : groupBy === "recent" ? (0, react_jsx_runtime.jsx)(RecentList, {
4611
+ list,
4612
+ rowState,
4613
+ usePanelInfo,
4614
+ useSessionStatus,
4615
+ open: guardedOpen,
4616
+ requestSessionRename,
4617
+ renderSlot,
4618
+ revealSessionId,
4619
+ onSessionRevealed: acknowledgeSessionReveal,
4620
+ onLeaveArchivedOnly: leaveArchivedOnly,
4621
+ t
4622
+ }, archivedFilter) : groupBy === "flat" ? (0, react_jsx_runtime.jsx)(FlatList, {
3265
4623
  usePanelInfo,
3266
4624
  list,
3267
4625
  sessionIds: orderedFlatSessionIds,
@@ -3835,6 +5193,11 @@ window.__ModuleLoader__.load({
3835
5193
  onDone: dismissToast
3836
5194
  }, `toast-${String(toast.seq)}`);
3837
5195
  }
5196
+ if (toast.kind === "sessionOperation") return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Toast, {
5197
+ text: toast.message,
5198
+ ...toast.success ? { tone: "success" } : {},
5199
+ onDone: dismissToast
5200
+ }, `toast-${String(toast.seq)}`);
3838
5201
  if (toast.kind === "createFailed") return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Toast, {
3839
5202
  text: t("toast.createFailed", { message: toast.message }),
3840
5203
  icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconWarningOutlineRegular, {}),
@@ -3859,6 +5222,232 @@ window.__ModuleLoader__.load({
3859
5222
  }
3860
5223
  }
3861
5224
  //#endregion
5225
+ //#region \0dsh-css:/Users/shiguifeng/IdeaProjects/chonggou/deepseek-harness/packages/client/ui-workspace/src/client/ArchivedSessions.module.css.mjs
5226
+ const css = ".CxM1Ra_root{color:var(--dsw-alias-label-primary);font-size:13px}.CxM1Ra_root h2{margin:0 0 12px;font-size:16px;font-weight:500}.CxM1Ra_root p{color:var(--dsw-alias-label-secondary);line-height:1.6}.CxM1Ra_search{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm);width:100%;color:inherit;font:inherit;background:0 0;padding:8px 12px}.CxM1Ra_list{padding:0;list-style:none}.CxM1Ra_row{border-bottom:.5px solid var(--dsw-alias-border-l4);align-items:center;gap:8px;min-height:44px;display:flex}.CxM1Ra_title{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.CxM1Ra_danger:not(:disabled),.CxM1Ra_root .CxM1Ra_error{color:var(--dsw-alias-state-error-primary)}.CxM1Ra_pagination{justify-content:flex-end;align-items:center;gap:12px;display:flex}";
5227
+ const tagId = "@deepseek-ai/dsh-client-ui-workspace/ArchivedSessions.module.css";
5228
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
5229
+ const tag = document.createElement("style");
5230
+ tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-workspace";
5231
+ tag.dataset.pluginCss = tagId;
5232
+ tag.textContent = css;
5233
+ document.head.appendChild(tag);
5234
+ }
5235
+ var ArchivedSessions_module_css_default = {
5236
+ "danger": "CxM1Ra_danger",
5237
+ "error": "CxM1Ra_error",
5238
+ "list": "CxM1Ra_list",
5239
+ "pagination": "CxM1Ra_pagination",
5240
+ "root": "CxM1Ra_root",
5241
+ "row": "CxM1Ra_row",
5242
+ "search": "CxM1Ra_search",
5243
+ "title": "CxM1Ra_title"
5244
+ };
5245
+ //#endregion
5246
+ //#region lib/types/client/ArchivedSessions.js
5247
+ /** Metadata-only archived-session management with bounded pages and confirmed deletion. */
5248
+ const PAGE_SIZE = 30;
5249
+ /** Archived roots, including archived empty Sessions, with one global search and bounded DOM. */
5250
+ function ArchivedSessions({ useSessions, useWorkspaces, requestDelete, restore, failureText, t }) {
5251
+ const list = useSessions((s) => s);
5252
+ const archived = useWorkspaces((s) => s.archivedSessionIds);
5253
+ const [query, setQuery] = (0, react.useState)("");
5254
+ const [page, setPage] = (0, react.useState)(0);
5255
+ const [pending, setPending] = (0, react.useState)();
5256
+ const busy = (0, react.useRef)(false);
5257
+ const [error, setError] = (0, react.useState)();
5258
+ const ids = (0, react.useMemo)(() => {
5259
+ const needle = query.trim().toLocaleLowerCase();
5260
+ return orderByRecency(archived.filter((id) => {
5261
+ const item = list.byId[id];
5262
+ return item !== void 0 && item.origin !== "subagent" && item.displayTitle.toLocaleLowerCase().includes(needle);
5263
+ }), list.byId);
5264
+ }, [
5265
+ archived,
5266
+ list.byId,
5267
+ query
5268
+ ]);
5269
+ const pages = Math.max(1, Math.ceil(ids.length / PAGE_SIZE));
5270
+ const current = Math.min(page, pages - 1);
5271
+ const run = async (id, operation) => {
5272
+ if (busy.current) return;
5273
+ busy.current = true;
5274
+ setPending(id);
5275
+ setError(void 0);
5276
+ try {
5277
+ await operation();
5278
+ } catch (reason) {
5279
+ setError(failureText(reason));
5280
+ } finally {
5281
+ busy.current = false;
5282
+ setPending(void 0);
5283
+ }
5284
+ };
5285
+ return (0, react_jsx_runtime.jsxs)("section", {
5286
+ className: ArchivedSessions_module_css_default.root,
5287
+ children: [
5288
+ (0, react_jsx_runtime.jsx)("h2", { children: t("archive.manager.title") }),
5289
+ (0, react_jsx_runtime.jsx)("p", { children: t("archive.manager.description") }),
5290
+ (0, react_jsx_runtime.jsx)("input", {
5291
+ className: ArchivedSessions_module_css_default.search,
5292
+ "aria-label": t("archive.manager.search"),
5293
+ placeholder: t("archive.manager.search"),
5294
+ value: query,
5295
+ onChange: (event) => {
5296
+ setQuery(event.target.value);
5297
+ setPage(0);
5298
+ }
5299
+ }),
5300
+ error !== void 0 && (0, react_jsx_runtime.jsx)("p", {
5301
+ role: "alert",
5302
+ className: ArchivedSessions_module_css_default.error,
5303
+ children: error
5304
+ }),
5305
+ (0, react_jsx_runtime.jsx)("ul", {
5306
+ className: ArchivedSessions_module_css_default.list,
5307
+ "aria-label": t("archive.manager.title"),
5308
+ children: ids.slice(current * PAGE_SIZE, (current + 1) * PAGE_SIZE).map((id) => {
5309
+ const item = list.byId[id];
5310
+ if (item === void 0) return null;
5311
+ return (0, react_jsx_runtime.jsxs)("li", {
5312
+ className: ArchivedSessions_module_css_default.row,
5313
+ children: [
5314
+ (0, react_jsx_runtime.jsx)("span", {
5315
+ className: ArchivedSessions_module_css_default.title,
5316
+ title: item.displayTitle,
5317
+ children: item.displayTitle
5318
+ }),
5319
+ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
5320
+ size: "sm",
5321
+ disabled: pending !== void 0,
5322
+ "aria-label": t("archive.manager.restoreAria", { title: item.displayTitle }),
5323
+ onClick: () => {
5324
+ run(id, () => restore(id));
5325
+ },
5326
+ children: t("archive.manager.restore")
5327
+ }),
5328
+ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
5329
+ size: "sm",
5330
+ className: ArchivedSessions_module_css_default.danger,
5331
+ disabled: pending !== void 0,
5332
+ "aria-label": t("archive.manager.deleteAria", { title: item.displayTitle }),
5333
+ onClick: () => {
5334
+ run(id, () => requestDelete(id));
5335
+ },
5336
+ children: t("archive.manager.delete")
5337
+ })
5338
+ ]
5339
+ }, id);
5340
+ })
5341
+ }),
5342
+ ids.length === 0 && (0, react_jsx_runtime.jsx)("p", { children: query.trim() === "" ? t("empty.noneArchived") : t("empty.noMatches") }),
5343
+ pages > 1 && (0, react_jsx_runtime.jsxs)("div", {
5344
+ className: ArchivedSessions_module_css_default.pagination,
5345
+ children: [
5346
+ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
5347
+ size: "sm",
5348
+ disabled: current === 0,
5349
+ onClick: () => {
5350
+ setPage(current - 1);
5351
+ },
5352
+ children: t("archive.manager.previous")
5353
+ }),
5354
+ (0, react_jsx_runtime.jsx)("span", { children: t("archive.manager.page", {
5355
+ page: current + 1,
5356
+ pages
5357
+ }) }),
5358
+ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
5359
+ size: "sm",
5360
+ disabled: current + 1 >= pages,
5361
+ onClick: () => {
5362
+ setPage(current + 1);
5363
+ },
5364
+ children: t("archive.manager.next")
5365
+ })
5366
+ ]
5367
+ })
5368
+ ]
5369
+ });
5370
+ }
5371
+ //#endregion
5372
+ //#region lib/types/client/session-actions/DeleteSession.js
5373
+ /** Archived-only permanent deletion; both entry points share this confirmation. */
5374
+ /** Permanent deletion is offered only for archived rows. */
5375
+ function DeleteSessionMenuItem({ sessionId, useArchived, useMenuOpenState, requestDelete, t }) {
5376
+ const archived = useArchived((ids) => ids.has(sessionId));
5377
+ const [, setMenuOpen] = useMenuOpenState();
5378
+ if (!archived) return null;
5379
+ return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuItemButton, {
5380
+ onSelect: () => {
5381
+ setMenuOpen(false);
5382
+ requestDelete(sessionId);
5383
+ },
5384
+ children: t("archive.manager.delete")
5385
+ });
5386
+ }
5387
+ /** The dialog outlives the menu or settings page that raised it. */
5388
+ function SessionDeleteDialog(props) {
5389
+ const request = props.useRequest((value) => value);
5390
+ if (request === null) return null;
5391
+ return (0, react_jsx_runtime.jsx)(DeleteForm, {
5392
+ request,
5393
+ dismiss: props.dismiss,
5394
+ remove: props.remove,
5395
+ failureText: props.failureText,
5396
+ t: props.t
5397
+ }, request.id);
5398
+ }
5399
+ function DeleteForm({ request, dismiss, remove, failureText, t }) {
5400
+ const busy = (0, react.useRef)(false);
5401
+ const [pending, setPending] = (0, react.useState)(false);
5402
+ const [error, setError] = (0, react.useState)();
5403
+ const close = () => {
5404
+ if (!busy.current) dismiss();
5405
+ };
5406
+ const confirm = async () => {
5407
+ if (busy.current) return;
5408
+ busy.current = true;
5409
+ setPending(true);
5410
+ setError(void 0);
5411
+ try {
5412
+ await remove(request.id, request.scope);
5413
+ dismiss();
5414
+ } catch (reason) {
5415
+ setError(failureText(reason));
5416
+ } finally {
5417
+ busy.current = false;
5418
+ setPending(false);
5419
+ }
5420
+ };
5421
+ return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
5422
+ open: true,
5423
+ title: t("archive.manager.confirmTitle"),
5424
+ closeLabel: t("close"),
5425
+ onClose: close,
5426
+ description: t("archive.manager.confirmDescription", {
5427
+ title: request.title,
5428
+ count: request.scope.length
5429
+ }),
5430
+ footer: (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
5431
+ "data-modal-autofocus": true,
5432
+ disabled: pending,
5433
+ onClick: close,
5434
+ children: t("cancel")
5435
+ }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
5436
+ className: ArchivedSessions_module_css_default.danger,
5437
+ disabled: pending,
5438
+ onClick: () => {
5439
+ confirm();
5440
+ },
5441
+ children: t(pending ? "archive.manager.deleting" : "archive.manager.delete")
5442
+ })] }),
5443
+ children: error !== void 0 && (0, react_jsx_runtime.jsx)("p", {
5444
+ role: "alert",
5445
+ className: ArchivedSessions_module_css_default.error,
5446
+ children: error
5447
+ })
5448
+ });
5449
+ }
5450
+ //#endregion
3862
5451
  //#region lib/types/client/locales.js
3863
5452
  /**
3864
5453
  * `workspace` namespace dictionaries: the browsing region (section header,
@@ -3867,6 +5456,25 @@ window.__ModuleLoader__.load({
3867
5456
  */
3868
5457
  /** Simplified Chinese dictionary (the key-set source of truth). */
3869
5458
  const zh = {
5459
+ "archive.manager.title": "已归档会话",
5460
+ "archive.manager.description": "归档保留会话记录,可恢复后继续。永久删除会同时移除该会话及其子代理记录,无法撤销。",
5461
+ "archive.manager.search": "搜索已归档会话",
5462
+ "archive.manager.restoreAria": "恢复会话“{title}”",
5463
+ "archive.manager.deleteAria": "永久删除会话“{title}”",
5464
+ "archive.manager.restore": "恢复",
5465
+ "archive.manager.delete": "永久删除",
5466
+ "archive.manager.previous": "上一页",
5467
+ "archive.manager.next": "下一页",
5468
+ "archive.manager.page": "第 {page} / {pages} 页",
5469
+ "archive.manager.confirmTitle": "永久删除会话?",
5470
+ "archive.manager.confirmDescription": "将永久删除“{title}”及其所属子代理,共 {count} 条会话记录,无法撤销。独立分叉、工作区文件与 Git 数据会保留。",
5471
+ "archive.manager.deleting": "正在删除…",
5472
+ "archive.manager.busy": "会话仍在使用或有任务运行,请关闭相关会话并稍后重试。",
5473
+ "archive.manager.notArchived": "请先归档该会话,再执行永久删除。",
5474
+ "archive.manager.scopeChanged": "会话的子代理记录已变化,请重新打开删除确认。",
5475
+ "archive.manager.deleted": "会话已永久删除。",
5476
+ "archive.manager.restored": "会话已恢复。",
5477
+ "archive.manager.failed": "操作失败,请重试。",
3870
5478
  "defaultWorkspace.failed": "无法创建默认工作区,请通过“选择工作区”选择文件夹",
3871
5479
  "group.ungrouped": "未分组",
3872
5480
  "session.new": "新会话",
@@ -3877,6 +5485,7 @@ window.__ModuleLoader__.load({
3877
5485
  "shortcut.forkFailed": "无法分叉会话,请重试",
3878
5486
  "section.workspaces": "工作区",
3879
5487
  "section.sessions": "会话",
5488
+ "section.recent": "最近会话",
3880
5489
  "viewOptions.label": "视图选项",
3881
5490
  "groupBy.label": "分组方式",
3882
5491
  "groupBy.workspace": "按工作区",
@@ -3982,6 +5591,25 @@ window.__ModuleLoader__.load({
3982
5591
  };
3983
5592
  /** English dictionary, checked complete against the zh key set. */
3984
5593
  const en = {
5594
+ "archive.manager.title": "Archived sessions",
5595
+ "archive.manager.description": "Archiving keeps the conversation for later. Permanent deletion removes the session and its subagent records and cannot be undone.",
5596
+ "archive.manager.search": "Search archived sessions",
5597
+ "archive.manager.restoreAria": "Restore session “{title}”",
5598
+ "archive.manager.deleteAria": "Permanently delete session “{title}”",
5599
+ "archive.manager.restore": "Restore",
5600
+ "archive.manager.delete": "Permanently delete",
5601
+ "archive.manager.previous": "Previous",
5602
+ "archive.manager.next": "Next",
5603
+ "archive.manager.page": "Page {page} of {pages}",
5604
+ "archive.manager.confirmTitle": "Permanently delete session?",
5605
+ "archive.manager.confirmDescription": "Permanently delete “{title}” and its owned subagents ({count} session records). This cannot be undone. Independent forks, workspace files and Git data are kept.",
5606
+ "archive.manager.deleting": "Deleting…",
5607
+ "archive.manager.busy": "The session is still in use or has running work. Close it and try again.",
5608
+ "archive.manager.notArchived": "Archive this session before permanently deleting it.",
5609
+ "archive.manager.scopeChanged": "The subagent records changed. Reopen the deletion confirmation.",
5610
+ "archive.manager.deleted": "Session permanently deleted.",
5611
+ "archive.manager.restored": "Session restored.",
5612
+ "archive.manager.failed": "The operation failed. Try again.",
3985
5613
  "defaultWorkspace.failed": "Unable to create default workspace. Use Choose workspace to select a folder.",
3986
5614
  "group.ungrouped": "Ungrouped",
3987
5615
  "session.new": "New Session",
@@ -3992,6 +5620,7 @@ window.__ModuleLoader__.load({
3992
5620
  "shortcut.forkFailed": "Could not fork the session. Try again.",
3993
5621
  "section.workspaces": "Workspaces",
3994
5622
  "section.sessions": "Sessions",
5623
+ "section.recent": "Recent sessions",
3995
5624
  "viewOptions.label": "View options",
3996
5625
  "groupBy.label": "Group by",
3997
5626
  "groupBy.workspace": "WorkSpace",
@@ -4169,6 +5798,57 @@ window.__ModuleLoader__.load({
4169
5798
  const archivedSet = derive(workspaces.list, (snapshot) => new Set(snapshot.archivedSessionIds));
4170
5799
  const renameRequest = derive(shortcutControls.state, (state) => state.renameTarget);
4171
5800
  const archiveRequest = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)(null);
5801
+ const deleteRequest = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)(null);
5802
+ const t = ctx.locale.bind(NS);
5803
+ const failureText = (reason) => {
5804
+ if (reason instanceof Error && reason.name === "WorkspaceArchiveError") {
5805
+ const { rpcError } = reason;
5806
+ if (rpcError.code === "workspace/session-active") return t("archive.manager.busy");
5807
+ if (rpcError.code === "workspace/session-delete-refused") switch (rpcError.details.reason) {
5808
+ case "in-use": return t("archive.manager.busy");
5809
+ case "not-archived": return t("archive.manager.notArchived");
5810
+ case "scope-changed": return t("archive.manager.scopeChanged");
5811
+ case "deleted": return t("archive.manager.deleted");
5812
+ }
5813
+ }
5814
+ return t("archive.manager.failed");
5815
+ };
5816
+ const requestDelete = async (id) => {
5817
+ const scope = await workspaces.sessionDeletionScope(id);
5818
+ const title = sessions.list.getSnapshot().byId[id]?.displayTitle ?? id;
5819
+ deleteRequest.set({
5820
+ id,
5821
+ title,
5822
+ scope
5823
+ });
5824
+ };
5825
+ const remove = async (id, scope) => {
5826
+ await workspaces.deleteSession(id, scope);
5827
+ notify({
5828
+ kind: "sessionOperation",
5829
+ message: t("archive.manager.deleted"),
5830
+ success: true
5831
+ });
5832
+ };
5833
+ ctx.slots.inject("settings.section", () => ctx.slots.register({
5834
+ name: "settings.section",
5835
+ id: "archived-sessions",
5836
+ order: 40,
5837
+ locale: NS,
5838
+ label: () => t("archive.manager.title"),
5839
+ inject: () => ({
5840
+ requestDelete,
5841
+ failureText,
5842
+ restore: async (id) => {
5843
+ await workspaces.unarchiveSession(id);
5844
+ notify({
5845
+ kind: "sessionOperation",
5846
+ message: t("archive.manager.restored"),
5847
+ success: true
5848
+ });
5849
+ }
5850
+ })
5851
+ }, ArchivedSessions));
4172
5852
  const requestSessionRename = shortcutControls.rename;
4173
5853
  const unarchiveSession = (sessionId) => {
4174
5854
  uiWorkspace.unarchiveSession(sessionId).catch((reason) => {
@@ -4353,6 +6033,24 @@ window.__ModuleLoader__.load({
4353
6033
  locale: NS,
4354
6034
  inject: archiveInjected
4355
6035
  }, ArchiveSessionMenuItem);
6036
+ yield ctx.slots.register({
6037
+ name: "sidebar.workspaces.session.menu.item",
6038
+ id: "delete",
6039
+ order: 500,
6040
+ locale: NS,
6041
+ inject: () => ({
6042
+ hooks: { archived: archivedSet },
6043
+ requestDelete: (id) => {
6044
+ requestDelete(id).catch((reason) => {
6045
+ notify({
6046
+ kind: "sessionOperation",
6047
+ message: failureText(reason),
6048
+ success: false
6049
+ });
6050
+ });
6051
+ }
6052
+ })
6053
+ }, DeleteSessionMenuItem);
4356
6054
  });
4357
6055
  ctx.slots.inject("sidebar.workspaces.session.row.action", function* () {
4358
6056
  yield ctx.slots.register({
@@ -4371,6 +6069,19 @@ window.__ModuleLoader__.load({
4371
6069
  }, PinSessionRowButton);
4372
6070
  });
4373
6071
  ctx.slots.inject("shell.overlay", function* () {
6072
+ yield ctx.slots.register({
6073
+ name: "shell.overlay",
6074
+ id: "workspace.session-delete",
6075
+ locale: NS,
6076
+ inject: () => ({
6077
+ hooks: { request: deleteRequest },
6078
+ dismiss: () => {
6079
+ deleteRequest.set(null);
6080
+ },
6081
+ remove,
6082
+ failureText
6083
+ })
6084
+ }, SessionDeleteDialog);
4374
6085
  yield ctx.slots.register({
4375
6086
  name: "shell.overlay",
4376
6087
  id: "workspace.session-rename",