@synclineapi/editor 3.0.0 → 3.0.1

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.
@@ -2,7 +2,7 @@ var rt = Object.defineProperty;
2
2
  var ot = (r, e, t) => e in r ? rt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var p = (r, e, t) => ot(r, typeof e != "symbol" ? e + "" : e, t);
4
4
  const Z = Object.freeze({ site: "\0root", clock: 0 });
5
- function z(r) {
5
+ function q(r) {
6
6
  return `${r.site}@${r.clock}`;
7
7
  }
8
8
  function he(r, e) {
@@ -30,7 +30,7 @@ class de {
30
30
  p(this, "_opLog", []);
31
31
  this.siteId = e;
32
32
  const t = { id: Z, after: Z, char: "", deleted: !0 };
33
- this._chars.set(z(Z), t), this._seq = [Z], this._rebuildIdx();
33
+ this._chars.set(q(Z), t), this._seq = [Z], this._rebuildIdx();
34
34
  }
35
35
  // ── Public accessors ──────────────────────────────────────
36
36
  get clock() {
@@ -40,7 +40,7 @@ class de {
40
40
  getText() {
41
41
  let e = "";
42
42
  for (const t of this._seq) {
43
- const i = this._chars.get(z(t));
43
+ const i = this._chars.get(q(t));
44
44
  i.deleted || (e += i.char);
45
45
  }
46
46
  return e;
@@ -49,7 +49,7 @@ class de {
49
49
  get length() {
50
50
  let e = 0;
51
51
  for (const t of this._seq)
52
- this._chars.get(z(t)).deleted || e++;
52
+ this._chars.get(q(t)).deleted || e++;
53
53
  return e;
54
54
  }
55
55
  // ── Local editing (produces ops to send to peers) ─────────
@@ -88,7 +88,7 @@ class de {
88
88
  * Returns true if the op was new (applied), false if already seen.
89
89
  */
90
90
  apply(e) {
91
- const t = z(e.id);
91
+ const t = q(e.id);
92
92
  if (e.type === "insert") {
93
93
  if (this._chars.has(t)) return !1;
94
94
  this._applyInsert(e, !1);
@@ -128,12 +128,12 @@ class de {
128
128
  _applyInsert(e, t) {
129
129
  t && this._updateSV(e.id);
130
130
  const i = { id: e.id, after: e.after, char: e.char, deleted: !1 };
131
- this._chars.set(z(e.id), i);
132
- const s = z(e.after);
131
+ this._chars.set(q(e.id), i);
132
+ const s = q(e.after);
133
133
  this._idxDirty && this._rebuildIdx();
134
134
  let n = (this._idxMap.get(s) ?? 0) + 1;
135
135
  for (; n < this._seq.length; ) {
136
- const o = this._seq[n], a = this._chars.get(z(o));
136
+ const o = this._seq[n], a = this._chars.get(q(o));
137
137
  if (!he(a.after, e.after)) break;
138
138
  if (this._cmp(o, e.id) > 0) {
139
139
  n++;
@@ -145,7 +145,7 @@ class de {
145
145
  }
146
146
  _applyDelete(e, t) {
147
147
  t && this._updateSV(e.id);
148
- const i = this._chars.get(z(e.id));
148
+ const i = this._chars.get(q(e.id));
149
149
  i && (i.deleted = !0);
150
150
  }
151
151
  /**
@@ -158,7 +158,7 @@ class de {
158
158
  _rebuildIdx() {
159
159
  this._idxMap.clear();
160
160
  for (let e = 0; e < this._seq.length; e++)
161
- this._idxMap.set(z(this._seq[e]), e);
161
+ this._idxMap.set(q(this._seq[e]), e);
162
162
  this._idxDirty = !1;
163
163
  }
164
164
  /** Return the ID of the n-th visible character (0-indexed). Returns ROOT_ID for n<0. */
@@ -166,13 +166,13 @@ class de {
166
166
  if (e < 0) return Z;
167
167
  let t = 0;
168
168
  for (const s of this._seq)
169
- if (!(this._chars.get(z(s)).deleted || he(s, Z))) {
169
+ if (!(this._chars.get(q(s)).deleted || he(s, Z))) {
170
170
  if (t === e) return s;
171
171
  t++;
172
172
  }
173
173
  let i = Z;
174
174
  for (const s of this._seq)
175
- this._chars.get(z(s)).deleted || (i = s);
175
+ this._chars.get(q(s)).deleted || (i = s);
176
176
  return i;
177
177
  }
178
178
  /** Return IDs of `len` visible characters starting at `offset` */
@@ -181,7 +181,7 @@ class de {
181
181
  let s = 0;
182
182
  for (const n of this._seq) {
183
183
  if (i.length >= t) break;
184
- this._chars.get(z(n)).deleted || he(n, Z) || (s >= e && i.push(n), s++);
184
+ this._chars.get(q(n)).deleted || he(n, Z) || (s >= e && i.push(n), s++);
185
185
  }
186
186
  return i;
187
187
  }
@@ -349,7 +349,7 @@ class Qe {
349
349
  this._unsub(), this.awareness.destroy();
350
350
  }
351
351
  }
352
- const pt = 22, je = 6, et = 300, ut = 60, se = 14, Pe = 20, Q = 7.82, ft = 13, gt = 2, bt = 80, q = 2, Y = 1.1, oe = 3, mt = 120, _t = 700, yt = 120, vt = {
352
+ const pt = 22, je = 6, et = 300, ut = 60, se = 14, Pe = 20, Q = 7.82, ft = 13, gt = 2, bt = 80, G = 2, Y = 1.1, oe = 3, mt = 120, _t = 700, yt = 120, vt = {
353
353
  typescript: "//",
354
354
  javascript: "//",
355
355
  css: "//",
@@ -598,7 +598,7 @@ function We(r, e) {
598
598
  scrollTop: 0
599
599
  };
600
600
  }
601
- function A(r, e = et) {
601
+ function D(r, e = et) {
602
602
  const t = {
603
603
  doc: [...r.doc],
604
604
  cur: { ...r.cur },
@@ -628,7 +628,7 @@ function Et(r) {
628
628
  const t = r.redoStack.pop();
629
629
  return r.doc = t.doc, r.cur = t.cur, r.sel = t.sel, !0;
630
630
  }
631
- function L(r) {
631
+ function B(r) {
632
632
  const { doc: e, cur: t } = r;
633
633
  t.row = Math.max(0, Math.min(e.length - 1, t.row)), t.col = Math.max(0, Math.min((e[t.row] ?? "").length, t.col));
634
634
  }
@@ -730,8 +730,8 @@ function xe(r, e = {}) {
730
730
  var d, u;
731
731
  const t = [], i = r.length;
732
732
  let s = 0;
733
- const n = (h, _, y) => {
734
- y > _ && t.push({ cls: h, start: _, end: y });
733
+ const n = (h, m, y) => {
734
+ y > m && t.push({ cls: h, start: m, end: y });
735
735
  }, o = tt[e.language ?? "typescript"] ?? we, a = it[e.language ?? "typescript"] ?? ke, l = (d = e.extraKeywords) != null && d.size ? /* @__PURE__ */ new Set([...o, ...e.extraKeywords]) : o, c = (u = e.extraTypes) != null && u.size ? /* @__PURE__ */ new Set([...a, ...e.extraTypes]) : a;
736
736
  for (; s < i; ) {
737
737
  if (r[s] === "/" && r[s + 1] === "/") {
@@ -750,19 +750,19 @@ function xe(r, e = {}) {
750
750
  }
751
751
  if (r[s] === '"' || r[s] === "'" || r[s] === "`") {
752
752
  const h = r[s];
753
- let _ = s + 1;
754
- for (; _ < i; ) {
755
- if (r[_] === "\\") {
756
- _ += 2;
753
+ let m = s + 1;
754
+ for (; m < i; ) {
755
+ if (r[m] === "\\") {
756
+ m += 2;
757
757
  continue;
758
758
  }
759
- if (r[_] === h) {
760
- _++;
759
+ if (r[m] === h) {
760
+ m++;
761
761
  break;
762
762
  }
763
- _++;
763
+ m++;
764
764
  }
765
- n("str", s, _), s = _;
765
+ n("str", s, m), s = m;
766
766
  continue;
767
767
  }
768
768
  if (/\d/.test(r[s]) && (s === 0 || !/\w/.test(r[s - 1]))) {
@@ -774,8 +774,8 @@ function xe(r, e = {}) {
774
774
  if (/[a-zA-Z_$]/.test(r[s])) {
775
775
  let h = s;
776
776
  for (; h < i && /[\w$]/.test(r[h]); ) h++;
777
- const _ = r.slice(s, h);
778
- l.has(_) ? n("kw", s, h) : c.has(_) ? n("typ", s, h) : h < i && r[h] === "(" ? n("fn", s, h) : /^[A-Z]/.test(_) && n("cls", s, h), s = h;
777
+ const m = r.slice(s, h);
778
+ l.has(m) ? n("kw", s, h) : c.has(m) ? n("typ", s, h) : h < i && r[h] === "(" ? n("fn", s, h) : /^[A-Z]/.test(m) && n("cls", s, h), s = h;
779
779
  continue;
780
780
  }
781
781
  if (/[=<>!&|+\-*/%^~?:,;.[\]{}()]/.test(r[s])) {
@@ -1762,7 +1762,7 @@ const zt = `
1762
1762
  .sl-empty{flex:1;display:flex;flex-direction:column;align-items:center;
1763
1763
  justify-content:center;gap:10px;color:var(--text3);font-size:13px}
1764
1764
  `;
1765
- function D(r, e, t) {
1765
+ function j(r, e, t) {
1766
1766
  const i = document.createElement(r);
1767
1767
  return e && (i.className = e), i;
1768
1768
  }
@@ -1780,7 +1780,7 @@ function Ue(r) {
1780
1780
  return r.split(`
1781
1781
  `);
1782
1782
  }
1783
- function P(r) {
1783
+ function $(r) {
1784
1784
  return r.join(`
1785
1785
  `);
1786
1786
  }
@@ -2342,8 +2342,8 @@ function oi(r, e, t, i, s) {
2342
2342
  for (; u <= c.length - n.length; ) {
2343
2343
  const h = c.indexOf(n, u);
2344
2344
  if (h < 0) break;
2345
- const _ = h === 0 || !/\w/.test(c[h - 1]), y = h + n.length >= c.length || !/\w/.test(c[h + n.length]);
2346
- if (_ && y)
2345
+ const m = h === 0 || !/\w/.test(c[h - 1]), y = h + n.length >= c.length || !/\w/.test(c[h + n.length]);
2346
+ if (m && y)
2347
2347
  return r.lastMatchRow = l, r.lastMatchCol = h + n.length, {
2348
2348
  word: n,
2349
2349
  sel: { ar: l, ac: h, fr: l, fc: h + n.length },
@@ -2359,8 +2359,8 @@ function oi(r, e, t, i, s) {
2359
2359
  for (; u < d; ) {
2360
2360
  const h = c.indexOf(n, u);
2361
2361
  if (h < 0 || h >= d) break;
2362
- const _ = h === 0 || !/\w/.test(c[h - 1]), y = h + n.length >= c.length || !/\w/.test(c[h + n.length]);
2363
- if (_ && y)
2362
+ const m = h === 0 || !/\w/.test(c[h - 1]), y = h + n.length >= c.length || !/\w/.test(c[h + n.length]);
2363
+ if (m && y)
2364
2364
  return r.lastMatchRow = l, r.lastMatchCol = h + n.length, {
2365
2365
  word: n,
2366
2366
  sel: { ar: l, ac: h, fr: l, fc: h + n.length },
@@ -2425,8 +2425,8 @@ function hi(r, e, t, i) {
2425
2425
  for (; u <= d.length - a.length; ) {
2426
2426
  const h = d.indexOf(a, u);
2427
2427
  if (h < 0) break;
2428
- const _ = h === 0 || !/\w/.test(d[h - 1]), y = h + a.length >= d.length || !/\w/.test(d[h + a.length]);
2429
- _ && y && !(c === e && h === n) && l.push({ row: c, col: h, len: a.length }), u = h + 1;
2428
+ const m = h === 0 || !/\w/.test(d[h - 1]), y = h + a.length >= d.length || !/\w/.test(d[h + a.length]);
2429
+ m && y && !(c === e && h === n) && l.push({ row: c, col: h, len: a.length }), u = h + 1;
2430
2430
  }
2431
2431
  }
2432
2432
  return l;
@@ -2675,7 +2675,7 @@ function gi(r, e, t = {}, i = 0, s = 0) {
2675
2675
  completions: c = [],
2676
2676
  replaceBuiltins: d = !1,
2677
2677
  maxResults: u = 14
2678
- } = t, h = c.filter((f) => f.kind === "snip" && !!f.body && Xe(f, o)), _ = c.filter((f) => !(f.kind === "snip" && f.body) && Xe(f, o)), y = h.filter((f) => f.label.toLowerCase().startsWith(n));
2678
+ } = t, h = c.filter((f) => f.kind === "snip" && !!f.body && Xe(f, o)), m = c.filter((f) => !(f.kind === "snip" && f.body) && Xe(f, o)), y = h.filter((f) => f.label.toLowerCase().startsWith(n));
2679
2679
  let g;
2680
2680
  if (t.provideCompletions) {
2681
2681
  const f = {
@@ -2685,21 +2685,21 @@ function gi(r, e, t = {}, i = 0, s = 0) {
2685
2685
  language: o,
2686
2686
  doc: r
2687
2687
  };
2688
- let T;
2688
+ let E;
2689
2689
  try {
2690
- T = t.provideCompletions(f);
2691
- } catch (R) {
2692
- console.error("[syncline-editor] provideCompletions threw an error:", R), T = null;
2690
+ E = t.provideCompletions(f);
2691
+ } catch (C) {
2692
+ console.error("[syncline-editor] provideCompletions threw an error:", C), E = null;
2693
2693
  }
2694
- g = T != null ? [...T, ..._] : [...d ? [] : Je(o, a, l), ..._];
2694
+ g = E != null ? [...E, ...m] : [...d ? [] : Je(o, a, l), ...m];
2695
2695
  } else
2696
- g = d ? _ : [...Je(o, a, l), ..._];
2697
- const k = new Set(g.map((f) => f.label)), m = g.filter(
2696
+ g = d ? m : [...Je(o, a, l), ...m];
2697
+ const k = new Set(g.map((f) => f.label)), b = g.filter(
2698
2698
  (f) => f.label.toLowerCase().startsWith(n) && f.label !== e
2699
- ), S = new Set(y.map((f) => f.label)), x = [...fi(r, e)].filter((f) => f.toLowerCase().startsWith(n) && !k.has(f) && !S.has(f)).slice(0, 8).map((f) => ({ label: f, kind: "var", detail: "in file" }));
2699
+ ), T = new Set(y.map((f) => f.label)), x = [...fi(r, e)].filter((f) => f.toLowerCase().startsWith(n) && !k.has(f) && !T.has(f)).slice(0, 8).map((f) => ({ label: f, kind: "var", detail: "in file" }));
2700
2700
  return [
2701
2701
  ...y,
2702
- ...m.filter((f) => !S.has(f.label)),
2702
+ ...b.filter((f) => !T.has(f.label)),
2703
2703
  ...x
2704
2704
  ].slice(0, u);
2705
2705
  }
@@ -3342,31 +3342,31 @@ function yi(r, e) {
3342
3342
  return !t || t.language && !(Array.isArray(t.language) ? t.language : [t.language]).includes(e) ? null : t;
3343
3343
  }
3344
3344
  function vi(r) {
3345
- var E, N, V, K;
3346
- const { vr: e, visIdx: t, curVisRow: i, wm: s, foldedLines: n, isFoldable: o, opts: a } = r, { docLine: l, segIdx: c, text: d } = e, u = t === i, h = l === ((E = s.visualRows[i]) == null ? void 0 : E.docLine), _ = c > 0, y = ((N = s.segments[l]) == null ? void 0 : N.slice(0, c).reduce((v, w) => v + w.length, 0)) ?? 0, g = r.docSel ? Oe(r.docSel, l, ((V = (s.segments[l] ?? [""])[c]) == null ? void 0 : V.length) ?? 0) : null;
3345
+ var L, F, V, K;
3346
+ const { vr: e, visIdx: t, curVisRow: i, wm: s, foldedLines: n, isFoldable: o, opts: a } = r, { docLine: l, segIdx: c, text: d } = e, u = t === i, h = l === ((L = s.visualRows[i]) == null ? void 0 : L.docLine), m = c > 0, y = ((F = s.segments[l]) == null ? void 0 : F.slice(0, c).reduce((v, w) => v + w.length, 0)) ?? 0, g = r.docSel ? Oe(r.docSel, l, ((V = (s.segments[l] ?? [""])[c]) == null ? void 0 : V.length) ?? 0) : null;
3347
3347
  let k = null;
3348
3348
  if (g) {
3349
3349
  const v = ((K = (s.segments[l] ?? [""])[c]) == null ? void 0 : K.length) ?? 0, w = Oe(r.docSel, l, v + y);
3350
3350
  if (w) {
3351
- const M = w.start - y, I = w.end - y;
3352
- I > 0 && M < d.length && (k = { start: Math.max(0, M), end: Math.min(d.length, I) });
3351
+ const M = w.start - y, R = w.end - y;
3352
+ R > 0 && M < d.length && (k = { start: Math.max(0, M), end: Math.min(d.length, R) });
3353
3353
  }
3354
3354
  }
3355
- const m = r.findMatches.filter((v) => v.row === l).map((v) => {
3356
- var F, X;
3355
+ const b = r.findMatches.filter((v) => v.row === l).map((v) => {
3356
+ var U, X;
3357
3357
  const w = v.col - y, M = v.col + v.len - y;
3358
3358
  if (M <= 0 || w >= d.length) return null;
3359
- const I = r.findIdx >= 0 && ((F = r.findMatches[r.findIdx]) == null ? void 0 : F.row) === v.row && ((X = r.findMatches[r.findIdx]) == null ? void 0 : X.col) === v.col;
3360
- return { start: Math.max(0, w), end: Math.min(d.length, M), isCur: I };
3361
- }).filter(Boolean), S = r.wordHighlights.filter((v) => v.row === l).map((v) => {
3359
+ const R = r.findIdx >= 0 && ((U = r.findMatches[r.findIdx]) == null ? void 0 : U.row) === v.row && ((X = r.findMatches[r.findIdx]) == null ? void 0 : X.col) === v.col;
3360
+ return { start: Math.max(0, w), end: Math.min(d.length, M), isCur: R };
3361
+ }).filter(Boolean), T = r.wordHighlights.filter((v) => v.row === l).map((v) => {
3362
3362
  const w = v.col - y, M = v.col + v.len - y;
3363
3363
  return M <= 0 || w >= d.length ? null : { start: Math.max(0, w), end: Math.min(d.length, M) };
3364
- }).filter(Boolean), b = [];
3364
+ }).filter(Boolean), _ = [];
3365
3365
  if (r.bracketMatch) {
3366
3366
  for (const v of [r.bracketMatch.open, r.bracketMatch.close])
3367
3367
  if (v.row === l) {
3368
3368
  const w = v.col - y;
3369
- w >= 0 && w < d.length && b.push({ start: w, end: w + 1 });
3369
+ w >= 0 && w < d.length && _.push({ start: w, end: w + 1 });
3370
3370
  }
3371
3371
  }
3372
3372
  const x = [], f = [];
@@ -3375,53 +3375,53 @@ function vi(r) {
3375
3375
  if (w.visRow === t && x.push(w.colInSeg), v.sel) {
3376
3376
  const M = ki(v.sel);
3377
3377
  if (l >= M.ar && l <= M.fr) {
3378
- const I = l === M.ar ? M.ac - y : -y, F = l === M.fr ? M.fc - y : d.length + 999;
3379
- F > 0 && I < d.length && f.push({ start: Math.max(0, I), end: Math.min(d.length, F) });
3378
+ const R = l === M.ar ? M.ac - y : -y, U = l === M.fr ? M.fc - y : d.length + 999;
3379
+ U > 0 && R < d.length && f.push({ start: Math.max(0, R), end: Math.min(d.length, U) });
3380
3380
  }
3381
3381
  }
3382
3382
  }
3383
- const T = [];
3383
+ const E = [];
3384
3384
  for (const v of r.remoteCursors) {
3385
3385
  const w = ee(s, v.row, v.col);
3386
- w.visRow === t && T.push({ col: w.colInSeg, name: v.name, color: v.color });
3386
+ w.visRow === t && E.push({ col: w.colInSeg, name: v.name, color: v.color });
3387
3387
  }
3388
- const R = [];
3388
+ const C = [];
3389
3389
  for (const v of r.remoteSels) {
3390
3390
  const w = v.from.row < v.to.row || v.from.row === v.to.row && v.from.col <= v.to.col ? v.from : v.to, M = w === v.from ? v.to : v.from;
3391
3391
  if (l >= w.row && l <= M.row) {
3392
- const I = l === w.row ? w.col - y : -y, F = l === M.row ? M.col - y : d.length + 999;
3393
- F > 0 && I < d.length && R.push({ start: Math.max(0, I), end: Math.min(d.length, F), color: v.color });
3392
+ const R = l === w.row ? w.col - y : -y, U = l === M.row ? M.col - y : d.length + 999;
3393
+ U > 0 && R < d.length && C.push({ start: Math.max(0, R), end: Math.min(d.length, U), color: v.color });
3394
3394
  }
3395
3395
  }
3396
- const j = wi(d, a.renderWhitespace), G = u || k || m.length || x.length || S.length || b.length || f.length || r.snippetStopCols.length > 0 || T.length > 0 || R.length > 0;
3396
+ const I = wi(d, a.renderWhitespace), z = u || k || b.length || x.length || T.length || _.length || f.length || r.snippetStopCols.length > 0 || E.length > 0 || C.length > 0;
3397
3397
  let H;
3398
- if (G)
3398
+ if (z)
3399
3399
  H = Ci(
3400
- j,
3400
+ I,
3401
3401
  u ? r.curColInSeg : -1,
3402
3402
  k,
3403
- m,
3403
+ b,
3404
3404
  x,
3405
3405
  r.snippetStopCols,
3406
- S,
3407
- b,
3406
+ T,
3407
+ _,
3408
3408
  f,
3409
3409
  a.tokeniserOpts,
3410
- T,
3411
- R,
3410
+ E,
3411
+ C,
3412
3412
  t === 0
3413
3413
  );
3414
3414
  else {
3415
3415
  const v = `${l}:${c}:${a.renderWhitespace}`;
3416
- let w = r.tokenCache.get(v, j);
3417
- w || (w = xe(j, a.tokeniserOpts), r.tokenCache.set(v, j, w)), H = xi(j, w) || "&#8203;";
3416
+ let w = r.tokenCache.get(v, I);
3417
+ w || (w = xe(I, a.tokeniserOpts), r.tokenCache.set(v, I, w)), H = xi(I, w) || "&#8203;";
3418
3418
  }
3419
- let $ = "";
3419
+ let P = "";
3420
3420
  if (c === 0 && a.showIndentGuides) {
3421
3421
  const v = (d.match(/^(\s*)/) ?? ["", ""])[1].length, w = Math.floor(v / a.tabSize);
3422
3422
  for (let M = 1; M < w; M++) {
3423
- const I = a.codePaddingLeft + M * a.tabSize * a.charWidth;
3424
- $ += `<span class="sl-ig" style="left:${I}px"></span>`;
3423
+ const R = a.codePaddingLeft + M * a.tabSize * a.charWidth;
3424
+ P += `<span class="sl-ig" style="left:${R}px"></span>`;
3425
3425
  }
3426
3426
  }
3427
3427
  let W = "";
@@ -3429,13 +3429,13 @@ function vi(r) {
3429
3429
  const v = n.has(l);
3430
3430
  W = `<span class="sl-fold-btn" data-row="${l}">${v ? "▸" : "▾"}</span>`;
3431
3431
  }
3432
- const U = n.has(l) && c === 0, C = c === 0 ? String(l + 1) : "";
3432
+ const N = n.has(l) && c === 0, S = c === 0 ? String(l + 1) : "";
3433
3433
  return `<div class="${[
3434
3434
  "sl-er",
3435
3435
  a.highlightActiveLine && h ? "sl-cur-row" : "",
3436
- _ ? "sl-wrap-cont" : "",
3437
- U ? "sl-folded" : ""
3438
- ].filter(Boolean).join(" ")}" style="height:${a.lineHeight}px" data-v="${t}" data-doc="${l}"><div class="sl-eg" style="position:relative">${W}<span class="sl-egn">${C}</span></div><div class="sl-el"><span class="sl-cl">${$}${H}</span></div></div>`;
3436
+ m ? "sl-wrap-cont" : "",
3437
+ N ? "sl-folded" : ""
3438
+ ].filter(Boolean).join(" ")}" style="height:${a.lineHeight}px" data-v="${t}" data-doc="${l}"><div class="sl-eg" style="position:relative">${W}<span class="sl-egn">${S}</span></div><div class="sl-el"><span class="sl-cl">${P}${H}</span></div></div>`;
3439
3439
  }
3440
3440
  function wi(r, e) {
3441
3441
  if (e === "none") return r;
@@ -3466,57 +3466,57 @@ function xi(r, e) {
3466
3466
  function Ci(r, e, t, i, s, n, o, a, l, c, d = [], u = [], h = !1) {
3467
3467
  if (r.length === 0) {
3468
3468
  let f = e >= 0 ? '<span class="sl-cur"></span>' : "";
3469
- for (const T of s) f += '<span class="sl-cur-extra"></span>';
3470
- for (const T of n) f += '<span class="sl-snip-stop"></span>';
3471
- for (const T of d)
3472
- f += `<span class="${h ? "sl-rc sl-rc-flip" : "sl-rc"}" style="--rc-color:${T.color}"><span class="sl-rc-label">${ne(T.name)}</span></span>`;
3469
+ for (const E of s) f += '<span class="sl-cur-extra"></span>';
3470
+ for (const E of n) f += '<span class="sl-snip-stop"></span>';
3471
+ for (const E of d)
3472
+ f += `<span class="${h ? "sl-rc sl-rc-flip" : "sl-rc"}" style="--rc-color:${E.color}"><span class="sl-rc-label">${ne(E.name)}</span></span>`;
3473
3473
  return f || "&#8203;";
3474
3474
  }
3475
- const _ = xe(r, c), y = st(r, _);
3476
- let g = "", k = 0, m = "", S = "", b = "";
3475
+ const m = xe(r, c), y = st(r, m);
3476
+ let g = "", k = 0, b = "", T = "", _ = "";
3477
3477
  const x = (f) => {
3478
3478
  if (f <= k) return;
3479
- const T = ne(r.slice(k, f)), R = [m, S, b ? "sl-rs" : ""].filter(Boolean).join(" "), j = b ? ` style="--rs-color:${b}33"` : "";
3480
- g += R || j ? `<span${j}${R ? ` class="${R}"` : ""}>${T}</span>` : T;
3479
+ const E = ne(r.slice(k, f)), C = [b, T, _ ? "sl-rs" : ""].filter(Boolean).join(" "), I = _ ? ` style="--rs-color:${_}33"` : "";
3480
+ g += C || I ? `<span${I}${C ? ` class="${C}"` : ""}>${E}</span>` : E;
3481
3481
  };
3482
3482
  for (let f = 0; f <= r.length; f++) {
3483
3483
  e === f && (x(f), k = f, g += '<span class="sl-cur"></span>');
3484
- for (const C of s)
3485
- C === f && (x(f), k = f, g += '<span class="sl-cur-extra"></span>');
3486
- for (const C of n)
3487
- C === f && (x(f), k = f, g += '<span class="sl-snip-stop"></span>');
3488
- for (const C of d)
3489
- C.col === f && (x(f), k = f, g += `<span class="${h ? "sl-rc sl-rc-flip" : "sl-rc"}" style="--rc-color:${C.color}"><span class="sl-rc-label">${ne(C.name)}</span></span>`);
3484
+ for (const S of s)
3485
+ S === f && (x(f), k = f, g += '<span class="sl-cur-extra"></span>');
3486
+ for (const S of n)
3487
+ S === f && (x(f), k = f, g += '<span class="sl-snip-stop"></span>');
3488
+ for (const S of d)
3489
+ S.col === f && (x(f), k = f, g += `<span class="${h ? "sl-rc sl-rc-flip" : "sl-rc"}" style="--rc-color:${S.color}"><span class="sl-rc-label">${ne(S.name)}</span></span>`);
3490
3490
  if (f === r.length) {
3491
3491
  x(f);
3492
3492
  break;
3493
3493
  }
3494
- const T = y[f] ?? "", R = i.find((C) => f >= C.start && f < C.end), j = t && f >= t.start && f < t.end || l.some((C) => f >= C.start && f < C.end), G = !j && !R && o.some((C) => f >= C.start && f < C.end), H = !j && !R && a.some((C) => f >= C.start && f < C.end);
3495
- let $ = "";
3496
- j ? $ = "sl-sh" : R ? $ = "sl-fh" + (R.isCur ? " sl-fh-cur" : "") : H ? $ = "sl-bm" : G && ($ = "sl-wh");
3497
- const W = j ? void 0 : u.find((C) => f >= C.start && f < C.end), U = (W == null ? void 0 : W.color) ?? "";
3498
- ($ !== m || T !== S || U !== b) && (x(f), k = f, m = $, S = T, b = U);
3494
+ const E = y[f] ?? "", C = i.find((S) => f >= S.start && f < S.end), I = t && f >= t.start && f < t.end || l.some((S) => f >= S.start && f < S.end), z = !I && !C && o.some((S) => f >= S.start && f < S.end), H = !I && !C && a.some((S) => f >= S.start && f < S.end);
3495
+ let P = "";
3496
+ I ? P = "sl-sh" : C ? P = "sl-fh" + (C.isCur ? " sl-fh-cur" : "") : H ? P = "sl-bm" : z && (P = "sl-wh");
3497
+ const W = I ? void 0 : u.find((S) => f >= S.start && f < S.end), N = (W == null ? void 0 : W.color) ?? "";
3498
+ (P !== b || E !== T || N !== _) && (x(f), k = f, b = P, T = E, _ = N);
3499
3499
  }
3500
3500
  return g || "&#8203;";
3501
3501
  }
3502
3502
  function _e(r, e, t, i, s) {
3503
- const n = Math.max(0, r * s - t), o = Math.max(0, r * q - i), l = (n > 0 ? e / n : 0) * o, c = Math.max(20, t / s * q), d = e / s * q - l;
3503
+ const n = Math.max(0, r * s - t), o = Math.max(0, r * G - i), l = (n > 0 ? e / n : 0) * o, c = Math.max(20, t / s * G), d = e / s * G - l;
3504
3504
  return { mmScroll: l, sliderTop: d, sliderHeight: c };
3505
3505
  }
3506
3506
  function Si(r, e, t, i, s) {
3507
- const n = Math.max(0, e * s - t), o = Math.max(0, e * q - i);
3507
+ const n = Math.max(0, e * s - t), o = Math.max(0, e * G - i);
3508
3508
  if (n <= 0) return 0;
3509
- const a = q / s - o / n;
3509
+ const a = G / s - o / n;
3510
3510
  if (Math.abs(a) < 1e-9) {
3511
- const l = Math.max(20, t / s * q);
3511
+ const l = Math.max(20, t / s * G);
3512
3512
  return Math.max(0, Math.min(n, r / Math.max(1, i - l) * n));
3513
3513
  }
3514
3514
  return Math.max(0, Math.min(n, r / a));
3515
3515
  }
3516
3516
  function Ti(r, e, t, i, s, n) {
3517
- const o = Math.max(0, e * n - i), a = Math.max(0, e * q - s);
3517
+ const o = Math.max(0, e * n - i), a = Math.max(0, e * G - s);
3518
3518
  if (o <= 0) return 0;
3519
- const l = t / o * a, c = (r + l) / q;
3519
+ const l = t / o * a, c = (r + l) / G;
3520
3520
  return Math.max(0, Math.min(o, c * n - i / 2));
3521
3521
  }
3522
3522
  function Ze(r) {
@@ -3541,7 +3541,7 @@ function Ze(r) {
3541
3541
  };
3542
3542
  }
3543
3543
  function Mi(r) {
3544
- var C, te;
3544
+ var S, te;
3545
3545
  const {
3546
3546
  canvas: e,
3547
3547
  doc: t,
@@ -3555,45 +3555,45 @@ function Mi(r) {
3555
3555
  findMatches: d,
3556
3556
  findIdx: u,
3557
3557
  sliderTop: h,
3558
- sliderHeight: _,
3558
+ sliderHeight: m,
3559
3559
  colors: y,
3560
3560
  getCssVar: g,
3561
3561
  dpr: k
3562
- } = r, m = e.getContext("2d");
3563
- if (!m) return;
3564
- m.setTransform(k, 0, 0, k, 0, 0);
3565
- const S = g("--mm-bg") || "#0d0d0f", b = g("--mm-dim") || "rgba(0,0,0,.30)", x = g("--mm-edge") || "rgba(255,255,255,.18)", f = g("--mm-slider") || "rgba(255,255,255,.07)", T = g("--sel-bg") || "rgba(110,159,255,.22)", R = g("--cur-line-bg") || "rgba(255,255,255,.05)", j = g("--find-border") || "rgba(234,180,86,.50)", G = g("--find-cur-bg") || "rgba(234,180,86,.80)", H = (E) => (E - i) * q;
3566
- if (m.fillStyle = S, m.fillRect(0, 0, o, a), l >= i && l < s && (m.fillStyle = R, m.fillRect(0, H(l), o, q)), c) {
3567
- const E = Math.max(i, c.ar), N = Math.min(s - 1, c.fr);
3568
- N >= E && (m.fillStyle = T, m.fillRect(0, H(E), o, (N - E + 1) * q));
3569
- }
3570
- for (const E of d) {
3571
- if (E.row < i || E.row >= s) continue;
3572
- const N = u >= 0 && ((C = d[u]) == null ? void 0 : C.row) === E.row && ((te = d[u]) == null ? void 0 : te.col) === E.col;
3573
- m.fillStyle = N ? G : j, m.fillRect(
3574
- oe + E.col * Y,
3575
- H(E.row),
3576
- Math.max(3, E.len * Y),
3577
- q
3562
+ } = r, b = e.getContext("2d");
3563
+ if (!b) return;
3564
+ b.setTransform(k, 0, 0, k, 0, 0);
3565
+ const T = g("--mm-bg") || "#0d0d0f", _ = g("--mm-dim") || "rgba(0,0,0,.30)", x = g("--mm-edge") || "rgba(255,255,255,.18)", f = g("--mm-slider") || "rgba(255,255,255,.07)", E = g("--sel-bg") || "rgba(110,159,255,.22)", C = g("--cur-line-bg") || "rgba(255,255,255,.05)", I = g("--find-border") || "rgba(234,180,86,.50)", z = g("--find-cur-bg") || "rgba(234,180,86,.80)", H = (L) => (L - i) * G;
3566
+ if (b.fillStyle = T, b.fillRect(0, 0, o, a), l >= i && l < s && (b.fillStyle = C, b.fillRect(0, H(l), o, G)), c) {
3567
+ const L = Math.max(i, c.ar), F = Math.min(s - 1, c.fr);
3568
+ F >= L && (b.fillStyle = E, b.fillRect(0, H(L), o, (F - L + 1) * G));
3569
+ }
3570
+ for (const L of d) {
3571
+ if (L.row < i || L.row >= s) continue;
3572
+ const F = u >= 0 && ((S = d[u]) == null ? void 0 : S.row) === L.row && ((te = d[u]) == null ? void 0 : te.col) === L.col;
3573
+ b.fillStyle = F ? z : I, b.fillRect(
3574
+ oe + L.col * Y,
3575
+ H(L.row),
3576
+ Math.max(3, L.len * Y),
3577
+ G
3578
3578
  );
3579
3579
  }
3580
- const $ = Math.floor((o - oe) / Y);
3581
- for (let E = i; E < s; E++) {
3582
- const N = t[E] ?? "";
3583
- if (!N.trim()) continue;
3584
- const V = H(E), K = 1.5, v = xe(N);
3580
+ const P = Math.floor((o - oe) / Y);
3581
+ for (let L = i; L < s; L++) {
3582
+ const F = t[L] ?? "";
3583
+ if (!F.trim()) continue;
3584
+ const V = H(L), K = 1.5, v = xe(F);
3585
3585
  let w = 0;
3586
- for (const I of v) {
3587
- if (I.start >= $) break;
3588
- I.start > w && (m.fillStyle = y.txt, m.fillRect(oe + w * Y, V, (Math.min(I.start, $) - w) * Y, K));
3589
- const F = y[I.cls] ?? y.txt, X = Math.min(I.end, $) - I.start;
3590
- X > 0 && (m.fillStyle = F, m.fillRect(oe + I.start * Y, V, X * Y, K)), w = Math.max(w, Math.min(I.end, $));
3586
+ for (const R of v) {
3587
+ if (R.start >= P) break;
3588
+ R.start > w && (b.fillStyle = y.txt, b.fillRect(oe + w * Y, V, (Math.min(R.start, P) - w) * Y, K));
3589
+ const U = y[R.cls] ?? y.txt, X = Math.min(R.end, P) - R.start;
3590
+ X > 0 && (b.fillStyle = U, b.fillRect(oe + R.start * Y, V, X * Y, K)), w = Math.max(w, Math.min(R.end, P));
3591
3591
  }
3592
- const M = Math.min(N.length, $);
3593
- w < M && (m.fillStyle = y.txt, m.fillRect(oe + w * Y, V, (M - w) * Y, K));
3592
+ const M = Math.min(F.length, P);
3593
+ w < M && (b.fillStyle = y.txt, b.fillRect(oe + w * Y, V, (M - w) * Y, K));
3594
3594
  }
3595
- const W = h + n, U = W + _;
3596
- m.fillStyle = b, W > 0 && m.fillRect(0, 0, o, W), U < a && m.fillRect(0, U, o, a - U), m.fillStyle = f, m.fillRect(0, W, o, _), m.fillStyle = x, m.fillRect(0, Math.max(0, W), o, 1), m.fillRect(0, Math.max(0, U - 1), o, 1);
3595
+ const W = h + n, N = W + m;
3596
+ b.fillStyle = _, W > 0 && b.fillRect(0, 0, o, W), N < a && b.fillRect(0, N, o, a - N), b.fillStyle = f, b.fillRect(0, W, o, m), b.fillStyle = x, b.fillRect(0, Math.max(0, W), o, 1), b.fillRect(0, Math.max(0, N - 1), o, 1);
3597
3597
  }
3598
3598
  const Ei = {
3599
3599
  value: "",
@@ -3770,16 +3770,16 @@ class Ii {
3770
3770
  }, this._onWinMmMouseUp = () => {
3771
3771
  this._mmDragMode !== "none" && (this._mmDragMode = "none", this._minimapWrap.style.cursor = "pointer");
3772
3772
  }, this._host = e, this._host.classList.add("sl-host"), this._shadow = this._host.attachShadow({ mode: "open" });
3773
- const i = D("style");
3774
- i.textContent = zt, this._shadow.appendChild(i), this._dynamicStyleEl = D("style"), this._shadow.appendChild(this._dynamicStyleEl), this._themeManager = new Ut(this._host);
3773
+ const i = j("style");
3774
+ i.textContent = zt, this._shadow.appendChild(i), this._dynamicStyleEl = j("style"), this._shadow.appendChild(this._dynamicStyleEl), this._themeManager = new Ut(this._host);
3775
3775
  const s = typeof this._config.theme == "string" ? this._config.theme : this._config.theme;
3776
3776
  this._themeManager.apply(s);
3777
- const n = D("div", "sl-layout"), o = D("div", "sl-ed-pane");
3778
- this._inputEl = D("textarea", "sl-input"), this._inputEl.setAttribute("autocomplete", "off"), this._inputEl.setAttribute("autocorrect", "off"), this._inputEl.setAttribute("autocapitalize", "off"), this._inputEl.setAttribute("spellcheck", "false"), this._inputEl.setAttribute("role", "textbox"), this._inputEl.setAttribute("aria-multiline", "true"), this._inputEl.setAttribute("aria-label", "Code editor"), this._inputEl.setAttribute("aria-readonly", String(!!this._config.readOnly)), this._inputEl.setAttribute("aria-haspopup", "listbox"), this._editorEl = D("div", "sl-editor"), this._spacerEl = D("div", "sl-spacer"), this._vpEl = D("div", "sl-vp"), this._editorEl.appendChild(this._spacerEl), this._editorEl.appendChild(this._vpEl), this._findBar = this._buildFindBar(), this._findInput = this._findBar.querySelector(".sl-find-input"), this._replaceInput = this._findBar.querySelector(".sl-find-replace-input"), this._findCount = this._findBar.querySelector(".sl-find-count"), this._replaceRow = this._findBar.querySelector(".sl-replace-row"), this._goToLineBar = this._buildGoToLineBar(), this._goToLineInput = this._goToLineBar.querySelector(".sl-gtl-input"), this._goToLineHint = this._goToLineBar.querySelector(".sl-gtl-hint"), this._placeholderEl = D("div", "sl-placeholder"), this._placeholderEl.textContent = this._config.placeholder, this._placeholderEl.style.display = "none", o.appendChild(this._inputEl), o.appendChild(this._findBar), o.appendChild(this._goToLineBar), o.appendChild(this._placeholderEl), o.appendChild(this._editorEl), this._minimapWrap = D("div", "sl-minimap"), this._minimapWrap.style.width = `${this._config.minimapWidth}px`, this._mmCanvas = D("canvas", ""), this._mmSlider = D("div", "sl-mm-slider"), this._minimapWrap.appendChild(this._mmCanvas), this._minimapWrap.appendChild(this._mmSlider), n.appendChild(o), this._config.showMinimap && n.appendChild(this._minimapWrap), this._statusBar = this._buildStatusBar(), this._acPopup = D("div", "sl-ac-popup"), this._acPopup.setAttribute("role", "listbox"), this._acPopup.setAttribute("aria-label", "Code suggestions"), this._acPopup.style.display = "none", this._emmetTip = D("div", "sl-emmet-tip"), this._emmetTip.style.display = "none", this._snippetTip = D("div", "sl-emmet-tip"), this._snippetTip.style.display = "none", this._hoverTip = D("div", "sl-hover-tip"), this._hoverTip.style.display = "none", this._hoverTip.addEventListener("mouseenter", () => {
3777
+ const n = j("div", "sl-layout"), o = j("div", "sl-ed-pane");
3778
+ this._inputEl = j("textarea", "sl-input"), this._inputEl.setAttribute("autocomplete", "off"), this._inputEl.setAttribute("autocorrect", "off"), this._inputEl.setAttribute("autocapitalize", "off"), this._inputEl.setAttribute("spellcheck", "false"), this._inputEl.setAttribute("role", "textbox"), this._inputEl.setAttribute("aria-multiline", "true"), this._inputEl.setAttribute("aria-label", "Code editor"), this._inputEl.setAttribute("aria-readonly", String(!!this._config.readOnly)), this._inputEl.setAttribute("aria-haspopup", "listbox"), this._editorEl = j("div", "sl-editor"), this._spacerEl = j("div", "sl-spacer"), this._vpEl = j("div", "sl-vp"), this._editorEl.appendChild(this._spacerEl), this._editorEl.appendChild(this._vpEl), this._findBar = this._buildFindBar(), this._findInput = this._findBar.querySelector(".sl-find-input"), this._replaceInput = this._findBar.querySelector(".sl-find-replace-input"), this._findCount = this._findBar.querySelector(".sl-find-count"), this._replaceRow = this._findBar.querySelector(".sl-replace-row"), this._goToLineBar = this._buildGoToLineBar(), this._goToLineInput = this._goToLineBar.querySelector(".sl-gtl-input"), this._goToLineHint = this._goToLineBar.querySelector(".sl-gtl-hint"), this._placeholderEl = j("div", "sl-placeholder"), this._placeholderEl.textContent = this._config.placeholder, this._placeholderEl.style.display = "none", o.appendChild(this._inputEl), o.appendChild(this._findBar), o.appendChild(this._goToLineBar), o.appendChild(this._placeholderEl), o.appendChild(this._editorEl), this._minimapWrap = j("div", "sl-minimap"), this._minimapWrap.style.width = `${this._config.minimapWidth}px`, this._mmCanvas = j("canvas", ""), this._mmSlider = j("div", "sl-mm-slider"), this._minimapWrap.appendChild(this._mmCanvas), this._minimapWrap.appendChild(this._mmSlider), n.appendChild(o), this._config.showMinimap && n.appendChild(this._minimapWrap), this._statusBar = this._buildStatusBar(), this._acPopup = j("div", "sl-ac-popup"), this._acPopup.setAttribute("role", "listbox"), this._acPopup.setAttribute("aria-label", "Code suggestions"), this._acPopup.style.display = "none", this._emmetTip = j("div", "sl-emmet-tip"), this._emmetTip.style.display = "none", this._snippetTip = j("div", "sl-emmet-tip"), this._snippetTip.style.display = "none", this._hoverTip = j("div", "sl-hover-tip"), this._hoverTip.style.display = "none", this._hoverTip.addEventListener("mouseenter", () => {
3779
3779
  this._hoverPinned = !0;
3780
3780
  }), this._hoverTip.addEventListener("mouseleave", () => {
3781
3781
  this._hoverPinned = !1, this._hideHover();
3782
- }), this._themeOverlay = D("div", "sl-theme-overlay"), this._themeOverlay.style.display = "none", this._themePanel = D("div", "sl-theme-panel"), this._themeOverlay.appendChild(this._themePanel), this._shadow.appendChild(n), this._config.showStatusBar && this._shadow.appendChild(this._statusBar), this._shadow.appendChild(this._acPopup), this._shadow.appendChild(this._emmetTip), this._shadow.appendChild(this._snippetTip), this._shadow.appendChild(this._hoverTip), this._shadow.appendChild(this._themeOverlay);
3782
+ }), this._themeOverlay = j("div", "sl-theme-overlay"), this._themeOverlay.style.display = "none", this._themePanel = j("div", "sl-theme-panel"), this._themeOverlay.appendChild(this._themePanel), this._shadow.appendChild(n), this._config.showStatusBar && this._shadow.appendChild(this._statusBar), this._shadow.appendChild(this._acPopup), this._shadow.appendChild(this._emmetTip), this._shadow.appendChild(this._snippetTip), this._shadow.appendChild(this._hoverTip), this._shadow.appendChild(this._themeOverlay);
3783
3783
  const a = typeof this._config.value == "string" ? Ue(this._config.value) : this._config.value;
3784
3784
  this._tab = We(1, a.length ? a : [""]), this._mmColors = Ze((l) => ue(l, this._host)), this._bindEditorEvents(), this._bindMinimapEvents(), this._bindFindEvents(), this._applyDynamicStyles(), typeof ResizeObserver < "u" && (this._ro = new ResizeObserver(fe(() => {
3785
3785
  this._config.wordWrap && (this._rebuildWrapMap(), this._scheduleRender());
@@ -3787,17 +3787,17 @@ class Ii {
3787
3787
  }
3788
3788
  // ── Public API ────────────────────────────────────────────
3789
3789
  getValue() {
3790
- return P(this._tab.doc);
3790
+ return $(this._tab.doc);
3791
3791
  }
3792
3792
  setValue(e) {
3793
3793
  var t, i;
3794
- A(this._tab, this._config.maxUndoHistory), this._tab.doc = Ue(e), this._tab.cur = { row: 0, col: 0 }, this._tab.sel = null, this._tokenCache.clear(), this._foldedLines.clear(), this._rebuildWrapMap(), this._render(), (i = (t = this._config).onChange) == null || i.call(t, e);
3794
+ D(this._tab, this._config.maxUndoHistory), this._tab.doc = Ue(e), this._tab.cur = { row: 0, col: 0 }, this._tab.sel = null, this._tokenCache.clear(), this._foldedLines.clear(), this._rebuildWrapMap(), this._render(), (i = (t = this._config).onChange) == null || i.call(t, e);
3795
3795
  }
3796
3796
  getCursor() {
3797
3797
  return { ...this._tab.cur };
3798
3798
  }
3799
3799
  setCursor(e) {
3800
- this._tab.cur = { ...e }, L(this._tab), this._scrollIntoView(), this._render();
3800
+ this._tab.cur = { ...e }, B(this._tab), this._scrollIntoView(), this._render();
3801
3801
  }
3802
3802
  getSelection() {
3803
3803
  return this._tab.sel ? { ...this._tab.sel } : null;
@@ -3806,7 +3806,7 @@ class Ii {
3806
3806
  this._tab.sel = e, this._render();
3807
3807
  }
3808
3808
  insertText(e) {
3809
- this._config.readOnly || (this._insertStr(e, !1), this._rebuildWrapMap(), L(this._tab), this._scrollIntoView(), this._render());
3809
+ this._config.readOnly || (this._insertStr(e, !1), this._rebuildWrapMap(), B(this._tab), this._scrollIntoView(), this._render());
3810
3810
  }
3811
3811
  setTheme(e) {
3812
3812
  this._themeManager.apply(e), this._applyTokenOverrides(), this._mmColors = Ze((t) => ue(t, this._host)), this._tokenCache.clear(), this._render();
@@ -3837,11 +3837,11 @@ class Ii {
3837
3837
  }
3838
3838
  undo() {
3839
3839
  var e, t;
3840
- Mt(this._tab) && (this._tokenCache.clear(), this._rebuildWrapMap(), L(this._tab), this._scrollIntoView(), this._render(), (t = (e = this._config).onChange) == null || t.call(e, P(this._tab.doc)));
3840
+ Mt(this._tab) && (this._tokenCache.clear(), this._rebuildWrapMap(), B(this._tab), this._scrollIntoView(), this._render(), (t = (e = this._config).onChange) == null || t.call(e, $(this._tab.doc)));
3841
3841
  }
3842
3842
  redo() {
3843
3843
  var e, t;
3844
- Et(this._tab) && (this._tokenCache.clear(), this._rebuildWrapMap(), L(this._tab), this._scrollIntoView(), this._render(), (t = (e = this._config).onChange) == null || t.call(e, P(this._tab.doc)));
3844
+ Et(this._tab) && (this._tokenCache.clear(), this._rebuildWrapMap(), B(this._tab), this._scrollIntoView(), this._render(), (t = (e = this._config).onChange) == null || t.call(e, $(this._tab.doc)));
3845
3845
  }
3846
3846
  executeCommand(e) {
3847
3847
  const t = this._config.readOnly;
@@ -3930,7 +3930,7 @@ class Ii {
3930
3930
  }
3931
3931
  // ── DOM builders ──────────────────────────────────────────
3932
3932
  _buildFindBar() {
3933
- const e = D("div", "sl-find-bar");
3933
+ const e = j("div", "sl-find-bar");
3934
3934
  return e.innerHTML = `
3935
3935
  <div class="sl-find-row">
3936
3936
  <input class="sl-find-input" placeholder="Find…" autocomplete="off" spellcheck="false">
@@ -3949,7 +3949,7 @@ class Ii {
3949
3949
  `, e;
3950
3950
  }
3951
3951
  _buildGoToLineBar() {
3952
- const e = D("div", "sl-gtl-bar");
3952
+ const e = j("div", "sl-gtl-bar");
3953
3953
  e.innerHTML = `
3954
3954
  <span class="sl-gtl-label">Go to line</span>
3955
3955
  <input class="sl-gtl-input" type="text" inputmode="numeric" autocomplete="off" spellcheck="false" placeholder="…">
@@ -3965,7 +3965,7 @@ class Ii {
3965
3965
  if (s.key === "Enter") {
3966
3966
  s.preventDefault();
3967
3967
  const a = parseInt(t.value, 10);
3968
- !isNaN(a) && a >= 1 && a <= this._tab.doc.length && (this._tab.cur.row = a - 1, this._tab.cur.col = Math.min(this._tab.cur.col, (this._tab.doc[a - 1] ?? "").length), L(this._tab), this._tab.sel = null, this._closeGoToLine(), this._scrollIntoView(), this._render(), (o = (n = this._config).onCursorChange) == null || o.call(n, { ...this._tab.cur }), this._broadcastCursorToCollab());
3968
+ !isNaN(a) && a >= 1 && a <= this._tab.doc.length && (this._tab.cur.row = a - 1, this._tab.cur.col = Math.min(this._tab.cur.col, (this._tab.doc[a - 1] ?? "").length), B(this._tab), this._tab.sel = null, this._closeGoToLine(), this._scrollIntoView(), this._render(), (o = (n = this._config).onCursorChange) == null || o.call(n, { ...this._tab.cur }), this._broadcastCursorToCollab());
3969
3969
  } else s.key === "Escape" && (s.preventDefault(), this._closeGoToLine());
3970
3970
  s.stopPropagation();
3971
3971
  }), e.querySelector(".sl-gtl-close").addEventListener("click", () => this._closeGoToLine()), e;
@@ -3981,7 +3981,7 @@ class Ii {
3981
3981
  this._goToLineBar.classList.remove("sl-open"), this._focusInput();
3982
3982
  }
3983
3983
  _buildStatusBar() {
3984
- const e = D("div", "sl-statusbar");
3984
+ const e = j("div", "sl-statusbar");
3985
3985
  return e.innerHTML = `
3986
3986
  <div class="sl-sb-item sl-no-click sl-sb-lang">⬡ TypeScript</div>
3987
3987
  <div class="sl-sb-sep"></div>
@@ -4056,23 +4056,23 @@ class Ii {
4056
4056
  if (this._spacerEl.style.height = `${n * s}px`, this._config.wordWrap)
4057
4057
  this._spacerEl.style.width = "", this._vpEl.style.width = "";
4058
4058
  else {
4059
- const g = e.reduce((S, b) => Math.max(S, b.length), 0), k = this._config.showGutter ? this._config.gutterWidth : 0, m = Math.max(
4059
+ const g = e.reduce((T, _) => Math.max(T, _.length), 0), k = this._config.showGutter ? this._config.gutterWidth : 0, b = Math.max(
4060
4060
  this._editorEl.clientWidth,
4061
4061
  k + se + Math.ceil(g * Q) + Pe + 64
4062
4062
  );
4063
- this._spacerEl.style.width = `${m}px`, this._vpEl.style.width = `${m}px`;
4063
+ this._spacerEl.style.width = `${b}px`, this._vpEl.style.width = `${b}px`;
4064
4064
  }
4065
4065
  const o = this._editorEl.scrollTop, a = this._editorEl.clientHeight, l = Math.max(0, Math.floor(o / s) - je), c = Math.min(n - 1, Math.ceil((o + a) / s) + je);
4066
4066
  this._vpEl.style.transform = `translateY(${l * s}px)`;
4067
4067
  const d = ee(this._wm, t.row, t.col), u = /* @__PURE__ */ new Map();
4068
4068
  if (this._snippetSession)
4069
4069
  for (let g = this._snippetSession.idx + 1; g < this._snippetSession.stops.length; g++) {
4070
- const k = this._snippetSession.stops[g], m = ee(this._wm, k.row, k.col), S = u.get(m.visRow) ?? [];
4071
- S.push(m.colInSeg), u.set(m.visRow, S);
4070
+ const k = this._snippetSession.stops[g], b = ee(this._wm, k.row, k.col), T = u.get(b.visRow) ?? [];
4071
+ T.push(b.colInSeg), u.set(b.visRow, T);
4072
4072
  }
4073
- const h = [], _ = [];
4073
+ const h = [], m = [];
4074
4074
  for (const g of this._remotePeers.values())
4075
- g.cursor && h.push({ row: g.cursor.row, col: g.cursor.col, name: g.name, color: g.color }), g.selection && _.push({ from: g.selection.from, to: g.selection.to, color: g.color });
4075
+ g.cursor && h.push({ row: g.cursor.row, col: g.cursor.col, name: g.name, color: g.color }), g.selection && m.push({ from: g.selection.from, to: g.selection.to, color: g.color });
4076
4076
  let y = "";
4077
4077
  for (let g = l; g <= c; g++) {
4078
4078
  const k = this._wm.visualRows[g];
@@ -4093,7 +4093,7 @@ class Ii {
4093
4093
  wm: this._wm,
4094
4094
  tokenCache: this._tokenCache,
4095
4095
  remoteCursors: h,
4096
- remoteSels: _,
4096
+ remoteSels: m,
4097
4097
  opts: {
4098
4098
  tokeniserOpts: {
4099
4099
  language: this._config.language,
@@ -4144,12 +4144,12 @@ class Ii {
4144
4144
  this._editorEl.clientHeight,
4145
4145
  t,
4146
4146
  o
4147
- ), d = a / 2, u = Math.floor(d), h = Math.ceil(t / 2) + 2, _ = Math.min(s, u + h), y = (_ - u) * 2, g = (d - u) * 2, k = Math.round(e * n), m = Math.round(y * n);
4148
- (this._mmCanvas.width !== k || this._mmCanvas.height !== m) && (this._mmCanvas.width = k, this._mmCanvas.height = m, this._mmCanvas.style.width = `${e}px`, this._mmCanvas.style.height = `${y}px`), this._mmCanvas.style.transform = `translateY(${-g}px)`, Mi({
4147
+ ), d = a / 2, u = Math.floor(d), h = Math.ceil(t / 2) + 2, m = Math.min(s, u + h), y = (m - u) * 2, g = (d - u) * 2, k = Math.round(e * n), b = Math.round(y * n);
4148
+ (this._mmCanvas.width !== k || this._mmCanvas.height !== b) && (this._mmCanvas.width = k, this._mmCanvas.height = b, this._mmCanvas.style.width = `${e}px`, this._mmCanvas.style.height = `${y}px`), this._mmCanvas.style.transform = `translateY(${-g}px)`, Mi({
4149
4149
  canvas: this._mmCanvas,
4150
4150
  doc: i,
4151
4151
  firstLine: u,
4152
- lastLine: _,
4152
+ lastLine: m,
4153
4153
  subPx: g,
4154
4154
  wrapperWidth: e,
4155
4155
  canvasHeight: y,
@@ -4160,7 +4160,7 @@ class Ii {
4160
4160
  sliderTop: l,
4161
4161
  sliderHeight: c,
4162
4162
  colors: this._mmColors,
4163
- getCssVar: (S) => ue(S, this._host),
4163
+ getCssVar: (T) => ue(T, this._host),
4164
4164
  dpr: n
4165
4165
  }), this._mmSlider.style.top = `${Math.max(0, Math.min(t - c, l))}px`, this._mmSlider.style.height = `${c}px`;
4166
4166
  }
@@ -4197,21 +4197,21 @@ class Ii {
4197
4197
  _insertStr(e, t) {
4198
4198
  var d, u;
4199
4199
  const i = Date.now();
4200
- (!t || i - this._lastInputTime > this._config.undoBatchMs) && A(this._tab, this._config.maxUndoHistory), this._lastInputTime = i, this._tab.sel && (this._tab.cur = re(this._tab));
4200
+ (!t || i - this._lastInputTime > this._config.undoBatchMs) && D(this._tab, this._config.maxUndoHistory), this._lastInputTime = i, this._tab.sel && (this._tab.cur = re(this._tab));
4201
4201
  const { doc: s, cur: n } = this._tab, o = e.split(`
4202
4202
  `), a = s[n.row] ?? "", l = a.slice(0, n.col), c = a.slice(n.col);
4203
4203
  if (o.length === 1)
4204
4204
  s[n.row] = l + e + c, n.col += e.length;
4205
4205
  else {
4206
4206
  const h = [l + o[0]];
4207
- for (let _ = 1; _ < o.length - 1; _++) h.push(o[_]);
4207
+ for (let m = 1; m < o.length - 1; m++) h.push(o[m]);
4208
4208
  h.push(o[o.length - 1] + c), s.splice(n.row, 1, ...h), n.row += o.length - 1, n.col = o[o.length - 1].length;
4209
4209
  }
4210
- this._tokenCache.invalidateLine(n.row, (this._wm.segments[n.row] ?? [""]).length), this._tab.dirty = !0, (u = (d = this._config).onChange) == null || u.call(d, P(s));
4210
+ this._tokenCache.invalidateLine(n.row, (this._wm.segments[n.row] ?? [""]).length), this._tab.dirty = !0, (u = (d = this._config).onChange) == null || u.call(d, $(s));
4211
4211
  }
4212
4212
  _doBackspace() {
4213
4213
  var i;
4214
- if (A(this._tab, this._config.maxUndoHistory), this._tab.sel) {
4214
+ if (D(this._tab, this._config.maxUndoHistory), this._tab.sel) {
4215
4215
  this._tab.cur = re(this._tab), this._tokenCache.clear(), this._tab.dirty = !0;
4216
4216
  return;
4217
4217
  }
@@ -4226,13 +4226,13 @@ class Ii {
4226
4226
  this._tab.dirty = !0;
4227
4227
  }
4228
4228
  _doEnter() {
4229
- A(this._tab, this._config.maxUndoHistory), this._tab.sel && (this._tab.cur = re(this._tab));
4229
+ D(this._tab, this._config.maxUndoHistory), this._tab.sel && (this._tab.cur = re(this._tab));
4230
4230
  const { doc: e, cur: t } = this._tab, i = e[t.row] ?? "", s = i.slice(0, t.col), n = i.slice(t.col), o = ze(i), a = s.trimEnd().endsWith("{") ? ce(this._config.tabSize) : "";
4231
4231
  e[t.row] = s, s.trimEnd().endsWith("{") && n.trimStart() === "}" ? e.splice(t.row + 1, 0, o + a, o + n) : e.splice(t.row + 1, 0, o + a + n), t.row++, t.col = o.length + a.length, this._tokenCache.clear(), this._tab.dirty = !0;
4232
4232
  }
4233
4233
  _doDelete() {
4234
4234
  var s;
4235
- if (A(this._tab, this._config.maxUndoHistory), this._tab.sel) {
4235
+ if (D(this._tab, this._config.maxUndoHistory), this._tab.sel) {
4236
4236
  this._tab.cur = re(this._tab), this._tokenCache.clear(), this._tab.dirty = !0;
4237
4237
  return;
4238
4238
  }
@@ -4255,11 +4255,11 @@ class Ii {
4255
4255
  var t, i, s, n, o, a, l;
4256
4256
  const e = Ne(this._tab);
4257
4257
  e && ((t = navigator.clipboard) == null || t.writeText(e).catch(() => {
4258
- }), A(this._tab, this._config.maxUndoHistory), this._tab.cur = re(this._tab), this._tokenCache.clear(), this._tab.dirty = !0, this._rebuildWrapMap(), this._render(), (s = (i = this._config).onChange) == null || s.call(i, P(this._tab.doc)), (o = (n = this._config).onCursorChange) == null || o.call(n, { ...this._tab.cur }), (l = (a = this._config).onSelectionChange) == null || l.call(a, null), this._broadcastCursorToCollab());
4258
+ }), D(this._tab, this._config.maxUndoHistory), this._tab.cur = re(this._tab), this._tokenCache.clear(), this._tab.dirty = !0, this._rebuildWrapMap(), this._render(), (s = (i = this._config).onChange) == null || s.call(i, $(this._tab.doc)), (o = (n = this._config).onCursorChange) == null || o.call(n, { ...this._tab.cur }), (l = (a = this._config).onSelectionChange) == null || l.call(a, null), this._broadcastCursorToCollab());
4259
4259
  }
4260
4260
  _toggleComment() {
4261
4261
  var n, o, a, l;
4262
- A(this._tab, this._config.maxUndoHistory);
4262
+ D(this._tab, this._config.maxUndoHistory);
4263
4263
  const e = this._getSelRows(), t = this._config.lineCommentToken || vt[this._config.language] || "";
4264
4264
  if (!t) return;
4265
4265
  const i = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), s = e.every((c) => (this._tab.doc[c] ?? "").trimStart().startsWith(t));
@@ -4267,19 +4267,19 @@ class Ii {
4267
4267
  var u;
4268
4268
  const d = this._tab.doc[c] ?? "";
4269
4269
  this._tab.doc[c] = s ? d.replace(new RegExp(`^(\\s*)${i}\\s?`), "$1") : d.replace(/^(\s*)/, `$1${t} `), this._tokenCache.invalidateLine(c, ((u = this._wm.segments[c]) == null ? void 0 : u.length) ?? 1);
4270
- }), this._tab.dirty = !0, this._rebuildWrapMap(), this._render(), (o = (n = this._config).onChange) == null || o.call(n, P(this._tab.doc)), (l = (a = this._config).onCursorChange) == null || l.call(a, { ...this._tab.cur }), this._broadcastCursorToCollab();
4270
+ }), this._tab.dirty = !0, this._rebuildWrapMap(), this._render(), (o = (n = this._config).onChange) == null || o.call(n, $(this._tab.doc)), (l = (a = this._config).onCursorChange) == null || l.call(a, { ...this._tab.cur }), this._broadcastCursorToCollab();
4271
4271
  }
4272
4272
  _duplicateLine() {
4273
4273
  var t, i, s, n;
4274
- A(this._tab, this._config.maxUndoHistory);
4274
+ D(this._tab, this._config.maxUndoHistory);
4275
4275
  const e = this._tab.cur.row;
4276
- this._tab.doc.splice(e + 1, 0, this._tab.doc[e] ?? ""), this._tab.cur.row++, this._tokenCache.clear(), this._tab.dirty = !0, this._rebuildWrapMap(), this._render(), (i = (t = this._config).onChange) == null || i.call(t, P(this._tab.doc)), (n = (s = this._config).onCursorChange) == null || n.call(s, { ...this._tab.cur }), this._broadcastCursorToCollab();
4276
+ this._tab.doc.splice(e + 1, 0, this._tab.doc[e] ?? ""), this._tab.cur.row++, this._tokenCache.clear(), this._tab.dirty = !0, this._rebuildWrapMap(), this._render(), (i = (t = this._config).onChange) == null || i.call(t, $(this._tab.doc)), (n = (s = this._config).onCursorChange) == null || n.call(s, { ...this._tab.cur }), this._broadcastCursorToCollab();
4277
4277
  }
4278
4278
  _deleteLine() {
4279
4279
  var i, s, n, o;
4280
- A(this._tab, this._config.maxUndoHistory);
4280
+ D(this._tab, this._config.maxUndoHistory);
4281
4281
  const { doc: e, cur: t } = this._tab;
4282
- e.length > 1 ? e.splice(t.row, 1) : (e[0] = "", t.col = 0), this._tokenCache.clear(), this._tab.dirty = !0, L(this._tab), this._rebuildWrapMap(), this._render(), (s = (i = this._config).onChange) == null || s.call(i, P(this._tab.doc)), (o = (n = this._config).onCursorChange) == null || o.call(n, { ...this._tab.cur }), this._broadcastCursorToCollab();
4282
+ e.length > 1 ? e.splice(t.row, 1) : (e[0] = "", t.col = 0), this._tokenCache.clear(), this._tab.dirty = !0, B(this._tab), this._rebuildWrapMap(), this._render(), (s = (i = this._config).onChange) == null || s.call(i, $(this._tab.doc)), (o = (n = this._config).onCursorChange) == null || o.call(n, { ...this._tab.cur }), this._broadcastCursorToCollab();
4283
4283
  }
4284
4284
  _indentSel() {
4285
4285
  var t, i, s, n;
@@ -4287,22 +4287,22 @@ class Ii {
4287
4287
  this._insertStr(ce(this._config.tabSize), !1);
4288
4288
  return;
4289
4289
  }
4290
- A(this._tab, this._config.maxUndoHistory);
4290
+ D(this._tab, this._config.maxUndoHistory);
4291
4291
  const e = ce(this._config.tabSize);
4292
4292
  this._getSelRows().forEach((o) => {
4293
4293
  var a;
4294
4294
  this._tab.doc[o] = e + (this._tab.doc[o] ?? ""), this._tokenCache.invalidateLine(o, ((a = this._wm.segments[o]) == null ? void 0 : a.length) ?? 1);
4295
- }), this._tab.dirty = !0, this._rebuildWrapMap(), this._render(), (i = (t = this._config).onChange) == null || i.call(t, P(this._tab.doc)), (n = (s = this._config).onCursorChange) == null || n.call(s, { ...this._tab.cur }), this._broadcastCursorToCollab();
4295
+ }), this._tab.dirty = !0, this._rebuildWrapMap(), this._render(), (i = (t = this._config).onChange) == null || i.call(t, $(this._tab.doc)), (n = (s = this._config).onCursorChange) == null || n.call(s, { ...this._tab.cur }), this._broadcastCursorToCollab();
4296
4296
  }
4297
4297
  _unindentSel() {
4298
4298
  var t, i, s, n;
4299
- A(this._tab, this._config.maxUndoHistory);
4299
+ D(this._tab, this._config.maxUndoHistory);
4300
4300
  const e = this._config.tabSize;
4301
4301
  this._getSelRows().forEach((o) => {
4302
4302
  var l;
4303
4303
  const a = this._tab.doc[o] ?? "";
4304
4304
  a.startsWith(ce(e)) ? this._tab.doc[o] = a.slice(e) : a.startsWith(" ") && (this._tab.doc[o] = a.slice(1)), this._tokenCache.invalidateLine(o, ((l = this._wm.segments[o]) == null ? void 0 : l.length) ?? 1);
4305
- }), this._tab.dirty = !0, this._rebuildWrapMap(), this._render(), (i = (t = this._config).onChange) == null || i.call(t, P(this._tab.doc)), (n = (s = this._config).onCursorChange) == null || n.call(s, { ...this._tab.cur }), this._broadcastCursorToCollab();
4305
+ }), this._tab.dirty = !0, this._rebuildWrapMap(), this._render(), (i = (t = this._config).onChange) == null || i.call(t, $(this._tab.doc)), (n = (s = this._config).onCursorChange) == null || n.call(s, { ...this._tab.cur }), this._broadcastCursorToCollab();
4306
4306
  }
4307
4307
  _toggleWrap() {
4308
4308
  this._config.wordWrap = !this._config.wordWrap, this._vpEl.classList.toggle("sl-wrap-mode", this._config.wordWrap);
@@ -4449,15 +4449,15 @@ class Ii {
4449
4449
  const e = this._acItems[this._acSel];
4450
4450
  if (!e) return;
4451
4451
  if (this._acHide(), e.kind === "emmet" && e.body) {
4452
- A(this._tab, this._config.maxUndoHistory), this._expandBodyAt(e.body, this._emmetAcStartCol);
4452
+ D(this._tab, this._config.maxUndoHistory), this._expandBodyAt(e.body, this._emmetAcStartCol);
4453
4453
  return;
4454
4454
  }
4455
4455
  if (e.body) {
4456
- A(this._tab, this._config.maxUndoHistory), this._expandBodyAt(e.body, this._acStartCol);
4456
+ D(this._tab, this._config.maxUndoHistory), this._expandBodyAt(e.body, this._acStartCol);
4457
4457
  return;
4458
4458
  }
4459
4459
  const t = e.label.slice(this._acPrefix.length);
4460
- this._insertStr(t, !1), this._rebuildWrapMap(), L(this._tab), this._scrollIntoView(), this._render();
4460
+ this._insertStr(t, !1), this._rebuildWrapMap(), B(this._tab), this._scrollIntoView(), this._render();
4461
4461
  }
4462
4462
  // ── Emmet ─────────────────────────────────────────────────
4463
4463
  _emmetCheck() {
@@ -4480,7 +4480,7 @@ class Ii {
4480
4480
  _emmetAccept() {
4481
4481
  if (!this._emmetExpanded || this._emmetTip.style.display === "none") return !1;
4482
4482
  const { abbr: e, result: t, start: i } = this._emmetExpanded;
4483
- return A(this._tab, this._config.maxUndoHistory), this._emmetExpanded = null, this._emmetTip.style.display = "none", this._expandBodyAt(t, i), !0;
4483
+ return D(this._tab, this._config.maxUndoHistory), this._emmetExpanded = null, this._emmetTip.style.display = "none", this._expandBodyAt(t, i), !0;
4484
4484
  }
4485
4485
  // ── Snippets / Completions ────────────────────────────────
4486
4486
  /** Returns built-in snippets for the current language merged with user completions.
@@ -4504,7 +4504,7 @@ class Ii {
4504
4504
  _snippetAccept() {
4505
4505
  if (!this._snippetExpanded || this._snippetTip.style.display === "none") return !1;
4506
4506
  const { snippet: e, start: t } = this._snippetExpanded;
4507
- return e.body ? (A(this._tab, this._config.maxUndoHistory), this._snippetExpanded = null, this._snippetTip.style.display = "none", this._expandBodyAt(e.body, t), !0) : !1;
4507
+ return e.body ? (D(this._tab, this._config.maxUndoHistory), this._snippetExpanded = null, this._snippetTip.style.display = "none", this._expandBodyAt(e.body, t), !0) : !1;
4508
4508
  }
4509
4509
  /**
4510
4510
  * Expand a snippet/emmet body template at the current cursor position.
@@ -4514,19 +4514,19 @@ class Ii {
4514
4514
  * Everything between `triggerStart` and `cur.col` is replaced by `body`.
4515
4515
  */
4516
4516
  _expandBodyAt(e, t) {
4517
- var m, S;
4517
+ var b, T, _, x, f, E;
4518
4518
  const { doc: i, cur: s } = this._tab, n = s.row, o = i[s.row] ?? "", a = o.slice(0, t), l = o.slice(s.col), c = ze(o), d = e.split(`
4519
- `).map((b, x) => x === 0 ? b : c + b), u = d.join(`
4520
- `), h = [], _ = /\$(\d+)/g;
4519
+ `).map((C, I) => I === 0 ? C : c + C), u = d.join(`
4520
+ `), h = [], m = /\$(\d+)/g;
4521
4521
  let y;
4522
- for (; (y = _.exec(u)) !== null; ) {
4523
- const b = parseInt(y[1], 10), f = u.slice(0, y.index).split(`
4524
- `), T = f.length - 1, R = f[T].length, j = (f[T].match(/\$\d+/g) ?? []).join("").length, G = n + T, H = (T === 0 ? t : c.length) + (R - j);
4525
- h.push({ n: b, row: G, col: H });
4522
+ for (; (y = m.exec(u)) !== null; ) {
4523
+ const C = parseInt(y[1], 10), z = u.slice(0, y.index).split(`
4524
+ `), H = z.length - 1, P = z[H].length, W = (z[H].match(/\$\d+/g) ?? []).join("").length, N = n + H, S = (H === 0 ? t : c.length) + (P - W);
4525
+ h.push({ n: C, row: N, col: S });
4526
4526
  }
4527
- h.sort((b, x) => b.n === 0 ? 1 : x.n === 0 ? -1 : b.n - x.n);
4528
- const g = d.map((b) => b.replace(/\$\d+/g, "")), k = g.length === 1 ? [a + g[0] + l] : [a + g[0], ...g.slice(1, -1), g[g.length - 1] + l];
4529
- i.splice(s.row, 1, ...k), h.length > 0 ? (this._snippetSession = { stops: h.map((b) => ({ row: b.row, col: b.col })), idx: 0 }, s.row = h[0].row, s.col = h[0].col) : (this._snippetSession = null, s.row += k.length - 1, s.col = (k[k.length - 1] ?? "").length - l.length), this._tokenCache.clear(), this._tab.dirty = !0, this._rebuildWrapMap(), L(this._tab), this._scrollIntoView(), this._render(), (S = (m = this._config).onChange) == null || S.call(m, P(this._tab.doc));
4527
+ h.sort((C, I) => C.n === 0 ? 1 : I.n === 0 ? -1 : C.n - I.n);
4528
+ const g = d.map((C) => C.replace(/\$\d+/g, "")), k = g.length === 1 ? [a + g[0] + l] : [a + g[0], ...g.slice(1, -1), g[g.length - 1] + l];
4529
+ i.splice(s.row, 1, ...k), h.length > 0 ? (this._snippetSession = { stops: h.map((C) => ({ row: C.row, col: C.col })), idx: 0 }, s.row = h[0].row, s.col = h[0].col) : (this._snippetSession = null, s.row += k.length - 1, s.col = (k[k.length - 1] ?? "").length - l.length), this._tokenCache.clear(), this._tab.dirty = !0, this._tab.sel = null, this._rebuildWrapMap(), B(this._tab), this._scrollIntoView(), this._render(), (T = (b = this._config).onCursorChange) == null || T.call(b, { ...this._tab.cur }), (x = (_ = this._config).onSelectionChange) == null || x.call(_, null), this._broadcastCursorToCollab(), (E = (f = this._config).onChange) == null || E.call(f, $(this._tab.doc));
4530
4530
  }
4531
4531
  // ── Theme picker ──────────────────────────────────────────
4532
4532
  _openThemePicker() {
@@ -4584,18 +4584,18 @@ class Ii {
4584
4584
  }
4585
4585
  this._tab.sel = null, this._isDragging = !0, this._dragAnchor = { ...t };
4586
4586
  }
4587
- L(this._tab), this._render(), (s = (i = this._config).onCursorChange) == null || s.call(i, { ...this._tab.cur }), (o = (n = this._config).onSelectionChange) == null || o.call(n, this._tab.sel ? { ...this._tab.sel } : null), this._broadcastCursorToCollab();
4587
+ B(this._tab), this._render(), (s = (i = this._config).onCursorChange) == null || s.call(i, { ...this._tab.cur }), (o = (n = this._config).onSelectionChange) == null || o.call(n, this._tab.sel ? { ...this._tab.sel } : null), this._broadcastCursorToCollab();
4588
4588
  }), this._editorEl.addEventListener("mousemove", (e) => {
4589
4589
  if (this._config.hover && !this._hoverPinned && !this._isDragging && this._scheduleHover(e), !this._isDragging || !this._dragAnchor) return;
4590
4590
  const t = this._posFromMouse(e);
4591
- this._tab.cur = { ...t }, t.row !== this._dragAnchor.row || t.col !== this._dragAnchor.col ? this._tab.sel = { ar: this._dragAnchor.row, ac: this._dragAnchor.col, fr: t.row, fc: t.col } : this._tab.sel = null, L(this._tab), this._render(), this._broadcastCursorToCollab();
4591
+ this._tab.cur = { ...t }, t.row !== this._dragAnchor.row || t.col !== this._dragAnchor.col ? this._tab.sel = { ar: this._dragAnchor.row, ac: this._dragAnchor.col, fr: t.row, fc: t.col } : this._tab.sel = null, B(this._tab), this._render(), this._broadcastCursorToCollab();
4592
4592
  }), this._editorEl.addEventListener("mouseleave", () => {
4593
4593
  this._hoverPinned || this._hideHover();
4594
4594
  }), window.addEventListener("mouseup", this._onWinMouseUp), this._editorEl.addEventListener("scroll", this._onEditorScroll, { passive: !0 }), window.addEventListener("resize", this._onWinResize), this._inputEl.addEventListener("keydown", (e) => this._onKeyDown(e)), this._inputEl.addEventListener("input", (e) => this._onInput(e)), this._inputEl.addEventListener("paste", (e) => {
4595
4595
  var i;
4596
4596
  if (e.preventDefault(), this._config.readOnly) return;
4597
4597
  const t = (i = e.clipboardData ?? window.clipboardData) == null ? void 0 : i.getData("text/plain");
4598
- t && (this._insertStr(t, !1), this._tokenCache.clear(), this._rebuildWrapMap(), L(this._tab), this._scrollIntoView(), this._render());
4598
+ t && (this._insertStr(t, !1), this._tokenCache.clear(), this._rebuildWrapMap(), B(this._tab), this._scrollIntoView(), this._render());
4599
4599
  }), this._editorEl.addEventListener("mousedown", () => setTimeout(() => this._focusInput(), 0)), this._inputEl.addEventListener("focus", () => {
4600
4600
  var e, t;
4601
4601
  return (t = (e = this._config).onFocus) == null ? void 0 : t.call(e);
@@ -4605,7 +4605,7 @@ class Ii {
4605
4605
  });
4606
4606
  }
4607
4607
  _onKeyDown(e) {
4608
- var o, a, l, c, d, u, h, _, y, g, k, m, S, b, x, f, T, R, j, G, H, $, W, U, C, te, E, N, V, K, v, w, M, I, F, X, Te, Me, Ee, Ie, Le, Re, Be;
4608
+ var o, a, l, c, d, u, h, m, y, g, k, b, T, _, x, f, E, C, I, z, H, P, W, N, S, te, L, F, V, K, v, w, M, R, U, X, Te, Me, Ee, Ie, Le, Re, Be;
4609
4609
  const t = e.ctrlKey || e.metaKey, i = e.shiftKey, s = e.altKey, n = this._config.readOnly;
4610
4610
  if (this._hideHover(), this._acVisible()) {
4611
4611
  if (e.key === "ArrowDown") {
@@ -4690,66 +4690,66 @@ class Ii {
4690
4690
  if (i) {
4691
4691
  if (this._snippetSession.idx > 0) {
4692
4692
  this._snippetSession.idx--;
4693
- const B = this._snippetSession.stops[this._snippetSession.idx];
4694
- this._tab.cur.row = B.row, this._tab.cur.col = B.col, this._tab.sel = null, L(this._tab), this._scrollIntoView(), this._render(), (u = (d = this._config).onCursorChange) == null || u.call(d, { ...this._tab.cur }), (_ = (h = this._config).onSelectionChange) == null || _.call(h, null), this._broadcastCursorToCollab();
4693
+ const A = this._snippetSession.stops[this._snippetSession.idx];
4694
+ this._tab.cur.row = A.row, this._tab.cur.col = A.col, this._tab.sel = null, B(this._tab), this._scrollIntoView(), this._render(), (u = (d = this._config).onCursorChange) == null || u.call(d, { ...this._tab.cur }), (m = (h = this._config).onSelectionChange) == null || m.call(h, null), this._broadcastCursorToCollab();
4695
4695
  }
4696
4696
  } else if (this._snippetSession.idx++, this._snippetSession.idx >= this._snippetSession.stops.length)
4697
4697
  this._snippetSession = null;
4698
4698
  else {
4699
- const B = this._snippetSession.stops[this._snippetSession.idx];
4700
- this._tab.cur.row = B.row, this._tab.cur.col = B.col, this._tab.sel = null, L(this._tab), this._scrollIntoView(), this._render(), (g = (y = this._config).onCursorChange) == null || g.call(y, { ...this._tab.cur }), (m = (k = this._config).onSelectionChange) == null || m.call(k, null), this._broadcastCursorToCollab();
4699
+ const A = this._snippetSession.stops[this._snippetSession.idx];
4700
+ this._tab.cur.row = A.row, this._tab.cur.col = A.col, this._tab.sel = null, B(this._tab), this._scrollIntoView(), this._render(), (g = (y = this._config).onCursorChange) == null || g.call(y, { ...this._tab.cur }), (b = (k = this._config).onSelectionChange) == null || b.call(k, null), this._broadcastCursorToCollab();
4701
4701
  }
4702
4702
  return;
4703
4703
  }
4704
4704
  if (!i && this._emmetAccept() || !i && this._snippetAccept()) return;
4705
- i ? this._unindentSel() : this._indentSel(), L(this._tab), this._scrollIntoView(), this._rebuildWrapMap(), this._render(), (b = (S = this._config).onCursorChange) == null || b.call(S, { ...this._tab.cur }), (f = (x = this._config).onSelectionChange) == null || f.call(x, this._tab.sel ? { ...this._tab.sel } : null), this._broadcastCursorToCollab();
4705
+ i ? this._unindentSel() : this._indentSel(), B(this._tab), this._scrollIntoView(), this._rebuildWrapMap(), this._render(), (_ = (T = this._config).onCursorChange) == null || _.call(T, { ...this._tab.cur }), (f = (x = this._config).onSelectionChange) == null || f.call(x, this._tab.sel ? { ...this._tab.sel } : null), this._broadcastCursorToCollab();
4706
4706
  return;
4707
4707
  }
4708
4708
  if (e.key === "Backspace") {
4709
4709
  if (e.preventDefault(), this._extraCursors.length) {
4710
4710
  this._snippetSession = null;
4711
- const B = ri(
4711
+ const A = ri(
4712
4712
  this._tab.doc,
4713
4713
  this._tab.cur.row,
4714
4714
  this._tab.cur.col,
4715
4715
  this._extraCursors
4716
4716
  );
4717
- this._tab.doc = B.doc, this._tab.cur.row = B.primaryRow, this._tab.cur.col = B.primaryCol, this._extraCursors = B.extraCursors, this._mc.cursors = B.extraCursors;
4717
+ this._tab.doc = A.doc, this._tab.cur.row = A.primaryRow, this._tab.cur.col = A.primaryCol, this._extraCursors = A.extraCursors, this._mc.cursors = A.extraCursors;
4718
4718
  } else {
4719
4719
  if (this._snippetSession) {
4720
- const B = this._snippetSession.stops[this._snippetSession.idx];
4721
- if (this._tab.cur.row === B.row && this._tab.cur.col > B.col) {
4720
+ const A = this._snippetSession.stops[this._snippetSession.idx];
4721
+ if (this._tab.cur.row === A.row && this._tab.cur.col > A.col) {
4722
4722
  for (let O = this._snippetSession.idx + 1; O < this._snippetSession.stops.length; O++) {
4723
4723
  const ie = this._snippetSession.stops[O];
4724
- ie.row === B.row && ie.col >= this._tab.cur.col && ie.col--;
4724
+ ie.row === A.row && ie.col >= this._tab.cur.col && ie.col--;
4725
4725
  }
4726
- B.col--;
4726
+ A.col--;
4727
4727
  } else
4728
4728
  this._snippetSession = null;
4729
4729
  }
4730
4730
  this._doBackspace();
4731
4731
  }
4732
- this._tokenCache.clear(), this._rebuildWrapMap(), L(this._tab), this._scrollIntoView(), this._render(), this._acTrigger(), this._emmetCheck(), this._snippetCheck(), (R = (T = this._config).onChange) == null || R.call(T, P(this._tab.doc)), (G = (j = this._config).onCursorChange) == null || G.call(j, { ...this._tab.cur }), ($ = (H = this._config).onSelectionChange) == null || $.call(H, this._tab.sel ? { ...this._tab.sel } : null), this._broadcastCursorToCollab();
4732
+ this._tokenCache.clear(), this._rebuildWrapMap(), B(this._tab), this._scrollIntoView(), this._render(), this._acTrigger(), this._emmetCheck(), this._snippetCheck(), (C = (E = this._config).onChange) == null || C.call(E, $(this._tab.doc)), (z = (I = this._config).onCursorChange) == null || z.call(I, { ...this._tab.cur }), (P = (H = this._config).onSelectionChange) == null || P.call(H, this._tab.sel ? { ...this._tab.sel } : null), this._broadcastCursorToCollab();
4733
4733
  return;
4734
4734
  }
4735
4735
  if (e.key === "Delete") {
4736
- e.preventDefault(), this._snippetSession = null, this._doDelete(), this._tokenCache.clear(), this._rebuildWrapMap(), L(this._tab), this._scrollIntoView(), this._render(), (U = (W = this._config).onChange) == null || U.call(W, P(this._tab.doc)), (te = (C = this._config).onCursorChange) == null || te.call(C, { ...this._tab.cur }), (N = (E = this._config).onSelectionChange) == null || N.call(E, this._tab.sel ? { ...this._tab.sel } : null), this._broadcastCursorToCollab();
4736
+ e.preventDefault(), this._snippetSession = null, this._doDelete(), this._tokenCache.clear(), this._rebuildWrapMap(), B(this._tab), this._scrollIntoView(), this._render(), (N = (W = this._config).onChange) == null || N.call(W, $(this._tab.doc)), (te = (S = this._config).onCursorChange) == null || te.call(S, { ...this._tab.cur }), (F = (L = this._config).onSelectionChange) == null || F.call(L, this._tab.sel ? { ...this._tab.sel } : null), this._broadcastCursorToCollab();
4737
4737
  return;
4738
4738
  }
4739
4739
  if (e.key === "Enter") {
4740
- e.preventDefault(), this._snippetSession = null, this._doEnter(), this._tokenCache.clear(), this._rebuildWrapMap(), L(this._tab), this._scrollIntoView(), this._render(), (K = (V = this._config).onChange) == null || K.call(V, P(this._tab.doc)), (w = (v = this._config).onCursorChange) == null || w.call(v, { ...this._tab.cur }), (I = (M = this._config).onSelectionChange) == null || I.call(M, this._tab.sel ? { ...this._tab.sel } : null), this._broadcastCursorToCollab();
4740
+ e.preventDefault(), this._snippetSession = null, this._doEnter(), this._tokenCache.clear(), this._rebuildWrapMap(), B(this._tab), this._scrollIntoView(), this._render(), (K = (V = this._config).onChange) == null || K.call(V, $(this._tab.doc)), (w = (v = this._config).onCursorChange) == null || w.call(v, { ...this._tab.cur }), (R = (M = this._config).onSelectionChange) == null || R.call(M, this._tab.sel ? { ...this._tab.sel } : null), this._broadcastCursorToCollab();
4741
4741
  return;
4742
4742
  }
4743
4743
  if (!t && !s && this._config.autoClosePairs[e.key]) {
4744
- e.preventDefault(), A(this._tab, this._config.maxUndoHistory), this._tab.sel && (this._tab.cur = re(this._tab));
4745
- const { doc: B, cur: O } = this._tab, ie = B[O.row] ?? "";
4746
- B[O.row] = ie.slice(0, O.col) + e.key + this._config.autoClosePairs[e.key] + ie.slice(O.col), O.col++, this._tokenCache.invalidateLine(O.row, ((F = this._wm.segments[O.row]) == null ? void 0 : F.length) ?? 1), this._tab.dirty = !0, this._rebuildWrapMap(), L(this._tab), this._scrollIntoView(), this._render(), (Te = (X = this._config).onChange) == null || Te.call(X, P(this._tab.doc)), (Ee = (Me = this._config).onCursorChange) == null || Ee.call(Me, { ...this._tab.cur }), (Le = (Ie = this._config).onSelectionChange) == null || Le.call(Ie, null), this._broadcastCursorToCollab();
4744
+ e.preventDefault(), D(this._tab, this._config.maxUndoHistory), this._tab.sel && (this._tab.cur = re(this._tab));
4745
+ const { doc: A, cur: O } = this._tab, ie = A[O.row] ?? "";
4746
+ A[O.row] = ie.slice(0, O.col) + e.key + this._config.autoClosePairs[e.key] + ie.slice(O.col), O.col++, this._tokenCache.invalidateLine(O.row, ((U = this._wm.segments[O.row]) == null ? void 0 : U.length) ?? 1), this._tab.dirty = !0, this._rebuildWrapMap(), B(this._tab), this._scrollIntoView(), this._render(), (Te = (X = this._config).onChange) == null || Te.call(X, $(this._tab.doc)), (Ee = (Me = this._config).onCursorChange) == null || Ee.call(Me, { ...this._tab.cur }), (Le = (Ie = this._config).onSelectionChange) == null || Le.call(Ie, null), this._broadcastCursorToCollab();
4747
4747
  return;
4748
4748
  }
4749
4749
  if (!t && !s && Object.values(this._config.autoClosePairs).includes(e.key)) {
4750
- const { doc: B, cur: O } = this._tab;
4751
- if ((B[O.row] ?? "")[O.col] === e.key) {
4752
- e.preventDefault(), O.col++, L(this._tab), this._scrollIntoView(), this._render(), (Be = (Re = this._config).onCursorChange) == null || Be.call(Re, { ...this._tab.cur }), this._broadcastCursorToCollab();
4750
+ const { doc: A, cur: O } = this._tab;
4751
+ if ((A[O.row] ?? "")[O.col] === e.key) {
4752
+ e.preventDefault(), O.col++, B(this._tab), this._scrollIntoView(), this._render(), (Be = (Re = this._config).onCursorChange) == null || Be.call(Re, { ...this._tab.cur }), this._broadcastCursorToCollab();
4753
4753
  return;
4754
4754
  }
4755
4755
  }
@@ -4764,41 +4764,41 @@ class Ii {
4764
4764
  this._handleArrowKeys(e, t, i);
4765
4765
  }
4766
4766
  _handleArrowKeys(e, t, i) {
4767
- var _, y, g, k, m, S;
4768
- const { doc: s, cur: n } = this._tab, o = this._config.lineHeight, a = e.metaKey, l = e.ctrlKey, c = e.altKey, d = (b, x) => {
4767
+ var m, y, g, k, b, T;
4768
+ const { doc: s, cur: n } = this._tab, o = this._config.lineHeight, a = e.metaKey, l = e.ctrlKey, c = e.altKey, d = (_, x) => {
4769
4769
  if (i) {
4770
- this._tab.sel || (this._tab.sel = { ar: n.row, ac: n.col, fr: n.row, fc: n.col }), n.row = b, n.col = x;
4770
+ this._tab.sel || (this._tab.sel = { ar: n.row, ac: n.col, fr: n.row, fc: n.col }), n.row = _, n.col = x;
4771
4771
  const f = this._tab.sel;
4772
- f.fr = b, f.fc = x, f.ar === f.fr && f.ac === f.fc && (this._tab.sel = null);
4772
+ f.fr = _, f.fc = x, f.ar === f.fr && f.ac === f.fc && (this._tab.sel = null);
4773
4773
  } else
4774
- this._tab.sel = null, n.row = b, n.col = x;
4775
- }, u = (b) => {
4776
- const f = (s[b] ?? "").search(/\S/);
4774
+ this._tab.sel = null, n.row = _, n.col = x;
4775
+ }, u = (_) => {
4776
+ const f = (s[_] ?? "").search(/\S/);
4777
4777
  return f === -1 || n.col === f ? 0 : f;
4778
4778
  }, h = () => ({ row: s.length - 1, col: (s[s.length - 1] ?? "").length });
4779
4779
  switch (e.key) {
4780
4780
  case "ArrowRight":
4781
4781
  if (e.preventDefault(), this._tab.sel && !i) {
4782
- const b = J(this._tab.sel);
4783
- n.row = b.fr, n.col = b.fc, this._tab.sel = null;
4782
+ const _ = J(this._tab.sel);
4783
+ n.row = _.fr, n.col = _.fc, this._tab.sel = null;
4784
4784
  break;
4785
4785
  }
4786
4786
  if (a)
4787
4787
  d(n.row, (s[n.row] ?? "").length);
4788
4788
  else if (l || c) {
4789
- const b = s[n.row] ?? "";
4790
- if (n.col >= b.length)
4789
+ const _ = s[n.row] ?? "";
4790
+ if (n.col >= _.length)
4791
4791
  n.row < s.length - 1 && d(n.row + 1, 0);
4792
4792
  else {
4793
- const x = this._wordSkipRight(b, n.col);
4793
+ const x = this._wordSkipRight(_, n.col);
4794
4794
  d(n.row, x);
4795
4795
  }
4796
4796
  } else n.col < (s[n.row] ?? "").length ? d(n.row, n.col + 1) : n.row < s.length - 1 && d(n.row + 1, 0);
4797
4797
  break;
4798
4798
  case "ArrowLeft":
4799
4799
  if (e.preventDefault(), this._tab.sel && !i) {
4800
- const b = J(this._tab.sel);
4801
- n.row = b.ar, n.col = b.ac, this._tab.sel = null;
4800
+ const _ = J(this._tab.sel);
4801
+ n.row = _.ar, n.col = _.ac, this._tab.sel = null;
4802
4802
  break;
4803
4803
  }
4804
4804
  if (a)
@@ -4807,32 +4807,32 @@ class Ii {
4807
4807
  if (n.col === 0)
4808
4808
  n.row > 0 && d(n.row - 1, (s[n.row - 1] ?? "").length);
4809
4809
  else {
4810
- const b = this._wordSkipLeft(s[n.row] ?? "", n.col);
4811
- d(n.row, b);
4810
+ const _ = this._wordSkipLeft(s[n.row] ?? "", n.col);
4811
+ d(n.row, _);
4812
4812
  }
4813
4813
  else n.col > 0 ? d(n.row, n.col - 1) : n.row > 0 && d(n.row - 1, (s[n.row - 1] ?? "").length);
4814
4814
  break;
4815
4815
  case "ArrowDown":
4816
4816
  if (e.preventDefault(), a) {
4817
- const b = h();
4818
- d(b.row, b.col);
4817
+ const _ = h();
4818
+ d(_.row, _.col);
4819
4819
  } else if (this._config.wordWrap) {
4820
- const b = ee(this._wm, n.row, n.col), x = Math.min(this._wm.visualRows.length - 1, b.visRow + 1), f = le(this._wm, x, Math.min(b.colInSeg, (((_ = this._wm.visualRows[x]) == null ? void 0 : _.text) ?? "").length));
4820
+ const _ = ee(this._wm, n.row, n.col), x = Math.min(this._wm.visualRows.length - 1, _.visRow + 1), f = le(this._wm, x, Math.min(_.colInSeg, (((m = this._wm.visualRows[x]) == null ? void 0 : m.text) ?? "").length));
4821
4821
  d(f.row, f.col);
4822
4822
  } else {
4823
- const b = Math.min(s.length - 1, n.row + 1);
4824
- d(b, Math.min(n.col, (s[b] ?? "").length));
4823
+ const _ = Math.min(s.length - 1, n.row + 1);
4824
+ d(_, Math.min(n.col, (s[_] ?? "").length));
4825
4825
  }
4826
4826
  break;
4827
4827
  case "ArrowUp":
4828
4828
  if (e.preventDefault(), a)
4829
4829
  d(0, 0);
4830
4830
  else if (this._config.wordWrap) {
4831
- const b = ee(this._wm, n.row, n.col), x = Math.max(0, b.visRow - 1), f = le(this._wm, x, Math.min(b.colInSeg, (((y = this._wm.visualRows[x]) == null ? void 0 : y.text) ?? "").length));
4831
+ const _ = ee(this._wm, n.row, n.col), x = Math.max(0, _.visRow - 1), f = le(this._wm, x, Math.min(_.colInSeg, (((y = this._wm.visualRows[x]) == null ? void 0 : y.text) ?? "").length));
4832
4832
  d(f.row, f.col);
4833
4833
  } else {
4834
- const b = Math.max(0, n.row - 1);
4835
- d(b, Math.min(n.col, (s[b] ?? "").length));
4834
+ const _ = Math.max(0, n.row - 1);
4835
+ d(_, Math.min(n.col, (s[_] ?? "").length));
4836
4836
  }
4837
4837
  break;
4838
4838
  case "Home":
@@ -4840,29 +4840,29 @@ class Ii {
4840
4840
  break;
4841
4841
  case "End":
4842
4842
  if (e.preventDefault(), l) {
4843
- const b = h();
4844
- d(b.row, b.col);
4843
+ const _ = h();
4844
+ d(_.row, _.col);
4845
4845
  } else
4846
4846
  d(n.row, (s[n.row] ?? "").length);
4847
4847
  break;
4848
4848
  case "PageDown":
4849
4849
  e.preventDefault();
4850
4850
  {
4851
- const b = Math.max(1, Math.floor(this._editorEl.clientHeight / o) - 1), x = Math.min(s.length - 1, n.row + b);
4851
+ const _ = Math.max(1, Math.floor(this._editorEl.clientHeight / o) - 1), x = Math.min(s.length - 1, n.row + _);
4852
4852
  d(x, Math.min(n.col, (s[x] ?? "").length)), this._editorEl.scrollTop += this._editorEl.clientHeight - o;
4853
4853
  break;
4854
4854
  }
4855
4855
  case "PageUp":
4856
4856
  e.preventDefault();
4857
4857
  {
4858
- const b = Math.max(1, Math.floor(this._editorEl.clientHeight / o) - 1), x = Math.max(0, n.row - b);
4858
+ const _ = Math.max(1, Math.floor(this._editorEl.clientHeight / o) - 1), x = Math.max(0, n.row - _);
4859
4859
  d(x, Math.min(n.col, (s[x] ?? "").length)), this._editorEl.scrollTop -= this._editorEl.clientHeight - o;
4860
4860
  break;
4861
4861
  }
4862
4862
  default:
4863
4863
  return;
4864
4864
  }
4865
- L(this._tab), this._scrollIntoView(), this._acHide(), (k = (g = this._config).onCursorChange) == null || k.call(g, { ...this._tab.cur }), (S = (m = this._config).onSelectionChange) == null || S.call(m, this._tab.sel ? { ...this._tab.sel } : null), this._broadcastCursorToCollab(), this._render();
4865
+ B(this._tab), this._scrollIntoView(), this._acHide(), (k = (g = this._config).onCursorChange) == null || k.call(g, { ...this._tab.cur }), (T = (b = this._config).onSelectionChange) == null || T.call(b, this._tab.sel ? { ...this._tab.sel } : null), this._broadcastCursorToCollab(), this._render();
4866
4866
  }
4867
4867
  _isWordChar(e) {
4868
4868
  const t = this._config.wordSeparators;
@@ -4898,9 +4898,9 @@ class Ii {
4898
4898
  const h = J(s);
4899
4899
  n = h.ar, o = h.fr, h.fc === 0 && h.fr > h.ar && o--;
4900
4900
  }
4901
- A(this._tab, this._config.maxUndoHistory);
4901
+ D(this._tab, this._config.maxUndoHistory);
4902
4902
  const a = t.slice(n, o + 1);
4903
- e ? (t.splice(o + 1, 0, ...a), i.row += a.length, s && (s.ar += a.length, s.fr += a.length)) : t.splice(n, 0, ...a), this._tab.dirty = !0, this._tokenCache.clear(), this._rebuildWrapMap(), L(this._tab), this._scrollIntoView(), this._render(), (c = (l = this._config).onChange) == null || c.call(l, P(this._tab.doc)), (u = (d = this._config).onCursorChange) == null || u.call(d, { ...this._tab.cur }), this._broadcastCursorToCollab();
4903
+ e ? (t.splice(o + 1, 0, ...a), i.row += a.length, s && (s.ar += a.length, s.fr += a.length)) : t.splice(n, 0, ...a), this._tab.dirty = !0, this._tokenCache.clear(), this._rebuildWrapMap(), B(this._tab), this._scrollIntoView(), this._render(), (c = (l = this._config).onChange) == null || c.call(l, $(this._tab.doc)), (u = (d = this._config).onCursorChange) == null || u.call(d, { ...this._tab.cur }), this._broadcastCursorToCollab();
4904
4904
  }
4905
4905
  _moveLines(e) {
4906
4906
  var a, l, c, d;
@@ -4912,16 +4912,16 @@ class Ii {
4912
4912
  }
4913
4913
  if (e) {
4914
4914
  if (n === 0) return;
4915
- A(this._tab, this._config.maxUndoHistory);
4915
+ D(this._tab, this._config.maxUndoHistory);
4916
4916
  const u = t.splice(n, o - n + 1);
4917
4917
  t.splice(n - 1, 0, ...u), i.row--, s && (s.ar--, s.fr--);
4918
4918
  } else {
4919
4919
  if (o >= t.length - 1) return;
4920
- A(this._tab, this._config.maxUndoHistory);
4920
+ D(this._tab, this._config.maxUndoHistory);
4921
4921
  const u = t.splice(n, o - n + 1);
4922
4922
  t.splice(n + 1, 0, ...u), i.row++, s && (s.ar++, s.fr++);
4923
4923
  }
4924
- this._tab.dirty = !0, this._tokenCache.clear(), this._rebuildWrapMap(), L(this._tab), this._scrollIntoView(), this._render(), (l = (a = this._config).onChange) == null || l.call(a, P(this._tab.doc)), (d = (c = this._config).onCursorChange) == null || d.call(c, { ...this._tab.cur }), this._broadcastCursorToCollab();
4924
+ this._tab.dirty = !0, this._tokenCache.clear(), this._rebuildWrapMap(), B(this._tab), this._scrollIntoView(), this._render(), (l = (a = this._config).onChange) == null || l.call(a, $(this._tab.doc)), (d = (c = this._config).onCursorChange) == null || d.call(c, { ...this._tab.cur }), this._broadcastCursorToCollab();
4925
4925
  }
4926
4926
  // ── Hover documentation ────────────────────────────────────
4927
4927
  _scheduleHover(e) {
@@ -4939,17 +4939,17 @@ class Ii {
4939
4939
  Math.round(o / Q)
4940
4940
  )), d = le(this._wm, l, c), u = this._tab.doc[d.row] ?? "", h = mi(u, d.col);
4941
4941
  if (!h) return;
4942
- let _ = yi(h, this._config.language);
4943
- if (!_) {
4944
- const m = this._config.completions.find((S) => S.label === h);
4945
- m && (m.description || m.detail) && (_ = {
4946
- title: m.label,
4947
- type: m.detail,
4948
- body: m.description ?? ""
4942
+ let m = yi(h, this._config.language);
4943
+ if (!m) {
4944
+ const b = this._config.completions.find((T) => T.label === h);
4945
+ b && (b.description || b.detail) && (m = {
4946
+ title: b.label,
4947
+ type: b.detail,
4948
+ body: b.description ?? ""
4949
4949
  });
4950
4950
  }
4951
- if (!_) {
4952
- const m = (k = (g = this._config).provideHover) == null ? void 0 : k.call(g, {
4951
+ if (!m) {
4952
+ const b = (k = (g = this._config).provideHover) == null ? void 0 : k.call(g, {
4953
4953
  word: h,
4954
4954
  row: d.row,
4955
4955
  col: d.col,
@@ -4957,9 +4957,9 @@ class Ii {
4957
4957
  language: this._config.language,
4958
4958
  doc: this._tab.doc
4959
4959
  });
4960
- m && (_ = m);
4960
+ b && (m = b);
4961
4961
  }
4962
- _ && this._showHoverTip(_, e, t);
4962
+ m && this._showHoverTip(m, e, t);
4963
4963
  }
4964
4964
  _showHoverTip(e, t, i) {
4965
4965
  const s = this._hoverTip;
@@ -4991,23 +4991,23 @@ class Ii {
4991
4991
  this._extraCursors,
4992
4992
  s
4993
4993
  );
4994
- this._tab.doc = c.doc, this._tab.cur.row = c.primaryRow, this._tab.cur.col = c.primaryCol, this._extraCursors = c.extraCursors, this._mc.cursors = c.extraCursors, this._tab.dirty = !0, (o = (n = this._config).onChange) == null || o.call(n, P(this._tab.doc));
4994
+ this._tab.doc = c.doc, this._tab.cur.row = c.primaryRow, this._tab.cur.col = c.primaryCol, this._extraCursors = c.extraCursors, this._mc.cursors = c.extraCursors, this._tab.dirty = !0, (o = (n = this._config).onChange) == null || o.call(n, $(this._tab.doc));
4995
4995
  } else {
4996
4996
  const c = this._tab.cur.row, d = this._tab.cur.col;
4997
4997
  if (this._insertStr(s, !0), this._snippetSession) {
4998
4998
  const u = this._snippetSession, h = u.stops[u.idx];
4999
4999
  if (this._tab.cur.row === h.row) {
5000
- const _ = this._tab.cur.col - d;
5000
+ const m = this._tab.cur.col - d;
5001
5001
  for (let y = u.idx + 1; y < u.stops.length; y++) {
5002
5002
  const g = u.stops[y];
5003
- g.row === c && g.col >= d && (g.col += _);
5003
+ g.row === c && g.col >= d && (g.col += m);
5004
5004
  }
5005
5005
  h.col = this._tab.cur.col;
5006
5006
  } else
5007
5007
  this._snippetSession = null;
5008
5008
  }
5009
5009
  }
5010
- this._tokenCache.clear(), this._rebuildWrapMap(), L(this._tab), this._scrollIntoView(), this._render(), this._acTrigger(), this._emmetCheck(), this._snippetCheck(), (l = (a = this._config).onCursorChange) == null || l.call(a, { ...this._tab.cur }), this._broadcastCursorToCollab();
5010
+ this._tokenCache.clear(), this._rebuildWrapMap(), B(this._tab), this._scrollIntoView(), this._render(), this._acTrigger(), this._emmetCheck(), this._snippetCheck(), (l = (a = this._config).onCursorChange) == null || l.call(a, { ...this._tab.cur }), this._broadcastCursorToCollab();
5011
5011
  }
5012
5012
  }
5013
5013
  _ctrlD() {
@@ -5038,13 +5038,13 @@ class Ii {
5038
5038
  }
5039
5039
  _doReplaceOne() {
5040
5040
  var e, t;
5041
- this._findIdx < 0 || !this._findMatches.length || (A(this._tab, this._config.maxUndoHistory), this._tab.doc = li(this._tab.doc, this._findMatches, this._findIdx, this._replaceInput.value), this._tokenCache.clear(), this._tab.dirty = !0, this._runFind(this._findInput.value), this._findMatches.length ? (this._findIdx >= this._findMatches.length && (this._findIdx = 0), this._navFind(0)) : (this._findCount.textContent = "0/0", this._rebuildWrapMap(), this._render()), (t = (e = this._config).onChange) == null || t.call(e, P(this._tab.doc)));
5041
+ this._findIdx < 0 || !this._findMatches.length || (D(this._tab, this._config.maxUndoHistory), this._tab.doc = li(this._tab.doc, this._findMatches, this._findIdx, this._replaceInput.value), this._tokenCache.clear(), this._tab.dirty = !0, this._runFind(this._findInput.value), this._findMatches.length ? (this._findIdx >= this._findMatches.length && (this._findIdx = 0), this._navFind(0)) : (this._findCount.textContent = "0/0", this._rebuildWrapMap(), this._render()), (t = (e = this._config).onChange) == null || t.call(e, $(this._tab.doc)));
5042
5042
  }
5043
5043
  _doReplaceAll() {
5044
5044
  var t, i;
5045
5045
  if (!this._findMatches.length) return;
5046
5046
  const e = this._findMatches.length;
5047
- A(this._tab, this._config.maxUndoHistory), this._tab.doc = ci(this._tab.doc, this._findMatches, this._replaceInput.value), this._tokenCache.clear(), this._tab.dirty = !0, this._findMatches = [], this._findIdx = -1, this._findCount.textContent = `0/0 (${e} replaced)`, this._rebuildWrapMap(), this._render(), (i = (t = this._config).onChange) == null || i.call(t, P(this._tab.doc));
5047
+ D(this._tab, this._config.maxUndoHistory), this._tab.doc = ci(this._tab.doc, this._findMatches, this._replaceInput.value), this._tokenCache.clear(), this._tab.dirty = !0, this._findMatches = [], this._findIdx = -1, this._findCount.textContent = `0/0 (${e} replaced)`, this._rebuildWrapMap(), this._render(), (i = (t = this._config).onChange) == null || i.call(t, $(this._tab.doc));
5048
5048
  }
5049
5049
  // ── Minimap events ────────────────────────────────────────
5050
5050
  _bindMinimapEvents() {
@@ -5282,7 +5282,7 @@ export {
5282
5282
  Dt as THEME_VSCODE_DARK,
5283
5283
  Ai as WebSocketTransport,
5284
5284
  he as charIdEq,
5285
- z as charIdToStr,
5285
+ q as charIdToStr,
5286
5286
  Di as createCollabSession,
5287
5287
  ji as createEditor,
5288
5288
  lt as diffText,