artifactuse 0.2.5 → 0.3.0

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