@vscode/markdown-editor 0.0.2-80 → 0.0.2-82
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.d.ts +2 -1
- package/dist/index.js +740 -736
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { commands as
|
|
2
|
-
import { O as w, S as M, a as
|
|
3
|
-
import
|
|
4
|
-
import { observableValue as C, derived as P, transaction as
|
|
5
|
-
import { D as Ei, f as Ci, a as Si, b as Li, c as Mi, d as
|
|
1
|
+
import { commands as Wt } from "./commands.js";
|
|
2
|
+
import { O as w, S as M, a as le, c as Cs } from "./stringEdit-CVDbCUBY.js";
|
|
3
|
+
import Ss from "katex";
|
|
4
|
+
import { observableValue as C, derived as P, transaction as ne, Disposable as H, runOnChange as Kt, autorun as B, constObservable as xi } from "@vscode/observables";
|
|
5
|
+
import { D as Ei, f as Ci, a as Si, b as Li, c as Mi, d as Ls, i as He } from "./config-BGeaJqWk.js";
|
|
6
6
|
import { e as Yl } from "./config-BGeaJqWk.js";
|
|
7
7
|
import { parse as Ti, preprocess as Oi, postprocess as Ri } from "micromark";
|
|
8
8
|
import { frontmatter as Ni } from "micromark-extension-frontmatter";
|
|
@@ -11,13 +11,13 @@ import { gfmTable as Pi } from "micromark-extension-gfm-table";
|
|
|
11
11
|
import { gfmTaskListItem as Bi } from "micromark-extension-gfm-task-list-item";
|
|
12
12
|
import { gfmStrikethrough as Ai } from "micromark-extension-gfm-strikethrough";
|
|
13
13
|
import { createDiffComputer as Di } from "@vscode/diff";
|
|
14
|
-
class
|
|
14
|
+
class zt {
|
|
15
15
|
constructor(e, t) {
|
|
16
16
|
if (this.replaceRange = e, this.newLength = t, t < 0)
|
|
17
17
|
throw new Error(`newLength must be non-negative, got ${t}`);
|
|
18
18
|
}
|
|
19
19
|
static replace(e, t) {
|
|
20
|
-
return new
|
|
20
|
+
return new zt(e, t);
|
|
21
21
|
}
|
|
22
22
|
get lengthDelta() {
|
|
23
23
|
return this.newLength - this.replaceRange.length;
|
|
@@ -35,7 +35,7 @@ class Ee {
|
|
|
35
35
|
return new Ee([e]);
|
|
36
36
|
}
|
|
37
37
|
static replace(e, t) {
|
|
38
|
-
return new Ee([
|
|
38
|
+
return new Ee([zt.replace(e, t)]);
|
|
39
39
|
}
|
|
40
40
|
replacements;
|
|
41
41
|
constructor(e) {
|
|
@@ -62,7 +62,7 @@ class Ee {
|
|
|
62
62
|
return this.isEmpty ? "LengthEdit.empty" : this.replacements.join(", ");
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
class
|
|
65
|
+
class dn {
|
|
66
66
|
constructor(e) {
|
|
67
67
|
this.value = e;
|
|
68
68
|
}
|
|
@@ -115,13 +115,13 @@ var N;
|
|
|
115
115
|
}
|
|
116
116
|
n.virtual = t;
|
|
117
117
|
})(N || (N = {}));
|
|
118
|
-
class
|
|
118
|
+
class ue {
|
|
119
119
|
constructor(e, t) {
|
|
120
120
|
this.x = e, this.y = t;
|
|
121
121
|
}
|
|
122
|
-
static ZERO = new
|
|
122
|
+
static ZERO = new ue(0, 0);
|
|
123
123
|
translate(e, t) {
|
|
124
|
-
return new
|
|
124
|
+
return new ue(this.x + e, this.y + t);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
class S {
|
|
@@ -148,7 +148,7 @@ class S {
|
|
|
148
148
|
return this.y + this.height;
|
|
149
149
|
}
|
|
150
150
|
get topLeft() {
|
|
151
|
-
return new
|
|
151
|
+
return new ue(this.x, this.y);
|
|
152
152
|
}
|
|
153
153
|
containsX(e) {
|
|
154
154
|
return e >= this.left && e < this.right;
|
|
@@ -228,12 +228,12 @@ function D(n, e) {
|
|
|
228
228
|
}
|
|
229
229
|
return t ?? e;
|
|
230
230
|
}
|
|
231
|
-
function
|
|
231
|
+
function se(n, e) {
|
|
232
232
|
const t = n.get(e);
|
|
233
233
|
return t && t !== e ? t : e;
|
|
234
234
|
}
|
|
235
235
|
function re(n, e) {
|
|
236
|
-
return e ?
|
|
236
|
+
return e ? se(n, e) : void 0;
|
|
237
237
|
}
|
|
238
238
|
class at extends U {
|
|
239
239
|
get children() {
|
|
@@ -246,7 +246,7 @@ class at extends U {
|
|
|
246
246
|
return this;
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
-
class
|
|
249
|
+
class et extends at {
|
|
250
250
|
constructor(e) {
|
|
251
251
|
super(), this.content = e;
|
|
252
252
|
}
|
|
@@ -273,13 +273,13 @@ class W extends at {
|
|
|
273
273
|
return this.content === e.content && this.glueKind === e.glueKind;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
|
-
class
|
|
276
|
+
class J extends U {
|
|
277
277
|
/** Prepends {@link leadingTrivia}, if any, ahead of the block's own children. */
|
|
278
278
|
_withLeading(e) {
|
|
279
279
|
return this.leadingTrivia ? [this.leadingTrivia, ...e] : e;
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
|
-
class
|
|
282
|
+
class _e extends J {
|
|
283
283
|
constructor(e, t) {
|
|
284
284
|
super(), this.content = e, this.leadingTrivia = t;
|
|
285
285
|
}
|
|
@@ -291,16 +291,16 @@ class ve extends Z {
|
|
|
291
291
|
return ae(this.content, "content");
|
|
292
292
|
}
|
|
293
293
|
mapChildren(e) {
|
|
294
|
-
return new
|
|
294
|
+
return new _e(D(e, this.content), re(e, this.leadingTrivia));
|
|
295
295
|
}
|
|
296
296
|
withLeadingTrivia(e) {
|
|
297
|
-
return new
|
|
297
|
+
return new _e(this.content, e);
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
function ae(n, e) {
|
|
301
301
|
return n.find((t) => t instanceof y && t.markerKind === e);
|
|
302
302
|
}
|
|
303
|
-
class
|
|
303
|
+
class qt extends U {
|
|
304
304
|
constructor(e, t, s) {
|
|
305
305
|
super(), this.openMarker = e, this.content = t, this.closeMarker = s;
|
|
306
306
|
}
|
|
@@ -309,10 +309,10 @@ class Ut extends U {
|
|
|
309
309
|
return [this.openMarker, ...this.content, this.closeMarker];
|
|
310
310
|
}
|
|
311
311
|
mapChildren(e) {
|
|
312
|
-
return new
|
|
312
|
+
return new qt(se(e, this.openMarker), D(e, this.content), se(e, this.closeMarker));
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
|
-
class
|
|
315
|
+
class Gt extends U {
|
|
316
316
|
constructor(e, t, s) {
|
|
317
317
|
super(), this.openMarker = e, this.content = t, this.closeMarker = s;
|
|
318
318
|
}
|
|
@@ -321,10 +321,10 @@ class Xt extends U {
|
|
|
321
321
|
return [this.openMarker, ...this.content, this.closeMarker];
|
|
322
322
|
}
|
|
323
323
|
mapChildren(e) {
|
|
324
|
-
return new
|
|
324
|
+
return new Gt(se(e, this.openMarker), D(e, this.content), se(e, this.closeMarker));
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
|
-
class
|
|
327
|
+
class Ut extends U {
|
|
328
328
|
constructor(e, t, s) {
|
|
329
329
|
super(), this.openMarker = e, this.content = t, this.closeMarker = s;
|
|
330
330
|
}
|
|
@@ -333,10 +333,10 @@ class Yt extends U {
|
|
|
333
333
|
return [this.openMarker, ...this.content, this.closeMarker];
|
|
334
334
|
}
|
|
335
335
|
mapChildren(e) {
|
|
336
|
-
return new
|
|
336
|
+
return new Ut(se(e, this.openMarker), D(e, this.content), se(e, this.closeMarker));
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
class
|
|
339
|
+
class Xt extends U {
|
|
340
340
|
constructor(e) {
|
|
341
341
|
super(), this.content = e;
|
|
342
342
|
}
|
|
@@ -345,10 +345,10 @@ class jt extends U {
|
|
|
345
345
|
return this.content;
|
|
346
346
|
}
|
|
347
347
|
mapChildren(e) {
|
|
348
|
-
return new
|
|
348
|
+
return new Xt(D(e, this.content));
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
|
-
class
|
|
351
|
+
class Yt extends U {
|
|
352
352
|
constructor(e) {
|
|
353
353
|
super(), this.content = e;
|
|
354
354
|
}
|
|
@@ -357,10 +357,10 @@ class Qt extends U {
|
|
|
357
357
|
return this.content;
|
|
358
358
|
}
|
|
359
359
|
mapChildren(e) {
|
|
360
|
-
return new
|
|
360
|
+
return new Yt(D(e, this.content));
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
|
-
class
|
|
363
|
+
class Be extends U {
|
|
364
364
|
constructor(e, t) {
|
|
365
365
|
super(), this.url = e, this.content = t;
|
|
366
366
|
}
|
|
@@ -369,13 +369,13 @@ class Ae extends U {
|
|
|
369
369
|
return this.content;
|
|
370
370
|
}
|
|
371
371
|
mapChildren(e) {
|
|
372
|
-
return new
|
|
372
|
+
return new Be(this.url, D(e, this.content));
|
|
373
373
|
}
|
|
374
374
|
_localEquals(e) {
|
|
375
375
|
return this.url === e.url;
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
|
-
class
|
|
378
|
+
class Ae extends U {
|
|
379
379
|
constructor(e, t, s) {
|
|
380
380
|
super(), this.alt = e, this.url = t, this.content = s;
|
|
381
381
|
}
|
|
@@ -384,13 +384,13 @@ class De extends U {
|
|
|
384
384
|
return this.content;
|
|
385
385
|
}
|
|
386
386
|
mapChildren(e) {
|
|
387
|
-
return new
|
|
387
|
+
return new Ae(this.alt, this.url, D(e, this.content));
|
|
388
388
|
}
|
|
389
389
|
_localEquals(e) {
|
|
390
390
|
return this.alt === e.alt && this.url === e.url;
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
|
-
class
|
|
393
|
+
class ve extends J {
|
|
394
394
|
constructor(e, t, s) {
|
|
395
395
|
super(), this.tokenType = e, this.content = t, this.leadingTrivia = s;
|
|
396
396
|
}
|
|
@@ -436,16 +436,16 @@ class me extends Z {
|
|
|
436
436
|
};
|
|
437
437
|
}
|
|
438
438
|
mapChildren(e) {
|
|
439
|
-
return new
|
|
439
|
+
return new ve(this.tokenType, D(e, this.content), re(e, this.leadingTrivia));
|
|
440
440
|
}
|
|
441
441
|
withLeadingTrivia(e) {
|
|
442
|
-
return new
|
|
442
|
+
return new ve(this.tokenType, this.content, e);
|
|
443
443
|
}
|
|
444
444
|
_localEquals(e) {
|
|
445
445
|
return this.tokenType === e.tokenType;
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
|
-
class
|
|
448
|
+
class fe extends J {
|
|
449
449
|
constructor(e, t, s, i) {
|
|
450
450
|
super(), this.level = e, this.marker = t, this.content = s, this.leadingTrivia = i;
|
|
451
451
|
}
|
|
@@ -454,16 +454,16 @@ class ge extends Z {
|
|
|
454
454
|
return this._withLeading([this.marker, ...this.content]);
|
|
455
455
|
}
|
|
456
456
|
mapChildren(e) {
|
|
457
|
-
return new
|
|
457
|
+
return new fe(this.level, se(e, this.marker), D(e, this.content), re(e, this.leadingTrivia));
|
|
458
458
|
}
|
|
459
459
|
withLeadingTrivia(e) {
|
|
460
|
-
return new
|
|
460
|
+
return new fe(this.level, this.marker, this.content, e);
|
|
461
461
|
}
|
|
462
462
|
_localEquals(e) {
|
|
463
463
|
return this.level === e.level;
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
class
|
|
466
|
+
class ie extends J {
|
|
467
467
|
constructor(e, t) {
|
|
468
468
|
super(), this.content = e, this.leadingTrivia = t;
|
|
469
469
|
}
|
|
@@ -472,13 +472,13 @@ class se extends Z {
|
|
|
472
472
|
return this._withLeading(this.content);
|
|
473
473
|
}
|
|
474
474
|
mapChildren(e) {
|
|
475
|
-
return new
|
|
475
|
+
return new ie(D(e, this.content), re(e, this.leadingTrivia));
|
|
476
476
|
}
|
|
477
477
|
withLeadingTrivia(e) {
|
|
478
|
-
return new
|
|
478
|
+
return new ie(this.content, e);
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
|
-
class Ce extends
|
|
481
|
+
class Ce extends J {
|
|
482
482
|
constructor(e, t) {
|
|
483
483
|
super(), this.content = e, this.leadingTrivia = t;
|
|
484
484
|
}
|
|
@@ -502,7 +502,7 @@ class Ce extends Z {
|
|
|
502
502
|
return new Ce(this.content, e);
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
class
|
|
505
|
+
class Z extends J {
|
|
506
506
|
constructor(e, t, s, i) {
|
|
507
507
|
super(), this.language = e, this.infoString = t, this.content = s, this.leadingTrivia = i;
|
|
508
508
|
}
|
|
@@ -532,10 +532,10 @@ class Q extends Z {
|
|
|
532
532
|
return e;
|
|
533
533
|
}
|
|
534
534
|
mapChildren(e) {
|
|
535
|
-
return new
|
|
535
|
+
return new Z(this.language, this.infoString, D(e, this.content), re(e, this.leadingTrivia));
|
|
536
536
|
}
|
|
537
537
|
withLeadingTrivia(e) {
|
|
538
|
-
return new
|
|
538
|
+
return new Z(this.language, this.infoString, this.content, e);
|
|
539
539
|
}
|
|
540
540
|
_localEquals(e) {
|
|
541
541
|
return this.language === e.language && this.infoString === e.infoString;
|
|
@@ -560,7 +560,7 @@ class Q extends Z {
|
|
|
560
560
|
return { stringEdit: this._contentEdit };
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
|
-
class we extends
|
|
563
|
+
class we extends J {
|
|
564
564
|
constructor(e, t) {
|
|
565
565
|
super(), this.content = e, this.leadingTrivia = t;
|
|
566
566
|
}
|
|
@@ -578,7 +578,7 @@ class we extends Z {
|
|
|
578
578
|
return new we(this.content, e);
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
|
-
class Se extends
|
|
581
|
+
class Se extends J {
|
|
582
582
|
constructor(e, t) {
|
|
583
583
|
super(), this.content = e, this.leadingTrivia = t;
|
|
584
584
|
}
|
|
@@ -587,7 +587,7 @@ class Se extends Z {
|
|
|
587
587
|
return this._withLeading(this.content);
|
|
588
588
|
}
|
|
589
589
|
get blocks() {
|
|
590
|
-
return this.content.filter(
|
|
590
|
+
return this.content.filter(Qt);
|
|
591
591
|
}
|
|
592
592
|
mapChildren(e) {
|
|
593
593
|
return new Se(D(e, this.content), re(e, this.leadingTrivia));
|
|
@@ -596,7 +596,7 @@ class Se extends Z {
|
|
|
596
596
|
return new Se(this.content, e);
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
|
-
class q extends
|
|
599
|
+
class q extends J {
|
|
600
600
|
constructor(e, t, s) {
|
|
601
601
|
super(), this.ordered = e, this.content = t, this.leadingTrivia = s;
|
|
602
602
|
}
|
|
@@ -626,14 +626,14 @@ class G extends U {
|
|
|
626
626
|
return this.leadingTrivia ? [this.leadingTrivia, this.marker, ...this.content] : [this.marker, ...this.content];
|
|
627
627
|
}
|
|
628
628
|
get blocks() {
|
|
629
|
-
return this.content.filter(
|
|
629
|
+
return this.content.filter(Qt);
|
|
630
630
|
}
|
|
631
631
|
mapChildren(e) {
|
|
632
632
|
return new G(
|
|
633
|
-
|
|
633
|
+
se(e, this.marker),
|
|
634
634
|
D(e, this.content),
|
|
635
635
|
this.checked,
|
|
636
|
-
this.leadingTrivia ?
|
|
636
|
+
this.leadingTrivia ? se(e, this.leadingTrivia) : void 0
|
|
637
637
|
);
|
|
638
638
|
}
|
|
639
639
|
withLeadingTrivia(e) {
|
|
@@ -643,7 +643,7 @@ class G extends U {
|
|
|
643
643
|
return this.checked === e.checked;
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
|
-
class Le extends
|
|
646
|
+
class Le extends J {
|
|
647
647
|
constructor(e, t) {
|
|
648
648
|
super(), this.content = e, this.leadingTrivia = t;
|
|
649
649
|
}
|
|
@@ -652,7 +652,7 @@ class Le extends Z {
|
|
|
652
652
|
return this._withLeading(this.content);
|
|
653
653
|
}
|
|
654
654
|
get _rows() {
|
|
655
|
-
return this.content.filter((e) => e instanceof
|
|
655
|
+
return this.content.filter((e) => e instanceof Re);
|
|
656
656
|
}
|
|
657
657
|
get headerRow() {
|
|
658
658
|
return this._rows[0];
|
|
@@ -670,7 +670,7 @@ class Le extends Z {
|
|
|
670
670
|
return new Le(this.content, e);
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
|
-
class
|
|
673
|
+
class Re extends U {
|
|
674
674
|
constructor(e) {
|
|
675
675
|
super(), this.content = e;
|
|
676
676
|
}
|
|
@@ -679,13 +679,13 @@ class Ne extends U {
|
|
|
679
679
|
return this.content;
|
|
680
680
|
}
|
|
681
681
|
get cells() {
|
|
682
|
-
return this.content.filter((e) => e instanceof
|
|
682
|
+
return this.content.filter((e) => e instanceof Ne);
|
|
683
683
|
}
|
|
684
684
|
mapChildren(e) {
|
|
685
|
-
return new
|
|
685
|
+
return new Re(D(e, this.content));
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
|
-
class
|
|
688
|
+
class Ne extends U {
|
|
689
689
|
constructor(e) {
|
|
690
690
|
super(), this.content = e;
|
|
691
691
|
}
|
|
@@ -694,10 +694,10 @@ class Ie extends U {
|
|
|
694
694
|
return this.content;
|
|
695
695
|
}
|
|
696
696
|
mapChildren(e) {
|
|
697
|
-
return new
|
|
697
|
+
return new Ne(D(e, this.content));
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
|
-
class
|
|
700
|
+
class jt extends U {
|
|
701
701
|
constructor(e) {
|
|
702
702
|
super(), this.content = e;
|
|
703
703
|
}
|
|
@@ -706,21 +706,21 @@ class Zt extends U {
|
|
|
706
706
|
return this.content;
|
|
707
707
|
}
|
|
708
708
|
get blocks() {
|
|
709
|
-
return this.content.filter(
|
|
709
|
+
return this.content.filter(Qt);
|
|
710
710
|
}
|
|
711
711
|
mapChildren(e) {
|
|
712
|
-
return new
|
|
712
|
+
return new jt(D(e, this.content));
|
|
713
713
|
}
|
|
714
714
|
}
|
|
715
|
-
function
|
|
716
|
-
return n instanceof
|
|
715
|
+
function Qt(n) {
|
|
716
|
+
return n instanceof fe || n instanceof ie || n instanceof Ce || n instanceof Z || n instanceof we || n instanceof _e || n instanceof Se || n instanceof q || n instanceof Le || n instanceof ve;
|
|
717
717
|
}
|
|
718
|
-
function
|
|
718
|
+
function Y(n, e) {
|
|
719
719
|
if (n.id === e.id)
|
|
720
720
|
return 0;
|
|
721
721
|
let t = 0;
|
|
722
722
|
for (const s of n.children) {
|
|
723
|
-
const i =
|
|
723
|
+
const i = Y(s, e);
|
|
724
724
|
if (i !== void 0)
|
|
725
725
|
return t + i;
|
|
726
726
|
t += s.length;
|
|
@@ -730,16 +730,16 @@ const Hi = /\[[ xX]\]/;
|
|
|
730
730
|
function Wi(n) {
|
|
731
731
|
if (n.checked === void 0)
|
|
732
732
|
return;
|
|
733
|
-
const e = Hi.exec(
|
|
733
|
+
const e = Hi.exec(Ms(n));
|
|
734
734
|
if (e)
|
|
735
735
|
return w.ofStartAndLength(e.index, e[0].length);
|
|
736
736
|
}
|
|
737
|
-
function
|
|
737
|
+
function Ms(n) {
|
|
738
738
|
if (n instanceof at)
|
|
739
739
|
return n.content;
|
|
740
740
|
let e = "";
|
|
741
741
|
for (const t of n.children)
|
|
742
|
-
e +=
|
|
742
|
+
e += Ms(t);
|
|
743
743
|
return e;
|
|
744
744
|
}
|
|
745
745
|
function Ki(n) {
|
|
@@ -759,7 +759,7 @@ const qi = /* @__PURE__ */ new Set([
|
|
|
759
759
|
"setextHeading",
|
|
760
760
|
"definition"
|
|
761
761
|
]);
|
|
762
|
-
function
|
|
762
|
+
function We(n) {
|
|
763
763
|
const e = [];
|
|
764
764
|
for (let t = 0; t < n.length; t++) {
|
|
765
765
|
const s = n[t], i = n[t + 1];
|
|
@@ -789,15 +789,15 @@ function Gi(n, e) {
|
|
|
789
789
|
const s = n.content.map((i, o) => o === t ? i.withLeadingTrivia(e) : i);
|
|
790
790
|
return new q(n.ordered, s, n.leadingTrivia);
|
|
791
791
|
}
|
|
792
|
-
if (n instanceof G || n instanceof
|
|
792
|
+
if (n instanceof G || n instanceof J)
|
|
793
793
|
return n.withLeadingTrivia(e);
|
|
794
794
|
}
|
|
795
|
-
function
|
|
795
|
+
function Ke(n) {
|
|
796
796
|
const e = [];
|
|
797
797
|
for (let t = 0; t < n.length; t++) {
|
|
798
798
|
const s = n[t];
|
|
799
799
|
if (s instanceof W && s.glueKind === void 0) {
|
|
800
|
-
const i = e[e.length - 1], o = n[t + 1], r = i instanceof
|
|
800
|
+
const i = e[e.length - 1], o = n[t + 1], r = i instanceof ie && o instanceof ie, c = new W(s.content, r ? "blockBreak" : "blockGap"), a = i !== void 0 ? Ts(i, c) : void 0;
|
|
801
801
|
a ? e[e.length - 1] = a : e.push(c);
|
|
802
802
|
continue;
|
|
803
803
|
}
|
|
@@ -805,19 +805,19 @@ function ze(n) {
|
|
|
805
805
|
}
|
|
806
806
|
return e;
|
|
807
807
|
}
|
|
808
|
-
function
|
|
808
|
+
function Ts(n, e) {
|
|
809
809
|
switch (n.kind) {
|
|
810
810
|
case "paragraph": {
|
|
811
811
|
const t = n;
|
|
812
|
-
return new
|
|
812
|
+
return new ie([...t.content, e], t.leadingTrivia);
|
|
813
813
|
}
|
|
814
814
|
case "heading": {
|
|
815
815
|
const t = n;
|
|
816
|
-
return new
|
|
816
|
+
return new fe(t.level, t.marker, [...t.content, e], t.leadingTrivia);
|
|
817
817
|
}
|
|
818
818
|
case "codeBlock": {
|
|
819
819
|
const t = n;
|
|
820
|
-
return new
|
|
820
|
+
return new Z(t.language, t.infoString, [...t.content, e], t.leadingTrivia);
|
|
821
821
|
}
|
|
822
822
|
case "frontMatter": {
|
|
823
823
|
const t = n;
|
|
@@ -829,11 +829,11 @@ function Ms(n, e) {
|
|
|
829
829
|
}
|
|
830
830
|
case "thematicBreak": {
|
|
831
831
|
const t = n;
|
|
832
|
-
return new
|
|
832
|
+
return new _e([...t.content, e], t.leadingTrivia);
|
|
833
833
|
}
|
|
834
834
|
case "unhandledBlock": {
|
|
835
835
|
const t = n;
|
|
836
|
-
return new
|
|
836
|
+
return new ve(t.tokenType, [...t.content, e], t.leadingTrivia);
|
|
837
837
|
}
|
|
838
838
|
case "table": {
|
|
839
839
|
const t = n;
|
|
@@ -841,22 +841,22 @@ function Ms(n, e) {
|
|
|
841
841
|
}
|
|
842
842
|
case "blockQuote": {
|
|
843
843
|
const t = n;
|
|
844
|
-
return new Se(
|
|
844
|
+
return new Se(pt(t.content, e), t.leadingTrivia);
|
|
845
845
|
}
|
|
846
846
|
case "list": {
|
|
847
847
|
const t = n;
|
|
848
|
-
return new q(t.ordered,
|
|
848
|
+
return new q(t.ordered, pt(t.content, e), t.leadingTrivia);
|
|
849
849
|
}
|
|
850
850
|
case "listItem": {
|
|
851
851
|
const t = n;
|
|
852
|
-
return new G(t.marker,
|
|
852
|
+
return new G(t.marker, pt(t.content, e), t.checked, t.leadingTrivia);
|
|
853
853
|
}
|
|
854
854
|
default:
|
|
855
855
|
return;
|
|
856
856
|
}
|
|
857
857
|
}
|
|
858
|
-
function
|
|
859
|
-
const t = n[n.length - 1], s = t !== void 0 ?
|
|
858
|
+
function pt(n, e) {
|
|
859
|
+
const t = n[n.length - 1], s = t !== void 0 ? Ts(t, e) : void 0;
|
|
860
860
|
if (s) {
|
|
861
861
|
const i = n.slice();
|
|
862
862
|
return i[i.length - 1] = s, i;
|
|
@@ -864,7 +864,7 @@ function vt(n, e) {
|
|
|
864
864
|
return [...n, e];
|
|
865
865
|
}
|
|
866
866
|
function Ui(n) {
|
|
867
|
-
return n.some((e) => !(e instanceof W)) ? n : [new
|
|
867
|
+
return n.some((e) => !(e instanceof W)) ? n : [new ie(n)];
|
|
868
868
|
}
|
|
869
869
|
class A {
|
|
870
870
|
constructor(e, t) {
|
|
@@ -914,7 +914,7 @@ class Xi {
|
|
|
914
914
|
} else
|
|
915
915
|
this._idx++;
|
|
916
916
|
}
|
|
917
|
-
return new
|
|
917
|
+
return new jt(Ui(Ke(We(e.build(this._source.length)))));
|
|
918
918
|
}
|
|
919
919
|
_tryParseBlock() {
|
|
920
920
|
switch (this._events[this._idx].tokenType) {
|
|
@@ -960,7 +960,7 @@ class Xi {
|
|
|
960
960
|
r.tokenType === t && (s += r.type === "enter" ? 1 : -1), s === 0 && (i = r), this._idx++;
|
|
961
961
|
}
|
|
962
962
|
const o = this._source.substring(e.startOffset, i.endOffset);
|
|
963
|
-
return new
|
|
963
|
+
return new ve(t, [new y("content", o)]);
|
|
964
964
|
}
|
|
965
965
|
/**
|
|
966
966
|
* Decides what to do with an unrecognized `enter` token at the top of a
|
|
@@ -997,7 +997,7 @@ class Xi {
|
|
|
997
997
|
for (const d of o)
|
|
998
998
|
a.add(d.node, d.start);
|
|
999
999
|
const l = a.build(r.endOffset - i);
|
|
1000
|
-
return new
|
|
1000
|
+
return new fe(t, c, l);
|
|
1001
1001
|
}
|
|
1002
1002
|
_parseParagraph() {
|
|
1003
1003
|
const e = this._consume("enter", "paragraph"), t = [];
|
|
@@ -1006,7 +1006,7 @@ class Xi {
|
|
|
1006
1006
|
const s = this._consume("exit", "paragraph"), i = new A(e.startOffset, this._source);
|
|
1007
1007
|
for (const o of t)
|
|
1008
1008
|
i.add(o.node, o.start);
|
|
1009
|
-
return new
|
|
1009
|
+
return new ie(i.build(s.endOffset - e.startOffset));
|
|
1010
1010
|
}
|
|
1011
1011
|
_parseFrontMatter() {
|
|
1012
1012
|
const e = this._consume("enter", "yaml"), t = new A(e.startOffset, this._source);
|
|
@@ -1058,7 +1058,7 @@ class Xi {
|
|
|
1058
1058
|
const l = this._consume("exit", "codeFenced");
|
|
1059
1059
|
c !== void 0 && o.add(new y("content", this._source.substring(c, a)), c);
|
|
1060
1060
|
const d = s === void 0 ? "" : this._source.substring(s, i);
|
|
1061
|
-
return new
|
|
1061
|
+
return new Z(t, d, o.build(l.endOffset - e.startOffset));
|
|
1062
1062
|
}
|
|
1063
1063
|
/**
|
|
1064
1064
|
* An indented code block has no fences and no info string: micromark strips a
|
|
@@ -1084,7 +1084,7 @@ class Xi {
|
|
|
1084
1084
|
}
|
|
1085
1085
|
o();
|
|
1086
1086
|
const r = this._consume("exit", "codeIndented");
|
|
1087
|
-
return new
|
|
1087
|
+
return new Z("", "", t.build(r.endOffset - e.startOffset));
|
|
1088
1088
|
}
|
|
1089
1089
|
_parseMathFlow() {
|
|
1090
1090
|
const e = this._consume("enter", "mathFlow"), t = new A(e.startOffset, this._source);
|
|
@@ -1110,7 +1110,7 @@ class Xi {
|
|
|
1110
1110
|
for (; this._notExit("thematicBreak"); )
|
|
1111
1111
|
this._idx++;
|
|
1112
1112
|
const t = this._consume("exit", "thematicBreak"), s = new y("content", this._source.substring(e.startOffset, t.endOffset));
|
|
1113
|
-
return new
|
|
1113
|
+
return new _e([s]);
|
|
1114
1114
|
}
|
|
1115
1115
|
_parseBlockQuote() {
|
|
1116
1116
|
const e = this._consume("enter", "blockQuote"), t = new A(e.startOffset, this._source);
|
|
@@ -1147,7 +1147,7 @@ class Xi {
|
|
|
1147
1147
|
new y("blockQuoteMarker", this._source.substring(a.startOffset, a.endOffset)),
|
|
1148
1148
|
a.startOffset
|
|
1149
1149
|
);
|
|
1150
|
-
return new Se(
|
|
1150
|
+
return new Se(Ke(We(t.build(r.endOffset - e.startOffset))));
|
|
1151
1151
|
}
|
|
1152
1152
|
_parseList() {
|
|
1153
1153
|
const e = this._events[this._idx].tokenType, t = e === "listOrdered", s = this._consume("enter", e), i = new A(s.startOffset, this._source);
|
|
@@ -1156,7 +1156,7 @@ class Xi {
|
|
|
1156
1156
|
if (o === void 0 || r === void 0 || a === void 0)
|
|
1157
1157
|
return;
|
|
1158
1158
|
const f = new y("listItemMarker", this._source.substring(r, c)), m = d ?? c, g = a.build(m - c);
|
|
1159
|
-
i.add(new G(f,
|
|
1159
|
+
i.add(new G(f, Ke(We(g)), l), o);
|
|
1160
1160
|
};
|
|
1161
1161
|
for (; this._notExit(e); ) {
|
|
1162
1162
|
const f = this._events[this._idx];
|
|
@@ -1177,7 +1177,7 @@ class Xi {
|
|
|
1177
1177
|
}
|
|
1178
1178
|
u();
|
|
1179
1179
|
const h = this._consume("exit", e);
|
|
1180
|
-
return new q(t,
|
|
1180
|
+
return new q(t, Ke(We(i.build(h.endOffset - s.startOffset))));
|
|
1181
1181
|
}
|
|
1182
1182
|
_parseTable() {
|
|
1183
1183
|
const e = this._consume("enter", "table"), t = new A(e.startOffset, this._source);
|
|
@@ -1228,9 +1228,9 @@ class Xi {
|
|
|
1228
1228
|
const a = new A(e, this._source);
|
|
1229
1229
|
for (let l = 0; l < r.length; l++) {
|
|
1230
1230
|
const d = r[l], u = l + 1 < r.length ? r[l + 1] : i.length, h = new A(e + d, this._source), f = i.substring(d, u);
|
|
1231
|
-
l === r.length - 1 && f.length > 1 && f.endsWith("|") ? (h.add(new y("tableDelimiter", f.slice(0, -1)), e + d), h.add(new y("tableDelimiterClose", "|"), e + d + f.length - 1)) : h.add(new y("tableDelimiter", f), e + d), a.add(new
|
|
1231
|
+
l === r.length - 1 && f.length > 1 && f.endsWith("|") ? (h.add(new y("tableDelimiter", f.slice(0, -1)), e + d), h.add(new y("tableDelimiterClose", "|"), e + d + f.length - 1)) : h.add(new y("tableDelimiter", f), e + d), a.add(new Ne(h.build(u - d)), e + d);
|
|
1232
1232
|
}
|
|
1233
|
-
return new
|
|
1233
|
+
return new Re(a.build(t - e));
|
|
1234
1234
|
}
|
|
1235
1235
|
_parseTableRow(e) {
|
|
1236
1236
|
const t = this._consume("enter", "tableRow"), s = new A(t.startOffset, this._source);
|
|
@@ -1250,12 +1250,12 @@ class Xi {
|
|
|
1250
1250
|
const a = this._consume("exit", e), l = new A(r.startOffset, this._source);
|
|
1251
1251
|
for (const d of c)
|
|
1252
1252
|
l.add(d.node, d.start);
|
|
1253
|
-
s.add(new
|
|
1253
|
+
s.add(new Ne(l.build(a.endOffset - r.startOffset, "tableCellGlue")), r.startOffset);
|
|
1254
1254
|
} else
|
|
1255
1255
|
this._idx++;
|
|
1256
1256
|
}
|
|
1257
1257
|
const i = this._consume("exit", "tableRow");
|
|
1258
|
-
return new
|
|
1258
|
+
return new Re(s.build(i.endOffset - t.startOffset));
|
|
1259
1259
|
}
|
|
1260
1260
|
_parseInlines(e, t) {
|
|
1261
1261
|
for (; this._idx < this._events.length; ) {
|
|
@@ -1293,7 +1293,7 @@ class Xi {
|
|
|
1293
1293
|
e.push(this._parseHardBreak());
|
|
1294
1294
|
return;
|
|
1295
1295
|
}
|
|
1296
|
-
t.type === "exit" && (t.tokenType === "data" || t.tokenType === "codeTextData") && e.push({ node: new
|
|
1296
|
+
t.type === "exit" && (t.tokenType === "data" || t.tokenType === "codeTextData") && e.push({ node: new et(this._source.substring(t.startOffset, t.endOffset)), start: t.startOffset }), t.type === "exit" && t.tokenType === "taskListCheckValueChecked" ? this._checkChecked = !0 : t.type === "exit" && t.tokenType === "taskListCheckValueUnchecked" && (this._checkChecked = !1), this._idx++;
|
|
1297
1297
|
}
|
|
1298
1298
|
/**
|
|
1299
1299
|
* A GFM hard line break — either two-or-more trailing spaces
|
|
@@ -1319,13 +1319,13 @@ class Xi {
|
|
|
1319
1319
|
const a = this._consume("enter", t), l = this._consume("exit", t), d = new y("openMarker", this._source.substring(i.startOffset, o.endOffset)), u = new y("closeMarker", this._source.substring(a.startOffset, l.endOffset)), h = new A(o.endOffset, this._source);
|
|
1320
1320
|
for (const g of r)
|
|
1321
1321
|
h.add(g.node, g.start);
|
|
1322
|
-
const f = h.build(a.startOffset - o.endOffset), m = s ? new
|
|
1322
|
+
const f = h.build(a.startOffset - o.endOffset), m = s ? new qt(d, f, u) : new Gt(d, f, u);
|
|
1323
1323
|
e.push({ node: m, start: i.startOffset });
|
|
1324
1324
|
return;
|
|
1325
1325
|
}
|
|
1326
1326
|
this._parseInlineEvent(r);
|
|
1327
1327
|
}
|
|
1328
|
-
e.push({ node: new
|
|
1328
|
+
e.push({ node: new et(this._source.substring(i.startOffset, o.endOffset)), start: i.startOffset });
|
|
1329
1329
|
}
|
|
1330
1330
|
_parseInlineCode() {
|
|
1331
1331
|
const e = this._consume("enter", "codeText"), t = new A(e.startOffset, this._source);
|
|
@@ -1335,7 +1335,7 @@ class Xi {
|
|
|
1335
1335
|
c.type === "enter" && c.tokenType === "codeTextSequence" ? (t.add(new y(s ? "closeMarker" : "openMarker", this._source.substring(c.startOffset, c.endOffset)), c.startOffset), s = !0) : c.type === "enter" && c.tokenType === "codeTextData" && (i === void 0 && (i = c.startOffset), o = c.endOffset), this._idx++;
|
|
1336
1336
|
}
|
|
1337
1337
|
const r = this._consume("exit", "codeText");
|
|
1338
|
-
return i !== void 0 && t.add(new y("content", this._source.substring(i, o)), i), { node: new
|
|
1338
|
+
return i !== void 0 && t.add(new y("content", this._source.substring(i, o)), i), { node: new Xt(t.build(r.endOffset - e.startOffset)), start: e.startOffset };
|
|
1339
1339
|
}
|
|
1340
1340
|
_parseInlineMath() {
|
|
1341
1341
|
const e = this._consume("enter", "mathText"), t = new A(e.startOffset, this._source);
|
|
@@ -1345,7 +1345,7 @@ class Xi {
|
|
|
1345
1345
|
c.type === "enter" && c.tokenType === "mathTextSequence" ? (t.add(new y(s ? "closeMarker" : "openMarker", this._source.substring(c.startOffset, c.endOffset)), c.startOffset), s = !0) : c.type === "enter" && c.tokenType === "mathTextData" && (i === void 0 && (i = c.startOffset), o = c.endOffset), this._idx++;
|
|
1346
1346
|
}
|
|
1347
1347
|
const r = this._consume("exit", "mathText");
|
|
1348
|
-
return i !== void 0 && t.add(new y("content", this._source.substring(i, o)), i), { node: new
|
|
1348
|
+
return i !== void 0 && t.add(new y("content", this._source.substring(i, o)), i), { node: new Yt(t.build(r.endOffset - e.startOffset)), start: e.startOffset };
|
|
1349
1349
|
}
|
|
1350
1350
|
_parseStrikethrough() {
|
|
1351
1351
|
const e = this._consume("enter", "strikethrough");
|
|
@@ -1363,7 +1363,7 @@ class Xi {
|
|
|
1363
1363
|
for (const l of r)
|
|
1364
1364
|
c.add(l.node, l.start);
|
|
1365
1365
|
const a = c.build(o - i);
|
|
1366
|
-
return { node: new
|
|
1366
|
+
return { node: new Ut(t, a, s), start: e.startOffset };
|
|
1367
1367
|
}
|
|
1368
1368
|
_parseLink() {
|
|
1369
1369
|
const e = this._consume("enter", "link"), t = new A(e.startOffset, this._source), s = [];
|
|
@@ -1396,7 +1396,7 @@ class Xi {
|
|
|
1396
1396
|
const r = this._consume("exit", "link");
|
|
1397
1397
|
for (const c of s)
|
|
1398
1398
|
t.add(c.node, c.start);
|
|
1399
|
-
return { node: new
|
|
1399
|
+
return { node: new Be(i, t.build(r.endOffset - e.startOffset)), start: e.startOffset };
|
|
1400
1400
|
}
|
|
1401
1401
|
_parseImage() {
|
|
1402
1402
|
const e = this._consume("enter", "image"), t = new A(e.startOffset, this._source);
|
|
@@ -1421,7 +1421,7 @@ class Xi {
|
|
|
1421
1421
|
this._idx++;
|
|
1422
1422
|
}
|
|
1423
1423
|
const r = this._consume("exit", "image");
|
|
1424
|
-
return { node: new
|
|
1424
|
+
return { node: new Ae(s, i, t.build(r.endOffset - e.startOffset)), start: e.startOffset };
|
|
1425
1425
|
}
|
|
1426
1426
|
_notExit(e) {
|
|
1427
1427
|
if (this._idx >= this._events.length)
|
|
@@ -1436,7 +1436,7 @@ class Xi {
|
|
|
1436
1436
|
return this._idx++, s;
|
|
1437
1437
|
}
|
|
1438
1438
|
}
|
|
1439
|
-
class
|
|
1439
|
+
class Os {
|
|
1440
1440
|
constructor(e) {
|
|
1441
1441
|
this._edit = e;
|
|
1442
1442
|
}
|
|
@@ -1494,10 +1494,10 @@ class Yi {
|
|
|
1494
1494
|
return this._byId.get(`${e}:${t}`);
|
|
1495
1495
|
}
|
|
1496
1496
|
}
|
|
1497
|
-
function
|
|
1497
|
+
function Rs(n, e, t, s, i) {
|
|
1498
1498
|
let o, r = e;
|
|
1499
1499
|
for (const u of n.children) {
|
|
1500
|
-
const h =
|
|
1500
|
+
const h = Rs(u, r, t, s, i);
|
|
1501
1501
|
h !== u && (o ??= /* @__PURE__ */ new Map()).set(u, h), r += u.length;
|
|
1502
1502
|
}
|
|
1503
1503
|
let c = o ? n.mapChildren(o) : n;
|
|
@@ -1508,7 +1508,7 @@ function Os(n, e, t, s, i) {
|
|
|
1508
1508
|
return u;
|
|
1509
1509
|
}
|
|
1510
1510
|
const l = t.getOriginalOffset(e), d = l !== void 0 ? s.lookupId(l, c.kind) : void 0;
|
|
1511
|
-
if (d && d.id !== c.id && (c = c.cloneWithId(d.id)), c instanceof
|
|
1511
|
+
if (d && d.id !== c.id && (c = c.cloneWithId(d.id)), c instanceof Z && d instanceof Z && l !== void 0) {
|
|
1512
1512
|
const u = ji(c, d, l, i);
|
|
1513
1513
|
if (u)
|
|
1514
1514
|
return u;
|
|
@@ -1533,10 +1533,10 @@ function Qi(n, e, t) {
|
|
|
1533
1533
|
return !0;
|
|
1534
1534
|
}
|
|
1535
1535
|
function Zi(n, e) {
|
|
1536
|
-
return new M(n.replacements.map((t) =>
|
|
1536
|
+
return new M(n.replacements.map((t) => le.replace(t.replaceRange.delta(e), t.newText)));
|
|
1537
1537
|
}
|
|
1538
1538
|
function Ji(n, e, t) {
|
|
1539
|
-
return
|
|
1539
|
+
return Rs(n, 0, new Os(t), new Yi(e), t);
|
|
1540
1540
|
}
|
|
1541
1541
|
function eo(n, e, t) {
|
|
1542
1542
|
const s = zi(n);
|
|
@@ -1549,32 +1549,32 @@ class to {
|
|
|
1549
1549
|
}
|
|
1550
1550
|
function no(n, e, t = 0) {
|
|
1551
1551
|
if (n.children.length === 0) {
|
|
1552
|
-
const o =
|
|
1553
|
-
if (n instanceof
|
|
1552
|
+
const o = Ns(e.substring(t, t + n.length));
|
|
1553
|
+
if (n instanceof et)
|
|
1554
1554
|
return o;
|
|
1555
1555
|
const r = n instanceof y ? n.markerKind : n.kind;
|
|
1556
|
-
return `<${r}${
|
|
1556
|
+
return `<${r}${hn(n)}>${o}</${r}>`;
|
|
1557
1557
|
}
|
|
1558
1558
|
let s = "", i = t;
|
|
1559
1559
|
for (const o of n.children)
|
|
1560
1560
|
s += no(o, e, i), i += o.length;
|
|
1561
|
-
return `<${n.kind}${
|
|
1561
|
+
return `<${n.kind}${hn(n)}>${s}</${n.kind}>`;
|
|
1562
1562
|
}
|
|
1563
|
-
function
|
|
1563
|
+
function hn(n) {
|
|
1564
1564
|
const e = {};
|
|
1565
|
-
return n instanceof
|
|
1565
|
+
return n instanceof fe ? e.level = String(n.level) : n instanceof q ? e.ordered = String(n.ordered) : n instanceof Z ? n.language && (e.language = n.language) : n instanceof Be ? e.url = n.url : n instanceof Ae ? (e.alt = n.alt, e.url = n.url) : n instanceof G ? n.checked !== void 0 && (e.checked = String(n.checked)) : n instanceof ve ? e.token = n.tokenType : n instanceof W && n.glueKind && (e.kind = n.glueKind), Object.entries(e).map(([t, s]) => ` ${t}="${Ns(s)}"`).join("");
|
|
1566
1566
|
}
|
|
1567
|
-
function
|
|
1567
|
+
function Ns(n) {
|
|
1568
1568
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1569
1569
|
}
|
|
1570
1570
|
function so(n) {
|
|
1571
|
-
return n instanceof
|
|
1571
|
+
return n instanceof et ? `text ${JSON.stringify(n.content)}` : n instanceof W ? `glue${n.glueKind ? `(${n.glueKind})` : ""} ${JSON.stringify(n.content)}` : n instanceof y ? `marker(${n.markerKind}) ${JSON.stringify(n.content)}` : n instanceof _e ? `thematicBreak ${JSON.stringify(n.content)}` : n instanceof fe ? `heading(level=${n.level})` : n instanceof q ? `list(ordered=${n.ordered})` : n instanceof G ? n.checked === void 0 ? "listItem" : `listItem(checked=${n.checked})` : n instanceof Z ? `codeBlock(language=${JSON.stringify(n.language)})` : n instanceof we ? "mathBlock" : n instanceof Be ? `link(url=${JSON.stringify(n.url)})` : n instanceof Ae ? `image(alt=${JSON.stringify(n.alt)}, url=${JSON.stringify(n.url)})` : n.kind;
|
|
1572
1572
|
}
|
|
1573
|
-
const
|
|
1573
|
+
const un = /* @__PURE__ */ new WeakMap();
|
|
1574
1574
|
let io = 0;
|
|
1575
1575
|
function oo(n) {
|
|
1576
|
-
let e =
|
|
1577
|
-
return e === void 0 && (e = io++,
|
|
1576
|
+
let e = un.get(n);
|
|
1577
|
+
return e === void 0 && (e = io++, un.set(n, e)), e;
|
|
1578
1578
|
}
|
|
1579
1579
|
function Pl(n, e) {
|
|
1580
1580
|
let t = 0;
|
|
@@ -1597,23 +1597,23 @@ function ro(n) {
|
|
|
1597
1597
|
}
|
|
1598
1598
|
return t;
|
|
1599
1599
|
}
|
|
1600
|
-
const co = {},
|
|
1601
|
-
let
|
|
1600
|
+
const co = {}, Is = C(co, !1), ao = Is;
|
|
1601
|
+
let Tt, _t;
|
|
1602
1602
|
function lo() {
|
|
1603
|
-
return
|
|
1604
|
-
|
|
1603
|
+
return _t || (_t = Di({ useWasm: !1 }).then((n) => {
|
|
1604
|
+
Tt = n, Is.set(!0, void 0);
|
|
1605
1605
|
}).catch(() => {
|
|
1606
|
-
})),
|
|
1606
|
+
})), _t;
|
|
1607
1607
|
}
|
|
1608
1608
|
lo();
|
|
1609
1609
|
function ho(n, e) {
|
|
1610
|
-
if (!
|
|
1610
|
+
if (!Tt)
|
|
1611
1611
|
throw new Error("Diff computer not loaded yet — await ensureDiffComputer() / observe diffComputerReady first.");
|
|
1612
|
-
const t =
|
|
1612
|
+
const t = Tt.computeDiff(n, e, { extendToSubwords: !0 });
|
|
1613
1613
|
return uo(t.edits.stripData());
|
|
1614
1614
|
}
|
|
1615
1615
|
function uo(n) {
|
|
1616
|
-
return new M(n.replacements.map((e) =>
|
|
1616
|
+
return new M(n.replacements.map((e) => le.replace(new w(e.range.start, e.range.endExclusive), e.newText)));
|
|
1617
1617
|
}
|
|
1618
1618
|
const fo = /* @__PURE__ */ new Set([
|
|
1619
1619
|
"document",
|
|
@@ -1623,16 +1623,16 @@ const fo = /* @__PURE__ */ new Set([
|
|
|
1623
1623
|
"tableRow"
|
|
1624
1624
|
]), mo = /* @__PURE__ */ new Set(["glue", "marker"]);
|
|
1625
1625
|
function go(n, e, t) {
|
|
1626
|
-
const s = new
|
|
1627
|
-
return
|
|
1626
|
+
const s = new Os(t), i = ro(t);
|
|
1627
|
+
return Ps(n, 0, e, 0, s, i);
|
|
1628
1628
|
}
|
|
1629
|
-
function
|
|
1630
|
-
const r =
|
|
1629
|
+
function Ps(n, e, t, s, i, o) {
|
|
1630
|
+
const r = fn(n, e), c = fn(t, s), a = [];
|
|
1631
1631
|
let l = 0;
|
|
1632
1632
|
for (const d of c) {
|
|
1633
1633
|
const u = w.ofStartAndLength(d.start, d.node.length), h = i.getOriginalOffset(d.start);
|
|
1634
1634
|
for (; l < r.length && h !== void 0 && r[l].start + r[l].node.length <= h; )
|
|
1635
|
-
a.push(
|
|
1635
|
+
a.push(mn(r[l], o)), l++;
|
|
1636
1636
|
const f = l < r.length ? r[l] : void 0, m = f ? w.ofStartAndLength(f.start, f.node.length) : void 0, g = i.getOriginalRange(u);
|
|
1637
1637
|
g && m && g.equals(m) ? (a.push({ kind: "unchanged", node: d.node, modifiedStart: d.start }), l++) : f && m && f.node.kind === d.node.kind && h !== void 0 && m.contains(h) ? (l++, fo.has(d.node.kind) ? a.push({
|
|
1638
1638
|
kind: "nested",
|
|
@@ -1640,7 +1640,7 @@ function Is(n, e, t, s, i, o) {
|
|
|
1640
1640
|
originalStart: f.start,
|
|
1641
1641
|
modified: d.node,
|
|
1642
1642
|
modifiedStart: d.start,
|
|
1643
|
-
children:
|
|
1643
|
+
children: Ps(f.node, f.start, d.node, d.start, i, o)
|
|
1644
1644
|
}) : a.push({
|
|
1645
1645
|
kind: "replaced",
|
|
1646
1646
|
original: f.node,
|
|
@@ -1652,10 +1652,10 @@ function Is(n, e, t, s, i, o) {
|
|
|
1652
1652
|
})) : a.push(po(d, o));
|
|
1653
1653
|
}
|
|
1654
1654
|
for (; l < r.length; )
|
|
1655
|
-
a.push(
|
|
1655
|
+
a.push(mn(r[l], o)), l++;
|
|
1656
1656
|
return a;
|
|
1657
1657
|
}
|
|
1658
|
-
function
|
|
1658
|
+
function fn(n, e) {
|
|
1659
1659
|
const t = [];
|
|
1660
1660
|
let s = e;
|
|
1661
1661
|
for (const i of n.children)
|
|
@@ -1667,7 +1667,7 @@ function po(n, e) {
|
|
|
1667
1667
|
let s = tt(t, n.start, e, "modified", "inserted");
|
|
1668
1668
|
return s.length === 0 && (s = [{ range: w.ofLength(n.node.length), kind: "inserted" }]), { kind: "added", node: n.node, modifiedStart: n.start, insertedLocal: s };
|
|
1669
1669
|
}
|
|
1670
|
-
function
|
|
1670
|
+
function mn(n, e) {
|
|
1671
1671
|
const t = w.ofStartAndLength(n.start, n.node.length);
|
|
1672
1672
|
let s = tt(t, n.start, e, "original", "deleted");
|
|
1673
1673
|
return s.length === 0 && (s = [{ range: w.ofLength(n.node.length), kind: "deleted" }]), { kind: "removed", node: n.node, originalStart: n.start, deletedLocal: s };
|
|
@@ -1693,7 +1693,7 @@ class Bl {
|
|
|
1693
1693
|
* source text (see {@link document}).
|
|
1694
1694
|
*/
|
|
1695
1695
|
_pendingEdit;
|
|
1696
|
-
sourceText = C(this, new
|
|
1696
|
+
sourceText = C(this, new dn(""));
|
|
1697
1697
|
wordNavigationConfig = C(this, Ei);
|
|
1698
1698
|
/**
|
|
1699
1699
|
* Read-only mode. When `true`, the editor never reveals a block's source
|
|
@@ -1786,7 +1786,7 @@ class Bl {
|
|
|
1786
1786
|
activeBlock = P(this, (e) => {
|
|
1787
1787
|
const t = e.readObservable(this.document), s = e.readObservable(this.cursorOffset);
|
|
1788
1788
|
if (s !== void 0)
|
|
1789
|
-
return
|
|
1789
|
+
return Bs(t, s);
|
|
1790
1790
|
});
|
|
1791
1791
|
/**
|
|
1792
1792
|
* All blocks whose source range intersects the current selection.
|
|
@@ -1805,7 +1805,7 @@ class Bl {
|
|
|
1805
1805
|
if (t !== void 0)
|
|
1806
1806
|
return new Set(t);
|
|
1807
1807
|
const s = e.readObservable(this.document), i = e.readObservable(this.selection);
|
|
1808
|
-
return i === void 0 ? /* @__PURE__ */ new Set() : new Set(
|
|
1808
|
+
return i === void 0 ? /* @__PURE__ */ new Set() : new Set(Ot(s, i.range.start, i.range.endExclusive));
|
|
1809
1809
|
});
|
|
1810
1810
|
/**
|
|
1811
1811
|
* The baseline document to diff against. When set, the editor renders in
|
|
@@ -1862,12 +1862,12 @@ class Bl {
|
|
|
1862
1862
|
* applied — the blank line exists only in the view until it is materialized.
|
|
1863
1863
|
*/
|
|
1864
1864
|
armPendingParagraph(e) {
|
|
1865
|
-
|
|
1865
|
+
ne((t) => {
|
|
1866
1866
|
this.pendingParagraph.set({
|
|
1867
1867
|
...e,
|
|
1868
1868
|
text: "",
|
|
1869
1869
|
cursorLine: new Fi(e.replaceRange.start, e.replaceRange.endExclusive),
|
|
1870
|
-
syntheticAst: new
|
|
1870
|
+
syntheticAst: new ie([])
|
|
1871
1871
|
}, t), this.selectionSource.set("user", t), this.selection.set(k.collapsed(e.replaceRange.start), t);
|
|
1872
1872
|
});
|
|
1873
1873
|
}
|
|
@@ -1881,11 +1881,11 @@ class Bl {
|
|
|
1881
1881
|
* state anchored to the previous parse.
|
|
1882
1882
|
*/
|
|
1883
1883
|
replaceSourceText(e) {
|
|
1884
|
-
const t = this.sourceText.get(), s =
|
|
1885
|
-
|
|
1886
|
-
|
|
1884
|
+
const t = this.sourceText.get(), s = Cs(t.value, e.value), i = this.selection.get(), o = i ? new k(
|
|
1885
|
+
ze(s.mapOffset(ze(i.anchor, t.value.length)), e.value.length),
|
|
1886
|
+
ze(s.mapOffset(ze(i.active, t.value.length)), e.value.length)
|
|
1887
1887
|
) : void 0;
|
|
1888
|
-
s.isEmpty || (this._pendingEdit = { baseText: t.value, newText: e.value, edit: s }),
|
|
1888
|
+
s.isEmpty || (this._pendingEdit = { baseText: t.value, newText: e.value, edit: s }), ne((r) => {
|
|
1889
1889
|
this.pendingParagraph.set(void 0, r), s.isEmpty || this.sourceText.set(e, r), o !== i && this.selection.set(o, r);
|
|
1890
1890
|
});
|
|
1891
1891
|
}
|
|
@@ -1920,7 +1920,7 @@ class Bl {
|
|
|
1920
1920
|
setTaskCheckboxChecked(e, t) {
|
|
1921
1921
|
if (e.checked === t)
|
|
1922
1922
|
return;
|
|
1923
|
-
const s =
|
|
1923
|
+
const s = Y(this.document.get(), e), i = Wi(e);
|
|
1924
1924
|
if (s === void 0 || i === void 0)
|
|
1925
1925
|
return;
|
|
1926
1926
|
const o = M.replace(i.delta(s), t ? "[x]" : "[ ]");
|
|
@@ -1939,10 +1939,10 @@ class Bl {
|
|
|
1939
1939
|
this._applySourceEdit(e, k.collapsed(s));
|
|
1940
1940
|
}
|
|
1941
1941
|
_applySourceEdit(e, t) {
|
|
1942
|
-
const s = this.sourceText.get(), i = new
|
|
1942
|
+
const s = this.sourceText.get(), i = new dn(e.apply(s.value));
|
|
1943
1943
|
this._pendingEdit = { baseText: s.value, newText: i.value, edit: e };
|
|
1944
1944
|
const o = this._identifySourceEdit(s, i);
|
|
1945
|
-
|
|
1945
|
+
ne((r) => {
|
|
1946
1946
|
this._emitWillApplySourceEdit({ ...o, edit: e, transaction: r }), this.pendingParagraph.set(void 0, r), this.sourceText.set(i, r), this.selectionSource.set("user", r), this.selection.set(t, r);
|
|
1947
1947
|
});
|
|
1948
1948
|
}
|
|
@@ -1957,10 +1957,10 @@ class Bl {
|
|
|
1957
1957
|
t(e);
|
|
1958
1958
|
}
|
|
1959
1959
|
}
|
|
1960
|
-
function
|
|
1960
|
+
function ze(n, e) {
|
|
1961
1961
|
return Math.max(0, Math.min(n, e));
|
|
1962
1962
|
}
|
|
1963
|
-
function
|
|
1963
|
+
function Bs(n, e) {
|
|
1964
1964
|
const t = new Set(n.blocks);
|
|
1965
1965
|
let s = 0, i;
|
|
1966
1966
|
for (const o of n.children) {
|
|
@@ -1974,9 +1974,9 @@ function Ps(n, e) {
|
|
|
1974
1974
|
}
|
|
1975
1975
|
return i;
|
|
1976
1976
|
}
|
|
1977
|
-
function
|
|
1977
|
+
function Ot(n, e, t) {
|
|
1978
1978
|
if (e === t) {
|
|
1979
|
-
const r =
|
|
1979
|
+
const r = Bs(n, e);
|
|
1980
1980
|
return r ? [r] : [];
|
|
1981
1981
|
}
|
|
1982
1982
|
const s = [], i = new Set(n.blocks);
|
|
@@ -1987,11 +1987,11 @@ function Nt(n, e, t) {
|
|
|
1987
1987
|
}
|
|
1988
1988
|
return s;
|
|
1989
1989
|
}
|
|
1990
|
-
class
|
|
1990
|
+
class De {
|
|
1991
1991
|
constructor(e) {
|
|
1992
1992
|
this.lines = e, this.sourceLines = e.filter((t) => !t.virtualCursorLine);
|
|
1993
1993
|
}
|
|
1994
|
-
static EMPTY = new
|
|
1994
|
+
static EMPTY = new De([]);
|
|
1995
1995
|
static measure(e, t, s = t.capture()) {
|
|
1996
1996
|
return bo(e, t, s);
|
|
1997
1997
|
}
|
|
@@ -2124,7 +2124,7 @@ class lt {
|
|
|
2124
2124
|
static virtual(e, t) {
|
|
2125
2125
|
return new lt(
|
|
2126
2126
|
t,
|
|
2127
|
-
[
|
|
2127
|
+
[pe.visualLineAnchor(e.sourceOffsetBefore, t.withZeroWidthAt(t.left))],
|
|
2128
2128
|
e
|
|
2129
2129
|
);
|
|
2130
2130
|
}
|
|
@@ -2223,12 +2223,12 @@ class lt {
|
|
|
2223
2223
|
return t.offsetAtX(i);
|
|
2224
2224
|
}
|
|
2225
2225
|
}
|
|
2226
|
-
class
|
|
2226
|
+
class pe {
|
|
2227
2227
|
constructor(e, t, s, i = !1) {
|
|
2228
2228
|
this.sourceRange = e, this.rect = t, this.source = s, this.isVisualLineAnchor = i;
|
|
2229
2229
|
}
|
|
2230
2230
|
static visualLineAnchor(e, t) {
|
|
2231
|
-
return new
|
|
2231
|
+
return new pe(w.emptyAt(e), t, void 0, !0);
|
|
2232
2232
|
}
|
|
2233
2233
|
get sourceStart() {
|
|
2234
2234
|
return this.sourceRange.start;
|
|
@@ -2307,25 +2307,25 @@ function bo(n, e, t) {
|
|
|
2307
2307
|
return;
|
|
2308
2308
|
const v = ko(Array.from(p, (b) => t.toLocalRect(b))), E = xo(g.parentElement);
|
|
2309
2309
|
if (f.sourceLength === 0) {
|
|
2310
|
-
s.push(
|
|
2310
|
+
s.push(pe.visualLineAnchor(
|
|
2311
2311
|
m,
|
|
2312
|
-
|
|
2312
|
+
vt(v[0], E)
|
|
2313
2313
|
));
|
|
2314
2314
|
return;
|
|
2315
2315
|
}
|
|
2316
2316
|
if (v.length === 1)
|
|
2317
|
-
s.push(new
|
|
2317
|
+
s.push(new pe(
|
|
2318
2318
|
w.fromTo(m, m + g.length),
|
|
2319
|
-
|
|
2319
|
+
vt(v[0], E),
|
|
2320
2320
|
{ textNode: g, textNodeStart: 0, coordinateSpace: e }
|
|
2321
2321
|
));
|
|
2322
2322
|
else {
|
|
2323
2323
|
const b = yo(g, v, t);
|
|
2324
2324
|
for (let x = 0; x < v.length; x++) {
|
|
2325
2325
|
const T = x === 0 ? 0 : b[x - 1], V = x < b.length ? b[x] : g.length;
|
|
2326
|
-
s.push(new
|
|
2326
|
+
s.push(new pe(
|
|
2327
2327
|
w.fromTo(m + T, m + V),
|
|
2328
|
-
|
|
2328
|
+
vt(v[x], E),
|
|
2329
2329
|
{ textNode: g, textNodeStart: T, coordinateSpace: e }
|
|
2330
2330
|
));
|
|
2331
2331
|
}
|
|
@@ -2343,18 +2343,18 @@ function bo(n, e, t) {
|
|
|
2343
2343
|
};
|
|
2344
2344
|
for (const u of s) {
|
|
2345
2345
|
const h = u.rect;
|
|
2346
|
-
o.length > 0 &&
|
|
2346
|
+
o.length > 0 && As(
|
|
2347
2347
|
S.fromPointSize(a, r, l - a, c),
|
|
2348
2348
|
h
|
|
2349
2349
|
) ? (o.push(u), c = Math.max(c, h.y + h.height - r), a = Math.min(a, h.left), l = Math.max(l, h.right)) : (d(), o = [u], r = h.y, c = h.height, a = h.left, l = h.right);
|
|
2350
2350
|
}
|
|
2351
|
-
return d(), new
|
|
2351
|
+
return d(), new De(i);
|
|
2352
2352
|
}
|
|
2353
2353
|
function ko(n) {
|
|
2354
2354
|
const e = [];
|
|
2355
2355
|
for (const t of n) {
|
|
2356
2356
|
const s = e[e.length - 1];
|
|
2357
|
-
if (!s || !
|
|
2357
|
+
if (!s || !As(s, t)) {
|
|
2358
2358
|
e.push(t);
|
|
2359
2359
|
continue;
|
|
2360
2360
|
}
|
|
@@ -2367,7 +2367,7 @@ function ko(n) {
|
|
|
2367
2367
|
}
|
|
2368
2368
|
return e;
|
|
2369
2369
|
}
|
|
2370
|
-
function
|
|
2370
|
+
function As(n, e) {
|
|
2371
2371
|
return Math.min(n.bottom, e.bottom) - Math.max(n.top, e.top) > Math.min(n.height, e.height) / 2;
|
|
2372
2372
|
}
|
|
2373
2373
|
function yo(n, e, t) {
|
|
@@ -2390,7 +2390,7 @@ function xo(n) {
|
|
|
2390
2390
|
let t = parseFloat(e.lineHeight);
|
|
2391
2391
|
return isFinite(t) || (t = parseFloat(e.fontSize) * 1.2), t;
|
|
2392
2392
|
}
|
|
2393
|
-
function
|
|
2393
|
+
function vt(n, e) {
|
|
2394
2394
|
if (e <= n.height)
|
|
2395
2395
|
return S.fromPointSize(n.x, n.y, n.width, n.height);
|
|
2396
2396
|
const t = (e - n.height) / 2;
|
|
@@ -2404,7 +2404,7 @@ function Eo(n, e, t, s) {
|
|
|
2404
2404
|
if (o.width === 0 && o.height === 0)
|
|
2405
2405
|
return;
|
|
2406
2406
|
const r = s.toLocalRect(o);
|
|
2407
|
-
n.push(new
|
|
2407
|
+
n.push(new pe(
|
|
2408
2408
|
w.fromTo(t, t + e.sourceLength),
|
|
2409
2409
|
S.fromPointSize(r.x, r.y, r.width, r.height)
|
|
2410
2410
|
));
|
|
@@ -2428,22 +2428,22 @@ class Co {
|
|
|
2428
2428
|
...r.visualLineMap?.lines ?? [],
|
|
2429
2429
|
...i.get(r.block) ?? []
|
|
2430
2430
|
]);
|
|
2431
|
-
return new
|
|
2431
|
+
return new De(o);
|
|
2432
2432
|
});
|
|
2433
2433
|
setMeasurements(e, t) {
|
|
2434
|
-
|
|
2434
|
+
ne((s) => {
|
|
2435
2435
|
this._measurements.set(e, s), this._virtualLines.set(t, s);
|
|
2436
2436
|
});
|
|
2437
2437
|
}
|
|
2438
2438
|
}
|
|
2439
|
-
const
|
|
2439
|
+
const gn = /* @__PURE__ */ new WeakMap(), So = 64;
|
|
2440
2440
|
function Me(n, e, t, s) {
|
|
2441
2441
|
const i = s === "right" ? t + 1 : t - 1;
|
|
2442
2442
|
return ce(n, e, t, i, s);
|
|
2443
2443
|
}
|
|
2444
2444
|
function ce(n, e, t, s, i, o = !0) {
|
|
2445
2445
|
s = Math.min(Math.max(s, 0), n.length);
|
|
2446
|
-
const r =
|
|
2446
|
+
const r = Ds(n, e, t);
|
|
2447
2447
|
if (i === "right")
|
|
2448
2448
|
for (let c = To(r, s); c < r.length; c++) {
|
|
2449
2449
|
const a = r[c];
|
|
@@ -2460,7 +2460,7 @@ function ce(n, e, t, s, i, o = !0) {
|
|
|
2460
2460
|
}
|
|
2461
2461
|
return s;
|
|
2462
2462
|
}
|
|
2463
|
-
function
|
|
2463
|
+
function Ds(n, e, t) {
|
|
2464
2464
|
const s = Lo(n), i = Mo(s, e, t), o = s.rangesByVisibilityKey.get(i);
|
|
2465
2465
|
if (o)
|
|
2466
2466
|
return s.rangesByVisibilityKey.delete(i), s.rangesByVisibilityKey.set(i, o), o;
|
|
@@ -2471,13 +2471,13 @@ function As(n, e, t) {
|
|
|
2471
2471
|
else if (c.block.kind === "list")
|
|
2472
2472
|
for (const a of Ro(
|
|
2473
2473
|
c.block,
|
|
2474
|
-
|
|
2474
|
+
Zt(c.block, t - c.start)
|
|
2475
2475
|
))
|
|
2476
2476
|
r.push(a.delta(c.start));
|
|
2477
2477
|
return s.rangesByVisibilityKey.set(i, r), s.rangesByVisibilityKey.size > So && s.rangesByVisibilityKey.delete(s.rangesByVisibilityKey.keys().next().value), r;
|
|
2478
2478
|
}
|
|
2479
2479
|
function Lo(n) {
|
|
2480
|
-
let e =
|
|
2480
|
+
let e = gn.get(n);
|
|
2481
2481
|
if (e)
|
|
2482
2482
|
return e;
|
|
2483
2483
|
const t = new Set(n.blocks), s = [], i = /* @__PURE__ */ new Map();
|
|
@@ -2494,7 +2494,7 @@ function Lo(n) {
|
|
|
2494
2494
|
}
|
|
2495
2495
|
o += r.length;
|
|
2496
2496
|
}
|
|
2497
|
-
return e = { entries: s, entryByBlock: i, rangesByVisibilityKey: /* @__PURE__ */ new Map() },
|
|
2497
|
+
return e = { entries: s, entryByBlock: i, rangesByVisibilityKey: /* @__PURE__ */ new Map() }, gn.set(n, e), e;
|
|
2498
2498
|
}
|
|
2499
2499
|
function Mo(n, e, t) {
|
|
2500
2500
|
const s = [];
|
|
@@ -2502,7 +2502,7 @@ function Mo(n, e, t) {
|
|
|
2502
2502
|
const o = n.entryByBlock.get(i);
|
|
2503
2503
|
if (!o)
|
|
2504
2504
|
continue;
|
|
2505
|
-
const r = i.kind === "list" ?
|
|
2505
|
+
const r = i.kind === "list" ? Zt(i, t - o.start) ?? "" : "";
|
|
2506
2506
|
s.push(`${o.index}:${r}`);
|
|
2507
2507
|
}
|
|
2508
2508
|
return s.sort(), s.join(",");
|
|
@@ -2523,7 +2523,7 @@ function Oo(n, e) {
|
|
|
2523
2523
|
}
|
|
2524
2524
|
return t - 1;
|
|
2525
2525
|
}
|
|
2526
|
-
function
|
|
2526
|
+
function Zt(n, e) {
|
|
2527
2527
|
let t = 0, s;
|
|
2528
2528
|
for (let i = 0; i < n.children.length; i++) {
|
|
2529
2529
|
const o = n.children[i], r = t + o.length, c = n.items.indexOf(o);
|
|
@@ -2543,7 +2543,7 @@ function Ro(n, e) {
|
|
|
2543
2543
|
const o = n.items.indexOf(i);
|
|
2544
2544
|
if (o >= 0 && o !== e) {
|
|
2545
2545
|
const r = n.items[o];
|
|
2546
|
-
|
|
2546
|
+
Jt(r, s, t);
|
|
2547
2547
|
}
|
|
2548
2548
|
s += i.length;
|
|
2549
2549
|
}
|
|
@@ -2551,9 +2551,9 @@ function Ro(n, e) {
|
|
|
2551
2551
|
}
|
|
2552
2552
|
function No(n) {
|
|
2553
2553
|
const e = [];
|
|
2554
|
-
return
|
|
2554
|
+
return Jt(n, 0, e), e.sort((t, s) => t.start - s.start), e;
|
|
2555
2555
|
}
|
|
2556
|
-
function
|
|
2556
|
+
function Jt(n, e, t) {
|
|
2557
2557
|
if (n.children.length === 0) {
|
|
2558
2558
|
n instanceof y && t.push(w.ofStartAndLength(e, n.length));
|
|
2559
2559
|
return;
|
|
@@ -2585,24 +2585,24 @@ function en(n, e, t) {
|
|
|
2585
2585
|
}
|
|
2586
2586
|
let s = e;
|
|
2587
2587
|
for (const i of n.children)
|
|
2588
|
-
|
|
2588
|
+
Jt(i, s, t), s += i.length;
|
|
2589
2589
|
}
|
|
2590
|
-
const Io = (n) => n.cursorPosition.kind === "virtual" ?
|
|
2590
|
+
const Io = (n) => n.cursorPosition.kind === "virtual" ? dt(n, n.cursorPosition.line, "after", "right") : n.selection.isCollapsed ? N.source(Me(
|
|
2591
2591
|
n.document,
|
|
2592
2592
|
n.markerVisibleBlocks,
|
|
2593
2593
|
n.selection.active,
|
|
2594
2594
|
"right"
|
|
2595
|
-
)) : N.source(n.selection.range.endExclusive), Po = (n) => n.cursorPosition.kind === "virtual" ?
|
|
2595
|
+
)) : N.source(n.selection.range.endExclusive), Po = (n) => n.cursorPosition.kind === "virtual" ? dt(n, n.cursorPosition.line, "before", "left") : n.selection.isCollapsed ? N.source(Me(
|
|
2596
2596
|
n.document,
|
|
2597
2597
|
n.markerVisibleBlocks,
|
|
2598
2598
|
n.selection.active,
|
|
2599
2599
|
"left"
|
|
2600
|
-
)) : N.source(n.selection.range.start), Bo = (n) => n.cursorPosition.kind === "virtual" ?
|
|
2600
|
+
)) : N.source(n.selection.range.start), Bo = (n) => n.cursorPosition.kind === "virtual" ? dt(n, n.cursorPosition.line, "after", "right") : N.source(Me(
|
|
2601
2601
|
n.document,
|
|
2602
2602
|
n.markerVisibleBlocks,
|
|
2603
2603
|
n.selection.active,
|
|
2604
2604
|
"right"
|
|
2605
|
-
)), Ao = (n) => n.cursorPosition.kind === "virtual" ?
|
|
2605
|
+
)), Ao = (n) => n.cursorPosition.kind === "virtual" ? dt(n, n.cursorPosition.line, "before", "left") : N.source(Me(
|
|
2606
2606
|
n.document,
|
|
2607
2607
|
n.markerVisibleBlocks,
|
|
2608
2608
|
n.selection.active,
|
|
@@ -2627,14 +2627,14 @@ const Io = (n) => n.cursorPosition.kind === "virtual" ? ht(n, n.cursorPosition.l
|
|
|
2627
2627
|
"left",
|
|
2628
2628
|
!1
|
|
2629
2629
|
));
|
|
2630
|
-
},
|
|
2630
|
+
}, Rt = (n) => n.cursorPosition.kind === "virtual" ? n.cursorPosition : N.source(ce(
|
|
2631
2631
|
n.document,
|
|
2632
2632
|
n.markerVisibleBlocks,
|
|
2633
2633
|
n.selection.active,
|
|
2634
2634
|
n.selection.active === 0 ? 0 : n.text.lastIndexOf(`
|
|
2635
2635
|
`, n.selection.active - 1) + 1,
|
|
2636
2636
|
"right"
|
|
2637
|
-
)),
|
|
2637
|
+
)), Nt = (n) => {
|
|
2638
2638
|
if (n.cursorPosition.kind === "virtual")
|
|
2639
2639
|
return n.cursorPosition;
|
|
2640
2640
|
const e = n.text.indexOf(`
|
|
@@ -2663,10 +2663,10 @@ const Io = (n) => n.cursorPosition.kind === "virtual" ? ht(n, n.cursorPosition.l
|
|
|
2663
2663
|
return { position: n.cursorPosition, desiredColumn: void 0 };
|
|
2664
2664
|
const e = n.lineMap.lineIndexOfPosition(n.cursorPosition);
|
|
2665
2665
|
if (e === void 0)
|
|
2666
|
-
return { position:
|
|
2666
|
+
return { position: Rt(n), desiredColumn: void 0 };
|
|
2667
2667
|
const t = n.lineMap.lineStartOffset(e), s = n.lineMap.lineEndOffset(e);
|
|
2668
2668
|
if (t === void 0 || s === void 0)
|
|
2669
|
-
return { position:
|
|
2669
|
+
return { position: Rt(n), desiredColumn: void 0 };
|
|
2670
2670
|
const i = t === 0 ? 0 : n.text.lastIndexOf(`
|
|
2671
2671
|
`, t - 1) + 1;
|
|
2672
2672
|
let o = t;
|
|
@@ -2691,9 +2691,9 @@ const Io = (n) => n.cursorPosition.kind === "virtual" ? ht(n, n.cursorPosition.l
|
|
|
2691
2691
|
return { position: n.cursorPosition, desiredColumn: void 0 };
|
|
2692
2692
|
const e = n.lineMap.lineIndexOfPosition(n.cursorPosition);
|
|
2693
2693
|
if (e === void 0)
|
|
2694
|
-
return { position:
|
|
2694
|
+
return { position: Nt(n), desiredColumn: void 0 };
|
|
2695
2695
|
const t = n.lineMap.lineEndOffset(e);
|
|
2696
|
-
return t === void 0 ? { position:
|
|
2696
|
+
return t === void 0 ? { position: Nt(n), desiredColumn: void 0 } : {
|
|
2697
2697
|
position: N.source(ce(
|
|
2698
2698
|
n.document,
|
|
2699
2699
|
n.markerVisibleBlocks,
|
|
@@ -2709,16 +2709,16 @@ const Io = (n) => n.cursorPosition.kind === "virtual" ? ht(n, n.cursorPosition.l
|
|
|
2709
2709
|
return qo(n);
|
|
2710
2710
|
const t = n.desiredColumn ?? n.lineMap.xAtPosition(n.cursorPosition);
|
|
2711
2711
|
return e >= n.lineMap.lineCount - 1 ? { position: n.cursorPosition, desiredColumn: t } : { position: n.lineMap.positionInLineAtX(e + 1, t), desiredColumn: t };
|
|
2712
|
-
},
|
|
2712
|
+
}, pn = (n) => {
|
|
2713
2713
|
const e = n.lineMap.lineIndexOfPosition(n.cursorPosition);
|
|
2714
2714
|
if (e === void 0)
|
|
2715
2715
|
return zo(n);
|
|
2716
2716
|
if (n.cursorPosition.kind === "virtual" && e > 0)
|
|
2717
|
-
return
|
|
2717
|
+
return Fs(n, e - 1);
|
|
2718
2718
|
const t = n.desiredColumn ?? n.lineMap.xAtPosition(n.cursorPosition);
|
|
2719
2719
|
return e <= 0 ? { position: n.cursorPosition, desiredColumn: t } : { position: n.lineMap.positionInLineAtX(e - 1, t), desiredColumn: t };
|
|
2720
2720
|
};
|
|
2721
|
-
function
|
|
2721
|
+
function dt(n, e, t, s) {
|
|
2722
2722
|
const i = t === "before" ? e.sourceOffsetBefore : e.sourceOffsetAfter;
|
|
2723
2723
|
return N.source(ce(
|
|
2724
2724
|
n.document,
|
|
@@ -2732,7 +2732,7 @@ function zo(n) {
|
|
|
2732
2732
|
if (n.cursorPosition.kind !== "virtual" || n.lineMap.isEmpty)
|
|
2733
2733
|
return { position: n.cursorPosition, desiredColumn: n.desiredColumn };
|
|
2734
2734
|
const e = n.lineMap.lineIndexOfOffset(n.cursorPosition.line.sourceOffsetBefore);
|
|
2735
|
-
return
|
|
2735
|
+
return Fs(n, e);
|
|
2736
2736
|
}
|
|
2737
2737
|
function qo(n) {
|
|
2738
2738
|
if (n.cursorPosition.kind !== "virtual" || n.lineMap.isEmpty)
|
|
@@ -2743,17 +2743,17 @@ function qo(n) {
|
|
|
2743
2743
|
desiredColumn: t
|
|
2744
2744
|
};
|
|
2745
2745
|
}
|
|
2746
|
-
function
|
|
2746
|
+
function Fs(n, e) {
|
|
2747
2747
|
const t = n.lineMap.lineRect(e).right;
|
|
2748
2748
|
return {
|
|
2749
2749
|
position: n.lineMap.positionInLineAtX(e, t),
|
|
2750
2750
|
desiredColumn: t
|
|
2751
2751
|
};
|
|
2752
2752
|
}
|
|
2753
|
-
const
|
|
2753
|
+
const Fe = {
|
|
2754
2754
|
tabSize: 4,
|
|
2755
2755
|
insertSpaces: !0
|
|
2756
|
-
}, Oe = " ",
|
|
2756
|
+
}, Oe = " ", _n = (n) => {
|
|
2757
2757
|
const e = n.selection;
|
|
2758
2758
|
if (!e.isCollapsed)
|
|
2759
2759
|
return {
|
|
@@ -2790,7 +2790,7 @@ const Ve = {
|
|
|
2790
2790
|
};
|
|
2791
2791
|
if (e.active === 0)
|
|
2792
2792
|
return;
|
|
2793
|
-
const t = Li(n.text, e.active, n.wordNavigationConfig), s = new w(t, e.active), i =
|
|
2793
|
+
const t = Li(n.text, e.active, n.wordNavigationConfig), s = new w(t, e.active), i = ht(n, s);
|
|
2794
2794
|
if (!i.isEmpty)
|
|
2795
2795
|
return {
|
|
2796
2796
|
edit: i,
|
|
@@ -2805,7 +2805,7 @@ const Ve = {
|
|
|
2805
2805
|
};
|
|
2806
2806
|
if (e.active >= n.text.length)
|
|
2807
2807
|
return;
|
|
2808
|
-
const t = Mi(n.text, e.active, n.wordNavigationConfig), s = new w(e.active, t), i =
|
|
2808
|
+
const t = Mi(n.text, e.active, n.wordNavigationConfig), s = new w(e.active, t), i = ht(n, s);
|
|
2809
2809
|
if (!i.isEmpty)
|
|
2810
2810
|
return {
|
|
2811
2811
|
edit: i,
|
|
@@ -2824,7 +2824,7 @@ const Ve = {
|
|
|
2824
2824
|
`, e.active - 1) + 1;
|
|
2825
2825
|
if (t === e.active && t > 0 && t--, t === e.active)
|
|
2826
2826
|
return;
|
|
2827
|
-
const s =
|
|
2827
|
+
const s = ht(n, new w(t, e.active));
|
|
2828
2828
|
if (!s.isEmpty)
|
|
2829
2829
|
return {
|
|
2830
2830
|
edit: s,
|
|
@@ -2841,17 +2841,17 @@ const Ve = {
|
|
|
2841
2841
|
`, e.active), s = t === -1 ? n.text.length : t === e.active ? t + 1 : t;
|
|
2842
2842
|
if (s === e.active)
|
|
2843
2843
|
return;
|
|
2844
|
-
const i =
|
|
2844
|
+
const i = ht(n, new w(e.active, s));
|
|
2845
2845
|
if (!i.isEmpty)
|
|
2846
2846
|
return {
|
|
2847
2847
|
edit: i,
|
|
2848
2848
|
selection: k.collapsed(i.mapOffset(e.active))
|
|
2849
2849
|
};
|
|
2850
2850
|
};
|
|
2851
|
-
function
|
|
2851
|
+
function ht(n, e) {
|
|
2852
2852
|
const t = [];
|
|
2853
2853
|
let s = e.start;
|
|
2854
|
-
for (const i of
|
|
2854
|
+
for (const i of Ds(
|
|
2855
2855
|
n.document,
|
|
2856
2856
|
n.markerVisibleBlocks,
|
|
2857
2857
|
n.selection.active
|
|
@@ -2859,9 +2859,9 @@ function ut(n, e) {
|
|
|
2859
2859
|
if (!(i.endExclusive <= s)) {
|
|
2860
2860
|
if (i.start >= e.endExclusive)
|
|
2861
2861
|
break;
|
|
2862
|
-
s < i.start && t.push(
|
|
2862
|
+
s < i.start && t.push(le.delete(new w(s, Math.min(i.start, e.endExclusive)))), s = Math.max(s, i.endExclusive);
|
|
2863
2863
|
}
|
|
2864
|
-
return s < e.endExclusive && t.push(
|
|
2864
|
+
return s < e.endExclusive && t.push(le.delete(new w(s, e.endExclusive))), t.length === 0 ? M.empty : new M(t);
|
|
2865
2865
|
}
|
|
2866
2866
|
function Qo(n) {
|
|
2867
2867
|
return (e) => {
|
|
@@ -2872,26 +2872,26 @@ function Qo(n) {
|
|
|
2872
2872
|
};
|
|
2873
2873
|
};
|
|
2874
2874
|
}
|
|
2875
|
-
function Zo(n =
|
|
2876
|
-
return
|
|
2877
|
-
const t = e.selection, s = t.range, i = z(e.text, s.start), o =
|
|
2875
|
+
function Zo(n = Fe) {
|
|
2876
|
+
return ut(n), (e) => {
|
|
2877
|
+
const t = e.selection, s = t.range, i = z(e.text, s.start), o = vn(e.text, s.start), c = s.endExclusive <= o && (s.start !== i || s.endExclusive !== o), a = t.isCollapsed ? tn(e.document, e.text, t.active) : void 0, l = a ? Y(e.document, a.item) : void 0, d = a ? Y(e.document, a.item.marker) : void 0;
|
|
2878
2878
|
if (a && l !== void 0 && d !== void 0 && z(e.text, d) === i) {
|
|
2879
|
-
const m =
|
|
2879
|
+
const m = Gs(
|
|
2880
2880
|
e.text,
|
|
2881
2881
|
l,
|
|
2882
2882
|
l + a.item.length,
|
|
2883
|
-
|
|
2883
|
+
Us(e.text, z(e.text, d), d)
|
|
2884
2884
|
), g = m[0];
|
|
2885
2885
|
if (a.index === 0 && d - g >= Oe.length)
|
|
2886
2886
|
return;
|
|
2887
|
-
const _ = m.filter((v) => v <
|
|
2887
|
+
const _ = m.filter((v) => v < vn(e.text, v)).map((v) => le.insert(v, Oe)), p = new M(_);
|
|
2888
2888
|
return {
|
|
2889
2889
|
edit: p,
|
|
2890
2890
|
selection: k.collapsed(p.mapOffset(t.active))
|
|
2891
2891
|
};
|
|
2892
2892
|
}
|
|
2893
2893
|
if (t.isCollapsed || c) {
|
|
2894
|
-
const m =
|
|
2894
|
+
const m = Ks(
|
|
2895
2895
|
e.text.slice(z(e.text, s.start), s.start),
|
|
2896
2896
|
n
|
|
2897
2897
|
);
|
|
@@ -2900,24 +2900,24 @@ function Zo(n = Ve) {
|
|
|
2900
2900
|
selection: k.collapsed(s.start + m.length)
|
|
2901
2901
|
};
|
|
2902
2902
|
}
|
|
2903
|
-
const u =
|
|
2903
|
+
const u = Ws(e.text, s), h = u.map((m) => le.insert(m, ur(n))), f = new M(h);
|
|
2904
2904
|
return {
|
|
2905
2905
|
edit: f,
|
|
2906
2906
|
selection: _r(f, t, new Set(u))
|
|
2907
2907
|
};
|
|
2908
2908
|
};
|
|
2909
2909
|
}
|
|
2910
|
-
function
|
|
2911
|
-
return
|
|
2910
|
+
function Vs(n = Fe) {
|
|
2911
|
+
return ut(n), (e) => {
|
|
2912
2912
|
if (e.selection.isCollapsed) {
|
|
2913
|
-
const i =
|
|
2913
|
+
const i = tn(e.document, e.text, e.selection.active), o = i ? Y(e.document, i.item) : void 0, r = i ? Y(e.document, i.item.marker) : void 0;
|
|
2914
2914
|
if (i && o !== void 0 && r !== void 0 && z(e.text, r) === z(e.text, e.selection.active)) {
|
|
2915
|
-
const c =
|
|
2915
|
+
const c = Gs(
|
|
2916
2916
|
e.text,
|
|
2917
2917
|
o,
|
|
2918
2918
|
o + i.item.length,
|
|
2919
|
-
|
|
2920
|
-
).flatMap((l) => e.text.slice(l, l + Oe.length) === Oe ? [
|
|
2919
|
+
Us(e.text, z(e.text, r), r)
|
|
2920
|
+
).flatMap((l) => e.text.slice(l, l + Oe.length) === Oe ? [le.delete(new w(l, l + Oe.length))] : []);
|
|
2921
2921
|
if (c.length === 0)
|
|
2922
2922
|
return;
|
|
2923
2923
|
const a = new M(c);
|
|
@@ -2928,9 +2928,9 @@ function Jo(n = Ve) {
|
|
|
2928
2928
|
}
|
|
2929
2929
|
}
|
|
2930
2930
|
const t = [];
|
|
2931
|
-
for (const i of
|
|
2932
|
-
const o = mr(e.text, i), r = e.text.slice(i, o), c =
|
|
2933
|
-
c !== r && t.push(
|
|
2931
|
+
for (const i of Ws(e.text, e.selection.range)) {
|
|
2932
|
+
const o = mr(e.text, i), r = e.text.slice(i, o), c = zs(r, n);
|
|
2933
|
+
c !== r && t.push(le.replace(
|
|
2934
2934
|
new w(i, o),
|
|
2935
2935
|
c
|
|
2936
2936
|
));
|
|
@@ -2944,7 +2944,7 @@ function Jo(n = Ve) {
|
|
|
2944
2944
|
};
|
|
2945
2945
|
};
|
|
2946
2946
|
}
|
|
2947
|
-
const
|
|
2947
|
+
const Jo = (n) => {
|
|
2948
2948
|
const e = M.replace(n.selection.range, `
|
|
2949
2949
|
|
|
2950
2950
|
`), t = n.selection.range.start + 2;
|
|
@@ -2952,14 +2952,14 @@ const er = (n) => {
|
|
|
2952
2952
|
edit: e,
|
|
2953
2953
|
selection: k.collapsed(t)
|
|
2954
2954
|
};
|
|
2955
|
-
},
|
|
2955
|
+
}, er = (n) => {
|
|
2956
2956
|
const e = M.replace(n.selection.range, `
|
|
2957
2957
|
`), t = n.selection.range.start + 1;
|
|
2958
2958
|
return {
|
|
2959
2959
|
edit: e,
|
|
2960
2960
|
selection: k.collapsed(t)
|
|
2961
2961
|
};
|
|
2962
|
-
},
|
|
2962
|
+
}, tr = (n) => {
|
|
2963
2963
|
const e = n.selection.range.start;
|
|
2964
2964
|
let t = 0;
|
|
2965
2965
|
for (; t < 2 && n.text[e - 1 - t] === " "; )
|
|
@@ -2971,59 +2971,59 @@ const er = (n) => {
|
|
|
2971
2971
|
selection: k.collapsed(r)
|
|
2972
2972
|
};
|
|
2973
2973
|
};
|
|
2974
|
-
function
|
|
2974
|
+
function Ve(n) {
|
|
2975
2975
|
const e = n.activeBlock;
|
|
2976
2976
|
if (!n.selection.isCollapsed || !e)
|
|
2977
2977
|
return;
|
|
2978
|
-
const t =
|
|
2978
|
+
const t = nn(n.document, e);
|
|
2979
2979
|
if (t !== void 0)
|
|
2980
2980
|
switch (e.kind) {
|
|
2981
2981
|
case "paragraph":
|
|
2982
2982
|
case "heading":
|
|
2983
2983
|
case "thematicBreak":
|
|
2984
|
-
return n.selection.active >= nt(e, t) ?
|
|
2984
|
+
return n.selection.active >= nt(e, t) ? wt(n, e, t) : void 0;
|
|
2985
2985
|
case "frontMatter":
|
|
2986
2986
|
case "codeBlock":
|
|
2987
|
-
return e.closeFence && n.selection.active >= nt(e, t) ?
|
|
2987
|
+
return e.closeFence && n.selection.active >= nt(e, t) ? wt(n, e, t) : void 0;
|
|
2988
2988
|
case "blockQuote":
|
|
2989
|
-
return
|
|
2989
|
+
return cr(n);
|
|
2990
2990
|
case "unhandledBlock": {
|
|
2991
2991
|
const s = e.htmlComment;
|
|
2992
2992
|
if (s?.kind !== "complete")
|
|
2993
2993
|
return;
|
|
2994
2994
|
const i = t + s.leadingWhitespace.length + s.opening.length + s.body.length + s.closing.length;
|
|
2995
|
-
return n.selection.active >= i ?
|
|
2995
|
+
return n.selection.active >= i ? wt(n, e, t) : void 0;
|
|
2996
2996
|
}
|
|
2997
2997
|
default:
|
|
2998
2998
|
return;
|
|
2999
2999
|
}
|
|
3000
3000
|
}
|
|
3001
|
-
const
|
|
3001
|
+
const nr = (n) => {
|
|
3002
3002
|
const e = n.selection, t = n.activeBlock;
|
|
3003
3003
|
if (!e.isCollapsed || !t)
|
|
3004
|
-
return
|
|
3004
|
+
return me(n);
|
|
3005
3005
|
switch (t.kind) {
|
|
3006
3006
|
case "paragraph":
|
|
3007
3007
|
case "heading":
|
|
3008
3008
|
case "thematicBreak":
|
|
3009
|
-
return
|
|
3009
|
+
return sr(n, t);
|
|
3010
3010
|
case "frontMatter":
|
|
3011
3011
|
case "codeBlock":
|
|
3012
|
-
return
|
|
3012
|
+
return ir(n);
|
|
3013
3013
|
case "blockQuote":
|
|
3014
|
-
return
|
|
3014
|
+
return rr(n);
|
|
3015
3015
|
case "list":
|
|
3016
|
-
return
|
|
3016
|
+
return ar(n);
|
|
3017
3017
|
case "unhandledBlock":
|
|
3018
|
-
return
|
|
3018
|
+
return or(n, t);
|
|
3019
3019
|
default:
|
|
3020
|
-
return
|
|
3020
|
+
return me(n);
|
|
3021
3021
|
}
|
|
3022
3022
|
};
|
|
3023
|
-
function
|
|
3024
|
-
const t = n.selection, s =
|
|
3023
|
+
function sr(n, e) {
|
|
3024
|
+
const t = n.selection, s = nn(n.document, e);
|
|
3025
3025
|
if (s === void 0)
|
|
3026
|
-
return
|
|
3026
|
+
return me(n);
|
|
3027
3027
|
const i = nt(e, s);
|
|
3028
3028
|
return t.active < i ? {
|
|
3029
3029
|
kind: "edit",
|
|
@@ -3031,10 +3031,10 @@ function ir(n, e) {
|
|
|
3031
3031
|
|
|
3032
3032
|
`),
|
|
3033
3033
|
selection: k.collapsed(t.range.start + 2)
|
|
3034
|
-
} :
|
|
3034
|
+
} : Ve(n) ?? me(n);
|
|
3035
3035
|
}
|
|
3036
|
-
function
|
|
3037
|
-
const t = n.selection, s =
|
|
3036
|
+
function ir(n, e) {
|
|
3037
|
+
const t = n.selection, s = Ve(n);
|
|
3038
3038
|
if (s)
|
|
3039
3039
|
return s;
|
|
3040
3040
|
const i = n.text.lastIndexOf(`
|
|
@@ -3044,9 +3044,9 @@ function or(n, e) {
|
|
|
3044
3044
|
o++;
|
|
3045
3045
|
const r = `
|
|
3046
3046
|
` + n.text.slice(i, o);
|
|
3047
|
-
return
|
|
3047
|
+
return en(t, r);
|
|
3048
3048
|
}
|
|
3049
|
-
function
|
|
3049
|
+
function wt(n, e, t) {
|
|
3050
3050
|
const s = nt(e, t), i = t + e.length;
|
|
3051
3051
|
return {
|
|
3052
3052
|
kind: "pending",
|
|
@@ -3056,28 +3056,28 @@ function kt(n, e, t) {
|
|
|
3056
3056
|
atEof: i >= n.text.length
|
|
3057
3057
|
};
|
|
3058
3058
|
}
|
|
3059
|
-
function
|
|
3060
|
-
return e.htmlComment?.kind !== "complete" ?
|
|
3059
|
+
function or(n, e) {
|
|
3060
|
+
return e.htmlComment?.kind !== "complete" ? me(n) : Ve(n) ?? me(n);
|
|
3061
3061
|
}
|
|
3062
3062
|
function nt(n, e) {
|
|
3063
3063
|
return e + n.length - vr(n);
|
|
3064
3064
|
}
|
|
3065
|
-
function
|
|
3066
|
-
const e = n.selection, t =
|
|
3065
|
+
function rr(n) {
|
|
3066
|
+
const e = n.selection, t = $s(n.text, e.active), s = t.prefix ?? "> ";
|
|
3067
3067
|
if (t.content.slice(s.length).trim() === "")
|
|
3068
|
-
return
|
|
3068
|
+
return Ve(n) ?? Hs(n, t.start, t.endExclusive);
|
|
3069
3069
|
const o = `
|
|
3070
3070
|
` + s.replace(/\s*$/, " ");
|
|
3071
|
-
return
|
|
3071
|
+
return en(e, o);
|
|
3072
3072
|
}
|
|
3073
|
-
function
|
|
3073
|
+
function cr(n) {
|
|
3074
3074
|
const e = n.activeBlock;
|
|
3075
3075
|
if (!n.selection.isCollapsed || e?.kind !== "blockQuote")
|
|
3076
3076
|
return;
|
|
3077
|
-
const t =
|
|
3077
|
+
const t = $s(n.text, n.selection.active);
|
|
3078
3078
|
if (!t.prefix || t.content.slice(t.prefix.length).trim() !== "" || n.selection.active < t.start + t.prefix.length)
|
|
3079
3079
|
return;
|
|
3080
|
-
const s =
|
|
3080
|
+
const s = nn(n.document, e);
|
|
3081
3081
|
if (s === void 0)
|
|
3082
3082
|
return;
|
|
3083
3083
|
const i = s + e.length;
|
|
@@ -3093,7 +3093,7 @@ function ar(n) {
|
|
|
3093
3093
|
atEof: i >= n.text.length
|
|
3094
3094
|
};
|
|
3095
3095
|
}
|
|
3096
|
-
function
|
|
3096
|
+
function $s(n, e) {
|
|
3097
3097
|
const t = n.lastIndexOf(`
|
|
3098
3098
|
`, e - 1) + 1, s = hr(n, e), i = n.slice(t, s);
|
|
3099
3099
|
return {
|
|
@@ -3103,23 +3103,22 @@ function Fs(n, e) {
|
|
|
3103
3103
|
prefix: /^(\s*(?:>\s*)+)/.exec(i)?.[1]
|
|
3104
3104
|
};
|
|
3105
3105
|
}
|
|
3106
|
-
function
|
|
3107
|
-
const
|
|
3108
|
-
if (
|
|
3109
|
-
return
|
|
3110
|
-
const i =
|
|
3111
|
-
if (
|
|
3112
|
-
return
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
return
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
function Vs(n, e, t) {
|
|
3106
|
+
function ar(n) {
|
|
3107
|
+
const e = n.selection, t = tn(n.document, n.text, e.active);
|
|
3108
|
+
if (!t)
|
|
3109
|
+
return me(n);
|
|
3110
|
+
const { item: s, list: i } = t, o = Y(n.document, s);
|
|
3111
|
+
if (o === void 0)
|
|
3112
|
+
return me(n);
|
|
3113
|
+
if (dr(n, s, o)) {
|
|
3114
|
+
const c = Vs()(n);
|
|
3115
|
+
return c ? { kind: "edit", edit: c.edit, selection: c.selection } : Hs(n, o, o + s.length);
|
|
3116
|
+
}
|
|
3117
|
+
const r = `
|
|
3118
|
+
` + lr(n, i, s);
|
|
3119
|
+
return en(e, r);
|
|
3120
|
+
}
|
|
3121
|
+
function Hs(n, e, t) {
|
|
3123
3122
|
const s = e > 0 ? n.text.lastIndexOf(`
|
|
3124
3123
|
`, e - 1) : -1;
|
|
3125
3124
|
return s >= 0 ? {
|
|
@@ -3134,18 +3133,26 @@ function Vs(n, e, t) {
|
|
|
3134
3133
|
selection: k.collapsed(e)
|
|
3135
3134
|
};
|
|
3136
3135
|
}
|
|
3137
|
-
function
|
|
3138
|
-
const
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
if (i)
|
|
3144
|
-
return `${Number(i[1]) + 1}${i[2]} `;
|
|
3136
|
+
function lr(n, e, t) {
|
|
3137
|
+
const s = Y(n.document, t.marker), i = s === void 0 ? "" : n.text.slice(z(n.text, s), s), o = t.marker.content.trim();
|
|
3138
|
+
let r = `${o.charAt(0) || "-"} `;
|
|
3139
|
+
if (e.ordered) {
|
|
3140
|
+
const c = /^(\d+)([.)])/.exec(o);
|
|
3141
|
+
c && (r = `${Number(c[1]) + 1}${c[2]} `);
|
|
3145
3142
|
}
|
|
3146
|
-
return `${
|
|
3143
|
+
return `${i}${r}${t.checked !== void 0 ? "[ ] " : ""}`;
|
|
3144
|
+
}
|
|
3145
|
+
function dr(n, e, t) {
|
|
3146
|
+
const s = Y(n.document, e.marker);
|
|
3147
|
+
if (s === void 0)
|
|
3148
|
+
return !1;
|
|
3149
|
+
const i = n.text.slice(
|
|
3150
|
+
s + e.marker.length,
|
|
3151
|
+
t + e.length
|
|
3152
|
+
);
|
|
3153
|
+
return i.trim().length === 0 || /^\[[ xX]\](?=[ \t\r\n])[ \t\r\n]*$/.test(i);
|
|
3147
3154
|
}
|
|
3148
|
-
function
|
|
3155
|
+
function en(n, e) {
|
|
3149
3156
|
return {
|
|
3150
3157
|
kind: "edit",
|
|
3151
3158
|
edit: M.replace(n.range, e),
|
|
@@ -3161,12 +3168,12 @@ function z(n, e) {
|
|
|
3161
3168
|
return n.lastIndexOf(`
|
|
3162
3169
|
`, Math.max(0, e - 1)) + 1;
|
|
3163
3170
|
}
|
|
3164
|
-
function
|
|
3171
|
+
function vn(n, e) {
|
|
3165
3172
|
const t = n.indexOf(`
|
|
3166
3173
|
`, e);
|
|
3167
3174
|
return t === -1 ? n.length : t;
|
|
3168
3175
|
}
|
|
3169
|
-
function
|
|
3176
|
+
function Ws(n, e) {
|
|
3170
3177
|
const t = [z(n, e.start)], s = e.endExclusive > e.start && n[e.endExclusive - 1] === `
|
|
3171
3178
|
` ? e.endExclusive - 1 : e.endExclusive;
|
|
3172
3179
|
let i = n.indexOf(`
|
|
@@ -3176,18 +3183,18 @@ function $s(n, e) {
|
|
|
3176
3183
|
`, i) + 1;
|
|
3177
3184
|
return t;
|
|
3178
3185
|
}
|
|
3179
|
-
function
|
|
3180
|
-
if (
|
|
3186
|
+
function Ks(n, e = Fe) {
|
|
3187
|
+
if (ut(e), !e.insertSpaces)
|
|
3181
3188
|
return " ";
|
|
3182
|
-
const t =
|
|
3189
|
+
const t = qs(n, e.tabSize);
|
|
3183
3190
|
return " ".repeat(e.tabSize - t % e.tabSize);
|
|
3184
3191
|
}
|
|
3185
3192
|
function ur(n) {
|
|
3186
3193
|
return n.insertSpaces ? " ".repeat(n.tabSize) : " ";
|
|
3187
3194
|
}
|
|
3188
|
-
function
|
|
3189
|
-
|
|
3190
|
-
const t =
|
|
3195
|
+
function zs(n, e = Fe) {
|
|
3196
|
+
ut(e);
|
|
3197
|
+
const t = qs(n, e.tabSize);
|
|
3191
3198
|
if (t === 0)
|
|
3192
3199
|
return n;
|
|
3193
3200
|
const s = t - (t % e.tabSize || e.tabSize);
|
|
@@ -3196,7 +3203,7 @@ function Ws(n, e = Ve) {
|
|
|
3196
3203
|
function fr(n, e) {
|
|
3197
3204
|
return e.insertSpaces ? " ".repeat(n) : " ".repeat(Math.floor(n / e.tabSize)) + " ".repeat(n % e.tabSize);
|
|
3198
3205
|
}
|
|
3199
|
-
function
|
|
3206
|
+
function qs(n, e) {
|
|
3200
3207
|
let t = 0;
|
|
3201
3208
|
for (const s of n)
|
|
3202
3209
|
t = s === " " ? t + e - t % e : t + 1;
|
|
@@ -3208,9 +3215,9 @@ function mr(n, e) {
|
|
|
3208
3215
|
t++;
|
|
3209
3216
|
return t;
|
|
3210
3217
|
}
|
|
3211
|
-
function
|
|
3218
|
+
function tn(n, e, t) {
|
|
3212
3219
|
const s = (c, a, l, d) => {
|
|
3213
|
-
const u = c instanceof G && l !== void 0 && d !== void 0 ? { item: c, index: d } : void 0;
|
|
3220
|
+
const u = c instanceof G && l !== void 0 && d !== void 0 ? { list: l, item: c, index: d } : void 0;
|
|
3214
3221
|
let h = a, f;
|
|
3215
3222
|
for (const m of c.children) {
|
|
3216
3223
|
const g = h + m.length, _ = c instanceof q && m instanceof G ? c : l, p = c instanceof q && m instanceof G ? c.items.indexOf(m) : d;
|
|
@@ -3221,7 +3228,7 @@ function zs(n, e, t) {
|
|
|
3221
3228
|
return f ?? u;
|
|
3222
3229
|
}, i = s(n, 0, void 0, void 0);
|
|
3223
3230
|
if (i) {
|
|
3224
|
-
const c =
|
|
3231
|
+
const c = Y(n, i.item.marker);
|
|
3225
3232
|
if (c !== void 0 && z(e, c) === z(e, t))
|
|
3226
3233
|
return i;
|
|
3227
3234
|
}
|
|
@@ -3229,15 +3236,15 @@ function zs(n, e, t) {
|
|
|
3229
3236
|
const r = (c) => {
|
|
3230
3237
|
if (c instanceof q)
|
|
3231
3238
|
for (let a = 0; a < c.items.length; a++) {
|
|
3232
|
-
const l = c.items[a], d =
|
|
3233
|
-
d !== void 0 && z(e, d) === z(e, t) && (o = { item: l, index: a });
|
|
3239
|
+
const l = c.items[a], d = Y(n, l.marker);
|
|
3240
|
+
d !== void 0 && z(e, d) === z(e, t) && (o = { list: c, item: l, index: a });
|
|
3234
3241
|
}
|
|
3235
3242
|
for (const a of c.children)
|
|
3236
3243
|
r(a);
|
|
3237
3244
|
};
|
|
3238
3245
|
return r(n), o ?? i;
|
|
3239
3246
|
}
|
|
3240
|
-
function
|
|
3247
|
+
function Gs(n, e, t, s) {
|
|
3241
3248
|
const i = [];
|
|
3242
3249
|
let o = z(n, e);
|
|
3243
3250
|
for (; o < t; ) {
|
|
@@ -3250,7 +3257,7 @@ function qs(n, e, t, s) {
|
|
|
3250
3257
|
}
|
|
3251
3258
|
return i;
|
|
3252
3259
|
}
|
|
3253
|
-
function
|
|
3260
|
+
function Us(n, e, t) {
|
|
3254
3261
|
let s = e, i = 0;
|
|
3255
3262
|
for (; s < t; ) {
|
|
3256
3263
|
let o = s;
|
|
@@ -3291,18 +3298,15 @@ function _r(n, e, t) {
|
|
|
3291
3298
|
};
|
|
3292
3299
|
return new k(s(e.anchor), s(e.active));
|
|
3293
3300
|
}
|
|
3294
|
-
function
|
|
3301
|
+
function ut(n) {
|
|
3295
3302
|
if (!Number.isInteger(n.tabSize) || n.tabSize <= 0)
|
|
3296
3303
|
throw new RangeError(`tabSize must be a positive integer, got ${n.tabSize}`);
|
|
3297
3304
|
}
|
|
3298
|
-
function
|
|
3299
|
-
|
|
3300
|
-
}
|
|
3301
|
-
function le(n) {
|
|
3302
|
-
const e = tr(n);
|
|
3305
|
+
function me(n) {
|
|
3306
|
+
const e = er(n);
|
|
3303
3307
|
return { kind: "edit", edit: e.edit, selection: e.selection };
|
|
3304
3308
|
}
|
|
3305
|
-
function
|
|
3309
|
+
function nn(n, e) {
|
|
3306
3310
|
let t = 0;
|
|
3307
3311
|
for (const s of n.children) {
|
|
3308
3312
|
if (s === e)
|
|
@@ -3318,18 +3322,18 @@ function vr(n) {
|
|
|
3318
3322
|
return t;
|
|
3319
3323
|
}
|
|
3320
3324
|
const wr = (n) => new k(0, n.text.length), br = (n, e) => {
|
|
3321
|
-
const t =
|
|
3325
|
+
const t = Ls(n.text, e, n.wordNavigationConfig);
|
|
3322
3326
|
return new k(t.start, t.end);
|
|
3323
3327
|
};
|
|
3324
3328
|
function kr(n, e) {
|
|
3325
3329
|
return new k(e.start, e.endExclusive);
|
|
3326
3330
|
}
|
|
3327
|
-
const
|
|
3331
|
+
const wn = /* @__PURE__ */ new WeakMap(), bt = /* @__PURE__ */ new WeakMap();
|
|
3328
3332
|
class oe extends H {
|
|
3329
3333
|
constructor(e, t, s = yr) {
|
|
3330
|
-
super(), this.ast = e, this.dom = t, this._children = s,
|
|
3334
|
+
super(), this.ast = e, this.dom = t, this._children = s, wn.set(t, this);
|
|
3331
3335
|
for (const i of s)
|
|
3332
|
-
|
|
3336
|
+
bt.set(i, this);
|
|
3333
3337
|
}
|
|
3334
3338
|
_children;
|
|
3335
3339
|
/** This node's view children (a mirror of `ast.children`). */
|
|
@@ -3350,7 +3354,7 @@ class oe extends H {
|
|
|
3350
3354
|
t.dispose();
|
|
3351
3355
|
this._children = e;
|
|
3352
3356
|
for (const t of e)
|
|
3353
|
-
|
|
3357
|
+
bt.set(t, this);
|
|
3354
3358
|
}
|
|
3355
3359
|
dispose() {
|
|
3356
3360
|
for (const e of this._children)
|
|
@@ -3377,7 +3381,7 @@ class oe extends H {
|
|
|
3377
3381
|
}
|
|
3378
3382
|
/** The view node that rendered this node's parent, or `undefined` for a root. */
|
|
3379
3383
|
get parent() {
|
|
3380
|
-
return
|
|
3384
|
+
return bt.get(this);
|
|
3381
3385
|
}
|
|
3382
3386
|
/**
|
|
3383
3387
|
* Closest view node owning `domNode`: the node itself if registered, else
|
|
@@ -3386,7 +3390,7 @@ class oe extends H {
|
|
|
3386
3390
|
*/
|
|
3387
3391
|
static forDom(e) {
|
|
3388
3392
|
for (let t = e; t; t = t.parentNode) {
|
|
3389
|
-
const s =
|
|
3393
|
+
const s = wn.get(t);
|
|
3390
3394
|
if (s)
|
|
3391
3395
|
return s;
|
|
3392
3396
|
}
|
|
@@ -3489,7 +3493,7 @@ function xr(n) {
|
|
|
3489
3493
|
if (t)
|
|
3490
3494
|
return { node: t.startContainer, offset: t.startOffset };
|
|
3491
3495
|
}
|
|
3492
|
-
function
|
|
3496
|
+
function It(n, e) {
|
|
3493
3497
|
let t = n.firstChild, s = 0;
|
|
3494
3498
|
for (; s < e.length && t === e[s]; s++)
|
|
3495
3499
|
t = t.nextSibling;
|
|
@@ -3521,17 +3525,17 @@ function Sr(n) {
|
|
|
3521
3525
|
`) ? 2 : n.endsWith("\r") || n.endsWith(`
|
|
3522
3526
|
`) ? 1 : 0;
|
|
3523
3527
|
}
|
|
3524
|
-
class
|
|
3528
|
+
class Ie {
|
|
3525
3529
|
static create(e) {
|
|
3526
3530
|
const t = document.createElement("span");
|
|
3527
3531
|
t.dataset.mdUrl = e.href, t.setAttribute("role", "link"), t.tabIndex = 0;
|
|
3528
3532
|
const s = document.createElement("span");
|
|
3529
3533
|
s.textContent = e.authoredLabel;
|
|
3530
|
-
const i = new
|
|
3534
|
+
const i = new Ie(t, s);
|
|
3531
3535
|
return i.update(e.presentation), i;
|
|
3532
3536
|
}
|
|
3533
3537
|
static mount(e, t) {
|
|
3534
|
-
return new
|
|
3538
|
+
return new Ie(e, t);
|
|
3535
3539
|
}
|
|
3536
3540
|
static clear(e) {
|
|
3537
3541
|
e.classList.remove("md-rich-link", "md-rich-link-unavailable"), delete e.dataset.mdRichLinkKind, delete e.dataset.mdRichLinkStatus, delete e.dataset.mdRichLinkSecondaryStatus, e.removeAttribute("aria-label"), e.removeAttribute("title");
|
|
@@ -3546,20 +3550,20 @@ class Pe {
|
|
|
3546
3550
|
_status;
|
|
3547
3551
|
_secondaryStatus;
|
|
3548
3552
|
constructor(e, t) {
|
|
3549
|
-
this.element = e, this.authoredLabel = t, this._icon = document.createElement("span"), this._icon.className = "md-rich-link-icon codicon", this._icon.setAttribute("aria-hidden", "true"), this._title = document.createElement("span"), this._title.className = "md-rich-link-title", this._detail = document.createElement("span"), this._detail.className = "md-rich-link-detail", this._reference = document.createElement("span"), this._reference.className = "md-rich-link-reference", this._changes = Mr(), this._status =
|
|
3553
|
+
this.element = e, this.authoredLabel = t, this._icon = document.createElement("span"), this._icon.className = "md-rich-link-icon codicon", this._icon.setAttribute("aria-hidden", "true"), this._title = document.createElement("span"), this._title.className = "md-rich-link-title", this._detail = document.createElement("span"), this._detail.className = "md-rich-link-detail", this._reference = document.createElement("span"), this._reference.className = "md-rich-link-reference", this._changes = Mr(), this._status = bn("md-rich-link-primary-status"), this._secondaryStatus = bn("md-rich-link-secondary-status"), this.authoredLabel.className = "md-rich-link-label", this.element.classList.add("md-rich-link"), this._setDefaultOrder();
|
|
3550
3554
|
}
|
|
3551
3555
|
update(e) {
|
|
3552
3556
|
if (!e) {
|
|
3553
3557
|
this._renderUnavailable();
|
|
3554
3558
|
return;
|
|
3555
3559
|
}
|
|
3556
|
-
this.element.classList.remove("md-rich-link-unavailable"), this.element.dataset.mdRichLinkKind = e.kind, this._icon.className = `md-rich-link-icon codicon codicon-${Lr[e.kind]}`, this.authoredLabel.hidden = !!e.title, this._title.textContent = e.title ?? "", this._title.hidden = !e.title, this._detail.textContent = e.detail ?? "", this._detail.hidden = !e.detail, this._reference.textContent = e.reference ?? "", this._reference.hidden = !e.reference, Tr(this._changes, e.changes),
|
|
3560
|
+
this.element.classList.remove("md-rich-link-unavailable"), this.element.dataset.mdRichLinkKind = e.kind, this._icon.className = `md-rich-link-icon codicon codicon-${Lr[e.kind]}`, this.authoredLabel.hidden = !!e.title, this._title.textContent = e.title ?? "", this._title.hidden = !e.title, this._detail.textContent = e.detail ?? "", this._detail.hidden = !e.detail, this._reference.textContent = e.reference ?? "", this._reference.hidden = !e.reference, Tr(this._changes, e.changes), kn(this.element, e.kind, this._status, e.status, "mdRichLinkStatus"), kn(this.element, e.kind, this._secondaryStatus, e.secondaryStatus, "mdRichLinkSecondaryStatus"), It(this.element, Nr(e) ? [this._status.root, this.authoredLabel, this._title, this._detail, this._reference, this._changes.root, this._secondaryStatus.root] : [this._icon, this.authoredLabel, this._title, this._detail, this._reference, this._changes.root, this._status.root, this._secondaryStatus.root]), e.ariaLabel ? this.element.setAttribute("aria-label", e.ariaLabel) : this.element.removeAttribute("aria-label"), e.tooltip ? this.element.title = e.tooltip : this.element.removeAttribute("title");
|
|
3557
3561
|
}
|
|
3558
3562
|
_renderUnavailable() {
|
|
3559
|
-
this.element.classList.add("md-rich-link-unavailable"), delete this.element.dataset.mdRichLinkKind, delete this.element.dataset.mdRichLinkStatus, delete this.element.dataset.mdRichLinkSecondaryStatus, this._setDefaultOrder(), this._icon.className = "md-rich-link-icon codicon codicon-link", this.authoredLabel.hidden = !1, this._title.hidden = !0, this._detail.hidden = !0, this._reference.hidden = !0, Xs(this._changes),
|
|
3563
|
+
this.element.classList.add("md-rich-link-unavailable"), delete this.element.dataset.mdRichLinkKind, delete this.element.dataset.mdRichLinkStatus, delete this.element.dataset.mdRichLinkSecondaryStatus, this._setDefaultOrder(), this._icon.className = "md-rich-link-icon codicon codicon-link", this.authoredLabel.hidden = !1, this._title.hidden = !0, this._detail.hidden = !0, this._reference.hidden = !0, Xs(this._changes), Pt(this._status), Pt(this._secondaryStatus), this.element.removeAttribute("aria-label"), this.element.removeAttribute("title");
|
|
3560
3564
|
}
|
|
3561
3565
|
_setDefaultOrder() {
|
|
3562
|
-
|
|
3566
|
+
It(this.element, [
|
|
3563
3567
|
this._icon,
|
|
3564
3568
|
this.authoredLabel,
|
|
3565
3569
|
this._title,
|
|
@@ -3582,7 +3586,7 @@ const Lr = {
|
|
|
3582
3586
|
repository: "repo",
|
|
3583
3587
|
branch: "git-branch"
|
|
3584
3588
|
};
|
|
3585
|
-
function
|
|
3589
|
+
function bn(n) {
|
|
3586
3590
|
const e = document.createElement("span");
|
|
3587
3591
|
e.className = `md-rich-link-status ${n}`;
|
|
3588
3592
|
const t = document.createElement("span");
|
|
@@ -3608,16 +3612,16 @@ function Tr(n, e) {
|
|
|
3608
3612
|
function Xs(n) {
|
|
3609
3613
|
n.insertions.textContent = "", n.deletions.textContent = "", n.root.hidden = !0;
|
|
3610
3614
|
}
|
|
3611
|
-
function
|
|
3615
|
+
function kn(n, e, t, s, i) {
|
|
3612
3616
|
if (!s) {
|
|
3613
|
-
delete n.dataset[i],
|
|
3617
|
+
delete n.dataset[i], Pt(t);
|
|
3614
3618
|
return;
|
|
3615
3619
|
}
|
|
3616
3620
|
n.dataset[i] = s.kind;
|
|
3617
3621
|
const o = Rr(e, s.kind);
|
|
3618
3622
|
t.icon.className = `md-rich-link-status-icon codicon codicon-${Ir(e, s.kind)}`, t.icon.hidden = o !== void 0, o ? (t.pixelSpinner ??= Or(t.label), t.pixelSpinner.classList.toggle("monaco-pixel-spinner-ring", o === "ring")) : (t.pixelSpinner?.remove(), t.pixelSpinner = void 0), t.label.textContent = s.label, t.root.hidden = !1;
|
|
3619
3623
|
}
|
|
3620
|
-
function
|
|
3624
|
+
function Pt(n) {
|
|
3621
3625
|
n.icon.hidden = !1, n.pixelSpinner?.remove(), n.pixelSpinner = void 0, n.label.textContent = "", n.root.hidden = !0;
|
|
3622
3626
|
}
|
|
3623
3627
|
function Or(n) {
|
|
@@ -3729,7 +3733,7 @@ class R extends oe {
|
|
|
3729
3733
|
recordMeasuredHeight(e) {
|
|
3730
3734
|
}
|
|
3731
3735
|
}
|
|
3732
|
-
function
|
|
3736
|
+
function j(n, e, t) {
|
|
3733
3737
|
if (t instanceof R) {
|
|
3734
3738
|
if (t.canReuse(n, e))
|
|
3735
3739
|
return t;
|
|
@@ -3737,92 +3741,92 @@ function Y(n, e, t) {
|
|
|
3737
3741
|
return t;
|
|
3738
3742
|
switch (n.kind) {
|
|
3739
3743
|
case "text":
|
|
3740
|
-
return Ar(n, I(t,
|
|
3744
|
+
return Ar(n, I(t, sn));
|
|
3741
3745
|
case "marker":
|
|
3742
|
-
return n.ast.markerKind === "hardBreak" ? new
|
|
3746
|
+
return n.ast.markerKind === "hardBreak" ? new Cn(n, I(t, Cn)) : new En(n, I(t, En));
|
|
3743
3747
|
case "glue":
|
|
3744
3748
|
return new st(n, I(t, st));
|
|
3745
3749
|
case "heading":
|
|
3746
|
-
return new
|
|
3750
|
+
return new Ln(n, e, I(t, Ln));
|
|
3747
3751
|
case "paragraph":
|
|
3748
|
-
return new
|
|
3752
|
+
return new ge(n, "p", "md-block md-paragraph", e, be(t));
|
|
3749
3753
|
case "frontMatter":
|
|
3750
|
-
return new
|
|
3754
|
+
return new In(n, e, I(t, In));
|
|
3751
3755
|
case "codeBlock":
|
|
3752
|
-
return new
|
|
3756
|
+
return new on(n, e, t);
|
|
3753
3757
|
case "mathBlock":
|
|
3754
|
-
return new
|
|
3758
|
+
return new Bn(n, e, I(t, Bn));
|
|
3755
3759
|
case "thematicBreak":
|
|
3756
|
-
return new
|
|
3760
|
+
return new Mn(n, e, I(t, Mn));
|
|
3757
3761
|
case "unhandledBlock": {
|
|
3758
3762
|
const s = n.ast.htmlComment;
|
|
3759
|
-
return s ? new
|
|
3763
|
+
return s ? new On(n, s, e, I(t, On)) : new Tn(n, e, I(t, Tn));
|
|
3760
3764
|
}
|
|
3761
3765
|
case "blockQuote":
|
|
3762
|
-
return new
|
|
3766
|
+
return new Sn(n, e, I(t, Sn));
|
|
3763
3767
|
case "list":
|
|
3764
|
-
return new Bn(n, e, I(t, Bn));
|
|
3765
|
-
case "listItem":
|
|
3766
3768
|
return new An(n, e, I(t, An));
|
|
3767
|
-
case "
|
|
3769
|
+
case "listItem":
|
|
3768
3770
|
return new Dn(n, e, I(t, Dn));
|
|
3769
|
-
case "
|
|
3771
|
+
case "table":
|
|
3770
3772
|
return new Fn(n, e, I(t, Fn));
|
|
3773
|
+
case "tableRow":
|
|
3774
|
+
return new Vn(n, e, I(t, Vn));
|
|
3771
3775
|
case "tableCell":
|
|
3772
|
-
return new
|
|
3776
|
+
return new ge(n, "td", "", e, be(t));
|
|
3773
3777
|
case "strong":
|
|
3774
|
-
return new
|
|
3778
|
+
return new ge(n, "strong", "", e, be(t));
|
|
3775
3779
|
case "emphasis":
|
|
3776
|
-
return new
|
|
3780
|
+
return new ge(n, "em", "", e, be(t));
|
|
3777
3781
|
case "strikethrough":
|
|
3778
|
-
return new
|
|
3782
|
+
return new ge(n, "del", "", e, be(t));
|
|
3779
3783
|
case "inlineCode":
|
|
3780
|
-
return new Vn(n, e, I(t, Vn));
|
|
3781
|
-
case "inlineMath":
|
|
3782
3784
|
return new $n(n, e, I(t, $n));
|
|
3783
|
-
case "
|
|
3785
|
+
case "inlineMath":
|
|
3784
3786
|
return new Hn(n, e, I(t, Hn));
|
|
3785
|
-
case "
|
|
3787
|
+
case "link":
|
|
3786
3788
|
return new Wn(n, e, I(t, Wn));
|
|
3789
|
+
case "image":
|
|
3790
|
+
return new Kn(n, e, I(t, Kn));
|
|
3787
3791
|
case "document":
|
|
3788
|
-
return new
|
|
3792
|
+
return new ge(n, "div", "", e, be(t));
|
|
3789
3793
|
case "diffHunk":
|
|
3790
|
-
return new
|
|
3794
|
+
return new Bt(n, e, I(t, Bt));
|
|
3791
3795
|
case "diffDecoration":
|
|
3792
|
-
return new
|
|
3796
|
+
return new At(n, e, I(t, At));
|
|
3793
3797
|
}
|
|
3794
3798
|
}
|
|
3795
3799
|
function I(n, e) {
|
|
3796
3800
|
return n instanceof e ? n : void 0;
|
|
3797
3801
|
}
|
|
3798
3802
|
function be(n) {
|
|
3799
|
-
return n instanceof
|
|
3803
|
+
return n instanceof ge ? n : void 0;
|
|
3800
3804
|
}
|
|
3801
3805
|
function X(n, e, t, s) {
|
|
3802
|
-
const { paired: i, unused: o } =
|
|
3806
|
+
const { paired: i, unused: o } = rn(e, t ?? F), r = e.map((c) => s(c, i.get(c)));
|
|
3803
3807
|
for (const c of o)
|
|
3804
3808
|
c.dispose();
|
|
3805
3809
|
return Pr(n, r), r;
|
|
3806
3810
|
}
|
|
3807
3811
|
function Pr(n, e) {
|
|
3808
|
-
|
|
3812
|
+
Q(n, e.map((t) => t.mountNode));
|
|
3809
3813
|
}
|
|
3810
|
-
const
|
|
3811
|
-
function
|
|
3812
|
-
return (e, t) =>
|
|
3814
|
+
const Q = It;
|
|
3815
|
+
function de(n) {
|
|
3816
|
+
return (e, t) => j(e, n, t);
|
|
3813
3817
|
}
|
|
3814
3818
|
function Ys(n) {
|
|
3815
|
-
return (e, t) => e.kind === "marker" && e.ast.markerKind === "content" ? new
|
|
3819
|
+
return (e, t) => e.kind === "marker" && e.ast.markerKind === "content" ? new sn(e, document.createTextNode(e.ast.content)) : j(e, n, t);
|
|
3816
3820
|
}
|
|
3817
3821
|
const F = [];
|
|
3818
|
-
class
|
|
3822
|
+
class Bt extends R {
|
|
3819
3823
|
_originalNode;
|
|
3820
3824
|
_modifiedNode;
|
|
3821
3825
|
constructor(e, t, s) {
|
|
3822
3826
|
const i = s?.dom ?? document.createElement("div");
|
|
3823
3827
|
i.className = "md-block md-diff-hunk";
|
|
3824
|
-
const o = [], r = [], c = e.original ?
|
|
3825
|
-
c && (o.push(c), r.push(c.mountNode)), a && (o.push(a), r.push(a.mountNode)),
|
|
3828
|
+
const o = [], r = [], c = e.original ? yn(e.original, "md-diff-original", t, s?._originalNode) : void 0, a = e.modified ? yn(e.modified, "md-diff-modified", t, s?._modifiedNode) : void 0;
|
|
3829
|
+
c && (o.push(c), r.push(c.mountNode)), a && (o.push(a), r.push(a.mountNode)), Q(i, r), super(e, i, o), this._originalNode = c, this._modifiedNode = a;
|
|
3826
3830
|
}
|
|
3827
3831
|
/** The mounted sides with their highlight ranges, for the diff highlighter. */
|
|
3828
3832
|
get sides() {
|
|
@@ -3830,17 +3834,17 @@ class Dt extends R {
|
|
|
3830
3834
|
return this._originalNode && this.data.original && e.push({ node: this._originalNode, ranges: this.data.original.ranges }), this._modifiedNode && this.data.modified && e.push({ node: this._modifiedNode, ranges: this.data.modified.ranges }), e;
|
|
3831
3835
|
}
|
|
3832
3836
|
}
|
|
3833
|
-
function
|
|
3834
|
-
const i =
|
|
3837
|
+
function yn(n, e, t, s) {
|
|
3838
|
+
const i = j(n.view, t, s), o = i.element;
|
|
3835
3839
|
return o.classList.add(e), o.classList.toggle("md-block-active", n.active), o.classList.toggle("md-markers-hidden", !n.active), i;
|
|
3836
3840
|
}
|
|
3837
|
-
class
|
|
3841
|
+
class At extends R {
|
|
3838
3842
|
sideNode;
|
|
3839
3843
|
constructor(e, t, s) {
|
|
3840
3844
|
const i = s?.dom ?? document.createElement("div");
|
|
3841
3845
|
i.className = "md-block md-diff-decoration", i.style.pointerEvents = "none";
|
|
3842
|
-
const o =
|
|
3843
|
-
r.classList.add(e.whole ? "md-diff-removed" : "md-diff-original"), r.classList.toggle("md-block-active", c), r.classList.toggle("md-markers-hidden", !c),
|
|
3846
|
+
const o = j(e.side, t, s?.sideNode), r = o.element, c = !e.whole;
|
|
3847
|
+
r.classList.add(e.whole ? "md-diff-removed" : "md-diff-original"), r.classList.toggle("md-block-active", c), r.classList.toggle("md-markers-hidden", !c), Q(i, [o.mountNode]), super(e, i, [o]), this.sideNode = o;
|
|
3844
3848
|
}
|
|
3845
3849
|
/** A decoration has no presence in the modified document's source space. */
|
|
3846
3850
|
get sourceLength() {
|
|
@@ -3874,11 +3878,11 @@ function Ar(n, e) {
|
|
|
3874
3878
|
if (n.showWhitespace && Zs(t, s)) {
|
|
3875
3879
|
const r = document.createElement("span");
|
|
3876
3880
|
r.className = "md-text";
|
|
3877
|
-
const c =
|
|
3881
|
+
const c = ft(r, t, s, n.ast);
|
|
3878
3882
|
return new R(n, r, c);
|
|
3879
3883
|
}
|
|
3880
3884
|
const i = e?.dom, o = i instanceof globalThis.Text && i.data === t ? i : document.createTextNode(t);
|
|
3881
|
-
return new
|
|
3885
|
+
return new sn(n, o);
|
|
3882
3886
|
}
|
|
3883
3887
|
function Dr(n, e, t) {
|
|
3884
3888
|
const s = document.createElement("span");
|
|
@@ -3893,13 +3897,13 @@ function Dr(n, e, t) {
|
|
|
3893
3897
|
new K(n.ast, r, F, e.length - t)
|
|
3894
3898
|
]);
|
|
3895
3899
|
}
|
|
3896
|
-
function
|
|
3900
|
+
function xn(n) {
|
|
3897
3901
|
return n === " " || n === " " || n === `
|
|
3898
3902
|
` || n === "\r";
|
|
3899
3903
|
}
|
|
3900
3904
|
const Fr = { leftBoundary: !1, rightBoundary: !1, decorateNewline: !1 }, Vr = { leftBoundary: !1, rightBoundary: !1, decorateNewline: !1 };
|
|
3901
3905
|
function $r(n, e, t) {
|
|
3902
|
-
const s = e > 0 ? !
|
|
3906
|
+
const s = e > 0 ? !xn(n[e - 1]) : t.leftBoundary, i = e < n.length - 1 ? !xn(n[e + 1]) : t.rightBoundary;
|
|
3903
3907
|
return s && i;
|
|
3904
3908
|
}
|
|
3905
3909
|
function Qs(n, e, t) {
|
|
@@ -3949,7 +3953,7 @@ function Hr(n, e) {
|
|
|
3949
3953
|
}
|
|
3950
3954
|
return i(n.length), t;
|
|
3951
3955
|
}
|
|
3952
|
-
function
|
|
3956
|
+
function ft(n, e, t, s) {
|
|
3953
3957
|
const i = [];
|
|
3954
3958
|
for (const o of Hr(e, t)) {
|
|
3955
3959
|
const r = document.createTextNode(o.display ?? o.text);
|
|
@@ -3962,7 +3966,7 @@ function gt(n, e, t, s) {
|
|
|
3962
3966
|
}
|
|
3963
3967
|
return i;
|
|
3964
3968
|
}
|
|
3965
|
-
class
|
|
3969
|
+
class sn extends R {
|
|
3966
3970
|
constructor(e, t) {
|
|
3967
3971
|
super(e, t, F);
|
|
3968
3972
|
}
|
|
@@ -3988,7 +3992,7 @@ class Js extends K {
|
|
|
3988
3992
|
return this._span;
|
|
3989
3993
|
}
|
|
3990
3994
|
}
|
|
3991
|
-
class
|
|
3995
|
+
class En extends R {
|
|
3992
3996
|
_span;
|
|
3993
3997
|
constructor(e, t) {
|
|
3994
3998
|
const s = e.ast, i = `md-marker md-marker-${s.markerKind}`, o = t && t.dom instanceof globalThis.Text && t.dom.data === s.content, r = o ? t._span : document.createElement("span");
|
|
@@ -4020,7 +4024,7 @@ class st extends R {
|
|
|
4020
4024
|
if (e.visible && Zs(s.content, r)) {
|
|
4021
4025
|
const u = document.createElement("span");
|
|
4022
4026
|
u.className = i;
|
|
4023
|
-
const h =
|
|
4027
|
+
const h = ft(u, s.content, r, s);
|
|
4024
4028
|
return { span: u, dom: u, children: h };
|
|
4025
4029
|
}
|
|
4026
4030
|
const a = t && t.dom instanceof globalThis.Text && t.dom.data === s.content && t.children.length === 0, l = a ? t._span : document.createElement("span");
|
|
@@ -4029,14 +4033,14 @@ class st extends R {
|
|
|
4029
4033
|
return a || l.appendChild(d), { span: l, dom: d, children: F };
|
|
4030
4034
|
}
|
|
4031
4035
|
}
|
|
4032
|
-
class
|
|
4036
|
+
class Cn extends R {
|
|
4033
4037
|
_span;
|
|
4034
4038
|
constructor(e, t) {
|
|
4035
4039
|
const s = e.ast.content, i = document.createElement("span");
|
|
4036
4040
|
i.className = "md-hardbreak";
|
|
4037
4041
|
const o = document.createElement("span");
|
|
4038
4042
|
o.className = e.visible ? "md-hardbreak-src" : "md-hardbreak-src md-hardbreak-src-hidden";
|
|
4039
|
-
const r = e.visible ?
|
|
4043
|
+
const r = e.visible ? ft(o, s, Fr, e.ast) : Wr(o, s, e.ast);
|
|
4040
4044
|
i.appendChild(o), i.appendChild(document.createElement("br")), super(e, i, r), this._span = i;
|
|
4041
4045
|
}
|
|
4042
4046
|
get mountNode() {
|
|
@@ -4047,21 +4051,21 @@ function Wr(n, e, t) {
|
|
|
4047
4051
|
const s = document.createTextNode(e);
|
|
4048
4052
|
return n.appendChild(s), [new K(t, s)];
|
|
4049
4053
|
}
|
|
4050
|
-
class
|
|
4054
|
+
class ge extends R {
|
|
4051
4055
|
constructor(e, t, s, i, o) {
|
|
4052
4056
|
const r = o?.element ?? document.createElement(t);
|
|
4053
4057
|
!o && s && (r.className = s);
|
|
4054
|
-
const c = X(r, js(e), o?.children,
|
|
4058
|
+
const c = X(r, js(e), o?.children, de(i));
|
|
4055
4059
|
super(e, r, c);
|
|
4056
4060
|
}
|
|
4057
4061
|
}
|
|
4058
|
-
class
|
|
4062
|
+
class Sn extends R {
|
|
4059
4063
|
_sourceChildren;
|
|
4060
4064
|
_anchors;
|
|
4061
4065
|
constructor(e, t, s) {
|
|
4062
4066
|
const i = s?.element ?? document.createElement("blockquote");
|
|
4063
4067
|
s || (i.className = "md-block md-blockquote");
|
|
4064
|
-
const o = X(i, e.content, s?._sourceChildren,
|
|
4068
|
+
const o = X(i, e.content, s?._sourceChildren, de(t)), r = Kr(e.ast), c = e.showFinalMarkerOnlyLine ? r : r.slice(0, -1);
|
|
4065
4069
|
i.classList.toggle("md-blockquote-marker-only-line", c.length > 0);
|
|
4066
4070
|
const a = new Map(s?._anchors.map((h) => [h.ast.id, h])), l = c.map(({ marker: h }) => {
|
|
4067
4071
|
const f = a.get(h.id) ?? new Js(h, "md-blockquote-line-anchor");
|
|
@@ -4075,7 +4079,7 @@ class Cn extends R {
|
|
|
4075
4079
|
const f = d.get(h);
|
|
4076
4080
|
f && u.push(f);
|
|
4077
4081
|
}
|
|
4078
|
-
|
|
4082
|
+
Q(i, u.map((h) => h.mountNode)), super(e, i, u), this._sourceChildren = o, this._anchors = l;
|
|
4079
4083
|
}
|
|
4080
4084
|
}
|
|
4081
4085
|
function Kr(n) {
|
|
@@ -4092,21 +4096,21 @@ function Kr(n) {
|
|
|
4092
4096
|
}
|
|
4093
4097
|
return e.reverse();
|
|
4094
4098
|
}
|
|
4095
|
-
class
|
|
4099
|
+
class Ln extends R {
|
|
4096
4100
|
constructor(e, t, s) {
|
|
4097
4101
|
const i = s && s.element.tagName === `H${e.ast.level}`, o = i ? s.element : document.createElement(`h${e.ast.level}`);
|
|
4098
4102
|
i || (o.className = "md-block md-heading");
|
|
4099
|
-
const r = X(o, e.content, s?.children,
|
|
4103
|
+
const r = X(o, e.content, s?.children, de(t));
|
|
4100
4104
|
super(e, o, r);
|
|
4101
4105
|
}
|
|
4102
4106
|
}
|
|
4103
|
-
class
|
|
4107
|
+
class Mn extends R {
|
|
4104
4108
|
_contentEl;
|
|
4105
4109
|
constructor(e, t, s) {
|
|
4106
4110
|
if (e.showMarkup) {
|
|
4107
4111
|
const r = s?.data.showMarkup ? s : void 0, c = r?.dom ?? document.createElement("div");
|
|
4108
4112
|
r || (c.className = "md-block md-thematic-break-source");
|
|
4109
|
-
const a = X(c, e.content, r?.children,
|
|
4113
|
+
const a = X(c, e.content, r?.children, de(t));
|
|
4110
4114
|
super(e, c, a), this._contentEl = c;
|
|
4111
4115
|
return;
|
|
4112
4116
|
}
|
|
@@ -4119,7 +4123,7 @@ class Ln extends R {
|
|
|
4119
4123
|
return this._contentEl;
|
|
4120
4124
|
}
|
|
4121
4125
|
}
|
|
4122
|
-
class
|
|
4126
|
+
class Tn extends R {
|
|
4123
4127
|
_scroller;
|
|
4124
4128
|
constructor(e, t, s) {
|
|
4125
4129
|
const i = s && s.dom instanceof HTMLDivElement ? s : void 0, o = i?.dom ?? document.createElement("div");
|
|
@@ -4134,7 +4138,7 @@ class Mn extends R {
|
|
|
4134
4138
|
const f = (d instanceof K && d.dom.nodeType === globalThis.Node.TEXT_NODE && d.dom.data === u.content ? d.dom : void 0) ?? document.createTextNode(u.content);
|
|
4135
4139
|
return new K(u, f);
|
|
4136
4140
|
}
|
|
4137
|
-
return
|
|
4141
|
+
return j(l, t, d);
|
|
4138
4142
|
});
|
|
4139
4143
|
super(e, o, a), this._scroller = r;
|
|
4140
4144
|
}
|
|
@@ -4142,18 +4146,18 @@ class Mn extends R {
|
|
|
4142
4146
|
return this._scroller;
|
|
4143
4147
|
}
|
|
4144
4148
|
}
|
|
4145
|
-
class
|
|
4149
|
+
class On extends R {
|
|
4146
4150
|
constructor(e, t, s, i) {
|
|
4147
4151
|
const o = i?.dom instanceof HTMLDivElement ? i.dom : document.createElement("div");
|
|
4148
4152
|
o.className = `md-block md-html-comment md-html-comment-${t.kind}${e.showMarkup ? " md-html-comment-source" : ""}`;
|
|
4149
4153
|
const r = X(o, e.content, i?.children, (c, a) => {
|
|
4150
4154
|
const l = c.ast;
|
|
4151
|
-
return c.kind === "marker" && l.markerKind === "content" ? new
|
|
4155
|
+
return c.kind === "marker" && l.markerKind === "content" ? new Rn(l, t, I(a, Rn)) : j(c, s, a);
|
|
4152
4156
|
});
|
|
4153
4157
|
super(e, o, r);
|
|
4154
4158
|
}
|
|
4155
4159
|
}
|
|
4156
|
-
class
|
|
4160
|
+
class Rn extends oe {
|
|
4157
4161
|
constructor(e, t, s) {
|
|
4158
4162
|
const i = s?.dom instanceof HTMLSpanElement ? s.dom : document.createElement("span");
|
|
4159
4163
|
i.className = "md-html-comment-content";
|
|
@@ -4167,15 +4171,15 @@ class On extends oe {
|
|
|
4167
4171
|
{ className: "md-html-comment-syntax", content: t.trailingWhitespace }
|
|
4168
4172
|
);
|
|
4169
4173
|
const c = o.filter((a) => a.content.length > 0).map((a, l) => {
|
|
4170
|
-
const d = s?.children[l] instanceof
|
|
4174
|
+
const d = s?.children[l] instanceof Nn ? s.children[l] : void 0, u = d?.mountNode instanceof HTMLSpanElement ? d.mountNode : document.createElement("span");
|
|
4171
4175
|
u.className = a.className;
|
|
4172
4176
|
const h = d?.dom instanceof Text ? d.dom : void 0, f = h?.data === a.content ? h : document.createTextNode(a.content);
|
|
4173
|
-
return
|
|
4177
|
+
return Q(u, [f]), new Nn(e, f, u, a.content.length);
|
|
4174
4178
|
});
|
|
4175
|
-
|
|
4179
|
+
Q(i, c.map((a) => a.mountNode)), super(e, i, c);
|
|
4176
4180
|
}
|
|
4177
4181
|
}
|
|
4178
|
-
class
|
|
4182
|
+
class Nn extends K {
|
|
4179
4183
|
constructor(e, t, s, i) {
|
|
4180
4184
|
super(e, t, F, i), this._span = s;
|
|
4181
4185
|
}
|
|
@@ -4183,7 +4187,7 @@ class Rn extends K {
|
|
|
4183
4187
|
return this._span;
|
|
4184
4188
|
}
|
|
4185
4189
|
}
|
|
4186
|
-
class
|
|
4190
|
+
class In extends R {
|
|
4187
4191
|
_session;
|
|
4188
4192
|
_snapshotSub;
|
|
4189
4193
|
constructor(e, t, s) {
|
|
@@ -4201,7 +4205,7 @@ class Nn extends R {
|
|
|
4201
4205
|
);
|
|
4202
4206
|
if (super(e, d.dom, d.children), this._session = a, a && d.contentNode) {
|
|
4203
4207
|
const u = d.contentNode;
|
|
4204
|
-
this._snapshotSub =
|
|
4208
|
+
this._snapshotSub = Kt(a.snapshot, () => {
|
|
4205
4209
|
const h = a.snapshot.get();
|
|
4206
4210
|
u.refresh(r, h.getTokens(w.ofLength(r.length)).tokens);
|
|
4207
4211
|
});
|
|
@@ -4211,7 +4215,7 @@ class Nn extends R {
|
|
|
4211
4215
|
this._snapshotSub?.dispose(), this._snapshotSub = void 0, this._session?.dispose(), this._session = void 0, super.dispose();
|
|
4212
4216
|
}
|
|
4213
4217
|
}
|
|
4214
|
-
class
|
|
4218
|
+
class on extends R {
|
|
4215
4219
|
_session;
|
|
4216
4220
|
/**
|
|
4217
4221
|
* Subscription that re-tokenises the rendered `<code>` in place whenever the
|
|
@@ -4236,7 +4240,7 @@ class sn extends R {
|
|
|
4236
4240
|
return super.canReuse(e, t) && Object.is(t?.embeddedCodeEditorFactoryVersion, this._embeddedEditorFactoryVersion) && (!this._embeddedEditor || (t?.embeddedCodeEditorReadOnly ?? !1) === this._embeddedEditorReadOnly);
|
|
4237
4241
|
}
|
|
4238
4242
|
constructor(e, t, s) {
|
|
4239
|
-
const i = e.ast, o = i.code?.content ?? "", r = s instanceof
|
|
4243
|
+
const i = e.ast, o = i.code?.content ?? "", r = s instanceof on ? s : void 0, c = t?.embeddedCodeEditorReadOnly ?? !1, a = Er(o);
|
|
4240
4244
|
let l;
|
|
4241
4245
|
!e.showMarkup && i.language && i.code && a.sourceOffset > 0 && t?.embeddedCodeEditorFactory && (r?._embeddedEditor && Object.is(t.embeddedCodeEditorFactoryVersion, r._embeddedEditorFactoryVersion) && (i === r.ast || i.getDiff(r.ast)) ? (l = r._embeddedEditor, r._embeddedEditor = void 0) : l = t.embeddedCodeEditorFactory.create(i.language, i.infoString, a.text) ?? void 0), r?._embeddedEditor && (r._embeddedEditor.dispose(), r._embeddedEditor = void 0);
|
|
4242
4246
|
const d = !l && !e.showMarkup && i.language && t?.renderCustomCodeBlock ? t.renderCustomCodeBlock(i.language, o) ?? void 0 : void 0, u = t?.syntaxHighlighter;
|
|
@@ -4246,7 +4250,7 @@ class sn extends R {
|
|
|
4246
4250
|
h = r._session, r._session = void 0;
|
|
4247
4251
|
else if (r?._session) {
|
|
4248
4252
|
const p = i.getDiff(r.ast);
|
|
4249
|
-
p && (h = r._session, r._session = void 0,
|
|
4253
|
+
p && (h = r._session, r._session = void 0, ne((v) => h.update(p.stringEdit, v)));
|
|
4250
4254
|
}
|
|
4251
4255
|
h || (h = u.create(i.language, o));
|
|
4252
4256
|
}
|
|
@@ -4258,7 +4262,7 @@ class sn extends R {
|
|
|
4258
4262
|
const p = l.estimateHeight?.(a.text);
|
|
4259
4263
|
p !== void 0 && (l.element.style.boxSizing = "border-box", l.element.style.minHeight = `${p}px`), l.onEdit = (v) => {
|
|
4260
4264
|
const E = a.sourceOffset === 0 ? v : new M(
|
|
4261
|
-
v.replacements.map((b) =>
|
|
4265
|
+
v.replacements.map((b) => le.replace(b.replaceRange.delta(a.sourceOffset), b.newText))
|
|
4262
4266
|
);
|
|
4263
4267
|
t?.onEmbeddedCodeEditorEdit?.(i, E);
|
|
4264
4268
|
}, l.setReadOnly?.(t?.embeddedCodeEditorReadOnly ?? !1), l.setContent(a.text), m = l.element, g = F;
|
|
@@ -4296,20 +4300,20 @@ class sn extends R {
|
|
|
4296
4300
|
if (b.visible) {
|
|
4297
4301
|
const V = document.createElement("span");
|
|
4298
4302
|
V.className = "md-marker md-marker-codeIndent";
|
|
4299
|
-
const
|
|
4300
|
-
v.appendChild(V), E.push(new K(T, V,
|
|
4303
|
+
const he = ft(V, T.content, Vr, T);
|
|
4304
|
+
v.appendChild(V), E.push(new K(T, V, he));
|
|
4301
4305
|
} else {
|
|
4302
|
-
const V =
|
|
4306
|
+
const V = j(b, t, void 0);
|
|
4303
4307
|
v.appendChild(V.mountNode), E.push(V);
|
|
4304
4308
|
}
|
|
4305
4309
|
} else {
|
|
4306
|
-
const T =
|
|
4310
|
+
const T = j(b, t, void 0);
|
|
4307
4311
|
p.appendChild(T.mountNode), E.push(T);
|
|
4308
4312
|
}
|
|
4309
4313
|
}
|
|
4310
4314
|
m = p, g = E;
|
|
4311
4315
|
}
|
|
4312
|
-
super(e, m, g), this._session = h, this._embeddedEditor = l, this._embeddedEditorFactoryVersion = t?.embeddedCodeEditorFactoryVersion, this._embeddedEditorReadOnly = c, h && _ && (this._snapshotSub =
|
|
4316
|
+
super(e, m, g), this._session = h, this._embeddedEditor = l, this._embeddedEditorFactoryVersion = t?.embeddedCodeEditorFactoryVersion, this._embeddedEditorReadOnly = c, h && _ && (this._snapshotSub = Kt(h.snapshot, () => {
|
|
4313
4317
|
const p = h.snapshot.get();
|
|
4314
4318
|
_.refresh(o, p.getTokens(w.ofLength(o.length)).tokens);
|
|
4315
4319
|
}));
|
|
@@ -4330,7 +4334,7 @@ function ei(n, e, t, s, i, o, r) {
|
|
|
4330
4334
|
const h = zr(e, t, u, r);
|
|
4331
4335
|
h instanceof ti && (l = h), a.push(h), c.appendChild(u);
|
|
4332
4336
|
} else {
|
|
4333
|
-
const u =
|
|
4337
|
+
const u = j(d, s, void 0);
|
|
4334
4338
|
c.appendChild(u.mountNode), a.push(u);
|
|
4335
4339
|
}
|
|
4336
4340
|
return { dom: c, children: a, contentNode: l };
|
|
@@ -4344,15 +4348,15 @@ function zr(n, e, t, s) {
|
|
|
4344
4348
|
}
|
|
4345
4349
|
class ti extends oe {
|
|
4346
4350
|
constructor(e, t, s, i) {
|
|
4347
|
-
super(e, t,
|
|
4351
|
+
super(e, t, Pn(e, t, s, i));
|
|
4348
4352
|
}
|
|
4349
4353
|
/** Re-render the token spans for a new colouring, in place. */
|
|
4350
4354
|
refresh(e, t) {
|
|
4351
4355
|
const s = this.dom;
|
|
4352
|
-
s.replaceChildren(), this._replaceChildren(
|
|
4356
|
+
s.replaceChildren(), this._replaceChildren(Pn(this.ast, s, e, t));
|
|
4353
4357
|
}
|
|
4354
4358
|
}
|
|
4355
|
-
function
|
|
4359
|
+
function Pn(n, e, t, s) {
|
|
4356
4360
|
const i = [];
|
|
4357
4361
|
let o = 0;
|
|
4358
4362
|
for (const r of s) {
|
|
@@ -4389,7 +4393,7 @@ function si(n, e, t) {
|
|
|
4389
4393
|
c.start < o || (r(c.start - o), i.push(new K(n, c.dom, F, c.length)), o = c.start + c.length);
|
|
4390
4394
|
return r(t - o), i;
|
|
4391
4395
|
}
|
|
4392
|
-
class
|
|
4396
|
+
class Bn extends R {
|
|
4393
4397
|
/**
|
|
4394
4398
|
* The rendered (inactive, KaTeX) height in px, measured after mount and
|
|
4395
4399
|
* carried forward across rebuilds via `previous`. When the block becomes
|
|
@@ -4409,7 +4413,7 @@ class Pn extends R {
|
|
|
4409
4413
|
const h = document.createElement("code"), f = document.createTextNode(i.code.content);
|
|
4410
4414
|
h.appendChild(f), l.appendChild(h), d.push(new K(i.code, f));
|
|
4411
4415
|
} else {
|
|
4412
|
-
const h =
|
|
4416
|
+
const h = j(u, t, void 0);
|
|
4413
4417
|
l.appendChild(h.mountNode), d.push(h);
|
|
4414
4418
|
}
|
|
4415
4419
|
super(e, l, d), this._renderedHeight = o;
|
|
@@ -4429,7 +4433,7 @@ class Pn extends R {
|
|
|
4429
4433
|
const a = document.createElement("div");
|
|
4430
4434
|
a.className = "md-block md-math-block";
|
|
4431
4435
|
try {
|
|
4432
|
-
|
|
4436
|
+
Ss.render(r, a, { displayMode: !0, throwOnError: !1 });
|
|
4433
4437
|
} catch {
|
|
4434
4438
|
a.textContent = r;
|
|
4435
4439
|
}
|
|
@@ -4439,15 +4443,15 @@ class Pn extends R {
|
|
|
4439
4443
|
this.data.showMarkup || (this._renderedHeight = e);
|
|
4440
4444
|
}
|
|
4441
4445
|
}
|
|
4442
|
-
class
|
|
4446
|
+
class An extends R {
|
|
4443
4447
|
constructor(e, t, s) {
|
|
4444
4448
|
const i = e.ast.ordered ? "ol" : "ul", o = s && s.element.tagName === i.toUpperCase(), r = o ? s.element : document.createElement(i);
|
|
4445
4449
|
o || (r.className = "md-block md-list");
|
|
4446
|
-
const c = X(r, e.content, s?.children,
|
|
4450
|
+
const c = X(r, e.content, s?.children, de(t));
|
|
4447
4451
|
super(e, r, c);
|
|
4448
4452
|
}
|
|
4449
4453
|
}
|
|
4450
|
-
class
|
|
4454
|
+
class Dn extends R {
|
|
4451
4455
|
constructor(e, t, s) {
|
|
4452
4456
|
const i = e.ast, o = document.createElement("li");
|
|
4453
4457
|
e.isActive && o.classList.add("md-list-item-active"), i.checked !== void 0 && o.classList.add("md-task-list-item"), e.isActive || o.classList.add("md-markers-hidden"), e.isRunning && o.classList.add("md-task-list-item-running"), o.style.setProperty("--md-list-level", String(e.level));
|
|
@@ -4471,20 +4475,20 @@ class An extends R {
|
|
|
4471
4475
|
}
|
|
4472
4476
|
}
|
|
4473
4477
|
function qr(n, e, t, s) {
|
|
4474
|
-
const { paired: i, unused: o } =
|
|
4478
|
+
const { paired: i, unused: o } = rn(e, t?.children ?? F), r = e.map((d) => j(d, s, i.get(d)));
|
|
4475
4479
|
for (const d of o)
|
|
4476
4480
|
d.dispose();
|
|
4477
4481
|
if (!(e.length >= 2 && e[0].kind === "glue" && e[0].ast.glueKind === "indent" && e[1].kind === "marker" && e[1].ast.markerKind === "listItemMarker"))
|
|
4478
|
-
return
|
|
4482
|
+
return Q(n, r.map((d) => d.mountNode)), r;
|
|
4479
4483
|
const a = n.firstElementChild, l = a && a.classList.contains("md-list-gutter") ? a : document.createElement("span");
|
|
4480
|
-
return l.className = "md-list-gutter",
|
|
4484
|
+
return l.className = "md-list-gutter", Q(l, [r[0].mountNode, r[1].mountNode]), Q(n, [l, ...r.slice(2).map((d) => d.mountNode)]), r;
|
|
4481
4485
|
}
|
|
4482
|
-
class
|
|
4486
|
+
class Fn extends R {
|
|
4483
4487
|
_table;
|
|
4484
4488
|
constructor(e, t, s) {
|
|
4485
4489
|
const i = s?.dom ?? document.createElement("div"), o = s?._table ?? document.createElement("table");
|
|
4486
4490
|
s || (i.className = "md-block md-table-wrapper", o.className = "md-block md-table", i.appendChild(o));
|
|
4487
|
-
const r = X(o, js(e), s?.children,
|
|
4491
|
+
const r = X(o, js(e), s?.children, de(t));
|
|
4488
4492
|
super(e, i, r), this._table = o;
|
|
4489
4493
|
}
|
|
4490
4494
|
get element() {
|
|
@@ -4494,23 +4498,23 @@ class Dn extends R {
|
|
|
4494
4498
|
return this.dom;
|
|
4495
4499
|
}
|
|
4496
4500
|
}
|
|
4497
|
-
class
|
|
4501
|
+
class Vn extends R {
|
|
4498
4502
|
constructor(e, t, s) {
|
|
4499
4503
|
const i = s?.element ?? document.createElement("tr");
|
|
4500
4504
|
e.isDelimiter && i.classList.add("md-table-delimiter-row");
|
|
4501
|
-
const o = X(i, e.content, s?.children,
|
|
4505
|
+
const o = X(i, e.content, s?.children, de(t));
|
|
4502
4506
|
e.isDelimiter || e.content.forEach((r, c) => {
|
|
4503
4507
|
r.kind === "tableCell" && o[c].element.classList.toggle("md-table-cell-active", r.isActive);
|
|
4504
4508
|
}), super(e, i, o);
|
|
4505
4509
|
}
|
|
4506
4510
|
}
|
|
4507
|
-
class
|
|
4511
|
+
class $n extends R {
|
|
4508
4512
|
constructor(e, t, s) {
|
|
4509
4513
|
const i = s?.element ?? document.createElement("code"), o = X(i, e.content, s?.children, Ys(t));
|
|
4510
4514
|
super(e, i, o);
|
|
4511
4515
|
}
|
|
4512
4516
|
}
|
|
4513
|
-
class
|
|
4517
|
+
class Hn extends R {
|
|
4514
4518
|
constructor(e, t, s) {
|
|
4515
4519
|
if (e.showMarkup) {
|
|
4516
4520
|
const a = document.createElement("span");
|
|
@@ -4535,20 +4539,20 @@ class $n extends R {
|
|
|
4535
4539
|
const c = document.createElement("span");
|
|
4536
4540
|
c.className = "md-inline-math";
|
|
4537
4541
|
try {
|
|
4538
|
-
|
|
4542
|
+
Ss.render(o, c, { throwOnError: !1 });
|
|
4539
4543
|
} catch {
|
|
4540
4544
|
c.textContent = o;
|
|
4541
4545
|
}
|
|
4542
4546
|
super(e, c, F);
|
|
4543
4547
|
}
|
|
4544
4548
|
}
|
|
4545
|
-
class
|
|
4549
|
+
class Wn extends R {
|
|
4546
4550
|
_presentation;
|
|
4547
4551
|
_presentationSubscription;
|
|
4548
4552
|
constructor(e, t, s) {
|
|
4549
4553
|
s?._presentationSubscription?.dispose(), s && (s._presentationSubscription = void 0), s?._presentation?.dispose(), s && (s._presentation = void 0);
|
|
4550
|
-
const i = !e.showMarkup &&
|
|
4551
|
-
if (
|
|
4554
|
+
const i = !e.showMarkup && Dt(e.ast.url) ? t?.linkPresentationProvider?.createLinkPresentation(e.ast.url) : void 0, o = i ? "SPAN" : "A", r = s?.element.tagName === o ? s.element : document.createElement(o.toLowerCase());
|
|
4555
|
+
if (Dt(e.ast.url) ? (r.dataset.mdUrl = e.ast.url, r instanceof HTMLAnchorElement && (r.href = e.ast.url)) : (r.removeAttribute("href"), delete r.dataset.mdUrl), i ? (r.setAttribute("role", "link"), r.tabIndex = 0) : (r.removeAttribute("role"), r.removeAttribute("tabindex")), r !== s?.element) {
|
|
4552
4556
|
const d = (m) => !r.dataset.mdUrl || m.button !== 0 && m.button !== 1 ? !1 : m.button === 1 ? !0 : !(r.closest(".md-block-active") !== null) || m.ctrlKey || m.metaKey, u = (m) => {
|
|
4553
4557
|
const g = r.dataset.mdUrl;
|
|
4554
4558
|
if (!g)
|
|
@@ -4569,32 +4573,32 @@ class Hn extends R {
|
|
|
4569
4573
|
});
|
|
4570
4574
|
}
|
|
4571
4575
|
let c;
|
|
4572
|
-
const a = i ? r.querySelector(":scope > .md-rich-link-label") ?? document.createElement("span") : r, l = X(a, e.content, s?.children,
|
|
4573
|
-
if (i ? c =
|
|
4576
|
+
const a = i ? r.querySelector(":scope > .md-rich-link-label") ?? document.createElement("span") : r, l = X(a, e.content, s?.children, de(t));
|
|
4577
|
+
if (i ? c = Ie.mount(r, a) : (Ie.clear(r), Q(r, l.map((d) => d.mountNode))), super(e, r, l), i && c) {
|
|
4574
4578
|
this._presentation = i;
|
|
4575
4579
|
const d = () => c.update(i.presentation.get());
|
|
4576
|
-
d(), this._presentationSubscription =
|
|
4580
|
+
d(), this._presentationSubscription = Kt(i.presentation, d);
|
|
4577
4581
|
}
|
|
4578
4582
|
}
|
|
4579
4583
|
dispose() {
|
|
4580
4584
|
this._presentationSubscription?.dispose(), this._presentationSubscription = void 0, this._presentation?.dispose(), this._presentation = void 0, super.dispose();
|
|
4581
4585
|
}
|
|
4582
4586
|
}
|
|
4583
|
-
class
|
|
4587
|
+
class Kn extends R {
|
|
4584
4588
|
constructor(e, t, s) {
|
|
4585
4589
|
const i = e.ast;
|
|
4586
4590
|
if (e.showMarkup) {
|
|
4587
4591
|
const r = document.createElement("span");
|
|
4588
4592
|
r.className = "md-image-source";
|
|
4589
|
-
const c = X(r, e.content, s?.children,
|
|
4593
|
+
const c = X(r, e.content, s?.children, de(t));
|
|
4590
4594
|
super(e, r, c);
|
|
4591
4595
|
return;
|
|
4592
4596
|
}
|
|
4593
4597
|
const o = document.createElement("img");
|
|
4594
|
-
|
|
4598
|
+
Dt(i.url) && (o.src = i.url), o.alt = i.alt, super(e, o, F);
|
|
4595
4599
|
}
|
|
4596
4600
|
}
|
|
4597
|
-
function
|
|
4601
|
+
function rn(n, e) {
|
|
4598
4602
|
const t = /* @__PURE__ */ new Map();
|
|
4599
4603
|
for (const i of e)
|
|
4600
4604
|
t.set(i.ast.id, i);
|
|
@@ -4605,10 +4609,10 @@ function on(n, e) {
|
|
|
4605
4609
|
}
|
|
4606
4610
|
return { paired: s, unused: [...t.values()] };
|
|
4607
4611
|
}
|
|
4608
|
-
function
|
|
4612
|
+
function Dt(n) {
|
|
4609
4613
|
return !n.trim().toLowerCase().startsWith("javascript:");
|
|
4610
4614
|
}
|
|
4611
|
-
class
|
|
4615
|
+
class cn extends oe {
|
|
4612
4616
|
constructor(e, t, s, i, o) {
|
|
4613
4617
|
super(e, t, i), this.blocks = s, this.pendingParagraph = o;
|
|
4614
4618
|
}
|
|
@@ -4617,15 +4621,15 @@ class rn extends oe {
|
|
|
4617
4621
|
i.classList.add("md-document");
|
|
4618
4622
|
const o = new Map(
|
|
4619
4623
|
e.children.filter((f) => f.kind === "block").map((f) => [f.view, f.isActive])
|
|
4620
|
-
), r = s?.children, c = e.children.map((f) => f.view), { paired: a, unused: l } =
|
|
4624
|
+
), r = s?.children, c = e.children.map((f) => f.view), { paired: a, unused: l } = rn(c, r ?? Gr);
|
|
4621
4625
|
let d;
|
|
4622
4626
|
const u = c.map((f, m) => {
|
|
4623
4627
|
const g = a.get(f);
|
|
4624
4628
|
if (e.children[m].kind === "pendingParagraph") {
|
|
4625
|
-
const p = f, v = g instanceof
|
|
4629
|
+
const p = f, v = g instanceof zn ? g : new zn(p);
|
|
4626
4630
|
return v.update(p.text), d = v, v;
|
|
4627
4631
|
}
|
|
4628
|
-
const _ =
|
|
4632
|
+
const _ = j(f, t, g);
|
|
4629
4633
|
if (e.children[m].kind === "block") {
|
|
4630
4634
|
const p = o.get(f);
|
|
4631
4635
|
p !== void 0 && (_.element.classList.toggle("md-block-active", p), _.element.classList.toggle("md-markers-hidden", !p));
|
|
@@ -4636,18 +4640,18 @@ class rn extends oe {
|
|
|
4636
4640
|
});
|
|
4637
4641
|
for (const f of l)
|
|
4638
4642
|
f.dispose();
|
|
4639
|
-
|
|
4643
|
+
Q(i, u.map((f) => f.mountNode));
|
|
4640
4644
|
const h = [];
|
|
4641
4645
|
return e.children.forEach((f, m) => {
|
|
4642
4646
|
f.kind === "block" && h.push({ node: u[m], absoluteStart: f.absoluteStart });
|
|
4643
|
-
}), new
|
|
4647
|
+
}), new cn(e.ast, i, h, u, d);
|
|
4644
4648
|
}
|
|
4645
4649
|
/** The stable content element this document mounts its children into. */
|
|
4646
4650
|
get contentDomNode() {
|
|
4647
4651
|
return this.dom;
|
|
4648
4652
|
}
|
|
4649
4653
|
}
|
|
4650
|
-
class
|
|
4654
|
+
class zn extends oe {
|
|
4651
4655
|
element;
|
|
4652
4656
|
anchorBlock;
|
|
4653
4657
|
cursorLine;
|
|
@@ -4681,13 +4685,13 @@ class Kn extends oe {
|
|
|
4681
4685
|
return new DOMRect(i?.right ?? e.left, e.top, 0, e.height);
|
|
4682
4686
|
}
|
|
4683
4687
|
}
|
|
4684
|
-
const Gr = [],
|
|
4685
|
-
class
|
|
4688
|
+
const Gr = [], qe = 1e-7;
|
|
4689
|
+
class mt {
|
|
4686
4690
|
constructor(e) {
|
|
4687
4691
|
this._getLocalToClientMatrix = e;
|
|
4688
4692
|
}
|
|
4689
4693
|
static forSvgOverlay(e) {
|
|
4690
|
-
return new
|
|
4694
|
+
return new mt(() => {
|
|
4691
4695
|
if (!e.isConnected)
|
|
4692
4696
|
return new DOMMatrix();
|
|
4693
4697
|
const t = e.getScreenCTM();
|
|
@@ -4698,7 +4702,7 @@ class pt {
|
|
|
4698
4702
|
}
|
|
4699
4703
|
capture() {
|
|
4700
4704
|
const e = this._getLocalToClientMatrix();
|
|
4701
|
-
if (e.is2D === !1 || Math.abs(e.b) >
|
|
4705
|
+
if (e.is2D === !1 || Math.abs(e.b) > qe || Math.abs(e.c) > qe || e.a <= qe || e.d <= qe)
|
|
4702
4706
|
throw new Error("Markdown editor geometry supports positive axis-aligned scale and translation only");
|
|
4703
4707
|
return new Ur(e);
|
|
4704
4708
|
}
|
|
@@ -4710,11 +4714,11 @@ class Ur {
|
|
|
4710
4714
|
_clientToLocal;
|
|
4711
4715
|
toLocalPoint(e) {
|
|
4712
4716
|
const t = new DOMPoint(e.x, e.y).matrixTransform(this._clientToLocal);
|
|
4713
|
-
return new
|
|
4717
|
+
return new ue(t.x, t.y);
|
|
4714
4718
|
}
|
|
4715
4719
|
toClientPoint(e) {
|
|
4716
4720
|
const t = new DOMPoint(e.x, e.y).matrixTransform(this._localToClient);
|
|
4717
|
-
return new
|
|
4721
|
+
return new ue(t.x, t.y);
|
|
4718
4722
|
}
|
|
4719
4723
|
toLocalRect(e) {
|
|
4720
4724
|
return this._convertRect(e, this._clientToLocal);
|
|
@@ -4891,7 +4895,7 @@ class _c {
|
|
|
4891
4895
|
kind = "diffDecoration";
|
|
4892
4896
|
}
|
|
4893
4897
|
const ri = { showMarkup: !1, showTableGlue: !1, selectionInNode: void 0 };
|
|
4894
|
-
function
|
|
4898
|
+
function te(n) {
|
|
4895
4899
|
return n.inlineFlow ? n : { ...n, inlineFlow: !0 };
|
|
4896
4900
|
}
|
|
4897
4901
|
function ci(n, e, t, s, i) {
|
|
@@ -4907,7 +4911,7 @@ function ci(n, e, t, s, i) {
|
|
|
4907
4911
|
const f = h, m = e.has(f), g = o.get(f), _ = i?.anchorBlock === f ? i.replaceRange.delta(-d) : void 0;
|
|
4908
4912
|
let p;
|
|
4909
4913
|
if (!m)
|
|
4910
|
-
p = g && !g.isActive && !_ ? g.view :
|
|
4914
|
+
p = g && !g.isActive && !_ ? g.view : Ft(f, {
|
|
4911
4915
|
...ri,
|
|
4912
4916
|
pendingAnchorBlock: _ ? f : void 0,
|
|
4913
4917
|
pendingReplacementInBlock: _
|
|
@@ -4917,7 +4921,7 @@ function ci(n, e, t, s, i) {
|
|
|
4917
4921
|
Math.max(0, t.start - d),
|
|
4918
4922
|
Math.min(f.length, t.endExclusive - d)
|
|
4919
4923
|
) : void 0;
|
|
4920
|
-
p =
|
|
4924
|
+
p = Ft(f, {
|
|
4921
4925
|
showMarkup: !0,
|
|
4922
4926
|
showTableGlue: !1,
|
|
4923
4927
|
selectionInNode: v,
|
|
@@ -4939,11 +4943,11 @@ function ci(n, e, t, s, i) {
|
|
|
4939
4943
|
}
|
|
4940
4944
|
return new ii(n, a, l);
|
|
4941
4945
|
}
|
|
4942
|
-
function
|
|
4946
|
+
function Ft(n, e, t) {
|
|
4943
4947
|
return Te(n, e, t);
|
|
4944
4948
|
}
|
|
4945
4949
|
function vc(n, e, t) {
|
|
4946
|
-
return
|
|
4950
|
+
return Ft(n, e ? { showMarkup: !0, showTableGlue: !1, selectionInNode: void 0 } : ri, t);
|
|
4947
4951
|
}
|
|
4948
4952
|
function wc(n, e, t = !1) {
|
|
4949
4953
|
const s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
@@ -4964,25 +4968,25 @@ function wc(n, e, t = !1) {
|
|
|
4964
4968
|
}
|
|
4965
4969
|
const d = l.view;
|
|
4966
4970
|
for (const g of i.get(d.ast) ?? [])
|
|
4967
|
-
c.push(
|
|
4971
|
+
c.push(kt(g.node, g.deletedLocal, l.absoluteStart, !0, g.originalStart, t));
|
|
4968
4972
|
const u = s.get(d.ast);
|
|
4969
|
-
u && u.kind === "replaced" && u.deletedLocal.length > 0 && c.push(
|
|
4973
|
+
u && u.kind === "replaced" && u.deletedLocal.length > 0 && c.push(kt(u.original, u.deletedLocal, l.absoluteStart, !1, u.originalStart, t));
|
|
4970
4974
|
const h = u && u.kind === "nested" ? ai(d, u, t) : d, f = u?.kind === "added" ? "added" : u?.kind === "replaced" ? "modified" : void 0, m = f ? { ...l, diffKind: f } : h !== d ? { ...l, view: h } : l;
|
|
4971
4975
|
c.push(m), a.push({ ast: d.ast, absoluteStart: l.absoluteStart, isActive: l.isActive, view: h });
|
|
4972
4976
|
}
|
|
4973
4977
|
for (const l of r)
|
|
4974
|
-
c.push(
|
|
4978
|
+
c.push(kt(l.node, l.deletedLocal, n.ast.length, !0, l.originalStart, t));
|
|
4975
4979
|
return new ii(n.ast, a, c);
|
|
4976
4980
|
}
|
|
4977
|
-
function
|
|
4981
|
+
function kt(n, e, t, s, i, o) {
|
|
4978
4982
|
return {
|
|
4979
4983
|
absoluteStart: t,
|
|
4980
4984
|
isActive: !1,
|
|
4981
|
-
view:
|
|
4985
|
+
view: Ze(n, e, s, i, o),
|
|
4982
4986
|
kind: "diffDecoration"
|
|
4983
4987
|
};
|
|
4984
4988
|
}
|
|
4985
|
-
function
|
|
4989
|
+
function Ze(n, e, t, s, i) {
|
|
4986
4990
|
return new _c(n, vc(n, i || !t), e, t, s);
|
|
4987
4991
|
}
|
|
4988
4992
|
function ai(n, e, t) {
|
|
@@ -4999,12 +5003,12 @@ function ai(n, e, t) {
|
|
|
4999
5003
|
const r = n.content ?? [], c = [];
|
|
5000
5004
|
for (const a of r) {
|
|
5001
5005
|
for (const d of i.get(a.ast) ?? [])
|
|
5002
|
-
c.push(
|
|
5006
|
+
c.push(Ze(d.node, d.deletedLocal, !0, d.originalStart, t));
|
|
5003
5007
|
const l = s.get(a.ast);
|
|
5004
|
-
l && l.kind === "replaced" && l.deletedLocal.length > 0 ? (c.push(
|
|
5008
|
+
l && l.kind === "replaced" && l.deletedLocal.length > 0 ? (c.push(Ze(l.original, l.deletedLocal, !1, l.originalStart, t)), c.push(a)) : l && l.kind === "nested" ? c.push(ai(a, l, t)) : c.push(a);
|
|
5005
5009
|
}
|
|
5006
5010
|
for (const a of o)
|
|
5007
|
-
c.push(
|
|
5011
|
+
c.push(Ze(a.node, a.deletedLocal, !0, a.originalStart, t));
|
|
5008
5012
|
return bc(n, c);
|
|
5009
5013
|
}
|
|
5010
5014
|
function bc(n, e) {
|
|
@@ -5046,9 +5050,9 @@ function Te(n, e, t, s) {
|
|
|
5046
5050
|
case "glue":
|
|
5047
5051
|
return O(t, new oi(i, Cc(i.glueKind, e), e.inlineFlow ?? !1));
|
|
5048
5052
|
case "heading":
|
|
5049
|
-
return O(t, new Xr(i, $(i.children,
|
|
5053
|
+
return O(t, new Xr(i, $(i.children, te(e), t)));
|
|
5050
5054
|
case "paragraph":
|
|
5051
|
-
return O(t, new Yr(i, $(i.children,
|
|
5055
|
+
return O(t, new Yr(i, $(i.children, te(e), t)));
|
|
5052
5056
|
case "frontMatter":
|
|
5053
5057
|
return O(t, new Qr(i, e.showMarkup, $(i.children, e, t)));
|
|
5054
5058
|
case "codeBlock":
|
|
@@ -5056,7 +5060,7 @@ function Te(n, e, t, s) {
|
|
|
5056
5060
|
case "mathBlock":
|
|
5057
5061
|
return O(t, new Jr(i, e.showMarkup, $(i.children, e, t)));
|
|
5058
5062
|
case "blockQuote": {
|
|
5059
|
-
const o = xc(i), r = e.pendingAnchorBlock ?
|
|
5063
|
+
const o = xc(i), r = e.pendingAnchorBlock ? Y(e.pendingAnchorBlock, i) : void 0, c = o && r !== void 0 ? o.delta(r) : void 0, a = !c || !e.pendingReplacementInBlock?.containsRange(c);
|
|
5060
5064
|
return O(t, new ec(i, $(i.children, e, t), a));
|
|
5061
5065
|
}
|
|
5062
5066
|
case "list":
|
|
@@ -5070,38 +5074,38 @@ function Te(n, e, t, s) {
|
|
|
5070
5074
|
case "tableCell":
|
|
5071
5075
|
return O(t, ui(i, e.showMarkup, e.showTableGlue, e.selectionInNode, t));
|
|
5072
5076
|
case "strong":
|
|
5073
|
-
return O(t, new sc(i, $(i.children,
|
|
5077
|
+
return O(t, new sc(i, $(i.children, te(e), t)));
|
|
5074
5078
|
case "emphasis":
|
|
5075
|
-
return O(t, new ic(i, $(i.children,
|
|
5079
|
+
return O(t, new ic(i, $(i.children, te(e), t)));
|
|
5076
5080
|
case "strikethrough":
|
|
5077
|
-
return O(t, new oc(i, $(i.children,
|
|
5081
|
+
return O(t, new oc(i, $(i.children, te(e), t)));
|
|
5078
5082
|
case "inlineCode":
|
|
5079
|
-
return O(t, new rc(i, $(i.children,
|
|
5083
|
+
return O(t, new rc(i, $(i.children, te(e), t)));
|
|
5080
5084
|
case "inlineMath":
|
|
5081
|
-
return O(t, new cc(i, e.showMarkup, $(i.children,
|
|
5085
|
+
return O(t, new cc(i, e.showMarkup, $(i.children, te(e), t)));
|
|
5082
5086
|
case "link":
|
|
5083
|
-
return O(t, new ac(i, e.showMarkup, $(i.children,
|
|
5087
|
+
return O(t, new ac(i, e.showMarkup, $(i.children, te(e), t)));
|
|
5084
5088
|
case "image":
|
|
5085
|
-
return O(t, new lc(i, e.showMarkup, $(i.children,
|
|
5089
|
+
return O(t, new lc(i, e.showMarkup, $(i.children, te(e), t)));
|
|
5086
5090
|
case "document":
|
|
5087
5091
|
return ci(i, /* @__PURE__ */ new Set(), w.ofLength(0), void 0);
|
|
5088
5092
|
}
|
|
5089
5093
|
}
|
|
5090
|
-
function
|
|
5094
|
+
function Vt(n) {
|
|
5091
5095
|
return n.kind === "document" ? n.blocks.map((e) => e.view) : "content" in n ? n.content : kc;
|
|
5092
5096
|
}
|
|
5093
5097
|
const kc = [];
|
|
5094
|
-
function
|
|
5098
|
+
function $e(n) {
|
|
5095
5099
|
if (!n)
|
|
5096
5100
|
return;
|
|
5097
5101
|
const e = /* @__PURE__ */ new Map();
|
|
5098
|
-
for (const t of
|
|
5102
|
+
for (const t of Vt(n))
|
|
5099
5103
|
e.set(t.ast, t);
|
|
5100
5104
|
return e;
|
|
5101
5105
|
}
|
|
5102
5106
|
function O(n, e) {
|
|
5103
5107
|
if (n && n.kind === e.kind && n.ast === e.ast && yc(n, e)) {
|
|
5104
|
-
const t =
|
|
5108
|
+
const t = Vt(n), s = Vt(e);
|
|
5105
5109
|
if (t.length === s.length && t.every((i, o) => i === s[o]))
|
|
5106
5110
|
return n;
|
|
5107
5111
|
}
|
|
@@ -5150,16 +5154,16 @@ function xc(n) {
|
|
|
5150
5154
|
return t;
|
|
5151
5155
|
}
|
|
5152
5156
|
function $(n, e, t) {
|
|
5153
|
-
const s =
|
|
5157
|
+
const s = $e(t);
|
|
5154
5158
|
return n.map((i, o) => {
|
|
5155
5159
|
const r = i.kind === "text" ? {
|
|
5156
|
-
left: o > 0 &&
|
|
5157
|
-
right: o < n.length - 1 &&
|
|
5160
|
+
left: o > 0 && qn(n[o - 1], "end"),
|
|
5161
|
+
right: o < n.length - 1 && qn(n[o + 1], "start")
|
|
5158
5162
|
} : void 0;
|
|
5159
5163
|
return Te(i, e, s?.get(i), r);
|
|
5160
5164
|
});
|
|
5161
5165
|
}
|
|
5162
|
-
function
|
|
5166
|
+
function qn(n, e) {
|
|
5163
5167
|
switch (n.kind) {
|
|
5164
5168
|
case "text": {
|
|
5165
5169
|
const t = n.content, s = e === "end" ? t[t.length - 1] : t[0];
|
|
@@ -5184,7 +5188,7 @@ function Ec(n, e) {
|
|
|
5184
5188
|
function Cc(n, e) {
|
|
5185
5189
|
return e.showMarkup || n === "tableCellGlue" && e.showTableGlue;
|
|
5186
5190
|
}
|
|
5187
|
-
const
|
|
5191
|
+
const Gn = ":running:";
|
|
5188
5192
|
function Sc(n) {
|
|
5189
5193
|
if (n.checked === void 0)
|
|
5190
5194
|
return;
|
|
@@ -5198,11 +5202,11 @@ function Sc(n) {
|
|
|
5198
5202
|
let i = 0;
|
|
5199
5203
|
for (; i < s.length && (s[i] === " " || s[i] === " "); )
|
|
5200
5204
|
i++;
|
|
5201
|
-
if (s.startsWith(
|
|
5202
|
-
return { text: t, hiddenLength: i +
|
|
5205
|
+
if (s.startsWith(Gn, i))
|
|
5206
|
+
return { text: t, hiddenLength: i + Gn.length };
|
|
5203
5207
|
}
|
|
5204
5208
|
function Lc(n, e, t) {
|
|
5205
|
-
const s =
|
|
5209
|
+
const s = $e(t), i = Tc(n, e), o = new Set(n.items), r = (e.listLevel ?? 0) + 1, c = [];
|
|
5206
5210
|
let a = 0;
|
|
5207
5211
|
for (const l of n.children) {
|
|
5208
5212
|
if (o.has(l)) {
|
|
@@ -5220,7 +5224,7 @@ function Lc(n, e, t) {
|
|
|
5220
5224
|
return new tc(n, c);
|
|
5221
5225
|
}
|
|
5222
5226
|
function di(n, e, t) {
|
|
5223
|
-
const s =
|
|
5227
|
+
const s = $e(t), i = e.showMarkup ? void 0 : Sc(n), o = i !== void 0, r = o ? { ...e, hideRunnerMarkerNode: i.text, hideRunnerMarkerLength: i.hiddenLength } : e, c = [];
|
|
5224
5228
|
let a = 0;
|
|
5225
5229
|
for (const l of n.children) {
|
|
5226
5230
|
const d = r.selectionInNode ? { ...r, selectionInNode: r.selectionInNode.delta(-a) } : r;
|
|
@@ -5229,7 +5233,7 @@ function di(n, e, t) {
|
|
|
5229
5233
|
return new dc(n, e.showMarkup, c, e.listLevel ?? 1, o);
|
|
5230
5234
|
}
|
|
5231
5235
|
function Mc(n, e, t) {
|
|
5232
|
-
const s =
|
|
5236
|
+
const s = $e(t), i = e.showMarkup, o = n.delimiterRow, r = new Set(
|
|
5233
5237
|
[n.headerRow, n.delimiterRow, ...n.bodyRows].filter((l) => l !== void 0)
|
|
5234
5238
|
), c = [];
|
|
5235
5239
|
let a = 0;
|
|
@@ -5248,7 +5252,7 @@ function Mc(n, e, t) {
|
|
|
5248
5252
|
return new nc(n, c);
|
|
5249
5253
|
}
|
|
5250
5254
|
function hi(n, e, t, s) {
|
|
5251
|
-
const i =
|
|
5255
|
+
const i = $e(s), o = e.showMarkup, r = t ? void 0 : Oc(n, e), c = new Set(n.cells), a = [];
|
|
5252
5256
|
let l = 0;
|
|
5253
5257
|
for (const d of n.children) {
|
|
5254
5258
|
if (c.has(d)) {
|
|
@@ -5262,7 +5266,7 @@ function hi(n, e, t, s) {
|
|
|
5262
5266
|
}
|
|
5263
5267
|
function ui(n, e, t, s, i) {
|
|
5264
5268
|
const o = { showMarkup: e, showTableGlue: t, selectionInNode: s };
|
|
5265
|
-
return new uc(n, e, t, $(n.children,
|
|
5269
|
+
return new uc(n, e, t, $(n.children, te(o), i));
|
|
5266
5270
|
}
|
|
5267
5271
|
const it = /* @__PURE__ */ new Set();
|
|
5268
5272
|
function Tc(n, e) {
|
|
@@ -5270,7 +5274,7 @@ function Tc(n, e) {
|
|
|
5270
5274
|
return it;
|
|
5271
5275
|
const t = e.selectionInNode;
|
|
5272
5276
|
if (t.isEmpty) {
|
|
5273
|
-
const o =
|
|
5277
|
+
const o = Zt(n, t.start);
|
|
5274
5278
|
return o === void 0 ? it : /* @__PURE__ */ new Set([o]);
|
|
5275
5279
|
}
|
|
5276
5280
|
const s = /* @__PURE__ */ new Set();
|
|
@@ -5322,11 +5326,11 @@ function Nc(n) {
|
|
|
5322
5326
|
};
|
|
5323
5327
|
return t(n, 0), e;
|
|
5324
5328
|
}
|
|
5325
|
-
function
|
|
5329
|
+
function Un(n, e) {
|
|
5326
5330
|
const t = document.createRange();
|
|
5327
5331
|
return t.setStart(n.text, e.start - n.start), t.setEnd(n.text, e.endExclusive - n.start), t;
|
|
5328
5332
|
}
|
|
5329
|
-
function
|
|
5333
|
+
function gt(n, e, t = Number.POSITIVE_INFINITY) {
|
|
5330
5334
|
if (t <= 0)
|
|
5331
5335
|
return [];
|
|
5332
5336
|
const s = Nc(n), i = e.slice().sort((c, a) => c.start - a.start || c.endExclusive - a.endExclusive), o = [];
|
|
@@ -5334,7 +5338,7 @@ function _t(n, e, t = Number.POSITIVE_INFINITY) {
|
|
|
5334
5338
|
for (const c of i) {
|
|
5335
5339
|
if (c.isEmpty) {
|
|
5336
5340
|
const a = Ic(s, c.start);
|
|
5337
|
-
if (a && (o.push({ range:
|
|
5341
|
+
if (a && (o.push({ range: Un(a, c), sourceRange: c }), o.length >= t))
|
|
5338
5342
|
return o;
|
|
5339
5343
|
continue;
|
|
5340
5344
|
}
|
|
@@ -5347,21 +5351,21 @@ function _t(n, e, t = Number.POSITIVE_INFINITY) {
|
|
|
5347
5351
|
const d = c.intersect(
|
|
5348
5352
|
w.ofStartAndLength(l.start, l.len)
|
|
5349
5353
|
);
|
|
5350
|
-
if (!(!d || d.isEmpty) && (o.push({ range:
|
|
5354
|
+
if (!(!d || d.isEmpty) && (o.push({ range: Un(l, d), sourceRange: d }), o.length >= t))
|
|
5351
5355
|
return o;
|
|
5352
5356
|
}
|
|
5353
5357
|
}
|
|
5354
5358
|
return o;
|
|
5355
5359
|
}
|
|
5356
|
-
function
|
|
5357
|
-
return
|
|
5360
|
+
function yt(n, e) {
|
|
5361
|
+
return gt(n, e).map((t) => t.range);
|
|
5358
5362
|
}
|
|
5359
5363
|
function Ic(n, e) {
|
|
5360
5364
|
return n.find((t) => t.start <= e && e <= t.start + t.len);
|
|
5361
5365
|
}
|
|
5362
5366
|
class Pc extends H {
|
|
5363
5367
|
constructor(e, t) {
|
|
5364
|
-
super(), this._parent = e, this.element = document.createElement("div"), this.element.className = "md-diff-highlight-layer", t ? (this._coordinateSpace = t, this._coordinateProbe = void 0) : (this._coordinateProbe = document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._coordinateProbe.setAttribute("aria-hidden", "true"), this._coordinateProbe.style.position = "absolute", this._coordinateProbe.style.inset = "0", this._coordinateProbe.style.width = "100%", this._coordinateProbe.style.height = "100%", this._coordinateProbe.style.visibility = "hidden", this._coordinateProbe.style.pointerEvents = "none", this.element.appendChild(this._coordinateProbe), this._coordinateSpace =
|
|
5368
|
+
super(), this._parent = e, this.element = document.createElement("div"), this.element.className = "md-diff-highlight-layer", t ? (this._coordinateSpace = t, this._coordinateProbe = void 0) : (this._coordinateProbe = document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._coordinateProbe.setAttribute("aria-hidden", "true"), this._coordinateProbe.style.position = "absolute", this._coordinateProbe.style.inset = "0", this._coordinateProbe.style.width = "100%", this._coordinateProbe.style.height = "100%", this._coordinateProbe.style.visibility = "hidden", this._coordinateProbe.style.pointerEvents = "none", this.element.appendChild(this._coordinateProbe), this._coordinateSpace = mt.forSvgOverlay(this._coordinateProbe)), this._resizeObserver = new ResizeObserver(() => {
|
|
5365
5369
|
this._last && this._repaint(this._last);
|
|
5366
5370
|
}), this._resizeObserver.observe(this._parent), this._register({ dispose: () => {
|
|
5367
5371
|
this._resizeObserver.disconnect(), this.element.remove();
|
|
@@ -5387,14 +5391,14 @@ class Pc extends H {
|
|
|
5387
5391
|
}
|
|
5388
5392
|
_repaint(e) {
|
|
5389
5393
|
const t = [], s = [];
|
|
5390
|
-
e.inserted && t.push(...
|
|
5394
|
+
e.inserted && t.push(...yt(e.node, e.inserted));
|
|
5391
5395
|
const i = (o) => {
|
|
5392
|
-
if (o instanceof
|
|
5393
|
-
o.whole || s.push(...
|
|
5394
|
-
else if (o instanceof
|
|
5396
|
+
if (o instanceof At)
|
|
5397
|
+
o.whole || s.push(...yt(o.sideNode, o.deletedRanges.map((r) => r.range)));
|
|
5398
|
+
else if (o instanceof Bt)
|
|
5395
5399
|
for (const r of o.sides)
|
|
5396
5400
|
for (const c of r.ranges) {
|
|
5397
|
-
const a =
|
|
5401
|
+
const a = yt(r.node, [c.range]);
|
|
5398
5402
|
(c.kind === "inserted" ? t : s).push(...a);
|
|
5399
5403
|
}
|
|
5400
5404
|
for (const r of o.children)
|
|
@@ -5432,16 +5436,16 @@ class Bc extends H {
|
|
|
5432
5436
|
}));
|
|
5433
5437
|
}
|
|
5434
5438
|
}
|
|
5435
|
-
class
|
|
5439
|
+
class Xn {
|
|
5436
5440
|
constructor(e) {
|
|
5437
5441
|
this.rects = e;
|
|
5438
5442
|
}
|
|
5439
5443
|
}
|
|
5440
5444
|
function Ac(n, e, t, s) {
|
|
5441
5445
|
if (!e || e.isCollapsed)
|
|
5442
|
-
return n.setAttribute("d", ""), new
|
|
5446
|
+
return n.setAttribute("d", ""), new Xn([]);
|
|
5443
5447
|
const i = fi(e.range, t, s);
|
|
5444
|
-
return n.setAttribute("d", gi(i, 4)), new
|
|
5448
|
+
return n.setAttribute("d", gi(i, 4)), new Xn(i);
|
|
5445
5449
|
}
|
|
5446
5450
|
const Dc = 0.4;
|
|
5447
5451
|
function fi(n, e, t) {
|
|
@@ -5494,14 +5498,14 @@ function fi(n, e, t) {
|
|
|
5494
5498
|
if (E <= b)
|
|
5495
5499
|
continue;
|
|
5496
5500
|
const x = d.get(f), T = l.get(m);
|
|
5497
|
-
if (x === void 0 &&
|
|
5501
|
+
if (x === void 0 && xt(e, f) || T === void 0 && xt(e, m))
|
|
5498
5502
|
continue;
|
|
5499
|
-
const V = x !== void 0 ? a[x] : { left: p.left, right: p.right },
|
|
5500
|
-
|
|
5503
|
+
const V = x !== void 0 ? a[x] : { left: p.left, right: p.right }, he = T !== void 0 ? a[T] : { left: v.left, right: v.right }, an = Math.max(V.left, he.left), ln = Math.min(V.right, he.right);
|
|
5504
|
+
ln <= an || c.push(i(an, b, ln, E));
|
|
5501
5505
|
}
|
|
5502
5506
|
for (const h of t) {
|
|
5503
5507
|
const f = w.ofStartAndLength(h.absoluteStart, h.block.length);
|
|
5504
|
-
s.intersects(f) && (
|
|
5508
|
+
s.intersects(f) && (xt(e, h) || c.push(h.rect));
|
|
5505
5509
|
}
|
|
5506
5510
|
return c;
|
|
5507
5511
|
}
|
|
@@ -5513,7 +5517,7 @@ function ot(n) {
|
|
|
5513
5517
|
s.sourceStart < e && (e = s.sourceStart), s.sourceEndExclusive > t && (t = s.sourceEndExclusive);
|
|
5514
5518
|
return w.fromTo(e, t);
|
|
5515
5519
|
}
|
|
5516
|
-
function
|
|
5520
|
+
function xt(n, e) {
|
|
5517
5521
|
const t = w.ofStartAndLength(e.absoluteStart, e.block.length);
|
|
5518
5522
|
for (const s of n.sourceLines) {
|
|
5519
5523
|
const i = ot(s);
|
|
@@ -5575,29 +5579,29 @@ function Hc(n, e) {
|
|
|
5575
5579
|
return "";
|
|
5576
5580
|
const s = new Array(t);
|
|
5577
5581
|
for (let r = 0; r < t; r++) {
|
|
5578
|
-
const c = n[(r + t - 1) % t], a = n[(r + 1) % t], l =
|
|
5582
|
+
const c = n[(r + t - 1) % t], a = n[(r + 1) % t], l = Ge(n[r], c), d = Ge(n[r], a);
|
|
5579
5583
|
s[r] = Math.min(e, l / 2, d / 2);
|
|
5580
5584
|
}
|
|
5581
|
-
const i =
|
|
5585
|
+
const i = Et(n[t - 1], n[0], Ge(n[t - 1], n[0]) - s[0]), o = [`M${ee(i.x)},${ee(i.y)}`];
|
|
5582
5586
|
for (let r = 0; r < t; r++) {
|
|
5583
|
-
const c = n[r], a = n[(r + 1) % t], l = s[r], d =
|
|
5584
|
-
l > 0 ? o.push(`A${
|
|
5585
|
-
const u = s[(r + 1) % t], h =
|
|
5586
|
-
o.push(`L${
|
|
5587
|
+
const c = n[r], a = n[(r + 1) % t], l = s[r], d = Et(c, a, l);
|
|
5588
|
+
l > 0 ? o.push(`A${ee(l)},${ee(l)} 0 0 ${c.convex ? 1 : 0} ${ee(d.x)},${ee(d.y)}`) : o.push(`L${ee(d.x)},${ee(d.y)}`);
|
|
5589
|
+
const u = s[(r + 1) % t], h = Et(c, a, Ge(c, a) - u);
|
|
5590
|
+
o.push(`L${ee(h.x)},${ee(h.y)}`);
|
|
5587
5591
|
}
|
|
5588
5592
|
return o.push("Z"), o.join(" ");
|
|
5589
5593
|
}
|
|
5590
|
-
function
|
|
5594
|
+
function Ge(n, e) {
|
|
5591
5595
|
return Math.hypot(n.x - e.x, n.y - e.y);
|
|
5592
5596
|
}
|
|
5593
|
-
function
|
|
5597
|
+
function Et(n, e, t) {
|
|
5594
5598
|
const s = e.x - n.x, i = e.y - n.y, o = Math.hypot(s, i);
|
|
5595
5599
|
if (o === 0)
|
|
5596
5600
|
return { x: n.x, y: n.y };
|
|
5597
5601
|
const r = t / o;
|
|
5598
5602
|
return { x: n.x + s * r, y: n.y + i * r };
|
|
5599
5603
|
}
|
|
5600
|
-
function
|
|
5604
|
+
function ee(n) {
|
|
5601
5605
|
return n.toFixed(2);
|
|
5602
5606
|
}
|
|
5603
5607
|
class Wc extends H {
|
|
@@ -5607,12 +5611,12 @@ class Wc extends H {
|
|
|
5607
5611
|
super(), this.element = document.createElement("div"), this.element.className = "md-cursor", this.rendering = P(this, (t) => {
|
|
5608
5612
|
const s = t.readObservable(e.position), i = t.readObservable(e.visualLineMap);
|
|
5609
5613
|
if (s === void 0 || i.isEmpty)
|
|
5610
|
-
return this.element.style.display = "none", new
|
|
5614
|
+
return this.element.style.display = "none", new Ue(s ?? N.source(0), !1, S.EMPTY);
|
|
5611
5615
|
const o = i.lineIndexOfPosition(s);
|
|
5612
5616
|
if (o === void 0)
|
|
5613
|
-
return this.element.style.display = "none", new
|
|
5617
|
+
return this.element.style.display = "none", new Ue(s, !1, S.EMPTY);
|
|
5614
5618
|
const r = i.lineRect(o).withZeroWidthAt(i.xAtPosition(s)), c = e.blocks ? t.readObservable(e.blocks) : void 0, a = c && s.kind === "source" ? mi(Fc(c, s.offset)) : void 0;
|
|
5615
|
-
return a && (r.x < a.left - 0.5 || r.x > a.right + 0.5) ? (this.element.style.display = "none", new
|
|
5619
|
+
return a && (r.x < a.left - 0.5 || r.x > a.right + 0.5) ? (this.element.style.display = "none", new Ue(s, !1, S.EMPTY)) : (this.element.style.left = `${r.x}px`, this.element.style.top = `${r.y}px`, this.element.style.height = `${r.height}px`, this.element.style.display = "", new Ue(s, !0, r));
|
|
5616
5620
|
}), this._register(B((t) => {
|
|
5617
5621
|
t.readObservable(this.rendering);
|
|
5618
5622
|
})), this._register(B((t) => {
|
|
@@ -5620,7 +5624,7 @@ class Wc extends H {
|
|
|
5620
5624
|
}));
|
|
5621
5625
|
}
|
|
5622
5626
|
}
|
|
5623
|
-
class
|
|
5627
|
+
class Ue {
|
|
5624
5628
|
constructor(e, t, s) {
|
|
5625
5629
|
this.position = e, this.visible = t, this.rect = s;
|
|
5626
5630
|
}
|
|
@@ -5638,7 +5642,7 @@ class Kc extends H {
|
|
|
5638
5642
|
}
|
|
5639
5643
|
_render(e, t) {
|
|
5640
5644
|
if (this.element.replaceChildren(), t.isEmpty)
|
|
5641
|
-
return new
|
|
5645
|
+
return new Yn([]);
|
|
5642
5646
|
const s = [];
|
|
5643
5647
|
for (const i of e) {
|
|
5644
5648
|
const o = i.type === "deleted" || i.range.isEmpty ? qc(i, t) : zc(i, t);
|
|
@@ -5647,10 +5651,10 @@ class Kc extends H {
|
|
|
5647
5651
|
const r = document.createElement("div");
|
|
5648
5652
|
r.className = `md-gutter-marker md-gutter-marker-${o.type}`, r.style.top = `${o.y}px`, o.height > 0 && (r.style.height = `${o.height}px`), this.element.appendChild(r), s.push(o);
|
|
5649
5653
|
}
|
|
5650
|
-
return new
|
|
5654
|
+
return new Yn(s);
|
|
5651
5655
|
}
|
|
5652
5656
|
}
|
|
5653
|
-
class
|
|
5657
|
+
class Yn {
|
|
5654
5658
|
constructor(e) {
|
|
5655
5659
|
this.rects = e;
|
|
5656
5660
|
}
|
|
@@ -5676,7 +5680,7 @@ function Gc(n) {
|
|
|
5676
5680
|
s.sourceStart < e && (e = s.sourceStart), s.sourceEndExclusive > t && (t = s.sourceEndExclusive);
|
|
5677
5681
|
return w.fromTo(e, t);
|
|
5678
5682
|
}
|
|
5679
|
-
function
|
|
5683
|
+
function jn(n) {
|
|
5680
5684
|
return n.windowHasFocus && n.focusIsUnclaimed;
|
|
5681
5685
|
}
|
|
5682
5686
|
function Uc(n) {
|
|
@@ -5691,7 +5695,7 @@ function pi(n) {
|
|
|
5691
5695
|
e.documentElement.clientHeight || t.innerHeight
|
|
5692
5696
|
);
|
|
5693
5697
|
for (let i = n.parentElement; i; i = i.parentElement) {
|
|
5694
|
-
const o = t.getComputedStyle(i), r =
|
|
5698
|
+
const o = t.getComputedStyle(i), r = Zn(o.overflowX), c = Zn(o.overflowY);
|
|
5695
5699
|
if (!r && !c)
|
|
5696
5700
|
continue;
|
|
5697
5701
|
const a = _i(i), l = r ? Math.max(s.left, a.left) : s.left, d = r ? Math.min(s.right, a.right) : s.right, u = c ? Math.max(s.top, a.top) : s.top, h = c ? Math.min(s.bottom, a.bottom) : s.bottom;
|
|
@@ -5725,18 +5729,18 @@ function Xc(n, e, t) {
|
|
|
5725
5729
|
function Yc(n) {
|
|
5726
5730
|
const t = n.ownerDocument.defaultView ?? window, s = [];
|
|
5727
5731
|
for (let i = n.parentElement; i; i = i.parentElement) {
|
|
5728
|
-
const o = t.getComputedStyle(i), r =
|
|
5732
|
+
const o = t.getComputedStyle(i), r = Jn(o.overflowX) && i.scrollWidth > i.clientWidth, c = Jn(o.overflowY) && i.scrollHeight > i.clientHeight;
|
|
5729
5733
|
(r || c) && s.push(i);
|
|
5730
5734
|
}
|
|
5731
5735
|
return s;
|
|
5732
5736
|
}
|
|
5733
|
-
function
|
|
5737
|
+
function Qn(n, e) {
|
|
5734
5738
|
return n.left <= e.left && e.right <= n.right && n.top <= e.top && e.bottom <= n.bottom;
|
|
5735
5739
|
}
|
|
5736
|
-
function
|
|
5740
|
+
function Zn(n) {
|
|
5737
5741
|
return n === "auto" || n === "scroll" || n === "hidden" || n === "clip";
|
|
5738
5742
|
}
|
|
5739
|
-
function
|
|
5743
|
+
function Jn(n) {
|
|
5740
5744
|
return n === "auto" || n === "scroll" || n === "hidden";
|
|
5741
5745
|
}
|
|
5742
5746
|
const jc = 900;
|
|
@@ -5775,7 +5779,7 @@ class Al extends H {
|
|
|
5775
5779
|
selection: this._model.selection,
|
|
5776
5780
|
visualLineMap: this.measuredLayout.visualLineMap,
|
|
5777
5781
|
blocks: this._selectionBlocksObs
|
|
5778
|
-
})), this._contentContainer.appendChild(this._selectionView.element), this.coordinateSpace =
|
|
5782
|
+
})), this._contentContainer.appendChild(this._selectionView.element), this.coordinateSpace = mt.forSvgOverlay(this._selectionView.element), this._cursorView = this._register(new Wc({
|
|
5779
5783
|
position: this._model.cursorPosition,
|
|
5780
5784
|
visualLineMap: this.measuredLayout.visualLineMap,
|
|
5781
5785
|
blocks: this._selectionBlocksObs
|
|
@@ -6057,7 +6061,7 @@ class Al extends H {
|
|
|
6057
6061
|
* open-time behavior on top of this primitive.
|
|
6058
6062
|
*/
|
|
6059
6063
|
tryAutoFocus() {
|
|
6060
|
-
return
|
|
6064
|
+
return jn(this._sampleAutoFocusEnvironment()) ? (this.focus(), !0) : !1;
|
|
6061
6065
|
}
|
|
6062
6066
|
/**
|
|
6063
6067
|
* Focuses the editor when it opens without ever stealing focus from an
|
|
@@ -6070,7 +6074,7 @@ class Al extends H {
|
|
|
6070
6074
|
*/
|
|
6071
6075
|
autoFocusOnOpen() {
|
|
6072
6076
|
const e = this._sampleAutoFocusEnvironment();
|
|
6073
|
-
if (
|
|
6077
|
+
if (jn(e)) {
|
|
6074
6078
|
this.focus();
|
|
6075
6079
|
return;
|
|
6076
6080
|
}
|
|
@@ -6194,7 +6198,7 @@ class Al extends H {
|
|
|
6194
6198
|
this._previousViewData = m;
|
|
6195
6199
|
const g = l ? wc(m, l.items, this._options?.diffDecorationsActive) : m;
|
|
6196
6200
|
this._viewData.set(g, void 0);
|
|
6197
|
-
const _ = this._options?.embeddedCodeEditorFactory ? { ...this._options, embeddedCodeEditorReadOnly: d, embeddedCodeEditorFactoryVersion: u } : this._options, p =
|
|
6201
|
+
const _ = this._options?.embeddedCodeEditorFactory ? { ...this._options, embeddedCodeEditorReadOnly: d, embeddedCodeEditorFactoryVersion: u } : this._options, p = cn.create(g, _, f);
|
|
6198
6202
|
if (f) {
|
|
6199
6203
|
if (p.contentDomNode !== f.contentDomNode)
|
|
6200
6204
|
throw new Error("DocumentViewNode.contentDomNode must be stable across rebuilds");
|
|
@@ -6223,7 +6227,7 @@ class Al extends H {
|
|
|
6223
6227
|
const m = t.toLocalRect(a.getBoundingClientRect()).left + a.clientLeft;
|
|
6224
6228
|
l = { left: m, right: m + a.clientWidth };
|
|
6225
6229
|
}
|
|
6226
|
-
const h =
|
|
6230
|
+
const h = De.measure([{
|
|
6227
6231
|
absoluteStart: r.absoluteStart,
|
|
6228
6232
|
viewNode: r.node
|
|
6229
6233
|
}], this.coordinateSpace, t);
|
|
@@ -6271,7 +6275,7 @@ class Al extends H {
|
|
|
6271
6275
|
const s = this._document.get();
|
|
6272
6276
|
if (!s)
|
|
6273
6277
|
return;
|
|
6274
|
-
const i =
|
|
6278
|
+
const i = gt(s, [e]);
|
|
6275
6279
|
if (i.length === 0 && !e.isEmpty)
|
|
6276
6280
|
return;
|
|
6277
6281
|
const o = this.measuredLayout.measurements.get().find(
|
|
@@ -6303,7 +6307,7 @@ class Al extends H {
|
|
|
6303
6307
|
return;
|
|
6304
6308
|
const d = pi(c);
|
|
6305
6309
|
let u = this._isRevealOccluded(l);
|
|
6306
|
-
if (
|
|
6310
|
+
if (Qn(d, l) && !u)
|
|
6307
6311
|
return;
|
|
6308
6312
|
const h = Yc(c);
|
|
6309
6313
|
for (let _ = 0; _ < h.length; _++) {
|
|
@@ -6313,8 +6317,8 @@ class Al extends H {
|
|
|
6313
6317
|
p,
|
|
6314
6318
|
l.left + l.width / 2 - (v.left + v.width / 2),
|
|
6315
6319
|
l.top + l.height / 2 - (v.top + v.height / 2)
|
|
6316
|
-
), T = E && (l.left < v.left || l.right > v.right) ? p.scrollLeft + x.x : p.scrollLeft, V = b && (l.top < v.top || l.bottom > v.bottom || u) ? p.scrollTop + x.y : p.scrollTop,
|
|
6317
|
-
(T !== p.scrollLeft ||
|
|
6320
|
+
), T = E && (l.left < v.left || l.right > v.right) ? p.scrollLeft + x.x : p.scrollLeft, V = b && (l.top < v.top || l.bottom > v.bottom || u) ? p.scrollTop + x.y : p.scrollTop, he = V !== p.scrollTop;
|
|
6321
|
+
(T !== p.scrollLeft || he) && p.scrollTo({
|
|
6318
6322
|
left: T,
|
|
6319
6323
|
top: V,
|
|
6320
6324
|
behavior: "auto"
|
|
@@ -6327,7 +6331,7 @@ class Al extends H {
|
|
|
6327
6331
|
f.documentElement.clientWidth || m.innerWidth,
|
|
6328
6332
|
f.documentElement.clientHeight || m.innerHeight
|
|
6329
6333
|
);
|
|
6330
|
-
(!
|
|
6334
|
+
(!Qn(g, l) || u) && m.scrollBy({
|
|
6331
6335
|
left: l.left < g.left || l.right > g.right ? l.left + l.width / 2 - g.width / 2 : 0,
|
|
6332
6336
|
top: l.top + l.height / 2 - g.height / 2,
|
|
6333
6337
|
behavior: t
|
|
@@ -6357,7 +6361,7 @@ function Zc(n) {
|
|
|
6357
6361
|
function Jc(n) {
|
|
6358
6362
|
return S.fromPointPoint(n.left, n.top, n.right, n.bottom);
|
|
6359
6363
|
}
|
|
6360
|
-
const ea = 1e3, ta = "md-editor-find-match", na = "md-editor-find-current",
|
|
6364
|
+
const ea = 1e3, ta = "md-editor-find-match", na = "md-editor-find-current", es = /* @__PURE__ */ new WeakMap();
|
|
6361
6365
|
class sa {
|
|
6362
6366
|
constructor(e) {
|
|
6363
6367
|
this._registry = e;
|
|
@@ -6388,12 +6392,12 @@ function ia(n) {
|
|
|
6388
6392
|
return { update: () => {
|
|
6389
6393
|
}, dispose: () => {
|
|
6390
6394
|
} };
|
|
6391
|
-
let t =
|
|
6392
|
-
return t || (t = new sa(e),
|
|
6395
|
+
let t = es.get(n);
|
|
6396
|
+
return t || (t = new sa(e), es.set(n, t)), t.add();
|
|
6393
6397
|
}
|
|
6394
6398
|
class oa extends H {
|
|
6395
6399
|
constructor(e, t) {
|
|
6396
|
-
super(), this._view = e, this._matchesLayer =
|
|
6400
|
+
super(), this._view = e, this._matchesLayer = ns("md-find-matches-layer"), this._currentLayer = ns("md-find-current-layer"), this._highlightRegistration = this._register(ia(this._view.element.ownerDocument)), this._register(this._view.mountOverlay(this._matchesLayer, "below-selection")), this._register(this._view.mountOverlay(this._currentLayer, "above-decorations")), this._register(B((r) => {
|
|
6397
6401
|
const c = t.isRevealed.read(r);
|
|
6398
6402
|
if (!c) {
|
|
6399
6403
|
this._snapshot = void 0, this._schedulePaint();
|
|
@@ -6446,10 +6450,10 @@ class oa extends H {
|
|
|
6446
6450
|
const f = ca(h, u.rect, i);
|
|
6447
6451
|
return f ? [f] : [];
|
|
6448
6452
|
}))
|
|
6449
|
-
), r =
|
|
6453
|
+
), r = ss(
|
|
6450
6454
|
e.result.matches.filter((u) => !e.currentMatch?.equals(u)),
|
|
6451
6455
|
o
|
|
6452
|
-
), c = e.currentMatch ? [e.currentMatch] : [], a =
|
|
6456
|
+
), c = e.currentMatch ? [e.currentMatch] : [], a = ss(c, o), l = this._paintRanges(
|
|
6453
6457
|
this._matchesLayer,
|
|
6454
6458
|
e.document,
|
|
6455
6459
|
r,
|
|
@@ -6479,7 +6483,7 @@ class oa extends H {
|
|
|
6479
6483
|
const m = this._view.measuredLayout.visualLineMap.get();
|
|
6480
6484
|
if (m.isEmpty)
|
|
6481
6485
|
continue;
|
|
6482
|
-
const g = m.lineIndexOfOffset(f.start), _ = m.lineRect(g), p =
|
|
6486
|
+
const g = m.lineIndexOfOffset(f.start), _ = m.lineRect(g), p = rs(
|
|
6483
6487
|
S.fromPointSize(
|
|
6484
6488
|
m.xAtOffset(f.start),
|
|
6485
6489
|
_.top,
|
|
@@ -6487,26 +6491,26 @@ class oa extends H {
|
|
|
6487
6491
|
_.height
|
|
6488
6492
|
),
|
|
6489
6493
|
o,
|
|
6490
|
-
|
|
6494
|
+
is(i, f.start)?.viewportClip
|
|
6491
6495
|
);
|
|
6492
|
-
if (p && (l.appendChild(
|
|
6496
|
+
if (p && (l.appendChild(ts(`${r} md-find-zero-width-rect`, p)), u++, u >= c))
|
|
6493
6497
|
return e.replaceChildren(l), d;
|
|
6494
6498
|
}
|
|
6495
6499
|
const h = Number.isFinite(c) ? Math.max(0, c - u) : Number.POSITIVE_INFINITY;
|
|
6496
|
-
for (const f of
|
|
6500
|
+
for (const f of gt(
|
|
6497
6501
|
t,
|
|
6498
6502
|
s.filter((m) => !m.isEmpty),
|
|
6499
6503
|
h
|
|
6500
6504
|
)) {
|
|
6501
|
-
const m =
|
|
6505
|
+
const m = is(i, f.sourceRange.start);
|
|
6502
6506
|
let g = !1;
|
|
6503
6507
|
for (const _ of f.range.getClientRects()) {
|
|
6504
|
-
const p =
|
|
6508
|
+
const p = rs(
|
|
6505
6509
|
a.toLocalRect(_),
|
|
6506
6510
|
o,
|
|
6507
6511
|
m?.viewportClip
|
|
6508
6512
|
);
|
|
6509
|
-
if (!(!p || p.width === 0 || p.height === 0) && (g = !0, l.appendChild(
|
|
6513
|
+
if (!(!p || p.width === 0 || p.height === 0) && (g = !0, l.appendChild(ts(r, p)), u++, u >= c))
|
|
6510
6514
|
return g && d.push(f.range), e.replaceChildren(l), d;
|
|
6511
6515
|
}
|
|
6512
6516
|
g && d.push(f.range);
|
|
@@ -6514,15 +6518,15 @@ class oa extends H {
|
|
|
6514
6518
|
return e.replaceChildren(l), d;
|
|
6515
6519
|
}
|
|
6516
6520
|
}
|
|
6517
|
-
function
|
|
6521
|
+
function ts(n, e) {
|
|
6518
6522
|
const t = document.createElement("div");
|
|
6519
6523
|
return t.className = n, t.style.left = `${e.left}px`, t.style.top = `${e.top}px`, t.style.width = `${e.width}px`, t.style.height = `${e.height}px`, t;
|
|
6520
6524
|
}
|
|
6521
|
-
function
|
|
6525
|
+
function ns(n) {
|
|
6522
6526
|
const e = document.createElement("div");
|
|
6523
6527
|
return e.className = `md-find-highlight-layer ${n}`, e.setAttribute("aria-hidden", "true"), e;
|
|
6524
6528
|
}
|
|
6525
|
-
function
|
|
6529
|
+
function ss(n, e) {
|
|
6526
6530
|
if (e.length === 0)
|
|
6527
6531
|
return [];
|
|
6528
6532
|
const t = [];
|
|
@@ -6547,7 +6551,7 @@ function ns(n, e) {
|
|
|
6547
6551
|
}
|
|
6548
6552
|
return t;
|
|
6549
6553
|
}
|
|
6550
|
-
function
|
|
6554
|
+
function is(n, e) {
|
|
6551
6555
|
let t = 0, s = n.length;
|
|
6552
6556
|
for (; t < s; ) {
|
|
6553
6557
|
const i = t + s >>> 1, o = n[i];
|
|
@@ -6577,14 +6581,14 @@ function ca(n, e, t) {
|
|
|
6577
6581
|
const o = n.xAtOffset(i), r = n.xAtOffset(s + 1), c = o >= r, a = n.rect.width > 0 ? n.rect : e, l = c ? a.left : a.right, d = (_) => _ === s ? l : n.xAtOffset(_), u = (_) => c ? _ : -_, h = u(c ? t.left : t.right), f = u(c ? t.right : t.left);
|
|
6578
6582
|
if (u(o) < h || u(l) > f)
|
|
6579
6583
|
return;
|
|
6580
|
-
const m =
|
|
6584
|
+
const m = os(
|
|
6581
6585
|
s,
|
|
6582
6586
|
i,
|
|
6583
6587
|
(_) => u(d(_)) >= h
|
|
6584
6588
|
);
|
|
6585
6589
|
if (m > i)
|
|
6586
6590
|
return;
|
|
6587
|
-
const g = Math.min(i,
|
|
6591
|
+
const g = Math.min(i, os(
|
|
6588
6592
|
m,
|
|
6589
6593
|
i,
|
|
6590
6594
|
(_) => u(d(_)) > f
|
|
@@ -6592,7 +6596,7 @@ function ca(n, e, t) {
|
|
|
6592
6596
|
if (!(m >= g))
|
|
6593
6597
|
return new w(m, g);
|
|
6594
6598
|
}
|
|
6595
|
-
function
|
|
6599
|
+
function os(n, e, t) {
|
|
6596
6600
|
let s = n, i = e + 1;
|
|
6597
6601
|
for (; s < i; ) {
|
|
6598
6602
|
const o = s + i >>> 1;
|
|
@@ -6600,7 +6604,7 @@ function is(n, e, t) {
|
|
|
6600
6604
|
}
|
|
6601
6605
|
return s;
|
|
6602
6606
|
}
|
|
6603
|
-
function
|
|
6607
|
+
function rs(n, e, t) {
|
|
6604
6608
|
const s = Math.max(n.left, e.left, t?.left ?? Number.NEGATIVE_INFINITY), i = Math.min(n.right, e.right, t?.right ?? Number.POSITIVE_INFINITY), o = Math.max(n.top, e.top), r = Math.min(n.bottom, e.bottom);
|
|
6605
6609
|
return s < i && o < r ? S.fromPointPoint(s, o, i, r) : void 0;
|
|
6606
6610
|
}
|
|
@@ -6679,7 +6683,7 @@ function da(n, e) {
|
|
|
6679
6683
|
return t <= s ? new w(t, s) : w.emptyAt(t);
|
|
6680
6684
|
}
|
|
6681
6685
|
function ha(n, e, t) {
|
|
6682
|
-
const s = n[e.start - 1], i = n[e.start], o = n[e.endExclusive - 1], r = n[e.endExclusive], c = e.start === 0 || !
|
|
6686
|
+
const s = n[e.start - 1], i = n[e.start], o = n[e.endExclusive - 1], r = n[e.endExclusive], c = e.start === 0 || !He(s, t) || e.length > 0 && !He(i, t), a = e.endExclusive === n.length || !He(r, t) || e.length > 0 && !He(o, t);
|
|
6683
6687
|
return c && a;
|
|
6684
6688
|
}
|
|
6685
6689
|
function ua(n, e) {
|
|
@@ -6728,7 +6732,7 @@ class fa extends H {
|
|
|
6728
6732
|
})), this._register(B((s) => {
|
|
6729
6733
|
const i = this._editorModel.sourceText.read(s), o = i.value, r = this._readInputSnapshot(s), c = this._sourceEditTracker.consume(i), a = c.sourceIdentityChanged, l = a && c.isExpected;
|
|
6730
6734
|
if (a && !l) {
|
|
6731
|
-
this._searchOrigin =
|
|
6735
|
+
this._searchOrigin = Ct(this._searchOrigin, 0, o.length), t = { ...r, scope: void 0 }, ne((f) => {
|
|
6732
6736
|
this.searchScope.set(void 0, f), this.currentMatch.set(void 0, f);
|
|
6733
6737
|
});
|
|
6734
6738
|
return;
|
|
@@ -6798,17 +6802,17 @@ class fa extends H {
|
|
|
6798
6802
|
_sourceEditTracker;
|
|
6799
6803
|
_pendingInitialDirection;
|
|
6800
6804
|
reveal(e) {
|
|
6801
|
-
this._searchOrigin =
|
|
6805
|
+
this._searchOrigin = Ct(e.origin, 0, this._editorModel.sourceText.get().value.length), this._pendingInitialDirection = e.direction ?? "next", ne((t) => {
|
|
6802
6806
|
e.searchString !== void 0 && this.searchString.set(e.searchString, t), this.isRevealed.set(!0, t);
|
|
6803
6807
|
});
|
|
6804
6808
|
}
|
|
6805
6809
|
hide() {
|
|
6806
|
-
|
|
6810
|
+
ne((e) => {
|
|
6807
6811
|
this.isRevealed.set(!1, e), this.searchScope.set(void 0, e), this.currentMatch.set(void 0, e);
|
|
6808
6812
|
});
|
|
6809
6813
|
}
|
|
6810
6814
|
setSearchOrigin(e) {
|
|
6811
|
-
this._searchOrigin =
|
|
6815
|
+
this._searchOrigin = Ct(e, 0, this._editorModel.sourceText.get().value.length);
|
|
6812
6816
|
}
|
|
6813
6817
|
setSearchScope(e) {
|
|
6814
6818
|
this.searchScope.set(e, void 0);
|
|
@@ -6845,12 +6849,12 @@ class fa extends H {
|
|
|
6845
6849
|
this.currentMatch.set(o, void 0);
|
|
6846
6850
|
}
|
|
6847
6851
|
_mapStateThroughEdit(e) {
|
|
6848
|
-
this._searchOrigin =
|
|
6852
|
+
this._searchOrigin = $t(e.edit, this._searchOrigin, "after");
|
|
6849
6853
|
const t = this.searchScope.get();
|
|
6850
|
-
t && this.searchScope.set(
|
|
6854
|
+
t && this.searchScope.set(cs(e.edit, t), e.transaction);
|
|
6851
6855
|
const s = this.currentMatch.get();
|
|
6852
6856
|
s && this.currentMatch.set(
|
|
6853
|
-
_a(e.edit, s) ? void 0 :
|
|
6857
|
+
_a(e.edit, s) ? void 0 : cs(e.edit, s),
|
|
6854
6858
|
e.transaction
|
|
6855
6859
|
);
|
|
6856
6860
|
}
|
|
@@ -6884,11 +6888,11 @@ function ga(n, e) {
|
|
|
6884
6888
|
function pa(n, e) {
|
|
6885
6889
|
return n === e || !!n && !!e && n.equals(e);
|
|
6886
6890
|
}
|
|
6887
|
-
function
|
|
6888
|
-
const t =
|
|
6891
|
+
function cs(n, e) {
|
|
6892
|
+
const t = $t(n, e.start, "after"), s = $t(n, e.endExclusive, "before");
|
|
6889
6893
|
return new w(Math.min(t, s), Math.max(t, s));
|
|
6890
6894
|
}
|
|
6891
|
-
function
|
|
6895
|
+
function $t(n, e, t) {
|
|
6892
6896
|
let s = 0;
|
|
6893
6897
|
for (const i of n.replacements) {
|
|
6894
6898
|
const o = i.replaceRange;
|
|
@@ -6908,7 +6912,7 @@ function _a(n, e) {
|
|
|
6908
6912
|
return s.isEmpty ? e.start < s.start && s.start < e.endExclusive : e.isEmpty ? s.contains(e.start) : s.intersects(e);
|
|
6909
6913
|
});
|
|
6910
6914
|
}
|
|
6911
|
-
function
|
|
6915
|
+
function Ct(n, e, t) {
|
|
6912
6916
|
return Math.min(Math.max(n, e), t);
|
|
6913
6917
|
}
|
|
6914
6918
|
class va extends H {
|
|
@@ -6917,8 +6921,8 @@ class va extends H {
|
|
|
6917
6921
|
const s = document.createElement("div");
|
|
6918
6922
|
s.className = "md-find-row", this.panelElement.appendChild(s), this._inputShell = document.createElement("div"), this._inputShell.className = "md-find-input-shell", s.appendChild(this._inputShell), this._input = document.createElement("textarea"), this._input.className = "md-find-input", this._input.rows = 1, this._input.spellcheck = !1, this._input.setAttribute("aria-label", "Find"), this._input.placeholder = "Find", this._inputShell.appendChild(this._input);
|
|
6919
6923
|
const i = document.createElement("div");
|
|
6920
|
-
i.className = "md-find-options", this._inputShell.appendChild(i), this._caseButton =
|
|
6921
|
-
const o =
|
|
6924
|
+
i.className = "md-find-options", this._inputShell.appendChild(i), this._caseButton = St("Aa", "Match Case"), this._wholeWordButton = St("ab", "Match Whole Word", "md-find-option-whole-word"), this._regexButton = St(".*", "Use Regular Expression"), i.append(this._caseButton, this._wholeWordButton, this._regexButton), this._matchesCount = document.createElement("div"), this._matchesCount.className = "md-find-count", this._matchesCount.setAttribute("role", "status"), this._matchesCount.setAttribute("aria-live", "polite"), s.appendChild(this._matchesCount), this._previousButton = Xe("arrow-up", "Previous Match"), this._nextButton = Xe("arrow-down", "Next Match"), this._selectionButton = Xe("selection", "Find in Selection");
|
|
6925
|
+
const o = Xe("close", "Close");
|
|
6922
6926
|
s.append(this._previousButton, this._nextButton, this._selectionButton, o), this._error = document.createElement("div"), this._error.className = "md-find-error", this._error.setAttribute("role", "alert"), this.panelElement.appendChild(this._error);
|
|
6923
6927
|
const r = () => this._options.findModel.searchString.set(this._input.value, void 0), c = (h) => {
|
|
6924
6928
|
h.isComposing || h.key === "Enter" && !h.ctrlKey && !h.metaKey && !h.altKey && (h.preventDefault(), h.stopPropagation(), h.shiftKey ? this._options.onPrevious() : this._options.onNext());
|
|
@@ -6958,7 +6962,7 @@ class va extends H {
|
|
|
6958
6962
|
if (!s && this.panelElement.contains(this.panelElement.ownerDocument.activeElement) && this._view.focus(), this.element.hidden = !s, this._view.element.classList.toggle("md-find-visible", s), !s)
|
|
6959
6963
|
return;
|
|
6960
6964
|
const i = t.searchString.read(e), o = t.matchCase.read(e), r = t.wholeWord.read(e), c = t.isRegex.read(e), a = t.searchScope.read(e), l = t.searchResult.read(e), d = t.currentMatchPosition.read(e), u = this._options.canFindInSelection.read(e) || a !== void 0;
|
|
6961
|
-
this._input.value !== i && (this._input.value = i),
|
|
6965
|
+
this._input.value !== i && (this._input.value = i), Ye(this._caseButton, o), Ye(this._wholeWordButton, r), Ye(this._regexButton, c), Ye(this._selectionButton, a !== void 0), this._selectionButton.disabled = !s || !u;
|
|
6962
6966
|
const h = l.kind === "valid" ? l.matches.length : 0, f = h > 0, m = i.length > 0;
|
|
6963
6967
|
if (this._previousButton.disabled = !s || !f, this._nextButton.disabled = !s || !f, this.panelElement.classList.toggle("md-find-no-results", m && !f && l.kind === "valid"), !f)
|
|
6964
6968
|
this._matchesCount.textContent = "No results";
|
|
@@ -6970,17 +6974,17 @@ class va extends H {
|
|
|
6970
6974
|
this._input.setAttribute("aria-invalid", String(g.length > 0)), this._inputShell.classList.toggle("md-find-input-invalid", g.length > 0), this._input.title = g, this._error.textContent = g, this._error.hidden = g.length === 0;
|
|
6971
6975
|
}
|
|
6972
6976
|
}
|
|
6973
|
-
function
|
|
6977
|
+
function St(n, e, t) {
|
|
6974
6978
|
const s = document.createElement("button");
|
|
6975
6979
|
return s.type = "button", s.className = "md-find-button md-find-option", t && s.classList.add(t), s.textContent = n, s.setAttribute("aria-label", e), s.title = e, s.setAttribute("aria-pressed", "false"), s;
|
|
6976
6980
|
}
|
|
6977
|
-
function
|
|
6981
|
+
function Xe(n, e) {
|
|
6978
6982
|
const t = document.createElement("button");
|
|
6979
6983
|
t.type = "button", t.className = "md-find-button", t.setAttribute("aria-label", e), t.title = e;
|
|
6980
6984
|
const s = document.createElement("span");
|
|
6981
6985
|
return s.className = `codicon codicon-${n}`, s.setAttribute("aria-hidden", "true"), t.appendChild(s), t;
|
|
6982
6986
|
}
|
|
6983
|
-
function
|
|
6987
|
+
function Ye(n, e) {
|
|
6984
6988
|
n.setAttribute("aria-pressed", String(e)), n.classList.toggle("md-find-option-active", e);
|
|
6985
6989
|
}
|
|
6986
6990
|
class wa extends H {
|
|
@@ -7028,8 +7032,8 @@ class wa extends H {
|
|
|
7028
7032
|
}
|
|
7029
7033
|
const g = !this._selectedMatch?.equals(h);
|
|
7030
7034
|
let _ = /* @__PURE__ */ new Set();
|
|
7031
|
-
this._forcedMatch?.equals(h) ? _ = new Set(
|
|
7032
|
-
|
|
7035
|
+
this._forcedMatch?.equals(h) ? _ = new Set(Ot(f, h.start, h.endExclusive)) : (m ? ka(m, h) : !1) ? this._forcedMatch = void 0 : (_ = new Set(Ot(f, h.start, h.endExclusive)), this._forcedMatch = h), ne((p) => {
|
|
7036
|
+
as(this._view.forcedMarkerVisibleBlocks.get(), _) || this._view.forcedMarkerVisibleBlocks.set(_, p);
|
|
7033
7037
|
const v = this._editorModel.selection.get();
|
|
7034
7038
|
g && !d && (!v || !v.range.equals(h)) && (this._editorModel.pendingParagraph.set(void 0, p), this._editorModel.selectionSource.set("find", p), this._editorModel.selection.set(new k(h.start, h.endExclusive), p));
|
|
7035
7039
|
}), this._selectedMatch = h, this._observedSourceTextId = l, g && !d && (this._cancelRevealRequest(), this._revealRequest = this._view.revealRangeInCenterIfOutsideViewport(h, "auto"));
|
|
@@ -7048,7 +7052,7 @@ class wa extends H {
|
|
|
7048
7052
|
_sourceEditTracker;
|
|
7049
7053
|
_revealRequest;
|
|
7050
7054
|
_setForcedMarkerVisibleBlocks(e) {
|
|
7051
|
-
|
|
7055
|
+
as(this._view.forcedMarkerVisibleBlocks.get(), e) || this._view.forcedMarkerVisibleBlocks.set(e, void 0);
|
|
7052
7056
|
}
|
|
7053
7057
|
openAndFocus() {
|
|
7054
7058
|
if (this.model.isRevealed.get()) {
|
|
@@ -7073,14 +7077,14 @@ class wa extends H {
|
|
|
7073
7077
|
const t = e.target, s = t instanceof Node && this.widget.panelElement.contains(t);
|
|
7074
7078
|
if (!(t !== this._view.element && !s)) {
|
|
7075
7079
|
if (ba(e, this._options.keyboardPlatform)) {
|
|
7076
|
-
|
|
7080
|
+
Lt(e), this.openAndFocus();
|
|
7077
7081
|
return;
|
|
7078
7082
|
}
|
|
7079
7083
|
if (e.key === "F3" && !e.altKey && !e.ctrlKey && !e.metaKey) {
|
|
7080
|
-
|
|
7084
|
+
Lt(e), this._findByKeyboard(e.shiftKey ? "previous" : "next");
|
|
7081
7085
|
return;
|
|
7082
7086
|
}
|
|
7083
|
-
e.key === "Escape" && this.model.isRevealed.get() && (
|
|
7087
|
+
e.key === "Escape" && this.model.isRevealed.get() && (Lt(e), this.close());
|
|
7084
7088
|
}
|
|
7085
7089
|
}
|
|
7086
7090
|
_cancelRevealRequest() {
|
|
@@ -7105,7 +7109,7 @@ class wa extends H {
|
|
|
7105
7109
|
};
|
|
7106
7110
|
if (t)
|
|
7107
7111
|
return { searchString: t, origin: e.active };
|
|
7108
|
-
const i = this._editorModel.sourceText.get().value, o =
|
|
7112
|
+
const i = this._editorModel.sourceText.get().value, o = Ls(i, e.active, this._editorModel.wordNavigationConfig.get()), r = i.slice(o.start, o.end);
|
|
7109
7113
|
return {
|
|
7110
7114
|
searchString: /\S/u.test(r) ? this._prepareSeed(r) : "",
|
|
7111
7115
|
origin: o.start
|
|
@@ -7133,20 +7137,20 @@ class wa extends H {
|
|
|
7133
7137
|
function ba(n, e) {
|
|
7134
7138
|
return n.key.toLowerCase() === "f" && !n.shiftKey && !n.altKey && (e === "macos" ? n.metaKey && !n.ctrlKey : n.ctrlKey && !n.metaKey);
|
|
7135
7139
|
}
|
|
7136
|
-
function
|
|
7140
|
+
function Lt(n) {
|
|
7137
7141
|
n.preventDefault(), n.stopPropagation();
|
|
7138
7142
|
}
|
|
7139
|
-
function
|
|
7143
|
+
function as(n, e) {
|
|
7140
7144
|
return n.size === e.size && Array.from(n).every((t) => e.has(t));
|
|
7141
7145
|
}
|
|
7142
7146
|
function ka(n, e) {
|
|
7143
|
-
const t =
|
|
7144
|
-
return e.isEmpty ? t.some((i) =>
|
|
7145
|
-
const r = Array.from(o.range.getClientRects()).some((c) => c.width > 0 && c.height > 0) &&
|
|
7147
|
+
const t = gt(n, [e]);
|
|
7148
|
+
return e.isEmpty ? t.some((i) => ls(i.range)) : t.reduce((i, o) => {
|
|
7149
|
+
const r = Array.from(o.range.getClientRects()).some((c) => c.width > 0 && c.height > 0) && ls(o.range);
|
|
7146
7150
|
return i + (r ? o.sourceRange.length : 0);
|
|
7147
7151
|
}, 0) === e.length;
|
|
7148
7152
|
}
|
|
7149
|
-
function
|
|
7153
|
+
function ls(n) {
|
|
7150
7154
|
const e = n.startContainer.ownerDocument;
|
|
7151
7155
|
if (!e)
|
|
7152
7156
|
return !1;
|
|
@@ -7161,17 +7165,17 @@ function as(n) {
|
|
|
7161
7165
|
class ya {
|
|
7162
7166
|
connect(e) {
|
|
7163
7167
|
const t = (r) => {
|
|
7164
|
-
if (
|
|
7168
|
+
if (Je(r.target, e.element))
|
|
7165
7169
|
return;
|
|
7166
7170
|
const c = e.getSelectedText();
|
|
7167
7171
|
c !== void 0 && (r.preventDefault(), r.clipboardData?.setData("text/plain", c));
|
|
7168
7172
|
}, s = (r) => {
|
|
7169
|
-
if (
|
|
7173
|
+
if (Je(r.target, e.element))
|
|
7170
7174
|
return;
|
|
7171
7175
|
const c = e.getSelectedText();
|
|
7172
7176
|
c !== void 0 && (r.preventDefault(), r.clipboardData?.setData("text/plain", c), e.deleteSelection());
|
|
7173
7177
|
}, i = (r) => {
|
|
7174
|
-
if (
|
|
7178
|
+
if (Je(r.target, e.element))
|
|
7175
7179
|
return;
|
|
7176
7180
|
r.preventDefault();
|
|
7177
7181
|
const c = r.clipboardData?.getData("text/plain");
|
|
@@ -7192,7 +7196,7 @@ class Dl {
|
|
|
7192
7196
|
const t = (i) => {
|
|
7193
7197
|
if (!(i.ctrlKey || i.metaKey) || i.altKey)
|
|
7194
7198
|
return;
|
|
7195
|
-
const r =
|
|
7199
|
+
const r = Je(i.target, e.element);
|
|
7196
7200
|
if (r) {
|
|
7197
7201
|
xa(i, r, this._clipboard);
|
|
7198
7202
|
return;
|
|
@@ -7223,7 +7227,7 @@ class Dl {
|
|
|
7223
7227
|
return s.addEventListener("keydown", t), { dispose: () => s.removeEventListener("keydown", t) };
|
|
7224
7228
|
}
|
|
7225
7229
|
}
|
|
7226
|
-
function
|
|
7230
|
+
function Je(n, e) {
|
|
7227
7231
|
if (!(n instanceof Node) || n === e)
|
|
7228
7232
|
return;
|
|
7229
7233
|
const s = (n instanceof Element ? n : n.parentElement)?.closest('input, textarea, [contenteditable]:not([contenteditable="false"]), [role="textbox"]');
|
|
@@ -7232,26 +7236,26 @@ function et(n, e) {
|
|
|
7232
7236
|
function xa(n, e, t) {
|
|
7233
7237
|
switch (n.key.toLowerCase()) {
|
|
7234
7238
|
case "c": {
|
|
7235
|
-
const s =
|
|
7239
|
+
const s = ds(e);
|
|
7236
7240
|
if (s === void 0)
|
|
7237
7241
|
return;
|
|
7238
7242
|
n.preventDefault(), t.writeText(s);
|
|
7239
7243
|
return;
|
|
7240
7244
|
}
|
|
7241
7245
|
case "x": {
|
|
7242
|
-
const s =
|
|
7246
|
+
const s = ds(e);
|
|
7243
7247
|
if (s === void 0)
|
|
7244
7248
|
return;
|
|
7245
|
-
n.preventDefault(), t.writeText(s),
|
|
7249
|
+
n.preventDefault(), t.writeText(s), hs(e, "");
|
|
7246
7250
|
return;
|
|
7247
7251
|
}
|
|
7248
7252
|
case "v":
|
|
7249
7253
|
n.preventDefault(), t.readText().then((s) => {
|
|
7250
|
-
s.length > 0 &&
|
|
7254
|
+
s.length > 0 && hs(e, s);
|
|
7251
7255
|
});
|
|
7252
7256
|
}
|
|
7253
7257
|
}
|
|
7254
|
-
function
|
|
7258
|
+
function ds(n) {
|
|
7255
7259
|
if (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement) {
|
|
7256
7260
|
const t = n.selectionStart, s = n.selectionEnd;
|
|
7257
7261
|
return t === null || s === null || t === s ? void 0 : n.value.slice(t, s);
|
|
@@ -7260,7 +7264,7 @@ function ls(n) {
|
|
|
7260
7264
|
if (!(!e || e.isCollapsed || e.rangeCount === 0 || !n.contains(e.getRangeAt(0).commonAncestorContainer)))
|
|
7261
7265
|
return e.toString();
|
|
7262
7266
|
}
|
|
7263
|
-
function
|
|
7267
|
+
function hs(n, e) {
|
|
7264
7268
|
if (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement) {
|
|
7265
7269
|
const o = n.selectionStart ?? n.value.length, r = n.selectionEnd ?? o;
|
|
7266
7270
|
n.setRangeText(e, o, r, "end"), n.dispatchEvent(new InputEvent("input", {
|
|
@@ -7282,18 +7286,18 @@ function ds(n, e) {
|
|
|
7282
7286
|
data: e
|
|
7283
7287
|
}));
|
|
7284
7288
|
}
|
|
7285
|
-
const
|
|
7286
|
-
bindings:
|
|
7289
|
+
const Ht = {
|
|
7290
|
+
bindings: Wt.flatMap((n) => n.keybindings.map((e) => ({
|
|
7287
7291
|
...e,
|
|
7288
7292
|
action: n.action
|
|
7289
7293
|
})))
|
|
7290
7294
|
}, Fl = {
|
|
7291
|
-
bindings:
|
|
7295
|
+
bindings: Wt.filter((n) => n.routing === "local").flatMap((n) => n.keybindings.map((e) => ({
|
|
7292
7296
|
...e,
|
|
7293
7297
|
action: n.action
|
|
7294
7298
|
})))
|
|
7295
7299
|
}, Vl = {
|
|
7296
|
-
bindings:
|
|
7300
|
+
bindings: Wt.filter((n) => n.routing !== "local").flatMap((n) => n.keybindings.map((e) => ({
|
|
7297
7301
|
...e,
|
|
7298
7302
|
action: n.action
|
|
7299
7303
|
})))
|
|
@@ -7311,7 +7315,7 @@ function Ca(n) {
|
|
|
7311
7315
|
function Sa(n) {
|
|
7312
7316
|
return n.includes("Macintosh") || n.includes("Mac OS X") ? "macos" : n.includes("Windows") ? "windows" : "linux";
|
|
7313
7317
|
}
|
|
7314
|
-
function
|
|
7318
|
+
function us(n) {
|
|
7315
7319
|
return {
|
|
7316
7320
|
key: n.key,
|
|
7317
7321
|
code: n.code,
|
|
@@ -7322,7 +7326,7 @@ function hs(n) {
|
|
|
7322
7326
|
altGraphKey: n.getModifierState("AltGraph")
|
|
7323
7327
|
};
|
|
7324
7328
|
}
|
|
7325
|
-
function
|
|
7329
|
+
function fs(n, e, t = Ht) {
|
|
7326
7330
|
if (n.altGraphKey)
|
|
7327
7331
|
return;
|
|
7328
7332
|
const s = n.key.length === 1 ? n.key.toLowerCase() : n.key, i = /^[a-z]$/.test(s) ? void 0 : La(n.code);
|
|
@@ -7336,12 +7340,12 @@ function La(n) {
|
|
|
7336
7340
|
function Ma(n, e = {}) {
|
|
7337
7341
|
return n.shiftKey === !!e.shift && n.altKey === !!e.alt && n.ctrlKey === !!e.ctrl && n.metaKey === !!e.meta;
|
|
7338
7342
|
}
|
|
7339
|
-
const Ta = 500,
|
|
7343
|
+
const Ta = 500, ms = 5;
|
|
7340
7344
|
class $l extends H {
|
|
7341
7345
|
constructor(e, t, s) {
|
|
7342
7346
|
super(), this._model = e, this._view = t;
|
|
7343
7347
|
const i = this._view.element, o = i.ownerDocument.defaultView ?? window;
|
|
7344
|
-
this._keyboardPlatform = s?.keyboardPlatform ?? Sa(o.navigator.userAgent), this._keyboardProfile = s?.keyboardProfile ??
|
|
7348
|
+
this._keyboardPlatform = s?.keyboardPlatform ?? Sa(o.navigator.userAgent), this._keyboardProfile = s?.keyboardProfile ?? Ht, this._forwardedKeyboardProfile = s?.forwardedKeyboardProfile, this._historyStrategy = s?.historyStrategy, this._indentation = s?.indentation ?? Fe, this._tabFocusStatus = this._keyboardProfile === Ht ? this._registerTabFocusAccessibility(i) : void 0, i.addEventListener("pointerdown", this._handlePointerDown), i.addEventListener("keydown", this._handleKeyDown), this._register({
|
|
7345
7349
|
dispose: () => {
|
|
7346
7350
|
i.removeEventListener("pointerdown", this._handlePointerDown), i.removeEventListener("keydown", this._handleKeyDown);
|
|
7347
7351
|
}
|
|
@@ -7354,7 +7358,7 @@ class $l extends H {
|
|
|
7354
7358
|
this._register(r.connect({
|
|
7355
7359
|
element: i,
|
|
7356
7360
|
getSelectedText: () => this._selectedText(),
|
|
7357
|
-
deleteSelection: () => this._executeEditCommand(
|
|
7361
|
+
deleteSelection: () => this._executeEditCommand(_n),
|
|
7358
7362
|
insertText: (a) => {
|
|
7359
7363
|
this._handlePendingInput(a) || this._executeEditCommand(Qo(a));
|
|
7360
7364
|
}
|
|
@@ -7413,7 +7417,7 @@ class $l extends H {
|
|
|
7413
7417
|
if (e.button !== 0)
|
|
7414
7418
|
return;
|
|
7415
7419
|
e.preventDefault(), this._model.cancelPendingParagraph(), this._view.focus(), this._desiredColumn = void 0;
|
|
7416
|
-
const t = new
|
|
7420
|
+
const t = new ue(e.clientX, e.clientY), s = this._lastPointerDown, i = s !== void 0 && e.timeStamp - s.time < Ta && Math.abs(t.x - s.point.x) < ms && Math.abs(t.y - s.point.y) < ms;
|
|
7417
7421
|
if (this._clickCount = i ? this._clickCount + 1 : 1, this._lastPointerDown = { time: e.timeStamp, point: t }, !this._view.isPointInContent(t)) {
|
|
7418
7422
|
this._setUserSelection(void 0);
|
|
7419
7423
|
return;
|
|
@@ -7438,7 +7442,7 @@ class $l extends H {
|
|
|
7438
7442
|
const c = this._view.element, a = e.pointerId;
|
|
7439
7443
|
c.setPointerCapture(a), this._model.isSelecting.set(!0, void 0);
|
|
7440
7444
|
const l = (u) => {
|
|
7441
|
-
const h = this._model.selection.get() ?? k.collapsed(o), f = this._view.resolveOffsetFromPoint(new
|
|
7445
|
+
const h = this._model.selection.get() ?? k.collapsed(o), f = this._view.resolveOffsetFromPoint(new ue(u.clientX, u.clientY)) ?? h.active;
|
|
7442
7446
|
this._setUserSelection(new k(h.anchor, f));
|
|
7443
7447
|
}, d = () => {
|
|
7444
7448
|
this._model.isSelecting.set(!1, void 0), r && (this._model.selection.get()?.isCollapsed ?? !0) && this._view.showReadonlyEditingAttempt(), c.removeEventListener("pointermove", l), c.removeEventListener("pointerup", d), c.removeEventListener("pointercancel", d), c.removeEventListener("lostpointercapture", d);
|
|
@@ -7487,7 +7491,7 @@ class $l extends H {
|
|
|
7487
7491
|
_cursorDown(e) {
|
|
7488
7492
|
const t = this._makeVisualCursorContext(), s = Ko(t);
|
|
7489
7493
|
if (!e && !this._model.readonlyMode.get() && !t.lineMap.isEmpty && t.cursorPosition.kind === "source" && s.position.kind === "source" && s.position.offset === t.selection.active) {
|
|
7490
|
-
const i =
|
|
7494
|
+
const i = Ve(t);
|
|
7491
7495
|
if (i) {
|
|
7492
7496
|
this._model.armPendingParagraph(i), this._desiredColumn = void 0;
|
|
7493
7497
|
return;
|
|
@@ -7496,7 +7500,7 @@ class $l extends H {
|
|
|
7496
7500
|
this._applyCursorPosition(t.selection, s.position, e), this._desiredColumn = s.desiredColumn;
|
|
7497
7501
|
}
|
|
7498
7502
|
_setUserSelection(e) {
|
|
7499
|
-
|
|
7503
|
+
ne((t) => {
|
|
7500
7504
|
this._model.pendingParagraph.set(void 0, t), this._model.selectionSource.set("user", t), this._model.selection.set(e, t);
|
|
7501
7505
|
});
|
|
7502
7506
|
}
|
|
@@ -7518,7 +7522,7 @@ class $l extends H {
|
|
|
7518
7522
|
}
|
|
7519
7523
|
/** Move the cursor up one visual line (Arrow Up). */
|
|
7520
7524
|
cursorUp(e = !1) {
|
|
7521
|
-
this._executeVisualCursorCommand(
|
|
7525
|
+
this._executeVisualCursorCommand(pn, e);
|
|
7522
7526
|
}
|
|
7523
7527
|
_selectedText() {
|
|
7524
7528
|
const e = this._model.selection.get();
|
|
@@ -7566,17 +7570,17 @@ class $l extends H {
|
|
|
7566
7570
|
if (e.isComposing || Oa(e, this._view.element) || (this._updateModifierState(e), e.key === "Tab" && (this._model.readonlyMode.get() || this._tabMovesFocus)))
|
|
7567
7571
|
return;
|
|
7568
7572
|
if (this._model.pendingParagraph.get() !== void 0 && e.key === "Escape") {
|
|
7569
|
-
|
|
7573
|
+
gs(e), this._model.cancelPendingParagraph();
|
|
7570
7574
|
return;
|
|
7571
7575
|
}
|
|
7572
|
-
const t =
|
|
7573
|
-
|
|
7576
|
+
const t = fs(
|
|
7577
|
+
us(e),
|
|
7574
7578
|
this._keyboardPlatform,
|
|
7575
7579
|
this._keyboardProfile
|
|
7576
7580
|
);
|
|
7577
7581
|
if (!t) {
|
|
7578
|
-
if (this._forwardedKeyboardProfile ?
|
|
7579
|
-
|
|
7582
|
+
if (this._forwardedKeyboardProfile ? fs(
|
|
7583
|
+
us(e),
|
|
7580
7584
|
this._keyboardPlatform,
|
|
7581
7585
|
this._forwardedKeyboardProfile
|
|
7582
7586
|
) : void 0) {
|
|
@@ -7587,7 +7591,7 @@ class $l extends H {
|
|
|
7587
7591
|
return;
|
|
7588
7592
|
}
|
|
7589
7593
|
const s = this._model.pendingParagraph.get() !== void 0;
|
|
7590
|
-
t.kind === "history" && !s && !this._historyStrategy || (
|
|
7594
|
+
t.kind === "history" && !s && !this._historyStrategy || (gs(e), this._executeKeyboardAction(t));
|
|
7591
7595
|
};
|
|
7592
7596
|
executeCommand(e) {
|
|
7593
7597
|
this._executeKeyboardAction(e.action);
|
|
@@ -7604,7 +7608,7 @@ class $l extends H {
|
|
|
7604
7608
|
this._executeCursorCommand(e.extend ? Bo : Io, e.extend);
|
|
7605
7609
|
return;
|
|
7606
7610
|
case "up":
|
|
7607
|
-
this._executeVisualCursorCommand(
|
|
7611
|
+
this._executeVisualCursorCommand(pn, e.extend);
|
|
7608
7612
|
return;
|
|
7609
7613
|
case "down":
|
|
7610
7614
|
this._cursorDown(e.extend);
|
|
@@ -7622,10 +7626,10 @@ class $l extends H {
|
|
|
7622
7626
|
this._executeVisualCursorCommand(Wo, e.extend);
|
|
7623
7627
|
return;
|
|
7624
7628
|
case "logicalLineStart":
|
|
7625
|
-
this._executeCursorCommand(
|
|
7629
|
+
this._executeCursorCommand(Rt, e.extend);
|
|
7626
7630
|
return;
|
|
7627
7631
|
case "logicalLineEnd":
|
|
7628
|
-
this._executeCursorCommand(
|
|
7632
|
+
this._executeCursorCommand(Nt, e.extend);
|
|
7629
7633
|
return;
|
|
7630
7634
|
case "documentStart":
|
|
7631
7635
|
this._executeCursorCommand(Vo, e.extend);
|
|
@@ -7649,7 +7653,7 @@ class $l extends H {
|
|
|
7649
7653
|
}
|
|
7650
7654
|
switch (t) {
|
|
7651
7655
|
case "deleteLeft":
|
|
7652
|
-
this._executeEditCommand(
|
|
7656
|
+
this._executeEditCommand(_n);
|
|
7653
7657
|
return;
|
|
7654
7658
|
case "deleteRight":
|
|
7655
7659
|
this._executeEditCommand(Go);
|
|
@@ -7701,9 +7705,9 @@ class $l extends H {
|
|
|
7701
7705
|
const t = this._model.pendingParagraph.get();
|
|
7702
7706
|
if (t !== void 0) {
|
|
7703
7707
|
e.command === "insert" ? this._model.setPendingParagraphText(
|
|
7704
|
-
t.text +
|
|
7708
|
+
t.text + Ks(t.text, this._indentation)
|
|
7705
7709
|
) : this._model.setPendingParagraphText(
|
|
7706
|
-
|
|
7710
|
+
zs(t.text, this._indentation)
|
|
7707
7711
|
);
|
|
7708
7712
|
return;
|
|
7709
7713
|
}
|
|
@@ -7713,7 +7717,7 @@ class $l extends H {
|
|
|
7713
7717
|
this._executeEditCommand(Zo(this._indentation));
|
|
7714
7718
|
return;
|
|
7715
7719
|
case "outdent":
|
|
7716
|
-
this._executeEditCommand(
|
|
7720
|
+
this._executeEditCommand(Vs(this._indentation));
|
|
7717
7721
|
return;
|
|
7718
7722
|
default:
|
|
7719
7723
|
return ke(s);
|
|
@@ -7738,10 +7742,10 @@ class $l extends H {
|
|
|
7738
7742
|
this._smartEnter();
|
|
7739
7743
|
return;
|
|
7740
7744
|
case "insertParagraph":
|
|
7741
|
-
this._executeEditCommand(
|
|
7745
|
+
this._executeEditCommand(Jo);
|
|
7742
7746
|
return;
|
|
7743
7747
|
case "insertHardLineBreak":
|
|
7744
|
-
this._executeEditCommand(
|
|
7748
|
+
this._executeEditCommand(tr);
|
|
7745
7749
|
return;
|
|
7746
7750
|
default:
|
|
7747
7751
|
return ke(t);
|
|
@@ -7760,7 +7764,7 @@ class $l extends H {
|
|
|
7760
7764
|
this._view.showReadonlyEditingAttempt();
|
|
7761
7765
|
return;
|
|
7762
7766
|
}
|
|
7763
|
-
const e = this._makeCursorContext(), t =
|
|
7767
|
+
const e = this._makeCursorContext(), t = nr(e);
|
|
7764
7768
|
t.kind === "edit" ? this._runUndoableEdit(() => this._model.applyEdit(t.edit, t.selection), t.edit) : this._model.armPendingParagraph({
|
|
7765
7769
|
anchorBlock: t.anchorBlock,
|
|
7766
7770
|
replaceRange: t.replaceRange,
|
|
@@ -7774,7 +7778,7 @@ class $l extends H {
|
|
|
7774
7778
|
const i = e.ownerDocument.createElement("span");
|
|
7775
7779
|
return i.className = "md-editor-a11y-status", i.setAttribute("aria-live", "polite"), e.ownerDocument.body.appendChild(i), this._register({
|
|
7776
7780
|
dispose: () => {
|
|
7777
|
-
i.remove(),
|
|
7781
|
+
i.remove(), ps(e, "aria-description", t), ps(e, "aria-keyshortcuts", s);
|
|
7778
7782
|
}
|
|
7779
7783
|
}), i;
|
|
7780
7784
|
}
|
|
@@ -7782,7 +7786,7 @@ class $l extends H {
|
|
|
7782
7786
|
function ke(n) {
|
|
7783
7787
|
throw new Error(`Unhandled keyboard action: ${JSON.stringify(n)}`);
|
|
7784
7788
|
}
|
|
7785
|
-
function
|
|
7789
|
+
function gs(n) {
|
|
7786
7790
|
n.preventDefault(), n.stopPropagation();
|
|
7787
7791
|
}
|
|
7788
7792
|
function Oa(n, e) {
|
|
@@ -7800,7 +7804,7 @@ function Ra(n, e) {
|
|
|
7800
7804
|
s += i.length;
|
|
7801
7805
|
}
|
|
7802
7806
|
}
|
|
7803
|
-
function
|
|
7807
|
+
function ps(n, e, t) {
|
|
7804
7808
|
t === null ? n.removeAttribute(e) : n.setAttribute(e, t);
|
|
7805
7809
|
}
|
|
7806
7810
|
const Na = 200;
|
|
@@ -7824,7 +7828,7 @@ class Hl {
|
|
|
7824
7828
|
const o = this._model.sourceText.get().value, r = this._model.selection.get();
|
|
7825
7829
|
if (this._lastKnownText = o, s === o)
|
|
7826
7830
|
return;
|
|
7827
|
-
const c = t?.apply(s) === o ? t :
|
|
7831
|
+
const c = t?.apply(s) === o ? t : Cs(s, o);
|
|
7828
7832
|
this._past.push({
|
|
7829
7833
|
undoEdit: c.inverse(s),
|
|
7830
7834
|
redoEdit: c,
|
|
@@ -7862,7 +7866,7 @@ class Hl {
|
|
|
7862
7866
|
this._past.length = 0, this._future.length = 0, this._lastKnownText = e;
|
|
7863
7867
|
}
|
|
7864
7868
|
}
|
|
7865
|
-
const
|
|
7869
|
+
const _s = "md-debug-show-line-rects";
|
|
7866
7870
|
function Ia(n, e) {
|
|
7867
7871
|
try {
|
|
7868
7872
|
const t = localStorage.getItem(n);
|
|
@@ -7884,7 +7888,7 @@ class Wl extends H {
|
|
|
7884
7888
|
/** Absolute source offsets that map to a rendered DOM character. */
|
|
7885
7889
|
mappedOffsets;
|
|
7886
7890
|
/** Whether the dashed line-bands and run boxes are drawn (persisted). */
|
|
7887
|
-
_showLineRects = C(this, Ia(
|
|
7891
|
+
_showLineRects = C(this, Ia(_s, !0));
|
|
7888
7892
|
constructor(e, t) {
|
|
7889
7893
|
super(), this.overlayElement = document.createElement("div"), this.overlayElement.className = "md-debug-layout-overlay", Object.assign(this.overlayElement.style, {
|
|
7890
7894
|
position: "absolute",
|
|
@@ -7913,7 +7917,7 @@ class Wl extends H {
|
|
|
7913
7917
|
});
|
|
7914
7918
|
const i = document.createElement("input");
|
|
7915
7919
|
i.type = "checkbox", i.checked = this._showLineRects.get(), i.addEventListener("change", () => {
|
|
7916
|
-
this._showLineRects.set(i.checked, void 0), Pa(
|
|
7920
|
+
this._showLineRects.set(i.checked, void 0), Pa(_s, i.checked);
|
|
7917
7921
|
}), s.appendChild(i), s.appendChild(document.createTextNode("show line rects")), this.infoElement.appendChild(s);
|
|
7918
7922
|
const o = document.createElement("pre");
|
|
7919
7923
|
o.style.margin = "0", o.style.whiteSpace = "pre", this.infoElement.appendChild(o), this.rendering = P(this, (r) => {
|
|
@@ -8009,7 +8013,7 @@ function Da(n, e, t, s, i, o, r) {
|
|
|
8009
8013
|
pointerEvents: "auto"
|
|
8010
8014
|
});
|
|
8011
8015
|
const v = f.node.data?.[f.offset - 1] ?? "";
|
|
8012
|
-
p.title = `offset ${h}: ${JSON.stringify(v)}`, p.dataset.offset = String(h), r ? (p.addEventListener("mouseenter", () => r.set(h, void 0)), p.addEventListener("mouseleave", () => r.set(void 0, void 0))) : (p.addEventListener("mouseenter", () =>
|
|
8016
|
+
p.title = `offset ${h}: ${JSON.stringify(v)}`, p.dataset.offset = String(h), r ? (p.addEventListener("mouseenter", () => r.set(h, void 0)), p.addEventListener("mouseleave", () => r.set(void 0, void 0))) : (p.addEventListener("mouseenter", () => vs(n, p, !0)), p.addEventListener("mouseleave", () => vs(n, p, !1))), n.appendChild(p), i.add(h), c++;
|
|
8013
8017
|
}
|
|
8014
8018
|
return c;
|
|
8015
8019
|
}
|
|
@@ -8021,11 +8025,11 @@ function Fa(n, e) {
|
|
|
8021
8025
|
t.style.visibility = e === void 0 || i ? "" : "hidden";
|
|
8022
8026
|
}
|
|
8023
8027
|
}
|
|
8024
|
-
function
|
|
8028
|
+
function vs(n, e, t) {
|
|
8025
8029
|
for (const s of Array.from(n.children))
|
|
8026
8030
|
s.style.visibility = t && s !== e ? "hidden" : "";
|
|
8027
8031
|
}
|
|
8028
|
-
class
|
|
8032
|
+
class Pe {
|
|
8029
8033
|
constructor(e, t) {
|
|
8030
8034
|
this.length = e, this.className = t;
|
|
8031
8035
|
}
|
|
@@ -8059,7 +8063,7 @@ class Va {
|
|
|
8059
8063
|
class $a {
|
|
8060
8064
|
constructor(e, t) {
|
|
8061
8065
|
this._tokenizer = e, this._initialState = e?.getInitialState(), this._text = t, this._lines = this._tokenizeFrom(0, [], this._initialState, t.split(`
|
|
8062
|
-
`)), this._lineStarts = this._computeLineStarts(), this._snapshotObs = C("syntaxSnapshot", new
|
|
8066
|
+
`)), this._lineStarts = this._computeLineStarts(), this._snapshotObs = C("syntaxSnapshot", new ws(this, this._version));
|
|
8063
8067
|
}
|
|
8064
8068
|
_text;
|
|
8065
8069
|
_lines;
|
|
@@ -8077,11 +8081,11 @@ class $a {
|
|
|
8077
8081
|
throw new Error("document is disposed");
|
|
8078
8082
|
if (e.isEmpty)
|
|
8079
8083
|
return;
|
|
8080
|
-
const s =
|
|
8084
|
+
const s = bs(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;
|
|
8081
8085
|
this._text = i, this._lines = this._tokenizeFrom(r, c, a, i.split(`
|
|
8082
8086
|
`)), this._lineStarts = this._computeLineStarts(), this._version++;
|
|
8083
|
-
const l = Ka(s,
|
|
8084
|
-
this._snapshotObs.set(new
|
|
8087
|
+
const l = Ka(s, bs(this._lines));
|
|
8088
|
+
this._snapshotObs.set(new ws(this, this._version), t, l);
|
|
8085
8089
|
}
|
|
8086
8090
|
dispose() {
|
|
8087
8091
|
this._disposed = !0;
|
|
@@ -8100,7 +8104,7 @@ class $a {
|
|
|
8100
8104
|
const d = this._tokenizer.tokenize(a, l, r);
|
|
8101
8105
|
o.push({ text: a, tokens: Wa(d.tokens, a.length), endState: d.endState }), r = d.endState;
|
|
8102
8106
|
} else
|
|
8103
|
-
o.push({ text: a, tokens: a.length === 0 ? [] : [new
|
|
8107
|
+
o.push({ text: a, tokens: a.length === 0 ? [] : [new Pe(a.length, void 0)], endState: r });
|
|
8104
8108
|
}
|
|
8105
8109
|
return o;
|
|
8106
8110
|
}
|
|
@@ -8125,7 +8129,7 @@ class $a {
|
|
|
8125
8129
|
let c = i, a = i, l = !1, d = 0;
|
|
8126
8130
|
const u = (h, f) => {
|
|
8127
8131
|
const m = d, g = d + h;
|
|
8128
|
-
d = g, h !== 0 && m < o && g > i && (l || (c = m, l = !0), r.push(new
|
|
8132
|
+
d = g, h !== 0 && m < o && g > i && (l || (c = m, l = !0), r.push(new Pe(h, f)), a = g);
|
|
8129
8133
|
};
|
|
8130
8134
|
for (let h = 0; h < this._lines.length && d < o; h++) {
|
|
8131
8135
|
for (const f of this._lines[h].tokens)
|
|
@@ -8135,7 +8139,7 @@ class $a {
|
|
|
8135
8139
|
return { range: new w(c, l ? a : i), tokens: r };
|
|
8136
8140
|
}
|
|
8137
8141
|
}
|
|
8138
|
-
class
|
|
8142
|
+
class ws {
|
|
8139
8143
|
constructor(e, t) {
|
|
8140
8144
|
this._doc = e, this._version = t;
|
|
8141
8145
|
}
|
|
@@ -8148,27 +8152,27 @@ function Ha(n) {
|
|
|
8148
8152
|
}
|
|
8149
8153
|
function Wa(n, e) {
|
|
8150
8154
|
if (n.length === 0)
|
|
8151
|
-
return e === 0 ? [] : [new
|
|
8155
|
+
return e === 0 ? [] : [new Pe(e, void 0)];
|
|
8152
8156
|
const t = [];
|
|
8153
8157
|
for (let s = 0; s < n.length; s++) {
|
|
8154
8158
|
const i = n[s].offset, o = s + 1 < n.length ? n[s + 1].offset : e;
|
|
8155
|
-
o > i && t.push(new
|
|
8159
|
+
o > i && t.push(new Pe(o - i, Ha(n[s].type)));
|
|
8156
8160
|
}
|
|
8157
8161
|
return t;
|
|
8158
8162
|
}
|
|
8159
|
-
function
|
|
8163
|
+
function bs(n) {
|
|
8160
8164
|
const e = [];
|
|
8161
8165
|
for (let t = 0; t < n.length; t++) {
|
|
8162
8166
|
for (const s of n[t].tokens)
|
|
8163
8167
|
e.push(s);
|
|
8164
|
-
t < n.length - 1 && e.push(new
|
|
8168
|
+
t < n.length - 1 && e.push(new Pe(1, void 0));
|
|
8165
8169
|
}
|
|
8166
8170
|
return e;
|
|
8167
8171
|
}
|
|
8168
|
-
function
|
|
8172
|
+
function ks(n, e) {
|
|
8169
8173
|
return n.length === e.length && n.className === e.className;
|
|
8170
8174
|
}
|
|
8171
|
-
function
|
|
8175
|
+
function ys(n) {
|
|
8172
8176
|
let e = 0;
|
|
8173
8177
|
for (const t of n)
|
|
8174
8178
|
e += t.length;
|
|
@@ -8177,12 +8181,12 @@ function ks(n) {
|
|
|
8177
8181
|
function Ka(n, e) {
|
|
8178
8182
|
const t = n.length, s = e.length;
|
|
8179
8183
|
let i = 0, o = 0;
|
|
8180
|
-
for (; i < t && i < s &&
|
|
8184
|
+
for (; i < t && i < s && ks(n[i], e[i]); )
|
|
8181
8185
|
o += n[i].length, i++;
|
|
8182
8186
|
let r = 0, c = 0;
|
|
8183
|
-
for (; r < t - i && r < s - i &&
|
|
8187
|
+
for (; r < t - i && r < s - i && ks(n[t - 1 - r], e[s - 1 - r]); )
|
|
8184
8188
|
c += n[t - 1 - r].length, r++;
|
|
8185
|
-
const a =
|
|
8189
|
+
const a = ys(n), l = ys(e), d = new w(o, a - c), u = l - c - o;
|
|
8186
8190
|
return d.isEmpty && u === 0 ? Ee.empty : Ee.replace(d, u);
|
|
8187
8191
|
}
|
|
8188
8192
|
const za = {
|
|
@@ -8465,7 +8469,7 @@ class zl {
|
|
|
8465
8469
|
this._comments.set(this._comments.get().filter((t) => t.id !== e), void 0);
|
|
8466
8470
|
}
|
|
8467
8471
|
}
|
|
8468
|
-
const
|
|
8472
|
+
const je = "http://www.w3.org/2000/svg", ja = 260, Qa = 320, Za = 0.32, Ja = 28, xs = 16, el = 12, tl = 18, nl = 4, sl = 2, il = 10;
|
|
8469
8473
|
class ol extends H {
|
|
8470
8474
|
constructor(e, t) {
|
|
8471
8475
|
super(), this._model = e, this._view = t, this._layer = this._createLayer("md-comment-shapes"), this._view.overlayContainer.appendChild(this._layer), this._register({
|
|
@@ -8480,7 +8484,7 @@ class ol extends H {
|
|
|
8480
8484
|
_layer;
|
|
8481
8485
|
_entries = /* @__PURE__ */ new Map();
|
|
8482
8486
|
_createLayer(e) {
|
|
8483
|
-
const t = document.createElementNS(
|
|
8487
|
+
const t = document.createElementNS(je, "svg");
|
|
8484
8488
|
return t.setAttribute("class", e), t;
|
|
8485
8489
|
}
|
|
8486
8490
|
_update(e) {
|
|
@@ -8508,11 +8512,11 @@ class ol extends H {
|
|
|
8508
8512
|
t.has(s) || (this._disposeEntry(i), this._entries.delete(s));
|
|
8509
8513
|
}
|
|
8510
8514
|
_createEntry(e) {
|
|
8511
|
-
const t = document.createElementNS(
|
|
8515
|
+
const t = document.createElementNS(je, "g");
|
|
8512
8516
|
t.setAttribute("class", "md-comment-group"), this._layer.appendChild(t);
|
|
8513
|
-
const s = document.createElementNS(
|
|
8517
|
+
const s = document.createElementNS(je, "path");
|
|
8514
8518
|
s.setAttribute("class", "md-comment-leader-path"), t.appendChild(s);
|
|
8515
|
-
const i = document.createElementNS(
|
|
8519
|
+
const i = document.createElementNS(je, "path");
|
|
8516
8520
|
i.setAttribute("class", "md-comment-shape-path"), t.appendChild(i);
|
|
8517
8521
|
const o = document.createElement("div");
|
|
8518
8522
|
o.className = "md-comment-card";
|
|
@@ -8566,11 +8570,11 @@ class ol extends H {
|
|
|
8566
8570
|
return;
|
|
8567
8571
|
}
|
|
8568
8572
|
this._layer.style.display = "";
|
|
8569
|
-
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(ja, Math.min(Qa, i * Za))), h = u + Ja +
|
|
8573
|
+
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(ja, Math.min(Qa, i * Za))), h = u + Ja + xs, f = d >= h ? 0 : Math.min(2 * (h - d), h), m = f > 0 ? `${Math.ceil(f)}px` : "";
|
|
8570
8574
|
t.style.paddingRight !== m && (t.style.paddingRight = m);
|
|
8571
|
-
const _ = this._view.coordinateSpace.capture().toLocalRect(t.getBoundingClientRect()).right -
|
|
8575
|
+
const _ = this._view.coordinateSpace.capture().toLocalRect(t.getBoundingClientRect()).right - xs - u, p = s.clientWidth, v = e.map(({ entry: b, rects: x }) => {
|
|
8572
8576
|
b.card.style.left = `${_}px`, b.card.style.width = `${u}px`;
|
|
8573
|
-
const T = rl(x), V = x.length > 0 ? Math.min(...x.map((
|
|
8577
|
+
const T = rl(x), V = x.length > 0 ? Math.min(...x.map((he) => he.y)) : 0;
|
|
8574
8578
|
return { entry: b, rects: x, anchor: T, desiredTop: V };
|
|
8575
8579
|
});
|
|
8576
8580
|
v.sort((b, x) => b.desiredTop - x.desiredTop);
|
|
@@ -8703,11 +8707,11 @@ const yi = {
|
|
|
8703
8707
|
edit: ye('<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>'),
|
|
8704
8708
|
close: ye('<line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line>')
|
|
8705
8709
|
};
|
|
8706
|
-
function
|
|
8710
|
+
function Mt(n) {
|
|
8707
8711
|
const e = L(`span.codicon.codicon-${n}`);
|
|
8708
8712
|
return e.setAttribute("aria-hidden", "true"), e.innerHTML = yi[n] ?? "", e;
|
|
8709
8713
|
}
|
|
8710
|
-
function
|
|
8714
|
+
function Qe(n) {
|
|
8711
8715
|
const e = L("div.rendered-markdown"), t = document.createElement("p");
|
|
8712
8716
|
for (const s of n.split(/(`[^`]+`)/g))
|
|
8713
8717
|
if (/^`[^`]+`$/.test(s)) {
|
|
@@ -8718,7 +8722,7 @@ function Ze(n) {
|
|
|
8718
8722
|
}
|
|
8719
8723
|
class ml {
|
|
8720
8724
|
constructor(e, t) {
|
|
8721
|
-
this._comments = e, this._domNode = L("div.agent-feedback-widget"), this._domNode.classList.add("collapsed"), this._domNode.tabIndex = -1, this._domNode.setAttribute("widgetid", "agent-feedback-widget-0"), this._headerNode = L("div.agent-feedback-widget-header"), this._headerNode.appendChild(
|
|
8725
|
+
this._comments = e, this._domNode = L("div.agent-feedback-widget"), this._domNode.classList.add("collapsed"), this._domNode.tabIndex = -1, this._domNode.setAttribute("widgetid", "agent-feedback-widget-0"), this._headerNode = L("div.agent-feedback-widget-header"), this._headerNode.appendChild(Mt("comment")), this._titleNode = L("span.agent-feedback-widget-title"), this._updateTitle(), this._headerNode.appendChild(this._titleNode), this._headerNode.appendChild(L("span.agent-feedback-widget-spacer")), this._toggleButton = L("div.agent-feedback-widget-toggle"), this._updateToggleButton(), this._headerNode.appendChild(this._toggleButton), this._domNode.appendChild(this._headerNode), this._bodyNode = L("div.agent-feedback-widget-body"), this._bodyNode.classList.add("collapsed"), this._buildFeedbackItems(), this._domNode.appendChild(this._bodyNode), this._domNode.appendChild(L("div.agent-feedback-widget-arrow")), this._setupEventHandlers(), this._domNode.classList.add("visible"), t?.expanded && this.expand(), t?.focusedCommentId && this.focusFeedback(t.focusedCommentId);
|
|
8722
8726
|
}
|
|
8723
8727
|
_domNode;
|
|
8724
8728
|
_headerNode;
|
|
@@ -8738,7 +8742,7 @@ class ml {
|
|
|
8738
8742
|
this._titleNode.textContent = e === 1 ? this._comments[0].text : `${e} comments`;
|
|
8739
8743
|
}
|
|
8740
8744
|
_updateToggleButton() {
|
|
8741
|
-
this._toggleButton.textContent = "", this._isExpanded ? (this._toggleButton.appendChild(
|
|
8745
|
+
this._toggleButton.textContent = "", this._isExpanded ? (this._toggleButton.appendChild(Mt("chevron-up")), this._toggleButton.title = "Collapse") : (this._toggleButton.appendChild(Mt("chevron-down")), this._toggleButton.title = "Expand");
|
|
8742
8746
|
}
|
|
8743
8747
|
_setupEventHandlers() {
|
|
8744
8748
|
this._listen(this._toggleButton, "click", (e) => {
|
|
@@ -8763,7 +8767,7 @@ class ml {
|
|
|
8763
8767
|
}
|
|
8764
8768
|
s.appendChild(i);
|
|
8765
8769
|
const c = L("div.agent-feedback-widget-text"), a = this._buildItemActions(e, t, c);
|
|
8766
|
-
s.appendChild(a.container), t.appendChild(s), c.appendChild(
|
|
8770
|
+
s.appendChild(a.container), t.appendChild(s), c.appendChild(Qe(e.text)), t.appendChild(c), e.suggestion?.edits.length && t.appendChild(this._renderSuggestion(e)), e.replies?.length && t.appendChild(this._renderReplies(e.replies)), this._listen(t, "click", (l) => {
|
|
8767
8771
|
const d = l.target;
|
|
8768
8772
|
if (!(d?.closest(".monaco-action-bar") || d?.closest(".agent-feedback-widget-add-reply"))) {
|
|
8769
8773
|
if (d?.closest(".agent-feedback-widget-text, .agent-feedback-widget-suggestion-text, .agent-feedback-widget-reply-text")) {
|
|
@@ -8832,7 +8836,7 @@ class ml {
|
|
|
8832
8836
|
const t = L("div.agent-feedback-widget-replies");
|
|
8833
8837
|
for (const s of e) {
|
|
8834
8838
|
const i = L("div.agent-feedback-widget-reply"), o = L("div.agent-feedback-widget-reply-text");
|
|
8835
|
-
o.appendChild(
|
|
8839
|
+
o.appendChild(Qe(s)), i.appendChild(o), t.appendChild(i);
|
|
8836
8840
|
}
|
|
8837
8841
|
return t;
|
|
8838
8842
|
}
|
|
@@ -8857,7 +8861,7 @@ class ml {
|
|
|
8857
8861
|
if (a.key === "Enter" && !a.shiftKey) {
|
|
8858
8862
|
a.preventDefault(), a.stopPropagation();
|
|
8859
8863
|
const l = o.value.trim();
|
|
8860
|
-
t.classList.remove("editing"), t.textContent = "", t.appendChild(
|
|
8864
|
+
t.classList.remove("editing"), t.textContent = "", t.appendChild(Qe(l || e.text)), s.setEnabled(!0);
|
|
8861
8865
|
} else a.key === "Escape" && (a.preventDefault(), a.stopPropagation(), c());
|
|
8862
8866
|
}), this._listen(o, "blur", c), o.focus();
|
|
8863
8867
|
}
|
|
@@ -8884,7 +8888,7 @@ class ml {
|
|
|
8884
8888
|
let d = t.querySelector(".agent-feedback-widget-replies");
|
|
8885
8889
|
d || (d = this._renderReplies([]), t.insertBefore(d, i));
|
|
8886
8890
|
const u = L("div.agent-feedback-widget-reply"), h = L("div.agent-feedback-widget-reply-text");
|
|
8887
|
-
h.appendChild(
|
|
8891
|
+
h.appendChild(Qe(l)), u.appendChild(h), d.appendChild(u);
|
|
8888
8892
|
}
|
|
8889
8893
|
c();
|
|
8890
8894
|
} else a.key === "Escape" && (a.preventDefault(), a.stopPropagation(), c());
|
|
@@ -8933,12 +8937,12 @@ function xe(n) {
|
|
|
8933
8937
|
const e = pl.exec(n)?.[1] ?? "div", t = document.createElement(e), s = n.slice(e.length).split(".").filter(Boolean);
|
|
8934
8938
|
return s.length && (t.className = s.join(" ")), t;
|
|
8935
8939
|
}
|
|
8936
|
-
function
|
|
8940
|
+
function Es(n) {
|
|
8937
8941
|
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>`;
|
|
8938
8942
|
}
|
|
8939
8943
|
const _l = {
|
|
8940
|
-
edit:
|
|
8941
|
-
trash:
|
|
8944
|
+
edit: Es('<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>'),
|
|
8945
|
+
trash: Es('<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>')
|
|
8942
8946
|
};
|
|
8943
8947
|
function vl(n, e) {
|
|
8944
8948
|
const t = document.createElement("button");
|
|
@@ -9023,26 +9027,26 @@ export {
|
|
|
9023
9027
|
R as BlockViewNode,
|
|
9024
9028
|
Gl as COMMENTS_DESIGNS,
|
|
9025
9029
|
ql as COMMENTS_DESIGN_LABELS,
|
|
9026
|
-
|
|
9027
|
-
|
|
9030
|
+
Z as CodeBlockAstNode,
|
|
9031
|
+
on as CodeBlockViewNode,
|
|
9028
9032
|
Xa as CommentInputWidget,
|
|
9029
9033
|
bi as CommentModeController,
|
|
9030
9034
|
zl as CommentsModel,
|
|
9031
9035
|
ol as CommentsView,
|
|
9032
9036
|
N as CursorPosition,
|
|
9033
9037
|
Wc as CursorView,
|
|
9034
|
-
|
|
9035
|
-
|
|
9038
|
+
Ue as CursorViewRendering,
|
|
9039
|
+
Fe as DEFAULT_INDENTATION_CONFIG,
|
|
9036
9040
|
Ei as DEFAULT_WORD_NAVIGATION_CONFIG,
|
|
9037
9041
|
Yl as DEFAULT_WORD_SEPARATORS,
|
|
9038
|
-
|
|
9039
|
-
|
|
9042
|
+
jt as DocumentAstNode,
|
|
9043
|
+
cn as DocumentViewNode,
|
|
9040
9044
|
$l as EditorController,
|
|
9041
|
-
|
|
9045
|
+
mt as EditorCoordinateSpace,
|
|
9042
9046
|
Ur as EditorCoordinateTransform,
|
|
9043
9047
|
Bl as EditorModel,
|
|
9044
9048
|
Al as EditorView,
|
|
9045
|
-
|
|
9049
|
+
Gt as EmphasisAstNode,
|
|
9046
9050
|
aa as FIND_MATCH_LIMIT,
|
|
9047
9051
|
wa as FindController,
|
|
9048
9052
|
oa as FindHighlightsView,
|
|
@@ -9051,13 +9055,13 @@ export {
|
|
|
9051
9055
|
va as FindWidget,
|
|
9052
9056
|
Ce as FrontMatterAstNode,
|
|
9053
9057
|
W as GlueAstNode,
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
+
fe as HeadingAstNode,
|
|
9059
|
+
Ae as ImageAstNode,
|
|
9060
|
+
Xt as InlineCodeAstNode,
|
|
9061
|
+
Yt as InlineMathAstNode,
|
|
9058
9062
|
Ee as LengthEdit,
|
|
9059
|
-
|
|
9060
|
-
|
|
9063
|
+
zt as LengthReplacement,
|
|
9064
|
+
Be as LinkAstNode,
|
|
9061
9065
|
q as ListAstNode,
|
|
9062
9066
|
G as ListItemAstNode,
|
|
9063
9067
|
Hl as LocalHistoryStrategy,
|
|
@@ -9070,81 +9074,81 @@ export {
|
|
|
9070
9074
|
Va as MonacoSyntaxHighlighter,
|
|
9071
9075
|
ya as NativeClipboardStrategy,
|
|
9072
9076
|
w as OffsetRange,
|
|
9073
|
-
|
|
9074
|
-
|
|
9077
|
+
ie as ParagraphAstNode,
|
|
9078
|
+
ue as Point2D,
|
|
9075
9079
|
S as Rect2D,
|
|
9076
|
-
|
|
9080
|
+
Ie as RichLink,
|
|
9077
9081
|
k as Selection,
|
|
9078
9082
|
Bc as SelectionView,
|
|
9079
|
-
|
|
9083
|
+
Xn as SelectionViewRendering,
|
|
9080
9084
|
ki as StackedCommentsPresenter,
|
|
9081
|
-
|
|
9085
|
+
Ut as StrikethroughAstNode,
|
|
9082
9086
|
M as StringEdit,
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9087
|
+
le as StringReplacement,
|
|
9088
|
+
dn as StringValue,
|
|
9089
|
+
qt as StrongAstNode,
|
|
9086
9090
|
Le as TableAstNode,
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9091
|
+
Ne as TableCellAstNode,
|
|
9092
|
+
Re as TableRowAstNode,
|
|
9093
|
+
et as TextAstNode,
|
|
9094
|
+
_e as ThematicBreakAstNode,
|
|
9095
|
+
Pe as Token,
|
|
9092
9096
|
oe as ViewNode,
|
|
9093
9097
|
Fi as VirtualCursorLine,
|
|
9094
9098
|
lt as VisualLine,
|
|
9095
|
-
|
|
9096
|
-
|
|
9099
|
+
De as VisualLineMap,
|
|
9100
|
+
pe as VisualRun,
|
|
9097
9101
|
kl as VsCodeV2CommentsView,
|
|
9098
9102
|
gl as VscodeStackedCommentsView,
|
|
9099
|
-
|
|
9100
|
-
|
|
9103
|
+
Ot as blocksIntersecting,
|
|
9104
|
+
Wt as commands,
|
|
9101
9105
|
Kl as createDefaultMonacoSyntaxHighlighter,
|
|
9102
9106
|
$o as cursorDocumentEnd,
|
|
9103
9107
|
Vo as cursorDocumentStart,
|
|
9104
9108
|
Ko as cursorDown,
|
|
9105
9109
|
Po as cursorLeft,
|
|
9106
|
-
|
|
9107
|
-
|
|
9110
|
+
Nt as cursorLineEnd,
|
|
9111
|
+
Rt as cursorLineStart,
|
|
9108
9112
|
Ao as cursorMoveLeft,
|
|
9109
9113
|
Bo as cursorMoveRight,
|
|
9110
9114
|
Io as cursorRight,
|
|
9111
|
-
|
|
9115
|
+
pn as cursorUp,
|
|
9112
9116
|
Wo as cursorVisualLineEnd,
|
|
9113
9117
|
Ho as cursorVisualLineStart,
|
|
9114
9118
|
Fo as cursorWordLeft,
|
|
9115
9119
|
Do as cursorWordRight,
|
|
9116
|
-
|
|
9120
|
+
_n as deleteLeft,
|
|
9117
9121
|
Yo as deleteLineLeft,
|
|
9118
9122
|
jo as deleteLineRight,
|
|
9119
9123
|
Go as deleteRight,
|
|
9120
9124
|
Uo as deleteWordLeft,
|
|
9121
9125
|
Xo as deleteWordRight,
|
|
9122
9126
|
vi as escapeFindRegex,
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9127
|
+
Bs as findBlockAtOffset,
|
|
9128
|
+
Y as findNodeOffsetById,
|
|
9129
|
+
Ls as findWordAt,
|
|
9126
9130
|
Ci as findWordBoundaryLeft,
|
|
9127
9131
|
Si as findWordBoundaryRight,
|
|
9128
9132
|
Li as findWordDeleteBoundaryLeft,
|
|
9129
9133
|
Mi as findWordDeleteBoundaryRight,
|
|
9130
9134
|
no as getAnnotatedSource,
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9135
|
+
Ds as hiddenCursorRanges,
|
|
9136
|
+
tr as insertHardLineBreak,
|
|
9137
|
+
er as insertLineBreak,
|
|
9138
|
+
Jo as insertParagraph,
|
|
9139
|
+
nr as insertSmartEnter,
|
|
9136
9140
|
Zo as insertTab,
|
|
9137
9141
|
Qo as insertText,
|
|
9138
9142
|
Me as nextCursorPosition,
|
|
9139
9143
|
ce as normalizeCursorPosition,
|
|
9140
|
-
|
|
9144
|
+
Vs as outdent,
|
|
9141
9145
|
wr as selectAll,
|
|
9142
9146
|
kr as selectBlock,
|
|
9143
9147
|
br as selectWord,
|
|
9144
9148
|
Wi as taskCheckboxRange,
|
|
9145
9149
|
Pl as visualizeAst,
|
|
9146
9150
|
Vl as vscodeHostKeyboardProfile,
|
|
9147
|
-
|
|
9151
|
+
Ht as vscodeKeyboardProfile,
|
|
9148
9152
|
Fl as vscodeLocalKeyboardProfile
|
|
9149
9153
|
};
|
|
9150
9154
|
//# sourceMappingURL=index.js.map
|