artifactuse 0.1.30 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/{index-BH35XKmt.js → index-llShix6s.js} +142 -120
- package/dist/index.js +1 -1
- package/dist/react/ArtifactusePanel.d.ts +3 -1
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.js +884 -866
- package/dist/svelte/index.js +1732 -1727
- package/dist/vue/index.js +1292 -1279
- package/dist/vue2/index.js +56 -7
- package/package.json +1 -1
|
@@ -18,6 +18,8 @@ const Ee = {
|
|
|
18
18
|
"patch",
|
|
19
19
|
"smartdiff",
|
|
20
20
|
"json",
|
|
21
|
+
"csv",
|
|
22
|
+
"tsv",
|
|
21
23
|
"javascript",
|
|
22
24
|
"js",
|
|
23
25
|
"python",
|
|
@@ -42,6 +44,8 @@ const Ee = {
|
|
|
42
44
|
"drawing",
|
|
43
45
|
// Code (panel for preview)
|
|
44
46
|
"json",
|
|
47
|
+
"csv",
|
|
48
|
+
"tsv",
|
|
45
49
|
"svg",
|
|
46
50
|
"diff",
|
|
47
51
|
"patch",
|
|
@@ -101,6 +105,8 @@ function ot(e) {
|
|
|
101
105
|
powershell: "PowerShell",
|
|
102
106
|
ps1: "PowerShell",
|
|
103
107
|
json: "JSON",
|
|
108
|
+
csv: "CSV",
|
|
109
|
+
tsv: "TSV",
|
|
104
110
|
xml: "XML",
|
|
105
111
|
yaml: "YAML",
|
|
106
112
|
yml: "YAML",
|
|
@@ -158,6 +164,8 @@ function Qs(e) {
|
|
|
158
164
|
shell: "sh",
|
|
159
165
|
sh: "sh",
|
|
160
166
|
json: "json",
|
|
167
|
+
csv: "csv",
|
|
168
|
+
tsv: "tsv",
|
|
161
169
|
xml: "xml",
|
|
162
170
|
yaml: "yml",
|
|
163
171
|
yml: "yml",
|
|
@@ -195,6 +203,8 @@ function Nr(e) {
|
|
|
195
203
|
sql: "sql",
|
|
196
204
|
sh: "bash",
|
|
197
205
|
json: "json",
|
|
206
|
+
csv: "csv",
|
|
207
|
+
tsv: "tsv",
|
|
198
208
|
xml: "xml",
|
|
199
209
|
yaml: "yaml",
|
|
200
210
|
yml: "yaml",
|
|
@@ -219,6 +229,8 @@ function Ys(e) {
|
|
|
219
229
|
jsx: '<circle cx="12" cy="12" r="2.5"/><ellipse cx="12" cy="12" rx="10" ry="4" fill="none" stroke="currentColor" stroke-width="1"/><ellipse cx="12" cy="12" rx="10" ry="4" fill="none" stroke="currentColor" stroke-width="1" transform="rotate(60 12 12)"/><ellipse cx="12" cy="12" rx="10" ry="4" fill="none" stroke="currentColor" stroke-width="1" transform="rotate(120 12 12)"/>',
|
|
220
230
|
tsx: '<circle cx="12" cy="12" r="2.5"/><ellipse cx="12" cy="12" rx="10" ry="4" fill="none" stroke="currentColor" stroke-width="1"/><ellipse cx="12" cy="12" rx="10" ry="4" fill="none" stroke="currentColor" stroke-width="1" transform="rotate(60 12 12)"/><ellipse cx="12" cy="12" rx="10" ry="4" fill="none" stroke="currentColor" stroke-width="1" transform="rotate(120 12 12)"/>',
|
|
221
231
|
json: '<path d="M5 3h2v2H5v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5h2v2H5c-1.07-.27-2-.9-2-2v-4a2 2 0 0 0-2-2H0v-2h1a2 2 0 0 0 2-2V5a2 2 0 0 1 2-2m14 0a2 2 0 0 1 2 2v4a2 2 0 0 0 2 2h1v2h-1a2 2 0 0 0-2 2v4a2 2 0 0 1-2 2h-2v-2h2v-5a2 2 0 0 1 2-2 2 2 0 0 1-2-2V5h-2V3h2m-7 12a1 1 0 0 1 1 1 1 1 0 0 1-1 1 1 1 0 0 1-1-1 1 1 0 0 1 1-1m-4 0a1 1 0 0 1 1 1 1 1 0 0 1-1 1 1 1 0 0 1-1-1 1 1 0 0 1 1-1m8 0a1 1 0 0 1 1 1 1 1 0 0 1-1 1 1 1 0 0 1-1-1 1 1 0 0 1 1-1z"/>',
|
|
232
|
+
csv: '<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18M3 15h18M9 3v18M15 3v18"/>',
|
|
233
|
+
tsv: '<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18M3 15h18M9 3v18M15 3v18"/>',
|
|
222
234
|
markdown: '<path d="M2 4h20v16H2V4m2 2v12h16V6H4m2 2h3l1.5 3 1.5-3h3v8h-2v-5l-2.5 4-2.5-4v5H6V8m11 0h2v4h2l-3 4-3-4h2V8z"/>',
|
|
223
235
|
md: '<path d="M2 4h20v16H2V4m2 2v12h16V6H4m2 2h3l1.5 3 1.5-3h3v8h-2v-5l-2.5 4-2.5-4v5H6V8m11 0h2v4h2l-3 4-3-4h2V8z"/>',
|
|
224
236
|
svg: '<path d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2m0 2v14h14V5H5m3 4a2 2 0 0 1 2 2 2 2 0 0 1-2 2 2 2 0 0 1-2-2 2 2 0 0 1 2-2m8 0l3 8h-2l-.5-1.5h-3L13 17h-2l3-8h2m-.5 2.5l-1 3h2l-1-3z"/>',
|
|
@@ -310,8 +322,8 @@ function Xr(e, t, r, a) {
|
|
|
310
322
|
if (b) return !1;
|
|
311
323
|
const y = a.minClickableLines;
|
|
312
324
|
if (y == null) return !1;
|
|
313
|
-
const v = typeof y == "number" ? y : y.lines || 0,
|
|
314
|
-
return f < v && !
|
|
325
|
+
const v = typeof y == "number" ? y : y.lines || 0, x = typeof y == "object" && Array.isArray(y.ignoreLanguages) ? y.ignoreLanguages : [];
|
|
326
|
+
return f < v && !x.includes(r);
|
|
315
327
|
}
|
|
316
328
|
function o(f, b) {
|
|
317
329
|
const y = a.actionLabel;
|
|
@@ -321,9 +333,9 @@ function Xr(e, t, r, a) {
|
|
|
321
333
|
if (r === "smartdiff")
|
|
322
334
|
try {
|
|
323
335
|
const f = JSON.parse(t), y = Wr(f.oldCode, f.newCode).split(`
|
|
324
|
-
`), v = y.slice(0, s),
|
|
325
|
-
`)), z = y.length > s, Z = f.language || "plaintext", A = n(y.length, z), j = A ? " artifactuse-inline-preview--static" : "", I = A ? ' data-non-clickable="true"' : "",
|
|
326
|
-
return `<div class="artifactuse-inline-preview${z ? " artifactuse-inline-preview--truncated" : ""}${j}" data-artifact-id="${e.id}" data-smartdiff="true" data-smartdiff-markers="${
|
|
336
|
+
`), v = y.slice(0, s), x = v.map((H) => H[0] || " "), $ = v.map((H) => H.slice(1)), R = ct($.join(`
|
|
337
|
+
`)), z = y.length > s, Z = f.language || "plaintext", A = n(y.length, z), j = A ? " artifactuse-inline-preview--static" : "", I = A ? ' data-non-clickable="true"' : "", _ = o("smartdiff", y.length);
|
|
338
|
+
return `<div class="artifactuse-inline-preview${z ? " artifactuse-inline-preview--truncated" : ""}${j}" data-artifact-id="${e.id}" data-smartdiff="true" data-smartdiff-markers="${x.join(",")}"${I}><pre class="artifactuse-inline-preview__pre"><code class="language-${Z}">${R}</code></pre>` + (z ? `<div class="artifactuse-inline-preview__fade"><span class="artifactuse-inline-preview__action">${_}</span></div>` : "") + "</div>";
|
|
327
339
|
} catch {
|
|
328
340
|
}
|
|
329
341
|
let i = t, u = r;
|
|
@@ -415,15 +427,15 @@ function ea(e, t, r = {}) {
|
|
|
415
427
|
const h = e.replace(l, (g, f, b) => {
|
|
416
428
|
const y = fr(b).trim(), v = y.split(`
|
|
417
429
|
`).length;
|
|
418
|
-
let
|
|
419
|
-
if ((["xml", "markup", "html", "htm"].includes(
|
|
430
|
+
let x = f.toLowerCase();
|
|
431
|
+
if ((["xml", "markup", "html", "htm"].includes(x) || !x) && y.trim().startsWith("<svg") && (x = "svg"), p(x))
|
|
420
432
|
return m++, g;
|
|
421
|
-
const $ = pr(
|
|
433
|
+
const $ = pr(x);
|
|
422
434
|
let R = !1;
|
|
423
|
-
if (n ? R = !0 :
|
|
424
|
-
const z = $e(y,
|
|
425
|
-
if (u && (z.tabs = u), c && (z.viewMode = c), m++, w.push(z), d(
|
|
426
|
-
return Xr(z, y,
|
|
435
|
+
if (n ? R = !0 : x === "diff" || x === "patch" || x === "smartdiff" ? R = v > 10 : $ ? R = !0 : R = y.length >= s && v >= a, !R && d(x) && (R = !0), R) {
|
|
436
|
+
const z = $e(y, x, t, m);
|
|
437
|
+
if (u && (z.tabs = u), c && (z.viewMode = c), m++, w.push(z), d(x))
|
|
438
|
+
return Xr(z, y, x, o);
|
|
427
439
|
let Z = "panel";
|
|
428
440
|
return z.isInline && (Z = z.type === "social" ? "inline-social" : "inline-form"), Kr(z, Z);
|
|
429
441
|
}
|
|
@@ -448,8 +460,8 @@ function ta() {
|
|
|
448
460
|
t.forEach((v) => {
|
|
449
461
|
try {
|
|
450
462
|
v(e);
|
|
451
|
-
} catch (
|
|
452
|
-
console.error("Artifactuse state subscriber error:",
|
|
463
|
+
} catch (x) {
|
|
464
|
+
console.error("Artifactuse state subscriber error:", x);
|
|
453
465
|
}
|
|
454
466
|
});
|
|
455
467
|
}
|
|
@@ -462,15 +474,15 @@ function ta() {
|
|
|
462
474
|
return { ...e };
|
|
463
475
|
}
|
|
464
476
|
function n(v) {
|
|
465
|
-
const
|
|
466
|
-
if (
|
|
477
|
+
const x = e.artifacts.findIndex(($) => $.id === v.id);
|
|
478
|
+
if (x === -1)
|
|
467
479
|
e = {
|
|
468
480
|
...e,
|
|
469
481
|
artifacts: [...e.artifacts, v]
|
|
470
482
|
};
|
|
471
483
|
else {
|
|
472
484
|
const $ = [...e.artifacts];
|
|
473
|
-
$[
|
|
485
|
+
$[x] = { ...$[x], ...v }, e = {
|
|
474
486
|
...e,
|
|
475
487
|
artifacts: $
|
|
476
488
|
};
|
|
@@ -483,21 +495,21 @@ function ta() {
|
|
|
483
495
|
function i(v) {
|
|
484
496
|
e = {
|
|
485
497
|
...e,
|
|
486
|
-
artifacts: e.artifacts.filter((
|
|
498
|
+
artifacts: e.artifacts.filter((x) => x.id !== v),
|
|
487
499
|
activeArtifactId: e.activeArtifactId === v ? null : e.activeArtifactId,
|
|
488
500
|
isPanelOpen: e.activeArtifactId === v ? !1 : e.isPanelOpen
|
|
489
501
|
}, r();
|
|
490
502
|
}
|
|
491
503
|
function u(v) {
|
|
492
|
-
return e.artifacts.find((
|
|
504
|
+
return e.artifacts.find((x) => x.id === v) || null;
|
|
493
505
|
}
|
|
494
506
|
function c() {
|
|
495
507
|
return e.activeArtifactId ? u(e.activeArtifactId) : null;
|
|
496
508
|
}
|
|
497
509
|
function d(v) {
|
|
498
|
-
const
|
|
499
|
-
let $ = (
|
|
500
|
-
|
|
510
|
+
const x = u(v);
|
|
511
|
+
let $ = (x == null ? void 0 : x.isPreviewable) === !1 ? "code" : "preview";
|
|
512
|
+
x != null && x.tabs && !x.tabs.includes($) && ($ = x.tabs[0]), e = {
|
|
501
513
|
...e,
|
|
502
514
|
activeArtifactId: v,
|
|
503
515
|
viewMode: $
|
|
@@ -533,10 +545,10 @@ function ta() {
|
|
|
533
545
|
}, r();
|
|
534
546
|
}
|
|
535
547
|
function h(v) {
|
|
536
|
-
return e.artifacts.filter((
|
|
548
|
+
return e.artifacts.filter((x) => x.messageId === v);
|
|
537
549
|
}
|
|
538
550
|
function g(v) {
|
|
539
|
-
return e.artifacts.filter((
|
|
551
|
+
return e.artifacts.filter((x) => x.type === v);
|
|
540
552
|
}
|
|
541
553
|
function f() {
|
|
542
554
|
return e.artifacts.length;
|
|
@@ -551,7 +563,7 @@ function ta() {
|
|
|
551
563
|
}, r();
|
|
552
564
|
}
|
|
553
565
|
function y(v) {
|
|
554
|
-
const
|
|
566
|
+
const x = r;
|
|
555
567
|
let $ = !1;
|
|
556
568
|
const R = () => {
|
|
557
569
|
$ = !0;
|
|
@@ -562,7 +574,7 @@ function ta() {
|
|
|
562
574
|
configurable: !0
|
|
563
575
|
}), v();
|
|
564
576
|
} finally {
|
|
565
|
-
delete window.__artifactuse_notify__, $ &&
|
|
577
|
+
delete window.__artifactuse_notify__, $ && x();
|
|
566
578
|
}
|
|
567
579
|
}
|
|
568
580
|
return {
|
|
@@ -606,19 +618,19 @@ function ra(e = []) {
|
|
|
606
618
|
const j = lt(A);
|
|
607
619
|
if (!j) return !1;
|
|
608
620
|
for (const I of r) {
|
|
609
|
-
const
|
|
610
|
-
if (
|
|
621
|
+
const _ = lt(I);
|
|
622
|
+
if (_ && _ === j || I === j)
|
|
611
623
|
return !0;
|
|
612
624
|
}
|
|
613
625
|
return !1;
|
|
614
626
|
}
|
|
615
627
|
function c(A) {
|
|
616
|
-
var U,
|
|
617
|
-
if (((U = A.data) == null ? void 0 : U.type) === "artifactuse" && (console.log("[Bridge] Message from:", A.origin, "action:", (
|
|
628
|
+
var U, k, C;
|
|
629
|
+
if (((U = A.data) == null ? void 0 : U.type) === "artifactuse" && (console.log("[Bridge] Message from:", A.origin, "action:", (k = A.data) == null ? void 0 : k.action), console.log("[Bridge] Allowed origins:", w())), !u(A.origin)) {
|
|
618
630
|
((C = A.data) == null ? void 0 : C.type) === "artifactuse" && console.warn("[Bridge] Origin NOT allowed:", A.origin);
|
|
619
631
|
return;
|
|
620
632
|
}
|
|
621
|
-
const { type: j, action: I, data:
|
|
633
|
+
const { type: j, action: I, data: _, requestId: H } = A.data || {};
|
|
622
634
|
if (j !== "artifactuse") return;
|
|
623
635
|
if (I === "ready" || I === "panel:ready") {
|
|
624
636
|
console.log("[Bridge] panel:ready received, setting isReady=true"), n = !0, o = !0, m();
|
|
@@ -626,13 +638,13 @@ function ra(e = []) {
|
|
|
626
638
|
}
|
|
627
639
|
(a.get(I) || []).forEach((L) => {
|
|
628
640
|
try {
|
|
629
|
-
L(
|
|
641
|
+
L(_, H);
|
|
630
642
|
} catch (S) {
|
|
631
643
|
console.error(`Artifactuse bridge handler error (${I}):`, S);
|
|
632
644
|
}
|
|
633
645
|
}), (a.get("*") || []).forEach((L) => {
|
|
634
646
|
try {
|
|
635
|
-
L({ action: I, data:
|
|
647
|
+
L({ action: I, data: _, requestId: H });
|
|
636
648
|
} catch (S) {
|
|
637
649
|
console.error("Artifactuse bridge wildcard handler error:", S);
|
|
638
650
|
}
|
|
@@ -663,7 +675,7 @@ function ra(e = []) {
|
|
|
663
675
|
return console.error("Artifactuse bridge send error:", I), !1;
|
|
664
676
|
}
|
|
665
677
|
}
|
|
666
|
-
function g(A, j, I = null,
|
|
678
|
+
function g(A, j, I = null, _ = "*") {
|
|
667
679
|
const H = {
|
|
668
680
|
type: "artifactuse",
|
|
669
681
|
action: A,
|
|
@@ -671,14 +683,14 @@ function ra(e = []) {
|
|
|
671
683
|
requestId: I || ut(),
|
|
672
684
|
timestamp: Date.now()
|
|
673
685
|
};
|
|
674
|
-
return n ? (h(H,
|
|
686
|
+
return n ? (h(H, _), H.requestId) : (i.push(H), H.requestId);
|
|
675
687
|
}
|
|
676
688
|
function f(A, j, I = 3e4) {
|
|
677
|
-
return new Promise((
|
|
689
|
+
return new Promise((_, H) => {
|
|
678
690
|
const X = ut(), te = setTimeout(() => {
|
|
679
691
|
y(`${A}:response`, U), H(new Error(`Artifactuse bridge request timeout: ${A}`));
|
|
680
|
-
}, I), U = (
|
|
681
|
-
C === X && (clearTimeout(te), y(`${A}:response`, U),
|
|
692
|
+
}, I), U = (k, C) => {
|
|
693
|
+
C === X && (clearTimeout(te), y(`${A}:response`, U), _(k));
|
|
682
694
|
};
|
|
683
695
|
b(`${A}:response`, U), g(A, j, X);
|
|
684
696
|
});
|
|
@@ -689,14 +701,14 @@ function ra(e = []) {
|
|
|
689
701
|
function y(A, j) {
|
|
690
702
|
const I = a.get(A);
|
|
691
703
|
if (I) {
|
|
692
|
-
const
|
|
693
|
-
|
|
704
|
+
const _ = I.indexOf(j);
|
|
705
|
+
_ > -1 && I.splice(_, 1);
|
|
694
706
|
}
|
|
695
707
|
}
|
|
696
708
|
function v(A) {
|
|
697
709
|
return g("load:artifact", A);
|
|
698
710
|
}
|
|
699
|
-
function
|
|
711
|
+
function x(A, j) {
|
|
700
712
|
return g("update:artifact", { artifactId: A, updates: j });
|
|
701
713
|
}
|
|
702
714
|
function $() {
|
|
@@ -718,7 +730,7 @@ function ra(e = []) {
|
|
|
718
730
|
on: b,
|
|
719
731
|
off: y,
|
|
720
732
|
loadArtifact: v,
|
|
721
|
-
updateArtifact:
|
|
733
|
+
updateArtifact: x,
|
|
722
734
|
requestSave: $,
|
|
723
735
|
requestExport: R,
|
|
724
736
|
sendAIResponse: z,
|
|
@@ -1386,17 +1398,17 @@ function fa(e = {}) {
|
|
|
1386
1398
|
highlightActiveLineGutter: b,
|
|
1387
1399
|
highlightSpecialChars: y,
|
|
1388
1400
|
drawSelection: v,
|
|
1389
|
-
dropCursor:
|
|
1401
|
+
dropCursor: x,
|
|
1390
1402
|
rectangularSelection: $,
|
|
1391
1403
|
crosshairCursor: R,
|
|
1392
1404
|
highlightActiveLine: z
|
|
1393
1405
|
} = t.view, { defaultKeymap: Z, history: A, historyKeymap: j, indentWithTab: I } = t.commands, {
|
|
1394
|
-
indentOnInput:
|
|
1406
|
+
indentOnInput: _,
|
|
1395
1407
|
syntaxHighlighting: H,
|
|
1396
1408
|
bracketMatching: X,
|
|
1397
1409
|
foldGutter: te,
|
|
1398
1410
|
foldKeymap: U,
|
|
1399
|
-
HighlightStyle:
|
|
1411
|
+
HighlightStyle: k
|
|
1400
1412
|
} = t.language, {
|
|
1401
1413
|
closeBrackets: C,
|
|
1402
1414
|
closeBracketsKeymap: L,
|
|
@@ -1412,10 +1424,10 @@ function fa(e = {}) {
|
|
|
1412
1424
|
closedText: "▸"
|
|
1413
1425
|
}),
|
|
1414
1426
|
v(),
|
|
1415
|
-
|
|
1427
|
+
x(),
|
|
1416
1428
|
m.allowMultipleSelections.of(!0),
|
|
1417
|
-
|
|
1418
|
-
...M ? [H(o(
|
|
1429
|
+
_(),
|
|
1430
|
+
...M ? [H(o(k, M, B))] : [],
|
|
1419
1431
|
X(),
|
|
1420
1432
|
C(),
|
|
1421
1433
|
S(),
|
|
@@ -1478,7 +1490,7 @@ function mr(e) {
|
|
|
1478
1490
|
ee = e;
|
|
1479
1491
|
}
|
|
1480
1492
|
var he = { exec: () => null };
|
|
1481
|
-
function
|
|
1493
|
+
function T(e, t = "") {
|
|
1482
1494
|
let r = typeof e == "string" ? e : e.source, a = { replace: (s, n) => {
|
|
1483
1495
|
let o = typeof n == "string" ? n : n.source;
|
|
1484
1496
|
return o = o.replace(q.caret, "$1"), r = r.replace(s, o), a;
|
|
@@ -1491,8 +1503,8 @@ var ha = (() => {
|
|
|
1491
1503
|
} catch {
|
|
1492
1504
|
return !1;
|
|
1493
1505
|
}
|
|
1494
|
-
})(), q = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (e) => new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}#`), htmlBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}<(?:[a-z].*>|!--)`, "i") }, ga = /^(?:[ \t]*(?:\n|$))+/, ma = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, wa = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, me = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, ba = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Je = /(?:[*+-]|\d{1,9}[.)])/, wr = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, br =
|
|
1495
|
-
]`).replace("lheading", br).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, za = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, La = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, yr = /^( {2,}|\\)\n(?!\s*$)/, Ca = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Te = /[\p{P}\p{S}]/u, rt = /[\s\p{P}\p{S}]/u, kr = /[^\s\p{P}\p{S}]/u, Ma =
|
|
1506
|
+
})(), q = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (e) => new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}#`), htmlBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}<(?:[a-z].*>|!--)`, "i") }, ga = /^(?:[ \t]*(?:\n|$))+/, ma = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, wa = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, me = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, ba = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Je = /(?:[*+-]|\d{1,9}[.)])/, wr = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, br = T(wr).replace(/bull/g, Je).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), va = T(wr).replace(/bull/g, Je).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), Qe = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, ya = /^[^\n]+/, Ye = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, ka = T(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Ye).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), xa = T(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Je).getRegex(), _e = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", et = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, $a = T("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", et).replace("tag", _e).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), vr = T(Qe).replace("hr", me).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _e).getRegex(), Aa = T(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", vr).getRegex(), tt = { blockquote: Aa, code: ma, def: ka, fences: wa, heading: ba, hr: me, html: $a, lheading: br, list: xa, newline: ga, paragraph: vr, table: he, text: ya }, pt = T("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", me).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _e).getRegex(), Sa = { ...tt, lheading: va, table: pt, paragraph: T(Qe).replace("hr", me).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", pt).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _e).getRegex() }, Ra = { ...tt, html: T(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", et).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: he, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: T(Qe).replace("hr", me).replace("heading", ` *#{1,6} *[^
|
|
1507
|
+
]`).replace("lheading", br).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, za = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, La = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, yr = /^( {2,}|\\)\n(?!\s*$)/, Ca = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Te = /[\p{P}\p{S}]/u, rt = /[\s\p{P}\p{S}]/u, kr = /[^\s\p{P}\p{S}]/u, Ma = T(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, rt).getRegex(), xr = /(?!~)[\p{P}\p{S}]/u, _a = /(?!~)[\s\p{P}\p{S}]/u, Ta = /(?:[^\s\p{P}\p{S}]|~)/u, Ea = T(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", ha ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), $r = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Pa = T($r, "u").replace(/punct/g, Te).getRegex(), ja = T($r, "u").replace(/punct/g, xr).getRegex(), Ar = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ia = T(Ar, "gu").replace(/notPunctSpace/g, kr).replace(/punctSpace/g, rt).replace(/punct/g, Te).getRegex(), Da = T(Ar, "gu").replace(/notPunctSpace/g, Ta).replace(/punctSpace/g, _a).replace(/punct/g, xr).getRegex(), Ha = T("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, kr).replace(/punctSpace/g, rt).replace(/punct/g, Te).getRegex(), qa = T(/\\(punct)/, "gu").replace(/punct/g, Te).getRegex(), Za = T(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Ba = T(et).replace("(?:-->|$)", "-->").getRegex(), Oa = T("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Ba).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Ae = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Va = T(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", Ae).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Sr = T(/^!?\[(label)\]\[(ref)\]/).replace("label", Ae).replace("ref", Ye).getRegex(), Rr = T(/^!?\[(ref)\](?:\[\])?/).replace("ref", Ye).getRegex(), Fa = T("reflink|nolink(?!\\()", "g").replace("reflink", Sr).replace("nolink", Rr).getRegex(), ft = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, at = { _backpedal: he, anyPunctuation: qa, autolink: Za, blockSkip: Ea, br: yr, code: La, del: he, emStrongLDelim: Pa, emStrongRDelimAst: Ia, emStrongRDelimUnd: Ha, escape: za, link: Va, nolink: Rr, punctuation: Ma, reflink: Sr, reflinkSearch: Fa, tag: Oa, text: Ca, url: he }, Na = { ...at, link: T(/^!?\[(label)\]\((.*?)\)/).replace("label", Ae).getRegex(), reflink: T(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Ae).getRegex() }, De = { ...at, emStrongRDelimAst: Da, emStrongLDelim: ja, url: T(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ft).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: T(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ft).getRegex() }, Ua = { ...De, br: T(yr).replace("{2,}", "*").getRegex(), text: T(De.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, ye = { normal: tt, gfm: Sa, pedantic: Ra }, le = { normal: at, gfm: De, breaks: Ua, pedantic: Na }, Ga = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, ht = (e) => Ga[e];
|
|
1496
1508
|
function G(e, t) {
|
|
1497
1509
|
if (t) {
|
|
1498
1510
|
if (q.escapeTest.test(e)) return e.replace(q.escapeReplace, ht);
|
|
@@ -1652,11 +1664,11 @@ ${d}` : d;
|
|
|
1652
1664
|
`, 1)[0], h = !l.trim(), g = 0;
|
|
1653
1665
|
if (this.options.pedantic ? (g = 2, w = l.trimStart()) : h ? g = t[1].length + 1 : (g = t[2].search(this.rules.other.nonSpaceChar), g = g > 4 ? 1 : g, w = l.slice(g), g += t[1].length), h && this.rules.other.blankLine.test(m) && (p += m + `
|
|
1654
1666
|
`, e = e.substring(m.length + 1), d = !0), !d) {
|
|
1655
|
-
let f = this.rules.other.nextBulletRegex(g), b = this.rules.other.hrRegex(g), y = this.rules.other.fencesBeginRegex(g), v = this.rules.other.headingBeginRegex(g),
|
|
1667
|
+
let f = this.rules.other.nextBulletRegex(g), b = this.rules.other.hrRegex(g), y = this.rules.other.fencesBeginRegex(g), v = this.rules.other.headingBeginRegex(g), x = this.rules.other.htmlBeginRegex(g);
|
|
1656
1668
|
for (; e; ) {
|
|
1657
1669
|
let $ = e.split(`
|
|
1658
1670
|
`, 1)[0], R;
|
|
1659
|
-
if (m = $, this.options.pedantic ? (m = m.replace(this.rules.other.listReplaceNesting, " "), R = m) : R = m.replace(this.rules.other.tabCharGlobal, " "), y.test(m) || v.test(m) ||
|
|
1671
|
+
if (m = $, this.options.pedantic ? (m = m.replace(this.rules.other.listReplaceNesting, " "), R = m) : R = m.replace(this.rules.other.tabCharGlobal, " "), y.test(m) || v.test(m) || x.test(m) || f.test(m) || b.test(m)) break;
|
|
1660
1672
|
if (R.search(this.rules.other.nonSpaceChar) >= g || !m.trim()) w += `
|
|
1661
1673
|
` + R.slice(g);
|
|
1662
1674
|
else {
|
|
@@ -2903,8 +2915,8 @@ function us(e, t = {}) {
|
|
|
2903
2915
|
e = e.replace(y, ($, R, z) => V("show", z, r));
|
|
2904
2916
|
const v = /<a[^>]*href="(https?:\/\/music\.apple\.com\/([a-z]{2})\/([a-z-]+)\/[^\/]+\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2905
2917
|
e = e.replace(v, ($, R, z, Z, A) => kt(z, Z, A));
|
|
2906
|
-
const
|
|
2907
|
-
e = e.replace(
|
|
2918
|
+
const x = new RegExp(`(?<!["'=])(https?:\\/\\/music\\.apple\\.com\\/([a-z]{2})\\/([a-z-]+)\\/[^\\/\\s]+\\/(\\d+))(?!["'])`, "gi");
|
|
2919
|
+
e = e.replace(x, ($, R, z, Z, A) => kt(z, Z, A));
|
|
2908
2920
|
for (let $ = a.length - 1; $ >= 0; $--)
|
|
2909
2921
|
e = e.replace(`__PROTECTED_${$}__`, a[$]);
|
|
2910
2922
|
return e;
|
|
@@ -3239,13 +3251,13 @@ function bs(e) {
|
|
|
3239
3251
|
e = e.replace(l, (g, f, b) => W(decodeURIComponent(b.replace(/\+/g, " "))));
|
|
3240
3252
|
const m = /<a[^>]*href="(https?:\/\/(?:www\.)?openstreetmap\.org\/[^"]*mlat=([0-9.-]+)[^"]*mlon=([0-9.-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3241
3253
|
e = e.replace(m, (g, f, b, y) => {
|
|
3242
|
-
const v = f.match(/#map=(\d+)/),
|
|
3243
|
-
return Lt(b, y,
|
|
3254
|
+
const v = f.match(/#map=(\d+)/), x = v ? v[1] : 15;
|
|
3255
|
+
return Lt(b, y, x);
|
|
3244
3256
|
});
|
|
3245
3257
|
const h = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?openstreetmap\\.org\\/[^\\s]*mlat=([0-9.-]+)[^\\s]*mlon=([0-9.-]+))(?!["'])`, "gi");
|
|
3246
3258
|
e = e.replace(h, (g, f, b, y) => {
|
|
3247
|
-
const v = f.match(/#map=(\d+)/),
|
|
3248
|
-
return Lt(b, y,
|
|
3259
|
+
const v = f.match(/#map=(\d+)/), x = v ? v[1] : 15;
|
|
3260
|
+
return Lt(b, y, x);
|
|
3249
3261
|
});
|
|
3250
3262
|
for (let g = t.length - 1; g >= 0; g--)
|
|
3251
3263
|
e = e.replace(`__PROTECTED_MAP_${g}__`, t[g]);
|
|
@@ -3341,37 +3353,37 @@ function Lt(e, t, r = 15) {
|
|
|
3341
3353
|
}
|
|
3342
3354
|
function vs(e, t = {}) {
|
|
3343
3355
|
const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/(?:www\.)?(?:twitter\.com|x\.com)\/([a-zA-Z0-9_]+)\/status\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3344
|
-
e = e.replace(a, (y, v,
|
|
3356
|
+
e = e.replace(a, (y, v, x, $) => Ct(x, $, r));
|
|
3345
3357
|
const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?(?:twitter\\.com|x\\.com)\\/([a-zA-Z0-9_]+)\\/status\\/(\\d+))(?!["'])`, "gi");
|
|
3346
|
-
e = e.replace(s, (y, v,
|
|
3358
|
+
e = e.replace(s, (y, v, x, $) => Ct(x, $, r));
|
|
3347
3359
|
const n = /<a[^>]*href="(https?:\/\/(?:www\.)?instagram\.com\/p\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3348
|
-
e = e.replace(n, (y, v,
|
|
3360
|
+
e = e.replace(n, (y, v, x) => Mt(x));
|
|
3349
3361
|
const o = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?instagram\\.com\\/p\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
3350
|
-
e = e.replace(o, (y, v,
|
|
3362
|
+
e = e.replace(o, (y, v, x) => Mt(x));
|
|
3351
3363
|
const i = /<a[^>]*href="(https?:\/\/(?:www\.)?instagram\.com\/reel\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3352
|
-
e = e.replace(i, (y, v,
|
|
3364
|
+
e = e.replace(i, (y, v, x) => _t(x));
|
|
3353
3365
|
const u = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?instagram\\.com\\/reel\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
3354
|
-
e = e.replace(u, (y, v,
|
|
3366
|
+
e = e.replace(u, (y, v, x) => _t(x));
|
|
3355
3367
|
const c = /<a[^>]*href="(https?:\/\/(?:www\.)?tiktok\.com\/@([a-zA-Z0-9_.]+)\/video\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3356
|
-
e = e.replace(c, (y, v,
|
|
3368
|
+
e = e.replace(c, (y, v, x, $) => Tt($));
|
|
3357
3369
|
const d = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?tiktok\\.com\\/@([a-zA-Z0-9_.]+)\\/video\\/(\\d+))(?!["'])`, "gi");
|
|
3358
|
-
e = e.replace(d, (y, v,
|
|
3370
|
+
e = e.replace(d, (y, v, x, $) => Tt($));
|
|
3359
3371
|
const p = /<a[^>]*href="(https?:\/\/(?:www\.)?linkedin\.com\/(?:posts|feed\/update)\/([a-zA-Z0-9_:-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3360
|
-
e = e.replace(p, (y, v,
|
|
3372
|
+
e = e.replace(p, (y, v, x) => Et(x, v));
|
|
3361
3373
|
const w = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?linkedin\\.com\\/(?:posts|feed\\/update)\\/([a-zA-Z0-9_:-]+))(?!["'])`, "gi");
|
|
3362
|
-
e = e.replace(w, (y, v,
|
|
3374
|
+
e = e.replace(w, (y, v, x) => Et(x, v));
|
|
3363
3375
|
const l = /<a[^>]*href="(https?:\/\/(?:www\.)?reddit\.com\/r\/([a-zA-Z0-9_]+)\/comments\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3364
|
-
e = e.replace(l, (y, v,
|
|
3376
|
+
e = e.replace(l, (y, v, x, $) => Pt(x, $, v));
|
|
3365
3377
|
const m = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?reddit\\.com\\/r\\/([a-zA-Z0-9_]+)\\/comments\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
3366
|
-
e = e.replace(m, (y, v,
|
|
3378
|
+
e = e.replace(m, (y, v, x, $) => Pt(x, $, v));
|
|
3367
3379
|
const h = /<a[^>]*href="(https?:\/\/(?:www\.)?facebook\.com\/[a-zA-Z0-9.]+\/posts\/\d+[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3368
3380
|
e = e.replace(h, (y, v) => jt(v));
|
|
3369
3381
|
const g = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?facebook\\.com\\/[a-zA-Z0-9.]+\\/posts\\/\\d+)(?!["'])`, "gi");
|
|
3370
3382
|
e = e.replace(g, (y, v) => jt(v));
|
|
3371
3383
|
const f = /<a[^>]*href="(https?:\/\/(?:www\.)?pinterest\.com\/pin\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3372
|
-
e = e.replace(f, (y, v,
|
|
3384
|
+
e = e.replace(f, (y, v, x) => It(x));
|
|
3373
3385
|
const b = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?pinterest\\.com\\/pin\\/(\\d+))(?!["'])`, "gi");
|
|
3374
|
-
return e = e.replace(b, (y, v,
|
|
3386
|
+
return e = e.replace(b, (y, v, x) => It(x)), e;
|
|
3375
3387
|
}
|
|
3376
3388
|
function Ct(e, t, r = "dark") {
|
|
3377
3389
|
return `
|
|
@@ -4579,6 +4591,8 @@ const Ir = {
|
|
|
4579
4591
|
drawing: "editor-panel/canvas",
|
|
4580
4592
|
// Data/config formats
|
|
4581
4593
|
json: "json-panel",
|
|
4594
|
+
csv: "sheet-panel",
|
|
4595
|
+
tsv: "sheet-panel",
|
|
4582
4596
|
// Graphics
|
|
4583
4597
|
svg: "svg-panel",
|
|
4584
4598
|
// Diff/patches
|
|
@@ -4614,6 +4628,12 @@ const Ir = {
|
|
|
4614
4628
|
// Show "Powered by Artifactuse" branding in panel footer
|
|
4615
4629
|
// Set to false to hide (requires paid license)
|
|
4616
4630
|
branding: !0,
|
|
4631
|
+
// Initial panel width as percentage (25-75)
|
|
4632
|
+
// Can be overridden per-component via props
|
|
4633
|
+
panelWidth: 65,
|
|
4634
|
+
// Initial split view position as percentage (20-80)
|
|
4635
|
+
// Can be overridden per-component via props
|
|
4636
|
+
splitPosition: 50,
|
|
4617
4637
|
// Panel configuration
|
|
4618
4638
|
// Users can add/override/disable panels here
|
|
4619
4639
|
//
|
|
@@ -4769,8 +4789,8 @@ function Ks(e, t) {
|
|
|
4769
4789
|
}
|
|
4770
4790
|
function bn(e = {}) {
|
|
4771
4791
|
const t = Hr(Ws, e), r = ta(), a = { ...Ir, ...t.panels }, s = Xs(a, t.cdnUrl), n = ra(s), o = na(t.theme, t.colors || {}), i = Ks(t, n), u = pa(t.sharing), c = fa(t.editor);
|
|
4772
|
-
function d(
|
|
4773
|
-
let S = E.parse(
|
|
4792
|
+
function d(k, C, L = {}) {
|
|
4793
|
+
let S = E.parse(k);
|
|
4774
4794
|
const D = [], M = { theme: o.resolved }, B = L.inlinePreview ?? t.inlinePreview ?? null, ne = L.inlineCode ?? t.inlineCode ?? null, re = L.tabs ?? t.tabs ?? null, ae = L.viewMode ?? t.viewMode ?? null;
|
|
4775
4795
|
if (t.processors.codeBlocks) {
|
|
4776
4796
|
const O = ea(S, C, {
|
|
@@ -4789,9 +4809,9 @@ function bn(e = {}) {
|
|
|
4789
4809
|
artifacts: D
|
|
4790
4810
|
};
|
|
4791
4811
|
}
|
|
4792
|
-
async function p(
|
|
4812
|
+
async function p(k = document) {
|
|
4793
4813
|
const C = [], L = { theme: o.resolved };
|
|
4794
|
-
t.processors.math && C.push(Pr()), t.processors.mermaid && C.push(_r(L)), t.processors.tables && Zs(), t.processors.audio && ps(
|
|
4814
|
+
t.processors.math && C.push(Pr()), t.processors.mermaid && C.push(_r(L)), t.processors.tables && Zs(), t.processors.audio && ps(k), t.syntaxHighlight && (jr(k), (k === document ? document : k).querySelectorAll(".artifactuse-inline-preview[data-smartdiff]").forEach((M) => {
|
|
4795
4815
|
var ae;
|
|
4796
4816
|
const B = M.querySelector("code");
|
|
4797
4817
|
if (!B || B.dataset.smartdiffProcessed) return;
|
|
@@ -4804,93 +4824,95 @@ function bn(e = {}) {
|
|
|
4804
4824
|
`), B.dataset.smartdiffProcessed = "true";
|
|
4805
4825
|
})), await Promise.all(C);
|
|
4806
4826
|
}
|
|
4807
|
-
function w(
|
|
4808
|
-
if (
|
|
4809
|
-
console.warn("Attempted to open inline artifact in panel:",
|
|
4827
|
+
function w(k) {
|
|
4828
|
+
if (k.isInline) {
|
|
4829
|
+
console.warn("Attempted to open inline artifact in panel:", k.id);
|
|
4810
4830
|
return;
|
|
4811
4831
|
}
|
|
4812
|
-
r.setActiveArtifact(
|
|
4832
|
+
r.setActiveArtifact(k.id), r.setPanelOpen(!0), k.viewMode && r.setViewMode(k.viewMode), _("artifact:opened", k);
|
|
4813
4833
|
}
|
|
4814
|
-
function l(
|
|
4815
|
-
const S =
|
|
4834
|
+
function l(k, C, L = {}) {
|
|
4835
|
+
const S = k.split(".").pop(), D = L.language || Nr(S) || S, M = L.title || k;
|
|
4816
4836
|
return m(C, D, { ...L, title: M });
|
|
4817
4837
|
}
|
|
4818
|
-
function m(
|
|
4819
|
-
const S = L.messageId || Vr("open"), D =
|
|
4838
|
+
function m(k, C, L = {}) {
|
|
4839
|
+
const S = L.messageId || Vr("open"), D = x({ type: C, language: C }) ? C : "txt", M = $e(k, D, S, 0);
|
|
4820
4840
|
return M.title = L.title || M.title, M.isInline = !1, M.editorLanguage = C, L.tabs && (M.tabs = L.tabs), L.panelUrl && (M.panelUrl = L.panelUrl), r.addArtifact(M), w(M), L.viewMode ? r.setViewMode(L.viewMode) : L.tabs && r.setViewMode(L.tabs[0]), M;
|
|
4821
4841
|
}
|
|
4822
|
-
function h(
|
|
4823
|
-
const S = typeof
|
|
4842
|
+
function h(k, C, L = {}) {
|
|
4843
|
+
const S = typeof k == "string" ? k : k == null ? void 0 : k.id, D = r.getArtifact(S);
|
|
4824
4844
|
if (!D) return null;
|
|
4825
4845
|
const M = { ...D, code: C, _refreshToken: Date.now() };
|
|
4826
|
-
return L.title !== void 0 && (M.title = L.title), L.tabs !== void 0 && (M.tabs = L.tabs), L.panelUrl !== void 0 && (M.panelUrl = L.panelUrl), r.addArtifact(M),
|
|
4846
|
+
return L.title !== void 0 && (M.title = L.title), L.tabs !== void 0 && (M.tabs = L.tabs), L.panelUrl !== void 0 && (M.panelUrl = L.panelUrl), r.addArtifact(M), _("artifact:updated", { artifactId: S, artifact: r.getArtifact(S) }), r.getArtifact(S);
|
|
4827
4847
|
}
|
|
4828
4848
|
function g() {
|
|
4829
|
-
r.setPanelOpen(!1), r.setFullscreen(!1),
|
|
4849
|
+
r.setPanelOpen(!1), r.setFullscreen(!1), _("panel:closed");
|
|
4830
4850
|
}
|
|
4831
4851
|
function f() {
|
|
4832
|
-
const
|
|
4833
|
-
r.clearActiveArtifact(), r.setPanelOpen(
|
|
4852
|
+
const k = !r.getState().isPanelOpen;
|
|
4853
|
+
r.clearActiveArtifact(), r.setPanelOpen(k), k || r.setFullscreen(!1), _("panel:toggled", { isOpen: k });
|
|
4834
4854
|
}
|
|
4835
4855
|
function b() {
|
|
4836
|
-
const
|
|
4837
|
-
r.setFullscreen(
|
|
4856
|
+
const k = !r.getState().isFullscreen;
|
|
4857
|
+
r.setFullscreen(k), _("fullscreen:toggled", { isFullscreen: k });
|
|
4838
4858
|
}
|
|
4839
|
-
function y(
|
|
4840
|
-
r.setViewMode(
|
|
4859
|
+
function y(k) {
|
|
4860
|
+
r.setViewMode(k), _("viewMode:changed", { mode: k });
|
|
4841
4861
|
}
|
|
4842
|
-
function v(
|
|
4843
|
-
if (!
|
|
4844
|
-
if (
|
|
4845
|
-
const { type: L, language: S } =
|
|
4862
|
+
function v(k, C = {}) {
|
|
4863
|
+
if (!k) return null;
|
|
4864
|
+
if (k.panelUrl) return k.panelUrl;
|
|
4865
|
+
const { type: L, language: S } = k, D = {
|
|
4846
4866
|
theme: C.theme || o.resolved
|
|
4847
4867
|
}, M = o.colors;
|
|
4848
4868
|
M != null && M.primary && (D.accent = M.primary);
|
|
4849
4869
|
let B = i.resolve(L, D);
|
|
4850
4870
|
return !B && S && (B = i.resolve(S, D)), B;
|
|
4851
4871
|
}
|
|
4852
|
-
function k
|
|
4853
|
-
return
|
|
4872
|
+
function x(k) {
|
|
4873
|
+
return k ? i.has(k.type) || i.has(k.language) : !1;
|
|
4854
4874
|
}
|
|
4855
|
-
function $(
|
|
4856
|
-
i.register(
|
|
4875
|
+
function $(k, C) {
|
|
4876
|
+
i.register(k, C);
|
|
4857
4877
|
}
|
|
4858
|
-
function R(
|
|
4859
|
-
i.unregister(
|
|
4878
|
+
function R(k) {
|
|
4879
|
+
i.unregister(k);
|
|
4860
4880
|
}
|
|
4861
4881
|
function z() {
|
|
4862
4882
|
return i.getTypes();
|
|
4863
4883
|
}
|
|
4864
|
-
function Z(
|
|
4865
|
-
n.send(
|
|
4884
|
+
function Z(k, C) {
|
|
4885
|
+
n.send(k, C);
|
|
4866
4886
|
}
|
|
4867
4887
|
const A = /* @__PURE__ */ new Map();
|
|
4868
|
-
function j(
|
|
4869
|
-
return A.has(
|
|
4888
|
+
function j(k, C) {
|
|
4889
|
+
return A.has(k) || A.set(k, /* @__PURE__ */ new Set()), A.get(k).add(C), () => {
|
|
4870
4890
|
var L;
|
|
4871
|
-
(L = A.get(
|
|
4891
|
+
(L = A.get(k)) == null || L.delete(C);
|
|
4872
4892
|
};
|
|
4873
4893
|
}
|
|
4874
|
-
function I(
|
|
4894
|
+
function I(k, C) {
|
|
4875
4895
|
var L;
|
|
4876
|
-
(L = A.get(
|
|
4896
|
+
(L = A.get(k)) == null || L.delete(C);
|
|
4877
4897
|
}
|
|
4878
|
-
function
|
|
4898
|
+
function _(k, C) {
|
|
4879
4899
|
var L;
|
|
4880
|
-
(L = A.get(
|
|
4900
|
+
(L = A.get(k)) == null || L.forEach((S) => {
|
|
4881
4901
|
try {
|
|
4882
4902
|
S(C);
|
|
4883
4903
|
} catch (D) {
|
|
4884
|
-
console.error(`Artifactuse event handler error (${
|
|
4904
|
+
console.error(`Artifactuse event handler error (${k}):`, D);
|
|
4885
4905
|
}
|
|
4886
4906
|
});
|
|
4887
4907
|
}
|
|
4888
|
-
n.on("ai:request", (
|
|
4908
|
+
n.on("ai:request", (k) => _("ai:request", k)), n.on("save:request", (k) => _("save:request", k)), n.on("export:complete", (k) => _("export:complete", k)), n.on("form:submit", (k) => _("form:submit", k)), n.on("form:cancel", (k) => _("form:cancel", k)), n.on("form:step", (k) => _("form:step", k)), n.on("social:copy", (k) => _("social:copy", k)), n.on("edit:save", (k) => {
|
|
4909
|
+
k != null && k.artifactId && (k == null ? void 0 : k.code) !== void 0 && h(k.artifactId, k.code), _("edit:save", k);
|
|
4910
|
+
});
|
|
4889
4911
|
function H() {
|
|
4890
4912
|
o.apply();
|
|
4891
4913
|
}
|
|
4892
|
-
function X(
|
|
4893
|
-
o.set(
|
|
4914
|
+
function X(k) {
|
|
4915
|
+
o.set(k);
|
|
4894
4916
|
}
|
|
4895
4917
|
function te() {
|
|
4896
4918
|
return o.resolved;
|
|
@@ -4920,7 +4942,7 @@ function bn(e = {}) {
|
|
|
4920
4942
|
getPanelUrl: v,
|
|
4921
4943
|
sendToPanel: Z,
|
|
4922
4944
|
// Panel management (new)
|
|
4923
|
-
hasPanel:
|
|
4945
|
+
hasPanel: x,
|
|
4924
4946
|
registerPanel: $,
|
|
4925
4947
|
unregisterPanel: R,
|
|
4926
4948
|
getPanelTypes: z,
|
|
@@ -4934,7 +4956,7 @@ function bn(e = {}) {
|
|
|
4934
4956
|
// Events
|
|
4935
4957
|
on: j,
|
|
4936
4958
|
off: I,
|
|
4937
|
-
emit:
|
|
4959
|
+
emit: _,
|
|
4938
4960
|
// Editor (CodeMirror integration)
|
|
4939
4961
|
editor: c,
|
|
4940
4962
|
// Bridge (for advanced use)
|