artifactuse 0.3.2 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- var Dr = Object.defineProperty;
2
- var qr = (e, t, r) => t in e ? Dr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var I = (e, t, r) => qr(e, typeof t != "symbol" ? t + "" : t, r);
1
+ var qr = Object.defineProperty;
2
+ var Zr = (e, t, r) => t in e ? qr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var I = (e, t, r) => Zr(e, typeof t != "symbol" ? t + "" : t, r);
4
4
  function ae() {
5
5
  return typeof window < "u" && window.Prism;
6
6
  }
@@ -13,11 +13,11 @@ function pr(e) {
13
13
  if (!t) return;
14
14
  t.querySelectorAll("pre code").forEach((a) => {
15
15
  if (a.classList.contains("prism-highlighted")) return;
16
- const s = Zr(a);
16
+ const s = Or(a);
17
17
  s && (a.className.includes(`language-${s}`) || a.classList.add(`language-${s}`), window.Prism.highlightElement(a), a.classList.add("prism-highlighted"));
18
18
  });
19
19
  }
20
- function Qs(e, t) {
20
+ function en(e, t) {
21
21
  ae() && (t && !e.className.includes(`language-${t}`) && e.classList.add(`language-${t}`), window.Prism.highlightElement(e), e.classList.add("prism-highlighted"));
22
22
  }
23
23
  function ot(e, t) {
@@ -25,7 +25,7 @@ function ot(e, t) {
25
25
  const r = window.Prism.languages[t];
26
26
  return r ? window.Prism.highlight(e, r, t) : lt(e);
27
27
  }
28
- function Zr(e) {
28
+ function Or(e) {
29
29
  const t = e.className.split(/\s+/);
30
30
  for (const s of t) {
31
31
  const n = s.match(/^(?:language-|lang-)(.+)$/);
@@ -73,7 +73,7 @@ function ge(e) {
73
73
  function lt(e) {
74
74
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
75
75
  }
76
- function Ys(e) {
76
+ function tn(e) {
77
77
  if (!ae())
78
78
  return console.warn("Artifactuse: Prism.js not found. Auto-highlighting disabled."), null;
79
79
  const t = new MutationObserver((r) => {
@@ -93,7 +93,7 @@ function Ys(e) {
93
93
  subtree: !0
94
94
  }), t;
95
95
  }
96
- function en() {
96
+ function rn() {
97
97
  return ae() ? Object.keys(window.Prism.languages).filter(
98
98
  (e) => typeof window.Prism.languages[e] == "object"
99
99
  ) : [];
@@ -102,7 +102,7 @@ const Pe = {
102
102
  CODE: "code",
103
103
  FORM: "form",
104
104
  SOCIAL: "social"
105
- }, Or = [
105
+ }, Br = [
106
106
  // Code languages
107
107
  "html",
108
108
  "htm",
@@ -131,7 +131,7 @@ const Pe = {
131
131
  // Structured artifacts
132
132
  "form",
133
133
  "social"
134
- ], Br = [
134
+ ], Fr = [
135
135
  // Visual editors (always panel)
136
136
  "video",
137
137
  "videoeditor",
@@ -156,17 +156,49 @@ const Pe = {
156
156
  "html",
157
157
  "htm",
158
158
  // Structured artifacts (form can be panel based on complexity)
159
- "form"
160
- ];
161
- function Fr(e = "artifact") {
159
+ "form",
160
+ // Binary workspace files
161
+ "image",
162
+ "audio",
163
+ "pdf",
164
+ "font",
165
+ "binary"
166
+ ], fr = {
167
+ png: "image",
168
+ jpg: "image",
169
+ jpeg: "image",
170
+ gif: "image",
171
+ webp: "image",
172
+ ico: "image",
173
+ bmp: "image",
174
+ tiff: "image",
175
+ tif: "image",
176
+ svg: "image",
177
+ mp3: "audio",
178
+ wav: "audio",
179
+ ogg: "audio",
180
+ flac: "audio",
181
+ aac: "audio",
182
+ mp4: "video",
183
+ m4a: "video",
184
+ webm: "video",
185
+ pdf: "pdf",
186
+ woff: "font",
187
+ woff2: "font",
188
+ ttf: "font",
189
+ eot: "font",
190
+ otf: "font",
191
+ bin: "binary"
192
+ };
193
+ function Nr(e = "artifact") {
162
194
  return `${e}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
163
195
  }
164
- function fr(e) {
165
- return Or.includes(e == null ? void 0 : e.toLowerCase());
166
- }
167
- function Nr(e) {
196
+ function hr(e) {
168
197
  return Br.includes(e == null ? void 0 : e.toLowerCase());
169
198
  }
199
+ function Ur(e) {
200
+ return Fr.includes(e == null ? void 0 : e.toLowerCase());
201
+ }
170
202
  function ct(e) {
171
203
  return {
172
204
  // Code languages
@@ -226,6 +258,12 @@ function ct(e) {
226
258
  // Structured artifacts
227
259
  form: "Form",
228
260
  social: "Social Preview",
261
+ // Binary workspace file types
262
+ image: "Image",
263
+ audio: "Audio",
264
+ pdf: "PDF",
265
+ font: "Font",
266
+ binary: "Binary",
229
267
  txt: "Plain Text",
230
268
  plaintext: "Plain Text",
231
269
  text: "Plain Text",
@@ -263,7 +301,7 @@ function ct(e) {
263
301
  v: "V"
264
302
  }[e == null ? void 0 : e.toLowerCase()] || (e == null ? void 0 : e.toUpperCase()) || "Code";
265
303
  }
266
- function tn(e) {
304
+ function an(e) {
267
305
  const t = {
268
306
  html: "html",
269
307
  htm: "html",
@@ -343,8 +381,8 @@ function tn(e) {
343
381
  }, r = e == null ? void 0 : e.toLowerCase();
344
382
  return t[r] || r || "txt";
345
383
  }
346
- function Ur(e) {
347
- return {
384
+ function Gr(e) {
385
+ const t = {
348
386
  html: "html",
349
387
  htm: "html",
350
388
  css: "css",
@@ -403,9 +441,10 @@ function Ur(e) {
403
441
  zig: "zig",
404
442
  nim: "nim",
405
443
  v: "v"
406
- }[e == null ? void 0 : e.toLowerCase()] || null;
444
+ }, r = e == null ? void 0 : e.toLowerCase();
445
+ return t[r] || fr[r] || null;
407
446
  }
408
- function rn(e) {
447
+ function sn(e) {
409
448
  return {
410
449
  html: '<path d="M12 17.56l4.07-1.13.55-6.1H9.38l-.16-1.7h7.78l.16-1.7H6.85l.48 5.1h6.3l-.25 2.9-2.38.63-2.38-.63-.15-1.7H6.76l.3 3.2L12 17.56M4.07 3h15.86L18.5 19.2 12 21l-6.5-1.8L4.07 3z"/>',
411
450
  htm: '<path d="M12 17.56l4.07-1.13.55-6.1H9.38l-.16-1.7h7.78l.16-1.7H6.85l.48 5.1h6.3l-.25 2.9-2.38.63-2.38-.63-.15-1.7H6.76l.3 3.2L12 17.56M4.07 3h15.86L18.5 19.2 12 21l-6.5-1.8L4.07 3z"/>',
@@ -497,26 +536,32 @@ function rn(e) {
497
536
  zig: '<path d="M2 6h7l-5 12h7l5-12h7l-5 12h7" fill="none" stroke="currentColor" stroke-width="1.5"/>',
498
537
  nim: '<path d="M12 2l3 5h5l-3 5 3 5h-5l-3 5-3-5H4l3-5-3-5h5l3-5z" fill="none" stroke="currentColor" stroke-width="1.2"/>',
499
538
  v: '<path d="M4 4l8 16 8-16" fill="none" stroke="currentColor" stroke-width="2"/>',
539
+ // Binary workspace file types
540
+ image: '<rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/>',
541
+ audio: '<path d="M9 18V5l12-2v13"/><circle cx="6" cy="18" r="3"/><circle cx="18" cy="16" r="3"/>',
542
+ pdf: '<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><path d="M10 11h4M10 14h4M10 17h2"/>',
543
+ font: '<path d="M4 7V4h16v3M9 20h6M12 4v16"/>',
544
+ binary: '<path d="M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"/><path d="M7 8v8M10 8v8M14 8h2v3h-2v2h2v3h-2M7.5 12h3"/>',
500
545
  // Text/document icon
501
546
  txt: '<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="8" y1="13" x2="16" y2="13"/><line x1="8" y1="17" x2="13" y2="17"/>',
502
547
  plaintext: '<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="8" y1="13" x2="16" y2="13"/><line x1="8" y1="17" x2="13" y2="17"/>',
503
548
  text: '<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="8" y1="13" x2="16" y2="13"/><line x1="8" y1="17" x2="13" y2="17"/>'
504
549
  }[e == null ? void 0 : e.toLowerCase()] || '<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="8" y1="13" x2="16" y2="13"/><line x1="8" y1="17" x2="13" y2="17"/>';
505
550
  }
506
- function an(e) {
551
+ function nn(e) {
507
552
  if (e === 0) return "0 Bytes";
508
553
  const t = 1024, r = ["Bytes", "KB", "MB", "GB"], a = Math.floor(Math.log(e) / Math.log(t));
509
554
  return parseFloat((e / Math.pow(t, a)).toFixed(2)) + " " + r[a];
510
555
  }
511
- function hr(e) {
556
+ function gr(e) {
512
557
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&amp;/g, "&").replace(/&#10;/g, `
513
558
  `).replace(/&#13;/g, "\r").replace(/&#9;/g, " ").replace(/&nbsp;/g, " ");
514
559
  }
515
- function Gr(e) {
560
+ function Wr(e) {
516
561
  const t = JSON.stringify(e);
517
562
  return typeof btoa == "function" ? btoa(unescape(encodeURIComponent(t))) : typeof Buffer < "u" ? Buffer.from(t, "utf-8").toString("base64") : t.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
518
563
  }
519
- function Wr(e, t) {
564
+ function Xr(e, t) {
520
565
  const r = t == null ? void 0 : t.toLowerCase();
521
566
  if (r === "smartdiff")
522
567
  try {
@@ -554,7 +599,7 @@ function Wr(e, t) {
554
599
  const u = e.match(/<title>([^<]+)<\/title>/i);
555
600
  return u ? u[1].trim() : e.includes("<template>") && e.includes("<script>") ? "Vue Component" : e.includes("import React") || e.includes('from "react"') ? "React Component" : e.includes("<!DOCTYPE html>") || e.includes("<html") ? "HTML Document" : e.includes("@app.route") || e.includes("Flask") ? "Flask App" : e.includes("express()") ? "Express Server" : e.includes("CREATE TABLE") ? "SQL Schema" : e.includes("SELECT") && e.includes("FROM") ? "SQL Query" : `${ct(t)} Code`;
556
601
  }
557
- function Xr(e, t) {
602
+ function Kr(e, t) {
558
603
  const r = (e || "").split(`
559
604
  `), a = (t || "").split(`
560
605
  `), s = [], n = Math.max(r.length, a.length);
@@ -565,7 +610,7 @@ function Xr(e, t) {
565
610
  return s.join(`
566
611
  `);
567
612
  }
568
- function Kr(e, t, r, a) {
613
+ function Jr(e, t, r, a) {
569
614
  const s = a.maxLines || 15;
570
615
  function n(v, x) {
571
616
  if (x) return !1;
@@ -581,7 +626,7 @@ function Kr(e, t, r, a) {
581
626
  }
582
627
  if (r === "smartdiff")
583
628
  try {
584
- const v = JSON.parse(t), M = Xr(v.oldCode, v.newCode).split(`
629
+ const v = JSON.parse(t), M = Kr(v.oldCode, v.newCode).split(`
585
630
  `), A = M.slice(0, s), S = A.map((B) => B[0] || " "), L = A.map((B) => B.slice(1)), $ = v.language || "plaintext", k = ge($), z = ot(L.join(`
586
631
  `), k), j = ae() && window.Prism.languages[k], P = M.length > s, T = n(M.length, P), N = T ? " artifactuse-inline-preview--static" : "", X = T ? ' data-non-clickable="true"' : "", O = o("smartdiff", M.length);
587
632
  return `<div class="artifactuse-inline-preview${P ? " artifactuse-inline-preview--truncated" : ""}${N}" data-artifact-id="${e.id}" data-smartdiff="true" data-smartdiff-markers="${S.join(",")}"${X}><pre class="artifactuse-inline-preview__pre${j ? " language-" + $ : ""}"><code class="language-${$}${j ? " prism-highlighted" : ""}">${z}</code></pre>` + (P ? `<div class="artifactuse-inline-preview__fade"><span class="artifactuse-inline-preview__action">${O}</span></div>` : "") + "</div>";
@@ -593,20 +638,20 @@ function Kr(e, t, r, a) {
593
638
  `), p = ge(u), w = ot(d, p), c = ae() && window.Prism.languages[p], h = l.length > s, f = n(l.length, h), g = f ? " artifactuse-inline-preview--static" : "", m = f ? ' data-non-clickable="true"' : "", b = o(r, l.length);
594
639
  return `<div class="artifactuse-inline-preview${h ? " artifactuse-inline-preview--truncated" : ""}${g}" data-artifact-id="${e.id}"${m}><pre class="artifactuse-inline-preview__pre${c ? " language-" + u : ""}"><code class="language-${u}${c ? " prism-highlighted" : ""}">${w}</code></pre>` + (h ? `<div class="artifactuse-inline-preview__fade"><span class="artifactuse-inline-preview__action">${b}</span></div>` : "") + "</div>";
595
640
  }
596
- function Jr(e, t = "panel") {
597
- const r = Gr(e);
641
+ function Qr(e, t = "panel") {
642
+ const r = Wr(e);
598
643
  return `<div class="${`artifactuse-placeholder artifactuse-${t}`}" data-artifact-id="${e.id}" data-artifact-type="${e.type}" data-artifact="${r}"></div>`;
599
644
  }
600
- function gr(e) {
645
+ function mr(e) {
601
646
  try {
602
647
  return JSON.parse(e);
603
648
  } catch {
604
649
  return null;
605
650
  }
606
651
  }
607
- function Qr(e) {
652
+ function Yr(e) {
608
653
  var s;
609
- const t = gr(e);
654
+ const t = mr(e);
610
655
  if (!t || t.display === "inline") return !0;
611
656
  if (t.display === "panel" || t.variant === "wizard") return !1;
612
657
  if (t.variant === "buttons") return !0;
@@ -615,39 +660,39 @@ function Qr(e) {
615
660
  const a = ["multiselect", "rating", "color", "range"];
616
661
  return !(r.some((n) => a.includes(n.type)) || r.filter((n) => n.type !== "buttons" && n.type !== "divider" && n.type !== "heading").length > 4 || r.some((n) => n.type === "textarea" && (n.rows || 3) > 4));
617
662
  }
618
- function Yr(e, t) {
663
+ function ea(e, t) {
619
664
  const r = e == null ? void 0 : e.toLowerCase();
620
- return r === "social" ? !0 : r === "form" ? Qr(t) : !1;
665
+ return r === "social" ? !0 : r === "form" ? Yr(t) : !1;
621
666
  }
622
- function ea(e) {
667
+ function ta(e) {
623
668
  const t = e == null ? void 0 : e.toLowerCase();
624
669
  return t === "form" ? Pe.FORM : t === "social" ? Pe.SOCIAL : Pe.CODE;
625
670
  }
626
671
  function $e(e, t, r, a) {
627
- const s = t == null ? void 0 : t.toLowerCase(), n = ea(s), o = Yr(s, e);
672
+ const s = t == null ? void 0 : t.toLowerCase(), n = ta(s), o = ea(s, e);
628
673
  return {
629
674
  id: `${r}-${n}-${a}`,
630
675
  messageId: r,
631
676
  type: n,
632
677
  language: s,
633
- title: Wr(e, s),
678
+ title: Xr(e, s),
634
679
  code: e,
635
680
  isInline: o,
636
- isPreviewable: fr(s),
637
- isPanelArtifact: Nr(s),
681
+ isPreviewable: hr(s),
682
+ isPanelArtifact: Ur(s),
638
683
  size: e.length,
639
684
  lineCount: e.split(`
640
685
  `).length,
641
686
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
642
687
  };
643
688
  }
644
- function sn(e, t) {
689
+ function on(e, t) {
645
690
  const r = [], a = /<pre><code class="language-(\w+)">([\s\S]*?)<\/code><\/pre>/gi;
646
691
  let s, n = 0;
647
692
  for (; (s = a.exec(e)) !== null; ) {
648
- const o = s[1], i = hr(s[2]);
693
+ const o = s[1], i = gr(s[2]);
649
694
  let u = o.toLowerCase();
650
- if ((["xml", "markup", "html", "htm"].includes(u) || !u) && (i.trim().startsWith("<svg") || i.includes("<svg ") || i.includes("<svg>")) && (u = "svg"), (u === "form" || u === "social") && !gr(i)) {
695
+ if ((["xml", "markup", "html", "htm"].includes(u) || !u) && (i.trim().startsWith("<svg") || i.includes("<svg ") || i.includes("<svg>")) && (u = "svg"), (u === "form" || u === "social") && !mr(i)) {
651
696
  r.push($e(i, "json", t, n)), n++;
652
697
  continue;
653
698
  }
@@ -655,7 +700,7 @@ function sn(e, t) {
655
700
  }
656
701
  return r;
657
702
  }
658
- function ta(e, t, r = {}) {
703
+ function ra(e, t, r = {}) {
659
704
  const {
660
705
  minLines: a = 3,
661
706
  minLength: s = 50,
@@ -674,19 +719,19 @@ function ta(e, t, r = {}) {
674
719
  const w = [], c = /<pre><code class="language-(\w+)">([\s\S]*?)<\/code><\/pre>/gi;
675
720
  let h = 0;
676
721
  const f = e.replace(c, (g, m, b) => {
677
- const v = hr(b).trim(), x = v.split(`
722
+ const v = gr(b).trim(), x = v.split(`
678
723
  `).length;
679
724
  let M = m.toLowerCase();
680
725
  if ((["xml", "markup", "html", "htm"].includes(M) || !M) && v.trim().startsWith("<svg") && (M = "svg"), p(M))
681
726
  return h++, g;
682
- const A = fr(M);
727
+ const A = hr(M);
683
728
  let S = !1;
684
729
  if (n ? S = !0 : M === "diff" || M === "patch" || M === "smartdiff" ? S = x > 10 : A ? S = !0 : S = v.length >= s && x >= a, !S && d(M) && (S = !0), S) {
685
730
  const L = $e(v, M, t, h);
686
731
  if (u && (L.tabs = u), l && (L.viewMode = l), h++, w.push(L), d(M))
687
- return Kr(L, v, M, o);
732
+ return Jr(L, v, M, o);
688
733
  let $ = "panel";
689
- return L.isInline && ($ = L.type === "social" ? "inline-social" : "inline-form"), Jr(L, $);
734
+ return L.isInline && ($ = L.type === "social" ? "inline-social" : "inline-form"), Qr(L, $);
690
735
  }
691
736
  return h++, g;
692
737
  });
@@ -695,7 +740,7 @@ function ta(e, t, r = {}) {
695
740
  html: f
696
741
  };
697
742
  }
698
- function ra() {
743
+ function aa() {
699
744
  let e = {
700
745
  artifacts: [],
701
746
  activeArtifactId: null,
@@ -933,7 +978,7 @@ function ut(e) {
933
978
  return null;
934
979
  }
935
980
  }
936
- function aa(e = []) {
981
+ function sa(e = []) {
937
982
  const t = Array.isArray(e) ? e : [e].filter(Boolean), r = new Set(t), a = /* @__PURE__ */ new Map();
938
983
  let s = null, n = !1, o = !1;
939
984
  const i = [];
@@ -964,14 +1009,14 @@ function aa(e = []) {
964
1009
  (a.get(j) || []).forEach((E) => {
965
1010
  try {
966
1011
  E(P, T);
967
- } catch (R) {
968
- console.error(`Artifactuse bridge handler error (${j}):`, R);
1012
+ } catch (C) {
1013
+ console.error(`Artifactuse bridge handler error (${j}):`, C);
969
1014
  }
970
1015
  }), (a.get("*") || []).forEach((E) => {
971
1016
  try {
972
1017
  E({ action: j, data: P, requestId: T });
973
- } catch (R) {
974
- console.error("Artifactuse bridge wildcard handler error:", R);
1018
+ } catch (C) {
1019
+ console.error("Artifactuse bridge wildcard handler error:", C);
975
1020
  }
976
1021
  });
977
1022
  }
@@ -1076,7 +1121,7 @@ function aa(e = []) {
1076
1121
  function dt() {
1077
1122
  return `req-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
1078
1123
  }
1079
- function sa(e) {
1124
+ function na(e) {
1080
1125
  if (!e) return null;
1081
1126
  if (typeof e == "string" && e.includes(","))
1082
1127
  return e.trim();
@@ -1086,8 +1131,8 @@ function sa(e) {
1086
1131
  const r = parseInt(t.slice(0, 2), 16), a = parseInt(t.slice(2, 4), 16), s = parseInt(t.slice(4, 6), 16);
1087
1132
  return `${r}, ${a}, ${s}`;
1088
1133
  }
1089
- function na(e) {
1090
- return e ? sa(e) : null;
1134
+ function ia(e) {
1135
+ return e ? na(e) : null;
1091
1136
  }
1092
1137
  function ye(e) {
1093
1138
  if (!e || typeof e != "object") return {};
@@ -1096,7 +1141,7 @@ function ye(e) {
1096
1141
  if (r === "gradientOpacity" || typeof a == "number")
1097
1142
  t[r] = a;
1098
1143
  else {
1099
- const s = na(a);
1144
+ const s = ia(a);
1100
1145
  s && (t[r] = s);
1101
1146
  }
1102
1147
  return t;
@@ -1171,7 +1216,7 @@ const pt = {
1171
1216
  gradientOpacity: "0.25"
1172
1217
  }
1173
1218
  };
1174
- function ia(e = "auto", t = {}) {
1219
+ function oa(e = "auto", t = {}) {
1175
1220
  let r = e, a = {
1176
1221
  dark: { ...pt.dark },
1177
1222
  light: { ...pt.light }
@@ -1267,7 +1312,7 @@ function ia(e = "auto", t = {}) {
1267
1312
  function ce(e) {
1268
1313
  return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1269
1314
  }
1270
- const Xe = "artifactuse_auth", mr = "https://app.artifactuse.com", we = "https://api.artifactuse.com";
1315
+ const Xe = "artifactuse_auth", wr = "https://app.artifactuse.com", we = "https://api.artifactuse.com";
1271
1316
  function Te() {
1272
1317
  if (typeof window > "u" || !window.localStorage)
1273
1318
  return null;
@@ -1278,14 +1323,14 @@ function Te() {
1278
1323
  return null;
1279
1324
  }
1280
1325
  }
1281
- function oa(e) {
1326
+ function la(e) {
1282
1327
  if (!(typeof window > "u" || !window.localStorage))
1283
1328
  try {
1284
1329
  localStorage.setItem(Xe, JSON.stringify(e));
1285
1330
  } catch {
1286
1331
  }
1287
1332
  }
1288
- async function la(e, t = {}) {
1333
+ async function ca(e, t = {}) {
1289
1334
  const { apiUrl: r = we } = t, a = await fetch(`${r}/v1/project/share`, {
1290
1335
  method: "POST",
1291
1336
  headers: {
@@ -1303,7 +1348,7 @@ async function la(e, t = {}) {
1303
1348
  }
1304
1349
  return a.json();
1305
1350
  }
1306
- async function ca(e, t = {}) {
1351
+ async function ua(e, t = {}) {
1307
1352
  const { apiUrl: r = we, getStoredAuthData: a = Te } = t, s = a();
1308
1353
  if (!(s != null && s.token))
1309
1354
  throw new Error("Authentication required. Please sign in first.");
@@ -1325,10 +1370,10 @@ async function ca(e, t = {}) {
1325
1370
  }
1326
1371
  return n.json();
1327
1372
  }
1328
- function ua(e = {}) {
1373
+ function da(e = {}) {
1329
1374
  const {
1330
- appUrl: t = mr,
1331
- setStoredAuthData: r = oa,
1375
+ appUrl: t = wr,
1376
+ setStoredAuthData: r = la,
1332
1377
  getStoredAuthData: a = Te
1333
1378
  } = e;
1334
1379
  return new Promise((s, n) => {
@@ -1359,7 +1404,7 @@ function ua(e = {}) {
1359
1404
  }, 500);
1360
1405
  });
1361
1406
  }
1362
- async function da(e = {}) {
1407
+ async function pa(e = {}) {
1363
1408
  const { apiUrl: t = we, language: r, getStoredAuthData: a = Te } = e, s = a();
1364
1409
  if (!(s != null && s.token))
1365
1410
  throw new Error("Authentication required. Please sign in first.");
@@ -1378,7 +1423,7 @@ async function da(e = {}) {
1378
1423
  }
1379
1424
  return o.json();
1380
1425
  }
1381
- async function pa(e, t, r = {}) {
1426
+ async function fa(e, t, r = {}) {
1382
1427
  const { apiUrl: a = we, getStoredAuthData: s = Te } = r, n = s();
1383
1428
  if (!(n != null && n.token))
1384
1429
  throw new Error("Authentication required. Please sign in first.");
@@ -1400,10 +1445,10 @@ async function pa(e, t, r = {}) {
1400
1445
  }
1401
1446
  return o.json();
1402
1447
  }
1403
- function fa(e = {}) {
1448
+ function ha(e = {}) {
1404
1449
  const {
1405
1450
  apiUrl: t = we,
1406
- appUrl: r = mr,
1451
+ appUrl: r = wr,
1407
1452
  storageKey: a = Xe,
1408
1453
  enabled: s = !0,
1409
1454
  allowAnonymous: n = !0,
@@ -1452,14 +1497,14 @@ function fa(e = {}) {
1452
1497
  clearStoredAuthData: l,
1453
1498
  signOut: l,
1454
1499
  // API methods
1455
- share: (d) => la(d, { apiUrl: t }),
1456
- save: (d) => ca(d, { apiUrl: t, getStoredAuthData: i }),
1457
- listArtifacts: (d) => da({ apiUrl: t, language: d, getStoredAuthData: i }),
1458
- updateArtifact: (d, p) => pa(d, p, { apiUrl: t, getStoredAuthData: i }),
1459
- openAuthPopup: () => ua({ appUrl: r, setStoredAuthData: u, getStoredAuthData: i })
1500
+ share: (d) => ca(d, { apiUrl: t }),
1501
+ save: (d) => ua(d, { apiUrl: t, getStoredAuthData: i }),
1502
+ listArtifacts: (d) => pa({ apiUrl: t, language: d, getStoredAuthData: i }),
1503
+ updateArtifact: (d, p) => fa(d, p, { apiUrl: t, getStoredAuthData: i }),
1504
+ openAuthPopup: () => da({ appUrl: r, setStoredAuthData: u, getStoredAuthData: i })
1460
1505
  };
1461
1506
  }
1462
- function ha(e = {}) {
1507
+ function ga(e = {}) {
1463
1508
  const t = e.modules || null;
1464
1509
  let r = e.theme || "dark";
1465
1510
  function a() {
@@ -1737,8 +1782,8 @@ function ha(e = {}) {
1737
1782
  } = t.language, {
1738
1783
  closeBrackets: y,
1739
1784
  closeBracketsKeymap: E,
1740
- autocompletion: R,
1741
- completionKeymap: C
1785
+ autocompletion: C,
1786
+ completionKeymap: R
1742
1787
  } = t.autocomplete, D = ((U = t.lezerHighlight) == null ? void 0 : U.tags) || ((ve = t.language) == null ? void 0 : ve.tags), _ = l(c.sdkTheme), q = _ ? s(f) : n(f), J = [
1743
1788
  m(),
1744
1789
  b(),
@@ -1755,7 +1800,7 @@ function ha(e = {}) {
1755
1800
  ...D ? [T(o(B, D, _))] : [],
1756
1801
  N(),
1757
1802
  y(),
1758
- R(),
1803
+ C(),
1759
1804
  A(),
1760
1805
  S(),
1761
1806
  L(),
@@ -1764,7 +1809,7 @@ function ha(e = {}) {
1764
1809
  ...$,
1765
1810
  ...z,
1766
1811
  ...O,
1767
- ...C,
1812
+ ...R,
1768
1813
  j
1769
1814
  ]),
1770
1815
  u(c.language),
@@ -1811,7 +1856,7 @@ function Ke() {
1811
1856
  return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
1812
1857
  }
1813
1858
  var ie = Ke();
1814
- function wr(e) {
1859
+ function br(e) {
1815
1860
  ie = e;
1816
1861
  }
1817
1862
  var me = { exec: () => null };
@@ -1822,14 +1867,14 @@ function H(e, t = "") {
1822
1867
  }, getRegex: () => new RegExp(r, t) };
1823
1868
  return a;
1824
1869
  }
1825
- var ga = (() => {
1870
+ var ma = (() => {
1826
1871
  try {
1827
1872
  return !!new RegExp("(?<=1)(?<!1)");
1828
1873
  } catch {
1829
1874
  return !1;
1830
1875
  }
1831
- })(), Z = { 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") }, ma = /^(?:[ \t]*(?:\n|$))+/, wa = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, ba = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, be = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, va = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Je = /(?:[*+-]|\d{1,9}[.)])/, br = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, vr = H(br).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(), ya = H(br).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]+)*)/, ka = /^[^\n]+/, Ye = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, xa = H(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Ye).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ma = H(/^( {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 = H("^ {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(), yr = H(Qe).replace("hr", be).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 = H(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", yr).getRegex(), tt = { blockquote: Aa, code: wa, def: xa, fences: ba, heading: va, hr: be, html: $a, lheading: vr, list: Ma, newline: ma, paragraph: yr, table: me, text: ka }, ft = H("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", be).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(), za = { ...tt, lheading: ya, table: ft, paragraph: H(Qe).replace("hr", be).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ft).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() }, Sa = { ...tt, html: H(`^ *(?: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: me, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: H(Qe).replace("hr", be).replace("heading", ` *#{1,6} *[^
1832
- ]`).replace("lheading", vr).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Ca = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ra = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, kr = /^( {2,}|\\)\n(?!\s*$)/, La = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Ee = /[\p{P}\p{S}]/u, rt = /[\s\p{P}\p{S}]/u, xr = /[^\s\p{P}\p{S}]/u, Ta = H(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, rt).getRegex(), Mr = /(?!~)[\p{P}\p{S}]/u, _a = /(?!~)[\s\p{P}\p{S}]/u, Ea = /(?:[^\s\p{P}\p{S}]|~)/u, Pa = H(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", ga ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), $r = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, ja = H($r, "u").replace(/punct/g, Ee).getRegex(), Ha = H($r, "u").replace(/punct/g, Mr).getRegex(), Ar = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Va = H(Ar, "gu").replace(/notPunctSpace/g, xr).replace(/punctSpace/g, rt).replace(/punct/g, Ee).getRegex(), Ia = H(Ar, "gu").replace(/notPunctSpace/g, Ea).replace(/punctSpace/g, _a).replace(/punct/g, Mr).getRegex(), Da = H("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, xr).replace(/punctSpace/g, rt).replace(/punct/g, Ee).getRegex(), qa = H(/\\(punct)/, "gu").replace(/punct/g, Ee).getRegex(), Za = H(/^<(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(), Oa = H(et).replace("(?:-->|$)", "-->").getRegex(), Ba = H("^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", Oa).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Ae = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Fa = H(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", Ae).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), zr = H(/^!?\[(label)\]\[(ref)\]/).replace("label", Ae).replace("ref", Ye).getRegex(), Sr = H(/^!?\[(ref)\](?:\[\])?/).replace("ref", Ye).getRegex(), Na = H("reflink|nolink(?!\\()", "g").replace("reflink", zr).replace("nolink", Sr).getRegex(), ht = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, at = { _backpedal: me, anyPunctuation: qa, autolink: Za, blockSkip: Pa, br: kr, code: Ra, del: me, emStrongLDelim: ja, emStrongRDelimAst: Va, emStrongRDelimUnd: Da, escape: Ca, link: Fa, nolink: Sr, punctuation: Ta, reflink: zr, reflinkSearch: Na, tag: Ba, text: La, url: me }, Ua = { ...at, link: H(/^!?\[(label)\]\((.*?)\)/).replace("label", Ae).getRegex(), reflink: H(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Ae).getRegex() }, Ve = { ...at, emStrongRDelimAst: Ia, emStrongLDelim: Ha, url: H(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ht).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: H(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ht).getRegex() }, Ga = { ...Ve, br: H(kr).replace("{2,}", "*").getRegex(), text: H(Ve.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, ke = { normal: tt, gfm: za, pedantic: Sa }, ue = { normal: at, gfm: Ve, breaks: Ga, pedantic: Ua }, Wa = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, gt = (e) => Wa[e];
1876
+ })(), Z = { 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") }, wa = /^(?:[ \t]*(?:\n|$))+/, ba = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, va = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, be = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, ya = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Je = /(?:[*+-]|\d{1,9}[.)])/, vr = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, yr = H(vr).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(), ka = H(vr).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]+)*)/, xa = /^[^\n]+/, Ye = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Ma = H(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Ye).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), $a = H(/^( {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]*?(?:-->|$))/, Aa = H("^ {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(), kr = H(Qe).replace("hr", be).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(), za = H(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", kr).getRegex(), tt = { blockquote: za, code: ba, def: Ma, fences: va, heading: ya, hr: be, html: Aa, lheading: yr, list: $a, newline: wa, paragraph: kr, table: me, text: xa }, ft = H("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", be).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: ka, table: ft, paragraph: H(Qe).replace("hr", be).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ft).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() }, Ca = { ...tt, html: H(`^ *(?: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: me, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: H(Qe).replace("hr", be).replace("heading", ` *#{1,6} *[^
1877
+ ]`).replace("lheading", yr).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Ra = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, La = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, xr = /^( {2,}|\\)\n(?!\s*$)/, Ta = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Ee = /[\p{P}\p{S}]/u, rt = /[\s\p{P}\p{S}]/u, Mr = /[^\s\p{P}\p{S}]/u, _a = H(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, rt).getRegex(), $r = /(?!~)[\p{P}\p{S}]/u, Ea = /(?!~)[\s\p{P}\p{S}]/u, Pa = /(?:[^\s\p{P}\p{S}]|~)/u, ja = H(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", ma ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Ar = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Ha = H(Ar, "u").replace(/punct/g, Ee).getRegex(), Va = H(Ar, "u").replace(/punct/g, $r).getRegex(), zr = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ia = H(zr, "gu").replace(/notPunctSpace/g, Mr).replace(/punctSpace/g, rt).replace(/punct/g, Ee).getRegex(), Da = H(zr, "gu").replace(/notPunctSpace/g, Pa).replace(/punctSpace/g, Ea).replace(/punct/g, $r).getRegex(), qa = H("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, Mr).replace(/punctSpace/g, rt).replace(/punct/g, Ee).getRegex(), Za = H(/\\(punct)/, "gu").replace(/punct/g, Ee).getRegex(), Oa = H(/^<(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 = H(et).replace("(?:-->|$)", "-->").getRegex(), Fa = H("^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]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Na = H(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", Ae).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Sr = H(/^!?\[(label)\]\[(ref)\]/).replace("label", Ae).replace("ref", Ye).getRegex(), Cr = H(/^!?\[(ref)\](?:\[\])?/).replace("ref", Ye).getRegex(), Ua = H("reflink|nolink(?!\\()", "g").replace("reflink", Sr).replace("nolink", Cr).getRegex(), ht = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, at = { _backpedal: me, anyPunctuation: Za, autolink: Oa, blockSkip: ja, br: xr, code: La, del: me, emStrongLDelim: Ha, emStrongRDelimAst: Ia, emStrongRDelimUnd: qa, escape: Ra, link: Na, nolink: Cr, punctuation: _a, reflink: Sr, reflinkSearch: Ua, tag: Fa, text: Ta, url: me }, Ga = { ...at, link: H(/^!?\[(label)\]\((.*?)\)/).replace("label", Ae).getRegex(), reflink: H(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Ae).getRegex() }, Ve = { ...at, emStrongRDelimAst: Da, emStrongLDelim: Va, url: H(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ht).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: H(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ht).getRegex() }, Wa = { ...Ve, br: H(xr).replace("{2,}", "*").getRegex(), text: H(Ve.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, ke = { normal: tt, gfm: Sa, pedantic: Ca }, ue = { normal: at, gfm: Ve, breaks: Wa, pedantic: Ga }, Xa = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, gt = (e) => Xa[e];
1833
1878
  function Q(e, t) {
1834
1879
  if (t) {
1835
1880
  if (Z.escapeTest.test(e)) return e.replace(Z.escapeReplace, gt);
@@ -1864,7 +1909,7 @@ function de(e, t, r) {
1864
1909
  s++;
1865
1910
  return e.slice(0, a - s);
1866
1911
  }
1867
- function Xa(e, t) {
1912
+ function Ka(e, t) {
1868
1913
  if (e.indexOf(t[1]) === -1) return -1;
1869
1914
  let r = 0;
1870
1915
  for (let a = 0; a < e.length; a++) if (e[a] === "\\") a++;
@@ -1878,7 +1923,7 @@ function bt(e, t, r, a, s) {
1878
1923
  let u = { type: e[0].charAt(0) === "!" ? "image" : "link", raw: r, href: n, title: o, text: i, tokens: a.inlineTokens(i) };
1879
1924
  return a.state.inLink = !1, u;
1880
1925
  }
1881
- function Ka(e, t, r) {
1926
+ function Ja(e, t, r) {
1882
1927
  let a = e.match(r.other.indentCodeCompensation);
1883
1928
  if (a === null) return t;
1884
1929
  let s = a[1];
@@ -1913,7 +1958,7 @@ var ze = class {
1913
1958
  fences(e) {
1914
1959
  let t = this.rules.block.fences.exec(e);
1915
1960
  if (t) {
1916
- let r = t[0], a = Ka(r, t[3] || "", this.rules);
1961
+ let r = t[0], a = Ja(r, t[3] || "", this.rules);
1917
1962
  return { type: "code", raw: r, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: a };
1918
1963
  }
1919
1964
  }
@@ -2095,7 +2140,7 @@ ${d}` : d;
2095
2140
  let n = de(r.slice(0, -1), "\\");
2096
2141
  if ((r.length - n.length) % 2 === 0) return;
2097
2142
  } else {
2098
- let n = Xa(t[2], "()");
2143
+ let n = Ka(t[2], "()");
2099
2144
  if (n === -2) return;
2100
2145
  if (n > -1) {
2101
2146
  let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + n;
@@ -2724,7 +2769,7 @@ ${e}</tr>
2724
2769
  provideParser() {
2725
2770
  return this.block ? W.parse : W.parseInline;
2726
2771
  }
2727
- }, I(Me, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), I(Me, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), Me), Ja = class {
2772
+ }, I(Me, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), I(Me, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), Me), Qa = class {
2728
2773
  constructor(...e) {
2729
2774
  I(this, "defaults", Ke());
2730
2775
  I(this, "options", this.setOptions);
@@ -2885,17 +2930,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
2885
2930
  throw r;
2886
2931
  };
2887
2932
  }
2888
- }, se = new Ja();
2933
+ }, se = new Qa();
2889
2934
  function V(e, t) {
2890
2935
  return se.parse(e, t);
2891
2936
  }
2892
2937
  V.options = V.setOptions = function(e) {
2893
- return se.setOptions(e), V.defaults = se.defaults, wr(V.defaults), V;
2938
+ return se.setOptions(e), V.defaults = se.defaults, br(V.defaults), V;
2894
2939
  };
2895
2940
  V.getDefaults = Ke;
2896
2941
  V.defaults = ie;
2897
2942
  V.use = function(...e) {
2898
- return se.use(...e), V.defaults = se.defaults, wr(V.defaults), V;
2943
+ return se.use(...e), V.defaults = se.defaults, br(V.defaults), V;
2899
2944
  };
2900
2945
  V.walkTokens = function(e, t) {
2901
2946
  return se.walkTokens(e, t);
@@ -2917,8 +2962,8 @@ V.walkTokens;
2917
2962
  V.parseInline;
2918
2963
  W.parse;
2919
2964
  G.lex;
2920
- const Qa = ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp", "ico", "avif"];
2921
- function Ya(e) {
2965
+ const Ya = ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp", "ico", "avif"];
2966
+ function es(e) {
2922
2967
  const t = [];
2923
2968
  e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (n) => {
2924
2969
  const o = `__IMG_PROTECTED_${t.length}__`;
@@ -2933,13 +2978,19 @@ function Ya(e) {
2933
2978
  const o = `__IMG_PROTECTED_${t.length}__`;
2934
2979
  return t.push(n), o;
2935
2980
  });
2936
- const r = Qa.join("|"), a = new RegExp(
2981
+ const r = Ya.join("|"), a = new RegExp(
2937
2982
  `<a[^>]*href="(https?:\\/\\/[^"]+\\.(?:${r})(?:\\?[^"]*)?)"[^>]*>([^<]*)<\\/a>`,
2938
2983
  "gi"
2939
2984
  );
2940
2985
  e = e.replace(a, (n, o, i) => {
2941
- const u = i && !i.match(/^(view|see|open|click|image|photo|picture)$/i) ? i : "";
2986
+ const u = i && !i.match(/^(view|see|open|click|image|photo|picture)$/i) && !i.match(/^https?:\/\//i) ? i : "";
2942
2987
  return qe(o, u, u);
2988
+ }), e = e.replace(/<img[^>]*>/gi, (n) => {
2989
+ const o = `__IMG_PROTECTED_${t.length}__`;
2990
+ return t.push(n), o;
2991
+ }), e = e.replace(/<div class="artifactuse-image-container">[\s\S]*?<\/div>\s*<\/div>/gi, (n) => {
2992
+ const o = `__IMG_PROTECTED_${t.length}__`;
2993
+ return t.push(n), o;
2943
2994
  });
2944
2995
  const s = new RegExp(
2945
2996
  `(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(?:${r})(\\?[^\\s<>"]*)?)(?!["'])`,
@@ -2957,7 +3008,7 @@ function qe(e, t, r) {
2957
3008
  let n = '<div class="artifactuse-image-container">';
2958
3009
  return n += `<img src="${e}" alt="${r || ""}" class="${s}" data-lightbox="true" data-caption="${a}" loading="lazy" />`, a && (n += `<div class="artifactuse-image-caption">${a}</div>`), n += "</div>", n;
2959
3010
  }
2960
- function es(e) {
3011
+ function ts(e) {
2961
3012
  const t = e.split(`
2962
3013
  `), r = [];
2963
3014
  let a = [], s = !1;
@@ -2997,24 +3048,24 @@ ${e.map((r) => r.replace("artifactuse-image-container", "artifactuse-gallery-ite
2997
3048
  `)}
2998
3049
  </div>`;
2999
3050
  }
3000
- const Cr = ["mp4", "webm", "mov", "avi", "mkv", "flv", "wmv", "m4v"];
3001
- function ts(e) {
3051
+ const Rr = ["mp4", "webm", "mov", "avi", "mkv", "flv", "wmv", "m4v"];
3052
+ function rs(e) {
3002
3053
  if (!e) return !1;
3003
- const t = Cr.join("|");
3054
+ const t = Rr.join("|");
3004
3055
  return !!(new RegExp(`\\.(${t})(\\?.*)?$`, "i").test(e) || /(?:youtube\.com\/watch\?v=|youtu\.be\/)[a-zA-Z0-9_-]+/.test(e) || /vimeo\.com\/\d+/.test(e) || /loom\.com\/share\/[a-zA-Z0-9]+/.test(e) || /dailymotion\.com\/video\/[a-zA-Z0-9]+/.test(e));
3005
3056
  }
3006
- function rs(e) {
3057
+ function as(e) {
3007
3058
  if (!e) return null;
3008
3059
  let t = e.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)/);
3009
3060
  if (t) return { type: "youtube", id: t[1] };
3010
3061
  if (t = e.match(/vimeo\.com\/(\d+)/), t) return { type: "vimeo", id: t[1] };
3011
3062
  if (t = e.match(/loom\.com\/share\/([a-zA-Z0-9]+)/), t) return { type: "loom", id: t[1] };
3012
3063
  if (t = e.match(/dailymotion\.com\/video\/([a-zA-Z0-9]+)/), t) return { type: "dailymotion", id: t[1] };
3013
- const r = Cr.join("|");
3064
+ const r = Rr.join("|");
3014
3065
  return new RegExp(`\\.(${r})(\\?.*)?$`, "i").test(e) ? { type: "direct", id: e } : null;
3015
3066
  }
3016
- function as(e) {
3017
- const t = rs(e);
3067
+ function ss(e) {
3068
+ const t = as(e);
3018
3069
  if (!t) return `<a href="${e}" target="_blank" rel="noopener noreferrer">${e}</a>`;
3019
3070
  switch (t.type) {
3020
3071
  case "youtube":
@@ -3031,7 +3082,7 @@ function as(e) {
3031
3082
  return `<a href="${e}" target="_blank" rel="noopener noreferrer">${e}</a>`;
3032
3083
  }
3033
3084
  }
3034
- function ss(e) {
3085
+ function ns(e) {
3035
3086
  const t = [];
3036
3087
  e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (c) => {
3037
3088
  const h = `__PROTECTED_${t.length}__`;
@@ -3044,7 +3095,7 @@ function ss(e) {
3044
3095
  return t.push(c), h;
3045
3096
  });
3046
3097
  const r = /\[([^\]]+)\]\((https:\/\/www\.pexels\.com\/video\/[^)]+)\)\s*(?:<\/p>)?\s*(?:<p>)?\s*(?:Preview image:\s*)?!\[([^\]]*)\]\((https:\/\/images\.pexels\.com\/videos\/[^)]+)\)/gi;
3047
- e = e.replace(r, (c, h, f, g, m) => is(h, f, m, g));
3098
+ e = e.replace(r, (c, h, f, g, m) => os(h, f, m, g));
3048
3099
  const a = /<a[^>]*href="(https?:\/\/[^"]+\.(mp4|webm|mov|avi|mkv|flv|wmv|m4v)(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
3049
3100
  e = e.replace(a, (c, h) => Ze(h));
3050
3101
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(mp4|webm|mov|avi|mkv|flv|wmv|m4v)(\\?[^\\s<>"]*)?)(?!["'])`, "gi");
@@ -3069,7 +3120,7 @@ function ss(e) {
3069
3120
  e = e.replace(`__PROTECTED_${c}__`, t[c]);
3070
3121
  return e;
3071
3122
  }
3072
- function ns(e) {
3123
+ function is(e) {
3073
3124
  const t = e.split("?")[0].split(".").pop().toLowerCase();
3074
3125
  return {
3075
3126
  mp4: "video/mp4",
@@ -3083,10 +3134,10 @@ function ns(e) {
3083
3134
  }[t] || "video/mp4";
3084
3135
  }
3085
3136
  function Ze(e) {
3086
- const t = ns(e);
3137
+ const t = is(e);
3087
3138
  return `<div class="artifactuse-video-wrapper"><video controls preload="metadata" class="artifactuse-video"><source src="${e}" type="${t}">Your browser does not support the video tag.</video></div>`;
3088
3139
  }
3089
- function is(e, t, r, a) {
3140
+ function os(e, t, r, a) {
3090
3141
  return `<div class="artifactuse-video-preview-container"><div class="artifactuse-video-preview-wrapper" data-video-url="${t}"><img src="${r}" alt="${a}" class="artifactuse-video-preview-image" loading="lazy" /><div class="artifactuse-video-play-overlay"><svg class="artifactuse-play-icon" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg></div><div class="artifactuse-video-info-overlay"><h4 class="artifactuse-video-title">${e}</h4><p class="artifactuse-video-alt">${a}</p></div></div><div class="artifactuse-video-actions"><a href="${t}" target="_blank" rel="noopener" class="artifactuse-video-link">Watch on Pexels</a></div></div>`;
3091
3142
  }
3092
3143
  function Oe(e) {
@@ -3105,7 +3156,7 @@ function Ne(e) {
3105
3156
  const t = `https://www.dailymotion.com/embed/video/${e}?autoplay=1`, r = `https://www.dailymotion.com/thumbnail/video/${e}`, a = `this.parentElement.innerHTML='<iframe src=\\'${t}\\' frameborder=\\'0\\' allow=\\'autoplay; fullscreen; picture-in-picture\\' allowfullscreen class=\\'artifactuse-video-iframe\\'></iframe>'`;
3106
3157
  return `<div class="artifactuse-video-wrapper artifactuse-video-lazy" data-video-type="dailymotion" data-video-id="${e}"><button type="button" class="artifactuse-video-facade" aria-label="Play Dailymotion video" onclick="${a}"><img src="${r}" alt="Dailymotion video thumbnail" class="artifactuse-video-thumbnail" loading="lazy" onerror="this.style.display='none'" /><div class="artifactuse-video-play-button artifactuse-dailymotion-play"><svg viewBox="0 0 64 64" width="64" height="64"><circle cx="32" cy="32" r="31" fill="#0066dc"/><path d="M26 20 L26 44 L46 32 Z" fill="#fff"/></svg></div></button></div>`;
3107
3158
  }
3108
- function os(e) {
3159
+ function ls(e) {
3109
3160
  let t = e.replace(/<\/p>/g, "").replace(/<p>/g, "").replace(/<br\s*\/?>/g, "").replace(/<strong>.*?<\/strong>/g, "").replace(/<em>.*?<\/em>/g, "").replace(/<b>.*?<\/b>/g, "").replace(/<i>.*?<\/i>/g, "").replace(/\n/g, "").replace(/\s+/g, "").trim();
3110
3161
  return /<(?!\/)[^>]+>/.test(t) ? !1 : t.length < 200;
3111
3162
  }
@@ -3123,7 +3174,7 @@ function je(e) {
3123
3174
  }
3124
3175
  return "";
3125
3176
  }
3126
- function ls(e) {
3177
+ function cs(e) {
3127
3178
  const t = /<div class="artifactuse-video-(wrapper|preview-container)/g, r = [];
3128
3179
  let a;
3129
3180
  for (; (a = t.exec(e)) !== null; ) {
@@ -3151,7 +3202,7 @@ function ls(e) {
3151
3202
  }];
3152
3203
  for (let u = 1; u < r.length; u++) {
3153
3204
  const l = r[u - 1], d = r[u], p = e.substring(l.end, d.start);
3154
- os(p) ? n.push({
3205
+ ls(p) ? n.push({
3155
3206
  ...d,
3156
3207
  caption: je(p)
3157
3208
  }) : (s.push([...n]), n = [{
@@ -3167,7 +3218,7 @@ function ls(e) {
3167
3218
  let d = l.start;
3168
3219
  const w = e.substring(i, l.start).match(/<p>((?:[^<]|<(?!\/p>))*?)(?:<br\s*\/?>)?\s*<\/p>\s*$/);
3169
3220
  if (w && (d = l.start - w[0].length, u[0].caption = w[1].trim()), o += e.substring(i, d), u.length >= 2)
3170
- o += cs(u);
3221
+ o += us(u);
3171
3222
  else {
3172
3223
  const c = u[0];
3173
3224
  c.caption ? o += `<div class="artifactuse-video-container">${c.html}<div class="artifactuse-video-caption">${c.caption}</div></div>` : o += c.html;
@@ -3176,7 +3227,7 @@ function ls(e) {
3176
3227
  }
3177
3228
  return o += e.substring(i), o = o.replace(/<p>\s*<\/p>/g, ""), o;
3178
3229
  }
3179
- function cs(e) {
3230
+ function us(e) {
3180
3231
  return `<div class="artifactuse-video-gallery">
3181
3232
  ${e.map(({ html: r, caption: a }) => {
3182
3233
  let s = r.replace(
@@ -3191,10 +3242,10 @@ ${e.map(({ html: r, caption: a }) => {
3191
3242
  `)}
3192
3243
  </div>`;
3193
3244
  }
3194
- function us() {
3245
+ function ds() {
3195
3246
  return `audio-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
3196
3247
  }
3197
- function ds(e, t = {}) {
3248
+ function ps(e, t = {}) {
3198
3249
  const r = t.theme || "dark", a = [];
3199
3250
  e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (A) => {
3200
3251
  const S = `__PROTECTED_${a.length}__`;
@@ -3246,7 +3297,7 @@ function ds(e, t = {}) {
3246
3297
  e = e.replace(`__PROTECTED_${A}__`, a[A]);
3247
3298
  return e;
3248
3299
  }
3249
- function ps(e) {
3300
+ function fs(e) {
3250
3301
  const t = e.match(/\.([a-zA-Z0-9]+)(?:\?|$)/);
3251
3302
  return t ? t[1].toUpperCase() : "AUDIO";
3252
3303
  }
@@ -3254,7 +3305,7 @@ function pe(e) {
3254
3305
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
3255
3306
  }
3256
3307
  function yt(e) {
3257
- const t = us(), r = decodeURIComponent(e.split("/").pop().split("?")[0]), a = ps(e);
3308
+ const t = ds(), r = decodeURIComponent(e.split("/").pop().split("?")[0]), a = fs(e);
3258
3309
  return `
3259
3310
  <div class="artifactuse-audio-player" data-player-id="${t}" data-audio-src="${pe(e)}">
3260
3311
  <!-- Hidden audio element -->
@@ -3395,12 +3446,12 @@ function xt(e, t, r) {
3395
3446
  `;
3396
3447
  }
3397
3448
  const ne = /* @__PURE__ */ new Map(), He = [0.5, 0.75, 1, 1.25, 1.5, 2];
3398
- function fs(e = document) {
3449
+ function hs(e = document) {
3399
3450
  e.querySelectorAll(".artifactuse-audio-player:not([data-initialized])").forEach((r) => {
3400
- hs(r);
3451
+ gs(r);
3401
3452
  });
3402
3453
  }
3403
- function hs(e) {
3454
+ function gs(e) {
3404
3455
  const t = e.dataset.playerId, r = e.dataset.audioSrc;
3405
3456
  if (!t || !r) return;
3406
3457
  const a = e.querySelector(".artifactuse-audio-element"), s = e.querySelector(".artifactuse-audio-play-btn"), n = e.querySelector(".artifactuse-audio-icon-play"), o = e.querySelector(".artifactuse-audio-icon-pause"), i = e.querySelector(".artifactuse-audio-current"), u = e.querySelector(".artifactuse-audio-duration"), l = e.querySelector(".artifactuse-audio-waveform"), d = e.querySelector(".artifactuse-audio-waveform-canvas"), p = e.querySelector(".artifactuse-audio-waveform-progress"), w = e.querySelector(".artifactuse-audio-waveform-hover"), c = e.querySelector(".artifactuse-audio-mute-btn"), h = e.querySelector(".artifactuse-audio-icon-volume"), f = e.querySelector(".artifactuse-audio-icon-muted"), g = e.querySelector(".artifactuse-audio-volume-slider"), m = e.querySelector(".artifactuse-audio-speed-btn");
@@ -3414,7 +3465,7 @@ function hs(e) {
3414
3465
  currentTime: 0,
3415
3466
  waveformData: null
3416
3467
  };
3417
- ne.set(t, { playerEl: e, audio: a, state: b }), gs(d, t), s == null || s.addEventListener("click", () => {
3468
+ ne.set(t, { playerEl: e, audio: a, state: b }), ms(d, t), s == null || s.addEventListener("click", () => {
3418
3469
  b.isPlaying ? St(t) : zt(t);
3419
3470
  }), a.addEventListener("loadedmetadata", () => {
3420
3471
  b.duration = a.duration, u.textContent = At(a.duration);
@@ -3425,7 +3476,7 @@ function hs(e) {
3425
3476
  }), a.addEventListener("ended", () => {
3426
3477
  b.isPlaying = !1, n.style.display = "", o.style.display = "none", e.classList.remove("is-playing"), p.style.width = "0%";
3427
3478
  }), a.addEventListener("play", () => {
3428
- b.isPlaying = !0, n.style.display = "none", o.style.display = "", e.classList.add("is-playing"), ms(t);
3479
+ b.isPlaying = !0, n.style.display = "none", o.style.display = "", e.classList.add("is-playing"), ws(t);
3429
3480
  }), a.addEventListener("pause", () => {
3430
3481
  b.isPlaying = !1, n.style.display = "", o.style.display = "none", e.classList.remove("is-playing");
3431
3482
  }), l == null || l.addEventListener("click", (v) => {
@@ -3468,7 +3519,7 @@ function hs(e) {
3468
3519
  }
3469
3520
  }), e.setAttribute("data-initialized", "true"), e.setAttribute("tabindex", "0");
3470
3521
  }
3471
- function gs(e, t) {
3522
+ function ms(e, t) {
3472
3523
  if (!e) return;
3473
3524
  const r = e.getContext("2d"), a = window.devicePixelRatio || 1, s = e.parentElement.getBoundingClientRect();
3474
3525
  e.width = s.width * a, e.height = s.height * a, e.style.width = `${s.width}px`, e.style.height = `${s.height}px`, r.scale(a, a);
@@ -3518,21 +3569,21 @@ function St(e) {
3518
3569
  const t = ne.get(e);
3519
3570
  t && t.audio.pause();
3520
3571
  }
3521
- function ms(e) {
3572
+ function ws(e) {
3522
3573
  ne.forEach((t, r) => {
3523
3574
  r !== e && t.state.isPlaying && t.audio.pause();
3524
3575
  });
3525
3576
  }
3526
- function ws(e) {
3577
+ function bs(e) {
3527
3578
  const t = ne.get(e);
3528
3579
  t && (t.audio.pause(), t.audio.src = "", ne.delete(e));
3529
3580
  }
3530
- function bs() {
3581
+ function vs() {
3531
3582
  ne.forEach((e, t) => {
3532
- ws(t);
3583
+ bs(t);
3533
3584
  });
3534
3585
  }
3535
- function vs(e) {
3586
+ function ys(e) {
3536
3587
  const t = [];
3537
3588
  e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (g) => {
3538
3589
  const m = `__PROTECTED_MAP_${t.length}__`;
@@ -3676,7 +3727,7 @@ function Rt(e, t, r = 15) {
3676
3727
  </div>
3677
3728
  `;
3678
3729
  }
3679
- function ys(e, t = {}) {
3730
+ function ks(e, t = {}) {
3680
3731
  const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/(?:www\.)?(?:twitter\.com|x\.com)\/([a-zA-Z0-9_]+)\/status\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3681
3732
  e = e.replace(a, (v, x, M, A) => Lt(M, A, r));
3682
3733
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?(?:twitter\\.com|x\\.com)\\/([a-zA-Z0-9_]+)\\/status\\/(\\d+))(?!["'])`, "gi");
@@ -3818,7 +3869,7 @@ function Vt(e) {
3818
3869
  </div>
3819
3870
  `;
3820
3871
  }
3821
- function ks(e) {
3872
+ function xs(e) {
3822
3873
  const t = /<a[^>]*href="(https?:\/\/[^"]+\.pdf(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
3823
3874
  e = e.replace(t, (a, s) => It(s));
3824
3875
  const r = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.pdf(?:\\?[^\\s<>"]*)?)(?!["'])`, "gi");
@@ -3848,7 +3899,7 @@ function It(e) {
3848
3899
  </div>
3849
3900
  `;
3850
3901
  }
3851
- function xs(e) {
3902
+ function Ms(e) {
3852
3903
  const t = /<a[^>]*href="(https?:\/\/docs\.google\.com\/document\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3853
3904
  e = e.replace(t, (l, d, p) => oe(p, "document"));
3854
3905
  const r = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/document\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
@@ -3908,7 +3959,7 @@ function Dt(e) {
3908
3959
  </div>
3909
3960
  `;
3910
3961
  }
3911
- function Ms(e) {
3962
+ function $s(e) {
3912
3963
  const t = /<a[^>]*href="(https?:\/\/[^"]+\.(docx?|xlsx?|pptx?)(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
3913
3964
  e = e.replace(t, (a, s) => qt(s));
3914
3965
  const r = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(docx?|xlsx?|pptx?)(?:\\?[^\\s<>"]*)?)(?!["'])`, "gi");
@@ -3940,10 +3991,10 @@ function qt(e) {
3940
3991
  </div>
3941
3992
  `;
3942
3993
  }
3943
- function $s(e) {
3994
+ function As(e) {
3944
3995
  return `${e}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
3945
3996
  }
3946
- function As(e, t = {}) {
3997
+ function zs(e, t = {}) {
3947
3998
  const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/gist\.github\.com\/([a-zA-Z0-9_-]+)\/([a-f0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3948
3999
  e = e.replace(a, (f, g, m, b) => Zt(m, b));
3949
4000
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/gist\\.github\\.com\\/([a-zA-Z0-9_-]+)\\/([a-f0-9]+))(?!["'])`, "gi");
@@ -3971,7 +4022,7 @@ function As(e, t = {}) {
3971
4022
  }
3972
4023
  function Zt(e, t) {
3973
4024
  return `
3974
- <div class="artifactuse-gist-wrapper" id="${$s("gist")}">
4025
+ <div class="artifactuse-gist-wrapper" id="${As("gist")}">
3975
4026
  <script src="https://gist.github.com/${e}/${t}.js"><\/script>
3976
4027
  </div>
3977
4028
  `;
@@ -4046,7 +4097,7 @@ function Ut(e, t, r = "dark") {
4046
4097
  </div>
4047
4098
  `;
4048
4099
  }
4049
- function zs(e) {
4100
+ function Ss(e) {
4050
4101
  const t = /<a[^>]*href="(https?:\/\/public\.tableau\.com\/(?:views|profile)\/([^\s"]+))"[^>]*>[^<]*<\/a>/gi;
4051
4102
  e = e.replace(t, (l, d, p) => Gt(p));
4052
4103
  const r = new RegExp(`(?<!["'=])(https?:\\/\\/public\\.tableau\\.com\\/(?:views|profile)\\/([^\\s<>"]+))(?!["'])`, "gi");
@@ -4113,7 +4164,7 @@ function Kt(e) {
4113
4164
  </div>
4114
4165
  `;
4115
4166
  }
4116
- function Ss(e, t = {}) {
4167
+ function Cs(e, t = {}) {
4117
4168
  const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/sketchfab\.com\/(?:3d-)?models\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4118
4169
  e = e.replace(a, (f, g, m) => Jt(m, r));
4119
4170
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/sketchfab\\.com\\/(?:3d-)?models\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
@@ -4223,7 +4274,7 @@ function rr(e, t) {
4223
4274
  </div>
4224
4275
  `;
4225
4276
  }
4226
- function Cs(e, t = {}) {
4277
+ function Rs(e, t = {}) {
4227
4278
  const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/(?:[a-zA-Z0-9-]+\.)?typeform\.com\/to\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4228
4279
  e = e.replace(a, (m, b, v) => ar(v));
4229
4280
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:[a-zA-Z0-9-]+\\.)?typeform\\.com\\/to\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
@@ -4333,33 +4384,33 @@ function cr(e) {
4333
4384
  `;
4334
4385
  }
4335
4386
  let te = null, Ce = !1, nt = !1;
4336
- function Rr(e) {
4387
+ function Lr(e) {
4337
4388
  const t = /<pre><code class="language-mermaid">([\s\S]*?)<\/code><\/pre>/gi;
4338
4389
  return e = e.replace(t, (r, a) => {
4339
- const s = Rs(a).trim();
4340
- return Ls(s);
4390
+ const s = Ls(a).trim();
4391
+ return Ts(s);
4341
4392
  }), e;
4342
4393
  }
4343
- function Rs(e) {
4394
+ function Ls(e) {
4344
4395
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&nbsp;/g, " ");
4345
4396
  }
4346
- function Ls(e) {
4347
- const t = Lr(e);
4397
+ function Ts(e) {
4398
+ const t = Tr(e);
4348
4399
  return `
4349
4400
  <div class="artifactuse-mermaid-container" data-mermaid-id="${`mermaid-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`}" data-mermaid-diagram="${t}">
4350
4401
  <div class="artifactuse-mermaid-loading">Loading diagram...</div>
4351
4402
  </div>
4352
4403
  `;
4353
4404
  }
4354
- function Lr(e) {
4405
+ function Tr(e) {
4355
4406
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
4356
4407
  }
4357
- function Tr(e) {
4408
+ function _r(e) {
4358
4409
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&amp;/g, "&");
4359
4410
  }
4360
- function _r(e = {}) {
4361
- return typeof mermaid > "u" ? Ce ? (console.warn("Mermaid loading previously failed. Diagram rendering disabled."), Promise.resolve()) : (console.debug("Mermaid library not loaded. Attempting to load..."), _s().then(() => (console.log("Mermaid loaded, rendering diagrams..."), ur(e), Re())).catch((t) => {
4362
- console.error("Failed to load Mermaid library:", t), Ce = !0, Ts();
4411
+ function Er(e = {}) {
4412
+ return typeof mermaid > "u" ? Ce ? (console.warn("Mermaid loading previously failed. Diagram rendering disabled."), Promise.resolve()) : (console.debug("Mermaid library not loaded. Attempting to load..."), Es().then(() => (console.log("Mermaid loaded, rendering diagrams..."), ur(e), Re())).catch((t) => {
4413
+ console.error("Failed to load Mermaid library:", t), Ce = !0, _s();
4363
4414
  })) : (nt || ur(e), Re());
4364
4415
  }
4365
4416
  function ur(e = {}) {
@@ -4400,7 +4451,7 @@ async function Re() {
4400
4451
  const e = document.querySelectorAll(".artifactuse-mermaid-container");
4401
4452
  for (const t of e) {
4402
4453
  if (t.dataset.rendered === "true") continue;
4403
- const r = Tr(t.dataset.mermaidDiagram), a = t.dataset.mermaidId;
4454
+ const r = _r(t.dataset.mermaidDiagram), a = t.dataset.mermaidId;
4404
4455
  try {
4405
4456
  if (await mermaid.parse(r)) {
4406
4457
  const { svg: n } = await mermaid.render(a, r);
@@ -4420,10 +4471,10 @@ async function Re() {
4420
4471
  }
4421
4472
  }
4422
4473
  }
4423
- function Ts() {
4474
+ function _s() {
4424
4475
  document.querySelectorAll(".artifactuse-mermaid-container").forEach((e) => {
4425
4476
  if (e.dataset.rendered === "true") return;
4426
- const t = Tr(e.dataset.mermaidDiagram);
4477
+ const t = _r(e.dataset.mermaidDiagram);
4427
4478
  e.innerHTML = `
4428
4479
  <div class="artifactuse-mermaid-fallback">
4429
4480
  <div class="artifactuse-mermaid-fallback-title">Mermaid Diagram</div>
@@ -4435,7 +4486,7 @@ function Ts() {
4435
4486
  function Ge(e) {
4436
4487
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4437
4488
  }
4438
- function _s() {
4489
+ function Es() {
4439
4490
  return te || (typeof mermaid < "u" ? Promise.resolve() : (te = new Promise((e, t) => {
4440
4491
  const r = setTimeout(() => {
4441
4492
  te = null, t(new Error("Mermaid loading timed out after 15 seconds"));
@@ -4447,41 +4498,41 @@ function _s() {
4447
4498
  }, document.head.appendChild(a);
4448
4499
  }), te));
4449
4500
  }
4450
- function nn() {
4501
+ function ln() {
4451
4502
  te = null, Ce = !1, nt = !1;
4452
4503
  }
4453
- function on() {
4504
+ function cn() {
4454
4505
  return typeof mermaid < "u";
4455
4506
  }
4456
- function ln() {
4507
+ function un() {
4457
4508
  return Ce;
4458
4509
  }
4459
- function cn(e, t = {}) {
4510
+ function dn(e, t = {}) {
4460
4511
  if (!e) return Promise.resolve();
4461
4512
  let r = e.innerHTML;
4462
- return r = Rr(r), e.innerHTML = r, _r(t);
4513
+ return r = Lr(r), e.innerHTML = r, Er(t);
4463
4514
  }
4464
- async function un(e) {
4515
+ async function pn(e) {
4465
4516
  const t = document.querySelector(`[data-mermaid-id="${e}"]`);
4466
4517
  t && (t.dataset.rendered = "false", t.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await Re());
4467
4518
  }
4468
- async function dn(e, t) {
4519
+ async function fn(e, t) {
4469
4520
  const r = document.querySelector(`[data-mermaid-id="${e}"]`);
4470
- r && (r.dataset.mermaidDiagram = Lr(t), r.dataset.rendered = "false", r.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await Re());
4521
+ r && (r.dataset.mermaidDiagram = Tr(t), r.dataset.rendered = "false", r.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await Re());
4471
4522
  }
4472
- function Es(e) {
4523
+ function Ps(e) {
4473
4524
  const t = /<table([^>]*)>([\s\S]*?)<\/table>/gi;
4474
4525
  let r = 0;
4475
4526
  return e = e.replace(t, (a, s, n) => {
4476
4527
  const o = `artifactuse-table-${r++}`;
4477
- return Ps(o, s, n);
4528
+ return js(o, s, n);
4478
4529
  }), e;
4479
4530
  }
4480
- function Ps(e, t, r) {
4531
+ function js(e, t, r) {
4481
4532
  const a = /<thead/i.test(r) || /<th/i.test(r), s = (r.match(/<tr/gi) || []).length;
4482
4533
  if (!a || s < 3)
4483
4534
  return `<table${t} class="artifactuse-table">${r}</table>`;
4484
- const n = js(r);
4535
+ const n = Hs(r);
4485
4536
  return `
4486
4537
  <div class="artifactuse-table-container" data-table-id="${e}">
4487
4538
  <div class="artifactuse-table-controls">
@@ -4524,7 +4575,7 @@ function Ps(e, t, r) {
4524
4575
  </div>
4525
4576
  `;
4526
4577
  }
4527
- function js(e) {
4578
+ function Hs(e) {
4528
4579
  let t = 0;
4529
4580
  return e = e.replace(/<th(\s[^>]*)?>([\s\S]*?)<\/th>/gi, (r, a, s) => {
4530
4581
  const n = t++;
@@ -4543,7 +4594,7 @@ function js(e) {
4543
4594
  `;
4544
4595
  }), e;
4545
4596
  }
4546
- function Hs(e) {
4597
+ function Vs(e) {
4547
4598
  const t = e.querySelectorAll("tr"), r = [];
4548
4599
  return t.forEach((a) => {
4549
4600
  const s = a.querySelectorAll("th, td"), n = [];
@@ -4555,11 +4606,11 @@ function Hs(e) {
4555
4606
  }), r.join(`
4556
4607
  `);
4557
4608
  }
4558
- function Vs(e, t = "table-data.csv") {
4609
+ function Is(e, t = "table-data.csv") {
4559
4610
  const r = new Blob([e], { type: "text/csv;charset=utf-8;" }), a = URL.createObjectURL(r), s = document.createElement("a");
4560
4611
  s.href = a, s.download = t, document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(a);
4561
4612
  }
4562
- function Is(e) {
4613
+ function Ds(e) {
4563
4614
  const t = e.querySelectorAll("tr"), r = [];
4564
4615
  return t.forEach((a) => {
4565
4616
  const s = a.querySelectorAll("th, td"), n = [];
@@ -4569,7 +4620,7 @@ function Is(e) {
4569
4620
  }), r.join(`
4570
4621
  `);
4571
4622
  }
4572
- function Ds(e, t, r = !0) {
4623
+ function qs(e, t, r = !0) {
4573
4624
  const a = e.querySelector("tbody") || e, s = Array.from(a.querySelectorAll("tr")).filter((n) => !n.querySelector("th"));
4574
4625
  s.sort((n, o) => {
4575
4626
  const i = n.cells[t], u = o.cells[t];
@@ -4582,7 +4633,7 @@ function Ds(e, t, r = !0) {
4582
4633
  return !isNaN(c.getTime()) && !isNaN(h.getTime()) ? r ? c - h : h - c : r ? l.localeCompare(d) : d.localeCompare(l);
4583
4634
  }), s.forEach((n) => a.appendChild(n));
4584
4635
  }
4585
- function qs(e, t) {
4636
+ function Zs(e, t) {
4586
4637
  const r = e.querySelectorAll("tbody tr, tr:not(:first-child)"), a = t.toLowerCase().trim();
4587
4638
  let s = 0;
4588
4639
  return r.forEach((n) => {
@@ -4594,13 +4645,13 @@ function qs(e, t) {
4594
4645
  n.style.display = i ? "" : "none", i && s++;
4595
4646
  }), s;
4596
4647
  }
4597
- function Zs() {
4648
+ function Os() {
4598
4649
  document.querySelectorAll("[data-table-search]").forEach((e) => {
4599
4650
  const t = e.dataset.tableSearch, r = document.getElementById(t), a = document.querySelector(`[data-table-count="${t}"]`);
4600
4651
  if (r) {
4601
4652
  const s = r.querySelectorAll("tbody tr, tr:not(:first-child)"), n = Array.from(s).filter((o) => !o.querySelector("th")).length;
4602
4653
  a && (a.textContent = `${n} rows`), e.addEventListener("input", (o) => {
4603
- const i = qs(r, o.target.value);
4654
+ const i = Zs(r, o.target.value);
4604
4655
  a && (a.textContent = o.target.value ? `${i} of ${n} rows` : `${n} rows`);
4605
4656
  });
4606
4657
  }
@@ -4609,21 +4660,21 @@ function Zs() {
4609
4660
  const t = e.closest("table"), r = parseInt(e.dataset.sortCol), s = e.dataset.sortDir !== "asc";
4610
4661
  t.querySelectorAll(".artifactuse-sortable-header").forEach((n) => {
4611
4662
  n.dataset.sortDir = "", n.classList.remove("sort-asc", "sort-desc");
4612
- }), e.dataset.sortDir = s ? "asc" : "desc", e.classList.add(s ? "sort-asc" : "sort-desc"), Ds(t, r, s);
4663
+ }), e.dataset.sortDir = s ? "asc" : "desc", e.classList.add(s ? "sort-asc" : "sort-desc"), qs(t, r, s);
4613
4664
  });
4614
4665
  }), document.querySelectorAll("[data-table-export]").forEach((e) => {
4615
4666
  e.addEventListener("click", () => {
4616
4667
  const t = e.dataset.tableExport, r = document.getElementById(t);
4617
4668
  if (r) {
4618
- const a = Hs(r);
4619
- Vs(a, `${t}.csv`);
4669
+ const a = Vs(r);
4670
+ Is(a, `${t}.csv`);
4620
4671
  }
4621
4672
  });
4622
4673
  }), document.querySelectorAll("[data-table-copy]").forEach((e) => {
4623
4674
  e.addEventListener("click", async () => {
4624
4675
  const t = e.dataset.tableCopy, r = document.getElementById(t);
4625
4676
  if (r) {
4626
- const a = Is(r);
4677
+ const a = Ds(r);
4627
4678
  try {
4628
4679
  await navigator.clipboard.writeText(a);
4629
4680
  const s = e.querySelector("span"), n = s ? s.textContent : "";
@@ -4638,40 +4689,40 @@ function Zs() {
4638
4689
  });
4639
4690
  }
4640
4691
  let re = null, Le = !1;
4641
- function Er(e) {
4642
- return e = Os(e), e = e.replace(/\$\$([\s\S]*?)\$\$/g, (t, r) => he(r.trim(), !0)), e = e.replace(/\\\[([\s\S]*?)\\\]/g, (t, r) => he(r.trim(), !0)), e = e.replace(new RegExp("(?<!\\$)\\$(?!\\$)((?:[^$\\\\]|\\\\.)+?)\\$(?!\\$)", "g"), (t, r) => he(r.trim(), !1)), e = e.replace(/\\\(([\s\S]*?)\\\)/g, (t, r) => he(r.trim(), !1)), e;
4692
+ function Pr(e) {
4693
+ return e = Bs(e), e = e.replace(/\$\$([\s\S]*?)\$\$/g, (t, r) => he(r.trim(), !0)), e = e.replace(/\\\[([\s\S]*?)\\\]/g, (t, r) => he(r.trim(), !0)), e = e.replace(new RegExp("(?<!\\$)\\$(?!\\$)((?:[^$\\\\]|\\\\.)+?)\\$(?!\\$)", "g"), (t, r) => he(r.trim(), !1)), e = e.replace(/\\\(([\s\S]*?)\\\)/g, (t, r) => he(r.trim(), !1)), e;
4643
4694
  }
4644
- function Os(e) {
4695
+ function Bs(e) {
4645
4696
  const t = /<pre><code class="language-(math|latex)">([\s\S]*?)<\/code><\/pre>/gi;
4646
4697
  return e = e.replace(t, (r, a, s) => {
4647
- const n = Bs(s).trim();
4698
+ const n = Fs(s).trim();
4648
4699
  return he(n, !0);
4649
4700
  }), e;
4650
4701
  }
4651
- function Bs(e) {
4702
+ function Fs(e) {
4652
4703
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&nbsp;/g, " ");
4653
4704
  }
4654
4705
  function he(e, t = !1) {
4655
- const r = Fs(e);
4706
+ const r = Ns(e);
4656
4707
  return `<span class="artifactuse-math-container ${t ? "artifactuse-math-display" : "artifactuse-math-inline"}" data-tex="${r}" data-display="${t ? "true" : "false"}"></span>`;
4657
4708
  }
4658
- function Fs(e) {
4709
+ function Ns(e) {
4659
4710
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
4660
4711
  }
4661
- function Pr(e) {
4712
+ function jr(e) {
4662
4713
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&amp;/g, "&");
4663
4714
  }
4664
- function jr() {
4665
- return typeof katex > "u" ? Le ? (console.warn("KaTeX loading previously failed. Math rendering disabled."), Promise.resolve()) : (console.debug("KaTeX library not loaded. Attempting to load..."), Us().then(() => {
4715
+ function Hr() {
4716
+ return typeof katex > "u" ? Le ? (console.warn("KaTeX loading previously failed. Math rendering disabled."), Promise.resolve()) : (console.debug("KaTeX library not loaded. Attempting to load..."), Gs().then(() => {
4666
4717
  console.log("KaTeX loaded, rendering math..."), dr();
4667
4718
  }).catch((e) => {
4668
- console.error("Failed to load KaTeX library:", e), Le = !0, Ns();
4719
+ console.error("Failed to load KaTeX library:", e), Le = !0, Us();
4669
4720
  })) : (dr(), Promise.resolve());
4670
4721
  }
4671
- function Ns() {
4722
+ function Us() {
4672
4723
  document.querySelectorAll(".artifactuse-math-container").forEach((e) => {
4673
4724
  if (e.dataset.rendered === "true") return;
4674
- const t = Pr(e.dataset.tex);
4725
+ const t = jr(e.dataset.tex);
4675
4726
  e.innerHTML = `<code class="artifactuse-math-fallback" title="Math rendering unavailable">${We(t)}</code>`, e.dataset.rendered = "true", e.classList.add("artifactuse-math-fallback-container");
4676
4727
  });
4677
4728
  }
@@ -4682,7 +4733,7 @@ function dr() {
4682
4733
  }
4683
4734
  document.querySelectorAll(".artifactuse-math-container").forEach((e) => {
4684
4735
  if (e.dataset.rendered === "true") return;
4685
- const t = Pr(e.dataset.tex), r = e.dataset.display === "true";
4736
+ const t = jr(e.dataset.tex), r = e.dataset.display === "true";
4686
4737
  try {
4687
4738
  katex.render(t, e, {
4688
4739
  displayMode: r,
@@ -4710,7 +4761,7 @@ function dr() {
4710
4761
  function We(e) {
4711
4762
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4712
4763
  }
4713
- function Us() {
4764
+ function Gs() {
4714
4765
  return re || (typeof katex < "u" ? Promise.resolve() : (re = new Promise((e, t) => {
4715
4766
  const r = setTimeout(() => {
4716
4767
  re = null, t(new Error("KaTeX loading timed out after 10 seconds"));
@@ -4726,21 +4777,21 @@ function Us() {
4726
4777
  }, document.head.appendChild(s);
4727
4778
  }), re));
4728
4779
  }
4729
- function pn() {
4780
+ function hn() {
4730
4781
  re = null, Le = !1;
4731
4782
  }
4732
- function fn() {
4783
+ function gn() {
4733
4784
  return typeof katex < "u";
4734
4785
  }
4735
- function hn() {
4786
+ function mn() {
4736
4787
  return Le;
4737
4788
  }
4738
- function gn(e) {
4789
+ function wn(e) {
4739
4790
  if (!e) return Promise.resolve();
4740
4791
  let t = e.innerHTML;
4741
- return t = Er(t), e.innerHTML = t, jr();
4792
+ return t = Pr(t), e.innerHTML = t, Hr();
4742
4793
  }
4743
- const mn = {
4794
+ const bn = {
4744
4795
  // Fractions
4745
4796
  fraction: (e, t) => `\\frac{${e}}{${t}}`,
4746
4797
  // Square root
@@ -4772,11 +4823,11 @@ const mn = {
4772
4823
  euler: "e^{i\\pi} + 1 = 0",
4773
4824
  derivative: (e, t) => `\\frac{d${e}}{d${t}}`,
4774
4825
  partialDerivative: (e, t) => `\\frac{\\partial ${e}}{\\partial ${t}}`
4775
- };
4826
+ }, Ws = new Set(Object.values(fr));
4776
4827
  function xe(e) {
4777
4828
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4778
4829
  }
4779
- function Gs() {
4830
+ function Xs() {
4780
4831
  const e = {
4781
4832
  image(a) {
4782
4833
  const s = typeof a == "string" ? a : a.href, n = typeof a == "string" ? arguments[1] : a.title, o = typeof a == "string" ? arguments[2] : a.text;
@@ -4785,8 +4836,8 @@ function Gs() {
4785
4836
  }, t = {
4786
4837
  link(a) {
4787
4838
  const s = typeof a == "string" ? a : a.href, n = typeof a == "string" ? arguments[1] : a.title, o = typeof a == "string" ? arguments[2] : a.text;
4788
- if (ts(s))
4789
- return as(s);
4839
+ if (rs(s))
4840
+ return ss(s);
4790
4841
  const i = n ? ` title="${xe(n)}"` : "";
4791
4842
  return `<a href="${xe(s || "")}" target="_blank" rel="noopener noreferrer"${i}>${o || ""}</a>`;
4792
4843
  }
@@ -4806,8 +4857,8 @@ function Gs() {
4806
4857
  breaks: !0
4807
4858
  });
4808
4859
  }
4809
- Gs();
4810
- const Hr = {
4860
+ Xs();
4861
+ const Vr = {
4811
4862
  // Structured artifact types
4812
4863
  form: "form-panel",
4813
4864
  // Visual editors
@@ -4845,7 +4896,7 @@ const Hr = {
4845
4896
  md: "html-panel",
4846
4897
  // Diagrams
4847
4898
  mermaid: "mermaid-panel"
4848
- }, Ws = {
4899
+ }, Ks = {
4849
4900
  // CDN URL for panel artifacts (video editor, canvas, etc.)
4850
4901
  cdnUrl: "https://cdn.artifactuse.com",
4851
4902
  // Theme: 'dark' | 'light' | 'auto'
@@ -4929,7 +4980,7 @@ const Hr = {
4929
4980
  expiryDays: 30
4930
4981
  }
4931
4982
  };
4932
- function Vr(e, t) {
4983
+ function Ir(e, t) {
4933
4984
  if (e == null)
4934
4985
  return null;
4935
4986
  try {
@@ -4944,7 +4995,7 @@ function Vr(e, t) {
4944
4995
  }
4945
4996
  return null;
4946
4997
  }
4947
- function Xs(e, t) {
4998
+ function Js(e, t) {
4948
4999
  const r = /* @__PURE__ */ new Set();
4949
5000
  try {
4950
5001
  r.add(new URL(t).origin);
@@ -4952,13 +5003,13 @@ function Xs(e, t) {
4952
5003
  console.warn("Artifactuse: Invalid default CDN URL:", t);
4953
5004
  }
4954
5005
  for (const a of Object.values(e)) {
4955
- const s = Vr(a, t);
5006
+ const s = Ir(a, t);
4956
5007
  s && r.add(s);
4957
5008
  }
4958
5009
  return [...r];
4959
5010
  }
4960
- function Ks(e, t) {
4961
- const r = { ...Hr };
5011
+ function Qs(e, t) {
5012
+ const r = { ...Vr };
4962
5013
  if (e.panels)
4963
5014
  for (const [u, l] of Object.entries(e.panels))
4964
5015
  if (Array.isArray(u))
@@ -5002,7 +5053,7 @@ function Ks(e, t) {
5002
5053
  const c = w == null ? void 0 : w.toLowerCase();
5003
5054
  c && (r[c] = l);
5004
5055
  });
5005
- const p = Vr(l, e.cdnUrl);
5056
+ const p = Ir(l, e.cdnUrl);
5006
5057
  p && t && t.addAllowedOrigin(p);
5007
5058
  }
5008
5059
  function i(u) {
@@ -5023,31 +5074,31 @@ function Ks(e, t) {
5023
5074
  }
5024
5075
  };
5025
5076
  }
5026
- function wn(e = {}) {
5027
- const t = Ir(Ws, e), r = ra(), a = { ...Hr, ...t.panels }, s = Xs(a, t.cdnUrl), n = aa(s), o = ia(t.theme, t.colors || {}), i = Ks(t, n), u = fa(t.sharing), l = ha(t.editor);
5028
- function d(y, E, R = {}) {
5029
- let C = V.parse(y);
5030
- const D = [], _ = { theme: o.resolved }, q = R.inlinePreview ?? t.inlinePreview ?? null, J = R.inlineCode ?? t.inlineCode ?? null, le = R.tabs ?? t.tabs ?? null, K = R.viewMode ?? t.viewMode ?? null;
5077
+ function vn(e = {}) {
5078
+ const t = Dr(Ks, e), r = aa(), a = { ...Vr, ...t.panels }, s = Js(a, t.cdnUrl), n = sa(s), o = oa(t.theme, t.colors || {}), i = Qs(t, n), u = ha(t.sharing), l = ga(t.editor);
5079
+ function d(y, E, C = {}) {
5080
+ let R = V.parse(y);
5081
+ const D = [], _ = { theme: o.resolved }, q = C.inlinePreview ?? t.inlinePreview ?? null, J = C.inlineCode ?? t.inlineCode ?? null, le = C.tabs ?? t.tabs ?? null, K = C.viewMode ?? t.viewMode ?? null;
5031
5082
  if (t.processors.codeBlocks) {
5032
- const U = ta(C, E, {
5083
+ const U = ra(R, E, {
5033
5084
  ...t.codeExtraction,
5034
5085
  inlinePreview: q,
5035
5086
  inlineCode: J,
5036
5087
  tabs: le,
5037
5088
  viewMode: K
5038
5089
  });
5039
- C = U.html, D.push(...U.artifacts);
5090
+ R = U.html, D.push(...U.artifacts);
5040
5091
  }
5041
- return t.processors.images && (C = Ya(C)), t.processors.imageGalleries && (C = es(C)), t.processors.videos && (C = ss(C)), t.processors.videoGalleries && (C = ls(C)), t.processors.audio && (C = ds(C, _)), t.processors.maps && (C = vs(C)), t.processors.social && (C = ys(C, _)), t.processors.documents && (C = ks(C), C = xs(C), C = Ms(C)), t.processors.codeEmbeds && (C = As(C, _)), t.processors.dataViz && (C = zs(C)), t.processors.design && (C = Ss(C, _)), t.processors.interactive && (C = Cs(C, _)), t.processors.tables && (C = Es(C)), t.processors.math && (C = Er(C)), t.processors.mermaid && (C = Rr(C)), D.forEach((U) => {
5092
+ return t.processors.images && (R = es(R)), t.processors.imageGalleries && (R = ts(R)), t.processors.videos && (R = ns(R)), t.processors.videoGalleries && (R = cs(R)), t.processors.audio && (R = ps(R, _)), t.processors.maps && (R = ys(R)), t.processors.social && (R = ks(R, _)), t.processors.documents && (R = xs(R), R = Ms(R), R = $s(R)), t.processors.codeEmbeds && (R = zs(R, _)), t.processors.dataViz && (R = Ss(R)), t.processors.design && (R = Cs(R, _)), t.processors.interactive && (R = Rs(R, _)), t.processors.tables && (R = Ps(R)), t.processors.math && (R = Pr(R)), t.processors.mermaid && (R = Lr(R)), D.forEach((U) => {
5042
5093
  r.addArtifact(U);
5043
5094
  }), {
5044
- html: C,
5095
+ html: R,
5045
5096
  artifacts: D
5046
5097
  };
5047
5098
  }
5048
5099
  async function p(y = document) {
5049
- const E = [], R = { theme: o.resolved };
5050
- t.processors.math && E.push(jr()), t.processors.mermaid && E.push(_r(R)), t.processors.tables && Zs(), t.processors.audio && fs(y), t.syntaxHighlight && (pr(y), (y === document ? document : y).querySelectorAll(".artifactuse-inline-preview[data-smartdiff]").forEach((_) => {
5100
+ const E = [], C = { theme: o.resolved };
5101
+ t.processors.math && E.push(Hr()), t.processors.mermaid && E.push(Er(C)), t.processors.tables && Os(), t.processors.audio && hs(y), t.syntaxHighlight && (pr(y), (y === document ? document : y).querySelectorAll(".artifactuse-inline-preview[data-smartdiff]").forEach((_) => {
5051
5102
  var K;
5052
5103
  const q = _.querySelector("code");
5053
5104
  if (!q || q.dataset.smartdiffProcessed) return;
@@ -5067,19 +5118,19 @@ function wn(e = {}) {
5067
5118
  }
5068
5119
  t.multiTab ? r.openTab(y.id) : r.setActiveArtifact(y.id), r.setForceEmptyView(!1), r.setPanelOpen(!0), y.viewMode && r.setViewMode(y.viewMode), T("artifact:opened", y);
5069
5120
  }
5070
- function c(y, E, R = {}) {
5071
- const C = y.split(".").pop(), D = R.language || Ur(C) || C, _ = R.title || y, q = r.getState().artifacts.find((J) => J.title === _ && !J.isInline);
5072
- return q ? (f(q.id, E, { ...R, title: _ }), w(q), R.viewMode ? r.setViewMode(R.viewMode) : R.tabs && r.setViewMode(R.tabs[0]), r.getArtifact(q.id)) : h(E, D, { ...R, title: _ });
5121
+ function c(y, E, C = {}) {
5122
+ const R = y.split(".").pop().toLowerCase(), D = C.language || Gr(R) || R, _ = C.title || y, q = r.getState().artifacts.find((J) => J.title === _ && !J.isInline);
5123
+ return q ? (f(q.id, E, { ...C, title: _ }), w(q), C.viewMode ? r.setViewMode(C.viewMode) : C.tabs && r.setViewMode(C.tabs[0]), r.getArtifact(q.id)) : h(E, D, { ...C, title: _, fileExtension: R });
5073
5124
  }
5074
- function h(y, E, R = {}) {
5075
- const C = R.messageId || Fr("open"), D = A({ type: E, language: E }) ? E : "txt", _ = $e(y, D, C, 0);
5076
- return _.title = R.title || _.title, _.isInline = !1, _.editorLanguage = E, R.tabs && (_.tabs = R.tabs), R.panelUrl && (_.panelUrl = R.panelUrl), R.externalPreview !== void 0 && (_.externalPreview = R.externalPreview), r.addArtifact(_), w(_), R.viewMode ? r.setViewMode(R.viewMode) : R.tabs && r.setViewMode(R.tabs[0]), _;
5125
+ function h(y, E, C = {}) {
5126
+ const R = C.messageId || Nr("open"), D = A({ type: E, language: E }) || Ws.has(E) ? E : "txt", _ = $e(y, D, R, 0);
5127
+ return _.title = C.title || _.title, _.isInline = !1, _.editorLanguage = E, C.fileExtension && (_.fileExtension = C.fileExtension), C.tabs && (_.tabs = C.tabs), C.panelUrl && (_.panelUrl = C.panelUrl), C.externalPreview !== void 0 && (_.externalPreview = C.externalPreview), r.addArtifact(_), w(_), C.viewMode ? r.setViewMode(C.viewMode) : C.tabs && r.setViewMode(C.tabs[0]), _;
5077
5128
  }
5078
- function f(y, E, R = {}) {
5079
- const C = typeof y == "string" ? y : y == null ? void 0 : y.id, D = r.getArtifact(C);
5129
+ function f(y, E, C = {}) {
5130
+ const R = typeof y == "string" ? y : y == null ? void 0 : y.id, D = r.getArtifact(R);
5080
5131
  if (!D) return null;
5081
5132
  const _ = { ...D, code: E, _refreshToken: Date.now() };
5082
- return R.title !== void 0 && (_.title = R.title), R.tabs !== void 0 && (_.tabs = R.tabs), R.panelUrl !== void 0 && (_.panelUrl = R.panelUrl), R.externalPreview !== void 0 && (_.externalPreview = R.externalPreview), r.addArtifact(_), T("artifact:updated", { artifactId: C, artifact: r.getArtifact(C) }), r.getArtifact(C);
5133
+ return C.title !== void 0 && (_.title = C.title), C.tabs !== void 0 && (_.tabs = C.tabs), C.panelUrl !== void 0 && (_.panelUrl = C.panelUrl), C.externalPreview !== void 0 && (_.externalPreview = C.externalPreview), r.addArtifact(_), T("artifact:updated", { artifactId: R, artifact: r.getArtifact(R) }), r.getArtifact(R);
5083
5134
  }
5084
5135
  function g() {
5085
5136
  r.clearActiveArtifact(), r.setForceEmptyView(!0), r.setPanelOpen(!0), T("panel:opened");
@@ -5101,12 +5152,12 @@ function wn(e = {}) {
5101
5152
  function M(y, E = {}) {
5102
5153
  if (!y) return null;
5103
5154
  if (y.panelUrl) return y.panelUrl;
5104
- const { type: R, language: C } = y, D = {
5155
+ const { type: C, language: R } = y, D = {
5105
5156
  theme: E.theme || o.resolved
5106
5157
  }, _ = o.colors;
5107
5158
  _ != null && _.primary && (D.accent = _.primary);
5108
- let q = i.resolve(R, D);
5109
- return !q && C && (q = i.resolve(C, D)), q;
5159
+ let q = i.resolve(C, D);
5160
+ return !q && R && (q = i.resolve(R, D)), q;
5110
5161
  }
5111
5162
  function A(y) {
5112
5163
  return y ? i.has(y.type) || i.has(y.language) : !1;
@@ -5126,19 +5177,19 @@ function wn(e = {}) {
5126
5177
  const z = /* @__PURE__ */ new Map();
5127
5178
  function j(y, E) {
5128
5179
  return z.has(y) || z.set(y, /* @__PURE__ */ new Set()), z.get(y).add(E), () => {
5129
- var R;
5130
- (R = z.get(y)) == null || R.delete(E);
5180
+ var C;
5181
+ (C = z.get(y)) == null || C.delete(E);
5131
5182
  };
5132
5183
  }
5133
5184
  function P(y, E) {
5134
- var R;
5135
- (R = z.get(y)) == null || R.delete(E);
5185
+ var C;
5186
+ (C = z.get(y)) == null || C.delete(E);
5136
5187
  }
5137
5188
  function T(y, E) {
5138
- var R;
5139
- (R = z.get(y)) == null || R.forEach((C) => {
5189
+ var C;
5190
+ (C = z.get(y)) == null || C.forEach((R) => {
5140
5191
  try {
5141
- C(E);
5192
+ R(E);
5142
5193
  } catch (D) {
5143
5194
  console.error(`Artifactuse event handler error (${y}):`, D);
5144
5195
  }
@@ -5160,7 +5211,7 @@ function wn(e = {}) {
5160
5211
  return o.resolved;
5161
5212
  }
5162
5213
  function B() {
5163
- n.destroy(), z.clear(), r.clear(), bs();
5214
+ n.destroy(), z.clear(), r.clear(), vs();
5164
5215
  }
5165
5216
  return {
5166
5217
  // Config
@@ -5214,7 +5265,7 @@ function wn(e = {}) {
5214
5265
  destroy: B
5215
5266
  };
5216
5267
  }
5217
- function Ir(e, t, r = /* @__PURE__ */ new WeakSet()) {
5268
+ function Dr(e, t, r = /* @__PURE__ */ new WeakSet()) {
5218
5269
  if (!t) return e;
5219
5270
  if (!e) return t;
5220
5271
  if (typeof t == "object" && t !== null) {
@@ -5235,7 +5286,7 @@ function Ir(e, t, r = /* @__PURE__ */ new WeakSet()) {
5235
5286
  continue;
5236
5287
  }
5237
5288
  if (typeof n == "object" && n.constructor === Object) {
5238
- a[s] = Ir(e[s] || {}, n, r);
5289
+ a[s] = Dr(e[s] || {}, n, r);
5239
5290
  continue;
5240
5291
  }
5241
5292
  a[s] = n;
@@ -5244,24 +5295,24 @@ function Ir(e, t, r = /* @__PURE__ */ new WeakSet()) {
5244
5295
  return a;
5245
5296
  }
5246
5297
  export {
5247
- xs as $,
5298
+ Ms as $,
5248
5299
  Oe as A,
5249
5300
  Be as B,
5250
5301
  Fe as C,
5251
- Hr as D,
5302
+ Vr as D,
5252
5303
  Ne as E,
5253
- ds as F,
5304
+ ps as F,
5254
5305
  yt as G,
5255
5306
  kt as H,
5256
5307
  F as I,
5257
5308
  xt as J,
5258
- fs as K,
5259
- bs as L,
5260
- vs as M,
5309
+ hs as K,
5310
+ vs as L,
5311
+ ys as M,
5261
5312
  ee as N,
5262
5313
  Ue as O,
5263
5314
  Rt as P,
5264
- ys as Q,
5315
+ ks as Q,
5265
5316
  Lt as R,
5266
5317
  Tt as S,
5267
5318
  _t as T,
@@ -5270,61 +5321,61 @@ export {
5270
5321
  jt as W,
5271
5322
  Ht as X,
5272
5323
  Vt as Y,
5273
- ks as Z,
5324
+ xs as Z,
5274
5325
  It as _,
5275
- rn as a,
5276
- en as a$,
5326
+ sn as a,
5327
+ rn as a$,
5277
5328
  oe as a0,
5278
5329
  Dt as a1,
5279
- Ms as a2,
5330
+ $s as a2,
5280
5331
  qt as a3,
5281
- As as a4,
5332
+ zs as a4,
5282
5333
  Zt as a5,
5283
5334
  Ot as a6,
5284
5335
  Bt as a7,
5285
5336
  Ft as a8,
5286
5337
  Nt as a9,
5287
- on as aA,
5288
- ln as aB,
5289
- cn as aC,
5290
- un as aD,
5291
- dn as aE,
5292
- Es as aF,
5293
- Ps as aG,
5294
- Hs as aH,
5295
- Vs as aI,
5296
- Is as aJ,
5297
- Ds as aK,
5298
- qs as aL,
5299
- Zs as aM,
5300
- Er as aN,
5338
+ cn as aA,
5339
+ un as aB,
5340
+ dn as aC,
5341
+ pn as aD,
5342
+ fn as aE,
5343
+ Ps as aF,
5344
+ js as aG,
5345
+ Vs as aH,
5346
+ Is as aI,
5347
+ Ds as aJ,
5348
+ qs as aK,
5349
+ Zs as aL,
5350
+ Os as aM,
5351
+ Pr as aN,
5301
5352
  he as aO,
5302
- jr as aP,
5303
- Us as aQ,
5304
- pn as aR,
5305
- fn as aS,
5306
- hn as aT,
5307
- gn as aU,
5308
- mn as aV,
5353
+ Hr as aP,
5354
+ Gs as aQ,
5355
+ hn as aR,
5356
+ gn as aS,
5357
+ mn as aT,
5358
+ wn as aU,
5359
+ bn as aV,
5309
5360
  pr as aW,
5310
- Qs as aX,
5361
+ en as aX,
5311
5362
  ot as aY,
5312
- Zr as aZ,
5313
- Ys as a_,
5363
+ Or as aZ,
5364
+ tn as a_,
5314
5365
  Ut as aa,
5315
- zs as ab,
5366
+ Ss as ab,
5316
5367
  Gt as ac,
5317
5368
  Wt as ad,
5318
5369
  Xt as ae,
5319
5370
  Kt as af,
5320
- Ss as ag,
5371
+ Cs as ag,
5321
5372
  Jt as ah,
5322
5373
  Qt as ai,
5323
5374
  Yt as aj,
5324
5375
  er as ak,
5325
5376
  tr as al,
5326
5377
  rr as am,
5327
- Cs as an,
5378
+ Rs as an,
5328
5379
  ar as ao,
5329
5380
  sr as ap,
5330
5381
  nr as aq,
@@ -5332,34 +5383,34 @@ export {
5332
5383
  or as as,
5333
5384
  lr as at,
5334
5385
  cr as au,
5335
- Rr as av,
5336
- Ls as aw,
5337
- _r as ax,
5338
- _s as ay,
5339
- nn as az,
5340
- tn as b,
5341
- Xr as c,
5342
- wn as d,
5343
- ta as e,
5344
- an as f,
5386
+ Lr as av,
5387
+ Ts as aw,
5388
+ Er as ax,
5389
+ Es as ay,
5390
+ ln as az,
5391
+ an as b,
5392
+ Kr as c,
5393
+ vn as d,
5394
+ ra as e,
5395
+ nn as f,
5345
5396
  ct as g,
5346
- Yr as h,
5397
+ ea as h,
5347
5398
  ae as i,
5348
- ra as j,
5349
- aa as k,
5350
- ia as l,
5351
- ha as m,
5399
+ aa as j,
5400
+ sa as k,
5401
+ oa as l,
5402
+ ga as m,
5352
5403
  ge as n,
5353
- Ya as o,
5354
- sn as p,
5355
- es as q,
5404
+ es as o,
5405
+ on as p,
5406
+ ts as q,
5356
5407
  qe as r,
5357
5408
  vt as s,
5358
- ss as t,
5359
- ts as u,
5360
- as as v,
5409
+ ns as t,
5410
+ rs as u,
5411
+ ss as v,
5361
5412
  Ze as w,
5362
- ls as x,
5363
- cs as y,
5364
- is as z
5413
+ cs as x,
5414
+ us as y,
5415
+ os as z
5365
5416
  };