artifactuse 0.1.21 → 0.1.22

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,29 +1,29 @@
1
- import e, { useState as N, useMemo as S, useCallback as d, useRef as z, useEffect as R, createContext as Pt, useContext as Tt } from "react";
2
- import { g as Ae, f as ct, a as Xe, b as Ze, n as Mt, i as St, D as it, c as At } from "../index-ZmmxlD3v.js";
3
- import { J as $t } from "../jszip.min-CdmYyw5L.js";
4
- import { createPortal as Ht } from "react-dom";
5
- function It({
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-CQXV7Rft.js";
3
+ import { J as Vt } from "../jszip.min-CdmYyw5L.js";
4
+ import { createPortal as zt } from "react-dom";
5
+ function Rt({
6
6
  artifact: t,
7
- isActive: a = !1,
7
+ isActive: r = !1,
8
8
  onOpen: l,
9
9
  onCopy: n,
10
10
  onDownload: s,
11
- className: r = ""
11
+ className: a = ""
12
12
  }) {
13
- const [E, p] = N(!1), y = S(() => Ae(t.language), [t.language]), i = S(() => {
14
- var w;
15
- return ct(t.size || ((w = t.code) == null ? void 0 : w.length) || 0);
16
- }, [t.size, t.code]), x = S(() => Xe(t.language), [t.language]), A = d((w) => {
17
- w.stopPropagation(), l && l(t);
18
- }, [t, l]), L = d(async (w) => {
19
- w.stopPropagation();
13
+ const [E, p] = b(!1), N = T(() => Te(t.language), [t.language]), i = T(() => {
14
+ var x;
15
+ return ut(t.size || ((x = t.code) == null ? void 0 : x.length) || 0);
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) => {
19
+ x.stopPropagation();
20
20
  try {
21
21
  await navigator.clipboard.writeText(t.code), p(!0), n && n(t), setTimeout(() => {
22
22
  p(!1);
23
23
  }, 2e3);
24
24
  } catch {
25
- const v = document.createElement("textarea");
26
- v.value = t.code, v.style.position = "fixed", v.style.opacity = "0", document.body.appendChild(v), v.select();
25
+ const h = document.createElement("textarea");
26
+ h.value = t.code, h.style.position = "fixed", h.style.opacity = "0", document.body.appendChild(h), h.select();
27
27
  try {
28
28
  document.execCommand("copy"), p(!0), n && n(t), setTimeout(() => {
29
29
  p(!1);
@@ -31,33 +31,33 @@ function It({
31
31
  } catch (B) {
32
32
  console.error("Failed to copy:", B);
33
33
  }
34
- document.body.removeChild(v);
34
+ document.body.removeChild(h);
35
35
  }
36
- }, [t, n]), u = d((w) => {
37
- var T;
38
- w.stopPropagation();
39
- const f = new Blob([t.code], { type: "text/plain" }), v = URL.createObjectURL(f), B = document.createElement("a"), O = Ze(t.language), D = ((T = t.title) == null ? void 0 : T.replace(/[^a-z0-9]/gi, "_").toLowerCase()) || "code";
40
- B.href = v, B.download = `${D}.${O}`, document.body.appendChild(B), B.click(), document.body.removeChild(B), URL.revokeObjectURL(v), s && s(t);
41
- }, [t, s]), h = [
36
+ }, [t, n]), m = d((x) => {
37
+ var M;
38
+ x.stopPropagation();
39
+ const f = new Blob([t.code], { type: "text/plain" }), h = URL.createObjectURL(f), B = document.createElement("a"), U = Ye(t.language), $ = ((M = t.title) == null ? void 0 : M.replace(/[^a-z0-9]/gi, "_").toLowerCase()) || "code";
40
+ B.href = h, B.download = `${$}.${U}`, document.body.appendChild(B), B.click(), document.body.removeChild(B), URL.revokeObjectURL(h), s && s(t);
41
+ }, [t, s]), g = [
42
42
  "artifactuse-card",
43
- a && "artifactuse-card--active",
44
- r
43
+ r && "artifactuse-card--active",
44
+ a
45
45
  ].filter(Boolean).join(" ");
46
- return /* @__PURE__ */ e.createElement("div", { className: h, onClick: A }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__icon" }, /* @__PURE__ */ e.createElement(
46
+ return /* @__PURE__ */ e.createElement("div", { className: g, onClick: S }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__icon" }, /* @__PURE__ */ e.createElement(
47
47
  "svg",
48
48
  {
49
49
  viewBox: "0 0 24 24",
50
50
  fill: "none",
51
51
  stroke: "currentColor",
52
52
  strokeWidth: "1.5",
53
- dangerouslySetInnerHTML: { __html: x }
53
+ dangerouslySetInnerHTML: { __html: w }
54
54
  }
55
- )), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__content" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__title" }, t.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__meta" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__type" }, y), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__separator" }, "•"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__size" }, i))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__actions" }, /* @__PURE__ */ e.createElement(
55
+ )), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__content" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__title" }, t.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__meta" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__type" }, N), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__separator" }, "•"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__size" }, i))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__actions" }, /* @__PURE__ */ e.createElement(
56
56
  "button",
57
57
  {
58
58
  className: "artifactuse-card__action",
59
59
  title: E ? "Copied!" : "Copy code",
60
- onClick: L
60
+ onClick: P
61
61
  },
62
62
  E ? /* @__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("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }), /* @__PURE__ */ e.createElement("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }))
63
63
  ), /* @__PURE__ */ e.createElement(
@@ -65,146 +65,146 @@ function It({
65
65
  {
66
66
  className: "artifactuse-card__action",
67
67
  title: "Download file",
68
- onClick: u
68
+ onClick: m
69
69
  },
70
70
  /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), /* @__PURE__ */ e.createElement("polyline", { points: "7 10 12 15 17 10" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "15", x2: "12", y2: "3" }))
71
71
  )), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__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" }))));
72
72
  }
73
- function Bt(t) {
73
+ function qt(t) {
74
74
  if (!t) return null;
75
- const a = t.trim();
76
- if (a.startsWith("#")) {
77
- let s = a.slice(1);
78
- if (s.length === 3 && (s = s.split("").map((r) => r + r).join("")), s.length === 6) {
79
- const r = parseInt(s.slice(0, 2), 16), E = parseInt(s.slice(2, 4), 16), p = parseInt(s.slice(4, 6), 16);
80
- if (!isNaN(r) && !isNaN(E) && !isNaN(p)) return `${r}, ${E}, ${p}`;
75
+ const r = t.trim();
76
+ if (r.startsWith("#")) {
77
+ let s = r.slice(1);
78
+ if (s.length === 3 && (s = s.split("").map((a) => a + a).join("")), s.length === 6) {
79
+ const a = parseInt(s.slice(0, 2), 16), E = parseInt(s.slice(2, 4), 16), p = parseInt(s.slice(4, 6), 16);
80
+ if (!isNaN(a) && !isNaN(E) && !isNaN(p)) return `${a}, ${E}, ${p}`;
81
81
  }
82
82
  }
83
- const l = a.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
83
+ const l = r.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
84
84
  if (l) return `${l[1]}, ${l[2]}, ${l[3]}`;
85
- const n = a.split(/[\s,]+/).map(Number).filter((s) => !isNaN(s));
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
  }
88
- function nt(t) {
89
- return t ? t.map((a) => typeof a == "string" ? { label: a, value: a } : a) : [];
88
+ function ot(t) {
89
+ return t ? t.map((r) => typeof r == "string" ? { label: r, value: r } : r) : [];
90
90
  }
91
- function Ft(t) {
91
+ function Dt(t) {
92
92
  return ["text", "email", "password", "tel", "url", "number", "date", "time", "datetime-local"].includes(t);
93
93
  }
94
- function Wt({
94
+ function Ut({
95
95
  artifact: t,
96
- onSubmit: a,
96
+ onSubmit: r,
97
97
  onCancel: l,
98
98
  onReset: n,
99
99
  onButtonClick: s,
100
- className: r = "",
100
+ className: a = "",
101
101
  theme: E = "dark",
102
102
  accent: p = null,
103
- initialState: y = "active"
103
+ initialState: N = "active"
104
104
  // 'active' | 'submitted' | 'cancelled' | 'inactive'
105
105
  }) {
106
- var ce, X, M;
107
- const i = z(null), [x, A] = N(y), L = x !== "active", u = x === "active" ? "" : `artifactuse-form--${x}`, h = S(() => {
106
+ var de, ne, le;
107
+ const i = W(null), [w, S] = b(N), P = w !== "active", m = w === "active" ? "" : `artifactuse-form--${w}`, g = T(() => {
108
108
  try {
109
109
  return JSON.parse(t.code);
110
110
  } catch {
111
111
  return { title: "Invalid Form", variant: "fields", data: { fields: [] } };
112
112
  }
113
- }, [t.code]), w = t.id || h.id || `form-${Date.now()}`, f = ((ce = h.data) == null ? void 0 : ce.fields) || [], v = h.title || "Form", B = S(() => f.some((o) => o.type === "buttons"), [f]), O = S(() => h.variant === "buttons" ? f : [], [h.variant, f]), [D, T] = N(() => {
114
- var P;
113
+ }, [t.code]), x = t.id || g.id || `form-${Date.now()}`, f = ((de = g.data) == null ? void 0 : de.fields) || [], h = g.title || "Form", B = T(() => f.some((o) => o.type === "buttons"), [f]), U = T(() => g.variant === "buttons" ? f : [], [g.variant, f]), [$, M] = b(() => {
114
+ var _;
115
115
  const o = {};
116
- return f.forEach((_) => {
117
- ["buttons", "divider", "heading"].includes(_.type) || (_.defaultValue !== void 0 ? o[_.name] = _.defaultValue : _.type === "checkbox" ? o[_.name] = !1 : o[_.name] = "");
118
- }), (P = h.data) != null && P.defaults && Object.assign(o, h.data.defaults), o;
119
- }), [Z, Q] = N({}), [J, me] = N(!1);
120
- R(() => {
121
- A(y);
122
- }, [y]), R(() => {
123
- var P;
116
+ return f.forEach((y) => {
117
+ ["buttons", "divider", "heading"].includes(y.type) || (y.defaultValue !== void 0 ? o[y.name] = y.defaultValue : y.type === "checkbox" ? o[y.name] = !1 : o[y.name] = "");
118
+ }), (_ = g.data) != null && _.defaults && Object.assign(o, g.data.defaults), o;
119
+ }), [Y, Q] = b({}), [O, me] = b(!1);
120
+ q(() => {
121
+ S(N);
122
+ }, [N]), q(() => {
123
+ var _;
124
124
  const o = {};
125
- f.forEach((_) => {
126
- ["buttons", "divider", "heading"].includes(_.type) || (_.defaultValue !== void 0 ? o[_.name] = _.defaultValue : _.type === "checkbox" ? o[_.name] = !1 : o[_.name] = "");
127
- }), (P = h.data) != null && P.defaults && Object.assign(o, h.data.defaults), T(o), Q({});
128
- }, [t.code]), R(() => {
125
+ f.forEach((y) => {
126
+ ["buttons", "divider", "heading"].includes(y.type) || (y.defaultValue !== void 0 ? o[y.name] = y.defaultValue : y.type === "checkbox" ? o[y.name] = !1 : o[y.name] = "");
127
+ }), (_ = g.data) != null && _.defaults && Object.assign(o, g.data.defaults), M(o), Q({});
128
+ }, [t.code]), q(() => {
129
129
  if (i.current && (i.current.setAttribute("data-artifactuse-theme", E), p)) {
130
- const o = Bt(p);
130
+ const o = qt(p);
131
131
  o && i.current.style.setProperty("--artifactuse-primary", o);
132
132
  }
133
133
  }, [E, p]);
134
- const te = d((o) => {
135
- A(o);
136
- }, []), he = d((o, P) => {
137
- T((_) => ({ ..._, [o]: P })), Q((_) => {
138
- const b = { ..._ };
139
- return delete b[o], b;
134
+ const K = d((o) => {
135
+ S(o);
136
+ }, []), Ee = d((o, _) => {
137
+ M((y) => ({ ...y, [o]: _ })), Q((y) => {
138
+ const k = { ...y };
139
+ return delete k[o], k;
140
140
  });
141
- }, []), ne = d(() => {
142
- var _;
141
+ }, []), re = d(() => {
142
+ var y;
143
143
  const o = {};
144
- f.forEach((b) => {
145
- if (["buttons", "divider", "heading"].includes(b.type)) return;
146
- const I = D[b.name];
147
- if (b.required && !I && I !== 0 && I !== !1) {
148
- o[b.name] = `${b.label || "This field"} is required`;
144
+ f.forEach((k) => {
145
+ if (["buttons", "divider", "heading"].includes(k.type)) return;
146
+ const H = $[k.name];
147
+ if (k.required && !H && H !== 0 && H !== !1) {
148
+ o[k.name] = `${k.label || "This field"} is required`;
149
149
  return;
150
150
  }
151
- if (b.pattern && I && !new RegExp(b.pattern).test(I)) {
152
- o[b.name] = b.patternMessage || `${b.label || "This field"} is invalid`;
151
+ if (k.pattern && H && !new RegExp(k.pattern).test(H)) {
152
+ o[k.name] = k.patternMessage || `${k.label || "This field"} is invalid`;
153
153
  return;
154
154
  }
155
- if (b.type === "email" && I && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(I)) {
156
- o[b.name] = "Please enter a valid email address";
155
+ if (k.type === "email" && H && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(H)) {
156
+ o[k.name] = "Please enter a valid email address";
157
157
  return;
158
158
  }
159
- if (b.minLength && I && I.length < b.minLength) {
160
- o[b.name] = `Minimum ${b.minLength} characters required`;
159
+ if (k.minLength && H && H.length < k.minLength) {
160
+ o[k.name] = `Minimum ${k.minLength} characters required`;
161
161
  return;
162
162
  }
163
- if (b.maxLength && I && I.length > b.maxLength) {
164
- o[b.name] = `Maximum ${b.maxLength} characters allowed`;
163
+ if (k.maxLength && H && H.length > k.maxLength) {
164
+ o[k.name] = `Maximum ${k.maxLength} characters allowed`;
165
165
  return;
166
166
  }
167
167
  });
168
- const P = (_ = h.data) == null ? void 0 : _.validation;
169
- return P && Object.entries(P).forEach(([b, I]) => {
170
- if (o[b]) return;
171
- const W = D[b];
172
- I.pattern && W && (new RegExp(I.pattern).test(W) || (o[b] = I.message || `${b} is invalid`));
168
+ const _ = (y = g.data) == null ? void 0 : y.validation;
169
+ return _ && Object.entries(_).forEach(([k, H]) => {
170
+ if (o[k]) return;
171
+ const X = $[k];
172
+ H.pattern && X && (new RegExp(H.pattern).test(X) || (o[k] = H.message || `${k} is invalid`));
173
173
  }), Q(o), Object.keys(o).length === 0;
174
- }, [f, D, (X = h.data) == null ? void 0 : X.validation]), K = d(() => {
175
- var P;
174
+ }, [f, $, (ne = g.data) == null ? void 0 : ne.validation]), ue = d(() => {
175
+ var _;
176
176
  const o = {};
177
- f.forEach((_) => {
178
- ["buttons", "divider", "heading"].includes(_.type) || (_.defaultValue !== void 0 ? o[_.name] = _.defaultValue : _.type === "checkbox" ? o[_.name] = !1 : o[_.name] = "");
179
- }), (P = h.data) != null && P.defaults && Object.assign(o, h.data.defaults), T(o), Q({});
180
- }, [f, (M = h.data) == null ? void 0 : M.defaults]), le = d((o) => {
181
- o == null || o.preventDefault(), ne() && (me(!0), a == null || a({
182
- formId: w,
177
+ f.forEach((y) => {
178
+ ["buttons", "divider", "heading"].includes(y.type) || (y.defaultValue !== void 0 ? o[y.name] = y.defaultValue : y.type === "checkbox" ? o[y.name] = !1 : o[y.name] = "");
179
+ }), (_ = g.data) != null && _.defaults && Object.assign(o, g.data.defaults), M(o), Q({});
180
+ }, [f, (le = g.data) == null ? void 0 : le.defaults]), se = d((o) => {
181
+ o == null || o.preventDefault(), re() && (me(!0), r == null || r({
182
+ formId: x,
183
183
  action: "submit",
184
- values: { ...D },
184
+ values: { ...$ },
185
185
  timestamp: Date.now()
186
186
  }), setTimeout(() => {
187
- me(!1), te("submitted");
187
+ me(!1), K("submitted");
188
188
  }, 300));
189
- }, [w, D, a, ne, te]), G = d((o) => {
190
- const P = o.action || "custom";
191
- switch (P) {
189
+ }, [x, $, r, re, K]), J = d((o) => {
190
+ const _ = o.action || "custom";
191
+ switch (_) {
192
192
  case "submit":
193
- le();
193
+ se();
194
194
  break;
195
195
  case "cancel":
196
196
  l == null || l({
197
- formId: w,
197
+ formId: x,
198
198
  action: "cancel",
199
199
  buttonName: o.name || "cancel",
200
200
  timestamp: Date.now()
201
201
  }), setTimeout(() => {
202
- te("cancelled");
202
+ K("cancelled");
203
203
  }, 150);
204
204
  break;
205
205
  case "reset":
206
- K(), n == null || n({
207
- formId: w,
206
+ ue(), n == null || n({
207
+ formId: x,
208
208
  action: "reset",
209
209
  buttonName: o.name || "reset",
210
210
  timestamp: Date.now()
@@ -213,42 +213,42 @@ function Wt({
213
213
  case "custom":
214
214
  default:
215
215
  s == null || s({
216
- formId: w,
217
- action: P,
216
+ formId: x,
217
+ action: _,
218
218
  buttonName: o.name || o.label,
219
219
  buttonLabel: o.label,
220
- values: { ...D },
220
+ values: { ...$ },
221
221
  timestamp: Date.now()
222
222
  }), setTimeout(() => {
223
- te("submitted");
223
+ K("submitted");
224
224
  }, 150);
225
225
  break;
226
226
  }
227
- }, [w, D, le, l, n, s, K, te]);
228
- return L ? /* @__PURE__ */ e.createElement(
227
+ }, [x, $, se, l, n, s, ue, K]);
228
+ return P ? /* @__PURE__ */ e.createElement(
229
229
  "div",
230
230
  {
231
231
  ref: i,
232
- className: `artifactuse-inline-form artifactuse-form-${h.variant || "fields"} ${u} ${r}`,
232
+ className: `artifactuse-inline-form artifactuse-form-${g.variant || "fields"} ${m} ${a}`,
233
233
  "data-artifactuse-theme": E
234
234
  },
235
- /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-collapsed" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-collapsed-icon" }, x === "submitted" && /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ e.createElement("polyline", { points: "20 6 9 17 4 12" })), x === "cancelled" && /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })), x === "inactive" && /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ e.createElement("line", { x1: "5", y1: "12", x2: "19", y2: "12" }))), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-collapsed-title" }, v))
236
- ) : h.variant === "buttons" ? /* @__PURE__ */ e.createElement(
235
+ /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-collapsed" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-collapsed-icon" }, w === "submitted" && /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ e.createElement("polyline", { points: "20 6 9 17 4 12" })), w === "cancelled" && /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })), w === "inactive" && /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ e.createElement("line", { x1: "5", y1: "12", x2: "19", y2: "12" }))), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-collapsed-title" }, h))
236
+ ) : g.variant === "buttons" ? /* @__PURE__ */ e.createElement(
237
237
  "div",
238
238
  {
239
239
  ref: i,
240
- className: `artifactuse-inline-form artifactuse-form-buttons ${r}`,
240
+ className: `artifactuse-inline-form artifactuse-form-buttons ${a}`,
241
241
  "data-artifactuse-theme": E
242
242
  },
243
- (h.title || h.description) && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-header" }, h.title && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-title" }, h.title), h.description && /* @__PURE__ */ e.createElement("p", { className: "artifactuse-form-description" }, h.description)),
244
- /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, O.map((o, P) => /* @__PURE__ */ e.createElement(
243
+ (g.title || g.description) && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-header" }, g.title && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-title" }, g.title), g.description && /* @__PURE__ */ e.createElement("p", { className: "artifactuse-form-description" }, g.description)),
244
+ /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, U.map((o, _) => /* @__PURE__ */ e.createElement(
245
245
  "button",
246
246
  {
247
- key: o.name || o.label || P,
247
+ key: o.name || o.label || _,
248
248
  type: "button",
249
249
  className: `artifactuse-form-btn artifactuse-form-btn-${o.variant || "secondary"}`,
250
- onClick: () => G(o),
251
- disabled: o.disabled || J
250
+ onClick: () => J(o),
251
+ disabled: o.disabled || O
252
252
  },
253
253
  o.icon && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-btn-icon", dangerouslySetInnerHTML: { __html: o.icon } }),
254
254
  o.label
@@ -257,28 +257,28 @@ function Wt({
257
257
  "div",
258
258
  {
259
259
  ref: i,
260
- className: `artifactuse-inline-form artifactuse-form-fields ${r}`,
260
+ className: `artifactuse-inline-form artifactuse-form-fields ${a}`,
261
261
  "data-artifactuse-theme": E
262
262
  },
263
- (h.title || h.description) && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-header" }, h.title && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-title" }, h.title), h.description && /* @__PURE__ */ e.createElement("p", { className: "artifactuse-form-description" }, h.description)),
264
- /* @__PURE__ */ e.createElement("form", { onSubmit: le, className: "artifactuse-form" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-fields" }, f.map((o, P) => /* @__PURE__ */ e.createElement(
265
- Vt,
263
+ (g.title || g.description) && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-header" }, g.title && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-title" }, g.title), g.description && /* @__PURE__ */ e.createElement("p", { className: "artifactuse-form-description" }, g.description)),
264
+ /* @__PURE__ */ e.createElement("form", { onSubmit: se, className: "artifactuse-form" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-fields" }, f.map((o, _) => /* @__PURE__ */ e.createElement(
265
+ jt,
266
266
  {
267
- key: o.name || P,
267
+ key: o.name || _,
268
268
  field: o,
269
- formId: w,
270
- value: D[o.name],
271
- error: Z[o.name],
272
- isSubmitting: J,
273
- onChange: (_) => he(o.name, _),
274
- onButtonAction: G
269
+ formId: x,
270
+ value: $[o.name],
271
+ error: Y[o.name],
272
+ isSubmitting: O,
273
+ onChange: (y) => Ee(o.name, y),
274
+ onButtonAction: J
275
275
  }
276
276
  ))), !B && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons artifactuse-form-buttons-default" }, /* @__PURE__ */ e.createElement(
277
277
  "button",
278
278
  {
279
279
  type: "button",
280
280
  className: "artifactuse-form-btn artifactuse-form-btn-ghost",
281
- onClick: () => G({ action: "cancel", label: "Cancel" })
281
+ onClick: () => J({ action: "cancel", label: "Cancel" })
282
282
  },
283
283
  "Cancel"
284
284
  ), /* @__PURE__ */ e.createElement(
@@ -286,20 +286,20 @@ function Wt({
286
286
  {
287
287
  type: "submit",
288
288
  className: "artifactuse-form-btn artifactuse-form-btn-primary",
289
- disabled: J
289
+ disabled: O
290
290
  },
291
- J && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-btn-spinner" }),
292
- J ? "Submitting..." : "Submit"
291
+ O && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-btn-spinner" }),
292
+ O ? "Submitting..." : "Submit"
293
293
  )))
294
294
  );
295
295
  }
296
- function Vt({ field: t, formId: a, value: l, error: n, isSubmitting: s, onChange: r, onButtonAction: E }) {
297
- const p = `${a}-${t.name}`;
296
+ function jt({ field: t, formId: r, value: l, error: n, isSubmitting: s, onChange: a, onButtonAction: E }) {
297
+ const p = `${r}-${t.name}`;
298
298
  if (t.type === "buttons")
299
- return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, (t.fields || []).map((i, x) => /* @__PURE__ */ e.createElement(
299
+ return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, (t.fields || []).map((i, w) => /* @__PURE__ */ e.createElement(
300
300
  "button",
301
301
  {
302
- key: i.name || i.label || x,
302
+ key: i.name || i.label || w,
303
303
  type: i.action === "submit" ? "submit" : "button",
304
304
  className: `artifactuse-form-btn artifactuse-form-btn-${i.variant || "secondary"}`,
305
305
  onClick: i.action !== "submit" ? () => E(i) : void 0,
@@ -322,11 +322,11 @@ function Vt({ field: t, formId: a, value: l, error: n, isSubmitting: s, onChange
322
322
  checked: l || !1,
323
323
  disabled: t.disabled,
324
324
  className: "artifactuse-checkbox",
325
- onChange: (i) => r(i.target.checked)
325
+ onChange: (i) => a(i.target.checked)
326
326
  }
327
327
  ), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-checkbox-text" }, t.label, t.required && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-required" }, "*"))), t.helpText && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-help-text" }, t.helpText), n && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-error-text" }, n));
328
328
  if (t.type === "radio")
329
- return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-field" }, t.label && /* @__PURE__ */ e.createElement("label", { className: "artifactuse-label" }, t.label, t.required && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-required" }, "*")), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-radio-group" }, nt(t.options).map((i) => /* @__PURE__ */ e.createElement("label", { key: i.value, className: "artifactuse-radio-label" }, /* @__PURE__ */ e.createElement(
329
+ return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-field" }, t.label && /* @__PURE__ */ e.createElement("label", { className: "artifactuse-label" }, t.label, t.required && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-required" }, "*")), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-radio-group" }, ot(t.options).map((i) => /* @__PURE__ */ e.createElement("label", { key: i.value, className: "artifactuse-radio-label" }, /* @__PURE__ */ e.createElement(
330
330
  "input",
331
331
  {
332
332
  type: "radio",
@@ -335,10 +335,10 @@ function Vt({ field: t, formId: a, value: l, error: n, isSubmitting: s, onChange
335
335
  checked: l === i.value,
336
336
  disabled: i.disabled || t.disabled,
337
337
  className: "artifactuse-radio",
338
- onChange: () => r(i.value)
338
+ onChange: () => a(i.value)
339
339
  }
340
340
  ), /* @__PURE__ */ e.createElement("span", null, i.label)))), t.helpText && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-help-text" }, t.helpText), n && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-error-text" }, n));
341
- const y = () => Ft(t.type) ? /* @__PURE__ */ e.createElement(
341
+ const N = () => Dt(t.type) ? /* @__PURE__ */ e.createElement(
342
342
  "input",
343
343
  {
344
344
  type: t.type,
@@ -349,7 +349,7 @@ function Vt({ field: t, formId: a, value: l, error: n, isSubmitting: s, onChange
349
349
  disabled: t.disabled,
350
350
  required: t.required,
351
351
  className: "artifactuse-input",
352
- onChange: (i) => r(t.type === "number" ? Number(i.target.value) : i.target.value)
352
+ onChange: (i) => a(t.type === "number" ? Number(i.target.value) : i.target.value)
353
353
  }
354
354
  ) : t.type === "textarea" ? /* @__PURE__ */ e.createElement(
355
355
  "textarea",
@@ -362,7 +362,7 @@ function Vt({ field: t, formId: a, value: l, error: n, isSubmitting: s, onChange
362
362
  required: t.required,
363
363
  rows: t.rows || 3,
364
364
  className: "artifactuse-textarea",
365
- onChange: (i) => r(i.target.value)
365
+ onChange: (i) => a(i.target.value)
366
366
  }
367
367
  ) : t.type === "select" ? /* @__PURE__ */ e.createElement(
368
368
  "select",
@@ -373,10 +373,10 @@ function Vt({ field: t, formId: a, value: l, error: n, isSubmitting: s, onChange
373
373
  disabled: t.disabled,
374
374
  required: t.required,
375
375
  className: "artifactuse-select",
376
- onChange: (i) => r(i.target.value)
376
+ onChange: (i) => a(i.target.value)
377
377
  },
378
378
  /* @__PURE__ */ e.createElement("option", { value: "" }, t.placeholder || "Select..."),
379
- nt(t.options).map((i) => /* @__PURE__ */ e.createElement("option", { key: i.value, value: i.value, disabled: i.disabled }, i.label))
379
+ ot(t.options).map((i) => /* @__PURE__ */ e.createElement("option", { key: i.value, value: i.value, disabled: i.disabled }, i.label))
380
380
  ) : /* @__PURE__ */ e.createElement(
381
381
  "input",
382
382
  {
@@ -386,12 +386,12 @@ function Vt({ field: t, formId: a, value: l, error: n, isSubmitting: s, onChange
386
386
  value: l || "",
387
387
  disabled: t.disabled,
388
388
  className: "artifactuse-input",
389
- onChange: (i) => r(i.target.value)
389
+ onChange: (i) => a(i.target.value)
390
390
  }
391
391
  );
392
- return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-field" }, /* @__PURE__ */ e.createElement("label", { htmlFor: p, className: "artifactuse-label" }, t.label, t.required && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-required" }, "*")), y(), t.helpText && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-help-text" }, t.helpText), n && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-error-text" }, n));
392
+ return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-field" }, /* @__PURE__ */ e.createElement("label", { htmlFor: p, className: "artifactuse-label" }, t.label, t.required && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-required" }, "*")), N(), t.helpText && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-help-text" }, t.helpText), n && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-error-text" }, n));
393
393
  }
394
- const U = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23888"><circle cx="12" cy="8" r="4"/><path d="M12 14c-6 0-8 3-8 6v2h16v-2c0-3-2-6-8-6z"/></svg>', zt = {
394
+ const D = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23888"><circle cx="12" cy="8" r="4"/><path d="M12 14c-6 0-8 3-8 6v2h16v-2c0-3-2-6-8-6z"/></svg>', Ot = {
395
395
  twitter: 280,
396
396
  linkedin: 3e3,
397
397
  instagram: 2200,
@@ -399,7 +399,7 @@ const U = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0
399
399
  threads: 500,
400
400
  tiktok: 2200,
401
401
  youtube: 100
402
- }, qt = {
402
+ }, Jt = {
403
403
  twitter: "X",
404
404
  linkedin: "LinkedIn",
405
405
  instagram: "Instagram",
@@ -407,130 +407,130 @@ const U = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0
407
407
  threads: "Threads",
408
408
  tiktok: "TikTok",
409
409
  youtube: "YouTube"
410
- }, $e = ({ type: t = "blue" }) => /* @__PURE__ */ e.createElement("svg", { className: `artifactuse-social-verified artifactuse-social-verified-${t}`, viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ e.createElement("path", { d: "M22.25 12c0-1.43-.88-2.67-2.19-3.34.46-1.39.2-2.9-.81-3.91s-2.52-1.27-3.91-.81c-.66-1.31-1.91-2.19-3.34-2.19s-2.67.88-3.34 2.19c-1.39-.46-2.9-.2-3.91.81s-1.27 2.52-.81 3.91C2.63 9.33 1.75 10.57 1.75 12s.88 2.67 2.19 3.34c-.46 1.39-.2 2.9.81 3.91s2.52 1.27 3.91.81c.66 1.31 1.91 2.19 3.34 2.19s2.67-.88 3.34-2.19c1.39.46 2.9.2 3.91-.81s1.27-2.52.81-3.91c1.31-.67 2.19-1.91 2.19-3.34zm-11.71 4.2L6.8 12.46l1.41-1.42 2.26 2.26 4.8-5.23 1.47 1.36-6.2 6.77z" })), F = (t) => t ? t >= 1e6 ? `${(t / 1e6).toFixed(1)}M` : t >= 1e3 ? `${(t / 1e3).toFixed(1)}K` : t.toString() : "0", Ke = (t) => {
410
+ }, Se = ({ type: t = "blue" }) => /* @__PURE__ */ e.createElement("svg", { className: `artifactuse-social-verified artifactuse-social-verified-${t}`, viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ e.createElement("path", { d: "M22.25 12c0-1.43-.88-2.67-2.19-3.34.46-1.39.2-2.9-.81-3.91s-2.52-1.27-3.91-.81c-.66-1.31-1.91-2.19-3.34-2.19s-2.67.88-3.34 2.19c-1.39-.46-2.9-.2-3.91.81s-1.27 2.52-.81 3.91C2.63 9.33 1.75 10.57 1.75 12s.88 2.67 2.19 3.34c-.46 1.39-.2 2.9.81 3.91s2.52 1.27 3.91.81c.66 1.31 1.91 2.19 3.34 2.19s2.67-.88 3.34-2.19c1.39.46 2.9.2 3.91-.81s1.27-2.52.81-3.91c1.31-.67 2.19-1.91 2.19-3.34zm-11.71 4.2L6.8 12.46l1.41-1.42 2.26 2.26 4.8-5.23 1.47 1.36-6.2 6.77z" })), V = (t) => t ? t >= 1e6 ? `${(t / 1e6).toFixed(1)}M` : t >= 1e3 ? `${(t / 1e3).toFixed(1)}K` : t.toString() : "0", Qe = (t) => {
411
411
  try {
412
412
  return new URL(t).hostname.replace("www.", "");
413
413
  } catch {
414
414
  return t;
415
415
  }
416
- }, Ee = (t) => {
416
+ }, ge = (t) => {
417
417
  if (!t) return "";
418
- let a = t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
419
- return a = a.replace(/\n/g, "<br>"), a = a.replace(/#(\w+)/g, '<span class="artifactuse-social-hashtag">#$1</span>'), a = a.replace(/@(\w+)/g, '<span class="artifactuse-social-mention">@$1</span>'), a;
420
- }, lt = ({ author: t, content: a, engagement: l, meta: n }) => {
421
- var E, p, y;
422
- const s = a.media || [], r = l.likes || l.retweets || l.replies || l.views;
423
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || U, alt: t.name, className: "artifactuse-social-avatar", onError: (i) => i.target.src = U }), /* @__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($e, { 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: Ee(a.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, x) => /* @__PURE__ */ e.createElement("img", { key: x, src: i.url, alt: i.alt || "", onError: (A) => A.target.style.display = "none" })))), a.link && !s.length && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, a.link.image && /* @__PURE__ */ e.createElement("img", { src: a.link.image, alt: a.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" }, a.link.domain || Ke(a.link.url)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, a.link.title), a.link.description && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-description" }, a.link.description))), a.poll && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll" }, a.poll.options.map((i, x) => {
424
- var A, L;
425
- return /* @__PURE__ */ e.createElement("div", { key: x, className: "artifactuse-social-poll-option" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-bar", style: { width: `${((A = a.poll.votes) == null ? void 0 : A[x]) || 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" }, ((L = a.poll.votes) == null ? void 0 : L[x]) || 0, "%")));
426
- }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-meta" }, F(a.poll.totalVotes || 0), " votes · ", a.poll.duration || "Poll ended")), a.quote && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-quote" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-quote-header" }, /* @__PURE__ */ e.createElement("img", { src: ((E = a.quote.author) == null ? void 0 : E.avatar) || U, className: "artifactuse-social-quote-avatar", alt: "" }), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-quote-author" }, (p = a.quote.author) == null ? void 0 : p.name), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-quote-handle" }, (y = a.quote.author) == null ? void 0 : y.handle)), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-quote-text" }, a.quote.text))), r && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, F(l.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, F(l.retweets || 0), " reposts"), /* @__PURE__ */ e.createElement("span", null, F(l.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, F(l.views || 0), " views")));
427
- }, Rt = ({ author: t, content: a, engagement: l, meta: n }) => {
418
+ let r = t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
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 }) => {
421
+ var E, p, N;
422
+ const s = r.media || [], a = l.likes || l.retweets || l.replies || l.views;
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
+ var S, P;
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
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 || U, alt: t.name, className: "artifactuse-social-avatar", onError: (r) => r.target.src = U }), /* @__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: Ee(a.text) } }), a.link && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, a.link.image && /* @__PURE__ */ e.createElement("img", { src: a.link.image, alt: a.link.title, className: "artifactuse-social-link-image", onError: (r) => r.target.style.display = "none" }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, a.link.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-domain" }, a.link.domain || Ke(a.link.url))))), s && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, F(l.likes || 0), " reactions"), /* @__PURE__ */ e.createElement("span", null, F(l.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, F(l.shares || l.reposts || 0), " reposts")));
430
- }, Dt = ({ author: t, content: a, engagement: l, meta: n }) => {
431
- const s = a.media || [];
432
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || U, alt: t.name, className: "artifactuse-social-avatar", onError: (r) => r.target.src = U }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement($e, { 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: (r) => r.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media-placeholder" })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-likes" }, F(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: Ee(a.text) } })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-timestamp" }, n.timestamp || "JUST NOW"));
433
- }, Ut = ({ author: t, content: a, engagement: l, meta: n }) => {
434
- const s = a.media || [], r = S(() => {
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 }) => {
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 }) => {
434
+ const s = r.media || [], a = T(() => {
435
435
  const p = l.reactions || {};
436
- return Object.values(p).reduce((y, i) => y + (i || 0), 0) || l.likes || 0;
437
- }, [l]), E = l.likes || l.comments || l.shares || r;
438
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || U, alt: t.name, className: "artifactuse-social-avatar", onError: (p) => p.target.src = U }), /* @__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: Ee(a.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, y) => /* @__PURE__ */ e.createElement("img", { key: y, src: p.url, alt: p.alt || "", onError: (i) => i.target.style.display = "none" })))), a.link && !s.length && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, a.link.image && /* @__PURE__ */ e.createElement("img", { src: a.link.image, alt: a.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" }, a.link.domain || Ke(a.link.url)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, a.link.title)))), E && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, "👍❤️ ", F(r)), /* @__PURE__ */ e.createElement("span", null, F(l.comments || 0), " comments · ", F(l.shares || 0), " shares")));
439
- }, jt = ({ author: t, content: a, engagement: l, meta: n }) => {
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
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 || U, alt: t.name, className: "artifactuse-social-avatar", onError: (r) => r.target.src = U }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement($e, { 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: Ee(a.text) } })), s && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, F(l.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, F(l.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, F(l.reposts || 0), " reposts")));
442
- }, Ot = ({ author: t, content: a, engagement: l, meta: n }) => {
443
- const s = a.media || [], r = 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" }), a.duration && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-duration" }, a.duration)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || U, alt: t.name, className: "artifactuse-social-avatar", onError: (E) => E.target.src = U }), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-author-name" }, "@", t.name), t.verified && /* @__PURE__ */ e.createElement($e, { type: "blue" })), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: Ee(a.text) } }), a.sound && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-sound" }, "🎵 ", a.sound)), r && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, F(l.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, F(l.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, F(l.shares || 0), " shares")));
445
- }, Jt = ({ author: t, content: a, engagement: l, meta: n }) => {
446
- const s = a.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: (r) => r.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail-placeholder" }), a.duration && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-duration" }, a.duration)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-info" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || U, alt: t.name, className: "artifactuse-social-avatar", onError: (r) => r.target.src = U }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-details" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-title" }, a.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-channel" }, t.name), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-meta" }, F(l.views || 0), " views · ", n.timestamp || "Just now"))));
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 }) => {
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"))));
448
448
  };
449
- function Xt({ artifact: t, theme: a = "dark", onCopy: l }) {
450
- const [n, s] = N("Copy"), r = S(() => {
449
+ function ea({ artifact: t, theme: r = "dark", onCopy: l }) {
450
+ const [n, s] = b("Copy"), a = T(() => {
451
451
  try {
452
452
  return JSON.parse(t.code);
453
453
  } catch {
454
454
  return { platform: "twitter", data: {} };
455
455
  }
456
- }, [t.code]), E = (r == null ? void 0 : r.platform) || "twitter", p = (r == null ? void 0 : r.data) || {}, { author: y = {}, content: i = {}, engagement: x = {}, meta: A = {} } = p, L = zt[E] || 280, u = (i.text || "").length, h = u > L ? "error" : u > L * 0.9 ? "warning" : "", w = d(() => {
457
- const v = i.text || "";
458
- navigator.clipboard.writeText(v).then(() => {
459
- s("Copied!"), setTimeout(() => s("Copy"), 2e3), l == null || l({ platform: E, text: v });
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
+ const h = i.text || "";
458
+ navigator.clipboard.writeText(h).then(() => {
459
+ s("Copied!"), setTimeout(() => s("Copy"), 2e3), l == null || l({ platform: E, text: h });
460
460
  });
461
461
  }, [i.text, E, l]), f = () => {
462
- const v = { author: y, content: i, engagement: x, meta: A };
462
+ const h = { author: N, content: i, engagement: w, meta: S };
463
463
  switch (E) {
464
464
  case "twitter":
465
- return /* @__PURE__ */ e.createElement(lt, { ...v });
465
+ return /* @__PURE__ */ e.createElement(mt, { ...h });
466
466
  case "linkedin":
467
- return /* @__PURE__ */ e.createElement(Rt, { ...v });
467
+ return /* @__PURE__ */ e.createElement(Xt, { ...h });
468
468
  case "instagram":
469
- return /* @__PURE__ */ e.createElement(Dt, { ...v });
469
+ return /* @__PURE__ */ e.createElement(Zt, { ...h });
470
470
  case "facebook":
471
- return /* @__PURE__ */ e.createElement(Ut, { ...v });
471
+ return /* @__PURE__ */ e.createElement(Kt, { ...h });
472
472
  case "threads":
473
- return /* @__PURE__ */ e.createElement(jt, { ...v });
473
+ return /* @__PURE__ */ e.createElement(Yt, { ...h });
474
474
  case "tiktok":
475
- return /* @__PURE__ */ e.createElement(Ot, { ...v });
475
+ return /* @__PURE__ */ e.createElement(Qt, { ...h });
476
476
  case "youtube":
477
- return /* @__PURE__ */ e.createElement(Jt, { ...v });
477
+ return /* @__PURE__ */ e.createElement(Gt, { ...h });
478
478
  default:
479
- return /* @__PURE__ */ e.createElement(lt, { ...v });
479
+ return /* @__PURE__ */ e.createElement(mt, { ...h });
480
480
  }
481
481
  };
482
- return /* @__PURE__ */ e.createElement("div", { className: `artifactuse-social artifactuse-social-${E}`, "data-artifactuse-theme": a }, f(), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-actions-bar" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-platform-badge" }, /* @__PURE__ */ e.createElement("span", null, qt[E] || E)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-actions-right" }, /* @__PURE__ */ e.createElement("span", { className: `artifactuse-social-char-counter ${h}` }, u, "/", L), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-social-copy-btn", onClick: w }, n))));
482
+ return /* @__PURE__ */ e.createElement("div", { className: `artifactuse-social artifactuse-social-${E}`, "data-artifactuse-theme": r }, f(), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-actions-bar" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-platform-badge" }, /* @__PURE__ */ e.createElement("span", null, Jt[E] || E)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-actions-right" }, /* @__PURE__ */ e.createElement("span", { className: `artifactuse-social-char-counter ${g}` }, m, "/", P), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-social-copy-btn", onClick: x }, n))));
483
483
  }
484
- function Zt({
484
+ function ta({
485
485
  isOpen: t = !1,
486
- type: a = "image",
486
+ type: r = "image",
487
487
  src: l = "",
488
488
  alt: n = "",
489
489
  caption: s = "",
490
- onClose: r,
490
+ onClose: a,
491
491
  className: E = ""
492
492
  }) {
493
- const p = z(null), [y, i] = N(!1), [x, A] = N(!1);
494
- R(() => (A(!0), () => A(!1)), []), R(() => {
493
+ const p = W(null), [N, i] = b(!1), [w, S] = b(!1);
494
+ q(() => (S(!0), () => S(!1)), []), q(() => {
495
495
  var f;
496
496
  return t ? (document.body.style.overflow = "hidden", (f = p.current) == null || f.focus()) : (document.body.style.overflow = "", i(!1)), () => {
497
497
  document.body.style.overflow = "";
498
498
  };
499
- }, [t]), R(() => {
500
- function f(v) {
501
- v.key === "Escape" && t && r && r();
499
+ }, [t]), q(() => {
500
+ function f(h) {
501
+ h.key === "Escape" && t && a && a();
502
502
  }
503
503
  return document.addEventListener("keydown", f), () => document.removeEventListener("keydown", f);
504
- }, [t, r]);
505
- const L = d(() => {
506
- i(!1), r && r();
507
- }, [r]), u = d(() => {
508
- a === "image" && i((f) => !f);
509
- }, [a]), h = d(() => {
504
+ }, [t, a]);
505
+ const P = d(() => {
506
+ i(!1), a && a();
507
+ }, [a]), m = d(() => {
508
+ r === "image" && i((f) => !f);
509
+ }, [r]), g = d(() => {
510
510
  const f = document.createElement("a");
511
511
  f.href = l, f.download = n || "download", document.body.appendChild(f), f.click(), document.body.removeChild(f);
512
512
  }, [l, n]);
513
- if (!t || !x)
513
+ if (!t || !w)
514
514
  return null;
515
- const w = /* @__PURE__ */ e.createElement(
515
+ const x = /* @__PURE__ */ e.createElement(
516
516
  "div",
517
517
  {
518
518
  ref: p,
519
519
  className: `artifactuse-viewer-overlay ${E}`,
520
- onClick: L,
520
+ onClick: P,
521
521
  tabIndex: -1,
522
522
  role: "dialog",
523
523
  "aria-modal": "true"
524
524
  },
525
- /* @__PURE__ */ e.createElement("div", { className: "artifactuse-viewer-content", onClick: (f) => f.stopPropagation() }, a === "image" && /* @__PURE__ */ e.createElement(
525
+ /* @__PURE__ */ e.createElement("div", { className: "artifactuse-viewer-content", onClick: (f) => f.stopPropagation() }, r === "image" && /* @__PURE__ */ e.createElement(
526
526
  "img",
527
527
  {
528
528
  src: l,
529
529
  alt: n,
530
- className: `artifactuse-viewer-image ${y ? "artifactuse-viewer-image--zoomed" : ""}`,
531
- onClick: u
530
+ className: `artifactuse-viewer-image ${N ? "artifactuse-viewer-image--zoomed" : ""}`,
531
+ onClick: m
532
532
  }
533
- ), a === "pdf" && /* @__PURE__ */ e.createElement(
533
+ ), r === "pdf" && /* @__PURE__ */ e.createElement(
534
534
  "iframe",
535
535
  {
536
536
  src: l,
@@ -541,35 +541,35 @@ function Zt({
541
541
  "button",
542
542
  {
543
543
  className: "artifactuse-viewer-close",
544
- onClick: L,
544
+ onClick: P,
545
545
  title: "Close (Esc)"
546
546
  },
547
547
  /* @__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" }))
548
- ), a === "image" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-viewer-controls" }, /* @__PURE__ */ e.createElement(
548
+ ), r === "image" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-viewer-controls" }, /* @__PURE__ */ e.createElement(
549
549
  "button",
550
550
  {
551
551
  className: "artifactuse-viewer-control",
552
- onClick: u,
553
- title: y ? "Zoom out" : "Zoom in"
552
+ onClick: m,
553
+ title: N ? "Zoom out" : "Zoom in"
554
554
  },
555
- y ? /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "11", cy: "11", r: "8" }), /* @__PURE__ */ e.createElement("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }), /* @__PURE__ */ e.createElement("line", { x1: "8", y1: "11", x2: "14", y2: "11" })) : /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "11", cy: "11", r: "8" }), /* @__PURE__ */ e.createElement("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }), /* @__PURE__ */ e.createElement("line", { x1: "11", y1: "8", x2: "11", y2: "14" }), /* @__PURE__ */ e.createElement("line", { x1: "8", y1: "11", x2: "14", y2: "11" }))
555
+ N ? /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "11", cy: "11", r: "8" }), /* @__PURE__ */ e.createElement("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }), /* @__PURE__ */ e.createElement("line", { x1: "8", y1: "11", x2: "14", y2: "11" })) : /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "11", cy: "11", r: "8" }), /* @__PURE__ */ e.createElement("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }), /* @__PURE__ */ e.createElement("line", { x1: "11", y1: "8", x2: "11", y2: "14" }), /* @__PURE__ */ e.createElement("line", { x1: "8", y1: "11", x2: "14", y2: "11" }))
556
556
  ), /* @__PURE__ */ e.createElement(
557
557
  "button",
558
558
  {
559
559
  className: "artifactuse-viewer-control",
560
- onClick: h,
560
+ onClick: g,
561
561
  title: "Download"
562
562
  },
563
563
  /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), /* @__PURE__ */ e.createElement("polyline", { points: "7 10 12 15 17 10" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "15", x2: "12", y2: "3" }))
564
564
  )), s && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-viewer-caption" }, s))
565
565
  );
566
- return Ht(w, document.body);
566
+ return zt(x, document.body);
567
567
  }
568
- function Kt(t) {
568
+ function aa(t) {
569
569
  if (!t) return null;
570
570
  try {
571
- const a = decodeURIComponent(escape(atob(t)));
572
- return JSON.parse(a);
571
+ const r = decodeURIComponent(escape(atob(t)));
572
+ return JSON.parse(r);
573
573
  } catch {
574
574
  try {
575
575
  const l = t.replace(/&#10;/g, `
@@ -580,210 +580,210 @@ function Kt(t) {
580
580
  }
581
581
  }
582
582
  }
583
- function Yt(t) {
584
- const a = [];
585
- if (!t) return a;
583
+ function ra(t) {
584
+ const r = [];
585
+ if (!t) return r;
586
586
  const l = /<div\s+class="artifactuse-placeholder[^"]*"[^>]*data-artifact-id="([^"]+)"[^>]*data-artifact-type="([^"]+)"[^>]*data-artifact=["']([^"']*)["'][^>]*><\/div>/gi;
587
587
  let n = 0, s;
588
588
  for (; (s = l.exec(t)) !== null; ) {
589
589
  if (s.index > n) {
590
590
  const p = t.slice(n, s.index);
591
- p.trim() && a.push({ type: "html", content: p });
591
+ p.trim() && r.push({ type: "html", content: p });
592
592
  }
593
- const r = Kt(s[3]), E = s[2];
594
- r && (E === "form" && r.isInline ? a.push({ type: "form", artifact: r }) : E === "social" ? a.push({ type: "social", artifact: r }) : a.push({ type: "panel", artifact: r })), n = s.index + s[0].length;
593
+ const a = aa(s[3]), E = s[2];
594
+ a && (E === "form" && a.isInline ? r.push({ type: "form", artifact: a }) : E === "social" ? r.push({ type: "social", artifact: a }) : r.push({ type: "panel", artifact: a })), n = s.index + s[0].length;
595
595
  }
596
596
  if (n < t.length) {
597
- const r = t.slice(n);
598
- r.trim() && a.push({ type: "html", content: r });
597
+ const a = t.slice(n);
598
+ a.trim() && r.push({ type: "html", content: a });
599
599
  }
600
- return a.length === 0 && t.trim() && a.push({ type: "html", content: t }), a;
600
+ return r.length === 0 && t.trim() && r.push({ type: "html", content: t }), r;
601
601
  }
602
- function Qt() {
602
+ function sa() {
603
603
  return `msg-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
604
604
  }
605
- function Gt({
605
+ function na({
606
606
  content: t,
607
- messageId: a = Qt(),
607
+ messageId: r = sa(),
608
608
  inlineCards: l = !0,
609
609
  typing: n = !1,
610
610
  isLastMessage: s = !1,
611
611
  // Whether this is the last/most recent message
612
- onArtifactDetected: r,
612
+ onArtifactDetected: a,
613
613
  onArtifactOpen: E,
614
614
  onArtifactCopy: p,
615
- onArtifactDownload: y,
615
+ onArtifactDownload: N,
616
616
  onFormSubmit: i,
617
- onFormCancel: x,
618
- onFormButtonClick: A,
619
- onSocialCopy: L,
620
- onMediaOpen: u,
621
- className: h = ""
617
+ onFormCancel: w,
618
+ onFormButtonClick: S,
619
+ onSocialCopy: P,
620
+ onMediaOpen: m,
621
+ className: g = ""
622
622
  }) {
623
623
  const {
624
- processMessage: w,
624
+ processMessage: x,
625
625
  openArtifact: f,
626
- state: v,
626
+ state: h,
627
627
  getTheme: B,
628
- instance: O
629
- } = ve(), D = z(null), T = z(null), Z = z(null), Q = z(n), [J, me] = N(""), [te, he] = N([]), [ne, K] = N(!1), [le, G] = N(!1), [ce, X] = N("image"), [M, o] = N(""), [P, _] = N(""), [b, I] = N(""), W = S(() => typeof B == "function" ? B() : "dark", [B]), ge = (v == null ? void 0 : v.activeArtifactId) || null, _e = S(() => Yt(J), [J]), pe = S(() => ne || s ? "active" : "inactive", [ne, s]);
630
- R(() => {
631
- n && K(!0);
628
+ instance: U
629
+ } = _e(), $ = W(null), M = W(null), Y = W(null), Q = W(n), [O, me] = b(""), [K, Ee] = b([]), [re, ue] = b(!1), [se, J] = b(!1), [de, ne] = b("image"), [le, o] = b(""), [_, y] = b(""), [k, H] = b(""), X = T(() => typeof B == "function" ? B() : "dark", [B]), Ne = (h == null ? void 0 : h.activeArtifactId) || null, Z = T(() => ra(O), [O]), be = T(() => re || s ? "active" : "inactive", [re, s]);
630
+ q(() => {
631
+ n && ue(!0);
632
632
  }, [n]);
633
- const Y = d((g) => {
634
- X(g.type || "image"), o(g.src || ""), _(g.alt || ""), I(g.caption || ""), G(!0), u && u(g);
635
- }, [u]), ke = d(() => {
636
- G(!1), o(""), _(""), I("");
637
- }, []), ye = d(() => {
638
- if (!T.current) return;
639
- T.current.querySelectorAll('img[data-lightbox="true"]').forEach((m) => {
640
- m._lightboxHandler && m.removeEventListener("click", m._lightboxHandler), m._lightboxHandler = (k) => {
641
- k.preventDefault(), k.stopPropagation(), Y({
633
+ const G = d((v) => {
634
+ ne(v.type || "image"), o(v.src || ""), y(v.alt || ""), H(v.caption || ""), J(!0), m && m(v);
635
+ }, [m]), ve = d(() => {
636
+ J(!1), o(""), y(""), H("");
637
+ }, []), pe = d(() => {
638
+ if (!M.current) return;
639
+ M.current.querySelectorAll('img[data-lightbox="true"]').forEach((u) => {
640
+ u._lightboxHandler && u.removeEventListener("click", u._lightboxHandler), u._lightboxHandler = (I) => {
641
+ I.preventDefault(), I.stopPropagation(), G({
642
642
  type: "image",
643
- src: m.src,
644
- alt: m.alt || "",
645
- caption: m.dataset.caption || m.alt || ""
643
+ src: u.src,
644
+ alt: u.alt || "",
645
+ caption: u.dataset.caption || u.alt || ""
646
646
  });
647
- }, m.addEventListener("click", m._lightboxHandler), m.style.cursor = "zoom-in";
648
- }), T.current.querySelectorAll(".artifactuse-image-container img").forEach((m) => {
649
- m._lightboxHandler || (m._lightboxHandler = (k) => {
650
- k.preventDefault(), k.stopPropagation();
651
- const $ = m.closest(".artifactuse-image-container"), j = $ == null ? void 0 : $.querySelector(".artifactuse-image-caption"), be = (j == null ? void 0 : j.textContent) || m.dataset.caption || m.alt || "";
652
- Y({
647
+ }, u.addEventListener("click", u._lightboxHandler), u.style.cursor = "zoom-in";
648
+ }), M.current.querySelectorAll(".artifactuse-image-container img").forEach((u) => {
649
+ u._lightboxHandler || (u._lightboxHandler = (I) => {
650
+ I.preventDefault(), I.stopPropagation();
651
+ const F = u.closest(".artifactuse-image-container"), L = F == null ? void 0 : F.querySelector(".artifactuse-image-caption"), j = (L == null ? void 0 : L.textContent) || u.dataset.caption || u.alt || "";
652
+ G({
653
653
  type: "image",
654
- src: m.src,
655
- alt: m.alt || "",
656
- caption: be
654
+ src: u.src,
655
+ alt: u.alt || "",
656
+ caption: j
657
657
  });
658
- }, m.addEventListener("click", m._lightboxHandler), m.style.cursor = "zoom-in");
659
- }), T.current.querySelectorAll(".artifactuse-gallery-item img, .artifactuse-image-gallery img").forEach((m) => {
660
- m._lightboxHandler || (m._lightboxHandler = (k) => {
661
- k.preventDefault(), k.stopPropagation();
662
- const $ = m.closest(".artifactuse-gallery-item"), j = $ == null ? void 0 : $.querySelector(".artifactuse-gallery-caption"), be = (j == null ? void 0 : j.textContent) || m.dataset.caption || m.alt || "";
663
- Y({
658
+ }, u.addEventListener("click", u._lightboxHandler), u.style.cursor = "zoom-in");
659
+ }), M.current.querySelectorAll(".artifactuse-gallery-item img, .artifactuse-image-gallery img").forEach((u) => {
660
+ u._lightboxHandler || (u._lightboxHandler = (I) => {
661
+ I.preventDefault(), I.stopPropagation();
662
+ const F = u.closest(".artifactuse-gallery-item"), L = F == null ? void 0 : F.querySelector(".artifactuse-gallery-caption"), j = (L == null ? void 0 : L.textContent) || u.dataset.caption || u.alt || "";
663
+ G({
664
664
  type: "image",
665
- src: m.src,
666
- alt: m.alt || "",
667
- caption: be
665
+ src: u.src,
666
+ alt: u.alt || "",
667
+ caption: j
668
668
  });
669
- }, m.addEventListener("click", m._lightboxHandler), m.style.cursor = "zoom-in");
670
- }), T.current.querySelectorAll('a[href$=".pdf"], a[data-type="pdf"]').forEach((m) => {
671
- m._pdfHandler && m.removeEventListener("click", m._pdfHandler), m._pdfHandler = (k) => {
672
- k.preventDefault(), k.stopPropagation(), Y({
669
+ }, u.addEventListener("click", u._lightboxHandler), u.style.cursor = "zoom-in");
670
+ }), M.current.querySelectorAll('a[href$=".pdf"], a[data-type="pdf"]').forEach((u) => {
671
+ u._pdfHandler && u.removeEventListener("click", u._pdfHandler), u._pdfHandler = (I) => {
672
+ I.preventDefault(), I.stopPropagation(), G({
673
673
  type: "pdf",
674
- src: m.href,
675
- alt: m.textContent || "PDF Document",
676
- caption: m.title || m.textContent || ""
674
+ src: u.href,
675
+ alt: u.textContent || "PDF Document",
676
+ caption: u.title || u.textContent || ""
677
677
  });
678
- }, m.addEventListener("click", m._pdfHandler);
679
- }), T.current.querySelectorAll(".artifactuse-pdf-container, [data-pdf-viewer]").forEach((m) => {
680
- var $;
681
- m._pdfHandler && m.removeEventListener("click", m._pdfHandler);
682
- const k = m.dataset.pdfSrc || (($ = m.querySelector("iframe")) == null ? void 0 : $.src) || "";
683
- k && (m._pdfHandler = (j) => {
684
- j.preventDefault(), j.stopPropagation(), Y({
678
+ }, u.addEventListener("click", u._pdfHandler);
679
+ }), M.current.querySelectorAll(".artifactuse-pdf-container, [data-pdf-viewer]").forEach((u) => {
680
+ var F;
681
+ u._pdfHandler && u.removeEventListener("click", u._pdfHandler);
682
+ const I = u.dataset.pdfSrc || ((F = u.querySelector("iframe")) == null ? void 0 : F.src) || "";
683
+ I && (u._pdfHandler = (L) => {
684
+ L.preventDefault(), L.stopPropagation(), G({
685
685
  type: "pdf",
686
- src: k,
686
+ src: I,
687
687
  alt: "PDF Document",
688
- caption: m.dataset.caption || ""
688
+ caption: u.dataset.caption || ""
689
689
  });
690
- }, m.addEventListener("click", m._pdfHandler), m.style.cursor = "pointer");
691
- }), T.current.querySelectorAll(".artifactuse-video-preview-wrapper, .video-preview-wrapper").forEach((m) => {
692
- m._clickHandler && m.removeEventListener("click", m._clickHandler), m._clickHandler = (k) => {
693
- if (k.target.closest(".artifactuse-video-play-button")) return;
694
- const $ = m.dataset.videoUrl || m.dataset.url;
695
- $ && window.open($, "_blank", "noopener,noreferrer");
696
- }, m.addEventListener("click", m._clickHandler);
690
+ }, u.addEventListener("click", u._pdfHandler), u.style.cursor = "pointer");
691
+ }), M.current.querySelectorAll(".artifactuse-video-preview-wrapper, .video-preview-wrapper").forEach((u) => {
692
+ u._clickHandler && u.removeEventListener("click", u._clickHandler), u._clickHandler = (I) => {
693
+ if (I.target.closest(".artifactuse-video-play-button")) return;
694
+ const F = u.dataset.videoUrl || u.dataset.url;
695
+ F && window.open(F, "_blank", "noopener,noreferrer");
696
+ }, u.addEventListener("click", u._clickHandler);
697
697
  });
698
- }, [Y]), He = d(() => {
699
- if (!T.current) return;
700
- T.current.querySelectorAll("img").forEach((H) => {
701
- H._lightboxHandler && (H.removeEventListener("click", H._lightboxHandler), delete H._lightboxHandler);
702
- }), T.current.querySelectorAll('a[href$=".pdf"], a[data-type="pdf"]').forEach((H) => {
703
- H._pdfHandler && (H.removeEventListener("click", H._pdfHandler), delete H._pdfHandler);
704
- }), T.current.querySelectorAll(".artifactuse-pdf-container, [data-pdf-viewer]").forEach((H) => {
705
- H._pdfHandler && (H.removeEventListener("click", H._pdfHandler), delete H._pdfHandler);
706
- }), T.current.querySelectorAll(".artifactuse-video-preview-wrapper, .video-preview-wrapper").forEach((H) => {
707
- H._clickHandler && (H.removeEventListener("click", H._clickHandler), delete H._clickHandler);
698
+ }, [G]), ke = d(() => {
699
+ if (!M.current) return;
700
+ M.current.querySelectorAll("img").forEach((A) => {
701
+ A._lightboxHandler && (A.removeEventListener("click", A._lightboxHandler), delete A._lightboxHandler);
702
+ }), M.current.querySelectorAll('a[href$=".pdf"], a[data-type="pdf"]').forEach((A) => {
703
+ A._pdfHandler && (A.removeEventListener("click", A._pdfHandler), delete A._pdfHandler);
704
+ }), M.current.querySelectorAll(".artifactuse-pdf-container, [data-pdf-viewer]").forEach((A) => {
705
+ A._pdfHandler && (A.removeEventListener("click", A._pdfHandler), delete A._pdfHandler);
706
+ }), M.current.querySelectorAll(".artifactuse-video-preview-wrapper, .video-preview-wrapper").forEach((A) => {
707
+ A._clickHandler && (A.removeEventListener("click", A._clickHandler), delete A._clickHandler);
708
708
  });
709
- }, []), ae = d(() => {
710
- Z.current && clearTimeout(Z.current), Z.current = setTimeout(async () => {
711
- if (O != null && O.initializeContent && T.current)
709
+ }, []), ce = d(() => {
710
+ Y.current && clearTimeout(Y.current), Y.current = setTimeout(async () => {
711
+ if (U != null && U.initializeContent && M.current)
712
712
  try {
713
- await O.initializeContent(T.current);
714
- } catch (g) {
715
- console.error("Failed to initialize content:", g);
713
+ await U.initializeContent(M.current);
714
+ } catch (v) {
715
+ console.error("Failed to initialize content:", v);
716
716
  }
717
- ye();
717
+ pe();
718
718
  }, 100);
719
- }, [O, ye]);
720
- R(() => {
719
+ }, [U, pe]);
720
+ q(() => {
721
721
  if (t) {
722
- const g = w(t, a);
723
- me(g.html), he(g.artifacts), g.artifacts.length > 0 && r && r(g.artifacts), n || ae();
722
+ const v = x(t, r);
723
+ me(v.html), Ee(v.artifacts), v.artifacts.length > 0 && a && a(v.artifacts), n || ce();
724
724
  }
725
- }, [t, a, w, n, ae, r]), R(() => {
726
- Q.current === !0 && n === !1 && ae(), Q.current = n;
727
- }, [n, ae]), R(() => (n && K(!0), n || ae(), () => {
728
- Z.current && clearTimeout(Z.current), He();
725
+ }, [t, r, x, n, ce, a]), q(() => {
726
+ Q.current === !0 && n === !1 && ce(), Q.current = n;
727
+ }, [n, ce]), q(() => (n && ue(!0), n || ce(), () => {
728
+ Y.current && clearTimeout(Y.current), ke();
729
729
  }), []);
730
- const Ie = d((g) => {
731
- f(g), E && E(g);
732
- }, [f, E]), we = d((g) => {
733
- p && p(g);
734
- }, [p]), ie = d((g) => {
735
- y && y(g);
736
- }, [y]), Be = d((g) => {
737
- i && i(g);
738
- }, [i]), fe = d((g) => {
739
- x && x(g);
740
- }, [x]), Fe = d((g) => {
741
- A && A(g);
742
- }, [A]), ue = d((g) => {
743
- L && L(g);
744
- }, [L]), de = (g, re) => {
745
- switch (g.type) {
730
+ const Ae = d((v) => {
731
+ f(v), E && E(v);
732
+ }, [f, E]), ye = d((v) => {
733
+ p && p(v);
734
+ }, [p]), $e = d((v) => {
735
+ N && N(v);
736
+ }, [N]), we = d((v) => {
737
+ i && i(v);
738
+ }, [i]), ie = d((v) => {
739
+ w && w(v);
740
+ }, [w]), He = d((v) => {
741
+ S && S(v);
742
+ }, [S]), he = d((v) => {
743
+ P && P(v);
744
+ }, [P]), Ie = (v, te) => {
745
+ switch (v.type) {
746
746
  case "html":
747
747
  return /* @__PURE__ */ e.createElement(
748
748
  "div",
749
749
  {
750
- key: `html-${re}`,
751
- dangerouslySetInnerHTML: { __html: g.content }
750
+ key: `html-${te}`,
751
+ dangerouslySetInnerHTML: { __html: v.content }
752
752
  }
753
753
  );
754
754
  case "form":
755
- return g.artifact.isInline ? /* @__PURE__ */ e.createElement(
756
- Wt,
755
+ return v.artifact.isInline ? /* @__PURE__ */ e.createElement(
756
+ Ut,
757
757
  {
758
- key: `form-${g.artifact.id}`,
759
- artifact: g.artifact,
760
- theme: W,
761
- initialState: pe,
762
- onSubmit: Be,
763
- onCancel: fe,
764
- onButtonClick: Fe
758
+ key: `form-${v.artifact.id}`,
759
+ artifact: v.artifact,
760
+ theme: X,
761
+ initialState: be,
762
+ onSubmit: we,
763
+ onCancel: ie,
764
+ onButtonClick: He
765
765
  }
766
766
  ) : null;
767
767
  case "social":
768
768
  return /* @__PURE__ */ e.createElement(
769
- Xt,
769
+ ea,
770
770
  {
771
- key: `social-${g.artifact.id}`,
772
- artifact: g.artifact,
773
- theme: W,
774
- onCopy: ue
771
+ key: `social-${v.artifact.id}`,
772
+ artifact: v.artifact,
773
+ theme: X,
774
+ onCopy: he
775
775
  }
776
776
  );
777
777
  case "panel":
778
778
  return l ? /* @__PURE__ */ e.createElement(
779
- It,
779
+ Rt,
780
780
  {
781
- key: `panel-${g.artifact.id}`,
782
- artifact: g.artifact,
783
- isActive: ge === g.artifact.id,
784
- onOpen: Ie,
785
- onCopy: we,
786
- onDownload: ie
781
+ key: `panel-${v.artifact.id}`,
782
+ artifact: v.artifact,
783
+ isActive: Ne === v.artifact.id,
784
+ onOpen: Ae,
785
+ onCopy: ye,
786
+ onDownload: $e
787
787
  }
788
788
  ) : null;
789
789
  default:
@@ -793,342 +793,373 @@ function Gt({
793
793
  return /* @__PURE__ */ e.createElement(
794
794
  "div",
795
795
  {
796
- ref: D,
797
- className: `artifactuse-agent-message ${h}`.trim()
796
+ ref: $,
797
+ className: `artifactuse-agent-message ${g}`.trim()
798
798
  },
799
- /* @__PURE__ */ e.createElement("div", { ref: T, className: "artifactuse-message-content" }, _e.map(de)),
799
+ /* @__PURE__ */ e.createElement("div", { ref: M, className: "artifactuse-message-content" }, Z.map(Ie)),
800
800
  /* @__PURE__ */ e.createElement(
801
- Zt,
801
+ ta,
802
802
  {
803
- isOpen: le,
804
- type: ce,
805
- src: M,
806
- alt: P,
807
- caption: b,
808
- onClose: ke
803
+ isOpen: se,
804
+ type: de,
805
+ src: le,
806
+ alt: _,
807
+ caption: k,
808
+ onClose: ve
809
809
  }
810
810
  )
811
811
  );
812
812
  }
813
- Gt.propTypes = {
813
+ na.propTypes = {
814
814
  /** The raw message content (markdown/HTML from AI) */
815
- content: (t, a) => {
816
- if (typeof t[a] != "string")
817
- return new Error(`${a} must be a string`);
815
+ content: (t, r) => {
816
+ if (typeof t[r] != "string")
817
+ return new Error(`${r} must be a string`);
818
818
  },
819
819
  /** Unique message ID */
820
- messageId: (t, a) => {
821
- if (t[a] !== void 0 && typeof t[a] != "string")
822
- return new Error(`${a} must be a string`);
820
+ messageId: (t, r) => {
821
+ if (t[r] !== void 0 && typeof t[r] != "string")
822
+ return new Error(`${r} must be a string`);
823
823
  },
824
824
  /** Whether to show artifact cards inline */
825
- inlineCards: (t, a) => {
826
- if (t[a] !== void 0 && typeof t[a] != "boolean")
827
- return new Error(`${a} must be a boolean`);
825
+ inlineCards: (t, r) => {
826
+ if (t[r] !== void 0 && typeof t[r] != "boolean")
827
+ return new Error(`${r} must be a boolean`);
828
828
  },
829
829
  /** Whether the message is still being typed/streamed */
830
- typing: (t, a) => {
831
- if (t[a] !== void 0 && typeof t[a] != "boolean")
832
- return new Error(`${a} must be a boolean`);
830
+ typing: (t, r) => {
831
+ if (t[r] !== void 0 && typeof t[r] != "boolean")
832
+ return new Error(`${r} must be a boolean`);
833
833
  },
834
834
  /** Whether this is the last/most recent message in the conversation */
835
- isLastMessage: (t, a) => {
836
- if (t[a] !== void 0 && typeof t[a] != "boolean")
837
- return new Error(`${a} must be a boolean`);
835
+ isLastMessage: (t, r) => {
836
+ if (t[r] !== void 0 && typeof t[r] != "boolean")
837
+ return new Error(`${r} must be a boolean`);
838
838
  }
839
839
  };
840
- function ca({
840
+ function pa({
841
841
  onAIRequest: t,
842
- onSave: a,
842
+ onSave: r,
843
843
  onExport: l,
844
844
  className: n = ""
845
845
  }) {
846
+ var it;
846
847
  const {
847
848
  state: s,
848
- activeArtifact: r,
849
+ activeArtifact: a,
849
850
  artifactCount: E,
850
851
  hasArtifacts: p,
851
- closePanel: y,
852
+ closePanel: N,
852
853
  toggleFullscreen: i,
853
- setViewMode: x,
854
- getPanelUrl: A,
855
- openArtifact: L,
856
- instance: u
857
- } = ve(), h = z(null), w = z(null), f = z(null), v = z(null), B = z(null), [O, D] = N(!1), [T, Z] = N(!1), [Q, J] = N(!0), [me, te] = N(!1), [he, ne] = N(!1), [K, le] = N(!1), [G, ce] = N(!1), [X, M] = N("options"), [o, P] = N(""), [_, b] = N(null), [I, W] = N(""), [ge, _e] = N(!1), [pe, Y] = N(!1), [ke, ye] = N([]), [He, ae] = N(!1), [Ie, we] = N(""), [ie, Be] = N(65), [fe, Fe] = N(50), ue = z(null), de = z(null), g = z(null), re = z(null), Ne = z(null), xe = S(() => r ? Ae(r.language) : "", [r]), H = S(() => r ? Xe(r.language) : "", [r]), Ce = S(() => r ? A(r) : null, [r, A]), m = S(() => r ? Mt(r.language) : "plaintext", [r]), k = S(() => s.artifacts.filter((c) => !c.isInline), [s.artifacts]), $ = S(() => r ? k.findIndex((c) => c.id === r.id) : -1, [r, k]), j = S(() => {
854
+ setViewMode: w,
855
+ getPanelUrl: S,
856
+ openArtifact: P,
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(() => {
858
859
  var c;
859
- return ((c = u == null ? void 0 : u.config) == null ? void 0 : c.branding) !== !1;
860
- }, [u]), be = S(() => {
860
+ return ((c = m == null ? void 0 : m.config) == null ? void 0 : c.branding) !== !1;
861
+ }, [m]), ft = T(() => {
861
862
  var c;
862
- return ((c = u == null ? void 0 : u.share) == null ? void 0 : c.enabled) !== !1;
863
- }, [u]), Le = S(() => {
863
+ return ((c = m == null ? void 0 : m.share) == null ? void 0 : c.enabled) !== !1;
864
+ }, [m]), xe = T(() => {
864
865
  var c;
865
- return ((c = u == null ? void 0 : u.share) == null ? void 0 : c.isAuthenticated()) || !1;
866
- }, [u]), Ye = S(() => r ? ie : Math.min(ie, 30), [r, ie]), Qe = d((c) => `<svg viewBox="0 0 24 24" fill="currentColor">${Xe(c)}</svg>`, []), mt = d(() => {
867
- ne(!1), u.state.clearActiveArtifact();
868
- }, [u]), Ge = d(() => {
869
- if (!v.current || !(r != null && r.code)) return;
870
- const c = r.code.split(`
871
- `).length, C = Array.from({ length: c }, (q, V) => `<div>${V + 1}</div>`).join("");
872
- v.current.innerHTML = C;
873
- }, [r]), et = d(() => {
874
- if (w.current && St() && (r != null && r.code)) {
875
- const c = window.Prism.languages[m];
876
- c ? w.current.innerHTML = window.Prism.highlight(
877
- r.code,
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(() => {
868
+ se(!1), m.state.clearActiveArtifact();
869
+ }, [m]), tt = d(() => {
870
+ 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("");
873
+ h.current.innerHTML = C;
874
+ }, [a]), at = d(() => {
875
+ if (x.current && Ft() && (a != null && a.code)) {
876
+ const c = window.Prism.languages[F];
877
+ c ? x.current.innerHTML = window.Prism.highlight(
878
+ a.code,
878
879
  c,
879
- m
880
- ) : w.current.textContent = r.code, w.current.dataset.highlighted = "true", setTimeout(() => {
881
- ut();
880
+ F
881
+ ) : x.current.textContent = a.code, x.current.dataset.highlighted = "true", setTimeout(() => {
882
+ vt();
882
883
  }, 0);
883
884
  }
884
- }, [r == null ? void 0 : r.code, m]), ut = d(() => {
885
+ }, [a == null ? void 0 : a.code, F]), vt = d(() => {
885
886
  var C;
886
- const c = (C = w.current) == null ? void 0 : C.closest("pre");
887
- if (c && B.current && v.current) {
888
- const V = window.getComputedStyle(c).backgroundColor;
889
- V && V !== "rgba(0, 0, 0, 0)" && V !== "transparent" && (B.current.style.backgroundColor = V, v.current.style.backgroundColor = V);
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;
890
+ z && z !== "rgba(0, 0, 0, 0)" && z !== "transparent" && (B.current.style.backgroundColor = z, h.current.style.backgroundColor = z);
890
891
  }
891
- }, []), tt = d(() => {
892
- B.current && (B.current.style.backgroundColor = ""), v.current && (v.current.style.backgroundColor = "");
893
- }, []), We = d(() => {
894
- Ge(), et();
895
- }, [Ge, et]), dt = d(() => {
896
- clearTimeout(re.current), J(!1), h.current && r && (u.bridge.setIframe(h.current), u.bridge.loadArtifact(r));
897
- }, [r, u]), pt = d(() => {
898
- clearTimeout(re.current), J(!1);
899
- }, []), ft = d(() => {
900
- clearTimeout(re.current), re.current = setTimeout(() => {
901
- J(!1);
892
+ }, []), rt = d(() => {
893
+ B.current && (B.current.style.backgroundColor = ""), h.current && (h.current.style.backgroundColor = "");
894
+ }, []), Ve = d(() => {
895
+ tt(), at();
896
+ }, [tt, at]), ze = ((it = m.editor) == null ? void 0 : it.isAvailable()) || !1, st = d(() => {
897
+ !ze || !U.current || !a || ($.current && ($.current.destroy(), $.current = null), $.current = m.editor.create(U.current, {
898
+ code: a.code || "",
899
+ language: a.language || "plaintext",
900
+ sdkTheme: m.getTheme()
901
+ }));
902
+ }, [ze, a, m]), ht = d(() => {
903
+ if (!$.current || !a) return;
904
+ const c = $.current.getCode();
905
+ m.emit("edit:save", {
906
+ artifactId: a.id,
907
+ artifact: a,
908
+ code: c
909
+ });
910
+ }, [a, m]), gt = d(() => {
911
+ clearTimeout(fe.current), K(!1), g.current && a && (m.bridge.setIframe(g.current), m.bridge.loadArtifact(a));
912
+ }, [a, m]), _t = d(() => {
913
+ clearTimeout(fe.current), K(!1);
914
+ }, []), yt = d(() => {
915
+ clearTimeout(fe.current), fe.current = setTimeout(() => {
916
+ K(!1);
902
917
  }, 1e3);
903
- }, []), Et = d(async () => {
904
- if (r)
918
+ }, []), Nt = d(async () => {
919
+ if (a)
905
920
  try {
906
- await navigator.clipboard.writeText(r.code), D(!0), setTimeout(() => D(!1), 2e3);
921
+ await navigator.clipboard.writeText(a.code), Y(!0), setTimeout(() => Y(!1), 2e3);
907
922
  } catch (c) {
908
923
  console.error("Failed to copy:", c);
909
924
  }
910
- }, [r]), vt = d(() => {
911
- if (!r) return;
912
- const { code: c, language: C, title: q } = r, V = Ze(C), se = `${q.toLowerCase().replace(/\s+/g, "-")}.${V}`, Se = new Blob([c], { type: "text/plain" }), oe = URL.createObjectURL(Se), ee = document.createElement("a");
913
- ee.href = oe, ee.download = se, document.body.appendChild(ee), ee.click(), document.body.removeChild(ee), URL.revokeObjectURL(oe);
914
- }, [r]), ht = d(async () => {
915
- if (!(K || k.length === 0)) {
916
- le(!0);
925
+ }, [a]), bt = d(() => {
926
+ 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");
928
+ ee.href = oe, ee.download = ae, document.body.appendChild(ee), ee.click(), document.body.removeChild(ee), URL.revokeObjectURL(oe);
929
+ }, [a]), kt = d(async () => {
930
+ if (!(J || L.length === 0)) {
931
+ de(!0);
917
932
  try {
918
- const c = new $t(), C = /* @__PURE__ */ new Map();
919
- for (const ee of k) {
933
+ const c = new Vt(), C = /* @__PURE__ */ new Map();
934
+ for (const ee of L) {
920
935
  if (!ee.code) continue;
921
- const Ue = Ze(ee.language);
922
- let je = (ee.title || "untitled").toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-_]/g, ""), Oe = `${je}.${Ue}`;
923
- const Je = C.get(Oe) || 0;
924
- Je > 0 && (Oe = `${je}-${Je}.${Ue}`), C.set(`${je}.${Ue}`, Je + 1), c.file(Oe, ee.code);
936
+ const Oe = Ye(ee.language);
937
+ let Je = (ee.title || "untitled").toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-_]/g, ""), Xe = `${Je}.${Oe}`;
938
+ const Ze = C.get(Xe) || 0;
939
+ Ze > 0 && (Xe = `${Je}-${Ze}.${Oe}`), C.set(`${Je}.${Oe}`, Ze + 1), c.file(Xe, ee.code);
925
940
  }
926
- const q = await c.generateAsync({ type: "blob" }), se = `artifacts-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`, Se = URL.createObjectURL(q), oe = document.createElement("a");
927
- oe.href = Se, oe.download = se, document.body.appendChild(oe), oe.click(), document.body.removeChild(oe), URL.revokeObjectURL(Se);
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");
942
+ oe.href = Me, oe.download = ae, document.body.appendChild(oe), oe.click(), document.body.removeChild(oe), URL.revokeObjectURL(Me);
928
943
  } catch (c) {
929
944
  console.error("Failed to create ZIP:", c);
930
945
  } finally {
931
- le(!1);
946
+ de(!1);
932
947
  }
933
948
  }
934
- }, [K, k]), at = d((c) => c ? new Date(c).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : "", []), gt = d(() => {
935
- if (G) {
936
- ce(!1);
949
+ }, [J, L]), nt = d((c) => c ? new Date(c).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : "", []), wt = d(() => {
950
+ if (ne) {
951
+ le(!1);
937
952
  return;
938
953
  }
939
- r && (M("options"), P(""), b(null), W(""), _e(!1), Y(!1), ye([]), ae(!1), we(""), ce(!0));
940
- }, [r, u, G]), _t = d(() => {
941
- ce(!1);
942
- }, []), Ve = d(async () => {
943
- if (!(!r || !(u != null && u.share))) {
944
- M("loading"), W("");
954
+ a && (_("options"), k(""), X(null), Z(""), G(!1), pe(!1), ce([]), ye(!1), we(""), le(!0));
955
+ }, [a, m, ne]), xt = d(() => {
956
+ le(!1);
957
+ }, []), Re = d(async () => {
958
+ if (!(!a || !(m != null && m.share))) {
959
+ _("loading"), Z("");
945
960
  try {
946
- const c = await u.share.share(r);
947
- P(c.url), b(c.expiresAt), Y(!1), M("success");
961
+ const c = await m.share.share(a);
962
+ k(c.url), X(c.expiresAt), pe(!1), _("success");
948
963
  } catch (c) {
949
- W(c.message || "Failed to create share link"), M("error");
964
+ Z(c.message || "Failed to create share link"), _("error");
950
965
  }
951
966
  }
952
- }, [r, u]), rt = d(async () => {
953
- if (Le)
954
- Pe();
967
+ }, [a, m]), lt = d(async () => {
968
+ if (xe)
969
+ Ce();
955
970
  else {
956
- M("loading");
971
+ _("loading");
957
972
  try {
958
- await u.share.openAuthPopup(), Pe();
973
+ await m.share.openAuthPopup(), Ce();
959
974
  } catch (c) {
960
- c.message === "Authentication cancelled" ? M("options") : (W(c.message || "Authentication failed"), M("error"));
975
+ c.message === "Authentication cancelled" ? _("options") : (Z(c.message || "Authentication failed"), _("error"));
961
976
  }
962
977
  }
963
- }, [Le, u]), Pe = d(async () => {
964
- if (!(!r || !(u != null && u.share))) {
965
- M("loading"), W("");
978
+ }, [xe, m]), Ce = d(async () => {
979
+ if (!(!a || !(m != null && m.share))) {
980
+ _("loading"), Z("");
966
981
  try {
967
- const c = await u.share.save(r);
968
- P(c.url), b(null), Y(!0), M("success");
982
+ const c = await m.share.save(a);
983
+ k(c.url), X(null), pe(!0), _("success");
969
984
  } catch (c) {
970
- W(c.message || "Failed to save artifact"), M("error");
985
+ Z(c.message || "Failed to save artifact"), _("error");
971
986
  }
972
987
  }
973
- }, [r, u]), yt = d(() => {
974
- pe ? Pe() : Ve();
975
- }, [pe, Pe, Ve]), Nt = d(async () => {
976
- if (u != null && u.share) {
977
- if (!Le) {
978
- M("loading");
988
+ }, [a, m]), Ct = d(() => {
989
+ ve ? Ce() : Re();
990
+ }, [ve, Ce, Re]), Lt = d(async () => {
991
+ if (m != null && m.share) {
992
+ if (!xe) {
993
+ _("loading");
979
994
  try {
980
- await u.share.openAuthPopup();
995
+ await m.share.openAuthPopup();
981
996
  } catch (c) {
982
- c.message === "Authentication cancelled" ? M("options") : (W(c.message || "Authentication failed"), M("error"));
997
+ c.message === "Authentication cancelled" ? _("options") : (Z(c.message || "Authentication failed"), _("error"));
983
998
  return;
984
999
  }
985
1000
  }
986
- M("update-list"), ae(!0);
1001
+ _("update-list"), ye(!0);
987
1002
  try {
988
- const c = (r == null ? void 0 : r.language) || null, C = await u.share.listArtifacts(c);
989
- ye(C.projects || []);
1003
+ const c = (a == null ? void 0 : a.language) || null, C = await m.share.listArtifacts(c);
1004
+ ce(C.projects || []);
990
1005
  } catch (c) {
991
- W(c.message || "Failed to load artifacts"), M("error");
1006
+ Z(c.message || "Failed to load artifacts"), _("error");
992
1007
  } finally {
993
- ae(!1);
1008
+ ye(!1);
994
1009
  }
995
1010
  }
996
- }, [r, u, Le]), bt = d(async (c) => {
997
- var q, V;
998
- if (!r || !(u != null && u.share)) return;
999
- const C = (q = c.project) == null ? void 0 : q.uuid;
1011
+ }, [a, m, xe]), Pt = d(async (c) => {
1012
+ var R, z;
1013
+ if (!a || !(m != null && m.share)) return;
1014
+ const C = (R = c.project) == null ? void 0 : R.uuid;
1000
1015
  if (C) {
1001
- M("loading"), W("");
1016
+ _("loading"), Z("");
1002
1017
  try {
1003
- const se = await u.share.updateArtifact(C, r);
1004
- P(se.url || ""), b(null), Y(!0), we(((V = c.project) == null ? void 0 : V.name) || "Untitled"), M("success");
1005
- } catch (se) {
1006
- W(se.message || "Failed to update artifact"), M("error");
1018
+ 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");
1020
+ } catch (ae) {
1021
+ Z(ae.message || "Failed to update artifact"), _("error");
1007
1022
  }
1008
1023
  }
1009
- }, [r, u]), kt = d(async () => {
1010
- if (o)
1024
+ }, [a, m]), Mt = d(async () => {
1025
+ if (y)
1011
1026
  try {
1012
- await navigator.clipboard.writeText(o), _e(!0), setTimeout(() => _e(!1), 2e3);
1027
+ await navigator.clipboard.writeText(y), G(!0), setTimeout(() => G(!1), 2e3);
1013
1028
  } catch (c) {
1014
1029
  console.error("Failed to copy link:", c);
1015
1030
  }
1016
- }, [o]), wt = d(() => {
1017
- $ > 0 && L(k[$ - 1]);
1018
- }, [$, L, k]), xt = d(() => {
1019
- $ < k.length - 1 && L(k[$ + 1]);
1020
- }, [$, L, k]), st = d((c) => {
1021
- ne(!0), L(c), Z(!1);
1022
- }, [L]), ze = d((c) => {
1023
- ue.current = {
1031
+ }, [y]), Tt = d(() => {
1032
+ j > 0 && P(L[j - 1]);
1033
+ }, [j, P, L]), St = d(() => {
1034
+ 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) => {
1038
+ v.current = {
1024
1039
  startX: c.clientX,
1025
1040
  startWidth: ie
1026
- }, document.addEventListener("mousemove", qe), document.addEventListener("mouseup", Te), document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.querySelectorAll("iframe").forEach((C) => {
1041
+ }, document.addEventListener("mousemove", De), document.addEventListener("mouseup", Le), document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.querySelectorAll("iframe").forEach((C) => {
1027
1042
  C.style.pointerEvents = "none";
1028
1043
  });
1029
- }, [ie]), qe = d((c) => {
1030
- if (!ue.current) return;
1031
- const C = window.innerWidth, V = (ue.current.startX - c.clientX) / C * 100, se = ue.current.startWidth + V;
1032
- Be(Math.min(Math.max(se, 25), 75));
1033
- }, []), Te = d(() => {
1034
- ue.current = null, document.removeEventListener("mousemove", qe), document.removeEventListener("mouseup", Te), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((c) => {
1044
+ }, [ie]), De = d((c) => {
1045
+ if (!v.current) return;
1046
+ const C = window.innerWidth, z = (v.current.startX - c.clientX) / C * 100, ae = v.current.startWidth + z;
1047
+ He(Math.min(Math.max(ae, 25), 75));
1048
+ }, []), 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) => {
1035
1050
  c.style.pointerEvents = "";
1036
1051
  });
1037
- }, [qe]), Ct = d((c) => {
1052
+ }, [De]), At = d((c) => {
1038
1053
  if (!f.current) return;
1039
1054
  const C = f.current.getBoundingClientRect();
1040
- de.current = {
1055
+ te.current = {
1041
1056
  startX: c.clientX,
1042
- startPosition: fe,
1057
+ startPosition: he,
1043
1058
  contentLeft: C.left,
1044
1059
  contentWidth: C.width
1045
- }, document.addEventListener("mousemove", Re), document.addEventListener("mouseup", Me), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.querySelectorAll("iframe").forEach((q) => {
1046
- q.style.pointerEvents = "none";
1060
+ }, 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
+ R.style.pointerEvents = "none";
1047
1062
  });
1048
- }, [fe]), Re = d((c) => {
1049
- if (!de.current) return;
1050
- const q = (c.clientX - de.current.contentLeft) / de.current.contentWidth * 100;
1051
- Fe(Math.min(Math.max(q, 20), 80));
1052
- }, []), Me = d(() => {
1053
- de.current = null, document.removeEventListener("mousemove", Re), document.removeEventListener("mouseup", Me), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((c) => {
1063
+ }, [he]), Ue = d((c) => {
1064
+ if (!te.current) return;
1065
+ const R = (c.clientX - te.current.contentLeft) / te.current.contentWidth * 100;
1066
+ Ie(Math.min(Math.max(R, 20), 80));
1067
+ }, []), 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) => {
1054
1069
  c.style.pointerEvents = "";
1055
1070
  });
1056
- }, [Re]);
1057
- if (R(() => {
1058
- r && (Ne.current && Ne.current.isPreviewable !== r.isPreviewable && (te(!0), setTimeout(() => te(!1), 150)), Ne.current = r, tt(), J(!0), ft(), We());
1059
- }, [r == null ? void 0 : r.id, tt]), R(() => {
1060
- (s.viewMode === "code" || s.viewMode === "split") && We();
1061
- }, [s.viewMode, We]), R(() => (t && u.on("ai:request", t), a && u.on("save:request", a), l && u.on("export:complete", l), () => {
1062
- t && u.off("ai:request", t), a && u.off("save:request", a), l && u.off("export:complete", l);
1063
- }), [u, t, a, l]), R(() => () => {
1064
- Te(), Me(), clearTimeout(g.current), clearTimeout(re.current);
1065
- }, [Te, Me]), !s.isPanelOpen) return null;
1066
- const De = [
1071
+ }, [Ue]);
1072
+ if (q(() => {
1073
+ a && (A.current && A.current.isPreviewable !== a.isPreviewable && (re(!0), setTimeout(() => re(!1), 150)), A.current = a, rt(), K(!0), yt(), Ve());
1074
+ }, [a == null ? void 0 : a.id, rt]), q(() => {
1075
+ (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(() => () => {
1079
+ Le(), Pe(), $.current && ($.current.destroy(), $.current = null), clearTimeout(Be.current), clearTimeout(fe.current);
1080
+ }, [Le, Pe]), !s.isPanelOpen) return null;
1081
+ const je = [
1067
1082
  "artifactuse-panel",
1068
1083
  s.isFullscreen && "artifactuse-panel--fullscreen",
1069
- !r && p && "artifactuse-panel--list",
1084
+ !a && p && "artifactuse-panel--list",
1070
1085
  !p && "artifactuse-panel--empty",
1071
1086
  n
1072
- ].filter(Boolean).join(" "), Lt = [
1087
+ ].filter(Boolean).join(" "), $t = [
1073
1088
  "artifactuse-panel__content",
1074
1089
  `artifactuse-panel__content--${s.viewMode}`,
1075
- me && "artifactuse-panel__content--transitioning"
1090
+ Ee && "artifactuse-panel__content--transitioning"
1076
1091
  ].filter(Boolean).join(" ");
1077
- return p ? r ? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
1092
+ return p ? a ? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
1078
1093
  "div",
1079
1094
  {
1080
- className: De,
1095
+ className: je,
1081
1096
  style: s.isFullscreen ? void 0 : { width: `${ie}%` }
1082
1097
  },
1083
1098
  !s.isFullscreen && /* @__PURE__ */ e.createElement(
1084
1099
  "div",
1085
1100
  {
1086
1101
  className: "artifactuse-panel__resize-handle",
1087
- onMouseDown: ze
1102
+ onMouseDown: qe
1088
1103
  },
1089
1104
  /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle-line" })
1090
1105
  ),
1091
- /* @__PURE__ */ e.createElement("header", { className: "artifactuse-panel__header" }, he && /* @__PURE__ */ e.createElement(
1106
+ /* @__PURE__ */ e.createElement("header", { className: "artifactuse-panel__header" }, ue && /* @__PURE__ */ e.createElement(
1092
1107
  "button",
1093
1108
  {
1094
1109
  className: "artifactuse-panel__back",
1095
1110
  title: "Back to list",
1096
- onClick: mt
1111
+ onClick: Et
1097
1112
  },
1098
1113
  /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "15 18 9 12 15 6" }))
1099
1114
  ), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title" }, /* @__PURE__ */ e.createElement(
1100
1115
  "span",
1101
1116
  {
1102
1117
  className: "artifactuse-panel__icon",
1103
- dangerouslySetInnerHTML: { __html: `<svg viewBox="0 0 24 24" fill="currentColor">${H}</svg>` }
1118
+ dangerouslySetInnerHTML: { __html: `<svg viewBox="0 0 24 24" fill="currentColor">${u}</svg>` }
1104
1119
  }
1105
- ), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__name" }, r.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__meta" }, xe, r.lineCount && ` • ${r.lineCount} lines`))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__tabs" }, /* @__PURE__ */ e.createElement(
1120
+ ), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__name" }, a.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__meta" }, Fe, a.lineCount && ` • ${a.lineCount} lines`))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__tabs" }, (!a.tabs || a.tabs.includes("preview")) && /* @__PURE__ */ e.createElement(
1106
1121
  "button",
1107
1122
  {
1108
1123
  className: `artifactuse-panel__tab ${s.viewMode === "preview" ? "artifactuse-panel__tab--active" : ""}`,
1109
- disabled: !r.isPreviewable,
1124
+ disabled: !a.isPreviewable,
1110
1125
  title: "Preview",
1111
- onClick: () => x("preview")
1126
+ onClick: () => w("preview")
1112
1127
  },
1113
1128
  /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }), /* @__PURE__ */ e.createElement("circle", { cx: "12", cy: "12", r: "3" }))
1114
- ), /* @__PURE__ */ e.createElement(
1129
+ ), (!a.tabs || a.tabs.includes("code")) && /* @__PURE__ */ e.createElement(
1115
1130
  "button",
1116
1131
  {
1117
1132
  className: `artifactuse-panel__tab ${s.viewMode === "code" ? "artifactuse-panel__tab--active" : ""}`,
1118
1133
  title: "Code",
1119
- onClick: () => x("code")
1134
+ onClick: () => w("code")
1120
1135
  },
1121
1136
  /* @__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" }))
1122
- ), /* @__PURE__ */ e.createElement(
1137
+ ), (!a.tabs || a.tabs.includes("split")) && /* @__PURE__ */ e.createElement(
1123
1138
  "button",
1124
1139
  {
1125
1140
  className: `artifactuse-panel__tab ${s.viewMode === "split" ? "artifactuse-panel__tab--active" : ""}`,
1126
- disabled: !r.isPreviewable,
1141
+ disabled: !a.isPreviewable,
1127
1142
  title: "Split view",
1128
- onClick: () => x("split")
1143
+ onClick: () => w("split")
1129
1144
  },
1130
1145
  /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "3", x2: "12", y2: "21" }))
1131
- )), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
1146
+ ), a.tabs && a.tabs.includes("edit") && ze && /* @__PURE__ */ e.createElement(
1147
+ "button",
1148
+ {
1149
+ className: `artifactuse-panel__tab ${s.viewMode === "edit" ? "artifactuse-panel__tab--active" : ""}`,
1150
+ title: "Edit",
1151
+ onClick: () => w("edit")
1152
+ },
1153
+ /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }), /* @__PURE__ */ e.createElement("path", { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" }))
1154
+ )), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__actions" }, s.viewMode === "edit" && /* @__PURE__ */ e.createElement(
1155
+ "button",
1156
+ {
1157
+ className: "artifactuse-panel__action artifactuse-panel__action--save",
1158
+ title: "Save",
1159
+ onClick: ht
1160
+ },
1161
+ /* @__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" }))
1162
+ ), /* @__PURE__ */ e.createElement(
1132
1163
  "button",
1133
1164
  {
1134
1165
  className: "artifactuse-panel__action",
@@ -1141,35 +1172,35 @@ function ca({
1141
1172
  {
1142
1173
  className: "artifactuse-panel__action artifactuse-panel__action--close",
1143
1174
  title: "Close",
1144
- onClick: y
1175
+ onClick: N
1145
1176
  },
1146
1177
  /* @__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" }))
1147
1178
  ))),
1148
- /* @__PURE__ */ e.createElement("div", { className: Lt, ref: f }, me && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__spinner" })), (s.viewMode === "preview" || s.viewMode === "split") && /* @__PURE__ */ e.createElement(
1179
+ /* @__PURE__ */ e.createElement("div", { className: $t, ref: f }, Ee && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__spinner" })), (s.viewMode === "preview" || s.viewMode === "split") && /* @__PURE__ */ e.createElement(
1149
1180
  "div",
1150
1181
  {
1151
1182
  className: "artifactuse-panel__preview",
1152
- style: s.viewMode === "split" ? { width: `${fe}%` } : void 0
1183
+ style: s.viewMode === "split" ? { width: `${he}%` } : void 0
1153
1184
  },
1154
- Q && Ce && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__spinner" })),
1155
- Ce ? /* @__PURE__ */ e.createElement(
1185
+ me && I && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__spinner" })),
1186
+ I ? /* @__PURE__ */ e.createElement(
1156
1187
  "iframe",
1157
1188
  {
1158
- ref: h,
1159
- src: Ce,
1160
- className: `artifactuse-panel__iframe ${Q ? "artifactuse-panel__iframe--loading" : ""}`,
1189
+ ref: g,
1190
+ src: I,
1191
+ className: `artifactuse-panel__iframe ${me ? "artifactuse-panel__iframe--loading" : ""}`,
1161
1192
  sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-downloads allow-top-navigation-by-user-activation",
1162
1193
  allow: "camera; microphone; fullscreen; geolocation; display-capture; autoplay; clipboard-write",
1163
- onLoad: dt,
1164
- onError: pt
1194
+ onLoad: gt,
1195
+ onError: _t
1165
1196
  }
1166
- ) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__no-preview" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }, /* @__PURE__ */ e.createElement("path", { d: "M9 17H7A5 5 0 0 1 7 7h2" }), /* @__PURE__ */ e.createElement("path", { d: "M15 7h2a5 5 0 1 1 0 10h-2" }), /* @__PURE__ */ e.createElement("line", { x1: "8", y1: "12", x2: "16", y2: "12" })), /* @__PURE__ */ e.createElement("p", null, "Preview not available for ", xe))
1197
+ ) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__no-preview" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }, /* @__PURE__ */ e.createElement("path", { d: "M9 17H7A5 5 0 0 1 7 7h2" }), /* @__PURE__ */ e.createElement("path", { d: "M15 7h2a5 5 0 1 1 0 10h-2" }), /* @__PURE__ */ e.createElement("line", { x1: "8", y1: "12", x2: "16", y2: "12" })), /* @__PURE__ */ e.createElement("p", null, "Preview not available for ", Fe))
1167
1198
  ), /* @__PURE__ */ e.createElement(
1168
1199
  "div",
1169
1200
  {
1170
1201
  className: "artifactuse-panel__code",
1171
1202
  style: {
1172
- ...s.viewMode === "split" ? { width: `${100 - fe}%` } : {},
1203
+ ...s.viewMode === "split" ? { width: `${100 - he}%` } : {},
1173
1204
  display: s.viewMode === "code" || s.viewMode === "split" ? void 0 : "none"
1174
1205
  }
1175
1206
  },
@@ -1177,19 +1208,26 @@ function ca({
1177
1208
  "div",
1178
1209
  {
1179
1210
  className: "artifactuse-panel__split-handle",
1180
- onMouseDown: Ct
1211
+ onMouseDown: At
1181
1212
  },
1182
1213
  /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__split-handle-line" })
1183
1214
  ),
1184
- /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__code-scroll", ref: B }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__line-numbers", ref: v }), /* @__PURE__ */ e.createElement("pre", { className: `artifactuse-panel__code-block language-${m}` }, /* @__PURE__ */ e.createElement(
1215
+ /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__code-scroll", ref: B }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__line-numbers", ref: h }), /* @__PURE__ */ e.createElement("pre", { className: `artifactuse-panel__code-block language-${F}` }, /* @__PURE__ */ e.createElement(
1185
1216
  "code",
1186
1217
  {
1187
- ref: w,
1188
- className: `language-${m}`
1218
+ ref: x,
1219
+ className: `language-${F}`
1189
1220
  }
1190
1221
  )))
1222
+ ), /* @__PURE__ */ e.createElement(
1223
+ "div",
1224
+ {
1225
+ className: "artifactuse-panel__edit",
1226
+ style: { display: s.viewMode === "edit" ? void 0 : "none" }
1227
+ },
1228
+ /* @__PURE__ */ e.createElement("div", { ref: U, className: "artifactuse-panel__editor-container" })
1191
1229
  )),
1192
- /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__footer-left" }, j && /* @__PURE__ */ e.createElement(
1230
+ /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__footer-left" }, We && /* @__PURE__ */ e.createElement(
1193
1231
  "a",
1194
1232
  {
1195
1233
  href: "https://artifactuse.com",
@@ -1200,142 +1238,142 @@ function ca({
1200
1238
  },
1201
1239
  /* @__PURE__ */ e.createElement("svg", { width: "16", height: "16", viewBox: "0 0 42 42", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ e.createElement("path", { d: "M16.6667 41.6673V10.4173C16.6667 9.86478 16.4472 9.33488 16.0565 8.94418C15.6658 8.55348 15.1359 8.33398 14.5833 8.33398H4.16667C3.0616 8.33398 2.00179 8.77297 1.22039 9.55437C0.438987 10.3358 0 11.3956 0 12.5007V37.5006C0 38.6057 0.438987 39.6655 1.22039 40.4469C2.00179 41.2283 3.0616 41.6673 4.16667 41.6673H29.1667C30.2717 41.6673 31.3315 41.2283 32.1129 40.4469C32.8943 39.6655 33.3333 38.6057 33.3333 37.5006V27.084C33.3333 26.5314 33.1138 26.0015 32.7231 25.6108C32.3324 25.2201 31.8025 25.0007 31.25 25.0007H0", fill: "#5F51C8" }), /* @__PURE__ */ e.createElement("path", { d: "M39.5833 0H27.0833C25.9327 0 25 0.93274 25 2.08333V14.5833C25 15.7339 25.9327 16.6667 27.0833 16.6667H39.5833C40.7339 16.6667 41.6667 15.7339 41.6667 14.5833V2.08333C41.6667 0.93274 40.7339 0 39.5833 0Z", fill: "#695AE0" })),
1202
1240
  /* @__PURE__ */ e.createElement("span", null, "Artifactuse")
1203
- ), r.code && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__badge artifactuse-panel__badge--secondary" }, ct(r.size))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__footer-right" }, /* @__PURE__ */ e.createElement(
1241
+ ), a.code && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__badge artifactuse-panel__badge--secondary" }, ut(a.size))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__footer-right" }, /* @__PURE__ */ e.createElement(
1204
1242
  "button",
1205
1243
  {
1206
- className: `artifactuse-panel__footer-action ${O ? "artifactuse-panel__footer-action--success" : ""}`,
1207
- title: O ? "Copied!" : "Copy code",
1208
- onClick: Et
1244
+ className: `artifactuse-panel__footer-action ${M ? "artifactuse-panel__footer-action--success" : ""}`,
1245
+ title: M ? "Copied!" : "Copy code",
1246
+ onClick: Nt
1209
1247
  },
1210
- O ? /* @__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("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }), /* @__PURE__ */ e.createElement("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }))
1248
+ M ? /* @__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("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }), /* @__PURE__ */ e.createElement("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }))
1211
1249
  ), /* @__PURE__ */ e.createElement(
1212
1250
  "button",
1213
1251
  {
1214
1252
  className: "artifactuse-panel__footer-action",
1215
1253
  title: "Download",
1216
- onClick: vt
1254
+ onClick: bt
1217
1255
  },
1218
1256
  /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), /* @__PURE__ */ e.createElement("polyline", { points: "7 10 12 15 17 10" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "15", x2: "12", y2: "3" }))
1219
- ), be && /* @__PURE__ */ e.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ e.createElement(
1257
+ ), ft && /* @__PURE__ */ e.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ e.createElement(
1220
1258
  "button",
1221
1259
  {
1222
1260
  className: "artifactuse-panel__footer-action",
1223
1261
  title: "Share",
1224
- onClick: gt
1262
+ onClick: wt
1225
1263
  },
1226
1264
  /* @__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" }))
1227
- ), G && /* @__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" }, X === "success" ? Ie ? "Artifact updated!" : "Link created!" : X === "update-list" ? "Update saved artifact" : "Share Artifact"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__close", onClick: _t }, /* @__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" }, X === "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...")), X === "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" }, I)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__actions" }, /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__btn artifactuse-share-popup__btn--secondary", onClick: () => M("options") }, "Back"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__btn artifactuse-share-popup__btn--primary", onClick: yt }, "Retry"))), X === "options" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__options" }, /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__option", onClick: Ve }, /* @__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: rt }, /* @__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: Nt }, /* @__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")))), X === "update-list" && /* @__PURE__ */ e.createElement("div", null, He ? /* @__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) => {
1228
- var C, q, V;
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) => {
1266
+ var C, R, z;
1229
1267
  return /* @__PURE__ */ e.createElement(
1230
1268
  "button",
1231
1269
  {
1232
1270
  key: ((C = c.project) == null ? void 0 : C.uuid) || c.id,
1233
1271
  className: "artifactuse-share-popup__artifact-item",
1234
- onClick: () => bt(c)
1272
+ onClick: () => Pt(c)
1235
1273
  },
1236
- /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-name" }, ((q = c.project) == null ? void 0 : q.name) || "Untitled"),
1237
- /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-date" }, at((V = c.project) == null ? void 0 : V.created_at))
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))
1238
1276
  );
1239
- })), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__back-btn", onClick: () => M("options") }, "Back")), X === "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(
1277
+ })), /* @__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(
1240
1278
  "input",
1241
1279
  {
1242
1280
  type: "text",
1243
1281
  className: "artifactuse-share-popup__link",
1244
- value: o,
1282
+ value: y,
1245
1283
  readOnly: !0,
1246
1284
  onClick: (c) => c.target.select()
1247
1285
  }
1248
1286
  ), /* @__PURE__ */ e.createElement(
1249
1287
  "button",
1250
1288
  {
1251
- className: `artifactuse-share-popup__copy-btn ${ge ? "artifactuse-share-popup__copy-btn--copied" : ""}`,
1252
- onClick: kt
1289
+ className: `artifactuse-share-popup__copy-btn ${be ? "artifactuse-share-popup__copy-btn--copied" : ""}`,
1290
+ onClick: Mt
1253
1291
  },
1254
- ge ? "Copied!" : "Copy"
1255
- )), _ && !pe && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__expiry" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__expiry-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "12", cy: "12", r: "10" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "8", x2: "12", y2: "12" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" }))), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__expiry-text" }, "Expires ", at(_))), !pe && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__save-prompt" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__save-prompt-text" }, "Keep it permanently?"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__save-prompt-btn", onClick: rt }, "Save to account")))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__footer" }, /* @__PURE__ */ e.createElement("a", { href: "https://artifactuse.com", target: "_blank", rel: "noopener noreferrer", className: "artifactuse-share-popup__branding" }, /* @__PURE__ */ e.createElement("svg", { width: "12", height: "12", viewBox: "0 0 42 42", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ e.createElement("path", { d: "M16.6667 41.6673V10.4173C16.6667 9.86478 16.4472 9.33488 16.0565 8.94418C15.6658 8.55348 15.1359 8.33398 14.5833 8.33398H4.16667C3.0616 8.33398 2.00179 8.77297 1.22039 9.55437C0.438987 10.3358 0 11.3956 0 12.5007V37.5006C0 38.6057 0.438987 39.6655 1.22039 40.4469C2.00179 41.2283 3.0616 41.6673 4.16667 41.6673H29.1667C30.2717 41.6673 31.3315 41.2283 32.1129 40.4469C32.8943 39.6655 33.3333 38.6057 33.3333 37.5006V27.084C33.3333 26.5314 33.1138 26.0015 32.7231 25.6108C32.3324 25.2201 31.8025 25.0007 31.25 25.0007H0", fill: "#5F51C8" }), /* @__PURE__ */ e.createElement("path", { d: "M39.5833 0H27.0833C25.9327 0 25 0.93274 25 2.08333V14.5833C25 15.7339 25.9327 16.6667 27.0833 16.6667H39.5833C40.7339 16.6667 41.6667 15.7339 41.6667 14.5833V2.08333C41.6667 0.93274 40.7339 0 39.5833 0Z", fill: "#695AE0" })), /* @__PURE__ */ e.createElement("span", null, "Powered by Artifactuse"))))), k.length > 1 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__nav" }, /* @__PURE__ */ e.createElement(
1292
+ be ? "Copied!" : "Copy"
1293
+ )), H && !ve && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__expiry" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__expiry-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "12", cy: "12", r: "10" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "8", x2: "12", y2: "12" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" }))), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__expiry-text" }, "Expires ", nt(H))), !ve && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__save-prompt" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__save-prompt-text" }, "Keep it permanently?"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__save-prompt-btn", onClick: lt }, "Save to account")))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__footer" }, /* @__PURE__ */ e.createElement("a", { href: "https://artifactuse.com", target: "_blank", rel: "noopener noreferrer", className: "artifactuse-share-popup__branding" }, /* @__PURE__ */ e.createElement("svg", { width: "12", height: "12", viewBox: "0 0 42 42", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ e.createElement("path", { d: "M16.6667 41.6673V10.4173C16.6667 9.86478 16.4472 9.33488 16.0565 8.94418C15.6658 8.55348 15.1359 8.33398 14.5833 8.33398H4.16667C3.0616 8.33398 2.00179 8.77297 1.22039 9.55437C0.438987 10.3358 0 11.3956 0 12.5007V37.5006C0 38.6057 0.438987 39.6655 1.22039 40.4469C2.00179 41.2283 3.0616 41.6673 4.16667 41.6673H29.1667C30.2717 41.6673 31.3315 41.2283 32.1129 40.4469C32.8943 39.6655 33.3333 38.6057 33.3333 37.5006V27.084C33.3333 26.5314 33.1138 26.0015 32.7231 25.6108C32.3324 25.2201 31.8025 25.0007 31.25 25.0007H0", fill: "#5F51C8" }), /* @__PURE__ */ e.createElement("path", { d: "M39.5833 0H27.0833C25.9327 0 25 0.93274 25 2.08333V14.5833C25 15.7339 25.9327 16.6667 27.0833 16.6667H39.5833C40.7339 16.6667 41.6667 15.7339 41.6667 14.5833V2.08333C41.6667 0.93274 40.7339 0 39.5833 0Z", fill: "#695AE0" })), /* @__PURE__ */ e.createElement("span", null, "Powered by Artifactuse"))))), L.length > 1 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__nav" }, /* @__PURE__ */ e.createElement(
1256
1294
  "button",
1257
1295
  {
1258
1296
  className: "artifactuse-panel__nav-btn",
1259
- disabled: $ <= 0,
1297
+ disabled: j <= 0,
1260
1298
  title: "Previous artifact",
1261
- onClick: wt
1299
+ onClick: Tt
1262
1300
  },
1263
1301
  /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "15 18 9 12 15 6" }))
1264
1302
  ), /* @__PURE__ */ e.createElement(
1265
1303
  "button",
1266
1304
  {
1267
1305
  className: "artifactuse-panel__nav-trigger",
1268
- onClick: () => Z(!T)
1306
+ onClick: () => O(!Q)
1269
1307
  },
1270
- /* @__PURE__ */ e.createElement("span", null, $ + 1, " / ", k.length),
1308
+ /* @__PURE__ */ e.createElement("span", null, j + 1, " / ", L.length),
1271
1309
  /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "6 9 12 15 18 9" }))
1272
1310
  ), /* @__PURE__ */ e.createElement(
1273
1311
  "button",
1274
1312
  {
1275
1313
  className: "artifactuse-panel__nav-btn",
1276
- disabled: $ >= k.length - 1,
1314
+ disabled: j >= L.length - 1,
1277
1315
  title: "Next artifact",
1278
- onClick: xt
1316
+ onClick: St
1279
1317
  },
1280
1318
  /* @__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" }))
1281
- ), T && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list-header" }, /* @__PURE__ */ e.createElement("span", null, "All Artifacts (", k.length, ")"), /* @__PURE__ */ e.createElement(
1319
+ ), Q && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list-header" }, /* @__PURE__ */ e.createElement("span", null, "All Artifacts (", L.length, ")"), /* @__PURE__ */ e.createElement(
1282
1320
  "button",
1283
1321
  {
1284
1322
  className: "artifactuse-panel__artifact-list-close",
1285
- onClick: () => Z(!1)
1323
+ onClick: () => O(!1)
1286
1324
  },
1287
1325
  /* @__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" }))
1288
- )), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list-items" }, k.map((c, C) => /* @__PURE__ */ e.createElement(
1326
+ )), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list-items" }, L.map((c, C) => /* @__PURE__ */ e.createElement(
1289
1327
  "button",
1290
1328
  {
1291
1329
  key: c.id,
1292
- className: `artifactuse-panel__artifact-item ${c.id === r.id ? "artifactuse-panel__artifact-item--active" : ""}`,
1293
- onClick: () => st(c)
1330
+ className: `artifactuse-panel__artifact-item ${c.id === a.id ? "artifactuse-panel__artifact-item--active" : ""}`,
1331
+ onClick: () => ct(c)
1294
1332
  },
1295
1333
  /* @__PURE__ */ e.createElement(
1296
1334
  "span",
1297
1335
  {
1298
1336
  className: "artifactuse-panel__artifact-item-icon",
1299
- dangerouslySetInnerHTML: { __html: Qe(c.language) }
1337
+ dangerouslySetInnerHTML: { __html: et(c.language) }
1300
1338
  }
1301
1339
  ),
1302
- /* @__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" }, Ae(c.language), c.lineCount && ` • ${c.lineCount} lines`)),
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`)),
1303
1341
  /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-index" }, C + 1)
1304
1342
  )))))))
1305
- )) : /* @__PURE__ */ e.createElement("div", { className: De, style: s.isFullscreen ? void 0 : { width: `${Ye}%` } }, !s.isFullscreen && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle", onMouseDown: ze }, /* @__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" }, k.length, " available"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
1343
+ )) : /* @__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(
1306
1344
  "button",
1307
1345
  {
1308
- className: `artifactuse-panel__action ${K ? "artifactuse-panel__action--loading" : ""}`,
1309
- disabled: K,
1346
+ className: `artifactuse-panel__action ${J ? "artifactuse-panel__action--loading" : ""}`,
1347
+ disabled: J,
1310
1348
  title: "Download all as ZIP",
1311
- onClick: ht
1349
+ onClick: kt
1312
1350
  },
1313
- K ? /* @__PURE__ */ e.createElement("svg", { className: "artifactuse-panel__spinner-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "12", cy: "12", r: "10", strokeDasharray: "32", strokeDashoffset: "32" })) : /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), /* @__PURE__ */ e.createElement("polyline", { points: "7 10 12 15 17 10" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "15", x2: "12", y2: "3" }))
1351
+ J ? /* @__PURE__ */ e.createElement("svg", { className: "artifactuse-panel__spinner-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "12", cy: "12", r: "10", strokeDasharray: "32", strokeDashoffset: "32" })) : /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), /* @__PURE__ */ e.createElement("polyline", { points: "7 10 12 15 17 10" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "15", x2: "12", y2: "3" }))
1314
1352
  ), /* @__PURE__ */ e.createElement(
1315
1353
  "button",
1316
1354
  {
1317
1355
  className: "artifactuse-panel__action artifactuse-panel__action--close",
1318
1356
  title: "Close panel",
1319
- onClick: y
1357
+ onClick: N
1320
1358
  },
1321
1359
  /* @__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" }))
1322
- ))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-items" }, k.map((c, C) => /* @__PURE__ */ e.createElement(
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(
1323
1361
  "button",
1324
1362
  {
1325
1363
  key: c.id,
1326
1364
  className: "artifactuse-panel__list-item",
1327
- onClick: () => st(c)
1365
+ onClick: () => ct(c)
1328
1366
  },
1329
1367
  /* @__PURE__ */ e.createElement(
1330
1368
  "span",
1331
1369
  {
1332
1370
  className: "artifactuse-panel__list-item-icon",
1333
- dangerouslySetInnerHTML: { __html: Qe(c.language) }
1371
+ dangerouslySetInnerHTML: { __html: et(c.language) }
1334
1372
  }
1335
1373
  ),
1336
- /* @__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" }, Ae(c.language), c.lineCount && ` • ${c.lineCount} lines`)),
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`)),
1337
1375
  /* @__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" })))
1338
- )))), /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer artifactuse-panel__footer--simple" }, j && /* @__PURE__ */ e.createElement(
1376
+ )))), /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer artifactuse-panel__footer--simple" }, We && /* @__PURE__ */ e.createElement(
1339
1377
  "a",
1340
1378
  {
1341
1379
  href: "https://artifactuse.com",
@@ -1345,15 +1383,15 @@ function ca({
1345
1383
  },
1346
1384
  /* @__PURE__ */ e.createElement("svg", { width: "16", height: "16", viewBox: "0 0 42 42", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ e.createElement("path", { d: "M16.6667 41.6673V10.4173C16.6667 9.86478 16.4472 9.33488 16.0565 8.94418C15.6658 8.55348 15.1359 8.33398 14.5833 8.33398H4.16667C3.0616 8.33398 2.00179 8.77297 1.22039 9.55437C0.438987 10.3358 0 11.3956 0 12.5007V37.5006C0 38.6057 0.438987 39.6655 1.22039 40.4469C2.00179 41.2283 3.0616 41.6673 4.16667 41.6673H29.1667C30.2717 41.6673 31.3315 41.2283 32.1129 40.4469C32.8943 39.6655 33.3333 38.6057 33.3333 37.5006V27.084C33.3333 26.5314 33.1138 26.0015 32.7231 25.6108C32.3324 25.2201 31.8025 25.0007 31.25 25.0007H0", fill: "#5F51C8" }), /* @__PURE__ */ e.createElement("path", { d: "M39.5833 0H27.0833C25.9327 0 25 0.93274 25 2.08333V14.5833C25 15.7339 25.9327 16.6667 27.0833 16.6667H39.5833C40.7339 16.6667 41.6667 15.7339 41.6667 14.5833V2.08333C41.6667 0.93274 40.7339 0 39.5833 0Z", fill: "#695AE0" })),
1347
1385
  /* @__PURE__ */ e.createElement("span", null, "Artifactuse")
1348
- ))) : /* @__PURE__ */ e.createElement("div", { className: De, style: s.isFullscreen ? void 0 : { width: `${Ye}%` } }, !s.isFullscreen && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle", onMouseDown: ze }, /* @__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("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
1386
+ ))) : /* @__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("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
1349
1387
  "button",
1350
1388
  {
1351
1389
  className: "artifactuse-panel__action artifactuse-panel__action--close",
1352
1390
  title: "Close panel",
1353
- onClick: y
1391
+ onClick: N
1354
1392
  },
1355
1393
  /* @__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" }))
1356
- ))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__empty" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__empty-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }, /* @__PURE__ */ e.createElement("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" }), /* @__PURE__ */ e.createElement("polyline", { points: "14 2 14 8 20 8" }))), /* @__PURE__ */ e.createElement("h3", { className: "artifactuse-panel__empty-title" }, "No artifacts yet"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-panel__empty-text" }, "Code blocks, forms, and other interactive content will appear here as the AI generates them.")), /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer artifactuse-panel__footer--simple" }, j && /* @__PURE__ */ e.createElement(
1394
+ ))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__empty" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__empty-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }, /* @__PURE__ */ e.createElement("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" }), /* @__PURE__ */ e.createElement("polyline", { points: "14 2 14 8 20 8" }))), /* @__PURE__ */ e.createElement("h3", { className: "artifactuse-panel__empty-title" }, "No artifacts yet"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-panel__empty-text" }, "Code blocks, forms, and other interactive content will appear here as the AI generates them.")), /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer artifactuse-panel__footer--simple" }, We && /* @__PURE__ */ e.createElement(
1357
1395
  "a",
1358
1396
  {
1359
1397
  href: "https://artifactuse.com",
@@ -1365,10 +1403,10 @@ function ca({
1365
1403
  /* @__PURE__ */ e.createElement("span", null, "Artifactuse")
1366
1404
  )));
1367
1405
  }
1368
- function ia({ className: t = "" }) {
1369
- const { state: a, artifactCount: l, hasArtifacts: n, togglePanel: s } = ve(), r = S(() => l > 99 ? "99+" : String(l), [l]), E = [
1406
+ function fa({ className: t = "" }) {
1407
+ const { state: r, artifactCount: l, hasArtifacts: n, togglePanel: s } = _e(), a = T(() => l > 99 ? "99+" : String(l), [l]), E = [
1370
1408
  "artifactuse-panel-toggle",
1371
- a.isPanelOpen && "artifactuse-panel-toggle--active",
1409
+ r.isPanelOpen && "artifactuse-panel-toggle--active",
1372
1410
  n && "artifactuse-panel-toggle--has-artifacts",
1373
1411
  t
1374
1412
  ].filter(Boolean).join(" ");
@@ -1377,56 +1415,58 @@ function ia({ className: t = "" }) {
1377
1415
  {
1378
1416
  className: E,
1379
1417
  onClick: s,
1380
- title: a.isPanelOpen ? "Close artifacts panel" : "Open artifacts panel"
1418
+ title: r.isPanelOpen ? "Close artifacts panel" : "Open artifacts panel"
1381
1419
  },
1382
1420
  /* @__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" })),
1383
- l > 0 && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel-toggle-badge" }, r)
1421
+ l > 0 && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel-toggle-badge" }, a)
1384
1422
  );
1385
1423
  }
1386
- const ot = Pt(null);
1387
- function ea({ children: t, config: a = {} }) {
1388
- const l = z(null);
1389
- l.current || (l.current = At(a));
1390
- const n = l.current, [s, r] = N({
1424
+ const pt = Ht(null);
1425
+ 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({
1391
1429
  artifacts: [],
1392
1430
  activeArtifactId: null,
1393
1431
  isPanelOpen: !1,
1394
1432
  viewMode: "preview",
1395
1433
  isFullscreen: !1
1396
- }), [E, p] = N(() => n.getPanelTypes());
1397
- R(() => {
1398
- const f = n.state.subscribe((v) => {
1399
- r({
1400
- artifacts: v.artifacts,
1401
- activeArtifactId: v.activeArtifactId,
1402
- isPanelOpen: v.isPanelOpen,
1403
- viewMode: v.viewMode,
1404
- isFullscreen: v.isFullscreen
1434
+ }), [E, p] = b(() => n.getPanelTypes());
1435
+ q(() => {
1436
+ const f = n.state.subscribe((h) => {
1437
+ a({
1438
+ artifacts: h.artifacts,
1439
+ activeArtifactId: h.activeArtifactId,
1440
+ isPanelOpen: h.isPanelOpen,
1441
+ viewMode: h.viewMode,
1442
+ isFullscreen: h.isFullscreen
1405
1443
  });
1406
1444
  });
1407
1445
  return n.applyTheme(), () => {
1408
1446
  f(), n.destroy();
1409
1447
  };
1410
1448
  }, [n]);
1411
- const y = S(() => s.activeArtifactId && s.artifacts.find((f) => f.id === s.activeArtifactId) || null, [s.artifacts, s.activeArtifactId]), i = s.artifacts.filter((f) => !f.isInline).length, x = i > 0, A = S(() => y ? n.getPanelUrl(y) : null, [y, n]), L = d((f) => {
1449
+ const N = T(() => s.activeArtifactId && s.artifacts.find((f) => f.id === s.activeArtifactId) || null, [s.artifacts, s.activeArtifactId]), i = s.artifacts.filter((f) => !f.isInline).length, w = i > 0, S = T(() => N ? n.getPanelUrl(N) : null, [N, n]), P = d((f) => {
1412
1450
  n.setTheme(f), n.applyTheme();
1413
- }, [n]), u = d((f, v) => {
1414
- n.registerPanel(f, v), p(n.getPanelTypes());
1415
- }, [n]), h = d((f) => {
1451
+ }, [n]), m = d((f, h) => {
1452
+ n.registerPanel(f, h), p(n.getPanelTypes());
1453
+ }, [n]), g = d((f) => {
1416
1454
  n.unregisterPanel(f), p(n.getPanelTypes());
1417
- }, [n]), w = S(() => ({
1455
+ }, [n]), x = T(() => ({
1418
1456
  instance: n,
1419
1457
  state: s,
1420
- activeArtifact: y,
1458
+ activeArtifact: N,
1421
1459
  artifactCount: i,
1422
- hasArtifacts: x,
1460
+ hasArtifacts: w,
1423
1461
  // Panel computed
1424
1462
  panelTypes: E,
1425
- activePanelUrl: A,
1463
+ activePanelUrl: S,
1426
1464
  // Methods
1427
1465
  processMessage: n.processMessage,
1428
1466
  initializeContent: n.initializeContent,
1429
1467
  openArtifact: n.openArtifact,
1468
+ openFile: n.openFile,
1469
+ openCode: n.openCode,
1430
1470
  closePanel: n.closePanel,
1431
1471
  togglePanel: n.togglePanel,
1432
1472
  toggleFullscreen: n.toggleFullscreen,
@@ -1435,8 +1475,8 @@ function ea({ children: t, config: a = {} }) {
1435
1475
  sendToPanel: n.sendToPanel,
1436
1476
  // Panel management
1437
1477
  hasPanel: n.hasPanel,
1438
- registerPanel: u,
1439
- unregisterPanel: h,
1478
+ registerPanel: m,
1479
+ unregisterPanel: g,
1440
1480
  getPanelTypes: n.getPanelTypes,
1441
1481
  // Events
1442
1482
  on: n.on,
@@ -1445,76 +1485,76 @@ function ea({ children: t, config: a = {} }) {
1445
1485
  clearArtifacts: () => n.state.clear(),
1446
1486
  // Theme
1447
1487
  applyTheme: n.applyTheme,
1448
- setTheme: L,
1488
+ setTheme: P,
1449
1489
  getTheme: n.getTheme
1450
1490
  }), [
1451
1491
  n,
1452
1492
  s,
1453
- y,
1493
+ N,
1454
1494
  i,
1455
- x,
1495
+ w,
1456
1496
  E,
1457
- A,
1458
- L,
1459
- u,
1460
- h
1497
+ S,
1498
+ P,
1499
+ m,
1500
+ g
1461
1501
  ]);
1462
- return /* @__PURE__ */ e.createElement(ot.Provider, { value: w }, t);
1502
+ return /* @__PURE__ */ e.createElement(pt.Provider, { value: x }, t);
1463
1503
  }
1464
- function ve() {
1465
- const t = Tt(ot);
1504
+ function _e() {
1505
+ const t = It(pt);
1466
1506
  if (!t)
1467
1507
  throw new Error("useArtifactuse must be used within an ArtifactuseProvider");
1468
1508
  return t;
1469
1509
  }
1470
- function ta(t, a) {
1471
- const { on: l, off: n } = ve();
1472
- R(() => {
1473
- const s = l(t, a);
1510
+ function ca(t, r) {
1511
+ const { on: l, off: n } = _e();
1512
+ q(() => {
1513
+ const s = l(t, r);
1474
1514
  return () => {
1475
- typeof s == "function" ? s() : n(t, a);
1515
+ typeof s == "function" ? s() : n(t, r);
1476
1516
  };
1477
- }, [t, a, l, n]);
1517
+ }, [t, r, l, n]);
1478
1518
  }
1479
- function aa() {
1519
+ function ia() {
1480
1520
  const {
1481
1521
  registerPanel: t,
1482
- unregisterPanel: a,
1522
+ unregisterPanel: r,
1483
1523
  hasPanel: l,
1484
1524
  panelTypes: n,
1485
1525
  instance: s
1486
- } = ve(), r = d((p) => l({ type: p }), [l]), E = d((p, y = {}) => {
1526
+ } = _e(), a = d((p) => l({ type: p }), [l]), E = d((p, N = {}) => {
1487
1527
  var i;
1488
- return ((i = s.panelResolver) == null ? void 0 : i.resolve(p, y)) || null;
1528
+ return ((i = s.panelResolver) == null ? void 0 : i.resolve(p, N)) || null;
1489
1529
  }, [s]);
1490
1530
  return {
1491
1531
  register: t,
1492
- unregister: a,
1493
- isRegistered: r,
1532
+ unregister: r,
1533
+ isRegistered: a,
1494
1534
  getPanelUrl: E,
1495
1535
  types: n,
1496
- defaults: it
1536
+ defaults: dt
1497
1537
  };
1498
1538
  }
1499
- const oa = {
1500
- ArtifactuseProvider: ea,
1501
- useArtifactuse: ve,
1502
- useArtifactuseEvent: ta,
1503
- usePanelRegistry: aa,
1504
- DEFAULT_PANELS: it
1539
+ const Ea = {
1540
+ ArtifactuseProvider: la,
1541
+ useArtifactuse: _e,
1542
+ useArtifactuseEvent: ca,
1543
+ usePanelRegistry: ia,
1544
+ DEFAULT_PANELS: dt
1505
1545
  };
1506
1546
  export {
1507
- Gt as ArtifactuseAgentMessage,
1508
- It as ArtifactuseCard,
1509
- Wt as ArtifactuseInlineForm,
1510
- ca as ArtifactusePanel,
1511
- ia as ArtifactusePanelToggle,
1512
- ea as ArtifactuseProvider,
1513
- Xt as ArtifactuseSocialPreview,
1514
- Zt as ArtifactuseViewer,
1515
- it as DEFAULT_PANELS,
1516
- oa as default,
1517
- ve as useArtifactuse,
1518
- ta as useArtifactuseEvent,
1519
- aa as usePanelRegistry
1547
+ na as ArtifactuseAgentMessage,
1548
+ Rt as ArtifactuseCard,
1549
+ Ut as ArtifactuseInlineForm,
1550
+ pa as ArtifactusePanel,
1551
+ fa as ArtifactusePanelToggle,
1552
+ la as ArtifactuseProvider,
1553
+ ea as ArtifactuseSocialPreview,
1554
+ ta as ArtifactuseViewer,
1555
+ dt as DEFAULT_PANELS,
1556
+ Ea as default,
1557
+ _e as useArtifactuse,
1558
+ ca as useArtifactuseEvent,
1559
+ ia as usePanelRegistry
1520
1560
  };