mdld-parse 0.9.3 → 0.9.4
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/docs/Guide.md +660 -166
- package/dist/docs/guide-m.md +56 -0
- package/dist/docs/one-page.md +322 -0
- package/dist/examples/Status-SHACL.md +8 -10
- package/dist/examples/demo/journal.md +110 -9
- package/dist/examples/demo/minimal.md +18 -6
- package/dist/examples/demo/project.md +90 -7
- package/dist/examples/demo/prov.md +107 -0
- package/dist/examples/demo/rdf.md +69 -0
- package/dist/examples/demo/recipe.md +79 -15
- package/dist/examples/demo/research.md +110 -30
- package/dist/examples/demo/shacl.md +161 -0
- package/dist/examples/demo/space-mission.md +109 -28
- package/dist/examples/demo/tasks.md +175 -0
- package/dist/examples/demo/xsd.md +91 -0
- package/dist/index.html +686 -260
- package/dist/index.js +469 -247
- package/package.json +2 -2
- package/dist/examples/prov-o.md +0 -2367
- package/dist/examples/rdf.md +0 -827
- package/dist/examples/shacl.md +0 -3399
package/dist/index.js
CHANGED
|
@@ -116,7 +116,7 @@ var e = {
|
|
|
116
116
|
};
|
|
117
117
|
function f(e, t) {
|
|
118
118
|
if (!e || !t || !t.quadIndex) return null;
|
|
119
|
-
let n =
|
|
119
|
+
let n = te(e);
|
|
120
120
|
return n && t.quadIndex.get(n) || null;
|
|
121
121
|
}
|
|
122
122
|
function p(e) {
|
|
@@ -295,15 +295,15 @@ function v(e, t, n) {
|
|
|
295
295
|
r
|
|
296
296
|
]);
|
|
297
297
|
}
|
|
298
|
-
function
|
|
298
|
+
function te(e) {
|
|
299
299
|
return e ? v(e.subject, e.predicate, e.object) : null;
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function ne(e, t, n, r, i) {
|
|
302
302
|
return t ? i.literal(e, i.namedNode(h(t, r))) : n ? i.literal(e, n) : i.literal(e);
|
|
303
303
|
}
|
|
304
304
|
//#endregion
|
|
305
305
|
//#region src/tokenizers.js
|
|
306
|
-
function
|
|
306
|
+
function re(e) {
|
|
307
307
|
if (e.length < 3) return null;
|
|
308
308
|
let t = e[0];
|
|
309
309
|
if (t !== "`" && t !== "~") return null;
|
|
@@ -319,7 +319,7 @@ function b(e) {
|
|
|
319
319
|
infoString: r
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function ie(e) {
|
|
323
323
|
if (e[0] !== "[") return null;
|
|
324
324
|
let t = e.indexOf("]", 1);
|
|
325
325
|
if (t === -1) return null;
|
|
@@ -336,7 +336,7 @@ function x(e) {
|
|
|
336
336
|
iri: a
|
|
337
337
|
} : null;
|
|
338
338
|
}
|
|
339
|
-
function
|
|
339
|
+
function ae(e) {
|
|
340
340
|
if (e[0] !== "#") return null;
|
|
341
341
|
let t = 1;
|
|
342
342
|
for (; t < e.length && t < 6 && e[t] === "#";) t++;
|
|
@@ -350,7 +350,7 @@ function S(e) {
|
|
|
350
350
|
attrs: o
|
|
351
351
|
};
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function y(e) {
|
|
354
354
|
let t = 0;
|
|
355
355
|
for (; t < e.length && (e[t] === " " || e[t] === " ");) t++;
|
|
356
356
|
let n = t;
|
|
@@ -373,7 +373,7 @@ function C(e) {
|
|
|
373
373
|
attrs: s
|
|
374
374
|
};
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function oe(e) {
|
|
377
377
|
if (e[0] !== ">" || e.length > 1 && e[1] !== " " && e[1] !== " ") return null;
|
|
378
378
|
let t = 1;
|
|
379
379
|
for (; t < e.length && (e[t] === " " || e[t] === " ");) t++;
|
|
@@ -383,7 +383,7 @@ function w(e) {
|
|
|
383
383
|
attrs: r
|
|
384
384
|
};
|
|
385
385
|
}
|
|
386
|
-
function
|
|
386
|
+
function se(e) {
|
|
387
387
|
let t = 0;
|
|
388
388
|
for (; t < e.length && (e[t] === " " || e[t] === " ");) t++;
|
|
389
389
|
if (t >= e.length || e[t] !== "{" || (t++, t >= e.length || e[t] !== "=")) return null;
|
|
@@ -395,12 +395,12 @@ function T(e) {
|
|
|
395
395
|
for (t++; t < e.length && (e[t] === " " || e[t] === " ");) t++;
|
|
396
396
|
return t < e.length ? null : { content: i };
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function ce(e, t, n = "[", r = "]") {
|
|
399
399
|
let i = 1, a = t + 1;
|
|
400
400
|
for (; a < e.length && i > 0;) e[a] === n && i++, e[a] === r && i--, i > 0 && a++;
|
|
401
401
|
return i === 0 ? a : null;
|
|
402
402
|
}
|
|
403
|
-
function
|
|
403
|
+
function b(e, t) {
|
|
404
404
|
let n = t;
|
|
405
405
|
for (; n < e.length && (e[n] === " " || e[n] === " ");) n++;
|
|
406
406
|
if (n >= e.length || e[n] !== "{") return null;
|
|
@@ -410,7 +410,7 @@ function E(e, t) {
|
|
|
410
410
|
endPos: r + 1
|
|
411
411
|
};
|
|
412
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function le(e, t) {
|
|
414
414
|
if (e[t] !== "<") return null;
|
|
415
415
|
let n = e.indexOf(">", t + 1);
|
|
416
416
|
if (n === -1) return null;
|
|
@@ -420,7 +420,7 @@ function re(e, t) {
|
|
|
420
420
|
endPos: n + 1
|
|
421
421
|
} : null;
|
|
422
422
|
}
|
|
423
|
-
function
|
|
423
|
+
function ue(e, t) {
|
|
424
424
|
let n = e[t];
|
|
425
425
|
if (n !== "*" && n !== "_") return null;
|
|
426
426
|
let r = 1;
|
|
@@ -433,7 +433,7 @@ function ie(e, t) {
|
|
|
433
433
|
s++;
|
|
434
434
|
continue;
|
|
435
435
|
}
|
|
436
|
-
let t = e.slice(o, s), a = s + r, c =
|
|
436
|
+
let t = e.slice(o, s), a = s + r, c = b(e, a), l = c ? c.endPos : a;
|
|
437
437
|
return {
|
|
438
438
|
type: i,
|
|
439
439
|
content: t,
|
|
@@ -446,7 +446,7 @@ function ie(e, t) {
|
|
|
446
446
|
}
|
|
447
447
|
return null;
|
|
448
448
|
}
|
|
449
|
-
function
|
|
449
|
+
function de(e, t) {
|
|
450
450
|
if (e[t] !== "`") return null;
|
|
451
451
|
let n = 1;
|
|
452
452
|
for (; t + n < e.length && e[t + n] === "`";) n++;
|
|
@@ -454,7 +454,7 @@ function ae(e, t) {
|
|
|
454
454
|
let r = "`".repeat(n), i = t + n, a = i;
|
|
455
455
|
for (; a < e.length;) {
|
|
456
456
|
if (e.slice(a, a + n) === r) {
|
|
457
|
-
let t = e.slice(i, a), r = a + n, o =
|
|
457
|
+
let t = e.slice(i, a), r = a + n, o = b(e, r), s = o ? o.endPos : r;
|
|
458
458
|
return {
|
|
459
459
|
type: "code",
|
|
460
460
|
content: t,
|
|
@@ -467,9 +467,9 @@ function ae(e, t) {
|
|
|
467
467
|
}
|
|
468
468
|
return null;
|
|
469
469
|
}
|
|
470
|
-
function
|
|
470
|
+
function fe(e, t) {
|
|
471
471
|
if (e[t] !== "[") return null;
|
|
472
|
-
let n =
|
|
472
|
+
let n = ce(e, t, "[", "]");
|
|
473
473
|
if (!n) return null;
|
|
474
474
|
let r = e.slice(t + 1, n), i = n + 1, a = null;
|
|
475
475
|
if (i < e.length && e[i] === "(") {
|
|
@@ -482,7 +482,7 @@ function oe(e, t) {
|
|
|
482
482
|
n.match(/^[a-zA-Z][a-zA-Z0-9+\-.]*:/) && (a = n, i = t + 1);
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
|
-
let o =
|
|
485
|
+
let o = b(e, i), s = o ? o.endPos : i;
|
|
486
486
|
return {
|
|
487
487
|
type: a ? "link" : "span",
|
|
488
488
|
text: r,
|
|
@@ -492,26 +492,26 @@ function oe(e, t) {
|
|
|
492
492
|
bracketEnd: n + 1
|
|
493
493
|
};
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function x(e, t = 0) {
|
|
496
496
|
let n = [], r = e.length, i = 0;
|
|
497
497
|
for (; i < r;) {
|
|
498
498
|
let r = e[i], a = null;
|
|
499
499
|
switch (r) {
|
|
500
500
|
case "<":
|
|
501
|
-
if (a =
|
|
502
|
-
let t =
|
|
501
|
+
if (a = le(e, i), a) {
|
|
502
|
+
let t = b(e, a.endPos);
|
|
503
503
|
t && (a.attrs = t.attrs, a.endPos = t.endPos), a.type = "link", a.text = a.url;
|
|
504
504
|
}
|
|
505
505
|
break;
|
|
506
506
|
case "[":
|
|
507
|
-
a =
|
|
507
|
+
a = fe(e, i);
|
|
508
508
|
break;
|
|
509
509
|
case "*":
|
|
510
510
|
case "_":
|
|
511
|
-
a =
|
|
511
|
+
a = ue(e, i);
|
|
512
512
|
break;
|
|
513
513
|
case "`":
|
|
514
|
-
a =
|
|
514
|
+
a = de(e, i);
|
|
515
515
|
break;
|
|
516
516
|
}
|
|
517
517
|
if (!a) {
|
|
@@ -538,23 +538,23 @@ function se(e, t = 0) {
|
|
|
538
538
|
}
|
|
539
539
|
//#endregion
|
|
540
540
|
//#region src/shared.js
|
|
541
|
-
var
|
|
542
|
-
function
|
|
543
|
-
return
|
|
541
|
+
var S = /* @__PURE__ */ new Map();
|
|
542
|
+
function pe(e) {
|
|
543
|
+
return S.has(e) || S.set(e, RegExp(`^(${e}{3,})`)), S.get(e);
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function C(e, t, n, r, i) {
|
|
546
546
|
let a = r + (r < e.length && e[r] === " " ? 1 : e.slice(r).match(/^\s+/)?.[0]?.length || 0);
|
|
547
547
|
return {
|
|
548
548
|
valueRange: [n + a, n + a + i],
|
|
549
|
-
attrsRange:
|
|
549
|
+
attrsRange: w(e, t, n)
|
|
550
550
|
};
|
|
551
551
|
}
|
|
552
|
-
function
|
|
552
|
+
function w(e, t, n) {
|
|
553
553
|
if (!t) return null;
|
|
554
554
|
let r = e.lastIndexOf(t);
|
|
555
555
|
return r >= 0 ? [n + r, n + r + t.length] : null;
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function T(e, t, n, r = null, i = null, a = null, o = {}) {
|
|
558
558
|
let s = {
|
|
559
559
|
type: e,
|
|
560
560
|
range: t,
|
|
@@ -570,31 +570,31 @@ function A(e, t, n, r = null, i = null, a = null, o = {}) {
|
|
|
570
570
|
value: null
|
|
571
571
|
}), s;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
574
|
-
let a = i[4] || null, o =
|
|
575
|
-
return
|
|
573
|
+
function me(e, t, n, r, i) {
|
|
574
|
+
let a = i[4] || null, o = C(t, a, n, i[1].length + (i[2] ? i[2].length : 0), i[3].length);
|
|
575
|
+
return T(e, [n, r - 1], i[3].trim(), a, o.attrsRange, o.valueRange, { indent: i[1].length });
|
|
576
576
|
}
|
|
577
|
-
var
|
|
577
|
+
var E = {}, he = Object.freeze({
|
|
578
578
|
predicates: [],
|
|
579
579
|
types: [],
|
|
580
580
|
subject: null
|
|
581
581
|
});
|
|
582
|
-
function
|
|
583
|
-
if (!e) return
|
|
584
|
-
let t =
|
|
585
|
-
return t || (t = Object.freeze(_(e)),
|
|
582
|
+
function D(e) {
|
|
583
|
+
if (!e) return he;
|
|
584
|
+
let t = E[e];
|
|
585
|
+
return t || (t = Object.freeze(_(e)), E[e] = t), t;
|
|
586
586
|
}
|
|
587
|
-
function
|
|
587
|
+
function ge(e, t) {
|
|
588
588
|
if (!e.range || !t) return 0;
|
|
589
589
|
let n = t.substring(e.range.start, e.range.end).match(/^(\s*)/), r = n ? n[1].length : 0;
|
|
590
590
|
return Math.floor(r / 2);
|
|
591
591
|
}
|
|
592
|
-
function
|
|
592
|
+
function _e(e, t, n = null) {
|
|
593
593
|
if (!t || !e) return "";
|
|
594
594
|
let r = e.substring(t[0], t[1]);
|
|
595
595
|
return n && (r = r.substring(0, n[0] - t[0]) + r.substring(n[1] - t[0])), r.trim();
|
|
596
596
|
}
|
|
597
|
-
function
|
|
597
|
+
function ve(e) {
|
|
598
598
|
if (!e.text) return "";
|
|
599
599
|
let t = e.text;
|
|
600
600
|
e.attrsRange && (t = t.substring(0, e.attrsRange[0] - (e.range?.[0] || 0)) + t.substring(e.attrsRange[1] - (e.range?.[0] || 0)));
|
|
@@ -607,7 +607,7 @@ function pe(e) {
|
|
|
607
607
|
default: return t.trim();
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
function
|
|
610
|
+
function ye(e, t, n, r = null) {
|
|
611
611
|
return {
|
|
612
612
|
blockId: e.id,
|
|
613
613
|
range: e.range,
|
|
@@ -619,72 +619,72 @@ function me(e, t, n, r = null) {
|
|
|
619
619
|
value: e.text || ""
|
|
620
620
|
};
|
|
621
621
|
}
|
|
622
|
-
function
|
|
622
|
+
function O(e, t, n) {
|
|
623
623
|
if (!t) return null;
|
|
624
624
|
let r = t.value, i = r.indexOf("#"), a = i > -1 ? r.slice(0, i) : r;
|
|
625
625
|
return n.namedNode(a + "#" + e);
|
|
626
626
|
}
|
|
627
|
-
function
|
|
628
|
-
return e.subject ? e.subject === "RESET" ? (t.currentSubject = null, null) : e.subject.startsWith("=#") ?
|
|
627
|
+
function k(e, t) {
|
|
628
|
+
return e.subject ? e.subject === "RESET" ? (t.currentSubject = null, null) : e.subject.startsWith("=#") ? O(e.subject.substring(2), t.currentSubject, t.df) : t.df.namedNode(h(e.subject, t.ctx)) : null;
|
|
629
629
|
}
|
|
630
|
-
function
|
|
631
|
-
return e.object ? e.object.startsWith("#") ?
|
|
630
|
+
function be(e, t) {
|
|
631
|
+
return e.object ? e.object.startsWith("#") ? O(e.object.substring(1), t.currentSubject, t.df) : t.df.namedNode(h(e.object, t.ctx)) : null;
|
|
632
632
|
}
|
|
633
|
-
function
|
|
633
|
+
function A(e) {
|
|
634
634
|
return e ? e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'") : "";
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function j(e) {
|
|
637
637
|
return e?.termType === "Literal";
|
|
638
638
|
}
|
|
639
|
-
function
|
|
639
|
+
function M(e) {
|
|
640
640
|
return e?.termType === "NamedNode";
|
|
641
641
|
}
|
|
642
|
-
function
|
|
642
|
+
function xe(e) {
|
|
643
643
|
return e?.value === "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
|
|
644
644
|
}
|
|
645
|
-
function
|
|
645
|
+
function N(e, t) {
|
|
646
646
|
if (!e) return null;
|
|
647
647
|
let n = g(e, t);
|
|
648
648
|
return n.includes(":") ? n.split(":")[0] : null;
|
|
649
649
|
}
|
|
650
|
-
function
|
|
650
|
+
function Se(e, t) {
|
|
651
651
|
let n = /* @__PURE__ */ new Set();
|
|
652
652
|
for (let r of e.values()) for (let e of r) {
|
|
653
|
-
let r =
|
|
653
|
+
let r = N(e.subject.value, t);
|
|
654
654
|
r && n.add(r);
|
|
655
|
-
let i =
|
|
656
|
-
if (i && n.add(i),
|
|
657
|
-
let r =
|
|
655
|
+
let i = N(e.predicate.value, t);
|
|
656
|
+
if (i && n.add(i), M(e.object)) {
|
|
657
|
+
let r = N(e.object.value, t);
|
|
658
658
|
r && n.add(r);
|
|
659
659
|
}
|
|
660
660
|
if (e.object.datatype && e.object.datatype.value) {
|
|
661
|
-
let r =
|
|
661
|
+
let r = N(e.object.datatype.value, t);
|
|
662
662
|
r && n.add(r);
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
665
|
return n;
|
|
666
666
|
}
|
|
667
|
-
function
|
|
667
|
+
function P(e, t, n, r, i = []) {
|
|
668
668
|
let a = r(e, t);
|
|
669
669
|
t.currentBlock = a, t.blockStack.push(a.id), i.forEach((n) => n(e, t)), n(e, t, e.type), t.blockStack.pop(), t.currentBlock = t.blockStack.length > 0 ? t.origin.blocks.get(t.blockStack[t.blockStack.length - 1]) : null;
|
|
670
670
|
}
|
|
671
|
-
function
|
|
671
|
+
function F(e) {
|
|
672
672
|
return e.sort((e, t) => e.predicate.value.localeCompare(t.predicate.value));
|
|
673
673
|
}
|
|
674
|
-
var
|
|
675
|
-
function
|
|
674
|
+
var Ce = (e, t) => `[${e}] <${t}>\n`;
|
|
675
|
+
function we(e, t) {
|
|
676
676
|
let n = g(e.predicate.value, t);
|
|
677
677
|
e.object.language ? n += ` @${e.object.language}` : e.object.datatype.value !== "http://www.w3.org/2001/XMLSchema#string" && (n += ` ^^${g(e.object.datatype.value, t)}`);
|
|
678
678
|
let r = e.object.value || e.object, i = typeof r == "string" ? r : String(r), a = e.object.datatype?.value || "";
|
|
679
679
|
return i.includes("\n") ? `~~~ {${n}}\n${i}\n~~~\n\n` : a.includes("integer") || a.includes("decimal") || a.includes("double") || a.includes("float") ? `\`${i}\` {${n}}\n` : a.includes("date") || a.includes("time") ? `*${i}* {${n}}\n` : a.includes("boolean") ? `**${i}** {${n}}\n` : `[${i}] {${n}}\n`;
|
|
680
680
|
}
|
|
681
|
-
var
|
|
681
|
+
var Te = (e, t, n = null) => {
|
|
682
682
|
let r = g(e.object.value, t), i = g(e.predicate.value, t);
|
|
683
683
|
return `[${n && n.has(e.object.value) ? n.get(e.object.value) : r}] {+${r} ?${i}}\n`;
|
|
684
684
|
};
|
|
685
|
-
function
|
|
685
|
+
function Ee(e) {
|
|
686
686
|
let t = [], n = [], r = [];
|
|
687
|
-
for (let i of e)
|
|
687
|
+
for (let i of e) xe(i.predicate) ? t.push(i) : j(i.object) ? n.push(i) : M(i.object) && r.push(i);
|
|
688
688
|
return {
|
|
689
689
|
types: t,
|
|
690
690
|
literals: n,
|
|
@@ -693,7 +693,7 @@ function xe(e) {
|
|
|
693
693
|
}
|
|
694
694
|
//#endregion
|
|
695
695
|
//#region src/parse.js
|
|
696
|
-
function
|
|
696
|
+
function I(t, n = {}) {
|
|
697
697
|
let r = typeof t == "object" && !!t && "text" in t, i = r ? t.text : t, a = r ? {
|
|
698
698
|
context: t.context,
|
|
699
699
|
dataFactory: t.dataFactory,
|
|
@@ -721,7 +721,7 @@ function V(t, n = {}) {
|
|
|
721
721
|
statementCandidates: /* @__PURE__ */ new Map(),
|
|
722
722
|
currentBlock: null,
|
|
723
723
|
blockStack: []
|
|
724
|
-
}, s =
|
|
724
|
+
}, s = De(i);
|
|
725
725
|
o.tokens = s.tokens;
|
|
726
726
|
for (let e = 0; e < o.tokens.length; e++) {
|
|
727
727
|
let t = o.tokens[e];
|
|
@@ -734,7 +734,7 @@ function V(t, n = {}) {
|
|
|
734
734
|
o.ctx[t.prefix] = e;
|
|
735
735
|
continue;
|
|
736
736
|
}
|
|
737
|
-
|
|
737
|
+
Le[t.type]?.(t, o);
|
|
738
738
|
}
|
|
739
739
|
let c = /* @__PURE__ */ new Set();
|
|
740
740
|
for (let e of o.quads) c.add(v(e.subject, e.predicate, e.object));
|
|
@@ -753,14 +753,14 @@ function V(t, n = {}) {
|
|
|
753
753
|
md: s.md
|
|
754
754
|
};
|
|
755
755
|
}
|
|
756
|
-
function
|
|
757
|
-
return e.type === "code" ? [] : e._carriers || (e._carriers =
|
|
756
|
+
function L(e) {
|
|
757
|
+
return e.type === "code" ? [] : e._carriers || (e._carriers = Oe(e.text, e.range[0]));
|
|
758
758
|
}
|
|
759
|
-
function
|
|
759
|
+
function De(e) {
|
|
760
760
|
let t = [], n = [], r = e.split("\n"), i = 0, a = null, o = [
|
|
761
761
|
{
|
|
762
762
|
type: "fence",
|
|
763
|
-
test: (e) =>
|
|
763
|
+
test: (e) => re(e.trim()),
|
|
764
764
|
process: s
|
|
765
765
|
},
|
|
766
766
|
{
|
|
@@ -770,27 +770,27 @@ function Se(e) {
|
|
|
770
770
|
},
|
|
771
771
|
{
|
|
772
772
|
type: "prefix",
|
|
773
|
-
test: (e) =>
|
|
773
|
+
test: (e) => ie(e),
|
|
774
774
|
process: c
|
|
775
775
|
},
|
|
776
776
|
{
|
|
777
777
|
type: "standalone",
|
|
778
|
-
test: (e) =>
|
|
778
|
+
test: (e) => se(e),
|
|
779
779
|
process: p
|
|
780
780
|
},
|
|
781
781
|
{
|
|
782
782
|
type: "heading",
|
|
783
|
-
test: (e) =>
|
|
783
|
+
test: (e) => ae(e),
|
|
784
784
|
process: l
|
|
785
785
|
},
|
|
786
786
|
{
|
|
787
787
|
type: "list",
|
|
788
|
-
test: (e) =>
|
|
788
|
+
test: (e) => y(e),
|
|
789
789
|
process: u
|
|
790
790
|
},
|
|
791
791
|
{
|
|
792
792
|
type: "blockquote",
|
|
793
|
-
test: (e) =>
|
|
793
|
+
test: (e) => oe(e),
|
|
794
794
|
process: d
|
|
795
795
|
},
|
|
796
796
|
{
|
|
@@ -802,7 +802,7 @@ function Se(e) {
|
|
|
802
802
|
function s(e, r, i) {
|
|
803
803
|
let o = e.trim();
|
|
804
804
|
if (a) {
|
|
805
|
-
let i = a.fence[0], s = i.repeat(a.fence.length), c = o.match(
|
|
805
|
+
let i = a.fence[0], s = i.repeat(a.fence.length), c = o.match(pe(i));
|
|
806
806
|
if (c && c[1] === s) {
|
|
807
807
|
let i = a.valueRangeStart, o = Math.max(i, r - 1);
|
|
808
808
|
t.push({
|
|
@@ -820,7 +820,7 @@ function Se(e) {
|
|
|
820
820
|
n.push(s);
|
|
821
821
|
}
|
|
822
822
|
} else {
|
|
823
|
-
let t =
|
|
823
|
+
let t = re(o);
|
|
824
824
|
if (!t) return !1;
|
|
825
825
|
let i = t.attrs, s = i ? e.indexOf(i) : -1, c = r + e.length + 1;
|
|
826
826
|
a = {
|
|
@@ -838,7 +838,7 @@ function Se(e) {
|
|
|
838
838
|
return !0;
|
|
839
839
|
}
|
|
840
840
|
function c(e, n, r) {
|
|
841
|
-
let i =
|
|
841
|
+
let i = ie(e);
|
|
842
842
|
return t.push({
|
|
843
843
|
type: "prefix",
|
|
844
844
|
prefix: i.prefix,
|
|
@@ -846,32 +846,32 @@ function Se(e) {
|
|
|
846
846
|
}), !0;
|
|
847
847
|
}
|
|
848
848
|
function l(e, r, i) {
|
|
849
|
-
let a =
|
|
850
|
-
t.push(
|
|
849
|
+
let a = ae(e), o = a.attrs, s = a.depth, c = C(e, o, r, s, a.content.length);
|
|
850
|
+
t.push(T("heading", [r, i - 1], a.content, o, c.attrsRange, c.valueRange, { depth: a.depth }));
|
|
851
851
|
let l = `${"#".repeat(a.depth)} ${a.content}`;
|
|
852
852
|
return n.push(l), !0;
|
|
853
853
|
}
|
|
854
854
|
function u(e, r, i) {
|
|
855
|
-
let a =
|
|
855
|
+
let a = y(e), o = " ".repeat(a.indent), s = [
|
|
856
856
|
e,
|
|
857
857
|
o,
|
|
858
858
|
a.marker,
|
|
859
859
|
a.content,
|
|
860
860
|
a.attrs
|
|
861
861
|
];
|
|
862
|
-
t.push(
|
|
862
|
+
t.push(me("list", e, r, i, s));
|
|
863
863
|
let c = `${o}${a.marker} ${a.content}`;
|
|
864
864
|
return n.push(c), !0;
|
|
865
865
|
}
|
|
866
866
|
function d(e, r, i) {
|
|
867
|
-
let a =
|
|
868
|
-
t.push(
|
|
867
|
+
let a = oe(e), o = a.attrs, s = e.startsWith("> ") ? 2 : e.indexOf(">") + 1, c = s + a.content.length;
|
|
868
|
+
t.push(T("blockquote", [r, i - 1], a.content, o, w(e, o, r), [r + s, r + c]));
|
|
869
869
|
let l = `> ${a.content}`;
|
|
870
870
|
return n.push(l), !0;
|
|
871
871
|
}
|
|
872
872
|
function f(e, r, i) {
|
|
873
|
-
t.push(
|
|
874
|
-
let a = e, o =
|
|
873
|
+
t.push(T("para", [r, i - 1], e.trim()));
|
|
874
|
+
let a = e, o = x(a, 0);
|
|
875
875
|
for (let e of o) if (e.attrs && (e.type === "emphasis" || e.type === "code")) {
|
|
876
876
|
let t = a.substring(0, e.range[0]), n = a.substring(e.range[1]);
|
|
877
877
|
a = t + (e.text || "") + n;
|
|
@@ -895,13 +895,13 @@ function Se(e) {
|
|
|
895
895
|
md: n.join("\n")
|
|
896
896
|
};
|
|
897
897
|
}
|
|
898
|
-
function
|
|
899
|
-
return
|
|
898
|
+
function Oe(e, t = 0) {
|
|
899
|
+
return x(e, t);
|
|
900
900
|
}
|
|
901
|
-
function
|
|
901
|
+
function R(e, t) {
|
|
902
902
|
let n = e._blockId || p(`${e.type}:${e.range?.[0]}:${e.range?.[1]}`);
|
|
903
903
|
e._blockId = n;
|
|
904
|
-
let r =
|
|
904
|
+
let r = L(e), i = ve(e), a = {
|
|
905
905
|
id: n,
|
|
906
906
|
type: e.type,
|
|
907
907
|
range: e.range,
|
|
@@ -924,16 +924,16 @@ function U(e, t) {
|
|
|
924
924
|
sem: null
|
|
925
925
|
};
|
|
926
926
|
if (e.attrs) {
|
|
927
|
-
let n =
|
|
927
|
+
let n = D(e.attrs);
|
|
928
928
|
t.sem = n, t.predicates = n.predicates || [], t.subject = n.subject, t.types = n.types || [];
|
|
929
929
|
}
|
|
930
930
|
a.carriers.push(t);
|
|
931
931
|
}
|
|
932
932
|
return t.origin.blocks.set(n, a), t.origin.documentStructure.push(a), a;
|
|
933
933
|
}
|
|
934
|
-
function
|
|
934
|
+
function ke(e, t, n, r) {
|
|
935
935
|
if (t.subject && t.subject !== "RESET") {
|
|
936
|
-
let n =
|
|
936
|
+
let n = k(t, r);
|
|
937
937
|
n && (e.subject = n.value);
|
|
938
938
|
}
|
|
939
939
|
if (t.types && t.types.length > 0 && t.types.forEach((t) => {
|
|
@@ -955,26 +955,26 @@ function we(e, t, n, r) {
|
|
|
955
955
|
predicates: []
|
|
956
956
|
};
|
|
957
957
|
if (n.attrs) {
|
|
958
|
-
let e =
|
|
958
|
+
let e = D(n.attrs);
|
|
959
959
|
t.sem = e, t.predicates = e.predicates || [], t.subject = e.subject, t.types = e.types || [];
|
|
960
960
|
}
|
|
961
961
|
e.carriers.push(t);
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
|
-
function
|
|
964
|
+
function Ae(e, t, n, r = {}) {
|
|
965
965
|
let { preserveGlobalSubject: i = !1, implicitSubject: a = null } = r;
|
|
966
966
|
if (t.subject === "RESET") {
|
|
967
967
|
n.currentSubject = null;
|
|
968
968
|
return;
|
|
969
969
|
}
|
|
970
|
-
let o = n.currentSubject, s =
|
|
970
|
+
let o = n.currentSubject, s = k(t, n), c = be(t, n);
|
|
971
971
|
s && !n.primarySubject && !t.subject.startsWith("=#") && (n.primarySubject = s.value), s && !i && !a && (n.currentSubject = s);
|
|
972
972
|
let l = i ? s || o : a || n.currentSubject;
|
|
973
973
|
if (!l) return;
|
|
974
|
-
let u =
|
|
975
|
-
n.currentBlock &&
|
|
974
|
+
let u = je(l.value, t.types, t.predicates, e.range, e.attrsRange || null, e.valueRange || null, e.type || null, n.ctx, e.text), d = ne(e.text, t.datatype, t.language, n.ctx, n.df), f = e.url ? n.df.namedNode(h(e.url, n.ctx)) : null, p = s || f;
|
|
975
|
+
n.currentBlock && ke(n.currentBlock, t, e, n), Pe(t, s, c, f, l, u, n, e), Ie(t, s, o, c, p, l, d, u, n, e);
|
|
976
976
|
}
|
|
977
|
-
function
|
|
977
|
+
function je(e, t, n, r, i, a, o, s, c) {
|
|
978
978
|
let l = {
|
|
979
979
|
subject: e,
|
|
980
980
|
types: t.map((e) => h(typeof e == "string" ? e : e.iri, s)),
|
|
@@ -1002,7 +1002,7 @@ function Ee(e, t, n, r, i, a, o, s, c) {
|
|
|
1002
1002
|
text: c || ""
|
|
1003
1003
|
};
|
|
1004
1004
|
}
|
|
1005
|
-
function
|
|
1005
|
+
function z(e, t, n, r, i, a, o, s, c, l = null, u = null, d = null, f = null) {
|
|
1006
1006
|
if (!a || !o || !s) return;
|
|
1007
1007
|
let p = c.quad(a, o, s);
|
|
1008
1008
|
if (l?.remove) {
|
|
@@ -1014,12 +1014,12 @@ function W(e, t, n, r, i, a, o, s, c, l = null, u = null, d = null, f = null) {
|
|
|
1014
1014
|
} else n.add(p);
|
|
1015
1015
|
} else {
|
|
1016
1016
|
let n = v(p.subject, p.predicate, p.object);
|
|
1017
|
-
t.set(n, p), e.push(p),
|
|
1018
|
-
let s =
|
|
1017
|
+
t.set(n, p), e.push(p), Me(p, c, l, u, d);
|
|
1018
|
+
let s = ye(i, a, o, l);
|
|
1019
1019
|
r.set(n, s), f.currentBlock && i.id === f.currentBlock.id && (f.currentBlock.quadKeys || (f.currentBlock.quadKeys = []), f.currentBlock.quadKeys.push(n));
|
|
1020
1020
|
}
|
|
1021
1021
|
}
|
|
1022
|
-
function
|
|
1022
|
+
function Me(e, t, n, r = null, i = null) {
|
|
1023
1023
|
if (!r || !i) return;
|
|
1024
1024
|
let a = e.predicate.value;
|
|
1025
1025
|
if (a !== "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" && a !== "http://www.w3.org/1999/02/22-rdf-syntax-ns#subject" && a !== "http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate" && a !== "http://www.w3.org/1999/02/22-rdf-syntax-ns#object") return;
|
|
@@ -1033,12 +1033,12 @@ function De(e, t, n, r = null, i = null) {
|
|
|
1033
1033
|
r.push(n), i.delete(e.subject.value);
|
|
1034
1034
|
}
|
|
1035
1035
|
}
|
|
1036
|
-
var
|
|
1036
|
+
var Ne = (e, t, n, r, i = null) => {
|
|
1037
1037
|
let a = h(e, n.ctx), o = typeof i == "object" ? i : {
|
|
1038
1038
|
entryIndex: i,
|
|
1039
1039
|
remove: !1
|
|
1040
1040
|
};
|
|
1041
|
-
|
|
1041
|
+
z(n.quads, n.quadBuffer, n.removeSet, n.origin.quadIndex, r, t, n.df.namedNode(h("rdf:type", n.ctx)), n.df.namedNode(a), n.df, {
|
|
1042
1042
|
kind: "type",
|
|
1043
1043
|
token: `.${e}`,
|
|
1044
1044
|
expandedType: a,
|
|
@@ -1046,15 +1046,15 @@ var Oe = (e, t, n, r, i = null) => {
|
|
|
1046
1046
|
remove: o.remove
|
|
1047
1047
|
}, n.statements, n.statementCandidates, n);
|
|
1048
1048
|
};
|
|
1049
|
-
function
|
|
1049
|
+
function Pe(e, t, n, r, i, a, o, s) {
|
|
1050
1050
|
e.types.forEach((e) => {
|
|
1051
|
-
|
|
1051
|
+
Ne(typeof e == "string" ? e : e.iri, t || n || r || i, o, a, typeof e == "string" ? {
|
|
1052
1052
|
entryIndex: null,
|
|
1053
1053
|
remove: !1
|
|
1054
1054
|
} : e);
|
|
1055
1055
|
});
|
|
1056
1056
|
}
|
|
1057
|
-
var
|
|
1057
|
+
var Fe = (e, t, n, r, i, a, o, s) => {
|
|
1058
1058
|
if (e.form === "" && t?.type === "link" && t?.url && t.text === t.url) return null;
|
|
1059
1059
|
switch (e.form) {
|
|
1060
1060
|
case "": return n ? {
|
|
@@ -1078,12 +1078,12 @@ var Ae = (e, t, n, r, i, a, o, s) => {
|
|
|
1078
1078
|
default: return null;
|
|
1079
1079
|
}
|
|
1080
1080
|
};
|
|
1081
|
-
function
|
|
1081
|
+
function Ie(e, t, n, r, i, a, o, s, c, l) {
|
|
1082
1082
|
e.predicates.forEach((e) => {
|
|
1083
|
-
let u =
|
|
1083
|
+
let u = Fe(e, l, t, n, r, i, a, o);
|
|
1084
1084
|
if (u) {
|
|
1085
1085
|
let t = c.df.namedNode(h(e.iri, c.ctx));
|
|
1086
|
-
|
|
1086
|
+
z(c.quads, c.quadBuffer, c.removeSet, c.origin.quadIndex, s, u.subject, t, u.object, c.df, {
|
|
1087
1087
|
kind: "pred",
|
|
1088
1088
|
token: `${e.form}${e.iri}`,
|
|
1089
1089
|
form: e.form,
|
|
@@ -1094,13 +1094,13 @@ function je(e, t, n, r, i, a, o, s, c, l) {
|
|
|
1094
1094
|
}
|
|
1095
1095
|
});
|
|
1096
1096
|
}
|
|
1097
|
-
function
|
|
1098
|
-
|
|
1097
|
+
function B(e, t, n, r = {}) {
|
|
1098
|
+
Ae(e, t, n, r);
|
|
1099
1099
|
}
|
|
1100
|
-
function
|
|
1100
|
+
function V(e, t, n) {
|
|
1101
1101
|
if (e.attrs) {
|
|
1102
|
-
let r =
|
|
1103
|
-
|
|
1102
|
+
let r = D(e.attrs);
|
|
1103
|
+
B({
|
|
1104
1104
|
type: n,
|
|
1105
1105
|
text: e.text,
|
|
1106
1106
|
range: e.range,
|
|
@@ -1108,15 +1108,15 @@ function K(e, t, n) {
|
|
|
1108
1108
|
valueRange: e.valueRange || null
|
|
1109
1109
|
}, r, t);
|
|
1110
1110
|
}
|
|
1111
|
-
|
|
1112
|
-
e.attrs &&
|
|
1111
|
+
L(e).forEach((e) => {
|
|
1112
|
+
e.attrs && B(e, D(e.attrs), t);
|
|
1113
1113
|
});
|
|
1114
1114
|
}
|
|
1115
|
-
function
|
|
1116
|
-
let n =
|
|
1115
|
+
function H(e, t) {
|
|
1116
|
+
let n = se(e.text);
|
|
1117
1117
|
if (!n) return;
|
|
1118
|
-
let r =
|
|
1119
|
-
|
|
1118
|
+
let r = D(`{=${n.content}}`), i = e.range[0] + e.text.indexOf("{=");
|
|
1119
|
+
B({
|
|
1120
1120
|
type: "standalone",
|
|
1121
1121
|
text: "",
|
|
1122
1122
|
range: e.range,
|
|
@@ -1124,21 +1124,21 @@ function q(e, t) {
|
|
|
1124
1124
|
valueRange: null
|
|
1125
1125
|
}, r, t);
|
|
1126
1126
|
}
|
|
1127
|
-
var
|
|
1128
|
-
heading: (e, t) =>
|
|
1129
|
-
code: (e, t) =>
|
|
1130
|
-
blockquote: (e, t) =>
|
|
1131
|
-
para: (e, t) =>
|
|
1132
|
-
list: (e, t) =>
|
|
1133
|
-
standalone: (e, t) =>
|
|
1127
|
+
var Le = {
|
|
1128
|
+
heading: (e, t) => P(e, t, V, R),
|
|
1129
|
+
code: (e, t) => P(e, t, V, R),
|
|
1130
|
+
blockquote: (e, t) => P(e, t, V, R),
|
|
1131
|
+
para: (e, t) => P(e, t, V, R, [H]),
|
|
1132
|
+
list: (e, t) => P(e, t, V, R),
|
|
1133
|
+
standalone: (e, t) => H(e, t)
|
|
1134
1134
|
};
|
|
1135
1135
|
//#endregion
|
|
1136
1136
|
//#region src/merge.js
|
|
1137
|
-
function
|
|
1138
|
-
return
|
|
1137
|
+
function U(e) {
|
|
1138
|
+
return te(e);
|
|
1139
1139
|
}
|
|
1140
|
-
function
|
|
1141
|
-
return typeof e == "string" ?
|
|
1140
|
+
function Re(e, t, n) {
|
|
1141
|
+
return typeof e == "string" ? I({
|
|
1142
1142
|
text: e,
|
|
1143
1143
|
...t,
|
|
1144
1144
|
context: {
|
|
@@ -1147,10 +1147,10 @@ function Ne(e, t, n) {
|
|
|
1147
1147
|
}
|
|
1148
1148
|
}) : e;
|
|
1149
1149
|
}
|
|
1150
|
-
function
|
|
1150
|
+
function ze(t, n = {}) {
|
|
1151
1151
|
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(), a = [], o = /* @__PURE__ */ new Map(), s = [], c = /* @__PURE__ */ new Map(), l = [];
|
|
1152
1152
|
for (let u = 0; u < t.length; u++) {
|
|
1153
|
-
let d = t[u], f =
|
|
1153
|
+
let d = t[u], f = Re(d, n, {
|
|
1154
1154
|
...e,
|
|
1155
1155
|
...n.context
|
|
1156
1156
|
});
|
|
@@ -1164,7 +1164,7 @@ function Pe(t, n = {}) {
|
|
|
1164
1164
|
};
|
|
1165
1165
|
a.push(p), f.statements && f.statements.length > 0 && s.push(...f.statements), f.primarySubject && l.push(f.primarySubject);
|
|
1166
1166
|
for (let e of f.quads) {
|
|
1167
|
-
let t =
|
|
1167
|
+
let t = U(e);
|
|
1168
1168
|
r.set(t, e);
|
|
1169
1169
|
let n = f.origin.quadIndex.get(t);
|
|
1170
1170
|
o.set(t, {
|
|
@@ -1174,7 +1174,7 @@ function Pe(t, n = {}) {
|
|
|
1174
1174
|
});
|
|
1175
1175
|
}
|
|
1176
1176
|
for (let e of f.remove) {
|
|
1177
|
-
let t =
|
|
1177
|
+
let t = U(e);
|
|
1178
1178
|
r.has(t) ? r.delete(t) : i.add(e);
|
|
1179
1179
|
let n = f.origin.quadIndex.get(t);
|
|
1180
1180
|
o.set(t, {
|
|
@@ -1191,10 +1191,10 @@ function Pe(t, n = {}) {
|
|
|
1191
1191
|
...e,
|
|
1192
1192
|
...n.context,
|
|
1193
1193
|
...Object.fromEntries(c)
|
|
1194
|
-
}, m = new Set(u.map(
|
|
1194
|
+
}, m = new Set(u.map(U)), h = new Set(d.map(U));
|
|
1195
1195
|
return {
|
|
1196
|
-
quads: u.filter((e) => !h.has(
|
|
1197
|
-
remove: d.filter((e) => !m.has(
|
|
1196
|
+
quads: u.filter((e) => !h.has(U(e))),
|
|
1197
|
+
remove: d.filter((e) => !m.has(U(e))),
|
|
1198
1198
|
statements: s,
|
|
1199
1199
|
origin: f,
|
|
1200
1200
|
context: p,
|
|
@@ -1203,14 +1203,14 @@ function Pe(t, n = {}) {
|
|
|
1203
1203
|
}
|
|
1204
1204
|
//#endregion
|
|
1205
1205
|
//#region src/generate.js
|
|
1206
|
-
var
|
|
1207
|
-
function
|
|
1206
|
+
var W = /* @__PURE__ */ new Map(), G = 1e3;
|
|
1207
|
+
function K(e, t) {
|
|
1208
1208
|
let n = `${e}|${JSON.stringify(t)}`;
|
|
1209
|
-
if (
|
|
1209
|
+
if (W.has(n)) return W.get(n);
|
|
1210
1210
|
let r = g(e, t);
|
|
1211
|
-
return
|
|
1211
|
+
return W.size >= G && Array.from(W.keys()).slice(0, Math.floor(G / 2)).forEach((e) => W.delete(e)), W.set(n, r), r;
|
|
1212
1212
|
}
|
|
1213
|
-
function
|
|
1213
|
+
function Be(e, t = {}) {
|
|
1214
1214
|
if (!e) return e;
|
|
1215
1215
|
for (let [n, r] of Object.entries(t)) if (e.startsWith(r) || e.startsWith(r.slice(0, -1))) return e.substring(r.length);
|
|
1216
1216
|
for (let t of [
|
|
@@ -1223,32 +1223,32 @@ function Ie(e, t = {}) {
|
|
|
1223
1223
|
}
|
|
1224
1224
|
return e;
|
|
1225
1225
|
}
|
|
1226
|
-
function
|
|
1227
|
-
let i = Object.assign({}, e, n), a =
|
|
1226
|
+
function Ve({ quads: t, context: n = {}, primarySubject: r = null }) {
|
|
1227
|
+
let i = Object.assign({}, e, n), a = Ue(t), o = We(a), s = r;
|
|
1228
1228
|
!s && a.length > 0 && (s = a[0].subject.value);
|
|
1229
|
-
let { text: c } =
|
|
1229
|
+
let { text: c } = Ke(o, i, s);
|
|
1230
1230
|
return {
|
|
1231
1231
|
text: c,
|
|
1232
1232
|
context: i
|
|
1233
1233
|
};
|
|
1234
1234
|
}
|
|
1235
|
-
function
|
|
1235
|
+
function He({ quads: t, focusIRI: n, context: r = {} }) {
|
|
1236
1236
|
if (!t?.length || !n) return {
|
|
1237
1237
|
text: "",
|
|
1238
1238
|
context: Object.assign({}, e, r)
|
|
1239
1239
|
};
|
|
1240
|
-
let i = Object.assign({}, e, r), a =
|
|
1240
|
+
let i = Object.assign({}, e, r), a = Ge(Ue(t));
|
|
1241
1241
|
if (!a.has(n)) return {
|
|
1242
1242
|
text: "",
|
|
1243
1243
|
context: i
|
|
1244
1244
|
};
|
|
1245
|
-
let { text: o } =
|
|
1245
|
+
let { text: o } = Ke(a, i, n);
|
|
1246
1246
|
return {
|
|
1247
1247
|
text: o,
|
|
1248
1248
|
context: i
|
|
1249
1249
|
};
|
|
1250
1250
|
}
|
|
1251
|
-
function
|
|
1251
|
+
function Ue(e) {
|
|
1252
1252
|
return !e || e.length === 0 ? [] : e.map((e) => e.subject.termType && e.predicate.termType && e.object.termType ? e : {
|
|
1253
1253
|
subject: d.fromTerm(e.subject),
|
|
1254
1254
|
predicate: d.fromTerm(e.predicate),
|
|
@@ -1258,11 +1258,11 @@ function ze(e) {
|
|
|
1258
1258
|
if (n !== 0) return n;
|
|
1259
1259
|
let r = e.predicate.value.localeCompare(t.predicate.value);
|
|
1260
1260
|
if (r !== 0) return r;
|
|
1261
|
-
let i = (
|
|
1261
|
+
let i = (j(e.object), e.object.value), a = (j(t.object), t.object.value);
|
|
1262
1262
|
return i.localeCompare(a);
|
|
1263
1263
|
});
|
|
1264
1264
|
}
|
|
1265
|
-
function
|
|
1265
|
+
function We(e) {
|
|
1266
1266
|
let t = /* @__PURE__ */ new Map();
|
|
1267
1267
|
for (let n of e) {
|
|
1268
1268
|
let e = n.subject.value, r = t.get(e);
|
|
@@ -1270,7 +1270,7 @@ function Be(e) {
|
|
|
1270
1270
|
}
|
|
1271
1271
|
return t;
|
|
1272
1272
|
}
|
|
1273
|
-
function
|
|
1273
|
+
function Ge(e) {
|
|
1274
1274
|
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
1275
1275
|
let n = t.get(e);
|
|
1276
1276
|
if (n) return n;
|
|
@@ -1283,40 +1283,40 @@ function Ve(e) {
|
|
|
1283
1283
|
}
|
|
1284
1284
|
return t;
|
|
1285
1285
|
}
|
|
1286
|
-
function
|
|
1287
|
-
let i = [], a =
|
|
1288
|
-
for (let [t, n] of s) t !== "@vocab" && !t.startsWith("@") && !e[t] && a.has(t) && i.push(
|
|
1286
|
+
function Ke(t, n, r = null) {
|
|
1287
|
+
let i = [], a = Se(t, n), o = qe(t), s = Object.entries(n).sort(([e], [t]) => e.localeCompare(t));
|
|
1288
|
+
for (let [t, n] of s) t !== "@vocab" && !t.startsWith("@") && !e[t] && a.has(t) && i.push(Ce(t, n));
|
|
1289
1289
|
s.length > 0 && i.push("\n");
|
|
1290
1290
|
let c = Array.from(t.keys()).sort(), l = r, u = l ? [l, ...c.filter((e) => e !== l)] : c;
|
|
1291
1291
|
for (let e of u) {
|
|
1292
1292
|
let r = t.get(e);
|
|
1293
1293
|
if (!r) continue;
|
|
1294
|
-
let a =
|
|
1294
|
+
let a = K(e, n), { types: s, literals: c, objects: l } = Ee(r), u = o.has(e), d = u ? o.get(e) : Be(e, n), f = s.length > 0 ? s.map((e) => "." + K(e.object.value, n)).sort().join(" ") : "";
|
|
1295
1295
|
u && (f += (f ? " " : "") + "label");
|
|
1296
1296
|
let p = f ? " " + f : "";
|
|
1297
1297
|
i.push(`# ${d} {=${a}${p}}\n\n`);
|
|
1298
1298
|
let m = u ? o.get(e) : null;
|
|
1299
|
-
|
|
1300
|
-
e.predicate.value === "http://www.w3.org/2000/01/rdf-schema#label" && e.object.value === m || i.push(
|
|
1301
|
-
}),
|
|
1302
|
-
i.push(
|
|
1299
|
+
F(c).forEach((e) => {
|
|
1300
|
+
e.predicate.value === "http://www.w3.org/2000/01/rdf-schema#label" && e.object.value === m || i.push(we(e, n));
|
|
1301
|
+
}), F(l).forEach((e) => {
|
|
1302
|
+
i.push(Te(e, n, o));
|
|
1303
1303
|
}), i.push("\n");
|
|
1304
1304
|
}
|
|
1305
1305
|
return { text: i.join("") };
|
|
1306
1306
|
}
|
|
1307
|
-
function
|
|
1307
|
+
function qe(e) {
|
|
1308
1308
|
let t = /* @__PURE__ */ new Map();
|
|
1309
1309
|
for (let n of e.values()) for (let e of n) e.predicate.value === "http://www.w3.org/2000/01/rdf-schema#label" && e.object.termType === "Literal" && t.set(e.subject.value, e.object.value);
|
|
1310
1310
|
return t;
|
|
1311
1311
|
}
|
|
1312
1312
|
//#endregion
|
|
1313
1313
|
//#region src/render.js
|
|
1314
|
-
function
|
|
1315
|
-
let n =
|
|
1314
|
+
function Je(e, t = {}) {
|
|
1315
|
+
let n = I({
|
|
1316
1316
|
text: e,
|
|
1317
1317
|
context: t.context || {}
|
|
1318
|
-
}), r =
|
|
1319
|
-
html:
|
|
1318
|
+
}), r = Ye(n, t, e), i = {
|
|
1319
|
+
html: ht(Xe(n.origin.blocks, r), r.ctx),
|
|
1320
1320
|
context: r.ctx,
|
|
1321
1321
|
metadata: {
|
|
1322
1322
|
blockCount: n.origin.blocks.size,
|
|
@@ -1331,7 +1331,7 @@ function We(e, t = {}) {
|
|
|
1331
1331
|
renderMap: r.renderMap
|
|
1332
1332
|
}), i;
|
|
1333
1333
|
}
|
|
1334
|
-
function
|
|
1334
|
+
function Ye(t, n, r) {
|
|
1335
1335
|
return {
|
|
1336
1336
|
ctx: t.context || {
|
|
1337
1337
|
...e,
|
|
@@ -1349,49 +1349,49 @@ function Ge(t, n, r) {
|
|
|
1349
1349
|
validation: n.validate || !1
|
|
1350
1350
|
};
|
|
1351
1351
|
}
|
|
1352
|
-
function
|
|
1352
|
+
function Xe(e, t) {
|
|
1353
1353
|
let n = Array.from(e.values()).sort((e, t) => (e.range?.start || 0) - (t.range?.start || 0)), r = n.filter((e) => e.carrierType === "list");
|
|
1354
1354
|
return n.filter((e) => e.carrierType !== "list").forEach((e) => {
|
|
1355
|
-
|
|
1356
|
-
}), r.length > 0 &&
|
|
1355
|
+
Ze(e, t);
|
|
1356
|
+
}), r.length > 0 && lt(r, t), t.output.join("");
|
|
1357
1357
|
}
|
|
1358
|
-
function
|
|
1358
|
+
function Ze(e, t) {
|
|
1359
1359
|
e.subject && e.subject !== "RESET" && (t.currentSubject = e.subject);
|
|
1360
|
-
let n =
|
|
1361
|
-
switch (n && t.renderMap.set(e.id ||
|
|
1360
|
+
let n = Qe(e, t);
|
|
1361
|
+
switch (n && t.renderMap.set(e.id || gt(e), n), e.type || e.carrierType) {
|
|
1362
1362
|
case "heading":
|
|
1363
|
-
|
|
1363
|
+
et(e, n, t);
|
|
1364
1364
|
break;
|
|
1365
1365
|
case "para":
|
|
1366
|
-
|
|
1366
|
+
tt(e, n, t);
|
|
1367
1367
|
break;
|
|
1368
1368
|
case "list": break;
|
|
1369
1369
|
case "quote":
|
|
1370
|
-
|
|
1370
|
+
nt(e, n, t);
|
|
1371
1371
|
break;
|
|
1372
1372
|
case "code":
|
|
1373
|
-
|
|
1373
|
+
rt(e, n, t);
|
|
1374
1374
|
break;
|
|
1375
|
-
default:
|
|
1375
|
+
default: it(e, n, t);
|
|
1376
1376
|
}
|
|
1377
1377
|
}
|
|
1378
|
-
function
|
|
1378
|
+
function Qe(e, t) {
|
|
1379
1379
|
let n = [];
|
|
1380
1380
|
if (!e.subject || e.subject === "RESET" || e.subject.startsWith("=#") || e.subject.startsWith("+")) return "";
|
|
1381
1381
|
let r = h(e.subject, t.ctx);
|
|
1382
|
-
if (n.push(`about="${
|
|
1382
|
+
if (n.push(`about="${A(r)}"`), e.types && e.types.length > 0) {
|
|
1383
1383
|
let r = e.types.map((e) => h(typeof e == "string" ? e : e.iri, t.ctx)).join(" ");
|
|
1384
|
-
n.push(`typeof="${
|
|
1384
|
+
n.push(`typeof="${A(r)}"`);
|
|
1385
1385
|
}
|
|
1386
1386
|
let i = [];
|
|
1387
1387
|
if (e.predicates && e.predicates.length > 0 && i.push(...e.predicates), e.carriers && e.carriers.length > 0) for (let t of e.carriers) t.predicates && t.predicates.length > 0 && i.push(...t.predicates);
|
|
1388
1388
|
if (i.length > 0) {
|
|
1389
|
-
let { literalProps: e, objectProps: r, reverseProps: a } =
|
|
1390
|
-
e.length > 0 && n.push(`property="${
|
|
1389
|
+
let { literalProps: e, objectProps: r, reverseProps: a } = $e(i, t.ctx);
|
|
1390
|
+
e.length > 0 && n.push(`property="${A(e.join(" "))}"`), r.length > 0 && n.push(`rel="${A(r.join(" "))}"`), a.length > 0 && n.push(`rev="${A(a.join(" "))}"`);
|
|
1391
1391
|
}
|
|
1392
1392
|
return n.length > 1 && t.renderedRDFaCount++, n.length > 0 ? ` ${n.join(" ")}` : "";
|
|
1393
1393
|
}
|
|
1394
|
-
function
|
|
1394
|
+
function $e(e, t) {
|
|
1395
1395
|
let n = [], r = [], i = [];
|
|
1396
1396
|
for (let a of e) {
|
|
1397
1397
|
let e = h(typeof a == "string" ? a : a.iri, t);
|
|
@@ -1403,37 +1403,37 @@ function Ye(e, t) {
|
|
|
1403
1403
|
reverseProps: i
|
|
1404
1404
|
};
|
|
1405
1405
|
}
|
|
1406
|
-
function
|
|
1407
|
-
let r = `h${e.text && e.text.match(/^#+/)?.[0]?.length || 1}`, i =
|
|
1408
|
-
i = i.replace(/\s*\{[^}]+\}\s*$/g, "").trim(), n.output.push(`<${r}${t}>${
|
|
1406
|
+
function et(e, t, n) {
|
|
1407
|
+
let r = `h${e.text && e.text.match(/^#+/)?.[0]?.length || 1}`, i = _e(n.sourceText, e.range);
|
|
1408
|
+
i = i.replace(/\s*\{[^}]+\}\s*$/g, "").trim(), n.output.push(`<${r}${t}>${A(i)}</${r}>`);
|
|
1409
1409
|
}
|
|
1410
|
-
function
|
|
1411
|
-
let r =
|
|
1410
|
+
function tt(e, t, n) {
|
|
1411
|
+
let r = q(e, n);
|
|
1412
1412
|
n.output.push(`<p${t}>${r}</p>`);
|
|
1413
1413
|
}
|
|
1414
|
-
function
|
|
1415
|
-
let r =
|
|
1414
|
+
function nt(e, t, n) {
|
|
1415
|
+
let r = q(e, n);
|
|
1416
1416
|
n.output.push(`<blockquote${t}>${r}</blockquote>`);
|
|
1417
1417
|
}
|
|
1418
|
-
function
|
|
1418
|
+
function rt(e, t, n) {
|
|
1419
1419
|
let r = e.info || "", i = e.text || "";
|
|
1420
|
-
n.output.push(`<pre><code${t}${r ? ` class="language-${
|
|
1420
|
+
n.output.push(`<pre><code${t}${r ? ` class="language-${A(r)}"` : ""}>${A(i)}</code></pre>`);
|
|
1421
1421
|
}
|
|
1422
|
-
function
|
|
1423
|
-
let r =
|
|
1422
|
+
function it(e, t, n) {
|
|
1423
|
+
let r = q(e, n);
|
|
1424
1424
|
n.output.push(`<div${t}>${r}</div>`);
|
|
1425
1425
|
}
|
|
1426
|
-
function
|
|
1427
|
-
if (!e.carriers || e.carriers.length === 0) return
|
|
1428
|
-
let n =
|
|
1429
|
-
return
|
|
1426
|
+
function q(e, t) {
|
|
1427
|
+
if (!e.carriers || e.carriers.length === 0) return A(at(t.sourceText, e.range));
|
|
1428
|
+
let n = ot(e);
|
|
1429
|
+
return st(at(t.sourceText, e.range), n, t);
|
|
1430
1430
|
}
|
|
1431
|
-
function
|
|
1431
|
+
function at(e, t) {
|
|
1432
1432
|
if (!t || !e) return "";
|
|
1433
1433
|
let n = e.substring(t[0], t[1]);
|
|
1434
1434
|
return n = n.replace(/\s*\{[^}]*\}\s*$/gm, ""), n = n.replace(/\{[^}]*\}/g, ""), n = n.replace(/\s+/g, " ").trim(), n = n.replace(/\]$/, ""), n;
|
|
1435
1435
|
}
|
|
1436
|
-
function
|
|
1436
|
+
function ot(e) {
|
|
1437
1437
|
let t = [];
|
|
1438
1438
|
if (!e.carriers) return t;
|
|
1439
1439
|
for (let n of e.carriers) !n.text || !n.range || t.push({
|
|
@@ -1443,52 +1443,52 @@ function nt(e) {
|
|
|
1443
1443
|
});
|
|
1444
1444
|
return t.sort((e, t) => e.pos - t.pos);
|
|
1445
1445
|
}
|
|
1446
|
-
function
|
|
1447
|
-
if (t.length === 0) return
|
|
1446
|
+
function st(e, t, n) {
|
|
1447
|
+
if (t.length === 0) return A(e);
|
|
1448
1448
|
let r = "", i = 0;
|
|
1449
|
-
for (let a of t) a.pos > i && (r +=
|
|
1450
|
-
return i < e.length && (r +=
|
|
1449
|
+
for (let a of t) a.pos > i && (r += A(e.substring(i, a.pos))), r += ct(a.carrier, n), i = a.pos + a.length;
|
|
1450
|
+
return i < e.length && (r += A(e.substring(i))), r;
|
|
1451
1451
|
}
|
|
1452
|
-
function
|
|
1452
|
+
function ct(e, t) {
|
|
1453
1453
|
let n = [], r = e.subject || t.currentSubject;
|
|
1454
|
-
if (!r || r === "RESET" || r.startsWith("=#") || r.startsWith("+")) return
|
|
1454
|
+
if (!r || r === "RESET" || r.startsWith("=#") || r.startsWith("+")) return A(e.text || "");
|
|
1455
1455
|
let i = g(h(r, t.ctx), t.ctx);
|
|
1456
|
-
if (n.push(`about="${
|
|
1456
|
+
if (n.push(`about="${A(i)}"`), e.types && e.types.length > 0) {
|
|
1457
1457
|
let r = e.types.map((e) => g(h(typeof e == "string" ? e : e.iri, t.ctx), t.ctx)).join(" ");
|
|
1458
|
-
n.push(`typeof="${
|
|
1458
|
+
n.push(`typeof="${A(r)}"`);
|
|
1459
1459
|
}
|
|
1460
1460
|
if (e.predicates && e.predicates.length > 0) {
|
|
1461
|
-
let { literalProps: r, objectProps: i, reverseProps: a } =
|
|
1461
|
+
let { literalProps: r, objectProps: i, reverseProps: a } = $e(e.predicates, t.ctx);
|
|
1462
1462
|
if (r.length > 0) {
|
|
1463
1463
|
let e = r.map((e) => g(e, t.ctx)).join(" ");
|
|
1464
|
-
n.push(`property="${
|
|
1464
|
+
n.push(`property="${A(e)}"`);
|
|
1465
1465
|
}
|
|
1466
1466
|
if (i.length > 0) {
|
|
1467
1467
|
let e = i.map((e) => g(e, t.ctx)).join(" ");
|
|
1468
|
-
n.push(`rel="${
|
|
1468
|
+
n.push(`rel="${A(e)}"`);
|
|
1469
1469
|
}
|
|
1470
1470
|
if (a.length > 0) {
|
|
1471
1471
|
let e = a.map((e) => g(e, t.ctx)).join(" ");
|
|
1472
|
-
n.push(`rev="${
|
|
1472
|
+
n.push(`rev="${A(e)}"`);
|
|
1473
1473
|
}
|
|
1474
1474
|
}
|
|
1475
1475
|
let a = n.length > 0 ? ` ${n.join(" ")}` : "";
|
|
1476
1476
|
switch (e.type) {
|
|
1477
|
-
case "emphasis": return `<em${a}>${
|
|
1478
|
-
case "strong": return `<strong${a}>${
|
|
1479
|
-
case "code": return `<code${a}>${
|
|
1480
|
-
case "link": return `<a href="${
|
|
1481
|
-
default: return `<span${a}>${
|
|
1477
|
+
case "emphasis": return `<em${a}>${A(e.text || "")}</em>`;
|
|
1478
|
+
case "strong": return `<strong${a}>${A(e.text || "")}</strong>`;
|
|
1479
|
+
case "code": return `<code${a}>${A(e.text || "")}</code>`;
|
|
1480
|
+
case "link": return `<a href="${A(e.url || "")}"${a}>${A(e.text || "")}</a>`;
|
|
1481
|
+
default: return `<span${a}>${A(e.text || "")}</span>`;
|
|
1482
1482
|
}
|
|
1483
1483
|
}
|
|
1484
|
-
function
|
|
1485
|
-
|
|
1486
|
-
|
|
1484
|
+
function lt(e, t) {
|
|
1485
|
+
ut(e, t.sourceText).forEach((e) => {
|
|
1486
|
+
dt(e, t);
|
|
1487
1487
|
});
|
|
1488
1488
|
}
|
|
1489
|
-
function
|
|
1489
|
+
function ut(e, t) {
|
|
1490
1490
|
let n = [], r = null, i = e.sort((e, t) => (e.range?.start || 0) - (t.range?.start || 0));
|
|
1491
|
-
for (let e of i)
|
|
1491
|
+
for (let e of i) ge(e, t) === 0 ? (r && n.push(r), r = {
|
|
1492
1492
|
contextName: "Items",
|
|
1493
1493
|
blocks: [e]
|
|
1494
1494
|
}) : r ? r.blocks.push(e) : r = {
|
|
@@ -1497,30 +1497,30 @@ function ot(e, t) {
|
|
|
1497
1497
|
};
|
|
1498
1498
|
return r && n.push(r), n;
|
|
1499
1499
|
}
|
|
1500
|
-
function
|
|
1500
|
+
function dt(e, t) {
|
|
1501
1501
|
t.output.push("<ul>");
|
|
1502
|
-
for (let n of e.blocks)
|
|
1502
|
+
for (let n of e.blocks) ft(n, t);
|
|
1503
1503
|
t.output.push("</ul>");
|
|
1504
1504
|
}
|
|
1505
|
-
function
|
|
1506
|
-
let n =
|
|
1505
|
+
function ft(e, t) {
|
|
1506
|
+
let n = Qe(e, t), r = q(e, t);
|
|
1507
1507
|
t.output.push(`<li${n}>${r}</li>`);
|
|
1508
1508
|
}
|
|
1509
|
-
function
|
|
1509
|
+
function pt(e) {
|
|
1510
1510
|
let t = [];
|
|
1511
1511
|
for (let [n, r] of Object.entries(e)) n !== "@vocab" && t.push(`${n}: ${r}`);
|
|
1512
1512
|
return t.length > 0 ? ` prefix="${t.join(" ")}"` : "";
|
|
1513
1513
|
}
|
|
1514
|
-
function
|
|
1514
|
+
function mt(e) {
|
|
1515
1515
|
return e["@vocab"] ? ` vocab="${e["@vocab"]}"` : "";
|
|
1516
1516
|
}
|
|
1517
|
-
function
|
|
1518
|
-
return `<div${
|
|
1517
|
+
function ht(e, t) {
|
|
1518
|
+
return `<div${pt(t)}${mt(t)}>${e}</div>`;
|
|
1519
1519
|
}
|
|
1520
|
-
function
|
|
1521
|
-
return
|
|
1520
|
+
function gt(e) {
|
|
1521
|
+
return _t(`${e.type || e.carrierType}|${e.subject || ""}|${e.text || ""}`);
|
|
1522
1522
|
}
|
|
1523
|
-
function
|
|
1523
|
+
function _t(e) {
|
|
1524
1524
|
let t = 0;
|
|
1525
1525
|
for (let n = 0; n < e.length; n++) {
|
|
1526
1526
|
let r = e.charCodeAt(n);
|
|
@@ -1530,8 +1530,80 @@ function pt(e) {
|
|
|
1530
1530
|
}
|
|
1531
1531
|
//#endregion
|
|
1532
1532
|
//#region src/highlight.js
|
|
1533
|
-
|
|
1534
|
-
|
|
1533
|
+
function J(e) {
|
|
1534
|
+
return String(e).replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("'", "'");
|
|
1535
|
+
}
|
|
1536
|
+
var Y = {
|
|
1537
|
+
text: "#6b7280",
|
|
1538
|
+
marker: "#f97316",
|
|
1539
|
+
retraction: "#dc2626",
|
|
1540
|
+
value: "#eab308",
|
|
1541
|
+
annotation: "#4b5563"
|
|
1542
|
+
};
|
|
1543
|
+
function X(e, t) {
|
|
1544
|
+
let n = t;
|
|
1545
|
+
for (; n < e.length && e[n] !== "\n" && e[n] !== "\r";) {
|
|
1546
|
+
if (e[n] === "{") return !0;
|
|
1547
|
+
n++;
|
|
1548
|
+
}
|
|
1549
|
+
return !1;
|
|
1550
|
+
}
|
|
1551
|
+
function vt(e, t) {
|
|
1552
|
+
let n = e[t];
|
|
1553
|
+
if (n === "*" && t + 1 < e.length && e[t + 1] === "*") {
|
|
1554
|
+
let n = e.indexOf("**", t + 2);
|
|
1555
|
+
if (n !== -1) {
|
|
1556
|
+
let r = e.slice(t + 2, n), i = X(e, n + 2) ? ` style="color: ${Y.marker}"` : "";
|
|
1557
|
+
return {
|
|
1558
|
+
html: `<span${i}>**</span><strong>${J(r)}</strong><span${i}>**</span>`,
|
|
1559
|
+
nextIndex: n + 2
|
|
1560
|
+
};
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
if (n === "_" && t + 1 < e.length && e[t + 1] === "_") {
|
|
1564
|
+
let n = e.indexOf("__", t + 2);
|
|
1565
|
+
if (n !== -1) {
|
|
1566
|
+
let r = e.slice(t + 2, n), i = X(e, n + 2) ? ` style="color: ${Y.marker}"` : "";
|
|
1567
|
+
return {
|
|
1568
|
+
html: `<span${i}>__</span><strong>${J(r)}</strong><span${i}>__</span>`,
|
|
1569
|
+
nextIndex: n + 2
|
|
1570
|
+
};
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
if (n === "*") {
|
|
1574
|
+
let n = e.indexOf("*", t + 1);
|
|
1575
|
+
if (n !== -1) {
|
|
1576
|
+
let r = e.slice(t + 1, n), i = X(e, n + 1) ? ` style="color: ${Y.marker}"` : "";
|
|
1577
|
+
return {
|
|
1578
|
+
html: `<span${i}>*</span><em>${J(r)}</em><span${i}>*</span>`,
|
|
1579
|
+
nextIndex: n + 1
|
|
1580
|
+
};
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
if (n === "_") {
|
|
1584
|
+
let n = e.indexOf("_", t + 1);
|
|
1585
|
+
if (n !== -1) {
|
|
1586
|
+
let r = e.slice(t + 1, n), i = X(e, n + 1) ? ` style="color: ${Y.marker}"` : "";
|
|
1587
|
+
return {
|
|
1588
|
+
html: `<span${i}>_</span><em>${J(r)}</em><span${i}>_</span>`,
|
|
1589
|
+
nextIndex: n + 1
|
|
1590
|
+
};
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
if (n === "`") {
|
|
1594
|
+
let n = e.indexOf("`", t + 1);
|
|
1595
|
+
if (n !== -1) {
|
|
1596
|
+
let r = e.slice(t + 1, n), i = X(e, n + 1) ? ` style="color: ${Y.marker}"` : "";
|
|
1597
|
+
return {
|
|
1598
|
+
html: `<span${i}>\`</span><code style="background-color:#7773">${J(r)}</code><span${i}>\`</span>`,
|
|
1599
|
+
nextIndex: n + 1
|
|
1600
|
+
};
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
return null;
|
|
1604
|
+
}
|
|
1605
|
+
var Z = /* @__PURE__ */ new Map();
|
|
1606
|
+
function yt(e) {
|
|
1535
1607
|
let t = 0;
|
|
1536
1608
|
for (let n = 0; n < e.length; n++) {
|
|
1537
1609
|
let r = e.charCodeAt(n);
|
|
@@ -1539,10 +1611,160 @@ function $(e) {
|
|
|
1539
1611
|
}
|
|
1540
1612
|
return Math.abs(t);
|
|
1541
1613
|
}
|
|
1542
|
-
function
|
|
1543
|
-
if (
|
|
1544
|
-
let t =
|
|
1545
|
-
return
|
|
1614
|
+
function Q(e) {
|
|
1615
|
+
if (Z.has(e)) return Z.get(e);
|
|
1616
|
+
let t = yt(e), n = `hsl(${t % 360}, ${15 + t % 10}%, ${45 + t % 10}%)`;
|
|
1617
|
+
return Z.set(e, n), n;
|
|
1618
|
+
}
|
|
1619
|
+
function bt(t) {
|
|
1620
|
+
let n = /* @__PURE__ */ new Map(), r = /^\[(\w+)\]\s*<([^>]*)>\s*$/gm, i;
|
|
1621
|
+
for (; (i = r.exec(t)) !== null;) {
|
|
1622
|
+
let e = i[1], t = i[2];
|
|
1623
|
+
if (t.includes(":")) {
|
|
1624
|
+
let e = t.indexOf(":");
|
|
1625
|
+
if (e > 0) {
|
|
1626
|
+
let r = t.slice(0, e), i = t.slice(e + 1);
|
|
1627
|
+
n.has(r) && (t = n.get(r) + i);
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
n.set(e, t);
|
|
1631
|
+
}
|
|
1632
|
+
for (let [t, r] of Object.entries(e)) t !== "@vocab" && n.set(t, r);
|
|
1633
|
+
return n;
|
|
1634
|
+
}
|
|
1635
|
+
function $(e, t, n) {
|
|
1636
|
+
let r = t ? Y.retraction : Y.text, i = e.indexOf(":");
|
|
1637
|
+
if (i > 0) {
|
|
1638
|
+
let t = e.slice(0, i), r = e.slice(i + 1);
|
|
1639
|
+
if (n.has(t)) {
|
|
1640
|
+
let e = n.get(t), i = Q(e), a = e + r, o = Q(a);
|
|
1641
|
+
return `<span style="color: ${i}">${J(t)}</span><span style="color: ${Y.marker}">:</span><span data-iri="${a}" style="color: ${o}">${J(r)}</span> `;
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
return e.startsWith("http:") || e.startsWith("https:") || e.startsWith("tag:") || e.startsWith("urn:") ? `<span style="color: ${Q(e)}">${J(e)}</span> ` : `<span style="color: ${r}">${J(e)}</span> `;
|
|
1645
|
+
}
|
|
1646
|
+
function xt(e, t) {
|
|
1647
|
+
let n = e.trim().split(/\s+/), r = "", i = !1;
|
|
1648
|
+
for (let e = 0; e < n.length; e++) {
|
|
1649
|
+
let a = n[e];
|
|
1650
|
+
if (!a) continue;
|
|
1651
|
+
if (a.startsWith("=") || a.startsWith("+")) {
|
|
1652
|
+
let e = a[0], n = a.slice(1);
|
|
1653
|
+
r += `<span style="color: ${Y.marker}">${J(e)}</span>${$(n, !1, t)}`;
|
|
1654
|
+
continue;
|
|
1655
|
+
}
|
|
1656
|
+
if (a === "-") {
|
|
1657
|
+
i = !0, r += `<span style="color: ${Y.retraction}">${J(a)}</span> `;
|
|
1658
|
+
continue;
|
|
1659
|
+
}
|
|
1660
|
+
if (a.startsWith("-") && a.length > 1) {
|
|
1661
|
+
r += `<span style="color: ${Y.retraction}">${J(a)}</span> `;
|
|
1662
|
+
continue;
|
|
1663
|
+
}
|
|
1664
|
+
let o = i;
|
|
1665
|
+
if (i = !1, a.startsWith("?") || a.startsWith("!")) {
|
|
1666
|
+
let e = a[0], n = a.slice(1), i = o ? Y.retraction : Y.marker;
|
|
1667
|
+
r += `<span style="color: ${i}">${J(e)}</span>${$(n, o, t)}`;
|
|
1668
|
+
continue;
|
|
1669
|
+
}
|
|
1670
|
+
if (a.startsWith("^^")) {
|
|
1671
|
+
let e = a.slice(2), n = o ? Y.retraction : Y.marker;
|
|
1672
|
+
r += `<span style="color: ${n}">${J("^^")}</span>${$(e, o, t)}`;
|
|
1673
|
+
continue;
|
|
1674
|
+
}
|
|
1675
|
+
if (a.startsWith("@")) {
|
|
1676
|
+
let e = a.slice(1), n = o ? Y.retraction : Y.marker;
|
|
1677
|
+
r += `<span style="color: ${n}">${J("@")}</span>${$(e, o, t)}`;
|
|
1678
|
+
continue;
|
|
1679
|
+
}
|
|
1680
|
+
if (a.startsWith(".")) {
|
|
1681
|
+
let e = a.slice(1), n = o ? Y.retraction : Y.marker;
|
|
1682
|
+
r += `<span style="color: ${n}">${J(".")}</span>${$(e, o, t)}`;
|
|
1683
|
+
continue;
|
|
1684
|
+
}
|
|
1685
|
+
r += $(a, o, t);
|
|
1686
|
+
}
|
|
1687
|
+
return r.trim();
|
|
1688
|
+
}
|
|
1689
|
+
function St(e) {
|
|
1690
|
+
let t = bt(e), n = "", r = 0;
|
|
1691
|
+
for (; r < e.length;) {
|
|
1692
|
+
let i = e[r];
|
|
1693
|
+
if (i === "{") {
|
|
1694
|
+
let a = e.indexOf("}", r);
|
|
1695
|
+
if (a === -1) {
|
|
1696
|
+
n += J(i), r++;
|
|
1697
|
+
continue;
|
|
1698
|
+
}
|
|
1699
|
+
let o = xt(e.slice(r + 1, a), t);
|
|
1700
|
+
n += `<span style="color: ${Y.annotation}; opacity: 0.75">{</span>`, n += o, n += `<span style="color: ${Y.annotation}; opacity: 0.75">}</span>`, r = a + 1;
|
|
1701
|
+
continue;
|
|
1702
|
+
}
|
|
1703
|
+
if (i === "[") {
|
|
1704
|
+
let a = e.indexOf("]", r);
|
|
1705
|
+
if (a === -1) {
|
|
1706
|
+
n += J(i), r++;
|
|
1707
|
+
continue;
|
|
1708
|
+
}
|
|
1709
|
+
let o = e.slice(r + 1, a), s = a + 1;
|
|
1710
|
+
for (; s < e.length && /\s/.test(e[s]);) s++;
|
|
1711
|
+
if (s < e.length && e[s] === "<") {
|
|
1712
|
+
let i = e.indexOf(">", s);
|
|
1713
|
+
if (i !== -1) {
|
|
1714
|
+
let a = e.slice(s + 1, i), c = t.has(o) ? Q(t.get(o)) : Y.text;
|
|
1715
|
+
n += `<span style="color: ${Y.annotation}; opacity: 0.75">[</span><span style="color: ${c}">${J(o)}</span><span style="color: ${Y.annotation}; opacity: 0.75">]</span> <span style="color: ${Y.text}; opacity: 0.6"><${J(a)}></span>`, r = i + 1;
|
|
1716
|
+
continue;
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
let c = e.slice(r + 1, a), l = X(e, a + 1) ? Y.marker : Y.value, u = J(c);
|
|
1720
|
+
n += `<span style="color: ${l}; opacity: 0.85">[</span><span style=" opacity: 1.0">${u}</span><span style="color: ${l}; opacity: 0.85">]</span>`, r = a + 1;
|
|
1721
|
+
continue;
|
|
1722
|
+
}
|
|
1723
|
+
if (i === "*" || i === "_" || i === "`") {
|
|
1724
|
+
let t = vt(e, r);
|
|
1725
|
+
if (t) {
|
|
1726
|
+
n += t.html, r = t.nextIndex;
|
|
1727
|
+
continue;
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
if (i === "#") {
|
|
1731
|
+
let i = 0, a = r;
|
|
1732
|
+
for (; a < e.length && e[a] === "#";) i++, a++;
|
|
1733
|
+
if (i <= 6 && (a >= e.length || e[a] === " " || e[a] === " ")) {
|
|
1734
|
+
let o = e.indexOf("\n", a), s = o === -1 ? e.length : o, c = e.slice(a, s).trim(), l = "", u = 0, d = c.indexOf("{");
|
|
1735
|
+
for (; d !== -1;) {
|
|
1736
|
+
let e = c.indexOf("}", d);
|
|
1737
|
+
if (e === -1) break;
|
|
1738
|
+
let n = c.slice(u, d);
|
|
1739
|
+
l += J(n);
|
|
1740
|
+
let r = xt(c.slice(d + 1, e), t);
|
|
1741
|
+
l += `<span style="color: ${Y.annotation}; opacity: 0.75">{</span>` + r + `<span style="color: ${Y.annotation}; opacity: 0.75">}</span>`, u = e + 1, d = c.indexOf("{", u);
|
|
1742
|
+
}
|
|
1743
|
+
l += J(c.slice(u));
|
|
1744
|
+
let f = c.includes("{") && c.includes("}"), p = `h${i}`, m = "#".repeat(i), h = f ? `color: ${Y.marker}; opacity: 0.8` : "";
|
|
1745
|
+
n += `<${p} style="margin: 0; font-weight: 600;"><span style="${h}">${m}</span> ${l}</${p}>`, r = s;
|
|
1746
|
+
continue;
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
if (i === "-" || i === "*") {
|
|
1750
|
+
let t = r > 0 ? e[r - 1] : "\n";
|
|
1751
|
+
if ((t === "\n" || t === "\r" || t === " " || t === " ") && e[r + 1] === " ") {
|
|
1752
|
+
let t = X(e, r + 2) ? `color: ${Y.marker}; opacity: 0.85` : "";
|
|
1753
|
+
n += `<span style="${t}">${J(i)}</span>`, r++;
|
|
1754
|
+
continue;
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
if (i === ">") {
|
|
1758
|
+
let t = r > 0 ? e[r - 1] : "\n";
|
|
1759
|
+
if ((t === "\n" || t === "\r" || t === " " || t === " ") && e[r + 1] === " ") {
|
|
1760
|
+
let t = X(e, r + 2) ? `color: ${Y.marker}; opacity: 0.85` : "";
|
|
1761
|
+
n += `<span style="${t}">${J(i)}</span>`, r++;
|
|
1762
|
+
continue;
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
n += J(i), r++;
|
|
1766
|
+
}
|
|
1767
|
+
return n;
|
|
1546
1768
|
}
|
|
1547
1769
|
//#endregion
|
|
1548
|
-
export { e as DEFAULT_CONTEXT, d as DataFactory, h as expandIRI,
|
|
1770
|
+
export { e as DEFAULT_CONTEXT, d as DataFactory, h as expandIRI, Ve as generate, He as generateNode, Q as getIRIColor, p as hash, yt as hashIRI, St as highlightMDLD, f as locate, ze as merge, I as parse, _ as parseSemanticBlock, Je as render, g as shortenIRI };
|