artifactuse 0.3.2 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,210 +1,210 @@
1
- import e, { useState as y, useMemo as w, useCallback as d, useRef as V, useEffect as B, createContext as na, useContext as sa } from "react";
2
- import { g as Ze, f as St, a as mt, b as dt, n as la, i as Tt, c as ca, D as $t, d as ia } from "../index-ABusvYh9.js";
3
- import { J as oa } from "../jszip.min-CdmYyw5L.js";
4
- import { createPortal as ua } from "react-dom";
5
- function ma({
1
+ import e, { useState as y, useMemo as N, useCallback as d, useRef as F, useEffect as I, createContext as Ea, useContext as va } from "react";
2
+ import { g as Qe, f as Rt, a as Et, b as vt, n as ha, i as Ht, c as ga, D as zt, d as _a } from "../index-CBGheZYZ.js";
3
+ import { b as ya, g as Bt, r as Ft, J as ba } from "../jszip.min-BdBnWAEK.js";
4
+ import { createPortal as Na } from "react-dom";
5
+ function wa({
6
6
  artifact: t,
7
- isActive: r = !1,
7
+ isActive: n = !1,
8
8
  onOpen: c,
9
9
  onCopy: l,
10
10
  onDownload: i,
11
11
  className: u = ""
12
12
  }) {
13
- const [h, E] = y(!1), o = w(() => Ze(t.language), [t.language]), a = w(() => {
14
- var x;
15
- return St(t.size || ((x = t.code) == null ? void 0 : x.length) || 0);
16
- }, [t.size, t.code]), k = w(() => mt(t.language), [t.language]), P = d((x) => {
17
- x.stopPropagation(), c && c(t);
18
- }, [t, c]), $ = d(async (x) => {
19
- x.stopPropagation();
13
+ const [g, v] = y(!1), o = N(() => Qe(t.language), [t.language]), a = N(() => {
14
+ var L;
15
+ return Rt(t.size || ((L = t.code) == null ? void 0 : L.length) || 0);
16
+ }, [t.size, t.code]), x = N(() => Et(t.language), [t.language]), S = d((L) => {
17
+ L.stopPropagation(), c && c(t);
18
+ }, [t, c]), A = d(async (L) => {
19
+ L.stopPropagation();
20
20
  try {
21
- await navigator.clipboard.writeText(t.code), E(!0), l && l(t), setTimeout(() => {
22
- E(!1);
21
+ await navigator.clipboard.writeText(t.code), v(!0), l && l(t), setTimeout(() => {
22
+ v(!1);
23
23
  }, 2e3);
24
24
  } catch {
25
25
  const s = document.createElement("textarea");
26
26
  s.value = t.code, s.style.position = "fixed", s.style.opacity = "0", document.body.appendChild(s), s.select();
27
27
  try {
28
- document.execCommand("copy"), E(!0), l && l(t), setTimeout(() => {
29
- E(!1);
28
+ document.execCommand("copy"), v(!0), l && l(t), setTimeout(() => {
29
+ v(!1);
30
30
  }, 2e3);
31
- } catch (O) {
32
- console.error("Failed to copy:", O);
31
+ } catch (Z) {
32
+ console.error("Failed to copy:", Z);
33
33
  }
34
34
  document.body.removeChild(s);
35
35
  }
36
- }, [t, l]), W = d((x) => {
37
- var F;
38
- x.stopPropagation();
39
- const p = new Blob([t.code], { type: "text/plain" }), s = URL.createObjectURL(p), O = document.createElement("a"), X = dt(t.editorLanguage || t.language), z = ((F = t.title) == null ? void 0 : F.replace(/[^a-z0-9]/gi, "_").toLowerCase()) || "code";
40
- O.href = s, O.download = `${z}.${X}`, document.body.appendChild(O), O.click(), document.body.removeChild(O), URL.revokeObjectURL(s), i && i(t);
36
+ }, [t, l]), R = d((L) => {
37
+ var V;
38
+ L.stopPropagation();
39
+ const p = new Blob([t.code], { type: "text/plain" }), s = URL.createObjectURL(p), Z = document.createElement("a"), Y = vt(t.editorLanguage || t.language), z = ((V = t.title) == null ? void 0 : V.replace(/[^a-z0-9]/gi, "_").toLowerCase()) || "code";
40
+ Z.href = s, Z.download = `${z}.${Y}`, document.body.appendChild(Z), Z.click(), document.body.removeChild(Z), URL.revokeObjectURL(s), i && i(t);
41
41
  }, [t, i]), _ = [
42
42
  "artifactuse-card",
43
- r && "artifactuse-card--active",
43
+ n && "artifactuse-card--active",
44
44
  u
45
45
  ].filter(Boolean).join(" ");
46
- return /* @__PURE__ */ e.createElement("div", { className: _, onClick: P }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__icon" }, /* @__PURE__ */ e.createElement(
46
+ return /* @__PURE__ */ e.createElement("div", { className: _, 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: k }
53
+ dangerouslySetInnerHTML: { __html: x }
54
54
  }
55
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" }, o), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__separator" }, "•"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__size" }, a))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__actions" }, /* @__PURE__ */ e.createElement(
56
56
  "button",
57
57
  {
58
58
  className: "artifactuse-card__action",
59
- title: h ? "Copied!" : "Copy code",
60
- onClick: $
59
+ title: g ? "Copied!" : "Copy code",
60
+ onClick: A
61
61
  },
62
- h ? /* @__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" }))
62
+ g ? /* @__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(
64
64
  "button",
65
65
  {
66
66
  className: "artifactuse-card__action",
67
67
  title: "Download file",
68
- onClick: W
68
+ onClick: R
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 da(t) {
73
+ function ka(t) {
74
74
  if (!t) return null;
75
- const r = t.trim();
76
- if (r.startsWith("#")) {
77
- let i = r.slice(1);
75
+ const n = t.trim();
76
+ if (n.startsWith("#")) {
77
+ let i = n.slice(1);
78
78
  if (i.length === 3 && (i = i.split("").map((u) => u + u).join("")), i.length === 6) {
79
- const u = parseInt(i.slice(0, 2), 16), h = parseInt(i.slice(2, 4), 16), E = parseInt(i.slice(4, 6), 16);
80
- if (!isNaN(u) && !isNaN(h) && !isNaN(E)) return `${u}, ${h}, ${E}`;
79
+ const u = parseInt(i.slice(0, 2), 16), g = parseInt(i.slice(2, 4), 16), v = parseInt(i.slice(4, 6), 16);
80
+ if (!isNaN(u) && !isNaN(g) && !isNaN(v)) return `${u}, ${g}, ${v}`;
81
81
  }
82
82
  }
83
- const c = r.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
83
+ const c = n.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
84
84
  if (c) return `${c[1]}, ${c[2]}, ${c[3]}`;
85
- const l = r.split(/[\s,]+/).map(Number).filter((i) => !isNaN(i));
85
+ const l = n.split(/[\s,]+/).map(Number).filter((i) => !isNaN(i));
86
86
  return l.length >= 3 ? `${l[0]}, ${l[1]}, ${l[2]}` : null;
87
87
  }
88
- function Mt(t) {
89
- return t ? t.map((r) => typeof r == "string" ? { label: r, value: r } : r) : [];
88
+ function It(t) {
89
+ return t ? t.map((n) => typeof n == "string" ? { label: n, value: n } : n) : [];
90
90
  }
91
- function fa(t) {
91
+ function xa(t) {
92
92
  return ["text", "email", "password", "tel", "url", "number", "date", "time", "datetime-local"].includes(t);
93
93
  }
94
- function pa({
94
+ function Ca({
95
95
  artifact: t,
96
- onSubmit: r,
96
+ onSubmit: n,
97
97
  onCancel: c,
98
98
  onReset: l,
99
99
  onButtonClick: i,
100
100
  className: u = "",
101
- theme: h = "dark",
102
- accent: E = null,
101
+ theme: g = "dark",
102
+ accent: v = null,
103
103
  initialState: o = "active"
104
104
  // 'active' | 'submitted' | 'cancelled' | 'inactive'
105
105
  }) {
106
- var me, _e, de;
107
- const a = V(null), [k, P] = y(o), $ = k !== "active", W = k === "active" ? "" : `artifactuse-form--${k}`, _ = w(() => {
106
+ var fe, be, pe;
107
+ const a = F(null), [x, S] = y(o), A = x !== "active", R = x === "active" ? "" : `artifactuse-form--${x}`, _ = N(() => {
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]), x = t.id || _.id || `form-${Date.now()}`, p = ((me = _.data) == null ? void 0 : me.fields) || [], s = _.title || "Form", O = w(() => p.some((m) => m.type === "buttons"), [p]), X = w(() => _.variant === "buttons" ? p : [], [_.variant, p]), [z, F] = y(() => {
114
- var S;
113
+ }, [t.code]), L = t.id || _.id || `form-${Date.now()}`, p = ((fe = _.data) == null ? void 0 : fe.fields) || [], s = _.title || "Form", Z = N(() => p.some((m) => m.type === "buttons"), [p]), Y = N(() => _.variant === "buttons" ? p : [], [_.variant, p]), [z, V] = y(() => {
114
+ var $;
115
115
  const m = {};
116
116
  return p.forEach((b) => {
117
117
  ["buttons", "divider", "heading"].includes(b.type) || (b.defaultValue !== void 0 ? m[b.name] = b.defaultValue : b.type === "checkbox" ? m[b.name] = !1 : m[b.name] = "");
118
- }), (S = _.data) != null && S.defaults && Object.assign(m, _.data.defaults), m;
119
- }), [te, q] = y({}), [D, H] = y(!1);
120
- B(() => {
121
- P(o);
122
- }, [o]), B(() => {
123
- var S;
118
+ }), ($ = _.data) != null && $.defaults && Object.assign(m, _.data.defaults), m;
119
+ }), [se, U] = y({}), [q, H] = y(!1);
120
+ I(() => {
121
+ S(o);
122
+ }, [o]), I(() => {
123
+ var $;
124
124
  const m = {};
125
125
  p.forEach((b) => {
126
126
  ["buttons", "divider", "heading"].includes(b.type) || (b.defaultValue !== void 0 ? m[b.name] = b.defaultValue : b.type === "checkbox" ? m[b.name] = !1 : m[b.name] = "");
127
- }), (S = _.data) != null && S.defaults && Object.assign(m, _.data.defaults), F(m), q({});
128
- }, [t.code]), B(() => {
129
- if (a.current && (a.current.setAttribute("data-artifactuse-theme", h), E)) {
130
- const m = da(E);
127
+ }), ($ = _.data) != null && $.defaults && Object.assign(m, _.data.defaults), V(m), U({});
128
+ }, [t.code]), I(() => {
129
+ if (a.current && (a.current.setAttribute("data-artifactuse-theme", g), v)) {
130
+ const m = ka(v);
131
131
  m && a.current.style.setProperty("--artifactuse-primary", m);
132
132
  }
133
- }, [h, E]);
134
- const Z = d((m) => {
135
- P(m);
136
- }, []), he = d((m, S) => {
137
- F((b) => ({ ...b, [m]: S })), q((b) => {
138
- const N = { ...b };
139
- return delete N[m], N;
133
+ }, [g, v]);
134
+ const G = d((m) => {
135
+ S(m);
136
+ }, []), _e = d((m, $) => {
137
+ V((b) => ({ ...b, [m]: $ })), U((b) => {
138
+ const k = { ...b };
139
+ return delete k[m], k;
140
140
  });
141
- }, []), le = d(() => {
141
+ }, []), ie = d(() => {
142
142
  var b;
143
143
  const m = {};
144
- p.forEach((N) => {
145
- if (["buttons", "divider", "heading"].includes(N.type)) return;
146
- const M = z[N.name];
147
- if (N.required && !M && M !== 0 && M !== !1) {
148
- m[N.name] = `${N.label || "This field"} is required`;
144
+ p.forEach((k) => {
145
+ if (["buttons", "divider", "heading"].includes(k.type)) return;
146
+ const P = z[k.name];
147
+ if (k.required && !P && P !== 0 && P !== !1) {
148
+ m[k.name] = `${k.label || "This field"} is required`;
149
149
  return;
150
150
  }
151
- if (N.pattern && M && !new RegExp(N.pattern).test(M)) {
152
- m[N.name] = N.patternMessage || `${N.label || "This field"} is invalid`;
151
+ if (k.pattern && P && !new RegExp(k.pattern).test(P)) {
152
+ m[k.name] = k.patternMessage || `${k.label || "This field"} is invalid`;
153
153
  return;
154
154
  }
155
- if (N.type === "email" && M && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(M)) {
156
- m[N.name] = "Please enter a valid email address";
155
+ if (k.type === "email" && P && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(P)) {
156
+ m[k.name] = "Please enter a valid email address";
157
157
  return;
158
158
  }
159
- if (N.minLength && M && M.length < N.minLength) {
160
- m[N.name] = `Minimum ${N.minLength} characters required`;
159
+ if (k.minLength && P && P.length < k.minLength) {
160
+ m[k.name] = `Minimum ${k.minLength} characters required`;
161
161
  return;
162
162
  }
163
- if (N.maxLength && M && M.length > N.maxLength) {
164
- m[N.name] = `Maximum ${N.maxLength} characters allowed`;
163
+ if (k.maxLength && P && P.length > k.maxLength) {
164
+ m[k.name] = `Maximum ${k.maxLength} characters allowed`;
165
165
  return;
166
166
  }
167
167
  });
168
- const S = (b = _.data) == null ? void 0 : b.validation;
169
- return S && Object.entries(S).forEach(([N, M]) => {
170
- if (m[N]) return;
171
- const L = z[N];
172
- M.pattern && L && (new RegExp(M.pattern).test(L) || (m[N] = M.message || `${N} is invalid`));
173
- }), q(m), Object.keys(m).length === 0;
174
- }, [p, z, (_e = _.data) == null ? void 0 : _e.validation]), ge = d(() => {
175
- var S;
168
+ const $ = (b = _.data) == null ? void 0 : b.validation;
169
+ return $ && Object.entries($).forEach(([k, P]) => {
170
+ if (m[k]) return;
171
+ const M = z[k];
172
+ P.pattern && M && (new RegExp(P.pattern).test(M) || (m[k] = P.message || `${k} is invalid`));
173
+ }), U(m), Object.keys(m).length === 0;
174
+ }, [p, z, (be = _.data) == null ? void 0 : be.validation]), ye = d(() => {
175
+ var $;
176
176
  const m = {};
177
177
  p.forEach((b) => {
178
178
  ["buttons", "divider", "heading"].includes(b.type) || (b.defaultValue !== void 0 ? m[b.name] = b.defaultValue : b.type === "checkbox" ? m[b.name] = !1 : m[b.name] = "");
179
- }), (S = _.data) != null && S.defaults && Object.assign(m, _.data.defaults), F(m), q({});
180
- }, [p, (de = _.data) == null ? void 0 : de.defaults]), ce = d((m) => {
181
- m == null || m.preventDefault(), le() && (H(!0), r == null || r({
182
- formId: x,
179
+ }), ($ = _.data) != null && $.defaults && Object.assign(m, _.data.defaults), V(m), U({});
180
+ }, [p, (pe = _.data) == null ? void 0 : pe.defaults]), oe = d((m) => {
181
+ m == null || m.preventDefault(), ie() && (H(!0), n == null || n({
182
+ formId: L,
183
183
  action: "submit",
184
184
  values: { ...z },
185
185
  timestamp: Date.now()
186
186
  }), setTimeout(() => {
187
- H(!1), Z("submitted");
187
+ H(!1), G("submitted");
188
188
  }, 300));
189
- }, [x, z, r, le, Z]), ue = d((m) => {
190
- const S = m.action || "custom";
191
- switch (S) {
189
+ }, [L, z, n, ie, G]), de = d((m) => {
190
+ const $ = m.action || "custom";
191
+ switch ($) {
192
192
  case "submit":
193
- ce();
193
+ oe();
194
194
  break;
195
195
  case "cancel":
196
196
  c == null || c({
197
- formId: x,
197
+ formId: L,
198
198
  action: "cancel",
199
199
  buttonName: m.name || "cancel",
200
200
  timestamp: Date.now()
201
201
  }), setTimeout(() => {
202
- Z("cancelled");
202
+ G("cancelled");
203
203
  }, 150);
204
204
  break;
205
205
  case "reset":
206
- ge(), l == null || l({
207
- formId: x,
206
+ ye(), l == null || l({
207
+ formId: L,
208
208
  action: "reset",
209
209
  buttonName: m.name || "reset",
210
210
  timestamp: Date.now()
@@ -213,42 +213,42 @@ function pa({
213
213
  case "custom":
214
214
  default:
215
215
  i == null || i({
216
- formId: x,
217
- action: S,
216
+ formId: L,
217
+ action: $,
218
218
  buttonName: m.name || m.label,
219
219
  buttonLabel: m.label,
220
220
  values: { ...z },
221
221
  timestamp: Date.now()
222
222
  }), setTimeout(() => {
223
- Z("submitted");
223
+ G("submitted");
224
224
  }, 150);
225
225
  break;
226
226
  }
227
- }, [x, z, ce, c, l, i, ge, Z]);
228
- return $ ? /* @__PURE__ */ e.createElement(
227
+ }, [L, z, oe, c, l, i, ye, G]);
228
+ return A ? /* @__PURE__ */ e.createElement(
229
229
  "div",
230
230
  {
231
231
  ref: a,
232
- className: `artifactuse-inline-form artifactuse-form-${_.variant || "fields"} ${W} ${u}`,
233
- "data-artifactuse-theme": h
232
+ className: `artifactuse-inline-form artifactuse-form-${_.variant || "fields"} ${R} ${u}`,
233
+ "data-artifactuse-theme": g
234
234
  },
235
- /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-collapsed" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-collapsed-icon" }, k === "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" })), k === "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" })), k === "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" }, s))
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" }, s))
236
236
  ) : _.variant === "buttons" ? /* @__PURE__ */ e.createElement(
237
237
  "div",
238
238
  {
239
239
  ref: a,
240
240
  className: `artifactuse-inline-form artifactuse-form-buttons ${u}`,
241
- "data-artifactuse-theme": h
241
+ "data-artifactuse-theme": g
242
242
  },
243
243
  (_.title || _.description) && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-header" }, _.title && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-title" }, _.title), _.description && /* @__PURE__ */ e.createElement("p", { className: "artifactuse-form-description" }, _.description)),
244
- /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, X.map((m, S) => /* @__PURE__ */ e.createElement(
244
+ /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, Y.map((m, $) => /* @__PURE__ */ e.createElement(
245
245
  "button",
246
246
  {
247
- key: m.name || m.label || S,
247
+ key: m.name || m.label || $,
248
248
  type: "button",
249
249
  className: `artifactuse-form-btn artifactuse-form-btn-${m.variant || "secondary"}`,
250
- onClick: () => ue(m),
251
- disabled: m.disabled || D
250
+ onClick: () => de(m),
251
+ disabled: m.disabled || q
252
252
  },
253
253
  m.icon && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-btn-icon", dangerouslySetInnerHTML: { __html: m.icon } }),
254
254
  m.label
@@ -258,27 +258,27 @@ function pa({
258
258
  {
259
259
  ref: a,
260
260
  className: `artifactuse-inline-form artifactuse-form-fields ${u}`,
261
- "data-artifactuse-theme": h
261
+ "data-artifactuse-theme": g
262
262
  },
263
263
  (_.title || _.description) && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-header" }, _.title && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-title" }, _.title), _.description && /* @__PURE__ */ e.createElement("p", { className: "artifactuse-form-description" }, _.description)),
264
- /* @__PURE__ */ e.createElement("form", { onSubmit: ce, className: "artifactuse-form" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-fields" }, p.map((m, S) => /* @__PURE__ */ e.createElement(
265
- Ea,
264
+ /* @__PURE__ */ e.createElement("form", { onSubmit: oe, className: "artifactuse-form" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-fields" }, p.map((m, $) => /* @__PURE__ */ e.createElement(
265
+ La,
266
266
  {
267
- key: m.name || S,
267
+ key: m.name || $,
268
268
  field: m,
269
- formId: x,
269
+ formId: L,
270
270
  value: z[m.name],
271
- error: te[m.name],
272
- isSubmitting: D,
273
- onChange: (b) => he(m.name, b),
274
- onButtonAction: ue
271
+ error: se[m.name],
272
+ isSubmitting: q,
273
+ onChange: (b) => _e(m.name, b),
274
+ onButtonAction: de
275
275
  }
276
- ))), !O && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons artifactuse-form-buttons-default" }, /* @__PURE__ */ e.createElement(
276
+ ))), !Z && /* @__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: () => ue({ action: "cancel", label: "Cancel" })
281
+ onClick: () => de({ action: "cancel", label: "Cancel" })
282
282
  },
283
283
  "Cancel"
284
284
  ), /* @__PURE__ */ e.createElement(
@@ -286,23 +286,23 @@ function pa({
286
286
  {
287
287
  type: "submit",
288
288
  className: "artifactuse-form-btn artifactuse-form-btn-primary",
289
- disabled: D
289
+ disabled: q
290
290
  },
291
- D && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-btn-spinner" }),
292
- D ? "Submitting..." : "Submit"
291
+ q && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-btn-spinner" }),
292
+ q ? "Submitting..." : "Submit"
293
293
  )))
294
294
  );
295
295
  }
296
- function Ea({ field: t, formId: r, value: c, error: l, isSubmitting: i, onChange: u, onButtonAction: h }) {
297
- const E = `${r}-${t.name}`;
296
+ function La({ field: t, formId: n, value: c, error: l, isSubmitting: i, onChange: u, onButtonAction: g }) {
297
+ const v = `${n}-${t.name}`;
298
298
  if (t.type === "buttons")
299
- return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, (t.fields || []).map((a, k) => /* @__PURE__ */ e.createElement(
299
+ return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, (t.fields || []).map((a, x) => /* @__PURE__ */ e.createElement(
300
300
  "button",
301
301
  {
302
- key: a.name || a.label || k,
302
+ key: a.name || a.label || x,
303
303
  type: a.action === "submit" ? "submit" : "button",
304
304
  className: `artifactuse-form-btn artifactuse-form-btn-${a.variant || "secondary"}`,
305
- onClick: a.action !== "submit" ? () => h(a) : void 0,
305
+ onClick: a.action !== "submit" ? () => g(a) : void 0,
306
306
  disabled: a.disabled || a.action === "submit" && i
307
307
  },
308
308
  i && a.action === "submit" ? /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-btn-spinner" }) : a.icon ? /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-btn-icon", dangerouslySetInnerHTML: { __html: a.icon } }) : null,
@@ -317,7 +317,7 @@ function Ea({ field: t, formId: r, value: c, error: l, isSubmitting: i, onChange
317
317
  "input",
318
318
  {
319
319
  type: "checkbox",
320
- id: E,
320
+ id: v,
321
321
  name: t.name,
322
322
  checked: c || !1,
323
323
  disabled: t.disabled,
@@ -326,7 +326,7 @@ function Ea({ field: t, formId: r, value: c, error: l, isSubmitting: i, onChange
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), l && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-error-text" }, l));
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" }, Mt(t.options).map((a) => /* @__PURE__ */ e.createElement("label", { key: a.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" }, It(t.options).map((a) => /* @__PURE__ */ e.createElement("label", { key: a.value, className: "artifactuse-radio-label" }, /* @__PURE__ */ e.createElement(
330
330
  "input",
331
331
  {
332
332
  type: "radio",
@@ -338,11 +338,11 @@ function Ea({ field: t, formId: r, value: c, error: l, isSubmitting: i, onChange
338
338
  onChange: () => u(a.value)
339
339
  }
340
340
  ), /* @__PURE__ */ e.createElement("span", null, a.label)))), t.helpText && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-help-text" }, t.helpText), l && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-error-text" }, l));
341
- const o = () => fa(t.type) ? /* @__PURE__ */ e.createElement(
341
+ const o = () => xa(t.type) ? /* @__PURE__ */ e.createElement(
342
342
  "input",
343
343
  {
344
344
  type: t.type,
345
- id: E,
345
+ id: v,
346
346
  name: t.name,
347
347
  value: c || "",
348
348
  placeholder: t.placeholder,
@@ -354,7 +354,7 @@ function Ea({ field: t, formId: r, value: c, error: l, isSubmitting: i, onChange
354
354
  ) : t.type === "textarea" ? /* @__PURE__ */ e.createElement(
355
355
  "textarea",
356
356
  {
357
- id: E,
357
+ id: v,
358
358
  name: t.name,
359
359
  value: c || "",
360
360
  placeholder: t.placeholder,
@@ -367,7 +367,7 @@ function Ea({ field: t, formId: r, value: c, error: l, isSubmitting: i, onChange
367
367
  ) : t.type === "select" ? /* @__PURE__ */ e.createElement(
368
368
  "select",
369
369
  {
370
- id: E,
370
+ id: v,
371
371
  name: t.name,
372
372
  value: c || "",
373
373
  disabled: t.disabled,
@@ -376,12 +376,12 @@ function Ea({ field: t, formId: r, value: c, error: l, isSubmitting: i, onChange
376
376
  onChange: (a) => u(a.target.value)
377
377
  },
378
378
  /* @__PURE__ */ e.createElement("option", { value: "" }, t.placeholder || "Select..."),
379
- Mt(t.options).map((a) => /* @__PURE__ */ e.createElement("option", { key: a.value, value: a.value, disabled: a.disabled }, a.label))
379
+ It(t.options).map((a) => /* @__PURE__ */ e.createElement("option", { key: a.value, value: a.value, disabled: a.disabled }, a.label))
380
380
  ) : /* @__PURE__ */ e.createElement(
381
381
  "input",
382
382
  {
383
383
  type: "text",
384
- id: E,
384
+ id: v,
385
385
  name: t.name,
386
386
  value: c || "",
387
387
  disabled: t.disabled,
@@ -389,9 +389,9 @@ function Ea({ field: t, formId: r, value: c, error: l, isSubmitting: i, onChange
389
389
  onChange: (a) => u(a.target.value)
390
390
  }
391
391
  );
392
- return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-field" }, /* @__PURE__ */ e.createElement("label", { htmlFor: E, className: "artifactuse-label" }, t.label, t.required && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-required" }, "*")), o(), t.helpText && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-help-text" }, t.helpText), l && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-error-text" }, l));
392
+ return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-field" }, /* @__PURE__ */ e.createElement("label", { htmlFor: v, className: "artifactuse-label" }, t.label, t.required && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-required" }, "*")), o(), t.helpText && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-help-text" }, t.helpText), l && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-error-text" }, l));
393
393
  }
394
- const J = '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>', va = {
394
+ const K = '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>', Ta = {
395
395
  twitter: 280,
396
396
  linkedin: 3e3,
397
397
  instagram: 2200,
@@ -399,7 +399,7 @@ const J = '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
- }, ha = {
402
+ }, Ma = {
403
403
  twitter: "X",
404
404
  linkedin: "LinkedIn",
405
405
  instagram: "Instagram",
@@ -407,130 +407,130 @@ const J = '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
- }, Ke = ({ 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" })), R = (t) => t ? t >= 1e6 ? `${(t / 1e6).toFixed(1)}M` : t >= 1e3 ? `${(t / 1e3).toFixed(1)}K` : t.toString() : "0", ft = (t) => {
410
+ }, et = ({ 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" })), D = (t) => t ? t >= 1e6 ? `${(t / 1e6).toFixed(1)}M` : t >= 1e3 ? `${(t / 1e3).toFixed(1)}K` : t.toString() : "0", ht = (t) => {
411
411
  try {
412
412
  return new URL(t).hostname.replace("www.", "");
413
413
  } catch {
414
414
  return t;
415
415
  }
416
- }, Te = (t) => {
416
+ }, $e = (t) => {
417
417
  if (!t) return "";
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
- }, Pt = ({ author: t, content: r, engagement: c, meta: l }) => {
421
- var h, E, o;
422
- const i = r.media || [], u = c.likes || c.retweets || c.replies || c.views;
423
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || J, alt: t.name, className: "artifactuse-social-avatar", onError: (a) => a.target.src = J }), /* @__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(Ke, { 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" }, "· ", l.timestamp || "Just now")))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: Te(r.text) } }), i.length > 0 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, /* @__PURE__ */ e.createElement("div", { className: `artifactuse-social-media-grid ${i.length === 1 ? "artifactuse-social-media-single" : ""}`, "data-count": i.length }, i.slice(0, 4).map((a, k) => /* @__PURE__ */ e.createElement("img", { key: k, src: a.url, alt: a.alt || "", onError: (P) => P.target.style.display = "none" })))), r.link && !i.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: (a) => a.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 || ft(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((a, k) => {
424
- var P, $;
425
- return /* @__PURE__ */ e.createElement("div", { key: k, className: "artifactuse-social-poll-option" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-bar", style: { width: `${((P = r.poll.votes) == null ? void 0 : P[k]) || 0}%` } }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-label" }, /* @__PURE__ */ e.createElement("span", null, a), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-poll-percent" }, (($ = r.poll.votes) == null ? void 0 : $[k]) || 0, "%")));
426
- }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-meta" }, R(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: ((h = r.quote.author) == null ? void 0 : h.avatar) || J, className: "artifactuse-social-quote-avatar", alt: "" }), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-quote-author" }, (E = r.quote.author) == null ? void 0 : E.name), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-quote-handle" }, (o = r.quote.author) == null ? void 0 : o.handle)), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-quote-text" }, r.quote.text))), u && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, R(c.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, R(c.retweets || 0), " reposts"), /* @__PURE__ */ e.createElement("span", null, R(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, R(c.views || 0), " views")));
427
- }, ga = ({ author: t, content: r, engagement: c, meta: l }) => {
418
+ let n = t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
419
+ return n = n.replace(/\n/g, "<br>"), n = n.replace(/#(\w+)/g, '<span class="artifactuse-social-hashtag">#$1</span>'), n = n.replace(/@(\w+)/g, '<span class="artifactuse-social-mention">@$1</span>'), n;
420
+ }, Vt = ({ author: t, content: n, engagement: c, meta: l }) => {
421
+ var g, v, o;
422
+ const i = n.media || [], u = c.likes || c.retweets || c.replies || c.views;
423
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || K, alt: t.name, className: "artifactuse-social-avatar", onError: (a) => a.target.src = K }), /* @__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(et, { 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" }, "· ", l.timestamp || "Just now")))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: $e(n.text) } }), i.length > 0 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, /* @__PURE__ */ e.createElement("div", { className: `artifactuse-social-media-grid ${i.length === 1 ? "artifactuse-social-media-single" : ""}`, "data-count": i.length }, i.slice(0, 4).map((a, x) => /* @__PURE__ */ e.createElement("img", { key: x, src: a.url, alt: a.alt || "", onError: (S) => S.target.style.display = "none" })))), n.link && !i.length && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, n.link.image && /* @__PURE__ */ e.createElement("img", { src: n.link.image, alt: n.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-domain" }, n.link.domain || ht(n.link.url)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, n.link.title), n.link.description && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-description" }, n.link.description))), n.poll && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll" }, n.poll.options.map((a, x) => {
424
+ var S, A;
425
+ return /* @__PURE__ */ e.createElement("div", { key: x, className: "artifactuse-social-poll-option" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-bar", style: { width: `${((S = n.poll.votes) == null ? void 0 : S[x]) || 0}%` } }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-label" }, /* @__PURE__ */ e.createElement("span", null, a), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-poll-percent" }, ((A = n.poll.votes) == null ? void 0 : A[x]) || 0, "%")));
426
+ }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-meta" }, D(n.poll.totalVotes || 0), " votes · ", n.poll.duration || "Poll ended")), n.quote && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-quote" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-quote-header" }, /* @__PURE__ */ e.createElement("img", { src: ((g = n.quote.author) == null ? void 0 : g.avatar) || K, className: "artifactuse-social-quote-avatar", alt: "" }), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-quote-author" }, (v = n.quote.author) == null ? void 0 : v.name), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-quote-handle" }, (o = n.quote.author) == null ? void 0 : o.handle)), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-quote-text" }, n.quote.text))), u && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, D(c.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, D(c.retweets || 0), " reposts"), /* @__PURE__ */ e.createElement("span", null, D(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, D(c.views || 0), " views")));
427
+ }, Pa = ({ author: t, content: n, engagement: c, meta: l }) => {
428
428
  const i = c.likes || c.comments || c.shares || c.reposts;
429
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || J, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = J }), /* @__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" }, l.timestamp || "Just now", " · 🌐"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: Te(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: (u) => u.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 || ft(r.link.url))))), i && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, R(c.likes || 0), " reactions"), /* @__PURE__ */ e.createElement("span", null, R(c.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, R(c.shares || c.reposts || 0), " reposts")));
430
- }, _a = ({ author: t, content: r, engagement: c, meta: l }) => {
431
- const i = 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 || J, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = J }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement(Ke, { type: "blue" })), l.location && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-location" }, l.location))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, i[0] ? /* @__PURE__ */ e.createElement("img", { src: i[0].url, alt: i[0].alt || "", onError: (u) => u.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media-placeholder" })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-likes" }, R(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-caption" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-caption-author" }, t.name), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-caption-text", dangerouslySetInnerHTML: { __html: Te(r.text) } })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-timestamp" }, l.timestamp || "JUST NOW"));
433
- }, ya = ({ author: t, content: r, engagement: c, meta: l }) => {
434
- const i = r.media || [], u = w(() => {
435
- const E = c.reactions || {};
436
- return Object.values(E).reduce((o, a) => o + (a || 0), 0) || c.likes || 0;
437
- }, [c]), h = c.likes || c.comments || c.shares || u;
438
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || J, alt: t.name, className: "artifactuse-social-avatar", onError: (E) => E.target.src = J }), /* @__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" }, l.timestamp || "Just now", " · 🌐"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: Te(r.text) } }), i.length > 0 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media-grid", "data-count": i.length }, i.slice(0, 4).map((E, o) => /* @__PURE__ */ e.createElement("img", { key: o, src: E.url, alt: E.alt || "", onError: (a) => a.target.style.display = "none" })))), r.link && !i.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: (E) => E.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 || ft(r.link.url)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, r.link.title)))), h && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, "👍❤️ ", R(u)), /* @__PURE__ */ e.createElement("span", null, R(c.comments || 0), " comments · ", R(c.shares || 0), " shares")));
439
- }, ba = ({ author: t, content: r, engagement: c, meta: l }) => {
429
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || K, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = K }), /* @__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" }, l.timestamp || "Just now", " · 🌐"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: $e(n.text) } }), n.link && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, n.link.image && /* @__PURE__ */ e.createElement("img", { src: n.link.image, alt: n.link.title, className: "artifactuse-social-link-image", onError: (u) => u.target.style.display = "none" }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, n.link.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-domain" }, n.link.domain || ht(n.link.url))))), i && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, D(c.likes || 0), " reactions"), /* @__PURE__ */ e.createElement("span", null, D(c.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, D(c.shares || c.reposts || 0), " reposts")));
430
+ }, Sa = ({ author: t, content: n, engagement: c, meta: l }) => {
431
+ const i = n.media || [];
432
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || K, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = K }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement(et, { type: "blue" })), l.location && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-location" }, l.location))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, i[0] ? /* @__PURE__ */ e.createElement("img", { src: i[0].url, alt: i[0].alt || "", onError: (u) => u.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media-placeholder" })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-likes" }, D(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-caption" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-caption-author" }, t.name), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-caption-text", dangerouslySetInnerHTML: { __html: $e(n.text) } })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-timestamp" }, l.timestamp || "JUST NOW"));
433
+ }, $a = ({ author: t, content: n, engagement: c, meta: l }) => {
434
+ const i = n.media || [], u = N(() => {
435
+ const v = c.reactions || {};
436
+ return Object.values(v).reduce((o, a) => o + (a || 0), 0) || c.likes || 0;
437
+ }, [c]), g = c.likes || c.comments || c.shares || u;
438
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || K, alt: t.name, className: "artifactuse-social-avatar", onError: (v) => v.target.src = K }), /* @__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" }, l.timestamp || "Just now", " · 🌐"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: $e(n.text) } }), i.length > 0 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media-grid", "data-count": i.length }, i.slice(0, 4).map((v, o) => /* @__PURE__ */ e.createElement("img", { key: o, src: v.url, alt: v.alt || "", onError: (a) => a.target.style.display = "none" })))), n.link && !i.length && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, n.link.image && /* @__PURE__ */ e.createElement("img", { src: n.link.image, alt: n.link.title, className: "artifactuse-social-link-image", onError: (v) => v.target.style.display = "none" }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-domain" }, n.link.domain || ht(n.link.url)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, n.link.title)))), g && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, "👍❤️ ", D(u)), /* @__PURE__ */ e.createElement("span", null, D(c.comments || 0), " comments · ", D(c.shares || 0), " shares")));
439
+ }, Aa = ({ author: t, content: n, engagement: c, meta: l }) => {
440
440
  const i = c.likes || c.replies || c.reposts;
441
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || J, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = J }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement(Ke, { type: "blue" }))), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-timestamp" }, l.timestamp || "Just now")), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: Te(r.text) } })), i && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, R(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, R(c.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, R(c.reposts || 0), " reposts")));
442
- }, Na = ({ author: t, content: r, engagement: c, meta: l }) => {
443
- const i = r.media || [], u = c.likes || c.comments || c.shares;
444
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, i[0] ? /* @__PURE__ */ e.createElement("img", { src: i[0].url, alt: "Video thumbnail", onError: (h) => h.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 || J, alt: t.name, className: "artifactuse-social-avatar", onError: (h) => h.target.src = J }), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-author-name" }, "@", t.name), t.verified && /* @__PURE__ */ e.createElement(Ke, { type: "blue" })), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: Te(r.text) } }), r.sound && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-sound" }, "🎵 ", r.sound)), u && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, R(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, R(c.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, R(c.shares || 0), " shares")));
445
- }, wa = ({ author: t, content: r, engagement: c, meta: l }) => {
446
- const i = r.media || [];
447
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, i[0] ? /* @__PURE__ */ e.createElement("img", { src: i[0].url, alt: "Video thumbnail", onError: (u) => u.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 || J, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = J }), /* @__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" }, R(c.views || 0), " views · ", l.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 || K, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = K }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement(et, { type: "blue" }))), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-timestamp" }, l.timestamp || "Just now")), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: $e(n.text) } })), i && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, D(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, D(c.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, D(c.reposts || 0), " reposts")));
442
+ }, Ha = ({ author: t, content: n, engagement: c, meta: l }) => {
443
+ const i = n.media || [], u = c.likes || c.comments || c.shares;
444
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, i[0] ? /* @__PURE__ */ e.createElement("img", { src: i[0].url, alt: "Video thumbnail", onError: (g) => g.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail-placeholder" }), n.duration && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-duration" }, n.duration)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || K, alt: t.name, className: "artifactuse-social-avatar", onError: (g) => g.target.src = K }), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-author-name" }, "@", t.name), t.verified && /* @__PURE__ */ e.createElement(et, { type: "blue" })), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: $e(n.text) } }), n.sound && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-sound" }, "🎵 ", n.sound)), u && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, D(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, D(c.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, D(c.shares || 0), " shares")));
445
+ }, Ba = ({ author: t, content: n, engagement: c, meta: l }) => {
446
+ const i = n.media || [];
447
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, i[0] ? /* @__PURE__ */ e.createElement("img", { src: i[0].url, alt: "Video thumbnail", onError: (u) => u.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail-placeholder" }), n.duration && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-duration" }, n.duration)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-info" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || K, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = K }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-details" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-title" }, n.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-channel" }, t.name), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-meta" }, D(c.views || 0), " views · ", l.timestamp || "Just now"))));
448
448
  };
449
- function ka({ artifact: t, theme: r = "dark", onCopy: c }) {
450
- const [l, i] = y("Copy"), u = w(() => {
449
+ function Fa({ artifact: t, theme: n = "dark", onCopy: c }) {
450
+ const [l, i] = y("Copy"), u = N(() => {
451
451
  try {
452
452
  return JSON.parse(t.code);
453
453
  } catch {
454
454
  return { platform: "twitter", data: {} };
455
455
  }
456
- }, [t.code]), h = (u == null ? void 0 : u.platform) || "twitter", E = (u == null ? void 0 : u.data) || {}, { author: o = {}, content: a = {}, engagement: k = {}, meta: P = {} } = E, $ = va[h] || 280, W = (a.text || "").length, _ = W > $ ? "error" : W > $ * 0.9 ? "warning" : "", x = d(() => {
456
+ }, [t.code]), g = (u == null ? void 0 : u.platform) || "twitter", v = (u == null ? void 0 : u.data) || {}, { author: o = {}, content: a = {}, engagement: x = {}, meta: S = {} } = v, A = Ta[g] || 280, R = (a.text || "").length, _ = R > A ? "error" : R > A * 0.9 ? "warning" : "", L = d(() => {
457
457
  const s = a.text || "";
458
458
  navigator.clipboard.writeText(s).then(() => {
459
- i("Copied!"), setTimeout(() => i("Copy"), 2e3), c == null || c({ platform: h, text: s });
459
+ i("Copied!"), setTimeout(() => i("Copy"), 2e3), c == null || c({ platform: g, text: s });
460
460
  });
461
- }, [a.text, h, c]), p = () => {
462
- const s = { author: o, content: a, engagement: k, meta: P };
463
- switch (h) {
461
+ }, [a.text, g, c]), p = () => {
462
+ const s = { author: o, content: a, engagement: x, meta: S };
463
+ switch (g) {
464
464
  case "twitter":
465
- return /* @__PURE__ */ e.createElement(Pt, { ...s });
465
+ return /* @__PURE__ */ e.createElement(Vt, { ...s });
466
466
  case "linkedin":
467
- return /* @__PURE__ */ e.createElement(ga, { ...s });
467
+ return /* @__PURE__ */ e.createElement(Pa, { ...s });
468
468
  case "instagram":
469
- return /* @__PURE__ */ e.createElement(_a, { ...s });
469
+ return /* @__PURE__ */ e.createElement(Sa, { ...s });
470
470
  case "facebook":
471
- return /* @__PURE__ */ e.createElement(ya, { ...s });
471
+ return /* @__PURE__ */ e.createElement($a, { ...s });
472
472
  case "threads":
473
- return /* @__PURE__ */ e.createElement(ba, { ...s });
473
+ return /* @__PURE__ */ e.createElement(Aa, { ...s });
474
474
  case "tiktok":
475
- return /* @__PURE__ */ e.createElement(Na, { ...s });
475
+ return /* @__PURE__ */ e.createElement(Ha, { ...s });
476
476
  case "youtube":
477
- return /* @__PURE__ */ e.createElement(wa, { ...s });
477
+ return /* @__PURE__ */ e.createElement(Ba, { ...s });
478
478
  default:
479
- return /* @__PURE__ */ e.createElement(Pt, { ...s });
479
+ return /* @__PURE__ */ e.createElement(Vt, { ...s });
480
480
  }
481
481
  };
482
- return /* @__PURE__ */ e.createElement("div", { className: `artifactuse-social artifactuse-social-${h}`, "data-artifactuse-theme": r }, p(), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-actions-bar" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-platform-badge" }, /* @__PURE__ */ e.createElement("span", null, ha[h] || h)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-actions-right" }, /* @__PURE__ */ e.createElement("span", { className: `artifactuse-social-char-counter ${_}` }, W, "/", $), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-social-copy-btn", onClick: x }, l))));
482
+ return /* @__PURE__ */ e.createElement("div", { className: `artifactuse-social artifactuse-social-${g}`, "data-artifactuse-theme": n }, p(), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-actions-bar" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-platform-badge" }, /* @__PURE__ */ e.createElement("span", null, Ma[g] || g)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-actions-right" }, /* @__PURE__ */ e.createElement("span", { className: `artifactuse-social-char-counter ${_}` }, R, "/", A), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-social-copy-btn", onClick: L }, l))));
483
483
  }
484
- function xa({
484
+ function Ia({
485
485
  isOpen: t = !1,
486
- type: r = "image",
486
+ type: n = "image",
487
487
  src: c = "",
488
488
  alt: l = "",
489
489
  caption: i = "",
490
490
  onClose: u,
491
- className: h = ""
491
+ className: g = ""
492
492
  }) {
493
- const E = V(null), [o, a] = y(!1), [k, P] = y(!1);
494
- B(() => (P(!0), () => P(!1)), []), B(() => {
493
+ const v = F(null), [o, a] = y(!1), [x, S] = y(!1);
494
+ I(() => (S(!0), () => S(!1)), []), I(() => {
495
495
  var p;
496
- return t ? (document.body.style.overflow = "hidden", (p = E.current) == null || p.focus()) : (document.body.style.overflow = "", a(!1)), () => {
496
+ return t ? (document.body.style.overflow = "hidden", (p = v.current) == null || p.focus()) : (document.body.style.overflow = "", a(!1)), () => {
497
497
  document.body.style.overflow = "";
498
498
  };
499
- }, [t]), B(() => {
499
+ }, [t]), I(() => {
500
500
  function p(s) {
501
501
  s.key === "Escape" && t && u && u();
502
502
  }
503
503
  return document.addEventListener("keydown", p), () => document.removeEventListener("keydown", p);
504
504
  }, [t, u]);
505
- const $ = d(() => {
505
+ const A = d(() => {
506
506
  a(!1), u && u();
507
- }, [u]), W = d(() => {
508
- r === "image" && a((p) => !p);
509
- }, [r]), _ = d(() => {
507
+ }, [u]), R = d(() => {
508
+ n === "image" && a((p) => !p);
509
+ }, [n]), _ = d(() => {
510
510
  const p = document.createElement("a");
511
511
  p.href = c, p.download = l || "download", document.body.appendChild(p), p.click(), document.body.removeChild(p);
512
512
  }, [c, l]);
513
- if (!t || !k)
513
+ if (!t || !x)
514
514
  return null;
515
- const x = /* @__PURE__ */ e.createElement(
515
+ const L = /* @__PURE__ */ e.createElement(
516
516
  "div",
517
517
  {
518
- ref: E,
519
- className: `artifactuse-viewer-overlay ${h}`,
520
- onClick: $,
518
+ ref: v,
519
+ className: `artifactuse-viewer-overlay ${g}`,
520
+ onClick: A,
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: (p) => p.stopPropagation() }, r === "image" && /* @__PURE__ */ e.createElement(
525
+ /* @__PURE__ */ e.createElement("div", { className: "artifactuse-viewer-content", onClick: (p) => p.stopPropagation() }, n === "image" && /* @__PURE__ */ e.createElement(
526
526
  "img",
527
527
  {
528
528
  src: c,
529
529
  alt: l,
530
530
  className: `artifactuse-viewer-image ${o ? "artifactuse-viewer-image--zoomed" : ""}`,
531
- onClick: W
531
+ onClick: R
532
532
  }
533
- ), r === "pdf" && /* @__PURE__ */ e.createElement(
533
+ ), n === "pdf" && /* @__PURE__ */ e.createElement(
534
534
  "iframe",
535
535
  {
536
536
  src: c,
@@ -541,15 +541,15 @@ function xa({
541
541
  "button",
542
542
  {
543
543
  className: "artifactuse-viewer-close",
544
- onClick: $,
544
+ onClick: A,
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
- ), r === "image" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-viewer-controls" }, /* @__PURE__ */ e.createElement(
548
+ ), n === "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: W,
552
+ onClick: R,
553
553
  title: o ? "Zoom out" : "Zoom in"
554
554
  },
555
555
  o ? /* @__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" }))
@@ -563,13 +563,13 @@ function xa({
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
  )), i && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-viewer-caption" }, i))
565
565
  );
566
- return ua(x, document.body);
566
+ return Na(L, document.body);
567
567
  }
568
- function Ca(t) {
568
+ function Va(t) {
569
569
  if (!t) return null;
570
570
  try {
571
- const r = decodeURIComponent(escape(atob(t)));
572
- return JSON.parse(r);
571
+ const n = decodeURIComponent(escape(atob(t)));
572
+ return JSON.parse(n);
573
573
  } catch {
574
574
  try {
575
575
  const c = t.replace(/&#10;/g, `
@@ -580,70 +580,70 @@ function Ca(t) {
580
580
  }
581
581
  }
582
582
  }
583
- function La(t) {
584
- const r = [];
585
- if (!t) return r;
583
+ function Wa(t) {
584
+ const n = [];
585
+ if (!t) return n;
586
586
  const c = /<div\s+class="artifactuse-placeholder[^"]*"[^>]*data-artifact-id="([^"]+)"[^>]*data-artifact-type="([^"]+)"[^>]*data-artifact=["']([^"']*)["'][^>]*><\/div>/gi;
587
587
  let l = 0, i;
588
588
  for (; (i = c.exec(t)) !== null; ) {
589
589
  if (i.index > l) {
590
- const E = t.slice(l, i.index);
591
- E.trim() && r.push({ type: "html", content: E });
590
+ const v = t.slice(l, i.index);
591
+ v.trim() && n.push({ type: "html", content: v });
592
592
  }
593
- const u = Ca(i[3]), h = i[2];
594
- u && (h === "form" && u.isInline ? r.push({ type: "form", artifact: u }) : h === "social" ? r.push({ type: "social", artifact: u }) : r.push({ type: "panel", artifact: u })), l = i.index + i[0].length;
593
+ const u = Va(i[3]), g = i[2];
594
+ u && (g === "form" && u.isInline ? n.push({ type: "form", artifact: u }) : g === "social" ? n.push({ type: "social", artifact: u }) : n.push({ type: "panel", artifact: u })), l = i.index + i[0].length;
595
595
  }
596
596
  if (l < t.length) {
597
597
  const u = t.slice(l);
598
- u.trim() && r.push({ type: "html", content: u });
598
+ u.trim() && n.push({ type: "html", content: u });
599
599
  }
600
- return r.length === 0 && t.trim() && r.push({ type: "html", content: t }), r;
600
+ return n.length === 0 && t.trim() && n.push({ type: "html", content: t }), n;
601
601
  }
602
- function Ta() {
602
+ function Ra() {
603
603
  return `msg-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
604
604
  }
605
- function Ma({
605
+ function za({
606
606
  content: t,
607
- messageId: r = Ta(),
607
+ messageId: n = Ra(),
608
608
  inlineCards: c = !0,
609
609
  typing: l = !1,
610
610
  isLastMessage: i = !1,
611
611
  // Whether this is the last/most recent message
612
612
  inlinePreview: u = null,
613
- inlineCode: h = null,
614
- tabs: E = null,
613
+ inlineCode: g = null,
614
+ tabs: v = null,
615
615
  viewMode: o = null,
616
616
  onArtifactDetected: a,
617
- onArtifactOpen: k,
618
- onArtifactCopy: P,
619
- onArtifactDownload: $,
620
- onFormSubmit: W,
617
+ onArtifactOpen: x,
618
+ onArtifactCopy: S,
619
+ onArtifactDownload: A,
620
+ onFormSubmit: R,
621
621
  onFormCancel: _,
622
- onFormButtonClick: x,
622
+ onFormButtonClick: L,
623
623
  onSocialCopy: p,
624
624
  onMediaOpen: s,
625
- className: O = ""
625
+ className: Z = ""
626
626
  }) {
627
- var Ne;
627
+ var ke;
628
628
  const {
629
- processMessage: X,
629
+ processMessage: Y,
630
630
  openArtifact: z,
631
- state: F,
632
- getTheme: te,
633
- instance: q
634
- } = Me(), D = V(null), H = V(null), Z = V(null), he = V(l), [le, ge] = y(""), [ce, ue] = y([]), [me, _e] = y(!1), [de, m] = y(!1), [S, b] = y("image"), [N, M] = y(""), [L, fe] = y(""), [ke, Pe] = y(""), ye = w(() => typeof te == "function" ? te() : "dark", [te]), Ye = (F == null ? void 0 : F.activeArtifactId) || null, G = c ?? ((Ne = q == null ? void 0 : q.config) == null ? void 0 : Ne.inlineCards) ?? !0, We = w(() => La(le), [le]), Se = w(() => me || i ? "active" : "inactive", [me, i]);
635
- B(() => {
636
- l && _e(!0);
631
+ state: V,
632
+ getTheme: se,
633
+ instance: U
634
+ } = Ae(), q = F(null), H = F(null), G = F(null), _e = F(l), [ie, ye] = y(""), [oe, de] = y([]), [fe, be] = y(!1), [pe, m] = y(!1), [$, b] = y("image"), [k, P] = y(""), [M, Ee] = y(""), [Le, He] = y(""), Ne = N(() => typeof se == "function" ? se() : "dark", [se]), tt = (V == null ? void 0 : V.activeArtifactId) || null, te = c ?? ((ke = U == null ? void 0 : U.config) == null ? void 0 : ke.inlineCards) ?? !0, De = N(() => Wa(ie), [ie]), Be = N(() => fe || i ? "active" : "inactive", [fe, i]);
635
+ I(() => {
636
+ l && be(!0);
637
637
  }, [l]);
638
- const ae = d((v) => {
639
- b(v.type || "image"), M(v.src || ""), fe(v.alt || ""), Pe(v.caption || ""), m(!0), s && s(v);
640
- }, [s]), xe = d(() => {
641
- m(!1), M(""), fe(""), Pe("");
642
- }, []), $e = d(() => {
638
+ const le = d((h) => {
639
+ b(h.type || "image"), P(h.src || ""), Ee(h.alt || ""), He(h.caption || ""), m(!0), s && s(h);
640
+ }, [s]), Te = d(() => {
641
+ m(!1), P(""), Ee(""), He("");
642
+ }, []), Fe = d(() => {
643
643
  if (!H.current) return;
644
644
  H.current.querySelectorAll('img[data-lightbox="true"]').forEach((f) => {
645
- f._lightboxHandler && f.removeEventListener("click", f._lightboxHandler), f._lightboxHandler = (I) => {
646
- I.preventDefault(), I.stopPropagation(), ae({
645
+ f._lightboxHandler && f.removeEventListener("click", f._lightboxHandler), f._lightboxHandler = (B) => {
646
+ B.preventDefault(), B.stopPropagation(), le({
647
647
  type: "image",
648
648
  src: f.src,
649
649
  alt: f.alt || "",
@@ -651,30 +651,30 @@ function Ma({
651
651
  });
652
652
  }, f.addEventListener("click", f._lightboxHandler), f.style.cursor = "zoom-in";
653
653
  }), H.current.querySelectorAll(".artifactuse-image-container img").forEach((f) => {
654
- f._lightboxHandler || (f._lightboxHandler = (I) => {
655
- I.preventDefault(), I.stopPropagation();
656
- const U = f.closest(".artifactuse-image-container"), Q = U == null ? void 0 : U.querySelector(".artifactuse-image-caption"), Be = (Q == null ? void 0 : Q.textContent) || f.dataset.caption || f.alt || "";
657
- ae({
654
+ f._lightboxHandler || (f._lightboxHandler = (B) => {
655
+ B.preventDefault(), B.stopPropagation();
656
+ const j = f.closest(".artifactuse-image-container"), W = j == null ? void 0 : j.querySelector(".artifactuse-image-caption"), ee = (W == null ? void 0 : W.textContent) || f.dataset.caption || f.alt || "";
657
+ le({
658
658
  type: "image",
659
659
  src: f.src,
660
660
  alt: f.alt || "",
661
- caption: Be
661
+ caption: ee
662
662
  });
663
663
  }, f.addEventListener("click", f._lightboxHandler), f.style.cursor = "zoom-in");
664
664
  }), H.current.querySelectorAll(".artifactuse-gallery-item img, .artifactuse-image-gallery img").forEach((f) => {
665
- f._lightboxHandler || (f._lightboxHandler = (I) => {
666
- I.preventDefault(), I.stopPropagation();
667
- const U = f.closest(".artifactuse-gallery-item"), Q = U == null ? void 0 : U.querySelector(".artifactuse-gallery-caption"), Be = (Q == null ? void 0 : Q.textContent) || f.dataset.caption || f.alt || "";
668
- ae({
665
+ f._lightboxHandler || (f._lightboxHandler = (B) => {
666
+ B.preventDefault(), B.stopPropagation();
667
+ const j = f.closest(".artifactuse-gallery-item"), W = j == null ? void 0 : j.querySelector(".artifactuse-gallery-caption"), ee = (W == null ? void 0 : W.textContent) || f.dataset.caption || f.alt || "";
668
+ le({
669
669
  type: "image",
670
670
  src: f.src,
671
671
  alt: f.alt || "",
672
- caption: Be
672
+ caption: ee
673
673
  });
674
674
  }, f.addEventListener("click", f._lightboxHandler), f.style.cursor = "zoom-in");
675
675
  }), H.current.querySelectorAll('a[href$=".pdf"], a[data-type="pdf"]').forEach((f) => {
676
- f._pdfHandler && f.removeEventListener("click", f._pdfHandler), f._pdfHandler = (I) => {
677
- I.preventDefault(), I.stopPropagation(), ae({
676
+ f._pdfHandler && f.removeEventListener("click", f._pdfHandler), f._pdfHandler = (B) => {
677
+ B.preventDefault(), B.stopPropagation(), le({
678
678
  type: "pdf",
679
679
  src: f.href,
680
680
  alt: f.textContent || "PDF Document",
@@ -682,128 +682,128 @@ function Ma({
682
682
  });
683
683
  }, f.addEventListener("click", f._pdfHandler);
684
684
  }), H.current.querySelectorAll(".artifactuse-pdf-container, [data-pdf-viewer]").forEach((f) => {
685
- var U;
685
+ var j;
686
686
  f._pdfHandler && f.removeEventListener("click", f._pdfHandler);
687
- const I = f.dataset.pdfSrc || ((U = f.querySelector("iframe")) == null ? void 0 : U.src) || "";
688
- I && (f._pdfHandler = (Q) => {
689
- Q.preventDefault(), Q.stopPropagation(), ae({
687
+ const B = f.dataset.pdfSrc || ((j = f.querySelector("iframe")) == null ? void 0 : j.src) || "";
688
+ B && (f._pdfHandler = (W) => {
689
+ W.preventDefault(), W.stopPropagation(), le({
690
690
  type: "pdf",
691
- src: I,
691
+ src: B,
692
692
  alt: "PDF Document",
693
693
  caption: f.dataset.caption || ""
694
694
  });
695
695
  }, f.addEventListener("click", f._pdfHandler), f.style.cursor = "pointer");
696
696
  }), H.current.querySelectorAll(".artifactuse-video-preview-wrapper, .video-preview-wrapper").forEach((f) => {
697
- f._clickHandler && f.removeEventListener("click", f._clickHandler), f._clickHandler = (I) => {
698
- if (I.target.closest(".artifactuse-video-play-button")) return;
699
- const U = f.dataset.videoUrl || f.dataset.url;
700
- U && window.open(U, "_blank", "noopener,noreferrer");
697
+ f._clickHandler && f.removeEventListener("click", f._clickHandler), f._clickHandler = (B) => {
698
+ if (B.target.closest(".artifactuse-video-play-button")) return;
699
+ const j = f.dataset.videoUrl || f.dataset.url;
700
+ j && window.open(j, "_blank", "noopener,noreferrer");
701
701
  }, f.addEventListener("click", f._clickHandler);
702
702
  });
703
- }, [ae]), ze = d(() => {
703
+ }, [le]), Ue = d(() => {
704
704
  if (!H.current) return;
705
- H.current.querySelectorAll("img").forEach((C) => {
706
- C._lightboxHandler && (C.removeEventListener("click", C._lightboxHandler), delete C._lightboxHandler);
707
- }), H.current.querySelectorAll('a[href$=".pdf"], a[data-type="pdf"]').forEach((C) => {
708
- C._pdfHandler && (C.removeEventListener("click", C._pdfHandler), delete C._pdfHandler);
709
- }), H.current.querySelectorAll(".artifactuse-pdf-container, [data-pdf-viewer]").forEach((C) => {
710
- C._pdfHandler && (C.removeEventListener("click", C._pdfHandler), delete C._pdfHandler);
711
- }), H.current.querySelectorAll(".artifactuse-video-preview-wrapper, .video-preview-wrapper").forEach((C) => {
712
- C._clickHandler && (C.removeEventListener("click", C._clickHandler), delete C._clickHandler);
705
+ H.current.querySelectorAll("img").forEach((T) => {
706
+ T._lightboxHandler && (T.removeEventListener("click", T._lightboxHandler), delete T._lightboxHandler);
707
+ }), H.current.querySelectorAll('a[href$=".pdf"], a[data-type="pdf"]').forEach((T) => {
708
+ T._pdfHandler && (T.removeEventListener("click", T._pdfHandler), delete T._pdfHandler);
709
+ }), H.current.querySelectorAll(".artifactuse-pdf-container, [data-pdf-viewer]").forEach((T) => {
710
+ T._pdfHandler && (T.removeEventListener("click", T._pdfHandler), delete T._pdfHandler);
711
+ }), H.current.querySelectorAll(".artifactuse-video-preview-wrapper, .video-preview-wrapper").forEach((T) => {
712
+ T._clickHandler && (T.removeEventListener("click", T._clickHandler), delete T._clickHandler);
713
713
  });
714
- }, []), be = d(() => {
715
- Z.current && clearTimeout(Z.current), Z.current = setTimeout(async () => {
716
- if (q != null && q.initializeContent && H.current)
714
+ }, []), we = d(() => {
715
+ G.current && clearTimeout(G.current), G.current = setTimeout(async () => {
716
+ if (U != null && U.initializeContent && H.current)
717
717
  try {
718
- await q.initializeContent(H.current);
719
- } catch (v) {
720
- console.error("Failed to initialize content:", v);
718
+ await U.initializeContent(H.current);
719
+ } catch (h) {
720
+ console.error("Failed to initialize content:", h);
721
721
  }
722
- $e();
722
+ Fe();
723
723
  }, 100);
724
- }, [q, $e]);
725
- B(() => {
724
+ }, [U, Fe]);
725
+ I(() => {
726
726
  if (t) {
727
- const v = X(t, r, {
727
+ const h = Y(t, n, {
728
728
  inlinePreview: u,
729
- inlineCode: h,
730
- tabs: E,
729
+ inlineCode: g,
730
+ tabs: v,
731
731
  viewMode: o
732
732
  });
733
- ge(v.html), ue(v.artifacts), v.artifacts.length > 0 && a && a(v.artifacts), l || be();
733
+ ye(h.html), de(h.artifacts), h.artifacts.length > 0 && a && a(h.artifacts), l || we();
734
734
  }
735
- }, [t, r, X, l, be, a]), B(() => {
736
- he.current === !0 && l === !1 && be(), he.current = l;
737
- }, [l, be]), B(() => (l && _e(!0), l || be(), () => {
738
- Z.current && clearTimeout(Z.current), ze();
735
+ }, [t, n, Y, l, we, a]), I(() => {
736
+ _e.current === !0 && l === !1 && we(), _e.current = l;
737
+ }, [l, we]), I(() => (l && be(!0), l || we(), () => {
738
+ G.current && clearTimeout(G.current), Ue();
739
739
  }), []);
740
- const Ae = d((v) => {
741
- const ne = v.target.closest(".artifactuse-inline-preview");
742
- if (ne) {
743
- if (ne.dataset.nonClickable) return;
744
- const ie = ne.dataset.artifactId;
745
- if (ie) {
746
- const Ee = F.artifacts.find((C) => C.id === ie);
747
- Ee && (z(Ee), k && k(Ee));
740
+ const Ie = d((h) => {
741
+ const ce = h.target.closest(".artifactuse-inline-preview");
742
+ if (ce) {
743
+ if (ce.dataset.nonClickable) return;
744
+ const ue = ce.dataset.artifactId;
745
+ if (ue) {
746
+ const he = V.artifacts.find((T) => T.id === ue);
747
+ he && (z(he), x && x(he));
748
748
  }
749
749
  }
750
- }, [F, z, k]), Qe = d((v) => {
751
- z(v), k && k(v);
752
- }, [z, k]), Re = d((v) => {
753
- P && P(v);
754
- }, [P]), K = d((v) => {
755
- $ && $(v);
756
- }, [$]), He = d((v) => {
757
- W && W(v);
758
- }, [W]), Ce = d((v) => {
759
- _ && _(v);
760
- }, [_]), Ie = d((v) => {
761
- x && x(v);
762
- }, [x]), pe = d((v) => {
763
- p && p(v);
764
- }, [p]), Ge = (v, ne) => {
765
- switch (v.type) {
750
+ }, [V, z, x]), at = d((h) => {
751
+ z(h), x && x(h);
752
+ }, [z, x]), qe = d((h) => {
753
+ S && S(h);
754
+ }, [S]), Q = d((h) => {
755
+ A && A(h);
756
+ }, [A]), Ve = d((h) => {
757
+ R && R(h);
758
+ }, [R]), Me = d((h) => {
759
+ _ && _(h);
760
+ }, [_]), We = d((h) => {
761
+ L && L(h);
762
+ }, [L]), ve = d((h) => {
763
+ p && p(h);
764
+ }, [p]), rt = (h, ce) => {
765
+ switch (h.type) {
766
766
  case "html":
767
767
  return /* @__PURE__ */ e.createElement(
768
768
  "div",
769
769
  {
770
- key: `html-${ne}`,
771
- dangerouslySetInnerHTML: { __html: v.content }
770
+ key: `html-${ce}`,
771
+ dangerouslySetInnerHTML: { __html: h.content }
772
772
  }
773
773
  );
774
774
  case "form":
775
- return v.artifact.isInline ? /* @__PURE__ */ e.createElement(
776
- pa,
775
+ return h.artifact.isInline ? /* @__PURE__ */ e.createElement(
776
+ Ca,
777
777
  {
778
- key: `form-${v.artifact.id}`,
779
- artifact: v.artifact,
780
- theme: ye,
781
- initialState: Se,
782
- onSubmit: He,
783
- onCancel: Ce,
784
- onButtonClick: Ie
778
+ key: `form-${h.artifact.id}`,
779
+ artifact: h.artifact,
780
+ theme: Ne,
781
+ initialState: Be,
782
+ onSubmit: Ve,
783
+ onCancel: Me,
784
+ onButtonClick: We
785
785
  }
786
786
  ) : null;
787
787
  case "social":
788
788
  return /* @__PURE__ */ e.createElement(
789
- ka,
789
+ Fa,
790
790
  {
791
- key: `social-${v.artifact.id}`,
792
- artifact: v.artifact,
793
- theme: ye,
794
- onCopy: pe
791
+ key: `social-${h.artifact.id}`,
792
+ artifact: h.artifact,
793
+ theme: Ne,
794
+ onCopy: ve
795
795
  }
796
796
  );
797
797
  case "panel":
798
- return G ? /* @__PURE__ */ e.createElement(
799
- ma,
798
+ return te ? /* @__PURE__ */ e.createElement(
799
+ wa,
800
800
  {
801
- key: `panel-${v.artifact.id}`,
802
- artifact: v.artifact,
803
- isActive: Ye === v.artifact.id,
804
- onOpen: Qe,
805
- onCopy: Re,
806
- onDownload: K
801
+ key: `panel-${h.artifact.id}`,
802
+ artifact: h.artifact,
803
+ isActive: tt === h.artifact.id,
804
+ onOpen: at,
805
+ onCopy: qe,
806
+ onDownload: Q
807
807
  }
808
808
  ) : null;
809
809
  default:
@@ -813,424 +813,452 @@ function Ma({
813
813
  return /* @__PURE__ */ e.createElement(
814
814
  "div",
815
815
  {
816
- ref: D,
817
- className: `artifactuse-agent-message ${O}`.trim()
816
+ ref: q,
817
+ className: `artifactuse-agent-message ${Z}`.trim()
818
818
  },
819
- /* @__PURE__ */ e.createElement("div", { ref: H, className: "artifactuse-message-content", onClick: Ae }, We.map(Ge)),
819
+ /* @__PURE__ */ e.createElement("div", { ref: H, className: "artifactuse-message-content", onClick: Ie }, De.map(rt)),
820
820
  /* @__PURE__ */ e.createElement(
821
- xa,
821
+ Ia,
822
822
  {
823
- isOpen: de,
824
- type: S,
825
- src: N,
826
- alt: L,
827
- caption: ke,
828
- onClose: xe
823
+ isOpen: pe,
824
+ type: $,
825
+ src: k,
826
+ alt: M,
827
+ caption: Le,
828
+ onClose: Te
829
829
  }
830
830
  )
831
831
  );
832
832
  }
833
- Ma.propTypes = {
833
+ za.propTypes = {
834
834
  /** The raw message content (markdown/HTML from AI) */
835
- content: (t, r) => {
836
- if (typeof t[r] != "string")
837
- return new Error(`${r} must be a string`);
835
+ content: (t, n) => {
836
+ if (typeof t[n] != "string")
837
+ return new Error(`${n} must be a string`);
838
838
  },
839
839
  /** Unique message ID */
840
- messageId: (t, r) => {
841
- if (t[r] !== void 0 && typeof t[r] != "string")
842
- return new Error(`${r} must be a string`);
840
+ messageId: (t, n) => {
841
+ if (t[n] !== void 0 && typeof t[n] != "string")
842
+ return new Error(`${n} must be a string`);
843
843
  },
844
844
  /** Whether to show artifact cards inline */
845
- inlineCards: (t, r) => {
846
- if (t[r] !== void 0 && typeof t[r] != "boolean")
847
- return new Error(`${r} must be a boolean`);
845
+ inlineCards: (t, n) => {
846
+ if (t[n] !== void 0 && typeof t[n] != "boolean")
847
+ return new Error(`${n} must be a boolean`);
848
848
  },
849
849
  /** Whether the message is still being typed/streamed */
850
- typing: (t, r) => {
851
- if (t[r] !== void 0 && typeof t[r] != "boolean")
852
- return new Error(`${r} must be a boolean`);
850
+ typing: (t, n) => {
851
+ if (t[n] !== void 0 && typeof t[n] != "boolean")
852
+ return new Error(`${n} must be a boolean`);
853
853
  },
854
854
  /** Whether this is the last/most recent message in the conversation */
855
- isLastMessage: (t, r) => {
856
- if (t[r] !== void 0 && typeof t[r] != "boolean")
857
- return new Error(`${r} must be a boolean`);
855
+ isLastMessage: (t, n) => {
856
+ if (t[n] !== void 0 && typeof t[n] != "boolean")
857
+ return new Error(`${n} must be a boolean`);
858
858
  },
859
859
  /** Override global inlinePreview config for this message */
860
- inlinePreview: (t, r) => {
861
- if (t[r] !== void 0 && t[r] !== null && typeof t[r] != "object")
862
- return new Error(`${r} must be an object or null`);
860
+ inlinePreview: (t, n) => {
861
+ if (t[n] !== void 0 && t[n] !== null && typeof t[n] != "object")
862
+ return new Error(`${n} must be an object or null`);
863
863
  },
864
864
  /** Show full inline code (no extraction) for listed languages */
865
- inlineCode: (t, r) => {
866
- if (t[r] !== void 0 && t[r] !== null && typeof t[r] != "object")
867
- return new Error(`${r} must be an object or null`);
865
+ inlineCode: (t, n) => {
866
+ if (t[n] !== void 0 && t[n] !== null && typeof t[n] != "object")
867
+ return new Error(`${n} must be an object or null`);
868
868
  },
869
869
  /** Override visible panel tabs for artifacts from this message */
870
- tabs: (t, r) => {
871
- if (t[r] !== void 0 && t[r] !== null && !Array.isArray(t[r]))
872
- return new Error(`${r} must be an array or null`);
870
+ tabs: (t, n) => {
871
+ if (t[n] !== void 0 && t[n] !== null && !Array.isArray(t[n]))
872
+ return new Error(`${n} must be an array or null`);
873
873
  },
874
874
  /** Override initial panel view mode for artifacts from this message */
875
- viewMode: (t, r) => {
876
- if (t[r] !== void 0 && t[r] !== null && typeof t[r] != "string")
877
- return new Error(`${r} must be a string or null`);
875
+ viewMode: (t, n) => {
876
+ if (t[n] !== void 0 && t[n] !== null && typeof t[n] != "string")
877
+ return new Error(`${n} must be a string or null`);
878
878
  }
879
879
  };
880
- function Fa({
880
+ const Wt = ["image", "audio", "video", "pdf", "font", "binary"];
881
+ function Za({
881
882
  onAIRequest: t,
882
- onSave: r,
883
+ onSave: n,
883
884
  onExport: c,
884
885
  className: l = "",
885
886
  panelWidth: i,
886
887
  splitPosition: u,
887
- externalPreview: h,
888
- consolePanel: E
888
+ externalPreview: g,
889
+ consolePanel: v
889
890
  }) {
890
- var Ct, Lt;
891
+ var $t, At;
891
892
  const {
892
893
  state: o,
893
894
  activeArtifact: a,
894
- artifactCount: k,
895
- hasArtifacts: P,
896
- closePanel: $,
897
- toggleFullscreen: W,
895
+ artifactCount: x,
896
+ hasArtifacts: S,
897
+ closePanel: A,
898
+ toggleFullscreen: R,
898
899
  setViewMode: _,
899
- getPanelUrl: x,
900
+ getPanelUrl: L,
900
901
  openArtifact: p,
901
902
  instance: s
902
- } = Me(), O = V(null), X = V(null), z = V(null), F = V(null), te = V(null), q = V(null), D = V(null), [H, Z] = y(!1), [he, le] = y(!1), [ge, ce] = y(!0), [ue, me] = y(!1), [_e, de] = y(!1), [m, S] = y(!1), [b, N] = y(!1), [M, L] = y("options"), [fe, ke] = y(""), [Pe, ye] = y(null), [Ye, G] = y(""), [We, Se] = y(!1), [ae, xe] = y(!1), [$e, ze] = y([]), [be, Ae] = y(!1), [Qe, Re] = y(""), [K, He] = y([]), [Ce, Ie] = y(!1), [pe, Ge] = y(/* @__PURE__ */ new Set(["log", "warn", "error", "info"])), Ne = V(null), [v, ne] = y(
903
+ } = Ae(), Z = F(null), Y = F(null), z = F(null), V = F(null), se = F(null), U = F(null), q = F(null), [H, G] = y(!1), [_e, ie] = y(!1), [ye, oe] = y(!0), [de, fe] = y(!1), [be, pe] = y(!1), [m, $] = y(!1), [b, k] = y(!1), [P, M] = y("options"), [Ee, Le] = y(""), [He, Ne] = y(null), [tt, te] = y(""), [De, Be] = y(!1), [le, Te] = y(!1), [Fe, Ue] = y([]), [we, Ie] = y(!1), [at, qe] = y(""), [Q, Ve] = y([]), [Me, We] = y(!1), [ve, rt] = y(/* @__PURE__ */ new Set(["log", "warn", "error", "info"])), ke = F(null), [h, ce] = y(
903
904
  () => {
904
- var n;
905
- return Math.min(Math.max(i ?? ((n = s == null ? void 0 : s.config) == null ? void 0 : n.panelWidth) ?? 65, 25), 75);
905
+ var r;
906
+ return Math.min(Math.max(i ?? ((r = s == null ? void 0 : s.config) == null ? void 0 : r.panelWidth) ?? 65, 25), 75);
906
907
  }
907
- ), [ie, Ee] = y(
908
+ ), [ue, he] = y(
908
909
  () => {
909
- var n;
910
- return Math.min(Math.max(u ?? ((n = s == null ? void 0 : s.config) == null ? void 0 : n.splitPosition) ?? 50, 20), 80);
910
+ var r;
911
+ return Math.min(Math.max(u ?? ((r = s == null ? void 0 : s.config) == null ? void 0 : r.splitPosition) ?? 50, 20), 80);
911
912
  }
912
- ), C = V(null), Le = V(null);
913
- B(() => {
914
- i !== void 0 && ne(Math.min(Math.max(i, 25), 75));
915
- }, [i]), B(() => {
916
- u !== void 0 && Ee(Math.min(Math.max(u, 20), 80));
913
+ ), T = F(null), Pe = F(null);
914
+ I(() => {
915
+ i !== void 0 && ce(Math.min(Math.max(i, 25), 75));
916
+ }, [i]), I(() => {
917
+ u !== void 0 && he(Math.min(Math.max(u, 20), 80));
917
918
  }, [u]);
918
- const f = V(null), I = V(null), U = V(null), Q = w(() => a ? Ze(a.language) : "", [a]), Be = w(() => a ? mt(a.language) : "", [a]), ve = w(() => {
919
+ const f = F(null), B = F(null), j = F(null), W = F({}), ee = F(null), gt = N(() => a ? Qe(a.language) : "", [a]), Ut = N(() => a ? Et(a.language) : "", [a]), ge = N(() => {
919
920
  if (!a) return null;
920
- let n = x(a);
921
- return n && a._refreshToken && (n += (n.includes("?") ? "&" : "?") + "_t=" + a._refreshToken), n;
922
- }, [a, x]), Fe = w(() => a ? la(a.language) : "plaintext", [a]), j = w(() => o.artifacts.filter((n) => !n.isInline), [o.artifacts]), oe = w(() => a ? j.findIndex((n) => n.id === a.id) : -1, [a, j]), et = w(() => {
923
- var n;
924
- return ((n = s == null ? void 0 : s.config) == null ? void 0 : n.branding) !== !1;
925
- }, [s]), Ht = w(() => {
926
- var n;
927
- return ve ? (a == null ? void 0 : a.externalPreview) !== void 0 ? a.externalPreview : h !== void 0 ? h : ((n = s == null ? void 0 : s.config) == null ? void 0 : n.externalPreview) ?? !1 : !1;
928
- }, [a, h, s, ve]), tt = w(
929
- () => K.filter((n) => n.type === "error").length,
930
- [K]
931
- ), pt = w(
932
- () => K.filter((n) => n.type === "warn").length,
933
- [K]
934
- ), Et = w(
935
- () => K.filter((n) => n.type === "info").length,
936
- [K]
937
- ), vt = w(
938
- () => K.filter((n) => n.type === "log").length,
939
- [K]
940
- ), It = w(
941
- () => K.filter((n) => pe.has(n.type)),
942
- [K, pe]
943
- ), Bt = (E ?? ((Ct = s == null ? void 0 : s.config) == null ? void 0 : Ct.consolePanel)) !== !1 && K.length > 0;
944
- function qe(n) {
945
- Ge((g) => {
946
- const T = new Set(g);
947
- return T.has(n) ? T.delete(n) : T.add(n), T;
921
+ let r = L(a);
922
+ return r && a._refreshToken && (r += (r.includes("?") ? "&" : "?") + "_t=" + a._refreshToken), r;
923
+ }, [a, L]), Re = N(() => a ? ha(a.language) : "plaintext", [a]), Se = N(() => Wt.includes(a == null ? void 0 : a.language), [a]), ae = N(() => Se ? a.language : null, [Se, a]), ze = N(() => ae !== "font" || !a ? null : "apfont_" + a.id, [ae, a]), qt = N(() => {
924
+ if (ae !== "binary" || !(a != null && a.code)) return "";
925
+ try {
926
+ const r = atob(a.code.slice(0, 684)), E = new Uint8Array(r.length);
927
+ for (let w = 0; w < r.length; w++) E[w] = r.charCodeAt(w);
928
+ const C = [];
929
+ for (let w = 0; w < Math.min(E.length, 512); w += 16) {
930
+ const J = E.slice(w, w + 16), xe = Array.from(J).map((X) => X.toString(16).padStart(2, "0")).join(" "), re = Array.from(J).map((X) => X >= 32 && X < 127 ? String.fromCharCode(X) : ".").join("");
931
+ C.push(`${w.toString(16).padStart(8, "0")} ${xe.padEnd(47)} |${re}|`);
932
+ }
933
+ return C.join(`
934
+ `);
935
+ } catch {
936
+ return "";
937
+ }
938
+ }, [ae, a]), O = N(() => o.artifacts.filter((r) => !r.isInline), [o.artifacts]), me = N(() => a ? O.findIndex((r) => r.id === a.id) : -1, [a, O]), nt = N(() => {
939
+ var r;
940
+ return ((r = s == null ? void 0 : s.config) == null ? void 0 : r.branding) !== !1;
941
+ }, [s]), jt = N(() => {
942
+ var r;
943
+ return ge ? (a == null ? void 0 : a.externalPreview) !== void 0 ? a.externalPreview : g !== void 0 ? g : ((r = s == null ? void 0 : s.config) == null ? void 0 : r.externalPreview) ?? !1 : !1;
944
+ }, [a, g, s, ge]), st = N(
945
+ () => Q.filter((r) => r.type === "error").length,
946
+ [Q]
947
+ ), _t = N(
948
+ () => Q.filter((r) => r.type === "warn").length,
949
+ [Q]
950
+ ), yt = N(
951
+ () => Q.filter((r) => r.type === "info").length,
952
+ [Q]
953
+ ), bt = N(
954
+ () => Q.filter((r) => r.type === "log").length,
955
+ [Q]
956
+ ), Ot = N(
957
+ () => Q.filter((r) => ve.has(r.type)),
958
+ [Q, ve]
959
+ ), Jt = (v ?? (($t = s == null ? void 0 : s.config) == null ? void 0 : $t.consolePanel)) !== !1 && Q.length > 0, je = d((r) => {
960
+ if (!r || !r.code) return null;
961
+ if (W.current[r.id]) return W.current[r.id];
962
+ const E = ya(r.code, Bt(r.fileExtension || r.language));
963
+ return W.current[r.id] = E, E;
964
+ }, []), Nt = d((r) => {
965
+ W.current[r] && (Ft(W.current[r]), delete W.current[r]);
966
+ }, []);
967
+ function Oe(r) {
968
+ rt((E) => {
969
+ const C = new Set(E);
970
+ return C.has(r) ? C.delete(r) : C.add(r), C;
948
971
  });
949
972
  }
950
- B(() => s ? s.on("console:log", ({ entry: g }) => {
951
- He((T) => {
952
- const A = [...T, g];
953
- return A.length > 500 ? A.slice(-500) : A;
954
- }), g.type === "error" && Ie(!0);
955
- }) : void 0, [s]), B(() => {
956
- He([]), Ie(!1);
957
- }, [a == null ? void 0 : a.id]), B(() => {
958
- Ne.current && Ce && (Ne.current.scrollTop = Ne.current.scrollHeight);
959
- }, [K, Ce]);
960
- const Ft = w(() => {
961
- var n;
962
- return ((n = s == null ? void 0 : s.share) == null ? void 0 : n.enabled) !== !1;
963
- }, [s]), De = w(() => {
964
- var n;
965
- return ((n = s == null ? void 0 : s.share) == null ? void 0 : n.isAuthenticated()) || !1;
966
- }, [s]), ht = w(() => !a && !o.forceEmptyView ? Math.min(v, 30) : v, [a, v, o.forceEmptyView]), Ue = w(() => {
967
- var n;
968
- return ((n = s == null ? void 0 : s.config) == null ? void 0 : n.multiTab) === !0;
973
+ I(() => s ? s.on("console:log", ({ entry: E }) => {
974
+ Ve((C) => {
975
+ const w = [...C, E];
976
+ return w.length > 500 ? w.slice(-500) : w;
977
+ }), E.type === "error" && We(!0);
978
+ }) : void 0, [s]), I(() => {
979
+ Ve([]), We(!1);
980
+ }, [a == null ? void 0 : a.id]), I(() => {
981
+ ke.current && Me && (ke.current.scrollTop = ke.current.scrollHeight);
982
+ }, [Q, Me]);
983
+ const Xt = N(() => {
984
+ var r;
985
+ return ((r = s == null ? void 0 : s.share) == null ? void 0 : r.enabled) !== !1;
986
+ }, [s]), Je = N(() => {
987
+ var r;
988
+ return ((r = s == null ? void 0 : s.share) == null ? void 0 : r.isAuthenticated()) || !1;
989
+ }, [s]), wt = N(() => !a && !o.forceEmptyView ? Math.min(h, 30) : h, [a, h, o.forceEmptyView]), Xe = N(() => {
990
+ var r;
991
+ return ((r = s == null ? void 0 : s.config) == null ? void 0 : r.multiTab) === !0;
969
992
  }, [s]);
970
- w(() => Ue ? o.openTabs.map((n) => o.artifacts.find((g) => g.id === n)).filter(Boolean) : [], [Ue, o.openTabs, o.artifacts]);
971
- const gt = d((n) => `<svg viewBox="0 0 24 24" fill="currentColor">${mt(n)}</svg>`, []), Vt = d(() => {
972
- de(!1), s.state.clearActiveArtifact();
973
- }, [s]), je = d((n) => {
974
- if (n.language !== "smartdiff") return null;
993
+ N(() => Xe ? o.openTabs.map((r) => o.artifacts.find((E) => E.id === r)).filter(Boolean) : [], [Xe, o.openTabs, o.artifacts]);
994
+ const kt = d((r) => `<svg viewBox="0 0 24 24" fill="currentColor">${Et(r)}</svg>`, []), Zt = d(() => {
995
+ pe(!1), s.state.clearActiveArtifact();
996
+ }, [s]), Ze = d((r) => {
997
+ if (r.language !== "smartdiff") return null;
975
998
  try {
976
- const g = JSON.parse(n.code);
977
- if (g.oldCode === void 0 || g.newCode === void 0) return null;
978
- const T = g.language || "plaintext", A = Tt() && window.Prism.languages[T], Y = ca(g.oldCode, g.newCode).split(`
999
+ const E = JSON.parse(r.code);
1000
+ if (E.oldCode === void 0 || E.newCode === void 0) return null;
1001
+ const C = E.language || "plaintext", w = Ht() && window.Prism.languages[C], J = ga(E.oldCode, E.newCode).split(`
979
1002
  `);
980
- return { html: Y.map((se) => {
981
- const re = se[0], ee = se.slice(1), we = A ? window.Prism.highlight(ee, A, T) : ee;
982
- return re === "-" ? `<span class="token deleted">${we}</span>` : re === "+" ? `<span class="token inserted">${we}</span>` : we;
1003
+ return { html: J.map((re) => {
1004
+ const X = re[0], ne = re.slice(1), Ce = w ? window.Prism.highlight(ne, w, C) : ne;
1005
+ return X === "-" ? `<span class="token deleted">${Ce}</span>` : X === "+" ? `<span class="token inserted">${Ce}</span>` : Ce;
983
1006
  }).join(`
984
- `), lineCount: Y.length };
1007
+ `), lineCount: J.length };
985
1008
  } catch {
986
1009
  return null;
987
1010
  }
988
- }, []), _t = d(() => {
989
- if (!F.current || !(a != null && a.code)) return;
990
- const n = je(a), g = n ? n.lineCount : a.code.split(`
991
- `).length, T = Array.from({ length: g }, (A, Y) => `<div>${Y + 1}</div>`).join("");
992
- F.current.innerHTML = T;
993
- }, [a, je]), yt = d(() => {
994
- if (X.current && Tt() && (a != null && a.code)) {
995
- const n = je(a);
996
- if (n)
997
- X.current.innerHTML = n.html;
1011
+ }, []), xt = d(() => {
1012
+ if (!V.current || !(a != null && a.code)) return;
1013
+ const r = Ze(a), E = r ? r.lineCount : a.code.split(`
1014
+ `).length, C = Array.from({ length: E }, (w, J) => `<div>${J + 1}</div>`).join("");
1015
+ V.current.innerHTML = C;
1016
+ }, [a, Ze]), Ct = d(() => {
1017
+ if (Y.current && Ht() && (a != null && a.code)) {
1018
+ const r = Ze(a);
1019
+ if (r)
1020
+ Y.current.innerHTML = r.html;
998
1021
  else {
999
- const g = window.Prism.languages[Fe];
1000
- g ? X.current.innerHTML = window.Prism.highlight(
1022
+ const E = window.Prism.languages[Re];
1023
+ E ? Y.current.innerHTML = window.Prism.highlight(
1001
1024
  a.code,
1002
- g,
1003
- Fe
1004
- ) : X.current.textContent = a.code;
1025
+ E,
1026
+ Re
1027
+ ) : Y.current.textContent = a.code;
1005
1028
  }
1006
- X.current.dataset.highlighted = "true", setTimeout(() => {
1007
- Wt();
1029
+ Y.current.dataset.highlighted = "true", setTimeout(() => {
1030
+ Kt();
1008
1031
  }, 0);
1009
1032
  }
1010
- }, [a == null ? void 0 : a.code, Fe, je]), Wt = d(() => {
1011
- var g;
1012
- const n = (g = X.current) == null ? void 0 : g.closest("pre");
1013
- if (n && te.current && F.current) {
1014
- const A = window.getComputedStyle(n).backgroundColor;
1015
- A && A !== "rgba(0, 0, 0, 0)" && A !== "transparent" && (te.current.style.backgroundColor = A, F.current.style.backgroundColor = A);
1033
+ }, [a == null ? void 0 : a.code, Re, Ze]), Kt = d(() => {
1034
+ var E;
1035
+ const r = (E = Y.current) == null ? void 0 : E.closest("pre");
1036
+ if (r && se.current && V.current) {
1037
+ const w = window.getComputedStyle(r).backgroundColor;
1038
+ w && w !== "rgba(0, 0, 0, 0)" && w !== "transparent" && (se.current.style.backgroundColor = w, V.current.style.backgroundColor = w);
1016
1039
  }
1017
- }, []), bt = d(() => {
1018
- te.current && (te.current.style.backgroundColor = ""), F.current && (F.current.style.backgroundColor = "");
1019
- }, []), at = d(() => {
1020
- _t(), yt();
1021
- }, [_t, yt]), rt = ((Lt = s.editor) == null ? void 0 : Lt.isAvailable()) || !1, Nt = d(() => {
1022
- !rt || !q.current || !a || (D.current && (D.current.destroy(), D.current = null), D.current = s.editor.create(q.current, {
1040
+ }, []), Lt = d(() => {
1041
+ se.current && (se.current.style.backgroundColor = ""), V.current && (V.current.style.backgroundColor = "");
1042
+ }, []), lt = d(() => {
1043
+ xt(), Ct();
1044
+ }, [xt, Ct]), ct = ((At = s.editor) == null ? void 0 : At.isAvailable()) || !1, Tt = d(() => {
1045
+ !ct || !U.current || !a || (q.current && (q.current.destroy(), q.current = null), q.current = s.editor.create(U.current, {
1023
1046
  code: a.code || "",
1024
1047
  language: a.editorLanguage || a.language || "plaintext",
1025
1048
  sdkTheme: s.getTheme()
1026
1049
  }));
1027
- }, [rt, a, s]), zt = d(() => {
1028
- if (!D.current || !a) return;
1029
- const n = D.current.getCode();
1050
+ }, [ct, a, s]), Yt = d(() => {
1051
+ if (!q.current || !a) return;
1052
+ const r = q.current.getCode();
1030
1053
  s.emit("edit:save", {
1031
1054
  artifactId: a.id,
1032
1055
  artifact: a,
1033
- code: n
1056
+ code: r
1034
1057
  });
1035
- }, [a, s]), Rt = d(() => {
1036
- ve && window.open(ve, "_blank", "noopener,noreferrer");
1037
- }, [ve]), qt = d(() => {
1038
- clearTimeout(I.current), ce(!1), O.current && a && (s.bridge.setIframe(O.current), s.bridge.loadArtifact(a));
1039
- }, [a, s]), Dt = d(() => {
1040
- clearTimeout(I.current), ce(!1);
1041
- }, []), Ut = d(() => {
1042
- clearTimeout(I.current), I.current = setTimeout(() => {
1043
- ce(!1);
1058
+ }, [a, s]), Gt = d(() => {
1059
+ ge && window.open(ge, "_blank", "noopener,noreferrer");
1060
+ }, [ge]), Qt = d(() => {
1061
+ clearTimeout(B.current), oe(!1), Z.current && a && (s.bridge.setIframe(Z.current), s.bridge.loadArtifact(a));
1062
+ }, [a, s]), ea = d(() => {
1063
+ clearTimeout(B.current), oe(!1);
1064
+ }, []), ta = d(() => {
1065
+ clearTimeout(B.current), B.current = setTimeout(() => {
1066
+ oe(!1);
1044
1067
  }, 1e3);
1045
- }, []), jt = d(async () => {
1068
+ }, []), aa = d(async () => {
1046
1069
  if (a)
1047
1070
  try {
1048
- await navigator.clipboard.writeText(a.code), Z(!0), setTimeout(() => Z(!1), 2e3);
1049
- } catch (n) {
1050
- console.error("Failed to copy:", n);
1071
+ await navigator.clipboard.writeText(a.code), G(!0), setTimeout(() => G(!1), 2e3);
1072
+ } catch (r) {
1073
+ console.error("Failed to copy:", r);
1051
1074
  }
1052
- }, [a]), Ot = d(() => {
1075
+ }, [a]), ra = d(() => {
1053
1076
  if (!a) return;
1054
- const { code: n, language: g, editorLanguage: T, title: A } = a, Y = dt(T || g), Ve = `${A.toLowerCase().replace(/\s+/g, "-")}.${Y}`, se = new Blob([n], { type: "text/plain" }), re = URL.createObjectURL(se), ee = document.createElement("a");
1055
- ee.href = re, ee.download = Ve, document.body.appendChild(ee), ee.click(), document.body.removeChild(ee), URL.revokeObjectURL(re);
1056
- }, [a]), Jt = d(async () => {
1057
- if (!(m || j.length === 0)) {
1058
- S(!0);
1077
+ const { code: r, language: E, editorLanguage: C, title: w } = a, J = vt(C || E), xe = `${w.toLowerCase().replace(/\s+/g, "-")}.${J}`, re = new Blob([r], { type: "text/plain" }), X = URL.createObjectURL(re), ne = document.createElement("a");
1078
+ ne.href = X, ne.download = xe, document.body.appendChild(ne), ne.click(), document.body.removeChild(ne), URL.revokeObjectURL(X);
1079
+ }, [a]), na = d(async () => {
1080
+ if (!(m || O.length === 0)) {
1081
+ $(!0);
1059
1082
  try {
1060
- const n = new oa(), g = /* @__PURE__ */ new Map();
1061
- for (const re of j) {
1062
- if (!re.code) continue;
1063
- const ee = dt(re.editorLanguage || re.language);
1064
- let we = (re.title || "untitled").toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-_]/g, ""), ot = `${we}.${ee}`;
1065
- const ut = g.get(ot) || 0;
1066
- ut > 0 && (ot = `${we}-${ut}.${ee}`), g.set(`${we}.${ee}`, ut + 1), n.file(ot, re.code);
1083
+ const r = new ba(), E = /* @__PURE__ */ new Map();
1084
+ for (const X of O) {
1085
+ if (!X.code) continue;
1086
+ const ne = vt(X.editorLanguage || X.language);
1087
+ let Ce = (X.title || "untitled").toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-_]/g, ""), ft = `${Ce}.${ne}`;
1088
+ const pt = E.get(ft) || 0;
1089
+ pt > 0 && (ft = `${Ce}-${pt}.${ne}`), E.set(`${Ce}.${ne}`, pt + 1), r.file(ft, X.code);
1067
1090
  }
1068
- const T = await n.generateAsync({ type: "blob" }), Y = `artifacts-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`, Ve = URL.createObjectURL(T), se = document.createElement("a");
1069
- se.href = Ve, se.download = Y, document.body.appendChild(se), se.click(), document.body.removeChild(se), URL.revokeObjectURL(Ve);
1070
- } catch (n) {
1071
- console.error("Failed to create ZIP:", n);
1091
+ const C = await r.generateAsync({ type: "blob" }), J = `artifacts-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`, xe = URL.createObjectURL(C), re = document.createElement("a");
1092
+ re.href = xe, re.download = J, document.body.appendChild(re), re.click(), document.body.removeChild(re), URL.revokeObjectURL(xe);
1093
+ } catch (r) {
1094
+ console.error("Failed to create ZIP:", r);
1072
1095
  } finally {
1073
- S(!1);
1096
+ $(!1);
1074
1097
  }
1075
1098
  }
1076
- }, [m, j]), wt = d((n) => n ? new Date(n).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : "", []), Xt = d(() => {
1099
+ }, [m, O]), Mt = d((r) => r ? new Date(r).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : "", []), sa = d(() => {
1077
1100
  if (b) {
1078
- N(!1);
1101
+ k(!1);
1079
1102
  return;
1080
1103
  }
1081
- a && (L("options"), ke(""), ye(null), G(""), Se(!1), xe(!1), ze([]), Ae(!1), Re(""), N(!0));
1082
- }, [a, s, b]), Zt = d(() => {
1083
- N(!1);
1084
- }, []), nt = d(async () => {
1104
+ a && (M("options"), Le(""), Ne(null), te(""), Be(!1), Te(!1), Ue([]), Ie(!1), qe(""), k(!0));
1105
+ }, [a, s, b]), la = d(() => {
1106
+ k(!1);
1107
+ }, []), it = d(async () => {
1085
1108
  if (!(!a || !(s != null && s.share))) {
1086
- L("loading"), G("");
1109
+ M("loading"), te("");
1087
1110
  try {
1088
- const n = await s.share.share(a);
1089
- ke(n.url), ye(n.expiresAt), xe(!1), L("success");
1090
- } catch (n) {
1091
- G(n.message || "Failed to create share link"), L("error");
1111
+ const r = await s.share.share(a);
1112
+ Le(r.url), Ne(r.expiresAt), Te(!1), M("success");
1113
+ } catch (r) {
1114
+ te(r.message || "Failed to create share link"), M("error");
1092
1115
  }
1093
1116
  }
1094
- }, [a, s]), kt = d(async () => {
1095
- if (De)
1096
- Oe();
1117
+ }, [a, s]), Pt = d(async () => {
1118
+ if (Je)
1119
+ Ke();
1097
1120
  else {
1098
- L("loading");
1121
+ M("loading");
1099
1122
  try {
1100
- await s.share.openAuthPopup(), Oe();
1101
- } catch (n) {
1102
- n.message === "Authentication cancelled" ? L("options") : (G(n.message || "Authentication failed"), L("error"));
1123
+ await s.share.openAuthPopup(), Ke();
1124
+ } catch (r) {
1125
+ r.message === "Authentication cancelled" ? M("options") : (te(r.message || "Authentication failed"), M("error"));
1103
1126
  }
1104
1127
  }
1105
- }, [De, s]), Oe = d(async () => {
1128
+ }, [Je, s]), Ke = d(async () => {
1106
1129
  if (!(!a || !(s != null && s.share))) {
1107
- L("loading"), G("");
1130
+ M("loading"), te("");
1108
1131
  try {
1109
- const n = await s.share.save(a);
1110
- ke(n.url), ye(null), xe(!0), L("success");
1111
- } catch (n) {
1112
- G(n.message || "Failed to save artifact"), L("error");
1132
+ const r = await s.share.save(a);
1133
+ Le(r.url), Ne(null), Te(!0), M("success");
1134
+ } catch (r) {
1135
+ te(r.message || "Failed to save artifact"), M("error");
1113
1136
  }
1114
1137
  }
1115
- }, [a, s]), Kt = d(() => {
1116
- ae ? Oe() : nt();
1117
- }, [ae, Oe, nt]), Yt = d(async () => {
1138
+ }, [a, s]), ca = d(() => {
1139
+ le ? Ke() : it();
1140
+ }, [le, Ke, it]), ia = d(async () => {
1118
1141
  if (s != null && s.share) {
1119
- if (!De) {
1120
- L("loading");
1142
+ if (!Je) {
1143
+ M("loading");
1121
1144
  try {
1122
1145
  await s.share.openAuthPopup();
1123
- } catch (n) {
1124
- n.message === "Authentication cancelled" ? L("options") : (G(n.message || "Authentication failed"), L("error"));
1146
+ } catch (r) {
1147
+ r.message === "Authentication cancelled" ? M("options") : (te(r.message || "Authentication failed"), M("error"));
1125
1148
  return;
1126
1149
  }
1127
1150
  }
1128
- L("update-list"), Ae(!0);
1151
+ M("update-list"), Ie(!0);
1129
1152
  try {
1130
- const n = (a == null ? void 0 : a.language) || null, g = await s.share.listArtifacts(n);
1131
- ze(g.projects || []);
1132
- } catch (n) {
1133
- G(n.message || "Failed to load artifacts"), L("error");
1153
+ const r = (a == null ? void 0 : a.language) || null, E = await s.share.listArtifacts(r);
1154
+ Ue(E.projects || []);
1155
+ } catch (r) {
1156
+ te(r.message || "Failed to load artifacts"), M("error");
1134
1157
  } finally {
1135
- Ae(!1);
1158
+ Ie(!1);
1136
1159
  }
1137
1160
  }
1138
- }, [a, s, De]), Qt = d(async (n) => {
1139
- var T, A;
1161
+ }, [a, s, Je]), oa = d(async (r) => {
1162
+ var C, w;
1140
1163
  if (!a || !(s != null && s.share)) return;
1141
- const g = (T = n.project) == null ? void 0 : T.uuid;
1142
- if (g) {
1143
- L("loading"), G("");
1164
+ const E = (C = r.project) == null ? void 0 : C.uuid;
1165
+ if (E) {
1166
+ M("loading"), te("");
1144
1167
  try {
1145
- const Y = await s.share.updateArtifact(g, a);
1146
- ke(Y.url || ""), ye(null), xe(!0), Re(((A = n.project) == null ? void 0 : A.name) || "Untitled"), L("success");
1147
- } catch (Y) {
1148
- G(Y.message || "Failed to update artifact"), L("error");
1168
+ const J = await s.share.updateArtifact(E, a);
1169
+ Le(J.url || ""), Ne(null), Te(!0), qe(((w = r.project) == null ? void 0 : w.name) || "Untitled"), M("success");
1170
+ } catch (J) {
1171
+ te(J.message || "Failed to update artifact"), M("error");
1149
1172
  }
1150
1173
  }
1151
- }, [a, s]), Gt = d(async () => {
1152
- if (fe)
1174
+ }, [a, s]), ua = d(async () => {
1175
+ if (Ee)
1153
1176
  try {
1154
- await navigator.clipboard.writeText(fe), Se(!0), setTimeout(() => Se(!1), 2e3);
1155
- } catch (n) {
1156
- console.error("Failed to copy link:", n);
1177
+ await navigator.clipboard.writeText(Ee), Be(!0), setTimeout(() => Be(!1), 2e3);
1178
+ } catch (r) {
1179
+ console.error("Failed to copy link:", r);
1157
1180
  }
1158
- }, [fe]);
1159
- d((n) => {
1160
- p(n);
1161
- }, [p]), d((n) => {
1162
- s.closeTab(n), o.openTabs.length === 0 && de(!1);
1163
- }, [s, o.openTabs]);
1164
- const ea = d(() => {
1165
- oe > 0 && p(j[oe - 1]);
1166
- }, [oe, p, j]), ta = d(() => {
1167
- oe < j.length - 1 && p(j[oe + 1]);
1168
- }, [oe, p, j]), xt = d((n) => {
1169
- de(!0), p(n), le(!1);
1170
- }, [p]), st = d((n) => {
1171
- C.current = {
1172
- startX: n.clientX,
1173
- startWidth: v
1174
- }, document.addEventListener("mousemove", lt), document.addEventListener("mouseup", Je), document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.querySelectorAll("iframe").forEach((g) => {
1175
- g.style.pointerEvents = "none";
1181
+ }, [Ee]);
1182
+ d((r) => {
1183
+ p(r);
1184
+ }, [p]), d((r) => {
1185
+ Nt(r), s.closeTab(r), o.openTabs.length === 0 && pe(!1);
1186
+ }, [s, o.openTabs, Nt]);
1187
+ const ma = d(() => {
1188
+ me > 0 && p(O[me - 1]);
1189
+ }, [me, p, O]), da = d(() => {
1190
+ me < O.length - 1 && p(O[me + 1]);
1191
+ }, [me, p, O]), St = d((r) => {
1192
+ pe(!0), p(r), ie(!1);
1193
+ }, [p]), ot = d((r) => {
1194
+ T.current = {
1195
+ startX: r.clientX,
1196
+ startWidth: h
1197
+ }, document.addEventListener("mousemove", ut), document.addEventListener("mouseup", Ye), document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.querySelectorAll("iframe").forEach((E) => {
1198
+ E.style.pointerEvents = "none";
1176
1199
  });
1177
- }, [v]), lt = d((n) => {
1178
- if (!C.current) return;
1179
- const g = window.innerWidth, A = (C.current.startX - n.clientX) / g * 100, Y = C.current.startWidth + A;
1180
- ne(Math.min(Math.max(Y, 25), 75));
1181
- }, []), Je = d(() => {
1182
- C.current = null, document.removeEventListener("mousemove", lt), document.removeEventListener("mouseup", Je), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((n) => {
1183
- n.style.pointerEvents = "";
1200
+ }, [h]), ut = d((r) => {
1201
+ if (!T.current) return;
1202
+ const E = window.innerWidth, w = (T.current.startX - r.clientX) / E * 100, J = T.current.startWidth + w;
1203
+ ce(Math.min(Math.max(J, 25), 75));
1204
+ }, []), Ye = d(() => {
1205
+ T.current = null, document.removeEventListener("mousemove", ut), document.removeEventListener("mouseup", Ye), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((r) => {
1206
+ r.style.pointerEvents = "";
1184
1207
  });
1185
- }, [lt]), aa = d((n) => {
1208
+ }, [ut]), fa = d((r) => {
1186
1209
  if (!z.current) return;
1187
- const g = z.current.getBoundingClientRect();
1188
- Le.current = {
1189
- startX: n.clientX,
1190
- startPosition: ie,
1191
- contentLeft: g.left,
1192
- contentWidth: g.width
1193
- }, document.addEventListener("mousemove", ct), document.addEventListener("mouseup", Xe), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.querySelectorAll("iframe").forEach((T) => {
1194
- T.style.pointerEvents = "none";
1210
+ const E = z.current.getBoundingClientRect();
1211
+ Pe.current = {
1212
+ startX: r.clientX,
1213
+ startPosition: ue,
1214
+ contentLeft: E.left,
1215
+ contentWidth: E.width
1216
+ }, document.addEventListener("mousemove", mt), document.addEventListener("mouseup", Ge), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.querySelectorAll("iframe").forEach((C) => {
1217
+ C.style.pointerEvents = "none";
1195
1218
  });
1196
- }, [ie]), ct = d((n) => {
1197
- if (!Le.current) return;
1198
- const T = (n.clientX - Le.current.contentLeft) / Le.current.contentWidth * 100;
1199
- Ee(Math.min(Math.max(T, 20), 80));
1200
- }, []), Xe = d(() => {
1201
- Le.current = null, document.removeEventListener("mousemove", ct), document.removeEventListener("mouseup", Xe), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((n) => {
1202
- n.style.pointerEvents = "";
1219
+ }, [ue]), mt = d((r) => {
1220
+ if (!Pe.current) return;
1221
+ const C = (r.clientX - Pe.current.contentLeft) / Pe.current.contentWidth * 100;
1222
+ he(Math.min(Math.max(C, 20), 80));
1223
+ }, []), Ge = d(() => {
1224
+ Pe.current = null, document.removeEventListener("mousemove", mt), document.removeEventListener("mouseup", Ge), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((r) => {
1225
+ r.style.pointerEvents = "";
1203
1226
  });
1204
- }, [ct]);
1205
- if (B(() => {
1206
- a && (U.current && U.current.isPreviewable !== a.isPreviewable && (me(!0), setTimeout(() => me(!1), 150)), U.current = a, bt(), ce(!0), Ut(), at());
1207
- }, [a == null ? void 0 : a.id, bt]), B(() => {
1208
- (o.viewMode === "code" || o.viewMode === "split") && at(), o.viewMode === "edit" && Nt();
1209
- }, [o.viewMode, at, Nt]), B(() => (t && s.on("ai:request", t), r && s.on("save:request", r), c && s.on("export:complete", c), () => {
1210
- t && s.off("ai:request", t), r && s.off("save:request", r), c && s.off("export:complete", c);
1211
- }), [s, t, r, c]), B(() => () => {
1212
- Je(), Xe(), D.current && (D.current.destroy(), D.current = null), clearTimeout(f.current), clearTimeout(I.current);
1213
- }, [Je, Xe]), !o.isPanelOpen) return null;
1214
- const it = [
1227
+ }, [mt]);
1228
+ if (I(() => {
1229
+ a && (j.current && j.current.isPreviewable !== a.isPreviewable && (fe(!0), setTimeout(() => fe(!1), 150)), j.current = a, Wt.includes(a.language) && _("preview"), Lt(), oe(!0), ta(), lt());
1230
+ }, [a == null ? void 0 : a.id, Lt]), I(() => {
1231
+ if (ae === "font" && ze && (a != null && a.code)) {
1232
+ const r = `@font-face { font-family: "${ze}"; src: url("data:${Bt(a.fileExtension || "woff2")};base64,${a.code}"); }`;
1233
+ ee.current || (ee.current = document.createElement("style"), document.head.appendChild(ee.current)), ee.current.textContent = r;
1234
+ } else ee.current && (ee.current.textContent = "");
1235
+ }, [ae, ze, a]), I(() => {
1236
+ (o.viewMode === "code" || o.viewMode === "split") && lt(), o.viewMode === "edit" && Tt();
1237
+ }, [o.viewMode, lt, Tt]), I(() => (t && s.on("ai:request", t), n && s.on("save:request", n), c && s.on("export:complete", c), () => {
1238
+ t && s.off("ai:request", t), n && s.off("save:request", n), c && s.off("export:complete", c);
1239
+ }), [s, t, n, c]), I(() => () => {
1240
+ Ye(), Ge(), q.current && (q.current.destroy(), q.current = null), clearTimeout(f.current), clearTimeout(B.current), Object.keys(W.current).forEach((r) => Ft(W.current[r])), W.current = {}, ee.current && (ee.current.remove(), ee.current = null);
1241
+ }, [Ye, Ge]), !o.isPanelOpen) return null;
1242
+ const dt = [
1215
1243
  "artifactuse-panel",
1216
1244
  o.isFullscreen && "artifactuse-panel--fullscreen",
1217
- !a && P && !o.forceEmptyView && "artifactuse-panel--list",
1218
- !P && !o.forceEmptyView && "artifactuse-panel--empty",
1245
+ !a && S && !o.forceEmptyView && "artifactuse-panel--list",
1246
+ !S && !o.forceEmptyView && "artifactuse-panel--empty",
1219
1247
  l
1220
- ].filter(Boolean).join(" "), ra = [
1248
+ ].filter(Boolean).join(" "), pa = [
1221
1249
  "artifactuse-panel__content",
1222
1250
  `artifactuse-panel__content--${o.viewMode}`,
1223
- ue && "artifactuse-panel__content--transitioning"
1251
+ de && "artifactuse-panel__content--transitioning"
1224
1252
  ].filter(Boolean).join(" ");
1225
- return !P || o.forceEmptyView ? /* @__PURE__ */ e.createElement("div", { className: it, style: o.isFullscreen ? void 0 : { width: `${ht}%` } }, !o.isFullscreen && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle", onMouseDown: st }, /* @__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" }, o.forceEmptyView ? /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__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("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" }, o.forceEmptyView ? "Artifact Viewer" : "Artifacts"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
1253
+ return !S || o.forceEmptyView ? /* @__PURE__ */ e.createElement("div", { className: dt, style: o.isFullscreen ? void 0 : { width: `${wt}%` } }, !o.isFullscreen && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle", onMouseDown: ot }, /* @__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" }, o.forceEmptyView ? /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__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("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" }, o.forceEmptyView ? "Artifact Viewer" : "Artifacts"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
1226
1254
  "button",
1227
1255
  {
1228
1256
  className: "artifactuse-panel__action artifactuse-panel__action--close",
1229
1257
  title: "Close panel",
1230
- onClick: $
1258
+ onClick: A
1231
1259
  },
1232
1260
  /* @__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" }))
1233
- ))), /* @__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" }, o.forceEmptyView ? "No artifact selected" : "No artifacts yet"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-panel__empty-text" }, o.forceEmptyView ? "Open an artifact to have it appear here" : "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" }, et && /* @__PURE__ */ e.createElement(
1261
+ ))), /* @__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" }, o.forceEmptyView ? "No artifact selected" : "No artifacts yet"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-panel__empty-text" }, o.forceEmptyView ? "Open an artifact to have it appear here" : "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" }, nt && /* @__PURE__ */ e.createElement(
1234
1262
  "a",
1235
1263
  {
1236
1264
  href: "https://artifactuse.com",
@@ -1243,32 +1271,32 @@ function Fa({
1243
1271
  ))) : a ? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
1244
1272
  "div",
1245
1273
  {
1246
- className: it,
1247
- style: o.isFullscreen ? void 0 : { width: `${v}%` }
1274
+ className: dt,
1275
+ style: o.isFullscreen ? void 0 : { width: `${h}%` }
1248
1276
  },
1249
1277
  !o.isFullscreen && /* @__PURE__ */ e.createElement(
1250
1278
  "div",
1251
1279
  {
1252
1280
  className: "artifactuse-panel__resize-handle",
1253
- onMouseDown: st
1281
+ onMouseDown: ot
1254
1282
  },
1255
1283
  /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle-line" })
1256
1284
  ),
1257
- /* @__PURE__ */ e.createElement("header", { className: "artifactuse-panel__header" }, (Ue || _e) && /* @__PURE__ */ e.createElement(
1285
+ /* @__PURE__ */ e.createElement("header", { className: "artifactuse-panel__header" }, (Xe || be) && /* @__PURE__ */ e.createElement(
1258
1286
  "button",
1259
1287
  {
1260
1288
  className: "artifactuse-panel__back",
1261
- title: Ue ? "Browse artifacts" : "Back to list",
1262
- onClick: Vt
1289
+ title: Xe ? "Browse artifacts" : "Back to list",
1290
+ onClick: Zt
1263
1291
  },
1264
1292
  /* @__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" }))
1265
1293
  ), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title" }, /* @__PURE__ */ e.createElement(
1266
1294
  "span",
1267
1295
  {
1268
1296
  className: "artifactuse-panel__icon",
1269
- dangerouslySetInnerHTML: { __html: `<svg viewBox="0 0 24 24" fill="currentColor">${Be}</svg>` }
1297
+ dangerouslySetInnerHTML: { __html: `<svg viewBox="0 0 24 24" fill="currentColor">${Ut}</svg>` }
1270
1298
  }
1271
- ), /* @__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" }, Q, a.lineCount && ` • ${a.lineCount} lines`))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__tabs" }, (!a.tabs || a.tabs.includes("preview")) && /* @__PURE__ */ e.createElement(
1299
+ ), /* @__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" }, gt, a.lineCount && ` • ${a.lineCount} lines`))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__tabs" }, (!a.tabs || a.tabs.includes("preview")) && /* @__PURE__ */ e.createElement(
1272
1300
  "button",
1273
1301
  {
1274
1302
  className: `artifactuse-panel__tab ${o.viewMode === "preview" ? "artifactuse-panel__tab--active" : ""}`,
@@ -1277,7 +1305,7 @@ function Fa({
1277
1305
  onClick: () => _("preview")
1278
1306
  },
1279
1307
  /* @__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" }))
1280
- ), (!a.tabs || a.tabs.includes("code")) && /* @__PURE__ */ e.createElement(
1308
+ ), (!a.tabs || a.tabs.includes("code")) && !Se && /* @__PURE__ */ e.createElement(
1281
1309
  "button",
1282
1310
  {
1283
1311
  className: `artifactuse-panel__tab ${o.viewMode === "code" ? "artifactuse-panel__tab--active" : ""}`,
@@ -1285,7 +1313,7 @@ function Fa({
1285
1313
  onClick: () => _("code")
1286
1314
  },
1287
1315
  /* @__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" }))
1288
- ), (!a.tabs || a.tabs.includes("split")) && /* @__PURE__ */ e.createElement(
1316
+ ), (!a.tabs || a.tabs.includes("split")) && !Se && /* @__PURE__ */ e.createElement(
1289
1317
  "button",
1290
1318
  {
1291
1319
  className: `artifactuse-panel__tab ${o.viewMode === "split" ? "artifactuse-panel__tab--active" : ""}`,
@@ -1294,7 +1322,7 @@ function Fa({
1294
1322
  onClick: () => _("split")
1295
1323
  },
1296
1324
  /* @__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" }))
1297
- ), a.tabs && a.tabs.includes("edit") && rt && /* @__PURE__ */ e.createElement(
1325
+ ), a.tabs && a.tabs.includes("edit") && ct && /* @__PURE__ */ e.createElement(
1298
1326
  "button",
1299
1327
  {
1300
1328
  className: `artifactuse-panel__tab ${o.viewMode === "edit" ? "artifactuse-panel__tab--active" : ""}`,
@@ -1307,15 +1335,15 @@ function Fa({
1307
1335
  {
1308
1336
  className: "artifactuse-panel__action artifactuse-panel__action--save",
1309
1337
  title: "Save",
1310
- onClick: zt
1338
+ onClick: Yt
1311
1339
  },
1312
1340
  /* @__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" }))
1313
- ), Ht && /* @__PURE__ */ e.createElement(
1341
+ ), jt && /* @__PURE__ */ e.createElement(
1314
1342
  "button",
1315
1343
  {
1316
1344
  className: "artifactuse-panel__action",
1317
1345
  title: "Open in new tab",
1318
- onClick: Rt
1346
+ onClick: Gt
1319
1347
  },
1320
1348
  /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }), /* @__PURE__ */ e.createElement("polyline", { points: "15 3 21 3 21 9" }), /* @__PURE__ */ e.createElement("line", { x1: "10", y1: "14", x2: "21", y2: "3" }))
1321
1349
  ), /* @__PURE__ */ e.createElement(
@@ -1323,7 +1351,7 @@ function Fa({
1323
1351
  {
1324
1352
  className: "artifactuse-panel__action",
1325
1353
  title: o.isFullscreen ? "Exit fullscreen" : "Fullscreen",
1326
- onClick: W
1354
+ onClick: R
1327
1355
  },
1328
1356
  o.isFullscreen ? /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "4 14 10 14 10 20" }), /* @__PURE__ */ e.createElement("polyline", { points: "20 10 14 10 14 4" }), /* @__PURE__ */ e.createElement("line", { x1: "14", y1: "10", x2: "21", y2: "3" }), /* @__PURE__ */ e.createElement("line", { x1: "3", y1: "21", x2: "10", y2: "14" })) : /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "15 3 21 3 21 9" }), /* @__PURE__ */ e.createElement("polyline", { points: "9 21 3 21 3 15" }), /* @__PURE__ */ e.createElement("line", { x1: "21", y1: "3", x2: "14", y2: "10" }), /* @__PURE__ */ e.createElement("line", { x1: "3", y1: "21", x2: "10", y2: "14" }))
1329
1357
  ), /* @__PURE__ */ e.createElement(
@@ -1331,35 +1359,35 @@ function Fa({
1331
1359
  {
1332
1360
  className: "artifactuse-panel__action artifactuse-panel__action--close",
1333
1361
  title: "Close",
1334
- onClick: $
1362
+ onClick: A
1335
1363
  },
1336
1364
  /* @__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" }))
1337
1365
  ))),
1338
- /* @__PURE__ */ e.createElement("div", { className: ra, ref: z }, ue && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__spinner" })), (o.viewMode === "preview" || o.viewMode === "split") && /* @__PURE__ */ e.createElement(
1366
+ /* @__PURE__ */ e.createElement("div", { className: pa, ref: z }, de && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__spinner" })), (o.viewMode === "preview" || o.viewMode === "split") && /* @__PURE__ */ e.createElement(
1339
1367
  "div",
1340
1368
  {
1341
1369
  className: "artifactuse-panel__preview",
1342
- style: o.viewMode === "split" ? { width: `${ie}%` } : void 0
1370
+ style: o.viewMode === "split" ? { width: `${ue}%` } : void 0
1343
1371
  },
1344
- ge && ve && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__spinner" })),
1345
- ve ? /* @__PURE__ */ e.createElement(
1372
+ ye && ge && !Se && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__spinner" })),
1373
+ Se ? /* @__PURE__ */ e.createElement(e.Fragment, null, ae === "image" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__binary artifactuse-panel__binary--image" }, /* @__PURE__ */ e.createElement("img", { src: je(a), alt: a.title || "image" })), ae === "audio" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__binary artifactuse-panel__binary--audio" }, /* @__PURE__ */ e.createElement("audio", { controls: !0, src: je(a) })), ae === "video" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__binary artifactuse-panel__binary--video" }, /* @__PURE__ */ e.createElement("video", { controls: !0, src: je(a) })), ae === "pdf" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__binary artifactuse-panel__binary--pdf" }, /* @__PURE__ */ e.createElement("iframe", { src: je(a) + "#toolbar=1", title: a.title || "PDF" })), ae === "font" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__binary artifactuse-panel__binary--font" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__font-sample", style: { fontFamily: ze } }, "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__font-sample artifactuse-panel__font-sample--sm", style: { fontFamily: ze } }, "0123456789 !@#$%^&*()")), ae === "binary" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__binary artifactuse-panel__binary--hex" }, /* @__PURE__ */ e.createElement("pre", { className: "artifactuse-panel__hex-dump" }, qt))) : ge ? /* @__PURE__ */ e.createElement(
1346
1374
  "iframe",
1347
1375
  {
1348
- ref: O,
1349
- src: ve,
1350
- className: `artifactuse-panel__iframe ${ge ? "artifactuse-panel__iframe--loading" : ""}`,
1376
+ ref: Z,
1377
+ src: ge,
1378
+ className: `artifactuse-panel__iframe ${ye ? "artifactuse-panel__iframe--loading" : ""}`,
1351
1379
  sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-downloads allow-top-navigation-by-user-activation",
1352
1380
  allow: "camera; microphone; fullscreen; geolocation; display-capture; autoplay; clipboard-write; encrypted-media; gyroscope; accelerometer; picture-in-picture",
1353
- onLoad: qt,
1354
- onError: Dt
1381
+ onLoad: Qt,
1382
+ onError: ea
1355
1383
  }
1356
- ) : /* @__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 ", Q))
1384
+ ) : /* @__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 ", gt))
1357
1385
  ), /* @__PURE__ */ e.createElement(
1358
1386
  "div",
1359
1387
  {
1360
1388
  className: "artifactuse-panel__code",
1361
1389
  style: {
1362
- ...o.viewMode === "split" ? { width: `${100 - ie}%` } : {},
1390
+ ...o.viewMode === "split" ? { width: `${100 - ue}%` } : {},
1363
1391
  display: o.viewMode === "code" || o.viewMode === "split" ? void 0 : "none"
1364
1392
  }
1365
1393
  },
@@ -1367,15 +1395,15 @@ function Fa({
1367
1395
  "div",
1368
1396
  {
1369
1397
  className: "artifactuse-panel__split-handle",
1370
- onMouseDown: aa
1398
+ onMouseDown: fa
1371
1399
  },
1372
1400
  /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__split-handle-line" })
1373
1401
  ),
1374
- /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__code-scroll", ref: te }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__line-numbers", ref: F }), /* @__PURE__ */ e.createElement("pre", { className: `artifactuse-panel__code-block language-${Fe}` }, /* @__PURE__ */ e.createElement(
1402
+ /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__code-scroll", ref: se }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__line-numbers", ref: V }), /* @__PURE__ */ e.createElement("pre", { className: `artifactuse-panel__code-block language-${Re}` }, /* @__PURE__ */ e.createElement(
1375
1403
  "code",
1376
1404
  {
1377
- ref: X,
1378
- className: `language-${Fe}`
1405
+ ref: Y,
1406
+ className: `language-${Re}`
1379
1407
  }
1380
1408
  )))
1381
1409
  ), /* @__PURE__ */ e.createElement(
@@ -1384,29 +1412,29 @@ function Fa({
1384
1412
  className: "artifactuse-panel__edit",
1385
1413
  style: { display: o.viewMode === "edit" ? void 0 : "none" }
1386
1414
  },
1387
- /* @__PURE__ */ e.createElement("div", { ref: q, className: "artifactuse-panel__editor-container" })
1415
+ /* @__PURE__ */ e.createElement("div", { ref: U, className: "artifactuse-panel__editor-container" })
1388
1416
  )),
1389
- Bt && /* @__PURE__ */ e.createElement("div", { className: `artifactuse-panel__console ${Ce ? "artifactuse-panel__console--expanded" : ""}` }, /* @__PURE__ */ e.createElement(
1417
+ Jt && /* @__PURE__ */ e.createElement("div", { className: `artifactuse-panel__console ${Me ? "artifactuse-panel__console--expanded" : ""}` }, /* @__PURE__ */ e.createElement(
1390
1418
  "div",
1391
1419
  {
1392
1420
  className: "artifactuse-panel__console-header",
1393
- onClick: () => Ie((n) => !n)
1421
+ onClick: () => We((r) => !r)
1394
1422
  },
1395
1423
  /* @__PURE__ */ e.createElement("svg", { className: "artifactuse-panel__console-chevron", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "18 15 12 9 6 15" })),
1396
1424
  /* @__PURE__ */ e.createElement("span", null, "Console"),
1397
- /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__console-filters", onClick: (n) => n.stopPropagation() }, tt > 0 && /* @__PURE__ */ e.createElement("button", { className: `artifactuse-panel__console-filter artifactuse-panel__console-filter--error${pe.has("error") ? "" : " artifactuse-panel__console-filter--inactive"}`, onClick: () => qe("error") }, tt, " error", tt !== 1 ? "s" : ""), pt > 0 && /* @__PURE__ */ e.createElement("button", { className: `artifactuse-panel__console-filter artifactuse-panel__console-filter--warn${pe.has("warn") ? "" : " artifactuse-panel__console-filter--inactive"}`, onClick: () => qe("warn") }, pt, " warn"), Et > 0 && /* @__PURE__ */ e.createElement("button", { className: `artifactuse-panel__console-filter artifactuse-panel__console-filter--info${pe.has("info") ? "" : " artifactuse-panel__console-filter--inactive"}`, onClick: () => qe("info") }, Et, " info"), vt > 0 && /* @__PURE__ */ e.createElement("button", { className: `artifactuse-panel__console-filter artifactuse-panel__console-filter--log${pe.has("log") ? "" : " artifactuse-panel__console-filter--inactive"}`, onClick: () => qe("log") }, vt, " log")),
1425
+ /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__console-filters", onClick: (r) => r.stopPropagation() }, st > 0 && /* @__PURE__ */ e.createElement("button", { className: `artifactuse-panel__console-filter artifactuse-panel__console-filter--error${ve.has("error") ? "" : " artifactuse-panel__console-filter--inactive"}`, onClick: () => Oe("error") }, st, " error", st !== 1 ? "s" : ""), _t > 0 && /* @__PURE__ */ e.createElement("button", { className: `artifactuse-panel__console-filter artifactuse-panel__console-filter--warn${ve.has("warn") ? "" : " artifactuse-panel__console-filter--inactive"}`, onClick: () => Oe("warn") }, _t, " warn"), yt > 0 && /* @__PURE__ */ e.createElement("button", { className: `artifactuse-panel__console-filter artifactuse-panel__console-filter--info${ve.has("info") ? "" : " artifactuse-panel__console-filter--inactive"}`, onClick: () => Oe("info") }, yt, " info"), bt > 0 && /* @__PURE__ */ e.createElement("button", { className: `artifactuse-panel__console-filter artifactuse-panel__console-filter--log${ve.has("log") ? "" : " artifactuse-panel__console-filter--inactive"}`, onClick: () => Oe("log") }, bt, " log")),
1398
1426
  /* @__PURE__ */ e.createElement(
1399
1427
  "button",
1400
1428
  {
1401
1429
  className: "artifactuse-panel__console-clear",
1402
- onClick: (n) => {
1403
- n.stopPropagation(), He([]);
1430
+ onClick: (r) => {
1431
+ r.stopPropagation(), Ve([]);
1404
1432
  }
1405
1433
  },
1406
1434
  "Clear"
1407
1435
  )
1408
- ), Ce && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__console-entries", ref: Ne }, It.map((n, g) => /* @__PURE__ */ e.createElement("div", { key: g, className: `artifactuse-panel__console-entry artifactuse-panel__console-entry--${n.type}` }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__console-type" }, "[", n.type, "]"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__console-content" }, n.content), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__console-timestamp" }, new Date(n.timestamp).toLocaleTimeString()))))),
1409
- /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__footer-left" }, et && /* @__PURE__ */ e.createElement(
1436
+ ), Me && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__console-entries", ref: ke }, Ot.map((r, E) => /* @__PURE__ */ e.createElement("div", { key: E, className: `artifactuse-panel__console-entry artifactuse-panel__console-entry--${r.type}` }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__console-type" }, "[", r.type, "]"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__console-content" }, r.content), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__console-timestamp" }, new Date(r.timestamp).toLocaleTimeString()))))),
1437
+ /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__footer-left" }, nt && /* @__PURE__ */ e.createElement(
1410
1438
  "a",
1411
1439
  {
1412
1440
  href: "https://artifactuse.com",
@@ -1417,12 +1445,12 @@ function Fa({
1417
1445
  },
1418
1446
  /* @__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" })),
1419
1447
  /* @__PURE__ */ e.createElement("span", null, "Artifactuse")
1420
- ), a.code && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__badge artifactuse-panel__badge--secondary" }, St(a.size))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__footer-right" }, /* @__PURE__ */ e.createElement(
1448
+ ), a.code && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__badge artifactuse-panel__badge--secondary" }, Rt(a.size))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__footer-right" }, /* @__PURE__ */ e.createElement(
1421
1449
  "button",
1422
1450
  {
1423
1451
  className: `artifactuse-panel__footer-action ${H ? "artifactuse-panel__footer-action--success" : ""}`,
1424
1452
  title: H ? "Copied!" : "Copy code",
1425
- onClick: jt
1453
+ onClick: aa
1426
1454
  },
1427
1455
  H ? /* @__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" }))
1428
1456
  ), /* @__PURE__ */ e.createElement(
@@ -1430,102 +1458,102 @@ function Fa({
1430
1458
  {
1431
1459
  className: "artifactuse-panel__footer-action",
1432
1460
  title: "Download",
1433
- onClick: Ot
1461
+ onClick: ra
1434
1462
  },
1435
1463
  /* @__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" }))
1436
- ), Ft && /* @__PURE__ */ e.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ e.createElement(
1464
+ ), Xt && /* @__PURE__ */ e.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ e.createElement(
1437
1465
  "button",
1438
1466
  {
1439
1467
  className: "artifactuse-panel__footer-action",
1440
1468
  title: "Share",
1441
- onClick: Xt
1469
+ onClick: sa
1442
1470
  },
1443
1471
  /* @__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" }))
1444
- ), b && /* @__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" }, M === "success" ? Qe ? "Artifact updated!" : "Link created!" : M === "update-list" ? "Update saved artifact" : "Share Artifact"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__close", onClick: Zt }, /* @__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" }, M === "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...")), M === "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" }, Ye)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__actions" }, /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__btn artifactuse-share-popup__btn--secondary", onClick: () => L("options") }, "Back"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__btn artifactuse-share-popup__btn--primary", onClick: Kt }, "Retry"))), M === "options" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__options" }, /* @__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("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: kt }, /* @__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: Yt }, /* @__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")))), M === "update-list" && /* @__PURE__ */ e.createElement("div", null, be ? /* @__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...")) : $e.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" }, $e.map((n) => {
1445
- var g, T, A;
1472
+ ), b && /* @__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" }, P === "success" ? at ? "Artifact updated!" : "Link created!" : P === "update-list" ? "Update saved artifact" : "Share Artifact"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__close", onClick: la }, /* @__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" }, P === "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...")), P === "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" }, tt)), /* @__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: ca }, "Retry"))), P === "options" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__options" }, /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__option", onClick: it }, /* @__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: Pt }, /* @__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: ia }, /* @__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")))), P === "update-list" && /* @__PURE__ */ e.createElement("div", null, we ? /* @__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...")) : Fe.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" }, Fe.map((r) => {
1473
+ var E, C, w;
1446
1474
  return /* @__PURE__ */ e.createElement(
1447
1475
  "button",
1448
1476
  {
1449
- key: ((g = n.project) == null ? void 0 : g.uuid) || n.id,
1477
+ key: ((E = r.project) == null ? void 0 : E.uuid) || r.id,
1450
1478
  className: "artifactuse-share-popup__artifact-item",
1451
- onClick: () => Qt(n)
1479
+ onClick: () => oa(r)
1452
1480
  },
1453
- /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-name" }, ((T = n.project) == null ? void 0 : T.name) || "Untitled"),
1454
- /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-date" }, wt((A = n.project) == null ? void 0 : A.created_at))
1481
+ /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-name" }, ((C = r.project) == null ? void 0 : C.name) || "Untitled"),
1482
+ /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-date" }, Mt((w = r.project) == null ? void 0 : w.created_at))
1455
1483
  );
1456
- })), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__back-btn", onClick: () => L("options") }, "Back")), M === "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(
1484
+ })), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__back-btn", onClick: () => M("options") }, "Back")), P === "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(
1457
1485
  "input",
1458
1486
  {
1459
1487
  type: "text",
1460
1488
  className: "artifactuse-share-popup__link",
1461
- value: fe,
1489
+ value: Ee,
1462
1490
  readOnly: !0,
1463
- onClick: (n) => n.target.select()
1491
+ onClick: (r) => r.target.select()
1464
1492
  }
1465
1493
  ), /* @__PURE__ */ e.createElement(
1466
1494
  "button",
1467
1495
  {
1468
- className: `artifactuse-share-popup__copy-btn ${We ? "artifactuse-share-popup__copy-btn--copied" : ""}`,
1469
- onClick: Gt
1496
+ className: `artifactuse-share-popup__copy-btn ${De ? "artifactuse-share-popup__copy-btn--copied" : ""}`,
1497
+ onClick: ua
1470
1498
  },
1471
- We ? "Copied!" : "Copy"
1472
- )), Pe && !ae && /* @__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 ", wt(Pe))), !ae && /* @__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: kt }, "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"))))), j.length > 1 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__nav" }, /* @__PURE__ */ e.createElement(
1499
+ De ? "Copied!" : "Copy"
1500
+ )), He && !le && /* @__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 ", Mt(He))), !le && /* @__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: Pt }, "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"))))), O.length > 1 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__nav" }, /* @__PURE__ */ e.createElement(
1473
1501
  "button",
1474
1502
  {
1475
1503
  className: "artifactuse-panel__nav-btn",
1476
- disabled: oe <= 0,
1504
+ disabled: me <= 0,
1477
1505
  title: "Previous artifact",
1478
- onClick: ea
1506
+ onClick: ma
1479
1507
  },
1480
1508
  /* @__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" }))
1481
1509
  ), /* @__PURE__ */ e.createElement(
1482
1510
  "button",
1483
1511
  {
1484
1512
  className: "artifactuse-panel__nav-trigger",
1485
- onClick: () => le(!he)
1513
+ onClick: () => ie(!_e)
1486
1514
  },
1487
- /* @__PURE__ */ e.createElement("span", null, oe + 1, " / ", j.length),
1515
+ /* @__PURE__ */ e.createElement("span", null, me + 1, " / ", O.length),
1488
1516
  /* @__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" }))
1489
1517
  ), /* @__PURE__ */ e.createElement(
1490
1518
  "button",
1491
1519
  {
1492
1520
  className: "artifactuse-panel__nav-btn",
1493
- disabled: oe >= j.length - 1,
1521
+ disabled: me >= O.length - 1,
1494
1522
  title: "Next artifact",
1495
- onClick: ta
1523
+ onClick: da
1496
1524
  },
1497
1525
  /* @__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" }))
1498
- ), he && /* @__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 (", j.length, ")"), /* @__PURE__ */ e.createElement(
1526
+ ), _e && /* @__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 (", O.length, ")"), /* @__PURE__ */ e.createElement(
1499
1527
  "button",
1500
1528
  {
1501
1529
  className: "artifactuse-panel__artifact-list-close",
1502
- onClick: () => le(!1)
1530
+ onClick: () => ie(!1)
1503
1531
  },
1504
1532
  /* @__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" }))
1505
- )), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list-items" }, j.map((n, g) => /* @__PURE__ */ e.createElement(
1533
+ )), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list-items" }, O.map((r, E) => /* @__PURE__ */ e.createElement(
1506
1534
  "button",
1507
1535
  {
1508
- key: n.id,
1509
- className: `artifactuse-panel__artifact-item ${n.id === a.id ? "artifactuse-panel__artifact-item--active" : ""}`,
1510
- onClick: () => xt(n)
1536
+ key: r.id,
1537
+ className: `artifactuse-panel__artifact-item ${r.id === a.id ? "artifactuse-panel__artifact-item--active" : ""}`,
1538
+ onClick: () => St(r)
1511
1539
  },
1512
1540
  /* @__PURE__ */ e.createElement(
1513
1541
  "span",
1514
1542
  {
1515
1543
  className: "artifactuse-panel__artifact-item-icon",
1516
- dangerouslySetInnerHTML: { __html: gt(n.language) }
1544
+ dangerouslySetInnerHTML: { __html: kt(r.language) }
1517
1545
  }
1518
1546
  ),
1519
- /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-title" }, n.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-meta" }, Ze(n.language), n.lineCount && ` • ${n.lineCount} lines`)),
1520
- /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-index" }, g + 1)
1547
+ /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-title" }, r.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-meta" }, Qe(r.language), r.lineCount && ` • ${r.lineCount} lines`)),
1548
+ /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-index" }, E + 1)
1521
1549
  )))))))
1522
- )) : /* @__PURE__ */ e.createElement("div", { className: it, style: o.isFullscreen ? void 0 : { width: `${ht}%` } }, !o.isFullscreen && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle", onMouseDown: st }, /* @__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" }, j.length, " available"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
1550
+ )) : /* @__PURE__ */ e.createElement("div", { className: dt, style: o.isFullscreen ? void 0 : { width: `${wt}%` } }, !o.isFullscreen && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle", onMouseDown: ot }, /* @__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" }, O.length, " available"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
1523
1551
  "button",
1524
1552
  {
1525
1553
  className: `artifactuse-panel__action ${m ? "artifactuse-panel__action--loading" : ""}`,
1526
1554
  disabled: m,
1527
1555
  title: "Download all as ZIP",
1528
- onClick: Jt
1556
+ onClick: na
1529
1557
  },
1530
1558
  m ? /* @__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" }))
1531
1559
  ), /* @__PURE__ */ e.createElement(
@@ -1533,26 +1561,26 @@ function Fa({
1533
1561
  {
1534
1562
  className: "artifactuse-panel__action artifactuse-panel__action--close",
1535
1563
  title: "Close panel",
1536
- onClick: $
1564
+ onClick: A
1537
1565
  },
1538
1566
  /* @__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" }))
1539
- ))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-items" }, j.map((n, g) => /* @__PURE__ */ e.createElement(
1567
+ ))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-items" }, O.map((r, E) => /* @__PURE__ */ e.createElement(
1540
1568
  "button",
1541
1569
  {
1542
- key: n.id,
1570
+ key: r.id,
1543
1571
  className: "artifactuse-panel__list-item",
1544
- onClick: () => xt(n)
1572
+ onClick: () => St(r)
1545
1573
  },
1546
1574
  /* @__PURE__ */ e.createElement(
1547
1575
  "span",
1548
1576
  {
1549
1577
  className: "artifactuse-panel__list-item-icon",
1550
- dangerouslySetInnerHTML: { __html: gt(n.language) }
1578
+ dangerouslySetInnerHTML: { __html: kt(r.language) }
1551
1579
  }
1552
1580
  ),
1553
- /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-title" }, n.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-meta" }, Ze(n.language), n.lineCount && ` • ${n.lineCount} lines`)),
1581
+ /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-title" }, r.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-meta" }, Qe(r.language), r.lineCount && ` • ${r.lineCount} lines`)),
1554
1582
  /* @__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" })))
1555
- )))), /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer artifactuse-panel__footer--simple" }, et && /* @__PURE__ */ e.createElement(
1583
+ )))), /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer artifactuse-panel__footer--simple" }, nt && /* @__PURE__ */ e.createElement(
1556
1584
  "a",
1557
1585
  {
1558
1586
  href: "https://artifactuse.com",
@@ -1564,28 +1592,28 @@ function Fa({
1564
1592
  /* @__PURE__ */ e.createElement("span", null, "Artifactuse")
1565
1593
  )));
1566
1594
  }
1567
- function Va({ className: t = "" }) {
1568
- const { state: r, artifactCount: c, hasArtifacts: l, togglePanel: i } = Me(), u = w(() => c > 99 ? "99+" : String(c), [c]), h = [
1595
+ function Ka({ className: t = "" }) {
1596
+ const { state: n, artifactCount: c, hasArtifacts: l, togglePanel: i } = Ae(), u = N(() => c > 99 ? "99+" : String(c), [c]), g = [
1569
1597
  "artifactuse-panel-toggle",
1570
- r.isPanelOpen && "artifactuse-panel-toggle--active",
1598
+ n.isPanelOpen && "artifactuse-panel-toggle--active",
1571
1599
  l && "artifactuse-panel-toggle--has-artifacts",
1572
1600
  t
1573
1601
  ].filter(Boolean).join(" ");
1574
1602
  return /* @__PURE__ */ e.createElement(
1575
1603
  "button",
1576
1604
  {
1577
- className: h,
1605
+ className: g,
1578
1606
  onClick: i,
1579
- title: r.isPanelOpen ? "Close artifacts panel" : "Open artifacts panel"
1607
+ title: n.isPanelOpen ? "Close artifacts panel" : "Open artifacts panel"
1580
1608
  },
1581
1609
  /* @__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" })),
1582
1610
  c > 0 && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel-toggle-badge" }, u)
1583
1611
  );
1584
1612
  }
1585
- const At = na(null);
1586
- function Pa({ children: t, config: r = {} }) {
1587
- const c = V(null);
1588
- c.current || (c.current = ia(r));
1613
+ const Dt = Ea(null);
1614
+ function Da({ children: t, config: n = {} }) {
1615
+ const c = F(null);
1616
+ c.current || (c.current = _a(n));
1589
1617
  const l = c.current, [i, u] = y({
1590
1618
  artifacts: [],
1591
1619
  activeArtifactId: null,
@@ -1595,8 +1623,8 @@ function Pa({ children: t, config: r = {} }) {
1595
1623
  openTabs: [],
1596
1624
  tabViewModes: {},
1597
1625
  forceEmptyView: !1
1598
- }), [h, E] = y(() => l.getPanelTypes());
1599
- B(() => {
1626
+ }), [g, v] = y(() => l.getPanelTypes());
1627
+ I(() => {
1600
1628
  const p = l.state.subscribe((s) => {
1601
1629
  u({
1602
1630
  artifacts: s.artifacts,
@@ -1613,21 +1641,21 @@ function Pa({ children: t, config: r = {} }) {
1613
1641
  p(), l.destroy();
1614
1642
  };
1615
1643
  }, [l]);
1616
- const o = w(() => i.activeArtifactId && i.artifacts.find((p) => p.id === i.activeArtifactId) || null, [i.artifacts, i.activeArtifactId]), a = i.artifacts.filter((p) => !p.isInline).length, k = a > 0, P = w(() => o ? l.getPanelUrl(o) : null, [o, l]), $ = d((p) => {
1644
+ const o = N(() => i.activeArtifactId && i.artifacts.find((p) => p.id === i.activeArtifactId) || null, [i.artifacts, i.activeArtifactId]), a = i.artifacts.filter((p) => !p.isInline).length, x = a > 0, S = N(() => o ? l.getPanelUrl(o) : null, [o, l]), A = d((p) => {
1617
1645
  l.setTheme(p), l.applyTheme();
1618
- }, [l]), W = d((p, s) => {
1619
- l.registerPanel(p, s), E(l.getPanelTypes());
1646
+ }, [l]), R = d((p, s) => {
1647
+ l.registerPanel(p, s), v(l.getPanelTypes());
1620
1648
  }, [l]), _ = d((p) => {
1621
- l.unregisterPanel(p), E(l.getPanelTypes());
1622
- }, [l]), x = w(() => ({
1649
+ l.unregisterPanel(p), v(l.getPanelTypes());
1650
+ }, [l]), L = N(() => ({
1623
1651
  instance: l,
1624
1652
  state: i,
1625
1653
  activeArtifact: o,
1626
1654
  artifactCount: a,
1627
- hasArtifacts: k,
1655
+ hasArtifacts: x,
1628
1656
  // Panel computed
1629
- panelTypes: h,
1630
- activePanelUrl: P,
1657
+ panelTypes: g,
1658
+ activePanelUrl: S,
1631
1659
  // Methods
1632
1660
  processMessage: l.processMessage,
1633
1661
  initializeContent: l.initializeContent,
@@ -1644,7 +1672,7 @@ function Pa({ children: t, config: r = {} }) {
1644
1672
  sendToPanel: l.sendToPanel,
1645
1673
  // Panel management
1646
1674
  hasPanel: l.hasPanel,
1647
- registerPanel: W,
1675
+ registerPanel: R,
1648
1676
  unregisterPanel: _,
1649
1677
  getPanelTypes: l.getPanelTypes,
1650
1678
  // Multi-tab
@@ -1658,76 +1686,76 @@ function Pa({ children: t, config: r = {} }) {
1658
1686
  clearArtifacts: () => l.state.clear(),
1659
1687
  // Theme
1660
1688
  applyTheme: l.applyTheme,
1661
- setTheme: $,
1689
+ setTheme: A,
1662
1690
  getTheme: l.getTheme
1663
1691
  }), [
1664
1692
  l,
1665
1693
  i,
1666
1694
  o,
1667
1695
  a,
1668
- k,
1669
- h,
1670
- P,
1671
- $,
1672
- W,
1696
+ x,
1697
+ g,
1698
+ S,
1699
+ A,
1700
+ R,
1673
1701
  _
1674
1702
  ]);
1675
- return /* @__PURE__ */ e.createElement(At.Provider, { value: x }, t);
1703
+ return /* @__PURE__ */ e.createElement(Dt.Provider, { value: L }, t);
1676
1704
  }
1677
- function Me() {
1678
- const t = sa(At);
1705
+ function Ae() {
1706
+ const t = va(Dt);
1679
1707
  if (!t)
1680
1708
  throw new Error("useArtifactuse must be used within an ArtifactuseProvider");
1681
1709
  return t;
1682
1710
  }
1683
- function Sa(t, r) {
1684
- const { on: c, off: l } = Me();
1685
- B(() => {
1686
- const i = c(t, r);
1711
+ function Ua(t, n) {
1712
+ const { on: c, off: l } = Ae();
1713
+ I(() => {
1714
+ const i = c(t, n);
1687
1715
  return () => {
1688
- typeof i == "function" ? i() : l(t, r);
1716
+ typeof i == "function" ? i() : l(t, n);
1689
1717
  };
1690
- }, [t, r, c, l]);
1718
+ }, [t, n, c, l]);
1691
1719
  }
1692
- function $a() {
1720
+ function qa() {
1693
1721
  const {
1694
1722
  registerPanel: t,
1695
- unregisterPanel: r,
1723
+ unregisterPanel: n,
1696
1724
  hasPanel: c,
1697
1725
  panelTypes: l,
1698
1726
  instance: i
1699
- } = Me(), u = d((E) => c({ type: E }), [c]), h = d((E, o = {}) => {
1727
+ } = Ae(), u = d((v) => c({ type: v }), [c]), g = d((v, o = {}) => {
1700
1728
  var a;
1701
- return ((a = i.panelResolver) == null ? void 0 : a.resolve(E, o)) || null;
1729
+ return ((a = i.panelResolver) == null ? void 0 : a.resolve(v, o)) || null;
1702
1730
  }, [i]);
1703
1731
  return {
1704
1732
  register: t,
1705
- unregister: r,
1733
+ unregister: n,
1706
1734
  isRegistered: u,
1707
- getPanelUrl: h,
1735
+ getPanelUrl: g,
1708
1736
  types: l,
1709
- defaults: $t
1737
+ defaults: zt
1710
1738
  };
1711
1739
  }
1712
- const Wa = {
1713
- ArtifactuseProvider: Pa,
1714
- useArtifactuse: Me,
1715
- useArtifactuseEvent: Sa,
1716
- usePanelRegistry: $a,
1717
- DEFAULT_PANELS: $t
1740
+ const Ya = {
1741
+ ArtifactuseProvider: Da,
1742
+ useArtifactuse: Ae,
1743
+ useArtifactuseEvent: Ua,
1744
+ usePanelRegistry: qa,
1745
+ DEFAULT_PANELS: zt
1718
1746
  };
1719
1747
  export {
1720
- Ma as ArtifactuseAgentMessage,
1721
- ma as ArtifactuseCard,
1722
- pa as ArtifactuseInlineForm,
1723
- Fa as ArtifactusePanel,
1724
- Va as ArtifactusePanelToggle,
1725
- Pa as ArtifactuseProvider,
1726
- ka as ArtifactuseSocialPreview,
1727
- xa as ArtifactuseViewer,
1728
- $t as DEFAULT_PANELS,
1729
- Wa as default,
1730
- Me as useArtifactuse,
1731
- Sa as useArtifactuseEvent,
1732
- $a as usePanelRegistry
1748
+ za as ArtifactuseAgentMessage,
1749
+ wa as ArtifactuseCard,
1750
+ Ca as ArtifactuseInlineForm,
1751
+ Za as ArtifactusePanel,
1752
+ Ka as ArtifactusePanelToggle,
1753
+ Da as ArtifactuseProvider,
1754
+ Fa as ArtifactuseSocialPreview,
1755
+ Ia as ArtifactuseViewer,
1756
+ zt as DEFAULT_PANELS,
1757
+ Ya as default,
1758
+ Ae as useArtifactuse,
1759
+ Ua as useArtifactuseEvent,
1760
+ qa as usePanelRegistry
1733
1761
  };