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