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