@simon_he/vue-tui 0.0.8 → 1.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/README.md +130 -27
  2. package/dist/TSelect-BmSkar0D.js +8697 -0
  3. package/dist/ansi-palette-Bv5Vqr4k.js +1499 -0
  4. package/dist/ansi-styles.d.ts +200 -0
  5. package/dist/cli/headless-renderer.d.ts +29 -0
  6. package/dist/cli/input.d.ts +49 -0
  7. package/dist/cli/node-file-writers.d.ts +12 -0
  8. package/dist/cli/node-module.d.ts +2 -0
  9. package/dist/cli/parse-kitty.d.ts +2 -0
  10. package/dist/cli/parse-mouse.d.ts +2 -0
  11. package/dist/cli/parse-utils.d.ts +14 -0
  12. package/dist/cli/parse-xterm.d.ts +2 -0
  13. package/dist/cli/path-provider-types.d.ts +1 -0
  14. package/dist/cli/path-provider.d.ts +4 -0
  15. package/dist/cli/path-suggest-core.d.ts +1 -0
  16. package/dist/cli/path-suggest.d.ts +15 -0
  17. package/dist/cli/recording.d.ts +4 -0
  18. package/dist/cli/stdin-buffer.d.ts +33 -0
  19. package/dist/cli.cjs +10664 -0
  20. package/dist/cli.d.cts +22 -0
  21. package/dist/cli.d.ts +22 -0
  22. package/dist/cli.js +9521 -0
  23. package/dist/core/ansi/capability.d.ts +20 -0
  24. package/dist/core/ansi/colors.d.ts +41 -0
  25. package/dist/core/ansi/sgr.d.ts +7 -0
  26. package/dist/core/ansi/theme.d.ts +6 -0
  27. package/dist/core/ansi-palette.d.ts +14 -0
  28. package/dist/core/buffer/buffer.d.ts +54 -0
  29. package/dist/core/buffer/width.d.ts +4 -0
  30. package/dist/core/debug-logger.d.ts +18 -0
  31. package/dist/core/hyperlink.d.ts +9 -0
  32. package/dist/core/index.d.ts +4 -0
  33. package/dist/core/path-provider-types.d.ts +24 -0
  34. package/dist/core/path-suggest.d.ts +35 -0
  35. package/dist/core/render-plane.d.ts +3 -0
  36. package/dist/core/terminal/create-terminal.d.ts +7 -0
  37. package/dist/core/terminal/emitter.d.ts +7 -0
  38. package/dist/core/types.d.ts +107 -0
  39. package/dist/core.cjs +3072 -0
  40. package/dist/core.d.cts +14 -0
  41. package/dist/core.d.ts +14 -0
  42. package/dist/core.js +422 -0
  43. package/dist/create-terminal-app.d.ts +34 -0
  44. package/dist/dom-renderer-CDVQIcIL.js +1172 -0
  45. package/dist/events/index.d.ts +6 -0
  46. package/dist/events/manager/cli-event-manager.d.ts +22 -0
  47. package/dist/events/manager/event-manager.d.ts +30 -0
  48. package/dist/events/manager/selection-suppression.d.ts +3 -0
  49. package/dist/events/manager/types.d.ts +108 -0
  50. package/dist/events/recording.d.ts +44 -0
  51. package/dist/experimental.cjs +1777 -1244
  52. package/dist/experimental.d.cts +39 -0
  53. package/dist/experimental.d.ts +39 -825
  54. package/dist/experimental.js +492 -343
  55. package/dist/frame-perf-C-w8mjJL.js +98 -0
  56. package/dist/hyperlink-B5PD7a3Q.js +331 -0
  57. package/dist/index.cjs +13133 -19960
  58. package/dist/index.d.cts +13 -0
  59. package/dist/index.d.ts +13 -1528
  60. package/dist/index.js +13 -20026
  61. package/dist/markdown.cjs +8728 -7359
  62. package/dist/markdown.d.cts +10 -0
  63. package/dist/markdown.d.ts +10 -112
  64. package/dist/markdown.js +169 -101
  65. package/dist/observability/cli-latency-node.d.ts +3 -0
  66. package/dist/observability/cli-latency-types.d.ts +41 -0
  67. package/dist/observability/cli-latency.d.ts +3 -0
  68. package/dist/observability/frame-perf-store.d.ts +13 -0
  69. package/dist/observability/frame-perf.d.ts +40 -0
  70. package/dist/observability/trace.d.ts +40 -0
  71. package/dist/observability/tui-profiler.d.ts +33 -0
  72. package/dist/observability.cjs +99 -0
  73. package/dist/observability.d.cts +6 -0
  74. package/dist/observability.d.ts +6 -0
  75. package/dist/observability.js +3 -0
  76. package/dist/path-DDiSCXrQ.js +99 -0
  77. package/dist/path-suggest-0Q2BDsuj.js +274 -0
  78. package/dist/path-suggest-Dk9TRLh5.js +3 -0
  79. package/dist/{path-suggest-DmrmeueH.js → path-suggest-bvR9SY6Q.js} +86 -18
  80. package/dist/renderer/capabilities.d.ts +13 -0
  81. package/dist/renderer/cli/index.d.ts +2 -0
  82. package/dist/renderer/cli/stdout-metrics.d.ts +18 -0
  83. package/dist/renderer/cli/stdout-renderer.d.ts +48 -0
  84. package/dist/renderer/dom/dom-renderer.d.ts +157 -0
  85. package/dist/renderer/dom/index.d.ts +2 -0
  86. package/dist/renderer/index.d.ts +2 -0
  87. package/dist/renderer-dom.cjs +1511 -0
  88. package/dist/renderer-dom.d.cts +4 -0
  89. package/dist/renderer-dom.d.ts +4 -0
  90. package/dist/renderer-dom.js +6 -0
  91. package/dist/runtime/index.d.ts +36 -0
  92. package/dist/runtime/osc52.d.ts +9 -0
  93. package/dist/runtime-DtrcQidD.js +1197 -0
  94. package/dist/runtime.cjs +1697 -0
  95. package/dist/runtime.d.cts +9 -0
  96. package/dist/runtime.d.ts +9 -0
  97. package/dist/runtime.js +4 -0
  98. package/dist/selection/terminal-selection.d.ts +122 -0
  99. package/dist/sgr-DMK2AvuT.js +304 -0
  100. package/dist/style-cache-i0ZABZRq.js +178 -0
  101. package/dist/terminal-selection-BCOh9jsL.js +329 -0
  102. package/dist/utils/env.d.ts +3 -0
  103. package/dist/utils/newlines.d.ts +1 -0
  104. package/dist/utils/path.d.ts +7 -0
  105. package/dist/utils/url-safety.d.ts +2 -0
  106. package/dist/vue/components/TAnchor.d.ts +108 -0
  107. package/dist/vue/components/TBox.d.ts +144 -0
  108. package/dist/vue/components/TDebugOverlay.d.ts +43 -0
  109. package/dist/vue/components/TDialog.d.ts +256 -0
  110. package/dist/vue/components/TFlow.d.ts +85 -0
  111. package/dist/vue/components/TInput.d.ts +554 -0
  112. package/dist/vue/components/TInputBox.d.ts +158 -0
  113. package/dist/vue/components/TJsonEditor.d.ts +165 -0
  114. package/dist/vue/components/TList.d.ts +119 -0
  115. package/dist/vue/components/TLogLinksPanel.d.ts +238 -0
  116. package/dist/vue/components/TLogMinimap.d.ts +263 -0
  117. package/dist/vue/components/TLogScrollbar.d.ts +236 -0
  118. package/dist/vue/components/TLogSearchBar.d.ts +267 -0
  119. package/dist/vue/components/TLogSearchPager.d.ts +162 -0
  120. package/dist/vue/components/TLogSearchResults.d.ts +200 -0
  121. package/dist/vue/components/TLogView.d.ts +502 -0
  122. package/dist/vue/components/TLogVirtualLinksPanel.d.ts +141 -0
  123. package/dist/vue/components/TLogVirtualSearchResults.d.ts +146 -0
  124. package/dist/vue/components/TMarkdownText.d.ts +134 -0
  125. package/dist/vue/components/TMultilineModal.d.ts +62 -0
  126. package/dist/vue/components/TPathPicker.d.ts +213 -0
  127. package/dist/vue/components/TRenderLayer.d.ts +16 -0
  128. package/dist/vue/components/TRenderPlane.d.ts +17 -0
  129. package/dist/vue/components/TSelect.d.ts +215 -0
  130. package/dist/vue/components/TText.d.ts +116 -0
  131. package/dist/vue/components/TTransition.d.ts +83 -0
  132. package/dist/vue/components/TView.d.ts +127 -0
  133. package/dist/vue/components/TVirtualList.d.ts +182 -0
  134. package/dist/vue/components/TVirtualMarkdown.d.ts +168 -0
  135. package/dist/vue/components/TerminalProvider.d.ts +195 -0
  136. package/dist/vue/components/input/host.d.ts +17 -0
  137. package/dist/vue/components/input/plugins/hostPlugin.d.ts +7 -0
  138. package/dist/vue/components/input/plugins/hostPlugin.node.d.ts +15 -0
  139. package/dist/vue/components/input/plugins/mentionUtils.d.ts +17 -0
  140. package/dist/vue/components/input/plugins/nodeMentionPathProvider.d.ts +2 -0
  141. package/dist/vue/components/input/plugins/promptMentionPlugin.d.ts +8 -0
  142. package/dist/vue/components/input/plugins/promptMentionState.d.ts +98 -0
  143. package/dist/vue/components/input/plugins/restrictText.d.ts +27 -0
  144. package/dist/vue/components/input/plugins/types.d.ts +90 -0
  145. package/dist/vue/components/input/utils/inlineText.d.ts +57 -0
  146. package/dist/vue/components/input/utils/inlineTextTokens.d.ts +34 -0
  147. package/dist/vue/components/input/utils/primitives.d.ts +3 -0
  148. package/dist/vue/components/input/utils/wordNavigation.d.ts +6 -0
  149. package/dist/vue/components/list/list-geometry.d.ts +16 -0
  150. package/dist/vue/components/list/list-paint.d.ts +1 -0
  151. package/dist/vue/components/list/scroll-state.d.ts +25 -0
  152. package/dist/vue/components/list/selection-state.d.ts +6 -0
  153. package/dist/vue/components/terminal-provider/copy-toast.d.ts +6 -0
  154. package/dist/vue/components/terminal-provider/portals.d.ts +17 -0
  155. package/dist/vue/components/terminal-provider/scheduler.d.ts +29 -0
  156. package/dist/vue/components/terminal-provider/selection-config.d.ts +15 -0
  157. package/dist/vue/components/terminal-provider/utils.d.ts +5 -0
  158. package/dist/vue/composables/use-layout.d.ts +2 -0
  159. package/dist/vue/composables/use-render-node.d.ts +19 -0
  160. package/dist/vue/composables/use-render-stack.d.ts +3 -0
  161. package/dist/vue/composables/use-runtime.d.ts +5 -0
  162. package/dist/vue/composables/use-terminal-node.d.ts +14 -0
  163. package/dist/vue/composables/use-terminal.d.ts +2 -0
  164. package/dist/vue/composables/use-visibility.d.ts +12 -0
  165. package/dist/vue/context.d.ts +153 -0
  166. package/dist/vue/index.d.ts +39 -0
  167. package/dist/vue/injection-key.d.ts +2 -0
  168. package/dist/vue/log/append-only-log-store.d.ts +2 -0
  169. package/dist/vue/log/tlog-keymap.d.ts +28 -0
  170. package/dist/vue/log/tlog-plugins.d.ts +144 -0
  171. package/dist/vue/log/tlog-session.d.ts +81 -0
  172. package/dist/vue/log/tlog-theme.d.ts +68 -0
  173. package/dist/vue/log/types.d.ts +43 -0
  174. package/dist/vue/log/use-tlog-link-controller.d.ts +31 -0
  175. package/dist/vue/log/use-tlog-retained-index.d.ts +26 -0
  176. package/dist/vue/log/use-tlog-search-controller.d.ts +51 -0
  177. package/dist/vue/log/use-tlog-search-results-page.d.ts +31 -0
  178. package/dist/vue/log/use-tlog-virtual-search-results.d.ts +22 -0
  179. package/dist/vue/markdown/ast.d.ts +3 -0
  180. package/dist/vue/markdown/block-source.d.ts +22 -0
  181. package/dist/vue/markdown/document.d.ts +18 -0
  182. package/dist/vue/markdown/layout.d.ts +16 -0
  183. package/dist/vue/markdown/parser.d.ts +11 -0
  184. package/dist/vue/markdown/render.d.ts +10 -0
  185. package/dist/vue/markdown/theme.d.ts +186 -0
  186. package/dist/vue/markdown/types.d.ts +47 -0
  187. package/dist/vue/render/context.d.ts +3 -0
  188. package/dist/vue/render/render-manager.d.ts +94 -0
  189. package/dist/vue/router/RouterView.d.ts +25 -0
  190. package/dist/vue/router/composables.d.ts +4 -0
  191. package/dist/vue/router/context.d.ts +4 -0
  192. package/dist/vue/router/router.d.ts +7 -0
  193. package/dist/vue/router/types.d.ts +29 -0
  194. package/dist/vue/scheduler/frame-mailbox.d.ts +55 -0
  195. package/dist/vue/scheduler/frame-scheduler.d.ts +51 -0
  196. package/dist/vue/utils/frame-task.d.ts +6 -0
  197. package/dist/vue/utils/rect.d.ts +4 -0
  198. package/dist/vue/utils/style-cache.d.ts +3 -0
  199. package/dist/vue/utils/text.d.ts +26 -0
  200. package/dist/vue/utils/wheel-scroll.d.ts +18 -0
  201. package/dist/vue.cjs +18882 -0
  202. package/dist/vue.d.cts +3 -0
  203. package/dist/vue.d.ts +3 -0
  204. package/dist/vue.js +3066 -0
  205. package/dist/{wheel-scroll-CiNsasLf.js → wheel-scroll-B-WlFuNB.js} +361 -367
  206. package/package.json +165 -35
  207. package/dist/path-suggest-BeV6n7m-.js +0 -3
  208. package/dist/sgr-Tko2EQ0U.js +0 -484
  209. package/dist/theme-Bsm65g8k.d.ts +0 -32
  210. package/dist/types-ClIV2h1o.d.ts +0 -103
@@ -1,5 +1,8 @@
1
- import { EventZIndexContextKey, RenderPlaneContextKey, applyWheelScroll, createWheelScrollState, forEachTextCellSegment, formatInlineCellLine, intersectRect, normalizeCellRect, padEndByCells, resetWheelScrollState, sanitizeInlineText, sliceByCellsRange, spaces, textCellWidth, translateRect, useLayout, useRenderNode, useTerminal, useTerminalNode, useVisibility, wrapByCells } from "./wheel-scroll-CiNsasLf.js";
2
- import { applyAnsiSgrStyle, createFrameMailbox, defaultActiveStyle, parseAnsiSgr } from "./sgr-Tko2EQ0U.js";
1
+ import { applyAnsiSgrStyle, parseAnsiSgr } from "./sgr-DMK2AvuT.js";
2
+ import { sanitizeTerminalHref } from "./hyperlink-B5PD7a3Q.js";
3
+ import { terminalSelectionRowSpans, terminalSelectionVisibleRowSpans } from "./terminal-selection-BCOh9jsL.js";
4
+ import { EventZIndexContextKey, RenderPlaneContextKey, applyWheelScroll, createWheelScrollState, forEachTextCellSegment, formatInlineCellLine, intersectRect, normalizeCellRect, padEndByCells, resetWheelScrollState, sanitizeInlineText, sliceByCellsRange, spaces, textCellWidth, translateRect, useLayout, useRenderNode, useTerminal, useTerminalNode, useVisibility, wrapByCells } from "./wheel-scroll-B-WlFuNB.js";
5
+ import { createFrameMailbox, defaultActiveStyle } from "./style-cache-i0ZABZRq.js";
3
6
  import { computed, defineComponent, getCurrentInstance, h, inject, onBeforeUnmount, ref, watch, watchEffect } from "vue";
4
7
 
5
8
  //#region src/vue/components/TVirtualList.ts
@@ -92,6 +95,14 @@ const TVirtualList = defineComponent({
92
95
  type: Boolean,
93
96
  default: false
94
97
  },
98
+ selectionText: {
99
+ type: Function,
100
+ default: void 0
101
+ },
102
+ selectable: {
103
+ type: Boolean,
104
+ default: false
105
+ },
95
106
  rowScrollMode: {
96
107
  type: String,
97
108
  default: "off"
@@ -108,7 +119,7 @@ const TVirtualList = defineComponent({
108
119
  "keydown"
109
120
  ],
110
121
  setup(props, { emit }) {
111
- const { terminal, scheduler, render, defaultStyle, events } = useTerminal();
122
+ const { terminal, scheduler, render, defaultStyle, events, selection } = useTerminal();
112
123
  const instance = getCurrentInstance();
113
124
  const layout = useLayout();
114
125
  const { visible, rootProps } = useVisibility();
@@ -126,6 +137,7 @@ const TVirtualList = defineComponent({
126
137
  let warnedRenderItemIdentity = false;
127
138
  let alive = true;
128
139
  let pendingWheelTop = null;
140
+ let pendingSelectionScrollFocusRemap = false;
129
141
  const wheelState = createWheelScrollState();
130
142
  const itemCount = computed(() => {
131
143
  const n = Math.floor(Number(props.itemCount));
@@ -188,7 +200,7 @@ const TVirtualList = defineComponent({
188
200
  return visible.value && r.w > 0 && r.h > 0;
189
201
  }
190
202
  function isScrollControlled() {
191
- return Object.prototype.hasOwnProperty.call((instance === null || instance === void 0 ? void 0 : instance.vnode.props) ?? {}, "scrollTop");
203
+ return Object.prototype.hasOwnProperty.call(instance?.vnode.props ?? {}, "scrollTop");
192
204
  }
193
205
  const visibleWindow = computed(() => {
194
206
  const clip = normalizedRect();
@@ -220,7 +232,9 @@ const TVirtualList = defineComponent({
220
232
  const visibleEnd = visibleStart + clip.h - 1;
221
233
  if (active.value < visibleStart) nextTop = clamp$10(active.value - clipY, 0, maxTop);
222
234
  else if (active.value > visibleEnd) nextTop = clamp$10(active.value - (clipY + clip.h - 1), 0, maxTop);
223
- return applyScrollTop(nextTop, options);
235
+ const result = applyScrollTop(nextTop, options);
236
+ if (result.changed) selection.refresh();
237
+ return result;
224
238
  }
225
239
  function normalizedModelValue() {
226
240
  return normalizeIndex(props.modelValue, itemCount.value);
@@ -245,6 +259,7 @@ const TVirtualList = defineComponent({
245
259
  resetWheelScrollState(wheelState);
246
260
  return;
247
261
  }
262
+ selection.refresh();
248
263
  if (changed.dirty) ctx.invalidate({
249
264
  priority: "high",
250
265
  plane: plane.value,
@@ -304,6 +319,7 @@ const TVirtualList = defineComponent({
304
319
  active.value = normalizedModelValue();
305
320
  const nextTop = clampScrollTop(scrollTop.value);
306
321
  const changed = applyScrollTop(nextTop, { emitScroll });
322
+ if (changed.changed) selection.refresh();
307
323
  if (!changed.changed) markViewportDirty();
308
324
  if (pendingWheelTop !== null && !hasPaintableViewport()) cancelWheelScrollFrame();
309
325
  else if (pendingWheelTop !== null) {
@@ -322,6 +338,9 @@ const TVirtualList = defineComponent({
322
338
  const changed = scrollTop.value !== nextTop;
323
339
  scrollTop.value = nextTop;
324
340
  if (!wasInitialized || !changed) return;
341
+ const remap = pendingSelectionScrollFocusRemap;
342
+ pendingSelectionScrollFocusRemap = false;
343
+ selection.refresh(remap ? { remapFocus: true } : void 0);
325
344
  markViewportDirty();
326
345
  invalidateSelf("high", "scroll");
327
346
  }, { immediate: true });
@@ -335,10 +354,14 @@ const TVirtualList = defineComponent({
335
354
  warnedRenderItemIdentity = true;
336
355
  console.warn("[vue-tui] TVirtualList renderItem changed identity; use a stable function reference and itemVersion.");
337
356
  });
357
+ watch(() => props.itemVersion, () => {
358
+ selection.refresh();
359
+ });
338
360
  function itemText(index) {
339
361
  const item = props.getItem(index);
362
+ if (props.selectionText) return String(props.selectionText(item, index) ?? "");
340
363
  const raw = props.renderItem ? props.renderItem(item, index) : item;
341
- return String(raw ?? "");
364
+ return typeof raw === "string" || typeof raw === "number" || typeof raw === "boolean" ? String(raw) : "";
342
365
  }
343
366
  function commit(index) {
344
367
  if (itemCount.value <= 0) return;
@@ -406,11 +429,91 @@ const TVirtualList = defineComponent({
406
429
  commit(active.value);
407
430
  }
408
431
  }
432
+ function scrollSelectionBy(delta) {
433
+ const n = Math.trunc(Number(delta));
434
+ if (!Number.isFinite(n) || n === 0) return false;
435
+ cancelWheelScrollFrame();
436
+ if (isScrollControlled()) {
437
+ const nextTop = clampScrollTop(scrollTop.value + n);
438
+ if (nextTop === scrollTop.value) return false;
439
+ if (pendingSelectionScrollFocusRemap) return false;
440
+ pendingSelectionScrollFocusRemap = true;
441
+ emit("update:scrollTop", nextTop);
442
+ emit("scroll", nextTop);
443
+ return true;
444
+ }
445
+ const changed = applyScrollTop(scrollTop.value + n, {
446
+ emitScroll: true,
447
+ emitUpdate: true,
448
+ priority: "high",
449
+ reason: "scroll"
450
+ });
451
+ if (!changed.changed) return false;
452
+ selection.refresh({ remapFocus: true });
453
+ return true;
454
+ }
455
+ function selectionPointForCell(point) {
456
+ const r = normalizedRect();
457
+ if (point.x < r.x || point.y < r.y || point.x >= r.x + r.w || point.y >= r.y + r.h) return null;
458
+ const { x: clipX, y: clipY } = clipOffsets();
459
+ const virtualY = scrollTop.value + clipY + (point.y - r.y);
460
+ if (virtualY < 0 || virtualY >= itemCount.value) return null;
461
+ return {
462
+ x: clamp$10(clipX + (point.x - r.x), 0, Math.max(0, props.w - 1)),
463
+ y: virtualY
464
+ };
465
+ }
466
+ function canHandleSelectionRange(range) {
467
+ return Boolean(selectionPointForCell(range.anchor) && selectionPointForCell(range.focus));
468
+ }
469
+ function textForSelectionRange(range) {
470
+ const cols = Math.max(1, Math.floor(props.w));
471
+ return terminalSelectionRowSpans(range, cols, itemCount.value).map((span) => {
472
+ const text = sliceByCellsRange(itemText(span.y), span.x0, span.x1);
473
+ return span.x1 >= cols ? text.trimEnd() : text;
474
+ }).join("\n");
475
+ }
476
+ function visibleSpansForSelectionRange(providerRange, _screenRange) {
477
+ const r = normalizedRect();
478
+ const { x: clipX, y: clipY } = clipOffsets();
479
+ const cols = Math.max(1, Math.floor(props.w));
480
+ const top = scrollTop.value + clipY;
481
+ const bottom = top + r.h;
482
+ const providerSpans = terminalSelectionVisibleRowSpans(providerRange, cols, itemCount.value, top, bottom);
483
+ const result = [];
484
+ for (const span of providerSpans) {
485
+ const screenY = r.y + (span.y - top);
486
+ const screenX0 = r.x + span.x0 - clipX;
487
+ const screenX1 = r.x + span.x1 - clipX;
488
+ const x0 = Math.max(r.x, screenX0);
489
+ const x1 = Math.min(r.x + r.w, screenX1);
490
+ if (screenY >= r.y && screenY < r.y + r.h && x1 > x0) result.push({
491
+ y: screenY,
492
+ x0,
493
+ x1
494
+ });
495
+ }
496
+ return result;
497
+ }
498
+ const selectionTextProvider = {
499
+ id: `TVirtualList:${virtualListInstanceId}:selection-text`,
500
+ get rect() {
501
+ return normalizedRect();
502
+ },
503
+ canHandle: canHandleSelectionRange,
504
+ pointForCell: selectionPointForCell,
505
+ getText: textForSelectionRange,
506
+ getVisibleSpans: visibleSpansForSelectionRange
507
+ };
508
+ const unregisterSelectionTextProvider = selection.registerTextProvider(selectionTextProvider);
509
+ onBeforeUnmount(unregisterSelectionTextProvider);
409
510
  const eventNode = useTerminalNode(() => ({
410
511
  rect: normalizedRect(),
411
512
  zIndex: eventZ.value,
412
513
  visible: visible.value,
413
514
  focusable: true,
515
+ selectable: props.selectable,
516
+ selectionScrollBy: scrollSelectionBy,
414
517
  handlers: {
415
518
  click: (e) => {
416
519
  cancelWheelScrollFrame();
@@ -435,7 +538,6 @@ const TVirtualList = defineComponent({
435
538
  if (idx >= 0 && idx < itemCount.value) commit(idx);
436
539
  },
437
540
  wheel: (e) => {
438
- var _e$preventDefault;
439
541
  const { deltaY, mode } = getWheelScrollInput$1(e);
440
542
  if (!deltaY) return;
441
543
  const maxTop = maxScrollTop();
@@ -444,7 +546,7 @@ const TVirtualList = defineComponent({
444
546
  const { nextTop, dir } = applyWheelScroll(wheelState, deltaY, baseTop, maxTop, now, mode, { disableAcceleration: mode === "pixel" });
445
547
  if (!dir || nextTop === baseTop) return;
446
548
  if (!requestWheelScroll(nextTop)) return;
447
- (_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 || _e$preventDefault.call(e);
549
+ e.preventDefault?.();
448
550
  },
449
551
  focus: () => {
450
552
  focused.value = true;
@@ -484,7 +586,7 @@ const TVirtualList = defineComponent({
484
586
  return rows;
485
587
  }
486
588
  function unionDirtyRows(nextRows) {
487
- if (!(dirtyRowsHint === null || dirtyRowsHint === void 0 ? void 0 : dirtyRowsHint.length)) return nextRows.slice().sort((a, b) => a - b);
589
+ if (!dirtyRowsHint?.length) return nextRows.slice().sort((a, b) => a - b);
488
590
  const rows = new Set(dirtyRowsHint);
489
591
  for (const y of nextRows) rows.add(y);
490
592
  return Array.from(rows).sort((a, b) => a - b);
@@ -520,8 +622,8 @@ const TVirtualList = defineComponent({
520
622
  controlled
521
623
  };
522
624
  if (controlled) {
523
- if ((options === null || options === void 0 ? void 0 : options.emitUpdate) ?? true) emit("update:scrollTop", clampedTop);
524
- if (options === null || options === void 0 ? void 0 : options.emitScroll) emit("scroll", clampedTop);
625
+ if (options?.emitUpdate ?? true) emit("update:scrollTop", clampedTop);
626
+ if (options?.emitScroll) emit("scroll", clampedTop);
525
627
  return {
526
628
  changed: true,
527
629
  dirty: false,
@@ -530,10 +632,10 @@ const TVirtualList = defineComponent({
530
632
  };
531
633
  }
532
634
  scrollTop.value = clampedTop;
533
- if (options === null || options === void 0 ? void 0 : options.emitUpdate) emit("update:scrollTop", clampedTop);
635
+ if (options?.emitUpdate) emit("update:scrollTop", clampedTop);
534
636
  const dirty = markViewportDirty();
535
- if (options === null || options === void 0 ? void 0 : options.emitScroll) emit("scroll", clampedTop);
536
- if ((options === null || options === void 0 ? void 0 : options.priority) && dirty) invalidateSelf(options.priority, options.reason ?? "scroll");
637
+ if (options?.emitScroll) emit("scroll", clampedTop);
638
+ if (options?.priority && dirty) invalidateSelf(options.priority, options.reason ?? "scroll");
537
639
  return {
538
640
  changed: true,
539
641
  dirty,
@@ -586,7 +688,7 @@ const TVirtualList = defineComponent({
586
688
  });
587
689
  };
588
690
  const rows = dirtyRows;
589
- if (rows === null || rows === void 0 ? void 0 : rows.length) {
691
+ if (rows?.length) {
590
692
  for (const y of rows) paintRow(y);
591
693
  return;
592
694
  }
@@ -794,7 +896,7 @@ function parseAnsiLineToSegments(text, baseStyle, links, linkStyle) {
794
896
  if (!osc) continue;
795
897
  flush(i);
796
898
  const parts = osc.body.split(";");
797
- if (parts[0] === "8" && parts.length >= 3) href = parts.slice(2).join(";") || void 0;
899
+ if (parts[0] === "8" && parts.length >= 3) href = sanitizeTerminalHref(parts.slice(2).join(";")) ?? void 0;
798
900
  i = osc.end;
799
901
  textStart = osc.end + 1;
800
902
  continue;
@@ -1015,6 +1117,10 @@ const TLogView = defineComponent({
1015
1117
  type: Boolean,
1016
1118
  default: false
1017
1119
  },
1120
+ selectable: {
1121
+ type: Boolean,
1122
+ default: true
1123
+ },
1018
1124
  autoStickToBottom: {
1019
1125
  type: Boolean,
1020
1126
  default: true
@@ -1099,7 +1205,7 @@ const TLogView = defineComponent({
1099
1205
  "keydown"
1100
1206
  ],
1101
1207
  setup(props, { emit, expose }) {
1102
- const { terminal, scheduler, render, rendererCapabilities, defaultStyle, events } = useTerminal();
1208
+ const { terminal, scheduler, render, rendererCapabilities, defaultStyle, events, selection } = useTerminal();
1103
1209
  const layout = useLayout();
1104
1210
  const { visible, rootProps } = useVisibility();
1105
1211
  const plane = inject(RenderPlaneContextKey, ref("default"));
@@ -1113,6 +1219,7 @@ const TLogView = defineComponent({
1113
1219
  let renderNodeId = null;
1114
1220
  let alive = true;
1115
1221
  let pendingWheelTop = null;
1222
+ let pendingSelectionScrollFocusRemap = false;
1116
1223
  let initializedScrollTop = false;
1117
1224
  let lastLineCount = 0;
1118
1225
  let lastFirstLineIndex = 0;
@@ -1206,13 +1313,11 @@ const TLogView = defineComponent({
1206
1313
  return Number.isFinite(n) ? Math.max(0, n) : 0;
1207
1314
  }
1208
1315
  function firstLineIndex() {
1209
- var _props$source$firstLi, _props$source;
1210
- const n = Math.floor(Number(((_props$source$firstLi = (_props$source = props.source).firstLineIndex) === null || _props$source$firstLi === void 0 ? void 0 : _props$source$firstLi.call(_props$source)) ?? 0));
1316
+ const n = Math.floor(Number(props.source.firstLineIndex?.() ?? 0));
1211
1317
  return Number.isFinite(n) ? Math.max(0, n) : 0;
1212
1318
  }
1213
1319
  function lineKey(index) {
1214
- var _props$source$getLine, _props$source2;
1215
- return ((_props$source$getLine = (_props$source2 = props.source).getLineKey) === null || _props$source$getLine === void 0 ? void 0 : _props$source$getLine.call(_props$source2, index)) ?? `v:${props.version}:i:${index}`;
1320
+ return props.source.getLineKey?.(index) ?? `v:${props.version}:i:${index}`;
1216
1321
  }
1217
1322
  function renderCacheKey(key, fullW, clipX, visibleW) {
1218
1323
  return JSON.stringify([
@@ -1443,42 +1548,36 @@ const TLogView = defineComponent({
1443
1548
  return query.trim() ? query : "";
1444
1549
  }
1445
1550
  function maxSearchMatches() {
1446
- var _props$searchOptions;
1447
- const n = Math.floor(Number(((_props$searchOptions = props.searchOptions) === null || _props$searchOptions === void 0 ? void 0 : _props$searchOptions.maxMatches) ?? DEFAULT_SEARCH_MAX_MATCHES));
1551
+ const n = Math.floor(Number(props.searchOptions?.maxMatches ?? DEFAULT_SEARCH_MAX_MATCHES));
1448
1552
  if (!Number.isFinite(n)) return DEFAULT_SEARCH_MAX_MATCHES;
1449
1553
  return Math.max(0, n);
1450
1554
  }
1451
1555
  function searchScanBudgetMs() {
1452
- var _props$searchOptions2;
1453
- const n = Number(((_props$searchOptions2 = props.searchOptions) === null || _props$searchOptions2 === void 0 ? void 0 : _props$searchOptions2.scanBudgetMs) ?? DEFAULT_SEARCH_SCAN_BUDGET_MS);
1556
+ const n = Number(props.searchOptions?.scanBudgetMs ?? DEFAULT_SEARCH_SCAN_BUDGET_MS);
1454
1557
  if (!Number.isFinite(n)) return DEFAULT_SEARCH_SCAN_BUDGET_MS;
1455
1558
  return Math.max(0, n);
1456
1559
  }
1457
1560
  function searchMode() {
1458
- var _props$searchOptions3;
1459
- return ((_props$searchOptions3 = props.searchOptions) === null || _props$searchOptions3 === void 0 ? void 0 : _props$searchOptions3.mode) === "regex" ? "regex" : "text";
1561
+ return props.searchOptions?.mode === "regex" ? "regex" : "text";
1460
1562
  }
1461
1563
  function normalizedMaxMatchesPerLine() {
1462
- var _props$searchOptions4;
1463
- const n = Math.floor(Number(((_props$searchOptions4 = props.searchOptions) === null || _props$searchOptions4 === void 0 ? void 0 : _props$searchOptions4.maxMatchesPerLine) ?? DEFAULT_SEARCH_MAX_MATCHES_PER_LINE));
1564
+ const n = Math.floor(Number(props.searchOptions?.maxMatchesPerLine ?? DEFAULT_SEARCH_MAX_MATCHES_PER_LINE));
1464
1565
  if (!Number.isFinite(n)) return DEFAULT_SEARCH_MAX_MATCHES_PER_LINE;
1465
1566
  return Math.max(0, n);
1466
1567
  }
1467
1568
  function normalizeRegexFlags() {
1468
- var _props$searchOptions5, _props$searchOptions6;
1469
1569
  const flags = new Set();
1470
- for (const ch of ((_props$searchOptions5 = props.searchOptions) === null || _props$searchOptions5 === void 0 ? void 0 : _props$searchOptions5.regexFlags) ?? "") {
1570
+ for (const ch of props.searchOptions?.regexFlags ?? "") {
1471
1571
  if (ch === "g" || ch === "y") continue;
1472
1572
  flags.add(ch);
1473
1573
  }
1474
- if (((_props$searchOptions6 = props.searchOptions) === null || _props$searchOptions6 === void 0 ? void 0 : _props$searchOptions6.caseSensitive) !== true) flags.add("i");
1574
+ if (props.searchOptions?.caseSensitive !== true) flags.add("i");
1475
1575
  flags.add("g");
1476
1576
  return Array.from(flags).join("");
1477
1577
  }
1478
1578
  function compileTextSearch(query) {
1479
- var _props$searchOptions7, _props$searchOptions8;
1480
- const caseSensitive = ((_props$searchOptions7 = props.searchOptions) === null || _props$searchOptions7 === void 0 ? void 0 : _props$searchOptions7.caseSensitive) === true;
1481
- const wholeWord = ((_props$searchOptions8 = props.searchOptions) === null || _props$searchOptions8 === void 0 ? void 0 : _props$searchOptions8.wholeWord) === true;
1579
+ const caseSensitive = props.searchOptions?.caseSensitive === true;
1580
+ const wholeWord = props.searchOptions?.wholeWord === true;
1482
1581
  const haystackQuery = caseSensitive ? query : query.toLowerCase();
1483
1582
  return {
1484
1583
  key: JSON.stringify([
@@ -1868,7 +1967,7 @@ const TLogView = defineComponent({
1868
1967
  function applySearchHighlightsToSegments(segments, lineIndex, visibleStartCell) {
1869
1968
  if (!props.highlightMatches || !searchMatches.length) return segments;
1870
1969
  const lineMatches = matchesByLine.get(lineIndex);
1871
- if (!(lineMatches === null || lineMatches === void 0 ? void 0 : lineMatches.length)) return segments;
1970
+ if (!lineMatches?.length) return segments;
1872
1971
  const out = [];
1873
1972
  let cursor = visibleStartCell;
1874
1973
  for (const seg of segments) {
@@ -1945,14 +2044,12 @@ const TLogView = defineComponent({
1945
2044
  return Math.max(1, normalizedFullRect().w);
1946
2045
  }
1947
2046
  function visualIndexMeasureBudgetMs() {
1948
- var _props$visualIndexOpt;
1949
- const raw = Number((_props$visualIndexOpt = props.visualIndexOptions) === null || _props$visualIndexOpt === void 0 ? void 0 : _props$visualIndexOpt.measureBudgetMs);
2047
+ const raw = Number(props.visualIndexOptions?.measureBudgetMs);
1950
2048
  if (!Number.isFinite(raw)) return DEFAULT_VISUAL_INDEX_MEASURE_BUDGET_MS;
1951
2049
  return Math.max(0, raw);
1952
2050
  }
1953
2051
  function visualIndexMaxMeasuredLines(count = lineCount()) {
1954
- var _props$visualIndexOpt2;
1955
- const raw = (_props$visualIndexOpt2 = props.visualIndexOptions) === null || _props$visualIndexOpt2 === void 0 ? void 0 : _props$visualIndexOpt2.maxMeasuredLines;
2052
+ const raw = props.visualIndexOptions?.maxMeasuredLines;
1956
2053
  if (raw == null) return count;
1957
2054
  const n = Math.floor(Number(raw));
1958
2055
  if (!Number.isFinite(n)) return count;
@@ -2377,7 +2474,7 @@ const TLogView = defineComponent({
2377
2474
  const href = seg.style.href;
2378
2475
  if (href) {
2379
2476
  const previous = rowLinks[rowLinks.length - 1];
2380
- if ((previous === null || previous === void 0 ? void 0 : previous.href) === href && previous.endX === x && previous.endCell === cell && previous.index === lineIndex) rowLinks[rowLinks.length - 1] = {
2477
+ if (previous?.href === href && previous.endX === x && previous.endCell === cell && previous.index === lineIndex) rowLinks[rowLinks.length - 1] = {
2381
2478
  ...previous,
2382
2479
  endX: x + seg.cells,
2383
2480
  text: previous.text + seg.text,
@@ -2424,7 +2521,7 @@ const TLogView = defineComponent({
2424
2521
  return out;
2425
2522
  }
2426
2523
  function focusedLinkMatches(link) {
2427
- return (focusedLinkTarget === null || focusedLinkTarget === void 0 ? void 0 : focusedLinkTarget.href) === link.href && focusedLinkTarget.absoluteLineIndex === link.absoluteLineIndex && focusedLinkTarget.index === link.index && focusedLinkTarget.startCell === link.startCell && focusedLinkTarget.endCell === link.endCell;
2524
+ return focusedLinkTarget?.href === link.href && focusedLinkTarget.absoluteLineIndex === link.absoluteLineIndex && focusedLinkTarget.index === link.index && focusedLinkTarget.startCell === link.startCell && focusedLinkTarget.endCell === link.endCell;
2428
2525
  }
2429
2526
  function emitLinkFocusPayload(link, focusedLinkIndex) {
2430
2527
  emit("linkFocus", {
@@ -2510,10 +2607,9 @@ const TLogView = defineComponent({
2510
2607
  clearLinkFocus();
2511
2608
  }
2512
2609
  function emitLinkClick(e) {
2513
- var _visibleLinksByRow$ge, _e$preventDefault;
2514
- const link = (_visibleLinksByRow$ge = visibleLinksByRow.get(e.cellY)) === null || _visibleLinksByRow$ge === void 0 ? void 0 : _visibleLinksByRow$ge.find((candidate) => e.cellX >= candidate.startX && e.cellX < candidate.endX);
2610
+ const link = visibleLinksByRow.get(e.cellY)?.find((candidate) => e.cellX >= candidate.startX && e.cellX < candidate.endX);
2515
2611
  if (!link) return;
2516
- (_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 || _e$preventDefault.call(e);
2612
+ e.preventDefault?.();
2517
2613
  emit("linkClick", {
2518
2614
  href: link.href,
2519
2615
  text: link.text,
@@ -2549,6 +2645,7 @@ const TLogView = defineComponent({
2549
2645
  resetWheelScrollState(wheelState);
2550
2646
  return;
2551
2647
  }
2648
+ selection.refresh();
2552
2649
  ctx.invalidate({
2553
2650
  priority: "high",
2554
2651
  plane: plane.value,
@@ -2579,13 +2676,13 @@ const TLogView = defineComponent({
2579
2676
  for (const [y, links] of visibleLinksByRow) if (y < y0 || y >= y1) next.set(y, links);
2580
2677
  if (delta > 0) for (let y = y0; y < y1 - delta; y++) {
2581
2678
  const links = visibleLinksByRow.get(y + delta);
2582
- if (links === null || links === void 0 ? void 0 : links.length) next.set(y, links);
2679
+ if (links?.length) next.set(y, links);
2583
2680
  }
2584
2681
  else {
2585
2682
  const n = -delta;
2586
2683
  for (let y = y0 + n; y < y1; y++) {
2587
2684
  const links = visibleLinksByRow.get(y + delta);
2588
- if (links === null || links === void 0 ? void 0 : links.length) next.set(y, links);
2685
+ if (links?.length) next.set(y, links);
2589
2686
  }
2590
2687
  }
2591
2688
  visibleLinksByRow.clear();
@@ -2598,7 +2695,7 @@ const TLogView = defineComponent({
2598
2695
  return rows;
2599
2696
  }
2600
2697
  function unionDirtyRows(nextRows) {
2601
- if (!(dirtyRowsHint === null || dirtyRowsHint === void 0 ? void 0 : dirtyRowsHint.length)) return nextRows.slice().sort((a, b) => a - b);
2698
+ if (!dirtyRowsHint?.length) return nextRows.slice().sort((a, b) => a - b);
2602
2699
  const rows = new Set(dirtyRowsHint);
2603
2700
  for (const y of nextRows) rows.add(y);
2604
2701
  return Array.from(rows).sort((a, b) => a - b);
@@ -2681,7 +2778,7 @@ const TLogView = defineComponent({
2681
2778
  if (props.wrap) return null;
2682
2779
  if (delta <= 0 || delta >= r.h) return null;
2683
2780
  if (prevCount <= 0 || nextCount <= prevCount) return null;
2684
- if ((lastPaintedBottom === null || lastPaintedBottom === void 0 ? void 0 : lastPaintedBottom.index) !== prevCount - 1) return null;
2781
+ if (lastPaintedBottom?.index !== prevCount - 1) return null;
2685
2782
  if (lineKey(prevCount - 1) === lastPaintedBottom.lineKey) return null;
2686
2783
  return r.y + r.h - delta - 1;
2687
2784
  }
@@ -2690,39 +2787,38 @@ const TLogView = defineComponent({
2690
2787
  const full = normalizedFullRect();
2691
2788
  const h$1 = r.h;
2692
2789
  if (h$1 <= 0 || full.h <= 0) return false;
2693
- if ((options === null || options === void 0 ? void 0 : options.stickToBottom) === true && props.wrap) ensureBottomMeasured();
2790
+ if (options?.stickToBottom === true && props.wrap) ensureBottomMeasured();
2694
2791
  const prevTop = rawScrollTop();
2695
2792
  const clampedTop = normalizeScrollTop(nextTop);
2696
2793
  const delta = clampedTop - prevTop;
2697
2794
  if (!delta) {
2698
- if ((options === null || options === void 0 ? void 0 : options.stickToBottom) != null) stickToBottom.value = options.stickToBottom;
2795
+ if (options?.stickToBottom != null) stickToBottom.value = options.stickToBottom;
2699
2796
  return false;
2700
2797
  }
2701
2798
  const uncontrolled = !isScrollControlled();
2702
2799
  if (uncontrolled) {
2703
2800
  innerScrollTop.value = clampedTop;
2704
- stickToBottom.value = (options === null || options === void 0 ? void 0 : options.stickToBottom) ?? isAtBottom(clampedTop);
2801
+ stickToBottom.value = options?.stickToBottom ?? isAtBottom(clampedTop);
2705
2802
  }
2706
- if ((options === null || options === void 0 ? void 0 : options.emitUpdate) !== false) emit("update:scrollTop", clampedTop);
2803
+ if (options?.emitUpdate !== false) emit("update:scrollTop", clampedTop);
2707
2804
  if (!uncontrolled) {
2708
2805
  markViewportDirty();
2709
- if (options === null || options === void 0 ? void 0 : options.emitScroll) emitScroll(clampedTop);
2806
+ if (options?.emitScroll) emitScroll(clampedTop);
2710
2807
  return true;
2711
2808
  }
2712
2809
  const size = terminal.size();
2713
2810
  const ownsFullRows = Math.floor(r.x) === 0 && Math.floor(r.w) >= size.cols;
2714
2811
  const withinTerminalRows = r.y >= 0 && r.y + h$1 <= size.rows;
2715
- const canUseScrollPlane = strategy === "auto" && props.rowScrollMode === "unsafe-full-row" && rendererCapabilities.value.scrollOperations && !props.wrap && ownsFullRows && withinTerminalRows && !isClipped() && Math.abs(delta) < h$1 && !(dirtyRowsHint === null || dirtyRowsHint === void 0 ? void 0 : dirtyRowsHint.length);
2812
+ const canUseScrollPlane = strategy === "auto" && props.rowScrollMode === "unsafe-full-row" && rendererCapabilities.value.scrollOperations && !props.wrap && ownsFullRows && withinTerminalRows && !isClipped() && Math.abs(delta) < h$1 && !dirtyRowsHint?.length;
2716
2813
  if (canUseScrollPlane) {
2717
- var _options$extraDirtyRo;
2718
2814
  render.unsafeScrollPlaneRows(plane.value, r.y, r.y + h$1, delta);
2719
2815
  shiftVisibleLinksForScrollRegion(r.y, r.y + h$1, delta);
2720
- markRowsDirty((options === null || options === void 0 || (_options$extraDirtyRo = options.extraDirtyRows) === null || _options$extraDirtyRo === void 0 ? void 0 : _options$extraDirtyRo.length) ? [...exposedRowsForDelta(r.y, h$1, delta), ...options.extraDirtyRows] : exposedRowsForDelta(r.y, h$1, delta));
2721
- if (options === null || options === void 0 ? void 0 : options.emitScroll) emitScroll(clampedTop);
2816
+ markRowsDirty(options?.extraDirtyRows?.length ? [...exposedRowsForDelta(r.y, h$1, delta), ...options.extraDirtyRows] : exposedRowsForDelta(r.y, h$1, delta));
2817
+ if (options?.emitScroll) emitScroll(clampedTop);
2722
2818
  return true;
2723
2819
  }
2724
2820
  markViewportDirty();
2725
- if (options === null || options === void 0 ? void 0 : options.emitScroll) emitScroll(clampedTop);
2821
+ if (options?.emitScroll) emitScroll(clampedTop);
2726
2822
  return true;
2727
2823
  }
2728
2824
  function visibleLineRange() {
@@ -2748,7 +2844,7 @@ const TLogView = defineComponent({
2748
2844
  }
2749
2845
  function handleSourceVersionChanged(payload) {
2750
2846
  const prevCount = lastLineCount;
2751
- const nextCount = (payload === null || payload === void 0 ? void 0 : payload.lineCount) ?? lineCount();
2847
+ const nextCount = payload?.lineCount ?? lineCount();
2752
2848
  const prevFirst = lastFirstLineIndex;
2753
2849
  const nextFirst = firstLineIndex();
2754
2850
  const droppedHeadLines = Math.max(0, nextFirst - prevFirst);
@@ -2784,6 +2880,7 @@ const TLogView = defineComponent({
2784
2880
  emitScroll: true,
2785
2881
  stickToBottom: false
2786
2882
  });
2883
+ if (changed) selection.refresh();
2787
2884
  if (!changed) markViewportDirty();
2788
2885
  resumeVisualMeasurement();
2789
2886
  return true;
@@ -2794,6 +2891,7 @@ const TLogView = defineComponent({
2794
2891
  emitScroll: true,
2795
2892
  stickToBottom: stickToBottom.value && nextTop >= maxScrollTop()
2796
2893
  });
2894
+ if (changed) selection.refresh();
2797
2895
  if (!changed) markViewportDirty();
2798
2896
  resumeVisualMeasurement();
2799
2897
  return true;
@@ -2809,6 +2907,7 @@ const TLogView = defineComponent({
2809
2907
  stickToBottom: true,
2810
2908
  extraDirtyRows: extraDirtyRow == null ? void 0 : [extraDirtyRow]
2811
2909
  });
2910
+ if (changed) selection.refresh();
2812
2911
  if (!changed) if (sameCountTailDirtyRows.length) markRowsDirty(sameCountTailDirtyRows);
2813
2912
  else markViewportDirty();
2814
2913
  resumeVisualMeasurement();
@@ -2827,6 +2926,7 @@ const TLogView = defineComponent({
2827
2926
  emitScroll: true,
2828
2927
  stickToBottom: isAtBottom()
2829
2928
  });
2929
+ if (changed) selection.refresh();
2830
2930
  if (!changed) markViewportDirty();
2831
2931
  resumeVisualMeasurement();
2832
2932
  return true;
@@ -2909,7 +3009,10 @@ const TLogView = defineComponent({
2909
3009
  stickToBottom: nextStick
2910
3010
  });
2911
3011
  if (!changed && nextStick != null) stickToBottom.value = nextStick;
2912
- if (changed) invalidateSelf("high", "input");
3012
+ if (changed) {
3013
+ selection.refresh();
3014
+ invalidateSelf("high", "input");
3015
+ }
2913
3016
  }
2914
3017
  function scrollToBottom() {
2915
3018
  cancelWheelScrollFrame();
@@ -2917,7 +3020,10 @@ const TLogView = defineComponent({
2917
3020
  emitScroll: true,
2918
3021
  stickToBottom: true
2919
3022
  });
2920
- if (changed) invalidateSelf("high", "scroll");
3023
+ if (changed) {
3024
+ selection.refresh();
3025
+ invalidateSelf("high", "scroll");
3026
+ }
2921
3027
  }
2922
3028
  function scrollToTop() {
2923
3029
  cancelWheelScrollFrame();
@@ -2925,7 +3031,10 @@ const TLogView = defineComponent({
2925
3031
  emitScroll: true,
2926
3032
  stickToBottom: false
2927
3033
  });
2928
- if (changed) invalidateSelf("high", "scroll");
3034
+ if (changed) {
3035
+ selection.refresh();
3036
+ invalidateSelf("high", "scroll");
3037
+ }
2929
3038
  }
2930
3039
  function scrollToVisualRow(row) {
2931
3040
  cancelWheelScrollFrame();
@@ -2934,12 +3043,100 @@ const TLogView = defineComponent({
2934
3043
  emitScroll: true,
2935
3044
  stickToBottom: target >= maxScrollTop()
2936
3045
  });
2937
- if (changed) invalidateSelf("high", "scroll");
3046
+ if (changed) {
3047
+ selection.refresh();
3048
+ invalidateSelf("high", "scroll");
3049
+ }
2938
3050
  }
2939
3051
  function scrollBy(delta) {
2940
3052
  const n = Math.trunc(Number(delta));
2941
3053
  scrollToVisualRow(currentScrollTop() + (Number.isFinite(n) ? n : 0));
2942
3054
  }
3055
+ function scrollSelectionBy(delta) {
3056
+ const n = Math.trunc(Number(delta));
3057
+ if (!Number.isFinite(n) || n === 0) return false;
3058
+ cancelWheelScrollFrame();
3059
+ if (isScrollControlled()) {
3060
+ const target$1 = currentScrollTop() + n;
3061
+ const clampedTop = normalizeScrollTop(target$1);
3062
+ if (clampedTop === currentScrollTop()) return false;
3063
+ if (pendingSelectionScrollFocusRemap) return false;
3064
+ pendingSelectionScrollFocusRemap = true;
3065
+ emit("update:scrollTop", clampedTop);
3066
+ emit("scroll", scrollPayload(clampedTop));
3067
+ invalidateSelf("high", "scroll");
3068
+ return true;
3069
+ }
3070
+ const target = currentScrollTop() + n;
3071
+ const changed = applyScrollTop(target, "viewport-repaint", {
3072
+ emitScroll: true,
3073
+ stickToBottom: target >= maxScrollTop()
3074
+ });
3075
+ if (!changed) return false;
3076
+ selection.refresh({ remapFocus: true });
3077
+ invalidateSelf("high", "scroll");
3078
+ return true;
3079
+ }
3080
+ function selectionPointForCell(point) {
3081
+ const r = normalizedRect();
3082
+ if (point.x < r.x || point.y < r.y || point.x >= r.x + r.w || point.y >= r.y + r.h) return null;
3083
+ const { x: clipX, y: clipY } = clipOffsets();
3084
+ const visualY = currentScrollTop() + clipY + (point.y - r.y);
3085
+ if (visualY < 0 || visualY >= estimatedVisualRowCount()) return null;
3086
+ return {
3087
+ x: clamp$9(clipX + (point.x - r.x), 0, Math.max(0, currentWrapWidth() - 1)),
3088
+ y: visualY
3089
+ };
3090
+ }
3091
+ function canHandleSelectionRange(range) {
3092
+ return Boolean(selectionPointForCell(range.anchor) && selectionPointForCell(range.focus));
3093
+ }
3094
+ function textForVisualRow(visualRow) {
3095
+ const count = lineCount();
3096
+ if (!props.wrap) {
3097
+ if (visualRow < 0 || visualRow >= count) return "";
3098
+ if (!props.ansi) return sanitizeInlineText(props.source.getLine(visualRow));
3099
+ const base$1 = props.style ?? defaultStyle.value;
3100
+ return ansiSegmentsForLine(visualRow, count, base$1, styleCacheKey(base$1)).map((segment) => segment.text).join("");
3101
+ }
3102
+ const located = locateVisualRow(visualRow);
3103
+ if (!located) return "";
3104
+ if (!props.ansi) return wrappedRowsForLine(located.lineIndex, count, currentWrapWidth())[located.partIndex] ?? "";
3105
+ const base = props.style ?? defaultStyle.value;
3106
+ const rows = ansiWrappedRowsForLine(located.lineIndex, count, currentWrapWidth(), base, styleCacheKey(base));
3107
+ return (rows[located.partIndex] ?? []).map((segment) => segment.text).join("");
3108
+ }
3109
+ function textForSelectionRange(range) {
3110
+ const cols = currentWrapWidth();
3111
+ const rows = estimatedVisualRowCount();
3112
+ return terminalSelectionRowSpans(range, cols, rows).map((span) => {
3113
+ const text = sliceByCellsRange(textForVisualRow(span.y), span.x0, span.x1);
3114
+ return span.x1 >= cols ? text.trimEnd() : text;
3115
+ }).join("\n");
3116
+ }
3117
+ function visibleSpansForSelectionRange(providerRange, _screenRange) {
3118
+ const r = normalizedRect();
3119
+ const { x: clipX, y: clipY } = clipOffsets();
3120
+ const cols = currentWrapWidth();
3121
+ const totalRows = Math.max(estimatedVisualRowCount(), providerRange.anchor.y + 1, providerRange.focus.y + 1);
3122
+ const top = currentScrollTop() + clipY;
3123
+ const bottom = top + r.h;
3124
+ const providerSpans = terminalSelectionVisibleRowSpans(providerRange, cols, totalRows, top, bottom);
3125
+ const result = [];
3126
+ for (const span of providerSpans) {
3127
+ const screenY = r.y + (span.y - top);
3128
+ const screenX0 = r.x + span.x0 - clipX;
3129
+ const screenX1 = r.x + span.x1 - clipX;
3130
+ const x0 = Math.max(r.x, screenX0);
3131
+ const x1 = Math.min(r.x + r.w, screenX1);
3132
+ if (screenY >= r.y && screenY < r.y + r.h && x1 > x0) result.push({
3133
+ y: screenY,
3134
+ x0,
3135
+ x1
3136
+ });
3137
+ }
3138
+ return result;
3139
+ }
2943
3140
  function scrollToLine(index, options) {
2944
3141
  const count = lineCount();
2945
3142
  if (count <= 0) return;
@@ -2953,8 +3150,8 @@ const TLogView = defineComponent({
2953
3150
  visualCount = visualCounts[lineIndex] ?? 1;
2954
3151
  }
2955
3152
  const h$1 = viewportHeight();
2956
- if ((options === null || options === void 0 ? void 0 : options.align) === "center") target -= Math.floor((h$1 - visualCount) / 2);
2957
- else if ((options === null || options === void 0 ? void 0 : options.align) === "end") target += visualCount - h$1;
3153
+ if (options?.align === "center") target -= Math.floor((h$1 - visualCount) / 2);
3154
+ else if (options?.align === "end") target += visualCount - h$1;
2958
3155
  scrollToVisualRow(target);
2959
3156
  }
2960
3157
  function repaintInvalidatedViewport() {
@@ -2963,6 +3160,7 @@ const TLogView = defineComponent({
2963
3160
  emitScroll: true,
2964
3161
  stickToBottom: stickToBottom.value && nextTop >= maxScrollTop()
2965
3162
  });
3163
+ if (changed) selection.refresh();
2966
3164
  if (!changed) markViewportDirty();
2967
3165
  invalidateSelf("normal", "data");
2968
3166
  }
@@ -3024,7 +3222,7 @@ const TLogView = defineComponent({
3024
3222
  return index$1 >= 0 ? index$1 : 0;
3025
3223
  }
3026
3224
  const located = locateVisualRow(visibleLineRange().start);
3027
- const firstVisibleLine = (located === null || located === void 0 ? void 0 : located.lineIndex) ?? 0;
3225
+ const firstVisibleLine = located?.lineIndex ?? 0;
3028
3226
  const index = searchMatches.findIndex((match) => match.index >= firstVisibleLine);
3029
3227
  return index >= 0 ? index : 0;
3030
3228
  }
@@ -3036,7 +3234,7 @@ const TLogView = defineComponent({
3036
3234
  return searchMatches.length - 1;
3037
3235
  }
3038
3236
  const located = locateVisualRow(Math.max(0, visibleLineRange().end - 1));
3039
- const lastVisibleLine = (located === null || located === void 0 ? void 0 : located.lineIndex) ?? lineCount() - 1;
3237
+ const lastVisibleLine = located?.lineIndex ?? lineCount() - 1;
3040
3238
  for (let i = searchMatches.length - 1; i >= 0; i--) if (searchMatches[i].index <= lastVisibleLine) return i;
3041
3239
  return searchMatches.length - 1;
3042
3240
  }
@@ -3058,7 +3256,7 @@ const TLogView = defineComponent({
3058
3256
  emitSearchMatch();
3059
3257
  invalidateSearchMarkers();
3060
3258
  emitSearchMarkers(true);
3061
- if ((options === null || options === void 0 ? void 0 : options.scroll) !== false) scrollToMatch(searchMatches[index], (options === null || options === void 0 ? void 0 : options.align) ?? "center");
3259
+ if (options?.scroll !== false) scrollToMatch(searchMatches[index], options?.align ?? "center");
3062
3260
  markViewportDirty();
3063
3261
  invalidateSelf("high", "data");
3064
3262
  return true;
@@ -3079,11 +3277,11 @@ const TLogView = defineComponent({
3079
3277
  return match ? copySearchMatch(match) : null;
3080
3278
  }
3081
3279
  function getSearchResults(options) {
3082
- const rawOffset = Number((options === null || options === void 0 ? void 0 : options.offset) ?? 0);
3083
- const rawLimit = Number((options === null || options === void 0 ? void 0 : options.limit) ?? searchMatches.length);
3280
+ const rawOffset = Number(options?.offset ?? 0);
3281
+ const rawLimit = Number(options?.limit ?? searchMatches.length);
3084
3282
  const offset = Number.isFinite(rawOffset) ? Math.max(0, Math.floor(rawOffset)) : 0;
3085
3283
  const limit = Number.isFinite(rawLimit) ? Math.max(0, Math.floor(rawLimit)) : searchMatches.length;
3086
- const includePreview = (options === null || options === void 0 ? void 0 : options.includePreview) === true;
3284
+ const includePreview = options?.includePreview === true;
3087
3285
  if (!includePreview) return searchMatches.slice(offset, offset + limit).map((match, index) => ({
3088
3286
  matchIndex: offset + index,
3089
3287
  match: copySearchMatch(match)
@@ -3091,8 +3289,8 @@ const TLogView = defineComponent({
3091
3289
  const count = lineCount();
3092
3290
  const base = props.style ?? defaultStyle.value;
3093
3291
  const baseStyleKey = styleCacheKey(base);
3094
- const previewWidth = normalizeSearchResultPreviewWidth(options === null || options === void 0 ? void 0 : options.previewWidth);
3095
- const contextCells = normalizeSearchResultContextCells(options === null || options === void 0 ? void 0 : options.contextCells);
3292
+ const previewWidth = normalizeSearchResultPreviewWidth(options?.previewWidth);
3293
+ const contextCells = normalizeSearchResultContextCells(options?.contextCells);
3096
3294
  return searchMatches.slice(offset, offset + limit).map((match, index) => ({
3097
3295
  matchIndex: offset + index,
3098
3296
  match: copySearchMatch(match),
@@ -3213,14 +3411,27 @@ const TLogView = defineComponent({
3213
3411
  keyboardScroll(bottomScrollTop(), true);
3214
3412
  }
3215
3413
  }
3414
+ const selectionTextProvider = {
3415
+ id: `${frameTaskId}:selection-text`,
3416
+ get rect() {
3417
+ return normalizedRect();
3418
+ },
3419
+ canHandle: canHandleSelectionRange,
3420
+ pointForCell: selectionPointForCell,
3421
+ getText: textForSelectionRange,
3422
+ getVisibleSpans: visibleSpansForSelectionRange
3423
+ };
3424
+ const unregisterSelectionTextProvider = selection.registerTextProvider(selectionTextProvider);
3425
+ onBeforeUnmount(unregisterSelectionTextProvider);
3216
3426
  const eventNode = useTerminalNode(() => ({
3217
3427
  rect: normalizedRect(),
3218
3428
  zIndex: eventZ.value,
3219
3429
  visible: visible.value,
3220
3430
  focusable: true,
3431
+ selectable: props.selectable,
3432
+ selectionScrollBy: scrollSelectionBy,
3221
3433
  handlers: {
3222
3434
  wheel: (e) => {
3223
- var _e$preventDefault2;
3224
3435
  const { deltaY, mode } = getWheelScrollInput(e);
3225
3436
  if (!deltaY) return;
3226
3437
  const maxTop = maxScrollTop();
@@ -3229,7 +3440,7 @@ const TLogView = defineComponent({
3229
3440
  const { nextTop, dir } = applyWheelScroll(wheelState, deltaY, baseTop, maxTop, now, mode, { disableAcceleration: mode === "pixel" });
3230
3441
  if (!dir || nextTop === baseTop) return;
3231
3442
  if (!requestWheelScroll(nextTop)) return;
3232
- (_e$preventDefault2 = e.preventDefault) === null || _e$preventDefault2 === void 0 || _e$preventDefault2.call(e);
3443
+ e.preventDefault?.();
3233
3444
  },
3234
3445
  focus: () => {
3235
3446
  focused.value = true;
@@ -3284,6 +3495,9 @@ const TLogView = defineComponent({
3284
3495
  watch(() => props.scrollTop, () => {
3285
3496
  cancelWheelScrollFrame();
3286
3497
  syncStickFromCurrentScrollTop();
3498
+ const remap = pendingSelectionScrollFocusRemap;
3499
+ pendingSelectionScrollFocusRemap = false;
3500
+ selection.refresh(remap ? { remapFocus: true } : void 0);
3287
3501
  markViewportDirty();
3288
3502
  invalidateSelf("high", "scroll");
3289
3503
  });
@@ -3291,14 +3505,8 @@ const TLogView = defineComponent({
3291
3505
  () => props.source,
3292
3506
  () => props.wrap,
3293
3507
  () => props.visualIndexMode,
3294
- () => {
3295
- var _props$visualIndexOpt3;
3296
- return (_props$visualIndexOpt3 = props.visualIndexOptions) === null || _props$visualIndexOpt3 === void 0 ? void 0 : _props$visualIndexOpt3.measureBudgetMs;
3297
- },
3298
- () => {
3299
- var _props$visualIndexOpt4;
3300
- return (_props$visualIndexOpt4 = props.visualIndexOptions) === null || _props$visualIndexOpt4 === void 0 ? void 0 : _props$visualIndexOpt4.maxMeasuredLines;
3301
- },
3508
+ () => props.visualIndexOptions?.measureBudgetMs,
3509
+ () => props.visualIndexOptions?.maxMeasuredLines,
3302
3510
  () => props.ansi,
3303
3511
  () => props.links,
3304
3512
  () => props.linkStyle,
@@ -3316,30 +3524,12 @@ const TLogView = defineComponent({
3316
3524
  }, { immediate: true });
3317
3525
  watch([
3318
3526
  () => props.searchQuery,
3319
- () => {
3320
- var _props$searchOptions9;
3321
- return (_props$searchOptions9 = props.searchOptions) === null || _props$searchOptions9 === void 0 ? void 0 : _props$searchOptions9.mode;
3322
- },
3323
- () => {
3324
- var _props$searchOptions10;
3325
- return (_props$searchOptions10 = props.searchOptions) === null || _props$searchOptions10 === void 0 ? void 0 : _props$searchOptions10.caseSensitive;
3326
- },
3327
- () => {
3328
- var _props$searchOptions11;
3329
- return (_props$searchOptions11 = props.searchOptions) === null || _props$searchOptions11 === void 0 ? void 0 : _props$searchOptions11.wholeWord;
3330
- },
3331
- () => {
3332
- var _props$searchOptions12;
3333
- return (_props$searchOptions12 = props.searchOptions) === null || _props$searchOptions12 === void 0 ? void 0 : _props$searchOptions12.regexFlags;
3334
- },
3335
- () => {
3336
- var _props$searchOptions13;
3337
- return (_props$searchOptions13 = props.searchOptions) === null || _props$searchOptions13 === void 0 ? void 0 : _props$searchOptions13.maxMatchesPerLine;
3338
- },
3339
- () => {
3340
- var _props$searchOptions14;
3341
- return (_props$searchOptions14 = props.searchOptions) === null || _props$searchOptions14 === void 0 ? void 0 : _props$searchOptions14.maxMatches;
3342
- },
3527
+ () => props.searchOptions?.mode,
3528
+ () => props.searchOptions?.caseSensitive,
3529
+ () => props.searchOptions?.wholeWord,
3530
+ () => props.searchOptions?.regexFlags,
3531
+ () => props.searchOptions?.maxMatchesPerLine,
3532
+ () => props.searchOptions?.maxMatches,
3343
3533
  () => props.ansi,
3344
3534
  () => props.links,
3345
3535
  () => props.source
@@ -3384,6 +3574,7 @@ const TLogView = defineComponent({
3384
3574
  emitUpdate: wasInitialized,
3385
3575
  stickToBottom: nextStick
3386
3576
  });
3577
+ if (changed) selection.refresh();
3387
3578
  if (!changed) markViewportDirty();
3388
3579
  invalidateSelf("normal", "data");
3389
3580
  }, { immediate: true });
@@ -3526,7 +3717,7 @@ const TLogView = defineComponent({
3526
3717
  });
3527
3718
  };
3528
3719
  const rows = dirtyRows;
3529
- if (rows === null || rows === void 0 ? void 0 : rows.length) {
3720
+ if (rows?.length) {
3530
3721
  for (const y of rows) paintRow(y);
3531
3722
  syncFocusedVisibleLinkFromViewport();
3532
3723
  trimRenderCache();
@@ -3726,7 +3917,6 @@ const TLogScrollbar = defineComponent({
3726
3917
  return intersectRect(translated, parent.clipRect) ?? EMPTY_RECT$5;
3727
3918
  });
3728
3919
  function emitTrackScroll(e) {
3729
- var _e$preventDefault4;
3730
3920
  const metrics = props.metrics;
3731
3921
  if (!metrics) return;
3732
3922
  const full = fullRect.value;
@@ -3735,15 +3925,13 @@ const TLogScrollbar = defineComponent({
3735
3925
  const { arrowRows, trackTop, trackHeight } = trackGeometry(full.h, props.showArrows);
3736
3926
  if (arrowRows) {
3737
3927
  if (localY === 0) {
3738
- var _e$preventDefault;
3739
3928
  emit("scrollBy", -Math.max(1, normalizeInt$7(metrics.viewportRows)));
3740
- (_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 || _e$preventDefault.call(e);
3929
+ e.preventDefault?.();
3741
3930
  return;
3742
3931
  }
3743
3932
  if (localY === full.h - 1) {
3744
- var _e$preventDefault2;
3745
3933
  emit("scrollBy", Math.max(1, normalizeInt$7(metrics.viewportRows)));
3746
- (_e$preventDefault2 = e.preventDefault) === null || _e$preventDefault2 === void 0 || _e$preventDefault2.call(e);
3934
+ e.preventDefault?.();
3747
3935
  return;
3748
3936
  }
3749
3937
  }
@@ -3752,7 +3940,6 @@ const TLogScrollbar = defineComponent({
3752
3940
  const isThumbRow = thumb != null && localY >= thumb.top && localY < thumb.top + thumb.size;
3753
3941
  const markerHit = !isThumbRow && props.showMarkers ? collectMarkersByRow$1(props.markers, metrics, full.h, props.showArrows).get(localY) : void 0;
3754
3942
  if (markerHit != null) {
3755
- var _e$preventDefault3;
3756
3943
  emit("markerClick", {
3757
3944
  marker: markerHit.marker,
3758
3945
  markerIndex: markerHit.index,
@@ -3760,14 +3947,14 @@ const TLogScrollbar = defineComponent({
3760
3947
  cellX: e.cellX,
3761
3948
  cellY: e.cellY
3762
3949
  });
3763
- (_e$preventDefault3 = e.preventDefault) === null || _e$preventDefault3 === void 0 || _e$preventDefault3.call(e);
3950
+ e.preventDefault?.();
3764
3951
  return;
3765
3952
  }
3766
3953
  const pos = clamp$8(localY - trackTop, 0, trackHeight - 1);
3767
3954
  const ratio = trackHeight <= 1 ? 0 : pos / (trackHeight - 1);
3768
3955
  const target = Math.round(ratio * Math.max(0, normalizeInt$7(metrics.maxScrollTop)));
3769
3956
  emit("scrollTo", target);
3770
- (_e$preventDefault4 = e.preventDefault) === null || _e$preventDefault4 === void 0 || _e$preventDefault4.call(e);
3957
+ e.preventDefault?.();
3771
3958
  }
3772
3959
  useTerminalNode(() => ({
3773
3960
  rect: rect.value,
@@ -3777,11 +3964,10 @@ const TLogScrollbar = defineComponent({
3777
3964
  handlers: {
3778
3965
  click: emitTrackScroll,
3779
3966
  wheel: (e) => {
3780
- var _e$preventDefault5;
3781
3967
  const dir = Math.sign(Number(e.deltaY ?? 0));
3782
3968
  if (!dir) return;
3783
3969
  emit("scrollBy", dir);
3784
- (_e$preventDefault5 = e.preventDefault) === null || _e$preventDefault5 === void 0 || _e$preventDefault5.call(e);
3970
+ e.preventDefault?.();
3785
3971
  }
3786
3972
  }
3787
3973
  }));
@@ -3837,18 +4023,15 @@ const TLogScrollbar = defineComponent({
3837
4023
  style = markerHit.marker.current ? currentMarkerStyle : markerStyle;
3838
4024
  }
3839
4025
  }
3840
- if (thumb && localY >= thumb.top && localY < thumb.top + thumb.size) {
3841
- var _props$metrics, _props$metrics2;
3842
- if (((_props$metrics = props.metrics) === null || _props$metrics === void 0 ? void 0 : _props$metrics.visualIndexStatus) === "measuring") {
3843
- char = MEASURING_THUMB_CHAR;
3844
- style = measuringThumbStyle;
3845
- } else if (((_props$metrics2 = props.metrics) === null || _props$metrics2 === void 0 ? void 0 : _props$metrics2.visualIndexStatus) === "estimated") {
3846
- char = ESTIMATED_THUMB_CHAR;
3847
- style = estimatedThumbStyle;
3848
- } else {
3849
- char = EXACT_THUMB_CHAR;
3850
- style = thumbStyle;
3851
- }
4026
+ if (thumb && localY >= thumb.top && localY < thumb.top + thumb.size) if (props.metrics?.visualIndexStatus === "measuring") {
4027
+ char = MEASURING_THUMB_CHAR;
4028
+ style = measuringThumbStyle;
4029
+ } else if (props.metrics?.visualIndexStatus === "estimated") {
4030
+ char = ESTIMATED_THUMB_CHAR;
4031
+ style = estimatedThumbStyle;
4032
+ } else {
4033
+ char = EXACT_THUMB_CHAR;
4034
+ style = thumbStyle;
3852
4035
  }
3853
4036
  terminal.put(r.x, y, char, style);
3854
4037
  };
@@ -4057,7 +4240,6 @@ const TLogMinimap = defineComponent({
4057
4240
  return intersectRect(translated, parent.clipRect) ?? EMPTY_RECT$4;
4058
4241
  });
4059
4242
  function onClick(e) {
4060
- var _e$preventDefault2;
4061
4243
  const metrics = props.metrics;
4062
4244
  if (!metrics) return;
4063
4245
  const full = fullRect.value;
@@ -4065,7 +4247,6 @@ const TLogMinimap = defineComponent({
4065
4247
  if (localY < 0 || localY >= full.h) return;
4066
4248
  const markerHit = props.showMarkers ? collectMarkersByRow(props.markers, metrics, full.h).get(localY) : void 0;
4067
4249
  if (markerHit) {
4068
- var _e$preventDefault;
4069
4250
  emit("markerClick", {
4070
4251
  marker: markerHit.marker,
4071
4252
  markerIndex: markerHit.index,
@@ -4073,7 +4254,7 @@ const TLogMinimap = defineComponent({
4073
4254
  cellX: e.cellX,
4074
4255
  cellY: e.cellY
4075
4256
  });
4076
- (_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 || _e$preventDefault.call(e);
4257
+ e.preventDefault?.();
4077
4258
  return;
4078
4259
  }
4079
4260
  emit("scrollTo", {
@@ -4081,7 +4262,7 @@ const TLogMinimap = defineComponent({
4081
4262
  cellX: e.cellX,
4082
4263
  cellY: e.cellY
4083
4264
  });
4084
- (_e$preventDefault2 = e.preventDefault) === null || _e$preventDefault2 === void 0 || _e$preventDefault2.call(e);
4265
+ e.preventDefault?.();
4085
4266
  }
4086
4267
  useTerminalNode(() => ({
4087
4268
  rect: rect.value,
@@ -4225,7 +4406,7 @@ function cellToStringIndex(text, cell) {
4225
4406
  return text.length;
4226
4407
  }
4227
4408
  function errorLabel$1(error) {
4228
- if ((error === null || error === void 0 ? void 0 : error.kind) === "invalid-regex") return "Invalid regex";
4409
+ if (error?.kind === "invalid-regex") return "Invalid regex";
4229
4410
  return "Search error";
4230
4411
  }
4231
4412
  const TLogSearchBar = defineComponent({
@@ -4462,9 +4643,8 @@ const TLogSearchBar = defineComponent({
4462
4643
  };
4463
4644
  });
4464
4645
  function focusSelf() {
4465
- var _events$value;
4466
4646
  const nodeId = eventNode.id.value;
4467
- if (nodeId) (_events$value = events.value) === null || _events$value === void 0 || _events$value.focus(nodeId);
4647
+ if (nodeId) events.value?.focus(nodeId);
4468
4648
  }
4469
4649
  function applyUpdate(next, field) {
4470
4650
  pendingUpdate.value = next;
@@ -4545,19 +4725,17 @@ const TLogSearchBar = defineComponent({
4545
4725
  if (localX < 0 || localX >= full.w) return;
4546
4726
  const layout = rowLayout.value;
4547
4727
  for (const hit of layout.hits) {
4548
- var _e$preventDefault;
4549
4728
  if (localX < hit.start || localX >= hit.end) continue;
4550
4729
  if (hit.action === "mode") toggleMode();
4551
4730
  else if (hit.action === "case") toggleCaseSensitive();
4552
4731
  else if (hit.action === "wholeWord") toggleWholeWord();
4553
4732
  else emitNavigation(hit.action);
4554
- (_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 || _e$preventDefault.call(e);
4733
+ e.preventDefault?.();
4555
4734
  return;
4556
4735
  }
4557
4736
  if (localX >= layout.inputStart && localX < layout.inputStart + layout.inputWidth) {
4558
- var _e$preventDefault2;
4559
4737
  setCursorFromLocalX(localX);
4560
- (_e$preventDefault2 = e.preventDefault) === null || _e$preventDefault2 === void 0 || _e$preventDefault2.call(e);
4738
+ e.preventDefault?.();
4561
4739
  }
4562
4740
  }
4563
4741
  function onKeydown(e) {
@@ -4934,17 +5112,16 @@ const TLogSearchResults = defineComponent({
4934
5112
  }
4935
5113
  }
4936
5114
  function onClick(e) {
4937
- var _events$value, _e$preventDefault;
4938
5115
  const full = fullRect.value;
4939
5116
  const localY = e.cellY - full.y;
4940
5117
  if (localY < 0 || localY >= full.h) return;
4941
5118
  const result = props.results[localY];
4942
5119
  if (!result) return;
4943
5120
  const nodeId = eventNode.id.value;
4944
- if (props.focusable && nodeId) (_events$value = events.value) === null || _events$value === void 0 || _events$value.focus(nodeId);
5121
+ if (props.focusable && nodeId) events.value?.focus(nodeId);
4945
5122
  setActiveIndex(localY);
4946
5123
  emitSelect(localY);
4947
- (_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 || _e$preventDefault.call(e);
5124
+ e.preventDefault?.();
4948
5125
  }
4949
5126
  const eventNode = useTerminalNode(() => ({
4950
5127
  rect: rect.value,
@@ -5097,7 +5274,7 @@ function formatCount(matchCount) {
5097
5274
  return `${matchCount} ${matchCount === 1 ? "match" : "matches"}`;
5098
5275
  }
5099
5276
  function errorLabel(error) {
5100
- if ((error === null || error === void 0 ? void 0 : error.kind) === "invalid-regex") return "Invalid regex";
5277
+ if (error?.kind === "invalid-regex") return "Invalid regex";
5101
5278
  return "Search error";
5102
5279
  }
5103
5280
  const TLogSearchPager = defineComponent({
@@ -5231,9 +5408,8 @@ const TLogSearchPager = defineComponent({
5231
5408
  scheduler.invalidate({ reason: "input" });
5232
5409
  }
5233
5410
  function focusSelf() {
5234
- var _events$value;
5235
5411
  const nodeId = eventNode.id.value;
5236
- if (nodeId) (_events$value = events.value) === null || _events$value === void 0 || _events$value.focus(nodeId);
5412
+ if (nodeId) events.value?.focus(nodeId);
5237
5413
  }
5238
5414
  function actionAt(cellX) {
5239
5415
  const full = fullRect.value;
@@ -5248,14 +5424,13 @@ const TLogSearchPager = defineComponent({
5248
5424
  return null;
5249
5425
  }
5250
5426
  function onClick(e) {
5251
- var _e$preventDefault;
5252
5427
  const full = fullRect.value;
5253
5428
  if (e.cellY !== full.y) return;
5254
5429
  focusSelf();
5255
5430
  const action = actionAt(e.cellX);
5256
5431
  if (!action) return;
5257
5432
  emitPage(action);
5258
- (_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 || _e$preventDefault.call(e);
5433
+ e.preventDefault?.();
5259
5434
  }
5260
5435
  function onKeydown(e) {
5261
5436
  if (e.key === "ArrowLeft" || e.key === "PageUp") {
@@ -5534,17 +5709,16 @@ const TLogLinksPanel = defineComponent({
5534
5709
  }
5535
5710
  }
5536
5711
  function onClick(e) {
5537
- var _events$value, _e$preventDefault;
5538
5712
  const full = fullRect.value;
5539
5713
  const localY = e.cellY - full.y;
5540
5714
  if (localY < 0 || localY >= full.h) return;
5541
5715
  const item = props.links[localY];
5542
5716
  if (!item) return;
5543
5717
  const nodeId = eventNode.id.value;
5544
- if (props.focusable && nodeId) (_events$value = events.value) === null || _events$value === void 0 || _events$value.focus(nodeId);
5718
+ if (props.focusable && nodeId) events.value?.focus(nodeId);
5545
5719
  setActiveIndex(localY);
5546
5720
  emitSelect(localY);
5547
- (_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 || _e$preventDefault.call(e);
5721
+ e.preventDefault?.();
5548
5722
  }
5549
5723
  const eventNode = useTerminalNode(() => ({
5550
5724
  rect: rect.value,
@@ -5942,7 +6116,7 @@ function normalizeMaxLines(value) {
5942
6116
  function createAppendOnlyLogStore(options) {
5943
6117
  const lines = [];
5944
6118
  const version = ref(0);
5945
- const maxLines = normalizeMaxLines(options === null || options === void 0 ? void 0 : options.maxLines);
6119
+ const maxLines = normalizeMaxLines(options?.maxLines);
5946
6120
  let head = 0;
5947
6121
  let firstLineIndex = 0;
5948
6122
  let tail = "";
@@ -5987,16 +6161,14 @@ function createAppendOnlyLogStore(options) {
5987
6161
  lineCount: () => retainedLineCount(),
5988
6162
  firstLineIndex: () => firstLineIndex,
5989
6163
  getLine(index) {
5990
- var _completedAt;
5991
6164
  const completedCount = retainedCompletedCount();
5992
- if (index >= 0 && index < completedCount) return ((_completedAt = completedAt(index)) === null || _completedAt === void 0 ? void 0 : _completedAt.text) ?? "";
6165
+ if (index >= 0 && index < completedCount) return completedAt(index)?.text ?? "";
5993
6166
  if (index === completedCount && tail) return tail;
5994
6167
  return "";
5995
6168
  },
5996
6169
  getLineKey(index) {
5997
- var _completedAt2;
5998
6170
  const completedCount = retainedCompletedCount();
5999
- if (index >= 0 && index < completedCount) return ((_completedAt2 = completedAt(index)) === null || _completedAt2 === void 0 ? void 0 : _completedAt2.id) ?? `missing:${firstLineIndex}:${index}`;
6171
+ if (index >= 0 && index < completedCount) return completedAt(index)?.id ?? `missing:${firstLineIndex}:${index}`;
6000
6172
  if (index === completedCount && tail) return `tail:${tailVersion}`;
6001
6173
  return `empty:${firstLineIndex}:${index}`;
6002
6174
  }
@@ -6061,6 +6233,12 @@ function escapeRegExp(value) {
6061
6233
  function stringIndexToCell(text, index) {
6062
6234
  return textCellWidth(text.slice(0, Math.max(0, index)));
6063
6235
  }
6236
+ function testRegex(pattern, text) {
6237
+ pattern.lastIndex = 0;
6238
+ const ok = pattern.test(text);
6239
+ pattern.lastIndex = 0;
6240
+ return ok;
6241
+ }
6064
6242
  function stripTLogAnsiText(text) {
6065
6243
  return parseTLogAnnotatedText(text).plainText;
6066
6244
  }
@@ -6090,13 +6268,15 @@ function parseTLogAnnotatedText(text) {
6090
6268
  const ch = text[i];
6091
6269
  out.push(ch);
6092
6270
  plainLength += ch.length;
6093
- if (currentHref) if ((activeLink === null || activeLink === void 0 ? void 0 : activeLink.href) === currentHref) activeLink.endIndex += ch.length;
6094
- else activeLink = {
6095
- href: currentHref,
6096
- startIndex: plainLength - ch.length,
6097
- endIndex: plainLength
6098
- };
6099
- else if (activeLink) flushLink();
6271
+ if (currentHref) {
6272
+ const link = activeLink;
6273
+ if (link && link.href === currentHref) link.endIndex += ch.length;
6274
+ else activeLink = {
6275
+ href: currentHref,
6276
+ startIndex: plainLength - ch.length,
6277
+ endIndex: plainLength
6278
+ };
6279
+ } else if (activeLink) flushLink();
6100
6280
  continue;
6101
6281
  }
6102
6282
  const next = text[i + 1];
@@ -6129,7 +6309,7 @@ function parseTLogAnnotatedText(text) {
6129
6309
  const parts = body.split(";");
6130
6310
  if (parts[0] === "8" && parts.length >= 3) {
6131
6311
  flushLink();
6132
- currentHref = parts.slice(2).join(";") || void 0;
6312
+ currentHref = sanitizeTerminalHref(parts.slice(2).join(";")) ?? void 0;
6133
6313
  }
6134
6314
  i = j;
6135
6315
  continue;
@@ -6142,16 +6322,21 @@ function parseTLogAnnotatedText(text) {
6142
6322
  };
6143
6323
  }
6144
6324
  function detectTLogUrls(text, options = {}) {
6145
- const pattern = options.pattern ?? /\b(?:https?:\/\/|file:\/\/)[^\s<>"'`]+/giu;
6325
+ const pattern = options.pattern ?? (options.allowFileUrls ? /\b(?:https?:\/\/|mailto:|file:\/\/)[^\s<>"'`]+/giu : /\b(?:https?:\/\/|mailto:)[^\s<>"'`]+/giu);
6146
6326
  const flags = pattern.flags.includes("g") ? pattern.flags : `${pattern.flags}g`;
6147
6327
  const regex = new RegExp(pattern.source, flags);
6148
6328
  const links = [];
6149
6329
  let match;
6150
6330
  while ((match = regex.exec(text)) != null) {
6151
- const href = match[0] ?? "";
6331
+ const rawHref = match[0] ?? "";
6332
+ if (rawHref.length === 0) {
6333
+ regex.lastIndex = Math.max(regex.lastIndex, match.index + 1);
6334
+ continue;
6335
+ }
6336
+ const href = sanitizeTerminalHref(rawHref, { allowFileUrls: options.allowFileUrls === true });
6152
6337
  if (!href) continue;
6153
6338
  const startIndex = match.index;
6154
- const endIndex = startIndex + href.length;
6339
+ const endIndex = startIndex + rawHref.length;
6155
6340
  const startCell = stringIndexToCell(text, startIndex);
6156
6341
  const endCell = stringIndexToCell(text, endIndex);
6157
6342
  if (endCell <= startCell) continue;
@@ -6162,7 +6347,6 @@ function detectTLogUrls(text, options = {}) {
6162
6347
  endCell,
6163
6348
  source: "url"
6164
6349
  });
6165
- if (!href.length) regex.lastIndex += 1;
6166
6350
  }
6167
6351
  return links;
6168
6352
  }
@@ -6170,9 +6354,9 @@ function detectTLogLevel(text, options = {}) {
6170
6354
  const errorPattern = options.errorPattern ?? /\b(?:ERROR|FATAL|ERR)\b/u;
6171
6355
  const warningPattern = options.warningPattern ?? /\b(?:WARN|WARNING)\b/u;
6172
6356
  const infoPattern = options.infoPattern ?? /\bINFO\b/u;
6173
- if (errorPattern.test(text)) return "error";
6174
- if (warningPattern.test(text)) return "warning";
6175
- if (options.includeInfo !== false && infoPattern.test(text)) return "info";
6357
+ if (testRegex(errorPattern, text)) return "error";
6358
+ if (testRegex(warningPattern, text)) return "warning";
6359
+ if (options.includeInfo !== false && testRegex(infoPattern, text)) return "info";
6176
6360
  return null;
6177
6361
  }
6178
6362
  function createTLogDensityBucketsFromMarkers(markers, totalVisualRows$1, bucketCount = 12) {
@@ -6196,12 +6380,10 @@ function createTLogDensityBucketsFromMarkers(markers, totalVisualRows$1, bucketC
6196
6380
  }).filter((bucket) => bucket != null);
6197
6381
  }
6198
6382
  function getTLogPluginMetadata(line, pluginName) {
6199
- var _line$results$find;
6200
- return ((_line$results$find = line.results.find((result) => result.pluginName === pluginName)) === null || _line$results$find === void 0 ? void 0 : _line$results$find.metadata) ?? null;
6383
+ return line.results.find((result) => result.pluginName === pluginName)?.metadata ?? null;
6201
6384
  }
6202
6385
  function dispatchTLogPluginLinkAction(plugins, action) {
6203
- var _plugin$onLinkAction;
6204
- for (const plugin of plugins ?? []) (_plugin$onLinkAction = plugin.onLinkAction) === null || _plugin$onLinkAction === void 0 || _plugin$onLinkAction.call(plugin, action);
6386
+ for (const plugin of plugins ?? []) plugin.onLinkAction?.(action);
6205
6387
  }
6206
6388
  function createTLogLevelPlugin(options = {}) {
6207
6389
  return {
@@ -6213,7 +6395,7 @@ function createTLogLevelPlugin(options = {}) {
6213
6395
  getMarkers(ctx) {
6214
6396
  return ctx.lines.flatMap((line) => {
6215
6397
  const metadata = getTLogPluginMetadata(line, "tlog-levels");
6216
- const level = metadata === null || metadata === void 0 ? void 0 : metadata.level;
6398
+ const level = metadata?.level;
6217
6399
  if (!level || level === "info" && options.includeInfo === false) return [];
6218
6400
  return [{
6219
6401
  id: `level:${line.absoluteLineIndex}:${level}`,
@@ -6230,7 +6412,7 @@ function createTLogLevelPlugin(options = {}) {
6230
6412
  getDensityBuckets(ctx) {
6231
6413
  const markers = ctx.lines.flatMap((line) => {
6232
6414
  const metadata = getTLogPluginMetadata(line, "tlog-levels");
6233
- const level = metadata === null || metadata === void 0 ? void 0 : metadata.level;
6415
+ const level = metadata?.level;
6234
6416
  if (!level || level === "info" && options.includeInfo === false) return [];
6235
6417
  return [{
6236
6418
  id: `density:${line.absoluteLineIndex}:${level}`,
@@ -6250,14 +6432,22 @@ function createTLogOsc8LinkPlugin() {
6250
6432
  name: "tlog-osc8-links",
6251
6433
  parseLine(ctx) {
6252
6434
  if (!ctx.osc8Links.length) return;
6253
- return { externalLinks: ctx.osc8Links.map((link, index) => ({
6254
- id: `osc8:${ctx.absoluteLineIndex}:${index}:${link.href}`,
6255
- href: link.href,
6256
- text: link.text,
6257
- startCell: link.startCell,
6258
- endCell: link.endCell,
6259
- source: "osc8"
6260
- })) };
6435
+ const links = [];
6436
+ for (let index = 0; index < ctx.osc8Links.length; index++) {
6437
+ const link = ctx.osc8Links[index];
6438
+ const href = sanitizeTerminalHref(link.href);
6439
+ if (!href) continue;
6440
+ links.push({
6441
+ id: `osc8:${ctx.absoluteLineIndex}:${index}:${href}`,
6442
+ href,
6443
+ text: link.text,
6444
+ startCell: link.startCell,
6445
+ endCell: link.endCell,
6446
+ source: "osc8"
6447
+ });
6448
+ }
6449
+ if (!links.length) return;
6450
+ return { externalLinks: links };
6261
6451
  }
6262
6452
  };
6263
6453
  }
@@ -6293,7 +6483,7 @@ function createTLogLineMatcherPlugin(options) {
6293
6483
  return {
6294
6484
  name: options.name,
6295
6485
  parseLine(ctx) {
6296
- if (!pattern.test(ctx.plainText)) return;
6486
+ if (!testRegex(pattern, ctx.plainText)) return;
6297
6487
  return { markers: [{
6298
6488
  id: `${options.name}:${ctx.absoluteLineIndex}`,
6299
6489
  label: options.label,
@@ -6303,7 +6493,7 @@ function createTLogLineMatcherPlugin(options) {
6303
6493
  getMarkers(ctx) {
6304
6494
  return ctx.lines.flatMap((line) => {
6305
6495
  const metadata = getTLogPluginMetadata(line, options.name);
6306
- return ((metadata === null || metadata === void 0 ? void 0 : metadata.markers) ?? []).map((marker, index) => ({
6496
+ return (metadata?.markers ?? []).map((marker, index) => ({
6307
6497
  id: String(marker.id ?? `${options.name}:${line.absoluteLineIndex}:${index}`),
6308
6498
  absoluteLineIndex: line.absoluteLineIndex,
6309
6499
  lineIndex: line.lineIndex,
@@ -6359,8 +6549,7 @@ function useTLogLinkController(logView, options = {}) {
6359
6549
  const activeIndex = ref(-1);
6360
6550
  let suppressedActivateKey = null;
6361
6551
  function emitAction(action) {
6362
- var _options$onAction;
6363
- (_options$onAction = options.onAction) === null || _options$onAction === void 0 || _options$onAction.call(options, action);
6552
+ options.onAction?.(action);
6364
6553
  dispatchTLogPluginLinkAction(options.plugins, action);
6365
6554
  }
6366
6555
  function suppressProgrammaticActivation(link) {
@@ -6378,32 +6567,27 @@ function useTLogLinkController(logView, options = {}) {
6378
6567
  });
6379
6568
  }
6380
6569
  function refresh() {
6381
- var _logView$value;
6382
- const next = ((_logView$value = logView.value) === null || _logView$value === void 0 ? void 0 : _logView$value.getVisibleLinks().map(toPanelItem)) ?? [];
6570
+ const next = logView.value?.getVisibleLinks().map(toPanelItem) ?? [];
6383
6571
  visibleLinks.value = next;
6384
6572
  activeIndex.value = next.findIndex((link) => link.current === true);
6385
6573
  }
6386
6574
  function focusVisibleLink(visibleIndex) {
6387
- var _logView$value2;
6388
- const focused = ((_logView$value2 = logView.value) === null || _logView$value2 === void 0 ? void 0 : _logView$value2.focusVisibleLink(visibleIndex)) === true;
6575
+ const focused = logView.value?.focusVisibleLink(visibleIndex) === true;
6389
6576
  refresh();
6390
6577
  return focused;
6391
6578
  }
6392
6579
  function focusNextLink() {
6393
- var _logView$value3;
6394
- const focused = ((_logView$value3 = logView.value) === null || _logView$value3 === void 0 ? void 0 : _logView$value3.focusNextLink()) === true;
6580
+ const focused = logView.value?.focusNextLink() === true;
6395
6581
  refresh();
6396
6582
  return focused;
6397
6583
  }
6398
6584
  function focusPreviousLink() {
6399
- var _logView$value4;
6400
- const focused = ((_logView$value4 = logView.value) === null || _logView$value4 === void 0 ? void 0 : _logView$value4.focusPreviousLink()) === true;
6585
+ const focused = logView.value?.focusPreviousLink() === true;
6401
6586
  refresh();
6402
6587
  return focused;
6403
6588
  }
6404
6589
  function clearFocus() {
6405
- var _logView$value5;
6406
- (_logView$value5 = logView.value) === null || _logView$value5 === void 0 || _logView$value5.clearLinkFocus();
6590
+ logView.value?.clearLinkFocus();
6407
6591
  refresh();
6408
6592
  }
6409
6593
  function activateVisibleLink(visibleIndex) {
@@ -6540,18 +6724,15 @@ function useTLogSearchResultsPage(logView, options = {}) {
6540
6724
  previewWidth: options.previewWidth,
6541
6725
  contextCells: options.contextCells
6542
6726
  }) : [];
6543
- const results = rawResults.map((entry) => {
6544
- var _entry$preview, _entry$preview2, _entry$preview3;
6545
- return {
6546
- matchIndex: entry.matchIndex,
6547
- absoluteLineIndex: entry.match.absoluteLineIndex,
6548
- lineIndex: entry.match.index,
6549
- text: ((_entry$preview = entry.preview) === null || _entry$preview === void 0 ? void 0 : _entry$preview.text) ?? "",
6550
- matchStartCell: ((_entry$preview2 = entry.preview) === null || _entry$preview2 === void 0 ? void 0 : _entry$preview2.matchStartCell) ?? 0,
6551
- matchEndCell: ((_entry$preview3 = entry.preview) === null || _entry$preview3 === void 0 ? void 0 : _entry$preview3.matchEndCell) ?? 0,
6552
- current: entry.matchIndex === search.currentMatchIndex
6553
- };
6554
- });
6727
+ const results = rawResults.map((entry) => ({
6728
+ matchIndex: entry.matchIndex,
6729
+ absoluteLineIndex: entry.match.absoluteLineIndex,
6730
+ lineIndex: entry.match.index,
6731
+ text: entry.preview?.text ?? "",
6732
+ matchStartCell: entry.preview?.matchStartCell ?? 0,
6733
+ matchEndCell: entry.preview?.matchEndCell ?? 0,
6734
+ current: entry.matchIndex === search.currentMatchIndex
6735
+ }));
6555
6736
  const activeIndex = search.currentMatchIndex >= offset && search.currentMatchIndex < offset + results.length ? search.currentMatchIndex - offset : -1;
6556
6737
  currentPage.value = page;
6557
6738
  state.value = {
@@ -6578,8 +6759,7 @@ function useTLogSearchResultsPage(logView, options = {}) {
6578
6759
  setPage(currentPage.value - 1);
6579
6760
  }
6580
6761
  function syncPageToCurrentMatch() {
6581
- var _logView$value;
6582
- const currentMatchIndex = ((_logView$value = logView.value) === null || _logView$value === void 0 ? void 0 : _logView$value.getSearchState().currentMatchIndex) ?? -1;
6762
+ const currentMatchIndex = logView.value?.getSearchState().currentMatchIndex ?? -1;
6583
6763
  if (currentMatchIndex >= 0) currentPage.value = Math.floor(currentMatchIndex / pageSize);
6584
6764
  refresh();
6585
6765
  }
@@ -6708,25 +6888,22 @@ function useTLogSearchController(logView, options = {}) {
6708
6888
  regexFlags.value = String(value ?? "");
6709
6889
  }
6710
6890
  function nextMatch() {
6711
- var _logView$value;
6712
6891
  recordHistory();
6713
- (_logView$value = logView.value) === null || _logView$value === void 0 || _logView$value.findNext();
6892
+ logView.value?.findNext();
6714
6893
  resultsPage.syncPageToCurrentMatch();
6715
6894
  refresh();
6716
6895
  }
6717
6896
  function previousMatch() {
6718
- var _logView$value2;
6719
6897
  recordHistory();
6720
- (_logView$value2 = logView.value) === null || _logView$value2 === void 0 || _logView$value2.findPrevious();
6898
+ logView.value?.findPrevious();
6721
6899
  resultsPage.syncPageToCurrentMatch();
6722
6900
  refresh();
6723
6901
  }
6724
6902
  function clearSearch() {
6725
- var _logView$value3;
6726
6903
  query.value = "";
6727
6904
  searchState.value = normalizeSearchState("");
6728
6905
  markers.value = [];
6729
- metrics.value = ((_logView$value3 = logView.value) === null || _logView$value3 === void 0 ? void 0 : _logView$value3.getScrollMetrics()) ?? null;
6906
+ metrics.value = logView.value?.getScrollMetrics() ?? null;
6730
6907
  resultsPage.clear();
6731
6908
  }
6732
6909
  function selectMatch(matchIndex) {
@@ -6740,7 +6917,7 @@ function useTLogSearchController(logView, options = {}) {
6740
6917
  if (!normalizedQuery) return null;
6741
6918
  recordHistory(normalizedQuery);
6742
6919
  const candidate = {
6743
- label: (label === null || label === void 0 ? void 0 : label.trim()) || void 0,
6920
+ label: label?.trim() || void 0,
6744
6921
  query: normalizedQuery,
6745
6922
  mode: mode.value,
6746
6923
  caseSensitive: caseSensitive.value,
@@ -6778,18 +6955,15 @@ function useTLogSearchController(logView, options = {}) {
6778
6955
  searchHistory.value = value.map((entry) => String(entry ?? "").trim()).filter(Boolean).slice(0, historyLimit);
6779
6956
  }
6780
6957
  function setSavedSearches(value) {
6781
- savedSearches.value = value.map((entry) => {
6782
- var _entry$label;
6783
- return {
6784
- id: String(entry.id),
6785
- label: ((_entry$label = entry.label) === null || _entry$label === void 0 ? void 0 : _entry$label.trim()) || void 0,
6786
- query: String(entry.query ?? ""),
6787
- mode: entry.mode === "regex" ? "regex" : "text",
6788
- caseSensitive: entry.caseSensitive === true,
6789
- wholeWord: entry.wholeWord === true,
6790
- regexFlags: entry.regexFlags || void 0
6791
- };
6792
- });
6958
+ savedSearches.value = value.map((entry) => ({
6959
+ id: String(entry.id),
6960
+ label: entry.label?.trim() || void 0,
6961
+ query: String(entry.query ?? ""),
6962
+ mode: entry.mode === "regex" ? "regex" : "text",
6963
+ caseSensitive: entry.caseSensitive === true,
6964
+ wholeWord: entry.wholeWord === true,
6965
+ regexFlags: entry.regexFlags || void 0
6966
+ }));
6793
6967
  }
6794
6968
  watch(() => logView.value, () => {
6795
6969
  refresh();
@@ -6845,22 +7019,21 @@ function useTLogVirtualSearchResults(logView, options = {}) {
6845
7019
  }
6846
7020
  function refresh() {
6847
7021
  const handle = logView.value;
6848
- const search = handle === null || handle === void 0 ? void 0 : handle.getSearchState();
6849
- const itemCount = Math.max(0, normalizeInt((search === null || search === void 0 ? void 0 : search.matchCount) ?? 0));
6850
- const currentMatchIndex = normalizeInt((search === null || search === void 0 ? void 0 : search.currentMatchIndex) ?? -1, -1);
7022
+ const search = handle?.getSearchState();
7023
+ const itemCount = Math.max(0, normalizeInt(search?.matchCount ?? 0));
7024
+ const currentMatchIndex = normalizeInt(search?.currentMatchIndex ?? -1, -1);
6851
7025
  const nextState = {
6852
7026
  itemCount,
6853
7027
  itemVersion: state.value.itemVersion + 1,
6854
7028
  activeIndex: currentMatchIndex >= 0 ? currentMatchIndex : -1,
6855
7029
  currentMatchIndex,
6856
- status: (search === null || search === void 0 ? void 0 : search.status) ?? "idle",
6857
- error: (search === null || search === void 0 ? void 0 : search.error) ?? null
7030
+ status: search?.status ?? "idle",
7031
+ error: search?.error ?? null
6858
7032
  };
6859
7033
  clearCache();
6860
7034
  state.value = nextState;
6861
7035
  }
6862
7036
  function getItem(index) {
6863
- var _entry$preview, _entry$preview2, _entry$preview3;
6864
7037
  const normalizedIndex = normalizeInt(index, -1);
6865
7038
  if (normalizedIndex < 0 || normalizedIndex >= state.value.itemCount) return null;
6866
7039
  const cached = cache.get(normalizedIndex);
@@ -6879,9 +7052,9 @@ function useTLogVirtualSearchResults(logView, options = {}) {
6879
7052
  matchIndex: entry.matchIndex,
6880
7053
  absoluteLineIndex: entry.match.absoluteLineIndex,
6881
7054
  lineIndex: entry.match.index,
6882
- text: ((_entry$preview = entry.preview) === null || _entry$preview === void 0 ? void 0 : _entry$preview.text) ?? entry.match.text,
6883
- matchStartCell: ((_entry$preview2 = entry.preview) === null || _entry$preview2 === void 0 ? void 0 : _entry$preview2.matchStartCell) ?? 0,
6884
- matchEndCell: ((_entry$preview3 = entry.preview) === null || _entry$preview3 === void 0 ? void 0 : _entry$preview3.matchEndCell) ?? Math.max(0, entry.match.text.length),
7055
+ text: entry.preview?.text ?? entry.match.text,
7056
+ matchStartCell: entry.preview?.matchStartCell ?? 0,
7057
+ matchEndCell: entry.preview?.matchEndCell ?? Math.max(0, entry.match.text.length),
6885
7058
  current: entry.matchIndex === state.value.currentMatchIndex
6886
7059
  };
6887
7060
  cache.set(normalizedIndex, item);
@@ -6918,6 +7091,9 @@ function normalizeMaxItems(value) {
6918
7091
  const n = Math.floor(Number(value ?? DEFAULT_MAX_ITEMS));
6919
7092
  return Number.isFinite(n) ? Math.max(1, n) : DEFAULT_MAX_ITEMS;
6920
7093
  }
7094
+ function sanitizeIndexedExternalHref(value, options = {}) {
7095
+ return sanitizeTerminalHref(value, options);
7096
+ }
6921
7097
  function useTLogRetainedIndex(logView, source, version, options = {}) {
6922
7098
  const status = ref("idle");
6923
7099
  const links = ref([]);
@@ -6926,7 +7102,7 @@ function useTLogRetainedIndex(logView, source, version, options = {}) {
6926
7102
  const plugins = computed(() => {
6927
7103
  const builtins = [];
6928
7104
  if (options.links) builtins.push(createTLogOsc8LinkPlugin());
6929
- if (options.urls) builtins.push(createTLogUrlPlugin());
7105
+ if (options.urls) builtins.push(createTLogUrlPlugin({ allowFileUrls: options.allowFileUrls }));
6930
7106
  if (options.levels) builtins.push(createTLogLevelPlugin({ bucketCount: options.bucketCount }));
6931
7107
  return [...builtins, ...options.plugins ?? []];
6932
7108
  });
@@ -6948,8 +7124,7 @@ function useTLogRetainedIndex(logView, source, version, options = {}) {
6948
7124
  function cancelFrame(handle) {
6949
7125
  if (!handle) return;
6950
7126
  if (handle.kind === "raf") {
6951
- var _cancelAnimationFrame, _ref;
6952
- (_cancelAnimationFrame = (_ref = globalThis).cancelAnimationFrame) === null || _cancelAnimationFrame === void 0 || _cancelAnimationFrame.call(_ref, handle.id);
7127
+ globalThis.cancelAnimationFrame?.(handle.id);
6953
7128
  return;
6954
7129
  }
6955
7130
  clearTimeout(handle.id);
@@ -6962,25 +7137,22 @@ function useTLogRetainedIndex(logView, source, version, options = {}) {
6962
7137
  if (status.value === "indexing") status.value = "idle";
6963
7138
  }
6964
7139
  function estimateVisualRow(lineIndex) {
6965
- var _logView$value;
6966
- const metrics = (_logView$value = logView.value) === null || _logView$value === void 0 ? void 0 : _logView$value.getScrollMetrics();
7140
+ const metrics = logView.value?.getScrollMetrics();
6967
7141
  if (!metrics) return Math.max(0, lineIndex);
6968
7142
  const lineCount = Math.max(1, metrics.lineCount);
6969
7143
  const totalVisualRows$1 = Math.max(metrics.visualRowCount, metrics.viewportRows, lineCount, 1);
6970
7144
  return clamp$1(Math.round(lineIndex / Math.max(1, lineCount - 1) * Math.max(0, totalVisualRows$1 - 1)), 0, Math.max(0, totalVisualRows$1 - 1));
6971
7145
  }
6972
7146
  function currentMatchLineIndex() {
6973
- var _handle$getSearchMatc;
6974
7147
  const handle = logView.value;
6975
7148
  if (!handle) return null;
6976
7149
  const current = handle.getSearchState().currentMatchIndex;
6977
7150
  if (current < 0) return null;
6978
- return ((_handle$getSearchMatc = handle.getSearchMatch(current)) === null || _handle$getSearchMatc === void 0 ? void 0 : _handle$getSearchMatc.index) ?? null;
7151
+ return handle.getSearchMatch(current)?.index ?? null;
6979
7152
  }
6980
7153
  function finalize(generationAtStart) {
6981
- var _logView$value2, _logView$value3;
6982
7154
  if (generationAtStart !== generation) return;
6983
- const totalVisualRows$1 = Math.max(((_logView$value2 = logView.value) === null || _logView$value2 === void 0 ? void 0 : _logView$value2.getScrollMetrics().visualRowCount) ?? indexedLines.length, ((_logView$value3 = logView.value) === null || _logView$value3 === void 0 ? void 0 : _logView$value3.getScrollMetrics().viewportRows) ?? 0, indexedLines.length, 1);
7155
+ const totalVisualRows$1 = Math.max(logView.value?.getScrollMetrics().visualRowCount ?? indexedLines.length, logView.value?.getScrollMetrics().viewportRows ?? 0, indexedLines.length, 1);
6984
7156
  const markerCtx = {
6985
7157
  lines: indexedLines,
6986
7158
  currentMatchLineIndex: currentMatchLineIndex(),
@@ -6991,10 +7163,9 @@ function useTLogRetainedIndex(logView, source, version, options = {}) {
6991
7163
  const nextDiagnostics = [];
6992
7164
  const nextDensity = [];
6993
7165
  for (const plugin of plugins.value) {
6994
- var _plugin$getMarkers, _plugin$getDensityBuc;
6995
- const markers = (_plugin$getMarkers = plugin.getMarkers) === null || _plugin$getMarkers === void 0 ? void 0 : _plugin$getMarkers.call(plugin, markerCtx);
7166
+ const markers = plugin.getMarkers?.(markerCtx);
6996
7167
  if (Array.isArray(markers) && markers.length) nextDiagnostics.push(...markers);
6997
- const buckets = (_plugin$getDensityBuc = plugin.getDensityBuckets) === null || _plugin$getDensityBuc === void 0 ? void 0 : _plugin$getDensityBuc.call(plugin, markerCtx);
7168
+ const buckets = plugin.getDensityBuckets?.(markerCtx);
6998
7169
  if (Array.isArray(buckets) && buckets.length) nextDensity.push(...buckets);
6999
7170
  }
7000
7171
  links.value = indexedLines.flatMap((line) => line.externalLinks);
@@ -7003,13 +7174,12 @@ function useTLogRetainedIndex(logView, source, version, options = {}) {
7003
7174
  status.value = "done";
7004
7175
  }
7005
7176
  function schedule() {
7006
- var _sourceValue$firstLin;
7007
7177
  const generationAtStart = generation;
7008
7178
  const sourceValue = source.value;
7009
7179
  const budgetMs = normalizeBudgetMs(options.budgetMs);
7010
7180
  const maxItems = normalizeMaxItems(options.maxItems);
7011
7181
  const lineCount = Math.max(0, Math.floor(Number(sourceValue.lineCount())));
7012
- const firstLineIndex = Math.max(0, Math.floor(Number(((_sourceValue$firstLin = sourceValue.firstLineIndex) === null || _sourceValue$firstLin === void 0 ? void 0 : _sourceValue$firstLin.call(sourceValue)) ?? 0)));
7182
+ const firstLineIndex = Math.max(0, Math.floor(Number(sourceValue.firstLineIndex?.() ?? 0)));
7013
7183
  const activePlugins = plugins.value;
7014
7184
  if (!lineCount) {
7015
7185
  links.value = [];
@@ -7022,17 +7192,15 @@ function useTLogRetainedIndex(logView, source, version, options = {}) {
7022
7192
  if (generationAtStart !== generation) return;
7023
7193
  const start = Date.now();
7024
7194
  while (cursor < lineCount && Date.now() - start < budgetMs) {
7025
- var _sourceValue$getLineK;
7026
7195
  const lineIndex = cursor++;
7027
7196
  const text = sourceValue.getLine(lineIndex);
7028
- const lineKey = ((_sourceValue$getLineK = sourceValue.getLineKey) === null || _sourceValue$getLineK === void 0 ? void 0 : _sourceValue$getLineK.call(sourceValue, lineIndex)) ?? `line:${version.value}:${lineIndex}`;
7197
+ const lineKey = sourceValue.getLineKey?.(lineIndex) ?? `line:${version.value}:${lineIndex}`;
7029
7198
  const parsed = parseTLogAnnotatedText(text);
7030
7199
  const results = [];
7031
7200
  const externalLinks = [];
7032
7201
  const seenLinks = new Set();
7033
7202
  for (const plugin of activePlugins) {
7034
- var _plugin$parseLine;
7035
- const metadata = (_plugin$parseLine = plugin.parseLine) === null || _plugin$parseLine === void 0 ? void 0 : _plugin$parseLine.call(plugin, {
7203
+ const metadata = plugin.parseLine?.({
7036
7204
  lineIndex,
7037
7205
  absoluteLineIndex: firstLineIndex + lineIndex,
7038
7206
  lineKey,
@@ -7046,12 +7214,14 @@ function useTLogRetainedIndex(logView, source, version, options = {}) {
7046
7214
  metadata
7047
7215
  });
7048
7216
  for (const link of metadata.externalLinks ?? []) {
7049
- const id = String(link.id ?? `${plugin.name}:${firstLineIndex + lineIndex}:${link.startCell}:${link.endCell}:${link.href}`);
7217
+ const href = sanitizeIndexedExternalHref(link.href, { allowFileUrls: options.allowFileUrls === true });
7218
+ if (!href) continue;
7219
+ const id = String(link.id ?? `${plugin.name}:${firstLineIndex + lineIndex}:${link.startCell}:${link.endCell}:${href}`);
7050
7220
  if (seenLinks.has(id) || externalLinks.length >= maxItems) continue;
7051
7221
  seenLinks.add(id);
7052
7222
  externalLinks.push({
7053
7223
  id,
7054
- href: link.href,
7224
+ href,
7055
7225
  text: link.text,
7056
7226
  absoluteLineIndex: firstLineIndex + lineIndex,
7057
7227
  lineIndex,
@@ -7131,17 +7301,17 @@ function createTLogViewSessionStore(options = {}) {
7131
7301
  const storage = options.storage ?? globalThis.localStorage ?? null;
7132
7302
  const state = ref(null);
7133
7303
  function load() {
7134
- const next = deserializeTLogViewSessionState(storage === null || storage === void 0 ? void 0 : storage.getItem(storageKey));
7304
+ const next = deserializeTLogViewSessionState(storage?.getItem(storageKey));
7135
7305
  state.value = next;
7136
7306
  return next;
7137
7307
  }
7138
7308
  function save(nextState) {
7139
7309
  state.value = nextState;
7140
- storage === null || storage === void 0 || storage.setItem(storageKey, serializeTLogViewSessionState(nextState));
7310
+ storage?.setItem(storageKey, serializeTLogViewSessionState(nextState));
7141
7311
  }
7142
7312
  function clear() {
7143
7313
  state.value = null;
7144
- storage === null || storage === void 0 || storage.removeItem(storageKey);
7314
+ storage?.removeItem(storageKey);
7145
7315
  }
7146
7316
  return {
7147
7317
  state,
@@ -7151,35 +7321,33 @@ function createTLogViewSessionStore(options = {}) {
7151
7321
  };
7152
7322
  }
7153
7323
  function captureTLogViewSessionState(bindings) {
7154
- var _bindings$logView$val, _bindings$visualIndex, _bindings$logView$val2, _bindings$search$sear, _bindings$search$save, _bindings$search, _bindings$linkControl, _bindings$wrap, _bindings$ansi, _bindings$links, _bindings$keyboardLin;
7155
- const metrics = (_bindings$logView$val = bindings.logView.value) === null || _bindings$logView$val === void 0 ? void 0 : _bindings$logView$val.getScrollMetrics();
7324
+ const metrics = bindings.logView.value?.getScrollMetrics();
7156
7325
  if (!metrics) return null;
7157
7326
  return {
7158
7327
  scrollTop: metrics.scrollTop,
7159
7328
  firstLineIndex: metrics.firstLineIndex,
7160
- visualIndexMode: ((_bindings$visualIndex = bindings.visualIndexMode) === null || _bindings$visualIndex === void 0 ? void 0 : _bindings$visualIndex.value) ?? "estimated",
7329
+ visualIndexMode: bindings.visualIndexMode?.value ?? "estimated",
7161
7330
  search: bindings.search ? {
7162
7331
  query: bindings.search.query.value,
7163
7332
  mode: bindings.search.mode.value,
7164
7333
  caseSensitive: bindings.search.caseSensitive.value,
7165
7334
  wholeWord: bindings.search.wholeWord.value,
7166
7335
  regexFlags: bindings.search.regexFlags.value || void 0,
7167
- currentMatchIndex: ((_bindings$logView$val2 = bindings.logView.value) === null || _bindings$logView$val2 === void 0 ? void 0 : _bindings$logView$val2.getSearchState().currentMatchIndex) ?? -1,
7168
- history: ((_bindings$search$sear = bindings.search.searchHistory) === null || _bindings$search$sear === void 0 ? void 0 : _bindings$search$sear.value) ?? [],
7169
- savedSearches: ((_bindings$search$save = bindings.search.savedSearches) === null || _bindings$search$save === void 0 ? void 0 : _bindings$search$save.value) ?? []
7336
+ currentMatchIndex: bindings.logView.value?.getSearchState().currentMatchIndex ?? -1,
7337
+ history: bindings.search.searchHistory?.value ?? [],
7338
+ savedSearches: bindings.search.savedSearches?.value ?? []
7170
7339
  } : void 0,
7171
7340
  ui: {
7172
- resultsPage: (_bindings$search = bindings.search) === null || _bindings$search === void 0 || (_bindings$search = _bindings$search.resultsPage) === null || _bindings$search === void 0 ? void 0 : _bindings$search.state.value.page,
7173
- linksPanelActiveIndex: (_bindings$linkControl = bindings.linkController) === null || _bindings$linkControl === void 0 ? void 0 : _bindings$linkControl.activeIndex.value,
7174
- wrap: (_bindings$wrap = bindings.wrap) === null || _bindings$wrap === void 0 ? void 0 : _bindings$wrap.value,
7175
- ansi: (_bindings$ansi = bindings.ansi) === null || _bindings$ansi === void 0 ? void 0 : _bindings$ansi.value,
7176
- links: (_bindings$links = bindings.links) === null || _bindings$links === void 0 ? void 0 : _bindings$links.value,
7177
- keyboardLinks: (_bindings$keyboardLin = bindings.keyboardLinks) === null || _bindings$keyboardLin === void 0 ? void 0 : _bindings$keyboardLin.value
7341
+ resultsPage: bindings.search?.resultsPage?.state.value.page,
7342
+ linksPanelActiveIndex: bindings.linkController?.activeIndex.value,
7343
+ wrap: bindings.wrap?.value,
7344
+ ansi: bindings.ansi?.value,
7345
+ links: bindings.links?.value,
7346
+ keyboardLinks: bindings.keyboardLinks?.value
7178
7347
  }
7179
7348
  };
7180
7349
  }
7181
7350
  function restoreTLogViewSessionState(bindings, state) {
7182
- var _state$ui2;
7183
7351
  if (!state) return false;
7184
7352
  if (bindings.visualIndexMode) bindings.visualIndexMode.value = state.visualIndexMode;
7185
7353
  if (state.ui) {
@@ -7189,33 +7357,27 @@ function restoreTLogViewSessionState(bindings, state) {
7189
7357
  if (bindings.keyboardLinks && state.ui.keyboardLinks != null) bindings.keyboardLinks.value = state.ui.keyboardLinks;
7190
7358
  }
7191
7359
  if (bindings.search && state.search) {
7192
- var _bindings$search$setS, _bindings$search2, _bindings$search$setS2, _bindings$search3, _state$ui, _bindings$search$resu;
7193
7360
  bindings.search.updateQuery(state.search.query);
7194
7361
  bindings.search.updateMode(state.search.mode);
7195
7362
  bindings.search.updateCaseSensitive(state.search.caseSensitive);
7196
7363
  bindings.search.updateWholeWord(state.search.wholeWord);
7197
7364
  bindings.search.updateRegexFlags(state.search.regexFlags ?? "");
7198
- (_bindings$search$setS = (_bindings$search2 = bindings.search).setSearchHistory) === null || _bindings$search$setS === void 0 || _bindings$search$setS.call(_bindings$search2, state.search.history ?? []);
7199
- (_bindings$search$setS2 = (_bindings$search3 = bindings.search).setSavedSearches) === null || _bindings$search$setS2 === void 0 || _bindings$search$setS2.call(_bindings$search3, state.search.savedSearches ?? []);
7200
- if (((_state$ui = state.ui) === null || _state$ui === void 0 ? void 0 : _state$ui.resultsPage) != null) (_bindings$search$resu = bindings.search.resultsPage) === null || _bindings$search$resu === void 0 || _bindings$search$resu.setPage(state.ui.resultsPage);
7365
+ bindings.search.setSearchHistory?.(state.search.history ?? []);
7366
+ bindings.search.setSavedSearches?.(state.search.savedSearches ?? []);
7367
+ if (state.ui?.resultsPage != null) bindings.search.resultsPage?.setPage(state.ui.resultsPage);
7201
7368
  if (!state.search.query) bindings.search.clearSearch();
7202
7369
  }
7203
7370
  const handle = bindings.logView.value;
7204
- const metrics = handle === null || handle === void 0 ? void 0 : handle.getScrollMetrics();
7371
+ const metrics = handle?.getScrollMetrics();
7205
7372
  if (handle && metrics) {
7206
- var _state$search;
7207
7373
  const firstLineDelta = metrics.firstLineIndex - state.firstLineIndex;
7208
7374
  const restoredScrollTop = clamp(state.scrollTop - Math.max(0, firstLineDelta), 0, metrics.maxScrollTop);
7209
7375
  handle.scrollToVisualRow(restoredScrollTop);
7210
- if ((((_state$search = state.search) === null || _state$search === void 0 ? void 0 : _state$search.currentMatchIndex) ?? -1) >= 0) {
7211
- var _bindings$search4;
7212
- (_bindings$search4 = bindings.search) === null || _bindings$search4 === void 0 || _bindings$search4.selectMatch(state.search.currentMatchIndex);
7213
- }
7376
+ if ((state.search?.currentMatchIndex ?? -1) >= 0) bindings.search?.selectMatch(state.search.currentMatchIndex);
7214
7377
  }
7215
- if (((_state$ui2 = state.ui) === null || _state$ui2 === void 0 ? void 0 : _state$ui2.linksPanelActiveIndex) != null) {
7216
- var _bindings$linkControl2, _bindings$linkControl3;
7217
- const restored = ((_bindings$linkControl2 = bindings.linkController) === null || _bindings$linkControl2 === void 0 ? void 0 : _bindings$linkControl2.focusVisibleLink(state.ui.linksPanelActiveIndex)) === true;
7218
- if (!restored && state.ui.linksPanelActiveIndex < 0) (_bindings$linkControl3 = bindings.linkController) === null || _bindings$linkControl3 === void 0 || _bindings$linkControl3.clearFocus();
7378
+ if (state.ui?.linksPanelActiveIndex != null) {
7379
+ const restored = bindings.linkController?.focusVisibleLink(state.ui.linksPanelActiveIndex) === true;
7380
+ if (!restored && state.ui.linksPanelActiveIndex < 0) bindings.linkController?.clearFocus();
7219
7381
  }
7220
7382
  return true;
7221
7383
  }
@@ -7247,45 +7409,39 @@ function eventSignature(event) {
7247
7409
  return parts.join("+");
7248
7410
  }
7249
7411
  function matchesTLogKeyBinding(event, bindings) {
7250
- if (!(bindings === null || bindings === void 0 ? void 0 : bindings.length)) return false;
7412
+ if (!bindings?.length) return false;
7251
7413
  const signature = eventSignature(event);
7252
7414
  return bindings.some((binding) => normalizeKeyToken(binding) === signature);
7253
7415
  }
7254
7416
  function handleTLogKeymapEvent(event, keymap, actions) {
7255
7417
  if (matchesTLogKeyBinding(event, keymap.searchNext)) {
7256
- var _actions$searchNext, _event$preventDefault;
7257
- (_actions$searchNext = actions.searchNext) === null || _actions$searchNext === void 0 || _actions$searchNext.call(actions);
7258
- (_event$preventDefault = event.preventDefault) === null || _event$preventDefault === void 0 || _event$preventDefault.call(event);
7418
+ actions.searchNext?.();
7419
+ event.preventDefault?.();
7259
7420
  return true;
7260
7421
  }
7261
7422
  if (matchesTLogKeyBinding(event, keymap.searchPrevious)) {
7262
- var _actions$searchPrevio, _event$preventDefault2;
7263
- (_actions$searchPrevio = actions.searchPrevious) === null || _actions$searchPrevio === void 0 || _actions$searchPrevio.call(actions);
7264
- (_event$preventDefault2 = event.preventDefault) === null || _event$preventDefault2 === void 0 || _event$preventDefault2.call(event);
7423
+ actions.searchPrevious?.();
7424
+ event.preventDefault?.();
7265
7425
  return true;
7266
7426
  }
7267
7427
  if (matchesTLogKeyBinding(event, keymap.clearSearch)) {
7268
- var _actions$clearSearch, _event$preventDefault3;
7269
- (_actions$clearSearch = actions.clearSearch) === null || _actions$clearSearch === void 0 || _actions$clearSearch.call(actions);
7270
- (_event$preventDefault3 = event.preventDefault) === null || _event$preventDefault3 === void 0 || _event$preventDefault3.call(event);
7428
+ actions.clearSearch?.();
7429
+ event.preventDefault?.();
7271
7430
  return true;
7272
7431
  }
7273
7432
  if (matchesTLogKeyBinding(event, keymap.nextLink)) {
7274
- var _actions$nextLink, _event$preventDefault4;
7275
- const handled = ((_actions$nextLink = actions.nextLink) === null || _actions$nextLink === void 0 ? void 0 : _actions$nextLink.call(actions)) === true;
7276
- if (handled) (_event$preventDefault4 = event.preventDefault) === null || _event$preventDefault4 === void 0 || _event$preventDefault4.call(event);
7433
+ const handled = actions.nextLink?.() === true;
7434
+ if (handled) event.preventDefault?.();
7277
7435
  return handled;
7278
7436
  }
7279
7437
  if (matchesTLogKeyBinding(event, keymap.previousLink)) {
7280
- var _actions$previousLink, _event$preventDefault5;
7281
- const handled = ((_actions$previousLink = actions.previousLink) === null || _actions$previousLink === void 0 ? void 0 : _actions$previousLink.call(actions)) === true;
7282
- if (handled) (_event$preventDefault5 = event.preventDefault) === null || _event$preventDefault5 === void 0 || _event$preventDefault5.call(event);
7438
+ const handled = actions.previousLink?.() === true;
7439
+ if (handled) event.preventDefault?.();
7283
7440
  return handled;
7284
7441
  }
7285
7442
  if (matchesTLogKeyBinding(event, keymap.activateLink)) {
7286
- var _actions$activateLink, _event$preventDefault6;
7287
- const handled = ((_actions$activateLink = actions.activateLink) === null || _actions$activateLink === void 0 ? void 0 : _actions$activateLink.call(actions)) === true;
7288
- if (handled) (_event$preventDefault6 = event.preventDefault) === null || _event$preventDefault6 === void 0 || _event$preventDefault6.call(event);
7443
+ const handled = actions.activateLink?.() === true;
7444
+ if (handled) event.preventDefault?.();
7289
7445
  return handled;
7290
7446
  }
7291
7447
  return false;
@@ -7405,71 +7561,64 @@ const tlogHighContrastPreset = Object.freeze({
7405
7561
  keymap: tlogHighContrastKeymap
7406
7562
  });
7407
7563
  function resolveTLogViewTheme(theme) {
7408
- var _theme$links, _theme$links2, _theme$search, _theme$search2;
7409
7564
  return {
7410
7565
  style: theme.base,
7411
- linkStyle: (_theme$links = theme.links) === null || _theme$links === void 0 ? void 0 : _theme$links.link,
7412
- linkFocusStyle: (_theme$links2 = theme.links) === null || _theme$links2 === void 0 ? void 0 : _theme$links2.focused,
7413
- matchStyle: (_theme$search = theme.search) === null || _theme$search === void 0 ? void 0 : _theme$search.match,
7414
- currentMatchStyle: (_theme$search2 = theme.search) === null || _theme$search2 === void 0 ? void 0 : _theme$search2.currentMatch
7566
+ linkStyle: theme.links?.link,
7567
+ linkFocusStyle: theme.links?.focused,
7568
+ matchStyle: theme.search?.match,
7569
+ currentMatchStyle: theme.search?.currentMatch
7415
7570
  };
7416
7571
  }
7417
7572
  function resolveTLogSearchBarTheme(theme) {
7418
- var _theme$search3, _theme$search4, _theme$search5, _theme$search6;
7419
7573
  return {
7420
7574
  style: theme.base,
7421
- inputStyle: (_theme$search3 = theme.search) === null || _theme$search3 === void 0 ? void 0 : _theme$search3.input,
7422
- activeStyle: (_theme$search4 = theme.search) === null || _theme$search4 === void 0 ? void 0 : _theme$search4.active,
7423
- errorStyle: (_theme$search5 = theme.search) === null || _theme$search5 === void 0 ? void 0 : _theme$search5.error,
7424
- disabledStyle: (_theme$search6 = theme.search) === null || _theme$search6 === void 0 ? void 0 : _theme$search6.disabled,
7575
+ inputStyle: theme.search?.input,
7576
+ activeStyle: theme.search?.active,
7577
+ errorStyle: theme.search?.error,
7578
+ disabledStyle: theme.search?.disabled,
7425
7579
  toggleStyle: theme.base
7426
7580
  };
7427
7581
  }
7428
7582
  function resolveTLogSearchResultsTheme(theme) {
7429
- var _theme$search7;
7430
7583
  return {
7431
7584
  style: theme.base,
7432
- activeStyle: (_theme$search7 = theme.search) === null || _theme$search7 === void 0 ? void 0 : _theme$search7.active
7585
+ activeStyle: theme.search?.active
7433
7586
  };
7434
7587
  }
7435
7588
  function resolveTLogSearchPagerTheme(theme) {
7436
- var _theme$search8, _theme$search9, _theme$search10;
7437
7589
  return {
7438
7590
  style: theme.base,
7439
- activeStyle: (_theme$search8 = theme.search) === null || _theme$search8 === void 0 ? void 0 : _theme$search8.active,
7440
- disabledStyle: (_theme$search9 = theme.search) === null || _theme$search9 === void 0 ? void 0 : _theme$search9.disabled,
7441
- errorStyle: (_theme$search10 = theme.search) === null || _theme$search10 === void 0 ? void 0 : _theme$search10.error
7591
+ activeStyle: theme.search?.active,
7592
+ disabledStyle: theme.search?.disabled,
7593
+ errorStyle: theme.search?.error
7442
7594
  };
7443
7595
  }
7444
7596
  function resolveTLogLinksPanelTheme(theme) {
7445
- var _theme$links3;
7446
7597
  return {
7447
7598
  style: theme.base,
7448
- activeStyle: (_theme$links3 = theme.links) === null || _theme$links3 === void 0 ? void 0 : _theme$links3.active
7599
+ activeStyle: theme.links?.active
7449
7600
  };
7450
7601
  }
7451
7602
  function resolveTLogScrollbarTheme(theme) {
7452
- var _theme$scrollbar, _theme$scrollbar2, _theme$scrollbar3, _theme$scrollbar4, _theme$scrollbar5;
7453
7603
  return {
7454
7604
  style: theme.base,
7455
- trackStyle: (_theme$scrollbar = theme.scrollbar) === null || _theme$scrollbar === void 0 ? void 0 : _theme$scrollbar.track,
7456
- thumbStyle: (_theme$scrollbar2 = theme.scrollbar) === null || _theme$scrollbar2 === void 0 ? void 0 : _theme$scrollbar2.thumb,
7457
- measuringStyle: (_theme$scrollbar3 = theme.scrollbar) === null || _theme$scrollbar3 === void 0 ? void 0 : _theme$scrollbar3.measuring,
7458
- markerStyle: (_theme$scrollbar4 = theme.scrollbar) === null || _theme$scrollbar4 === void 0 ? void 0 : _theme$scrollbar4.marker,
7459
- currentMarkerStyle: (_theme$scrollbar5 = theme.scrollbar) === null || _theme$scrollbar5 === void 0 ? void 0 : _theme$scrollbar5.currentMarker
7605
+ trackStyle: theme.scrollbar?.track,
7606
+ thumbStyle: theme.scrollbar?.thumb,
7607
+ measuringStyle: theme.scrollbar?.measuring,
7608
+ markerStyle: theme.scrollbar?.marker,
7609
+ currentMarkerStyle: theme.scrollbar?.currentMarker
7460
7610
  };
7461
7611
  }
7462
7612
  function resolveTLogMinimapTheme(theme) {
7463
- var _theme$minimap, _theme$minimap2, _theme$minimap3, _theme$minimap4, _theme$minimap5;
7464
7613
  return {
7465
7614
  style: theme.base,
7466
- densityStyle: (_theme$minimap = theme.minimap) === null || _theme$minimap === void 0 ? void 0 : _theme$minimap.density,
7467
- viewportStyle: (_theme$minimap2 = theme.minimap) === null || _theme$minimap2 === void 0 ? void 0 : _theme$minimap2.viewport,
7468
- markerStyle: (_theme$minimap3 = theme.minimap) === null || _theme$minimap3 === void 0 ? void 0 : _theme$minimap3.marker,
7469
- currentMarkerStyle: (_theme$minimap4 = theme.minimap) === null || _theme$minimap4 === void 0 ? void 0 : _theme$minimap4.currentMarker,
7470
- estimatedStyle: (_theme$minimap5 = theme.minimap) === null || _theme$minimap5 === void 0 ? void 0 : _theme$minimap5.estimated
7615
+ densityStyle: theme.minimap?.density,
7616
+ viewportStyle: theme.minimap?.viewport,
7617
+ markerStyle: theme.minimap?.marker,
7618
+ currentMarkerStyle: theme.minimap?.currentMarker,
7619
+ estimatedStyle: theme.minimap?.estimated
7471
7620
  };
7472
7621
  }
7473
7622
 
7474
7623
  //#endregion
7475
- export { TLogLinksPanel, TLogMinimap, TLogScrollbar, TLogSearchBar, TLogSearchPager, TLogSearchResults, TLogView, TLogVirtualLinksPanel, TLogVirtualSearchResults, TVirtualList, captureTLogViewSessionState, createAppendOnlyLogStore, createTLogDensityBucketsFromMarkers, createTLogLevelPlugin, createTLogLineMatcherPlugin, createTLogLinkActionPlugin, createTLogOsc8LinkPlugin, createTLogUrlPlugin, createTLogViewSessionStore, deserializeTLogViewSessionState, dispatchTLogPluginLinkAction, getTLogPluginMetadata, handleTLogKeymapEvent, matchesTLogKeyBinding, parseTLogAnnotatedText, resolveTLogLinksPanelTheme, resolveTLogMinimapTheme, resolveTLogScrollbarTheme, resolveTLogSearchBarTheme, resolveTLogSearchPagerTheme, resolveTLogSearchResultsTheme, resolveTLogViewTheme, restoreTLogViewSessionState, serializeTLogViewSessionState, stripTLogAnsiText, tlogDarkPreset, tlogDarkTheme, tlogDefaultKeymap, tlogDefaultPreset, tlogDefaultTheme, tlogHighContrastKeymap, tlogHighContrastPreset, tlogHighContrastTheme, toTLogExternalLinkFromVisibleLink, useTLogLinkController, useTLogRetainedIndex, useTLogSearchController, useTLogSearchResultsPage, useTLogVirtualSearchResults };
7624
+ export { TLogLinksPanel, TLogMinimap, TLogScrollbar, TLogSearchBar, TLogSearchPager, TLogSearchResults, TLogView, TLogVirtualLinksPanel, TLogVirtualSearchResults, TVirtualList, captureTLogViewSessionState, createAppendOnlyLogStore, createTLogDensityBucketsFromMarkers, createTLogLevelPlugin, createTLogLineMatcherPlugin, createTLogLinkActionPlugin, createTLogOsc8LinkPlugin, createTLogUrlPlugin, createTLogViewSessionStore, deserializeTLogViewSessionState, detectTLogUrls, dispatchTLogPluginLinkAction, getTLogPluginMetadata, handleTLogKeymapEvent, matchesTLogKeyBinding, parseTLogAnnotatedText, resolveTLogLinksPanelTheme, resolveTLogMinimapTheme, resolveTLogScrollbarTheme, resolveTLogSearchBarTheme, resolveTLogSearchPagerTheme, resolveTLogSearchResultsTheme, resolveTLogViewTheme, restoreTLogViewSessionState, sanitizeTerminalHref, serializeTLogViewSessionState, stripTLogAnsiText, tlogDarkPreset, tlogDarkTheme, tlogDefaultKeymap, tlogDefaultPreset, tlogDefaultTheme, tlogHighContrastKeymap, tlogHighContrastPreset, tlogHighContrastTheme, toTLogExternalLinkFromVisibleLink, useTLogLinkController, useTLogRetainedIndex, useTLogSearchController, useTLogSearchResultsPage, useTLogVirtualSearchResults };