artifactuse 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,108 @@
1
1
  var Dr = Object.defineProperty;
2
2
  var qr = (e, t, r) => t in e ? Dr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
3
  var I = (e, t, r) => qr(e, typeof t != "symbol" ? t + "" : t, r);
4
- const Ee = {
4
+ function ae() {
5
+ return typeof window < "u" && window.Prism;
6
+ }
7
+ function pr(e) {
8
+ if (!ae()) {
9
+ console.warn("Artifactuse: Prism.js not found. Install and include Prism.js for syntax highlighting.");
10
+ return;
11
+ }
12
+ const t = typeof e == "string" ? document.querySelector(e) : e;
13
+ if (!t) return;
14
+ t.querySelectorAll("pre code").forEach((a) => {
15
+ if (a.classList.contains("prism-highlighted")) return;
16
+ const s = Zr(a);
17
+ s && (a.className.includes(`language-${s}`) || a.classList.add(`language-${s}`), window.Prism.highlightElement(a), a.classList.add("prism-highlighted"));
18
+ });
19
+ }
20
+ function Qs(e, t) {
21
+ ae() && (t && !e.className.includes(`language-${t}`) && e.classList.add(`language-${t}`), window.Prism.highlightElement(e), e.classList.add("prism-highlighted"));
22
+ }
23
+ function ot(e, t) {
24
+ if (!ae()) return lt(e);
25
+ const r = window.Prism.languages[t];
26
+ return r ? window.Prism.highlight(e, r, t) : lt(e);
27
+ }
28
+ function Zr(e) {
29
+ const t = e.className.split(/\s+/);
30
+ for (const s of t) {
31
+ const n = s.match(/^(?:language-|lang-)(.+)$/);
32
+ if (n)
33
+ return ge(n[1]);
34
+ }
35
+ const r = e.closest("pre");
36
+ if (r) {
37
+ const s = r.className.split(/\s+/);
38
+ for (const n of s) {
39
+ const o = n.match(/^(?:language-|lang-)(.+)$/);
40
+ if (o)
41
+ return ge(o[1]);
42
+ }
43
+ }
44
+ const a = e.dataset.language || (r == null ? void 0 : r.dataset.language);
45
+ return a ? ge(a) : null;
46
+ }
47
+ function ge(e) {
48
+ const t = {
49
+ js: "javascript",
50
+ ts: "typescript",
51
+ py: "python",
52
+ rb: "ruby",
53
+ sh: "bash",
54
+ shell: "bash",
55
+ zsh: "bash",
56
+ yml: "yaml",
57
+ md: "markdown",
58
+ html: "markup",
59
+ xml: "markup",
60
+ svg: "markup",
61
+ vue: "markup",
62
+ jsx: "jsx",
63
+ tsx: "tsx",
64
+ "c++": "cpp",
65
+ "c#": "csharp",
66
+ cs: "csharp",
67
+ "f#": "fsharp",
68
+ "objective-c": "objectivec",
69
+ objc: "objectivec"
70
+ }, r = e.toLowerCase();
71
+ return t[r] || r;
72
+ }
73
+ function lt(e) {
74
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
75
+ }
76
+ function Ys(e) {
77
+ if (!ae())
78
+ return console.warn("Artifactuse: Prism.js not found. Auto-highlighting disabled."), null;
79
+ const t = new MutationObserver((r) => {
80
+ let a = !1;
81
+ for (const s of r)
82
+ if (s.type === "childList") {
83
+ for (const n of s.addedNodes)
84
+ if (n.nodeType === Node.ELEMENT_NODE && (n.matches("pre code") || n.querySelector("pre code"))) {
85
+ a = !0;
86
+ break;
87
+ }
88
+ }
89
+ a && pr(e);
90
+ });
91
+ return t.observe(e, {
92
+ childList: !0,
93
+ subtree: !0
94
+ }), t;
95
+ }
96
+ function en() {
97
+ return ae() ? Object.keys(window.Prism.languages).filter(
98
+ (e) => typeof window.Prism.languages[e] == "object"
99
+ ) : [];
100
+ }
101
+ const Pe = {
5
102
  CODE: "code",
6
103
  FORM: "form",
7
104
  SOCIAL: "social"
8
- }, Zr = [
105
+ }, Or = [
9
106
  // Code languages
10
107
  "html",
11
108
  "htm",
@@ -34,7 +131,7 @@ const Ee = {
34
131
  // Structured artifacts
35
132
  "form",
36
133
  "social"
37
- ], Or = [
134
+ ], Br = [
38
135
  // Visual editors (always panel)
39
136
  "video",
40
137
  "videoeditor",
@@ -61,16 +158,16 @@ const Ee = {
61
158
  // Structured artifacts (form can be panel based on complexity)
62
159
  "form"
63
160
  ];
64
- function Br(e = "artifact") {
161
+ function Fr(e = "artifact") {
65
162
  return `${e}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
66
163
  }
67
- function pr(e) {
68
- return Zr.includes(e == null ? void 0 : e.toLowerCase());
69
- }
70
- function Fr(e) {
164
+ function fr(e) {
71
165
  return Or.includes(e == null ? void 0 : e.toLowerCase());
72
166
  }
73
- function ot(e) {
167
+ function Nr(e) {
168
+ return Br.includes(e == null ? void 0 : e.toLowerCase());
169
+ }
170
+ function ct(e) {
74
171
  return {
75
172
  // Code languages
76
173
  html: "HTML",
@@ -166,7 +263,7 @@ function ot(e) {
166
263
  v: "V"
167
264
  }[e == null ? void 0 : e.toLowerCase()] || (e == null ? void 0 : e.toUpperCase()) || "Code";
168
265
  }
169
- function Qs(e) {
266
+ function tn(e) {
170
267
  return {
171
268
  html: "html",
172
269
  htm: "html",
@@ -245,7 +342,7 @@ function Qs(e) {
245
342
  v: "v"
246
343
  }[e == null ? void 0 : e.toLowerCase()] || "txt";
247
344
  }
248
- function Nr(e) {
345
+ function Ur(e) {
249
346
  return {
250
347
  html: "html",
251
348
  htm: "html",
@@ -307,7 +404,7 @@ function Nr(e) {
307
404
  v: "v"
308
405
  }[e == null ? void 0 : e.toLowerCase()] || null;
309
406
  }
310
- function Ys(e) {
407
+ function rn(e) {
311
408
  return {
312
409
  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"/>',
313
410
  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"/>',
@@ -405,28 +502,25 @@ function Ys(e) {
405
502
  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"/>'
406
503
  }[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"/>';
407
504
  }
408
- function en(e) {
505
+ function an(e) {
409
506
  if (e === 0) return "0 Bytes";
410
507
  const t = 1024, r = ["Bytes", "KB", "MB", "GB"], a = Math.floor(Math.log(e) / Math.log(t));
411
508
  return parseFloat((e / Math.pow(t, a)).toFixed(2)) + " " + r[a];
412
509
  }
413
- function fr(e) {
510
+ function hr(e) {
414
511
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&amp;/g, "&").replace(/&#10;/g, `
415
512
  `).replace(/&#13;/g, "\r").replace(/&#9;/g, " ").replace(/&nbsp;/g, " ");
416
513
  }
417
- function lt(e) {
418
- return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
419
- }
420
- function Ur(e) {
514
+ function Gr(e) {
421
515
  const t = JSON.stringify(e);
422
516
  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;");
423
517
  }
424
- function Gr(e, t) {
518
+ function Wr(e, t) {
425
519
  const r = t == null ? void 0 : t.toLowerCase();
426
520
  if (r === "smartdiff")
427
521
  try {
428
522
  const l = JSON.parse(e);
429
- return l.language ? `${ot(l.language)} Diff` : "Smart Diff";
523
+ return l.language ? `${ct(l.language)} Diff` : "Smart Diff";
430
524
  } catch {
431
525
  return "Smart Diff";
432
526
  }
@@ -457,9 +551,9 @@ function Gr(e, t) {
457
551
  if (d && d[1] !== "main") return d[1];
458
552
  }
459
553
  const u = e.match(/<title>([^<]+)<\/title>/i);
460
- 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" : `${ot(t)} Code`;
554
+ 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`;
461
555
  }
462
- function Wr(e, t) {
556
+ function Xr(e, t) {
463
557
  const r = (e || "").split(`
464
558
  `), a = (t || "").split(`
465
559
  `), s = [], n = Math.max(r.length, a.length);
@@ -470,48 +564,48 @@ function Wr(e, t) {
470
564
  return s.join(`
471
565
  `);
472
566
  }
473
- function Xr(e, t, r, a) {
567
+ function Kr(e, t, r, a) {
474
568
  const s = a.maxLines || 15;
475
- function n(f, b) {
476
- if (b) return !1;
477
- const v = a.minClickableLines;
478
- if (v == null) return !1;
479
- const x = typeof v == "number" ? v : v.lines || 0, $ = typeof v == "object" && Array.isArray(v.ignoreLanguages) ? v.ignoreLanguages : [];
480
- return f < x && !$.includes(r);
481
- }
482
- function o(f, b) {
483
- const v = a.actionLabel;
484
- let x;
485
- return typeof v == "string" ? x = v : v && typeof v == "object" && (x = v[f] || v.default || null), x || (x = f === "diff" || f === "patch" || f === "smartdiff" ? "View full diff" : "View full code"), `${x} (${b} lines)`;
569
+ function n(v, x) {
570
+ if (x) return !1;
571
+ const M = a.minClickableLines;
572
+ if (M == null) return !1;
573
+ const A = typeof M == "number" ? M : M.lines || 0, S = typeof M == "object" && Array.isArray(M.ignoreLanguages) ? M.ignoreLanguages : [];
574
+ return v < A && !S.includes(r);
575
+ }
576
+ function o(v, x) {
577
+ const M = a.actionLabel;
578
+ let A;
579
+ return typeof M == "string" ? A = M : M && typeof M == "object" && (A = M[v] || M.default || null), A || (A = v === "diff" || v === "patch" || v === "smartdiff" ? "View full diff" : "View full code"), `${A} (${x} lines)`;
486
580
  }
487
581
  if (r === "smartdiff")
488
582
  try {
489
- const f = JSON.parse(t), v = Wr(f.oldCode, f.newCode).split(`
490
- `), x = v.slice(0, s), $ = x.map((T) => T[0] || " "), A = x.map((T) => T.slice(1)), C = lt(A.join(`
491
- `)), R = v.length > s, M = f.language || "plaintext", y = n(v.length, R), z = y ? " artifactuse-inline-preview--static" : "", H = y ? ' data-non-clickable="true"' : "", P = o("smartdiff", v.length);
492
- return `<div class="artifactuse-inline-preview${R ? " artifactuse-inline-preview--truncated" : ""}${z}" data-artifact-id="${e.id}" data-smartdiff="true" data-smartdiff-markers="${$.join(",")}"${H}><pre class="artifactuse-inline-preview__pre"><code class="language-${M}">${C}</code></pre>` + (R ? `<div class="artifactuse-inline-preview__fade"><span class="artifactuse-inline-preview__action">${P}</span></div>` : "") + "</div>";
583
+ const v = JSON.parse(t), M = Xr(v.oldCode, v.newCode).split(`
584
+ `), A = M.slice(0, s), S = A.map((B) => B[0] || " "), L = A.map((B) => B.slice(1)), $ = v.language || "plaintext", y = ge($), z = ot(L.join(`
585
+ `), y), j = ae() && window.Prism.languages[y], E = M.length > s, T = n(M.length, E), N = T ? " artifactuse-inline-preview--static" : "", X = T ? ' data-non-clickable="true"' : "", O = o("smartdiff", M.length);
586
+ return `<div class="artifactuse-inline-preview${E ? " 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>` + (E ? `<div class="artifactuse-inline-preview__fade"><span class="artifactuse-inline-preview__action">${O}</span></div>` : "") + "</div>";
493
587
  } catch {
494
588
  }
495
589
  let i = t, u = r;
496
590
  const l = i.split(`
497
591
  `), d = l.slice(0, s).join(`
498
- `), p = lt(d), w = l.length > s, c = n(l.length, w), m = c ? " artifactuse-inline-preview--static" : "", h = c ? ' data-non-clickable="true"' : "", g = o(r, l.length);
499
- return `<div class="artifactuse-inline-preview${w ? " artifactuse-inline-preview--truncated" : ""}${m}" data-artifact-id="${e.id}"${h}><pre class="artifactuse-inline-preview__pre"><code class="language-${u}">${p}</code></pre>` + (w ? `<div class="artifactuse-inline-preview__fade"><span class="artifactuse-inline-preview__action">${g}</span></div>` : "") + "</div>";
592
+ `), 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);
593
+ 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>";
500
594
  }
501
- function Kr(e, t = "panel") {
502
- const r = Ur(e);
595
+ function Jr(e, t = "panel") {
596
+ const r = Gr(e);
503
597
  return `<div class="${`artifactuse-placeholder artifactuse-${t}`}" data-artifact-id="${e.id}" data-artifact-type="${e.type}" data-artifact="${r}"></div>`;
504
598
  }
505
- function hr(e) {
599
+ function gr(e) {
506
600
  try {
507
601
  return JSON.parse(e);
508
602
  } catch {
509
603
  return null;
510
604
  }
511
605
  }
512
- function Jr(e) {
606
+ function Qr(e) {
513
607
  var s;
514
- const t = hr(e);
608
+ const t = gr(e);
515
609
  if (!t || t.display === "inline") return !0;
516
610
  if (t.display === "panel" || t.variant === "wizard") return !1;
517
611
  if (t.variant === "buttons") return !0;
@@ -520,47 +614,47 @@ function Jr(e) {
520
614
  const a = ["multiselect", "rating", "color", "range"];
521
615
  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));
522
616
  }
523
- function Qr(e, t) {
617
+ function Yr(e, t) {
524
618
  const r = e == null ? void 0 : e.toLowerCase();
525
- return r === "social" ? !0 : r === "form" ? Jr(t) : !1;
619
+ return r === "social" ? !0 : r === "form" ? Qr(t) : !1;
526
620
  }
527
- function Yr(e) {
621
+ function ea(e) {
528
622
  const t = e == null ? void 0 : e.toLowerCase();
529
- return t === "form" ? Ee.FORM : t === "social" ? Ee.SOCIAL : Ee.CODE;
623
+ return t === "form" ? Pe.FORM : t === "social" ? Pe.SOCIAL : Pe.CODE;
530
624
  }
531
- function Me(e, t, r, a) {
532
- const s = t == null ? void 0 : t.toLowerCase(), n = Yr(s), o = Qr(s, e);
625
+ function $e(e, t, r, a) {
626
+ const s = t == null ? void 0 : t.toLowerCase(), n = ea(s), o = Yr(s, e);
533
627
  return {
534
628
  id: `${r}-${n}-${a}`,
535
629
  messageId: r,
536
630
  type: n,
537
631
  language: s,
538
- title: Gr(e, s),
632
+ title: Wr(e, s),
539
633
  code: e,
540
634
  isInline: o,
541
- isPreviewable: pr(s),
542
- isPanelArtifact: Fr(s),
635
+ isPreviewable: fr(s),
636
+ isPanelArtifact: Nr(s),
543
637
  size: e.length,
544
638
  lineCount: e.split(`
545
639
  `).length,
546
640
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
547
641
  };
548
642
  }
549
- function tn(e, t) {
643
+ function sn(e, t) {
550
644
  const r = [], a = /<pre><code class="language-(\w+)">([\s\S]*?)<\/code><\/pre>/gi;
551
645
  let s, n = 0;
552
646
  for (; (s = a.exec(e)) !== null; ) {
553
- const o = s[1], i = fr(s[2]);
647
+ const o = s[1], i = hr(s[2]);
554
648
  let u = o.toLowerCase();
555
- if ((["xml", "markup", "html", "htm"].includes(u) || !u) && (i.trim().startsWith("<svg") || i.includes("<svg ") || i.includes("<svg>")) && (u = "svg"), (u === "form" || u === "social") && !hr(i)) {
556
- r.push(Me(i, "json", t, n)), n++;
649
+ 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)) {
650
+ r.push($e(i, "json", t, n)), n++;
557
651
  continue;
558
652
  }
559
- r.push(Me(i, u, t, n)), n++;
653
+ r.push($e(i, u, t, n)), n++;
560
654
  }
561
655
  return r;
562
656
  }
563
- function ea(e, t, r = {}) {
657
+ function ta(e, t, r = {}) {
564
658
  const {
565
659
  minLines: a = 3,
566
660
  minLength: s = 50,
@@ -577,30 +671,30 @@ function ea(e, t, r = {}) {
577
671
  return i ? i.languages === !0 ? !0 : Array.isArray(i.languages) ? i.languages.includes(g) : !1 : !1;
578
672
  }
579
673
  const w = [], c = /<pre><code class="language-(\w+)">([\s\S]*?)<\/code><\/pre>/gi;
580
- let m = 0;
581
- const h = e.replace(c, (g, f, b) => {
582
- const v = fr(b).trim(), x = v.split(`
674
+ let h = 0;
675
+ const f = e.replace(c, (g, m, b) => {
676
+ const v = hr(b).trim(), x = v.split(`
583
677
  `).length;
584
- let $ = f.toLowerCase();
585
- if ((["xml", "markup", "html", "htm"].includes($) || !$) && v.trim().startsWith("<svg") && ($ = "svg"), p($))
586
- return m++, g;
587
- const A = pr($);
588
- let C = !1;
589
- if (n ? C = !0 : $ === "diff" || $ === "patch" || $ === "smartdiff" ? C = x > 10 : A ? C = !0 : C = v.length >= s && x >= a, !C && d($) && (C = !0), C) {
590
- const R = Me(v, $, t, m);
591
- if (u && (R.tabs = u), l && (R.viewMode = l), m++, w.push(R), d($))
592
- return Xr(R, v, $, o);
593
- let M = "panel";
594
- return R.isInline && (M = R.type === "social" ? "inline-social" : "inline-form"), Kr(R, M);
678
+ let M = m.toLowerCase();
679
+ if ((["xml", "markup", "html", "htm"].includes(M) || !M) && v.trim().startsWith("<svg") && (M = "svg"), p(M))
680
+ return h++, g;
681
+ const A = fr(M);
682
+ let S = !1;
683
+ 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) {
684
+ const L = $e(v, M, t, h);
685
+ if (u && (L.tabs = u), l && (L.viewMode = l), h++, w.push(L), d(M))
686
+ return Kr(L, v, M, o);
687
+ let $ = "panel";
688
+ return L.isInline && ($ = L.type === "social" ? "inline-social" : "inline-form"), Jr(L, $);
595
689
  }
596
- return m++, g;
690
+ return h++, g;
597
691
  });
598
692
  return {
599
693
  artifacts: w,
600
- html: h
694
+ html: f
601
695
  };
602
696
  }
603
- function ta() {
697
+ function ra() {
604
698
  let e = {
605
699
  artifacts: [],
606
700
  activeArtifactId: null,
@@ -619,64 +713,64 @@ function ta() {
619
713
  };
620
714
  const t = /* @__PURE__ */ new Set();
621
715
  function r() {
622
- t.forEach((M) => {
716
+ t.forEach(($) => {
623
717
  try {
624
- M(e);
718
+ $(e);
625
719
  } catch (y) {
626
720
  console.error("Artifactuse state subscriber error:", y);
627
721
  }
628
722
  });
629
723
  }
630
- function a(M) {
631
- return t.add(M), M(e), () => {
632
- t.delete(M);
724
+ function a($) {
725
+ return t.add($), $(e), () => {
726
+ t.delete($);
633
727
  };
634
728
  }
635
729
  function s() {
636
730
  return { ...e };
637
731
  }
638
- function n(M) {
639
- const y = e.artifacts.findIndex((z) => z.id === M.id);
732
+ function n($) {
733
+ const y = e.artifacts.findIndex((z) => z.id === $.id);
640
734
  if (y === -1)
641
735
  e = {
642
736
  ...e,
643
- artifacts: [...e.artifacts, M]
737
+ artifacts: [...e.artifacts, $]
644
738
  };
645
739
  else {
646
740
  const z = [...e.artifacts];
647
- z[y] = { ...z[y], ...M }, e = {
741
+ z[y] = { ...z[y], ...$ }, e = {
648
742
  ...e,
649
743
  artifacts: z
650
744
  };
651
745
  }
652
746
  r();
653
747
  }
654
- function o(M) {
655
- M.forEach(n);
748
+ function o($) {
749
+ $.forEach(n);
656
750
  }
657
- function i(M) {
658
- const y = e.openTabs.filter((P) => P !== M), { [M]: z, ...H } = e.tabViewModes;
751
+ function i($) {
752
+ const y = e.openTabs.filter((E) => E !== $), { [$]: z, ...j } = e.tabViewModes;
659
753
  e = {
660
754
  ...e,
661
- artifacts: e.artifacts.filter((P) => P.id !== M),
662
- activeArtifactId: e.activeArtifactId === M ? null : e.activeArtifactId,
663
- isPanelOpen: e.activeArtifactId === M ? !1 : e.isPanelOpen,
755
+ artifacts: e.artifacts.filter((E) => E.id !== $),
756
+ activeArtifactId: e.activeArtifactId === $ ? null : e.activeArtifactId,
757
+ isPanelOpen: e.activeArtifactId === $ ? !1 : e.isPanelOpen,
664
758
  openTabs: y,
665
- tabViewModes: H
759
+ tabViewModes: j
666
760
  }, r();
667
761
  }
668
- function u(M) {
669
- return e.artifacts.find((y) => y.id === M) || null;
762
+ function u($) {
763
+ return e.artifacts.find((y) => y.id === $) || null;
670
764
  }
671
765
  function l() {
672
766
  return e.activeArtifactId ? u(e.activeArtifactId) : null;
673
767
  }
674
- function d(M) {
675
- const y = u(M);
676
- let z = e.tabViewModes[M];
768
+ function d($) {
769
+ const y = u($);
770
+ let z = e.tabViewModes[$];
677
771
  z || (z = (y == null ? void 0 : y.isPreviewable) === !1 ? "code" : "preview", y != null && y.tabs && !y.tabs.includes(z) && (z = y.tabs[0])), e = {
678
772
  ...e,
679
- activeArtifactId: M,
773
+ activeArtifactId: $,
680
774
  viewMode: z,
681
775
  forceEmptyView: !1
682
776
  }, r();
@@ -687,82 +781,82 @@ function ta() {
687
781
  activeArtifactId: null
688
782
  }, r();
689
783
  }
690
- function w(M) {
784
+ function w($) {
691
785
  e = {
692
786
  ...e,
693
- isPanelOpen: M,
694
- isFullscreen: M ? e.isFullscreen : !1
787
+ isPanelOpen: $,
788
+ isFullscreen: $ ? e.isFullscreen : !1
695
789
  }, r();
696
790
  }
697
- function c(M) {
698
- if (!["preview", "code", "split", "edit"].includes(M)) {
699
- console.warn(`Invalid view mode: ${M}`);
791
+ function c($) {
792
+ if (!["preview", "code", "split", "edit"].includes($)) {
793
+ console.warn(`Invalid view mode: ${$}`);
700
794
  return;
701
795
  }
702
- const y = e.activeArtifactId ? { ...e.tabViewModes, [e.activeArtifactId]: M } : e.tabViewModes;
796
+ const y = e.activeArtifactId ? { ...e.tabViewModes, [e.activeArtifactId]: $ } : e.tabViewModes;
703
797
  e = {
704
798
  ...e,
705
- viewMode: M,
799
+ viewMode: $,
706
800
  tabViewModes: y
707
801
  }, r();
708
802
  }
709
- function m(M) {
803
+ function h($) {
710
804
  e = {
711
805
  ...e,
712
- isFullscreen: M
806
+ isFullscreen: $
713
807
  }, r();
714
808
  }
715
- function h(M) {
809
+ function f($) {
716
810
  e = {
717
811
  ...e,
718
- forceEmptyView: !!M
812
+ forceEmptyView: !!$
719
813
  }, r();
720
814
  }
721
- function g(M) {
722
- return e.artifacts.filter((y) => y.messageId === M);
815
+ function g($) {
816
+ return e.artifacts.filter((y) => y.messageId === $);
723
817
  }
724
- function f(M) {
725
- return e.artifacts.filter((y) => y.type === M);
818
+ function m($) {
819
+ return e.artifacts.filter((y) => y.type === $);
726
820
  }
727
821
  function b() {
728
822
  return e.artifacts.length;
729
823
  }
730
- function v(M) {
731
- const y = u(M);
824
+ function v($) {
825
+ const y = u($);
732
826
  if (!y) return;
733
- const H = e.openTabs.includes(M) ? e.openTabs : [...e.openTabs, M];
734
- let P = e.tabViewModes[M];
735
- P || (P = y.isPreviewable === !1 ? "code" : "preview", y.tabs && !y.tabs.includes(P) && (P = y.tabs[0])), e = {
827
+ const j = e.openTabs.includes($) ? e.openTabs : [...e.openTabs, $];
828
+ let E = e.tabViewModes[$];
829
+ E || (E = y.isPreviewable === !1 ? "code" : "preview", y.tabs && !y.tabs.includes(E) && (E = y.tabs[0])), e = {
736
830
  ...e,
737
- openTabs: H,
738
- activeArtifactId: M,
739
- tabViewModes: { ...e.tabViewModes, [M]: P },
740
- viewMode: P
831
+ openTabs: j,
832
+ activeArtifactId: $,
833
+ tabViewModes: { ...e.tabViewModes, [$]: E },
834
+ viewMode: E
741
835
  }, r();
742
836
  }
743
- function x(M) {
744
- const y = e.openTabs.indexOf(M);
837
+ function x($) {
838
+ const y = e.openTabs.indexOf($);
745
839
  if (y === -1) return;
746
- const z = e.openTabs.filter((K) => K !== M), { [M]: H, ...P } = e.tabViewModes;
840
+ const z = e.openTabs.filter((X) => X !== $), { [$]: j, ...E } = e.tabViewModes;
747
841
  let T = e.activeArtifactId;
748
- e.activeArtifactId === M && (z.length === 0 ? T = null : y >= z.length ? T = z[z.length - 1] : T = z[y]);
749
- const W = T && P[T] || "preview";
842
+ e.activeArtifactId === $ && (z.length === 0 ? T = null : y >= z.length ? T = z[z.length - 1] : T = z[y]);
843
+ const N = T && E[T] || "preview";
750
844
  e = {
751
845
  ...e,
752
846
  openTabs: z,
753
847
  activeArtifactId: T,
754
- tabViewModes: P,
755
- viewMode: W
848
+ tabViewModes: E,
849
+ viewMode: N
756
850
  }, r();
757
851
  }
758
- function $(M) {
759
- if (!u(M)) return;
760
- const z = e.tabViewModes[M] || e.viewMode;
852
+ function M($) {
853
+ if (!u($)) return;
854
+ const z = e.tabViewModes[$] || e.viewMode;
761
855
  e = {
762
856
  ...e,
763
- openTabs: [M],
764
- activeArtifactId: M,
765
- tabViewModes: { [M]: z },
857
+ openTabs: [$],
858
+ activeArtifactId: $,
859
+ tabViewModes: { [$]: z },
766
860
  viewMode: z
767
861
  }, r();
768
862
  }
@@ -774,7 +868,7 @@ function ta() {
774
868
  tabViewModes: {}
775
869
  }, r();
776
870
  }
777
- function C() {
871
+ function S() {
778
872
  e = {
779
873
  artifacts: [],
780
874
  activeArtifactId: null,
@@ -786,17 +880,17 @@ function ta() {
786
880
  forceEmptyView: !1
787
881
  }, r();
788
882
  }
789
- function R(M) {
883
+ function L($) {
790
884
  const y = r;
791
885
  let z = !1;
792
- const H = () => {
886
+ const j = () => {
793
887
  z = !0;
794
888
  };
795
889
  try {
796
890
  Object.defineProperty(window, "__artifactuse_notify__", {
797
- value: H,
891
+ value: j,
798
892
  configurable: !0
799
- }), M();
893
+ }), $();
800
894
  } finally {
801
895
  delete window.__artifactuse_notify__, z && y();
802
896
  }
@@ -812,71 +906,71 @@ function ta() {
812
906
  getArtifact: u,
813
907
  getActiveArtifact: l,
814
908
  getArtifactsByMessageId: g,
815
- getArtifactsByType: f,
909
+ getArtifactsByType: m,
816
910
  getArtifactCount: b,
817
911
  // Panel state
818
912
  setActiveArtifact: d,
819
913
  clearActiveArtifact: p,
820
914
  setPanelOpen: w,
821
915
  setViewMode: c,
822
- setFullscreen: m,
823
- setForceEmptyView: h,
916
+ setFullscreen: h,
917
+ setForceEmptyView: f,
824
918
  // Multi-tab
825
919
  openTab: v,
826
920
  closeTab: x,
827
- closeOtherTabs: $,
921
+ closeOtherTabs: M,
828
922
  closeAllTabs: A,
829
923
  // Utilities
830
- clear: C,
831
- batch: R
924
+ clear: S,
925
+ batch: L
832
926
  };
833
927
  }
834
- function ct(e) {
928
+ function ut(e) {
835
929
  try {
836
930
  return new URL(e).hostname;
837
931
  } catch {
838
932
  return null;
839
933
  }
840
934
  }
841
- function ra(e = []) {
935
+ function aa(e = []) {
842
936
  const t = Array.isArray(e) ? e : [e].filter(Boolean), r = new Set(t), a = /* @__PURE__ */ new Map();
843
937
  let s = null, n = !1, o = !1;
844
938
  const i = [];
845
939
  function u(y) {
846
940
  if (r.size === 0)
847
941
  return console.warn("Artifactuse bridge: No allowed origins configured, accepting all messages"), !0;
848
- const z = ct(y);
942
+ const z = ut(y);
849
943
  if (!z) return !1;
850
- for (const H of r) {
851
- const P = ct(H);
852
- if (P && P === z || H === z)
944
+ for (const j of r) {
945
+ const E = ut(j);
946
+ if (E && E === z || j === z)
853
947
  return !0;
854
948
  }
855
949
  return !1;
856
950
  }
857
951
  function l(y) {
858
- var U, J, k;
859
- if (((U = y.data) == null ? void 0 : U.type) === "artifactuse" && (console.log("[Bridge] Message from:", y.origin, "action:", (J = y.data) == null ? void 0 : J.action), console.log("[Bridge] Allowed origins:", w())), !u(y.origin)) {
952
+ var O, B, k;
953
+ if (((O = y.data) == null ? void 0 : O.type) === "artifactuse" && (console.log("[Bridge] Message from:", y.origin, "action:", (B = y.data) == null ? void 0 : B.action), console.log("[Bridge] Allowed origins:", w())), !u(y.origin)) {
860
954
  ((k = y.data) == null ? void 0 : k.type) === "artifactuse" && console.warn("[Bridge] Origin NOT allowed:", y.origin);
861
955
  return;
862
956
  }
863
- const { type: z, action: H, data: P, requestId: T } = y.data || {};
957
+ const { type: z, action: j, data: E, requestId: T } = y.data || {};
864
958
  if (z !== "artifactuse") return;
865
- if (H === "ready" || H === "panel:ready") {
866
- console.log("[Bridge] panel:ready received, setting isReady=true"), n = !0, o = !0, m();
959
+ if (j === "ready" || j === "panel:ready") {
960
+ console.log("[Bridge] panel:ready received, setting isReady=true"), n = !0, o = !0, h();
867
961
  return;
868
962
  }
869
- (a.get(H) || []).forEach((_) => {
963
+ (a.get(j) || []).forEach((P) => {
870
964
  try {
871
- _(P, T);
872
- } catch (L) {
873
- console.error(`Artifactuse bridge handler error (${H}):`, L);
965
+ P(E, T);
966
+ } catch (R) {
967
+ console.error(`Artifactuse bridge handler error (${j}):`, R);
874
968
  }
875
- }), (a.get("*") || []).forEach((_) => {
969
+ }), (a.get("*") || []).forEach((P) => {
876
970
  try {
877
- _({ action: H, data: P, requestId: T });
878
- } catch (L) {
879
- console.error("Artifactuse bridge wildcard handler error:", L);
971
+ P({ action: j, data: E, requestId: T });
972
+ } catch (R) {
973
+ console.error("Artifactuse bridge wildcard handler error:", R);
880
974
  }
881
975
  });
882
976
  }
@@ -891,80 +985,80 @@ function ra(e = []) {
891
985
  return [...r];
892
986
  }
893
987
  function c(y) {
894
- console.log("[Bridge] setIframe called, current isReady:", n, "readySignalReceived:", o, "same iframe:", s === y), s !== y && (s = y, o ? (console.log("[Bridge] Ready signal was already received, keeping isReady=true"), n = !0) : n = !1), console.log("[Bridge] setIframe done, isReady:", n, "pendingMessages:", i.length), m();
988
+ console.log("[Bridge] setIframe called, current isReady:", n, "readySignalReceived:", o, "same iframe:", s === y), s !== y && (s = y, o ? (console.log("[Bridge] Ready signal was already received, keeping isReady=true"), n = !0) : n = !1), console.log("[Bridge] setIframe done, isReady:", n, "pendingMessages:", i.length), h();
895
989
  }
896
- function m() {
897
- console.log("[Bridge] flushPendingMessages: isReady=", n, "hasIframe=", !!(s != null && s.contentWindow), "pending=", i.length), n && (s != null && s.contentWindow) && i.length > 0 && (console.log("[Bridge] Flushing", i.length, "pending messages"), i.forEach((y) => h(y)), i.length = 0);
990
+ function h() {
991
+ console.log("[Bridge] flushPendingMessages: isReady=", n, "hasIframe=", !!(s != null && s.contentWindow), "pending=", i.length), n && (s != null && s.contentWindow) && i.length > 0 && (console.log("[Bridge] Flushing", i.length, "pending messages"), i.forEach((y) => f(y)), i.length = 0);
898
992
  }
899
- function h(y, z = "*") {
993
+ function f(y, z = "*") {
900
994
  if (!(s != null && s.contentWindow))
901
995
  return console.warn("Artifactuse: No panel iframe available"), !1;
902
996
  try {
903
997
  return s.contentWindow.postMessage(y, z), !0;
904
- } catch (H) {
905
- return console.error("Artifactuse bridge send error:", H), !1;
998
+ } catch (j) {
999
+ return console.error("Artifactuse bridge send error:", j), !1;
906
1000
  }
907
1001
  }
908
- function g(y, z, H = null, P = "*") {
1002
+ function g(y, z, j = null, E = "*") {
909
1003
  const T = {
910
1004
  type: "artifactuse",
911
1005
  action: y,
912
1006
  data: z,
913
- requestId: H || ut(),
1007
+ requestId: j || dt(),
914
1008
  timestamp: Date.now()
915
1009
  };
916
- return n ? (h(T, P), T.requestId) : (i.push(T), T.requestId);
917
- }
918
- function f(y, z, H = 3e4) {
919
- return new Promise((P, T) => {
920
- const W = ut(), K = setTimeout(() => {
921
- v(`${y}:response`, U), T(new Error(`Artifactuse bridge request timeout: ${y}`));
922
- }, H), U = (J, k) => {
923
- k === W && (clearTimeout(K), v(`${y}:response`, U), P(J));
1010
+ return n ? (f(T, E), T.requestId) : (i.push(T), T.requestId);
1011
+ }
1012
+ function m(y, z, j = 3e4) {
1013
+ return new Promise((E, T) => {
1014
+ const N = dt(), X = setTimeout(() => {
1015
+ v(`${y}:response`, O), T(new Error(`Artifactuse bridge request timeout: ${y}`));
1016
+ }, j), O = (B, k) => {
1017
+ k === N && (clearTimeout(X), v(`${y}:response`, O), E(B));
924
1018
  };
925
- b(`${y}:response`, U), g(y, z, W);
1019
+ b(`${y}:response`, O), g(y, z, N);
926
1020
  });
927
1021
  }
928
1022
  function b(y, z) {
929
1023
  return a.has(y) || a.set(y, []), a.get(y).push(z), () => v(y, z);
930
1024
  }
931
1025
  function v(y, z) {
932
- const H = a.get(y);
933
- if (H) {
934
- const P = H.indexOf(z);
935
- P > -1 && H.splice(P, 1);
1026
+ const j = a.get(y);
1027
+ if (j) {
1028
+ const E = j.indexOf(z);
1029
+ E > -1 && j.splice(E, 1);
936
1030
  }
937
1031
  }
938
1032
  function x(y) {
939
1033
  return g("load:artifact", y);
940
1034
  }
941
- function $(y, z) {
1035
+ function M(y, z) {
942
1036
  return g("update:artifact", { artifactId: y, updates: z });
943
1037
  }
944
1038
  function A() {
945
- return f("save", {});
1039
+ return m("save", {});
946
1040
  }
947
- function C(y = "default") {
948
- return f("export", { format: y });
1041
+ function S(y = "default") {
1042
+ return m("export", { format: y });
949
1043
  }
950
- function R(y, z) {
1044
+ function L(y, z) {
951
1045
  return g("ai:response", y, z);
952
1046
  }
953
- function M() {
1047
+ function $() {
954
1048
  window.removeEventListener("message", l), a.clear(), r.clear(), s = null, n = !1, o = !1, i.length = 0;
955
1049
  }
956
1050
  return {
957
1051
  setIframe: c,
958
1052
  send: g,
959
- request: f,
1053
+ request: m,
960
1054
  on: b,
961
1055
  off: v,
962
1056
  loadArtifact: x,
963
- updateArtifact: $,
1057
+ updateArtifact: M,
964
1058
  requestSave: A,
965
- requestExport: C,
966
- sendAIResponse: R,
967
- destroy: M,
1059
+ requestExport: S,
1060
+ sendAIResponse: L,
1061
+ destroy: $,
968
1062
  // Origin management
969
1063
  addAllowedOrigin: d,
970
1064
  removeAllowedOrigin: p,
@@ -978,10 +1072,10 @@ function ra(e = []) {
978
1072
  }
979
1073
  };
980
1074
  }
981
- function ut() {
1075
+ function dt() {
982
1076
  return `req-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
983
1077
  }
984
- function aa(e) {
1078
+ function sa(e) {
985
1079
  if (!e) return null;
986
1080
  if (typeof e == "string" && e.includes(","))
987
1081
  return e.trim();
@@ -991,22 +1085,22 @@ function aa(e) {
991
1085
  const r = parseInt(t.slice(0, 2), 16), a = parseInt(t.slice(2, 4), 16), s = parseInt(t.slice(4, 6), 16);
992
1086
  return `${r}, ${a}, ${s}`;
993
1087
  }
994
- function sa(e) {
995
- return e ? aa(e) : null;
1088
+ function na(e) {
1089
+ return e ? sa(e) : null;
996
1090
  }
997
- function ve(e) {
1091
+ function ye(e) {
998
1092
  if (!e || typeof e != "object") return {};
999
1093
  const t = {};
1000
1094
  for (const [r, a] of Object.entries(e))
1001
1095
  if (r === "gradientOpacity" || typeof a == "number")
1002
1096
  t[r] = a;
1003
1097
  else {
1004
- const s = sa(a);
1098
+ const s = na(a);
1005
1099
  s && (t[r] = s);
1006
1100
  }
1007
1101
  return t;
1008
1102
  }
1009
- const dt = {
1103
+ const pt = {
1010
1104
  // Dark theme
1011
1105
  dark: {
1012
1106
  primary: "99, 102, 241",
@@ -1076,16 +1170,16 @@ const dt = {
1076
1170
  gradientOpacity: "0.25"
1077
1171
  }
1078
1172
  };
1079
- function na(e = "auto", t = {}) {
1173
+ function ia(e = "auto", t = {}) {
1080
1174
  let r = e, a = {
1081
- dark: { ...dt.dark },
1082
- light: { ...dt.light }
1175
+ dark: { ...pt.dark },
1176
+ light: { ...pt.light }
1083
1177
  };
1084
- t.dark && (a.dark = { ...a.dark, ...ve(t.dark) }), t.light && (a.light = { ...a.light, ...ve(t.light) });
1178
+ t.dark && (a.dark = { ...a.dark, ...ye(t.dark) }), t.light && (a.light = { ...a.light, ...ye(t.light) });
1085
1179
  const s = { ...t };
1086
1180
  if (delete s.dark, delete s.light, Object.keys(s).length > 0) {
1087
- const m = ve(s);
1088
- a.dark = { ...a.dark, ...m }, a.light = { ...a.light, ...m };
1181
+ const h = ye(s);
1182
+ a.dark = { ...a.dark, ...h }, a.light = { ...a.light, ...h };
1089
1183
  }
1090
1184
  function n() {
1091
1185
  return r === "auto" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : r;
@@ -1094,55 +1188,55 @@ function na(e = "auto", t = {}) {
1094
1188
  return a[n()];
1095
1189
  }
1096
1190
  function i() {
1097
- const m = o();
1098
- return Object.entries(m).map(([h, g]) => `--artifactuse-${le(h)}: ${g};`).join(`
1191
+ const h = o();
1192
+ return Object.entries(h).map(([f, g]) => `--artifactuse-${ce(f)}: ${g};`).join(`
1099
1193
  `);
1100
1194
  }
1101
- function u(m = document.documentElement) {
1102
- const h = o(), g = n();
1103
- Object.entries(h).forEach(([f, b]) => {
1104
- m.style.setProperty(`--artifactuse-${le(f)}`, b);
1105
- }), m.setAttribute("data-artifactuse-theme", g), m.classList.remove("artifactuse-dark", "artifactuse-light"), m.classList.add(`artifactuse-${g}`);
1195
+ function u(h = document.documentElement) {
1196
+ const f = o(), g = n();
1197
+ Object.entries(f).forEach(([m, b]) => {
1198
+ h.style.setProperty(`--artifactuse-${ce(m)}`, b);
1199
+ }), h.setAttribute("data-artifactuse-theme", g), h.classList.remove("artifactuse-dark", "artifactuse-light"), h.classList.add(`artifactuse-${g}`);
1106
1200
  }
1107
- function l(m) {
1108
- if (!["dark", "light", "auto"].includes(m)) {
1109
- console.warn(`Invalid theme: ${m}`);
1201
+ function l(h) {
1202
+ if (!["dark", "light", "auto"].includes(h)) {
1203
+ console.warn(`Invalid theme: ${h}`);
1110
1204
  return;
1111
1205
  }
1112
- r = m, u();
1206
+ r = h, u();
1113
1207
  }
1114
1208
  function d() {
1115
- const m = n();
1116
- l(m === "dark" ? "light" : "dark");
1209
+ const h = n();
1210
+ l(h === "dark" ? "light" : "dark");
1117
1211
  }
1118
- function p(m, h = null) {
1119
- const g = ve(m);
1120
- h ? a[h] = { ...a[h], ...g } : (a.dark = { ...a.dark, ...g }, a.light = { ...a.light, ...g }), u();
1212
+ function p(h, f = null) {
1213
+ const g = ye(h);
1214
+ f ? a[f] = { ...a[f], ...g } : (a.dark = { ...a.dark, ...g }, a.light = { ...a.light, ...g }), u();
1121
1215
  }
1122
- function w(m) {
1123
- const h = window.matchMedia("(prefers-color-scheme: dark)"), g = (f) => {
1124
- r === "auto" && (u(), m && m(f.matches ? "dark" : "light"));
1216
+ function w(h) {
1217
+ const f = window.matchMedia("(prefers-color-scheme: dark)"), g = (m) => {
1218
+ r === "auto" && (u(), h && h(m.matches ? "dark" : "light"));
1125
1219
  };
1126
- return h.addEventListener("change", g), () => {
1127
- h.removeEventListener("change", g);
1220
+ return f.addEventListener("change", g), () => {
1221
+ f.removeEventListener("change", g);
1128
1222
  };
1129
1223
  }
1130
1224
  function c() {
1131
1225
  return `
1132
1226
  :root,
1133
1227
  [data-artifactuse-theme="dark"] {
1134
- ${Object.entries(a.dark).map(([m, h]) => `--artifactuse-${le(m)}: ${h};`).join(`
1228
+ ${Object.entries(a.dark).map(([h, f]) => `--artifactuse-${ce(h)}: ${f};`).join(`
1135
1229
  `)}
1136
1230
  }
1137
1231
 
1138
1232
  [data-artifactuse-theme="light"] {
1139
- ${Object.entries(a.light).map(([m, h]) => `--artifactuse-${le(m)}: ${h};`).join(`
1233
+ ${Object.entries(a.light).map(([h, f]) => `--artifactuse-${ce(h)}: ${f};`).join(`
1140
1234
  `)}
1141
1235
  }
1142
1236
 
1143
1237
  @media (prefers-color-scheme: light) {
1144
1238
  :root:not([data-artifactuse-theme]) {
1145
- ${Object.entries(a.light).map(([m, h]) => `--artifactuse-${le(m)}: ${h};`).join(`
1239
+ ${Object.entries(a.light).map(([h, f]) => `--artifactuse-${ce(h)}: ${f};`).join(`
1146
1240
  `)}
1147
1241
  }
1148
1242
  }
@@ -1169,11 +1263,11 @@ function na(e = "auto", t = {}) {
1169
1263
  watchSystemTheme: w
1170
1264
  };
1171
1265
  }
1172
- function le(e) {
1266
+ function ce(e) {
1173
1267
  return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1174
1268
  }
1175
- const Xe = "artifactuse_auth", gr = "https://app.artifactuse.com", ge = "https://api.artifactuse.com";
1176
- function Le() {
1269
+ const Xe = "artifactuse_auth", mr = "https://app.artifactuse.com", we = "https://api.artifactuse.com";
1270
+ function Te() {
1177
1271
  if (typeof window > "u" || !window.localStorage)
1178
1272
  return null;
1179
1273
  try {
@@ -1183,15 +1277,15 @@ function Le() {
1183
1277
  return null;
1184
1278
  }
1185
1279
  }
1186
- function ia(e) {
1280
+ function oa(e) {
1187
1281
  if (!(typeof window > "u" || !window.localStorage))
1188
1282
  try {
1189
1283
  localStorage.setItem(Xe, JSON.stringify(e));
1190
1284
  } catch {
1191
1285
  }
1192
1286
  }
1193
- async function oa(e, t = {}) {
1194
- const { apiUrl: r = ge } = t, a = await fetch(`${r}/v1/project/share`, {
1287
+ async function la(e, t = {}) {
1288
+ const { apiUrl: r = we } = t, a = await fetch(`${r}/v1/project/share`, {
1195
1289
  method: "POST",
1196
1290
  headers: {
1197
1291
  "Content-Type": "application/json"
@@ -1208,8 +1302,8 @@ async function oa(e, t = {}) {
1208
1302
  }
1209
1303
  return a.json();
1210
1304
  }
1211
- async function la(e, t = {}) {
1212
- const { apiUrl: r = ge, getStoredAuthData: a = Le } = t, s = a();
1305
+ async function ca(e, t = {}) {
1306
+ const { apiUrl: r = we, getStoredAuthData: a = Te } = t, s = a();
1213
1307
  if (!(s != null && s.token))
1214
1308
  throw new Error("Authentication required. Please sign in first.");
1215
1309
  const n = await fetch(`${r}/v1/project/save`, {
@@ -1230,11 +1324,11 @@ async function la(e, t = {}) {
1230
1324
  }
1231
1325
  return n.json();
1232
1326
  }
1233
- function ca(e = {}) {
1327
+ function ua(e = {}) {
1234
1328
  const {
1235
- appUrl: t = gr,
1236
- setStoredAuthData: r = ia,
1237
- getStoredAuthData: a = Le
1329
+ appUrl: t = mr,
1330
+ setStoredAuthData: r = oa,
1331
+ getStoredAuthData: a = Te
1238
1332
  } = e;
1239
1333
  return new Promise((s, n) => {
1240
1334
  const o = window.location.origin, i = `${t}/sdk/auth?origin=${encodeURIComponent(o)}`, u = window.open(
@@ -1250,8 +1344,8 @@ function ca(e = {}) {
1250
1344
  var w;
1251
1345
  if (p.origin === t && ((w = p.data) == null ? void 0 : w.type) === "sdk-auth") {
1252
1346
  window.removeEventListener("message", l);
1253
- const { token: c, user: m } = p.data;
1254
- c ? (r({ token: c, user: m }), s({ token: c, user: m })) : n(new Error("Authentication failed"));
1347
+ const { token: c, user: h } = p.data;
1348
+ c ? (r({ token: c, user: h }), s({ token: c, user: h })) : n(new Error("Authentication failed"));
1255
1349
  }
1256
1350
  };
1257
1351
  window.addEventListener("message", l);
@@ -1264,8 +1358,8 @@ function ca(e = {}) {
1264
1358
  }, 500);
1265
1359
  });
1266
1360
  }
1267
- async function ua(e = {}) {
1268
- const { apiUrl: t = ge, language: r, getStoredAuthData: a = Le } = e, s = a();
1361
+ async function da(e = {}) {
1362
+ const { apiUrl: t = we, language: r, getStoredAuthData: a = Te } = e, s = a();
1269
1363
  if (!(s != null && s.token))
1270
1364
  throw new Error("Authentication required. Please sign in first.");
1271
1365
  const n = new URLSearchParams();
@@ -1283,8 +1377,8 @@ async function ua(e = {}) {
1283
1377
  }
1284
1378
  return o.json();
1285
1379
  }
1286
- async function da(e, t, r = {}) {
1287
- const { apiUrl: a = ge, getStoredAuthData: s = Le } = r, n = s();
1380
+ async function pa(e, t, r = {}) {
1381
+ const { apiUrl: a = we, getStoredAuthData: s = Te } = r, n = s();
1288
1382
  if (!(n != null && n.token))
1289
1383
  throw new Error("Authentication required. Please sign in first.");
1290
1384
  const o = await fetch(`${a}/v1/project/update`, {
@@ -1305,10 +1399,10 @@ async function da(e, t, r = {}) {
1305
1399
  }
1306
1400
  return o.json();
1307
1401
  }
1308
- function pa(e = {}) {
1402
+ function fa(e = {}) {
1309
1403
  const {
1310
- apiUrl: t = ge,
1311
- appUrl: r = gr,
1404
+ apiUrl: t = we,
1405
+ appUrl: r = mr,
1312
1406
  storageKey: a = Xe,
1313
1407
  enabled: s = !0,
1314
1408
  allowAnonymous: n = !0,
@@ -1357,14 +1451,14 @@ function pa(e = {}) {
1357
1451
  clearStoredAuthData: l,
1358
1452
  signOut: l,
1359
1453
  // API methods
1360
- share: (d) => oa(d, { apiUrl: t }),
1361
- save: (d) => la(d, { apiUrl: t, getStoredAuthData: i }),
1362
- listArtifacts: (d) => ua({ apiUrl: t, language: d, getStoredAuthData: i }),
1363
- updateArtifact: (d, p) => da(d, p, { apiUrl: t, getStoredAuthData: i }),
1364
- openAuthPopup: () => ca({ appUrl: r, setStoredAuthData: u, getStoredAuthData: i })
1454
+ share: (d) => la(d, { apiUrl: t }),
1455
+ save: (d) => ca(d, { apiUrl: t, getStoredAuthData: i }),
1456
+ listArtifacts: (d) => da({ apiUrl: t, language: d, getStoredAuthData: i }),
1457
+ updateArtifact: (d, p) => pa(d, p, { apiUrl: t, getStoredAuthData: i }),
1458
+ openAuthPopup: () => ua({ appUrl: r, setStoredAuthData: u, getStoredAuthData: i })
1365
1459
  };
1366
1460
  }
1367
- function fa(e = {}) {
1461
+ function ha(e = {}) {
1368
1462
  const t = e.modules || null;
1369
1463
  let r = e.theme || "dark";
1370
1464
  function a() {
@@ -1517,8 +1611,8 @@ function fa(e = {}) {
1517
1611
  }
1518
1612
  }, { dark: !1 });
1519
1613
  }
1520
- function o(w, c, m) {
1521
- return m ? w.define([
1614
+ function o(w, c, h) {
1615
+ return h ? w.define([
1522
1616
  { tag: c.keyword, color: "#c084fc" },
1523
1617
  { tag: c.operator, color: "#94a3b8" },
1524
1618
  { tag: c.special(c.variableName), color: "#67e8f9" },
@@ -1611,95 +1705,95 @@ function fa(e = {}) {
1611
1705
  function u(w) {
1612
1706
  const c = i[w == null ? void 0 : w.toLowerCase()];
1613
1707
  if (!c) return [];
1614
- const m = t[c.mod];
1615
- return !m || typeof m[c.fn] != "function" ? [] : c.opts ? m[c.fn](c.opts) : m[c.fn]();
1708
+ const h = t[c.mod];
1709
+ return !h || typeof h[c.fn] != "function" ? [] : c.opts ? h[c.fn](c.opts) : h[c.fn]();
1616
1710
  }
1617
1711
  function l(w) {
1618
1712
  return r === "auto" ? w === "dark" : r === "dark";
1619
1713
  }
1620
1714
  function d(w, c = {}) {
1621
- var B, be;
1715
+ var U, ve;
1622
1716
  if (!a())
1623
1717
  return console.warn("Artifactuse: CodeMirror modules not provided. Editor not available."), null;
1624
- const { EditorState: m } = t.state, {
1625
- EditorView: h,
1718
+ const { EditorState: h } = t.state, {
1719
+ EditorView: f,
1626
1720
  keymap: g,
1627
- lineNumbers: f,
1721
+ lineNumbers: m,
1628
1722
  highlightActiveLineGutter: b,
1629
1723
  highlightSpecialChars: v,
1630
1724
  drawSelection: x,
1631
- dropCursor: $,
1725
+ dropCursor: M,
1632
1726
  rectangularSelection: A,
1633
- crosshairCursor: C,
1634
- highlightActiveLine: R
1635
- } = t.view, { defaultKeymap: M, history: y, historyKeymap: z, indentWithTab: H } = t.commands, {
1636
- indentOnInput: P,
1727
+ crosshairCursor: S,
1728
+ highlightActiveLine: L
1729
+ } = t.view, { defaultKeymap: $, history: y, historyKeymap: z, indentWithTab: j } = t.commands, {
1730
+ indentOnInput: E,
1637
1731
  syntaxHighlighting: T,
1638
- bracketMatching: W,
1639
- foldGutter: K,
1640
- foldKeymap: U,
1641
- HighlightStyle: J
1732
+ bracketMatching: N,
1733
+ foldGutter: X,
1734
+ foldKeymap: O,
1735
+ HighlightStyle: B
1642
1736
  } = t.language, {
1643
1737
  closeBrackets: k,
1644
- closeBracketsKeymap: _,
1645
- autocompletion: L,
1646
- completionKeymap: S
1647
- } = t.autocomplete, D = ((B = t.lezerHighlight) == null ? void 0 : B.tags) || ((be = t.language) == null ? void 0 : be.tags), E = l(c.sdkTheme), Z = E ? s(h) : n(h), ne = [
1648
- f(),
1738
+ closeBracketsKeymap: P,
1739
+ autocompletion: R,
1740
+ completionKeymap: C
1741
+ } = 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 = [
1742
+ m(),
1649
1743
  b(),
1650
1744
  v(),
1651
1745
  y(),
1652
- K({
1746
+ X({
1653
1747
  openText: "▾",
1654
1748
  closedText: "▸"
1655
1749
  }),
1656
1750
  x(),
1657
- $(),
1658
- m.allowMultipleSelections.of(!0),
1659
- P(),
1660
- ...D ? [T(o(J, D, E))] : [],
1661
- W(),
1751
+ M(),
1752
+ h.allowMultipleSelections.of(!0),
1753
+ E(),
1754
+ ...D ? [T(o(B, D, _))] : [],
1755
+ N(),
1662
1756
  k(),
1663
- L(),
1664
- A(),
1665
- C(),
1666
1757
  R(),
1758
+ A(),
1759
+ S(),
1760
+ L(),
1667
1761
  g.of([
1668
- ..._,
1669
- ...M,
1762
+ ...P,
1763
+ ...$,
1670
1764
  ...z,
1671
- ...U,
1672
- ...S,
1673
- H
1765
+ ...O,
1766
+ ...C,
1767
+ j
1674
1768
  ]),
1675
1769
  u(c.language),
1676
- Z
1770
+ q
1677
1771
  ];
1678
- c.onChange && ne.push(
1679
- h.updateListener.of((Q) => {
1680
- Q.docChanged && c.onChange(Q.state.doc.toString());
1772
+ c.onChange && J.push(
1773
+ f.updateListener.of((Y) => {
1774
+ Y.docChanged && c.onChange(Y.state.doc.toString());
1681
1775
  })
1682
1776
  );
1683
- const oe = m.create({
1777
+ const le = h.create({
1684
1778
  doc: c.code || "",
1685
- extensions: ne
1686
- }), G = new h({
1687
- state: oe,
1779
+ extensions: J
1780
+ }), K = new f({
1781
+ state: le,
1688
1782
  parent: w
1689
1783
  });
1690
1784
  return {
1691
- view: G,
1785
+ view: K,
1692
1786
  getCode() {
1693
- return G.state.doc.toString();
1787
+ return K.state.doc.toString();
1694
1788
  },
1695
- setCode(Q) {
1696
- const it = G.state.doc.toString();
1697
- it !== Q && G.dispatch({
1698
- changes: { from: 0, to: it.length, insert: Q }
1789
+ setCode(Y) {
1790
+ const it = K.state.doc.toString();
1791
+ it !== Y && K.dispatch({
1792
+ changes: { from: 0, to: it.length, insert: Y }
1699
1793
  });
1700
1794
  },
1701
1795
  destroy() {
1702
- G.destroy();
1796
+ K.destroy();
1703
1797
  }
1704
1798
  };
1705
1799
  }
@@ -1715,53 +1809,53 @@ function fa(e = {}) {
1715
1809
  function Ke() {
1716
1810
  return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
1717
1811
  }
1718
- var se = Ke();
1719
- function mr(e) {
1720
- se = e;
1812
+ var ie = Ke();
1813
+ function wr(e) {
1814
+ ie = e;
1721
1815
  }
1722
- var he = { exec: () => null };
1723
- function j(e, t = "") {
1816
+ var me = { exec: () => null };
1817
+ function H(e, t = "") {
1724
1818
  let r = typeof e == "string" ? e : e.source, a = { replace: (s, n) => {
1725
1819
  let o = typeof n == "string" ? n : n.source;
1726
- return o = o.replace(q.caret, "$1"), r = r.replace(s, o), a;
1820
+ return o = o.replace(Z.caret, "$1"), r = r.replace(s, o), a;
1727
1821
  }, getRegex: () => new RegExp(r, t) };
1728
1822
  return a;
1729
1823
  }
1730
- var ha = (() => {
1824
+ var ga = (() => {
1731
1825
  try {
1732
1826
  return !!new RegExp("(?<=1)(?<!1)");
1733
1827
  } catch {
1734
1828
  return !1;
1735
1829
  }
1736
- })(), q = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (e) => new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}#`), htmlBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}<(?:[a-z].*>|!--)`, "i") }, ga = /^(?:[ \t]*(?:\n|$))+/, ma = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, wa = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, me = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, ba = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Je = /(?:[*+-]|\d{1,9}[.)])/, wr = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, br = j(wr).replace(/bull/g, Je).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), va = j(wr).replace(/bull/g, Je).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), Qe = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, ya = /^[^\n]+/, Ye = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, ka = j(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Ye).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), xa = j(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Je).getRegex(), Te = "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]*?(?:-->|$))/, Ma = j("^ {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", Te).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), vr = j(Qe).replace("hr", me).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Te).getRegex(), $a = j(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", vr).getRegex(), tt = { blockquote: $a, code: ma, def: ka, fences: wa, heading: ba, hr: me, html: Ma, lheading: br, list: xa, newline: ga, paragraph: vr, table: he, text: ya }, pt = j("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", me).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Te).getRegex(), Aa = { ...tt, lheading: va, table: pt, paragraph: j(Qe).replace("hr", me).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", pt).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Te).getRegex() }, za = { ...tt, html: j(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", et).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: he, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: j(Qe).replace("hr", me).replace("heading", ` *#{1,6} *[^
1737
- ]`).replace("lheading", br).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Sa = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ca = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, yr = /^( {2,}|\\)\n(?!\s*$)/, Ra = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, _e = /[\p{P}\p{S}]/u, rt = /[\s\p{P}\p{S}]/u, kr = /[^\s\p{P}\p{S}]/u, La = j(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, rt).getRegex(), xr = /(?!~)[\p{P}\p{S}]/u, Ta = /(?!~)[\s\p{P}\p{S}]/u, _a = /(?:[^\s\p{P}\p{S}]|~)/u, Ea = j(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", ha ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Mr = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Pa = j(Mr, "u").replace(/punct/g, _e).getRegex(), ja = j(Mr, "u").replace(/punct/g, xr).getRegex(), $r = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ha = j($r, "gu").replace(/notPunctSpace/g, kr).replace(/punctSpace/g, rt).replace(/punct/g, _e).getRegex(), Va = j($r, "gu").replace(/notPunctSpace/g, _a).replace(/punctSpace/g, Ta).replace(/punct/g, xr).getRegex(), Ia = j("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, kr).replace(/punctSpace/g, rt).replace(/punct/g, _e).getRegex(), Da = j(/\\(punct)/, "gu").replace(/punct/g, _e).getRegex(), qa = j(/^<(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(), Za = j(et).replace("(?:-->|$)", "-->").getRegex(), Oa = j("^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", Za).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), $e = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Ba = j(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", $e).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Ar = j(/^!?\[(label)\]\[(ref)\]/).replace("label", $e).replace("ref", Ye).getRegex(), zr = j(/^!?\[(ref)\](?:\[\])?/).replace("ref", Ye).getRegex(), Fa = j("reflink|nolink(?!\\()", "g").replace("reflink", Ar).replace("nolink", zr).getRegex(), ft = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, at = { _backpedal: he, anyPunctuation: Da, autolink: qa, blockSkip: Ea, br: yr, code: Ca, del: he, emStrongLDelim: Pa, emStrongRDelimAst: Ha, emStrongRDelimUnd: Ia, escape: Sa, link: Ba, nolink: zr, punctuation: La, reflink: Ar, reflinkSearch: Fa, tag: Oa, text: Ra, url: he }, Na = { ...at, link: j(/^!?\[(label)\]\((.*?)\)/).replace("label", $e).getRegex(), reflink: j(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", $e).getRegex() }, Ve = { ...at, emStrongRDelimAst: Va, emStrongLDelim: ja, url: j(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ft).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: j(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ft).getRegex() }, Ua = { ...Ve, br: j(yr).replace("{2,}", "*").getRegex(), text: j(Ve.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, ye = { normal: tt, gfm: Aa, pedantic: za }, ce = { normal: at, gfm: Ve, breaks: Ua, pedantic: Na }, Ga = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, ht = (e) => Ga[e];
1738
- function X(e, t) {
1830
+ })(), 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} *[^
1831
+ ]`).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];
1832
+ function Q(e, t) {
1739
1833
  if (t) {
1740
- if (q.escapeTest.test(e)) return e.replace(q.escapeReplace, ht);
1741
- } else if (q.escapeTestNoEncode.test(e)) return e.replace(q.escapeReplaceNoEncode, ht);
1834
+ if (Z.escapeTest.test(e)) return e.replace(Z.escapeReplace, gt);
1835
+ } else if (Z.escapeTestNoEncode.test(e)) return e.replace(Z.escapeReplaceNoEncode, gt);
1742
1836
  return e;
1743
1837
  }
1744
- function gt(e) {
1838
+ function mt(e) {
1745
1839
  try {
1746
- e = encodeURI(e).replace(q.percentDecode, "%");
1840
+ e = encodeURI(e).replace(Z.percentDecode, "%");
1747
1841
  } catch {
1748
1842
  return null;
1749
1843
  }
1750
1844
  return e;
1751
1845
  }
1752
- function mt(e, t) {
1846
+ function wt(e, t) {
1753
1847
  var n;
1754
- let r = e.replace(q.findPipe, (o, i, u) => {
1848
+ let r = e.replace(Z.findPipe, (o, i, u) => {
1755
1849
  let l = !1, d = i;
1756
1850
  for (; --d >= 0 && u[d] === "\\"; ) l = !l;
1757
1851
  return l ? "|" : " |";
1758
- }), a = r.split(q.splitPipe), s = 0;
1852
+ }), a = r.split(Z.splitPipe), s = 0;
1759
1853
  if (a[0].trim() || a.shift(), a.length > 0 && !((n = a.at(-1)) != null && n.trim()) && a.pop(), t) if (a.length > t) a.splice(t);
1760
1854
  else for (; a.length < t; ) a.push("");
1761
- for (; s < a.length; s++) a[s] = a[s].trim().replace(q.slashPipe, "|");
1855
+ for (; s < a.length; s++) a[s] = a[s].trim().replace(Z.slashPipe, "|");
1762
1856
  return a;
1763
1857
  }
1764
- function ue(e, t, r) {
1858
+ function de(e, t, r) {
1765
1859
  let a = e.length;
1766
1860
  if (a === 0) return "";
1767
1861
  let s = 0;
@@ -1769,7 +1863,7 @@ function ue(e, t, r) {
1769
1863
  s++;
1770
1864
  return e.slice(0, a - s);
1771
1865
  }
1772
- function Wa(e, t) {
1866
+ function Xa(e, t) {
1773
1867
  if (e.indexOf(t[1]) === -1) return -1;
1774
1868
  let r = 0;
1775
1869
  for (let a = 0; a < e.length; a++) if (e[a] === "\\") a++;
@@ -1777,13 +1871,13 @@ function Wa(e, t) {
1777
1871
  else if (e[a] === t[1] && (r--, r < 0)) return a;
1778
1872
  return r > 0 ? -2 : -1;
1779
1873
  }
1780
- function wt(e, t, r, a, s) {
1874
+ function bt(e, t, r, a, s) {
1781
1875
  let n = t.href, o = t.title || null, i = e[1].replace(s.other.outputLinkReplace, "$1");
1782
1876
  a.state.inLink = !0;
1783
1877
  let u = { type: e[0].charAt(0) === "!" ? "image" : "link", raw: r, href: n, title: o, text: i, tokens: a.inlineTokens(i) };
1784
1878
  return a.state.inLink = !1, u;
1785
1879
  }
1786
- function Xa(e, t, r) {
1880
+ function Ka(e, t, r) {
1787
1881
  let a = e.match(r.other.indentCodeCompensation);
1788
1882
  if (a === null) return t;
1789
1883
  let s = a[1];
@@ -1796,12 +1890,12 @@ function Xa(e, t, r) {
1796
1890
  }).join(`
1797
1891
  `);
1798
1892
  }
1799
- var Ae = class {
1893
+ var ze = class {
1800
1894
  constructor(e) {
1801
1895
  I(this, "options");
1802
1896
  I(this, "rules");
1803
1897
  I(this, "lexer");
1804
- this.options = e || se;
1898
+ this.options = e || ie;
1805
1899
  }
1806
1900
  space(e) {
1807
1901
  let t = this.rules.block.newline.exec(e);
@@ -1811,14 +1905,14 @@ var Ae = class {
1811
1905
  let t = this.rules.block.code.exec(e);
1812
1906
  if (t) {
1813
1907
  let r = t[0].replace(this.rules.other.codeRemoveIndent, "");
1814
- return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? r : ue(r, `
1908
+ return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? r : de(r, `
1815
1909
  `) };
1816
1910
  }
1817
1911
  }
1818
1912
  fences(e) {
1819
1913
  let t = this.rules.block.fences.exec(e);
1820
1914
  if (t) {
1821
- let r = t[0], a = Xa(r, t[3] || "", this.rules);
1915
+ let r = t[0], a = Ka(r, t[3] || "", this.rules);
1822
1916
  return { type: "code", raw: r, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: a };
1823
1917
  }
1824
1918
  }
@@ -1827,7 +1921,7 @@ var Ae = class {
1827
1921
  if (t) {
1828
1922
  let r = t[2].trim();
1829
1923
  if (this.rules.other.endingHash.test(r)) {
1830
- let a = ue(r, "#");
1924
+ let a = de(r, "#");
1831
1925
  (this.options.pedantic || !a || this.rules.other.endingSpaceChar.test(a)) && (r = a.trim());
1832
1926
  }
1833
1927
  return { type: "heading", raw: t[0], depth: t[1].length, text: r, tokens: this.lexer.inline(r) };
@@ -1835,13 +1929,13 @@ var Ae = class {
1835
1929
  }
1836
1930
  hr(e) {
1837
1931
  let t = this.rules.block.hr.exec(e);
1838
- if (t) return { type: "hr", raw: ue(t[0], `
1932
+ if (t) return { type: "hr", raw: de(t[0], `
1839
1933
  `) };
1840
1934
  }
1841
1935
  blockquote(e) {
1842
1936
  let t = this.rules.block.blockquote.exec(e);
1843
1937
  if (t) {
1844
- let r = ue(t[0], `
1938
+ let r = de(t[0], `
1845
1939
  `).split(`
1846
1940
  `), a = "", s = "", n = [];
1847
1941
  for (; r.length > 0; ) {
@@ -1861,16 +1955,16 @@ ${d}` : d;
1861
1955
  let w = n.at(-1);
1862
1956
  if ((w == null ? void 0 : w.type) === "code") break;
1863
1957
  if ((w == null ? void 0 : w.type) === "blockquote") {
1864
- let c = w, m = c.raw + `
1958
+ let c = w, h = c.raw + `
1865
1959
  ` + r.join(`
1866
- `), h = this.blockquote(m);
1867
- n[n.length - 1] = h, a = a.substring(0, a.length - c.raw.length) + h.raw, s = s.substring(0, s.length - c.text.length) + h.text;
1960
+ `), f = this.blockquote(h);
1961
+ n[n.length - 1] = f, a = a.substring(0, a.length - c.raw.length) + f.raw, s = s.substring(0, s.length - c.text.length) + f.text;
1868
1962
  break;
1869
1963
  } else if ((w == null ? void 0 : w.type) === "list") {
1870
- let c = w, m = c.raw + `
1964
+ let c = w, h = c.raw + `
1871
1965
  ` + r.join(`
1872
- `), h = this.list(m);
1873
- n[n.length - 1] = h, a = a.substring(0, a.length - w.raw.length) + h.raw, s = s.substring(0, s.length - c.raw.length) + h.raw, r = m.substring(n.at(-1).raw.length).split(`
1966
+ `), f = this.list(h);
1967
+ n[n.length - 1] = f, a = a.substring(0, a.length - w.raw.length) + f.raw, s = s.substring(0, s.length - c.raw.length) + f.raw, r = h.substring(n.at(-1).raw.length).split(`
1874
1968
  `);
1875
1969
  continue;
1876
1970
  }
@@ -1890,24 +1984,24 @@ ${d}` : d;
1890
1984
  if (!(t = i.exec(e)) || this.rules.block.hr.test(e)) break;
1891
1985
  p = t[0], e = e.substring(p.length);
1892
1986
  let c = t[2].split(`
1893
- `, 1)[0].replace(this.rules.other.listReplaceTabs, (f) => " ".repeat(3 * f.length)), m = e.split(`
1894
- `, 1)[0], h = !c.trim(), g = 0;
1895
- if (this.options.pedantic ? (g = 2, w = c.trimStart()) : h ? g = t[1].length + 1 : (g = t[2].search(this.rules.other.nonSpaceChar), g = g > 4 ? 1 : g, w = c.slice(g), g += t[1].length), h && this.rules.other.blankLine.test(m) && (p += m + `
1896
- `, e = e.substring(m.length + 1), d = !0), !d) {
1897
- let f = this.rules.other.nextBulletRegex(g), b = this.rules.other.hrRegex(g), v = this.rules.other.fencesBeginRegex(g), x = this.rules.other.headingBeginRegex(g), $ = this.rules.other.htmlBeginRegex(g);
1987
+ `, 1)[0].replace(this.rules.other.listReplaceTabs, (m) => " ".repeat(3 * m.length)), h = e.split(`
1988
+ `, 1)[0], f = !c.trim(), g = 0;
1989
+ if (this.options.pedantic ? (g = 2, w = c.trimStart()) : f ? g = t[1].length + 1 : (g = t[2].search(this.rules.other.nonSpaceChar), g = g > 4 ? 1 : g, w = c.slice(g), g += t[1].length), f && this.rules.other.blankLine.test(h) && (p += h + `
1990
+ `, e = e.substring(h.length + 1), d = !0), !d) {
1991
+ let m = this.rules.other.nextBulletRegex(g), b = this.rules.other.hrRegex(g), v = this.rules.other.fencesBeginRegex(g), x = this.rules.other.headingBeginRegex(g), M = this.rules.other.htmlBeginRegex(g);
1898
1992
  for (; e; ) {
1899
1993
  let A = e.split(`
1900
- `, 1)[0], C;
1901
- if (m = A, this.options.pedantic ? (m = m.replace(this.rules.other.listReplaceNesting, " "), C = m) : C = m.replace(this.rules.other.tabCharGlobal, " "), v.test(m) || x.test(m) || $.test(m) || f.test(m) || b.test(m)) break;
1902
- if (C.search(this.rules.other.nonSpaceChar) >= g || !m.trim()) w += `
1903
- ` + C.slice(g);
1994
+ `, 1)[0], S;
1995
+ if (h = A, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), S = h) : S = h.replace(this.rules.other.tabCharGlobal, " "), v.test(h) || x.test(h) || M.test(h) || m.test(h) || b.test(h)) break;
1996
+ if (S.search(this.rules.other.nonSpaceChar) >= g || !h.trim()) w += `
1997
+ ` + S.slice(g);
1904
1998
  else {
1905
- if (h || c.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || v.test(c) || x.test(c) || b.test(c)) break;
1999
+ if (f || c.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || v.test(c) || x.test(c) || b.test(c)) break;
1906
2000
  w += `
1907
- ` + m;
2001
+ ` + h;
1908
2002
  }
1909
- !h && !m.trim() && (h = !0), p += A + `
1910
- `, e = e.substring(A.length + 1), c = C.slice(g);
2003
+ !f && !h.trim() && (f = !0), p += A + `
2004
+ `, e = e.substring(A.length + 1), c = S.slice(g);
1911
2005
  }
1912
2006
  }
1913
2007
  o.loose || (u ? o.loose = !0 : this.rules.other.doubleBlankLine.test(p) && (u = !0)), o.items.push({ type: "list_item", raw: p, task: !!this.options.gfm && this.rules.other.listIsTask.test(w), loose: !1, text: w, tokens: [] }), o.raw += p;
@@ -1958,12 +2052,12 @@ ${d}` : d;
1958
2052
  var o;
1959
2053
  let t = this.rules.block.table.exec(e);
1960
2054
  if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
1961
- let r = mt(t[1]), a = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), s = (o = t[3]) != null && o.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
2055
+ let r = wt(t[1]), a = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), s = (o = t[3]) != null && o.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
1962
2056
  `) : [], n = { type: "table", raw: t[0], header: [], align: [], rows: [] };
1963
2057
  if (r.length === a.length) {
1964
2058
  for (let i of a) this.rules.other.tableAlignRight.test(i) ? n.align.push("right") : this.rules.other.tableAlignCenter.test(i) ? n.align.push("center") : this.rules.other.tableAlignLeft.test(i) ? n.align.push("left") : n.align.push(null);
1965
2059
  for (let i = 0; i < r.length; i++) n.header.push({ text: r[i], tokens: this.lexer.inline(r[i]), header: !0, align: n.align[i] });
1966
- for (let i of s) n.rows.push(mt(i, n.header.length).map((u, l) => ({ text: u, tokens: this.lexer.inline(u), header: !1, align: n.align[l] })));
2060
+ for (let i of s) n.rows.push(wt(i, n.header.length).map((u, l) => ({ text: u, tokens: this.lexer.inline(u), header: !1, align: n.align[l] })));
1967
2061
  return n;
1968
2062
  }
1969
2063
  }
@@ -1997,10 +2091,10 @@ ${d}` : d;
1997
2091
  let r = t[2].trim();
1998
2092
  if (!this.options.pedantic && this.rules.other.startAngleBracket.test(r)) {
1999
2093
  if (!this.rules.other.endAngleBracket.test(r)) return;
2000
- let n = ue(r.slice(0, -1), "\\");
2094
+ let n = de(r.slice(0, -1), "\\");
2001
2095
  if ((r.length - n.length) % 2 === 0) return;
2002
2096
  } else {
2003
- let n = Wa(t[2], "()");
2097
+ let n = Xa(t[2], "()");
2004
2098
  if (n === -2) return;
2005
2099
  if (n > -1) {
2006
2100
  let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + n;
@@ -2012,7 +2106,7 @@ ${d}` : d;
2012
2106
  let n = this.rules.other.pedanticHrefTitle.exec(a);
2013
2107
  n && (a = n[1], s = n[3]);
2014
2108
  } else s = t[3] ? t[3].slice(1, -1) : "";
2015
- return a = a.trim(), this.rules.other.startAngleBracket.test(a) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(r) ? a = a.slice(1) : a = a.slice(1, -1)), wt(t, { href: a && a.replace(this.rules.inline.anyPunctuation, "$1"), title: s && s.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
2109
+ return a = a.trim(), this.rules.other.startAngleBracket.test(a) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(r) ? a = a.slice(1) : a = a.slice(1, -1)), bt(t, { href: a && a.replace(this.rules.inline.anyPunctuation, "$1"), title: s && s.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
2016
2110
  }
2017
2111
  }
2018
2112
  reflink(e, t) {
@@ -2023,7 +2117,7 @@ ${d}` : d;
2023
2117
  let n = r[0].charAt(0);
2024
2118
  return { type: "text", raw: n, text: n };
2025
2119
  }
2026
- return wt(r, s, r[0], this.lexer, this.rules);
2120
+ return bt(r, s, r[0], this.lexer, this.rules);
2027
2121
  }
2028
2122
  }
2029
2123
  emStrong(e, t, r = "") {
@@ -2096,19 +2190,19 @@ ${d}` : d;
2096
2190
  return { type: "text", raw: t[0], text: t[0], escaped: r };
2097
2191
  }
2098
2192
  }
2099
- }, F = class Ie {
2193
+ }, G = class Ie {
2100
2194
  constructor(t) {
2101
2195
  I(this, "tokens");
2102
2196
  I(this, "options");
2103
2197
  I(this, "state");
2104
2198
  I(this, "inlineQueue");
2105
2199
  I(this, "tokenizer");
2106
- this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || se, this.options.tokenizer = this.options.tokenizer || new Ae(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
2107
- let r = { other: q, block: ye.normal, inline: ce.normal };
2108
- this.options.pedantic ? (r.block = ye.pedantic, r.inline = ce.pedantic) : this.options.gfm && (r.block = ye.gfm, this.options.breaks ? r.inline = ce.breaks : r.inline = ce.gfm), this.tokenizer.rules = r;
2200
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || ie, this.options.tokenizer = this.options.tokenizer || new ze(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
2201
+ let r = { other: Z, block: ke.normal, inline: ue.normal };
2202
+ this.options.pedantic ? (r.block = ke.pedantic, r.inline = ue.pedantic) : this.options.gfm && (r.block = ke.gfm, this.options.breaks ? r.inline = ue.breaks : r.inline = ue.gfm), this.tokenizer.rules = r;
2109
2203
  }
2110
2204
  static get rules() {
2111
- return { block: ye, inline: ce };
2205
+ return { block: ke, inline: ue };
2112
2206
  }
2113
2207
  static lex(t, r) {
2114
2208
  return new Ie(r).lex(t);
@@ -2117,7 +2211,7 @@ ${d}` : d;
2117
2211
  return new Ie(r).inlineTokens(t);
2118
2212
  }
2119
2213
  lex(t) {
2120
- t = t.replace(q.carriageReturn, `
2214
+ t = t.replace(Z.carriageReturn, `
2121
2215
  `), this.blockTokens(t, this.tokens);
2122
2216
  for (let r = 0; r < this.inlineQueue.length; r++) {
2123
2217
  let a = this.inlineQueue[r];
@@ -2127,7 +2221,7 @@ ${d}` : d;
2127
2221
  }
2128
2222
  blockTokens(t, r = [], a = !1) {
2129
2223
  var s, n, o;
2130
- for (this.options.pedantic && (t = t.replace(q.tabCharGlobal, " ").replace(q.spaceLine, "")); t; ) {
2224
+ for (this.options.pedantic && (t = t.replace(Z.tabCharGlobal, " ").replace(Z.spaceLine, "")); t; ) {
2131
2225
  let i;
2132
2226
  if ((n = (s = this.options.extensions) == null ? void 0 : s.block) != null && n.some((l) => (i = l.call({ lexer: this }, t, r)) ? (t = t.substring(i.raw.length), r.push(i), !0) : !1)) continue;
2133
2227
  if (i = this.tokenizer.space(t)) {
@@ -2239,7 +2333,7 @@ ${d}` : d;
2239
2333
  for (; t; ) {
2240
2334
  o || (i = ""), o = !1;
2241
2335
  let c;
2242
- if ((p = (d = this.options.extensions) == null ? void 0 : d.inline) != null && p.some((h) => (c = h.call({ lexer: this }, t, r)) ? (t = t.substring(c.raw.length), r.push(c), !0) : !1)) continue;
2336
+ if ((p = (d = this.options.extensions) == null ? void 0 : d.inline) != null && p.some((f) => (c = f.call({ lexer: this }, t, r)) ? (t = t.substring(c.raw.length), r.push(c), !0) : !1)) continue;
2243
2337
  if (c = this.tokenizer.escape(t)) {
2244
2338
  t = t.substring(c.raw.length), r.push(c);
2245
2339
  continue;
@@ -2254,8 +2348,8 @@ ${d}` : d;
2254
2348
  }
2255
2349
  if (c = this.tokenizer.reflink(t, this.tokens.links)) {
2256
2350
  t = t.substring(c.raw.length);
2257
- let h = r.at(-1);
2258
- c.type === "text" && (h == null ? void 0 : h.type) === "text" ? (h.raw += c.raw, h.text += c.text) : r.push(c);
2351
+ let f = r.at(-1);
2352
+ c.type === "text" && (f == null ? void 0 : f.type) === "text" ? (f.raw += c.raw, f.text += c.text) : r.push(c);
2259
2353
  continue;
2260
2354
  }
2261
2355
  if (c = this.tokenizer.emStrong(t, a, i)) {
@@ -2282,44 +2376,44 @@ ${d}` : d;
2282
2376
  t = t.substring(c.raw.length), r.push(c);
2283
2377
  continue;
2284
2378
  }
2285
- let m = t;
2379
+ let h = t;
2286
2380
  if ((w = this.options.extensions) != null && w.startInline) {
2287
- let h = 1 / 0, g = t.slice(1), f;
2381
+ let f = 1 / 0, g = t.slice(1), m;
2288
2382
  this.options.extensions.startInline.forEach((b) => {
2289
- f = b.call({ lexer: this }, g), typeof f == "number" && f >= 0 && (h = Math.min(h, f));
2290
- }), h < 1 / 0 && h >= 0 && (m = t.substring(0, h + 1));
2383
+ m = b.call({ lexer: this }, g), typeof m == "number" && m >= 0 && (f = Math.min(f, m));
2384
+ }), f < 1 / 0 && f >= 0 && (h = t.substring(0, f + 1));
2291
2385
  }
2292
- if (c = this.tokenizer.inlineText(m)) {
2386
+ if (c = this.tokenizer.inlineText(h)) {
2293
2387
  t = t.substring(c.raw.length), c.raw.slice(-1) !== "_" && (i = c.raw.slice(-1)), o = !0;
2294
- let h = r.at(-1);
2295
- (h == null ? void 0 : h.type) === "text" ? (h.raw += c.raw, h.text += c.text) : r.push(c);
2388
+ let f = r.at(-1);
2389
+ (f == null ? void 0 : f.type) === "text" ? (f.raw += c.raw, f.text += c.text) : r.push(c);
2296
2390
  continue;
2297
2391
  }
2298
2392
  if (t) {
2299
- let h = "Infinite loop on byte: " + t.charCodeAt(0);
2393
+ let f = "Infinite loop on byte: " + t.charCodeAt(0);
2300
2394
  if (this.options.silent) {
2301
- console.error(h);
2395
+ console.error(f);
2302
2396
  break;
2303
- } else throw new Error(h);
2397
+ } else throw new Error(f);
2304
2398
  }
2305
2399
  }
2306
2400
  return r;
2307
2401
  }
2308
- }, ze = class {
2402
+ }, Se = class {
2309
2403
  constructor(e) {
2310
2404
  I(this, "options");
2311
2405
  I(this, "parser");
2312
- this.options = e || se;
2406
+ this.options = e || ie;
2313
2407
  }
2314
2408
  space(e) {
2315
2409
  return "";
2316
2410
  }
2317
2411
  code({ text: e, lang: t, escaped: r }) {
2318
2412
  var n;
2319
- let a = (n = (t || "").match(q.notSpaceStart)) == null ? void 0 : n[0], s = e.replace(q.endingNewline, "") + `
2413
+ let a = (n = (t || "").match(Z.notSpaceStart)) == null ? void 0 : n[0], s = e.replace(Z.endingNewline, "") + `
2320
2414
  `;
2321
- return a ? '<pre><code class="language-' + X(a) + '">' + (r ? s : X(s, !0)) + `</code></pre>
2322
- ` : "<pre><code>" + (r ? s : X(s, !0)) + `</code></pre>
2415
+ return a ? '<pre><code class="language-' + Q(a) + '">' + (r ? s : Q(s, !0)) + `</code></pre>
2416
+ ` : "<pre><code>" + (r ? s : Q(s, !0)) + `</code></pre>
2323
2417
  `;
2324
2418
  }
2325
2419
  blockquote({ tokens: e }) {
@@ -2397,7 +2491,7 @@ ${e}</tr>
2397
2491
  return `<em>${this.parser.parseInline(e)}</em>`;
2398
2492
  }
2399
2493
  codespan({ text: e }) {
2400
- return `<code>${X(e, !0)}</code>`;
2494
+ return `<code>${Q(e, !0)}</code>`;
2401
2495
  }
2402
2496
  br(e) {
2403
2497
  return "<br>";
@@ -2406,22 +2500,22 @@ ${e}</tr>
2406
2500
  return `<del>${this.parser.parseInline(e)}</del>`;
2407
2501
  }
2408
2502
  link({ href: e, title: t, tokens: r }) {
2409
- let a = this.parser.parseInline(r), s = gt(e);
2503
+ let a = this.parser.parseInline(r), s = mt(e);
2410
2504
  if (s === null) return a;
2411
2505
  e = s;
2412
2506
  let n = '<a href="' + e + '"';
2413
- return t && (n += ' title="' + X(t) + '"'), n += ">" + a + "</a>", n;
2507
+ return t && (n += ' title="' + Q(t) + '"'), n += ">" + a + "</a>", n;
2414
2508
  }
2415
2509
  image({ href: e, title: t, text: r, tokens: a }) {
2416
2510
  a && (r = this.parser.parseInline(a, this.parser.textRenderer));
2417
- let s = gt(e);
2418
- if (s === null) return X(r);
2511
+ let s = mt(e);
2512
+ if (s === null) return Q(r);
2419
2513
  e = s;
2420
2514
  let n = `<img src="${e}" alt="${r}"`;
2421
- return t && (n += ` title="${X(t)}"`), n += ">", n;
2515
+ return t && (n += ` title="${Q(t)}"`), n += ">", n;
2422
2516
  }
2423
2517
  text(e) {
2424
- return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : X(e.text);
2518
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : Q(e.text);
2425
2519
  }
2426
2520
  }, st = class {
2427
2521
  strong({ text: e }) {
@@ -2454,12 +2548,12 @@ ${e}</tr>
2454
2548
  checkbox({ raw: e }) {
2455
2549
  return e;
2456
2550
  }
2457
- }, N = class De {
2551
+ }, W = class De {
2458
2552
  constructor(t) {
2459
2553
  I(this, "options");
2460
2554
  I(this, "renderer");
2461
2555
  I(this, "textRenderer");
2462
- this.options = t || se, this.options.renderer = this.options.renderer || new ze(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new st();
2556
+ this.options = t || ie, this.options.renderer = this.options.renderer || new Se(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new st();
2463
2557
  }
2464
2558
  static parse(t, r) {
2465
2559
  return new De(r).parse(t);
@@ -2605,11 +2699,11 @@ ${e}</tr>
2605
2699
  }
2606
2700
  return a;
2607
2701
  }
2608
- }, xe, pe = (xe = class {
2702
+ }, Me, fe = (Me = class {
2609
2703
  constructor(e) {
2610
2704
  I(this, "options");
2611
2705
  I(this, "block");
2612
- this.options = e || se;
2706
+ this.options = e || ie;
2613
2707
  }
2614
2708
  preprocess(e) {
2615
2709
  return e;
@@ -2624,23 +2718,23 @@ ${e}</tr>
2624
2718
  return e;
2625
2719
  }
2626
2720
  provideLexer() {
2627
- return this.block ? F.lex : F.lexInline;
2721
+ return this.block ? G.lex : G.lexInline;
2628
2722
  }
2629
2723
  provideParser() {
2630
- return this.block ? N.parse : N.parseInline;
2724
+ return this.block ? W.parse : W.parseInline;
2631
2725
  }
2632
- }, I(xe, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), I(xe, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), xe), Ka = class {
2726
+ }, I(Me, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), I(Me, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), Me), Ja = class {
2633
2727
  constructor(...e) {
2634
2728
  I(this, "defaults", Ke());
2635
2729
  I(this, "options", this.setOptions);
2636
2730
  I(this, "parse", this.parseMarkdown(!0));
2637
2731
  I(this, "parseInline", this.parseMarkdown(!1));
2638
- I(this, "Parser", N);
2639
- I(this, "Renderer", ze);
2732
+ I(this, "Parser", W);
2733
+ I(this, "Renderer", Se);
2640
2734
  I(this, "TextRenderer", st);
2641
- I(this, "Lexer", F);
2642
- I(this, "Tokenizer", Ae);
2643
- I(this, "Hooks", pe);
2735
+ I(this, "Lexer", G);
2736
+ I(this, "Tokenizer", ze);
2737
+ I(this, "Hooks", fe);
2644
2738
  this.use(...e);
2645
2739
  }
2646
2740
  walkTokens(e, t) {
@@ -2688,7 +2782,7 @@ ${e}</tr>
2688
2782
  }
2689
2783
  "childTokens" in s && s.childTokens && (t.childTokens[s.name] = s.childTokens);
2690
2784
  }), a.extensions = t), r.renderer) {
2691
- let s = this.defaults.renderer || new ze(this.defaults);
2785
+ let s = this.defaults.renderer || new Se(this.defaults);
2692
2786
  for (let n in r.renderer) {
2693
2787
  if (!(n in s)) throw new Error(`renderer '${n}' does not exist`);
2694
2788
  if (["options", "parser"].includes(n)) continue;
@@ -2701,7 +2795,7 @@ ${e}</tr>
2701
2795
  a.renderer = s;
2702
2796
  }
2703
2797
  if (r.tokenizer) {
2704
- let s = this.defaults.tokenizer || new Ae(this.defaults);
2798
+ let s = this.defaults.tokenizer || new ze(this.defaults);
2705
2799
  for (let n in r.tokenizer) {
2706
2800
  if (!(n in s)) throw new Error(`tokenizer '${n}' does not exist`);
2707
2801
  if (["options", "rules", "lexer"].includes(n)) continue;
@@ -2714,13 +2808,13 @@ ${e}</tr>
2714
2808
  a.tokenizer = s;
2715
2809
  }
2716
2810
  if (r.hooks) {
2717
- let s = this.defaults.hooks || new pe();
2811
+ let s = this.defaults.hooks || new fe();
2718
2812
  for (let n in r.hooks) {
2719
2813
  if (!(n in s)) throw new Error(`hook '${n}' does not exist`);
2720
2814
  if (["options", "block"].includes(n)) continue;
2721
2815
  let o = n, i = r.hooks[o], u = s[o];
2722
- pe.passThroughHooks.has(n) ? s[o] = (l) => {
2723
- if (this.defaults.async && pe.passThroughHooksRespectAsync.has(n)) return (async () => {
2816
+ fe.passThroughHooks.has(n) ? s[o] = (l) => {
2817
+ if (this.defaults.async && fe.passThroughHooksRespectAsync.has(n)) return (async () => {
2724
2818
  let p = await i.call(s, l);
2725
2819
  return u.call(s, p);
2726
2820
  })();
@@ -2751,10 +2845,10 @@ ${e}</tr>
2751
2845
  return this.defaults = { ...this.defaults, ...e }, this;
2752
2846
  }
2753
2847
  lexer(e, t) {
2754
- return F.lex(e, t ?? this.defaults);
2848
+ return G.lex(e, t ?? this.defaults);
2755
2849
  }
2756
2850
  parser(e, t) {
2757
- return N.parse(e, t ?? this.defaults);
2851
+ return W.parse(e, t ?? this.defaults);
2758
2852
  }
2759
2853
  parseMarkdown(e) {
2760
2854
  return (t, r) => {
@@ -2763,16 +2857,16 @@ ${e}</tr>
2763
2857
  if (typeof t > "u" || t === null) return n(new Error("marked(): input parameter is undefined or null"));
2764
2858
  if (typeof t != "string") return n(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
2765
2859
  if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
2766
- let o = s.hooks ? await s.hooks.preprocess(t) : t, i = await (s.hooks ? await s.hooks.provideLexer() : e ? F.lex : F.lexInline)(o, s), u = s.hooks ? await s.hooks.processAllTokens(i) : i;
2860
+ let o = s.hooks ? await s.hooks.preprocess(t) : t, i = await (s.hooks ? await s.hooks.provideLexer() : e ? G.lex : G.lexInline)(o, s), u = s.hooks ? await s.hooks.processAllTokens(i) : i;
2767
2861
  s.walkTokens && await Promise.all(this.walkTokens(u, s.walkTokens));
2768
- let l = await (s.hooks ? await s.hooks.provideParser() : e ? N.parse : N.parseInline)(u, s);
2862
+ let l = await (s.hooks ? await s.hooks.provideParser() : e ? W.parse : W.parseInline)(u, s);
2769
2863
  return s.hooks ? await s.hooks.postprocess(l) : l;
2770
2864
  })().catch(n);
2771
2865
  try {
2772
2866
  s.hooks && (t = s.hooks.preprocess(t));
2773
- let o = (s.hooks ? s.hooks.provideLexer() : e ? F.lex : F.lexInline)(t, s);
2867
+ let o = (s.hooks ? s.hooks.provideLexer() : e ? G.lex : G.lexInline)(t, s);
2774
2868
  s.hooks && (o = s.hooks.processAllTokens(o)), s.walkTokens && this.walkTokens(o, s.walkTokens);
2775
- let i = (s.hooks ? s.hooks.provideParser() : e ? N.parse : N.parseInline)(o, s);
2869
+ let i = (s.hooks ? s.hooks.provideParser() : e ? W.parse : W.parseInline)(o, s);
2776
2870
  return s.hooks && (i = s.hooks.postprocess(i)), i;
2777
2871
  } catch (o) {
2778
2872
  return n(o);
@@ -2783,47 +2877,47 @@ ${e}</tr>
2783
2877
  return (r) => {
2784
2878
  if (r.message += `
2785
2879
  Please report this to https://github.com/markedjs/marked.`, e) {
2786
- let a = "<p>An error occurred:</p><pre>" + X(r.message + "", !0) + "</pre>";
2880
+ let a = "<p>An error occurred:</p><pre>" + Q(r.message + "", !0) + "</pre>";
2787
2881
  return t ? Promise.resolve(a) : a;
2788
2882
  }
2789
2883
  if (t) return Promise.reject(r);
2790
2884
  throw r;
2791
2885
  };
2792
2886
  }
2793
- }, re = new Ka();
2887
+ }, se = new Ja();
2794
2888
  function V(e, t) {
2795
- return re.parse(e, t);
2889
+ return se.parse(e, t);
2796
2890
  }
2797
2891
  V.options = V.setOptions = function(e) {
2798
- return re.setOptions(e), V.defaults = re.defaults, mr(V.defaults), V;
2892
+ return se.setOptions(e), V.defaults = se.defaults, wr(V.defaults), V;
2799
2893
  };
2800
2894
  V.getDefaults = Ke;
2801
- V.defaults = se;
2895
+ V.defaults = ie;
2802
2896
  V.use = function(...e) {
2803
- return re.use(...e), V.defaults = re.defaults, mr(V.defaults), V;
2897
+ return se.use(...e), V.defaults = se.defaults, wr(V.defaults), V;
2804
2898
  };
2805
2899
  V.walkTokens = function(e, t) {
2806
- return re.walkTokens(e, t);
2900
+ return se.walkTokens(e, t);
2807
2901
  };
2808
- V.parseInline = re.parseInline;
2809
- V.Parser = N;
2810
- V.parser = N.parse;
2811
- V.Renderer = ze;
2902
+ V.parseInline = se.parseInline;
2903
+ V.Parser = W;
2904
+ V.parser = W.parse;
2905
+ V.Renderer = Se;
2812
2906
  V.TextRenderer = st;
2813
- V.Lexer = F;
2814
- V.lexer = F.lex;
2815
- V.Tokenizer = Ae;
2816
- V.Hooks = pe;
2907
+ V.Lexer = G;
2908
+ V.lexer = G.lex;
2909
+ V.Tokenizer = ze;
2910
+ V.Hooks = fe;
2817
2911
  V.parse = V;
2818
2912
  V.options;
2819
2913
  V.setOptions;
2820
2914
  V.use;
2821
2915
  V.walkTokens;
2822
2916
  V.parseInline;
2823
- N.parse;
2824
- F.lex;
2825
- const Ja = ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp", "ico", "avif"];
2826
- function Qa(e) {
2917
+ W.parse;
2918
+ G.lex;
2919
+ const Qa = ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp", "ico", "avif"];
2920
+ function Ya(e) {
2827
2921
  const t = [];
2828
2922
  e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (n) => {
2829
2923
  const o = `__IMG_PROTECTED_${t.length}__`;
@@ -2838,7 +2932,7 @@ function Qa(e) {
2838
2932
  const o = `__IMG_PROTECTED_${t.length}__`;
2839
2933
  return t.push(n), o;
2840
2934
  });
2841
- const r = Ja.join("|"), a = new RegExp(
2935
+ const r = Qa.join("|"), a = new RegExp(
2842
2936
  `<a[^>]*href="(https?:\\/\\/[^"]+\\.(?:${r})(?:\\?[^"]*)?)"[^>]*>([^<]*)<\\/a>`,
2843
2937
  "gi"
2844
2938
  );
@@ -2862,7 +2956,7 @@ function qe(e, t, r) {
2862
2956
  let n = '<div class="artifactuse-image-container">';
2863
2957
  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;
2864
2958
  }
2865
- function Ya(e) {
2959
+ function es(e) {
2866
2960
  const t = e.split(`
2867
2961
  `), r = [];
2868
2962
  let a = [], s = !1;
@@ -2883,43 +2977,43 @@ function Ya(e) {
2883
2977
  r.push(t[n]);
2884
2978
  } else {
2885
2979
  if (s && a.length >= 2) {
2886
- const i = bt(a);
2980
+ const i = vt(a);
2887
2981
  r.push(i);
2888
2982
  } else s && a.length === 1 && r.push(a[0]);
2889
2983
  s = !1, a = [], r.push(t[n]);
2890
2984
  }
2891
2985
  }
2892
2986
  if (s && a.length >= 2) {
2893
- const n = bt(a);
2987
+ const n = vt(a);
2894
2988
  r.push(n);
2895
2989
  } else s && a.length === 1 && r.push(a[0]);
2896
2990
  return r.join(`
2897
2991
  `);
2898
2992
  }
2899
- function bt(e) {
2993
+ function vt(e) {
2900
2994
  return `<div class="artifactuse-image-gallery">
2901
2995
  ${e.map((r) => r.replace("artifactuse-image-container", "artifactuse-gallery-item").replace("artifactuse-image-caption", "artifactuse-gallery-caption").replace("artifactuse-image", "artifactuse-gallery-image").replace("artifactuse-hero-image", "artifactuse-gallery-image").replace("artifactuse-inline-image", "artifactuse-gallery-image")).join(`
2902
2996
  `)}
2903
2997
  </div>`;
2904
2998
  }
2905
- const Sr = ["mp4", "webm", "mov", "avi", "mkv", "flv", "wmv", "m4v"];
2906
- function es(e) {
2999
+ const Cr = ["mp4", "webm", "mov", "avi", "mkv", "flv", "wmv", "m4v"];
3000
+ function ts(e) {
2907
3001
  if (!e) return !1;
2908
- const t = Sr.join("|");
3002
+ const t = Cr.join("|");
2909
3003
  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));
2910
3004
  }
2911
- function ts(e) {
3005
+ function rs(e) {
2912
3006
  if (!e) return null;
2913
3007
  let t = e.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)/);
2914
3008
  if (t) return { type: "youtube", id: t[1] };
2915
3009
  if (t = e.match(/vimeo\.com\/(\d+)/), t) return { type: "vimeo", id: t[1] };
2916
3010
  if (t = e.match(/loom\.com\/share\/([a-zA-Z0-9]+)/), t) return { type: "loom", id: t[1] };
2917
3011
  if (t = e.match(/dailymotion\.com\/video\/([a-zA-Z0-9]+)/), t) return { type: "dailymotion", id: t[1] };
2918
- const r = Sr.join("|");
3012
+ const r = Cr.join("|");
2919
3013
  return new RegExp(`\\.(${r})(\\?.*)?$`, "i").test(e) ? { type: "direct", id: e } : null;
2920
3014
  }
2921
- function rs(e) {
2922
- const t = ts(e);
3015
+ function as(e) {
3016
+ const t = rs(e);
2923
3017
  if (!t) return `<a href="${e}" target="_blank" rel="noopener noreferrer">${e}</a>`;
2924
3018
  switch (t.type) {
2925
3019
  case "youtube":
@@ -2936,45 +3030,45 @@ function rs(e) {
2936
3030
  return `<a href="${e}" target="_blank" rel="noopener noreferrer">${e}</a>`;
2937
3031
  }
2938
3032
  }
2939
- function as(e) {
3033
+ function ss(e) {
2940
3034
  const t = [];
2941
3035
  e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (c) => {
2942
- const m = `__PROTECTED_${t.length}__`;
2943
- return t.push(c), m;
3036
+ const h = `__PROTECTED_${t.length}__`;
3037
+ return t.push(c), h;
2944
3038
  }), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (c) => {
2945
- const m = `__PROTECTED_${t.length}__`;
2946
- return t.push(c), m;
3039
+ const h = `__PROTECTED_${t.length}__`;
3040
+ return t.push(c), h;
2947
3041
  }), e = e.replace(/<(video|audio|iframe)[^>]*>[\s\S]*?<\/\1>/gi, (c) => {
2948
- const m = `__PROTECTED_${t.length}__`;
2949
- return t.push(c), m;
3042
+ const h = `__PROTECTED_${t.length}__`;
3043
+ return t.push(c), h;
2950
3044
  });
2951
3045
  const r = /\[([^\]]+)\]\((https:\/\/www\.pexels\.com\/video\/[^)]+)\)\s*(?:<\/p>)?\s*(?:<p>)?\s*(?:Preview image:\s*)?!\[([^\]]*)\]\((https:\/\/images\.pexels\.com\/videos\/[^)]+)\)/gi;
2952
- e = e.replace(r, (c, m, h, g, f) => ns(m, h, f, g));
3046
+ e = e.replace(r, (c, h, f, g, m) => is(h, f, m, g));
2953
3047
  const a = /<a[^>]*href="(https?:\/\/[^"]+\.(mp4|webm|mov|avi|mkv|flv|wmv|m4v)(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
2954
- e = e.replace(a, (c, m) => Ze(m));
3048
+ e = e.replace(a, (c, h) => Ze(h));
2955
3049
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(mp4|webm|mov|avi|mkv|flv|wmv|m4v)(\\?[^\\s<>"]*)?)(?!["'])`, "gi");
2956
- e = e.replace(s, (c, m) => Ze(m));
3050
+ e = e.replace(s, (c, h) => Ze(h));
2957
3051
  const n = /<a[^>]*href="(https?:\/\/(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
2958
- e = e.replace(n, (c, m, h) => Oe(h));
3052
+ e = e.replace(n, (c, h, f) => Oe(f));
2959
3053
  const o = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?(?:youtube\\.com\\/watch\\?v=|youtu\\.be\\/)([a-zA-Z0-9_-]+))(?!["'])`, "gi");
2960
- e = e.replace(o, (c, m, h) => Oe(h));
3054
+ e = e.replace(o, (c, h, f) => Oe(f));
2961
3055
  const i = /<a[^>]*href="(https?:\/\/(?:www\.)?vimeo\.com\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
2962
- e = e.replace(i, (c, m, h) => Be(h));
3056
+ e = e.replace(i, (c, h, f) => Be(f));
2963
3057
  const u = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?vimeo\\.com\\/(\\d+))(?!["'])`, "gi");
2964
- e = e.replace(u, (c, m, h) => Be(h));
3058
+ e = e.replace(u, (c, h, f) => Be(f));
2965
3059
  const l = /<a[^>]*href="(https?:\/\/(?:www\.)?loom\.com\/share\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
2966
- e = e.replace(l, (c, m, h) => Fe(h));
3060
+ e = e.replace(l, (c, h, f) => Fe(f));
2967
3061
  const d = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?loom\\.com\\/share\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
2968
- e = e.replace(d, (c, m, h) => Fe(h));
3062
+ e = e.replace(d, (c, h, f) => Fe(f));
2969
3063
  const p = /<a[^>]*href="(https?:\/\/(?:www\.)?dailymotion\.com\/video\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
2970
- e = e.replace(p, (c, m, h) => Ne(h));
3064
+ e = e.replace(p, (c, h, f) => Ne(f));
2971
3065
  const w = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?dailymotion\\.com\\/video\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
2972
- e = e.replace(w, (c, m, h) => Ne(h));
3066
+ e = e.replace(w, (c, h, f) => Ne(f));
2973
3067
  for (let c = t.length - 1; c >= 0; c--)
2974
3068
  e = e.replace(`__PROTECTED_${c}__`, t[c]);
2975
3069
  return e;
2976
3070
  }
2977
- function ss(e) {
3071
+ function ns(e) {
2978
3072
  const t = e.split("?")[0].split(".").pop().toLowerCase();
2979
3073
  return {
2980
3074
  mp4: "video/mp4",
@@ -2988,10 +3082,10 @@ function ss(e) {
2988
3082
  }[t] || "video/mp4";
2989
3083
  }
2990
3084
  function Ze(e) {
2991
- const t = ss(e);
3085
+ const t = ns(e);
2992
3086
  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>`;
2993
3087
  }
2994
- function ns(e, t, r, a) {
3088
+ function is(e, t, r, a) {
2995
3089
  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>`;
2996
3090
  }
2997
3091
  function Oe(e) {
@@ -3010,11 +3104,11 @@ function Ne(e) {
3010
3104
  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>'`;
3011
3105
  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>`;
3012
3106
  }
3013
- function is(e) {
3107
+ function os(e) {
3014
3108
  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();
3015
3109
  return /<(?!\/)[^>]+>/.test(t) ? !1 : t.length < 200;
3016
3110
  }
3017
- function Pe(e) {
3111
+ function je(e) {
3018
3112
  let t = e.match(/<p>((?:[^<]|<(?!\/p>))*?)(?:<br\s*\/?>)?\s*<\/p>\s*$/);
3019
3113
  if (t) {
3020
3114
  const r = t[1].trim(), a = r.replace(/<[^>]*>/g, "").trim();
@@ -3028,7 +3122,7 @@ function Pe(e) {
3028
3122
  }
3029
3123
  return "";
3030
3124
  }
3031
- function os(e) {
3125
+ function ls(e) {
3032
3126
  const t = /<div class="artifactuse-video-(wrapper|preview-container)/g, r = [];
3033
3127
  let a;
3034
3128
  for (; (a = t.exec(e)) !== null; ) {
@@ -3052,16 +3146,16 @@ function os(e) {
3052
3146
  const s = [];
3053
3147
  let n = [{
3054
3148
  ...r[0],
3055
- caption: Pe(e.substring(0, r[0].start))
3149
+ caption: je(e.substring(0, r[0].start))
3056
3150
  }];
3057
3151
  for (let u = 1; u < r.length; u++) {
3058
3152
  const l = r[u - 1], d = r[u], p = e.substring(l.end, d.start);
3059
- is(p) ? n.push({
3153
+ os(p) ? n.push({
3060
3154
  ...d,
3061
- caption: Pe(p)
3155
+ caption: je(p)
3062
3156
  }) : (s.push([...n]), n = [{
3063
3157
  ...d,
3064
- caption: Pe(e.substring(l.end, d.start))
3158
+ caption: je(e.substring(l.end, d.start))
3065
3159
  }]);
3066
3160
  }
3067
3161
  s.push(n);
@@ -3072,7 +3166,7 @@ function os(e) {
3072
3166
  let d = l.start;
3073
3167
  const w = e.substring(i, l.start).match(/<p>((?:[^<]|<(?!\/p>))*?)(?:<br\s*\/?>)?\s*<\/p>\s*$/);
3074
3168
  if (w && (d = l.start - w[0].length, u[0].caption = w[1].trim()), o += e.substring(i, d), u.length >= 2)
3075
- o += ls(u);
3169
+ o += cs(u);
3076
3170
  else {
3077
3171
  const c = u[0];
3078
3172
  c.caption ? o += `<div class="artifactuse-video-container">${c.html}<div class="artifactuse-video-caption">${c.caption}</div></div>` : o += c.html;
@@ -3081,7 +3175,7 @@ function os(e) {
3081
3175
  }
3082
3176
  return o += e.substring(i), o = o.replace(/<p>\s*<\/p>/g, ""), o;
3083
3177
  }
3084
- function ls(e) {
3178
+ function cs(e) {
3085
3179
  return `<div class="artifactuse-video-gallery">
3086
3180
  ${e.map(({ html: r, caption: a }) => {
3087
3181
  let s = r.replace(
@@ -3096,75 +3190,75 @@ ${e.map(({ html: r, caption: a }) => {
3096
3190
  `)}
3097
3191
  </div>`;
3098
3192
  }
3099
- function cs() {
3193
+ function us() {
3100
3194
  return `audio-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
3101
3195
  }
3102
- function us(e, t = {}) {
3196
+ function ds(e, t = {}) {
3103
3197
  const r = t.theme || "dark", a = [];
3104
3198
  e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (A) => {
3105
- const C = `__PROTECTED_${a.length}__`;
3106
- return a.push(A), C;
3199
+ const S = `__PROTECTED_${a.length}__`;
3200
+ return a.push(A), S;
3107
3201
  }), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (A) => {
3108
- const C = `__PROTECTED_${a.length}__`;
3109
- return a.push(A), C;
3202
+ const S = `__PROTECTED_${a.length}__`;
3203
+ return a.push(A), S;
3110
3204
  }), e = e.replace(/<(video|audio|iframe)[^>]*>[\s\S]*?<\/\1>/gi, (A) => {
3111
- const C = `__PROTECTED_${a.length}__`;
3112
- return a.push(A), C;
3205
+ const S = `__PROTECTED_${a.length}__`;
3206
+ return a.push(A), S;
3113
3207
  });
3114
3208
  const s = /<a[^>]*href="(https?:\/\/[^"]+\.(mp3|wav|flac|aac|ogg|m4a|wma)(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
3115
- e = e.replace(s, (A, C) => vt(C));
3209
+ e = e.replace(s, (A, S) => yt(S));
3116
3210
  const n = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(mp3|wav|flac|aac|ogg|m4a|wma)(\\?[^\\s<>"]*)?)(?!["'])`, "gi");
3117
- e = e.replace(n, (A, C) => vt(C));
3211
+ e = e.replace(n, (A, S) => yt(S));
3118
3212
  const o = /<a[^>]*href="(https?:\/\/(?:www\.)?soundcloud\.com\/[^"]+)"[^>]*>[^<]*<\/a>/gi;
3119
- e = e.replace(o, (A, C) => yt(C));
3213
+ e = e.replace(o, (A, S) => kt(S));
3120
3214
  const i = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?soundcloud\\.com\\/[^\\s<>"]+)(?!["'])`, "gi");
3121
- e = e.replace(i, (A, C) => yt(C));
3215
+ e = e.replace(i, (A, S) => kt(S));
3122
3216
  const u = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/track\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3123
- e = e.replace(u, (A, C, R) => O("track", R, r));
3217
+ e = e.replace(u, (A, S, L) => F("track", L, r));
3124
3218
  const l = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/track\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3125
- e = e.replace(l, (A, C, R) => O("track", R, r));
3219
+ e = e.replace(l, (A, S, L) => F("track", L, r));
3126
3220
  const d = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/album\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3127
- e = e.replace(d, (A, C, R) => O("album", R, r));
3221
+ e = e.replace(d, (A, S, L) => F("album", L, r));
3128
3222
  const p = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/album\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3129
- e = e.replace(p, (A, C, R) => O("album", R, r));
3223
+ e = e.replace(p, (A, S, L) => F("album", L, r));
3130
3224
  const w = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/playlist\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3131
- e = e.replace(w, (A, C, R) => O("playlist", R, r));
3225
+ e = e.replace(w, (A, S, L) => F("playlist", L, r));
3132
3226
  const c = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/playlist\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3133
- e = e.replace(c, (A, C, R) => O("playlist", R, r));
3134
- const m = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/artist\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3135
- e = e.replace(m, (A, C, R) => O("artist", R, r));
3136
- const h = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/artist\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3137
- e = e.replace(h, (A, C, R) => O("artist", R, r));
3227
+ e = e.replace(c, (A, S, L) => F("playlist", L, r));
3228
+ const h = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/artist\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3229
+ e = e.replace(h, (A, S, L) => F("artist", L, r));
3230
+ const f = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/artist\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3231
+ e = e.replace(f, (A, S, L) => F("artist", L, r));
3138
3232
  const g = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/episode\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3139
- e = e.replace(g, (A, C, R) => O("episode", R, r));
3140
- const f = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/episode\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3141
- e = e.replace(f, (A, C, R) => O("episode", R, r));
3233
+ e = e.replace(g, (A, S, L) => F("episode", L, r));
3234
+ const m = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/episode\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3235
+ e = e.replace(m, (A, S, L) => F("episode", L, r));
3142
3236
  const b = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/show\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3143
- e = e.replace(b, (A, C, R) => O("show", R, r));
3237
+ e = e.replace(b, (A, S, L) => F("show", L, r));
3144
3238
  const v = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/show\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3145
- e = e.replace(v, (A, C, R) => O("show", R, r));
3239
+ e = e.replace(v, (A, S, L) => F("show", L, r));
3146
3240
  const x = /<a[^>]*href="(https?:\/\/music\.apple\.com\/([a-z]{2})\/([a-z-]+)\/[^\/]+\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3147
- e = e.replace(x, (A, C, R, M, y) => kt(R, M, y));
3148
- const $ = new RegExp(`(?<!["'=])(https?:\\/\\/music\\.apple\\.com\\/([a-z]{2})\\/([a-z-]+)\\/[^\\/\\s]+\\/(\\d+))(?!["'])`, "gi");
3149
- e = e.replace($, (A, C, R, M, y) => kt(R, M, y));
3241
+ e = e.replace(x, (A, S, L, $, y) => xt(L, $, y));
3242
+ const M = new RegExp(`(?<!["'=])(https?:\\/\\/music\\.apple\\.com\\/([a-z]{2})\\/([a-z-]+)\\/[^\\/\\s]+\\/(\\d+))(?!["'])`, "gi");
3243
+ e = e.replace(M, (A, S, L, $, y) => xt(L, $, y));
3150
3244
  for (let A = a.length - 1; A >= 0; A--)
3151
3245
  e = e.replace(`__PROTECTED_${A}__`, a[A]);
3152
3246
  return e;
3153
3247
  }
3154
- function ds(e) {
3248
+ function ps(e) {
3155
3249
  const t = e.match(/\.([a-zA-Z0-9]+)(?:\?|$)/);
3156
3250
  return t ? t[1].toUpperCase() : "AUDIO";
3157
3251
  }
3158
- function de(e) {
3252
+ function pe(e) {
3159
3253
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
3160
3254
  }
3161
- function vt(e) {
3162
- const t = cs(), r = decodeURIComponent(e.split("/").pop().split("?")[0]), a = ds(e);
3255
+ function yt(e) {
3256
+ const t = us(), r = decodeURIComponent(e.split("/").pop().split("?")[0]), a = ps(e);
3163
3257
  return `
3164
- <div class="artifactuse-audio-player" data-player-id="${t}" data-audio-src="${de(e)}">
3258
+ <div class="artifactuse-audio-player" data-player-id="${t}" data-audio-src="${pe(e)}">
3165
3259
  <!-- Hidden audio element -->
3166
3260
  <audio preload="metadata" class="artifactuse-audio-element">
3167
- <source src="${de(e)}" type="audio/mpeg">
3261
+ <source src="${pe(e)}" type="audio/mpeg">
3168
3262
  </audio>
3169
3263
 
3170
3264
  <!-- Header -->
@@ -3177,7 +3271,7 @@ function vt(e) {
3177
3271
  </svg>
3178
3272
  </div>
3179
3273
  <div class="artifactuse-audio-meta">
3180
- <span class="artifactuse-audio-filename" title="${de(r)}">${de(r)}</span>
3274
+ <span class="artifactuse-audio-filename" title="${pe(r)}">${pe(r)}</span>
3181
3275
  <span class="artifactuse-audio-format">${a}</span>
3182
3276
  </div>
3183
3277
  <span class="artifactuse-audio-duration">--:--</span>
@@ -3238,7 +3332,7 @@ function vt(e) {
3238
3332
  </div>
3239
3333
 
3240
3334
  <!-- Download -->
3241
- <a href="${de(e)}" download class="artifactuse-audio-btn artifactuse-audio-download-btn" aria-label="Download">
3335
+ <a href="${pe(e)}" download class="artifactuse-audio-btn artifactuse-audio-download-btn" aria-label="Download">
3242
3336
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
3243
3337
  <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
3244
3338
  <polyline points="7 10 12 15 17 10"></polyline>
@@ -3250,7 +3344,7 @@ function vt(e) {
3250
3344
  </div>
3251
3345
  `;
3252
3346
  }
3253
- function yt(e) {
3347
+ function kt(e) {
3254
3348
  return `
3255
3349
  <div class="artifactuse-soundcloud-wrapper">
3256
3350
  <iframe
@@ -3262,7 +3356,7 @@ function yt(e) {
3262
3356
  </div>
3263
3357
  `;
3264
3358
  }
3265
- function O(e, t, r = "dark") {
3359
+ function F(e, t, r = "dark") {
3266
3360
  const s = {
3267
3361
  track: 152,
3268
3362
  album: 352,
@@ -3285,7 +3379,7 @@ function O(e, t, r = "dark") {
3285
3379
  </div>
3286
3380
  `;
3287
3381
  }
3288
- function kt(e, t, r) {
3382
+ function xt(e, t, r) {
3289
3383
  return `
3290
3384
  <div class="artifactuse-apple-music-wrapper">
3291
3385
  <iframe
@@ -3299,16 +3393,16 @@ function kt(e, t, r) {
3299
3393
  </div>
3300
3394
  `;
3301
3395
  }
3302
- const ae = /* @__PURE__ */ new Map(), je = [0.5, 0.75, 1, 1.25, 1.5, 2];
3303
- function ps(e = document) {
3396
+ const ne = /* @__PURE__ */ new Map(), He = [0.5, 0.75, 1, 1.25, 1.5, 2];
3397
+ function fs(e = document) {
3304
3398
  e.querySelectorAll(".artifactuse-audio-player:not([data-initialized])").forEach((r) => {
3305
- fs(r);
3399
+ hs(r);
3306
3400
  });
3307
3401
  }
3308
- function fs(e) {
3402
+ function hs(e) {
3309
3403
  const t = e.dataset.playerId, r = e.dataset.audioSrc;
3310
3404
  if (!t || !r) return;
3311
- 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"), m = e.querySelector(".artifactuse-audio-icon-volume"), h = e.querySelector(".artifactuse-audio-icon-muted"), g = e.querySelector(".artifactuse-audio-volume-slider"), f = e.querySelector(".artifactuse-audio-speed-btn");
3405
+ 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");
3312
3406
  if (!a) return;
3313
3407
  const b = {
3314
3408
  isPlaying: !1,
@@ -3319,41 +3413,41 @@ function fs(e) {
3319
3413
  currentTime: 0,
3320
3414
  waveformData: null
3321
3415
  };
3322
- ae.set(t, { playerEl: e, audio: a, state: b }), hs(d, t), s == null || s.addEventListener("click", () => {
3323
- b.isPlaying ? zt(t) : At(t);
3416
+ ne.set(t, { playerEl: e, audio: a, state: b }), gs(d, t), s == null || s.addEventListener("click", () => {
3417
+ b.isPlaying ? St(t) : zt(t);
3324
3418
  }), a.addEventListener("loadedmetadata", () => {
3325
- b.duration = a.duration, u.textContent = $t(a.duration);
3419
+ b.duration = a.duration, u.textContent = At(a.duration);
3326
3420
  }), a.addEventListener("timeupdate", () => {
3327
- b.currentTime = a.currentTime, i.textContent = $t(a.currentTime);
3421
+ b.currentTime = a.currentTime, i.textContent = At(a.currentTime);
3328
3422
  const v = a.currentTime / a.duration * 100;
3329
3423
  p.style.width = `${v}%`;
3330
3424
  }), a.addEventListener("ended", () => {
3331
3425
  b.isPlaying = !1, n.style.display = "", o.style.display = "none", e.classList.remove("is-playing"), p.style.width = "0%";
3332
3426
  }), a.addEventListener("play", () => {
3333
- b.isPlaying = !0, n.style.display = "none", o.style.display = "", e.classList.add("is-playing"), gs(t);
3427
+ b.isPlaying = !0, n.style.display = "none", o.style.display = "", e.classList.add("is-playing"), ms(t);
3334
3428
  }), a.addEventListener("pause", () => {
3335
3429
  b.isPlaying = !1, n.style.display = "", o.style.display = "none", e.classList.remove("is-playing");
3336
3430
  }), l == null || l.addEventListener("click", (v) => {
3337
- const x = l.getBoundingClientRect(), C = (v.clientX - x.left) / x.width * a.duration;
3338
- isNaN(C) || (a.currentTime = C);
3431
+ const x = l.getBoundingClientRect(), S = (v.clientX - x.left) / x.width * a.duration;
3432
+ isNaN(S) || (a.currentTime = S);
3339
3433
  }), l == null || l.addEventListener("mousemove", (v) => {
3340
3434
  const x = l.getBoundingClientRect(), A = (v.clientX - x.left) / x.width * 100;
3341
3435
  w.style.width = `${A}%`;
3342
3436
  }), l == null || l.addEventListener("mouseleave", () => {
3343
3437
  w.style.width = "0%";
3344
3438
  }), c == null || c.addEventListener("click", () => {
3345
- b.isMuted = !b.isMuted, a.muted = b.isMuted, m.style.display = b.isMuted ? "none" : "", h.style.display = b.isMuted ? "" : "none", b.isMuted ? g.value = 0 : g.value = b.volume * 100;
3439
+ b.isMuted = !b.isMuted, a.muted = b.isMuted, h.style.display = b.isMuted ? "none" : "", f.style.display = b.isMuted ? "" : "none", b.isMuted ? g.value = 0 : g.value = b.volume * 100;
3346
3440
  }), g == null || g.addEventListener("input", (v) => {
3347
3441
  const x = parseInt(v.target.value, 10) / 100;
3348
- b.volume = x, a.volume = x, x === 0 ? (b.isMuted = !0, m.style.display = "none", h.style.display = "") : (b.isMuted = !1, a.muted = !1, m.style.display = "", h.style.display = "none");
3349
- }), f == null || f.addEventListener("click", () => {
3350
- const x = (je.indexOf(b.playbackRate) + 1) % je.length;
3351
- b.playbackRate = je[x], a.playbackRate = b.playbackRate, f.querySelector("span").textContent = `${b.playbackRate}x`;
3442
+ b.volume = x, a.volume = x, x === 0 ? (b.isMuted = !0, h.style.display = "none", f.style.display = "") : (b.isMuted = !1, a.muted = !1, h.style.display = "", f.style.display = "none");
3443
+ }), m == null || m.addEventListener("click", () => {
3444
+ const x = (He.indexOf(b.playbackRate) + 1) % He.length;
3445
+ b.playbackRate = He[x], a.playbackRate = b.playbackRate, m.querySelector("span").textContent = `${b.playbackRate}x`;
3352
3446
  }), e.addEventListener("keydown", (v) => {
3353
3447
  switch (v.key) {
3354
3448
  case " ":
3355
3449
  case "k":
3356
- v.preventDefault(), b.isPlaying ? zt(t) : At(t);
3450
+ v.preventDefault(), b.isPlaying ? St(t) : zt(t);
3357
3451
  break;
3358
3452
  case "ArrowLeft":
3359
3453
  v.preventDefault(), a.currentTime = Math.max(0, a.currentTime - 5);
@@ -3373,19 +3467,19 @@ function fs(e) {
3373
3467
  }
3374
3468
  }), e.setAttribute("data-initialized", "true"), e.setAttribute("tabindex", "0");
3375
3469
  }
3376
- function hs(e, t) {
3470
+ function gs(e, t) {
3377
3471
  if (!e) return;
3378
3472
  const r = e.getContext("2d"), a = window.devicePixelRatio || 1, s = e.parentElement.getBoundingClientRect();
3379
3473
  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);
3380
- const n = s.width, o = s.height, i = Math.floor(n / 4), u = xt(i, t);
3381
- Mt(r, u, n, o), new ResizeObserver(() => {
3474
+ const n = s.width, o = s.height, i = Math.floor(n / 4), u = Mt(i, t);
3475
+ $t(r, u, n, o), new ResizeObserver(() => {
3382
3476
  const d = e.parentElement.getBoundingClientRect();
3383
3477
  e.width = d.width * a, e.height = d.height * a, e.style.width = `${d.width}px`, e.style.height = `${d.height}px`, r.scale(a, a);
3384
- const p = Math.floor(d.width / 4), w = xt(p, t);
3385
- Mt(r, w, d.width, d.height);
3478
+ const p = Math.floor(d.width / 4), w = Mt(p, t);
3479
+ $t(r, w, d.width, d.height);
3386
3480
  }).observe(e.parentElement);
3387
3481
  }
3388
- function xt(e, t) {
3482
+ function Mt(e, t) {
3389
3483
  const r = [];
3390
3484
  let a = 0;
3391
3485
  for (let n = 0; n < t.length; n++) {
@@ -3402,98 +3496,98 @@ function xt(e, t) {
3402
3496
  }
3403
3497
  return r;
3404
3498
  }
3405
- function Mt(e, t, r, a) {
3499
+ function $t(e, t, r, a) {
3406
3500
  e.clearRect(0, 0, r, a);
3407
3501
  const s = 2, o = s + 2, i = a / 2, l = getComputedStyle(document.documentElement).getPropertyValue("--artifactuse-text-muted").trim() || "107, 114, 128";
3408
3502
  e.fillStyle = `rgba(${l}, 0.4)`, t.forEach((d, p) => {
3409
- const w = p * o, c = d * (a * 0.8), m = c / 2, h = s / 2;
3410
- e.beginPath(), e.roundRect(w, i - m, s, c, h), e.fill();
3503
+ const w = p * o, c = d * (a * 0.8), h = c / 2, f = s / 2;
3504
+ e.beginPath(), e.roundRect(w, i - h, s, c, f), e.fill();
3411
3505
  });
3412
3506
  }
3413
- function $t(e) {
3507
+ function At(e) {
3414
3508
  if (!e || isNaN(e)) return "0:00";
3415
3509
  const t = Math.floor(e / 3600), r = Math.floor(e % 3600 / 60), a = Math.floor(e % 60);
3416
3510
  return t > 0 ? `${t}:${r.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}` : `${r}:${a.toString().padStart(2, "0")}`;
3417
3511
  }
3418
- function At(e) {
3419
- const t = ae.get(e);
3512
+ function zt(e) {
3513
+ const t = ne.get(e);
3420
3514
  t && t.audio.play();
3421
3515
  }
3422
- function zt(e) {
3423
- const t = ae.get(e);
3516
+ function St(e) {
3517
+ const t = ne.get(e);
3424
3518
  t && t.audio.pause();
3425
3519
  }
3426
- function gs(e) {
3427
- ae.forEach((t, r) => {
3520
+ function ms(e) {
3521
+ ne.forEach((t, r) => {
3428
3522
  r !== e && t.state.isPlaying && t.audio.pause();
3429
3523
  });
3430
3524
  }
3431
- function ms(e) {
3432
- const t = ae.get(e);
3433
- t && (t.audio.pause(), t.audio.src = "", ae.delete(e));
3525
+ function ws(e) {
3526
+ const t = ne.get(e);
3527
+ t && (t.audio.pause(), t.audio.src = "", ne.delete(e));
3434
3528
  }
3435
- function ws() {
3436
- ae.forEach((e, t) => {
3437
- ms(t);
3529
+ function bs() {
3530
+ ne.forEach((e, t) => {
3531
+ ws(t);
3438
3532
  });
3439
3533
  }
3440
- function bs(e) {
3534
+ function vs(e) {
3441
3535
  const t = [];
3442
3536
  e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (g) => {
3443
- const f = `__PROTECTED_MAP_${t.length}__`;
3444
- return t.push(g), f;
3537
+ const m = `__PROTECTED_MAP_${t.length}__`;
3538
+ return t.push(g), m;
3445
3539
  }), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (g) => {
3446
- const f = `__PROTECTED_MAP_${t.length}__`;
3447
- return t.push(g), f;
3540
+ const m = `__PROTECTED_MAP_${t.length}__`;
3541
+ return t.push(g), m;
3448
3542
  }), e = e.replace(/<iframe[^>]*>[\s\S]*?<\/iframe>/gi, (g) => {
3449
- const f = `__PROTECTED_MAP_${t.length}__`;
3450
- return t.push(g), f;
3543
+ const m = `__PROTECTED_MAP_${t.length}__`;
3544
+ return t.push(g), m;
3451
3545
  });
3452
3546
  const r = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/embed\?pb=[^"]+)"[^>]*>[^<]*<\/a>/gi;
3453
- e = e.replace(r, (g, f) => {
3547
+ e = e.replace(r, (g, m) => {
3454
3548
  const b = `__PROTECTED_MAP_${t.length}__`;
3455
- return t.push(St(f)), b;
3549
+ return t.push(Ct(m)), b;
3456
3550
  });
3457
3551
  const a = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/embed\\?pb=[^\\s<>"]+)(?!["'])`, "gi");
3458
- e = e.replace(a, (g, f) => {
3552
+ e = e.replace(a, (g, m) => {
3459
3553
  const b = `__PROTECTED_MAP_${t.length}__`;
3460
- return t.push(St(f)), b;
3554
+ return t.push(Ct(m)), b;
3461
3555
  });
3462
3556
  const s = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/place\/([^\/\?"]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3463
- e = e.replace(s, (g, f, b) => Y(decodeURIComponent(b.replace(/\+/g, " "))));
3557
+ e = e.replace(s, (g, m, b) => ee(decodeURIComponent(b.replace(/\+/g, " "))));
3464
3558
  const n = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/place\\/([^\\/\\?\\s]+))(?!["'])`, "gi");
3465
- e = e.replace(n, (g, f, b) => Y(decodeURIComponent(b.replace(/\+/g, " "))));
3559
+ e = e.replace(n, (g, m, b) => ee(decodeURIComponent(b.replace(/\+/g, " "))));
3466
3560
  const o = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/@([0-9.-]+),([0-9.-]+),([0-9]+)z[^"]*)"[^>]*>[^<]*<\/a>/gi;
3467
- e = e.replace(o, (g, f, b, v, x) => Ue(b, v, x));
3561
+ e = e.replace(o, (g, m, b, v, x) => Ue(b, v, x));
3468
3562
  const i = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/@([0-9.-]+),([0-9.-]+),([0-9]+)z)(?!["'])`, "gi");
3469
- e = e.replace(i, (g, f, b, v, x) => Ue(b, v, x));
3563
+ e = e.replace(i, (g, m, b, v, x) => Ue(b, v, x));
3470
3564
  const u = /<a[^>]*href="(https?:\/\/maps\.google\.com\/\?q=([^\s"&]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3471
- e = e.replace(u, (g, f, b) => Y(decodeURIComponent(b)));
3565
+ e = e.replace(u, (g, m, b) => ee(decodeURIComponent(b)));
3472
3566
  const l = new RegExp(`(?<!["'=])(https?:\\/\\/maps\\.google\\.com\\/\\?q=([^\\s"&]+))(?!["'])`, "gi");
3473
- e = e.replace(l, (g, f, b) => Y(decodeURIComponent(b)));
3567
+ e = e.replace(l, (g, m, b) => ee(decodeURIComponent(b)));
3474
3568
  const d = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/search\/([^\/\?"]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3475
- e = e.replace(d, (g, f, b) => Y(decodeURIComponent(b.replace(/\+/g, " "))));
3569
+ e = e.replace(d, (g, m, b) => ee(decodeURIComponent(b.replace(/\+/g, " "))));
3476
3570
  const p = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/search\\/([^\\/\\?\\s]+))(?!["'])`, "gi");
3477
- e = e.replace(p, (g, f, b) => Y(decodeURIComponent(b.replace(/\+/g, " "))));
3571
+ e = e.replace(p, (g, m, b) => ee(decodeURIComponent(b.replace(/\+/g, " "))));
3478
3572
  const w = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/search\/\?[^"]*query=([^"&]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3479
- e = e.replace(w, (g, f, b) => Y(decodeURIComponent(b.replace(/\+/g, " "))));
3573
+ e = e.replace(w, (g, m, b) => ee(decodeURIComponent(b.replace(/\+/g, " "))));
3480
3574
  const c = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/search\\/\\?[^\\s"]*query=([^\\s"&]+))(?!["'])`, "gi");
3481
- e = e.replace(c, (g, f, b) => Y(decodeURIComponent(b.replace(/\+/g, " "))));
3482
- const m = /<a[^>]*href="(https?:\/\/(?:www\.)?openstreetmap\.org\/[^"]*mlat=([0-9.-]+)[^"]*mlon=([0-9.-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3483
- e = e.replace(m, (g, f, b, v) => {
3484
- const x = f.match(/#map=(\d+)/), $ = x ? x[1] : 15;
3485
- return Ct(b, v, $);
3575
+ e = e.replace(c, (g, m, b) => ee(decodeURIComponent(b.replace(/\+/g, " "))));
3576
+ const h = /<a[^>]*href="(https?:\/\/(?:www\.)?openstreetmap\.org\/[^"]*mlat=([0-9.-]+)[^"]*mlon=([0-9.-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3577
+ e = e.replace(h, (g, m, b, v) => {
3578
+ const x = m.match(/#map=(\d+)/), M = x ? x[1] : 15;
3579
+ return Rt(b, v, M);
3486
3580
  });
3487
- const h = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?openstreetmap\\.org\\/[^\\s]*mlat=([0-9.-]+)[^\\s]*mlon=([0-9.-]+))(?!["'])`, "gi");
3488
- e = e.replace(h, (g, f, b, v) => {
3489
- const x = f.match(/#map=(\d+)/), $ = x ? x[1] : 15;
3490
- return Ct(b, v, $);
3581
+ const f = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?openstreetmap\\.org\\/[^\\s]*mlat=([0-9.-]+)[^\\s]*mlon=([0-9.-]+))(?!["'])`, "gi");
3582
+ e = e.replace(f, (g, m, b, v) => {
3583
+ const x = m.match(/#map=(\d+)/), M = x ? x[1] : 15;
3584
+ return Rt(b, v, M);
3491
3585
  });
3492
3586
  for (let g = t.length - 1; g >= 0; g--)
3493
3587
  e = e.replace(`__PROTECTED_MAP_${g}__`, t[g]);
3494
3588
  return e;
3495
3589
  }
3496
- function St(e) {
3590
+ function Ct(e) {
3497
3591
  const t = e.match(/pb=([^&]+)/);
3498
3592
  if (t) {
3499
3593
  const r = decodeURIComponent(t[1]), a = r.match(/!3d(-?[\d.]+).*?!2d(-?[\d.]+)/), s = r.match(/!2d(-?[\d.]+).*?!3d(-?[\d.]+)/);
@@ -3521,7 +3615,7 @@ function St(e) {
3521
3615
  </div>
3522
3616
  `;
3523
3617
  }
3524
- function Y(e) {
3618
+ function ee(e) {
3525
3619
  const t = encodeURIComponent(e);
3526
3620
  return `
3527
3621
  <div class="artifactuse-map-wrapper">
@@ -3565,7 +3659,7 @@ function Ue(e, t, r) {
3565
3659
  </div>
3566
3660
  `;
3567
3661
  }
3568
- function Ct(e, t, r = 15) {
3662
+ function Rt(e, t, r = 15) {
3569
3663
  return `
3570
3664
  <div class="artifactuse-map-wrapper">
3571
3665
  <iframe
@@ -3581,41 +3675,41 @@ function Ct(e, t, r = 15) {
3581
3675
  </div>
3582
3676
  `;
3583
3677
  }
3584
- function vs(e, t = {}) {
3678
+ function ys(e, t = {}) {
3585
3679
  const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/(?:www\.)?(?:twitter\.com|x\.com)\/([a-zA-Z0-9_]+)\/status\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3586
- e = e.replace(a, (v, x, $, A) => Rt($, A, r));
3680
+ e = e.replace(a, (v, x, M, A) => Lt(M, A, r));
3587
3681
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?(?:twitter\\.com|x\\.com)\\/([a-zA-Z0-9_]+)\\/status\\/(\\d+))(?!["'])`, "gi");
3588
- e = e.replace(s, (v, x, $, A) => Rt($, A, r));
3682
+ e = e.replace(s, (v, x, M, A) => Lt(M, A, r));
3589
3683
  const n = /<a[^>]*href="(https?:\/\/(?:www\.)?instagram\.com\/p\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3590
- e = e.replace(n, (v, x, $) => Lt($));
3684
+ e = e.replace(n, (v, x, M) => Tt(M));
3591
3685
  const o = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?instagram\\.com\\/p\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3592
- e = e.replace(o, (v, x, $) => Lt($));
3686
+ e = e.replace(o, (v, x, M) => Tt(M));
3593
3687
  const i = /<a[^>]*href="(https?:\/\/(?:www\.)?instagram\.com\/reel\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3594
- e = e.replace(i, (v, x, $) => Tt($));
3688
+ e = e.replace(i, (v, x, M) => _t(M));
3595
3689
  const u = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?instagram\\.com\\/reel\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3596
- e = e.replace(u, (v, x, $) => Tt($));
3690
+ e = e.replace(u, (v, x, M) => _t(M));
3597
3691
  const l = /<a[^>]*href="(https?:\/\/(?:www\.)?tiktok\.com\/@([a-zA-Z0-9_.]+)\/video\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3598
- e = e.replace(l, (v, x, $, A) => _t(A));
3692
+ e = e.replace(l, (v, x, M, A) => Et(A));
3599
3693
  const d = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?tiktok\\.com\\/@([a-zA-Z0-9_.]+)\\/video\\/(\\d+))(?!["'])`, "gi");
3600
- e = e.replace(d, (v, x, $, A) => _t(A));
3694
+ e = e.replace(d, (v, x, M, A) => Et(A));
3601
3695
  const p = /<a[^>]*href="(https?:\/\/(?:www\.)?linkedin\.com\/(?:posts|feed\/update)\/([a-zA-Z0-9_:-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3602
- e = e.replace(p, (v, x, $) => Et($, x));
3696
+ e = e.replace(p, (v, x, M) => Pt(M, x));
3603
3697
  const w = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?linkedin\\.com\\/(?:posts|feed\\/update)\\/([a-zA-Z0-9_:-]+))(?!["'])`, "gi");
3604
- e = e.replace(w, (v, x, $) => Et($, x));
3698
+ e = e.replace(w, (v, x, M) => Pt(M, x));
3605
3699
  const c = /<a[^>]*href="(https?:\/\/(?:www\.)?reddit\.com\/r\/([a-zA-Z0-9_]+)\/comments\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3606
- e = e.replace(c, (v, x, $, A) => Pt($, A, x));
3607
- const m = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?reddit\\.com\\/r\\/([a-zA-Z0-9_]+)\\/comments\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3608
- e = e.replace(m, (v, x, $, A) => Pt($, A, x));
3609
- const h = /<a[^>]*href="(https?:\/\/(?:www\.)?facebook\.com\/[a-zA-Z0-9.]+\/posts\/\d+[^"]*)"[^>]*>[^<]*<\/a>/gi;
3610
- e = e.replace(h, (v, x) => jt(x));
3700
+ e = e.replace(c, (v, x, M, A) => jt(M, A, x));
3701
+ const h = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?reddit\\.com\\/r\\/([a-zA-Z0-9_]+)\\/comments\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3702
+ e = e.replace(h, (v, x, M, A) => jt(M, A, x));
3703
+ const f = /<a[^>]*href="(https?:\/\/(?:www\.)?facebook\.com\/[a-zA-Z0-9.]+\/posts\/\d+[^"]*)"[^>]*>[^<]*<\/a>/gi;
3704
+ e = e.replace(f, (v, x) => Ht(x));
3611
3705
  const g = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?facebook\\.com\\/[a-zA-Z0-9.]+\\/posts\\/\\d+)(?!["'])`, "gi");
3612
- e = e.replace(g, (v, x) => jt(x));
3613
- const f = /<a[^>]*href="(https?:\/\/(?:www\.)?pinterest\.com\/pin\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3614
- e = e.replace(f, (v, x, $) => Ht($));
3706
+ e = e.replace(g, (v, x) => Ht(x));
3707
+ const m = /<a[^>]*href="(https?:\/\/(?:www\.)?pinterest\.com\/pin\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3708
+ e = e.replace(m, (v, x, M) => Vt(M));
3615
3709
  const b = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?pinterest\\.com\\/pin\\/(\\d+))(?!["'])`, "gi");
3616
- return e = e.replace(b, (v, x, $) => Ht($)), e;
3710
+ return e = e.replace(b, (v, x, M) => Vt(M)), e;
3617
3711
  }
3618
- function Rt(e, t, r = "dark") {
3712
+ function Lt(e, t, r = "dark") {
3619
3713
  return `
3620
3714
  <div class="artifactuse-twitter-wrapper">
3621
3715
  <blockquote class="twitter-tweet" data-dnt="true" data-theme="${r}">
@@ -3625,7 +3719,7 @@ function Rt(e, t, r = "dark") {
3625
3719
  </div>
3626
3720
  `;
3627
3721
  }
3628
- function Lt(e) {
3722
+ function Tt(e) {
3629
3723
  return `
3630
3724
  <div class="artifactuse-instagram-wrapper">
3631
3725
  <iframe
@@ -3639,7 +3733,7 @@ function Lt(e) {
3639
3733
  </div>
3640
3734
  `;
3641
3735
  }
3642
- function Tt(e) {
3736
+ function _t(e) {
3643
3737
  return `
3644
3738
  <div class="artifactuse-instagram-wrapper">
3645
3739
  <iframe
@@ -3653,7 +3747,7 @@ function Tt(e) {
3653
3747
  </div>
3654
3748
  `;
3655
3749
  }
3656
- function _t(e) {
3750
+ function Et(e) {
3657
3751
  return `
3658
3752
  <div class="artifactuse-tiktok-wrapper">
3659
3753
  <iframe
@@ -3666,7 +3760,7 @@ function _t(e) {
3666
3760
  </div>
3667
3761
  `;
3668
3762
  }
3669
- function Et(e, t) {
3763
+ function Pt(e, t) {
3670
3764
  return `
3671
3765
  <div class="artifactuse-linkedin-wrapper">
3672
3766
  <iframe
@@ -3682,7 +3776,7 @@ function Et(e, t) {
3682
3776
  </div>
3683
3777
  `;
3684
3778
  }
3685
- function Pt(e, t, r) {
3779
+ function jt(e, t, r) {
3686
3780
  return `
3687
3781
  <div class="artifactuse-reddit-wrapper">
3688
3782
  <iframe
@@ -3697,7 +3791,7 @@ function Pt(e, t, r) {
3697
3791
  </div>
3698
3792
  `;
3699
3793
  }
3700
- function jt(e) {
3794
+ function Ht(e) {
3701
3795
  return `
3702
3796
  <div class="artifactuse-facebook-wrapper">
3703
3797
  <iframe
@@ -3715,7 +3809,7 @@ function jt(e) {
3715
3809
  </div>
3716
3810
  `;
3717
3811
  }
3718
- function Ht(e) {
3812
+ function Vt(e) {
3719
3813
  return `
3720
3814
  <div class="artifactuse-pinterest-wrapper">
3721
3815
  <a data-pin-do="embedPin" data-pin-width="large" href="https://www.pinterest.com/pin/${e}/"></a>
@@ -3723,13 +3817,13 @@ function Ht(e) {
3723
3817
  </div>
3724
3818
  `;
3725
3819
  }
3726
- function ys(e) {
3820
+ function ks(e) {
3727
3821
  const t = /<a[^>]*href="(https?:\/\/[^"]+\.pdf(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
3728
- e = e.replace(t, (a, s) => Vt(s));
3822
+ e = e.replace(t, (a, s) => It(s));
3729
3823
  const r = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.pdf(?:\\?[^\\s<>"]*)?)(?!["'])`, "gi");
3730
- return e = e.replace(r, (a, s) => Vt(s)), e;
3824
+ return e = e.replace(r, (a, s) => It(s)), e;
3731
3825
  }
3732
- function Vt(e) {
3826
+ function It(e) {
3733
3827
  return `
3734
3828
  <div class="artifactuse-pdf-wrapper">
3735
3829
  <div class="artifactuse-pdf-header">
@@ -3753,25 +3847,25 @@ function Vt(e) {
3753
3847
  </div>
3754
3848
  `;
3755
3849
  }
3756
- function ks(e) {
3850
+ function xs(e) {
3757
3851
  const t = /<a[^>]*href="(https?:\/\/docs\.google\.com\/document\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3758
- e = e.replace(t, (l, d, p) => ie(p, "document"));
3852
+ e = e.replace(t, (l, d, p) => oe(p, "document"));
3759
3853
  const r = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/document\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3760
- e = e.replace(r, (l, d, p) => ie(p, "document"));
3854
+ e = e.replace(r, (l, d, p) => oe(p, "document"));
3761
3855
  const a = /<a[^>]*href="(https?:\/\/docs\.google\.com\/spreadsheets\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3762
- e = e.replace(a, (l, d, p) => ie(p, "spreadsheets"));
3856
+ e = e.replace(a, (l, d, p) => oe(p, "spreadsheets"));
3763
3857
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/spreadsheets\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3764
- e = e.replace(s, (l, d, p) => ie(p, "spreadsheets"));
3858
+ e = e.replace(s, (l, d, p) => oe(p, "spreadsheets"));
3765
3859
  const n = /<a[^>]*href="(https?:\/\/docs\.google\.com\/presentation\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3766
- e = e.replace(n, (l, d, p) => ie(p, "presentation"));
3860
+ e = e.replace(n, (l, d, p) => oe(p, "presentation"));
3767
3861
  const o = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/presentation\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3768
- e = e.replace(o, (l, d, p) => ie(p, "presentation"));
3862
+ e = e.replace(o, (l, d, p) => oe(p, "presentation"));
3769
3863
  const i = /<a[^>]*href="(https?:\/\/docs\.google\.com\/forms\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3770
- e = e.replace(i, (l, d, p) => It(p));
3864
+ e = e.replace(i, (l, d, p) => Dt(p));
3771
3865
  const u = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/forms\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3772
- return e = e.replace(u, (l, d, p) => It(p)), e;
3866
+ return e = e.replace(u, (l, d, p) => Dt(p)), e;
3773
3867
  }
3774
- function ie(e, t) {
3868
+ function oe(e, t) {
3775
3869
  const r = {
3776
3870
  document: "Google Doc",
3777
3871
  spreadsheets: "Google Sheet",
@@ -3802,7 +3896,7 @@ function ie(e, t) {
3802
3896
  </div>
3803
3897
  `;
3804
3898
  }
3805
- function It(e) {
3899
+ function Dt(e) {
3806
3900
  return `
3807
3901
  <div class="artifactuse-google-form-wrapper">
3808
3902
  <iframe
@@ -3813,13 +3907,13 @@ function It(e) {
3813
3907
  </div>
3814
3908
  `;
3815
3909
  }
3816
- function xs(e) {
3910
+ function Ms(e) {
3817
3911
  const t = /<a[^>]*href="(https?:\/\/[^"]+\.(docx?|xlsx?|pptx?)(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
3818
- e = e.replace(t, (a, s) => Dt(s));
3912
+ e = e.replace(t, (a, s) => qt(s));
3819
3913
  const r = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(docx?|xlsx?|pptx?)(?:\\?[^\\s<>"]*)?)(?!["'])`, "gi");
3820
- return e = e.replace(r, (a, s) => Dt(s)), e;
3914
+ return e = e.replace(r, (a, s) => qt(s)), e;
3821
3915
  }
3822
- function Dt(e) {
3916
+ function qt(e) {
3823
3917
  const t = encodeURIComponent(e), r = e.split("/").pop().split("?")[0], a = r.split(".").pop().toLowerCase();
3824
3918
  return `
3825
3919
  <div class="artifactuse-office-wrapper">
@@ -3845,43 +3939,43 @@ function Dt(e) {
3845
3939
  </div>
3846
3940
  `;
3847
3941
  }
3848
- function Ms(e) {
3942
+ function $s(e) {
3849
3943
  return `${e}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
3850
3944
  }
3851
- function $s(e, t = {}) {
3945
+ function As(e, t = {}) {
3852
3946
  const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/gist\.github\.com\/([a-zA-Z0-9_-]+)\/([a-f0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3853
- e = e.replace(a, (h, g, f, b) => qt(f, b));
3947
+ e = e.replace(a, (f, g, m, b) => Zt(m, b));
3854
3948
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/gist\\.github\\.com\\/([a-zA-Z0-9_-]+)\\/([a-f0-9]+))(?!["'])`, "gi");
3855
- e = e.replace(s, (h, g, f, b) => qt(f, b));
3949
+ e = e.replace(s, (f, g, m, b) => Zt(m, b));
3856
3950
  const n = /<a[^>]*href="(https?:\/\/codepen\.io\/([a-zA-Z0-9_-]+)\/(?:pen|full|details)\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3857
- e = e.replace(n, (h, g, f, b) => Zt(f, b, r));
3951
+ e = e.replace(n, (f, g, m, b) => Ot(m, b, r));
3858
3952
  const o = new RegExp(`(?<!["'=])(https?:\\/\\/codepen\\.io\\/([a-zA-Z0-9_-]+)\\/(?:pen|full|details)\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3859
- e = e.replace(o, (h, g, f, b) => Zt(f, b, r));
3953
+ e = e.replace(o, (f, g, m, b) => Ot(m, b, r));
3860
3954
  const i = /<a[^>]*href="(https?:\/\/codesandbox\.io\/(?:s|embed)\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3861
- e = e.replace(i, (h, g, f) => Ot(f, r));
3955
+ e = e.replace(i, (f, g, m) => Bt(m, r));
3862
3956
  const u = new RegExp(`(?<!["'=])(https?:\\/\\/codesandbox\\.io\\/(?:s|embed)\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
3863
- e = e.replace(u, (h, g, f) => Ot(f, r));
3957
+ e = e.replace(u, (f, g, m) => Bt(m, r));
3864
3958
  const l = /<a[^>]*href="(https?:\/\/jsfiddle\.net\/([a-zA-Z0-9_]+)\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3865
- e = e.replace(l, (h, g, f, b) => Bt(f, b, r));
3959
+ e = e.replace(l, (f, g, m, b) => Ft(m, b, r));
3866
3960
  const d = new RegExp(`(?<!["'=])(https?:\\/\\/jsfiddle\\.net\\/([a-zA-Z0-9_]+)\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3867
- e = e.replace(d, (h, g, f, b) => Bt(f, b, r));
3961
+ e = e.replace(d, (f, g, m, b) => Ft(m, b, r));
3868
3962
  const p = /<a[^>]*href="(https?:\/\/stackblitz\.com\/(?:edit|embed)\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3869
- e = e.replace(p, (h, g, f) => Ft(f, r));
3963
+ e = e.replace(p, (f, g, m) => Nt(m, r));
3870
3964
  const w = new RegExp(`(?<!["'=])(https?:\\/\\/stackblitz\\.com\\/(?:edit|embed)\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
3871
- e = e.replace(w, (h, g, f) => Ft(f, r));
3965
+ e = e.replace(w, (f, g, m) => Nt(m, r));
3872
3966
  const c = /<a[^>]*href="(https?:\/\/replit\.com\/@([a-zA-Z0-9_]+)\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3873
- e = e.replace(c, (h, g, f, b) => Nt(f, b, r));
3874
- const m = new RegExp(`(?<!["'=])(https?:\\/\\/replit\\.com\\/@([a-zA-Z0-9_]+)\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3875
- return e = e.replace(m, (h, g, f, b) => Nt(f, b, r)), e;
3967
+ e = e.replace(c, (f, g, m, b) => Ut(m, b, r));
3968
+ const h = new RegExp(`(?<!["'=])(https?:\\/\\/replit\\.com\\/@([a-zA-Z0-9_]+)\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3969
+ return e = e.replace(h, (f, g, m, b) => Ut(m, b, r)), e;
3876
3970
  }
3877
- function qt(e, t) {
3971
+ function Zt(e, t) {
3878
3972
  return `
3879
- <div class="artifactuse-gist-wrapper" id="${Ms("gist")}">
3973
+ <div class="artifactuse-gist-wrapper" id="${$s("gist")}">
3880
3974
  <script src="https://gist.github.com/${e}/${t}.js"><\/script>
3881
3975
  </div>
3882
3976
  `;
3883
3977
  }
3884
- function Zt(e, t, r = "dark") {
3978
+ function Ot(e, t, r = "dark") {
3885
3979
  return `
3886
3980
  <div class="artifactuse-codepen-wrapper">
3887
3981
  <iframe
@@ -3898,7 +3992,7 @@ function Zt(e, t, r = "dark") {
3898
3992
  </div>
3899
3993
  `;
3900
3994
  }
3901
- function Ot(e, t = "dark") {
3995
+ function Bt(e, t = "dark") {
3902
3996
  return `
3903
3997
  <div class="artifactuse-codesandbox-wrapper">
3904
3998
  <iframe
@@ -3912,7 +4006,7 @@ function Ot(e, t = "dark") {
3912
4006
  </div>
3913
4007
  `;
3914
4008
  }
3915
- function Bt(e, t, r = "dark") {
4009
+ function Ft(e, t, r = "dark") {
3916
4010
  return `
3917
4011
  <div class="artifactuse-jsfiddle-wrapper">
3918
4012
  <iframe
@@ -3927,7 +4021,7 @@ function Bt(e, t, r = "dark") {
3927
4021
  </div>
3928
4022
  `;
3929
4023
  }
3930
- function Ft(e, t = "dark") {
4024
+ function Nt(e, t = "dark") {
3931
4025
  return `
3932
4026
  <div class="artifactuse-stackblitz-wrapper">
3933
4027
  <iframe
@@ -3939,7 +4033,7 @@ function Ft(e, t = "dark") {
3939
4033
  </div>
3940
4034
  `;
3941
4035
  }
3942
- function Nt(e, t, r = "dark") {
4036
+ function Ut(e, t, r = "dark") {
3943
4037
  return `
3944
4038
  <div class="artifactuse-replit-wrapper">
3945
4039
  <iframe
@@ -3951,25 +4045,25 @@ function Nt(e, t, r = "dark") {
3951
4045
  </div>
3952
4046
  `;
3953
4047
  }
3954
- function As(e) {
4048
+ function zs(e) {
3955
4049
  const t = /<a[^>]*href="(https?:\/\/public\.tableau\.com\/(?:views|profile)\/([^\s"]+))"[^>]*>[^<]*<\/a>/gi;
3956
- e = e.replace(t, (l, d, p) => Ut(p));
4050
+ e = e.replace(t, (l, d, p) => Gt(p));
3957
4051
  const r = new RegExp(`(?<!["'=])(https?:\\/\\/public\\.tableau\\.com\\/(?:views|profile)\\/([^\\s<>"]+))(?!["'])`, "gi");
3958
- e = e.replace(r, (l, d, p) => Ut(p));
4052
+ e = e.replace(r, (l, d, p) => Gt(p));
3959
4053
  const a = /<a[^>]*href="(https?:\/\/(?:public\.)?flourish\.studio\/visualisation\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3960
- e = e.replace(a, (l, d, p) => Gt(p));
4054
+ e = e.replace(a, (l, d, p) => Wt(p));
3961
4055
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:public\\.)?flourish\\.studio\\/visualisation\\/(\\d+))(?!["'])`, "gi");
3962
- e = e.replace(s, (l, d, p) => Gt(p));
4056
+ e = e.replace(s, (l, d, p) => Wt(p));
3963
4057
  const n = /<a[^>]*href="(https?:\/\/datawrapper\.dwcdn\.net\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3964
- e = e.replace(n, (l, d, p) => Wt(p));
4058
+ e = e.replace(n, (l, d, p) => Xt(p));
3965
4059
  const o = new RegExp(`(?<!["'=])(https?:\\/\\/datawrapper\\.dwcdn\\.net\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3966
- e = e.replace(o, (l, d, p) => Wt(p));
4060
+ e = e.replace(o, (l, d, p) => Xt(p));
3967
4061
  const i = /<a[^>]*href="(https?:\/\/(?:e\.)?infogram\.com\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3968
- e = e.replace(i, (l, d, p) => Xt(p));
4062
+ e = e.replace(i, (l, d, p) => Kt(p));
3969
4063
  const u = new RegExp(`(?<!["'=])(https?:\\/\\/(?:e\\.)?infogram\\.com\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3970
- return e = e.replace(u, (l, d, p) => Xt(p)), e;
4064
+ return e = e.replace(u, (l, d, p) => Kt(p)), e;
3971
4065
  }
3972
- function Ut(e) {
4066
+ function Gt(e) {
3973
4067
  return `
3974
4068
  <div class="artifactuse-tableau-wrapper">
3975
4069
  <iframe
@@ -3981,7 +4075,7 @@ function Ut(e) {
3981
4075
  </div>
3982
4076
  `;
3983
4077
  }
3984
- function Gt(e) {
4078
+ function Wt(e) {
3985
4079
  return `
3986
4080
  <div class="artifactuse-flourish-wrapper">
3987
4081
  <iframe
@@ -3993,7 +4087,7 @@ function Gt(e) {
3993
4087
  </div>
3994
4088
  `;
3995
4089
  }
3996
- function Wt(e) {
4090
+ function Xt(e) {
3997
4091
  return `
3998
4092
  <div class="artifactuse-datawrapper-wrapper">
3999
4093
  <iframe
@@ -4005,7 +4099,7 @@ function Wt(e) {
4005
4099
  </div>
4006
4100
  `;
4007
4101
  }
4008
- function Xt(e) {
4102
+ function Kt(e) {
4009
4103
  return `
4010
4104
  <div class="artifactuse-infogram-wrapper">
4011
4105
  <iframe
@@ -4018,33 +4112,33 @@ function Xt(e) {
4018
4112
  </div>
4019
4113
  `;
4020
4114
  }
4021
- function zs(e, t = {}) {
4115
+ function Ss(e, t = {}) {
4022
4116
  const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/sketchfab\.com\/(?:3d-)?models\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4023
- e = e.replace(a, (h, g, f) => Kt(f, r));
4117
+ e = e.replace(a, (f, g, m) => Jt(m, r));
4024
4118
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/sketchfab\\.com\\/(?:3d-)?models\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
4025
- e = e.replace(s, (h, g, f) => Kt(f, r));
4119
+ e = e.replace(s, (f, g, m) => Jt(m, r));
4026
4120
  const n = /<a[^>]*href="(https?:\/\/(?:www\.)?figma\.com\/(?:file|design)\/([a-zA-Z0-9]+)(?:\/[^?\s"]*)?(?:\?node-id=([^&\s"]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
4027
- e = e.replace(n, (h, g, f, b) => Jt(f, b));
4121
+ e = e.replace(n, (f, g, m, b) => Qt(m, b));
4028
4122
  const o = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?figma\\.com\\/(?:file|design)\\/([a-zA-Z0-9]+)(?:\\/[^?\\s]*)?(?:\\?node-id=([^&\\s]+))?)(?!["'])`, "gi");
4029
- e = e.replace(o, (h, g, f, b) => Jt(f, b));
4123
+ e = e.replace(o, (f, g, m, b) => Qt(m, b));
4030
4124
  const i = /<a[^>]*href="(https?:\/\/(?:www\.)?figma\.com\/proto\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4031
- e = e.replace(i, (h, g, f) => Qt(f, g));
4125
+ e = e.replace(i, (f, g, m) => Yt(m, g));
4032
4126
  const u = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?figma\\.com\\/proto\\/([a-zA-Z0-9]+)[^\\s]*)(?!["'])`, "gi");
4033
- e = e.replace(u, (h, g, f) => Qt(f, g));
4127
+ e = e.replace(u, (f, g, m) => Yt(m, g));
4034
4128
  const l = /<a[^>]*href="(https?:\/\/(?:www\.)?canva\.com\/design\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4035
- e = e.replace(l, (h, g, f) => Yt(f, g));
4129
+ e = e.replace(l, (f, g, m) => er(m, g));
4036
4130
  const d = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?canva\\.com\\/design\\/([a-zA-Z0-9_-]+)[^\\s]*)(?!["'])`, "gi");
4037
- e = e.replace(d, (h, g, f) => Yt(f, g));
4131
+ e = e.replace(d, (f, g, m) => er(m, g));
4038
4132
  const p = /<a[^>]*href="(https?:\/\/dribbble\.com\/shots\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4039
- e = e.replace(p, (h, g, f) => er(f));
4133
+ e = e.replace(p, (f, g, m) => tr(m));
4040
4134
  const w = new RegExp(`(?<!["'=])(https?:\\/\\/dribbble\\.com\\/shots\\/(\\d+))(?!["'])`, "gi");
4041
- e = e.replace(w, (h, g, f) => er(f));
4135
+ e = e.replace(w, (f, g, m) => tr(m));
4042
4136
  const c = /<a[^>]*href="(https?:\/\/(?:www\.)?behance\.net\/gallery\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4043
- e = e.replace(c, (h, g, f) => tr(f, g));
4044
- const m = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?behance\\.net\\/gallery\\/(\\d+)[^\\s]*)(?!["'])`, "gi");
4045
- return e = e.replace(m, (h, g, f) => tr(f, g)), e;
4137
+ e = e.replace(c, (f, g, m) => rr(m, g));
4138
+ const h = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?behance\\.net\\/gallery\\/(\\d+)[^\\s]*)(?!["'])`, "gi");
4139
+ return e = e.replace(h, (f, g, m) => rr(m, g)), e;
4046
4140
  }
4047
- function Kt(e, t = "dark") {
4141
+ function Jt(e, t = "dark") {
4048
4142
  return `
4049
4143
  <div class="artifactuse-sketchfab-wrapper">
4050
4144
  <iframe
@@ -4059,7 +4153,7 @@ function Kt(e, t = "dark") {
4059
4153
  </div>
4060
4154
  `;
4061
4155
  }
4062
- function Jt(e, t) {
4156
+ function Qt(e, t) {
4063
4157
  const r = t ? `&node-id=${t}` : "";
4064
4158
  return `
4065
4159
  <div class="artifactuse-figma-wrapper">
@@ -4072,7 +4166,7 @@ function Jt(e, t) {
4072
4166
  </div>
4073
4167
  `;
4074
4168
  }
4075
- function Qt(e, t) {
4169
+ function Yt(e, t) {
4076
4170
  return `
4077
4171
  <div class="artifactuse-figma-wrapper">
4078
4172
  <iframe
@@ -4084,7 +4178,7 @@ function Qt(e, t) {
4084
4178
  </div>
4085
4179
  `;
4086
4180
  }
4087
- function Yt(e, t) {
4181
+ function er(e, t) {
4088
4182
  return `
4089
4183
  <div class="artifactuse-canva-wrapper">
4090
4184
  <div class="artifactuse-canva-preview">
@@ -4101,7 +4195,7 @@ function Yt(e, t) {
4101
4195
  </div>
4102
4196
  `;
4103
4197
  }
4104
- function er(e) {
4198
+ function tr(e) {
4105
4199
  return `
4106
4200
  <div class="artifactuse-dribbble-wrapper">
4107
4201
  <iframe
@@ -4113,7 +4207,7 @@ function er(e) {
4113
4207
  </div>
4114
4208
  `;
4115
4209
  }
4116
- function tr(e, t) {
4210
+ function rr(e, t) {
4117
4211
  return `
4118
4212
  <div class="artifactuse-behance-wrapper">
4119
4213
  <iframe
@@ -4128,37 +4222,37 @@ function tr(e, t) {
4128
4222
  </div>
4129
4223
  `;
4130
4224
  }
4131
- function Ss(e, t = {}) {
4225
+ function Cs(e, t = {}) {
4132
4226
  const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/(?:[a-zA-Z0-9-]+\.)?typeform\.com\/to\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4133
- e = e.replace(a, (f, b, v) => rr(v));
4227
+ e = e.replace(a, (m, b, v) => ar(v));
4134
4228
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:[a-zA-Z0-9-]+\\.)?typeform\\.com\\/to\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
4135
- e = e.replace(s, (f, b, v) => rr(v));
4229
+ e = e.replace(s, (m, b, v) => ar(v));
4136
4230
  const n = /<a[^>]*href="(https?:\/\/calendly\.com\/([a-zA-Z0-9_-]+)(?:\/([a-zA-Z0-9_-]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
4137
- e = e.replace(n, (f, b, v, x) => ar(v, x));
4231
+ e = e.replace(n, (m, b, v, x) => sr(v, x));
4138
4232
  const o = new RegExp(`(?<!["'=])(https?:\\/\\/calendly\\.com\\/([a-zA-Z0-9_-]+)(?:\\/([a-zA-Z0-9_-]+))?)(?!["'])`, "gi");
4139
- e = e.replace(o, (f, b, v, x) => ar(v, x));
4233
+ e = e.replace(o, (m, b, v, x) => sr(v, x));
4140
4234
  const i = /<a[^>]*href="(https?:\/\/calendar\.google\.com\/calendar\/appointments\/schedules\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4141
- e = e.replace(i, (f, b, v) => sr(v));
4235
+ e = e.replace(i, (m, b, v) => nr(v));
4142
4236
  const u = new RegExp(`(?<!["'=])(https?:\\/\\/calendar\\.google\\.com\\/calendar\\/appointments\\/schedules\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
4143
- e = e.replace(u, (f, b, v) => sr(v));
4237
+ e = e.replace(u, (m, b, v) => nr(v));
4144
4238
  const l = /<a[^>]*href="(https?:\/\/cal\.com\/([a-zA-Z0-9_-]+)(?:\/([a-zA-Z0-9_-]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
4145
- e = e.replace(l, (f, b, v, x) => nr(v, x, r));
4239
+ e = e.replace(l, (m, b, v, x) => ir(v, x, r));
4146
4240
  const d = new RegExp(`(?<!["'=])(https?:\\/\\/cal\\.com\\/([a-zA-Z0-9_-]+)(?:\\/([a-zA-Z0-9_-]+))?)(?!["'])`, "gi");
4147
- e = e.replace(d, (f, b, v, x) => nr(v, x, r));
4241
+ e = e.replace(d, (m, b, v, x) => ir(v, x, r));
4148
4242
  const p = /<a[^>]*href="(https?:\/\/(?:www\.)?notion\.so\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4149
- e = e.replace(p, (f, b, v) => ir(v));
4243
+ e = e.replace(p, (m, b, v) => or(v));
4150
4244
  const w = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?notion\\.so\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
4151
- e = e.replace(w, (f, b, v) => ir(v));
4245
+ e = e.replace(w, (m, b, v) => or(v));
4152
4246
  const c = /<a[^>]*href="(https?:\/\/airtable\.com\/(?:embed\/)?([a-zA-Z0-9]+)(?:\/([a-zA-Z0-9]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
4153
- e = e.replace(c, (f, b, v, x) => or(v, x));
4154
- const m = new RegExp(`(?<!["'=])(https?:\\/\\/airtable\\.com\\/(?:embed\\/)?([a-zA-Z0-9]+)(?:\\/([a-zA-Z0-9]+))?)(?!["'])`, "gi");
4155
- e = e.replace(m, (f, b, v, x) => or(v, x));
4156
- const h = /<a[^>]*href="(https?:\/\/miro\.com\/app\/board\/([a-zA-Z0-9_=-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4157
- e = e.replace(h, (f, b, v) => lr(v));
4247
+ e = e.replace(c, (m, b, v, x) => lr(v, x));
4248
+ const h = new RegExp(`(?<!["'=])(https?:\\/\\/airtable\\.com\\/(?:embed\\/)?([a-zA-Z0-9]+)(?:\\/([a-zA-Z0-9]+))?)(?!["'])`, "gi");
4249
+ e = e.replace(h, (m, b, v, x) => lr(v, x));
4250
+ const f = /<a[^>]*href="(https?:\/\/miro\.com\/app\/board\/([a-zA-Z0-9_=-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4251
+ e = e.replace(f, (m, b, v) => cr(v));
4158
4252
  const g = new RegExp(`(?<!["'=])(https?:\\/\\/miro\\.com\\/app\\/board\\/([a-zA-Z0-9_=-]+))(?!["'])`, "gi");
4159
- return e = e.replace(g, (f, b, v) => lr(v)), e;
4253
+ return e = e.replace(g, (m, b, v) => cr(v)), e;
4160
4254
  }
4161
- function rr(e) {
4255
+ function ar(e) {
4162
4256
  return `
4163
4257
  <div class="artifactuse-typeform-wrapper">
4164
4258
  <iframe
@@ -4169,7 +4263,7 @@ function rr(e) {
4169
4263
  </div>
4170
4264
  `;
4171
4265
  }
4172
- function ar(e, t = "") {
4266
+ function sr(e, t = "") {
4173
4267
  return `
4174
4268
  <div class="artifactuse-calendly-wrapper">
4175
4269
  <iframe
@@ -4180,7 +4274,7 @@ function ar(e, t = "") {
4180
4274
  </div>
4181
4275
  `;
4182
4276
  }
4183
- function sr(e) {
4277
+ function nr(e) {
4184
4278
  return `
4185
4279
  <div class="artifactuse-google-calendar-wrapper">
4186
4280
  <iframe
@@ -4191,7 +4285,7 @@ function sr(e) {
4191
4285
  </div>
4192
4286
  `;
4193
4287
  }
4194
- function nr(e, t = "", r = "dark") {
4288
+ function ir(e, t = "", r = "dark") {
4195
4289
  return `
4196
4290
  <div class="artifactuse-calcom-wrapper">
4197
4291
  <iframe
@@ -4202,7 +4296,7 @@ function nr(e, t = "", r = "dark") {
4202
4296
  </div>
4203
4297
  `;
4204
4298
  }
4205
- function ir(e) {
4299
+ function or(e) {
4206
4300
  return `
4207
4301
  <div class="artifactuse-notion-wrapper">
4208
4302
  <iframe
@@ -4214,7 +4308,7 @@ function ir(e) {
4214
4308
  </div>
4215
4309
  `;
4216
4310
  }
4217
- function or(e, t) {
4311
+ function lr(e, t) {
4218
4312
  return `
4219
4313
  <div class="artifactuse-airtable-wrapper">
4220
4314
  <iframe
@@ -4225,7 +4319,7 @@ function or(e, t) {
4225
4319
  </div>
4226
4320
  `;
4227
4321
  }
4228
- function lr(e) {
4322
+ function cr(e) {
4229
4323
  return `
4230
4324
  <div class="artifactuse-miro-wrapper">
4231
4325
  <iframe
@@ -4237,37 +4331,37 @@ function lr(e) {
4237
4331
  </div>
4238
4332
  `;
4239
4333
  }
4240
- let ee = null, Se = !1, nt = !1;
4241
- function Cr(e) {
4334
+ let te = null, Ce = !1, nt = !1;
4335
+ function Rr(e) {
4242
4336
  const t = /<pre><code class="language-mermaid">([\s\S]*?)<\/code><\/pre>/gi;
4243
4337
  return e = e.replace(t, (r, a) => {
4244
- const s = Cs(a).trim();
4245
- return Rs(s);
4338
+ const s = Rs(a).trim();
4339
+ return Ls(s);
4246
4340
  }), e;
4247
4341
  }
4248
- function Cs(e) {
4342
+ function Rs(e) {
4249
4343
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&nbsp;/g, " ");
4250
4344
  }
4251
- function Rs(e) {
4252
- const t = Rr(e);
4345
+ function Ls(e) {
4346
+ const t = Lr(e);
4253
4347
  return `
4254
4348
  <div class="artifactuse-mermaid-container" data-mermaid-id="${`mermaid-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`}" data-mermaid-diagram="${t}">
4255
4349
  <div class="artifactuse-mermaid-loading">Loading diagram...</div>
4256
4350
  </div>
4257
4351
  `;
4258
4352
  }
4259
- function Rr(e) {
4353
+ function Lr(e) {
4260
4354
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
4261
4355
  }
4262
- function Lr(e) {
4356
+ function Tr(e) {
4263
4357
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&amp;/g, "&");
4264
4358
  }
4265
- function Tr(e = {}) {
4266
- return typeof mermaid > "u" ? Se ? (console.warn("Mermaid loading previously failed. Diagram rendering disabled."), Promise.resolve()) : (console.debug("Mermaid library not loaded. Attempting to load..."), Ts().then(() => (console.log("Mermaid loaded, rendering diagrams..."), cr(e), Ce())).catch((t) => {
4267
- console.error("Failed to load Mermaid library:", t), Se = !0, Ls();
4268
- })) : (nt || cr(e), Ce());
4359
+ function _r(e = {}) {
4360
+ 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) => {
4361
+ console.error("Failed to load Mermaid library:", t), Ce = !0, Ts();
4362
+ })) : (nt || ur(e), Re());
4269
4363
  }
4270
- function cr(e = {}) {
4364
+ function ur(e = {}) {
4271
4365
  if (typeof mermaid > "u") return;
4272
4366
  const r = {
4273
4367
  dark: "dark",
@@ -4297,7 +4391,7 @@ function cr(e = {}) {
4297
4391
  };
4298
4392
  mermaid.initialize(a), nt = !0;
4299
4393
  }
4300
- async function Ce() {
4394
+ async function Re() {
4301
4395
  if (typeof mermaid > "u") {
4302
4396
  console.warn("renderAllMermaid called but Mermaid is not available");
4303
4397
  return;
@@ -4305,7 +4399,7 @@ async function Ce() {
4305
4399
  const e = document.querySelectorAll(".artifactuse-mermaid-container");
4306
4400
  for (const t of e) {
4307
4401
  if (t.dataset.rendered === "true") continue;
4308
- const r = Lr(t.dataset.mermaidDiagram), a = t.dataset.mermaidId;
4402
+ const r = Tr(t.dataset.mermaidDiagram), a = t.dataset.mermaidId;
4309
4403
  try {
4310
4404
  if (await mermaid.parse(r)) {
4311
4405
  const { svg: n } = await mermaid.render(a, r);
@@ -4325,10 +4419,10 @@ async function Ce() {
4325
4419
  }
4326
4420
  }
4327
4421
  }
4328
- function Ls() {
4422
+ function Ts() {
4329
4423
  document.querySelectorAll(".artifactuse-mermaid-container").forEach((e) => {
4330
4424
  if (e.dataset.rendered === "true") return;
4331
- const t = Lr(e.dataset.mermaidDiagram);
4425
+ const t = Tr(e.dataset.mermaidDiagram);
4332
4426
  e.innerHTML = `
4333
4427
  <div class="artifactuse-mermaid-fallback">
4334
4428
  <div class="artifactuse-mermaid-fallback-title">Mermaid Diagram</div>
@@ -4340,53 +4434,53 @@ function Ls() {
4340
4434
  function Ge(e) {
4341
4435
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4342
4436
  }
4343
- function Ts() {
4344
- return ee || (typeof mermaid < "u" ? Promise.resolve() : (ee = new Promise((e, t) => {
4437
+ function _s() {
4438
+ return te || (typeof mermaid < "u" ? Promise.resolve() : (te = new Promise((e, t) => {
4345
4439
  const r = setTimeout(() => {
4346
- ee = null, t(new Error("Mermaid loading timed out after 15 seconds"));
4440
+ te = null, t(new Error("Mermaid loading timed out after 15 seconds"));
4347
4441
  }, 15e3), a = document.createElement("script");
4348
4442
  a.src = "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js", a.crossOrigin = "anonymous", a.onload = () => {
4349
4443
  clearTimeout(r), console.log("Mermaid script loaded successfully"), e();
4350
4444
  }, a.onerror = (s) => {
4351
- clearTimeout(r), ee = null, console.error("Mermaid script failed to load:", s), t(new Error("Failed to load Mermaid script from CDN"));
4445
+ clearTimeout(r), te = null, console.error("Mermaid script failed to load:", s), t(new Error("Failed to load Mermaid script from CDN"));
4352
4446
  }, document.head.appendChild(a);
4353
- }), ee));
4447
+ }), te));
4354
4448
  }
4355
- function rn() {
4356
- ee = null, Se = !1, nt = !1;
4449
+ function nn() {
4450
+ te = null, Ce = !1, nt = !1;
4357
4451
  }
4358
- function an() {
4452
+ function on() {
4359
4453
  return typeof mermaid < "u";
4360
4454
  }
4361
- function sn() {
4362
- return Se;
4455
+ function ln() {
4456
+ return Ce;
4363
4457
  }
4364
- function nn(e, t = {}) {
4458
+ function cn(e, t = {}) {
4365
4459
  if (!e) return Promise.resolve();
4366
4460
  let r = e.innerHTML;
4367
- return r = Cr(r), e.innerHTML = r, Tr(t);
4461
+ return r = Rr(r), e.innerHTML = r, _r(t);
4368
4462
  }
4369
- async function on(e) {
4463
+ async function un(e) {
4370
4464
  const t = document.querySelector(`[data-mermaid-id="${e}"]`);
4371
- t && (t.dataset.rendered = "false", t.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await Ce());
4465
+ t && (t.dataset.rendered = "false", t.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await Re());
4372
4466
  }
4373
- async function ln(e, t) {
4467
+ async function dn(e, t) {
4374
4468
  const r = document.querySelector(`[data-mermaid-id="${e}"]`);
4375
- r && (r.dataset.mermaidDiagram = Rr(t), r.dataset.rendered = "false", r.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await Ce());
4469
+ r && (r.dataset.mermaidDiagram = Lr(t), r.dataset.rendered = "false", r.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await Re());
4376
4470
  }
4377
- function _s(e) {
4471
+ function Es(e) {
4378
4472
  const t = /<table([^>]*)>([\s\S]*?)<\/table>/gi;
4379
4473
  let r = 0;
4380
4474
  return e = e.replace(t, (a, s, n) => {
4381
4475
  const o = `artifactuse-table-${r++}`;
4382
- return Es(o, s, n);
4476
+ return Ps(o, s, n);
4383
4477
  }), e;
4384
4478
  }
4385
- function Es(e, t, r) {
4479
+ function Ps(e, t, r) {
4386
4480
  const a = /<thead/i.test(r) || /<th/i.test(r), s = (r.match(/<tr/gi) || []).length;
4387
4481
  if (!a || s < 3)
4388
4482
  return `<table${t} class="artifactuse-table">${r}</table>`;
4389
- const n = Ps(r);
4483
+ const n = js(r);
4390
4484
  return `
4391
4485
  <div class="artifactuse-table-container" data-table-id="${e}">
4392
4486
  <div class="artifactuse-table-controls">
@@ -4429,7 +4523,7 @@ function Es(e, t, r) {
4429
4523
  </div>
4430
4524
  `;
4431
4525
  }
4432
- function Ps(e) {
4526
+ function js(e) {
4433
4527
  let t = 0;
4434
4528
  return e = e.replace(/<th(\s[^>]*)?>([\s\S]*?)<\/th>/gi, (r, a, s) => {
4435
4529
  const n = t++;
@@ -4448,7 +4542,7 @@ function Ps(e) {
4448
4542
  `;
4449
4543
  }), e;
4450
4544
  }
4451
- function js(e) {
4545
+ function Hs(e) {
4452
4546
  const t = e.querySelectorAll("tr"), r = [];
4453
4547
  return t.forEach((a) => {
4454
4548
  const s = a.querySelectorAll("th, td"), n = [];
@@ -4460,11 +4554,11 @@ function js(e) {
4460
4554
  }), r.join(`
4461
4555
  `);
4462
4556
  }
4463
- function Hs(e, t = "table-data.csv") {
4557
+ function Vs(e, t = "table-data.csv") {
4464
4558
  const r = new Blob([e], { type: "text/csv;charset=utf-8;" }), a = URL.createObjectURL(r), s = document.createElement("a");
4465
4559
  s.href = a, s.download = t, document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(a);
4466
4560
  }
4467
- function Vs(e) {
4561
+ function Is(e) {
4468
4562
  const t = e.querySelectorAll("tr"), r = [];
4469
4563
  return t.forEach((a) => {
4470
4564
  const s = a.querySelectorAll("th, td"), n = [];
@@ -4474,7 +4568,7 @@ function Vs(e) {
4474
4568
  }), r.join(`
4475
4569
  `);
4476
4570
  }
4477
- function Is(e, t, r = !0) {
4571
+ function Ds(e, t, r = !0) {
4478
4572
  const a = e.querySelector("tbody") || e, s = Array.from(a.querySelectorAll("tr")).filter((n) => !n.querySelector("th"));
4479
4573
  s.sort((n, o) => {
4480
4574
  const i = n.cells[t], u = o.cells[t];
@@ -4483,11 +4577,11 @@ function Is(e, t, r = !0) {
4483
4577
  const p = parseFloat(l.replace(/[,$%]/g, "")), w = parseFloat(d.replace(/[,$%]/g, ""));
4484
4578
  if (!isNaN(p) && !isNaN(w))
4485
4579
  return r ? p - w : w - p;
4486
- const c = new Date(l), m = new Date(d);
4487
- return !isNaN(c.getTime()) && !isNaN(m.getTime()) ? r ? c - m : m - c : r ? l.localeCompare(d) : d.localeCompare(l);
4580
+ const c = new Date(l), h = new Date(d);
4581
+ return !isNaN(c.getTime()) && !isNaN(h.getTime()) ? r ? c - h : h - c : r ? l.localeCompare(d) : d.localeCompare(l);
4488
4582
  }), s.forEach((n) => a.appendChild(n));
4489
4583
  }
4490
- function Ds(e, t) {
4584
+ function qs(e, t) {
4491
4585
  const r = e.querySelectorAll("tbody tr, tr:not(:first-child)"), a = t.toLowerCase().trim();
4492
4586
  let s = 0;
4493
4587
  return r.forEach((n) => {
@@ -4499,13 +4593,13 @@ function Ds(e, t) {
4499
4593
  n.style.display = i ? "" : "none", i && s++;
4500
4594
  }), s;
4501
4595
  }
4502
- function qs() {
4596
+ function Zs() {
4503
4597
  document.querySelectorAll("[data-table-search]").forEach((e) => {
4504
4598
  const t = e.dataset.tableSearch, r = document.getElementById(t), a = document.querySelector(`[data-table-count="${t}"]`);
4505
4599
  if (r) {
4506
4600
  const s = r.querySelectorAll("tbody tr, tr:not(:first-child)"), n = Array.from(s).filter((o) => !o.querySelector("th")).length;
4507
4601
  a && (a.textContent = `${n} rows`), e.addEventListener("input", (o) => {
4508
- const i = Ds(r, o.target.value);
4602
+ const i = qs(r, o.target.value);
4509
4603
  a && (a.textContent = o.target.value ? `${i} of ${n} rows` : `${n} rows`);
4510
4604
  });
4511
4605
  }
@@ -4514,21 +4608,21 @@ function qs() {
4514
4608
  const t = e.closest("table"), r = parseInt(e.dataset.sortCol), s = e.dataset.sortDir !== "asc";
4515
4609
  t.querySelectorAll(".artifactuse-sortable-header").forEach((n) => {
4516
4610
  n.dataset.sortDir = "", n.classList.remove("sort-asc", "sort-desc");
4517
- }), e.dataset.sortDir = s ? "asc" : "desc", e.classList.add(s ? "sort-asc" : "sort-desc"), Is(t, r, s);
4611
+ }), e.dataset.sortDir = s ? "asc" : "desc", e.classList.add(s ? "sort-asc" : "sort-desc"), Ds(t, r, s);
4518
4612
  });
4519
4613
  }), document.querySelectorAll("[data-table-export]").forEach((e) => {
4520
4614
  e.addEventListener("click", () => {
4521
4615
  const t = e.dataset.tableExport, r = document.getElementById(t);
4522
4616
  if (r) {
4523
- const a = js(r);
4524
- Hs(a, `${t}.csv`);
4617
+ const a = Hs(r);
4618
+ Vs(a, `${t}.csv`);
4525
4619
  }
4526
4620
  });
4527
4621
  }), document.querySelectorAll("[data-table-copy]").forEach((e) => {
4528
4622
  e.addEventListener("click", async () => {
4529
4623
  const t = e.dataset.tableCopy, r = document.getElementById(t);
4530
4624
  if (r) {
4531
- const a = Vs(r);
4625
+ const a = Is(r);
4532
4626
  try {
4533
4627
  await navigator.clipboard.writeText(a);
4534
4628
  const s = e.querySelector("span"), n = s ? s.textContent : "";
@@ -4542,52 +4636,52 @@ function qs() {
4542
4636
  });
4543
4637
  });
4544
4638
  }
4545
- let te = null, Re = !1;
4546
- function _r(e) {
4547
- return e = Zs(e), e = e.replace(/\$\$([\s\S]*?)\$\$/g, (t, r) => fe(r.trim(), !0)), e = e.replace(/\\\[([\s\S]*?)\\\]/g, (t, r) => fe(r.trim(), !0)), e = e.replace(new RegExp("(?<!\\$)\\$(?!\\$)((?:[^$\\\\]|\\\\.)+?)\\$(?!\\$)", "g"), (t, r) => fe(r.trim(), !1)), e = e.replace(/\\\(([\s\S]*?)\\\)/g, (t, r) => fe(r.trim(), !1)), e;
4639
+ let re = null, Le = !1;
4640
+ function Er(e) {
4641
+ 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;
4548
4642
  }
4549
- function Zs(e) {
4643
+ function Os(e) {
4550
4644
  const t = /<pre><code class="language-(math|latex)">([\s\S]*?)<\/code><\/pre>/gi;
4551
4645
  return e = e.replace(t, (r, a, s) => {
4552
- const n = Os(s).trim();
4553
- return fe(n, !0);
4646
+ const n = Bs(s).trim();
4647
+ return he(n, !0);
4554
4648
  }), e;
4555
4649
  }
4556
- function Os(e) {
4650
+ function Bs(e) {
4557
4651
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&nbsp;/g, " ");
4558
4652
  }
4559
- function fe(e, t = !1) {
4560
- const r = Bs(e);
4653
+ function he(e, t = !1) {
4654
+ const r = Fs(e);
4561
4655
  return `<span class="artifactuse-math-container ${t ? "artifactuse-math-display" : "artifactuse-math-inline"}" data-tex="${r}" data-display="${t ? "true" : "false"}"></span>`;
4562
4656
  }
4563
- function Bs(e) {
4657
+ function Fs(e) {
4564
4658
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
4565
4659
  }
4566
- function Er(e) {
4660
+ function Pr(e) {
4567
4661
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&amp;/g, "&");
4568
4662
  }
4569
- function Pr() {
4570
- return typeof katex > "u" ? Re ? (console.warn("KaTeX loading previously failed. Math rendering disabled."), Promise.resolve()) : (console.debug("KaTeX library not loaded. Attempting to load..."), Ns().then(() => {
4571
- console.log("KaTeX loaded, rendering math..."), ur();
4663
+ function jr() {
4664
+ 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(() => {
4665
+ console.log("KaTeX loaded, rendering math..."), dr();
4572
4666
  }).catch((e) => {
4573
- console.error("Failed to load KaTeX library:", e), Re = !0, Fs();
4574
- })) : (ur(), Promise.resolve());
4667
+ console.error("Failed to load KaTeX library:", e), Le = !0, Ns();
4668
+ })) : (dr(), Promise.resolve());
4575
4669
  }
4576
- function Fs() {
4670
+ function Ns() {
4577
4671
  document.querySelectorAll(".artifactuse-math-container").forEach((e) => {
4578
4672
  if (e.dataset.rendered === "true") return;
4579
- const t = Er(e.dataset.tex);
4673
+ const t = Pr(e.dataset.tex);
4580
4674
  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");
4581
4675
  });
4582
4676
  }
4583
- function ur() {
4677
+ function dr() {
4584
4678
  if (typeof katex > "u") {
4585
4679
  console.warn("renderAllMath called but KaTeX is not available");
4586
4680
  return;
4587
4681
  }
4588
4682
  document.querySelectorAll(".artifactuse-math-container").forEach((e) => {
4589
4683
  if (e.dataset.rendered === "true") return;
4590
- const t = Er(e.dataset.tex), r = e.dataset.display === "true";
4684
+ const t = Pr(e.dataset.tex), r = e.dataset.display === "true";
4591
4685
  try {
4592
4686
  katex.render(t, e, {
4593
4687
  displayMode: r,
@@ -4615,10 +4709,10 @@ function ur() {
4615
4709
  function We(e) {
4616
4710
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4617
4711
  }
4618
- function Ns() {
4619
- return te || (typeof katex < "u" ? Promise.resolve() : (te = new Promise((e, t) => {
4712
+ function Us() {
4713
+ return re || (typeof katex < "u" ? Promise.resolve() : (re = new Promise((e, t) => {
4620
4714
  const r = setTimeout(() => {
4621
- te = null, t(new Error("KaTeX loading timed out after 10 seconds"));
4715
+ re = null, t(new Error("KaTeX loading timed out after 10 seconds"));
4622
4716
  }, 1e4), a = document.createElement("link");
4623
4717
  a.rel = "stylesheet", a.href = "https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css", a.crossOrigin = "anonymous", a.onerror = () => {
4624
4718
  console.warn("KaTeX CSS failed to load, math may not render correctly");
@@ -4627,25 +4721,25 @@ function Ns() {
4627
4721
  s.src = "https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js", s.crossOrigin = "anonymous", s.onload = () => {
4628
4722
  clearTimeout(r), console.log("KaTeX script loaded successfully"), e();
4629
4723
  }, s.onerror = (n) => {
4630
- clearTimeout(r), te = null, console.error("KaTeX script failed to load:", n), t(new Error("Failed to load KaTeX script from CDN"));
4724
+ clearTimeout(r), re = null, console.error("KaTeX script failed to load:", n), t(new Error("Failed to load KaTeX script from CDN"));
4631
4725
  }, document.head.appendChild(s);
4632
- }), te));
4726
+ }), re));
4633
4727
  }
4634
- function cn() {
4635
- te = null, Re = !1;
4728
+ function pn() {
4729
+ re = null, Le = !1;
4636
4730
  }
4637
- function un() {
4731
+ function fn() {
4638
4732
  return typeof katex < "u";
4639
4733
  }
4640
- function dn() {
4641
- return Re;
4734
+ function hn() {
4735
+ return Le;
4642
4736
  }
4643
- function pn(e) {
4737
+ function gn(e) {
4644
4738
  if (!e) return Promise.resolve();
4645
4739
  let t = e.innerHTML;
4646
- return t = _r(t), e.innerHTML = t, Pr();
4740
+ return t = Er(t), e.innerHTML = t, jr();
4647
4741
  }
4648
- const fn = {
4742
+ const mn = {
4649
4743
  // Fractions
4650
4744
  fraction: (e, t) => `\\frac{${e}}{${t}}`,
4651
4745
  // Square root
@@ -4678,104 +4772,7 @@ const fn = {
4678
4772
  derivative: (e, t) => `\\frac{d${e}}{d${t}}`,
4679
4773
  partialDerivative: (e, t) => `\\frac{\\partial ${e}}{\\partial ${t}}`
4680
4774
  };
4681
- function we() {
4682
- return typeof window < "u" && window.Prism;
4683
- }
4684
- function jr(e) {
4685
- if (!we()) {
4686
- console.warn("Artifactuse: Prism.js not found. Install and include Prism.js for syntax highlighting.");
4687
- return;
4688
- }
4689
- const t = typeof e == "string" ? document.querySelector(e) : e;
4690
- if (!t) return;
4691
- t.querySelectorAll("pre code").forEach((a) => {
4692
- if (a.classList.contains("prism-highlighted")) return;
4693
- const s = Us(a);
4694
- s && (a.className.includes(`language-${s}`) || a.classList.add(`language-${s}`), window.Prism.highlightElement(a), a.classList.add("prism-highlighted"));
4695
- });
4696
- }
4697
- function hn(e, t) {
4698
- we() && (t && !e.className.includes(`language-${t}`) && e.classList.add(`language-${t}`), window.Prism.highlightElement(e), e.classList.add("prism-highlighted"));
4699
- }
4700
- function gn(e, t) {
4701
- if (!we()) return dr(e);
4702
- const r = window.Prism.languages[t];
4703
- return r ? window.Prism.highlight(e, r, t) : dr(e);
4704
- }
4705
- function Us(e) {
4706
- const t = e.className.split(/\s+/);
4707
- for (const s of t) {
4708
- const n = s.match(/^(?:language-|lang-)(.+)$/);
4709
- if (n)
4710
- return He(n[1]);
4711
- }
4712
- const r = e.closest("pre");
4713
- if (r) {
4714
- const s = r.className.split(/\s+/);
4715
- for (const n of s) {
4716
- const o = n.match(/^(?:language-|lang-)(.+)$/);
4717
- if (o)
4718
- return He(o[1]);
4719
- }
4720
- }
4721
- const a = e.dataset.language || (r == null ? void 0 : r.dataset.language);
4722
- return a ? He(a) : null;
4723
- }
4724
- function He(e) {
4725
- const t = {
4726
- js: "javascript",
4727
- ts: "typescript",
4728
- py: "python",
4729
- rb: "ruby",
4730
- sh: "bash",
4731
- shell: "bash",
4732
- zsh: "bash",
4733
- yml: "yaml",
4734
- md: "markdown",
4735
- html: "markup",
4736
- xml: "markup",
4737
- svg: "markup",
4738
- vue: "markup",
4739
- jsx: "jsx",
4740
- tsx: "tsx",
4741
- "c++": "cpp",
4742
- "c#": "csharp",
4743
- cs: "csharp",
4744
- "f#": "fsharp",
4745
- "objective-c": "objectivec",
4746
- objc: "objectivec"
4747
- }, r = e.toLowerCase();
4748
- return t[r] || r;
4749
- }
4750
- function dr(e) {
4751
- return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
4752
- }
4753
- function mn(e) {
4754
- if (!we())
4755
- return console.warn("Artifactuse: Prism.js not found. Auto-highlighting disabled."), null;
4756
- const t = new MutationObserver((r) => {
4757
- let a = !1;
4758
- for (const s of r)
4759
- if (s.type === "childList") {
4760
- for (const n of s.addedNodes)
4761
- if (n.nodeType === Node.ELEMENT_NODE && (n.matches("pre code") || n.querySelector("pre code"))) {
4762
- a = !0;
4763
- break;
4764
- }
4765
- }
4766
- a && jr(e);
4767
- });
4768
- return t.observe(e, {
4769
- childList: !0,
4770
- subtree: !0
4771
- }), t;
4772
- }
4773
- function wn() {
4774
- return we() ? Object.keys(window.Prism.languages).filter(
4775
- (e) => typeof window.Prism.languages[e] == "object"
4776
- ) : [];
4777
- }
4778
- function ke(e) {
4775
+ function xe(e) {
4779
4776
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4780
4777
  }
4781
4778
  function Gs() {
@@ -4787,15 +4784,15 @@ function Gs() {
4787
4784
  }, t = {
4788
4785
  link(a) {
4789
4786
  const s = typeof a == "string" ? a : a.href, n = typeof a == "string" ? arguments[1] : a.title, o = typeof a == "string" ? arguments[2] : a.text;
4790
- if (es(s))
4791
- return rs(s);
4792
- const i = n ? ` title="${ke(n)}"` : "";
4793
- return `<a href="${ke(s || "")}" target="_blank" rel="noopener noreferrer"${i}>${o || ""}</a>`;
4787
+ if (ts(s))
4788
+ return as(s);
4789
+ const i = n ? ` title="${xe(n)}"` : "";
4790
+ return `<a href="${xe(s || "")}" target="_blank" rel="noopener noreferrer"${i}>${o || ""}</a>`;
4794
4791
  }
4795
4792
  }, r = {
4796
4793
  code(a) {
4797
- const s = typeof a == "string" ? a : a.text, o = (typeof a == "string" ? arguments[1] : a.lang) || "", i = ke(s || "");
4798
- return o ? `<pre><code class="language-${ke(o)}">${i}</code></pre>` : `<pre><code>${i}</code></pre>`;
4794
+ const s = typeof a == "string" ? a : a.text, o = (typeof a == "string" ? arguments[1] : a.lang) || "", i = xe(s || "");
4795
+ return o ? `<pre><code class="language-${xe(o)}">${i}</code></pre>` : `<pre><code>${i}</code></pre>`;
4799
4796
  }
4800
4797
  };
4801
4798
  V.use({
@@ -4980,11 +4977,11 @@ function Ks(e, t) {
4980
4977
  return null;
4981
4978
  w.endsWith("/") || (w += "");
4982
4979
  const c = new URLSearchParams();
4983
- l.theme && c.set("theme", l.theme), l.accent && c.set("accent", l.accent), l.params && Object.entries(l.params).forEach(([h, g]) => {
4984
- c.set(h, g);
4980
+ l.theme && c.set("theme", l.theme), l.accent && c.set("accent", l.accent), l.params && Object.entries(l.params).forEach(([f, g]) => {
4981
+ c.set(f, g);
4985
4982
  });
4986
- const m = c.toString();
4987
- return m ? `${w}?${m}` : w;
4983
+ const h = c.toString();
4984
+ return h ? `${w}?${h}` : w;
4988
4985
  }
4989
4986
  function s(u) {
4990
4987
  const l = u == null ? void 0 : u.toLowerCase();
@@ -5019,42 +5016,42 @@ function Ks(e, t) {
5019
5016
  }
5020
5017
  };
5021
5018
  }
5022
- function bn(e = {}) {
5023
- const t = Ir(Ws, e), r = ta(), a = { ...Hr, ...t.panels }, s = Xs(a, t.cdnUrl), n = ra(s), o = na(t.theme, t.colors || {}), i = Ks(t, n), u = pa(t.sharing), l = fa(t.editor);
5024
- function d(k, _, L = {}) {
5025
- let S = V.parse(k);
5026
- const D = [], E = { theme: o.resolved }, Z = L.inlinePreview ?? t.inlinePreview ?? null, ne = L.inlineCode ?? t.inlineCode ?? null, oe = L.tabs ?? t.tabs ?? null, G = L.viewMode ?? t.viewMode ?? null;
5019
+ function wn(e = {}) {
5020
+ 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);
5021
+ function d(k, P, R = {}) {
5022
+ let C = V.parse(k);
5023
+ 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;
5027
5024
  if (t.processors.codeBlocks) {
5028
- const B = ea(S, _, {
5025
+ const U = ta(C, P, {
5029
5026
  ...t.codeExtraction,
5030
- inlinePreview: Z,
5031
- inlineCode: ne,
5032
- tabs: oe,
5033
- viewMode: G
5027
+ inlinePreview: q,
5028
+ inlineCode: J,
5029
+ tabs: le,
5030
+ viewMode: K
5034
5031
  });
5035
- S = B.html, D.push(...B.artifacts);
5032
+ C = U.html, D.push(...U.artifacts);
5036
5033
  }
5037
- return t.processors.images && (S = Qa(S)), t.processors.imageGalleries && (S = Ya(S)), t.processors.videos && (S = as(S)), t.processors.videoGalleries && (S = os(S)), t.processors.audio && (S = us(S, E)), t.processors.maps && (S = bs(S)), t.processors.social && (S = vs(S, E)), t.processors.documents && (S = ys(S), S = ks(S), S = xs(S)), t.processors.codeEmbeds && (S = $s(S, E)), t.processors.dataViz && (S = As(S)), t.processors.design && (S = zs(S, E)), t.processors.interactive && (S = Ss(S, E)), t.processors.tables && (S = _s(S)), t.processors.math && (S = _r(S)), t.processors.mermaid && (S = Cr(S)), D.forEach((B) => {
5038
- r.addArtifact(B);
5034
+ 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) => {
5035
+ r.addArtifact(U);
5039
5036
  }), {
5040
- html: S,
5037
+ html: C,
5041
5038
  artifacts: D
5042
5039
  };
5043
5040
  }
5044
5041
  async function p(k = document) {
5045
- const _ = [], L = { theme: o.resolved };
5046
- t.processors.math && _.push(Pr()), t.processors.mermaid && _.push(Tr(L)), t.processors.tables && qs(), t.processors.audio && ps(k), t.syntaxHighlight && (jr(k), (k === document ? document : k).querySelectorAll(".artifactuse-inline-preview[data-smartdiff]").forEach((E) => {
5047
- var G;
5048
- const Z = E.querySelector("code");
5049
- if (!Z || Z.dataset.smartdiffProcessed) return;
5050
- const ne = ((G = E.dataset.smartdiffMarkers) == null ? void 0 : G.split(",")) || [], oe = Z.innerHTML.split(`
5042
+ const P = [], R = { theme: o.resolved };
5043
+ t.processors.math && P.push(jr()), t.processors.mermaid && P.push(_r(R)), t.processors.tables && Zs(), t.processors.audio && fs(k), t.syntaxHighlight && (pr(k), (k === document ? document : k).querySelectorAll(".artifactuse-inline-preview[data-smartdiff]").forEach((_) => {
5044
+ var K;
5045
+ const q = _.querySelector("code");
5046
+ if (!q || q.dataset.smartdiffProcessed) return;
5047
+ const J = ((K = _.dataset.smartdiffMarkers) == null ? void 0 : K.split(",")) || [], le = q.innerHTML.split(`
5051
5048
  `);
5052
- Z.innerHTML = oe.map((B, be) => {
5053
- const Q = ne[be];
5054
- return Q === "-" ? `<span class="token deleted">${B}</span>` : Q === "+" ? `<span class="token inserted">${B}</span>` : B;
5049
+ q.innerHTML = le.map((U, ve) => {
5050
+ const Y = J[ve];
5051
+ return Y === "-" ? `<span class="token deleted">${U}</span>` : Y === "+" ? `<span class="token inserted">${U}</span>` : U;
5055
5052
  }).join(`
5056
- `), Z.dataset.smartdiffProcessed = "true";
5057
- })), await Promise.all(_);
5053
+ `), q.dataset.smartdiffProcessed = "true";
5054
+ })), await Promise.all(P);
5058
5055
  }
5059
5056
  function w(k) {
5060
5057
  if (k.isInline) {
@@ -5063,24 +5060,24 @@ function bn(e = {}) {
5063
5060
  }
5064
5061
  t.multiTab ? r.openTab(k.id) : r.setActiveArtifact(k.id), r.setForceEmptyView(!1), r.setPanelOpen(!0), k.viewMode && r.setViewMode(k.viewMode), T("artifact:opened", k);
5065
5062
  }
5066
- function c(k, _, L = {}) {
5067
- const S = k.split(".").pop(), D = L.language || Nr(S) || S, E = L.title || k;
5068
- return m(_, D, { ...L, title: E });
5063
+ function c(k, P, R = {}) {
5064
+ const C = k.split(".").pop(), D = R.language || Ur(C) || C, _ = R.title || k, q = r.getState().artifacts.find((J) => J.title === _ && !J.isInline);
5065
+ return q ? (f(q.id, P, { ...R, title: _ }), w(q), R.viewMode ? r.setViewMode(R.viewMode) : R.tabs && r.setViewMode(R.tabs[0]), r.getArtifact(q.id)) : h(P, D, { ...R, title: _ });
5069
5066
  }
5070
- function m(k, _, L = {}) {
5071
- const S = L.messageId || Br("open"), D = A({ type: _, language: _ }) ? _ : "txt", E = Me(k, D, S, 0);
5072
- return E.title = L.title || E.title, E.isInline = !1, E.editorLanguage = _, L.tabs && (E.tabs = L.tabs), L.panelUrl && (E.panelUrl = L.panelUrl), r.addArtifact(E), w(E), L.viewMode ? r.setViewMode(L.viewMode) : L.tabs && r.setViewMode(L.tabs[0]), E;
5067
+ function h(k, P, R = {}) {
5068
+ const C = R.messageId || Fr("open"), D = A({ type: P, language: P }) ? P : "txt", _ = $e(k, D, C, 0);
5069
+ return _.title = R.title || _.title, _.isInline = !1, _.editorLanguage = P, R.tabs && (_.tabs = R.tabs), R.panelUrl && (_.panelUrl = R.panelUrl), r.addArtifact(_), w(_), R.viewMode ? r.setViewMode(R.viewMode) : R.tabs && r.setViewMode(R.tabs[0]), _;
5073
5070
  }
5074
- function h(k, _, L = {}) {
5075
- const S = typeof k == "string" ? k : k == null ? void 0 : k.id, D = r.getArtifact(S);
5071
+ function f(k, P, R = {}) {
5072
+ const C = typeof k == "string" ? k : k == null ? void 0 : k.id, D = r.getArtifact(C);
5076
5073
  if (!D) return null;
5077
- const E = { ...D, code: _, _refreshToken: Date.now() };
5078
- return L.title !== void 0 && (E.title = L.title), L.tabs !== void 0 && (E.tabs = L.tabs), L.panelUrl !== void 0 && (E.panelUrl = L.panelUrl), r.addArtifact(E), T("artifact:updated", { artifactId: S, artifact: r.getArtifact(S) }), r.getArtifact(S);
5074
+ const _ = { ...D, code: P, _refreshToken: Date.now() };
5075
+ return R.title !== void 0 && (_.title = R.title), R.tabs !== void 0 && (_.tabs = R.tabs), R.panelUrl !== void 0 && (_.panelUrl = R.panelUrl), r.addArtifact(_), T("artifact:updated", { artifactId: C, artifact: r.getArtifact(C) }), r.getArtifact(C);
5079
5076
  }
5080
5077
  function g() {
5081
5078
  r.clearActiveArtifact(), r.setForceEmptyView(!0), r.setPanelOpen(!0), T("panel:opened");
5082
5079
  }
5083
- function f() {
5080
+ function m() {
5084
5081
  r.setPanelOpen(!1), r.setFullscreen(!1), T("panel:closed");
5085
5082
  }
5086
5083
  function b() {
@@ -5094,66 +5091,66 @@ function bn(e = {}) {
5094
5091
  function x(k) {
5095
5092
  r.setViewMode(k), T("viewMode:changed", { mode: k });
5096
5093
  }
5097
- function $(k, _ = {}) {
5094
+ function M(k, P = {}) {
5098
5095
  if (!k) return null;
5099
5096
  if (k.panelUrl) return k.panelUrl;
5100
- const { type: L, language: S } = k, D = {
5101
- theme: _.theme || o.resolved
5102
- }, E = o.colors;
5103
- E != null && E.primary && (D.accent = E.primary);
5104
- let Z = i.resolve(L, D);
5105
- return !Z && S && (Z = i.resolve(S, D)), Z;
5097
+ const { type: R, language: C } = k, D = {
5098
+ theme: P.theme || o.resolved
5099
+ }, _ = o.colors;
5100
+ _ != null && _.primary && (D.accent = _.primary);
5101
+ let q = i.resolve(R, D);
5102
+ return !q && C && (q = i.resolve(C, D)), q;
5106
5103
  }
5107
5104
  function A(k) {
5108
5105
  return k ? i.has(k.type) || i.has(k.language) : !1;
5109
5106
  }
5110
- function C(k, _) {
5111
- i.register(k, _);
5107
+ function S(k, P) {
5108
+ i.register(k, P);
5112
5109
  }
5113
- function R(k) {
5110
+ function L(k) {
5114
5111
  i.unregister(k);
5115
5112
  }
5116
- function M() {
5113
+ function $() {
5117
5114
  return i.getTypes();
5118
5115
  }
5119
- function y(k, _) {
5120
- n.send(k, _);
5116
+ function y(k, P) {
5117
+ n.send(k, P);
5121
5118
  }
5122
5119
  const z = /* @__PURE__ */ new Map();
5123
- function H(k, _) {
5124
- return z.has(k) || z.set(k, /* @__PURE__ */ new Set()), z.get(k).add(_), () => {
5125
- var L;
5126
- (L = z.get(k)) == null || L.delete(_);
5120
+ function j(k, P) {
5121
+ return z.has(k) || z.set(k, /* @__PURE__ */ new Set()), z.get(k).add(P), () => {
5122
+ var R;
5123
+ (R = z.get(k)) == null || R.delete(P);
5127
5124
  };
5128
5125
  }
5129
- function P(k, _) {
5130
- var L;
5131
- (L = z.get(k)) == null || L.delete(_);
5126
+ function E(k, P) {
5127
+ var R;
5128
+ (R = z.get(k)) == null || R.delete(P);
5132
5129
  }
5133
- function T(k, _) {
5134
- var L;
5135
- (L = z.get(k)) == null || L.forEach((S) => {
5130
+ function T(k, P) {
5131
+ var R;
5132
+ (R = z.get(k)) == null || R.forEach((C) => {
5136
5133
  try {
5137
- S(_);
5134
+ C(P);
5138
5135
  } catch (D) {
5139
5136
  console.error(`Artifactuse event handler error (${k}):`, D);
5140
5137
  }
5141
5138
  });
5142
5139
  }
5143
5140
  n.on("ai:request", (k) => T("ai:request", k)), n.on("save:request", (k) => T("save:request", k)), n.on("export:complete", (k) => T("export:complete", k)), n.on("form:submit", (k) => T("form:submit", k)), n.on("form:cancel", (k) => T("form:cancel", k)), n.on("form:step", (k) => T("form:step", k)), n.on("social:copy", (k) => T("social:copy", k)), n.on("edit:save", (k) => {
5144
- k != null && k.artifactId && (k == null ? void 0 : k.code) !== void 0 && h(k.artifactId, k.code), T("edit:save", k);
5141
+ k != null && k.artifactId && (k == null ? void 0 : k.code) !== void 0 && f(k.artifactId, k.code), T("edit:save", k);
5145
5142
  });
5146
- function W() {
5143
+ function N() {
5147
5144
  o.apply();
5148
5145
  }
5149
- function K(k) {
5146
+ function X(k) {
5150
5147
  o.set(k);
5151
5148
  }
5152
- function U() {
5149
+ function O() {
5153
5150
  return o.resolved;
5154
5151
  }
5155
- function J() {
5156
- n.destroy(), z.clear(), r.clear(), ws();
5152
+ function B() {
5153
+ n.destroy(), z.clear(), r.clear(), bs();
5157
5154
  }
5158
5155
  return {
5159
5156
  // Config
@@ -5168,14 +5165,14 @@ function bn(e = {}) {
5168
5165
  // Panel control
5169
5166
  openArtifact: w,
5170
5167
  openFile: c,
5171
- openCode: m,
5172
- updateFile: h,
5168
+ openCode: h,
5169
+ updateFile: f,
5173
5170
  openPanel: g,
5174
- closePanel: f,
5171
+ closePanel: m,
5175
5172
  togglePanel: b,
5176
5173
  toggleFullscreen: v,
5177
5174
  setViewMode: x,
5178
- getPanelUrl: $,
5175
+ getPanelUrl: M,
5179
5176
  sendToPanel: y,
5180
5177
  // Multi-tab
5181
5178
  closeTab: (k) => r.closeTab(k),
@@ -5183,19 +5180,19 @@ function bn(e = {}) {
5183
5180
  closeAllTabs: () => r.closeAllTabs(),
5184
5181
  // Panel management (new)
5185
5182
  hasPanel: A,
5186
- registerPanel: C,
5187
- unregisterPanel: R,
5188
- getPanelTypes: M,
5183
+ registerPanel: S,
5184
+ unregisterPanel: L,
5185
+ getPanelTypes: $,
5189
5186
  panelResolver: i,
5190
5187
  // Expose for advanced use
5191
5188
  // Theme
5192
5189
  theme: o,
5193
- applyTheme: W,
5194
- setTheme: K,
5195
- getTheme: U,
5190
+ applyTheme: N,
5191
+ setTheme: X,
5192
+ getTheme: O,
5196
5193
  // Events
5197
- on: H,
5198
- off: P,
5194
+ on: j,
5195
+ off: E,
5199
5196
  emit: T,
5200
5197
  // Editor (CodeMirror integration)
5201
5198
  editor: l,
@@ -5204,7 +5201,7 @@ function bn(e = {}) {
5204
5201
  // Sharing
5205
5202
  share: u,
5206
5203
  // Cleanup
5207
- destroy: J
5204
+ destroy: B
5208
5205
  };
5209
5206
  }
5210
5207
  function Ir(e, t, r = /* @__PURE__ */ new WeakSet()) {
@@ -5237,122 +5234,122 @@ function Ir(e, t, r = /* @__PURE__ */ new WeakSet()) {
5237
5234
  return a;
5238
5235
  }
5239
5236
  export {
5240
- ks as $,
5237
+ xs as $,
5241
5238
  Oe as A,
5242
5239
  Be as B,
5243
5240
  Fe as C,
5244
5241
  Hr as D,
5245
5242
  Ne as E,
5246
- us as F,
5247
- vt as G,
5248
- yt as H,
5249
- O as I,
5250
- kt as J,
5251
- ps as K,
5252
- ws as L,
5253
- bs as M,
5254
- Y as N,
5243
+ ds as F,
5244
+ yt as G,
5245
+ kt as H,
5246
+ F as I,
5247
+ xt as J,
5248
+ fs as K,
5249
+ bs as L,
5250
+ vs as M,
5251
+ ee as N,
5255
5252
  Ue as O,
5256
- Ct as P,
5257
- vs as Q,
5258
- Rt as R,
5259
- Lt as S,
5260
- Tt as T,
5261
- _t as U,
5262
- Et as V,
5263
- Pt as W,
5264
- jt as X,
5265
- Ht as Y,
5266
- ys as Z,
5267
- Vt as _,
5268
- Ys as a,
5269
- wn as a$,
5270
- ie as a0,
5271
- It as a1,
5272
- xs as a2,
5273
- Dt as a3,
5274
- $s as a4,
5275
- qt as a5,
5276
- Zt as a6,
5277
- Ot as a7,
5278
- Bt as a8,
5279
- Ft as a9,
5280
- an as aA,
5281
- sn as aB,
5282
- nn as aC,
5283
- on as aD,
5284
- ln as aE,
5285
- _s as aF,
5286
- Es as aG,
5287
- js as aH,
5288
- Hs as aI,
5289
- Vs as aJ,
5290
- Is as aK,
5291
- Ds as aL,
5292
- qs as aM,
5293
- _r as aN,
5294
- fe as aO,
5295
- Pr as aP,
5296
- Ns as aQ,
5297
- cn as aR,
5298
- un as aS,
5299
- dn as aT,
5300
- pn as aU,
5301
- fn as aV,
5302
- jr as aW,
5303
- hn as aX,
5304
- gn as aY,
5305
- Us as aZ,
5306
- mn as a_,
5307
- Nt as aa,
5308
- As as ab,
5309
- Ut as ac,
5310
- Gt as ad,
5311
- Wt as ae,
5312
- Xt as af,
5313
- zs as ag,
5314
- Kt as ah,
5315
- Jt as ai,
5316
- Qt as aj,
5317
- Yt as ak,
5318
- er as al,
5319
- tr as am,
5320
- Ss as an,
5321
- rr as ao,
5322
- ar as ap,
5323
- sr as aq,
5324
- nr as ar,
5325
- ir as as,
5326
- or as at,
5327
- lr as au,
5328
- Cr as av,
5329
- Rs as aw,
5330
- Tr as ax,
5331
- Ts as ay,
5332
- rn as az,
5333
- Qs as b,
5334
- Wr as c,
5335
- bn as d,
5336
- ea as e,
5337
- en as f,
5338
- ot as g,
5339
- Qr as h,
5340
- we as i,
5341
- ta as j,
5342
- ra as k,
5343
- na as l,
5344
- fa as m,
5345
- He as n,
5346
- Qa as o,
5347
- tn as p,
5348
- Ya as q,
5253
+ Rt as P,
5254
+ ys as Q,
5255
+ Lt as R,
5256
+ Tt as S,
5257
+ _t as T,
5258
+ Et as U,
5259
+ Pt as V,
5260
+ jt as W,
5261
+ Ht as X,
5262
+ Vt as Y,
5263
+ ks as Z,
5264
+ It as _,
5265
+ rn as a,
5266
+ en as a$,
5267
+ oe as a0,
5268
+ Dt as a1,
5269
+ Ms as a2,
5270
+ qt as a3,
5271
+ As as a4,
5272
+ Zt as a5,
5273
+ Ot as a6,
5274
+ Bt as a7,
5275
+ Ft as a8,
5276
+ Nt as a9,
5277
+ on as aA,
5278
+ ln as aB,
5279
+ cn as aC,
5280
+ un as aD,
5281
+ dn as aE,
5282
+ Es as aF,
5283
+ Ps as aG,
5284
+ Hs as aH,
5285
+ Vs as aI,
5286
+ Is as aJ,
5287
+ Ds as aK,
5288
+ qs as aL,
5289
+ Zs as aM,
5290
+ Er as aN,
5291
+ he as aO,
5292
+ jr as aP,
5293
+ Us as aQ,
5294
+ pn as aR,
5295
+ fn as aS,
5296
+ hn as aT,
5297
+ gn as aU,
5298
+ mn as aV,
5299
+ pr as aW,
5300
+ Qs as aX,
5301
+ ot as aY,
5302
+ Zr as aZ,
5303
+ Ys as a_,
5304
+ Ut as aa,
5305
+ zs as ab,
5306
+ Gt as ac,
5307
+ Wt as ad,
5308
+ Xt as ae,
5309
+ Kt as af,
5310
+ Ss as ag,
5311
+ Jt as ah,
5312
+ Qt as ai,
5313
+ Yt as aj,
5314
+ er as ak,
5315
+ tr as al,
5316
+ rr as am,
5317
+ Cs as an,
5318
+ ar as ao,
5319
+ sr as ap,
5320
+ nr as aq,
5321
+ ir as ar,
5322
+ or as as,
5323
+ lr as at,
5324
+ cr as au,
5325
+ Rr as av,
5326
+ Ls as aw,
5327
+ _r as ax,
5328
+ _s as ay,
5329
+ nn as az,
5330
+ tn as b,
5331
+ Xr as c,
5332
+ wn as d,
5333
+ ta as e,
5334
+ an as f,
5335
+ ct as g,
5336
+ Yr as h,
5337
+ ae as i,
5338
+ ra as j,
5339
+ aa as k,
5340
+ ia as l,
5341
+ ha as m,
5342
+ ge as n,
5343
+ Ya as o,
5344
+ sn as p,
5345
+ es as q,
5349
5346
  qe as r,
5350
- bt as s,
5351
- as as t,
5352
- es as u,
5353
- rs as v,
5347
+ vt as s,
5348
+ ss as t,
5349
+ ts as u,
5350
+ as as v,
5354
5351
  Ze as w,
5355
- os as x,
5356
- ls as y,
5357
- ns as z
5352
+ ls as x,
5353
+ cs as y,
5354
+ is as z
5358
5355
  };