@pluno/product-agent-web 0.1.52 → 0.1.54
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/dist/attachmentStorage.d.ts +18 -0
- package/dist/index.d.ts +39 -3
- package/dist/product-agent-sdk.js +832 -387
- package/dist/product-agent-widget.js +1207 -1250
- package/dist/widget.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const t =
|
|
5
|
-
if (
|
|
1
|
+
import { PlunoProductAgent as Jn } from "./product-agent-sdk.js";
|
|
2
|
+
const Qn = "#7c3aed", $e = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z", qe = "#2c2a1e", zt = [253, 250, 241], Bt = 3.5;
|
|
3
|
+
function hn(e) {
|
|
4
|
+
const t = mn(e);
|
|
5
|
+
if (Ut(Re(t), zt) >= Bt)
|
|
6
6
|
return t;
|
|
7
|
-
let
|
|
8
|
-
const i =
|
|
7
|
+
let n = Re(t);
|
|
8
|
+
const i = Re(qe);
|
|
9
9
|
for (let a = 0; a < 6; a += 1)
|
|
10
|
-
if (
|
|
11
|
-
return
|
|
12
|
-
return
|
|
10
|
+
if (n = no(n, i, 0.22), Ut(n, zt) >= Bt)
|
|
11
|
+
return ut(n);
|
|
12
|
+
return ut(n);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
let
|
|
14
|
+
function eo() {
|
|
15
|
+
let o = "M 280 120", n = !1, i = 0;
|
|
16
16
|
for (let a = 150; a <= 1170; a += 62) {
|
|
17
|
-
const l = (i % 3 - 1) * 18, p =
|
|
18
|
-
|
|
17
|
+
const l = (i % 3 - 1) * 18, p = n ? 280 - l : 1020 + l;
|
|
18
|
+
o += ` L ${p} ${a}`, n = !n, i += 1;
|
|
19
19
|
}
|
|
20
|
-
return
|
|
20
|
+
return o;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const t =
|
|
24
|
-
return
|
|
22
|
+
function to(e) {
|
|
23
|
+
const t = mn(e), o = gt(Re(t));
|
|
24
|
+
return o > 0.86 ? {
|
|
25
25
|
top: "#ffffff",
|
|
26
26
|
middle: "#f6f6f6",
|
|
27
27
|
bottom: "#e7e7e7",
|
|
@@ -32,7 +32,7 @@ function Xn(e) {
|
|
|
32
32
|
highlight: "#ffffff",
|
|
33
33
|
inner: "#f4f4f4",
|
|
34
34
|
shadow: "#9d9d9d"
|
|
35
|
-
} :
|
|
35
|
+
} : o < 0.05 ? {
|
|
36
36
|
top: "#3d3d3d",
|
|
37
37
|
middle: "#171717",
|
|
38
38
|
bottom: "#030303",
|
|
@@ -44,187 +44,179 @@ function Xn(e) {
|
|
|
44
44
|
inner: "#4b4b4b",
|
|
45
45
|
shadow: "#000000"
|
|
46
46
|
} : {
|
|
47
|
-
top:
|
|
48
|
-
middle:
|
|
49
|
-
bottom:
|
|
50
|
-
edgeStart:
|
|
51
|
-
edgeMiddle:
|
|
52
|
-
edgeEnd:
|
|
53
|
-
glow:
|
|
54
|
-
highlight:
|
|
55
|
-
inner:
|
|
56
|
-
shadow:
|
|
47
|
+
top: Y(t, 0.28, -0.03),
|
|
48
|
+
middle: Y(t, 0.08, 0.04),
|
|
49
|
+
bottom: Y(t, -0.1, 0.02),
|
|
50
|
+
edgeStart: Y(t, 0.08, 0.08),
|
|
51
|
+
edgeMiddle: Y(t, -0.08, 0.08),
|
|
52
|
+
edgeEnd: Y(t, -0.18, 0.05),
|
|
53
|
+
glow: Y(t, 0.32, -0.12),
|
|
54
|
+
highlight: Y(t, 0.38, -0.18),
|
|
55
|
+
inner: Y(t, 0.24, -0.1),
|
|
56
|
+
shadow: Y(t, -0.25, -0.08)
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function mn(e) {
|
|
60
60
|
const t = e.trim();
|
|
61
|
-
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((
|
|
61
|
+
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((o) => o + o).join("").toLowerCase()}` : Qn;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function Re(e) {
|
|
64
64
|
return [
|
|
65
65
|
Number.parseInt(e.slice(1, 3), 16),
|
|
66
66
|
Number.parseInt(e.slice(3, 5), 16),
|
|
67
67
|
Number.parseInt(e.slice(5, 7), 16)
|
|
68
68
|
];
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
const
|
|
72
|
-
return `#${
|
|
70
|
+
function ut([e, t, o]) {
|
|
71
|
+
const n = (i) => Math.max(0, Math.min(255, Math.round(i))).toString(16).padStart(2, "0");
|
|
72
|
+
return `#${n(e)}${n(t)}${n(o)}`;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
const
|
|
74
|
+
function gt([e, t, o]) {
|
|
75
|
+
const n = (i) => {
|
|
76
76
|
const a = i / 255;
|
|
77
77
|
return a <= 0.04045 ? a / 12.92 : ((a + 0.055) / 1.055) ** 2.4;
|
|
78
78
|
};
|
|
79
|
-
return 0.2126 *
|
|
79
|
+
return 0.2126 * n(e) + 0.7152 * n(t) + 0.0722 * n(o);
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
const
|
|
81
|
+
function Ut(e, t) {
|
|
82
|
+
const o = gt(e), n = gt(t), [i, a] = o > n ? [o, n] : [n, o];
|
|
83
83
|
return (i + 0.05) / (a + 0.05);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
const
|
|
85
|
+
function no(e, t, o) {
|
|
86
|
+
const n = ht(o);
|
|
87
87
|
return [
|
|
88
|
-
e[0] + (t[0] - e[0]) *
|
|
89
|
-
e[1] + (t[1] - e[1]) *
|
|
90
|
-
e[2] + (t[2] - e[2]) *
|
|
88
|
+
e[0] + (t[0] - e[0]) * n,
|
|
89
|
+
e[1] + (t[1] - e[1]) * n,
|
|
90
|
+
e[2] + (t[2] - e[2]) * n
|
|
91
91
|
];
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
const [
|
|
95
|
-
return
|
|
93
|
+
function Y(e, t, o) {
|
|
94
|
+
const [n, i, a] = oo(Re(e));
|
|
95
|
+
return ut(io(n, ht(i + o), ht(a + t)));
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
const
|
|
97
|
+
function oo([e, t, o]) {
|
|
98
|
+
const n = e / 255, i = t / 255, a = o / 255, l = Math.max(n, i, a), p = Math.min(n, i, a), c = (l + p) / 2;
|
|
99
99
|
if (l === p)
|
|
100
100
|
return [0, 0, c];
|
|
101
101
|
const u = l - p, d = c > 0.5 ? u / (2 - l - p) : u / (l + p);
|
|
102
|
-
return [(l ===
|
|
102
|
+
return [(l === n ? (i - a) / u + (i < a ? 6 : 0) : l === i ? (a - n) / u + 2 : (n - i) / u + 4) / 6, d, c];
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function io(e, t, o) {
|
|
105
105
|
if (t === 0)
|
|
106
|
-
return [
|
|
107
|
-
const
|
|
106
|
+
return [o * 255, o * 255, o * 255];
|
|
107
|
+
const n = o < 0.5 ? o * (1 + t) : o + t - o * t, i = 2 * o - n;
|
|
108
108
|
return [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
at(i, n, e + 1 / 3) * 255,
|
|
110
|
+
at(i, n, e) * 255,
|
|
111
|
+
at(i, n, e - 1 / 3) * 255
|
|
112
112
|
];
|
|
113
113
|
}
|
|
114
|
-
function
|
|
115
|
-
let
|
|
116
|
-
return
|
|
114
|
+
function at(e, t, o) {
|
|
115
|
+
let n = o;
|
|
116
|
+
return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? e + (t - e) * 6 * n : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function ht(e) {
|
|
119
119
|
return Math.max(0, Math.min(1, e));
|
|
120
120
|
}
|
|
121
|
-
const
|
|
122
|
-
function
|
|
121
|
+
const bn = "suggest_share_on_socials";
|
|
122
|
+
function ao(e) {
|
|
123
123
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
124
|
+
const o = e[t];
|
|
125
|
+
if (o.role !== "tool" || o.toolName !== bn)
|
|
126
126
|
continue;
|
|
127
|
-
const
|
|
128
|
-
if (!
|
|
127
|
+
const n = Ot(e, t, "assistant");
|
|
128
|
+
if (!n)
|
|
129
129
|
return null;
|
|
130
|
-
const i =
|
|
130
|
+
const i = Ot(e, n.index, "user");
|
|
131
131
|
return i ? {
|
|
132
|
-
id: `share:${
|
|
132
|
+
id: `share:${o.callId ?? o.id}`,
|
|
133
133
|
userPrompt: i.content,
|
|
134
|
-
assistantAnswer:
|
|
134
|
+
assistantAnswer: n.content
|
|
135
135
|
} : null;
|
|
136
136
|
}
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
|
-
async function
|
|
140
|
-
const t = await
|
|
139
|
+
async function ro(e) {
|
|
140
|
+
const t = await lo(e);
|
|
141
141
|
if (!navigator.clipboard || typeof ClipboardItem > "u")
|
|
142
142
|
throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
|
|
143
143
|
await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
for (let
|
|
147
|
-
const i = e[
|
|
148
|
-
if (i.role ===
|
|
149
|
-
return { index:
|
|
145
|
+
function Ot(e, t, o) {
|
|
146
|
+
for (let n = t - 1; n >= 0; n -= 1) {
|
|
147
|
+
const i = e[n];
|
|
148
|
+
if (i.role === o && i.content.trim())
|
|
149
|
+
return { index: n, content: i.content.trim() };
|
|
150
150
|
}
|
|
151
151
|
return null;
|
|
152
152
|
}
|
|
153
|
-
async function
|
|
153
|
+
async function lo(e) {
|
|
154
154
|
return await (await fetch(e)).blob();
|
|
155
155
|
}
|
|
156
|
-
const
|
|
157
|
-
function
|
|
158
|
-
let
|
|
156
|
+
const po = "https://app.pluno.ai", so = "/api/product-agent/embed/active-users", co = 1800, uo = 15e3, go = 250, ho = 1e3, mo = 3e4;
|
|
157
|
+
function bo(e, t = {}) {
|
|
158
|
+
let o = !1, n = null, i = null, a = null;
|
|
159
159
|
const l = () => {
|
|
160
160
|
a !== null && (window.clearInterval(a), a = null);
|
|
161
161
|
}, p = (d) => {
|
|
162
|
-
|
|
162
|
+
o || (i !== null && window.clearTimeout(i), i = window.setTimeout(() => {
|
|
163
163
|
u();
|
|
164
|
-
},
|
|
164
|
+
}, _o(d)));
|
|
165
165
|
}, c = (d) => {
|
|
166
|
-
if (l(),
|
|
167
|
-
|
|
166
|
+
if (l(), n === null) {
|
|
167
|
+
n = d, e(d);
|
|
168
168
|
return;
|
|
169
169
|
}
|
|
170
|
-
const
|
|
170
|
+
const g = n, S = performance.now();
|
|
171
171
|
a = window.setInterval(() => {
|
|
172
|
-
if (
|
|
172
|
+
if (o) {
|
|
173
173
|
l();
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
},
|
|
176
|
+
const f = Math.min(1, (performance.now() - S) / co);
|
|
177
|
+
n = Math.round(g + (d - g) * xo(f)), e(n), f >= 1 && (n = d, e(d), l());
|
|
178
|
+
}, go);
|
|
179
179
|
}, u = async () => {
|
|
180
180
|
try {
|
|
181
|
-
const d = await
|
|
182
|
-
if (
|
|
181
|
+
const d = await fo(t);
|
|
182
|
+
if (o)
|
|
183
183
|
return;
|
|
184
184
|
c(d.count), p(d.refreshAfterMs);
|
|
185
185
|
} catch {
|
|
186
|
-
p(
|
|
186
|
+
p(uo);
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
return u(), () => {
|
|
190
|
-
|
|
190
|
+
o = !0, i !== null && window.clearTimeout(i), l();
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
async function
|
|
193
|
+
async function fo(e) {
|
|
194
194
|
if (e.loader)
|
|
195
195
|
return e.loader();
|
|
196
|
-
const
|
|
196
|
+
const o = await (e.fetcher ?? fetch)(new URL(so, wo(e.backendUrl ?? po)).toString(), {
|
|
197
197
|
cache: "no-store",
|
|
198
198
|
credentials: "omit"
|
|
199
199
|
});
|
|
200
|
-
if (!
|
|
200
|
+
if (!o.ok)
|
|
201
201
|
throw new Error("Failed to load active users");
|
|
202
|
-
const
|
|
202
|
+
const n = await o.json(), i = Ft(n.count), a = Ft(n.refreshAfterMs ?? n.refresh_after_ms);
|
|
203
203
|
if (i === null || a === null)
|
|
204
204
|
throw new Error("Invalid active users response");
|
|
205
205
|
return { count: i, refreshAfterMs: a };
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function Ft(e) {
|
|
208
208
|
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function wo(e) {
|
|
211
211
|
return e.endsWith("/") ? e : `${e}/`;
|
|
212
212
|
}
|
|
213
|
-
function
|
|
214
|
-
return Math.min(
|
|
213
|
+
function _o(e) {
|
|
214
|
+
return Math.min(mo, Math.max(ho, e));
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function xo(e) {
|
|
217
217
|
return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
|
|
218
218
|
}
|
|
219
|
-
const
|
|
220
|
-
"image/png",
|
|
221
|
-
"image/jpeg",
|
|
222
|
-
"image/webp",
|
|
223
|
-
"image/gif",
|
|
224
|
-
"application/pdf"
|
|
225
|
-
]), ko = Array.from(
|
|
226
|
-
mn
|
|
227
|
-
).join(","), Lo = 3, Ao = "No recent chats for this page yet.", Z = {
|
|
219
|
+
const fn = 100, vo = "product-agent:sdk-preview-socket-connect", yo = "product-agent:sdk-preview-socket-send", Co = "product-agent:sdk-preview-socket-close", So = "product-agent:sdk-preview-socket-open", Eo = "product-agent:sdk-preview-socket-message", ko = "product-agent:sdk-preview-socket-error", Lo = "product-agent:sdk-preview-socket-closed", Ht = "product-agent:sdk-preview-socket-id", Po = "data-pluno-sdk-preview-channel", Io = "product-agent:preview-diagnostic", wn = "pluno.productAgent.sharePromptsDisabled", Ao = 3, No = "No recent chats for this page yet.", Z = {
|
|
228
220
|
launcherLabel: "Ask for anything...",
|
|
229
221
|
accentColor: "#7c3aed",
|
|
230
222
|
colorScheme: "light",
|
|
@@ -232,7 +224,7 @@ const gn = 100, bo = "product-agent:sdk-preview-socket-connect", fo = "product-a
|
|
|
232
224
|
scribbleStyle: !1,
|
|
233
225
|
position: "bottom-right",
|
|
234
226
|
movableLauncher: !1
|
|
235
|
-
},
|
|
227
|
+
}, To = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Wt = "pluno-pa-scribble-font", _n = 190, xn = 41, Gt = 22, Do = 16, Ro = 24, Mo = 1, zo = 48, Bo = 420, Uo = 520, Oo = 0.24, Fo = 680, Ho = 800, Wo = 0.76, W = 8, mt = 50, vn = "http://www.w3.org/2000/svg", $t = 26, qt = 8, Go = 36, jt = [
|
|
236
228
|
{
|
|
237
229
|
ellipseCx: "17.5",
|
|
238
230
|
ellipseCy: "24.5",
|
|
@@ -269,12 +261,12 @@ const gn = 100, bo = "product-agent:sdk-preview-socket-connect", fo = "product-a
|
|
|
269
261
|
path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
|
|
270
262
|
pathStrokeWidth: "2.45"
|
|
271
263
|
}
|
|
272
|
-
],
|
|
273
|
-
let
|
|
274
|
-
function
|
|
264
|
+
], $o = 11, qo = 13, Vt = 4, jo = 10, Vo = 40, Ko = "movable-launcher-position-v2", yn = "pluno-pa-widget-styles", Cn = "data-pluno-pa-widget-styles";
|
|
265
|
+
let Kt = 0;
|
|
266
|
+
function Yo(e) {
|
|
275
267
|
return (t) => new oe(t, e);
|
|
276
268
|
}
|
|
277
|
-
async function
|
|
269
|
+
async function Xo(e = {}) {
|
|
278
270
|
const t = {
|
|
279
271
|
launcherLabel: e.launcherLabel ?? Z.launcherLabel,
|
|
280
272
|
accentColor: e.accentColor ?? Z.accentColor,
|
|
@@ -293,6 +285,7 @@ async function Vo(e = {}) {
|
|
|
293
285
|
restorePersistedState: e.restorePersistedState,
|
|
294
286
|
expectedPersistedSessionId: e.expectedPersistedSessionId,
|
|
295
287
|
webSocketFactory: e.webSocketFactory,
|
|
288
|
+
prepareAttachmentUpload: e.prepareAttachmentUpload,
|
|
296
289
|
loginRequired: e.loginRequired === !0,
|
|
297
290
|
loginButtonLabel: e.loginButtonLabel ?? "Log in to Pluno",
|
|
298
291
|
loginUrl: e.loginUrl,
|
|
@@ -311,6 +304,7 @@ async function Vo(e = {}) {
|
|
|
311
304
|
sdkPreviewChannelId: e.sdkPreviewChannelId,
|
|
312
305
|
initialDisplayState: e.initialDisplayState,
|
|
313
306
|
onDisplayStateChange: e.onDisplayStateChange,
|
|
307
|
+
onPanelOpenChange: e.onPanelOpenChange,
|
|
314
308
|
showLauncherMinimizeButton: e.showLauncherMinimizeButton === !0
|
|
315
309
|
};
|
|
316
310
|
X(
|
|
@@ -328,41 +322,41 @@ async function Vo(e = {}) {
|
|
|
328
322
|
initialStarterPromptCount: t.initialStarterPrompts?.length ?? 0
|
|
329
323
|
}
|
|
330
324
|
);
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
|
|
325
|
+
const o = document.createElement("div");
|
|
326
|
+
o.className = "pluno-pa-widget-host", o.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && o.setAttribute(
|
|
327
|
+
Po,
|
|
334
328
|
t.sdkPreviewChannelId
|
|
335
329
|
);
|
|
336
|
-
const
|
|
330
|
+
const n = o.attachShadow({ mode: "open" }), i = document.createElement("div");
|
|
337
331
|
i.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, i.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
338
|
-
let a =
|
|
332
|
+
let a = Yt(
|
|
339
333
|
t.accentColor,
|
|
340
334
|
t.scribbleStyle
|
|
341
335
|
);
|
|
342
|
-
|
|
336
|
+
bi(
|
|
343
337
|
i,
|
|
344
338
|
t.launcherLabel,
|
|
345
339
|
a,
|
|
346
340
|
t.movableLauncher,
|
|
347
341
|
t.showLauncherMinimizeButton
|
|
348
|
-
),
|
|
342
|
+
), n.appendChild(i);
|
|
349
343
|
const l = ca(t);
|
|
350
344
|
let p = t.movableLauncher ? l.launcherPosition : null, c = p !== null;
|
|
351
|
-
i.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && i.classList.add("pluno-pa-widget--scribble"), t.initialDisplayState === "minimized" && (i.classList.add("pluno-pa-widget--minimized"),
|
|
345
|
+
i.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && i.classList.add("pluno-pa-widget--scribble"), t.initialDisplayState === "minimized" && (i.classList.add("pluno-pa-widget--minimized"), fe(
|
|
352
346
|
i,
|
|
353
|
-
|
|
347
|
+
rt(
|
|
354
348
|
i,
|
|
355
349
|
p,
|
|
356
350
|
t.position
|
|
357
351
|
)
|
|
358
|
-
)),
|
|
352
|
+
)), dn(n, t.accentColor), Xt(i, a, {
|
|
359
353
|
accentColor: t.accentColor,
|
|
360
354
|
colorScheme: t.colorScheme,
|
|
361
355
|
fontFamily: t.fontFamily,
|
|
362
356
|
scribbleStyle: t.scribbleStyle
|
|
363
357
|
});
|
|
364
358
|
const u = await da(), d = u.ownerDocument;
|
|
365
|
-
u.appendChild(
|
|
359
|
+
u.appendChild(o), X(
|
|
366
360
|
"web-sdk.widget",
|
|
367
361
|
"Applied initial widget appearance",
|
|
368
362
|
{
|
|
@@ -372,70 +366,70 @@ async function Vo(e = {}) {
|
|
|
372
366
|
cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
|
|
373
367
|
}
|
|
374
368
|
);
|
|
375
|
-
const
|
|
369
|
+
const g = i.querySelector(
|
|
376
370
|
".pluno-pa-widget__launcher"
|
|
377
|
-
),
|
|
371
|
+
), S = i.querySelector(
|
|
378
372
|
".pluno-pa-widget__launcher-drag-handle"
|
|
379
|
-
),
|
|
373
|
+
), f = i.querySelector(
|
|
380
374
|
".pluno-pa-widget__launcher-input"
|
|
381
|
-
),
|
|
375
|
+
), F = i.querySelector(
|
|
382
376
|
".pluno-pa-widget__launcher-minimize"
|
|
383
|
-
),
|
|
377
|
+
), k = i.querySelector(".pluno-pa-widget__panel"), x = i.querySelector(
|
|
384
378
|
".pluno-pa-widget__close"
|
|
385
|
-
),
|
|
379
|
+
), v = i.querySelector(
|
|
386
380
|
".pluno-pa-widget__composer"
|
|
387
|
-
),
|
|
381
|
+
), h = i.querySelector(
|
|
388
382
|
".pluno-pa-widget__attachment-error"
|
|
389
|
-
),
|
|
383
|
+
), I = i.querySelector(
|
|
390
384
|
".pluno-pa-widget__billing-status"
|
|
391
|
-
),
|
|
385
|
+
), T = i.querySelector(
|
|
392
386
|
".pluno-pa-widget__attachments"
|
|
393
|
-
),
|
|
387
|
+
), P = i.querySelector(
|
|
394
388
|
".pluno-pa-widget__attachment-input"
|
|
395
|
-
),
|
|
389
|
+
), ke = i.querySelector(
|
|
396
390
|
".pluno-pa-widget__attach"
|
|
397
391
|
), b = i.querySelector(
|
|
398
392
|
".pluno-pa-widget__input"
|
|
399
|
-
),
|
|
393
|
+
), D = i.querySelector(
|
|
400
394
|
".pluno-pa-widget__send"
|
|
401
|
-
),
|
|
395
|
+
), de = i.querySelector(
|
|
402
396
|
".pluno-pa-widget__top-actions"
|
|
403
|
-
),
|
|
397
|
+
), ce = i.querySelector(
|
|
404
398
|
".pluno-pa-widget__history"
|
|
405
|
-
),
|
|
399
|
+
), we = i.querySelector(
|
|
406
400
|
".pluno-pa-widget__history-panel"
|
|
407
|
-
),
|
|
401
|
+
), G = i.querySelector(
|
|
408
402
|
".pluno-pa-widget__history-list"
|
|
409
|
-
),
|
|
403
|
+
), ie = i.querySelector(
|
|
410
404
|
".pluno-pa-widget__history-close"
|
|
411
|
-
),
|
|
405
|
+
), _ = i.querySelector(
|
|
412
406
|
".pluno-pa-widget__history-status"
|
|
413
|
-
),
|
|
407
|
+
), M = i.querySelector(
|
|
414
408
|
".pluno-pa-widget__timeline-jump"
|
|
415
|
-
),
|
|
409
|
+
), ae = i.querySelector(
|
|
416
410
|
".pluno-pa-widget__active-users-counter"
|
|
417
|
-
),
|
|
411
|
+
), L = i.querySelector(
|
|
418
412
|
".pluno-pa-widget__timeline"
|
|
419
|
-
),
|
|
413
|
+
), A = i.querySelector(
|
|
420
414
|
".pluno-pa-widget__timeline-bottom-sentinel"
|
|
421
415
|
);
|
|
422
|
-
if (!
|
|
416
|
+
if (!g || !f || !k || !x || !v || !h || !I || !T || !P || !ke || !b || !D || !de || !ce || !we || !G || !ie || !_ || !M || !ae || !L || !A)
|
|
423
417
|
throw new Error("Failed to mount Pluno widget");
|
|
424
|
-
if (t.movableLauncher && !
|
|
418
|
+
if (t.movableLauncher && !S)
|
|
425
419
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
426
|
-
|
|
427
|
-
let
|
|
428
|
-
const
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
420
|
+
tn(f), tn(b);
|
|
421
|
+
let y = [], B = null;
|
|
422
|
+
const _e = () => {
|
|
423
|
+
Ri(
|
|
424
|
+
T,
|
|
425
|
+
y,
|
|
432
426
|
(r) => {
|
|
433
|
-
|
|
434
|
-
(s,
|
|
435
|
-
),
|
|
427
|
+
y = y.filter(
|
|
428
|
+
(s, E) => E !== r
|
|
429
|
+
), _e(), O(w.getState()), $();
|
|
436
430
|
}
|
|
437
431
|
);
|
|
438
|
-
},
|
|
432
|
+
}, On = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
|
|
439
433
|
if (!t.tokenEndpoint)
|
|
440
434
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
441
435
|
const r = await fetch(t.tokenEndpoint, {
|
|
@@ -453,11 +447,11 @@ async function Vo(e = {}) {
|
|
|
453
447
|
if (!s.token)
|
|
454
448
|
throw new Error("Pluno token endpoint did not return a token");
|
|
455
449
|
return s.token;
|
|
456
|
-
}),
|
|
450
|
+
}), Fn = window.fetch.bind(window);
|
|
457
451
|
let w;
|
|
458
|
-
w = await
|
|
452
|
+
w = await Jn.init({
|
|
459
453
|
token: t.token,
|
|
460
|
-
tokenProvider:
|
|
454
|
+
tokenProvider: On,
|
|
461
455
|
backendUrl: t.backendUrl,
|
|
462
456
|
metadata: () => ({
|
|
463
457
|
...t.metadata ?? {},
|
|
@@ -468,56 +462,57 @@ async function Vo(e = {}) {
|
|
|
468
462
|
restorePersistedState: t.restorePersistedState,
|
|
469
463
|
expectedPersistedSessionId: t.expectedPersistedSessionId,
|
|
470
464
|
webSocketFactory: t.webSocketFactory,
|
|
465
|
+
prepareAttachmentUpload: t.prepareAttachmentUpload,
|
|
471
466
|
autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0
|
|
472
467
|
});
|
|
473
|
-
const
|
|
468
|
+
const Ke = new Set(l.openToolGroupKeys), xe = new Set(
|
|
474
469
|
l.seenShareCandidateIds
|
|
475
|
-
),
|
|
476
|
-
let Ye = l.sharePromptsDisabled || await ua(t), j = null,
|
|
470
|
+
), Me = new Set(xe);
|
|
471
|
+
let Ye = l.sharePromptsDisabled || await ua(t), j = null, ze = !1, ue = !1, ge = {
|
|
477
472
|
enabled: !0
|
|
478
|
-
},
|
|
473
|
+
}, he = 0, Ct = "", re = !1, ne = !1, le = [], Xe = null, Le = null;
|
|
479
474
|
const V = (r, s) => {
|
|
480
|
-
|
|
481
|
-
},
|
|
482
|
-
|
|
483
|
-
},
|
|
484
|
-
|
|
485
|
-
},
|
|
486
|
-
V(!0, r),
|
|
487
|
-
},
|
|
488
|
-
if (
|
|
475
|
+
ge = { enabled: r, reason: s };
|
|
476
|
+
}, K = () => {
|
|
477
|
+
M.hidden = !0;
|
|
478
|
+
}, Hn = () => {
|
|
479
|
+
M.hidden = !1;
|
|
480
|
+
}, Wn = (r = "jump") => {
|
|
481
|
+
V(!0, r), K(), De(L, () => ge.enabled), he = L.scrollTop;
|
|
482
|
+
}, me = () => {
|
|
483
|
+
if (ce.hidden = t.loginRequired, we.hidden = !re, ce.setAttribute("aria-expanded", String(re)), G.classList.toggle(
|
|
489
484
|
"pluno-pa-widget__history-list--center",
|
|
490
485
|
ne && le.length === 0
|
|
491
|
-
),
|
|
486
|
+
), G.replaceChildren(), ne && le.length === 0) {
|
|
492
487
|
const r = document.createElement("p");
|
|
493
|
-
r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...",
|
|
488
|
+
r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...", G.appendChild(r);
|
|
494
489
|
}
|
|
495
490
|
for (const r of le) {
|
|
496
491
|
const s = document.createElement("button");
|
|
497
492
|
s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled = ne;
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
const
|
|
501
|
-
|
|
493
|
+
const E = document.createElement("span");
|
|
494
|
+
E.className = "pluno-pa-widget__history-item-title", E.textContent = gi(r);
|
|
495
|
+
const z = document.createElement("time");
|
|
496
|
+
z.className = "pluno-pa-widget__history-time", z.dateTime = r.lastActiveAt, z.textContent = mi(
|
|
502
497
|
r.lastActiveAt,
|
|
503
498
|
Date.now()
|
|
504
499
|
);
|
|
505
|
-
const
|
|
506
|
-
|
|
507
|
-
re = !1,
|
|
508
|
-
}),
|
|
500
|
+
const N = document.createElement("small");
|
|
501
|
+
N.className = "pluno-pa-widget__history-path", N.textContent = hi(r), s.append(E, z, N), s.addEventListener("click", () => {
|
|
502
|
+
re = !1, Le = null, me(), V(!0, "newSession"), K(), w.loadSession(r.id), O(w.getState());
|
|
503
|
+
}), G.appendChild(s);
|
|
509
504
|
}
|
|
510
505
|
if (ne && le.length > 0) {
|
|
511
506
|
const r = document.createElement("p");
|
|
512
|
-
r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...",
|
|
507
|
+
r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...", G.appendChild(r);
|
|
513
508
|
}
|
|
514
|
-
|
|
515
|
-
},
|
|
509
|
+
_.textContent = Le ?? (!ne && le.length === 0 ? "No recent chats for this page yet." : ""), _.hidden = _.textContent.length === 0;
|
|
510
|
+
}, St = async (r) => {
|
|
516
511
|
if (!ne) {
|
|
517
|
-
ne = !0,
|
|
512
|
+
ne = !0, Le = null, me();
|
|
518
513
|
try {
|
|
519
514
|
const s = await w.listSessions({ cursor: r, limit: 20 });
|
|
520
|
-
le = r ? [...le, ...s.sessions] : s.sessions,
|
|
515
|
+
le = r ? [...le, ...s.sessions] : s.sessions, Xe = s.nextCursor;
|
|
521
516
|
} catch (s) {
|
|
522
517
|
X(
|
|
523
518
|
"web-sdk.widget",
|
|
@@ -525,60 +520,60 @@ async function Vo(e = {}) {
|
|
|
525
520
|
{
|
|
526
521
|
message: s instanceof Error ? s.message : String(s)
|
|
527
522
|
}
|
|
528
|
-
),
|
|
523
|
+
), Le = No;
|
|
529
524
|
} finally {
|
|
530
|
-
ne = !1,
|
|
525
|
+
ne = !1, me();
|
|
531
526
|
}
|
|
532
527
|
}
|
|
533
|
-
},
|
|
534
|
-
!
|
|
535
|
-
},
|
|
536
|
-
|
|
537
|
-
},
|
|
538
|
-
|
|
528
|
+
}, Gn = () => {
|
|
529
|
+
!Xe || ne || G.scrollHeight - G.scrollTop - G.clientHeight <= 24 && St(Xe);
|
|
530
|
+
}, $n = () => {
|
|
531
|
+
ze || typeof document > "u" || (dn(n, t.accentColor), o.isConnected || d.body?.appendChild(o));
|
|
532
|
+
}, Et = new MutationObserver($n);
|
|
533
|
+
Et.observe(d.documentElement, {
|
|
539
534
|
childList: !0,
|
|
540
535
|
subtree: !0
|
|
541
536
|
});
|
|
542
|
-
const
|
|
543
|
-
const s =
|
|
544
|
-
return
|
|
537
|
+
const Ze = (r = !0) => {
|
|
538
|
+
const s = je(i, r);
|
|
539
|
+
return bt(
|
|
545
540
|
i,
|
|
546
|
-
p ?
|
|
541
|
+
p ? En(p, s) : ni(
|
|
547
542
|
i,
|
|
548
543
|
t.position,
|
|
549
544
|
s
|
|
550
545
|
),
|
|
551
546
|
s
|
|
552
547
|
);
|
|
553
|
-
},
|
|
548
|
+
}, H = () => {
|
|
554
549
|
ha(t, {
|
|
555
550
|
isOpen: i.classList.contains("pluno-pa-widget--open"),
|
|
556
551
|
composerValue: b.value,
|
|
557
|
-
openToolGroupKeys: [...
|
|
552
|
+
openToolGroupKeys: [...Ke],
|
|
558
553
|
launcherPosition: c ? p : null,
|
|
559
|
-
seenShareCandidateIds: [...
|
|
560
|
-
-
|
|
554
|
+
seenShareCandidateIds: [...xe].slice(
|
|
555
|
+
-fn
|
|
561
556
|
),
|
|
562
557
|
sharePromptsDisabled: Ye
|
|
563
558
|
});
|
|
564
|
-
},
|
|
559
|
+
}, Be = (r) => {
|
|
565
560
|
t.onDisplayStateChange?.(r);
|
|
566
|
-
},
|
|
561
|
+
}, Pe = (r, s = !0) => {
|
|
567
562
|
if (r === "shown") {
|
|
568
|
-
i.classList.remove("pluno-pa-widget--minimized"),
|
|
563
|
+
i.classList.remove("pluno-pa-widget--minimized"), g.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && Ie(!1), s && Be("shown");
|
|
569
564
|
return;
|
|
570
565
|
}
|
|
571
|
-
j !== null && (window.clearTimeout(j), j = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"),
|
|
566
|
+
j !== null && (window.clearTimeout(j), j = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), g.hidden = !1, k.hidden = !0, x.hidden = !0, g.tabIndex = 0, b.value = "", fe(
|
|
572
567
|
i,
|
|
573
|
-
|
|
568
|
+
rt(
|
|
574
569
|
i,
|
|
575
570
|
p,
|
|
576
571
|
t.position
|
|
577
572
|
)
|
|
578
|
-
),
|
|
579
|
-
},
|
|
580
|
-
|
|
581
|
-
debugVersion:
|
|
573
|
+
), Jt(i), H(), s && Be("minimized");
|
|
574
|
+
}, be = (r, s = {}) => {
|
|
575
|
+
si(r, {
|
|
576
|
+
debugVersion: Ko,
|
|
582
577
|
launcherPosition: p,
|
|
583
578
|
rootClasses: i.className,
|
|
584
579
|
rootStyle: {
|
|
@@ -587,35 +582,35 @@ async function Vo(e = {}) {
|
|
|
587
582
|
right: i.style.right,
|
|
588
583
|
bottom: i.style.bottom
|
|
589
584
|
},
|
|
590
|
-
rootRect:
|
|
591
|
-
launcherRect:
|
|
592
|
-
panelRect:
|
|
593
|
-
viewport:
|
|
594
|
-
panelHidden:
|
|
595
|
-
closeHidden:
|
|
585
|
+
rootRect: lt(i),
|
|
586
|
+
launcherRect: lt(g),
|
|
587
|
+
panelRect: lt(k),
|
|
588
|
+
viewport: ee(),
|
|
589
|
+
panelHidden: k.hidden,
|
|
590
|
+
closeHidden: x.hidden,
|
|
596
591
|
...s
|
|
597
592
|
});
|
|
598
|
-
},
|
|
593
|
+
}, Ie = (r = !0) => {
|
|
599
594
|
if (!p)
|
|
600
|
-
return
|
|
601
|
-
const s =
|
|
602
|
-
return
|
|
595
|
+
return fe(i, null), Ze(r);
|
|
596
|
+
const s = Ze(r);
|
|
597
|
+
return fe(i, s), be("Applied stored closed launcher position", {
|
|
603
598
|
visibleLauncherPosition: s
|
|
604
599
|
}), s;
|
|
605
|
-
},
|
|
600
|
+
}, kt = (r, s) => {
|
|
606
601
|
if (!r || !s) {
|
|
607
|
-
|
|
602
|
+
Jt(i);
|
|
608
603
|
return;
|
|
609
604
|
}
|
|
610
|
-
|
|
605
|
+
pi(i, {
|
|
611
606
|
x: r.x - s.x,
|
|
612
607
|
y: r.y - s.y
|
|
613
608
|
});
|
|
614
|
-
},
|
|
609
|
+
}, Lt = () => {
|
|
615
610
|
if (i.classList.contains("pluno-pa-widget--minimized")) {
|
|
616
|
-
|
|
611
|
+
fe(
|
|
617
612
|
i,
|
|
618
|
-
|
|
613
|
+
rt(
|
|
619
614
|
i,
|
|
620
615
|
p,
|
|
621
616
|
t.position
|
|
@@ -623,127 +618,127 @@ async function Vo(e = {}) {
|
|
|
623
618
|
);
|
|
624
619
|
return;
|
|
625
620
|
}
|
|
626
|
-
const r =
|
|
621
|
+
const r = Ie();
|
|
627
622
|
if (i.classList.contains("pluno-pa-widget--open") || i.classList.contains("pluno-pa-widget--closing")) {
|
|
628
|
-
const s =
|
|
623
|
+
const s = Zt(
|
|
629
624
|
i,
|
|
630
625
|
r,
|
|
631
626
|
t.position
|
|
632
627
|
);
|
|
633
|
-
|
|
628
|
+
kt(s, r), be(
|
|
634
629
|
"Applied open panel position after viewport resize",
|
|
635
630
|
{ openPanelPosition: s }
|
|
636
631
|
);
|
|
637
|
-
} else p &&
|
|
632
|
+
} else p && be(
|
|
638
633
|
"Applied visible launcher position after viewport resize",
|
|
639
634
|
{ visibleLauncherPosition: r }
|
|
640
635
|
);
|
|
641
636
|
};
|
|
642
|
-
let
|
|
637
|
+
let Pt = () => {
|
|
643
638
|
};
|
|
644
|
-
window.addEventListener("resize",
|
|
639
|
+
window.addEventListener("resize", Lt), t.movableLauncher && S ? (Ie(), Pt = ti({
|
|
645
640
|
root: i,
|
|
646
|
-
launcher:
|
|
647
|
-
launcherDragHandle:
|
|
648
|
-
getPosition: () =>
|
|
641
|
+
launcher: g,
|
|
642
|
+
launcherDragHandle: S,
|
|
643
|
+
getPosition: () => Ze(),
|
|
649
644
|
setPosition: (r) => {
|
|
650
|
-
const s = r,
|
|
645
|
+
const s = r, E = je(i), z = bt(
|
|
651
646
|
i,
|
|
652
647
|
r,
|
|
653
|
-
|
|
648
|
+
E
|
|
654
649
|
);
|
|
655
|
-
p =
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
),
|
|
650
|
+
p = ii(
|
|
651
|
+
z,
|
|
652
|
+
E
|
|
653
|
+
), fe(i, z), be("Dragging closed launcher", {
|
|
659
654
|
requestedPosition: s
|
|
660
655
|
});
|
|
661
656
|
},
|
|
662
657
|
persist: () => {
|
|
663
|
-
c = !0,
|
|
658
|
+
c = !0, H(), be("Persisted closed launcher drag position");
|
|
664
659
|
}
|
|
665
|
-
})) :
|
|
666
|
-
let
|
|
667
|
-
const
|
|
668
|
-
if (!(!t.billingStatusLoader ||
|
|
669
|
-
|
|
660
|
+
})) : fe(i, null);
|
|
661
|
+
let Je = !1;
|
|
662
|
+
const It = async () => {
|
|
663
|
+
if (!(!t.billingStatusLoader || Je)) {
|
|
664
|
+
Je = !0;
|
|
670
665
|
try {
|
|
671
666
|
const r = await t.billingStatusLoader();
|
|
672
|
-
|
|
667
|
+
on(
|
|
673
668
|
t.billingStatus,
|
|
674
669
|
r,
|
|
675
670
|
w.getState().lastErrorCode
|
|
676
|
-
) && (t.billingStatus = r,
|
|
677
|
-
|
|
671
|
+
) && (t.billingStatus = r, dt(
|
|
672
|
+
I,
|
|
678
673
|
t.billingStatus,
|
|
679
674
|
w.getState().lastErrorCode
|
|
680
675
|
), $());
|
|
681
676
|
} finally {
|
|
682
|
-
|
|
677
|
+
Je = !1;
|
|
683
678
|
}
|
|
684
679
|
}
|
|
685
680
|
}, pe = (r = "", s = !0) => {
|
|
686
|
-
|
|
687
|
-
const
|
|
681
|
+
It(), j !== null && (window.clearTimeout(j), j = null), Pe("shown", !1), k.hidden = !1, x.hidden = !1, i.classList.remove("pluno-pa-widget--closing");
|
|
682
|
+
const E = Ie(), z = Zt(
|
|
688
683
|
i,
|
|
689
|
-
|
|
684
|
+
E,
|
|
690
685
|
t.position
|
|
691
686
|
);
|
|
692
|
-
if (
|
|
693
|
-
openPanelPosition:
|
|
694
|
-
visibleLauncherPosition:
|
|
695
|
-
}), V(!0, "open"),
|
|
696
|
-
i.classList.add("pluno-pa-widget--open"),
|
|
687
|
+
if (kt(z, E), be("Opening launcher at clamped open panel position", {
|
|
688
|
+
openPanelPosition: z,
|
|
689
|
+
visibleLauncherPosition: E
|
|
690
|
+
}), V(!0, "open"), K(), !s) {
|
|
691
|
+
i.classList.add("pluno-pa-widget--open"), g.hidden = !0, r && (b.value = r, Te(b)), De(L, () => ge.enabled), he = L.scrollTop, b.focus(), b.setSelectionRange(b.value.length, b.value.length), H(), Be("shown"), t.onPanelOpenChange?.(!0);
|
|
697
692
|
return;
|
|
698
693
|
}
|
|
699
694
|
window.requestAnimationFrame(() => {
|
|
700
|
-
i.classList.add("pluno-pa-widget--open"), r && (b.value = r,
|
|
701
|
-
|
|
695
|
+
i.classList.add("pluno-pa-widget--open"), r && (b.value = r, Te(b)), De(L, () => ge.enabled), he = L.scrollTop, b.focus(), b.setSelectionRange(b.value.length, b.value.length), H(), Be("shown"), t.onPanelOpenChange?.(!0), j = window.setTimeout(() => {
|
|
696
|
+
g.hidden = !0, De(L, () => ge.enabled), he = L.scrollTop;
|
|
702
697
|
}, 220);
|
|
703
698
|
});
|
|
704
|
-
},
|
|
705
|
-
j !== null && (window.clearTimeout(j), j = null),
|
|
706
|
-
|
|
699
|
+
}, qn = () => {
|
|
700
|
+
j !== null && (window.clearTimeout(j), j = null), g.hidden = !1, p && (Ie(!1), be("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), H(), t.onPanelOpenChange?.(!1), j = window.setTimeout(() => {
|
|
701
|
+
k.hidden = !0, x.hidden = !0, i.classList.remove("pluno-pa-widget--closing");
|
|
707
702
|
}, 220);
|
|
708
703
|
};
|
|
709
|
-
|
|
710
|
-
r.preventDefault(), pe(
|
|
711
|
-
}),
|
|
704
|
+
g.addEventListener("submit", (r) => {
|
|
705
|
+
r.preventDefault(), pe(f.value), f.value = "";
|
|
706
|
+
}), S?.addEventListener("click", (r) => {
|
|
712
707
|
r.preventDefault(), r.stopPropagation();
|
|
713
|
-
}),
|
|
714
|
-
r.target ===
|
|
715
|
-
}),
|
|
716
|
-
pe(
|
|
717
|
-
}),
|
|
718
|
-
if (!
|
|
708
|
+
}), g.addEventListener("click", (r) => {
|
|
709
|
+
r.target === f && !S || (pe(f.value), f.value = "");
|
|
710
|
+
}), f.addEventListener("focus", () => {
|
|
711
|
+
pe(f.value), f.value = "";
|
|
712
|
+
}), f.addEventListener("input", () => {
|
|
713
|
+
if (!f.value)
|
|
719
714
|
return;
|
|
720
|
-
const r =
|
|
721
|
-
pe(r),
|
|
722
|
-
}),
|
|
715
|
+
const r = f.value;
|
|
716
|
+
pe(r), f.value = "";
|
|
717
|
+
}), g.addEventListener("keydown", (r) => {
|
|
723
718
|
!i.classList.contains("pluno-pa-widget--minimized") || r.key !== "Enter" && r.key !== " " || (r.preventDefault(), pe());
|
|
724
|
-
}),
|
|
719
|
+
}), F?.addEventListener("pointerdown", (r) => {
|
|
725
720
|
r.stopPropagation();
|
|
726
|
-
}),
|
|
727
|
-
r.preventDefault(), r.stopPropagation(),
|
|
728
|
-
}),
|
|
729
|
-
|
|
730
|
-
}),
|
|
731
|
-
|
|
721
|
+
}), F?.addEventListener("click", (r) => {
|
|
722
|
+
r.preventDefault(), r.stopPropagation(), Pe("minimized");
|
|
723
|
+
}), x.addEventListener("click", qn), L.addEventListener("scroll", () => {
|
|
724
|
+
L.scrollTop < he - 1 && V(!1, "userScroll"), he = L.scrollTop;
|
|
725
|
+
}), M.addEventListener("click", () => {
|
|
726
|
+
Wn();
|
|
732
727
|
});
|
|
733
|
-
const
|
|
728
|
+
const At = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
|
|
734
729
|
([r]) => {
|
|
735
|
-
r?.isIntersecting && (V(!0, "bottom"),
|
|
730
|
+
r?.isIntersecting && (V(!0, "bottom"), K());
|
|
736
731
|
},
|
|
737
|
-
{ root:
|
|
732
|
+
{ root: L, threshold: 0 }
|
|
738
733
|
);
|
|
739
|
-
|
|
740
|
-
const
|
|
741
|
-
const r =
|
|
742
|
-
|
|
734
|
+
At?.observe(A);
|
|
735
|
+
const Ue = () => t.loginRequired || t.signupRequired, Nt = () => {
|
|
736
|
+
const r = Ue();
|
|
737
|
+
f.readOnly = r, f.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : t.launcherLabel, b.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Z.launcherLabel, v.hidden = r;
|
|
743
738
|
}, $ = () => {
|
|
744
|
-
|
|
739
|
+
D.disabled = Q(t.billingStatus) || !w.getState().isThinking && b.value.trim().length === 0 && y.length === 0, ke.disabled = Ue() || Q(t.billingStatus);
|
|
745
740
|
};
|
|
746
|
-
|
|
741
|
+
Nt(), v.addEventListener("submit", (r) => {
|
|
747
742
|
if (r.preventDefault(), t.loginRequired) {
|
|
748
743
|
t.onLoginClick?.();
|
|
749
744
|
return;
|
|
@@ -752,59 +747,55 @@ async function Vo(e = {}) {
|
|
|
752
747
|
t.onSignupClick?.();
|
|
753
748
|
return;
|
|
754
749
|
}
|
|
755
|
-
|
|
750
|
+
Q(t.billingStatus) || (ue = !0, V(!0, "send"), K(), y = pt(
|
|
756
751
|
w,
|
|
757
752
|
b,
|
|
758
|
-
|
|
759
|
-
),
|
|
753
|
+
y
|
|
754
|
+
), _e(), $());
|
|
760
755
|
});
|
|
761
|
-
let
|
|
762
|
-
const
|
|
763
|
-
|
|
764
|
-
},
|
|
765
|
-
|
|
766
|
-
|
|
756
|
+
let Ae = 0;
|
|
757
|
+
const jn = () => {
|
|
758
|
+
Ae = 0, i.classList.remove("pluno-pa-widget--drag-over");
|
|
759
|
+
}, Tt = (r) => {
|
|
760
|
+
B !== null && window.clearTimeout(B), h.textContent = r, h.hidden = !1, B = window.setTimeout(() => {
|
|
761
|
+
h.textContent = "", h.hidden = !0, B = null;
|
|
767
762
|
}, 3e3);
|
|
768
|
-
},
|
|
769
|
-
|
|
770
|
-
},
|
|
763
|
+
}, Vn = () => {
|
|
764
|
+
B !== null && (window.clearTimeout(B), B = null), h.textContent = "", h.hidden = !0;
|
|
765
|
+
}, Dt = async (r) => {
|
|
771
766
|
if (r.length === 0)
|
|
772
767
|
return;
|
|
773
|
-
const s =
|
|
774
|
-
|
|
775
|
-
throw new Error(
|
|
776
|
-
`Attach up to ${We} files per message.`
|
|
777
|
-
);
|
|
778
|
-
z = [...z, ...s], fe(), Wn(), $(), O(w.getState()), i.classList.contains("pluno-pa-widget--open") || pe();
|
|
768
|
+
const s = Bi(w, r);
|
|
769
|
+
y = [...y, ...s], _e(), Vn(), $(), O(w.getState()), i.classList.contains("pluno-pa-widget--open") || pe();
|
|
779
770
|
};
|
|
780
|
-
|
|
781
|
-
t.loginRequired ||
|
|
782
|
-
}),
|
|
783
|
-
const r = Array.from(
|
|
784
|
-
|
|
785
|
-
|
|
771
|
+
ke.addEventListener("click", () => {
|
|
772
|
+
t.loginRequired || Q(t.billingStatus) || P.click();
|
|
773
|
+
}), P.addEventListener("change", () => {
|
|
774
|
+
const r = Array.from(P.files ?? []);
|
|
775
|
+
P.value = "", Dt(r).catch((s) => {
|
|
776
|
+
Tt(
|
|
786
777
|
s instanceof Error ? s.message : "Failed to attach file"
|
|
787
778
|
), X("web-sdk.widget", "Attachment failed", {
|
|
788
779
|
message: s instanceof Error ? s.message : String(s)
|
|
789
780
|
});
|
|
790
781
|
});
|
|
791
782
|
}), i.addEventListener("dragenter", (r) => {
|
|
792
|
-
!
|
|
783
|
+
!He(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Ae += 1, i.classList.add("pluno-pa-widget--drag-over"));
|
|
793
784
|
}), i.addEventListener("dragover", (r) => {
|
|
794
785
|
const s = r.dataTransfer;
|
|
795
|
-
!
|
|
786
|
+
!He(s) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), s.dropEffect = "copy");
|
|
796
787
|
}), i.addEventListener("dragleave", (r) => {
|
|
797
|
-
|
|
788
|
+
He(r.dataTransfer) && (r.stopPropagation(), Ae = Math.max(0, Ae - 1), Ae === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
|
|
798
789
|
}), i.addEventListener("drop", (r) => {
|
|
799
790
|
const s = r.dataTransfer;
|
|
800
|
-
!
|
|
801
|
-
|
|
802
|
-
|
|
791
|
+
!He(s) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), jn(), Dt(s.files).catch((E) => {
|
|
792
|
+
Tt(
|
|
793
|
+
E instanceof Error ? E.message : "Failed to attach file"
|
|
803
794
|
), X("web-sdk.widget", "Attachment failed", {
|
|
804
|
-
message:
|
|
795
|
+
message: E instanceof Error ? E.message : String(E)
|
|
805
796
|
});
|
|
806
797
|
}));
|
|
807
|
-
}),
|
|
798
|
+
}), D.addEventListener("click", () => {
|
|
808
799
|
if (t.loginRequired) {
|
|
809
800
|
t.onLoginClick?.();
|
|
810
801
|
return;
|
|
@@ -813,61 +804,64 @@ async function Vo(e = {}) {
|
|
|
813
804
|
w.stop();
|
|
814
805
|
return;
|
|
815
806
|
}
|
|
816
|
-
|
|
807
|
+
ue = !0, V(!0, "send"), K(), y = pt(
|
|
817
808
|
w,
|
|
818
809
|
b,
|
|
819
|
-
|
|
820
|
-
),
|
|
821
|
-
}),
|
|
822
|
-
re = !re,
|
|
823
|
-
}),
|
|
824
|
-
re = !1,
|
|
825
|
-
}),
|
|
826
|
-
|
|
810
|
+
y
|
|
811
|
+
), _e(), $(), O(w.getState());
|
|
812
|
+
}), ce.addEventListener("click", () => {
|
|
813
|
+
re = !re, Le = null, me(), re && le.length === 0 && St(null);
|
|
814
|
+
}), ie.addEventListener("click", () => {
|
|
815
|
+
re = !1, me();
|
|
816
|
+
}), G.addEventListener("scroll", Gn), b.addEventListener("input", () => {
|
|
817
|
+
Te(b), H(), $(), Yn();
|
|
827
818
|
}), b.addEventListener("keydown", (r) => {
|
|
828
819
|
if (!(r.key !== "Enter" || r.shiftKey)) {
|
|
829
820
|
if (r.preventDefault(), t.loginRequired) {
|
|
830
821
|
t.onLoginClick?.();
|
|
831
822
|
return;
|
|
832
823
|
}
|
|
833
|
-
|
|
824
|
+
ue = !0, V(!0, "send"), K(), y = pt(
|
|
834
825
|
w,
|
|
835
826
|
b,
|
|
836
|
-
|
|
837
|
-
),
|
|
827
|
+
y
|
|
828
|
+
), _e(), $(), O(w.getState());
|
|
838
829
|
}
|
|
839
830
|
}), i.addEventListener("click", (r) => {
|
|
840
|
-
(r.target instanceof Element ? r.target : null)?.closest("a[href]") &&
|
|
841
|
-
}), l.composerValue && (b.value = l.composerValue,
|
|
842
|
-
const
|
|
843
|
-
let
|
|
831
|
+
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && H();
|
|
832
|
+
}), l.composerValue && (b.value = l.composerValue, Te(b)), t.initialDisplayState === "minimized" ? Pe("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && pe(b.value, !1);
|
|
833
|
+
const Oe = () => a;
|
|
834
|
+
let Qe = w.getState().appearance !== null, Fe = null, Ne = null, ve = null, Rt = w.getState().isThinking, ye = null, Ce = null, Mt = () => {
|
|
835
|
+
};
|
|
836
|
+
const Kn = !!t.socialPostDraftHandler, et = /* @__PURE__ */ new Map(), tt = () => b.value.trim().length > 0 || y.length > 0, Yn = () => {
|
|
837
|
+
const r = Ce !== null && ct(w.getState(), tt());
|
|
838
|
+
ae.hidden = !r, r && Ce !== null && Ln(ae, Ce);
|
|
844
839
|
};
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
}, et = (r) => {
|
|
840
|
+
let Se = null;
|
|
841
|
+
const Xn = () => {
|
|
842
|
+
ue = !0, V(!0, "newSession"), K(), re = !1, me(), w.startNewSession(), Ke.clear(), b.value = "", y = [], _e(), Te(b), H(), $(), b.focus(), O(w.getState());
|
|
843
|
+
}, nt = (r) => {
|
|
850
844
|
if (!r) {
|
|
851
|
-
|
|
845
|
+
Se?.remove(), Se = null;
|
|
852
846
|
return;
|
|
853
847
|
}
|
|
854
|
-
|
|
848
|
+
Se || (Se = Ve(
|
|
855
849
|
"pluno-pa-widget__new-chat",
|
|
856
850
|
"New chat",
|
|
857
|
-
|
|
851
|
+
ki(),
|
|
858
852
|
!1
|
|
859
|
-
),
|
|
853
|
+
), Se.addEventListener("click", Xn), de.insertBefore(Se, ce));
|
|
860
854
|
}, O = (r) => {
|
|
861
|
-
if (
|
|
862
|
-
|
|
855
|
+
if (me(), yt(r.lastErrorCode) ? ye = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !Q(t.billingStatus) && (ye = null), dt(
|
|
856
|
+
I,
|
|
863
857
|
t.billingStatus,
|
|
864
|
-
|
|
858
|
+
ye
|
|
865
859
|
), t.loginRequired) {
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
860
|
+
et.clear(), pn(
|
|
861
|
+
L,
|
|
862
|
+
D,
|
|
863
|
+
nt,
|
|
864
|
+
Oe,
|
|
871
865
|
"Log in to use Pluno on this page.",
|
|
872
866
|
t.loginButtonLabel,
|
|
873
867
|
t.loginUrl,
|
|
@@ -876,11 +870,11 @@ async function Vo(e = {}) {
|
|
|
876
870
|
return;
|
|
877
871
|
}
|
|
878
872
|
if (t.signupRequired) {
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
873
|
+
et.clear(), pn(
|
|
874
|
+
L,
|
|
875
|
+
D,
|
|
876
|
+
nt,
|
|
877
|
+
Oe,
|
|
884
878
|
"Complete signup to unlock your free trial credits.",
|
|
885
879
|
t.signupButtonLabel,
|
|
886
880
|
t.signupUrl,
|
|
@@ -888,70 +882,65 @@ async function Vo(e = {}) {
|
|
|
888
882
|
);
|
|
889
883
|
return;
|
|
890
884
|
}
|
|
891
|
-
const s =
|
|
892
|
-
|
|
893
|
-
const
|
|
894
|
-
|
|
885
|
+
const s = ci(r), E = s !== Ct;
|
|
886
|
+
Ct = s;
|
|
887
|
+
const z = ue || ge.enabled;
|
|
888
|
+
ue = !1, $i(
|
|
889
|
+
L,
|
|
895
890
|
A,
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
be,
|
|
891
|
+
D,
|
|
892
|
+
nt,
|
|
893
|
+
ae,
|
|
900
894
|
r,
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
(D) => {
|
|
912
|
-
de = !0, V(!0, "send"), Y(), w.sendMessage(D);
|
|
895
|
+
Ce,
|
|
896
|
+
Ce !== null && ct(r, tt()),
|
|
897
|
+
z,
|
|
898
|
+
() => ge.enabled,
|
|
899
|
+
Ke,
|
|
900
|
+
et,
|
|
901
|
+
H,
|
|
902
|
+
Oe,
|
|
903
|
+
(N) => {
|
|
904
|
+
ue = !0, V(!0, "send"), K(), w.sendMessage(N);
|
|
913
905
|
},
|
|
914
|
-
|
|
915
|
-
dismissedCandidateIds:
|
|
916
|
-
draftingCandidateId:
|
|
917
|
-
error:
|
|
918
|
-
characterIconOptions:
|
|
919
|
-
onSeen: (
|
|
920
|
-
|
|
906
|
+
Kn && !Ye ? {
|
|
907
|
+
dismissedCandidateIds: Me,
|
|
908
|
+
draftingCandidateId: Fe,
|
|
909
|
+
error: Ne,
|
|
910
|
+
characterIconOptions: Oe(),
|
|
911
|
+
onSeen: (N) => {
|
|
912
|
+
xe.add(N.id), H();
|
|
921
913
|
},
|
|
922
|
-
onDraft: (
|
|
923
|
-
|
|
914
|
+
onDraft: (N) => {
|
|
915
|
+
Zn(N);
|
|
924
916
|
},
|
|
925
|
-
onDismiss: (
|
|
926
|
-
|
|
917
|
+
onDismiss: (N) => {
|
|
918
|
+
xe.add(N.id), Me.add(N.id), H(), Ne = null, O(w.getState());
|
|
927
919
|
},
|
|
928
|
-
onDisable: (
|
|
929
|
-
Ye = !0,
|
|
920
|
+
onDisable: (N) => {
|
|
921
|
+
Ye = !0, xe.add(N.id), Me.add(N.id), H(), ga(t, !0), Ne = null, O(w.getState());
|
|
930
922
|
}
|
|
931
923
|
} : void 0
|
|
932
|
-
),
|
|
924
|
+
), z ? (he = L.scrollTop, K()) : E && ui(r) && Hn();
|
|
933
925
|
};
|
|
934
|
-
return
|
|
926
|
+
return Mt = bo(
|
|
935
927
|
(r) => {
|
|
936
|
-
|
|
937
|
-
w.getState(),
|
|
938
|
-
b.value.trim().length > 0 || z.length > 0
|
|
939
|
-
) && O(w.getState());
|
|
928
|
+
Ce = r, !ze && ct(w.getState(), tt()) && O(w.getState());
|
|
940
929
|
},
|
|
941
930
|
{
|
|
942
931
|
backendUrl: t.backendUrl,
|
|
943
|
-
fetcher:
|
|
932
|
+
fetcher: Fn,
|
|
944
933
|
loader: t.activeUsersLoader
|
|
945
934
|
}
|
|
946
935
|
), w.on("state", (r) => {
|
|
947
|
-
const s =
|
|
948
|
-
|
|
936
|
+
const s = Rt && !r.isThinking;
|
|
937
|
+
Rt = r.isThinking, r.appearance ? (Qe = !0, X(
|
|
949
938
|
"web-sdk.widget",
|
|
950
939
|
"Agent state supplied appearance",
|
|
951
940
|
{
|
|
952
941
|
appearance: r.appearance
|
|
953
942
|
}
|
|
954
|
-
),
|
|
943
|
+
), ot(r.appearance, "agent.state.appearance")) : Qe && (Qe = !1, X(
|
|
955
944
|
"web-sdk.widget",
|
|
956
945
|
"Agent state cleared appearance; reverting to configured widget options",
|
|
957
946
|
{
|
|
@@ -959,32 +948,32 @@ async function Vo(e = {}) {
|
|
|
959
948
|
fallbackColorScheme: t.colorScheme,
|
|
960
949
|
fallbackFontFamily: t.fontFamily
|
|
961
950
|
}
|
|
962
|
-
),
|
|
951
|
+
), ot({}, "agent.state.appearance-cleared")), O(r), $(), s && It();
|
|
963
952
|
}), O(w.getState()), $(), {
|
|
964
953
|
agent: w,
|
|
965
954
|
updateAppearance: (r) => {
|
|
966
|
-
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle),
|
|
955
|
+
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), ot(r, "widgetHandle.updateAppearance");
|
|
967
956
|
},
|
|
968
957
|
updateBillingStatus: (r) => {
|
|
969
958
|
const s = r ?? null;
|
|
970
|
-
|
|
959
|
+
on(
|
|
971
960
|
t.billingStatus,
|
|
972
961
|
s,
|
|
973
|
-
|
|
974
|
-
) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !
|
|
962
|
+
ye
|
|
963
|
+
) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !Q(t.billingStatus) && (ye = null), dt(
|
|
975
964
|
i.querySelector(".pluno-pa-widget__billing-status"),
|
|
976
965
|
t.billingStatus,
|
|
977
|
-
|
|
966
|
+
ye
|
|
978
967
|
), $());
|
|
979
968
|
},
|
|
980
969
|
updateAuthGate: (r) => {
|
|
981
|
-
const s =
|
|
982
|
-
t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl),
|
|
970
|
+
const s = Ue();
|
|
971
|
+
t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl), Nt(), O(w.getState()), $(), s && !Ue() && w.connect().catch((E) => {
|
|
983
972
|
X(
|
|
984
973
|
"web-sdk.widget",
|
|
985
974
|
"Failed to connect after auth gate cleared",
|
|
986
975
|
{
|
|
987
|
-
message:
|
|
976
|
+
message: E instanceof Error ? E.message : String(E)
|
|
988
977
|
}
|
|
989
978
|
);
|
|
990
979
|
});
|
|
@@ -994,66 +983,66 @@ async function Vo(e = {}) {
|
|
|
994
983
|
},
|
|
995
984
|
updateDisplayState: (r) => {
|
|
996
985
|
if (r === "shown") {
|
|
997
|
-
|
|
986
|
+
Pe("shown", !1);
|
|
998
987
|
return;
|
|
999
988
|
}
|
|
1000
|
-
|
|
989
|
+
Pe("minimized", !1);
|
|
1001
990
|
},
|
|
1002
991
|
destroy: () => {
|
|
1003
|
-
|
|
992
|
+
ze || (ze = !0, Et.disconnect(), At?.disconnect(), window.removeEventListener("resize", Lt), Pt(), B !== null && window.clearTimeout(B), Mt(), ve?.remove(), w.destroy(), o.remove());
|
|
1004
993
|
}
|
|
1005
994
|
};
|
|
1006
|
-
async function
|
|
1007
|
-
if (!
|
|
1008
|
-
|
|
995
|
+
async function Zn(r) {
|
|
996
|
+
if (!Fe) {
|
|
997
|
+
Fe = r.id, Ne = null, O(w.getState());
|
|
1009
998
|
try {
|
|
1010
999
|
if (!t.socialPostDraftHandler)
|
|
1011
1000
|
throw new Error("Social post drafting is not available here.");
|
|
1012
1001
|
const s = await t.socialPostDraftHandler(r);
|
|
1013
1002
|
if (!s.linkedinPost || !s.xPost)
|
|
1014
1003
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
1015
|
-
|
|
1004
|
+
xe.add(r.id), Me.add(r.id), H(), ve?.remove(), ve = Ji(s, {
|
|
1016
1005
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
1017
1006
|
onClose: () => {
|
|
1018
|
-
|
|
1007
|
+
ve?.remove(), ve = null;
|
|
1019
1008
|
}
|
|
1020
|
-
}), i.appendChild(
|
|
1009
|
+
}), i.appendChild(ve);
|
|
1021
1010
|
} catch (s) {
|
|
1022
|
-
|
|
1011
|
+
Ne = s instanceof Error ? s.message : "Could not draft social post.";
|
|
1023
1012
|
} finally {
|
|
1024
|
-
|
|
1013
|
+
Fe = null, O(w.getState());
|
|
1025
1014
|
}
|
|
1026
1015
|
}
|
|
1027
1016
|
}
|
|
1028
|
-
function
|
|
1029
|
-
const
|
|
1030
|
-
a =
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
),
|
|
1034
|
-
accentColor:
|
|
1035
|
-
colorScheme:
|
|
1036
|
-
fontFamily:
|
|
1037
|
-
scribbleStyle:
|
|
1017
|
+
function ot(r, s) {
|
|
1018
|
+
const E = r.accentColor ?? t.accentColor, z = r.colorScheme ?? t.colorScheme, N = r.fontFamily ?? t.fontFamily, it = r.scribbleStyle ?? t.scribbleStyle;
|
|
1019
|
+
a = Yt(
|
|
1020
|
+
E,
|
|
1021
|
+
it
|
|
1022
|
+
), Xt(i, a, {
|
|
1023
|
+
accentColor: E,
|
|
1024
|
+
colorScheme: z,
|
|
1025
|
+
fontFamily: N,
|
|
1026
|
+
scribbleStyle: it
|
|
1038
1027
|
}), X("web-sdk.widget", "Updated widget appearance", {
|
|
1039
1028
|
source: s,
|
|
1040
1029
|
inputAppearance: r,
|
|
1041
|
-
appliedAccentColor:
|
|
1042
|
-
appliedColorScheme:
|
|
1043
|
-
appliedFontFamily:
|
|
1044
|
-
appliedScribbleStyle:
|
|
1030
|
+
appliedAccentColor: E,
|
|
1031
|
+
appliedColorScheme: z,
|
|
1032
|
+
appliedFontFamily: N,
|
|
1033
|
+
appliedScribbleStyle: it,
|
|
1045
1034
|
cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
|
|
1046
1035
|
});
|
|
1047
1036
|
}
|
|
1048
1037
|
}
|
|
1049
|
-
function
|
|
1038
|
+
function Yt(e, t) {
|
|
1050
1039
|
return { accentColor: e, scribbleStyle: t };
|
|
1051
1040
|
}
|
|
1052
|
-
function
|
|
1053
|
-
const t =
|
|
1054
|
-
return t === null ? "#fafafa" :
|
|
1041
|
+
function Zo(e) {
|
|
1042
|
+
const t = Jo(e);
|
|
1043
|
+
return t === null ? "#fafafa" : Qo(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
1055
1044
|
}
|
|
1056
|
-
function
|
|
1045
|
+
function Jo(e) {
|
|
1057
1046
|
const t = e.trim();
|
|
1058
1047
|
return /^#[0-9a-f]{6}$/i.test(t) ? [
|
|
1059
1048
|
Number.parseInt(t.slice(1, 3), 16),
|
|
@@ -1065,26 +1054,26 @@ function Ko(e) {
|
|
|
1065
1054
|
Number.parseInt(t[3] + t[3], 16)
|
|
1066
1055
|
] : null;
|
|
1067
1056
|
}
|
|
1068
|
-
function
|
|
1069
|
-
const
|
|
1057
|
+
function Qo([e, t, o]) {
|
|
1058
|
+
const n = (i) => {
|
|
1070
1059
|
const a = i / 255;
|
|
1071
1060
|
return a <= 0.03928 ? a / 12.92 : ((a + 0.055) / 1.055) ** 2.4;
|
|
1072
1061
|
};
|
|
1073
|
-
return 0.2126 *
|
|
1062
|
+
return 0.2126 * n(e) + 0.7152 * n(t) + 0.0722 * n(o);
|
|
1074
1063
|
}
|
|
1075
|
-
function
|
|
1064
|
+
function Xt(e, t, o) {
|
|
1076
1065
|
e.classList.toggle(
|
|
1077
1066
|
"pluno-pa-widget--dark",
|
|
1078
|
-
|
|
1067
|
+
o.colorScheme === "dark"
|
|
1079
1068
|
), e.classList.toggle(
|
|
1080
1069
|
"pluno-pa-widget--light",
|
|
1081
|
-
|
|
1082
|
-
), e.classList.toggle("pluno-pa-widget--scribble",
|
|
1083
|
-
const
|
|
1084
|
-
e.style.setProperty("--pluno-pa-accent",
|
|
1070
|
+
o.colorScheme !== "dark"
|
|
1071
|
+
), e.classList.toggle("pluno-pa-widget--scribble", o.scribbleStyle);
|
|
1072
|
+
const n = o.scribbleStyle ? hn(o.accentColor) : o.accentColor;
|
|
1073
|
+
e.style.setProperty("--pluno-pa-accent", n), o.scribbleStyle ? e.style.setProperty(
|
|
1085
1074
|
"--pluno-pa-accent-contrast",
|
|
1086
|
-
|
|
1087
|
-
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily =
|
|
1075
|
+
Zo(n)
|
|
1076
|
+
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = o.scribbleStyle ? To : o.fontFamily, o.scribbleStyle && ei(e.ownerDocument);
|
|
1088
1077
|
const i = Array.from(
|
|
1089
1078
|
e.querySelectorAll(".pluno-pa-widget__character")
|
|
1090
1079
|
);
|
|
@@ -1096,11 +1085,11 @@ function jt(e, t, n) {
|
|
|
1096
1085
|
)
|
|
1097
1086
|
);
|
|
1098
1087
|
}
|
|
1099
|
-
function
|
|
1100
|
-
if (e.getElementById(
|
|
1088
|
+
function ei(e) {
|
|
1089
|
+
if (e.getElementById(Wt))
|
|
1101
1090
|
return;
|
|
1102
1091
|
const t = e.createElement("style");
|
|
1103
|
-
t.id =
|
|
1092
|
+
t.id = Wt, t.textContent = `@font-face {
|
|
1104
1093
|
font-family: "Architects Daughter";
|
|
1105
1094
|
font-style: normal;
|
|
1106
1095
|
font-weight: 400;
|
|
@@ -1108,201 +1097,201 @@ function Zo(e) {
|
|
|
1108
1097
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
1109
1098
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
1110
1099
|
}
|
|
1111
|
-
function
|
|
1100
|
+
function ti({
|
|
1112
1101
|
root: e,
|
|
1113
1102
|
launcher: t,
|
|
1114
|
-
launcherDragHandle:
|
|
1115
|
-
getPosition:
|
|
1103
|
+
launcherDragHandle: o,
|
|
1104
|
+
getPosition: n,
|
|
1116
1105
|
setPosition: i,
|
|
1117
1106
|
persist: a
|
|
1118
1107
|
}) {
|
|
1119
1108
|
let l = null, p = null, c = null, u = !1, d = null;
|
|
1120
|
-
const
|
|
1109
|
+
const g = () => {
|
|
1121
1110
|
l = null, p = null, c = null, u = !1, e.classList.remove("pluno-pa-widget--dragging");
|
|
1122
|
-
},
|
|
1123
|
-
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (
|
|
1124
|
-
},
|
|
1125
|
-
if (l !==
|
|
1111
|
+
}, S = (h) => {
|
|
1112
|
+
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, p = { x: h.clientX, y: h.clientY }, c = n(), u = !1, t.setPointerCapture?.(h.pointerId));
|
|
1113
|
+
}, f = (h) => {
|
|
1114
|
+
if (l !== h.pointerId || !p || !c)
|
|
1126
1115
|
return;
|
|
1127
|
-
|
|
1128
|
-
const
|
|
1129
|
-
!u && Math.hypot(
|
|
1130
|
-
},
|
|
1131
|
-
l ===
|
|
1132
|
-
},
|
|
1133
|
-
l ===
|
|
1134
|
-
},
|
|
1116
|
+
h.preventDefault();
|
|
1117
|
+
const I = h.clientX - p.x, T = h.clientY - p.y;
|
|
1118
|
+
!u && Math.hypot(I, T) < Vt || (u = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: c.x + I, y: c.y + T }));
|
|
1119
|
+
}, F = (h) => {
|
|
1120
|
+
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), u && (d = { x: h.clientX, y: h.clientY }, a()), g());
|
|
1121
|
+
}, k = (h) => {
|
|
1122
|
+
l === h.pointerId && (h.preventDefault(), g());
|
|
1123
|
+
}, x = (h) => {
|
|
1135
1124
|
if (!d)
|
|
1136
1125
|
return;
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
) <=
|
|
1141
|
-
d = null,
|
|
1142
|
-
},
|
|
1126
|
+
const I = Math.hypot(
|
|
1127
|
+
h.clientX - d.x,
|
|
1128
|
+
h.clientY - d.y
|
|
1129
|
+
) <= Vt;
|
|
1130
|
+
d = null, I && (h.preventDefault(), h.stopPropagation());
|
|
1131
|
+
}, v = (h) => {
|
|
1143
1132
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
1144
1133
|
return;
|
|
1145
|
-
const
|
|
1146
|
-
let
|
|
1147
|
-
|
|
1134
|
+
const I = h.shiftKey ? Vo : jo, T = n();
|
|
1135
|
+
let P = null;
|
|
1136
|
+
h.key === "ArrowUp" ? P = { x: T.x, y: T.y - I } : h.key === "ArrowDown" ? P = { x: T.x, y: T.y + I } : h.key === "ArrowLeft" ? P = { x: T.x - I, y: T.y } : h.key === "ArrowRight" && (P = { x: T.x + I, y: T.y }), P && (h.preventDefault(), h.stopPropagation(), i(P), a());
|
|
1148
1137
|
};
|
|
1149
|
-
return t.addEventListener("pointerdown",
|
|
1150
|
-
t.removeEventListener("pointerdown",
|
|
1138
|
+
return t.addEventListener("pointerdown", S), t.addEventListener("pointermove", f), t.addEventListener("pointerup", F), t.addEventListener("pointercancel", k), t.addEventListener("click", x, !0), o.addEventListener("keydown", v), () => {
|
|
1139
|
+
t.removeEventListener("pointerdown", S), t.removeEventListener("pointermove", f), t.removeEventListener("pointerup", F), t.removeEventListener("pointercancel", k), t.removeEventListener("click", x, !0), o.removeEventListener("keydown", v);
|
|
1151
1140
|
};
|
|
1152
1141
|
}
|
|
1153
|
-
function
|
|
1154
|
-
const
|
|
1142
|
+
function je(e, t = !0) {
|
|
1143
|
+
const o = ee();
|
|
1155
1144
|
if (e.classList.contains("pluno-pa-widget--minimized"))
|
|
1156
1145
|
return e.classList.contains("pluno-pa-widget--scribble") ? {
|
|
1157
|
-
width:
|
|
1158
|
-
height:
|
|
1159
|
-
} : { width:
|
|
1160
|
-
const
|
|
1146
|
+
width: Do,
|
|
1147
|
+
height: Ro
|
|
1148
|
+
} : { width: Gt, height: Gt };
|
|
1149
|
+
const n = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
1161
1150
|
return {
|
|
1162
|
-
width: t && i &&
|
|
1163
|
-
height: t && i &&
|
|
1151
|
+
width: t && i && n.width > 0 ? n.width : Math.min(_n, o.width - 36),
|
|
1152
|
+
height: t && i && n.height > 0 ? n.height : e.classList.contains("pluno-pa-widget--scribble") ? zo : xn
|
|
1164
1153
|
};
|
|
1165
1154
|
}
|
|
1166
|
-
function
|
|
1167
|
-
const e =
|
|
1155
|
+
function Sn() {
|
|
1156
|
+
const e = ee();
|
|
1168
1157
|
return {
|
|
1169
1158
|
width: Math.min(
|
|
1170
|
-
|
|
1171
|
-
e.width *
|
|
1172
|
-
|
|
1173
|
-
|
|
1159
|
+
Ee(
|
|
1160
|
+
e.width * Oo,
|
|
1161
|
+
Bo,
|
|
1162
|
+
Uo
|
|
1174
1163
|
),
|
|
1175
1164
|
e.width - W * 2
|
|
1176
1165
|
),
|
|
1177
1166
|
height: Math.min(
|
|
1178
|
-
|
|
1179
|
-
e.height *
|
|
1180
|
-
|
|
1181
|
-
|
|
1167
|
+
Ee(
|
|
1168
|
+
e.height * Wo,
|
|
1169
|
+
Fo,
|
|
1170
|
+
Ho
|
|
1182
1171
|
),
|
|
1183
|
-
e.height -
|
|
1172
|
+
e.height - mt - W
|
|
1184
1173
|
)
|
|
1185
1174
|
};
|
|
1186
1175
|
}
|
|
1187
|
-
function
|
|
1188
|
-
const
|
|
1189
|
-
if (Number.isFinite(
|
|
1190
|
-
return { x:
|
|
1176
|
+
function ni(e, t, o) {
|
|
1177
|
+
const n = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
|
|
1178
|
+
if (Number.isFinite(n) && Number.isFinite(i))
|
|
1179
|
+
return { x: n, y: i };
|
|
1191
1180
|
const a = e.getBoundingClientRect();
|
|
1192
1181
|
if (a.width > 0 || a.height > 0)
|
|
1193
1182
|
return { x: a.left, y: a.top };
|
|
1194
|
-
const l =
|
|
1183
|
+
const l = ee();
|
|
1195
1184
|
return {
|
|
1196
|
-
x: t === "bottom-left" ? 26 : l.width - 26 -
|
|
1197
|
-
y: l.height - 24 -
|
|
1185
|
+
x: t === "bottom-left" ? 26 : l.width - 26 - o.width,
|
|
1186
|
+
y: l.height - 24 - o.height
|
|
1198
1187
|
};
|
|
1199
1188
|
}
|
|
1200
|
-
function
|
|
1201
|
-
const
|
|
1202
|
-
return t ?
|
|
1189
|
+
function rt(e, t, o) {
|
|
1190
|
+
const n = je(e, !1);
|
|
1191
|
+
return t ? bt(
|
|
1203
1192
|
e,
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
) :
|
|
1193
|
+
En(t, n),
|
|
1194
|
+
n
|
|
1195
|
+
) : oi(o === "bottom-left" ? "bottom-left" : "bottom-right", n, Mo);
|
|
1207
1196
|
}
|
|
1208
|
-
function
|
|
1209
|
-
const
|
|
1197
|
+
function oi(e, t, o) {
|
|
1198
|
+
const n = ee();
|
|
1210
1199
|
return {
|
|
1211
|
-
x: e.endsWith("right") ? Math.max(0,
|
|
1212
|
-
y: e.startsWith("bottom") ? Math.max(0,
|
|
1200
|
+
x: e.endsWith("right") ? Math.max(0, n.width - t.width - o) : o,
|
|
1201
|
+
y: e.startsWith("bottom") ? Math.max(0, n.height - t.height - o) : o
|
|
1213
1202
|
};
|
|
1214
1203
|
}
|
|
1215
|
-
function
|
|
1216
|
-
const
|
|
1204
|
+
function bt(e, t, o) {
|
|
1205
|
+
const n = ee(), i = W + ri(e);
|
|
1217
1206
|
return {
|
|
1218
|
-
x:
|
|
1207
|
+
x: Ee(
|
|
1219
1208
|
t.x,
|
|
1220
1209
|
W,
|
|
1221
1210
|
Math.max(
|
|
1222
1211
|
W,
|
|
1223
|
-
|
|
1212
|
+
n.width - o.width - W
|
|
1224
1213
|
)
|
|
1225
1214
|
),
|
|
1226
|
-
y:
|
|
1215
|
+
y: Ee(
|
|
1227
1216
|
t.y,
|
|
1228
1217
|
i,
|
|
1229
1218
|
Math.max(
|
|
1230
1219
|
i,
|
|
1231
|
-
|
|
1220
|
+
n.height - o.height - W
|
|
1232
1221
|
)
|
|
1233
1222
|
)
|
|
1234
1223
|
};
|
|
1235
1224
|
}
|
|
1236
|
-
function
|
|
1237
|
-
const
|
|
1225
|
+
function En(e, t) {
|
|
1226
|
+
const o = ee();
|
|
1238
1227
|
return {
|
|
1239
|
-
x: e.anchor.endsWith("right") ?
|
|
1240
|
-
y: e.anchor.startsWith("bottom") ?
|
|
1228
|
+
x: e.anchor.endsWith("right") ? o.width - t.width - e.x : e.x,
|
|
1229
|
+
y: e.anchor.startsWith("bottom") ? o.height - t.height - e.y : e.y
|
|
1241
1230
|
};
|
|
1242
1231
|
}
|
|
1243
|
-
function
|
|
1244
|
-
const
|
|
1232
|
+
function ii(e, t) {
|
|
1233
|
+
const o = ai(e, t), n = ee();
|
|
1245
1234
|
return {
|
|
1246
|
-
anchor:
|
|
1247
|
-
x:
|
|
1248
|
-
y:
|
|
1235
|
+
anchor: o,
|
|
1236
|
+
x: o.endsWith("right") ? n.width - e.x - t.width : e.x,
|
|
1237
|
+
y: o.startsWith("bottom") ? n.height - e.y - t.height : e.y
|
|
1249
1238
|
};
|
|
1250
1239
|
}
|
|
1251
|
-
function
|
|
1252
|
-
const
|
|
1240
|
+
function ai(e, t) {
|
|
1241
|
+
const o = ee(), n = e.x + t.width / 2, a = e.y + t.height / 2 <= o.height / 2 ? "top" : "bottom", l = n <= o.width / 2 ? "left" : "right";
|
|
1253
1242
|
return `${a}-${l}`;
|
|
1254
1243
|
}
|
|
1255
|
-
function
|
|
1256
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
1244
|
+
function ri(e) {
|
|
1245
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? qo : $o;
|
|
1257
1246
|
}
|
|
1258
|
-
function
|
|
1259
|
-
const
|
|
1260
|
-
x:
|
|
1261
|
-
y: t.y +
|
|
1247
|
+
function Zt(e, t, o) {
|
|
1248
|
+
const n = je(e), i = Sn(), a = {
|
|
1249
|
+
x: o === "bottom-left" ? t.x : t.x + n.width - i.width,
|
|
1250
|
+
y: t.y + n.height - i.height
|
|
1262
1251
|
};
|
|
1263
|
-
return
|
|
1252
|
+
return li(a);
|
|
1264
1253
|
}
|
|
1265
|
-
function
|
|
1266
|
-
const t =
|
|
1254
|
+
function li(e) {
|
|
1255
|
+
const t = ee(), o = Sn();
|
|
1267
1256
|
return {
|
|
1268
|
-
x:
|
|
1257
|
+
x: Ee(
|
|
1269
1258
|
e.x,
|
|
1270
1259
|
W,
|
|
1271
1260
|
Math.max(
|
|
1272
1261
|
W,
|
|
1273
|
-
t.width -
|
|
1262
|
+
t.width - o.width - W
|
|
1274
1263
|
)
|
|
1275
1264
|
),
|
|
1276
|
-
y:
|
|
1265
|
+
y: Ee(
|
|
1277
1266
|
e.y,
|
|
1278
|
-
|
|
1267
|
+
mt,
|
|
1279
1268
|
Math.max(
|
|
1280
|
-
|
|
1281
|
-
t.height -
|
|
1269
|
+
mt,
|
|
1270
|
+
t.height - o.height - W
|
|
1282
1271
|
)
|
|
1283
1272
|
)
|
|
1284
1273
|
};
|
|
1285
1274
|
}
|
|
1286
|
-
function
|
|
1275
|
+
function fe(e, t) {
|
|
1287
1276
|
if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
|
|
1288
1277
|
e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
1289
1278
|
return;
|
|
1290
1279
|
}
|
|
1291
1280
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
1292
1281
|
}
|
|
1293
|
-
function
|
|
1282
|
+
function pi(e, t) {
|
|
1294
1283
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
1295
1284
|
}
|
|
1296
|
-
function
|
|
1285
|
+
function Jt(e) {
|
|
1297
1286
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
1298
1287
|
}
|
|
1299
|
-
function
|
|
1288
|
+
function ee() {
|
|
1300
1289
|
return {
|
|
1301
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
1302
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
1290
|
+
width: window.innerWidth || document.documentElement.clientWidth || _n + W * 2,
|
|
1291
|
+
height: window.innerHeight || document.documentElement.clientHeight || xn + W * 2
|
|
1303
1292
|
};
|
|
1304
1293
|
}
|
|
1305
|
-
function
|
|
1294
|
+
function lt(e) {
|
|
1306
1295
|
const t = e.getBoundingClientRect();
|
|
1307
1296
|
return {
|
|
1308
1297
|
x: Math.round(t.x),
|
|
@@ -1311,42 +1300,45 @@ function at(e) {
|
|
|
1311
1300
|
height: Math.round(t.height)
|
|
1312
1301
|
};
|
|
1313
1302
|
}
|
|
1314
|
-
function
|
|
1315
|
-
return Math.min(Math.max(e, t),
|
|
1303
|
+
function Ee(e, t, o) {
|
|
1304
|
+
return Math.min(Math.max(e, t), o);
|
|
1316
1305
|
}
|
|
1317
|
-
function X(e, t,
|
|
1306
|
+
function X(e, t, o) {
|
|
1318
1307
|
if (typeof window > "u")
|
|
1319
1308
|
return;
|
|
1320
|
-
const
|
|
1309
|
+
const n = window, i = {
|
|
1321
1310
|
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1322
1311
|
source: e,
|
|
1323
1312
|
message: t,
|
|
1324
|
-
details:
|
|
1325
|
-
}, a =
|
|
1326
|
-
a.push(i), a.length > 120 && a.splice(0, a.length - 120),
|
|
1327
|
-
new CustomEvent(
|
|
1313
|
+
details: o
|
|
1314
|
+
}, a = n.__plunoProductAgentDiagnostics__ ?? [];
|
|
1315
|
+
a.push(i), a.length > 120 && a.splice(0, a.length - 120), n.__plunoProductAgentDiagnostics__ = a, n.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...a], window.dispatchEvent(
|
|
1316
|
+
new CustomEvent(Io, { detail: i })
|
|
1328
1317
|
);
|
|
1329
1318
|
}
|
|
1330
|
-
function
|
|
1319
|
+
function si(e, t) {
|
|
1331
1320
|
X("web-sdk.widget.position", e, t);
|
|
1332
1321
|
}
|
|
1333
|
-
function
|
|
1334
|
-
const
|
|
1335
|
-
return !
|
|
1336
|
-
attachments:
|
|
1322
|
+
function pt(e, t, o) {
|
|
1323
|
+
const n = t.value.trim();
|
|
1324
|
+
return !n && o.length === 0 ? o : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(n, {
|
|
1325
|
+
attachments: o.length > 0 ? o.map(di) : void 0
|
|
1337
1326
|
}), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
|
|
1338
1327
|
}
|
|
1339
|
-
function
|
|
1328
|
+
function di(e) {
|
|
1329
|
+
return e;
|
|
1330
|
+
}
|
|
1331
|
+
function Te(e) {
|
|
1340
1332
|
e.style.height = "0px";
|
|
1341
1333
|
const t = Math.max(22, Math.min(e.scrollHeight, 140));
|
|
1342
1334
|
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
|
|
1343
1335
|
}
|
|
1344
|
-
function
|
|
1336
|
+
function De(e, t = () => !0) {
|
|
1345
1337
|
e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
|
|
1346
1338
|
t() && (e.scrollTop = e.scrollHeight);
|
|
1347
1339
|
});
|
|
1348
1340
|
}
|
|
1349
|
-
function
|
|
1341
|
+
function ci(e) {
|
|
1350
1342
|
const t = e.messages[e.messages.length - 1];
|
|
1351
1343
|
return [
|
|
1352
1344
|
e.messages.length,
|
|
@@ -1357,64 +1349,64 @@ function li(e) {
|
|
|
1357
1349
|
e.lastError ?? ""
|
|
1358
1350
|
].join(":");
|
|
1359
1351
|
}
|
|
1360
|
-
function
|
|
1352
|
+
function ui(e) {
|
|
1361
1353
|
return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
|
|
1362
1354
|
}
|
|
1363
|
-
function
|
|
1355
|
+
function gi(e) {
|
|
1364
1356
|
return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
|
|
1365
1357
|
}
|
|
1366
|
-
function
|
|
1358
|
+
function hi(e) {
|
|
1367
1359
|
const t = e.currentPage;
|
|
1368
1360
|
if (typeof t?.url == "string" && t.url.trim())
|
|
1369
1361
|
try {
|
|
1370
|
-
const
|
|
1371
|
-
return `${
|
|
1362
|
+
const o = new URL(t.url);
|
|
1363
|
+
return `${o.pathname || "/"}${o.search}`;
|
|
1372
1364
|
} catch {
|
|
1373
1365
|
return t.url;
|
|
1374
1366
|
}
|
|
1375
1367
|
return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
|
|
1376
1368
|
}
|
|
1377
|
-
function
|
|
1378
|
-
const
|
|
1379
|
-
if (!Number.isFinite(
|
|
1369
|
+
function mi(e, t) {
|
|
1370
|
+
const o = new Date(e).getTime();
|
|
1371
|
+
if (!Number.isFinite(o))
|
|
1380
1372
|
return "now";
|
|
1381
|
-
const
|
|
1373
|
+
const n = Math.max(0, t - o), i = [
|
|
1382
1374
|
["day", 864e5],
|
|
1383
1375
|
["hour", 36e5],
|
|
1384
1376
|
["min", 6e4]
|
|
1385
1377
|
];
|
|
1386
1378
|
for (const [a, l] of i)
|
|
1387
|
-
if (
|
|
1388
|
-
const p = Math.max(1, Math.floor(
|
|
1379
|
+
if (n >= l) {
|
|
1380
|
+
const p = Math.max(1, Math.floor(n / l));
|
|
1389
1381
|
return a === "min" ? `${p} min` : `${p} ${a}${p === 1 ? "" : "s"}`;
|
|
1390
1382
|
}
|
|
1391
1383
|
return "now";
|
|
1392
1384
|
}
|
|
1393
|
-
function
|
|
1394
|
-
e.appendChild(
|
|
1395
|
-
|
|
1385
|
+
function bi(e, t, o, n, i) {
|
|
1386
|
+
e.appendChild(Si()), e.appendChild(
|
|
1387
|
+
fi(
|
|
1396
1388
|
t,
|
|
1397
|
-
n,
|
|
1398
1389
|
o,
|
|
1390
|
+
n,
|
|
1399
1391
|
i
|
|
1400
1392
|
)
|
|
1401
1393
|
), e.appendChild(
|
|
1402
|
-
|
|
1394
|
+
Ve(
|
|
1403
1395
|
"pluno-pa-widget__close",
|
|
1404
1396
|
"Close",
|
|
1405
|
-
|
|
1397
|
+
Ei(16),
|
|
1406
1398
|
!0
|
|
1407
1399
|
)
|
|
1408
|
-
), e.appendChild(
|
|
1400
|
+
), e.appendChild(wi(o));
|
|
1409
1401
|
}
|
|
1410
|
-
function
|
|
1402
|
+
function fi(e, t, o, n) {
|
|
1411
1403
|
const i = document.createElement("form");
|
|
1412
|
-
if (i.className = "pluno-pa-widget__launcher",
|
|
1404
|
+
if (i.className = "pluno-pa-widget__launcher", n && i.classList.add("pluno-pa-widget__launcher--minimizable"), o) {
|
|
1413
1405
|
const l = document.createElement("button");
|
|
1414
1406
|
l.type = "button", l.className = "pluno-pa-widget__launcher-drag-handle", l.setAttribute("aria-label", "Move Pluno launcher"), l.title = "Move Pluno launcher", i.appendChild(l);
|
|
1415
1407
|
}
|
|
1416
1408
|
i.appendChild(
|
|
1417
|
-
|
|
1409
|
+
In(
|
|
1418
1410
|
"pluno-pa-widget__scribble-spirals--launcher",
|
|
1419
1411
|
10
|
|
1420
1412
|
)
|
|
@@ -1425,118 +1417,118 @@ function gi(e, t, n, o) {
|
|
|
1425
1417
|
)
|
|
1426
1418
|
);
|
|
1427
1419
|
const a = document.createElement("input");
|
|
1428
|
-
if (a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), i.appendChild(a),
|
|
1420
|
+
if (a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), i.appendChild(a), n) {
|
|
1429
1421
|
const l = document.createElement("button");
|
|
1430
1422
|
l.type = "button", l.className = "pluno-pa-widget__launcher-minimize", l.textContent = "-", l.setAttribute("aria-label", "Minimize Pluno on this site"), l.title = "Minimize Pluno on this site", i.appendChild(l);
|
|
1431
1423
|
}
|
|
1432
1424
|
return i;
|
|
1433
1425
|
}
|
|
1434
|
-
function
|
|
1426
|
+
function wi(e) {
|
|
1435
1427
|
const t = document.createElement("section");
|
|
1436
1428
|
t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
|
|
1437
|
-
|
|
1429
|
+
In("pluno-pa-widget__scribble-spirals--panel", 16)
|
|
1438
1430
|
);
|
|
1439
|
-
const
|
|
1440
|
-
|
|
1441
|
-
const
|
|
1442
|
-
|
|
1431
|
+
const o = document.createElement("div");
|
|
1432
|
+
o.className = "pluno-pa-widget__timeline-wrap";
|
|
1433
|
+
const n = document.createElement("main");
|
|
1434
|
+
n.className = "pluno-pa-widget__timeline", n.appendChild(vi(e));
|
|
1443
1435
|
const i = document.createElement("div");
|
|
1444
|
-
i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"),
|
|
1436
|
+
i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), n.appendChild(i), o.appendChild(n);
|
|
1445
1437
|
const a = document.createElement("div");
|
|
1446
|
-
a.className = "pluno-pa-widget__active-users-counter", a.hidden = !0,
|
|
1438
|
+
a.className = "pluno-pa-widget__active-users-counter", a.hidden = !0, o.appendChild(a);
|
|
1447
1439
|
const l = document.createElement("button");
|
|
1448
|
-
l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0,
|
|
1440
|
+
l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, o.appendChild(l);
|
|
1449
1441
|
const p = document.createElement("div");
|
|
1450
1442
|
return p.className = "pluno-pa-widget__top-actions", p.appendChild(
|
|
1451
|
-
|
|
1443
|
+
Ve(
|
|
1452
1444
|
"pluno-pa-widget__history",
|
|
1453
1445
|
"Recent chats",
|
|
1454
|
-
|
|
1446
|
+
Li(),
|
|
1455
1447
|
!0
|
|
1456
1448
|
)
|
|
1457
|
-
),
|
|
1449
|
+
), o.appendChild(p), o.appendChild(xi()), t.appendChild(o), t.appendChild(_i()), t;
|
|
1458
1450
|
}
|
|
1459
|
-
function
|
|
1451
|
+
function _i() {
|
|
1460
1452
|
const e = document.createElement("form");
|
|
1461
1453
|
e.className = "pluno-pa-widget__composer";
|
|
1462
1454
|
const t = document.createElement("div");
|
|
1463
1455
|
t.className = "pluno-pa-widget__billing-status", t.hidden = !0, e.appendChild(t);
|
|
1464
|
-
const n = document.createElement("div");
|
|
1465
|
-
n.className = "pluno-pa-widget__attachment-error", n.hidden = !0, e.appendChild(n);
|
|
1466
1456
|
const o = document.createElement("div");
|
|
1467
|
-
o.className = "pluno-pa-
|
|
1457
|
+
o.className = "pluno-pa-widget__attachment-error", o.hidden = !0, e.appendChild(o);
|
|
1458
|
+
const n = document.createElement("div");
|
|
1459
|
+
n.className = "pluno-pa-widget__attachments", n.hidden = !0, e.appendChild(n);
|
|
1468
1460
|
const i = document.createElement("div");
|
|
1469
1461
|
i.className = "pluno-pa-widget__composer-inner";
|
|
1470
1462
|
const a = document.createElement("input");
|
|
1471
|
-
a.className = "pluno-pa-widget__attachment-input", a.type = "file", a.
|
|
1463
|
+
a.className = "pluno-pa-widget__attachment-input", a.type = "file", a.multiple = !0, a.tabIndex = -1, a.setAttribute("aria-hidden", "true"), i.appendChild(a);
|
|
1472
1464
|
const l = document.createElement("button");
|
|
1473
|
-
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(
|
|
1465
|
+
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Ii()), l.appendChild(Ai()), i.appendChild(l);
|
|
1474
1466
|
const p = document.createElement("textarea");
|
|
1475
1467
|
p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", i.appendChild(p);
|
|
1476
1468
|
const c = document.createElement("button");
|
|
1477
|
-
c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(
|
|
1469
|
+
c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(An()), i.appendChild(c), e.appendChild(i);
|
|
1478
1470
|
const u = document.createElement("div");
|
|
1479
1471
|
u.className = "pluno-pa-widget__composer-meta";
|
|
1480
1472
|
const d = document.createElement("a");
|
|
1481
1473
|
d.className = "pluno-pa-widget__powered-by", d.href = "https://pluno.ai", d.target = "_blank", d.rel = "noopener noreferrer", d.textContent = "Powered by Pluno.ai.", u.appendChild(d);
|
|
1482
|
-
const
|
|
1483
|
-
return
|
|
1474
|
+
const g = document.createElement("span");
|
|
1475
|
+
return g.className = "pluno-pa-widget__ai-disclaimer", g.textContent = "AI can make mistakes. Verify outputs.", u.appendChild(g), e.appendChild(u), e;
|
|
1484
1476
|
}
|
|
1485
|
-
function
|
|
1477
|
+
function xi() {
|
|
1486
1478
|
const e = document.createElement("section");
|
|
1487
1479
|
e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", "Recent chats");
|
|
1488
1480
|
const t = document.createElement("div");
|
|
1489
1481
|
t.className = "pluno-pa-widget__history-header";
|
|
1490
|
-
const
|
|
1491
|
-
|
|
1492
|
-
const
|
|
1482
|
+
const o = document.createElement("strong");
|
|
1483
|
+
o.textContent = "Recent chats";
|
|
1484
|
+
const n = Ve(
|
|
1493
1485
|
"pluno-pa-widget__history-close",
|
|
1494
1486
|
"Close recent chats",
|
|
1495
|
-
|
|
1487
|
+
Pi(),
|
|
1496
1488
|
!1
|
|
1497
1489
|
);
|
|
1498
|
-
t.append(
|
|
1490
|
+
t.append(o, n);
|
|
1499
1491
|
const i = document.createElement("div");
|
|
1500
1492
|
i.className = "pluno-pa-widget__history-list";
|
|
1501
1493
|
const a = document.createElement("p");
|
|
1502
1494
|
return a.className = "pluno-pa-widget__history-status", a.hidden = !0, e.append(t, i, a), e;
|
|
1503
1495
|
}
|
|
1504
|
-
function
|
|
1496
|
+
function vi(e) {
|
|
1505
1497
|
const t = document.createElement("div");
|
|
1506
1498
|
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
1507
1499
|
se(
|
|
1508
1500
|
"pluno-pa-widget__character--empty",
|
|
1509
1501
|
e
|
|
1510
1502
|
)
|
|
1511
|
-
), t.appendChild(
|
|
1503
|
+
), t.appendChild(kn()), t;
|
|
1512
1504
|
}
|
|
1513
|
-
function
|
|
1505
|
+
function kn() {
|
|
1514
1506
|
const e = document.createElement("div");
|
|
1515
1507
|
return e.className = "pluno-pa-widget__empty", e.appendChild(document.createTextNode("Hey there, I'm Pluno 👋")), e.appendChild(document.createElement("br")), e.appendChild(document.createTextNode("What do you want to do today?")), e;
|
|
1516
1508
|
}
|
|
1517
|
-
function
|
|
1509
|
+
function Ln(e, t) {
|
|
1518
1510
|
e.replaceChildren(), e.setAttribute(
|
|
1519
1511
|
"aria-label",
|
|
1520
1512
|
`${t.toLocaleString("en-US")} users currently active`
|
|
1521
1513
|
);
|
|
1522
|
-
const
|
|
1523
|
-
|
|
1514
|
+
const o = document.createElement("span");
|
|
1515
|
+
o.className = "pluno-pa-widget__active-users-counter-dot", o.setAttribute("aria-hidden", "true"), e.appendChild(o), e.appendChild(
|
|
1524
1516
|
document.createTextNode(
|
|
1525
1517
|
`${t.toLocaleString("en-US")} users currently active`
|
|
1526
1518
|
)
|
|
1527
1519
|
);
|
|
1528
1520
|
}
|
|
1529
1521
|
function se(e, t) {
|
|
1530
|
-
const
|
|
1531
|
-
|
|
1532
|
-
const
|
|
1533
|
-
return
|
|
1522
|
+
const o = `pluno-pa-character-${Kt}`;
|
|
1523
|
+
Kt += 1;
|
|
1524
|
+
const n = t.scribbleStyle ? Ci(t.accentColor, o) : yi(t.accentColor, o), i = e.split(/\s+/).filter(Boolean);
|
|
1525
|
+
return n.setAttribute(
|
|
1534
1526
|
"class",
|
|
1535
1527
|
i.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
|
|
1536
|
-
),
|
|
1528
|
+
), n.setAttribute("aria-hidden", "true"), n.setAttribute("focusable", "false"), n.removeAttribute("role"), n.removeAttribute("aria-label"), n;
|
|
1537
1529
|
}
|
|
1538
|
-
function
|
|
1539
|
-
const
|
|
1530
|
+
function yi(e, t) {
|
|
1531
|
+
const o = to(e), n = {
|
|
1540
1532
|
boltFill: `${t}-boltFill`,
|
|
1541
1533
|
boltEdge: `${t}-boltEdge`,
|
|
1542
1534
|
boltGlow: `${t}-boltGlow`,
|
|
@@ -1547,171 +1539,171 @@ function _i(e, t) {
|
|
|
1547
1539
|
eyeShadow: `${t}-eyeShadow`,
|
|
1548
1540
|
pupilGloss: `${t}-pupilGloss`,
|
|
1549
1541
|
boltClip: `${t}-boltClip`
|
|
1550
|
-
}, i =
|
|
1551
|
-
id:
|
|
1542
|
+
}, i = Pn(), a = m(i, "defs"), l = m(a, "linearGradient", {
|
|
1543
|
+
id: n.boltFill,
|
|
1552
1544
|
x1: "420",
|
|
1553
1545
|
y1: "180",
|
|
1554
1546
|
x2: "790",
|
|
1555
1547
|
y2: "1040",
|
|
1556
1548
|
gradientUnits: "userSpaceOnUse"
|
|
1557
1549
|
});
|
|
1558
|
-
|
|
1550
|
+
R(l, "0", o.top), R(l, "0.36", o.middle), R(l, "0.72", o.bottom), R(l, "1", o.bottom);
|
|
1559
1551
|
const p = m(a, "linearGradient", {
|
|
1560
|
-
id:
|
|
1552
|
+
id: n.boltEdge,
|
|
1561
1553
|
x1: "470",
|
|
1562
1554
|
y1: "145",
|
|
1563
1555
|
x2: "900",
|
|
1564
1556
|
y2: "980",
|
|
1565
1557
|
gradientUnits: "userSpaceOnUse"
|
|
1566
1558
|
});
|
|
1567
|
-
|
|
1559
|
+
R(p, "0", o.edgeStart), R(p, "0.32", o.edgeMiddle), R(p, "0.78", o.edgeEnd), R(p, "1", o.edgeEnd);
|
|
1568
1560
|
const c = m(a, "radialGradient", {
|
|
1569
|
-
id:
|
|
1561
|
+
id: n.boltGlow,
|
|
1570
1562
|
cx: "50%",
|
|
1571
1563
|
cy: "22%",
|
|
1572
1564
|
r: "82%"
|
|
1573
1565
|
});
|
|
1574
|
-
|
|
1566
|
+
R(c, "0", o.glow, "0.72"), R(c, "0.5", o.middle, "0.44"), R(c, "1", o.bottom, "0");
|
|
1575
1567
|
const u = m(a, "radialGradient", {
|
|
1576
|
-
id:
|
|
1568
|
+
id: n.eyeWhite,
|
|
1577
1569
|
cx: "35%",
|
|
1578
1570
|
cy: "25%",
|
|
1579
1571
|
r: "70%"
|
|
1580
1572
|
});
|
|
1581
|
-
|
|
1573
|
+
R(u, "0", "#ffffff"), R(u, "0.72", "#ffffff"), R(u, "1", "#e5e5e5");
|
|
1582
1574
|
const d = m(a, "radialGradient", {
|
|
1583
|
-
id:
|
|
1575
|
+
id: n.pupil,
|
|
1584
1576
|
cx: "42%",
|
|
1585
1577
|
cy: "38%",
|
|
1586
1578
|
r: "65%"
|
|
1587
1579
|
});
|
|
1588
|
-
|
|
1589
|
-
const
|
|
1590
|
-
id:
|
|
1580
|
+
R(d, "0", "#2a1f10"), R(d, "0.52", "#080604"), R(d, "1", "#000000");
|
|
1581
|
+
const g = m(a, "filter", {
|
|
1582
|
+
id: n.softDropShadow,
|
|
1591
1583
|
x: "-18%",
|
|
1592
1584
|
y: "-12%",
|
|
1593
1585
|
width: "136%",
|
|
1594
1586
|
height: "136%",
|
|
1595
1587
|
"color-interpolation-filters": "sRGB"
|
|
1596
1588
|
});
|
|
1597
|
-
m(
|
|
1589
|
+
m(g, "feDropShadow", {
|
|
1598
1590
|
dx: "0",
|
|
1599
1591
|
dy: "12",
|
|
1600
1592
|
stdDeviation: "18",
|
|
1601
|
-
"flood-color":
|
|
1593
|
+
"flood-color": o.shadow,
|
|
1602
1594
|
"flood-opacity": "0.24"
|
|
1603
1595
|
});
|
|
1604
|
-
const
|
|
1605
|
-
id:
|
|
1596
|
+
const S = m(a, "filter", {
|
|
1597
|
+
id: n.innerDepth,
|
|
1606
1598
|
x: "-8%",
|
|
1607
1599
|
y: "-8%",
|
|
1608
1600
|
width: "116%",
|
|
1609
1601
|
height: "116%",
|
|
1610
1602
|
"color-interpolation-filters": "sRGB"
|
|
1611
1603
|
});
|
|
1612
|
-
m(
|
|
1604
|
+
m(S, "feGaussianBlur", {
|
|
1613
1605
|
in: "SourceAlpha",
|
|
1614
1606
|
stdDeviation: "8",
|
|
1615
1607
|
result: "blur"
|
|
1616
|
-
}), m(
|
|
1608
|
+
}), m(S, "feOffset", {
|
|
1617
1609
|
dx: "-7",
|
|
1618
1610
|
dy: "-9",
|
|
1619
1611
|
result: "topLeft"
|
|
1620
|
-
}), m(
|
|
1612
|
+
}), m(S, "feComposite", {
|
|
1621
1613
|
in: "topLeft",
|
|
1622
1614
|
in2: "SourceAlpha",
|
|
1623
1615
|
operator: "arithmetic",
|
|
1624
1616
|
k2: "-1",
|
|
1625
1617
|
k3: "1",
|
|
1626
1618
|
result: "innerShadow"
|
|
1627
|
-
}), m(
|
|
1619
|
+
}), m(S, "feColorMatrix", {
|
|
1628
1620
|
in: "innerShadow",
|
|
1629
1621
|
type: "matrix",
|
|
1630
1622
|
values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
|
|
1631
1623
|
result: "innerLight"
|
|
1632
|
-
}), m(
|
|
1624
|
+
}), m(S, "feBlend", {
|
|
1633
1625
|
in: "SourceGraphic",
|
|
1634
1626
|
in2: "innerLight",
|
|
1635
1627
|
mode: "screen"
|
|
1636
1628
|
});
|
|
1637
|
-
const
|
|
1638
|
-
id:
|
|
1629
|
+
const f = m(a, "filter", {
|
|
1630
|
+
id: n.eyeShadow,
|
|
1639
1631
|
x: "-24%",
|
|
1640
1632
|
y: "-20%",
|
|
1641
1633
|
width: "148%",
|
|
1642
1634
|
height: "148%",
|
|
1643
1635
|
"color-interpolation-filters": "sRGB"
|
|
1644
1636
|
});
|
|
1645
|
-
m(
|
|
1637
|
+
m(f, "feDropShadow", {
|
|
1646
1638
|
dx: "0",
|
|
1647
1639
|
dy: "8",
|
|
1648
1640
|
stdDeviation: "5",
|
|
1649
|
-
"flood-color":
|
|
1641
|
+
"flood-color": o.shadow,
|
|
1650
1642
|
"flood-opacity": "0.3"
|
|
1651
1643
|
});
|
|
1652
|
-
const
|
|
1653
|
-
id:
|
|
1644
|
+
const F = m(a, "filter", {
|
|
1645
|
+
id: n.pupilGloss,
|
|
1654
1646
|
x: "-15%",
|
|
1655
1647
|
y: "-15%",
|
|
1656
1648
|
width: "130%",
|
|
1657
1649
|
height: "130%",
|
|
1658
1650
|
"color-interpolation-filters": "sRGB"
|
|
1659
1651
|
});
|
|
1660
|
-
m(
|
|
1652
|
+
m(F, "feDropShadow", {
|
|
1661
1653
|
dx: "0",
|
|
1662
1654
|
dy: "3",
|
|
1663
1655
|
stdDeviation: "3",
|
|
1664
1656
|
"flood-color": "#000000",
|
|
1665
1657
|
"flood-opacity": "0.22"
|
|
1666
1658
|
});
|
|
1667
|
-
const
|
|
1668
|
-
m(
|
|
1669
|
-
const
|
|
1670
|
-
filter: q(
|
|
1659
|
+
const k = m(a, "clipPath", { id: n.boltClip });
|
|
1660
|
+
m(k, "path", { d: $e });
|
|
1661
|
+
const x = m(i, "g", {
|
|
1662
|
+
filter: q(n.softDropShadow)
|
|
1671
1663
|
});
|
|
1672
|
-
m(
|
|
1673
|
-
d:
|
|
1674
|
-
fill: q(
|
|
1664
|
+
m(x, "path", {
|
|
1665
|
+
d: $e,
|
|
1666
|
+
fill: q(n.boltEdge)
|
|
1675
1667
|
});
|
|
1676
|
-
const
|
|
1677
|
-
m(
|
|
1678
|
-
d:
|
|
1679
|
-
fill: q(
|
|
1680
|
-
filter: q(
|
|
1681
|
-
}), m(
|
|
1682
|
-
d:
|
|
1683
|
-
fill: q(
|
|
1668
|
+
const v = "M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z";
|
|
1669
|
+
m(x, "path", {
|
|
1670
|
+
d: v,
|
|
1671
|
+
fill: q(n.boltFill),
|
|
1672
|
+
filter: q(n.innerDepth)
|
|
1673
|
+
}), m(x, "path", {
|
|
1674
|
+
d: v,
|
|
1675
|
+
fill: q(n.boltGlow),
|
|
1684
1676
|
opacity: "0.74"
|
|
1685
1677
|
});
|
|
1686
|
-
const
|
|
1687
|
-
"clip-path": q(
|
|
1678
|
+
const h = m(x, "g", {
|
|
1679
|
+
"clip-path": q(n.boltClip),
|
|
1688
1680
|
opacity: "0.42"
|
|
1689
1681
|
});
|
|
1690
|
-
m(
|
|
1682
|
+
m(h, "path", {
|
|
1691
1683
|
d: "M523 181 C505 189 496 206 489 232 L400 594 C397 606 400 619 411 626",
|
|
1692
1684
|
fill: "none",
|
|
1693
|
-
stroke:
|
|
1685
|
+
stroke: o.highlight,
|
|
1694
1686
|
"stroke-width": "22",
|
|
1695
1687
|
"stroke-linecap": "round",
|
|
1696
1688
|
opacity: "0.65"
|
|
1697
|
-
}), m(
|
|
1689
|
+
}), m(h, "path", {
|
|
1698
1690
|
d: "M556 685 L501 994",
|
|
1699
1691
|
fill: "none",
|
|
1700
|
-
stroke:
|
|
1692
|
+
stroke: o.highlight,
|
|
1701
1693
|
"stroke-width": "20",
|
|
1702
1694
|
"stroke-linecap": "round",
|
|
1703
1695
|
opacity: "0.55"
|
|
1704
|
-
}), m(
|
|
1696
|
+
}), m(h, "path", {
|
|
1705
1697
|
d: "M858 160 C882 166 893 181 883 204",
|
|
1706
1698
|
fill: "none",
|
|
1707
|
-
stroke:
|
|
1699
|
+
stroke: o.inner,
|
|
1708
1700
|
"stroke-width": "18",
|
|
1709
1701
|
"stroke-linecap": "round",
|
|
1710
1702
|
opacity: "0.48"
|
|
1711
1703
|
});
|
|
1712
|
-
const
|
|
1713
|
-
return
|
|
1714
|
-
|
|
1704
|
+
const I = m(i, "g", { filter: q(n.eyeShadow) });
|
|
1705
|
+
return Qt(
|
|
1706
|
+
I,
|
|
1715
1707
|
"rotate(-2 528 463)",
|
|
1716
1708
|
"528",
|
|
1717
1709
|
"463",
|
|
@@ -1719,9 +1711,9 @@ function _i(e, t) {
|
|
|
1719
1711
|
"473",
|
|
1720
1712
|
"557",
|
|
1721
1713
|
"447",
|
|
1722
|
-
|
|
1723
|
-
),
|
|
1724
|
-
|
|
1714
|
+
n
|
|
1715
|
+
), Qt(
|
|
1716
|
+
I,
|
|
1725
1717
|
"rotate(2 717 462)",
|
|
1726
1718
|
"717",
|
|
1727
1719
|
"462",
|
|
@@ -1729,17 +1721,17 @@ function _i(e, t) {
|
|
|
1729
1721
|
"473",
|
|
1730
1722
|
"728",
|
|
1731
1723
|
"447",
|
|
1732
|
-
|
|
1724
|
+
n
|
|
1733
1725
|
), i;
|
|
1734
1726
|
}
|
|
1735
|
-
function
|
|
1736
|
-
const
|
|
1727
|
+
function Ci(e, t) {
|
|
1728
|
+
const o = hn(e), n = {
|
|
1737
1729
|
clip: `${t}-scribbleBoltClip`,
|
|
1738
1730
|
wobble: `${t}-scribbleBoltWobble`
|
|
1739
|
-
}, i =
|
|
1740
|
-
m(l, "path", { d:
|
|
1731
|
+
}, i = Pn(), a = m(i, "defs"), l = m(a, "clipPath", { id: n.clip });
|
|
1732
|
+
m(l, "path", { d: $e });
|
|
1741
1733
|
const p = m(a, "filter", {
|
|
1742
|
-
id:
|
|
1734
|
+
id: n.wobble,
|
|
1743
1735
|
x: "-10%",
|
|
1744
1736
|
y: "-10%",
|
|
1745
1737
|
width: "120%",
|
|
@@ -1759,25 +1751,25 @@ function xi(e, t) {
|
|
|
1759
1751
|
xChannelSelector: "R",
|
|
1760
1752
|
yChannelSelector: "G"
|
|
1761
1753
|
});
|
|
1762
|
-
const c = m(i, "g", { filter: q(
|
|
1763
|
-
"clip-path": q(
|
|
1754
|
+
const c = m(i, "g", { filter: q(n.wobble) }), u = m(c, "g", {
|
|
1755
|
+
"clip-path": q(n.clip)
|
|
1764
1756
|
});
|
|
1765
1757
|
return m(u, "path", {
|
|
1766
|
-
d:
|
|
1758
|
+
d: eo(),
|
|
1767
1759
|
fill: "none",
|
|
1768
|
-
stroke:
|
|
1760
|
+
stroke: o,
|
|
1769
1761
|
"stroke-width": "56",
|
|
1770
1762
|
"stroke-linecap": "round",
|
|
1771
1763
|
"stroke-linejoin": "round",
|
|
1772
1764
|
opacity: "0.9",
|
|
1773
1765
|
transform: "rotate(-14 627 600)"
|
|
1774
1766
|
}), m(c, "path", {
|
|
1775
|
-
d:
|
|
1767
|
+
d: $e,
|
|
1776
1768
|
fill: "none",
|
|
1777
|
-
stroke:
|
|
1769
|
+
stroke: qe,
|
|
1778
1770
|
"stroke-width": "18",
|
|
1779
1771
|
"stroke-linejoin": "round"
|
|
1780
|
-
}),
|
|
1772
|
+
}), en(
|
|
1781
1773
|
c,
|
|
1782
1774
|
"rotate(-2 528 463)",
|
|
1783
1775
|
"528",
|
|
@@ -1786,7 +1778,7 @@ function xi(e, t) {
|
|
|
1786
1778
|
"473",
|
|
1787
1779
|
"557",
|
|
1788
1780
|
"447"
|
|
1789
|
-
),
|
|
1781
|
+
), en(
|
|
1790
1782
|
c,
|
|
1791
1783
|
"rotate(2 717 462)",
|
|
1792
1784
|
"717",
|
|
@@ -1797,17 +1789,17 @@ function xi(e, t) {
|
|
|
1797
1789
|
"447"
|
|
1798
1790
|
), i;
|
|
1799
1791
|
}
|
|
1800
|
-
function
|
|
1801
|
-
return
|
|
1802
|
-
xmlns:
|
|
1792
|
+
function Pn() {
|
|
1793
|
+
return C("svg", {
|
|
1794
|
+
xmlns: vn,
|
|
1803
1795
|
viewBox: "0 0 1254 1254"
|
|
1804
1796
|
});
|
|
1805
1797
|
}
|
|
1806
|
-
function
|
|
1798
|
+
function Qt(e, t, o, n, i, a, l, p, c) {
|
|
1807
1799
|
const u = m(e, "g", { transform: t });
|
|
1808
1800
|
m(u, "ellipse", {
|
|
1809
|
-
cx:
|
|
1810
|
-
cy:
|
|
1801
|
+
cx: o,
|
|
1802
|
+
cy: n,
|
|
1811
1803
|
rx: "73",
|
|
1812
1804
|
ry: "80",
|
|
1813
1805
|
fill: q(c.eyeWhite)
|
|
@@ -1825,22 +1817,22 @@ function Kt(e, t, n, o, i, a, l, p, c) {
|
|
|
1825
1817
|
fill: "#ffffff"
|
|
1826
1818
|
});
|
|
1827
1819
|
}
|
|
1828
|
-
function
|
|
1820
|
+
function en(e, t, o, n, i, a, l, p) {
|
|
1829
1821
|
const c = m(e, "g", { transform: t });
|
|
1830
1822
|
m(c, "ellipse", {
|
|
1831
|
-
cx:
|
|
1832
|
-
cy:
|
|
1823
|
+
cx: o,
|
|
1824
|
+
cy: n,
|
|
1833
1825
|
rx: "73",
|
|
1834
1826
|
ry: "80",
|
|
1835
1827
|
fill: "#ffffff",
|
|
1836
|
-
stroke:
|
|
1828
|
+
stroke: qe,
|
|
1837
1829
|
"stroke-width": "13"
|
|
1838
1830
|
}), m(c, "ellipse", {
|
|
1839
1831
|
cx: i,
|
|
1840
1832
|
cy: a,
|
|
1841
1833
|
rx: "45",
|
|
1842
1834
|
ry: "53",
|
|
1843
|
-
fill:
|
|
1835
|
+
fill: qe
|
|
1844
1836
|
}), m(c, "circle", {
|
|
1845
1837
|
cx: l,
|
|
1846
1838
|
cy: p,
|
|
@@ -1848,49 +1840,49 @@ function Xt(e, t, n, o, i, a, l, p) {
|
|
|
1848
1840
|
fill: "#ffffff"
|
|
1849
1841
|
});
|
|
1850
1842
|
}
|
|
1851
|
-
function m(e, t,
|
|
1852
|
-
const
|
|
1853
|
-
return e.appendChild(
|
|
1843
|
+
function m(e, t, o = {}) {
|
|
1844
|
+
const n = C(t, o);
|
|
1845
|
+
return e.appendChild(n), n;
|
|
1854
1846
|
}
|
|
1855
|
-
function
|
|
1856
|
-
const i = { offset: t, "stop-color":
|
|
1857
|
-
|
|
1847
|
+
function R(e, t, o, n) {
|
|
1848
|
+
const i = { offset: t, "stop-color": o };
|
|
1849
|
+
n !== void 0 && (i["stop-opacity"] = n), m(e, "stop", i);
|
|
1858
1850
|
}
|
|
1859
1851
|
function q(e) {
|
|
1860
1852
|
return `url(#${e})`;
|
|
1861
1853
|
}
|
|
1862
|
-
function
|
|
1854
|
+
function Ve(e, t, o, n) {
|
|
1863
1855
|
const i = document.createElement("button");
|
|
1864
|
-
return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden =
|
|
1856
|
+
return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = n, i.appendChild(o), i;
|
|
1865
1857
|
}
|
|
1866
|
-
function
|
|
1867
|
-
const e =
|
|
1858
|
+
function Si() {
|
|
1859
|
+
const e = C("svg", {
|
|
1868
1860
|
class: "pluno-pa-widget__scribble-defs",
|
|
1869
1861
|
"aria-hidden": "true",
|
|
1870
1862
|
focusable: "false",
|
|
1871
1863
|
width: "0",
|
|
1872
1864
|
height: "0"
|
|
1873
|
-
}), t =
|
|
1874
|
-
return t.appendChild(
|
|
1875
|
-
|
|
1865
|
+
}), t = C("defs");
|
|
1866
|
+
return t.appendChild(st("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
|
|
1867
|
+
st("pluno-pa-scribble-wobble-2", "5", "15")
|
|
1876
1868
|
), t.appendChild(
|
|
1877
|
-
|
|
1869
|
+
st("pluno-pa-scribble-wobble-3", "9", "19")
|
|
1878
1870
|
), e.appendChild(t), e;
|
|
1879
1871
|
}
|
|
1880
|
-
function
|
|
1881
|
-
const
|
|
1872
|
+
function In(e, t) {
|
|
1873
|
+
const o = t * $t + qt * 2, n = C("svg", {
|
|
1882
1874
|
class: `pluno-pa-widget__scribble-spirals ${e}`,
|
|
1883
|
-
viewBox: `0 0 ${
|
|
1875
|
+
viewBox: `0 0 ${o} ${Go}`,
|
|
1884
1876
|
preserveAspectRatio: "xMidYMid meet",
|
|
1885
1877
|
"aria-hidden": "true",
|
|
1886
1878
|
focusable: "false"
|
|
1887
1879
|
});
|
|
1888
1880
|
for (let i = 0; i < t; i += 1) {
|
|
1889
|
-
const a =
|
|
1890
|
-
transform: `translate(${
|
|
1881
|
+
const a = jt[i % jt.length], l = C("g", {
|
|
1882
|
+
transform: `translate(${qt + i * $t} 0)`
|
|
1891
1883
|
});
|
|
1892
1884
|
l.appendChild(
|
|
1893
|
-
|
|
1885
|
+
C("ellipse", {
|
|
1894
1886
|
cx: a.ellipseCx,
|
|
1895
1887
|
cy: a.ellipseCy,
|
|
1896
1888
|
rx: a.ellipseRx,
|
|
@@ -1901,35 +1893,35 @@ function Sn(e, t) {
|
|
|
1901
1893
|
opacity: "0.8"
|
|
1902
1894
|
})
|
|
1903
1895
|
), l.appendChild(
|
|
1904
|
-
|
|
1896
|
+
C("path", {
|
|
1905
1897
|
d: a.path,
|
|
1906
1898
|
fill: "none",
|
|
1907
1899
|
stroke: "#2c2a1e",
|
|
1908
1900
|
"stroke-width": a.pathStrokeWidth,
|
|
1909
1901
|
"stroke-linecap": "round"
|
|
1910
1902
|
})
|
|
1911
|
-
),
|
|
1903
|
+
), n.appendChild(l);
|
|
1912
1904
|
}
|
|
1913
|
-
return
|
|
1905
|
+
return n;
|
|
1914
1906
|
}
|
|
1915
|
-
function
|
|
1916
|
-
const
|
|
1907
|
+
function st(e, t, o) {
|
|
1908
|
+
const n = C("filter", {
|
|
1917
1909
|
id: e,
|
|
1918
1910
|
x: "-8%",
|
|
1919
1911
|
y: "-8%",
|
|
1920
1912
|
width: "116%",
|
|
1921
1913
|
height: "116%"
|
|
1922
1914
|
});
|
|
1923
|
-
return
|
|
1924
|
-
|
|
1915
|
+
return n.appendChild(
|
|
1916
|
+
C("feTurbulence", {
|
|
1925
1917
|
type: "fractalNoise",
|
|
1926
1918
|
baseFrequency: "0.012 0.028",
|
|
1927
1919
|
numOctaves: "3",
|
|
1928
1920
|
seed: t,
|
|
1929
1921
|
result: "stroke-noise"
|
|
1930
1922
|
})
|
|
1931
|
-
),
|
|
1932
|
-
|
|
1923
|
+
), n.appendChild(
|
|
1924
|
+
C("feDisplacementMap", {
|
|
1933
1925
|
in: "SourceGraphic",
|
|
1934
1926
|
in2: "stroke-noise",
|
|
1935
1927
|
scale: "3.5",
|
|
@@ -1937,26 +1929,26 @@ function lt(e, t, n) {
|
|
|
1937
1929
|
yChannelSelector: "G",
|
|
1938
1930
|
result: "warped"
|
|
1939
1931
|
})
|
|
1940
|
-
),
|
|
1941
|
-
|
|
1932
|
+
), n.appendChild(
|
|
1933
|
+
C("feTurbulence", {
|
|
1942
1934
|
type: "fractalNoise",
|
|
1943
1935
|
baseFrequency: "0.7",
|
|
1944
1936
|
numOctaves: "1",
|
|
1945
|
-
seed:
|
|
1937
|
+
seed: o,
|
|
1946
1938
|
result: "ink-noise"
|
|
1947
1939
|
})
|
|
1948
|
-
),
|
|
1949
|
-
|
|
1940
|
+
), n.appendChild(
|
|
1941
|
+
C("feDisplacementMap", {
|
|
1950
1942
|
in: "warped",
|
|
1951
1943
|
in2: "ink-noise",
|
|
1952
1944
|
scale: "0.9",
|
|
1953
1945
|
xChannelSelector: "R",
|
|
1954
1946
|
yChannelSelector: "G"
|
|
1955
1947
|
})
|
|
1956
|
-
),
|
|
1948
|
+
), n;
|
|
1957
1949
|
}
|
|
1958
|
-
function
|
|
1959
|
-
const t =
|
|
1950
|
+
function Ei(e) {
|
|
1951
|
+
const t = te(
|
|
1960
1952
|
"0 0 24 24",
|
|
1961
1953
|
e,
|
|
1962
1954
|
e,
|
|
@@ -1964,10 +1956,10 @@ function vi(e) {
|
|
|
1964
1956
|
"currentColor",
|
|
1965
1957
|
"2.25"
|
|
1966
1958
|
);
|
|
1967
|
-
return t.appendChild(
|
|
1959
|
+
return t.appendChild(C("path", { d: "m6 9 6 6 6-6" })), t;
|
|
1968
1960
|
}
|
|
1969
|
-
function
|
|
1970
|
-
const e =
|
|
1961
|
+
function ki() {
|
|
1962
|
+
const e = te(
|
|
1971
1963
|
"0 0 24 24",
|
|
1972
1964
|
17,
|
|
1973
1965
|
17,
|
|
@@ -1976,17 +1968,17 @@ function Ci() {
|
|
|
1976
1968
|
"2.25"
|
|
1977
1969
|
);
|
|
1978
1970
|
return e.appendChild(
|
|
1979
|
-
|
|
1971
|
+
C("path", {
|
|
1980
1972
|
d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
|
|
1981
1973
|
})
|
|
1982
1974
|
), e.appendChild(
|
|
1983
|
-
|
|
1975
|
+
C("path", {
|
|
1984
1976
|
d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z"
|
|
1985
1977
|
})
|
|
1986
1978
|
), e;
|
|
1987
1979
|
}
|
|
1988
|
-
function
|
|
1989
|
-
const e =
|
|
1980
|
+
function Li() {
|
|
1981
|
+
const e = te(
|
|
1990
1982
|
"0 0 24 24",
|
|
1991
1983
|
17,
|
|
1992
1984
|
17,
|
|
@@ -1994,10 +1986,10 @@ function Ei() {
|
|
|
1994
1986
|
"currentColor",
|
|
1995
1987
|
"2.25"
|
|
1996
1988
|
);
|
|
1997
|
-
return e.appendChild(
|
|
1989
|
+
return e.appendChild(C("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(C("path", { d: "M3 4v5h5" })), e.appendChild(C("path", { d: "M12 7v5l3 2" })), e;
|
|
1998
1990
|
}
|
|
1999
|
-
function
|
|
2000
|
-
const e =
|
|
1991
|
+
function Pi() {
|
|
1992
|
+
const e = te(
|
|
2001
1993
|
"0 0 24 24",
|
|
2002
1994
|
15,
|
|
2003
1995
|
15,
|
|
@@ -2005,10 +1997,10 @@ function Si() {
|
|
|
2005
1997
|
"currentColor",
|
|
2006
1998
|
"2.4"
|
|
2007
1999
|
);
|
|
2008
|
-
return e.appendChild(
|
|
2000
|
+
return e.appendChild(C("path", { d: "M18 6 6 18" })), e.appendChild(C("path", { d: "m6 6 12 12" })), e;
|
|
2009
2001
|
}
|
|
2010
|
-
function
|
|
2011
|
-
const e =
|
|
2002
|
+
function An() {
|
|
2003
|
+
const e = te(
|
|
2012
2004
|
"0 0 24 24",
|
|
2013
2005
|
14,
|
|
2014
2006
|
14,
|
|
@@ -2017,11 +2009,11 @@ function kn() {
|
|
|
2017
2009
|
"2.75"
|
|
2018
2010
|
);
|
|
2019
2011
|
return e.appendChild(
|
|
2020
|
-
|
|
2021
|
-
), e.appendChild(
|
|
2012
|
+
C("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
|
|
2013
|
+
), e.appendChild(C("polyline", { points: "5 12 12 5 19 12" })), e;
|
|
2022
2014
|
}
|
|
2023
|
-
function
|
|
2024
|
-
const e =
|
|
2015
|
+
function Ii() {
|
|
2016
|
+
const e = te(
|
|
2025
2017
|
"0 0 24 24",
|
|
2026
2018
|
16,
|
|
2027
2019
|
16,
|
|
@@ -2033,18 +2025,18 @@ function ki() {
|
|
|
2033
2025
|
"class",
|
|
2034
2026
|
"pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"
|
|
2035
2027
|
), e.appendChild(
|
|
2036
|
-
|
|
2028
|
+
C("path", {
|
|
2037
2029
|
d: "m21.4 11.6-8.5 8.5a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5"
|
|
2038
2030
|
})
|
|
2039
2031
|
), e;
|
|
2040
2032
|
}
|
|
2041
|
-
function
|
|
2042
|
-
const e =
|
|
2033
|
+
function Ai() {
|
|
2034
|
+
const e = te("0 0 24 24", 19, 19, "none", "currentColor");
|
|
2043
2035
|
return e.setAttribute(
|
|
2044
2036
|
"class",
|
|
2045
2037
|
"pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
|
|
2046
2038
|
), e.appendChild(
|
|
2047
|
-
|
|
2039
|
+
C("path", {
|
|
2048
2040
|
d: "M7.1 15.6 15.2 7.7c1.9-1.8 4.9.8 2.7 3.2l-8.8 8.3c-3.2 3-8-1.1-4.6-4.8l10.1-9.1",
|
|
2049
2041
|
stroke: "currentColor",
|
|
2050
2042
|
"stroke-width": "2",
|
|
@@ -2053,10 +2045,10 @@ function Li() {
|
|
|
2053
2045
|
})
|
|
2054
2046
|
), e;
|
|
2055
2047
|
}
|
|
2056
|
-
function
|
|
2057
|
-
const e =
|
|
2048
|
+
function Ni() {
|
|
2049
|
+
const e = te("0 0 24 24", 18, 18, "currentColor");
|
|
2058
2050
|
return e.appendChild(
|
|
2059
|
-
|
|
2051
|
+
C("rect", {
|
|
2060
2052
|
x: "6",
|
|
2061
2053
|
y: "6",
|
|
2062
2054
|
width: "12",
|
|
@@ -2065,8 +2057,8 @@ function Ai() {
|
|
|
2065
2057
|
})
|
|
2066
2058
|
), e;
|
|
2067
2059
|
}
|
|
2068
|
-
function
|
|
2069
|
-
const e =
|
|
2060
|
+
function Ti() {
|
|
2061
|
+
const e = te(
|
|
2070
2062
|
"0 0 24 24",
|
|
2071
2063
|
12,
|
|
2072
2064
|
12,
|
|
@@ -2074,10 +2066,10 @@ function Pi() {
|
|
|
2074
2066
|
"currentColor",
|
|
2075
2067
|
"2.4"
|
|
2076
2068
|
);
|
|
2077
|
-
return e.appendChild(
|
|
2069
|
+
return e.appendChild(C("path", { d: "M18 6 6 18" })), e.appendChild(C("path", { d: "m6 6 12 12" })), e;
|
|
2078
2070
|
}
|
|
2079
|
-
function
|
|
2080
|
-
const e =
|
|
2071
|
+
function Di() {
|
|
2072
|
+
const e = te(
|
|
2081
2073
|
"0 0 24 24",
|
|
2082
2074
|
13,
|
|
2083
2075
|
13,
|
|
@@ -2086,7 +2078,7 @@ function Ii() {
|
|
|
2086
2078
|
"2.25"
|
|
2087
2079
|
);
|
|
2088
2080
|
return e.appendChild(
|
|
2089
|
-
|
|
2081
|
+
C("rect", {
|
|
2090
2082
|
width: "14",
|
|
2091
2083
|
height: "14",
|
|
2092
2084
|
x: "8",
|
|
@@ -2095,379 +2087,341 @@ function Ii() {
|
|
|
2095
2087
|
ry: "2"
|
|
2096
2088
|
})
|
|
2097
2089
|
), e.appendChild(
|
|
2098
|
-
|
|
2090
|
+
C("path", {
|
|
2099
2091
|
d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
|
|
2100
2092
|
})
|
|
2101
2093
|
), e;
|
|
2102
2094
|
}
|
|
2103
|
-
function
|
|
2095
|
+
function te(e, t, o, n, i, a) {
|
|
2104
2096
|
const l = {
|
|
2105
2097
|
viewBox: e,
|
|
2106
2098
|
width: String(t),
|
|
2107
|
-
height: String(
|
|
2108
|
-
fill:
|
|
2099
|
+
height: String(o),
|
|
2100
|
+
fill: n,
|
|
2109
2101
|
"aria-hidden": "true"
|
|
2110
2102
|
};
|
|
2111
|
-
return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), a && (l["stroke-width"] = a),
|
|
2103
|
+
return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), a && (l["stroke-width"] = a), C("svg", l);
|
|
2112
2104
|
}
|
|
2113
|
-
function
|
|
2114
|
-
const
|
|
2115
|
-
for (const [
|
|
2116
|
-
|
|
2117
|
-
return
|
|
2105
|
+
function C(e, t = {}) {
|
|
2106
|
+
const o = document.createElementNS(vn, e);
|
|
2107
|
+
for (const [n, i] of Object.entries(t))
|
|
2108
|
+
o.setAttribute(n, i);
|
|
2109
|
+
return o;
|
|
2118
2110
|
}
|
|
2119
|
-
function
|
|
2111
|
+
function tn(e) {
|
|
2120
2112
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
2121
|
-
e.addEventListener(t, (
|
|
2122
|
-
|
|
2113
|
+
e.addEventListener(t, (o) => {
|
|
2114
|
+
o.stopPropagation();
|
|
2123
2115
|
});
|
|
2124
2116
|
}
|
|
2125
|
-
function
|
|
2117
|
+
function Ri(e, t, o) {
|
|
2126
2118
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
2127
|
-
for (const [
|
|
2119
|
+
for (const [n, i] of t.entries()) {
|
|
2128
2120
|
const a = document.createElement("div");
|
|
2129
|
-
a.className = "pluno-pa-widget__attachment", a.appendChild(
|
|
2121
|
+
a.className = "pluno-pa-widget__attachment", a.appendChild(Mi(i));
|
|
2130
2122
|
const l = document.createElement("span");
|
|
2131
2123
|
l.textContent = i.name, a.appendChild(l);
|
|
2132
2124
|
const p = document.createElement("button");
|
|
2133
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(
|
|
2125
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(Ti()), p.addEventListener("click", () => o(n)), a.appendChild(p), e.appendChild(a);
|
|
2134
2126
|
}
|
|
2135
2127
|
}
|
|
2136
|
-
function
|
|
2137
|
-
|
|
2128
|
+
function Mi(e) {
|
|
2129
|
+
const t = vt(e), o = Nn(e);
|
|
2130
|
+
if (t === "image" && o) {
|
|
2138
2131
|
const n = document.createElement("img");
|
|
2139
|
-
return n.src =
|
|
2132
|
+
return n.src = o, n.alt = "", n.setAttribute("aria-hidden", "true"), n.addEventListener("error", () => n.replaceWith(J(e))), n;
|
|
2140
2133
|
}
|
|
2141
|
-
|
|
2142
|
-
|
|
2134
|
+
if (t === "video" && o) {
|
|
2135
|
+
const n = document.createElement("video");
|
|
2136
|
+
return n.src = o, n.muted = !0, n.preload = "metadata", n.setAttribute("aria-hidden", "true"), n.addEventListener("error", () => n.replaceWith(J(e))), n.addEventListener("stalled", () => n.replaceWith(J(e))), n;
|
|
2137
|
+
}
|
|
2138
|
+
return J(e);
|
|
2143
2139
|
}
|
|
2144
|
-
function
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2140
|
+
function zi(e) {
|
|
2141
|
+
const t = vt(e), o = Nn(e);
|
|
2142
|
+
if (t === "image" && o) {
|
|
2143
|
+
const n = document.createElement("img");
|
|
2144
|
+
return n.className = "pluno-pa-widget__message-attachment-preview", n.src = o, n.alt = e.name, n.addEventListener("error", () => n.replaceWith(J(e, "message"))), n;
|
|
2148
2145
|
}
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2146
|
+
if (t === "pdf" && o) {
|
|
2147
|
+
const n = document.createElement("object");
|
|
2148
|
+
return n.className = "pluno-pa-widget__message-attachment-preview pluno-pa-widget__message-attachment-preview--pdf", n.data = o, n.type = "application/pdf", n.setAttribute("aria-label", e.name), n.addEventListener("error", () => n.replaceWith(J(e, "message"))), n.appendChild(J(e, "message")), n;
|
|
2149
|
+
}
|
|
2150
|
+
if (t === "video" && o) {
|
|
2151
|
+
const n = document.createElement("video");
|
|
2152
|
+
return n.className = "pluno-pa-widget__message-attachment-preview", n.src = o, n.muted = !0, n.preload = "metadata", n.addEventListener("error", () => n.replaceWith(J(e, "message"))), n.addEventListener("stalled", () => n.replaceWith(J(e, "message"))), n;
|
|
2153
|
+
}
|
|
2154
|
+
return J(e, "message");
|
|
2155
2155
|
}
|
|
2156
|
-
function
|
|
2157
|
-
|
|
2156
|
+
function J(e, t = "composer") {
|
|
2157
|
+
if (t === "composer") {
|
|
2158
|
+
const a = document.createElement("span");
|
|
2159
|
+
return a.className = "pluno-pa-widget__attachment-file", a.textContent = nn(e), a;
|
|
2160
|
+
}
|
|
2161
|
+
const o = document.createElement("div");
|
|
2162
|
+
o.className = "pluno-pa-widget__message-attachment-file";
|
|
2163
|
+
const n = document.createElement("span");
|
|
2164
|
+
n.textContent = nn(e);
|
|
2165
|
+
const i = document.createElement("strong");
|
|
2166
|
+
return i.textContent = e.name, o.append(n, i), o;
|
|
2158
2167
|
}
|
|
2159
|
-
function
|
|
2160
|
-
return e === "application/pdf" ? "
|
|
2168
|
+
function vt(e) {
|
|
2169
|
+
return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
|
|
2161
2170
|
}
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
return [];
|
|
2165
|
-
const t = Array.from(e);
|
|
2166
|
-
if (t.length > We)
|
|
2167
|
-
throw new Error(
|
|
2168
|
-
`Attach up to ${We} files per message.`
|
|
2169
|
-
);
|
|
2170
|
-
return Promise.all(
|
|
2171
|
-
t.map(async (n) => {
|
|
2172
|
-
const o = zi(n);
|
|
2173
|
-
if (!o)
|
|
2174
|
-
throw new Error(
|
|
2175
|
-
"Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files."
|
|
2176
|
-
);
|
|
2177
|
-
if (n.size > So)
|
|
2178
|
-
throw new Error("Each Pluno attachment can be up to 10 MB.");
|
|
2179
|
-
if (o === "image/gif") {
|
|
2180
|
-
const i = new Uint8Array(await qi(n));
|
|
2181
|
-
if (Oi(i))
|
|
2182
|
-
throw new Error("Pluno supports non-animated GIF images.");
|
|
2183
|
-
}
|
|
2184
|
-
return {
|
|
2185
|
-
name: n.name || Ri(o),
|
|
2186
|
-
mimeType: o,
|
|
2187
|
-
sizeBytes: n.size,
|
|
2188
|
-
dataUrl: Bi(
|
|
2189
|
-
await ji(n),
|
|
2190
|
-
o
|
|
2191
|
-
)
|
|
2192
|
-
};
|
|
2193
|
-
})
|
|
2194
|
-
);
|
|
2171
|
+
function Nn(e) {
|
|
2172
|
+
return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
|
|
2195
2173
|
}
|
|
2196
|
-
function
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
const t = e.name.toLowerCase();
|
|
2200
|
-
return t.endsWith(".png") ? "image/png" : t.endsWith(".jpg") || t.endsWith(".jpeg") ? "image/jpeg" : t.endsWith(".webp") ? "image/webp" : t.endsWith(".gif") ? "image/gif" : t.endsWith(".pdf") ? "application/pdf" : null;
|
|
2174
|
+
function nn(e) {
|
|
2175
|
+
const t = vt(e);
|
|
2176
|
+
return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
|
|
2201
2177
|
}
|
|
2202
2178
|
function Bi(e, t) {
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
if (e.length < 14 || !Ui(e))
|
|
2208
|
-
return !1;
|
|
2209
|
-
const t = e[10];
|
|
2210
|
-
let n = 13;
|
|
2211
|
-
t & 128 && (n += 3 * 2 ** ((t & 7) + 1));
|
|
2212
|
-
let o = 0;
|
|
2213
|
-
for (; n < e.length; ) {
|
|
2214
|
-
const i = e[n];
|
|
2215
|
-
if (n += 1, i === 59)
|
|
2216
|
-
return !1;
|
|
2217
|
-
if (i === 33) {
|
|
2218
|
-
n += 1, n = Jt(e, n);
|
|
2219
|
-
continue;
|
|
2220
|
-
}
|
|
2221
|
-
if (i !== 44)
|
|
2222
|
-
return !1;
|
|
2223
|
-
if (o += 1, o > 1)
|
|
2224
|
-
return !0;
|
|
2225
|
-
if (n + 9 >= e.length)
|
|
2226
|
-
return !1;
|
|
2227
|
-
const a = e[n + 8];
|
|
2228
|
-
if (n += 9, a & 128 && (n += 3 * 2 ** ((a & 7) + 1)), n >= e.length)
|
|
2229
|
-
return !1;
|
|
2230
|
-
n += 1, n = Jt(e, n);
|
|
2231
|
-
}
|
|
2232
|
-
return !1;
|
|
2179
|
+
return t ? Array.from(t).map((n) => ({
|
|
2180
|
+
...e.createLocalAttachment(n),
|
|
2181
|
+
previewUrl: Ui(n)
|
|
2182
|
+
})) : [];
|
|
2233
2183
|
}
|
|
2234
2184
|
function Ui(e) {
|
|
2235
|
-
return
|
|
2236
|
-
}
|
|
2237
|
-
function Jt(e, t) {
|
|
2238
|
-
for (; t < e.length; ) {
|
|
2239
|
-
const n = e[t];
|
|
2240
|
-
if (t += 1, n === 0)
|
|
2241
|
-
return t;
|
|
2242
|
-
t += n;
|
|
2243
|
-
}
|
|
2244
|
-
return t;
|
|
2185
|
+
return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
|
|
2245
2186
|
}
|
|
2246
|
-
function
|
|
2187
|
+
function He(e) {
|
|
2247
2188
|
return !!(e && Array.from(e.types).includes("Files"));
|
|
2248
2189
|
}
|
|
2249
|
-
function
|
|
2250
|
-
if (!e || !
|
|
2190
|
+
function dt(e, t, o = null) {
|
|
2191
|
+
if (!e || !ft(t, o)) {
|
|
2251
2192
|
e && (e.hidden = !0, e.replaceChildren());
|
|
2252
2193
|
return;
|
|
2253
2194
|
}
|
|
2254
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status",
|
|
2255
|
-
|
|
2256
|
-
) :
|
|
2195
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", Q(t) || yt(o) ? e.appendChild(
|
|
2196
|
+
Oi(t, o)
|
|
2197
|
+
) : Tn(t) && e.appendChild(Fi(t));
|
|
2257
2198
|
}
|
|
2258
|
-
function
|
|
2259
|
-
const
|
|
2260
|
-
|
|
2261
|
-
const
|
|
2262
|
-
i.textContent =
|
|
2199
|
+
function Oi(e, t) {
|
|
2200
|
+
const o = document.createElement("div");
|
|
2201
|
+
o.className = "pluno-pa-widget__billing-action-card";
|
|
2202
|
+
const n = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
|
|
2203
|
+
i.textContent = n ? "Credits used up" : "Billing needs attention", o.appendChild(i);
|
|
2263
2204
|
const a = document.createElement("span");
|
|
2264
|
-
return a.textContent =
|
|
2265
|
-
|
|
2205
|
+
return a.textContent = n ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", o.appendChild(a), o.appendChild(
|
|
2206
|
+
Dn(
|
|
2266
2207
|
e,
|
|
2267
2208
|
"Upgrade plan",
|
|
2268
2209
|
"pluno-pa-widget__billing-action-card-actions"
|
|
2269
2210
|
)
|
|
2270
|
-
),
|
|
2211
|
+
), o;
|
|
2271
2212
|
}
|
|
2272
|
-
function
|
|
2213
|
+
function Fi(e) {
|
|
2273
2214
|
const t = document.createElement("div");
|
|
2274
2215
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
2275
|
-
const
|
|
2276
|
-
|
|
2277
|
-
const
|
|
2278
|
-
return
|
|
2279
|
-
|
|
2216
|
+
const o = document.createElement("strong");
|
|
2217
|
+
o.textContent = "Credits running low", t.appendChild(o);
|
|
2218
|
+
const n = document.createElement("span");
|
|
2219
|
+
return n.textContent = Wi(e) ?? "Credits are running low for this period.", t.appendChild(n), t.appendChild(
|
|
2220
|
+
Dn(
|
|
2280
2221
|
e,
|
|
2281
2222
|
"Upgrade",
|
|
2282
2223
|
"pluno-pa-widget__billing-action-card-actions"
|
|
2283
2224
|
)
|
|
2284
2225
|
), t;
|
|
2285
2226
|
}
|
|
2286
|
-
function
|
|
2287
|
-
return e !== null && (
|
|
2227
|
+
function ft(e, t) {
|
|
2228
|
+
return e !== null && (Q(e) || Tn(e) || yt(t));
|
|
2288
2229
|
}
|
|
2289
|
-
function
|
|
2290
|
-
return
|
|
2230
|
+
function on(e, t, o) {
|
|
2231
|
+
return ft(t, o) || Hi(t) ? !0 : !ft(e, o);
|
|
2291
2232
|
}
|
|
2292
|
-
function
|
|
2293
|
-
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null ||
|
|
2233
|
+
function Hi(e) {
|
|
2234
|
+
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || Q(e));
|
|
2294
2235
|
}
|
|
2295
|
-
function
|
|
2236
|
+
function Q(e) {
|
|
2296
2237
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
2297
2238
|
}
|
|
2298
|
-
function
|
|
2239
|
+
function yt(e) {
|
|
2299
2240
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
2300
2241
|
}
|
|
2301
|
-
function
|
|
2302
|
-
return !
|
|
2242
|
+
function Tn(e) {
|
|
2243
|
+
return !Q(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
2303
2244
|
}
|
|
2304
2245
|
function Wi(e) {
|
|
2305
|
-
return e.creditsRemaining === null ? null : `${
|
|
2246
|
+
return e.creditsRemaining === null ? null : `${Gi(e.creditsRemaining)} credits left`;
|
|
2306
2247
|
}
|
|
2307
|
-
function
|
|
2248
|
+
function Gi(e) {
|
|
2308
2249
|
return new Intl.NumberFormat("en-US", {
|
|
2309
2250
|
maximumFractionDigits: 0
|
|
2310
2251
|
}).format(Math.ceil(e));
|
|
2311
2252
|
}
|
|
2312
|
-
function
|
|
2313
|
-
const
|
|
2314
|
-
return
|
|
2315
|
-
|
|
2316
|
-
),
|
|
2317
|
-
|
|
2318
|
-
),
|
|
2253
|
+
function Dn(e, t, o) {
|
|
2254
|
+
const n = document.createElement("div");
|
|
2255
|
+
return n.className = o, n.appendChild(
|
|
2256
|
+
an(t, e.pricingUrl)
|
|
2257
|
+
), n.appendChild(
|
|
2258
|
+
an("Earn credits", e.earnCreditsUrl)
|
|
2259
|
+
), n;
|
|
2319
2260
|
}
|
|
2320
|
-
function
|
|
2321
|
-
const
|
|
2322
|
-
if (
|
|
2323
|
-
const
|
|
2324
|
-
|
|
2261
|
+
function an(e, t) {
|
|
2262
|
+
const o = document.createElement("button");
|
|
2263
|
+
if (o.type = "button", e === "Earn credits") {
|
|
2264
|
+
const n = document.createElement("span");
|
|
2265
|
+
n.className = "pluno-pa-widget__billing-action-card-earn-credits-label", n.textContent = e, o.appendChild(n);
|
|
2325
2266
|
} else
|
|
2326
|
-
|
|
2327
|
-
return
|
|
2267
|
+
o.textContent = e;
|
|
2268
|
+
return o.disabled = t.trim().length === 0, o.addEventListener("click", () => {
|
|
2328
2269
|
t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
|
|
2329
|
-
}),
|
|
2330
|
-
}
|
|
2331
|
-
function qi(e) {
|
|
2332
|
-
return new Promise((t, n) => {
|
|
2333
|
-
const o = new FileReader();
|
|
2334
|
-
o.addEventListener("load", () => {
|
|
2335
|
-
if (o.result instanceof ArrayBuffer) {
|
|
2336
|
-
t(o.result);
|
|
2337
|
-
return;
|
|
2338
|
-
}
|
|
2339
|
-
n(new Error("Failed to read file"));
|
|
2340
|
-
}), o.addEventListener("error", () => {
|
|
2341
|
-
n(o.error ?? new Error("Failed to read file"));
|
|
2342
|
-
}), o.readAsArrayBuffer(e);
|
|
2343
|
-
});
|
|
2270
|
+
}), o;
|
|
2344
2271
|
}
|
|
2345
|
-
function
|
|
2346
|
-
return new Promise((t, n) => {
|
|
2347
|
-
const o = new FileReader();
|
|
2348
|
-
o.addEventListener("load", () => {
|
|
2349
|
-
if (typeof o.result == "string") {
|
|
2350
|
-
t(o.result);
|
|
2351
|
-
return;
|
|
2352
|
-
}
|
|
2353
|
-
n(new Error("Failed to read file"));
|
|
2354
|
-
}), o.addEventListener("error", () => {
|
|
2355
|
-
n(o.error ?? new Error("Failed to read file"));
|
|
2356
|
-
}), o.readAsDataURL(e);
|
|
2357
|
-
});
|
|
2358
|
-
}
|
|
2359
|
-
function tn(e, t) {
|
|
2272
|
+
function ct(e, t) {
|
|
2360
2273
|
return e.messages.filter(
|
|
2361
|
-
(
|
|
2274
|
+
(n) => !Rn(n)
|
|
2362
2275
|
).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
2363
2276
|
}
|
|
2364
|
-
function
|
|
2365
|
-
const
|
|
2366
|
-
(_) => !
|
|
2367
|
-
),
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2277
|
+
function $i(e, t, o, n, i, a, l, p, c, u, d, g, S, f, F, k) {
|
|
2278
|
+
const x = Ki(a), v = x.filter(
|
|
2279
|
+
(_) => !Rn(_)
|
|
2280
|
+
), h = e.scrollTop, I = [], T = /* @__PURE__ */ new Set(), P = (_) => {
|
|
2281
|
+
I.push(_);
|
|
2282
|
+
};
|
|
2283
|
+
zn(o, a.isThinking), i.hidden = !p, p && l !== null && Ln(i, l);
|
|
2284
|
+
const ke = v.length > 0 || !!a.assistantDraft || a.isThinking;
|
|
2285
|
+
if (n(ke), v.length === 0 && !a.assistantDraft && !a.lastError && !a.isThinking) {
|
|
2371
2286
|
const _ = document.createElement("div");
|
|
2372
2287
|
_.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
2373
|
-
const
|
|
2374
|
-
|
|
2375
|
-
const
|
|
2288
|
+
const M = document.createElement("div");
|
|
2289
|
+
M.className = "pluno-pa-widget__empty-hero";
|
|
2290
|
+
const ae = se(
|
|
2376
2291
|
"pluno-pa-widget__character--empty",
|
|
2377
|
-
|
|
2292
|
+
f()
|
|
2378
2293
|
);
|
|
2379
|
-
|
|
2380
|
-
const
|
|
2381
|
-
if (
|
|
2382
|
-
for (const
|
|
2383
|
-
const
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
}),
|
|
2294
|
+
M.appendChild(ae), _.appendChild(M), _.appendChild(kn());
|
|
2295
|
+
const L = document.createElement("div");
|
|
2296
|
+
if (L.className = a.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", a.starterPrompts.length === 0 && !a.starterPromptsLoading && L.setAttribute("aria-hidden", "true"), a.starterPrompts.length > 0)
|
|
2297
|
+
for (const A of a.starterPrompts) {
|
|
2298
|
+
const y = document.createElement("button");
|
|
2299
|
+
y.type = "button", y.className = "pluno-pa-widget__starter-prompt", y.textContent = `"${A}"`, y.addEventListener("click", () => {
|
|
2300
|
+
F(A);
|
|
2301
|
+
}), L.appendChild(y);
|
|
2387
2302
|
}
|
|
2388
2303
|
else if (a.starterPromptsLoading) {
|
|
2389
|
-
const
|
|
2390
|
-
|
|
2304
|
+
const A = document.createElement("button");
|
|
2305
|
+
A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", A.disabled = !0, A.tabIndex = -1, A.textContent = "Generating example tasks...", L.appendChild(A);
|
|
2391
2306
|
} else
|
|
2392
|
-
for (let
|
|
2393
|
-
const
|
|
2394
|
-
|
|
2307
|
+
for (let A = 0; A < Ao; A += 1) {
|
|
2308
|
+
const y = document.createElement("button");
|
|
2309
|
+
y.type = "button", y.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", y.disabled = !0, y.tabIndex = -1, y.textContent = "", L.appendChild(y);
|
|
2395
2310
|
}
|
|
2396
|
-
_.appendChild(
|
|
2311
|
+
_.appendChild(L), g.clear(), P(_), P(t), rn(e, I);
|
|
2397
2312
|
return;
|
|
2398
2313
|
}
|
|
2399
|
-
let
|
|
2400
|
-
const
|
|
2401
|
-
if (
|
|
2314
|
+
let b = null, D = null, de = [];
|
|
2315
|
+
const ce = v.some(wt), we = () => {
|
|
2316
|
+
if (de.length === 0)
|
|
2402
2317
|
return !1;
|
|
2403
2318
|
const _ = ia(
|
|
2404
|
-
|
|
2319
|
+
de,
|
|
2405
2320
|
d,
|
|
2406
|
-
|
|
2407
|
-
|
|
2321
|
+
S,
|
|
2322
|
+
f()
|
|
2408
2323
|
);
|
|
2409
|
-
return
|
|
2324
|
+
return P(_), b = null, D = _, de = [], !0;
|
|
2410
2325
|
};
|
|
2411
|
-
for (let _ = 0; _ <
|
|
2412
|
-
const
|
|
2413
|
-
if (
|
|
2414
|
-
|
|
2326
|
+
for (let _ = 0; _ < v.length; _ += 1) {
|
|
2327
|
+
const M = v[_];
|
|
2328
|
+
if (M.role === "tool") {
|
|
2329
|
+
de.push(M);
|
|
2415
2330
|
continue;
|
|
2416
2331
|
}
|
|
2417
|
-
if (
|
|
2418
|
-
if (
|
|
2419
|
-
const
|
|
2420
|
-
|
|
2332
|
+
if (wt(M)) {
|
|
2333
|
+
if (we()) {
|
|
2334
|
+
const B = _t();
|
|
2335
|
+
P(B), b = null, D = B;
|
|
2421
2336
|
} else {
|
|
2422
|
-
const
|
|
2423
|
-
|
|
2337
|
+
const B = sn(f());
|
|
2338
|
+
P(B), b = null, D = B;
|
|
2424
2339
|
}
|
|
2425
2340
|
continue;
|
|
2426
2341
|
}
|
|
2427
|
-
if (
|
|
2342
|
+
if (M.role === "system")
|
|
2428
2343
|
continue;
|
|
2429
|
-
const
|
|
2430
|
-
if (
|
|
2431
|
-
const
|
|
2432
|
-
|
|
2344
|
+
const ae = we(), L = oa(M.content);
|
|
2345
|
+
if (M.role === "assistant" && !ae) {
|
|
2346
|
+
const y = Mn(f());
|
|
2347
|
+
P(y), b = null, D = y;
|
|
2433
2348
|
}
|
|
2434
|
-
const
|
|
2435
|
-
|
|
2436
|
-
const I = document.createElement("div");
|
|
2437
|
-
I.className = "pluno-pa-widget__message-actions", I.appendChild(Xi(H)), L.appendChild(I), e.appendChild(L), S = L, k = null;
|
|
2349
|
+
const A = qi(M, L, g, T);
|
|
2350
|
+
P(A), b = A, D = null;
|
|
2438
2351
|
}
|
|
2439
|
-
const
|
|
2440
|
-
if (a.isThinking && !a.assistantDraft && !
|
|
2441
|
-
if (
|
|
2442
|
-
const _ =
|
|
2443
|
-
|
|
2352
|
+
const G = we();
|
|
2353
|
+
if (a.isThinking && !a.assistantDraft && !ce)
|
|
2354
|
+
if (G) {
|
|
2355
|
+
const _ = _t();
|
|
2356
|
+
P(_), b = null, D = _;
|
|
2444
2357
|
} else {
|
|
2445
|
-
const _ =
|
|
2446
|
-
|
|
2358
|
+
const _ = sn(f());
|
|
2359
|
+
P(_), b = null, D = _;
|
|
2447
2360
|
}
|
|
2448
2361
|
if (a.lastError) {
|
|
2449
2362
|
const _ = document.createElement("div");
|
|
2450
|
-
_.className = "pluno-pa-widget__error", _.textContent = a.lastError,
|
|
2363
|
+
_.className = "pluno-pa-widget__error", _.textContent = a.lastError, P(_), b = _, D = null;
|
|
2451
2364
|
}
|
|
2452
|
-
const
|
|
2453
|
-
if (
|
|
2454
|
-
const _ = Zi(
|
|
2455
|
-
isDrafting:
|
|
2456
|
-
error:
|
|
2457
|
-
characterIconOptions:
|
|
2458
|
-
onDraft:
|
|
2459
|
-
onDismiss:
|
|
2460
|
-
onDisable:
|
|
2365
|
+
const ie = k && !a.isThinking ? ao(x) : null;
|
|
2366
|
+
if (k && ie && !k.dismissedCandidateIds.has(ie.id)) {
|
|
2367
|
+
const _ = Zi(ie, {
|
|
2368
|
+
isDrafting: k.draftingCandidateId === ie.id,
|
|
2369
|
+
error: k.error,
|
|
2370
|
+
characterIconOptions: k.characterIconOptions,
|
|
2371
|
+
onDraft: k.onDraft,
|
|
2372
|
+
onDismiss: k.onDismiss,
|
|
2373
|
+
onDisable: k.onDisable
|
|
2461
2374
|
});
|
|
2462
|
-
|
|
2375
|
+
P(_), k.onSeen(ie), b = null, D = _;
|
|
2463
2376
|
}
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2377
|
+
b?.classList.add("pluno-pa-widget__message--bottom-reserve"), D?.classList.add("pluno-pa-widget__bottom-reserve-compact"), P(t), Vi(g, T), rn(e, I), c ? De(e, u) : e.scrollTop = h;
|
|
2378
|
+
}
|
|
2379
|
+
function qi(e, t, o, n) {
|
|
2380
|
+
const i = ji(e, t), a = i ? o.get(i) : void 0;
|
|
2381
|
+
if (i && a)
|
|
2382
|
+
return a.classList.remove("pluno-pa-widget__message--bottom-reserve"), n.add(i), a;
|
|
2383
|
+
const l = document.createElement("div");
|
|
2384
|
+
l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? ra(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(Yi(e.attachments));
|
|
2385
|
+
const p = document.createElement("div");
|
|
2386
|
+
return p.className = "pluno-pa-widget__message-actions", p.appendChild(Xi(t)), l.appendChild(p), i && (o.set(i, l), n.add(i)), l;
|
|
2387
|
+
}
|
|
2388
|
+
function ji(e, t) {
|
|
2389
|
+
return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
|
|
2390
|
+
id: e.id,
|
|
2391
|
+
content: t,
|
|
2392
|
+
attachments: e.attachments.map((o) => {
|
|
2393
|
+
const { previewUrl: n } = o;
|
|
2394
|
+
return {
|
|
2395
|
+
id: o.id ?? null,
|
|
2396
|
+
name: o.name,
|
|
2397
|
+
mimeType: o.mimeType,
|
|
2398
|
+
sizeBytes: o.sizeBytes,
|
|
2399
|
+
previewUrl: n ?? null,
|
|
2400
|
+
fileUrl: o.fileUrl ?? null,
|
|
2401
|
+
gcsPath: o.gcsPath ?? null
|
|
2402
|
+
};
|
|
2403
|
+
})
|
|
2404
|
+
});
|
|
2469
2405
|
}
|
|
2470
|
-
function
|
|
2406
|
+
function Vi(e, t) {
|
|
2407
|
+
for (const o of e.keys())
|
|
2408
|
+
t.has(o) || e.delete(o);
|
|
2409
|
+
}
|
|
2410
|
+
function rn(e, t) {
|
|
2411
|
+
let o = e.firstChild;
|
|
2412
|
+
for (const n of t) {
|
|
2413
|
+
if (n === o) {
|
|
2414
|
+
o = o.nextSibling;
|
|
2415
|
+
continue;
|
|
2416
|
+
}
|
|
2417
|
+
e.insertBefore(n, o);
|
|
2418
|
+
}
|
|
2419
|
+
for (; o; ) {
|
|
2420
|
+
const n = o;
|
|
2421
|
+
o = o.nextSibling, e.removeChild(n);
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
function Ki(e) {
|
|
2471
2425
|
if (!e.assistantDraft)
|
|
2472
2426
|
return [...e.messages];
|
|
2473
2427
|
const t = {
|
|
@@ -2481,22 +2435,22 @@ function Yi(e) {
|
|
|
2481
2435
|
};
|
|
2482
2436
|
if (!t.respondsToUserMessageId)
|
|
2483
2437
|
return [...e.messages, t];
|
|
2484
|
-
const
|
|
2438
|
+
const o = e.messages.findIndex(
|
|
2485
2439
|
(a) => a.role === "user" && a.id === t.respondsToUserMessageId
|
|
2486
2440
|
);
|
|
2487
|
-
if (
|
|
2441
|
+
if (o === -1)
|
|
2488
2442
|
return [...e.messages, t];
|
|
2489
|
-
const
|
|
2490
|
-
(a, l) => l >
|
|
2443
|
+
const n = e.messages.findIndex(
|
|
2444
|
+
(a, l) => l > o && a.role !== "user" && a.respondsToUserMessageId === t.respondsToUserMessageId && ln(a, t) && wt(a)
|
|
2491
2445
|
);
|
|
2492
|
-
if (
|
|
2446
|
+
if (n !== -1)
|
|
2493
2447
|
return [
|
|
2494
|
-
...e.messages.slice(0,
|
|
2448
|
+
...e.messages.slice(0, n),
|
|
2495
2449
|
t,
|
|
2496
|
-
...e.messages.slice(
|
|
2450
|
+
...e.messages.slice(n + 1)
|
|
2497
2451
|
];
|
|
2498
|
-
let i =
|
|
2499
|
-
for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId &&
|
|
2452
|
+
let i = o + 1;
|
|
2453
|
+
for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && ln(e.messages[i], t); )
|
|
2500
2454
|
i += 1;
|
|
2501
2455
|
return [
|
|
2502
2456
|
...e.messages.slice(0, i),
|
|
@@ -2504,49 +2458,49 @@ function Yi(e) {
|
|
|
2504
2458
|
...e.messages.slice(i)
|
|
2505
2459
|
];
|
|
2506
2460
|
}
|
|
2507
|
-
function
|
|
2461
|
+
function wt(e) {
|
|
2508
2462
|
return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
|
|
2509
2463
|
}
|
|
2510
|
-
function
|
|
2464
|
+
function ln(e, t) {
|
|
2511
2465
|
return !e.runId || !t.runId ? !0 : e.runId === t.runId;
|
|
2512
2466
|
}
|
|
2513
|
-
function
|
|
2514
|
-
e.replaceChildren(),
|
|
2467
|
+
function pn(e, t, o, n, i, a, l, p) {
|
|
2468
|
+
e.replaceChildren(), zn(t, !1), t.disabled = !0, o(!1);
|
|
2515
2469
|
const c = document.createElement("div");
|
|
2516
2470
|
c.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
2517
2471
|
const u = se(
|
|
2518
2472
|
"pluno-pa-widget__character--empty",
|
|
2519
|
-
|
|
2473
|
+
n()
|
|
2520
2474
|
);
|
|
2521
2475
|
c.appendChild(u);
|
|
2522
2476
|
const d = document.createElement("div");
|
|
2523
2477
|
if (d.className = "pluno-pa-widget__empty", d.textContent = i, c.appendChild(d), l) {
|
|
2524
|
-
const
|
|
2525
|
-
|
|
2478
|
+
const g = document.createElement("a");
|
|
2479
|
+
g.className = "pluno-pa-widget__login", g.href = l, g.target = "_blank", g.rel = "noopener noreferrer", g.textContent = a, c.appendChild(g);
|
|
2526
2480
|
} else {
|
|
2527
|
-
const
|
|
2528
|
-
|
|
2481
|
+
const g = document.createElement("button");
|
|
2482
|
+
g.type = "button", g.className = "pluno-pa-widget__login", g.textContent = a, g.addEventListener("click", () => p?.()), c.appendChild(g);
|
|
2529
2483
|
}
|
|
2530
2484
|
e.appendChild(c);
|
|
2531
2485
|
}
|
|
2532
|
-
function
|
|
2486
|
+
function Yi(e) {
|
|
2533
2487
|
const t = document.createElement("div");
|
|
2534
2488
|
t.className = "pluno-pa-widget__message-attachments";
|
|
2535
|
-
for (const
|
|
2536
|
-
t.appendChild(
|
|
2489
|
+
for (const o of e)
|
|
2490
|
+
t.appendChild(zi(o));
|
|
2537
2491
|
return t;
|
|
2538
2492
|
}
|
|
2539
2493
|
function Xi(e) {
|
|
2540
2494
|
const t = document.createElement("button");
|
|
2541
|
-
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(
|
|
2542
|
-
|
|
2495
|
+
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Di()), t.addEventListener("click", (o) => {
|
|
2496
|
+
o.preventDefault(), o.stopPropagation(), navigator.clipboard.writeText(e);
|
|
2543
2497
|
}), t;
|
|
2544
2498
|
}
|
|
2545
2499
|
function Zi(e, t) {
|
|
2546
|
-
const
|
|
2547
|
-
|
|
2548
|
-
const
|
|
2549
|
-
|
|
2500
|
+
const o = document.createElement("article");
|
|
2501
|
+
o.className = "pluno-pa-widget__share-prompt";
|
|
2502
|
+
const n = document.createElement("div");
|
|
2503
|
+
n.className = "pluno-pa-widget__share-prompt-body", n.appendChild(
|
|
2550
2504
|
se(
|
|
2551
2505
|
"pluno-pa-widget__share-prompt-icon",
|
|
2552
2506
|
t.characterIconOptions
|
|
@@ -2561,7 +2515,7 @@ function Zi(e, t) {
|
|
|
2561
2515
|
const d = document.createElement("span");
|
|
2562
2516
|
d.className = "pluno-pa-widget__share-prompt-error", d.textContent = t.error, i.appendChild(d);
|
|
2563
2517
|
}
|
|
2564
|
-
|
|
2518
|
+
n.appendChild(i);
|
|
2565
2519
|
const p = document.createElement("div");
|
|
2566
2520
|
p.className = "pluno-pa-widget__share-prompt-actions";
|
|
2567
2521
|
const c = document.createElement("div");
|
|
@@ -2569,31 +2523,31 @@ function Zi(e, t) {
|
|
|
2569
2523
|
const u = document.createElement("button");
|
|
2570
2524
|
if (u.type = "button", u.disabled = t.isDrafting, u.addEventListener("click", () => {
|
|
2571
2525
|
t.onDraft(e);
|
|
2572
|
-
}), t.isDrafting ? (u.appendChild(
|
|
2526
|
+
}), t.isDrafting ? (u.appendChild(xt()), u.appendChild(document.createTextNode("Drafting..."))) : u.textContent = "Draft a social post", c.appendChild(u), t.isDrafting)
|
|
2573
2527
|
p.appendChild(c);
|
|
2574
2528
|
else {
|
|
2575
2529
|
const d = document.createElement("button");
|
|
2576
2530
|
d.type = "button", d.className = "pluno-pa-widget__share-prompt-dismiss", d.setAttribute("aria-label", "Dismiss share prompt"), d.title = "Dismiss", d.textContent = "Dismiss", d.addEventListener("click", () => {
|
|
2577
2531
|
t.onDismiss(e);
|
|
2578
2532
|
}), c.appendChild(d), p.appendChild(c);
|
|
2579
|
-
const
|
|
2580
|
-
|
|
2533
|
+
const g = document.createElement("button");
|
|
2534
|
+
g.type = "button", g.className = "pluno-pa-widget__share-prompt-disable", g.textContent = "Don't ask again", g.addEventListener("click", () => {
|
|
2581
2535
|
t.onDisable(e);
|
|
2582
|
-
}), p.appendChild(
|
|
2536
|
+
}), p.appendChild(g);
|
|
2583
2537
|
}
|
|
2584
|
-
return
|
|
2538
|
+
return n.appendChild(p), o.appendChild(n), o;
|
|
2585
2539
|
}
|
|
2586
2540
|
function Ji(e, t) {
|
|
2587
|
-
const
|
|
2588
|
-
|
|
2589
|
-
|
|
2541
|
+
const o = document.createElement("div");
|
|
2542
|
+
o.className = "pluno-pa-widget__share-dialog-backdrop", o.addEventListener("click", (x) => {
|
|
2543
|
+
x.target === o && t.onClose();
|
|
2590
2544
|
});
|
|
2591
|
-
const
|
|
2592
|
-
|
|
2545
|
+
const n = document.createElement("section");
|
|
2546
|
+
n.className = "pluno-pa-widget__share-dialog", n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "true"), n.setAttribute("aria-label", "Draft a social post");
|
|
2593
2547
|
const i = document.createElement("header"), a = document.createElement("strong");
|
|
2594
2548
|
a.textContent = "Share this win", i.appendChild(a);
|
|
2595
2549
|
const l = document.createElement("button");
|
|
2596
|
-
l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), i.appendChild(l),
|
|
2550
|
+
l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), i.appendChild(l), n.appendChild(i);
|
|
2597
2551
|
const p = document.createElement("p");
|
|
2598
2552
|
p.className = "pluno-pa-widget__share-dialog-status", p.hidden = !0;
|
|
2599
2553
|
const c = document.createElement("div");
|
|
@@ -2602,53 +2556,53 @@ function Ji(e, t) {
|
|
|
2602
2556
|
u.className = "pluno-pa-widget__share-dialog-step-header";
|
|
2603
2557
|
const d = document.createElement("strong");
|
|
2604
2558
|
d.textContent = "1) Copy Screenshot", u.appendChild(d);
|
|
2605
|
-
const
|
|
2559
|
+
const g = Qi(
|
|
2606
2560
|
"Copy Screenshot",
|
|
2607
2561
|
async () => {
|
|
2608
2562
|
try {
|
|
2609
|
-
return await
|
|
2563
|
+
return await ro(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
2610
2564
|
} catch {
|
|
2611
2565
|
return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
|
|
2612
2566
|
}
|
|
2613
2567
|
}
|
|
2614
2568
|
);
|
|
2615
|
-
if (u.appendChild(
|
|
2616
|
-
const
|
|
2617
|
-
|
|
2618
|
-
const
|
|
2619
|
-
|
|
2569
|
+
if (u.appendChild(g), c.appendChild(u), e.screenshotDataUrl) {
|
|
2570
|
+
const x = document.createElement("div");
|
|
2571
|
+
x.className = "pluno-pa-widget__share-dialog-screenshot";
|
|
2572
|
+
const v = document.createElement("img");
|
|
2573
|
+
v.src = e.screenshotDataUrl, v.alt = "Product page with Pluno open", x.appendChild(v), c.appendChild(x);
|
|
2620
2574
|
}
|
|
2621
|
-
|
|
2622
|
-
const
|
|
2623
|
-
|
|
2624
|
-
const
|
|
2625
|
-
|
|
2626
|
-
const
|
|
2627
|
-
|
|
2628
|
-
const
|
|
2629
|
-
|
|
2630
|
-
for (const
|
|
2631
|
-
const
|
|
2632
|
-
|
|
2575
|
+
n.appendChild(c), n.appendChild(p);
|
|
2576
|
+
const S = document.createElement("div");
|
|
2577
|
+
S.className = "pluno-pa-widget__share-dialog-step";
|
|
2578
|
+
const f = document.createElement("strong");
|
|
2579
|
+
f.className = "pluno-pa-widget__share-dialog-step-title", f.textContent = "2) Share on", S.appendChild(f);
|
|
2580
|
+
const F = document.createElement("p");
|
|
2581
|
+
F.className = "pluno-pa-widget__share-dialog-hint", F.textContent = "Post draft opens prefilled on supported platforms.", S.appendChild(F);
|
|
2582
|
+
const k = document.createElement("footer");
|
|
2583
|
+
k.className = "pluno-pa-widget__share-dialog-platforms";
|
|
2584
|
+
for (const x of ea(e)) {
|
|
2585
|
+
const v = document.createElement("a");
|
|
2586
|
+
v.href = x.href, v.target = "_blank", v.rel = "noopener noreferrer", v.title = x.label, v.setAttribute("aria-label", `Open ${x.label}`), v.appendChild(ta(x.id)), k.appendChild(v);
|
|
2633
2587
|
}
|
|
2634
|
-
if (
|
|
2635
|
-
const
|
|
2636
|
-
|
|
2637
|
-
const
|
|
2638
|
-
|
|
2639
|
-
const
|
|
2640
|
-
|
|
2588
|
+
if (S.appendChild(k), n.appendChild(S), t.socialPostRewardsUrl) {
|
|
2589
|
+
const x = document.createElement("div");
|
|
2590
|
+
x.className = "pluno-pa-widget__share-dialog-step";
|
|
2591
|
+
const v = document.createElement("strong");
|
|
2592
|
+
v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "3) Submit post to get 2000 free credits!", x.appendChild(v);
|
|
2593
|
+
const h = document.createElement("a");
|
|
2594
|
+
h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(na()), x.appendChild(h), n.appendChild(x);
|
|
2641
2595
|
}
|
|
2642
|
-
return
|
|
2596
|
+
return o.appendChild(n), o;
|
|
2643
2597
|
}
|
|
2644
2598
|
function Qi(e, t) {
|
|
2645
|
-
const
|
|
2646
|
-
return
|
|
2647
|
-
|
|
2648
|
-
}),
|
|
2599
|
+
const o = document.createElement("button");
|
|
2600
|
+
return o.type = "button", o.className = "pluno-pa-widget__share-dialog-copy", o.textContent = e, o.addEventListener("click", async (n) => {
|
|
2601
|
+
n.preventDefault(), n.stopPropagation(), await t() && (o.textContent = "Copied ✓");
|
|
2602
|
+
}), o;
|
|
2649
2603
|
}
|
|
2650
2604
|
function ea(e) {
|
|
2651
|
-
const t = e.linkedinPost.trim(),
|
|
2605
|
+
const t = e.linkedinPost.trim(), o = e.xPost.trim();
|
|
2652
2606
|
return [
|
|
2653
2607
|
{
|
|
2654
2608
|
id: "linkedin",
|
|
@@ -2658,7 +2612,7 @@ function ea(e) {
|
|
|
2658
2612
|
{
|
|
2659
2613
|
id: "x",
|
|
2660
2614
|
label: "X",
|
|
2661
|
-
href: `https://twitter.com/intent/tweet?text=${encodeURIComponent(
|
|
2615
|
+
href: `https://twitter.com/intent/tweet?text=${encodeURIComponent(o)}`
|
|
2662
2616
|
},
|
|
2663
2617
|
{
|
|
2664
2618
|
id: "instagram",
|
|
@@ -2690,9 +2644,9 @@ function ta(e) {
|
|
|
2690
2644
|
"M22 10.7c.3-.1.7 0 .9.3.2.4.1.8-.2 1-.4.2-.8.1-1-.2-.2-.4-.1-.8.3-1.1Z"
|
|
2691
2645
|
), t);
|
|
2692
2646
|
}
|
|
2693
|
-
function U(e, t,
|
|
2694
|
-
const
|
|
2695
|
-
|
|
2647
|
+
function U(e, t, o) {
|
|
2648
|
+
const n = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2649
|
+
n.setAttribute("d", t), o && n.setAttribute("opacity", o), e.appendChild(n);
|
|
2696
2650
|
}
|
|
2697
2651
|
function na() {
|
|
2698
2652
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
@@ -2701,43 +2655,43 @@ function na() {
|
|
|
2701
2655
|
"M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
|
|
2702
2656
|
), e;
|
|
2703
2657
|
}
|
|
2704
|
-
function
|
|
2705
|
-
return e.role === "tool" && e.toolName ===
|
|
2658
|
+
function Rn(e) {
|
|
2659
|
+
return e.role === "tool" && e.toolName === bn;
|
|
2706
2660
|
}
|
|
2707
2661
|
function oa(e) {
|
|
2708
2662
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
2709
2663
|
}
|
|
2710
|
-
function ia(e, t,
|
|
2664
|
+
function ia(e, t, o, n) {
|
|
2711
2665
|
const i = document.createElement("article");
|
|
2712
2666
|
i.className = "pluno-pa-widget__tool-group", i.title = new Date(
|
|
2713
2667
|
e[e.length - 1].createdAt
|
|
2714
2668
|
).toLocaleString(), i.appendChild(
|
|
2715
2669
|
se(
|
|
2716
2670
|
"pluno-pa-widget__character--tool-group",
|
|
2717
|
-
|
|
2671
|
+
n
|
|
2718
2672
|
)
|
|
2719
2673
|
);
|
|
2720
2674
|
const a = document.createElement("details"), l = aa(e);
|
|
2721
2675
|
a.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", a.open), a.addEventListener("toggle", () => {
|
|
2722
|
-
i.classList.toggle("pluno-pa-widget__tool-group--open", a.open), a.open ? t.add(l) : t.delete(l),
|
|
2676
|
+
i.classList.toggle("pluno-pa-widget__tool-group--open", a.open), a.open ? t.add(l) : t.delete(l), o();
|
|
2723
2677
|
});
|
|
2724
2678
|
const p = document.createElement("summary");
|
|
2725
|
-
p.className = "pluno-pa-widget__tool-summary", e.some((d) => d.loading) && p.appendChild(
|
|
2679
|
+
p.className = "pluno-pa-widget__tool-summary", e.some((d) => d.loading) && p.appendChild(xt());
|
|
2726
2680
|
const u = document.createElement("span");
|
|
2727
2681
|
if (u.className = "pluno-pa-widget__tool-summary-title", u.textContent = e[e.length - 1].content || "Run tool", p.appendChild(u), a.appendChild(p), e.length > 0) {
|
|
2728
2682
|
const d = document.createElement("div");
|
|
2729
2683
|
d.className = "pluno-pa-widget__tool-lines";
|
|
2730
|
-
for (const
|
|
2731
|
-
const
|
|
2732
|
-
|
|
2733
|
-
const
|
|
2734
|
-
|
|
2684
|
+
for (const g of e) {
|
|
2685
|
+
const S = document.createElement("div");
|
|
2686
|
+
S.className = "pluno-pa-widget__tool-line", g.loading && S.appendChild(xt());
|
|
2687
|
+
const f = document.createElement("span");
|
|
2688
|
+
f.textContent = g.content || "Run tool", S.appendChild(f), d.appendChild(S);
|
|
2735
2689
|
}
|
|
2736
2690
|
a.appendChild(d);
|
|
2737
2691
|
}
|
|
2738
2692
|
return i.appendChild(a), i;
|
|
2739
2693
|
}
|
|
2740
|
-
function
|
|
2694
|
+
function Mn(e) {
|
|
2741
2695
|
const t = document.createElement("article");
|
|
2742
2696
|
return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
|
|
2743
2697
|
se(
|
|
@@ -2746,89 +2700,89 @@ function Tn(e) {
|
|
|
2746
2700
|
)
|
|
2747
2701
|
), t;
|
|
2748
2702
|
}
|
|
2749
|
-
function
|
|
2750
|
-
const t =
|
|
2751
|
-
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(
|
|
2703
|
+
function sn(e) {
|
|
2704
|
+
const t = Mn(e);
|
|
2705
|
+
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(_t()), t;
|
|
2752
2706
|
}
|
|
2753
|
-
function
|
|
2707
|
+
function _t() {
|
|
2754
2708
|
const e = document.createElement("div");
|
|
2755
2709
|
e.className = "pluno-pa-widget__status";
|
|
2756
2710
|
const t = document.createElement("span");
|
|
2757
2711
|
t.className = "pluno-pa-widget__thinking-dot", t.setAttribute("aria-hidden", "true"), e.appendChild(t);
|
|
2758
|
-
const
|
|
2759
|
-
return
|
|
2712
|
+
const o = document.createElement("span");
|
|
2713
|
+
return o.textContent = "Thinking...", e.appendChild(o), e;
|
|
2760
2714
|
}
|
|
2761
2715
|
function aa(e) {
|
|
2762
2716
|
return `tools:${e[0]?.id ?? ""}`;
|
|
2763
2717
|
}
|
|
2764
|
-
function
|
|
2718
|
+
function xt() {
|
|
2765
2719
|
const e = document.createElement("span");
|
|
2766
2720
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
2767
2721
|
}
|
|
2768
|
-
function
|
|
2769
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
2722
|
+
function zn(e, t) {
|
|
2723
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Ni() : An());
|
|
2770
2724
|
}
|
|
2771
2725
|
function ra(e, t) {
|
|
2772
|
-
const
|
|
2726
|
+
const o = t.replace(/\r\n/g, `
|
|
2773
2727
|
`).split(`
|
|
2774
2728
|
`);
|
|
2775
|
-
let
|
|
2776
|
-
for (;
|
|
2777
|
-
const i = n
|
|
2729
|
+
let n = 0;
|
|
2730
|
+
for (; n < o.length; ) {
|
|
2731
|
+
const i = o[n];
|
|
2778
2732
|
if (!i.trim()) {
|
|
2779
|
-
|
|
2733
|
+
n += 1;
|
|
2780
2734
|
continue;
|
|
2781
2735
|
}
|
|
2782
2736
|
if (i.match(/^```(\w+)?\s*$/)) {
|
|
2783
2737
|
const u = [];
|
|
2784
|
-
for (
|
|
2785
|
-
u.push(n
|
|
2786
|
-
|
|
2787
|
-
const d = document.createElement("pre"),
|
|
2788
|
-
|
|
2789
|
-
`), d.appendChild(
|
|
2738
|
+
for (n += 1; n < o.length && !/^```\s*$/.test(o[n]); )
|
|
2739
|
+
u.push(o[n]), n += 1;
|
|
2740
|
+
n += n < o.length ? 1 : 0;
|
|
2741
|
+
const d = document.createElement("pre"), g = document.createElement("code");
|
|
2742
|
+
g.textContent = u.join(`
|
|
2743
|
+
`), d.appendChild(g), e.appendChild(d);
|
|
2790
2744
|
continue;
|
|
2791
2745
|
}
|
|
2792
2746
|
const l = i.match(/^(#{1,3})\s+(.+)$/);
|
|
2793
2747
|
if (l) {
|
|
2794
2748
|
const u = document.createElement(`h${l[1].length + 2}`);
|
|
2795
|
-
|
|
2749
|
+
We(u, l[2]), e.appendChild(u), n += 1;
|
|
2796
2750
|
continue;
|
|
2797
2751
|
}
|
|
2798
2752
|
if (/^\s*[-*+]\s+/.test(i)) {
|
|
2799
2753
|
const u = document.createElement("ul");
|
|
2800
|
-
for (;
|
|
2754
|
+
for (; n < o.length && /^\s*[-*+]\s+/.test(o[n]); ) {
|
|
2801
2755
|
const d = document.createElement("li");
|
|
2802
|
-
|
|
2756
|
+
We(d, o[n].replace(/^\s*[-*+]\s+/, "")), u.appendChild(d), n += 1;
|
|
2803
2757
|
}
|
|
2804
2758
|
e.appendChild(u);
|
|
2805
2759
|
continue;
|
|
2806
2760
|
}
|
|
2807
2761
|
if (/^\s*\d+\.\s+/.test(i)) {
|
|
2808
2762
|
const u = document.createElement("ol");
|
|
2809
|
-
for (;
|
|
2763
|
+
for (; n < o.length && /^\s*\d+\.\s+/.test(o[n]); ) {
|
|
2810
2764
|
const d = document.createElement("li");
|
|
2811
|
-
|
|
2765
|
+
We(d, o[n].replace(/^\s*\d+\.\s+/, "")), u.appendChild(d), n += 1;
|
|
2812
2766
|
}
|
|
2813
2767
|
e.appendChild(u);
|
|
2814
2768
|
continue;
|
|
2815
2769
|
}
|
|
2816
2770
|
const p = [i];
|
|
2817
|
-
for (
|
|
2818
|
-
p.push(n
|
|
2771
|
+
for (n += 1; n < o.length && o[n].trim() && !/^```/.test(o[n]) && !/^(#{1,3})\s+/.test(o[n]) && !/^\s*[-*+]\s+/.test(o[n]) && !/^\s*\d+\.\s+/.test(o[n]); )
|
|
2772
|
+
p.push(o[n]), n += 1;
|
|
2819
2773
|
const c = document.createElement("p");
|
|
2820
2774
|
p.forEach((u, d) => {
|
|
2821
|
-
d > 0 && c.appendChild(document.createElement("br")),
|
|
2775
|
+
d > 0 && c.appendChild(document.createElement("br")), We(c, u);
|
|
2822
2776
|
}), e.appendChild(c);
|
|
2823
2777
|
}
|
|
2824
2778
|
}
|
|
2825
|
-
function
|
|
2826
|
-
const
|
|
2827
|
-
let
|
|
2828
|
-
for (const i of t.matchAll(
|
|
2779
|
+
function We(e, t) {
|
|
2780
|
+
const o = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
2781
|
+
let n = 0;
|
|
2782
|
+
for (const i of t.matchAll(o)) {
|
|
2829
2783
|
const a = i.index ?? 0;
|
|
2830
|
-
a >
|
|
2831
|
-
document.createTextNode(t.slice(
|
|
2784
|
+
a > n && e.appendChild(
|
|
2785
|
+
document.createTextNode(t.slice(n, a))
|
|
2832
2786
|
);
|
|
2833
2787
|
const l = i[0];
|
|
2834
2788
|
if (l.startsWith("`")) {
|
|
@@ -2848,9 +2802,9 @@ function Ue(e, t) {
|
|
|
2848
2802
|
} else
|
|
2849
2803
|
e.appendChild(document.createTextNode(l));
|
|
2850
2804
|
}
|
|
2851
|
-
|
|
2805
|
+
n = a + l.length;
|
|
2852
2806
|
}
|
|
2853
|
-
|
|
2807
|
+
n < t.length && e.appendChild(document.createTextNode(t.slice(n)));
|
|
2854
2808
|
}
|
|
2855
2809
|
function la(e) {
|
|
2856
2810
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
@@ -2862,10 +2816,10 @@ function la(e) {
|
|
|
2862
2816
|
return !1;
|
|
2863
2817
|
}
|
|
2864
2818
|
}
|
|
2865
|
-
function
|
|
2819
|
+
function dn(e, t) {
|
|
2866
2820
|
if (pa(e))
|
|
2867
2821
|
return;
|
|
2868
|
-
const
|
|
2822
|
+
const o = `
|
|
2869
2823
|
:host {
|
|
2870
2824
|
all: initial;
|
|
2871
2825
|
color-scheme: light;
|
|
@@ -3508,12 +3462,14 @@ function rn(e, t) {
|
|
|
3508
3462
|
margin-top: 8px;
|
|
3509
3463
|
max-width: 220px;
|
|
3510
3464
|
}
|
|
3511
|
-
.pluno-pa-widget__message-
|
|
3465
|
+
.pluno-pa-widget__message-attachment-preview {
|
|
3512
3466
|
width: 100%;
|
|
3513
3467
|
aspect-ratio: 1;
|
|
3514
3468
|
border-radius: 8px;
|
|
3515
3469
|
object-fit: cover;
|
|
3516
3470
|
border: 1px solid var(--pluno-pa-divider);
|
|
3471
|
+
background: var(--pluno-pa-surface);
|
|
3472
|
+
overflow: hidden;
|
|
3517
3473
|
}
|
|
3518
3474
|
.pluno-pa-widget__message-attachment-file {
|
|
3519
3475
|
min-width: 0;
|
|
@@ -4199,7 +4155,8 @@ function rn(e, t) {
|
|
|
4199
4155
|
padding: 3px 5px 3px 3px;
|
|
4200
4156
|
font-size: 12px;
|
|
4201
4157
|
}
|
|
4202
|
-
.pluno-pa-widget__attachment img
|
|
4158
|
+
.pluno-pa-widget__attachment img,
|
|
4159
|
+
.pluno-pa-widget__attachment video {
|
|
4203
4160
|
width: 22px;
|
|
4204
4161
|
height: 22px;
|
|
4205
4162
|
border-radius: 5px;
|
|
@@ -4968,23 +4925,23 @@ function rn(e, t) {
|
|
|
4968
4925
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
4969
4926
|
}
|
|
4970
4927
|
`;
|
|
4971
|
-
if (sa(e,
|
|
4928
|
+
if (sa(e, o))
|
|
4972
4929
|
return;
|
|
4973
|
-
const
|
|
4974
|
-
|
|
4930
|
+
const n = e.ownerDocument.createElement("style");
|
|
4931
|
+
n.id = yn, n.textContent = o, e.appendChild(n), Bn(e);
|
|
4975
4932
|
}
|
|
4976
4933
|
function pa(e) {
|
|
4977
|
-
return e.getElementById(
|
|
4934
|
+
return e.getElementById(yn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Cn) === "true";
|
|
4978
4935
|
}
|
|
4979
|
-
function
|
|
4980
|
-
e.host instanceof HTMLElement && e.host.setAttribute(
|
|
4936
|
+
function Bn(e) {
|
|
4937
|
+
e.host instanceof HTMLElement && e.host.setAttribute(Cn, "true");
|
|
4981
4938
|
}
|
|
4982
4939
|
function sa(e, t) {
|
|
4983
4940
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
4984
4941
|
return !1;
|
|
4985
4942
|
try {
|
|
4986
|
-
const
|
|
4987
|
-
return
|
|
4943
|
+
const o = new CSSStyleSheet();
|
|
4944
|
+
return o.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, o], Bn(e), !0;
|
|
4988
4945
|
} catch {
|
|
4989
4946
|
return !1;
|
|
4990
4947
|
}
|
|
@@ -4997,34 +4954,34 @@ async function da() {
|
|
|
4997
4954
|
t.observe(document.documentElement, { childList: !0 });
|
|
4998
4955
|
});
|
|
4999
4956
|
}
|
|
5000
|
-
function
|
|
4957
|
+
function Un(e) {
|
|
5001
4958
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
5002
4959
|
}
|
|
5003
4960
|
function ca(e) {
|
|
5004
4961
|
try {
|
|
5005
|
-
const t = window.localStorage.getItem(
|
|
4962
|
+
const t = window.localStorage.getItem(Un(e));
|
|
5006
4963
|
if (!t)
|
|
5007
|
-
return
|
|
5008
|
-
const
|
|
4964
|
+
return cn();
|
|
4965
|
+
const o = JSON.parse(t);
|
|
5009
4966
|
return {
|
|
5010
|
-
isOpen:
|
|
5011
|
-
composerValue: typeof
|
|
5012
|
-
openToolGroupKeys: Array.isArray(
|
|
5013
|
-
(
|
|
4967
|
+
isOpen: o.isOpen === !0,
|
|
4968
|
+
composerValue: typeof o.composerValue == "string" ? o.composerValue : "",
|
|
4969
|
+
openToolGroupKeys: Array.isArray(o.openToolGroupKeys) ? o.openToolGroupKeys.filter(
|
|
4970
|
+
(n) => typeof n == "string"
|
|
5014
4971
|
) : [],
|
|
5015
|
-
launcherPosition: ma(
|
|
5016
|
-
seenShareCandidateIds: Array.isArray(
|
|
5017
|
-
sharePromptsDisabled:
|
|
4972
|
+
launcherPosition: ma(o.launcherPosition) ? o.launcherPosition : null,
|
|
4973
|
+
seenShareCandidateIds: Array.isArray(o.seenShareCandidateIds) ? o.seenShareCandidateIds.filter((n) => typeof n == "string").slice(-fn) : [],
|
|
4974
|
+
sharePromptsDisabled: o.sharePromptsDisabled === !0
|
|
5018
4975
|
};
|
|
5019
4976
|
} catch {
|
|
5020
|
-
return
|
|
4977
|
+
return cn();
|
|
5021
4978
|
}
|
|
5022
4979
|
}
|
|
5023
4980
|
async function ua(e) {
|
|
5024
4981
|
if (e.loadSharePromptsDisabled)
|
|
5025
4982
|
return e.loadSharePromptsDisabled();
|
|
5026
4983
|
try {
|
|
5027
|
-
return window.localStorage.getItem(
|
|
4984
|
+
return window.localStorage.getItem(wn) === "true";
|
|
5028
4985
|
} catch {
|
|
5029
4986
|
return !1;
|
|
5030
4987
|
}
|
|
@@ -5038,12 +4995,12 @@ function ga(e, t) {
|
|
|
5038
4995
|
return;
|
|
5039
4996
|
}
|
|
5040
4997
|
try {
|
|
5041
|
-
t && window.localStorage.setItem(
|
|
4998
|
+
t && window.localStorage.setItem(wn, "true");
|
|
5042
4999
|
} catch {
|
|
5043
5000
|
return;
|
|
5044
5001
|
}
|
|
5045
5002
|
}
|
|
5046
|
-
function
|
|
5003
|
+
function cn() {
|
|
5047
5004
|
return {
|
|
5048
5005
|
isOpen: !1,
|
|
5049
5006
|
composerValue: "",
|
|
@@ -5056,7 +5013,7 @@ function ln() {
|
|
|
5056
5013
|
function ha(e, t) {
|
|
5057
5014
|
try {
|
|
5058
5015
|
window.localStorage.setItem(
|
|
5059
|
-
|
|
5016
|
+
Un(e),
|
|
5060
5017
|
JSON.stringify(t)
|
|
5061
5018
|
);
|
|
5062
5019
|
} catch {
|
|
@@ -5069,31 +5026,31 @@ function ma(e) {
|
|
|
5069
5026
|
const t = e;
|
|
5070
5027
|
return Number.isFinite(t.x) && Number.isFinite(t.y) && (t.anchor === "top-left" || t.anchor === "top-right" || t.anchor === "bottom-left" || t.anchor === "bottom-right");
|
|
5071
5028
|
}
|
|
5072
|
-
const
|
|
5029
|
+
const un = /* @__PURE__ */ new WeakSet();
|
|
5073
5030
|
function ba(e) {
|
|
5074
5031
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
5075
5032
|
}
|
|
5076
|
-
function
|
|
5033
|
+
function gn(e) {
|
|
5077
5034
|
const t = e.pathname.split("/");
|
|
5078
5035
|
return t[t.length - 1] ?? "";
|
|
5079
5036
|
}
|
|
5080
5037
|
function fa(e, t) {
|
|
5081
|
-
const
|
|
5082
|
-
return
|
|
5038
|
+
const o = new URL(e.src, document.baseURI);
|
|
5039
|
+
return o.href === t.href || o.pathname === t.pathname ? !0 : gn(o) === gn(t);
|
|
5083
5040
|
}
|
|
5084
5041
|
class oe extends EventTarget {
|
|
5085
|
-
constructor(t,
|
|
5086
|
-
super(), this.channelId =
|
|
5042
|
+
constructor(t, o) {
|
|
5043
|
+
super(), this.channelId = o, this.url = t, this.addPreviewListener(So, () => {
|
|
5087
5044
|
this.readyState = oe.OPEN, this.dispatchEvent(new Event("open"));
|
|
5088
|
-
}), this.addPreviewListener(
|
|
5089
|
-
const i =
|
|
5045
|
+
}), this.addPreviewListener(Eo, (n) => {
|
|
5046
|
+
const i = n;
|
|
5090
5047
|
this.dispatchEvent(
|
|
5091
5048
|
new MessageEvent("message", { data: i.detail?.data ?? "" })
|
|
5092
5049
|
);
|
|
5093
|
-
}), this.addPreviewListener(
|
|
5050
|
+
}), this.addPreviewListener(ko, () => {
|
|
5094
5051
|
this.readyState = oe.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
5095
|
-
}), this.addPreviewListener(
|
|
5096
|
-
const i =
|
|
5052
|
+
}), this.addPreviewListener(Lo, (n) => {
|
|
5053
|
+
const i = n;
|
|
5097
5054
|
this.readyState = oe.CLOSED, this.dispatchEvent(
|
|
5098
5055
|
new CloseEvent("close", {
|
|
5099
5056
|
code: i.detail?.code ?? 1e3,
|
|
@@ -5103,8 +5060,8 @@ class oe extends EventTarget {
|
|
|
5103
5060
|
), this.cleanup();
|
|
5104
5061
|
}), window.dispatchEvent(
|
|
5105
5062
|
new CustomEvent(
|
|
5106
|
-
|
|
5107
|
-
|
|
5063
|
+
Ge(
|
|
5064
|
+
vo,
|
|
5108
5065
|
this.channelId
|
|
5109
5066
|
),
|
|
5110
5067
|
{
|
|
@@ -5134,7 +5091,7 @@ class oe extends EventTarget {
|
|
|
5134
5091
|
);
|
|
5135
5092
|
window.dispatchEvent(
|
|
5136
5093
|
new CustomEvent(
|
|
5137
|
-
|
|
5094
|
+
Ge(yo, this.channelId),
|
|
5138
5095
|
{
|
|
5139
5096
|
detail: {
|
|
5140
5097
|
socketId: this.socketId,
|
|
@@ -5144,78 +5101,78 @@ class oe extends EventTarget {
|
|
|
5144
5101
|
)
|
|
5145
5102
|
);
|
|
5146
5103
|
}
|
|
5147
|
-
close(t,
|
|
5104
|
+
close(t, o) {
|
|
5148
5105
|
this.readyState !== oe.CLOSED && (this.readyState = oe.CLOSING, window.dispatchEvent(
|
|
5149
5106
|
new CustomEvent(
|
|
5150
|
-
|
|
5107
|
+
Ge(Co, this.channelId),
|
|
5151
5108
|
{
|
|
5152
|
-
detail: { socketId: this.socketId, code: t, reason:
|
|
5109
|
+
detail: { socketId: this.socketId, code: t, reason: o }
|
|
5153
5110
|
}
|
|
5154
5111
|
)
|
|
5155
5112
|
), this.cleanup());
|
|
5156
5113
|
}
|
|
5157
|
-
addPreviewListener(t,
|
|
5158
|
-
const
|
|
5114
|
+
addPreviewListener(t, o) {
|
|
5115
|
+
const n = Ge(
|
|
5159
5116
|
t,
|
|
5160
5117
|
this.channelId
|
|
5161
5118
|
), i = (a) => {
|
|
5162
|
-
a.detail?.socketId === this.socketId &&
|
|
5119
|
+
a.detail?.socketId === this.socketId && o(a);
|
|
5163
5120
|
};
|
|
5164
|
-
this.listeners.set(
|
|
5121
|
+
this.listeners.set(n, i), window.addEventListener(n, i);
|
|
5165
5122
|
}
|
|
5166
5123
|
cleanup() {
|
|
5167
|
-
for (const [t,
|
|
5168
|
-
window.removeEventListener(t,
|
|
5124
|
+
for (const [t, o] of this.listeners.entries())
|
|
5125
|
+
window.removeEventListener(t, o);
|
|
5169
5126
|
this.listeners.clear();
|
|
5170
5127
|
}
|
|
5171
5128
|
}
|
|
5172
5129
|
function wa() {
|
|
5173
5130
|
const e = window.sessionStorage.getItem(
|
|
5174
|
-
|
|
5131
|
+
Ht
|
|
5175
5132
|
);
|
|
5176
5133
|
if (e)
|
|
5177
5134
|
return e;
|
|
5178
5135
|
const t = crypto.randomUUID();
|
|
5179
|
-
return window.sessionStorage.setItem(
|
|
5136
|
+
return window.sessionStorage.setItem(Ht, t), t;
|
|
5180
5137
|
}
|
|
5181
|
-
function
|
|
5138
|
+
function Ge(e, t) {
|
|
5182
5139
|
return `${e}:${t}`;
|
|
5183
5140
|
}
|
|
5184
5141
|
function _a(e) {
|
|
5185
5142
|
const t = document.currentScript;
|
|
5186
5143
|
if (t instanceof HTMLScriptElement)
|
|
5187
5144
|
return [t];
|
|
5188
|
-
const
|
|
5145
|
+
const o = new URL(e, document.baseURI).href, n = new URL(o);
|
|
5189
5146
|
return Array.from(
|
|
5190
5147
|
document.querySelectorAll("script[type='module'][src]")
|
|
5191
5148
|
).filter(
|
|
5192
|
-
(i) => i instanceof HTMLScriptElement && ba(i) && fa(i,
|
|
5149
|
+
(i) => i instanceof HTMLScriptElement && ba(i) && fa(i, n)
|
|
5193
5150
|
);
|
|
5194
5151
|
}
|
|
5195
5152
|
function xa(e) {
|
|
5196
5153
|
for (const t of _a(e)) {
|
|
5197
|
-
if (
|
|
5154
|
+
if (un.has(t) || t.dataset.plunoAutoMount === "false")
|
|
5198
5155
|
continue;
|
|
5199
|
-
|
|
5200
|
-
const
|
|
5201
|
-
|
|
5156
|
+
un.add(t);
|
|
5157
|
+
const o = t.dataset.plunoPreviewChannel;
|
|
5158
|
+
Xo({
|
|
5202
5159
|
token: t.dataset.plunoToken,
|
|
5203
5160
|
tokenEndpoint: t.dataset.plunoTokenEndpoint,
|
|
5204
5161
|
backendUrl: t.dataset.plunoBackendUrl,
|
|
5205
|
-
webSocketFactory:
|
|
5162
|
+
webSocketFactory: o ? Yo(o) : void 0,
|
|
5206
5163
|
launcherLabel: t.dataset.plunoLauncherLabel,
|
|
5207
5164
|
accentColor: t.dataset.plunoAccentColor,
|
|
5208
5165
|
colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
5209
5166
|
fontFamily: t.dataset.plunoFontFamily,
|
|
5210
5167
|
scribbleStyle: t.dataset.plunoScribbleStyle === "true",
|
|
5211
5168
|
position: t.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
|
|
5212
|
-
}).catch((
|
|
5213
|
-
console.error("Failed to mount Pluno widget",
|
|
5169
|
+
}).catch((n) => {
|
|
5170
|
+
console.error("Failed to mount Pluno widget", n);
|
|
5214
5171
|
});
|
|
5215
5172
|
}
|
|
5216
5173
|
}
|
|
5217
5174
|
xa(import.meta.url);
|
|
5218
5175
|
export {
|
|
5219
|
-
|
|
5220
|
-
|
|
5176
|
+
Yo as createProductAgentPreviewBridgeWebSocketFactory,
|
|
5177
|
+
Xo as mountPlunoProductAgentWidget
|
|
5221
5178
|
};
|