artifactuse 0.1.25 → 0.1.28

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