@vscode/markdown-editor 0.0.2-30 → 0.0.2-31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { O as v, S as N, a as Se } from "./stringEdit-DzLs4E1d.js";
2
2
  import kn from "katex";
3
3
  import { o as R, d as $, t as bn, n as U, V as rs, q as H, A as cs } from "./runOnChange-e7FtCqOQ.js";
4
4
  import { D as as, f as ls, a as ds, b as hs, c as us, d as fs } from "./config-Dvgk17FF.js";
5
- import { e as Sc } from "./config-Dvgk17FF.js";
5
+ import { e as Oc } from "./config-Dvgk17FF.js";
6
6
  import { parse as ms, preprocess as gs, postprocess as ps } from "micromark";
7
7
  import { math as _s } from "micromark-extension-math";
8
8
  import { gfmTable as vs } from "micromark-extension-gfm-table";
@@ -651,7 +651,7 @@ function xn(n, e) {
651
651
  }
652
652
  }
653
653
  const Es = /\[[ xX]\]/;
654
- function fc(n) {
654
+ function mc(n) {
655
655
  if (n.checked === void 0)
656
656
  return;
657
657
  const e = Es.exec(yn(n));
@@ -1460,7 +1460,7 @@ function Fs(n) {
1460
1460
  let e = Bt.get(n);
1461
1461
  return e === void 0 && (e = Hs++, Bt.set(n, e)), e;
1462
1462
  }
1463
- function mc(n, e) {
1463
+ function gc(n, e) {
1464
1464
  let t = 0;
1465
1465
  function s(i) {
1466
1466
  const o = t, r = i.children;
@@ -1565,7 +1565,7 @@ function je(n, e, t, s, i) {
1565
1565
  return o;
1566
1566
  }
1567
1567
  const Zs = Symbol("NO_ACTIVE_BLOCKS");
1568
- class gc {
1568
+ class pc {
1569
1569
  _parser = new Ps();
1570
1570
  /**
1571
1571
  * The most recent edit applied to {@link sourceText}, used by
@@ -4581,11 +4581,14 @@ function tr(n) {
4581
4581
  function nr(n) {
4582
4582
  return n.windowHasFocus && n.focusIsUnclaimed;
4583
4583
  }
4584
- const sr = 900;
4585
- class pc extends U {
4584
+ function sr(n) {
4585
+ return !n.windowHasFocus;
4586
+ }
4587
+ const ir = 900;
4588
+ class _c extends U {
4586
4589
  constructor(e, t) {
4587
4590
  super(), this._model = e, this._options = t, this.element = document.createElement("div"), this.element.className = "md-editor", this._options?.classNames && this.element.classList.add(...this._options.classNames), this.element.tabIndex = 0, this._contentContainer = document.createElement("div"), this._contentContainer.className = "md-editor-content", this.element.appendChild(this._contentContainer);
4588
- const s = this._options?.limitedWidth ?? cs(sr);
4591
+ const s = this._options?.limitedWidth ?? cs(ir);
4589
4592
  this._register(H((a) => {
4590
4593
  const l = s.read(a);
4591
4594
  this._contentContainer.style.maxWidth = l === void 0 ? "" : `${l}px`;
@@ -4841,11 +4844,12 @@ class pc extends U {
4841
4844
  this.element.focus({ preventScroll: !0 });
4842
4845
  }
4843
4846
  /**
4844
- * Focuses the editor when it opens, but only if doing so will not steal
4845
- * focus from an explicit user target: the window must already be focused and
4846
- * no other element may have claimed focus yet. Returns whether focus was
4847
- * taken. Intended for the single editable editor on open; a no-op for a
4848
- * background window or when the user has already focused something else.
4847
+ * One-shot guarded focus attempt: focuses the editor only if doing so will
4848
+ * not steal focus from an explicit user target the window must already be
4849
+ * focused and no other element may have claimed focus yet. Returns whether
4850
+ * focus was taken. A no-op for a background window or when the user has
4851
+ * already focused something else. {@link autoFocusOnOpen} builds the
4852
+ * open-time behavior on top of this primitive.
4849
4853
  */
4850
4854
  tryAutoFocus() {
4851
4855
  const e = this.element.ownerDocument, t = e.activeElement, s = {
@@ -4854,6 +4858,24 @@ class pc extends U {
4854
4858
  };
4855
4859
  return nr(s) ? (this.focus(), !0) : !1;
4856
4860
  }
4861
+ /**
4862
+ * Focuses the editor when it opens without ever stealing focus from an
4863
+ * explicit user target. Tries once immediately ({@link tryAutoFocus}); if the
4864
+ * window is not focused yet — a common open-time race where the editor is
4865
+ * mounted before the host routes focus to its window — the guarded attempt is
4866
+ * deferred to the next time the window gains focus and re-evaluated then. The
4867
+ * deferral is one-shot, so a later, unrelated window refocus never grabs
4868
+ * focus, and the re-check still respects any target the user has claimed in
4869
+ * the meantime.
4870
+ */
4871
+ autoFocusOnOpen() {
4872
+ if (this.tryAutoFocus() || !sr({ windowHasFocus: this.element.ownerDocument.hasFocus() }))
4873
+ return;
4874
+ const e = this.element.ownerDocument.defaultView ?? window, t = () => {
4875
+ e.removeEventListener("focus", t), this.tryAutoFocus();
4876
+ };
4877
+ e.addEventListener("focus", t), this._register({ dispose: () => e.removeEventListener("focus", t) });
4878
+ }
4857
4879
  /**
4858
4880
  * Own point→offset resolution. When `true` (the default),
4859
4881
  * {@link resolveOffsetFromPoint} ignores the platform DOM hit-test
@@ -5024,7 +5046,7 @@ class pc extends U {
5024
5046
  this._diffHighlightsView.clear();
5025
5047
  }
5026
5048
  }
5027
- class ir {
5049
+ class or {
5028
5050
  connect(e) {
5029
5051
  const t = (r) => {
5030
5052
  const c = e.getSelectedText();
@@ -5044,7 +5066,7 @@ class ir {
5044
5066
  };
5045
5067
  }
5046
5068
  }
5047
- class _c {
5069
+ class vc {
5048
5070
  constructor(e = navigator.clipboard) {
5049
5071
  this._clipboard = e;
5050
5072
  }
@@ -5147,7 +5169,7 @@ const S = ["macos"], j = ["windows", "linux"], y = (n, e = !1) => ({
5147
5169
  p("Enter", We("insertHardLineBreak"), { shift: !0 }),
5148
5170
  p("Enter", We("insertParagraph"), { ctrl: !0 })
5149
5171
  ]
5150
- }, or = /* @__PURE__ */ new Set([
5172
+ }, rr = /* @__PURE__ */ new Set([
5151
5173
  "ArrowLeft",
5152
5174
  "ArrowRight",
5153
5175
  "ArrowUp",
@@ -5155,13 +5177,13 @@ const S = ["macos"], j = ["windows", "linux"], y = (n, e = !1) => ({
5155
5177
  "Home",
5156
5178
  "End"
5157
5179
  ]);
5158
- function rr(n) {
5159
- return or.has(n);
5160
- }
5161
5180
  function cr(n) {
5162
- return n.includes("Macintosh") || n.includes("Mac OS X") ? "macos" : n.includes("Windows") ? "windows" : "linux";
5181
+ return rr.has(n);
5163
5182
  }
5164
5183
  function ar(n) {
5184
+ return n.includes("Macintosh") || n.includes("Mac OS X") ? "macos" : n.includes("Windows") ? "windows" : "linux";
5185
+ }
5186
+ function lr(n) {
5165
5187
  return {
5166
5188
  key: n.key,
5167
5189
  code: n.code,
@@ -5172,26 +5194,26 @@ function ar(n) {
5172
5194
  altGraphKey: n.getModifierState("AltGraph")
5173
5195
  };
5174
5196
  }
5175
- function lr(n, e, t = ss) {
5197
+ function dr(n, e, t = ss) {
5176
5198
  if (n.altGraphKey)
5177
5199
  return;
5178
- const s = n.key.length === 1 ? n.key.toLowerCase() : n.key, i = /^[a-z]$/.test(s) ? void 0 : dr(n.code);
5200
+ const s = n.key.length === 1 ? n.key.toLowerCase() : n.key, i = /^[a-z]$/.test(s) ? void 0 : hr(n.code);
5179
5201
  for (const o of t.bindings)
5180
- if ((o.key === s || o.key === i) && (!o.platforms || o.platforms.includes(e)) && hr(n, o.modifiers))
5202
+ if ((o.key === s || o.key === i) && (!o.platforms || o.platforms.includes(e)) && ur(n, o.modifiers))
5181
5203
  return o.action;
5182
5204
  }
5183
- function dr(n) {
5205
+ function hr(n) {
5184
5206
  return /^Key([A-Z])$/.exec(n)?.[1].toLowerCase();
5185
5207
  }
5186
- function hr(n, e = {}) {
5208
+ function ur(n, e = {}) {
5187
5209
  return n.shiftKey === !!e.shift && n.altKey === !!e.alt && n.ctrlKey === !!e.ctrl && n.metaKey === !!e.meta;
5188
5210
  }
5189
- const ur = 500, dn = 5;
5190
- class vc extends U {
5211
+ const fr = 500, dn = 5;
5212
+ class wc extends U {
5191
5213
  constructor(e, t, s) {
5192
5214
  super(), this._model = e, this._view = t;
5193
5215
  const i = this._view.element, o = i.ownerDocument.defaultView ?? window;
5194
- this._keyboardPlatform = s?.keyboardPlatform ?? cr(o.navigator.userAgent), this._keyboardProfile = s?.keyboardProfile ?? ss, i.addEventListener("pointerdown", this._handlePointerDown), i.addEventListener("keydown", this._handleKeyDown), this._register({
5216
+ this._keyboardPlatform = s?.keyboardPlatform ?? ar(o.navigator.userAgent), this._keyboardProfile = s?.keyboardProfile ?? ss, i.addEventListener("pointerdown", this._handlePointerDown), i.addEventListener("keydown", this._handleKeyDown), this._register({
5195
5217
  dispose: () => {
5196
5218
  i.removeEventListener("pointerdown", this._handlePointerDown), i.removeEventListener("keydown", this._handleKeyDown);
5197
5219
  }
@@ -5200,7 +5222,7 @@ class vc extends U {
5200
5222
  o.removeEventListener("keydown", this._updateModifierState), o.removeEventListener("keyup", this._updateModifierState), o.removeEventListener("blur", this._clearModifierState), i.ownerDocument.removeEventListener("selectionchange", this._discardNativeSelection);
5201
5223
  }
5202
5224
  });
5203
- const r = s?.clipboardStrategy ?? new ir();
5225
+ const r = s?.clipboardStrategy ?? new or();
5204
5226
  this._register(r.connect({
5205
5227
  element: i,
5206
5228
  getSelectedText: () => this._selectedText(),
@@ -5240,7 +5262,7 @@ class vc extends U {
5240
5262
  if (e.button !== 0)
5241
5263
  return;
5242
5264
  e.preventDefault(), this._model.cancelPendingParagraph(), this._view.focus(), this._desiredColumn = void 0;
5243
- const t = new de(e.clientX, e.clientY), s = this._lastPointerDown, i = s !== void 0 && e.timeStamp - s.time < ur && Math.abs(t.x - s.point.x) < dn && Math.abs(t.y - s.point.y) < dn;
5265
+ const t = new de(e.clientX, e.clientY), s = this._lastPointerDown, i = s !== void 0 && e.timeStamp - s.time < fr && Math.abs(t.x - s.point.x) < dn && Math.abs(t.y - s.point.y) < dn;
5244
5266
  if (this._clickCount = i ? this._clickCount + 1 : 1, this._lastPointerDown = { time: e.timeStamp, point: t }, !this._view.isPointInContent(t)) {
5245
5267
  this._model.selection.set(void 0, void 0);
5246
5268
  return;
@@ -5252,7 +5274,7 @@ class vc extends U {
5252
5274
  return;
5253
5275
  }
5254
5276
  if (this._clickCount === 3) {
5255
- const u = mr(this._model.document.get(), o);
5277
+ const u = gr(this._model.document.get(), o);
5256
5278
  u && this._model.selection.set(zi(this._makeCursorContext(), u), void 0);
5257
5279
  return;
5258
5280
  }
@@ -5357,19 +5379,19 @@ class vc extends U {
5357
5379
  !t || t.rangeCount === 0 || t.isCollapsed || !this._view.containsRenderedContent(t.anchorNode) && !this._view.containsRenderedContent(t.focusNode) || t.removeAllRanges();
5358
5380
  };
5359
5381
  _handleKeyDown = (e) => {
5360
- if (e.isComposing || fr(e, this._view.element))
5382
+ if (e.isComposing || mr(e, this._view.element))
5361
5383
  return;
5362
5384
  if (this._updateModifierState(e), this._model.pendingParagraph.get() !== void 0 && (e.key === "Backspace" || e.key === "Escape")) {
5363
5385
  hn(e), this._model.cancelPendingParagraph();
5364
5386
  return;
5365
5387
  }
5366
- const t = lr(
5367
- ar(e),
5388
+ const t = dr(
5389
+ lr(e),
5368
5390
  this._keyboardPlatform,
5369
5391
  this._keyboardProfile
5370
5392
  );
5371
5393
  if (!t) {
5372
- rr(e.key) && e.preventDefault();
5394
+ cr(e.key) && e.preventDefault();
5373
5395
  return;
5374
5396
  }
5375
5397
  hn(e), this._model.pendingParagraph.get() !== void 0 && t.kind !== "enter" && this._model.cancelPendingParagraph(), this._executeKeyboardAction(t);
@@ -5492,10 +5514,10 @@ function ze(n) {
5492
5514
  function hn(n) {
5493
5515
  n.preventDefault(), n.stopPropagation();
5494
5516
  }
5495
- function fr(n, e) {
5517
+ function mr(n, e) {
5496
5518
  return n.target !== e;
5497
5519
  }
5498
- function mr(n, e) {
5520
+ function gr(n, e) {
5499
5521
  const t = new Set(n.blocks);
5500
5522
  let s = 0;
5501
5523
  for (const i of n.children) {
@@ -5508,7 +5530,7 @@ function mr(n, e) {
5508
5530
  }
5509
5531
  }
5510
5532
  const un = "md-debug-show-line-rects";
5511
- function gr(n, e) {
5533
+ function pr(n, e) {
5512
5534
  try {
5513
5535
  const t = localStorage.getItem(n);
5514
5536
  return t === null ? e : t === "true";
@@ -5516,20 +5538,20 @@ function gr(n, e) {
5516
5538
  return e;
5517
5539
  }
5518
5540
  }
5519
- function pr(n, e) {
5541
+ function _r(n, e) {
5520
5542
  try {
5521
5543
  localStorage.setItem(n, String(e));
5522
5544
  } catch {
5523
5545
  }
5524
5546
  }
5525
- class wc extends U {
5547
+ class kc extends U {
5526
5548
  overlayElement;
5527
5549
  infoElement;
5528
5550
  rendering;
5529
5551
  /** Absolute source offsets that map to a rendered DOM character. */
5530
5552
  mappedOffsets;
5531
5553
  /** Whether the dashed line-bands and run boxes are drawn (persisted). */
5532
- _showLineRects = R(this, gr(un, !0));
5554
+ _showLineRects = R(this, pr(un, !0));
5533
5555
  constructor(e, t) {
5534
5556
  super(), this.overlayElement = document.createElement("div"), this.overlayElement.className = "md-debug-layout-overlay", Object.assign(this.overlayElement.style, {
5535
5557
  position: "absolute",
@@ -5558,12 +5580,12 @@ class wc extends U {
5558
5580
  });
5559
5581
  const i = document.createElement("input");
5560
5582
  i.type = "checkbox", i.checked = this._showLineRects.get(), i.addEventListener("change", () => {
5561
- this._showLineRects.set(i.checked, void 0), pr(un, i.checked);
5583
+ this._showLineRects.set(i.checked, void 0), _r(un, i.checked);
5562
5584
  }), s.appendChild(i), s.appendChild(document.createTextNode("show line rects")), this.infoElement.appendChild(s);
5563
5585
  const o = document.createElement("pre");
5564
5586
  o.style.margin = "0", o.style.whiteSpace = "pre", this.infoElement.appendChild(o), this.rendering = $(this, (r) => {
5565
5587
  const c = r.readObservable(t.model.measurements), a = r.readObservable(this._showLineRects);
5566
- return vr(
5588
+ return wr(
5567
5589
  this.overlayElement,
5568
5590
  o,
5569
5591
  c,
@@ -5575,16 +5597,16 @@ class wc extends U {
5575
5597
  }), this.mappedOffsets = $(this, (r) => r.readObservable(this.rendering).mappedOffsets), this._register(H((r) => {
5576
5598
  r.readObservable(this.rendering);
5577
5599
  const c = t.hoveredOffset ? r.readObservable(t.hoveredOffset) : void 0;
5578
- t.hoveredOffset && kr(this.overlayElement, c);
5600
+ t.hoveredOffset && br(this.overlayElement, c);
5579
5601
  }));
5580
5602
  }
5581
5603
  }
5582
- class _r {
5604
+ class vr {
5583
5605
  constructor(e, t, s, i) {
5584
5606
  this.blockCount = e, this.mountedCount = t, this.lineCount = s, this.mappedOffsets = i;
5585
5607
  }
5586
5608
  }
5587
- function vr(n, e, t, s, i, o, r) {
5609
+ function wr(n, e, t, s, i, o, r) {
5588
5610
  n.textContent = "";
5589
5611
  const c = s.capture();
5590
5612
  let a = 0, l = 0, d = 0;
@@ -5616,16 +5638,16 @@ function vr(n, e, t, s, i, o, r) {
5616
5638
  }), n.appendChild(M);
5617
5639
  }
5618
5640
  }
5619
- g.viewNode && (d += wr(n, c, g.viewNode, g.absoluteStart, u, o, r));
5641
+ g.viewNode && (d += kr(n, c, g.viewNode, g.absoluteStart, u, o, r));
5620
5642
  }
5621
5643
  const h = `blocks: ${t.length} mounted: ${a} lines: ${l} chars: ${d}`, f = t.map((m, g) => {
5622
5644
  const _ = m.isMeasured ? "M" : "e", k = m.visualLineMap?.lines.length ?? 0;
5623
5645
  return `${String(g).padStart(2)} ${_} start=${String(m.absoluteStart).padStart(4)} h=${m.height.toFixed(1).padStart(6)} lines=${k} kind=${m.block.kind}`;
5624
5646
  });
5625
5647
  return e.textContent = [h, ...f].join(`
5626
- `), new _r(t.length, a, l, u);
5648
+ `), new vr(t.length, a, l, u);
5627
5649
  }
5628
- function wr(n, e, t, s, i, o, r) {
5650
+ function kr(n, e, t, s, i, o, r) {
5629
5651
  let c = 0;
5630
5652
  const a = document.createRange(), l = s + t.sourceLength, d = [];
5631
5653
  t.forEachTextLeaf(s, (h, f) => {
@@ -5658,7 +5680,7 @@ function wr(n, e, t, s, i, o, r) {
5658
5680
  }
5659
5681
  return c;
5660
5682
  }
5661
- function kr(n, e) {
5683
+ function br(n, e) {
5662
5684
  for (const t of Array.from(n.children)) {
5663
5685
  if (!t.style)
5664
5686
  continue;
@@ -5675,7 +5697,7 @@ class Ne {
5675
5697
  this.length = e, this.className = t;
5676
5698
  }
5677
5699
  }
5678
- class br {
5700
+ class xr {
5679
5701
  /**
5680
5702
  * @param _monaco The Monarch runtime ({@link IMonarchApi}), injected so this
5681
5703
  * package depends on `monaco-editor` for types only.
@@ -5686,7 +5708,7 @@ class br {
5686
5708
  }
5687
5709
  _tokenizers = /* @__PURE__ */ new Map();
5688
5710
  create(e, t) {
5689
- return new xr(this._tokenizerFor(e), t);
5711
+ return new yr(this._tokenizerFor(e), t);
5690
5712
  }
5691
5713
  dispose() {
5692
5714
  for (const e of this._tokenizers.values())
@@ -5698,10 +5720,10 @@ class br {
5698
5720
  if (t === void 0)
5699
5721
  return;
5700
5722
  let s = this._tokenizers.get(e);
5701
- return s || (s = new this._monaco.MonarchTokenizer(Lr, Sr, e, this._monaco.compile(e, t), Or), this._tokenizers.set(e, s)), s;
5723
+ return s || (s = new this._monaco.MonarchTokenizer(Sr, Or, e, this._monaco.compile(e, t), Tr), this._tokenizers.set(e, s)), s;
5702
5724
  }
5703
5725
  }
5704
- class xr {
5726
+ class yr {
5705
5727
  constructor(e, t) {
5706
5728
  this._tokenizer = e, this._initialState = e?.getInitialState(), this._text = t, this._lines = this._tokenizeFrom(0, [], this._initialState, t.split(`
5707
5729
  `)), this._lineStarts = this._computeLineStarts(), this._snapshotObs = R("syntaxSnapshot", new mn(this, this._version));
@@ -5725,7 +5747,7 @@ class xr {
5725
5747
  const s = gn(this._lines), i = e.apply(this._text), o = e.replacements[0].replaceRange.start, r = this._lineIndexAt(o), c = this._lines.slice(0, r), a = r === 0 ? this._initialState : this._lines[r - 1].endState;
5726
5748
  this._text = i, this._lines = this._tokenizeFrom(r, c, a, i.split(`
5727
5749
  `)), this._lineStarts = this._computeLineStarts(), this._version++;
5728
- const l = Cr(s, gn(this._lines));
5750
+ const l = Lr(s, gn(this._lines));
5729
5751
  this._snapshotObs.set(new mn(this, this._version), t, l);
5730
5752
  }
5731
5753
  dispose() {
@@ -5743,7 +5765,7 @@ class xr {
5743
5765
  const a = i[c], l = c < i.length - 1;
5744
5766
  if (this._tokenizer && r) {
5745
5767
  const d = this._tokenizer.tokenize(a, l, r);
5746
- o.push({ text: a, tokens: Er(d.tokens, a.length), endState: d.endState }), r = d.endState;
5768
+ o.push({ text: a, tokens: Cr(d.tokens, a.length), endState: d.endState }), r = d.endState;
5747
5769
  } else
5748
5770
  o.push({ text: a, tokens: a.length === 0 ? [] : [new Ne(a.length, void 0)], endState: r });
5749
5771
  }
@@ -5788,16 +5810,16 @@ class mn {
5788
5810
  return this._doc._getTokens(this._version, e);
5789
5811
  }
5790
5812
  }
5791
- function yr(n) {
5813
+ function Er(n) {
5792
5814
  return n === "" ? void 0 : n;
5793
5815
  }
5794
- function Er(n, e) {
5816
+ function Cr(n, e) {
5795
5817
  if (n.length === 0)
5796
5818
  return e === 0 ? [] : [new Ne(e, void 0)];
5797
5819
  const t = [];
5798
5820
  for (let s = 0; s < n.length; s++) {
5799
5821
  const i = n[s].offset, o = s + 1 < n.length ? n[s + 1].offset : e;
5800
- o > i && t.push(new Ne(o - i, yr(n[s].type)));
5822
+ o > i && t.push(new Ne(o - i, Er(n[s].type)));
5801
5823
  }
5802
5824
  return t;
5803
5825
  }
@@ -5819,7 +5841,7 @@ function _n(n) {
5819
5841
  e += t.length;
5820
5842
  return e;
5821
5843
  }
5822
- function Cr(n, e) {
5844
+ function Lr(n, e) {
5823
5845
  const t = n.length, s = e.length;
5824
5846
  let i = 0, o = 0;
5825
5847
  for (; i < t && i < s && pn(n[i], e[i]); )
@@ -5830,21 +5852,21 @@ function Cr(n, e) {
5830
5852
  const a = _n(n), l = _n(e), d = new v(o, a - c), u = l - c - o;
5831
5853
  return d.isEmpty && u === 0 ? ke.empty : ke.replace(d, u);
5832
5854
  }
5833
- const Lr = {
5855
+ const Sr = {
5834
5856
  languageIdCodec: { encodeLanguageId: () => 0, decodeLanguageId: () => "" },
5835
5857
  isRegisteredLanguageId: () => !1,
5836
5858
  getLanguageIdByLanguageName: () => null,
5837
5859
  getLanguageIdByMimeType: () => null,
5838
5860
  requestBasicLanguageFeatures: () => {
5839
5861
  }
5840
- }, Sr = {
5841
- getColorTheme: () => ({ tokenTheme: {} })
5842
5862
  }, Or = {
5863
+ getColorTheme: () => ({ tokenTheme: {} })
5864
+ }, Tr = {
5843
5865
  getValue: () => 2e4,
5844
5866
  onDidChangeConfiguration: () => ({ dispose() {
5845
5867
  } })
5846
5868
  };
5847
- function kc(n, e) {
5869
+ function bc(n, e) {
5848
5870
  const t = /* @__PURE__ */ new Map([
5849
5871
  ["typescript", e.typescript],
5850
5872
  ["ts", e.typescript],
@@ -5860,14 +5882,14 @@ function kc(n, e) {
5860
5882
  ["sh", e.shell],
5861
5883
  ["bash", e.shell]
5862
5884
  ]);
5863
- return new br(n, t);
5885
+ return new xr(n, t);
5864
5886
  }
5865
- const Tr = '<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M14 7v1H8v6H7V8H1V7h6V1h1v6h6z"></path></svg>';
5866
- class Mr extends U {
5887
+ const Mr = '<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M14 7v1H8v6H7V8H1V7h6V1h1v6h6z"></path></svg>';
5888
+ class Nr extends U {
5867
5889
  constructor(e) {
5868
5890
  super(), this._options = e, this.element = document.createElement("div"), this.element.className = "md-comment-input", this._textarea = document.createElement("textarea"), this._textarea.className = "md-comment-input-textarea", this._textarea.rows = 1, this._textarea.placeholder = e?.placeholder ?? "Add Comment", this.element.appendChild(this._textarea), this._measure = document.createElement("span"), this._measure.className = "md-comment-input-measure", this._measure.setAttribute("aria-hidden", "true"), this.element.appendChild(this._measure);
5869
5891
  const t = document.createElement("div");
5870
- t.className = "md-comment-input-actions", this.element.appendChild(t), this._submitButton = document.createElement("button"), this._submitButton.type = "button", this._submitButton.className = "md-comment-input-submit", this._submitButton.innerHTML = Tr, this._submitButton.title = "Comment", t.appendChild(this._submitButton);
5892
+ t.className = "md-comment-input-actions", this.element.appendChild(t), this._submitButton = document.createElement("button"), this._submitButton.type = "button", this._submitButton.className = "md-comment-input-submit", this._submitButton.innerHTML = Mr, this._submitButton.title = "Comment", t.appendChild(this._submitButton);
5871
5893
  const s = (c) => {
5872
5894
  c.stopPropagation(), !(c.target === this._textarea || this._submitButton.contains(c.target)) && (c.preventDefault(), this._textarea.focus());
5873
5895
  };
@@ -5930,9 +5952,9 @@ class Mr extends U {
5930
5952
  r > 0 && (this._textarea.style.height = `${r}px`), this._options?.onDidChangeSize?.();
5931
5953
  }
5932
5954
  }
5933
- class bc extends U {
5955
+ class xc extends U {
5934
5956
  constructor(e, t, s) {
5935
- super(), this._model = e, this._view = t, this._options = s, this._gap = s?.gap ?? 8, this._widget = this._register(new Mr({
5957
+ super(), this._model = e, this._view = t, this._options = s, this._gap = s?.gap ?? 8, this._widget = this._register(new Nr({
5936
5958
  onDidChangeSize: () => {
5937
5959
  this._visible && this._layoutHorizontally();
5938
5960
  },
@@ -6050,7 +6072,7 @@ class bc extends U {
6050
6072
  this._submittedRange = t, this._hideAndRefocus(), t && this._options?.onSubmit?.({ text: e, range: t });
6051
6073
  }
6052
6074
  }
6053
- class xc {
6075
+ class yc {
6054
6076
  _comments = R(this, []);
6055
6077
  /** Monotonic counter for ids of comments created via {@link create}. */
6056
6078
  _sequence = 0;
@@ -6091,8 +6113,8 @@ class xc {
6091
6113
  this._comments.set(this._comments.get().filter((t) => t.id !== e), void 0);
6092
6114
  }
6093
6115
  }
6094
- const Ge = "http://www.w3.org/2000/svg", Nr = 260, Rr = 320, Br = 0.32, Ir = 28, vn = 16, Ar = 12, Dr = 18, Pr = 4, Vr = 2, $r = 10;
6095
- class Hr extends U {
6116
+ const Ge = "http://www.w3.org/2000/svg", Rr = 260, Br = 320, Ir = 0.32, Ar = 28, vn = 16, Dr = 12, Pr = 18, Vr = 4, $r = 2, Hr = 10;
6117
+ class Fr extends U {
6096
6118
  constructor(e, t) {
6097
6119
  super(), this._model = e, this._view = t, this._layer = this._createLayer("md-comment-shapes"), this._view.overlayContainer.appendChild(this._layer), this._register({
6098
6120
  dispose: () => {
@@ -6177,7 +6199,7 @@ class Hr extends U {
6177
6199
  }
6178
6200
  _fillCard(e) {
6179
6201
  const { comment: t } = e, s = t.author ?? "You";
6180
- e.authorEl.textContent = s, e.avatarEl.textContent = Wr(s), e.timeEl.textContent = t.createdAt !== void 0 ? zr(t.createdAt) : "", e.bodyEl.textContent = t.body;
6202
+ e.authorEl.textContent = s, e.avatarEl.textContent = zr(s), e.timeEl.textContent = t.createdAt !== void 0 ? Gr(t.createdAt) : "", e.bodyEl.textContent = t.body;
6181
6203
  }
6182
6204
  _disposeEntry(e) {
6183
6205
  for (const t of e.disposables)
@@ -6192,20 +6214,20 @@ class Hr extends U {
6192
6214
  return;
6193
6215
  }
6194
6216
  this._layer.style.display = "";
6195
- const i = this._view.coordinateSpace.capture().toLocalRect(t.getBoundingClientRect()).width, o = getComputedStyle(s), r = parseFloat(o.maxWidth), c = (parseFloat(o.paddingLeft) || 0) + (parseFloat(o.paddingRight) || 0), a = (parseFloat(o.borderLeftWidth) || 0) + (parseFloat(o.borderRightWidth) || 0), l = Number.isNaN(r) ? i : o.boxSizing === "border-box" ? r : r + c + a, d = Math.max(0, (i - Math.min(l, i)) / 2), u = Math.round(Math.max(Nr, Math.min(Rr, i * Br))), h = u + Ir + vn, f = d >= h ? 0 : Math.min(2 * (h - d), h), m = f > 0 ? `${Math.ceil(f)}px` : "";
6217
+ const i = this._view.coordinateSpace.capture().toLocalRect(t.getBoundingClientRect()).width, o = getComputedStyle(s), r = parseFloat(o.maxWidth), c = (parseFloat(o.paddingLeft) || 0) + (parseFloat(o.paddingRight) || 0), a = (parseFloat(o.borderLeftWidth) || 0) + (parseFloat(o.borderRightWidth) || 0), l = Number.isNaN(r) ? i : o.boxSizing === "border-box" ? r : r + c + a, d = Math.max(0, (i - Math.min(l, i)) / 2), u = Math.round(Math.max(Rr, Math.min(Br, i * Ir))), h = u + Ar + vn, f = d >= h ? 0 : Math.min(2 * (h - d), h), m = f > 0 ? `${Math.ceil(f)}px` : "";
6196
6218
  t.style.paddingRight !== m && (t.style.paddingRight = m);
6197
6219
  const _ = this._view.coordinateSpace.capture().toLocalRect(t.getBoundingClientRect()).right - vn - u, k = s.clientWidth, b = e.map(({ entry: x, rects: w }) => {
6198
6220
  x.card.style.left = `${_}px`, x.card.style.width = `${u}px`;
6199
- const M = Fr(w), V = w.length > 0 ? Math.min(...w.map((q) => q.y)) : 0;
6221
+ const M = Kr(w), V = w.length > 0 ? Math.min(...w.map((q) => q.y)) : 0;
6200
6222
  return { entry: x, rects: w, anchor: M, desiredTop: V };
6201
6223
  });
6202
6224
  b.sort((x, w) => x.desiredTop - w.desiredTop);
6203
6225
  let L = -1 / 0;
6204
6226
  for (const x of b) {
6205
- const w = Math.max(x.desiredTop, L + Ar);
6227
+ const w = Math.max(x.desiredTop, L + Dr);
6206
6228
  x.entry.card.style.top = `${w}px`;
6207
6229
  const M = x.entry.card.offsetHeight;
6208
- L = w + M, x.entry.shapePath.setAttribute("d", ns(x.rects, Pr)), x.entry.leaderPath.setAttribute("d", x.anchor ? Kr(x.anchor, k, { x: _, y: w + Dr }) : "");
6230
+ L = w + M, x.entry.shapePath.setAttribute("d", ns(x.rects, Vr)), x.entry.leaderPath.setAttribute("d", x.anchor ? Wr(x.anchor, k, { x: _, y: w + Pr }) : "");
6209
6231
  }
6210
6232
  }
6211
6233
  _applyHover(e) {
@@ -6215,27 +6237,27 @@ class Hr extends U {
6215
6237
  }
6216
6238
  }
6217
6239
  }
6218
- function Fr(n) {
6240
+ function Kr(n) {
6219
6241
  if (n.length === 0)
6220
6242
  return;
6221
6243
  let e = n[0];
6222
6244
  for (const i of n)
6223
6245
  i.y + i.height > e.y + e.height && (e = i);
6224
6246
  const t = e.x + e.width;
6225
- return { x: Math.max(e.x, t - $r), y: e.y + e.height - Vr / 2 };
6247
+ return { x: Math.max(e.x, t - Hr), y: e.y + e.height - $r / 2 };
6226
6248
  }
6227
- function Kr(n, e, t) {
6249
+ function Wr(n, e, t) {
6228
6250
  const s = Math.max(e, n.x + 12), i = t.x - s, o = s + i * 0.55, r = t.x - i * 0.45;
6229
6251
  return `M ${n.x} ${n.y} L ${s} ${n.y} C ${o} ${n.y}, ${r} ${t.y}, ${t.x} ${t.y}`;
6230
6252
  }
6231
- function Wr(n) {
6253
+ function zr(n) {
6232
6254
  const e = n.trim().split(/\s+/).filter(Boolean);
6233
6255
  if (e.length === 0)
6234
6256
  return "?";
6235
6257
  const t = e[0][0] ?? "", s = e.length > 1 ? e[e.length - 1][0] ?? "" : "";
6236
6258
  return (t + s).toUpperCase();
6237
6259
  }
6238
- function zr(n) {
6260
+ function Gr(n) {
6239
6261
  const e = Math.max(0, Math.round((Date.now() - n) / 1e3));
6240
6262
  if (e < 60)
6241
6263
  return "just now";
@@ -6245,9 +6267,9 @@ function zr(n) {
6245
6267
  const s = Math.round(t / 60);
6246
6268
  return s < 24 ? `${s}h ago` : `${Math.round(s / 24)}d ago`;
6247
6269
  }
6248
- const Gr = 12, qr = 8;
6249
- function Ur(n, e) {
6250
- const t = n.element, s = n.overlayContainer, i = t.clientWidth - qr - s.offsetLeft, o = [];
6270
+ const qr = 12, Ur = 8;
6271
+ function jr(n, e) {
6272
+ const t = n.element, s = n.overlayContainer, i = t.clientWidth - Ur - s.offsetLeft, o = [];
6251
6273
  for (const c of e) {
6252
6274
  if (c.rects.length === 0) {
6253
6275
  c.element.style.visibility = "hidden";
@@ -6258,7 +6280,7 @@ function Ur(n, e) {
6258
6280
  o.sort((c, a) => c.y - a.y);
6259
6281
  let r = -1 / 0;
6260
6282
  for (const c of o) {
6261
- const a = Math.max(c.y, r + Gr), l = i - c.element.offsetWidth;
6283
+ const a = Math.max(c.y, r + qr), l = i - c.element.offsetWidth;
6262
6284
  c.element.style.left = `${l}px`, c.element.style.top = `${a}px`, r = a + c.element.offsetHeight;
6263
6285
  }
6264
6286
  }
@@ -6303,7 +6325,7 @@ class is extends U {
6303
6325
  }
6304
6326
  _relayout() {
6305
6327
  const e = this._order.map((t) => this._entries.get(t)).filter((t) => t !== void 0).map((t) => ({ element: t.widget.element, rects: t.rects.get() }));
6306
- Ur(this.view, e), this._revealPendingComment();
6328
+ jr(this.view, e), this._revealPendingComment();
6307
6329
  }
6308
6330
  _revealPendingComment() {
6309
6331
  const e = this._pendingRevealCommentId;
@@ -6313,9 +6335,9 @@ class is extends U {
6313
6335
  !t || t.style.visibility === "hidden" || (this._pendingRevealCommentId = void 0, t.scrollIntoView({ block: "center", inline: "nearest" }));
6314
6336
  }
6315
6337
  }
6316
- const jr = /^([a-z0-9]+)/i;
6338
+ const Xr = /^([a-z0-9]+)/i;
6317
6339
  function O(n) {
6318
- const e = jr.exec(n)?.[1] ?? "div", t = document.createElement(e), s = n.slice(e.length).split(".").filter(Boolean);
6340
+ const e = Xr.exec(n)?.[1] ?? "div", t = document.createElement(e), s = n.slice(e.length).split(".").filter(Boolean);
6319
6341
  return s.length && (t.className = s.join(" ")), t;
6320
6342
  }
6321
6343
  function ve(n) {
@@ -6342,7 +6364,7 @@ function qe(n) {
6342
6364
  } else s && t.appendChild(document.createTextNode(s));
6343
6365
  return e.appendChild(t), e;
6344
6366
  }
6345
- class Xr {
6367
+ class Yr {
6346
6368
  constructor(e, t) {
6347
6369
  this._comments = e, this._domNode = O("div.agent-feedback-widget"), this._domNode.classList.add("collapsed"), this._domNode.tabIndex = -1, this._domNode.setAttribute("widgetid", "agent-feedback-widget-0"), this._headerNode = O("div.agent-feedback-widget-header"), this._headerNode.appendChild(dt("comment")), this._titleNode = O("span.agent-feedback-widget-title"), this._updateTitle(), this._headerNode.appendChild(this._titleNode), this._headerNode.appendChild(O("span.agent-feedback-widget-spacer")), this._toggleButton = O("div.agent-feedback-widget-toggle"), this._updateToggleButton(), this._headerNode.appendChild(this._toggleButton), this._domNode.appendChild(this._headerNode), this._bodyNode = O("div.agent-feedback-widget-body"), this._bodyNode.classList.add("collapsed"), this._buildFeedbackItems(), this._domNode.appendChild(this._bodyNode), this._domNode.appendChild(O("div.agent-feedback-widget-arrow")), this._setupEventHandlers(), this._domNode.classList.add("visible"), t?.expanded && this.expand(), t?.focusedCommentId && this.focusFeedback(t.focusedCommentId);
6348
6370
  }
@@ -6542,7 +6564,7 @@ class Xr {
6542
6564
  this._disposables.length = 0, this._domNode.remove();
6543
6565
  }
6544
6566
  }
6545
- class Yr extends is {
6567
+ class Qr extends is {
6546
6568
  createWidget(e) {
6547
6569
  const t = this.context?.resolveLine?.(e.range.start) ?? 1, s = {
6548
6570
  id: e.id,
@@ -6551,26 +6573,26 @@ class Yr extends is {
6551
6573
  startLine: t,
6552
6574
  text: e.body
6553
6575
  };
6554
- return new Xr([s], { expanded: !0 });
6576
+ return new Yr([s], { expanded: !0 });
6555
6577
  }
6556
6578
  }
6557
- const Qr = /^([a-z0-9]+)/i;
6579
+ const Zr = /^([a-z0-9]+)/i;
6558
6580
  function we(n) {
6559
- const e = Qr.exec(n)?.[1] ?? "div", t = document.createElement(e), s = n.slice(e.length).split(".").filter(Boolean);
6581
+ const e = Zr.exec(n)?.[1] ?? "div", t = document.createElement(e), s = n.slice(e.length).split(".").filter(Boolean);
6560
6582
  return s.length && (t.className = s.join(" ")), t;
6561
6583
  }
6562
6584
  function wn(n) {
6563
6585
  return `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n}</svg>`;
6564
6586
  }
6565
- const Zr = {
6587
+ const Jr = {
6566
6588
  edit: wn('<path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path>'),
6567
6589
  trash: wn('<polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line>')
6568
6590
  };
6569
- function Jr(n, e) {
6591
+ function ec(n, e) {
6570
6592
  const t = document.createElement("button");
6571
- return t.type = "button", t.className = "vscode-comment-widget-v2-action", t.setAttribute("aria-label", e), t.title = e, t.innerHTML = Zr[n] ?? "", t;
6593
+ return t.type = "button", t.className = "vscode-comment-widget-v2-action", t.setAttribute("aria-label", e), t.title = e, t.innerHTML = Jr[n] ?? "", t;
6572
6594
  }
6573
- class ec {
6595
+ class tc {
6574
6596
  _domNode;
6575
6597
  _textNode;
6576
6598
  _toggleNode;
@@ -6608,7 +6630,7 @@ class ec {
6608
6630
  }
6609
6631
  /** A header action button that runs `onClick` (and cleans up on dispose). */
6610
6632
  _actionButton(e, t, s) {
6611
- const i = Jr(e, t), o = (r) => {
6633
+ const i = ec(e, t), o = (r) => {
6612
6634
  r.preventDefault(), r.stopPropagation(), s();
6613
6635
  };
6614
6636
  return i.addEventListener("click", o), this._disposables.push(() => i.removeEventListener("click", o)), i;
@@ -6620,52 +6642,52 @@ class ec {
6620
6642
  this._domNode.remove();
6621
6643
  }
6622
6644
  }
6623
- const tc = 80;
6624
- class nc extends is {
6645
+ const nc = 80;
6646
+ class sc extends is {
6625
6647
  createWidget(e) {
6626
- return new ec({
6648
+ return new tc({
6627
6649
  username: e.author ?? "You",
6628
6650
  body: e.body,
6629
- state: e.body.length > tc ? "collapsed" : "short",
6651
+ state: e.body.length > nc ? "collapsed" : "short",
6630
6652
  // Edit is intentionally omitted (hidden) for now. Delete removes the
6631
6653
  // comment from the shared model; the autorun then disposes the card.
6632
6654
  onDelete: () => this.model.remove(e.id)
6633
6655
  });
6634
6656
  }
6635
6657
  }
6636
- const yc = {
6658
+ const Ec = {
6637
6659
  connected: "Connected lines (original)",
6638
6660
  vscode: "VS Code cards",
6639
6661
  "vscode-v2": "Markdown cards (V3)"
6640
- }, Ec = {
6641
- connected: (n, e) => new Hr(n, e),
6642
- vscode: (n, e, t) => new Yr(n, e, t),
6643
- "vscode-v2": (n, e, t) => new nc(n, e, t)
6662
+ }, Cc = {
6663
+ connected: (n, e) => new Fr(n, e),
6664
+ vscode: (n, e, t) => new Qr(n, e, t),
6665
+ "vscode-v2": (n, e, t) => new sc(n, e, t)
6644
6666
  };
6645
6667
  export {
6646
6668
  G as AstNode,
6647
- _c as AsyncClipboardStrategy,
6669
+ vc as AsyncClipboardStrategy,
6648
6670
  ye as BlockQuoteAstNode,
6649
6671
  B as BlockViewNode,
6650
- Ec as COMMENTS_DESIGNS,
6651
- yc as COMMENTS_DESIGN_LABELS,
6672
+ Cc as COMMENTS_DESIGNS,
6673
+ Ec as COMMENTS_DESIGN_LABELS,
6652
6674
  Y as CodeBlockAstNode,
6653
6675
  Ot as CodeBlockViewNode,
6654
- Mr as CommentInputWidget,
6655
- bc as CommentModeController,
6656
- xc as CommentsModel,
6657
- Hr as CommentsView,
6676
+ Nr as CommentInputWidget,
6677
+ xc as CommentModeController,
6678
+ yc as CommentsModel,
6679
+ Fr as CommentsView,
6658
6680
  Qo as CursorView,
6659
6681
  Ke as CursorViewRendering,
6660
6682
  as as DEFAULT_WORD_NAVIGATION_CONFIG,
6661
- Sc as DEFAULT_WORD_SEPARATORS,
6683
+ Oc as DEFAULT_WORD_SEPARATORS,
6662
6684
  yt as DocumentAstNode,
6663
6685
  Mt as DocumentViewNode,
6664
- vc as EditorController,
6686
+ wc as EditorController,
6665
6687
  nt as EditorCoordinateSpace,
6666
6688
  io as EditorCoordinateTransform,
6667
- gc as EditorModel,
6668
- pc as EditorView,
6689
+ pc as EditorModel,
6690
+ _c as EditorView,
6669
6691
  wt as EmphasisAstNode,
6670
6692
  z as GlueAstNode,
6671
6693
  he as HeadingAstNode,
@@ -6680,11 +6702,11 @@ export {
6680
6702
  Ps as MarkdownParser,
6681
6703
  C as MarkerAstNode,
6682
6704
  _e as MathBlockAstNode,
6683
- _r as MeasuredLayoutDebugRendering,
6684
- wc as MeasuredLayoutDebugView,
6705
+ vr as MeasuredLayoutDebugRendering,
6706
+ kc as MeasuredLayoutDebugView,
6685
6707
  ci as MeasuredLayoutModel,
6686
- br as MonacoSyntaxHighlighter,
6687
- ir as NativeClipboardStrategy,
6708
+ xr as MonacoSyntaxHighlighter,
6709
+ or as NativeClipboardStrategy,
6688
6710
  v as OffsetRange,
6689
6711
  ne as ParagraphAstNode,
6690
6712
  de as Point2D,
@@ -6708,9 +6730,9 @@ export {
6708
6730
  ei as VisualLine,
6709
6731
  Ie as VisualLineMap,
6710
6732
  ut as VisualRun,
6711
- nc as VsCodeV2CommentsView,
6712
- Yr as VscodeStackedCommentsView,
6713
- kc as createDefaultMonacoSyntaxHighlighter,
6733
+ sc as VsCodeV2CommentsView,
6734
+ Qr as VscodeStackedCommentsView,
6735
+ bc as createDefaultMonacoSyntaxHighlighter,
6714
6736
  xi as cursorDocumentEnd,
6715
6737
  bi as cursorDocumentStart,
6716
6738
  Vt as cursorDown,
@@ -6749,8 +6771,8 @@ export {
6749
6771
  Ki as selectAll,
6750
6772
  zi as selectBlock,
6751
6773
  Wi as selectWord,
6752
- fc as taskCheckboxRange,
6753
- mc as visualizeAst,
6774
+ mc as taskCheckboxRange,
6775
+ gc as visualizeAst,
6754
6776
  ss as vscodeKeyboardProfile
6755
6777
  };
6756
6778
  //# sourceMappingURL=index.js.map