artifactuse 0.1.23 → 0.1.25

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,11 @@
1
1
  import e, { useState as b, useMemo as T, useCallback as d, useRef as W, useEffect as q, createContext as Ht, useContext as It } from "react";
2
- import { g as Te, f as ut, a as Ke, b as Ye, n as Bt, i as Ft, D as dt, c as Wt } from "../index-BR2-i8NP.js";
2
+ import { g as Te, f as ut, a as Ke, b as Ye, n as Bt, i as Ft, D as dt, c as Wt } from "../index-Bzk5VnG1.js";
3
3
  import { J as Vt } from "../jszip.min-CdmYyw5L.js";
4
4
  import { createPortal as zt } from "react-dom";
5
5
  function Rt({
6
6
  artifact: t,
7
7
  isActive: r = !1,
8
- onOpen: l,
8
+ onOpen: c,
9
9
  onCopy: n,
10
10
  onDownload: s,
11
11
  className: a = ""
@@ -14,8 +14,8 @@ function Rt({
14
14
  var x;
15
15
  return ut(t.size || ((x = t.code) == null ? void 0 : x.length) || 0);
16
16
  }, [t.size, t.code]), w = T(() => Ke(t.language), [t.language]), S = d((x) => {
17
- x.stopPropagation(), l && l(t);
18
- }, [t, l]), P = d(async (x) => {
17
+ x.stopPropagation(), c && c(t);
18
+ }, [t, c]), P = d(async (x) => {
19
19
  x.stopPropagation();
20
20
  try {
21
21
  await navigator.clipboard.writeText(t.code), p(!0), n && n(t), setTimeout(() => {
@@ -80,8 +80,8 @@ function qt(t) {
80
80
  if (!isNaN(a) && !isNaN(E) && !isNaN(p)) return `${a}, ${E}, ${p}`;
81
81
  }
82
82
  }
83
- const l = r.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
84
- if (l) return `${l[1]}, ${l[2]}, ${l[3]}`;
83
+ const c = r.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
84
+ if (c) return `${c[1]}, ${c[2]}, ${c[3]}`;
85
85
  const n = r.split(/[\s,]+/).map(Number).filter((s) => !isNaN(s));
86
86
  return n.length >= 3 ? `${n[0]}, ${n[1]}, ${n[2]}` : null;
87
87
  }
@@ -94,7 +94,7 @@ function Dt(t) {
94
94
  function Ut({
95
95
  artifact: t,
96
96
  onSubmit: r,
97
- onCancel: l,
97
+ onCancel: c,
98
98
  onReset: n,
99
99
  onButtonClick: s,
100
100
  className: a = "",
@@ -193,7 +193,7 @@ function Ut({
193
193
  se();
194
194
  break;
195
195
  case "cancel":
196
- l == null || l({
196
+ c == null || c({
197
197
  formId: x,
198
198
  action: "cancel",
199
199
  buttonName: o.name || "cancel",
@@ -224,7 +224,7 @@ function Ut({
224
224
  }, 150);
225
225
  break;
226
226
  }
227
- }, [x, $, se, l, n, s, ue, K]);
227
+ }, [x, $, se, c, n, s, ue, K]);
228
228
  return P ? /* @__PURE__ */ e.createElement(
229
229
  "div",
230
230
  {
@@ -293,7 +293,7 @@ function Ut({
293
293
  )))
294
294
  );
295
295
  }
296
- function jt({ field: t, formId: r, value: l, error: n, isSubmitting: s, onChange: a, onButtonAction: E }) {
296
+ function jt({ field: t, formId: r, value: c, error: n, isSubmitting: s, onChange: a, onButtonAction: E }) {
297
297
  const p = `${r}-${t.name}`;
298
298
  if (t.type === "buttons")
299
299
  return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, (t.fields || []).map((i, w) => /* @__PURE__ */ e.createElement(
@@ -319,7 +319,7 @@ function jt({ field: t, formId: r, value: l, error: n, isSubmitting: s, onChange
319
319
  type: "checkbox",
320
320
  id: p,
321
321
  name: t.name,
322
- checked: l || !1,
322
+ checked: c || !1,
323
323
  disabled: t.disabled,
324
324
  className: "artifactuse-checkbox",
325
325
  onChange: (i) => a(i.target.checked)
@@ -332,7 +332,7 @@ function jt({ field: t, formId: r, value: l, error: n, isSubmitting: s, onChange
332
332
  type: "radio",
333
333
  name: t.name,
334
334
  value: i.value,
335
- checked: l === i.value,
335
+ checked: c === i.value,
336
336
  disabled: i.disabled || t.disabled,
337
337
  className: "artifactuse-radio",
338
338
  onChange: () => a(i.value)
@@ -344,7 +344,7 @@ function jt({ field: t, formId: r, value: l, error: n, isSubmitting: s, onChange
344
344
  type: t.type,
345
345
  id: p,
346
346
  name: t.name,
347
- value: l || "",
347
+ value: c || "",
348
348
  placeholder: t.placeholder,
349
349
  disabled: t.disabled,
350
350
  required: t.required,
@@ -356,7 +356,7 @@ function jt({ field: t, formId: r, value: l, error: n, isSubmitting: s, onChange
356
356
  {
357
357
  id: p,
358
358
  name: t.name,
359
- value: l || "",
359
+ value: c || "",
360
360
  placeholder: t.placeholder,
361
361
  disabled: t.disabled,
362
362
  required: t.required,
@@ -369,7 +369,7 @@ function jt({ field: t, formId: r, value: l, error: n, isSubmitting: s, onChange
369
369
  {
370
370
  id: p,
371
371
  name: t.name,
372
- value: l || "",
372
+ value: c || "",
373
373
  disabled: t.disabled,
374
374
  required: t.required,
375
375
  className: "artifactuse-select",
@@ -383,7 +383,7 @@ function jt({ field: t, formId: r, value: l, error: n, isSubmitting: s, onChange
383
383
  type: "text",
384
384
  id: p,
385
385
  name: t.name,
386
- value: l || "",
386
+ value: c || "",
387
387
  disabled: t.disabled,
388
388
  className: "artifactuse-input",
389
389
  onChange: (i) => a(i.target.value)
@@ -417,36 +417,36 @@ const D = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0
417
417
  if (!t) return "";
418
418
  let r = t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
419
419
  return r = r.replace(/\n/g, "<br>"), r = r.replace(/#(\w+)/g, '<span class="artifactuse-social-hashtag">#$1</span>'), r = r.replace(/@(\w+)/g, '<span class="artifactuse-social-mention">@$1</span>'), r;
420
- }, mt = ({ author: t, content: r, engagement: l, meta: n }) => {
420
+ }, mt = ({ author: t, content: r, engagement: c, meta: n }) => {
421
421
  var E, p, N;
422
- const s = r.media || [], a = l.likes || l.retweets || l.replies || l.views;
422
+ const s = r.media || [], a = c.likes || c.retweets || c.replies || c.views;
423
423
  return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || D, alt: t.name, className: "artifactuse-social-avatar", onError: (i) => i.target.src = D }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, /* @__PURE__ */ e.createElement("span", null, t.name), t.verified && /* @__PURE__ */ e.createElement(Se, { type: t.verifiedType || "blue" })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-meta" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-author-handle" }, t.handle), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-timestamp" }, "· ", n.timestamp || "Just now")))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: ge(r.text) } }), s.length > 0 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, /* @__PURE__ */ e.createElement("div", { className: `artifactuse-social-media-grid ${s.length === 1 ? "artifactuse-social-media-single" : ""}`, "data-count": s.length }, s.slice(0, 4).map((i, w) => /* @__PURE__ */ e.createElement("img", { key: w, src: i.url, alt: i.alt || "", onError: (S) => S.target.style.display = "none" })))), r.link && !s.length && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, r.link.image && /* @__PURE__ */ e.createElement("img", { src: r.link.image, alt: r.link.title, className: "artifactuse-social-link-image", onError: (i) => i.target.style.display = "none" }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-domain" }, r.link.domain || Qe(r.link.url)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, r.link.title), r.link.description && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-description" }, r.link.description))), r.poll && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll" }, r.poll.options.map((i, w) => {
424
424
  var S, P;
425
425
  return /* @__PURE__ */ e.createElement("div", { key: w, className: "artifactuse-social-poll-option" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-bar", style: { width: `${((S = r.poll.votes) == null ? void 0 : S[w]) || 0}%` } }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-label" }, /* @__PURE__ */ e.createElement("span", null, i), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-poll-percent" }, ((P = r.poll.votes) == null ? void 0 : P[w]) || 0, "%")));
426
- }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-meta" }, V(r.poll.totalVotes || 0), " votes · ", r.poll.duration || "Poll ended")), r.quote && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-quote" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-quote-header" }, /* @__PURE__ */ e.createElement("img", { src: ((E = r.quote.author) == null ? void 0 : E.avatar) || D, className: "artifactuse-social-quote-avatar", alt: "" }), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-quote-author" }, (p = r.quote.author) == null ? void 0 : p.name), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-quote-handle" }, (N = r.quote.author) == null ? void 0 : N.handle)), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-quote-text" }, r.quote.text))), a && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, V(l.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, V(l.retweets || 0), " reposts"), /* @__PURE__ */ e.createElement("span", null, V(l.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, V(l.views || 0), " views")));
427
- }, Xt = ({ author: t, content: r, engagement: l, meta: n }) => {
428
- const s = l.likes || l.comments || l.shares || l.reposts;
429
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || D, alt: t.name, className: "artifactuse-social-avatar", onError: (a) => a.target.src = D }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.connection && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-author-connection" }, "· ", t.connection)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-headline" }, t.headline), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-timestamp" }, n.timestamp || "Just now", " · 🌐"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: ge(r.text) } }), r.link && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, r.link.image && /* @__PURE__ */ e.createElement("img", { src: r.link.image, alt: r.link.title, className: "artifactuse-social-link-image", onError: (a) => a.target.style.display = "none" }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, r.link.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-domain" }, r.link.domain || Qe(r.link.url))))), s && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, V(l.likes || 0), " reactions"), /* @__PURE__ */ e.createElement("span", null, V(l.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, V(l.shares || l.reposts || 0), " reposts")));
430
- }, Zt = ({ author: t, content: r, engagement: l, meta: n }) => {
426
+ }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-meta" }, V(r.poll.totalVotes || 0), " votes · ", r.poll.duration || "Poll ended")), r.quote && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-quote" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-quote-header" }, /* @__PURE__ */ e.createElement("img", { src: ((E = r.quote.author) == null ? void 0 : E.avatar) || D, className: "artifactuse-social-quote-avatar", alt: "" }), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-quote-author" }, (p = r.quote.author) == null ? void 0 : p.name), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-quote-handle" }, (N = r.quote.author) == null ? void 0 : N.handle)), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-quote-text" }, r.quote.text))), a && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, V(c.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, V(c.retweets || 0), " reposts"), /* @__PURE__ */ e.createElement("span", null, V(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, V(c.views || 0), " views")));
427
+ }, Xt = ({ author: t, content: r, engagement: c, meta: n }) => {
428
+ const s = c.likes || c.comments || c.shares || c.reposts;
429
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || D, alt: t.name, className: "artifactuse-social-avatar", onError: (a) => a.target.src = D }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.connection && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-author-connection" }, "· ", t.connection)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-headline" }, t.headline), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-timestamp" }, n.timestamp || "Just now", " · 🌐"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: ge(r.text) } }), r.link && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, r.link.image && /* @__PURE__ */ e.createElement("img", { src: r.link.image, alt: r.link.title, className: "artifactuse-social-link-image", onError: (a) => a.target.style.display = "none" }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, r.link.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-domain" }, r.link.domain || Qe(r.link.url))))), s && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, V(c.likes || 0), " reactions"), /* @__PURE__ */ e.createElement("span", null, V(c.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, V(c.shares || c.reposts || 0), " reposts")));
430
+ }, Zt = ({ author: t, content: r, engagement: c, meta: n }) => {
431
431
  const s = r.media || [];
432
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || D, alt: t.name, className: "artifactuse-social-avatar", onError: (a) => a.target.src = D }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement(Se, { type: "blue" })), n.location && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-location" }, n.location))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, s[0] ? /* @__PURE__ */ e.createElement("img", { src: s[0].url, alt: s[0].alt || "", onError: (a) => a.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media-placeholder" })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-likes" }, V(l.likes || 0), " likes"), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-caption" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-caption-author" }, t.name), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-caption-text", dangerouslySetInnerHTML: { __html: ge(r.text) } })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-timestamp" }, n.timestamp || "JUST NOW"));
433
- }, Kt = ({ author: t, content: r, engagement: l, meta: n }) => {
432
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || D, alt: t.name, className: "artifactuse-social-avatar", onError: (a) => a.target.src = D }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement(Se, { type: "blue" })), n.location && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-location" }, n.location))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, s[0] ? /* @__PURE__ */ e.createElement("img", { src: s[0].url, alt: s[0].alt || "", onError: (a) => a.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media-placeholder" })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-likes" }, V(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-caption" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-caption-author" }, t.name), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-caption-text", dangerouslySetInnerHTML: { __html: ge(r.text) } })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-timestamp" }, n.timestamp || "JUST NOW"));
433
+ }, Kt = ({ author: t, content: r, engagement: c, meta: n }) => {
434
434
  const s = r.media || [], a = T(() => {
435
- const p = l.reactions || {};
436
- return Object.values(p).reduce((N, i) => N + (i || 0), 0) || l.likes || 0;
437
- }, [l]), E = l.likes || l.comments || l.shares || a;
438
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || D, alt: t.name, className: "artifactuse-social-avatar", onError: (p) => p.target.src = D }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-timestamp" }, n.timestamp || "Just now", " · 🌐"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: ge(r.text) } }), s.length > 0 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media-grid", "data-count": s.length }, s.slice(0, 4).map((p, N) => /* @__PURE__ */ e.createElement("img", { key: N, src: p.url, alt: p.alt || "", onError: (i) => i.target.style.display = "none" })))), r.link && !s.length && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, r.link.image && /* @__PURE__ */ e.createElement("img", { src: r.link.image, alt: r.link.title, className: "artifactuse-social-link-image", onError: (p) => p.target.style.display = "none" }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-domain" }, r.link.domain || Qe(r.link.url)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, r.link.title)))), E && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, "👍❤️ ", V(a)), /* @__PURE__ */ e.createElement("span", null, V(l.comments || 0), " comments · ", V(l.shares || 0), " shares")));
439
- }, Yt = ({ author: t, content: r, engagement: l, meta: n }) => {
440
- const s = l.likes || l.replies || l.reposts;
441
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || D, alt: t.name, className: "artifactuse-social-avatar", onError: (a) => a.target.src = D }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement(Se, { type: "blue" }))), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-timestamp" }, n.timestamp || "Just now")), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: ge(r.text) } })), s && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, V(l.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, V(l.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, V(l.reposts || 0), " reposts")));
442
- }, Qt = ({ author: t, content: r, engagement: l, meta: n }) => {
443
- const s = r.media || [], a = l.likes || l.comments || l.shares;
444
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, s[0] ? /* @__PURE__ */ e.createElement("img", { src: s[0].url, alt: "Video thumbnail", onError: (E) => E.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail-placeholder" }), r.duration && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-duration" }, r.duration)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || D, alt: t.name, className: "artifactuse-social-avatar", onError: (E) => E.target.src = D }), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-author-name" }, "@", t.name), t.verified && /* @__PURE__ */ e.createElement(Se, { type: "blue" })), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: ge(r.text) } }), r.sound && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-sound" }, "🎵 ", r.sound)), a && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, V(l.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, V(l.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, V(l.shares || 0), " shares")));
445
- }, Gt = ({ author: t, content: r, engagement: l, meta: n }) => {
435
+ const p = c.reactions || {};
436
+ return Object.values(p).reduce((N, i) => N + (i || 0), 0) || c.likes || 0;
437
+ }, [c]), E = c.likes || c.comments || c.shares || a;
438
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || D, alt: t.name, className: "artifactuse-social-avatar", onError: (p) => p.target.src = D }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-timestamp" }, n.timestamp || "Just now", " · 🌐"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: ge(r.text) } }), s.length > 0 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media-grid", "data-count": s.length }, s.slice(0, 4).map((p, N) => /* @__PURE__ */ e.createElement("img", { key: N, src: p.url, alt: p.alt || "", onError: (i) => i.target.style.display = "none" })))), r.link && !s.length && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, r.link.image && /* @__PURE__ */ e.createElement("img", { src: r.link.image, alt: r.link.title, className: "artifactuse-social-link-image", onError: (p) => p.target.style.display = "none" }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-domain" }, r.link.domain || Qe(r.link.url)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, r.link.title)))), E && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, "👍❤️ ", V(a)), /* @__PURE__ */ e.createElement("span", null, V(c.comments || 0), " comments · ", V(c.shares || 0), " shares")));
439
+ }, Yt = ({ author: t, content: r, engagement: c, meta: n }) => {
440
+ const s = c.likes || c.replies || c.reposts;
441
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || D, alt: t.name, className: "artifactuse-social-avatar", onError: (a) => a.target.src = D }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement(Se, { type: "blue" }))), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-timestamp" }, n.timestamp || "Just now")), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: ge(r.text) } })), s && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, V(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, V(c.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, V(c.reposts || 0), " reposts")));
442
+ }, Qt = ({ author: t, content: r, engagement: c, meta: n }) => {
443
+ const s = r.media || [], a = c.likes || c.comments || c.shares;
444
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, s[0] ? /* @__PURE__ */ e.createElement("img", { src: s[0].url, alt: "Video thumbnail", onError: (E) => E.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail-placeholder" }), r.duration && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-duration" }, r.duration)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || D, alt: t.name, className: "artifactuse-social-avatar", onError: (E) => E.target.src = D }), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-author-name" }, "@", t.name), t.verified && /* @__PURE__ */ e.createElement(Se, { type: "blue" })), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: ge(r.text) } }), r.sound && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-sound" }, "🎵 ", r.sound)), a && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, V(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, V(c.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, V(c.shares || 0), " shares")));
445
+ }, Gt = ({ author: t, content: r, engagement: c, meta: n }) => {
446
446
  const s = r.media || [];
447
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, s[0] ? /* @__PURE__ */ e.createElement("img", { src: s[0].url, alt: "Video thumbnail", onError: (a) => a.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail-placeholder" }), r.duration && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-duration" }, r.duration)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-info" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || D, alt: t.name, className: "artifactuse-social-avatar", onError: (a) => a.target.src = D }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-details" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-title" }, r.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-channel" }, t.name), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-meta" }, V(l.views || 0), " views · ", n.timestamp || "Just now"))));
447
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, s[0] ? /* @__PURE__ */ e.createElement("img", { src: s[0].url, alt: "Video thumbnail", onError: (a) => a.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail-placeholder" }), r.duration && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-duration" }, r.duration)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-info" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || D, alt: t.name, className: "artifactuse-social-avatar", onError: (a) => a.target.src = D }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-details" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-title" }, r.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-channel" }, t.name), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-meta" }, V(c.views || 0), " views · ", n.timestamp || "Just now"))));
448
448
  };
449
- function ea({ artifact: t, theme: r = "dark", onCopy: l }) {
449
+ function ea({ artifact: t, theme: r = "dark", onCopy: c }) {
450
450
  const [n, s] = b("Copy"), a = T(() => {
451
451
  try {
452
452
  return JSON.parse(t.code);
@@ -456,9 +456,9 @@ function ea({ artifact: t, theme: r = "dark", onCopy: l }) {
456
456
  }, [t.code]), E = (a == null ? void 0 : a.platform) || "twitter", p = (a == null ? void 0 : a.data) || {}, { author: N = {}, content: i = {}, engagement: w = {}, meta: S = {} } = p, P = Ot[E] || 280, m = (i.text || "").length, g = m > P ? "error" : m > P * 0.9 ? "warning" : "", x = d(() => {
457
457
  const h = i.text || "";
458
458
  navigator.clipboard.writeText(h).then(() => {
459
- s("Copied!"), setTimeout(() => s("Copy"), 2e3), l == null || l({ platform: E, text: h });
459
+ s("Copied!"), setTimeout(() => s("Copy"), 2e3), c == null || c({ platform: E, text: h });
460
460
  });
461
- }, [i.text, E, l]), f = () => {
461
+ }, [i.text, E, c]), f = () => {
462
462
  const h = { author: N, content: i, engagement: w, meta: S };
463
463
  switch (E) {
464
464
  case "twitter":
@@ -484,7 +484,7 @@ function ea({ artifact: t, theme: r = "dark", onCopy: l }) {
484
484
  function ta({
485
485
  isOpen: t = !1,
486
486
  type: r = "image",
487
- src: l = "",
487
+ src: c = "",
488
488
  alt: n = "",
489
489
  caption: s = "",
490
490
  onClose: a,
@@ -508,8 +508,8 @@ function ta({
508
508
  r === "image" && i((f) => !f);
509
509
  }, [r]), g = d(() => {
510
510
  const f = document.createElement("a");
511
- f.href = l, f.download = n || "download", document.body.appendChild(f), f.click(), document.body.removeChild(f);
512
- }, [l, n]);
511
+ f.href = c, f.download = n || "download", document.body.appendChild(f), f.click(), document.body.removeChild(f);
512
+ }, [c, n]);
513
513
  if (!t || !w)
514
514
  return null;
515
515
  const x = /* @__PURE__ */ e.createElement(
@@ -525,7 +525,7 @@ function ta({
525
525
  /* @__PURE__ */ e.createElement("div", { className: "artifactuse-viewer-content", onClick: (f) => f.stopPropagation() }, r === "image" && /* @__PURE__ */ e.createElement(
526
526
  "img",
527
527
  {
528
- src: l,
528
+ src: c,
529
529
  alt: n,
530
530
  className: `artifactuse-viewer-image ${N ? "artifactuse-viewer-image--zoomed" : ""}`,
531
531
  onClick: m
@@ -533,7 +533,7 @@ function ta({
533
533
  ), r === "pdf" && /* @__PURE__ */ e.createElement(
534
534
  "iframe",
535
535
  {
536
- src: l,
536
+ src: c,
537
537
  className: "artifactuse-viewer-pdf",
538
538
  title: n || "PDF Viewer"
539
539
  }
@@ -572,20 +572,20 @@ function aa(t) {
572
572
  return JSON.parse(r);
573
573
  } catch {
574
574
  try {
575
- const l = t.replace(/&#10;/g, `
575
+ const c = t.replace(/&#10;/g, `
576
576
  `).replace(/&#13;/g, "\r").replace(/&#9;/g, " ").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
577
- return JSON.parse(l);
578
- } catch (l) {
579
- return console.error("Failed to parse artifact data:", l), null;
577
+ return JSON.parse(c);
578
+ } catch (c) {
579
+ return console.error("Failed to parse artifact data:", c), null;
580
580
  }
581
581
  }
582
582
  }
583
583
  function ra(t) {
584
584
  const r = [];
585
585
  if (!t) return r;
586
- const l = /<div\s+class="artifactuse-placeholder[^"]*"[^>]*data-artifact-id="([^"]+)"[^>]*data-artifact-type="([^"]+)"[^>]*data-artifact=["']([^"']*)["'][^>]*><\/div>/gi;
586
+ const c = /<div\s+class="artifactuse-placeholder[^"]*"[^>]*data-artifact-id="([^"]+)"[^>]*data-artifact-type="([^"]+)"[^>]*data-artifact=["']([^"']*)["'][^>]*><\/div>/gi;
587
587
  let n = 0, s;
588
- for (; (s = l.exec(t)) !== null; ) {
588
+ for (; (s = c.exec(t)) !== null; ) {
589
589
  if (s.index > n) {
590
590
  const p = t.slice(n, s.index);
591
591
  p.trim() && r.push({ type: "html", content: p });
@@ -605,7 +605,7 @@ function sa() {
605
605
  function na({
606
606
  content: t,
607
607
  messageId: r = sa(),
608
- inlineCards: l = !0,
608
+ inlineCards: c = !0,
609
609
  typing: n = !1,
610
610
  isLastMessage: s = !1,
611
611
  // Whether this is the last/most recent message
@@ -775,7 +775,7 @@ function na({
775
775
  }
776
776
  );
777
777
  case "panel":
778
- return l ? /* @__PURE__ */ e.createElement(
778
+ return c ? /* @__PURE__ */ e.createElement(
779
779
  Rt,
780
780
  {
781
781
  key: `panel-${v.artifact.id}`,
@@ -840,7 +840,7 @@ na.propTypes = {
840
840
  function pa({
841
841
  onAIRequest: t,
842
842
  onSave: r,
843
- onExport: l,
843
+ onExport: c,
844
844
  className: n = ""
845
845
  }) {
846
846
  var it;
@@ -855,28 +855,32 @@ function pa({
855
855
  getPanelUrl: S,
856
856
  openArtifact: P,
857
857
  instance: m
858
- } = _e(), g = W(null), x = W(null), f = W(null), h = W(null), B = W(null), U = W(null), $ = W(null), [M, Y] = b(!1), [Q, O] = b(!1), [me, K] = b(!0), [Ee, re] = b(!1), [ue, se] = b(!1), [J, de] = b(!1), [ne, le] = b(!1), [o, _] = b("options"), [y, k] = b(""), [H, X] = b(null), [Ne, Z] = b(""), [be, G] = b(!1), [ve, pe] = b(!1), [ke, ce] = b([]), [Ae, ye] = b(!1), [$e, we] = b(""), [ie, He] = b(65), [he, Ie] = b(50), v = W(null), te = W(null), Be = W(null), fe = W(null), A = W(null), Fe = T(() => a ? Te(a.language) : "", [a]), u = T(() => a ? Ke(a.language) : "", [a]), I = T(() => a ? S(a) : null, [a, S]), F = T(() => a ? Bt(a.language) : "plaintext", [a]), L = T(() => s.artifacts.filter((c) => !c.isInline), [s.artifacts]), j = T(() => a ? L.findIndex((c) => c.id === a.id) : -1, [a, L]), We = T(() => {
859
- var c;
860
- return ((c = m == null ? void 0 : m.config) == null ? void 0 : c.branding) !== !1;
858
+ } = _e(), g = W(null), x = W(null), f = W(null), h = W(null), B = W(null), U = W(null), $ = W(null), [M, Y] = b(!1), [Q, O] = b(!1), [me, K] = b(!0), [Ee, re] = b(!1), [ue, se] = b(!1), [J, de] = b(!1), [ne, le] = b(!1), [o, _] = b("options"), [y, k] = b(""), [H, X] = b(null), [Ne, Z] = b(""), [be, G] = b(!1), [ve, pe] = b(!1), [ke, ce] = b([]), [Ae, ye] = b(!1), [$e, we] = b(""), [ie, He] = b(65), [he, Ie] = b(50), v = W(null), te = W(null), Be = W(null), fe = W(null), A = W(null), Fe = T(() => a ? Te(a.language) : "", [a]), u = T(() => a ? Ke(a.language) : "", [a]), I = T(() => {
859
+ if (!a) return null;
860
+ let l = S(a);
861
+ return l && a._refreshToken && (l += (l.includes("?") ? "&" : "?") + "_t=" + a._refreshToken), l;
862
+ }, [a, S]), F = T(() => a ? Bt(a.language) : "plaintext", [a]), L = T(() => s.artifacts.filter((l) => !l.isInline), [s.artifacts]), j = T(() => a ? L.findIndex((l) => l.id === a.id) : -1, [a, L]), We = T(() => {
863
+ var l;
864
+ return ((l = m == null ? void 0 : m.config) == null ? void 0 : l.branding) !== !1;
861
865
  }, [m]), ft = T(() => {
862
- var c;
863
- return ((c = m == null ? void 0 : m.share) == null ? void 0 : c.enabled) !== !1;
866
+ var l;
867
+ return ((l = m == null ? void 0 : m.share) == null ? void 0 : l.enabled) !== !1;
864
868
  }, [m]), xe = T(() => {
865
- var c;
866
- return ((c = m == null ? void 0 : m.share) == null ? void 0 : c.isAuthenticated()) || !1;
867
- }, [m]), Ge = T(() => a ? ie : Math.min(ie, 30), [a, ie]), et = d((c) => `<svg viewBox="0 0 24 24" fill="currentColor">${Ke(c)}</svg>`, []), Et = d(() => {
869
+ var l;
870
+ return ((l = m == null ? void 0 : m.share) == null ? void 0 : l.isAuthenticated()) || !1;
871
+ }, [m]), Ge = T(() => a ? ie : Math.min(ie, 30), [a, ie]), et = d((l) => `<svg viewBox="0 0 24 24" fill="currentColor">${Ke(l)}</svg>`, []), Et = d(() => {
868
872
  se(!1), m.state.clearActiveArtifact();
869
873
  }, [m]), tt = d(() => {
870
874
  if (!h.current || !(a != null && a.code)) return;
871
- const c = a.code.split(`
872
- `).length, C = Array.from({ length: c }, (R, z) => `<div>${z + 1}</div>`).join("");
875
+ const l = a.code.split(`
876
+ `).length, C = Array.from({ length: l }, (R, z) => `<div>${z + 1}</div>`).join("");
873
877
  h.current.innerHTML = C;
874
878
  }, [a]), at = d(() => {
875
879
  if (x.current && Ft() && (a != null && a.code)) {
876
- const c = window.Prism.languages[F];
877
- c ? x.current.innerHTML = window.Prism.highlight(
880
+ const l = window.Prism.languages[F];
881
+ l ? x.current.innerHTML = window.Prism.highlight(
878
882
  a.code,
879
- c,
883
+ l,
880
884
  F
881
885
  ) : x.current.textContent = a.code, x.current.dataset.highlighted = "true", setTimeout(() => {
882
886
  vt();
@@ -884,9 +888,9 @@ function pa({
884
888
  }
885
889
  }, [a == null ? void 0 : a.code, F]), vt = d(() => {
886
890
  var C;
887
- const c = (C = x.current) == null ? void 0 : C.closest("pre");
888
- if (c && B.current && h.current) {
889
- const z = window.getComputedStyle(c).backgroundColor;
891
+ const l = (C = x.current) == null ? void 0 : C.closest("pre");
892
+ if (l && B.current && h.current) {
893
+ const z = window.getComputedStyle(l).backgroundColor;
890
894
  z && z !== "rgba(0, 0, 0, 0)" && z !== "transparent" && (B.current.style.backgroundColor = z, h.current.style.backgroundColor = z);
891
895
  }
892
896
  }, []), rt = d(() => {
@@ -896,16 +900,16 @@ function pa({
896
900
  }, [tt, at]), ze = ((it = m.editor) == null ? void 0 : it.isAvailable()) || !1, st = d(() => {
897
901
  !ze || !U.current || !a || ($.current && ($.current.destroy(), $.current = null), $.current = m.editor.create(U.current, {
898
902
  code: a.code || "",
899
- language: a.language || "plaintext",
903
+ language: a.editorLanguage || a.language || "plaintext",
900
904
  sdkTheme: m.getTheme()
901
905
  }));
902
906
  }, [ze, a, m]), ht = d(() => {
903
907
  if (!$.current || !a) return;
904
- const c = $.current.getCode();
908
+ const l = $.current.getCode();
905
909
  m.emit("edit:save", {
906
910
  artifactId: a.id,
907
911
  artifact: a,
908
- code: c
912
+ code: l
909
913
  });
910
914
  }, [a, m]), gt = d(() => {
911
915
  clearTimeout(fe.current), K(!1), g.current && a && (m.bridge.setIframe(g.current), m.bridge.loadArtifact(a));
@@ -919,34 +923,34 @@ function pa({
919
923
  if (a)
920
924
  try {
921
925
  await navigator.clipboard.writeText(a.code), Y(!0), setTimeout(() => Y(!1), 2e3);
922
- } catch (c) {
923
- console.error("Failed to copy:", c);
926
+ } catch (l) {
927
+ console.error("Failed to copy:", l);
924
928
  }
925
929
  }, [a]), bt = d(() => {
926
930
  if (!a) return;
927
- const { code: c, language: C, title: R } = a, z = Ye(C), ae = `${R.toLowerCase().replace(/\s+/g, "-")}.${z}`, Me = new Blob([c], { type: "text/plain" }), oe = URL.createObjectURL(Me), ee = document.createElement("a");
931
+ const { code: l, language: C, title: R } = a, z = Ye(C), ae = `${R.toLowerCase().replace(/\s+/g, "-")}.${z}`, Me = new Blob([l], { type: "text/plain" }), oe = URL.createObjectURL(Me), ee = document.createElement("a");
928
932
  ee.href = oe, ee.download = ae, document.body.appendChild(ee), ee.click(), document.body.removeChild(ee), URL.revokeObjectURL(oe);
929
933
  }, [a]), kt = d(async () => {
930
934
  if (!(J || L.length === 0)) {
931
935
  de(!0);
932
936
  try {
933
- const c = new Vt(), C = /* @__PURE__ */ new Map();
937
+ const l = new Vt(), C = /* @__PURE__ */ new Map();
934
938
  for (const ee of L) {
935
939
  if (!ee.code) continue;
936
940
  const Oe = Ye(ee.language);
937
941
  let Je = (ee.title || "untitled").toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-_]/g, ""), Xe = `${Je}.${Oe}`;
938
942
  const Ze = C.get(Xe) || 0;
939
- Ze > 0 && (Xe = `${Je}-${Ze}.${Oe}`), C.set(`${Je}.${Oe}`, Ze + 1), c.file(Xe, ee.code);
943
+ Ze > 0 && (Xe = `${Je}-${Ze}.${Oe}`), C.set(`${Je}.${Oe}`, Ze + 1), l.file(Xe, ee.code);
940
944
  }
941
- const R = await c.generateAsync({ type: "blob" }), ae = `artifacts-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`, Me = URL.createObjectURL(R), oe = document.createElement("a");
945
+ const R = await l.generateAsync({ type: "blob" }), ae = `artifacts-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`, Me = URL.createObjectURL(R), oe = document.createElement("a");
942
946
  oe.href = Me, oe.download = ae, document.body.appendChild(oe), oe.click(), document.body.removeChild(oe), URL.revokeObjectURL(Me);
943
- } catch (c) {
944
- console.error("Failed to create ZIP:", c);
947
+ } catch (l) {
948
+ console.error("Failed to create ZIP:", l);
945
949
  } finally {
946
950
  de(!1);
947
951
  }
948
952
  }
949
- }, [J, L]), nt = d((c) => c ? new Date(c).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : "", []), wt = d(() => {
953
+ }, [J, L]), nt = d((l) => l ? new Date(l).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : "", []), wt = d(() => {
950
954
  if (ne) {
951
955
  le(!1);
952
956
  return;
@@ -958,10 +962,10 @@ function pa({
958
962
  if (!(!a || !(m != null && m.share))) {
959
963
  _("loading"), Z("");
960
964
  try {
961
- const c = await m.share.share(a);
962
- k(c.url), X(c.expiresAt), pe(!1), _("success");
963
- } catch (c) {
964
- Z(c.message || "Failed to create share link"), _("error");
965
+ const l = await m.share.share(a);
966
+ k(l.url), X(l.expiresAt), pe(!1), _("success");
967
+ } catch (l) {
968
+ Z(l.message || "Failed to create share link"), _("error");
965
969
  }
966
970
  }
967
971
  }, [a, m]), lt = d(async () => {
@@ -971,18 +975,18 @@ function pa({
971
975
  _("loading");
972
976
  try {
973
977
  await m.share.openAuthPopup(), Ce();
974
- } catch (c) {
975
- c.message === "Authentication cancelled" ? _("options") : (Z(c.message || "Authentication failed"), _("error"));
978
+ } catch (l) {
979
+ l.message === "Authentication cancelled" ? _("options") : (Z(l.message || "Authentication failed"), _("error"));
976
980
  }
977
981
  }
978
982
  }, [xe, m]), Ce = d(async () => {
979
983
  if (!(!a || !(m != null && m.share))) {
980
984
  _("loading"), Z("");
981
985
  try {
982
- const c = await m.share.save(a);
983
- k(c.url), X(null), pe(!0), _("success");
984
- } catch (c) {
985
- Z(c.message || "Failed to save artifact"), _("error");
986
+ const l = await m.share.save(a);
987
+ k(l.url), X(null), pe(!0), _("success");
988
+ } catch (l) {
989
+ Z(l.message || "Failed to save artifact"), _("error");
986
990
  }
987
991
  }
988
992
  }, [a, m]), Ct = d(() => {
@@ -993,30 +997,30 @@ function pa({
993
997
  _("loading");
994
998
  try {
995
999
  await m.share.openAuthPopup();
996
- } catch (c) {
997
- c.message === "Authentication cancelled" ? _("options") : (Z(c.message || "Authentication failed"), _("error"));
1000
+ } catch (l) {
1001
+ l.message === "Authentication cancelled" ? _("options") : (Z(l.message || "Authentication failed"), _("error"));
998
1002
  return;
999
1003
  }
1000
1004
  }
1001
1005
  _("update-list"), ye(!0);
1002
1006
  try {
1003
- const c = (a == null ? void 0 : a.language) || null, C = await m.share.listArtifacts(c);
1007
+ const l = (a == null ? void 0 : a.language) || null, C = await m.share.listArtifacts(l);
1004
1008
  ce(C.projects || []);
1005
- } catch (c) {
1006
- Z(c.message || "Failed to load artifacts"), _("error");
1009
+ } catch (l) {
1010
+ Z(l.message || "Failed to load artifacts"), _("error");
1007
1011
  } finally {
1008
1012
  ye(!1);
1009
1013
  }
1010
1014
  }
1011
- }, [a, m, xe]), Pt = d(async (c) => {
1015
+ }, [a, m, xe]), Pt = d(async (l) => {
1012
1016
  var R, z;
1013
1017
  if (!a || !(m != null && m.share)) return;
1014
- const C = (R = c.project) == null ? void 0 : R.uuid;
1018
+ const C = (R = l.project) == null ? void 0 : R.uuid;
1015
1019
  if (C) {
1016
1020
  _("loading"), Z("");
1017
1021
  try {
1018
1022
  const ae = await m.share.updateArtifact(C, a);
1019
- k(ae.url || ""), X(null), pe(!0), we(((z = c.project) == null ? void 0 : z.name) || "Untitled"), _("success");
1023
+ k(ae.url || ""), X(null), pe(!0), we(((z = l.project) == null ? void 0 : z.name) || "Untitled"), _("success");
1020
1024
  } catch (ae) {
1021
1025
  Z(ae.message || "Failed to update artifact"), _("error");
1022
1026
  }
@@ -1025,57 +1029,57 @@ function pa({
1025
1029
  if (y)
1026
1030
  try {
1027
1031
  await navigator.clipboard.writeText(y), G(!0), setTimeout(() => G(!1), 2e3);
1028
- } catch (c) {
1029
- console.error("Failed to copy link:", c);
1032
+ } catch (l) {
1033
+ console.error("Failed to copy link:", l);
1030
1034
  }
1031
1035
  }, [y]), Tt = d(() => {
1032
1036
  j > 0 && P(L[j - 1]);
1033
1037
  }, [j, P, L]), St = d(() => {
1034
1038
  j < L.length - 1 && P(L[j + 1]);
1035
- }, [j, P, L]), ct = d((c) => {
1036
- se(!0), P(c), O(!1);
1037
- }, [P]), qe = d((c) => {
1039
+ }, [j, P, L]), ct = d((l) => {
1040
+ se(!0), P(l), O(!1);
1041
+ }, [P]), qe = d((l) => {
1038
1042
  v.current = {
1039
- startX: c.clientX,
1043
+ startX: l.clientX,
1040
1044
  startWidth: ie
1041
1045
  }, document.addEventListener("mousemove", De), document.addEventListener("mouseup", Le), document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.querySelectorAll("iframe").forEach((C) => {
1042
1046
  C.style.pointerEvents = "none";
1043
1047
  });
1044
- }, [ie]), De = d((c) => {
1048
+ }, [ie]), De = d((l) => {
1045
1049
  if (!v.current) return;
1046
- const C = window.innerWidth, z = (v.current.startX - c.clientX) / C * 100, ae = v.current.startWidth + z;
1050
+ const C = window.innerWidth, z = (v.current.startX - l.clientX) / C * 100, ae = v.current.startWidth + z;
1047
1051
  He(Math.min(Math.max(ae, 25), 75));
1048
1052
  }, []), Le = d(() => {
1049
- v.current = null, document.removeEventListener("mousemove", De), document.removeEventListener("mouseup", Le), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((c) => {
1050
- c.style.pointerEvents = "";
1053
+ v.current = null, document.removeEventListener("mousemove", De), document.removeEventListener("mouseup", Le), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((l) => {
1054
+ l.style.pointerEvents = "";
1051
1055
  });
1052
- }, [De]), At = d((c) => {
1056
+ }, [De]), At = d((l) => {
1053
1057
  if (!f.current) return;
1054
1058
  const C = f.current.getBoundingClientRect();
1055
1059
  te.current = {
1056
- startX: c.clientX,
1060
+ startX: l.clientX,
1057
1061
  startPosition: he,
1058
1062
  contentLeft: C.left,
1059
1063
  contentWidth: C.width
1060
1064
  }, document.addEventListener("mousemove", Ue), document.addEventListener("mouseup", Pe), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.querySelectorAll("iframe").forEach((R) => {
1061
1065
  R.style.pointerEvents = "none";
1062
1066
  });
1063
- }, [he]), Ue = d((c) => {
1067
+ }, [he]), Ue = d((l) => {
1064
1068
  if (!te.current) return;
1065
- const R = (c.clientX - te.current.contentLeft) / te.current.contentWidth * 100;
1069
+ const R = (l.clientX - te.current.contentLeft) / te.current.contentWidth * 100;
1066
1070
  Ie(Math.min(Math.max(R, 20), 80));
1067
1071
  }, []), Pe = d(() => {
1068
- te.current = null, document.removeEventListener("mousemove", Ue), document.removeEventListener("mouseup", Pe), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((c) => {
1069
- c.style.pointerEvents = "";
1072
+ te.current = null, document.removeEventListener("mousemove", Ue), document.removeEventListener("mouseup", Pe), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((l) => {
1073
+ l.style.pointerEvents = "";
1070
1074
  });
1071
1075
  }, [Ue]);
1072
1076
  if (q(() => {
1073
1077
  a && (A.current && A.current.isPreviewable !== a.isPreviewable && (re(!0), setTimeout(() => re(!1), 150)), A.current = a, rt(), K(!0), yt(), Ve());
1074
1078
  }, [a == null ? void 0 : a.id, rt]), q(() => {
1075
1079
  (s.viewMode === "code" || s.viewMode === "split") && Ve(), s.viewMode === "edit" && st();
1076
- }, [s.viewMode, Ve, st]), q(() => (t && m.on("ai:request", t), r && m.on("save:request", r), l && m.on("export:complete", l), () => {
1077
- t && m.off("ai:request", t), r && m.off("save:request", r), l && m.off("export:complete", l);
1078
- }), [m, t, r, l]), q(() => () => {
1080
+ }, [s.viewMode, Ve, st]), q(() => (t && m.on("ai:request", t), r && m.on("save:request", r), c && m.on("export:complete", c), () => {
1081
+ t && m.off("ai:request", t), r && m.off("save:request", r), c && m.off("export:complete", c);
1082
+ }), [m, t, r, c]), q(() => () => {
1079
1083
  Le(), Pe(), $.current && ($.current.destroy(), $.current = null), clearTimeout(Be.current), clearTimeout(fe.current);
1080
1084
  }, [Le, Pe]), !s.isPanelOpen) return null;
1081
1085
  const je = [
@@ -1262,17 +1266,17 @@ function pa({
1262
1266
  onClick: wt
1263
1267
  },
1264
1268
  /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "18", cy: "5", r: "3" }), /* @__PURE__ */ e.createElement("circle", { cx: "6", cy: "12", r: "3" }), /* @__PURE__ */ e.createElement("circle", { cx: "18", cy: "19", r: "3" }), /* @__PURE__ */ e.createElement("line", { x1: "8.59", y1: "13.51", x2: "15.42", y2: "17.49" }), /* @__PURE__ */ e.createElement("line", { x1: "15.41", y1: "6.51", x2: "8.59", y2: "10.49" }))
1265
- ), ne && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__header" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__title" }, o === "success" ? $e ? "Artifact updated!" : "Link created!" : o === "update-list" ? "Update saved artifact" : "Share Artifact"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__close", onClick: xt }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__body" }, o === "loading" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__spinner" }), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__loading-text" }, "Creating link...")), o === "error" && /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__error" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__error-text" }, Ne)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__actions" }, /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__btn artifactuse-share-popup__btn--secondary", onClick: () => _("options") }, "Back"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__btn artifactuse-share-popup__btn--primary", onClick: Ct }, "Retry"))), o === "options" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__options" }, /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__option", onClick: Re }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }), /* @__PURE__ */ e.createElement("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-title" }, "Share link"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-desc" }, "Expires in 30 days"))), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__option", onClick: lt }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" }), /* @__PURE__ */ e.createElement("polyline", { points: "17 21 17 13 7 13 7 21" }), /* @__PURE__ */ e.createElement("polyline", { points: "7 3 7 8 15 8" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-title" }, "Save to account"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-desc" }, "Permanent, manageable"))), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__option", onClick: Lt }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "23 4 23 10 17 10" }), /* @__PURE__ */ e.createElement("polyline", { points: "1 20 1 14 7 14" }), /* @__PURE__ */ e.createElement("path", { d: "M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-title" }, "Update saved"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-desc" }, "Replace an existing artifact")))), o === "update-list" && /* @__PURE__ */ e.createElement("div", null, Ae ? /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__spinner" }), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__loading-text" }, "Loading artifacts...")) : ke.length === 0 ? /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__empty" }, "No saved artifacts of this type") : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__artifact-list" }, ke.map((c) => {
1269
+ ), ne && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__header" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__title" }, o === "success" ? $e ? "Artifact updated!" : "Link created!" : o === "update-list" ? "Update saved artifact" : "Share Artifact"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__close", onClick: xt }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__body" }, o === "loading" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__spinner" }), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__loading-text" }, "Creating link...")), o === "error" && /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__error" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__error-text" }, Ne)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__actions" }, /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__btn artifactuse-share-popup__btn--secondary", onClick: () => _("options") }, "Back"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__btn artifactuse-share-popup__btn--primary", onClick: Ct }, "Retry"))), o === "options" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__options" }, /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__option", onClick: Re }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }), /* @__PURE__ */ e.createElement("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-title" }, "Share link"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-desc" }, "Expires in 30 days"))), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__option", onClick: lt }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" }), /* @__PURE__ */ e.createElement("polyline", { points: "17 21 17 13 7 13 7 21" }), /* @__PURE__ */ e.createElement("polyline", { points: "7 3 7 8 15 8" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-title" }, "Save to account"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-desc" }, "Permanent, manageable"))), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__option", onClick: Lt }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "23 4 23 10 17 10" }), /* @__PURE__ */ e.createElement("polyline", { points: "1 20 1 14 7 14" }), /* @__PURE__ */ e.createElement("path", { d: "M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-title" }, "Update saved"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-desc" }, "Replace an existing artifact")))), o === "update-list" && /* @__PURE__ */ e.createElement("div", null, Ae ? /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__spinner" }), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__loading-text" }, "Loading artifacts...")) : ke.length === 0 ? /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__empty" }, "No saved artifacts of this type") : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__artifact-list" }, ke.map((l) => {
1266
1270
  var C, R, z;
1267
1271
  return /* @__PURE__ */ e.createElement(
1268
1272
  "button",
1269
1273
  {
1270
- key: ((C = c.project) == null ? void 0 : C.uuid) || c.id,
1274
+ key: ((C = l.project) == null ? void 0 : C.uuid) || l.id,
1271
1275
  className: "artifactuse-share-popup__artifact-item",
1272
- onClick: () => Pt(c)
1276
+ onClick: () => Pt(l)
1273
1277
  },
1274
- /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-name" }, ((R = c.project) == null ? void 0 : R.name) || "Untitled"),
1275
- /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-date" }, nt((z = c.project) == null ? void 0 : z.created_at))
1278
+ /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-name" }, ((R = l.project) == null ? void 0 : R.name) || "Untitled"),
1279
+ /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-date" }, nt((z = l.project) == null ? void 0 : z.created_at))
1276
1280
  );
1277
1281
  })), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__back-btn", onClick: () => _("options") }, "Back")), o === "success" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__success" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__success-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "20 6 9 17 4 12" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__link-wrapper" }, /* @__PURE__ */ e.createElement(
1278
1282
  "input",
@@ -1281,7 +1285,7 @@ function pa({
1281
1285
  className: "artifactuse-share-popup__link",
1282
1286
  value: y,
1283
1287
  readOnly: !0,
1284
- onClick: (c) => c.target.select()
1288
+ onClick: (l) => l.target.select()
1285
1289
  }
1286
1290
  ), /* @__PURE__ */ e.createElement(
1287
1291
  "button",
@@ -1323,21 +1327,21 @@ function pa({
1323
1327
  onClick: () => O(!1)
1324
1328
  },
1325
1329
  /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" }))
1326
- )), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list-items" }, L.map((c, C) => /* @__PURE__ */ e.createElement(
1330
+ )), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list-items" }, L.map((l, C) => /* @__PURE__ */ e.createElement(
1327
1331
  "button",
1328
1332
  {
1329
- key: c.id,
1330
- className: `artifactuse-panel__artifact-item ${c.id === a.id ? "artifactuse-panel__artifact-item--active" : ""}`,
1331
- onClick: () => ct(c)
1333
+ key: l.id,
1334
+ className: `artifactuse-panel__artifact-item ${l.id === a.id ? "artifactuse-panel__artifact-item--active" : ""}`,
1335
+ onClick: () => ct(l)
1332
1336
  },
1333
1337
  /* @__PURE__ */ e.createElement(
1334
1338
  "span",
1335
1339
  {
1336
1340
  className: "artifactuse-panel__artifact-item-icon",
1337
- dangerouslySetInnerHTML: { __html: et(c.language) }
1341
+ dangerouslySetInnerHTML: { __html: et(l.language) }
1338
1342
  }
1339
1343
  ),
1340
- /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-title" }, c.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-meta" }, Te(c.language), c.lineCount && ` • ${c.lineCount} lines`)),
1344
+ /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-title" }, l.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-meta" }, Te(l.language), l.lineCount && ` • ${l.lineCount} lines`)),
1341
1345
  /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-index" }, C + 1)
1342
1346
  )))))))
1343
1347
  )) : /* @__PURE__ */ e.createElement("div", { className: je, style: s.isFullscreen ? void 0 : { width: `${Ge}%` } }, !s.isFullscreen && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle", onMouseDown: qe }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle-line" })), /* @__PURE__ */ e.createElement("header", { className: "artifactuse-panel__header artifactuse-panel__header--simple" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "16 18 22 12 16 6" }), /* @__PURE__ */ e.createElement("polyline", { points: "8 6 2 12 8 18" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__name" }, "Artifacts"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__meta" }, L.length, " available"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
@@ -1357,21 +1361,21 @@ function pa({
1357
1361
  onClick: N
1358
1362
  },
1359
1363
  /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" }))
1360
- ))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-items" }, L.map((c, C) => /* @__PURE__ */ e.createElement(
1364
+ ))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-items" }, L.map((l, C) => /* @__PURE__ */ e.createElement(
1361
1365
  "button",
1362
1366
  {
1363
- key: c.id,
1367
+ key: l.id,
1364
1368
  className: "artifactuse-panel__list-item",
1365
- onClick: () => ct(c)
1369
+ onClick: () => ct(l)
1366
1370
  },
1367
1371
  /* @__PURE__ */ e.createElement(
1368
1372
  "span",
1369
1373
  {
1370
1374
  className: "artifactuse-panel__list-item-icon",
1371
- dangerouslySetInnerHTML: { __html: et(c.language) }
1375
+ dangerouslySetInnerHTML: { __html: et(l.language) }
1372
1376
  }
1373
1377
  ),
1374
- /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-title" }, c.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-meta" }, Te(c.language), c.lineCount && ` • ${c.lineCount} lines`)),
1378
+ /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-title" }, l.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-meta" }, Te(l.language), l.lineCount && ` • ${l.lineCount} lines`)),
1375
1379
  /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-arrow" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "9 18 15 12 9 6" })))
1376
1380
  )))), /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer artifactuse-panel__footer--simple" }, We && /* @__PURE__ */ e.createElement(
1377
1381
  "a",
@@ -1404,7 +1408,7 @@ function pa({
1404
1408
  )));
1405
1409
  }
1406
1410
  function fa({ className: t = "" }) {
1407
- const { state: r, artifactCount: l, hasArtifacts: n, togglePanel: s } = _e(), a = T(() => l > 99 ? "99+" : String(l), [l]), E = [
1411
+ const { state: r, artifactCount: c, hasArtifacts: n, togglePanel: s } = _e(), a = T(() => c > 99 ? "99+" : String(c), [c]), E = [
1408
1412
  "artifactuse-panel-toggle",
1409
1413
  r.isPanelOpen && "artifactuse-panel-toggle--active",
1410
1414
  n && "artifactuse-panel-toggle--has-artifacts",
@@ -1418,14 +1422,14 @@ function fa({ className: t = "" }) {
1418
1422
  title: r.isPanelOpen ? "Close artifacts panel" : "Open artifacts panel"
1419
1423
  },
1420
1424
  /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ e.createElement("polyline", { points: "16 18 22 12 16 6" }), /* @__PURE__ */ e.createElement("polyline", { points: "8 6 2 12 8 18" })),
1421
- l > 0 && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel-toggle-badge" }, a)
1425
+ c > 0 && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel-toggle-badge" }, a)
1422
1426
  );
1423
1427
  }
1424
1428
  const pt = Ht(null);
1425
1429
  function la({ children: t, config: r = {} }) {
1426
- const l = W(null);
1427
- l.current || (l.current = Wt(r));
1428
- const n = l.current, [s, a] = b({
1430
+ const c = W(null);
1431
+ c.current || (c.current = Wt(r));
1432
+ const n = c.current, [s, a] = b({
1429
1433
  artifacts: [],
1430
1434
  activeArtifactId: null,
1431
1435
  isPanelOpen: !1,
@@ -1467,6 +1471,7 @@ function la({ children: t, config: r = {} }) {
1467
1471
  openArtifact: n.openArtifact,
1468
1472
  openFile: n.openFile,
1469
1473
  openCode: n.openCode,
1474
+ updateFile: n.updateFile,
1470
1475
  closePanel: n.closePanel,
1471
1476
  togglePanel: n.togglePanel,
1472
1477
  toggleFullscreen: n.toggleFullscreen,
@@ -1508,22 +1513,22 @@ function _e() {
1508
1513
  return t;
1509
1514
  }
1510
1515
  function ca(t, r) {
1511
- const { on: l, off: n } = _e();
1516
+ const { on: c, off: n } = _e();
1512
1517
  q(() => {
1513
- const s = l(t, r);
1518
+ const s = c(t, r);
1514
1519
  return () => {
1515
1520
  typeof s == "function" ? s() : n(t, r);
1516
1521
  };
1517
- }, [t, r, l, n]);
1522
+ }, [t, r, c, n]);
1518
1523
  }
1519
1524
  function ia() {
1520
1525
  const {
1521
1526
  registerPanel: t,
1522
1527
  unregisterPanel: r,
1523
- hasPanel: l,
1528
+ hasPanel: c,
1524
1529
  panelTypes: n,
1525
1530
  instance: s
1526
- } = _e(), a = d((p) => l({ type: p }), [l]), E = d((p, N = {}) => {
1531
+ } = _e(), a = d((p) => c({ type: p }), [c]), E = d((p, N = {}) => {
1527
1532
  var i;
1528
1533
  return ((i = s.panelResolver) == null ? void 0 : i.resolve(p, N)) || null;
1529
1534
  }, [s]);