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.
- package/README.md +60 -1
- package/dist/core/detector.d.ts +5 -0
- package/dist/core/index.d.ts +2 -1
- package/dist/{index-Bzk5VnG1.js → index-D56xsAnF.js} +1484 -1411
- package/dist/index.js +1 -1
- package/dist/react/ArtifactuseAgentMessage.d.ts +9 -1
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +863 -803
- package/dist/styles/artifactuse.css +1 -0
- package/dist/styles/components/inline-preview.css +69 -0
- package/dist/styles/components/message.css +7 -1
- package/dist/styles/components/panel.css +18 -0
- package/dist/svelte/index.d.ts +6 -6
- package/dist/svelte/index.js +1909 -1868
- package/dist/vue/index.d.ts +4 -4
- package/dist/vue/index.js +1230 -1169
- package/dist/vue2/composables.d.ts +4 -4
- package/dist/vue2/index.js +265 -27
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -1,210 +1,210 @@
|
|
|
1
|
-
import e, { useState as b, useMemo as T, useCallback as d, useRef as W, useEffect as
|
|
2
|
-
import { g as
|
|
3
|
-
import { J as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
function
|
|
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:
|
|
7
|
+
isActive: a = !1,
|
|
8
8
|
onOpen: c,
|
|
9
|
-
onCopy:
|
|
9
|
+
onCopy: l,
|
|
10
10
|
onDownload: s,
|
|
11
|
-
className:
|
|
11
|
+
className: r = ""
|
|
12
12
|
}) {
|
|
13
|
-
const [
|
|
14
|
-
var
|
|
15
|
-
return
|
|
16
|
-
}, [t.size, t.code]),
|
|
17
|
-
|
|
18
|
-
}, [t, c]),
|
|
19
|
-
|
|
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),
|
|
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
|
|
26
|
-
|
|
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),
|
|
28
|
+
document.execCommand("copy"), p(!0), l && l(t), setTimeout(() => {
|
|
29
29
|
p(!1);
|
|
30
30
|
}, 2e3);
|
|
31
|
-
} catch (
|
|
32
|
-
console.error("Failed to copy:",
|
|
31
|
+
} catch (z) {
|
|
32
|
+
console.error("Failed to copy:", z);
|
|
33
33
|
}
|
|
34
|
-
document.body.removeChild(
|
|
34
|
+
document.body.removeChild(g);
|
|
35
35
|
}
|
|
36
|
-
}, [t,
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
const f = new Blob([t.code], { type: "text/plain" }),
|
|
40
|
-
|
|
41
|
-
}, [t, s]),
|
|
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
|
-
|
|
44
|
-
|
|
43
|
+
a && "artifactuse-card--active",
|
|
44
|
+
r
|
|
45
45
|
].filter(Boolean).join(" ");
|
|
46
|
-
return /* @__PURE__ */ e.createElement("div", { className:
|
|
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:
|
|
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" },
|
|
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:
|
|
60
|
-
onClick:
|
|
59
|
+
title: v ? "Copied!" : "Copy code",
|
|
60
|
+
onClick: L
|
|
61
61
|
},
|
|
62
|
-
|
|
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:
|
|
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
|
|
73
|
+
function Ut(t) {
|
|
74
74
|
if (!t) return null;
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
let s =
|
|
78
|
-
if (s.length === 3 && (s = s.split("").map((
|
|
79
|
-
const
|
|
80
|
-
if (!isNaN(
|
|
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 =
|
|
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
|
|
86
|
-
return
|
|
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
|
|
89
|
-
return t ? t.map((
|
|
88
|
+
function ft(t) {
|
|
89
|
+
return t ? t.map((a) => typeof a == "string" ? { label: a, value: a } : a) : [];
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function jt(t) {
|
|
92
92
|
return ["text", "email", "password", "tel", "url", "number", "date", "time", "datetime-local"].includes(t);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function Ot({
|
|
95
95
|
artifact: t,
|
|
96
|
-
onSubmit:
|
|
96
|
+
onSubmit: a,
|
|
97
97
|
onCancel: c,
|
|
98
|
-
onReset:
|
|
98
|
+
onReset: l,
|
|
99
99
|
onButtonClick: s,
|
|
100
|
-
className:
|
|
101
|
-
theme:
|
|
100
|
+
className: r = "",
|
|
101
|
+
theme: v = "dark",
|
|
102
102
|
accent: p = null,
|
|
103
|
-
initialState:
|
|
103
|
+
initialState: x = "active"
|
|
104
104
|
// 'active' | 'submitted' | 'cancelled' | 'inactive'
|
|
105
105
|
}) {
|
|
106
|
-
var
|
|
107
|
-
const i = W(null), [
|
|
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]),
|
|
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
|
-
}), (_ =
|
|
119
|
-
}), [
|
|
120
|
-
|
|
121
|
-
S(
|
|
122
|
-
}, [
|
|
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
|
-
}), (_ =
|
|
128
|
-
}, [t.code]),
|
|
129
|
-
if (i.current && (i.current.setAttribute("data-artifactuse-theme",
|
|
130
|
-
const o =
|
|
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
|
-
}, [
|
|
134
|
-
const
|
|
133
|
+
}, [v, p]);
|
|
134
|
+
const D = d((o) => {
|
|
135
135
|
S(o);
|
|
136
|
-
}, []),
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
return delete
|
|
136
|
+
}, []), de = d((o, _) => {
|
|
137
|
+
R((y) => ({ ...y, [o]: _ })), q((y) => {
|
|
138
|
+
const w = { ...y };
|
|
139
|
+
return delete w[o], w;
|
|
140
140
|
});
|
|
141
|
-
}, []),
|
|
141
|
+
}, []), ce = d(() => {
|
|
142
142
|
var y;
|
|
143
143
|
const o = {};
|
|
144
|
-
f.forEach((
|
|
145
|
-
if (["buttons", "divider", "heading"].includes(
|
|
146
|
-
const H =
|
|
147
|
-
if (
|
|
148
|
-
o[
|
|
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 (
|
|
152
|
-
o[
|
|
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 (
|
|
156
|
-
o[
|
|
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 (
|
|
160
|
-
o[
|
|
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 (
|
|
164
|
-
o[
|
|
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 =
|
|
169
|
-
return _ && Object.entries(_).forEach(([
|
|
170
|
-
if (o[
|
|
171
|
-
const
|
|
172
|
-
H.pattern &&
|
|
173
|
-
}),
|
|
174
|
-
}, [f,
|
|
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
|
-
}), (_ =
|
|
180
|
-
}, [f, (
|
|
181
|
-
o == null || o.preventDefault(),
|
|
182
|
-
formId:
|
|
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
|
-
|
|
187
|
+
$(!1), D("submitted");
|
|
188
188
|
}, 300));
|
|
189
|
-
}, [
|
|
189
|
+
}, [C, M, a, ce, D]), te = d((o) => {
|
|
190
190
|
const _ = o.action || "custom";
|
|
191
191
|
switch (_) {
|
|
192
192
|
case "submit":
|
|
193
|
-
|
|
193
|
+
fe();
|
|
194
194
|
break;
|
|
195
195
|
case "cancel":
|
|
196
196
|
c == null || c({
|
|
197
|
-
formId:
|
|
197
|
+
formId: C,
|
|
198
198
|
action: "cancel",
|
|
199
199
|
buttonName: o.name || "cancel",
|
|
200
200
|
timestamp: Date.now()
|
|
201
201
|
}), setTimeout(() => {
|
|
202
|
-
|
|
202
|
+
D("cancelled");
|
|
203
203
|
}, 150);
|
|
204
204
|
break;
|
|
205
205
|
case "reset":
|
|
206
|
-
|
|
207
|
-
formId:
|
|
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:
|
|
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
|
-
|
|
223
|
+
D("submitted");
|
|
224
224
|
}, 150);
|
|
225
225
|
break;
|
|
226
226
|
}
|
|
227
|
-
}, [
|
|
228
|
-
return
|
|
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-${
|
|
233
|
-
"data-artifactuse-theme":
|
|
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" },
|
|
236
|
-
) :
|
|
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 ${
|
|
241
|
-
"data-artifactuse-theme":
|
|
240
|
+
className: `artifactuse-inline-form artifactuse-form-buttons ${r}`,
|
|
241
|
+
"data-artifactuse-theme": v
|
|
242
242
|
},
|
|
243
|
-
(
|
|
244
|
-
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" },
|
|
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: () =>
|
|
251
|
-
disabled: o.disabled ||
|
|
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 ${
|
|
261
|
-
"data-artifactuse-theme":
|
|
260
|
+
className: `artifactuse-inline-form artifactuse-form-fields ${r}`,
|
|
261
|
+
"data-artifactuse-theme": v
|
|
262
262
|
},
|
|
263
|
-
(
|
|
264
|
-
/* @__PURE__ */ e.createElement("form", { onSubmit:
|
|
265
|
-
|
|
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:
|
|
270
|
-
value:
|
|
271
|
-
error:
|
|
272
|
-
isSubmitting:
|
|
273
|
-
onChange: (y) =>
|
|
274
|
-
onButtonAction:
|
|
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
|
-
))), !
|
|
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: () =>
|
|
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:
|
|
289
|
+
disabled: ee
|
|
290
290
|
},
|
|
291
|
-
|
|
292
|
-
|
|
291
|
+
ee && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-btn-spinner" }),
|
|
292
|
+
ee ? "Submitting..." : "Submit"
|
|
293
293
|
)))
|
|
294
294
|
);
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
const p = `${
|
|
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,
|
|
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 ||
|
|
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" ? () =>
|
|
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) =>
|
|
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),
|
|
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" },
|
|
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: () =>
|
|
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),
|
|
341
|
-
const
|
|
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) =>
|
|
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) =>
|
|
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) =>
|
|
376
|
+
onChange: (i) => r(i.target.value)
|
|
377
377
|
},
|
|
378
378
|
/* @__PURE__ */ e.createElement("option", { value: "" }, t.placeholder || "Select..."),
|
|
379
|
-
|
|
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) =>
|
|
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" }, "*")),
|
|
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
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
416
|
+
}, we = (t) => {
|
|
417
417
|
if (!t) return "";
|
|
418
|
-
let
|
|
419
|
-
return
|
|
420
|
-
},
|
|
421
|
-
var
|
|
422
|
-
const s =
|
|
423
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar ||
|
|
424
|
-
var S,
|
|
425
|
-
return /* @__PURE__ */ e.createElement("div", { key:
|
|
426
|
-
}), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-meta" }, V(
|
|
427
|
-
},
|
|
418
|
+
let a = t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
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 ||
|
|
430
|
-
},
|
|
431
|
-
const s =
|
|
432
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar ||
|
|
433
|
-
},
|
|
434
|
-
const s =
|
|
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((
|
|
437
|
-
}, [c]),
|
|
438
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar ||
|
|
439
|
-
},
|
|
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 ||
|
|
442
|
-
},
|
|
443
|
-
const s =
|
|
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: (
|
|
445
|
-
},
|
|
446
|
-
const s =
|
|
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: (
|
|
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
|
|
450
|
-
const [
|
|
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]),
|
|
457
|
-
const
|
|
458
|
-
navigator.clipboard.writeText(
|
|
459
|
-
s("Copied!"), setTimeout(() => s("Copy"), 2e3), c == null || c({ platform:
|
|
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,
|
|
462
|
-
const
|
|
463
|
-
switch (
|
|
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(
|
|
465
|
+
return /* @__PURE__ */ e.createElement(pt, { ...g });
|
|
466
466
|
case "linkedin":
|
|
467
|
-
return /* @__PURE__ */ e.createElement(
|
|
467
|
+
return /* @__PURE__ */ e.createElement(Kt, { ...g });
|
|
468
468
|
case "instagram":
|
|
469
|
-
return /* @__PURE__ */ e.createElement(
|
|
469
|
+
return /* @__PURE__ */ e.createElement(Yt, { ...g });
|
|
470
470
|
case "facebook":
|
|
471
|
-
return /* @__PURE__ */ e.createElement(
|
|
471
|
+
return /* @__PURE__ */ e.createElement(Qt, { ...g });
|
|
472
472
|
case "threads":
|
|
473
|
-
return /* @__PURE__ */ e.createElement(
|
|
473
|
+
return /* @__PURE__ */ e.createElement(Gt, { ...g });
|
|
474
474
|
case "tiktok":
|
|
475
|
-
return /* @__PURE__ */ e.createElement(
|
|
475
|
+
return /* @__PURE__ */ e.createElement(ea, { ...g });
|
|
476
476
|
case "youtube":
|
|
477
|
-
return /* @__PURE__ */ e.createElement(
|
|
477
|
+
return /* @__PURE__ */ e.createElement(ta, { ...g });
|
|
478
478
|
default:
|
|
479
|
-
return /* @__PURE__ */ e.createElement(
|
|
479
|
+
return /* @__PURE__ */ e.createElement(pt, { ...g });
|
|
480
480
|
}
|
|
481
481
|
};
|
|
482
|
-
return /* @__PURE__ */ e.createElement("div", { className: `artifactuse-social artifactuse-social-${
|
|
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
|
|
484
|
+
function ra({
|
|
485
485
|
isOpen: t = !1,
|
|
486
|
-
type:
|
|
486
|
+
type: a = "image",
|
|
487
487
|
src: c = "",
|
|
488
|
-
alt:
|
|
488
|
+
alt: l = "",
|
|
489
489
|
caption: s = "",
|
|
490
|
-
onClose:
|
|
491
|
-
className:
|
|
490
|
+
onClose: r,
|
|
491
|
+
className: v = ""
|
|
492
492
|
}) {
|
|
493
|
-
const p = W(null), [
|
|
494
|
-
|
|
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]),
|
|
500
|
-
function f(
|
|
501
|
-
|
|
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,
|
|
505
|
-
const
|
|
506
|
-
i(!1),
|
|
507
|
-
}, [
|
|
508
|
-
|
|
509
|
-
}, [
|
|
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 =
|
|
512
|
-
}, [c,
|
|
513
|
-
if (!t || !
|
|
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
|
|
515
|
+
const C = /* @__PURE__ */ e.createElement(
|
|
516
516
|
"div",
|
|
517
517
|
{
|
|
518
518
|
ref: p,
|
|
519
|
-
className: `artifactuse-viewer-overlay ${
|
|
520
|
-
onClick:
|
|
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() },
|
|
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:
|
|
530
|
-
className: `artifactuse-viewer-image ${
|
|
531
|
-
onClick:
|
|
529
|
+
alt: l,
|
|
530
|
+
className: `artifactuse-viewer-image ${x ? "artifactuse-viewer-image--zoomed" : ""}`,
|
|
531
|
+
onClick: u
|
|
532
532
|
}
|
|
533
|
-
),
|
|
533
|
+
), a === "pdf" && /* @__PURE__ */ e.createElement(
|
|
534
534
|
"iframe",
|
|
535
535
|
{
|
|
536
536
|
src: c,
|
|
537
537
|
className: "artifactuse-viewer-pdf",
|
|
538
|
-
title:
|
|
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:
|
|
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
|
-
),
|
|
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:
|
|
553
|
-
title:
|
|
552
|
+
onClick: u,
|
|
553
|
+
title: x ? "Zoom out" : "Zoom in"
|
|
554
554
|
},
|
|
555
|
-
|
|
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:
|
|
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
|
|
566
|
+
return qt(C, document.body);
|
|
567
567
|
}
|
|
568
|
-
function
|
|
568
|
+
function sa(t) {
|
|
569
569
|
if (!t) return null;
|
|
570
570
|
try {
|
|
571
|
-
const
|
|
572
|
-
return JSON.parse(
|
|
571
|
+
const a = decodeURIComponent(escape(atob(t)));
|
|
572
|
+
return JSON.parse(a);
|
|
573
573
|
} catch {
|
|
574
574
|
try {
|
|
575
575
|
const c = t.replace(/ /g, `
|
|
@@ -580,210 +580,229 @@ function aa(t) {
|
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
|
-
function
|
|
584
|
-
const
|
|
585
|
-
if (!t) return
|
|
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
|
|
587
|
+
let l = 0, s;
|
|
588
588
|
for (; (s = c.exec(t)) !== null; ) {
|
|
589
|
-
if (s.index >
|
|
590
|
-
const p = t.slice(
|
|
591
|
-
p.trim() &&
|
|
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
|
|
594
|
-
|
|
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 (
|
|
597
|
-
const
|
|
598
|
-
|
|
596
|
+
if (l < t.length) {
|
|
597
|
+
const r = t.slice(l);
|
|
598
|
+
r.trim() && a.push({ type: "html", content: r });
|
|
599
599
|
}
|
|
600
|
-
return
|
|
600
|
+
return a.length === 0 && t.trim() && a.push({ type: "html", content: t }), a;
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function la() {
|
|
603
603
|
return `msg-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function ca({
|
|
606
606
|
content: t,
|
|
607
|
-
messageId:
|
|
607
|
+
messageId: a = la(),
|
|
608
608
|
inlineCards: c = !0,
|
|
609
|
-
typing:
|
|
609
|
+
typing: l = !1,
|
|
610
610
|
isLastMessage: s = !1,
|
|
611
611
|
// Whether this is the last/most recent message
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
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:
|
|
625
|
-
openArtifact:
|
|
626
|
-
state:
|
|
627
|
-
getTheme:
|
|
628
|
-
instance:
|
|
629
|
-
} =
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
}, [
|
|
633
|
-
const
|
|
634
|
-
|
|
635
|
-
}, [
|
|
636
|
-
|
|
637
|
-
}, []),
|
|
638
|
-
if (
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
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:
|
|
644
|
-
alt:
|
|
645
|
-
caption:
|
|
648
|
+
src: m.src,
|
|
649
|
+
alt: m.alt || "",
|
|
650
|
+
caption: m.dataset.caption || m.alt || ""
|
|
646
651
|
});
|
|
647
|
-
},
|
|
648
|
-
}),
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
const
|
|
652
|
-
|
|
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:
|
|
655
|
-
alt:
|
|
656
|
-
caption:
|
|
659
|
+
src: m.src,
|
|
660
|
+
alt: m.alt || "",
|
|
661
|
+
caption: me
|
|
657
662
|
});
|
|
658
|
-
},
|
|
659
|
-
}),
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
const
|
|
663
|
-
|
|
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:
|
|
666
|
-
alt:
|
|
667
|
-
caption:
|
|
670
|
+
src: m.src,
|
|
671
|
+
alt: m.alt || "",
|
|
672
|
+
caption: me
|
|
668
673
|
});
|
|
669
|
-
},
|
|
670
|
-
}),
|
|
671
|
-
|
|
672
|
-
|
|
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:
|
|
675
|
-
alt:
|
|
676
|
-
caption:
|
|
679
|
+
src: m.href,
|
|
680
|
+
alt: m.textContent || "PDF Document",
|
|
681
|
+
caption: m.title || m.textContent || ""
|
|
677
682
|
});
|
|
678
|
-
},
|
|
679
|
-
}),
|
|
680
|
-
var
|
|
681
|
-
|
|
682
|
-
const
|
|
683
|
-
|
|
684
|
-
|
|
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:
|
|
691
|
+
src: F,
|
|
687
692
|
alt: "PDF Document",
|
|
688
|
-
caption:
|
|
693
|
+
caption: m.dataset.caption || ""
|
|
689
694
|
});
|
|
690
|
-
},
|
|
691
|
-
}),
|
|
692
|
-
|
|
693
|
-
if (
|
|
694
|
-
const
|
|
695
|
-
|
|
696
|
-
},
|
|
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
|
-
}, [
|
|
699
|
-
if (
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
}),
|
|
703
|
-
|
|
704
|
-
}),
|
|
705
|
-
|
|
706
|
-
}),
|
|
707
|
-
|
|
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
|
-
}, []),
|
|
710
|
-
|
|
711
|
-
if (
|
|
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
|
|
714
|
-
} catch (
|
|
715
|
-
console.error("Failed to initialize content:",
|
|
718
|
+
await q.initializeContent($.current);
|
|
719
|
+
} catch (E) {
|
|
720
|
+
console.error("Failed to initialize content:", E);
|
|
716
721
|
}
|
|
717
|
-
|
|
722
|
+
$e();
|
|
718
723
|
}, 100);
|
|
719
|
-
}, [
|
|
720
|
-
|
|
724
|
+
}, [q, $e]);
|
|
725
|
+
j(() => {
|
|
721
726
|
if (t) {
|
|
722
|
-
const
|
|
723
|
-
|
|
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,
|
|
726
|
-
|
|
727
|
-
}, [
|
|
728
|
-
|
|
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
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
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-${
|
|
751
|
-
dangerouslySetInnerHTML: { __html:
|
|
769
|
+
key: `html-${Q}`,
|
|
770
|
+
dangerouslySetInnerHTML: { __html: E.content }
|
|
752
771
|
}
|
|
753
772
|
);
|
|
754
773
|
case "form":
|
|
755
|
-
return
|
|
756
|
-
|
|
774
|
+
return E.artifact.isInline ? /* @__PURE__ */ e.createElement(
|
|
775
|
+
Ot,
|
|
757
776
|
{
|
|
758
|
-
key: `form-${
|
|
759
|
-
artifact:
|
|
760
|
-
theme:
|
|
761
|
-
initialState:
|
|
762
|
-
onSubmit:
|
|
763
|
-
onCancel:
|
|
764
|
-
onButtonClick:
|
|
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
|
-
|
|
788
|
+
aa,
|
|
770
789
|
{
|
|
771
|
-
key: `social-${
|
|
772
|
-
artifact:
|
|
773
|
-
theme:
|
|
774
|
-
onCopy:
|
|
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
|
|
779
|
-
|
|
797
|
+
return Ne ? /* @__PURE__ */ e.createElement(
|
|
798
|
+
Dt,
|
|
780
799
|
{
|
|
781
|
-
key: `panel-${
|
|
782
|
-
artifact:
|
|
783
|
-
isActive:
|
|
784
|
-
onOpen:
|
|
785
|
-
onCopy:
|
|
786
|
-
onDownload:
|
|
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 ${
|
|
815
|
+
ref: ee,
|
|
816
|
+
className: `artifactuse-agent-message ${z}`.trim()
|
|
798
817
|
},
|
|
799
|
-
/* @__PURE__ */ e.createElement("div", { ref:
|
|
818
|
+
/* @__PURE__ */ e.createElement("div", { ref: $, className: "artifactuse-message-content", onClick: qe }, Se.map(Ie)),
|
|
800
819
|
/* @__PURE__ */ e.createElement(
|
|
801
|
-
|
|
820
|
+
ra,
|
|
802
821
|
{
|
|
803
|
-
isOpen:
|
|
804
|
-
type:
|
|
805
|
-
src:
|
|
806
|
-
alt:
|
|
807
|
-
caption:
|
|
808
|
-
onClose:
|
|
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
|
-
|
|
832
|
+
ca.propTypes = {
|
|
814
833
|
/** The raw message content (markdown/HTML from AI) */
|
|
815
|
-
content: (t,
|
|
816
|
-
if (typeof t[
|
|
817
|
-
return new Error(`${
|
|
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,
|
|
821
|
-
if (t[
|
|
822
|
-
return new Error(`${
|
|
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,
|
|
826
|
-
if (t[
|
|
827
|
-
return new Error(`${
|
|
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,
|
|
831
|
-
if (t[
|
|
832
|
-
return new Error(`${
|
|
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,
|
|
836
|
-
if (t[
|
|
837
|
-
return new Error(`${
|
|
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
|
|
879
|
+
function Ea({
|
|
841
880
|
onAIRequest: t,
|
|
842
|
-
onSave:
|
|
881
|
+
onSave: a,
|
|
843
882
|
onExport: c,
|
|
844
|
-
className:
|
|
883
|
+
className: l = ""
|
|
845
884
|
}) {
|
|
846
|
-
var
|
|
885
|
+
var mt;
|
|
847
886
|
const {
|
|
848
887
|
state: s,
|
|
849
|
-
activeArtifact:
|
|
850
|
-
artifactCount:
|
|
888
|
+
activeArtifact: r,
|
|
889
|
+
artifactCount: v,
|
|
851
890
|
hasArtifacts: p,
|
|
852
|
-
closePanel:
|
|
891
|
+
closePanel: x,
|
|
853
892
|
toggleFullscreen: i,
|
|
854
|
-
setViewMode:
|
|
893
|
+
setViewMode: k,
|
|
855
894
|
getPanelUrl: S,
|
|
856
|
-
openArtifact:
|
|
857
|
-
instance:
|
|
858
|
-
} =
|
|
859
|
-
if (!
|
|
860
|
-
let
|
|
861
|
-
return
|
|
862
|
-
}, [
|
|
863
|
-
var
|
|
864
|
-
return ((
|
|
865
|
-
}, [
|
|
866
|
-
var
|
|
867
|
-
return ((
|
|
868
|
-
}, [
|
|
869
|
-
var
|
|
870
|
-
return ((
|
|
871
|
-
}, [
|
|
872
|
-
|
|
873
|
-
}, [
|
|
874
|
-
if (
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
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
|
-
}, [
|
|
890
|
-
var
|
|
891
|
-
const
|
|
892
|
-
if (
|
|
893
|
-
const
|
|
894
|
-
|
|
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
|
-
}, []),
|
|
897
|
-
|
|
898
|
-
}, []),
|
|
899
|
-
|
|
900
|
-
}, [
|
|
901
|
-
!
|
|
902
|
-
code:
|
|
903
|
-
language:
|
|
904
|
-
sdkTheme:
|
|
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
|
-
}, [
|
|
907
|
-
if (
|
|
908
|
-
const
|
|
909
|
-
|
|
910
|
-
artifactId:
|
|
911
|
-
artifact:
|
|
912
|
-
code:
|
|
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
|
-
}, [
|
|
915
|
-
clearTimeout(
|
|
916
|
-
}, [
|
|
917
|
-
clearTimeout(
|
|
918
|
-
}, []),
|
|
919
|
-
clearTimeout(
|
|
920
|
-
|
|
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
|
-
}, []),
|
|
923
|
-
if (
|
|
982
|
+
}, []), kt = d(async () => {
|
|
983
|
+
if (r)
|
|
924
984
|
try {
|
|
925
|
-
await navigator.clipboard.writeText(
|
|
926
|
-
} catch (
|
|
927
|
-
console.error("Failed to copy:",
|
|
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
|
-
}, [
|
|
930
|
-
if (!
|
|
931
|
-
const { code:
|
|
932
|
-
|
|
933
|
-
}, [
|
|
934
|
-
if (!(
|
|
935
|
-
|
|
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
|
|
938
|
-
for (const
|
|
939
|
-
if (!
|
|
940
|
-
const
|
|
941
|
-
let
|
|
942
|
-
const
|
|
943
|
-
|
|
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
|
|
946
|
-
|
|
947
|
-
} catch (
|
|
948
|
-
console.error("Failed to create ZIP:",
|
|
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
|
-
|
|
1010
|
+
ie(!1);
|
|
951
1011
|
}
|
|
952
1012
|
}
|
|
953
|
-
}, [
|
|
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
|
-
|
|
1015
|
+
oe(!1);
|
|
956
1016
|
return;
|
|
957
1017
|
}
|
|
958
|
-
|
|
959
|
-
}, [
|
|
960
|
-
|
|
961
|
-
}, []),
|
|
962
|
-
if (!(!
|
|
963
|
-
_("loading"),
|
|
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
|
|
966
|
-
|
|
967
|
-
} catch (
|
|
968
|
-
|
|
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
|
-
}, [
|
|
972
|
-
if (
|
|
973
|
-
|
|
1031
|
+
}, [r, u]), ot = d(async () => {
|
|
1032
|
+
if (m)
|
|
1033
|
+
Fe();
|
|
974
1034
|
else {
|
|
975
1035
|
_("loading");
|
|
976
1036
|
try {
|
|
977
|
-
await
|
|
978
|
-
} catch (
|
|
979
|
-
|
|
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
|
-
}, [
|
|
983
|
-
if (!(!
|
|
984
|
-
_("loading"),
|
|
1042
|
+
}, [m, u]), Fe = d(async () => {
|
|
1043
|
+
if (!(!r || !(u != null && u.share))) {
|
|
1044
|
+
_("loading"), K("");
|
|
985
1045
|
try {
|
|
986
|
-
const
|
|
987
|
-
|
|
988
|
-
} catch (
|
|
989
|
-
|
|
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
|
-
}, [
|
|
993
|
-
|
|
994
|
-
}, [
|
|
995
|
-
if (
|
|
996
|
-
if (!
|
|
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
|
|
1000
|
-
} catch (
|
|
1001
|
-
|
|
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"),
|
|
1065
|
+
_("update-list"), Pe(!0);
|
|
1006
1066
|
try {
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1009
|
-
} catch (
|
|
1010
|
-
|
|
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
|
-
|
|
1072
|
+
Pe(!1);
|
|
1013
1073
|
}
|
|
1014
1074
|
}
|
|
1015
|
-
}, [
|
|
1016
|
-
var
|
|
1017
|
-
if (!
|
|
1018
|
-
const
|
|
1019
|
-
if (
|
|
1020
|
-
_("loading"),
|
|
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
|
|
1023
|
-
|
|
1024
|
-
} catch (
|
|
1025
|
-
|
|
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
|
-
}, [
|
|
1088
|
+
}, [r, u]), St = d(async () => {
|
|
1029
1089
|
if (y)
|
|
1030
1090
|
try {
|
|
1031
|
-
await navigator.clipboard.writeText(y),
|
|
1032
|
-
} catch (
|
|
1033
|
-
console.error("Failed to copy link:",
|
|
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]),
|
|
1036
|
-
|
|
1037
|
-
}, [
|
|
1038
|
-
|
|
1039
|
-
}, [
|
|
1040
|
-
|
|
1041
|
-
}, [
|
|
1042
|
-
|
|
1043
|
-
startX:
|
|
1044
|
-
startWidth:
|
|
1045
|
-
}, document.addEventListener("mousemove",
|
|
1046
|
-
|
|
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
|
-
}, [
|
|
1049
|
-
if (!
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1052
|
-
}, []),
|
|
1053
|
-
|
|
1054
|
-
|
|
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
|
-
}, [
|
|
1116
|
+
}, [Ze]), Ht = d((n) => {
|
|
1057
1117
|
if (!f.current) return;
|
|
1058
|
-
const
|
|
1059
|
-
|
|
1060
|
-
startX:
|
|
1061
|
-
startPosition:
|
|
1062
|
-
contentLeft:
|
|
1063
|
-
contentWidth:
|
|
1064
|
-
}, document.addEventListener("mousemove",
|
|
1065
|
-
|
|
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
|
-
}, [
|
|
1068
|
-
if (!
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1071
|
-
}, []),
|
|
1072
|
-
|
|
1073
|
-
|
|
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
|
-
}, [
|
|
1076
|
-
if (
|
|
1077
|
-
|
|
1078
|
-
}, [
|
|
1079
|
-
(s.viewMode === "code" || s.viewMode === "split") &&
|
|
1080
|
-
}, [s.viewMode,
|
|
1081
|
-
t &&
|
|
1082
|
-
}), [
|
|
1083
|
-
|
|
1084
|
-
}, [
|
|
1085
|
-
const
|
|
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
|
-
!
|
|
1148
|
+
!r && p && "artifactuse-panel--list",
|
|
1089
1149
|
!p && "artifactuse-panel--empty",
|
|
1090
|
-
|
|
1091
|
-
].filter(Boolean).join(" "),
|
|
1150
|
+
l
|
|
1151
|
+
].filter(Boolean).join(" "), It = [
|
|
1092
1152
|
"artifactuse-panel__content",
|
|
1093
1153
|
`artifactuse-panel__content--${s.viewMode}`,
|
|
1094
|
-
|
|
1154
|
+
de && "artifactuse-panel__content--transitioning"
|
|
1095
1155
|
].filter(Boolean).join(" ");
|
|
1096
|
-
return p ?
|
|
1156
|
+
return p ? r ? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
|
|
1097
1157
|
"div",
|
|
1098
1158
|
{
|
|
1099
|
-
className:
|
|
1100
|
-
style: s.isFullscreen ? void 0 : { width: `${
|
|
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:
|
|
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" },
|
|
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:
|
|
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">${
|
|
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" },
|
|
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: !
|
|
1188
|
+
disabled: !r.isPreviewable,
|
|
1129
1189
|
title: "Preview",
|
|
1130
|
-
onClick: () =>
|
|
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
|
-
), (!
|
|
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: () =>
|
|
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
|
-
), (!
|
|
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: !
|
|
1205
|
+
disabled: !r.isPreviewable,
|
|
1146
1206
|
title: "Split view",
|
|
1147
|
-
onClick: () =>
|
|
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
|
-
),
|
|
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: () =>
|
|
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:
|
|
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:
|
|
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:
|
|
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: `${
|
|
1247
|
+
style: s.viewMode === "split" ? { width: `${be}%` } : void 0
|
|
1188
1248
|
},
|
|
1189
|
-
|
|
1190
|
-
|
|
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:
|
|
1194
|
-
src:
|
|
1195
|
-
className: `artifactuse-panel__iframe ${
|
|
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:
|
|
1199
|
-
onError:
|
|
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 ",
|
|
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 -
|
|
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:
|
|
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:
|
|
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:
|
|
1223
|
-
className: `language-${
|
|
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:
|
|
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" },
|
|
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
|
-
),
|
|
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 ${
|
|
1249
|
-
title:
|
|
1250
|
-
onClick:
|
|
1308
|
+
className: `artifactuse-panel__footer-action ${R ? "artifactuse-panel__footer-action--success" : ""}`,
|
|
1309
|
+
title: R ? "Copied!" : "Copy code",
|
|
1310
|
+
onClick: kt
|
|
1251
1311
|
},
|
|
1252
|
-
|
|
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:
|
|
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
|
-
),
|
|
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:
|
|
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:
|
|
1270
|
-
var
|
|
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: ((
|
|
1334
|
+
key: ((N = n.project) == null ? void 0 : N.uuid) || n.id,
|
|
1275
1335
|
className: "artifactuse-share-popup__artifact-item",
|
|
1276
|
-
onClick: () =>
|
|
1336
|
+
onClick: () => Tt(n)
|
|
1277
1337
|
},
|
|
1278
|
-
/* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-name" }, ((
|
|
1279
|
-
/* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-date" },
|
|
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: (
|
|
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 ${
|
|
1294
|
-
onClick:
|
|
1353
|
+
className: `artifactuse-share-popup__copy-btn ${Le ? "artifactuse-share-popup__copy-btn--copied" : ""}`,
|
|
1354
|
+
onClick: St
|
|
1295
1355
|
},
|
|
1296
|
-
|
|
1297
|
-
)), H && !
|
|
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:
|
|
1361
|
+
disabled: O <= 0,
|
|
1302
1362
|
title: "Previous artifact",
|
|
1303
|
-
onClick:
|
|
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: () =>
|
|
1370
|
+
onClick: () => ee(!q)
|
|
1311
1371
|
},
|
|
1312
|
-
/* @__PURE__ */ e.createElement("span", null,
|
|
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:
|
|
1378
|
+
disabled: O >= A.length - 1,
|
|
1319
1379
|
title: "Next artifact",
|
|
1320
|
-
onClick:
|
|
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
|
-
),
|
|
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: () =>
|
|
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" },
|
|
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:
|
|
1334
|
-
className: `artifactuse-panel__artifact-item ${
|
|
1335
|
-
onClick: () =>
|
|
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:
|
|
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" },
|
|
1345
|
-
/* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-index" },
|
|
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:
|
|
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 ${
|
|
1351
|
-
disabled:
|
|
1410
|
+
className: `artifactuse-panel__action ${te ? "artifactuse-panel__action--loading" : ""}`,
|
|
1411
|
+
disabled: te,
|
|
1352
1412
|
title: "Download all as ZIP",
|
|
1353
|
-
onClick:
|
|
1413
|
+
onClick: xt
|
|
1354
1414
|
},
|
|
1355
|
-
|
|
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:
|
|
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" },
|
|
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:
|
|
1427
|
+
key: n.id,
|
|
1368
1428
|
className: "artifactuse-panel__list-item",
|
|
1369
|
-
onClick: () =>
|
|
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:
|
|
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" },
|
|
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" },
|
|
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:
|
|
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:
|
|
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" },
|
|
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
|
|
1411
|
-
const { state:
|
|
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
|
-
|
|
1414
|
-
|
|
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:
|
|
1480
|
+
className: v,
|
|
1421
1481
|
onClick: s,
|
|
1422
|
-
title:
|
|
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" },
|
|
1485
|
+
c > 0 && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel-toggle-badge" }, r)
|
|
1426
1486
|
);
|
|
1427
1487
|
}
|
|
1428
|
-
const
|
|
1429
|
-
function
|
|
1488
|
+
const ht = Bt(null);
|
|
1489
|
+
function ia({ children: t, config: a = {} }) {
|
|
1430
1490
|
const c = W(null);
|
|
1431
|
-
c.current || (c.current =
|
|
1432
|
-
const
|
|
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
|
-
}), [
|
|
1439
|
-
|
|
1440
|
-
const f =
|
|
1441
|
-
|
|
1442
|
-
artifacts:
|
|
1443
|
-
activeArtifactId:
|
|
1444
|
-
isPanelOpen:
|
|
1445
|
-
viewMode:
|
|
1446
|
-
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
|
|
1450
|
-
f(),
|
|
1509
|
+
return l.applyTheme(), () => {
|
|
1510
|
+
f(), l.destroy();
|
|
1451
1511
|
};
|
|
1452
|
-
}, [
|
|
1453
|
-
const
|
|
1454
|
-
|
|
1455
|
-
}, [
|
|
1456
|
-
|
|
1457
|
-
}, [
|
|
1458
|
-
|
|
1459
|
-
}, [
|
|
1460
|
-
instance:
|
|
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:
|
|
1522
|
+
activeArtifact: x,
|
|
1463
1523
|
artifactCount: i,
|
|
1464
|
-
hasArtifacts:
|
|
1524
|
+
hasArtifacts: k,
|
|
1465
1525
|
// Panel computed
|
|
1466
|
-
panelTypes:
|
|
1526
|
+
panelTypes: v,
|
|
1467
1527
|
activePanelUrl: S,
|
|
1468
1528
|
// Methods
|
|
1469
|
-
processMessage:
|
|
1470
|
-
initializeContent:
|
|
1471
|
-
openArtifact:
|
|
1472
|
-
openFile:
|
|
1473
|
-
openCode:
|
|
1474
|
-
updateFile:
|
|
1475
|
-
closePanel:
|
|
1476
|
-
togglePanel:
|
|
1477
|
-
toggleFullscreen:
|
|
1478
|
-
setViewMode:
|
|
1479
|
-
getPanelUrl:
|
|
1480
|
-
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:
|
|
1483
|
-
registerPanel:
|
|
1484
|
-
unregisterPanel:
|
|
1485
|
-
getPanelTypes:
|
|
1542
|
+
hasPanel: l.hasPanel,
|
|
1543
|
+
registerPanel: u,
|
|
1544
|
+
unregisterPanel: h,
|
|
1545
|
+
getPanelTypes: l.getPanelTypes,
|
|
1486
1546
|
// Events
|
|
1487
|
-
on:
|
|
1488
|
-
off:
|
|
1547
|
+
on: l.on,
|
|
1548
|
+
off: l.off,
|
|
1489
1549
|
// State management
|
|
1490
|
-
clearArtifacts: () =>
|
|
1550
|
+
clearArtifacts: () => l.state.clear(),
|
|
1491
1551
|
// Theme
|
|
1492
|
-
applyTheme:
|
|
1493
|
-
setTheme:
|
|
1494
|
-
getTheme:
|
|
1552
|
+
applyTheme: l.applyTheme,
|
|
1553
|
+
setTheme: L,
|
|
1554
|
+
getTheme: l.getTheme
|
|
1495
1555
|
}), [
|
|
1496
|
-
|
|
1556
|
+
l,
|
|
1497
1557
|
s,
|
|
1498
|
-
|
|
1558
|
+
x,
|
|
1499
1559
|
i,
|
|
1500
|
-
|
|
1501
|
-
|
|
1560
|
+
k,
|
|
1561
|
+
v,
|
|
1502
1562
|
S,
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1563
|
+
L,
|
|
1564
|
+
u,
|
|
1565
|
+
h
|
|
1506
1566
|
]);
|
|
1507
|
-
return /* @__PURE__ */ e.createElement(
|
|
1567
|
+
return /* @__PURE__ */ e.createElement(ht.Provider, { value: C }, t);
|
|
1508
1568
|
}
|
|
1509
|
-
function
|
|
1510
|
-
const t =
|
|
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
|
|
1516
|
-
const { on: c, off:
|
|
1517
|
-
|
|
1518
|
-
const s = c(t,
|
|
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() :
|
|
1580
|
+
typeof s == "function" ? s() : l(t, a);
|
|
1521
1581
|
};
|
|
1522
|
-
}, [t,
|
|
1582
|
+
}, [t, a, c, l]);
|
|
1523
1583
|
}
|
|
1524
|
-
function
|
|
1584
|
+
function ua() {
|
|
1525
1585
|
const {
|
|
1526
1586
|
registerPanel: t,
|
|
1527
|
-
unregisterPanel:
|
|
1587
|
+
unregisterPanel: a,
|
|
1528
1588
|
hasPanel: c,
|
|
1529
|
-
panelTypes:
|
|
1589
|
+
panelTypes: l,
|
|
1530
1590
|
instance: s
|
|
1531
|
-
} =
|
|
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,
|
|
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:
|
|
1538
|
-
isRegistered:
|
|
1539
|
-
getPanelUrl:
|
|
1540
|
-
types:
|
|
1541
|
-
defaults:
|
|
1597
|
+
unregister: a,
|
|
1598
|
+
isRegistered: r,
|
|
1599
|
+
getPanelUrl: v,
|
|
1600
|
+
types: l,
|
|
1601
|
+
defaults: vt
|
|
1542
1602
|
};
|
|
1543
1603
|
}
|
|
1544
|
-
const
|
|
1545
|
-
ArtifactuseProvider:
|
|
1546
|
-
useArtifactuse:
|
|
1547
|
-
useArtifactuseEvent:
|
|
1548
|
-
usePanelRegistry:
|
|
1549
|
-
DEFAULT_PANELS:
|
|
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
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
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
|
};
|